UNPKG

acorn-typescript

Version:
1 lines 105 kB
import*as t from"acorn";import{tokTypes as e,TokContext as s,TokenType as i,keywordTypes as r}from"acorn";function a(t,e){for(var s=0;s<e.length;s++){var i=e[s];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,"symbol"==typeof(r=function(t,e){if("object"!=typeof t||null===t)return t;var s=t[Symbol.toPrimitive];if(void 0!==s){var i=s.call(t,"string");if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(i.key))?r:String(r),i)}var r}function n(){return n=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var s=arguments[e];for(var i in s)Object.prototype.hasOwnProperty.call(s,i)&&(t[i]=s[i])}return t},n.apply(this,arguments)}function o(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,h(t,e)}function h(t,e){return h=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},h(t,e)}function p(t,e){(null==e||e>t.length)&&(e=t.length);for(var s=0,i=new Array(e);s<e;s++)i[s]=t[s];return i}function c(t,e){var s="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(s)return(s=s.call(t)).next.bind(s);if(Array.isArray(t)||(s=function(t,e){if(t){if("string"==typeof t)return p(t,e);var s=Object.prototype.toString.call(t).slice(8,-1);return"Object"===s&&t.constructor&&(s=t.constructor.name),"Map"===s||"Set"===s?Array.from(t):"Arguments"===s||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(s)?p(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){s&&(t=s);var i=0;return function(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var l=!0;function u(t,e){return void 0===e&&(e={}),new i("name",e)}var d=new WeakMap;function m(t){var a=d.get(t.Parser.acorn||t);if(!a){var o={assert:u(0,{startsExpr:l}),asserts:u(0,{startsExpr:l}),global:u(0,{startsExpr:l}),keyof:u(0,{startsExpr:l}),readonly:u(0,{startsExpr:l}),unique:u(0,{startsExpr:l}),abstract:u(0,{startsExpr:l}),declare:u(0,{startsExpr:l}),enum:u(0,{startsExpr:l}),module:u(0,{startsExpr:l}),namespace:u(0,{startsExpr:l}),interface:u(0,{startsExpr:l}),type:u(0,{startsExpr:l})},h={at:new i("@"),jsxName:new i("jsxName"),jsxText:new i("jsxText",{beforeExpr:!0}),jsxTagStart:new i("jsxTagStart",{startsExpr:!0}),jsxTagEnd:new i("jsxTagEnd")},p={tc_oTag:new s("<tag",!1,!1),tc_cTag:new s("</tag",!1,!1),tc_expr:new s("<tag>...</tag>",!0,!0)},c=new RegExp("^(?:"+Object.keys(o).join("|")+")$");h.jsxTagStart.updateContext=function(){this.context.push(p.tc_expr),this.context.push(p.tc_oTag),this.exprAllowed=!1},h.jsxTagEnd.updateContext=function(t){var s=this.context.pop();s===p.tc_oTag&&t===e.slash||s===p.tc_cTag?(this.context.pop(),this.exprAllowed=this.curContext()===p.tc_expr):this.exprAllowed=!0},a={tokTypes:n({},o,h),tokContexts:n({},p),keywordsRegExp:c,tokenIsLiteralPropertyName:function(t){return[e.name,e.string,e.num].concat(Object.values(r),Object.values(o)).includes(t)},tokenIsKeywordOrIdentifier:function(t){return[e.name].concat(Object.values(r),Object.values(o)).includes(t)},tokenIsIdentifier:function(t){return[].concat(Object.values(o),[e.name]).includes(t)},tokenIsTSDeclarationStart:function(t){return[o.abstract,o.declare,o.enum,o.module,o.namespace,o.interface,o.type].includes(t)},tokenIsTSTypeOperator:function(t){return[o.keyof,o.readonly,o.unique].includes(t)},tokenIsTemplate:function(t){return t===e.invalidTemplate}}}return a}var f=1024,y=new RegExp("(?:[^\\S\\n\\r\\u2028\\u2029]|\\/\\/.*|\\/\\*.*?\\*\\/)*","y"),x=new RegExp("(?=("+y.source+"))\\1"+/(?=[\n\r\u2028\u2029]|\/\*(?!.*?\*\/)|$)/.source,"y"),T=function(){this.shorthandAssign=void 0,this.trailingComma=void 0,this.parenthesizedAssign=void 0,this.parenthesizedBind=void 0,this.doubleProto=void 0,this.shorthandAssign=this.trailingComma=this.parenthesizedAssign=this.parenthesizedBind=this.doubleProto=-1};function v(t,e){var s=e.key.name,i=t[s],r="true";return"MethodDefinition"!==e.type||"get"!==e.kind&&"set"!==e.kind||(r=(e.static?"s":"i")+e.kind),"iget"===i&&"iset"===r||"iset"===i&&"iget"===r||"sget"===i&&"sset"===r||"sset"===i&&"sget"===r?(t[s]="true",!1):!!i||(t[s]=r,!1)}function P(t,e){var s=t.key;return!t.computed&&("Identifier"===s.type&&s.name===e||"Literal"===s.type&&s.value===e)}var b={AbstractMethodHasImplementation:function(t){return"Method '"+t.methodName+"' cannot have an implementation because it is marked abstract."},AbstractPropertyHasInitializer:function(t){return"Property '"+t.propertyName+"' 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.",CannotFindName:function(t){return"Cannot find name '"+t.name+"'."},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:function(t){return"'declare' is not allowed in "+t.kind+"ters."},DeclareClassFieldHasInitializer:"Initializers are not allowed in ambient contexts.",DeclareFunctionHasImplementation:"An implementation cannot be declared in ambient contexts.",DuplicateAccessibilityModifier:function(){return"Accessibility modifier already seen."},DuplicateModifier:function(t){return"Duplicate modifier: '"+t.modifier+"'."},EmptyHeritageClauseType:function(t){return"'"+t.token+"' 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'.",IncompatibleModifiers:function(t){var e=t.modifiers;return"'"+e[0]+"' modifier cannot be used with '"+e[1]+"' modifier."},IndexSignatureHasAbstract:"Index signatures cannot have the 'abstract' modifier.",IndexSignatureHasAccessibility:function(t){return"Index signatures cannot have an accessibility modifier ('"+t.modifier+"')."},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:function(t){return"'"+t.modifier+"' modifier cannot appear on a type member."},InvalidModifierOnTypeParameter:function(t){return"'"+t.modifier+"' modifier cannot appear on a type parameter."},InvalidModifierOnTypeParameterPositions:function(t){return"'"+t.modifier+"' modifier can only appear on a type parameter of a class, interface or type alias."},InvalidModifiersOrder:function(t){var e=t.orderedModifiers;return"'"+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:function(t){return"Private elements cannot have an accessibility modifier ('"+t.modifier+"')."},PrivateMethodsHasAccessibility:function(t){return"Private methods cannot have an accessibility modifier ('"+t.modifier+"')."},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:function(t){var e=t.typeParameterName;return"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.",GenericsEndWithComma:"Trailing comma is not allowed at the end of generics.",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:function(t){return"Name in a signature must be an Identifier, ObjectPattern or ArrayPattern, instead got "+t.type+"."},LetInLexicalBinding:"'let' is not allowed to be used as a name in 'let' or 'const' declarations."},g={quot:'"',amp:"&",apos:"'",lt:"<",gt:">",nbsp:" ",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:"♦"},A=/^[\da-fA-F]+$/,S=/^\d+$/;function C(t){return t?"JSXIdentifier"===t.type?t.name:"JSXNamespacedName"===t.type?t.namespace.name+":"+t.name.name:"JSXMemberExpression"===t.type?C(t.object)+"."+C(t.property):void 0:t}var E=/(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g;function k(t){if(!t)throw new Error("Assert fail")}function I(t){return"accessor"===t}function N(t){return"in"===t||"out"===t}function w(t,e){return 2|(t?4:0)|(e?8:0)}function L(t){if("MemberExpression"!==t.type)return!1;var e=t.property;return(!t.computed||!("TemplateLiteral"!==e.type||e.expressions.length>0))&&M(t.object)}function M(t){return"Identifier"===t.type||"MemberExpression"===t.type&&!t.computed&&M(t.object)}function O(t){return"private"===t||"public"===t||"protected"===t}function D(e){var s=e||{},i=s.dts,r=void 0!==i&&i,n=s.allowSatisfies,h=void 0!==n&&n;return function(s){var i=s.acorn||t,n=m(i),p=i.tokTypes,l=i.keywordTypes,u=i.isIdentifierStart,d=i.lineBreak,y=i.isNewLine,M=i.tokContexts,D=i.isIdentifierChar,_=n.tokTypes,R=n.tokContexts,j=n.keywordsRegExp,F=n.tokenIsLiteralPropertyName,B=n.tokenIsTemplate,H=n.tokenIsTSDeclarationStart,q=n.tokenIsIdentifier,U=n.tokenIsKeywordOrIdentifier,V=n.tokenIsTSTypeOperator;function K(t,e,s){void 0===s&&(s=t.length);for(var i=e;i<s;i++){var r=t.charCodeAt(i);if(y(r))return i<s-1&&13===r&&10===t.charCodeAt(i+1)?i+2:i+1}return-1}s=function(t,e,s){var i=s.tokTypes,r=e.tokTypes;/*#__PURE__*/return function(t){function e(){return t.apply(this,arguments)||this}o(e,t);var s=e.prototype;return s.takeDecorators=function(t){var e=this.decoratorStack[this.decoratorStack.length-1];e.length&&(t.decorators=e,this.resetStartLocationFromNode(t,e[0]),this.decoratorStack[this.decoratorStack.length-1]=[])},s.parseDecorators=function(t){for(var e=this.decoratorStack[this.decoratorStack.length-1];this.match(r.at);){var s=this.parseDecorator();e.push(s)}this.match(i._export)?t||this.unexpected():this.canHaveLeadingDecorator()||this.raise(this.start,"Leading decorators must be attached to a class declaration.")},s.parseDecorator=function(){var t=this.startNode();this.next(),this.decoratorStack.push([]);var e,s=this.start,r=this.startLoc;if(this.match(i.parenL)){var a=this.start,n=this.startLoc;if(this.next(),e=this.parseExpression(),this.expect(i.parenR),this.options.preserveParens){var o=this.startNodeAt(a,n);o.expression=e,e=this.finishNode(o,"ParenthesizedExpression")}}else for(e=this.parseIdent(!1);this.eat(i.dot);){var h=this.startNodeAt(s,r);h.object=e,h.property=this.parseIdent(!0),h.computed=!1,e=this.finishNode(h,"MemberExpression")}return t.expression=this.parseMaybeDecoratorArguments(e),this.decoratorStack.pop(),this.finishNode(t,"Decorator")},s.parseMaybeDecoratorArguments=function(t){if(this.eat(i.parenL)){var e=this.startNodeAtNode(t);return e.callee=t,e.arguments=this.parseExprList(i.parenR,!1),this.finishNode(e,"CallExpression")}return t},e}(t)}(s,n,i),s=function(t,e,s,i){var r=t.tokTypes,a=e.tokTypes,n=t.isNewLine,h=t.isIdentifierChar,p=Object.assign({allowNamespaces:!0,allowNamespacedObjects:!0},i||{});/*#__PURE__*/return function(t){function e(){return t.apply(this,arguments)||this}o(e,t);var s=e.prototype;return s.jsx_readToken=function(){for(var t="",e=this.pos;;){this.pos>=this.input.length&&this.raise(this.start,"Unterminated JSX contents");var s=this.input.charCodeAt(this.pos);switch(s){case 60:case 123:return this.pos===this.start?60===s&&this.exprAllowed?(++this.pos,this.finishToken(a.jsxTagStart)):this.getTokenFromCode(s):(t+=this.input.slice(e,this.pos),this.finishToken(a.jsxText,t));case 38:t+=this.input.slice(e,this.pos),t+=this.jsx_readEntity(),e=this.pos;break;case 62:case 125:this.raise(this.pos,"Unexpected token `"+this.input[this.pos]+"`. Did you mean `"+(62===s?"&gt;":"&rbrace;")+'` or `{"'+this.input[this.pos]+'"}`?');default:n(s)?(t+=this.input.slice(e,this.pos),t+=this.jsx_readNewLine(!0),e=this.pos):++this.pos}}},s.jsx_readNewLine=function(t){var e,s=this.input.charCodeAt(this.pos);return++this.pos,13===s&&10===this.input.charCodeAt(this.pos)?(++this.pos,e=t?"\n":"\r\n"):e=String.fromCharCode(s),this.options.locations&&(++this.curLine,this.lineStart=this.pos),e},s.jsx_readString=function(t){for(var e="",s=++this.pos;;){this.pos>=this.input.length&&this.raise(this.start,"Unterminated string constant");var i=this.input.charCodeAt(this.pos);if(i===t)break;38===i?(e+=this.input.slice(s,this.pos),e+=this.jsx_readEntity(),s=this.pos):n(i)?(e+=this.input.slice(s,this.pos),e+=this.jsx_readNewLine(!1),s=this.pos):++this.pos}return e+=this.input.slice(s,this.pos++),this.finishToken(r.string,e)},s.jsx_readEntity=function(){var t,e="",s=0,i=this.input[this.pos];"&"!==i&&this.raise(this.pos,"Entity must start with an ampersand");for(var r=++this.pos;this.pos<this.input.length&&s++<10;){if(";"===(i=this.input[this.pos++])){"#"===e[0]?"x"===e[1]?(e=e.substr(2),A.test(e)&&(t=String.fromCharCode(parseInt(e,16)))):(e=e.substr(1),S.test(e)&&(t=String.fromCharCode(parseInt(e,10)))):t=g[e];break}e+=i}return t||(this.pos=r,"&")},s.jsx_readWord=function(){var t,e=this.pos;do{t=this.input.charCodeAt(++this.pos)}while(h(t)||45===t);return this.finishToken(a.jsxName,this.input.slice(e,this.pos))},s.jsx_parseIdentifier=function(){var t=this.startNode();return this.type===a.jsxName?t.name=this.value:this.type.keyword?t.name=this.type.keyword:this.unexpected(),this.next(),this.finishNode(t,"JSXIdentifier")},s.jsx_parseNamespacedName=function(){var t=this.start,e=this.startLoc,s=this.jsx_parseIdentifier();if(!p.allowNamespaces||!this.eat(r.colon))return s;var i=this.startNodeAt(t,e);return i.namespace=s,i.name=this.jsx_parseIdentifier(),this.finishNode(i,"JSXNamespacedName")},s.jsx_parseElementName=function(){if(this.type===a.jsxTagEnd)return"";var t=this.start,e=this.startLoc,s=this.jsx_parseNamespacedName();for(this.type!==r.dot||"JSXNamespacedName"!==s.type||p.allowNamespacedObjects||this.unexpected();this.eat(r.dot);){var i=this.startNodeAt(t,e);i.object=s,i.property=this.jsx_parseIdentifier(),s=this.finishNode(i,"JSXMemberExpression")}return s},s.jsx_parseAttributeValue=function(){switch(this.type){case r.braceL:var t=this.jsx_parseExpressionContainer();return"JSXEmptyExpression"===t.expression.type&&this.raise(t.start,"JSX attributes must only be assigned a non-empty expression"),t;case a.jsxTagStart:case r.string:return this.parseExprAtom();default:this.raise(this.start,"JSX value should be either an expression or a quoted JSX text")}},s.jsx_parseEmptyExpression=function(){var t=this.startNodeAt(this.lastTokEnd,this.lastTokEndLoc);return this.finishNodeAt(t,"JSXEmptyExpression",this.start,this.startLoc)},s.jsx_parseExpressionContainer=function(){var t=this.startNode();return this.next(),t.expression=this.type===r.braceR?this.jsx_parseEmptyExpression():this.parseExpression(),this.expect(r.braceR),this.finishNode(t,"JSXExpressionContainer")},s.jsx_parseAttribute=function(){var t=this.startNode();return this.eat(r.braceL)?(this.expect(r.ellipsis),t.argument=this.parseMaybeAssign(),this.expect(r.braceR),this.finishNode(t,"JSXSpreadAttribute")):(t.name=this.jsx_parseNamespacedName(),t.value=this.eat(r.eq)?this.jsx_parseAttributeValue():null,this.finishNode(t,"JSXAttribute"))},s.jsx_parseOpeningElementAt=function(t,e){var s=this.startNodeAt(t,e);s.attributes=[];var i=this.jsx_parseElementName();for(i&&(s.name=i);this.type!==r.slash&&this.type!==a.jsxTagEnd;)s.attributes.push(this.jsx_parseAttribute());return s.selfClosing=this.eat(r.slash),this.expect(a.jsxTagEnd),this.finishNode(s,i?"JSXOpeningElement":"JSXOpeningFragment")},s.jsx_parseClosingElementAt=function(t,e){var s=this.startNodeAt(t,e),i=this.jsx_parseElementName();return i&&(s.name=i),this.expect(a.jsxTagEnd),this.finishNode(s,i?"JSXClosingElement":"JSXClosingFragment")},s.jsx_parseElementAt=function(t,e){var s=this.startNodeAt(t,e),i=[],n=this.jsx_parseOpeningElementAt(t,e),o=null;if(!n.selfClosing){t:for(;;)switch(this.type){case a.jsxTagStart:if(t=this.start,e=this.startLoc,this.next(),this.eat(r.slash)){o=this.jsx_parseClosingElementAt(t,e);break t}i.push(this.jsx_parseElementAt(t,e));break;case a.jsxText:i.push(this.parseExprAtom());break;case r.braceL:i.push(this.jsx_parseExpressionContainer());break;default:this.unexpected()}C(o.name)!==C(n.name)&&this.raise(o.start,"Expected corresponding JSX closing tag for <"+C(n.name)+">")}var h=n.name?"Element":"Fragment";return s["opening"+h]=n,s["closing"+h]=o,s.children=i,this.type===r.relational&&"<"===this.value&&this.raise(this.start,"Adjacent JSX elements must be wrapped in an enclosing tag"),this.finishNode(s,"JSX"+h)},s.jsx_parseText=function(){var t=this.parseLiteral(this.value);return t.type="JSXText",t},s.jsx_parseElement=function(){var t=this.start,e=this.startLoc;return this.next(),this.jsx_parseElementAt(t,e)},e}(s)}(i,n,s,null==e?void 0:e.jsx),s=function(t,e,s){var i=e.tokTypes,r=s.tokTypes;/*#__PURE__*/return function(t){function e(){return t.apply(this,arguments)||this}o(e,t);var s=e.prototype;return s.parseMaybeImportAttributes=function(t){if(this.type===r._with||this.type===i.assert){this.next();var e=this.parseImportAttributes();e&&(t.attributes=e)}},s.parseImportAttributes=function(){this.expect(r.braceL);var t=this.parseWithEntries();return this.expect(r.braceR),t},s.parseWithEntries=function(){var t=[],e=new Set;do{if(this.type===r.braceR)break;var s,i=this.startNode();s=this.type===r.string?this.parseLiteral(this.value):this.parseIdent(!0),this.next(),i.key=s,e.has(i.key.name)&&this.raise(this.pos,"Duplicated key in attributes"),e.add(i.key.name),this.type!==r.string&&this.raise(this.pos,"Only string is supported as an attribute value"),i.value=this.parseLiteral(this.value),t.push(this.finishNode(i,"ImportAttribute"))}while(this.eat(r.comma));return t},e}(t)}(s,n,i);var z=/*#__PURE__*/function(t){function e(e,s,i){var r;return(r=t.call(this,e,s,i)||this).preValue=null,r.preToken=null,r.isLookahead=!1,r.isAmbientContext=!1,r.inAbstractClass=!1,r.inType=!1,r.inDisallowConditionalTypesContext=!1,r.maybeInArrowParameters=!1,r.shouldParseArrowReturnType=void 0,r.shouldParseAsyncArrowReturnType=void 0,r.decoratorStack=[[]],r.importsStack=[[]],r.importOrExportOuterKind=void 0,r.tsParseConstModifier=r.tsParseModifiers.bind(function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(r),{allowedModifiers:["const"],disallowedModifiers:["in","out"],errorTemplate:b.InvalidModifierOnTypeParameterPositions}),r}o(e,t);var s,m,g,A=e.prototype;return A.getTokenFromCodeInType=function(e){return 62===e||60===e?this.finishOp(p.relational,1):t.prototype.getTokenFromCode.call(this,e)},A.readToken=function(e){if(!this.inType){var s=this.curContext();if(s===R.tc_expr)return this.jsx_readToken();if(s===R.tc_oTag||s===R.tc_cTag){if(u(e))return this.jsx_readWord();if(62==e)return++this.pos,this.finishToken(_.jsxTagEnd);if((34===e||39===e)&&s==R.tc_oTag)return this.jsx_readString(e)}if(60===e&&this.exprAllowed&&33!==this.input.charCodeAt(this.pos+1))return++this.pos,this.finishToken(_.jsxTagStart)}return t.prototype.readToken.call(this,e)},A.getTokenFromCode=function(e){return this.inType?this.getTokenFromCodeInType(e):64===e?(++this.pos,this.finishToken(_.at)):t.prototype.getTokenFromCode.call(this,e)},A.isAbstractClass=function(){return this.ts_isContextual(_.abstract)&&this.lookahead().type===p._class},A.finishNode=function(e,s){return""!==e.type&&0!==e.end?e:t.prototype.finishNode.call(this,e,s)},A.tryParse=function(t,e){void 0===e&&(e=this.cloneCurLookaheadState());var s={node:null};try{return{node:t(function(t){throw void 0===t&&(t=null),s.node=t,s}),error:null,thrown:!1,aborted:!1,failState:null}}catch(t){var i=this.getCurLookaheadState();if(this.setLookaheadState(e),t instanceof SyntaxError)return{node:null,error:t,thrown:!0,aborted:!1,failState:i};if(t===s)return{node:s.node,error:null,thrown:!1,aborted:!0,failState:i};throw t}},A.setOptionalParametersError=function(t,e){var s;t.optionalParametersLoc=null!=(s=null==e?void 0:e.loc)?s:this.startLoc},A.reScan_lt_gt=function(){this.type===p.relational&&(this.pos-=1,this.readToken_lt_gt(this.fullCharCodeAtPos()))},A.reScan_lt=function(){var t=this.type;return t===p.bitShift?(this.pos-=2,this.finishOp(p.relational,1),p.relational):t},A.resetEndLocation=function(t,e){void 0===e&&(e=this.lastTokEndLoc),t.end=e.column,t.loc.end=e,this.options.ranges&&(t.range[1]=e.column)},A.startNodeAtNode=function(e){return t.prototype.startNodeAt.call(this,e.start,e.loc.start)},A.nextTokenStart=function(){return this.nextTokenStartSince(this.pos)},A.tsHasSomeModifiers=function(t,e){return e.some(function(e){return O(e)?t.accessibility===e:!!t[e]})},A.tsIsStartOfStaticBlocks=function(){return this.isContextual("static")&&123===this.lookaheadCharCode()},A.tsCheckForInvalidTypeCasts=function(t){var e=this;t.forEach(function(t){"TSTypeCastExpression"===(null==t?void 0:t.type)&&e.raise(t.typeAnnotation.start,b.UnexpectedTypeAnnotation)})},A.atPossibleAsyncArrow=function(t){return"Identifier"===t.type&&"async"===t.name&&this.lastTokEndLoc.column===t.end&&!this.canInsertSemicolon()&&t.end-t.start==5&&t.start===this.potentialArrowAt},A.tsIsIdentifier=function(){return q(this.type)},A.tsTryParseTypeOrTypePredicateAnnotation=function(){return this.match(p.colon)?this.tsParseTypeOrTypePredicateAnnotation(p.colon):void 0},A.tsTryParseGenericAsyncArrowFunction=function(e,s,i){var r=this;if(this.tsMatchLeftRelational()){var a=this.maybeInArrowParameters;this.maybeInArrowParameters=!0;var n=this.tsTryParseAndCatch(function(){var i=r.startNodeAt(e,s);return i.typeParameters=r.tsParseTypeParameters(),t.prototype.parseFunctionParams.call(r,i),i.returnType=r.tsTryParseTypeOrTypePredicateAnnotation(),r.expect(p.arrow),i});if(this.maybeInArrowParameters=a,n)return t.prototype.parseArrowExpression.call(this,n,null,!0,i)}},A.tsParseTypeArgumentsInExpression=function(){if(this.reScan_lt()===p.relational)return this.tsParseTypeArguments()},A.tsInNoContext=function(t){var e=this.context;this.context=[e[0]];try{return t()}finally{this.context=e}},A.tsTryParseTypeAnnotation=function(){return this.match(p.colon)?this.tsParseTypeAnnotation():void 0},A.isUnparsedContextual=function(t,e){var s=t+e.length;if(this.input.slice(t,s)===e){var i=this.input.charCodeAt(s);return!(D(i)||55296==(64512&i))}return!1},A.isAbstractConstructorSignature=function(){return this.ts_isContextual(_.abstract)&&this.lookahead().type===p._new},A.nextTokenStartSince=function(t){return E.lastIndex=t,E.test(this.input)?E.lastIndex:t},A.lookaheadCharCode=function(){return this.input.charCodeAt(this.nextTokenStart())},A.compareLookaheadState=function(t,e){for(var s=0,i=Object.keys(t);s<i.length;s++){var r=i[s];if(t[r]!==e[r])return!1}return!0},A.createLookaheadState=function(){this.value=null,this.context=[this.curContext()]},A.getCurLookaheadState=function(){return{endLoc:this.endLoc,lastTokEnd:this.lastTokEnd,lastTokStart:this.lastTokStart,lastTokStartLoc:this.lastTokStartLoc,pos:this.pos,value:this.value,type:this.type,start:this.start,end:this.end,context:this.context,startLoc:this.startLoc,lastTokEndLoc:this.lastTokEndLoc,curLine:this.curLine,lineStart:this.lineStart,curPosition:this.curPosition,containsEsc:this.containsEsc}},A.cloneCurLookaheadState=function(){return{pos:this.pos,value:this.value,type:this.type,start:this.start,end:this.end,context:this.context&&this.context.slice(),startLoc:this.startLoc,lastTokEndLoc:this.lastTokEndLoc,endLoc:this.endLoc,lastTokEnd:this.lastTokEnd,lastTokStart:this.lastTokStart,lastTokStartLoc:this.lastTokStartLoc,curLine:this.curLine,lineStart:this.lineStart,curPosition:this.curPosition,containsEsc:this.containsEsc}},A.setLookaheadState=function(t){this.pos=t.pos,this.value=t.value,this.endLoc=t.endLoc,this.lastTokEnd=t.lastTokEnd,this.lastTokStart=t.lastTokStart,this.lastTokStartLoc=t.lastTokStartLoc,this.type=t.type,this.start=t.start,this.end=t.end,this.context=t.context,this.startLoc=t.startLoc,this.lastTokEndLoc=t.lastTokEndLoc,this.curLine=t.curLine,this.lineStart=t.lineStart,this.curPosition=t.curPosition,this.containsEsc=t.containsEsc},A.tsLookAhead=function(t){var e=this.getCurLookaheadState(),s=t();return this.setLookaheadState(e),s},A.lookahead=function(t){var e=this.getCurLookaheadState();if(this.createLookaheadState(),this.isLookahead=!0,void 0!==t)for(var s=0;s<t;s++)this.nextToken();else this.nextToken();this.isLookahead=!1;var i=this.getCurLookaheadState();return this.setLookaheadState(e),i},A.readWord=function(){var t=this.readWord1(),e=p.name;return this.keywords.test(t)?e=l[t]:new RegExp(j).test(t)&&(e=_[t]),this.finishToken(e,t)},A.skipBlockComment=function(){var t;this.isLookahead||(t=this.options.onComment&&this.curPosition());var e=this.pos,s=this.input.indexOf("*/",this.pos+=2);if(-1===s&&this.raise(this.pos-2,"Unterminated comment"),this.pos=s+2,this.options.locations)for(var i,r=e;(i=K(this.input,r,this.pos))>-1;)++this.curLine,r=this.lineStart=i;this.isLookahead||this.options.onComment&&this.options.onComment(!0,this.input.slice(e+2,s),e,this.pos,t,this.curPosition())},A.skipLineComment=function(t){var e,s=this.pos;this.isLookahead||(e=this.options.onComment&&this.curPosition());for(var i=this.input.charCodeAt(this.pos+=t);this.pos<this.input.length&&!y(i);)i=this.input.charCodeAt(++this.pos);this.isLookahead||this.options.onComment&&this.options.onComment(!1,this.input.slice(s+t,this.pos),s,this.pos,e,this.curPosition())},A.finishToken=function(t,e){this.preValue=this.value,this.preToken=this.type,this.end=this.pos,this.options.locations&&(this.endLoc=this.curPosition());var s=this.type;this.type=t,this.value=e,this.isLookahead||this.updateContext(s)},A.resetStartLocation=function(t,e,s){t.start=e,t.loc.start=s,this.options.ranges&&(t.range[0]=e)},A.isLineTerminator=function(){return this.eat(p.semi)||t.prototype.canInsertSemicolon.call(this)},A.hasFollowingLineBreak=function(){return x.lastIndex=this.end,x.test(this.input)},A.addExtra=function(t,e,s,i){if(void 0===i&&(i=!0),t){var r=t.extra=t.extra||{};i?r[e]=s:Object.defineProperty(r,e,{enumerable:i,value:s})}},A.isLiteralPropertyName=function(){return F(this.type)},A.hasPrecedingLineBreak=function(){return d.test(this.input.slice(this.lastTokEndLoc.index,this.start))},A.createIdentifier=function(t,e){return t.name=e,this.finishNode(t,"Identifier")},A.resetStartLocationFromNode=function(t,e){this.resetStartLocation(t,e.start,e.loc.start)},A.isThisParam=function(t){return"Identifier"===t.type&&"this"===t.name},A.isLookaheadContextual=function(t){var e=this.nextTokenStart();return this.isUnparsedContextual(e,t)},A.ts_type_isContextual=function(t,e){return t===e&&!this.containsEsc},A.ts_isContextual=function(t){return this.type===t&&!this.containsEsc},A.ts_isContextualWithState=function(t,e){return t.type===e&&!t.containsEsc},A.isContextualWithState=function(t,e){return e.type===p.name&&e.value===t&&!e.containsEsc},A.tsIsStartOfMappedType=function(){return this.next(),this.eat(p.plusMin)?this.ts_isContextual(_.readonly):(this.ts_isContextual(_.readonly)&&this.next(),!!this.match(p.bracketL)&&(this.next(),!!this.tsIsIdentifier()&&(this.next(),this.match(p._in))))},A.tsInDisallowConditionalTypesContext=function(t){var e=this.inDisallowConditionalTypesContext;this.inDisallowConditionalTypesContext=!0;try{return t()}finally{this.inDisallowConditionalTypesContext=e}},A.tsTryParseType=function(){return this.tsEatThenParseType(p.colon)},A.match=function(t){return this.type===t},A.matchJsx=function(t){return this.type===n.tokTypes[t]},A.ts_eatWithState=function(t,e,s){if(t===s.type){for(var i=0;i<e;i++)this.next();return!0}return!1},A.ts_eatContextualWithState=function(t,e,s){if(j.test(t)){if(this.ts_isContextualWithState(s,_[t])){for(var i=0;i<e;i++)this.next();return!0}return!1}if(!this.isContextualWithState(t,s))return!1;for(var r=0;r<e;r++)this.next();return!0},A.canHaveLeadingDecorator=function(){return this.match(p._class)},A.eatContextual=function(e){return j.test(e)?!!this.ts_isContextual(_[e])&&(this.next(),!0):t.prototype.eatContextual.call(this,e)},A.tsIsExternalModuleReference=function(){return this.isContextual("require")&&40===this.lookaheadCharCode()},A.tsParseExternalModuleReference=function(){var t=this.startNode();return this.expectContextual("require"),this.expect(p.parenL),this.match(p.string)||this.unexpected(),t.expression=this.parseExprAtom(),this.expect(p.parenR),this.finishNode(t,"TSExternalModuleReference")},A.tsParseEntityName=function(t){void 0===t&&(t=!0);for(var e=this.parseIdent(t);this.eat(p.dot);){var s=this.startNodeAtNode(e);s.left=e,s.right=this.parseIdent(t),e=this.finishNode(s,"TSQualifiedName")}return e},A.tsParseEnumMember=function(){var t=this.startNode();return t.id=this.match(p.string)?this.parseLiteral(this.value):this.parseIdent(!0),this.eat(p.eq)&&(t.initializer=this.parseMaybeAssign()),this.finishNode(t,"TSEnumMember")},A.tsParseEnumDeclaration=function(t,e){return void 0===e&&(e={}),e.const&&(t.const=!0),e.declare&&(t.declare=!0),this.expectContextual("enum"),t.id=this.parseIdent(),this.checkLValSimple(t.id),this.expect(p.braceL),t.members=this.tsParseDelimitedList("EnumMembers",this.tsParseEnumMember.bind(this)),this.expect(p.braceR),this.finishNode(t,"TSEnumDeclaration")},A.tsParseModuleBlock=function(){var e=this.startNode();for(t.prototype.enterScope.call(this,512),this.expect(p.braceL),e.body=[];this.type!==p.braceR;){var s=this.parseStatement(null,!0);e.body.push(s)}return this.next(),t.prototype.exitScope.call(this),this.finishNode(e,"TSModuleBlock")},A.tsParseAmbientExternalModuleDeclaration=function(e){return this.ts_isContextual(_.global)?(e.global=!0,e.id=this.parseIdent()):this.match(p.string)?e.id=this.parseLiteral(this.value):this.unexpected(),this.match(p.braceL)?(t.prototype.enterScope.call(this,f),e.body=this.tsParseModuleBlock(),t.prototype.exitScope.call(this)):t.prototype.semicolon.call(this),this.finishNode(e,"TSModuleDeclaration")},A.tsTryParseDeclare=function(t){var e=this;if(!this.isLineTerminator()){var s,i=this.type;return this.isContextual("let")&&(i=p._var,s="let"),this.tsInAmbientContext(function(){if(i===p._function)return t.declare=!0,e.parseFunctionStatement(t,!1,!0);if(i===p._class)return t.declare=!0,e.parseClass(t,!0);if(i===_.enum)return e.tsParseEnumDeclaration(t,{declare:!0});if(i===_.global)return e.tsParseAmbientExternalModuleDeclaration(t);if(i===p._const||i===p._var)return e.match(p._const)&&e.isLookaheadContextual("enum")?(e.expect(p._const),e.tsParseEnumDeclaration(t,{const:!0,declare:!0})):(t.declare=!0,e.parseVarStatement(t,s||e.value,!0));if(i===_.interface){var r=e.tsParseInterfaceDeclaration(t,{declare:!0});if(r)return r}return q(i)?e.tsParseDeclaration(t,e.value,!0):void 0})}},A.tsIsListTerminator=function(t){switch(t){case"EnumMembers":case"TypeMembers":return this.match(p.braceR);case"HeritageClauseElement":return this.match(p.braceL);case"TupleElementTypes":return this.match(p.bracketR);case"TypeParametersOrArguments":return this.tsMatchRightRelational()}},A.tsParseDelimitedListWorker=function(t,e,s,i){for(var r=[],a=-1;!this.tsIsListTerminator(t);){a=-1;var n=e();if(null==n)return;if(r.push(n),!this.eat(p.comma)){if(this.tsIsListTerminator(t))break;return void(s&&this.expect(p.comma))}a=this.lastTokStart}return i&&(i.value=a),r},A.tsParseDelimitedList=function(t,e,s){return function(t){if(null==t)throw new Error("Unexpected "+t+" value.");return t}(this.tsParseDelimitedListWorker(t,e,!0,s))},A.tsParseBracketedList=function(t,e,s,i,r){i||this.expect(s?p.bracketL:p.relational);var a=this.tsParseDelimitedList(t,e,r);return this.expect(s?p.bracketR:p.relational),a},A.tsParseTypeParameterName=function(){return this.parseIdent().name},A.tsEatThenParseType=function(t){return this.match(t)?this.tsNextThenParseType():void 0},A.tsExpectThenParseType=function(t){var e=this;return this.tsDoThenParseType(function(){return e.expect(t)})},A.tsNextThenParseType=function(){var t=this;return this.tsDoThenParseType(function(){return t.next()})},A.tsDoThenParseType=function(t){var e=this;return this.tsInType(function(){return t(),e.tsParseType()})},A.tsSkipParameterStart=function(){if(q(this.type)||this.match(p._this))return this.next(),!0;if(this.match(p.braceL))try{return this.parseObj(!0),!0}catch(t){return!1}if(this.match(p.bracketL)){this.next();try{return this.parseBindingList(p.bracketR,!0,!0),!0}catch(t){return!1}}return!1},A.tsIsUnambiguouslyStartOfFunctionType=function(){if(this.next(),this.match(p.parenR)||this.match(p.ellipsis))return!0;if(this.tsSkipParameterStart()){if(this.match(p.colon)||this.match(p.comma)||this.match(p.question)||this.match(p.eq))return!0;if(this.match(p.parenR)&&(this.next(),this.match(p.arrow)))return!0}return!1},A.tsIsStartOfFunctionType=function(){return!!this.tsMatchLeftRelational()||this.match(p.parenL)&&this.tsLookAhead(this.tsIsUnambiguouslyStartOfFunctionType.bind(this))},A.tsInAllowConditionalTypesContext=function(t){var e=this.inDisallowConditionalTypesContext;this.inDisallowConditionalTypesContext=!1;try{return t()}finally{this.inDisallowConditionalTypesContext=e}},A.tsParseBindingListForSignature=function(){var e=this;return t.prototype.parseBindingList.call(this,p.parenR,!0,!0).map(function(t){return"Identifier"!==t.type&&"RestElement"!==t.type&&"ObjectPattern"!==t.type&&"ArrayPattern"!==t.type&&e.raise(t.start,b.UnsupportedSignatureParameterKind(t.type)),t})},A.tsParseTypePredicateAsserts=function(){if(this.type!==_.asserts)return!1;var t=this.containsEsc;return this.next(),!(!q(this.type)&&!this.match(p._this)||(t&&this.raise(this.lastTokStart,"Escape sequence in keyword asserts"),0))},A.tsParseThisTypeNode=function(){var t=this.startNode();return this.next(),this.finishNode(t,"TSThisType")},A.tsParseTypeAnnotation=function(t,e){var s=this;return void 0===t&&(t=!0),void 0===e&&(e=this.startNode()),this.tsInType(function(){t&&s.expect(p.colon),e.typeAnnotation=s.tsParseType()}),this.finishNode(e,"TSTypeAnnotation")},A.tsParseThisTypePredicate=function(t){this.next();var e=this.startNodeAtNode(t);return e.parameterName=t,e.typeAnnotation=this.tsParseTypeAnnotation(!1),e.asserts=!1,this.finishNode(e,"TSTypePredicate")},A.tsParseThisTypeOrThisTypePredicate=function(){var t=this.tsParseThisTypeNode();return this.isContextual("is")&&!this.hasPrecedingLineBreak()?this.tsParseThisTypePredicate(t):t},A.tsParseTypePredicatePrefix=function(){var t=this.parseIdent();if(this.isContextual("is")&&!this.hasPrecedingLineBreak())return this.next(),t},A.tsParseTypeOrTypePredicateAnnotation=function(t){var e=this;return this.tsInType(function(){var s=e.startNode();e.expect(t);var i=e.startNode(),r=!!e.tsTryParse(e.tsParseTypePredicateAsserts.bind(e));if(r&&e.match(p._this)){var a=e.tsParseThisTypeOrThisTypePredicate();return"TSThisType"===a.type?(i.parameterName=a,i.asserts=!0,i.typeAnnotation=null,a=e.finishNode(i,"TSTypePredicate")):(e.resetStartLocationFromNode(a,i),a.asserts=!0),s.typeAnnotation=a,e.finishNode(s,"TSTypeAnnotation")}var n=e.tsIsIdentifier()&&e.tsTryParse(e.tsParseTypePredicatePrefix.bind(e));if(!n)return r?(i.parameterName=e.parseIdent(),i.asserts=r,i.typeAnnotation=null,s.typeAnnotation=e.finishNode(i,"TSTypePredicate"),e.finishNode(s,"TSTypeAnnotation")):e.tsParseTypeAnnotation(!1,s);var o=e.tsParseTypeAnnotation(!1);return i.parameterName=n,i.typeAnnotation=o,i.asserts=r,s.typeAnnotation=e.finishNode(i,"TSTypePredicate"),e.finishNode(s,"TSTypeAnnotation")})},A.tsFillSignature=function(t,e){var s=t===p.arrow;e.typeParameters=this.tsTryParseTypeParameters(),this.expect(p.parenL),e.parameters=this.tsParseBindingListForSignature(),(s||this.match(t))&&(e.typeAnnotation=this.tsParseTypeOrTypePredicateAnnotation(t))},A.tsTryNextParseConstantContext=function(){if(this.lookahead().type!==p._const)return null;this.next();var t=this.tsParseTypeReference();return t.typeParameters&&this.raise(t.typeName.start,b.CannotFindName({name:"const"})),t},A.tsParseFunctionOrConstructorType=function(t,e){var s=this,i=this.startNode();return"TSConstructorType"===t&&(i.abstract=!!e,e&&this.next(),this.next()),this.tsInAllowConditionalTypesContext(function(){return s.tsFillSignature(p.arrow,i)}),this.finishNode(i,t)},A.tsParseUnionOrIntersectionType=function(t,e,s){var i=this.startNode(),r=this.eat(s),a=[];do{a.push(e())}while(this.eat(s));return 1!==a.length||r?(i.types=a,this.finishNode(i,t)):a[0]},A.tsCheckTypeAnnotationForReadOnly=function(t){switch(t.typeAnnotation.type){case"TSTupleType":case"TSArrayType":return;default:this.raise(t.start,b.UnexpectedReadonly)}},A.tsParseTypeOperator=function(){var t=this.startNode(),e=this.value;return this.next(),t.operator=e,t.typeAnnotation=this.tsParseTypeOperatorOrHigher(),"readonly"===e&&this.tsCheckTypeAnnotationForReadOnly(t),this.finishNode(t,"TSTypeOperator")},A.tsParseConstraintForInferType=function(){var t=this;if(this.eat(p._extends)){var e=this.tsInDisallowConditionalTypesContext(function(){return t.tsParseType()});if(this.inDisallowConditionalTypesContext||!this.match(p.question))return e}},A.tsParseInferType=function(){var t=this,e=this.startNode();this.expectContextual("infer");var s=this.startNode();return s.name=this.tsParseTypeParameterName(),s.constraint=this.tsTryParse(function(){return t.tsParseConstraintForInferType()}),e.typeParameter=this.finishNode(s,"TSTypeParameter"),this.finishNode(e,"TSInferType")},A.tsParseLiteralTypeNode=function(){var t=this,e=this.startNode();return e.literal=function(){switch(t.type){case p.num:case p.string:case p._true:case p._false:return t.parseExprAtom();default:t.unexpected()}}(),this.finishNode(e,"TSLiteralType")},A.tsParseImportType=function(){var t=this.startNode();return this.expect(p._import),this.expect(p.parenL),this.match(p.string)||this.raise(this.start,b.UnsupportedImportTypeArgument),t.argument=this.parseExprAtom(),this.expect(p.parenR),this.eat(p.dot)&&(t.qualifier=this.tsParseEntityName()),this.tsMatchLeftRelational()&&(t.typeParameters=this.tsParseTypeArguments()),this.finishNode(t,"TSImportType")},A.tsParseTypeQuery=function(){var t=this.startNode();return this.expect(p._typeof),t.exprName=this.match(p._import)?this.tsParseImportType():this.tsParseEntityName(),!this.hasPrecedingLineBreak()&&this.tsMatchLeftRelational()&&(t.typeParameters=this.tsParseTypeArguments()),this.finishNode(t,"TSTypeQuery")},A.tsParseMappedTypeParameter=function(){var t=this.startNode();return t.name=this.tsParseTypeParameterName(),t.constraint=this.tsExpectThenParseType(p._in),this.finishNode(t,"TSTypeParameter")},A.tsParseMappedType=function(){var t=this.startNode();return this.expect(p.braceL),this.match(p.plusMin)?(t.readonly=this.value,this.next(),this.expectContextual("readonly")):this.eatContextual("readonly")&&(t.readonly=!0),this.expect(p.bracketL),t.typeParameter=this.tsParseMappedTypeParameter(),t.nameType=this.eatContextual("as")?this.tsParseType():null,this.expect(p.bracketR),this.match(p.plusMin)?(t.optional=this.value,this.next(),this.expect(p.question)):this.eat(p.question)&&(t.optional=!0),t.typeAnnotation=this.tsTryParseType(),this.semicolon(),this.expect(p.braceR),this.finishNode(t,"TSMappedType")},A.tsParseTypeLiteral=function(){var t=this.startNode();return t.members=this.tsParseObjectTypeMembers(),this.finishNode(t,"TSTypeLiteral")},A.tsParseTupleElementType=function(){var t=this.startLoc,e=this.start,s=this.eat(p.ellipsis),i=this.tsParseType(),r=this.eat(p.question);if(this.eat(p.colon)){var a=this.startNodeAtNode(i);a.optional=r,"TSTypeReference"!==i.type||i.typeParameters||"Identifier"!==i.typeName.type?(this.raise(i.start,b.InvalidTupleMemberLabel),a.label=i):a.label=i.typeName,a.elementType=this.tsParseType(),i=this.finishNode(a,"TSNamedTupleMember")}else if(r){var n=this.startNodeAtNode(i);n.typeAnnotation=i,i=this.finishNode(n,"TSOptionalType")}if(s){var o=this.startNodeAt(e,t);o.typeAnnotation=i,i=this.finishNode(o,"TSRestType")}return i},A.tsParseTupleType=function(){var t=this,e=this.startNode();e.elementTypes=this.tsParseBracketedList("TupleElementTypes",this.tsParseTupleElementType.bind(this),!0,!1);var s=!1,i=null;return e.elementTypes.forEach(function(e){var r=e.type;!s||"TSRestType"===r||"TSOptionalType"===r||"TSNamedTupleMember"===r&&e.optional||t.raise(e.start,b.OptionalTypeBeforeRequired),s||(s="TSNamedTupleMember"===r&&e.optional||"TSOptionalType"===r);var a=r;"TSRestType"===r&&(a=(e=e.typeAnnotation).type);var n="TSNamedTupleMember"===a;null!=i||(i=n),i!==n&&t.raise(e.start,b.MixedLabeledAndUnlabeledElements)}),this.finishNode(e,"TSTupleType")},A.tsParseTemplateLiteralType=function(){var t=this.startNode();return t.literal=this.parseTemplate({isTagged:!1}),this.finishNode(t,"TSLiteralType")},A.tsParseTypeReference=function(){var t=this.startNode();return t.typeName=this.tsParseEntityName(),!this.hasPrecedingLineBreak()&&this.tsMatchLeftRelational()&&(t.typeParameters=this.tsParseTypeArguments()),this.finishNode(t,"TSTypeReference")},A.tsMatchLeftRelational=function(){return this.match(p.relational)&&"<"===this.value},A.tsMatchRightRelational=function(){return this.match(p.relational)&&">"===this.value},A.tsParseParenthesizedType=function(){var t=this.startNode();return this.expect(p.parenL),t.typeAnnotation=this.tsParseType(),this.expect(p.parenR),this.finishNode(t,"TSParenthesizedType")},A.tsParseNonArrayType=function(){switch(this.type){case p.string:case p.num:case p._true:case p._false:return this.tsParseLiteralTypeNode();case p.plusMin:if("-"===this.value){var t=this.startNode();return this.lookahead().type!==p.num&&this.unexpected(),t.literal=this.parseMaybeUnary(),this.finishNode(t,"TSLiteralType")}break;case p._this:return this.tsParseThisTypeOrThisTypePredicate();case p._typeof:return this.tsParseTypeQuery();case p._import:return this.tsParseImportType();case p.braceL:return this.tsLookAhead(this.tsIsStartOfMappedType.bind(this))?this.tsParseMappedType():this.tsParseTypeLiteral();case p.bracketL:return this.tsParseTupleType();case p.parenL:return this.tsParseParenthesizedType();case p.backQuote:case p.dollarBraceL:return this.tsParseTemplateLiteralType();default:var e=this.type;if(q(e)||e===p._void||e===p._null){var s=e===p._void?"TSVoidKeyword":e===p._null?"TSNullKeyword":function(t){switch(t){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}}(this.value);if(void 0!==s&&46!==this.lookaheadCharCode()){var i=this.startNode();return this.next(),this.finishNode(i,s)}return this.tsParseTypeReference()}}this.unexpected()},A.tsParseArrayTypeOrHigher=function(){for(var t=this.tsParseNonArrayType();!this.hasPrecedingLineBreak()&&this.eat(p.bracketL);)if(this.match(p.bracketR)){var e=this.startNodeAtNode(t);e.elementType=t,this.expect(p.bracketR),t=this.finishNode(e,"TSArrayType")}else{var s=this.startNodeAtNode(t);s.objectType=t,s.indexType=this.tsParseType(),this.expect(p.bracketR),t=this.finishNode(s,"TSIndexedAccessType")}return t},A.tsParseTypeOperatorOrHigher=function(){var t=this;return V(this.type)&&!this.containsEsc?this.tsParseTypeOperator():this.isContextual("infer")?this.tsParseInferType():this.tsInAllowConditionalTypesContext(function(){return t.tsParseArrayTypeOrHigher()})},A.tsParseIntersectionTypeOrHigher=function(){return this.tsParseUnionOrIntersectionType("TSIntersectionType",this.tsParseTypeOperatorOrHigher.bind(this),p.bitwiseAND)},A.tsParseUnionTypeOrHigher=function(){return this.tsParseUnionOrIntersectionType("TSUnionType",this.tsParseIntersectionTypeOrHigher.bind(this),p.bitwiseOR)},A.tsParseNonConditionalType=function(){return this.tsIsStartOfFunctionType()?this.tsParseFunctionOrConstructorType("TSFunctionType"):this.match(p._new)?this.tsParseFunctionOrConstructorType("TSConstructorType"):this.isAbstractConstructorSignature()?this.tsParseFunctionOrConstructorType("TSConstructorType",!0):this.tsParseUnionTypeOrHigher()},A.tsParseType=function(){var t=this;k(this.inType);var e=this.tsParseNonConditionalType();if(this.inDisallowConditionalTypesContext||this.hasPrecedingLineBreak()||!this.eat(p._extends))return e;var s=this.startNodeAtNode(e);return s.checkType=e,s.extendsType=this.tsInDisallowConditionalTypesContext(function(){return t.tsParseNonConditionalType()}),this.expect(p.question),s.trueType=this.tsInAllowConditionalTypesContext(function(){return t.tsParseType()}),this.expect(p.colon),s.fal