stackthread 0.1.0.dev2__py3-none-any.whl
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.
Potentially problematic release.
This version of stackthread might be problematic. Click here for more details.
- stackthread/__init__.py +6 -0
- stackthread/__main__.py +3 -0
- stackthread/_vendor/THIRD_PARTY_NOTICES.txt +23 -0
- stackthread/_vendor/extract.mjs +15 -0
- stackthread/adapters.py +130 -0
- stackthread/cli.py +342 -0
- stackthread/config.py +409 -0
- stackthread/detect.py +150 -0
- stackthread/lang/__init__.py +1 -0
- stackthread/lang/js/__init__.py +1 -0
- stackthread/lang/js/aliases.py +133 -0
- stackthread/lang/js/build.py +455 -0
- stackthread/lang/js/worker.py +186 -0
- stackthread/lang/python/__init__.py +1 -0
- stackthread/lang/python/build.py +249 -0
- stackthread/lang/python/extract.py +494 -0
- stackthread/lang/python/frameworks.py +700 -0
- stackthread/lang/python/orm.py +300 -0
- stackthread/lang/python/resolve.py +448 -0
- stackthread/lineage.py +965 -0
- stackthread/link.py +130 -0
- stackthread/logs.py +314 -0
- stackthread/model.py +161 -0
- stackthread/paths.py +173 -0
- stackthread/project.py +414 -0
- stackthread/report.py +203 -0
- stackthread/rules.py +48 -0
- stackthread/server/__init__.py +5 -0
- stackthread/server/app.py +696 -0
- stackthread/server/edit.py +108 -0
- stackthread/server/security.py +73 -0
- stackthread/static/THIRD_PARTY_NOTICES.txt +379 -0
- stackthread/static/app.css +1 -0
- stackthread/static/app.js +29 -0
- stackthread/static/index.html +16 -0
- stackthread-0.1.0.dev2.dist-info/METADATA +51 -0
- stackthread-0.1.0.dev2.dist-info/RECORD +40 -0
- stackthread-0.1.0.dev2.dist-info/WHEEL +4 -0
- stackthread-0.1.0.dev2.dist-info/entry_points.txt +2 -0
- stackthread-0.1.0.dev2.dist-info/licenses/LICENSE +21 -0
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// stackthread extractor (MIT). Bundles @babel/parser (MIT); see THIRD_PARTY_NOTICES.txt.
|
|
2
|
+
import{readFileSync as ss}from"node:fs";import{createInterface as vi}from"node:readline";var D=class{constructor(e,t,s){this.line=void 0,this.column=void 0,s!==void 0&&(this.index=void 0),this.line=e,this.column=t,s!==void 0&&(this.index=s)}},rt=class{start;end;filename;identifierName;constructor(e,t){this.start=e,this.end=t}};function U(n,e){let{line:t,column:s,index:i}=n;return new D(t,s+e,i+e)}var Ce="BABEL_PARSER_SOURCETYPE_MODULE_REQUIRED",is={ImportMetaOutsideModule:{message:`import.meta may appear only with 'sourceType: "module"'`,code:Ce},ImportOutsideModule:{message:`'import' and 'export' may appear only with 'sourceType: "module"'`,code:Ce}},Ne={ArrayPattern:"array destructuring pattern",AssignmentExpression:"assignment expression",AssignmentPattern:"assignment expression",ArrowFunctionExpression:"arrow function expression",ConditionalExpression:"conditional expression",CatchClause:"catch clause",ForOfStatement:"for-of statement",ForInStatement:"for-in statement",ForStatement:"for-loop",FormalParameters:"function parameter list",Identifier:"identifier",ImportSpecifier:"import specifier",ImportDefaultSpecifier:"import default specifier",ImportNamespaceSpecifier:"import namespace specifier",ObjectPattern:"object destructuring pattern",ParenthesizedExpression:"parenthesized expression",RestElement:"rest element",UpdateExpression:{true:"prefix operation",false:"postfix operation"},VariableDeclarator:"variable declaration",YieldExpression:"yield expression"},St=n=>n.type==="UpdateExpression"?Ne.UpdateExpression[`${n.prefix}`]:Ne[n.type],rs={AccessorIsGenerator:({kind:n})=>`A ${n}ter cannot be a generator.`,ArgumentsInClass:"'arguments' is only allowed in functions and class methods.",AsyncFunctionInSingleStatementContext:"Async functions can only be declared at the top level or inside a block.",AwaitBindingIdentifier:"Can not use 'await' as identifier inside an async function.",AwaitBindingIdentifierInStaticBlock:"Can not use 'await' as identifier inside a static block.",AwaitExpressionFormalParameter:"'await' is not allowed in async function parameters.",AwaitUsingNotInAsyncContext:"'await using' is only allowed within async functions and at the top levels of modules.",AwaitNotInAsyncContext:"'await' is only allowed within async functions and at the top levels of modules.",BadGetterArity:"A 'get' accessor must not have any formal parameters.",BadSetterArity:"A 'set' accessor must have exactly one formal parameter.",BadSetterRestParameter:"A 'set' accessor function argument must not be a rest parameter.",ConstructorClassField:"Classes may not have a field named 'constructor'.",ConstructorClassPrivateField:"Classes may not have a private field named '#constructor'.",ConstructorIsAccessor:"Class constructor may not be an accessor.",ConstructorIsAsync:"Constructor can't be an async function.",ConstructorIsGenerator:"Constructor can't be a generator.",DeclarationMissingInitializer:({kind:n})=>`Missing initializer in ${n} declaration.`,DecoratorArgumentsOutsideParentheses:"Decorator arguments must be moved inside parentheses: use '@(decorator(args))' instead of '@(decorator)(args)'.",DecoratorsBeforeAfterExport:"Decorators can be placed *either* before or after the 'export' keyword, but not in both locations at the same time.",DecoratorConstructor:"Decorators can't be used with a constructor. Did you mean '@dec class { ... }'?",DecoratorSemicolon:"Decorators must not be followed by a semicolon.",DecoratorStaticBlock:"Decorators can't be used with a static block.",DeferImportRequiresNamespace:'Only `import defer * as x from "./module"` is valid.',DeferExportInvalidAll:'`export defer * from "./module"` is invalid. Explicitly list the re-exported names.',DeletePrivateField:"Deleting a private field is not allowed.",DestructureNamedImport:"ES2015 named imports do not destructure. Use another statement for destructuring after the import.",DuplicateConstructor:"Duplicate constructor in the same class.",DuplicateDefaultExport:"Only one default export allowed per module.",DuplicateExport:({exportName:n})=>`\`${n}\` has already been exported. Exported identifiers must be unique.`,DuplicateProto:"Redefinition of __proto__ property.",DuplicateRegExpFlags:"Duplicate regular expression flag.",ElementAfterRest:"Rest element must be last element.",EscapedCharNotAnIdentifier:"Invalid Unicode escape.",ExportBindingIsString:({localName:n,exportName:e})=>`A string literal cannot be used as an exported binding without \`from\`.
|
|
3
|
+
- Did you mean \`export { '${n}' as '${e}' } from 'some-module'\`?`,ExportDefaultFromAsIdentifier:"'from' is not allowed as an identifier after 'export default'.",FilteredNamespaceDuplicateName:({name:n})=>`Duplicate name '${n}' in filtered namespace.`,FilteredNamespaceRename:"Names in a filtered namespace cannot be renamed using `as`.",FilteredNamespaceTypeModifier:"Names in a filtered namespace cannot have a type modifier.",ForInOfLoopInitializer:({type:n})=>`'${n==="ForInStatement"?"for-in":"for-of"}' loop variable declaration may not have an initializer.`,ForInUsing:"For-in loop may not start with 'using' declaration.",ForOfAsync:"The left-hand side of a for-of loop may not be 'async'.",ForOfLet:"The left-hand side of a for-of loop may not start with 'let'.",GeneratorInSingleStatementContext:"Generators can only be declared at the top level or inside a block.",IllegalBreakContinue:({type:n})=>`Unsyntactic ${n==="BreakStatement"?"break":"continue"}.`,IllegalLanguageModeDirective:"Illegal 'use strict' directive in function with non-simple parameter list.",IllegalReturn:"'return' outside of function.",ImportBindingIsString:({importName:n})=>`A string literal cannot be used as an imported binding.
|
|
4
|
+
- Did you mean \`import { "${n}" as foo }\`?`,ImportCallArity:({phase:n,sync:e})=>`\`import${n?`.${n}`:e?".sync":""}()\` requires exactly one or two arguments.`,ImportCallNotNewExpression:({phase:n,sync:e})=>`Cannot use new with import${n?`.${n}`:e?".sync":""}().`,ImportCallSpreadArgument:({phase:n,sync:e})=>`\`...\` is not allowed in \`import${n?`.${n}`:e?".sync":""}()\`.`,IncompatibleRegExpUVFlags:"The 'u' and 'v' regular expression flags cannot be enabled at the same time.",InvalidBigIntLiteral:"Invalid BigIntLiteral.",InvalidCodePoint:"Code point out of bounds.",InvalidCoverDiscardElement:"'void' must be followed by an expression when not used in a binding position.",InvalidCoverInitializedName:"Invalid shorthand property initializer.",InvalidDigit:({radix:n})=>`Expected number in radix ${n}.`,InvalidEscapeSequence:"Bad character escape sequence.",InvalidEscapeSequenceTemplate:"Invalid escape sequence in template.",InvalidEscapedReservedWord:({reservedWord:n})=>`Escape sequence in keyword ${n}.`,InvalidIdentifier:({identifierName:n})=>`Invalid identifier ${n}.`,InvalidLhs:({ancestor:n})=>`Invalid left-hand side in ${St(n)}.`,InvalidLhsBinding:({ancestor:n})=>`Binding invalid left-hand side in ${St(n)}.`,InvalidLhsOptionalChaining:({ancestor:n})=>`Invalid optional chaining in the left-hand side of ${St(n)}.`,InvalidOrMissingExponent:"Floating-point numbers require a valid exponent after the 'e'.",InvalidOrUnexpectedToken:({unexpected:n})=>`Unexpected character '${n}'.`,InvalidParenthesizedAssignment:"Invalid parenthesized assignment pattern.",InvalidPrivateFieldResolution:({identifierName:n})=>`Private name #${n} is not defined.`,InvalidPropertyBindingPattern:"Binding member expression.",InvalidRestAssignmentPattern:"Invalid rest operator's argument.",LabelRedeclaration:({labelName:n})=>`Label '${n}' is already declared.`,LetInLexicalBinding:"'let' is disallowed as a lexically bound name.",LineTerminatorBeforeArrow:"No line break is allowed before '=>'.",MalformedRegExpFlags:"Invalid regular expression flag.",MissingClassName:"A class name is required.",MissingEqInAssignment:"Only '=' operator can be used for specifying default value.",MissingSemicolon:"Missing semicolon.",MissingPlugin:({missingPlugin:n})=>`This experimental syntax requires enabling the parser plugin: ${n.map(e=>JSON.stringify(e)).join(", ")}.`,MissingOneOfPlugins:({missingPlugin:n})=>`This experimental syntax requires enabling one of the following parser plugin(s): ${n.map(e=>JSON.stringify(e)).join(", ")}.`,MissingUnicodeEscape:"Expecting Unicode escape sequence \\uXXXX.",MixingCoalesceWithLogical:"Nullish coalescing operator(??) requires parens when mixing with logical operators.",ModuleAttributeInvalidValue:"Only string literals are allowed as module attribute values.",ModuleAttributesWithDuplicateKeys:({key:n})=>`Duplicate key "${n}" is not allowed in module attributes.`,ModuleExportNameHasLoneSurrogate:({surrogateCharCode:n})=>`An export name cannot include a lone surrogate, found '\\u${n.toString(16)}'.`,ModuleExportUndefined:({localName:n})=>`Export '${n}' is not defined.`,MultipleDefaultsInSwitch:"Multiple default clauses.",NewlineAfterThrow:"Illegal newline after throw.",NoCatchOrFinally:"Missing catch or finally clause.",NumberIdentifier:"Identifier directly after number.",NumericSeparatorInEscapeSequence:"Numeric separators are not allowed inside unicode escape sequences or hex escape sequences.",ObsoleteAwaitStar:"'await*' has been removed from the async functions proposal. Use Promise.all() instead.",OptionalChainingNoNew:"Constructors in/after an Optional Chain are not allowed.",OptionalChainingNoTemplate:"Tagged Template Literals are not allowed in optionalChain.",OverrideOnConstructor:"'override' modifier cannot appear on a constructor declaration.",ParamDupe:"Argument name clash.",PatternHasAccessor:"Object pattern can't contain getter or setter.",PatternHasMethod:"Object pattern can't contain methods.",PrivateInExpectedIn:({identifierName:n})=>`Private names are only allowed in property accesses (\`obj.#${n}\`) or in \`in\` expressions (\`#${n} in obj\`).`,PrivateNameRedeclaration:({identifierName:n})=>`Duplicate private name #${n}.`,RestTrailingComma:"Unexpected trailing comma after rest element.",SloppyFunction:"In non-strict mode code, functions can only be declared at top level or inside a block.",SloppyFunctionAnnexB:"In non-strict mode code, functions can only be declared at top level, inside a block, or as the body of an if statement.",SourcePhaseImportRequiresDefault:'Only `import source x from "./module"` is valid.',StaticPrototype:"Classes may not have static property named prototype.",SuperCallNotNewExpression:"Cannot use new with super(...).",SuperNotAllowed:"`super()` is only valid inside a class constructor of a subclass. Maybe a typo in the method name ('constructor') or not extending another class?",SuperPrivateField:"Private fields can't be accessed on super.",TrailingDecorator:"Decorators must be attached to a class element.",UnexpectedArgumentPlaceholder:"Unexpected argument placeholder.",UnexpectedDigitAfterHash:"Unexpected digit after hash token.",UnexpectedImportExport:"'import' and 'export' may only appear at the top level.",UnexpectedKeyword:({keyword:n})=>`Unexpected keyword '${n}'.`,UnexpectedLeadingDecorator:"Leading decorators must be attached to a class declaration.",UnexpectedLexicalDeclaration:"Lexical declaration cannot appear in a single-statement context.",UnexpectedNewTarget:"`new.target` can only be used in functions or class properties.",UnexpectedNumericSeparator:"A numeric separator is only allowed between two digits.",UnexpectedPrivateField:"Unexpected private name.",UnexpectedReservedWord:({reservedWord:n})=>`Unexpected reserved word '${n}'.`,UnexpectedSuper:"'super' is only allowed in object methods and classes.",UnexpectedToken:({expected:n,unexpected:e})=>`Unexpected token${e?` '${e}'.`:""}${n?`, expected "${n}"`:""}`,UnexpectedTokenUnaryExponentiation:"Illegal expression. Wrap left hand side or entire exponentiation in parentheses.",UnexpectedUsingDeclaration:"Using declaration cannot appear in the top level when source type is `script` or in the bare case statement.",UnexpectedVoidPattern:"Unexpected void binding.",UnsupportedDecoratorExport:"A decorated export must export a class declaration.",UnsupportedDefaultExport:"Only expressions, functions or classes are allowed as the `default` export.",UnsupportedImport:"`import` can only be used in `import()` or `import.meta`.",UnsupportedMetaProperty:({target:n,onlyValidPropertyName:e})=>`The only valid meta property for ${n} is ${n}.${e}.`,UnsupportedParameterDecorator:"Decorators cannot be used to decorate parameters.",UnsupportedPropertyDecorator:"Decorators cannot be used to decorate object literal properties.",UnsupportedSuper:"'super' can only be used with function calls (i.e. super()) or in property accesses (i.e. super.prop or super[prop]).",UnterminatedComment:"Unterminated comment.",UnterminatedRegExp:"Unterminated regular expression.",UnterminatedString:"Unterminated string constant.",UnterminatedTemplate:"Unterminated template.",UsingDeclarationExport:"Using declaration cannot be exported.",UsingDeclarationHasBindingPattern:"Using declaration cannot have destructuring patterns.",VarRedeclaration:({identifierName:n})=>`Identifier '${n}' has already been declared.`,VoidPatternCatchClauseParam:"A void binding can not be the catch clause parameter. Use `try { ... } catch { ... }` if you want to discard the caught error.",VoidPatternInitializer:"A void binding may not have an initializer.",YieldBindingIdentifier:"Can not use 'yield' as identifier inside a generator.",YieldInParameter:"Yield expression is not allowed in formal parameters.",YieldNotInGeneratorFunction:"'yield' is only allowed within generator functions.",ZeroDigitNumericSeparator:"Numeric separator can not be used after leading 0."},as={StrictDelete:"Deleting local variable in strict mode.",StrictEvalArguments:({referenceName:n})=>`Assigning to '${n}' in strict mode.`,StrictEvalArgumentsBinding:({bindingName:n})=>`Binding '${n}' in strict mode.`,StrictFunction:"In strict mode code, functions can only be declared at top level or inside a block.",StrictNumericEscape:"The only valid numeric escape in strict mode is '\\0'.",StrictOctalLiteral:"Legacy octal literals are not allowed in strict mode.",StrictWith:"'with' in strict mode."},ns={ParseExpressionEmptyInput:"Unexpected parseExpression() input: The input is empty or contains only comments.",ParseExpressionExpectsEOF:({unexpected:n})=>`Unexpected parseExpression() input: The input should contain exactly one expression, but the first expression is followed by the unexpected character \`${String.fromCodePoint(n)}\`.`},os=new Set(["ArrowFunctionExpression","AssignmentExpression","ConditionalExpression","YieldExpression"]),cs={PipeTopicRequiresHackPipes:'Topic references are only supported when using the `"proposal": "hack"` version of the pipeline proposal.',PipeTopicUnbound:"Topic reference is unbound; it must be inside a pipe body.",PipeTopicUnconfiguredToken:({token:n})=>`Invalid topic token ${n}. In order to use ${n} as a topic reference, the pipelineOperator plugin must be configured with { "proposal": "hack", "topicToken": "${n}" }.`,PipeTopicUnused:"Hack-style pipe body does not contain a topic reference; Hack-style pipes must use topic at least once.",PipeUnparenthesizedBody:({type:n})=>`Hack-style pipe body cannot be an unparenthesized ${St({type:n})}; please wrap it in parentheses.`,PipelineUnparenthesized:"Cannot mix binary operator with solo-await F#-style pipeline. Please wrap the pipeline in parentheses."},hs={UnsupportedBind:"Binding should be performed on object property.",UnsupportedBindRHS:"The right-hand side of binding can not be super or import."};function Ie(n,e,t){Object.defineProperty(n,e,{enumerable:!1,configurable:!0,value:t})}function ls({toMessage:n,code:e,reasonCode:t,syntaxPlugin:s}){let i=t==="MissingPlugin"||t==="MissingOneOfPlugins";return function r(a,o,c){let h=new SyntaxError;return h.code=e,h.reasonCode=t,h.loc=a,h.pos=o,h.syntaxPlugin=s,i&&(h.missingPlugin=c.missingPlugin),Ie(h,"clone",function(u={}){let{line:f,column:d,index:y=o}=u.loc??a;return r(new D(f,d),y,{...c,...u.details})}),Ie(h,"details",c),Object.defineProperty(h,"message",{configurable:!0,get(){let l=`${n(c)} (${a.line}:${a.column})`;return this.message=l,l},set(l){Object.defineProperty(this,"message",{value:l,writable:!0})}}),h}}function $(n,e){if(Array.isArray(n))return s=>$(s,n[0]);let t={};for(let s of Object.keys(n)){let i=n[s],{message:r,...a}=typeof i=="string"?{message:()=>i}:typeof i=="function"?{message:i}:i,o=typeof r=="string"?()=>r:r;t[s]=ls({code:"BABEL_PARSER_SYNTAX_ERROR",reasonCode:s,toMessage:o,...e?{syntaxPlugin:e}:{},...a})}return t}var p={...$(is),...$(rs),...$(as),...$(ns),...$`pipelineOperator`(cs),...$`functionBind`(hs)};function ps(){return{sourceType:"script",sourceFilename:void 0,startIndex:0,startColumn:0,startLine:1,allowAwaitOutsideFunction:!1,allowReturnOutsideFunction:!1,allowNewTargetOutsideFunction:!1,allowImportExportEverywhere:!1,allowSuperOutsideMethod:!1,allowUndeclaredExports:!1,allowYieldOutsideFunction:!1,plugins:[],strictMode:void 0,ranges:!1,locations:!0,tokens:!1,createImportExpressions:!0,createParenthesizedExpressions:!1,errorRecovery:!1,attachComment:!0,annexB:!0}}function us(n){let e=ps();if(n==null)return e;if(n.annexB!=null&&n.annexB!==!1)throw new Error("The `annexB` option can only be set to `false`.");for(let t of Object.keys(e))n[t]!=null&&(e[t]=n[t]);if(e.startLine===1)n.startIndex==null&&e.startColumn>0?e.startIndex=e.startColumn:n.startColumn==null&&e.startIndex>0&&(e.startColumn=e.startIndex);else if(n.startColumn==null||n.startIndex==null)throw new Error("With a `startLine > 1` you must also specify `startIndex` and `startColumn`.");if(e.sourceType==="commonjs"){if(n.allowAwaitOutsideFunction!=null)throw new Error("The `allowAwaitOutsideFunction` option cannot be used with `sourceType: 'commonjs'`.");if(n.allowReturnOutsideFunction!=null)throw new Error("`sourceType: 'commonjs'` implies `allowReturnOutsideFunction: true`, please remove the `allowReturnOutsideFunction` option or use `sourceType: 'script'`.");if(n.allowNewTargetOutsideFunction!=null)throw new Error("`sourceType: 'commonjs'` implies `allowNewTargetOutsideFunction: true`, please remove the `allowNewTargetOutsideFunction` option or use `sourceType: 'script'`.")}return e}function tt(n){if(n.loc){let{start:e,end:t}=n.loc;n.loc.start=new D(e.line,e.column),n.loc.end=new D(t.line,t.column)}return n}var fs=n=>class extends n{createPosition(t){return new D(t.line,t.column)}parse(){let t=super.parse();return this.optionFlags&512&&(t.tokens=t.tokens.map(tt)),tt(t)}parseRegExpLiteral({pattern:t,flags:s}){let i=null;try{i=new RegExp(t,s)}catch{}let r=this.estreeParseLiteral(i);return r.regex={pattern:t,flags:s},r}parseBigIntLiteral(t){let s;try{s=BigInt(t)}catch{s=null}let i=this.estreeParseLiteral(s);return i.bigint=i.value!==null?String(i.value):t,i}estreeParseLiteral(t){return this.parseLiteral(t,"Literal")}parseStringLiteral(t){return this.estreeParseLiteral(t)}parseNumericLiteral(t){return this.estreeParseLiteral(t)}parseNullLiteral(){return this.estreeParseLiteral(null)}parseBooleanLiteral(t){return this.estreeParseLiteral(t)}estreeParseChainExpression(t,s){let i=this.startNodeAtNode(t);return i.expression=t,this.finishNodeAtNode(i,"ChainExpression",s)}directiveToStmt(t){let s=t.value;delete t.value,this.castNodeTo(s,"Literal"),s.raw=s.extra.raw,s.value=s.extra.expressionValue;let i=this.castNodeTo(t,"ExpressionStatement");return i.expression=s,i.directive=s.extra.rawValue,delete s.extra,i}fillOptionalPropertiesForTSESLint(t){}cloneEstreeStringLiteral(t){let{start:s,end:i,loc:r,range:a,raw:o,value:c}=t,h=Object.create(t.constructor.prototype);return h.type="Literal",h.start=s,h.end=i,h.loc=r,h.range=a,h.raw=o,h.value=c,h}initFunction(t,s){super.initFunction(t,s),t.expression=!1}checkDeclaration(t){t!=null&&this.isObjectProperty(t)?this.checkDeclaration(t.value):super.checkDeclaration(t)}getObjectOrClassMethodParams(t){return t.value.params}isValidDirective(t){return t.type==="ExpressionStatement"&&t.expression.type==="Literal"&&typeof t.expression.value=="string"&&!t.expression.extra?.parenthesized}parseBlockBody(t,s,i,r,a){super.parseBlockBody(t,s,i,r,a);let o=t.directives.map(c=>this.directiveToStmt(c));t.body=o.concat(t.body),delete t.directives}parsePrivateName(){let t=super.parsePrivateName();return this.convertPrivateNameToPrivateIdentifier(t)}convertPrivateNameToPrivateIdentifier(t){let s=super.getPrivateNameSV(t);return delete t.id,t.name=s,this.castNodeTo(t,"PrivateIdentifier")}isPrivateName(t){return t.type==="PrivateIdentifier"}getPrivateNameSV(t){return t.name}parseLiteral(t,s){let i=super.parseLiteral(t,s);return i.raw=i.extra.raw,delete i.extra,i}parseFunctionBody(t,s,i=!1){super.parseFunctionBody(t,s,i),t.expression=t.body.type!=="BlockStatement"}parseMethod(t,s,i,r,a,o,c=!1){let h=this.startNode();h.kind=t.kind,h=super.parseMethod(h,s,i,r,a,o,c),delete h.kind;let{typeParameters:l}=t;l&&(delete t.typeParameters,h.typeParameters=l,this.resetStartLocationFromNode(h,l));let u=this.castNodeTo(h,this.hasPlugin("typescript")&&!h.body?"TSEmptyBodyFunctionExpression":"FunctionExpression");return t.value=u,o==="ClassPrivateMethod"&&(t.computed=!1),this.hasPlugin("typescript")&&t.abstract?(delete t.abstract,this.finishNode(t,"TSAbstractMethodDefinition")):o==="ObjectMethod"?(t.kind==="method"&&(t.kind="init"),t.shorthand=!1,this.finishNode(t,"Property")):this.finishNode(t,"MethodDefinition")}nameIsConstructor(t){return t.type==="Literal"?t.value==="constructor":super.nameIsConstructor(t)}parseClassProperty(...t){let s=super.parseClassProperty(...t);return s.abstract&&this.hasPlugin("typescript")?(delete s.abstract,this.castNodeTo(s,"TSAbstractPropertyDefinition")):this.castNodeTo(s,"PropertyDefinition"),s}parseClassPrivateProperty(...t){let s=super.parseClassPrivateProperty(...t);return s.abstract&&this.hasPlugin("typescript")?this.castNodeTo(s,"TSAbstractPropertyDefinition"):this.castNodeTo(s,"PropertyDefinition"),s.computed=!1,s}parseClassAccessorProperty(t){let s=super.parseClassAccessorProperty(t);return s.abstract&&this.hasPlugin("typescript")?(delete s.abstract,this.castNodeTo(s,"TSAbstractAccessorProperty")):this.castNodeTo(s,"AccessorProperty"),s}parseObjectProperty(t,s,i,r){let a=super.parseObjectProperty(t,s,i,r);return a&&(a.kind="init",this.castNodeTo(a,"Property")),a}finishObjectProperty(t){return t.kind="init",this.finishNode(t,"Property")}isValidLVal(t,s,i,r){return t==="Property"?"value":super.isValidLVal(t,s,i,r)}isAssignable(t,s){return t!=null&&this.isObjectProperty(t)?this.isAssignable(t.value,s):super.isAssignable(t,s)}toAssignable(t,s=!1){if(t!=null&&this.isObjectProperty(t)){let{key:i,value:r}=t;this.isPrivateName(i)&&this.classScope.usePrivateName(this.getPrivateNameSV(i),i.start),this.toAssignable(r,s)}else super.toAssignable(t,s)}toAssignableObjectExpressionProp(t,s,i){t.type==="Property"&&(t.kind==="get"||t.kind==="set")?this.raise(p.PatternHasAccessor,t.key):t.type==="Property"&&t.method?this.raise(p.PatternHasMethod,t.key):super.toAssignableObjectExpressionProp(t,s,i)}finishCallExpression(t,s){let i=super.finishCallExpression(t,s);return i.callee.type==="Import"?(this.castNodeTo(i,"ImportExpression"),i.source=i.arguments[0],i.options=i.arguments[1]??null,delete i.arguments,delete i.callee):i.type==="OptionalCallExpression"?this.castNodeTo(i,"CallExpression"):i.optional=!1,i}parseExport(t,s){let i=this.state.lastTokStartLoc,r=super.parseExport(t,s);switch(r.type){case"ExportAllDeclaration":r.exported=null;break;case"ExportNamedDeclaration":r.specifiers.length===1&&r.specifiers[0].type==="ExportNamespaceSpecifier"&&!r.specifiers[0].exportsFilter&&(this.castNodeTo(r,"ExportAllDeclaration"),r.exported=r.specifiers[0].exported,delete r.specifiers);case"ExportDefaultDeclaration":{let{declaration:a}=r;a?.type==="ClassDeclaration"&&a.decorators?.length>0&&a.start===r.start&&this.resetStartLocation(r,i)}break}return r}stopParseSubscript(t,s){let i=super.stopParseSubscript(t,s);return s.optionalChainMember?this.estreeParseChainExpression(i,t):i}parseMember(t,s,i,r,a){let o=super.parseMember(t,s,i,r,a);return o.type==="OptionalMemberExpression"?this.castNodeTo(o,"MemberExpression"):o.optional=!1,o}isOptionalMemberExpression(t){return t.type==="ChainExpression"?t.expression.type==="MemberExpression":super.isOptionalMemberExpression(t)}hasPropertyAsPrivateName(t){return t.type==="ChainExpression"&&(t=t.expression),super.hasPropertyAsPrivateName(t)}isObjectProperty(t){return t.type==="Property"&&t.kind==="init"&&!t.method}isObjectMethod(t){return t.type==="Property"&&(t.method||t.kind==="get"||t.kind==="set")}castNodeTo(t,s){let i=super.castNodeTo(t,s);return this.fillOptionalPropertiesForTSESLint(i),i}cloneIdentifier(t){let s=super.cloneIdentifier(t);return this.fillOptionalPropertiesForTSESLint(s),s}cloneStringLiteral(t){return t.type==="Literal"?this.cloneEstreeStringLiteral(t):super.cloneStringLiteral(t)}finishNodeAt(t,s,i){return tt(super.finishNodeAt(t,s,i))}finishNodeAtNode(t,s,i){return tt(super.finishNodeAtNode(t,s,i))}finishNode(t,s){let i=super.finishNode(t,s);return this.fillOptionalPropertiesForTSESLint(i),i}resetStartLocation(t,s){super.resetStartLocation(t,s),tt(t)}resetEndLocation(t,s=this.state.lastTokEndLoc){super.resetEndLocation(t,s),tt(t)}},N=!0,x=!0,Dt=!0,ot=!0,H=!0,ds=!0,Ct=class{label;keyword;beforeExpr;startsExpr;rightAssociative;isLoop;isAssign;prefix;postfix;binop;constructor(e,t={}){this.label=e,this.keyword=t.keyword,this.beforeExpr=!!t.beforeExpr,this.startsExpr=!!t.startsExpr,this.rightAssociative=!!t.rightAssociative,this.isLoop=!!t.isLoop,this.isAssign=!!t.isAssign,this.prefix=!!t.prefix,this.postfix=!!t.postfix,this.binop=t.binop!=null?t.binop:null}},le=new Map;function I(n,e={}){e.keyword=n;let t=T(n,e);return le.set(n,t),t}function O(n,e){return T(n,{beforeExpr:N,binop:e})}var lt=-1,pe=[],ue=[],fe=[],de=[],me=[],ye=[];function T(n,e={}){return++lt,ue.push(n),fe.push(e.binop??-1),de.push(e.beforeExpr??!1),me.push(e.startsExpr??!1),ye.push(e.prefix??!1),pe.push(new Ct(n,e)),lt}function A(n,e={}){return++lt,le.set(n,lt),ue.push(n),fe.push(e.binop??-1),de.push(e.beforeExpr??!1),me.push(e.startsExpr??!1),ye.push(e.prefix??!1),pe.push(new Ct("name",e)),lt}var ms={bracketL:T("[",{beforeExpr:N,startsExpr:x}),bracketR:T("]"),braceL:T("{",{beforeExpr:N,startsExpr:x}),braceBarL:T("{|",{beforeExpr:N,startsExpr:x}),braceR:T("}"),braceBarR:T("|}"),parenL:T("(",{beforeExpr:N,startsExpr:x}),parenR:T(")"),comma:T(",",{beforeExpr:N}),semi:T(";",{beforeExpr:N}),colon:T(":",{beforeExpr:N}),doubleColon:T("::",{beforeExpr:N}),dot:T("."),question:T("?",{beforeExpr:N}),questionDot:T("?."),arrow:T("=>",{beforeExpr:N}),template:T("template"),ellipsis:T("...",{beforeExpr:N}),backQuote:T("`",{startsExpr:x}),dollarBraceL:T("${",{beforeExpr:N,startsExpr:x}),templateTail:T("...`",{startsExpr:x}),templateNonTail:T("...${",{beforeExpr:N,startsExpr:x}),at:T("@"),hash:T("#",{startsExpr:x}),interpreterDirective:T("#!..."),eq:T("=",{beforeExpr:N,isAssign:ot}),assign:T("_=",{beforeExpr:N,isAssign:ot}),slashAssign:T("_=",{beforeExpr:N,isAssign:ot}),xorAssign:T("_=",{beforeExpr:N,isAssign:ot}),moduloAssign:T("_=",{beforeExpr:N,isAssign:ot}),incDec:T("++/--",{prefix:H,postfix:ds,startsExpr:x}),bang:T("!",{beforeExpr:N,prefix:H,startsExpr:x}),tilde:T("~",{beforeExpr:N,prefix:H,startsExpr:x}),doubleCaret:T("^^",{startsExpr:x}),doubleAt:T("@@",{startsExpr:x}),pipeline:O("|>",0),nullishCoalescing:O("??",1),logicalOR:O("||",1),logicalAND:O("&&",2),bitwiseOR:O("|",3),bitwiseXOR:O("^",4),bitwiseAND:O("&",5),equality:O("==/!=/===/!==",6),lt:O("</>/<=/>=",7),gt:O("</>/<=/>=",7),relational:O("</>/<=/>=",7),bitShift:O("<</>>/>>>",8),bitShiftL:O("<</>>/>>>",8),bitShiftR:O("<</>>/>>>",8),plusMin:T("+/-",{beforeExpr:N,binop:9,prefix:H,startsExpr:x}),modulo:T("%",{binop:10,startsExpr:x}),star:T("*",{binop:10}),slash:O("/",10),exponent:T("**",{beforeExpr:N,binop:11,rightAssociative:!0}),_in:I("in",{beforeExpr:N,binop:7}),_instanceof:I("instanceof",{beforeExpr:N,binop:7}),_break:I("break"),_case:I("case",{beforeExpr:N}),_catch:I("catch"),_continue:I("continue"),_debugger:I("debugger"),_default:I("default",{beforeExpr:N}),_else:I("else",{beforeExpr:N}),_finally:I("finally"),_function:I("function",{startsExpr:x}),_if:I("if"),_return:I("return",{beforeExpr:N}),_switch:I("switch"),_throw:I("throw",{beforeExpr:N,prefix:H,startsExpr:x}),_try:I("try"),_var:I("var"),_const:I("const"),_with:I("with"),_new:I("new",{beforeExpr:N,startsExpr:x}),_this:I("this",{startsExpr:x}),_super:I("super",{startsExpr:x}),_class:I("class",{startsExpr:x}),_extends:I("extends",{beforeExpr:N}),_export:I("export"),_import:I("import",{startsExpr:x}),_null:I("null",{startsExpr:x}),_true:I("true",{startsExpr:x}),_false:I("false",{startsExpr:x}),_typeof:I("typeof",{beforeExpr:N,prefix:H,startsExpr:x}),_void:I("void",{beforeExpr:N,prefix:H,startsExpr:x}),_delete:I("delete",{beforeExpr:N,prefix:H,startsExpr:x}),_do:I("do",{isLoop:Dt,beforeExpr:N}),_for:I("for",{isLoop:Dt}),_while:I("while",{isLoop:Dt}),_arguments:A("arguments",{startsExpr:x}),_as:A("as",{startsExpr:x}),_assert:A("assert",{startsExpr:x}),_async:A("async",{startsExpr:x}),_await:A("await",{startsExpr:x}),_defer:A("defer",{startsExpr:x}),_from:A("from",{startsExpr:x}),_get:A("get",{startsExpr:x}),_let:A("let",{startsExpr:x}),_meta:A("meta",{startsExpr:x}),_of:A("of",{startsExpr:x}),_sent:A("sent",{startsExpr:x}),_set:A("set",{startsExpr:x}),_source:A("source",{startsExpr:x}),_static:A("static",{startsExpr:x}),_struct:A("struct",{startsExpr:x}),_sync:A("sync",{startsExpr:x}),_using:A("using",{startsExpr:x}),_yield:A("yield",{startsExpr:x}),_asserts:A("asserts",{startsExpr:x}),_checks:A("checks",{startsExpr:x}),_exports:A("exports",{startsExpr:x}),_global:A("global",{startsExpr:x}),_implements:A("implements",{startsExpr:x}),_intrinsic:A("intrinsic",{startsExpr:x}),_infer:A("infer",{startsExpr:x}),_is:A("is",{startsExpr:x}),_mixins:A("mixins",{startsExpr:x}),_proto:A("proto",{startsExpr:x}),_require:A("require",{startsExpr:x}),_satisfies:A("satisfies",{startsExpr:x}),_keyof:A("keyof",{startsExpr:x}),_readonly:A("readonly",{startsExpr:x}),_unique:A("unique",{startsExpr:x}),_abstract:A("abstract",{startsExpr:x}),_declare:A("declare",{startsExpr:x}),_enum:A("enum",{startsExpr:x}),_module:A("module",{startsExpr:x}),_namespace:A("namespace",{startsExpr:x}),_interface:A("interface",{startsExpr:x}),_type:A("type",{startsExpr:x}),_opaque:A("opaque",{startsExpr:x}),name:T("name",{startsExpr:x}),placeholder:T("%%",{startsExpr:x}),string:T("string",{startsExpr:x}),num:T("num",{startsExpr:x}),bigint:T("bigint",{startsExpr:x}),regexp:T("regexp",{startsExpr:x}),privateName:T("#name",{startsExpr:x}),eof:T("eof"),jsxName:T("jsxName"),jsxText:T("jsxText",{beforeExpr:N}),jsxTagStart:T("jsxTagStart",{startsExpr:x}),jsxTagEnd:T("jsxTagEnd")};function E(n){return n>=89&&n<=132}function ys(n){return n<=88}function F(n){return n>=54&&n<=132}function je(n){return n>=54&&n<=135}function xs(n){return de[n]}function ht(n){return me[n]}function gs(n){return n>=25&&n<=29}function Ee(n){return n>=128&&n<=130}function Ps(n){return n>=86&&n<=88}function wt(n){return n>=54&&n<=88}function Ts(n){return n>=35&&n<=55}function Ss(n){return n===30}function As(n){return ye[n]}function bs(n){return n>=120&&n<=122}function Cs(n){return n>=123&&n<=129}function W(n){return ue[n]}function At(n){return fe[n]}function Ns(n){return n===53}function _t(n){return n>=20&&n<=21}function _e(n){return pe[n]}var et=class{constructor(e,t){this.token=e,this.preserveSpace=!!t}token;preserveSpace},k={brace:new et("{"),j_oTag:new et("<tag"),j_cTag:new et("</tag"),j_expr:new et("<tag>...</tag>",!0)},we=/[\p{ID_Start}\u0558\u058b\u058c\u088f\u0c5c\u0cdc\u208f\u209d-\u209f\ua7ce\ua7cf\ua7d2\ua7d4\ua7dd\ua7e2\ua7f1\uab6c\uab6d]/u,ke=/[\p{ID_Continue}\u0558\u058b\u058c\u088f\u0c5c\u0cdc\u208f\u209d-\u209f\ua7ce\ua7cf\ua7d2\ua7d4\ua7dd\ua7e2\ua7f1\uab6c\uab6d\u05c8\u05c9\u0b53\u0b54\u1acf-\u1af0]/u,$e=[1979,4,385,25,1388,2,18,21,3100,0,678,43,22,0,1662,0,6,10,209,310,18458,24,3,24,287,4,6146,7,1239,4,47,23,96,114,14,913,15,50,8017,5,64,0,9534,0,2169,5,7,86,15,6,55,50,1729,30,2,2,2,1,2,6,3,4,10,1,53307,5,223,0,5764,11,21763,4297,39815,11327],Is=[3787,4,33,11,3173,7,633,9,7,0,45879,1,296,2,9,1,3,0,33,1,5218,0,3,0,8,1,6,0];function $t(n,e){let t=65536;for(let s=0,i=e.length;s<i;s+=2){if(t+=e[s],t>n)return!1;if(t+=e[s+1],t>=n)return!0}return!1}function z(n){return n<65?n===36:n<=90?!0:n<97?n===95:n<=122?!0:n<=65535?n>=170&&we.test(String.fromCharCode(n)):!isNaN(n)&&n<=1114111&&(we.test(String.fromCodePoint(n))||$t(n,$e))}function J(n){return n<48?n===36:n<58?!0:n<65?!1:n<=90?!0:n<97?n===95:n<=122?!0:n<=65535?n>=170&&ke.test(String.fromCharCode(n)):!isNaN(n)&&n<=1114111&&(ke.test(String.fromCodePoint(n))||$t(n,$e)||$t(n,Is))}var xe={keyword:["break","case","catch","continue","debugger","default","do","else","finally","for","function","if","return","switch","throw","try","var","const","while","with","new","this","super","class","extends","export","import","null","true","false","in","instanceof","typeof","void","delete"],strict:["implements","interface","let","package","private","protected","public","static","yield"],strictBind:["eval","arguments"]},Es=new Set(xe.keyword),ws=new Set(xe.strict),ks=new Set(xe.strictBind);function ge(n,e){return e&&n==="await"||n==="enum"}function ze(n,e){return ge(n,e)||ws.has(n)}function Ve(n){return ks.has(n)}function qe(n,e){return ze(n,e)||Ve(n)}function He(n){return Es.has(n)}function vs(n,e,t){return n===64&&e===64&&z(t)}var Ls=new Set(["break","case","catch","continue","debugger","default","do","else","finally","for","function","if","return","switch","throw","try","var","const","while","with","new","this","super","class","extends","export","import","null","true","false","in","instanceof","typeof","void","delete","implements","interface","let","package","private","protected","public","static","yield","eval","arguments","enum","await"]);function Ds(n){return Ls.has(n)}var pt=class{flags=0;names=new Map;firstLexicalName="";constructor(e){this.flags=e}},ut=class{parser;scopeStack=[];inModule;undefinedExports=new Map;constructor(e,t){this.parser=e,this.inModule=t}get inTopLevel(){return(this.currentScope().flags&1)>0}get inFunction(){return(this.currentVarScopeFlags()&2)>0}get allowSuper(){return(this.currentThisScopeFlags()&16)>0}get allowDirectSuper(){return(this.currentThisScopeFlags()&32)>0}get allowNewTarget(){return(this.currentThisScopeFlags()&512)>0}get inClass(){return(this.currentThisScopeFlags()&64)>0}get inClassAndNotInNonArrowFunction(){let e=this.currentThisScopeFlags();return(e&64)>0&&(e&2)===0}get inStaticBlock(){for(let e=this.scopeStack.length-1;;e--){let{flags:t}=this.scopeStack[e];if(t&128)return!0;if(t&3779)return!1}}get inNonArrowFunction(){return(this.currentThisScopeFlags()&2)>0}get inBareCaseStatement(){return(this.currentScope().flags&256)>0}get treatFunctionsAsVar(){return this.treatFunctionsAsVarInScope(this.currentScope())}createScope(e){return new pt(e)}enter(e){this.scopeStack.push(this.createScope(e))}exit(){return this.scopeStack.pop().flags}treatFunctionsAsVarInScope(e){return!!(e.flags&130||!this.parser.inModule&&e.flags&1)}declareName(e,t,s){let i=this.currentScope();if(t&8||t&16){this.checkRedeclarationInScope(i,e,t,s);let r=i.names.get(e)||0;t&16?r=r|4:(i.firstLexicalName||(i.firstLexicalName=e),r=r|2),i.names.set(e,r),t&8&&this.maybeExportDefined(i,e)}else if(t&4)for(let r=this.scopeStack.length-1;r>=0&&(i=this.scopeStack[r],this.checkRedeclarationInScope(i,e,t,s),i.names.set(e,(i.names.get(e)||0)|1),this.maybeExportDefined(i,e),!(i.flags&3715));--r);this.parser.inModule&&i.flags&1&&this.undefinedExports.delete(e)}maybeExportDefined(e,t){this.parser.inModule&&e.flags&1&&this.undefinedExports.delete(t)}checkRedeclarationInScope(e,t,s,i){this.isRedeclaredInScope(e,t,s)&&this.parser.raise(p.VarRedeclaration,i,{identifierName:t})}isRedeclaredInScope(e,t,s){if(!(s&1))return!1;if(s&8)return e.names.has(t);let i=e.names.get(t)||0;return s&16?(i&2)>0||!this.treatFunctionsAsVarInScope(e)&&(i&1)>0:(i&2)>0&&!(e.flags&8&&e.firstLexicalName===t)||!this.treatFunctionsAsVarInScope(e)&&(i&4)>0}checkLocalExport(e){let{name:t}=e;this.scopeStack[0].names.has(t)||this.undefinedExports.set(t,e.start)}currentScope(){return this.scopeStack[this.scopeStack.length-1]}currentVarScopeFlags(){for(let e=this.scopeStack.length-1;;e--){let{flags:t}=this.scopeStack[e];if(t&3715)return t}}currentThisScopeFlags(){for(let e=this.scopeStack.length-1;;e--){let{flags:t}=this.scopeStack[e];if(t&3779&&!(t&4))return t}}},zt=class extends pt{declareFunctions=new Set},Vt=class extends ut{createScope(e){return new zt(e)}declareName(e,t,s){let i=this.currentScope();if(t&2048){this.checkRedeclarationInScope(i,e,t,s),this.maybeExportDefined(i,e),i.declareFunctions.add(e);return}super.declareName(e,t,s)}isRedeclaredInScope(e,t,s){if(super.isRedeclaredInScope(e,t,s))return!0;if(s&2048&&!e.declareFunctions.has(t)){let i=e.names.get(t);return(i&4)>0||(i&2)>0}return!1}checkLocalExport(e){this.scopeStack[0].declareFunctions.has(e.name)||super.checkLocalExport(e)}},Os=new Set(["_","any","bool","boolean","empty","extends","false","interface","mixed","null","number","static","string","true","typeof","void"]),Fs={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:n})=>`Cannot overwrite reserved type ${n}.`,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:n,enumName:e})=>`Boolean enum members need to be initialized. Use either \`${n} = true,\` or \`${n} = false,\` in enum \`${e}\`.`,EnumDuplicateMemberName:({memberName:n,enumName:e})=>`Enum member names need to be unique, but the name \`${n}\` has already been used before in enum \`${e}\`.`,EnumInconsistentMemberValues:({enumName:n})=>`Enum \`${n}\` has inconsistent member initializers. Either use no initializers, or consistently use literals (either booleans, numbers, or strings) for all member initializers.`,EnumInvalidExplicitType:({invalidEnumType:n,enumName:e})=>`Enum type \`${n}\` is not valid. Use one of \`boolean\`, \`number\`, \`string\`, or \`symbol\` in enum \`${e}\`.`,EnumInvalidExplicitTypeUnknownSupplied:({enumName:n})=>`Supplied enum type is not valid. Use one of \`boolean\`, \`number\`, \`string\`, or \`symbol\` in enum \`${n}\`.`,EnumInvalidMemberInitializerPrimaryType:({enumName:n,memberName:e,explicitType:t})=>`Enum \`${n}\` has type \`${t}\`, so the initializer of \`${e}\` needs to be a ${t} literal.`,EnumInvalidMemberInitializerSymbolType:({enumName:n,memberName:e})=>`Symbol enum members cannot be initialized. Use \`${e},\` in enum \`${n}\`.`,EnumInvalidMemberInitializerUnknownType:({enumName:n,memberName:e})=>`The enum member initializer for \`${e}\` needs to be a literal (either a boolean, number, or string) in enum \`${n}\`.`,EnumInvalidMemberName:({enumName:n,memberName:e,suggestion:t})=>`Enum member names cannot start with lowercase 'a' through 'z'. Instead of using \`${e}\`, consider using \`${t}\`, in enum \`${n}\`.`,EnumNumberMemberNotInitialized:({enumName:n,memberName:e})=>`Number enum members need to be initialized, e.g. \`${e} = 1\` in enum \`${n}\`.`,EnumStringMemberInconsistentlyInitialized:({enumName:n})=>`String enum members need to consistently either all use initializers, or use no initializers, in enum \`${n}\`.`,GetterMayNotHaveThisParam:"A getter cannot have a `this` parameter.",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:{message:"A binding pattern parameter cannot be optional in an implementation signature."},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:n})=>`Unexpected reserved type ${n}.`,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:n,suggestion:e})=>`\`declare export ${n}\` is not supported. Use \`${e}\` instead.`,UnsupportedStatementInDeclareModule:"Only declares and type imports are allowed inside declare module.",UnterminatedFlowComment:"Unterminated flow-comment."},g=$`flow`(Fs);function Ms(n){return n.type==="DeclareExportAllDeclaration"||n.type==="DeclareExportDeclaration"&&(!n.declaration||n.declaration.type!=="TypeAlias"&&n.declaration.type!=="InterfaceDeclaration")}function Ot(n){return n.importKind==="type"||n.importKind==="typeof"}var Bs={const:"declare export var",let:"declare export var",type:"export type",interface:"export interface"};function Rs(n,e){let t=[],s=[];for(let i=0;i<n.length;i++)(e(n[i],i,n)?t:s).push(n[i]);return[t,s]}var Us=/\*?\s*@((?:no)?flow)\b/,js=n=>class extends n{flowPragma=void 0;getScopeHandler(){return Vt}shouldParseTypes(){return this.getPluginOption("flow","all")||this.flowPragma==="flow"}finishToken(t,s){t!==133&&t!==9&&t!==24&&this.flowPragma===void 0&&(this.flowPragma=null),super.finishToken(t,s)}addComment(t){if(this.flowPragma===void 0){let s=Us.exec(t.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(t)}flowParseTypeInitialiser(t){let s=this.state.inType;this.state.inType=!0,this.expect(t||10);let i=this.flowParseType();return this.state.inType=s,i}flowParsePredicate(){let t=this.startNode(),s=this.state.startLoc;return this.next(),this.expectContextual(109),this.state.lastTokStartLoc.index>s.index+1&&this.raise(g.UnexpectedSpaceBetweenModuloChecks,s),this.eat(6)?(t.value=super.parseExpression(),this.expect(7),this.finishNode(t,"DeclaredPredicate")):this.finishNode(t,"InferredPredicate")}flowParseTypeAndPredicateInitialiser(t){let s=this.state.inType;this.state.inType=!0,this.expect(10);let i=null,r=null;return t&&this.match(50)?(this.state.inType=s,r=this.flowParsePredicate()):(i=this.flowParseType(),this.state.inType=s,this.match(50)&&(r=this.flowParsePredicate())),[i,r]}flowParseDeclareClass(t){return this.next(),this.flowParseInterfaceish(t,!0),this.finishNode(t,"DeclareClass")}flowParseDeclareFunction(t){this.next();let s=t.id=this.parseIdentifier(),i=this.startNode(),r=this.startNode();this.match(43)?i.typeParameters=this.flowParseTypeParameterDeclaration():i.typeParameters=null,this.expect(6);let a=this.flowParseFunctionTypeParams();return i.params=a.params,i.rest=a.rest,i.this=a._this,this.expect(7),[i.returnType,t.predicate]=this.flowParseTypeAndPredicateInitialiser(!1),r.typeAnnotation=this.finishNode(i,"FunctionTypeAnnotation"),s.typeAnnotation=this.finishNode(r,"TypeAnnotation"),this.resetEndLocation(s),this.semicolon(),this.scope.declareName(t.id.name,2048,t.id.start),this.finishNode(t,"DeclareFunction")}flowParseDeclare(t,s){if(this.match(76))return this.flowParseDeclareClass(t);if(this.match(64))return this.flowParseDeclareFunction(t);if(this.match(70))return this.flowParseDeclareVariable(t);if(this.eatContextual(126))return this.match(12)?this.flowParseDeclareModuleExports(t):(s&&this.raise(g.NestedDeclareModule,this.state.lastTokStartLoc),this.flowParseDeclareModule(t));if(this.isContextual(129))return this.flowParseDeclareTypeAlias(t);if(this.isContextual(130))return this.flowParseDeclareOpaqueType(t);if(this.isContextual(128))return this.flowParseDeclareInterface(t);if(this.match(78))return this.flowParseDeclareExportDeclaration(t,s);throw this.unexpected()}flowParseDeclareVariable(t){return this.next(),t.id=this.flowParseTypeAnnotatableIdentifier(),this.scope.declareName(t.id.name,5,t.id.start),this.semicolon(),this.finishNode(t,"DeclareVariable")}flowParseDeclareModule(t){this.scope.enter(0),this.match(133)?t.id=super.parseExprAtom():t.id=this.parseIdentifier();let s=this.startNode(),i=s.body=[];for(this.expect(2);!this.match(4);){let o=this.startNode();this.match(79)?(this.next(),!this.isContextual(129)&&!this.match(83)&&this.raise(g.InvalidNonTypeImportInDeclareModule,this.state.lastTokStartLoc),i.push(super.parseImport(o))):(this.expectContextual(124,g.UnsupportedStatementInDeclareModule),i.push(this.flowParseDeclare(o,!0)))}this.scope.exit(),this.expect(4),t.body=this.finishNode(s,"BlockStatement");let r=null,a=!1;return i.forEach(o=>{Ms(o)?(r==="CommonJS"&&this.raise(g.AmbiguousDeclareModuleKind,o),r="ES"):o.type==="DeclareModuleExports"&&(a&&this.raise(g.DuplicateDeclareModuleExports,o),r==="ES"&&this.raise(g.AmbiguousDeclareModuleKind,o),r="CommonJS",a=!0)}),t.kind=r||"CommonJS",this.finishNode(t,"DeclareModule")}flowParseDeclareExportDeclaration(t,s){if(this.expect(78),this.eat(61))return this.match(64)||this.match(76)?t.declaration=this.flowParseDeclare(this.startNode()):(t.declaration=this.flowParseType(),this.semicolon()),t.default=!0,this.finishNode(t,"DeclareExportDeclaration");if(this.match(71)||this.isLet()||(this.isContextual(129)||this.isContextual(128))&&!s){let i=this.state.value;throw this.raise(g.UnsupportedDeclareExportKind,this.state.startLoc,{unsupportedExportKind:i,suggestion:Bs[i]})}if(this.match(70)||this.match(64)||this.match(76)||this.isContextual(130))return t.declaration=this.flowParseDeclare(this.startNode()),t.default=!1,this.finishNode(t,"DeclareExportDeclaration");if(this.match(51)||this.match(2)||this.isContextual(128)||this.isContextual(129)||this.isContextual(130)){let i=this.parseExport(t,null);return i.type==="ExportNamedDeclaration"?(i.default=!1,delete i.exportKind,this.castNodeTo(i,"DeclareExportDeclaration")):this.castNodeTo(i,"DeclareExportAllDeclaration")}throw this.unexpected()}flowParseDeclareModuleExports(t){return this.next(),this.expectContextual(110),t.typeAnnotation=this.flowParseTypeAnnotation(),this.semicolon(),this.finishNode(t,"DeclareModuleExports")}flowParseDeclareTypeAlias(t){this.next();let s=this.flowParseTypeAlias(t);return this.castNodeTo(s,"DeclareTypeAlias"),s}flowParseDeclareOpaqueType(t){return this.next(),this.flowParseOpaqueType(t,!0)}flowParseDeclareInterface(t){return this.next(),this.flowParseInterfaceish(t,!1),this.finishNode(t,"DeclareInterface")}flowParseInterfaceish(t,s){if(t.id=this.flowParseRestrictedIdentifier(!s,!0),this.scope.declareName(t.id.name,s?17:8201,t.id.start),this.match(43)?t.typeParameters=this.flowParseTypeParameterDeclaration():t.typeParameters=null,t.extends=[],this.eat(77))do t.extends.push(this.flowParseInterfaceExtends());while(!s&&this.eat(8));if(s){let i=[],r=[];if(this.eatContextual(116))do r.push(this.flowParseInterfaceExtends());while(this.eat(8));if(this.eatContextual(112))do i.push(this.flowParseClassImplements());while(this.eat(8));t.implements=i,t.mixins=r}t.body=this.flowParseObjectType({allowStatic:s,allowExact:!1,allowSpread:!1,allowProto:s,allowInexact:!1})}flowParseInterfaceExtends(){let t=this.startNode();return t.id=this.flowParseQualifiedTypeIdentifier(),this.match(43)?t.typeParameters=this.flowParseTypeParameterInstantiation():t.typeParameters=null,this.finishNode(t,"InterfaceExtends")}flowParseInterface(t){return this.flowParseInterfaceish(t,!1),this.finishNode(t,"InterfaceDeclaration")}checkNotUnderscore(t){t==="_"&&this.raise(g.UnexpectedReservedUnderscore,this.state.startLoc)}checkReservedType(t,s,i){Os.has(t)&&this.raise(i?g.AssignReservedType:g.UnexpectedReservedType,s,{reservedType:t})}flowParseRestrictedIdentifierName(t,s){return this.checkReservedType(this.state.value,this.state.startLoc,s),this.parseIdentifierName(t)}flowParseRestrictedIdentifier(t,s){let i=this.startNode(),r=this.flowParseRestrictedIdentifierName(t,s);return this.createIdentifier(i,r)}flowParseTypeAlias(t){return t.id=this.flowParseRestrictedIdentifier(!1,!0),this.scope.declareName(t.id.name,8201,t.id.start),this.match(43)?t.typeParameters=this.flowParseTypeParameterDeclaration():t.typeParameters=null,t.right=this.flowParseTypeInitialiser(25),this.semicolon(),this.finishNode(t,"TypeAlias")}flowParseOpaqueType(t,s){return this.expectContextual(129),t.id=this.flowParseRestrictedIdentifier(!0,!0),this.scope.declareName(t.id.name,8201,t.id.start),this.match(43)?t.typeParameters=this.flowParseTypeParameterDeclaration():t.typeParameters=null,t.supertype=null,this.match(10)&&(t.supertype=this.flowParseTypeInitialiser(10)),t.impltype=null,s||(t.impltype=this.flowParseTypeInitialiser(25)),this.semicolon(),this.finishNode(t,s?"DeclareOpaqueType":"OpaqueType")}flowParseTypeParameterBound(){if(this.match(10)||this.isContextual(77)){let t=this.startNode();return this.next(),t.typeAnnotation=this.flowParseType(),this.finishNode(t,"TypeAnnotation")}}flowParseTypeParameter(t=!1){let s=this.state.startLoc,i=this.startNode(),r=this.flowParseVariance();return i.name=this.flowParseRestrictedIdentifierName(),i.variance=r,i.bound=this.flowParseTypeParameterBound(),this.match(25)?(this.eat(25),i.default=this.flowParseType()):t&&this.raise(g.MissingTypeParamDefault,s),this.finishNode(i,"TypeParameter")}flowParseTypeParameterDeclaration(){let t=this.state.inType,s=this.startNode();s.params=[],this.state.inType=!0,this.match(43)||this.match(141)?this.next():this.unexpected();let i=!1;do{let r=this.flowParseTypeParameter(i);s.params.push(r),r.default&&(i=!0),this.match(44)||this.expect(8)}while(!this.match(44));return this.expect(44),this.state.inType=t,this.finishNode(s,"TypeParameterDeclaration")}flowInTopLevelContext(t){if(this.curContext()!==k.brace){let s=this.state.context;this.state.context=[s[0]];try{return t()}finally{this.state.context=s}}else return t()}flowParseTypeParameterInstantiationInExpression(){if(this.reScan_lt()===43)return this.flowParseTypeParameterInstantiation()}flowParseTypeParameterInstantiation(){let t=this.startNode(),s=this.state.inType;return this.state.inType=!0,t.params=[],this.flowInTopLevelContext(()=>{this.expect(43);let i=this.state.noAnonFunctionType;for(this.state.noAnonFunctionType=!1;!this.match(44);)t.params.push(this.flowParseType()),this.match(44)||this.expect(8);this.state.noAnonFunctionType=i}),this.state.inType=s,!this.state.inType&&this.curContext()===k.brace&&this.reScan_lt_gt(),this.expect(44),this.finishNode(t,"TypeParameterInstantiation")}flowParseTypeParameterInstantiationCallOrNew(){if(this.reScan_lt()!==43)return null;let t=this.startNode(),s=this.state.inType;for(t.params=[],this.state.inType=!0,this.expect(43);!this.match(44);)t.params.push(this.flowParseTypeOrImplicitInstantiation()),this.match(44)||this.expect(8);return this.expect(44),this.state.inType=s,this.finishNode(t,"TypeParameterInstantiation")}flowParseInterfaceType(){let t=this.startNode();if(this.expectContextual(128),t.extends=[],this.eat(77))do t.extends.push(this.flowParseInterfaceExtends());while(this.eat(8));return t.body=this.flowParseObjectType({allowStatic:!1,allowExact:!1,allowSpread:!1,allowProto:!1,allowInexact:!1}),this.finishNode(t,"InterfaceTypeAnnotation")}flowParseObjectPropertyKey(){return this.match(134)||this.match(133)?super.parseExprAtom():this.parseIdentifier(!0)}flowParseObjectTypeIndexer(t,s,i){return t.static=s,this.lookahead().type===10?(t.id=this.parseIdentifier(!0),t.key=this.flowParseTypeInitialiser()):(t.id=null,t.key=this.flowParseType()),this.expect(1),t.value=this.flowParseTypeInitialiser(),t.variance=i,this.finishNode(t,"ObjectTypeIndexer")}flowParseObjectTypeInternalSlot(t,s){return t.static=s,t.id=this.parseIdentifier(!0),this.expect(1),this.expect(1),this.match(43)||this.match(6)?(t.method=!0,t.optional=!1,t.value=this.flowParseObjectTypeMethodish(this.startNodeAtNode(t))):(t.method=!1,this.eat(13)&&(t.optional=!0),t.value=this.flowParseTypeInitialiser()),this.finishNode(t,"ObjectTypeInternalSlot")}flowParseObjectTypeMethodish(t){for(t.params=[],t.rest=null,t.typeParameters=null,t.this=null,this.match(43)&&(t.typeParameters=this.flowParseTypeParameterDeclaration()),this.expect(6),this.match(74)&&(t.this=this.flowParseFunctionTypeParam(!0),t.this.name=null,this.match(7)||this.expect(8));!this.match(7)&&!this.match(17);)t.params.push(this.flowParseFunctionTypeParam(!1)),this.match(7)||this.expect(8);return this.eat(17)&&(t.rest=this.flowParseFunctionTypeParam(!1)),this.expect(7),t.returnType=this.flowParseTypeInitialiser(),this.finishNode(t,"FunctionTypeAnnotation")}flowParseObjectTypeCallProperty(t,s){let i=this.startNode();return t.static=s,t.value=this.flowParseObjectTypeMethodish(i),this.finishNode(t,"ObjectTypeCallProperty")}flowParseObjectType({allowStatic:t,allowExact:s,allowSpread:i,allowProto:r,allowInexact:a}){let o=this.state.inType;this.state.inType=!0;let c=this.startNode();c.callProperties=[],c.properties=[],c.indexers=[],c.internalSlots=[];let h,l,u=!1;for(s&&this.match(3)?(this.expect(3),h=5,l=!0):(this.expect(2),h=4,l=!1),c.exact=l;!this.match(h);){let d=!1,y=null,P=null,C=this.startNode();if(r&&this.isContextual(117)){let w=this.lookahead();w.type!==10&&w.type!==13&&(this.next(),y=this.state.startLoc,t=!1)}if(t&&this.isContextual(103)){let w=this.lookahead();w.type!==10&&w.type!==13&&(this.next(),d=!0)}let S=this.flowParseVariance();if(this.eat(0))y!=null&&this.unexpected(y),this.eat(0)?(S&&this.unexpected(S.start),c.internalSlots.push(this.flowParseObjectTypeInternalSlot(C,d))):c.indexers.push(this.flowParseObjectTypeIndexer(C,d,S));else if(this.match(6)||this.match(43))y!=null&&this.unexpected(y),S&&this.unexpected(S.start),c.callProperties.push(this.flowParseObjectTypeCallProperty(C,d));else{let w="init";if(this.isContextual(96)||this.isContextual(101)){let _=this.lookahead();je(_.type)&&(w=this.state.value,this.next())}let j=this.flowParseObjectTypeProperty(C,d,y,S,w,i,a??!l);j===null?(u=!0,P=this.state.lastTokStartLoc):c.properties.push(j)}this.flowObjectTypeSemicolon(),P&&!this.match(4)&&!this.match(5)&&this.raise(g.UnexpectedExplicitInexactInObject,P)}this.expect(h),i&&(c.inexact=u);let f=this.finishNode(c,"ObjectTypeAnnotation");return this.state.inType=o,f}flowParseObjectTypeProperty(t,s,i,r,a,o,c){if(this.eat(17))return this.match(8)||this.match(9)||this.match(4)||this.match(5)?(o?c||this.raise(g.InexactInsideExact,this.state.lastTokStartLoc):this.raise(g.InexactInsideNonObject,this.state.lastTokStartLoc),r&&this.raise(g.InexactVariance,r),null):(o||this.raise(g.UnexpectedSpreadType,this.state.lastTokStartLoc),i!=null&&this.unexpected(i),r&&this.raise(g.SpreadVariance,r),t.argument=this.flowParseType(),this.finishNode(t,"ObjectTypeSpreadProperty"));{t.key=this.flowParseObjectPropertyKey(),t.static=s,t.proto=i!=null,t.kind=a;let h=!1;return this.match(43)||this.match(6)?(t.method=!0,i!=null&&this.unexpected(i),r&&this.unexpected(r.start),t.value=this.flowParseObjectTypeMethodish(this.startNodeAtNode(t)),a==="get"||a==="set"?this.flowCheckGetterSetterParams(t):!s&&!o&&t.key.name==="constructor"&&t.value.this&&this.raise(g.ThisParamBannedInConstructor,t.value.this)):(a!=="init"&&this.unexpected(),t.method=!1,this.eat(13)&&(h=!0),t.value=this.flowParseTypeInitialiser(),t.variance=r),t.optional=h,this.finishNode(t,"ObjectTypeProperty")}}flowCheckGetterSetterParams(t){let s=t.kind==="get"?0:1,i=t.value,r=i.params.length+(i.rest?1:0);i.this&&this.raise(t.kind==="get"?g.GetterMayNotHaveThisParam:g.SetterMayNotHaveThisParam,i.this),r!==s&&this.raise(t.kind==="get"?p.BadGetterArity:p.BadSetterArity,t),t.kind==="set"&&i.rest&&this.raise(p.BadSetterRestParameter,t)}flowObjectTypeSemicolon(){!this.eat(9)&&!this.eat(8)&&!this.match(4)&&!this.match(5)&&this.unexpected()}flowParseQualifiedTypeIdentifier(t,s){t??=this.state.startLoc;let i=s||this.flowParseRestrictedIdentifier(!0);for(;this.eat(12);){let r=this.startNodeAt(t);r.qualification=i,r.id=this.flowParseRestrictedIdentifier(!0),i=this.finishNode(r,"QualifiedTypeIdentifier")}return i}flowParseGenericType(t,s){let i=this.startNodeAt(t);return i.typeParameters=null,i.id=this.flowParseQualifiedTypeIdentifier(t,s),this.match(43)&&(i.typeParameters=this.flowParseTypeParameterInstantiation()),this.finishNode(i,"GenericTypeAnnotation")}flowParseTypeofType(){let t=this.startNode();return this.expect(83),t.argument=this.flowParsePrimaryType(),this.finishNode(t,"TypeofTypeAnnotation")}flowParseTupleType(){let t=this.startNode();for(t.types=[],this.expect(0);this.state.pos<this.length&&!this.match(1)&&(t.types.push(this.flowParseType()),!this.match(1));)this.expect(8);return this.expect(1),this.finishNode(t,"TupleTypeAnnotation")}flowParseFunctionTypeParam(t){let s=null,i=!1,r,a=this.startNode(),o=this.lookahead(),c=this.state.type===74;return o.type===10||o.type===13?(c&&!t&&this.raise(g.ThisParamMustBeFirst,a),s=this.parseIdentifier(c),this.eat(13)&&(i=!0,c&&this.raise(g.ThisParamMayNotBeOptional,a)),r=this.flowParseTypeInitialiser()):r=this.flowParseType(),a.name=s,a.optional=i,a.typeAnnotation=r,this.finishNode(a,"FunctionTypeParam")}reinterpretTypeAsFunctionTypeParam(t){let s=this.startNodeAtNode(t);return s.name=null,s.optional=!1,s.typeAnnotation=t,this.finishNode(s,"FunctionTypeParam")}flowParseFunctionTypeParams(t=[]){let s=null,i=null;for(this.match(74)&&(i=this.flowParseFunctionTypeParam(!0),i.name=null,this.match(7)||this.expect(8));!this.match(7)&&!this.match(17);)t.push(this.flowParseFunctionTypeParam(!1)),this.match(7)||this.expect(8);return this.eat(17)&&(s=this.flowParseFunctionTypeParam(!1)),{params:t,rest:s,_this:i}}flowIdentToTypeAnnotation(t,s,i){switch(i.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(i.name),this.flowParseGenericType(t,i)}}flowParsePrimaryType(){let t=this.state.startLoc,s=this.startNode(),i,r,a=!1,o=this.state.noAnonFunctionType;switch(this.state.type){case 2:return this.flowParseObjectType({allowStatic:!1,allowExact:!1,allowSpread:!0,allowProto:!1,allowInexact:!0});case 3:return this.flowParseObjectType({allowStatic:!1,allowExact:!0,allowSpread:!0,allowProto:!1,allowInexact:!1});case 0:return this.state.noAnonFunctionType=!1,r=this.flowParseTupleType(),this.state.noAnonFunctionType=o,r;case 43:{let c=this.startNode();return c.typeParameters=this.flowParseTypeParameterDeclaration(),this.expect(6),i=this.flowParseFunctionTypeParams(),c.params=i.params,c.rest=i.rest,c.this=i._this,this.expect(7),this.expect(15),c.returnType=this.flowParseType(),this.finishNode(c,"FunctionTypeAnnotation")}case 6:{let c=this.startNode();if(this.next(),!this.match(7)&&!this.match(17))if(E(this.state.type)||this.match(74)){let h=this.lookahead().type;a=h!==13&&h!==10}else a=!0;if(a){if(this.state.noAnonFunctionType=!1,r=this.flowParseType(),this.state.noAnonFunctionType=o,this.state.noAnonFunctionType||!(this.match(8)||this.match(7)&&this.lookahead().type===15))return this.expect(7),r;this.eat(8)}return r?i=this.flowParseFunctionTypeParams([this.reinterpretTypeAsFunctionTypeParam(r)]):i=this.flowParseFunctionTypeParams(),c.params=i.params,c.rest=i.rest,c.this=i._this,this.expect(7),this.expect(15),c.returnType=this.flowParseType(),c.typeParameters=null,this.finishNode(c,"FunctionTypeAnnotation")}case 133:return this.parseLiteral(this.state.value,"StringLiteralTypeAnnotation");case 81:case 82:return s.value=this.match(81),this.next(),this.finishNode(s,"BooleanLiteralTypeAnnotation");case 49: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(g.UnexpectedSubtractionOperand,this.state.startLoc)}throw this.unexpected();case 134:return this.parseLiteral(this.state.value,"NumberLiteralTypeAnnotation");case 135:return this.parseLiteral(this.state.value,"BigIntLiteralTypeAnnotation");case 84:return this.next(),this.finishNode(s,"VoidTypeAnnotation");case 80:return this.next(),this.finishNode(s,"NullLiteralTypeAnnotation");case 74:return this.next(),this.finishNode(s,"ThisTypeAnnotation");case 51:return this.next(),this.finishNode(s,"ExistsTypeAnnotation");case 83:return this.flowParseTypeofType();default:if(wt(this.state.type)){let c=W(this.state.type);return this.next(),super.createIdentifier(s,c)}else if(E(this.state.type))return this.isContextual(128)?this.flowParseInterfaceType():this.flowIdentToTypeAnnotation(t,s,this.parseIdentifier())}throw this.unexpected()}flowParsePostfixType(){let t=this.state.startLoc,s=this.flowParsePrimaryType(),i=!1;for(;(this.match(0)||this.match(14))&&!this.canInsertSemicolon();){let r=this.startNodeAt(t),a=this.eat(14);i=i||a,this.expect(0),!a&&this.match(1)?(r.elementType=s,this.next(),s=this.finishNode(r,"ArrayTypeAnnotation")):(r.objectType=s,r.indexType=this.flowParseType(),this.expect(1),i?(r.optional=a,s=this.finishNode(r,"OptionalIndexedAccessType")):s=this.finishNode(r,"IndexedAccessType"))}return s}flowParsePrefixType(){let t=this.startNode();return this.eat(13)?(t.typeAnnotation=this.flowParsePrefixType(),this.finishNode(t,"NullableTypeAnnotation")):this.flowParsePostfixType()}flowParseAnonFunctionWithoutParens(){let t=this.flowParsePrefixType();if(!this.state.noAnonFunctionType&&this.eat(15)){let s=this.startNodeAtNode(t);return s.params=[this.reinterpretTypeAsFunctionTypeParam(t)],s.rest=null,s.this=null,s.returnType=this.flowParseType(),s.typeParameters=null,this.finishNode(s,"FunctionTypeAnnotation")}return t}flowParseIntersectionType(){let t=this.startNode();this.eat(41);let s=this.flowParseAnonFunctionWithoutParens();for(t.types=[s];this.eat(41);)t.types.push(this.flowParseAnonFunctionWithoutParens());return t.types.length===1?s:this.finishNode(t,"IntersectionTypeAnnotation")}flowParseUnionType(){let t=this.startNode();this.eat(39);let s=this.flowParseIntersectionType();for(t.types=[s];this.eat(39);)t.types.push(this.flowParseIntersectionType());return t.types.length===1?s:this.finishNode(t,"UnionTypeAnnotation")}flowParseType(){let t=this.state.inType;this.state.inType=!0;let s=this.flowParseUnionType();return this.state.inType=t,s}flowParseTypeOrImplicitInstantiation(){if(this.state.type===131&&this.state.value==="_"){let t=this.state.startLoc,s=this.parseIdentifier();return this.flowParseGenericType(t,s)}else return this.flowParseType()}flowParseTypeAnnotation(){let t=this.startNode();return t.typeAnnotation=this.flowParseTypeInitialiser(),this.finishNode(t,"TypeAnnotation")}flowParseTypeAnnotatableIdentifier(){let t=this.startNode(),s=this.parseIdentifierName();return this.match(10)&&(t.typeAnnotation=this.flowParseTypeAnnotation()),this.createIdentifier(t,s)}typeCastToParameter(t){return t.expression.typeAnnotation=t.typeAnnotation,this.resetEndLocationFromNode(t.expression,t.typeAnnotation),t.expression}flowParseVariance(){let t=null;return this.match(49)?(t=this.startNode(),this.state.value==="+"?t.kind="plus":t.kind="minus",this.next(),this.finishNode(t,"Variance")):t}parseFunctionBody(t,s,i=!1){if(s){this.forwardNoArrowParamsConversionAt(t,()=>super.parseFunctionBody(t,!0,i));return}super.parseFunctionBody(t,!1,i)}parseFunctionBodyAndFinish(t,s,i=!1){if(this.match(10)){let r=this.startNode();s==="FunctionDeclaration"||s==="FunctionExpression"||s==="ArrowFunctionExpression"?[r.typeAnnotation,t.predicate]=this.flowParseTypeAndPredicateInitialiser(!0):r.typeAnnotation=this.flowParseTypeInitialiser(),t.returnType=r.typeAnnotation?this.finishNode(r,"TypeAnnotation"):null}return super.parseFunctionBodyAndFinish(t,s,i)}parseStatementLike(t){if(this.state.strict&&this.isContextual(128)){let i=this.lookahead();if(F(i.type)){let r=this.startNode();return this.next(),this.flowParseInterface(r)}}else if(this.isContextual(125)){let i=this.startNode();return this.next(),this.flowParseEnumDeclaration(i)}let s=super.parseStatementLike(t);return this.flowPragma===void 0&&!this.isValidDirective(s)&&(this.flowPragma=null),s}parseExpressionStatement(t,s,i){if(s.type==="Identifier"){if(s.name==="declare"){if(this.match(76)||E(this.state.type)||this.match(64)||this.match(70)||this.match(78))return this.flowParseDeclare(t)}else if(E(this.state.type)){if(s.name==="interface")return this.flowParseInterface(t);if(s.name==="type")return this.flowParseTypeAlias(t);if(s.name==="opaque")return this.flowParseOpaqueType(t,!1)}}return super.parseExpressionStatement(t,s,i)}shouldParseExportDeclaration(){let{type:t}=this.state;return t===125||Ee(t)?!this.state.containsEsc:super.shouldParseExportDeclaration()}isExportDefaultSpecifier(){let{type:t}=this.state;return t===125||Ee(t)?this.state.containsEsc:super.isExportDefaultSpecifier()}parseExportDefaultExpression(){if(this.isContextual(125)){let t=this.startNode();return this.next(),this.flowParseEnumDeclaration(t)}return super.parseExportDefaultExpression()}parseConditional(t,s,i){if(!this.match(13))return t;if(i!=null){let d=this.lookaheadCharCode();if(d===44||d===61||d===58||d===41)return this.setOptionalParametersError(i),t}this.expect(13);let r=this.state.clone(),a=this.state.noArrowAt,o=this.startNodeAt(s),{consequent:c,failed:h}=this.tryParseConditionalConsequent(),l=this.getArrowLikeExpressions(c),u=l[0],f=l[1];if(h||f.length>0){let d=[...a];if(f.length>0){this.state=r,this.state.noArrowAt=d;for(let y=0;y<f.length;y++)d.push(f[y].start);({consequent:c,failed:h}=this.tryParseConditionalConsequent()),[u]=this.getArrowLikeExpressions(c)}h&&u.length>1&&this.raise(g.AmbiguousConditionalArrow,r.startLoc),h&&u.length===1&&(this.state=r,d.push(u[0].start),this.state.noArrowAt=d,{consequent:c}=this.tryParseConditionalConsequent())}return this.getArrowLikeExpressions(c,!0),this.state.noArrowAt=a,this.expect(10),o.test=t,o.consequent=c,o.alternate=this.forwardNoArrowParamsConversionAt(o,()=>this.parseMaybeAssign()),this.finishNode(o,"ConditionalExpression")}tryParseConditionalConsequent(){this.state.noArrowParamsConversionAt.push(this.state.start);let t=this.parseMaybeAssignAllowIn(),s=!this.match(10);return this.state.noArrowParamsConversionAt.pop(),{consequent:t,failed:s}}getArrowLikeExpressions(t,s){let i=[t],r=[];for(;i.length!==0;){let a=i.pop();a.type==="ArrowFunctionExpression"?(a.typeParameters||!a.returnType?this.finishArrowValidation(a):r.push(a),a.body.type!=="BlockStatement"&&i.push(a.body)):a.type==="ConditionalExpression"&&(i.push(a.consequent),i.push(a.alternate))}return s?(r.forEach(a=>this.finishArrowValidation(a)),[r,[]]):Rs(r,a=>a.params.every(o=>this.isAssignable(o,!0)))}finishArrowValidation(t){this.toAssignableList(t.params,t.extra?.trailingCommaLoc,!1),this.scope.enter(518),super.checkParams(t,!1,!0),this.scope.exit()}forwardNoArrowParamsConversionAt(t,s){let i;return this.state.noArrowParamsConversionAt.includes(this.offsetToSourcePos(t.start))?(this.state.noArrowParamsConversionAt.push(this.state.start),i=s(),this.state.noArrowParamsConversionAt.pop()):i=s(),i}parseParenItem(t,s){let i=super.parseParenItem(t,s);if(this.eat(13)&&(i.optional=!0,this.resetEndLocation(t)),this.match(10)){let r=this.startNodeAt(s);return r.expression=i,r.typeAnnotation=this.flowParseTypeAnnotation(),this.finishNode(r,"TypeCastExpression")}return i}assertModuleNodeAllowed(t){t.type==="ImportDeclaration"&&(t.importKind==="type"||t.importKind==="typeof")||t.type==="ExportNamedDeclaration"&&t.exportKind==="type"||t.type==="ExportAllDeclaration"&&t.exportKind==="type"||super.assertModuleNodeAllowed(t)}parseExportDeclaration(t){if(this.isContextual(129)){t.exportKind="type";let s=this.startNode();return this.next(),this.match(2)?(t.specifiers=this.parseExportSpecifiers(!0),super.parseExportFrom(t),null):this.flowParseTypeAlias(s)}else if(this.isContextual(130)){t.exportKind="type";let s=this.startNode();return this.next(),this.flowParseOpaqueType(s,!1)}else if(this.isContextual(128)){t.exportKind="type";let s=this.startNode();return this.next(),this.flowParseInterface(s)}else if(this.isContextual(125)){t.exportKind="value";let s=this.startNode();return this.next(),this.flowParseEnumDeclaration(s)}else return super.parseExportDeclaration(t)}eatExportStar(t){return super.eatExportStar(t)?!0:this.isContextual(129)&&this.lookahead().type===51?(t.exportKind="type",this.next(),this.next(),!0):!1}maybeParseExportNamespaceSpecifier(t){let{startLoc:s}=this.state,i=super.maybeParseExportNamespaceSpecifier(t);return i&&t.exportKind==="type"&&this.unexpected(s),i}maybeParseExportNamedSpecifiers(t){if(!super.maybeParseExportNamedSpecifiers(t))return!1;let s=t.specifiers[t.specifiers.length-1];return t.exportKind==="type"&&s?.type==="ExportNamespaceSpecifier"&&this.unexpected(s.start),!0}parseClassId(t,s,i){if((!s||i)&&this.isContextual(112)){t.id=null;return}super.parseClassId(t,s,i),this.match(43)&&(t.typeParameters=this.flowParseTypeParameterDeclaration())}parseClassMember(t,s,i){let{startLoc:r}=this.state;if(this.isContextual(124)){if(super.parseClassMemberFromModifier(t,s))return;s.declare=!0}super.parseClassMember(t,s,i),s.declare&&(s.type!=="ClassProperty"&&s.type!=="ClassPrivateProperty"&&s.type!=="PropertyDefinition"?this.raise(g.DeclareClassElement,r):s.value&&this.raise(g.DeclareClassFieldInitializer,s.value))}isIterator(t){return t==="iterator"||t==="asyncIterator"}readIterator(){let t=super.readWord1(),s="@@"+t;(!this.isIterator(t)||!this.state.inType)&&this.raise(p.InvalidIdentifier,this.state.curPosition(),{identifierName:s}),this.finishToken(131,s)}getTokenFromCode(t){let s=this.input.charCodeAt(this.state.pos+1);t===123&&s===124?this.finishOp(3,2):this.state.inType&&(t===62||t===60)?this.finishOp(t===62?44:43,1):this.state.inType&&t===63?s===46?this.finishOp(14,2):this.finishOp(13,1):vs(t,s,this.input.charCodeAt(this.state.pos+2))?(this.state.pos+=2,this.readIterator()):super.getTokenFromCode(t)}isAssignable(t,s){return t.type==="TypeCastExpression"?this.isAssignable(t.expression,s):super.isAssignable(t,s)}toAssignable(t,s=!1){!s&&t.type==="AssignmentExpression"&&t.left.type==="TypeCastExpression"&&(t.left=this.typeCastToParameter(t.left)),super.toAssignable(t,s)}toAssignableListItem(t,s,i){let r=t[s];r.type==="TypeCastExpression"&&(t[s]=this.typeCastToParameter(r)),super.toAssignableListItem(t,s,i)}toReferencedList(t,s){for(let i=0;i<t.length;i++){let r=t[i];r?.type==="TypeCastExpression"&&!r.extra?.parenthesized&&(t.length>1||!s)&&this.raise(g.TypeCastInPattern,r.typeAnnotation)}return t}parseArrayLike(t,s){let i=super.parseArrayLike(t,s);return i.type==="ArrayExpression"&&this.toReferencedList(i.elements),i}isValidLVal(t,s,i,r){return t==="TypeCastExpression"||super.isValidLVal(t,s,i,r)}parseClassProperty(t){return this.match(10)&&(t.typeAnnotation=this.flowParseTypeAnnotation()),super.parseClassProperty(t)}parseClassPrivateProperty(t){return this.match(10)&&(t.typeAnnotation=this.flowParseTypeAnnotation()),super.parseClassPrivateProperty(t)}isClassMethod(){return this.match(43)||super.isClassMethod()}isClassProperty(){return this.match(10)||super.isClassProperty()}isNonstaticConstructor(t){return!this.match(10)&&super.isNonstaticConstructor(t)}pushClassMethod(t,s,i,r,a,o){if(s.variance&&this.unexpected(s.variance.start),delete s.variance,this.match(43)&&(s.typeParameters=this.flowParseTypeParameterDeclaration()),super.pushClassMethod(t,s,i,r,a,o),s.params&&a){let c=s.params;c.length>0&&this.isThisParam(c[0])&&this.raise(g.ThisParamBannedInConstructor,s)}else if(s.type==="MethodDefinition"&&a&&s.value.params){let c=s.value.params;c.length>0&&this.isThisParam(c[0])&&this.raise(g.ThisParamBannedInConstructor,s)}}pushClassPrivateMethod(t,s,i,r){s.variance&&this.unexpected(s.variance.start),delete s.variance,this.match(43)&&(s.typeParameters=this.flowParseTypeParameterDeclaration()),super.pushClassPrivateMethod(t,s,i,r)}flowParseClassImplements(){let t=this.startNode();return t.id=this.flowParseRestrictedIdentifier(!0),this.match(43)?t.typeParameters=this.flowParseTypeParameterInstantiation():t.typeParameters=null,this.finishNode(t,"ClassImplements")}parseClassSuper(t){if(super.parseClassSuper(t),t.superClass&&(this.match(43)||this.match(47))&&(t.superTypeArguments=this.flowParseTypeParameterInstantiationInExpression()),this.eatContextual(112)){let s=t.implements=[];do s.push(this.flowParseClassImplements());while(this.eat(8))}}checkGetterSetterParams(t){super.checkGetterSetterParams(t);let s=this.getObjectOrClassMethodParams(t);if(s.length>0){let i=s[0];this.isThisParam(i)&&t.kind==="get"?this.raise(g.GetterMayNotHaveThisParam,i):this.isThisParam(i)&&this.raise(g.SetterMayNotHaveThisParam,i)}}parsePropertyNamePrefixOperator(t){t.variance=this.flowParseVariance()}parseObjPropValue(t,s,i,r,a,o,c){t.variance&&this.unexpected(t.variance.start),delete t.variance;let h;this.match(43)&&!o&&(h=this.flowParseTypeParameterDeclaration(),this.match(6)||this.unexpected());let l=super.parseObjPropValue(t,s,i,r,a,o,c);return h&&((l.value||l).typeParameters=h),l}parseFunctionParamType(t){return this.eat(13)&&(t.type!=="Identifier"&&this.raise(g.PatternIsOptional,t),this.isThisParam(t)&&this.raise(g.ThisParamMayNotBeOptional,t),t.optional=!0),this.match(10)?t.typeAnnotation=this.flowParseTypeAnnotation():this.isThisParam(t)&&this.raise(g.ThisParamAnnotationRequired,t),this.match(25)&&this.isThisParam(t)&&this.raise(g.ThisParamNoDefault,t),this.resetEndLocation(t),t}parseMaybeDefault(t,s){let i=super.parseMaybeDefault(t,s);return i.type==="AssignmentPattern"&&i.typeAnnotation&&i.right.start<i.typeAnnotation.start&&this.raise(g.TypeBeforeInitializer,i.typeAnnotation),i}parseImportSpecifierLocal(t,s,i){s.local=Ot(t)?this.flowParseRestrictedIdentifier(!0,!0):this.parseIdentifier(),t.specifiers.push(this.finishImportSpecifier(s,i))}isPotentialImportPhase(t){if(super.isPotentialImportPhase(t))return!0;if(this.isContextual(129)){if(!t)return!0;let s=this.lookaheadCharCode();return s===123||s===42}return!t&&this.isContextual(83)}applyImportPhase(t,s,i,r){if(super.applyImportPhase(t,s,i,r),s){if(!i&&this.match(61))return;t.exportKind=i==="type"?i:"value"}else i==="type"&&this.match(51)&&this.unexpected(),t.importKind=i==="type"||i==="typeof"?i:"value"}parseNamedOrFilteredImportSpecifiers(t){super.parseNamedOrFilteredImportSpecifiers(t);let s=t.specifiers[t.specifiers.length-1];Ot(t)&&s?.type==="ImportNamespaceSpecifier"&&this.unexpected(s.start)}parseImportSpecifier(t,s,i,r){let a=t.imported,o=null;if(a.type==="Identifier"&&(a.name==="type"?o="type":a.name==="typeof"&&(o="typeof")),this.isContextual(90)&&!this.isLookaheadContextual("as")){let c=this.parseIdentifier(!0);o!==null&&!F(this.state.type)?(t.imported=c,t.importKind=o,t.local=this.cloneIdentifier(c)):(t.imported=a,t.importKind=null,t.local=this.parseIdentifier())}else o!==null&&F(this.state.type)?(t.imported=this.parseIdentifier(!0),t.importKind=o):(t.imported=a,t.importKind=null),this.eatContextual(90)?t.local=this.parseIdentifier():t.local=this.cloneIdentifier(t.imported);return this.finishNode(t,"ImportSpecifier")}checkImportSpecifier(t,s){let i=Ot(t),r=s||i;if(r){s&&i&&this.raise(g.ImportTypeShorthandOnlyInPureImport,t);let{local:a}=t;this.checkReservedType(a.name,a.start,!0)}super.checkImportSpecifier(t,s,8201,!r)}parseBindingAtom(){return this.state.type===74?this.parseIdentifier(!0):super.parseBindingAtom()}parseFunctionParams(t,s){let i=t.kind;i!=="get"&&i!=="set"&&this.match(43)&&(t.typeParameters=this.flowParseTypeParameterDeclaration()),super.parseFunctionParams(t,s)}parseVarId(t,s){super.parseVarId(t,s),this.match(10)&&(t.id.typeAnnotation=this.flowParseTypeAnnotation(),this.resetEndLocation(t.id))}parseAsyncArrowFromCallExpression(t,s){if(this.match(10)){let i=this.state.noAnonFunctionType;this.state.noAnonFunctionType=!0,t.returnType=this.flowParseTypeAnnotation(),this.state.noAnonFunctionType=i}return super.parseAsyncArrowFromCallExpression(t,s)}shouldParseAsyncArrow(){return this.match(10)||super.shouldParseAsyncArrow()}parseMaybeAssign(t,s){let i=null,r;if(this.hasPlugin("jsx")&&(this.match(141)||this.match(43))){if(i=this.state.clone(),r=this.tryParse(()=>super.parseMaybeAssign(t,s),i),!r.error)return r.node;let{context:a}=this.state,o=a[a.length-1];(o===k.j_oTag||o===k.j_expr)&&a.pop()}if(r?.error||this.match(43)){i=i||this.state.clone();let a,o=this.tryParse(h=>{a=this.flowParseTypeParameterDeclaration();let l=this.forwardNoArrowParamsConversionAt(a,()=>{let f=super.parseMaybeAssign(t,s);return this.resetStartLocationFromNode(f,a),f});l.extra?.parenthesized&&h();let u=this.maybeUnwrapTypeCastExpression(l);return u.type!=="ArrowFunctionExpression"&&h(),u.typeParameters=a,this.resetStartLocationFromNode(u,a),l},i),c=null;if(o.node&&this.maybeUnwrapTypeCastExpression(o.node).type==="ArrowFunctionExpression"){if(!o.error&&!o.aborted)return o.node.async&&this.raise(g.UnexpectedTypeParameterBeforeAsyncArrowFunction,a),o.node;c=o.node}if(r?.node)return this.state=r.failState,r.node;if(c)return this.state=o.failState,c;throw r?.thrown?r.error:o.thrown?o.error:this.raise(g.UnexpectedTokenAfterTypeParameter,a)}return super.parseMaybeAssign(t,s)}parseArrow(t){if(this.match(10)){let s=this.tryParse(()=>{let i=this.state.noAnonFunctionType;this.state.noAnonFunctionType=!0;let r=this.startNode();return[r.typeAnnotation,t.predicate]=this.flowParseTypeAndPredicateInitialiser(!0),this.state.noAnonFunctionType=i,this.canInsertSemicolon()&&this.unexpected(),this.match(15)||this.unexpected(),r});if(s.thrown)return null;s.error&&(this.state=s.failState),t.returnType=s.node.typeAnnotation?this.finishNode(s.node,"TypeAnnotation"):null}return super.parseArrow(t)}shouldParseArrow(t){return this.match(10)||super.shouldParseArrow(t)}setArrowFunctionParameters(t,s){this.state.noArrowParamsConversionAt.includes(this.offsetToSourcePos(t.start))?t.params=s:super.setArrowFunctionParameters(t,s)}checkParams(t,s,i,r=!0){if(!(i&&this.state.noArrowParamsConversionAt.includes(this.offsetToSourcePos(t.start)))){for(let a=0;a<t.params.length;a++)this.isThisParam(t.params[a])&&a>0&&this.raise(g.ThisParamMustBeFirst,t.params[a]);super.checkParams(t,s,i,r)}}parseParenAndDistinguishExpression(t){return super.parseParenAndDistinguishExpression(t&&!this.state.noArrowAt.includes(this.sourceToOffsetPos(this.state.start)))}parseSubscripts(t,s,i){if(t.type==="Identifier"&&t.name==="async"&&this.state.noArrowAt.includes(s.index)){this.next();let r=this.startNodeAt(s);r.callee=t,r.arguments=super.parseCallExpressionArguments(),t=this.finishNode(r,"CallExpression")}else if(t.type==="Identifier"&&t.name==="async"&&this.match(43)){let r=this.state.clone(),a=this.tryParse(c=>this.parseAsyncArrowWithTypeParameters(s)||c(),r);if(!a.error&&!a.aborted)return a.node;let o=this.tryParse(()=>super.parseSubscripts(t,s,i),r);if(o.node&&!o.error)return o.node;if(a.node)return this.state=a.failState,a.node;if(o.node)return this.state=o.failState,o.node;throw a.error||o.error}return super.parseSubscripts(t,s,i)}parseSubscript(t,s,i,r){if(this.match(14)&&this.isLookaheadToken_lt()){if(r.optionalChainMember=!0,i)return r.stop=!0,t;this.next();let a=this.startNodeAt(s);return a.callee=t,a.typeArguments=this.flowParseTypeParameterInstantiationInExpression(),this.expect(6),a.arguments=this.parseCallExpressionArguments(),a.optional=!0,this.finishCallExpression(a,!0)}else if(!i&&this.shouldParseTypes()&&(this.match(43)||this.match(47))){let a=this.startNodeAt(s);a.callee=t;let o=this.tryParse(()=>(a.typeArguments=this.flowParseTypeParameterInstantiationCallOrNew(),this.expect(6),a.arguments=super.parseCallExpressionArguments(),r.optionalChainMember&&(a.optional=!1),this.finishCallExpression(a,r.optionalChainMember)));if(o.node)return o.error&&(this.state=o.failState),o.node}return super.parseSubscript(t,s,i,r)}parseNewCallee(t){super.parseNewCallee(t);let s=null;this.shouldParseTypes()&&this.match(43)&&(s=this.tryParse(()=>this.flowParseTypeParameterInstantiationCallOrNew()).node),t.typeArguments=s}parseAsyncArrowWithTypeParameters(t){let s=this.startNodeAt(t);if(this.parseFunctionParams(s,!1),!!this.parseArrow(s))return super.parseArrowExpression(s,void 0,!0)}readToken_mult_modulo(t){let s=this.input.charCodeAt(this.state.pos+1);if(t===42&&s===47&&this.state.hasFlowComment){this.state.hasFlowComment=!1,this.state.pos+=2,this.nextToken();return}super.readToken_mult_modulo(t)}readToken_pipe_amp(t){let s=this.input.charCodeAt(this.state.pos+1);if(t===124&&s===125){this.finishOp(5,2);return}super.readToken_pipe_amp(t)}parseTopLevel(t,s){let i=super.parseTopLevel(t,s);return this.state.hasFlowComment&&this.raise(g.UnterminatedFlowComment,this.state.curPosition()),i}skipBlockComment(){if(this.hasPlugin("flowComments")&&this.skipFlowComment()){if(this.state.hasFlowComment)throw this.raise(g.NestedFlowComment,this.state.startLoc);this.hasFlowCommentCompletion();let t=this.skipFlowComment();t&&(this.state.pos+=t,this.state.hasFlowComment=!0);return}return super.skipBlockComment(this.state.hasFlowComment?"*-/":"*/")}skipFlowComment(){let{pos:t}=this.state,s=2;for(;[32,9].includes(this.input.charCodeAt(t+s));)s++;let i=this.input.charCodeAt(s+t),r=this.input.charCodeAt(s+t+1);return i===58&&r===58?s+2:this.input.slice(s+t,s+t+12)==="flow-include"?s+12:i===58&&r!==58?s:!1}hasFlowCommentCompletion(){if(this.input.indexOf("*/",this.state.pos)===-1)throw this.raise(p.UnterminatedComment,this.state.curPosition())}flowEnumErrorBooleanMemberNotInitialized(t,s){this.raise(g.EnumBooleanMemberNotInitialized,t,s)}flowEnumErrorInvalidMemberInitializer(t,s){return this.raise(s.explicitType?s.explicitType==="symbol"?g.EnumInvalidMemberInitializerSymbolType:g.EnumInvalidMemberInitializerPrimaryType:g.EnumInvalidMemberInitializerUnknownType,t,s)}flowEnumErrorNumberMemberNotInitialized(t,s){this.raise(g.EnumNumberMemberNotInitialized,t,s)}flowEnumErrorStringMemberInconsistentlyInitialized(t,s){this.raise(g.EnumStringMemberInconsistentlyInitialized,t,s)}flowEnumMemberInit(){let t=this.state.startLoc,s=()=>this.match(8)||this.match(4);switch(this.state.type){case 134:{let i=this.parseNumericLiteral(this.state.value);if(s())return{type:"number",loc:i.start,value:i};break}case 133:{let i=this.parseStringLiteral(this.state.value);if(s())return{type:"string",loc:i.start,value:i};break}case 81:case 82:{let i=this.parseBooleanLiteral(this.match(81));if(s())return{type:"boolean",loc:i.start,value:i}}}return{type:"invalid",loc:t}}flowEnumMemberRaw(){let t=this.state.startLoc,s=this.parseIdentifier(!0),i=this.eat(25)?this.flowEnumMemberInit():{type:"none",loc:t};return{id:s,init:i}}flowEnumCheckExplicitTypeMismatch(t,s,i){let{explicitType:r}=s;r!==null&&r!==i&&this.flowEnumErrorInvalidMemberInitializer(t,s)}flowEnumMembers({enumName:t,explicitType:s}){let i=new Set,r={booleanMembers:[],numberMembers:[],stringMembers:[],defaultedMembers:[]},a=!1;for(;!this.match(4);){if(this.eat(17)){a=!0;break}let o=this.startNode(),{id:c,init:h}=this.flowEnumMemberRaw(),l=c.name;if(l==="")continue;/^[a-z]/.test(l)&&this.raise(g.EnumInvalidMemberName,c,{memberName:l,suggestion:l[0].toUpperCase()+l.slice(1),enumName:t}),i.has(l)&&this.raise(g.EnumDuplicateMemberName,c,{memberName:l,enumName:t}),i.add(l);let u={enumName:t,explicitType:s,memberName:l};switch(o.id=c,h.type){case"boolean":{this.flowEnumCheckExplicitTypeMismatch(h.loc,u,"boolean"),o.init=h.value,r.booleanMembers.push(this.finishNode(o,"EnumBooleanMember"));break}case"number":{this.flowEnumCheckExplicitTypeMismatch(h.loc,u,"number"),o.init=h.value,r.numberMembers.push(this.finishNode(o,"EnumNumberMember"));break}case"string":{this.flowEnumCheckExplicitTypeMismatch(h.loc,u,"string"),o.init=h.value,r.stringMembers.push(this.finishNode(o,"EnumStringMember"));break}case"invalid":throw this.flowEnumErrorInvalidMemberInitializer(h.loc,u);case"none":switch(s){case"boolean":this.flowEnumErrorBooleanMemberNotInitialized(h.loc,u);break;case"number":this.flowEnumErrorNumberMemberNotInitialized(h.loc,u);break;default:r.defaultedMembers.push(this.finishNode(o,"EnumDefaultedMember"))}}this.match(4)||this.expect(8)}return{members:r,hasUnknownMembers:a}}flowEnumStringMembers(t,s,{enumName:i}){if(t.length===0)return s;if(s.length===0)return t;if(s.length>t.length){for(let r of t)this.flowEnumErrorStringMemberInconsistentlyInitialized(r,{enumName:i});return s}else{for(let r of s)this.flowEnumErrorStringMemberInconsistentlyInitialized(r,{enumName:i});return t}}flowEnumParseExplicitType({enumName:t}){if(!this.eatContextual(99))return null;if(!E(this.state.type))throw this.raise(g.EnumInvalidExplicitTypeUnknownSupplied,this.state.startLoc,{enumName:t});let{value:s}=this.state;return this.next(),s!=="boolean"&&s!=="number"&&s!=="string"&&s!=="symbol"&&this.raise(g.EnumInvalidExplicitType,this.state.startLoc,{enumName:t,invalidEnumType:s}),s}flowEnumBody(t,s){let i=s.name,r=s.start,a=this.flowEnumParseExplicitType({enumName:i});this.expect(2);let{members:o,hasUnknownMembers:c}=this.flowEnumMembers({enumName:i,explicitType:a});switch(t.hasUnknownMembers=c,a){case"boolean":return t.explicitType=!0,t.members=o.booleanMembers,this.expect(4),this.finishNode(t,"EnumBooleanBody");case"number":return t.explicitType=!0,t.members=o.numberMembers,this.expect(4),this.finishNode(t,"EnumNumberBody");case"string":return t.explicitType=!0,t.members=this.flowEnumStringMembers(o.stringMembers,o.defaultedMembers,{enumName:i}),this.expect(4),this.finishNode(t,"EnumStringBody");case"symbol":return t.members=o.defaultedMembers,this.expect(4),this.finishNode(t,"EnumSymbolBody");default:{let h=()=>(t.members=[],this.expect(4),this.finishNode(t,"EnumStringBody"));t.explicitType=!1;let l=o.booleanMembers.length,u=o.numberMembers.length,f=o.stringMembers.length,d=o.defaultedMembers.length;if(!l&&!u&&!f&&!d)return h();if(!l&&!u)return t.members=this.flowEnumStringMembers(o.stringMembers,o.defaultedMembers,{enumName:i}),this.expect(4),this.finishNode(t,"EnumStringBody");if(!u&&!f&&l>=d){for(let y of o.defaultedMembers)this.flowEnumErrorBooleanMemberNotInitialized(y.start,{enumName:i,memberName:y.id.name});return t.members=o.booleanMembers,this.expect(4),this.finishNode(t,"EnumBooleanBody")}else if(!l&&!f&&u>=d){for(let y of o.defaultedMembers)this.flowEnumErrorNumberMemberNotInitialized(y.start,{enumName:i,memberName:y.id.name});return t.members=o.numberMembers,this.expect(4),this.finishNode(t,"EnumNumberBody")}else return this.raise(g.EnumInconsistentMemberValues,r,{enumName:i}),h()}}}flowParseEnumDeclaration(t){let s=this.parseIdentifier();return t.id=s,t.body=this.flowEnumBody(this.startNode(),s),this.finishNode(t,"EnumDeclaration")}jsxParseOpeningElementAfterName(t){return this.shouldParseTypes()&&(this.match(43)||this.match(47))&&(t.typeArguments=this.flowParseTypeParameterInstantiationInExpression()),super.jsxParseOpeningElementAfterName(t)}isLookaheadToken_lt(){let t=this.nextTokenStart();if(this.input.charCodeAt(t)===60){let s=this.input.charCodeAt(t+1);return s!==60&&s!==61}return!1}reScan_lt_gt(){let{type:t}=this.state;t===43?(this.state.pos-=1,this.readToken_lt()):t===44&&(this.state.pos-=1,this.readToken_gt())}reScan_lt(){let{type:t}=this.state;return t===47?(this.state.pos-=2,this.finishOp(43,1),43):t}maybeUnwrapTypeCastExpression(t){return t.type==="TypeCastExpression"?t.expression:t}},_s={__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"},xt=/\r\n|[\r\n\u2028\u2029]/g;function it(n){switch(n){case 10:case 13:case 8232:case 8233:return!0;default:return!1}}function qt(n,e,t){for(let s=e;s<t;s++)if(it(n.charCodeAt(s)))return!0;return!1}var $s=/(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g,zs=/(?:[^\S\n\r\u2028\u2029]|\/\*.*?\*\/)*(?:(?!-->)(?:\s|\/\/.*|\/\*[^]*?\*\/|<!--.*|-->.*)*)?/g,Ft=/(?:[^\S\n\r\u2028\u2029]|\/\/.*|\/\*.*?\*\/)*/g;function Vs(n){switch(n){case 9:case 11:case 12:case 32:case 160:case 5760:case 8192:case 8193:case 8194:case 8195:case 8196:case 8197:case 8198:case 8199:case 8200:case 8201:case 8202:case 8239:case 8287:case 12288:case 65279:return!0;default:return!1}}var qs={AttributeIsEmpty:"JSX attributes must only be assigned a non-empty expression.",MissingClosingTagElement:({openingTagName:n})=>`Expected corresponding JSX closing tag for <${n}>.`,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:n,HTMLEntity:e})=>`Unexpected token \`${n}\`. Did you mean \`${e}\` or \`{'${n}'}\`?`,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 <>...</>?"},V=$`jsx`(qs);function K(n){return n?n.type==="JSXOpeningFragment"||n.type==="JSXClosingFragment":!1}function st(n){if(n.type==="JSXIdentifier")return n.name;if(n.type==="JSXNamespacedName")return n.namespace.name+":"+n.name.name;if(n.type==="JSXMemberExpression")return st(n.object)+"."+st(n.property);throw new Error("Node had unexpected type: "+n.type)}var Hs=n=>class extends n{jsxReadToken(){let t="",s=this.state.pos;for(;;){if(this.state.pos>=this.length)throw this.raise(V.UnterminatedJsxContent,this.state.startLoc);let i=this.input.charCodeAt(this.state.pos);switch(i){case 60:case 123:if(this.state.pos===this.state.start){i===60&&this.state.canStartJSXElement?(++this.state.pos,this.finishToken(141)):super.getTokenFromCode(i);return}t+=this.input.slice(s,this.state.pos),this.finishToken(140,t);return;case 38:t+=this.input.slice(s,this.state.pos),t+=this.jsxReadEntity(),s=this.state.pos;break;case 62:case 125:this.raise(V.UnexpectedToken,this.state.curPosition(),{unexpected:this.input[this.state.pos],HTMLEntity:i===125?"}":">"});default:it(i)?(t+=this.input.slice(s,this.state.pos),t+=this.jsxReadNewLine(!0),s=this.state.pos):++this.state.pos}}}jsxReadNewLine(t){let s=this.input.charCodeAt(this.state.pos),i;return++this.state.pos,s===13&&this.input.charCodeAt(this.state.pos)===10?(++this.state.pos,i=t?`
|
|
5
|
+
`:`\r
|
|
6
|
+
`):i=String.fromCharCode(s),++this.state.curLine,this.state.lineStart=this.state.pos,i}jsxReadString(t){let s="",i=++this.state.pos;for(;;){if(this.state.pos>=this.length)throw this.raise(p.UnterminatedString,this.state.startLoc);let r=this.input.charCodeAt(this.state.pos);if(r===t)break;r===38?(s+=this.input.slice(i,this.state.pos),s+=this.jsxReadEntity(),i=this.state.pos):it(r)?(s+=this.input.slice(i,this.state.pos),s+=this.jsxReadNewLine(!1),i=this.state.pos):++this.state.pos}s+=this.input.slice(i,this.state.pos++),this.finishToken(133,s)}jsxReadEntity(){let t=++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 i=this.readInt(s,void 0,!1,"bail");if(i!==null&&i<=1114111&&this.codePointAtPos(this.state.pos)===59)return++this.state.pos,String.fromCodePoint(i)}else{let s=0,i=!1;for(;s++<10&&this.state.pos<this.length&&!(i=this.codePointAtPos(this.state.pos)===59);)++this.state.pos;if(i){let r=this.input.slice(t,this.state.pos),a=_s[r];if(++this.state.pos,a)return a}}return this.state.pos=t,"&"}jsxReadWord(){let t,s=this.state.pos;do t=this.input.charCodeAt(++this.state.pos);while(J(t)||t===45);this.finishToken(139,this.input.slice(s,this.state.pos))}jsxParseIdentifier(){let t=this.startNode();return this.match(139)?t.name=this.state.value:wt(this.state.type)?t.name=W(this.state.type):this.unexpected(),this.next(),this.finishNode(t,"JSXIdentifier")}jsxParseNamespacedName(){let t=this.state.startLoc,s=this.jsxParseIdentifier();if(!this.eat(10))return s;let i=this.startNodeAt(t);return i.namespace=s,i.name=this.jsxParseIdentifier(),this.finishNode(i,"JSXNamespacedName")}jsxParseElementName(){let t=this.state.startLoc,s=this.jsxParseNamespacedName();if(s.type==="JSXNamespacedName")return s;for(;this.eat(12);){let i=this.startNodeAt(t);i.object=s,i.property=this.jsxParseIdentifier(),s=this.finishNode(i,"JSXMemberExpression")}return s}jsxParseAttributeValue(){let t;switch(this.state.type){case 2:return t=this.startNode(),this.setContext(k.brace),this.next(),t=this.jsxParseExpressionContainer(t,k.j_oTag),t.expression.type==="JSXEmptyExpression"&&this.raise(V.AttributeIsEmpty,t),t;case 141:case 133:return this.parseExprAtom();default:throw this.raise(V.UnsupportedJsxValue,this.state.startLoc)}}jsxParseEmptyExpression(){let t=this.startNodeAt(this.state.lastTokEndLoc);return this.finishNodeAt(t,"JSXEmptyExpression",this.state.startLoc)}jsxParseSpreadChild(t){return this.next(),t.expression=this.parseExpression(),this.setContext(k.j_expr),this.state.canStartJSXElement=!0,this.expect(4),this.finishNode(t,"JSXSpreadChild")}jsxParseExpressionContainer(t,s){if(this.match(4))t.expression=this.jsxParseEmptyExpression();else{let i=this.parseExpression();i.type==="SequenceExpression"&&!i.extra?.parenthesized&&this.raise(V.UnexpectedSequenceExpression,i.expressions[1]),t.expression=i}return this.setContext(s),this.state.canStartJSXElement=!0,this.expect(4),this.finishNode(t,"JSXExpressionContainer")}jsxParseAttribute(){if(this.match(2)){let s=this.startNode();return this.setContext(k.brace),this.next(),this.expect(17),s.argument=this.parseMaybeAssignAllowIn(),this.setContext(k.j_oTag),this.state.canStartJSXElement=!0,this.expect(4),this.finishNode(s,"JSXSpreadAttribute")}let t=this.startNode();return t.name=this.jsxParseNamespacedName(),t.value=this.eat(25)?this.jsxParseAttributeValue():null,this.finishNode(t,"JSXAttribute")}jsxParseOpeningElementAt(t){if(this.eat(142)){let i=this.startNodeAt(t);return this.finishNode(i,"JSXOpeningFragment")}let s=this.startNodeAt(t);return s.name=this.jsxParseElementName(),this.jsxParseOpeningElementAfterName(s)}jsxParseOpeningElementAfterName(t){let s=[];for(;!this.match(52)&&!this.match(142);)s.push(this.jsxParseAttribute());return t.attributes=s,t.selfClosing=this.eat(52),this.expect(142),this.finishNode(t,"JSXOpeningElement")}jsxParseClosingElementAt(t){if(this.eat(142)){let i=this.startNodeAt(t);return this.finishNode(i,"JSXClosingFragment")}let s=this.startNodeAt(t);return s.name=this.jsxParseElementName(),this.expect(142),this.finishNode(s,"JSXClosingElement")}jsxParseElementAt(t){let s=this.startNodeAt(t),i=[],r=this.jsxParseOpeningElementAt(t),a=null;if(!r.selfClosing){t:for(;;)switch(this.state.type){case 141:if(t=this.state.startLoc,this.next(),this.eat(52)){a=this.jsxParseClosingElementAt(t);break t}i.push(this.jsxParseElementAt(t));break;case 140:i.push(this.parseLiteral(this.state.value,"JSXText"));break;case 2:{let o=this.startNode();this.setContext(k.brace),this.next(),this.match(17)?i.push(this.jsxParseSpreadChild(o)):i.push(this.jsxParseExpressionContainer(o,k.j_expr));break}default:this.unexpected()}K(r)&&!K(a)&&a!==null?this.raise(V.MissingClosingTagFragment,a):!K(r)&&K(a)?this.raise(V.MissingClosingTagElement,a,{openingTagName:st(r.name)}):!K(r)&&!K(a)&&st(a.name)!==st(r.name)&&this.raise(V.MissingClosingTagElement,a,{openingTagName:st(r.name)})}if(K(r)?(s.openingFragment=r,s.closingFragment=a):(s.openingElement=r,s.closingElement=a),s.children=i,this.match(43))throw this.raise(V.UnwrappedAdjacentJSXElements,this.state.startLoc);return K(r)?this.finishNode(s,"JSXFragment"):this.finishNode(s,"JSXElement")}jsxParseElement(){let t=this.state.startLoc;return this.next(),this.jsxParseElementAt(t)}setContext(t){let{context:s}=this.state;s[s.length-1]=t}parseExprAtom(t){return this.match(141)?this.jsxParseElement():this.match(43)&&this.input.charCodeAt(this.state.pos)!==33?(this.replaceToken(141),this.jsxParseElement()):super.parseExprAtom(t)}skipSpace(){this.curContext().preserveSpace||super.skipSpace()}getTokenFromCode(t){let s=this.curContext();if(s===k.j_expr){this.jsxReadToken();return}if(s===k.j_oTag||s===k.j_cTag){if(z(t)){this.jsxReadWord();return}if(t===62){++this.state.pos,this.finishToken(142);return}if((t===34||t===39)&&s===k.j_oTag){this.jsxReadString(t);return}}if(t===60&&this.state.canStartJSXElement&&this.input.charCodeAt(this.state.pos+1)!==33){++this.state.pos,this.finishToken(141);return}super.getTokenFromCode(t)}updateContext(t){let{context:s,type:i}=this.state;if(i===52&&t===141)s.splice(-2,2,k.j_cTag),this.state.canStartJSXElement=!1;else if(i===141)s.push(k.j_oTag);else if(i===142){let r=s[s.length-1];r===k.j_oTag&&t===52||r===k.j_cTag?(s.pop(),this.state.canStartJSXElement=s[s.length-1]===k.j_expr):(this.setContext(k.j_expr),this.state.canStartJSXElement=!0)}else this.state.canStartJSXElement=xs(i)}},Ht=class extends pt{tsNames=new Map},Kt=class extends ut{get inTSNamespace(){let e=this.scopeStack;return e.length>=2&&e[e.length-1].flags===0&&(e[e.length-2].flags&2048)>0}importsStack=[];createScope(e){return this.importsStack.push(new Set),new Ht(e)}enter(e){e&3072&&this.importsStack.push(new Set),super.enter(e)}exit(){let e=super.exit();return e&3072&&this.importsStack.pop(),e}hasImport(e,t){let s=this.importsStack.length;if(this.importsStack[s-1].has(e))return!0;if(!t&&s>1){for(let i=0;i<s-1;i++)if(this.importsStack[i].has(e))return!0}return!1}declareName(e,t,s){if(t&4096){this.hasImport(e,!0)&&this.parser.raise(p.VarRedeclaration,s,{identifierName:e}),this.importsStack[this.importsStack.length-1].add(e);return}let i=this.currentScope(),r=i.tsNames.get(e)||0;if(t&1024){this.maybeExportDefined(i,e),i.tsNames.set(e,r|16);return}super.declareName(e,t,s),t&2&&(t&1||(this.checkRedeclarationInScope(i,e,t,s),this.maybeExportDefined(i,e)),r=r|1),t&256&&(r=r|2),t&512&&(r=r|4),t&128&&(r=r|8),r&&i.tsNames.set(e,r)}isRedeclaredInScope(e,t,s){let i=e.tsNames.get(t);if((i&2)>0){if(s&256){let r=(s&512)>0,a=(i&4)>0;return r!==a}return!0}return s&128&&(i&8)>0?e.names.get(t)&2?!!(s&1):!1:s&2&&(i&1)>0?!0:super.isRedeclaredInScope(e,t,s)}checkLocalExport(e){let{name:t}=e;if(this.hasImport(t))return;let s=this.scopeStack.length;for(let i=s-1;i>=0;i--){let a=this.scopeStack[i].tsNames.get(t);if((a&1)>0||(a&16)>0)return}super.checkLocalExport(e)}},Wt=class{sawUnambiguousESM=!1;ambiguousScriptDifferentAst=!1;sourceToOffsetPos(e){return e+this.startIndex}offsetToSourcePos(e){return e-this.startIndex}hasPlugin(e){if(typeof e=="string")return this.plugins.has(e);{let[t,s]=e;if(!this.hasPlugin(t))return!1;let i=this.plugins.get(t);for(let r of Object.keys(s))if(i?.[r]!==s[r])return!1;return!0}}getPluginOption(e,t){return this.plugins.get(e)?.[t]}};function Ke(n,e){n.trailingComments===void 0?n.trailingComments=e:n.trailingComments.unshift(...e)}function Ks(n,e){n.leadingComments===void 0?n.leadingComments=e:n.leadingComments.unshift(...e)}function ft(n,e){n.innerComments===void 0?n.innerComments=e:n.innerComments.unshift(...e)}function q(n,e,t){let s=null,i=e.length;for(;s===null&&i>0;)s=e[--i];s===null||s.start>t.start?ft(n,t.comments):Ke(s,t.comments)}var Jt=class extends Wt{addComment(e){this.filename&&(e.loc.filename=this.filename);let{commentsLen:t}=this.state;this.comments.length!==t&&(this.comments.length=t),this.comments.push(e),this.state.commentsLen++}processComment(e){let{commentStack:t}=this.state,s=t.length;if(s===0)return;let i=s-1,r=t[i];r.start===e.end&&(r.leadingNode=e,i--);let a=e.start;for(;i>=0;i--){let o=t[i],c=o.end;if(c>a)o.containingNode=e,this.finalizeComment(o),t.splice(i,1);else{c===a&&(o.trailingNode=e);break}}}finalizeComment(e){let{comments:t}=e;if(e.leadingNode!==null||e.trailingNode!==null)e.leadingNode!==null&&Ke(e.leadingNode,t),e.trailingNode!==null&&Ks(e.trailingNode,t);else{let s=e.containingNode,i=e.start;if(this.input.charCodeAt(this.offsetToSourcePos(i)-1)===44)switch(s.type){case"ObjectExpression":case"ObjectPattern":q(s,s.properties,e);break;case"CallExpression":case"NewExpression":case"OptionalCallExpression":q(s,s.arguments,e);break;case"ImportExpression":q(s,[s.source,s.options??null],e);break;case"FunctionDeclaration":case"FunctionExpression":case"ArrowFunctionExpression":case"ObjectMethod":case"ClassMethod":case"ClassPrivateMethod":case"TSTypeParameterDeclaration":q(s,s.params,e);break;case"ArrayExpression":case"ArrayPattern":q(s,s.elements,e);break;case"ExportNamedDeclaration":case"ImportDeclaration":q(s,s.specifiers,e);break;case"ImportNamespaceSpecifier":case"ExportNamespaceSpecifier":q(s,s.exportsFilter??[],e);break;case"TSEnumBody":q(s,s.members,e);break;case"TSInterfaceBody":q(s,s.body,e);break;default:ft(s,t)}else ft(s,t)}}finalizeRemainingComments(){let{commentStack:e}=this.state;for(let t=e.length-1;t>=0;t--)this.finalizeComment(e[t]);this.state.commentStack=[]}resetPreviousNodeTrailingComments(e){let{commentStack:t}=this.state,{length:s}=t;if(s===0)return;let i=t[s-1];i.leadingNode===e&&(i.leadingNode=null)}replaceNodeInPendingComments(e,t){for(let s of this.state.commentStack)s.leadingNode===e&&(s.leadingNode=t),s.trailingNode===e&&(s.trailingNode=t)}takeSurroundingComments(e,t,s){let{commentStack:i}=this.state,r=i.length;if(r===0)return;let a=r-1;for(;a>=0;a--){let o=i[a],c=o.end;if(o.start===s)o.leadingNode=e;else if(c===t)o.trailingNode=e;else if(c<t)break}}},Xt=class n{flags=2048;get strict(){return(this.flags&1)>0}set strict(e){e?this.flags|=1:this.flags&=-2}startIndex;curLine;lineStart;startLoc;endLoc;init({strictMode:e,sourceType:t,startIndex:s,startLine:i,startColumn:r}){this.strict=e===!1?!1:e===!0?!0:t==="module",this.startIndex=s,this.curLine=i,this.lineStart=-r,this.startLoc=this.endLoc=new D(i,r,s)}errors=[];noArrowAt=[];noArrowParamsConversionAt=[];regExpAllowedAt=-1;get canStartArrow(){return(this.flags&2)>0}set canStartArrow(e){e?this.flags|=2:this.flags&=-3}get inType(){return(this.flags&4)>0}set inType(e){e?this.flags|=4:this.flags&=-5}get noAnonFunctionType(){return(this.flags&8)>0}set noAnonFunctionType(e){e?this.flags|=8:this.flags&=-9}get hasFlowComment(){return(this.flags&16)>0}set hasFlowComment(e){e?this.flags|=16:this.flags&=-17}get isAmbientContext(){return(this.flags&32)>0}set isAmbientContext(e){e?this.flags|=32:this.flags&=-33}get inAbstractClass(){return(this.flags&64)>0}set inAbstractClass(e){e?this.flags|=64:this.flags&=-65}get inDisallowConditionalTypesContext(){return(this.flags&128)>0}set inDisallowConditionalTypesContext(e){e?this.flags|=128:this.flags&=-129}get inConditionalConsequent(){return(this.flags&256)>0}set inConditionalConsequent(e){e?this.flags|=256:this.flags&=-257}get inHackPipelineBody(){return(this.flags&512)>0}set inHackPipelineBody(e){e?this.flags|=512:this.flags&=-513}get seenTopicReference(){return(this.flags&1024)>0}set seenTopicReference(e){e?this.flags|=1024:this.flags&=-1025}labels=[];commentsLen=0;commentStack=[];pos=0;type=138;value=null;start=0;end=0;lastTokEndLoc=null;lastTokStartLoc=null;context=[k.brace];get canStartJSXElement(){return(this.flags&2048)>0}set canStartJSXElement(e){e?this.flags|=2048:this.flags&=-2049}get containsEsc(){return(this.flags&4096)>0}set containsEsc(e){e?this.flags|=4096:this.flags&=-4097}firstInvalidTemplateEscapePos=null;get hasTopLevelAwait(){return(this.flags&8192)>0}set hasTopLevelAwait(e){e?this.flags|=8192:this.flags&=-8193}strictErrors=new Map;tokensLength=0;curPosition(){return new D(this.curLine,this.pos-this.lineStart,this.pos+this.startIndex)}clone(){let e=new n;return e.flags=this.flags,e.startIndex=this.startIndex,e.curLine=this.curLine,e.lineStart=this.lineStart,e.startLoc=this.startLoc,e.endLoc=this.endLoc,e.errors=this.errors.slice(),e.noArrowAt=this.noArrowAt.slice(),e.noArrowParamsConversionAt=this.noArrowParamsConversionAt.slice(),e.regExpAllowedAt=this.regExpAllowedAt,e.labels=this.labels.slice(),e.commentsLen=this.commentsLen,e.commentStack=this.commentStack.slice(),e.pos=this.pos,e.type=this.type,e.value=this.value,e.start=this.start,e.end=this.end,e.lastTokEndLoc=this.lastTokEndLoc,e.lastTokStartLoc=this.lastTokStartLoc,e.context=this.context.slice(),e.firstInvalidTemplateEscapePos=this.firstInvalidTemplateEscapePos,e.strictErrors=this.strictErrors,e.tokensLength=this.tokensLength,e}},Ws=function(e){return e>=48&&e<=57},ve={decBinOct:new Set([46,66,69,79,95,98,101,111,43,45]),hex:new Set([46,88,95,120])},gt={bin:n=>n===48||n===49,oct:n=>n>=48&&n<=55,dec:n=>n>=48&&n<=57,hex:n=>n>=48&&n<=57||n>=65&&n<=70||n>=97&&n<=102};function Le(n,e,t,s,i,r){let a=t,o=s,c=i,h="",l=null,u=t,{length:f}=e;for(;;){if(t>=f){r.unterminated(a,o,c),h+=e.slice(u,t);break}let d=e.charCodeAt(t);if(Js(n,d,e,t)){h+=e.slice(u,t);break}if(d===92){h+=e.slice(u,t);let y=Xs(e,t,s,i,n==="template",r);y.ch===null&&!l?l={pos:t,lineStart:s,curLine:i}:h+=y.ch,{pos:t,lineStart:s,curLine:i}=y,u=t}else d===8232||d===8233?(++t,++i,s=t):d===10||d===13?n==="template"?(h+=e.slice(u,t)+`
|
|
7
|
+
`,++t,d===13&&e.charCodeAt(t)===10&&++t,++i,u=s=t):r.unterminated(a,o,c):++t}return{pos:t,str:h,firstInvalidLoc:l,lineStart:s,curLine:i}}function Js(n,e,t,s){return n==="template"?e===96||e===36&&t.charCodeAt(s+1)===123:e===(n==="double"?34:39)}function Xs(n,e,t,s,i,r){let a=!i;e++;let o=h=>({pos:e,ch:h,lineStart:t,curLine:s}),c=n.charCodeAt(e++);switch(c){case 110:return o(`
|
|
8
|
+
`);case 114:return o("\r");case 120:{let h;return{code:h,pos:e}=Gt(n,e,t,s,2,!1,a,r),o(h===null?null:String.fromCharCode(h))}case 117:{let h;return{code:h,pos:e}=Je(n,e,t,s,a,r),o(h===null?null:String.fromCodePoint(h))}case 116:return o(" ");case 98:return o("\b");case 118:return o("\v");case 102:return o("\f");case 13:n.charCodeAt(e)===10&&++e;case 10:t=e,++s;case 8232:case 8233:return o("");case 56:case 57:if(i)return o(null);r.strictNumericEscape(e-1,t,s);default:if(c>=48&&c<=55){let h=e-1,u=/^[0-7]+/.exec(n.slice(h,e+2))[0],f=parseInt(u,8);f>255&&(u=u.slice(0,-1),f=parseInt(u,8)),e+=u.length-1;let d=n.charCodeAt(e);if(u!=="0"||d===56||d===57){if(i)return o(null);r.strictNumericEscape(h,t,s)}return o(String.fromCharCode(f))}return o(String.fromCharCode(c))}}function Gt(n,e,t,s,i,r,a,o){let c=e,h;return{n:h,pos:e}=We(n,e,t,s,16,i,r,!1,o,!a),h===null&&(a?o.invalidEscapeSequence(c,t,s):e=c-1),{code:h,pos:e}}function We(n,e,t,s,i,r,a,o,c,h){let l=e,u=i===16?ve.hex:ve.decBinOct,f=i===16?gt.hex:i===10?gt.dec:i===8?gt.oct:gt.bin,d=!1,y=0;for(let P=0,C=r??1/0;P<C;++P){let S=n.charCodeAt(e),w;if(S===95&&o!=="bail"){let j=n.charCodeAt(e-1),_=n.charCodeAt(e+1);if(o){if(Number.isNaN(_)||!f(_)||u.has(j)){if(h)return{n:null,pos:e};c.unexpectedNumericSeparator(e,t,s)}}else{if(h)return{n:null,pos:e};c.numericSeparatorInEscapeSequence(e,t,s)}++e;continue}if(S>=97?w=S-97+10:S>=65?w=S-65+10:Ws(S)?w=S-48:w=1/0,w>=i)if(w<=9){if(h)return{n:null,pos:e};c.invalidDigit(e,t,s,i),w=0}else if(a)w=0,d=!0;else break;++e,y=y*i+w}return e===l||r!=null&&e-l!==r||d?{n:null,pos:e}:{n:y,pos:e}}function Je(n,e,t,s,i,r){let a=n.charCodeAt(e),o;if(a===123){if(++e,{code:o,pos:e}=Gt(n,e,t,s,n.indexOf("}",e)-e,!0,i,r),++e,o!==null&&o>1114111)if(i)r.invalidCodePoint(e,t,s);else return{code:null,pos:e}}else({code:o,pos:e}=Gt(n,e,t,s,4,!1,i,r));return{code:o,pos:e}}function ct(n,e,t){return new D(t,n-e,n)}var Gs=new Set([103,109,115,105,121,117,100,118]),Yt=class{constructor(e){let t=e.startIndex||0;this.type=e.type,this.value=e.value,this.start=t+e.start,this.end=t+e.end,this.loc=new rt(e.startLoc,e.endLoc)}},Pt,Qt=class extends Jt{isLookahead;tokens=[];constructor(e,t){super(),this.state=new Xt,this.state.init(e),this.input=t,this.length=t.length,this.comments=[],this.isLookahead=!1,(!Pt||Pt.length<(this.length+1)*2)&&(Pt=new Uint32Array((this.length+1)*2)),this.locData=Pt}setLoc(e){let t=this.offsetToSourcePos(e.index);this.locData[t*2]=e.line,this.locData[t*2+1]=e.column}getLoc(e){let t=this.offsetToSourcePos(e);return new D(this.locData[t*2],this.locData[t*2+1],e)}pushToken(e){this.tokens.length=this.state.tokensLength,this.tokens.push(e),++this.state.tokensLength}next(){this.checkKeywordEscapes(),this.optionFlags&512&&this.pushToken(new Yt(this.state)),this.state.lastTokEndLoc=this.state.endLoc,this.state.lastTokStartLoc=this.state.startLoc,this.nextToken()}eat(e){return this.match(e)?(this.next(),!0):!1}match(e){return this.state.type===e}createLookaheadState(e){return{pos:e.pos,value:null,type:e.type,start:e.start,end:e.end,context:[this.curContext()],inType:e.inType,strict:e.strict,startLoc:e.startLoc,lastTokEndLoc:e.lastTokEndLoc,curLine:e.curLine,lineStart:e.lineStart,curPosition:e.curPosition}}lookahead(){let e=this.state;this.state=this.createLookaheadState(e),this.isLookahead=!0,this.nextToken(),this.isLookahead=!1;let t=this.state;return this.state=e,t}nextTokenStart(){return this.nextTokenStartSince(this.state.pos)}nextTokenStartSince(e){let t=this.inModule||!(this.optionFlags&16384)?$s:zs;return t.lastIndex=e,t.test(this.input)?t.lastIndex:e}lookaheadCharCode(){return this.lookaheadCharCodeSince(this.state.pos)}lookaheadCharCodeSince(e){return this.input.charCodeAt(this.nextTokenStartSince(e))}nextTokenInLineStart(){return this.nextTokenInLineStartSince(this.state.pos)}nextTokenInLineStartSince(e){return Ft.lastIndex=e,Ft.test(this.input)?Ft.lastIndex:e}lookaheadInLineCharCode(){return this.input.charCodeAt(this.nextTokenInLineStart())}codePointAtPos(e){let t=this.input.charCodeAt(e);if((t&64512)===55296&&++e<this.input.length){let s=this.input.charCodeAt(e);(s&64512)===56320&&(t=65536+((t&1023)<<10)+(s&1023))}return t}setStrict(e){this.state.strict=e,e&&(this.state.strictErrors.forEach(([t,s])=>this.raise(t,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(138);return}this.getTokenFromCode(this.codePointAtPos(this.state.pos))}skipBlockComment(e){let t;this.isLookahead||(t=this.state.curPosition());let s=this.state.pos,i=this.input.indexOf(e,s+2);if(i===-1)throw this.raise(p.UnterminatedComment,this.state.curPosition());for(this.state.pos=i+e.length,xt.lastIndex=s+2;xt.test(this.input)&&xt.lastIndex<=i;)++this.state.curLine,this.state.lineStart=xt.lastIndex;if(this.isLookahead)return;let r={type:"CommentBlock",value:this.input.slice(s+2,i),start:this.sourceToOffsetPos(s),end:this.sourceToOffsetPos(i+e.length),loc:new rt(t,this.state.curPosition())};return this.optionFlags&512&&this.pushToken(r),r}skipLineComment(e){let t=this.state.pos,s;this.isLookahead||(s=this.state.curPosition());let i=this.input.charCodeAt(this.state.pos+=e);if(this.state.pos<this.length)for(;!it(i)&&++this.state.pos<this.length;)i=this.input.charCodeAt(this.state.pos);if(this.isLookahead)return;let r=this.state.pos,o={type:"CommentLine",value:this.input.slice(t+e,r),start:this.sourceToOffsetPos(t),end:this.sourceToOffsetPos(r),loc:new rt(s,this.state.curPosition())};return this.optionFlags&512&&this.pushToken(o),o}skipSpace(){let e=this.state.pos,t=(this.optionFlags&8192)>0,s;t:for(;this.state.pos<this.length;){let i=this.input.charCodeAt(this.state.pos);switch(i){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),t&&(s??=[]).push(r));break}case 47:{let r=this.skipLineComment(2);r!==void 0&&(this.addComment(r),t&&(s??=[]).push(r));break}default:break t}break;default:if(Vs(i))++this.state.pos;else if(i===45&&!this.inModule&&this.optionFlags&16384){let r=this.state.pos;if(this.input.charCodeAt(r+1)===45&&this.input.charCodeAt(r+2)===62&&(e===0||this.state.lineStart>e)){let a=this.skipLineComment(3);a!==void 0&&(this.addComment(a),t&&(s??=[]).push(a))}else break t}else if(i===60&&!this.inModule&&this.optionFlags&16384){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),t&&(s??=[]).push(a))}else break t}else break t}}if(s?.length){let i=this.state.pos,r={start:this.sourceToOffsetPos(e),end:this.sourceToOffsetPos(i),comments:s,leadingNode:null,trailingNode:null,containingNode:null};this.state.commentStack.push(r)}}finishToken(e,t){this.state.end=this.state.pos,this.state.endLoc=this.state.curPosition();let s=this.state.type;this.state.type=e,this.state.value=t,this.isLookahead||this.updateContext(s)}replaceToken(e){this.state.type=e,this.updateContext()}readToken_numberSign(){if(this.state.pos===0&&this.readToken_interpreter())return;let e=this.state.pos+1,t=this.codePointAtPos(e);if(t>=48&&t<=57)throw this.raise(p.UnexpectedDigitAfterHash,this.state.curPosition());z(t)?(++this.state.pos,this.finishToken(137,this.readWord1(t))):t===92?(++this.state.pos,this.finishToken(137,this.readWord1())):this.finishOp(23,1)}readToken_dot(){let e=this.input.charCodeAt(this.state.pos+1);if(e>=48&&e<=57){this.readNumber(!0);return}e===46&&this.input.charCodeAt(this.state.pos+2)===46?(this.state.pos+=3,this.finishToken(17)):(++this.state.pos,this.finishToken(12))}readToken_slash(){this.input.charCodeAt(this.state.pos+1)===61?this.finishOp(27,2):this.finishOp(52,1)}readToken_interpreter(){if(this.state.pos!==0||this.length<2)return!1;let e=this.input.charCodeAt(this.state.pos+1);if(e!==33)return!1;let t=this.state.pos;for(this.state.pos+=1;!it(e)&&++this.state.pos<this.length;)e=this.input.charCodeAt(this.state.pos);let s=this.input.slice(t+2,this.state.pos);return this.finishToken(24,s),!0}readToken_mult_modulo(e){let t=e===42?51:50,s=1,i=this.input.charCodeAt(this.state.pos+1);e===42&&i===42&&(s++,i=this.input.charCodeAt(this.state.pos+2),t=53),i===61&&!this.state.inType&&(s++,t=e===37?29:26),this.finishOp(t,s)}readToken_pipe_amp(e){let t=this.input.charCodeAt(this.state.pos+1);if(t===e){this.input.charCodeAt(this.state.pos+2)===61?this.finishOp(26,3):this.finishOp(e===124?37:38,2);return}if(e===124&&t===62){this.finishOp(35,2);return}if(t===61){this.finishOp(26,2);return}this.finishOp(e===124?39:41,1)}readToken_caret(){let e=this.input.charCodeAt(this.state.pos+1);e===61&&!this.state.inType?this.finishOp(28,2):e===94&&this.hasPlugin(["pipelineOperator",{proposal:"hack",topicToken:"^^"}])?(this.finishOp(33,2),this.input.codePointAt(this.state.pos)===94&&this.unexpected()):this.finishOp(40,1)}readToken_atSign(){this.input.charCodeAt(this.state.pos+1)===64&&this.hasPlugin(["pipelineOperator",{proposal:"hack",topicToken:"@@"}])?this.finishOp(34,2):this.finishOp(22,1)}readToken_plus_min(e){let t=this.input.charCodeAt(this.state.pos+1);if(t===e){this.finishOp(30,2);return}t===61?this.finishOp(26,2):this.finishOp(49,1)}readToken_lt(){let{pos:e}=this.state,t=this.input.charCodeAt(e+1);if(t===60){if(this.input.charCodeAt(e+2)===61){this.finishOp(26,3);return}this.finishOp(47,2);return}if(t===61){this.finishOp(45,2);return}this.finishOp(43,1)}readToken_gt(){let{pos:e}=this.state,t=this.input.charCodeAt(e+1);if(t===62){let s=this.input.charCodeAt(e+2)===62?3:2;if(this.input.charCodeAt(e+s)===61){this.finishOp(26,s+1);return}this.finishOp(48,s);return}if(t===61){this.finishOp(45,2);return}this.finishOp(44,1)}readToken_eq_excl(e){let t=this.input.charCodeAt(this.state.pos+1);if(t===61){this.finishOp(42,this.input.charCodeAt(this.state.pos+2)===61?3:2);return}if(e===61&&t===62){this.state.pos+=2,this.finishToken(15);return}this.finishOp(e===61?25:31,1)}readToken_question(){let e=this.input.charCodeAt(this.state.pos+1),t=this.input.charCodeAt(this.state.pos+2);e===63?t===61?this.finishOp(26,3):this.finishOp(36,2):e===46&&!(t>=48&&t<=57)?(this.state.pos+=2,this.finishToken(14)):(++this.state.pos,this.finishToken(13))}getTokenFromCode(e){switch(e){case 46:this.readToken_dot();return;case 40:++this.state.pos,this.finishToken(6);return;case 41:++this.state.pos,this.finishToken(7);return;case 59:++this.state.pos,this.finishToken(9);return;case 44:++this.state.pos,this.finishToken(8);return;case 91:++this.state.pos,this.finishToken(0);return;case 93:++this.state.pos,this.finishToken(1);return;case 123:++this.state.pos,this.finishToken(2);return;case 125:++this.state.pos,this.finishToken(4);return;case 58:this.hasPlugin("functionBind")&&this.input.charCodeAt(this.state.pos+1)===58?this.finishOp(11,2):(++this.state.pos,this.finishToken(10));return;case 63:this.readToken_question();return;case 96:this.readTemplateToken();return;case 48:{let t=this.input.charCodeAt(this.state.pos+1);if(t===120||t===88){this.readRadixNumber(16);return}if(t===111||t===79){this.readRadixNumber(8);return}if(t===98||t===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(e);return;case 47:this.readToken_slash();return;case 37:case 42:this.readToken_mult_modulo(e);return;case 124:case 38:this.readToken_pipe_amp(e);return;case 94:this.readToken_caret();return;case 43:case 45:this.readToken_plus_min(e);return;case 60:this.readToken_lt();return;case 62:this.readToken_gt();return;case 61:case 33:this.readToken_eq_excl(e);return;case 126:this.finishOp(32,1);return;case 64:this.readToken_atSign();return;case 35:this.readToken_numberSign();return;case 92:this.readWord();return;default:if(z(e)){this.readWord(e);return}}throw this.raise(p.InvalidOrUnexpectedToken,this.state.curPosition(),{unexpected:String.fromCodePoint(e)})}finishOp(e,t){let s=this.input.slice(this.state.pos,this.state.pos+t);this.state.pos+=t,this.finishToken(e,s)}readRegexp(){let e=this.state.startLoc,t=this.state.start+1,s,i,{pos:r}=this.state;for(;;++r){if(r>=this.length)throw this.raise(p.UnterminatedRegExp,U(e,1));let h=this.input.charCodeAt(r);if(it(h))throw this.raise(p.UnterminatedRegExp,U(e,1));if(s)s=!1;else{if(h===91)i=!0;else if(h===93&&i)i=!1;else if(h===47&&!i)break;s=h===92}}let a=this.input.slice(t,r);++r;let o="",c=()=>U(e,r+2-t);for(;r<this.length;){let h=this.codePointAtPos(r),l=String.fromCharCode(h);if(Gs.has(h))h===118?o.includes("u")&&this.raise(p.IncompatibleRegExpUVFlags,c()):h===117&&o.includes("v")&&this.raise(p.IncompatibleRegExpUVFlags,c()),o.includes(l)&&this.raise(p.DuplicateRegExpFlags,c());else if(J(h)||h===92)this.raise(p.MalformedRegExpFlags,c());else break;++r,o+=l}this.state.pos=r,this.finishToken(136,{pattern:a,flags:o})}readInt(e,t,s=!1,i=!0){let{n:r,pos:a}=We(this.input,this.state.pos,this.state.lineStart,this.state.curLine,e,t,s,i,this.errorHandlers_readInt,!1);return this.state.pos=a,r}readLiteralInt(e){let t=this.state.pos,s=0,i;for(;;){i=this.input.charCodeAt(t);let r;if(i>=48&&i<=57)r=i-48;else{if(r=(i|32)-97,r<0||r>5)break;r+=10}if(r>=e)break;s=s*e+r,++t}return i===95||i>=48&&i<=57?this.readInt(e):t===this.state.pos?null:(this.state.pos=t,s)}readRadixNumber(e){let t=this.state.pos,s=this.state.curPosition();this.state.pos+=2;let i=this.readLiteralInt(e),r=this.state.pos;i==null&&this.raise(p.InvalidDigit,U(s,2),{radix:e});let a=this.input.charCodeAt(this.state.pos)===110;if(a&&++this.state.pos,z(this.codePointAtPos(this.state.pos)))throw this.raise(p.NumberIdentifier,this.state.curPosition());if(a||i!==null&&i>Number.MAX_SAFE_INTEGER){let o=this.input.slice(t,r).replaceAll("_","");if(a){this.finishToken(135,o);return}i=Number(e!==16&&this.optionFlags&4096?o.replace(e===2?/[2-9]/g:/[89]/g,"0"):o)}this.finishToken(134,i)}readNumber(e){let t=this.state.pos,s=this.state.curPosition(),i=!1,r=!1,a=e?0:this.readLiteralInt(10),o=this.state.pos-t>=2&&this.input.charCodeAt(t)===48;if(o){let d=this.input.slice(t,this.state.pos);if(this.recordStrictModeErrors(p.StrictOctalLiteral,s),!this.state.strict){let y=d.indexOf("_");y>0&&this.raise(p.ZeroDigitNumericSeparator,U(s,y))}r=!/[89]/.test(d)}let c=this.input.charCodeAt(this.state.pos);c===46&&!r&&(++this.state.pos,this.readLiteralInt(10),i=!0,c=this.input.charCodeAt(this.state.pos)),(c===69||c===101)&&!r&&(c=this.input.charCodeAt(++this.state.pos),(c===43||c===45)&&++this.state.pos,this.readLiteralInt(10)===null&&this.raise(p.InvalidOrMissingExponent,s),i=!0,c=this.input.charCodeAt(this.state.pos));let h=this.state.pos,l=c===110;if(l&&((i||o)&&this.raise(p.InvalidBigIntLiteral,s),++this.state.pos),z(this.codePointAtPos(this.state.pos)))throw this.raise(p.NumberIdentifier,this.state.curPosition());if(!i&&!l&&!o&&a<=Number.MAX_SAFE_INTEGER){this.finishToken(134,a);return}let u=this.input.slice(t,h).replaceAll("_","");if(l){this.finishToken(135,u);return}let f=r?parseInt(u,8):parseFloat(u);this.finishToken(134,f)}readCodePoint(e){let{code:t,pos:s}=Je(this.input,this.state.pos,this.state.lineStart,this.state.curLine,e,this.errorHandlers_readCodePoint);return this.state.pos=s,t}readString(e){let{str:t,pos:s,curLine:i,lineStart:r}=Le(e===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=r,this.state.curLine=i,this.finishToken(133,t)}readTemplateContinuation(){this.match(4)||this.unexpected(null,4),this.state.pos--,this.readTemplateToken()}readTemplateToken(){let e=this.input[this.state.pos],{str:t,firstInvalidLoc:s,pos:i,curLine:r,lineStart:a}=Le("template",this.input,this.state.pos+1,this.state.lineStart,this.state.curLine,this.errorHandlers_readStringContents_template);this.state.pos=i+1,this.state.lineStart=a,this.state.curLine=r,s&&(this.state.firstInvalidTemplateEscapePos=new D(s.curLine,s.pos-s.lineStart,this.sourceToOffsetPos(s.pos))),this.input.codePointAt(i)===96?this.finishToken(20,s?null:e+t+"`"):(this.state.pos++,this.finishToken(21,s?null:e+t+"${"))}recordStrictModeErrors(e,t){if(this.isLookahead)return;let s=t.index;this.state.strict&&!this.state.strictErrors.has(s)?this.raise(e,t):this.state.strictErrors.set(s,[e,t])}readWord1(e){this.state.containsEsc=!1;let t="",s=this.state.pos,i=this.state.pos;for(e!==void 0&&(this.state.pos+=e<=65535?1:2);this.state.pos<this.length;){let r=this.codePointAtPos(this.state.pos);if(J(r))this.state.pos+=r<=65535?1:2;else if(r===92){this.state.containsEsc=!0,t+=this.input.slice(i,this.state.pos);let a=this.state.curPosition(),o=this.state.pos===s?z:J;if(this.input.charCodeAt(++this.state.pos)!==117){this.raise(p.MissingUnicodeEscape,this.state.curPosition()),i=this.state.pos-1;continue}++this.state.pos;let c=this.readCodePoint(!0);c!==null&&(o(c)||this.raise(p.EscapedCharNotAnIdentifier,a),t+=String.fromCodePoint(c)),i=this.state.pos}else break}return t+this.input.slice(i,this.state.pos)}readWord(e){let t=this.readWord1(e),s=le.get(t);s!==void 0?this.finishToken(s,W(s)):this.finishToken(131,t)}checkKeywordEscapes(){let{type:e}=this.state;wt(e)&&this.state.containsEsc&&this.raise(p.InvalidEscapedReservedWord,this.state.startLoc,{reservedWord:W(e)})}raise(e,t,s={}){let i=t instanceof D?t:typeof t=="number"?this.getLoc(t):this.optionFlags&256?t.loc.start:this.getLoc(t.start),r=t instanceof D?i.index:typeof t=="number"?t:t.start,a=e(i,r,s);if(!(this.optionFlags&4096))throw a;return this.isLookahead||this.state.errors.push(a),a}raiseOverwrite(e,t,s={}){let i=t instanceof D?t:this.optionFlags&256?t.loc.start:this.getLoc(t.start),r=t instanceof D?i.index:t.start,a=this.state.errors;for(let o=a.length-1;o>=0;o--){let c=a[o];if(c.pos===r)return a[o]=e(i,r,s);if(c.pos<r)break}return this.raise(e,i,s)}updateContext(e){}unexpected(e,t){throw this.raise(p.UnexpectedToken,e??this.state.startLoc,{expected:t?W(t):null})}expectPlugin(e,t){if(this.hasPlugin(e))return!0;throw this.raise(p.MissingPlugin,t??this.state.startLoc,{missingPlugin:[e]})}expectOnePlugin(e){if(!e.some(t=>this.hasPlugin(t)))throw this.raise(p.MissingOneOfPlugins,this.state.startLoc,{missingPlugin:e})}errorBuilder(e){return(t,s,i)=>{this.raise(e,ct(t,s,i))}}errorHandlers_readInt={invalidDigit:(e,t,s,i)=>{this.raise(p.InvalidDigit,ct(e,t,s),{radix:i})},numericSeparatorInEscapeSequence:this.errorBuilder(p.NumericSeparatorInEscapeSequence),unexpectedNumericSeparator:this.errorBuilder(p.UnexpectedNumericSeparator)};errorHandlers_readCodePoint={...this.errorHandlers_readInt,invalidEscapeSequence:this.errorBuilder(p.InvalidEscapeSequence),invalidCodePoint:this.errorBuilder(p.InvalidCodePoint)};errorHandlers_readStringContents_string={...this.errorHandlers_readCodePoint,strictNumericEscape:(e,t,s)=>{this.recordStrictModeErrors(p.StrictNumericEscape,ct(e,t,s))},unterminated:(e,t,s)=>{throw this.raise(p.UnterminatedString,ct(e-1,t,s))}};errorHandlers_readStringContents_template={...this.errorHandlers_readCodePoint,strictNumericEscape:this.errorBuilder(p.StrictNumericEscape),unterminated:(e,t,s)=>{throw this.raise(p.UnterminatedTemplate,ct(e,t,s))}}},Zt=class{privateNames=new Set;loneAccessors=new Map;undefinedPrivateNames=new Map},te=class{parser;stack=[];constructor(e){this.parser=e}current(){return this.stack[this.stack.length-1]}enter(){this.stack.push(new Zt)}exit(){let e=this.stack.pop(),t=this.current();for(let[s,i]of Array.from(e.undefinedPrivateNames))t?t.undefinedPrivateNames.has(s)||t.undefinedPrivateNames.set(s,i):this.parser.raise(p.InvalidPrivateFieldResolution,i,{identifierName:s})}declarePrivateName(e,t,s){let{privateNames:i,loneAccessors:r,undefinedPrivateNames:a}=this.current(),o=i.has(e);if(t&3){let c=o&&r.get(e);if(c){let h=c&4,l=t&4,u=c&3,f=t&3;o=u===f||h!==l,o||r.delete(e)}else o||r.set(e,t)}o&&this.parser.raise(p.PrivateNameRedeclaration,s,{identifierName:e}),i.add(e),a.delete(e)}usePrivateName(e,t){let s;for(s of this.stack)if(s.privateNames.has(e))return;s?s.undefinedPrivateNames.set(e,t):this.parser.raise(p.InvalidPrivateFieldResolution,t,{identifierName:e})}},Z=class{constructor(e=0){this.type=e}canBeArrowParameterDeclaration(){return this.type===2||this.type===1}isCertainlyParameterDeclaration(){return this.type===3}isInitializer(){return this.type===4}},Nt=class extends Z{declarationErrors=new Map;constructor(e){super(e)}recordDeclarationError(e,t){this.declarationErrors.set(t,e)}clearDeclarationError(e){this.declarationErrors.delete(e)}iterateErrors(e){this.declarationErrors.forEach(e)}},ee=class{parser;stack=[new Z];constructor(e){this.parser=e}enter(e){this.stack.push(e)}exit(){this.stack.pop()}canBeInParameters(){let e=this.stack[this.stack.length-1];return e.canBeArrowParameterDeclaration()||e.isCertainlyParameterDeclaration()}recordParameterInitializerError(e,t){let{stack:s}=this,i=s.length-1,r=s[i];for(;!r.isCertainlyParameterDeclaration();){if(r.canBeArrowParameterDeclaration())r.recordDeclarationError(e,t);else if(!r.isInitializer())return;r=s[--i]}this.parser.raise(e,t)}recordArrowParameterBindingError(e,t){let{stack:s}=this,i=s[s.length-1],r=t.start;if(i.isCertainlyParameterDeclaration())this.parser.raise(e,r);else if(i.canBeArrowParameterDeclaration())i.recordDeclarationError(e,r);else return}recordAsyncArrowParametersError(e){let{stack:t}=this;for(let s=t.length-1;;s--){let i=t[s];if(i.canBeArrowParameterDeclaration())i.type===2&&i.recordDeclarationError(p.AwaitBindingIdentifier,e);else if(!i.isInitializer())return}}validateAsPattern(){let{stack:e}=this,t=e[e.length-1];t.canBeArrowParameterDeclaration()&&t.iterateErrors((s,i)=>{this.parser.raise(s,i);for(let r=e.length-2;;r--){let a=e[r];if(a.canBeArrowParameterDeclaration())a.clearDeclarationError(i);else if(!a.isInitializer())break}})}};function Ys(){return new Nt(1)}function Qs(){return new Nt(2)}var se=new Z,Zs=new Z(3),ti=new Z(4),ie=class{stacks=[];enter(e){this.stacks.push(e)}exit(){this.stacks.pop()}currentFlags(){return this.stacks[this.stacks.length-1]}get hasAwait(){return(this.currentFlags()&2)>0}get hasYield(){return(this.currentFlags()&1)>0}get hasReturn(){return(this.currentFlags()&4)>0}get hasIn(){return(this.currentFlags()&8)>0}get inFSharpPipelineDirectBody(){return(this.currentFlags()&16)===0}};function bt(n,e){return(n?2:0)|(e?1:0)}var re=class extends Qt{addExtra(e,t,s,i=!0){if(!e)return;let{extra:r}=e;r==null&&(r={},e.extra=r),i?r[t]=s:Object.defineProperty(r,t,{enumerable:i,value:s})}isContextual(e){return this.state.type===e&&!this.state.containsEsc}isUnparsedContextual(e,t){if(this.input.startsWith(t,e)){let s=this.input.charCodeAt(e+t.length);return!(J(s)||s===92||(s&64512)===55296)}return!1}isLookaheadContextual(e){let t=this.nextTokenStart();return this.isUnparsedContextual(t,e)}eatContextual(e){return this.isContextual(e)?(this.next(),!0):!1}expectContextual(e,t){if(!this.eatContextual(e)){if(t!=null)throw this.raise(t,this.state.startLoc);this.unexpected(null,e)}}canInsertSemicolon(){return this.match(138)||this.match(4)||this.hasPrecedingLineBreak()}hasPrecedingLineBreak(){return qt(this.input,this.offsetToSourcePos(this.state.lastTokEndLoc.index),this.state.start)}hasFollowingLineBreak(){return qt(this.input,this.state.end,this.nextTokenStart())}isLineTerminator(){return this.eat(9)||this.canInsertSemicolon()}semicolon(e=!0){(e?this.isLineTerminator():this.eat(9))||this.raise(p.MissingSemicolon,this.state.lastTokEndLoc)}expect(e,t){this.eat(e)||this.unexpected(t,e)}snapshotScopeStacks(){return{scopeDepth:this.scope.scopeStack.length,prodParamDepth:this.prodParam.stacks.length,classScopeDepth:this.classScope.stack.length,expressionScopeDepth:this.expressionScope.stack.length}}restoreScopeStacks(e){let{scope:t}=this;for(;t.scopeStack.length>e.scopeDepth;)t.exit();this.prodParam.stacks.length=e.prodParamDepth,this.classScope.stack.length=e.classScopeDepth,this.expressionScope.stack.length=e.expressionScopeDepth}tryParse(e,t=this.state.clone()){let s={node:null},i=this.snapshotScopeStacks();try{let r=e((a=null)=>{throw s.node=a,s});if(this.state.errors.length>t.errors.length){let a=this.state;return this.state=t,this.state.tokensLength=a.tokensLength,{node:r,error:a.errors[t.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=t,this.restoreScopeStacks(i),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(e,t){if(!e)return!1;let{shorthandAssignLoc:s,doubleProtoLoc:i,privateKeyLoc:r,optionalParametersLoc:a,voidPatternLoc:o}=e,c=!!s||!!i||!!a||!!r||!!o;if(!t)return c;s!=null&&this.raise(p.InvalidCoverInitializedName,s),i!=null&&this.raise(p.DuplicateProto,i),r!=null&&this.raise(p.UnexpectedPrivateField,r),a!=null&&this.unexpected(a),o!=null&&this.raise(p.InvalidCoverDiscardElement,o)}isLiteralPropertyName(){return je(this.state.type)}isPrivateName(e){return e.type==="PrivateName"}getPrivateNameSV(e){return e.id.name}hasPropertyAsPrivateName(e){return(e.type==="MemberExpression"||e.type==="OptionalMemberExpression")&&this.isPrivateName(e.property)}isObjectProperty(e){return e.type==="ObjectProperty"}isObjectMethod(e){return e.type==="ObjectMethod"}initializeScopes(e=this.options.sourceType==="module"){let t=this.state.labels;this.state.labels=[];let s=this.exportedIdentifiers;this.exportedIdentifiers=new Set;let i=this.inModule;this.inModule=e;let r=this.scope,a=this.getScopeHandler();this.scope=new a(this,e);let o=this.prodParam;this.prodParam=new ie;let c=this.classScope;this.classScope=new te(this);let h=this.expressionScope;return this.expressionScope=new ee(this),()=>{this.state.labels=t,this.exportedIdentifiers=s,this.inModule=i,this.scope=r,this.prodParam=o,this.classScope=c,this.expressionScope=h}}enterInitialScopes(){let e=0;(this.inModule||this.optionFlags&1)&&(e|=2),this.optionFlags&32&&(e|=1);let t=!this.inModule&&this.options.sourceType==="commonjs";(t||this.optionFlags&2)&&(e|=4),this.prodParam.enter(e);let s=t?514:1;this.optionFlags&4&&(s|=512),this.optionFlags&16&&(s|=48),this.scope.enter(s)}checkDestructuringPrivate(e){let{privateKeyLoc:t}=e;t!==null&&this.expectPlugin("destructuringPrivate",t)}},G=class{shorthandAssignLoc=null;doubleProtoLoc=null;privateKeyLoc=null;optionalParametersLoc=null;voidPatternLoc=null},Y=class{constructor(e,t,s,i){this.start=s,this.end=0,i!==void 0&&(this.loc=new rt(i)),e&128&&(this.range=[s,0]),i!==void 0&&t&&(this.loc.filename=t)}type=""},De=Y.prototype,ae=class extends re{createPosition(e){return e}startNode(){return this.startNodeAt(this.state.startLoc)}startNodeAt(e){this.setLoc(e);let{optionFlags:t,filename:s}=this;return t&256?new Y(t,s,e.index,this.createPosition(e)):new Y(t,s,e.index)}startNodeAtNode(e){let{optionFlags:t,filename:s}=this;return t&256?new Y(t,s,e.start,e.loc.start):new Y(t,s,e.start)}finishNode(e,t){return this.finishNodeAt(e,t,this.state.lastTokEndLoc)}finishNodeAt(e,t,s){e.type=t,e.end=s.index;let{optionFlags:i}=this;return i&256&&(e.loc.end=this.createPosition(s)),i&128&&(e.range[1]=s.index),i&8192&&this.processComment(e),e}finishNodeAtNode(e,t,s){e.type=t,e.end=s.end;let{optionFlags:i}=this;return i&256&&(e.loc.end=s.loc.end),i&128&&(e.range[1]=e.end),i&8192&&this.processComment(e),e}resetStartLocation(e,t){e.start=t.index;let{optionFlags:s}=this;s&256&&(e.loc.start=this.createPosition(t)),s&128&&(e.range[0]=t.index)}resetEndLocation(e,t=this.state.lastTokEndLoc){e.end=t.index;let{optionFlags:s}=this;s&256&&(e.loc.end=this.createPosition(t)),s&128&&(e.range[1]=t.index)}resetStartLocationFromNode(e,t){e.start=t.start;let{optionFlags:s}=this;s&256&&(e.loc.start=t.loc.start),s&128&&(e.range[0]=t.start)}resetEndLocationFromNode(e,t){e.end=t.end;let{optionFlags:s}=this;s&256&&(e.loc.end=t.loc.end),s&128&&(e.range[1]=t.end)}castNodeTo(e,t){return e.type=t,e}cloneIdentifier(e){let{type:t,start:s,end:i,loc:r,range:a,name:o}=e,c=Object.create(De);return c.type=t,c.start=s,c.end=i,c.loc=r,c.range=a,c.name=o,e.extra&&(c.extra=e.extra),c}cloneStringLiteral(e){let{type:t,start:s,end:i,loc:r,range:a,extra:o}=e,c=Object.create(De);return c.type=t,c.start=s,c.end=i,c.loc=r,c.range=a,c.extra=o,c.value=e.value,c}},It=n=>n.type==="ParenthesizedExpression"?It(n.expression):n,ne=class extends ae{raiseOnce(e,t){let{errors:s}=this.state,i=s.length,r=this.raise(e,t);if(s.length!==i){for(let a=i-1;a>=0;a--)if(s[a].pos===r.pos&&s[a].reasonCode===r.reasonCode){s.pop();return}}}toAssignable(e,t=!1){let s;switch((e.type==="ParenthesizedExpression"||e.extra?.parenthesized)&&(s=It(e),t?s.type==="Identifier"?this.expressionScope.recordArrowParameterBindingError(p.InvalidParenthesizedAssignment,e):s.type!=="CallExpression"&&s.type!=="MemberExpression"&&!this.isOptionalMemberExpression(s)&&this.raiseOnce(p.InvalidParenthesizedAssignment,e):this.raiseOnce(p.InvalidParenthesizedAssignment,e)),e.type){case"Identifier":case"ObjectPattern":case"ArrayPattern":case"AssignmentPattern":case"RestElement":case"VoidPattern":break;case"ObjectExpression":this.castNodeTo(e,"ObjectPattern");for(let i=0,r=e.properties.length,a=r-1;i<r;i++){let o=e.properties[i],c=i===a;this.toAssignableObjectExpressionProp(o,c,t),c&&o.type==="RestElement"&&e.extra?.trailingCommaLoc&&this.raise(p.RestTrailingComma,e.extra.trailingCommaLoc)}break;case"ObjectProperty":{let{key:i,value:r}=e;this.isPrivateName(i)&&this.classScope.usePrivateName(this.getPrivateNameSV(i),i.start),this.toAssignable(r,t);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":this.castNodeTo(e,"ArrayPattern"),this.toAssignableList(e.elements,e.extra?.trailingCommaLoc,t);break;case"AssignmentExpression":e.operator!=="="&&this.raise(p.MissingEqInAssignment,this.optionFlags&256?e.left.loc.end:e.left),this.castNodeTo(e,"AssignmentPattern"),delete e.operator,e.left.type==="VoidPattern"&&this.raise(p.VoidPatternInitializer,e.left),this.toAssignable(e.left,t);break;case"ParenthesizedExpression":this.toAssignable(s,t);break}}toAssignableObjectExpressionProp(e,t,s){if(e.type==="ObjectMethod")this.raise(e.kind==="get"||e.kind==="set"?p.PatternHasAccessor:p.PatternHasMethod,e.key);else if(e.type==="SpreadElement"){this.castNodeTo(e,"RestElement");let i=e.argument;this.checkToRestConversion(i,!1),this.toAssignable(i,s),t||this.raise(p.RestTrailingComma,e)}else this.toAssignable(e,s)}toAssignableList(e,t,s){let i=e.length-1;for(let r=0;r<=i;r++){let a=e[r];a&&(this.toAssignableListItem(e,r,s),a.type==="RestElement"&&(r<i?this.raise(p.RestTrailingComma,a):t&&this.raise(p.RestTrailingComma,t)))}}toAssignableListItem(e,t,s){let i=e[t];if(i.type==="SpreadElement"){this.castNodeTo(i,"RestElement");let r=i.argument;this.checkToRestConversion(r,!0),this.toAssignable(r,s)}else this.toAssignable(i,s)}isAssignable(e,t){switch(e.type){case"Identifier":case"ObjectPattern":case"ArrayPattern":case"AssignmentPattern":case"RestElement":case"VoidPattern":return!0;case"ObjectExpression":{let s=e.properties.length-1;return e.properties.every((i,r)=>i.type!=="ObjectMethod"&&(r===s||i.type!=="SpreadElement")&&this.isAssignable(i))}case"ObjectProperty":return this.isAssignable(e.value);case"SpreadElement":return this.isAssignable(e.argument);case"ArrayExpression":return e.elements.every(s=>s===null||this.isAssignable(s));case"AssignmentExpression":return e.operator==="=";case"ParenthesizedExpression":return this.isAssignable(e.expression);case"MemberExpression":case"OptionalMemberExpression":return!t;default:return!1}}toReferencedList(e,t){return e}parseSpread(e){let t=this.startNode();return this.next(),t.argument=this.parseMaybeAssignAllowIn(e),this.finishNode(t,"SpreadElement")}parseRestBinding(){let e=this.startNode();this.next();let t=this.parseBindingAtom();return t.type==="VoidPattern"&&this.raise(p.UnexpectedVoidPattern,t),e.argument=t,this.finishNode(e,"RestElement")}parseBindingAtom(){switch(this.state.type){case 0:{let e=this.startNode();return this.next(),e.elements=this.parseBindingList(1,93,1),this.finishNode(e,"ArrayPattern")}case 2:return this.parseObjectLike(4,!0);case 84:return this.parseVoidPattern(null)}return this.parseIdentifier()}parseBindingList(e,t,s){let i=s&1,r=[],a=!0;for(;!this.eat(e);)if(a?a=!1:this.expect(8),i&&this.match(8))r.push(null);else{if(this.eat(e))break;if(this.match(17)){let o=this.parseRestBinding();if(s&2&&(o=this.parseFunctionParamType(o)),r.push(o),!this.checkCommaAfterRest(t)){this.expect(e);break}}else{let o=[];if(s&2)for(this.match(22)&&this.hasPlugin("decorators")&&this.raise(p.UnsupportedParameterDecorator,this.state.startLoc);this.match(22);)o.push(this.parseDecorator());r.push(this.parseBindingElement(s,o))}}return r}parseBindingRestProperty(e){return this.next(),this.hasPlugin("discardBinding")&&this.match(84)?(e.argument=this.parseVoidPattern(null),this.raise(p.UnexpectedVoidPattern,e.argument)):e.argument=this.parseIdentifier(),this.checkCommaAfterRest(125),this.finishNode(e,"RestElement")}parseBindingProperty(){let{type:e,startLoc:t}=this.state;if(e===17)return this.parseBindingRestProperty(this.startNode());let s=this.startNode();return e===137?(this.expectPlugin("destructuringPrivate",t),this.classScope.usePrivateName(this.state.value,t),s.key=this.parsePrivateName()):this.parsePropertyName(s),s.method=!1,this.parseObjPropValue(s,t,!1,!1,!0,!1)}parseBindingElement(e,t){let{startLoc:s}=this.state,i=this.parseMaybeDefault();return e&2&&this.parseFunctionParamType(i),t.length&&(i.decorators=t,this.resetStartLocationFromNode(i,t[0])),this.parseMaybeDefault(s,i)}parseFunctionParamType(e){return e}parseMaybeDefault(e,t){if(e??=this.state.startLoc,t=t??this.parseBindingAtom(),!this.eat(25))return t;let s=this.startNodeAt(e);return t.type==="VoidPattern"&&this.raise(p.VoidPatternInitializer,t),s.left=t,s.right=this.parseMaybeAssignAllowIn(),this.finishNode(s,"AssignmentPattern")}isValidLVal(e,t,s,i){switch(e){case"AssignmentPattern":return"left";case"RestElement":return"argument";case"ObjectProperty":return"value";case"ParenthesizedExpression":return"expression";case"ArrayPattern":return"elements";case"ObjectPattern":return"properties";case"VoidPattern":return!0;case"CallExpression":if(!t&&!this.state.strict&&this.optionFlags&16384)return!0}return!1}isOptionalMemberExpression(e){return e.type==="OptionalMemberExpression"}checkLVal(e,t,s=64,i=!1,r=!1,a=!1,o=!1){let c=e.type;if(this.isObjectMethod(e))return;let h=this.isOptionalMemberExpression(e);if(h||c==="MemberExpression"){h&&(this.expectPlugin("optionalChainingAssign",e.start),t.type!=="AssignmentExpression"&&this.raise(p.InvalidLhsOptionalChaining,e,{ancestor:t})),s!==64&&this.raise(p.InvalidPropertyBindingPattern,e);return}if(c==="Identifier"){this.checkIdentifier(e,s,r);let{name:C}=e;i&&(i.has(C)?this.raise(p.ParamDupe,e):i.add(C));return}else c==="VoidPattern"&&t.type==="CatchClause"&&this.raise(p.VoidPatternCatchClauseParam,e);let l=It(e);o||=s!==64||l.type==="CallExpression"&&(l.callee.type==="Import"||l.callee.type==="Super");let u=this.isValidLVal(c,o,!(a||e.extra?.parenthesized)&&t.type==="AssignmentExpression",s);if(u===!0)return;if(u===!1){let C=s===64?p.InvalidLhs:p.InvalidLhsBinding;this.raise(C,e,{ancestor:t});return}let f,d;typeof u=="string"?(f=u,d=c==="ParenthesizedExpression"):[f,d]=u;let y=c==="ArrayPattern"||c==="ObjectPattern"?{type:c}:t,P=e[f];if(Array.isArray(P))for(let C of P)C&&this.checkLVal(C,y,s,i,r,d,!0);else P&&this.checkLVal(P,y,s,i,r,d,o)}checkIdentifier(e,t,s=!1){this.checkStrictBindReservedWord(e,t,s),t&8192&&e.name==="let"&&this.raise(p.LetInLexicalBinding,e),t&64||this.declareNameFromIdentifier(e,t)}checkStrictBindReservedWord(e,t,s=!1){this.state.strict&&(s?qe(e.name,this.inModule):Ve(e.name))&&(t===64?this.raise(p.StrictEvalArguments,e,{referenceName:e.name}):this.raise(p.StrictEvalArgumentsBinding,e,{bindingName:e.name}))}declareNameFromIdentifier(e,t){this.scope.declareName(e.name,t,e.start)}checkToRestConversion(e,t){switch(e.type){case"ParenthesizedExpression":this.checkToRestConversion(e.expression,t);break;case"Identifier":case"MemberExpression":break;case"ArrayExpression":case"ObjectExpression":if(t)break;default:this.raise(p.InvalidRestAssignmentPattern,e)}}checkCommaAfterRest(e){return this.match(8)?(this.raise(this.lookaheadCharCode()===e?p.RestTrailingComma:p.ElementAfterRest,this.state.startLoc),!0):!1}},oe=class extends ne{checkProto(e,t,s){if(e.type==="SpreadElement"||this.isObjectMethod(e)||e.computed||e.shorthand)return t;let i=e.key;return(i.type==="Identifier"?i.name:i.value)==="__proto__"?(t&&(s?s.doubleProtoLoc===null&&(s.doubleProtoLoc=this.getLoc(i.start)):this.raise(p.DuplicateProto,i)),!0):t}shouldExitDescending(e){return e.type==="ArrowFunctionExpression"&&!e.extra?.parenthesized}getExpression(){if(this.enterInitialScopes(),this.nextToken(),this.match(138))throw this.raise(p.ParseExpressionEmptyInput,this.state.startLoc);let e=this.parseExpression();if(!this.match(138))throw this.raise(p.ParseExpressionExpectsEOF,this.state.startLoc,{unexpected:this.input.codePointAt(this.state.start)});return this.finalizeRemainingComments(),e.comments=this.comments,e.errors=this.state.errors,this.optionFlags&512&&(e.tokens=Xe(this.tokens)),e}parseExpression(e,t){return e?this.disallowInAnd(()=>this.parseExpressionBase(t)):this.allowInAnd(()=>this.parseExpressionBase(t))}parseExpressionBase(e){let t=this.state.startLoc,s=this.parseMaybeAssign(e);if(this.match(8)){let i=this.startNodeAt(t);for(i.expressions=[s];this.eat(8);)i.expressions.push(this.parseMaybeAssign(e));return this.toReferencedList(i.expressions),this.finishNode(i,"SequenceExpression")}return s}parseMaybeAssignDisallowIn(e){return this.disallowInAnd(()=>this.parseMaybeAssign(e))}parseMaybeAssignAllowIn(e,t){return this.allowInAnd(()=>this.parseMaybeAssign(e,t))}setOptionalParametersError(e){e.optionalParametersLoc=this.state.startLoc}parseMaybeAssign(e,t){let s=this.state.startLoc,i=this.isContextual(107);if(i&&this.prodParam.hasYield){this.next();let c=this.parseYield(s);return t&&(c=this.parseParenItem(c,s)),c}let r,a=!1;e?r=!1:(e=new G,r=!0,this.expressionScope.canBeInParameters()&&(this.expressionScope.enter(ti),a=!0)),this.state.canStartArrow=!0;let o=this.parseMaybeConditional(e);if(t&&(o=this.parseParenItem(o,s)),gs(this.state.type)&&!(this.match(27)&&this.state.lastTokEndLoc.index===this.state.regExpAllowedAt)){let c=this.startNodeAt(s),h=this.state.value;if(c.operator=h,this.match(25)){this.toAssignable(o,!0),c.left=o;let l=s.index;e.doubleProtoLoc!=null&&e.doubleProtoLoc.index>=l&&(e.doubleProtoLoc=null),e.shorthandAssignLoc!=null&&e.shorthandAssignLoc.index>=l&&(e.shorthandAssignLoc=null),e.privateKeyLoc!=null&&e.privateKeyLoc.index>=l&&(this.checkDestructuringPrivate(e),e.privateKeyLoc=null),e.voidPatternLoc!=null&&e.voidPatternLoc.index>=l&&(e.voidPatternLoc=null)}else c.left=o;return this.next(),c.right=this.parseMaybeAssign(),a&&this.expressionScope.exit(),this.checkLVal(o,this.finishNode(c,"AssignmentExpression"),void 0,void 0,void 0,void 0,h==="||="||h==="&&="||h==="??="),c}else r&&(this.checkExpressionErrors(e,!0),a&&this.expressionScope.exit());if(i){let{type:c}=this.state;if((this.hasPlugin("v8intrinsic")?ht(c):ht(c)&&!this.match(50))&&!this.isAmbiguousPrefixOrIdentifier())return this.raiseOverwrite(p.YieldNotInGeneratorFunction,s),this.parseYield(s)}return o}parseMaybeConditional(e){let t=this.state.startLoc,s=this.parseExprOps(e);return this.shouldExitDescending(s)?s:this.parseConditional(s,t,e)}parseConditional(e,t,s){if(this.eat(13)){let i=this.startNodeAt(t);return i.test=e,i.consequent=this.parseMaybeAssignAllowIn(),this.expect(10),i.alternate=this.parseMaybeAssign(),this.finishNode(i,"ConditionalExpression")}return e}parseMaybeUnaryOrPrivate(e){return this.match(137)?this.parsePrivateName():this.parseMaybeUnary(e)}parseExprOps(e){let t=this.state.startLoc,s=this.parseMaybeUnaryOrPrivate(e);return this.shouldExitDescending(s)?s:(this.state.canStartArrow=!1,this.parseExprOp(s,t,-1))}isEscapedKeywordOperatorAfterLineBreak(){return wt(this.state.type)&&this.state.containsEsc&&this.hasPrecedingLineBreak()}isBinaryOperator(e){return Ts(e)&&(this.prodParam.hasIn||e!==54)&&!this.isEscapedKeywordOperatorAfterLineBreak()}parseExprOp(e,t,s){let i=this.state.type,r=this.isBinaryOperator(i);if(this.isPrivateName(e)){let a=this.getPrivateNameSV(e);(s>=At(54)||i!==54||!r)&&this.raise(p.PrivateInExpectedIn,t,{identifierName:a}),this.classScope.usePrivateName(a,t)}if(r){let a=At(i);if(a>s){if(i===35&&(this.expectPlugin("pipelineOperator"),this.prodParam.inFSharpPipelineDirectBody))return e;let o=this.startNodeAt(t);o.left=e,o.operator=this.state.value;let c=i===37||i===38,h=i===36;h&&(a=At(38)),this.next(),o.right=this.parseExprOpRightExpr(i,a);let l=this.finishNode(o,c||h?"LogicalExpression":"BinaryExpression"),u=this.state.type;if(h&&(u===37||u===38)||c&&u===36)throw this.raise(p.MixingCoalesceWithLogical,this.state.startLoc);return this.parseExprOp(l,t,s)}}return e}parseExprOpRightExpr(e,t){switch(e){case 35:switch(this.getPluginOption("pipelineOperator","proposal")){case"hack":return this.withTopicBindingContext(()=>this.parseHackPipeBody());case"fsharp":return this.parseFSharpPipelineBody(t)}default:return this.parseExprOpBaseRightExpr(e,t)}}parseExprOpBaseRightExpr(e,t){let s=this.state.startLoc;return this.parseExprOp(this.parseMaybeUnaryOrPrivate(),s,Ns(e)?t-1:t)}parseHackPipeBody(){let{startLoc:e}=this.state,t=this.parseMaybeAssign();return os.has(t.type)&&!t.extra?.parenthesized&&this.raise(p.PipeUnparenthesizedBody,e,{type:t.type}),this.topicReferenceWasUsedInCurrentContext()||this.raise(p.PipeTopicUnused,e),t}checkExponentialAfterUnary(e){this.match(53)&&this.raise(p.UnexpectedTokenUnaryExponentiation,e.argument)}parseMaybeUnary(e,t){let s=this.state.startLoc,i=this.isContextual(93);if(i&&this.recordAwaitIfAllowed()){this.next();let c=this.parseAwait(s);return t||this.checkExponentialAfterUnary(c),c}let r=this.match(30),a=this.startNode();if(As(this.state.type)){a.operator=this.state.value,a.prefix=!0,this.state.canStartArrow=!1,this.match(68)&&this.expectPlugin("throwExpressions");let c=this.match(85);if(this.next(),a.argument=this.parseMaybeUnary(null,!0),this.checkExpressionErrors(e,!0),this.state.strict&&c){let h=It(a.argument);h.type==="Identifier"?this.raise(p.StrictDelete,a):this.hasPropertyAsPrivateName(h)&&this.raise(p.DeletePrivateField,a)}if(!r)return t||this.checkExponentialAfterUnary(a),this.finishNode(a,"UnaryExpression")}let o=this.parseUpdate(a,r,e);if(i){let{type:c}=this.state;if((this.hasPlugin("v8intrinsic")?ht(c):ht(c)&&!this.match(50))&&!this.isAmbiguousPrefixOrIdentifier())return this.raiseOverwrite(p.AwaitNotInAsyncContext,s),this.parseAwait(s)}return o}parseUpdate(e,t,s){if(t){let a=this.finishNode(e,"UpdateExpression");return this.checkLVal(a.argument,a),a}let i=this.state.startLoc,r=this.parseExprSubscripts(s);if(this.checkExpressionErrors(s,!1))return r;for(;Ss(this.state.type)&&!this.canInsertSemicolon();){let a=this.startNodeAt(i);a.operator=this.state.value,a.prefix=!1,a.argument=r,this.next(),this.checkLVal(r,r=this.finishNode(a,"UpdateExpression"))}return r}parseExprSubscripts(e){let t=this.state.startLoc;if(e!=null&&(this.match(2)||this.match(0))){let i=new G,r=this.parseExprAtom(i),a=this.parseSubscripts(r,t);return a!==r?this.checkExpressionErrors(i,!0):(e.shorthandAssignLoc??=i.shorthandAssignLoc,e.doubleProtoLoc??=i.doubleProtoLoc,e.privateKeyLoc??=i.privateKeyLoc,e.optionalParametersLoc??=i.optionalParametersLoc,e.voidPatternLoc??=i.voidPatternLoc),a}let s=this.parseExprAtom(e);return this.shouldExitDescending(s)?s:this.parseSubscripts(s,t)}parseSubscripts(e,t,s){let i={optionalChainMember:!1,maybeAsyncArrow:this.atPossibleAsyncArrow(e),stop:!1};do e=this.parseSubscript(e,t,s,i),i.maybeAsyncArrow=!1;while(!i.stop);return e}parseSubscript(e,t,s,i){let{type:r}=this.state;if(!s&&r===11)return this.parseBind(e,t,i);if(_t(r))return this.parseTaggedTemplateExpression(e,t,i);let a=!1;if(r===14){if(s&&(this.raise(p.OptionalChainingNoNew,this.state.startLoc),this.lookaheadCharCode()===40))return this.stopParseSubscript(e,i);i.optionalChainMember=a=!0,this.next()}if(!s&&this.match(6))return this.parseCoverCallAndAsyncArrowHead(e,t,i,a);{let o=this.eat(0);return o||a||this.eat(12)?this.parseMember(e,t,i,o,a):this.stopParseSubscript(e,i)}}stopParseSubscript(e,t){return t.stop=!0,e}parseMember(e,t,s,i,r){let a=this.startNodeAt(t);return a.object=e,a.computed=i,i?(a.property=this.parseExpression(),this.expect(1)):this.match(137)?(e.type==="Super"&&this.raise(p.SuperPrivateField,t),this.classScope.usePrivateName(this.state.value,this.state.startLoc),a.property=this.parsePrivateName()):a.property=this.parseIdentifier(!0),s.optionalChainMember?(a.optional=r,this.finishNode(a,"OptionalMemberExpression")):this.finishNode(a,"MemberExpression")}parseBind(e,t,s){let i=this.startNodeAt(t);i.object=e,this.next();let r=this.parseNoCallExpr(a=>{throw this.raise(p.UnsupportedBindRHS,a)});if(r.type==="Super"||r.type==="Import")throw this.raise(p.UnsupportedBindRHS,r);return i.callee=r,s.stop=!0,this.parseSubscripts(this.finishNode(i,"BindExpression"),t,!1)}parseCoverCallAndAsyncArrowHead(e,t,s,i){let r=null;this.next();let a=this.startNodeAt(t);a.callee=e;let{maybeAsyncArrow:o,optionalChainMember:c}=s;o&&(this.expressionScope.enter(Qs()),r=new G),c&&(a.optional=i),i?a.arguments=this.parseCallExpressionArguments():a.arguments=this.parseCallExpressionArguments(e.type!=="Super",a,r);let h=this.finishCallExpression(a,c);return o&&this.shouldParseAsyncArrow()&&!i?(s.stop=!0,this.checkDestructuringPrivate(r),this.expressionScope.validateAsPattern(),this.expressionScope.exit(),h=this.parseAsyncArrowFromCallExpression(this.startNodeAt(t),h)):(o&&(this.checkExpressionErrors(r,!0),this.expressionScope.exit()),this.toReferencedList(a.arguments)),h}parseTaggedTemplateExpression(e,t,s){let i=this.startNodeAt(t);return i.tag=e,i.quasi=this.parseTemplate(!0),s.optionalChainMember&&this.raise(p.OptionalChainingNoTemplate,t),this.finishNode(i,"TaggedTemplateExpression")}atPossibleAsyncArrow(e){return e.type==="Identifier"&&e.name==="async"&&this.state.lastTokEndLoc.index===e.end&&!this.canInsertSemicolon()&&e.end-e.start===5&&this.state.canStartArrow}finishCallExpression(e,t){if(e.callee.type==="Import")if(e.arguments.length===0||e.arguments.length>2)this.raise(p.ImportCallArity,e);else for(let s of e.arguments)s.type==="SpreadElement"&&this.raise(p.ImportCallSpreadArgument,s);return this.finishNode(e,t?"OptionalCallExpression":"CallExpression")}parseCallExpressionArguments(e,t,s){let i=[],r=!0;for(;!this.eat(7);){if(r)r=!1;else if(this.expect(8),this.match(7)){t&&this.addTrailingCommaExtraToNode(t),this.next();break}i.push(this.parseExprListItem(7,!1,s,e))}return i}shouldParseAsyncArrow(){return this.match(15)&&!this.canInsertSemicolon()}parseAsyncArrowFromCallExpression(e,t){return this.resetPreviousNodeTrailingComments(t),this.expect(15),this.parseArrowExpression(e,t.arguments,!0,t.extra?.trailingCommaLoc),t.innerComments&&ft(e,t.innerComments),t.callee.trailingComments&&ft(e,t.callee.trailingComments),e}parseNoCallExpr(e){let t=this.state.startLoc,s=this.match(79);this.state.canStartArrow=!1;let i=this.parseExprAtom();return s&&i.type==="ImportExpression"&&e(i),this.parseSubscripts(i,t,!0)}parseExprAtom(e){let t,s=null,{type:i}=this.state;switch(i){case 75:return this.parseSuper();case 79:return t=this.startNode(),this.next(),this.match(12)?this.parseImportMetaPropertyOrPhaseCallOrSyncCall(t):this.match(6)?this.optionFlags&1024?this.parseImportCall(t):this.finishNode(t,"Import"):(this.raise(p.UnsupportedImport,this.state.lastTokStartLoc),this.finishNode(t,"Import"));case 74:return t=this.startNode(),this.next(),this.finishNode(t,"ThisExpression");case 86:return this.parseDo(this.startNode(),!1);case 52:case 27: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 133:return this.parseStringLiteral(this.state.value);case 80:return this.parseNullLiteral();case 81:return this.parseBooleanLiteral(!0);case 82:return this.parseBooleanLiteral(!1);case 6:return this.parseParenAndDistinguishExpression(this.state.canStartArrow);case 0:return this.parseArrayLike(1,e);case 2:return this.parseObjectLike(4,!1,e);case 64:return this.parseFunctionOrFunctionSent();case 22:s=this.parseDecorators();case 76:return this.parseClass(this.maybeTakeDecorators(s,this.startNode()),!1);case 73:return this.parseNewOrNewTarget();case 21:case 20:return this.parseTemplate(!1);case 11:{t=this.startNode(),this.next(),t.object=null;let r=t.callee=this.parseNoCallExpr(a=>{throw this.raise(p.UnsupportedBind,a)});if(r.type==="MemberExpression")return this.finishNode(t,"BindExpression");throw this.raise(p.UnsupportedBind,r)}case 137:return this.raise(p.PrivateInExpectedIn,this.state.startLoc,{identifierName:this.state.value}),this.parsePrivateName();case 29:return this.parseTopicReferenceThenEqualsSign(50,"%");case 28:return this.parseTopicReferenceThenEqualsSign(40,"^");case 33:case 34:return this.parseTopicReference("hack");case 40:case 50:case 23:{let r=this.getPluginOption("pipelineOperator","proposal");if(r)return this.parseTopicReference(r);throw this.unexpected()}case 43:{let r=this.input.codePointAt(this.nextTokenStart());throw(z(r)||r===62)&&this.expectOnePlugin(["jsx","flow","typescript"]),this.unexpected()}default:if(E(i)){if(this.isContextual(126)&&this.lookaheadInLineCharCode()===123)return this.parseModuleExpression();let{canStartArrow:r,containsEsc:a}=this.state,o=this.parseIdentifier();if(!a&&o.name==="async"&&!this.canInsertSemicolon()){let{type:c}=this.state;if(c===64)return this.resetPreviousNodeTrailingComments(o),this.next(),this.parseAsyncFunctionExpression(this.startNodeAtNode(o));if(E(c))return r&&this.lookaheadCharCode()===61?this.parseAsyncArrowUnaryFunction(this.startNodeAtNode(o)):o;if(c===86)return this.resetPreviousNodeTrailingComments(o),this.parseDo(this.startNodeAtNode(o),!0)}return r&&this.match(15)&&!this.canInsertSemicolon()?(this.next(),this.parseArrowExpression(this.startNodeAtNode(o),[o],!1)):o}else throw this.unexpected()}}parseTopicReferenceThenEqualsSign(e,t){let s=this.getPluginOption("pipelineOperator","proposal");if(s)return this.state.type=e,this.state.value=t,this.state.pos--,this.state.end--,this.state.endLoc=U(this.state.endLoc,-1),this.parseTopicReference(s);throw this.unexpected()}parseTopicReference(e){let t=this.startNode(),s=this.state.startLoc,i=this.state.type;return this.next(),this.finishTopicReference(t,s,e,i)}finishTopicReference(e,t,s,i){if(this.testTopicReferenceConfiguration(s,t,i))return this.topicReferenceIsAllowedInCurrentContext()||this.raise(p.PipeTopicUnbound,t),this.registerTopicReference(),this.finishNode(e,"TopicReference");throw this.raise(p.PipeTopicUnconfiguredToken,t,{token:W(i)})}testTopicReferenceConfiguration(e,t,s){if(e==="hack")return this.hasPlugin(["pipelineOperator",{topicToken:W(s)}]);throw this.raise(p.PipeTopicRequiresHackPipes,t)}parseAsyncArrowUnaryFunction(e){this.prodParam.enter(bt(!0,this.prodParam.hasYield));let t=[this.parseIdentifier()];return this.prodParam.exit(),this.hasPrecedingLineBreak()&&this.raise(p.LineTerminatorBeforeArrow,this.state.curPosition()),this.expect(15),this.parseArrowExpression(e,t,!0)}parseDo(e,t){this.expectPlugin("doExpressions"),t&&this.expectPlugin("asyncDoExpressions"),e.async=t,this.next();let s=this.state.labels;return this.state.labels=[],t?(this.prodParam.enter(2),e.body=this.parseBlock(),this.prodParam.exit()):e.body=this.parseBlock(),this.state.labels=s,this.finishNode(e,"DoExpression")}parseSuper(){let e=this.startNode();return this.next(),this.match(6)&&!this.scope.allowDirectSuper?this.raise(p.SuperNotAllowed,e):this.scope.allowSuper||this.raise(p.UnexpectedSuper,e),!this.match(6)&&!this.match(0)&&!this.match(12)&&this.raise(p.UnsupportedSuper,e),this.finishNode(e,"Super")}parsePrivateName(){let e=this.startNode(),t=this.startNodeAt(U(this.state.startLoc,1)),s=this.state.value;return this.next(),e.id=this.createIdentifier(t,s),this.finishNode(e,"PrivateName")}parseFunctionOrFunctionSent(){let e=this.startNode();if(this.next(),this.prodParam.hasYield&&this.match(12)){let t=this.createIdentifier(this.startNodeAtNode(e),"function");return this.next(),this.match(100)?this.expectPlugin("functionSent"):this.hasPlugin("functionSent")||this.unexpected(),this.parseMetaProperty(e,t,"sent")}return this.parseFunction(e)}parseMetaProperty(e,t,s){e.meta=t;let i=this.state.containsEsc;return e.property=this.parseIdentifier(!0),(e.property.name!==s||i)&&this.raise(p.UnsupportedMetaProperty,e.property,{target:t.name,onlyValidPropertyName:s}),this.finishNode(e,"MetaProperty")}parseImportMetaPropertyOrPhaseCallOrSyncCall(e){if(this.next(),this.isContextual(102)||this.isContextual(94)){let t=this.isContextual(102);return this.expectPlugin(t?"sourcePhaseImports":"deferredImportEvaluation"),this.next(),e.phase=t?"source":"defer",this.parseImportCall(e)}else{if(this.isContextual(105))return this.expectPlugin("importSync"),this.next(),e.sync=!0,this.parseImportCall(e);{let t=this.createIdentifierAt(this.startNodeAtNode(e),"import",this.state.lastTokStartLoc);return this.isContextual(98)&&(this.inModule||this.raise(p.ImportMetaOutsideModule,t),this.sawUnambiguousESM=!0),this.parseMetaProperty(e,t,"meta")}}}parseLiteralAtNode(e,t,s){return this.addExtra(s,"rawValue",e),this.addExtra(s,"raw",this.input.slice(this.offsetToSourcePos(s.start),this.state.end)),s.value=e,this.next(),this.finishNode(s,t)}parseLiteral(e,t){let s=this.startNode();return this.parseLiteralAtNode(e,t,s)}parseStringLiteral(e){return this.parseLiteral(e,"StringLiteral")}parseNumericLiteral(e){return this.parseLiteral(e,"NumericLiteral")}parseBigIntLiteral(e){let t;try{t=BigInt(e)}catch{t=null}return this.parseLiteral(t,"BigIntLiteral")}parseRegExpLiteral(e){let t=this.startNode();return this.addExtra(t,"raw",this.input.slice(this.offsetToSourcePos(t.start),this.state.end)),t.pattern=e.pattern,t.flags=e.flags,this.next(),this.finishNode(t,"RegExpLiteral")}parseBooleanLiteral(e){let t=this.startNode();return t.value=e,this.next(),this.finishNode(t,"BooleanLiteral")}parseNullLiteral(){let e=this.startNode();return this.next(),this.finishNode(e,"NullLiteral")}parseParenAndDistinguishExpression(e){let t=this.state.startLoc,s;this.next(),this.expressionScope.enter(Ys());let i=this.state.startLoc,r=[],a=new G,o=!0,c,h;for(;!this.match(7);){if(o)o=!1;else if(this.expect(8,a.optionalParametersLoc===null?null:a.optionalParametersLoc),this.match(7)){h=this.state.startLoc;break}if(this.match(17)){let f=this.state.startLoc;if(c=this.state.startLoc,r.push(this.parseParenItem(this.parseRestBinding(),f)),!this.checkCommaAfterRest(41))break}else r.push(this.parseMaybeAssignAllowInOrVoidPattern(7,a,!0))}let l=this.state.lastTokEndLoc;this.expect(7);let u=this.startNodeAt(t);return e&&this.shouldParseArrow(r)&&(u=this.parseArrow(u))?(this.checkDestructuringPrivate(a),this.expressionScope.validateAsPattern(),this.expressionScope.exit(),this.parseArrowExpression(u,r,!1),u):(this.expressionScope.exit(),r.length||this.unexpected(this.state.lastTokStartLoc),h&&this.unexpected(h),c&&this.unexpected(c),this.checkExpressionErrors(a,!0),this.toReferencedList(r,!0),r.length>1?(s=this.startNodeAt(i),s.expressions=r,this.finishNode(s,"SequenceExpression"),this.resetEndLocation(s,l)):s=r[0],this.wrapParenthesis(t,s))}wrapParenthesis(e,t){if(!(this.optionFlags&2048))return this.addExtra(t,"parenthesized",!0),this.addExtra(t,"parenStart",e.index),this.takeSurroundingComments(t,e.index,this.state.lastTokEndLoc.index),t;let s=this.startNodeAt(e);return s.expression=t,this.finishNode(s,"ParenthesizedExpression")}shouldParseArrow(e){return!this.canInsertSemicolon()}parseArrow(e){if(this.eat(15))return e}parseParenItem(e,t){return e}parseNewOrNewTarget(){let e=this.startNode();if(this.next(),this.match(12)){let t=this.createIdentifier(this.startNodeAtNode(e),"new");this.next();let s=this.parseMetaProperty(e,t,"target");return this.scope.allowNewTarget||this.raise(p.UnexpectedNewTarget,s),s}return this.parseNew(e)}parseNew(e){if(this.parseNewCallee(e),this.eat(6)){let t=this.parseExprList(7);this.toReferencedList(t),e.arguments=t}else e.arguments=[];return this.finishNode(e,"NewExpression")}parseNewCallee(e){let t=this.parseNoCallExpr(s=>{this.raise(p.ImportCallNotNewExpression,s,s)});e.callee=t,t.type==="Import"&&this.raise(p.ImportCallNotNewExpression,t),t.type==="Super"&&this.raise(p.SuperCallNotNewExpression,t)}parseTemplateElement(e){let{start:t,startLoc:s,end:i,value:r}=this.state,a=t+1,o=this.startNodeAt(U(s,1));r===null&&(e||this.raise(p.InvalidEscapeSequenceTemplate,U(this.state.firstInvalidTemplateEscapePos,1)));let c=this.match(20),h=c?-1:-2,l=i+h;o.value={raw:this.input.slice(a,l).replace(/\r\n?/g,`
|
|
9
|
+
`),cooked:r===null?null:r.slice(1,h)},o.tail=c,this.next();let u=this.finishNode(o,"TemplateElement");return this.resetEndLocation(u,U(this.state.lastTokEndLoc,h)),u}parseTemplate(e){let t=this.startNode(),s=this.parseTemplateElement(e),i=[s],r=[];for(;!s.tail;)r.push(this.parseTemplateSubstitution()),this.readTemplateContinuation(),i.push(s=this.parseTemplateElement(e));return t.expressions=r,t.quasis=i,this.finishNode(t,"TemplateLiteral")}parseTemplateSubstitution(){return this.parseExpression()}parseObjectLike(e,t,s){let i=!1,r=!0,a=this.startNode();for(a.properties=[],this.next();!this.match(e);){if(r)r=!1;else if(this.expect(8),this.match(e)){this.addTrailingCommaExtraToNode(a);break}let c;t?c=this.parseBindingProperty():(c=this.parsePropertyDefinition(s),i=this.checkProto(c,i,s)),a.properties.push(c)}this.next();let o=t?"ObjectPattern":"ObjectExpression";return this.finishNode(a,o)}addTrailingCommaExtraToNode(e){this.addExtra(e,"trailingComma",this.state.lastTokStartLoc.index),this.addExtra(e,"trailingCommaLoc",this.state.lastTokStartLoc,!1)}maybeAsyncOrAccessorProp(e){return!e.computed&&e.key.type==="Identifier"&&(this.isLiteralPropertyName()||this.match(0)||this.match(51))}parsePropertyDefinition(e){let t=[];if(this.match(22))for(this.hasPlugin("decorators")&&this.raise(p.UnsupportedPropertyDecorator,this.state.startLoc);this.match(22);)t.push(this.parseDecorator());let s=this.startNode(),i=!1,r=!1,a;if(this.match(17))return t.length&&this.unexpected(),this.parseSpread();t.length&&(s.decorators=t),s.method=!1,e&&(a=this.state.startLoc);let o=this.eat(51);this.parsePropertyNamePrefixOperator(s);let c=this.state.containsEsc;if(this.parsePropertyName(s,e),!o&&!c&&this.maybeAsyncOrAccessorProp(s)){let{key:h}=s,l=h.name;l==="async"&&!this.hasPrecedingLineBreak()&&(i=!0,this.resetPreviousNodeTrailingComments(h),o=this.eat(51),this.parsePropertyName(s)),(l==="get"||l==="set")&&(r=!0,this.resetPreviousNodeTrailingComments(h),s.kind=l,this.match(51)&&(o=!0,this.raise(p.AccessorIsGenerator,this.state.curPosition(),{kind:l}),this.next()),this.parsePropertyName(s))}return this.parseObjPropValue(s,a,o,i,!1,r,e)}getGetterSetterExpectedParamCount(e){return e.kind==="get"?0:1}getObjectOrClassMethodParams(e){return e.params}checkGetterSetterParams(e){let t=this.getGetterSetterExpectedParamCount(e),s=this.getObjectOrClassMethodParams(e);s.length!==t&&this.raise(e.kind==="get"?p.BadGetterArity:p.BadSetterArity,e),e.kind==="set"&&s[s.length-1]?.type==="RestElement"&&this.raise(p.BadSetterRestParameter,e)}parseObjectMethod(e,t,s,i,r){if(r){let a=this.parseMethod(e,t,!1,!1,!1,"ObjectMethod");return this.checkGetterSetterParams(a),a}if(s||t||this.match(6))return i&&this.unexpected(),e.kind="method",e.method=!0,this.parseMethod(e,t,s,!1,!1,"ObjectMethod")}parseObjectProperty(e,t,s,i){if(e.shorthand=!1,this.eat(10))return e.value=s?this.parseMaybeDefault(this.state.startLoc):this.parseMaybeAssignAllowInOrVoidPattern(4,i),this.finishObjectProperty(e);if(!e.computed&&e.key.type==="Identifier"){if(this.checkReservedWord(e.key.name,e.key.start,!0,!1),s)e.value=this.parseMaybeDefault(t,this.cloneIdentifier(e.key));else if(this.match(25)){let r=this.state.startLoc;i!=null?i.shorthandAssignLoc===null&&(i.shorthandAssignLoc=r):this.raise(p.InvalidCoverInitializedName,r),e.value=this.parseMaybeDefault(t,this.cloneIdentifier(e.key))}else e.value=this.cloneIdentifier(e.key);return e.shorthand=!0,this.finishObjectProperty(e)}}finishObjectProperty(e){return this.finishNode(e,"ObjectProperty")}parseObjPropValue(e,t,s,i,r,a,o){let c=this.parseObjectMethod(e,s,i,r,a)||this.parseObjectProperty(e,t,r,o);return c||this.unexpected(),c}parsePropertyName(e,t){if(this.eat(0))e.computed=!0,e.key=this.parseMaybeAssignAllowIn(),this.expect(1);else{let{type:s,value:i}=this.state,r;if(F(s))r=this.parseIdentifier(!0);else switch(s){case 134:r=this.parseNumericLiteral(i);break;case 133:r=this.parseStringLiteral(i);break;case 135:r=this.parseBigIntLiteral(i);break;case 137:{let a=this.state.startLoc;t!=null?t.privateKeyLoc===null&&(t.privateKeyLoc=a):this.raise(p.UnexpectedPrivateField,a),r=this.parsePrivateName();break}default:throw this.unexpected()}e.key=r,s!==137&&(e.computed=!1)}}initFunction(e,t){e.id=null,e.generator=!1,e.async=t}parseMethod(e,t,s,i,r,a,o=!1){this.initFunction(e,s),e.generator=t,this.scope.enter(530|(o?576:0)|(r?32:0)),this.prodParam.enter(bt(s,e.generator)),this.parseFunctionParams(e,i);let c=this.parseFunctionBodyAndFinish(e,a,!0);return this.prodParam.exit(),this.scope.exit(),c}parseArrayLike(e,t){let s=this.startNode();return this.next(),s.elements=this.parseExprList(e,!0,t,s),this.finishNode(s,"ArrayExpression")}parseArrowExpression(e,t,s,i){this.scope.enter(518);let r=bt(s,!1),a=this.match(2);return a||(r|=this.prodParam.currentFlags()&24),this.prodParam.enter(r),this.initFunction(e,s),t&&this.setArrowFunctionParameters(e,t,i),this.parseFunctionBody(e,!0),a&&(this.state.regExpAllowedAt=this.state.lastTokEndLoc.index),this.prodParam.exit(),this.scope.exit(),this.finishNode(e,"ArrowFunctionExpression")}setArrowFunctionParameters(e,t,s){this.toAssignableList(t,s,!1),e.params=t}parseFunctionBodyAndFinish(e,t,s=!1){return this.parseFunctionBody(e,!1,s),this.finishNode(e,t)}parseFunctionBody(e,t,s=!1){let i=t&&!this.match(2);if(this.expressionScope.enter(se),i)e.body=this.parseMaybeAssign(),this.checkParams(e,!1,t,!1);else{let r=this.state.strict,a=this.state.labels;this.state.labels=[],this.prodParam.enter(this.prodParam.currentFlags()|4),e.body=this.parseBlock(!0,!1,o=>{let c=!this.isSimpleParamList(e.params);o&&c&&this.raise(p.IllegalLanguageModeDirective,(e.kind==="method"||e.kind==="constructor")&&e.key?this.optionFlags&256?e.key.loc.end:e.key:e);let h=!r&&this.state.strict;this.checkParams(e,!this.state.strict&&!t&&!s&&!c,t,h),e.id&&this.checkStrictBindReservedWord(e.id,65,h)}),this.prodParam.exit(),this.state.labels=a}this.expressionScope.exit()}isSimpleParameter(e){return e.type==="Identifier"}isSimpleParamList(e){for(let t=0,s=e.length;t<s;t++)if(!this.isSimpleParameter(e[t]))return!1;return!0}checkParams(e,t,s,i=!0){let r=!t&&new Set,a={type:"FormalParameters"};for(let o of e.params)this.checkLVal(o,a,5,r,i)}parseExprList(e,t,s,i){let r=[],a=!0;for(;!this.eat(e);){if(a)a=!1;else if(this.expect(8),this.match(e)){i&&this.addTrailingCommaExtraToNode(i),this.next();break}r.push(this.parseExprListItem(e,t,s))}return r}parseExprListItem(e,t,s,i){let r;if(this.match(8))t||this.raise(p.UnexpectedToken,this.state.curPosition(),{unexpected:","}),r=null;else if(this.match(17)){let a=this.state.startLoc;r=this.parseParenItem(this.parseSpread(s),a)}else if(this.match(13)){this.expectPlugin("partialApplication"),i||this.raise(p.UnexpectedArgumentPlaceholder,this.state.startLoc);let a=this.startNode();this.next(),r=this.finishNode(a,"ArgumentPlaceholder")}else r=this.parseMaybeAssignAllowInOrVoidPattern(e,s,!0);return r}parseIdentifier(e){let t=this.startNode(),s=this.parseIdentifierName(e);return this.createIdentifier(t,s)}createIdentifier(e,t){return e.name=t,this.optionFlags&256&&(e.loc.identifierName=t),this.finishNode(e,"Identifier")}createIdentifierAt(e,t,s){return e.name=t,this.optionFlags&256&&(e.loc.identifierName=t),this.finishNodeAt(e,"Identifier",s)}parseIdentifierName(e){let t,{start:s,type:i}=this.state;F(i)?t=this.state.value:this.unexpected();let r=ys(i);return e?r&&this.replaceToken(131):this.checkReservedWord(t,this.sourceToOffsetPos(s),r,!1),this.next(),t}checkReservedWord(e,t,s,i){if(e.length>10||!Ds(e))return;if(s&&He(e)){this.raise(p.UnexpectedKeyword,t,{keyword:e});return}if((this.state.strict?i?qe:ze:ge)(e,this.inModule)){this.raise(p.UnexpectedReservedWord,t,{reservedWord:e});return}else if(e==="yield"){if(this.prodParam.hasYield){this.raise(p.YieldBindingIdentifier,t);return}}else if(e==="await"){if(this.prodParam.hasAwait){this.raise(p.AwaitBindingIdentifier,t);return}if(this.scope.inStaticBlock){this.raise(p.AwaitBindingIdentifierInStaticBlock,t);return}this.expressionScope.recordAsyncArrowParametersError(t)}else if(e==="arguments"&&this.scope.inClassAndNotInNonArrowFunction){this.raise(p.ArgumentsInClass,t);return}}recordAwaitIfAllowed(){let e=this.prodParam.hasAwait;return e&&!this.scope.inFunction&&(this.state.hasTopLevelAwait=!0),e}parseAwait(e,t){let s=e.index,i=this.startNodeAt(e);return this.expressionScope.recordParameterInitializerError(p.AwaitExpressionFormalParameter,s),this.eat(51)&&this.raise(p.ObsoleteAwaitStar,e),!this.scope.inFunction&&!(this.optionFlags&1)&&(this.isAmbiguousPrefixOrIdentifier()?this.ambiguousScriptDifferentAst=!0:this.sawUnambiguousESM=!0),t||(this.state.canStartArrow=!1,i.argument=this.parseMaybeUnary(null,!0)),this.finishNode(i,"AwaitExpression")}isAmbiguousPrefixOrIdentifier(){if(this.hasPrecedingLineBreak())return!0;let{type:e}=this.state;return e===49||e===6||e===0||_t(e)||e===99&&!this.state.containsEsc||e===136||e===52||this.hasPlugin("v8intrinsic")&&e===50}parseYield(e){let t=this.startNodeAt(e);this.expressionScope.recordParameterInitializerError(p.YieldInParameter,e.index);let s=!1,i=null;if(!this.hasPrecedingLineBreak())switch(s=this.eat(51),this.state.type){case 9:case 138:case 4:case 7:case 1:case 5:case 10:case 8:if(!s)break;case 54:if(this.options.annexB&&!s)break;default:i=this.parseMaybeAssign()}return i||(this.state.regExpAllowedAt=this.state.lastTokEndLoc.index),t.delegate=s,t.argument=i,this.finishNode(t,"YieldExpression")}parseImportCall(e){this.next();let t=this.parseCallExpressionArguments();if(t.length===0||t.length>2)this.raise(p.ImportCallArity,e,e);else for(let s of t)s.type==="SpreadElement"&&this.raise(p.ImportCallSpreadArgument,s,e);return e.source=t[0],e.options=t[1]??null,this.finishNode(e,"ImportExpression")}withTopicBindingContext(e){let t=this.state.inHackPipelineBody;this.state.inHackPipelineBody=!0;let s=this.state.seenTopicReference;this.state.seenTopicReference=!1;try{return e()}finally{this.state.inHackPipelineBody=t,this.state.seenTopicReference=s}}allowInAnd(e){let t=this.prodParam.currentFlags();if(24&~t){this.prodParam.enter(t|8|16);try{return e()}finally{this.prodParam.exit()}}return e()}disallowInAnd(e){let t=this.prodParam.currentFlags(),s=8&t,i=16&~t;if(s||i){this.prodParam.enter(t&-9|16);try{return e()}finally{this.prodParam.exit()}}return e()}registerTopicReference(){this.state.seenTopicReference=!0}topicReferenceIsAllowedInCurrentContext(){return this.state.inHackPipelineBody}topicReferenceWasUsedInCurrentContext(){return this.state.seenTopicReference}parseFSharpPipelineBody(e){let t=this.state.startLoc;this.prodParam.enter(this.prodParam.currentFlags()&-17);let s;if(this.isContextual(93)&&this.recordAwaitIfAllowed()){this.next(),s=this.parseAwait(t,!0);let i=this.state.type;i!==35&&this.isBinaryOperator(i)&&this.raise(p.PipelineUnparenthesized,t)}else this.state.canStartArrow=!0,s=this.parseExprOp(this.parseMaybeUnaryOrPrivate(),t,e);return this.prodParam.exit(),s}parseModuleExpression(){this.expectPlugin("moduleBlocks");let e=this.startNode();this.next(),this.match(2)||this.unexpected(null,2);let t=this.startNodeAt(this.state.endLoc);this.next();let s=this.initializeScopes(!0);this.enterInitialScopes();try{e.body=this.parseProgram(t,4,"module")}finally{s()}return this.finishNode(e,"ModuleExpression")}parseVoidPattern(e){this.expectPlugin("discardBinding");let t=this.startNode();return e!=null&&(e.voidPatternLoc=this.state.startLoc),this.next(),this.finishNode(t,"VoidPattern")}parseMaybeAssignAllowInOrVoidPattern(e,t,s){if(t!=null&&this.match(84)){let i=this.lookaheadCharCode();if(i===44||i===(e===1?93:e===4?125:41)||i===61)return this.parseMaybeDefault(this.state.startLoc,this.parseVoidPattern(t))}return this.parseMaybeAssignAllowIn(t,s)}parsePropertyNamePrefixOperator(e){}},Mt={kind:1},ei={kind:2},si=/[\uD800-\uDFFF]/u,Bt=/in(?:stanceof)?/y,Rt=/[a-z]{2,10}/y;function Xe(n){for(let e=0;e<n.length;e++){let t=n[e],{type:s}=t;typeof s=="number"&&(t.type=_e(s))}return n}var ce=class extends oe{parseTopLevel(e,t){return e.program=this.parseProgram(t,138,this.options.sourceType==="module"?"module":"script"),e.comments=this.comments,this.optionFlags&512&&(e.tokens=Xe(this.tokens)),this.finishNode(e,"File")}parseProgram(e,t,s){if(e.sourceType=s,e.interpreter=this.parseInterpreterDirective(),this.parseBlockBody(e,!0,!0,t),this.inModule){if(!(this.optionFlags&64)&&this.scope.undefinedExports.size>0)for(let[r,a]of Array.from(this.scope.undefinedExports))this.raise(p.ModuleExportUndefined,a,{localName:r});this.addExtra(e,"topLevelAwait",this.state.hasTopLevelAwait)}let i;return t===138?i=this.finishNode(e,"Program"):i=this.finishNodeAt(e,"Program",U(this.state.startLoc,-1)),i}stmtToDirective(e){let t=this.castNodeTo(e,"Directive"),s=this.castNodeTo(e.expression,"DirectiveLiteral"),i=s.value,r=this.input.slice(this.offsetToSourcePos(s.start),this.offsetToSourcePos(s.end)),a=s.value=r.slice(1,-1);return this.addExtra(s,"raw",r),this.addExtra(s,"rawValue",a),this.addExtra(s,"expressionValue",i),t.value=s,delete e.expression,t}parseInterpreterDirective(){if(!this.match(24))return null;let e=this.startNode();return e.value=this.state.value,this.next(),this.finishNode(e,"InterpreterDirective")}isLet(){return this.isContextual(97)?this.hasFollowingBindingAtom():!1}isUsing(){return this.isContextual(106)?this.nextTokenIsIdentifierOnSameLine():!1}isForUsing(){if(!this.isContextual(106))return!1;let e=this.nextTokenInLineStart(),t=this.codePointAtPos(e);if(this.isUnparsedContextual(e,"of")){let s=this.lookaheadCharCodeSince(e+2);if(s!==61&&s!==58&&s!==59)return!1}return!!(this.chStartsBindingIdentifier(t,e)||this.isUnparsedContextual(e,"void"))}nextTokenIsIdentifierOnSameLine(){let e=this.nextTokenInLineStart(),t=this.codePointAtPos(e);return this.chStartsBindingIdentifier(t,e)}isAwaitUsing(){if(!this.isContextual(93))return!1;let e=this.nextTokenInLineStart();if(this.isUnparsedContextual(e,"using")){e=this.nextTokenInLineStartSince(e+5);let t=this.codePointAtPos(e);if(this.chStartsBindingIdentifier(t,e))return!0}return!1}chStartsBindingIdentifier(e,t){if(z(e)){if(Bt.lastIndex=t,Bt.test(this.input)){let s=this.codePointAtPos(Bt.lastIndex);if(!J(s)&&s!==92)return!1}return!0}else return e===92}isReservedWordOnNewLineAfterLet(e){if(!qt(this.input,this.state.end,e)||(Rt.lastIndex=e,!Rt.test(this.input)))return!1;let t=Rt.lastIndex,s=this.codePointAtPos(t);if(J(s)||s===92)return!1;let i=this.input.slice(e,t);return He(i)||ge(i,!1)}chStartsBindingPattern(e){return e===91||e===123}hasFollowingBindingAtom(){let e=this.nextTokenStart(),t=this.codePointAtPos(e);return this.chStartsBindingPattern(t)||this.chStartsBindingIdentifier(t,e)}hasInLineFollowingBindingIdentifierOrBrace(){let e=this.nextTokenInLineStart(),t=this.codePointAtPos(e);return t===123||this.chStartsBindingIdentifier(t,e)}allowsUsing(){return(this.scope.inModule||!this.scope.inTopLevel)&&!this.scope.inBareCaseStatement}parseModuleItem(){return this.parseStatementLike(15)}parseStatementListItem(){return this.parseStatementLike(6|(!this.options.annexB||this.state.strict?0:8))}parseStatementOrSloppyAnnexBFunctionDeclaration(e=!1){let t=0;return this.options.annexB&&!this.state.strict&&(t|=4,e&&(t|=8)),this.parseStatementLike(t)}parseStatement(){return this.parseStatementLike(0)}parseStatementLike(e){let t=null;return this.match(22)&&(t=this.parseDecorators(!0)),this.parseStatementContent(e,t)}parseStatementContent(e,t){let s=this.state.type,i=this.startNode(),r=!!(e&2),a=!!(e&4),o=e&1;switch(s){case 56:return this.parseBreakContinueStatement(i,!0);case 59:return this.parseBreakContinueStatement(i,!1);case 60:return this.parseDebuggerStatement(i);case 86:return this.parseDoWhileStatement(i);case 87:return this.parseForStatement(i);case 64:if(this.lookaheadCharCode()===46)break;return a||this.raise(this.state.strict?p.StrictFunction:this.options.annexB?p.SloppyFunctionAnnexB:p.SloppyFunction,this.state.startLoc),this.parseFunctionStatement(i,!1,e);case 76:return r||this.unexpected(),this.parseClass(this.maybeTakeDecorators(t,i),!0);case 104:if(!this.state.containsEsc&&this.nextTokenIsIdentifierOnSameLine())return this.expectPlugin("structs"),r||this.unexpected(),this.parseStructDeclaration(i,!1);break;case 65:return this.parseIfStatement(i);case 66:return this.parseReturnStatement(i);case 67:return this.parseSwitchStatement(i);case 68:return this.parseThrowStatement(i);case 69:return this.parseTryStatement(i);case 93:if(this.isAwaitUsing())return this.allowsUsing()?r?this.recordAwaitIfAllowed()||this.raise(p.AwaitUsingNotInAsyncContext,i):this.raise(p.UnexpectedLexicalDeclaration,i):this.raise(p.UnexpectedUsingDeclaration,i),this.next(),this.parseVarStatement(i,"await using");break;case 106:if(this.state.containsEsc||!this.hasInLineFollowingBindingIdentifierOrBrace())break;return this.allowsUsing()?r||this.raise(p.UnexpectedLexicalDeclaration,this.state.startLoc):this.raise(p.UnexpectedUsingDeclaration,this.state.startLoc),this.parseVarStatement(i,"using");case 97:{if(this.state.containsEsc)break;let l=this.nextTokenStart(),u=this.codePointAtPos(l);if(u!==91&&(!r&&this.hasFollowingLineBreak()||!this.chStartsBindingIdentifier(u,l)&&u!==123||this.isReservedWordOnNewLineAfterLet(l)))break}case 71:r||this.raise(p.UnexpectedLexicalDeclaration,this.state.startLoc);case 70:{let l=this.state.value;return this.parseVarStatement(i,l)}case 88:return this.parseWhileStatement(i);case 72:return this.parseWithStatement(i);case 2:return this.parseBlock();case 9:return this.parseEmptyStatement(i);case 79:{let l=this.lookaheadCharCode();if(l===40||l===46)break}case 78:{!(this.optionFlags&8)&&!o&&this.raise(p.UnexpectedImportExport,this.state.startLoc),this.next();let l;return s===79?l=this.parseImport(i):l=this.parseExport(i,t),this.assertModuleNodeAllowed(l),l}default:if(this.isAsyncFunction())return r||this.raise(p.AsyncFunctionInSingleStatementContext,this.state.startLoc),this.next(),this.parseFunctionStatement(i,!0,e)}let c=this.state.value;if(s===89&&this.lookahead().type===10){let l=this.parseIdentifier(!0);return this.next(),this.parseLabeledStatement(i,c,l,e)}let h=this.parseExpression();return E(s)&&h.type==="Identifier"&&this.eat(10)?this.parseLabeledStatement(i,c,h,e):this.parseExpressionStatement(i,h,e)}assertModuleNodeAllowed(e){!(this.optionFlags&8)&&!this.inModule&&this.raise(p.ImportOutsideModule,e)}maybeTakeDecorators(e,t,s){return e&&(t.decorators?.length?(this.raise(p.DecoratorsBeforeAfterExport,t.decorators[0]),t.decorators.unshift(...e)):t.decorators=e,this.resetStartLocationFromNode(t,e[0]),s&&this.resetStartLocationFromNode(s,t)),t}canHaveLeadingDecorator(){return this.match(76)}parseDecorators(e){let t=[];do t.push(this.parseDecorator());while(this.match(22));if(this.match(78))e||this.unexpected();else if(!this.canHaveLeadingDecorator())throw this.raise(p.UnexpectedLeadingDecorator,this.state.startLoc);return t}parseDecorator(){this.expectOnePlugin(["decorators","decorators-legacy"]);let e=this.startNode();if(this.next(),this.hasPlugin("decorators")){let t=this.state.startLoc,s;if(this.match(6)){let i=this.state.startLoc;this.next(),s=this.parseExpression(),this.expect(7),s=this.wrapParenthesis(i,s);let r=this.state.startLoc;e.expression=this.parseMaybeDecoratorArguments(s,i),e.expression!==s&&this.raise(p.DecoratorArgumentsOutsideParentheses,r)}else{for(s=this.parseIdentifier(!1);this.eat(12);){let i=this.startNodeAt(t);i.object=s,this.match(137)?(this.classScope.usePrivateName(this.state.value,this.state.startLoc),i.property=this.parsePrivateName()):i.property=this.parseIdentifier(!0),i.computed=!1,s=this.finishNode(i,"MemberExpression")}e.expression=this.parseMaybeDecoratorArguments(s,t)}}else this.state.canStartArrow=!1,e.expression=this.parseExprSubscripts();return this.finishNode(e,"Decorator")}parseMaybeDecoratorArguments(e,t){if(this.eat(6)){let s=this.startNodeAt(t);return s.callee=e,s.arguments=this.parseCallExpressionArguments(),this.toReferencedList(s.arguments),this.finishNode(s,"CallExpression")}return e}parseBreakContinueStatement(e,t){return this.next(),this.isLineTerminator()?e.label=null:(e.label=this.parseIdentifier(this.match(89)),this.semicolon()),this.verifyBreakContinue(e,t),this.finishNode(e,t?"BreakStatement":"ContinueStatement")}verifyBreakContinue(e,t){let s;for(s=0;s<this.state.labels.length;++s){let i=this.state.labels[s];if((e.label==null||i.name===e.label.name)&&(i.kind!=null&&(t||i.kind===1)||e.label&&t))break}if(s===this.state.labels.length){let i=t?"BreakStatement":"ContinueStatement";this.raise(p.IllegalBreakContinue,e,{type:i})}}parseDebuggerStatement(e){return this.next(),this.semicolon(),this.finishNode(e,"DebuggerStatement")}parseHeaderExpression(){this.expect(6);let e=this.parseExpression();return this.expect(7),e}parseDoWhileStatement(e){return this.next(),this.state.labels.push(Mt),e.body=this.parseStatement(),this.state.labels.pop(),this.expect(88),e.test=this.parseHeaderExpression(),this.eat(9),this.finishNode(e,"DoWhileStatement")}parseForStatement(e){this.next(),this.state.labels.push(Mt);let t=null;if(this.isContextual(93)&&this.recordAwaitIfAllowed()&&(t=this.state.startLoc,this.next()),this.scope.enter(0),this.expect(6),this.match(9))return t!==null&&this.unexpected(t),this.parseFor(e,null);let s=this.isContextual(97);{let c=this.isAwaitUsing(),h=c||this.isForUsing(),l=s&&this.hasFollowingBindingAtom()||h;if(this.match(70)||this.match(71)||l){let u=this.startNode(),f;c?(f="await using",this.recordAwaitIfAllowed()||this.raise(p.AwaitUsingNotInAsyncContext,this.state.startLoc),this.next()):f=this.state.value,this.next(),this.parseVar(u,!0,f);let d=this.finishNode(u,"VariableDeclaration"),y=this.match(54);return y&&h&&this.raise(p.ForInUsing,d),(y||this.isContextual(99))&&d.declarations.length===1?this.parseForX(e,d,t):(t!==null&&this.unexpected(t),this.parseFor(e,d))}}let i=this.isContextual(92),r=new G,a=this.parseExpression(!0,r),o=this.isContextual(99);if(o&&(s&&this.raise(p.ForOfLet,a),t===null&&i&&a.type==="Identifier"&&this.raise(p.ForOfAsync,a)),o||this.match(54)){this.checkDestructuringPrivate(r),this.toAssignable(a,!0);let c=o?"ForOfStatement":"ForInStatement";return this.checkLVal(a,{type:c}),this.parseForX(e,a,t)}else this.checkExpressionErrors(r,!0);return t!==null&&this.unexpected(t),this.parseFor(e,a)}parseFunctionStatement(e,t,s){this.next();let i=1|(t?8:0);return!(s&2)&&s&4&&(i|=16,s&8||(i|=2)),this.parseFunction(e,i)}parseIfStatement(e){return this.next(),e.test=this.parseHeaderExpression(),e.consequent=this.parseStatementOrSloppyAnnexBFunctionDeclaration(),e.alternate=this.eat(62)?this.parseStatementOrSloppyAnnexBFunctionDeclaration():null,this.finishNode(e,"IfStatement")}parseReturnStatement(e){return this.prodParam.hasReturn||this.raise(p.IllegalReturn,this.state.startLoc),this.next(),this.isLineTerminator()?e.argument=null:(e.argument=this.parseExpression(),this.semicolon()),this.finishNode(e,"ReturnStatement")}parseSwitchStatement(e){this.next(),e.discriminant=this.parseHeaderExpression();let t=e.cases=[];this.expect(2),this.state.labels.push(ei),this.scope.enter(256);let s;for(let i;!this.match(4);)if(this.match(57)||this.match(61)){let r=this.match(57);s&&this.finishNode(s,"SwitchCase"),t.push(s=this.startNode()),s.consequent=[],this.next(),r?s.test=this.parseExpression():(i&&this.raise(p.MultipleDefaultsInSwitch,this.state.lastTokStartLoc),i=!0,s.test=null),this.expect(10)}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(e,"SwitchStatement")}parseThrowStatement(e){return this.next(),this.hasPrecedingLineBreak()&&this.raise(p.NewlineAfterThrow,this.state.lastTokEndLoc),e.argument=this.parseExpression(),this.semicolon(),this.finishNode(e,"ThrowStatement")}parseCatchClauseParam(){let e=this.parseBindingAtom();return this.scope.enter(this.options.annexB&&e.type==="Identifier"?8:0),this.checkLVal(e,{type:"CatchClause"},9),e}parseTryStatement(e){if(this.next(),e.block=this.parseBlock(),e.handler=null,this.match(58)){let t=this.startNode();this.next(),this.match(6)?(this.expect(6),t.param=this.parseCatchClauseParam(),this.expect(7)):(t.param=null,this.scope.enter(0)),t.body=this.parseBlock(!1,!1),this.scope.exit(),e.handler=this.finishNode(t,"CatchClause")}return e.finalizer=this.eat(63)?this.parseBlock():null,!e.handler&&!e.finalizer&&this.raise(p.NoCatchOrFinally,e),this.finishNode(e,"TryStatement")}parseVarStatement(e,t,s=!1){return this.next(),this.parseVar(e,!1,t,s),this.semicolon(),this.finishNode(e,"VariableDeclaration")}parseWhileStatement(e){return this.next(),e.test=this.parseHeaderExpression(),this.state.labels.push(Mt),e.body=this.parseStatement(),this.state.labels.pop(),this.finishNode(e,"WhileStatement")}parseWithStatement(e){return this.state.strict&&this.raise(p.StrictWith,this.state.startLoc),this.next(),e.object=this.parseHeaderExpression(),e.body=this.parseStatement(),this.finishNode(e,"WithStatement")}parseEmptyStatement(e){return this.next(),this.finishNode(e,"EmptyStatement")}parseLabeledStatement(e,t,s,i){for(let a of this.state.labels)a.name===t&&this.raise(p.LabelRedeclaration,s,{labelName:t});let r=Ps(this.state.type)?1:this.match(67)?2:null;for(let a=this.state.labels.length-1;a>=0;a--){let o=this.state.labels[a];if(o.statementStart===e.start)o.statementStart=this.sourceToOffsetPos(this.state.start),o.kind=r;else break}return this.state.labels.push({name:t,kind:r,statementStart:this.sourceToOffsetPos(this.state.start)}),e.body=i&8?this.parseStatementOrSloppyAnnexBFunctionDeclaration(!0):this.parseStatement(),this.state.labels.pop(),e.label=s,this.finishNode(e,"LabeledStatement")}parseExpressionStatement(e,t,s){return e.expression=t,this.semicolon(),this.finishNode(e,"ExpressionStatement")}parseBlock(e=!1,t=!0,s){let i=this.startNode();return e&&this.state.strictErrors.clear(),this.expect(2),t&&this.scope.enter(0),this.parseBlockBody(i,e,!1,4,s),t&&this.scope.exit(),this.finishNode(i,"BlockStatement")}isValidDirective(e){return e.type==="ExpressionStatement"&&e.expression.type==="StringLiteral"&&!e.expression.extra.parenthesized}parseBlockBody(e,t,s,i,r){let a=e.body=[],o=e.directives=[];this.parseBlockOrModuleBlockBody(a,t?o:void 0,s,i,r)}parseBlockOrModuleBlockBody(e,t,s,i,r){let a=this.state.strict,o=!1,c=!1;for(;!this.match(i);){let h=s?this.parseModuleItem():this.parseStatementListItem();if(t&&!c){if(this.isValidDirective(h)){let l=this.stmtToDirective(h);t.push(l),!o&&l.value.value==="use strict"&&(o=!0,this.setStrict(!0));continue}c=!0,this.state.strictErrors.clear()}e.push(h)}r?.call(this,o),a||this.setStrict(!1),this.next()}parseFor(e,t){return e.init=t,this.semicolon(!1),e.test=this.match(9)?null:this.parseExpression(),this.semicolon(!1),e.update=this.match(7)?null:this.parseExpression(),this.expect(7),e.body=this.parseStatement(),this.scope.exit(),this.state.labels.pop(),this.finishNode(e,"ForStatement")}parseForX(e,t,s){let i=this.match(54);return this.next(),i?s!==null&&this.unexpected(s):e.await=s!==null,t.type==="VariableDeclaration"&&t.declarations[0].init!=null&&(!i||!this.options.annexB||this.state.strict||t.kind!=="var"||t.declarations[0].id.type!=="Identifier")&&this.raise(p.ForInOfLoopInitializer,t,{type:i?"ForInStatement":"ForOfStatement"}),t.type==="AssignmentPattern"&&this.raise(p.InvalidLhs,t,{ancestor:{type:"ForStatement"}}),e.left=t,e.right=i?this.parseExpression():this.parseMaybeAssignAllowIn(),this.expect(7),e.body=this.parseStatement(),this.scope.exit(),this.state.labels.pop(),this.finishNode(e,i?"ForInStatement":"ForOfStatement")}parseVar(e,t,s,i=!1){let r=e.declarations=[];for(e.kind=s;;){let a=this.startNode();if(this.parseVarId(a,s),a.init=this.eat(25)?t?this.parseMaybeAssignDisallowIn():this.parseMaybeAssignAllowIn():null,a.init===null&&!i&&!(t&&r.length===0&&(this.match(54)||this.isContextual(99)))&&(a.id.type!=="Identifier"?this.raise(p.DeclarationMissingInitializer,this.state.lastTokEndLoc,{kind:"destructuring"}):(s==="const"||s==="using"||s==="await using")&&this.raise(p.DeclarationMissingInitializer,this.state.lastTokEndLoc,{kind:s})),r.push(this.finishNode(a,"VariableDeclarator")),!this.eat(8))break}return e}parseVarId(e,t){let s=this.parseBindingAtom();t==="using"||t==="await using"?(s.type==="ArrayPattern"||s.type==="ObjectPattern")&&this.raise(p.UsingDeclarationHasBindingPattern,s):s.type==="VoidPattern"&&this.raise(p.UnexpectedVoidPattern,s),this.checkLVal(s,{type:"VariableDeclarator"},t==="var"?5:8201),e.id=s}parseAsyncFunctionExpression(e){return this.parseFunction(e,8)}parseFunction(e,t=0){let s=!!(t&1),i=s&&!(t&4),r=!!(t&8);return this.initFunction(e,r),this.match(51)&&(t&16&&this.raise(p.GeneratorInSingleStatementContext,this.state.startLoc),this.next(),e.generator=!0),s&&(e.id=this.parseFunctionId(i)),this.scope.enter(514),this.prodParam.enter(bt(r,e.generator)),!s&&E(this.state.type)&&(this.expressionScope.enter(se),e.id=this.parseFunctionId(),this.expressionScope.exit()),this.parseFunctionParams(e,!1),this.parseFunctionBodyAndFinish(e,s?"FunctionDeclaration":"FunctionExpression"),this.prodParam.exit(),this.scope.exit(),s&&!(t&2)&&this.registerFunctionStatementId(e),e}parseFunctionId(e){return e||E(this.state.type)?this.parseIdentifier():null}parseFunctionParams(e,t){this.expect(6),this.expressionScope.enter(Zs),e.params=this.parseBindingList(7,41,2|(t?4:0)),this.expressionScope.exit()}registerFunctionStatementId(e){e.id&&this.scope.declareName(e.id.name,!this.options.annexB||this.state.strict||e.generator||e.async?this.scope.treatFunctionsAsVar?5:8201:17,e.id.start)}parseClass(e,t,s){this.next();let i=this.state.strict;return this.state.strict=!0,this.parseClassId(e,t,s),this.parseClassSuper(e),e.body=this.parseClassBody(!!e.superClass,i),this.finishNode(e,t?"ClassDeclaration":"ClassExpression")}isClassProperty(){return this.match(25)||this.match(9)||this.match(4)}isClassMethod(){return this.match(6)}nameIsConstructor(e){return e.type==="Identifier"&&e.name==="constructor"||e.type==="StringLiteral"&&e.value==="constructor"}isNonstaticConstructor(e){return!e.computed&&!e.static&&this.nameIsConstructor(e.key)}parseClassBody(e,t){this.classScope.enter();let s={hadConstructor:!1,hadSuperClass:e},i=[],r=this.startNode();for(r.body=[],this.expect(2);!this.match(4);){if(this.eat(9)){if(i.length>0)throw this.raise(p.DecoratorSemicolon,this.state.lastTokEndLoc);continue}if(this.match(22)){i.push(this.parseDecorator());continue}let a=this.startNode();i.length&&(a.decorators=i,this.resetStartLocationFromNode(a,i[0]),i=[]),this.parseClassMember(r,a,s)}if(this.state.strict=t,this.next(),i.length)throw this.raise(p.TrailingDecorator,this.state.startLoc);return this.classScope.exit(),this.finishNode(r,"ClassBody")}parseClassMemberFromModifier(e,t){let s=this.parseIdentifier(!0);if(this.isClassMethod()){let i=t;return i.kind="method",i.computed=!1,i.key=s,i.static=!1,this.pushClassMethod(e,i,!1,!1,!1,!1),!0}else if(this.isClassProperty()){let i=t;return i.computed=!1,i.key=s,i.static=!1,e.body.push(this.parseClassProperty(i)),!0}return this.resetPreviousNodeTrailingComments(s),!1}parseClassMember(e,t,s){let i=this.isContextual(103);if(i){if(this.parseClassMemberFromModifier(e,t))return;if(this.eat(2)){this.parseClassStaticBlock(e,t);return}}this.parseClassMemberWithIsStatic(e,t,s,i)}parseClassMemberWithIsStatic(e,t,s,i){let r=t,a=t,o=t,c=t,h=t,l=r,u=r;if(t.static=i,this.parsePropertyNamePrefixOperator(t),this.eat(51)){l.kind="method";let S=this.match(137);if(this.parseClassElementName(l),this.parsePostMemberNameModifiers(l),S){this.pushClassPrivateMethod(e,a,!0,!1);return}this.isNonstaticConstructor(r)&&this.raise(p.ConstructorIsGenerator,r.key),this.pushClassMethod(e,r,!0,!1,!1,!1);return}let f=!this.state.containsEsc&&E(this.state.type),d=this.parseClassElementName(t),y=f?d.name:null,P=this.isPrivateName(d),C=this.state.startLoc;if(this.parsePostMemberNameModifiers(u),this.isClassMethod()){if(l.kind="method",P){this.pushClassPrivateMethod(e,a,!1,!1);return}let S=this.isNonstaticConstructor(r),w=!1;S&&(r.kind="constructor",r.decorators&&r.decorators.length>0&&this.raise(p.DecoratorConstructor,t),s.hadConstructor&&!this.hasPlugin("typescript")&&this.raise(p.DuplicateConstructor,d),S&&this.hasPlugin("typescript")&&t.override&&this.raise(p.OverrideOnConstructor,d),s.hadConstructor=!0,w=s.hadSuperClass),this.pushClassMethod(e,r,!1,!1,S,w)}else if(this.isClassProperty())P?this.pushClassPrivateProperty(e,c):this.pushClassProperty(e,o);else if(y==="async"&&!this.isLineTerminator()){this.resetPreviousNodeTrailingComments(d);let S=this.eat(51);u.optional&&this.unexpected(C),l.kind="method";let w=this.match(137);this.parseClassElementName(l),this.parsePostMemberNameModifiers(u),w?this.pushClassPrivateMethod(e,a,S,!0):(this.isNonstaticConstructor(r)&&this.raise(p.ConstructorIsAsync,r.key),this.pushClassMethod(e,r,S,!0,!1,!1))}else if((y==="get"||y==="set")&&!(this.match(51)&&this.isLineTerminator())){this.resetPreviousNodeTrailingComments(d),l.kind=y;let S=this.match(137);this.parseClassElementName(r),S?this.pushClassPrivateMethod(e,a,!1,!1):(this.isNonstaticConstructor(r)&&this.raise(p.ConstructorIsAccessor,r.key),this.pushClassMethod(e,r,!1,!1,!1,!1)),this.checkGetterSetterParams(r)}else if(y==="accessor"&&!this.isLineTerminator()){this.expectPlugin("decoratorAutoAccessors"),this.resetPreviousNodeTrailingComments(d);let S=this.match(137);this.parseClassElementName(o),this.pushClassAccessorProperty(e,h,S)}else this.isLineTerminator()?P?this.pushClassPrivateProperty(e,c):this.pushClassProperty(e,o):this.unexpected()}parseClassElementName(e){let{type:t,value:s}=this.state;if((t===131||t===133)&&e.static&&s==="prototype"&&this.raise(p.StaticPrototype,this.state.startLoc),t===137){s==="constructor"&&this.raise(p.ConstructorClassPrivateField,this.state.startLoc);let i=this.parsePrivateName();return e.key=i,i}return this.parsePropertyName(e),e.key}parseClassStaticBlock(e,t){this.scope.enter(720);let s=this.state.labels;this.state.labels=[],this.prodParam.enter(0);let i=t.body=[];this.parseBlockOrModuleBlockBody(i,void 0,!1,4),this.prodParam.exit(),this.scope.exit(),this.state.labels=s,e.body.push(this.finishNode(t,"StaticBlock")),t.decorators?.length&&this.raise(p.DecoratorStaticBlock,t)}pushClassProperty(e,t){!t.computed&&this.nameIsConstructor(t.key)&&this.raise(p.ConstructorClassField,t.key),e.body.push(this.parseClassProperty(t))}pushClassPrivateProperty(e,t){let s=this.parseClassPrivateProperty(t);e.body.push(s),this.classScope.declarePrivateName(this.getPrivateNameSV(s.key),0,s.key.start)}pushClassAccessorProperty(e,t,s){!s&&!t.computed&&this.nameIsConstructor(t.key)&&this.raise(p.ConstructorClassField,t.key);let i=this.parseClassAccessorProperty(t);e.body.push(i),s&&this.classScope.declarePrivateName(this.getPrivateNameSV(i.key),0,i.key.start)}pushClassMethod(e,t,s,i,r,a){e.body.push(this.parseMethod(t,s,i,r,a,"ClassMethod",!0))}pushClassPrivateMethod(e,t,s,i){let r=this.parseMethod(t,s,i,!1,!1,"ClassPrivateMethod",!0);e.body.push(r);let a=r.kind==="get"?r.static?6:2:r.kind==="set"?r.static?5:1:0;this.declareClassPrivateMethodInScope(r,a)}declareClassPrivateMethodInScope(e,t){this.classScope.declarePrivateName(this.getPrivateNameSV(e.key),t,e.key.start)}parsePostMemberNameModifiers(e){}parseClassPrivateProperty(e){return this.parseInitializer(e),this.semicolon(),this.finishNode(e,"ClassPrivateProperty")}parseClassProperty(e){return this.parseInitializer(e),this.semicolon(),this.finishNode(e,"ClassProperty")}parseClassAccessorProperty(e){return this.parseInitializer(e),this.semicolon(),this.finishNode(e,"ClassAccessorProperty")}parseInitializer(e){this.scope.enter(592),this.expressionScope.enter(se),this.prodParam.enter(0),e.value=this.eat(25)?this.parseMaybeAssignAllowIn():null,this.expressionScope.exit(),this.prodParam.exit(),this.scope.exit()}parseClassId(e,t,s,i=8331){if(E(this.state.type))e.id=this.parseIdentifier(),this.checkStrictBindReservedWord(e.id,i),t&&this.declareNameFromIdentifier(e.id,i);else if(s||!t)e.id=null;else throw this.raise(p.MissingClassName,this.state.startLoc)}parseClassSuper(e){this.eat(77)?(this.state.canStartArrow=!1,e.superClass=this.parseExprSubscripts()):e.superClass=null}parseStructDeclaration(e,t){this.next();let s=this.state.strict;return this.state.strict=!0,this.parseClassId(e,!0,t),this.parseClassSuper(e),e.body=this.parseStructBody(!!e.superClass,s),this.finishNode(e,"StructDeclaration")}parseStructBody(e,t){this.classScope.enter();let s={hadConstructor:!1,hadSuperClass:e},i=this.startNode();for(i.body=[],this.expect(2);!this.match(4);){if(this.eat(9))continue;let r=this.startNode();this.parseClassMember(i,r,s)}return this.state.strict=t,this.next(),this.classScope.exit(),this.finishNode(i,"StructBody")}parseExport(e,t){let s=this.parseMaybeImportPhase(e,!0),i=this.maybeParseExportDefaultSpecifier(e,s),r=!i||this.eat(8),a=r&&this.eatExportStar(e),o=a&&this.maybeParseExportNamespaceSpecifier(e),c=r&&!o;if(a&&!o){if(i&&this.unexpected(),t)throw this.raise(p.UnsupportedDecoratorExport,e);return e.phase==="defer"&&this.raise(p.DeferExportInvalidAll,e),this.parseExportFrom(e,!0),this.sawUnambiguousESM=!0,this.finishNode(e,"ExportAllDeclaration")}let h=c&&this.maybeParseExportNamedSpecifiers(e),l=i||a||e.phase==="defer"||h&&e.specifiers[0]?.type==="ExportNamespaceSpecifier";i&&r&&!a&&!h&&this.unexpected(null,2);let u;if(l||h){if(u=!1,t)throw this.raise(p.UnsupportedDecoratorExport,e);this.parseExportFrom(e,l)}else u=this.maybeParseExportDeclaration(e);if(l||h||u){let f=e;if(this.checkNamedExport(f,!!f.source),f.declaration?.type==="ClassDeclaration")this.maybeTakeDecorators(t,f.declaration,f);else if(t)throw this.raise(p.UnsupportedDecoratorExport,e);return this.hasPlugin("deferredReexports")&&(f.phase??=null),this.sawUnambiguousESM=!0,this.finishNode(f,"ExportNamedDeclaration")}if(this.eat(61)){let f=e,d=this.parseExportDefaultExpression();if(f.declaration=d,d.type==="ClassDeclaration")this.maybeTakeDecorators(t,d,f);else if(t)throw this.raise(p.UnsupportedDecoratorExport,e);return this.checkDuplicateExports(e,"default"),this.hasPlugin("exportDefaultFrom")&&d.type==="Identifier"&&d.name==="from"&&d.end-d.start===4&&!d.extra?.parenthesized&&this.raise(p.ExportDefaultFromAsIdentifier,d),this.sawUnambiguousESM=!0,this.finishNode(f,"ExportDefaultDeclaration")}throw this.unexpected(null,2)}eatExportStar(e){return this.eat(51)}maybeParseExportDefaultSpecifier(e,t){if(t||this.isExportDefaultSpecifier()){this.expectPlugin("exportDefaultFrom",t?.start);let s=t||this.parseIdentifier(!0),i=this.startNodeAtNode(s);return i.exported=s,e.specifiers=[this.finishNode(i,"ExportDefaultSpecifier")],!0}return!1}maybeParseExportNamespaceSpecifier(e){if(this.isContextual(90)){e.specifiers??=[];let t=this.startNodeAt(this.state.lastTokStartLoc);return this.next(),t.exported=this.parseModuleExportName(),e.specifiers.push(this.finishNode(t,"ExportNamespaceSpecifier")),!0}return!1}maybeParseExportNamedSpecifiers(e){if(this.match(2)){let t=e;t.specifiers||(t.specifiers=[]);let s=t.exportKind==="type",i=this.state.startLoc;this.setLoc(i);let r=this.parseExportSpecifiers(s);if(this.isContextual(90)&&!this.hasPrecedingLineBreak()){this.expectPlugin("namespaceImportFilter");let a=this.startNodeAt(i);a.exportsFilter=this.toNamespaceExportsFilter(r),this.next(),a.exported=this.parseModuleExportName(),t.specifiers.push(this.finishNode(a,"ExportNamespaceSpecifier"))}else t.specifiers.push(...r);return t.source=null,t.attributes=[],t.declaration=null,!0}return!1}maybeParseExportDeclaration(e){return this.shouldParseExportDeclaration()?(e.specifiers=[],e.source=null,e.attributes=[],e.declaration=this.parseExportDeclaration(e),!0):!1}isAsyncFunction(){if(!this.isContextual(92))return!1;let e=this.nextTokenInLineStart();return this.isUnparsedContextual(e,"function")}parseExportDefaultExpression(){let e=this.startNode();if(this.match(64))return this.next(),this.parseFunction(e,5);if(this.isAsyncFunction())return this.next(),this.next(),this.parseFunction(e,13);if(this.match(76))return this.parseClass(e,!0,!0);if(this.isContextual(104)){let s=this.nextTokenInLineStart(),i=this.codePointAtPos(s);if(i===123||this.chStartsBindingIdentifier(i,s))return this.expectPlugin("structs"),this.parseStructDeclaration(e,!0)}if(this.match(22))return this.parseClass(this.maybeTakeDecorators(this.parseDecorators(!1),this.startNode()),!0,!0);if(this.match(71)||this.match(70)||this.isLet()&&!this.isReservedWordOnNewLineAfterLet(this.nextTokenStart())||this.isUsing()||this.isAwaitUsing())throw this.raise(p.UnsupportedDefaultExport,this.state.startLoc);let t=this.parseMaybeAssignAllowIn();return this.semicolon(),t}parseExportDeclaration(e){return this.match(76)?this.parseClass(this.startNode(),!0,!1):this.isContextual(104)&&this.nextTokenIsIdentifierOnSameLine()?(this.expectPlugin("structs"),this.parseStructDeclaration(this.startNode(),!1)):this.isContextual(97)?this.parseVarStatement(this.startNode(),"let"):this.parseStatementListItem()}isExportDefaultSpecifier(){let{type:e}=this.state;if(E(e)){if(e===92&&!this.state.containsEsc||e===97)return!1;if((e===129||e===128||e===104)&&!this.state.containsEsc){let i=this.nextTokenStart(),r=this.input.charCodeAt(i);if(r===123||this.chStartsBindingIdentifier(r,i)&&!this.isUnparsedContextual(i,"from"))return e!==104&&this.expectOnePlugin(["flow","typescript"]),!1}}else if(!this.match(61))return!1;let t=this.nextTokenStart(),s=this.isUnparsedContextual(t,"from");if(this.input.charCodeAt(t)===44||E(this.state.type)&&s)return!0;if(this.match(61)&&s){let i=this.input.charCodeAt(this.hasPlugin("exportDefaultFrom")?this.nextTokenStartSince(t+4):this.nextTokenInLineStartSince(t+4));return i===34||i===39}return!1}parseExportFrom(e,t){this.eatContextual(95)?(e.source=this.parseImportSource(),this.maybeParseImportAttributes(e)):t&&this.unexpected(null,95),this.semicolon()}shouldParseExportDeclaration(){let{type:e}=this.state;return e===22&&(this.expectOnePlugin(["decorators","decorators-legacy"]),this.hasPlugin("decorators"))?!0:this.isUsing()?(this.raise(p.UsingDeclarationExport,this.state.startLoc),!0):this.isAwaitUsing()?(this.raise(p.UsingDeclarationExport,this.state.startLoc),!0):e===70||e===71||e===64||e===76||this.isLet()||this.isAsyncFunction()||this.isContextual(104)&&this.nextTokenIsIdentifierOnSameLine()}checkNamedExport(e,t){if(e.specifiers?.length)for(let s of e.specifiers){let{exported:i}=s,r=i.type==="Identifier"?i.name:i.value;if(this.checkDuplicateExports(s,r),!t&&s.type==="ExportSpecifier"){let{local:a}=s;a.type!=="Identifier"?this.raise(p.ExportBindingIsString,s,{localName:a.value,exportName:r}):(this.checkReservedWord(a.name,a.start,!0,!1),this.scope.checkLocalExport(a))}}else if(e.declaration){let s=e.declaration;if(s.type==="FunctionDeclaration"||s.type==="ClassDeclaration"||s.type==="StructDeclaration"){let{id:i}=s;if(!i)throw new Error("Assertion failure");this.checkDuplicateExports(e,i.name)}else if(s.type==="VariableDeclaration")for(let i of s.declarations)this.checkDeclaration(i.id)}}checkDeclaration(e){if(e.type==="Identifier")this.checkDuplicateExports(e,e.name);else if(e.type==="ObjectPattern")for(let t of e.properties)this.checkDeclaration(t);else if(e.type==="ArrayPattern")for(let t of e.elements)t&&this.checkDeclaration(t);else e.type==="ObjectProperty"?this.checkDeclaration(e.value):e.type==="RestElement"?this.checkDeclaration(e.argument):e.type==="AssignmentPattern"&&this.checkDeclaration(e.left)}checkDuplicateExports(e,t){this.exportedIdentifiers.has(t)&&(t==="default"?this.raise(p.DuplicateDefaultExport,e):this.raise(p.DuplicateExport,e,{exportName:t})),this.exportedIdentifiers.add(t)}parseExportSpecifiers(e){let t=[],s=!0;for(this.expect(2);!this.eat(4);){if(s)s=!1;else if(this.expect(8),this.eat(4))break;let i=this.isContextual(129),r=this.match(133),a=this.startNode();a.local=this.parseModuleExportName(),t.push(this.parseExportSpecifier(a,r,e,i))}return t}parseExportSpecifier(e,t,s,i){return this.eatContextual(90)?e.exported=this.parseModuleExportName():t?e.exported=this.cloneStringLiteral(e.local):e.exported||(e.exported=this.cloneIdentifier(e.local)),this.finishNode(e,"ExportSpecifier")}parseModuleExportName(){if(this.match(133)){let e=this.parseStringLiteral(this.state.value),t=si.exec(e.value);return t&&this.raise(p.ModuleExportNameHasLoneSurrogate,e,{surrogateCharCode:t[0].charCodeAt(0)}),e}return this.parseIdentifier(!0)}toNamespaceExportsFilter(e){let t=new Set;return e.map(s=>{let i,r,a;s.type==="ImportSpecifier"?{imported:i,local:r,importKind:a}=s:{local:i,exported:r,exportKind:a}=s;let o=i.type==="Identifier"?i.name:this.isStringModuleExportName(i)?i.value:null;o!==null&&(t.has(o)&&this.raise(p.FilteredNamespaceDuplicateName,i,{name:o}),t.add(o));let c=!1;return r.start!==i.start&&(this.raise(p.FilteredNamespaceRename,r),c=!0),(a==="type"||a==="typeof")&&(this.raise(p.FilteredNamespaceTypeModifier,s),c=!0),c?s:(this.replaceNodeInPendingComments(s,i),i)})}checkImportPhase(e){if(e.phase==null)return;let{specifiers:t}=e,s=t.length===1?t[0].type:null;e.phase==="source"?s!=="ImportDefaultSpecifier"&&this.raise(p.SourcePhaseImportRequiresDefault,e):e.phase==="defer"&&s!=="ImportNamespaceSpecifier"&&this.raise(p.DeferImportRequiresNamespace,e)}isPotentialImportPhase(e){if(e){if(!this.isContextual(94))return!1;let t=this.lookaheadCharCode();return t===123||t===42}return this.isContextual(102)||this.isContextual(94)}applyImportPhase(e,t,s,i){if(t){s==="defer"&&(this.expectPlugin("deferredReexports",i),e.phase="defer");return}s==="source"?(this.expectPlugin("sourcePhaseImports",i),e.phase="source"):s==="defer"?(this.expectPlugin("deferredImportEvaluation",i),e.phase="defer"):(this.hasPlugin("sourcePhaseImports")||this.hasPlugin("deferredImportEvaluation"))&&(e.phase=null)}parseMaybeImportPhase(e,t){if(!this.isPotentialImportPhase(t))return this.applyImportPhase(e,t,null),null;let s=this.startNode(),i=this.parseIdentifierName(!0),{type:r}=this.state;return(F(r)?r!==95||this.lookaheadCharCode()===102:r!==8)?(this.applyImportPhase(e,t,i,s.start),null):(this.applyImportPhase(e,t,null),this.createIdentifier(s,i))}isPrecedingIdImportPhase(e){let{type:t}=this.state;return E(t)?t!==95||this.lookaheadCharCode()===102:t!==8}parseImport(e){return this.match(133)?this.parseImportSourceAndAttributes(e):this.parseImportSpecifiersAndAfter(e,this.parseMaybeImportPhase(e,!1))}parseImportSpecifiersAndAfter(e,t){e.specifiers=[];let i=!this.maybeParseDefaultImportSpecifier(e,t)||this.eat(8),r=i&&this.maybeParseStarImportSpecifier(e);return i&&!r&&this.parseNamedOrFilteredImportSpecifiers(e),this.expectContextual(95),this.parseImportSourceAndAttributes(e)}parseImportSourceAndAttributes(e){return e.specifiers??=[],e.source=this.parseImportSource(),this.maybeParseImportAttributes(e),this.checkImportPhase(e),this.semicolon(),this.sawUnambiguousESM=!0,this.finishNode(e,"ImportDeclaration")}parseImportSource(){return this.match(133)||this.unexpected(),this.parseExprAtom()}parseImportSpecifierLocal(e,t,s){t.local=this.parseIdentifier(),e.specifiers.push(this.finishImportSpecifier(t,s))}finishImportSpecifier(e,t){return this.checkLVal(e.local,{type:t},8201),this.finishNode(e,t)}parseImportAttributes(){this.expect(2);let e=[],t=new Set;do{if(this.match(4))break;let s=this.startNode(),i=this.state.value;if(t.has(i)&&this.raise(p.ModuleAttributesWithDuplicateKeys,this.state.startLoc,{key:i}),t.add(i),this.match(133)?s.key=this.parseStringLiteral(i):s.key=this.parseIdentifier(!0),this.expect(10),!this.match(133))throw this.raise(p.ModuleAttributeInvalidValue,this.state.startLoc);s.value=this.parseStringLiteral(this.state.value),e.push(this.finishNode(s,"ImportAttribute"))}while(this.eat(8));return this.expect(4),e}maybeParseImportAttributes(e){let t;if(this.match(72)){if(this.hasPrecedingLineBreak()&&this.lookaheadCharCode()===40)return;this.next(),t=this.parseImportAttributes()}else t=[];e.attributes=t}maybeParseDefaultImportSpecifier(e,t){if(t){let s=this.startNodeAtNode(t);return s.local=t,e.specifiers.push(this.finishImportSpecifier(s,"ImportDefaultSpecifier")),!0}else if(F(this.state.type))return this.parseImportSpecifierLocal(e,this.startNode(),"ImportDefaultSpecifier"),!0;return!1}maybeParseStarImportSpecifier(e){if(this.match(51)){let t=this.startNode();return this.next(),this.expectContextual(90),this.parseImportSpecifierLocal(e,t,"ImportNamespaceSpecifier"),!0}return!1}parseNamedOrFilteredImportSpecifiers(e){let t=this.state.startLoc;this.setLoc(t);let s=e.specifiers.length;if(this.parseNamedImportSpecifiers(e),this.isContextual(90)){this.expectPlugin("namespaceImportFilter");let r=this.startNodeAt(t);r.exportsFilter=this.toNamespaceExportsFilter(e.specifiers.splice(s)),this.next(),this.parseImportSpecifierLocal(e,r,"ImportNamespaceSpecifier");return}let i=e.importKind==="type"||e.importKind==="typeof";for(let r=s;r<e.specifiers.length;r++)this.checkImportSpecifier(e.specifiers[r],i)}parseNamedImportSpecifiers(e){let t=!0;for(this.expect(2);!this.eat(4);){if(t)t=!1;else{if(this.eat(10))throw this.raise(p.DestructureNamedImport,this.state.startLoc);if(this.expect(8),this.eat(4))break}let s=this.startNode(),i=this.match(133),r=this.isContextual(129);s.imported=this.parseModuleExportName();let a=this.parseImportSpecifier(s,i,e.importKind==="type"||e.importKind==="typeof",r);e.specifiers.push(a)}}parseImportSpecifier(e,t,s,i){return this.eatContextual(90)?e.local=this.parseIdentifier():e.local??=this.cloneIdentifier(e.imported),this.finishNode(e,"ImportSpecifier")}checkImportSpecifier(e,t,s=8201,i=!0){let{imported:r,local:a}=e;if(this.isStringModuleExportName(a))throw this.raise(p.ImportBindingIsString,e,{importName:r.value});i&&a.start===r.start&&this.checkReservedWord(a.name,a.start,!0,!0),this.checkLVal(a,{type:"ImportSpecifier"},s)}isStringModuleExportName(e){return e.type==="StringLiteral"||e.type==="Literal"}isThisParam(e){return e.type==="Identifier"&&e.name==="this"}},Ut=/in(?:stanceof)?|as|satisfies/y;function ii(n){if(n==null)throw new Error(`Unexpected ${n} value.`);return n}function Oe(n){if(!n)throw new Error("Assert fail")}var ri={AbstractMethodHasImplementation:({methodName:n})=>`Method '${n}' cannot have an implementation because it is marked abstract.`,AbstractPropertyHasInitializer:({propertyName:n})=>`Property '${n}' cannot have an initializer because it is marked abstract.`,AccessorCannotBeOptional:"An 'accessor' property cannot be declared optional.",AccessorCannotDeclareThisParameter:"'get' and 'set' accessors cannot declare 'this' parameters.",AccessorCannotHaveTypeParameters:"An accessor cannot have type parameters.",ClassMethodHasDeclare:"Class methods cannot have the 'declare' modifier.",ClassMethodHasReadonly:"Class methods cannot have the 'readonly' modifier.",ConstInitializerMustBeStringOrNumericLiteralOrLiteralEnumReference:"A 'const' initializer in an ambient context must be a string or numeric literal or literal enum reference.",ConstructorHasTypeParameters:"Type parameters cannot appear on a constructor declaration.",DeclaratorDefiniteAssertionRequiresTypeAnnotation:"Declarations with definite assignment assertions must also have type annotations.",DeclaratorDefiniteAssertionWithInitializer:"Declarations with initializers cannot also have definite assignment assertions.",DeclareAccessor:({kind:n})=>`'declare' is not allowed in ${n}ters.`,DeclareClassFieldHasInitializer:"Initializers are not allowed in ambient contexts.",DeclareFunctionHasImplementation:"An implementation cannot be declared in ambient contexts.",DecoratorAbstractMethod:({kind:n})=>`Decorators can't be used with ${n.startsWith("a")?"an":"a"} ${n}.`,DuplicateAccessibilityModifier:({modifier:n})=>`Accessibility modifier already seen: '${n}'.`,DuplicateModifier:({modifier:n})=>`Duplicate modifier: '${n}'.`,EmptyHeritageClauseType:({token:n})=>`'${n}' list cannot be empty.`,EmptyNamespaceName:"Namespace must be given a name.",EmptyTypeArguments:"Type argument list cannot be empty.",EmptyTypeParameters:"Type parameter list cannot be empty.",ExpectedAmbientAfterExportDeclare:"'export declare' must be followed by an ambient declaration.",ExportAssignmentInTSNamespace:"An export assignment cannot be used in a namespace.",ExportInTSNamespace:"Export declarations are not permitted in a namespace.",ImportAliasHasImportType:"An import alias can not use 'import type'.",ImportInTSNamespace:"Import declarations in a namespace cannot reference a module.",IncompatibleModifiers:({modifiers:n})=>`'${n[0]}' modifier cannot be used with '${n[1]}' modifier.`,IndexSignatureHasAbstract:"Index signatures cannot have the 'abstract' modifier.",IndexSignatureHasAccessibility:({modifier:n})=>`Index signatures cannot have an accessibility modifier ('${n}').`,IndexSignatureHasDeclare:"Index signatures cannot have the 'declare' modifier.",IndexSignatureHasOverride:"'override' modifier cannot appear on an index signature.",IndexSignatureHasStatic:"Index signatures cannot have the 'static' modifier.",InitializerNotAllowedInAmbientContext:"Initializers are not allowed in ambient contexts.",InlineModuleDeclarationMustUseString:"`module ... {}` declarations must have a string name. Use `namespace ... {}` instead.",InvalidHeritageClauseType:({token:n})=>`'${n}' list can only include identifiers or qualified-names with optional type arguments.`,InvalidModifierOnAwaitUsingDeclaration:n=>`'${n}' modifier cannot appear on an await using declaration.`,InvalidModifierOnTypeMember:({modifier:n})=>`'${n}' modifier cannot appear on a type member.`,InvalidModifierOnTypeParameter:({modifier:n})=>`'${n}' modifier cannot appear on a type parameter.`,InvalidModifierOnTypeParameterPositions:({modifier:n})=>`'${n}' modifier can only appear on a type parameter of a class, interface or type alias.`,InvalidModifierOnUsingDeclaration:n=>`'${n}' modifier cannot appear on a using declaration.`,InvalidModifiersOrder:({orderedModifiers:n})=>`'${n[0]}' modifier must precede '${n[1]}' modifier.`,InvalidNamespaceName:n=>`Namespace name cannot be '${n}'.`,InvalidPropertyAccessAfterInstantiationExpression:"Invalid property access after an instantiation expression. You can either wrap the instantiation expression in parentheses, or delete the type arguments.",InvalidTupleMemberLabel:"Tuple members must be labeled with a simple identifier.",MissingInterfaceName:"'interface' declarations must be followed by an identifier.",NamespaceExportInTSNamespace:"Global module exports may only appear at top level.",NonAbstractClassHasAbstractMethod:"Abstract methods can only appear within an abstract class.",NonClassMethodPropertyHasAbstractModifier:"'abstract' modifier can only appear on a class, method, or property declaration.",OptionalTypeBeforeRequired:"A required element cannot follow an optional element.",OverrideNotInSubClass:"This member cannot have an 'override' modifier because its containing class does not extend another class.",PatternIsOptional:"A binding pattern parameter cannot be optional in an implementation signature.",PrivateElementHasAbstract:"Private elements cannot have the 'abstract' modifier.",PrivateElementHasAccessibility:({modifier:n})=>`Private elements cannot have an accessibility modifier ('${n}').`,ReadonlyForMethodSignature:"'readonly' modifier can only appear on a property declaration or index signature.",ReservedArrowTypeParam:"This syntax is reserved in files with the .mts or .cts extension. Add a trailing comma, as in `<T,>() => ...`.",ReservedTypeAssertion:"This syntax is reserved in files with the .mts or .cts extension. Use an `as` expression instead.",SetAccessorCannotHaveOptionalParameter:"A 'set' accessor cannot have an optional parameter.",SetAccessorCannotHaveRestParameter:"A 'set' accessor cannot have rest parameter.",SetAccessorCannotHaveReturnType:"A 'set' accessor cannot have a return type annotation.",SingleTypeParameterWithoutTrailingComma:({typeParameterName:n})=>`Single type parameter ${n} should have a trailing comma. Example usage: <${n},>.`,StaticBlockCannotHaveModifier:"Static class blocks cannot have any modifier.",TupleOptionalAfterType:"A labeled tuple optional element must be declared using a question mark after the name and before the colon (`name?: type`), rather than after the type (`name: type?`).",TypeAnnotationAfterAssign:"Type annotations must come before default assignments, e.g. instead of `age = 25: number` use `age: number = 25`.",TypeImportCannotSpecifyDefaultAndNamed:"A type-only import can specify a default import or named bindings, but not both.",TypeModifierIsUsedInTypeExports:"The 'type' modifier cannot be used on a named export when 'export type' is used on its export statement.",TypeModifierIsUsedInTypeImports:"The 'type' modifier cannot be used on a named import when 'import type' is used on its import statement.",UnexpectedParameterInitializer:"A parameter initializer is only allowed in a function or constructor implementation.",UnexpectedParameterModifier:"A parameter property is only allowed in a constructor implementation.",UnexpectedReadonly:"'readonly' type modifier is only permitted on array and tuple literal types.",UnexpectedTypeAnnotation:"Did not expect a type annotation here.",UnexpectedTypeCastInParameter:"Unexpected type cast in parameter position.",UnexpectedTypeDeclaration:n=>`'${n}' declarations can only be declared inside a block.`,UnsupportedImportTypeArgument:"Argument in a type import must be a string literal.",UnsupportedParameterPropertyKind:"A parameter property may not be declared using a binding pattern.",UnsupportedSignatureParameterKind:({type:n})=>`Name in a signature must be an Identifier, ObjectPattern or ArrayPattern, instead got ${n}.`,UsingDeclarationInAmbientContext:n=>`'${n}' declarations are not allowed in ambient contexts.`},m=$`typescript`(ri);function ai(n){switch(n){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 Fe(n){return n==="private"||n==="public"||n==="protected"}function ni(n){return n==="in"||n==="out"}function he(n){if(n.extra?.parenthesized)return!1;switch(n.type){case"Identifier":return!0;case"MemberExpression":return!n.computed&&he(n.object);case"TSInstantiationExpression":return he(n.expression);default:return!1}}function jt(n){switch(n.type){case"TSAsExpression":case"TSSatisfiesExpression":case"TSNonNullExpression":case"TSTypeAssertion":return!0;default:return!1}}var oi=Q(["declare","private","public","protected","override","abstract","readonly","static"],["in","out"]),ci=Q(["readonly"],["declare","abstract","private","protected","public","static","override"]),hi=Q(["public","private","protected","override","readonly"]),li=Q(["private","public","protected"]),pi=n=>class extends n{getScopeHandler(){return Kt}tsIsIdentifier(){return E(this.state.type)}tsTokenCanFollowModifier(){return this.match(0)||this.match(2)||this.match(51)||this.match(17)||this.match(137)||this.isLiteralPropertyName()}tsNextTokenOnSameLineAndCanFollowModifier(){return this.next(),this.hasPrecedingLineBreak()?!1:this.tsTokenCanFollowModifier()}tsNextTokenCanFollowModifier(){return this.match(103)?(this.next(),this.tsTokenCanFollowModifier()):this.tsNextTokenOnSameLineAndCanFollowModifier()}tsParseModifier(t,s,i){if(!E(this.state.type)&&this.state.type!==54&&this.state.type!==71)return;let r=this.state.value;if(t.has(r)){if(i&&this.match(103)||s&&this.tsIsStartOfStaticBlocks())return;let a=this.state.containsEsc&&!E(this.state.type)?this.state.startLoc:null;if(a&&(this.state.containsEsc=!1),this.tsTryParse(this.tsNextTokenCanFollowModifier.bind(this)))return a&&this.raise(p.InvalidEscapedReservedWord,a,{reservedWord:r}),r;a&&(this.state.containsEsc=!0)}}tsParseModifiers(t,s=m.InvalidModifierOnTypeMember,i,r=!1){let a=(c,h,l,u)=>{h===l&&i[u]&&this.raise(m.InvalidModifiersOrder,c,{orderedModifiers:[l,u]})},o=(c,h,l,u)=>{(i[l]&&h===u||i[u]&&h===l)&&this.raise(m.IncompatibleModifiers,c,{modifiers:[l,u]})};for(;;){let{startLoc:c}=this.state,h=this.tsParseModifier(t,r,i.static);if(!h)break;Fe(h)?i.accessibility?this.raise(m.DuplicateAccessibilityModifier,c,{modifier:h}):(a(c,h,h,"override"),a(c,h,h,"static"),a(c,h,h,"readonly"),i.accessibility=h):ni(h)?(i[h]&&this.raise(m.DuplicateModifier,c,{modifier:h}),i[h]=!0,a(c,h,"in","out")):(Object.hasOwn(i,h)?this.raise(m.DuplicateModifier,c,{modifier:h}):(a(c,h,"static","readonly"),a(c,h,"static","override"),a(c,h,"override","readonly"),a(c,h,"abstract","override"),o(c,h,"declare","override"),o(c,h,"static","abstract")),i[h]=!0),t.get(h)||this.raise(s,c,{modifier:h})}}tsIsListTerminator(t){switch(t){case"EnumMembers":case"TypeMembers":return this.match(4);case"HeritageClauseElement":return this.match(2);case"TupleElementTypes":return this.match(1);case"TypeParametersOrArguments":return this.match(44)}}tsParseList(t,s){let i=[];for(;!this.tsIsListTerminator(t);)i.push(s());return i}tsParseDelimitedList(t,s,i){return ii(this.tsParseDelimitedListWorker(t,s,!0,i))}tsParseDelimitedListWorker(t,s,i,r){let a=[],o=-1;for(;!this.tsIsListTerminator(t);){o=-1;let c=s();if(c==null)return;if(a.push(c),this.eat(8)){o=this.state.lastTokStartLoc.index;continue}if(this.tsIsListTerminator(t))break;i&&this.expect(8);return}return r&&(r.value=o),a}tsParseBracketedList(t,s,i,r,a){r||(i?this.expect(0):this.expect(43));let o=this.tsParseDelimitedList(t,s,a);return i?this.expect(1):this.expect(44),o}tsParseImportType(){let t=this.startNode();return this.expect(79),this.expect(6),this.match(133)?t.source=this.parseStringLiteral(this.state.value):(this.raise(m.UnsupportedImportTypeArgument,this.state.startLoc),t.source=this.tsParseNonConditionalType()),this.eat(8)?t.options=this.tsParseImportTypeOptions():t.options=null,this.expect(7),this.eat(12)&&(t.qualifier=this.tsParseEntityName(3)),this.match(43)&&(t.typeArguments=this.tsParseTypeArguments()),this.finishNode(t,"TSImportType")}tsParseImportTypeOptions(){let t=this.startNode();this.expect(2);let s=this.startNode();return this.isContextual(72)?(s.method=!1,s.key=this.parseIdentifier(!0),s.computed=!1,s.shorthand=!1):this.unexpected(null,72),this.expect(10),s.value=this.tsParseImportTypeWithPropertyValue(),t.properties=[this.finishObjectProperty(s)],this.eat(8),this.expect(4),this.finishNode(t,"ObjectExpression")}tsParseImportTypeWithPropertyValue(){let t=this.startNode(),s=[];for(this.expect(2);!this.match(4);){let i=this.state.type;E(i)||i===133?s.push(super.parsePropertyDefinition(null)):this.unexpected(),this.eat(8)}return t.properties=s,this.next(),this.finishNode(t,"ObjectExpression")}tsParseEntityName(t){let s;if(t&1&&this.match(74))if(t&2)s=this.parseIdentifier(!0);else{let i=this.startNode();this.next(),s=this.finishNode(i,"ThisExpression")}else s=this.parseIdentifier(!!(t&1));for(;this.eat(12);){let i=this.startNodeAtNode(s);i.left=s,i.right=this.parseIdentifier(!!(t&1)),s=this.finishNode(i,"TSQualifiedName")}return s}tsParseTypeReference(){let t=this.startNode();return t.typeName=this.tsParseEntityName(1),!this.hasPrecedingLineBreak()&&this.match(43)&&(t.typeArguments=this.tsParseTypeArguments()),this.finishNode(t,"TSTypeReference")}tsParseThisTypePredicate(t){this.next();let s=this.startNodeAtNode(t);return s.parameterName=t,s.typeAnnotation=this.tsParseTypeAnnotation(!1),s.asserts=!1,this.finishNode(s,"TSTypePredicate")}tsParseThisTypeNode(){let t=this.startNode();return this.next(),this.finishNode(t,"TSThisType")}tsParseTypeQuery(){let t=this.startNode();return this.expect(83),this.match(79)?t.exprName=this.tsParseImportType():t.exprName=this.tsParseEntityName(1),!this.hasPrecedingLineBreak()&&this.match(43)&&(t.typeArguments=this.tsParseTypeArguments()),this.finishNode(t,"TSTypeQuery")}tsParseInOutModifiers=this.tsParseModifiers.bind(this,Q(["in","out"],["const","public","private","protected","readonly","declare","abstract","override"]),m.InvalidModifierOnTypeParameter);tsParseConstModifier=this.tsParseModifiers.bind(this,Q(["const"],["in","out"]),m.InvalidModifierOnTypeParameterPositions);tsParseInOutConstModifiers=this.tsParseModifiers.bind(this,Q(["in","out","const"],["public","private","protected","readonly","declare","abstract","override"]),m.InvalidModifierOnTypeParameter);tsParseTypeParameter(t){let s=this.startNode();return t(s),s.name=this.tsParseTypeParameterName(),s.constraint=this.tsEatThenParseType(77),s.default=this.tsEatThenParseType(25),this.finishNode(s,"TSTypeParameter")}tsTryParseTypeParameters(t){if(this.match(43))return this.tsParseTypeParameters(t)}tsParseTypeParameters(t){let s=this.startNode();this.match(43)||this.match(141)?this.next():this.unexpected();let i={value:-1};return s.params=this.tsParseBracketedList("TypeParametersOrArguments",this.tsParseTypeParameter.bind(this,t),!1,!0,i),s.params.length===0&&this.raise(m.EmptyTypeParameters,s),i.value!==-1&&this.addExtra(s,"trailingComma",i.value),this.finishNode(s,"TSTypeParameterDeclaration")}tsFillSignature(t,s){let i=t===15,r="params",a="returnType";s.typeParameters=this.tsTryParseTypeParameters(this.tsParseConstModifier),this.expect(6),s[r]=this.tsParseBindingListForSignature(),i?s[a]=this.tsParseTypeOrTypePredicateAnnotation(t):this.match(t)&&(s[a]=this.tsParseTypeOrTypePredicateAnnotation(t))}tsParseBindingListForSignature(){let t=super.parseBindingList(7,41,2);for(let s of t){let{type:i}=s;(i==="AssignmentPattern"||i==="TSParameterProperty")&&this.raise(m.UnsupportedSignatureParameterKind,s,{type:i})}return t}tsParseTypeMemberSemicolon(){!this.eat(8)&&!this.isLineTerminator()&&this.expect(9)}tsParseSignatureMember(t,s){return this.tsFillSignature(10,s),this.tsParseTypeMemberSemicolon(),this.finishNode(s,t)}tsIsUnambiguouslyIndexSignature(){return this.next(),E(this.state.type)?(this.next(),this.match(10)):!1}tsTryParseIndexSignature(t){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(1),t.parameters=[s];let i=this.tsTryParseTypeAnnotation();return i&&(t.typeAnnotation=i),this.tsParseTypeMemberSemicolon(),this.finishNode(t,"TSIndexSignature")}tsParsePropertyOrMethodSignature(t,s){if(this.eat(13)&&(t.optional=!0),this.match(6)||this.match(43)){s&&this.raise(m.ReadonlyForMethodSignature,t);let i=t;if(i.kind&&this.match(43)&&this.raise(m.AccessorCannotHaveTypeParameters,this.state.curPosition()),this.tsFillSignature(10,i),this.tsParseTypeMemberSemicolon(),i.kind==="get")i.params.length>0&&(this.raise(p.BadGetterArity,this.state.curPosition()),this.isThisParam(i.params[0])&&this.raise(m.AccessorCannotDeclareThisParameter,this.state.curPosition()));else if(i.kind==="set"){if(i.params.length!==1)this.raise(p.BadSetterArity,this.state.curPosition());else{let r=i.params[0];this.isThisParam(r)&&this.raise(m.AccessorCannotDeclareThisParameter,this.state.curPosition()),r.type==="Identifier"&&r.optional&&this.raise(m.SetAccessorCannotHaveOptionalParameter,this.state.curPosition()),r.type==="RestElement"&&this.raise(m.SetAccessorCannotHaveRestParameter,this.state.curPosition())}i.returnType&&this.raise(m.SetAccessorCannotHaveReturnType,i.returnType)}else i.kind="method";return this.finishNode(i,"TSMethodSignature")}else{let i=t;s&&(i.readonly=!0);let r=this.tsTryParseTypeAnnotation();return r&&(i.typeAnnotation=r),this.tsParseTypeMemberSemicolon(),this.finishNode(i,"TSPropertySignature")}}tsParseTypeMember(){let t=this.startNode();if(this.match(6)||this.match(43))return this.tsParseSignatureMember("TSCallSignatureDeclaration",t);if(this.match(73)){let i=this.startNode();return this.next(),this.match(6)||this.match(43)?this.tsParseSignatureMember("TSConstructSignatureDeclaration",t):(t.key=this.createIdentifier(i,"new"),this.tsParsePropertyOrMethodSignature(t,!1))}this.tsParseModifiers(ci,void 0,t);let s=this.tsTryParseIndexSignature(t);return s||(super.parsePropertyName(t),!t.computed&&t.key.type==="Identifier"&&(t.key.name==="get"||t.key.name==="set")&&this.tsTokenCanFollowModifier()&&(t.kind=t.key.name,super.parsePropertyName(t),!this.match(6)&&!this.match(43)&&this.unexpected(null,6)),this.tsParsePropertyOrMethodSignature(t,!!t.readonly))}tsParseTypeLiteral(){let t=this.startNode();return t.members=this.tsParseObjectTypeMembers(),this.finishNode(t,"TSTypeLiteral")}tsParseObjectTypeMembers(){this.expect(2);let t=this.tsParseList("TypeMembers",this.tsParseTypeMember.bind(this));return this.expect(4),t}tsIsStartOfMappedType(){return this.next(),this.eat(49)?this.isContextual(121):(this.isContextual(121)&&this.next(),!this.match(0)||(this.next(),!this.tsIsIdentifier())?!1:(this.next(),this.match(54)))}tsParseMappedType(){let t=this.startNode();return this.expect(2),this.match(49)?(t.readonly=this.state.value,this.next(),this.expectContextual(121)):this.eatContextual(121)&&(t.readonly=!0),this.expect(0),t.key=this.tsParseTypeParameterName(),t.constraint=this.tsExpectThenParseType(54),t.nameType=this.eatContextual(90)?this.tsParseType():null,this.expect(1),this.match(49)?(t.optional=this.state.value,this.next(),this.expect(13)):this.eat(13)&&(t.optional=!0),t.typeAnnotation=this.tsTryParseType(),this.semicolon(),this.expect(4),this.finishNode(t,"TSMappedType")}tsParseTupleType(){let t=this.startNode();t.elementTypes=this.tsParseBracketedList("TupleElementTypes",this.tsParseTupleElementType.bind(this),!0,!1);let s=!1;return t.elementTypes.forEach(i=>{let{type:r}=i;s&&r!=="TSRestType"&&r!=="TSOptionalType"&&!(r==="TSNamedTupleMember"&&i.optional)&&this.raise(m.OptionalTypeBeforeRequired,i),s||=r==="TSNamedTupleMember"&&i.optional||r==="TSOptionalType"}),this.finishNode(t,"TSTupleType")}tsParseTupleElementType(){let t=this.state.startLoc,s=this.eat(17),{startLoc:i}=this.state,r,a,o,c,l=F(this.state.type)?this.lookaheadCharCode():null;if(l===58)r=!0,o=!1,a=this.parseIdentifier(!0),this.expect(10),c=this.tsParseType();else if(l===63){o=!0;let u=this.state.value,f=this.tsParseNonArrayType();this.lookaheadCharCode()===58?(r=!0,a=this.createIdentifier(this.startNodeAt(i),u),this.expect(13),this.expect(10),c=this.tsParseType()):(r=!1,c=f,this.expect(13))}else c=this.tsParseType(),o=this.eat(13),r=this.eat(10);if(r){let u;a?(u=this.startNodeAt(i),u.optional=o,u.label=a,u.elementType=c,this.eat(13)&&(u.optional=!0,this.raise(m.TupleOptionalAfterType,this.state.lastTokStartLoc))):(u=this.startNodeAt(i),u.optional=o,this.raise(m.InvalidTupleMemberLabel,c),u.label=c,u.elementType=this.tsParseType()),c=this.finishNode(u,"TSNamedTupleMember")}else if(o){let u=this.startNodeAt(i);u.typeAnnotation=c,c=this.finishNode(u,"TSOptionalType")}if(s){let u=this.startNodeAt(t);u.typeAnnotation=c,c=this.finishNode(u,"TSRestType")}return c}tsParseParenthesizedType(){let t=this.startNode();return this.expect(6),t.typeAnnotation=this.tsParseType(),this.expect(7),this.finishNode(t,"TSParenthesizedType")}tsParseFunctionOrConstructorType(t,s){let i=this.startNode();return t==="TSConstructorType"&&(i.abstract=!!s,s&&this.next(),this.next()),this.tsInAllowConditionalTypesContext(()=>this.tsFillSignature(15,i)),this.finishNode(i,t)}tsParseLiteralTypeNode(){let t=this.startNode();switch(this.state.type){case 134:case 135:case 133:case 81:case 82:t.literal=super.parseExprAtom();break;default:this.unexpected()}return this.finishNode(t,"TSLiteralType")}tsParseTemplateLiteralType(){let t=this.state.startLoc,s=this.parseTemplateElement(!1),i=[s];if(s.tail){let r=this.startNodeAt(t),a=this.startNodeAt(t);return a.expressions=[],a.quasis=i,r.literal=this.finishNode(a,"TemplateLiteral"),this.finishNode(r,"TSLiteralType")}else{let r=[];for(;!s.tail;)r.push(this.tsParseType()),this.readTemplateContinuation(),i.push(s=this.parseTemplateElement(!1));let a=this.startNodeAt(t);return a.types=r,a.quasis=i,this.finishNode(a,"TSTemplateLiteralType")}}parseTemplateSubstitution(){return this.state.inType?this.tsParseType():super.parseTemplateSubstitution()}tsParseThisTypeOrThisTypePredicate(){let t=this.tsParseThisTypeNode();return this.isContextual(115)&&!this.hasPrecedingLineBreak()?this.tsParseThisTypePredicate(t):t}tsParseNonArrayType(){switch(this.state.type){case 133:case 134:case 135:case 81:case 82:return this.tsParseLiteralTypeNode();case 49:if(this.state.value==="-"){let t=this.startNode(),s=this.lookahead();return s.type!==134&&s.type!==135&&this.unexpected(),t.literal=this.parseMaybeUnary(),this.finishNode(t,"TSLiteralType")}break;case 74:return this.tsParseThisTypeOrThisTypePredicate();case 83:return this.tsParseTypeQuery();case 79:return this.tsParseImportType();case 2:return this.tsLookAhead(this.tsIsStartOfMappedType.bind(this))?this.tsParseMappedType():this.tsParseTypeLiteral();case 0:return this.tsParseTupleType();case 6:if(!(this.optionFlags&2048)){let t=this.state.startLoc;this.next();let s=this.tsParseType();return this.expect(7),this.addExtra(s,"parenthesized",!0),this.addExtra(s,"parenStart",t.index),s}return this.tsParseParenthesizedType();case 21:case 20:return this.tsParseTemplateLiteralType();default:{let{type:t}=this.state;if(E(t)||t===84||t===80){let s=t===84?"TSVoidKeyword":t===80?"TSNullKeyword":ai(this.state.value);if(s!==void 0&&this.lookaheadCharCode()!==46){let i=this.startNode();return this.next(),this.finishNode(i,s)}return this.tsParseTypeReference()}}}throw this.unexpected()}tsParseArrayTypeOrHigher(){let{startLoc:t}=this.state,s=this.tsParseNonArrayType();for(;!this.hasPrecedingLineBreak()&&this.eat(0);)if(this.match(1)){let i=this.startNodeAt(t);i.elementType=s,this.expect(1),s=this.finishNode(i,"TSArrayType")}else{let i=this.startNodeAt(t);i.objectType=s,i.indexType=this.tsParseType(),this.expect(1),s=this.finishNode(i,"TSIndexedAccessType")}return s}tsParseTypeOperator(){let t=this.startNode(),s=this.state.value;return this.next(),t.operator=s,t.typeAnnotation=this.tsParseTypeOperatorOrHigher(),s==="readonly"&&this.tsCheckTypeAnnotationForReadOnly(t),this.finishNode(t,"TSTypeOperator")}tsCheckTypeAnnotationForReadOnly(t){switch(t.typeAnnotation.type){case"TSTupleType":case"TSArrayType":return;default:this.raise(m.UnexpectedReadonly,t)}}tsParseInferType(){let t=this.startNode();this.expectContextual(114);let s=this.startNode();return s.name=this.tsParseTypeParameterName(),s.constraint=this.tsTryParse(()=>this.tsParseConstraintForInferType()),t.typeParameter=this.finishNode(s,"TSTypeParameter"),this.finishNode(t,"TSInferType")}tsParseConstraintForInferType(){if(this.eat(77)){let t=this.tsInDisallowConditionalTypesContext(()=>this.tsParseType());if(this.state.inDisallowConditionalTypesContext||!this.match(13))return t}}tsParseTypeOperatorOrHigher(){return bs(this.state.type)&&!this.state.containsEsc?this.tsParseTypeOperator():this.isContextual(114)?this.tsParseInferType():this.tsInAllowConditionalTypesContext(()=>this.tsParseArrayTypeOrHigher())}tsParseUnionOrIntersectionType(t,s,i){let r=this.startNode(),a=this.eat(i),o=[];do o.push(s());while(this.eat(i));return o.length===1&&!a?o[0]:(r.types=o,this.finishNode(r,t))}tsParseIntersectionTypeOrHigher(){return this.tsParseUnionOrIntersectionType("TSIntersectionType",this.tsParseTypeOperatorOrHigher.bind(this),41)}tsParseUnionTypeOrHigher(){return this.tsParseUnionOrIntersectionType("TSUnionType",this.tsParseIntersectionTypeOrHigher.bind(this),39)}tsIsStartOfFunctionType(){return this.match(43)?!0:this.match(6)&&this.tsLookAhead(this.tsIsUnambiguouslyStartOfFunctionType.bind(this))}tsSkipParameterStart(){if(E(this.state.type)||this.match(74))return this.next(),!0;let t=this.match(2);if(t||this.match(0)){t||this.next();let{errors:s}=this.state,i=s.length,r=this.snapshotScopeStacks();try{return t?this.parseObjectLike(4,!0):super.parseBindingList(1,93,1),s.length===i}catch{return this.restoreScopeStacks(r),!1}}return!1}tsIsUnambiguouslyStartOfFunctionType(){return this.next(),!!(this.match(7)||this.match(17)||this.tsSkipParameterStart()&&(this.match(10)||this.match(8)||this.match(13)||this.match(25)||this.match(7)&&(this.next(),this.match(15))))}tsParseTypeOrTypePredicateAnnotation(t){return this.tsInType(()=>{let s=this.startNode();this.expect(t);let i=this.startNode(),r=!!this.tsTryParse(this.tsParseTypePredicateAsserts.bind(this));if(r&&this.match(74)){let c=this.tsParseThisTypeOrThisTypePredicate();return c.type==="TSThisType"?(i.parameterName=c,i.asserts=!0,i.typeAnnotation=null,c=this.finishNode(i,"TSTypePredicate")):(this.resetStartLocationFromNode(c,i),c.asserts=!0),s.typeAnnotation=c,this.finishNode(s,"TSTypeAnnotation")}let a=this.tsIsIdentifier()&&this.tsTryParse(this.tsParseTypePredicatePrefix.bind(this));if(!a)return r?(i.parameterName=this.parseIdentifier(),i.asserts=r,i.typeAnnotation=null,s.typeAnnotation=this.finishNode(i,"TSTypePredicate"),this.finishNode(s,"TSTypeAnnotation")):this.tsParseTypeAnnotation(!1,s);let o=this.tsParseTypeAnnotation(!1);return i.parameterName=a,i.typeAnnotation=o,i.asserts=r,s.typeAnnotation=this.finishNode(i,"TSTypePredicate"),this.finishNode(s,"TSTypeAnnotation")})}tsTryParseTypeOrTypePredicateAnnotation(){if(this.match(10))return this.tsParseTypeOrTypePredicateAnnotation(10)}tsTryParseTypeAnnotation(){if(this.match(10))return this.tsParseTypeAnnotation()}tsTryParseType(){return this.tsEatThenParseType(10)}tsParseTypePredicatePrefix(){let t=this.parseIdentifier();if(this.isContextual(115)&&!this.hasPrecedingLineBreak())return this.next(),t}tsParseTypePredicateAsserts(){if(this.state.type!==108)return!1;let t=this.state.containsEsc;return this.next(),!E(this.state.type)&&!this.match(74)?!1:(t&&this.raise(p.InvalidEscapedReservedWord,this.state.lastTokStartLoc,{reservedWord:"asserts"}),!0)}tsParseTypeAnnotation(t=!0,s=this.startNode()){return this.tsInType(()=>{t&&this.expect(10),s.typeAnnotation=this.tsParseType()}),this.finishNode(s,"TSTypeAnnotation")}tsParseType(){Oe(this.state.inType);let t=this.tsParseNonConditionalType();if(this.state.inDisallowConditionalTypesContext||this.hasPrecedingLineBreak()||!this.eat(77))return t;let s=this.startNodeAtNode(t);return s.checkType=t,s.extendsType=this.tsInDisallowConditionalTypesContext(()=>this.tsParseNonConditionalType()),this.expect(13),s.trueType=this.tsInAllowConditionalTypesContext(()=>this.tsParseType()),this.expect(10),s.falseType=this.tsInAllowConditionalTypesContext(()=>this.tsParseType()),this.finishNode(s,"TSConditionalType")}isAbstractConstructorSignature(){return this.isContextual(123)&&this.isLookaheadContextual("new")}tsParseNonConditionalType(){return this.tsIsStartOfFunctionType()?this.tsParseFunctionOrConstructorType("TSFunctionType"):this.match(73)?this.tsParseFunctionOrConstructorType("TSConstructorType"):this.isAbstractConstructorSignature()?this.tsParseFunctionOrConstructorType("TSConstructorType",!0):this.tsParseUnionTypeOrHigher()}tsParseTypeAssertion(){this.getPluginOption("typescript","disallowAmbiguousJSXLike")&&this.raise(m.ReservedTypeAssertion,this.state.startLoc);let t=this.startNode();return t.typeAnnotation=this.tsInType(()=>(this.next(),this.match(71)?this.tsParseTypeReference():this.tsParseType())),this.expect(44),this.state.canStartArrow=!1,t.expression=this.parseMaybeUnary(),this.finishNode(t,"TSTypeAssertion")}tsParseHeritageClause(t){let s=this.state.startLoc,i=this.tsParseDelimitedList("HeritageClauseElement",()=>{let r=(this.state.canStartArrow=!1,super.parseExprSubscripts());he(r)||this.raise(m.InvalidHeritageClauseType,r.start,{token:t});let a=t==="extends"?"TSInterfaceHeritage":"TSClassImplements";if(r.type==="TSInstantiationExpression")return r.type=a,r;let o=this.startNodeAtNode(r);return o.expression=r,(this.match(43)||this.match(47))&&(o.typeArguments=this.tsParseTypeArgumentsInExpression()),this.finishNode(o,a)});return i.length||this.raise(m.EmptyHeritageClauseType,s,{token:t}),i}tsParseInterfaceDeclaration(t,s={}){if(this.hasFollowingLineBreak())return null;this.expectContextual(128),s.declare&&(t.declare=!0),E(this.state.type)?(t.id=this.parseIdentifier(),this.checkIdentifier(t.id,130)):(t.id=null,this.raise(m.MissingInterfaceName,this.state.startLoc)),t.typeParameters=this.tsTryParseTypeParameters(this.tsParseInOutConstModifiers),this.eat(77)&&(t.extends=this.tsParseHeritageClause("extends"));let i=this.startNode();return i.body=this.tsInType(this.tsParseObjectTypeMembers.bind(this)),t.body=this.finishNode(i,"TSInterfaceBody"),this.finishNode(t,"TSInterfaceDeclaration")}tsParseTypeAliasDeclaration(t){return t.id=this.parseIdentifier(),this.checkIdentifier(t.id,2),t.typeAnnotation=this.tsInType(()=>{if(t.typeParameters=this.tsTryParseTypeParameters(this.tsParseInOutModifiers),this.expect(25),this.isContextual(113)&&this.lookaheadCharCode()!==46){let s=this.startNode();return this.next(),this.finishNode(s,"TSIntrinsicKeyword")}return this.tsParseType()}),this.semicolon(),this.finishNode(t,"TSTypeAliasDeclaration")}tsInTopLevelContext(t){if(this.curContext()!==k.brace){let s=this.state.context;this.state.context=[s[0]];try{return t()}finally{this.state.context=s}}else return t()}tsInType(t){let s=this.state.inType;this.state.inType=!0;try{return t()}finally{this.state.inType=s}}tsInDisallowConditionalTypesContext(t){let s=this.state.inDisallowConditionalTypesContext;this.state.inDisallowConditionalTypesContext=!0;try{return t()}finally{this.state.inDisallowConditionalTypesContext=s}}tsInAllowConditionalTypesContext(t){let s=this.state.inDisallowConditionalTypesContext;this.state.inDisallowConditionalTypesContext=!1;try{return t()}finally{this.state.inDisallowConditionalTypesContext=s}}tsEatThenParseType(t){if(this.match(t))return this.tsNextThenParseType()}tsExpectThenParseType(t){return this.tsInType(()=>(this.expect(t),this.tsParseType()))}tsNextThenParseType(){return this.tsInType(()=>(this.next(),this.tsParseType()))}tsParseEnumMember(){let t=this.startNode();return t.id=this.match(133)?super.parseStringLiteral(this.state.value):this.parseIdentifier(!0),this.eat(25)&&(t.initializer=super.parseMaybeAssignAllowIn()),this.finishNode(t,"TSEnumMember")}tsParseEnumDeclaration(t,s={}){return s.const&&(t.const=!0),s.declare&&(t.declare=!0),this.expectContextual(125),t.id=this.parseIdentifier(),this.checkIdentifier(t.id,t.const?8971:8459),t.body=this.tsParseEnumBody(),this.finishNode(t,"TSEnumDeclaration")}tsParseEnumBody(){let t=this.startNode();return this.expect(2),t.members=this.tsParseDelimitedList("EnumMembers",this.tsParseEnumMember.bind(this)),this.expect(4),this.finishNode(t,"TSEnumBody")}tsParseModuleBlock(t){let s=this.startNode();return t||this.scope.enter(0),this.expect(2),super.parseBlockOrModuleBlockBody(s.body=[],void 0,!0,4),t||this.scope.exit(),this.finishNode(s,"TSModuleBlock")}tsParseNamespaceDeclaration(t){return t.id=this.tsParseEntityName(0),t.id.type==="Identifier"&&this.checkIdentifier(t.id,1024),this.scope.enter(2048),this.prodParam.enter(0),t.body=this.tsParseModuleBlock(!1),this.prodParam.exit(),this.scope.exit(),this.finishNode(t,"TSModuleDeclaration")}tsParseAmbientExternalModuleDeclaration(t){let s=this.isContextual(111);if(s)t.kind="global",t.id=this.parseIdentifier();else{t.kind="module";let{type:i,value:r}=this.state;i===133?t.id=super.parseStringLiteral(r):E(i)?(this.raise(m.InlineModuleDeclarationMustUseString,this.state.startLoc),t.id=this.tsParseEntityName(0)):i===2?this.raise(m.EmptyNamespaceName,this.state.startLoc):(this.raise(m.InvalidNamespaceName,this.state.startLoc,r),t.id=super.parseExprAtom())}return this.match(2)?(s||this.scope.enter(1024),this.prodParam.enter(0),t.body=this.tsParseModuleBlock(s),this.prodParam.exit(),s||this.scope.exit()):this.semicolon(),this.finishNode(t,"TSModuleDeclaration")}tsParseImportEqualsDeclaration(t,s){t.id=s||this.parseIdentifier(),this.checkIdentifier(t.id,4096),this.expect(25);let i=this.tsParseModuleReference();return t.importKind==="type"&&i.type!=="TSExternalModuleReference"&&this.raise(m.ImportAliasHasImportType,i),t.moduleReference=i,this.semicolon(),this.finishNode(t,"TSImportEqualsDeclaration")}tsIsExternalModuleReference(){return this.isContextual(118)&&this.lookaheadCharCode()===40}tsParseModuleReference(){return this.tsIsExternalModuleReference()?this.tsParseExternalModuleReference():this.tsParseEntityName(0)}tsParseExternalModuleReference(){let t=this.startNode();return this.expectContextual(118),this.expect(6),this.match(133)||this.unexpected(),t.expression=super.parseExprAtom(),this.expect(7),this.sawUnambiguousESM=!0,this.finishNode(t,"TSExternalModuleReference")}tsLookAhead(t){let s=this.state.clone(),i=t();return this.state=s,i}tsTryParseAndCatch(t){let s=this.tryParse(i=>t()||i());if(!(s.aborted||!s.node))return s.error&&(this.state=s.failState),s.node}tsTryParse(t){let s=this.state.clone(),i=t();if(i!==void 0&&i!==!1)return i;this.state=s}tsTryParseDeclare(t){if(this.isLineTerminator())return;let s=this.state.type;return this.tsInAmbientContext(()=>{switch(s){case 64:return t.declare=!0,super.parseFunctionStatement(t,!1,2);case 76:return t.declare=!0,this.parseClass(t,!0,!1);case 125:return this.tsParseEnumDeclaration(t,{declare:!0});case 111:return this.tsParseAmbientExternalModuleDeclaration(t);case 97:if(this.state.containsEsc)return;case 71:case 70:return!this.match(71)||!this.isLookaheadContextual("enum")?(t.declare=!0,this.parseVarStatement(t,this.state.value,!0)):(this.expect(71),this.tsParseEnumDeclaration(t,{const:!0,declare:!0}));case 106:if(this.isUsing())return this.raise(m.InvalidModifierOnUsingDeclaration,this.state.startLoc,"declare"),t.declare=!0,this.parseVarStatement(t,"using",!0);break;case 93:if(this.isAwaitUsing())return this.raise(m.InvalidModifierOnAwaitUsingDeclaration,this.state.startLoc,"declare"),t.declare=!0,this.next(),this.parseVarStatement(t,"await using",!0);break;case 128:{let i=this.tsParseInterfaceDeclaration(t,{declare:!0});if(i)return i}default:if(E(s))return this.tsParseDeclaration(t,this.state.type,!0,null)}})}tsTryParseExportDeclaration(){return this.tsParseDeclaration(this.startNode(),this.state.type,!0,null)}tsParseDeclaration(t,s,i,r){switch(s){case 123:if(this.tsCheckLineTerminator(i)&&(this.match(76)||E(this.state.type)))return this.tsParseAbstractDeclaration(t,r);break;case 126:if(this.tsCheckLineTerminator(i))return this.tsParseAmbientExternalModuleDeclaration(t);break;case 127:if(this.tsCheckLineTerminator(i)&&E(this.state.type))return t.kind="namespace",this.tsParseNamespaceDeclaration(t);break;case 129:if(this.tsCheckLineTerminator(i)&&E(this.state.type))return this.tsParseTypeAliasDeclaration(t);break}}tsCheckLineTerminator(t){return t?this.hasFollowingLineBreak()?!1:(this.next(),!0):!this.isLineTerminator()}tsTryParseGenericAsyncArrowFunction(t){if(!this.match(43))return;let s=this.tsTryParseAndCatch(()=>{let i=this.startNodeAt(t);return i.typeParameters=this.tsParseTypeParameters(this.tsParseConstModifier),super.parseFunctionParams(i),i.returnType=this.tsTryParseTypeOrTypePredicateAnnotation(),this.expect(15),i});if(s)return super.parseArrowExpression(s,null,!0)}tsParseTypeArgumentsInExpression(){if(this.reScan_lt()===43)return this.tsParseTypeArguments()}tsParseTypeArguments(){let t=this.startNode();return t.params=this.tsInType(()=>this.tsInTopLevelContext(()=>(this.expect(43),this.tsParseDelimitedList("TypeParametersOrArguments",this.tsParseType.bind(this))))),t.params.length===0?this.raise(m.EmptyTypeArguments,t):!this.state.inType&&this.curContext()===k.brace&&this.reScan_lt_gt(),this.expect(44),this.finishNode(t,"TSTypeParameterInstantiation")}tsIsDeclarationStart(){return Cs(this.state.type)}isExportDefaultSpecifier(){return this.tsIsDeclarationStart()?!1:super.isExportDefaultSpecifier()}parseBindingElement(t,s){let i=s.length?null:this.state.startLoc,r={};this.tsParseModifiers(hi,void 0,r);let a=r.accessibility,o=r.override,c=r.readonly;!(t&4)&&(a||c||o)&&this.raise(m.UnexpectedParameterModifier,i||s[0]);let h=this.state.startLoc,l=this.parseMaybeDefault(h);t&2&&this.parseFunctionParamType(l);let u=this.parseMaybeDefault(h,l);if(a||c||o){let f=i?this.startNodeAt(i):this.startNodeAtNode(s[0]);return s.length&&(f.decorators=s),a&&(f.accessibility=a),c&&(f.readonly=c),o&&(f.override=o),u.type!=="Identifier"&&u.type!=="AssignmentPattern"&&this.raise(m.UnsupportedParameterPropertyKind,i||s[0]),f.parameter=u,this.finishNode(f,"TSParameterProperty")}return s.length&&(l.decorators=s),u}isSimpleParameter(t){return t.type==="TSParameterProperty"&&super.isSimpleParameter(t.parameter)||super.isSimpleParameter(t)}tsDisallowOptionalPattern(t){for(let s of t.params)s.type!=="Identifier"&&s.optional&&!this.state.isAmbientContext&&this.raise(m.PatternIsOptional,s)}setArrowFunctionParameters(t,s,i){super.setArrowFunctionParameters(t,s,i),this.tsDisallowOptionalPattern(t)}parseFunctionBodyAndFinish(t,s,i=!1){this.match(10)&&(t.returnType=this.tsParseTypeOrTypePredicateAnnotation(10));let r=s==="FunctionDeclaration"?"TSDeclareFunction":s==="ClassMethod"||s==="ClassPrivateMethod"?"TSDeclareMethod":void 0;if(r&&!this.match(2)&&this.isLineTerminator()){if(r==="TSDeclareMethod"&&t.kind==="constructor")for(let a of t.params)a.type==="TSParameterProperty"?this.raise(m.UnexpectedParameterModifier,a):a.type==="AssignmentPattern"&&this.raise(m.UnexpectedParameterInitializer,a);else for(let a of t.params)a.type==="AssignmentPattern"&&this.raise(m.UnexpectedParameterInitializer,a);return this.finishNode(t,r)}return r&&this.state.isAmbientContext&&(this.raise(m.DeclareFunctionHasImplementation,this.state.startLoc),r==="TSDeclareFunction"&&t.declare)?super.parseFunctionBodyAndFinish(t,r,i):(this.tsDisallowOptionalPattern(t),super.parseFunctionBodyAndFinish(t,s,i))}registerFunctionStatementId(t){!t.body&&t.id?this.checkIdentifier(t.id,1024):super.registerFunctionStatementId(t)}tsCheckForInvalidTypeCasts(t){t.forEach(s=>{s?.type==="TSTypeCastExpression"&&this.raise(m.UnexpectedTypeAnnotation,s.typeAnnotation)})}toReferencedList(t,s){return this.tsCheckForInvalidTypeCasts(t),t}parseArrayLike(t,s){let i=super.parseArrayLike(t,s);return i.type==="ArrayExpression"&&this.tsCheckForInvalidTypeCasts(i.elements),i}parseSubscript(t,s,i,r){if(!this.hasPrecedingLineBreak()&&this.match(31)){this.state.canStartJSXElement=!1,this.next();let o=this.startNodeAt(s);return o.expression=t,this.finishNode(o,"TSNonNullExpression")}let a=!1;if(this.match(14)&&this.lookaheadCharCode()===60){if(i)return r.stop=!0,t;r.optionalChainMember=a=!0,this.next()}if(this.match(43)||this.match(47)){let o,c=this.tsTryParseAndCatch(()=>{if(!i&&this.atPossibleAsyncArrow(t)){let f=this.tsTryParseGenericAsyncArrowFunction(s);if(f)return r.stop=!0,f}let h=this.tsParseTypeArgumentsInExpression();if(!h)return;if(a&&!this.match(6)){o=this.state.curPosition();return}if(_t(this.state.type)){let f=super.parseTaggedTemplateExpression(t,s,r);return f.typeArguments=h,f}if(!i&&this.eat(6)){let f=this.startNodeAt(s);return f.callee=t,f.arguments=this.parseCallExpressionArguments(),this.tsCheckForInvalidTypeCasts(f.arguments),f.typeArguments=h,r.optionalChainMember&&(f.optional=a),this.finishCallExpression(f,r.optionalChainMember)}let l=this.state.type;if(l===44||l===48||l!==6&&l!==90&&l!==119&&ht(l)&&!this.hasPrecedingLineBreak())return;let u=this.startNodeAt(s);return u.expression=t,u.typeArguments=h,this.finishNode(u,"TSInstantiationExpression")});if(o&&this.unexpected(o,6),c)return c.type==="TSInstantiationExpression"&&((this.match(12)||this.match(14)&&this.lookaheadCharCode()!==40)&&this.raise(m.InvalidPropertyAccessAfterInstantiationExpression,this.state.startLoc),!this.match(12)&&!this.match(14)&&(c.expression=super.stopParseSubscript(t,r))),c}return super.parseSubscript(t,s,i,r)}parseNewCallee(t){super.parseNewCallee(t);let{callee:s}=t;s.type==="TSInstantiationExpression"&&!s.extra?.parenthesized&&(t.typeArguments=s.typeArguments,t.callee=s.expression)}parseExprOp(t,s,i){let r;if(At(54)>i&&!this.hasPrecedingLineBreak()&&(this.isContextual(90)||(r=this.isContextual(119)))){let a=this.startNodeAt(s);a.expression=t,a.typeAnnotation=this.tsInType(()=>(this.next(),this.match(71)?(r&&this.raise(p.UnexpectedKeyword,this.state.startLoc,{keyword:"const"}),this.tsParseTypeReference()):this.tsParseType()));let o=this.finishNode(a,r?"TSSatisfiesExpression":"TSAsExpression");return this.reScan_lt_gt(),this.parseExprOp(o,s,i)}return super.parseExprOp(t,s,i)}checkReservedWord(t,s,i,r){this.state.isAmbientContext||super.checkReservedWord(t,s,i,r)}checkDuplicateExports(){}isPotentialImportPhase(t){if(super.isPotentialImportPhase(t))return!0;if(this.isContextual(129)){let s=this.lookaheadCharCode();return t?s===123||s===42:s!==61}return!t&&this.isContextual(83)}applyImportPhase(t,s,i,r){super.applyImportPhase(t,s,i,r),s?t.exportKind=i==="type"?"type":"value":t.importKind=i==="type"||i==="typeof"?i:"value"}parseImport(t){if(this.match(133))return t.importKind="value",this.scope.inTSNamespace&&this.raise(m.ImportInTSNamespace,t),super.parseImport(t);let s;if(E(this.state.type)&&this.lookaheadCharCode()===61){t.importKind="value";let i=this.tsParseImportEqualsDeclaration(t);return this.scope.inTSNamespace&&i.moduleReference.type==="TSExternalModuleReference"&&this.raise(m.ImportInTSNamespace,t),i}else if(this.isContextual(129)){let i=this.parseMaybeImportPhase(t,!1);if(this.lookaheadCharCode()===61)return this.scope.inTSNamespace&&this.raise(m.ImportInTSNamespace,t),this.tsParseImportEqualsDeclaration(t,i);s=super.parseImportSpecifiersAndAfter(t,i)}else s=super.parseImport(t);return s.importKind==="type"&&s.specifiers.length>1&&s.specifiers[0].type==="ImportDefaultSpecifier"?this.raise(m.TypeImportCannotSpecifyDefaultAndNamed,s):this.scope.inTSNamespace&&this.raise(m.ImportInTSNamespace,s),s}parseExport(t,s){if(this.match(79)){let i=this.startNode();this.next();let r=null;this.isContextual(129)&&this.isPotentialImportPhase(!1)?r=this.parseMaybeImportPhase(i,!1):i.importKind="value";let a=this.tsParseImportEqualsDeclaration(i,r);return t.attributes=[],t.declaration=a,t.exportKind="value",t.source=null,t.specifiers=[],this.finishNode(t,"ExportNamedDeclaration")}else if(this.eat(25)){let i=t;return i.expression=super.parseExpression(),this.semicolon(),this.sawUnambiguousESM=!0,this.scope.inTSNamespace&&this.raise(m.ExportAssignmentInTSNamespace,i),this.finishNode(i,"TSExportAssignment")}else if(this.eatContextual(90)){let i=t;return this.expectContextual(127),i.id=this.parseIdentifier(),this.checkIdentifier(i.id,8201),this.semicolon(),this.scope.inTSNamespace&&this.raise(m.NamespaceExportInTSNamespace,i),this.finishNode(i,"TSNamespaceExportDeclaration")}else{let i=super.parseExport(t,s);return this.scope.inTSNamespace&&(i.type!=="ExportNamedDeclaration"||i.source||!i.declaration&&!this.state.isAmbientContext)&&this.raise(m.ExportInTSNamespace,i),i}}isAbstractClass(){return this.isContextual(123)&&this.isLookaheadContextual("class")}parseExportDefaultExpression(){if(this.isAbstractClass()){let t=this.startNode();return this.next(),t.abstract=!0,this.parseClass(t,!0,!0)}if(this.match(128)){let t=this.tsParseInterfaceDeclaration(this.startNode());if(t)return t}return super.parseExportDefaultExpression()}parseVarStatement(t,s,i=!1){let{isAmbientContext:r}=this.state,a=super.parseVarStatement(t,s,i||r);if(r&&!t.declare&&(s==="using"||s==="await using"))return this.raiseOverwrite(m.UsingDeclarationInAmbientContext,t,s),a;for(let o of a.declarations){let{id:c,init:h,definite:l}=o;l&&(h?this.raise(m.DeclaratorDefiniteAssertionWithInitializer,c):c.typeAnnotation||this.raise(m.DeclaratorDefiniteAssertionRequiresTypeAnnotation,c)),r&&h&&(s==="var"||s==="let"||c.typeAnnotation?this.raise(m.InitializerNotAllowedInAmbientContext,h):fi(h,this.hasPlugin("estree"))||this.raise(m.ConstInitializerMustBeStringOrNumericLiteralOrLiteralEnumReference,h))}return a}parseStatementContent(t,s){let i=!!(t&2);if(!this.state.containsEsc)switch(this.state.type){case 71:{if(this.isLookaheadContextual("enum")){let r=this.startNode();return this.next(),this.tsParseEnumDeclaration(r,{const:!0})}break}case 123:case 124:{if(this.nextTokenIsIdentifierAndNotTSRelationalOperatorOnSameLine()){let r=this.state.type,a=this.startNode();this.next();let o=r===124?this.tsTryParseDeclare(a):this.tsParseAbstractDeclaration(a,s);return o?(r===124&&(o.declare=!0),o):(a.expression=this.createIdentifier(this.startNodeAtNode(a),r===124?"declare":"abstract"),this.semicolon(!1),this.finishNode(a,"ExpressionStatement"))}break}case 125:return this.tsParseEnumDeclaration(this.startNode());case 111:{if(this.lookaheadCharCode()===123){let a=this.startNode();return this.tsParseAmbientExternalModuleDeclaration(a)}break}case 128:{let r=this.tsParseInterfaceDeclaration(this.startNode());if(r)return i||this.raise(m.UnexpectedTypeDeclaration,r,"interface"),r;break}case 126:{if(this.nextTokenIsStringLiteralOnSameLine()){let r=this.startNode();return this.next(),this.tsParseDeclaration(r,126,!1,s)}else if(this.nextTokenIsIdentifierOnSameLine()){this.raise(m.InlineModuleDeclarationMustUseString,this.state.startLoc);let r=this.startNode();return this.next(),this.tsParseDeclaration(r,127,!1,s)}break}case 127:{if(this.nextTokenIsIdentifierOnSameLine()){let r=this.startNode();return this.next(),this.tsParseDeclaration(r,127,!1,s)}break}case 129:{if(this.nextTokenIsIdentifierOnSameLine()){let r=this.startNode();return i||this.raise(m.UnexpectedTypeDeclaration,r,"type"),this.next(),this.tsParseTypeAliasDeclaration(r)}break}}return super.parseStatementContent(t,s)}parseAccessModifier(){return this.tsParseModifier(li)}tsHasSomeModifiers(t,s){return s.some(i=>Fe(i)?t.accessibility===i:!!t[i])}tsIsStartOfStaticBlocks(){return this.isContextual(103)&&this.lookaheadCharCode()===123}parseClassMember(t,s,i){this.tsParseModifiers(oi,m.InvalidModifierOnTypeParameterPositions,s,!0);let r=()=>{this.tsIsStartOfStaticBlocks()?(this.next(),this.next(),this.tsHasSomeModifiers(s,["declare","private","public","protected","override","abstract","readonly","static"])&&this.raise(m.StaticBlockCannotHaveModifier,this.state.curPosition()),super.parseClassStaticBlock(t,s)):this.parseClassMemberWithIsStatic(t,s,i,!!s.static)};s.declare?this.tsInAmbientContext(r):r(),s.decorators&&s.decorators.length>0&&!this.hasPlugin("decorators-legacy")&&(s.type==="TSAbstractMethodDefinition"||s.type==="TSDeclareMethod"?this.raise(m.DecoratorAbstractMethod,s,{kind:"abstract method"}):(s.type==="ClassProperty"&&s.abstract||s.type==="ClassProperty"&&s.declare||s.type==="TSAbstractPropertyDefinition"||s.type==="PropertyDefinition"&&s.declare)&&this.raise(m.DecoratorAbstractMethod,s,{kind:s.declare?"declare field":"abstract field"}))}parseClassMemberWithIsStatic(t,s,i,r){let a=this.tsTryParseIndexSignature(s);if(a){t.body.push(a),s.abstract&&this.raise(m.IndexSignatureHasAbstract,s),s.accessibility&&this.raise(m.IndexSignatureHasAccessibility,s,{modifier:s.accessibility}),s.declare&&this.raise(m.IndexSignatureHasDeclare,s),s.override&&this.raise(m.IndexSignatureHasOverride,s);return}!this.state.inAbstractClass&&s.abstract&&this.raise(m.NonAbstractClassHasAbstractMethod,s),s.override&&(i.hadSuperClass||this.raise(m.OverrideNotInSubClass,s)),super.parseClassMemberWithIsStatic(t,s,i,r)}parsePostMemberNameModifiers(t){this.eat(13)&&(t.optional=!0),t.readonly&&this.match(6)&&this.raise(m.ClassMethodHasReadonly,t),t.declare&&this.match(6)&&this.raise(m.ClassMethodHasDeclare,t)}shouldParseExportDeclaration(){return this.tsIsDeclarationStart()?!0:super.shouldParseExportDeclaration()}parseConditional(t,s,i){if(!this.match(13))return t;if(i!=null){let o=this.lookaheadCharCode();if(o===44||o===61||o===58||o===41)return this.setOptionalParametersError(i),t}this.next();let r=this.startNodeAt(s);r.test=t;let a=this.state.inConditionalConsequent;return this.state.inConditionalConsequent=!0,r.consequent=this.parseMaybeAssignAllowIn(),this.state.inConditionalConsequent=a,this.expect(10),r.alternate=this.parseMaybeAssign(),this.finishNode(r,"ConditionalExpression")}parseParenItem(t,s){let i=super.parseParenItem(t,s);if(this.eat(13)&&(i.optional=!0,this.resetEndLocation(t)),this.match(10)){let r=this.startNodeAt(s);return r.expression=t,r.typeAnnotation=this.tsParseTypeAnnotation(),this.finishNode(r,"TSTypeCastExpression")}return t}parseExportDeclaration(t){if(!this.state.isAmbientContext&&this.isContextual(124))return this.tsInAmbientContext(()=>this.parseExportDeclaration(t));let s=this.state.startLoc,i=this.eatContextual(124);if(i&&(this.isContextual(124)||!this.shouldParseExportDeclaration()))throw this.raise(m.ExpectedAmbientAfterExportDeclare,this.state.startLoc);let a=E(this.state.type)&&this.tsTryParseExportDeclaration()||super.parseExportDeclaration(t);return a?((a.type==="TSInterfaceDeclaration"||a.type==="TSTypeAliasDeclaration"||i)&&(t.exportKind="type"),i&&a.type!=="TSImportEqualsDeclaration"&&(this.resetStartLocation(a,s),a.declare=!0),a):null}parseClassId(t,s,i,r){if((!s||i)&&this.isContextual(112)){t.id=null;return}super.parseClassId(t,s,i,t.declare?1024:8331);let a=this.tsTryParseTypeParameters(this.tsParseInOutConstModifiers);a&&(t.typeParameters=a)}parseClassPropertyAnnotation(t){t.optional||(this.eat(31)?t.definite=!0:this.eat(13)&&(t.optional=!0));let s=this.tsTryParseTypeAnnotation();s&&(t.typeAnnotation=s),t.definite&&(this.match(25)?this.raise(m.DeclaratorDefiniteAssertionWithInitializer,t):s||this.raise(m.DeclaratorDefiniteAssertionRequiresTypeAnnotation,t))}parseClassProperty(t){if(this.parseClassPropertyAnnotation(t),this.state.isAmbientContext&&!(t.readonly&&!t.typeAnnotation)&&this.match(25)&&this.raise(m.DeclareClassFieldHasInitializer,this.state.startLoc),t.abstract&&this.match(25)){let{key:s}=t;this.raise(m.AbstractPropertyHasInitializer,this.state.startLoc,{propertyName:s.type==="Identifier"&&!t.computed?s.name:`[${this.input.slice(this.offsetToSourcePos(s.start),this.offsetToSourcePos(s.end))}]`})}return super.parseClassProperty(t)}parseClassPrivateProperty(t){return t.abstract&&this.raise(m.PrivateElementHasAbstract,t),t.accessibility&&this.raise(m.PrivateElementHasAccessibility,t,{modifier:t.accessibility}),this.parseClassPropertyAnnotation(t),super.parseClassPrivateProperty(t)}parseClassAccessorProperty(t){return this.parseClassPropertyAnnotation(t),t.optional&&this.raise(m.AccessorCannotBeOptional,t),super.parseClassAccessorProperty(t)}pushClassMethod(t,s,i,r,a,o){let c=this.tsTryParseTypeParameters(this.tsParseConstModifier);c&&a&&this.raise(m.ConstructorHasTypeParameters,c);let{declare:h=!1,kind:l}=s;h&&(l==="get"||l==="set")&&this.raise(m.DeclareAccessor,s,{kind:l}),c&&(s.typeParameters=c),super.pushClassMethod(t,s,i,r,a,o)}pushClassPrivateMethod(t,s,i,r){let a=this.tsTryParseTypeParameters(this.tsParseConstModifier);a&&(s.typeParameters=a),super.pushClassPrivateMethod(t,s,i,r)}declareClassPrivateMethodInScope(t,s){t.type!=="TSDeclareMethod"&&(t.type==="MethodDefinition"&&t.value.body==null||super.declareClassPrivateMethodInScope(t,s))}parseClassSuper(t){if(super.parseClassSuper(t),t.superClass)if(t.superClass.type==="TSInstantiationExpression"){let s=t.superClass,i=s.expression;this.takeSurroundingComments(i,i.start,i.end);let r=s.typeArguments;this.takeSurroundingComments(r,r.start,r.end),t.superClass=i,t.superTypeArguments=r}else(this.match(43)||this.match(47))&&(t.superTypeArguments=this.tsParseTypeArgumentsInExpression());this.eatContextual(112)&&(t.implements=this.tsParseHeritageClause("implements"))}parseObjPropValue(t,s,i,r,a,o,c){let h=this.tsTryParseTypeParameters(this.tsParseConstModifier);return h&&(t.typeParameters=h),super.parseObjPropValue(t,s,i,r,a,o,c)}parseFunctionParams(t,s){let i=this.tsTryParseTypeParameters(this.tsParseConstModifier);i&&(t.typeParameters=i),super.parseFunctionParams(t,s)}parseVarId(t,s){super.parseVarId(t,s),t.id.type==="Identifier"&&!this.hasPrecedingLineBreak()&&this.eat(31)&&(t.definite=!0);let i=this.tsTryParseTypeAnnotation();i&&(t.id.typeAnnotation=i,this.resetEndLocation(t.id))}parseAsyncArrowFromCallExpression(t,s){return this.match(10)&&(t.returnType=this.tsParseTypeAnnotation()),super.parseAsyncArrowFromCallExpression(t,s)}parseMaybeAssign(t,s){let i,r,a;if(this.hasPlugin("jsx")&&(this.match(141)||this.match(43))){if(i=this.state.clone(),r=this.tryParse(()=>super.parseMaybeAssign(t,s),i),!r.error)return r.node;let{context:h}=this.state,l=h[h.length-1];(l===k.j_oTag||l===k.j_expr)&&h.pop()}if(!r?.error&&!this.match(43))return super.parseMaybeAssign(t,s);(!i||i===this.state)&&(i=this.state.clone());let o,c=this.tryParse(h=>{o=this.tsParseTypeParameters(this.tsParseConstModifier);let l=super.parseMaybeAssign(t,s);if((l.type!=="ArrowFunctionExpression"||l.extra?.parenthesized)&&h(),o?.params.length!==0&&this.resetStartLocationFromNode(l,o),l.typeParameters=o,this.hasPlugin("jsx")&&l.typeParameters.params.length===1&&!l.typeParameters.extra?.trailingComma){let u=l.typeParameters.params[0];u.constraint||this.raise(m.SingleTypeParameterWithoutTrailingComma,this.optionFlags&256?U(u.loc.end,1):u,{typeParameterName:u.name.name})}return l},i);if(!c.error&&!c.aborted)return o&&this.reportReservedArrowTypeParam(o),c.node;if(!r&&(Oe(!this.hasPlugin("jsx")),a=this.tryParse(()=>super.parseMaybeAssign(t,s),i),!a.error))return a.node;if(r?.node)return this.state=r.failState,r.node;if(c.node)return this.state=c.failState,o&&this.reportReservedArrowTypeParam(o),c.node;if(a?.node)return this.state=a.failState,a.node;throw r?.error||c.error||a?.error}reportReservedArrowTypeParam(t){t.params.length===1&&!t.params[0].constraint&&!t.extra?.trailingComma&&this.getPluginOption("typescript","disallowAmbiguousJSXLike")&&this.raise(m.ReservedArrowTypeParam,t)}parseMaybeUnary(t,s){return!this.hasPlugin("jsx")&&this.match(43)?this.tsParseTypeAssertion():super.parseMaybeUnary(t,s)}parseArrow(t){if(this.match(10)){let s=this.tryParse(i=>{let r=this.tsParseTypeOrTypePredicateAnnotation(10);return(this.canInsertSemicolon()||!this.match(15))&&i(),r});if(s.aborted)return;s.thrown||(s.error&&(this.state=s.failState),t.returnType=s.node)}return super.parseArrow(t)}parseFunctionParamType(t){this.eat(13)&&(t.optional=!0);let s=this.tsTryParseTypeAnnotation();return s&&(t.typeAnnotation=s),this.resetEndLocation(t),t}isAssignable(t,s){switch(t.type){case"TSTypeCastExpression":return this.isAssignable(t.expression,s);case"TSParameterProperty":return!0;default:return super.isAssignable(t,s)}}toAssignable(t,s=!1){if(jt(t)){s?this.expressionScope.recordArrowParameterBindingError(m.UnexpectedTypeCastInParameter,t):this.raiseOnce(m.UnexpectedTypeCastInParameter,t),this.toAssignable(t.expression,s);return}switch(t.type){case"ParenthesizedExpression":this.toAssignableParenthesizedExpression(t,s);break;case"AssignmentExpression":!s&&t.left.type==="TSTypeCastExpression"&&(t.left=this.typeCastToParameter(t.left));default:super.toAssignable(t,s)}}toAssignableParenthesizedExpression(t,s){jt(t.expression)||t.expression.type==="ParenthesizedExpression"?this.toAssignable(t.expression,s):super.toAssignable(t,s)}checkToRestConversion(t,s){jt(t)?this.checkToRestConversion(t.expression,!1):super.checkToRestConversion(t,s)}isValidLVal(t,s,i,r){switch(t){case"TSTypeCastExpression":return!0;case"TSParameterProperty":return"parameter";case"TSNonNullExpression":return"expression";case"TSAsExpression":case"TSSatisfiesExpression":case"TSTypeAssertion":return(r!==64||!i)&&["expression",!0];default:return super.isValidLVal(t,s,i,r)}}parseBindingAtom(){return this.state.type===74?this.parseIdentifier(!0):super.parseBindingAtom()}parseMaybeDecoratorArguments(t,s){if(this.match(43)||this.match(47)){let i=this.tsParseTypeArgumentsInExpression();if(this.match(6)){let r=super.parseMaybeDecoratorArguments(t,s);return r.typeArguments=i,r}this.unexpected(null,6)}return super.parseMaybeDecoratorArguments(t,s)}checkCommaAfterRest(t){return this.state.isAmbientContext&&this.match(8)&&this.lookaheadCharCode()===t?(this.next(),!1):super.checkCommaAfterRest(t)}isClassMethod(){return this.match(43)||super.isClassMethod()}isClassProperty(){return this.match(31)||this.match(10)||super.isClassProperty()}parseMaybeDefault(t,s){let i=super.parseMaybeDefault(t,s);return i.type==="AssignmentPattern"&&i.typeAnnotation&&i.right.start<i.typeAnnotation.start&&this.raise(m.TypeAnnotationAfterAssign,i.typeAnnotation),i}getTokenFromCode(t){if(this.state.inType){if(t===62){this.finishOp(44,1);return}if(t===60){this.finishOp(43,1);return}}super.getTokenFromCode(t)}reScan_lt_gt(){let{type:t}=this.state;t===43?(this.state.pos-=1,this.readToken_lt()):t===44&&(this.state.pos-=1,this.readToken_gt())}reScan_lt(){let{type:t}=this.state;return t===47?(this.state.pos-=2,this.finishOp(43,1),43):t}toAssignableListItem(t,s,i){let r=t[s];r.type==="TSTypeCastExpression"&&(t[s]=this.typeCastToParameter(r)),super.toAssignableListItem(t,s,i)}typeCastToParameter(t){return t.expression.typeAnnotation=t.typeAnnotation,this.resetEndLocationFromNode(t.expression,t.typeAnnotation),t.expression}shouldParseArrow(t){return this.match(10)?t.every(s=>this.isAssignable(s,!0)):super.shouldParseArrow(t)}shouldParseAsyncArrow(){return this.match(10)?!this.state.inConditionalConsequent:super.shouldParseAsyncArrow()}parseParenAndDistinguishExpression(t){let s=this.state.inConditionalConsequent;this.state.inConditionalConsequent=!1;let i=super.parseParenAndDistinguishExpression(t);return this.state.inConditionalConsequent=s,i}canHaveLeadingDecorator(){return super.canHaveLeadingDecorator()||this.isAbstractClass()}jsxParseOpeningElementAfterName(t){if(this.match(43)||this.match(47)){let s=this.tsTryParseAndCatch(()=>this.tsParseTypeArgumentsInExpression());s&&(t.typeArguments=s)}return super.jsxParseOpeningElementAfterName(t)}getGetterSetterExpectedParamCount(t){let s=super.getGetterSetterExpectedParamCount(t),r=this.getObjectOrClassMethodParams(t)[0];return r&&this.isThisParam(r)?s+1:s}parseCatchClauseParam(){let t=super.parseCatchClauseParam(),s=this.tsTryParseTypeAnnotation();return s&&(t.typeAnnotation=s,this.resetEndLocation(t)),t}tsInAmbientContext(t){let{isAmbientContext:s,strict:i}=this.state;this.state.isAmbientContext=!0,this.state.strict=!1;try{return t()}finally{this.state.isAmbientContext=s,this.state.strict=i}}parseClass(t,s,i){let r=this.state.inAbstractClass;this.state.inAbstractClass=!!t.abstract;try{return super.parseClass(t,s,i)}finally{this.state.inAbstractClass=r}}tsParseAbstractDeclaration(t,s){if(this.match(76))return t.abstract=!0,this.maybeTakeDecorators(s,this.parseClass(t,!0,!1));if(this.isContextual(128))return this.hasFollowingLineBreak()?null:(t.abstract=!0,this.raise(m.NonClassMethodPropertyHasAbstractModifier,t),this.tsParseInterfaceDeclaration(t));throw this.unexpected(null,76)}parseMethod(t,s,i,r,a,o,c){let h=super.parseMethod(t,s,i,r,a,o,c);if((h.abstract||h.type==="TSAbstractMethodDefinition")&&(this.hasPlugin("estree")?h.value:h).body){let{key:f}=h;this.raise(m.AbstractMethodHasImplementation,h,{methodName:f.type==="Identifier"&&!h.computed?f.name:`[${this.input.slice(this.offsetToSourcePos(f.start),this.offsetToSourcePos(f.end))}]`})}return h}tsParseTypeParameterName(){return this.parseIdentifier()}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(t,s,i,r){return!s&&r?(this.parseTypeOnlyExportSpecifier(t,i),this.finishNode(t,"ExportSpecifier")):(t.exportKind="value",super.parseExportSpecifier(t,s,i,r))}parseImportSpecifier(t,s,i,r){return!s&&r?(this.parseTypeOnlyImportSpecifier(t),this.finishNode(t,"ImportSpecifier")):(t.importKind="value",super.parseImportSpecifier(t,s,i,r))}checkImportSpecifier(t,s){let i=t.importKind==="type";i&&s&&this.raise(m.TypeModifierIsUsedInTypeImports,t),super.checkImportSpecifier(t,s,i||s?4098:4096)}parseTypeOnlyImportSpecifier(t){let s=t.imported,i=!1;if(this.isContextual(90)){let r=this.parseIdentifier();if(this.isContextual(90)){let a=this.parseIdentifier();F(this.state.type)?(i=!0,s=r,t.local=this.parseIdentifier()):t.local=a}else F(this.state.type)?t.local=this.parseIdentifier():(i=!0,s=r)}else F(this.state.type)&&(i=!0,s=this.parseIdentifier(!0));t.imported=s,t.importKind=i?"type":"value",t.local??=this.eatContextual(90)?this.parseIdentifier():this.cloneIdentifier(t.imported)}parseTypeOnlyExportSpecifier(t,s){let i=t.local,r=!1;if(this.isContextual(90)){let a=this.parseIdentifier();if(this.isContextual(90)){let o=this.parseIdentifier();F(this.state.type)?(r=!0,t.local=a,t.exported=this.parseModuleExportName()):t.exported=o}else F(this.state.type)?t.exported=this.parseModuleExportName():(r=!0,t.local=a)}else F(this.state.type)&&(r=!0,t.local=this.parseModuleExportName());r&&s&&this.raise(m.TypeModifierIsUsedInTypeExports,i),t.exportKind=r?"type":"value",t.exported??=this.eatContextual(90)?this.parseModuleExportName():this.cloneIdentifier(t.local)}fillOptionalPropertiesForTSESLint(t){switch(t.type){case"ImportDeclaration":t.phase??=null;return;case"ExpressionStatement":t.directive??=void 0;return;case"RestElement":t.value=void 0;case"Identifier":case"ArrayPattern":case"AssignmentPattern":case"ObjectPattern":t.decorators??=[],t.optional??=!1,t.typeAnnotation??=void 0;return;case"TSParameterProperty":t.accessibility??=void 0,t.decorators??=[],t.override??=!1,t.readonly??=!1,t.static??=!1;return;case"TSEmptyBodyFunctionExpression":t.body=null;case"TSDeclareFunction":case"FunctionDeclaration":case"FunctionExpression":case"ClassMethod":case"ClassPrivateMethod":t.declare??=!1,t.returnType??=void 0,t.typeParameters??=void 0;return;case"Property":t.optional??=!1;return;case"TSMethodSignature":case"TSPropertySignature":t.optional??=!1;case"TSIndexSignature":t.accessibility??=void 0,t.readonly??=!1,t.static??=!1;return;case"TSAbstractPropertyDefinition":case"PropertyDefinition":case"TSAbstractAccessorProperty":case"AccessorProperty":t.declare??=!1,t.definite??=!1,t.readonly??=!1,t.typeAnnotation??=void 0;case"TSAbstractMethodDefinition":case"MethodDefinition":t.accessibility??=void 0,t.decorators??=[],t.override??=!1,t.optional??=!1;return;case"ClassExpression":t.id??=null;case"ClassDeclaration":t.abstract??=!1,t.declare??=!1,t.decorators??=[],t.implements??=[],t.superTypeArguments??=void 0,t.typeParameters??=void 0;return;case"TSTypeAliasDeclaration":case"VariableDeclaration":t.declare??=!1;return;case"VariableDeclarator":t.definite??=!1;return;case"TSEnumDeclaration":t.const??=!1,t.declare??=!1;return;case"TSEnumMember":t.computed??=!1;return;case"TSImportType":t.qualifier??=null,t.options??=null,t.typeArguments??=null;return;case"TSInterfaceDeclaration":t.declare??=!1,t.extends??=[];return;case"TSMappedType":t.optional??=!1,t.readonly??=void 0;return;case"TSModuleDeclaration":t.declare??=!1,t.global??=t.kind==="global";return;case"TSTypeParameter":t.const??=!1,t.in??=!1,t.out??=!1;return}}chStartsBindingIdentifierAndNotRelationalOperator(t,s){if(z(t)){if(Ut.lastIndex=s,Ut.test(this.input)){let i=this.codePointAtPos(Ut.lastIndex);if(!J(i)&&i!==92)return!1}return!0}else return t===92}nextTokenIsIdentifierAndNotTSRelationalOperatorOnSameLine(){let t=this.nextTokenInLineStart(),s=this.codePointAtPos(t);return this.chStartsBindingIdentifierAndNotRelationalOperator(s,t)}nextTokenIsStringLiteralOnSameLine(){let t=this.nextTokenInLineStart(),s=this.codePointAtPos(t);return s===34||s===39}};function ui(n){if(n.type!=="MemberExpression")return!1;let{computed:e,property:t}=n;return e&&t.type!=="StringLiteral"&&(t.type!=="TemplateLiteral"||t.expressions.length>0)?!1:Ye(n.object)}function fi(n,e){let{type:t}=n;if(n.extra?.parenthesized)return!1;if(e){if(t==="Literal"){let{value:s}=n;if(typeof s=="string"||typeof s=="boolean")return!0}}else if(t==="StringLiteral"||t==="BooleanLiteral")return!0;return!!(Ge(n,e)||di(n,e)||t==="TemplateLiteral"&&n.expressions.length===0||ui(n))}function Ge(n,e){return e?n.type==="Literal"&&(typeof n.value=="number"||"bigint"in n):n.type==="NumericLiteral"||n.type==="BigIntLiteral"}function di(n,e){if(n.type==="UnaryExpression"){let{operator:t,argument:s}=n;if(t==="-"&&Ge(s,e))return!0}return!1}function Ye(n){return n.type==="Identifier"?!0:n.type!=="MemberExpression"||n.computed?!1:Ye(n.object)}function Q(n,e=[]){let t=new Map;for(let s of n)t.set(s,!0);for(let s of e)t.set(s,!1);return t}var mi={ClassNameIsRequired:"A class name is required.",UnexpectedSpace:"Unexpected space in placeholder."},Me=$`placeholders`(mi),yi=n=>class extends n{parsePlaceholder(t){if(this.match(132)){let s=this.startNode();return this.next(),this.assertNoSpace(),s.name=super.parseIdentifier(!0),this.assertNoSpace(),this.expect(132),this.finishPlaceholder(s,t)}}finishPlaceholder(t,s){let i=t;return(!i.expectedNode||!i.type)&&(i=this.finishNode(i,"Placeholder")),i.expectedNode=s,i}getTokenFromCode(t){t===37&&this.input.charCodeAt(this.state.pos+1)===37?this.finishOp(132,2):super.getTokenFromCode(t)}parseExprAtom(t){return this.parsePlaceholder("Expression")||super.parseExprAtom(t)}parseIdentifier(t){return this.parsePlaceholder("Identifier")||super.parseIdentifier(t)}checkReservedWord(t,s,i,r){t!==void 0&&super.checkReservedWord(t,s,i,r)}cloneIdentifier(t){let s=super.cloneIdentifier(t);return s.type==="Placeholder"&&(s.expectedNode=t.expectedNode),s}cloneStringLiteral(t){return t.type==="Placeholder"?this.cloneIdentifier(t):super.cloneStringLiteral(t)}parseBindingAtom(){return this.parsePlaceholder("Pattern")||super.parseBindingAtom()}isValidLVal(t,s,i,r){return t==="Placeholder"||super.isValidLVal(t,s,i,r)}toAssignable(t,s){t&&t.type==="Placeholder"&&t.expectedNode==="Expression"?t.expectedNode="Pattern":super.toAssignable(t,s)}chStartsBindingIdentifier(t,s){if(super.chStartsBindingIdentifier(t,s))return!0;let i=this.nextTokenStart();return this.input.charCodeAt(i)===37&&this.input.charCodeAt(i+1)===37}verifyBreakContinue(t,s){t.label?.type!=="Placeholder"&&super.verifyBreakContinue(t,s)}parseExpressionStatement(t,s,i){if(s.type!=="Placeholder"||s.extra?.parenthesized)return super.parseExpressionStatement(t,s,i);if(this.match(10)){let a=t;return a.label=this.finishPlaceholder(s,"Identifier"),this.next(),a.body=i&8?super.parseStatementOrSloppyAnnexBFunctionDeclaration(!0):super.parseStatement(),this.finishNode(a,"LabeledStatement")}this.semicolon();let r=t;return r.name=s.name,this.finishPlaceholder(r,"Statement")}parseBlock(t,s,i){return this.parsePlaceholder("BlockStatement")||super.parseBlock(t,s,i)}parseFunctionId(t){return this.parsePlaceholder("Identifier")||super.parseFunctionId(t)}parseClass(t,s,i){let r=s?"ClassDeclaration":"ClassExpression";this.next();let a=this.state.strict,o=this.parsePlaceholder("Identifier");if(o)if(this.match(77)||this.match(132)||this.match(2))t.id=o;else{if(i||!s)return t.id=null,t.body=this.finishPlaceholder(o,"ClassBody"),this.finishNode(t,r);throw this.raise(Me.ClassNameIsRequired,this.state.startLoc)}else this.parseClassId(t,s,i);return super.parseClassSuper(t),t.body=this.parsePlaceholder("ClassBody")||super.parseClassBody(!!t.superClass,a),this.finishNode(t,r)}parseExport(t,s){let i=this.parsePlaceholder("Identifier");if(!i)return super.parseExport(t,s);let r=t;if(!this.isContextual(95)&&!this.match(8))return r.specifiers=[],r.source=null,r.declaration=this.finishPlaceholder(i,"Declaration"),this.finishNode(r,"ExportNamedDeclaration");this.expectPlugin("exportDefaultFrom");let a=this.startNode();return a.exported=i,r.specifiers=[this.finishNode(a,"ExportDefaultSpecifier")],super.parseExport(r,s)}isExportDefaultSpecifier(){if(this.match(61)){let t=this.nextTokenStart();if(this.isUnparsedContextual(t,"from")&&this.input.startsWith(W(132),this.hasPlugin("exportDefaultFrom")?this.nextTokenStartSince(t+4):this.nextTokenInLineStartSince(t+4)))return!0}return super.isExportDefaultSpecifier()}maybeParseExportDefaultSpecifier(t,s){return t.specifiers?.length?!0:super.maybeParseExportDefaultSpecifier(t,s)}checkNamedExport(){}parseImport(t){let s=this.parsePlaceholder("Identifier");if(!s)return super.parseImport(t);if(t.specifiers=[],!this.isContextual(95)&&!this.match(8))return t.source=this.finishPlaceholder(s,"StringLiteral"),this.semicolon(),this.finishNode(t,"ImportDeclaration");let i=this.startNodeAtNode(s);return i.local=s,t.specifiers.push(this.finishNode(i,"ImportDefaultSpecifier")),this.eat(8)&&(this.maybeParseStarImportSpecifier(t)||this.parseNamedOrFilteredImportSpecifiers(t)),this.expectContextual(95),t.source=this.parseImportSource(),this.semicolon(),this.finishNode(t,"ImportDeclaration")}parseImportSource(){return this.parsePlaceholder("StringLiteral")||super.parseImportSource()}assertNoSpace(){this.state.start>this.offsetToSourcePos(this.state.lastTokEndLoc.index)&&this.raise(Me.UnexpectedSpace,this.state.lastTokEndLoc)}},xi=n=>class extends n{parseV8Intrinsic(){if(this.match(50)){let t=this.state.startLoc,s=this.startNode();if(this.next(),E(this.state.type)){this.setLoc(this.state.startLoc);let i=this.parseIdentifierName(),r=this.createIdentifier(s,i);if(this.castNodeTo(r,"V8IntrinsicIdentifier"),this.match(6))return r}this.unexpected(t)}}parseExprAtom(t){return this.parseV8Intrinsic()||super.parseExprAtom(t)}},Be=["fsharp","hack"],Re=["^^","@@","^","%","#"];function gi(n){if(n.has("decorators")&&n.has("decorators-legacy"))throw new Error("Cannot use the decorators and decorators-legacy plugin together");if(n.has("flow")&&n.has("typescript"))throw new Error("Cannot combine flow and typescript plugins.");if(n.has("placeholders")&&n.has("v8intrinsic"))throw new Error("Cannot combine placeholders and v8intrinsic plugins.");if(n.has("pipelineOperator")){let e=n.get("pipelineOperator").proposal;if(!Be.includes(e)){let t=Be.map(s=>`"${s}"`).join(", ");throw new Error(`"pipelineOperator" requires "proposal" option whose value must be one of: ${t}.`)}if(e==="hack"){if(n.has("placeholders"))throw new Error("Cannot combine placeholders plugin and Hack-style pipes.");if(n.has("v8intrinsic"))throw new Error("Cannot combine v8intrinsic plugin and Hack-style pipes.");let t=n.get("pipelineOperator").topicToken;if(!Re.includes(t)){let s=Re.map(i=>`"${i}"`).join(", ");throw new Error(`"pipelineOperator" in "proposal": "hack" mode also requires a "topicToken" option whose value must be one of: ${s}.`)}}}if(n.has("moduleAttributes"))throw new Error("`moduleAttributes` has been removed in Babel 8, please migrate to import attributes instead.");if(n.has("importAssertions"))throw new Error("`importAssertions` has been removed in Babel 8, please use import attributes instead.");if(n.has("deprecatedImportAssert")?console.warn("`deprecatedImportAssert` has been removed in Babel 8, please use import attributes instead."):n.has("importAttributes")&&n.get("importAttributes").deprecatedAssertSyntax&&console.warn("The 'importAttributes' plugin has been removed in Babel 8. Please migrate any usage of `assert`-style attributes to `with`."),n.has("recordAndTuple"))throw new Error("The 'recordAndTuple' plugin has been removed in Babel 8. Please remove it from your configuration.");if(n.has("asyncDoExpressions")&&!n.has("doExpressions")){let e=new Error("'asyncDoExpressions' requires 'doExpressions', please add 'doExpressions' to parser plugins.");throw e.missingPlugins="doExpressions",e}if(n.has("optionalChainingAssign")&&n.get("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'.");if(n.has("discardBinding")&&n.get("discardBinding").syntaxType!=="void")throw new Error("The 'discardBinding' plugin requires a 'syntaxType' option. Currently the only supported value is 'void'.");if(n.has("decimal"))throw new Error("The 'decimal' plugin has been removed in Babel 8. Please remove it from your configuration.");if(n.has("importReflection"))throw new Error("The 'importReflection' plugin has been removed in Babel 8. Use 'sourcePhaseImports' instead, and replace 'import module' with 'import source' in your code.");if(n.has("deferredReexports")&&!n.has("deferredImportEvaluation"))throw new Error("The 'deferredReexports' plugin requires 'deferredImportEvaluation'.")}var Qe={estree:fs,jsx:Hs,flow:js,typescript:pi,v8intrinsic:xi,placeholders:yi},Pi=Object.keys(Qe),Et=class extends ce{constructor(e,t,s){let i=us(e);super(i,t),this.options=i,this.initializeScopes(),this.plugins=s,this.filename=i.sourceFilename,this.startIndex=i.startIndex;let r=0;i.allowAwaitOutsideFunction&&(r|=1),i.allowReturnOutsideFunction&&(r|=2),i.allowImportExportEverywhere&&(r|=8),i.allowSuperOutsideMethod&&(r|=16),i.allowUndeclaredExports&&(r|=64),i.allowNewTargetOutsideFunction&&(r|=4),i.allowYieldOutsideFunction&&(r|=32),i.ranges&&(r|=128),i.locations===!0&&(r|=256),i.tokens&&(r|=512),i.createImportExpressions&&(r|=1024),i.createParenthesizedExpressions&&(r|=2048),i.errorRecovery&&(r|=4096),i.attachComment&&(r|=8192),i.annexB&&(r|=16384),this.optionFlags=r}getScopeHandler(){return ut}parse(){this.enterInitialScopes();let e=this.startNode(),t=this.startNode();this.nextToken(),e.errors=[];let s=this.parseTopLevel(e,t);return s.errors=this.state.errors,s.comments.length=this.state.commentsLen,s}};function Ze(n,e){if(e?.sourceType==="unambiguous"){e={...e};try{e.sourceType="module";let t=Tt(e,n),s=t.parse();if(t.sawUnambiguousESM)return s;if(t.ambiguousScriptDifferentAst)try{return e.sourceType="script",Tt(e,n).parse()}catch{}else s.program.sourceType="script";return s}catch(t){try{return e.sourceType="script",Tt(e,n).parse()}catch{}throw t}}else return Tt(e,n).parse()}function Ti(n){let e={};for(let t of Object.keys(n))e[t]=_e(n[t]);return e}var _i=Ti(ms);function Tt(n,e){let t=Et,s=new Map;if(n?.plugins){for(let i of n.plugins){let r,a;typeof i=="string"?r=i:[r,a]=i,s.has(r)||s.set(r,a||{})}gi(s),t=Si(s)}return new t(n,e,s)}var Ue=new Map;function Si(n){let e=[];for(let i of Pi)n.has(i)&&e.push(i);let t=e.join("|"),s=Ue.get(t);if(!s){s=Et;for(let i of e)s=Qe[i](s);Ue.set(t,s)}return s}var Ai=new Set(["type","start","end","loc","range","extra","leadingComments","trailingComments","innerComments","comments","tokens","errors"]),bi=new Set(["typeAnnotation","typeParameters","typeArguments","returnType","superTypeParameters","superTypeArguments","implements","predicate"]),ts=new Set(["memo","forwardRef","React.memo","React.forwardRef","observer","withRouter"]),Pe=["get","post","put","patch","delete","head","options"],Ci=new Set(["GET","POST","PUT","PATCH","DELETE","HEAD","OPTIONS"]),es=new Set(["map","cache","searchParams","params","headers","formData","localStorage","sessionStorage","url","router","navigate","store","state","storage","weakMap","set","registry","queryClient","Reflect","Object","Array","Map","Set","JSON","Math","Promise","console","document","window","location","history"]),Ni=new Set(["createBrowserRouter","createHashRouter","createMemoryRouter","createStaticRouter","useRoutes"]),X=40,Te=120;function*nt(n){for(let e of Object.keys(n)){if(Ai.has(e)||bi.has(e))continue;let t=n[e];if(Array.isArray(t))for(let s of t)s&&typeof s=="object"&&"type"in s&&(yield[e,s]);else t&&typeof t=="object"&&"type"in t&&(yield[e,t])}}function b(n){let e=n??null;for(;e;)switch(e.type){case"TSAsExpression":case"TSSatisfiesExpression":case"TSNonNullExpression":case"TSTypeAssertion":case"TSInstantiationExpression":case"ParenthesizedExpression":e=e.expression;continue;case"AwaitExpression":e=e.argument;continue;default:return e}return e}function R(n){return!!n&&(n.type==="ArrowFunctionExpression"||n.type==="FunctionExpression"||n.type==="FunctionDeclaration")}function v(n){return n.type==="Identifier"?n.name:n.type==="StringLiteral"?n.value:n.type==="PrivateName"?"#"+n.id.name:null}function M(n){let e=b(n);if(!e)return null;switch(e.type){case"Identifier":return e.name;case"ThisExpression":return"this";case"Super":return"super";case"MemberExpression":case"OptionalMemberExpression":{let t=M(e.object);if(t===null)return null;if(!e.computed){let s=v(e.property);return s?`${t}.${s}`:null}return e.property.type==="StringLiteral"?`${t}.${e.property.value}`:`${t}[]`}case"CallExpression":case"OptionalCallExpression":{let t=M(e.callee);return t?`${t}()`:null}case"Import":return"import";default:return null}}function kt(n,e=3){let t=b(n);if(!t)return null;if(t.type==="Identifier")return t.name;if(t.type==="ThisExpression")return"this";if((t.type==="MemberExpression"||t.type==="OptionalMemberExpression")&&!t.computed){let s=kt(t.object,e),i=v(t.property);return s===null||i===null?null:`${s}.${i}`.split(".").slice(0,e).join(".")}return null}function B(n,e=[]){if(!n)return e;switch(n.type){case"Identifier":e.push(n.name);break;case"ObjectPattern":for(let t of n.properties)t.type==="RestElement"?B(t.argument,e):B(t.value,e);break;case"ArrayPattern":for(let t of n.elements)B(t,e);break;case"AssignmentPattern":B(n.left,e);break;case"RestElement":B(n.argument,e);break;case"TSParameterProperty":B(n.parameter,e);break}return e}function L(n){return{line:n.loc?.start.line??0,col:(n.loc?.start.column??0)+1}}function vt(n){return n.type==="JSXIdentifier"?n.name:n.type==="JSXNamespacedName"?`${n.namespace.name}:${n.name.name}`:`${vt(n.object)}.${n.property.name}`}function Ii(n){return/^[A-Z]/.test(n)||n.includes(".")}function dt(...n){for(let e of n){let t=e?.leadingComments;if(!t?.length)continue;let i=t[t.length-1].value.split(`
|
|
10
|
+
`).map(r=>r.replace(/^\s*\*?\s?/,"").trim()).filter(Boolean).filter(r=>!r.startsWith("@"))[0];if(i)return i.slice(0,200)}}function Ei(n){let e=!1,t=s=>{if(!e){if(s.type==="JSXElement"||s.type==="JSXFragment"){e=!0;return}for(let[,i]of nt(s))R(i)&&s!==n||t(i)}};return t(n),e}function wi(n,e,t=90){let s=n.slice(e.start??0,e.end??0).replace(/\s+/g," ");return s.length>t?`${s.slice(0,t-1)}\u2026`:s}function at(n){let e=n.trim();return e=e.replace(/^[a-z][a-z0-9+.-]*:\/\/[^/]*/i,""),e=e.split("#")[0].split("?")[0],e=e.replace(/\/{2,}/g,"/"),e===""&&(e="/"),e}var Ae=class{facts;code;file;clientNames=new Map;axiosNames=new Set;kyNames=new Set;ofetchNames=new Set;openapiFactories=new Set;lazyNames=new Set;extraClients;exportedLocals=new Set;elementIndex=new Map;skip=new Set;tanstack=new Map;constructor(e,t,s,i){this.code=e,this.file=t,this.facts=s,this.extraClients=new Set(i.clients??[])}run(e){this.scanImportsAndExports(e);let t=this.newFunction("(module)","(module)","module",e,!1);t.end=this.facts.lines;for(let s of e.body)this.topLevel(s,t);this.finishTanstack(),(t.calls.length||Object.keys(t.bindings).length||t.renders.length)&&this.facts.functions.unshift(t)}scanImportsAndExports(e){for(let t of e.body)if(t.type==="ImportDeclaration"){let s=t.source.value,i=t.importKind==="type";for(let r of t.specifiers){let{line:a}=L(r),o="default";r.type==="ImportNamespaceSpecifier"?o="*":r.type==="ImportSpecifier"&&(o=v(r.imported)??r.local.name);let c={local:r.local.name,imported:o,source:s,line:a,typeOnly:i||r.type==="ImportSpecifier"&&r.importKind==="type"};this.facts.imports.push(c),!c.typeOnly&&(s==="axios"&&o==="default"&&this.axiosNames.add(c.local),s==="ky"&&o==="default"&&this.kyNames.add(c.local),s==="ofetch"&&(o==="ofetch"||o==="$fetch")&&this.ofetchNames.add(c.local),s==="openapi-fetch"&&(o==="default"||o==="createClient")&&this.openapiFactories.add(c.local),s==="react"&&o==="lazy"&&this.lazyNames.add(c.local))}}else if(t.type==="ExportNamedDeclaration"){let{line:s}=L(t);if(t.source){for(let r of t.specifiers)r.type==="ExportSpecifier"?this.facts.exports.push({name:v(r.exported)??"",local:v(r.local)??"",source:t.source.value,line:s}):r.type==="ExportNamespaceSpecifier"&&this.facts.exports.push({name:v(r.exported)??"",local:"*",source:t.source.value,line:s});continue}for(let r of t.specifiers)if(r.type==="ExportSpecifier"){let a=v(r.local)??"";this.facts.exports.push({name:v(r.exported)??a,local:a,line:s}),this.exportedLocals.add(a)}let i=t.declaration;if(i){let r=i.type==="VariableDeclaration"?i.declarations.flatMap(a=>B(a.id)):"id"in i&&i.id&&i.id.type==="Identifier"?[i.id.name]:[];for(let a of r)this.facts.exports.push({name:a,local:a,line:s}),this.exportedLocals.add(a)}}else if(t.type==="ExportDefaultDeclaration"){let{line:s}=L(t),i=t.declaration,r="default";i.type==="Identifier"?r=i.name:(i.type==="FunctionDeclaration"||i.type==="ClassDeclaration")&&i.id?r=i.id.name:i.type==="CallExpression"&&ts.has(M(i.callee)??"")&&i.arguments[0]?.type==="Identifier"&&(r=i.arguments[0].name),this.facts.exports.push({name:"default",local:r,line:s}),this.exportedLocals.add(r)}else t.type==="ExportAllDeclaration"?this.facts.exports.push({name:"*",source:t.source.value,line:L(t).line}):t.type}recordClient(e,t){let s=b(t);if(!s||s.type!=="CallExpression")return!1;let i=M(s.callee)??"",[r,a]=i.split("."),o=s.arguments[0]&&s.arguments[0].type==="ObjectExpression"?s.arguments[0]:null,c=(...f)=>{if(!o)return null;for(let d of o.properties)if(d.type==="ObjectProperty"&&f.includes(v(d.key)??""))return this.staticString(d.value);return null},h=null,l=null;if(this.axiosNames.has(r)&&a==="create"?(h="axios",l=c("baseURL")):this.kyNames.has(r)&&(a==="create"||a==="extend")?(h="ky",l=c("prefixUrl","prefix")):this.ofetchNames.has(r)&&a==="create"?(h="ofetch",l=c("baseURL")):this.openapiFactories.has(i)&&(h="openapi",l=c("baseUrl")),!h)return!1;let u={name:e,kind:h,base:l===null?null:at(l),...L(s)};return this.clientNames.set(e,u),this.facts.clients.push(u),!0}staticString(e){let t=b(e);if(!t)return null;if(t.type==="StringLiteral")return t.value;if(t.type==="TemplateLiteral"&&t.expressions.length===0)return t.quasis.map(s=>s.value.cooked??"").join("");if(t.type==="Identifier"&&t.name in this.facts.consts)return this.facts.consts[t.name];if(t.type==="LogicalExpression"&&(t.operator==="??"||t.operator==="||"))return this.staticString(t.left)??this.staticString(t.right);if(t.type==="BinaryExpression"&&t.operator==="+"){let s=this.staticString(t.left),i=this.staticString(t.right);return s!==null&&i!==null?s+i:null}return null}urlOf(e){let t=b(e);if(!t)return null;let s=this.staticString(t);if(s!==null)return{url:at(s),exact:!0};if(t.type==="TemplateLiteral"){let i="",r=!0;return t.quasis.forEach((a,o)=>{if(i+=a.value.cooked??"",o<t.expressions.length){let c=this.staticString(t.expressions[o]);c!==null?i+=c:(i+="{}",o===0&&i==="{}"&&(r=!1))}}),/[/]/.test(i)?{url:at(i),exact:r}:null}if(t.type==="BinaryExpression"&&t.operator==="+"){let i=this.urlOf(t.left),r=this.urlOf(t.right),a=i?i.url:"{}",o=r?r.url:"{}";if(!i&&!r)return null;let c=`${a}${o.startsWith("/")&&a.endsWith("/")?o.slice(1):o}`;return{url:at(c),exact:!!i&&!!r}}return t.type==="ConditionalExpression"?this.urlOf(t.consequent)??this.urlOf(t.alternate):null}newFunction(e,t,s,i,r,a,o){let{line:c,col:h}=L(i),l={id:e,name:t,kind:s,line:c,col:h,end:i.loc?.end.line??c,exported:r,params:[],bindings:{},calls:[],refs:[],renders:[]};return a&&(l.parent=a),o&&(l.doc=o),l}kindOf(e,t){return/^use[A-Z0-9]/.test(e)?"hook":/^[A-Z]/.test(e)&&Ei(t)?"component":"function"}topLevel(e,t){switch(e.type){case"ImportDeclaration":case"TSInterfaceDeclaration":case"TSTypeAliasDeclaration":case"TSDeclareFunction":case"TSModuleDeclaration":case"TSEnumDeclaration":return;case"ExportNamedDeclaration":e.declaration&&this.topLevelDeclaration(e.declaration,t,e);return;case"ExportDefaultDeclaration":{let s=e.declaration;if(s.type==="FunctionDeclaration"||s.type==="ClassDeclaration")this.topLevelDeclaration(s,t,e);else if(R(b(s))||this.hocFunction(s)){let i=R(b(s))?b(s):this.hocFunction(s),r=this.file.split("/").pop().replace(/\.[^.]+$/,""),a=r==="index"?this.file.split("/").slice(-2,-1)[0]??"default":r;this.analyseFunction("default",a.replace(/[^\w$]/g,"_"),i,!0,void 0,dt(e))}else this.walk(s,[],{fn:t,binding:null,declared:new Set});return}default:this.topLevelDeclaration(e,t,null)}}hocFunction(e){let t=b(e);if(!t||t.type!=="CallExpression")return null;let s=M(t.callee)??"";if(!ts.has(s))return null;let i=b(t.arguments[0]);return R(i)?i:this.hocFunction(i)}topLevelDeclaration(e,t,s){let i={fn:t,binding:null,declared:new Set};if(e.type==="FunctionDeclaration"&&e.id){let r=e.id.name;this.analyseFunction(r,r,e,this.exportedLocals.has(r),void 0,dt(s,e));return}if(e.type==="ClassDeclaration"&&e.id){this.analyseClass(e,dt(s,e));return}if(e.type==="VariableDeclaration"){for(let r of e.declarations){let a=r.init?b(r.init):null;if(r.id.type!=="Identifier"){this.declareBinding(r,i,[]);continue}let o=r.id.name,c=dt(s,e),h=R(a)?a:this.hocFunction(a);if(h){this.analyseFunction(o,o,h,this.exportedLocals.has(o),void 0,c);continue}if(a&&a.type==="ObjectExpression"){for(let u of this.functionValues(a))this.skip.add(u);this.objectMethods(o,a,void 0)}let l=this.staticString(a);if(l!==null&&(this.facts.consts[o]=l),this.recordClient(o,a)){this.walk(a,[],i);continue}a&&a.type==="CallExpression"&&this.tanstackRoute(o,a),this.declareBinding(r,i,[])}return}this.walk(e,[],i)}analyseClass(e,t){let s=e.id?.name??"default",i=M(e.superClass)??"",r=/(^|\.)(Pure)?Component$/.test(i);for(let a of e.body.body)if((a.type==="ClassMethod"||a.type==="ClassPrivateMethod")&&a.kind!=="get"&&a.kind!=="set"){let o=v(a.key)??"method",c=this.analyseFunction(`${s}.${o}`,o,a,this.exportedLocals.has(s),void 0,dt(a)??(o==="render"?t:void 0));c.kind=r&&o==="render"?"component":"method",c.kind==="component"&&(c.id=s)}else if(a.type==="ClassProperty"&&a.value){let o=b(a.value);if(R(o)){let c=v(a.key)??"property",h=this.analyseFunction(`${s}.${c}`,c,o,this.exportedLocals.has(s));h.kind="method"}}}objectMethods(e,t,s){for(let i of t.properties)if(i.type==="ObjectMethod"&&i.kind==="method"){let r=v(i.key);r&&this.analyseFunction(`${e}.${r}`,r,i,s?.exported??this.exportedLocals.has(e),s?.id)}else if(i.type==="ObjectProperty"){let r=v(i.key),a=b(i.value);if(!r||!a)continue;if(R(a))this.analyseFunction(`${e}.${r}`,r,a,s?.exported??this.exportedLocals.has(e),s?.id);else if(s&&a.type==="Identifier"&&s.bindings[a.name]?.kind==="function"){let o=s.bindings[a.name],c={id:`${e}.${r}`,name:r,kind:"function",line:o.line,col:o.col,end:o.line,exported:s.exported,parent:s.id,params:[],bindings:{},calls:s.calls.filter(h=>h.in===a.name).map(h=>({...h,in:void 0})),refs:[...o.refs],renders:[]};this.facts.functions.push(c);for(let h of this.facts.http.filter(l=>l.fn===s.id&&l.in===a.name))this.facts.http.push({...h,fn:c.id,in:void 0})}}}analyseFunction(e,t,s,i,r,a){let o=s.body,c=this.newFunction(e,t,this.kindOf(t,o),s,i,r,a);this.facts.functions.push(c);let h={fn:c,binding:null,declared:new Set};(s.params??[]).forEach((f,d)=>this.declareParam(f,d,c,h));let u=this.returnedObject(o);if(u)for(let f of this.functionValues(u))this.skip.add(f);return this.walk(o,[],h),u&&this.objectMethods(e,u,c),c.refs=[...new Set(c.refs)].slice(0,X*3),c}functionValues(e){let t=[];for(let s of e.properties)s.type==="ObjectMethod"?t.push(s):s.type==="ObjectProperty"&&R(b(s.value))&&t.push(s.value);return t}returnedObject(e){let t=b(e);if(t&&t.type==="ObjectExpression")return t;if(e.type!=="BlockStatement")return null;for(let s=e.body.length-1;s>=0;s--){let i=e.body[s];if(i.type==="ReturnStatement"){let r=b(i.argument);return r&&r.type==="ObjectExpression"?r:null}}return null}declareParam(e,t,s,i){let{line:r,col:a}=L(e),o=s.kind==="component"&&t===0,c=e.type==="AssignmentPattern"?e.left:e;if(c.type==="ObjectPattern"&&o){for(let h of c.properties){if(h.type==="RestElement"){for(let u of B(h.argument))this.addBinding(s,u,{kind:"prop",line:r,col:a,refs:[],calls:[],prop:"..."});continue}let l=v(h.key)??"";for(let u of B(h.value))s.params.push(u),i.declared.add(u),this.addBinding(s,u,{kind:"prop",line:r,col:a,refs:[],calls:[],prop:l!==u?l:void 0})}return}for(let h of B(c))s.params.push(h),i.declared.add(h),this.addBinding(s,h,{kind:o?"prop":"param",line:r,col:a,refs:[],calls:[],prop:o?"*":void 0})}addBinding(e,t,s){t in e.bindings||(e.bindings[t]=s)}declareBinding(e,t,s){let i=e.init?b(e.init):null,{line:r,col:a}=L(e),o=i&&(i.type==="CallExpression"||i.type==="OptionalCallExpression")?M(i.callee)??"":"",c=o.split(".").pop()??"",h=B(e.id),l=d=>R(i)?"function":c==="useState"?d===0?"state":"setter":c==="useReducer"?d===0?"reducer":"setter":c==="useRef"?"ref":c==="useMemo"?"memo":c==="useCallback"?"callback":c==="useContext"?"context":o==="lazy"||o==="React.lazy"||this.lazyNames.has(o)?"lazy":/^use[A-Z0-9]/.test(c)?"hook":"local",u;l(0)==="lazy"&&i&&i.type==="CallExpression"&&(u=this.importSource(i.arguments[0]));let f=t.fn;if(h.forEach((d,y)=>{t.declared.add(d);let P={kind:l(e.id.type==="ArrayPattern"?y:0),line:r,col:a,refs:[],calls:[]};o&&(P.init=o),u&&(P.source=u),this.addBinding(f,d,P)}),i){let d=h.length===1?h[0]:h[0]??null;this.walk(i,[...s,{node:e,key:"init"}],{...t,binding:d})}}importSource(e){let t=b(e);if(!t||!R(t))return;let s,i=r=>{if(!s){if(r.type==="CallExpression"&&r.callee.type==="Import"&&r.arguments[0]?.type==="StringLiteral"){s=r.arguments[0].value;return}if(r.type==="ImportExpression"&&r.source.type==="StringLiteral"){s=r.source.value;return}for(let[,a]of nt(r))i(a)}};return i(t),s}walk(e,t,s){if(!this.skip.has(e)){switch(e.type){case"ImportExpression":{let i=e.source;i.type==="StringLiteral"&&this.facts.dynamicImports.push({source:i.value,line:L(e).line});break}case"VariableDeclarator":this.declareBinding(e,s,t);return;case"FunctionDeclaration":if(e.id){let{line:i,col:r}=L(e);this.addBinding(s.fn,e.id.name,{kind:"function",line:i,col:r,refs:[],calls:[]}),s.declared.add(e.id.name);let a={fn:s.fn,binding:e.id.name,declared:new Set(s.declared)};for(let o of e.params)for(let c of B(o))a.declared.add(c);this.walk(e.body,[...t,{node:e,key:"body"}],a);return}break;case"ArrowFunctionExpression":case"FunctionExpression":case"ObjectMethod":case"ClassMethod":{let i={...s,declared:new Set(s.declared)};for(let r of e.params)for(let a of B(r))i.declared.add(a);this.walk(e.body,[...t,{node:e,key:"body"}],i);return}case"CallExpression":case"OptionalCallExpression":case"NewExpression":this.call(e,t,s);break;case"JSXElement":this.element(e,t,s);return;case"Identifier":this.ref(e.name,e,t,s);return;case"MemberExpression":case"OptionalMemberExpression":{let i=t[t.length-1],r=!(i&&(i.node.type==="MemberExpression"||i.node.type==="OptionalMemberExpression")&&i.key==="object"),a=i&&(i.node.type==="CallExpression"||i.node.type==="OptionalCallExpression")&&i.key==="callee",o=kt(e);if(r&&o&&!a){this.ref(o,e,t,s);return}break}case"TSInterfaceDeclaration":case"TSTypeAliasDeclaration":return}for(let[i,r]of nt(e))this.walk(r,[...t,{node:e,key:i}],s)}}ref(e,t,s,i){let r=s[s.length-1];if(r){let o=r.node.type;if((o==="ObjectProperty"||o==="ClassProperty"||o==="ObjectMethod"||o==="ClassMethod")&&r.key==="key"&&!r.node.computed||(o==="MemberExpression"||o==="OptionalMemberExpression")&&r.key==="property"&&!r.node.computed||o==="LabeledStatement"||o==="BreakStatement"||o==="ContinueStatement"||(o==="CallExpression"||o==="OptionalCallExpression")&&r.key==="callee")return}let a=e.split(".")[0];if(!(i.declared.has(a)&&!(a in i.fn.bindings))&&!(a==="undefined"||a==="this"&&e==="this")&&(i.fn.refs.push(e),i.binding&&i.fn.bindings[i.binding]&&i.binding!==a)){let o=i.fn.bindings[i.binding];o.refs.length<X&&!o.refs.includes(e)&&o.refs.push(e)}}call(e,t,s){let i=M(e.callee),{line:r,col:a}=L(e);if(i&&i!=="import"){let o={callee:i,line:r,col:a};s.binding&&(o.in=s.binding),e.type==="NewExpression"&&(o.isNew=!0);let c=e.arguments[0];if(c){let h=this.staticString(c);if(h!==null)o.args=[h.slice(0,200)];else{let l=this.urlOf(c);l&&(o.args=[l.url])}}for(let h of e.arguments.slice(1)){let l=this.methodOption(h);l&&(o.method=l)}if(s.fn.calls.push(o),s.binding&&s.fn.bindings[s.binding]){let h=s.fn.bindings[s.binding];h.calls.length<X&&!h.calls.includes(i)&&h.calls.push(i)}this.http(e,i,t,s),this.routes(e,i)}}methodOption(e){let t=b(e);if(!t||t.type!=="ObjectExpression")return null;for(let s of t.properties)if(s.type==="ObjectProperty"&&v(s.key)==="method"){let i=this.staticString(s.value);return i?i.toUpperCase():null}return null}http(e,t,s,i){let r=e.arguments,a=t.split("."),o=a[0],c=a.length>1?a[a.length-1]:"",h=a.slice(0,-1).join("."),l=y=>{let P=b(r[y]??null);if(!P||P.type!=="ObjectExpression")return null;for(let C of P.properties)if(C.type==="ObjectProperty"&&v(C.key)==="method"){let S=this.staticString(C.value);return S?S.toUpperCase():"?"}return null},u=(y,P,C,S,w,j)=>{if(this.wrapperFrom(P,y,i,r))return;let _=this.urlOf(P);if(!_)return;let mt=_.url;w&&!/^https?:/i.test(mt)&&(mt=at(`${w.replace(/\/$/,"")}/${mt.replace(/^\//,"")}`));let yt={method:y,url:mt,raw:wi(this.code,e),client:C,...L(e),confidence:_.exact?S:S==="exact"?"inferred":S};i.fn.kind!=="module"&&(yt.fn=i.fn.id),i.binding&&(yt.in=i.binding),j&&(yt.recv=j),this.facts.http.push(yt)};if(e.type==="NewExpression"){t==="EventSource"?u("SSE",r[0]??null,"eventsource","exact",null):t==="WebSocket"&&u("WS",r[0]??null,"websocket","exact",null);return}if(t==="fetch"||t==="window.fetch"||t==="globalThis.fetch"||this.ofetchNames.has(t)){u(l(1)??"GET",r[0]??null,t.includes("fetch")&&!this.ofetchNames.has(t)?"fetch":"ofetch","exact",null);return}let f=this.clientNames.get(h);if(this.axiosNames.has(t)){this.axiosConfig(r,"axios",null,u);return}if(this.axiosNames.has(h)||f?.kind==="axios"){let y=f?.base??null;Pe.includes(c)?u(c.toUpperCase(),r[0]??null,"axios","exact",y):c==="request"&&this.axiosConfig(r,"axios",y,u);return}let d=this.clientNames.get(t);if(d&&d.kind==="axios"){this.axiosConfig(r,"axios",d.base,u);return}if(this.kyNames.has(t)||d?.kind==="ky"){u(l(1)??"GET",r[0]??null,"ky","exact",d?.base??null);return}if(this.kyNames.has(h)||f?.kind==="ky"){Pe.includes(c)&&u(c.toUpperCase(),r[0]??null,"ky","exact",f?.base??null);return}if(Ci.has(c)&&h){let y=f?.kind==="openapi";u(c,r[0]??null,"openapi",y?"exact":"inferred",f?.base??null,y?void 0:o);return}if(h&&Pe.includes(c)){let y=this.extraClients.has(h)||this.extraClients.has(o),P=b(r[0]??null),C=(()=>{let S=this.urlOf(P);return!!S&&(S.url.startsWith("/")||S.url.startsWith("{}/"))})();y&&P?u(c.toUpperCase(),P,"custom","inferred",null,o):C&&!es.has(o)&&!es.has(a[a.length-2])&&u(c.toUpperCase(),P,"unknown","heuristic",null,o);return}if((t==="useSWR"||t==="useSWRImmutable")&&r[0]){let y=this.urlOf(r[0]);y&&y.url.startsWith("/")&&u("GET",r[0],"swr","heuristic",null)}}axiosConfig(e,t,s,i){let r=b(e[0]??null);if(r&&r.type==="ObjectExpression"){let a=null,o="GET";for(let c of r.properties){if(c.type!=="ObjectProperty")continue;let h=v(c.key);h==="url"&&(a=c.value),h==="method"&&(o=(this.staticString(c.value)??"?").toUpperCase())}i(o,a,t,"exact",s)}else i("GET",r,t,"exact",s)}wrapperFrom(e,t,s,i){let r=b(e);if(!r||s.fn.kind==="module")return!1;let a=null,o="";if(r.type==="Identifier")a=r.name;else if(r.type==="TemplateLiteral"&&r.expressions.length===1&&r.expressions[0].type==="Identifier"&&(r.quasis[1]?.value.cooked??"")==="")a=r.expressions[0].name,o=r.quasis[0].value.cooked??"";else if(r.type==="BinaryExpression"&&r.operator==="+"&&b(r.right)?.type==="Identifier"){let f=this.staticString(r.left);f!==null&&(a=b(r.right).name,o=f)}if(!a)return!1;let c=s.fn.params.indexOf(a);if(c<0||!(o===""||!o.endsWith("/")||/^(path|url|uri|endpoint|route|href|input|resource|to)$/i.test(a)))return!1;let l={url:c};o&&(l.prefix=at(o).replace(/\/$/,"")),t!=="?"&&(l.method=t);let u=b(i[1]??null);if(u&&u.type==="ObjectExpression")for(let f of u.properties){if(f.type==="ObjectProperty"&&v(f.key)==="method"){let d=b(f.value);d&&d.type==="Identifier"&&s.fn.params.includes(d.name)&&(l.methodArg=s.fn.params.indexOf(d.name),delete l.method)}if(f.type==="SpreadElement"){let d=b(f.argument);d&&d.type==="Identifier"&&s.fn.params.includes(d.name)&&(l.optionsArg=s.fn.params.indexOf(d.name))}}else u&&u.type==="Identifier"&&s.fn.params.includes(u.name)&&(l.optionsArg=s.fn.params.indexOf(u.name));return s.fn.wrapper=l,!0}element(e,t,s){let i=e.openingElement,r=vt(i.name),{line:a,col:o}=L(i),c=Ii(r),h={line:a,col:o,tag:r,component:c,attrs:[],refs:[],calls:[],conds:[]};s.fn.kind!=="module"&&(h.fn=s.fn.id),this.elementIndex.set(e,h),this.facts.elements.push(h),c&&s.fn.renders.push({tag:r,line:a,col:o});let l=[...t,{node:e,key:"openingElement"}];for(let f of i.attributes){if(f.type==="JSXSpreadAttribute"){let{refs:C,calls:S}=this.collect(f.argument,s);h.attrs.push({name:"...",refs:C,calls:S}),this.walk(f.argument,l,s);continue}let d=f.name.type==="JSXNamespacedName"?`${f.name.namespace.name}:${f.name.name.name}`:f.name.name,y={name:d,refs:[],calls:[]};/^on[A-Z]/.test(d)&&(y.handler=!0);let P=f.value;if(P?.type==="StringLiteral")y.literal=P.value.slice(0,Te);else if(P?.type==="JSXExpressionContainer"&&P.expression.type!=="JSXEmptyExpression"){let C=P.expression,S=this.collect(C,s);y.refs=S.refs,y.calls=S.calls;let w=this.staticString(C);w!==null&&(y.literal=w.slice(0,Te));let j=b(C);j&&j.type==="JSXElement"&&(y.jsx=vt(j.openingElement.name));let _=this.callStrings(C);_.length&&(y.strings=_),this.walk(C,[...l,{node:f,key:"value"}],s)}else P&&(P.type==="JSXElement"||P.type==="JSXFragment")&&this.walk(P,[...l,{node:f,key:"value"}],s);h.attrs.push(y)}let u=[];for(let f of e.children)if(f.type==="JSXText"){let d=f.value.replace(/\s+/g," ").trim();d&&u.push(d)}else if(f.type==="JSXExpressionContainer"&&f.expression.type!=="JSXEmptyExpression"){let d=f.expression,y=this.staticString(d);y!==null&&u.push(y);let P=this.collect(d,s);for(let C of P.refs)!h.refs.includes(C)&&h.refs.length<X&&h.refs.push(C);for(let C of P.calls)!h.calls.includes(C)&&h.calls.length<X&&h.calls.push(C)}u.length&&(h.text=u.join(" ").slice(0,Te)),this.conditions(h,t);for(let[f,d]of nt(e))f!=="openingElement"&&this.walk(d,[...t,{node:e,key:f}],s)}callStrings(e){let t=[],s=i=>{if(!(t.length>=8||i.type==="JSXElement"||i.type==="JSXFragment")){if(i.type==="CallExpression"||i.type==="OptionalCallExpression")for(let r of i.arguments)r.type==="StringLiteral"&&!t.includes(r.value)&&t.push(r.value);for(let[,r]of nt(i))s(r)}};return s(e),t}conditions(e,t){for(let s=t.length-1;s>=0;s--){let{node:i,key:r}=t[s];if(i.type==="JSXElement"){let a=this.elementIndex.get(i);a&&r==="children"&&(e.parent=`${a.line}:${a.col}`);break}if(R(i)||i.type==="ClassMethod"||i.type==="ObjectMethod"){let a=t[s-1];if(a&&(a.node.type==="CallExpression"||a.node.type==="OptionalCallExpression")&&a.key==="arguments"){let o=a.node.callee,c=M(o)??"";if(/\.(map|flatMap)$/.test(c)){let h=kt(o.object);h&&(e.each=h);continue}}break}if(i.type==="LogicalExpression"&&r==="right")for(let a of this.collect(i.left,null).refs)e.conds.includes(a)||e.conds.push(a);else if(i.type==="ConditionalExpression"&&(r==="consequent"||r==="alternate"))for(let a of this.collect(i.test,null).refs)e.conds.includes(a)||e.conds.push(a);else if(i.type==="IfStatement"&&(r==="consequent"||r==="alternate"))for(let a of this.collect(i.test,null).refs)e.conds.includes(a)||e.conds.push(a)}e.conds=e.conds.slice(0,X)}collect(e,t){let s=[],i=[],r=(a,o,c)=>{if(!(a.type==="JSXElement"||a.type==="JSXFragment")){if(R(a)){let h=new Set(c);for(let l of a.params)for(let u of B(l))h.add(u);r(a.body,{node:a,key:"body"},h);return}if(a.type==="CallExpression"||a.type==="OptionalCallExpression"||a.type==="NewExpression"){let h=M(a.callee);h&&!i.includes(h)&&!c.has(h.split(".")[0])&&i.push(h);let l=b(a.callee);l&&l.type!=="Identifier"&&l.type!=="MemberExpression"&&l.type!=="OptionalMemberExpression"?r(l,{node:a,key:"callee"},c):l&&(l.type==="MemberExpression"||l.type==="OptionalMemberExpression")&&r(l.object,{node:l,key:"object"},c);for(let u of a.arguments)r(u,{node:a,key:"arguments"},c);return}if(a.type==="MemberExpression"||a.type==="OptionalMemberExpression"){let h=kt(a);if(h){let l=h.split(".")[0];!c.has(l)&&!s.includes(h)&&s.push(h);return}}if(a.type==="Identifier"){if(o&&o.node.type==="ObjectProperty"&&o.key==="key"&&!o.node.computed||o&&(o.node.type==="MemberExpression"||o.node.type==="OptionalMemberExpression")&&o.key==="property"&&!o.node.computed)return;!c.has(a.name)&&a.name!=="undefined"&&!s.includes(a.name)&&s.push(a.name);return}for(let[h,l]of nt(a))r(l,{node:a,key:h},c)}};return r(e,null,new Set(t?[...t.declared].filter(a=>!(a in t.fn.bindings)):[])),{refs:s.slice(0,X),calls:i.slice(0,X)}}routes(e,t){if(e.type!=="CallExpression")return;let s=t.split(".").pop()??"";if(Ni.has(s)){let i=b(e.arguments[0]);i&&i.type==="ArrayExpression"&&this.routeObjects(i,"");return}if(!(s==="createRoutesFromElements"||s==="createRoutesFromChildren")&&e.callee.type==="CallExpression"){let i=M(e.callee.callee)??"";if(/(^|\.)create(Lazy)?FileRoute$/.test(i)){let r=this.staticString(e.callee.arguments[0]),a=b(e.arguments[0]);if(r!==null){let o={path:r,line:L(e).line,col:L(e).col,router:"tanstack-router"};a&&a.type==="ObjectExpression"&&this.routeComponent(a,o),this.facts.routes.push(o)}}}}routeComponent(e,t){for(let s of e.properties){if(s.type!=="ObjectProperty")continue;let i=v(s.key),r=b(s.value);if(r){if(i==="element"){let a=r.type==="JSXElement"?r:null;a&&(t.component=vt(a.openingElement.name))}else if(i==="Component"||i==="component"){if(r.type==="Identifier"||r.type==="MemberExpression")t.component=M(r)??void 0;else if(r.type==="CallExpression"){let a=this.importSource(r.arguments[0]);a&&(t.lazy=a)}}else if(i==="lazy"){let a=this.importSource(r);a&&(t.lazy=a)}}}}routeObjects(e,t){for(let s of e.elements){let i=b(s);if(!i||i.type!=="ObjectExpression")continue;let r=null,a=!1,o=null;for(let d of i.properties){if(d.type!=="ObjectProperty")continue;let y=v(d.key),P=b(d.value);y==="path"&&(r=this.staticString(P)),y==="index"&&P?.type==="BooleanLiteral"&&(a=P.value),y==="children"&&P?.type==="ArrayExpression"&&(o=P)}let c=Se(t,a?"":r??""),{line:h,col:l}=L(i),u={path:c,line:h,col:l,router:"react-router"};this.routeComponent(i,u),!(o&&o.elements.some(d=>{let y=b(d);return!!y&&y.type==="ObjectExpression"&&y.properties.some(P=>P.type==="ObjectProperty"&&v(P.key)==="index")}))&&(r!==null||a||u.component)&&this.facts.routes.push(u),o&&this.routeObjects(o,c)}}tanstackRoute(e,t){let s=M(t.callee)??"",i=b(t.arguments[0]),r=!1;if(/(^|\.)createRootRoute$/.test(s))r=!0;else if(t.callee.type==="CallExpression"&&/createRootRouteWithContext$/.test(M(t.callee.callee)??""))r=!0;else if(!/(^|\.)createRoute$/.test(s))return;let{line:a,col:o}=L(t),c={path:r?"/":"",line:a,col:o,root:r};if(i&&i.type==="ObjectExpression")for(let h of i.properties){if(h.type!=="ObjectProperty")continue;let l=v(h.key),u=b(h.value);if(u){if(l==="path"&&(c.path=this.staticString(u)??c.path),l==="getParentRoute"&&R(u)){let f=b(u.body);f&&f.type==="Identifier"&&(c.parent=f.name)}l==="component"&&(u.type==="Identifier"?c.component=u.name:u.type==="CallExpression"&&(c.lazy=this.importSource(u.arguments[0])))}}i=null,this.tanstack.set(e,c)}finishTanstack(){let e=(t,s=new Set)=>{let i=this.tanstack.get(t);if(!i||s.has(t)||(s.add(t),i.root))return"";let r=i.parent?e(i.parent,s):"";return Se(r,i.path)};for(let[t,s]of this.tanstack){let i={path:s.root?"/":e(t)||"/",line:s.line,col:s.col,router:"tanstack-router"};s.component&&(i.component=s.component),s.lazy&&(i.lazy=s.lazy),!s.root&&this.facts.routes.push(i)}}jsxRoutes(){let e=new Map,t=new Map(this.facts.elements.map(i=>[`${i.line}:${i.col}`,i])),s=i=>{let r=`${i.line}:${i.col}`;if(e.has(r))return e.get(r);let a="",o=i.parent?t.get(i.parent):void 0;for(;o&&!/(^|\.)Route$/.test(o.tag);)o=o.parent?t.get(o.parent):void 0;o&&(a=s(o));let c=i.attrs.find(u=>u.name==="path")?.literal??"",h=i.attrs.some(u=>u.name==="index"),l=Se(a,h?"":c);return e.set(r,l),l};for(let i of this.facts.elements){if(!/(^|\.)Route$/.test(i.tag))continue;let r={path:s(i),line:i.line,col:i.col,router:"react-router"},a=i.attrs.find(u=>u.name==="element"),o=i.attrs.find(u=>u.name==="Component"||u.name==="component");o&&o.refs[0]?r.component=o.refs[0]:a?.jsx&&(r.component=a.jsx);let c=i.attrs.some(u=>u.name==="path"||u.name==="index"),h=`${i.line}:${i.col}`;!this.facts.elements.some(u=>u.parent===h&&/(^|\.)Route$/.test(u.tag)&&u.attrs.some(f=>f.name==="index"))&&(c||r.component)&&this.facts.routes.push(r)}}};function Se(n,e){if(e.startsWith("/"))return e.replace(/\/{2,}/g,"/");let t=`${n.replace(/\/$/,"")}/${e}`.replace(/\/{2,}/g,"/");return t===""?"/":t.replace(/(.)\/$/,"$1")}function ki(n){let e=/\.(ts|mts|cts)$/.test(n),t=/\.tsx$/.test(n);return e?["typescript","decorators"]:t?["jsx","typescript","decorators"]:["jsx","decorators"]}function Lt(n,e,t={}){let s={schema:1,lang:"js",file:e,lines:n.split(`
|
|
11
|
+
`).length,imports:[],exports:[],functions:[],elements:[],http:[],clients:[],routes:[],consts:{},dynamicImports:[],errors:[]},i;try{i=Ze(n,{sourceType:"module",plugins:ki(e),errorRecovery:!0})}catch(a){let o=a;return s.errors.push({line:o.loc?.line??0,message:`cannot parse: ${o.message}`}),s}for(let a of i.errors??[])s.errors.push({line:a.loc?.line??0,message:a.message});let r=new Ae(n,e,s,t);return r.run(i.program),r.jsxRoutes(),s}function Li(n){try{let e=ss(n.path,"utf8");return JSON.stringify({id:n.id,facts:Lt(e,n.file,n.options??{})})}catch(e){return JSON.stringify({id:n.id,error:e.message})}}async function Di(){let n=vi({input:process.stdin,crlfDelay:1/0});for await(let e of n){if(!e.trim())continue;let t;try{t=JSON.parse(e)}catch{process.stdout.write(JSON.stringify({id:-1,error:"bad request"})+`
|
|
12
|
+
`);continue}process.stdout.write(Li(t)+`
|
|
13
|
+
`)}}var Oi=process.argv[1]&&/extract\.(mjs|js|ts)$/.test(process.argv[1]);if(Oi){let n=process.argv.slice(2);if(n[0]==="--version")process.stdout.write(JSON.stringify({schema:1,version:"0.1.0-dev.0",node:process.version})+`
|
|
14
|
+
`);else if(n[0]==="--worker")Di();else{let e=n.map(t=>Lt(ss(t,"utf8"),t.replace(/\\/g,"/")));process.stdout.write(JSON.stringify(e,null,1)+`
|
|
15
|
+
`)}}export{Lt as extract};
|