monocart-reporter 2.0.4 → 2.1.1

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.
@@ -13,7 +13,7 @@ ${d}`),s?r.reset(d):d}function ku(i,t,e,s={}){if(!ta){ta=!0;let a="Passing lineN
13
13
  `);case 114:return o("\r");case 120:{let l;return{code:l,pos:t}=Ds(i,t,e,s,2,!1,n,a),o(l===null?null:String.fromCharCode(l))}case 117:{let l;return{code:l,pos:t}=Oa(i,t,e,s,n,a),o(l===null?null:String.fromCodePoint(l))}case 116:return o(" ");case 98:return o("\b");case 118:return o("\v");case 102:return o("\f");case 13:i.charCodeAt(t)===10&&++t;case 10:e=t,++s;case 8232:case 8233:return o("");case 56:case 57:if(r)return o(null);a.strictNumericEscape(t-1,e,s);default:if(u>=48&&u<=55){let l=t-1,p=i.slice(l,t+2).match(/^[0-7]+/)[0],f=parseInt(p,8);f>255&&(p=p.slice(0,-1),f=parseInt(p,8)),t+=p.length-1;let m=i.charCodeAt(t);if(p!=="0"||m===56||m===57){if(r)return o(null);a.strictNumericEscape(l,e,s)}return o(String.fromCharCode(f))}return o(String.fromCharCode(u))}}function Ds(i,t,e,s,r,a,n,o){let u=t,l;return{n:l,pos:t}=_a(i,t,e,s,16,r,a,!1,o,!n),l===null&&(n?o.invalidEscapeSequence(u,e,s):t=u-1),{code:l,pos:t}}function _a(i,t,e,s,r,a,n,o,u,l){let c=t,p=r===16?pa.hex:pa.decBinOct,f=r===16?Bt.hex:r===10?Bt.dec:r===8?Bt.oct:Bt.bin,m=!1,d=0;for(let y=0,v=a??1/0;y<v;++y){let S=i.charCodeAt(t),_;if(S===95&&o!=="bail"){let U=i.charCodeAt(t-1),B=i.charCodeAt(t+1);if(o){if(Number.isNaN(B)||!f(B)||p.has(U)||p.has(B)){if(l)return{n:null,pos:t};u.unexpectedNumericSeparator(t,e,s)}}else{if(l)return{n:null,pos:t};u.numericSeparatorInEscapeSequence(t,e,s)}++t;continue}if(S>=97?_=S-97+10:S>=65?_=S-65+10:cl(S)?_=S-48:_=1/0,_>=r){if(_<=9&&l)return{n:null,pos:t};if(_<=9&&u.invalidDigit(t,e,s,r))_=0;else if(n)_=0,m=!0;else break}++t,d=d*r+_}return t===c||a!=null&&t-c!==a||m?{n:null,pos:t}:{n:d,pos:t}}function Oa(i,t,e,s,r,a){let n=i.charCodeAt(t),o;if(n===123){if(++t,{code:o,pos:t}=Ds(i,t,e,s,i.indexOf("}",t)-t,!0,r,a),++t,o!==null&&o>1114111)if(r)a.invalidCodePoint(t,e,s);else return{code:null,pos:t}}else({code:o,pos:t}=Ds(i,t,e,s,4,!1,r,a));return{code:o,pos:t}}var fl=["at"],dl=["at"];function et(i,t,e){return new Z(e,i-t,i)}var ml=new Set([103,109,115,105,121,117,100,118]),Q=class{constructor(t){this.type=t.type,this.value=t.value,this.start=t.start,this.end=t.end,this.loc=new Fe(t.startLoc,t.endLoc)}},Bs=class extends Ms{constructor(t,e){super(),this.isLookahead=void 0,this.tokens=[],this.errorHandlers_readInt={invalidDigit:(s,r,a,n)=>this.options.errorRecovery?(this.raise(h.InvalidDigit,{at:et(s,r,a),radix:n}),!0):!1,numericSeparatorInEscapeSequence:this.errorBuilder(h.NumericSeparatorInEscapeSequence),unexpectedNumericSeparator:this.errorBuilder(h.UnexpectedNumericSeparator)},this.errorHandlers_readCodePoint=Object.assign({},this.errorHandlers_readInt,{invalidEscapeSequence:this.errorBuilder(h.InvalidEscapeSequence),invalidCodePoint:this.errorBuilder(h.InvalidCodePoint)}),this.errorHandlers_readStringContents_string=Object.assign({},this.errorHandlers_readCodePoint,{strictNumericEscape:(s,r,a)=>{this.recordStrictModeErrors(h.StrictNumericEscape,{at:et(s,r,a)})},unterminated:(s,r,a)=>{throw this.raise(h.UnterminatedString,{at:et(s-1,r,a)})}}),this.errorHandlers_readStringContents_template=Object.assign({},this.errorHandlers_readCodePoint,{strictNumericEscape:this.errorBuilder(h.StrictNumericEscape),unterminated:(s,r,a)=>{throw this.raise(h.UnterminatedTemplate,{at:et(s,r,a)})}}),this.state=new Ls,this.state.init(t),this.input=e,this.length=e.length,this.isLookahead=!1}pushToken(t){this.tokens.length=this.state.tokensLength,this.tokens.push(t),++this.state.tokensLength}next(){this.checkKeywordEscapes(),this.options.tokens&&this.pushToken(new Q(this.state)),this.state.lastTokStart=this.state.start,this.state.lastTokEndLoc=this.state.endLoc,this.state.lastTokStartLoc=this.state.startLoc,this.nextToken()}eat(t){return this.match(t)?(this.next(),!0):!1}match(t){return this.state.type===t}createLookaheadState(t){return{pos:t.pos,value:null,type:t.type,start:t.start,end:t.end,context:[this.curContext()],inType:t.inType,startLoc:t.startLoc,lastTokEndLoc:t.lastTokEndLoc,curLine:t.curLine,lineStart:t.lineStart,curPosition:t.curPosition}}lookahead(){let t=this.state;this.state=this.createLookaheadState(t),this.isLookahead=!0,this.nextToken(),this.isLookahead=!1;let e=this.state;return this.state=t,e}nextTokenStart(){return this.nextTokenStartSince(this.state.pos)}nextTokenStartSince(t){return Ss.lastIndex=t,Ss.test(this.input)?Ss.lastIndex:t}lookaheadCharCode(){return this.input.charCodeAt(this.nextTokenStart())}nextTokenInLineStart(){return this.nextTokenInLineStartSince(this.state.pos)}nextTokenInLineStartSince(t){return jt.lastIndex=t,jt.test(this.input)?jt.lastIndex:t}lookaheadInLineCharCode(){return this.input.charCodeAt(this.nextTokenInLineStart())}codePointAtPos(t){let e=this.input.charCodeAt(t);if((e&64512)===55296&&++t<this.input.length){let s=this.input.charCodeAt(t);(s&64512)===56320&&(e=65536+((e&1023)<<10)+(s&1023))}return e}setStrict(t){this.state.strict=t,t&&(this.state.strictErrors.forEach(([e,s])=>this.raise(e,{at:s})),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()),this.state.pos>=this.length){this.finishToken(139);return}this.getTokenFromCode(this.codePointAtPos(this.state.pos))}skipBlockComment(t){let e;this.isLookahead||(e=this.state.curPosition());let s=this.state.pos,r=this.input.indexOf(t,s+2);if(r===-1)throw this.raise(h.UnterminatedComment,{at:this.state.curPosition()});for(this.state.pos=r+t.length,Dt.lastIndex=s+2;Dt.test(this.input)&&Dt.lastIndex<=r;)++this.state.curLine,this.state.lineStart=Dt.lastIndex;if(this.isLookahead)return;let a={type:"CommentBlock",value:this.input.slice(s+2,r),start:s,end:r+t.length,loc:new Fe(e,this.state.curPosition())};return this.options.tokens&&this.pushToken(a),a}skipLineComment(t){let e=this.state.pos,s;this.isLookahead||(s=this.state.curPosition());let r=this.input.charCodeAt(this.state.pos+=t);if(this.state.pos<this.length)for(;!rt(r)&&++this.state.pos<this.length;)r=this.input.charCodeAt(this.state.pos);if(this.isLookahead)return;let a=this.state.pos,o={type:"CommentLine",value:this.input.slice(e+t,a),start:e,end:a,loc:new Fe(s,this.state.curPosition())};return this.options.tokens&&this.pushToken(o),o}skipSpace(){let t=this.state.pos,e=[];e:for(;this.state.pos<this.length;){let s=this.input.charCodeAt(this.state.pos);switch(s){case 32:case 160:case 9:++this.state.pos;break;case 13: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 r=this.skipBlockComment("*/");r!==void 0&&(this.addComment(r),this.options.attachComment&&e.push(r));break}case 47:{let r=this.skipLineComment(2);r!==void 0&&(this.addComment(r),this.options.attachComment&&e.push(r));break}default:break e}break;default:if(ll(s))++this.state.pos;else if(s===45&&!this.inModule&&this.options.annexB){let r=this.state.pos;if(this.input.charCodeAt(r+1)===45&&this.input.charCodeAt(r+2)===62&&(t===0||this.state.lineStart>t)){let a=this.skipLineComment(3);a!==void 0&&(this.addComment(a),this.options.attachComment&&e.push(a))}else break e}else if(s===60&&!this.inModule&&this.options.annexB){let r=this.state.pos;if(this.input.charCodeAt(r+1)===33&&this.input.charCodeAt(r+2)===45&&this.input.charCodeAt(r+3)===45){let a=this.skipLineComment(4);a!==void 0&&(this.addComment(a),this.options.attachComment&&e.push(a))}else break e}else break e}}if(e.length>0){let s=this.state.pos,r={start:t,end:s,comments:e,leadingNode:null,trailingNode:null,containingNode:null};this.state.commentStack.push(r)}}finishToken(t,e){this.state.end=this.state.pos,this.state.endLoc=this.state.curPosition();let s=this.state.type;this.state.type=t,this.state.value=e,this.isLookahead||this.updateContext(s)}replaceToken(t){this.state.type=t,this.updateContext()}readToken_numberSign(){if(this.state.pos===0&&this.readToken_interpreter())return;let t=this.state.pos+1,e=this.codePointAtPos(t);if(e>=48&&e<=57)throw this.raise(h.UnexpectedDigitAfterHash,{at:this.state.curPosition()});if(e===123||e===91&&this.hasPlugin("recordAndTuple")){if(this.expectPlugin("recordAndTuple"),this.getPluginOption("recordAndTuple","syntaxType")==="bar")throw this.raise(e===123?h.RecordExpressionHashIncorrectStartSyntaxType:h.TupleExpressionHashIncorrectStartSyntaxType,{at:this.state.curPosition()});this.state.pos+=2,e===123?this.finishToken(7):this.finishToken(1)}else ie(e)?(++this.state.pos,this.finishToken(138,this.readWord1(e))):e===92?(++this.state.pos,this.finishToken(138,this.readWord1())):this.finishOp(27,1)}readToken_dot(){let t=this.input.charCodeAt(this.state.pos+1);if(t>=48&&t<=57){this.readNumber(!0);return}t===46&&this.input.charCodeAt(this.state.pos+2)===46?(this.state.pos+=3,this.finishToken(21)):(++this.state.pos,this.finishToken(16))}readToken_slash(){this.input.charCodeAt(this.state.pos+1)===61?this.finishOp(31,2):this.finishOp(56,1)}readToken_interpreter(){if(this.state.pos!==0||this.length<2)return!1;let t=this.input.charCodeAt(this.state.pos+1);if(t!==33)return!1;let e=this.state.pos;for(this.state.pos+=1;!rt(t)&&++this.state.pos<this.length;)t=this.input.charCodeAt(this.state.pos);let s=this.input.slice(e+2,this.state.pos);return this.finishToken(28,s),!0}readToken_mult_modulo(t){let e=t===42?55:54,s=1,r=this.input.charCodeAt(this.state.pos+1);t===42&&r===42&&(s++,r=this.input.charCodeAt(this.state.pos+2),e=57),r===61&&!this.state.inType&&(s++,e=t===37?33:30),this.finishOp(e,s)}readToken_pipe_amp(t){let e=this.input.charCodeAt(this.state.pos+1);if(e===t){this.input.charCodeAt(this.state.pos+2)===61?this.finishOp(30,3):this.finishOp(t===124?41:42,2);return}if(t===124){if(e===62){this.finishOp(39,2);return}if(this.hasPlugin("recordAndTuple")&&e===125){if(this.getPluginOption("recordAndTuple","syntaxType")!=="bar")throw this.raise(h.RecordExpressionBarIncorrectEndSyntaxType,{at:this.state.curPosition()});this.state.pos+=2,this.finishToken(9);return}if(this.hasPlugin("recordAndTuple")&&e===93){if(this.getPluginOption("recordAndTuple","syntaxType")!=="bar")throw this.raise(h.TupleExpressionBarIncorrectEndSyntaxType,{at:this.state.curPosition()});this.state.pos+=2,this.finishToken(4);return}}if(e===61){this.finishOp(30,2);return}this.finishOp(t===124?43:45,1)}readToken_caret(){let t=this.input.charCodeAt(this.state.pos+1);t===61&&!this.state.inType?this.finishOp(32,2):t===94&&this.hasPlugin(["pipelineOperator",{proposal:"hack",topicToken:"^^"}])?(this.finishOp(37,2),this.input.codePointAt(this.state.pos)===94&&this.unexpected()):this.finishOp(44,1)}readToken_atSign(){this.input.charCodeAt(this.state.pos+1)===64&&this.hasPlugin(["pipelineOperator",{proposal:"hack",topicToken:"@@"}])?this.finishOp(38,2):this.finishOp(26,1)}readToken_plus_min(t){let e=this.input.charCodeAt(this.state.pos+1);if(e===t){this.finishOp(34,2);return}e===61?this.finishOp(30,2):this.finishOp(53,1)}readToken_lt(){let{pos:t}=this.state,e=this.input.charCodeAt(t+1);if(e===60){if(this.input.charCodeAt(t+2)===61){this.finishOp(30,3);return}this.finishOp(51,2);return}if(e===61){this.finishOp(49,2);return}this.finishOp(47,1)}readToken_gt(){let{pos:t}=this.state,e=this.input.charCodeAt(t+1);if(e===62){let s=this.input.charCodeAt(t+2)===62?3:2;if(this.input.charCodeAt(t+s)===61){this.finishOp(30,s+1);return}this.finishOp(52,s);return}if(e===61){this.finishOp(49,2);return}this.finishOp(48,1)}readToken_eq_excl(t){let e=this.input.charCodeAt(this.state.pos+1);if(e===61){this.finishOp(46,this.input.charCodeAt(this.state.pos+2)===61?3:2);return}if(t===61&&e===62){this.state.pos+=2,this.finishToken(19);return}this.finishOp(t===61?29:35,1)}readToken_question(){let t=this.input.charCodeAt(this.state.pos+1),e=this.input.charCodeAt(this.state.pos+2);t===63?e===61?this.finishOp(30,3):this.finishOp(40,2):t===46&&!(e>=48&&e<=57)?(this.state.pos+=2,this.finishToken(18)):(++this.state.pos,this.finishToken(17))}getTokenFromCode(t){switch(t){case 46:this.readToken_dot();return;case 40:++this.state.pos,this.finishToken(10);return;case 41:++this.state.pos,this.finishToken(11);return;case 59:++this.state.pos,this.finishToken(13);return;case 44:++this.state.pos,this.finishToken(12);return;case 91:if(this.hasPlugin("recordAndTuple")&&this.input.charCodeAt(this.state.pos+1)===124){if(this.getPluginOption("recordAndTuple","syntaxType")!=="bar")throw this.raise(h.TupleExpressionBarIncorrectStartSyntaxType,{at:this.state.curPosition()});this.state.pos+=2,this.finishToken(2)}else++this.state.pos,this.finishToken(0);return;case 93:++this.state.pos,this.finishToken(3);return;case 123:if(this.hasPlugin("recordAndTuple")&&this.input.charCodeAt(this.state.pos+1)===124){if(this.getPluginOption("recordAndTuple","syntaxType")!=="bar")throw this.raise(h.RecordExpressionBarIncorrectStartSyntaxType,{at:this.state.curPosition()});this.state.pos+=2,this.finishToken(6)}else++this.state.pos,this.finishToken(5);return;case 125:++this.state.pos,this.finishToken(8);return;case 58:this.hasPlugin("functionBind")&&this.input.charCodeAt(this.state.pos+1)===58?this.finishOp(15,2):(++this.state.pos,this.finishToken(14));return;case 63:this.readToken_question();return;case 96:this.readTemplateToken();return;case 48:{let e=this.input.charCodeAt(this.state.pos+1);if(e===120||e===88){this.readRadixNumber(16);return}if(e===111||e===79){this.readRadixNumber(8);return}if(e===98||e===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(t);return;case 47:this.readToken_slash();return;case 37:case 42:this.readToken_mult_modulo(t);return;case 124:case 38:this.readToken_pipe_amp(t);return;case 94:this.readToken_caret();return;case 43:case 45:this.readToken_plus_min(t);return;case 60:this.readToken_lt();return;case 62:this.readToken_gt();return;case 61:case 33:this.readToken_eq_excl(t);return;case 126:this.finishOp(36,1);return;case 64:this.readToken_atSign();return;case 35:this.readToken_numberSign();return;case 92:this.readWord();return;default:if(ie(t)){this.readWord(t);return}}throw this.raise(h.InvalidOrUnexpectedToken,{at:this.state.curPosition(),unexpected:String.fromCodePoint(t)})}finishOp(t,e){let s=this.input.slice(this.state.pos,this.state.pos+e);this.state.pos+=e,this.finishToken(t,s)}readRegexp(){let t=this.state.startLoc,e=this.state.start+1,s,r,{pos:a}=this.state;for(;;++a){if(a>=this.length)throw this.raise(h.UnterminatedRegExp,{at:V(t,1)});let l=this.input.charCodeAt(a);if(rt(l))throw this.raise(h.UnterminatedRegExp,{at:V(t,1)});if(s)s=!1;else{if(l===91)r=!0;else if(l===93&&r)r=!1;else if(l===47&&!r)break;s=l===92}}let n=this.input.slice(e,a);++a;let o="",u=()=>V(t,a+2-e);for(;a<this.length;){let l=this.codePointAtPos(a),c=String.fromCharCode(l);if(ml.has(l))l===118?o.includes("u")&&this.raise(h.IncompatibleRegExpUVFlags,{at:u()}):l===117&&o.includes("v")&&this.raise(h.IncompatibleRegExpUVFlags,{at:u()}),o.includes(c)&&this.raise(h.DuplicateRegExpFlags,{at:u()});else if(De(l)||l===92)this.raise(h.MalformedRegExpFlags,{at:u()});else break;++a,o+=c}this.state.pos=a,this.finishToken(137,{pattern:n,flags:o})}readInt(t,e,s=!1,r=!0){let{n:a,pos:n}=_a(this.input,this.state.pos,this.state.lineStart,this.state.curLine,t,e,s,r,this.errorHandlers_readInt,!1);return this.state.pos=n,a}readRadixNumber(t){let e=this.state.curPosition(),s=!1;this.state.pos+=2;let r=this.readInt(t);r==null&&this.raise(h.InvalidDigit,{at:V(e,2),radix:t});let a=this.input.charCodeAt(this.state.pos);if(a===110)++this.state.pos,s=!0;else if(a===109)throw this.raise(h.InvalidDecimal,{at:e});if(ie(this.codePointAtPos(this.state.pos)))throw this.raise(h.NumberIdentifier,{at:this.state.curPosition()});if(s){let n=this.input.slice(e.index,this.state.pos).replace(/[_n]/g,"");this.finishToken(135,n);return}this.finishToken(134,r)}readNumber(t){let e=this.state.pos,s=this.state.curPosition(),r=!1,a=!1,n=!1,o=!1,u=!1;!t&&this.readInt(10)===null&&this.raise(h.InvalidNumber,{at:this.state.curPosition()});let l=this.state.pos-e>=2&&this.input.charCodeAt(e)===48;if(l){let m=this.input.slice(e,this.state.pos);if(this.recordStrictModeErrors(h.StrictOctalLiteral,{at:s}),!this.state.strict){let d=m.indexOf("_");d>0&&this.raise(h.ZeroDigitNumericSeparator,{at:V(s,d)})}u=l&&!/[89]/.test(m)}let c=this.input.charCodeAt(this.state.pos);if(c===46&&!u&&(++this.state.pos,this.readInt(10),r=!0,c=this.input.charCodeAt(this.state.pos)),(c===69||c===101)&&!u&&(c=this.input.charCodeAt(++this.state.pos),(c===43||c===45)&&++this.state.pos,this.readInt(10)===null&&this.raise(h.InvalidOrMissingExponent,{at:s}),r=!0,o=!0,c=this.input.charCodeAt(this.state.pos)),c===110&&((r||l)&&this.raise(h.InvalidBigIntLiteral,{at:s}),++this.state.pos,a=!0),c===109&&(this.expectPlugin("decimal",this.state.curPosition()),(o||l)&&this.raise(h.InvalidDecimal,{at:s}),++this.state.pos,n=!0),ie(this.codePointAtPos(this.state.pos)))throw this.raise(h.NumberIdentifier,{at:this.state.curPosition()});let p=this.input.slice(e,this.state.pos).replace(/[_mn]/g,"");if(a){this.finishToken(135,p);return}if(n){this.finishToken(136,p);return}let f=u?parseInt(p,8):parseFloat(p);this.finishToken(134,f)}readCodePoint(t){let{code:e,pos:s}=Oa(this.input,this.state.pos,this.state.lineStart,this.state.curLine,t,this.errorHandlers_readCodePoint);return this.state.pos=s,e}readString(t){let{str:e,pos:s,curLine:r,lineStart:a}=fa(t===34?"double":"single",this.input,this.state.pos+1,this.state.lineStart,this.state.curLine,this.errorHandlers_readStringContents_string);this.state.pos=s+1,this.state.lineStart=a,this.state.curLine=r,this.finishToken(133,e)}readTemplateContinuation(){this.match(8)||this.unexpected(null,8),this.state.pos--,this.readTemplateToken()}readTemplateToken(){let t=this.input[this.state.pos],{str:e,firstInvalidLoc:s,pos:r,curLine:a,lineStart:n}=fa("template",this.input,this.state.pos+1,this.state.lineStart,this.state.curLine,this.errorHandlers_readStringContents_template);this.state.pos=r+1,this.state.lineStart=n,this.state.curLine=a,s&&(this.state.firstInvalidTemplateEscapePos=new Z(s.curLine,s.pos-s.lineStart,s.pos)),this.input.codePointAt(r)===96?this.finishToken(24,s?null:t+e+"`"):(this.state.pos++,this.finishToken(25,s?null:t+e+"${"))}recordStrictModeErrors(t,{at:e}){let s=e.index;this.state.strict&&!this.state.strictErrors.has(s)?this.raise(t,{at:e}):this.state.strictErrors.set(s,[t,e])}readWord1(t){this.state.containsEsc=!1;let e="",s=this.state.pos,r=this.state.pos;for(t!==void 0&&(this.state.pos+=t<=65535?1:2);this.state.pos<this.length;){let a=this.codePointAtPos(this.state.pos);if(De(a))this.state.pos+=a<=65535?1:2;else if(a===92){this.state.containsEsc=!0,e+=this.input.slice(r,this.state.pos);let n=this.state.curPosition(),o=this.state.pos===s?ie:De;if(this.input.charCodeAt(++this.state.pos)!==117){this.raise(h.MissingUnicodeEscape,{at:this.state.curPosition()}),r=this.state.pos-1;continue}++this.state.pos;let u=this.readCodePoint(!0);u!==null&&(o(u)||this.raise(h.EscapedCharNotAnIdentifier,{at:n}),e+=String.fromCodePoint(u)),r=this.state.pos}else break}return e+this.input.slice(r,this.state.pos)}readWord(t){let e=this.readWord1(t),s=Gs.get(e);s!==void 0?this.finishToken(s,fe(s)):this.finishToken(132,e)}checkKeywordEscapes(){let{type:t}=this.state;er(t)&&this.state.containsEsc&&this.raise(h.InvalidEscapedReservedWord,{at:this.state.startLoc,reservedWord:fe(t)})}raise(t,e){let{at:s}=e,r=$t(e,fl),a=s instanceof Z?s:s.loc.start,n=t({loc:a,details:r});if(!this.options.errorRecovery)throw n;return this.isLookahead||this.state.errors.push(n),n}raiseOverwrite(t,e){let{at:s}=e,r=$t(e,dl),a=s instanceof Z?s:s.loc.start,n=a.index,o=this.state.errors;for(let u=o.length-1;u>=0;u--){let l=o[u];if(l.loc.index===n)return o[u]=t({loc:a,details:r});if(l.loc.index<n)break}return this.raise(t,e)}updateContext(t){}unexpected(t,e){throw this.raise(h.UnexpectedToken,{expected:e?fe(e):null,at:t??this.state.startLoc})}expectPlugin(t,e){if(this.hasPlugin(t))return!0;throw this.raise(h.MissingPlugin,{at:e??this.state.startLoc,missingPlugin:[t]})}expectOnePlugin(t){if(!t.some(e=>this.hasPlugin(e)))throw this.raise(h.MissingOneOfPlugins,{at:this.state.startLoc,missingPlugin:t})}errorBuilder(t){return(e,s,r)=>{this.raise(t,{at:et(e,s,r)})}}},Fs=class{constructor(){this.privateNames=new Set,this.loneAccessors=new Map,this.undefinedPrivateNames=new Map}},Rs=class{constructor(t){this.parser=void 0,this.stack=[],this.undefinedPrivateNames=new Map,this.parser=t}current(){return this.stack[this.stack.length-1]}enter(){this.stack.push(new Fs)}exit(){let t=this.stack.pop(),e=this.current();for(let[s,r]of Array.from(t.undefinedPrivateNames))e?e.undefinedPrivateNames.has(s)||e.undefinedPrivateNames.set(s,r):this.parser.raise(h.InvalidPrivateFieldResolution,{at:r,identifierName:s})}declarePrivateName(t,e,s){let{privateNames:r,loneAccessors:a,undefinedPrivateNames:n}=this.current(),o=r.has(t);if(e&3){let u=o&&a.get(t);if(u){let l=u&4,c=e&4,p=u&3,f=e&3;o=p===f||l!==c,o||a.delete(t)}else o||a.set(t,e)}o&&this.parser.raise(h.PrivateNameRedeclaration,{at:s,identifierName:t}),r.add(t),n.delete(t)}usePrivateName(t,e){let s;for(s of this.stack)if(s.privateNames.has(t))return;s?s.undefinedPrivateNames.set(t,e):this.parser.raise(h.InvalidPrivateFieldResolution,{at:e,identifierName:t})}},Re=class{constructor(t=0){this.type=t}canBeArrowParameterDeclaration(){return this.type===2||this.type===1}isCertainlyParameterDeclaration(){return this.type===3}},Vt=class extends Re{constructor(t){super(t),this.declarationErrors=new Map}recordDeclarationError(t,{at:e}){let s=e.index;this.declarationErrors.set(s,[t,e])}clearDeclarationError(t){this.declarationErrors.delete(t)}iterateErrors(t){this.declarationErrors.forEach(t)}},js=class{constructor(t){this.parser=void 0,this.stack=[new Re],this.parser=t}enter(t){this.stack.push(t)}exit(){this.stack.pop()}recordParameterInitializerError(t,{at:e}){let s={at:e.loc.start},{stack:r}=this,a=r.length-1,n=r[a];for(;!n.isCertainlyParameterDeclaration();){if(n.canBeArrowParameterDeclaration())n.recordDeclarationError(t,s);else return;n=r[--a]}this.parser.raise(t,s)}recordArrowParameterBindingError(t,{at:e}){let{stack:s}=this,r=s[s.length-1],a={at:e.loc.start};if(r.isCertainlyParameterDeclaration())this.parser.raise(t,a);else if(r.canBeArrowParameterDeclaration())r.recordDeclarationError(t,a);else return}recordAsyncArrowParametersError({at:t}){let{stack:e}=this,s=e.length-1,r=e[s];for(;r.canBeArrowParameterDeclaration();)r.type===2&&r.recordDeclarationError(h.AwaitBindingIdentifier,{at:t}),r=e[--s]}validateAsPattern(){let{stack:t}=this,e=t[t.length-1];e.canBeArrowParameterDeclaration()&&e.iterateErrors(([s,r])=>{this.parser.raise(s,{at:r});let a=t.length-2,n=t[a];for(;n.canBeArrowParameterDeclaration();)n.clearDeclarationError(r.index),n=t[--a]})}};function yl(){return new Re(3)}function xl(){return new Vt(1)}function gl(){return new Vt(2)}function Ma(){return new Re}var Us=class{constructor(){this.stacks=[]}enter(t){this.stacks.push(t)}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}};function Ut(i,t){return(i?2:0)|(t?1:0)}var $s=class extends Bs{addExtra(t,e,s,r=!0){if(!t)return;let a=t.extra=t.extra||{};r?a[e]=s:Object.defineProperty(a,e,{enumerable:r,value:s})}isContextual(t){return this.state.type===t&&!this.state.containsEsc}isUnparsedContextual(t,e){let s=t+e.length;if(this.input.slice(t,s)===e){let r=this.input.charCodeAt(s);return!(De(r)||(r&64512)===55296)}return!1}isLookaheadContextual(t){let e=this.nextTokenStart();return this.isUnparsedContextual(e,t)}eatContextual(t){return this.isContextual(t)?(this.next(),!0):!1}expectContextual(t,e){if(!this.eatContextual(t)){if(e!=null)throw this.raise(e,{at:this.state.startLoc});this.unexpected(null,t)}}canInsertSemicolon(){return this.match(139)||this.match(8)||this.hasPrecedingLineBreak()}hasPrecedingLineBreak(){return Na.test(this.input.slice(this.state.lastTokEndLoc.index,this.state.start))}hasFollowingLineBreak(){return ha.lastIndex=this.state.end,ha.test(this.input)}isLineTerminator(){return this.eat(13)||this.canInsertSemicolon()}semicolon(t=!0){(t?this.isLineTerminator():this.eat(13))||this.raise(h.MissingSemicolon,{at:this.state.lastTokEndLoc})}expect(t,e){this.eat(t)||this.unexpected(e,t)}tryParse(t,e=this.state.clone()){let s={node:null};try{let r=t((a=null)=>{throw s.node=a,s});if(this.state.errors.length>e.errors.length){let a=this.state;return this.state=e,this.state.tokensLength=a.tokensLength,{node:r,error:a.errors[e.errors.length],thrown:!1,aborted:!1,failState:a}}return{node:r,error:null,thrown:!1,aborted:!1,failState:null}}catch(r){let a=this.state;if(this.state=e,r instanceof SyntaxError)return{node:null,error:r,thrown:!0,aborted:!1,failState:a};if(r===s)return{node:s.node,error:null,thrown:!1,aborted:!0,failState:a};throw r}}checkExpressionErrors(t,e){if(!t)return!1;let{shorthandAssignLoc:s,doubleProtoLoc:r,privateKeyLoc:a,optionalParametersLoc:n}=t,o=!!s||!!r||!!n||!!a;if(!e)return o;s!=null&&this.raise(h.InvalidCoverInitializedName,{at:s}),r!=null&&this.raise(h.DuplicateProto,{at:r}),a!=null&&this.raise(h.UnexpectedPrivateField,{at:a}),n!=null&&this.unexpected(n)}isLiteralPropertyName(){return wa(this.state.type)}isPrivateName(t){return t.type==="PrivateName"}getPrivateNameSV(t){return t.id.name}hasPropertyAsPrivateName(t){return(t.type==="MemberExpression"||t.type==="OptionalMemberExpression")&&this.isPrivateName(t.property)}isObjectProperty(t){return t.type==="ObjectProperty"}isObjectMethod(t){return t.type==="ObjectMethod"}initializeScopes(t=this.options.sourceType==="module"){let e=this.state.labels;this.state.labels=[];let s=this.exportedIdentifiers;this.exportedIdentifiers=new Set;let r=this.inModule;this.inModule=t;let a=this.scope,n=this.getScopeHandler();this.scope=new n(this,t);let o=this.prodParam;this.prodParam=new Us;let u=this.classScope;this.classScope=new Rs(this);let l=this.expressionScope;return this.expressionScope=new js(this),()=>{this.state.labels=e,this.exportedIdentifiers=s,this.inModule=r,this.scope=a,this.prodParam=o,this.classScope=u,this.expressionScope=l}}enterInitialScopes(){let t=0;this.inModule&&(t|=2),this.scope.enter(1),this.prodParam.enter(t)}checkDestructuringPrivate(t){let{privateKeyLoc:e}=t;e!==null&&this.expectPlugin("destructuringPrivate",e)}},Be=class{constructor(){this.shorthandAssignLoc=null,this.doubleProtoLoc=null,this.privateKeyLoc=null,this.optionalParametersLoc=null}},je=class{constructor(t,e,s){this.type="",this.start=e,this.end=0,this.loc=new Fe(s),t!=null&&t.options.ranges&&(this.range=[e,0]),t!=null&&t.filename&&(this.loc.filename=t.filename)}},rr=je.prototype;rr.__clone=function(){let i=new je(void 0,this.start,this.loc.start),t=Object.keys(this);for(let e=0,s=t.length;e<s;e++){let r=t[e];r!=="leadingComments"&&r!=="trailingComments"&&r!=="innerComments"&&(i[r]=this[r])}return i};function bl(i){return ne(i)}function ne(i){let{type:t,start:e,end:s,loc:r,range:a,extra:n,name:o}=i,u=Object.create(rr);return u.type=t,u.start=e,u.end=s,u.loc=r,u.range=a,u.extra=n,u.name=o,t==="Placeholder"&&(u.expectedNode=i.expectedNode),u}function Pl(i){let{type:t,start:e,end:s,loc:r,range:a,extra:n}=i;if(t==="Placeholder")return bl(i);let o=Object.create(rr);return o.type=t,o.start=e,o.end=s,o.loc=r,o.range=a,i.raw!==void 0?o.raw=i.raw:o.extra=n,o.value=i.value,o}var qs=class extends $s{startNode(){return new je(this,this.state.start,this.state.startLoc)}startNodeAt(t){return new je(this,t.index,t)}startNodeAtNode(t){return this.startNodeAt(t.loc.start)}finishNode(t,e){return this.finishNodeAt(t,e,this.state.lastTokEndLoc)}finishNodeAt(t,e,s){return t.type=e,t.end=s.index,t.loc.end=s,this.options.ranges&&(t.range[1]=s.index),this.options.attachComment&&this.processComment(t),t}resetStartLocation(t,e){t.start=e.index,t.loc.start=e,this.options.ranges&&(t.range[0]=e.index)}resetEndLocation(t,e=this.state.lastTokEndLoc){t.end=e.index,t.loc.end=e,this.options.ranges&&(t.range[1]=e.index)}resetStartLocationFromNode(t,e){this.resetStartLocation(t,e.loc.start)}},vl=new Set(["_","any","bool","boolean","empty","extends","false","interface","mixed","null","number","static","string","true","typeof","void"]),T=ae`flow`({AmbiguousConditionalArrow:"Ambiguous expression: wrap the arrow functions in parentheses to disambiguate.",AmbiguousDeclareModuleKind:"Found both `declare module.exports` and `declare export` in the same module. Modules can only have 1 since they are either an ES module or they are a CommonJS module.",AssignReservedType:({reservedType:i})=>`Cannot overwrite reserved type ${i}.`,DeclareClassElement:"The `declare` modifier can only appear on class fields.",DeclareClassFieldInitializer:"Initializers are not allowed in fields with the `declare` modifier.",DuplicateDeclareModuleExports:"Duplicate `declare module.exports` statement.",EnumBooleanMemberNotInitialized:({memberName:i,enumName:t})=>`Boolean enum members need to be initialized. Use either \`${i} = true,\` or \`${i} = false,\` in enum \`${t}\`.`,EnumDuplicateMemberName:({memberName:i,enumName:t})=>`Enum member names need to be unique, but the name \`${i}\` has already been used before in enum \`${t}\`.`,EnumInconsistentMemberValues:({enumName:i})=>`Enum \`${i}\` has inconsistent member initializers. Either use no initializers, or consistently use literals (either booleans, numbers, or strings) for all member initializers.`,EnumInvalidExplicitType:({invalidEnumType:i,enumName:t})=>`Enum type \`${i}\` is not valid. Use one of \`boolean\`, \`number\`, \`string\`, or \`symbol\` in enum \`${t}\`.`,EnumInvalidExplicitTypeUnknownSupplied:({enumName:i})=>`Supplied enum type is not valid. Use one of \`boolean\`, \`number\`, \`string\`, or \`symbol\` in enum \`${i}\`.`,EnumInvalidMemberInitializerPrimaryType:({enumName:i,memberName:t,explicitType:e})=>`Enum \`${i}\` has type \`${e}\`, so the initializer of \`${t}\` needs to be a ${e} literal.`,EnumInvalidMemberInitializerSymbolType:({enumName:i,memberName:t})=>`Symbol enum members cannot be initialized. Use \`${t},\` in enum \`${i}\`.`,EnumInvalidMemberInitializerUnknownType:({enumName:i,memberName:t})=>`The enum member initializer for \`${t}\` needs to be a literal (either a boolean, number, or string) in enum \`${i}\`.`,EnumInvalidMemberName:({enumName:i,memberName:t,suggestion:e})=>`Enum member names cannot start with lowercase 'a' through 'z'. Instead of using \`${t}\`, consider using \`${e}\`, in enum \`${i}\`.`,EnumNumberMemberNotInitialized:({enumName:i,memberName:t})=>`Number enum members need to be initialized, e.g. \`${t} = 1\` in enum \`${i}\`.`,EnumStringMemberInconsistentlyInitialized:({enumName:i})=>`String enum members need to consistently either all use initializers, or use no initializers, in enum \`${i}\`.`,GetterMayNotHaveThisParam:"A getter cannot have a `this` parameter.",ImportReflectionHasImportType:"An `import module` declaration can not use `type` or `typeof` keyword.",ImportTypeShorthandOnlyInPureImport:"The `type` and `typeof` keywords on named imports can only be used on regular `import` statements. It cannot be used with `import type` or `import typeof` statements.",InexactInsideExact:"Explicit inexact syntax cannot appear inside an explicit exact object type.",InexactInsideNonObject:"Explicit inexact syntax cannot appear in class or interface definitions.",InexactVariance:"Explicit inexact syntax cannot have variance.",InvalidNonTypeImportInDeclareModule:"Imports within a `declare module` body must always be `import type` or `import typeof`.",MissingTypeParamDefault:"Type parameter declaration needs a default, since a preceding type parameter declaration has a default.",NestedDeclareModule:"`declare module` cannot be used inside another `declare module`.",NestedFlowComment:"Cannot have a flow comment inside another flow comment.",PatternIsOptional:Object.assign({message:"A binding pattern parameter cannot be optional in an implementation signature."},{reasonCode:"OptionalBindingPattern"}),SetterMayNotHaveThisParam:"A setter cannot have a `this` parameter.",SpreadVariance:"Spread properties cannot have variance.",ThisParamAnnotationRequired:"A type annotation is required for the `this` parameter.",ThisParamBannedInConstructor:"Constructors cannot have a `this` parameter; constructors don't bind `this` like other functions.",ThisParamMayNotBeOptional:"The `this` parameter cannot be optional.",ThisParamMustBeFirst:"The `this` parameter must be the first function parameter.",ThisParamNoDefault:"The `this` parameter may not have a default value.",TypeBeforeInitializer:"Type annotations must come before default assignments, e.g. instead of `age = 25: number` use `age: number = 25`.",TypeCastInPattern:"The type cast expression is expected to be wrapped with parenthesis.",UnexpectedExplicitInexactInObject:"Explicit inexact syntax must appear at the end of an inexact object.",UnexpectedReservedType:({reservedType:i})=>`Unexpected reserved type ${i}.`,UnexpectedReservedUnderscore:"`_` is only allowed as a type argument to call or new.",UnexpectedSpaceBetweenModuloChecks:"Spaces between `%` and `checks` are not allowed here.",UnexpectedSpreadType:"Spread operator cannot appear in class or interface definitions.",UnexpectedSubtractionOperand:'Unexpected token, expected "number" or "bigint".',UnexpectedTokenAfterTypeParameter:"Expected an arrow function after this type parameter declaration.",UnexpectedTypeParameterBeforeAsyncArrowFunction:"Type parameters must come after the async keyword, e.g. instead of `<T> async () => {}`, use `async <T>() => {}`.",UnsupportedDeclareExportKind:({unsupportedExportKind:i,suggestion:t})=>`\`declare export ${i}\` is not supported. Use \`${t}\` instead.`,UnsupportedStatementInDeclareModule:"Only declares and type imports are allowed inside declare module.",UnterminatedFlowComment:"Unterminated flow-comment."});function wl(i){return i.type==="DeclareExportAllDeclaration"||i.type==="DeclareExportDeclaration"&&(!i.declaration||i.declaration.type!=="TypeAlias"&&i.declaration.type!=="InterfaceDeclaration")}function da(i){return i.importKind==="type"||i.importKind==="typeof"}var Tl={const:"declare export var",let:"declare export var",type:"export type",interface:"export interface"};function Sl(i,t){let e=[],s=[];for(let r=0;r<i.length;r++)(t(i[r],r,i)?e:s).push(i[r]);return[e,s]}var Al=/\*?\s*@((?:no)?flow)\b/,El=i=>class extends i{constructor(...e){super(...e),this.flowPragma=void 0}getScopeHandler(){return _s}shouldParseTypes(){return this.getPluginOption("flow","all")||this.flowPragma==="flow"}shouldParseEnums(){return!!this.getPluginOption("flow","enums")}finishToken(e,s){e!==133&&e!==13&&e!==28&&this.flowPragma===void 0&&(this.flowPragma=null),super.finishToken(e,s)}addComment(e){if(this.flowPragma===void 0){let s=Al.exec(e.value);if(s)if(s[1]==="flow")this.flowPragma="flow";else if(s[1]==="noflow")this.flowPragma="noflow";else throw new Error("Unexpected flow pragma")}super.addComment(e)}flowParseTypeInitialiser(e){let s=this.state.inType;this.state.inType=!0,this.expect(e||14);let r=this.flowParseType();return this.state.inType=s,r}flowParsePredicate(){let e=this.startNode(),s=this.state.startLoc;return this.next(),this.expectContextual(110),this.state.lastTokStart>s.index+1&&this.raise(T.UnexpectedSpaceBetweenModuloChecks,{at:s}),this.eat(10)?(e.value=super.parseExpression(),this.expect(11),this.finishNode(e,"DeclaredPredicate")):this.finishNode(e,"InferredPredicate")}flowParseTypeAndPredicateInitialiser(){let e=this.state.inType;this.state.inType=!0,this.expect(14);let s=null,r=null;return this.match(54)?(this.state.inType=e,r=this.flowParsePredicate()):(s=this.flowParseType(),this.state.inType=e,this.match(54)&&(r=this.flowParsePredicate())),[s,r]}flowParseDeclareClass(e){return this.next(),this.flowParseInterfaceish(e,!0),this.finishNode(e,"DeclareClass")}flowParseDeclareFunction(e){this.next();let s=e.id=this.parseIdentifier(),r=this.startNode(),a=this.startNode();this.match(47)?r.typeParameters=this.flowParseTypeParameterDeclaration():r.typeParameters=null,this.expect(10);let n=this.flowParseFunctionTypeParams();return r.params=n.params,r.rest=n.rest,r.this=n._this,this.expect(11),[r.returnType,e.predicate]=this.flowParseTypeAndPredicateInitialiser(),a.typeAnnotation=this.finishNode(r,"FunctionTypeAnnotation"),s.typeAnnotation=this.finishNode(a,"TypeAnnotation"),this.resetEndLocation(s),this.semicolon(),this.scope.declareName(e.id.name,2048,e.id.loc.start),this.finishNode(e,"DeclareFunction")}flowParseDeclare(e,s){if(this.match(80))return this.flowParseDeclareClass(e);if(this.match(68))return this.flowParseDeclareFunction(e);if(this.match(74))return this.flowParseDeclareVariable(e);if(this.eatContextual(127))return this.match(16)?this.flowParseDeclareModuleExports(e):(s&&this.raise(T.NestedDeclareModule,{at:this.state.lastTokStartLoc}),this.flowParseDeclareModule(e));if(this.isContextual(130))return this.flowParseDeclareTypeAlias(e);if(this.isContextual(131))return this.flowParseDeclareOpaqueType(e);if(this.isContextual(129))return this.flowParseDeclareInterface(e);if(this.match(82))return this.flowParseDeclareExportDeclaration(e,s);this.unexpected()}flowParseDeclareVariable(e){return this.next(),e.id=this.flowParseTypeAnnotatableIdentifier(!0),this.scope.declareName(e.id.name,5,e.id.loc.start),this.semicolon(),this.finishNode(e,"DeclareVariable")}flowParseDeclareModule(e){this.scope.enter(0),this.match(133)?e.id=super.parseExprAtom():e.id=this.parseIdentifier();let s=e.body=this.startNode(),r=s.body=[];for(this.expect(5);!this.match(8);){let o=this.startNode();this.match(83)?(this.next(),!this.isContextual(130)&&!this.match(87)&&this.raise(T.InvalidNonTypeImportInDeclareModule,{at:this.state.lastTokStartLoc}),super.parseImport(o)):(this.expectContextual(125,T.UnsupportedStatementInDeclareModule),o=this.flowParseDeclare(o,!0)),r.push(o)}this.scope.exit(),this.expect(8),this.finishNode(s,"BlockStatement");let a=null,n=!1;return r.forEach(o=>{wl(o)?(a==="CommonJS"&&this.raise(T.AmbiguousDeclareModuleKind,{at:o}),a="ES"):o.type==="DeclareModuleExports"&&(n&&this.raise(T.DuplicateDeclareModuleExports,{at:o}),a==="ES"&&this.raise(T.AmbiguousDeclareModuleKind,{at:o}),a="CommonJS",n=!0)}),e.kind=a||"CommonJS",this.finishNode(e,"DeclareModule")}flowParseDeclareExportDeclaration(e,s){if(this.expect(82),this.eat(65))return this.match(68)||this.match(80)?e.declaration=this.flowParseDeclare(this.startNode()):(e.declaration=this.flowParseType(),this.semicolon()),e.default=!0,this.finishNode(e,"DeclareExportDeclaration");if(this.match(75)||this.isLet()||(this.isContextual(130)||this.isContextual(129))&&!s){let r=this.state.value;throw this.raise(T.UnsupportedDeclareExportKind,{at:this.state.startLoc,unsupportedExportKind:r,suggestion:Tl[r]})}if(this.match(74)||this.match(68)||this.match(80)||this.isContextual(131))return e.declaration=this.flowParseDeclare(this.startNode()),e.default=!1,this.finishNode(e,"DeclareExportDeclaration");if(this.match(55)||this.match(5)||this.isContextual(129)||this.isContextual(130)||this.isContextual(131))return e=this.parseExport(e,null),e.type==="ExportNamedDeclaration"&&(e.type="ExportDeclaration",e.default=!1,delete e.exportKind),e.type="Declare"+e.type,e;this.unexpected()}flowParseDeclareModuleExports(e){return this.next(),this.expectContextual(111),e.typeAnnotation=this.flowParseTypeAnnotation(),this.semicolon(),this.finishNode(e,"DeclareModuleExports")}flowParseDeclareTypeAlias(e){this.next();let s=this.flowParseTypeAlias(e);return s.type="DeclareTypeAlias",s}flowParseDeclareOpaqueType(e){this.next();let s=this.flowParseOpaqueType(e,!0);return s.type="DeclareOpaqueType",s}flowParseDeclareInterface(e){return this.next(),this.flowParseInterfaceish(e,!1),this.finishNode(e,"DeclareInterface")}flowParseInterfaceish(e,s){if(e.id=this.flowParseRestrictedIdentifier(!s,!0),this.scope.declareName(e.id.name,s?17:8201,e.id.loc.start),this.match(47)?e.typeParameters=this.flowParseTypeParameterDeclaration():e.typeParameters=null,e.extends=[],this.eat(81))do e.extends.push(this.flowParseInterfaceExtends());while(!s&&this.eat(12));if(s){if(e.implements=[],e.mixins=[],this.eatContextual(117))do e.mixins.push(this.flowParseInterfaceExtends());while(this.eat(12));if(this.eatContextual(113))do e.implements.push(this.flowParseInterfaceExtends());while(this.eat(12))}e.body=this.flowParseObjectType({allowStatic:s,allowExact:!1,allowSpread:!1,allowProto:s,allowInexact:!1})}flowParseInterfaceExtends(){let e=this.startNode();return e.id=this.flowParseQualifiedTypeIdentifier(),this.match(47)?e.typeParameters=this.flowParseTypeParameterInstantiation():e.typeParameters=null,this.finishNode(e,"InterfaceExtends")}flowParseInterface(e){return this.flowParseInterfaceish(e,!1),this.finishNode(e,"InterfaceDeclaration")}checkNotUnderscore(e){e==="_"&&this.raise(T.UnexpectedReservedUnderscore,{at:this.state.startLoc})}checkReservedType(e,s,r){vl.has(e)&&this.raise(r?T.AssignReservedType:T.UnexpectedReservedType,{at:s,reservedType:e})}flowParseRestrictedIdentifier(e,s){return this.checkReservedType(this.state.value,this.state.startLoc,s),this.parseIdentifier(e)}flowParseTypeAlias(e){return e.id=this.flowParseRestrictedIdentifier(!1,!0),this.scope.declareName(e.id.name,8201,e.id.loc.start),this.match(47)?e.typeParameters=this.flowParseTypeParameterDeclaration():e.typeParameters=null,e.right=this.flowParseTypeInitialiser(29),this.semicolon(),this.finishNode(e,"TypeAlias")}flowParseOpaqueType(e,s){return this.expectContextual(130),e.id=this.flowParseRestrictedIdentifier(!0,!0),this.scope.declareName(e.id.name,8201,e.id.loc.start),this.match(47)?e.typeParameters=this.flowParseTypeParameterDeclaration():e.typeParameters=null,e.supertype=null,this.match(14)&&(e.supertype=this.flowParseTypeInitialiser(14)),e.impltype=null,s||(e.impltype=this.flowParseTypeInitialiser(29)),this.semicolon(),this.finishNode(e,"OpaqueType")}flowParseTypeParameter(e=!1){let s=this.state.startLoc,r=this.startNode(),a=this.flowParseVariance(),n=this.flowParseTypeAnnotatableIdentifier();return r.name=n.name,r.variance=a,r.bound=n.typeAnnotation,this.match(29)?(this.eat(29),r.default=this.flowParseType()):e&&this.raise(T.MissingTypeParamDefault,{at:s}),this.finishNode(r,"TypeParameter")}flowParseTypeParameterDeclaration(){let e=this.state.inType,s=this.startNode();s.params=[],this.state.inType=!0,this.match(47)||this.match(142)?this.next():this.unexpected();let r=!1;do{let a=this.flowParseTypeParameter(r);s.params.push(a),a.default&&(r=!0),this.match(48)||this.expect(12)}while(!this.match(48));return this.expect(48),this.state.inType=e,this.finishNode(s,"TypeParameterDeclaration")}flowParseTypeParameterInstantiation(){let e=this.startNode(),s=this.state.inType;e.params=[],this.state.inType=!0,this.expect(47);let r=this.state.noAnonFunctionType;for(this.state.noAnonFunctionType=!1;!this.match(48);)e.params.push(this.flowParseType()),this.match(48)||this.expect(12);return this.state.noAnonFunctionType=r,this.expect(48),this.state.inType=s,this.finishNode(e,"TypeParameterInstantiation")}flowParseTypeParameterInstantiationCallOrNew(){let e=this.startNode(),s=this.state.inType;for(e.params=[],this.state.inType=!0,this.expect(47);!this.match(48);)e.params.push(this.flowParseTypeOrImplicitInstantiation()),this.match(48)||this.expect(12);return this.expect(48),this.state.inType=s,this.finishNode(e,"TypeParameterInstantiation")}flowParseInterfaceType(){let e=this.startNode();if(this.expectContextual(129),e.extends=[],this.eat(81))do e.extends.push(this.flowParseInterfaceExtends());while(this.eat(12));return e.body=this.flowParseObjectType({allowStatic:!1,allowExact:!1,allowSpread:!1,allowProto:!1,allowInexact:!1}),this.finishNode(e,"InterfaceTypeAnnotation")}flowParseObjectPropertyKey(){return this.match(134)||this.match(133)?super.parseExprAtom():this.parseIdentifier(!0)}flowParseObjectTypeIndexer(e,s,r){return e.static=s,this.lookahead().type===14?(e.id=this.flowParseObjectPropertyKey(),e.key=this.flowParseTypeInitialiser()):(e.id=null,e.key=this.flowParseType()),this.expect(3),e.value=this.flowParseTypeInitialiser(),e.variance=r,this.finishNode(e,"ObjectTypeIndexer")}flowParseObjectTypeInternalSlot(e,s){return e.static=s,e.id=this.flowParseObjectPropertyKey(),this.expect(3),this.expect(3),this.match(47)||this.match(10)?(e.method=!0,e.optional=!1,e.value=this.flowParseObjectTypeMethodish(this.startNodeAt(e.loc.start))):(e.method=!1,this.eat(17)&&(e.optional=!0),e.value=this.flowParseTypeInitialiser()),this.finishNode(e,"ObjectTypeInternalSlot")}flowParseObjectTypeMethodish(e){for(e.params=[],e.rest=null,e.typeParameters=null,e.this=null,this.match(47)&&(e.typeParameters=this.flowParseTypeParameterDeclaration()),this.expect(10),this.match(78)&&(e.this=this.flowParseFunctionTypeParam(!0),e.this.name=null,this.match(11)||this.expect(12));!this.match(11)&&!this.match(21);)e.params.push(this.flowParseFunctionTypeParam(!1)),this.match(11)||this.expect(12);return this.eat(21)&&(e.rest=this.flowParseFunctionTypeParam(!1)),this.expect(11),e.returnType=this.flowParseTypeInitialiser(),this.finishNode(e,"FunctionTypeAnnotation")}flowParseObjectTypeCallProperty(e,s){let r=this.startNode();return e.static=s,e.value=this.flowParseObjectTypeMethodish(r),this.finishNode(e,"ObjectTypeCallProperty")}flowParseObjectType({allowStatic:e,allowExact:s,allowSpread:r,allowProto:a,allowInexact:n}){let o=this.state.inType;this.state.inType=!0;let u=this.startNode();u.callProperties=[],u.properties=[],u.indexers=[],u.internalSlots=[];let l,c,p=!1;for(s&&this.match(6)?(this.expect(6),l=9,c=!0):(this.expect(5),l=8,c=!1),u.exact=c;!this.match(l);){let m=!1,d=null,y=null,v=this.startNode();if(a&&this.isContextual(118)){let _=this.lookahead();_.type!==14&&_.type!==17&&(this.next(),d=this.state.startLoc,e=!1)}if(e&&this.isContextual(106)){let _=this.lookahead();_.type!==14&&_.type!==17&&(this.next(),m=!0)}let S=this.flowParseVariance();if(this.eat(0))d!=null&&this.unexpected(d),this.eat(0)?(S&&this.unexpected(S.loc.start),u.internalSlots.push(this.flowParseObjectTypeInternalSlot(v,m))):u.indexers.push(this.flowParseObjectTypeIndexer(v,m,S));else if(this.match(10)||this.match(47))d!=null&&this.unexpected(d),S&&this.unexpected(S.loc.start),u.callProperties.push(this.flowParseObjectTypeCallProperty(v,m));else{let _="init";if(this.isContextual(99)||this.isContextual(104)){let B=this.lookahead();wa(B.type)&&(_=this.state.value,this.next())}let U=this.flowParseObjectTypeProperty(v,m,d,S,_,r,n??!c);U===null?(p=!0,y=this.state.lastTokStartLoc):u.properties.push(U)}this.flowObjectTypeSemicolon(),y&&!this.match(8)&&!this.match(9)&&this.raise(T.UnexpectedExplicitInexactInObject,{at:y})}this.expect(l),r&&(u.inexact=p);let f=this.finishNode(u,"ObjectTypeAnnotation");return this.state.inType=o,f}flowParseObjectTypeProperty(e,s,r,a,n,o,u){if(this.eat(21))return this.match(12)||this.match(13)||this.match(8)||this.match(9)?(o?u||this.raise(T.InexactInsideExact,{at:this.state.lastTokStartLoc}):this.raise(T.InexactInsideNonObject,{at:this.state.lastTokStartLoc}),a&&this.raise(T.InexactVariance,{at:a}),null):(o||this.raise(T.UnexpectedSpreadType,{at:this.state.lastTokStartLoc}),r!=null&&this.unexpected(r),a&&this.raise(T.SpreadVariance,{at:a}),e.argument=this.flowParseType(),this.finishNode(e,"ObjectTypeSpreadProperty"));{e.key=this.flowParseObjectPropertyKey(),e.static=s,e.proto=r!=null,e.kind=n;let l=!1;return this.match(47)||this.match(10)?(e.method=!0,r!=null&&this.unexpected(r),a&&this.unexpected(a.loc.start),e.value=this.flowParseObjectTypeMethodish(this.startNodeAt(e.loc.start)),(n==="get"||n==="set")&&this.flowCheckGetterSetterParams(e),!o&&e.key.name==="constructor"&&e.value.this&&this.raise(T.ThisParamBannedInConstructor,{at:e.value.this})):(n!=="init"&&this.unexpected(),e.method=!1,this.eat(17)&&(l=!0),e.value=this.flowParseTypeInitialiser(),e.variance=a),e.optional=l,this.finishNode(e,"ObjectTypeProperty")}}flowCheckGetterSetterParams(e){let s=e.kind==="get"?0:1,r=e.value.params.length+(e.value.rest?1:0);e.value.this&&this.raise(e.kind==="get"?T.GetterMayNotHaveThisParam:T.SetterMayNotHaveThisParam,{at:e.value.this}),r!==s&&this.raise(e.kind==="get"?h.BadGetterArity:h.BadSetterArity,{at:e}),e.kind==="set"&&e.value.rest&&this.raise(h.BadSetterRestParameter,{at:e})}flowObjectTypeSemicolon(){!this.eat(13)&&!this.eat(12)&&!this.match(8)&&!this.match(9)&&this.unexpected()}flowParseQualifiedTypeIdentifier(e,s){var r;(r=e)!=null||(e=this.state.startLoc);let a=s||this.flowParseRestrictedIdentifier(!0);for(;this.eat(16);){let n=this.startNodeAt(e);n.qualification=a,n.id=this.flowParseRestrictedIdentifier(!0),a=this.finishNode(n,"QualifiedTypeIdentifier")}return a}flowParseGenericType(e,s){let r=this.startNodeAt(e);return r.typeParameters=null,r.id=this.flowParseQualifiedTypeIdentifier(e,s),this.match(47)&&(r.typeParameters=this.flowParseTypeParameterInstantiation()),this.finishNode(r,"GenericTypeAnnotation")}flowParseTypeofType(){let e=this.startNode();return this.expect(87),e.argument=this.flowParsePrimaryType(),this.finishNode(e,"TypeofTypeAnnotation")}flowParseTupleType(){let e=this.startNode();for(e.types=[],this.expect(0);this.state.pos<this.length&&!this.match(3)&&(e.types.push(this.flowParseType()),!this.match(3));)this.expect(12);return this.expect(3),this.finishNode(e,"TupleTypeAnnotation")}flowParseFunctionTypeParam(e){let s=null,r=!1,a=null,n=this.startNode(),o=this.lookahead(),u=this.state.type===78;return o.type===14||o.type===17?(u&&!e&&this.raise(T.ThisParamMustBeFirst,{at:n}),s=this.parseIdentifier(u),this.eat(17)&&(r=!0,u&&this.raise(T.ThisParamMayNotBeOptional,{at:n})),a=this.flowParseTypeInitialiser()):a=this.flowParseType(),n.name=s,n.optional=r,n.typeAnnotation=a,this.finishNode(n,"FunctionTypeParam")}reinterpretTypeAsFunctionTypeParam(e){let s=this.startNodeAt(e.loc.start);return s.name=null,s.optional=!1,s.typeAnnotation=e,this.finishNode(s,"FunctionTypeParam")}flowParseFunctionTypeParams(e=[]){let s=null,r=null;for(this.match(78)&&(r=this.flowParseFunctionTypeParam(!0),r.name=null,this.match(11)||this.expect(12));!this.match(11)&&!this.match(21);)e.push(this.flowParseFunctionTypeParam(!1)),this.match(11)||this.expect(12);return this.eat(21)&&(s=this.flowParseFunctionTypeParam(!1)),{params:e,rest:s,_this:r}}flowIdentToTypeAnnotation(e,s,r){switch(r.name){case"any":return this.finishNode(s,"AnyTypeAnnotation");case"bool":case"boolean":return this.finishNode(s,"BooleanTypeAnnotation");case"mixed":return this.finishNode(s,"MixedTypeAnnotation");case"empty":return this.finishNode(s,"EmptyTypeAnnotation");case"number":return this.finishNode(s,"NumberTypeAnnotation");case"string":return this.finishNode(s,"StringTypeAnnotation");case"symbol":return this.finishNode(s,"SymbolTypeAnnotation");default:return this.checkNotUnderscore(r.name),this.flowParseGenericType(e,r)}}flowParsePrimaryType(){let e=this.state.startLoc,s=this.startNode(),r,a,n=!1,o=this.state.noAnonFunctionType;switch(this.state.type){case 5:return this.flowParseObjectType({allowStatic:!1,allowExact:!1,allowSpread:!0,allowProto:!1,allowInexact:!0});case 6:return this.flowParseObjectType({allowStatic:!1,allowExact:!0,allowSpread:!0,allowProto:!1,allowInexact:!1});case 0:return this.state.noAnonFunctionType=!1,a=this.flowParseTupleType(),this.state.noAnonFunctionType=o,a;case 47:return s.typeParameters=this.flowParseTypeParameterDeclaration(),this.expect(10),r=this.flowParseFunctionTypeParams(),s.params=r.params,s.rest=r.rest,s.this=r._this,this.expect(11),this.expect(19),s.returnType=this.flowParseType(),this.finishNode(s,"FunctionTypeAnnotation");case 10:if(this.next(),!this.match(11)&&!this.match(21))if(k(this.state.type)||this.match(78)){let u=this.lookahead().type;n=u!==17&&u!==14}else n=!0;if(n){if(this.state.noAnonFunctionType=!1,a=this.flowParseType(),this.state.noAnonFunctionType=o,this.state.noAnonFunctionType||!(this.match(12)||this.match(11)&&this.lookahead().type===19))return this.expect(11),a;this.eat(12)}return a?r=this.flowParseFunctionTypeParams([this.reinterpretTypeAsFunctionTypeParam(a)]):r=this.flowParseFunctionTypeParams(),s.params=r.params,s.rest=r.rest,s.this=r._this,this.expect(11),this.expect(19),s.returnType=this.flowParseType(),s.typeParameters=null,this.finishNode(s,"FunctionTypeAnnotation");case 133:return this.parseLiteral(this.state.value,"StringLiteralTypeAnnotation");case 85:case 86:return s.value=this.match(85),this.next(),this.finishNode(s,"BooleanLiteralTypeAnnotation");case 53:if(this.state.value==="-"){if(this.next(),this.match(134))return this.parseLiteralAtNode(-this.state.value,"NumberLiteralTypeAnnotation",s);if(this.match(135))return this.parseLiteralAtNode(-this.state.value,"BigIntLiteralTypeAnnotation",s);throw this.raise(T.UnexpectedSubtractionOperand,{at:this.state.startLoc})}this.unexpected();return;case 134:return this.parseLiteral(this.state.value,"NumberLiteralTypeAnnotation");case 135:return this.parseLiteral(this.state.value,"BigIntLiteralTypeAnnotation");case 88:return this.next(),this.finishNode(s,"VoidTypeAnnotation");case 84:return this.next(),this.finishNode(s,"NullLiteralTypeAnnotation");case 78:return this.next(),this.finishNode(s,"ThisTypeAnnotation");case 55:return this.next(),this.finishNode(s,"ExistsTypeAnnotation");case 87:return this.flowParseTypeofType();default:if(er(this.state.type)){let u=fe(this.state.type);return this.next(),super.createIdentifier(s,u)}else if(k(this.state.type))return this.isContextual(129)?this.flowParseInterfaceType():this.flowIdentToTypeAnnotation(e,s,this.parseIdentifier())}this.unexpected()}flowParsePostfixType(){let e=this.state.startLoc,s=this.flowParsePrimaryType(),r=!1;for(;(this.match(0)||this.match(18))&&!this.canInsertSemicolon();){let a=this.startNodeAt(e),n=this.eat(18);r=r||n,this.expect(0),!n&&this.match(3)?(a.elementType=s,this.next(),s=this.finishNode(a,"ArrayTypeAnnotation")):(a.objectType=s,a.indexType=this.flowParseType(),this.expect(3),r?(a.optional=n,s=this.finishNode(a,"OptionalIndexedAccessType")):s=this.finishNode(a,"IndexedAccessType"))}return s}flowParsePrefixType(){let e=this.startNode();return this.eat(17)?(e.typeAnnotation=this.flowParsePrefixType(),this.finishNode(e,"NullableTypeAnnotation")):this.flowParsePostfixType()}flowParseAnonFunctionWithoutParens(){let e=this.flowParsePrefixType();if(!this.state.noAnonFunctionType&&this.eat(19)){let s=this.startNodeAt(e.loc.start);return s.params=[this.reinterpretTypeAsFunctionTypeParam(e)],s.rest=null,s.this=null,s.returnType=this.flowParseType(),s.typeParameters=null,this.finishNode(s,"FunctionTypeAnnotation")}return e}flowParseIntersectionType(){let e=this.startNode();this.eat(45);let s=this.flowParseAnonFunctionWithoutParens();for(e.types=[s];this.eat(45);)e.types.push(this.flowParseAnonFunctionWithoutParens());return e.types.length===1?s:this.finishNode(e,"IntersectionTypeAnnotation")}flowParseUnionType(){let e=this.startNode();this.eat(43);let s=this.flowParseIntersectionType();for(e.types=[s];this.eat(43);)e.types.push(this.flowParseIntersectionType());return e.types.length===1?s:this.finishNode(e,"UnionTypeAnnotation")}flowParseType(){let e=this.state.inType;this.state.inType=!0;let s=this.flowParseUnionType();return this.state.inType=e,s}flowParseTypeOrImplicitInstantiation(){if(this.state.type===132&&this.state.value==="_"){let e=this.state.startLoc,s=this.parseIdentifier();return this.flowParseGenericType(e,s)}else return this.flowParseType()}flowParseTypeAnnotation(){let e=this.startNode();return e.typeAnnotation=this.flowParseTypeInitialiser(),this.finishNode(e,"TypeAnnotation")}flowParseTypeAnnotatableIdentifier(e){let s=e?this.parseIdentifier():this.flowParseRestrictedIdentifier();return this.match(14)&&(s.typeAnnotation=this.flowParseTypeAnnotation(),this.resetEndLocation(s)),s}typeCastToParameter(e){return e.expression.typeAnnotation=e.typeAnnotation,this.resetEndLocation(e.expression,e.typeAnnotation.loc.end),e.expression}flowParseVariance(){let e=null;return this.match(53)?(e=this.startNode(),this.state.value==="+"?e.kind="plus":e.kind="minus",this.next(),this.finishNode(e,"Variance")):e}parseFunctionBody(e,s,r=!1){if(s){this.forwardNoArrowParamsConversionAt(e,()=>super.parseFunctionBody(e,!0,r));return}super.parseFunctionBody(e,!1,r)}parseFunctionBodyAndFinish(e,s,r=!1){if(this.match(14)){let a=this.startNode();[a.typeAnnotation,e.predicate]=this.flowParseTypeAndPredicateInitialiser(),e.returnType=a.typeAnnotation?this.finishNode(a,"TypeAnnotation"):null}return super.parseFunctionBodyAndFinish(e,s,r)}parseStatementLike(e){if(this.state.strict&&this.isContextual(129)){let r=this.lookahead();if(X(r.type)){let a=this.startNode();return this.next(),this.flowParseInterface(a)}}else if(this.shouldParseEnums()&&this.isContextual(126)){let r=this.startNode();return this.next(),this.flowParseEnumDeclaration(r)}let s=super.parseStatementLike(e);return this.flowPragma===void 0&&!this.isValidDirective(s)&&(this.flowPragma=null),s}parseExpressionStatement(e,s,r){if(s.type==="Identifier"){if(s.name==="declare"){if(this.match(80)||k(this.state.type)||this.match(68)||this.match(74)||this.match(82))return this.flowParseDeclare(e)}else if(k(this.state.type)){if(s.name==="interface")return this.flowParseInterface(e);if(s.name==="type")return this.flowParseTypeAlias(e);if(s.name==="opaque")return this.flowParseOpaqueType(e,!1)}}return super.parseExpressionStatement(e,s,r)}shouldParseExportDeclaration(){let{type:e}=this.state;return ca(e)||this.shouldParseEnums()&&e===126?!this.state.containsEsc:super.shouldParseExportDeclaration()}isExportDefaultSpecifier(){let{type:e}=this.state;return ca(e)||this.shouldParseEnums()&&e===126?this.state.containsEsc:super.isExportDefaultSpecifier()}parseExportDefaultExpression(){if(this.shouldParseEnums()&&this.isContextual(126)){let e=this.startNode();return this.next(),this.flowParseEnumDeclaration(e)}return super.parseExportDefaultExpression()}parseConditional(e,s,r){if(!this.match(17))return e;if(this.state.maybeInArrowParameters){let f=this.lookaheadCharCode();if(f===44||f===61||f===58||f===41)return this.setOptionalParametersError(r),e}this.expect(17);let a=this.state.clone(),n=this.state.noArrowAt,o=this.startNodeAt(s),{consequent:u,failed:l}=this.tryParseConditionalConsequent(),[c,p]=this.getArrowLikeExpressions(u);if(l||p.length>0){let f=[...n];if(p.length>0){this.state=a,this.state.noArrowAt=f;for(let m=0;m<p.length;m++)f.push(p[m].start);({consequent:u,failed:l}=this.tryParseConditionalConsequent()),[c,p]=this.getArrowLikeExpressions(u)}l&&c.length>1&&this.raise(T.AmbiguousConditionalArrow,{at:a.startLoc}),l&&c.length===1&&(this.state=a,f.push(c[0].start),this.state.noArrowAt=f,{consequent:u,failed:l}=this.tryParseConditionalConsequent())}return this.getArrowLikeExpressions(u,!0),this.state.noArrowAt=n,this.expect(14),o.test=e,o.consequent=u,o.alternate=this.forwardNoArrowParamsConversionAt(o,()=>this.parseMaybeAssign(void 0,void 0)),this.finishNode(o,"ConditionalExpression")}tryParseConditionalConsequent(){this.state.noArrowParamsConversionAt.push(this.state.start);let e=this.parseMaybeAssignAllowIn(),s=!this.match(14);return this.state.noArrowParamsConversionAt.pop(),{consequent:e,failed:s}}getArrowLikeExpressions(e,s){let r=[e],a=[];for(;r.length!==0;){let n=r.pop();n.type==="ArrowFunctionExpression"?(n.typeParameters||!n.returnType?this.finishArrowValidation(n):a.push(n),r.push(n.body)):n.type==="ConditionalExpression"&&(r.push(n.consequent),r.push(n.alternate))}return s?(a.forEach(n=>this.finishArrowValidation(n)),[a,[]]):Sl(a,n=>n.params.every(o=>this.isAssignable(o,!0)))}finishArrowValidation(e){var s;this.toAssignableList(e.params,(s=e.extra)==null?void 0:s.trailingCommaLoc,!1),this.scope.enter(6),super.checkParams(e,!1,!0),this.scope.exit()}forwardNoArrowParamsConversionAt(e,s){let r;return this.state.noArrowParamsConversionAt.indexOf(e.start)!==-1?(this.state.noArrowParamsConversionAt.push(this.state.start),r=s(),this.state.noArrowParamsConversionAt.pop()):r=s(),r}parseParenItem(e,s){if(e=super.parseParenItem(e,s),this.eat(17)&&(e.optional=!0,this.resetEndLocation(e)),this.match(14)){let r=this.startNodeAt(s);return r.expression=e,r.typeAnnotation=this.flowParseTypeAnnotation(),this.finishNode(r,"TypeCastExpression")}return e}assertModuleNodeAllowed(e){e.type==="ImportDeclaration"&&(e.importKind==="type"||e.importKind==="typeof")||e.type==="ExportNamedDeclaration"&&e.exportKind==="type"||e.type==="ExportAllDeclaration"&&e.exportKind==="type"||super.assertModuleNodeAllowed(e)}parseExportDeclaration(e){if(this.isContextual(130)){e.exportKind="type";let s=this.startNode();return this.next(),this.match(5)?(e.specifiers=this.parseExportSpecifiers(!0),super.parseExportFrom(e),null):this.flowParseTypeAlias(s)}else if(this.isContextual(131)){e.exportKind="type";let s=this.startNode();return this.next(),this.flowParseOpaqueType(s,!1)}else if(this.isContextual(129)){e.exportKind="type";let s=this.startNode();return this.next(),this.flowParseInterface(s)}else if(this.shouldParseEnums()&&this.isContextual(126)){e.exportKind="value";let s=this.startNode();return this.next(),this.flowParseEnumDeclaration(s)}else return super.parseExportDeclaration(e)}eatExportStar(e){return super.eatExportStar(e)?!0:this.isContextual(130)&&this.lookahead().type===55?(e.exportKind="type",this.next(),this.next(),!0):!1}maybeParseExportNamespaceSpecifier(e){let{startLoc:s}=this.state,r=super.maybeParseExportNamespaceSpecifier(e);return r&&e.exportKind==="type"&&this.unexpected(s),r}parseClassId(e,s,r){super.parseClassId(e,s,r),this.match(47)&&(e.typeParameters=this.flowParseTypeParameterDeclaration())}parseClassMember(e,s,r){let{startLoc:a}=this.state;if(this.isContextual(125)){if(super.parseClassMemberFromModifier(e,s))return;s.declare=!0}super.parseClassMember(e,s,r),s.declare&&(s.type!=="ClassProperty"&&s.type!=="ClassPrivateProperty"&&s.type!=="PropertyDefinition"?this.raise(T.DeclareClassElement,{at:a}):s.value&&this.raise(T.DeclareClassFieldInitializer,{at:s.value}))}isIterator(e){return e==="iterator"||e==="asyncIterator"}readIterator(){let e=super.readWord1(),s="@@"+e;(!this.isIterator(e)||!this.state.inType)&&this.raise(h.InvalidIdentifier,{at:this.state.curPosition(),identifierName:s}),this.finishToken(132,s)}getTokenFromCode(e){let s=this.input.charCodeAt(this.state.pos+1);e===123&&s===124?this.finishOp(6,2):this.state.inType&&(e===62||e===60)?this.finishOp(e===62?48:47,1):this.state.inType&&e===63?s===46?this.finishOp(18,2):this.finishOp(17,1):al(e,s,this.input.charCodeAt(this.state.pos+2))?(this.state.pos+=2,this.readIterator()):super.getTokenFromCode(e)}isAssignable(e,s){return e.type==="TypeCastExpression"?this.isAssignable(e.expression,s):super.isAssignable(e,s)}toAssignable(e,s=!1){!s&&e.type==="AssignmentExpression"&&e.left.type==="TypeCastExpression"&&(e.left=this.typeCastToParameter(e.left)),super.toAssignable(e,s)}toAssignableList(e,s,r){for(let a=0;a<e.length;a++){let n=e[a];(n==null?void 0:n.type)==="TypeCastExpression"&&(e[a]=this.typeCastToParameter(n))}super.toAssignableList(e,s,r)}toReferencedList(e,s){for(let a=0;a<e.length;a++){var r;let n=e[a];n&&n.type==="TypeCastExpression"&&!((r=n.extra)!=null&&r.parenthesized)&&(e.length>1||!s)&&this.raise(T.TypeCastInPattern,{at:n.typeAnnotation})}return e}parseArrayLike(e,s,r,a){let n=super.parseArrayLike(e,s,r,a);return s&&!this.state.maybeInArrowParameters&&this.toReferencedList(n.elements),n}isValidLVal(e,s,r){return e==="TypeCastExpression"||super.isValidLVal(e,s,r)}parseClassProperty(e){return this.match(14)&&(e.typeAnnotation=this.flowParseTypeAnnotation()),super.parseClassProperty(e)}parseClassPrivateProperty(e){return this.match(14)&&(e.typeAnnotation=this.flowParseTypeAnnotation()),super.parseClassPrivateProperty(e)}isClassMethod(){return this.match(47)||super.isClassMethod()}isClassProperty(){return this.match(14)||super.isClassProperty()}isNonstaticConstructor(e){return!this.match(14)&&super.isNonstaticConstructor(e)}pushClassMethod(e,s,r,a,n,o){if(s.variance&&this.unexpected(s.variance.loc.start),delete s.variance,this.match(47)&&(s.typeParameters=this.flowParseTypeParameterDeclaration()),super.pushClassMethod(e,s,r,a,n,o),s.params&&n){let u=s.params;u.length>0&&this.isThisParam(u[0])&&this.raise(T.ThisParamBannedInConstructor,{at:s})}else if(s.type==="MethodDefinition"&&n&&s.value.params){let u=s.value.params;u.length>0&&this.isThisParam(u[0])&&this.raise(T.ThisParamBannedInConstructor,{at:s})}}pushClassPrivateMethod(e,s,r,a){s.variance&&this.unexpected(s.variance.loc.start),delete s.variance,this.match(47)&&(s.typeParameters=this.flowParseTypeParameterDeclaration()),super.pushClassPrivateMethod(e,s,r,a)}parseClassSuper(e){if(super.parseClassSuper(e),e.superClass&&this.match(47)&&(e.superTypeParameters=this.flowParseTypeParameterInstantiation()),this.isContextual(113)){this.next();let s=e.implements=[];do{let r=this.startNode();r.id=this.flowParseRestrictedIdentifier(!0),this.match(47)?r.typeParameters=this.flowParseTypeParameterInstantiation():r.typeParameters=null,s.push(this.finishNode(r,"ClassImplements"))}while(this.eat(12))}}checkGetterSetterParams(e){super.checkGetterSetterParams(e);let s=this.getObjectOrClassMethodParams(e);if(s.length>0){let r=s[0];this.isThisParam(r)&&e.kind==="get"?this.raise(T.GetterMayNotHaveThisParam,{at:r}):this.isThisParam(r)&&this.raise(T.SetterMayNotHaveThisParam,{at:r})}}parsePropertyNamePrefixOperator(e){e.variance=this.flowParseVariance()}parseObjPropValue(e,s,r,a,n,o,u){e.variance&&this.unexpected(e.variance.loc.start),delete e.variance;let l;this.match(47)&&!o&&(l=this.flowParseTypeParameterDeclaration(),this.match(10)||this.unexpected());let c=super.parseObjPropValue(e,s,r,a,n,o,u);return l&&((c.value||c).typeParameters=l),c}parseAssignableListItemTypes(e){return this.eat(17)&&(e.type!=="Identifier"&&this.raise(T.PatternIsOptional,{at:e}),this.isThisParam(e)&&this.raise(T.ThisParamMayNotBeOptional,{at:e}),e.optional=!0),this.match(14)?e.typeAnnotation=this.flowParseTypeAnnotation():this.isThisParam(e)&&this.raise(T.ThisParamAnnotationRequired,{at:e}),this.match(29)&&this.isThisParam(e)&&this.raise(T.ThisParamNoDefault,{at:e}),this.resetEndLocation(e),e}parseMaybeDefault(e,s){let r=super.parseMaybeDefault(e,s);return r.type==="AssignmentPattern"&&r.typeAnnotation&&r.right.start<r.typeAnnotation.start&&this.raise(T.TypeBeforeInitializer,{at:r.typeAnnotation}),r}checkImportReflection(e){super.checkImportReflection(e),e.module&&e.importKind!=="value"&&this.raise(T.ImportReflectionHasImportType,{at:e.specifiers[0].loc.start})}parseImportSpecifierLocal(e,s,r){s.local=da(e)?this.flowParseRestrictedIdentifier(!0,!0):this.parseIdentifier(),e.specifiers.push(this.finishImportSpecifier(s,r))}isPotentialImportPhase(e){if(super.isPotentialImportPhase(e))return!0;if(this.isContextual(130)){if(!e)return!0;let s=this.lookaheadCharCode();return s===123||s===42}return!e&&this.isContextual(87)}applyImportPhase(e,s,r,a){if(super.applyImportPhase(e,s,r,a),s){if(!r&&this.match(65))return;e.exportKind=r==="type"?r:"value"}else r==="type"&&this.match(55)&&this.unexpected(),e.importKind=r==="type"||r==="typeof"?r:"value"}parseImportSpecifier(e,s,r,a,n){let o=e.imported,u=null;o.type==="Identifier"&&(o.name==="type"?u="type":o.name==="typeof"&&(u="typeof"));let l=!1;if(this.isContextual(93)&&!this.isLookaheadContextual("as")){let p=this.parseIdentifier(!0);u!==null&&!X(this.state.type)?(e.imported=p,e.importKind=u,e.local=ne(p)):(e.imported=o,e.importKind=null,e.local=this.parseIdentifier())}else{if(u!==null&&X(this.state.type))e.imported=this.parseIdentifier(!0),e.importKind=u;else{if(s)throw this.raise(h.ImportBindingIsString,{at:e,importName:o.value});e.imported=o,e.importKind=null}this.eatContextual(93)?e.local=this.parseIdentifier():(l=!0,e.local=ne(e.imported))}let c=da(e);return r&&c&&this.raise(T.ImportTypeShorthandOnlyInPureImport,{at:e}),(r||c)&&this.checkReservedType(e.local.name,e.local.loc.start,!0),l&&!r&&!c&&this.checkReservedWord(e.local.name,e.loc.start,!0,!0),this.finishImportSpecifier(e,"ImportSpecifier")}parseBindingAtom(){switch(this.state.type){case 78:return this.parseIdentifier(!0);default:return super.parseBindingAtom()}}parseFunctionParams(e,s){let r=e.kind;r!=="get"&&r!=="set"&&this.match(47)&&(e.typeParameters=this.flowParseTypeParameterDeclaration()),super.parseFunctionParams(e,s)}parseVarId(e,s){super.parseVarId(e,s),this.match(14)&&(e.id.typeAnnotation=this.flowParseTypeAnnotation(),this.resetEndLocation(e.id))}parseAsyncArrowFromCallExpression(e,s){if(this.match(14)){let r=this.state.noAnonFunctionType;this.state.noAnonFunctionType=!0,e.returnType=this.flowParseTypeAnnotation(),this.state.noAnonFunctionType=r}return super.parseAsyncArrowFromCallExpression(e,s)}shouldParseAsyncArrow(){return this.match(14)||super.shouldParseAsyncArrow()}parseMaybeAssign(e,s){var r;let a=null,n;if(this.hasPlugin("jsx")&&(this.match(142)||this.match(47))){if(a=this.state.clone(),n=this.tryParse(()=>super.parseMaybeAssign(e,s),a),!n.error)return n.node;let{context:l}=this.state,c=l[l.length-1];(c===N.j_oTag||c===N.j_expr)&&l.pop()}if((r=n)!=null&&r.error||this.match(47)){var o,u;a=a||this.state.clone();let l,c=this.tryParse(f=>{var m;l=this.flowParseTypeParameterDeclaration();let d=this.forwardNoArrowParamsConversionAt(l,()=>{let v=super.parseMaybeAssign(e,s);return this.resetStartLocationFromNode(v,l),v});(m=d.extra)!=null&&m.parenthesized&&f();let y=this.maybeUnwrapTypeCastExpression(d);return y.type!=="ArrowFunctionExpression"&&f(),y.typeParameters=l,this.resetStartLocationFromNode(y,l),d},a),p=null;if(c.node&&this.maybeUnwrapTypeCastExpression(c.node).type==="ArrowFunctionExpression"){if(!c.error&&!c.aborted)return c.node.async&&this.raise(T.UnexpectedTypeParameterBeforeAsyncArrowFunction,{at:l}),c.node;p=c.node}if((o=n)!=null&&o.node)return this.state=n.failState,n.node;if(p)return this.state=c.failState,p;throw(u=n)!=null&&u.thrown?n.error:c.thrown?c.error:this.raise(T.UnexpectedTokenAfterTypeParameter,{at:l})}return super.parseMaybeAssign(e,s)}parseArrow(e){if(this.match(14)){let s=this.tryParse(()=>{let r=this.state.noAnonFunctionType;this.state.noAnonFunctionType=!0;let a=this.startNode();return[a.typeAnnotation,e.predicate]=this.flowParseTypeAndPredicateInitialiser(),this.state.noAnonFunctionType=r,this.canInsertSemicolon()&&this.unexpected(),this.match(19)||this.unexpected(),a});if(s.thrown)return null;s.error&&(this.state=s.failState),e.returnType=s.node.typeAnnotation?this.finishNode(s.node,"TypeAnnotation"):null}return super.parseArrow(e)}shouldParseArrow(e){return this.match(14)||super.shouldParseArrow(e)}setArrowFunctionParameters(e,s){this.state.noArrowParamsConversionAt.indexOf(e.start)!==-1?e.params=s:super.setArrowFunctionParameters(e,s)}checkParams(e,s,r,a=!0){if(!(r&&this.state.noArrowParamsConversionAt.indexOf(e.start)!==-1)){for(let n=0;n<e.params.length;n++)this.isThisParam(e.params[n])&&n>0&&this.raise(T.ThisParamMustBeFirst,{at:e.params[n]});super.checkParams(e,s,r,a)}}parseParenAndDistinguishExpression(e){return super.parseParenAndDistinguishExpression(e&&this.state.noArrowAt.indexOf(this.state.start)===-1)}parseSubscripts(e,s,r){if(e.type==="Identifier"&&e.name==="async"&&this.state.noArrowAt.indexOf(s.index)!==-1){this.next();let a=this.startNodeAt(s);a.callee=e,a.arguments=super.parseCallExpressionArguments(11,!1),e=this.finishNode(a,"CallExpression")}else if(e.type==="Identifier"&&e.name==="async"&&this.match(47)){let a=this.state.clone(),n=this.tryParse(u=>this.parseAsyncArrowWithTypeParameters(s)||u(),a);if(!n.error&&!n.aborted)return n.node;let o=this.tryParse(()=>super.parseSubscripts(e,s,r),a);if(o.node&&!o.error)return o.node;if(n.node)return this.state=n.failState,n.node;if(o.node)return this.state=o.failState,o.node;throw n.error||o.error}return super.parseSubscripts(e,s,r)}parseSubscript(e,s,r,a){if(this.match(18)&&this.isLookaheadToken_lt()){if(a.optionalChainMember=!0,r)return a.stop=!0,e;this.next();let n=this.startNodeAt(s);return n.callee=e,n.typeArguments=this.flowParseTypeParameterInstantiation(),this.expect(10),n.arguments=this.parseCallExpressionArguments(11,!1),n.optional=!0,this.finishCallExpression(n,!0)}else if(!r&&this.shouldParseTypes()&&this.match(47)){let n=this.startNodeAt(s);n.callee=e;let o=this.tryParse(()=>(n.typeArguments=this.flowParseTypeParameterInstantiationCallOrNew(),this.expect(10),n.arguments=super.parseCallExpressionArguments(11,!1),a.optionalChainMember&&(n.optional=!1),this.finishCallExpression(n,a.optionalChainMember)));if(o.node)return o.error&&(this.state=o.failState),o.node}return super.parseSubscript(e,s,r,a)}parseNewCallee(e){super.parseNewCallee(e);let s=null;this.shouldParseTypes()&&this.match(47)&&(s=this.tryParse(()=>this.flowParseTypeParameterInstantiationCallOrNew()).node),e.typeArguments=s}parseAsyncArrowWithTypeParameters(e){let s=this.startNodeAt(e);if(this.parseFunctionParams(s,!1),!!this.parseArrow(s))return super.parseArrowExpression(s,void 0,!0)}readToken_mult_modulo(e){let s=this.input.charCodeAt(this.state.pos+1);if(e===42&&s===47&&this.state.hasFlowComment){this.state.hasFlowComment=!1,this.state.pos+=2,this.nextToken();return}super.readToken_mult_modulo(e)}readToken_pipe_amp(e){let s=this.input.charCodeAt(this.state.pos+1);if(e===124&&s===125){this.finishOp(9,2);return}super.readToken_pipe_amp(e)}parseTopLevel(e,s){let r=super.parseTopLevel(e,s);return this.state.hasFlowComment&&this.raise(T.UnterminatedFlowComment,{at:this.state.curPosition()}),r}skipBlockComment(){if(this.hasPlugin("flowComments")&&this.skipFlowComment()){if(this.state.hasFlowComment)throw this.raise(T.NestedFlowComment,{at:this.state.startLoc});this.hasFlowCommentCompletion();let e=this.skipFlowComment();e&&(this.state.pos+=e,this.state.hasFlowComment=!0);return}return super.skipBlockComment(this.state.hasFlowComment?"*-/":"*/")}skipFlowComment(){let{pos:e}=this.state,s=2;for(;[32,9].includes(this.input.charCodeAt(e+s));)s++;let r=this.input.charCodeAt(s+e),a=this.input.charCodeAt(s+e+1);return r===58&&a===58?s+2:this.input.slice(s+e,s+e+12)==="flow-include"?s+12:r===58&&a!==58?s:!1}hasFlowCommentCompletion(){if(this.input.indexOf("*/",this.state.pos)===-1)throw this.raise(h.UnterminatedComment,{at:this.state.curPosition()})}flowEnumErrorBooleanMemberNotInitialized(e,{enumName:s,memberName:r}){this.raise(T.EnumBooleanMemberNotInitialized,{at:e,memberName:r,enumName:s})}flowEnumErrorInvalidMemberInitializer(e,s){return this.raise(s.explicitType?s.explicitType==="symbol"?T.EnumInvalidMemberInitializerSymbolType:T.EnumInvalidMemberInitializerPrimaryType:T.EnumInvalidMemberInitializerUnknownType,Object.assign({at:e},s))}flowEnumErrorNumberMemberNotInitialized(e,{enumName:s,memberName:r}){this.raise(T.EnumNumberMemberNotInitialized,{at:e,enumName:s,memberName:r})}flowEnumErrorStringMemberInconsistentlyInitialized(e,{enumName:s}){this.raise(T.EnumStringMemberInconsistentlyInitialized,{at:e,enumName:s})}flowEnumMemberInit(){let e=this.state.startLoc,s=()=>this.match(12)||this.match(8);switch(this.state.type){case 134:{let r=this.parseNumericLiteral(this.state.value);return s()?{type:"number",loc:r.loc.start,value:r}:{type:"invalid",loc:e}}case 133:{let r=this.parseStringLiteral(this.state.value);return s()?{type:"string",loc:r.loc.start,value:r}:{type:"invalid",loc:e}}case 85:case 86:{let r=this.parseBooleanLiteral(this.match(85));return s()?{type:"boolean",loc:r.loc.start,value:r}:{type:"invalid",loc:e}}default:return{type:"invalid",loc:e}}}flowEnumMemberRaw(){let e=this.state.startLoc,s=this.parseIdentifier(!0),r=this.eat(29)?this.flowEnumMemberInit():{type:"none",loc:e};return{id:s,init:r}}flowEnumCheckExplicitTypeMismatch(e,s,r){let{explicitType:a}=s;a!==null&&a!==r&&this.flowEnumErrorInvalidMemberInitializer(e,s)}flowEnumMembers({enumName:e,explicitType:s}){let r=new Set,a={booleanMembers:[],numberMembers:[],stringMembers:[],defaultedMembers:[]},n=!1;for(;!this.match(8);){if(this.eat(21)){n=!0;break}let o=this.startNode(),{id:u,init:l}=this.flowEnumMemberRaw(),c=u.name;if(c==="")continue;/^[a-z]/.test(c)&&this.raise(T.EnumInvalidMemberName,{at:u,memberName:c,suggestion:c[0].toUpperCase()+c.slice(1),enumName:e}),r.has(c)&&this.raise(T.EnumDuplicateMemberName,{at:u,memberName:c,enumName:e}),r.add(c);let p={enumName:e,explicitType:s,memberName:c};switch(o.id=u,l.type){case"boolean":{this.flowEnumCheckExplicitTypeMismatch(l.loc,p,"boolean"),o.init=l.value,a.booleanMembers.push(this.finishNode(o,"EnumBooleanMember"));break}case"number":{this.flowEnumCheckExplicitTypeMismatch(l.loc,p,"number"),o.init=l.value,a.numberMembers.push(this.finishNode(o,"EnumNumberMember"));break}case"string":{this.flowEnumCheckExplicitTypeMismatch(l.loc,p,"string"),o.init=l.value,a.stringMembers.push(this.finishNode(o,"EnumStringMember"));break}case"invalid":throw this.flowEnumErrorInvalidMemberInitializer(l.loc,p);case"none":switch(s){case"boolean":this.flowEnumErrorBooleanMemberNotInitialized(l.loc,p);break;case"number":this.flowEnumErrorNumberMemberNotInitialized(l.loc,p);break;default:a.defaultedMembers.push(this.finishNode(o,"EnumDefaultedMember"))}}this.match(8)||this.expect(12)}return{members:a,hasUnknownMembers:n}}flowEnumStringMembers(e,s,{enumName:r}){if(e.length===0)return s;if(s.length===0)return e;if(s.length>e.length){for(let a of e)this.flowEnumErrorStringMemberInconsistentlyInitialized(a,{enumName:r});return s}else{for(let a of s)this.flowEnumErrorStringMemberInconsistentlyInitialized(a,{enumName:r});return e}}flowEnumParseExplicitType({enumName:e}){if(!this.eatContextual(102))return null;if(!k(this.state.type))throw this.raise(T.EnumInvalidExplicitTypeUnknownSupplied,{at:this.state.startLoc,enumName:e});let{value:s}=this.state;return this.next(),s!=="boolean"&&s!=="number"&&s!=="string"&&s!=="symbol"&&this.raise(T.EnumInvalidExplicitType,{at:this.state.startLoc,enumName:e,invalidEnumType:s}),s}flowEnumBody(e,s){let r=s.name,a=s.loc.start,n=this.flowEnumParseExplicitType({enumName:r});this.expect(5);let{members:o,hasUnknownMembers:u}=this.flowEnumMembers({enumName:r,explicitType:n});switch(e.hasUnknownMembers=u,n){case"boolean":return e.explicitType=!0,e.members=o.booleanMembers,this.expect(8),this.finishNode(e,"EnumBooleanBody");case"number":return e.explicitType=!0,e.members=o.numberMembers,this.expect(8),this.finishNode(e,"EnumNumberBody");case"string":return e.explicitType=!0,e.members=this.flowEnumStringMembers(o.stringMembers,o.defaultedMembers,{enumName:r}),this.expect(8),this.finishNode(e,"EnumStringBody");case"symbol":return e.members=o.defaultedMembers,this.expect(8),this.finishNode(e,"EnumSymbolBody");default:{let l=()=>(e.members=[],this.expect(8),this.finishNode(e,"EnumStringBody"));e.explicitType=!1;let c=o.booleanMembers.length,p=o.numberMembers.length,f=o.stringMembers.length,m=o.defaultedMembers.length;if(!c&&!p&&!f&&!m)return l();if(!c&&!p)return e.members=this.flowEnumStringMembers(o.stringMembers,o.defaultedMembers,{enumName:r}),this.expect(8),this.finishNode(e,"EnumStringBody");if(!p&&!f&&c>=m){for(let d of o.defaultedMembers)this.flowEnumErrorBooleanMemberNotInitialized(d.loc.start,{enumName:r,memberName:d.id.name});return e.members=o.booleanMembers,this.expect(8),this.finishNode(e,"EnumBooleanBody")}else if(!c&&!f&&p>=m){for(let d of o.defaultedMembers)this.flowEnumErrorNumberMemberNotInitialized(d.loc.start,{enumName:r,memberName:d.id.name});return e.members=o.numberMembers,this.expect(8),this.finishNode(e,"EnumNumberBody")}else return this.raise(T.EnumInconsistentMemberValues,{at:a,enumName:r}),l()}}}flowParseEnumDeclaration(e){let s=this.parseIdentifier();return e.id=s,e.body=this.flowEnumBody(this.startNode(),s),this.finishNode(e,"EnumDeclaration")}isLookaheadToken_lt(){let e=this.nextTokenStart();if(this.input.charCodeAt(e)===60){let s=this.input.charCodeAt(e+1);return s!==60&&s!==61}return!1}maybeUnwrapTypeCastExpression(e){return e.type==="TypeCastExpression"?e.expression:e}},Cl={__proto__:null,quot:'"',amp:"&",apos:"'",lt:"<",gt:">",nbsp:"\xA0",iexcl:"\xA1",cent:"\xA2",pound:"\xA3",curren:"\xA4",yen:"\xA5",brvbar:"\xA6",sect:"\xA7",uml:"\xA8",copy:"\xA9",ordf:"\xAA",laquo:"\xAB",not:"\xAC",shy:"\xAD",reg:"\xAE",macr:"\xAF",deg:"\xB0",plusmn:"\xB1",sup2:"\xB2",sup3:"\xB3",acute:"\xB4",micro:"\xB5",para:"\xB6",middot:"\xB7",cedil:"\xB8",sup1:"\xB9",ordm:"\xBA",raquo:"\xBB",frac14:"\xBC",frac12:"\xBD",frac34:"\xBE",iquest:"\xBF",Agrave:"\xC0",Aacute:"\xC1",Acirc:"\xC2",Atilde:"\xC3",Auml:"\xC4",Aring:"\xC5",AElig:"\xC6",Ccedil:"\xC7",Egrave:"\xC8",Eacute:"\xC9",Ecirc:"\xCA",Euml:"\xCB",Igrave:"\xCC",Iacute:"\xCD",Icirc:"\xCE",Iuml:"\xCF",ETH:"\xD0",Ntilde:"\xD1",Ograve:"\xD2",Oacute:"\xD3",Ocirc:"\xD4",Otilde:"\xD5",Ouml:"\xD6",times:"\xD7",Oslash:"\xD8",Ugrave:"\xD9",Uacute:"\xDA",Ucirc:"\xDB",Uuml:"\xDC",Yacute:"\xDD",THORN:"\xDE",szlig:"\xDF",agrave:"\xE0",aacute:"\xE1",acirc:"\xE2",atilde:"\xE3",auml:"\xE4",aring:"\xE5",aelig:"\xE6",ccedil:"\xE7",egrave:"\xE8",eacute:"\xE9",ecirc:"\xEA",euml:"\xEB",igrave:"\xEC",iacute:"\xED",icirc:"\xEE",iuml:"\xEF",eth:"\xF0",ntilde:"\xF1",ograve:"\xF2",oacute:"\xF3",ocirc:"\xF4",otilde:"\xF5",ouml:"\xF6",divide:"\xF7",oslash:"\xF8",ugrave:"\xF9",uacute:"\xFA",ucirc:"\xFB",uuml:"\xFC",yacute:"\xFD",thorn:"\xFE",yuml:"\xFF",OElig:"\u0152",oelig:"\u0153",Scaron:"\u0160",scaron:"\u0161",Yuml:"\u0178",fnof:"\u0192",circ:"\u02C6",tilde:"\u02DC",Alpha:"\u0391",Beta:"\u0392",Gamma:"\u0393",Delta:"\u0394",Epsilon:"\u0395",Zeta:"\u0396",Eta:"\u0397",Theta:"\u0398",Iota:"\u0399",Kappa:"\u039A",Lambda:"\u039B",Mu:"\u039C",Nu:"\u039D",Xi:"\u039E",Omicron:"\u039F",Pi:"\u03A0",Rho:"\u03A1",Sigma:"\u03A3",Tau:"\u03A4",Upsilon:"\u03A5",Phi:"\u03A6",Chi:"\u03A7",Psi:"\u03A8",Omega:"\u03A9",alpha:"\u03B1",beta:"\u03B2",gamma:"\u03B3",delta:"\u03B4",epsilon:"\u03B5",zeta:"\u03B6",eta:"\u03B7",theta:"\u03B8",iota:"\u03B9",kappa:"\u03BA",lambda:"\u03BB",mu:"\u03BC",nu:"\u03BD",xi:"\u03BE",omicron:"\u03BF",pi:"\u03C0",rho:"\u03C1",sigmaf:"\u03C2",sigma:"\u03C3",tau:"\u03C4",upsilon:"\u03C5",phi:"\u03C6",chi:"\u03C7",psi:"\u03C8",omega:"\u03C9",thetasym:"\u03D1",upsih:"\u03D2",piv:"\u03D6",ensp:"\u2002",emsp:"\u2003",thinsp:"\u2009",zwnj:"\u200C",zwj:"\u200D",lrm:"\u200E",rlm:"\u200F",ndash:"\u2013",mdash:"\u2014",lsquo:"\u2018",rsquo:"\u2019",sbquo:"\u201A",ldquo:"\u201C",rdquo:"\u201D",bdquo:"\u201E",dagger:"\u2020",Dagger:"\u2021",bull:"\u2022",hellip:"\u2026",permil:"\u2030",prime:"\u2032",Prime:"\u2033",lsaquo:"\u2039",rsaquo:"\u203A",oline:"\u203E",frasl:"\u2044",euro:"\u20AC",image:"\u2111",weierp:"\u2118",real:"\u211C",trade:"\u2122",alefsym:"\u2135",larr:"\u2190",uarr:"\u2191",rarr:"\u2192",darr:"\u2193",harr:"\u2194",crarr:"\u21B5",lArr:"\u21D0",uArr:"\u21D1",rArr:"\u21D2",dArr:"\u21D3",hArr:"\u21D4",forall:"\u2200",part:"\u2202",exist:"\u2203",empty:"\u2205",nabla:"\u2207",isin:"\u2208",notin:"\u2209",ni:"\u220B",prod:"\u220F",sum:"\u2211",minus:"\u2212",lowast:"\u2217",radic:"\u221A",prop:"\u221D",infin:"\u221E",ang:"\u2220",and:"\u2227",or:"\u2228",cap:"\u2229",cup:"\u222A",int:"\u222B",there4:"\u2234",sim:"\u223C",cong:"\u2245",asymp:"\u2248",ne:"\u2260",equiv:"\u2261",le:"\u2264",ge:"\u2265",sub:"\u2282",sup:"\u2283",nsub:"\u2284",sube:"\u2286",supe:"\u2287",oplus:"\u2295",otimes:"\u2297",perp:"\u22A5",sdot:"\u22C5",lceil:"\u2308",rceil:"\u2309",lfloor:"\u230A",rfloor:"\u230B",lang:"\u2329",rang:"\u232A",loz:"\u25CA",spades:"\u2660",clubs:"\u2663",hearts:"\u2665",diams:"\u2666"},ve=ae`jsx`({AttributeIsEmpty:"JSX attributes must only be assigned a non-empty expression.",MissingClosingTagElement:({openingTagName:i})=>`Expected corresponding JSX closing tag for <${i}>.`,MissingClosingTagFragment:"Expected corresponding JSX closing tag for <>.",UnexpectedSequenceExpression:"Sequence expressions cannot be directly nested inside JSX. Did you mean to wrap it in parentheses (...)?",UnexpectedToken:({unexpected:i,HTMLEntity:t})=>`Unexpected token \`${i}\`. Did you mean \`${t}\` or \`{'${i}'}\`?`,UnsupportedJsxValue:"JSX value should be either an expression or a quoted JSX text.",UnterminatedJsxContent:"Unterminated JSX contents.",UnwrappedAdjacentJSXElements:"Adjacent JSX elements must be wrapped in an enclosing tag. Did you want a JSX fragment <>...</>?"});function he(i){return i?i.type==="JSXOpeningFragment"||i.type==="JSXClosingFragment":!1}function Le(i){if(i.type==="JSXIdentifier")return i.name;if(i.type==="JSXNamespacedName")return i.namespace.name+":"+i.name.name;if(i.type==="JSXMemberExpression")return Le(i.object)+"."+Le(i.property);throw new Error("Node had unexpected type: "+i.type)}var Il=i=>class extends i{jsxReadToken(){let e="",s=this.state.pos;for(;;){if(this.state.pos>=this.length)throw this.raise(ve.UnterminatedJsxContent,{at:this.state.startLoc});let r=this.input.charCodeAt(this.state.pos);switch(r){case 60:case 123:if(this.state.pos===this.state.start){r===60&&this.state.canStartJSXElement?(++this.state.pos,this.finishToken(142)):super.getTokenFromCode(r);return}e+=this.input.slice(s,this.state.pos),this.finishToken(141,e);return;case 38:e+=this.input.slice(s,this.state.pos),e+=this.jsxReadEntity(),s=this.state.pos;break;case 62:case 125:default:rt(r)?(e+=this.input.slice(s,this.state.pos),e+=this.jsxReadNewLine(!0),s=this.state.pos):++this.state.pos}}}jsxReadNewLine(e){let s=this.input.charCodeAt(this.state.pos),r;return++this.state.pos,s===13&&this.input.charCodeAt(this.state.pos)===10?(++this.state.pos,r=e?`
14
14
  `:`\r
15
15
  `):r=String.fromCharCode(s),++this.state.curLine,this.state.lineStart=this.state.pos,r}jsxReadString(e){let s="",r=++this.state.pos;for(;;){if(this.state.pos>=this.length)throw this.raise(h.UnterminatedString,{at:this.state.startLoc});let a=this.input.charCodeAt(this.state.pos);if(a===e)break;a===38?(s+=this.input.slice(r,this.state.pos),s+=this.jsxReadEntity(),r=this.state.pos):rt(a)?(s+=this.input.slice(r,this.state.pos),s+=this.jsxReadNewLine(!1),r=this.state.pos):++this.state.pos}s+=this.input.slice(r,this.state.pos++),this.finishToken(133,s)}jsxReadEntity(){let e=++this.state.pos;if(this.codePointAtPos(this.state.pos)===35){++this.state.pos;let s=10;this.codePointAtPos(this.state.pos)===120&&(s=16,++this.state.pos);let r=this.readInt(s,void 0,!1,"bail");if(r!==null&&this.codePointAtPos(this.state.pos)===59)return++this.state.pos,String.fromCodePoint(r)}else{let s=0,r=!1;for(;s++<10&&this.state.pos<this.length&&!(r=this.codePointAtPos(this.state.pos)==59);)++this.state.pos;if(r){let a=this.input.slice(e,this.state.pos),n=Cl[a];if(++this.state.pos,n)return n}}return this.state.pos=e,"&"}jsxReadWord(){let e,s=this.state.pos;do e=this.input.charCodeAt(++this.state.pos);while(De(e)||e===45);this.finishToken(140,this.input.slice(s,this.state.pos))}jsxParseIdentifier(){let e=this.startNode();return this.match(140)?e.name=this.state.value:er(this.state.type)?e.name=fe(this.state.type):this.unexpected(),this.next(),this.finishNode(e,"JSXIdentifier")}jsxParseNamespacedName(){let e=this.state.startLoc,s=this.jsxParseIdentifier();if(!this.eat(14))return s;let r=this.startNodeAt(e);return r.namespace=s,r.name=this.jsxParseIdentifier(),this.finishNode(r,"JSXNamespacedName")}jsxParseElementName(){let e=this.state.startLoc,s=this.jsxParseNamespacedName();if(s.type==="JSXNamespacedName")return s;for(;this.eat(16);){let r=this.startNodeAt(e);r.object=s,r.property=this.jsxParseIdentifier(),s=this.finishNode(r,"JSXMemberExpression")}return s}jsxParseAttributeValue(){let e;switch(this.state.type){case 5:return e=this.startNode(),this.setContext(N.brace),this.next(),e=this.jsxParseExpressionContainer(e,N.j_oTag),e.expression.type==="JSXEmptyExpression"&&this.raise(ve.AttributeIsEmpty,{at:e}),e;case 142:case 133:return this.parseExprAtom();default:throw this.raise(ve.UnsupportedJsxValue,{at:this.state.startLoc})}}jsxParseEmptyExpression(){let e=this.startNodeAt(this.state.lastTokEndLoc);return this.finishNodeAt(e,"JSXEmptyExpression",this.state.startLoc)}jsxParseSpreadChild(e){return this.next(),e.expression=this.parseExpression(),this.setContext(N.j_expr),this.state.canStartJSXElement=!0,this.expect(8),this.finishNode(e,"JSXSpreadChild")}jsxParseExpressionContainer(e,s){if(this.match(8))e.expression=this.jsxParseEmptyExpression();else{let r=this.parseExpression();e.expression=r}return this.setContext(s),this.state.canStartJSXElement=!0,this.expect(8),this.finishNode(e,"JSXExpressionContainer")}jsxParseAttribute(){let e=this.startNode();return this.match(5)?(this.setContext(N.brace),this.next(),this.expect(21),e.argument=this.parseMaybeAssignAllowIn(),this.setContext(N.j_oTag),this.state.canStartJSXElement=!0,this.expect(8),this.finishNode(e,"JSXSpreadAttribute")):(e.name=this.jsxParseNamespacedName(),e.value=this.eat(29)?this.jsxParseAttributeValue():null,this.finishNode(e,"JSXAttribute"))}jsxParseOpeningElementAt(e){let s=this.startNodeAt(e);return this.eat(143)?this.finishNode(s,"JSXOpeningFragment"):(s.name=this.jsxParseElementName(),this.jsxParseOpeningElementAfterName(s))}jsxParseOpeningElementAfterName(e){let s=[];for(;!this.match(56)&&!this.match(143);)s.push(this.jsxParseAttribute());return e.attributes=s,e.selfClosing=this.eat(56),this.expect(143),this.finishNode(e,"JSXOpeningElement")}jsxParseClosingElementAt(e){let s=this.startNodeAt(e);return this.eat(143)?this.finishNode(s,"JSXClosingFragment"):(s.name=this.jsxParseElementName(),this.expect(143),this.finishNode(s,"JSXClosingElement"))}jsxParseElementAt(e){let s=this.startNodeAt(e),r=[],a=this.jsxParseOpeningElementAt(e),n=null;if(!a.selfClosing){e:for(;;)switch(this.state.type){case 142:if(e=this.state.startLoc,this.next(),this.eat(56)){n=this.jsxParseClosingElementAt(e);break e}r.push(this.jsxParseElementAt(e));break;case 141:r.push(this.parseExprAtom());break;case 5:{let o=this.startNode();this.setContext(N.brace),this.next(),this.match(21)?r.push(this.jsxParseSpreadChild(o)):r.push(this.jsxParseExpressionContainer(o,N.j_expr));break}default:this.unexpected()}he(a)&&!he(n)&&n!==null?this.raise(ve.MissingClosingTagFragment,{at:n}):!he(a)&&he(n)?this.raise(ve.MissingClosingTagElement,{at:n,openingTagName:Le(a.name)}):!he(a)&&!he(n)&&Le(n.name)!==Le(a.name)&&this.raise(ve.MissingClosingTagElement,{at:n,openingTagName:Le(a.name)})}if(he(a)?(s.openingFragment=a,s.closingFragment=n):(s.openingElement=a,s.closingElement=n),s.children=r,this.match(47))throw this.raise(ve.UnwrappedAdjacentJSXElements,{at:this.state.startLoc});return he(a)?this.finishNode(s,"JSXFragment"):this.finishNode(s,"JSXElement")}jsxParseElement(){let e=this.state.startLoc;return this.next(),this.jsxParseElementAt(e)}setContext(e){let{context:s}=this.state;s[s.length-1]=e}parseExprAtom(e){return this.match(141)?this.parseLiteral(this.state.value,"JSXText"):this.match(142)?this.jsxParseElement():this.match(47)&&this.input.charCodeAt(this.state.pos)!==33?(this.replaceToken(142),this.jsxParseElement()):super.parseExprAtom(e)}skipSpace(){this.curContext().preserveSpace||super.skipSpace()}getTokenFromCode(e){let s=this.curContext();if(s===N.j_expr){this.jsxReadToken();return}if(s===N.j_oTag||s===N.j_cTag){if(ie(e)){this.jsxReadWord();return}if(e===62){++this.state.pos,this.finishToken(143);return}if((e===34||e===39)&&s===N.j_oTag){this.jsxReadString(e);return}}if(e===60&&this.state.canStartJSXElement&&this.input.charCodeAt(this.state.pos+1)!==33){++this.state.pos,this.finishToken(142);return}super.getTokenFromCode(e)}updateContext(e){let{context:s,type:r}=this.state;if(r===56&&e===142)s.splice(-2,2,N.j_cTag),this.state.canStartJSXElement=!1;else if(r===142)s.push(N.j_oTag);else if(r===143){let a=s[s.length-1];a===N.j_oTag&&e===56||a===N.j_cTag?(s.pop(),this.state.canStartJSXElement=s[s.length-1]===N.j_expr):(this.setContext(N.j_expr),this.state.canStartJSXElement=!0)}else this.state.canStartJSXElement=Wu(r)}},Ws=class extends it{constructor(...t){super(...t),this.types=new Set,this.enums=new Set,this.constEnums=new Set,this.classes=new Set,this.exportOnlyBindings=new Set}},Vs=class extends at{constructor(...t){super(...t),this.importsStack=[]}createScope(t){return this.importsStack.push(new Set),new Ws(t)}enter(t){t==256&&this.importsStack.push(new Set),super.enter(t)}exit(){let t=super.exit();return t==256&&this.importsStack.pop(),t}hasImport(t,e){let s=this.importsStack.length;if(this.importsStack[s-1].has(t))return!0;if(!e&&s>1){for(let r=0;r<s-1;r++)if(this.importsStack[r].has(t))return!0}return!1}declareName(t,e,s){if(e&4096){this.hasImport(t,!0)&&this.parser.raise(h.VarRedeclaration,{at:s,identifierName:t}),this.importsStack[this.importsStack.length-1].add(t);return}let r=this.currentScope();if(e&1024){this.maybeExportDefined(r,t),r.exportOnlyBindings.add(t);return}super.declareName(t,e,s),e&2&&(e&1||(this.checkRedeclarationInScope(r,t,e,s),this.maybeExportDefined(r,t)),r.types.add(t)),e&256&&r.enums.add(t),e&512&&r.constEnums.add(t),e&128&&r.classes.add(t)}isRedeclaredInScope(t,e,s){if(t.enums.has(e)){if(s&256){let r=!!(s&512),a=t.constEnums.has(e);return r!==a}return!0}return s&128&&t.classes.has(e)?t.lexical.has(e)?!!(s&1):!1:s&2&&t.types.has(e)?!0:super.isRedeclaredInScope(t,e,s)}checkLocalExport(t){let{name:e}=t;if(this.hasImport(e))return;let s=this.scopeStack.length;for(let r=s-1;r>=0;r--){let a=this.scopeStack[r];if(a.types.has(e)||a.exportOnlyBindings.has(e))return}super.checkLocalExport(t)}},kl=(i,t)=>Object.hasOwnProperty.call(i,t)&&i[t],La=i=>i.type==="ParenthesizedExpression"?La(i.expression):i,zs=class extends qs{toAssignable(t,e=!1){var s,r;let a;switch((t.type==="ParenthesizedExpression"||(s=t.extra)!=null&&s.parenthesized)&&(a=La(t),e?a.type==="Identifier"?this.expressionScope.recordArrowParameterBindingError(h.InvalidParenthesizedAssignment,{at:t}):a.type!=="MemberExpression"&&!this.isOptionalMemberExpression(a)&&this.raise(h.InvalidParenthesizedAssignment,{at:t}):this.raise(h.InvalidParenthesizedAssignment,{at:t})),t.type){case"Identifier":case"ObjectPattern":case"ArrayPattern":case"AssignmentPattern":case"RestElement":break;case"ObjectExpression":t.type="ObjectPattern";for(let o=0,u=t.properties.length,l=u-1;o<u;o++){var n;let c=t.properties[o],p=o===l;this.toAssignableObjectExpressionProp(c,p,e),p&&c.type==="RestElement"&&(n=t.extra)!=null&&n.trailingCommaLoc&&this.raise(h.RestTrailingComma,{at:t.extra.trailingCommaLoc})}break;case"ObjectProperty":{let{key:o,value:u}=t;this.isPrivateName(o)&&this.classScope.usePrivateName(this.getPrivateNameSV(o),o.loc.start),this.toAssignable(u,e);break}case"SpreadElement":throw new Error("Internal @babel/parser error (this is a bug, please report it). SpreadElement should be converted by .toAssignable's caller.");case"ArrayExpression":t.type="ArrayPattern",this.toAssignableList(t.elements,(r=t.extra)==null?void 0:r.trailingCommaLoc,e);break;case"AssignmentExpression":t.operator!=="="&&this.raise(h.MissingEqInAssignment,{at:t.left.loc.end}),t.type="AssignmentPattern",delete t.operator,this.toAssignable(t.left,e);break;case"ParenthesizedExpression":this.toAssignable(a,e);break}}toAssignableObjectExpressionProp(t,e,s){if(t.type==="ObjectMethod")this.raise(t.kind==="get"||t.kind==="set"?h.PatternHasAccessor:h.PatternHasMethod,{at:t.key});else if(t.type==="SpreadElement"){t.type="RestElement";let r=t.argument;this.checkToRestConversion(r,!1),this.toAssignable(r,s),e||this.raise(h.RestTrailingComma,{at:t})}else this.toAssignable(t,s)}toAssignableList(t,e,s){let r=t.length-1;for(let a=0;a<=r;a++){let n=t[a];if(n){if(n.type==="SpreadElement"){n.type="RestElement";let o=n.argument;this.checkToRestConversion(o,!0),this.toAssignable(o,s)}else this.toAssignable(n,s);n.type==="RestElement"&&(a<r?this.raise(h.RestTrailingComma,{at:n}):e&&this.raise(h.RestTrailingComma,{at:e}))}}}isAssignable(t,e){switch(t.type){case"Identifier":case"ObjectPattern":case"ArrayPattern":case"AssignmentPattern":case"RestElement":return!0;case"ObjectExpression":{let s=t.properties.length-1;return t.properties.every((r,a)=>r.type!=="ObjectMethod"&&(a===s||r.type!=="SpreadElement")&&this.isAssignable(r))}case"ObjectProperty":return this.isAssignable(t.value);case"SpreadElement":return this.isAssignable(t.argument);case"ArrayExpression":return t.elements.every(s=>s===null||this.isAssignable(s));case"AssignmentExpression":return t.operator==="=";case"ParenthesizedExpression":return this.isAssignable(t.expression);case"MemberExpression":case"OptionalMemberExpression":return!e;default:return!1}}toReferencedList(t,e){return t}toReferencedListDeep(t,e){this.toReferencedList(t,e);for(let s of t)(s==null?void 0:s.type)==="ArrayExpression"&&this.toReferencedListDeep(s.elements)}parseSpread(t){let e=this.startNode();return this.next(),e.argument=this.parseMaybeAssignAllowIn(t,void 0),this.finishNode(e,"SpreadElement")}parseRestBinding(){let t=this.startNode();return this.next(),t.argument=this.parseBindingAtom(),this.finishNode(t,"RestElement")}parseBindingAtom(){switch(this.state.type){case 0:{let t=this.startNode();return this.next(),t.elements=this.parseBindingList(3,93,1),this.finishNode(t,"ArrayPattern")}case 5:return this.parseObjectLike(8,!0)}return this.parseIdentifier()}parseBindingList(t,e,s){let r=s&1,a=[],n=!0;for(;!this.eat(t);)if(n?n=!1:this.expect(12),r&&this.match(12))a.push(null);else{if(this.eat(t))break;if(this.match(21)){if(a.push(this.parseAssignableListItemTypes(this.parseRestBinding(),s)),!this.checkCommaAfterRest(e)){this.expect(t);break}}else{let o=[];for(this.match(26)&&this.hasPlugin("decorators")&&this.raise(h.UnsupportedParameterDecorator,{at:this.state.startLoc});this.match(26);)o.push(this.parseDecorator());a.push(this.parseAssignableListItem(s,o))}}return a}parseBindingRestProperty(t){return this.next(),t.argument=this.parseIdentifier(),this.checkCommaAfterRest(125),this.finishNode(t,"RestElement")}parseBindingProperty(){let t=this.startNode(),{type:e,startLoc:s}=this.state;return e===21?this.parseBindingRestProperty(t):(e===138?(this.expectPlugin("destructuringPrivate",s),this.classScope.usePrivateName(this.state.value,s),t.key=this.parsePrivateName()):this.parsePropertyName(t),t.method=!1,this.parseObjPropValue(t,s,!1,!1,!0,!1))}parseAssignableListItem(t,e){let s=this.parseMaybeDefault();this.parseAssignableListItemTypes(s,t);let r=this.parseMaybeDefault(s.loc.start,s);return e.length&&(s.decorators=e),r}parseAssignableListItemTypes(t,e){return t}parseMaybeDefault(t,e){var s,r;if((s=t)!=null||(t=this.state.startLoc),e=(r=e)!=null?r:this.parseBindingAtom(),!this.eat(29))return e;let a=this.startNodeAt(t);return a.left=e,a.right=this.parseMaybeAssignAllowIn(),this.finishNode(a,"AssignmentPattern")}isValidLVal(t,e,s){return kl({AssignmentPattern:"left",RestElement:"argument",ObjectProperty:"value",ParenthesizedExpression:"expression",ArrayPattern:"elements",ObjectPattern:"properties"},t)}isOptionalMemberExpression(t){return t.type==="OptionalMemberExpression"}checkLVal(t,{in:e,binding:s=64,checkClashes:r=!1,strictModeChanged:a=!1,hasParenthesizedAncestor:n=!1}){var o;let u=t.type;if(this.isObjectMethod(t))return;let l=this.isOptionalMemberExpression(t);if(l||u==="MemberExpression"){l&&(this.expectPlugin("optionalChainingAssign",t.loc.start),e.type!=="AssignmentExpression"&&this.raise(h.InvalidLhsOptionalChaining,{at:t,ancestor:e})),s!==64&&this.raise(h.InvalidPropertyBindingPattern,{at:t});return}if(u==="Identifier"){this.checkIdentifier(t,s,a);let{name:d}=t;r&&(r.has(d)?this.raise(h.ParamDupe,{at:t}):r.add(d));return}let c=this.isValidLVal(u,!(n||(o=t.extra)!=null&&o.parenthesized)&&e.type==="AssignmentExpression",s);if(c===!0)return;if(c===!1){let d=s===64?h.InvalidLhs:h.InvalidLhsBinding;this.raise(d,{at:t,ancestor:e});return}let[p,f]=Array.isArray(c)?c:[c,u==="ParenthesizedExpression"],m=u==="ArrayPattern"||u==="ObjectPattern"?{type:u}:e;for(let d of[].concat(t[p]))d&&this.checkLVal(d,{in:m,binding:s,checkClashes:r,strictModeChanged:a,hasParenthesizedAncestor:f})}checkIdentifier(t,e,s=!1){this.state.strict&&(s?Ia(t.name,this.inModule):Ca(t.name))&&(e===64?this.raise(h.StrictEvalArguments,{at:t,referenceName:t.name}):this.raise(h.StrictEvalArgumentsBinding,{at:t,bindingName:t.name})),e&8192&&t.name==="let"&&this.raise(h.LetInLexicalBinding,{at:t}),e&64||this.declareNameFromIdentifier(t,e)}declareNameFromIdentifier(t,e){this.scope.declareName(t.name,e,t.loc.start)}checkToRestConversion(t,e){switch(t.type){case"ParenthesizedExpression":this.checkToRestConversion(t.expression,e);break;case"Identifier":case"MemberExpression":break;case"ArrayExpression":case"ObjectExpression":if(e)break;default:this.raise(h.InvalidRestAssignmentPattern,{at:t})}}checkCommaAfterRest(t){return this.match(12)?(this.raise(this.lookaheadCharCode()===t?h.RestTrailingComma:h.ElementAfterRest,{at:this.state.startLoc}),!0):!1}},Nl=(i,t)=>Object.hasOwnProperty.call(i,t)&&i[t];function _l(i){if(i==null)throw new Error(`Unexpected ${i} value.`);return i}function ma(i){if(!i)throw new Error("Assert fail")}var g=ae`typescript`({AbstractMethodHasImplementation:({methodName:i})=>`Method '${i}' cannot have an implementation because it is marked abstract.`,AbstractPropertyHasInitializer:({propertyName:i})=>`Property '${i}' cannot have an initializer because it is marked abstract.`,AccesorCannotDeclareThisParameter:"'get' and 'set' accessors cannot declare 'this' parameters.",AccesorCannotHaveTypeParameters:"An accessor cannot have type parameters.",AccessorCannotBeOptional:"An 'accessor' property cannot be declared optional.",ClassMethodHasDeclare:"Class methods cannot have the 'declare' modifier.",ClassMethodHasReadonly:"Class methods cannot have the 'readonly' modifier.",ConstInitiailizerMustBeStringOrNumericLiteralOrLiteralEnumReference:"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.",DeclareAccessor:({kind:i})=>`'declare' is not allowed in ${i}ters.`,DeclareClassFieldHasInitializer:"Initializers are not allowed in ambient contexts.",DeclareFunctionHasImplementation:"An implementation cannot be declared in ambient contexts.",DuplicateAccessibilityModifier:({modifier:i})=>"Accessibility modifier already seen.",DuplicateModifier:({modifier:i})=>`Duplicate modifier: '${i}'.`,EmptyHeritageClauseType:({token:i})=>`'${i}' list cannot be empty.`,EmptyTypeArguments:"Type argument list cannot be empty.",EmptyTypeParameters:"Type parameter list cannot be empty.",ExpectedAmbientAfterExportDeclare:"'export declare' must be followed by an ambient declaration.",ImportAliasHasImportType:"An import alias can not use 'import type'.",ImportReflectionHasImportType:"An `import module` declaration can not use `type` modifier",IncompatibleModifiers:({modifiers:i})=>`'${i[0]}' modifier cannot be used with '${i[1]}' modifier.`,IndexSignatureHasAbstract:"Index signatures cannot have the 'abstract' modifier.",IndexSignatureHasAccessibility:({modifier:i})=>`Index signatures cannot have an accessibility modifier ('${i}').`,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.",InvalidModifierOnTypeMember:({modifier:i})=>`'${i}' modifier cannot appear on a type member.`,InvalidModifierOnTypeParameter:({modifier:i})=>`'${i}' modifier cannot appear on a type parameter.`,InvalidModifierOnTypeParameterPositions:({modifier:i})=>`'${i}' modifier can only appear on a type parameter of a class, interface or type alias.`,InvalidModifiersOrder:({orderedModifiers:i})=>`'${i[0]}' modifier must precede '${i[1]}' modifier.`,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.",NonAbstractClassHasAbstractMethod:"Abstract methods can only appear within an abstract class.",NonClassMethodPropertyHasAbstractModifer:"'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:i})=>`Private elements cannot have an accessibility modifier ('${i}').`,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.",SetAccesorCannotHaveOptionalParameter:"A 'set' accessor cannot have an optional parameter.",SetAccesorCannotHaveRestParameter:"A 'set' accessor cannot have rest parameter.",SetAccesorCannotHaveReturnType:"A 'set' accessor cannot have a return type annotation.",SingleTypeParameterWithoutTrailingComma:({typeParameterName:i})=>`Single type parameter ${i} should have a trailing comma. Example usage: <${i},>.`,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.",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.",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:i})=>`Name in a signature must be an Identifier, ObjectPattern or ArrayPattern, instead got ${i}.`});function Ol(i){switch(i){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 ya(i){return i==="private"||i==="public"||i==="protected"}function Ml(i){return i==="in"||i==="out"}var Ll=i=>class extends i{constructor(...e){super(...e),this.tsParseInOutModifiers=this.tsParseModifiers.bind(this,{allowedModifiers:["in","out"],disallowedModifiers:["const","public","private","protected","readonly","declare","abstract","override"],errorTemplate:g.InvalidModifierOnTypeParameter}),this.tsParseConstModifier=this.tsParseModifiers.bind(this,{allowedModifiers:["const"],disallowedModifiers:["in","out"],errorTemplate:g.InvalidModifierOnTypeParameterPositions}),this.tsParseInOutConstModifiers=this.tsParseModifiers.bind(this,{allowedModifiers:["in","out","const"],disallowedModifiers:["public","private","protected","readonly","declare","abstract","override"],errorTemplate:g.InvalidModifierOnTypeParameter})}getScopeHandler(){return Vs}tsIsIdentifier(){return k(this.state.type)}tsTokenCanFollowModifier(){return(this.match(0)||this.match(5)||this.match(55)||this.match(21)||this.match(138)||this.isLiteralPropertyName())&&!this.hasPrecedingLineBreak()}tsNextTokenCanFollowModifier(){return this.next(),this.tsTokenCanFollowModifier()}tsParseModifier(e,s){if(!k(this.state.type)&&this.state.type!==58&&this.state.type!==75)return;let r=this.state.value;if(e.indexOf(r)!==-1){if(s&&this.tsIsStartOfStaticBlocks())return;if(this.tsTryParse(this.tsNextTokenCanFollowModifier.bind(this)))return r}}tsParseModifiers({allowedModifiers:e,disallowedModifiers:s,stopOnStartOfClassStaticBlock:r,errorTemplate:a=g.InvalidModifierOnTypeMember},n){let o=(l,c,p,f)=>{c===p&&n[f]&&this.raise(g.InvalidModifiersOrder,{at:l,orderedModifiers:[p,f]})},u=(l,c,p,f)=>{(n[p]&&c===f||n[f]&&c===p)&&this.raise(g.IncompatibleModifiers,{at:l,modifiers:[p,f]})};for(;;){let{startLoc:l}=this.state,c=this.tsParseModifier(e.concat(s??[]),r);if(!c)break;ya(c)?n.accessibility?this.raise(g.DuplicateAccessibilityModifier,{at:l,modifier:c}):(o(l,c,c,"override"),o(l,c,c,"static"),o(l,c,c,"readonly"),n.accessibility=c):Ml(c)?(n[c]&&this.raise(g.DuplicateModifier,{at:l,modifier:c}),n[c]=!0,o(l,c,"in","out")):(Object.hasOwnProperty.call(n,c)?this.raise(g.DuplicateModifier,{at:l,modifier:c}):(o(l,c,"static","readonly"),o(l,c,"static","override"),o(l,c,"override","readonly"),o(l,c,"abstract","override"),u(l,c,"declare","override"),u(l,c,"static","abstract")),n[c]=!0),s!=null&&s.includes(c)&&this.raise(a,{at:l,modifier:c})}}tsIsListTerminator(e){switch(e){case"EnumMembers":case"TypeMembers":return this.match(8);case"HeritageClauseElement":return this.match(5);case"TupleElementTypes":return this.match(3);case"TypeParametersOrArguments":return this.match(48)}}tsParseList(e,s){let r=[];for(;!this.tsIsListTerminator(e);)r.push(s());return r}tsParseDelimitedList(e,s,r){return _l(this.tsParseDelimitedListWorker(e,s,!0,r))}tsParseDelimitedListWorker(e,s,r,a){let n=[],o=-1;for(;!this.tsIsListTerminator(e);){o=-1;let u=s();if(u==null)return;if(n.push(u),this.eat(12)){o=this.state.lastTokStart;continue}if(this.tsIsListTerminator(e))break;r&&this.expect(12);return}return a&&(a.value=o),n}tsParseBracketedList(e,s,r,a,n){a||(r?this.expect(0):this.expect(47));let o=this.tsParseDelimitedList(e,s,n);return r?this.expect(3):this.expect(48),o}tsParseImportType(){let e=this.startNode();return this.expect(83),this.expect(10),this.match(133)||this.raise(g.UnsupportedImportTypeArgument,{at:this.state.startLoc}),e.argument=super.parseExprAtom(),this.expect(11),this.eat(16)&&(e.qualifier=this.tsParseEntityName()),this.match(47)&&(e.typeParameters=this.tsParseTypeArguments()),this.finishNode(e,"TSImportType")}tsParseEntityName(e=!0){let s=this.parseIdentifier(e);for(;this.eat(16);){let r=this.startNodeAtNode(s);r.left=s,r.right=this.parseIdentifier(e),s=this.finishNode(r,"TSQualifiedName")}return s}tsParseTypeReference(){let e=this.startNode();return e.typeName=this.tsParseEntityName(),!this.hasPrecedingLineBreak()&&this.match(47)&&(e.typeParameters=this.tsParseTypeArguments()),this.finishNode(e,"TSTypeReference")}tsParseThisTypePredicate(e){this.next();let s=this.startNodeAtNode(e);return s.parameterName=e,s.typeAnnotation=this.tsParseTypeAnnotation(!1),s.asserts=!1,this.finishNode(s,"TSTypePredicate")}tsParseThisTypeNode(){let e=this.startNode();return this.next(),this.finishNode(e,"TSThisType")}tsParseTypeQuery(){let e=this.startNode();return this.expect(87),this.match(83)?e.exprName=this.tsParseImportType():e.exprName=this.tsParseEntityName(),!this.hasPrecedingLineBreak()&&this.match(47)&&(e.typeParameters=this.tsParseTypeArguments()),this.finishNode(e,"TSTypeQuery")}tsParseTypeParameter(e){let s=this.startNode();return e(s),s.name=this.tsParseTypeParameterName(),s.constraint=this.tsEatThenParseType(81),s.default=this.tsEatThenParseType(29),this.finishNode(s,"TSTypeParameter")}tsTryParseTypeParameters(e){if(this.match(47))return this.tsParseTypeParameters(e)}tsParseTypeParameters(e){let s=this.startNode();this.match(47)||this.match(142)?this.next():this.unexpected();let r={value:-1};return s.params=this.tsParseBracketedList("TypeParametersOrArguments",this.tsParseTypeParameter.bind(this,e),!1,!0,r),s.params.length===0&&this.raise(g.EmptyTypeParameters,{at:s}),r.value!==-1&&this.addExtra(s,"trailingComma",r.value),this.finishNode(s,"TSTypeParameterDeclaration")}tsFillSignature(e,s){let r=e===19,a="parameters",n="typeAnnotation";s.typeParameters=this.tsTryParseTypeParameters(this.tsParseConstModifier),this.expect(10),s[a]=this.tsParseBindingListForSignature(),r?s[n]=this.tsParseTypeOrTypePredicateAnnotation(e):this.match(e)&&(s[n]=this.tsParseTypeOrTypePredicateAnnotation(e))}tsParseBindingListForSignature(){let e=super.parseBindingList(11,41,2);for(let s of e){let{type:r}=s;(r==="AssignmentPattern"||r==="TSParameterProperty")&&this.raise(g.UnsupportedSignatureParameterKind,{at:s,type:r})}return e}tsParseTypeMemberSemicolon(){!this.eat(12)&&!this.isLineTerminator()&&this.expect(13)}tsParseSignatureMember(e,s){return this.tsFillSignature(14,s),this.tsParseTypeMemberSemicolon(),this.finishNode(s,e)}tsIsUnambiguouslyIndexSignature(){return this.next(),k(this.state.type)?(this.next(),this.match(14)):!1}tsTryParseIndexSignature(e){if(!(this.match(0)&&this.tsLookAhead(this.tsIsUnambiguouslyIndexSignature.bind(this))))return;this.expect(0);let s=this.parseIdentifier();s.typeAnnotation=this.tsParseTypeAnnotation(),this.resetEndLocation(s),this.expect(3),e.parameters=[s];let r=this.tsTryParseTypeAnnotation();return r&&(e.typeAnnotation=r),this.tsParseTypeMemberSemicolon(),this.finishNode(e,"TSIndexSignature")}tsParsePropertyOrMethodSignature(e,s){this.eat(17)&&(e.optional=!0);let r=e;if(this.match(10)||this.match(47)){s&&this.raise(g.ReadonlyForMethodSignature,{at:e});let a=r;a.kind&&this.match(47)&&this.raise(g.AccesorCannotHaveTypeParameters,{at:this.state.curPosition()}),this.tsFillSignature(14,a),this.tsParseTypeMemberSemicolon();let n="parameters",o="typeAnnotation";if(a.kind==="get")a[n].length>0&&(this.raise(h.BadGetterArity,{at:this.state.curPosition()}),this.isThisParam(a[n][0])&&this.raise(g.AccesorCannotDeclareThisParameter,{at:this.state.curPosition()}));else if(a.kind==="set"){if(a[n].length!==1)this.raise(h.BadSetterArity,{at:this.state.curPosition()});else{let u=a[n][0];this.isThisParam(u)&&this.raise(g.AccesorCannotDeclareThisParameter,{at:this.state.curPosition()}),u.type==="Identifier"&&u.optional&&this.raise(g.SetAccesorCannotHaveOptionalParameter,{at:this.state.curPosition()}),u.type==="RestElement"&&this.raise(g.SetAccesorCannotHaveRestParameter,{at:this.state.curPosition()})}a[o]&&this.raise(g.SetAccesorCannotHaveReturnType,{at:a[o]})}else a.kind="method";return this.finishNode(a,"TSMethodSignature")}else{let a=r;s&&(a.readonly=!0);let n=this.tsTryParseTypeAnnotation();return n&&(a.typeAnnotation=n),this.tsParseTypeMemberSemicolon(),this.finishNode(a,"TSPropertySignature")}}tsParseTypeMember(){let e=this.startNode();if(this.match(10)||this.match(47))return this.tsParseSignatureMember("TSCallSignatureDeclaration",e);if(this.match(77)){let r=this.startNode();return this.next(),this.match(10)||this.match(47)?this.tsParseSignatureMember("TSConstructSignatureDeclaration",e):(e.key=this.createIdentifier(r,"new"),this.tsParsePropertyOrMethodSignature(e,!1))}this.tsParseModifiers({allowedModifiers:["readonly"],disallowedModifiers:["declare","abstract","private","protected","public","static","override"]},e);let s=this.tsTryParseIndexSignature(e);return s||(super.parsePropertyName(e),!e.computed&&e.key.type==="Identifier"&&(e.key.name==="get"||e.key.name==="set")&&this.tsTokenCanFollowModifier()&&(e.kind=e.key.name,super.parsePropertyName(e)),this.tsParsePropertyOrMethodSignature(e,!!e.readonly))}tsParseTypeLiteral(){let e=this.startNode();return e.members=this.tsParseObjectTypeMembers(),this.finishNode(e,"TSTypeLiteral")}tsParseObjectTypeMembers(){this.expect(5);let e=this.tsParseList("TypeMembers",this.tsParseTypeMember.bind(this));return this.expect(8),e}tsIsStartOfMappedType(){return this.next(),this.eat(53)?this.isContextual(122):(this.isContextual(122)&&this.next(),!this.match(0)||(this.next(),!this.tsIsIdentifier())?!1:(this.next(),this.match(58)))}tsParseMappedTypeParameter(){let e=this.startNode();return e.name=this.tsParseTypeParameterName(),e.constraint=this.tsExpectThenParseType(58),this.finishNode(e,"TSTypeParameter")}tsParseMappedType(){let e=this.startNode();return this.expect(5),this.match(53)?(e.readonly=this.state.value,this.next(),this.expectContextual(122)):this.eatContextual(122)&&(e.readonly=!0),this.expect(0),e.typeParameter=this.tsParseMappedTypeParameter(),e.nameType=this.eatContextual(93)?this.tsParseType():null,this.expect(3),this.match(53)?(e.optional=this.state.value,this.next(),this.expect(17)):this.eat(17)&&(e.optional=!0),e.typeAnnotation=this.tsTryParseType(),this.semicolon(),this.expect(8),this.finishNode(e,"TSMappedType")}tsParseTupleType(){let e=this.startNode();e.elementTypes=this.tsParseBracketedList("TupleElementTypes",this.tsParseTupleElementType.bind(this),!0,!1);let s=!1;return e.elementTypes.forEach(r=>{let{type:a}=r;s&&a!=="TSRestType"&&a!=="TSOptionalType"&&!(a==="TSNamedTupleMember"&&r.optional)&&this.raise(g.OptionalTypeBeforeRequired,{at:r}),s||(s=a==="TSNamedTupleMember"&&r.optional||a==="TSOptionalType")}),this.finishNode(e,"TSTupleType")}tsParseTupleElementType(){let{startLoc:e}=this.state,s=this.eat(21),r,a,n,o,l=X(this.state.type)?this.lookaheadCharCode():null;if(l===58)r=!0,n=!1,a=this.parseIdentifier(!0),this.expect(14),o=this.tsParseType();else if(l===63){n=!0;let c=this.state.startLoc,p=this.state.value,f=this.tsParseNonArrayType();this.lookaheadCharCode()===58?(r=!0,a=this.createIdentifier(this.startNodeAt(c),p),this.expect(17),this.expect(14),o=this.tsParseType()):(r=!1,o=f,this.expect(17))}else o=this.tsParseType(),n=this.eat(17),r=this.eat(14);if(r){let c;a?(c=this.startNodeAtNode(a),c.optional=n,c.label=a,c.elementType=o,this.eat(17)&&(c.optional=!0,this.raise(g.TupleOptionalAfterType,{at:this.state.lastTokStartLoc}))):(c=this.startNodeAtNode(o),c.optional=n,this.raise(g.InvalidTupleMemberLabel,{at:o}),c.label=o,c.elementType=this.tsParseType()),o=this.finishNode(c,"TSNamedTupleMember")}else if(n){let c=this.startNodeAtNode(o);c.typeAnnotation=o,o=this.finishNode(c,"TSOptionalType")}if(s){let c=this.startNodeAt(e);c.typeAnnotation=o,o=this.finishNode(c,"TSRestType")}return o}tsParseParenthesizedType(){let e=this.startNode();return this.expect(10),e.typeAnnotation=this.tsParseType(),this.expect(11),this.finishNode(e,"TSParenthesizedType")}tsParseFunctionOrConstructorType(e,s){let r=this.startNode();return e==="TSConstructorType"&&(r.abstract=!!s,s&&this.next(),this.next()),this.tsInAllowConditionalTypesContext(()=>this.tsFillSignature(19,r)),this.finishNode(r,e)}tsParseLiteralTypeNode(){let e=this.startNode();switch(this.state.type){case 134:case 135:case 133:case 85:case 86:e.literal=super.parseExprAtom();break;default:this.unexpected()}return this.finishNode(e,"TSLiteralType")}tsParseTemplateLiteralType(){let e=this.startNode();return e.literal=super.parseTemplate(!1),this.finishNode(e,"TSLiteralType")}parseTemplateSubstitution(){return this.state.inType?this.tsParseType():super.parseTemplateSubstitution()}tsParseThisTypeOrThisTypePredicate(){let e=this.tsParseThisTypeNode();return this.isContextual(116)&&!this.hasPrecedingLineBreak()?this.tsParseThisTypePredicate(e):e}tsParseNonArrayType(){switch(this.state.type){case 133:case 134:case 135:case 85:case 86:return this.tsParseLiteralTypeNode();case 53:if(this.state.value==="-"){let e=this.startNode(),s=this.lookahead();return s.type!==134&&s.type!==135&&this.unexpected(),e.literal=this.parseMaybeUnary(),this.finishNode(e,"TSLiteralType")}break;case 78:return this.tsParseThisTypeOrThisTypePredicate();case 87:return this.tsParseTypeQuery();case 83:return this.tsParseImportType();case 5:return this.tsLookAhead(this.tsIsStartOfMappedType.bind(this))?this.tsParseMappedType():this.tsParseTypeLiteral();case 0:return this.tsParseTupleType();case 10:return this.tsParseParenthesizedType();case 25:case 24:return this.tsParseTemplateLiteralType();default:{let{type:e}=this.state;if(k(e)||e===88||e===84){let s=e===88?"TSVoidKeyword":e===84?"TSNullKeyword":Ol(this.state.value);if(s!==void 0&&this.lookaheadCharCode()!==46){let r=this.startNode();return this.next(),this.finishNode(r,s)}return this.tsParseTypeReference()}}}this.unexpected()}tsParseArrayTypeOrHigher(){let e=this.tsParseNonArrayType();for(;!this.hasPrecedingLineBreak()&&this.eat(0);)if(this.match(3)){let s=this.startNodeAtNode(e);s.elementType=e,this.expect(3),e=this.finishNode(s,"TSArrayType")}else{let s=this.startNodeAtNode(e);s.objectType=e,s.indexType=this.tsParseType(),this.expect(3),e=this.finishNode(s,"TSIndexedAccessType")}return e}tsParseTypeOperator(){let e=this.startNode(),s=this.state.value;return this.next(),e.operator=s,e.typeAnnotation=this.tsParseTypeOperatorOrHigher(),s==="readonly"&&this.tsCheckTypeAnnotationForReadOnly(e),this.finishNode(e,"TSTypeOperator")}tsCheckTypeAnnotationForReadOnly(e){switch(e.typeAnnotation.type){case"TSTupleType":case"TSArrayType":return;default:this.raise(g.UnexpectedReadonly,{at:e})}}tsParseInferType(){let e=this.startNode();this.expectContextual(115);let s=this.startNode();return s.name=this.tsParseTypeParameterName(),s.constraint=this.tsTryParse(()=>this.tsParseConstraintForInferType()),e.typeParameter=this.finishNode(s,"TSTypeParameter"),this.finishNode(e,"TSInferType")}tsParseConstraintForInferType(){if(this.eat(81)){let e=this.tsInDisallowConditionalTypesContext(()=>this.tsParseType());if(this.state.inDisallowConditionalTypesContext||!this.match(17))return e}}tsParseTypeOperatorOrHigher(){return Xu(this.state.type)&&!this.state.containsEsc?this.tsParseTypeOperator():this.isContextual(115)?this.tsParseInferType():this.tsInAllowConditionalTypesContext(()=>this.tsParseArrayTypeOrHigher())}tsParseUnionOrIntersectionType(e,s,r){let a=this.startNode(),n=this.eat(r),o=[];do o.push(s());while(this.eat(r));return o.length===1&&!n?o[0]:(a.types=o,this.finishNode(a,e))}tsParseIntersectionTypeOrHigher(){return this.tsParseUnionOrIntersectionType("TSIntersectionType",this.tsParseTypeOperatorOrHigher.bind(this),45)}tsParseUnionTypeOrHigher(){return this.tsParseUnionOrIntersectionType("TSUnionType",this.tsParseIntersectionTypeOrHigher.bind(this),43)}tsIsStartOfFunctionType(){return this.match(47)?!0:this.match(10)&&this.tsLookAhead(this.tsIsUnambiguouslyStartOfFunctionType.bind(this))}tsSkipParameterStart(){if(k(this.state.type)||this.match(78))return this.next(),!0;if(this.match(5)){let{errors:e}=this.state,s=e.length;try{return this.parseObjectLike(8,!0),e.length===s}catch{return!1}}if(this.match(0)){this.next();let{errors:e}=this.state,s=e.length;try{return super.parseBindingList(3,93,1),e.length===s}catch{return!1}}return!1}tsIsUnambiguouslyStartOfFunctionType(){return this.next(),!!(this.match(11)||this.match(21)||this.tsSkipParameterStart()&&(this.match(14)||this.match(12)||this.match(17)||this.match(29)||this.match(11)&&(this.next(),this.match(19))))}tsParseTypeOrTypePredicateAnnotation(e){return this.tsInType(()=>{let s=this.startNode();this.expect(e);let r=this.startNode(),a=!!this.tsTryParse(this.tsParseTypePredicateAsserts.bind(this));if(a&&this.match(78)){let u=this.tsParseThisTypeOrThisTypePredicate();return u.type==="TSThisType"?(r.parameterName=u,r.asserts=!0,r.typeAnnotation=null,u=this.finishNode(r,"TSTypePredicate")):(this.resetStartLocationFromNode(u,r),u.asserts=!0),s.typeAnnotation=u,this.finishNode(s,"TSTypeAnnotation")}let n=this.tsIsIdentifier()&&this.tsTryParse(this.tsParseTypePredicatePrefix.bind(this));if(!n)return a?(r.parameterName=this.parseIdentifier(),r.asserts=a,r.typeAnnotation=null,s.typeAnnotation=this.finishNode(r,"TSTypePredicate"),this.finishNode(s,"TSTypeAnnotation")):this.tsParseTypeAnnotation(!1,s);let o=this.tsParseTypeAnnotation(!1);return r.parameterName=n,r.typeAnnotation=o,r.asserts=a,s.typeAnnotation=this.finishNode(r,"TSTypePredicate"),this.finishNode(s,"TSTypeAnnotation")})}tsTryParseTypeOrTypePredicateAnnotation(){if(this.match(14))return this.tsParseTypeOrTypePredicateAnnotation(14)}tsTryParseTypeAnnotation(){if(this.match(14))return this.tsParseTypeAnnotation()}tsTryParseType(){return this.tsEatThenParseType(14)}tsParseTypePredicatePrefix(){let e=this.parseIdentifier();if(this.isContextual(116)&&!this.hasPrecedingLineBreak())return this.next(),e}tsParseTypePredicateAsserts(){if(this.state.type!==109)return!1;let e=this.state.containsEsc;return this.next(),!k(this.state.type)&&!this.match(78)?!1:(e&&this.raise(h.InvalidEscapedReservedWord,{at:this.state.lastTokStartLoc,reservedWord:"asserts"}),!0)}tsParseTypeAnnotation(e=!0,s=this.startNode()){return this.tsInType(()=>{e&&this.expect(14),s.typeAnnotation=this.tsParseType()}),this.finishNode(s,"TSTypeAnnotation")}tsParseType(){ma(this.state.inType);let e=this.tsParseNonConditionalType();if(this.state.inDisallowConditionalTypesContext||this.hasPrecedingLineBreak()||!this.eat(81))return e;let s=this.startNodeAtNode(e);return s.checkType=e,s.extendsType=this.tsInDisallowConditionalTypesContext(()=>this.tsParseNonConditionalType()),this.expect(17),s.trueType=this.tsInAllowConditionalTypesContext(()=>this.tsParseType()),this.expect(14),s.falseType=this.tsInAllowConditionalTypesContext(()=>this.tsParseType()),this.finishNode(s,"TSConditionalType")}isAbstractConstructorSignature(){return this.isContextual(124)&&this.lookahead().type===77}tsParseNonConditionalType(){return this.tsIsStartOfFunctionType()?this.tsParseFunctionOrConstructorType("TSFunctionType"):this.match(77)?this.tsParseFunctionOrConstructorType("TSConstructorType"):this.isAbstractConstructorSignature()?this.tsParseFunctionOrConstructorType("TSConstructorType",!0):this.tsParseUnionTypeOrHigher()}tsParseTypeAssertion(){this.getPluginOption("typescript","disallowAmbiguousJSXLike")&&this.raise(g.ReservedTypeAssertion,{at:this.state.startLoc});let e=this.startNode();return e.typeAnnotation=this.tsInType(()=>(this.next(),this.match(75)?this.tsParseTypeReference():this.tsParseType())),this.expect(48),e.expression=this.parseMaybeUnary(),this.finishNode(e,"TSTypeAssertion")}tsParseHeritageClause(e){let s=this.state.startLoc,r=this.tsParseDelimitedList("HeritageClauseElement",()=>{let a=this.startNode();return a.expression=this.tsParseEntityName(),this.match(47)&&(a.typeParameters=this.tsParseTypeArguments()),this.finishNode(a,"TSExpressionWithTypeArguments")});return r.length||this.raise(g.EmptyHeritageClauseType,{at:s,token:e}),r}tsParseInterfaceDeclaration(e,s={}){if(this.hasFollowingLineBreak())return null;this.expectContextual(129),s.declare&&(e.declare=!0),k(this.state.type)?(e.id=this.parseIdentifier(),this.checkIdentifier(e.id,130)):(e.id=null,this.raise(g.MissingInterfaceName,{at:this.state.startLoc})),e.typeParameters=this.tsTryParseTypeParameters(this.tsParseInOutConstModifiers),this.eat(81)&&(e.extends=this.tsParseHeritageClause("extends"));let r=this.startNode();return r.body=this.tsInType(this.tsParseObjectTypeMembers.bind(this)),e.body=this.finishNode(r,"TSInterfaceBody"),this.finishNode(e,"TSInterfaceDeclaration")}tsParseTypeAliasDeclaration(e){return e.id=this.parseIdentifier(),this.checkIdentifier(e.id,2),e.typeAnnotation=this.tsInType(()=>{if(e.typeParameters=this.tsTryParseTypeParameters(this.tsParseInOutModifiers),this.expect(29),this.isContextual(114)&&this.lookahead().type!==16){let s=this.startNode();return this.next(),this.finishNode(s,"TSIntrinsicKeyword")}return this.tsParseType()}),this.semicolon(),this.finishNode(e,"TSTypeAliasDeclaration")}tsInNoContext(e){let s=this.state.context;this.state.context=[s[0]];try{return e()}finally{this.state.context=s}}tsInType(e){let s=this.state.inType;this.state.inType=!0;try{return e()}finally{this.state.inType=s}}tsInDisallowConditionalTypesContext(e){let s=this.state.inDisallowConditionalTypesContext;this.state.inDisallowConditionalTypesContext=!0;try{return e()}finally{this.state.inDisallowConditionalTypesContext=s}}tsInAllowConditionalTypesContext(e){let s=this.state.inDisallowConditionalTypesContext;this.state.inDisallowConditionalTypesContext=!1;try{return e()}finally{this.state.inDisallowConditionalTypesContext=s}}tsEatThenParseType(e){if(this.match(e))return this.tsNextThenParseType()}tsExpectThenParseType(e){return this.tsInType(()=>(this.expect(e),this.tsParseType()))}tsNextThenParseType(){return this.tsInType(()=>(this.next(),this.tsParseType()))}tsParseEnumMember(){let e=this.startNode();return e.id=this.match(133)?super.parseStringLiteral(this.state.value):this.parseIdentifier(!0),this.eat(29)&&(e.initializer=super.parseMaybeAssignAllowIn()),this.finishNode(e,"TSEnumMember")}tsParseEnumDeclaration(e,s={}){return s.const&&(e.const=!0),s.declare&&(e.declare=!0),this.expectContextual(126),e.id=this.parseIdentifier(),this.checkIdentifier(e.id,e.const?8971:8459),this.expect(5),e.members=this.tsParseDelimitedList("EnumMembers",this.tsParseEnumMember.bind(this)),this.expect(8),this.finishNode(e,"TSEnumDeclaration")}tsParseModuleBlock(){let e=this.startNode();return this.scope.enter(0),this.expect(5),super.parseBlockOrModuleBlockBody(e.body=[],void 0,!0,8),this.scope.exit(),this.finishNode(e,"TSModuleBlock")}tsParseModuleOrNamespaceDeclaration(e,s=!1){if(e.id=this.parseIdentifier(),s||this.checkIdentifier(e.id,1024),this.eat(16)){let r=this.startNode();this.tsParseModuleOrNamespaceDeclaration(r,!0),e.body=r}else this.scope.enter(256),this.prodParam.enter(0),e.body=this.tsParseModuleBlock(),this.prodParam.exit(),this.scope.exit();return this.finishNode(e,"TSModuleDeclaration")}tsParseAmbientExternalModuleDeclaration(e){return this.isContextual(112)?(e.global=!0,e.id=this.parseIdentifier()):this.match(133)?e.id=super.parseStringLiteral(this.state.value):this.unexpected(),this.match(5)?(this.scope.enter(256),this.prodParam.enter(0),e.body=this.tsParseModuleBlock(),this.prodParam.exit(),this.scope.exit()):this.semicolon(),this.finishNode(e,"TSModuleDeclaration")}tsParseImportEqualsDeclaration(e,s,r){e.isExport=r||!1,e.id=s||this.parseIdentifier(),this.checkIdentifier(e.id,4096),this.expect(29);let a=this.tsParseModuleReference();return e.importKind==="type"&&a.type!=="TSExternalModuleReference"&&this.raise(g.ImportAliasHasImportType,{at:a}),e.moduleReference=a,this.semicolon(),this.finishNode(e,"TSImportEqualsDeclaration")}tsIsExternalModuleReference(){return this.isContextual(119)&&this.lookaheadCharCode()===40}tsParseModuleReference(){return this.tsIsExternalModuleReference()?this.tsParseExternalModuleReference():this.tsParseEntityName(!1)}tsParseExternalModuleReference(){let e=this.startNode();return this.expectContextual(119),this.expect(10),this.match(133)||this.unexpected(),e.expression=super.parseExprAtom(),this.expect(11),this.sawUnambiguousESM=!0,this.finishNode(e,"TSExternalModuleReference")}tsLookAhead(e){let s=this.state.clone(),r=e();return this.state=s,r}tsTryParseAndCatch(e){let s=this.tryParse(r=>e()||r());if(!(s.aborted||!s.node))return s.error&&(this.state=s.failState),s.node}tsTryParse(e){let s=this.state.clone(),r=e();if(r!==void 0&&r!==!1)return r;this.state=s}tsTryParseDeclare(e){if(this.isLineTerminator())return;let s=this.state.type,r;return this.isContextual(100)&&(s=74,r="let"),this.tsInAmbientContext(()=>{switch(s){case 68:return e.declare=!0,super.parseFunctionStatement(e,!1,!1);case 80:return e.declare=!0,this.parseClass(e,!0,!1);case 126:return this.tsParseEnumDeclaration(e,{declare:!0});case 112:return this.tsParseAmbientExternalModuleDeclaration(e);case 75:case 74:return!this.match(75)||!this.isLookaheadContextual("enum")?(e.declare=!0,this.parseVarStatement(e,r||this.state.value,!0)):(this.expect(75),this.tsParseEnumDeclaration(e,{const:!0,declare:!0}));case 129:{let a=this.tsParseInterfaceDeclaration(e,{declare:!0});if(a)return a}default:if(k(s))return this.tsParseDeclaration(e,this.state.value,!0,null)}})}tsTryParseExportDeclaration(){return this.tsParseDeclaration(this.startNode(),this.state.value,!0,null)}tsParseExpressionStatement(e,s,r){switch(s.name){case"declare":{let a=this.tsTryParseDeclare(e);return a&&(a.declare=!0),a}case"global":if(this.match(5)){this.scope.enter(256),this.prodParam.enter(0);let a=e;return a.global=!0,a.id=s,a.body=this.tsParseModuleBlock(),this.scope.exit(),this.prodParam.exit(),this.finishNode(a,"TSModuleDeclaration")}break;default:return this.tsParseDeclaration(e,s.name,!1,r)}}tsParseDeclaration(e,s,r,a){switch(s){case"abstract":if(this.tsCheckLineTerminator(r)&&(this.match(80)||k(this.state.type)))return this.tsParseAbstractDeclaration(e,a);break;case"module":if(this.tsCheckLineTerminator(r)){if(this.match(133))return this.tsParseAmbientExternalModuleDeclaration(e);if(k(this.state.type))return this.tsParseModuleOrNamespaceDeclaration(e)}break;case"namespace":if(this.tsCheckLineTerminator(r)&&k(this.state.type))return this.tsParseModuleOrNamespaceDeclaration(e);break;case"type":if(this.tsCheckLineTerminator(r)&&k(this.state.type))return this.tsParseTypeAliasDeclaration(e);break}}tsCheckLineTerminator(e){return e?this.hasFollowingLineBreak()?!1:(this.next(),!0):!this.isLineTerminator()}tsTryParseGenericAsyncArrowFunction(e){if(!this.match(47))return;let s=this.state.maybeInArrowParameters;this.state.maybeInArrowParameters=!0;let r=this.tsTryParseAndCatch(()=>{let a=this.startNodeAt(e);return a.typeParameters=this.tsParseTypeParameters(this.tsParseConstModifier),super.parseFunctionParams(a),a.returnType=this.tsTryParseTypeOrTypePredicateAnnotation(),this.expect(19),a});if(this.state.maybeInArrowParameters=s,!!r)return super.parseArrowExpression(r,null,!0)}tsParseTypeArgumentsInExpression(){if(this.reScan_lt()===47)return this.tsParseTypeArguments()}tsParseTypeArguments(){let e=this.startNode();return e.params=this.tsInType(()=>this.tsInNoContext(()=>(this.expect(47),this.tsParseDelimitedList("TypeParametersOrArguments",this.tsParseType.bind(this))))),e.params.length===0?this.raise(g.EmptyTypeArguments,{at:e}):!this.state.inType&&this.curContext()===N.brace&&this.reScan_lt_gt(),this.expect(48),this.finishNode(e,"TSTypeParameterInstantiation")}tsIsDeclarationStart(){return Ju(this.state.type)}isExportDefaultSpecifier(){return this.tsIsDeclarationStart()?!1:super.isExportDefaultSpecifier()}parseAssignableListItem(e,s){let r=this.state.startLoc,a={};this.tsParseModifiers({allowedModifiers:["public","private","protected","override","readonly"]},a);let n=a.accessibility,o=a.override,u=a.readonly;!(e&4)&&(n||u||o)&&this.raise(g.UnexpectedParameterModifier,{at:r});let l=this.parseMaybeDefault();this.parseAssignableListItemTypes(l,e);let c=this.parseMaybeDefault(l.loc.start,l);if(n||u||o){let p=this.startNodeAt(r);return s.length&&(p.decorators=s),n&&(p.accessibility=n),u&&(p.readonly=u),o&&(p.override=o),c.type!=="Identifier"&&c.type!=="AssignmentPattern"&&this.raise(g.UnsupportedParameterPropertyKind,{at:p}),p.parameter=c,this.finishNode(p,"TSParameterProperty")}return s.length&&(l.decorators=s),c}isSimpleParameter(e){return e.type==="TSParameterProperty"&&super.isSimpleParameter(e.parameter)||super.isSimpleParameter(e)}tsDisallowOptionalPattern(e){for(let s of e.params)s.type!=="Identifier"&&s.optional&&!this.state.isAmbientContext&&this.raise(g.PatternIsOptional,{at:s})}setArrowFunctionParameters(e,s,r){super.setArrowFunctionParameters(e,s,r),this.tsDisallowOptionalPattern(e)}parseFunctionBodyAndFinish(e,s,r=!1){this.match(14)&&(e.returnType=this.tsParseTypeOrTypePredicateAnnotation(14));let a=s==="FunctionDeclaration"?"TSDeclareFunction":s==="ClassMethod"||s==="ClassPrivateMethod"?"TSDeclareMethod":void 0;return a&&!this.match(5)&&this.isLineTerminator()?this.finishNode(e,a):a==="TSDeclareFunction"&&this.state.isAmbientContext&&(this.raise(g.DeclareFunctionHasImplementation,{at:e}),e.declare)?super.parseFunctionBodyAndFinish(e,a,r):(this.tsDisallowOptionalPattern(e),super.parseFunctionBodyAndFinish(e,s,r))}registerFunctionStatementId(e){!e.body&&e.id?this.checkIdentifier(e.id,1024):super.registerFunctionStatementId(e)}tsCheckForInvalidTypeCasts(e){e.forEach(s=>{(s==null?void 0:s.type)==="TSTypeCastExpression"&&this.raise(g.UnexpectedTypeAnnotation,{at:s.typeAnnotation})})}toReferencedList(e,s){return this.tsCheckForInvalidTypeCasts(e),e}parseArrayLike(e,s,r,a){let n=super.parseArrayLike(e,s,r,a);return n.type==="ArrayExpression"&&this.tsCheckForInvalidTypeCasts(n.elements),n}parseSubscript(e,s,r,a){if(!this.hasPrecedingLineBreak()&&this.match(35)){this.state.canStartJSXElement=!1,this.next();let o=this.startNodeAt(s);return o.expression=e,this.finishNode(o,"TSNonNullExpression")}let n=!1;if(this.match(18)&&this.lookaheadCharCode()===60){if(r)return a.stop=!0,e;a.optionalChainMember=n=!0,this.next()}if(this.match(47)||this.match(51)){let o,u=this.tsTryParseAndCatch(()=>{if(!r&&this.atPossibleAsyncArrow(e)){let f=this.tsTryParseGenericAsyncArrowFunction(s);if(f)return f}let l=this.tsParseTypeArgumentsInExpression();if(!l)return;if(n&&!this.match(10)){o=this.state.curPosition();return}if(Wt(this.state.type)){let f=super.parseTaggedTemplateExpression(e,s,a);return f.typeParameters=l,f}if(!r&&this.eat(10)){let f=this.startNodeAt(s);return f.callee=e,f.arguments=this.parseCallExpressionArguments(11,!1),this.tsCheckForInvalidTypeCasts(f.arguments),f.typeParameters=l,a.optionalChainMember&&(f.optional=n),this.finishCallExpression(f,a.optionalChainMember)}let c=this.state.type;if(c===48||c===52||c!==10&&Is(c)&&!this.hasPrecedingLineBreak())return;let p=this.startNodeAt(s);return p.expression=e,p.typeParameters=l,this.finishNode(p,"TSInstantiationExpression")});if(o&&this.unexpected(o,10),u)return u.type==="TSInstantiationExpression"&&(this.match(16)||this.match(18)&&this.lookaheadCharCode()!==40)&&this.raise(g.InvalidPropertyAccessAfterInstantiationExpression,{at:this.state.startLoc}),u}return super.parseSubscript(e,s,r,a)}parseNewCallee(e){var s;super.parseNewCallee(e);let{callee:r}=e;r.type==="TSInstantiationExpression"&&!((s=r.extra)!=null&&s.parenthesized)&&(e.typeParameters=r.typeParameters,e.callee=r.expression)}parseExprOp(e,s,r){let a;if(Rt(58)>r&&!this.hasPrecedingLineBreak()&&(this.isContextual(93)||(a=this.isContextual(120)))){let n=this.startNodeAt(s);return n.expression=e,n.typeAnnotation=this.tsInType(()=>(this.next(),this.match(75)?(a&&this.raise(h.UnexpectedKeyword,{at:this.state.startLoc,keyword:"const"}),this.tsParseTypeReference()):this.tsParseType())),this.finishNode(n,a?"TSSatisfiesExpression":"TSAsExpression"),this.reScan_lt_gt(),this.parseExprOp(n,s,r)}return super.parseExprOp(e,s,r)}checkReservedWord(e,s,r,a){this.state.isAmbientContext||super.checkReservedWord(e,s,r,a)}checkImportReflection(e){super.checkImportReflection(e),e.module&&e.importKind!=="value"&&this.raise(g.ImportReflectionHasImportType,{at:e.specifiers[0].loc.start})}checkDuplicateExports(){}isPotentialImportPhase(e){if(super.isPotentialImportPhase(e))return!0;if(this.isContextual(130)){let s=this.lookaheadCharCode();return e?s===123||s===42:s!==61}return!e&&this.isContextual(87)}applyImportPhase(e,s,r,a){super.applyImportPhase(e,s,r,a),s?e.exportKind=r==="type"?"type":"value":e.importKind=r==="type"||r==="typeof"?r:"value"}parseImport(e){if(this.match(133))return e.importKind="value",super.parseImport(e);let s;if(k(this.state.type)&&this.lookaheadCharCode()===61)return e.importKind="value",this.tsParseImportEqualsDeclaration(e);if(this.isContextual(130)){let r=this.parseMaybeImportPhase(e,!1);if(this.lookaheadCharCode()===61)return this.tsParseImportEqualsDeclaration(e,r);s=super.parseImportSpecifiersAndAfter(e,r)}else s=super.parseImport(e);return s.importKind==="type"&&s.specifiers.length>1&&s.specifiers[0].type==="ImportDefaultSpecifier"&&this.raise(g.TypeImportCannotSpecifyDefaultAndNamed,{at:s}),s}parseExport(e,s){if(this.match(83)){this.next();let r=null;return this.isContextual(130)&&this.isPotentialImportPhase(!1)?r=this.parseMaybeImportPhase(e,!1):e.importKind="value",this.tsParseImportEqualsDeclaration(e,r,!0)}else if(this.eat(29)){let r=e;return r.expression=super.parseExpression(),this.semicolon(),this.sawUnambiguousESM=!0,this.finishNode(r,"TSExportAssignment")}else if(this.eatContextual(93)){let r=e;return this.expectContextual(128),r.id=this.parseIdentifier(),this.semicolon(),this.finishNode(r,"TSNamespaceExportDeclaration")}else return super.parseExport(e,s)}isAbstractClass(){return this.isContextual(124)&&this.lookahead().type===80}parseExportDefaultExpression(){if(this.isAbstractClass()){let e=this.startNode();return this.next(),e.abstract=!0,this.parseClass(e,!0,!0)}if(this.match(129)){let e=this.tsParseInterfaceDeclaration(this.startNode());if(e)return e}return super.parseExportDefaultExpression()}parseVarStatement(e,s,r=!1){let{isAmbientContext:a}=this.state,n=super.parseVarStatement(e,s,r||a);if(!a)return n;for(let{id:o,init:u}of n.declarations)u&&(s!=="const"||o.typeAnnotation?this.raise(g.InitializerNotAllowedInAmbientContext,{at:u}):Bl(u,this.hasPlugin("estree"))||this.raise(g.ConstInitiailizerMustBeStringOrNumericLiteralOrLiteralEnumReference,{at:u}));return n}parseStatementContent(e,s){if(this.match(75)&&this.isLookaheadContextual("enum")){let r=this.startNode();return this.expect(75),this.tsParseEnumDeclaration(r,{const:!0})}if(this.isContextual(126))return this.tsParseEnumDeclaration(this.startNode());if(this.isContextual(129)){let r=this.tsParseInterfaceDeclaration(this.startNode());if(r)return r}return super.parseStatementContent(e,s)}parseAccessModifier(){return this.tsParseModifier(["public","protected","private"])}tsHasSomeModifiers(e,s){return s.some(r=>ya(r)?e.accessibility===r:!!e[r])}tsIsStartOfStaticBlocks(){return this.isContextual(106)&&this.lookaheadCharCode()===123}parseClassMember(e,s,r){let a=["declare","private","public","protected","override","abstract","readonly","static"];this.tsParseModifiers({allowedModifiers:a,disallowedModifiers:["in","out"],stopOnStartOfClassStaticBlock:!0,errorTemplate:g.InvalidModifierOnTypeParameterPositions},s);let n=()=>{this.tsIsStartOfStaticBlocks()?(this.next(),this.next(),this.tsHasSomeModifiers(s,a)&&this.raise(g.StaticBlockCannotHaveModifier,{at:this.state.curPosition()}),super.parseClassStaticBlock(e,s)):this.parseClassMemberWithIsStatic(e,s,r,!!s.static)};s.declare?this.tsInAmbientContext(n):n()}parseClassMemberWithIsStatic(e,s,r,a){let n=this.tsTryParseIndexSignature(s);if(n){e.body.push(n),s.abstract&&this.raise(g.IndexSignatureHasAbstract,{at:s}),s.accessibility&&this.raise(g.IndexSignatureHasAccessibility,{at:s,modifier:s.accessibility}),s.declare&&this.raise(g.IndexSignatureHasDeclare,{at:s}),s.override&&this.raise(g.IndexSignatureHasOverride,{at:s});return}!this.state.inAbstractClass&&s.abstract&&this.raise(g.NonAbstractClassHasAbstractMethod,{at:s}),s.override&&(r.hadSuperClass||this.raise(g.OverrideNotInSubClass,{at:s})),super.parseClassMemberWithIsStatic(e,s,r,a)}parsePostMemberNameModifiers(e){this.eat(17)&&(e.optional=!0),e.readonly&&this.match(10)&&this.raise(g.ClassMethodHasReadonly,{at:e}),e.declare&&this.match(10)&&this.raise(g.ClassMethodHasDeclare,{at:e})}parseExpressionStatement(e,s,r){return(s.type==="Identifier"?this.tsParseExpressionStatement(e,s,r):void 0)||super.parseExpressionStatement(e,s,r)}shouldParseExportDeclaration(){return this.tsIsDeclarationStart()?!0:super.shouldParseExportDeclaration()}parseConditional(e,s,r){if(!this.state.maybeInArrowParameters||!this.match(17))return super.parseConditional(e,s,r);let a=this.tryParse(()=>super.parseConditional(e,s));return a.node?(a.error&&(this.state=a.failState),a.node):(a.error&&super.setOptionalParametersError(r,a.error),e)}parseParenItem(e,s){if(e=super.parseParenItem(e,s),this.eat(17)&&(e.optional=!0,this.resetEndLocation(e)),this.match(14)){let r=this.startNodeAt(s);return r.expression=e,r.typeAnnotation=this.tsParseTypeAnnotation(),this.finishNode(r,"TSTypeCastExpression")}return e}parseExportDeclaration(e){if(!this.state.isAmbientContext&&this.isContextual(125))return this.tsInAmbientContext(()=>this.parseExportDeclaration(e));let s=this.state.startLoc,r=this.eatContextual(125);if(r&&(this.isContextual(125)||!this.shouldParseExportDeclaration()))throw this.raise(g.ExpectedAmbientAfterExportDeclare,{at:this.state.startLoc});let n=k(this.state.type)&&this.tsTryParseExportDeclaration()||super.parseExportDeclaration(e);return n?((n.type==="TSInterfaceDeclaration"||n.type==="TSTypeAliasDeclaration"||r)&&(e.exportKind="type"),r&&(this.resetStartLocation(n,s),n.declare=!0),n):null}parseClassId(e,s,r,a){if((!s||r)&&this.isContextual(113))return;super.parseClassId(e,s,r,e.declare?1024:8331);let n=this.tsTryParseTypeParameters(this.tsParseInOutConstModifiers);n&&(e.typeParameters=n)}parseClassPropertyAnnotation(e){e.optional||(this.eat(35)?e.definite=!0:this.eat(17)&&(e.optional=!0));let s=this.tsTryParseTypeAnnotation();s&&(e.typeAnnotation=s)}parseClassProperty(e){if(this.parseClassPropertyAnnotation(e),this.state.isAmbientContext&&!(e.readonly&&!e.typeAnnotation)&&this.match(29)&&this.raise(g.DeclareClassFieldHasInitializer,{at:this.state.startLoc}),e.abstract&&this.match(29)){let{key:s}=e;this.raise(g.AbstractPropertyHasInitializer,{at:this.state.startLoc,propertyName:s.type==="Identifier"&&!e.computed?s.name:`[${this.input.slice(s.start,s.end)}]`})}return super.parseClassProperty(e)}parseClassPrivateProperty(e){return e.abstract&&this.raise(g.PrivateElementHasAbstract,{at:e}),e.accessibility&&this.raise(g.PrivateElementHasAccessibility,{at:e,modifier:e.accessibility}),this.parseClassPropertyAnnotation(e),super.parseClassPrivateProperty(e)}parseClassAccessorProperty(e){return this.parseClassPropertyAnnotation(e),e.optional&&this.raise(g.AccessorCannotBeOptional,{at:e}),super.parseClassAccessorProperty(e)}pushClassMethod(e,s,r,a,n,o){let u=this.tsTryParseTypeParameters(this.tsParseConstModifier);u&&n&&this.raise(g.ConstructorHasTypeParameters,{at:u});let{declare:l=!1,kind:c}=s;l&&(c==="get"||c==="set")&&this.raise(g.DeclareAccessor,{at:s,kind:c}),u&&(s.typeParameters=u),super.pushClassMethod(e,s,r,a,n,o)}pushClassPrivateMethod(e,s,r,a){let n=this.tsTryParseTypeParameters(this.tsParseConstModifier);n&&(s.typeParameters=n),super.pushClassPrivateMethod(e,s,r,a)}declareClassPrivateMethodInScope(e,s){e.type!=="TSDeclareMethod"&&(e.type==="MethodDefinition"&&!e.value.body||super.declareClassPrivateMethodInScope(e,s))}parseClassSuper(e){super.parseClassSuper(e),e.superClass&&(this.match(47)||this.match(51))&&(e.superTypeParameters=this.tsParseTypeArgumentsInExpression()),this.eatContextual(113)&&(e.implements=this.tsParseHeritageClause("implements"))}parseObjPropValue(e,s,r,a,n,o,u){let l=this.tsTryParseTypeParameters(this.tsParseConstModifier);return l&&(e.typeParameters=l),super.parseObjPropValue(e,s,r,a,n,o,u)}parseFunctionParams(e,s){let r=this.tsTryParseTypeParameters(this.tsParseConstModifier);r&&(e.typeParameters=r),super.parseFunctionParams(e,s)}parseVarId(e,s){super.parseVarId(e,s),e.id.type==="Identifier"&&!this.hasPrecedingLineBreak()&&this.eat(35)&&(e.definite=!0);let r=this.tsTryParseTypeAnnotation();r&&(e.id.typeAnnotation=r,this.resetEndLocation(e.id))}parseAsyncArrowFromCallExpression(e,s){return this.match(14)&&(e.returnType=this.tsParseTypeAnnotation()),super.parseAsyncArrowFromCallExpression(e,s)}parseMaybeAssign(e,s){var r,a,n,o,u;let l,c,p;if(this.hasPlugin("jsx")&&(this.match(142)||this.match(47))){if(l=this.state.clone(),c=this.tryParse(()=>super.parseMaybeAssign(e,s),l),!c.error)return c.node;let{context:d}=this.state,y=d[d.length-1];(y===N.j_oTag||y===N.j_expr)&&d.pop()}if(!((r=c)!=null&&r.error)&&!this.match(47))return super.parseMaybeAssign(e,s);(!l||l===this.state)&&(l=this.state.clone());let f,m=this.tryParse(d=>{var y,v;f=this.tsParseTypeParameters(this.tsParseConstModifier);let S=super.parseMaybeAssign(e,s);return(S.type!=="ArrowFunctionExpression"||(y=S.extra)!=null&&y.parenthesized)&&d(),((v=f)==null?void 0:v.params.length)!==0&&this.resetStartLocationFromNode(S,f),S.typeParameters=f,S},l);if(!m.error&&!m.aborted)return f&&this.reportReservedArrowTypeParam(f),m.node;if(!c&&(ma(!this.hasPlugin("jsx")),p=this.tryParse(()=>super.parseMaybeAssign(e,s),l),!p.error))return p.node;if((a=c)!=null&&a.node)return this.state=c.failState,c.node;if(m.node)return this.state=m.failState,f&&this.reportReservedArrowTypeParam(f),m.node;if((n=p)!=null&&n.node)return this.state=p.failState,p.node;throw((o=c)==null?void 0:o.error)||m.error||((u=p)==null?void 0:u.error)}reportReservedArrowTypeParam(e){var s;e.params.length===1&&!e.params[0].constraint&&!((s=e.extra)!=null&&s.trailingComma)&&this.getPluginOption("typescript","disallowAmbiguousJSXLike")&&this.raise(g.ReservedArrowTypeParam,{at:e})}parseMaybeUnary(e,s){return!this.hasPlugin("jsx")&&this.match(47)?this.tsParseTypeAssertion():super.parseMaybeUnary(e,s)}parseArrow(e){if(this.match(14)){let s=this.tryParse(r=>{let a=this.tsParseTypeOrTypePredicateAnnotation(14);return(this.canInsertSemicolon()||!this.match(19))&&r(),a});if(s.aborted)return;s.thrown||(s.error&&(this.state=s.failState),e.returnType=s.node)}return super.parseArrow(e)}parseAssignableListItemTypes(e,s){if(!(s&2))return e;this.eat(17)&&(e.optional=!0);let r=this.tsTryParseTypeAnnotation();return r&&(e.typeAnnotation=r),this.resetEndLocation(e),e}isAssignable(e,s){switch(e.type){case"TSTypeCastExpression":return this.isAssignable(e.expression,s);case"TSParameterProperty":return!0;default:return super.isAssignable(e,s)}}toAssignable(e,s=!1){switch(e.type){case"ParenthesizedExpression":this.toAssignableParenthesizedExpression(e,s);break;case"TSAsExpression":case"TSSatisfiesExpression":case"TSNonNullExpression":case"TSTypeAssertion":s?this.expressionScope.recordArrowParameterBindingError(g.UnexpectedTypeCastInParameter,{at:e}):this.raise(g.UnexpectedTypeCastInParameter,{at:e}),this.toAssignable(e.expression,s);break;case"AssignmentExpression":!s&&e.left.type==="TSTypeCastExpression"&&(e.left=this.typeCastToParameter(e.left));default:super.toAssignable(e,s)}}toAssignableParenthesizedExpression(e,s){switch(e.expression.type){case"TSAsExpression":case"TSSatisfiesExpression":case"TSNonNullExpression":case"TSTypeAssertion":case"ParenthesizedExpression":this.toAssignable(e.expression,s);break;default:super.toAssignable(e,s)}}checkToRestConversion(e,s){switch(e.type){case"TSAsExpression":case"TSSatisfiesExpression":case"TSTypeAssertion":case"TSNonNullExpression":this.checkToRestConversion(e.expression,!1);break;default:super.checkToRestConversion(e,s)}}isValidLVal(e,s,r){return Nl({TSTypeCastExpression:!0,TSParameterProperty:"parameter",TSNonNullExpression:"expression",TSAsExpression:(r!==64||!s)&&["expression",!0],TSSatisfiesExpression:(r!==64||!s)&&["expression",!0],TSTypeAssertion:(r!==64||!s)&&["expression",!0]},e)||super.isValidLVal(e,s,r)}parseBindingAtom(){return this.state.type===78?this.parseIdentifier(!0):super.parseBindingAtom()}parseMaybeDecoratorArguments(e){if(this.match(47)||this.match(51)){let s=this.tsParseTypeArgumentsInExpression();if(this.match(10)){let r=super.parseMaybeDecoratorArguments(e);return r.typeParameters=s,r}this.unexpected(null,10)}return super.parseMaybeDecoratorArguments(e)}checkCommaAfterRest(e){return this.state.isAmbientContext&&this.match(12)&&this.lookaheadCharCode()===e?(this.next(),!1):super.checkCommaAfterRest(e)}isClassMethod(){return this.match(47)||super.isClassMethod()}isClassProperty(){return this.match(35)||this.match(14)||super.isClassProperty()}parseMaybeDefault(e,s){let r=super.parseMaybeDefault(e,s);return r.type==="AssignmentPattern"&&r.typeAnnotation&&r.right.start<r.typeAnnotation.start&&this.raise(g.TypeAnnotationAfterAssign,{at:r.typeAnnotation}),r}getTokenFromCode(e){if(this.state.inType){if(e===62){this.finishOp(48,1);return}if(e===60){this.finishOp(47,1);return}}super.getTokenFromCode(e)}reScan_lt_gt(){let{type:e}=this.state;e===47?(this.state.pos-=1,this.readToken_lt()):e===48&&(this.state.pos-=1,this.readToken_gt())}reScan_lt(){let{type:e}=this.state;return e===51?(this.state.pos-=2,this.finishOp(47,1),47):e}toAssignableList(e,s,r){for(let a=0;a<e.length;a++){let n=e[a];(n==null?void 0:n.type)==="TSTypeCastExpression"&&(e[a]=this.typeCastToParameter(n))}super.toAssignableList(e,s,r)}typeCastToParameter(e){return e.expression.typeAnnotation=e.typeAnnotation,this.resetEndLocation(e.expression,e.typeAnnotation.loc.end),e.expression}shouldParseArrow(e){return this.match(14)?e.every(s=>this.isAssignable(s,!0)):super.shouldParseArrow(e)}shouldParseAsyncArrow(){return this.match(14)||super.shouldParseAsyncArrow()}canHaveLeadingDecorator(){return super.canHaveLeadingDecorator()||this.isAbstractClass()}jsxParseOpeningElementAfterName(e){if(this.match(47)||this.match(51)){let s=this.tsTryParseAndCatch(()=>this.tsParseTypeArgumentsInExpression());s&&(e.typeParameters=s)}return super.jsxParseOpeningElementAfterName(e)}getGetterSetterExpectedParamCount(e){let s=super.getGetterSetterExpectedParamCount(e),a=this.getObjectOrClassMethodParams(e)[0];return a&&this.isThisParam(a)?s+1:s}parseCatchClauseParam(){let e=super.parseCatchClauseParam(),s=this.tsTryParseTypeAnnotation();return s&&(e.typeAnnotation=s,this.resetEndLocation(e)),e}tsInAmbientContext(e){let s=this.state.isAmbientContext;this.state.isAmbientContext=!0;try{return e()}finally{this.state.isAmbientContext=s}}parseClass(e,s,r){let a=this.state.inAbstractClass;this.state.inAbstractClass=!!e.abstract;try{return super.parseClass(e,s,r)}finally{this.state.inAbstractClass=a}}tsParseAbstractDeclaration(e,s){if(this.match(80))return e.abstract=!0,this.maybeTakeDecorators(s,this.parseClass(e,!0,!1));if(this.isContextual(129)){if(!this.hasFollowingLineBreak())return e.abstract=!0,this.raise(g.NonClassMethodPropertyHasAbstractModifer,{at:e}),this.tsParseInterfaceDeclaration(e)}else this.unexpected(null,80)}parseMethod(e,s,r,a,n,o,u){let l=super.parseMethod(e,s,r,a,n,o,u);if(l.abstract&&(this.hasPlugin("estree")?!!l.value.body:!!l.body)){let{key:p}=l;this.raise(g.AbstractMethodHasImplementation,{at:l,methodName:p.type==="Identifier"&&!l.computed?p.name:`[${this.input.slice(p.start,p.end)}]`})}return l}tsParseTypeParameterName(){return this.parseIdentifier().name}shouldParseAsAmbientContext(){return!!this.getPluginOption("typescript","dts")}parse(){return this.shouldParseAsAmbientContext()&&(this.state.isAmbientContext=!0),super.parse()}getExpression(){return this.shouldParseAsAmbientContext()&&(this.state.isAmbientContext=!0),super.getExpression()}parseExportSpecifier(e,s,r,a){return!s&&a?(this.parseTypeOnlyImportExportSpecifier(e,!1,r),this.finishNode(e,"ExportSpecifier")):(e.exportKind="value",super.parseExportSpecifier(e,s,r,a))}parseImportSpecifier(e,s,r,a,n){return!s&&a?(this.parseTypeOnlyImportExportSpecifier(e,!0,r),this.finishNode(e,"ImportSpecifier")):(e.importKind="value",super.parseImportSpecifier(e,s,r,a,r?4098:4096))}parseTypeOnlyImportExportSpecifier(e,s,r){let a=s?"imported":"local",n=s?"local":"exported",o=e[a],u,l=!1,c=!0,p=o.loc.start;if(this.isContextual(93)){let m=this.parseIdentifier();if(this.isContextual(93)){let d=this.parseIdentifier();X(this.state.type)?(l=!0,o=m,u=s?this.parseIdentifier():this.parseModuleExportName(),c=!1):(u=d,c=!1)}else X(this.state.type)?(c=!1,u=s?this.parseIdentifier():this.parseModuleExportName()):(l=!0,o=m)}else X(this.state.type)&&(l=!0,s?(o=this.parseIdentifier(!0),this.isContextual(93)||this.checkReservedWord(o.name,o.loc.start,!0,!0)):o=this.parseModuleExportName());l&&r&&this.raise(s?g.TypeModifierIsUsedInTypeImports:g.TypeModifierIsUsedInTypeExports,{at:p}),e[a]=o,e[n]=u;let f=s?"importKind":"exportKind";e[f]=l?"type":"value",c&&this.eatContextual(93)&&(e[n]=s?this.parseIdentifier():this.parseModuleExportName()),e[n]||(e[n]=ne(e[a])),s&&this.checkIdentifier(e[n],l?4098:4096)}};function Dl(i){if(i.type!=="MemberExpression")return!1;let{computed:t,property:e}=i;return t&&e.type!=="StringLiteral"&&(e.type!=="TemplateLiteral"||e.expressions.length>0)?!1:Ba(i.object)}function Bl(i,t){var e;let{type:s}=i;if((e=i.extra)!=null&&e.parenthesized)return!1;if(t){if(s==="Literal"){let{value:r}=i;if(typeof r=="string"||typeof r=="boolean")return!0}}else if(s==="StringLiteral"||s==="BooleanLiteral")return!0;return!!(Da(i,t)||Fl(i,t)||s==="TemplateLiteral"&&i.expressions.length===0||Dl(i))}function Da(i,t){return t?i.type==="Literal"&&(typeof i.value=="number"||"bigint"in i):i.type==="NumericLiteral"||i.type==="BigIntLiteral"}function Fl(i,t){if(i.type==="UnaryExpression"){let{operator:e,argument:s}=i;if(e==="-"&&Da(s,t))return!0}return!1}function Ba(i){return i.type==="Identifier"?!0:i.type!=="MemberExpression"||i.computed?!1:Ba(i.object)}var xa=ae`placeholders`({ClassNameIsRequired:"A class name is required.",UnexpectedSpace:"Unexpected space in placeholder."}),Rl=i=>class extends i{parsePlaceholder(e){if(this.match(144)){let s=this.startNode();return this.next(),this.assertNoSpace(),s.name=super.parseIdentifier(!0),this.assertNoSpace(),this.expect(144),this.finishPlaceholder(s,e)}}finishPlaceholder(e,s){let r=!!(e.expectedNode&&e.type==="Placeholder");return e.expectedNode=s,r?e:this.finishNode(e,"Placeholder")}getTokenFromCode(e){e===37&&this.input.charCodeAt(this.state.pos+1)===37?this.finishOp(144,2):super.getTokenFromCode(e)}parseExprAtom(e){return this.parsePlaceholder("Expression")||super.parseExprAtom(e)}parseIdentifier(e){return this.parsePlaceholder("Identifier")||super.parseIdentifier(e)}checkReservedWord(e,s,r,a){e!==void 0&&super.checkReservedWord(e,s,r,a)}parseBindingAtom(){return this.parsePlaceholder("Pattern")||super.parseBindingAtom()}isValidLVal(e,s,r){return e==="Placeholder"||super.isValidLVal(e,s,r)}toAssignable(e,s){e&&e.type==="Placeholder"&&e.expectedNode==="Expression"?e.expectedNode="Pattern":super.toAssignable(e,s)}chStartsBindingIdentifier(e,s){return!!(super.chStartsBindingIdentifier(e,s)||this.lookahead().type===144)}verifyBreakContinue(e,s){e.label&&e.label.type==="Placeholder"||super.verifyBreakContinue(e,s)}parseExpressionStatement(e,s){var r;if(s.type!=="Placeholder"||(r=s.extra)!=null&&r.parenthesized)return super.parseExpressionStatement(e,s);if(this.match(14)){let a=e;return a.label=this.finishPlaceholder(s,"Identifier"),this.next(),a.body=super.parseStatementOrSloppyAnnexBFunctionDeclaration(),this.finishNode(a,"LabeledStatement")}return this.semicolon(),e.name=s.name,this.finishPlaceholder(e,"Statement")}parseBlock(e,s,r){return this.parsePlaceholder("BlockStatement")||super.parseBlock(e,s,r)}parseFunctionId(e){return this.parsePlaceholder("Identifier")||super.parseFunctionId(e)}parseClass(e,s,r){let a=s?"ClassDeclaration":"ClassExpression";this.next();let n=this.state.strict,o=this.parsePlaceholder("Identifier");if(o)if(this.match(81)||this.match(144)||this.match(5))e.id=o;else{if(r||!s)return e.id=null,e.body=this.finishPlaceholder(o,"ClassBody"),this.finishNode(e,a);throw this.raise(xa.ClassNameIsRequired,{at:this.state.startLoc})}else this.parseClassId(e,s,r);return super.parseClassSuper(e),e.body=this.parsePlaceholder("ClassBody")||super.parseClassBody(!!e.superClass,n),this.finishNode(e,a)}parseExport(e,s){let r=this.parsePlaceholder("Identifier");if(!r)return super.parseExport(e,s);if(!this.isContextual(98)&&!this.match(12))return e.specifiers=[],e.source=null,e.declaration=this.finishPlaceholder(r,"Declaration"),this.finishNode(e,"ExportNamedDeclaration");this.expectPlugin("exportDefaultFrom");let a=this.startNode();return a.exported=r,e.specifiers=[this.finishNode(a,"ExportDefaultSpecifier")],super.parseExport(e,s)}isExportDefaultSpecifier(){if(this.match(65)){let e=this.nextTokenStart();if(this.isUnparsedContextual(e,"from")&&this.input.startsWith(fe(144),this.nextTokenStartSince(e+4)))return!0}return super.isExportDefaultSpecifier()}maybeParseExportDefaultSpecifier(e,s){var r;return(r=e.specifiers)!=null&&r.length?!0:super.maybeParseExportDefaultSpecifier(e,s)}checkExport(e){let{specifiers:s}=e;s!=null&&s.length&&(e.specifiers=s.filter(r=>r.exported.type==="Placeholder")),super.checkExport(e),e.specifiers=s}parseImport(e){let s=this.parsePlaceholder("Identifier");if(!s)return super.parseImport(e);if(e.specifiers=[],!this.isContextual(98)&&!this.match(12))return e.source=this.finishPlaceholder(s,"StringLiteral"),this.semicolon(),this.finishNode(e,"ImportDeclaration");let r=this.startNodeAtNode(s);return r.local=s,e.specifiers.push(this.finishNode(r,"ImportDefaultSpecifier")),this.eat(12)&&(this.maybeParseStarImportSpecifier(e)||this.parseNamedImportSpecifiers(e)),this.expectContextual(98),e.source=this.parseImportSource(),this.semicolon(),this.finishNode(e,"ImportDeclaration")}parseImportSource(){return this.parsePlaceholder("StringLiteral")||super.parseImportSource()}assertNoSpace(){this.state.start>this.state.lastTokEndLoc.index&&this.raise(xa.UnexpectedSpace,{at:this.state.lastTokEndLoc})}},jl=i=>class extends i{parseV8Intrinsic(){if(this.match(54)){let e=this.state.startLoc,s=this.startNode();if(this.next(),k(this.state.type)){let r=this.parseIdentifierName(),a=this.createIdentifier(s,r);if(a.type="V8IntrinsicIdentifier",this.match(10))return a}this.unexpected(e)}}parseExprAtom(e){return this.parseV8Intrinsic()||super.parseExprAtom(e)}};function D(i,t){let[e,s]=typeof t=="string"?[t,{}]:t,r=Object.keys(s),a=r.length===0;return i.some(n=>{if(typeof n=="string")return a&&n===e;{let[o,u]=n;if(o!==e)return!1;for(let l of r)if(u[l]!==s[l])return!1;return!0}})}function pe(i,t,e){let s=i.find(r=>Array.isArray(r)?r[0]===t:r===t);return s&&Array.isArray(s)&&s.length>1?s[1][e]:null}var ga=["minimal","fsharp","hack","smart"],ba=["^^","@@","^","%","#"],Pa=["hash","bar"];function Ul(i){if(D(i,"decorators")){if(D(i,"decorators-legacy"))throw new Error("Cannot use the decorators and decorators-legacy plugin together");let t=pe(i,"decorators","decoratorsBeforeExport");if(t!=null&&typeof t!="boolean")throw new Error("'decoratorsBeforeExport' must be a boolean, if specified.");let e=pe(i,"decorators","allowCallParenthesized");if(e!=null&&typeof e!="boolean")throw new Error("'allowCallParenthesized' must be a boolean.")}if(D(i,"flow")&&D(i,"typescript"))throw new Error("Cannot combine flow and typescript plugins.");if(D(i,"placeholders")&&D(i,"v8intrinsic"))throw new Error("Cannot combine placeholders and v8intrinsic plugins.");if(D(i,"pipelineOperator")){let t=pe(i,"pipelineOperator","proposal");if(!ga.includes(t)){let s=ga.map(r=>`"${r}"`).join(", ");throw new Error(`"pipelineOperator" requires "proposal" option whose value must be one of: ${s}.`)}let e=D(i,["recordAndTuple",{syntaxType:"hash"}]);if(t==="hack"){if(D(i,"placeholders"))throw new Error("Cannot combine placeholders plugin and Hack-style pipes.");if(D(i,"v8intrinsic"))throw new Error("Cannot combine v8intrinsic plugin and Hack-style pipes.");let s=pe(i,"pipelineOperator","topicToken");if(!ba.includes(s)){let r=ba.map(a=>`"${a}"`).join(", ");throw new Error(`"pipelineOperator" in "proposal": "hack" mode also requires a "topicToken" option whose value must be one of: ${r}.`)}if(s==="#"&&e)throw new Error('Plugin conflict between `["pipelineOperator", { proposal: "hack", topicToken: "#" }]` and `["recordAndtuple", { syntaxType: "hash"}]`.')}else if(t==="smart"&&e)throw new Error('Plugin conflict between `["pipelineOperator", { proposal: "smart" }]` and `["recordAndtuple", { syntaxType: "hash"}]`.')}if(D(i,"moduleAttributes")){if(D(i,"importAssertions")||D(i,"importAttributes"))throw new Error("Cannot combine importAssertions, importAttributes and moduleAttributes plugins.");if(pe(i,"moduleAttributes","version")!=="may-2020")throw new Error("The 'moduleAttributes' plugin requires a 'version' option, representing the last proposal update. Currently, the only supported value is 'may-2020'.")}if(D(i,"importAssertions")&&D(i,"importAttributes"))throw new Error("Cannot combine importAssertions and importAttributes plugins.");if(D(i,"recordAndTuple")&&pe(i,"recordAndTuple","syntaxType")!=null&&!Pa.includes(pe(i,"recordAndTuple","syntaxType")))throw new Error("The 'syntaxType' option of the 'recordAndTuple' plugin must be one of: "+Pa.map(t=>`'${t}'`).join(", "));if(D(i,"asyncDoExpressions")&&!D(i,"doExpressions")){let t=new Error("'asyncDoExpressions' requires 'doExpressions', please add 'doExpressions' to parser plugins.");throw t.missingPlugins="doExpressions",t}if(D(i,"optionalChainingAssign")&&pe(i,"optionalChainingAssign","version")!=="2023-07")throw new Error("The 'optionalChainingAssign' plugin requires a 'version' option, representing the last proposal update. Currently, the only supported value is '2023-07'.")}var Fa={estree:ju,jsx:Il,flow:El,typescript:Ll,v8intrinsic:jl,placeholders:Rl},$l=Object.keys(Fa),As={sourceType:"script",sourceFilename:void 0,startColumn:0,startLine:1,allowAwaitOutsideFunction:!1,allowReturnOutsideFunction:!1,allowNewTargetOutsideFunction:!1,allowImportExportEverywhere:!1,allowSuperOutsideMethod:!1,allowUndeclaredExports:!1,plugins:[],strictMode:null,ranges:!1,tokens:!1,createImportExpressions:!1,createParenthesizedExpressions:!1,errorRecovery:!1,attachComment:!0,annexB:!0};function ql(i){if(i==null)return Object.assign({},As);if(i.annexB!=null&&i.annexB!==!1)throw new Error("The `annexB` option can only be set to `false`.");let t={};for(let s of Object.keys(As)){var e;t[s]=(e=i[s])!=null?e:As[s]}return t}var Hs=class extends zs{checkProto(t,e,s,r){if(t.type==="SpreadElement"||this.isObjectMethod(t)||t.computed||t.shorthand)return;let a=t.key;if((a.type==="Identifier"?a.name:a.value)==="__proto__"){if(e){this.raise(h.RecordNoProto,{at:a});return}s.used&&(r?r.doubleProtoLoc===null&&(r.doubleProtoLoc=a.loc.start):this.raise(h.DuplicateProto,{at:a})),s.used=!0}}shouldExitDescending(t,e){return t.type==="ArrowFunctionExpression"&&t.start===e}getExpression(){this.enterInitialScopes(),this.nextToken();let t=this.parseExpression();return this.match(139)||this.unexpected(),this.finalizeRemainingComments(),t.comments=this.state.comments,t.errors=this.state.errors,this.options.tokens&&(t.tokens=this.tokens),t}parseExpression(t,e){return t?this.disallowInAnd(()=>this.parseExpressionBase(e)):this.allowInAnd(()=>this.parseExpressionBase(e))}parseExpressionBase(t){let e=this.state.startLoc,s=this.parseMaybeAssign(t);if(this.match(12)){let r=this.startNodeAt(e);for(r.expressions=[s];this.eat(12);)r.expressions.push(this.parseMaybeAssign(t));return this.toReferencedList(r.expressions),this.finishNode(r,"SequenceExpression")}return s}parseMaybeAssignDisallowIn(t,e){return this.disallowInAnd(()=>this.parseMaybeAssign(t,e))}parseMaybeAssignAllowIn(t,e){return this.allowInAnd(()=>this.parseMaybeAssign(t,e))}setOptionalParametersError(t,e){var s;t.optionalParametersLoc=(s=e==null?void 0:e.loc)!=null?s:this.state.startLoc}parseMaybeAssign(t,e){let s=this.state.startLoc;if(this.isContextual(108)&&this.prodParam.hasYield){let o=this.parseYield();return e&&(o=e.call(this,o,s)),o}let r;t?r=!1:(t=new Be,r=!0);let{type:a}=this.state;(a===10||k(a))&&(this.state.potentialArrowAt=this.state.start);let n=this.parseMaybeConditional(t);if(e&&(n=e.call(this,n,s)),Vu(this.state.type)){let o=this.startNodeAt(s),u=this.state.value;if(o.operator=u,this.match(29)){this.toAssignable(n,!0),o.left=n;let l=s.index;t.doubleProtoLoc!=null&&t.doubleProtoLoc.index>=l&&(t.doubleProtoLoc=null),t.shorthandAssignLoc!=null&&t.shorthandAssignLoc.index>=l&&(t.shorthandAssignLoc=null),t.privateKeyLoc!=null&&t.privateKeyLoc.index>=l&&(this.checkDestructuringPrivate(t),t.privateKeyLoc=null)}else o.left=n;return this.next(),o.right=this.parseMaybeAssign(),this.checkLVal(n,{in:this.finishNode(o,"AssignmentExpression")}),o}else r&&this.checkExpressionErrors(t,!0);return n}parseMaybeConditional(t){let e=this.state.startLoc,s=this.state.potentialArrowAt,r=this.parseExprOps(t);return this.shouldExitDescending(r,s)?r:this.parseConditional(r,e,t)}parseConditional(t,e,s){if(this.eat(17)){let r=this.startNodeAt(e);return r.test=t,r.consequent=this.parseMaybeAssignAllowIn(),this.expect(14),r.alternate=this.parseMaybeAssign(),this.finishNode(r,"ConditionalExpression")}return t}parseMaybeUnaryOrPrivate(t){return this.match(138)?this.parsePrivateName():this.parseMaybeUnary(t)}parseExprOps(t){let e=this.state.startLoc,s=this.state.potentialArrowAt,r=this.parseMaybeUnaryOrPrivate(t);return this.shouldExitDescending(r,s)?r:this.parseExprOp(r,e,-1)}parseExprOp(t,e,s){if(this.isPrivateName(t)){let a=this.getPrivateNameSV(t);(s>=Rt(58)||!this.prodParam.hasIn||!this.match(58))&&this.raise(h.PrivateInExpectedIn,{at:t,identifierName:a}),this.classScope.usePrivateName(a,t.loc.start)}let r=this.state.type;if(Hu(r)&&(this.prodParam.hasIn||!this.match(58))){let a=Rt(r);if(a>s){if(r===39){if(this.expectPlugin("pipelineOperator"),this.state.inFSharpPipelineDirectBody)return t;this.checkPipelineAtInfixOperator(t,e)}let n=this.startNodeAt(e);n.left=t,n.operator=this.state.value;let o=r===41||r===42,u=r===40;if(u&&(a=Rt(42)),this.next(),r===39&&this.hasPlugin(["pipelineOperator",{proposal:"minimal"}])&&this.state.type===96&&this.prodParam.hasAwait)throw this.raise(h.UnexpectedAwaitAfterPipelineBody,{at:this.state.startLoc});n.right=this.parseExprOpRightExpr(r,a);let l=this.finishNode(n,o||u?"LogicalExpression":"BinaryExpression"),c=this.state.type;if(u&&(c===41||c===42)||o&&c===40)throw this.raise(h.MixingCoalesceWithLogical,{at:this.state.startLoc});return this.parseExprOp(l,e,s)}}return t}parseExprOpRightExpr(t,e){let s=this.state.startLoc;switch(t){case 39:switch(this.getPluginOption("pipelineOperator","proposal")){case"hack":return this.withTopicBindingContext(()=>this.parseHackPipeBody());case"smart":return this.withTopicBindingContext(()=>{if(this.prodParam.hasYield&&this.isContextual(108))throw this.raise(h.PipeBodyIsTighter,{at:this.state.startLoc});return this.parseSmartPipelineBodyInStyle(this.parseExprOpBaseRightExpr(t,e),s)});case"fsharp":return this.withSoloAwaitPermittingContext(()=>this.parseFSharpPipelineBody(e))}default:return this.parseExprOpBaseRightExpr(t,e)}}parseExprOpBaseRightExpr(t,e){let s=this.state.startLoc;return this.parseExprOp(this.parseMaybeUnaryOrPrivate(),s,Yu(t)?e-1:e)}parseHackPipeBody(){var t;let{startLoc:e}=this.state,s=this.parseMaybeAssign();return Mu.has(s.type)&&!((t=s.extra)!=null&&t.parenthesized)&&this.raise(h.PipeUnparenthesizedBody,{at:e,type:s.type}),this.topicReferenceWasUsedInCurrentContext()||this.raise(h.PipeTopicUnused,{at:e}),s}checkExponentialAfterUnary(t){this.match(57)&&this.raise(h.UnexpectedTokenUnaryExponentiation,{at:t.argument})}parseMaybeUnary(t,e){let s=this.state.startLoc,r=this.isContextual(96);if(r&&this.isAwaitAllowed()){this.next();let u=this.parseAwait(s);return e||this.checkExponentialAfterUnary(u),u}let a=this.match(34),n=this.startNode();if(Gu(this.state.type)){n.operator=this.state.value,n.prefix=!0,this.match(72)&&this.expectPlugin("throwExpressions");let u=this.match(89);if(this.next(),n.argument=this.parseMaybeUnary(null,!0),this.checkExpressionErrors(t,!0),this.state.strict&&u){let l=n.argument;l.type==="Identifier"?this.raise(h.StrictDelete,{at:n}):this.hasPropertyAsPrivateName(l)&&this.raise(h.DeletePrivateField,{at:n})}if(!a)return e||this.checkExponentialAfterUnary(n),this.finishNode(n,"UnaryExpression")}let o=this.parseUpdate(n,a,t);if(r){let{type:u}=this.state;if((this.hasPlugin("v8intrinsic")?Is(u):Is(u)&&!this.match(54))&&!this.isAmbiguousAwait())return this.raiseOverwrite(h.AwaitNotInAsyncContext,{at:s}),this.parseAwait(s)}return o}parseUpdate(t,e,s){if(e){let n=t;return this.checkLVal(n.argument,{in:this.finishNode(n,"UpdateExpression")}),t}let r=this.state.startLoc,a=this.parseExprSubscripts(s);if(this.checkExpressionErrors(s,!1))return a;for(;Ku(this.state.type)&&!this.canInsertSemicolon();){let n=this.startNodeAt(r);n.operator=this.state.value,n.prefix=!1,n.argument=a,this.next(),this.checkLVal(a,{in:a=this.finishNode(n,"UpdateExpression")})}return a}parseExprSubscripts(t){let e=this.state.startLoc,s=this.state.potentialArrowAt,r=this.parseExprAtom(t);return this.shouldExitDescending(r,s)?r:this.parseSubscripts(r,e)}parseSubscripts(t,e,s){let r={optionalChainMember:!1,maybeAsyncArrow:this.atPossibleAsyncArrow(t),stop:!1};do t=this.parseSubscript(t,e,s,r),r.maybeAsyncArrow=!1;while(!r.stop);return t}parseSubscript(t,e,s,r){let{type:a}=this.state;if(!s&&a===15)return this.parseBind(t,e,s,r);if(Wt(a))return this.parseTaggedTemplateExpression(t,e,r);let n=!1;if(a===18){if(s&&(this.raise(h.OptionalChainingNoNew,{at:this.state.startLoc}),this.lookaheadCharCode()===40))return r.stop=!0,t;r.optionalChainMember=n=!0,this.next()}if(!s&&this.match(10))return this.parseCoverCallAndAsyncArrowHead(t,e,r,n);{let o=this.eat(0);return o||n||this.eat(16)?this.parseMember(t,e,r,o,n):(r.stop=!0,t)}}parseMember(t,e,s,r,a){let n=this.startNodeAt(e);return n.object=t,n.computed=r,r?(n.property=this.parseExpression(),this.expect(3)):this.match(138)?(t.type==="Super"&&this.raise(h.SuperPrivateField,{at:e}),this.classScope.usePrivateName(this.state.value,this.state.startLoc),n.property=this.parsePrivateName()):n.property=this.parseIdentifier(!0),s.optionalChainMember?(n.optional=a,this.finishNode(n,"OptionalMemberExpression")):this.finishNode(n,"MemberExpression")}parseBind(t,e,s,r){let a=this.startNodeAt(e);return a.object=t,this.next(),a.callee=this.parseNoCallExpr(),r.stop=!0,this.parseSubscripts(this.finishNode(a,"BindExpression"),e,s)}parseCoverCallAndAsyncArrowHead(t,e,s,r){let a=this.state.maybeInArrowParameters,n=null;this.state.maybeInArrowParameters=!0,this.next();let o=this.startNodeAt(e);o.callee=t;let{maybeAsyncArrow:u,optionalChainMember:l}=s;u&&(this.expressionScope.enter(gl()),n=new Be),l&&(o.optional=r),r?o.arguments=this.parseCallExpressionArguments(11):o.arguments=this.parseCallExpressionArguments(11,t.type==="Import",t.type!=="Super",o,n);let c=this.finishCallExpression(o,l);return u&&this.shouldParseAsyncArrow()&&!r?(s.stop=!0,this.checkDestructuringPrivate(n),this.expressionScope.validateAsPattern(),this.expressionScope.exit(),c=this.parseAsyncArrowFromCallExpression(this.startNodeAt(e),c)):(u&&(this.checkExpressionErrors(n,!0),this.expressionScope.exit()),this.toReferencedArguments(c)),this.state.maybeInArrowParameters=a,c}toReferencedArguments(t,e){this.toReferencedListDeep(t.arguments,e)}parseTaggedTemplateExpression(t,e,s){let r=this.startNodeAt(e);return r.tag=t,r.quasi=this.parseTemplate(!0),s.optionalChainMember&&this.raise(h.OptionalChainingNoTemplate,{at:e}),this.finishNode(r,"TaggedTemplateExpression")}atPossibleAsyncArrow(t){return t.type==="Identifier"&&t.name==="async"&&this.state.lastTokEndLoc.index===t.end&&!this.canInsertSemicolon()&&t.end-t.start===5&&t.start===this.state.potentialArrowAt}expectImportAttributesPlugin(){this.hasPlugin("importAssertions")||this.expectPlugin("importAttributes")}finishCallExpression(t,e){if(t.callee.type==="Import")if(t.arguments.length===2&&(this.hasPlugin("moduleAttributes")||this.expectImportAttributesPlugin()),t.arguments.length===0||t.arguments.length>2)this.raise(h.ImportCallArity,{at:t,maxArgumentCount:this.hasPlugin("importAttributes")||this.hasPlugin("importAssertions")||this.hasPlugin("moduleAttributes")?2:1});else for(let s of t.arguments)s.type==="SpreadElement"&&this.raise(h.ImportCallSpreadArgument,{at:s});return this.finishNode(t,e?"OptionalCallExpression":"CallExpression")}parseCallExpressionArguments(t,e,s,r,a){let n=[],o=!0,u=this.state.inFSharpPipelineDirectBody;for(this.state.inFSharpPipelineDirectBody=!1;!this.eat(t);){if(o)o=!1;else if(this.expect(12),this.match(t)){e&&!this.hasPlugin("importAttributes")&&!this.hasPlugin("importAssertions")&&!this.hasPlugin("moduleAttributes")&&this.raise(h.ImportCallArgumentTrailingComma,{at:this.state.lastTokStartLoc}),r&&this.addTrailingCommaExtraToNode(r),this.next();break}n.push(this.parseExprListItem(!1,a,s))}return this.state.inFSharpPipelineDirectBody=u,n}shouldParseAsyncArrow(){return this.match(19)&&!this.canInsertSemicolon()}parseAsyncArrowFromCallExpression(t,e){var s;return this.resetPreviousNodeTrailingComments(e),this.expect(19),this.parseArrowExpression(t,e.arguments,!0,(s=e.extra)==null?void 0:s.trailingCommaLoc),e.innerComments&&nt(t,e.innerComments),e.callee.trailingComments&&nt(t,e.callee.trailingComments),t}parseNoCallExpr(){let t=this.state.startLoc;return this.parseSubscripts(this.parseExprAtom(),t,!0)}parseExprAtom(t){let e,s=null,{type:r}=this.state;switch(r){case 79:return this.parseSuper();case 83:return e=this.startNode(),this.next(),this.match(16)?this.parseImportMetaProperty(e):this.match(10)?this.options.createImportExpressions?this.parseImportCall(e):this.finishNode(e,"Import"):(this.raise(h.UnsupportedImport,{at:this.state.lastTokStartLoc}),this.finishNode(e,"Import"));case 78:return e=this.startNode(),this.next(),this.finishNode(e,"ThisExpression");case 90:return this.parseDo(this.startNode(),!1);case 56:case 31:return this.readRegexp(),this.parseRegExpLiteral(this.state.value);case 134:return this.parseNumericLiteral(this.state.value);case 135:return this.parseBigIntLiteral(this.state.value);case 136:return this.parseDecimalLiteral(this.state.value);case 133:return this.parseStringLiteral(this.state.value);case 84:return this.parseNullLiteral();case 85:return this.parseBooleanLiteral(!0);case 86:return this.parseBooleanLiteral(!1);case 10:{let a=this.state.potentialArrowAt===this.state.start;return this.parseParenAndDistinguishExpression(a)}case 2:case 1:return this.parseArrayLike(this.state.type===2?4:3,!1,!0);case 0:return this.parseArrayLike(3,!0,!1,t);case 6:case 7:return this.parseObjectLike(this.state.type===6?9:8,!1,!0);case 5:return this.parseObjectLike(8,!1,!1,t);case 68:return this.parseFunctionOrFunctionSent();case 26:s=this.parseDecorators();case 80:return this.parseClass(this.maybeTakeDecorators(s,this.startNode()),!1);case 77:return this.parseNewOrNewTarget();case 25:case 24:return this.parseTemplate(!1);case 15:{e=this.startNode(),this.next(),e.object=null;let a=e.callee=this.parseNoCallExpr();if(a.type==="MemberExpression")return this.finishNode(e,"BindExpression");throw this.raise(h.UnsupportedBind,{at:a})}case 138:return this.raise(h.PrivateInExpectedIn,{at:this.state.startLoc,identifierName:this.state.value}),this.parsePrivateName();case 33:return this.parseTopicReferenceThenEqualsSign(54,"%");case 32:return this.parseTopicReferenceThenEqualsSign(44,"^");case 37:case 38:return this.parseTopicReference("hack");case 44:case 54:case 27:{let a=this.getPluginOption("pipelineOperator","proposal");if(a)return this.parseTopicReference(a);this.unexpected();break}case 47:{let a=this.input.codePointAt(this.nextTokenStart());ie(a)||a===62?this.expectOnePlugin(["jsx","flow","typescript"]):this.unexpected();break}default:if(k(r)){if(this.isContextual(127)&&this.lookaheadInLineCharCode()===123)return this.parseModuleExpression();let a=this.state.potentialArrowAt===this.state.start,n=this.state.containsEsc,o=this.parseIdentifier();if(!n&&o.name==="async"&&!this.canInsertSemicolon()){let{type:u}=this.state;if(u===68)return this.resetPreviousNodeTrailingComments(o),this.next(),this.parseAsyncFunctionExpression(this.startNodeAtNode(o));if(k(u))return this.lookaheadCharCode()===61?this.parseAsyncArrowUnaryFunction(this.startNodeAtNode(o)):o;if(u===90)return this.resetPreviousNodeTrailingComments(o),this.parseDo(this.startNodeAtNode(o),!0)}return a&&this.match(19)&&!this.canInsertSemicolon()?(this.next(),this.parseArrowExpression(this.startNodeAtNode(o),[o],!1)):o}else this.unexpected()}}parseTopicReferenceThenEqualsSign(t,e){let s=this.getPluginOption("pipelineOperator","proposal");if(s)return this.state.type=t,this.state.value=e,this.state.pos--,this.state.end--,this.state.endLoc=V(this.state.endLoc,-1),this.parseTopicReference(s);this.unexpected()}parseTopicReference(t){let e=this.startNode(),s=this.state.startLoc,r=this.state.type;return this.next(),this.finishTopicReference(e,s,t,r)}finishTopicReference(t,e,s,r){if(this.testTopicReferenceConfiguration(s,e,r)){let a=s==="smart"?"PipelinePrimaryTopicReference":"TopicReference";return this.topicReferenceIsAllowedInCurrentContext()||this.raise(s==="smart"?h.PrimaryTopicNotAllowed:h.PipeTopicUnbound,{at:e}),this.registerTopicReference(),this.finishNode(t,a)}else throw this.raise(h.PipeTopicUnconfiguredToken,{at:e,token:fe(r)})}testTopicReferenceConfiguration(t,e,s){switch(t){case"hack":return this.hasPlugin(["pipelineOperator",{topicToken:fe(s)}]);case"smart":return s===27;default:throw this.raise(h.PipeTopicRequiresHackPipes,{at:e})}}parseAsyncArrowUnaryFunction(t){this.prodParam.enter(Ut(!0,this.prodParam.hasYield));let e=[this.parseIdentifier()];return this.prodParam.exit(),this.hasPrecedingLineBreak()&&this.raise(h.LineTerminatorBeforeArrow,{at:this.state.curPosition()}),this.expect(19),this.parseArrowExpression(t,e,!0)}parseDo(t,e){this.expectPlugin("doExpressions"),e&&this.expectPlugin("asyncDoExpressions"),t.async=e,this.next();let s=this.state.labels;return this.state.labels=[],e?(this.prodParam.enter(2),t.body=this.parseBlock(),this.prodParam.exit()):t.body=this.parseBlock(),this.state.labels=s,this.finishNode(t,"DoExpression")}parseSuper(){let t=this.startNode();return this.next(),this.match(10)&&!this.scope.allowDirectSuper&&!this.options.allowSuperOutsideMethod?this.raise(h.SuperNotAllowed,{at:t}):!this.scope.allowSuper&&!this.options.allowSuperOutsideMethod&&this.raise(h.UnexpectedSuper,{at:t}),!this.match(10)&&!this.match(0)&&!this.match(16)&&this.raise(h.UnsupportedSuper,{at:t}),this.finishNode(t,"Super")}parsePrivateName(){let t=this.startNode(),e=this.startNodeAt(V(this.state.startLoc,1)),s=this.state.value;return this.next(),t.id=this.createIdentifier(e,s),this.finishNode(t,"PrivateName")}parseFunctionOrFunctionSent(){let t=this.startNode();if(this.next(),this.prodParam.hasYield&&this.match(16)){let e=this.createIdentifier(this.startNodeAtNode(t),"function");return this.next(),this.match(103)?this.expectPlugin("functionSent"):this.hasPlugin("functionSent")||this.unexpected(),this.parseMetaProperty(t,e,"sent")}return this.parseFunction(t)}parseMetaProperty(t,e,s){t.meta=e;let r=this.state.containsEsc;return t.property=this.parseIdentifier(!0),(t.property.name!==s||r)&&this.raise(h.UnsupportedMetaProperty,{at:t.property,target:e.name,onlyValidPropertyName:s}),this.finishNode(t,"MetaProperty")}parseImportMetaProperty(t){let e=this.createIdentifier(this.startNodeAtNode(t),"import");if(this.next(),this.isContextual(101))this.inModule||this.raise(h.ImportMetaOutsideModule,{at:e}),this.sawUnambiguousESM=!0;else if(this.isContextual(105)||this.isContextual(97)){let s=this.isContextual(105);if(s||this.unexpected(),this.expectPlugin(s?"sourcePhaseImports":"deferredImportEvaluation"),!this.options.createImportExpressions)throw this.raise(h.DynamicImportPhaseRequiresImportExpressions,{at:this.state.startLoc,phase:this.state.value});return this.next(),t.phase=s?"source":"defer",this.parseImportCall(t)}return this.parseMetaProperty(t,e,"meta")}parseLiteralAtNode(t,e,s){return this.addExtra(s,"rawValue",t),this.addExtra(s,"raw",this.input.slice(s.start,this.state.end)),s.value=t,this.next(),this.finishNode(s,e)}parseLiteral(t,e){let s=this.startNode();return this.parseLiteralAtNode(t,e,s)}parseStringLiteral(t){return this.parseLiteral(t,"StringLiteral")}parseNumericLiteral(t){return this.parseLiteral(t,"NumericLiteral")}parseBigIntLiteral(t){return this.parseLiteral(t,"BigIntLiteral")}parseDecimalLiteral(t){return this.parseLiteral(t,"DecimalLiteral")}parseRegExpLiteral(t){let e=this.parseLiteral(t.value,"RegExpLiteral");return e.pattern=t.pattern,e.flags=t.flags,e}parseBooleanLiteral(t){let e=this.startNode();return e.value=t,this.next(),this.finishNode(e,"BooleanLiteral")}parseNullLiteral(){let t=this.startNode();return this.next(),this.finishNode(t,"NullLiteral")}parseParenAndDistinguishExpression(t){let e=this.state.startLoc,s;this.next(),this.expressionScope.enter(xl());let r=this.state.maybeInArrowParameters,a=this.state.inFSharpPipelineDirectBody;this.state.maybeInArrowParameters=!0,this.state.inFSharpPipelineDirectBody=!1;let n=this.state.startLoc,o=[],u=new Be,l=!0,c,p;for(;!this.match(11);){if(l)l=!1;else if(this.expect(12,u.optionalParametersLoc===null?null:u.optionalParametersLoc),this.match(11)){p=this.state.startLoc;break}if(this.match(21)){let d=this.state.startLoc;if(c=this.state.startLoc,o.push(this.parseParenItem(this.parseRestBinding(),d)),!this.checkCommaAfterRest(41))break}else o.push(this.parseMaybeAssignAllowIn(u,this.parseParenItem))}let f=this.state.lastTokEndLoc;this.expect(11),this.state.maybeInArrowParameters=r,this.state.inFSharpPipelineDirectBody=a;let m=this.startNodeAt(e);return t&&this.shouldParseArrow(o)&&(m=this.parseArrow(m))?(this.checkDestructuringPrivate(u),this.expressionScope.validateAsPattern(),this.expressionScope.exit(),this.parseArrowExpression(m,o,!1),m):(this.expressionScope.exit(),o.length||this.unexpected(this.state.lastTokStartLoc),p&&this.unexpected(p),c&&this.unexpected(c),this.checkExpressionErrors(u,!0),this.toReferencedListDeep(o,!0),o.length>1?(s=this.startNodeAt(n),s.expressions=o,this.finishNode(s,"SequenceExpression"),this.resetEndLocation(s,f)):s=o[0],this.wrapParenthesis(e,s))}wrapParenthesis(t,e){if(!this.options.createParenthesizedExpressions)return this.addExtra(e,"parenthesized",!0),this.addExtra(e,"parenStart",t.index),this.takeSurroundingComments(e,t.index,this.state.lastTokEndLoc.index),e;let s=this.startNodeAt(t);return s.expression=e,this.finishNode(s,"ParenthesizedExpression")}shouldParseArrow(t){return!this.canInsertSemicolon()}parseArrow(t){if(this.eat(19))return t}parseParenItem(t,e){return t}parseNewOrNewTarget(){let t=this.startNode();if(this.next(),this.match(16)){let e=this.createIdentifier(this.startNodeAtNode(t),"new");this.next();let s=this.parseMetaProperty(t,e,"target");return!this.scope.inNonArrowFunction&&!this.scope.inClass&&!this.options.allowNewTargetOutsideFunction&&this.raise(h.UnexpectedNewTarget,{at:s}),s}return this.parseNew(t)}parseNew(t){if(this.parseNewCallee(t),this.eat(10)){let e=this.parseExprList(11);this.toReferencedList(e),t.arguments=e}else t.arguments=[];return this.finishNode(t,"NewExpression")}parseNewCallee(t){let e=this.match(83),s=this.parseNoCallExpr();t.callee=s,e&&(s.type==="Import"||s.type==="ImportExpression")&&this.raise(h.ImportCallNotNewExpression,{at:s})}parseTemplateElement(t){let{start:e,startLoc:s,end:r,value:a}=this.state,n=e+1,o=this.startNodeAt(V(s,1));a===null&&(t||this.raise(h.InvalidEscapeSequenceTemplate,{at:V(this.state.firstInvalidTemplateEscapePos,1)}));let u=this.match(24),l=u?-1:-2,c=r+l;o.value={raw:this.input.slice(n,c).replace(/\r\n?/g,`
16
- `),cooked:a===null?null:a.slice(1,l)},o.tail=u,this.next();let p=this.finishNode(o,"TemplateElement");return this.resetEndLocation(p,V(this.state.lastTokEndLoc,l)),p}parseTemplate(t){let e=this.startNode();e.expressions=[];let s=this.parseTemplateElement(t);for(e.quasis=[s];!s.tail;)e.expressions.push(this.parseTemplateSubstitution()),this.readTemplateContinuation(),e.quasis.push(s=this.parseTemplateElement(t));return this.finishNode(e,"TemplateLiteral")}parseTemplateSubstitution(){return this.parseExpression()}parseObjectLike(t,e,s,r){s&&this.expectPlugin("recordAndTuple");let a=this.state.inFSharpPipelineDirectBody;this.state.inFSharpPipelineDirectBody=!1;let n=Object.create(null),o=!0,u=this.startNode();for(u.properties=[],this.next();!this.match(t);){if(o)o=!1;else if(this.expect(12),this.match(t)){this.addTrailingCommaExtraToNode(u);break}let c;e?c=this.parseBindingProperty():(c=this.parsePropertyDefinition(r),this.checkProto(c,s,n,r)),s&&!this.isObjectProperty(c)&&c.type!=="SpreadElement"&&this.raise(h.InvalidRecordProperty,{at:c}),c.shorthand&&this.addExtra(c,"shorthand",!0),u.properties.push(c)}this.next(),this.state.inFSharpPipelineDirectBody=a;let l="ObjectExpression";return e?l="ObjectPattern":s&&(l="RecordExpression"),this.finishNode(u,l)}addTrailingCommaExtraToNode(t){this.addExtra(t,"trailingComma",this.state.lastTokStart),this.addExtra(t,"trailingCommaLoc",this.state.lastTokStartLoc,!1)}maybeAsyncOrAccessorProp(t){return!t.computed&&t.key.type==="Identifier"&&(this.isLiteralPropertyName()||this.match(0)||this.match(55))}parsePropertyDefinition(t){let e=[];if(this.match(26))for(this.hasPlugin("decorators")&&this.raise(h.UnsupportedPropertyDecorator,{at:this.state.startLoc});this.match(26);)e.push(this.parseDecorator());let s=this.startNode(),r=!1,a=!1,n;if(this.match(21))return e.length&&this.unexpected(),this.parseSpread();e.length&&(s.decorators=e,e=[]),s.method=!1,t&&(n=this.state.startLoc);let o=this.eat(55);this.parsePropertyNamePrefixOperator(s);let u=this.state.containsEsc,l=this.parsePropertyName(s,t);if(!o&&!u&&this.maybeAsyncOrAccessorProp(s)){let c=l.name;c==="async"&&!this.hasPrecedingLineBreak()&&(r=!0,this.resetPreviousNodeTrailingComments(l),o=this.eat(55),this.parsePropertyName(s)),(c==="get"||c==="set")&&(a=!0,this.resetPreviousNodeTrailingComments(l),s.kind=c,this.match(55)&&(o=!0,this.raise(h.AccessorIsGenerator,{at:this.state.curPosition(),kind:c}),this.next()),this.parsePropertyName(s))}return this.parseObjPropValue(s,n,o,r,!1,a,t)}getGetterSetterExpectedParamCount(t){return t.kind==="get"?0:1}getObjectOrClassMethodParams(t){return t.params}checkGetterSetterParams(t){var e;let s=this.getGetterSetterExpectedParamCount(t),r=this.getObjectOrClassMethodParams(t);r.length!==s&&this.raise(t.kind==="get"?h.BadGetterArity:h.BadSetterArity,{at:t}),t.kind==="set"&&((e=r[r.length-1])==null?void 0:e.type)==="RestElement"&&this.raise(h.BadSetterRestParameter,{at:t})}parseObjectMethod(t,e,s,r,a){if(a){let n=this.parseMethod(t,e,!1,!1,!1,"ObjectMethod");return this.checkGetterSetterParams(n),n}if(s||e||this.match(10))return r&&this.unexpected(),t.kind="method",t.method=!0,this.parseMethod(t,e,s,!1,!1,"ObjectMethod")}parseObjectProperty(t,e,s,r){if(t.shorthand=!1,this.eat(14))return t.value=s?this.parseMaybeDefault(this.state.startLoc):this.parseMaybeAssignAllowIn(r),this.finishNode(t,"ObjectProperty");if(!t.computed&&t.key.type==="Identifier"){if(this.checkReservedWord(t.key.name,t.key.loc.start,!0,!1),s)t.value=this.parseMaybeDefault(e,ne(t.key));else if(this.match(29)){let a=this.state.startLoc;r!=null?r.shorthandAssignLoc===null&&(r.shorthandAssignLoc=a):this.raise(h.InvalidCoverInitializedName,{at:a}),t.value=this.parseMaybeDefault(e,ne(t.key))}else t.value=ne(t.key);return t.shorthand=!0,this.finishNode(t,"ObjectProperty")}}parseObjPropValue(t,e,s,r,a,n,o){let u=this.parseObjectMethod(t,s,r,a,n)||this.parseObjectProperty(t,e,a,o);return u||this.unexpected(),u}parsePropertyName(t,e){if(this.eat(0))t.computed=!0,t.key=this.parseMaybeAssignAllowIn(),this.expect(3);else{let{type:s,value:r}=this.state,a;if(X(s))a=this.parseIdentifier(!0);else switch(s){case 134:a=this.parseNumericLiteral(r);break;case 133:a=this.parseStringLiteral(r);break;case 135:a=this.parseBigIntLiteral(r);break;case 136:a=this.parseDecimalLiteral(r);break;case 138:{let n=this.state.startLoc;e!=null?e.privateKeyLoc===null&&(e.privateKeyLoc=n):this.raise(h.UnexpectedPrivateField,{at:n}),a=this.parsePrivateName();break}default:this.unexpected()}t.key=a,s!==138&&(t.computed=!1)}return t.key}initFunction(t,e){t.id=null,t.generator=!1,t.async=e}parseMethod(t,e,s,r,a,n,o=!1){this.initFunction(t,s),t.generator=e,this.scope.enter(18|(o?64:0)|(a?32:0)),this.prodParam.enter(Ut(s,t.generator)),this.parseFunctionParams(t,r);let u=this.parseFunctionBodyAndFinish(t,n,!0);return this.prodParam.exit(),this.scope.exit(),u}parseArrayLike(t,e,s,r){s&&this.expectPlugin("recordAndTuple");let a=this.state.inFSharpPipelineDirectBody;this.state.inFSharpPipelineDirectBody=!1;let n=this.startNode();return this.next(),n.elements=this.parseExprList(t,!s,r,n),this.state.inFSharpPipelineDirectBody=a,this.finishNode(n,s?"TupleExpression":"ArrayExpression")}parseArrowExpression(t,e,s,r){this.scope.enter(6);let a=Ut(s,!1);!this.match(5)&&this.prodParam.hasIn&&(a|=8),this.prodParam.enter(a),this.initFunction(t,s);let n=this.state.maybeInArrowParameters;return e&&(this.state.maybeInArrowParameters=!0,this.setArrowFunctionParameters(t,e,r)),this.state.maybeInArrowParameters=!1,this.parseFunctionBody(t,!0),this.prodParam.exit(),this.scope.exit(),this.state.maybeInArrowParameters=n,this.finishNode(t,"ArrowFunctionExpression")}setArrowFunctionParameters(t,e,s){this.toAssignableList(e,s,!1),t.params=e}parseFunctionBodyAndFinish(t,e,s=!1){return this.parseFunctionBody(t,!1,s),this.finishNode(t,e)}parseFunctionBody(t,e,s=!1){let r=e&&!this.match(5);if(this.expressionScope.enter(Ma()),r)t.body=this.parseMaybeAssign(),this.checkParams(t,!1,e,!1);else{let a=this.state.strict,n=this.state.labels;this.state.labels=[],this.prodParam.enter(this.prodParam.currentFlags()|4),t.body=this.parseBlock(!0,!1,o=>{let u=!this.isSimpleParamList(t.params);o&&u&&this.raise(h.IllegalLanguageModeDirective,{at:(t.kind==="method"||t.kind==="constructor")&&t.key?t.key.loc.end:t});let l=!a&&this.state.strict;this.checkParams(t,!this.state.strict&&!e&&!s&&!u,e,l),this.state.strict&&t.id&&this.checkIdentifier(t.id,65,l)}),this.prodParam.exit(),this.state.labels=n}this.expressionScope.exit()}isSimpleParameter(t){return t.type==="Identifier"}isSimpleParamList(t){for(let e=0,s=t.length;e<s;e++)if(!this.isSimpleParameter(t[e]))return!1;return!0}checkParams(t,e,s,r=!0){let a=!e&&new Set,n={type:"FormalParameters"};for(let o of t.params)this.checkLVal(o,{in:n,binding:5,checkClashes:a,strictModeChanged:r})}parseExprList(t,e,s,r){let a=[],n=!0;for(;!this.eat(t);){if(n)n=!1;else if(this.expect(12),this.match(t)){r&&this.addTrailingCommaExtraToNode(r),this.next();break}a.push(this.parseExprListItem(e,s))}return a}parseExprListItem(t,e,s){let r;if(this.match(12))t||this.raise(h.UnexpectedToken,{at:this.state.curPosition(),unexpected:","}),r=null;else if(this.match(21)){let a=this.state.startLoc;r=this.parseParenItem(this.parseSpread(e),a)}else if(this.match(17)){this.expectPlugin("partialApplication"),s||this.raise(h.UnexpectedArgumentPlaceholder,{at:this.state.startLoc});let a=this.startNode();this.next(),r=this.finishNode(a,"ArgumentPlaceholder")}else r=this.parseMaybeAssignAllowIn(e,this.parseParenItem);return r}parseIdentifier(t){let e=this.startNode(),s=this.parseIdentifierName(t);return this.createIdentifier(e,s)}createIdentifier(t,e){return t.name=e,t.loc.identifierName=e,this.finishNode(t,"Identifier")}parseIdentifierName(t){let e,{startLoc:s,type:r}=this.state;X(r)?e=this.state.value:this.unexpected();let a=qu(r);return t?a&&this.replaceToken(132):this.checkReservedWord(e,s,a,!1),this.next(),e}checkReservedWord(t,e,s,r){if(t.length>10||!ol(t))return;if(s&&il(t)){this.raise(h.UnexpectedKeyword,{at:e,keyword:t});return}if((this.state.strict?r?Ia:Ea:Aa)(t,this.inModule)){this.raise(h.UnexpectedReservedWord,{at:e,reservedWord:t});return}else if(t==="yield"){if(this.prodParam.hasYield){this.raise(h.YieldBindingIdentifier,{at:e});return}}else if(t==="await"){if(this.prodParam.hasAwait){this.raise(h.AwaitBindingIdentifier,{at:e});return}if(this.scope.inStaticBlock){this.raise(h.AwaitBindingIdentifierInStaticBlock,{at:e});return}this.expressionScope.recordAsyncArrowParametersError({at:e})}else if(t==="arguments"&&this.scope.inClassAndNotInNonArrowFunction){this.raise(h.ArgumentsInClass,{at:e});return}}isAwaitAllowed(){return!!(this.prodParam.hasAwait||this.options.allowAwaitOutsideFunction&&!this.scope.inFunction)}parseAwait(t){let e=this.startNodeAt(t);return this.expressionScope.recordParameterInitializerError(h.AwaitExpressionFormalParameter,{at:e}),this.eat(55)&&this.raise(h.ObsoleteAwaitStar,{at:e}),!this.scope.inFunction&&!this.options.allowAwaitOutsideFunction&&(this.isAmbiguousAwait()?this.ambiguousScriptDifferentAst=!0:this.sawUnambiguousESM=!0),this.state.soloAwait||(e.argument=this.parseMaybeUnary(null,!0)),this.finishNode(e,"AwaitExpression")}isAmbiguousAwait(){if(this.hasPrecedingLineBreak())return!0;let{type:t}=this.state;return t===53||t===10||t===0||Wt(t)||t===102&&!this.state.containsEsc||t===137||t===56||this.hasPlugin("v8intrinsic")&&t===54}parseYield(){let t=this.startNode();this.expressionScope.recordParameterInitializerError(h.YieldInParameter,{at:t}),this.next();let e=!1,s=null;if(!this.hasPrecedingLineBreak())switch(e=this.eat(55),this.state.type){case 13:case 139:case 8:case 11:case 3:case 9:case 14:case 12:if(!e)break;default:s=this.parseMaybeAssign()}return t.delegate=e,t.argument=s,this.finishNode(t,"YieldExpression")}parseImportCall(t){return this.next(),t.source=this.parseMaybeAssignAllowIn(),(this.hasPlugin("importAttributes")||this.hasPlugin("importAssertions"))&&(t.options=null),this.eat(12)&&(this.expectImportAttributesPlugin(),this.match(11)||(t.options=this.parseMaybeAssignAllowIn(),this.eat(12))),this.expect(11),this.finishNode(t,"ImportExpression")}checkPipelineAtInfixOperator(t,e){this.hasPlugin(["pipelineOperator",{proposal:"smart"}])&&t.type==="SequenceExpression"&&this.raise(h.PipelineHeadSequenceExpression,{at:e})}parseSmartPipelineBodyInStyle(t,e){if(this.isSimpleReference(t)){let s=this.startNodeAt(e);return s.callee=t,this.finishNode(s,"PipelineBareFunction")}else{let s=this.startNodeAt(e);return this.checkSmartPipeTopicBodyEarlyErrors(e),s.expression=t,this.finishNode(s,"PipelineTopicExpression")}}isSimpleReference(t){switch(t.type){case"MemberExpression":return!t.computed&&this.isSimpleReference(t.object);case"Identifier":return!0;default:return!1}}checkSmartPipeTopicBodyEarlyErrors(t){if(this.match(19))throw this.raise(h.PipelineBodyNoArrow,{at:this.state.startLoc});this.topicReferenceWasUsedInCurrentContext()||this.raise(h.PipelineTopicUnused,{at:t})}withTopicBindingContext(t){let e=this.state.topicContext;this.state.topicContext={maxNumOfResolvableTopics:1,maxTopicIndex:null};try{return t()}finally{this.state.topicContext=e}}withSmartMixTopicForbiddingContext(t){if(this.hasPlugin(["pipelineOperator",{proposal:"smart"}])){let e=this.state.topicContext;this.state.topicContext={maxNumOfResolvableTopics:0,maxTopicIndex:null};try{return t()}finally{this.state.topicContext=e}}else return t()}withSoloAwaitPermittingContext(t){let e=this.state.soloAwait;this.state.soloAwait=!0;try{return t()}finally{this.state.soloAwait=e}}allowInAnd(t){let e=this.prodParam.currentFlags();if(8&~e){this.prodParam.enter(e|8);try{return t()}finally{this.prodParam.exit()}}return t()}disallowInAnd(t){let e=this.prodParam.currentFlags();if(8&e){this.prodParam.enter(e&-9);try{return t()}finally{this.prodParam.exit()}}return t()}registerTopicReference(){this.state.topicContext.maxTopicIndex=0}topicReferenceIsAllowedInCurrentContext(){return this.state.topicContext.maxNumOfResolvableTopics>=1}topicReferenceWasUsedInCurrentContext(){return this.state.topicContext.maxTopicIndex!=null&&this.state.topicContext.maxTopicIndex>=0}parseFSharpPipelineBody(t){let e=this.state.startLoc;this.state.potentialArrowAt=this.state.start;let s=this.state.inFSharpPipelineDirectBody;this.state.inFSharpPipelineDirectBody=!0;let r=this.parseExprOp(this.parseMaybeUnaryOrPrivate(),e,t);return this.state.inFSharpPipelineDirectBody=s,r}parseModuleExpression(){this.expectPlugin("moduleBlocks");let t=this.startNode();this.next(),this.match(5)||this.unexpected(null,5);let e=this.startNodeAt(this.state.endLoc);this.next();let s=this.initializeScopes(!0);this.enterInitialScopes();try{t.body=this.parseProgram(e,8,"module")}finally{s()}return this.finishNode(t,"ModuleExpression")}parsePropertyNamePrefixOperator(t){}},Es={kind:"loop"},Wl={kind:"switch"},Vl=/[\uD800-\uDFFF]/u,Cs=/in(?:stanceof)?/y;function zl(i,t){for(let e=0;e<i.length;e++){let s=i[e],{type:r}=s;if(typeof r=="number"){{if(r===138){let{loc:a,start:n,value:o,end:u}=s,l=n+1,c=V(a.start,1);i.splice(e,1,new Q({type:se(27),value:"#",start:n,end:l,startLoc:a.start,endLoc:c}),new Q({type:se(132),value:o,start:l,end:u,startLoc:c,endLoc:a.end})),e++;continue}if(Wt(r)){let{loc:a,start:n,value:o,end:u}=s,l=n+1,c=V(a.start,1),p;t.charCodeAt(n)===96?p=new Q({type:se(22),value:"`",start:n,end:l,startLoc:a.start,endLoc:c}):p=new Q({type:se(8),value:"}",start:n,end:l,startLoc:a.start,endLoc:c});let f,m,d,y;r===24?(m=u-1,d=V(a.end,-1),f=o===null?null:o.slice(1,-1),y=new Q({type:se(22),value:"`",start:m,end:u,startLoc:d,endLoc:a.end})):(m=u-2,d=V(a.end,-2),f=o===null?null:o.slice(1,-2),y=new Q({type:se(23),value:"${",start:m,end:u,startLoc:d,endLoc:a.end})),i.splice(e,1,p,new Q({type:se(20),value:f,start:l,end:m,startLoc:c,endLoc:d}),y),e+=2;continue}}s.type=se(r)}}return i}var Ks=class extends Hs{parseTopLevel(t,e){return t.program=this.parseProgram(e),t.comments=this.state.comments,this.options.tokens&&(t.tokens=zl(this.tokens,this.input)),this.finishNode(t,"File")}parseProgram(t,e=139,s=this.options.sourceType){if(t.sourceType=s,t.interpreter=this.parseInterpreterDirective(),this.parseBlockBody(t,!0,!0,e),this.inModule&&!this.options.allowUndeclaredExports&&this.scope.undefinedExports.size>0)for(let[a,n]of Array.from(this.scope.undefinedExports))this.raise(h.ModuleExportUndefined,{at:n,localName:a});let r;return e===139?r=this.finishNode(t,"Program"):r=this.finishNodeAt(t,"Program",V(this.state.startLoc,-1)),r}stmtToDirective(t){let e=t;e.type="Directive",e.value=e.expression,delete e.expression;let s=e.value,r=s.value,a=this.input.slice(s.start,s.end),n=s.value=a.slice(1,-1);return this.addExtra(s,"raw",a),this.addExtra(s,"rawValue",n),this.addExtra(s,"expressionValue",r),s.type="DirectiveLiteral",e}parseInterpreterDirective(){if(!this.match(28))return null;let t=this.startNode();return t.value=this.state.value,this.next(),this.finishNode(t,"InterpreterDirective")}isLet(){return this.isContextual(100)?this.hasFollowingBindingAtom():!1}chStartsBindingIdentifier(t,e){if(ie(t)){if(Cs.lastIndex=e,Cs.test(this.input)){let s=this.codePointAtPos(Cs.lastIndex);if(!De(s)&&s!==92)return!1}return!0}else return t===92}chStartsBindingPattern(t){return t===91||t===123}hasFollowingBindingAtom(){let t=this.nextTokenStart(),e=this.codePointAtPos(t);return this.chStartsBindingPattern(e)||this.chStartsBindingIdentifier(e,t)}hasInLineFollowingBindingIdentifier(){let t=this.nextTokenInLineStart(),e=this.codePointAtPos(t);return this.chStartsBindingIdentifier(e,t)}startsUsingForOf(){let{type:t,containsEsc:e}=this.lookahead();if(t===102&&!e)return!1;if(k(t)&&!this.hasFollowingLineBreak())return this.expectPlugin("explicitResourceManagement"),!0}startsAwaitUsing(){let t=this.nextTokenInLineStart();if(this.isUnparsedContextual(t,"using")){t=this.nextTokenInLineStartSince(t+5);let e=this.codePointAtPos(t);if(this.chStartsBindingIdentifier(e,t))return this.expectPlugin("explicitResourceManagement"),!0}return!1}parseModuleItem(){return this.parseStatementLike(15)}parseStatementListItem(){return this.parseStatementLike(6|(!this.options.annexB||this.state.strict?0:8))}parseStatementOrSloppyAnnexBFunctionDeclaration(t=!1){let e=0;return this.options.annexB&&!this.state.strict&&(e|=4,t&&(e|=8)),this.parseStatementLike(e)}parseStatement(){return this.parseStatementLike(0)}parseStatementLike(t){let e=null;return this.match(26)&&(e=this.parseDecorators(!0)),this.parseStatementContent(t,e)}parseStatementContent(t,e){let s=this.state.type,r=this.startNode(),a=!!(t&2),n=!!(t&4),o=t&1;switch(s){case 60:return this.parseBreakContinueStatement(r,!0);case 63:return this.parseBreakContinueStatement(r,!1);case 64:return this.parseDebuggerStatement(r);case 90:return this.parseDoWhileStatement(r);case 91:return this.parseForStatement(r);case 68:if(this.lookaheadCharCode()===46)break;return n||this.raise(this.state.strict?h.StrictFunction:this.options.annexB?h.SloppyFunctionAnnexB:h.SloppyFunction,{at:this.state.startLoc}),this.parseFunctionStatement(r,!1,!a&&n);case 80:return a||this.unexpected(),this.parseClass(this.maybeTakeDecorators(e,r),!0);case 69:return this.parseIfStatement(r);case 70:return this.parseReturnStatement(r);case 71:return this.parseSwitchStatement(r);case 72:return this.parseThrowStatement(r);case 73:return this.parseTryStatement(r);case 96:if(!this.state.containsEsc&&this.startsAwaitUsing())return this.isAwaitAllowed()?a||this.raise(h.UnexpectedLexicalDeclaration,{at:r}):this.raise(h.AwaitUsingNotInAsyncContext,{at:r}),this.next(),this.parseVarStatement(r,"await using");break;case 107:if(this.state.containsEsc||!this.hasInLineFollowingBindingIdentifier())break;return this.expectPlugin("explicitResourceManagement"),!this.scope.inModule&&this.scope.inTopLevel?this.raise(h.UnexpectedUsingDeclaration,{at:this.state.startLoc}):a||this.raise(h.UnexpectedLexicalDeclaration,{at:this.state.startLoc}),this.parseVarStatement(r,"using");case 100:{if(this.state.containsEsc)break;let c=this.nextTokenStart(),p=this.codePointAtPos(c);if(p!==91&&(!a&&this.hasFollowingLineBreak()||!this.chStartsBindingIdentifier(p,c)&&p!==123))break}case 75:a||this.raise(h.UnexpectedLexicalDeclaration,{at:this.state.startLoc});case 74:{let c=this.state.value;return this.parseVarStatement(r,c)}case 92:return this.parseWhileStatement(r);case 76:return this.parseWithStatement(r);case 5:return this.parseBlock();case 13:return this.parseEmptyStatement(r);case 83:{let c=this.lookaheadCharCode();if(c===40||c===46)break}case 82:{!this.options.allowImportExportEverywhere&&!o&&this.raise(h.UnexpectedImportExport,{at:this.state.startLoc}),this.next();let c;return s===83?(c=this.parseImport(r),c.type==="ImportDeclaration"&&(!c.importKind||c.importKind==="value")&&(this.sawUnambiguousESM=!0)):(c=this.parseExport(r,e),(c.type==="ExportNamedDeclaration"&&(!c.exportKind||c.exportKind==="value")||c.type==="ExportAllDeclaration"&&(!c.exportKind||c.exportKind==="value")||c.type==="ExportDefaultDeclaration")&&(this.sawUnambiguousESM=!0)),this.assertModuleNodeAllowed(c),c}default:if(this.isAsyncFunction())return a||this.raise(h.AsyncFunctionInSingleStatementContext,{at:this.state.startLoc}),this.next(),this.parseFunctionStatement(r,!0,!a&&n)}let u=this.state.value,l=this.parseExpression();return k(s)&&l.type==="Identifier"&&this.eat(14)?this.parseLabeledStatement(r,u,l,t):this.parseExpressionStatement(r,l,e)}assertModuleNodeAllowed(t){!this.options.allowImportExportEverywhere&&!this.inModule&&this.raise(h.ImportOutsideModule,{at:t})}decoratorsEnabledBeforeExport(){return this.hasPlugin("decorators-legacy")?!0:this.hasPlugin("decorators")&&this.getPluginOption("decorators","decoratorsBeforeExport")!==!1}maybeTakeDecorators(t,e,s){return t&&(e.decorators&&e.decorators.length>0?(typeof this.getPluginOption("decorators","decoratorsBeforeExport")!="boolean"&&this.raise(h.DecoratorsBeforeAfterExport,{at:e.decorators[0]}),e.decorators.unshift(...t)):e.decorators=t,this.resetStartLocationFromNode(e,t[0]),s&&this.resetStartLocationFromNode(s,e)),e}canHaveLeadingDecorator(){return this.match(80)}parseDecorators(t){let e=[];do e.push(this.parseDecorator());while(this.match(26));if(this.match(82))t||this.unexpected(),this.decoratorsEnabledBeforeExport()||this.raise(h.DecoratorExportClass,{at:this.state.startLoc});else if(!this.canHaveLeadingDecorator())throw this.raise(h.UnexpectedLeadingDecorator,{at:this.state.startLoc});return e}parseDecorator(){this.expectOnePlugin(["decorators","decorators-legacy"]);let t=this.startNode();if(this.next(),this.hasPlugin("decorators")){let e=this.state.startLoc,s;if(this.match(10)){let r=this.state.startLoc;this.next(),s=this.parseExpression(),this.expect(11),s=this.wrapParenthesis(r,s);let a=this.state.startLoc;t.expression=this.parseMaybeDecoratorArguments(s),this.getPluginOption("decorators","allowCallParenthesized")===!1&&t.expression!==s&&this.raise(h.DecoratorArgumentsOutsideParentheses,{at:a})}else{for(s=this.parseIdentifier(!1);this.eat(16);){let r=this.startNodeAt(e);r.object=s,this.match(138)?(this.classScope.usePrivateName(this.state.value,this.state.startLoc),r.property=this.parsePrivateName()):r.property=this.parseIdentifier(!0),r.computed=!1,s=this.finishNode(r,"MemberExpression")}t.expression=this.parseMaybeDecoratorArguments(s)}}else t.expression=this.parseExprSubscripts();return this.finishNode(t,"Decorator")}parseMaybeDecoratorArguments(t){if(this.eat(10)){let e=this.startNodeAtNode(t);return e.callee=t,e.arguments=this.parseCallExpressionArguments(11,!1),this.toReferencedList(e.arguments),this.finishNode(e,"CallExpression")}return t}parseBreakContinueStatement(t,e){return this.next(),this.isLineTerminator()?t.label=null:(t.label=this.parseIdentifier(),this.semicolon()),this.verifyBreakContinue(t,e),this.finishNode(t,e?"BreakStatement":"ContinueStatement")}verifyBreakContinue(t,e){let s;for(s=0;s<this.state.labels.length;++s){let r=this.state.labels[s];if((t.label==null||r.name===t.label.name)&&(r.kind!=null&&(e||r.kind==="loop")||t.label&&e))break}if(s===this.state.labels.length){let r=e?"BreakStatement":"ContinueStatement";this.raise(h.IllegalBreakContinue,{at:t,type:r})}}parseDebuggerStatement(t){return this.next(),this.semicolon(),this.finishNode(t,"DebuggerStatement")}parseHeaderExpression(){this.expect(10);let t=this.parseExpression();return this.expect(11),t}parseDoWhileStatement(t){return this.next(),this.state.labels.push(Es),t.body=this.withSmartMixTopicForbiddingContext(()=>this.parseStatement()),this.state.labels.pop(),this.expect(92),t.test=this.parseHeaderExpression(),this.eat(13),this.finishNode(t,"DoWhileStatement")}parseForStatement(t){this.next(),this.state.labels.push(Es);let e=null;if(this.isAwaitAllowed()&&this.eatContextual(96)&&(e=this.state.lastTokStartLoc),this.scope.enter(0),this.expect(10),this.match(13))return e!==null&&this.unexpected(e),this.parseFor(t,null);let s=this.isContextual(100);{let u=this.isContextual(96)&&this.startsAwaitUsing(),l=u||this.isContextual(107)&&this.startsUsingForOf(),c=s&&this.hasFollowingBindingAtom()||l;if(this.match(74)||this.match(75)||c){let p=this.startNode(),f;u?(f="await using",this.isAwaitAllowed()||this.raise(h.AwaitUsingNotInAsyncContext,{at:this.state.startLoc}),this.next()):f=this.state.value,this.next(),this.parseVar(p,!0,f);let m=this.finishNode(p,"VariableDeclaration"),d=this.match(58);return d&&l&&this.raise(h.ForInUsing,{at:m}),(d||this.isContextual(102))&&m.declarations.length===1?this.parseForIn(t,m,e):(e!==null&&this.unexpected(e),this.parseFor(t,m))}}let r=this.isContextual(95),a=new Be,n=this.parseExpression(!0,a),o=this.isContextual(102);if(o&&(s&&this.raise(h.ForOfLet,{at:n}),e===null&&r&&n.type==="Identifier"&&this.raise(h.ForOfAsync,{at:n})),o||this.match(58)){this.checkDestructuringPrivate(a),this.toAssignable(n,!0);let u=o?"ForOfStatement":"ForInStatement";return this.checkLVal(n,{in:{type:u}}),this.parseForIn(t,n,e)}else this.checkExpressionErrors(a,!0);return e!==null&&this.unexpected(e),this.parseFor(t,n)}parseFunctionStatement(t,e,s){return this.next(),this.parseFunction(t,1|(s?2:0)|(e?8:0))}parseIfStatement(t){return this.next(),t.test=this.parseHeaderExpression(),t.consequent=this.parseStatementOrSloppyAnnexBFunctionDeclaration(),t.alternate=this.eat(66)?this.parseStatementOrSloppyAnnexBFunctionDeclaration():null,this.finishNode(t,"IfStatement")}parseReturnStatement(t){return!this.prodParam.hasReturn&&!this.options.allowReturnOutsideFunction&&this.raise(h.IllegalReturn,{at:this.state.startLoc}),this.next(),this.isLineTerminator()?t.argument=null:(t.argument=this.parseExpression(),this.semicolon()),this.finishNode(t,"ReturnStatement")}parseSwitchStatement(t){this.next(),t.discriminant=this.parseHeaderExpression();let e=t.cases=[];this.expect(5),this.state.labels.push(Wl),this.scope.enter(0);let s;for(let r;!this.match(8);)if(this.match(61)||this.match(65)){let a=this.match(61);s&&this.finishNode(s,"SwitchCase"),e.push(s=this.startNode()),s.consequent=[],this.next(),a?s.test=this.parseExpression():(r&&this.raise(h.MultipleDefaultsInSwitch,{at:this.state.lastTokStartLoc}),r=!0,s.test=null),this.expect(14)}else s?s.consequent.push(this.parseStatementListItem()):this.unexpected();return this.scope.exit(),s&&this.finishNode(s,"SwitchCase"),this.next(),this.state.labels.pop(),this.finishNode(t,"SwitchStatement")}parseThrowStatement(t){return this.next(),this.hasPrecedingLineBreak()&&this.raise(h.NewlineAfterThrow,{at:this.state.lastTokEndLoc}),t.argument=this.parseExpression(),this.semicolon(),this.finishNode(t,"ThrowStatement")}parseCatchClauseParam(){let t=this.parseBindingAtom();return this.scope.enter(this.options.annexB&&t.type==="Identifier"?8:0),this.checkLVal(t,{in:{type:"CatchClause"},binding:9}),t}parseTryStatement(t){if(this.next(),t.block=this.parseBlock(),t.handler=null,this.match(62)){let e=this.startNode();this.next(),this.match(10)?(this.expect(10),e.param=this.parseCatchClauseParam(),this.expect(11)):(e.param=null,this.scope.enter(0)),e.body=this.withSmartMixTopicForbiddingContext(()=>this.parseBlock(!1,!1)),this.scope.exit(),t.handler=this.finishNode(e,"CatchClause")}return t.finalizer=this.eat(67)?this.parseBlock():null,!t.handler&&!t.finalizer&&this.raise(h.NoCatchOrFinally,{at:t}),this.finishNode(t,"TryStatement")}parseVarStatement(t,e,s=!1){return this.next(),this.parseVar(t,!1,e,s),this.semicolon(),this.finishNode(t,"VariableDeclaration")}parseWhileStatement(t){return this.next(),t.test=this.parseHeaderExpression(),this.state.labels.push(Es),t.body=this.withSmartMixTopicForbiddingContext(()=>this.parseStatement()),this.state.labels.pop(),this.finishNode(t,"WhileStatement")}parseWithStatement(t){return this.state.strict&&this.raise(h.StrictWith,{at:this.state.startLoc}),this.next(),t.object=this.parseHeaderExpression(),t.body=this.withSmartMixTopicForbiddingContext(()=>this.parseStatement()),this.finishNode(t,"WithStatement")}parseEmptyStatement(t){return this.next(),this.finishNode(t,"EmptyStatement")}parseLabeledStatement(t,e,s,r){for(let n of this.state.labels)n.name===e&&this.raise(h.LabelRedeclaration,{at:s,labelName:e});let a=zu(this.state.type)?"loop":this.match(71)?"switch":null;for(let n=this.state.labels.length-1;n>=0;n--){let o=this.state.labels[n];if(o.statementStart===t.start)o.statementStart=this.state.start,o.kind=a;else break}return this.state.labels.push({name:e,kind:a,statementStart:this.state.start}),t.body=r&8?this.parseStatementOrSloppyAnnexBFunctionDeclaration(!0):this.parseStatement(),this.state.labels.pop(),t.label=s,this.finishNode(t,"LabeledStatement")}parseExpressionStatement(t,e,s){return t.expression=e,this.semicolon(),this.finishNode(t,"ExpressionStatement")}parseBlock(t=!1,e=!0,s){let r=this.startNode();return t&&this.state.strictErrors.clear(),this.expect(5),e&&this.scope.enter(0),this.parseBlockBody(r,t,!1,8,s),e&&this.scope.exit(),this.finishNode(r,"BlockStatement")}isValidDirective(t){return t.type==="ExpressionStatement"&&t.expression.type==="StringLiteral"&&!t.expression.extra.parenthesized}parseBlockBody(t,e,s,r,a){let n=t.body=[],o=t.directives=[];this.parseBlockOrModuleBlockBody(n,e?o:void 0,s,r,a)}parseBlockOrModuleBlockBody(t,e,s,r,a){let n=this.state.strict,o=!1,u=!1;for(;!this.match(r);){let l=s?this.parseModuleItem():this.parseStatementListItem();if(e&&!u){if(this.isValidDirective(l)){let c=this.stmtToDirective(l);e.push(c),!o&&c.value.value==="use strict"&&(o=!0,this.setStrict(!0));continue}u=!0,this.state.strictErrors.clear()}t.push(l)}a==null||a.call(this,o),n||this.setStrict(!1),this.next()}parseFor(t,e){return t.init=e,this.semicolon(!1),t.test=this.match(13)?null:this.parseExpression(),this.semicolon(!1),t.update=this.match(11)?null:this.parseExpression(),this.expect(11),t.body=this.withSmartMixTopicForbiddingContext(()=>this.parseStatement()),this.scope.exit(),this.state.labels.pop(),this.finishNode(t,"ForStatement")}parseForIn(t,e,s){let r=this.match(58);return this.next(),r?s!==null&&this.unexpected(s):t.await=s!==null,e.type==="VariableDeclaration"&&e.declarations[0].init!=null&&(!r||!this.options.annexB||this.state.strict||e.kind!=="var"||e.declarations[0].id.type!=="Identifier")&&this.raise(h.ForInOfLoopInitializer,{at:e,type:r?"ForInStatement":"ForOfStatement"}),e.type==="AssignmentPattern"&&this.raise(h.InvalidLhs,{at:e,ancestor:{type:"ForStatement"}}),t.left=e,t.right=r?this.parseExpression():this.parseMaybeAssignAllowIn(),this.expect(11),t.body=this.withSmartMixTopicForbiddingContext(()=>this.parseStatement()),this.scope.exit(),this.state.labels.pop(),this.finishNode(t,r?"ForInStatement":"ForOfStatement")}parseVar(t,e,s,r=!1){let a=t.declarations=[];for(t.kind=s;;){let n=this.startNode();if(this.parseVarId(n,s),n.init=this.eat(29)?e?this.parseMaybeAssignDisallowIn():this.parseMaybeAssignAllowIn():null,n.init===null&&!r&&(n.id.type!=="Identifier"&&!(e&&(this.match(58)||this.isContextual(102)))?this.raise(h.DeclarationMissingInitializer,{at:this.state.lastTokEndLoc,kind:"destructuring"}):s==="const"&&!(this.match(58)||this.isContextual(102))&&this.raise(h.DeclarationMissingInitializer,{at:this.state.lastTokEndLoc,kind:"const"})),a.push(this.finishNode(n,"VariableDeclarator")),!this.eat(12))break}return t}parseVarId(t,e){let s=this.parseBindingAtom();this.checkLVal(s,{in:{type:"VariableDeclarator"},binding:e==="var"?5:8201}),t.id=s}parseAsyncFunctionExpression(t){return this.parseFunction(t,8)}parseFunction(t,e=0){let s=e&2,r=!!(e&1),a=r&&!(e&4),n=!!(e&8);this.initFunction(t,n),this.match(55)&&(s&&this.raise(h.GeneratorInSingleStatementContext,{at:this.state.startLoc}),this.next(),t.generator=!0),r&&(t.id=this.parseFunctionId(a));let o=this.state.maybeInArrowParameters;return this.state.maybeInArrowParameters=!1,this.scope.enter(2),this.prodParam.enter(Ut(n,t.generator)),r||(t.id=this.parseFunctionId()),this.parseFunctionParams(t,!1),this.withSmartMixTopicForbiddingContext(()=>{this.parseFunctionBodyAndFinish(t,r?"FunctionDeclaration":"FunctionExpression")}),this.prodParam.exit(),this.scope.exit(),r&&!s&&this.registerFunctionStatementId(t),this.state.maybeInArrowParameters=o,t}parseFunctionId(t){return t||k(this.state.type)?this.parseIdentifier():null}parseFunctionParams(t,e){this.expect(10),this.expressionScope.enter(yl()),t.params=this.parseBindingList(11,41,2|(e?4:0)),this.expressionScope.exit()}registerFunctionStatementId(t){t.id&&this.scope.declareName(t.id.name,!this.options.annexB||this.state.strict||t.generator||t.async?this.scope.treatFunctionsAsVar?5:8201:17,t.id.loc.start)}parseClass(t,e,s){this.next();let r=this.state.strict;return this.state.strict=!0,this.parseClassId(t,e,s),this.parseClassSuper(t),t.body=this.parseClassBody(!!t.superClass,r),this.finishNode(t,e?"ClassDeclaration":"ClassExpression")}isClassProperty(){return this.match(29)||this.match(13)||this.match(8)}isClassMethod(){return this.match(10)}isNonstaticConstructor(t){return!t.computed&&!t.static&&(t.key.name==="constructor"||t.key.value==="constructor")}parseClassBody(t,e){this.classScope.enter();let s={hadConstructor:!1,hadSuperClass:t},r=[],a=this.startNode();if(a.body=[],this.expect(5),this.withSmartMixTopicForbiddingContext(()=>{for(;!this.match(8);){if(this.eat(13)){if(r.length>0)throw this.raise(h.DecoratorSemicolon,{at:this.state.lastTokEndLoc});continue}if(this.match(26)){r.push(this.parseDecorator());continue}let n=this.startNode();r.length&&(n.decorators=r,this.resetStartLocationFromNode(n,r[0]),r=[]),this.parseClassMember(a,n,s),n.kind==="constructor"&&n.decorators&&n.decorators.length>0&&this.raise(h.DecoratorConstructor,{at:n})}}),this.state.strict=e,this.next(),r.length)throw this.raise(h.TrailingDecorator,{at:this.state.startLoc});return this.classScope.exit(),this.finishNode(a,"ClassBody")}parseClassMemberFromModifier(t,e){let s=this.parseIdentifier(!0);if(this.isClassMethod()){let r=e;return r.kind="method",r.computed=!1,r.key=s,r.static=!1,this.pushClassMethod(t,r,!1,!1,!1,!1),!0}else if(this.isClassProperty()){let r=e;return r.computed=!1,r.key=s,r.static=!1,t.body.push(this.parseClassProperty(r)),!0}return this.resetPreviousNodeTrailingComments(s),!1}parseClassMember(t,e,s){let r=this.isContextual(106);if(r){if(this.parseClassMemberFromModifier(t,e))return;if(this.eat(5)){this.parseClassStaticBlock(t,e);return}}this.parseClassMemberWithIsStatic(t,e,s,r)}parseClassMemberWithIsStatic(t,e,s,r){let a=e,n=e,o=e,u=e,l=e,c=a,p=a;if(e.static=r,this.parsePropertyNamePrefixOperator(e),this.eat(55)){c.kind="method";let v=this.match(138);if(this.parseClassElementName(c),v){this.pushClassPrivateMethod(t,n,!0,!1);return}this.isNonstaticConstructor(a)&&this.raise(h.ConstructorIsGenerator,{at:a.key}),this.pushClassMethod(t,a,!0,!1,!1,!1);return}let f=k(this.state.type)&&!this.state.containsEsc,m=this.match(138),d=this.parseClassElementName(e),y=this.state.startLoc;if(this.parsePostMemberNameModifiers(p),this.isClassMethod()){if(c.kind="method",m){this.pushClassPrivateMethod(t,n,!1,!1);return}let v=this.isNonstaticConstructor(a),S=!1;v&&(a.kind="constructor",s.hadConstructor&&!this.hasPlugin("typescript")&&this.raise(h.DuplicateConstructor,{at:d}),v&&this.hasPlugin("typescript")&&e.override&&this.raise(h.OverrideOnConstructor,{at:d}),s.hadConstructor=!0,S=s.hadSuperClass),this.pushClassMethod(t,a,!1,!1,v,S)}else if(this.isClassProperty())m?this.pushClassPrivateProperty(t,u):this.pushClassProperty(t,o);else if(f&&d.name==="async"&&!this.isLineTerminator()){this.resetPreviousNodeTrailingComments(d);let v=this.eat(55);p.optional&&this.unexpected(y),c.kind="method";let S=this.match(138);this.parseClassElementName(c),this.parsePostMemberNameModifiers(p),S?this.pushClassPrivateMethod(t,n,v,!0):(this.isNonstaticConstructor(a)&&this.raise(h.ConstructorIsAsync,{at:a.key}),this.pushClassMethod(t,a,v,!0,!1,!1))}else if(f&&(d.name==="get"||d.name==="set")&&!(this.match(55)&&this.isLineTerminator())){this.resetPreviousNodeTrailingComments(d),c.kind=d.name;let v=this.match(138);this.parseClassElementName(a),v?this.pushClassPrivateMethod(t,n,!1,!1):(this.isNonstaticConstructor(a)&&this.raise(h.ConstructorIsAccessor,{at:a.key}),this.pushClassMethod(t,a,!1,!1,!1,!1)),this.checkGetterSetterParams(a)}else if(f&&d.name==="accessor"&&!this.isLineTerminator()){this.expectPlugin("decoratorAutoAccessors"),this.resetPreviousNodeTrailingComments(d);let v=this.match(138);this.parseClassElementName(o),this.pushClassAccessorProperty(t,l,v)}else this.isLineTerminator()?m?this.pushClassPrivateProperty(t,u):this.pushClassProperty(t,o):this.unexpected()}parseClassElementName(t){let{type:e,value:s}=this.state;if((e===132||e===133)&&t.static&&s==="prototype"&&this.raise(h.StaticPrototype,{at:this.state.startLoc}),e===138){s==="constructor"&&this.raise(h.ConstructorClassPrivateField,{at:this.state.startLoc});let r=this.parsePrivateName();return t.key=r,r}return this.parsePropertyName(t)}parseClassStaticBlock(t,e){var s;this.scope.enter(208);let r=this.state.labels;this.state.labels=[],this.prodParam.enter(0);let a=e.body=[];this.parseBlockOrModuleBlockBody(a,void 0,!1,8),this.prodParam.exit(),this.scope.exit(),this.state.labels=r,t.body.push(this.finishNode(e,"StaticBlock")),(s=e.decorators)!=null&&s.length&&this.raise(h.DecoratorStaticBlock,{at:e})}pushClassProperty(t,e){!e.computed&&(e.key.name==="constructor"||e.key.value==="constructor")&&this.raise(h.ConstructorClassField,{at:e.key}),t.body.push(this.parseClassProperty(e))}pushClassPrivateProperty(t,e){let s=this.parseClassPrivateProperty(e);t.body.push(s),this.classScope.declarePrivateName(this.getPrivateNameSV(s.key),0,s.key.loc.start)}pushClassAccessorProperty(t,e,s){if(!s&&!e.computed){let a=e.key;(a.name==="constructor"||a.value==="constructor")&&this.raise(h.ConstructorClassField,{at:a})}let r=this.parseClassAccessorProperty(e);t.body.push(r),s&&this.classScope.declarePrivateName(this.getPrivateNameSV(r.key),0,r.key.loc.start)}pushClassMethod(t,e,s,r,a,n){t.body.push(this.parseMethod(e,s,r,a,n,"ClassMethod",!0))}pushClassPrivateMethod(t,e,s,r){let a=this.parseMethod(e,s,r,!1,!1,"ClassPrivateMethod",!0);t.body.push(a);let n=a.kind==="get"?a.static?6:2:a.kind==="set"?a.static?5:1:0;this.declareClassPrivateMethodInScope(a,n)}declareClassPrivateMethodInScope(t,e){this.classScope.declarePrivateName(this.getPrivateNameSV(t.key),e,t.key.loc.start)}parsePostMemberNameModifiers(t){}parseClassPrivateProperty(t){return this.parseInitializer(t),this.semicolon(),this.finishNode(t,"ClassPrivateProperty")}parseClassProperty(t){return this.parseInitializer(t),this.semicolon(),this.finishNode(t,"ClassProperty")}parseClassAccessorProperty(t){return this.parseInitializer(t),this.semicolon(),this.finishNode(t,"ClassAccessorProperty")}parseInitializer(t){this.scope.enter(80),this.expressionScope.enter(Ma()),this.prodParam.enter(0),t.value=this.eat(29)?this.parseMaybeAssignAllowIn():null,this.expressionScope.exit(),this.prodParam.exit(),this.scope.exit()}parseClassId(t,e,s,r=8331){if(k(this.state.type))t.id=this.parseIdentifier(),e&&this.declareNameFromIdentifier(t.id,r);else if(s||!e)t.id=null;else throw this.raise(h.MissingClassName,{at:this.state.startLoc})}parseClassSuper(t){t.superClass=this.eat(81)?this.parseExprSubscripts():null}parseExport(t,e){let s=this.parseMaybeImportPhase(t,!0),r=this.maybeParseExportDefaultSpecifier(t,s),a=!r||this.eat(12),n=a&&this.eatExportStar(t),o=n&&this.maybeParseExportNamespaceSpecifier(t),u=a&&(!o||this.eat(12)),l=r||n;if(n&&!o){if(r&&this.unexpected(),e)throw this.raise(h.UnsupportedDecoratorExport,{at:t});return this.parseExportFrom(t,!0),this.finishNode(t,"ExportAllDeclaration")}let c=this.maybeParseExportNamedSpecifiers(t);r&&a&&!n&&!c&&this.unexpected(null,5),o&&u&&this.unexpected(null,98);let p;if(l||c){if(p=!1,e)throw this.raise(h.UnsupportedDecoratorExport,{at:t});this.parseExportFrom(t,l)}else p=this.maybeParseExportDeclaration(t);if(l||c||p){var f;let m=t;if(this.checkExport(m,!0,!1,!!m.source),((f=m.declaration)==null?void 0:f.type)==="ClassDeclaration")this.maybeTakeDecorators(e,m.declaration,m);else if(e)throw this.raise(h.UnsupportedDecoratorExport,{at:t});return this.finishNode(m,"ExportNamedDeclaration")}if(this.eat(65)){let m=t,d=this.parseExportDefaultExpression();if(m.declaration=d,d.type==="ClassDeclaration")this.maybeTakeDecorators(e,d,m);else if(e)throw this.raise(h.UnsupportedDecoratorExport,{at:t});return this.checkExport(m,!0,!0),this.finishNode(m,"ExportDefaultDeclaration")}this.unexpected(null,5)}eatExportStar(t){return this.eat(55)}maybeParseExportDefaultSpecifier(t,e){if(e||this.isExportDefaultSpecifier()){this.expectPlugin("exportDefaultFrom",e==null?void 0:e.loc.start);let s=e||this.parseIdentifier(!0),r=this.startNodeAtNode(s);return r.exported=s,t.specifiers=[this.finishNode(r,"ExportDefaultSpecifier")],!0}return!1}maybeParseExportNamespaceSpecifier(t){if(this.isContextual(93)){t.specifiers||(t.specifiers=[]);let e=this.startNodeAt(this.state.lastTokStartLoc);return this.next(),e.exported=this.parseModuleExportName(),t.specifiers.push(this.finishNode(e,"ExportNamespaceSpecifier")),!0}return!1}maybeParseExportNamedSpecifiers(t){if(this.match(5)){t.specifiers||(t.specifiers=[]);let e=t.exportKind==="type";return t.specifiers.push(...this.parseExportSpecifiers(e)),t.source=null,t.declaration=null,this.hasPlugin("importAssertions")&&(t.assertions=[]),!0}return!1}maybeParseExportDeclaration(t){return this.shouldParseExportDeclaration()?(t.specifiers=[],t.source=null,this.hasPlugin("importAssertions")&&(t.assertions=[]),t.declaration=this.parseExportDeclaration(t),!0):!1}isAsyncFunction(){if(!this.isContextual(95))return!1;let t=this.nextTokenInLineStart();return this.isUnparsedContextual(t,"function")}parseExportDefaultExpression(){let t=this.startNode();if(this.match(68))return this.next(),this.parseFunction(t,5);if(this.isAsyncFunction())return this.next(),this.next(),this.parseFunction(t,13);if(this.match(80))return this.parseClass(t,!0,!0);if(this.match(26))return this.hasPlugin("decorators")&&this.getPluginOption("decorators","decoratorsBeforeExport")===!0&&this.raise(h.DecoratorBeforeExport,{at:this.state.startLoc}),this.parseClass(this.maybeTakeDecorators(this.parseDecorators(!1),this.startNode()),!0,!0);if(this.match(75)||this.match(74)||this.isLet())throw this.raise(h.UnsupportedDefaultExport,{at:this.state.startLoc});let e=this.parseMaybeAssignAllowIn();return this.semicolon(),e}parseExportDeclaration(t){return this.match(80)?this.parseClass(this.startNode(),!0,!1):this.parseStatementListItem()}isExportDefaultSpecifier(){let{type:t}=this.state;if(k(t)){if(t===95&&!this.state.containsEsc||t===100)return!1;if((t===130||t===129)&&!this.state.containsEsc){let{type:r}=this.lookahead();if(k(r)&&r!==98||r===5)return this.expectOnePlugin(["flow","typescript"]),!1}}else if(!this.match(65))return!1;let e=this.nextTokenStart(),s=this.isUnparsedContextual(e,"from");if(this.input.charCodeAt(e)===44||k(this.state.type)&&s)return!0;if(this.match(65)&&s){let r=this.input.charCodeAt(this.nextTokenStartSince(e+4));return r===34||r===39}return!1}parseExportFrom(t,e){this.eatContextual(98)?(t.source=this.parseImportSource(),this.checkExport(t),this.maybeParseImportAttributes(t),this.checkJSONModuleImport(t)):e&&this.unexpected(),this.semicolon()}shouldParseExportDeclaration(){let{type:t}=this.state;return t===26&&(this.expectOnePlugin(["decorators","decorators-legacy"]),this.hasPlugin("decorators"))?(this.getPluginOption("decorators","decoratorsBeforeExport")===!0&&this.raise(h.DecoratorBeforeExport,{at:this.state.startLoc}),!0):t===74||t===75||t===68||t===80||this.isLet()||this.isAsyncFunction()}checkExport(t,e,s,r){if(e){var a;if(s){if(this.checkDuplicateExports(t,"default"),this.hasPlugin("exportDefaultFrom")){var n;let o=t.declaration;o.type==="Identifier"&&o.name==="from"&&o.end-o.start===4&&!((n=o.extra)!=null&&n.parenthesized)&&this.raise(h.ExportDefaultFromAsIdentifier,{at:o})}}else if((a=t.specifiers)!=null&&a.length)for(let o of t.specifiers){let{exported:u}=o,l=u.type==="Identifier"?u.name:u.value;if(this.checkDuplicateExports(o,l),!r&&o.local){let{local:c}=o;c.type!=="Identifier"?this.raise(h.ExportBindingIsString,{at:o,localName:c.value,exportName:l}):(this.checkReservedWord(c.name,c.loc.start,!0,!1),this.scope.checkLocalExport(c))}}else if(t.declaration){if(t.declaration.type==="FunctionDeclaration"||t.declaration.type==="ClassDeclaration"){let o=t.declaration.id;if(!o)throw new Error("Assertion failure");this.checkDuplicateExports(t,o.name)}else if(t.declaration.type==="VariableDeclaration")for(let o of t.declaration.declarations)this.checkDeclaration(o.id)}}}checkDeclaration(t){if(t.type==="Identifier")this.checkDuplicateExports(t,t.name);else if(t.type==="ObjectPattern")for(let e of t.properties)this.checkDeclaration(e);else if(t.type==="ArrayPattern")for(let e of t.elements)e&&this.checkDeclaration(e);else t.type==="ObjectProperty"?this.checkDeclaration(t.value):t.type==="RestElement"?this.checkDeclaration(t.argument):t.type==="AssignmentPattern"&&this.checkDeclaration(t.left)}checkDuplicateExports(t,e){this.exportedIdentifiers.has(e)&&(e==="default"?this.raise(h.DuplicateDefaultExport,{at:t}):this.raise(h.DuplicateExport,{at:t,exportName:e})),this.exportedIdentifiers.add(e)}parseExportSpecifiers(t){let e=[],s=!0;for(this.expect(5);!this.eat(8);){if(s)s=!1;else if(this.expect(12),this.eat(8))break;let r=this.isContextual(130),a=this.match(133),n=this.startNode();n.local=this.parseModuleExportName(),e.push(this.parseExportSpecifier(n,a,t,r))}return e}parseExportSpecifier(t,e,s,r){return this.eatContextual(93)?t.exported=this.parseModuleExportName():e?t.exported=Pl(t.local):t.exported||(t.exported=ne(t.local)),this.finishNode(t,"ExportSpecifier")}parseModuleExportName(){if(this.match(133)){let t=this.parseStringLiteral(this.state.value),e=t.value.match(Vl);return e&&this.raise(h.ModuleExportNameHasLoneSurrogate,{at:t,surrogateCharCode:e[0].charCodeAt(0)}),t}return this.parseIdentifier(!0)}isJSONModuleImport(t){return t.assertions!=null?t.assertions.some(({key:e,value:s})=>s.value==="json"&&(e.type==="Identifier"?e.name==="type":e.value==="type")):!1}checkImportReflection(t){let{specifiers:e}=t,s=e.length===1?e[0].type:null;if(t.phase==="source")s!=="ImportDefaultSpecifier"&&this.raise(h.SourcePhaseImportRequiresDefault,{at:e[0].loc.start});else if(t.phase==="defer")s!=="ImportNamespaceSpecifier"&&this.raise(h.DeferImportRequiresNamespace,{at:e[0].loc.start});else if(t.module){var r;s!=="ImportDefaultSpecifier"&&this.raise(h.ImportReflectionNotBinding,{at:e[0].loc.start}),((r=t.assertions)==null?void 0:r.length)>0&&this.raise(h.ImportReflectionHasAssertion,{at:t.specifiers[0].loc.start})}}checkJSONModuleImport(t){if(this.isJSONModuleImport(t)&&t.type!=="ExportAllDeclaration"){let{specifiers:e}=t;if(e!=null){let s=e.find(r=>{let a;if(r.type==="ExportSpecifier"?a=r.local:r.type==="ImportSpecifier"&&(a=r.imported),a!==void 0)return a.type==="Identifier"?a.name!=="default":a.value!=="default"});s!==void 0&&this.raise(h.ImportJSONBindingNotDefault,{at:s.loc.start})}}}isPotentialImportPhase(t){return t?!1:this.isContextual(105)||this.isContextual(97)||this.isContextual(127)}applyImportPhase(t,e,s,r){e||(s==="module"?(this.expectPlugin("importReflection",r),t.module=!0):this.hasPlugin("importReflection")&&(t.module=!1),s==="source"?(this.expectPlugin("sourcePhaseImports",r),t.phase="source"):s==="defer"?(this.expectPlugin("deferredImportEvaluation",r),t.phase="defer"):this.hasPlugin("sourcePhaseImports")&&(t.phase=null))}parseMaybeImportPhase(t,e){if(!this.isPotentialImportPhase(e))return this.applyImportPhase(t,e,null),null;let s=this.parseIdentifier(!0),{type:r}=this.state;return(X(r)?r!==98||this.lookaheadCharCode()===102:r!==12)?(this.resetPreviousIdentifierLeadingComments(s),this.applyImportPhase(t,e,s.name,s.loc.start),null):(this.applyImportPhase(t,e,null),s)}isPrecedingIdImportPhase(t){let{type:e}=this.state;return k(e)?e!==98||this.lookaheadCharCode()===102:e!==12}parseImport(t){return this.match(133)?this.parseImportSourceAndAttributes(t):this.parseImportSpecifiersAndAfter(t,this.parseMaybeImportPhase(t,!1))}parseImportSpecifiersAndAfter(t,e){t.specifiers=[];let r=!this.maybeParseDefaultImportSpecifier(t,e)||this.eat(12),a=r&&this.maybeParseStarImportSpecifier(t);return r&&!a&&this.parseNamedImportSpecifiers(t),this.expectContextual(98),this.parseImportSourceAndAttributes(t)}parseImportSourceAndAttributes(t){var e;return(e=t.specifiers)!=null||(t.specifiers=[]),t.source=this.parseImportSource(),this.maybeParseImportAttributes(t),this.checkImportReflection(t),this.checkJSONModuleImport(t),this.semicolon(),this.finishNode(t,"ImportDeclaration")}parseImportSource(){return this.match(133)||this.unexpected(),this.parseExprAtom()}parseImportSpecifierLocal(t,e,s){e.local=this.parseIdentifier(),t.specifiers.push(this.finishImportSpecifier(e,s))}finishImportSpecifier(t,e,s=8201){return this.checkLVal(t.local,{in:{type:e},binding:s}),this.finishNode(t,e)}parseImportAttributes(){this.expect(5);let t=[],e=new Set;do{if(this.match(8))break;let s=this.startNode(),r=this.state.value;if(e.has(r)&&this.raise(h.ModuleAttributesWithDuplicateKeys,{at:this.state.startLoc,key:r}),e.add(r),this.match(133)?s.key=this.parseStringLiteral(r):s.key=this.parseIdentifier(!0),this.expect(14),!this.match(133))throw this.raise(h.ModuleAttributeInvalidValue,{at:this.state.startLoc});s.value=this.parseStringLiteral(this.state.value),t.push(this.finishNode(s,"ImportAttribute"))}while(this.eat(12));return this.expect(8),t}parseModuleAttributes(){let t=[],e=new Set;do{let s=this.startNode();if(s.key=this.parseIdentifier(!0),s.key.name!=="type"&&this.raise(h.ModuleAttributeDifferentFromType,{at:s.key}),e.has(s.key.name)&&this.raise(h.ModuleAttributesWithDuplicateKeys,{at:s.key,key:s.key.name}),e.add(s.key.name),this.expect(14),!this.match(133))throw this.raise(h.ModuleAttributeInvalidValue,{at:this.state.startLoc});s.value=this.parseStringLiteral(this.state.value),t.push(this.finishNode(s,"ImportAttribute"))}while(this.eat(12));return t}maybeParseImportAttributes(t){let e,s=!1;if(this.match(76)){if(this.hasPrecedingLineBreak()&&this.lookaheadCharCode()===40)return;this.next(),this.hasPlugin("moduleAttributes")?e=this.parseModuleAttributes():(this.expectImportAttributesPlugin(),e=this.parseImportAttributes()),s=!0}else if(this.isContextual(94)&&!this.hasPrecedingLineBreak())this.hasPlugin("importAttributes")?(this.getPluginOption("importAttributes","deprecatedAssertSyntax")!==!0&&this.raise(h.ImportAttributesUseAssert,{at:this.state.startLoc}),this.addExtra(t,"deprecatedAssertSyntax",!0)):this.expectOnePlugin(["importAttributes","importAssertions"]),this.next(),e=this.parseImportAttributes();else if(this.hasPlugin("importAttributes")||this.hasPlugin("importAssertions"))e=[];else if(this.hasPlugin("moduleAttributes"))e=[];else return;!s&&this.hasPlugin("importAssertions")?t.assertions=e:t.attributes=e}maybeParseDefaultImportSpecifier(t,e){if(e){let s=this.startNodeAtNode(e);return s.local=e,t.specifiers.push(this.finishImportSpecifier(s,"ImportDefaultSpecifier")),!0}else if(X(this.state.type))return this.parseImportSpecifierLocal(t,this.startNode(),"ImportDefaultSpecifier"),!0;return!1}maybeParseStarImportSpecifier(t){if(this.match(55)){let e=this.startNode();return this.next(),this.expectContextual(93),this.parseImportSpecifierLocal(t,e,"ImportNamespaceSpecifier"),!0}return!1}parseNamedImportSpecifiers(t){let e=!0;for(this.expect(5);!this.eat(8);){if(e)e=!1;else{if(this.eat(14))throw this.raise(h.DestructureNamedImport,{at:this.state.startLoc});if(this.expect(12),this.eat(8))break}let s=this.startNode(),r=this.match(133),a=this.isContextual(130);s.imported=this.parseModuleExportName();let n=this.parseImportSpecifier(s,r,t.importKind==="type"||t.importKind==="typeof",a,void 0);t.specifiers.push(n)}}parseImportSpecifier(t,e,s,r,a){if(this.eatContextual(93))t.local=this.parseIdentifier();else{let{imported:n}=t;if(e)throw this.raise(h.ImportBindingIsString,{at:t,importName:n.value});this.checkReservedWord(n.name,t.loc.start,!0,!0),t.local||(t.local=ne(n))}return this.finishImportSpecifier(t,"ImportSpecifier",a)}isThisParam(t){return t.type==="Identifier"&&t.name==="this"}},zt=class extends Ks{constructor(t,e){t=ql(t),super(t,e),this.options=t,this.initializeScopes(),this.plugins=Hl(this.options.plugins),this.filename=t.sourceFilename}getScopeHandler(){return at}parse(){this.enterInitialScopes();let t=this.startNode(),e=this.startNode();return this.nextToken(),t.errors=null,this.parseTopLevel(t,e),t.errors=this.state.errors,t}};function Hl(i){let t=new Map;for(let e of i){let[s,r]=Array.isArray(e)?e:[e,{}];t.has(s)||t.set(s,r||{})}return t}function Kl(i,t){var e;if(((e=t)==null?void 0:e.sourceType)==="unambiguous"){t=Object.assign({},t);try{t.sourceType="module";let s=tt(t,i),r=s.parse();if(s.sawUnambiguousESM)return r;if(s.ambiguousScriptDifferentAst)try{return t.sourceType="script",tt(t,i).parse()}catch{}else r.program.sourceType="script";return r}catch(s){try{return t.sourceType="script",tt(t,i).parse()}catch{}throw s}}else return tt(t,i).parse()}function Gl(i,t){let e=tt(t,i);return e.options.strictMode&&(e.state.strict=!0),e.getExpression()}function Xl(i){let t={};for(let e of Object.keys(i))t[e]=se(i[e]);return t}var Jl=Xl($u);function tt(i,t){let e=zt;return i!=null&&i.plugins&&(Ul(i.plugins),e=Yl(i.plugins)),new e(i,t)}var va={};function Yl(i){let t=$l.filter(r=>D(i,r)),e=t.join("/"),s=va[e];if(!s){s=zt;for(let r of t)s=Fa[r](s);va[e]=s}return s}ot.parse=Kl;ot.parseExpression=Gl;ot.tokTypes=Jl});var qa=A((op,$a)=>{"use strict";var{Duplex:Ql}=require("stream");function ja(i){i.emit("close")}function Zl(){!this.destroyed&&this._writableState.finished&&this.destroy()}function Ua(i){this.removeListener("error",Ua),this.destroy(),this.listenerCount("error")===0&&this.emit("error",i)}function ec(i,t){let e=!0,s=new Ql({...t,autoDestroy:!1,emitClose:!1,objectMode:!1,writableObjectMode:!1});return i.on("message",function(a,n){let o=!n&&s._readableState.objectMode?a.toString():a;s.push(o)||i.pause()}),i.once("error",function(a){s.destroyed||(e=!1,s.destroy(a))}),i.once("close",function(){s.destroyed||s.push(null)}),s._destroy=function(r,a){if(i.readyState===i.CLOSED){a(r),process.nextTick(ja,s);return}let n=!1;i.once("error",function(u){n=!0,a(u)}),i.once("close",function(){n||a(r),process.nextTick(ja,s)}),e&&i.terminate()},s._final=function(r){if(i.readyState===i.CONNECTING){i.once("open",function(){s._final(r)});return}i._socket!==null&&(i._socket._writableState.finished?(r(),s._readableState.endEmitted&&s.destroy()):(i._socket.once("finish",function(){r()}),i.close()))},s._read=function(){i.isPaused&&i.resume()},s._write=function(r,a,n){if(i.readyState===i.CONNECTING){i.once("open",function(){s._write(r,a,n)});return}i.send(r,n)},s.on("end",Zl),s.on("error",Ua),s}$a.exports=ec});var de=A((up,Wa)=>{"use strict";Wa.exports={BINARY_TYPES:["nodebuffer","arraybuffer","fragments"],EMPTY_BUFFER:Buffer.alloc(0),GUID:"258EAFA5-E914-47DA-95CA-C5AB0DC85B11",kForOnEventAttribute:Symbol("kIsForOnEventAttribute"),kListener:Symbol("kListener"),kStatusCode:Symbol("status-code"),kWebSocket:Symbol("websocket"),NOOP:()=>{}}});var ut=A((lp,Ht)=>{"use strict";var{EMPTY_BUFFER:tc}=de(),ir=Buffer[Symbol.species];function sc(i,t){if(i.length===0)return tc;if(i.length===1)return i[0];let e=Buffer.allocUnsafe(t),s=0;for(let r=0;r<i.length;r++){let a=i[r];e.set(a,s),s+=a.length}return s<t?new ir(e.buffer,e.byteOffset,s):e}function Va(i,t,e,s,r){for(let a=0;a<r;a++)e[s+a]=i[a]^t[a&3]}function za(i,t){for(let e=0;e<i.length;e++)i[e]^=t[e&3]}function rc(i){return i.length===i.buffer.byteLength?i.buffer:i.buffer.slice(i.byteOffset,i.byteOffset+i.length)}function ar(i){if(ar.readOnly=!0,Buffer.isBuffer(i))return i;let t;return i instanceof ArrayBuffer?t=new ir(i):ArrayBuffer.isView(i)?t=new ir(i.buffer,i.byteOffset,i.byteLength):(t=Buffer.from(i),ar.readOnly=!1),t}Ht.exports={concat:sc,mask:Va,toArrayBuffer:rc,toBuffer:ar,unmask:za};if(!process.env.WS_NO_BUFFER_UTIL)try{let i=require("bufferutil");Ht.exports.mask=function(t,e,s,r,a){a<48?Va(t,e,s,r,a):i.mask(t,e,s,r,a)},Ht.exports.unmask=function(t,e){t.length<32?za(t,e):i.unmask(t,e)}}catch{}});var Ga=A((cp,Ka)=>{"use strict";var Ha=Symbol("kDone"),nr=Symbol("kRun"),or=class{constructor(t){this[Ha]=()=>{this.pending--,this[nr]()},this.concurrency=t||1/0,this.jobs=[],this.pending=0}add(t){this.jobs.push(t),this[nr]()}[nr](){if(this.pending!==this.concurrency&&this.jobs.length){let t=this.jobs.shift();this.pending++,t(this[Ha])}}};Ka.exports=or});var ht=A((hp,Qa)=>{"use strict";var lt=require("zlib"),Xa=ut(),ic=Ga(),{kStatusCode:Ja}=de(),ac=Buffer[Symbol.species],nc=Buffer.from([0,0,255,255]),Xt=Symbol("permessage-deflate"),oe=Symbol("total-length"),ct=Symbol("callback"),me=Symbol("buffers"),Gt=Symbol("error"),Kt,ur=class{constructor(t,e,s){if(this._maxPayload=s|0,this._options=t||{},this._threshold=this._options.threshold!==void 0?this._options.threshold:1024,this._isServer=!!e,this._deflate=null,this._inflate=null,this.params=null,!Kt){let r=this._options.concurrencyLimit!==void 0?this._options.concurrencyLimit:10;Kt=new ic(r)}}static get extensionName(){return"permessage-deflate"}offer(){let t={};return this._options.serverNoContextTakeover&&(t.server_no_context_takeover=!0),this._options.clientNoContextTakeover&&(t.client_no_context_takeover=!0),this._options.serverMaxWindowBits&&(t.server_max_window_bits=this._options.serverMaxWindowBits),this._options.clientMaxWindowBits?t.client_max_window_bits=this._options.clientMaxWindowBits:this._options.clientMaxWindowBits==null&&(t.client_max_window_bits=!0),t}accept(t){return t=this.normalizeParams(t),this.params=this._isServer?this.acceptAsServer(t):this.acceptAsClient(t),this.params}cleanup(){if(this._inflate&&(this._inflate.close(),this._inflate=null),this._deflate){let t=this._deflate[ct];this._deflate.close(),this._deflate=null,t&&t(new Error("The deflate stream was closed while data was being processed"))}}acceptAsServer(t){let e=this._options,s=t.find(r=>!(e.serverNoContextTakeover===!1&&r.server_no_context_takeover||r.server_max_window_bits&&(e.serverMaxWindowBits===!1||typeof e.serverMaxWindowBits=="number"&&e.serverMaxWindowBits>r.server_max_window_bits)||typeof e.clientMaxWindowBits=="number"&&!r.client_max_window_bits));if(!s)throw new Error("None of the extension offers can be accepted");return e.serverNoContextTakeover&&(s.server_no_context_takeover=!0),e.clientNoContextTakeover&&(s.client_no_context_takeover=!0),typeof e.serverMaxWindowBits=="number"&&(s.server_max_window_bits=e.serverMaxWindowBits),typeof e.clientMaxWindowBits=="number"?s.client_max_window_bits=e.clientMaxWindowBits:(s.client_max_window_bits===!0||e.clientMaxWindowBits===!1)&&delete s.client_max_window_bits,s}acceptAsClient(t){let e=t[0];if(this._options.clientNoContextTakeover===!1&&e.client_no_context_takeover)throw new Error('Unexpected parameter "client_no_context_takeover"');if(!e.client_max_window_bits)typeof this._options.clientMaxWindowBits=="number"&&(e.client_max_window_bits=this._options.clientMaxWindowBits);else if(this._options.clientMaxWindowBits===!1||typeof this._options.clientMaxWindowBits=="number"&&e.client_max_window_bits>this._options.clientMaxWindowBits)throw new Error('Unexpected or invalid parameter "client_max_window_bits"');return e}normalizeParams(t){return t.forEach(e=>{Object.keys(e).forEach(s=>{let r=e[s];if(r.length>1)throw new Error(`Parameter "${s}" must have only a single value`);if(r=r[0],s==="client_max_window_bits"){if(r!==!0){let a=+r;if(!Number.isInteger(a)||a<8||a>15)throw new TypeError(`Invalid value for parameter "${s}": ${r}`);r=a}else if(!this._isServer)throw new TypeError(`Invalid value for parameter "${s}": ${r}`)}else if(s==="server_max_window_bits"){let a=+r;if(!Number.isInteger(a)||a<8||a>15)throw new TypeError(`Invalid value for parameter "${s}": ${r}`);r=a}else if(s==="client_no_context_takeover"||s==="server_no_context_takeover"){if(r!==!0)throw new TypeError(`Invalid value for parameter "${s}": ${r}`)}else throw new Error(`Unknown parameter "${s}"`);e[s]=r})}),t}decompress(t,e,s){Kt.add(r=>{this._decompress(t,e,(a,n)=>{r(),s(a,n)})})}compress(t,e,s){Kt.add(r=>{this._compress(t,e,(a,n)=>{r(),s(a,n)})})}_decompress(t,e,s){let r=this._isServer?"client":"server";if(!this._inflate){let a=`${r}_max_window_bits`,n=typeof this.params[a]!="number"?lt.Z_DEFAULT_WINDOWBITS:this.params[a];this._inflate=lt.createInflateRaw({...this._options.zlibInflateOptions,windowBits:n}),this._inflate[Xt]=this,this._inflate[oe]=0,this._inflate[me]=[],this._inflate.on("error",uc),this._inflate.on("data",Ya)}this._inflate[ct]=s,this._inflate.write(t),e&&this._inflate.write(nc),this._inflate.flush(()=>{let a=this._inflate[Gt];if(a){this._inflate.close(),this._inflate=null,s(a);return}let n=Xa.concat(this._inflate[me],this._inflate[oe]);this._inflate._readableState.endEmitted?(this._inflate.close(),this._inflate=null):(this._inflate[oe]=0,this._inflate[me]=[],e&&this.params[`${r}_no_context_takeover`]&&this._inflate.reset()),s(null,n)})}_compress(t,e,s){let r=this._isServer?"server":"client";if(!this._deflate){let a=`${r}_max_window_bits`,n=typeof this.params[a]!="number"?lt.Z_DEFAULT_WINDOWBITS:this.params[a];this._deflate=lt.createDeflateRaw({...this._options.zlibDeflateOptions,windowBits:n}),this._deflate[oe]=0,this._deflate[me]=[],this._deflate.on("data",oc)}this._deflate[ct]=s,this._deflate.write(t),this._deflate.flush(lt.Z_SYNC_FLUSH,()=>{if(!this._deflate)return;let a=Xa.concat(this._deflate[me],this._deflate[oe]);e&&(a=new ac(a.buffer,a.byteOffset,a.length-4)),this._deflate[ct]=null,this._deflate[oe]=0,this._deflate[me]=[],e&&this.params[`${r}_no_context_takeover`]&&this._deflate.reset(),s(null,a)})}};Qa.exports=ur;function oc(i){this[me].push(i),this[oe]+=i.length}function Ya(i){if(this[oe]+=i.length,this[Xt]._maxPayload<1||this[oe]<=this[Xt]._maxPayload){this[me].push(i);return}this[Gt]=new RangeError("Max payload size exceeded"),this[Gt].code="WS_ERR_UNSUPPORTED_MESSAGE_LENGTH",this[Gt][Ja]=1009,this.removeListener("data",Ya),this.reset()}function uc(i){this[Xt]._inflate=null,i[Ja]=1007,this[ct](i)}});var pt=A((pp,Jt)=>{"use strict";var{isUtf8:Za}=require("buffer"),lc=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,1,1,0,0,1,1,0,1,1,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,1,0];function cc(i){return i>=1e3&&i<=1014&&i!==1004&&i!==1005&&i!==1006||i>=3e3&&i<=4999}function lr(i){let t=i.length,e=0;for(;e<t;)if(!(i[e]&128))e++;else if((i[e]&224)===192){if(e+1===t||(i[e+1]&192)!==128||(i[e]&254)===192)return!1;e+=2}else if((i[e]&240)===224){if(e+2>=t||(i[e+1]&192)!==128||(i[e+2]&192)!==128||i[e]===224&&(i[e+1]&224)===128||i[e]===237&&(i[e+1]&224)===160)return!1;e+=3}else if((i[e]&248)===240){if(e+3>=t||(i[e+1]&192)!==128||(i[e+2]&192)!==128||(i[e+3]&192)!==128||i[e]===240&&(i[e+1]&240)===128||i[e]===244&&i[e+1]>143||i[e]>244)return!1;e+=4}else return!1;return!0}Jt.exports={isValidStatusCode:cc,isValidUTF8:lr,tokenChars:lc};if(Za)Jt.exports.isValidUTF8=function(i){return i.length<24?lr(i):Za(i)};else if(!process.env.WS_NO_UTF_8_VALIDATE)try{let i=require("utf-8-validate");Jt.exports.isValidUTF8=function(t){return t.length<32?lr(t):i(t)}}catch{}});var dr=A((fp,on)=>{"use strict";var{Writable:hc}=require("stream"),en=ht(),{BINARY_TYPES:pc,EMPTY_BUFFER:tn,kStatusCode:fc,kWebSocket:dc}=de(),{concat:cr,toArrayBuffer:mc,unmask:yc}=ut(),{isValidStatusCode:xc,isValidUTF8:sn}=pt(),Yt=Buffer[Symbol.species],gc=Promise.resolve(),hr=typeof queueMicrotask=="function"?queueMicrotask:bc,H=0,rn=1,an=2,nn=3,pr=4,Qt=5,Zt=6,fr=class extends hc{constructor(t={}){super(),this._allowSynchronousEvents=!!t.allowSynchronousEvents,this._binaryType=t.binaryType||pc[0],this._extensions=t.extensions||{},this._isServer=!!t.isServer,this._maxPayload=t.maxPayload|0,this._skipUTF8Validation=!!t.skipUTF8Validation,this[dc]=void 0,this._bufferedBytes=0,this._buffers=[],this._compressed=!1,this._payloadLength=0,this._mask=void 0,this._fragmented=0,this._masked=!1,this._fin=!1,this._opcode=0,this._totalPayloadLength=0,this._messageLength=0,this._fragments=[],this._errored=!1,this._loop=!1,this._state=H}_write(t,e,s){if(this._opcode===8&&this._state==H)return s();this._bufferedBytes+=t.length,this._buffers.push(t),this.startLoop(s)}consume(t){if(this._bufferedBytes-=t,t===this._buffers[0].length)return this._buffers.shift();if(t<this._buffers[0].length){let s=this._buffers[0];return this._buffers[0]=new Yt(s.buffer,s.byteOffset+t,s.length-t),new Yt(s.buffer,s.byteOffset,t)}let e=Buffer.allocUnsafe(t);do{let s=this._buffers[0],r=e.length-t;t>=s.length?e.set(this._buffers.shift(),r):(e.set(new Uint8Array(s.buffer,s.byteOffset,t),r),this._buffers[0]=new Yt(s.buffer,s.byteOffset+t,s.length-t)),t-=s.length}while(t>0);return e}startLoop(t){this._loop=!0;do switch(this._state){case H:this.getInfo(t);break;case rn:this.getPayloadLength16(t);break;case an:this.getPayloadLength64(t);break;case nn:this.getMask();break;case pr:this.getData(t);break;case Qt:case Zt:this._loop=!1;return}while(this._loop);this._errored||t()}getInfo(t){if(this._bufferedBytes<2){this._loop=!1;return}let e=this.consume(2);if(e[0]&48){let r=this.createError(RangeError,"RSV2 and RSV3 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_2_3");t(r);return}let s=(e[0]&64)===64;if(s&&!this._extensions[en.extensionName]){let r=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");t(r);return}if(this._fin=(e[0]&128)===128,this._opcode=e[0]&15,this._payloadLength=e[1]&127,this._opcode===0){if(s){let r=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");t(r);return}if(!this._fragmented){let r=this.createError(RangeError,"invalid opcode 0",!0,1002,"WS_ERR_INVALID_OPCODE");t(r);return}this._opcode=this._fragmented}else if(this._opcode===1||this._opcode===2){if(this._fragmented){let r=this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");t(r);return}this._compressed=s}else if(this._opcode>7&&this._opcode<11){if(!this._fin){let r=this.createError(RangeError,"FIN must be set",!0,1002,"WS_ERR_EXPECTED_FIN");t(r);return}if(s){let r=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");t(r);return}if(this._payloadLength>125||this._opcode===8&&this._payloadLength===1){let r=this.createError(RangeError,`invalid payload length ${this._payloadLength}`,!0,1002,"WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH");t(r);return}}else{let r=this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");t(r);return}if(!this._fin&&!this._fragmented&&(this._fragmented=this._opcode),this._masked=(e[1]&128)===128,this._isServer){if(!this._masked){let r=this.createError(RangeError,"MASK must be set",!0,1002,"WS_ERR_EXPECTED_MASK");t(r);return}}else if(this._masked){let r=this.createError(RangeError,"MASK must be clear",!0,1002,"WS_ERR_UNEXPECTED_MASK");t(r);return}this._payloadLength===126?this._state=rn:this._payloadLength===127?this._state=an:this.haveLength(t)}getPayloadLength16(t){if(this._bufferedBytes<2){this._loop=!1;return}this._payloadLength=this.consume(2).readUInt16BE(0),this.haveLength(t)}getPayloadLength64(t){if(this._bufferedBytes<8){this._loop=!1;return}let e=this.consume(8),s=e.readUInt32BE(0);if(s>Math.pow(2,21)-1){let r=this.createError(RangeError,"Unsupported WebSocket frame: payload length > 2^53 - 1",!1,1009,"WS_ERR_UNSUPPORTED_DATA_PAYLOAD_LENGTH");t(r);return}this._payloadLength=s*Math.pow(2,32)+e.readUInt32BE(4),this.haveLength(t)}haveLength(t){if(this._payloadLength&&this._opcode<8&&(this._totalPayloadLength+=this._payloadLength,this._totalPayloadLength>this._maxPayload&&this._maxPayload>0)){let e=this.createError(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");t(e);return}this._masked?this._state=nn:this._state=pr}getMask(){if(this._bufferedBytes<4){this._loop=!1;return}this._mask=this.consume(4),this._state=pr}getData(t){let e=tn;if(this._payloadLength){if(this._bufferedBytes<this._payloadLength){this._loop=!1;return}e=this.consume(this._payloadLength),this._masked&&this._mask[0]|this._mask[1]|this._mask[2]|this._mask[3]&&yc(e,this._mask)}if(this._opcode>7){this.controlMessage(e,t);return}if(this._compressed){this._state=Qt,this.decompress(e,t);return}e.length&&(this._messageLength=this._totalPayloadLength,this._fragments.push(e)),this.dataMessage(t)}decompress(t,e){this._extensions[en.extensionName].decompress(t,this._fin,(r,a)=>{if(r)return e(r);if(a.length){if(this._messageLength+=a.length,this._messageLength>this._maxPayload&&this._maxPayload>0){let n=this.createError(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");e(n);return}this._fragments.push(a)}this.dataMessage(e),this._state===H&&this.startLoop(e)})}dataMessage(t){if(!this._fin){this._state=H;return}let e=this._messageLength,s=this._fragments;if(this._totalPayloadLength=0,this._messageLength=0,this._fragmented=0,this._fragments=[],this._opcode===2){let r;this._binaryType==="nodebuffer"?r=cr(s,e):this._binaryType==="arraybuffer"?r=mc(cr(s,e)):r=s,this._state===Qt||this._allowSynchronousEvents?(this.emit("message",r,!0),this._state=H):(this._state=Zt,hr(()=>{this.emit("message",r,!0),this._state=H,this.startLoop(t)}))}else{let r=cr(s,e);if(!this._skipUTF8Validation&&!sn(r)){let a=this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");t(a);return}this._state===Qt||this._allowSynchronousEvents?(this.emit("message",r,!1),this._state=H):(this._state=Zt,hr(()=>{this.emit("message",r,!1),this._state=H,this.startLoop(t)}))}}controlMessage(t,e){if(this._opcode===8){if(t.length===0)this._loop=!1,this.emit("conclude",1005,tn),this.end();else{let s=t.readUInt16BE(0);if(!xc(s)){let a=this.createError(RangeError,`invalid status code ${s}`,!0,1002,"WS_ERR_INVALID_CLOSE_CODE");e(a);return}let r=new Yt(t.buffer,t.byteOffset+2,t.length-2);if(!this._skipUTF8Validation&&!sn(r)){let a=this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");e(a);return}this._loop=!1,this.emit("conclude",s,r),this.end()}this._state=H;return}this._allowSynchronousEvents?(this.emit(this._opcode===9?"ping":"pong",t),this._state=H):(this._state=Zt,hr(()=>{this.emit(this._opcode===9?"ping":"pong",t),this._state=H,this.startLoop(e)}))}createError(t,e,s,r,a){this._loop=!1,this._errored=!0;let n=new t(s?`Invalid WebSocket frame: ${e}`:e);return Error.captureStackTrace(n,this.createError),n.code=a,n[fc]=r,n}};on.exports=fr;function bc(i){gc.then(i).catch(vc)}function Pc(i){throw i}function vc(i){process.nextTick(Pc,i)}});var yr=A((mp,cn)=>{"use strict";var{Duplex:dp}=require("stream"),{randomFillSync:wc}=require("crypto"),un=ht(),{EMPTY_BUFFER:Tc}=de(),{isValidStatusCode:Sc}=pt(),{mask:ln,toBuffer:Ue}=ut(),J=Symbol("kByteLength"),Ac=Buffer.alloc(4),mr=class i{constructor(t,e,s){this._extensions=e||{},s&&(this._generateMask=s,this._maskBuffer=Buffer.alloc(4)),this._socket=t,this._firstFragment=!0,this._compress=!1,this._bufferedBytes=0,this._deflating=!1,this._queue=[]}static frame(t,e){let s,r=!1,a=2,n=!1;e.mask&&(s=e.maskBuffer||Ac,e.generateMask?e.generateMask(s):wc(s,0,4),n=(s[0]|s[1]|s[2]|s[3])===0,a=6);let o;typeof t=="string"?(!e.mask||n)&&e[J]!==void 0?o=e[J]:(t=Buffer.from(t),o=t.length):(o=t.length,r=e.mask&&e.readOnly&&!n);let u=o;o>=65536?(a+=8,u=127):o>125&&(a+=2,u=126);let l=Buffer.allocUnsafe(r?o+a:a);return l[0]=e.fin?e.opcode|128:e.opcode,e.rsv1&&(l[0]|=64),l[1]=u,u===126?l.writeUInt16BE(o,2):u===127&&(l[2]=l[3]=0,l.writeUIntBE(o,4,6)),e.mask?(l[1]|=128,l[a-4]=s[0],l[a-3]=s[1],l[a-2]=s[2],l[a-1]=s[3],n?[l,t]:r?(ln(t,s,l,a,o),[l]):(ln(t,s,t,0,o),[l,t])):[l,t]}close(t,e,s,r){let a;if(t===void 0)a=Tc;else{if(typeof t!="number"||!Sc(t))throw new TypeError("First argument must be a valid error code number");if(e===void 0||!e.length)a=Buffer.allocUnsafe(2),a.writeUInt16BE(t,0);else{let o=Buffer.byteLength(e);if(o>123)throw new RangeError("The message must not be greater than 123 bytes");a=Buffer.allocUnsafe(2+o),a.writeUInt16BE(t,0),typeof e=="string"?a.write(e,2):a.set(e,2)}}let n={[J]:a.length,fin:!0,generateMask:this._generateMask,mask:s,maskBuffer:this._maskBuffer,opcode:8,readOnly:!1,rsv1:!1};this._deflating?this.enqueue([this.dispatch,a,!1,n,r]):this.sendFrame(i.frame(a,n),r)}ping(t,e,s){let r,a;if(typeof t=="string"?(r=Buffer.byteLength(t),a=!1):(t=Ue(t),r=t.length,a=Ue.readOnly),r>125)throw new RangeError("The data size must not be greater than 125 bytes");let n={[J]:r,fin:!0,generateMask:this._generateMask,mask:e,maskBuffer:this._maskBuffer,opcode:9,readOnly:a,rsv1:!1};this._deflating?this.enqueue([this.dispatch,t,!1,n,s]):this.sendFrame(i.frame(t,n),s)}pong(t,e,s){let r,a;if(typeof t=="string"?(r=Buffer.byteLength(t),a=!1):(t=Ue(t),r=t.length,a=Ue.readOnly),r>125)throw new RangeError("The data size must not be greater than 125 bytes");let n={[J]:r,fin:!0,generateMask:this._generateMask,mask:e,maskBuffer:this._maskBuffer,opcode:10,readOnly:a,rsv1:!1};this._deflating?this.enqueue([this.dispatch,t,!1,n,s]):this.sendFrame(i.frame(t,n),s)}send(t,e,s){let r=this._extensions[un.extensionName],a=e.binary?2:1,n=e.compress,o,u;if(typeof t=="string"?(o=Buffer.byteLength(t),u=!1):(t=Ue(t),o=t.length,u=Ue.readOnly),this._firstFragment?(this._firstFragment=!1,n&&r&&r.params[r._isServer?"server_no_context_takeover":"client_no_context_takeover"]&&(n=o>=r._threshold),this._compress=n):(n=!1,a=0),e.fin&&(this._firstFragment=!0),r){let l={[J]:o,fin:e.fin,generateMask:this._generateMask,mask:e.mask,maskBuffer:this._maskBuffer,opcode:a,readOnly:u,rsv1:n};this._deflating?this.enqueue([this.dispatch,t,this._compress,l,s]):this.dispatch(t,this._compress,l,s)}else this.sendFrame(i.frame(t,{[J]:o,fin:e.fin,generateMask:this._generateMask,mask:e.mask,maskBuffer:this._maskBuffer,opcode:a,readOnly:u,rsv1:!1}),s)}dispatch(t,e,s,r){if(!e){this.sendFrame(i.frame(t,s),r);return}let a=this._extensions[un.extensionName];this._bufferedBytes+=s[J],this._deflating=!0,a.compress(t,s.fin,(n,o)=>{if(this._socket.destroyed){let u=new Error("The socket was closed while data was being compressed");typeof r=="function"&&r(u);for(let l=0;l<this._queue.length;l++){let c=this._queue[l],p=c[c.length-1];typeof p=="function"&&p(u)}return}this._bufferedBytes-=s[J],this._deflating=!1,s.readOnly=!1,this.sendFrame(i.frame(o,s),r),this.dequeue()})}dequeue(){for(;!this._deflating&&this._queue.length;){let t=this._queue.shift();this._bufferedBytes-=t[3][J],Reflect.apply(t[0],this,t.slice(1))}}enqueue(t){this._bufferedBytes+=t[3][J],this._queue.push(t)}sendFrame(t,e){t.length===2?(this._socket.cork(),this._socket.write(t[0]),this._socket.write(t[1],e),this._socket.uncork()):this._socket.write(t[0],e)}};cn.exports=mr});var bn=A((yp,gn)=>{"use strict";var{kForOnEventAttribute:ft,kListener:xr}=de(),hn=Symbol("kCode"),pn=Symbol("kData"),fn=Symbol("kError"),dn=Symbol("kMessage"),mn=Symbol("kReason"),$e=Symbol("kTarget"),yn=Symbol("kType"),xn=Symbol("kWasClean"),ue=class{constructor(t){this[$e]=null,this[yn]=t}get target(){return this[$e]}get type(){return this[yn]}};Object.defineProperty(ue.prototype,"target",{enumerable:!0});Object.defineProperty(ue.prototype,"type",{enumerable:!0});var Te=class extends ue{constructor(t,e={}){super(t),this[hn]=e.code===void 0?0:e.code,this[mn]=e.reason===void 0?"":e.reason,this[xn]=e.wasClean===void 0?!1:e.wasClean}get code(){return this[hn]}get reason(){return this[mn]}get wasClean(){return this[xn]}};Object.defineProperty(Te.prototype,"code",{enumerable:!0});Object.defineProperty(Te.prototype,"reason",{enumerable:!0});Object.defineProperty(Te.prototype,"wasClean",{enumerable:!0});var qe=class extends ue{constructor(t,e={}){super(t),this[fn]=e.error===void 0?null:e.error,this[dn]=e.message===void 0?"":e.message}get error(){return this[fn]}get message(){return this[dn]}};Object.defineProperty(qe.prototype,"error",{enumerable:!0});Object.defineProperty(qe.prototype,"message",{enumerable:!0});var dt=class extends ue{constructor(t,e={}){super(t),this[pn]=e.data===void 0?null:e.data}get data(){return this[pn]}};Object.defineProperty(dt.prototype,"data",{enumerable:!0});var Ec={addEventListener(i,t,e={}){for(let r of this.listeners(i))if(!e[ft]&&r[xr]===t&&!r[ft])return;let s;if(i==="message")s=function(a,n){let o=new dt("message",{data:n?a:a.toString()});o[$e]=this,es(t,this,o)};else if(i==="close")s=function(a,n){let o=new Te("close",{code:a,reason:n.toString(),wasClean:this._closeFrameReceived&&this._closeFrameSent});o[$e]=this,es(t,this,o)};else if(i==="error")s=function(a){let n=new qe("error",{error:a,message:a.message});n[$e]=this,es(t,this,n)};else if(i==="open")s=function(){let a=new ue("open");a[$e]=this,es(t,this,a)};else return;s[ft]=!!e[ft],s[xr]=t,e.once?this.once(i,s):this.on(i,s)},removeEventListener(i,t){for(let e of this.listeners(i))if(e[xr]===t&&!e[ft]){this.removeListener(i,e);break}}};gn.exports={CloseEvent:Te,ErrorEvent:qe,Event:ue,EventTarget:Ec,MessageEvent:dt};function es(i,t,e){typeof i=="object"&&i.handleEvent?i.handleEvent.call(i,e):i.call(t,e)}});var gr=A((xp,Pn)=>{"use strict";var{tokenChars:mt}=pt();function ee(i,t,e){i[t]===void 0?i[t]=[e]:i[t].push(e)}function Cc(i){let t=Object.create(null),e=Object.create(null),s=!1,r=!1,a=!1,n,o,u=-1,l=-1,c=-1,p=0;for(;p<i.length;p++)if(l=i.charCodeAt(p),n===void 0)if(c===-1&&mt[l]===1)u===-1&&(u=p);else if(p!==0&&(l===32||l===9))c===-1&&u!==-1&&(c=p);else if(l===59||l===44){if(u===-1)throw new SyntaxError(`Unexpected character at index ${p}`);c===-1&&(c=p);let m=i.slice(u,c);l===44?(ee(t,m,e),e=Object.create(null)):n=m,u=c=-1}else throw new SyntaxError(`Unexpected character at index ${p}`);else if(o===void 0)if(c===-1&&mt[l]===1)u===-1&&(u=p);else if(l===32||l===9)c===-1&&u!==-1&&(c=p);else if(l===59||l===44){if(u===-1)throw new SyntaxError(`Unexpected character at index ${p}`);c===-1&&(c=p),ee(e,i.slice(u,c),!0),l===44&&(ee(t,n,e),e=Object.create(null),n=void 0),u=c=-1}else if(l===61&&u!==-1&&c===-1)o=i.slice(u,p),u=c=-1;else throw new SyntaxError(`Unexpected character at index ${p}`);else if(r){if(mt[l]!==1)throw new SyntaxError(`Unexpected character at index ${p}`);u===-1?u=p:s||(s=!0),r=!1}else if(a)if(mt[l]===1)u===-1&&(u=p);else if(l===34&&u!==-1)a=!1,c=p;else if(l===92)r=!0;else throw new SyntaxError(`Unexpected character at index ${p}`);else if(l===34&&i.charCodeAt(p-1)===61)a=!0;else if(c===-1&&mt[l]===1)u===-1&&(u=p);else if(u!==-1&&(l===32||l===9))c===-1&&(c=p);else if(l===59||l===44){if(u===-1)throw new SyntaxError(`Unexpected character at index ${p}`);c===-1&&(c=p);let m=i.slice(u,c);s&&(m=m.replace(/\\/g,""),s=!1),ee(e,o,m),l===44&&(ee(t,n,e),e=Object.create(null),n=void 0),o=void 0,u=c=-1}else throw new SyntaxError(`Unexpected character at index ${p}`);if(u===-1||a||l===32||l===9)throw new SyntaxError("Unexpected end of input");c===-1&&(c=p);let f=i.slice(u,c);return n===void 0?ee(t,f,e):(o===void 0?ee(e,f,!0):s?ee(e,o,f.replace(/\\/g,"")):ee(e,o,f),ee(t,n,e)),t}function Ic(i){return Object.keys(i).map(t=>{let e=i[t];return Array.isArray(e)||(e=[e]),e.map(s=>[t].concat(Object.keys(s).map(r=>{let a=s[r];return Array.isArray(a)||(a=[a]),a.map(n=>n===!0?r:`${r}=${n}`).join("; ")})).join("; ")).join(", ")}).join(", ")}Pn.exports={format:Ic,parse:Cc}});var Tr=A((Pp,_n)=>{"use strict";var kc=require("events"),Nc=require("https"),_c=require("http"),Tn=require("net"),Oc=require("tls"),{randomBytes:Mc,createHash:Lc}=require("crypto"),{Duplex:gp,Readable:bp}=require("stream"),{URL:br}=require("url"),ye=ht(),Dc=dr(),Bc=yr(),{BINARY_TYPES:vn,EMPTY_BUFFER:ts,GUID:Fc,kForOnEventAttribute:Pr,kListener:Rc,kStatusCode:jc,kWebSocket:j,NOOP:Sn}=de(),{EventTarget:{addEventListener:Uc,removeEventListener:$c}}=bn(),{format:qc,parse:Wc}=gr(),{toBuffer:Vc}=ut(),zc=30*1e3,An=Symbol("kAborted"),vr=[8,13],le=["CONNECTING","OPEN","CLOSING","CLOSED"],Hc=/^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/,O=class i extends kc{constructor(t,e,s){super(),this._binaryType=vn[0],this._closeCode=1006,this._closeFrameReceived=!1,this._closeFrameSent=!1,this._closeMessage=ts,this._closeTimer=null,this._extensions={},this._paused=!1,this._protocol="",this._readyState=i.CONNECTING,this._receiver=null,this._sender=null,this._socket=null,t!==null?(this._bufferedAmount=0,this._isServer=!1,this._redirects=0,e===void 0?e=[]:Array.isArray(e)||(typeof e=="object"&&e!==null?(s=e,e=[]):e=[e]),En(this,t,e,s)):this._isServer=!0}get binaryType(){return this._binaryType}set binaryType(t){vn.includes(t)&&(this._binaryType=t,this._receiver&&(this._receiver._binaryType=t))}get bufferedAmount(){return this._socket?this._socket._writableState.length+this._sender._bufferedBytes:this._bufferedAmount}get extensions(){return Object.keys(this._extensions).join()}get isPaused(){return this._paused}get onclose(){return null}get onerror(){return null}get onopen(){return null}get onmessage(){return null}get protocol(){return this._protocol}get readyState(){return this._readyState}get url(){return this._url}setSocket(t,e,s){let r=new Dc({allowSynchronousEvents:s.allowSynchronousEvents,binaryType:this.binaryType,extensions:this._extensions,isServer:this._isServer,maxPayload:s.maxPayload,skipUTF8Validation:s.skipUTF8Validation});this._sender=new Bc(t,this._extensions,s.generateMask),this._receiver=r,this._socket=t,r[j]=this,t[j]=this,r.on("conclude",Xc),r.on("drain",Jc),r.on("error",Yc),r.on("message",Qc),r.on("ping",Zc),r.on("pong",eh),t.setTimeout&&t.setTimeout(0),t.setNoDelay&&t.setNoDelay(),e.length>0&&t.unshift(e),t.on("close",In),t.on("data",rs),t.on("end",kn),t.on("error",Nn),this._readyState=i.OPEN,this.emit("open")}emitClose(){if(!this._socket){this._readyState=i.CLOSED,this.emit("close",this._closeCode,this._closeMessage);return}this._extensions[ye.extensionName]&&this._extensions[ye.extensionName].cleanup(),this._receiver.removeAllListeners(),this._readyState=i.CLOSED,this.emit("close",this._closeCode,this._closeMessage)}close(t,e){if(this.readyState!==i.CLOSED){if(this.readyState===i.CONNECTING){let s="WebSocket was closed before the connection was established";z(this,this._req,s);return}if(this.readyState===i.CLOSING){this._closeFrameSent&&(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end();return}this._readyState=i.CLOSING,this._sender.close(t,e,!this._isServer,s=>{s||(this._closeFrameSent=!0,(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end())}),this._closeTimer=setTimeout(this._socket.destroy.bind(this._socket),zc)}}pause(){this.readyState===i.CONNECTING||this.readyState===i.CLOSED||(this._paused=!0,this._socket.pause())}ping(t,e,s){if(this.readyState===i.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof t=="function"?(s=t,t=e=void 0):typeof e=="function"&&(s=e,e=void 0),typeof t=="number"&&(t=t.toString()),this.readyState!==i.OPEN){wr(this,t,s);return}e===void 0&&(e=!this._isServer),this._sender.ping(t||ts,e,s)}pong(t,e,s){if(this.readyState===i.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof t=="function"?(s=t,t=e=void 0):typeof e=="function"&&(s=e,e=void 0),typeof t=="number"&&(t=t.toString()),this.readyState!==i.OPEN){wr(this,t,s);return}e===void 0&&(e=!this._isServer),this._sender.pong(t||ts,e,s)}resume(){this.readyState===i.CONNECTING||this.readyState===i.CLOSED||(this._paused=!1,this._receiver._writableState.needDrain||this._socket.resume())}send(t,e,s){if(this.readyState===i.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof e=="function"&&(s=e,e={}),typeof t=="number"&&(t=t.toString()),this.readyState!==i.OPEN){wr(this,t,s);return}let r={binary:typeof t!="string",mask:!this._isServer,compress:!0,fin:!0,...e};this._extensions[ye.extensionName]||(r.compress=!1),this._sender.send(t||ts,r,s)}terminate(){if(this.readyState!==i.CLOSED){if(this.readyState===i.CONNECTING){let t="WebSocket was closed before the connection was established";z(this,this._req,t);return}this._socket&&(this._readyState=i.CLOSING,this._socket.destroy())}}};Object.defineProperty(O,"CONNECTING",{enumerable:!0,value:le.indexOf("CONNECTING")});Object.defineProperty(O.prototype,"CONNECTING",{enumerable:!0,value:le.indexOf("CONNECTING")});Object.defineProperty(O,"OPEN",{enumerable:!0,value:le.indexOf("OPEN")});Object.defineProperty(O.prototype,"OPEN",{enumerable:!0,value:le.indexOf("OPEN")});Object.defineProperty(O,"CLOSING",{enumerable:!0,value:le.indexOf("CLOSING")});Object.defineProperty(O.prototype,"CLOSING",{enumerable:!0,value:le.indexOf("CLOSING")});Object.defineProperty(O,"CLOSED",{enumerable:!0,value:le.indexOf("CLOSED")});Object.defineProperty(O.prototype,"CLOSED",{enumerable:!0,value:le.indexOf("CLOSED")});["binaryType","bufferedAmount","extensions","isPaused","protocol","readyState","url"].forEach(i=>{Object.defineProperty(O.prototype,i,{enumerable:!0})});["open","error","close","message"].forEach(i=>{Object.defineProperty(O.prototype,`on${i}`,{enumerable:!0,get(){for(let t of this.listeners(i))if(t[Pr])return t[Rc];return null},set(t){for(let e of this.listeners(i))if(e[Pr]){this.removeListener(i,e);break}typeof t=="function"&&this.addEventListener(i,t,{[Pr]:!0})}})});O.prototype.addEventListener=Uc;O.prototype.removeEventListener=$c;_n.exports=O;function En(i,t,e,s){let r={allowSynchronousEvents:!1,protocolVersion:vr[1],maxPayload:104857600,skipUTF8Validation:!1,perMessageDeflate:!0,followRedirects:!1,maxRedirects:10,...s,createConnection:void 0,socketPath:void 0,hostname:void 0,protocol:void 0,timeout:void 0,method:"GET",host:void 0,path:void 0,port:void 0};if(!vr.includes(r.protocolVersion))throw new RangeError(`Unsupported protocol version: ${r.protocolVersion} (supported versions: ${vr.join(", ")})`);let a;if(t instanceof br)a=t;else try{a=new br(t)}catch{throw new SyntaxError(`Invalid URL: ${t}`)}a.protocol==="http:"?a.protocol="ws:":a.protocol==="https:"&&(a.protocol="wss:"),i._url=a.href;let n=a.protocol==="wss:",o=a.protocol==="ws+unix:",u;if(a.protocol!=="ws:"&&!n&&!o?u=`The URL's protocol must be one of "ws:", "wss:", "http:", "https", or "ws+unix:"`:o&&!a.pathname?u="The URL's pathname is empty":a.hash&&(u="The URL contains a fragment identifier"),u){let y=new SyntaxError(u);if(i._redirects===0)throw y;ss(i,y);return}let l=n?443:80,c=Mc(16).toString("base64"),p=n?Nc.request:_c.request,f=new Set,m;if(r.createConnection=n?Gc:Kc,r.defaultPort=r.defaultPort||l,r.port=a.port||l,r.host=a.hostname.startsWith("[")?a.hostname.slice(1,-1):a.hostname,r.headers={...r.headers,"Sec-WebSocket-Version":r.protocolVersion,"Sec-WebSocket-Key":c,Connection:"Upgrade",Upgrade:"websocket"},r.path=a.pathname+a.search,r.timeout=r.handshakeTimeout,r.perMessageDeflate&&(m=new ye(r.perMessageDeflate!==!0?r.perMessageDeflate:{},!1,r.maxPayload),r.headers["Sec-WebSocket-Extensions"]=qc({[ye.extensionName]:m.offer()})),e.length){for(let y of e){if(typeof y!="string"||!Hc.test(y)||f.has(y))throw new SyntaxError("An invalid or duplicated subprotocol was specified");f.add(y)}r.headers["Sec-WebSocket-Protocol"]=e.join(",")}if(r.origin&&(r.protocolVersion<13?r.headers["Sec-WebSocket-Origin"]=r.origin:r.headers.Origin=r.origin),(a.username||a.password)&&(r.auth=`${a.username}:${a.password}`),o){let y=r.path.split(":");r.socketPath=y[0],r.path=y[1]}let d;if(r.followRedirects){if(i._redirects===0){i._originalIpc=o,i._originalSecure=n,i._originalHostOrSocketPath=o?r.socketPath:a.host;let y=s&&s.headers;if(s={...s,headers:{}},y)for(let[v,S]of Object.entries(y))s.headers[v.toLowerCase()]=S}else if(i.listenerCount("redirect")===0){let y=o?i._originalIpc?r.socketPath===i._originalHostOrSocketPath:!1:i._originalIpc?!1:a.host===i._originalHostOrSocketPath;(!y||i._originalSecure&&!n)&&(delete r.headers.authorization,delete r.headers.cookie,y||delete r.headers.host,r.auth=void 0)}r.auth&&!s.headers.authorization&&(s.headers.authorization="Basic "+Buffer.from(r.auth).toString("base64")),d=i._req=p(r),i._redirects&&i.emit("redirect",i.url,d)}else d=i._req=p(r);r.timeout&&d.on("timeout",()=>{z(i,d,"Opening handshake has timed out")}),d.on("error",y=>{d===null||d[An]||(d=i._req=null,ss(i,y))}),d.on("response",y=>{let v=y.headers.location,S=y.statusCode;if(v&&r.followRedirects&&S>=300&&S<400){if(++i._redirects>r.maxRedirects){z(i,d,"Maximum redirects exceeded");return}d.abort();let _;try{_=new br(v,t)}catch{let B=new SyntaxError(`Invalid URL: ${v}`);ss(i,B);return}En(i,_,e,s)}else i.emit("unexpected-response",d,y)||z(i,d,`Unexpected server response: ${y.statusCode}`)}),d.on("upgrade",(y,v,S)=>{if(i.emit("upgrade",y),i.readyState!==O.CONNECTING)return;if(d=i._req=null,y.headers.upgrade.toLowerCase()!=="websocket"){z(i,v,"Invalid Upgrade header");return}let _=Lc("sha1").update(c+Fc).digest("base64");if(y.headers["sec-websocket-accept"]!==_){z(i,v,"Invalid Sec-WebSocket-Accept header");return}let U=y.headers["sec-websocket-protocol"],B;if(U!==void 0?f.size?f.has(U)||(B="Server sent an invalid subprotocol"):B="Server sent a subprotocol but none was requested":f.size&&(B="Server sent no subprotocol"),B){z(i,v,B);return}U&&(i._protocol=U);let gt=y.headers["sec-websocket-extensions"];if(gt!==void 0){if(!m){z(i,v,"Server sent a Sec-WebSocket-Extensions header but no extension was requested");return}let xe;try{xe=Wc(gt)}catch{z(i,v,"Invalid Sec-WebSocket-Extensions header");return}let bt=Object.keys(xe);if(bt.length!==1||bt[0]!==ye.extensionName){z(i,v,"Server indicated an extension that was not requested");return}try{m.accept(xe[ye.extensionName])}catch{z(i,v,"Invalid Sec-WebSocket-Extensions header");return}i._extensions[ye.extensionName]=m}i.setSocket(v,S,{allowSynchronousEvents:r.allowSynchronousEvents,generateMask:r.generateMask,maxPayload:r.maxPayload,skipUTF8Validation:r.skipUTF8Validation})}),r.finishRequest?r.finishRequest(d,i):d.end()}function ss(i,t){i._readyState=O.CLOSING,i.emit("error",t),i.emitClose()}function Kc(i){return i.path=i.socketPath,Tn.connect(i)}function Gc(i){return i.path=void 0,!i.servername&&i.servername!==""&&(i.servername=Tn.isIP(i.host)?"":i.host),Oc.connect(i)}function z(i,t,e){i._readyState=O.CLOSING;let s=new Error(e);Error.captureStackTrace(s,z),t.setHeader?(t[An]=!0,t.abort(),t.socket&&!t.socket.destroyed&&t.socket.destroy(),process.nextTick(ss,i,s)):(t.destroy(s),t.once("error",i.emit.bind(i,"error")),t.once("close",i.emitClose.bind(i)))}function wr(i,t,e){if(t){let s=Vc(t).length;i._socket?i._sender._bufferedBytes+=s:i._bufferedAmount+=s}if(e){let s=new Error(`WebSocket is not open: readyState ${i.readyState} (${le[i.readyState]})`);process.nextTick(e,s)}}function Xc(i,t){let e=this[j];e._closeFrameReceived=!0,e._closeMessage=t,e._closeCode=i,e._socket[j]!==void 0&&(e._socket.removeListener("data",rs),process.nextTick(Cn,e._socket),i===1005?e.close():e.close(i,t))}function Jc(){let i=this[j];i.isPaused||i._socket.resume()}function Yc(i){let t=this[j];t._socket[j]!==void 0&&(t._socket.removeListener("data",rs),process.nextTick(Cn,t._socket),t.close(i[jc])),t.emit("error",i)}function wn(){this[j].emitClose()}function Qc(i,t){this[j].emit("message",i,t)}function Zc(i){let t=this[j];t.pong(i,!t._isServer,Sn),t.emit("ping",i)}function eh(i){this[j].emit("pong",i)}function Cn(i){i.resume()}function In(){let i=this[j];this.removeListener("close",In),this.removeListener("data",rs),this.removeListener("end",kn),i._readyState=O.CLOSING;let t;!this._readableState.endEmitted&&!i._closeFrameReceived&&!i._receiver._writableState.errorEmitted&&(t=i._socket.read())!==null&&i._receiver.write(t),i._receiver.end(),this[j]=void 0,clearTimeout(i._closeTimer),i._receiver._writableState.finished||i._receiver._writableState.errorEmitted?i.emitClose():(i._receiver.on("error",wn),i._receiver.on("finish",wn))}function rs(i){this[j]._receiver.write(i)||this.pause()}function kn(){let i=this[j];i._readyState=O.CLOSING,i._receiver.end(),this.end()}function Nn(){let i=this[j];this.removeListener("error",Nn),this.on("error",Sn),i&&(i._readyState=O.CLOSING,this.destroy())}});var Mn=A((vp,On)=>{"use strict";var{tokenChars:th}=pt();function sh(i){let t=new Set,e=-1,s=-1,r=0;for(r;r<i.length;r++){let n=i.charCodeAt(r);if(s===-1&&th[n]===1)e===-1&&(e=r);else if(r!==0&&(n===32||n===9))s===-1&&e!==-1&&(s=r);else if(n===44){if(e===-1)throw new SyntaxError(`Unexpected character at index ${r}`);s===-1&&(s=r);let o=i.slice(e,s);if(t.has(o))throw new SyntaxError(`The "${o}" subprotocol is duplicated`);t.add(o),e=s=-1}else throw new SyntaxError(`Unexpected character at index ${r}`)}if(e===-1||s!==-1)throw new SyntaxError("Unexpected end of input");let a=i.slice(e,r);if(t.has(a))throw new SyntaxError(`The "${a}" subprotocol is duplicated`);return t.add(a),t}On.exports={parse:sh}});var Un=A((Tp,jn)=>{"use strict";var rh=require("events"),is=require("http"),{Duplex:wp}=require("stream"),{createHash:ih}=require("crypto"),Ln=gr(),Se=ht(),ah=Mn(),nh=Tr(),{GUID:oh,kWebSocket:uh}=de(),lh=/^[+/0-9A-Za-z]{22}==$/,Dn=0,Bn=1,Rn=2,Sr=class extends rh{constructor(t,e){if(super(),t={allowSynchronousEvents:!1,maxPayload:100*1024*1024,skipUTF8Validation:!1,perMessageDeflate:!1,handleProtocols:null,clientTracking:!0,verifyClient:null,noServer:!1,backlog:null,server:null,host:null,path:null,port:null,WebSocket:nh,...t},t.port==null&&!t.server&&!t.noServer||t.port!=null&&(t.server||t.noServer)||t.server&&t.noServer)throw new TypeError('One and only one of the "port", "server", or "noServer" options must be specified');if(t.port!=null?(this._server=is.createServer((s,r)=>{let a=is.STATUS_CODES[426];r.writeHead(426,{"Content-Length":a.length,"Content-Type":"text/plain"}),r.end(a)}),this._server.listen(t.port,t.host,t.backlog,e)):t.server&&(this._server=t.server),this._server){let s=this.emit.bind(this,"connection");this._removeListeners=ch(this._server,{listening:this.emit.bind(this,"listening"),error:this.emit.bind(this,"error"),upgrade:(r,a,n)=>{this.handleUpgrade(r,a,n,s)}})}t.perMessageDeflate===!0&&(t.perMessageDeflate={}),t.clientTracking&&(this.clients=new Set,this._shouldEmitClose=!1),this.options=t,this._state=Dn}address(){if(this.options.noServer)throw new Error('The server is operating in "noServer" mode');return this._server?this._server.address():null}close(t){if(this._state===Rn){t&&this.once("close",()=>{t(new Error("The server is not running"))}),process.nextTick(yt,this);return}if(t&&this.once("close",t),this._state!==Bn)if(this._state=Bn,this.options.noServer||this.options.server)this._server&&(this._removeListeners(),this._removeListeners=this._server=null),this.clients?this.clients.size?this._shouldEmitClose=!0:process.nextTick(yt,this):process.nextTick(yt,this);else{let e=this._server;this._removeListeners(),this._removeListeners=this._server=null,e.close(()=>{yt(this)})}}shouldHandle(t){if(this.options.path){let e=t.url.indexOf("?");if((e!==-1?t.url.slice(0,e):t.url)!==this.options.path)return!1}return!0}handleUpgrade(t,e,s,r){e.on("error",Fn);let a=t.headers["sec-websocket-key"],n=+t.headers["sec-websocket-version"];if(t.method!=="GET"){Ae(this,t,e,405,"Invalid HTTP method");return}if(t.headers.upgrade.toLowerCase()!=="websocket"){Ae(this,t,e,400,"Invalid Upgrade header");return}if(!a||!lh.test(a)){Ae(this,t,e,400,"Missing or invalid Sec-WebSocket-Key header");return}if(n!==8&&n!==13){Ae(this,t,e,400,"Missing or invalid Sec-WebSocket-Version header");return}if(!this.shouldHandle(t)){xt(e,400);return}let o=t.headers["sec-websocket-protocol"],u=new Set;if(o!==void 0)try{u=ah.parse(o)}catch{Ae(this,t,e,400,"Invalid Sec-WebSocket-Protocol header");return}let l=t.headers["sec-websocket-extensions"],c={};if(this.options.perMessageDeflate&&l!==void 0){let p=new Se(this.options.perMessageDeflate,!0,this.options.maxPayload);try{let f=Ln.parse(l);f[Se.extensionName]&&(p.accept(f[Se.extensionName]),c[Se.extensionName]=p)}catch{Ae(this,t,e,400,"Invalid or unacceptable Sec-WebSocket-Extensions header");return}}if(this.options.verifyClient){let p={origin:t.headers[`${n===8?"sec-websocket-origin":"origin"}`],secure:!!(t.socket.authorized||t.socket.encrypted),req:t};if(this.options.verifyClient.length===2){this.options.verifyClient(p,(f,m,d,y)=>{if(!f)return xt(e,m||401,d,y);this.completeUpgrade(c,a,u,t,e,s,r)});return}if(!this.options.verifyClient(p))return xt(e,401)}this.completeUpgrade(c,a,u,t,e,s,r)}completeUpgrade(t,e,s,r,a,n,o){if(!a.readable||!a.writable)return a.destroy();if(a[uh])throw new Error("server.handleUpgrade() was called more than once with the same socket, possibly due to a misconfiguration");if(this._state>Dn)return xt(a,503);let l=["HTTP/1.1 101 Switching Protocols","Upgrade: websocket","Connection: Upgrade",`Sec-WebSocket-Accept: ${ih("sha1").update(e+oh).digest("base64")}`],c=new this.options.WebSocket(null);if(s.size){let p=this.options.handleProtocols?this.options.handleProtocols(s,r):s.values().next().value;p&&(l.push(`Sec-WebSocket-Protocol: ${p}`),c._protocol=p)}if(t[Se.extensionName]){let p=t[Se.extensionName].params,f=Ln.format({[Se.extensionName]:[p]});l.push(`Sec-WebSocket-Extensions: ${f}`),c._extensions=t}this.emit("headers",l,r),a.write(l.concat(`\r
16
+ `),cooked:a===null?null:a.slice(1,l)},o.tail=u,this.next();let p=this.finishNode(o,"TemplateElement");return this.resetEndLocation(p,V(this.state.lastTokEndLoc,l)),p}parseTemplate(t){let e=this.startNode();e.expressions=[];let s=this.parseTemplateElement(t);for(e.quasis=[s];!s.tail;)e.expressions.push(this.parseTemplateSubstitution()),this.readTemplateContinuation(),e.quasis.push(s=this.parseTemplateElement(t));return this.finishNode(e,"TemplateLiteral")}parseTemplateSubstitution(){return this.parseExpression()}parseObjectLike(t,e,s,r){s&&this.expectPlugin("recordAndTuple");let a=this.state.inFSharpPipelineDirectBody;this.state.inFSharpPipelineDirectBody=!1;let n=Object.create(null),o=!0,u=this.startNode();for(u.properties=[],this.next();!this.match(t);){if(o)o=!1;else if(this.expect(12),this.match(t)){this.addTrailingCommaExtraToNode(u);break}let c;e?c=this.parseBindingProperty():(c=this.parsePropertyDefinition(r),this.checkProto(c,s,n,r)),s&&!this.isObjectProperty(c)&&c.type!=="SpreadElement"&&this.raise(h.InvalidRecordProperty,{at:c}),c.shorthand&&this.addExtra(c,"shorthand",!0),u.properties.push(c)}this.next(),this.state.inFSharpPipelineDirectBody=a;let l="ObjectExpression";return e?l="ObjectPattern":s&&(l="RecordExpression"),this.finishNode(u,l)}addTrailingCommaExtraToNode(t){this.addExtra(t,"trailingComma",this.state.lastTokStart),this.addExtra(t,"trailingCommaLoc",this.state.lastTokStartLoc,!1)}maybeAsyncOrAccessorProp(t){return!t.computed&&t.key.type==="Identifier"&&(this.isLiteralPropertyName()||this.match(0)||this.match(55))}parsePropertyDefinition(t){let e=[];if(this.match(26))for(this.hasPlugin("decorators")&&this.raise(h.UnsupportedPropertyDecorator,{at:this.state.startLoc});this.match(26);)e.push(this.parseDecorator());let s=this.startNode(),r=!1,a=!1,n;if(this.match(21))return e.length&&this.unexpected(),this.parseSpread();e.length&&(s.decorators=e,e=[]),s.method=!1,t&&(n=this.state.startLoc);let o=this.eat(55);this.parsePropertyNamePrefixOperator(s);let u=this.state.containsEsc,l=this.parsePropertyName(s,t);if(!o&&!u&&this.maybeAsyncOrAccessorProp(s)){let c=l.name;c==="async"&&!this.hasPrecedingLineBreak()&&(r=!0,this.resetPreviousNodeTrailingComments(l),o=this.eat(55),this.parsePropertyName(s)),(c==="get"||c==="set")&&(a=!0,this.resetPreviousNodeTrailingComments(l),s.kind=c,this.match(55)&&(o=!0,this.raise(h.AccessorIsGenerator,{at:this.state.curPosition(),kind:c}),this.next()),this.parsePropertyName(s))}return this.parseObjPropValue(s,n,o,r,!1,a,t)}getGetterSetterExpectedParamCount(t){return t.kind==="get"?0:1}getObjectOrClassMethodParams(t){return t.params}checkGetterSetterParams(t){var e;let s=this.getGetterSetterExpectedParamCount(t),r=this.getObjectOrClassMethodParams(t);r.length!==s&&this.raise(t.kind==="get"?h.BadGetterArity:h.BadSetterArity,{at:t}),t.kind==="set"&&((e=r[r.length-1])==null?void 0:e.type)==="RestElement"&&this.raise(h.BadSetterRestParameter,{at:t})}parseObjectMethod(t,e,s,r,a){if(a){let n=this.parseMethod(t,e,!1,!1,!1,"ObjectMethod");return this.checkGetterSetterParams(n),n}if(s||e||this.match(10))return r&&this.unexpected(),t.kind="method",t.method=!0,this.parseMethod(t,e,s,!1,!1,"ObjectMethod")}parseObjectProperty(t,e,s,r){if(t.shorthand=!1,this.eat(14))return t.value=s?this.parseMaybeDefault(this.state.startLoc):this.parseMaybeAssignAllowIn(r),this.finishNode(t,"ObjectProperty");if(!t.computed&&t.key.type==="Identifier"){if(this.checkReservedWord(t.key.name,t.key.loc.start,!0,!1),s)t.value=this.parseMaybeDefault(e,ne(t.key));else if(this.match(29)){let a=this.state.startLoc;r!=null?r.shorthandAssignLoc===null&&(r.shorthandAssignLoc=a):this.raise(h.InvalidCoverInitializedName,{at:a}),t.value=this.parseMaybeDefault(e,ne(t.key))}else t.value=ne(t.key);return t.shorthand=!0,this.finishNode(t,"ObjectProperty")}}parseObjPropValue(t,e,s,r,a,n,o){let u=this.parseObjectMethod(t,s,r,a,n)||this.parseObjectProperty(t,e,a,o);return u||this.unexpected(),u}parsePropertyName(t,e){if(this.eat(0))t.computed=!0,t.key=this.parseMaybeAssignAllowIn(),this.expect(3);else{let{type:s,value:r}=this.state,a;if(X(s))a=this.parseIdentifier(!0);else switch(s){case 134:a=this.parseNumericLiteral(r);break;case 133:a=this.parseStringLiteral(r);break;case 135:a=this.parseBigIntLiteral(r);break;case 136:a=this.parseDecimalLiteral(r);break;case 138:{let n=this.state.startLoc;e!=null?e.privateKeyLoc===null&&(e.privateKeyLoc=n):this.raise(h.UnexpectedPrivateField,{at:n}),a=this.parsePrivateName();break}default:this.unexpected()}t.key=a,s!==138&&(t.computed=!1)}return t.key}initFunction(t,e){t.id=null,t.generator=!1,t.async=e}parseMethod(t,e,s,r,a,n,o=!1){this.initFunction(t,s),t.generator=e,this.scope.enter(18|(o?64:0)|(a?32:0)),this.prodParam.enter(Ut(s,t.generator)),this.parseFunctionParams(t,r);let u=this.parseFunctionBodyAndFinish(t,n,!0);return this.prodParam.exit(),this.scope.exit(),u}parseArrayLike(t,e,s,r){s&&this.expectPlugin("recordAndTuple");let a=this.state.inFSharpPipelineDirectBody;this.state.inFSharpPipelineDirectBody=!1;let n=this.startNode();return this.next(),n.elements=this.parseExprList(t,!s,r,n),this.state.inFSharpPipelineDirectBody=a,this.finishNode(n,s?"TupleExpression":"ArrayExpression")}parseArrowExpression(t,e,s,r){this.scope.enter(6);let a=Ut(s,!1);!this.match(5)&&this.prodParam.hasIn&&(a|=8),this.prodParam.enter(a),this.initFunction(t,s);let n=this.state.maybeInArrowParameters;return e&&(this.state.maybeInArrowParameters=!0,this.setArrowFunctionParameters(t,e,r)),this.state.maybeInArrowParameters=!1,this.parseFunctionBody(t,!0),this.prodParam.exit(),this.scope.exit(),this.state.maybeInArrowParameters=n,this.finishNode(t,"ArrowFunctionExpression")}setArrowFunctionParameters(t,e,s){this.toAssignableList(e,s,!1),t.params=e}parseFunctionBodyAndFinish(t,e,s=!1){return this.parseFunctionBody(t,!1,s),this.finishNode(t,e)}parseFunctionBody(t,e,s=!1){let r=e&&!this.match(5);if(this.expressionScope.enter(Ma()),r)t.body=this.parseMaybeAssign(),this.checkParams(t,!1,e,!1);else{let a=this.state.strict,n=this.state.labels;this.state.labels=[],this.prodParam.enter(this.prodParam.currentFlags()|4),t.body=this.parseBlock(!0,!1,o=>{let u=!this.isSimpleParamList(t.params);o&&u&&this.raise(h.IllegalLanguageModeDirective,{at:(t.kind==="method"||t.kind==="constructor")&&t.key?t.key.loc.end:t});let l=!a&&this.state.strict;this.checkParams(t,!this.state.strict&&!e&&!s&&!u,e,l),this.state.strict&&t.id&&this.checkIdentifier(t.id,65,l)}),this.prodParam.exit(),this.state.labels=n}this.expressionScope.exit()}isSimpleParameter(t){return t.type==="Identifier"}isSimpleParamList(t){for(let e=0,s=t.length;e<s;e++)if(!this.isSimpleParameter(t[e]))return!1;return!0}checkParams(t,e,s,r=!0){let a=!e&&new Set,n={type:"FormalParameters"};for(let o of t.params)this.checkLVal(o,{in:n,binding:5,checkClashes:a,strictModeChanged:r})}parseExprList(t,e,s,r){let a=[],n=!0;for(;!this.eat(t);){if(n)n=!1;else if(this.expect(12),this.match(t)){r&&this.addTrailingCommaExtraToNode(r),this.next();break}a.push(this.parseExprListItem(e,s))}return a}parseExprListItem(t,e,s){let r;if(this.match(12))t||this.raise(h.UnexpectedToken,{at:this.state.curPosition(),unexpected:","}),r=null;else if(this.match(21)){let a=this.state.startLoc;r=this.parseParenItem(this.parseSpread(e),a)}else if(this.match(17)){this.expectPlugin("partialApplication"),s||this.raise(h.UnexpectedArgumentPlaceholder,{at:this.state.startLoc});let a=this.startNode();this.next(),r=this.finishNode(a,"ArgumentPlaceholder")}else r=this.parseMaybeAssignAllowIn(e,this.parseParenItem);return r}parseIdentifier(t){let e=this.startNode(),s=this.parseIdentifierName(t);return this.createIdentifier(e,s)}createIdentifier(t,e){return t.name=e,t.loc.identifierName=e,this.finishNode(t,"Identifier")}parseIdentifierName(t){let e,{startLoc:s,type:r}=this.state;X(r)?e=this.state.value:this.unexpected();let a=qu(r);return t?a&&this.replaceToken(132):this.checkReservedWord(e,s,a,!1),this.next(),e}checkReservedWord(t,e,s,r){if(t.length>10||!ol(t))return;if(s&&il(t)){this.raise(h.UnexpectedKeyword,{at:e,keyword:t});return}if((this.state.strict?r?Ia:Ea:Aa)(t,this.inModule)){this.raise(h.UnexpectedReservedWord,{at:e,reservedWord:t});return}else if(t==="yield"){if(this.prodParam.hasYield){this.raise(h.YieldBindingIdentifier,{at:e});return}}else if(t==="await"){if(this.prodParam.hasAwait){this.raise(h.AwaitBindingIdentifier,{at:e});return}if(this.scope.inStaticBlock){this.raise(h.AwaitBindingIdentifierInStaticBlock,{at:e});return}this.expressionScope.recordAsyncArrowParametersError({at:e})}else if(t==="arguments"&&this.scope.inClassAndNotInNonArrowFunction){this.raise(h.ArgumentsInClass,{at:e});return}}isAwaitAllowed(){return!!(this.prodParam.hasAwait||this.options.allowAwaitOutsideFunction&&!this.scope.inFunction)}parseAwait(t){let e=this.startNodeAt(t);return this.expressionScope.recordParameterInitializerError(h.AwaitExpressionFormalParameter,{at:e}),this.eat(55)&&this.raise(h.ObsoleteAwaitStar,{at:e}),!this.scope.inFunction&&!this.options.allowAwaitOutsideFunction&&(this.isAmbiguousAwait()?this.ambiguousScriptDifferentAst=!0:this.sawUnambiguousESM=!0),this.state.soloAwait||(e.argument=this.parseMaybeUnary(null,!0)),this.finishNode(e,"AwaitExpression")}isAmbiguousAwait(){if(this.hasPrecedingLineBreak())return!0;let{type:t}=this.state;return t===53||t===10||t===0||Wt(t)||t===102&&!this.state.containsEsc||t===137||t===56||this.hasPlugin("v8intrinsic")&&t===54}parseYield(){let t=this.startNode();this.expressionScope.recordParameterInitializerError(h.YieldInParameter,{at:t}),this.next();let e=!1,s=null;if(!this.hasPrecedingLineBreak())switch(e=this.eat(55),this.state.type){case 13:case 139:case 8:case 11:case 3:case 9:case 14:case 12:if(!e)break;default:s=this.parseMaybeAssign()}return t.delegate=e,t.argument=s,this.finishNode(t,"YieldExpression")}parseImportCall(t){return this.next(),t.source=this.parseMaybeAssignAllowIn(),(this.hasPlugin("importAttributes")||this.hasPlugin("importAssertions"))&&(t.options=null),this.eat(12)&&(this.expectImportAttributesPlugin(),this.match(11)||(t.options=this.parseMaybeAssignAllowIn(),this.eat(12))),this.expect(11),this.finishNode(t,"ImportExpression")}checkPipelineAtInfixOperator(t,e){this.hasPlugin(["pipelineOperator",{proposal:"smart"}])&&t.type==="SequenceExpression"&&this.raise(h.PipelineHeadSequenceExpression,{at:e})}parseSmartPipelineBodyInStyle(t,e){if(this.isSimpleReference(t)){let s=this.startNodeAt(e);return s.callee=t,this.finishNode(s,"PipelineBareFunction")}else{let s=this.startNodeAt(e);return this.checkSmartPipeTopicBodyEarlyErrors(e),s.expression=t,this.finishNode(s,"PipelineTopicExpression")}}isSimpleReference(t){switch(t.type){case"MemberExpression":return!t.computed&&this.isSimpleReference(t.object);case"Identifier":return!0;default:return!1}}checkSmartPipeTopicBodyEarlyErrors(t){if(this.match(19))throw this.raise(h.PipelineBodyNoArrow,{at:this.state.startLoc});this.topicReferenceWasUsedInCurrentContext()||this.raise(h.PipelineTopicUnused,{at:t})}withTopicBindingContext(t){let e=this.state.topicContext;this.state.topicContext={maxNumOfResolvableTopics:1,maxTopicIndex:null};try{return t()}finally{this.state.topicContext=e}}withSmartMixTopicForbiddingContext(t){if(this.hasPlugin(["pipelineOperator",{proposal:"smart"}])){let e=this.state.topicContext;this.state.topicContext={maxNumOfResolvableTopics:0,maxTopicIndex:null};try{return t()}finally{this.state.topicContext=e}}else return t()}withSoloAwaitPermittingContext(t){let e=this.state.soloAwait;this.state.soloAwait=!0;try{return t()}finally{this.state.soloAwait=e}}allowInAnd(t){let e=this.prodParam.currentFlags();if(8&~e){this.prodParam.enter(e|8);try{return t()}finally{this.prodParam.exit()}}return t()}disallowInAnd(t){let e=this.prodParam.currentFlags();if(8&e){this.prodParam.enter(e&-9);try{return t()}finally{this.prodParam.exit()}}return t()}registerTopicReference(){this.state.topicContext.maxTopicIndex=0}topicReferenceIsAllowedInCurrentContext(){return this.state.topicContext.maxNumOfResolvableTopics>=1}topicReferenceWasUsedInCurrentContext(){return this.state.topicContext.maxTopicIndex!=null&&this.state.topicContext.maxTopicIndex>=0}parseFSharpPipelineBody(t){let e=this.state.startLoc;this.state.potentialArrowAt=this.state.start;let s=this.state.inFSharpPipelineDirectBody;this.state.inFSharpPipelineDirectBody=!0;let r=this.parseExprOp(this.parseMaybeUnaryOrPrivate(),e,t);return this.state.inFSharpPipelineDirectBody=s,r}parseModuleExpression(){this.expectPlugin("moduleBlocks");let t=this.startNode();this.next(),this.match(5)||this.unexpected(null,5);let e=this.startNodeAt(this.state.endLoc);this.next();let s=this.initializeScopes(!0);this.enterInitialScopes();try{t.body=this.parseProgram(e,8,"module")}finally{s()}return this.finishNode(t,"ModuleExpression")}parsePropertyNamePrefixOperator(t){}},Es={kind:"loop"},Wl={kind:"switch"},Vl=/[\uD800-\uDFFF]/u,Cs=/in(?:stanceof)?/y;function zl(i,t){for(let e=0;e<i.length;e++){let s=i[e],{type:r}=s;if(typeof r=="number"){{if(r===138){let{loc:a,start:n,value:o,end:u}=s,l=n+1,c=V(a.start,1);i.splice(e,1,new Q({type:se(27),value:"#",start:n,end:l,startLoc:a.start,endLoc:c}),new Q({type:se(132),value:o,start:l,end:u,startLoc:c,endLoc:a.end})),e++;continue}if(Wt(r)){let{loc:a,start:n,value:o,end:u}=s,l=n+1,c=V(a.start,1),p;t.charCodeAt(n)===96?p=new Q({type:se(22),value:"`",start:n,end:l,startLoc:a.start,endLoc:c}):p=new Q({type:se(8),value:"}",start:n,end:l,startLoc:a.start,endLoc:c});let f,m,d,y;r===24?(m=u-1,d=V(a.end,-1),f=o===null?null:o.slice(1,-1),y=new Q({type:se(22),value:"`",start:m,end:u,startLoc:d,endLoc:a.end})):(m=u-2,d=V(a.end,-2),f=o===null?null:o.slice(1,-2),y=new Q({type:se(23),value:"${",start:m,end:u,startLoc:d,endLoc:a.end})),i.splice(e,1,p,new Q({type:se(20),value:f,start:l,end:m,startLoc:c,endLoc:d}),y),e+=2;continue}}s.type=se(r)}}return i}var Ks=class extends Hs{parseTopLevel(t,e){return t.program=this.parseProgram(e),t.comments=this.state.comments,this.options.tokens&&(t.tokens=zl(this.tokens,this.input)),this.finishNode(t,"File")}parseProgram(t,e=139,s=this.options.sourceType){if(t.sourceType=s,t.interpreter=this.parseInterpreterDirective(),this.parseBlockBody(t,!0,!0,e),this.inModule&&!this.options.allowUndeclaredExports&&this.scope.undefinedExports.size>0)for(let[a,n]of Array.from(this.scope.undefinedExports))this.raise(h.ModuleExportUndefined,{at:n,localName:a});let r;return e===139?r=this.finishNode(t,"Program"):r=this.finishNodeAt(t,"Program",V(this.state.startLoc,-1)),r}stmtToDirective(t){let e=t;e.type="Directive",e.value=e.expression,delete e.expression;let s=e.value,r=s.value,a=this.input.slice(s.start,s.end),n=s.value=a.slice(1,-1);return this.addExtra(s,"raw",a),this.addExtra(s,"rawValue",n),this.addExtra(s,"expressionValue",r),s.type="DirectiveLiteral",e}parseInterpreterDirective(){if(!this.match(28))return null;let t=this.startNode();return t.value=this.state.value,this.next(),this.finishNode(t,"InterpreterDirective")}isLet(){return this.isContextual(100)?this.hasFollowingBindingAtom():!1}chStartsBindingIdentifier(t,e){if(ie(t)){if(Cs.lastIndex=e,Cs.test(this.input)){let s=this.codePointAtPos(Cs.lastIndex);if(!De(s)&&s!==92)return!1}return!0}else return t===92}chStartsBindingPattern(t){return t===91||t===123}hasFollowingBindingAtom(){let t=this.nextTokenStart(),e=this.codePointAtPos(t);return this.chStartsBindingPattern(e)||this.chStartsBindingIdentifier(e,t)}hasInLineFollowingBindingIdentifier(){let t=this.nextTokenInLineStart(),e=this.codePointAtPos(t);return this.chStartsBindingIdentifier(e,t)}startsUsingForOf(){let{type:t,containsEsc:e}=this.lookahead();if(t===102&&!e)return!1;if(k(t)&&!this.hasFollowingLineBreak())return this.expectPlugin("explicitResourceManagement"),!0}startsAwaitUsing(){let t=this.nextTokenInLineStart();if(this.isUnparsedContextual(t,"using")){t=this.nextTokenInLineStartSince(t+5);let e=this.codePointAtPos(t);if(this.chStartsBindingIdentifier(e,t))return this.expectPlugin("explicitResourceManagement"),!0}return!1}parseModuleItem(){return this.parseStatementLike(15)}parseStatementListItem(){return this.parseStatementLike(6|(!this.options.annexB||this.state.strict?0:8))}parseStatementOrSloppyAnnexBFunctionDeclaration(t=!1){let e=0;return this.options.annexB&&!this.state.strict&&(e|=4,t&&(e|=8)),this.parseStatementLike(e)}parseStatement(){return this.parseStatementLike(0)}parseStatementLike(t){let e=null;return this.match(26)&&(e=this.parseDecorators(!0)),this.parseStatementContent(t,e)}parseStatementContent(t,e){let s=this.state.type,r=this.startNode(),a=!!(t&2),n=!!(t&4),o=t&1;switch(s){case 60:return this.parseBreakContinueStatement(r,!0);case 63:return this.parseBreakContinueStatement(r,!1);case 64:return this.parseDebuggerStatement(r);case 90:return this.parseDoWhileStatement(r);case 91:return this.parseForStatement(r);case 68:if(this.lookaheadCharCode()===46)break;return n||this.raise(this.state.strict?h.StrictFunction:this.options.annexB?h.SloppyFunctionAnnexB:h.SloppyFunction,{at:this.state.startLoc}),this.parseFunctionStatement(r,!1,!a&&n);case 80:return a||this.unexpected(),this.parseClass(this.maybeTakeDecorators(e,r),!0);case 69:return this.parseIfStatement(r);case 70:return this.parseReturnStatement(r);case 71:return this.parseSwitchStatement(r);case 72:return this.parseThrowStatement(r);case 73:return this.parseTryStatement(r);case 96:if(!this.state.containsEsc&&this.startsAwaitUsing())return this.isAwaitAllowed()?a||this.raise(h.UnexpectedLexicalDeclaration,{at:r}):this.raise(h.AwaitUsingNotInAsyncContext,{at:r}),this.next(),this.parseVarStatement(r,"await using");break;case 107:if(this.state.containsEsc||!this.hasInLineFollowingBindingIdentifier())break;return this.expectPlugin("explicitResourceManagement"),!this.scope.inModule&&this.scope.inTopLevel?this.raise(h.UnexpectedUsingDeclaration,{at:this.state.startLoc}):a||this.raise(h.UnexpectedLexicalDeclaration,{at:this.state.startLoc}),this.parseVarStatement(r,"using");case 100:{if(this.state.containsEsc)break;let c=this.nextTokenStart(),p=this.codePointAtPos(c);if(p!==91&&(!a&&this.hasFollowingLineBreak()||!this.chStartsBindingIdentifier(p,c)&&p!==123))break}case 75:a||this.raise(h.UnexpectedLexicalDeclaration,{at:this.state.startLoc});case 74:{let c=this.state.value;return this.parseVarStatement(r,c)}case 92:return this.parseWhileStatement(r);case 76:return this.parseWithStatement(r);case 5:return this.parseBlock();case 13:return this.parseEmptyStatement(r);case 83:{let c=this.lookaheadCharCode();if(c===40||c===46)break}case 82:{!this.options.allowImportExportEverywhere&&!o&&this.raise(h.UnexpectedImportExport,{at:this.state.startLoc}),this.next();let c;return s===83?(c=this.parseImport(r),c.type==="ImportDeclaration"&&(!c.importKind||c.importKind==="value")&&(this.sawUnambiguousESM=!0)):(c=this.parseExport(r,e),(c.type==="ExportNamedDeclaration"&&(!c.exportKind||c.exportKind==="value")||c.type==="ExportAllDeclaration"&&(!c.exportKind||c.exportKind==="value")||c.type==="ExportDefaultDeclaration")&&(this.sawUnambiguousESM=!0)),this.assertModuleNodeAllowed(c),c}default:if(this.isAsyncFunction())return a||this.raise(h.AsyncFunctionInSingleStatementContext,{at:this.state.startLoc}),this.next(),this.parseFunctionStatement(r,!0,!a&&n)}let u=this.state.value,l=this.parseExpression();return k(s)&&l.type==="Identifier"&&this.eat(14)?this.parseLabeledStatement(r,u,l,t):this.parseExpressionStatement(r,l,e)}assertModuleNodeAllowed(t){!this.options.allowImportExportEverywhere&&!this.inModule&&this.raise(h.ImportOutsideModule,{at:t})}decoratorsEnabledBeforeExport(){return this.hasPlugin("decorators-legacy")?!0:this.hasPlugin("decorators")&&this.getPluginOption("decorators","decoratorsBeforeExport")!==!1}maybeTakeDecorators(t,e,s){return t&&(e.decorators&&e.decorators.length>0?(typeof this.getPluginOption("decorators","decoratorsBeforeExport")!="boolean"&&this.raise(h.DecoratorsBeforeAfterExport,{at:e.decorators[0]}),e.decorators.unshift(...t)):e.decorators=t,this.resetStartLocationFromNode(e,t[0]),s&&this.resetStartLocationFromNode(s,e)),e}canHaveLeadingDecorator(){return this.match(80)}parseDecorators(t){let e=[];do e.push(this.parseDecorator());while(this.match(26));if(this.match(82))t||this.unexpected(),this.decoratorsEnabledBeforeExport()||this.raise(h.DecoratorExportClass,{at:this.state.startLoc});else if(!this.canHaveLeadingDecorator())throw this.raise(h.UnexpectedLeadingDecorator,{at:this.state.startLoc});return e}parseDecorator(){this.expectOnePlugin(["decorators","decorators-legacy"]);let t=this.startNode();if(this.next(),this.hasPlugin("decorators")){let e=this.state.startLoc,s;if(this.match(10)){let r=this.state.startLoc;this.next(),s=this.parseExpression(),this.expect(11),s=this.wrapParenthesis(r,s);let a=this.state.startLoc;t.expression=this.parseMaybeDecoratorArguments(s),this.getPluginOption("decorators","allowCallParenthesized")===!1&&t.expression!==s&&this.raise(h.DecoratorArgumentsOutsideParentheses,{at:a})}else{for(s=this.parseIdentifier(!1);this.eat(16);){let r=this.startNodeAt(e);r.object=s,this.match(138)?(this.classScope.usePrivateName(this.state.value,this.state.startLoc),r.property=this.parsePrivateName()):r.property=this.parseIdentifier(!0),r.computed=!1,s=this.finishNode(r,"MemberExpression")}t.expression=this.parseMaybeDecoratorArguments(s)}}else t.expression=this.parseExprSubscripts();return this.finishNode(t,"Decorator")}parseMaybeDecoratorArguments(t){if(this.eat(10)){let e=this.startNodeAtNode(t);return e.callee=t,e.arguments=this.parseCallExpressionArguments(11,!1),this.toReferencedList(e.arguments),this.finishNode(e,"CallExpression")}return t}parseBreakContinueStatement(t,e){return this.next(),this.isLineTerminator()?t.label=null:(t.label=this.parseIdentifier(),this.semicolon()),this.verifyBreakContinue(t,e),this.finishNode(t,e?"BreakStatement":"ContinueStatement")}verifyBreakContinue(t,e){let s;for(s=0;s<this.state.labels.length;++s){let r=this.state.labels[s];if((t.label==null||r.name===t.label.name)&&(r.kind!=null&&(e||r.kind==="loop")||t.label&&e))break}if(s===this.state.labels.length){let r=e?"BreakStatement":"ContinueStatement";this.raise(h.IllegalBreakContinue,{at:t,type:r})}}parseDebuggerStatement(t){return this.next(),this.semicolon(),this.finishNode(t,"DebuggerStatement")}parseHeaderExpression(){this.expect(10);let t=this.parseExpression();return this.expect(11),t}parseDoWhileStatement(t){return this.next(),this.state.labels.push(Es),t.body=this.withSmartMixTopicForbiddingContext(()=>this.parseStatement()),this.state.labels.pop(),this.expect(92),t.test=this.parseHeaderExpression(),this.eat(13),this.finishNode(t,"DoWhileStatement")}parseForStatement(t){this.next(),this.state.labels.push(Es);let e=null;if(this.isAwaitAllowed()&&this.eatContextual(96)&&(e=this.state.lastTokStartLoc),this.scope.enter(0),this.expect(10),this.match(13))return e!==null&&this.unexpected(e),this.parseFor(t,null);let s=this.isContextual(100);{let u=this.isContextual(96)&&this.startsAwaitUsing(),l=u||this.isContextual(107)&&this.startsUsingForOf(),c=s&&this.hasFollowingBindingAtom()||l;if(this.match(74)||this.match(75)||c){let p=this.startNode(),f;u?(f="await using",this.isAwaitAllowed()||this.raise(h.AwaitUsingNotInAsyncContext,{at:this.state.startLoc}),this.next()):f=this.state.value,this.next(),this.parseVar(p,!0,f);let m=this.finishNode(p,"VariableDeclaration"),d=this.match(58);return d&&l&&this.raise(h.ForInUsing,{at:m}),(d||this.isContextual(102))&&m.declarations.length===1?this.parseForIn(t,m,e):(e!==null&&this.unexpected(e),this.parseFor(t,m))}}let r=this.isContextual(95),a=new Be,n=this.parseExpression(!0,a),o=this.isContextual(102);if(o&&(s&&this.raise(h.ForOfLet,{at:n}),e===null&&r&&n.type==="Identifier"&&this.raise(h.ForOfAsync,{at:n})),o||this.match(58)){this.checkDestructuringPrivate(a),this.toAssignable(n,!0);let u=o?"ForOfStatement":"ForInStatement";return this.checkLVal(n,{in:{type:u}}),this.parseForIn(t,n,e)}else this.checkExpressionErrors(a,!0);return e!==null&&this.unexpected(e),this.parseFor(t,n)}parseFunctionStatement(t,e,s){return this.next(),this.parseFunction(t,1|(s?2:0)|(e?8:0))}parseIfStatement(t){return this.next(),t.test=this.parseHeaderExpression(),t.consequent=this.parseStatementOrSloppyAnnexBFunctionDeclaration(),t.alternate=this.eat(66)?this.parseStatementOrSloppyAnnexBFunctionDeclaration():null,this.finishNode(t,"IfStatement")}parseReturnStatement(t){return!this.prodParam.hasReturn&&!this.options.allowReturnOutsideFunction&&this.raise(h.IllegalReturn,{at:this.state.startLoc}),this.next(),this.isLineTerminator()?t.argument=null:(t.argument=this.parseExpression(),this.semicolon()),this.finishNode(t,"ReturnStatement")}parseSwitchStatement(t){this.next(),t.discriminant=this.parseHeaderExpression();let e=t.cases=[];this.expect(5),this.state.labels.push(Wl),this.scope.enter(0);let s;for(let r;!this.match(8);)if(this.match(61)||this.match(65)){let a=this.match(61);s&&this.finishNode(s,"SwitchCase"),e.push(s=this.startNode()),s.consequent=[],this.next(),a?s.test=this.parseExpression():(r&&this.raise(h.MultipleDefaultsInSwitch,{at:this.state.lastTokStartLoc}),r=!0,s.test=null),this.expect(14)}else s?s.consequent.push(this.parseStatementListItem()):this.unexpected();return this.scope.exit(),s&&this.finishNode(s,"SwitchCase"),this.next(),this.state.labels.pop(),this.finishNode(t,"SwitchStatement")}parseThrowStatement(t){return this.next(),this.hasPrecedingLineBreak()&&this.raise(h.NewlineAfterThrow,{at:this.state.lastTokEndLoc}),t.argument=this.parseExpression(),this.semicolon(),this.finishNode(t,"ThrowStatement")}parseCatchClauseParam(){let t=this.parseBindingAtom();return this.scope.enter(this.options.annexB&&t.type==="Identifier"?8:0),this.checkLVal(t,{in:{type:"CatchClause"},binding:9}),t}parseTryStatement(t){if(this.next(),t.block=this.parseBlock(),t.handler=null,this.match(62)){let e=this.startNode();this.next(),this.match(10)?(this.expect(10),e.param=this.parseCatchClauseParam(),this.expect(11)):(e.param=null,this.scope.enter(0)),e.body=this.withSmartMixTopicForbiddingContext(()=>this.parseBlock(!1,!1)),this.scope.exit(),t.handler=this.finishNode(e,"CatchClause")}return t.finalizer=this.eat(67)?this.parseBlock():null,!t.handler&&!t.finalizer&&this.raise(h.NoCatchOrFinally,{at:t}),this.finishNode(t,"TryStatement")}parseVarStatement(t,e,s=!1){return this.next(),this.parseVar(t,!1,e,s),this.semicolon(),this.finishNode(t,"VariableDeclaration")}parseWhileStatement(t){return this.next(),t.test=this.parseHeaderExpression(),this.state.labels.push(Es),t.body=this.withSmartMixTopicForbiddingContext(()=>this.parseStatement()),this.state.labels.pop(),this.finishNode(t,"WhileStatement")}parseWithStatement(t){return this.state.strict&&this.raise(h.StrictWith,{at:this.state.startLoc}),this.next(),t.object=this.parseHeaderExpression(),t.body=this.withSmartMixTopicForbiddingContext(()=>this.parseStatement()),this.finishNode(t,"WithStatement")}parseEmptyStatement(t){return this.next(),this.finishNode(t,"EmptyStatement")}parseLabeledStatement(t,e,s,r){for(let n of this.state.labels)n.name===e&&this.raise(h.LabelRedeclaration,{at:s,labelName:e});let a=zu(this.state.type)?"loop":this.match(71)?"switch":null;for(let n=this.state.labels.length-1;n>=0;n--){let o=this.state.labels[n];if(o.statementStart===t.start)o.statementStart=this.state.start,o.kind=a;else break}return this.state.labels.push({name:e,kind:a,statementStart:this.state.start}),t.body=r&8?this.parseStatementOrSloppyAnnexBFunctionDeclaration(!0):this.parseStatement(),this.state.labels.pop(),t.label=s,this.finishNode(t,"LabeledStatement")}parseExpressionStatement(t,e,s){return t.expression=e,this.semicolon(),this.finishNode(t,"ExpressionStatement")}parseBlock(t=!1,e=!0,s){let r=this.startNode();return t&&this.state.strictErrors.clear(),this.expect(5),e&&this.scope.enter(0),this.parseBlockBody(r,t,!1,8,s),e&&this.scope.exit(),this.finishNode(r,"BlockStatement")}isValidDirective(t){return t.type==="ExpressionStatement"&&t.expression.type==="StringLiteral"&&!t.expression.extra.parenthesized}parseBlockBody(t,e,s,r,a){let n=t.body=[],o=t.directives=[];this.parseBlockOrModuleBlockBody(n,e?o:void 0,s,r,a)}parseBlockOrModuleBlockBody(t,e,s,r,a){let n=this.state.strict,o=!1,u=!1;for(;!this.match(r);){let l=s?this.parseModuleItem():this.parseStatementListItem();if(e&&!u){if(this.isValidDirective(l)){let c=this.stmtToDirective(l);e.push(c),!o&&c.value.value==="use strict"&&(o=!0,this.setStrict(!0));continue}u=!0,this.state.strictErrors.clear()}t.push(l)}a==null||a.call(this,o),n||this.setStrict(!1),this.next()}parseFor(t,e){return t.init=e,this.semicolon(!1),t.test=this.match(13)?null:this.parseExpression(),this.semicolon(!1),t.update=this.match(11)?null:this.parseExpression(),this.expect(11),t.body=this.withSmartMixTopicForbiddingContext(()=>this.parseStatement()),this.scope.exit(),this.state.labels.pop(),this.finishNode(t,"ForStatement")}parseForIn(t,e,s){let r=this.match(58);return this.next(),r?s!==null&&this.unexpected(s):t.await=s!==null,e.type==="VariableDeclaration"&&e.declarations[0].init!=null&&(!r||!this.options.annexB||this.state.strict||e.kind!=="var"||e.declarations[0].id.type!=="Identifier")&&this.raise(h.ForInOfLoopInitializer,{at:e,type:r?"ForInStatement":"ForOfStatement"}),e.type==="AssignmentPattern"&&this.raise(h.InvalidLhs,{at:e,ancestor:{type:"ForStatement"}}),t.left=e,t.right=r?this.parseExpression():this.parseMaybeAssignAllowIn(),this.expect(11),t.body=this.withSmartMixTopicForbiddingContext(()=>this.parseStatement()),this.scope.exit(),this.state.labels.pop(),this.finishNode(t,r?"ForInStatement":"ForOfStatement")}parseVar(t,e,s,r=!1){let a=t.declarations=[];for(t.kind=s;;){let n=this.startNode();if(this.parseVarId(n,s),n.init=this.eat(29)?e?this.parseMaybeAssignDisallowIn():this.parseMaybeAssignAllowIn():null,n.init===null&&!r&&(n.id.type!=="Identifier"&&!(e&&(this.match(58)||this.isContextual(102)))?this.raise(h.DeclarationMissingInitializer,{at:this.state.lastTokEndLoc,kind:"destructuring"}):s==="const"&&!(this.match(58)||this.isContextual(102))&&this.raise(h.DeclarationMissingInitializer,{at:this.state.lastTokEndLoc,kind:"const"})),a.push(this.finishNode(n,"VariableDeclarator")),!this.eat(12))break}return t}parseVarId(t,e){let s=this.parseBindingAtom();this.checkLVal(s,{in:{type:"VariableDeclarator"},binding:e==="var"?5:8201}),t.id=s}parseAsyncFunctionExpression(t){return this.parseFunction(t,8)}parseFunction(t,e=0){let s=e&2,r=!!(e&1),a=r&&!(e&4),n=!!(e&8);this.initFunction(t,n),this.match(55)&&(s&&this.raise(h.GeneratorInSingleStatementContext,{at:this.state.startLoc}),this.next(),t.generator=!0),r&&(t.id=this.parseFunctionId(a));let o=this.state.maybeInArrowParameters;return this.state.maybeInArrowParameters=!1,this.scope.enter(2),this.prodParam.enter(Ut(n,t.generator)),r||(t.id=this.parseFunctionId()),this.parseFunctionParams(t,!1),this.withSmartMixTopicForbiddingContext(()=>{this.parseFunctionBodyAndFinish(t,r?"FunctionDeclaration":"FunctionExpression")}),this.prodParam.exit(),this.scope.exit(),r&&!s&&this.registerFunctionStatementId(t),this.state.maybeInArrowParameters=o,t}parseFunctionId(t){return t||k(this.state.type)?this.parseIdentifier():null}parseFunctionParams(t,e){this.expect(10),this.expressionScope.enter(yl()),t.params=this.parseBindingList(11,41,2|(e?4:0)),this.expressionScope.exit()}registerFunctionStatementId(t){t.id&&this.scope.declareName(t.id.name,!this.options.annexB||this.state.strict||t.generator||t.async?this.scope.treatFunctionsAsVar?5:8201:17,t.id.loc.start)}parseClass(t,e,s){this.next();let r=this.state.strict;return this.state.strict=!0,this.parseClassId(t,e,s),this.parseClassSuper(t),t.body=this.parseClassBody(!!t.superClass,r),this.finishNode(t,e?"ClassDeclaration":"ClassExpression")}isClassProperty(){return this.match(29)||this.match(13)||this.match(8)}isClassMethod(){return this.match(10)}isNonstaticConstructor(t){return!t.computed&&!t.static&&(t.key.name==="constructor"||t.key.value==="constructor")}parseClassBody(t,e){this.classScope.enter();let s={hadConstructor:!1,hadSuperClass:t},r=[],a=this.startNode();if(a.body=[],this.expect(5),this.withSmartMixTopicForbiddingContext(()=>{for(;!this.match(8);){if(this.eat(13)){if(r.length>0)throw this.raise(h.DecoratorSemicolon,{at:this.state.lastTokEndLoc});continue}if(this.match(26)){r.push(this.parseDecorator());continue}let n=this.startNode();r.length&&(n.decorators=r,this.resetStartLocationFromNode(n,r[0]),r=[]),this.parseClassMember(a,n,s),n.kind==="constructor"&&n.decorators&&n.decorators.length>0&&this.raise(h.DecoratorConstructor,{at:n})}}),this.state.strict=e,this.next(),r.length)throw this.raise(h.TrailingDecorator,{at:this.state.startLoc});return this.classScope.exit(),this.finishNode(a,"ClassBody")}parseClassMemberFromModifier(t,e){let s=this.parseIdentifier(!0);if(this.isClassMethod()){let r=e;return r.kind="method",r.computed=!1,r.key=s,r.static=!1,this.pushClassMethod(t,r,!1,!1,!1,!1),!0}else if(this.isClassProperty()){let r=e;return r.computed=!1,r.key=s,r.static=!1,t.body.push(this.parseClassProperty(r)),!0}return this.resetPreviousNodeTrailingComments(s),!1}parseClassMember(t,e,s){let r=this.isContextual(106);if(r){if(this.parseClassMemberFromModifier(t,e))return;if(this.eat(5)){this.parseClassStaticBlock(t,e);return}}this.parseClassMemberWithIsStatic(t,e,s,r)}parseClassMemberWithIsStatic(t,e,s,r){let a=e,n=e,o=e,u=e,l=e,c=a,p=a;if(e.static=r,this.parsePropertyNamePrefixOperator(e),this.eat(55)){c.kind="method";let v=this.match(138);if(this.parseClassElementName(c),v){this.pushClassPrivateMethod(t,n,!0,!1);return}this.isNonstaticConstructor(a)&&this.raise(h.ConstructorIsGenerator,{at:a.key}),this.pushClassMethod(t,a,!0,!1,!1,!1);return}let f=k(this.state.type)&&!this.state.containsEsc,m=this.match(138),d=this.parseClassElementName(e),y=this.state.startLoc;if(this.parsePostMemberNameModifiers(p),this.isClassMethod()){if(c.kind="method",m){this.pushClassPrivateMethod(t,n,!1,!1);return}let v=this.isNonstaticConstructor(a),S=!1;v&&(a.kind="constructor",s.hadConstructor&&!this.hasPlugin("typescript")&&this.raise(h.DuplicateConstructor,{at:d}),v&&this.hasPlugin("typescript")&&e.override&&this.raise(h.OverrideOnConstructor,{at:d}),s.hadConstructor=!0,S=s.hadSuperClass),this.pushClassMethod(t,a,!1,!1,v,S)}else if(this.isClassProperty())m?this.pushClassPrivateProperty(t,u):this.pushClassProperty(t,o);else if(f&&d.name==="async"&&!this.isLineTerminator()){this.resetPreviousNodeTrailingComments(d);let v=this.eat(55);p.optional&&this.unexpected(y),c.kind="method";let S=this.match(138);this.parseClassElementName(c),this.parsePostMemberNameModifiers(p),S?this.pushClassPrivateMethod(t,n,v,!0):(this.isNonstaticConstructor(a)&&this.raise(h.ConstructorIsAsync,{at:a.key}),this.pushClassMethod(t,a,v,!0,!1,!1))}else if(f&&(d.name==="get"||d.name==="set")&&!(this.match(55)&&this.isLineTerminator())){this.resetPreviousNodeTrailingComments(d),c.kind=d.name;let v=this.match(138);this.parseClassElementName(a),v?this.pushClassPrivateMethod(t,n,!1,!1):(this.isNonstaticConstructor(a)&&this.raise(h.ConstructorIsAccessor,{at:a.key}),this.pushClassMethod(t,a,!1,!1,!1,!1)),this.checkGetterSetterParams(a)}else if(f&&d.name==="accessor"&&!this.isLineTerminator()){this.expectPlugin("decoratorAutoAccessors"),this.resetPreviousNodeTrailingComments(d);let v=this.match(138);this.parseClassElementName(o),this.pushClassAccessorProperty(t,l,v)}else this.isLineTerminator()?m?this.pushClassPrivateProperty(t,u):this.pushClassProperty(t,o):this.unexpected()}parseClassElementName(t){let{type:e,value:s}=this.state;if((e===132||e===133)&&t.static&&s==="prototype"&&this.raise(h.StaticPrototype,{at:this.state.startLoc}),e===138){s==="constructor"&&this.raise(h.ConstructorClassPrivateField,{at:this.state.startLoc});let r=this.parsePrivateName();return t.key=r,r}return this.parsePropertyName(t)}parseClassStaticBlock(t,e){var s;this.scope.enter(208);let r=this.state.labels;this.state.labels=[],this.prodParam.enter(0);let a=e.body=[];this.parseBlockOrModuleBlockBody(a,void 0,!1,8),this.prodParam.exit(),this.scope.exit(),this.state.labels=r,t.body.push(this.finishNode(e,"StaticBlock")),(s=e.decorators)!=null&&s.length&&this.raise(h.DecoratorStaticBlock,{at:e})}pushClassProperty(t,e){!e.computed&&(e.key.name==="constructor"||e.key.value==="constructor")&&this.raise(h.ConstructorClassField,{at:e.key}),t.body.push(this.parseClassProperty(e))}pushClassPrivateProperty(t,e){let s=this.parseClassPrivateProperty(e);t.body.push(s),this.classScope.declarePrivateName(this.getPrivateNameSV(s.key),0,s.key.loc.start)}pushClassAccessorProperty(t,e,s){if(!s&&!e.computed){let a=e.key;(a.name==="constructor"||a.value==="constructor")&&this.raise(h.ConstructorClassField,{at:a})}let r=this.parseClassAccessorProperty(e);t.body.push(r),s&&this.classScope.declarePrivateName(this.getPrivateNameSV(r.key),0,r.key.loc.start)}pushClassMethod(t,e,s,r,a,n){t.body.push(this.parseMethod(e,s,r,a,n,"ClassMethod",!0))}pushClassPrivateMethod(t,e,s,r){let a=this.parseMethod(e,s,r,!1,!1,"ClassPrivateMethod",!0);t.body.push(a);let n=a.kind==="get"?a.static?6:2:a.kind==="set"?a.static?5:1:0;this.declareClassPrivateMethodInScope(a,n)}declareClassPrivateMethodInScope(t,e){this.classScope.declarePrivateName(this.getPrivateNameSV(t.key),e,t.key.loc.start)}parsePostMemberNameModifiers(t){}parseClassPrivateProperty(t){return this.parseInitializer(t),this.semicolon(),this.finishNode(t,"ClassPrivateProperty")}parseClassProperty(t){return this.parseInitializer(t),this.semicolon(),this.finishNode(t,"ClassProperty")}parseClassAccessorProperty(t){return this.parseInitializer(t),this.semicolon(),this.finishNode(t,"ClassAccessorProperty")}parseInitializer(t){this.scope.enter(80),this.expressionScope.enter(Ma()),this.prodParam.enter(0),t.value=this.eat(29)?this.parseMaybeAssignAllowIn():null,this.expressionScope.exit(),this.prodParam.exit(),this.scope.exit()}parseClassId(t,e,s,r=8331){if(k(this.state.type))t.id=this.parseIdentifier(),e&&this.declareNameFromIdentifier(t.id,r);else if(s||!e)t.id=null;else throw this.raise(h.MissingClassName,{at:this.state.startLoc})}parseClassSuper(t){t.superClass=this.eat(81)?this.parseExprSubscripts():null}parseExport(t,e){let s=this.parseMaybeImportPhase(t,!0),r=this.maybeParseExportDefaultSpecifier(t,s),a=!r||this.eat(12),n=a&&this.eatExportStar(t),o=n&&this.maybeParseExportNamespaceSpecifier(t),u=a&&(!o||this.eat(12)),l=r||n;if(n&&!o){if(r&&this.unexpected(),e)throw this.raise(h.UnsupportedDecoratorExport,{at:t});return this.parseExportFrom(t,!0),this.finishNode(t,"ExportAllDeclaration")}let c=this.maybeParseExportNamedSpecifiers(t);r&&a&&!n&&!c&&this.unexpected(null,5),o&&u&&this.unexpected(null,98);let p;if(l||c){if(p=!1,e)throw this.raise(h.UnsupportedDecoratorExport,{at:t});this.parseExportFrom(t,l)}else p=this.maybeParseExportDeclaration(t);if(l||c||p){var f;let m=t;if(this.checkExport(m,!0,!1,!!m.source),((f=m.declaration)==null?void 0:f.type)==="ClassDeclaration")this.maybeTakeDecorators(e,m.declaration,m);else if(e)throw this.raise(h.UnsupportedDecoratorExport,{at:t});return this.finishNode(m,"ExportNamedDeclaration")}if(this.eat(65)){let m=t,d=this.parseExportDefaultExpression();if(m.declaration=d,d.type==="ClassDeclaration")this.maybeTakeDecorators(e,d,m);else if(e)throw this.raise(h.UnsupportedDecoratorExport,{at:t});return this.checkExport(m,!0,!0),this.finishNode(m,"ExportDefaultDeclaration")}this.unexpected(null,5)}eatExportStar(t){return this.eat(55)}maybeParseExportDefaultSpecifier(t,e){if(e||this.isExportDefaultSpecifier()){this.expectPlugin("exportDefaultFrom",e==null?void 0:e.loc.start);let s=e||this.parseIdentifier(!0),r=this.startNodeAtNode(s);return r.exported=s,t.specifiers=[this.finishNode(r,"ExportDefaultSpecifier")],!0}return!1}maybeParseExportNamespaceSpecifier(t){if(this.isContextual(93)){t.specifiers||(t.specifiers=[]);let e=this.startNodeAt(this.state.lastTokStartLoc);return this.next(),e.exported=this.parseModuleExportName(),t.specifiers.push(this.finishNode(e,"ExportNamespaceSpecifier")),!0}return!1}maybeParseExportNamedSpecifiers(t){if(this.match(5)){t.specifiers||(t.specifiers=[]);let e=t.exportKind==="type";return t.specifiers.push(...this.parseExportSpecifiers(e)),t.source=null,t.declaration=null,this.hasPlugin("importAssertions")&&(t.assertions=[]),!0}return!1}maybeParseExportDeclaration(t){return this.shouldParseExportDeclaration()?(t.specifiers=[],t.source=null,this.hasPlugin("importAssertions")&&(t.assertions=[]),t.declaration=this.parseExportDeclaration(t),!0):!1}isAsyncFunction(){if(!this.isContextual(95))return!1;let t=this.nextTokenInLineStart();return this.isUnparsedContextual(t,"function")}parseExportDefaultExpression(){let t=this.startNode();if(this.match(68))return this.next(),this.parseFunction(t,5);if(this.isAsyncFunction())return this.next(),this.next(),this.parseFunction(t,13);if(this.match(80))return this.parseClass(t,!0,!0);if(this.match(26))return this.hasPlugin("decorators")&&this.getPluginOption("decorators","decoratorsBeforeExport")===!0&&this.raise(h.DecoratorBeforeExport,{at:this.state.startLoc}),this.parseClass(this.maybeTakeDecorators(this.parseDecorators(!1),this.startNode()),!0,!0);if(this.match(75)||this.match(74)||this.isLet())throw this.raise(h.UnsupportedDefaultExport,{at:this.state.startLoc});let e=this.parseMaybeAssignAllowIn();return this.semicolon(),e}parseExportDeclaration(t){return this.match(80)?this.parseClass(this.startNode(),!0,!1):this.parseStatementListItem()}isExportDefaultSpecifier(){let{type:t}=this.state;if(k(t)){if(t===95&&!this.state.containsEsc||t===100)return!1;if((t===130||t===129)&&!this.state.containsEsc){let{type:r}=this.lookahead();if(k(r)&&r!==98||r===5)return this.expectOnePlugin(["flow","typescript"]),!1}}else if(!this.match(65))return!1;let e=this.nextTokenStart(),s=this.isUnparsedContextual(e,"from");if(this.input.charCodeAt(e)===44||k(this.state.type)&&s)return!0;if(this.match(65)&&s){let r=this.input.charCodeAt(this.nextTokenStartSince(e+4));return r===34||r===39}return!1}parseExportFrom(t,e){this.eatContextual(98)?(t.source=this.parseImportSource(),this.checkExport(t),this.maybeParseImportAttributes(t),this.checkJSONModuleImport(t)):e&&this.unexpected(),this.semicolon()}shouldParseExportDeclaration(){let{type:t}=this.state;return t===26&&(this.expectOnePlugin(["decorators","decorators-legacy"]),this.hasPlugin("decorators"))?(this.getPluginOption("decorators","decoratorsBeforeExport")===!0&&this.raise(h.DecoratorBeforeExport,{at:this.state.startLoc}),!0):t===74||t===75||t===68||t===80||this.isLet()||this.isAsyncFunction()}checkExport(t,e,s,r){if(e){var a;if(s){if(this.checkDuplicateExports(t,"default"),this.hasPlugin("exportDefaultFrom")){var n;let o=t.declaration;o.type==="Identifier"&&o.name==="from"&&o.end-o.start===4&&!((n=o.extra)!=null&&n.parenthesized)&&this.raise(h.ExportDefaultFromAsIdentifier,{at:o})}}else if((a=t.specifiers)!=null&&a.length)for(let o of t.specifiers){let{exported:u}=o,l=u.type==="Identifier"?u.name:u.value;if(this.checkDuplicateExports(o,l),!r&&o.local){let{local:c}=o;c.type!=="Identifier"?this.raise(h.ExportBindingIsString,{at:o,localName:c.value,exportName:l}):(this.checkReservedWord(c.name,c.loc.start,!0,!1),this.scope.checkLocalExport(c))}}else if(t.declaration){if(t.declaration.type==="FunctionDeclaration"||t.declaration.type==="ClassDeclaration"){let o=t.declaration.id;if(!o)throw new Error("Assertion failure");this.checkDuplicateExports(t,o.name)}else if(t.declaration.type==="VariableDeclaration")for(let o of t.declaration.declarations)this.checkDeclaration(o.id)}}}checkDeclaration(t){if(t.type==="Identifier")this.checkDuplicateExports(t,t.name);else if(t.type==="ObjectPattern")for(let e of t.properties)this.checkDeclaration(e);else if(t.type==="ArrayPattern")for(let e of t.elements)e&&this.checkDeclaration(e);else t.type==="ObjectProperty"?this.checkDeclaration(t.value):t.type==="RestElement"?this.checkDeclaration(t.argument):t.type==="AssignmentPattern"&&this.checkDeclaration(t.left)}checkDuplicateExports(t,e){this.exportedIdentifiers.has(e)&&(e==="default"?this.raise(h.DuplicateDefaultExport,{at:t}):this.raise(h.DuplicateExport,{at:t,exportName:e})),this.exportedIdentifiers.add(e)}parseExportSpecifiers(t){let e=[],s=!0;for(this.expect(5);!this.eat(8);){if(s)s=!1;else if(this.expect(12),this.eat(8))break;let r=this.isContextual(130),a=this.match(133),n=this.startNode();n.local=this.parseModuleExportName(),e.push(this.parseExportSpecifier(n,a,t,r))}return e}parseExportSpecifier(t,e,s,r){return this.eatContextual(93)?t.exported=this.parseModuleExportName():e?t.exported=Pl(t.local):t.exported||(t.exported=ne(t.local)),this.finishNode(t,"ExportSpecifier")}parseModuleExportName(){if(this.match(133)){let t=this.parseStringLiteral(this.state.value),e=t.value.match(Vl);return e&&this.raise(h.ModuleExportNameHasLoneSurrogate,{at:t,surrogateCharCode:e[0].charCodeAt(0)}),t}return this.parseIdentifier(!0)}isJSONModuleImport(t){return t.assertions!=null?t.assertions.some(({key:e,value:s})=>s.value==="json"&&(e.type==="Identifier"?e.name==="type":e.value==="type")):!1}checkImportReflection(t){let{specifiers:e}=t,s=e.length===1?e[0].type:null;if(t.phase==="source")s!=="ImportDefaultSpecifier"&&this.raise(h.SourcePhaseImportRequiresDefault,{at:e[0].loc.start});else if(t.phase==="defer")s!=="ImportNamespaceSpecifier"&&this.raise(h.DeferImportRequiresNamespace,{at:e[0].loc.start});else if(t.module){var r;s!=="ImportDefaultSpecifier"&&this.raise(h.ImportReflectionNotBinding,{at:e[0].loc.start}),((r=t.assertions)==null?void 0:r.length)>0&&this.raise(h.ImportReflectionHasAssertion,{at:t.specifiers[0].loc.start})}}checkJSONModuleImport(t){if(this.isJSONModuleImport(t)&&t.type!=="ExportAllDeclaration"){let{specifiers:e}=t;if(e!=null){let s=e.find(r=>{let a;if(r.type==="ExportSpecifier"?a=r.local:r.type==="ImportSpecifier"&&(a=r.imported),a!==void 0)return a.type==="Identifier"?a.name!=="default":a.value!=="default"});s!==void 0&&this.raise(h.ImportJSONBindingNotDefault,{at:s.loc.start})}}}isPotentialImportPhase(t){return t?!1:this.isContextual(105)||this.isContextual(97)||this.isContextual(127)}applyImportPhase(t,e,s,r){e||(s==="module"?(this.expectPlugin("importReflection",r),t.module=!0):this.hasPlugin("importReflection")&&(t.module=!1),s==="source"?(this.expectPlugin("sourcePhaseImports",r),t.phase="source"):s==="defer"?(this.expectPlugin("deferredImportEvaluation",r),t.phase="defer"):this.hasPlugin("sourcePhaseImports")&&(t.phase=null))}parseMaybeImportPhase(t,e){if(!this.isPotentialImportPhase(e))return this.applyImportPhase(t,e,null),null;let s=this.parseIdentifier(!0),{type:r}=this.state;return(X(r)?r!==98||this.lookaheadCharCode()===102:r!==12)?(this.resetPreviousIdentifierLeadingComments(s),this.applyImportPhase(t,e,s.name,s.loc.start),null):(this.applyImportPhase(t,e,null),s)}isPrecedingIdImportPhase(t){let{type:e}=this.state;return k(e)?e!==98||this.lookaheadCharCode()===102:e!==12}parseImport(t){return this.match(133)?this.parseImportSourceAndAttributes(t):this.parseImportSpecifiersAndAfter(t,this.parseMaybeImportPhase(t,!1))}parseImportSpecifiersAndAfter(t,e){t.specifiers=[];let r=!this.maybeParseDefaultImportSpecifier(t,e)||this.eat(12),a=r&&this.maybeParseStarImportSpecifier(t);return r&&!a&&this.parseNamedImportSpecifiers(t),this.expectContextual(98),this.parseImportSourceAndAttributes(t)}parseImportSourceAndAttributes(t){var e;return(e=t.specifiers)!=null||(t.specifiers=[]),t.source=this.parseImportSource(),this.maybeParseImportAttributes(t),this.checkImportReflection(t),this.checkJSONModuleImport(t),this.semicolon(),this.finishNode(t,"ImportDeclaration")}parseImportSource(){return this.match(133)||this.unexpected(),this.parseExprAtom()}parseImportSpecifierLocal(t,e,s){e.local=this.parseIdentifier(),t.specifiers.push(this.finishImportSpecifier(e,s))}finishImportSpecifier(t,e,s=8201){return this.checkLVal(t.local,{in:{type:e},binding:s}),this.finishNode(t,e)}parseImportAttributes(){this.expect(5);let t=[],e=new Set;do{if(this.match(8))break;let s=this.startNode(),r=this.state.value;if(e.has(r)&&this.raise(h.ModuleAttributesWithDuplicateKeys,{at:this.state.startLoc,key:r}),e.add(r),this.match(133)?s.key=this.parseStringLiteral(r):s.key=this.parseIdentifier(!0),this.expect(14),!this.match(133))throw this.raise(h.ModuleAttributeInvalidValue,{at:this.state.startLoc});s.value=this.parseStringLiteral(this.state.value),t.push(this.finishNode(s,"ImportAttribute"))}while(this.eat(12));return this.expect(8),t}parseModuleAttributes(){let t=[],e=new Set;do{let s=this.startNode();if(s.key=this.parseIdentifier(!0),s.key.name!=="type"&&this.raise(h.ModuleAttributeDifferentFromType,{at:s.key}),e.has(s.key.name)&&this.raise(h.ModuleAttributesWithDuplicateKeys,{at:s.key,key:s.key.name}),e.add(s.key.name),this.expect(14),!this.match(133))throw this.raise(h.ModuleAttributeInvalidValue,{at:this.state.startLoc});s.value=this.parseStringLiteral(this.state.value),t.push(this.finishNode(s,"ImportAttribute"))}while(this.eat(12));return t}maybeParseImportAttributes(t){let e,s=!1;if(this.match(76)){if(this.hasPrecedingLineBreak()&&this.lookaheadCharCode()===40)return;this.next(),this.hasPlugin("moduleAttributes")?e=this.parseModuleAttributes():(this.expectImportAttributesPlugin(),e=this.parseImportAttributes()),s=!0}else if(this.isContextual(94)&&!this.hasPrecedingLineBreak())this.hasPlugin("importAttributes")?(this.getPluginOption("importAttributes","deprecatedAssertSyntax")!==!0&&this.raise(h.ImportAttributesUseAssert,{at:this.state.startLoc}),this.addExtra(t,"deprecatedAssertSyntax",!0)):this.expectOnePlugin(["importAttributes","importAssertions"]),this.next(),e=this.parseImportAttributes();else if(this.hasPlugin("importAttributes")||this.hasPlugin("importAssertions"))e=[];else if(this.hasPlugin("moduleAttributes"))e=[];else return;!s&&this.hasPlugin("importAssertions")?t.assertions=e:t.attributes=e}maybeParseDefaultImportSpecifier(t,e){if(e){let s=this.startNodeAtNode(e);return s.local=e,t.specifiers.push(this.finishImportSpecifier(s,"ImportDefaultSpecifier")),!0}else if(X(this.state.type))return this.parseImportSpecifierLocal(t,this.startNode(),"ImportDefaultSpecifier"),!0;return!1}maybeParseStarImportSpecifier(t){if(this.match(55)){let e=this.startNode();return this.next(),this.expectContextual(93),this.parseImportSpecifierLocal(t,e,"ImportNamespaceSpecifier"),!0}return!1}parseNamedImportSpecifiers(t){let e=!0;for(this.expect(5);!this.eat(8);){if(e)e=!1;else{if(this.eat(14))throw this.raise(h.DestructureNamedImport,{at:this.state.startLoc});if(this.expect(12),this.eat(8))break}let s=this.startNode(),r=this.match(133),a=this.isContextual(130);s.imported=this.parseModuleExportName();let n=this.parseImportSpecifier(s,r,t.importKind==="type"||t.importKind==="typeof",a,void 0);t.specifiers.push(n)}}parseImportSpecifier(t,e,s,r,a){if(this.eatContextual(93))t.local=this.parseIdentifier();else{let{imported:n}=t;if(e)throw this.raise(h.ImportBindingIsString,{at:t,importName:n.value});this.checkReservedWord(n.name,t.loc.start,!0,!0),t.local||(t.local=ne(n))}return this.finishImportSpecifier(t,"ImportSpecifier",a)}isThisParam(t){return t.type==="Identifier"&&t.name==="this"}},zt=class extends Ks{constructor(t,e){t=ql(t),super(t,e),this.options=t,this.initializeScopes(),this.plugins=Hl(this.options.plugins),this.filename=t.sourceFilename}getScopeHandler(){return at}parse(){this.enterInitialScopes();let t=this.startNode(),e=this.startNode();return this.nextToken(),t.errors=null,this.parseTopLevel(t,e),t.errors=this.state.errors,t}};function Hl(i){let t=new Map;for(let e of i){let[s,r]=Array.isArray(e)?e:[e,{}];t.has(s)||t.set(s,r||{})}return t}function Kl(i,t){var e;if(((e=t)==null?void 0:e.sourceType)==="unambiguous"){t=Object.assign({},t);try{t.sourceType="module";let s=tt(t,i),r=s.parse();if(s.sawUnambiguousESM)return r;if(s.ambiguousScriptDifferentAst)try{return t.sourceType="script",tt(t,i).parse()}catch{}else r.program.sourceType="script";return r}catch(s){try{return t.sourceType="script",tt(t,i).parse()}catch{}throw s}}else return tt(t,i).parse()}function Gl(i,t){let e=tt(t,i);return e.options.strictMode&&(e.state.strict=!0),e.getExpression()}function Xl(i){let t={};for(let e of Object.keys(i))t[e]=se(i[e]);return t}var Jl=Xl($u);function tt(i,t){let e=zt;return i!=null&&i.plugins&&(Ul(i.plugins),e=Yl(i.plugins)),new e(i,t)}var va={};function Yl(i){let t=$l.filter(r=>D(i,r)),e=t.join("/"),s=va[e];if(!s){s=zt;for(let r of t)s=Fa[r](s);va[e]=s}return s}ot.parse=Kl;ot.parseExpression=Gl;ot.tokTypes=Jl});var qa=A((op,$a)=>{"use strict";var{Duplex:Ql}=require("stream");function ja(i){i.emit("close")}function Zl(){!this.destroyed&&this._writableState.finished&&this.destroy()}function Ua(i){this.removeListener("error",Ua),this.destroy(),this.listenerCount("error")===0&&this.emit("error",i)}function ec(i,t){let e=!0,s=new Ql({...t,autoDestroy:!1,emitClose:!1,objectMode:!1,writableObjectMode:!1});return i.on("message",function(a,n){let o=!n&&s._readableState.objectMode?a.toString():a;s.push(o)||i.pause()}),i.once("error",function(a){s.destroyed||(e=!1,s.destroy(a))}),i.once("close",function(){s.destroyed||s.push(null)}),s._destroy=function(r,a){if(i.readyState===i.CLOSED){a(r),process.nextTick(ja,s);return}let n=!1;i.once("error",function(u){n=!0,a(u)}),i.once("close",function(){n||a(r),process.nextTick(ja,s)}),e&&i.terminate()},s._final=function(r){if(i.readyState===i.CONNECTING){i.once("open",function(){s._final(r)});return}i._socket!==null&&(i._socket._writableState.finished?(r(),s._readableState.endEmitted&&s.destroy()):(i._socket.once("finish",function(){r()}),i.close()))},s._read=function(){i.isPaused&&i.resume()},s._write=function(r,a,n){if(i.readyState===i.CONNECTING){i.once("open",function(){s._write(r,a,n)});return}i.send(r,n)},s.on("end",Zl),s.on("error",Ua),s}$a.exports=ec});var de=A((up,Wa)=>{"use strict";Wa.exports={BINARY_TYPES:["nodebuffer","arraybuffer","fragments"],EMPTY_BUFFER:Buffer.alloc(0),GUID:"258EAFA5-E914-47DA-95CA-C5AB0DC85B11",kForOnEventAttribute:Symbol("kIsForOnEventAttribute"),kListener:Symbol("kListener"),kStatusCode:Symbol("status-code"),kWebSocket:Symbol("websocket"),NOOP:()=>{}}});var ut=A((lp,Ht)=>{"use strict";var{EMPTY_BUFFER:tc}=de(),ir=Buffer[Symbol.species];function sc(i,t){if(i.length===0)return tc;if(i.length===1)return i[0];let e=Buffer.allocUnsafe(t),s=0;for(let r=0;r<i.length;r++){let a=i[r];e.set(a,s),s+=a.length}return s<t?new ir(e.buffer,e.byteOffset,s):e}function Va(i,t,e,s,r){for(let a=0;a<r;a++)e[s+a]=i[a]^t[a&3]}function za(i,t){for(let e=0;e<i.length;e++)i[e]^=t[e&3]}function rc(i){return i.length===i.buffer.byteLength?i.buffer:i.buffer.slice(i.byteOffset,i.byteOffset+i.length)}function ar(i){if(ar.readOnly=!0,Buffer.isBuffer(i))return i;let t;return i instanceof ArrayBuffer?t=new ir(i):ArrayBuffer.isView(i)?t=new ir(i.buffer,i.byteOffset,i.byteLength):(t=Buffer.from(i),ar.readOnly=!1),t}Ht.exports={concat:sc,mask:Va,toArrayBuffer:rc,toBuffer:ar,unmask:za};if(!process.env.WS_NO_BUFFER_UTIL)try{let i=require("bufferutil");Ht.exports.mask=function(t,e,s,r,a){a<48?Va(t,e,s,r,a):i.mask(t,e,s,r,a)},Ht.exports.unmask=function(t,e){t.length<32?za(t,e):i.unmask(t,e)}}catch{}});var Ga=A((cp,Ka)=>{"use strict";var Ha=Symbol("kDone"),nr=Symbol("kRun"),or=class{constructor(t){this[Ha]=()=>{this.pending--,this[nr]()},this.concurrency=t||1/0,this.jobs=[],this.pending=0}add(t){this.jobs.push(t),this[nr]()}[nr](){if(this.pending!==this.concurrency&&this.jobs.length){let t=this.jobs.shift();this.pending++,t(this[Ha])}}};Ka.exports=or});var ht=A((hp,Qa)=>{"use strict";var lt=require("zlib"),Xa=ut(),ic=Ga(),{kStatusCode:Ja}=de(),ac=Buffer[Symbol.species],nc=Buffer.from([0,0,255,255]),Xt=Symbol("permessage-deflate"),oe=Symbol("total-length"),ct=Symbol("callback"),me=Symbol("buffers"),Gt=Symbol("error"),Kt,ur=class{constructor(t,e,s){if(this._maxPayload=s|0,this._options=t||{},this._threshold=this._options.threshold!==void 0?this._options.threshold:1024,this._isServer=!!e,this._deflate=null,this._inflate=null,this.params=null,!Kt){let r=this._options.concurrencyLimit!==void 0?this._options.concurrencyLimit:10;Kt=new ic(r)}}static get extensionName(){return"permessage-deflate"}offer(){let t={};return this._options.serverNoContextTakeover&&(t.server_no_context_takeover=!0),this._options.clientNoContextTakeover&&(t.client_no_context_takeover=!0),this._options.serverMaxWindowBits&&(t.server_max_window_bits=this._options.serverMaxWindowBits),this._options.clientMaxWindowBits?t.client_max_window_bits=this._options.clientMaxWindowBits:this._options.clientMaxWindowBits==null&&(t.client_max_window_bits=!0),t}accept(t){return t=this.normalizeParams(t),this.params=this._isServer?this.acceptAsServer(t):this.acceptAsClient(t),this.params}cleanup(){if(this._inflate&&(this._inflate.close(),this._inflate=null),this._deflate){let t=this._deflate[ct];this._deflate.close(),this._deflate=null,t&&t(new Error("The deflate stream was closed while data was being processed"))}}acceptAsServer(t){let e=this._options,s=t.find(r=>!(e.serverNoContextTakeover===!1&&r.server_no_context_takeover||r.server_max_window_bits&&(e.serverMaxWindowBits===!1||typeof e.serverMaxWindowBits=="number"&&e.serverMaxWindowBits>r.server_max_window_bits)||typeof e.clientMaxWindowBits=="number"&&!r.client_max_window_bits));if(!s)throw new Error("None of the extension offers can be accepted");return e.serverNoContextTakeover&&(s.server_no_context_takeover=!0),e.clientNoContextTakeover&&(s.client_no_context_takeover=!0),typeof e.serverMaxWindowBits=="number"&&(s.server_max_window_bits=e.serverMaxWindowBits),typeof e.clientMaxWindowBits=="number"?s.client_max_window_bits=e.clientMaxWindowBits:(s.client_max_window_bits===!0||e.clientMaxWindowBits===!1)&&delete s.client_max_window_bits,s}acceptAsClient(t){let e=t[0];if(this._options.clientNoContextTakeover===!1&&e.client_no_context_takeover)throw new Error('Unexpected parameter "client_no_context_takeover"');if(!e.client_max_window_bits)typeof this._options.clientMaxWindowBits=="number"&&(e.client_max_window_bits=this._options.clientMaxWindowBits);else if(this._options.clientMaxWindowBits===!1||typeof this._options.clientMaxWindowBits=="number"&&e.client_max_window_bits>this._options.clientMaxWindowBits)throw new Error('Unexpected or invalid parameter "client_max_window_bits"');return e}normalizeParams(t){return t.forEach(e=>{Object.keys(e).forEach(s=>{let r=e[s];if(r.length>1)throw new Error(`Parameter "${s}" must have only a single value`);if(r=r[0],s==="client_max_window_bits"){if(r!==!0){let a=+r;if(!Number.isInteger(a)||a<8||a>15)throw new TypeError(`Invalid value for parameter "${s}": ${r}`);r=a}else if(!this._isServer)throw new TypeError(`Invalid value for parameter "${s}": ${r}`)}else if(s==="server_max_window_bits"){let a=+r;if(!Number.isInteger(a)||a<8||a>15)throw new TypeError(`Invalid value for parameter "${s}": ${r}`);r=a}else if(s==="client_no_context_takeover"||s==="server_no_context_takeover"){if(r!==!0)throw new TypeError(`Invalid value for parameter "${s}": ${r}`)}else throw new Error(`Unknown parameter "${s}"`);e[s]=r})}),t}decompress(t,e,s){Kt.add(r=>{this._decompress(t,e,(a,n)=>{r(),s(a,n)})})}compress(t,e,s){Kt.add(r=>{this._compress(t,e,(a,n)=>{r(),s(a,n)})})}_decompress(t,e,s){let r=this._isServer?"client":"server";if(!this._inflate){let a=`${r}_max_window_bits`,n=typeof this.params[a]!="number"?lt.Z_DEFAULT_WINDOWBITS:this.params[a];this._inflate=lt.createInflateRaw({...this._options.zlibInflateOptions,windowBits:n}),this._inflate[Xt]=this,this._inflate[oe]=0,this._inflate[me]=[],this._inflate.on("error",uc),this._inflate.on("data",Ya)}this._inflate[ct]=s,this._inflate.write(t),e&&this._inflate.write(nc),this._inflate.flush(()=>{let a=this._inflate[Gt];if(a){this._inflate.close(),this._inflate=null,s(a);return}let n=Xa.concat(this._inflate[me],this._inflate[oe]);this._inflate._readableState.endEmitted?(this._inflate.close(),this._inflate=null):(this._inflate[oe]=0,this._inflate[me]=[],e&&this.params[`${r}_no_context_takeover`]&&this._inflate.reset()),s(null,n)})}_compress(t,e,s){let r=this._isServer?"server":"client";if(!this._deflate){let a=`${r}_max_window_bits`,n=typeof this.params[a]!="number"?lt.Z_DEFAULT_WINDOWBITS:this.params[a];this._deflate=lt.createDeflateRaw({...this._options.zlibDeflateOptions,windowBits:n}),this._deflate[oe]=0,this._deflate[me]=[],this._deflate.on("data",oc)}this._deflate[ct]=s,this._deflate.write(t),this._deflate.flush(lt.Z_SYNC_FLUSH,()=>{if(!this._deflate)return;let a=Xa.concat(this._deflate[me],this._deflate[oe]);e&&(a=new ac(a.buffer,a.byteOffset,a.length-4)),this._deflate[ct]=null,this._deflate[oe]=0,this._deflate[me]=[],e&&this.params[`${r}_no_context_takeover`]&&this._deflate.reset(),s(null,a)})}};Qa.exports=ur;function oc(i){this[me].push(i),this[oe]+=i.length}function Ya(i){if(this[oe]+=i.length,this[Xt]._maxPayload<1||this[oe]<=this[Xt]._maxPayload){this[me].push(i);return}this[Gt]=new RangeError("Max payload size exceeded"),this[Gt].code="WS_ERR_UNSUPPORTED_MESSAGE_LENGTH",this[Gt][Ja]=1009,this.removeListener("data",Ya),this.reset()}function uc(i){this[Xt]._inflate=null,i[Ja]=1007,this[ct](i)}});var pt=A((pp,Jt)=>{"use strict";var{isUtf8:Za}=require("buffer"),lc=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,1,1,0,0,1,1,0,1,1,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,1,0];function cc(i){return i>=1e3&&i<=1014&&i!==1004&&i!==1005&&i!==1006||i>=3e3&&i<=4999}function lr(i){let t=i.length,e=0;for(;e<t;)if(!(i[e]&128))e++;else if((i[e]&224)===192){if(e+1===t||(i[e+1]&192)!==128||(i[e]&254)===192)return!1;e+=2}else if((i[e]&240)===224){if(e+2>=t||(i[e+1]&192)!==128||(i[e+2]&192)!==128||i[e]===224&&(i[e+1]&224)===128||i[e]===237&&(i[e+1]&224)===160)return!1;e+=3}else if((i[e]&248)===240){if(e+3>=t||(i[e+1]&192)!==128||(i[e+2]&192)!==128||(i[e+3]&192)!==128||i[e]===240&&(i[e+1]&240)===128||i[e]===244&&i[e+1]>143||i[e]>244)return!1;e+=4}else return!1;return!0}Jt.exports={isValidStatusCode:cc,isValidUTF8:lr,tokenChars:lc};if(Za)Jt.exports.isValidUTF8=function(i){return i.length<24?lr(i):Za(i)};else if(!process.env.WS_NO_UTF_8_VALIDATE)try{let i=require("utf-8-validate");Jt.exports.isValidUTF8=function(t){return t.length<32?lr(t):i(t)}}catch{}});var dr=A((fp,on)=>{"use strict";var{Writable:hc}=require("stream"),en=ht(),{BINARY_TYPES:pc,EMPTY_BUFFER:tn,kStatusCode:fc,kWebSocket:dc}=de(),{concat:cr,toArrayBuffer:mc,unmask:yc}=ut(),{isValidStatusCode:xc,isValidUTF8:sn}=pt(),Yt=Buffer[Symbol.species],gc=Promise.resolve(),hr=typeof queueMicrotask=="function"?queueMicrotask:bc,H=0,rn=1,an=2,nn=3,pr=4,Qt=5,Zt=6,fr=class extends hc{constructor(t={}){super(),this._allowSynchronousEvents=!!t.allowSynchronousEvents,this._binaryType=t.binaryType||pc[0],this._extensions=t.extensions||{},this._isServer=!!t.isServer,this._maxPayload=t.maxPayload|0,this._skipUTF8Validation=!!t.skipUTF8Validation,this[dc]=void 0,this._bufferedBytes=0,this._buffers=[],this._compressed=!1,this._payloadLength=0,this._mask=void 0,this._fragmented=0,this._masked=!1,this._fin=!1,this._opcode=0,this._totalPayloadLength=0,this._messageLength=0,this._fragments=[],this._errored=!1,this._loop=!1,this._state=H}_write(t,e,s){if(this._opcode===8&&this._state==H)return s();this._bufferedBytes+=t.length,this._buffers.push(t),this.startLoop(s)}consume(t){if(this._bufferedBytes-=t,t===this._buffers[0].length)return this._buffers.shift();if(t<this._buffers[0].length){let s=this._buffers[0];return this._buffers[0]=new Yt(s.buffer,s.byteOffset+t,s.length-t),new Yt(s.buffer,s.byteOffset,t)}let e=Buffer.allocUnsafe(t);do{let s=this._buffers[0],r=e.length-t;t>=s.length?e.set(this._buffers.shift(),r):(e.set(new Uint8Array(s.buffer,s.byteOffset,t),r),this._buffers[0]=new Yt(s.buffer,s.byteOffset+t,s.length-t)),t-=s.length}while(t>0);return e}startLoop(t){this._loop=!0;do switch(this._state){case H:this.getInfo(t);break;case rn:this.getPayloadLength16(t);break;case an:this.getPayloadLength64(t);break;case nn:this.getMask();break;case pr:this.getData(t);break;case Qt:case Zt:this._loop=!1;return}while(this._loop);this._errored||t()}getInfo(t){if(this._bufferedBytes<2){this._loop=!1;return}let e=this.consume(2);if(e[0]&48){let r=this.createError(RangeError,"RSV2 and RSV3 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_2_3");t(r);return}let s=(e[0]&64)===64;if(s&&!this._extensions[en.extensionName]){let r=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");t(r);return}if(this._fin=(e[0]&128)===128,this._opcode=e[0]&15,this._payloadLength=e[1]&127,this._opcode===0){if(s){let r=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");t(r);return}if(!this._fragmented){let r=this.createError(RangeError,"invalid opcode 0",!0,1002,"WS_ERR_INVALID_OPCODE");t(r);return}this._opcode=this._fragmented}else if(this._opcode===1||this._opcode===2){if(this._fragmented){let r=this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");t(r);return}this._compressed=s}else if(this._opcode>7&&this._opcode<11){if(!this._fin){let r=this.createError(RangeError,"FIN must be set",!0,1002,"WS_ERR_EXPECTED_FIN");t(r);return}if(s){let r=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");t(r);return}if(this._payloadLength>125||this._opcode===8&&this._payloadLength===1){let r=this.createError(RangeError,`invalid payload length ${this._payloadLength}`,!0,1002,"WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH");t(r);return}}else{let r=this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");t(r);return}if(!this._fin&&!this._fragmented&&(this._fragmented=this._opcode),this._masked=(e[1]&128)===128,this._isServer){if(!this._masked){let r=this.createError(RangeError,"MASK must be set",!0,1002,"WS_ERR_EXPECTED_MASK");t(r);return}}else if(this._masked){let r=this.createError(RangeError,"MASK must be clear",!0,1002,"WS_ERR_UNEXPECTED_MASK");t(r);return}this._payloadLength===126?this._state=rn:this._payloadLength===127?this._state=an:this.haveLength(t)}getPayloadLength16(t){if(this._bufferedBytes<2){this._loop=!1;return}this._payloadLength=this.consume(2).readUInt16BE(0),this.haveLength(t)}getPayloadLength64(t){if(this._bufferedBytes<8){this._loop=!1;return}let e=this.consume(8),s=e.readUInt32BE(0);if(s>Math.pow(2,21)-1){let r=this.createError(RangeError,"Unsupported WebSocket frame: payload length > 2^53 - 1",!1,1009,"WS_ERR_UNSUPPORTED_DATA_PAYLOAD_LENGTH");t(r);return}this._payloadLength=s*Math.pow(2,32)+e.readUInt32BE(4),this.haveLength(t)}haveLength(t){if(this._payloadLength&&this._opcode<8&&(this._totalPayloadLength+=this._payloadLength,this._totalPayloadLength>this._maxPayload&&this._maxPayload>0)){let e=this.createError(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");t(e);return}this._masked?this._state=nn:this._state=pr}getMask(){if(this._bufferedBytes<4){this._loop=!1;return}this._mask=this.consume(4),this._state=pr}getData(t){let e=tn;if(this._payloadLength){if(this._bufferedBytes<this._payloadLength){this._loop=!1;return}e=this.consume(this._payloadLength),this._masked&&this._mask[0]|this._mask[1]|this._mask[2]|this._mask[3]&&yc(e,this._mask)}if(this._opcode>7){this.controlMessage(e,t);return}if(this._compressed){this._state=Qt,this.decompress(e,t);return}e.length&&(this._messageLength=this._totalPayloadLength,this._fragments.push(e)),this.dataMessage(t)}decompress(t,e){this._extensions[en.extensionName].decompress(t,this._fin,(r,a)=>{if(r)return e(r);if(a.length){if(this._messageLength+=a.length,this._messageLength>this._maxPayload&&this._maxPayload>0){let n=this.createError(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");e(n);return}this._fragments.push(a)}this.dataMessage(e),this._state===H&&this.startLoop(e)})}dataMessage(t){if(!this._fin){this._state=H;return}let e=this._messageLength,s=this._fragments;if(this._totalPayloadLength=0,this._messageLength=0,this._fragmented=0,this._fragments=[],this._opcode===2){let r;this._binaryType==="nodebuffer"?r=cr(s,e):this._binaryType==="arraybuffer"?r=mc(cr(s,e)):r=s,this._state===Qt||this._allowSynchronousEvents?(this.emit("message",r,!0),this._state=H):(this._state=Zt,hr(()=>{this.emit("message",r,!0),this._state=H,this.startLoop(t)}))}else{let r=cr(s,e);if(!this._skipUTF8Validation&&!sn(r)){let a=this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");t(a);return}this._state===Qt||this._allowSynchronousEvents?(this.emit("message",r,!1),this._state=H):(this._state=Zt,hr(()=>{this.emit("message",r,!1),this._state=H,this.startLoop(t)}))}}controlMessage(t,e){if(this._opcode===8){if(t.length===0)this._loop=!1,this.emit("conclude",1005,tn),this.end();else{let s=t.readUInt16BE(0);if(!xc(s)){let a=this.createError(RangeError,`invalid status code ${s}`,!0,1002,"WS_ERR_INVALID_CLOSE_CODE");e(a);return}let r=new Yt(t.buffer,t.byteOffset+2,t.length-2);if(!this._skipUTF8Validation&&!sn(r)){let a=this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");e(a);return}this._loop=!1,this.emit("conclude",s,r),this.end()}this._state=H;return}this._allowSynchronousEvents?(this.emit(this._opcode===9?"ping":"pong",t),this._state=H):(this._state=Zt,hr(()=>{this.emit(this._opcode===9?"ping":"pong",t),this._state=H,this.startLoop(e)}))}createError(t,e,s,r,a){this._loop=!1,this._errored=!0;let n=new t(s?`Invalid WebSocket frame: ${e}`:e);return Error.captureStackTrace(n,this.createError),n.code=a,n[fc]=r,n}};on.exports=fr;function bc(i){gc.then(i).catch(vc)}function Pc(i){throw i}function vc(i){process.nextTick(Pc,i)}});var yr=A((mp,cn)=>{"use strict";var{Duplex:dp}=require("stream"),{randomFillSync:wc}=require("crypto"),un=ht(),{EMPTY_BUFFER:Tc}=de(),{isValidStatusCode:Sc}=pt(),{mask:ln,toBuffer:Ue}=ut(),J=Symbol("kByteLength"),Ac=Buffer.alloc(4),mr=class i{constructor(t,e,s){this._extensions=e||{},s&&(this._generateMask=s,this._maskBuffer=Buffer.alloc(4)),this._socket=t,this._firstFragment=!0,this._compress=!1,this._bufferedBytes=0,this._deflating=!1,this._queue=[]}static frame(t,e){let s,r=!1,a=2,n=!1;e.mask&&(s=e.maskBuffer||Ac,e.generateMask?e.generateMask(s):wc(s,0,4),n=(s[0]|s[1]|s[2]|s[3])===0,a=6);let o;typeof t=="string"?(!e.mask||n)&&e[J]!==void 0?o=e[J]:(t=Buffer.from(t),o=t.length):(o=t.length,r=e.mask&&e.readOnly&&!n);let u=o;o>=65536?(a+=8,u=127):o>125&&(a+=2,u=126);let l=Buffer.allocUnsafe(r?o+a:a);return l[0]=e.fin?e.opcode|128:e.opcode,e.rsv1&&(l[0]|=64),l[1]=u,u===126?l.writeUInt16BE(o,2):u===127&&(l[2]=l[3]=0,l.writeUIntBE(o,4,6)),e.mask?(l[1]|=128,l[a-4]=s[0],l[a-3]=s[1],l[a-2]=s[2],l[a-1]=s[3],n?[l,t]:r?(ln(t,s,l,a,o),[l]):(ln(t,s,t,0,o),[l,t])):[l,t]}close(t,e,s,r){let a;if(t===void 0)a=Tc;else{if(typeof t!="number"||!Sc(t))throw new TypeError("First argument must be a valid error code number");if(e===void 0||!e.length)a=Buffer.allocUnsafe(2),a.writeUInt16BE(t,0);else{let o=Buffer.byteLength(e);if(o>123)throw new RangeError("The message must not be greater than 123 bytes");a=Buffer.allocUnsafe(2+o),a.writeUInt16BE(t,0),typeof e=="string"?a.write(e,2):a.set(e,2)}}let n={[J]:a.length,fin:!0,generateMask:this._generateMask,mask:s,maskBuffer:this._maskBuffer,opcode:8,readOnly:!1,rsv1:!1};this._deflating?this.enqueue([this.dispatch,a,!1,n,r]):this.sendFrame(i.frame(a,n),r)}ping(t,e,s){let r,a;if(typeof t=="string"?(r=Buffer.byteLength(t),a=!1):(t=Ue(t),r=t.length,a=Ue.readOnly),r>125)throw new RangeError("The data size must not be greater than 125 bytes");let n={[J]:r,fin:!0,generateMask:this._generateMask,mask:e,maskBuffer:this._maskBuffer,opcode:9,readOnly:a,rsv1:!1};this._deflating?this.enqueue([this.dispatch,t,!1,n,s]):this.sendFrame(i.frame(t,n),s)}pong(t,e,s){let r,a;if(typeof t=="string"?(r=Buffer.byteLength(t),a=!1):(t=Ue(t),r=t.length,a=Ue.readOnly),r>125)throw new RangeError("The data size must not be greater than 125 bytes");let n={[J]:r,fin:!0,generateMask:this._generateMask,mask:e,maskBuffer:this._maskBuffer,opcode:10,readOnly:a,rsv1:!1};this._deflating?this.enqueue([this.dispatch,t,!1,n,s]):this.sendFrame(i.frame(t,n),s)}send(t,e,s){let r=this._extensions[un.extensionName],a=e.binary?2:1,n=e.compress,o,u;if(typeof t=="string"?(o=Buffer.byteLength(t),u=!1):(t=Ue(t),o=t.length,u=Ue.readOnly),this._firstFragment?(this._firstFragment=!1,n&&r&&r.params[r._isServer?"server_no_context_takeover":"client_no_context_takeover"]&&(n=o>=r._threshold),this._compress=n):(n=!1,a=0),e.fin&&(this._firstFragment=!0),r){let l={[J]:o,fin:e.fin,generateMask:this._generateMask,mask:e.mask,maskBuffer:this._maskBuffer,opcode:a,readOnly:u,rsv1:n};this._deflating?this.enqueue([this.dispatch,t,this._compress,l,s]):this.dispatch(t,this._compress,l,s)}else this.sendFrame(i.frame(t,{[J]:o,fin:e.fin,generateMask:this._generateMask,mask:e.mask,maskBuffer:this._maskBuffer,opcode:a,readOnly:u,rsv1:!1}),s)}dispatch(t,e,s,r){if(!e){this.sendFrame(i.frame(t,s),r);return}let a=this._extensions[un.extensionName];this._bufferedBytes+=s[J],this._deflating=!0,a.compress(t,s.fin,(n,o)=>{if(this._socket.destroyed){let u=new Error("The socket was closed while data was being compressed");typeof r=="function"&&r(u);for(let l=0;l<this._queue.length;l++){let c=this._queue[l],p=c[c.length-1];typeof p=="function"&&p(u)}return}this._bufferedBytes-=s[J],this._deflating=!1,s.readOnly=!1,this.sendFrame(i.frame(o,s),r),this.dequeue()})}dequeue(){for(;!this._deflating&&this._queue.length;){let t=this._queue.shift();this._bufferedBytes-=t[3][J],Reflect.apply(t[0],this,t.slice(1))}}enqueue(t){this._bufferedBytes+=t[3][J],this._queue.push(t)}sendFrame(t,e){t.length===2?(this._socket.cork(),this._socket.write(t[0]),this._socket.write(t[1],e),this._socket.uncork()):this._socket.write(t[0],e)}};cn.exports=mr});var bn=A((yp,gn)=>{"use strict";var{kForOnEventAttribute:ft,kListener:xr}=de(),hn=Symbol("kCode"),pn=Symbol("kData"),fn=Symbol("kError"),dn=Symbol("kMessage"),mn=Symbol("kReason"),$e=Symbol("kTarget"),yn=Symbol("kType"),xn=Symbol("kWasClean"),ue=class{constructor(t){this[$e]=null,this[yn]=t}get target(){return this[$e]}get type(){return this[yn]}};Object.defineProperty(ue.prototype,"target",{enumerable:!0});Object.defineProperty(ue.prototype,"type",{enumerable:!0});var Te=class extends ue{constructor(t,e={}){super(t),this[hn]=e.code===void 0?0:e.code,this[mn]=e.reason===void 0?"":e.reason,this[xn]=e.wasClean===void 0?!1:e.wasClean}get code(){return this[hn]}get reason(){return this[mn]}get wasClean(){return this[xn]}};Object.defineProperty(Te.prototype,"code",{enumerable:!0});Object.defineProperty(Te.prototype,"reason",{enumerable:!0});Object.defineProperty(Te.prototype,"wasClean",{enumerable:!0});var qe=class extends ue{constructor(t,e={}){super(t),this[fn]=e.error===void 0?null:e.error,this[dn]=e.message===void 0?"":e.message}get error(){return this[fn]}get message(){return this[dn]}};Object.defineProperty(qe.prototype,"error",{enumerable:!0});Object.defineProperty(qe.prototype,"message",{enumerable:!0});var dt=class extends ue{constructor(t,e={}){super(t),this[pn]=e.data===void 0?null:e.data}get data(){return this[pn]}};Object.defineProperty(dt.prototype,"data",{enumerable:!0});var Ec={addEventListener(i,t,e={}){for(let r of this.listeners(i))if(!e[ft]&&r[xr]===t&&!r[ft])return;let s;if(i==="message")s=function(a,n){let o=new dt("message",{data:n?a:a.toString()});o[$e]=this,es(t,this,o)};else if(i==="close")s=function(a,n){let o=new Te("close",{code:a,reason:n.toString(),wasClean:this._closeFrameReceived&&this._closeFrameSent});o[$e]=this,es(t,this,o)};else if(i==="error")s=function(a){let n=new qe("error",{error:a,message:a.message});n[$e]=this,es(t,this,n)};else if(i==="open")s=function(){let a=new ue("open");a[$e]=this,es(t,this,a)};else return;s[ft]=!!e[ft],s[xr]=t,e.once?this.once(i,s):this.on(i,s)},removeEventListener(i,t){for(let e of this.listeners(i))if(e[xr]===t&&!e[ft]){this.removeListener(i,e);break}}};gn.exports={CloseEvent:Te,ErrorEvent:qe,Event:ue,EventTarget:Ec,MessageEvent:dt};function es(i,t,e){typeof i=="object"&&i.handleEvent?i.handleEvent.call(i,e):i.call(t,e)}});var gr=A((xp,Pn)=>{"use strict";var{tokenChars:mt}=pt();function ee(i,t,e){i[t]===void 0?i[t]=[e]:i[t].push(e)}function Cc(i){let t=Object.create(null),e=Object.create(null),s=!1,r=!1,a=!1,n,o,u=-1,l=-1,c=-1,p=0;for(;p<i.length;p++)if(l=i.charCodeAt(p),n===void 0)if(c===-1&&mt[l]===1)u===-1&&(u=p);else if(p!==0&&(l===32||l===9))c===-1&&u!==-1&&(c=p);else if(l===59||l===44){if(u===-1)throw new SyntaxError(`Unexpected character at index ${p}`);c===-1&&(c=p);let m=i.slice(u,c);l===44?(ee(t,m,e),e=Object.create(null)):n=m,u=c=-1}else throw new SyntaxError(`Unexpected character at index ${p}`);else if(o===void 0)if(c===-1&&mt[l]===1)u===-1&&(u=p);else if(l===32||l===9)c===-1&&u!==-1&&(c=p);else if(l===59||l===44){if(u===-1)throw new SyntaxError(`Unexpected character at index ${p}`);c===-1&&(c=p),ee(e,i.slice(u,c),!0),l===44&&(ee(t,n,e),e=Object.create(null),n=void 0),u=c=-1}else if(l===61&&u!==-1&&c===-1)o=i.slice(u,p),u=c=-1;else throw new SyntaxError(`Unexpected character at index ${p}`);else if(r){if(mt[l]!==1)throw new SyntaxError(`Unexpected character at index ${p}`);u===-1?u=p:s||(s=!0),r=!1}else if(a)if(mt[l]===1)u===-1&&(u=p);else if(l===34&&u!==-1)a=!1,c=p;else if(l===92)r=!0;else throw new SyntaxError(`Unexpected character at index ${p}`);else if(l===34&&i.charCodeAt(p-1)===61)a=!0;else if(c===-1&&mt[l]===1)u===-1&&(u=p);else if(u!==-1&&(l===32||l===9))c===-1&&(c=p);else if(l===59||l===44){if(u===-1)throw new SyntaxError(`Unexpected character at index ${p}`);c===-1&&(c=p);let m=i.slice(u,c);s&&(m=m.replace(/\\/g,""),s=!1),ee(e,o,m),l===44&&(ee(t,n,e),e=Object.create(null),n=void 0),o=void 0,u=c=-1}else throw new SyntaxError(`Unexpected character at index ${p}`);if(u===-1||a||l===32||l===9)throw new SyntaxError("Unexpected end of input");c===-1&&(c=p);let f=i.slice(u,c);return n===void 0?ee(t,f,e):(o===void 0?ee(e,f,!0):s?ee(e,o,f.replace(/\\/g,"")):ee(e,o,f),ee(t,n,e)),t}function Ic(i){return Object.keys(i).map(t=>{let e=i[t];return Array.isArray(e)||(e=[e]),e.map(s=>[t].concat(Object.keys(s).map(r=>{let a=s[r];return Array.isArray(a)||(a=[a]),a.map(n=>n===!0?r:`${r}=${n}`).join("; ")})).join("; ")).join(", ")}).join(", ")}Pn.exports={format:Ic,parse:Cc}});var Tr=A((Pp,_n)=>{"use strict";var kc=require("events"),Nc=require("https"),_c=require("http"),Tn=require("net"),Oc=require("tls"),{randomBytes:Mc,createHash:Lc}=require("crypto"),{Duplex:gp,Readable:bp}=require("stream"),{URL:br}=require("url"),ye=ht(),Dc=dr(),Bc=yr(),{BINARY_TYPES:vn,EMPTY_BUFFER:ts,GUID:Fc,kForOnEventAttribute:Pr,kListener:Rc,kStatusCode:jc,kWebSocket:j,NOOP:Sn}=de(),{EventTarget:{addEventListener:Uc,removeEventListener:$c}}=bn(),{format:qc,parse:Wc}=gr(),{toBuffer:Vc}=ut(),zc=30*1e3,An=Symbol("kAborted"),vr=[8,13],le=["CONNECTING","OPEN","CLOSING","CLOSED"],Hc=/^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/,O=class i extends kc{constructor(t,e,s){super(),this._binaryType=vn[0],this._closeCode=1006,this._closeFrameReceived=!1,this._closeFrameSent=!1,this._closeMessage=ts,this._closeTimer=null,this._extensions={},this._paused=!1,this._protocol="",this._readyState=i.CONNECTING,this._receiver=null,this._sender=null,this._socket=null,t!==null?(this._bufferedAmount=0,this._isServer=!1,this._redirects=0,e===void 0?e=[]:Array.isArray(e)||(typeof e=="object"&&e!==null?(s=e,e=[]):e=[e]),En(this,t,e,s)):(this._autoPong=s.autoPong,this._isServer=!0)}get binaryType(){return this._binaryType}set binaryType(t){vn.includes(t)&&(this._binaryType=t,this._receiver&&(this._receiver._binaryType=t))}get bufferedAmount(){return this._socket?this._socket._writableState.length+this._sender._bufferedBytes:this._bufferedAmount}get extensions(){return Object.keys(this._extensions).join()}get isPaused(){return this._paused}get onclose(){return null}get onerror(){return null}get onopen(){return null}get onmessage(){return null}get protocol(){return this._protocol}get readyState(){return this._readyState}get url(){return this._url}setSocket(t,e,s){let r=new Dc({allowSynchronousEvents:s.allowSynchronousEvents,binaryType:this.binaryType,extensions:this._extensions,isServer:this._isServer,maxPayload:s.maxPayload,skipUTF8Validation:s.skipUTF8Validation});this._sender=new Bc(t,this._extensions,s.generateMask),this._receiver=r,this._socket=t,r[j]=this,t[j]=this,r.on("conclude",Xc),r.on("drain",Jc),r.on("error",Yc),r.on("message",Qc),r.on("ping",Zc),r.on("pong",eh),t.setTimeout&&t.setTimeout(0),t.setNoDelay&&t.setNoDelay(),e.length>0&&t.unshift(e),t.on("close",In),t.on("data",rs),t.on("end",kn),t.on("error",Nn),this._readyState=i.OPEN,this.emit("open")}emitClose(){if(!this._socket){this._readyState=i.CLOSED,this.emit("close",this._closeCode,this._closeMessage);return}this._extensions[ye.extensionName]&&this._extensions[ye.extensionName].cleanup(),this._receiver.removeAllListeners(),this._readyState=i.CLOSED,this.emit("close",this._closeCode,this._closeMessage)}close(t,e){if(this.readyState!==i.CLOSED){if(this.readyState===i.CONNECTING){let s="WebSocket was closed before the connection was established";z(this,this._req,s);return}if(this.readyState===i.CLOSING){this._closeFrameSent&&(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end();return}this._readyState=i.CLOSING,this._sender.close(t,e,!this._isServer,s=>{s||(this._closeFrameSent=!0,(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end())}),this._closeTimer=setTimeout(this._socket.destroy.bind(this._socket),zc)}}pause(){this.readyState===i.CONNECTING||this.readyState===i.CLOSED||(this._paused=!0,this._socket.pause())}ping(t,e,s){if(this.readyState===i.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof t=="function"?(s=t,t=e=void 0):typeof e=="function"&&(s=e,e=void 0),typeof t=="number"&&(t=t.toString()),this.readyState!==i.OPEN){wr(this,t,s);return}e===void 0&&(e=!this._isServer),this._sender.ping(t||ts,e,s)}pong(t,e,s){if(this.readyState===i.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof t=="function"?(s=t,t=e=void 0):typeof e=="function"&&(s=e,e=void 0),typeof t=="number"&&(t=t.toString()),this.readyState!==i.OPEN){wr(this,t,s);return}e===void 0&&(e=!this._isServer),this._sender.pong(t||ts,e,s)}resume(){this.readyState===i.CONNECTING||this.readyState===i.CLOSED||(this._paused=!1,this._receiver._writableState.needDrain||this._socket.resume())}send(t,e,s){if(this.readyState===i.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof e=="function"&&(s=e,e={}),typeof t=="number"&&(t=t.toString()),this.readyState!==i.OPEN){wr(this,t,s);return}let r={binary:typeof t!="string",mask:!this._isServer,compress:!0,fin:!0,...e};this._extensions[ye.extensionName]||(r.compress=!1),this._sender.send(t||ts,r,s)}terminate(){if(this.readyState!==i.CLOSED){if(this.readyState===i.CONNECTING){let t="WebSocket was closed before the connection was established";z(this,this._req,t);return}this._socket&&(this._readyState=i.CLOSING,this._socket.destroy())}}};Object.defineProperty(O,"CONNECTING",{enumerable:!0,value:le.indexOf("CONNECTING")});Object.defineProperty(O.prototype,"CONNECTING",{enumerable:!0,value:le.indexOf("CONNECTING")});Object.defineProperty(O,"OPEN",{enumerable:!0,value:le.indexOf("OPEN")});Object.defineProperty(O.prototype,"OPEN",{enumerable:!0,value:le.indexOf("OPEN")});Object.defineProperty(O,"CLOSING",{enumerable:!0,value:le.indexOf("CLOSING")});Object.defineProperty(O.prototype,"CLOSING",{enumerable:!0,value:le.indexOf("CLOSING")});Object.defineProperty(O,"CLOSED",{enumerable:!0,value:le.indexOf("CLOSED")});Object.defineProperty(O.prototype,"CLOSED",{enumerable:!0,value:le.indexOf("CLOSED")});["binaryType","bufferedAmount","extensions","isPaused","protocol","readyState","url"].forEach(i=>{Object.defineProperty(O.prototype,i,{enumerable:!0})});["open","error","close","message"].forEach(i=>{Object.defineProperty(O.prototype,`on${i}`,{enumerable:!0,get(){for(let t of this.listeners(i))if(t[Pr])return t[Rc];return null},set(t){for(let e of this.listeners(i))if(e[Pr]){this.removeListener(i,e);break}typeof t=="function"&&this.addEventListener(i,t,{[Pr]:!0})}})});O.prototype.addEventListener=Uc;O.prototype.removeEventListener=$c;_n.exports=O;function En(i,t,e,s){let r={allowSynchronousEvents:!1,autoPong:!0,protocolVersion:vr[1],maxPayload:104857600,skipUTF8Validation:!1,perMessageDeflate:!0,followRedirects:!1,maxRedirects:10,...s,createConnection:void 0,socketPath:void 0,hostname:void 0,protocol:void 0,timeout:void 0,method:"GET",host:void 0,path:void 0,port:void 0};if(i._autoPong=r.autoPong,!vr.includes(r.protocolVersion))throw new RangeError(`Unsupported protocol version: ${r.protocolVersion} (supported versions: ${vr.join(", ")})`);let a;if(t instanceof br)a=t;else try{a=new br(t)}catch{throw new SyntaxError(`Invalid URL: ${t}`)}a.protocol==="http:"?a.protocol="ws:":a.protocol==="https:"&&(a.protocol="wss:"),i._url=a.href;let n=a.protocol==="wss:",o=a.protocol==="ws+unix:",u;if(a.protocol!=="ws:"&&!n&&!o?u=`The URL's protocol must be one of "ws:", "wss:", "http:", "https", or "ws+unix:"`:o&&!a.pathname?u="The URL's pathname is empty":a.hash&&(u="The URL contains a fragment identifier"),u){let y=new SyntaxError(u);if(i._redirects===0)throw y;ss(i,y);return}let l=n?443:80,c=Mc(16).toString("base64"),p=n?Nc.request:_c.request,f=new Set,m;if(r.createConnection=n?Gc:Kc,r.defaultPort=r.defaultPort||l,r.port=a.port||l,r.host=a.hostname.startsWith("[")?a.hostname.slice(1,-1):a.hostname,r.headers={...r.headers,"Sec-WebSocket-Version":r.protocolVersion,"Sec-WebSocket-Key":c,Connection:"Upgrade",Upgrade:"websocket"},r.path=a.pathname+a.search,r.timeout=r.handshakeTimeout,r.perMessageDeflate&&(m=new ye(r.perMessageDeflate!==!0?r.perMessageDeflate:{},!1,r.maxPayload),r.headers["Sec-WebSocket-Extensions"]=qc({[ye.extensionName]:m.offer()})),e.length){for(let y of e){if(typeof y!="string"||!Hc.test(y)||f.has(y))throw new SyntaxError("An invalid or duplicated subprotocol was specified");f.add(y)}r.headers["Sec-WebSocket-Protocol"]=e.join(",")}if(r.origin&&(r.protocolVersion<13?r.headers["Sec-WebSocket-Origin"]=r.origin:r.headers.Origin=r.origin),(a.username||a.password)&&(r.auth=`${a.username}:${a.password}`),o){let y=r.path.split(":");r.socketPath=y[0],r.path=y[1]}let d;if(r.followRedirects){if(i._redirects===0){i._originalIpc=o,i._originalSecure=n,i._originalHostOrSocketPath=o?r.socketPath:a.host;let y=s&&s.headers;if(s={...s,headers:{}},y)for(let[v,S]of Object.entries(y))s.headers[v.toLowerCase()]=S}else if(i.listenerCount("redirect")===0){let y=o?i._originalIpc?r.socketPath===i._originalHostOrSocketPath:!1:i._originalIpc?!1:a.host===i._originalHostOrSocketPath;(!y||i._originalSecure&&!n)&&(delete r.headers.authorization,delete r.headers.cookie,y||delete r.headers.host,r.auth=void 0)}r.auth&&!s.headers.authorization&&(s.headers.authorization="Basic "+Buffer.from(r.auth).toString("base64")),d=i._req=p(r),i._redirects&&i.emit("redirect",i.url,d)}else d=i._req=p(r);r.timeout&&d.on("timeout",()=>{z(i,d,"Opening handshake has timed out")}),d.on("error",y=>{d===null||d[An]||(d=i._req=null,ss(i,y))}),d.on("response",y=>{let v=y.headers.location,S=y.statusCode;if(v&&r.followRedirects&&S>=300&&S<400){if(++i._redirects>r.maxRedirects){z(i,d,"Maximum redirects exceeded");return}d.abort();let _;try{_=new br(v,t)}catch{let B=new SyntaxError(`Invalid URL: ${v}`);ss(i,B);return}En(i,_,e,s)}else i.emit("unexpected-response",d,y)||z(i,d,`Unexpected server response: ${y.statusCode}`)}),d.on("upgrade",(y,v,S)=>{if(i.emit("upgrade",y),i.readyState!==O.CONNECTING)return;if(d=i._req=null,y.headers.upgrade.toLowerCase()!=="websocket"){z(i,v,"Invalid Upgrade header");return}let _=Lc("sha1").update(c+Fc).digest("base64");if(y.headers["sec-websocket-accept"]!==_){z(i,v,"Invalid Sec-WebSocket-Accept header");return}let U=y.headers["sec-websocket-protocol"],B;if(U!==void 0?f.size?f.has(U)||(B="Server sent an invalid subprotocol"):B="Server sent a subprotocol but none was requested":f.size&&(B="Server sent no subprotocol"),B){z(i,v,B);return}U&&(i._protocol=U);let gt=y.headers["sec-websocket-extensions"];if(gt!==void 0){if(!m){z(i,v,"Server sent a Sec-WebSocket-Extensions header but no extension was requested");return}let xe;try{xe=Wc(gt)}catch{z(i,v,"Invalid Sec-WebSocket-Extensions header");return}let bt=Object.keys(xe);if(bt.length!==1||bt[0]!==ye.extensionName){z(i,v,"Server indicated an extension that was not requested");return}try{m.accept(xe[ye.extensionName])}catch{z(i,v,"Invalid Sec-WebSocket-Extensions header");return}i._extensions[ye.extensionName]=m}i.setSocket(v,S,{allowSynchronousEvents:r.allowSynchronousEvents,generateMask:r.generateMask,maxPayload:r.maxPayload,skipUTF8Validation:r.skipUTF8Validation})}),r.finishRequest?r.finishRequest(d,i):d.end()}function ss(i,t){i._readyState=O.CLOSING,i.emit("error",t),i.emitClose()}function Kc(i){return i.path=i.socketPath,Tn.connect(i)}function Gc(i){return i.path=void 0,!i.servername&&i.servername!==""&&(i.servername=Tn.isIP(i.host)?"":i.host),Oc.connect(i)}function z(i,t,e){i._readyState=O.CLOSING;let s=new Error(e);Error.captureStackTrace(s,z),t.setHeader?(t[An]=!0,t.abort(),t.socket&&!t.socket.destroyed&&t.socket.destroy(),process.nextTick(ss,i,s)):(t.destroy(s),t.once("error",i.emit.bind(i,"error")),t.once("close",i.emitClose.bind(i)))}function wr(i,t,e){if(t){let s=Vc(t).length;i._socket?i._sender._bufferedBytes+=s:i._bufferedAmount+=s}if(e){let s=new Error(`WebSocket is not open: readyState ${i.readyState} (${le[i.readyState]})`);process.nextTick(e,s)}}function Xc(i,t){let e=this[j];e._closeFrameReceived=!0,e._closeMessage=t,e._closeCode=i,e._socket[j]!==void 0&&(e._socket.removeListener("data",rs),process.nextTick(Cn,e._socket),i===1005?e.close():e.close(i,t))}function Jc(){let i=this[j];i.isPaused||i._socket.resume()}function Yc(i){let t=this[j];t._socket[j]!==void 0&&(t._socket.removeListener("data",rs),process.nextTick(Cn,t._socket),t.close(i[jc])),t.emit("error",i)}function wn(){this[j].emitClose()}function Qc(i,t){this[j].emit("message",i,t)}function Zc(i){let t=this[j];t._autoPong&&t.pong(i,!this._isServer,Sn),t.emit("ping",i)}function eh(i){this[j].emit("pong",i)}function Cn(i){i.resume()}function In(){let i=this[j];this.removeListener("close",In),this.removeListener("data",rs),this.removeListener("end",kn),i._readyState=O.CLOSING;let t;!this._readableState.endEmitted&&!i._closeFrameReceived&&!i._receiver._writableState.errorEmitted&&(t=i._socket.read())!==null&&i._receiver.write(t),i._receiver.end(),this[j]=void 0,clearTimeout(i._closeTimer),i._receiver._writableState.finished||i._receiver._writableState.errorEmitted?i.emitClose():(i._receiver.on("error",wn),i._receiver.on("finish",wn))}function rs(i){this[j]._receiver.write(i)||this.pause()}function kn(){let i=this[j];i._readyState=O.CLOSING,i._receiver.end(),this.end()}function Nn(){let i=this[j];this.removeListener("error",Nn),this.on("error",Sn),i&&(i._readyState=O.CLOSING,this.destroy())}});var Mn=A((vp,On)=>{"use strict";var{tokenChars:th}=pt();function sh(i){let t=new Set,e=-1,s=-1,r=0;for(r;r<i.length;r++){let n=i.charCodeAt(r);if(s===-1&&th[n]===1)e===-1&&(e=r);else if(r!==0&&(n===32||n===9))s===-1&&e!==-1&&(s=r);else if(n===44){if(e===-1)throw new SyntaxError(`Unexpected character at index ${r}`);s===-1&&(s=r);let o=i.slice(e,s);if(t.has(o))throw new SyntaxError(`The "${o}" subprotocol is duplicated`);t.add(o),e=s=-1}else throw new SyntaxError(`Unexpected character at index ${r}`)}if(e===-1||s!==-1)throw new SyntaxError("Unexpected end of input");let a=i.slice(e,r);if(t.has(a))throw new SyntaxError(`The "${a}" subprotocol is duplicated`);return t.add(a),t}On.exports={parse:sh}});var Un=A((Tp,jn)=>{"use strict";var rh=require("events"),is=require("http"),{Duplex:wp}=require("stream"),{createHash:ih}=require("crypto"),Ln=gr(),Se=ht(),ah=Mn(),nh=Tr(),{GUID:oh,kWebSocket:uh}=de(),lh=/^[+/0-9A-Za-z]{22}==$/,Dn=0,Bn=1,Rn=2,Sr=class extends rh{constructor(t,e){if(super(),t={allowSynchronousEvents:!1,autoPong:!0,maxPayload:100*1024*1024,skipUTF8Validation:!1,perMessageDeflate:!1,handleProtocols:null,clientTracking:!0,verifyClient:null,noServer:!1,backlog:null,server:null,host:null,path:null,port:null,WebSocket:nh,...t},t.port==null&&!t.server&&!t.noServer||t.port!=null&&(t.server||t.noServer)||t.server&&t.noServer)throw new TypeError('One and only one of the "port", "server", or "noServer" options must be specified');if(t.port!=null?(this._server=is.createServer((s,r)=>{let a=is.STATUS_CODES[426];r.writeHead(426,{"Content-Length":a.length,"Content-Type":"text/plain"}),r.end(a)}),this._server.listen(t.port,t.host,t.backlog,e)):t.server&&(this._server=t.server),this._server){let s=this.emit.bind(this,"connection");this._removeListeners=ch(this._server,{listening:this.emit.bind(this,"listening"),error:this.emit.bind(this,"error"),upgrade:(r,a,n)=>{this.handleUpgrade(r,a,n,s)}})}t.perMessageDeflate===!0&&(t.perMessageDeflate={}),t.clientTracking&&(this.clients=new Set,this._shouldEmitClose=!1),this.options=t,this._state=Dn}address(){if(this.options.noServer)throw new Error('The server is operating in "noServer" mode');return this._server?this._server.address():null}close(t){if(this._state===Rn){t&&this.once("close",()=>{t(new Error("The server is not running"))}),process.nextTick(yt,this);return}if(t&&this.once("close",t),this._state!==Bn)if(this._state=Bn,this.options.noServer||this.options.server)this._server&&(this._removeListeners(),this._removeListeners=this._server=null),this.clients?this.clients.size?this._shouldEmitClose=!0:process.nextTick(yt,this):process.nextTick(yt,this);else{let e=this._server;this._removeListeners(),this._removeListeners=this._server=null,e.close(()=>{yt(this)})}}shouldHandle(t){if(this.options.path){let e=t.url.indexOf("?");if((e!==-1?t.url.slice(0,e):t.url)!==this.options.path)return!1}return!0}handleUpgrade(t,e,s,r){e.on("error",Fn);let a=t.headers["sec-websocket-key"],n=+t.headers["sec-websocket-version"];if(t.method!=="GET"){Ae(this,t,e,405,"Invalid HTTP method");return}if(t.headers.upgrade.toLowerCase()!=="websocket"){Ae(this,t,e,400,"Invalid Upgrade header");return}if(!a||!lh.test(a)){Ae(this,t,e,400,"Missing or invalid Sec-WebSocket-Key header");return}if(n!==8&&n!==13){Ae(this,t,e,400,"Missing or invalid Sec-WebSocket-Version header");return}if(!this.shouldHandle(t)){xt(e,400);return}let o=t.headers["sec-websocket-protocol"],u=new Set;if(o!==void 0)try{u=ah.parse(o)}catch{Ae(this,t,e,400,"Invalid Sec-WebSocket-Protocol header");return}let l=t.headers["sec-websocket-extensions"],c={};if(this.options.perMessageDeflate&&l!==void 0){let p=new Se(this.options.perMessageDeflate,!0,this.options.maxPayload);try{let f=Ln.parse(l);f[Se.extensionName]&&(p.accept(f[Se.extensionName]),c[Se.extensionName]=p)}catch{Ae(this,t,e,400,"Invalid or unacceptable Sec-WebSocket-Extensions header");return}}if(this.options.verifyClient){let p={origin:t.headers[`${n===8?"sec-websocket-origin":"origin"}`],secure:!!(t.socket.authorized||t.socket.encrypted),req:t};if(this.options.verifyClient.length===2){this.options.verifyClient(p,(f,m,d,y)=>{if(!f)return xt(e,m||401,d,y);this.completeUpgrade(c,a,u,t,e,s,r)});return}if(!this.options.verifyClient(p))return xt(e,401)}this.completeUpgrade(c,a,u,t,e,s,r)}completeUpgrade(t,e,s,r,a,n,o){if(!a.readable||!a.writable)return a.destroy();if(a[uh])throw new Error("server.handleUpgrade() was called more than once with the same socket, possibly due to a misconfiguration");if(this._state>Dn)return xt(a,503);let l=["HTTP/1.1 101 Switching Protocols","Upgrade: websocket","Connection: Upgrade",`Sec-WebSocket-Accept: ${ih("sha1").update(e+oh).digest("base64")}`],c=new this.options.WebSocket(null,void 0,this.options);if(s.size){let p=this.options.handleProtocols?this.options.handleProtocols(s,r):s.values().next().value;p&&(l.push(`Sec-WebSocket-Protocol: ${p}`),c._protocol=p)}if(t[Se.extensionName]){let p=t[Se.extensionName].params,f=Ln.format({[Se.extensionName]:[p]});l.push(`Sec-WebSocket-Extensions: ${f}`),c._extensions=t}this.emit("headers",l,r),a.write(l.concat(`\r
17
17
  `).join(`\r
18
18
  `)),a.removeListener("error",Fn),c.setSocket(a,n,{allowSynchronousEvents:this.options.allowSynchronousEvents,maxPayload:this.options.maxPayload,skipUTF8Validation:this.options.skipUTF8Validation}),this.clients&&(this.clients.add(c),c.on("close",()=>{this.clients.delete(c),this._shouldEmitClose&&!this.clients.size&&process.nextTick(yt,this)})),o(c,r)}};jn.exports=Sr;function ch(i,t){for(let e of Object.keys(t))i.on(e,t[e]);return function(){for(let s of Object.keys(t))i.removeListener(s,t[s])}}function yt(i){i._state=Rn,i.emit("close")}function Fn(){this.destroy()}function xt(i,t,e,s){e=e||is.STATUS_CODES[t],s={Connection:"close","Content-Type":"text/html","Content-Length":Buffer.byteLength(e),...s},i.once("finish",i.destroy),i.end(`HTTP/1.1 ${t} ${is.STATUS_CODES[t]}\r
19
19
  `+Object.keys(s).map(r=>`${r}: ${s[r]}`).join(`\r