@mintlify/cli 4.1.66 → 4.1.68

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.
@@ -0,0 +1,12 @@
1
+ import { createRequire as __mintCreateRequire } from 'node:module';
2
+ import { fileURLToPath as __mintFileURLToPath } from 'node:url';
3
+ import { dirname as __mintDirname } from 'node:path';
4
+ const require = __mintCreateRequire(import.meta.url);
5
+ const __filename = __mintFileURLToPath(import.meta.url);
6
+ const __dirname = __mintDirname(__filename);
7
+ import{o as e,t}from"./rolldown-runtime-CEAe2Uac.js";import{T as n,a as r,c as i,k as a,m as o,p as s,t as c,u as l,v as u}from"./chokidar-BDpb15A5.js";import{N as d,c as f,o as p}from"./micromark-extension-mdxjs-BEBdzW1n.js";import{n as m,t as h}from"./lib-g4r7PSeX.js";import{a as ee,c as te}from"./multi-repo-config-BdcKgu6I.js";import{constants as g}from"node:fs";import _ from"node:os";import{copyFile as ne,lstat as v,mkdir as re,mkdtemp as ie,readFile as y,readdir as b,realpath as ae,rename as oe,rm as x,stat as S,writeFile as C}from"node:fs/promises";import w from"node:path";import{createHash as se}from"node:crypto";const ce=({gitSources:e})=>{let[t,...n]=e;if(t!==void 0)return[t,...n];throw Error(`Deployment must have at least one git source`)},le=e=>{let t=ce(e);return t.find(e=>e.isBase===!0)??t[0]};var T=/* @__PURE__ */ t((e=>{Object.defineProperty(e,"__esModule",{value:!0});function t(e,t){if(e==null)return{};for(var n={},r=Object.keys(e),i,a=0;a<r.length;a++)i=r[a],t.indexOf(i)>=0||(n[i]=e[i]);return n}var n=class{constructor(e,t,n){this.line=void 0,this.column=void 0,this.index=void 0,this.line=e,this.column=t,this.index=n}},r=class{constructor(e,t){this.start=void 0,this.end=void 0,this.filename=void 0,this.identifierName=void 0,this.start=e,this.end=t}};function i(e,t){let{line:r,column:i,index:a}=e;return new n(r,i+t,a+t)}var a={SyntaxError:`BABEL_PARSER_SYNTAX_ERROR`,SourceTypeModuleError:`BABEL_PARSER_SOURCETYPE_MODULE_REQUIRED`};let o=(e,t=e.length-1)=>({get(){return e.reduce((e,t)=>e[t],this)},set(n){e.reduce((e,r,i)=>i===t?e[r]=n:e[r],this)}}),s=(e,t,n)=>Object.keys(n).map(e=>[e,n[e]]).filter(([,e])=>!!e).map(([e,t])=>[e,typeof t==`function`?{value:t,enumerable:!1}:typeof t.reflect==`string`?Object.assign({},t,o(t.reflect.split(`.`))):t]).reduce((e,[t,n])=>Object.defineProperty(e,t,Object.assign({configurable:!0},n)),Object.assign(new e,t));var c={ImportMetaOutsideModule:{message:`import.meta may appear only with 'sourceType: "module"'`,code:a.SourceTypeModuleError},ImportOutsideModule:{message:`'import' and 'export' may appear only with 'sourceType: "module"'`,code:a.SourceTypeModuleError}};let l={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`},u=({type:e,prefix:t})=>e===`UpdateExpression`?l.UpdateExpression[String(t)]:l[e];var d={AccessorIsGenerator:({kind:e})=>`A ${e}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.`,AwaitInUsingBinding:`'await' is not allowed to be used as a name in 'using' declarations.`,AwaitNotInAsyncContext:`'await' is only allowed within async functions and at the top levels of modules.`,AwaitNotInAsyncFunction:`'await' is only allowed within async functions.`,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:e})=>`Missing initializer in ${e} declaration.`,DecoratorArgumentsOutsideParentheses:`Decorator arguments must be moved inside parentheses: use '@(decorator(args))' instead of '@(decorator)(args)'.`,DecoratorBeforeExport:`Decorators must be placed *before* the 'export' keyword. Remove the 'decoratorsBeforeExport: true' option to use the 'export @decorator class {}' syntax.`,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 { ... }'?`,DecoratorExportClass:`Decorators must be placed *after* the 'export' keyword. Remove the 'decoratorsBeforeExport: false' option to use the '@decorator export class {}' syntax.`,DecoratorSemicolon:`Decorators must not be followed by a semicolon.`,DecoratorStaticBlock:`Decorators can't be used with a static block.`,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:e})=>`\`${e}\` 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:e,exportName:t})=>`A string literal cannot be used as an exported binding without \`from\`.\n- Did you mean \`export { '${e}' as '${t}' } from 'some-module'\`?`,ExportDefaultFromAsIdentifier:`'from' is not allowed as an identifier after 'export default'.`,ForInOfLoopInitializer:({type:e})=>`'${e===`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:e})=>`Unsyntactic ${e===`BreakStatement`?`break`:`continue`}.`,IllegalLanguageModeDirective:`Illegal 'use strict' directive in function with non-simple parameter list.`,IllegalReturn:`'return' outside of function.`,ImportBindingIsString:({importName:e})=>`A string literal cannot be used as an imported binding.\n- Did you mean \`import { "${e}" as foo }\`?`,ImportCallArgumentTrailingComma:`Trailing comma is disallowed inside import(...) arguments.`,ImportCallArity:({maxArgumentCount:e})=>`\`import()\` requires exactly ${e===1?`one argument`:`one or two arguments`}.`,ImportCallNotNewExpression:`Cannot use new with import(...).`,ImportCallSpreadArgument:"`...` is not allowed in `import()`.",ImportJSONBindingNotDefault:"A JSON module can only be imported with `default`.",ImportReflectionHasAssertion:"`import module x` cannot have assertions.",ImportReflectionNotBinding:'Only `import module x from "./module"` is valid.',IncompatibleRegExpUVFlags:`The 'u' and 'v' regular expression flags cannot be enabled at the same time.`,InvalidBigIntLiteral:`Invalid BigIntLiteral.`,InvalidCodePoint:`Code point out of bounds.`,InvalidCoverInitializedName:`Invalid shorthand property initializer.`,InvalidDecimal:`Invalid decimal.`,InvalidDigit:({radix:e})=>`Expected number in radix ${e}.`,InvalidEscapeSequence:`Bad character escape sequence.`,InvalidEscapeSequenceTemplate:`Invalid escape sequence in template.`,InvalidEscapedReservedWord:({reservedWord:e})=>`Escape sequence in keyword ${e}.`,InvalidIdentifier:({identifierName:e})=>`Invalid identifier ${e}.`,InvalidLhs:({ancestor:e})=>`Invalid left-hand side in ${u(e)}.`,InvalidLhsBinding:({ancestor:e})=>`Binding invalid left-hand side in ${u(e)}.`,InvalidNumber:`Invalid number.`,InvalidOrMissingExponent:`Floating-point numbers require a valid exponent after the 'e'.`,InvalidOrUnexpectedToken:({unexpected:e})=>`Unexpected character '${e}'.`,InvalidParenthesizedAssignment:`Invalid parenthesized assignment pattern.`,InvalidPrivateFieldResolution:({identifierName:e})=>`Private name #${e} is not defined.`,InvalidPropertyBindingPattern:`Binding member expression.`,InvalidRecordProperty:`Only properties and spread elements are allowed in record definitions.`,InvalidRestAssignmentPattern:`Invalid rest operator's argument.`,LabelRedeclaration:({labelName:e})=>`Label '${e}' is already declared.`,LetInLexicalBinding:`'let' is not allowed to be used as a name in 'let' or 'const' declarations.`,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:e})=>`This experimental syntax requires enabling the parser plugin: ${e.map(e=>JSON.stringify(e)).join(`, `)}.`,MissingOneOfPlugins:({missingPlugin:e})=>`This experimental syntax requires enabling one of the following parser plugin(s): ${e.map(e=>JSON.stringify(e)).join(`, `)}.`,MissingUnicodeEscape:`Expecting Unicode escape sequence \\uXXXX.`,MixingCoalesceWithLogical:`Nullish coalescing operator(??) requires parens when mixing with logical operators.`,ModuleAttributeDifferentFromType:"The only accepted module attribute is `type`.",ModuleAttributeInvalidValue:`Only string literals are allowed as module attribute values.`,ModuleAttributesWithDuplicateKeys:({key:e})=>`Duplicate key "${e}" is not allowed in module attributes.`,ModuleExportNameHasLoneSurrogate:({surrogateCharCode:e})=>`An export name cannot include a lone surrogate, found '\\u${e.toString(16)}'.`,ModuleExportUndefined:({localName:e})=>`Export '${e}' 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:e})=>`Private names are only allowed in property accesses (\`obj.#${e}\`) or in \`in\` expressions (\`#${e} in obj\`).`,PrivateNameRedeclaration:({identifierName:e})=>`Duplicate private name #${e}.`,RecordExpressionBarIncorrectEndSyntaxType:`Record expressions ending with '|}' are only allowed when the 'syntaxType' option of the 'recordAndTuple' plugin is set to 'bar'.`,RecordExpressionBarIncorrectStartSyntaxType:`Record expressions starting with '{|' are only allowed when the 'syntaxType' option of the 'recordAndTuple' plugin is set to 'bar'.`,RecordExpressionHashIncorrectStartSyntaxType:`Record expressions starting with '#{' are only allowed when the 'syntaxType' option of the 'recordAndTuple' plugin is set to 'hash'.`,RecordNoProto:`'__proto__' is not allowed in Record expressions.`,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.`,StaticPrototype:`Classes may not have static property named prototype.`,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.`,TupleExpressionBarIncorrectEndSyntaxType:`Tuple expressions ending with '|]' are only allowed when the 'syntaxType' option of the 'recordAndTuple' plugin is set to 'bar'.`,TupleExpressionBarIncorrectStartSyntaxType:`Tuple expressions starting with '[|' are only allowed when the 'syntaxType' option of the 'recordAndTuple' plugin is set to 'bar'.`,TupleExpressionHashIncorrectStartSyntaxType:`Tuple expressions starting with '#[' are only allowed when the 'syntaxType' option of the 'recordAndTuple' plugin is set to 'hash'.`,UnexpectedArgumentPlaceholder:`Unexpected argument placeholder.`,UnexpectedAwaitAfterPipelineBody:`Unexpected "await" after pipeline body; await must have parentheses in minimal proposal.`,UnexpectedDigitAfterHash:`Unexpected digit after hash token.`,UnexpectedImportExport:`'import' and 'export' may only appear at the top level.`,UnexpectedKeyword:({keyword:e})=>`Unexpected keyword '${e}'.`,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:e})=>`Unexpected reserved word '${e}'.`,UnexpectedSuper:`'super' is only allowed in object methods and classes.`,UnexpectedToken:({expected:e,unexpected:t})=>`Unexpected token${t?` '${t}'.`:``}${e?`, expected "${e}"`:``}`,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`.",UnsupportedBind:`Binding should be performed on object property.`,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:e,onlyValidPropertyName:t})=>`The only valid meta property for ${e} is ${e}.${t}.`,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.`,UsingDeclarationHasBindingPattern:`Using declaration cannot have destructuring patterns.`,VarRedeclaration:({identifierName:e})=>`Identifier '${e}' has already been declared.`,YieldBindingIdentifier:`Can not use 'yield' as identifier inside a generator.`,YieldInParameter:`Yield expression is not allowed in formal parameters.`,ZeroDigitNumericSeparator:`Numeric separator can not be used after leading 0.`},f={StrictDelete:`Deleting local variable in strict mode.`,StrictEvalArguments:({referenceName:e})=>`Assigning to '${e}' in strict mode.`,StrictEvalArgumentsBinding:({bindingName:e})=>`Binding '${e}' 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.`};let p=/* @__PURE__ */ new Set([`ArrowFunctionExpression`,`AssignmentExpression`,`ConditionalExpression`,`YieldExpression`]);var m={PipeBodyIsTighter:`Unexpected yield after pipeline body; any yield expression acting as Hack-style pipe body must be parenthesized due to its loose operator precedence.`,PipeTopicRequiresHackPipes:`Topic reference is used, but the pipelineOperator plugin was not passed a "proposal": "hack" or "smart" option.`,PipeTopicUnbound:`Topic reference is unbound; it must be inside a pipe body.`,PipeTopicUnconfiguredToken:({token:e})=>`Invalid topic token ${e}. In order to use ${e} as a topic reference, the pipelineOperator plugin must be configured with { "proposal": "hack", "topicToken": "${e}" }.`,PipeTopicUnused:`Hack-style pipe body does not contain a topic reference; Hack-style pipes must use topic at least once.`,PipeUnparenthesizedBody:({type:e})=>`Hack-style pipe body cannot be an unparenthesized ${u({type:e})}; please wrap it in parentheses.`,PipelineBodyNoArrow:`Unexpected arrow "=>" after pipeline body; arrow function in pipeline body must be parenthesized.`,PipelineBodySequenceExpression:`Pipeline body may not be a comma-separated sequence expression.`,PipelineHeadSequenceExpression:`Pipeline head should not be a comma-separated sequence expression.`,PipelineTopicUnused:`Pipeline is in topic style but does not use topic reference.`,PrimaryTopicNotAllowed:`Topic reference was used in a lexical context without topic binding.`,PrimaryTopicRequiresSmartPipeline:`Topic reference is used, but the pipelineOperator plugin was not passed a "proposal": "hack" or "smart" option.`};let h=[`toMessage`],ee=[`message`];function te(e){let{toMessage:r}=e,i=t(e,h);return function e({loc:t,details:a}){return s(SyntaxError,Object.assign({},i,{loc:t}),{clone(t={}){let r=t.loc||{};return e({loc:new n(`line`in r?r.line:this.loc.line,`column`in r?r.column:this.loc.column,`index`in r?r.index:this.loc.index),details:Object.assign({},this.details,t.details)})},details:{value:a,enumerable:!1},message:{get(){return`${r(this.details)} (${this.loc.line}:${this.loc.column})`},set(e){Object.defineProperty(this,"message",{value:e})}},pos:{reflect:`loc.index`,enumerable:!0},missingPlugin:`missingPlugin`in a&&{reflect:`details.missingPlugin`,enumerable:!0}})}}function g(e,n){if(Array.isArray(e))return t=>g(t,e[0]);let r={};for(let i of Object.keys(e)){let o=e[i],s=typeof o==`string`?{message:()=>o}:typeof o==`function`?{message:o}:o,{message:c}=s,l=t(s,ee),u=typeof c==`string`?()=>c:c;r[i]=te(Object.assign({code:a.SyntaxError,reasonCode:i,toMessage:u},n?{syntaxPlugin:n}:{},l))}return r}let _=Object.assign({},g(c),g(d),g(f),g`pipelineOperator`(m)),{defineProperty:ne}=Object,v=(e,t)=>ne(e,t,{enumerable:!1,value:e[t]});function re(e){return e.loc.start&&v(e.loc.start,`index`),e.loc.end&&v(e.loc.end,`index`),e}var ie=(e=>class extends e{parse(){let e=re(super.parse());return this.options.tokens&&(e.tokens=e.tokens.map(re)),e}parseRegExpLiteral({pattern:e,flags:t}){let n=null;try{n=new RegExp(e,t)}catch{}let r=this.estreeParseLiteral(n);return r.regex={pattern:e,flags:t},r}parseBigIntLiteral(e){let t;try{t=BigInt(e)}catch{t=null}let n=this.estreeParseLiteral(t);return n.bigint=String(n.value||e),n}parseDecimalLiteral(e){let t=this.estreeParseLiteral(null);return t.decimal=String(t.value||e),t}estreeParseLiteral(e){return this.parseLiteral(e,`Literal`)}parseStringLiteral(e){return this.estreeParseLiteral(e)}parseNumericLiteral(e){return this.estreeParseLiteral(e)}parseNullLiteral(){return this.estreeParseLiteral(null)}parseBooleanLiteral(e){return this.estreeParseLiteral(e)}directiveToStmt(e){let t=e.value;delete e.value,t.type=`Literal`,t.raw=t.extra.raw,t.value=t.extra.expressionValue;let n=e;return n.type=`ExpressionStatement`,n.expression=t,n.directive=t.extra.rawValue,delete t.extra,n}initFunction(e,t){super.initFunction(e,t),e.expression=!1}checkDeclaration(e){e!=null&&this.isObjectProperty(e)?this.checkDeclaration(e.value):super.checkDeclaration(e)}getObjectOrClassMethodParams(e){return e.value.params}isValidDirective(e){var t;return e.type===`ExpressionStatement`&&e.expression.type===`Literal`&&typeof e.expression.value==`string`&&!((t=e.expression.extra)!=null&&t.parenthesized)}parseBlockBody(e,t,n,r,i){super.parseBlockBody(e,t,n,r,i),e.body=e.directives.map(e=>this.directiveToStmt(e)).concat(e.body),delete e.directives}pushClassMethod(e,t,n,r,i,a){this.parseMethod(t,n,r,i,a,`ClassMethod`,!0),t.typeParameters&&(t.value.typeParameters=t.typeParameters,delete t.typeParameters),e.body.push(t)}parsePrivateName(){let e=super.parsePrivateName();return this.getPluginOption(`estree`,`classFeatures`)?this.convertPrivateNameToPrivateIdentifier(e):e}convertPrivateNameToPrivateIdentifier(e){let t=super.getPrivateNameSV(e);return e=e,delete e.id,e.name=t,e.type=`PrivateIdentifier`,e}isPrivateName(e){return this.getPluginOption(`estree`,`classFeatures`)?e.type===`PrivateIdentifier`:super.isPrivateName(e)}getPrivateNameSV(e){return this.getPluginOption(`estree`,`classFeatures`)?e.name:super.getPrivateNameSV(e)}parseLiteral(e,t){let n=super.parseLiteral(e,t);return n.raw=n.extra.raw,delete n.extra,n}parseFunctionBody(e,t,n=!1){super.parseFunctionBody(e,t,n),e.expression=e.body.type!==`BlockStatement`}parseMethod(e,t,n,r,i,a,o=!1){let s=this.startNode();return s.kind=e.kind,s=super.parseMethod(s,t,n,r,i,a,o),s.type=`FunctionExpression`,delete s.kind,e.value=s,a===`ClassPrivateMethod`&&(e.computed=!1),this.finishNode(e,`MethodDefinition`)}parseClassProperty(...e){let t=super.parseClassProperty(...e);return this.getPluginOption(`estree`,`classFeatures`)&&(t.type=`PropertyDefinition`),t}parseClassPrivateProperty(...e){let t=super.parseClassPrivateProperty(...e);return this.getPluginOption(`estree`,`classFeatures`)&&(t.type=`PropertyDefinition`,t.computed=!1),t}parseObjectMethod(e,t,n,r,i){let a=super.parseObjectMethod(e,t,n,r,i);return a&&(a.type=`Property`,a.kind===`method`&&(a.kind=`init`),a.shorthand=!1),a}parseObjectProperty(e,t,n,r){let i=super.parseObjectProperty(e,t,n,r);return i&&(i.kind=`init`,i.type=`Property`),i}isValidLVal(e,t,n){return e===`Property`?`value`:super.isValidLVal(e,t,n)}isAssignable(e,t){return e!=null&&this.isObjectProperty(e)?this.isAssignable(e.value,t):super.isAssignable(e,t)}toAssignable(e,t=!1){if(e!=null&&this.isObjectProperty(e)){let{key:n,value:r}=e;this.isPrivateName(n)&&this.classScope.usePrivateName(this.getPrivateNameSV(n),n.loc.start),this.toAssignable(r,t)}else super.toAssignable(e,t)}toAssignableObjectExpressionProp(e,t,n){e.kind===`get`||e.kind===`set`?this.raise(_.PatternHasAccessor,{at:e.key}):e.method?this.raise(_.PatternHasMethod,{at:e.key}):super.toAssignableObjectExpressionProp(e,t,n)}finishCallExpression(e,t){let n=super.finishCallExpression(e,t);return n.callee.type===`Import`&&(n.type=`ImportExpression`,n.source=n.arguments[0],this.hasPlugin(`importAssertions`)&&(n.attributes=n.arguments[1]??null),delete n.arguments,delete n.callee),n}toReferencedArguments(e){e.type!==`ImportExpression`&&super.toReferencedArguments(e)}parseExport(e,t){let n=this.state.lastTokStartLoc,r=super.parseExport(e,t);switch(r.type){case`ExportAllDeclaration`:r.exported=null;break;case`ExportNamedDeclaration`:r.specifiers.length===1&&r.specifiers[0].type===`ExportNamespaceSpecifier`&&(r.type=`ExportAllDeclaration`,r.exported=r.specifiers[0].exported,delete r.specifiers);case`ExportDefaultDeclaration`:{let{declaration:e}=r;e?.type===`ClassDeclaration`&&e.decorators?.length>0&&e.start===r.start&&this.resetStartLocation(r,n)}}return r}parseSubscript(e,t,n,r){let i=super.parseSubscript(e,t,n,r);if(r.optionalChainMember){if((i.type===`OptionalMemberExpression`||i.type===`OptionalCallExpression`)&&(i.type=i.type.substring(8)),r.stop){let e=this.startNodeAtNode(i);return e.expression=i,this.finishNode(e,`ChainExpression`)}}else(i.type===`MemberExpression`||i.type===`CallExpression`)&&(i.optional=!1);return i}hasPropertyAsPrivateName(e){return e.type===`ChainExpression`&&(e=e.expression),super.hasPropertyAsPrivateName(e)}isObjectProperty(e){return e.type===`Property`&&e.kind===`init`&&!e.method}isObjectMethod(e){return e.method||e.kind===`get`||e.kind===`set`}finishNodeAt(e,t,n){return re(super.finishNodeAt(e,t,n))}resetStartLocation(e,t){super.resetStartLocation(e,t),re(e)}resetEndLocation(e,t=this.state.lastTokEndLoc){super.resetEndLocation(e,t),re(e)}}),y=class{constructor(e,t){this.token=void 0,this.preserveSpace=void 0,this.token=e,this.preserveSpace=!!t}};let b={brace:new y(`{`),j_oTag:new y(`<tag`),j_cTag:new y(`</tag`),j_expr:new y(`<tag>...</tag>`,!0)};b.template=new y("`",!0);var ae=class{constructor(e,t={}){this.label=void 0,this.keyword=void 0,this.beforeExpr=void 0,this.startsExpr=void 0,this.rightAssociative=void 0,this.isLoop=void 0,this.isAssign=void 0,this.prefix=void 0,this.postfix=void 0,this.binop=void 0,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?null:t.binop,this.updateContext=null}};let oe=/* @__PURE__ */ new Map;function x(e,t={}){t.keyword=e;let n=D(e,t);return oe.set(e,n),n}function S(e,t){return D(e,{beforeExpr:!0,binop:t})}let C=-1,w=[],se=[],ce=[],le=[],T=[],E=[];function D(e,t={}){return++C,se.push(e),ce.push(t.binop??-1),le.push(t.beforeExpr??!1),T.push(t.startsExpr??!1),E.push(t.prefix??!1),w.push(new ae(e,t)),C}function O(e,t={}){return++C,oe.set(e,C),se.push(e),ce.push(t.binop??-1),le.push(t.beforeExpr??!1),T.push(t.startsExpr??!1),E.push(t.prefix??!1),w.push(new ae(`name`,t)),C}let k={bracketL:D(`[`,{beforeExpr:!0,startsExpr:!0}),bracketHashL:D(`#[`,{beforeExpr:!0,startsExpr:!0}),bracketBarL:D(`[|`,{beforeExpr:!0,startsExpr:!0}),bracketR:D(`]`),bracketBarR:D(`|]`),braceL:D(`{`,{beforeExpr:!0,startsExpr:!0}),braceBarL:D(`{|`,{beforeExpr:!0,startsExpr:!0}),braceHashL:D(`#{`,{beforeExpr:!0,startsExpr:!0}),braceR:D(`}`),braceBarR:D(`|}`),parenL:D(`(`,{beforeExpr:!0,startsExpr:!0}),parenR:D(`)`),comma:D(`,`,{beforeExpr:!0}),semi:D(`;`,{beforeExpr:!0}),colon:D(`:`,{beforeExpr:!0}),doubleColon:D(`::`,{beforeExpr:!0}),dot:D(`.`),question:D(`?`,{beforeExpr:!0}),questionDot:D(`?.`),arrow:D(`=>`,{beforeExpr:!0}),template:D(`template`),ellipsis:D(`...`,{beforeExpr:!0}),backQuote:D("`",{startsExpr:!0}),dollarBraceL:D("${",{beforeExpr:!0,startsExpr:!0}),templateTail:D("...`",{startsExpr:!0}),templateNonTail:D("...${",{beforeExpr:!0,startsExpr:!0}),at:D(`@`),hash:D(`#`,{startsExpr:!0}),interpreterDirective:D(`#!...`),eq:D(`=`,{beforeExpr:!0,isAssign:!0}),assign:D(`_=`,{beforeExpr:!0,isAssign:!0}),slashAssign:D(`_=`,{beforeExpr:!0,isAssign:!0}),xorAssign:D(`_=`,{beforeExpr:!0,isAssign:!0}),moduloAssign:D(`_=`,{beforeExpr:!0,isAssign:!0}),incDec:D(`++/--`,{prefix:!0,postfix:!0,startsExpr:!0}),bang:D(`!`,{beforeExpr:!0,prefix:!0,startsExpr:!0}),tilde:D(`~`,{beforeExpr:!0,prefix:!0,startsExpr:!0}),doubleCaret:D(`^^`,{startsExpr:!0}),doubleAt:D(`@@`,{startsExpr:!0}),pipeline:S(`|>`,0),nullishCoalescing:S(`??`,1),logicalOR:S(`||`,1),logicalAND:S(`&&`,2),bitwiseOR:S(`|`,3),bitwiseXOR:S(`^`,4),bitwiseAND:S(`&`,5),equality:S(`==/!=/===/!==`,6),lt:S(`</>/<=/>=`,7),gt:S(`</>/<=/>=`,7),relational:S(`</>/<=/>=`,7),bitShift:S(`<</>>/>>>`,8),bitShiftL:S(`<</>>/>>>`,8),bitShiftR:S(`<</>>/>>>`,8),plusMin:D(`+/-`,{beforeExpr:!0,binop:9,prefix:!0,startsExpr:!0}),modulo:D(`%`,{binop:10,startsExpr:!0}),star:D(`*`,{binop:10}),slash:S(`/`,10),exponent:D(`**`,{beforeExpr:!0,binop:11,rightAssociative:!0}),_in:x(`in`,{beforeExpr:!0,binop:7}),_instanceof:x(`instanceof`,{beforeExpr:!0,binop:7}),_break:x(`break`),_case:x(`case`,{beforeExpr:!0}),_catch:x(`catch`),_continue:x(`continue`),_debugger:x(`debugger`),_default:x(`default`,{beforeExpr:!0}),_else:x(`else`,{beforeExpr:!0}),_finally:x(`finally`),_function:x(`function`,{startsExpr:!0}),_if:x(`if`),_return:x(`return`,{beforeExpr:!0}),_switch:x(`switch`),_throw:x(`throw`,{beforeExpr:!0,prefix:!0,startsExpr:!0}),_try:x(`try`),_var:x(`var`),_const:x(`const`),_with:x(`with`),_new:x(`new`,{beforeExpr:!0,startsExpr:!0}),_this:x(`this`,{startsExpr:!0}),_super:x(`super`,{startsExpr:!0}),_class:x(`class`,{startsExpr:!0}),_extends:x(`extends`,{beforeExpr:!0}),_export:x(`export`),_import:x(`import`,{startsExpr:!0}),_null:x(`null`,{startsExpr:!0}),_true:x(`true`,{startsExpr:!0}),_false:x(`false`,{startsExpr:!0}),_typeof:x(`typeof`,{beforeExpr:!0,prefix:!0,startsExpr:!0}),_void:x(`void`,{beforeExpr:!0,prefix:!0,startsExpr:!0}),_delete:x(`delete`,{beforeExpr:!0,prefix:!0,startsExpr:!0}),_do:x(`do`,{isLoop:!0,beforeExpr:!0}),_for:x(`for`,{isLoop:!0}),_while:x(`while`,{isLoop:!0}),_as:O(`as`,{startsExpr:!0}),_assert:O(`assert`,{startsExpr:!0}),_async:O(`async`,{startsExpr:!0}),_await:O(`await`,{startsExpr:!0}),_from:O(`from`,{startsExpr:!0}),_get:O(`get`,{startsExpr:!0}),_let:O(`let`,{startsExpr:!0}),_meta:O(`meta`,{startsExpr:!0}),_of:O(`of`,{startsExpr:!0}),_sent:O(`sent`,{startsExpr:!0}),_set:O(`set`,{startsExpr:!0}),_static:O(`static`,{startsExpr:!0}),_using:O(`using`,{startsExpr:!0}),_yield:O(`yield`,{startsExpr:!0}),_asserts:O(`asserts`,{startsExpr:!0}),_checks:O(`checks`,{startsExpr:!0}),_exports:O(`exports`,{startsExpr:!0}),_global:O(`global`,{startsExpr:!0}),_implements:O(`implements`,{startsExpr:!0}),_intrinsic:O(`intrinsic`,{startsExpr:!0}),_infer:O(`infer`,{startsExpr:!0}),_is:O(`is`,{startsExpr:!0}),_mixins:O(`mixins`,{startsExpr:!0}),_proto:O(`proto`,{startsExpr:!0}),_require:O(`require`,{startsExpr:!0}),_satisfies:O(`satisfies`,{startsExpr:!0}),_keyof:O(`keyof`,{startsExpr:!0}),_readonly:O(`readonly`,{startsExpr:!0}),_unique:O(`unique`,{startsExpr:!0}),_abstract:O(`abstract`,{startsExpr:!0}),_declare:O(`declare`,{startsExpr:!0}),_enum:O(`enum`,{startsExpr:!0}),_module:O(`module`,{startsExpr:!0}),_namespace:O(`namespace`,{startsExpr:!0}),_interface:O(`interface`,{startsExpr:!0}),_type:O(`type`,{startsExpr:!0}),_opaque:O(`opaque`,{startsExpr:!0}),name:D(`name`,{startsExpr:!0}),string:D(`string`,{startsExpr:!0}),num:D(`num`,{startsExpr:!0}),bigint:D(`bigint`,{startsExpr:!0}),decimal:D(`decimal`,{startsExpr:!0}),regexp:D(`regexp`,{startsExpr:!0}),privateName:D(`#name`,{startsExpr:!0}),eof:D(`eof`),jsxName:D(`jsxName`),jsxText:D(`jsxText`,{beforeExpr:!0}),jsxTagStart:D(`jsxTagStart`,{startsExpr:!0}),jsxTagEnd:D(`jsxTagEnd`),placeholder:D(`%%`,{startsExpr:!0})};function A(e){return e>=93&&e<=130}function ue(e){return e<=92}function j(e){return e>=58&&e<=130}function M(e){return e>=58&&e<=134}function de(e){return le[e]}function fe(e){return T[e]}function pe(e){return e>=29&&e<=33}function N(e){return e>=127&&e<=129}function P(e){return e>=90&&e<=92}function F(e){return e>=58&&e<=92}function me(e){return e>=39&&e<=59}function I(e){return e===34}function he(e){return E[e]}function ge(e){return e>=119&&e<=121}function _e(e){return e>=122&&e<=128}function L(e){return se[e]}function R(e){return ce[e]}function ve(e){return e===57}function ye(e){return e>=24&&e<=25}function z(e){return w[e]}w[8].updateContext=e=>{e.pop()},w[5].updateContext=w[7].updateContext=w[23].updateContext=e=>{e.push(b.brace)},w[22].updateContext=e=>{e[e.length-1]===b.template?e.pop():e.push(b.template)},w[140].updateContext=e=>{e.push(b.j_expr,b.j_oTag)};let B=`ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԯԱ-Ֆՙՠ-ֈא-תׯ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࡠ-ࡪࡰ-ࢇࢉ-ࢎࢠ-ࣉऄ-हऽॐक़-ॡॱ-ঀঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱৼਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡૹଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-హఽౘ-ౚౝౠౡಀಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೝೞೠೡೱೲഄ-ഌഎ-ഐഒ-ഺഽൎൔ-ൖൟ-ൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄຆ-ຊຌ-ຣລວ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏽᏸ-ᏽᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜑᜟ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡸᢀ-ᢨᢪᢰ-ᣵᤀ-ᤞᥐ-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭌᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᲀ-ᲈᲐ-ᲺᲽ-Ჿᳩ-ᳬᳮ-ᳳᳵᳶᳺᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕ℘-ℝℤΩℨK-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞ々-〇〡-〩〱-〵〸-〼ぁ-ゖ゛-ゟァ-ヺー-ヿㄅ-ㄯㄱ-ㆎㆠ-ㆿㇰ-ㇿ㐀-䶿一-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚝꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ-ꟊꟐꟑꟓꟕ-ꟙꟲ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꣽꣾꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꧠ-ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꩾ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭩꭰ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ`,be=`‌‍·̀-ͯ·҃-֑҇-ׇֽֿׁׂׅׄؐ-ًؚ-٩ٰۖ-ۜ۟-۪ۤۧۨ-ۭ۰-۹ܑܰ-݊ަ-ް߀-߉߫-߽߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛࢘-࢟࣊-ࣣ࣡-ःऺ-़ा-ॏ॑-ॗॢॣ०-९ঁ-ঃ়া-ৄেৈো-্ৗৢৣ০-৯৾ਁ-ਃ਼ਾ-ੂੇੈੋ-੍ੑ੦-ੱੵઁ-ઃ઼ા-ૅે-ૉો-્ૢૣ૦-૯ૺ-૿ଁ-ଃ଼ା-ୄେୈୋ-୍୕-ୗୢୣ୦-୯ஂா-ூெ-ைொ-்ௗ௦-௯ఀ-ఄ఼ా-ౄె-ైొ-్ౕౖౢౣ౦-౯ಁ-ಃ಼ಾ-ೄೆ-ೈೊ-್ೕೖೢೣ೦-೯ೳഀ-ഃ഻഼ാ-ൄെ-ൈൊ-്ൗൢൣ൦-൯ඁ-ඃ්ා-ුූෘ-ෟ෦-෯ෲෳัิ-ฺ็-๎๐-๙ັິ-ຼ່-໎໐-໙༘༙༠-༩༹༵༷༾༿ཱ-྄྆྇ྍ-ྗྙ-ྼ࿆ါ-ှ၀-၉ၖ-ၙၞ-ၠၢ-ၤၧ-ၭၱ-ၴႂ-ႍႏ-ႝ፝-፟፩-፱ᜒ-᜕ᜲ-᜴ᝒᝓᝲᝳ឴-៓៝០-៩᠋-᠍᠏-᠙ᢩᤠ-ᤫᤰ-᤻᥆-᥏᧐-᧚ᨗ-ᨛᩕ-ᩞ᩠-᩿᩼-᪉᪐-᪙᪰-᪽ᪿ-ᫎᬀ-ᬄ᬴-᭄᭐-᭙᭫-᭳ᮀ-ᮂᮡ-ᮭ᮰-᮹᯦-᯳ᰤ-᰷᱀-᱉᱐-᱙᳐-᳔᳒-᳨᳭᳴᳷-᳹᷀-᷿‿⁀⁔⃐-⃥⃜⃡-⃰⳯-⵿⳱ⷠ-〪ⷿ-゙゚〯꘠-꘩꙯ꙴ-꙽ꚞꚟ꛰꛱ꠂ꠆ꠋꠣ-ꠧ꠬ꢀꢁꢴ-ꣅ꣐-꣙꣠-꣱ꣿ-꤉ꤦ-꤭ꥇ-꥓ꦀ-ꦃ꦳-꧀꧐-꧙ꧥ꧰-꧹ꨩ-ꨶꩃꩌꩍ꩐-꩙ꩻ-ꩽꪰꪲ-ꪴꪷꪸꪾ꪿꫁ꫫ-ꫯꫵ꫶ꯣ-ꯪ꯬꯭꯰-꯹ﬞ︀-️︠-︯︳︴﹍-﹏0-9_`,xe=RegExp(`[`+B+`]`),Se=RegExp(`[`+B+be+`]`);B=be=null;let Ce=[0,11,2,25,2,18,2,1,2,14,3,13,35,122,70,52,268,28,4,48,48,31,14,29,6,37,11,29,3,35,5,7,2,4,43,157,19,35,5,35,5,39,9,51,13,10,2,14,2,6,2,1,2,10,2,14,2,6,2,1,68,310,10,21,11,7,25,5,2,41,2,8,70,5,3,0,2,43,2,1,4,0,3,22,11,22,10,30,66,18,2,1,11,21,11,25,71,55,7,1,65,0,16,3,2,2,2,28,43,28,4,28,36,7,2,27,28,53,11,21,11,18,14,17,111,72,56,50,14,50,14,35,349,41,7,1,79,28,11,0,9,21,43,17,47,20,28,22,13,52,58,1,3,0,14,44,33,24,27,35,30,0,3,0,9,34,4,0,13,47,15,3,22,0,2,0,36,17,2,24,20,1,64,6,2,0,2,3,2,14,2,9,8,46,39,7,3,1,3,21,2,6,2,1,2,4,4,0,19,0,13,4,159,52,19,3,21,2,31,47,21,1,2,0,185,46,42,3,37,47,21,0,60,42,14,0,72,26,38,6,186,43,117,63,32,7,3,0,3,7,2,1,2,23,16,0,2,0,95,7,3,38,17,0,2,0,29,0,11,39,8,0,22,0,12,45,20,0,19,72,264,8,2,36,18,0,50,29,113,6,2,1,2,37,22,0,26,5,2,1,2,31,15,0,328,18,16,0,2,12,2,33,125,0,80,921,103,110,18,195,2637,96,16,1071,18,5,4026,582,8634,568,8,30,18,78,18,29,19,47,17,3,32,20,6,18,689,63,129,74,6,0,67,12,65,1,2,0,29,6135,9,1237,43,8,8936,3,2,6,2,1,2,290,16,0,30,2,3,0,15,3,9,395,2309,106,6,12,4,8,8,9,5991,84,2,70,2,1,3,0,3,1,3,3,2,11,2,0,2,6,2,64,2,3,3,7,2,6,2,27,2,3,2,4,2,0,4,6,2,339,3,24,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,7,1845,30,7,5,262,61,147,44,11,6,17,0,322,29,19,43,485,27,757,6,2,3,2,1,2,14,2,196,60,67,8,0,1205,3,2,26,2,1,2,0,3,0,2,9,2,3,2,0,2,0,7,0,5,0,2,0,2,0,2,2,2,1,2,0,3,0,2,0,2,0,2,0,2,0,2,1,2,0,3,3,2,6,2,3,2,3,2,0,2,9,2,16,6,2,2,4,2,16,4421,42719,33,4153,7,221,3,5761,15,7472,3104,541,1507,4938,6,4191],V=[509,0,227,0,150,4,294,9,1368,2,2,1,6,3,41,2,5,0,166,1,574,3,9,9,370,1,81,2,71,10,50,3,123,2,54,14,32,10,3,1,11,3,46,10,8,0,46,9,7,2,37,13,2,9,6,1,45,0,13,2,49,13,9,3,2,11,83,11,7,0,3,0,158,11,6,9,7,3,56,1,2,6,3,1,3,2,10,0,11,1,3,6,4,4,193,17,10,9,5,0,82,19,13,9,214,6,3,8,28,1,83,16,16,9,82,12,9,9,84,14,5,9,243,14,166,9,71,5,2,1,3,3,2,0,2,1,13,9,120,6,3,6,4,0,29,9,41,6,2,3,9,0,10,10,47,15,406,7,2,7,17,9,57,21,2,13,123,5,4,0,2,1,2,6,2,0,9,9,49,4,2,1,2,4,9,9,330,3,10,1,2,0,49,6,4,4,14,9,5351,0,7,14,13835,9,87,9,39,4,60,6,26,9,1014,0,2,54,8,3,82,0,12,1,19628,1,4706,45,3,22,543,4,4,5,9,7,3,6,31,3,149,2,1418,49,513,54,5,49,9,0,15,0,23,4,2,14,1361,6,2,16,3,6,2,1,2,4,101,0,161,6,10,9,357,0,62,13,499,13,983,6,110,6,6,9,4759,9,787719,239];function we(e,t){let n=65536;for(let r=0,i=t.length;r<i;r+=2){if(n+=t[r],n>e)return!1;if(n+=t[r+1],n>=e)return!0}return!1}function H(e){return e<65?e===36:e<=90?!0:e<97?e===95:e<=122?!0:e<=65535?e>=170&&xe.test(String.fromCharCode(e)):we(e,Ce)}function Te(e){return e<48?e===36:e<58?!0:e<65?!1:e<=90?!0:e<97?e===95:e<=122?!0:e<=65535?e>=170&&Se.test(String.fromCharCode(e)):we(e,Ce)||we(e,V)}let Ee={keyword:/* @__PURE__ */ `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`.split(`.`),strict:[`implements`,`interface`,`let`,`package`,`private`,`protected`,`public`,`static`,`yield`],strictBind:[`eval`,`arguments`]},De=new Set(Ee.keyword),U=new Set(Ee.strict),W=new Set(Ee.strictBind);function Oe(e,t){return t&&e===`await`||e===`enum`}function ke(e,t){return Oe(e,t)||U.has(e)}function Ae(e){return W.has(e)}function je(e,t){return ke(e,t)||Ae(e)}function Me(e){return De.has(e)}function Ne(e,t,n){return e===64&&t===64&&H(n)}let Pe=/* @__PURE__ */ new Set(/* @__PURE__ */ `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`.split(`.`));function Fe(e){return Pe.has(e)}let Ie=2048,Le=4096,Re=8331,ze=8201,Be=1024,Ve=4098;var He=class{constructor(e){this.var=/* @__PURE__ */ new Set,this.lexical=/* @__PURE__ */ new Set,this.functions=/* @__PURE__ */ new Set,this.flags=e}},Ue=class{constructor(e,t){this.parser=void 0,this.scopeStack=[],this.inModule=void 0,this.undefinedExports=/* @__PURE__ */ new Map,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 inClass(){return(this.currentThisScopeFlags()&64)>0}get inClassAndNotInNonArrowFunction(){let e=this.currentThisScopeFlags();return(e&64)>0&&!(e&2)}get inStaticBlock(){for(let e=this.scopeStack.length-1;;e--){let{flags:t}=this.scopeStack[e];if(t&128)return!0;if(t&451)return!1}}get inNonArrowFunction(){return(this.currentThisScopeFlags()&2)>0}get treatFunctionsAsVar(){return this.treatFunctionsAsVarInScope(this.currentScope())}createScope(e){return new He(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,n){let r=this.currentScope();if(t&8||t&16)this.checkRedeclarationInScope(r,e,t,n),t&16?r.functions.add(e):r.lexical.add(e),t&8&&this.maybeExportDefined(r,e);else if(t&4)for(let i=this.scopeStack.length-1;i>=0&&(r=this.scopeStack[i],this.checkRedeclarationInScope(r,e,t,n),r.var.add(e),this.maybeExportDefined(r,e),!(r.flags&387));--i);this.parser.inModule&&r.flags&1&&this.undefinedExports.delete(e)}maybeExportDefined(e,t){this.parser.inModule&&e.flags&1&&this.undefinedExports.delete(t)}checkRedeclarationInScope(e,t,n,r){this.isRedeclaredInScope(e,t,n)&&this.parser.raise(_.VarRedeclaration,{at:r,identifierName:t})}isRedeclaredInScope(e,t,n){return n&1?n&8?e.lexical.has(t)||e.functions.has(t)||e.var.has(t):n&16?e.lexical.has(t)||!this.treatFunctionsAsVarInScope(e)&&e.var.has(t):e.lexical.has(t)&&!(e.flags&8&&e.lexical.values().next().value===t)||!this.treatFunctionsAsVarInScope(e)&&e.functions.has(t):!1}checkLocalExport(e){let{name:t}=e,n=this.scopeStack[0];n.lexical.has(t)||n.var.has(t)||n.functions.has(t)||this.undefinedExports.set(t,e.loc.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&387)return t}}currentThisScopeFlags(){for(let e=this.scopeStack.length-1;;e--){let{flags:t}=this.scopeStack[e];if(t&451&&!(t&4))return t}}},We=class extends He{constructor(...e){super(...e),this.declareFunctions=/* @__PURE__ */ new Set}},Ge=class extends Ue{createScope(e){return new We(e)}declareName(e,t,n){let r=this.currentScope();t&Ie?(this.checkRedeclarationInScope(r,e,t,n),this.maybeExportDefined(r,e),r.declareFunctions.add(e)):super.declareName(e,t,n)}isRedeclaredInScope(e,t,n){return super.isRedeclaredInScope(e,t,n)?!0:n&Ie?!e.declareFunctions.has(t)&&(e.lexical.has(t)||e.functions.has(t)):!1}checkLocalExport(e){this.scopeStack[0].declareFunctions.has(e.name)||super.checkLocalExport(e)}},Ke=class{constructor(){this.sawUnambiguousESM=!1,this.ambiguousScriptDifferentAst=!1}hasPlugin(e){if(typeof e==`string`)return this.plugins.has(e);{let[t,n]=e;if(!this.hasPlugin(t))return!1;let r=this.plugins.get(t);for(let e of Object.keys(n))if(r?.[e]!==n[e])return!1;return!0}}getPluginOption(e,t){return this.plugins.get(e)?.[t]}};function qe(e,t){e.trailingComments===void 0?e.trailingComments=t:e.trailingComments.unshift(...t)}function Je(e,t){e.leadingComments===void 0?e.leadingComments=t:e.leadingComments.unshift(...t)}function Ye(e,t){e.innerComments===void 0?e.innerComments=t:e.innerComments.unshift(...t)}function Xe(e,t,n){let r=null,i=t.length;for(;r===null&&i>0;)r=t[--i];r===null||r.start>n.start?Ye(e,n.comments):qe(r,n.comments)}var Ze=class extends Ke{addComment(e){this.filename&&(e.loc.filename=this.filename),this.state.comments.push(e)}processComment(e){let{commentStack:t}=this.state,n=t.length;if(n===0)return;let r=n-1,i=t[r];i.start===e.end&&(i.leadingNode=e,r--);let{start:a}=e;for(;r>=0;r--){let n=t[r],i=n.end;if(i>a)n.containingNode=e,this.finalizeComment(n),t.splice(r,1);else{i===a&&(n.trailingNode=e);break}}}finalizeComment(e){let{comments:t}=e;if(e.leadingNode!==null||e.trailingNode!==null)e.leadingNode!==null&&qe(e.leadingNode,t),e.trailingNode!==null&&Je(e.trailingNode,t);else{let{containingNode:n,start:r}=e;if(this.input.charCodeAt(r-1)===44)switch(n.type){case`ObjectExpression`:case`ObjectPattern`:case`RecordExpression`:Xe(n,n.properties,e);break;case`CallExpression`:case`OptionalCallExpression`:Xe(n,n.arguments,e);break;case`FunctionDeclaration`:case`FunctionExpression`:case`ArrowFunctionExpression`:case`ObjectMethod`:case`ClassMethod`:case`ClassPrivateMethod`:Xe(n,n.params,e);break;case`ArrayExpression`:case`ArrayPattern`:case`TupleExpression`:Xe(n,n.elements,e);break;case`ExportNamedDeclaration`:case`ImportDeclaration`:Xe(n,n.specifiers,e);break;default:Ye(n,t)}else Ye(n,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:n}=t;if(n===0)return;let r=t[n-1];r.leadingNode===e&&(r.leadingNode=null)}takeSurroundingComments(e,t,n){let{commentStack:r}=this.state,i=r.length;if(i===0)return;let a=i-1;for(;a>=0;a--){let i=r[a],o=i.end;if(i.start===n)i.leadingNode=e;else if(o===t)i.trailingNode=e;else if(o<t)break}}};let Qe=/\r\n?|[\n\u2028\u2029]/,$e=new RegExp(Qe.source,`g`);function et(e){switch(e){case 10:case 13:case 8232:case 8233:return!0;default:return!1}}let tt=/(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g,nt=/* @__PURE__ */ RegExp(`(?=((?:[^\\S\\n\\r\\u2028\\u2029]|\\/\\/.*|\\/\\*.*?\\*\\/)*))\\1(?=[\\n\\r\\u2028\\u2029]|\\/\\*(?!.*?\\*\\/)|$)`,`y`);function rt(e){switch(e){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 it=class e{constructor(){this.strict=void 0,this.curLine=void 0,this.lineStart=void 0,this.startLoc=void 0,this.endLoc=void 0,this.errors=[],this.potentialArrowAt=-1,this.noArrowAt=[],this.noArrowParamsConversionAt=[],this.maybeInArrowParameters=!1,this.inType=!1,this.noAnonFunctionType=!1,this.hasFlowComment=!1,this.isAmbientContext=!1,this.inAbstractClass=!1,this.inDisallowConditionalTypesContext=!1,this.topicContext={maxNumOfResolvableTopics:0,maxTopicIndex:null},this.soloAwait=!1,this.inFSharpPipelineDirectBody=!1,this.labels=[],this.comments=[],this.commentStack=[],this.pos=0,this.type=137,this.value=null,this.start=0,this.end=0,this.lastTokEndLoc=null,this.lastTokStartLoc=null,this.lastTokStart=0,this.context=[b.brace],this.canStartJSXElement=!0,this.containsEsc=!1,this.firstInvalidTemplateEscapePos=null,this.strictErrors=/* @__PURE__ */ new Map,this.tokensLength=0}init({strictMode:e,sourceType:t,startLine:r,startColumn:i}){this.strict=e===!1?!1:e===!0||t===`module`,this.curLine=r,this.lineStart=-i,this.startLoc=this.endLoc=new n(r,i,0)}curPosition(){return new n(this.curLine,this.pos-this.lineStart,this.pos)}clone(t){let n=new e,r=Object.keys(this);for(let e=0,i=r.length;e<i;e++){let i=r[e],a=this[i];!t&&Array.isArray(a)&&(a=a.slice()),n[i]=a}return n}},at=function(e){return e>=48&&e<=57};let ot={decBinOct:/* @__PURE__ */ new Set([46,66,69,79,95,98,101,111]),hex:/* @__PURE__ */ new Set([46,88,95,120])},st={bin:e=>e===48||e===49,oct:e=>e>=48&&e<=55,dec:e=>e>=48&&e<=57,hex:e=>e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102};function ct(e,t,n,r,i,a){let o=n,s=r,c=i,l=``,u=null,d=n,{length:f}=t;for(;;){if(n>=f){a.unterminated(o,s,c),l+=t.slice(d,n);break}let p=t.charCodeAt(n);if(lt(e,p,t,n)){l+=t.slice(d,n);break}if(p===92){l+=t.slice(d,n);let o=ut(t,n,r,i,e===`template`,a);o.ch===null&&!u?u={pos:n,lineStart:r,curLine:i}:l+=o.ch,{pos:n,lineStart:r,curLine:i}=o,d=n}else p===8232||p===8233?(++n,++i,r=n):p===10||p===13?e===`template`?(l+=t.slice(d,n)+`
8
+ `,++n,p===13&&t.charCodeAt(n)===10&&++n,++i,d=r=n):a.unterminated(o,s,c):++n}return{pos:n,str:l,firstInvalidLoc:u,lineStart:r,curLine:i,containsInvalid:!!u}}function lt(e,t,n,r){return e===`template`?t===96||t===36&&n.charCodeAt(r+1)===123:t===(e===`double`?34:39)}function ut(e,t,n,r,i,a){let o=!i;t++;let s=e=>({pos:t,ch:e,lineStart:n,curLine:r}),c=e.charCodeAt(t++);switch(c){case 110:return s(`
9
+ `);case 114:return s(`\r`);case 120:{let i;return{code:i,pos:t}=dt(e,t,n,r,2,!1,o,a),s(i===null?null:String.fromCharCode(i))}case 117:{let i;return{code:i,pos:t}=pt(e,t,n,r,o,a),s(i===null?null:String.fromCodePoint(i))}case 116:return s(` `);case 98:return s(`\b`);case 118:return s(`\v`);case 102:return s(`\f`);case 13:e.charCodeAt(t)===10&&++t;case 10:n=t,++r;case 8232:case 8233:return s(``);case 56:case 57:if(i)return s(null);a.strictNumericEscape(t-1,n,r);default:if(c>=48&&c<=55){let o=t-1,c=e.slice(o,t+2).match(/^[0-7]+/)[0],l=parseInt(c,8);l>255&&(c=c.slice(0,-1),l=parseInt(c,8)),t+=c.length-1;let u=e.charCodeAt(t);if(c!==`0`||u===56||u===57){if(i)return s(null);a.strictNumericEscape(o,n,r)}return s(String.fromCharCode(l))}return s(String.fromCharCode(c))}}function dt(e,t,n,r,i,a,o,s){let c=t,l;return{n:l,pos:t}=ft(e,t,n,r,16,i,a,!1,s,!o),l===null&&(o?s.invalidEscapeSequence(c,n,r):t=c-1),{code:l,pos:t}}function ft(e,t,n,r,i,a,o,s,c,l){let u=t,d=i===16?ot.hex:ot.decBinOct,f=i===16?st.hex:i===10?st.dec:i===8?st.oct:st.bin,p=!1,m=0;for(let u=0,h=a??1/0;u<h;++u){let a=e.charCodeAt(t),u;if(a===95&&s!==`bail`){let i=e.charCodeAt(t-1),a=e.charCodeAt(t+1);if(!s){if(l)return{n:null,pos:t};c.numericSeparatorInEscapeSequence(t,n,r)}else if(Number.isNaN(a)||!f(a)||d.has(i)||d.has(a)){if(l)return{n:null,pos:t};c.unexpectedNumericSeparator(t,n,r)}++t}else{if(u=a>=97?a-97+10:a>=65?a-65+10:at(a)?a-48:1/0,u>=i){if(u<=9&&l)return{n:null,pos:t};if(u<=9&&c.invalidDigit(t,n,r,i))u=0;else if(o)u=0,p=!0;else break}++t,m=m*i+u}}return t===u||a!=null&&t-u!==a||p?{n:null,pos:t}:{n:m,pos:t}}function pt(e,t,n,r,i,a){let o=e.charCodeAt(t),s;if(o===123){if(++t,{code:s,pos:t}=dt(e,t,n,r,e.indexOf(`}`,t)-t,!0,i,a),++t,s!==null&&s>1114111){if(i)a.invalidCodePoint(t,n,r);else return{code:null,pos:t}}}else({code:s,pos:t}=dt(e,t,n,r,4,!1,i,a));return{code:s,pos:t}}let mt=[`at`],ht=[`at`];function gt(e,t,r){return new n(r,e-t,e)}let _t=/* @__PURE__ */ new Set([103,109,115,105,121,117,100,118]);var G=class{constructor(e){this.type=e.type,this.value=e.value,this.start=e.start,this.end=e.end,this.loc=new r(e.startLoc,e.endLoc)}},vt=class extends Ze{constructor(e,t){super(),this.isLookahead=void 0,this.tokens=[],this.errorHandlers_readInt={invalidDigit:(e,t,n,r)=>this.options.errorRecovery?(this.raise(_.InvalidDigit,{at:gt(e,t,n),radix:r}),!0):!1,numericSeparatorInEscapeSequence:this.errorBuilder(_.NumericSeparatorInEscapeSequence),unexpectedNumericSeparator:this.errorBuilder(_.UnexpectedNumericSeparator)},this.errorHandlers_readCodePoint=Object.assign({},this.errorHandlers_readInt,{invalidEscapeSequence:this.errorBuilder(_.InvalidEscapeSequence),invalidCodePoint:this.errorBuilder(_.InvalidCodePoint)}),this.errorHandlers_readStringContents_string=Object.assign({},this.errorHandlers_readCodePoint,{strictNumericEscape:(e,t,n)=>{this.recordStrictModeErrors(_.StrictNumericEscape,{at:gt(e,t,n)})},unterminated:(e,t,n)=>{throw this.raise(_.UnterminatedString,{at:gt(e-1,t,n)})}}),this.errorHandlers_readStringContents_template=Object.assign({},this.errorHandlers_readCodePoint,{strictNumericEscape:this.errorBuilder(_.StrictNumericEscape),unterminated:(e,t,n)=>{throw this.raise(_.UnterminatedTemplate,{at:gt(e,t,n)})}}),this.state=new it,this.state.init(e),this.input=t,this.length=t.length,this.isLookahead=!1}pushToken(e){this.tokens.length=this.state.tokensLength,this.tokens.push(e),++this.state.tokensLength}next(){this.checkKeywordEscapes(),this.options.tokens&&this.pushToken(new G(this.state)),this.state.lastTokStart=this.state.start,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,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){return tt.lastIndex=e,tt.test(this.input)?tt.lastIndex:e}lookaheadCharCode(){return this.input.charCodeAt(this.nextTokenStart())}codePointAtPos(e){let t=this.input.charCodeAt(e);if((t&64512)==55296&&++e<this.input.length){let n=this.input.charCodeAt(e);(n&64512)==56320&&(t=65536+((t&1023)<<10)+(n&1023))}return t}setStrict(e){this.state.strict=e,e&&(this.state.strictErrors.forEach(([e,t])=>this.raise(e,{at:t})),this.state.strictErrors.clear())}curContext(){return this.state.context[this.state.context.length-1]}nextToken(){this.skipSpace(),this.state.start=this.state.pos,this.isLookahead||(this.state.startLoc=this.state.curPosition()),this.state.pos>=this.length?this.finishToken(137):this.getTokenFromCode(this.codePointAtPos(this.state.pos))}skipBlockComment(e){let t;this.isLookahead||(t=this.state.curPosition());let n=this.state.pos,i=this.input.indexOf(e,n+2);if(i===-1)throw this.raise(_.UnterminatedComment,{at:this.state.curPosition()});for(this.state.pos=i+e.length,$e.lastIndex=n+2;$e.test(this.input)&&$e.lastIndex<=i;)++this.state.curLine,this.state.lineStart=$e.lastIndex;if(this.isLookahead)return;let a={type:`CommentBlock`,value:this.input.slice(n+2,i),start:n,end:i+e.length,loc:new r(t,this.state.curPosition())};return this.options.tokens&&this.pushToken(a),a}skipLineComment(e){let t=this.state.pos,n;this.isLookahead||(n=this.state.curPosition());let i=this.input.charCodeAt(this.state.pos+=e);if(this.state.pos<this.length)for(;!et(i)&&++this.state.pos<this.length;)i=this.input.charCodeAt(this.state.pos);if(this.isLookahead)return;let a=this.state.pos,o={type:`CommentLine`,value:this.input.slice(t+e,a),start:t,end:a,loc:new r(n,this.state.curPosition())};return this.options.tokens&&this.pushToken(o),o}skipSpace(){let e=this.state.pos,t=[];loop:for(;this.state.pos<this.length;){let n=this.input.charCodeAt(this.state.pos);switch(n){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 e=this.skipBlockComment(`*/`);e!==void 0&&(this.addComment(e),this.options.attachComment&&t.push(e));break}case 47:{let e=this.skipLineComment(2);e!==void 0&&(this.addComment(e),this.options.attachComment&&t.push(e));break}default:break loop}break;default:if(rt(n))++this.state.pos;else if(n===45&&!this.inModule&&this.options.annexB){let n=this.state.pos;if(this.input.charCodeAt(n+1)===45&&this.input.charCodeAt(n+2)===62&&(e===0||this.state.lineStart>e)){let e=this.skipLineComment(3);e!==void 0&&(this.addComment(e),this.options.attachComment&&t.push(e))}else break loop}else if(n===60&&!this.inModule&&this.options.annexB){let e=this.state.pos;if(this.input.charCodeAt(e+1)===33&&this.input.charCodeAt(e+2)===45&&this.input.charCodeAt(e+3)===45){let e=this.skipLineComment(4);e!==void 0&&(this.addComment(e),this.options.attachComment&&t.push(e))}else break loop}else break loop}}if(t.length>0){let n={start:e,end:this.state.pos,comments:t,leadingNode:null,trailingNode:null,containingNode:null};this.state.commentStack.push(n)}}finishToken(e,t){this.state.end=this.state.pos,this.state.endLoc=this.state.curPosition();let n=this.state.type;this.state.type=e,this.state.value=t,this.isLookahead||this.updateContext(n)}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(_.UnexpectedDigitAfterHash,{at:this.state.curPosition()});if(t===123||t===91&&this.hasPlugin(`recordAndTuple`)){if(this.expectPlugin(`recordAndTuple`),this.getPluginOption(`recordAndTuple`,`syntaxType`)===`bar`)throw this.raise(t===123?_.RecordExpressionHashIncorrectStartSyntaxType:_.TupleExpressionHashIncorrectStartSyntaxType,{at:this.state.curPosition()});this.state.pos+=2,t===123?this.finishToken(7):this.finishToken(1)}else H(t)?(++this.state.pos,this.finishToken(136,this.readWord1(t))):t===92?(++this.state.pos,this.finishToken(136,this.readWord1())):this.finishOp(27,1)}readToken_dot(){let e=this.input.charCodeAt(this.state.pos+1);e>=48&&e<=57?this.readNumber(!0):e===46&&this.input.charCodeAt(this.state.pos+2)===46?(this.state.pos+=3,this.finishToken(21)):(++this.state.pos,this.finishToken(16))}readToken_slash(){this.input.charCodeAt(this.state.pos+1)===61?this.finishOp(31,2):this.finishOp(56,1)}readToken_interpreter(){if(this.state.pos!==0||this.length<2)return!1;let e=this.input.charCodeAt(this.state.pos+1);if(e!==33)return!1;let t=this.state.pos;for(this.state.pos+=1;!et(e)&&++this.state.pos<this.length;)e=this.input.charCodeAt(this.state.pos);let n=this.input.slice(t+2,this.state.pos);return this.finishToken(28,n),!0}readToken_mult_modulo(e){let t=e===42?55:54,n=1,r=this.input.charCodeAt(this.state.pos+1);e===42&&r===42&&(n++,r=this.input.charCodeAt(this.state.pos+2),t=57),r===61&&!this.state.inType&&(n++,t=e===37?33:30),this.finishOp(t,n)}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(30,3):this.finishOp(e===124?41:42,2);else{if(e===124){if(t===62){this.finishOp(39,2);return}if(this.hasPlugin(`recordAndTuple`)&&t===125){if(this.getPluginOption(`recordAndTuple`,`syntaxType`)!==`bar`)throw this.raise(_.RecordExpressionBarIncorrectEndSyntaxType,{at:this.state.curPosition()});this.state.pos+=2,this.finishToken(9);return}if(this.hasPlugin(`recordAndTuple`)&&t===93){if(this.getPluginOption(`recordAndTuple`,`syntaxType`)!==`bar`)throw this.raise(_.TupleExpressionBarIncorrectEndSyntaxType,{at:this.state.curPosition()});this.state.pos+=2,this.finishToken(4);return}}t===61?this.finishOp(30,2):this.finishOp(e===124?43:45,1)}}readToken_caret(){let e=this.input.charCodeAt(this.state.pos+1);if(e===61&&!this.state.inType)this.finishOp(32,2);else if(e===94&&this.hasPlugin([`pipelineOperator`,{proposal:`hack`,topicToken:`^^`}])){if(this.finishOp(37,2),this.input.codePointAt(this.state.pos)===94)throw this.unexpected()}else this.finishOp(44,1)}readToken_atSign(){this.input.charCodeAt(this.state.pos+1)===64&&this.hasPlugin([`pipelineOperator`,{proposal:`hack`,topicToken:`@@`}])?this.finishOp(38,2):this.finishOp(26,1)}readToken_plus_min(e){let t=this.input.charCodeAt(this.state.pos+1);t===e?this.finishOp(34,2):t===61?this.finishOp(30,2):this.finishOp(53,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(30,3);return}this.finishOp(51,2)}else t===61?this.finishOp(49,2):this.finishOp(47,1)}readToken_gt(){let{pos:e}=this.state,t=this.input.charCodeAt(e+1);if(t===62){let t=this.input.charCodeAt(e+2)===62?3:2;if(this.input.charCodeAt(e+t)===61){this.finishOp(30,t+1);return}this.finishOp(52,t)}else t===61?this.finishOp(49,2):this.finishOp(48,1)}readToken_eq_excl(e){let t=this.input.charCodeAt(this.state.pos+1);t===61?this.finishOp(46,this.input.charCodeAt(this.state.pos+2)===61?3:2):e===61&&t===62?(this.state.pos+=2,this.finishToken(19)):this.finishOp(e===61?29:35,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(30,3):this.finishOp(40,2):e===46&&!(t>=48&&t<=57)?(this.state.pos+=2,this.finishToken(18)):(++this.state.pos,this.finishToken(17))}getTokenFromCode(e){switch(e){case 46:this.readToken_dot();return;case 40:++this.state.pos,this.finishToken(10);return;case 41:++this.state.pos,this.finishToken(11);return;case 59:++this.state.pos,this.finishToken(13);return;case 44:++this.state.pos,this.finishToken(12);return;case 91:if(this.hasPlugin(`recordAndTuple`)&&this.input.charCodeAt(this.state.pos+1)===124){if(this.getPluginOption(`recordAndTuple`,`syntaxType`)!==`bar`)throw this.raise(_.TupleExpressionBarIncorrectStartSyntaxType,{at:this.state.curPosition()});this.state.pos+=2,this.finishToken(2)}else++this.state.pos,this.finishToken(0);return;case 93:++this.state.pos,this.finishToken(3);return;case 123:if(this.hasPlugin(`recordAndTuple`)&&this.input.charCodeAt(this.state.pos+1)===124){if(this.getPluginOption(`recordAndTuple`,`syntaxType`)!==`bar`)throw this.raise(_.RecordExpressionBarIncorrectStartSyntaxType,{at:this.state.curPosition()});this.state.pos+=2,this.finishToken(6)}else++this.state.pos,this.finishToken(5);return;case 125:++this.state.pos,this.finishToken(8);return;case 58:this.hasPlugin(`functionBind`)&&this.input.charCodeAt(this.state.pos+1)===58?this.finishOp(15,2):(++this.state.pos,this.finishToken(14));return;case 63:this.readToken_question();return;case 96:this.readTemplateToken();return;case 48:{let e=this.input.charCodeAt(this.state.pos+1);if(e===120||e===88){this.readRadixNumber(16);return}if(e===111||e===79){this.readRadixNumber(8);return}if(e===98||e===66){this.readRadixNumber(2);return}}case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:this.readNumber(!1);return;case 34:case 39:this.readString(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(36,1);return;case 64:this.readToken_atSign();return;case 35:this.readToken_numberSign();return;case 92:this.readWord();return;default:if(H(e)){this.readWord(e);return}}throw this.raise(_.InvalidOrUnexpectedToken,{at:this.state.curPosition(),unexpected:String.fromCodePoint(e)})}finishOp(e,t){let n=this.input.slice(this.state.pos,this.state.pos+t);this.state.pos+=t,this.finishToken(e,n)}readRegexp(){let e=this.state.startLoc,t=this.state.start+1,n,r,{pos:a}=this.state;for(;;++a){if(a>=this.length)throw this.raise(_.UnterminatedRegExp,{at:i(e,1)});let t=this.input.charCodeAt(a);if(et(t))throw this.raise(_.UnterminatedRegExp,{at:i(e,1)});if(n)n=!1;else{if(t===91)r=!0;else if(t===93&&r)r=!1;else if(t===47&&!r)break;n=t===92}}let o=this.input.slice(t,a);++a;let s=``,c=()=>i(e,a+2-t);for(;a<this.length;){let e=this.codePointAtPos(a),t=String.fromCharCode(e);if(_t.has(e))e===118?(this.expectPlugin(`regexpUnicodeSets`,c()),s.includes(`u`)&&this.raise(_.IncompatibleRegExpUVFlags,{at:c()})):e===117&&s.includes(`v`)&&this.raise(_.IncompatibleRegExpUVFlags,{at:c()}),s.includes(t)&&this.raise(_.DuplicateRegExpFlags,{at:c()});else if(Te(e)||e===92)this.raise(_.MalformedRegExpFlags,{at:c()});else break;++a,s+=t}this.state.pos=a,this.finishToken(135,{pattern:o,flags:s})}readInt(e,t,n=!1,r=!0){let{n:i,pos:a}=ft(this.input,this.state.pos,this.state.lineStart,this.state.curLine,e,t,n,r,this.errorHandlers_readInt,!1);return this.state.pos=a,i}readRadixNumber(e){let t=this.state.curPosition(),n=!1;this.state.pos+=2;let r=this.readInt(e);r??this.raise(_.InvalidDigit,{at:i(t,2),radix:e});let a=this.input.charCodeAt(this.state.pos);if(a===110)++this.state.pos,n=!0;else if(a===109)throw this.raise(_.InvalidDecimal,{at:t});if(H(this.codePointAtPos(this.state.pos)))throw this.raise(_.NumberIdentifier,{at:this.state.curPosition()});if(n){let e=this.input.slice(t.index,this.state.pos).replace(/[_n]/g,``);this.finishToken(133,e)}else this.finishToken(132,r)}readNumber(e){let t=this.state.pos,n=this.state.curPosition(),r=!1,a=!1,o=!1,s=!1,c=!1;!e&&this.readInt(10)===null&&this.raise(_.InvalidNumber,{at:this.state.curPosition()});let l=this.state.pos-t>=2&&this.input.charCodeAt(t)===48;if(l){let e=this.input.slice(t,this.state.pos);if(this.recordStrictModeErrors(_.StrictOctalLiteral,{at:n}),!this.state.strict){let t=e.indexOf(`_`);t>0&&this.raise(_.ZeroDigitNumericSeparator,{at:i(n,t)})}c=l&&!/[89]/.test(e)}let u=this.input.charCodeAt(this.state.pos);if(u===46&&!c&&(++this.state.pos,this.readInt(10),r=!0,u=this.input.charCodeAt(this.state.pos)),u!==69&&u!==101||c||(u=this.input.charCodeAt(++this.state.pos),(u===43||u===45)&&++this.state.pos,this.readInt(10)===null&&this.raise(_.InvalidOrMissingExponent,{at:n}),r=!0,s=!0,u=this.input.charCodeAt(this.state.pos)),u===110&&((r||l)&&this.raise(_.InvalidBigIntLiteral,{at:n}),++this.state.pos,a=!0),u===109&&(this.expectPlugin(`decimal`,this.state.curPosition()),(s||l)&&this.raise(_.InvalidDecimal,{at:n}),++this.state.pos,o=!0),H(this.codePointAtPos(this.state.pos)))throw this.raise(_.NumberIdentifier,{at:this.state.curPosition()});let d=this.input.slice(t,this.state.pos).replace(/[_mn]/g,``);if(a){this.finishToken(133,d);return}if(o){this.finishToken(134,d);return}let f=c?parseInt(d,8):parseFloat(d);this.finishToken(132,f)}readCodePoint(e){let{code:t,pos:n}=pt(this.input,this.state.pos,this.state.lineStart,this.state.curLine,e,this.errorHandlers_readCodePoint);return this.state.pos=n,t}readString(e){let{str:t,pos:n,curLine:r,lineStart:i}=ct(e===34?`double`:`single`,this.input,this.state.pos+1,this.state.lineStart,this.state.curLine,this.errorHandlers_readStringContents_string);this.state.pos=n+1,this.state.lineStart=i,this.state.curLine=r,this.finishToken(131,t)}readTemplateContinuation(){this.match(8)||this.unexpected(null,8),this.state.pos--,this.readTemplateToken()}readTemplateToken(){let e=this.input[this.state.pos],{str:t,firstInvalidLoc:r,pos:i,curLine:a,lineStart:o}=ct(`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=o,this.state.curLine=a,r&&(this.state.firstInvalidTemplateEscapePos=new n(r.curLine,r.pos-r.lineStart,r.pos)),this.input.codePointAt(i)===96?this.finishToken(24,r?null:e+t+"`"):(this.state.pos++,this.finishToken(25,r?null:e+t+"${"))}recordStrictModeErrors(e,{at:t}){let n=t.index;this.state.strict&&!this.state.strictErrors.has(n)?this.raise(e,{at:t}):this.state.strictErrors.set(n,[e,t])}readWord1(e){this.state.containsEsc=!1;let t=``,n=this.state.pos,r=this.state.pos;for(e!==void 0&&(this.state.pos+=e<=65535?1:2);this.state.pos<this.length;){let e=this.codePointAtPos(this.state.pos);if(Te(e))this.state.pos+=e<=65535?1:2;else if(e===92){this.state.containsEsc=!0,t+=this.input.slice(r,this.state.pos);let e=this.state.curPosition(),i=this.state.pos===n?H:Te;if(this.input.charCodeAt(++this.state.pos)!==117){this.raise(_.MissingUnicodeEscape,{at:this.state.curPosition()}),r=this.state.pos-1;continue}++this.state.pos;let a=this.readCodePoint(!0);a!==null&&(i(a)||this.raise(_.EscapedCharNotAnIdentifier,{at:e}),t+=String.fromCodePoint(a)),r=this.state.pos}else break}return t+this.input.slice(r,this.state.pos)}readWord(e){let t=this.readWord1(e),n=oe.get(t);n===void 0?this.finishToken(130,t):this.finishToken(n,L(n))}checkKeywordEscapes(){let{type:e}=this.state;F(e)&&this.state.containsEsc&&this.raise(_.InvalidEscapedReservedWord,{at:this.state.startLoc,reservedWord:L(e)})}raise(e,r){let{at:i}=r,a=t(r,mt),o=e({loc:i instanceof n?i:i.loc.start,details:a});if(!this.options.errorRecovery)throw o;return this.isLookahead||this.state.errors.push(o),o}raiseOverwrite(e,r){let{at:i}=r,a=t(r,ht),o=i instanceof n?i:i.loc.start,s=o.index,c=this.state.errors;for(let t=c.length-1;t>=0;t--){let n=c[t];if(n.loc.index===s)return c[t]=e({loc:o,details:a});if(n.loc.index<s)break}return this.raise(e,r)}updateContext(e){}unexpected(e,t){throw this.raise(_.UnexpectedToken,{expected:t?L(t):null,at:e??this.state.startLoc})}expectPlugin(e,t){if(this.hasPlugin(e))return!0;throw this.raise(_.MissingPlugin,{at:t??this.state.startLoc,missingPlugin:[e]})}expectOnePlugin(e){if(!e.some(e=>this.hasPlugin(e)))throw this.raise(_.MissingOneOfPlugins,{at:this.state.startLoc,missingPlugin:e})}errorBuilder(e){return(t,n,r)=>{this.raise(e,{at:gt(t,n,r)})}}},yt=class{constructor(){this.privateNames=/* @__PURE__ */ new Set,this.loneAccessors=/* @__PURE__ */ new Map,this.undefinedPrivateNames=/* @__PURE__ */ new Map}},bt=class{constructor(e){this.parser=void 0,this.stack=[],this.undefinedPrivateNames=/* @__PURE__ */ new Map,this.parser=e}current(){return this.stack[this.stack.length-1]}enter(){this.stack.push(new yt)}exit(){let e=this.stack.pop(),t=this.current();for(let[n,r]of Array.from(e.undefinedPrivateNames))t?t.undefinedPrivateNames.has(n)||t.undefinedPrivateNames.set(n,r):this.parser.raise(_.InvalidPrivateFieldResolution,{at:r,identifierName:n})}declarePrivateName(e,t,n){let{privateNames:r,loneAccessors:i,undefinedPrivateNames:a}=this.current(),o=r.has(e);if(t&3){let n=o&&i.get(e);if(n){let r=n&4,a=t&4;o=(n&3)==(t&3)||r!==a,o||i.delete(e)}else o||i.set(e,t)}o&&this.parser.raise(_.PrivateNameRedeclaration,{at:n,identifierName:e}),r.add(e),a.delete(e)}usePrivateName(e,t){let n;for(n of this.stack)if(n.privateNames.has(e))return;n?n.undefinedPrivateNames.set(e,t):this.parser.raise(_.InvalidPrivateFieldResolution,{at:t,identifierName:e})}},xt=class{constructor(e=0){this.type=void 0,this.type=e}canBeArrowParameterDeclaration(){return this.type===2||this.type===1}isCertainlyParameterDeclaration(){return this.type===3}},St=class extends xt{constructor(e){super(e),this.declarationErrors=/* @__PURE__ */ new Map}recordDeclarationError(e,{at:t}){let n=t.index;this.declarationErrors.set(n,[e,t])}clearDeclarationError(e){this.declarationErrors.delete(e)}iterateErrors(e){this.declarationErrors.forEach(e)}},Ct=class{constructor(e){this.parser=void 0,this.stack=[new xt],this.parser=e}enter(e){this.stack.push(e)}exit(){this.stack.pop()}recordParameterInitializerError(e,{at:t}){let n={at:t.loc.start},{stack:r}=this,i=r.length-1,a=r[i];for(;!a.isCertainlyParameterDeclaration();){if(a.canBeArrowParameterDeclaration())a.recordDeclarationError(e,n);else return;a=r[--i]}this.parser.raise(e,n)}recordArrowParameterBindingError(e,{at:t}){let{stack:n}=this,r=n[n.length-1],i={at:t.loc.start};if(r.isCertainlyParameterDeclaration())this.parser.raise(e,i);else if(r.canBeArrowParameterDeclaration())r.recordDeclarationError(e,i);else return}recordAsyncArrowParametersError({at:e}){let{stack:t}=this,n=t.length-1,r=t[n];for(;r.canBeArrowParameterDeclaration();)r.type===2&&r.recordDeclarationError(_.AwaitBindingIdentifier,{at:e}),r=t[--n]}validateAsPattern(){let{stack:e}=this,t=e[e.length-1];t.canBeArrowParameterDeclaration()&&t.iterateErrors(([t,n])=>{this.parser.raise(t,{at:n});let r=e.length-2,i=e[r];for(;i.canBeArrowParameterDeclaration();)i.clearDeclarationError(n.index),i=e[--r]})}};function wt(){return new xt(3)}function Tt(){return new St(1)}function Et(){return new St(2)}function Dt(){return new xt}var Ot=class{constructor(){this.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}};function kt(e,t){return(e?2:0)|!!t}var At=class extends vt{addExtra(e,t,n,r=!0){if(!e)return;let i=e.extra=e.extra||{};r?i[t]=n:Object.defineProperty(i,t,{enumerable:r,value:n})}isContextual(e){return this.state.type===e&&!this.state.containsEsc}isUnparsedContextual(e,t){let n=e+t.length;if(this.input.slice(e,n)===t){let e=this.input.charCodeAt(n);return!(Te(e)||(e&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))throw t==null?this.unexpected(null,e):this.raise(t,{at:this.state.startLoc})}canInsertSemicolon(){return this.match(137)||this.match(8)||this.hasPrecedingLineBreak()}hasPrecedingLineBreak(){return Qe.test(this.input.slice(this.state.lastTokEndLoc.index,this.state.start))}hasFollowingLineBreak(){return nt.lastIndex=this.state.end,nt.test(this.input)}isLineTerminator(){return this.eat(13)||this.canInsertSemicolon()}semicolon(e=!0){(e?this.isLineTerminator():this.eat(13))||this.raise(_.MissingSemicolon,{at:this.state.lastTokEndLoc})}expect(e,t){this.eat(e)||this.unexpected(t,e)}tryParse(e,t=this.state.clone()){let n={node:null};try{let r=e((e=null)=>{throw n.node=e,n});if(this.state.errors.length>t.errors.length){let e=this.state;return this.state=t,this.state.tokensLength=e.tokensLength,{node:r,error:e.errors[t.errors.length],thrown:!1,aborted:!1,failState:e}}return{node:r,error:null,thrown:!1,aborted:!1,failState:null}}catch(e){let r=this.state;if(this.state=t,e instanceof SyntaxError)return{node:null,error:e,thrown:!0,aborted:!1,failState:r};if(e===n)return{node:n.node,error:null,thrown:!1,aborted:!0,failState:r};throw e}}checkExpressionErrors(e,t){if(!e)return!1;let{shorthandAssignLoc:n,doubleProtoLoc:r,privateKeyLoc:i,optionalParametersLoc:a}=e,o=!!n||!!r||!!a||!!i;if(!t)return o;n!=null&&this.raise(_.InvalidCoverInitializedName,{at:n}),r!=null&&this.raise(_.DuplicateProto,{at:r}),i!=null&&this.raise(_.UnexpectedPrivateField,{at:i}),a!=null&&this.unexpected(a)}isLiteralPropertyName(){return M(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 n=this.exportedIdentifiers;this.exportedIdentifiers=/* @__PURE__ */ new Set;let r=this.inModule;this.inModule=e;let i=this.scope,a=this.getScopeHandler();this.scope=new a(this,e);let o=this.prodParam;this.prodParam=new Ot;let s=this.classScope;this.classScope=new bt(this);let c=this.expressionScope;return this.expressionScope=new Ct(this),()=>{this.state.labels=t,this.exportedIdentifiers=n,this.inModule=r,this.scope=i,this.prodParam=o,this.classScope=s,this.expressionScope=c}}enterInitialScopes(){let e=0;this.inModule&&(e|=2),this.scope.enter(1),this.prodParam.enter(e)}checkDestructuringPrivate(e){let{privateKeyLoc:t}=e;t!==null&&this.expectPlugin(`destructuringPrivate`,t)}},jt=class{constructor(){this.shorthandAssignLoc=null,this.doubleProtoLoc=null,this.privateKeyLoc=null,this.optionalParametersLoc=null}},Mt=class{constructor(e,t,n){this.type=``,this.start=t,this.end=0,this.loc=new r(n),e!=null&&e.options.ranges&&(this.range=[t,0]),e!=null&&e.filename&&(this.loc.filename=e.filename)}};let Nt=Mt.prototype;Nt.__clone=function(){let e=new Mt(void 0,this.start,this.loc.start),t=Object.keys(this);for(let n=0,r=t.length;n<r;n++){let r=t[n];r!==`leadingComments`&&r!==`trailingComments`&&r!==`innerComments`&&(e[r]=this[r])}return e};function Pt(e){return K(e)}function K(e){let{type:t,start:n,end:r,loc:i,range:a,extra:o,name:s}=e,c=Object.create(Nt);return c.type=t,c.start=n,c.end=r,c.loc=i,c.range=a,c.extra=o,c.name=s,t===`Placeholder`&&(c.expectedNode=e.expectedNode),c}function Ft(e){let{type:t,start:n,end:r,loc:i,range:a,extra:o}=e;if(t===`Placeholder`)return Pt(e);let s=Object.create(Nt);return s.type=t,s.start=n,s.end=r,s.loc=i,s.range=a,e.raw===void 0?s.extra=o:s.raw=e.raw,s.value=e.value,s}var It=class extends At{startNode(){return new Mt(this,this.state.start,this.state.startLoc)}startNodeAt(e){return new Mt(this,e.index,e)}startNodeAtNode(e){return this.startNodeAt(e.loc.start)}finishNode(e,t){return this.finishNodeAt(e,t,this.state.lastTokEndLoc)}finishNodeAt(e,t,n){return e.type=t,e.end=n.index,e.loc.end=n,this.options.ranges&&(e.range[1]=n.index),this.options.attachComment&&this.processComment(e),e}resetStartLocation(e,t){e.start=t.index,e.loc.start=t,this.options.ranges&&(e.range[0]=t.index)}resetEndLocation(e,t=this.state.lastTokEndLoc){e.end=t.index,e.loc.end=t,this.options.ranges&&(e.range[1]=t.index)}resetStartLocationFromNode(e,t){this.resetStartLocation(e,t.loc.start)}};let Lt=/* @__PURE__ */ new Set([`_`,`any`,`bool`,`boolean`,`empty`,`extends`,`false`,`interface`,`mixed`,`null`,`number`,`static`,`string`,`true`,`typeof`,`void`]),q=g`flow`({AmbiguousConditionalArrow:`Ambiguous expression: wrap the arrow functions in parentheses to disambiguate.`,AmbiguousDeclareModuleKind:"Found both `declare module.exports` and `declare export` in the same module. Modules can only have 1 since they are either an ES module or they are a CommonJS module.",AssignReservedType:({reservedType:e})=>`Cannot overwrite reserved type ${e}.`,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:e,enumName:t})=>`Boolean enum members need to be initialized. Use either \`${e} = true,\` or \`${e} = false,\` in enum \`${t}\`.`,EnumDuplicateMemberName:({memberName:e,enumName:t})=>`Enum member names need to be unique, but the name \`${e}\` has already been used before in enum \`${t}\`.`,EnumInconsistentMemberValues:({enumName:e})=>`Enum \`${e}\` has inconsistent member initializers. Either use no initializers, or consistently use literals (either booleans, numbers, or strings) for all member initializers.`,EnumInvalidExplicitType:({invalidEnumType:e,enumName:t})=>`Enum type \`${e}\` is not valid. Use one of \`boolean\`, \`number\`, \`string\`, or \`symbol\` in enum \`${t}\`.`,EnumInvalidExplicitTypeUnknownSupplied:({enumName:e})=>`Supplied enum type is not valid. Use one of \`boolean\`, \`number\`, \`string\`, or \`symbol\` in enum \`${e}\`.`,EnumInvalidMemberInitializerPrimaryType:({enumName:e,memberName:t,explicitType:n})=>`Enum \`${e}\` has type \`${n}\`, so the initializer of \`${t}\` needs to be a ${n} literal.`,EnumInvalidMemberInitializerSymbolType:({enumName:e,memberName:t})=>`Symbol enum members cannot be initialized. Use \`${t},\` in enum \`${e}\`.`,EnumInvalidMemberInitializerUnknownType:({enumName:e,memberName:t})=>`The enum member initializer for \`${t}\` needs to be a literal (either a boolean, number, or string) in enum \`${e}\`.`,EnumInvalidMemberName:({enumName:e,memberName:t,suggestion:n})=>`Enum member names cannot start with lowercase 'a' through 'z'. Instead of using \`${t}\`, consider using \`${n}\`, in enum \`${e}\`.`,EnumNumberMemberNotInitialized:({enumName:e,memberName:t})=>`Number enum members need to be initialized, e.g. \`${t} = 1\` in enum \`${e}\`.`,EnumStringMemberInconsistentlyInitailized:({enumName:e})=>`String enum members need to consistently either all use initializers, or use no initializers, in enum \`${e}\`.`,GetterMayNotHaveThisParam:"A getter cannot have a `this` parameter.",ImportReflectionHasImportType:"An `import module` declaration can not use `type` or `typeof` keyword.",ImportTypeShorthandOnlyInPureImport:"The `type` and `typeof` keywords on named imports can only be used on regular `import` statements. It cannot be used with `import type` or `import typeof` statements.",InexactInsideExact:`Explicit inexact syntax cannot appear inside an explicit exact object type.`,InexactInsideNonObject:`Explicit inexact syntax cannot appear in class or interface definitions.`,InexactVariance:`Explicit inexact syntax cannot have variance.`,InvalidNonTypeImportInDeclareModule:"Imports within a `declare module` body must always be `import type` or `import typeof`.",MissingTypeParamDefault:`Type parameter declaration needs a default, since a preceding type parameter declaration has a default.`,NestedDeclareModule:"`declare module` cannot be used inside another `declare module`.",NestedFlowComment:`Cannot have a flow comment inside another flow comment.`,PatternIsOptional:Object.assign({message:`A binding pattern parameter cannot be optional in an implementation signature.`},{reasonCode:`OptionalBindingPattern`}),SetterMayNotHaveThisParam:"A setter cannot have a `this` parameter.",SpreadVariance:`Spread properties cannot have variance.`,ThisParamAnnotationRequired:"A type annotation is required for the `this` parameter.",ThisParamBannedInConstructor:"Constructors cannot have a `this` parameter; constructors don't bind `this` like other functions.",ThisParamMayNotBeOptional:"The `this` parameter cannot be optional.",ThisParamMustBeFirst:"The `this` parameter must be the first function parameter.",ThisParamNoDefault:"The `this` parameter may not have a default value.",TypeBeforeInitializer:"Type annotations must come before default assignments, e.g. instead of `age = 25: number` use `age: number = 25`.",TypeCastInPattern:`The type cast expression is expected to be wrapped with parenthesis.`,UnexpectedExplicitInexactInObject:`Explicit inexact syntax must appear at the end of an inexact object.`,UnexpectedReservedType:({reservedType:e})=>`Unexpected reserved type ${e}.`,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:e,suggestion:t})=>`\`declare export ${e}\` is not supported. Use \`${t}\` instead.`,UnsupportedStatementInDeclareModule:`Only declares and type imports are allowed inside declare module.`,UnterminatedFlowComment:`Unterminated flow-comment.`});function Rt(e){return e.type===`DeclareExportAllDeclaration`||e.type===`DeclareExportDeclaration`&&(!e.declaration||e.declaration.type!==`TypeAlias`&&e.declaration.type!==`InterfaceDeclaration`)}function zt(e){return e.importKind===`type`||e.importKind===`typeof`}function Bt(e){return j(e)&&e!==97}let Vt={const:`declare export var`,let:`declare export var`,type:`export type`,interface:`export interface`};function Ht(e,t){let n=[],r=[];for(let i=0;i<e.length;i++)(t(e[i],i,e)?n:r).push(e[i]);return[n,r]}let Ut=/\*?\s*@((?:no)?flow)\b/;var Wt=(e=>class extends e{constructor(...e){super(...e),this.flowPragma=void 0}getScopeHandler(){return Ge}shouldParseTypes(){return this.getPluginOption(`flow`,`all`)||this.flowPragma===`flow`}shouldParseEnums(){return!!this.getPluginOption(`flow`,`enums`)}finishToken(e,t){return e!==131&&e!==13&&e!==28&&this.flowPragma===void 0&&(this.flowPragma=null),super.finishToken(e,t)}addComment(e){if(this.flowPragma===void 0){let t=Ut.exec(e.value);if(t){if(t[1]===`flow`)this.flowPragma=`flow`;else if(t[1]===`noflow`)this.flowPragma=`noflow`;else throw Error(`Unexpected flow pragma`)}}return super.addComment(e)}flowParseTypeInitialiser(e){let t=this.state.inType;this.state.inType=!0,this.expect(e||14);let n=this.flowParseType();return this.state.inType=t,n}flowParsePredicate(){let e=this.startNode(),t=this.state.startLoc;return this.next(),this.expectContextual(108),this.state.lastTokStart>t.index+1&&this.raise(q.UnexpectedSpaceBetweenModuloChecks,{at:t}),this.eat(10)?(e.value=super.parseExpression(),this.expect(11),this.finishNode(e,`DeclaredPredicate`)):this.finishNode(e,`InferredPredicate`)}flowParseTypeAndPredicateInitialiser(){let e=this.state.inType;this.state.inType=!0,this.expect(14);let t=null,n=null;return this.match(54)?(this.state.inType=e,n=this.flowParsePredicate()):(t=this.flowParseType(),this.state.inType=e,this.match(54)&&(n=this.flowParsePredicate())),[t,n]}flowParseDeclareClass(e){return this.next(),this.flowParseInterfaceish(e,!0),this.finishNode(e,`DeclareClass`)}flowParseDeclareFunction(e){this.next();let t=e.id=this.parseIdentifier(),n=this.startNode(),r=this.startNode();n.typeParameters=this.match(47)?this.flowParseTypeParameterDeclaration():null,this.expect(10);let i=this.flowParseFunctionTypeParams();return n.params=i.params,n.rest=i.rest,n.this=i._this,this.expect(11),[n.returnType,e.predicate]=this.flowParseTypeAndPredicateInitialiser(),r.typeAnnotation=this.finishNode(n,`FunctionTypeAnnotation`),t.typeAnnotation=this.finishNode(r,`TypeAnnotation`),this.resetEndLocation(t),this.semicolon(),this.scope.declareName(e.id.name,2048,e.id.loc.start),this.finishNode(e,`DeclareFunction`)}flowParseDeclare(e,t){if(this.match(80))return this.flowParseDeclareClass(e);if(this.match(68))return this.flowParseDeclareFunction(e);if(this.match(74))return this.flowParseDeclareVariable(e);if(this.eatContextual(125))return this.match(16)?this.flowParseDeclareModuleExports(e):(t&&this.raise(q.NestedDeclareModule,{at:this.state.lastTokStartLoc}),this.flowParseDeclareModule(e));if(this.isContextual(128))return this.flowParseDeclareTypeAlias(e);if(this.isContextual(129))return this.flowParseDeclareOpaqueType(e);if(this.isContextual(127))return this.flowParseDeclareInterface(e);if(this.match(82))return this.flowParseDeclareExportDeclaration(e,t);throw this.unexpected()}flowParseDeclareVariable(e){return this.next(),e.id=this.flowParseTypeAnnotatableIdentifier(!0),this.scope.declareName(e.id.name,5,e.id.loc.start),this.semicolon(),this.finishNode(e,`DeclareVariable`)}flowParseDeclareModule(e){this.scope.enter(0),e.id=this.match(131)?super.parseExprAtom():this.parseIdentifier();let t=e.body=this.startNode(),n=t.body=[];for(this.expect(5);!this.match(8);){let e=this.startNode();this.match(83)?(this.next(),!this.isContextual(128)&&!this.match(87)&&this.raise(q.InvalidNonTypeImportInDeclareModule,{at:this.state.lastTokStartLoc}),super.parseImport(e)):(this.expectContextual(123,q.UnsupportedStatementInDeclareModule),e=this.flowParseDeclare(e,!0)),n.push(e)}this.scope.exit(),this.expect(8),this.finishNode(t,`BlockStatement`);let r=null,i=!1;return n.forEach(e=>{Rt(e)?(r===`CommonJS`&&this.raise(q.AmbiguousDeclareModuleKind,{at:e}),r=`ES`):e.type===`DeclareModuleExports`&&(i&&this.raise(q.DuplicateDeclareModuleExports,{at:e}),r===`ES`&&this.raise(q.AmbiguousDeclareModuleKind,{at:e}),r=`CommonJS`,i=!0)}),e.kind=r||`CommonJS`,this.finishNode(e,`DeclareModule`)}flowParseDeclareExportDeclaration(e,t){if(this.expect(82),this.eat(65))return this.match(68)||this.match(80)?e.declaration=this.flowParseDeclare(this.startNode()):(e.declaration=this.flowParseType(),this.semicolon()),e.default=!0,this.finishNode(e,`DeclareExportDeclaration`);if(this.match(75)||this.isLet()||(this.isContextual(128)||this.isContextual(127))&&!t){let e=this.state.value;throw this.raise(q.UnsupportedDeclareExportKind,{at:this.state.startLoc,unsupportedExportKind:e,suggestion:Vt[e]})}if(this.match(74)||this.match(68)||this.match(80)||this.isContextual(129))return e.declaration=this.flowParseDeclare(this.startNode()),e.default=!1,this.finishNode(e,`DeclareExportDeclaration`);if(this.match(55)||this.match(5)||this.isContextual(127)||this.isContextual(128)||this.isContextual(129))return e=this.parseExport(e,null),e.type===`ExportNamedDeclaration`&&(e.type=`ExportDeclaration`,e.default=!1,delete e.exportKind),e.type=`Declare`+e.type,e;throw this.unexpected()}flowParseDeclareModuleExports(e){return this.next(),this.expectContextual(109),e.typeAnnotation=this.flowParseTypeAnnotation(),this.semicolon(),this.finishNode(e,`DeclareModuleExports`)}flowParseDeclareTypeAlias(e){this.next();let t=this.flowParseTypeAlias(e);return t.type=`DeclareTypeAlias`,t}flowParseDeclareOpaqueType(e){this.next();let t=this.flowParseOpaqueType(e,!0);return t.type=`DeclareOpaqueType`,t}flowParseDeclareInterface(e){return this.next(),this.flowParseInterfaceish(e),this.finishNode(e,`DeclareInterface`)}flowParseInterfaceish(e,t=!1){if(e.id=this.flowParseRestrictedIdentifier(!t,!0),this.scope.declareName(e.id.name,t?17:ze,e.id.loc.start),e.typeParameters=this.match(47)?this.flowParseTypeParameterDeclaration():null,e.extends=[],e.implements=[],e.mixins=[],this.eat(81))do e.extends.push(this.flowParseInterfaceExtends());while(!t&&this.eat(12));if(this.isContextual(115)){this.next();do e.mixins.push(this.flowParseInterfaceExtends());while(this.eat(12))}if(this.isContextual(111)){this.next();do e.implements.push(this.flowParseInterfaceExtends());while(this.eat(12))}e.body=this.flowParseObjectType({allowStatic:t,allowExact:!1,allowSpread:!1,allowProto:t,allowInexact:!1})}flowParseInterfaceExtends(){let e=this.startNode();return e.id=this.flowParseQualifiedTypeIdentifier(),e.typeParameters=this.match(47)?this.flowParseTypeParameterInstantiation():null,this.finishNode(e,`InterfaceExtends`)}flowParseInterface(e){return this.flowParseInterfaceish(e),this.finishNode(e,`InterfaceDeclaration`)}checkNotUnderscore(e){e===`_`&&this.raise(q.UnexpectedReservedUnderscore,{at:this.state.startLoc})}checkReservedType(e,t,n){Lt.has(e)&&this.raise(n?q.AssignReservedType:q.UnexpectedReservedType,{at:t,reservedType:e})}flowParseRestrictedIdentifier(e,t){return this.checkReservedType(this.state.value,this.state.startLoc,t),this.parseIdentifier(e)}flowParseTypeAlias(e){return e.id=this.flowParseRestrictedIdentifier(!1,!0),this.scope.declareName(e.id.name,ze,e.id.loc.start),e.typeParameters=this.match(47)?this.flowParseTypeParameterDeclaration():null,e.right=this.flowParseTypeInitialiser(29),this.semicolon(),this.finishNode(e,`TypeAlias`)}flowParseOpaqueType(e,t){return this.expectContextual(128),e.id=this.flowParseRestrictedIdentifier(!0,!0),this.scope.declareName(e.id.name,ze,e.id.loc.start),e.typeParameters=this.match(47)?this.flowParseTypeParameterDeclaration():null,e.supertype=null,this.match(14)&&(e.supertype=this.flowParseTypeInitialiser(14)),e.impltype=null,t||(e.impltype=this.flowParseTypeInitialiser(29)),this.semicolon(),this.finishNode(e,`OpaqueType`)}flowParseTypeParameter(e=!1){let t=this.state.startLoc,n=this.startNode(),r=this.flowParseVariance(),i=this.flowParseTypeAnnotatableIdentifier();return n.name=i.name,n.variance=r,n.bound=i.typeAnnotation,this.match(29)?(this.eat(29),n.default=this.flowParseType()):e&&this.raise(q.MissingTypeParamDefault,{at:t}),this.finishNode(n,`TypeParameter`)}flowParseTypeParameterDeclaration(){let e=this.state.inType,t=this.startNode();t.params=[],this.state.inType=!0,this.match(47)||this.match(140)?this.next():this.unexpected();let n=!1;do{let e=this.flowParseTypeParameter(n);t.params.push(e),e.default&&(n=!0),this.match(48)||this.expect(12)}while(!this.match(48));return this.expect(48),this.state.inType=e,this.finishNode(t,`TypeParameterDeclaration`)}flowParseTypeParameterInstantiation(){let e=this.startNode(),t=this.state.inType;e.params=[],this.state.inType=!0,this.expect(47);let n=this.state.noAnonFunctionType;for(this.state.noAnonFunctionType=!1;!this.match(48);)e.params.push(this.flowParseType()),this.match(48)||this.expect(12);return this.state.noAnonFunctionType=n,this.expect(48),this.state.inType=t,this.finishNode(e,`TypeParameterInstantiation`)}flowParseTypeParameterInstantiationCallOrNew(){let e=this.startNode(),t=this.state.inType;for(e.params=[],this.state.inType=!0,this.expect(47);!this.match(48);)e.params.push(this.flowParseTypeOrImplicitInstantiation()),this.match(48)||this.expect(12);return this.expect(48),this.state.inType=t,this.finishNode(e,`TypeParameterInstantiation`)}flowParseInterfaceType(){let e=this.startNode();if(this.expectContextual(127),e.extends=[],this.eat(81))do e.extends.push(this.flowParseInterfaceExtends());while(this.eat(12));return e.body=this.flowParseObjectType({allowStatic:!1,allowExact:!1,allowSpread:!1,allowProto:!1,allowInexact:!1}),this.finishNode(e,`InterfaceTypeAnnotation`)}flowParseObjectPropertyKey(){return this.match(132)||this.match(131)?super.parseExprAtom():this.parseIdentifier(!0)}flowParseObjectTypeIndexer(e,t,n){return e.static=t,this.lookahead().type===14?(e.id=this.flowParseObjectPropertyKey(),e.key=this.flowParseTypeInitialiser()):(e.id=null,e.key=this.flowParseType()),this.expect(3),e.value=this.flowParseTypeInitialiser(),e.variance=n,this.finishNode(e,`ObjectTypeIndexer`)}flowParseObjectTypeInternalSlot(e,t){return e.static=t,e.id=this.flowParseObjectPropertyKey(),this.expect(3),this.expect(3),this.match(47)||this.match(10)?(e.method=!0,e.optional=!1,e.value=this.flowParseObjectTypeMethodish(this.startNodeAt(e.loc.start))):(e.method=!1,this.eat(17)&&(e.optional=!0),e.value=this.flowParseTypeInitialiser()),this.finishNode(e,`ObjectTypeInternalSlot`)}flowParseObjectTypeMethodish(e){for(e.params=[],e.rest=null,e.typeParameters=null,e.this=null,this.match(47)&&(e.typeParameters=this.flowParseTypeParameterDeclaration()),this.expect(10),this.match(78)&&(e.this=this.flowParseFunctionTypeParam(!0),e.this.name=null,this.match(11)||this.expect(12));!this.match(11)&&!this.match(21);)e.params.push(this.flowParseFunctionTypeParam(!1)),this.match(11)||this.expect(12);return this.eat(21)&&(e.rest=this.flowParseFunctionTypeParam(!1)),this.expect(11),e.returnType=this.flowParseTypeInitialiser(),this.finishNode(e,`FunctionTypeAnnotation`)}flowParseObjectTypeCallProperty(e,t){let n=this.startNode();return e.static=t,e.value=this.flowParseObjectTypeMethodish(n),this.finishNode(e,`ObjectTypeCallProperty`)}flowParseObjectType({allowStatic:e,allowExact:t,allowSpread:n,allowProto:r,allowInexact:i}){let a=this.state.inType;this.state.inType=!0;let o=this.startNode();o.callProperties=[],o.properties=[],o.indexers=[],o.internalSlots=[];let s,c,l=!1;for(t&&this.match(6)?(this.expect(6),s=9,c=!0):(this.expect(5),s=8,c=!1),o.exact=c;!this.match(s);){let t=!1,a=null,s=null,u=this.startNode();if(r&&this.isContextual(116)){let t=this.lookahead();t.type!==14&&t.type!==17&&(this.next(),a=this.state.startLoc,e=!1)}if(e&&this.isContextual(104)){let e=this.lookahead();e.type!==14&&e.type!==17&&(this.next(),t=!0)}let d=this.flowParseVariance();if(this.eat(0))a!=null&&this.unexpected(a),this.eat(0)?(d&&this.unexpected(d.loc.start),o.internalSlots.push(this.flowParseObjectTypeInternalSlot(u,t))):o.indexers.push(this.flowParseObjectTypeIndexer(u,t,d));else if(this.match(10)||this.match(47))a!=null&&this.unexpected(a),d&&this.unexpected(d.loc.start),o.callProperties.push(this.flowParseObjectTypeCallProperty(u,t));else{let e=`init`;(this.isContextual(98)||this.isContextual(103))&&M(this.lookahead().type)&&(e=this.state.value,this.next());let r=this.flowParseObjectTypeProperty(u,t,a,d,e,n,i??!c);r===null?(l=!0,s=this.state.lastTokStartLoc):o.properties.push(r)}this.flowObjectTypeSemicolon(),s&&!this.match(8)&&!this.match(9)&&this.raise(q.UnexpectedExplicitInexactInObject,{at:s})}this.expect(s),n&&(o.inexact=l);let u=this.finishNode(o,`ObjectTypeAnnotation`);return this.state.inType=a,u}flowParseObjectTypeProperty(e,t,n,r,i,a,o){if(this.eat(21))return this.match(12)||this.match(13)||this.match(8)||this.match(9)?(a?o||this.raise(q.InexactInsideExact,{at:this.state.lastTokStartLoc}):this.raise(q.InexactInsideNonObject,{at:this.state.lastTokStartLoc}),r&&this.raise(q.InexactVariance,{at:r}),null):(a||this.raise(q.UnexpectedSpreadType,{at:this.state.lastTokStartLoc}),n!=null&&this.unexpected(n),r&&this.raise(q.SpreadVariance,{at:r}),e.argument=this.flowParseType(),this.finishNode(e,`ObjectTypeSpreadProperty`));{e.key=this.flowParseObjectPropertyKey(),e.static=t,e.proto=n!=null,e.kind=i;let o=!1;return this.match(47)||this.match(10)?(e.method=!0,n!=null&&this.unexpected(n),r&&this.unexpected(r.loc.start),e.value=this.flowParseObjectTypeMethodish(this.startNodeAt(e.loc.start)),(i===`get`||i===`set`)&&this.flowCheckGetterSetterParams(e),!a&&e.key.name===`constructor`&&e.value.this&&this.raise(q.ThisParamBannedInConstructor,{at:e.value.this})):(i!==`init`&&this.unexpected(),e.method=!1,this.eat(17)&&(o=!0),e.value=this.flowParseTypeInitialiser(),e.variance=r),e.optional=o,this.finishNode(e,`ObjectTypeProperty`)}}flowCheckGetterSetterParams(e){let t=e.kind===`get`?0:1,n=e.value.params.length+ +!!e.value.rest;e.value.this&&this.raise(e.kind===`get`?q.GetterMayNotHaveThisParam:q.SetterMayNotHaveThisParam,{at:e.value.this}),n!==t&&this.raise(e.kind===`get`?_.BadGetterArity:_.BadSetterArity,{at:e}),e.kind===`set`&&e.value.rest&&this.raise(_.BadSetterRestParameter,{at:e})}flowObjectTypeSemicolon(){this.eat(13)||this.eat(12)||this.match(8)||this.match(9)||this.unexpected()}flowParseQualifiedTypeIdentifier(e,t){e??=this.state.startLoc;let n=t||this.flowParseRestrictedIdentifier(!0);for(;this.eat(16);){let t=this.startNodeAt(e);t.qualification=n,t.id=this.flowParseRestrictedIdentifier(!0),n=this.finishNode(t,`QualifiedTypeIdentifier`)}return n}flowParseGenericType(e,t){let n=this.startNodeAt(e);return n.typeParameters=null,n.id=this.flowParseQualifiedTypeIdentifier(e,t),this.match(47)&&(n.typeParameters=this.flowParseTypeParameterInstantiation()),this.finishNode(n,`GenericTypeAnnotation`)}flowParseTypeofType(){let e=this.startNode();return this.expect(87),e.argument=this.flowParsePrimaryType(),this.finishNode(e,`TypeofTypeAnnotation`)}flowParseTupleType(){let e=this.startNode();for(e.types=[],this.expect(0);this.state.pos<this.length&&!this.match(3)&&(e.types.push(this.flowParseType()),!this.match(3));)this.expect(12);return this.expect(3),this.finishNode(e,`TupleTypeAnnotation`)}flowParseFunctionTypeParam(e){let t=null,n=!1,r=null,i=this.startNode(),a=this.lookahead(),o=this.state.type===78;return a.type===14||a.type===17?(o&&!e&&this.raise(q.ThisParamMustBeFirst,{at:i}),t=this.parseIdentifier(o),this.eat(17)&&(n=!0,o&&this.raise(q.ThisParamMayNotBeOptional,{at:i})),r=this.flowParseTypeInitialiser()):r=this.flowParseType(),i.name=t,i.optional=n,i.typeAnnotation=r,this.finishNode(i,`FunctionTypeParam`)}reinterpretTypeAsFunctionTypeParam(e){let t=this.startNodeAt(e.loc.start);return t.name=null,t.optional=!1,t.typeAnnotation=e,this.finishNode(t,`FunctionTypeParam`)}flowParseFunctionTypeParams(e=[]){let t=null,n=null;for(this.match(78)&&(n=this.flowParseFunctionTypeParam(!0),n.name=null,this.match(11)||this.expect(12));!this.match(11)&&!this.match(21);)e.push(this.flowParseFunctionTypeParam(!1)),this.match(11)||this.expect(12);return this.eat(21)&&(t=this.flowParseFunctionTypeParam(!1)),{params:e,rest:t,_this:n}}flowIdentToTypeAnnotation(e,t,n){switch(n.name){case`any`:return this.finishNode(t,`AnyTypeAnnotation`);case`bool`:case`boolean`:return this.finishNode(t,`BooleanTypeAnnotation`);case`mixed`:return this.finishNode(t,`MixedTypeAnnotation`);case`empty`:return this.finishNode(t,`EmptyTypeAnnotation`);case`number`:return this.finishNode(t,`NumberTypeAnnotation`);case`string`:return this.finishNode(t,`StringTypeAnnotation`);case`symbol`:return this.finishNode(t,`SymbolTypeAnnotation`);default:return this.checkNotUnderscore(n.name),this.flowParseGenericType(e,n)}}flowParsePrimaryType(){let e=this.state.startLoc,t=this.startNode(),n,r,i=!1,a=this.state.noAnonFunctionType;switch(this.state.type){case 5:return this.flowParseObjectType({allowStatic:!1,allowExact:!1,allowSpread:!0,allowProto:!1,allowInexact:!0});case 6:return this.flowParseObjectType({allowStatic:!1,allowExact:!0,allowSpread:!0,allowProto:!1,allowInexact:!1});case 0:return this.state.noAnonFunctionType=!1,r=this.flowParseTupleType(),this.state.noAnonFunctionType=a,r;case 47:return t.typeParameters=this.flowParseTypeParameterDeclaration(),this.expect(10),n=this.flowParseFunctionTypeParams(),t.params=n.params,t.rest=n.rest,t.this=n._this,this.expect(11),this.expect(19),t.returnType=this.flowParseType(),this.finishNode(t,`FunctionTypeAnnotation`);case 10:if(this.next(),!this.match(11)&&!this.match(21)){if(A(this.state.type)||this.match(78)){let e=this.lookahead().type;i=e!==17&&e!==14}else i=!0}if(i){if(this.state.noAnonFunctionType=!1,r=this.flowParseType(),this.state.noAnonFunctionType=a,this.state.noAnonFunctionType||!(this.match(12)||this.match(11)&&this.lookahead().type===19))return this.expect(11),r;this.eat(12)}return n=r?this.flowParseFunctionTypeParams([this.reinterpretTypeAsFunctionTypeParam(r)]):this.flowParseFunctionTypeParams(),t.params=n.params,t.rest=n.rest,t.this=n._this,this.expect(11),this.expect(19),t.returnType=this.flowParseType(),t.typeParameters=null,this.finishNode(t,`FunctionTypeAnnotation`);case 131:return this.parseLiteral(this.state.value,`StringLiteralTypeAnnotation`);case 85:case 86:return t.value=this.match(85),this.next(),this.finishNode(t,`BooleanLiteralTypeAnnotation`);case 53:if(this.state.value===`-`){if(this.next(),this.match(132))return this.parseLiteralAtNode(-this.state.value,`NumberLiteralTypeAnnotation`,t);if(this.match(133))return this.parseLiteralAtNode(-this.state.value,`BigIntLiteralTypeAnnotation`,t);throw this.raise(q.UnexpectedSubtractionOperand,{at:this.state.startLoc})}throw this.unexpected();case 132:return this.parseLiteral(this.state.value,`NumberLiteralTypeAnnotation`);case 133:return this.parseLiteral(this.state.value,`BigIntLiteralTypeAnnotation`);case 88:return this.next(),this.finishNode(t,`VoidTypeAnnotation`);case 84:return this.next(),this.finishNode(t,`NullLiteralTypeAnnotation`);case 78:return this.next(),this.finishNode(t,`ThisTypeAnnotation`);case 55:return this.next(),this.finishNode(t,`ExistsTypeAnnotation`);case 87:return this.flowParseTypeofType();default:if(F(this.state.type)){let e=L(this.state.type);return this.next(),super.createIdentifier(t,e)}if(A(this.state.type))return this.isContextual(127)?this.flowParseInterfaceType():this.flowIdentToTypeAnnotation(e,t,this.parseIdentifier())}throw this.unexpected()}flowParsePostfixType(){let e=this.state.startLoc,t=this.flowParsePrimaryType(),n=!1;for(;(this.match(0)||this.match(18))&&!this.canInsertSemicolon();){let r=this.startNodeAt(e),i=this.eat(18);n||=i,this.expect(0),!i&&this.match(3)?(r.elementType=t,this.next(),t=this.finishNode(r,`ArrayTypeAnnotation`)):(r.objectType=t,r.indexType=this.flowParseType(),this.expect(3),n?(r.optional=i,t=this.finishNode(r,`OptionalIndexedAccessType`)):t=this.finishNode(r,`IndexedAccessType`))}return t}flowParsePrefixType(){let e=this.startNode();return this.eat(17)?(e.typeAnnotation=this.flowParsePrefixType(),this.finishNode(e,`NullableTypeAnnotation`)):this.flowParsePostfixType()}flowParseAnonFunctionWithoutParens(){let e=this.flowParsePrefixType();if(!this.state.noAnonFunctionType&&this.eat(19)){let t=this.startNodeAt(e.loc.start);return t.params=[this.reinterpretTypeAsFunctionTypeParam(e)],t.rest=null,t.this=null,t.returnType=this.flowParseType(),t.typeParameters=null,this.finishNode(t,`FunctionTypeAnnotation`)}return e}flowParseIntersectionType(){let e=this.startNode();this.eat(45);let t=this.flowParseAnonFunctionWithoutParens();for(e.types=[t];this.eat(45);)e.types.push(this.flowParseAnonFunctionWithoutParens());return e.types.length===1?t:this.finishNode(e,`IntersectionTypeAnnotation`)}flowParseUnionType(){let e=this.startNode();this.eat(43);let t=this.flowParseIntersectionType();for(e.types=[t];this.eat(43);)e.types.push(this.flowParseIntersectionType());return e.types.length===1?t:this.finishNode(e,`UnionTypeAnnotation`)}flowParseType(){let e=this.state.inType;this.state.inType=!0;let t=this.flowParseUnionType();return this.state.inType=e,t}flowParseTypeOrImplicitInstantiation(){if(this.state.type===130&&this.state.value===`_`){let e=this.state.startLoc,t=this.parseIdentifier();return this.flowParseGenericType(e,t)}return this.flowParseType()}flowParseTypeAnnotation(){let e=this.startNode();return e.typeAnnotation=this.flowParseTypeInitialiser(),this.finishNode(e,`TypeAnnotation`)}flowParseTypeAnnotatableIdentifier(e){let t=e?this.parseIdentifier():this.flowParseRestrictedIdentifier();return this.match(14)&&(t.typeAnnotation=this.flowParseTypeAnnotation(),this.resetEndLocation(t)),t}typeCastToParameter(e){return e.expression.typeAnnotation=e.typeAnnotation,this.resetEndLocation(e.expression,e.typeAnnotation.loc.end),e.expression}flowParseVariance(){let e=null;return this.match(53)?(e=this.startNode(),this.state.value===`+`?e.kind=`plus`:e.kind=`minus`,this.next(),this.finishNode(e,`Variance`)):e}parseFunctionBody(e,t,n=!1){return t?this.forwardNoArrowParamsConversionAt(e,()=>super.parseFunctionBody(e,!0,n)):super.parseFunctionBody(e,!1,n)}parseFunctionBodyAndFinish(e,t,n=!1){if(this.match(14)){let t=this.startNode();[t.typeAnnotation,e.predicate]=this.flowParseTypeAndPredicateInitialiser(),e.returnType=t.typeAnnotation?this.finishNode(t,`TypeAnnotation`):null}return super.parseFunctionBodyAndFinish(e,t,n)}parseStatementLike(e){if(this.state.strict&&this.isContextual(127)){if(j(this.lookahead().type)){let e=this.startNode();return this.next(),this.flowParseInterface(e)}}else if(this.shouldParseEnums()&&this.isContextual(124)){let e=this.startNode();return this.next(),this.flowParseEnumDeclaration(e)}let t=super.parseStatementLike(e);return this.flowPragma===void 0&&!this.isValidDirective(t)&&(this.flowPragma=null),t}parseExpressionStatement(e,t,n){if(t.type===`Identifier`){if(t.name===`declare`){if(this.match(80)||A(this.state.type)||this.match(68)||this.match(74)||this.match(82))return this.flowParseDeclare(e)}else if(A(this.state.type)){if(t.name===`interface`)return this.flowParseInterface(e);if(t.name===`type`)return this.flowParseTypeAlias(e);if(t.name===`opaque`)return this.flowParseOpaqueType(e,!1)}}return super.parseExpressionStatement(e,t,n)}shouldParseExportDeclaration(){let{type:e}=this.state;return N(e)||this.shouldParseEnums()&&e===124?!this.state.containsEsc:super.shouldParseExportDeclaration()}isExportDefaultSpecifier(){let{type:e}=this.state;return N(e)||this.shouldParseEnums()&&e===124?this.state.containsEsc:super.isExportDefaultSpecifier()}parseExportDefaultExpression(){if(this.shouldParseEnums()&&this.isContextual(124)){let e=this.startNode();return this.next(),this.flowParseEnumDeclaration(e)}return super.parseExportDefaultExpression()}parseConditional(e,t,n){if(!this.match(17))return e;if(this.state.maybeInArrowParameters){let t=this.lookaheadCharCode();if(t===44||t===61||t===58||t===41)return this.setOptionalParametersError(n),e}this.expect(17);let r=this.state.clone(),i=this.state.noArrowAt,a=this.startNodeAt(t),{consequent:o,failed:s}=this.tryParseConditionalConsequent(),[c,l]=this.getArrowLikeExpressions(o);if(s||l.length>0){let e=[...i];if(l.length>0){this.state=r,this.state.noArrowAt=e;for(let t=0;t<l.length;t++)e.push(l[t].start);({consequent:o,failed:s}=this.tryParseConditionalConsequent()),[c,l]=this.getArrowLikeExpressions(o)}s&&c.length>1&&this.raise(q.AmbiguousConditionalArrow,{at:r.startLoc}),s&&c.length===1&&(this.state=r,e.push(c[0].start),this.state.noArrowAt=e,{consequent:o,failed:s}=this.tryParseConditionalConsequent())}return this.getArrowLikeExpressions(o,!0),this.state.noArrowAt=i,this.expect(14),a.test=e,a.consequent=o,a.alternate=this.forwardNoArrowParamsConversionAt(a,()=>this.parseMaybeAssign(void 0,void 0)),this.finishNode(a,`ConditionalExpression`)}tryParseConditionalConsequent(){this.state.noArrowParamsConversionAt.push(this.state.start);let e=this.parseMaybeAssignAllowIn(),t=!this.match(14);return this.state.noArrowParamsConversionAt.pop(),{consequent:e,failed:t}}getArrowLikeExpressions(e,t){let n=[e],r=[];for(;n.length!==0;){let e=n.pop();e.type===`ArrowFunctionExpression`?(e.typeParameters||!e.returnType?this.finishArrowValidation(e):r.push(e),n.push(e.body)):e.type===`ConditionalExpression`&&(n.push(e.consequent),n.push(e.alternate))}return t?(r.forEach(e=>this.finishArrowValidation(e)),[r,[]]):Ht(r,e=>e.params.every(e=>this.isAssignable(e,!0)))}finishArrowValidation(e){this.toAssignableList(e.params,e.extra?.trailingCommaLoc,!1),this.scope.enter(6),super.checkParams(e,!1,!0),this.scope.exit()}forwardNoArrowParamsConversionAt(e,t){let n;return this.state.noArrowParamsConversionAt.indexOf(e.start)===-1?n=t():(this.state.noArrowParamsConversionAt.push(this.state.start),n=t(),this.state.noArrowParamsConversionAt.pop()),n}parseParenItem(e,t){if(e=super.parseParenItem(e,t),this.eat(17)&&(e.optional=!0,this.resetEndLocation(e)),this.match(14)){let n=this.startNodeAt(t);return n.expression=e,n.typeAnnotation=this.flowParseTypeAnnotation(),this.finishNode(n,`TypeCastExpression`)}return e}assertModuleNodeAllowed(e){e.type===`ImportDeclaration`&&(e.importKind===`type`||e.importKind===`typeof`)||e.type===`ExportNamedDeclaration`&&e.exportKind===`type`||e.type===`ExportAllDeclaration`&&e.exportKind===`type`||super.assertModuleNodeAllowed(e)}parseExport(e,t){let n=super.parseExport(e,t);return(n.type===`ExportNamedDeclaration`||n.type===`ExportAllDeclaration`)&&(n.exportKind=n.exportKind||`value`),n}parseExportDeclaration(e){if(this.isContextual(128)){e.exportKind=`type`;let t=this.startNode();return this.next(),this.match(5)?(e.specifiers=this.parseExportSpecifiers(!0),super.parseExportFrom(e),null):this.flowParseTypeAlias(t)}if(this.isContextual(129)){e.exportKind=`type`;let t=this.startNode();return this.next(),this.flowParseOpaqueType(t,!1)}if(this.isContextual(127)){e.exportKind=`type`;let t=this.startNode();return this.next(),this.flowParseInterface(t)}if(this.shouldParseEnums()&&this.isContextual(124)){e.exportKind=`value`;let t=this.startNode();return this.next(),this.flowParseEnumDeclaration(t)}return super.parseExportDeclaration(e)}eatExportStar(e){return super.eatExportStar(e)?!0:this.isContextual(128)&&this.lookahead().type===55?(e.exportKind=`type`,this.next(),this.next(),!0):!1}maybeParseExportNamespaceSpecifier(e){let{startLoc:t}=this.state,n=super.maybeParseExportNamespaceSpecifier(e);return n&&e.exportKind===`type`&&this.unexpected(t),n}parseClassId(e,t,n){super.parseClassId(e,t,n),this.match(47)&&(e.typeParameters=this.flowParseTypeParameterDeclaration())}parseClassMember(e,t,n){let{startLoc:r}=this.state;if(this.isContextual(123)){if(super.parseClassMemberFromModifier(e,t))return;t.declare=!0}super.parseClassMember(e,t,n),t.declare&&(t.type!==`ClassProperty`&&t.type!==`ClassPrivateProperty`&&t.type!==`PropertyDefinition`?this.raise(q.DeclareClassElement,{at:r}):t.value&&this.raise(q.DeclareClassFieldInitializer,{at:t.value}))}isIterator(e){return e===`iterator`||e===`asyncIterator`}readIterator(){let e=super.readWord1(),t=`@@`+e;this.isIterator(e)&&this.state.inType||this.raise(_.InvalidIdentifier,{at:this.state.curPosition(),identifierName:t}),this.finishToken(130,t)}getTokenFromCode(e){let t=this.input.charCodeAt(this.state.pos+1);return e===123&&t===124?this.finishOp(6,2):this.state.inType&&(e===62||e===60)?this.finishOp(e===62?48:47,1):this.state.inType&&e===63?t===46?this.finishOp(18,2):this.finishOp(17,1):Ne(e,t,this.input.charCodeAt(this.state.pos+2))?(this.state.pos+=2,this.readIterator()):super.getTokenFromCode(e)}isAssignable(e,t){return e.type===`TypeCastExpression`?this.isAssignable(e.expression,t):super.isAssignable(e,t)}toAssignable(e,t=!1){!t&&e.type===`AssignmentExpression`&&e.left.type===`TypeCastExpression`&&(e.left=this.typeCastToParameter(e.left)),super.toAssignable(e,t)}toAssignableList(e,t,n){for(let t=0;t<e.length;t++){let n=e[t];n?.type===`TypeCastExpression`&&(e[t]=this.typeCastToParameter(n))}super.toAssignableList(e,t,n)}toReferencedList(e,t){for(let r=0;r<e.length;r++){var n;let i=e[r];i&&i.type===`TypeCastExpression`&&!((n=i.extra)!=null&&n.parenthesized)&&(e.length>1||!t)&&this.raise(q.TypeCastInPattern,{at:i.typeAnnotation})}return e}parseArrayLike(e,t,n,r){let i=super.parseArrayLike(e,t,n,r);return t&&!this.state.maybeInArrowParameters&&this.toReferencedList(i.elements),i}isValidLVal(e,t,n){return e===`TypeCastExpression`||super.isValidLVal(e,t,n)}parseClassProperty(e){return this.match(14)&&(e.typeAnnotation=this.flowParseTypeAnnotation()),super.parseClassProperty(e)}parseClassPrivateProperty(e){return this.match(14)&&(e.typeAnnotation=this.flowParseTypeAnnotation()),super.parseClassPrivateProperty(e)}isClassMethod(){return this.match(47)||super.isClassMethod()}isClassProperty(){return this.match(14)||super.isClassProperty()}isNonstaticConstructor(e){return!this.match(14)&&super.isNonstaticConstructor(e)}pushClassMethod(e,t,n,r,i,a){if(t.variance&&this.unexpected(t.variance.loc.start),delete t.variance,this.match(47)&&(t.typeParameters=this.flowParseTypeParameterDeclaration()),super.pushClassMethod(e,t,n,r,i,a),t.params&&i){let e=t.params;e.length>0&&this.isThisParam(e[0])&&this.raise(q.ThisParamBannedInConstructor,{at:t})}else if(t.type===`MethodDefinition`&&i&&t.value.params){let e=t.value.params;e.length>0&&this.isThisParam(e[0])&&this.raise(q.ThisParamBannedInConstructor,{at:t})}}pushClassPrivateMethod(e,t,n,r){t.variance&&this.unexpected(t.variance.loc.start),delete t.variance,this.match(47)&&(t.typeParameters=this.flowParseTypeParameterDeclaration()),super.pushClassPrivateMethod(e,t,n,r)}parseClassSuper(e){if(super.parseClassSuper(e),e.superClass&&this.match(47)&&(e.superTypeParameters=this.flowParseTypeParameterInstantiation()),this.isContextual(111)){this.next();let t=e.implements=[];do{let e=this.startNode();e.id=this.flowParseRestrictedIdentifier(!0),e.typeParameters=this.match(47)?this.flowParseTypeParameterInstantiation():null,t.push(this.finishNode(e,`ClassImplements`))}while(this.eat(12))}}checkGetterSetterParams(e){super.checkGetterSetterParams(e);let t=this.getObjectOrClassMethodParams(e);if(t.length>0){let n=t[0];this.isThisParam(n)&&e.kind===`get`?this.raise(q.GetterMayNotHaveThisParam,{at:n}):this.isThisParam(n)&&this.raise(q.SetterMayNotHaveThisParam,{at:n})}}parsePropertyNamePrefixOperator(e){e.variance=this.flowParseVariance()}parseObjPropValue(e,t,n,r,i,a,o){e.variance&&this.unexpected(e.variance.loc.start),delete e.variance;let s;this.match(47)&&!a&&(s=this.flowParseTypeParameterDeclaration(),this.match(10)||this.unexpected());let c=super.parseObjPropValue(e,t,n,r,i,a,o);return s&&((c.value||c).typeParameters=s),c}parseAssignableListItemTypes(e){return this.eat(17)&&(e.type!==`Identifier`&&this.raise(q.PatternIsOptional,{at:e}),this.isThisParam(e)&&this.raise(q.ThisParamMayNotBeOptional,{at:e}),e.optional=!0),this.match(14)?e.typeAnnotation=this.flowParseTypeAnnotation():this.isThisParam(e)&&this.raise(q.ThisParamAnnotationRequired,{at:e}),this.match(29)&&this.isThisParam(e)&&this.raise(q.ThisParamNoDefault,{at:e}),this.resetEndLocation(e),e}parseMaybeDefault(e,t){let n=super.parseMaybeDefault(e,t);return n.type===`AssignmentPattern`&&n.typeAnnotation&&n.right.start<n.typeAnnotation.start&&this.raise(q.TypeBeforeInitializer,{at:n.typeAnnotation}),n}shouldParseDefaultImport(e){return zt(e)?Bt(this.state.type):super.shouldParseDefaultImport(e)}checkImportReflection(e){super.checkImportReflection(e),e.module&&e.importKind!==`value`&&this.raise(q.ImportReflectionHasImportType,{at:e.specifiers[0].loc.start})}parseImportSpecifierLocal(e,t,n){t.local=zt(e)?this.flowParseRestrictedIdentifier(!0,!0):this.parseIdentifier(),e.specifiers.push(this.finishImportSpecifier(t,n))}maybeParseDefaultImportSpecifier(e){e.importKind=`value`;let t=null;if(this.match(87)?t=`typeof`:this.isContextual(128)&&(t=`type`),t){let n=this.lookahead(),{type:r}=n;t===`type`&&r===55&&this.unexpected(null,n.type),(Bt(r)||r===5||r===55)&&(this.next(),e.importKind=t)}return super.maybeParseDefaultImportSpecifier(e)}parseImportSpecifier(e,t,n,r,i){let a=e.imported,o=null;a.type===`Identifier`&&(a.name===`type`?o=`type`:a.name===`typeof`&&(o=`typeof`));let s=!1;if(this.isContextual(93)&&!this.isLookaheadContextual(`as`)){let t=this.parseIdentifier(!0);o!==null&&!j(this.state.type)?(e.imported=t,e.importKind=o,e.local=K(t)):(e.imported=a,e.importKind=null,e.local=this.parseIdentifier())}else{if(o!==null&&j(this.state.type))e.imported=this.parseIdentifier(!0),e.importKind=o;else{if(t)throw this.raise(_.ImportBindingIsString,{at:e,importName:a.value});e.imported=a,e.importKind=null}this.eatContextual(93)?e.local=this.parseIdentifier():(s=!0,e.local=K(e.imported))}let c=zt(e);return n&&c&&this.raise(q.ImportTypeShorthandOnlyInPureImport,{at:e}),(n||c)&&this.checkReservedType(e.local.name,e.local.loc.start,!0),s&&!n&&!c&&this.checkReservedWord(e.local.name,e.loc.start,!0,!0),this.finishImportSpecifier(e,`ImportSpecifier`)}parseBindingAtom(){switch(this.state.type){case 78:return this.parseIdentifier(!0);default:return super.parseBindingAtom()}}parseFunctionParams(e,t){let n=e.kind;n!==`get`&&n!==`set`&&this.match(47)&&(e.typeParameters=this.flowParseTypeParameterDeclaration()),super.parseFunctionParams(e,t)}parseVarId(e,t){super.parseVarId(e,t),this.match(14)&&(e.id.typeAnnotation=this.flowParseTypeAnnotation(),this.resetEndLocation(e.id))}parseAsyncArrowFromCallExpression(e,t){if(this.match(14)){let t=this.state.noAnonFunctionType;this.state.noAnonFunctionType=!0,e.returnType=this.flowParseTypeAnnotation(),this.state.noAnonFunctionType=t}return super.parseAsyncArrowFromCallExpression(e,t)}shouldParseAsyncArrow(){return this.match(14)||super.shouldParseAsyncArrow()}parseMaybeAssign(e,t){var n;let r=null,i;if(this.hasPlugin(`jsx`)&&(this.match(140)||this.match(47))){if(r=this.state.clone(),i=this.tryParse(()=>super.parseMaybeAssign(e,t),r),!i.error)return i.node;let{context:n}=this.state,a=n[n.length-1];(a===b.j_oTag||a===b.j_expr)&&n.pop()}if((n=i)!=null&&n.error||this.match(47)){var a,o;r||=this.state.clone();let n,s=this.tryParse(r=>{var i;n=this.flowParseTypeParameterDeclaration();let a=this.forwardNoArrowParamsConversionAt(n,()=>{let r=super.parseMaybeAssign(e,t);return this.resetStartLocationFromNode(r,n),r});(i=a.extra)!=null&&i.parenthesized&&r();let o=this.maybeUnwrapTypeCastExpression(a);return o.type!==`ArrowFunctionExpression`&&r(),o.typeParameters=n,this.resetStartLocationFromNode(o,n),a},r),c=null;if(s.node&&this.maybeUnwrapTypeCastExpression(s.node).type===`ArrowFunctionExpression`){if(!s.error&&!s.aborted)return s.node.async&&this.raise(q.UnexpectedTypeParameterBeforeAsyncArrowFunction,{at:n}),s.node;c=s.node}if((a=i)!=null&&a.node)return this.state=i.failState,i.node;if(c)return this.state=s.failState,c;throw(o=i)!=null&&o.thrown?i.error:s.thrown?s.error:this.raise(q.UnexpectedTokenAfterTypeParameter,{at:n})}return super.parseMaybeAssign(e,t)}parseArrow(e){if(this.match(14)){let t=this.tryParse(()=>{let t=this.state.noAnonFunctionType;this.state.noAnonFunctionType=!0;let n=this.startNode();return[n.typeAnnotation,e.predicate]=this.flowParseTypeAndPredicateInitialiser(),this.state.noAnonFunctionType=t,this.canInsertSemicolon()&&this.unexpected(),this.match(19)||this.unexpected(),n});if(t.thrown)return null;t.error&&(this.state=t.failState),e.returnType=t.node.typeAnnotation?this.finishNode(t.node,`TypeAnnotation`):null}return super.parseArrow(e)}shouldParseArrow(e){return this.match(14)||super.shouldParseArrow(e)}setArrowFunctionParameters(e,t){this.state.noArrowParamsConversionAt.indexOf(e.start)===-1?super.setArrowFunctionParameters(e,t):e.params=t}checkParams(e,t,n,r=!0){if(!(n&&this.state.noArrowParamsConversionAt.indexOf(e.start)!==-1)){for(let t=0;t<e.params.length;t++)this.isThisParam(e.params[t])&&t>0&&this.raise(q.ThisParamMustBeFirst,{at:e.params[t]});return super.checkParams(e,t,n,r)}}parseParenAndDistinguishExpression(e){return super.parseParenAndDistinguishExpression(e&&this.state.noArrowAt.indexOf(this.state.start)===-1)}parseSubscripts(e,t,n){if(e.type===`Identifier`&&e.name===`async`&&this.state.noArrowAt.indexOf(t.index)!==-1){this.next();let n=this.startNodeAt(t);n.callee=e,n.arguments=super.parseCallExpressionArguments(11,!1),e=this.finishNode(n,`CallExpression`)}else if(e.type===`Identifier`&&e.name===`async`&&this.match(47)){let r=this.state.clone(),i=this.tryParse(e=>this.parseAsyncArrowWithTypeParameters(t)||e(),r);if(!i.error&&!i.aborted)return i.node;let a=this.tryParse(()=>super.parseSubscripts(e,t,n),r);if(a.node&&!a.error)return a.node;if(i.node)return this.state=i.failState,i.node;if(a.node)return this.state=a.failState,a.node;throw i.error||a.error}return super.parseSubscripts(e,t,n)}parseSubscript(e,t,n,r){if(this.match(18)&&this.isLookaheadToken_lt()){if(r.optionalChainMember=!0,n)return r.stop=!0,e;this.next();let i=this.startNodeAt(t);return i.callee=e,i.typeArguments=this.flowParseTypeParameterInstantiation(),this.expect(10),i.arguments=this.parseCallExpressionArguments(11,!1),i.optional=!0,this.finishCallExpression(i,!0)}if(!n&&this.shouldParseTypes()&&this.match(47)){let n=this.startNodeAt(t);n.callee=e;let i=this.tryParse(()=>(n.typeArguments=this.flowParseTypeParameterInstantiationCallOrNew(),this.expect(10),n.arguments=super.parseCallExpressionArguments(11,!1),r.optionalChainMember&&(n.optional=!1),this.finishCallExpression(n,r.optionalChainMember)));if(i.node)return i.error&&(this.state=i.failState),i.node}return super.parseSubscript(e,t,n,r)}parseNewCallee(e){super.parseNewCallee(e);let t=null;this.shouldParseTypes()&&this.match(47)&&(t=this.tryParse(()=>this.flowParseTypeParameterInstantiationCallOrNew()).node),e.typeArguments=t}parseAsyncArrowWithTypeParameters(e){let t=this.startNodeAt(e);if(this.parseFunctionParams(t,!1),this.parseArrow(t))return super.parseArrowExpression(t,void 0,!0)}readToken_mult_modulo(e){let t=this.input.charCodeAt(this.state.pos+1);e===42&&t===47&&this.state.hasFlowComment?(this.state.hasFlowComment=!1,this.state.pos+=2,this.nextToken()):super.readToken_mult_modulo(e)}readToken_pipe_amp(e){let t=this.input.charCodeAt(this.state.pos+1);e===124&&t===125?this.finishOp(9,2):super.readToken_pipe_amp(e)}parseTopLevel(e,t){let n=super.parseTopLevel(e,t);return this.state.hasFlowComment&&this.raise(q.UnterminatedFlowComment,{at:this.state.curPosition()}),n}skipBlockComment(){if(this.hasPlugin(`flowComments`)&&this.skipFlowComment()){if(this.state.hasFlowComment)throw this.raise(q.NestedFlowComment,{at:this.state.startLoc});this.hasFlowCommentCompletion();let e=this.skipFlowComment();e&&(this.state.pos+=e,this.state.hasFlowComment=!0)}else return super.skipBlockComment(this.state.hasFlowComment?`*-/`:`*/`)}skipFlowComment(){let{pos:e}=this.state,t=2;for(;[32,9].includes(this.input.charCodeAt(e+t));)t++;let n=this.input.charCodeAt(t+e),r=this.input.charCodeAt(t+e+1);return n===58&&r===58?t+2:this.input.slice(t+e,t+e+12)===`flow-include`?t+12:n===58&&r!==58&&t}hasFlowCommentCompletion(){if(this.input.indexOf(`*/`,this.state.pos)===-1)throw this.raise(_.UnterminatedComment,{at:this.state.curPosition()})}flowEnumErrorBooleanMemberNotInitialized(e,{enumName:t,memberName:n}){this.raise(q.EnumBooleanMemberNotInitialized,{at:e,memberName:n,enumName:t})}flowEnumErrorInvalidMemberInitializer(e,t){return this.raise(t.explicitType?t.explicitType===`symbol`?q.EnumInvalidMemberInitializerSymbolType:q.EnumInvalidMemberInitializerPrimaryType:q.EnumInvalidMemberInitializerUnknownType,Object.assign({at:e},t))}flowEnumErrorNumberMemberNotInitialized(e,{enumName:t,memberName:n}){this.raise(q.EnumNumberMemberNotInitialized,{at:e,enumName:t,memberName:n})}flowEnumErrorStringMemberInconsistentlyInitailized(e,{enumName:t}){this.raise(q.EnumStringMemberInconsistentlyInitailized,{at:e,enumName:t})}flowEnumMemberInit(){let e=this.state.startLoc,t=()=>this.match(12)||this.match(8);switch(this.state.type){case 132:{let n=this.parseNumericLiteral(this.state.value);return t()?{type:`number`,loc:n.loc.start,value:n}:{type:`invalid`,loc:e}}case 131:{let n=this.parseStringLiteral(this.state.value);return t()?{type:`string`,loc:n.loc.start,value:n}:{type:`invalid`,loc:e}}case 85:case 86:{let n=this.parseBooleanLiteral(this.match(85));return t()?{type:`boolean`,loc:n.loc.start,value:n}:{type:`invalid`,loc:e}}default:return{type:`invalid`,loc:e}}}flowEnumMemberRaw(){let e=this.state.startLoc;return{id:this.parseIdentifier(!0),init:this.eat(29)?this.flowEnumMemberInit():{type:`none`,loc:e}}}flowEnumCheckExplicitTypeMismatch(e,t,n){let{explicitType:r}=t;r!==null&&r!==n&&this.flowEnumErrorInvalidMemberInitializer(e,t)}flowEnumMembers({enumName:e,explicitType:t}){let n=/* @__PURE__ */ new Set,r={booleanMembers:[],numberMembers:[],stringMembers:[],defaultedMembers:[]},i=!1;for(;!this.match(8);){if(this.eat(21)){i=!0;break}let a=this.startNode(),{id:o,init:s}=this.flowEnumMemberRaw(),c=o.name;if(c===``)continue;/^[a-z]/.test(c)&&this.raise(q.EnumInvalidMemberName,{at:o,memberName:c,suggestion:c[0].toUpperCase()+c.slice(1),enumName:e}),n.has(c)&&this.raise(q.EnumDuplicateMemberName,{at:o,memberName:c,enumName:e}),n.add(c);let l={enumName:e,explicitType:t,memberName:c};switch(a.id=o,s.type){case`boolean`:this.flowEnumCheckExplicitTypeMismatch(s.loc,l,`boolean`),a.init=s.value,r.booleanMembers.push(this.finishNode(a,`EnumBooleanMember`));break;case`number`:this.flowEnumCheckExplicitTypeMismatch(s.loc,l,`number`),a.init=s.value,r.numberMembers.push(this.finishNode(a,`EnumNumberMember`));break;case`string`:this.flowEnumCheckExplicitTypeMismatch(s.loc,l,`string`),a.init=s.value,r.stringMembers.push(this.finishNode(a,`EnumStringMember`));break;case`invalid`:throw this.flowEnumErrorInvalidMemberInitializer(s.loc,l);case`none`:switch(t){case`boolean`:this.flowEnumErrorBooleanMemberNotInitialized(s.loc,l);break;case`number`:this.flowEnumErrorNumberMemberNotInitialized(s.loc,l);break;default:r.defaultedMembers.push(this.finishNode(a,`EnumDefaultedMember`))}}this.match(8)||this.expect(12)}return{members:r,hasUnknownMembers:i}}flowEnumStringMembers(e,t,{enumName:n}){if(e.length===0)return t;if(t.length===0)return e;if(t.length>e.length){for(let t of e)this.flowEnumErrorStringMemberInconsistentlyInitailized(t,{enumName:n});return t}for(let e of t)this.flowEnumErrorStringMemberInconsistentlyInitailized(e,{enumName:n});return e}flowEnumParseExplicitType({enumName:e}){if(!this.eatContextual(101))return null;if(!A(this.state.type))throw this.raise(q.EnumInvalidExplicitTypeUnknownSupplied,{at:this.state.startLoc,enumName:e});let{value:t}=this.state;return this.next(),t!==`boolean`&&t!==`number`&&t!==`string`&&t!==`symbol`&&this.raise(q.EnumInvalidExplicitType,{at:this.state.startLoc,enumName:e,invalidEnumType:t}),t}flowEnumBody(e,t){let n=t.name,r=t.loc.start,i=this.flowEnumParseExplicitType({enumName:n});this.expect(5);let{members:a,hasUnknownMembers:o}=this.flowEnumMembers({enumName:n,explicitType:i});switch(e.hasUnknownMembers=o,i){case`boolean`:return e.explicitType=!0,e.members=a.booleanMembers,this.expect(8),this.finishNode(e,`EnumBooleanBody`);case`number`:return e.explicitType=!0,e.members=a.numberMembers,this.expect(8),this.finishNode(e,`EnumNumberBody`);case`string`:return e.explicitType=!0,e.members=this.flowEnumStringMembers(a.stringMembers,a.defaultedMembers,{enumName:n}),this.expect(8),this.finishNode(e,`EnumStringBody`);case`symbol`:return e.members=a.defaultedMembers,this.expect(8),this.finishNode(e,`EnumSymbolBody`);default:{let t=()=>(e.members=[],this.expect(8),this.finishNode(e,`EnumStringBody`));e.explicitType=!1;let i=a.booleanMembers.length,o=a.numberMembers.length,s=a.stringMembers.length,c=a.defaultedMembers.length;if(!i&&!o&&!s&&!c)return t();if(!i&&!o)return e.members=this.flowEnumStringMembers(a.stringMembers,a.defaultedMembers,{enumName:n}),this.expect(8),this.finishNode(e,`EnumStringBody`);if(!o&&!s&&i>=c){for(let e of a.defaultedMembers)this.flowEnumErrorBooleanMemberNotInitialized(e.loc.start,{enumName:n,memberName:e.id.name});return e.members=a.booleanMembers,this.expect(8),this.finishNode(e,`EnumBooleanBody`)}if(!i&&!s&&o>=c){for(let e of a.defaultedMembers)this.flowEnumErrorNumberMemberNotInitialized(e.loc.start,{enumName:n,memberName:e.id.name});return e.members=a.numberMembers,this.expect(8),this.finishNode(e,`EnumNumberBody`)}return this.raise(q.EnumInconsistentMemberValues,{at:r,enumName:n}),t()}}}flowParseEnumDeclaration(e){let t=this.parseIdentifier();return e.id=t,e.body=this.flowEnumBody(this.startNode(),t),this.finishNode(e,`EnumDeclaration`)}isLookaheadToken_lt(){let e=this.nextTokenStart();if(this.input.charCodeAt(e)===60){let t=this.input.charCodeAt(e+1);return t!==60&&t!==61}return!1}maybeUnwrapTypeCastExpression(e){return e.type===`TypeCastExpression`?e.expression:e}});let Gt={__proto__:null,quot:`"`,amp:`&`,apos:`'`,lt:`<`,gt:`>`,nbsp:`\xA0`,iexcl:`¡`,cent:`¢`,pound:`£`,curren:`¤`,yen:`¥`,brvbar:`¦`,sect:`§`,uml:`¨`,copy:`©`,ordf:`ª`,laquo:`«`,not:`¬`,shy:`­`,reg:`®`,macr:`¯`,deg:`°`,plusmn:`±`,sup2:`²`,sup3:`³`,acute:`´`,micro:`µ`,para:`¶`,middot:`·`,cedil:`¸`,sup1:`¹`,ordm:`º`,raquo:`»`,frac14:`¼`,frac12:`½`,frac34:`¾`,iquest:`¿`,Agrave:`À`,Aacute:`Á`,Acirc:`Â`,Atilde:`Ã`,Auml:`Ä`,Aring:`Å`,AElig:`Æ`,Ccedil:`Ç`,Egrave:`È`,Eacute:`É`,Ecirc:`Ê`,Euml:`Ë`,Igrave:`Ì`,Iacute:`Í`,Icirc:`Î`,Iuml:`Ï`,ETH:`Ð`,Ntilde:`Ñ`,Ograve:`Ò`,Oacute:`Ó`,Ocirc:`Ô`,Otilde:`Õ`,Ouml:`Ö`,times:`×`,Oslash:`Ø`,Ugrave:`Ù`,Uacute:`Ú`,Ucirc:`Û`,Uuml:`Ü`,Yacute:`Ý`,THORN:`Þ`,szlig:`ß`,agrave:`à`,aacute:`á`,acirc:`â`,atilde:`ã`,auml:`ä`,aring:`å`,aelig:`æ`,ccedil:`ç`,egrave:`è`,eacute:`é`,ecirc:`ê`,euml:`ë`,igrave:`ì`,iacute:`í`,icirc:`î`,iuml:`ï`,eth:`ð`,ntilde:`ñ`,ograve:`ò`,oacute:`ó`,ocirc:`ô`,otilde:`õ`,ouml:`ö`,divide:`÷`,oslash:`ø`,ugrave:`ù`,uacute:`ú`,ucirc:`û`,uuml:`ü`,yacute:`ý`,thorn:`þ`,yuml:`ÿ`,OElig:`Œ`,oelig:`œ`,Scaron:`Š`,scaron:`š`,Yuml:`Ÿ`,fnof:`ƒ`,circ:`ˆ`,tilde:`˜`,Alpha:`Α`,Beta:`Β`,Gamma:`Γ`,Delta:`Δ`,Epsilon:`Ε`,Zeta:`Ζ`,Eta:`Η`,Theta:`Θ`,Iota:`Ι`,Kappa:`Κ`,Lambda:`Λ`,Mu:`Μ`,Nu:`Ν`,Xi:`Ξ`,Omicron:`Ο`,Pi:`Π`,Rho:`Ρ`,Sigma:`Σ`,Tau:`Τ`,Upsilon:`Υ`,Phi:`Φ`,Chi:`Χ`,Psi:`Ψ`,Omega:`Ω`,alpha:`α`,beta:`β`,gamma:`γ`,delta:`δ`,epsilon:`ε`,zeta:`ζ`,eta:`η`,theta:`θ`,iota:`ι`,kappa:`κ`,lambda:`λ`,mu:`μ`,nu:`ν`,xi:`ξ`,omicron:`ο`,pi:`π`,rho:`ρ`,sigmaf:`ς`,sigma:`σ`,tau:`τ`,upsilon:`υ`,phi:`φ`,chi:`χ`,psi:`ψ`,omega:`ω`,thetasym:`ϑ`,upsih:`ϒ`,piv:`ϖ`,ensp:` `,emsp:` `,thinsp:` `,zwnj:`‌`,zwj:`‍`,lrm:`‎`,rlm:`‏`,ndash:`–`,mdash:`—`,lsquo:`‘`,rsquo:`’`,sbquo:`‚`,ldquo:`“`,rdquo:`”`,bdquo:`„`,dagger:`†`,Dagger:`‡`,bull:`•`,hellip:`…`,permil:`‰`,prime:`′`,Prime:`″`,lsaquo:`‹`,rsaquo:`›`,oline:`‾`,frasl:`⁄`,euro:`€`,image:`ℑ`,weierp:`℘`,real:`ℜ`,trade:`™`,alefsym:`ℵ`,larr:`←`,uarr:`↑`,rarr:`→`,darr:`↓`,harr:`↔`,crarr:`↵`,lArr:`⇐`,uArr:`⇑`,rArr:`⇒`,dArr:`⇓`,hArr:`⇔`,forall:`∀`,part:`∂`,exist:`∃`,empty:`∅`,nabla:`∇`,isin:`∈`,notin:`∉`,ni:`∋`,prod:`∏`,sum:`∑`,minus:`−`,lowast:`∗`,radic:`√`,prop:`∝`,infin:`∞`,ang:`∠`,and:`∧`,or:`∨`,cap:`∩`,cup:`∪`,int:`∫`,there4:`∴`,sim:`∼`,cong:`≅`,asymp:`≈`,ne:`≠`,equiv:`≡`,le:`≤`,ge:`≥`,sub:`⊂`,sup:`⊃`,nsub:`⊄`,sube:`⊆`,supe:`⊇`,oplus:`⊕`,otimes:`⊗`,perp:`⊥`,sdot:`⋅`,lceil:`⌈`,rceil:`⌉`,lfloor:`⌊`,rfloor:`⌋`,lang:`〈`,rang:`〉`,loz:`◊`,spades:`♠`,clubs:`♣`,hearts:`♥`,diams:`♦`},Kt=g`jsx`({AttributeIsEmpty:`JSX attributes must only be assigned a non-empty expression.`,MissingClosingTagElement:({openingTagName:e})=>`Expected corresponding JSX closing tag for <${e}>.`,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:e,HTMLEntity:t})=>`Unexpected token \`${e}\`. Did you mean \`${t}\` or \`{'${e}'}\`?`,UnsupportedJsxValue:`JSX value should be either an expression or a quoted JSX text.`,UnterminatedJsxContent:`Unterminated JSX contents.`,UnwrappedAdjacentJSXElements:`Adjacent JSX elements must be wrapped in an enclosing tag. Did you want a JSX fragment <>...</>?`});function J(e){return e?e.type===`JSXOpeningFragment`||e.type===`JSXClosingFragment`:!1}function qt(e){if(e.type===`JSXIdentifier`)return e.name;if(e.type===`JSXNamespacedName`)return e.namespace.name+`:`+e.name.name;if(e.type===`JSXMemberExpression`)return qt(e.object)+`.`+qt(e.property);throw Error(`Node had unexpected type: `+e.type)}var Jt=(e=>class extends e{jsxReadToken(){let e=``,t=this.state.pos;for(;;){if(this.state.pos>=this.length)throw this.raise(Kt.UnterminatedJsxContent,{at:this.state.startLoc});let n=this.input.charCodeAt(this.state.pos);switch(n){case 60:case 123:return this.state.pos===this.state.start?n===60&&this.state.canStartJSXElement?(++this.state.pos,this.finishToken(140)):super.getTokenFromCode(n):(e+=this.input.slice(t,this.state.pos),this.finishToken(139,e));case 38:e+=this.input.slice(t,this.state.pos),e+=this.jsxReadEntity(),t=this.state.pos;break;default:et(n)?(e+=this.input.slice(t,this.state.pos),e+=this.jsxReadNewLine(!0),t=this.state.pos):++this.state.pos}}}jsxReadNewLine(e){let t=this.input.charCodeAt(this.state.pos),n;return++this.state.pos,t===13&&this.input.charCodeAt(this.state.pos)===10?(++this.state.pos,n=e?`
10
+ `:`\r
11
+ `):n=String.fromCharCode(t),++this.state.curLine,this.state.lineStart=this.state.pos,n}jsxReadString(e){let t=``,n=++this.state.pos;for(;;){if(this.state.pos>=this.length)throw this.raise(_.UnterminatedString,{at:this.state.startLoc});let r=this.input.charCodeAt(this.state.pos);if(r===e)break;r===38?(t+=this.input.slice(n,this.state.pos),t+=this.jsxReadEntity(),n=this.state.pos):et(r)?(t+=this.input.slice(n,this.state.pos),t+=this.jsxReadNewLine(!1),n=this.state.pos):++this.state.pos}return t+=this.input.slice(n,this.state.pos++),this.finishToken(131,t)}jsxReadEntity(){let e=++this.state.pos;if(this.codePointAtPos(this.state.pos)===35){++this.state.pos;let e=10;this.codePointAtPos(this.state.pos)===120&&(e=16,++this.state.pos);let t=this.readInt(e,void 0,!1,`bail`);if(t!==null&&this.codePointAtPos(this.state.pos)===59)return++this.state.pos,String.fromCodePoint(t)}else{let t=0,n=!1;for(;t++<10&&this.state.pos<this.length&&!(n=this.codePointAtPos(this.state.pos)==59);)++this.state.pos;if(n){let t=this.input.slice(e,this.state.pos),n=Gt[t];if(++this.state.pos,n)return n}}return this.state.pos=e,`&`}jsxReadWord(){let e,t=this.state.pos;do e=this.input.charCodeAt(++this.state.pos);while(Te(e)||e===45);return this.finishToken(138,this.input.slice(t,this.state.pos))}jsxParseIdentifier(){let e=this.startNode();return this.match(138)?e.name=this.state.value:F(this.state.type)?e.name=L(this.state.type):this.unexpected(),this.next(),this.finishNode(e,`JSXIdentifier`)}jsxParseNamespacedName(){let e=this.state.startLoc,t=this.jsxParseIdentifier();if(!this.eat(14))return t;let n=this.startNodeAt(e);return n.namespace=t,n.name=this.jsxParseIdentifier(),this.finishNode(n,`JSXNamespacedName`)}jsxParseElementName(){let e=this.state.startLoc,t=this.jsxParseNamespacedName();if(t.type===`JSXNamespacedName`)return t;for(;this.eat(16);){let n=this.startNodeAt(e);n.object=t,n.property=this.jsxParseIdentifier(),t=this.finishNode(n,`JSXMemberExpression`)}return t}jsxParseAttributeValue(){let e;switch(this.state.type){case 5:return e=this.startNode(),this.setContext(b.brace),this.next(),e=this.jsxParseExpressionContainer(e,b.j_oTag),e.expression.type===`JSXEmptyExpression`&&this.raise(Kt.AttributeIsEmpty,{at:e}),e;case 140:case 131:return this.parseExprAtom();default:throw this.raise(Kt.UnsupportedJsxValue,{at:this.state.startLoc})}}jsxParseEmptyExpression(){let e=this.startNodeAt(this.state.lastTokEndLoc);return this.finishNodeAt(e,`JSXEmptyExpression`,this.state.startLoc)}jsxParseSpreadChild(e){return this.next(),e.expression=this.parseExpression(),this.setContext(b.j_expr),this.state.canStartJSXElement=!0,this.expect(8),this.finishNode(e,`JSXSpreadChild`)}jsxParseExpressionContainer(e,t){return e.expression=this.match(8)?this.jsxParseEmptyExpression():this.parseExpression(),this.setContext(t),this.state.canStartJSXElement=!0,this.expect(8),this.finishNode(e,`JSXExpressionContainer`)}jsxParseAttribute(){let e=this.startNode();return this.match(5)?(this.setContext(b.brace),this.next(),this.expect(21),e.argument=this.parseMaybeAssignAllowIn(),this.setContext(b.j_oTag),this.state.canStartJSXElement=!0,this.expect(8),this.finishNode(e,`JSXSpreadAttribute`)):(e.name=this.jsxParseNamespacedName(),e.value=this.eat(29)?this.jsxParseAttributeValue():null,this.finishNode(e,`JSXAttribute`))}jsxParseOpeningElementAt(e){let t=this.startNodeAt(e);return this.eat(141)?this.finishNode(t,`JSXOpeningFragment`):(t.name=this.jsxParseElementName(),this.jsxParseOpeningElementAfterName(t))}jsxParseOpeningElementAfterName(e){let t=[];for(;!this.match(56)&&!this.match(141);)t.push(this.jsxParseAttribute());return e.attributes=t,e.selfClosing=this.eat(56),this.expect(141),this.finishNode(e,`JSXOpeningElement`)}jsxParseClosingElementAt(e){let t=this.startNodeAt(e);return this.eat(141)?this.finishNode(t,`JSXClosingFragment`):(t.name=this.jsxParseElementName(),this.expect(141),this.finishNode(t,`JSXClosingElement`))}jsxParseElementAt(e){let t=this.startNodeAt(e),n=[],r=this.jsxParseOpeningElementAt(e),i=null;if(!r.selfClosing){contents:for(;;)switch(this.state.type){case 140:if(e=this.state.startLoc,this.next(),this.eat(56)){i=this.jsxParseClosingElementAt(e);break contents}n.push(this.jsxParseElementAt(e));break;case 139:n.push(this.parseExprAtom());break;case 5:{let e=this.startNode();this.setContext(b.brace),this.next(),this.match(21)?n.push(this.jsxParseSpreadChild(e)):n.push(this.jsxParseExpressionContainer(e,b.j_expr));break}default:throw this.unexpected()}J(r)&&!J(i)&&i!==null?this.raise(Kt.MissingClosingTagFragment,{at:i}):(!J(r)&&J(i)||!J(r)&&!J(i)&&qt(i.name)!==qt(r.name))&&this.raise(Kt.MissingClosingTagElement,{at:i,openingTagName:qt(r.name)})}if(J(r)?(t.openingFragment=r,t.closingFragment=i):(t.openingElement=r,t.closingElement=i),t.children=n,this.match(47))throw this.raise(Kt.UnwrappedAdjacentJSXElements,{at:this.state.startLoc});return J(r)?this.finishNode(t,`JSXFragment`):this.finishNode(t,`JSXElement`)}jsxParseElement(){let e=this.state.startLoc;return this.next(),this.jsxParseElementAt(e)}setContext(e){let{context:t}=this.state;t[t.length-1]=e}parseExprAtom(e){return this.match(139)?this.parseLiteral(this.state.value,`JSXText`):this.match(140)?this.jsxParseElement():this.match(47)&&this.input.charCodeAt(this.state.pos)!==33?(this.replaceToken(140),this.jsxParseElement()):super.parseExprAtom(e)}skipSpace(){this.curContext().preserveSpace||super.skipSpace()}getTokenFromCode(e){let t=this.curContext();if(t===b.j_expr)return this.jsxReadToken();if(t===b.j_oTag||t===b.j_cTag){if(H(e))return this.jsxReadWord();if(e===62)return++this.state.pos,this.finishToken(141);if((e===34||e===39)&&t===b.j_oTag)return this.jsxReadString(e)}return e===60&&this.state.canStartJSXElement&&this.input.charCodeAt(this.state.pos+1)!==33?(++this.state.pos,this.finishToken(140)):super.getTokenFromCode(e)}updateContext(e){let{context:t,type:n}=this.state;if(n===56&&e===140)t.splice(-2,2,b.j_cTag),this.state.canStartJSXElement=!1;else if(n===140)t.push(b.j_oTag);else if(n===141){let n=t[t.length-1];n===b.j_oTag&&e===56||n===b.j_cTag?(t.pop(),this.state.canStartJSXElement=t[t.length-1]===b.j_expr):(this.setContext(b.j_expr),this.state.canStartJSXElement=!0)}else this.state.canStartJSXElement=de(n)}}),Yt=class extends He{constructor(...e){super(...e),this.types=/* @__PURE__ */ new Set,this.enums=/* @__PURE__ */ new Set,this.constEnums=/* @__PURE__ */ new Set,this.classes=/* @__PURE__ */ new Set,this.exportOnlyBindings=/* @__PURE__ */ new Set}},Xt=class extends Ue{constructor(...e){super(...e),this.importsStack=[]}createScope(e){return this.importsStack.push(/* @__PURE__ */ new Set),new Yt(e)}enter(e){e==256&&this.importsStack.push(/* @__PURE__ */ new Set),super.enter(e)}exit(){let e=super.exit();return e==256&&this.importsStack.pop(),e}hasImport(e,t){let n=this.importsStack.length;if(this.importsStack[n-1].has(e))return!0;if(!t&&n>1){for(let t=0;t<n-1;t++)if(this.importsStack[t].has(e))return!0}return!1}declareName(e,t,n){if(t&Le){this.hasImport(e,!0)&&this.parser.raise(_.VarRedeclaration,{at:n,identifierName:e}),this.importsStack[this.importsStack.length-1].add(e);return}let r=this.currentScope();t&1024?(this.maybeExportDefined(r,e),r.exportOnlyBindings.add(e)):(super.declareName(e,t,n),t&2&&(t&1||(this.checkRedeclarationInScope(r,e,t,n),this.maybeExportDefined(r,e)),r.types.add(e)),t&256&&r.enums.add(e),t&512&&r.constEnums.add(e),t&128&&r.classes.add(e))}isRedeclaredInScope(e,t,n){return e.enums.has(t)?n&256?!!(n&512)!==e.constEnums.has(t):!0:n&128&&e.classes.has(t)?e.lexical.has(t)?!!(n&1):!1:n&2&&e.types.has(t)?!0:super.isRedeclaredInScope(e,t,n)}checkLocalExport(e){let{name:t}=e;if(this.hasImport(t))return;let n=this.scopeStack.length;for(let e=n-1;e>=0;e--){let n=this.scopeStack[e];if(n.types.has(t)||n.exportOnlyBindings.has(t))return}super.checkLocalExport(e)}};let Zt=(e,t)=>Object.hasOwnProperty.call(e,t)&&e[t],Qt=e=>e.type===`ParenthesizedExpression`?Qt(e.expression):e;var Y={ALLOW_EMPTY:1,IS_FUNCTION_PARAMS:2,IS_CONSTRUCTOR_PARAMS:4},$t=class extends It{toAssignable(e,t=!1){var n;let r;switch((e.type===`ParenthesizedExpression`||(n=e.extra)!=null&&n.parenthesized)&&(r=Qt(e),t?r.type===`Identifier`?this.expressionScope.recordArrowParameterBindingError(_.InvalidParenthesizedAssignment,{at:e}):r.type!==`MemberExpression`&&this.raise(_.InvalidParenthesizedAssignment,{at:e}):this.raise(_.InvalidParenthesizedAssignment,{at:e})),e.type){case`Identifier`:case`ObjectPattern`:case`ArrayPattern`:case`AssignmentPattern`:case`RestElement`:break;case`ObjectExpression`:e.type=`ObjectPattern`;for(let n=0,r=e.properties.length,a=r-1;n<r;n++){var i;let r=e.properties[n],o=n===a;this.toAssignableObjectExpressionProp(r,o,t),o&&r.type===`RestElement`&&(i=e.extra)!=null&&i.trailingCommaLoc&&this.raise(_.RestTrailingComma,{at:e.extra.trailingCommaLoc})}break;case`ObjectProperty`:{let{key:n,value:r}=e;this.isPrivateName(n)&&this.classScope.usePrivateName(this.getPrivateNameSV(n),n.loc.start),this.toAssignable(r,t);break}case`SpreadElement`:throw Error(`Internal @babel/parser error (this is a bug, please report it). SpreadElement should be converted by .toAssignable's caller.`);case`ArrayExpression`:e.type=`ArrayPattern`,this.toAssignableList(e.elements,e.extra?.trailingCommaLoc,t);break;case`AssignmentExpression`:e.operator!==`=`&&this.raise(_.MissingEqInAssignment,{at:e.left.loc.end}),e.type=`AssignmentPattern`,delete e.operator,this.toAssignable(e.left,t);break;case`ParenthesizedExpression`:this.toAssignable(r,t)}}toAssignableObjectExpressionProp(e,t,n){if(e.type===`ObjectMethod`)this.raise(e.kind===`get`||e.kind===`set`?_.PatternHasAccessor:_.PatternHasMethod,{at:e.key});else if(e.type===`SpreadElement`){e.type=`RestElement`;let r=e.argument;this.checkToRestConversion(r,!1),this.toAssignable(r,n),t||this.raise(_.RestTrailingComma,{at:e})}else this.toAssignable(e,n)}toAssignableList(e,t,n){let r=e.length-1;for(let i=0;i<=r;i++){let a=e[i];if(a){if(a.type===`SpreadElement`){a.type=`RestElement`;let e=a.argument;this.checkToRestConversion(e,!0),this.toAssignable(e,n)}else this.toAssignable(a,n);a.type===`RestElement`&&(i<r?this.raise(_.RestTrailingComma,{at:a}):t&&this.raise(_.RestTrailingComma,{at:t}))}}}isAssignable(e,t){switch(e.type){case`Identifier`:case`ObjectPattern`:case`ArrayPattern`:case`AssignmentPattern`:case`RestElement`:return!0;case`ObjectExpression`:{let t=e.properties.length-1;return e.properties.every((e,n)=>e.type!==`ObjectMethod`&&(n===t||e.type!==`SpreadElement`)&&this.isAssignable(e))}case`ObjectProperty`:return this.isAssignable(e.value);case`SpreadElement`:return this.isAssignable(e.argument);case`ArrayExpression`:return e.elements.every(e=>e===null||this.isAssignable(e));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}toReferencedListDeep(e,t){this.toReferencedList(e,t);for(let t of e)t?.type===`ArrayExpression`&&this.toReferencedListDeep(t.elements)}parseSpread(e){let t=this.startNode();return this.next(),t.argument=this.parseMaybeAssignAllowIn(e,void 0),this.finishNode(t,`SpreadElement`)}parseRestBinding(){let e=this.startNode();return this.next(),e.argument=this.parseBindingAtom(),this.finishNode(e,`RestElement`)}parseBindingAtom(){switch(this.state.type){case 0:{let e=this.startNode();return this.next(),e.elements=this.parseBindingList(3,93,Y.ALLOW_EMPTY),this.finishNode(e,`ArrayPattern`)}case 5:return this.parseObjectLike(8,!0)}return this.parseIdentifier()}parseBindingList(e,t,n){let r=n&Y.ALLOW_EMPTY,i=[],a=!0;for(;!this.eat(e);)if(a?a=!1:this.expect(12),r&&this.match(12))i.push(null);else if(this.eat(e))break;else if(this.match(21)){if(i.push(this.parseAssignableListItemTypes(this.parseRestBinding(),n)),!this.checkCommaAfterRest(t)){this.expect(e);break}}else{let e=[];for(this.match(26)&&this.hasPlugin(`decorators`)&&this.raise(_.UnsupportedParameterDecorator,{at:this.state.startLoc});this.match(26);)e.push(this.parseDecorator());i.push(this.parseAssignableListItem(n,e))}return i}parseBindingRestProperty(e){return this.next(),e.argument=this.parseIdentifier(),this.checkCommaAfterRest(125),this.finishNode(e,`RestElement`)}parseBindingProperty(){let e=this.startNode(),{type:t,startLoc:n}=this.state;return t===21?this.parseBindingRestProperty(e):(t===136?(this.expectPlugin(`destructuringPrivate`,n),this.classScope.usePrivateName(this.state.value,n),e.key=this.parsePrivateName()):this.parsePropertyName(e),e.method=!1,this.parseObjPropValue(e,n,!1,!1,!0,!1))}parseAssignableListItem(e,t){let n=this.parseMaybeDefault();this.parseAssignableListItemTypes(n,e);let r=this.parseMaybeDefault(n.loc.start,n);return t.length&&(n.decorators=t),r}parseAssignableListItemTypes(e,t){return e}parseMaybeDefault(e,t){if(e??=this.state.startLoc,t??=this.parseBindingAtom(),!this.eat(29))return t;let n=this.startNodeAt(e);return n.left=t,n.right=this.parseMaybeAssignAllowIn(),this.finishNode(n,`AssignmentPattern`)}isValidLVal(e,t,n){return Zt({AssignmentPattern:`left`,RestElement:`argument`,ObjectProperty:`value`,ParenthesizedExpression:`expression`,ArrayPattern:`elements`,ObjectPattern:`properties`},e)}checkLVal(e,{in:t,binding:n=64,checkClashes:r=!1,strictModeChanged:i=!1,hasParenthesizedAncestor:a=!1}){var o;let s=e.type;if(this.isObjectMethod(e))return;if(s===`MemberExpression`){n!==64&&this.raise(_.InvalidPropertyBindingPattern,{at:e});return}if(s===`Identifier`){this.checkIdentifier(e,n,i);let{name:t}=e;r&&(r.has(t)?this.raise(_.ParamDupe,{at:e}):r.add(t));return}let c=this.isValidLVal(s,!(a||(o=e.extra)!=null&&o.parenthesized)&&t.type===`AssignmentExpression`,n);if(c===!0)return;if(c===!1){let r=n===64?_.InvalidLhs:_.InvalidLhsBinding;this.raise(r,{at:e,ancestor:t});return}let[l,u]=Array.isArray(c)?c:[c,s===`ParenthesizedExpression`],d=s===`ArrayPattern`||s===`ObjectPattern`||s===`ParenthesizedExpression`?{type:s}:t;for(let t of[].concat(e[l]))t&&this.checkLVal(t,{in:d,binding:n,checkClashes:r,strictModeChanged:i,hasParenthesizedAncestor:u})}checkIdentifier(e,t,n=!1){this.state.strict&&(n?je(e.name,this.inModule):Ae(e.name))&&(t===64?this.raise(_.StrictEvalArguments,{at:e,referenceName:e.name}):this.raise(_.StrictEvalArgumentsBinding,{at:e,bindingName:e.name})),t&8192&&e.name===`let`&&this.raise(_.LetInLexicalBinding,{at:e}),t&64||this.declareNameFromIdentifier(e,t)}declareNameFromIdentifier(e,t){this.scope.declareName(e.name,t,e.loc.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(_.InvalidRestAssignmentPattern,{at:e})}}checkCommaAfterRest(e){return this.match(12)?(this.raise(this.lookaheadCharCode()===e?_.RestTrailingComma:_.ElementAfterRest,{at:this.state.startLoc}),!0):!1}};let en=(e,t)=>Object.hasOwnProperty.call(e,t)&&e[t];function tn(e){if(e==null)throw Error(`Unexpected ${e} value.`);return e}function nn(e){if(!e)throw Error(`Assert fail`)}let X=g`typescript`({AbstractMethodHasImplementation:({methodName:e})=>`Method '${e}' cannot have an implementation because it is marked abstract.`,AbstractPropertyHasInitializer:({propertyName:e})=>`Property '${e}' cannot have an initializer because it is marked abstract.`,AccesorCannotDeclareThisParameter:`'get' and 'set' accessors cannot declare 'this' parameters.`,AccesorCannotHaveTypeParameters:`An accessor cannot have type parameters.`,AccessorCannotBeOptional:`An 'accessor' property cannot be declared optional.`,ClassMethodHasDeclare:`Class methods cannot have the 'declare' modifier.`,ClassMethodHasReadonly:`Class methods cannot have the 'readonly' modifier.`,ConstInitiailizerMustBeStringOrNumericLiteralOrLiteralEnumReference:`A 'const' initializer in an ambient context must be a string or numeric literal or literal enum reference.`,ConstructorHasTypeParameters:`Type parameters cannot appear on a constructor declaration.`,DeclareAccessor:({kind:e})=>`'declare' is not allowed in ${e}ters.`,DeclareClassFieldHasInitializer:`Initializers are not allowed in ambient contexts.`,DeclareFunctionHasImplementation:`An implementation cannot be declared in ambient contexts.`,DuplicateAccessibilityModifier:({modifier:e})=>`Accessibility modifier already seen.`,DuplicateModifier:({modifier:e})=>`Duplicate modifier: '${e}'.`,EmptyHeritageClauseType:({token:e})=>`'${e}' list cannot be empty.`,EmptyTypeArguments:`Type argument list cannot be empty.`,EmptyTypeParameters:`Type parameter list cannot be empty.`,ExpectedAmbientAfterExportDeclare:`'export declare' must be followed by an ambient declaration.`,ImportAliasHasImportType:`An import alias can not use 'import type'.`,ImportReflectionHasImportType:"An `import module` declaration can not use `type` modifier",IncompatibleModifiers:({modifiers:e})=>`'${e[0]}' modifier cannot be used with '${e[1]}' modifier.`,IndexSignatureHasAbstract:`Index signatures cannot have the 'abstract' modifier.`,IndexSignatureHasAccessibility:({modifier:e})=>`Index signatures cannot have an accessibility modifier ('${e}').`,IndexSignatureHasDeclare:`Index signatures cannot have the 'declare' modifier.`,IndexSignatureHasOverride:`'override' modifier cannot appear on an index signature.`,IndexSignatureHasStatic:`Index signatures cannot have the 'static' modifier.`,InitializerNotAllowedInAmbientContext:`Initializers are not allowed in ambient contexts.`,InvalidModifierOnTypeMember:({modifier:e})=>`'${e}' modifier cannot appear on a type member.`,InvalidModifierOnTypeParameter:({modifier:e})=>`'${e}' modifier cannot appear on a type parameter.`,InvalidModifierOnTypeParameterPositions:({modifier:e})=>`'${e}' modifier can only appear on a type parameter of a class, interface or type alias.`,InvalidModifiersOrder:({orderedModifiers:e})=>`'${e[0]}' modifier must precede '${e[1]}' modifier.`,InvalidPropertyAccessAfterInstantiationExpression:`Invalid property access after an instantiation expression. You can either wrap the instantiation expression in parentheses, or delete the type arguments.`,InvalidTupleMemberLabel:`Tuple members must be labeled with a simple identifier.`,MissingInterfaceName:`'interface' declarations must be followed by an identifier.`,MixedLabeledAndUnlabeledElements:`Tuple members must all have names or all not have names.`,NonAbstractClassHasAbstractMethod:`Abstract methods can only appear within an abstract class.`,NonClassMethodPropertyHasAbstractModifer:`'abstract' modifier can only appear on a class, method, or property declaration.`,OptionalTypeBeforeRequired:`A required element cannot follow an optional element.`,OverrideNotInSubClass:`This member cannot have an 'override' modifier because its containing class does not extend another class.`,PatternIsOptional:`A binding pattern parameter cannot be optional in an implementation signature.`,PrivateElementHasAbstract:`Private elements cannot have the 'abstract' modifier.`,PrivateElementHasAccessibility:({modifier:e})=>`Private elements cannot have an accessibility modifier ('${e}').`,ReadonlyForMethodSignature:`'readonly' modifier can only appear on a property declaration or index signature.`,ReservedArrowTypeParam:"This syntax is reserved in files with the .mts or .cts extension. Add a trailing comma, as in `<T,>() => ...`.",ReservedTypeAssertion:"This syntax is reserved in files with the .mts or .cts extension. Use an `as` expression instead.",SetAccesorCannotHaveOptionalParameter:`A 'set' accessor cannot have an optional parameter.`,SetAccesorCannotHaveRestParameter:`A 'set' accessor cannot have rest parameter.`,SetAccesorCannotHaveReturnType:`A 'set' accessor cannot have a return type annotation.`,SingleTypeParameterWithoutTrailingComma:({typeParameterName:e})=>`Single type parameter ${e} should have a trailing comma. Example usage: <${e},>.`,StaticBlockCannotHaveModifier:`Static class blocks cannot have any modifier.`,TypeAnnotationAfterAssign:"Type annotations must come before default assignments, e.g. instead of `age = 25: number` use `age: number = 25`.",TypeImportCannotSpecifyDefaultAndNamed:`A type-only import can specify a default import or named bindings, but not both.`,TypeModifierIsUsedInTypeExports:`The 'type' modifier cannot be used on a named export when 'export type' is used on its export statement.`,TypeModifierIsUsedInTypeImports:`The 'type' modifier cannot be used on a named import when 'import type' is used on its import statement.`,UnexpectedParameterModifier:`A parameter property is only allowed in a constructor implementation.`,UnexpectedReadonly:`'readonly' type modifier is only permitted on array and tuple literal types.`,UnexpectedTypeAnnotation:`Did not expect a type annotation here.`,UnexpectedTypeCastInParameter:`Unexpected type cast in parameter position.`,UnsupportedImportTypeArgument:`Argument in a type import must be a string literal.`,UnsupportedParameterPropertyKind:`A parameter property may not be declared using a binding pattern.`,UnsupportedSignatureParameterKind:({type:e})=>`Name in a signature must be an Identifier, ObjectPattern or ArrayPattern, instead got ${e}.`});function rn(e){switch(e){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 an(e){return e===`private`||e===`public`||e===`protected`}function on(e){return e===`in`||e===`out`}var sn=(e=>class extends e{constructor(...e){super(...e),this.tsParseInOutModifiers=this.tsParseModifiers.bind(this,{allowedModifiers:[`in`,`out`],disallowedModifiers:[`const`,`public`,`private`,`protected`,`readonly`,`declare`,`abstract`,`override`],errorTemplate:X.InvalidModifierOnTypeParameter}),this.tsParseConstModifier=this.tsParseModifiers.bind(this,{allowedModifiers:[`const`],disallowedModifiers:[`in`,`out`],errorTemplate:X.InvalidModifierOnTypeParameterPositions}),this.tsParseInOutConstModifiers=this.tsParseModifiers.bind(this,{allowedModifiers:[`in`,`out`,`const`],disallowedModifiers:[`public`,`private`,`protected`,`readonly`,`declare`,`abstract`,`override`],errorTemplate:X.InvalidModifierOnTypeParameter})}getScopeHandler(){return Xt}tsIsIdentifier(){return A(this.state.type)}tsTokenCanFollowModifier(){return(this.match(0)||this.match(5)||this.match(55)||this.match(21)||this.match(136)||this.isLiteralPropertyName())&&!this.hasPrecedingLineBreak()}tsNextTokenCanFollowModifier(){return this.next(),this.tsTokenCanFollowModifier()}tsParseModifier(e,t){if(!A(this.state.type)&&this.state.type!==58&&this.state.type!==75)return;let n=this.state.value;if(e.indexOf(n)!==-1){if(t&&this.tsIsStartOfStaticBlocks())return;if(this.tsTryParse(this.tsNextTokenCanFollowModifier.bind(this)))return n}}tsParseModifiers({allowedModifiers:e,disallowedModifiers:t,stopOnStartOfClassStaticBlock:n,errorTemplate:r=X.InvalidModifierOnTypeMember},i){let a=(e,t,n,r)=>{t===n&&i[r]&&this.raise(X.InvalidModifiersOrder,{at:e,orderedModifiers:[n,r]})},o=(e,t,n,r)=>{(i[n]&&t===r||i[r]&&t===n)&&this.raise(X.IncompatibleModifiers,{at:e,modifiers:[n,r]})};for(;;){let{startLoc:s}=this.state,c=this.tsParseModifier(e.concat(t??[]),n);if(!c)break;an(c)?i.accessibility?this.raise(X.DuplicateAccessibilityModifier,{at:s,modifier:c}):(a(s,c,c,`override`),a(s,c,c,`static`),a(s,c,c,`readonly`),i.accessibility=c):on(c)?(i[c]&&this.raise(X.DuplicateModifier,{at:s,modifier:c}),i[c]=!0,a(s,c,`in`,`out`)):(Object.hasOwnProperty.call(i,c)?this.raise(X.DuplicateModifier,{at:s,modifier:c}):(a(s,c,`static`,`readonly`),a(s,c,`static`,`override`),a(s,c,`override`,`readonly`),a(s,c,`abstract`,`override`),o(s,c,`declare`,`override`),o(s,c,`static`,`abstract`)),i[c]=!0),t!=null&&t.includes(c)&&this.raise(r,{at:s,modifier:c})}}tsIsListTerminator(e){switch(e){case`EnumMembers`:case`TypeMembers`:return this.match(8);case`HeritageClauseElement`:return this.match(5);case`TupleElementTypes`:return this.match(3);case`TypeParametersOrArguments`:return this.match(48)}throw Error(`Unreachable`)}tsParseList(e,t){let n=[];for(;!this.tsIsListTerminator(e);)n.push(t());return n}tsParseDelimitedList(e,t,n){return tn(this.tsParseDelimitedListWorker(e,t,!0,n))}tsParseDelimitedListWorker(e,t,n,r){let i=[],a=-1;for(;!this.tsIsListTerminator(e);){a=-1;let r=t();if(r==null)return;if(i.push(r),this.eat(12))a=this.state.lastTokStart;else{if(this.tsIsListTerminator(e))break;n&&this.expect(12);return}}return r&&(r.value=a),i}tsParseBracketedList(e,t,n,r,i){r||(n?this.expect(0):this.expect(47));let a=this.tsParseDelimitedList(e,t,i);return n?this.expect(3):this.expect(48),a}tsParseImportType(){let e=this.startNode();return this.expect(83),this.expect(10),this.match(131)||this.raise(X.UnsupportedImportTypeArgument,{at:this.state.startLoc}),e.argument=super.parseExprAtom(),this.expect(11),this.eat(16)&&(e.qualifier=this.tsParseEntityName()),this.match(47)&&(e.typeParameters=this.tsParseTypeArguments()),this.finishNode(e,`TSImportType`)}tsParseEntityName(e=!0){let t=this.parseIdentifier(e);for(;this.eat(16);){let n=this.startNodeAtNode(t);n.left=t,n.right=this.parseIdentifier(e),t=this.finishNode(n,`TSQualifiedName`)}return t}tsParseTypeReference(){let e=this.startNode();return e.typeName=this.tsParseEntityName(),!this.hasPrecedingLineBreak()&&this.match(47)&&(e.typeParameters=this.tsParseTypeArguments()),this.finishNode(e,`TSTypeReference`)}tsParseThisTypePredicate(e){this.next();let t=this.startNodeAtNode(e);return t.parameterName=e,t.typeAnnotation=this.tsParseTypeAnnotation(!1),t.asserts=!1,this.finishNode(t,`TSTypePredicate`)}tsParseThisTypeNode(){let e=this.startNode();return this.next(),this.finishNode(e,`TSThisType`)}tsParseTypeQuery(){let e=this.startNode();return this.expect(87),e.exprName=this.match(83)?this.tsParseImportType():this.tsParseEntityName(),!this.hasPrecedingLineBreak()&&this.match(47)&&(e.typeParameters=this.tsParseTypeArguments()),this.finishNode(e,`TSTypeQuery`)}tsParseTypeParameter(e){let t=this.startNode();return e(t),t.name=this.tsParseTypeParameterName(),t.constraint=this.tsEatThenParseType(81),t.default=this.tsEatThenParseType(29),this.finishNode(t,`TSTypeParameter`)}tsTryParseTypeParameters(e){if(this.match(47))return this.tsParseTypeParameters(e)}tsParseTypeParameters(e){let t=this.startNode();this.match(47)||this.match(140)?this.next():this.unexpected();let n={value:-1};return t.params=this.tsParseBracketedList(`TypeParametersOrArguments`,this.tsParseTypeParameter.bind(this,e),!1,!0,n),t.params.length===0&&this.raise(X.EmptyTypeParameters,{at:t}),n.value!==-1&&this.addExtra(t,`trailingComma`,n.value),this.finishNode(t,`TSTypeParameterDeclaration`)}tsFillSignature(e,t){let n=e===19;t.typeParameters=this.tsTryParseTypeParameters(this.tsParseConstModifier),this.expect(10),t.parameters=this.tsParseBindingListForSignature(),(n||this.match(e))&&(t.typeAnnotation=this.tsParseTypeOrTypePredicateAnnotation(e))}tsParseBindingListForSignature(){return super.parseBindingList(11,41,Y.IS_FUNCTION_PARAMS).map(e=>(e.type!==`Identifier`&&e.type!==`RestElement`&&e.type!==`ObjectPattern`&&e.type!==`ArrayPattern`&&this.raise(X.UnsupportedSignatureParameterKind,{at:e,type:e.type}),e))}tsParseTypeMemberSemicolon(){!this.eat(12)&&!this.isLineTerminator()&&this.expect(13)}tsParseSignatureMember(e,t){return this.tsFillSignature(14,t),this.tsParseTypeMemberSemicolon(),this.finishNode(t,e)}tsIsUnambiguouslyIndexSignature(){return this.next(),A(this.state.type)?(this.next(),this.match(14)):!1}tsTryParseIndexSignature(e){if(!(this.match(0)&&this.tsLookAhead(this.tsIsUnambiguouslyIndexSignature.bind(this))))return;this.expect(0);let t=this.parseIdentifier();t.typeAnnotation=this.tsParseTypeAnnotation(),this.resetEndLocation(t),this.expect(3),e.parameters=[t];let n=this.tsTryParseTypeAnnotation();return n&&(e.typeAnnotation=n),this.tsParseTypeMemberSemicolon(),this.finishNode(e,`TSIndexSignature`)}tsParsePropertyOrMethodSignature(e,t){this.eat(17)&&(e.optional=!0);let n=e;if(this.match(10)||this.match(47)){t&&this.raise(X.ReadonlyForMethodSignature,{at:e});let r=n;r.kind&&this.match(47)&&this.raise(X.AccesorCannotHaveTypeParameters,{at:this.state.curPosition()}),this.tsFillSignature(14,r),this.tsParseTypeMemberSemicolon();let i=`parameters`,a=`typeAnnotation`;if(r.kind===`get`)r[i].length>0&&(this.raise(_.BadGetterArity,{at:this.state.curPosition()}),this.isThisParam(r[i][0])&&this.raise(X.AccesorCannotDeclareThisParameter,{at:this.state.curPosition()}));else if(r.kind===`set`){if(r[i].length!==1)this.raise(_.BadSetterArity,{at:this.state.curPosition()});else{let e=r[i][0];this.isThisParam(e)&&this.raise(X.AccesorCannotDeclareThisParameter,{at:this.state.curPosition()}),e.type===`Identifier`&&e.optional&&this.raise(X.SetAccesorCannotHaveOptionalParameter,{at:this.state.curPosition()}),e.type===`RestElement`&&this.raise(X.SetAccesorCannotHaveRestParameter,{at:this.state.curPosition()})}r[a]&&this.raise(X.SetAccesorCannotHaveReturnType,{at:r[a]})}else r.kind=`method`;return this.finishNode(r,`TSMethodSignature`)}{let e=n;t&&(e.readonly=!0);let r=this.tsTryParseTypeAnnotation();return r&&(e.typeAnnotation=r),this.tsParseTypeMemberSemicolon(),this.finishNode(e,`TSPropertySignature`)}}tsParseTypeMember(){let e=this.startNode();if(this.match(10)||this.match(47))return this.tsParseSignatureMember(`TSCallSignatureDeclaration`,e);if(this.match(77)){let t=this.startNode();return this.next(),this.match(10)||this.match(47)?this.tsParseSignatureMember(`TSConstructSignatureDeclaration`,e):(e.key=this.createIdentifier(t,`new`),this.tsParsePropertyOrMethodSignature(e,!1))}return this.tsParseModifiers({allowedModifiers:[`readonly`],disallowedModifiers:[`declare`,`abstract`,`private`,`protected`,`public`,`static`,`override`]},e),this.tsTryParseIndexSignature(e)||(super.parsePropertyName(e),!e.computed&&e.key.type===`Identifier`&&(e.key.name===`get`||e.key.name===`set`)&&this.tsTokenCanFollowModifier()&&(e.kind=e.key.name,super.parsePropertyName(e)),this.tsParsePropertyOrMethodSignature(e,!!e.readonly))}tsParseTypeLiteral(){let e=this.startNode();return e.members=this.tsParseObjectTypeMembers(),this.finishNode(e,`TSTypeLiteral`)}tsParseObjectTypeMembers(){this.expect(5);let e=this.tsParseList(`TypeMembers`,this.tsParseTypeMember.bind(this));return this.expect(8),e}tsIsStartOfMappedType(){return this.next(),this.eat(53)?this.isContextual(120):(this.isContextual(120)&&this.next(),!this.match(0)||(this.next(),!this.tsIsIdentifier())?!1:(this.next(),this.match(58)))}tsParseMappedTypeParameter(){let e=this.startNode();return e.name=this.tsParseTypeParameterName(),e.constraint=this.tsExpectThenParseType(58),this.finishNode(e,`TSTypeParameter`)}tsParseMappedType(){let e=this.startNode();return this.expect(5),this.match(53)?(e.readonly=this.state.value,this.next(),this.expectContextual(120)):this.eatContextual(120)&&(e.readonly=!0),this.expect(0),e.typeParameter=this.tsParseMappedTypeParameter(),e.nameType=this.eatContextual(93)?this.tsParseType():null,this.expect(3),this.match(53)?(e.optional=this.state.value,this.next(),this.expect(17)):this.eat(17)&&(e.optional=!0),e.typeAnnotation=this.tsTryParseType(),this.semicolon(),this.expect(8),this.finishNode(e,`TSMappedType`)}tsParseTupleType(){let e=this.startNode();e.elementTypes=this.tsParseBracketedList(`TupleElementTypes`,this.tsParseTupleElementType.bind(this),!0,!1);let t=!1,n=null;return e.elementTypes.forEach(e=>{let{type:r}=e;t&&r!==`TSRestType`&&r!==`TSOptionalType`&&!(r===`TSNamedTupleMember`&&e.optional)&&this.raise(X.OptionalTypeBeforeRequired,{at:e}),t||=r===`TSNamedTupleMember`&&e.optional||r===`TSOptionalType`;let i=r;r===`TSRestType`&&(e=e.typeAnnotation,i=e.type);let a=i===`TSNamedTupleMember`;n??=a,n!==a&&this.raise(X.MixedLabeledAndUnlabeledElements,{at:e})}),this.finishNode(e,`TSTupleType`)}tsParseTupleElementType(){let{startLoc:e}=this.state,t=this.eat(21),n=this.tsParseType(),r=this.eat(17);if(this.eat(14)){let e=this.startNodeAtNode(n);e.optional=r,n.type===`TSTypeReference`&&!n.typeParameters&&n.typeName.type===`Identifier`?e.label=n.typeName:(this.raise(X.InvalidTupleMemberLabel,{at:n}),e.label=n),e.elementType=this.tsParseType(),n=this.finishNode(e,`TSNamedTupleMember`)}else if(r){let e=this.startNodeAtNode(n);e.typeAnnotation=n,n=this.finishNode(e,`TSOptionalType`)}if(t){let t=this.startNodeAt(e);t.typeAnnotation=n,n=this.finishNode(t,`TSRestType`)}return n}tsParseParenthesizedType(){let e=this.startNode();return this.expect(10),e.typeAnnotation=this.tsParseType(),this.expect(11),this.finishNode(e,`TSParenthesizedType`)}tsParseFunctionOrConstructorType(e,t){let n=this.startNode();return e===`TSConstructorType`&&(n.abstract=!!t,t&&this.next(),this.next()),this.tsInAllowConditionalTypesContext(()=>this.tsFillSignature(19,n)),this.finishNode(n,e)}tsParseLiteralTypeNode(){let e=this.startNode();return e.literal=(()=>{switch(this.state.type){case 132:case 133:case 131:case 85:case 86:return super.parseExprAtom();default:throw this.unexpected()}})(),this.finishNode(e,`TSLiteralType`)}tsParseTemplateLiteralType(){let e=this.startNode();return e.literal=super.parseTemplate(!1),this.finishNode(e,`TSLiteralType`)}parseTemplateSubstitution(){return this.state.inType?this.tsParseType():super.parseTemplateSubstitution()}tsParseThisTypeOrThisTypePredicate(){let e=this.tsParseThisTypeNode();return this.isContextual(114)&&!this.hasPrecedingLineBreak()?this.tsParseThisTypePredicate(e):e}tsParseNonArrayType(){switch(this.state.type){case 131:case 132:case 133:case 85:case 86:return this.tsParseLiteralTypeNode();case 53:if(this.state.value===`-`){let e=this.startNode(),t=this.lookahead();if(t.type!==132&&t.type!==133)throw this.unexpected();return e.literal=this.parseMaybeUnary(),this.finishNode(e,`TSLiteralType`)}break;case 78:return this.tsParseThisTypeOrThisTypePredicate();case 87:return this.tsParseTypeQuery();case 83:return this.tsParseImportType();case 5:return this.tsLookAhead(this.tsIsStartOfMappedType.bind(this))?this.tsParseMappedType():this.tsParseTypeLiteral();case 0:return this.tsParseTupleType();case 10:return this.tsParseParenthesizedType();case 25:case 24:return this.tsParseTemplateLiteralType();default:{let{type:e}=this.state;if(A(e)||e===88||e===84){let t=e===88?`TSVoidKeyword`:e===84?`TSNullKeyword`:rn(this.state.value);if(t!==void 0&&this.lookaheadCharCode()!==46){let e=this.startNode();return this.next(),this.finishNode(e,t)}return this.tsParseTypeReference()}}}throw this.unexpected()}tsParseArrayTypeOrHigher(){let e=this.tsParseNonArrayType();for(;!this.hasPrecedingLineBreak()&&this.eat(0);)if(this.match(3)){let t=this.startNodeAtNode(e);t.elementType=e,this.expect(3),e=this.finishNode(t,`TSArrayType`)}else{let t=this.startNodeAtNode(e);t.objectType=e,t.indexType=this.tsParseType(),this.expect(3),e=this.finishNode(t,`TSIndexedAccessType`)}return e}tsParseTypeOperator(){let e=this.startNode(),t=this.state.value;return this.next(),e.operator=t,e.typeAnnotation=this.tsParseTypeOperatorOrHigher(),t===`readonly`&&this.tsCheckTypeAnnotationForReadOnly(e),this.finishNode(e,`TSTypeOperator`)}tsCheckTypeAnnotationForReadOnly(e){switch(e.typeAnnotation.type){case`TSTupleType`:case`TSArrayType`:return;default:this.raise(X.UnexpectedReadonly,{at:e})}}tsParseInferType(){let e=this.startNode();this.expectContextual(113);let t=this.startNode();return t.name=this.tsParseTypeParameterName(),t.constraint=this.tsTryParse(()=>this.tsParseConstraintForInferType()),e.typeParameter=this.finishNode(t,`TSTypeParameter`),this.finishNode(e,`TSInferType`)}tsParseConstraintForInferType(){if(this.eat(81)){let e=this.tsInDisallowConditionalTypesContext(()=>this.tsParseType());if(this.state.inDisallowConditionalTypesContext||!this.match(17))return e}}tsParseTypeOperatorOrHigher(){return ge(this.state.type)&&!this.state.containsEsc?this.tsParseTypeOperator():this.isContextual(113)?this.tsParseInferType():this.tsInAllowConditionalTypesContext(()=>this.tsParseArrayTypeOrHigher())}tsParseUnionOrIntersectionType(e,t,n){let r=this.startNode(),i=this.eat(n),a=[];do a.push(t());while(this.eat(n));return a.length===1&&!i?a[0]:(r.types=a,this.finishNode(r,e))}tsParseIntersectionTypeOrHigher(){return this.tsParseUnionOrIntersectionType(`TSIntersectionType`,this.tsParseTypeOperatorOrHigher.bind(this),45)}tsParseUnionTypeOrHigher(){return this.tsParseUnionOrIntersectionType(`TSUnionType`,this.tsParseIntersectionTypeOrHigher.bind(this),43)}tsIsStartOfFunctionType(){return this.match(47)?!0:this.match(10)&&this.tsLookAhead(this.tsIsUnambiguouslyStartOfFunctionType.bind(this))}tsSkipParameterStart(){if(A(this.state.type)||this.match(78))return this.next(),!0;if(this.match(5)){let{errors:e}=this.state,t=e.length;try{return this.parseObjectLike(8,!0),e.length===t}catch{return!1}}if(this.match(0)){this.next();let{errors:e}=this.state,t=e.length;try{return super.parseBindingList(3,93,Y.ALLOW_EMPTY),e.length===t}catch{return!1}}return!1}tsIsUnambiguouslyStartOfFunctionType(){return this.next(),!!(this.match(11)||this.match(21)||this.tsSkipParameterStart()&&(this.match(14)||this.match(12)||this.match(17)||this.match(29)||this.match(11)&&(this.next(),this.match(19))))}tsParseTypeOrTypePredicateAnnotation(e){return this.tsInType(()=>{let t=this.startNode();this.expect(e);let n=this.startNode(),r=!!this.tsTryParse(this.tsParseTypePredicateAsserts.bind(this));if(r&&this.match(78)){let e=this.tsParseThisTypeOrThisTypePredicate();return e.type===`TSThisType`?(n.parameterName=e,n.asserts=!0,n.typeAnnotation=null,e=this.finishNode(n,`TSTypePredicate`)):(this.resetStartLocationFromNode(e,n),e.asserts=!0),t.typeAnnotation=e,this.finishNode(t,`TSTypeAnnotation`)}let i=this.tsIsIdentifier()&&this.tsTryParse(this.tsParseTypePredicatePrefix.bind(this));if(!i)return r?(n.parameterName=this.parseIdentifier(),n.asserts=r,n.typeAnnotation=null,t.typeAnnotation=this.finishNode(n,`TSTypePredicate`),this.finishNode(t,`TSTypeAnnotation`)):this.tsParseTypeAnnotation(!1,t);let a=this.tsParseTypeAnnotation(!1);return n.parameterName=i,n.typeAnnotation=a,n.asserts=r,t.typeAnnotation=this.finishNode(n,`TSTypePredicate`),this.finishNode(t,`TSTypeAnnotation`)})}tsTryParseTypeOrTypePredicateAnnotation(){return this.match(14)?this.tsParseTypeOrTypePredicateAnnotation(14):void 0}tsTryParseTypeAnnotation(){return this.match(14)?this.tsParseTypeAnnotation():void 0}tsTryParseType(){return this.tsEatThenParseType(14)}tsParseTypePredicatePrefix(){let e=this.parseIdentifier();if(this.isContextual(114)&&!this.hasPrecedingLineBreak())return this.next(),e}tsParseTypePredicateAsserts(){if(this.state.type!==107)return!1;let e=this.state.containsEsc;return this.next(),!A(this.state.type)&&!this.match(78)?!1:(e&&this.raise(_.InvalidEscapedReservedWord,{at:this.state.lastTokStartLoc,reservedWord:`asserts`}),!0)}tsParseTypeAnnotation(e=!0,t=this.startNode()){return this.tsInType(()=>{e&&this.expect(14),t.typeAnnotation=this.tsParseType()}),this.finishNode(t,`TSTypeAnnotation`)}tsParseType(){nn(this.state.inType);let e=this.tsParseNonConditionalType();if(this.state.inDisallowConditionalTypesContext||this.hasPrecedingLineBreak()||!this.eat(81))return e;let t=this.startNodeAtNode(e);return t.checkType=e,t.extendsType=this.tsInDisallowConditionalTypesContext(()=>this.tsParseNonConditionalType()),this.expect(17),t.trueType=this.tsInAllowConditionalTypesContext(()=>this.tsParseType()),this.expect(14),t.falseType=this.tsInAllowConditionalTypesContext(()=>this.tsParseType()),this.finishNode(t,`TSConditionalType`)}isAbstractConstructorSignature(){return this.isContextual(122)&&this.lookahead().type===77}tsParseNonConditionalType(){return this.tsIsStartOfFunctionType()?this.tsParseFunctionOrConstructorType(`TSFunctionType`):this.match(77)?this.tsParseFunctionOrConstructorType(`TSConstructorType`):this.isAbstractConstructorSignature()?this.tsParseFunctionOrConstructorType(`TSConstructorType`,!0):this.tsParseUnionTypeOrHigher()}tsParseTypeAssertion(){this.getPluginOption(`typescript`,`disallowAmbiguousJSXLike`)&&this.raise(X.ReservedTypeAssertion,{at:this.state.startLoc});let e=this.startNode();return e.typeAnnotation=this.tsInType(()=>(this.next(),this.match(75)?this.tsParseTypeReference():this.tsParseType())),this.expect(48),e.expression=this.parseMaybeUnary(),this.finishNode(e,`TSTypeAssertion`)}tsParseHeritageClause(e){let t=this.state.startLoc,n=this.tsParseDelimitedList(`HeritageClauseElement`,()=>{let e=this.startNode();return e.expression=this.tsParseEntityName(),this.match(47)&&(e.typeParameters=this.tsParseTypeArguments()),this.finishNode(e,`TSExpressionWithTypeArguments`)});return n.length||this.raise(X.EmptyHeritageClauseType,{at:t,token:e}),n}tsParseInterfaceDeclaration(e,t={}){if(this.hasFollowingLineBreak())return null;this.expectContextual(127),t.declare&&(e.declare=!0),A(this.state.type)?(e.id=this.parseIdentifier(),this.checkIdentifier(e.id,130)):(e.id=null,this.raise(X.MissingInterfaceName,{at:this.state.startLoc})),e.typeParameters=this.tsTryParseTypeParameters(this.tsParseInOutConstModifiers),this.eat(81)&&(e.extends=this.tsParseHeritageClause(`extends`));let n=this.startNode();return n.body=this.tsInType(this.tsParseObjectTypeMembers.bind(this)),e.body=this.finishNode(n,`TSInterfaceBody`),this.finishNode(e,`TSInterfaceDeclaration`)}tsParseTypeAliasDeclaration(e){return e.id=this.parseIdentifier(),this.checkIdentifier(e.id,2),e.typeAnnotation=this.tsInType(()=>{if(e.typeParameters=this.tsTryParseTypeParameters(this.tsParseInOutModifiers),this.expect(29),this.isContextual(112)&&this.lookahead().type!==16){let e=this.startNode();return this.next(),this.finishNode(e,`TSIntrinsicKeyword`)}return this.tsParseType()}),this.semicolon(),this.finishNode(e,`TSTypeAliasDeclaration`)}tsInNoContext(e){let t=this.state.context;this.state.context=[t[0]];try{return e()}finally{this.state.context=t}}tsInType(e){let t=this.state.inType;this.state.inType=!0;try{return e()}finally{this.state.inType=t}}tsInDisallowConditionalTypesContext(e){let t=this.state.inDisallowConditionalTypesContext;this.state.inDisallowConditionalTypesContext=!0;try{return e()}finally{this.state.inDisallowConditionalTypesContext=t}}tsInAllowConditionalTypesContext(e){let t=this.state.inDisallowConditionalTypesContext;this.state.inDisallowConditionalTypesContext=!1;try{return e()}finally{this.state.inDisallowConditionalTypesContext=t}}tsEatThenParseType(e){return this.match(e)?this.tsNextThenParseType():void 0}tsExpectThenParseType(e){return this.tsDoThenParseType(()=>this.expect(e))}tsNextThenParseType(){return this.tsDoThenParseType(()=>this.next())}tsDoThenParseType(e){return this.tsInType(()=>(e(),this.tsParseType()))}tsParseEnumMember(){let e=this.startNode();return e.id=this.match(131)?super.parseStringLiteral(this.state.value):this.parseIdentifier(!0),this.eat(29)&&(e.initializer=super.parseMaybeAssignAllowIn()),this.finishNode(e,`TSEnumMember`)}tsParseEnumDeclaration(e,t={}){return t.const&&(e.const=!0),t.declare&&(e.declare=!0),this.expectContextual(124),e.id=this.parseIdentifier(),this.checkIdentifier(e.id,e.const?8971:8459),this.expect(5),e.members=this.tsParseDelimitedList(`EnumMembers`,this.tsParseEnumMember.bind(this)),this.expect(8),this.finishNode(e,`TSEnumDeclaration`)}tsParseModuleBlock(){let e=this.startNode();return this.scope.enter(0),this.expect(5),super.parseBlockOrModuleBlockBody(e.body=[],void 0,!0,8),this.scope.exit(),this.finishNode(e,`TSModuleBlock`)}tsParseModuleOrNamespaceDeclaration(e,t=!1){if(e.id=this.parseIdentifier(),t||this.checkIdentifier(e.id,1024),this.eat(16)){let t=this.startNode();this.tsParseModuleOrNamespaceDeclaration(t,!0),e.body=t}else this.scope.enter(256),this.prodParam.enter(0),e.body=this.tsParseModuleBlock(),this.prodParam.exit(),this.scope.exit();return this.finishNode(e,`TSModuleDeclaration`)}tsParseAmbientExternalModuleDeclaration(e){return this.isContextual(110)?(e.global=!0,e.id=this.parseIdentifier()):this.match(131)?e.id=super.parseStringLiteral(this.state.value):this.unexpected(),this.match(5)?(this.scope.enter(256),this.prodParam.enter(0),e.body=this.tsParseModuleBlock(),this.prodParam.exit(),this.scope.exit()):this.semicolon(),this.finishNode(e,`TSModuleDeclaration`)}tsParseImportEqualsDeclaration(e,t){e.isExport=t||!1,e.id=this.parseIdentifier(),this.checkIdentifier(e.id,Le),this.expect(29);let n=this.tsParseModuleReference();return e.importKind===`type`&&n.type!==`TSExternalModuleReference`&&this.raise(X.ImportAliasHasImportType,{at:n}),e.moduleReference=n,this.semicolon(),this.finishNode(e,`TSImportEqualsDeclaration`)}tsIsExternalModuleReference(){return this.isContextual(117)&&this.lookaheadCharCode()===40}tsParseModuleReference(){return this.tsIsExternalModuleReference()?this.tsParseExternalModuleReference():this.tsParseEntityName(!1)}tsParseExternalModuleReference(){let e=this.startNode();if(this.expectContextual(117),this.expect(10),!this.match(131))throw this.unexpected();return e.expression=super.parseExprAtom(),this.expect(11),this.finishNode(e,`TSExternalModuleReference`)}tsLookAhead(e){let t=this.state.clone(),n=e();return this.state=t,n}tsTryParseAndCatch(e){let t=this.tryParse(t=>e()||t());if(!t.aborted&&t.node)return t.error&&(this.state=t.failState),t.node}tsTryParse(e){let t=this.state.clone(),n=e();if(n!==void 0&&n!==!1)return n;this.state=t}tsTryParseDeclare(e){if(this.isLineTerminator())return;let t=this.state.type,n;return this.isContextual(99)&&(t=74,n=`let`),this.tsInAmbientContext(()=>{if(t===68)return e.declare=!0,super.parseFunctionStatement(e,!1,!1);if(t===80)return e.declare=!0,this.parseClass(e,!0,!1);if(t===124)return this.tsParseEnumDeclaration(e,{declare:!0});if(t===110)return this.tsParseAmbientExternalModuleDeclaration(e);if(t===75||t===74)return!this.match(75)||!this.isLookaheadContextual(`enum`)?(e.declare=!0,this.parseVarStatement(e,n||this.state.value,!0)):(this.expect(75),this.tsParseEnumDeclaration(e,{const:!0,declare:!0}));if(t===127){let t=this.tsParseInterfaceDeclaration(e,{declare:!0});if(t)return t}if(A(t))return this.tsParseDeclaration(e,this.state.value,!0,null)})}tsTryParseExportDeclaration(){return this.tsParseDeclaration(this.startNode(),this.state.value,!0,null)}tsParseExpressionStatement(e,t,n){switch(t.name){case`declare`:{let t=this.tsTryParseDeclare(e);if(t)return t.declare=!0,t;break}case`global`:if(this.match(5)){this.scope.enter(256),this.prodParam.enter(0);let n=e;return n.global=!0,n.id=t,n.body=this.tsParseModuleBlock(),this.scope.exit(),this.prodParam.exit(),this.finishNode(n,`TSModuleDeclaration`)}break;default:return this.tsParseDeclaration(e,t.name,!1,n)}}tsParseDeclaration(e,t,n,r){switch(t){case`abstract`:if(this.tsCheckLineTerminator(n)&&(this.match(80)||A(this.state.type)))return this.tsParseAbstractDeclaration(e,r);break;case`module`:if(this.tsCheckLineTerminator(n)){if(this.match(131))return this.tsParseAmbientExternalModuleDeclaration(e);if(A(this.state.type))return this.tsParseModuleOrNamespaceDeclaration(e)}break;case`namespace`:if(this.tsCheckLineTerminator(n)&&A(this.state.type))return this.tsParseModuleOrNamespaceDeclaration(e);break;case`type`:if(this.tsCheckLineTerminator(n)&&A(this.state.type))return this.tsParseTypeAliasDeclaration(e)}}tsCheckLineTerminator(e){return e?!this.hasFollowingLineBreak()&&(this.next(),!0):!this.isLineTerminator()}tsTryParseGenericAsyncArrowFunction(e){if(!this.match(47))return;let t=this.state.maybeInArrowParameters;this.state.maybeInArrowParameters=!0;let n=this.tsTryParseAndCatch(()=>{let t=this.startNodeAt(e);return t.typeParameters=this.tsParseTypeParameters(this.tsParseConstModifier),super.parseFunctionParams(t),t.returnType=this.tsTryParseTypeOrTypePredicateAnnotation(),this.expect(19),t});if(this.state.maybeInArrowParameters=t,n)return super.parseArrowExpression(n,null,!0)}tsParseTypeArgumentsInExpression(){if(this.reScan_lt()===47)return this.tsParseTypeArguments()}tsParseTypeArguments(){let e=this.startNode();return e.params=this.tsInType(()=>this.tsInNoContext(()=>(this.expect(47),this.tsParseDelimitedList(`TypeParametersOrArguments`,this.tsParseType.bind(this))))),e.params.length===0&&this.raise(X.EmptyTypeArguments,{at:e}),this.expect(48),this.finishNode(e,`TSTypeParameterInstantiation`)}tsIsDeclarationStart(){return _e(this.state.type)}isExportDefaultSpecifier(){return!this.tsIsDeclarationStart()&&super.isExportDefaultSpecifier()}parseAssignableListItem(e,t){let n=this.state.startLoc,r={};this.tsParseModifiers({allowedModifiers:[`public`,`private`,`protected`,`override`,`readonly`]},r);let i=r.accessibility,a=r.override,o=r.readonly;!(e&Y.IS_CONSTRUCTOR_PARAMS)&&(i||o||a)&&this.raise(X.UnexpectedParameterModifier,{at:n});let s=this.parseMaybeDefault();this.parseAssignableListItemTypes(s,e);let c=this.parseMaybeDefault(s.loc.start,s);if(i||o||a){let e=this.startNodeAt(n);return t.length&&(e.decorators=t),i&&(e.accessibility=i),o&&(e.readonly=o),a&&(e.override=a),c.type!==`Identifier`&&c.type!==`AssignmentPattern`&&this.raise(X.UnsupportedParameterPropertyKind,{at:e}),e.parameter=c,this.finishNode(e,`TSParameterProperty`)}return t.length&&(s.decorators=t),c}isSimpleParameter(e){return e.type===`TSParameterProperty`&&super.isSimpleParameter(e.parameter)||super.isSimpleParameter(e)}tsDisallowOptionalPattern(e){for(let t of e.params)t.type!==`Identifier`&&t.optional&&!this.state.isAmbientContext&&this.raise(X.PatternIsOptional,{at:t})}setArrowFunctionParameters(e,t,n){super.setArrowFunctionParameters(e,t,n),this.tsDisallowOptionalPattern(e)}parseFunctionBodyAndFinish(e,t,n=!1){this.match(14)&&(e.returnType=this.tsParseTypeOrTypePredicateAnnotation(14));let r=t===`FunctionDeclaration`?`TSDeclareFunction`:t===`ClassMethod`||t===`ClassPrivateMethod`?`TSDeclareMethod`:void 0;return r&&!this.match(5)&&this.isLineTerminator()?this.finishNode(e,r):r===`TSDeclareFunction`&&this.state.isAmbientContext&&(this.raise(X.DeclareFunctionHasImplementation,{at:e}),e.declare)?super.parseFunctionBodyAndFinish(e,r,n):(this.tsDisallowOptionalPattern(e),super.parseFunctionBodyAndFinish(e,t,n))}registerFunctionStatementId(e){!e.body&&e.id?this.checkIdentifier(e.id,Be):super.registerFunctionStatementId(e)}tsCheckForInvalidTypeCasts(e){e.forEach(e=>{e?.type===`TSTypeCastExpression`&&this.raise(X.UnexpectedTypeAnnotation,{at:e.typeAnnotation})})}toReferencedList(e,t){return this.tsCheckForInvalidTypeCasts(e),e}parseArrayLike(e,t,n,r){let i=super.parseArrayLike(e,t,n,r);return i.type===`ArrayExpression`&&this.tsCheckForInvalidTypeCasts(i.elements),i}parseSubscript(e,t,n,r){if(!this.hasPrecedingLineBreak()&&this.match(35)){this.state.canStartJSXElement=!1,this.next();let n=this.startNodeAt(t);return n.expression=e,this.finishNode(n,`TSNonNullExpression`)}let i=!1;if(this.match(18)&&this.lookaheadCharCode()===60){if(n)return r.stop=!0,e;r.optionalChainMember=i=!0,this.next()}if(this.match(47)||this.match(51)){let a,o=this.tsTryParseAndCatch(()=>{if(!n&&this.atPossibleAsyncArrow(e)){let e=this.tsTryParseGenericAsyncArrowFunction(t);if(e)return e}let o=this.tsParseTypeArgumentsInExpression();if(!o)return;if(i&&!this.match(10)){a=this.state.curPosition();return}if(ye(this.state.type)){let n=super.parseTaggedTemplateExpression(e,t,r);return n.typeParameters=o,n}if(!n&&this.eat(10)){let n=this.startNodeAt(t);return n.callee=e,n.arguments=this.parseCallExpressionArguments(11,!1),this.tsCheckForInvalidTypeCasts(n.arguments),n.typeParameters=o,r.optionalChainMember&&(n.optional=i),this.finishCallExpression(n,r.optionalChainMember)}let s=this.state.type;if(s===48||s===52||s!==10&&fe(s)&&!this.hasPrecedingLineBreak())return;let c=this.startNodeAt(t);return c.expression=e,c.typeParameters=o,this.finishNode(c,`TSInstantiationExpression`)});if(a&&this.unexpected(a,10),o)return o.type===`TSInstantiationExpression`&&(this.match(16)||this.match(18)&&this.lookaheadCharCode()!==40)&&this.raise(X.InvalidPropertyAccessAfterInstantiationExpression,{at:this.state.startLoc}),o}return super.parseSubscript(e,t,n,r)}parseNewCallee(e){var t;super.parseNewCallee(e);let{callee:n}=e;n.type===`TSInstantiationExpression`&&!((t=n.extra)!=null&&t.parenthesized)&&(e.typeParameters=n.typeParameters,e.callee=n.expression)}parseExprOp(e,t,n){let r;if(R(58)>n&&!this.hasPrecedingLineBreak()&&(this.isContextual(93)||(r=this.isContextual(118)))){let i=this.startNodeAt(t);return i.expression=e,i.typeAnnotation=this.tsInType(()=>(this.next(),this.match(75)?(r&&this.raise(_.UnexpectedKeyword,{at:this.state.startLoc,keyword:`const`}),this.tsParseTypeReference()):this.tsParseType())),this.finishNode(i,r?`TSSatisfiesExpression`:`TSAsExpression`),this.reScan_lt_gt(),this.parseExprOp(i,t,n)}return super.parseExprOp(e,t,n)}checkReservedWord(e,t,n,r){this.state.isAmbientContext||super.checkReservedWord(e,t,n,r)}checkImportReflection(e){super.checkImportReflection(e),e.module&&e.importKind!==`value`&&this.raise(X.ImportReflectionHasImportType,{at:e.specifiers[0].loc.start})}checkDuplicateExports(){}parseImport(e){if(e.importKind=`value`,A(this.state.type)||this.match(55)||this.match(5)){let t=this.lookahead();if(this.isContextual(128)&&t.type!==12&&t.type!==97&&t.type!==29&&(e.importKind=`type`,this.next(),t=this.lookahead()),A(this.state.type)&&t.type===29)return this.tsParseImportEqualsDeclaration(e)}let t=super.parseImport(e);return t.importKind===`type`&&t.specifiers.length>1&&t.specifiers[0].type===`ImportDefaultSpecifier`&&this.raise(X.TypeImportCannotSpecifyDefaultAndNamed,{at:t}),t}parseExport(e,t){if(this.match(83))return this.next(),this.isContextual(128)&&this.lookaheadCharCode()!==61?(e.importKind=`type`,this.next()):e.importKind=`value`,this.tsParseImportEqualsDeclaration(e,!0);if(this.eat(29)){let t=e;return t.expression=super.parseExpression(),this.semicolon(),this.finishNode(t,`TSExportAssignment`)}if(this.eatContextual(93)){let t=e;return this.expectContextual(126),t.id=this.parseIdentifier(),this.semicolon(),this.finishNode(t,`TSNamespaceExportDeclaration`)}if(e.exportKind=`value`,this.isContextual(128)){let t=this.lookaheadCharCode();(t===123||t===42)&&(this.next(),e.exportKind=`type`)}return super.parseExport(e,t)}isAbstractClass(){return this.isContextual(122)&&this.lookahead().type===80}parseExportDefaultExpression(){if(this.isAbstractClass()){let e=this.startNode();return this.next(),e.abstract=!0,this.parseClass(e,!0,!0)}if(this.match(127)){let e=this.tsParseInterfaceDeclaration(this.startNode());if(e)return e}return super.parseExportDefaultExpression()}parseVarStatement(e,t,n=!1){let{isAmbientContext:r}=this.state,i=super.parseVarStatement(e,t,n||r);if(!r)return i;for(let{id:e,init:n}of i.declarations)n&&(t!==`const`||e.typeAnnotation?this.raise(X.InitializerNotAllowedInAmbientContext,{at:n}):ln(n,this.hasPlugin(`estree`))||this.raise(X.ConstInitiailizerMustBeStringOrNumericLiteralOrLiteralEnumReference,{at:n}));return i}parseStatementContent(e,t){if(this.match(75)&&this.isLookaheadContextual(`enum`)){let e=this.startNode();return this.expect(75),this.tsParseEnumDeclaration(e,{const:!0})}if(this.isContextual(124))return this.tsParseEnumDeclaration(this.startNode());if(this.isContextual(127)){let e=this.tsParseInterfaceDeclaration(this.startNode());if(e)return e}return super.parseStatementContent(e,t)}parseAccessModifier(){return this.tsParseModifier([`public`,`protected`,`private`])}tsHasSomeModifiers(e,t){return t.some(t=>an(t)?e.accessibility===t:!!e[t])}tsIsStartOfStaticBlocks(){return this.isContextual(104)&&this.lookaheadCharCode()===123}parseClassMember(e,t,n){let r=[`declare`,`private`,`public`,`protected`,`override`,`abstract`,`readonly`,`static`];this.tsParseModifiers({allowedModifiers:r,disallowedModifiers:[`in`,`out`],stopOnStartOfClassStaticBlock:!0,errorTemplate:X.InvalidModifierOnTypeParameterPositions},t);let i=()=>{this.tsIsStartOfStaticBlocks()?(this.next(),this.next(),this.tsHasSomeModifiers(t,r)&&this.raise(X.StaticBlockCannotHaveModifier,{at:this.state.curPosition()}),super.parseClassStaticBlock(e,t)):this.parseClassMemberWithIsStatic(e,t,n,!!t.static)};t.declare?this.tsInAmbientContext(i):i()}parseClassMemberWithIsStatic(e,t,n,r){let i=this.tsTryParseIndexSignature(t);i?(e.body.push(i),t.abstract&&this.raise(X.IndexSignatureHasAbstract,{at:t}),t.accessibility&&this.raise(X.IndexSignatureHasAccessibility,{at:t,modifier:t.accessibility}),t.declare&&this.raise(X.IndexSignatureHasDeclare,{at:t}),t.override&&this.raise(X.IndexSignatureHasOverride,{at:t})):(!this.state.inAbstractClass&&t.abstract&&this.raise(X.NonAbstractClassHasAbstractMethod,{at:t}),t.override&&(n.hadSuperClass||this.raise(X.OverrideNotInSubClass,{at:t})),super.parseClassMemberWithIsStatic(e,t,n,r))}parsePostMemberNameModifiers(e){this.eat(17)&&(e.optional=!0),e.readonly&&this.match(10)&&this.raise(X.ClassMethodHasReadonly,{at:e}),e.declare&&this.match(10)&&this.raise(X.ClassMethodHasDeclare,{at:e})}parseExpressionStatement(e,t,n){return(t.type===`Identifier`?this.tsParseExpressionStatement(e,t,n):void 0)||super.parseExpressionStatement(e,t,n)}shouldParseExportDeclaration(){return this.tsIsDeclarationStart()?!0:super.shouldParseExportDeclaration()}parseConditional(e,t,n){if(!this.state.maybeInArrowParameters||!this.match(17))return super.parseConditional(e,t,n);let r=this.tryParse(()=>super.parseConditional(e,t));return r.node?(r.error&&(this.state=r.failState),r.node):(r.error&&super.setOptionalParametersError(n,r.error),e)}parseParenItem(e,t){if(e=super.parseParenItem(e,t),this.eat(17)&&(e.optional=!0,this.resetEndLocation(e)),this.match(14)){let n=this.startNodeAt(t);return n.expression=e,n.typeAnnotation=this.tsParseTypeAnnotation(),this.finishNode(n,`TSTypeCastExpression`)}return e}parseExportDeclaration(e){if(!this.state.isAmbientContext&&this.isContextual(123))return this.tsInAmbientContext(()=>this.parseExportDeclaration(e));let t=this.state.startLoc,n=this.eatContextual(123);if(n&&(this.isContextual(123)||!this.shouldParseExportDeclaration()))throw this.raise(X.ExpectedAmbientAfterExportDeclare,{at:this.state.startLoc});let r=A(this.state.type)&&this.tsTryParseExportDeclaration()||super.parseExportDeclaration(e);return r?((r.type===`TSInterfaceDeclaration`||r.type===`TSTypeAliasDeclaration`||n)&&(e.exportKind=`type`),n&&(this.resetStartLocation(r,t),r.declare=!0),r):null}parseClassId(e,t,n,r){if((!t||n)&&this.isContextual(111))return;super.parseClassId(e,t,n,e.declare?Be:Re);let i=this.tsTryParseTypeParameters(this.tsParseInOutConstModifiers);i&&(e.typeParameters=i)}parseClassPropertyAnnotation(e){e.optional||(this.eat(35)?e.definite=!0:this.eat(17)&&(e.optional=!0));let t=this.tsTryParseTypeAnnotation();t&&(e.typeAnnotation=t)}parseClassProperty(e){if(this.parseClassPropertyAnnotation(e),this.state.isAmbientContext&&(!e.readonly||e.typeAnnotation)&&this.match(29)&&this.raise(X.DeclareClassFieldHasInitializer,{at:this.state.startLoc}),e.abstract&&this.match(29)){let{key:t}=e;this.raise(X.AbstractPropertyHasInitializer,{at:this.state.startLoc,propertyName:t.type===`Identifier`&&!e.computed?t.name:`[${this.input.slice(t.start,t.end)}]`})}return super.parseClassProperty(e)}parseClassPrivateProperty(e){return e.abstract&&this.raise(X.PrivateElementHasAbstract,{at:e}),e.accessibility&&this.raise(X.PrivateElementHasAccessibility,{at:e,modifier:e.accessibility}),this.parseClassPropertyAnnotation(e),super.parseClassPrivateProperty(e)}parseClassAccessorProperty(e){return this.parseClassPropertyAnnotation(e),e.optional&&this.raise(X.AccessorCannotBeOptional,{at:e}),super.parseClassAccessorProperty(e)}pushClassMethod(e,t,n,r,i,a){let o=this.tsTryParseTypeParameters(this.tsParseConstModifier);o&&i&&this.raise(X.ConstructorHasTypeParameters,{at:o});let{declare:s=!1,kind:c}=t;s&&(c===`get`||c===`set`)&&this.raise(X.DeclareAccessor,{at:t,kind:c}),o&&(t.typeParameters=o),super.pushClassMethod(e,t,n,r,i,a)}pushClassPrivateMethod(e,t,n,r){let i=this.tsTryParseTypeParameters(this.tsParseConstModifier);i&&(t.typeParameters=i),super.pushClassPrivateMethod(e,t,n,r)}declareClassPrivateMethodInScope(e,t){e.type!==`TSDeclareMethod`&&(e.type!==`MethodDefinition`||e.value.body)&&super.declareClassPrivateMethodInScope(e,t)}parseClassSuper(e){super.parseClassSuper(e),e.superClass&&(this.match(47)||this.match(51))&&(e.superTypeParameters=this.tsParseTypeArgumentsInExpression()),this.eatContextual(111)&&(e.implements=this.tsParseHeritageClause(`implements`))}parseObjPropValue(e,t,n,r,i,a,o){let s=this.tsTryParseTypeParameters(this.tsParseConstModifier);return s&&(e.typeParameters=s),super.parseObjPropValue(e,t,n,r,i,a,o)}parseFunctionParams(e,t){let n=this.tsTryParseTypeParameters(this.tsParseConstModifier);n&&(e.typeParameters=n),super.parseFunctionParams(e,t)}parseVarId(e,t){super.parseVarId(e,t),e.id.type===`Identifier`&&!this.hasPrecedingLineBreak()&&this.eat(35)&&(e.definite=!0);let n=this.tsTryParseTypeAnnotation();n&&(e.id.typeAnnotation=n,this.resetEndLocation(e.id))}parseAsyncArrowFromCallExpression(e,t){return this.match(14)&&(e.returnType=this.tsParseTypeAnnotation()),super.parseAsyncArrowFromCallExpression(e,t)}parseMaybeAssign(e,t){var n,r,i,a,o;let s,c,l;if(this.hasPlugin(`jsx`)&&(this.match(140)||this.match(47))){if(s=this.state.clone(),c=this.tryParse(()=>super.parseMaybeAssign(e,t),s),!c.error)return c.node;let{context:n}=this.state,r=n[n.length-1];(r===b.j_oTag||r===b.j_expr)&&n.pop()}if(!((n=c)!=null&&n.error)&&!this.match(47))return super.parseMaybeAssign(e,t);s&&s!==this.state||(s=this.state.clone());let u,d=this.tryParse(n=>{var r;u=this.tsParseTypeParameters(this.tsParseConstModifier);let i=super.parseMaybeAssign(e,t);return(i.type!==`ArrowFunctionExpression`||(r=i.extra)!=null&&r.parenthesized)&&n(),u?.params.length!==0&&this.resetStartLocationFromNode(i,u),i.typeParameters=u,i},s);if(!d.error&&!d.aborted)return u&&this.reportReservedArrowTypeParam(u),d.node;if(!c&&(nn(!this.hasPlugin(`jsx`)),l=this.tryParse(()=>super.parseMaybeAssign(e,t),s),!l.error))return l.node;if((r=c)!=null&&r.node)return this.state=c.failState,c.node;if(d.node)return this.state=d.failState,u&&this.reportReservedArrowTypeParam(u),d.node;if((i=l)!=null&&i.node)return this.state=l.failState,l.node;throw(a=c)!=null&&a.thrown?c.error:d.thrown?d.error:(o=l)!=null&&o.thrown?l.error:c?.error||d.error||l?.error}reportReservedArrowTypeParam(e){var t;e.params.length===1&&!e.params[0].constraint&&!((t=e.extra)!=null&&t.trailingComma)&&this.getPluginOption(`typescript`,`disallowAmbiguousJSXLike`)&&this.raise(X.ReservedArrowTypeParam,{at:e})}parseMaybeUnary(e,t){return!this.hasPlugin(`jsx`)&&this.match(47)?this.tsParseTypeAssertion():super.parseMaybeUnary(e,t)}parseArrow(e){if(this.match(14)){let t=this.tryParse(e=>{let t=this.tsParseTypeOrTypePredicateAnnotation(14);return(this.canInsertSemicolon()||!this.match(19))&&e(),t});if(t.aborted)return;t.thrown||(t.error&&(this.state=t.failState),e.returnType=t.node)}return super.parseArrow(e)}parseAssignableListItemTypes(e,t){if(!(t&Y.IS_FUNCTION_PARAMS))return e;this.eat(17)&&(e.optional=!0);let n=this.tsTryParseTypeAnnotation();return n&&(e.typeAnnotation=n),this.resetEndLocation(e),e}isAssignable(e,t){switch(e.type){case`TSTypeCastExpression`:return this.isAssignable(e.expression,t);case`TSParameterProperty`:return!0;default:return super.isAssignable(e,t)}}toAssignable(e,t=!1){switch(e.type){case`ParenthesizedExpression`:this.toAssignableParenthesizedExpression(e,t);break;case`TSAsExpression`:case`TSSatisfiesExpression`:case`TSNonNullExpression`:case`TSTypeAssertion`:t?this.expressionScope.recordArrowParameterBindingError(X.UnexpectedTypeCastInParameter,{at:e}):this.raise(X.UnexpectedTypeCastInParameter,{at:e}),this.toAssignable(e.expression,t);break;case`AssignmentExpression`:!t&&e.left.type===`TSTypeCastExpression`&&(e.left=this.typeCastToParameter(e.left));default:super.toAssignable(e,t)}}toAssignableParenthesizedExpression(e,t){switch(e.expression.type){case`TSAsExpression`:case`TSSatisfiesExpression`:case`TSNonNullExpression`:case`TSTypeAssertion`:case`ParenthesizedExpression`:this.toAssignable(e.expression,t);break;default:super.toAssignable(e,t)}}checkToRestConversion(e,t){switch(e.type){case`TSAsExpression`:case`TSSatisfiesExpression`:case`TSTypeAssertion`:case`TSNonNullExpression`:this.checkToRestConversion(e.expression,!1);break;default:super.checkToRestConversion(e,t)}}isValidLVal(e,t,n){return en({TSTypeCastExpression:!0,TSParameterProperty:`parameter`,TSNonNullExpression:`expression`,TSAsExpression:(n!==64||!t)&&[`expression`,!0],TSSatisfiesExpression:(n!==64||!t)&&[`expression`,!0],TSTypeAssertion:(n!==64||!t)&&[`expression`,!0]},e)||super.isValidLVal(e,t,n)}parseBindingAtom(){switch(this.state.type){case 78:return this.parseIdentifier(!0);default:return super.parseBindingAtom()}}parseMaybeDecoratorArguments(e){if(this.match(47)||this.match(51)){let t=this.tsParseTypeArgumentsInExpression();if(this.match(10)){let n=super.parseMaybeDecoratorArguments(e);return n.typeParameters=t,n}this.unexpected(null,10)}return super.parseMaybeDecoratorArguments(e)}checkCommaAfterRest(e){return this.state.isAmbientContext&&this.match(12)&&this.lookaheadCharCode()===e?(this.next(),!1):super.checkCommaAfterRest(e)}isClassMethod(){return this.match(47)||super.isClassMethod()}isClassProperty(){return this.match(35)||this.match(14)||super.isClassProperty()}parseMaybeDefault(e,t){let n=super.parseMaybeDefault(e,t);return n.type===`AssignmentPattern`&&n.typeAnnotation&&n.right.start<n.typeAnnotation.start&&this.raise(X.TypeAnnotationAfterAssign,{at:n.typeAnnotation}),n}getTokenFromCode(e){if(this.state.inType){if(e===62)return this.finishOp(48,1);if(e===60)return this.finishOp(47,1)}return super.getTokenFromCode(e)}reScan_lt_gt(){let{type:e}=this.state;e===47?(--this.state.pos,this.readToken_lt()):e===48&&(--this.state.pos,this.readToken_gt())}reScan_lt(){let{type:e}=this.state;return e===51?(this.state.pos-=2,this.finishOp(47,1),47):e}toAssignableList(e,t,n){for(let t=0;t<e.length;t++){let n=e[t];n?.type===`TSTypeCastExpression`&&(e[t]=this.typeCastToParameter(n))}super.toAssignableList(e,t,n)}typeCastToParameter(e){return e.expression.typeAnnotation=e.typeAnnotation,this.resetEndLocation(e.expression,e.typeAnnotation.loc.end),e.expression}shouldParseArrow(e){return this.match(14)?e.every(e=>this.isAssignable(e,!0)):super.shouldParseArrow(e)}shouldParseAsyncArrow(){return this.match(14)||super.shouldParseAsyncArrow()}canHaveLeadingDecorator(){return super.canHaveLeadingDecorator()||this.isAbstractClass()}jsxParseOpeningElementAfterName(e){if(this.match(47)||this.match(51)){let t=this.tsTryParseAndCatch(()=>this.tsParseTypeArgumentsInExpression());t&&(e.typeParameters=t)}return super.jsxParseOpeningElementAfterName(e)}getGetterSetterExpectedParamCount(e){let t=super.getGetterSetterExpectedParamCount(e),n=this.getObjectOrClassMethodParams(e)[0];return n&&this.isThisParam(n)?t+1:t}parseCatchClauseParam(){let e=super.parseCatchClauseParam(),t=this.tsTryParseTypeAnnotation();return t&&(e.typeAnnotation=t,this.resetEndLocation(e)),e}tsInAmbientContext(e){let t=this.state.isAmbientContext;this.state.isAmbientContext=!0;try{return e()}finally{this.state.isAmbientContext=t}}parseClass(e,t,n){let r=this.state.inAbstractClass;this.state.inAbstractClass=!!e.abstract;try{return super.parseClass(e,t,n)}finally{this.state.inAbstractClass=r}}tsParseAbstractDeclaration(e,t){if(this.match(80))return e.abstract=!0,this.maybeTakeDecorators(t,this.parseClass(e,!0,!1));if(this.isContextual(127)){if(!this.hasFollowingLineBreak())return e.abstract=!0,this.raise(X.NonClassMethodPropertyHasAbstractModifer,{at:e}),this.tsParseInterfaceDeclaration(e)}else this.unexpected(null,80)}parseMethod(e,t,n,r,i,a,o){let s=super.parseMethod(e,t,n,r,i,a,o);if(s.abstract&&(this.hasPlugin(`estree`)?s.value.body:s.body)){let{key:e}=s;this.raise(X.AbstractMethodHasImplementation,{at:s,methodName:e.type===`Identifier`&&!s.computed?e.name:`[${this.input.slice(e.start,e.end)}]`})}return s}tsParseTypeParameterName(){return this.parseIdentifier().name}shouldParseAsAmbientContext(){return!!this.getPluginOption(`typescript`,`dts`)}parse(){return this.shouldParseAsAmbientContext()&&(this.state.isAmbientContext=!0),super.parse()}getExpression(){return this.shouldParseAsAmbientContext()&&(this.state.isAmbientContext=!0),super.getExpression()}parseExportSpecifier(e,t,n,r){return!t&&r?(this.parseTypeOnlyImportExportSpecifier(e,!1,n),this.finishNode(e,`ExportSpecifier`)):(e.exportKind=`value`,super.parseExportSpecifier(e,t,n,r))}parseImportSpecifier(e,t,n,r,i){return!t&&r?(this.parseTypeOnlyImportExportSpecifier(e,!0,n),this.finishNode(e,`ImportSpecifier`)):(e.importKind=`value`,super.parseImportSpecifier(e,t,n,r,n?Ve:Le))}parseTypeOnlyImportExportSpecifier(e,t,n){let r=t?`imported`:`local`,i=t?`local`:`exported`,a=e[r],o,s=!1,c=!0,l=a.loc.start;if(this.isContextual(93)){let e=this.parseIdentifier();if(this.isContextual(93)){let n=this.parseIdentifier();j(this.state.type)?(s=!0,a=e,o=t?this.parseIdentifier():this.parseModuleExportName(),c=!1):(o=n,c=!1)}else j(this.state.type)?(c=!1,o=t?this.parseIdentifier():this.parseModuleExportName()):(s=!0,a=e)}else j(this.state.type)&&(s=!0,t?(a=this.parseIdentifier(!0),this.isContextual(93)||this.checkReservedWord(a.name,a.loc.start,!0,!0)):a=this.parseModuleExportName());s&&n&&this.raise(t?X.TypeModifierIsUsedInTypeImports:X.TypeModifierIsUsedInTypeExports,{at:l}),e[r]=a,e[i]=o;let u=t?`importKind`:`exportKind`;e[u]=s?`type`:`value`,c&&this.eatContextual(93)&&(e[i]=t?this.parseIdentifier():this.parseModuleExportName()),e[i]||(e[i]=K(e[r])),t&&this.checkIdentifier(e[i],s?Ve:Le)}});function cn(e){if(e.type!==`MemberExpression`)return!1;let{computed:t,property:n}=e;return t&&n.type!==`StringLiteral`&&(n.type!==`TemplateLiteral`||n.expressions.length>0)?!1:fn(e.object)}function ln(e,t){var n;let{type:r}=e;if((n=e.extra)!=null&&n.parenthesized)return!1;if(t){if(r===`Literal`){let{value:t}=e;if(typeof t==`string`||typeof t==`boolean`)return!0}}else if(r===`StringLiteral`||r===`BooleanLiteral`)return!0;return!!(un(e,t)||dn(e,t)||r===`TemplateLiteral`&&e.expressions.length===0||cn(e))}function un(e,t){return t?e.type===`Literal`&&(typeof e.value==`number`||`bigint`in e):e.type===`NumericLiteral`||e.type===`BigIntLiteral`}function dn(e,t){if(e.type===`UnaryExpression`){let{operator:n,argument:r}=e;if(n===`-`&&un(r,t))return!0}return!1}function fn(e){return e.type===`Identifier`?!0:e.type!==`MemberExpression`||e.computed?!1:fn(e.object)}let pn=g`placeholders`({ClassNameIsRequired:`A class name is required.`,UnexpectedSpace:`Unexpected space in placeholder.`});var mn=(e=>class extends e{parsePlaceholder(e){if(this.match(142)){let t=this.startNode();return this.next(),this.assertNoSpace(),t.name=super.parseIdentifier(!0),this.assertNoSpace(),this.expect(142),this.finishPlaceholder(t,e)}}finishPlaceholder(e,t){let n=!!(e.expectedNode&&e.type===`Placeholder`);return e.expectedNode=t,n?e:this.finishNode(e,`Placeholder`)}getTokenFromCode(e){return e===37&&this.input.charCodeAt(this.state.pos+1)===37?this.finishOp(142,2):super.getTokenFromCode(e)}parseExprAtom(e){return this.parsePlaceholder(`Expression`)||super.parseExprAtom(e)}parseIdentifier(e){return this.parsePlaceholder(`Identifier`)||super.parseIdentifier(e)}checkReservedWord(e,t,n,r){e!==void 0&&super.checkReservedWord(e,t,n,r)}parseBindingAtom(){return this.parsePlaceholder(`Pattern`)||super.parseBindingAtom()}isValidLVal(e,t,n){return e===`Placeholder`||super.isValidLVal(e,t,n)}toAssignable(e,t){e&&e.type===`Placeholder`&&e.expectedNode===`Expression`?e.expectedNode=`Pattern`:super.toAssignable(e,t)}chStartsBindingIdentifier(e,t){return!!(super.chStartsBindingIdentifier(e,t)||this.lookahead().type===142)}verifyBreakContinue(e,t){e.label&&e.label.type===`Placeholder`||super.verifyBreakContinue(e,t)}parseExpressionStatement(e,t){if(t.type!==`Placeholder`||t.extra&&t.extra.parenthesized)return super.parseExpressionStatement(e,t);if(this.match(14)){let n=e;return n.label=this.finishPlaceholder(t,`Identifier`),this.next(),n.body=super.parseStatementOrSloppyAnnexBFunctionDeclaration(),this.finishNode(n,`LabeledStatement`)}return this.semicolon(),e.name=t.name,this.finishPlaceholder(e,`Statement`)}parseBlock(e,t,n){return this.parsePlaceholder(`BlockStatement`)||super.parseBlock(e,t,n)}parseFunctionId(e){return this.parsePlaceholder(`Identifier`)||super.parseFunctionId(e)}parseClass(e,t,n){let r=t?`ClassDeclaration`:`ClassExpression`;this.next();let i=this.state.strict,a=this.parsePlaceholder(`Identifier`);if(a){if(this.match(81)||this.match(142)||this.match(5))e.id=a;else if(n||!t)return e.id=null,e.body=this.finishPlaceholder(a,`ClassBody`),this.finishNode(e,r);else throw this.raise(pn.ClassNameIsRequired,{at:this.state.startLoc})}else this.parseClassId(e,t,n);return super.parseClassSuper(e),e.body=this.parsePlaceholder(`ClassBody`)||super.parseClassBody(!!e.superClass,i),this.finishNode(e,r)}parseExport(e,t){let n=this.parsePlaceholder(`Identifier`);if(!n)return super.parseExport(e,t);if(!this.isContextual(97)&&!this.match(12))return e.specifiers=[],e.source=null,e.declaration=this.finishPlaceholder(n,`Declaration`),this.finishNode(e,`ExportNamedDeclaration`);this.expectPlugin(`exportDefaultFrom`);let r=this.startNode();return r.exported=n,e.specifiers=[this.finishNode(r,`ExportDefaultSpecifier`)],super.parseExport(e,t)}isExportDefaultSpecifier(){if(this.match(65)){let e=this.nextTokenStart();if(this.isUnparsedContextual(e,`from`)&&this.input.startsWith(L(142),this.nextTokenStartSince(e+4)))return!0}return super.isExportDefaultSpecifier()}maybeParseExportDefaultSpecifier(e){return e.specifiers&&e.specifiers.length>0?!0:super.maybeParseExportDefaultSpecifier(e)}checkExport(e){let{specifiers:t}=e;t!=null&&t.length&&(e.specifiers=t.filter(e=>e.exported.type===`Placeholder`)),super.checkExport(e),e.specifiers=t}parseImport(e){let t=this.parsePlaceholder(`Identifier`);if(!t)return super.parseImport(e);if(e.specifiers=[],!this.isContextual(97)&&!this.match(12))return e.source=this.finishPlaceholder(t,`StringLiteral`),this.semicolon(),this.finishNode(e,`ImportDeclaration`);let n=this.startNodeAtNode(t);return n.local=t,e.specifiers.push(this.finishNode(n,`ImportDefaultSpecifier`)),this.eat(12)&&(this.maybeParseStarImportSpecifier(e)||this.parseNamedImportSpecifiers(e)),this.expectContextual(97),e.source=this.parseImportSource(),this.semicolon(),this.finishNode(e,`ImportDeclaration`)}parseImportSource(){return this.parsePlaceholder(`StringLiteral`)||super.parseImportSource()}assertNoSpace(){this.state.start>this.state.lastTokEndLoc.index&&this.raise(pn.UnexpectedSpace,{at:this.state.lastTokEndLoc})}}),hn=(e=>class extends e{parseV8Intrinsic(){if(this.match(54)){let e=this.state.startLoc,t=this.startNode();if(this.next(),A(this.state.type)){let e=this.parseIdentifierName(),n=this.createIdentifier(t,e);if(n.type=`V8IntrinsicIdentifier`,this.match(10))return n}this.unexpected(e)}}parseExprAtom(e){return this.parseV8Intrinsic()||super.parseExprAtom(e)}});function Z(e,t){let[n,r]=typeof t==`string`?[t,{}]:t,i=Object.keys(r),a=i.length===0;return e.some(e=>{if(typeof e==`string`)return a&&e===n;{let[t,a]=e;if(t!==n)return!1;for(let e of i)if(a[e]!==r[e])return!1;return!0}})}function gn(e,t,n){let r=e.find(e=>Array.isArray(e)?e[0]===t:e===t);return r&&Array.isArray(r)&&r.length>1?r[1][n]:null}let _n=[`minimal`,`fsharp`,`hack`,`smart`],vn=[`^^`,`@@`,`^`,`%`,`#`],yn=[`hash`,`bar`];function bn(e){if(Z(e,`decorators`)){if(Z(e,`decorators-legacy`))throw Error(`Cannot use the decorators and decorators-legacy plugin together`);let t=gn(e,`decorators`,`decoratorsBeforeExport`);if(t!=null&&typeof t!=`boolean`)throw Error(`'decoratorsBeforeExport' must be a boolean, if specified.`);let n=gn(e,`decorators`,`allowCallParenthesized`);if(n!=null&&typeof n!=`boolean`)throw Error(`'allowCallParenthesized' must be a boolean.`)}if(Z(e,`flow`)&&Z(e,`typescript`))throw Error(`Cannot combine flow and typescript plugins.`);if(Z(e,`placeholders`)&&Z(e,`v8intrinsic`))throw Error(`Cannot combine placeholders and v8intrinsic plugins.`);if(Z(e,`pipelineOperator`)){let t=gn(e,`pipelineOperator`,`proposal`);if(!_n.includes(t)){let e=_n.map(e=>`"${e}"`).join(`, `);throw Error(`"pipelineOperator" requires "proposal" option whose value must be one of: ${e}.`)}let n=Z(e,[`recordAndTuple`,{syntaxType:`hash`}]);if(t===`hack`){if(Z(e,`placeholders`))throw Error(`Cannot combine placeholders plugin and Hack-style pipes.`);if(Z(e,`v8intrinsic`))throw Error(`Cannot combine v8intrinsic plugin and Hack-style pipes.`);let t=gn(e,`pipelineOperator`,`topicToken`);if(!vn.includes(t)){let e=vn.map(e=>`"${e}"`).join(`, `);throw Error(`"pipelineOperator" in "proposal": "hack" mode also requires a "topicToken" option whose value must be one of: ${e}.`)}if(t===`#`&&n)throw Error('Plugin conflict between `["pipelineOperator", { proposal: "hack", topicToken: "#" }]` and `["recordAndtuple", { syntaxType: "hash"}]`.')}else if(t===`smart`&&n)throw Error('Plugin conflict between `["pipelineOperator", { proposal: "smart" }]` and `["recordAndtuple", { syntaxType: "hash"}]`.')}if(Z(e,`moduleAttributes`)){if(Z(e,`importAssertions`))throw Error(`Cannot combine importAssertions and moduleAttributes plugins.`);if(gn(e,`moduleAttributes`,`version`)!==`may-2020`)throw Error(`The 'moduleAttributes' plugin requires a 'version' option, representing the last proposal update. Currently, the only supported value is 'may-2020'.`)}if(Z(e,`recordAndTuple`)&&gn(e,`recordAndTuple`,`syntaxType`)!=null&&!yn.includes(gn(e,`recordAndTuple`,`syntaxType`)))throw Error(`The 'syntaxType' option of the 'recordAndTuple' plugin must be one of: `+yn.map(e=>`'${e}'`).join(`, `));if(Z(e,`asyncDoExpressions`)&&!Z(e,`doExpressions`)){let e=/* @__PURE__ */ Error(`'asyncDoExpressions' requires 'doExpressions', please add 'doExpressions' to parser plugins.`);throw e.missingPlugins=`doExpressions`,e}}let xn={estree:ie,jsx:Jt,flow:Wt,typescript:sn,v8intrinsic:hn,placeholders:mn},Sn=Object.keys(xn),Cn={sourceType:`script`,sourceFilename:void 0,startColumn:0,startLine:1,allowAwaitOutsideFunction:!1,allowReturnOutsideFunction:!1,allowNewTargetOutsideFunction:!1,allowImportExportEverywhere:!1,allowSuperOutsideMethod:!1,allowUndeclaredExports:!1,plugins:[],strictMode:null,ranges:!1,tokens:!1,createParenthesizedExpressions:!1,errorRecovery:!1,attachComment:!0,annexB:!0};function wn(e){if(e&&e.annexB!=null&&e.annexB!==!1)throw Error("The `annexB` option can only be set to `false`.");let t={};for(let n of Object.keys(Cn))t[n]=e&&e[n]!=null?e[n]:Cn[n];return t}var Tn=class extends $t{checkProto(e,t,n,r){if(e.type===`SpreadElement`||this.isObjectMethod(e)||e.computed||e.shorthand)return;let i=e.key;if((i.type===`Identifier`?i.name:i.value)===`__proto__`){if(t){this.raise(_.RecordNoProto,{at:i});return}n.used&&(r?r.doubleProtoLoc===null&&(r.doubleProtoLoc=i.loc.start):this.raise(_.DuplicateProto,{at:i})),n.used=!0}}shouldExitDescending(e,t){return e.type===`ArrowFunctionExpression`&&e.start===t}getExpression(){this.enterInitialScopes(),this.nextToken();let e=this.parseExpression();return this.match(137)||this.unexpected(),this.finalizeRemainingComments(),e.comments=this.state.comments,e.errors=this.state.errors,this.options.tokens&&(e.tokens=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,n=this.parseMaybeAssign(e);if(this.match(12)){let r=this.startNodeAt(t);for(r.expressions=[n];this.eat(12);)r.expressions.push(this.parseMaybeAssign(e));return this.toReferencedList(r.expressions),this.finishNode(r,`SequenceExpression`)}return n}parseMaybeAssignDisallowIn(e,t){return this.disallowInAnd(()=>this.parseMaybeAssign(e,t))}parseMaybeAssignAllowIn(e,t){return this.allowInAnd(()=>this.parseMaybeAssign(e,t))}setOptionalParametersError(e,t){e.optionalParametersLoc=t?.loc??this.state.startLoc}parseMaybeAssign(e,t){let n=this.state.startLoc;if(this.isContextual(106)&&this.prodParam.hasYield){let e=this.parseYield();return t&&(e=t.call(this,e,n)),e}let r;e?r=!1:(e=new jt,r=!0);let{type:i}=this.state;(i===10||A(i))&&(this.state.potentialArrowAt=this.state.start);let a=this.parseMaybeConditional(e);if(t&&(a=t.call(this,a,n)),pe(this.state.type)){let t=this.startNodeAt(n);if(t.operator=this.state.value,this.match(29)){this.toAssignable(a,!0),t.left=a;let r=n.index;e.doubleProtoLoc!=null&&e.doubleProtoLoc.index>=r&&(e.doubleProtoLoc=null),e.shorthandAssignLoc!=null&&e.shorthandAssignLoc.index>=r&&(e.shorthandAssignLoc=null),e.privateKeyLoc!=null&&e.privateKeyLoc.index>=r&&(this.checkDestructuringPrivate(e),e.privateKeyLoc=null)}else t.left=a;return this.next(),t.right=this.parseMaybeAssign(),this.checkLVal(a,{in:this.finishNode(t,`AssignmentExpression`)}),t}return r&&this.checkExpressionErrors(e,!0),a}parseMaybeConditional(e){let t=this.state.startLoc,n=this.state.potentialArrowAt,r=this.parseExprOps(e);return this.shouldExitDescending(r,n)?r:this.parseConditional(r,t,e)}parseConditional(e,t,n){if(this.eat(17)){let n=this.startNodeAt(t);return n.test=e,n.consequent=this.parseMaybeAssignAllowIn(),this.expect(14),n.alternate=this.parseMaybeAssign(),this.finishNode(n,`ConditionalExpression`)}return e}parseMaybeUnaryOrPrivate(e){return this.match(136)?this.parsePrivateName():this.parseMaybeUnary(e)}parseExprOps(e){let t=this.state.startLoc,n=this.state.potentialArrowAt,r=this.parseMaybeUnaryOrPrivate(e);return this.shouldExitDescending(r,n)?r:this.parseExprOp(r,t,-1)}parseExprOp(e,t,n){if(this.isPrivateName(e)){let t=this.getPrivateNameSV(e);(n>=R(58)||!this.prodParam.hasIn||!this.match(58))&&this.raise(_.PrivateInExpectedIn,{at:e,identifierName:t}),this.classScope.usePrivateName(t,e.loc.start)}let r=this.state.type;if(me(r)&&(this.prodParam.hasIn||!this.match(58))){let i=R(r);if(i>n){if(r===39){if(this.expectPlugin(`pipelineOperator`),this.state.inFSharpPipelineDirectBody)return e;this.checkPipelineAtInfixOperator(e,t)}let a=this.startNodeAt(t);a.left=e,a.operator=this.state.value;let o=r===41||r===42,s=r===40;if(s&&(i=R(42)),this.next(),r===39&&this.hasPlugin([`pipelineOperator`,{proposal:`minimal`}])&&this.state.type===96&&this.prodParam.hasAwait)throw this.raise(_.UnexpectedAwaitAfterPipelineBody,{at:this.state.startLoc});a.right=this.parseExprOpRightExpr(r,i);let c=this.finishNode(a,o||s?`LogicalExpression`:`BinaryExpression`),l=this.state.type;if(s&&(l===41||l===42)||o&&l===40)throw this.raise(_.MixingCoalesceWithLogical,{at:this.state.startLoc});return this.parseExprOp(c,t,n)}}return e}parseExprOpRightExpr(e,t){let n=this.state.startLoc;switch(e){case 39:switch(this.getPluginOption(`pipelineOperator`,`proposal`)){case`hack`:return this.withTopicBindingContext(()=>this.parseHackPipeBody());case`smart`:return this.withTopicBindingContext(()=>{if(this.prodParam.hasYield&&this.isContextual(106))throw this.raise(_.PipeBodyIsTighter,{at:this.state.startLoc});return this.parseSmartPipelineBodyInStyle(this.parseExprOpBaseRightExpr(e,t),n)});case`fsharp`:return this.withSoloAwaitPermittingContext(()=>this.parseFSharpPipelineBody(t))}default:return this.parseExprOpBaseRightExpr(e,t)}}parseExprOpBaseRightExpr(e,t){let n=this.state.startLoc;return this.parseExprOp(this.parseMaybeUnaryOrPrivate(),n,ve(e)?t-1:t)}parseHackPipeBody(){var e;let{startLoc:t}=this.state,n=this.parseMaybeAssign();return p.has(n.type)&&!((e=n.extra)!=null&&e.parenthesized)&&this.raise(_.PipeUnparenthesizedBody,{at:t,type:n.type}),this.topicReferenceWasUsedInCurrentContext()||this.raise(_.PipeTopicUnused,{at:t}),n}checkExponentialAfterUnary(e){this.match(57)&&this.raise(_.UnexpectedTokenUnaryExponentiation,{at:e.argument})}parseMaybeUnary(e,t){let n=this.state.startLoc,r=this.isContextual(96);if(r&&this.isAwaitAllowed()){this.next();let e=this.parseAwait(n);return t||this.checkExponentialAfterUnary(e),e}let i=this.match(34),a=this.startNode();if(he(this.state.type)){a.operator=this.state.value,a.prefix=!0,this.match(72)&&this.expectPlugin(`throwExpressions`);let n=this.match(89);if(this.next(),a.argument=this.parseMaybeUnary(null,!0),this.checkExpressionErrors(e,!0),this.state.strict&&n){let e=a.argument;e.type===`Identifier`?this.raise(_.StrictDelete,{at:a}):this.hasPropertyAsPrivateName(e)&&this.raise(_.DeletePrivateField,{at:a})}if(!i)return t||this.checkExponentialAfterUnary(a),this.finishNode(a,`UnaryExpression`)}let o=this.parseUpdate(a,i,e);if(r){let{type:e}=this.state;if((this.hasPlugin(`v8intrinsic`)?fe(e):fe(e)&&!this.match(54))&&!this.isAmbiguousAwait())return this.raiseOverwrite(_.AwaitNotInAsyncContext,{at:n}),this.parseAwait(n)}return o}parseUpdate(e,t,n){if(t){let t=e;return this.checkLVal(t.argument,{in:this.finishNode(t,`UpdateExpression`)}),e}let r=this.state.startLoc,i=this.parseExprSubscripts(n);if(this.checkExpressionErrors(n,!1))return i;for(;I(this.state.type)&&!this.canInsertSemicolon();){let e=this.startNodeAt(r);e.operator=this.state.value,e.prefix=!1,e.argument=i,this.next(),this.checkLVal(i,{in:i=this.finishNode(e,`UpdateExpression`)})}return i}parseExprSubscripts(e){let t=this.state.startLoc,n=this.state.potentialArrowAt,r=this.parseExprAtom(e);return this.shouldExitDescending(r,n)?r:this.parseSubscripts(r,t)}parseSubscripts(e,t,n){let r={optionalChainMember:!1,maybeAsyncArrow:this.atPossibleAsyncArrow(e),stop:!1};do e=this.parseSubscript(e,t,n,r),r.maybeAsyncArrow=!1;while(!r.stop);return e}parseSubscript(e,t,n,r){let{type:i}=this.state;if(!n&&i===15)return this.parseBind(e,t,n,r);if(ye(i))return this.parseTaggedTemplateExpression(e,t,r);let a=!1;if(i===18){if(n&&(this.raise(_.OptionalChainingNoNew,{at:this.state.startLoc}),this.lookaheadCharCode()===40))return r.stop=!0,e;r.optionalChainMember=a=!0,this.next()}if(!n&&this.match(10))return this.parseCoverCallAndAsyncArrowHead(e,t,r,a);{let n=this.eat(0);return n||a||this.eat(16)?this.parseMember(e,t,r,n,a):(r.stop=!0,e)}}parseMember(e,t,n,r,i){let a=this.startNodeAt(t);return a.object=e,a.computed=r,r?(a.property=this.parseExpression(),this.expect(3)):this.match(136)?(e.type===`Super`&&this.raise(_.SuperPrivateField,{at:t}),this.classScope.usePrivateName(this.state.value,this.state.startLoc),a.property=this.parsePrivateName()):a.property=this.parseIdentifier(!0),n.optionalChainMember?(a.optional=i,this.finishNode(a,`OptionalMemberExpression`)):this.finishNode(a,`MemberExpression`)}parseBind(e,t,n,r){let i=this.startNodeAt(t);return i.object=e,this.next(),i.callee=this.parseNoCallExpr(),r.stop=!0,this.parseSubscripts(this.finishNode(i,`BindExpression`),t,n)}parseCoverCallAndAsyncArrowHead(e,t,n,r){let i=this.state.maybeInArrowParameters,a=null;this.state.maybeInArrowParameters=!0,this.next();let o=this.startNodeAt(t);o.callee=e;let{maybeAsyncArrow:s,optionalChainMember:c}=n;s&&(this.expressionScope.enter(Et()),a=new jt),c&&(o.optional=r),o.arguments=r?this.parseCallExpressionArguments(11):this.parseCallExpressionArguments(11,e.type===`Import`,e.type!==`Super`,o,a);let l=this.finishCallExpression(o,c);return s&&this.shouldParseAsyncArrow()&&!r?(n.stop=!0,this.checkDestructuringPrivate(a),this.expressionScope.validateAsPattern(),this.expressionScope.exit(),l=this.parseAsyncArrowFromCallExpression(this.startNodeAt(t),l)):(s&&(this.checkExpressionErrors(a,!0),this.expressionScope.exit()),this.toReferencedArguments(l)),this.state.maybeInArrowParameters=i,l}toReferencedArguments(e,t){this.toReferencedListDeep(e.arguments,t)}parseTaggedTemplateExpression(e,t,n){let r=this.startNodeAt(t);return r.tag=e,r.quasi=this.parseTemplate(!0),n.optionalChainMember&&this.raise(_.OptionalChainingNoTemplate,{at:t}),this.finishNode(r,`TaggedTemplateExpression`)}atPossibleAsyncArrow(e){return e.type===`Identifier`&&e.name===`async`&&this.state.lastTokEndLoc.index===e.end&&!this.canInsertSemicolon()&&e.end-e.start===5&&e.start===this.state.potentialArrowAt}finishCallExpression(e,t){if(e.callee.type===`Import`){if(e.arguments.length===2&&(this.hasPlugin(`moduleAttributes`)||this.expectPlugin(`importAssertions`)),e.arguments.length===0||e.arguments.length>2)this.raise(_.ImportCallArity,{at:e,maxArgumentCount:this.hasPlugin(`importAssertions`)||this.hasPlugin(`moduleAttributes`)?2:1});else for(let t of e.arguments)t.type===`SpreadElement`&&this.raise(_.ImportCallSpreadArgument,{at:t})}return this.finishNode(e,t?`OptionalCallExpression`:`CallExpression`)}parseCallExpressionArguments(e,t,n,r,i){let a=[],o=!0,s=this.state.inFSharpPipelineDirectBody;for(this.state.inFSharpPipelineDirectBody=!1;!this.eat(e);){if(o)o=!1;else if(this.expect(12),this.match(e)){t&&!this.hasPlugin(`importAssertions`)&&!this.hasPlugin(`moduleAttributes`)&&this.raise(_.ImportCallArgumentTrailingComma,{at:this.state.lastTokStartLoc}),r&&this.addTrailingCommaExtraToNode(r),this.next();break}a.push(this.parseExprListItem(!1,i,n))}return this.state.inFSharpPipelineDirectBody=s,a}shouldParseAsyncArrow(){return this.match(19)&&!this.canInsertSemicolon()}parseAsyncArrowFromCallExpression(e,t){return this.resetPreviousNodeTrailingComments(t),this.expect(19),this.parseArrowExpression(e,t.arguments,!0,t.extra?.trailingCommaLoc),t.innerComments&&Ye(e,t.innerComments),t.callee.trailingComments&&Ye(e,t.callee.trailingComments),e}parseNoCallExpr(){let e=this.state.startLoc;return this.parseSubscripts(this.parseExprAtom(),e,!0)}parseExprAtom(e){let t,n=null,{type:r}=this.state;switch(r){case 79:return this.parseSuper();case 83:return t=this.startNode(),this.next(),this.match(16)?this.parseImportMetaProperty(t):(this.match(10)||this.raise(_.UnsupportedImport,{at:this.state.lastTokStartLoc}),this.finishNode(t,`Import`));case 78:return t=this.startNode(),this.next(),this.finishNode(t,`ThisExpression`);case 90:return this.parseDo(this.startNode(),!1);case 56:case 31:return this.readRegexp(),this.parseRegExpLiteral(this.state.value);case 132:return this.parseNumericLiteral(this.state.value);case 133:return this.parseBigIntLiteral(this.state.value);case 134:return this.parseDecimalLiteral(this.state.value);case 131:return this.parseStringLiteral(this.state.value);case 84:return this.parseNullLiteral();case 85:return this.parseBooleanLiteral(!0);case 86:return this.parseBooleanLiteral(!1);case 10:{let e=this.state.potentialArrowAt===this.state.start;return this.parseParenAndDistinguishExpression(e)}case 2:case 1:return this.parseArrayLike(this.state.type===2?4:3,!1,!0);case 0:return this.parseArrayLike(3,!0,!1,e);case 6:case 7:return this.parseObjectLike(this.state.type===6?9:8,!1,!0);case 5:return this.parseObjectLike(8,!1,!1,e);case 68:return this.parseFunctionOrFunctionSent();case 26:n=this.parseDecorators();case 80:return this.parseClass(this.maybeTakeDecorators(n,this.startNode()),!1);case 77:return this.parseNewOrNewTarget();case 25:case 24:return this.parseTemplate(!1);case 15:{t=this.startNode(),this.next(),t.object=null;let e=t.callee=this.parseNoCallExpr();if(e.type===`MemberExpression`)return this.finishNode(t,`BindExpression`);throw this.raise(_.UnsupportedBind,{at:e})}case 136:return this.raise(_.PrivateInExpectedIn,{at:this.state.startLoc,identifierName:this.state.value}),this.parsePrivateName();case 33:return this.parseTopicReferenceThenEqualsSign(54,`%`);case 32:return this.parseTopicReferenceThenEqualsSign(44,`^`);case 37:case 38:return this.parseTopicReference(`hack`);case 44:case 54:case 27:{let e=this.getPluginOption(`pipelineOperator`,`proposal`);if(e)return this.parseTopicReference(e);throw this.unexpected()}case 47:{let e=this.input.codePointAt(this.nextTokenStart());if(H(e)||e===62){this.expectOnePlugin([`jsx`,`flow`,`typescript`]);break}throw this.unexpected()}default:if(A(r)){if(this.isContextual(125)&&this.lookaheadCharCode()===123&&!this.hasFollowingLineBreak())return this.parseModuleExpression();let e=this.state.potentialArrowAt===this.state.start,t=this.state.containsEsc,n=this.parseIdentifier();if(!t&&n.name===`async`&&!this.canInsertSemicolon()){let{type:e}=this.state;if(e===68)return this.resetPreviousNodeTrailingComments(n),this.next(),this.parseAsyncFunctionExpression(this.startNodeAtNode(n));if(A(e))return this.lookaheadCharCode()===61?this.parseAsyncArrowUnaryFunction(this.startNodeAtNode(n)):n;if(e===90)return this.resetPreviousNodeTrailingComments(n),this.parseDo(this.startNodeAtNode(n),!0)}return e&&this.match(19)&&!this.canInsertSemicolon()?(this.next(),this.parseArrowExpression(this.startNodeAtNode(n),[n],!1)):n}throw this.unexpected()}}parseTopicReferenceThenEqualsSign(e,t){let n=this.getPluginOption(`pipelineOperator`,`proposal`);if(n)return this.state.type=e,this.state.value=t,this.state.pos--,this.state.end--,this.state.endLoc=i(this.state.endLoc,-1),this.parseTopicReference(n);throw this.unexpected()}parseTopicReference(e){let t=this.startNode(),n=this.state.startLoc,r=this.state.type;return this.next(),this.finishTopicReference(t,n,e,r)}finishTopicReference(e,t,n,r){if(this.testTopicReferenceConfiguration(n,t,r)){let r=n===`smart`?`PipelinePrimaryTopicReference`:`TopicReference`;return this.topicReferenceIsAllowedInCurrentContext()||this.raise(n===`smart`?_.PrimaryTopicNotAllowed:_.PipeTopicUnbound,{at:t}),this.registerTopicReference(),this.finishNode(e,r)}throw this.raise(_.PipeTopicUnconfiguredToken,{at:t,token:L(r)})}testTopicReferenceConfiguration(e,t,n){switch(e){case`hack`:return this.hasPlugin([`pipelineOperator`,{topicToken:L(n)}]);case`smart`:return n===27;default:throw this.raise(_.PipeTopicRequiresHackPipes,{at:t})}}parseAsyncArrowUnaryFunction(e){this.prodParam.enter(kt(!0,this.prodParam.hasYield));let t=[this.parseIdentifier()];return this.prodParam.exit(),this.hasPrecedingLineBreak()&&this.raise(_.LineTerminatorBeforeArrow,{at:this.state.curPosition()}),this.expect(19),this.parseArrowExpression(e,t,!0)}parseDo(e,t){this.expectPlugin(`doExpressions`),t&&this.expectPlugin(`asyncDoExpressions`),e.async=t,this.next();let n=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=n,this.finishNode(e,`DoExpression`)}parseSuper(){let e=this.startNode();return this.next(),this.match(10)&&!this.scope.allowDirectSuper&&!this.options.allowSuperOutsideMethod?this.raise(_.SuperNotAllowed,{at:e}):!this.scope.allowSuper&&!this.options.allowSuperOutsideMethod&&this.raise(_.UnexpectedSuper,{at:e}),this.match(10)||this.match(0)||this.match(16)||this.raise(_.UnsupportedSuper,{at:e}),this.finishNode(e,`Super`)}parsePrivateName(){let e=this.startNode(),t=this.startNodeAt(i(this.state.startLoc,1)),n=this.state.value;return this.next(),e.id=this.createIdentifier(t,n),this.finishNode(e,`PrivateName`)}parseFunctionOrFunctionSent(){let e=this.startNode();if(this.next(),this.prodParam.hasYield&&this.match(16)){let t=this.createIdentifier(this.startNodeAtNode(e),`function`);return this.next(),this.match(102)?this.expectPlugin(`functionSent`):this.hasPlugin(`functionSent`)||this.unexpected(),this.parseMetaProperty(e,t,`sent`)}return this.parseFunction(e)}parseMetaProperty(e,t,n){e.meta=t;let r=this.state.containsEsc;return e.property=this.parseIdentifier(!0),(e.property.name!==n||r)&&this.raise(_.UnsupportedMetaProperty,{at:e.property,target:t.name,onlyValidPropertyName:n}),this.finishNode(e,`MetaProperty`)}parseImportMetaProperty(e){let t=this.createIdentifier(this.startNodeAtNode(e),`import`);return this.next(),this.isContextual(100)&&(this.inModule||this.raise(_.ImportMetaOutsideModule,{at:t}),this.sawUnambiguousESM=!0),this.parseMetaProperty(e,t,`meta`)}parseLiteralAtNode(e,t,n){return this.addExtra(n,`rawValue`,e),this.addExtra(n,`raw`,this.input.slice(n.start,this.state.end)),n.value=e,this.next(),this.finishNode(n,t)}parseLiteral(e,t){let n=this.startNode();return this.parseLiteralAtNode(e,t,n)}parseStringLiteral(e){return this.parseLiteral(e,`StringLiteral`)}parseNumericLiteral(e){return this.parseLiteral(e,`NumericLiteral`)}parseBigIntLiteral(e){return this.parseLiteral(e,`BigIntLiteral`)}parseDecimalLiteral(e){return this.parseLiteral(e,`DecimalLiteral`)}parseRegExpLiteral(e){let t=this.parseLiteral(e.value,`RegExpLiteral`);return t.pattern=e.pattern,t.flags=e.flags,t}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,n;this.next(),this.expressionScope.enter(Tt());let r=this.state.maybeInArrowParameters,i=this.state.inFSharpPipelineDirectBody;this.state.maybeInArrowParameters=!0,this.state.inFSharpPipelineDirectBody=!1;let a=this.state.startLoc,o=[],s=new jt,c=!0,l,u;for(;!this.match(11);){if(c)c=!1;else if(this.expect(12,s.optionalParametersLoc===null?null:s.optionalParametersLoc),this.match(11)){u=this.state.startLoc;break}if(this.match(21)){let e=this.state.startLoc;if(l=this.state.startLoc,o.push(this.parseParenItem(this.parseRestBinding(),e)),!this.checkCommaAfterRest(41))break}else o.push(this.parseMaybeAssignAllowIn(s,this.parseParenItem))}let d=this.state.lastTokEndLoc;this.expect(11),this.state.maybeInArrowParameters=r,this.state.inFSharpPipelineDirectBody=i;let f=this.startNodeAt(t);return e&&this.shouldParseArrow(o)&&(f=this.parseArrow(f))?(this.checkDestructuringPrivate(s),this.expressionScope.validateAsPattern(),this.expressionScope.exit(),this.parseArrowExpression(f,o,!1),f):(this.expressionScope.exit(),o.length||this.unexpected(this.state.lastTokStartLoc),u&&this.unexpected(u),l&&this.unexpected(l),this.checkExpressionErrors(s,!0),this.toReferencedListDeep(o,!0),o.length>1?(n=this.startNodeAt(a),n.expressions=o,this.finishNode(n,`SequenceExpression`),this.resetEndLocation(n,d)):n=o[0],this.wrapParenthesis(t,n))}wrapParenthesis(e,t){if(!this.options.createParenthesizedExpressions)return this.addExtra(t,`parenthesized`,!0),this.addExtra(t,`parenStart`,e.index),this.takeSurroundingComments(t,e.index,this.state.lastTokEndLoc.index),t;let n=this.startNodeAt(e);return n.expression=t,this.finishNode(n,`ParenthesizedExpression`)}shouldParseArrow(e){return!this.canInsertSemicolon()}parseArrow(e){if(this.eat(19))return e}parseParenItem(e,t){return e}parseNewOrNewTarget(){let e=this.startNode();if(this.next(),this.match(16)){let t=this.createIdentifier(this.startNodeAtNode(e),`new`);this.next();let n=this.parseMetaProperty(e,t,`target`);return this.scope.inNonArrowFunction||this.scope.inClass||this.options.allowNewTargetOutsideFunction||this.raise(_.UnexpectedNewTarget,{at:n}),n}return this.parseNew(e)}parseNew(e){if(this.parseNewCallee(e),this.eat(10)){let t=this.parseExprList(11);this.toReferencedList(t),e.arguments=t}else e.arguments=[];return this.finishNode(e,`NewExpression`)}parseNewCallee(e){e.callee=this.parseNoCallExpr(),e.callee.type===`Import`&&this.raise(_.ImportCallNotNewExpression,{at:e.callee})}parseTemplateElement(e){let{start:t,startLoc:n,end:r,value:a}=this.state,o=t+1,s=this.startNodeAt(i(n,1));a===null&&(e||this.raise(_.InvalidEscapeSequenceTemplate,{at:i(this.state.firstInvalidTemplateEscapePos,1)}));let c=this.match(24),l=c?-1:-2,u=r+l;s.value={raw:this.input.slice(o,u).replace(/\r\n?/g,`
12
+ `),cooked:a===null?null:a.slice(1,l)},s.tail=c,this.next();let d=this.finishNode(s,`TemplateElement`);return this.resetEndLocation(d,i(this.state.lastTokEndLoc,l)),d}parseTemplate(e){let t=this.startNode();t.expressions=[];let n=this.parseTemplateElement(e);for(t.quasis=[n];!n.tail;)t.expressions.push(this.parseTemplateSubstitution()),this.readTemplateContinuation(),t.quasis.push(n=this.parseTemplateElement(e));return this.finishNode(t,`TemplateLiteral`)}parseTemplateSubstitution(){return this.parseExpression()}parseObjectLike(e,t,n,r){n&&this.expectPlugin(`recordAndTuple`);let i=this.state.inFSharpPipelineDirectBody;this.state.inFSharpPipelineDirectBody=!1;let a=Object.create(null),o=!0,s=this.startNode();for(s.properties=[],this.next();!this.match(e);){if(o)o=!1;else if(this.expect(12),this.match(e)){this.addTrailingCommaExtraToNode(s);break}let i;t?i=this.parseBindingProperty():(i=this.parsePropertyDefinition(r),this.checkProto(i,n,a,r)),n&&!this.isObjectProperty(i)&&i.type!==`SpreadElement`&&this.raise(_.InvalidRecordProperty,{at:i}),i.shorthand&&this.addExtra(i,`shorthand`,!0),s.properties.push(i)}this.next(),this.state.inFSharpPipelineDirectBody=i;let c=`ObjectExpression`;return t?c=`ObjectPattern`:n&&(c=`RecordExpression`),this.finishNode(s,c)}addTrailingCommaExtraToNode(e){this.addExtra(e,`trailingComma`,this.state.lastTokStart),this.addExtra(e,`trailingCommaLoc`,this.state.lastTokStartLoc,!1)}maybeAsyncOrAccessorProp(e){return!e.computed&&e.key.type===`Identifier`&&(this.isLiteralPropertyName()||this.match(0)||this.match(55))}parsePropertyDefinition(e){let t=[];if(this.match(26))for(this.hasPlugin(`decorators`)&&this.raise(_.UnsupportedPropertyDecorator,{at:this.state.startLoc});this.match(26);)t.push(this.parseDecorator());let n=this.startNode(),r=!1,i=!1,a;if(this.match(21))return t.length&&this.unexpected(),this.parseSpread();t.length&&(n.decorators=t,t=[]),n.method=!1,e&&(a=this.state.startLoc);let o=this.eat(55);this.parsePropertyNamePrefixOperator(n);let s=this.state.containsEsc,c=this.parsePropertyName(n,e);if(!o&&!s&&this.maybeAsyncOrAccessorProp(n)){let e=c.name;e===`async`&&!this.hasPrecedingLineBreak()&&(r=!0,this.resetPreviousNodeTrailingComments(c),o=this.eat(55),this.parsePropertyName(n)),(e===`get`||e===`set`)&&(i=!0,this.resetPreviousNodeTrailingComments(c),n.kind=e,this.match(55)&&(o=!0,this.raise(_.AccessorIsGenerator,{at:this.state.curPosition(),kind:e}),this.next()),this.parsePropertyName(n))}return this.parseObjPropValue(n,a,o,r,!1,i,e)}getGetterSetterExpectedParamCount(e){return e.kind===`get`?0:1}getObjectOrClassMethodParams(e){return e.params}checkGetterSetterParams(e){let t=this.getGetterSetterExpectedParamCount(e),n=this.getObjectOrClassMethodParams(e);n.length!==t&&this.raise(e.kind===`get`?_.BadGetterArity:_.BadSetterArity,{at:e}),e.kind===`set`&&n[n.length-1]?.type===`RestElement`&&this.raise(_.BadSetterRestParameter,{at:e})}parseObjectMethod(e,t,n,r,i){if(i){let n=this.parseMethod(e,t,!1,!1,!1,`ObjectMethod`);return this.checkGetterSetterParams(n),n}if(n||t||this.match(10))return r&&this.unexpected(),e.kind=`method`,e.method=!0,this.parseMethod(e,t,n,!1,!1,`ObjectMethod`)}parseObjectProperty(e,t,n,r){if(e.shorthand=!1,this.eat(14))return e.value=n?this.parseMaybeDefault(this.state.startLoc):this.parseMaybeAssignAllowIn(r),this.finishNode(e,`ObjectProperty`);if(!e.computed&&e.key.type===`Identifier`){if(this.checkReservedWord(e.key.name,e.key.loc.start,!0,!1),n)e.value=this.parseMaybeDefault(t,K(e.key));else if(this.match(29)){let n=this.state.startLoc;r==null?this.raise(_.InvalidCoverInitializedName,{at:n}):r.shorthandAssignLoc===null&&(r.shorthandAssignLoc=n),e.value=this.parseMaybeDefault(t,K(e.key))}else e.value=K(e.key);return e.shorthand=!0,this.finishNode(e,`ObjectProperty`)}}parseObjPropValue(e,t,n,r,i,a,o){let s=this.parseObjectMethod(e,n,r,i,a)||this.parseObjectProperty(e,t,i,o);return s||this.unexpected(),s}parsePropertyName(e,t){if(this.eat(0))e.computed=!0,e.key=this.parseMaybeAssignAllowIn(),this.expect(3);else{let{type:n,value:r}=this.state,i;if(j(n))i=this.parseIdentifier(!0);else switch(n){case 132:i=this.parseNumericLiteral(r);break;case 131:i=this.parseStringLiteral(r);break;case 133:i=this.parseBigIntLiteral(r);break;case 134:i=this.parseDecimalLiteral(r);break;case 136:{let e=this.state.startLoc;t==null?this.raise(_.UnexpectedPrivateField,{at:e}):t.privateKeyLoc===null&&(t.privateKeyLoc=e),i=this.parsePrivateName();break}default:throw this.unexpected()}e.key=i,n!==136&&(e.computed=!1)}return e.key}initFunction(e,t){e.id=null,e.generator=!1,e.async=t}parseMethod(e,t,n,r,i,a,o=!1){this.initFunction(e,n),e.generator=t,this.scope.enter(18|(o?64:0)|(i?32:0)),this.prodParam.enter(kt(n,e.generator)),this.parseFunctionParams(e,r);let s=this.parseFunctionBodyAndFinish(e,a,!0);return this.prodParam.exit(),this.scope.exit(),s}parseArrayLike(e,t,n,r){n&&this.expectPlugin(`recordAndTuple`);let i=this.state.inFSharpPipelineDirectBody;this.state.inFSharpPipelineDirectBody=!1;let a=this.startNode();return this.next(),a.elements=this.parseExprList(e,!n,r,a),this.state.inFSharpPipelineDirectBody=i,this.finishNode(a,n?`TupleExpression`:`ArrayExpression`)}parseArrowExpression(e,t,n,r){this.scope.enter(6);let i=kt(n,!1);!this.match(5)&&this.prodParam.hasIn&&(i|=8),this.prodParam.enter(i),this.initFunction(e,n);let a=this.state.maybeInArrowParameters;return t&&(this.state.maybeInArrowParameters=!0,this.setArrowFunctionParameters(e,t,r)),this.state.maybeInArrowParameters=!1,this.parseFunctionBody(e,!0),this.prodParam.exit(),this.scope.exit(),this.state.maybeInArrowParameters=a,this.finishNode(e,`ArrowFunctionExpression`)}setArrowFunctionParameters(e,t,n){this.toAssignableList(t,n,!1),e.params=t}parseFunctionBodyAndFinish(e,t,n=!1){return this.parseFunctionBody(e,!1,n),this.finishNode(e,t)}parseFunctionBody(e,t,n=!1){let r=t&&!this.match(5);if(this.expressionScope.enter(Dt()),r)e.body=this.parseMaybeAssign(),this.checkParams(e,!1,t,!1);else{let r=this.state.strict,i=this.state.labels;this.state.labels=[],this.prodParam.enter(this.prodParam.currentFlags()|4),e.body=this.parseBlock(!0,!1,i=>{let a=!this.isSimpleParamList(e.params);i&&a&&this.raise(_.IllegalLanguageModeDirective,{at:(e.kind===`method`||e.kind===`constructor`)&&e.key?e.key.loc.end:e});let o=!r&&this.state.strict;this.checkParams(e,!this.state.strict&&!t&&!n&&!a,t,o),this.state.strict&&e.id&&this.checkIdentifier(e.id,65,o)}),this.prodParam.exit(),this.state.labels=i}this.expressionScope.exit()}isSimpleParameter(e){return e.type===`Identifier`}isSimpleParamList(e){for(let t=0,n=e.length;t<n;t++)if(!this.isSimpleParameter(e[t]))return!1;return!0}checkParams(e,t,n,r=!0){let i=!t&&/* @__PURE__ */ new Set,a={type:`FormalParameters`};for(let t of e.params)this.checkLVal(t,{in:a,binding:5,checkClashes:i,strictModeChanged:r})}parseExprList(e,t,n,r){let i=[],a=!0;for(;!this.eat(e);){if(a)a=!1;else if(this.expect(12),this.match(e)){r&&this.addTrailingCommaExtraToNode(r),this.next();break}i.push(this.parseExprListItem(t,n))}return i}parseExprListItem(e,t,n){let r;if(this.match(12))e||this.raise(_.UnexpectedToken,{at:this.state.curPosition(),unexpected:`,`}),r=null;else if(this.match(21)){let e=this.state.startLoc;r=this.parseParenItem(this.parseSpread(t),e)}else if(this.match(17)){this.expectPlugin(`partialApplication`),n||this.raise(_.UnexpectedArgumentPlaceholder,{at:this.state.startLoc});let e=this.startNode();this.next(),r=this.finishNode(e,`ArgumentPlaceholder`)}else r=this.parseMaybeAssignAllowIn(t,this.parseParenItem);return r}parseIdentifier(e){let t=this.startNode(),n=this.parseIdentifierName(e);return this.createIdentifier(t,n)}createIdentifier(e,t){return e.name=t,e.loc.identifierName=t,this.finishNode(e,`Identifier`)}parseIdentifierName(e){let t,{startLoc:n,type:r}=this.state;if(j(r))t=this.state.value;else throw this.unexpected();let i=ue(r);return e?i&&this.replaceToken(130):this.checkReservedWord(t,n,i,!1),this.next(),t}checkReservedWord(e,t,n,r){if(!(e.length>10)&&Fe(e)){if(n&&Me(e))this.raise(_.UnexpectedKeyword,{at:t,keyword:e});else if((this.state.strict?r?je:ke:Oe)(e,this.inModule))this.raise(_.UnexpectedReservedWord,{at:t,reservedWord:e});else if(e===`yield`){if(this.prodParam.hasYield){this.raise(_.YieldBindingIdentifier,{at:t});return}}else if(e===`await`){if(this.prodParam.hasAwait){this.raise(_.AwaitBindingIdentifier,{at:t});return}if(this.scope.inStaticBlock){this.raise(_.AwaitBindingIdentifierInStaticBlock,{at:t});return}this.expressionScope.recordAsyncArrowParametersError({at:t})}else if(e===`arguments`&&this.scope.inClassAndNotInNonArrowFunction){this.raise(_.ArgumentsInClass,{at:t});return}}}isAwaitAllowed(){return!!(this.prodParam.hasAwait||this.options.allowAwaitOutsideFunction&&!this.scope.inFunction)}parseAwait(e){let t=this.startNodeAt(e);return this.expressionScope.recordParameterInitializerError(_.AwaitExpressionFormalParameter,{at:t}),this.eat(55)&&this.raise(_.ObsoleteAwaitStar,{at:t}),!this.scope.inFunction&&!this.options.allowAwaitOutsideFunction&&(this.isAmbiguousAwait()?this.ambiguousScriptDifferentAst=!0:this.sawUnambiguousESM=!0),this.state.soloAwait||(t.argument=this.parseMaybeUnary(null,!0)),this.finishNode(t,`AwaitExpression`)}isAmbiguousAwait(){if(this.hasPrecedingLineBreak())return!0;let{type:e}=this.state;return e===53||e===10||e===0||ye(e)||e===101&&!this.state.containsEsc||e===135||e===56||this.hasPlugin(`v8intrinsic`)&&e===54}parseYield(){let e=this.startNode();this.expressionScope.recordParameterInitializerError(_.YieldInParameter,{at:e}),this.next();let t=!1,n=null;if(!this.hasPrecedingLineBreak())switch(t=this.eat(55),this.state.type){case 13:case 137:case 8:case 11:case 3:case 9:case 14:case 12:if(!t)break;default:n=this.parseMaybeAssign()}return e.delegate=t,e.argument=n,this.finishNode(e,`YieldExpression`)}checkPipelineAtInfixOperator(e,t){this.hasPlugin([`pipelineOperator`,{proposal:`smart`}])&&e.type===`SequenceExpression`&&this.raise(_.PipelineHeadSequenceExpression,{at:t})}parseSmartPipelineBodyInStyle(e,t){if(this.isSimpleReference(e)){let n=this.startNodeAt(t);return n.callee=e,this.finishNode(n,`PipelineBareFunction`)}{let n=this.startNodeAt(t);return this.checkSmartPipeTopicBodyEarlyErrors(t),n.expression=e,this.finishNode(n,`PipelineTopicExpression`)}}isSimpleReference(e){switch(e.type){case`MemberExpression`:return!e.computed&&this.isSimpleReference(e.object);case`Identifier`:return!0;default:return!1}}checkSmartPipeTopicBodyEarlyErrors(e){if(this.match(19))throw this.raise(_.PipelineBodyNoArrow,{at:this.state.startLoc});this.topicReferenceWasUsedInCurrentContext()||this.raise(_.PipelineTopicUnused,{at:e})}withTopicBindingContext(e){let t=this.state.topicContext;this.state.topicContext={maxNumOfResolvableTopics:1,maxTopicIndex:null};try{return e()}finally{this.state.topicContext=t}}withSmartMixTopicForbiddingContext(e){if(this.hasPlugin([`pipelineOperator`,{proposal:`smart`}])){let t=this.state.topicContext;this.state.topicContext={maxNumOfResolvableTopics:0,maxTopicIndex:null};try{return e()}finally{this.state.topicContext=t}}else return e()}withSoloAwaitPermittingContext(e){let t=this.state.soloAwait;this.state.soloAwait=!0;try{return e()}finally{this.state.soloAwait=t}}allowInAnd(e){let t=this.prodParam.currentFlags();if(8&~t){this.prodParam.enter(t|8);try{return e()}finally{this.prodParam.exit()}}return e()}disallowInAnd(e){let t=this.prodParam.currentFlags();if(8&t){this.prodParam.enter(t&-9);try{return e()}finally{this.prodParam.exit()}}return e()}registerTopicReference(){this.state.topicContext.maxTopicIndex=0}topicReferenceIsAllowedInCurrentContext(){return this.state.topicContext.maxNumOfResolvableTopics>=1}topicReferenceWasUsedInCurrentContext(){return this.state.topicContext.maxTopicIndex!=null&&this.state.topicContext.maxTopicIndex>=0}parseFSharpPipelineBody(e){let t=this.state.startLoc;this.state.potentialArrowAt=this.state.start;let n=this.state.inFSharpPipelineDirectBody;this.state.inFSharpPipelineDirectBody=!0;let r=this.parseExprOp(this.parseMaybeUnaryOrPrivate(),t,e);return this.state.inFSharpPipelineDirectBody=n,r}parseModuleExpression(){this.expectPlugin(`moduleBlocks`);let e=this.startNode();this.next(),this.match(5)||this.unexpected(null,5);let t=this.startNodeAt(this.state.endLoc);this.next();let n=this.initializeScopes(!0);this.enterInitialScopes();try{e.body=this.parseProgram(t,8,`module`)}finally{n()}return this.finishNode(e,`ModuleExpression`)}parsePropertyNamePrefixOperator(e){}};let En={kind:`loop`},Dn={kind:`switch`};var Q={Expression:0,Declaration:1,HangingDeclaration:2,NullableId:4,Async:8},$={StatementOnly:0,AllowImportExport:1,AllowDeclaration:2,AllowFunctionDeclaration:4,AllowLabeledFunction:8};let On=/[\uD800-\uDFFF]/u,kn=/in(?:stanceof)?/y;function An(e,t){for(let n=0;n<e.length;n++){let r=e[n],{type:a}=r;if(typeof a==`number`){if(a===136){let{loc:t,start:a,value:o,end:s}=r,c=a+1,l=i(t.start,1);e.splice(n,1,new G({type:z(27),value:`#`,start:a,end:c,startLoc:t.start,endLoc:l}),new G({type:z(130),value:o,start:c,end:s,startLoc:l,endLoc:t.end})),n++;continue}if(ye(a)){let{loc:o,start:s,value:c,end:l}=r,u=s+1,d=i(o.start,1),f;f=t.charCodeAt(s)===96?new G({type:z(22),value:"`",start:s,end:u,startLoc:o.start,endLoc:d}):new G({type:z(8),value:`}`,start:s,end:u,startLoc:o.start,endLoc:d});let p,m,h,ee;a===24?(m=l-1,h=i(o.end,-1),p=c===null?null:c.slice(1,-1),ee=new G({type:z(22),value:"`",start:m,end:l,startLoc:h,endLoc:o.end})):(m=l-2,h=i(o.end,-2),p=c===null?null:c.slice(1,-2),ee=new G({type:z(23),value:"${",start:m,end:l,startLoc:h,endLoc:o.end})),e.splice(n,1,f,new G({type:z(20),value:p,start:u,end:m,startLoc:d,endLoc:h}),ee),n+=2;continue}r.type=z(a)}}return e}var jn=class extends Tn{parseTopLevel(e,t){return e.program=this.parseProgram(t),e.comments=this.state.comments,this.options.tokens&&(e.tokens=An(this.tokens,this.input)),this.finishNode(e,`File`)}parseProgram(e,t=137,n=this.options.sourceType){if(e.sourceType=n,e.interpreter=this.parseInterpreterDirective(),this.parseBlockBody(e,!0,!0,t),this.inModule&&!this.options.allowUndeclaredExports&&this.scope.undefinedExports.size>0)for(let[e,t]of Array.from(this.scope.undefinedExports))this.raise(_.ModuleExportUndefined,{at:t,localName:e});let r;return r=t===137?this.finishNode(e,`Program`):this.finishNodeAt(e,`Program`,i(this.state.startLoc,-1)),r}stmtToDirective(e){let t=e;t.type=`Directive`,t.value=t.expression,delete t.expression;let n=t.value,r=n.value,i=this.input.slice(n.start,n.end),a=n.value=i.slice(1,-1);return this.addExtra(n,`raw`,i),this.addExtra(n,`rawValue`,a),this.addExtra(n,`expressionValue`,r),n.type=`DirectiveLiteral`,t}parseInterpreterDirective(){if(!this.match(28))return null;let e=this.startNode();return e.value=this.state.value,this.next(),this.finishNode(e,`InterpreterDirective`)}isLet(){return this.isContextual(99)?this.hasFollowingBindingAtom():!1}chStartsBindingIdentifier(e,t){if(H(e)){if(kn.lastIndex=t,kn.test(this.input)){let e=this.codePointAtPos(kn.lastIndex);if(!Te(e)&&e!==92)return!1}return!0}return e===92}chStartsBindingPattern(e){return e===91||e===123}hasFollowingBindingAtom(){let e=this.nextTokenStart(),t=this.codePointAtPos(e);return this.chStartsBindingPattern(t)||this.chStartsBindingIdentifier(t,e)}hasFollowingBindingIdentifier(){let e=this.nextTokenStart(),t=this.codePointAtPos(e);return this.chStartsBindingIdentifier(t,e)}startsUsingForOf(){let e=this.lookahead();return e.type===101&&!e.containsEsc?!1:(this.expectPlugin(`explicitResourceManagement`),!0)}parseModuleItem(){return this.parseStatementLike($.AllowImportExport|$.AllowDeclaration|$.AllowFunctionDeclaration|$.AllowLabeledFunction)}parseStatementListItem(){return this.parseStatementLike($.AllowDeclaration|$.AllowFunctionDeclaration|(!this.options.annexB||this.state.strict?0:$.AllowLabeledFunction))}parseStatementOrSloppyAnnexBFunctionDeclaration(e=!1){let t=$.StatementOnly;return this.options.annexB&&!this.state.strict&&(t|=$.AllowFunctionDeclaration,e&&(t|=$.AllowLabeledFunction)),this.parseStatementLike(t)}parseStatement(){return this.parseStatementLike($.StatementOnly)}parseStatementLike(e){let t=null;return this.match(26)&&(t=this.parseDecorators(!0)),this.parseStatementContent(e,t)}parseStatementContent(e,t){let n=this.state.type,r=this.startNode(),i=!!(e&$.AllowDeclaration),a=!!(e&$.AllowFunctionDeclaration),o=e&$.AllowImportExport;switch(n){case 60:return this.parseBreakContinueStatement(r,!0);case 63:return this.parseBreakContinueStatement(r,!1);case 64:return this.parseDebuggerStatement(r);case 90:return this.parseDoWhileStatement(r);case 91:return this.parseForStatement(r);case 68:if(this.lookaheadCharCode()===46)break;return a||this.raise(this.state.strict?_.StrictFunction:this.options.annexB?_.SloppyFunctionAnnexB:_.SloppyFunction,{at:this.state.startLoc}),this.parseFunctionStatement(r,!1,!i&&a);case 80:return i||this.unexpected(),this.parseClass(this.maybeTakeDecorators(t,r),!0);case 69:return this.parseIfStatement(r);case 70:return this.parseReturnStatement(r);case 71:return this.parseSwitchStatement(r);case 72:return this.parseThrowStatement(r);case 73:return this.parseTryStatement(r);case 105:if(this.hasFollowingLineBreak()||this.state.containsEsc||!this.hasFollowingBindingIdentifier())break;return this.expectPlugin(`explicitResourceManagement`),!this.scope.inModule&&this.scope.inTopLevel?this.raise(_.UnexpectedUsingDeclaration,{at:this.state.startLoc}):i||this.raise(_.UnexpectedLexicalDeclaration,{at:this.state.startLoc}),this.parseVarStatement(r,`using`);case 99:{if(this.state.containsEsc)break;let e=this.nextTokenStart(),t=this.codePointAtPos(e);if(t!==91&&(!i&&this.hasFollowingLineBreak()||!this.chStartsBindingIdentifier(t,e)&&t!==123))break}case 75:i||this.raise(_.UnexpectedLexicalDeclaration,{at:this.state.startLoc});case 74:{let e=this.state.value;return this.parseVarStatement(r,e)}case 92:return this.parseWhileStatement(r);case 76:return this.parseWithStatement(r);case 5:return this.parseBlock();case 13:return this.parseEmptyStatement(r);case 83:{let e=this.lookaheadCharCode();if(e===40||e===46)break}case 82:{!this.options.allowImportExportEverywhere&&!o&&this.raise(_.UnexpectedImportExport,{at:this.state.startLoc}),this.next();let e;return n===83?(e=this.parseImport(r),e.type!==`ImportDeclaration`||e.importKind&&e.importKind!==`value`||(this.sawUnambiguousESM=!0)):(e=this.parseExport(r,t),(e.type!==`ExportNamedDeclaration`||e.exportKind&&e.exportKind!==`value`)&&(e.type!==`ExportAllDeclaration`||e.exportKind&&e.exportKind!==`value`)&&e.type!==`ExportDefaultDeclaration`||(this.sawUnambiguousESM=!0)),this.assertModuleNodeAllowed(e),e}default:if(this.isAsyncFunction())return i||this.raise(_.AsyncFunctionInSingleStatementContext,{at:this.state.startLoc}),this.next(),this.parseFunctionStatement(r,!0,!i&&a)}let s=this.state.value,c=this.parseExpression();return A(n)&&c.type===`Identifier`&&this.eat(14)?this.parseLabeledStatement(r,s,c,e):this.parseExpressionStatement(r,c,t)}assertModuleNodeAllowed(e){!this.options.allowImportExportEverywhere&&!this.inModule&&this.raise(_.ImportOutsideModule,{at:e})}decoratorsEnabledBeforeExport(){return this.hasPlugin(`decorators-legacy`)?!0:this.hasPlugin(`decorators`)&&this.getPluginOption(`decorators`,`decoratorsBeforeExport`)!==!1}maybeTakeDecorators(e,t,n){return e&&(t.decorators&&t.decorators.length>0?(typeof this.getPluginOption(`decorators`,`decoratorsBeforeExport`)!=`boolean`&&this.raise(_.DecoratorsBeforeAfterExport,{at:t.decorators[0]}),t.decorators.unshift(...e)):t.decorators=e,this.resetStartLocationFromNode(t,e[0]),n&&this.resetStartLocationFromNode(n,t)),t}canHaveLeadingDecorator(){return this.match(80)}parseDecorators(e){let t=[];do t.push(this.parseDecorator());while(this.match(26));if(this.match(82))e||this.unexpected(),this.decoratorsEnabledBeforeExport()||this.raise(_.DecoratorExportClass,{at:this.state.startLoc});else if(!this.canHaveLeadingDecorator())throw this.raise(_.UnexpectedLeadingDecorator,{at: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,n;if(this.match(10)){let t=this.state.startLoc;this.next(),n=this.parseExpression(),this.expect(11),n=this.wrapParenthesis(t,n);let r=this.state.startLoc;e.expression=this.parseMaybeDecoratorArguments(n),this.getPluginOption(`decorators`,`allowCallParenthesized`)===!1&&e.expression!==n&&this.raise(_.DecoratorArgumentsOutsideParentheses,{at:r})}else{for(n=this.parseIdentifier(!1);this.eat(16);){let e=this.startNodeAt(t);e.object=n,this.match(136)?(this.classScope.usePrivateName(this.state.value,this.state.startLoc),e.property=this.parsePrivateName()):e.property=this.parseIdentifier(!0),e.computed=!1,n=this.finishNode(e,`MemberExpression`)}e.expression=this.parseMaybeDecoratorArguments(n)}}else e.expression=this.parseExprSubscripts();return this.finishNode(e,`Decorator`)}parseMaybeDecoratorArguments(e){if(this.eat(10)){let t=this.startNodeAtNode(e);return t.callee=e,t.arguments=this.parseCallExpressionArguments(11,!1),this.toReferencedList(t.arguments),this.finishNode(t,`CallExpression`)}return e}parseBreakContinueStatement(e,t){return this.next(),this.isLineTerminator()?e.label=null:(e.label=this.parseIdentifier(),this.semicolon()),this.verifyBreakContinue(e,t),this.finishNode(e,t?`BreakStatement`:`ContinueStatement`)}verifyBreakContinue(e,t){let n=0;for(;n<this.state.labels.length;++n){let r=this.state.labels[n];if((e.label==null||r.name===e.label.name)&&(r.kind!=null&&(t||r.kind===`loop`)||e.label&&t))break}if(n===this.state.labels.length){let n=t?`BreakStatement`:`ContinueStatement`;this.raise(_.IllegalBreakContinue,{at:e,type:n})}}parseDebuggerStatement(e){return this.next(),this.semicolon(),this.finishNode(e,`DebuggerStatement`)}parseHeaderExpression(){this.expect(10);let e=this.parseExpression();return this.expect(11),e}parseDoWhileStatement(e){return this.next(),this.state.labels.push(En),e.body=this.withSmartMixTopicForbiddingContext(()=>this.parseStatement()),this.state.labels.pop(),this.expect(92),e.test=this.parseHeaderExpression(),this.eat(13),this.finishNode(e,`DoWhileStatement`)}parseForStatement(e){this.next(),this.state.labels.push(En);let t=null;if(this.isAwaitAllowed()&&this.eatContextual(96)&&(t=this.state.lastTokStartLoc),this.scope.enter(0),this.expect(10),this.match(13))return t!==null&&this.unexpected(t),this.parseFor(e,null);let n=this.isContextual(99),r=this.isContextual(105)&&!this.hasFollowingLineBreak(),i=n&&this.hasFollowingBindingAtom()||r&&this.hasFollowingBindingIdentifier()&&this.startsUsingForOf();if(this.match(74)||this.match(75)||i){let n=this.startNode(),i=this.state.value;this.next(),this.parseVar(n,!0,i);let a=this.finishNode(n,`VariableDeclaration`),o=this.match(58);return o&&r&&this.raise(_.ForInUsing,{at:a}),(o||this.isContextual(101))&&a.declarations.length===1?this.parseForIn(e,a,t):(t!==null&&this.unexpected(t),this.parseFor(e,a))}let a=this.isContextual(95),o=new jt,s=this.parseExpression(!0,o),c=this.isContextual(101);if(c&&(n&&this.raise(_.ForOfLet,{at:s}),t===null&&a&&s.type===`Identifier`&&this.raise(_.ForOfAsync,{at:s})),c||this.match(58)){this.checkDestructuringPrivate(o),this.toAssignable(s,!0);let n=c?`ForOfStatement`:`ForInStatement`;return this.checkLVal(s,{in:{type:n}}),this.parseForIn(e,s,t)}return this.checkExpressionErrors(o,!0),t!==null&&this.unexpected(t),this.parseFor(e,s)}parseFunctionStatement(e,t,n){return this.next(),this.parseFunction(e,Q.Declaration|(n?Q.HangingDeclaration:0)|(t?Q.Async:0))}parseIfStatement(e){return this.next(),e.test=this.parseHeaderExpression(),e.consequent=this.parseStatementOrSloppyAnnexBFunctionDeclaration(),e.alternate=this.eat(66)?this.parseStatementOrSloppyAnnexBFunctionDeclaration():null,this.finishNode(e,`IfStatement`)}parseReturnStatement(e){return!this.prodParam.hasReturn&&!this.options.allowReturnOutsideFunction&&this.raise(_.IllegalReturn,{at: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(5),this.state.labels.push(Dn),this.scope.enter(0);let n;for(let e;!this.match(8);)if(this.match(61)||this.match(65)){let r=this.match(61);n&&this.finishNode(n,`SwitchCase`),t.push(n=this.startNode()),n.consequent=[],this.next(),r?n.test=this.parseExpression():(e&&this.raise(_.MultipleDefaultsInSwitch,{at:this.state.lastTokStartLoc}),e=!0,n.test=null),this.expect(14)}else n?n.consequent.push(this.parseStatementListItem()):this.unexpected();return this.scope.exit(),n&&this.finishNode(n,`SwitchCase`),this.next(),this.state.labels.pop(),this.finishNode(e,`SwitchStatement`)}parseThrowStatement(e){return this.next(),this.hasPrecedingLineBreak()&&this.raise(_.NewlineAfterThrow,{at: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,{in:{type:`CatchClause`},binding:9}),e}parseTryStatement(e){if(this.next(),e.block=this.parseBlock(),e.handler=null,this.match(62)){let t=this.startNode();this.next(),this.match(10)?(this.expect(10),t.param=this.parseCatchClauseParam(),this.expect(11)):(t.param=null,this.scope.enter(0)),t.body=this.withSmartMixTopicForbiddingContext(()=>this.parseBlock(!1,!1)),this.scope.exit(),e.handler=this.finishNode(t,`CatchClause`)}return e.finalizer=this.eat(67)?this.parseBlock():null,!e.handler&&!e.finalizer&&this.raise(_.NoCatchOrFinally,{at:e}),this.finishNode(e,`TryStatement`)}parseVarStatement(e,t,n=!1){return this.next(),this.parseVar(e,!1,t,n),this.semicolon(),this.finishNode(e,`VariableDeclaration`)}parseWhileStatement(e){return this.next(),e.test=this.parseHeaderExpression(),this.state.labels.push(En),e.body=this.withSmartMixTopicForbiddingContext(()=>this.parseStatement()),this.state.labels.pop(),this.finishNode(e,`WhileStatement`)}parseWithStatement(e){return this.state.strict&&this.raise(_.StrictWith,{at:this.state.startLoc}),this.next(),e.object=this.parseHeaderExpression(),e.body=this.withSmartMixTopicForbiddingContext(()=>this.parseStatement()),this.finishNode(e,`WithStatement`)}parseEmptyStatement(e){return this.next(),this.finishNode(e,`EmptyStatement`)}parseLabeledStatement(e,t,n,r){for(let e of this.state.labels)e.name===t&&this.raise(_.LabelRedeclaration,{at:n,labelName:t});let i=P(this.state.type)?`loop`:this.match(71)?`switch`:null;for(let t=this.state.labels.length-1;t>=0;t--){let n=this.state.labels[t];if(n.statementStart===e.start)n.statementStart=this.state.start,n.kind=i;else break}return this.state.labels.push({name:t,kind:i,statementStart:this.state.start}),e.body=r&$.AllowLabeledFunction?this.parseStatementOrSloppyAnnexBFunctionDeclaration(!0):this.parseStatement(),this.state.labels.pop(),e.label=n,this.finishNode(e,`LabeledStatement`)}parseExpressionStatement(e,t,n){return e.expression=t,this.semicolon(),this.finishNode(e,`ExpressionStatement`)}parseBlock(e=!1,t=!0,n){let r=this.startNode();return e&&this.state.strictErrors.clear(),this.expect(5),t&&this.scope.enter(0),this.parseBlockBody(r,e,!1,8,n),t&&this.scope.exit(),this.finishNode(r,`BlockStatement`)}isValidDirective(e){return e.type===`ExpressionStatement`&&e.expression.type===`StringLiteral`&&!e.expression.extra.parenthesized}parseBlockBody(e,t,n,r,i){let a=e.body=[],o=e.directives=[];this.parseBlockOrModuleBlockBody(a,t?o:void 0,n,r,i)}parseBlockOrModuleBlockBody(e,t,n,r,i){let a=this.state.strict,o=!1,s=!1;for(;!this.match(r);){let r=n?this.parseModuleItem():this.parseStatementListItem();if(t&&!s){if(this.isValidDirective(r)){let e=this.stmtToDirective(r);t.push(e),!o&&e.value.value===`use strict`&&(o=!0,this.setStrict(!0));continue}s=!0,this.state.strictErrors.clear()}e.push(r)}i&&i.call(this,o),a||this.setStrict(!1),this.next()}parseFor(e,t){return e.init=t,this.semicolon(!1),e.test=this.match(13)?null:this.parseExpression(),this.semicolon(!1),e.update=this.match(11)?null:this.parseExpression(),this.expect(11),e.body=this.withSmartMixTopicForbiddingContext(()=>this.parseStatement()),this.scope.exit(),this.state.labels.pop(),this.finishNode(e,`ForStatement`)}parseForIn(e,t,n){let r=this.match(58);return this.next(),r?n!==null&&this.unexpected(n):e.await=n!==null,t.type!==`VariableDeclaration`||t.declarations[0].init==null||r&&this.options.annexB&&!this.state.strict&&t.kind===`var`&&t.declarations[0].id.type===`Identifier`||this.raise(_.ForInOfLoopInitializer,{at:t,type:r?`ForInStatement`:`ForOfStatement`}),t.type===`AssignmentPattern`&&this.raise(_.InvalidLhs,{at:t,ancestor:{type:`ForStatement`}}),e.left=t,e.right=r?this.parseExpression():this.parseMaybeAssignAllowIn(),this.expect(11),e.body=this.withSmartMixTopicForbiddingContext(()=>this.parseStatement()),this.scope.exit(),this.state.labels.pop(),this.finishNode(e,r?`ForInStatement`:`ForOfStatement`)}parseVar(e,t,n,r=!1){let i=e.declarations=[];for(e.kind=n;;){let e=this.startNode();if(this.parseVarId(e,n),e.init=this.eat(29)?t?this.parseMaybeAssignDisallowIn():this.parseMaybeAssignAllowIn():null,e.init===null&&!r&&(e.id.type!==`Identifier`&&!(t&&(this.match(58)||this.isContextual(101)))?this.raise(_.DeclarationMissingInitializer,{at:this.state.lastTokEndLoc,kind:`destructuring`}):n===`const`&&!(this.match(58)||this.isContextual(101))&&this.raise(_.DeclarationMissingInitializer,{at:this.state.lastTokEndLoc,kind:`const`})),i.push(this.finishNode(e,`VariableDeclarator`)),!this.eat(12))break}return e}parseVarId(e,t){t===`using`&&!this.inModule&&this.match(96)&&this.raise(_.AwaitInUsingBinding,{at:this.state.startLoc});let n=this.parseBindingAtom();this.checkLVal(n,{in:{type:`VariableDeclarator`},binding:t===`var`?5:ze}),e.id=n}parseAsyncFunctionExpression(e){return this.parseFunction(e,Q.Async)}parseFunction(e,t=Q.Expression){let n=t&Q.HangingDeclaration,r=!!(t&Q.Declaration),i=r&&!(t&Q.NullableId),a=!!(t&Q.Async);this.initFunction(e,a),this.match(55)&&(n&&this.raise(_.GeneratorInSingleStatementContext,{at:this.state.startLoc}),this.next(),e.generator=!0),r&&(e.id=this.parseFunctionId(i));let o=this.state.maybeInArrowParameters;return this.state.maybeInArrowParameters=!1,this.scope.enter(2),this.prodParam.enter(kt(a,e.generator)),r||(e.id=this.parseFunctionId()),this.parseFunctionParams(e,!1),this.withSmartMixTopicForbiddingContext(()=>{this.parseFunctionBodyAndFinish(e,r?`FunctionDeclaration`:`FunctionExpression`)}),this.prodParam.exit(),this.scope.exit(),r&&!n&&this.registerFunctionStatementId(e),this.state.maybeInArrowParameters=o,e}parseFunctionId(e){return e||A(this.state.type)?this.parseIdentifier():null}parseFunctionParams(e,t){this.expect(10),this.expressionScope.enter(wt()),e.params=this.parseBindingList(11,41,Y.IS_FUNCTION_PARAMS|(t?Y.IS_CONSTRUCTOR_PARAMS: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:ze:17,e.id.loc.start)}parseClass(e,t,n){this.next();let r=this.state.strict;return this.state.strict=!0,this.parseClassId(e,t,n),this.parseClassSuper(e),e.body=this.parseClassBody(!!e.superClass,r),this.finishNode(e,t?`ClassDeclaration`:`ClassExpression`)}isClassProperty(){return this.match(29)||this.match(13)||this.match(8)}isClassMethod(){return this.match(10)}isNonstaticConstructor(e){return!e.computed&&!e.static&&(e.key.name===`constructor`||e.key.value===`constructor`)}parseClassBody(e,t){this.classScope.enter();let n={hadConstructor:!1,hadSuperClass:e},r=[],i=this.startNode();if(i.body=[],this.expect(5),this.withSmartMixTopicForbiddingContext(()=>{for(;!this.match(8);){if(this.eat(13)){if(r.length>0)throw this.raise(_.DecoratorSemicolon,{at:this.state.lastTokEndLoc});continue}if(this.match(26)){r.push(this.parseDecorator());continue}let e=this.startNode();r.length&&(e.decorators=r,this.resetStartLocationFromNode(e,r[0]),r=[]),this.parseClassMember(i,e,n),e.kind===`constructor`&&e.decorators&&e.decorators.length>0&&this.raise(_.DecoratorConstructor,{at:e})}}),this.state.strict=t,this.next(),r.length)throw this.raise(_.TrailingDecorator,{at:this.state.startLoc});return this.classScope.exit(),this.finishNode(i,`ClassBody`)}parseClassMemberFromModifier(e,t){let n=this.parseIdentifier(!0);if(this.isClassMethod()){let r=t;return r.kind=`method`,r.computed=!1,r.key=n,r.static=!1,this.pushClassMethod(e,r,!1,!1,!1,!1),!0}if(this.isClassProperty()){let r=t;return r.computed=!1,r.key=n,r.static=!1,e.body.push(this.parseClassProperty(r)),!0}return this.resetPreviousNodeTrailingComments(n),!1}parseClassMember(e,t,n){let r=this.isContextual(104);if(r){if(this.parseClassMemberFromModifier(e,t))return;if(this.eat(5)){this.parseClassStaticBlock(e,t);return}}this.parseClassMemberWithIsStatic(e,t,n,r)}parseClassMemberWithIsStatic(e,t,n,r){let i=t,a=t,o=t,s=t,c=t,l=i,u=i;if(t.static=r,this.parsePropertyNamePrefixOperator(t),this.eat(55)){l.kind=`method`;let t=this.match(136);if(this.parseClassElementName(l),t){this.pushClassPrivateMethod(e,a,!0,!1);return}this.isNonstaticConstructor(i)&&this.raise(_.ConstructorIsGenerator,{at:i.key}),this.pushClassMethod(e,i,!0,!1,!1,!1);return}let d=A(this.state.type)&&!this.state.containsEsc,f=this.match(136),p=this.parseClassElementName(t),m=this.state.startLoc;if(this.parsePostMemberNameModifiers(u),this.isClassMethod()){if(l.kind=`method`,f){this.pushClassPrivateMethod(e,a,!1,!1);return}let r=this.isNonstaticConstructor(i),o=!1;r&&(i.kind=`constructor`,n.hadConstructor&&!this.hasPlugin(`typescript`)&&this.raise(_.DuplicateConstructor,{at:p}),r&&this.hasPlugin(`typescript`)&&t.override&&this.raise(_.OverrideOnConstructor,{at:p}),n.hadConstructor=!0,o=n.hadSuperClass),this.pushClassMethod(e,i,!1,!1,r,o)}else if(this.isClassProperty())f?this.pushClassPrivateProperty(e,s):this.pushClassProperty(e,o);else if(d&&p.name===`async`&&!this.isLineTerminator()){this.resetPreviousNodeTrailingComments(p);let t=this.eat(55);u.optional&&this.unexpected(m),l.kind=`method`;let n=this.match(136);this.parseClassElementName(l),this.parsePostMemberNameModifiers(u),n?this.pushClassPrivateMethod(e,a,t,!0):(this.isNonstaticConstructor(i)&&this.raise(_.ConstructorIsAsync,{at:i.key}),this.pushClassMethod(e,i,t,!0,!1,!1))}else if(d&&(p.name===`get`||p.name===`set`)&&!(this.match(55)&&this.isLineTerminator())){this.resetPreviousNodeTrailingComments(p),l.kind=p.name;let t=this.match(136);this.parseClassElementName(i),t?this.pushClassPrivateMethod(e,a,!1,!1):(this.isNonstaticConstructor(i)&&this.raise(_.ConstructorIsAccessor,{at:i.key}),this.pushClassMethod(e,i,!1,!1,!1,!1)),this.checkGetterSetterParams(i)}else if(d&&p.name===`accessor`&&!this.isLineTerminator()){this.expectPlugin(`decoratorAutoAccessors`),this.resetPreviousNodeTrailingComments(p);let t=this.match(136);this.parseClassElementName(o),this.pushClassAccessorProperty(e,c,t)}else this.isLineTerminator()?f?this.pushClassPrivateProperty(e,s):this.pushClassProperty(e,o):this.unexpected()}parseClassElementName(e){let{type:t,value:n}=this.state;if((t===130||t===131)&&e.static&&n===`prototype`&&this.raise(_.StaticPrototype,{at:this.state.startLoc}),t===136){n===`constructor`&&this.raise(_.ConstructorClassPrivateField,{at:this.state.startLoc});let t=this.parsePrivateName();return e.key=t,t}return this.parsePropertyName(e)}parseClassStaticBlock(e,t){var n;this.scope.enter(208);let r=this.state.labels;this.state.labels=[],this.prodParam.enter(0);let i=t.body=[];this.parseBlockOrModuleBlockBody(i,void 0,!1,8),this.prodParam.exit(),this.scope.exit(),this.state.labels=r,e.body.push(this.finishNode(t,`StaticBlock`)),(n=t.decorators)!=null&&n.length&&this.raise(_.DecoratorStaticBlock,{at:t})}pushClassProperty(e,t){t.computed||t.key.name!==`constructor`&&t.key.value!==`constructor`||this.raise(_.ConstructorClassField,{at:t.key}),e.body.push(this.parseClassProperty(t))}pushClassPrivateProperty(e,t){let n=this.parseClassPrivateProperty(t);e.body.push(n),this.classScope.declarePrivateName(this.getPrivateNameSV(n.key),0,n.key.loc.start)}pushClassAccessorProperty(e,t,n){if(!n&&!t.computed){let e=t.key;(e.name===`constructor`||e.value===`constructor`)&&this.raise(_.ConstructorClassField,{at:e})}let r=this.parseClassAccessorProperty(t);e.body.push(r),n&&this.classScope.declarePrivateName(this.getPrivateNameSV(r.key),0,r.key.loc.start)}pushClassMethod(e,t,n,r,i,a){e.body.push(this.parseMethod(t,n,r,i,a,`ClassMethod`,!0))}pushClassPrivateMethod(e,t,n,r){let i=this.parseMethod(t,n,r,!1,!1,`ClassPrivateMethod`,!0);e.body.push(i);let a=i.kind===`get`?i.static?6:2:i.kind===`set`?i.static?5:1:0;this.declareClassPrivateMethodInScope(i,a)}declareClassPrivateMethodInScope(e,t){this.classScope.declarePrivateName(this.getPrivateNameSV(e.key),t,e.key.loc.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(80),this.expressionScope.enter(Dt()),this.prodParam.enter(0),e.value=this.eat(29)?this.parseMaybeAssignAllowIn():null,this.expressionScope.exit(),this.prodParam.exit(),this.scope.exit()}parseClassId(e,t,n,r=Re){if(A(this.state.type))e.id=this.parseIdentifier(),t&&this.declareNameFromIdentifier(e.id,r);else if(n||!t)e.id=null;else throw this.raise(_.MissingClassName,{at:this.state.startLoc})}parseClassSuper(e){e.superClass=this.eat(81)?this.parseExprSubscripts():null}parseExport(e,t){let n=this.maybeParseExportDefaultSpecifier(e),r=!n||this.eat(12),i=r&&this.eatExportStar(e),a=i&&this.maybeParseExportNamespaceSpecifier(e),o=r&&(!a||this.eat(12)),s=n||i;if(i&&!a){if(n&&this.unexpected(),t)throw this.raise(_.UnsupportedDecoratorExport,{at:e});return this.parseExportFrom(e,!0),this.finishNode(e,`ExportAllDeclaration`)}let c=this.maybeParseExportNamedSpecifiers(e);if(n&&r&&!i&&!c)throw this.unexpected(null,5);if(a&&o)throw this.unexpected(null,97);let l;if(s||c){if(l=!1,t)throw this.raise(_.UnsupportedDecoratorExport,{at:e});this.parseExportFrom(e,s)}else l=this.maybeParseExportDeclaration(e);if(s||c||l){let n=e;if(this.checkExport(n,!0,!1,!!n.source),n.declaration?.type===`ClassDeclaration`)this.maybeTakeDecorators(t,n.declaration,n);else if(t)throw this.raise(_.UnsupportedDecoratorExport,{at:e});return this.finishNode(n,`ExportNamedDeclaration`)}if(this.eat(65)){let n=e,r=this.parseExportDefaultExpression();if(n.declaration=r,r.type===`ClassDeclaration`)this.maybeTakeDecorators(t,r,n);else if(t)throw this.raise(_.UnsupportedDecoratorExport,{at:e});return this.checkExport(n,!0,!0),this.finishNode(n,`ExportDefaultDeclaration`)}throw this.unexpected(null,5)}eatExportStar(e){return this.eat(55)}maybeParseExportDefaultSpecifier(e){if(this.isExportDefaultSpecifier()){this.expectPlugin(`exportDefaultFrom`);let t=this.startNode();return t.exported=this.parseIdentifier(!0),e.specifiers=[this.finishNode(t,`ExportDefaultSpecifier`)],!0}return!1}maybeParseExportNamespaceSpecifier(e){if(this.isContextual(93)){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(5)){e.specifiers||=[];let t=e.exportKind===`type`;return e.specifiers.push(...this.parseExportSpecifiers(t)),e.source=null,e.declaration=null,this.hasPlugin(`importAssertions`)&&(e.assertions=[]),!0}return!1}maybeParseExportDeclaration(e){return this.shouldParseExportDeclaration()?(e.specifiers=[],e.source=null,this.hasPlugin(`importAssertions`)&&(e.assertions=[]),e.declaration=this.parseExportDeclaration(e),!0):!1}isAsyncFunction(){if(!this.isContextual(95))return!1;let e=this.nextTokenStart();return!Qe.test(this.input.slice(this.state.pos,e))&&this.isUnparsedContextual(e,`function`)}parseExportDefaultExpression(){let e=this.startNode();if(this.match(68))return this.next(),this.parseFunction(e,Q.Declaration|Q.NullableId);if(this.isAsyncFunction())return this.next(),this.next(),this.parseFunction(e,Q.Declaration|Q.NullableId|Q.Async);if(this.match(80))return this.parseClass(e,!0,!0);if(this.match(26))return this.hasPlugin(`decorators`)&&this.getPluginOption(`decorators`,`decoratorsBeforeExport`)===!0&&this.raise(_.DecoratorBeforeExport,{at:this.state.startLoc}),this.parseClass(this.maybeTakeDecorators(this.parseDecorators(!1),this.startNode()),!0,!0);if(this.match(75)||this.match(74)||this.isLet())throw this.raise(_.UnsupportedDefaultExport,{at:this.state.startLoc});let t=this.parseMaybeAssignAllowIn();return this.semicolon(),t}parseExportDeclaration(e){return this.match(80)?this.parseClass(this.startNode(),!0,!1):this.parseStatementListItem()}isExportDefaultSpecifier(){let{type:e}=this.state;if(A(e)){if(e===95&&!this.state.containsEsc||e===99)return!1;if((e===128||e===127)&&!this.state.containsEsc){let{type:e}=this.lookahead();if(A(e)&&e!==97||e===5)return this.expectOnePlugin([`flow`,`typescript`]),!1}}else if(!this.match(65))return!1;let t=this.nextTokenStart(),n=this.isUnparsedContextual(t,`from`);if(this.input.charCodeAt(t)===44||A(this.state.type)&&n)return!0;if(this.match(65)&&n){let e=this.input.charCodeAt(this.nextTokenStartSince(t+4));return e===34||e===39}return!1}parseExportFrom(e,t){if(this.eatContextual(97)){e.source=this.parseImportSource(),this.checkExport(e);let t=this.maybeParseImportAssertions();t&&(e.assertions=t,this.checkJSONModuleImport(e))}else t&&this.unexpected();this.semicolon()}shouldParseExportDeclaration(){let{type:e}=this.state;return e===26&&(this.expectOnePlugin([`decorators`,`decorators-legacy`]),this.hasPlugin(`decorators`))?(this.getPluginOption(`decorators`,`decoratorsBeforeExport`)===!0&&this.raise(_.DecoratorBeforeExport,{at:this.state.startLoc}),!0):e===74||e===75||e===68||e===80||this.isLet()||this.isAsyncFunction()}checkExport(e,t,n,r){if(t){if(n){if(this.checkDuplicateExports(e,`default`),this.hasPlugin(`exportDefaultFrom`)){var i;let t=e.declaration;t.type===`Identifier`&&t.name===`from`&&t.end-t.start===4&&!((i=t.extra)!=null&&i.parenthesized)&&this.raise(_.ExportDefaultFromAsIdentifier,{at:t})}}else if(e.specifiers&&e.specifiers.length)for(let t of e.specifiers){let{exported:e}=t,n=e.type===`Identifier`?e.name:e.value;if(this.checkDuplicateExports(t,n),!r&&t.local){let{local:e}=t;e.type===`Identifier`?(this.checkReservedWord(e.name,e.loc.start,!0,!1),this.scope.checkLocalExport(e)):this.raise(_.ExportBindingIsString,{at:t,localName:e.value,exportName:n})}}else if(e.declaration){if(e.declaration.type===`FunctionDeclaration`||e.declaration.type===`ClassDeclaration`){let t=e.declaration.id;if(!t)throw Error(`Assertion failure`);this.checkDuplicateExports(e,t.name)}else if(e.declaration.type===`VariableDeclaration`)for(let t of e.declaration.declarations)this.checkDeclaration(t.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(_.DuplicateDefaultExport,{at:e}):this.raise(_.DuplicateExport,{at:e,exportName:t})),this.exportedIdentifiers.add(t)}parseExportSpecifiers(e){let t=[],n=!0;for(this.expect(5);!this.eat(8);){if(n)n=!1;else if(this.expect(12),this.eat(8))break;let r=this.isContextual(128),i=this.match(131),a=this.startNode();a.local=this.parseModuleExportName(),t.push(this.parseExportSpecifier(a,i,e,r))}return t}parseExportSpecifier(e,t,n,r){return this.eatContextual(93)?e.exported=this.parseModuleExportName():t?e.exported=Ft(e.local):e.exported||=K(e.local),this.finishNode(e,`ExportSpecifier`)}parseModuleExportName(){if(this.match(131)){let e=this.parseStringLiteral(this.state.value),t=e.value.match(On);return t&&this.raise(_.ModuleExportNameHasLoneSurrogate,{at:e,surrogateCharCode:t[0].charCodeAt(0)}),e}return this.parseIdentifier(!0)}isJSONModuleImport(e){return e.assertions!=null&&e.assertions.some(({key:e,value:t})=>t.value===`json`&&(e.type===`Identifier`?e.name===`type`:e.value===`type`))}checkImportReflection(e){e.module&&((e.specifiers.length!==1||e.specifiers[0].type!==`ImportDefaultSpecifier`)&&this.raise(_.ImportReflectionNotBinding,{at:e.specifiers[0].loc.start}),e.assertions?.length>0&&this.raise(_.ImportReflectionHasAssertion,{at:e.specifiers[0].loc.start}))}checkJSONModuleImport(e){if(this.isJSONModuleImport(e)&&e.type!==`ExportAllDeclaration`){let{specifiers:t}=e;if(t!=null){let e=t.find(e=>{let t;if(e.type===`ExportSpecifier`?t=e.local:e.type===`ImportSpecifier`&&(t=e.imported),t!==void 0)return t.type===`Identifier`?t.name!=="default":t.value!=="default"});e!==void 0&&this.raise(_.ImportJSONBindingNotDefault,{at:e.loc.start})}}}parseMaybeImportReflection(e){let t=!1;if(this.isContextual(125)){let e=this.lookahead(),n=e.type;A(n)?n===97?this.input.charCodeAt(this.nextTokenStartSince(e.end))===102&&(t=!0):t=!0:n!==12&&(t=!0)}t?(this.expectPlugin(`importReflection`),this.next(),e.module=!0):this.hasPlugin(`importReflection`)&&(e.module=!1)}parseImport(e){if(e.specifiers=[],!this.match(131)){this.parseMaybeImportReflection(e);let t=!this.maybeParseDefaultImportSpecifier(e)||this.eat(12),n=t&&this.maybeParseStarImportSpecifier(e);t&&!n&&this.parseNamedImportSpecifiers(e),this.expectContextual(97)}e.source=this.parseImportSource();let t=this.maybeParseImportAssertions();if(t)e.assertions=t;else{let t=this.maybeParseModuleAttributes();t&&(e.attributes=t)}return this.checkImportReflection(e),this.checkJSONModuleImport(e),this.semicolon(),this.finishNode(e,`ImportDeclaration`)}parseImportSource(){return this.match(131)||this.unexpected(),this.parseExprAtom()}shouldParseDefaultImport(e){return A(this.state.type)}parseImportSpecifierLocal(e,t,n){t.local=this.parseIdentifier(),e.specifiers.push(this.finishImportSpecifier(t,n))}finishImportSpecifier(e,t,n=ze){return this.checkLVal(e.local,{in:{type:t},binding:n}),this.finishNode(e,t)}parseAssertEntries(){let e=[],t=/* @__PURE__ */ new Set;do{if(this.match(8))break;let n=this.startNode(),r=this.state.value;if(t.has(r)&&this.raise(_.ModuleAttributesWithDuplicateKeys,{at:this.state.startLoc,key:r}),t.add(r),n.key=this.match(131)?this.parseStringLiteral(r):this.parseIdentifier(!0),this.expect(14),!this.match(131))throw this.raise(_.ModuleAttributeInvalidValue,{at:this.state.startLoc});n.value=this.parseStringLiteral(this.state.value),e.push(this.finishNode(n,`ImportAttribute`))}while(this.eat(12));return e}maybeParseModuleAttributes(){if(this.match(76)&&!this.hasPrecedingLineBreak())this.expectPlugin(`moduleAttributes`),this.next();else return this.hasPlugin(`moduleAttributes`)?[]:null;let e=[],t=/* @__PURE__ */ new Set;do{let n=this.startNode();if(n.key=this.parseIdentifier(!0),n.key.name!==`type`&&this.raise(_.ModuleAttributeDifferentFromType,{at:n.key}),t.has(n.key.name)&&this.raise(_.ModuleAttributesWithDuplicateKeys,{at:n.key,key:n.key.name}),t.add(n.key.name),this.expect(14),!this.match(131))throw this.raise(_.ModuleAttributeInvalidValue,{at:this.state.startLoc});n.value=this.parseStringLiteral(this.state.value),this.finishNode(n,`ImportAttribute`),e.push(n)}while(this.eat(12));return e}maybeParseImportAssertions(){if(this.isContextual(94)&&!this.hasPrecedingLineBreak())this.expectPlugin(`importAssertions`),this.next();else return this.hasPlugin(`importAssertions`)?[]:null;this.eat(5);let e=this.parseAssertEntries();return this.eat(8),e}maybeParseDefaultImportSpecifier(e){return this.shouldParseDefaultImport(e)?(this.parseImportSpecifierLocal(e,this.startNode(),`ImportDefaultSpecifier`),!0):!1}maybeParseStarImportSpecifier(e){if(this.match(55)){let t=this.startNode();return this.next(),this.expectContextual(93),this.parseImportSpecifierLocal(e,t,`ImportNamespaceSpecifier`),!0}return!1}parseNamedImportSpecifiers(e){let t=!0;for(this.expect(5);!this.eat(8);){if(t)t=!1;else{if(this.eat(14))throw this.raise(_.DestructureNamedImport,{at:this.state.startLoc});if(this.expect(12),this.eat(8))break}let n=this.startNode(),r=this.match(131),i=this.isContextual(128);n.imported=this.parseModuleExportName();let a=this.parseImportSpecifier(n,r,e.importKind===`type`||e.importKind===`typeof`,i,void 0);e.specifiers.push(a)}}parseImportSpecifier(e,t,n,r,i){if(this.eatContextual(93))e.local=this.parseIdentifier();else{let{imported:n}=e;if(t)throw this.raise(_.ImportBindingIsString,{at:e,importName:n.value});this.checkReservedWord(n.name,e.loc.start,!0,!0),e.local||=K(n)}return this.finishImportSpecifier(e,`ImportSpecifier`,i)}isThisParam(e){return e.type===`Identifier`&&e.name===`this`}},Mn=class extends jn{constructor(e,t){e=wn(e),super(e,t),this.options=e,this.initializeScopes(),this.plugins=Nn(this.options.plugins),this.filename=e.sourceFilename}getScopeHandler(){return Ue}parse(){this.enterInitialScopes();let e=this.startNode(),t=this.startNode();return this.nextToken(),e.errors=null,this.parseTopLevel(e,t),e.errors=this.state.errors,e}};function Nn(e){let t=/* @__PURE__ */ new Map;for(let n of e){let[e,r]=Array.isArray(n)?n:[n,{}];t.has(e)||t.set(e,r||{})}return t}function Pn(e,t){if(t?.sourceType===`unambiguous`){t=Object.assign({},t);try{t.sourceType=`module`;let n=Ln(t,e),r=n.parse();if(n.sawUnambiguousESM)return r;if(n.ambiguousScriptDifferentAst)try{return t.sourceType=`script`,Ln(t,e).parse()}catch{}else r.program.sourceType=`script`;return r}catch(n){try{return t.sourceType=`script`,Ln(t,e).parse()}catch{}throw n}}return Ln(t,e).parse()}function Fn(e,t){let n=Ln(t,e);return n.options.strictMode&&(n.state.strict=!0),n.getExpression()}function In(e){let t={};for(let n of Object.keys(e))t[n]=z(e[n]);return t}In(k);function Ln(e,t){let n=Mn;return e!=null&&e.plugins&&(bn(e.plugins),n=zn(e.plugins)),new n(e,t)}let Rn={};function zn(e){let t=Sn.filter(t=>Z(e,t)),n=t.join(`/`),r=Rn[n];if(!r){r=Mn;for(let e of t)r=xn[e](r);Rn[n]=r}return r}e.parse=Pn,e.parseExpression=Fn}));const E=/^[a-zA-Z][a-zA-Z\d+\-.]*?:/,D=/^[a-zA-Z]:\\/;function O(e){if(typeof e!=`string`)throw TypeError(`Expected a \`string\`, got \`${typeof e}\``);return!D.test(e)&&E.test(e)}function k(e){return(e??``).replace(/^\//,``).replace(/\/$/,``)}function A(e,t){return[k(e),t].filter(Boolean).join(`/`)}function ue(e,t){return k(t).length>k(e).length}const j=e=>e.label||e.mountPath||`${e.owner}/${e.repo}`,M=e=>typeof e==`object`&&!!e&&!Array.isArray(e),de=[...a,`groups`],fe=[...a,`groups`,`pages`],pe=e=>{let t=le({gitSources:e}),n=e.findIndex(e=>e===t);return n===-1?0:n},N=(e,t)=>!e||O(t)||t.startsWith(`#`)?t:t.startsWith(`/`)?`/${e}${t}`:`${e}/${t}`,P=(e,t)=>!e||O(t)?t:`${e}/${t.startsWith(`/`)?t.slice(1):t}`,F=(e,t)=>{let n=s(t);if(n){if(!n.filename)return t;let r=t.trim();return`${P(e,n.filename)}${r.slice(n.filename.length)}`}return N(e,t)},me=(e,t)=>{let n=Object.assign({},t);return typeof n.source==`string`&&(n.source=P(e,n.source)),typeof n.directory==`string`&&(n.directory=P(e,n.directory)),Array.isArray(n.overlays)&&(n.overlays=n.overlays.map(t=>typeof t==`string`?P(e,t):t)),n},I=(e,t)=>typeof t==`string`?P(e,t):Array.isArray(t)?t.map(t=>typeof t==`string`?P(e,t):M(t)?me(e,t):t):M(t)?me(e,t):t,he=(e,t)=>{if(typeof t==`string`)return e?{source:/^https:\/\//i.test(t)?t:P(e,t),directory:P(e,`graphql-reference`)}:t;if(!M(t))return t;let n=Object.assign({},t);return typeof n.source==`string`&&(n.source=/^https:\/\//i.test(n.source)?n.source:P(e,n.source)),typeof n.directory==`string`?n.directory=P(e,n.directory):e&&(n.directory=P(e,`graphql-reference`)),n},ge=(e,t)=>{if(!M(t))return{};let n=Object.assign({},t),{api:r}=t;if(!M(r))return n;let i=Object.assign({},r);return i.openapi!==void 0&&(i.openapi=I(e,i.openapi)),i.asyncapi!==void 0&&(i.asyncapi=I(e,i.asyncapi)),n.api=i,n},_e=(e,t)=>{let n=Object.assign({},t);for(let[t,r]of Object.entries(n))Array.isArray(r)&&(n[t]=r.map(t=>{if(!M(t))return t;let n=Object.assign({},t);return typeof n.href==`string`&&(n.href=N(e,n.href)),typeof n.icon==`string`&&n.icon.startsWith(`/`)&&(n.icon=N(e,n.icon)),n}));return n},L=(e,t)=>{if(!M(t))return{};let n=Object.assign({},t);typeof n.root==`string`&&(n.root=N(e,n.root)),typeof n.href==`string`&&(n.href=N(e,n.href)),typeof n.icon==`string`&&n.icon.startsWith(`/`)&&(n.icon=N(e,n.icon)),Array.isArray(n.pages)&&(n.pages=n.pages.map(t=>typeof t==`string`?F(e,t):M(t)?L(e,t):t));for(let t of de){let r=n[t];Array.isArray(r)&&(n[t]=r.map(t=>M(t)?L(e,t):t))}return n.sdk!==void 0&&(n.sdk=I(e,n.sdk)),n.openapi!==void 0&&(n.openapi=I(e,n.openapi)),n.asyncapi!==void 0&&(n.asyncapi=I(e,n.asyncapi)),n.graphql!==void 0&&(n.graphql=he(e,n.graphql)),M(n.global)&&(n.global=_e(e,n.global)),n},R=(e,t)=>{let{redirects:n}=t;return!e||!Array.isArray(n)?t:Object.assign(Object.assign({},t),{redirects:n.map(t=>{if(!M(t))return t;let n=Object.assign({},t);return typeof n.source==`string`&&(n.source=N(e,n.source)),typeof n.destination==`string`&&(n.destination=N(e,n.destination)),n})})},ve=(e,t,n,r)=>{let i=[n,...t.map((e,t)=>t).filter(e=>e!==n)].flatMap(r=>{let i=e[r];if(!i)return[];let a=r===n?``:k(t[r]?.mountPath),o=R(a,i).redirects;return Array.isArray(o)?o:[]}),a=/* @__PURE__ */ new Set,o=i.filter(e=>{let t=M(e)?e.source:void 0;return typeof t==`string`?a.has(t)?(r.push(`Dropped duplicate redirect for ${t}; the first definition wins`),!1):(a.add(t),!0):!0});return o.length>0?{redirects:o}:{}},ye=e=>M(e)&&typeof e.sourceRef==`string`,z=e=>ye(e)?!0:Array.isArray(e)?e.some(z):M(e)?Object.values(e).some(z):!1,B=(e,t,n,r)=>{let i=e[n]?.variables??{},a={},o=/* @__PURE__ */ new Map;return t.forEach((t,s)=>{if(s===n)return;let c=e[s]?.variables;if(c)for(let[e,n]of Object.entries(c)){let s=o.get(e);s?a[e]!==n&&!(e in i)&&r.push(`Variable "${e}" is defined by multiple git sources (${j(s)} and ${j(t)}); using the value from ${j(s)}`):(a[e]=n,o.set(e,t))}}),Object.assign(a,i),Object.keys(a).length>0?a:void 0},be=e=>{let t=k(e).toLowerCase(),n=t.split(`/`);return n.length>=2&&n.every(Boolean)?t:null},xe=e=>{if(!e.owner||!e.repo)return null;let t=be(`${e.owner}/${e.repo}`);if(!t)return null;let n=t.split(`/`);return{canonical:t,aliases:n.length>2?[n.slice(-2).join(`/`)]:[]}},Se=(e,t)=>{let n=/* @__PURE__ */ new Map,r=/* @__PURE__ */ new Map,i=/* @__PURE__ */ new Set;for(let[a,o]of t.entries()){let t=e[a];if(!t)continue;let s=xe(o);if(!s)continue;let c=n.get(s.canonical);if(c)return`sourceRef ${s.canonical} is ambiguous between ${j(c.source)} and ${j(o)}`;n.set(s.canonical,{config:t,source:o});for(let e of s.aliases)r.has(e)?i.add(e):r.set(e,{config:t,source:o})}for(let[e,t]of r)i.has(e)||n.has(e)||n.set(e,t);return n},Ce=(e,t,n)=>{let r=M(e)?e:void 0,i=M(r?.global)?r.global:void 0,a=n?i?.[t]:r?.[t];return Array.isArray(a)?a:null},V=(e,t)=>{let{sourceContexts:n,customBasePath:r,currentDivision:i,inGlobal:a=!1,resolving:o=[]}=t;if(ye(e)){if(!i)return{success:!1,summary:`sourceRef must be used inside a navigation array`};let t=be(e.sourceRef);if(!t)return{success:!1,summary:`sourceRef ${e.sourceRef} must be in owner/repo format`};let s=n.get(t);if(!s)return{success:!1,summary:`No git source found for sourceRef ${e.sourceRef}`};if(o.includes(t))return{success:!1,summary:`Circular sourceRef detected for ${e.sourceRef}`};let c=A(r,k(s.source.mountPath));if(i===`menu`&&!a){let e=de.flatMap(e=>(Ce(s.config.navigation,e,!1)??[]).flatMap(e=>M(e)&&Array.isArray(e.menu)?e.menu:[]));if(e.length===0)return{success:!1,summary:`Git source ${j(s.source)} does not define a menu under its root navigation`};let l=e.map(e=>M(e)?L(c,e):e);return V(l,{sourceContexts:n,customBasePath:r,currentDivision:i,inGlobal:a,resolving:[...o,t]})}let l=Ce(s.config.navigation,i,a);if(!l){let e=a?`navigation.global.${i}`:`navigation.${i}`;return{success:!1,summary:`Git source ${j(s.source)} does not define ${e}`}}let u=l.map(e=>M(e)?L(c,e):typeof e==`string`?F(c,e):e),d=V(u,{sourceContexts:n,customBasePath:r,currentDivision:i,inGlobal:a,resolving:[...o,t]});return d.success,d}if(Array.isArray(e)){let t=[];for(let s of e){let e=V(s,{sourceContexts:n,customBasePath:r,currentDivision:i,inGlobal:a,resolving:o});if(!e.success)return e;Array.isArray(e.value)?t.push(...e.value):t.push(e.value)}return{success:!0,value:t}}if(!M(e))return{success:!0,value:e};let s=Object.assign({},e);for(let[e,t]of Object.entries(s)){let c=fe.includes(e)?e:i,l=V(t,{sourceContexts:n,customBasePath:r,currentDivision:c,inGlobal:e===`global`||a,resolving:o});if(!l.success)return l;s[e]=l.value}return{success:!0,value:s}};function we(e,t,n=``){if(t.length===0||e.length!==t.length)return{success:!1,summary:`Each git source must have a docs config to merge`};let r=pe(t),i=e[r],a=t[r];if(!i||!a)return{success:!1,summary:`Each git source must have a docs config to merge`};let o=[],s=Se(e,t);if(typeof s==`string`)return{success:!1,summary:s};let c=B(e,t,r,o),l=ve(e,t,r,o);if(z(i.navigation)){let e=A(n,k(a.mountPath)),t=V(L(e,i.navigation),{sourceContexts:s,customBasePath:n});return t.success?H(R(k(n),Object.assign(Object.assign(Object.assign(Object.assign({},ge(e,i)),l),c?{variables:c}:{}),{navigation:t.value})),o):t}let u=[];for(let[r,i]of t.entries()){let t=e[r];if(!t)return{success:!1,summary:`Each git source must have a docs config to merge`};if(`products`in t.navigation)return{success:!1,summary:`Git source ${j(i)} uses navigation.products, which cannot be nested under a product in the merged docs config`};let a=k(i.mountPath);u.push(Object.assign(Object.assign({},L(A(n,a),t.navigation)),{product:i.label||t.name}))}let d=A(n,k(a.mountPath));return H(R(k(n),Object.assign(Object.assign(Object.assign(Object.assign({},ge(d,i)),l),c?{variables:c}:{}),{navigation:{products:u}})),o)}function H(e,t){let r=n.safeParse(e);return r.success?{success:!0,docsConfig:r.data,warnings:t}:{success:!1,summary:`Merged docs config is invalid: ${r.error.issues.slice(0,5).map(o).join(`; `)}`}}var Te=/* @__PURE__ */ e(c(),1),Ee=T();function De(e){let t=/* @__PURE__ */ new Set,n=[],r=e.some(e=>e.trimStart().startsWith(`!`));for(let i of e){let e=i.replace(/^\//,``).replace(/\/$/,``);!r&&!i.startsWith(`#`)&&!i.endsWith(`/`)&&e.includes(`/`)&&!/[!*?\[\]\\\s]/.test(i)&&!e.split(`/`).some(e=>e===`.`||e===`..`)?t.add(e.toLowerCase()):n.push(i)}let a=i(n);return(e,n=!1)=>{let r=e.toLowerCase();for(;r;){if(t.has(r))return!0;let e=r.lastIndexOf(`/`);r=e<0?``:r.slice(0,e)}return l(e,a,n)}}var U=function(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})},W=function(e){return this instanceof W?(this.v=e,this):new W(e)},Oe=function(e){if(!Symbol.asyncIterator)throw TypeError(`Symbol.asyncIterator is not defined.`);var t=e[Symbol.asyncIterator],n;return t?t.call(e):(e=typeof __values==`function`?__values(e):e[Symbol.iterator](),n={},r(`next`),r(`throw`),r(`return`),n[Symbol.asyncIterator]=function(){return this},n);function r(t){n[t]=e[t]&&function(n){return new Promise(function(r,a){n=e[t](n),i(r,a,n.done,n.value)})}}function i(e,t,n,r){Promise.resolve(r).then(function(t){e({value:t,done:n})},t)}},ke=function(e){var t={},n;return r(`next`),r(`throw`,function(e){throw e}),r(`return`),t[Symbol.iterator]=function(){return this},t;function r(r,i){t[r]=e[r]?function(t){return(n=!n)?{value:W(e[r](t)),done:!1}:i?i(t):t}:i}},Ae=function(e,t,n){if(!Symbol.asyncIterator)throw TypeError(`Symbol.asyncIterator is not defined.`);var r=n.apply(e,t||[]),i,a=[];return i=Object.create((typeof AsyncIterator==`function`?AsyncIterator:Object).prototype),s(`next`),s(`throw`),s(`return`,o),i[Symbol.asyncIterator]=function(){return this},i;function o(e){return function(t){return Promise.resolve(t).then(e,d)}}function s(e,t){r[e]&&(i[e]=function(t){return new Promise(function(n,r){a.push([e,t,n,r])>1||c(e,t)})},t&&(i[e]=t(i[e])))}function c(e,t){try{l(r[e](t))}catch(e){f(a[0][3],e)}}function l(e){e.value instanceof W?Promise.resolve(e.value.v).then(u,d):f(a[0][2],e)}function u(e){c(`next`,e)}function d(e){c(`throw`,e)}function f(e,t){e(t),a.shift(),a.length&&c(a[0][0],a[0][1])}};const je=e=>typeof e==`object`&&!!e&&!Array.isArray(e),Me=(e,t)=>t.startsWith(`/${e}`)&&[``,`/`,`?`,`#`].includes(t.charAt(e.length+1)),Ne=(e,t)=>!e||/^(?:[a-z][a-z\d+.-]*:|\/\/|#|\?)/i.test(t)||Me(e,t)?t:`${t.startsWith(`/`)?`/`:``}${e}/${t.replace(/^\/+/,``)}`;function Pe(e,t){if(e.filter(e=>e.base).length!==1)throw Error(`Exactly one source must have base: true.`);let n=we(t.map((t,n)=>{let r=u(t);if(!r.success)throw Error(`Invalid docs.json in ${e[n]?.repo}: ${r.error.message}`);return r.data}),e.map(e=>{let t=e.repo.split(`/`),n=t.pop(),r=t.join(`/`);if(!r||!n)throw Error(`Repository must use owner/repo: ${e.repo}`);return{type:`github`,owner:r,repo:n,deployBranch:``,contentDirectory:``,isPrivate:!1,mountPath:e.mountPath,label:``,isBase:e.base}}));if(!n.success)throw Error(n.summary);for(let e of n.warnings)console.warn(`[multi-repo] ${e}`);return n.docsConfig}const Fe=f().use(p,[`yaml`]).use(h).use(m).freeze();function Ie(e,t,n=[]){if(!t||!/(?:\]\(\s*\/|^\s*\[[^\]]+\]:\s*\/|(?:href|src|poster)\s*=\s*(?:["']\/|\{)|(?:\bfrom|\bimport)\s*["']\/)/m.test(e))return e;let r=e=>n.some(t=>t&&Me(t,e))?e:Ne(t,e),i=Fe,a={count:0},o=i.parse(e);return d(o,e=>{if((e.type===`link`||e.type===`image`||e.type===`definition`)&&e.url.startsWith(`/`)){let t=r(e.url);t!==e.url&&a.count++,e.url=t}if(e.type===`mdxJsxFlowElement`||e.type===`mdxJsxTextElement`)for(let t of e.attributes){if(t.type!==`mdxJsxAttribute`||![`href`,`src`,`poster`].includes(t.name))continue;let e;if(typeof t.value==`string`)e=t.value;else if(t.value?.type===`mdxJsxAttributeValueExpression`)try{let n=(0,Ee.parseExpression)(t.value.value);n.type===`StringLiteral`?e=n.value:n.type===`TemplateLiteral`&&n.expressions.length===0&&(e=n.quasis[0]?.value.cooked??void 0)}catch{continue}if(!e?.startsWith(`/`))continue;let n=r(e);n!==e&&(a.count++,t.value=n)}if(e.type===`mdxjsEsm`){let r=Le(e.value,t,`snippet.jsx`,n);r!==e.value&&a.count++,e.value=r}}),a.count>0?i.stringify(o):e}function Le(e,t,n=`snippet.jsx`,r=[]){if(!/\b(?:import|export)\b/.test(e))return e;let i=(0,Ee.parse)(e,{sourceType:`module`,plugins:n.endsWith(`.ts`)?[`typescript`]:[`typescript`,`jsx`]}),a=[];for(let e of i.program.body){if(e.type!==`ImportDeclaration`&&e.type!==`ExportNamedDeclaration`&&e.type!==`ExportAllDeclaration`)continue;let n=e.source;if(!n||n.start==null||n.end==null||!n.value.startsWith(`/`))continue;let i=r.some(e=>e&&Me(e,n.value))?n.value:Ne(t,n.value);i!==n.value&&a.push({start:n.start,end:n.end,value:i})}for(let t of a.reverse())e=e.slice(0,t.start)+JSON.stringify(t.value)+e.slice(t.end);return e}function Re(e){return U(this,arguments,void 0,function*(e,t=!0,n={}){var i,a;let o=w.resolve(e),s=te.parse(JSON.parse(yield y(o,`utf8`)));if(s.sources.filter(e=>e.base).length!==1)throw Error(`Exactly one source must have base: true.`);let c=/* @__PURE__ */ new Set,l=/* @__PURE__ */ new Set,u=s.sources.map(e=>{let t=e.mountPath.replace(/^\/+|\/+$/g,``);if(t.split(`/`).some(e=>e===`..`||e===`.`)||t.includes(`\\`))throw Error(`Invalid mountPath: ${e.mountPath}`);if(c.has(e.repo)||l.has(t))throw Error(`Each repo and mountPath must be unique.`);return c.add(e.repo),l.add(t),Object.assign(Object.assign({},e),{mountPath:t,directory:ee(e.directory,w.dirname(o))})}),d=yield Promise.all(u.map(e=>U(this,void 0,void 0,function*(){return{source:e,realRoot:yield ae(e.directory),ignores:De(yield r(e.directory)),files:/* @__PURE__ */ new Map}}))),{openCompositionCache:f}=yield import(`./multi-repo-cache-BXVYZO0d.js`),p=n.compositionCacheDirectory?yield f(n.compositionCacheDirectory,u,`copy`):void 0;(i=n.onProgress)==null||i.call(n,{stage:p?.index?`cached`:`cold`,files:0});let m=p?.directory??(yield ie(w.join(_.tmpdir(),`mint-multi-repo-`))),h=yield ie(w.join(w.dirname(m),`mint-multi-stage-`)),ce=w.join(h,`case-probe-a`);yield C(ce,``,{flag:`wx`});let le;try{le=!(yield S(w.join(h,`CASE-PROBE-A`)).catch(e=>{if(e.code!==`ENOENT`)throw e}))}finally{yield x(ce,{force:!0})}let T=e=>le?e:e.toLowerCase(),E=/* @__PURE__ */ new Map,D=/* @__PURE__ */ new Set,O=/* @__PURE__ */ new Map,k=e=>U(this,void 0,void 0,function*(){let t=w.relative(m,w.dirname(e));if(t===`..`||t.startsWith(`..${w.sep}`)||w.isAbsolute(t))throw Error(`Output path escapes composition: ${e}`);let n=m;for(let e of[``,...t.split(w.sep).filter(Boolean)]){e&&(n=w.join(n,e));let t=O.get(n);if(!t){let e=n;t=U(this,void 0,void 0,function*(){let t=yield v(e).catch(e=>{if(e.code!==`ENOENT`)throw e});if(t?.isSymbolicLink())throw Error(`Composition cache contains a symbolic link: ${e}. Remove the damaged cache entry and retry.`);if(t&&!t.isDirectory())throw Error(`Mounted file blocks directory: ${e}`);yield re(e,{recursive:!0})}),O.set(n,t),t.catch(()=>O.delete(e))}yield t}}),A=e=>U(this,void 0,void 0,function*(){e===h||e.startsWith(h+w.sep)?yield re(e,{recursive:!0}):yield k(w.join(e,`.output`))});if(p?.index)for(let e of d)for(let[t,n]of p.index.files[e.source.repo]??[]){e.files.set(t,n);let r=T(w.posix.join(e.source.mountPath,t)),i=E.get(r);(!i||ue(i.source.mountPath,e.source.mountPath))&&E.set(r,e)}let j,M,de=/* @__PURE__ */ new Set,fe=/* @__PURE__ */ new Map,pe,N=Promise.resolve(void 0),P=!0,F=!1,me=()=>F,I=(e,t,n=!1)=>[`docs.json`,`mint.json`,`.mintignore`].includes(t)||w.resolve(e.source.directory,t)===o||e.ignores(t,n);function he(e,t,n){return U(this,void 0,void 0,function*(){if(!e.files.has(t))return;let r=w.posix.join(e.source.mountPath,t);if(E.get(T(r))!==e)e.files.delete(t);else{yield k(w.join(m,r)),yield x(w.join(m,r),{recursive:!0,force:!0}),e.files.delete(t),E.delete(T(r)),n.removedFiles++;for(let t of[...d].sort((e,t)=>t.source.mountPath.length-e.source.mountPath.length)){if(t===e)continue;let i=t.source.mountPath;if(i&&!T(r).startsWith(`${T(i)}/`))continue;let a=i?r.slice(i.length+1):r;if(I(t,a))continue;let o=w.join(t.source.directory,a);if(!(yield v(o).catch(e=>{if(e.code!==`ENOENT`&&e.code!==`ENOTDIR`)throw e}))?.isFile())continue;let s=yield ae(o);if(!s.startsWith(t.realRoot+w.sep))continue;let c=w.relative(t.realRoot,s).split(w.sep).join(`/`);t.files.delete(c),yield _e(t,c,n);break}}})}function ge(e,t,n){return U(this,void 0,void 0,function*(){yield ne(e,t,g.COPYFILE_FICLONE),n.copiedFiles++})}function _e(e,t,n){return U(this,void 0,void 0,function*(){let r=w.join(e.source.directory,t),i=yield S(r).catch(e=>{if(e.code!==`ENOENT`&&e.code!==`ENOTDIR`)throw e});if(!i?.isFile())return;let a=w.posix.join(e.source.mountPath,t);yield k(w.join(m,a));let o=E.get(T(a));if(o&&o!==e){let t=ue(o.source.mountPath,e.source.mountPath);if(D.has(a)||(D.add(a),console.warn(`[multi-repo] Mounted file collision at ${a}; using ${t?e.source.repo:o.source.repo}.`)),!t)return}let s=o===e?e.files.get(t):void 0;if(s&&s.size===i.size&&s.mtimeMs===i.mtimeMs&&s.ctimeMs===i.ctimeMs){let r=yield v(w.join(m,e.source.mountPath,t)).catch(()=>void 0);if(r?.isFile()&&r.size===s.outputSize&&r.mtimeMs===s.outputMtimeMs){n.reusedFiles++,s.failed&&n.transformErrors++;return}}let c=w.join(m,a);if((yield v(c).catch(()=>void 0))?.isDirectory()){for(let[t,n]of E)if(t.startsWith(`${T(a)}/`)){if(n!==e)throw Error(`Mounted directory collision: ${a}`);for(let n of e.files.keys())T(w.posix.join(e.source.mountPath,n))===t&&e.files.delete(n);E.delete(t)}}let u=w.join(h,a);for(let e of[c,u])if((yield v(e).catch(()=>void 0))?.isDirectory()){yield x(e,{recursive:!0,force:!0});for(let t of O.keys())(t===e||t.startsWith(e+w.sep))&&O.delete(t)}E.set(T(a),e),yield A(w.dirname(u));let d,f=!1;if(e.source.mountPath&&/\.(?:mdx?|[jt]sx?)$/.test(t)){let a=yield y(r,`utf8`);n.readFiles++;let o=a,c=!1;try{o=/\.mdx?$/.test(t)?Ie(a,e.source.mountPath,[...l]):Le(a,e.source.mountPath,t,[...l])}catch{c=!0}if(f=c,c&&(n.transformErrors++,n.transformErrors<=3&&console.warn(`[multi-repo] Cannot rewrite ${e.source.repo}:${t}; retaining source for page diagnostics.`)),d=se(`sha256`).update(o).digest(`hex`),s?.digest===d&&!p){e.files.set(t,Object.assign(Object.assign({},s),{size:i.size,mtimeMs:i.mtimeMs,ctimeMs:i.ctimeMs,digest:d}));return}o===a?yield ge(r,u,n):(yield C(u,o),n.rewrittenFiles++)}else yield ge(r,u,n);yield A(w.dirname(w.join(m,a))),yield oe(u,w.join(m,a));let ee=yield S(w.join(m,a));e.files.set(t,{outputSize:ee.size,outputMtimeMs:ee.mtimeMs,failed:f,size:i.size,mtimeMs:i.mtimeMs,ctimeMs:i.ctimeMs,digest:d})})}function L(e,t,n){return Ae(this,arguments,function*(){let r=yield W(b(w.join(e.source.directory,t),{withFileTypes:!0}));for(let i of r){let r=w.posix.join(t,i.name);i.isSymbolicLink()||I(e,r,i.isDirectory())||(i.isDirectory()?(e.files.has(r)&&(yield W(he(e,r,n))),yield W(yield*ke(Oe(L(e,r,n))))):i.isFile()&&(yield yield W(r)))}})}function R(e,t){return U(this,arguments,void 0,function*(e,t,r=``){var i,a,o,s,c;let l=/* @__PURE__ */ new Set,u=e=>!r||e===r||e.startsWith(`${r}/`),d=n=>U(this,void 0,void 0,function*(){let r=(yield Promise.allSettled(n.map(n=>_e(e,n,t)))).find(e=>e.status===`rejected`);if(r?.status===`rejected`)throw r.reason}),f=[];try{for(var p=!0,m=Oe(L(e,r,t)),h;h=yield m.next(),i=h.done,!i;p=!0){s=h.value,p=!1;let e=s;l.add(e),t.scannedFiles++,P&&t.scannedFiles%1e3==0&&((c=n.onProgress)==null||c.call(n,{stage:`files`,files:t.scannedFiles})),f.push(e),f.length===8&&(yield d(f),f=[])}}catch(e){a={error:e}}finally{try{!p&&!i&&(o=m.return)&&(yield o.call(m))}finally{if(a)throw a.error}}yield d(f);for(let n of e.files.keys())u(n)&&!l.has(n)&&(yield he(e,n,t))})}function ve(e){return U(this,void 0,void 0,function*(){let t=[];for(let n of d){let r=JSON.parse(yield y(w.join(n.source.directory,`docs.json`),`utf8`));if(e.readFiles++,!je(r))throw Error(`Invalid docs.json in ${n.source.repo}`);t.push(r)}let n=JSON.stringify(Pe(u,t),null,2);if(n===j)return;yield k(w.join(m,`docs.json`));let r=w.join(h,`docs.json`);yield C(r,n),yield oe(r,w.join(m,`docs.json`)),j=n,e.rewrittenFiles++})}function ye(e){return U(this,void 0,void 0,function*(){var i;O.clear();let a=performance.now(),o={durationMs:0,scannedFiles:0,readFiles:0,copiedFiles:0,reusedFiles:0,checkpointMs:0,rewrittenFiles:0,removedFiles:0,transformErrors:0};if(e){let n=/* @__PURE__ */ new Set,i=!1;for(let t of e){let e=d.find(e=>e.source.repo===t.repo);if(!e)throw Error(`Unknown repository: ${t.repo}`);t.filename===`docs.json`&&(i=!0),(t.filename===void 0||t.filename===`.mintignore`)&&n.add(e)}i&&(yield ve(o));for(let e of n)e.ignores=De(yield r(e.source.directory)),t&&(yield we(e),yield ve(o)),yield R(e,o);let a=new Map(e.map(e=>[`${e.repo}\0${e.filename}`,e]));for(let e of a.values()){let t=d.find(t=>t.source.repo===e.repo),r=e.filename?.split(w.sep).join(`/`);if(!t||n.has(t)||!r||[`docs.json`,`.mintignore`].includes(r))continue;if(w.isAbsolute(r)||r.split(`/`).some(e=>e===`..`||e===`.`))throw Error(`Invalid changed path: ${r}`);if(I(t,r))continue;let i=w.join(t.source.directory,r),a=yield v(i).catch(e=>{if(e.code!==`ENOENT`&&e.code!==`ENOTDIR`)throw e});if(!a||a.isSymbolicLink()){if(t.files.has(r)){yield he(t,r,o);continue}for(let e of t.files.keys())e.startsWith(`${r}/`)&&(yield he(t,e,o));continue}let s=yield ae(i);(s===t.realRoot||s.startsWith(t.realRoot+w.sep))&&(a.isDirectory()?(t.files.has(r)&&(yield he(t,r,o)),t.ignores(r,!0)||(yield R(t,o,r))):a.isFile()&&(yield _e(t,r,o)))}}else{for(let e of d){let t=[...e.files.keys()];for(let n=0;n<t.length;n+=32){let r=yield Promise.all(t.slice(n,n+32).map(t=>U(this,void 0,void 0,function*(){return{filename:t,info:yield v(w.join(e.source.directory,t)).catch(e=>{if(e.code!==`ENOENT`&&e.code!==`ENOTDIR`)throw e})}})));for(let{filename:t,info:n}of r)if(!n?.isFile()||I(e,t)){let n=w.posix.join(e.source.mountPath,t);E.get(T(n))===e&&(yield k(w.join(m,n)),yield x(w.join(m,n),{recursive:!0,force:!0}),E.delete(T(n)),o.removedFiles++),e.files.delete(t)}}}O.clear(),yield ve(o);for(let e of[...d].sort((e,t)=>t.source.mountPath.length-e.source.mountPath.length))yield R(e,o);if(p){let e=(...t)=>U(this,[...t],void 0,function*(t=``){for(let n of yield b(w.join(m,t),{withFileTypes:!0})){let r=w.posix.join(t,n.name);n.isDirectory()?yield e(r):r!==`docs.json`&&!E.has(T(r))&&(yield x(w.join(m,r),{force:!0}),o.removedFiles++)}});yield e()}}if(o.transformErrors>3&&console.warn(`[multi-repo] ${o.transformErrors} files retained without path rewriting; page compiler diagnostics remain available.`),p){if(z=!0,P){let e=performance.now();yield be(),o.checkpointMs=performance.now()-e}else!F&&!B&&(B=setTimeout(()=>{B=void 0,N=N.then(be).then(()=>void 0).catch(e=>{console.error(`[multi-repo] Cache checkpoint failed:`,e)})},2e3),B.unref())}return o.durationMs=performance.now()-a,M=o,(i=n.onSync)==null||i.call(n,o),o})}let z=!1,B;function be(){return U(this,void 0,void 0,function*(){p&&z&&(yield p.save({config:j,files:Object.fromEntries(d.map(e=>[e.source.repo,[...e.files.entries()]]))}),z=!1)})}let xe=[],Se=e=>{let t=N.then(()=>U(this,void 0,void 0,function*(){let t=e?[...xe,...e]:void 0;xe=[];try{return yield ye(t)}catch(e){throw t&&(xe=t),e}}));return N=t.catch(()=>void 0),t},Ce=()=>{clearTimeout(pe),pe=void 0;let e=[...fe.values()];return fe.clear(),e.length&&Se(e).catch(e=>{console.error(`[multi-repo]`,e instanceof Error?e.message:e)}),N},V=()=>U(this,void 0,void 0,function*(){F=!0,clearTimeout(pe),clearTimeout(B),yield Promise.all([...de].map(e=>e.close())),yield N;try{yield be()}finally{yield x(h,{recursive:!0,force:!0}),yield p?.close()}});function we(e){return U(this,void 0,void 0,function*(){if(me()||(e.watcher&&(yield e.watcher.close(),de.delete(e.watcher)),me()))return;let t=Te.watch(e.source.directory,{ignoreInitial:!0,followSymlinks:!1,ignored:(t,n)=>{let r=w.relative(e.source.directory,t).split(w.sep).join(`/`);return!r||r===`docs.json`||r===`.mintignore`?!1:I(e,r,n?.isDirectory())}});de.add(t),e.watcher=t;let n=!1,r=new Promise((r,i)=>{t.once(`ready`,()=>{n=!0,r()}),t.on(`error`,t=>{n?console.error(`[multi-repo] Watcher failed for ${e.source.repo}:`,t):i(t)})});t.on(`all`,(t,n)=>{if(me())return;let r=w.relative(e.source.directory,n).split(w.sep).join(`/`);if(!r||r!==`docs.json`&&r!==`.mintignore`&&I(e,r))return;let i={repo:e.source.repo,filename:r};fe.set(`${i.repo}\0${r}`,i),!P&&!pe&&(pe=setTimeout(Ce,100))}),yield r})}let H=performance.now(),Ee=0;try{t&&((a=n.onProgress)==null||a.call(n,{stage:`watching`,files:0}),yield Promise.all(d.map(we))),Ee=performance.now()-H,yield Se(),P=!1,yield Ce()}catch(e){throw yield V(),e}return{directory:m,sources:u,sync:Se,flush:Ce,close:V,getStats:()=>M,getTimings:()=>({watcherReadyMs:Ee})}})}export{Pe as composeConfig,Ne as mountedPath,Re as prepareMultiRepoPreview,Ie as rewriteMdx};