svelte-typecheck 0.1.7 → 0.1.8
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.
- package/cli.js +2 -2
- package/compile-worker.js +1 -0
- package/index.js +1 -1
- package/package.json +1 -1
- package/shared-2ek7s6xw.js +1 -0
- package/shared-7cvnvjc0.js +2 -0
- package/shared-8badht7e.js +4 -0
- package/shared-atsj8zxq.js +4 -0
- package/shared-ebbnnbmn.js +19 -0
- package/shared-exams0w3.js +6 -0
- package/shared-g75sf85w.js +47 -0
- package/shared-msaa239m.js +263 -0
- package/shared-xcpj2ac7.js +1 -0
- package/shared-5306yfge.js +0 -2
- package/shared-hk3rtr6f.js +0 -1
- package/shared-nh2k4882.js +0 -334
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import{Output}from"./shared-atsj8zxq.js";var names=Array(2048).fill(void 0);function resetNames(){names.fill(void 0)}function internName(input,start,end,hash){let slot=hash&2047,name=names[slot];if(name!==void 0&&name.length===end-start&&input.startsWith(name,start))return name;let word=input.slice(start,end);return names[slot]=word,word}var source="",lineStarts=[0],scanned=0,lastLine=0,breakEnds;function setSource(value){resetNames(),source=value,lineStarts=[0],scanned=0,lastLine=0,breakEnds=void 0}function scanTo(index){while(scanned<=index){let newline=source.indexOf(`
|
|
2
|
+
`,scanned);if(newline===-1){scanned=Number.POSITIVE_INFINITY;return}scanned=newline+1,lineStarts.push(scanned)}}function lineOf(starts,index,hint){let low=0,high=starts.length-1;if(index>=starts[hint])low=hint;else high=hint-1;if(low<high&&index<starts[low+1])high=low;while(low<high){let mid=low+high+1>>>1;if(starts[mid]<=index)low=mid;else high=mid-1}return low}function locate3(index){return scanTo(index),lastLine=lineOf(lineStarts,index,lastLine),{line:lastLine+1,column:index-lineStarts[lastLine],character:index}}var REGEX_LINE_BREAK=/\r\n?|\n|\u2028|\u2029/g,REGEX_OTHER_LINE_BREAK=/[\r\u2028\u2029]/;function lineBreaksBefore(offset){if(breakEnds===void 0){breakEnds=REGEX_OTHER_LINE_BREAK.test(source)?[]:null,REGEX_LINE_BREAK.lastIndex=0;while(breakEnds!==null&®EX_LINE_BREAK.exec(source)!==null)breakEnds.push(REGEX_LINE_BREAK.lastIndex)}if(breakEnds===null)return scanTo(offset),lineOf(lineStarts,offset,lastLine);let low=0,high=breakEnds.length;while(low<high){let mid=low+high>>>1;if(breakEnds[mid]<=offset)low=mid+1;else high=mid}return low}function position(index){let{line,column}=locate3(index);return{line,column}}function lineText(line){while(lineStarts.length<=line+1&&scanned!==Number.POSITIVE_INFINITY)scanTo(scanned);if(line>=lineStarts.length)return;let end=line+1<lineStarts.length?lineStarts[line+1]-1:source.length;return source.slice(lineStarts[line],end)}function isNode(value){return typeof value==="object"&&value!==null&&typeof fieldsOf(value).type==="string"}function fieldsOf(node){return node}function mapChildren(node,map){let fields=fieldsOf(node);for(let key in fields){let value=fields[key];if(Array.isArray(value)){for(let i=0;i<value.length;i++)if(isNode(value[i]))value[i]=map(value[i])}else if(isNode(value))fields[key]=map(value)}}function assertType(node,...types){if(!types.some((type)=>type===node.type))throw Error(`expected ${types.join(" or ")}, got ${node.type}`)}var reservedWords={3:"abstract boolean byte char class double enum export extends final float goto implements import int interface long native package private protected public short static super synchronized throws transient volatile",5:"class enum extends super const export import",6:"enum",strict:"implements interface let package private protected public static yield",strictBind:"eval arguments"},ecma5AndLessKeywords="break case catch continue debugger default do else finally for function if return switch throw try var while with null true false instanceof typeof void delete new in this",keywords$1={5:ecma5AndLessKeywords,"5module":ecma5AndLessKeywords+" export import",6:ecma5AndLessKeywords+" const class extends export import super"},keywordRelationalOperator=/^in(stanceof)?$/,nonASCIIidentifierStart=/\p{ID_Start}/u,nonASCIIidentifier=/[\p{ID_Continue}\u200c\u200d]/u;function isIdentifierStart(code,astral){if(code<65)return code===36;if(code<91)return!0;if(code<97)return code===95;if(code<123)return!0;if(code>65535&&astral===!1)return!1;return code>=170&&nonASCIIidentifierStart.test(String.fromCodePoint(code))}function isIdentifierChar(code,astral){if(code<48)return code===36;if(code<58)return!0;if(code<65)return!1;if(code<91)return!0;if(code<97)return code===95;if(code<123)return!0;if(code>65535&&astral===!1)return!1;return code>=170&&nonASCIIidentifier.test(String.fromCodePoint(code))}var TokenType=function(label,conf){if(conf===void 0)conf={};this.label=label,this.keyword=conf.keyword,this.beforeExpr=!!conf.beforeExpr,this.startsExpr=!!conf.startsExpr,this.isLoop=!!conf.isLoop,this.isAssign=!!conf.isAssign,this.prefix=!!conf.prefix,this.postfix=!!conf.postfix,this.binop=conf.binop||null,this.updateContext=null};function binop(name,prec){return new TokenType(name,{beforeExpr:!0,binop:prec})}var beforeExpr={beforeExpr:!0},startsExpr={startsExpr:!0},keywords={};function kw(name,options){if(options===void 0)options={};return options.keyword=name,keywords[name]=new TokenType(name,options)}var types$1={num:new TokenType("num",startsExpr),regexp:new TokenType("regexp",startsExpr),string:new TokenType("string",startsExpr),name:new TokenType("name",startsExpr),privateId:new TokenType("privateId",startsExpr),eof:new TokenType("eof"),bracketL:new TokenType("[",{beforeExpr:!0,startsExpr:!0}),bracketR:new TokenType("]"),braceL:new TokenType("{",{beforeExpr:!0,startsExpr:!0}),braceR:new TokenType("}"),parenL:new TokenType("(",{beforeExpr:!0,startsExpr:!0}),parenR:new TokenType(")"),comma:new TokenType(",",beforeExpr),semi:new TokenType(";",beforeExpr),colon:new TokenType(":",beforeExpr),dot:new TokenType("."),question:new TokenType("?",beforeExpr),questionDot:new TokenType("?."),arrow:new TokenType("=>",beforeExpr),template:new TokenType("template"),invalidTemplate:new TokenType("invalidTemplate"),ellipsis:new TokenType("...",beforeExpr),backQuote:new TokenType("`",startsExpr),dollarBraceL:new TokenType("${",{beforeExpr:!0,startsExpr:!0}),eq:new TokenType("=",{beforeExpr:!0,isAssign:!0}),assign:new TokenType("_=",{beforeExpr:!0,isAssign:!0}),incDec:new TokenType("++/--",{prefix:!0,postfix:!0,startsExpr:!0}),prefix:new TokenType("!/~",{beforeExpr:!0,prefix:!0,startsExpr:!0}),logicalOR:binop("||",1),logicalAND:binop("&&",2),bitwiseOR:binop("|",3),bitwiseXOR:binop("^",4),bitwiseAND:binop("&",5),equality:binop("==/!=/===/!==",6),relational:binop("</>/<=/>=",7),bitShift:binop("<</>>/>>>",8),plusMin:new TokenType("+/-",{beforeExpr:!0,binop:9,prefix:!0,startsExpr:!0}),modulo:binop("%",10),star:binop("*",10),slash:binop("/",10),starstar:new TokenType("**",{beforeExpr:!0}),coalesce:binop("??",1),_break:kw("break"),_case:kw("case",beforeExpr),_catch:kw("catch"),_continue:kw("continue"),_debugger:kw("debugger"),_default:kw("default",beforeExpr),_do:kw("do",{isLoop:!0,beforeExpr:!0}),_else:kw("else",beforeExpr),_finally:kw("finally"),_for:kw("for",{isLoop:!0}),_function:kw("function",startsExpr),_if:kw("if"),_return:kw("return",beforeExpr),_switch:kw("switch"),_throw:kw("throw",beforeExpr),_try:kw("try"),_var:kw("var"),_const:kw("const"),_while:kw("while",{isLoop:!0}),_with:kw("with"),_new:kw("new",{beforeExpr:!0,startsExpr:!0}),_this:kw("this",startsExpr),_super:kw("super",startsExpr),_class:kw("class",startsExpr),_extends:kw("extends",beforeExpr),_export:kw("export"),_import:kw("import",startsExpr),_null:kw("null",startsExpr),_true:kw("true",startsExpr),_false:kw("false",startsExpr),_in:kw("in",{beforeExpr:!0,binop:7}),_instanceof:kw("instanceof",{beforeExpr:!0,binop:7}),_typeof:kw("typeof",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_void:kw("void",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_delete:kw("delete",{beforeExpr:!0,prefix:!0,startsExpr:!0})},lineBreak=/\r\n?|\n|\u2028|\u2029/,lineBreakG=new RegExp(lineBreak.source,"g");function isNewLine(code){return code===10||code===13||code===8232||code===8233}function nextLineBreak(code,from,end){if(end===void 0)end=code.length;for(var i=from;i<end;i++){var next=code.charCodeAt(i);if(isNewLine(next))return i<end-1&&next===13&&code.charCodeAt(i+1)===10?i+2:i+1}return-1}var nonASCIIwhitespace=/[\u1680\u2000-\u200a\u202f\u205f\u3000\ufeff]/,skipWhiteSpace=/(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g,ref=Object.prototype,{hasOwnProperty,toString}=ref,hasOwn=Object.hasOwn||function(obj,propName){return hasOwnProperty.call(obj,propName)},isArray=Array.isArray||function(obj){return toString.call(obj)==="[object Array]"},regexpCache=Object.create(null);function wordsRegexp(words){return regexpCache[words]||(regexpCache[words]=new RegExp("^(?:"+words.replace(/ /g,"|")+")$"))}function codePointToString(code){if(code<=65535)return String.fromCharCode(code);return code-=65536,String.fromCharCode((code>>10)+55296,(code&1023)+56320)}var loneSurrogate=/(?:[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/,Position=function(line,col){this.line=line,this.column=col};Position.prototype.offset=function(n){return new Position(this.line,this.column+n)};var SourceLocation=function(p,start,end){if(this.start=start,this.end=end,p.sourceFile!==null)this.source=p.sourceFile};function getLineInfo(input,offset){for(var line=1,cur=0;;){var nextBreak=nextLineBreak(input,cur,offset);if(nextBreak<0)return new Position(line,offset-cur);++line,cur=nextBreak}}var defaultOptions={ecmaVersion:null,sourceType:"script",strict:!1,onInsertedSemicolon:null,onTrailingComma:null,allowReserved:null,allowReturnOutsideFunction:!1,allowImportExportEverywhere:!1,allowAwaitOutsideFunction:null,allowSuperOutsideMethod:null,allowHashBang:!1,checkPrivateFields:!0,locations:!1,startLocation:null,onToken:null,onComment:null,ranges:!1,program:null,sourceFile:null,directSourceFile:null,preserveParens:!1},warnedAboutEcmaVersion=!1;function getOptions(opts){var options={};for(var opt in defaultOptions)options[opt]=opts&&hasOwn(opts,opt)?opts[opt]:defaultOptions[opt];if(options.ecmaVersion==="latest")options.ecmaVersion=1e8;else if(options.ecmaVersion==null){if(!warnedAboutEcmaVersion&&typeof console==="object"&&console.warn)warnedAboutEcmaVersion=!0,console.warn(`Since Acorn 8.0.0, options.ecmaVersion is required.
|
|
3
|
+
Defaulting to 2020, but this will stop working in the future.`);options.ecmaVersion=11}else if(options.ecmaVersion>=2015)options.ecmaVersion-=2009;if(options.allowReserved==null)options.allowReserved=options.ecmaVersion<5;if(!opts||opts.allowHashBang==null)options.allowHashBang=options.ecmaVersion>=14;if(isArray(options.onToken)){var tokens=options.onToken;options.onToken=function(token){return tokens.push(token)}}if(isArray(options.onComment))options.onComment=pushComment(options,options.onComment);if(options.sourceType==="commonjs"&&options.allowAwaitOutsideFunction)throw Error("Cannot use allowAwaitOutsideFunction with sourceType: commonjs");return options}function pushComment(options,array){return function(block,text,start,end,startLoc,endLoc){var comment={type:block?"Block":"Line",value:text,start,end};if(options.locations)comment.loc=new SourceLocation(this,startLoc,endLoc);if(options.ranges)comment.range=[start,end];array.push(comment)}}var SCOPE_TOP=1,SCOPE_FUNCTION=2,SCOPE_ASYNC=4,SCOPE_GENERATOR=8,SCOPE_ARROW=16,SCOPE_SIMPLE_CATCH=32,SCOPE_SUPER=64,SCOPE_DIRECT_SUPER=128,SCOPE_CLASS_STATIC_BLOCK=256,SCOPE_CLASS_FIELD_INIT=512,SCOPE_SWITCH=1024,SCOPE_VAR=SCOPE_TOP|SCOPE_FUNCTION|SCOPE_CLASS_STATIC_BLOCK;function functionFlags(async,generator){return SCOPE_FUNCTION|(async?SCOPE_ASYNC:0)|(generator?SCOPE_GENERATOR:0)}var BIND_NONE=0,BIND_VAR=1,BIND_LEXICAL=2,BIND_FUNCTION=3,BIND_SIMPLE_CATCH=4,BIND_OUTSIDE=5,Parser=function(options,input,startPos){this.options=options=getOptions(options),this.sourceFile=options.sourceFile,this.keywords=wordsRegexp(keywords$1[options.ecmaVersion>=6?6:options.sourceType==="module"?"5module":5]);var reserved="";if(options.allowReserved!==!0){if(reserved=reservedWords[options.ecmaVersion>=6?6:options.ecmaVersion===5?5:3],options.sourceType==="module")reserved+=" await"}this.reservedWords=wordsRegexp(reserved);var reservedStrict=(reserved?reserved+" ":"")+reservedWords.strict;if(this.reservedWordsStrict=wordsRegexp(reservedStrict),this.reservedWordsStrictBind=wordsRegexp(reservedStrict+" "+reservedWords.strictBind),this.input=String(input),this.containsEsc=!1,this.pos=startPos||0,this.curLine=1,options.startLocation)this.lineStart=this.pos-options.startLocation.column,this.curLine=options.startLocation.line;else if(startPos){if(this.lineStart=this.input.lastIndexOf(`
|
|
4
|
+
`,startPos-1)+1,this.options.locations)this.curLine=this.input.slice(0,this.lineStart).split(lineBreak).length}else this.lineStart=0;if(this.type=types$1.eof,this.value=null,this.start=this.end=this.pos,this.startLoc=this.endLoc=this.curPosition(),this.lastTokEndLoc=this.lastTokStartLoc=null,this.lastTokStart=this.lastTokEnd=this.pos,this.context=this.initialContext(),this.exprAllowed=!0,this.inModule=options.sourceType==="module",this.strict=this.inModule||options.strict===!0||this.strictDirective(this.pos),this.potentialArrowAt=-1,this.potentialArrowInForAwait=!1,this.yieldPos=this.awaitPos=this.awaitIdentPos=0,this.labels=[],this.undefinedExports=Object.create(null),this.pos===0&&options.allowHashBang&&this.input.slice(0,2)==="#!")this.skipLineComment(2);this.scopeStack=[],this.enterScope(this.options.sourceType==="commonjs"?SCOPE_FUNCTION:SCOPE_TOP),this.regexpState=null,this.privateNameStack=[]},prototypeAccessors={inFunction:{configurable:!0},inGenerator:{configurable:!0},inAsync:{configurable:!0},canAwait:{configurable:!0},allowReturn:{configurable:!0},allowSuper:{configurable:!0},allowDirectSuper:{configurable:!0},treatFunctionsAsVar:{configurable:!0},allowNewDotTarget:{configurable:!0},allowUsing:{configurable:!0},inClassStaticBlock:{configurable:!0}};Parser.prototype.parse=function(){var this$1$1=this,node=this.options.program||this.startNode();return this.nextToken(),this.catchStackOverflow(function(){return this$1$1.parseTopLevel(node)})};prototypeAccessors.inFunction.get=function(){return(this.currentVarScope().flags&SCOPE_FUNCTION)>0};prototypeAccessors.inGenerator.get=function(){return(this.currentVarScope().flags&SCOPE_GENERATOR)>0};prototypeAccessors.inAsync.get=function(){return(this.currentVarScope().flags&SCOPE_ASYNC)>0};prototypeAccessors.canAwait.get=function(){for(var i=this.scopeStack.length-1;i>=0;i--){var ref=this.scopeStack[i],flags=ref.flags;if(flags&(SCOPE_CLASS_STATIC_BLOCK|SCOPE_CLASS_FIELD_INIT))return!1;if(flags&SCOPE_FUNCTION)return(flags&SCOPE_ASYNC)>0}return this.inModule&&this.options.ecmaVersion>=13||this.options.allowAwaitOutsideFunction};prototypeAccessors.allowReturn.get=function(){if(this.inFunction)return!0;if(this.options.allowReturnOutsideFunction&&this.currentVarScope().flags&SCOPE_TOP)return!0;return!1};prototypeAccessors.allowSuper.get=function(){var ref=this.currentThisScope(),flags=ref.flags;return(flags&SCOPE_SUPER)>0||this.options.allowSuperOutsideMethod};prototypeAccessors.allowDirectSuper.get=function(){return(this.currentThisScope().flags&SCOPE_DIRECT_SUPER)>0};prototypeAccessors.treatFunctionsAsVar.get=function(){return this.treatFunctionsAsVarInScope(this.currentScope())};prototypeAccessors.allowNewDotTarget.get=function(){for(var i=this.scopeStack.length-1;i>=0;i--){var ref=this.scopeStack[i],flags=ref.flags;if(flags&(SCOPE_CLASS_STATIC_BLOCK|SCOPE_CLASS_FIELD_INIT)||flags&SCOPE_FUNCTION&&!(flags&SCOPE_ARROW))return!0}return!1};prototypeAccessors.allowUsing.get=function(){var ref=this.currentScope(),flags=ref.flags;if(flags&SCOPE_SWITCH)return!1;if(!this.inModule&&flags&SCOPE_TOP)return!1;return!0};prototypeAccessors.inClassStaticBlock.get=function(){return(this.currentVarScope().flags&SCOPE_CLASS_STATIC_BLOCK)>0};Parser.extend=function(){var plugins=[],len=arguments.length;while(len--)plugins[len]=arguments[len];var cls=this;for(var i=0;i<plugins.length;i++)cls=plugins[i](cls);return cls};Parser.parse=function(input,options){return new this(options,input).parse()};Parser.parseExpressionAt=function(input,pos,options){var parser=new this(options,input,pos);return parser.nextToken(),parser.parseExpression()};Parser.tokenizer=function(input,options){return new this(options,input)};Object.defineProperties(Parser.prototype,prototypeAccessors);var pp$9=Parser.prototype,literal=/^(?:'((?:\\[^]|[^'\\])*?)'|"((?:\\[^]|[^"\\])*?)")/;pp$9.strictDirective=function(start){if(this.options.ecmaVersion<5)return!1;for(;;){skipWhiteSpace.lastIndex=start,start+=skipWhiteSpace.exec(this.input)[0].length;var match=literal.exec(this.input.slice(start));if(!match)return!1;if((match[1]||match[2])==="use strict"){skipWhiteSpace.lastIndex=start+match[0].length;var spaceAfter=skipWhiteSpace.exec(this.input),end=spaceAfter.index+spaceAfter[0].length,next=this.input.charAt(end);return next===";"||next==="}"||lineBreak.test(spaceAfter[0])&&!(/[(`.[+\-/*%<>=,?^&]/.test(next)||next==="!"&&this.input.charAt(end+1)==="=")}if(start+=match[0].length,skipWhiteSpace.lastIndex=start,start+=skipWhiteSpace.exec(this.input)[0].length,this.input[start]===";")start++}};pp$9.eat=function(type){if(this.type===type)return this.next(),!0;else return!1};pp$9.isContextual=function(name){return this.type===types$1.name&&this.value===name&&!this.containsEsc};pp$9.eatContextual=function(name){if(!this.isContextual(name))return!1;return this.next(),!0};pp$9.catchStackOverflow=function(f){try{return f()}catch(e){if(e instanceof Error&&(/\bstack\b.*\b(exceeded|overflow)\b/i.test(e.message)||/\btoo much recursion\b/i.test(e.message)))this.raise(this.start,"Not enough stack space to parse input");else throw e}};pp$9.expectContextual=function(name){if(!this.eatContextual(name))this.unexpected()};pp$9.canInsertSemicolon=function(){return this.type===types$1.eof||this.type===types$1.braceR||lineBreak.test(this.input.slice(this.lastTokEnd,this.start))};pp$9.insertSemicolon=function(){if(this.canInsertSemicolon()){if(this.options.onInsertedSemicolon)this.options.onInsertedSemicolon(this.lastTokEnd,this.lastTokEndLoc);return!0}};pp$9.semicolon=function(){if(!this.eat(types$1.semi)&&!this.insertSemicolon())this.unexpected()};pp$9.afterTrailingComma=function(tokType,notNext){if(this.type===tokType){if(this.options.onTrailingComma)this.options.onTrailingComma(this.lastTokStart,this.lastTokStartLoc);if(!notNext)this.next();return!0}};pp$9.expect=function(type){this.eat(type)||this.unexpected()};pp$9.unexpected=function(pos){this.raise(pos!=null?pos:this.start,"Unexpected token")};var DestructuringErrors=function(){this.shorthandAssign=this.trailingComma=this.parenthesizedAssign=this.parenthesizedBind=this.doubleProto=-1};pp$9.checkPatternErrors=function(refDestructuringErrors,isAssign){if(!refDestructuringErrors)return;if(refDestructuringErrors.trailingComma>-1)this.raiseRecoverable(refDestructuringErrors.trailingComma,"Comma is not permitted after the rest element");var parens=isAssign?refDestructuringErrors.parenthesizedAssign:refDestructuringErrors.parenthesizedBind;if(parens>-1)this.raiseRecoverable(parens,isAssign?"Assigning to rvalue":"Parenthesized pattern")};pp$9.checkExpressionErrors=function(refDestructuringErrors,andThrow){if(!refDestructuringErrors)return!1;var{shorthandAssign,doubleProto}=refDestructuringErrors;if(!andThrow)return shorthandAssign>=0||doubleProto>=0;if(shorthandAssign>=0)this.raise(shorthandAssign,"Shorthand property assignments are valid only in destructuring patterns");if(doubleProto>=0)this.raiseRecoverable(doubleProto,"Redefinition of __proto__ property")};pp$9.checkYieldAwaitInDefaultParams=function(){if(this.yieldPos&&(!this.awaitPos||this.yieldPos<this.awaitPos))this.raise(this.yieldPos,"Yield expression cannot be a default value");if(this.awaitPos)this.raise(this.awaitPos,"Await expression cannot be a default value")};pp$9.isSimpleAssignTarget=function(expr){if(expr.type==="ParenthesizedExpression")return this.isSimpleAssignTarget(expr.expression);return expr.type==="Identifier"||expr.type==="MemberExpression"};var pp$8=Parser.prototype;pp$8.parseTopLevel=function(node){var exports$1=Object.create(null);if(!node.body)node.body=[];while(this.type!==types$1.eof){var stmt=this.parseStatement(null,!0,exports$1);node.body.push(stmt)}if(this.inModule)for(var i=0,list=Object.keys(this.undefinedExports);i<list.length;i+=1){var name=list[i];this.raiseRecoverable(this.undefinedExports[name].start,"Export '"+name+"' is not defined")}return this.adaptDirectivePrologue(node.body),this.next(),node.sourceType=this.options.sourceType==="commonjs"?"script":this.options.sourceType,this.finishNode(node,"Program")};var loopLabel={kind:"loop"},switchLabel={kind:"switch"};pp$8.isLet=function(context){if(this.options.ecmaVersion<6||!this.isContextual("let"))return!1;skipWhiteSpace.lastIndex=this.pos;var skip=skipWhiteSpace.exec(this.input),next=this.pos+skip[0].length,nextCh=this.fullCharCodeAt(next);if(nextCh===91||nextCh===92)return!0;if(context)return!1;if(nextCh===123)return!0;if(isIdentifierStart(nextCh)){var start=next;do next+=nextCh<=65535?1:2;while(isIdentifierChar(nextCh=this.fullCharCodeAt(next)));if(nextCh===92)return!0;var ident=this.input.slice(start,next);if(!keywordRelationalOperator.test(ident))return!0}return!1};pp$8.isAsyncFunction=function(){if(this.options.ecmaVersion<8||!this.isContextual("async"))return!1;skipWhiteSpace.lastIndex=this.pos;var skip=skipWhiteSpace.exec(this.input),next=this.pos+skip[0].length,after;return!lineBreak.test(this.input.slice(this.pos,next))&&this.input.slice(next,next+8)==="function"&&(next+8===this.input.length||!(isIdentifierChar(after=this.fullCharCodeAt(next+8))||after===92))};pp$8.isUsingKeyword=function(isAwaitUsing,isFor){if(this.options.ecmaVersion<17||!this.isContextual(isAwaitUsing?"await":"using"))return!1;skipWhiteSpace.lastIndex=this.pos;var skip=skipWhiteSpace.exec(this.input),next=this.pos+skip[0].length;if(lineBreak.test(this.input.slice(this.pos,next)))return!1;if(isAwaitUsing){var usingEndPos=next+5,after;if(this.input.slice(next,usingEndPos)!=="using"||usingEndPos===this.input.length||isIdentifierChar(after=this.fullCharCodeAt(usingEndPos))||after===92)return!1;skipWhiteSpace.lastIndex=usingEndPos;var skipAfterUsing=skipWhiteSpace.exec(this.input);if(next=usingEndPos+skipAfterUsing[0].length,skipAfterUsing&&lineBreak.test(this.input.slice(usingEndPos,next)))return!1}var ch=this.fullCharCodeAt(next);if(!isIdentifierStart(ch)&&ch!==92)return!1;var idStart=next;do next+=ch<=65535?1:2;while(isIdentifierChar(ch=this.fullCharCodeAt(next)));if(ch===92)return!0;var id=this.input.slice(idStart,next);if(keywordRelationalOperator.test(id))return!1;if(isFor&&!isAwaitUsing&&id==="of"){skipWhiteSpace.lastIndex=next;var skipAfterOf=skipWhiteSpace.exec(this.input);if(next=next+skipAfterOf[0].length,this.input.charCodeAt(next)!==61||(ch=this.input.charCodeAt(next+1))===61||ch===62)return!1}return!0};pp$8.isAwaitUsing=function(isFor){return this.isUsingKeyword(!0,isFor)};pp$8.isUsing=function(isFor){return this.isUsingKeyword(!1,isFor)};pp$8.parseStatement=function(context,topLevel,exports$1){var starttype=this.type,node=this.startNode(),kind;if(this.isLet(context))starttype=types$1._var,kind="let";switch(starttype){case types$1._break:case types$1._continue:return this.parseBreakContinueStatement(node,starttype.keyword);case types$1._debugger:return this.parseDebuggerStatement(node);case types$1._do:return this.parseDoStatement(node);case types$1._for:return this.parseForStatement(node);case types$1._function:if(context&&(this.strict||context!=="if"&&context!=="label")&&this.options.ecmaVersion>=6)this.unexpected();return this.parseFunctionStatement(node,!1,!context);case types$1._class:if(context)this.unexpected();return this.parseClass(node,!0);case types$1._if:return this.parseIfStatement(node);case types$1._return:return this.parseReturnStatement(node);case types$1._switch:return this.parseSwitchStatement(node);case types$1._throw:return this.parseThrowStatement(node);case types$1._try:return this.parseTryStatement(node);case types$1._const:case types$1._var:if(kind=kind||this.value,context&&kind!=="var")this.unexpected();return this.parseVarStatement(node,kind);case types$1._while:return this.parseWhileStatement(node);case types$1._with:return this.parseWithStatement(node);case types$1.braceL:return this.parseBlock(!0,node);case types$1.semi:return this.parseEmptyStatement(node);case types$1._export:case types$1._import:if(this.options.ecmaVersion>10&&starttype===types$1._import){skipWhiteSpace.lastIndex=this.pos;var skip=skipWhiteSpace.exec(this.input),next=this.pos+skip[0].length,nextCh=this.input.charCodeAt(next);if(nextCh===40||nextCh===46)return this.parseExpressionStatement(node,this.parseExpression())}if(!this.options.allowImportExportEverywhere){if(!topLevel)this.raise(this.start,"'import' and 'export' may only appear at the top level");if(!this.inModule)this.raise(this.start,"'import' and 'export' may appear only with 'sourceType: module'")}return starttype===types$1._import?this.parseImport(node):this.parseExport(node,exports$1);default:if(this.isAsyncFunction()){if(context)this.unexpected();return this.next(),this.parseFunctionStatement(node,!0,!context)}var usingKind=this.isAwaitUsing(!1)?"await using":this.isUsing(!1)?"using":null;if(usingKind){if(!this.allowUsing)this.raise(this.start,"Using declaration cannot appear in the top level when source type is `script` or in the bare case statement");if(context)this.raise(this.start,"Using declaration is not allowed in single-statement positions");if(usingKind==="await using"){if(!this.canAwait)this.raise(this.start,"Await using cannot appear outside of async function");this.next()}return this.next(),this.parseVar(node,!1,usingKind),this.semicolon(),this.finishNode(node,"VariableDeclaration")}var maybeName=this.value,expr=this.parseExpression();if(starttype===types$1.name&&expr.type==="Identifier"&&this.eat(types$1.colon))return this.parseLabeledStatement(node,maybeName,expr,context);else return this.parseExpressionStatement(node,expr)}};pp$8.parseBreakContinueStatement=function(node,keyword){var isBreak=keyword==="break";if(this.next(),this.eat(types$1.semi)||this.insertSemicolon())node.label=null;else if(this.type!==types$1.name)this.unexpected();else node.label=this.parseIdent(),this.semicolon();var i=0;for(;i<this.labels.length;++i){var lab=this.labels[i];if(node.label==null||lab.name===node.label.name){if(lab.kind!=null&&(isBreak||lab.kind==="loop"))break;if(node.label&&isBreak)break}}if(i===this.labels.length)this.raise(node.start,"Unsyntactic "+keyword);return this.finishNode(node,isBreak?"BreakStatement":"ContinueStatement")};pp$8.parseDebuggerStatement=function(node){return this.next(),this.semicolon(),this.finishNode(node,"DebuggerStatement")};pp$8.parseDoStatement=function(node){if(this.next(),this.labels.push(loopLabel),node.body=this.parseStatement("do"),this.labels.pop(),this.expect(types$1._while),node.test=this.parseParenExpression(),this.options.ecmaVersion>=6)this.eat(types$1.semi);else this.semicolon();return this.finishNode(node,"DoWhileStatement")};pp$8.parseForStatement=function(node){this.next();var awaitAt=this.options.ecmaVersion>=9&&this.canAwait&&this.eatContextual("await")?this.lastTokStart:-1;if(this.labels.push(loopLabel),this.enterScope(0),this.expect(types$1.parenL),this.type===types$1.semi){if(awaitAt>-1)this.unexpected(awaitAt);return this.parseFor(node,null)}var isLet=this.isLet();if(this.type===types$1._var||this.type===types$1._const||isLet){var init$1=this.startNode(),kind=isLet?"let":this.value;return this.next(),this.parseVar(init$1,!0,kind),this.finishNode(init$1,"VariableDeclaration"),this.parseForAfterInit(node,init$1,awaitAt)}var startsWithLet=this.isContextual("let"),isForOf=!1,usingKind=this.isUsing(!0)?"using":this.isAwaitUsing(!0)?"await using":null;if(usingKind){var init$2=this.startNode();if(this.next(),usingKind==="await using"){if(!this.canAwait)this.raise(this.start,"Await using cannot appear outside of async function");this.next()}return this.parseVar(init$2,!0,usingKind),this.finishNode(init$2,"VariableDeclaration"),this.parseForAfterInit(node,init$2,awaitAt)}var containsEsc=this.containsEsc,refDestructuringErrors=new DestructuringErrors,initPos=this.start,init=awaitAt>-1?this.parseExprSubscripts(refDestructuringErrors,"await"):this.parseExpression(!0,refDestructuringErrors);if(this.type===types$1._in||(isForOf=this.options.ecmaVersion>=6&&this.isContextual("of"))){if(awaitAt>-1){if(this.type===types$1._in)this.unexpected(awaitAt);node.await=!0}else if(isForOf&&this.options.ecmaVersion>=8){if(init.start===initPos&&!containsEsc&&init.type==="Identifier"&&init.name==="async")this.unexpected();else if(this.options.ecmaVersion>=9)node.await=!1}if(startsWithLet&&isForOf)this.raise(init.start,"The left-hand side of a for-of loop may not start with 'let'.");return this.toAssignable(init,!1,refDestructuringErrors),this.checkLValPattern(init),this.parseForIn(node,init)}else this.checkExpressionErrors(refDestructuringErrors,!0);if(awaitAt>-1)this.unexpected(awaitAt);return this.parseFor(node,init)};pp$8.parseForAfterInit=function(node,init,awaitAt){if((this.type===types$1._in||this.options.ecmaVersion>=6&&this.isContextual("of"))&&init.declarations.length===1){if(this.type===types$1._in){if((init.kind==="using"||init.kind==="await using")&&!init.declarations[0].init)this.raise(this.start,"Using declaration is not allowed in for-in loops");if(this.options.ecmaVersion>=9&&awaitAt>-1)this.unexpected(awaitAt)}else if(this.options.ecmaVersion>=9)node.await=awaitAt>-1;return this.parseForIn(node,init)}if(awaitAt>-1)this.unexpected(awaitAt);return this.parseFor(node,init)};pp$8.parseFunctionStatement=function(node,isAsync,declarationPosition){return this.next(),this.parseFunction(node,FUNC_STATEMENT|(declarationPosition?0:FUNC_HANGING_STATEMENT),!1,isAsync)};pp$8.parseIfStatement=function(node){return this.next(),node.test=this.parseParenExpression(),node.consequent=this.parseStatement("if"),node.alternate=this.eat(types$1._else)?this.parseStatement("if"):null,this.finishNode(node,"IfStatement")};pp$8.parseReturnStatement=function(node){if(!this.allowReturn)this.raise(this.start,"'return' outside of function");if(this.next(),this.eat(types$1.semi)||this.insertSemicolon())node.argument=null;else node.argument=this.parseExpression(),this.semicolon();return this.finishNode(node,"ReturnStatement")};pp$8.parseSwitchStatement=function(node){this.next(),node.discriminant=this.parseParenExpression(),node.cases=[],this.expect(types$1.braceL),this.labels.push(switchLabel),this.enterScope(SCOPE_SWITCH);var cur;for(var sawDefault=!1;this.type!==types$1.braceR;)if(this.type===types$1._case||this.type===types$1._default){var isCase=this.type===types$1._case;if(cur)this.finishNode(cur,"SwitchCase");if(node.cases.push(cur=this.startNode()),cur.consequent=[],this.next(),isCase)cur.test=this.parseExpression();else{if(sawDefault)this.raiseRecoverable(this.lastTokStart,"Multiple default clauses");sawDefault=!0,cur.test=null}this.expect(types$1.colon)}else{if(!cur)this.unexpected();cur.consequent.push(this.parseStatement(null))}if(this.exitScope(),cur)this.finishNode(cur,"SwitchCase");return this.next(),this.labels.pop(),this.finishNode(node,"SwitchStatement")};pp$8.parseThrowStatement=function(node){if(this.next(),lineBreak.test(this.input.slice(this.lastTokEnd,this.start)))this.raise(this.lastTokEnd,"Illegal newline after throw");return node.argument=this.parseExpression(),this.semicolon(),this.finishNode(node,"ThrowStatement")};var empty$1=[];pp$8.parseCatchClauseParam=function(){var param=this.parseBindingAtom(),simple=param.type==="Identifier";return this.enterScope(simple?SCOPE_SIMPLE_CATCH:0),this.checkLValPattern(param,simple?BIND_SIMPLE_CATCH:BIND_LEXICAL),this.expect(types$1.parenR),param};pp$8.parseTryStatement=function(node){if(this.next(),node.block=this.parseBlock(),node.handler=null,this.type===types$1._catch){var clause=this.startNode();if(this.next(),this.eat(types$1.parenL))clause.param=this.parseCatchClauseParam();else{if(this.options.ecmaVersion<10)this.unexpected();clause.param=null,this.enterScope(0)}clause.body=this.parseBlock(!1),this.exitScope(),node.handler=this.finishNode(clause,"CatchClause")}if(node.finalizer=this.eat(types$1._finally)?this.parseBlock():null,!node.handler&&!node.finalizer)this.raise(node.start,"Missing catch or finally clause");return this.finishNode(node,"TryStatement")};pp$8.parseVarStatement=function(node,kind,allowMissingInitializer){return this.next(),this.parseVar(node,!1,kind,allowMissingInitializer),this.semicolon(),this.finishNode(node,"VariableDeclaration")};pp$8.parseWhileStatement=function(node){return this.next(),node.test=this.parseParenExpression(),this.labels.push(loopLabel),node.body=this.parseStatement("while"),this.labels.pop(),this.finishNode(node,"WhileStatement")};pp$8.parseWithStatement=function(node){if(this.strict)this.raise(this.start,"'with' in strict mode");return this.next(),node.object=this.parseParenExpression(),node.body=this.parseStatement("with"),this.finishNode(node,"WithStatement")};pp$8.parseEmptyStatement=function(node){return this.next(),this.finishNode(node,"EmptyStatement")};pp$8.parseLabeledStatement=function(node,maybeName,expr,context){for(var i$1=0,list=this.labels;i$1<list.length;i$1+=1){var label=list[i$1];if(label.name===maybeName)this.raise(expr.start,"Label '"+maybeName+"' is already declared")}var kind=this.type.isLoop?"loop":this.type===types$1._switch?"switch":null;for(var i=this.labels.length-1;i>=0;i--){var label$1=this.labels[i];if(label$1.statementStart===node.start)label$1.statementStart=this.start,label$1.kind=kind;else break}return this.labels.push({name:maybeName,kind,statementStart:this.start}),node.body=this.parseStatement(context?context.indexOf("label")===-1?context+"label":context:"label"),this.labels.pop(),node.label=expr,this.finishNode(node,"LabeledStatement")};pp$8.parseExpressionStatement=function(node,expr){return node.expression=expr,this.semicolon(),this.finishNode(node,"ExpressionStatement")};pp$8.parseBlock=function(createNewLexicalScope,node,exitStrict){if(createNewLexicalScope===void 0)createNewLexicalScope=!0;if(node===void 0)node=this.startNode();if(node.body=[],this.expect(types$1.braceL),createNewLexicalScope)this.enterScope(0);while(this.type!==types$1.braceR){var stmt=this.parseStatement(null);node.body.push(stmt)}if(exitStrict)this.strict=!1;if(this.next(),createNewLexicalScope)this.exitScope();return this.finishNode(node,"BlockStatement")};pp$8.parseFor=function(node,init){return node.init=init,this.expect(types$1.semi),node.test=this.type===types$1.semi?null:this.parseExpression(),this.expect(types$1.semi),node.update=this.type===types$1.parenR?null:this.parseExpression(),this.expect(types$1.parenR),node.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(node,"ForStatement")};pp$8.parseForIn=function(node,init){var isForIn=this.type===types$1._in;if(this.next(),init.type==="VariableDeclaration"&&init.declarations[0].init!=null&&(!isForIn||this.options.ecmaVersion<8||this.strict||init.kind!=="var"||init.declarations[0].id.type!=="Identifier"))this.raise(init.start,(isForIn?"for-in":"for-of")+" loop variable declaration may not have an initializer");return node.left=init,node.right=isForIn?this.parseExpression():this.parseMaybeAssign(),this.expect(types$1.parenR),node.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(node,isForIn?"ForInStatement":"ForOfStatement")};pp$8.parseVar=function(node,isFor,kind,allowMissingInitializer){node.declarations=[],node.kind=kind;for(;;){var decl=this.startNode();if(this.parseVarId(decl,kind),this.eat(types$1.eq))decl.init=this.parseMaybeAssign(isFor);else if(!allowMissingInitializer&&kind==="const"&&!(this.type===types$1._in||this.options.ecmaVersion>=6&&this.isContextual("of")))this.unexpected();else if(!allowMissingInitializer&&(kind==="using"||kind==="await using")&&this.options.ecmaVersion>=17&&this.type!==types$1._in&&!this.isContextual("of"))this.raise(this.lastTokEnd,"Missing initializer in "+kind+" declaration");else if(!allowMissingInitializer&&decl.id.type!=="Identifier"&&!(isFor&&(this.type===types$1._in||this.isContextual("of"))))this.raise(this.lastTokEnd,"Complex binding patterns require an initialization value");else decl.init=null;if(node.declarations.push(this.finishNode(decl,"VariableDeclarator")),!this.eat(types$1.comma))break}return node};pp$8.parseVarId=function(decl,kind){decl.id=kind==="using"||kind==="await using"?this.parseIdent():this.parseBindingAtom(),this.checkLValPattern(decl.id,kind==="var"?BIND_VAR:BIND_LEXICAL,!1)};var FUNC_STATEMENT=1,FUNC_HANGING_STATEMENT=2,FUNC_NULLABLE_ID=4;pp$8.parseFunction=function(node,statement,allowExpressionBody,isAsync,forInit){if(this.initFunction(node),this.options.ecmaVersion>=9||this.options.ecmaVersion>=6&&!isAsync){if(this.type===types$1.star&&statement&FUNC_HANGING_STATEMENT)this.unexpected();node.generator=this.eat(types$1.star)}if(this.options.ecmaVersion>=8)node.async=!!isAsync;if(statement&FUNC_STATEMENT){if(node.id=statement&FUNC_NULLABLE_ID&&this.type!==types$1.name?null:this.parseIdent(),node.id&&!(statement&FUNC_HANGING_STATEMENT))this.checkLValSimple(node.id,this.strict||node.generator||node.async?this.treatFunctionsAsVar?BIND_VAR:BIND_LEXICAL:BIND_FUNCTION)}var oldYieldPos=this.yieldPos,oldAwaitPos=this.awaitPos,oldAwaitIdentPos=this.awaitIdentPos;if(this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(functionFlags(node.async,node.generator)),!(statement&FUNC_STATEMENT))node.id=this.type===types$1.name?this.parseIdent():null;return this.parseFunctionParams(node),this.parseFunctionBody(node,allowExpressionBody,!1,forInit),this.yieldPos=oldYieldPos,this.awaitPos=oldAwaitPos,this.awaitIdentPos=oldAwaitIdentPos,this.finishNode(node,statement&FUNC_STATEMENT?"FunctionDeclaration":"FunctionExpression")};pp$8.parseFunctionParams=function(node){this.expect(types$1.parenL),node.params=this.parseBindingList(types$1.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams()};pp$8.parseClass=function(node,isStatement){this.next();var oldStrict=this.strict;this.strict=!0,this.parseClassId(node,isStatement),this.parseClassSuper(node);var privateNameMap=this.enterClassBody(),classBody=this.startNode(),hadConstructor=!1;classBody.body=[],this.expect(types$1.braceL);while(this.type!==types$1.braceR){var element=this.parseClassElement(node.superClass!==null);if(element){if(classBody.body.push(element),element.type==="MethodDefinition"&&element.kind==="constructor"){if(hadConstructor)this.raiseRecoverable(element.start,"Duplicate constructor in the same class");hadConstructor=!0}else if(element.key&&element.key.type==="PrivateIdentifier"&&isPrivateNameConflicted(privateNameMap,element))this.raiseRecoverable(element.key.start,"Identifier '#"+element.key.name+"' has already been declared")}}return this.strict=oldStrict,this.next(),node.body=this.finishNode(classBody,"ClassBody"),this.exitClassBody(),this.finishNode(node,isStatement?"ClassDeclaration":"ClassExpression")};pp$8.parseClassElement=function(constructorAllowsSuper){if(this.eat(types$1.semi))return null;var ecmaVersion=this.options.ecmaVersion,node=this.startNode(),keyName="",isGenerator=!1,isAsync=!1,kind="method",isStatic=!1;if(this.eatContextual("static")){if(ecmaVersion>=13&&this.eat(types$1.braceL))return this.parseClassStaticBlock(node),node;if(this.isClassElementNameStart()||this.type===types$1.star)isStatic=!0;else keyName="static"}if(node.static=isStatic,!keyName&&ecmaVersion>=8&&this.eatContextual("async"))if((this.isClassElementNameStart()||this.type===types$1.star)&&!this.canInsertSemicolon())isAsync=!0;else keyName="async";if(!keyName&&(ecmaVersion>=9||!isAsync)&&this.eat(types$1.star))isGenerator=!0;if(!keyName&&!isAsync&&!isGenerator){var lastValue=this.value;if(this.eatContextual("get")||this.eatContextual("set"))if(this.isClassElementNameStart())kind=lastValue;else keyName=lastValue}if(keyName)node.computed=!1,node.key=this.startNodeAt(this.lastTokStart,this.lastTokStartLoc),node.key.name=keyName,this.finishNode(node.key,"Identifier");else this.parseClassElementName(node);if(ecmaVersion<13||this.type===types$1.parenL||kind!=="method"||isGenerator||isAsync){var isConstructor=!node.static&&checkKeyName(node,"constructor"),allowsDirectSuper=isConstructor&&constructorAllowsSuper;if(isConstructor&&kind!=="method")this.raise(node.key.start,"Constructor can't have get/set modifier");node.kind=isConstructor?"constructor":kind,this.parseClassMethod(node,isGenerator,isAsync,allowsDirectSuper)}else this.parseClassField(node);return node};pp$8.isClassElementNameStart=function(){return this.type===types$1.name||this.type===types$1.privateId||this.type===types$1.num||this.type===types$1.string||this.type===types$1.bracketL||this.type.keyword};pp$8.parseClassElementName=function(element){if(this.type===types$1.privateId){if(this.value==="constructor")this.raise(this.start,"Classes can't have an element named '#constructor'");element.computed=!1,element.key=this.parsePrivateIdent()}else this.parsePropertyName(element)};pp$8.parseClassMethod=function(method,isGenerator,isAsync,allowsDirectSuper){var key=method.key;if(method.kind==="constructor"){if(isGenerator)this.raise(key.start,"Constructor can't be a generator");if(isAsync)this.raise(key.start,"Constructor can't be an async method")}else if(method.static&&checkKeyName(method,"prototype"))this.raise(key.start,"Classes may not have a static property named prototype");var value=method.value=this.parseMethod(isGenerator,isAsync,allowsDirectSuper);if(method.kind==="get"&&value.params.length!==0)this.raiseRecoverable(value.start,"getter should have no params");if(method.kind==="set"&&value.params.length!==1)this.raiseRecoverable(value.start,"setter should have exactly one param");if(method.kind==="set"&&value.params[0].type==="RestElement")this.raiseRecoverable(value.params[0].start,"Setter cannot use rest params");return this.finishNode(method,"MethodDefinition")};pp$8.parseClassField=function(field){if(checkKeyName(field,"constructor"))this.raise(field.key.start,"Classes can't have a field named 'constructor'");else if(field.static&&checkKeyName(field,"prototype"))this.raise(field.key.start,"Classes can't have a static field named 'prototype'");if(this.eat(types$1.eq))this.enterScope(SCOPE_CLASS_FIELD_INIT|SCOPE_SUPER),field.value=this.parseMaybeAssign(),this.exitScope();else field.value=null;return this.semicolon(),this.finishNode(field,"PropertyDefinition")};pp$8.parseClassStaticBlock=function(node){node.body=[];var oldLabels=this.labels;this.labels=[],this.enterScope(SCOPE_CLASS_STATIC_BLOCK|SCOPE_SUPER);while(this.type!==types$1.braceR){var stmt=this.parseStatement(null);node.body.push(stmt)}return this.next(),this.exitScope(),this.labels=oldLabels,this.finishNode(node,"StaticBlock")};pp$8.parseClassId=function(node,isStatement){if(this.type===types$1.name){if(node.id=this.parseIdent(),isStatement)this.checkLValSimple(node.id,BIND_LEXICAL,!1)}else{if(isStatement===!0)this.unexpected();node.id=null}};pp$8.parseClassSuper=function(node){node.superClass=this.eat(types$1._extends)?this.parseExprSubscripts(null,!1):null};pp$8.enterClassBody=function(){var element={declared:Object.create(null),used:[]};return this.privateNameStack.push(element),element.declared};pp$8.exitClassBody=function(){var ref=this.privateNameStack.pop(),{declared,used}=ref;if(!this.options.checkPrivateFields)return;var len=this.privateNameStack.length,parent=len===0?null:this.privateNameStack[len-1];for(var i=0;i<used.length;++i){var id=used[i];if(!hasOwn(declared,id.name))if(parent)parent.used.push(id);else this.raiseRecoverable(id.start,"Private field '#"+id.name+"' must be declared in an enclosing class")}};function isPrivateNameConflicted(privateNameMap,element){var name=element.key.name,curr=privateNameMap[name],next="true";if(element.type==="MethodDefinition"&&(element.kind==="get"||element.kind==="set"))next=(element.static?"s":"i")+element.kind;if(curr==="iget"&&next==="iset"||curr==="iset"&&next==="iget"||curr==="sget"&&next==="sset"||curr==="sset"&&next==="sget")return privateNameMap[name]="true",!1;else if(!curr)return privateNameMap[name]=next,!1;else return!0}function checkKeyName(node,name){var{computed,key}=node;return!computed&&(key.type==="Identifier"&&key.name===name||key.type==="Literal"&&key.value===name)}pp$8.parseExportAllDeclaration=function(node,exports$1){if(this.options.ecmaVersion>=11)if(this.eatContextual("as"))node.exported=this.parseModuleExportName(),this.checkExport(exports$1,node.exported,this.lastTokStart);else node.exported=null;if(this.expectContextual("from"),this.type!==types$1.string)this.unexpected();if(node.source=this.parseExprAtom(),this.options.ecmaVersion>=16)node.attributes=this.parseWithClause();return this.semicolon(),this.finishNode(node,"ExportAllDeclaration")};pp$8.parseExport=function(node,exports$1){if(this.next(),this.eat(types$1.star))return this.parseExportAllDeclaration(node,exports$1);if(this.eat(types$1._default))return this.checkExport(exports$1,"default",this.lastTokStart),node.declaration=this.parseExportDefaultDeclaration(),this.finishNode(node,"ExportDefaultDeclaration");if(this.shouldParseExportStatement()){if(node.declaration=this.parseExportDeclaration(node),node.declaration.type==="VariableDeclaration")this.checkVariableExport(exports$1,node.declaration.declarations);else this.checkExport(exports$1,node.declaration.id,node.declaration.id.start);if(node.specifiers=[],node.source=null,this.options.ecmaVersion>=16)node.attributes=[]}else{if(node.declaration=null,node.specifiers=this.parseExportSpecifiers(exports$1),this.eatContextual("from")){if(this.type!==types$1.string)this.unexpected();if(node.source=this.parseExprAtom(),this.options.ecmaVersion>=16)node.attributes=this.parseWithClause()}else{for(var i=0,list=node.specifiers;i<list.length;i+=1){var spec=list[i];if(this.checkUnreserved(spec.local),this.checkLocalExport(spec.local),spec.local.type==="Literal")this.raise(spec.local.start,"A string literal cannot be used as an exported binding without `from`.")}if(node.source=null,this.options.ecmaVersion>=16)node.attributes=[]}this.semicolon()}return this.finishNode(node,"ExportNamedDeclaration")};pp$8.parseExportDeclaration=function(node){return this.parseStatement(null)};pp$8.parseExportDefaultDeclaration=function(){var isAsync;if(this.type===types$1._function||(isAsync=this.isAsyncFunction())){var fNode=this.startNode();if(this.next(),isAsync)this.next();return this.parseFunction(fNode,FUNC_STATEMENT|FUNC_NULLABLE_ID,!1,isAsync)}else if(this.type===types$1._class){var cNode=this.startNode();return this.parseClass(cNode,"nullableID")}else{var declaration=this.parseMaybeAssign();return this.semicolon(),declaration}};pp$8.checkExport=function(exports$1,name,pos){if(!exports$1)return;if(typeof name!=="string")name=name.type==="Identifier"?name.name:name.value;if(hasOwn(exports$1,name))this.raiseRecoverable(pos,"Duplicate export '"+name+"'");exports$1[name]=!0};pp$8.checkPatternExport=function(exports$1,pat){var type=pat.type;if(type==="Identifier")this.checkExport(exports$1,pat,pat.start);else if(type==="ObjectPattern")for(var i=0,list=pat.properties;i<list.length;i+=1){var prop=list[i];this.checkPatternExport(exports$1,prop)}else if(type==="ArrayPattern")for(var i$1=0,list$1=pat.elements;i$1<list$1.length;i$1+=1){var elt=list$1[i$1];if(elt)this.checkPatternExport(exports$1,elt)}else if(type==="Property")this.checkPatternExport(exports$1,pat.value);else if(type==="AssignmentPattern")this.checkPatternExport(exports$1,pat.left);else if(type==="RestElement")this.checkPatternExport(exports$1,pat.argument)};pp$8.checkVariableExport=function(exports$1,decls){if(!exports$1)return;for(var i=0,list=decls;i<list.length;i+=1){var decl=list[i];this.checkPatternExport(exports$1,decl.id)}};pp$8.shouldParseExportStatement=function(){return this.type.keyword==="var"||this.type.keyword==="const"||this.type.keyword==="class"||this.type.keyword==="function"||this.isLet()||this.isAsyncFunction()};pp$8.parseExportSpecifier=function(exports$1){var node=this.startNode();return node.local=this.parseModuleExportName(),node.exported=this.eatContextual("as")?this.parseModuleExportName():node.local,this.checkExport(exports$1,node.exported,node.exported.start),this.finishNode(node,"ExportSpecifier")};pp$8.parseExportSpecifiers=function(exports$1){var nodes=[],first=!0;this.expect(types$1.braceL);while(!this.eat(types$1.braceR)){if(!first){if(this.expect(types$1.comma),this.afterTrailingComma(types$1.braceR))break}else first=!1;nodes.push(this.parseExportSpecifier(exports$1))}return nodes};pp$8.parseImport=function(node){if(this.next(),this.type===types$1.string)node.specifiers=empty$1,node.source=this.parseExprAtom();else node.specifiers=this.parseImportSpecifiers(),this.expectContextual("from"),node.source=this.type===types$1.string?this.parseExprAtom():this.unexpected();if(this.options.ecmaVersion>=16)node.attributes=this.parseWithClause();return this.semicolon(),this.finishNode(node,"ImportDeclaration")};pp$8.parseImportSpecifier=function(){var node=this.startNode();if(node.imported=this.parseModuleExportName(),this.eatContextual("as"))node.local=this.parseIdent();else this.checkUnreserved(node.imported),node.local=node.imported;return this.checkLValSimple(node.local,BIND_LEXICAL),this.finishNode(node,"ImportSpecifier")};pp$8.parseImportDefaultSpecifier=function(){var node=this.startNode();return node.local=this.parseIdent(),this.checkLValSimple(node.local,BIND_LEXICAL),this.finishNode(node,"ImportDefaultSpecifier")};pp$8.parseImportNamespaceSpecifier=function(){var node=this.startNode();return this.next(),this.expectContextual("as"),node.local=this.parseIdent(),this.checkLValSimple(node.local,BIND_LEXICAL),this.finishNode(node,"ImportNamespaceSpecifier")};pp$8.parseImportSpecifiers=function(){var nodes=[],first=!0;if(this.type===types$1.name){if(nodes.push(this.parseImportDefaultSpecifier()),!this.eat(types$1.comma))return nodes}if(this.type===types$1.star)return nodes.push(this.parseImportNamespaceSpecifier()),nodes;this.expect(types$1.braceL);while(!this.eat(types$1.braceR)){if(!first){if(this.expect(types$1.comma),this.afterTrailingComma(types$1.braceR))break}else first=!1;nodes.push(this.parseImportSpecifier())}return nodes};pp$8.parseWithClause=function(){var nodes=[];if(!this.eat(types$1._with))return nodes;this.expect(types$1.braceL);var attributeKeys={},first=!0;while(!this.eat(types$1.braceR)){if(!first){if(this.expect(types$1.comma),this.afterTrailingComma(types$1.braceR))break}else first=!1;var attr=this.parseImportAttribute(),keyName=attr.key.type==="Identifier"?attr.key.name:attr.key.value;if(hasOwn(attributeKeys,keyName))this.raiseRecoverable(attr.key.start,"Duplicate attribute key '"+keyName+"'");attributeKeys[keyName]=!0,nodes.push(attr)}return nodes};pp$8.parseImportAttribute=function(){var node=this.startNode();if(node.key=this.type===types$1.string?this.parseExprAtom():this.parseIdent(this.options.allowReserved!=="never"),this.expect(types$1.colon),this.type!==types$1.string)this.unexpected();return node.value=this.parseExprAtom(),this.finishNode(node,"ImportAttribute")};pp$8.parseModuleExportName=function(){if(this.options.ecmaVersion>=13&&this.type===types$1.string){var stringLiteral=this.parseLiteral(this.value);if(loneSurrogate.test(stringLiteral.value))this.raise(stringLiteral.start,"An export name cannot include a lone surrogate.");return stringLiteral}return this.parseIdent(!0)};pp$8.adaptDirectivePrologue=function(statements){for(var i=0;i<statements.length&&this.isDirectiveCandidate(statements[i]);++i)statements[i].directive=statements[i].expression.raw.slice(1,-1)};pp$8.isDirectiveCandidate=function(statement){return this.options.ecmaVersion>=5&&statement.type==="ExpressionStatement"&&statement.expression.type==="Literal"&&typeof statement.expression.value==="string"&&(this.input[statement.start]==='"'||this.input[statement.start]==="'")};var pp$7=Parser.prototype;pp$7.toAssignable=function(node,isBinding,refDestructuringErrors){if(this.options.ecmaVersion>=6&&node)switch(node.type){case"Identifier":if(this.inAsync&&node.name==="await")this.raise(node.start,"Cannot use 'await' as identifier inside an async function");break;case"ObjectPattern":case"ArrayPattern":case"AssignmentPattern":case"RestElement":break;case"ObjectExpression":if(node.type="ObjectPattern",refDestructuringErrors)this.checkPatternErrors(refDestructuringErrors,!0);for(var i=0,list=node.properties;i<list.length;i+=1){var prop=list[i];if(this.toAssignable(prop,isBinding),prop.type==="RestElement"&&(prop.argument.type==="ArrayPattern"||prop.argument.type==="ObjectPattern"))this.raise(prop.argument.start,"Unexpected token")}break;case"Property":if(node.kind!=="init")this.raise(node.key.start,"Object pattern can't contain getter or setter");this.toAssignable(node.value,isBinding);break;case"ArrayExpression":if(node.type="ArrayPattern",refDestructuringErrors)this.checkPatternErrors(refDestructuringErrors,!0);this.toAssignableList(node.elements,isBinding);break;case"SpreadElement":if(node.type="RestElement",this.toAssignable(node.argument,isBinding),node.argument.type==="AssignmentPattern")this.raise(node.argument.start,"Rest elements cannot have a default value");break;case"AssignmentExpression":if(node.operator!=="=")this.raise(node.left.end,"Only '=' operator can be used for specifying default value.");node.type="AssignmentPattern",delete node.operator,this.toAssignable(node.left,isBinding);break;case"ParenthesizedExpression":this.toAssignable(node.expression,isBinding,refDestructuringErrors);break;case"ChainExpression":this.raiseRecoverable(node.start,"Optional chaining cannot appear in left-hand side");break;case"MemberExpression":if(!isBinding)break;default:this.raise(node.start,"Assigning to rvalue")}else if(refDestructuringErrors)this.checkPatternErrors(refDestructuringErrors,!0);return node};pp$7.toAssignableList=function(exprList,isBinding){var end=exprList.length;for(var i=0;i<end;i++){var elt=exprList[i];if(elt)this.toAssignable(elt,isBinding)}if(end){var last=exprList[end-1];if(this.options.ecmaVersion===6&&isBinding&&last&&last.type==="RestElement"&&last.argument.type!=="Identifier")this.unexpected(last.argument.start)}return exprList};pp$7.parseSpread=function(refDestructuringErrors){var node=this.startNode();return this.next(),node.argument=this.parseMaybeAssign(!1,refDestructuringErrors),this.finishNode(node,"SpreadElement")};pp$7.parseRestBinding=function(){var node=this.startNode();if(this.next(),this.options.ecmaVersion===6&&this.type!==types$1.name)this.unexpected();return node.argument=this.parseBindingAtom(),this.finishNode(node,"RestElement")};pp$7.parseBindingAtom=function(){if(this.options.ecmaVersion>=6)switch(this.type){case types$1.bracketL:var node=this.startNode();return this.next(),node.elements=this.parseBindingList(types$1.bracketR,!0,!0),this.finishNode(node,"ArrayPattern");case types$1.braceL:return this.parseObj(!0)}return this.parseIdent()};pp$7.parseBindingList=function(close,allowEmpty,allowTrailingComma,allowModifiers){var elts=[],first=!0;while(!this.eat(close)){if(first)first=!1;else this.expect(types$1.comma);if(allowEmpty&&this.type===types$1.comma)elts.push(null);else if(allowTrailingComma&&this.afterTrailingComma(close))break;else if(this.type===types$1.ellipsis){var rest=this.parseRestBinding();if(this.parseBindingListItem(rest),elts.push(rest),this.type===types$1.comma)this.raiseRecoverable(this.start,"Comma is not permitted after the rest element");this.expect(close);break}else elts.push(this.parseAssignableListItem(allowModifiers))}return elts};pp$7.parseAssignableListItem=function(allowModifiers){var elem=this.parseMaybeDefault(this.start,this.startLoc);return this.parseBindingListItem(elem),elem};pp$7.parseBindingListItem=function(param){return param};pp$7.parseMaybeDefault=function(startPos,startLoc,left){if(left=left||this.parseBindingAtom(),this.options.ecmaVersion<6||!this.eat(types$1.eq))return left;var node=this.startNodeAt(startPos,startLoc);return node.left=left,node.right=this.parseMaybeAssign(),this.finishNode(node,"AssignmentPattern")};pp$7.checkLValSimple=function(expr,bindingType,checkClashes){if(bindingType===void 0)bindingType=BIND_NONE;var isBind=bindingType!==BIND_NONE;switch(expr.type){case"Identifier":if(this.strict&&this.reservedWordsStrictBind.test(expr.name))this.raiseRecoverable(expr.start,(isBind?"Binding ":"Assigning to ")+expr.name+" in strict mode");if(isBind){if(bindingType===BIND_LEXICAL&&expr.name==="let")this.raiseRecoverable(expr.start,"let is disallowed as a lexically bound name");if(checkClashes){if(hasOwn(checkClashes,expr.name))this.raiseRecoverable(expr.start,"Argument name clash");checkClashes[expr.name]=!0}if(bindingType!==BIND_OUTSIDE)this.declareName(expr.name,bindingType,expr.start)}break;case"ChainExpression":this.raiseRecoverable(expr.start,"Optional chaining cannot appear in left-hand side");break;case"MemberExpression":if(isBind)this.raiseRecoverable(expr.start,"Binding member expression");break;case"ParenthesizedExpression":if(isBind)this.raiseRecoverable(expr.start,"Binding parenthesized expression");return this.checkLValSimple(expr.expression,bindingType,checkClashes);default:this.raise(expr.start,(isBind?"Binding":"Assigning to")+" rvalue")}};pp$7.checkLValPattern=function(expr,bindingType,checkClashes){if(bindingType===void 0)bindingType=BIND_NONE;switch(expr.type){case"ObjectPattern":for(var i=0,list=expr.properties;i<list.length;i+=1){var prop=list[i];this.checkLValInnerPattern(prop,bindingType,checkClashes)}break;case"ArrayPattern":for(var i$1=0,list$1=expr.elements;i$1<list$1.length;i$1+=1){var elem=list$1[i$1];if(elem)this.checkLValInnerPattern(elem,bindingType,checkClashes)}break;default:this.checkLValSimple(expr,bindingType,checkClashes)}};pp$7.checkLValInnerPattern=function(expr,bindingType,checkClashes){if(bindingType===void 0)bindingType=BIND_NONE;switch(expr.type){case"Property":this.checkLValInnerPattern(expr.value,bindingType,checkClashes);break;case"AssignmentPattern":this.checkLValPattern(expr.left,bindingType,checkClashes);break;case"RestElement":this.checkLValPattern(expr.argument,bindingType,checkClashes);break;default:this.checkLValPattern(expr,bindingType,checkClashes)}};var TokContext=function(token,isExpr,preserveSpace,override,generator){this.token=token,this.isExpr=!!isExpr,this.preserveSpace=!!preserveSpace,this.override=override,this.generator=!!generator},types={b_stat:new TokContext("{",!1),b_expr:new TokContext("{",!0),b_tmpl:new TokContext("${",!1),p_stat:new TokContext("(",!1),p_expr:new TokContext("(",!0),q_tmpl:new TokContext("`",!0,!0,function(p){return p.tryReadTemplateToken()}),f_stat:new TokContext("function",!1),f_expr:new TokContext("function",!0),f_expr_gen:new TokContext("function",!0,!1,null,!0),f_gen:new TokContext("function",!1,!1,null,!0)},pp$6=Parser.prototype;pp$6.initialContext=function(){return[types.b_stat]};pp$6.curContext=function(){return this.context[this.context.length-1]};pp$6.braceIsBlock=function(prevType){var parent=this.curContext();if(parent===types.f_expr||parent===types.f_stat)return!0;if(prevType===types$1.colon&&(parent===types.b_stat||parent===types.b_expr))return!parent.isExpr;if(prevType===types$1._return||prevType===types$1.name&&this.exprAllowed)return lineBreak.test(this.input.slice(this.lastTokEnd,this.start));if(prevType===types$1._else||prevType===types$1.semi||prevType===types$1.eof||prevType===types$1.parenR||prevType===types$1.arrow)return!0;if(prevType===types$1.braceL)return parent===types.b_stat;if(prevType===types$1._var||prevType===types$1._const||prevType===types$1.name)return!1;return!this.exprAllowed};pp$6.inGeneratorContext=function(){for(var i=this.context.length-1;i>=1;i--){var context=this.context[i];if(context.token==="function")return context.generator}return!1};pp$6.updateContext=function(prevType){var update,type=this.type;if(type.keyword&&prevType===types$1.dot)this.exprAllowed=!1;else if(update=type.updateContext)update.call(this,prevType);else this.exprAllowed=type.beforeExpr};pp$6.overrideContext=function(tokenCtx){if(this.curContext()!==tokenCtx)this.context[this.context.length-1]=tokenCtx};types$1.parenR.updateContext=types$1.braceR.updateContext=function(){if(this.context.length===1){this.exprAllowed=!0;return}var out=this.context.pop();if(out===types.b_stat&&this.curContext().token==="function")out=this.context.pop();this.exprAllowed=!out.isExpr};types$1.braceL.updateContext=function(prevType){this.context.push(this.braceIsBlock(prevType)?types.b_stat:types.b_expr),this.exprAllowed=!0};types$1.dollarBraceL.updateContext=function(){this.context.push(types.b_tmpl),this.exprAllowed=!0};types$1.parenL.updateContext=function(prevType){var statementParens=prevType===types$1._if||prevType===types$1._for||prevType===types$1._with||prevType===types$1._while;this.context.push(statementParens?types.p_stat:types.p_expr),this.exprAllowed=!0};types$1.incDec.updateContext=function(){};types$1._function.updateContext=types$1._class.updateContext=function(prevType){if(prevType.beforeExpr&&prevType!==types$1._else&&!(prevType===types$1.semi&&this.curContext()!==types.p_stat)&&!(prevType===types$1._return&&lineBreak.test(this.input.slice(this.lastTokEnd,this.start)))&&!((prevType===types$1.colon||prevType===types$1.braceL)&&this.curContext()===types.b_stat))this.context.push(types.f_expr);else this.context.push(types.f_stat);this.exprAllowed=!1};types$1.colon.updateContext=function(){if(this.curContext().token==="function")this.context.pop();this.exprAllowed=!0};types$1.backQuote.updateContext=function(){if(this.curContext()===types.q_tmpl)this.context.pop();else this.context.push(types.q_tmpl);this.exprAllowed=!1};types$1.star.updateContext=function(prevType){if(prevType===types$1._function){var index=this.context.length-1;if(this.context[index]===types.f_expr)this.context[index]=types.f_expr_gen;else this.context[index]=types.f_gen}this.exprAllowed=!0};types$1.name.updateContext=function(prevType){var allowed=!1;if(this.options.ecmaVersion>=6&&prevType!==types$1.dot){if(this.value==="of"&&!this.exprAllowed||this.value==="yield"&&this.inGeneratorContext())allowed=!0}this.exprAllowed=allowed};var pp$5=Parser.prototype;pp$5.checkPropClash=function(prop,propHash,refDestructuringErrors){if(this.options.ecmaVersion>=9&&prop.type==="SpreadElement")return;if(this.options.ecmaVersion>=6&&(prop.computed||prop.method||prop.shorthand))return;var key=prop.key,name;switch(key.type){case"Identifier":name=key.name;break;case"Literal":name=String(key.value);break;default:return}var kind=prop.kind;if(this.options.ecmaVersion>=6){if(name==="__proto__"&&kind==="init"){if(propHash.proto)if(refDestructuringErrors){if(refDestructuringErrors.doubleProto<0)refDestructuringErrors.doubleProto=key.start}else this.raiseRecoverable(key.start,"Redefinition of __proto__ property");propHash.proto=!0}return}name="$"+name;var other=propHash[name];if(other){var redefinition;if(kind==="init")redefinition=this.strict&&other.init||other.get||other.set;else redefinition=other.init||other[kind];if(redefinition)this.raiseRecoverable(key.start,"Redefinition of property")}else other=propHash[name]={init:!1,get:!1,set:!1};other[kind]=!0};pp$5.parseExpression=function(forInit,refDestructuringErrors){var this$1$1=this;return this.catchStackOverflow(function(){var{start:startPos,startLoc}=this$1$1,expr=this$1$1.parseMaybeAssign(forInit,refDestructuringErrors);if(this$1$1.type===types$1.comma){var node=this$1$1.startNodeAt(startPos,startLoc);node.expressions=[expr];while(this$1$1.eat(types$1.comma))node.expressions.push(this$1$1.parseMaybeAssign(forInit,refDestructuringErrors));return this$1$1.finishNode(node,"SequenceExpression")}return expr})};pp$5.parseMaybeAssign=function(forInit,refDestructuringErrors,afterLeftParse){if(this.isContextual("yield"))if(this.inGenerator)return this.parseYield(forInit);else this.exprAllowed=!1;var ownDestructuringErrors=!1,oldParenAssign=-1,oldTrailingComma=-1,oldDoubleProto=-1;if(refDestructuringErrors)oldParenAssign=refDestructuringErrors.parenthesizedAssign,oldTrailingComma=refDestructuringErrors.trailingComma,oldDoubleProto=refDestructuringErrors.doubleProto,refDestructuringErrors.parenthesizedAssign=refDestructuringErrors.trailingComma=-1;else refDestructuringErrors=new DestructuringErrors,ownDestructuringErrors=!0;var startPos=this.start,startLoc=this.startLoc;if(this.type===types$1.parenL||this.type===types$1.name)this.potentialArrowAt=this.start,this.potentialArrowInForAwait=forInit==="await";var left=this.parseMaybeConditional(forInit,refDestructuringErrors);if(afterLeftParse)left=afterLeftParse.call(this,left,startPos,startLoc);if(this.type.isAssign){var node=this.startNodeAt(startPos,startLoc);if(node.operator=this.value,this.type===types$1.eq)left=this.toAssignable(left,!1,refDestructuringErrors);if(!ownDestructuringErrors)refDestructuringErrors.parenthesizedAssign=refDestructuringErrors.trailingComma=refDestructuringErrors.doubleProto=-1;if(refDestructuringErrors.shorthandAssign>=left.start)refDestructuringErrors.shorthandAssign=-1;if(this.type===types$1.eq)this.checkLValPattern(left);else this.checkLValSimple(left);if(node.left=left,this.next(),node.right=this.parseMaybeAssign(forInit),oldDoubleProto>-1)refDestructuringErrors.doubleProto=oldDoubleProto;return this.finishNode(node,"AssignmentExpression")}else if(ownDestructuringErrors)this.checkExpressionErrors(refDestructuringErrors,!0);if(oldParenAssign>-1)refDestructuringErrors.parenthesizedAssign=oldParenAssign;if(oldTrailingComma>-1)refDestructuringErrors.trailingComma=oldTrailingComma;return left};pp$5.parseMaybeConditional=function(forInit,refDestructuringErrors){var startPos=this.start,startLoc=this.startLoc,expr=this.parseExprOps(forInit,refDestructuringErrors);if(this.checkExpressionErrors(refDestructuringErrors))return expr;if(!(expr.type==="ArrowFunctionExpression"&&expr.start===startPos)&&this.eat(types$1.question)){var node=this.startNodeAt(startPos,startLoc);return node.test=expr,node.consequent=this.parseMaybeAssign(),this.expect(types$1.colon),node.alternate=this.parseMaybeAssign(forInit),this.finishNode(node,"ConditionalExpression")}return expr};pp$5.parseExprOps=function(forInit,refDestructuringErrors){var startPos=this.start,startLoc=this.startLoc,expr=this.parseMaybeUnary(refDestructuringErrors,!1,!1,forInit);if(this.checkExpressionErrors(refDestructuringErrors))return expr;return expr.start===startPos&&expr.type==="ArrowFunctionExpression"?expr:this.parseExprOp(expr,startPos,startLoc,-1,forInit)};pp$5.parseExprOp=function(left,leftStartPos,leftStartLoc,minPrec,forInit){var prec=this.type.binop;if(prec!=null&&(!forInit||this.type!==types$1._in)){if(prec>minPrec){var logical=this.type===types$1.logicalOR||this.type===types$1.logicalAND,coalesce=this.type===types$1.coalesce;if(coalesce)prec=types$1.logicalAND.binop;var op=this.value;this.next();var startPos=this.start,startLoc=this.startLoc,right=this.parseExprOp(this.parseMaybeUnary(null,!1,!1,forInit),startPos,startLoc,prec,forInit),node=this.buildBinary(leftStartPos,leftStartLoc,left,right,op,logical||coalesce);if(logical&&this.type===types$1.coalesce||coalesce&&(this.type===types$1.logicalOR||this.type===types$1.logicalAND))this.raiseRecoverable(this.start,"Logical expressions and coalesce expressions cannot be mixed. Wrap either by parentheses");return this.parseExprOp(node,leftStartPos,leftStartLoc,minPrec,forInit)}}return left};pp$5.buildBinary=function(startPos,startLoc,left,right,op,logical){if(right.type==="PrivateIdentifier")this.raise(right.start,"Private identifier can only be left side of binary expression");var node=this.startNodeAt(startPos,startLoc);return node.left=left,node.operator=op,node.right=right,this.finishNode(node,logical?"LogicalExpression":"BinaryExpression")};pp$5.parseMaybeUnary=function(refDestructuringErrors,sawUnary,incDec,forInit){var startPos=this.start,startLoc=this.startLoc,expr;if(this.isContextual("await")&&this.canAwait)expr=this.parseAwait(forInit),sawUnary=!0;else if(this.type.prefix){var node=this.startNode(),update=this.type===types$1.incDec;if(node.operator=this.value,node.prefix=!0,this.next(),node.argument=this.parseMaybeUnary(null,!0,update,forInit),this.checkExpressionErrors(refDestructuringErrors,!0),update)this.checkLValSimple(node.argument);else if(this.strict&&node.operator==="delete"&&isLocalVariableAccess(node.argument))this.raiseRecoverable(node.start,"Deleting local variable in strict mode");else if(node.operator==="delete"&&isPrivateFieldAccess(node.argument))this.raiseRecoverable(node.start,"Private fields can not be deleted");else sawUnary=!0;expr=this.finishNode(node,update?"UpdateExpression":"UnaryExpression")}else if(!sawUnary&&this.type===types$1.privateId){if((forInit||this.privateNameStack.length===0)&&this.options.checkPrivateFields)this.unexpected();if(expr=this.parsePrivateIdent(),this.type!==types$1._in)this.unexpected()}else{if(expr=this.parseExprSubscripts(refDestructuringErrors,forInit),this.checkExpressionErrors(refDestructuringErrors))return expr;while(this.type.postfix&&!this.canInsertSemicolon()){var node$1=this.startNodeAt(startPos,startLoc);node$1.operator=this.value,node$1.prefix=!1,node$1.argument=expr,this.checkLValSimple(expr),this.next(),expr=this.finishNode(node$1,"UpdateExpression")}}if(!incDec&&!(expr.type==="ArrowFunctionExpression"&&expr.start===startPos)&&this.eat(types$1.starstar))if(sawUnary)this.unexpected(this.lastTokStart);else return this.buildBinary(startPos,startLoc,expr,this.parseMaybeUnary(null,!1,!1,forInit),"**",!1);else return expr};function isLocalVariableAccess(node){return node.type==="Identifier"||node.type==="ParenthesizedExpression"&&isLocalVariableAccess(node.expression)}function isPrivateFieldAccess(node){return node.type==="MemberExpression"&&node.property.type==="PrivateIdentifier"||node.type==="ChainExpression"&&isPrivateFieldAccess(node.expression)||node.type==="ParenthesizedExpression"&&isPrivateFieldAccess(node.expression)}pp$5.parseExprSubscripts=function(refDestructuringErrors,forInit){var startPos=this.start,startLoc=this.startLoc,expr=this.parseExprAtom(refDestructuringErrors,forInit);if(expr.type==="ArrowFunctionExpression"&&this.input.slice(this.lastTokStart,this.lastTokEnd)!==")")return expr;var result=this.parseSubscripts(expr,startPos,startLoc,!1,forInit);if(refDestructuringErrors&&result.type==="MemberExpression"){if(refDestructuringErrors.parenthesizedAssign>=result.start)refDestructuringErrors.parenthesizedAssign=-1;if(refDestructuringErrors.parenthesizedBind>=result.start)refDestructuringErrors.parenthesizedBind=-1;if(refDestructuringErrors.trailingComma>=result.start)refDestructuringErrors.trailingComma=-1}return result};pp$5.parseSubscripts=function(base,startPos,startLoc,noCalls,forInit){var maybeAsyncArrow=this.options.ecmaVersion>=8&&base.type==="Identifier"&&base.name==="async"&&this.lastTokEnd===base.end&&!this.canInsertSemicolon()&&base.end-base.start===5&&this.potentialArrowAt===base.start,optionalChained=!1;while(!0){var element=this.parseSubscript(base,startPos,startLoc,noCalls,maybeAsyncArrow,optionalChained,forInit);if(element.optional)optionalChained=!0;if(element===base||element.type==="ArrowFunctionExpression"){if(optionalChained){var chainNode=this.startNodeAt(startPos,startLoc);chainNode.expression=element,element=this.finishNode(chainNode,"ChainExpression")}return element}base=element}};pp$5.shouldParseAsyncArrow=function(){return!this.canInsertSemicolon()&&this.eat(types$1.arrow)};pp$5.parseSubscriptAsyncArrow=function(startPos,startLoc,exprList,forInit){return this.parseArrowExpression(this.startNodeAt(startPos,startLoc),exprList,!0,forInit)};pp$5.parseSubscript=function(base,startPos,startLoc,noCalls,maybeAsyncArrow,optionalChained,forInit){var optionalSupported=this.options.ecmaVersion>=11,optional=optionalSupported&&this.eat(types$1.questionDot);if(noCalls&&optional)this.raise(this.lastTokStart,"Optional chaining cannot appear in the callee of new expressions");var computed=this.eat(types$1.bracketL);if(computed||optional&&this.type!==types$1.parenL&&this.type!==types$1.backQuote||this.eat(types$1.dot)){var node=this.startNodeAt(startPos,startLoc);if(node.object=base,computed)node.property=this.parseExpression(),this.expect(types$1.bracketR);else if(this.type===types$1.privateId&&base.type!=="Super")node.property=this.parsePrivateIdent();else node.property=this.parseIdent(this.options.allowReserved!=="never");if(node.computed=!!computed,optionalSupported)node.optional=optional;base=this.finishNode(node,"MemberExpression")}else if(!noCalls&&this.eat(types$1.parenL)){var refDestructuringErrors=new DestructuringErrors,oldYieldPos=this.yieldPos,oldAwaitPos=this.awaitPos,oldAwaitIdentPos=this.awaitIdentPos;this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0;var exprList=this.parseExprList(types$1.parenR,this.options.ecmaVersion>=8,!1,refDestructuringErrors);if(maybeAsyncArrow&&!optional&&this.shouldParseAsyncArrow()){if(this.checkPatternErrors(refDestructuringErrors,!1),this.checkYieldAwaitInDefaultParams(),this.awaitIdentPos>0)this.raise(this.awaitIdentPos,"Cannot use 'await' as identifier inside an async function");return this.yieldPos=oldYieldPos,this.awaitPos=oldAwaitPos,this.awaitIdentPos=oldAwaitIdentPos,this.parseSubscriptAsyncArrow(startPos,startLoc,exprList,forInit)}this.checkExpressionErrors(refDestructuringErrors,!0),this.yieldPos=oldYieldPos||this.yieldPos,this.awaitPos=oldAwaitPos||this.awaitPos,this.awaitIdentPos=oldAwaitIdentPos||this.awaitIdentPos;var node$1=this.startNodeAt(startPos,startLoc);if(node$1.callee=base,node$1.arguments=exprList,optionalSupported)node$1.optional=optional;base=this.finishNode(node$1,"CallExpression")}else if(this.type===types$1.backQuote){if(optional||optionalChained)this.raise(this.start,"Optional chaining cannot appear in the tag of tagged template expressions");var node$2=this.startNodeAt(startPos,startLoc);node$2.tag=base,node$2.quasi=this.parseTemplate({isTagged:!0}),base=this.finishNode(node$2,"TaggedTemplateExpression")}return base};pp$5.parseExprAtom=function(refDestructuringErrors,forInit,forNew){if(this.type===types$1.slash)this.readRegexp();var node,canBeArrow=this.potentialArrowAt===this.start;switch(this.type){case types$1._super:if(!this.allowSuper)this.raise(this.start,"'super' keyword outside a method");if(node=this.startNode(),this.next(),this.type===types$1.parenL&&!this.allowDirectSuper)this.raise(node.start,"super() call outside constructor of a subclass");if(this.type!==types$1.dot&&this.type!==types$1.bracketL&&this.type!==types$1.parenL)this.unexpected();return this.finishNode(node,"Super");case types$1._this:return node=this.startNode(),this.next(),this.finishNode(node,"ThisExpression");case types$1.name:var startPos=this.start,startLoc=this.startLoc,containsEsc=this.containsEsc,id=this.parseIdent(!1);if(this.options.ecmaVersion>=8&&!containsEsc&&id.name==="async"&&!this.canInsertSemicolon()&&this.eat(types$1._function))return this.overrideContext(types.f_expr),this.parseFunction(this.startNodeAt(startPos,startLoc),0,!1,!0,forInit);if(canBeArrow&&!this.canInsertSemicolon()){if(this.eat(types$1.arrow))return this.parseArrowExpression(this.startNodeAt(startPos,startLoc),[id],!1,forInit);if(this.options.ecmaVersion>=8&&id.name==="async"&&this.type===types$1.name&&!containsEsc&&(!this.potentialArrowInForAwait||this.value!=="of"||this.containsEsc)){if(id=this.parseIdent(!1),this.canInsertSemicolon()||!this.eat(types$1.arrow))this.unexpected();return this.parseArrowExpression(this.startNodeAt(startPos,startLoc),[id],!0,forInit)}}return id;case types$1.regexp:var value=this.value;return node=this.parseLiteral(value.value),node.regex={pattern:value.pattern,flags:value.flags},node;case types$1.num:case types$1.string:return this.parseLiteral(this.value);case types$1._null:case types$1._true:case types$1._false:return node=this.startNode(),node.value=this.type===types$1._null?null:this.type===types$1._true,node.raw=this.type.keyword,this.next(),this.finishNode(node,"Literal");case types$1.parenL:var start=this.start,expr=this.parseParenAndDistinguishExpression(canBeArrow,forInit);if(refDestructuringErrors){if(refDestructuringErrors.parenthesizedAssign<0&&!this.isSimpleAssignTarget(expr))refDestructuringErrors.parenthesizedAssign=start;if(refDestructuringErrors.parenthesizedBind<0)refDestructuringErrors.parenthesizedBind=start}return expr;case types$1.bracketL:return node=this.startNode(),this.next(),node.elements=this.parseExprList(types$1.bracketR,!0,!0,refDestructuringErrors),this.finishNode(node,"ArrayExpression");case types$1.braceL:return this.overrideContext(types.b_expr),this.parseObj(!1,refDestructuringErrors);case types$1._function:return node=this.startNode(),this.next(),this.parseFunction(node,0);case types$1._class:return this.parseClass(this.startNode(),!1);case types$1._new:return this.parseNew();case types$1.backQuote:return this.parseTemplate();case types$1._import:if(this.options.ecmaVersion>=11)return this.parseExprImport(forNew);else return this.unexpected();default:return this.parseExprAtomDefault()}};pp$5.parseExprAtomDefault=function(){this.unexpected()};pp$5.parseExprImport=function(forNew){var node=this.startNode();if(this.containsEsc)this.raiseRecoverable(this.start,"Escape sequence in keyword import");if(this.next(),this.type===types$1.parenL&&!forNew)return this.parseDynamicImport(node);else if(this.type===types$1.dot){var meta=this.startNodeAt(node.start,node.loc&&node.loc.start);return meta.name="import",node.meta=this.finishNode(meta,"Identifier"),this.parseImportMeta(node)}else this.unexpected()};pp$5.parseDynamicImport=function(node){if(this.next(),node.source=this.parseMaybeAssign(),this.options.ecmaVersion>=16)if(!this.eat(types$1.parenR))if(this.expect(types$1.comma),!this.afterTrailingComma(types$1.parenR)){if(node.options=this.parseMaybeAssign(),!this.eat(types$1.parenR)){if(this.expect(types$1.comma),!this.afterTrailingComma(types$1.parenR))this.unexpected()}}else node.options=null;else node.options=null;else if(!this.eat(types$1.parenR)){var errorPos=this.start;if(this.eat(types$1.comma)&&this.eat(types$1.parenR))this.raiseRecoverable(errorPos,"Trailing comma is not allowed in import()");else this.unexpected(errorPos)}return this.finishNode(node,"ImportExpression")};pp$5.parseImportMeta=function(node){this.next();var containsEsc=this.containsEsc;if(node.property=this.parseIdent(!0),node.property.name!=="meta")this.raiseRecoverable(node.property.start,"The only valid meta property for import is 'import.meta'");if(containsEsc)this.raiseRecoverable(node.start,"'import.meta' must not contain escaped characters");if(this.options.sourceType!=="module"&&!this.options.allowImportExportEverywhere)this.raiseRecoverable(node.start,"Cannot use 'import.meta' outside a module");return this.finishNode(node,"MetaProperty")};pp$5.parseLiteral=function(value){var node=this.startNode();if(node.value=value,node.raw=this.input.slice(this.start,this.end),node.raw.charCodeAt(node.raw.length-1)===110)node.bigint=node.value!=null?node.value.toString():node.raw.slice(0,-1).replace(/_/g,"");return this.next(),this.finishNode(node,"Literal")};pp$5.parseParenExpression=function(){this.expect(types$1.parenL);var val=this.parseExpression();return this.expect(types$1.parenR),val};pp$5.shouldParseArrow=function(exprList){return!this.canInsertSemicolon()};pp$5.parseParenAndDistinguishExpression=function(canBeArrow,forInit){var startPos=this.start,startLoc=this.startLoc,val,allowTrailingComma=this.options.ecmaVersion>=8;if(this.options.ecmaVersion>=6){this.next();var innerStartPos=this.start,innerStartLoc=this.startLoc,exprList=[],first=!0,lastIsComma=!1,refDestructuringErrors=new DestructuringErrors,oldYieldPos=this.yieldPos,oldAwaitPos=this.awaitPos,spreadStart;this.yieldPos=0,this.awaitPos=0;while(this.type!==types$1.parenR)if(first?first=!1:this.expect(types$1.comma),allowTrailingComma&&this.afterTrailingComma(types$1.parenR,!0)){lastIsComma=!0;break}else if(this.type===types$1.ellipsis){if(spreadStart=this.start,exprList.push(this.parseParenItem(this.parseRestBinding())),this.type===types$1.comma)this.raiseRecoverable(this.start,"Comma is not permitted after the rest element");break}else exprList.push(this.parseMaybeAssign(!1,refDestructuringErrors,this.parseParenItem));var innerEndPos=this.lastTokEnd,innerEndLoc=this.lastTokEndLoc;if(this.expect(types$1.parenR),canBeArrow&&this.shouldParseArrow(exprList)&&this.eat(types$1.arrow))return this.checkPatternErrors(refDestructuringErrors,!1),this.checkYieldAwaitInDefaultParams(),this.yieldPos=oldYieldPos,this.awaitPos=oldAwaitPos,this.parseParenArrowList(startPos,startLoc,exprList,forInit);if(!exprList.length||lastIsComma)this.unexpected(this.lastTokStart);if(spreadStart)this.unexpected(spreadStart);if(this.checkExpressionErrors(refDestructuringErrors,!0),this.yieldPos=oldYieldPos||this.yieldPos,this.awaitPos=oldAwaitPos||this.awaitPos,exprList.length>1)val=this.startNodeAt(innerStartPos,innerStartLoc),val.expressions=exprList,this.finishNodeAt(val,"SequenceExpression",innerEndPos,innerEndLoc);else val=exprList[0]}else val=this.parseParenExpression();if(this.options.preserveParens){var par=this.startNodeAt(startPos,startLoc);return par.expression=val,this.finishNode(par,"ParenthesizedExpression")}else return val};pp$5.parseParenItem=function(item){return item};pp$5.parseParenArrowList=function(startPos,startLoc,exprList,forInit){return this.parseArrowExpression(this.startNodeAt(startPos,startLoc),exprList,!1,forInit)};var empty=[];pp$5.parseNew=function(){if(this.containsEsc)this.raiseRecoverable(this.start,"Escape sequence in keyword new");var node=this.startNode();if(this.next(),this.options.ecmaVersion>=6&&this.type===types$1.dot){var meta=this.startNodeAt(node.start,node.loc&&node.loc.start);meta.name="new",node.meta=this.finishNode(meta,"Identifier"),this.next();var containsEsc=this.containsEsc;if(node.property=this.parseIdent(!0),node.property.name!=="target")this.raiseRecoverable(node.property.start,"The only valid meta property for new is 'new.target'");if(containsEsc)this.raiseRecoverable(node.start,"'new.target' must not contain escaped characters");if(!this.allowNewDotTarget)this.raiseRecoverable(node.start,"'new.target' can only be used in functions and class static block");return this.finishNode(node,"MetaProperty")}var startPos=this.start,startLoc=this.startLoc;if(node.callee=this.parseSubscripts(this.parseExprAtom(null,!1,!0),startPos,startLoc,!0,!1),node.callee.type==="Super")this.raiseRecoverable(startPos,"Invalid use of 'super'");if(this.eat(types$1.parenL))node.arguments=this.parseExprList(types$1.parenR,this.options.ecmaVersion>=8,!1);else node.arguments=empty;return this.finishNode(node,"NewExpression")};pp$5.parseTemplateElement=function(ref){var isTagged=ref.isTagged,elem=this.startNode();if(this.type===types$1.invalidTemplate){if(!isTagged)this.raiseRecoverable(this.start,"Bad escape sequence in untagged template literal");elem.value={raw:this.value.replace(/\r\n?/g,`
|
|
5
|
+
`),cooked:null}}else elem.value={raw:this.input.slice(this.start,this.end).replace(/\r\n?/g,`
|
|
6
|
+
`),cooked:this.value};return this.next(),elem.tail=this.type===types$1.backQuote,this.finishNode(elem,"TemplateElement")};pp$5.parseTemplate=function(ref){if(ref===void 0)ref={};var isTagged=ref.isTagged;if(isTagged===void 0)isTagged=!1;var node=this.startNode();this.next(),node.expressions=[];var curElt=this.parseTemplateElement({isTagged});node.quasis=[curElt];while(!curElt.tail){if(this.type===types$1.eof)this.raise(this.pos,"Unterminated template literal");this.expect(types$1.dollarBraceL),node.expressions.push(this.parseExpression()),this.expect(types$1.braceR),node.quasis.push(curElt=this.parseTemplateElement({isTagged}))}return this.next(),this.finishNode(node,"TemplateLiteral")};pp$5.isAsyncProp=function(prop){return!prop.computed&&prop.key.type==="Identifier"&&prop.key.name==="async"&&(this.type===types$1.name||this.type===types$1.num||this.type===types$1.string||this.type===types$1.bracketL||this.type.keyword||this.options.ecmaVersion>=9&&this.type===types$1.star)&&!lineBreak.test(this.input.slice(this.lastTokEnd,this.start))};pp$5.parseObj=function(isPattern,refDestructuringErrors){var node=this.startNode(),first=!0,propHash={};node.properties=[],this.next();while(!this.eat(types$1.braceR)){if(!first){if(this.expect(types$1.comma),this.options.ecmaVersion>=5&&this.afterTrailingComma(types$1.braceR))break}else first=!1;var prop=this.parseProperty(isPattern,refDestructuringErrors);if(!isPattern)this.checkPropClash(prop,propHash,refDestructuringErrors);node.properties.push(prop)}return this.finishNode(node,isPattern?"ObjectPattern":"ObjectExpression")};pp$5.parseProperty=function(isPattern,refDestructuringErrors){var prop=this.startNode(),isGenerator,isAsync,startPos,startLoc;if(this.options.ecmaVersion>=9&&this.eat(types$1.ellipsis)){if(isPattern){if(prop.argument=this.parseIdent(!1),this.type===types$1.comma)this.raiseRecoverable(this.start,"Comma is not permitted after the rest element");return this.finishNode(prop,"RestElement")}if(prop.argument=this.parseMaybeAssign(!1,refDestructuringErrors),this.type===types$1.comma&&refDestructuringErrors&&refDestructuringErrors.trailingComma<0)refDestructuringErrors.trailingComma=this.start;return this.finishNode(prop,"SpreadElement")}if(this.options.ecmaVersion>=6){if(prop.method=!1,prop.shorthand=!1,isPattern||refDestructuringErrors)startPos=this.start,startLoc=this.startLoc;if(!isPattern)isGenerator=this.eat(types$1.star)}var containsEsc=this.containsEsc;if(this.parsePropertyName(prop),!isPattern&&!containsEsc&&this.options.ecmaVersion>=8&&!isGenerator&&this.isAsyncProp(prop))isAsync=!0,isGenerator=this.options.ecmaVersion>=9&&this.eat(types$1.star),this.parsePropertyName(prop);else isAsync=!1;return this.parsePropertyValue(prop,isPattern,isGenerator,isAsync,startPos,startLoc,refDestructuringErrors,containsEsc),this.finishNode(prop,"Property")};pp$5.parseGetterSetter=function(prop){var kind=prop.key.name;this.parsePropertyName(prop),prop.value=this.parseMethod(!1),prop.kind=kind;var paramCount=prop.kind==="get"?0:1;if(prop.value.params.length!==paramCount){var start=prop.value.start;if(prop.kind==="get")this.raiseRecoverable(start,"getter should have no params");else this.raiseRecoverable(start,"setter should have exactly one param")}else if(prop.kind==="set"&&prop.value.params[0].type==="RestElement")this.raiseRecoverable(prop.value.params[0].start,"Setter cannot use rest params")};pp$5.parsePropertyValue=function(prop,isPattern,isGenerator,isAsync,startPos,startLoc,refDestructuringErrors,containsEsc){if((isGenerator||isAsync)&&this.type===types$1.colon)this.unexpected();if(this.eat(types$1.colon))prop.value=isPattern?this.parseMaybeDefault(this.start,this.startLoc):this.parseMaybeAssign(!1,refDestructuringErrors),prop.kind="init";else if(this.options.ecmaVersion>=6&&this.type===types$1.parenL){if(isPattern)this.unexpected();prop.method=!0,prop.value=this.parseMethod(isGenerator,isAsync),prop.kind="init"}else if(!isPattern&&!containsEsc&&this.options.ecmaVersion>=5&&!prop.computed&&prop.key.type==="Identifier"&&(prop.key.name==="get"||prop.key.name==="set")&&(this.type!==types$1.comma&&this.type!==types$1.braceR&&this.type!==types$1.eq)){if(isGenerator||isAsync)this.unexpected();this.parseGetterSetter(prop)}else if(this.options.ecmaVersion>=6&&!prop.computed&&prop.key.type==="Identifier"){if(isGenerator||isAsync)this.unexpected();if(this.checkUnreserved(prop.key),prop.key.name==="await"&&!this.awaitIdentPos)this.awaitIdentPos=startPos;if(isPattern)prop.value=this.parseMaybeDefault(startPos,startLoc,this.copyNode(prop.key));else if(this.type===types$1.eq&&refDestructuringErrors){if(refDestructuringErrors.shorthandAssign<0)refDestructuringErrors.shorthandAssign=this.start;prop.value=this.parseMaybeDefault(startPos,startLoc,this.copyNode(prop.key))}else prop.value=this.copyNode(prop.key);prop.kind="init",prop.shorthand=!0}else this.unexpected()};pp$5.parsePropertyName=function(prop){if(this.options.ecmaVersion>=6)if(this.eat(types$1.bracketL))return prop.computed=!0,prop.key=this.parseMaybeAssign(),this.expect(types$1.bracketR),prop.key;else prop.computed=!1;return prop.key=this.type===types$1.num||this.type===types$1.string?this.parseExprAtom():this.parseIdent(this.options.allowReserved!=="never")};pp$5.initFunction=function(node){if(node.id=null,this.options.ecmaVersion>=6)node.generator=node.expression=!1;if(this.options.ecmaVersion>=8)node.async=!1};pp$5.parseMethod=function(isGenerator,isAsync,allowDirectSuper){var node=this.startNode(),oldYieldPos=this.yieldPos,oldAwaitPos=this.awaitPos,oldAwaitIdentPos=this.awaitIdentPos;if(this.initFunction(node),this.options.ecmaVersion>=6)node.generator=isGenerator;if(this.options.ecmaVersion>=8)node.async=!!isAsync;return this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(functionFlags(isAsync,node.generator)|SCOPE_SUPER|(allowDirectSuper?SCOPE_DIRECT_SUPER:0)),this.expect(types$1.parenL),node.params=this.parseBindingList(types$1.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams(),this.parseFunctionBody(node,!1,!0,!1),this.yieldPos=oldYieldPos,this.awaitPos=oldAwaitPos,this.awaitIdentPos=oldAwaitIdentPos,this.finishNode(node,"FunctionExpression")};pp$5.parseArrowExpression=function(node,params,isAsync,forInit){var oldYieldPos=this.yieldPos,oldAwaitPos=this.awaitPos,oldAwaitIdentPos=this.awaitIdentPos;if(this.enterScope(functionFlags(isAsync,!1)|SCOPE_ARROW),this.initFunction(node),this.options.ecmaVersion>=8)node.async=!!isAsync;return this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,node.params=this.toAssignableList(params,!0),this.parseFunctionBody(node,!0,!1,forInit),this.yieldPos=oldYieldPos,this.awaitPos=oldAwaitPos,this.awaitIdentPos=oldAwaitIdentPos,this.finishNode(node,"ArrowFunctionExpression")};pp$5.parseFunctionBody=function(node,isArrowFunction,isMethod,forInit){var isExpression=isArrowFunction&&this.type!==types$1.braceL,oldStrict=this.strict,useStrict=!1;if(isExpression)node.body=this.parseMaybeAssign(forInit),node.expression=!0,this.checkParams(node,!1);else{var nonSimple=this.options.ecmaVersion>=7&&!this.isSimpleParamList(node.params);if(!oldStrict||nonSimple){if(useStrict=this.strictDirective(this.end),useStrict&&nonSimple)this.raiseRecoverable(node.start,"Illegal 'use strict' directive in function with non-simple parameter list")}var oldLabels=this.labels;if(this.labels=[],useStrict)this.strict=!0;if(this.checkParams(node,!oldStrict&&!useStrict&&!isArrowFunction&&!isMethod&&this.isSimpleParamList(node.params)),this.strict&&node.id)this.checkLValSimple(node.id,BIND_OUTSIDE);node.body=this.parseBlock(!1,void 0,useStrict&&!oldStrict),node.expression=!1,this.adaptDirectivePrologue(node.body.body),this.labels=oldLabels}this.exitScope()};pp$5.isSimpleParamList=function(params){for(var i=0,list=params;i<list.length;i+=1){var param=list[i];if(param.type!=="Identifier")return!1}return!0};pp$5.checkParams=function(node,allowDuplicates){var nameHash=Object.create(null);for(var i=0,list=node.params;i<list.length;i+=1){var param=list[i];this.checkLValInnerPattern(param,BIND_VAR,allowDuplicates?null:nameHash)}};pp$5.parseExprList=function(close,allowTrailingComma,allowEmpty,refDestructuringErrors){var elts=[],first=!0;while(!this.eat(close)){if(!first){if(this.expect(types$1.comma),allowTrailingComma&&this.afterTrailingComma(close))break}else first=!1;var elt=void 0;if(allowEmpty&&this.type===types$1.comma)elt=null;else if(this.type===types$1.ellipsis){if(elt=this.parseSpread(refDestructuringErrors),refDestructuringErrors&&this.type===types$1.comma&&refDestructuringErrors.trailingComma<0)refDestructuringErrors.trailingComma=this.start}else elt=this.parseMaybeAssign(!1,refDestructuringErrors);elts.push(elt)}return elts};pp$5.checkUnreserved=function(ref){var{start,end,name}=ref;if(this.inGenerator&&name==="yield")this.raiseRecoverable(start,"Cannot use 'yield' as identifier inside a generator");if(this.inAsync&&name==="await")this.raiseRecoverable(start,"Cannot use 'await' as identifier inside an async function");if(!(this.currentThisScope().flags&SCOPE_VAR)&&name==="arguments")this.raiseRecoverable(start,"Cannot use 'arguments' in class field initializer");if(this.inClassStaticBlock&&(name==="arguments"||name==="await"))this.raise(start,"Cannot use "+name+" in class static initialization block");if(this.keywords.test(name))this.raise(start,"Unexpected keyword '"+name+"'");if(this.options.ecmaVersion<6&&this.input.slice(start,end).indexOf("\\")!==-1)return;var re=this.strict?this.reservedWordsStrict:this.reservedWords;if(re.test(name)){if(!this.inAsync&&name==="await")this.raiseRecoverable(start,"Cannot use keyword 'await' outside an async function");this.raiseRecoverable(start,"The keyword '"+name+"' is reserved")}};pp$5.parseIdent=function(liberal){var node=this.parseIdentNode();if(this.next(!!liberal),this.finishNode(node,"Identifier"),!liberal){if(this.checkUnreserved(node),node.name==="await"&&!this.awaitIdentPos)this.awaitIdentPos=node.start}return node};pp$5.parseIdentNode=function(){var node=this.startNode();if(this.type===types$1.name)node.name=this.value;else if(this.type.keyword){if(node.name=this.type.keyword,(node.name==="class"||node.name==="function")&&(this.lastTokEnd!==this.lastTokStart+1||this.input.charCodeAt(this.lastTokStart)!==46))this.context.pop();this.type=types$1.name}else this.unexpected();return node};pp$5.parsePrivateIdent=function(){var node=this.startNode();if(this.type===types$1.privateId)node.name=this.value;else this.unexpected();if(this.next(),this.finishNode(node,"PrivateIdentifier"),this.options.checkPrivateFields)if(this.privateNameStack.length===0)this.raise(node.start,"Private field '#"+node.name+"' must be declared in an enclosing class");else this.privateNameStack[this.privateNameStack.length-1].used.push(node);return node};pp$5.parseYield=function(forInit){if(!this.yieldPos)this.yieldPos=this.start;var node=this.startNode();if(this.next(),this.type===types$1.semi||this.canInsertSemicolon()||this.type!==types$1.star&&!this.type.startsExpr)node.delegate=!1,node.argument=null;else node.delegate=this.eat(types$1.star),node.argument=this.parseMaybeAssign(forInit);return this.finishNode(node,"YieldExpression")};pp$5.parseAwait=function(forInit){if(!this.awaitPos)this.awaitPos=this.start;var node=this.startNode();return this.next(),node.argument=this.parseMaybeUnary(null,!0,!1,forInit),this.finishNode(node,"AwaitExpression")};var pp$4=Parser.prototype;pp$4.raise=function(pos,message){var loc=getLineInfo(this.input,pos);if(message+=" ("+loc.line+":"+loc.column+")",this.sourceFile)message+=" in "+this.sourceFile;var err=SyntaxError(message);throw err.pos=pos,err.loc=loc,err.raisedAt=this.pos,err};pp$4.raiseRecoverable=pp$4.raise;pp$4.curPosition=function(){if(this.options.locations)return new Position(this.curLine,this.pos-this.lineStart)};var pp$3=Parser.prototype,Scope=function(flags){this.flags=flags,this.var=[],this.lexical=[],this.functions=[]};pp$3.enterScope=function(flags){this.scopeStack.push(new Scope(flags))};pp$3.exitScope=function(){this.scopeStack.pop()};pp$3.treatFunctionsAsVarInScope=function(scope){return scope.flags&SCOPE_FUNCTION||!this.inModule&&scope.flags&SCOPE_TOP};pp$3.declareName=function(name,bindingType,pos){var redeclared=!1;if(bindingType===BIND_LEXICAL){var scope=this.currentScope();if(redeclared=scope.lexical.indexOf(name)>-1||scope.functions.indexOf(name)>-1||scope.var.indexOf(name)>-1,scope.lexical.push(name),this.inModule&&scope.flags&SCOPE_TOP)delete this.undefinedExports[name]}else if(bindingType===BIND_SIMPLE_CATCH){var scope$1=this.currentScope();scope$1.lexical.push(name)}else if(bindingType===BIND_FUNCTION){var scope$2=this.currentScope();if(this.treatFunctionsAsVar)redeclared=scope$2.lexical.indexOf(name)>-1;else redeclared=scope$2.lexical.indexOf(name)>-1||scope$2.var.indexOf(name)>-1;scope$2.functions.push(name)}else for(var i=this.scopeStack.length-1;i>=0;--i){var scope$3=this.scopeStack[i];if(scope$3.lexical.indexOf(name)>-1&&!(scope$3.flags&SCOPE_SIMPLE_CATCH&&scope$3.lexical[0]===name)||!this.treatFunctionsAsVarInScope(scope$3)&&scope$3.functions.indexOf(name)>-1){redeclared=!0;break}if(scope$3.var.push(name),this.inModule&&scope$3.flags&SCOPE_TOP)delete this.undefinedExports[name];if(scope$3.flags&SCOPE_VAR)break}if(redeclared)this.raiseRecoverable(pos,"Identifier '"+name+"' has already been declared")};pp$3.checkLocalExport=function(id){if(this.scopeStack[0].lexical.indexOf(id.name)===-1&&this.scopeStack[0].var.indexOf(id.name)===-1)this.undefinedExports[id.name]=id};pp$3.currentScope=function(){return this.scopeStack[this.scopeStack.length-1]};pp$3.currentVarScope=function(){for(var i=this.scopeStack.length-1;;i--){var scope=this.scopeStack[i];if(scope.flags&(SCOPE_VAR|SCOPE_CLASS_FIELD_INIT|SCOPE_CLASS_STATIC_BLOCK))return scope}};pp$3.currentThisScope=function(){for(var i=this.scopeStack.length-1;;i--){var scope=this.scopeStack[i];if(scope.flags&(SCOPE_VAR|SCOPE_CLASS_FIELD_INIT|SCOPE_CLASS_STATIC_BLOCK)&&!(scope.flags&SCOPE_ARROW))return scope}};var Node=function(parser,pos,loc){if(this.type="",this.start=pos,this.end=0,parser.options.locations)this.loc=new SourceLocation(parser,loc);if(parser.options.directSourceFile)this.sourceFile=parser.options.directSourceFile;if(parser.options.ranges)this.range=[pos,0]},pp$2=Parser.prototype;pp$2.startNode=function(){return new Node(this,this.start,this.startLoc)};pp$2.startNodeAt=function(pos,loc){return new Node(this,pos,loc)};function finishNodeAt(node,type,pos,loc){if(node.type=type,node.end=pos,this.options.locations)node.loc.end=loc;if(this.options.ranges)node.range[1]=pos;return node}pp$2.finishNode=function(node,type){return finishNodeAt.call(this,node,type,this.lastTokEnd,this.lastTokEndLoc)};pp$2.finishNodeAt=function(node,type,pos,loc){return finishNodeAt.call(this,node,type,pos,loc)};pp$2.copyNode=function(node){var newNode=new Node(this,node.start,this.startLoc);for(var prop in node)newNode[prop]=node[prop];return newNode};var RegExpValidationState=function(){};RegExpValidationState.prototype.reset=function(){};Parser.prototype.validateRegExpFlags=function(){};Parser.prototype.validateRegExpPattern=function(){};var Token=function(p){if(this.type=p.type,this.value=p.value,this.start=p.start,this.end=p.end,p.options.locations)this.loc=new SourceLocation(p,p.startLoc,p.endLoc);if(p.options.ranges)this.range=[p.start,p.end]},pp=Parser.prototype;pp.next=function(ignoreEscapeSequenceInKeyword){if(!ignoreEscapeSequenceInKeyword&&this.type.keyword&&this.containsEsc)this.raiseRecoverable(this.start,"Escape sequence in keyword "+this.type.keyword);if(this.options.onToken)this.options.onToken(new Token(this));this.lastTokEnd=this.end,this.lastTokStart=this.start,this.lastTokEndLoc=this.endLoc,this.lastTokStartLoc=this.startLoc,this.nextToken()};pp.getToken=function(){return this.next(),new Token(this)};if(typeof Symbol<"u")pp[Symbol.iterator]=function(){var this$1$1=this;return{next:function(){var token=this$1$1.getToken();return{done:token.type===types$1.eof,value:token}}}};pp.nextToken=function(){var curContext=this.curContext();if(!curContext||!curContext.preserveSpace)this.skipSpace();if(this.start=this.pos,this.options.locations)this.startLoc=this.curPosition();if(this.pos>=this.input.length)return this.finishToken(types$1.eof);if(curContext.override)return curContext.override(this);else this.readToken(this.fullCharCodeAtPos())};pp.readToken=function(code){if(isIdentifierStart(code,this.options.ecmaVersion>=6)||code===92)return this.readWord();return this.getTokenFromCode(code)};pp.fullCharCodeAt=function(pos){var code=this.input.charCodeAt(pos);if(code<=55295||code>=56320)return code;var next=this.input.charCodeAt(pos+1);return next<=56319||next>=57344?code:(code<<10)+next-56613888};pp.fullCharCodeAtPos=function(){return this.fullCharCodeAt(this.pos)};pp.skipBlockComment=function(){var startLoc=this.options.onComment&&this.curPosition(),start=this.pos,end=this.input.indexOf("*/",this.pos+=2);if(end===-1)this.raise(this.pos-2,"Unterminated comment");if(this.pos=end+2,this.options.locations)for(var nextBreak=void 0,pos=start;(nextBreak=nextLineBreak(this.input,pos,this.pos))>-1;)++this.curLine,pos=this.lineStart=nextBreak;if(this.options.onComment)this.options.onComment(!0,this.input.slice(start+2,end),start,this.pos,startLoc,this.curPosition())};pp.skipLineComment=function(startSkip){var start=this.pos,startLoc=this.options.onComment&&this.curPosition(),ch=this.input.charCodeAt(this.pos+=startSkip);while(this.pos<this.input.length&&!isNewLine(ch))ch=this.input.charCodeAt(++this.pos);if(this.options.onComment)this.options.onComment(!1,this.input.slice(start+startSkip,this.pos),start,this.pos,startLoc,this.curPosition())};pp.skipSpace=function(){loop:while(this.pos<this.input.length){var ch=this.input.charCodeAt(this.pos);switch(ch){case 32:case 160:++this.pos;break;case 13:if(this.input.charCodeAt(this.pos+1)===10)++this.pos;case 10:case 8232:case 8233:if(++this.pos,this.options.locations)++this.curLine,this.lineStart=this.pos;break;case 47:switch(this.input.charCodeAt(this.pos+1)){case 42:this.skipBlockComment();break;case 47:this.skipLineComment(2);break;default:break loop}break;default:if(ch>8&&ch<14||ch>=5760&&nonASCIIwhitespace.test(String.fromCharCode(ch)))++this.pos;else break loop}}};pp.finishToken=function(type,val){if(this.end=this.pos,this.options.locations)this.endLoc=this.curPosition();var prevType=this.type;this.type=type,this.value=val,this.updateContext(prevType)};pp.readToken_dot=function(){var next=this.input.charCodeAt(this.pos+1);if(next>=48&&next<=57)return this.readNumber(!0);var next2=this.input.charCodeAt(this.pos+2);if(this.options.ecmaVersion>=6&&next===46&&next2===46)return this.pos+=3,this.finishToken(types$1.ellipsis);else return++this.pos,this.finishToken(types$1.dot)};pp.readToken_slash=function(){var next=this.input.charCodeAt(this.pos+1);if(this.exprAllowed)return++this.pos,this.readRegexp();if(next===61)return this.finishOp(types$1.assign,2);return this.finishOp(types$1.slash,1)};pp.readToken_mult_modulo_exp=function(code){var next=this.input.charCodeAt(this.pos+1),size=1,tokentype=code===42?types$1.star:types$1.modulo;if(this.options.ecmaVersion>=7&&code===42&&next===42)++size,tokentype=types$1.starstar,next=this.input.charCodeAt(this.pos+2);if(next===61)return this.finishOp(types$1.assign,size+1);return this.finishOp(tokentype,size)};pp.readToken_pipe_amp=function(code){var next=this.input.charCodeAt(this.pos+1);if(next===code){if(this.options.ecmaVersion>=12){var next2=this.input.charCodeAt(this.pos+2);if(next2===61)return this.finishOp(types$1.assign,3)}return this.finishOp(code===124?types$1.logicalOR:types$1.logicalAND,2)}if(next===61)return this.finishOp(types$1.assign,2);return this.finishOp(code===124?types$1.bitwiseOR:types$1.bitwiseAND,1)};pp.readToken_caret=function(){var next=this.input.charCodeAt(this.pos+1);if(next===61)return this.finishOp(types$1.assign,2);return this.finishOp(types$1.bitwiseXOR,1)};pp.readToken_plus_min=function(code){var next=this.input.charCodeAt(this.pos+1);if(next===code){if(next===45&&!this.inModule&&this.input.charCodeAt(this.pos+2)===62&&(this.lastTokEnd===0||lineBreak.test(this.input.slice(this.lastTokEnd,this.pos))))return this.skipLineComment(3),this.skipSpace(),this.nextToken();return this.finishOp(types$1.incDec,2)}if(next===61)return this.finishOp(types$1.assign,2);return this.finishOp(types$1.plusMin,1)};pp.readToken_lt_gt=function(code){var next=this.input.charCodeAt(this.pos+1),size=1;if(next===code){if(size=code===62&&this.input.charCodeAt(this.pos+2)===62?3:2,this.input.charCodeAt(this.pos+size)===61)return this.finishOp(types$1.assign,size+1);return this.finishOp(types$1.bitShift,size)}if(next===33&&code===60&&!this.inModule&&this.input.charCodeAt(this.pos+2)===45&&this.input.charCodeAt(this.pos+3)===45)return this.skipLineComment(4),this.skipSpace(),this.nextToken();if(next===61)size=2;return this.finishOp(types$1.relational,size)};pp.readToken_eq_excl=function(code){var next=this.input.charCodeAt(this.pos+1);if(next===61)return this.finishOp(types$1.equality,this.input.charCodeAt(this.pos+2)===61?3:2);if(code===61&&next===62&&this.options.ecmaVersion>=6)return this.pos+=2,this.finishToken(types$1.arrow);return this.finishOp(code===61?types$1.eq:types$1.prefix,1)};pp.readToken_question=function(){var ecmaVersion=this.options.ecmaVersion;if(ecmaVersion>=11){var next=this.input.charCodeAt(this.pos+1);if(next===46){var next2=this.input.charCodeAt(this.pos+2);if(next2<48||next2>57)return this.finishOp(types$1.questionDot,2)}if(next===63){if(ecmaVersion>=12){var next2$1=this.input.charCodeAt(this.pos+2);if(next2$1===61)return this.finishOp(types$1.assign,3)}return this.finishOp(types$1.coalesce,2)}}return this.finishOp(types$1.question,1)};pp.readToken_numberSign=function(){var ecmaVersion=this.options.ecmaVersion,code=35;if(ecmaVersion>=13){if(++this.pos,code=this.fullCharCodeAtPos(),isIdentifierStart(code,!0)||code===92)return this.finishToken(types$1.privateId,this.readWord1())}this.raise(this.pos,"Unexpected character '"+codePointToString(code)+"'")};pp.getTokenFromCode=function(code){switch(code){case 46:return this.readToken_dot();case 40:return++this.pos,this.finishToken(types$1.parenL);case 41:return++this.pos,this.finishToken(types$1.parenR);case 59:return++this.pos,this.finishToken(types$1.semi);case 44:return++this.pos,this.finishToken(types$1.comma);case 91:return++this.pos,this.finishToken(types$1.bracketL);case 93:return++this.pos,this.finishToken(types$1.bracketR);case 123:return++this.pos,this.finishToken(types$1.braceL);case 125:return++this.pos,this.finishToken(types$1.braceR);case 58:return++this.pos,this.finishToken(types$1.colon);case 96:if(this.options.ecmaVersion<6)break;return++this.pos,this.finishToken(types$1.backQuote);case 48:var next=this.input.charCodeAt(this.pos+1);if(next===120||next===88)return this.readRadixNumber(16);if(this.options.ecmaVersion>=6){if(next===111||next===79)return this.readRadixNumber(8);if(next===98||next===66)return this.readRadixNumber(2)}case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return this.readNumber(!1);case 34:case 39:return this.readString(code);case 47:return this.readToken_slash();case 37:case 42:return this.readToken_mult_modulo_exp(code);case 124:case 38:return this.readToken_pipe_amp(code);case 94:return this.readToken_caret();case 43:case 45:return this.readToken_plus_min(code);case 60:case 62:return this.readToken_lt_gt(code);case 61:case 33:return this.readToken_eq_excl(code);case 63:return this.readToken_question();case 126:return this.finishOp(types$1.prefix,1);case 35:return this.readToken_numberSign()}this.raise(this.pos,"Unexpected character '"+codePointToString(code)+"'")};pp.finishOp=function(type,size){var str=this.input.slice(this.pos,this.pos+size);return this.pos+=size,this.finishToken(type,str)};pp.readRegexp=function(){var escaped,inClass,start=this.pos;for(;;){if(this.pos>=this.input.length)this.raise(start,"Unterminated regular expression");var ch=this.input.charAt(this.pos);if(lineBreak.test(ch))this.raise(start,"Unterminated regular expression");if(!escaped){if(ch==="[")inClass=!0;else if(ch==="]"&&inClass)inClass=!1;else if(ch==="/"&&!inClass)break;escaped=ch==="\\"}else escaped=!1;++this.pos}var pattern=this.input.slice(start,this.pos);++this.pos;var flagsStart=this.pos,flags=this.readWord1();if(this.containsEsc)this.unexpected(flagsStart);var state=this.regexpState||(this.regexpState=new RegExpValidationState(this));state.reset(start,pattern,flags),this.validateRegExpFlags(state),this.validateRegExpPattern(state);var value=null;try{value=new RegExp(pattern,flags)}catch(e){}return this.finishToken(types$1.regexp,{pattern,flags,value})};pp.readInt=function(radix,len,maybeLegacyOctalNumericLiteral){var allowSeparators=this.options.ecmaVersion>=12&&len===void 0,isLegacyOctalNumericLiteral=maybeLegacyOctalNumericLiteral&&this.input.charCodeAt(this.pos)===48,start=this.pos,total=0,lastCode=0;for(var i=0,e=len==null?1/0:len;i<e;++i,++this.pos){var code=this.input.charCodeAt(this.pos),val=void 0;if(allowSeparators&&code===95){if(isLegacyOctalNumericLiteral)this.raiseRecoverable(this.pos,"Numeric separator is not allowed in legacy octal numeric literals");if(lastCode===95)this.raiseRecoverable(this.pos,"Numeric separator must be exactly one underscore");if(i===0)this.raiseRecoverable(this.pos,"Numeric separator is not allowed at the first of digits");lastCode=code;continue}if(code>=97)val=code-97+10;else if(code>=65)val=code-65+10;else if(code>=48&&code<=57)val=code-48;else val=1/0;if(val>=radix)break;lastCode=code,total=total*radix+val}if(allowSeparators&&lastCode===95)this.raiseRecoverable(this.pos-1,"Numeric separator is not allowed at the last of digits");if(this.pos===start||len!=null&&this.pos-start!==len)return null;return total};function stringToNumber(str,isLegacyOctalNumericLiteral){if(isLegacyOctalNumericLiteral)return parseInt(str,8);return parseFloat(str.replace(/_/g,""))}function stringToBigInt(str){if(typeof BigInt!=="function")return null;return BigInt(str.replace(/_/g,""))}pp.readRadixNumber=function(radix){var start=this.pos;this.pos+=2;var val=this.readInt(radix);if(val==null)this.raise(this.start+2,"Expected number in radix "+radix);if(this.options.ecmaVersion>=11&&this.input.charCodeAt(this.pos)===110)val=stringToBigInt(this.input.slice(start,this.pos)),++this.pos;else if(isIdentifierStart(this.fullCharCodeAtPos()))this.raise(this.pos,"Identifier directly after number");return this.finishToken(types$1.num,val)};pp.readNumber=function(startsWithDot){var start=this.pos;if(!startsWithDot&&this.readInt(10,void 0,!0)===null)this.raise(start,"Invalid number");var octal=this.pos-start>=2&&this.input.charCodeAt(start)===48;if(octal&&this.strict)this.raise(start,"Invalid number");var next=this.input.charCodeAt(this.pos);if(!octal&&!startsWithDot&&this.options.ecmaVersion>=11&&next===110){var val$1=stringToBigInt(this.input.slice(start,this.pos));if(++this.pos,isIdentifierStart(this.fullCharCodeAtPos()))this.raise(this.pos,"Identifier directly after number");return this.finishToken(types$1.num,val$1)}if(octal&&/[89]/.test(this.input.slice(start,this.pos)))octal=!1;if(next===46&&!octal)++this.pos,this.readInt(10),next=this.input.charCodeAt(this.pos);if((next===69||next===101)&&!octal){if(next=this.input.charCodeAt(++this.pos),next===43||next===45)++this.pos;if(this.readInt(10)===null)this.raise(start,"Invalid number")}if(isIdentifierStart(this.fullCharCodeAtPos()))this.raise(this.pos,"Identifier directly after number");var val=stringToNumber(this.input.slice(start,this.pos),octal);return this.finishToken(types$1.num,val)};pp.readCodePoint=function(){var ch=this.input.charCodeAt(this.pos),code;if(ch===123){if(this.options.ecmaVersion<6)this.unexpected();var codePos=++this.pos;if(code=this.readHexChar(this.input.indexOf("}",this.pos)-this.pos),++this.pos,code>1114111)this.invalidStringToken(codePos,"Code point out of bounds")}else code=this.readHexChar(4);return code};pp.readString=function(quote){var out="",chunkStart=++this.pos;for(;;){if(this.pos>=this.input.length)this.raise(this.start,"Unterminated string constant");var ch=this.input.charCodeAt(this.pos);if(ch===quote)break;if(ch===92)out+=this.input.slice(chunkStart,this.pos),out+=this.readEscapedChar(!1),chunkStart=this.pos;else if(ch===8232||ch===8233){if(this.options.ecmaVersion<10)this.raise(this.start,"Unterminated string constant");if(++this.pos,this.options.locations)this.curLine++,this.lineStart=this.pos}else{if(isNewLine(ch))this.raise(this.start,"Unterminated string constant");++this.pos}}return out+=this.input.slice(chunkStart,this.pos++),this.finishToken(types$1.string,out)};var INVALID_TEMPLATE_ESCAPE_ERROR={};pp.tryReadTemplateToken=function(){this.inTemplateElement=!0;try{this.readTmplToken()}catch(err){if(err===INVALID_TEMPLATE_ESCAPE_ERROR)this.readInvalidTemplateToken();else throw err}this.inTemplateElement=!1};pp.invalidStringToken=function(position,message){if(this.inTemplateElement&&this.options.ecmaVersion>=9)throw INVALID_TEMPLATE_ESCAPE_ERROR;else this.raise(position,message)};pp.readTmplToken=function(){var out="",chunkStart=this.pos;for(;;){if(this.pos>=this.input.length)this.raise(this.start,"Unterminated template");var ch=this.input.charCodeAt(this.pos);if(ch===96||ch===36&&this.input.charCodeAt(this.pos+1)===123){if(this.pos===this.start&&(this.type===types$1.template||this.type===types$1.invalidTemplate))if(ch===36)return this.pos+=2,this.finishToken(types$1.dollarBraceL);else return++this.pos,this.finishToken(types$1.backQuote);return out+=this.input.slice(chunkStart,this.pos),this.finishToken(types$1.template,out)}if(ch===92)out+=this.input.slice(chunkStart,this.pos),out+=this.readEscapedChar(!0),chunkStart=this.pos;else if(isNewLine(ch)){switch(out+=this.input.slice(chunkStart,this.pos),++this.pos,ch){case 13:if(this.input.charCodeAt(this.pos)===10)++this.pos;case 10:out+=`
|
|
7
|
+
`;break;default:out+=String.fromCharCode(ch);break}if(this.options.locations)++this.curLine,this.lineStart=this.pos;chunkStart=this.pos}else++this.pos}};pp.readInvalidTemplateToken=function(){for(;this.pos<this.input.length;this.pos++)switch(this.input[this.pos]){case"\\":++this.pos;break;case"$":if(this.input[this.pos+1]!=="{")break;case"`":return this.finishToken(types$1.invalidTemplate,this.input.slice(this.start,this.pos));case"\r":if(this.input[this.pos+1]===`
|
|
8
|
+
`)++this.pos;case`
|
|
9
|
+
`:case"\u2028":case"\u2029":++this.curLine,this.lineStart=this.pos+1;break}this.raise(this.start,"Unterminated template")};pp.readEscapedChar=function(inTemplate){var ch=this.input.charCodeAt(++this.pos);switch(++this.pos,ch){case 110:return`
|
|
10
|
+
`;case 114:return"\r";case 120:return String.fromCharCode(this.readHexChar(2));case 117:return codePointToString(this.readCodePoint());case 116:return"\t";case 98:return"\b";case 118:return"\v";case 102:return"\f";case 13:if(this.input.charCodeAt(this.pos)===10)++this.pos;case 10:if(this.options.locations)this.lineStart=this.pos,++this.curLine;return"";case 56:case 57:if(this.strict)this.invalidStringToken(this.pos-1,"Invalid escape sequence");if(inTemplate){var codePos=this.pos-1;this.invalidStringToken(codePos,"Invalid escape sequence in template string")}default:if(ch>=48&&ch<=55){var octalStr=this.input.substr(this.pos-1,3).match(/^[0-7]+/)[0],octal=parseInt(octalStr,8);if(octal>255)octalStr=octalStr.slice(0,-1),octal=parseInt(octalStr,8);if(this.pos+=octalStr.length-1,ch=this.input.charCodeAt(this.pos),(octalStr!=="0"||ch===56||ch===57)&&(this.strict||inTemplate))this.invalidStringToken(this.pos-1-octalStr.length,inTemplate?"Octal literal in template string":"Octal literal in strict mode");return String.fromCharCode(octal)}if(isNewLine(ch)){if(this.options.locations)this.lineStart=this.pos,++this.curLine;return""}return String.fromCharCode(ch)}};pp.readHexChar=function(len){var codePos=this.pos,n=this.readInt(16,len);if(n===null)this.invalidStringToken(codePos,"Bad character escape sequence");return n};pp.readWord1=function(){this.containsEsc=!1;var word="",first=!0,chunkStart=this.pos,astral=this.options.ecmaVersion>=6;while(this.pos<this.input.length){var ch=this.fullCharCodeAtPos();if(isIdentifierChar(ch,astral))this.pos+=ch<=65535?1:2;else if(ch===92){this.containsEsc=!0,word+=this.input.slice(chunkStart,this.pos);var escStart=this.pos;if(this.input.charCodeAt(++this.pos)!==117)this.invalidStringToken(this.pos,"Expecting Unicode escape sequence \\uXXXX");++this.pos;var esc=this.readCodePoint();if(!(first?isIdentifierStart:isIdentifierChar)(esc,astral))this.invalidStringToken(escStart,"Invalid Unicode escape");word+=codePointToString(esc),chunkStart=this.pos}else break;first=!1}return word+this.input.slice(chunkStart,this.pos)};pp.readWord=function(){var word=this.readWord1(),type=types$1.name;if(this.keywords.test(word))type=keywords[word];return this.finishToken(type,word)};var version="8.18.0";Parser.acorn={Parser,version,defaultOptions,Position,SourceLocation,getLineInfo,Node,TokenType,tokTypes:types$1,keywordTypes:keywords,TokContext,tokContexts:types,isIdentifierChar,isIdentifierStart,Token,isNewLine,lineBreak,lineBreakG,nonASCIIwhitespace};function definePlugin(plugin){return(BaseParser)=>plugin(BaseParser)}function extendParser(...plugins){return Parser.extend(...plugins)}function hasLineBreak(input,from,to){for(let i=from;i<to;i++){let code=input.charCodeAt(i);if(code===10||code===13||code===8232||code===8233)return!0}return!1}var sets=new WeakMap;function hasName(names,name){if(names===void 0)return!1;if(names.length<16)return names.includes(name);let entry=sets.get(names);if(entry===void 0||entry.length>names.length)entry={names:new Set,length:0},sets.set(names,entry);while(entry.length<names.length)entry.names.add(names[entry.length++]);return entry.names.has(name)}function missingTypeScript(){throw Error('sveast: parsing TypeScript needs `typescript` from "sveast/typescript": createParser({ typescript }) or createModuleParser({ typescript })')}var REGEX_LEADING_TABS=/^\t+/;class ParseError2 extends Error{name="ParseError";code;reason;position;start;end;frame;constructor(node,code,reason){super(`${reason}
|
|
11
|
+
https://svelte.dev/e/${code}`);this.code=code,this.reason=reason;let start=typeof node==="number"?node:node?.start,end=typeof node==="number"?node:node?.end;if(start!==void 0)this.position=[start,end??start],this.start=locate3(this.position[0]),this.end=locate3(this.position[1]),this.frame=codeFrame(this.start.line-1,this.end.column)}}var tabsToSpaces=(text)=>text.replace(REGEX_LEADING_TABS,(match)=>" ".repeat(match.length));function codeFrame(line,column){let frameStart=Math.max(0,line-2),lines=[];for(let i=frameStart;i<line+3;i++){let text=lineText(i);if(text===void 0)break;lines.push(text)}let digits=String(frameStart+lines.length+1).length;return lines.map((text,i)=>{let numbered=`${String(frameStart+i+1).padStart(digits," ")}: ${tabsToSpaces(text)}`;if(frameStart+i!==line)return numbered;return`${numbered}
|
|
12
|
+
${" ".repeat(digits+2+tabsToSpaces(text.slice(0,column)).length)}^`}).join(`
|
|
13
|
+
`)}function attribute_duplicate(node){throw new ParseError2(node,"attribute_duplicate","Attributes need to be unique")}function attribute_empty_shorthand(node){throw new ParseError2(node,"attribute_empty_shorthand","Attribute shorthand cannot be empty")}function block_duplicate_clause(node,name){throw new ParseError2(node,"block_duplicate_clause",`${name} cannot appear more than once within a block`)}function block_invalid_continuation_placement(node){throw new ParseError2(node,"block_invalid_continuation_placement","{:...} block is invalid at this position (did you forget to close the preceding element or block?)")}function block_invalid_elseif(node){throw new ParseError2(node,"block_invalid_elseif","'elseif' should be 'else if'")}function block_invalid_placement(node,name,location){throw new ParseError2(node,"block_invalid_placement",`{#${name} ...} block cannot be ${location}`)}function block_unclosed(node){throw new ParseError2(node,"block_unclosed","Block was left open")}function block_unexpected_close(node){throw new ParseError2(node,"block_unexpected_close","Unexpected block closing tag")}function const_tag_invalid_expression(node){throw new ParseError2(node,"const_tag_invalid_expression","{@const ...} must consist of a single variable declaration")}function css_empty_declaration(node){throw new ParseError2(node,"css_empty_declaration","Declaration cannot be empty")}function css_expected_identifier(node){throw new ParseError2(node,"css_expected_identifier","Expected a valid CSS identifier")}function css_selector_invalid(node){throw new ParseError2(node,"css_selector_invalid","Invalid selector")}function debug_tag_invalid_arguments(node){throw new ParseError2(node,"debug_tag_invalid_arguments","{@debug ...} arguments must be identifiers, not arbitrary expressions")}function declaration_tag_invalid_type(node){throw new ParseError2(node,"declaration_tag_invalid_type","Declaration tags must be `let` or `const` declarations")}function directive_invalid_value(node){throw new ParseError2(node,"directive_invalid_value","Directive value must be a JavaScript expression enclosed in curly braces")}function directive_missing_name(node,type){throw new ParseError2(node,"directive_missing_name",`\`${type}\` name cannot be empty`)}function element_invalid_closing_tag(node,name){throw new ParseError2(node,"element_invalid_closing_tag",`\`</${name}>\` attempted to close an element that was not open`)}function element_invalid_closing_tag_autoclosed(node,name,reason){throw new ParseError2(node,"element_invalid_closing_tag_autoclosed",`\`</${name}>\` attempted to close element that was already automatically closed by \`<${reason}>\` (cannot nest \`<${reason}>\` inside \`<${name}>\`)`)}function element_unclosed(node,name){throw new ParseError2(node,"element_unclosed",`\`<${name}>\` was left open`)}function expected_attribute_value(node){throw new ParseError2(node,"expected_attribute_value","Expected attribute value")}function expected_block_type(node){throw new ParseError2(node,"expected_block_type","Expected 'if', 'each', 'await', 'key' or 'snippet'")}function expected_identifier(node){throw new ParseError2(node,"expected_identifier","Expected an identifier")}function expected_pattern(node){throw new ParseError2(node,"expected_pattern","Expected identifier or destructure pattern")}function expected_tag(node){throw new ParseError2(node,"expected_tag","Expected 'html', 'render', 'attach', 'const', or 'debug'")}function expected_token(node,token){throw new ParseError2(node,"expected_token",`Expected token ${token}`)}function expected_whitespace(node){throw new ParseError2(node,"expected_whitespace","Expected whitespace")}function js_parse_error(node,message){throw new ParseError2(node,"js_parse_error",`${message}`)}function render_tag_invalid_expression(node){throw new ParseError2(node,"render_tag_invalid_expression","`{@render ...}` tags can only contain call expressions")}function script_duplicate(node){throw new ParseError2(node,"script_duplicate","A component can have a single top-level `<script>` element and/or a single top-level `<script module>` element")}function script_invalid_attribute_value(node,name){throw new ParseError2(node,"script_invalid_attribute_value",`If the \`${name}\` attribute is supplied, it must be a boolean attribute`)}function script_invalid_context(node){throw new ParseError2(node,"script_invalid_context",'If the context attribute is supplied, its value must be "module"')}function script_reserved_attribute(node,name){throw new ParseError2(node,"script_reserved_attribute",`The \`${name}\` attribute is reserved and cannot be used`)}function style_duplicate(node){throw new ParseError2(node,"style_duplicate","A component can have a single top-level `<style>` element")}function svelte_component_invalid_this(node){throw new ParseError2(node,"svelte_component_invalid_this","Invalid component definition — must be an `{expression}`")}function svelte_component_missing_this(node){throw new ParseError2(node,"svelte_component_missing_this","`<svelte:component>` must have a 'this' attribute")}function svelte_element_missing_this(node){throw new ParseError2(node,"svelte_element_missing_this","`<svelte:element>` must have a 'this' attribute with a value")}function svelte_meta_duplicate(node,name){throw new ParseError2(node,"svelte_meta_duplicate",`A component can only have one \`<${name}>\` element`)}function svelte_meta_invalid_content(node,name){throw new ParseError2(node,"svelte_meta_invalid_content",`<${name}> cannot have children`)}function svelte_meta_invalid_placement(node,name){throw new ParseError2(node,"svelte_meta_invalid_placement",`\`<${name}>\` tags cannot be inside elements or blocks`)}function svelte_meta_invalid_tag(node,list){throw new ParseError2(node,"svelte_meta_invalid_tag",`Valid \`<svelte:...>\` tag names are ${list}`)}function svelte_options_deprecated_tag(node){throw new ParseError2(node,"svelte_options_deprecated_tag",'"tag" option is deprecated — use "customElement" instead')}function svelte_options_invalid_attribute(node){throw new ParseError2(node,"svelte_options_invalid_attribute","`<svelte:options>` can only receive static attributes")}function svelte_options_invalid_attribute_value(node,list){throw new ParseError2(node,"svelte_options_invalid_attribute_value",`Value must be ${list}, if specified`)}function svelte_options_invalid_customelement(node){throw new ParseError2(node,"svelte_options_invalid_customelement",'"customElement" must be a string literal defining a valid custom element name or an object of the form { tag?: string; shadow?: "open" | "none" | `ShadowRootInit`; props?: { [key: string]: { attribute?: string; reflect?: boolean; type: .. } } }')}function svelte_options_invalid_customelement_props(node){throw new ParseError2(node,"svelte_options_invalid_customelement_props",'"props" must be a statically analyzable object literal of the form "{ [key: string]: { attribute?: string; reflect?: boolean; type?: "String" | "Boolean" | "Number" | "Array" | "Object" }"')}function svelte_options_invalid_customelement_shadow(node){throw new ParseError2(node,"svelte_options_invalid_customelement_shadow",'"shadow" must be either "open", "none" or `ShadowRootInit` object.')}function svelte_options_invalid_tagname(node){throw new ParseError2(node,"svelte_options_invalid_tagname","Tag name must be lowercase and hyphenated")}function svelte_options_reserved_tagname(node){throw new ParseError2(node,"svelte_options_reserved_tagname","Tag name is reserved")}function svelte_options_unknown_attribute(node,name){throw new ParseError2(node,"svelte_options_unknown_attribute",`\`<svelte:options>\` unknown attribute '${name}'`)}function tag_invalid_name(node){throw new ParseError2(node,"tag_invalid_name","Expected a valid element or component name. Components must have a valid variable name or dot notation expression")}function tag_invalid_placement(node,name,location){throw new ParseError2(node,"tag_invalid_placement",`{@${name} ...} tag cannot be ${location}`)}function unexpected_eof(node){throw new ParseError2(node,"unexpected_eof","Unexpected end of input")}function unexpected_reserved_word(node,word){throw new ParseError2(node,"unexpected_reserved_word",`'${word}' is a reserved word in JavaScript and cannot be used here`)}function unterminated_string_constant(node){throw new ParseError2(node,"unterminated_string_constant","Unterminated string constant")}function void_element_invalid_content(node){throw new ParseError2(node,"void_element_invalid_content","Void elements cannot have children or closing tags")}var commentSource="",commentSink=[],commentEnd=0,queue=[],next=0;function bindOnComment(source,comments){commentSource=source,commentSink=comments,commentEnd=0}function lastCommentEnd(){return commentEnd}function skipComment(_block,_value,_start,end){commentEnd=end}function onComment(block,rawValue,start,end,startLoc,endLoc){commentEnd=end;let value=rawValue;if(block&&value.includes(`
|
|
14
|
+
`)){let lineStart=commentSource.lastIndexOf(`
|
|
15
|
+
`,start-1)+1,indentEnd=lineStart,code=commentSource.charCodeAt(indentEnd);while(code===32||code===9)code=commentSource.charCodeAt(++indentEnd);if(indentEnd>lineStart)value=stripLeadingIndentation(value,commentSource.slice(lineStart,indentEnd))}let comment={type:block?"Block":"Line",value,start,end};if(startLoc&&endLoc)comment.loc={start:startLoc,end:endLoc};commentSink.push(comment)}function stripLeadingIndentation(value,indentation){let from=value.startsWith(indentation)?indentation.length:0,result="",newline=value.indexOf(`
|
|
16
|
+
`,from);while(newline!==-1){if(result+=value.slice(from,newline+1),from=newline+1,value.startsWith(indentation,from))from+=indentation.length;newline=value.indexOf(`
|
|
17
|
+
`,from)}return result+value.slice(from)}function attachComments(ast,comments,fromIndex){let low=0,high=comments.length;while(low<high){let mid=low+high>>>1;if(comments[mid].start<fromIndex)low=mid+1;else high=mid}if(low>=comments.length)return;if(queue=comments.slice(low).map(({type,value,start,end})=>({type,value,start,end})),next=0,visit(ast,void 0,!1),next<queue.length&&(queue[next].start>=ast.end||ast.type==="Program")){ast.trailingComments??=[];while(next<queue.length)ast.trailingComments.push(queue[next++])}}var LIST_KEYS=new Map([["BlockStatement","body"],["Program","body"],["ArrayExpression","elements"],["ObjectExpression","properties"]]);function gapBlocked(from,to){for(let i=from;i<to;i++){let code=commentSource.charCodeAt(i);if(code!==44&&code!==41&&code!==32&&code!==9)return!0}return!1}function visit(node,parent,lastInBody){while(next<queue.length&&queue[next].start<node.start)node.leadingComments??=[],node.leadingComments.push(queue[next++]);if(next>=queue.length)return;let upcoming=queue[next].start;if(upcoming<node.end||!gapBlocked(node.end,upcoming)){let fields=fieldsOf(node),listKey=LIST_KEYS.get(node.type),list=listKey===void 0?void 0:fields[listKey],listEmpty=Array.isArray(list)&&list.length===0;for(let key in fields){if(next>=queue.length)return;if(key==="type")continue;let value=fields[key];if(Array.isArray(value)){let inList=key===listKey;for(let i=0;i<value.length;i++){let child=value[i];if(isNode(child))visit(child,node,inList?i===value.length-1:listEmpty)}}else if(isNode(value))visit(value,node,listEmpty)}if(next>=queue.length)return}if(parent!==void 0&&node.end===parent.end)return;if(lastInBody)while(next<queue.length){if(parent&&queue[next].start>=parent.end)break;node.trailingComments??=[],node.trailingComments.push(queue[next++])}else if(node.end<=queue[next].start&&!gapBlocked(node.end,queue[next].start))node.trailingComments=[queue[next++]]}var RESERVED_WORDS=new Set("arguments await break case catch class const continue debugger default delete do else enum eval export extends false finally for function if implements import in instanceof interface let new null package private protected public return static super switch this throw true try typeof var void while with yield".split(" ")),sawParenthesized=!1,SCOPE_TOP2=1,SCOPE_FUNCTION2=2,SCOPE_SIMPLE_CATCH2=32,SCOPE_CLASS_STATIC_BLOCK2=256,SCOPE_VAR2=SCOPE_TOP2|SCOPE_FUNCTION2|SCOPE_CLASS_STATIC_BLOCK2,BIND_LEXICAL2=2,BIND_FUNCTION2=3,BIND_SIMPLE_CATCH2=4,LINE_BREAK=/\r\n?|\n|\u2028|\u2029/,WORD_TESTERS=new Map;function wordTester(words){if(!(words instanceof RegExp))return words;let tester=WORD_TESTERS.get(words);if(!tester){let set=new Set(words.source.slice(4,-2).split("|"));tester={test:(word)=>set.has(word)},WORD_TESTERS.set(words,tester)}return tester}var declarations=definePlugin((Base)=>class extends Base{declareName(name,bindingType,pos){let redeclared=!1;if(bindingType===BIND_LEXICAL2){let scope=this.currentScope();if(redeclared=hasName(scope.lexical,name)||hasName(scope.functions,name)||hasName(scope.var,name),scope.lexical.push(name),this.inModule&&scope.flags&SCOPE_TOP2)delete this.undefinedExports[name]}else if(bindingType===BIND_SIMPLE_CATCH2)this.currentScope().lexical.push(name);else if(bindingType===BIND_FUNCTION2){let scope=this.currentScope();redeclared=this.treatFunctionsAsVar?hasName(scope.lexical,name):hasName(scope.lexical,name)||hasName(scope.var,name),scope.functions.push(name)}else for(let i=this.scopeStack.length-1;i>=0;--i){let scope=this.scopeStack[i];if(hasName(scope.lexical,name)&&!(scope.flags&SCOPE_SIMPLE_CATCH2&&scope.lexical[0]===name)||!this.treatFunctionsAsVarInScope(scope)&&hasName(scope.functions,name)){redeclared=!0;break}if(scope.var.push(name),this.inModule&&scope.flags&SCOPE_TOP2)delete this.undefinedExports[name];if(scope.flags&SCOPE_VAR2)break}if(redeclared)this.raiseRecoverable(pos,`Identifier '${name}' has already been declared`)}}),tweaks=definePlugin((Base)=>{let{keywordTypes,tokTypes}=Base.acorn,keywordTokens=new Map("break case catch continue debugger default do else finally for function if return switch throw try var while with null true false instanceof typeof void delete new in this const class extends export import super".split(" ").map((word)=>[word,keywordTypes[word]])),initialContext;return class extends Base{constructor(options,input,startPos){super(options,input,startPos);this.keywords=wordTester(this.keywords),this.reservedWords=wordTester(this.reservedWords),this.reservedWordsStrict=wordTester(this.reservedWordsStrict),this.reservedWordsStrictBind=wordTester(this.reservedWordsStrictBind),initialContext??=this.context[0]}reset(input,pos,startLocation){if(super.reset?.(input,pos,startLocation),this.input=input,this.containsEsc=!1,this.pos=pos,startLocation)this.lineStart=pos-startLocation.column,this.curLine=startLocation.line;else this.lineStart=input.lastIndexOf(`
|
|
18
|
+
`,pos-1)+1,this.curLine=this.options.locations?input.slice(0,this.lineStart).split(LINE_BREAK).length:1;this.type=tokTypes.eof,this.value=null,this.start=this.end=pos,this.startLoc=this.endLoc=this.curPosition(),this.lastTokEndLoc=this.lastTokStartLoc=null,this.lastTokStart=this.lastTokEnd=pos;let context=this.context;if(context.length!==1||context[0]!==initialContext)this.context=this.initialContext();if(this.exprAllowed=!0,this.strict=!0,this.potentialArrowAt=-1,this.potentialArrowInForAwait=!1,this.yieldPos=this.awaitPos=this.awaitIdentPos=0,this.labels.length>0)this.labels=[];for(let _ in this.undefinedExports){this.undefinedExports=Object.create(null);break}let scopes=this.scopeStack,top=scopes[0];if(scopes.length!==1||top.flags!==SCOPE_TOP2||top.var.length>0||top.lexical.length>0||top.functions.length>0||top.tsTypes!==void 0||top.tsExportOnly!==void 0||top.tsEnums!==void 0)this.scopeStack=[],this.enterScope(SCOPE_TOP2);if(this.regexpState=null,this.privateNameStack.length>0)this.privateNameStack=[];this.inTemplateElement=!1}parseParenAndDistinguishExpression(canBeArrow,forInit){let node=super.parseParenAndDistinguishExpression(canBeArrow,forInit);if(node.type==="ParenthesizedExpression")sawParenthesized=!0;return node}checkUnreserved(ref){if(RESERVED_WORDS.has(ref.name))super.checkUnreserved(ref)}canInsertSemicolon(){let type=this.type;return type===tokTypes.eof||type===tokTypes.braceR||hasLineBreak(this.input,this.lastTokEnd,this.start)}checkLocalExport(){}skipSpace(){let input=this.input,locations=this.options.locations,pos=this.pos,code=input.charCodeAt(pos);for(;;)if(code===32||code===9)code=input.charCodeAt(++pos);else if(code===10){if(code=input.charCodeAt(++pos),locations)this.curLine++,this.lineStart=pos}else break;if(this.pos=pos,code===47||code<33||code>=128)super.skipSpace()}readWord1(){let input=this.input,start=this.pos,end=start,code=input.charCodeAt(end),hash=0;while(code>=97&&code<=122||code>=65&&code<=90||code>=48&&code<=57||code===95||code===36)hash=Math.imul(hash,31)+code|0,code=input.charCodeAt(++end);if(code>=128||code===92)return super.readWord1();return this.containsEsc=!1,this.pos=end,internName(input,start,end,hash)}readWord(){let word=this.readWord1();return this.finishToken(keywordTokens.get(word)??tokTypes.name,word)}}}),JSParser=extendParser(declarations,tweaks),REGEX_POSITION_SUFFIX=/ \(\d+:\d+\)$/;function estree(node){return node}function isSyntaxErrorAt(error){return error instanceof SyntaxError&&"pos"in error&&typeof error.pos==="number"}function run(context,source,start,preserveParens,parse,commentsBefore=context.root.comments.length){let comments=context.root.comments;bindOnComment(source,comments);let options={onComment:context.comments?onComment:skipComment,sourceType:"module",ecmaVersion:16,locations:context.loc,preserveParens};if(context.lfOnly)options.startLocation=locate3(start);let ParserClass=context.isTypeScript?context.typescript:JSParser;if(!ParserClass)missingTypeScript();let node;try{node=parse(ParserClass,options)}catch(error){if(!isSyntaxErrorAt(error))throw error;js_parse_error(error.pos,error.message.replace(REGEX_POSITION_SUFFIX,""))}if(comments.length>commentsBefore)attachComments(estree(node),comments,start);return node}function parseProgram(context,source,start=0){return estree(run(context,source,0,!1,(ParserClass,options)=>{if(start>0&&options.locations)options.startLocation=locate3(start);let program=new ParserClass(options,source,start).parse();return program.start=0,program},0))}function acornLocation(index,locations){if(!locations)return{line:1,column:0};let{column}=locate3(index);return{line:lineBreaksBefore(index-column)+1,column}}var acornExpressionParses={count:0},spare,readExpression=(parser)=>parser.parseExpression();function parseWithSpare(ParserClass,options,source,index,read){let entry=spare;if(spare=void 0,entry?.ParserClass===ParserClass&&entry.onComment===options.onComment&&entry.locations===options.locations&&entry.parser.reset)entry.parser.reset(source,index,options.startLocation);else entry={ParserClass,onComment:options.onComment,locations:options.locations,parser:new ParserClass(options,source,index)};let parser=entry.parser;parser.nextToken();let node=read(parser);return parser.input="",spare=entry,node}function parseMarkupAt(context,source,index,read){return acornExpressionParses.count+=1,sawParenthesized=!1,run(context,source,index,!0,(ParserClass,options)=>(options.startLocation??=acornLocation(index,options.locations),parseWithSpare(ParserClass,options,source,index,read)))}function parseExpressionAt(context,source,index,keepParens=!1){let node=estree(parseMarkupAt(context,source,index,readExpression)),end=Math.max(node.end,lastCommentEnd());return{node:sawParenthesized&&!keepParens?removeParens(node):node,end}}function parsePatternAt(context,source,index){let comments=context.root.comments.length,complete=!0,node=parseMarkupAt(context,source,index,(parser)=>{let refDestructuringErrors={shorthandAssign:-1,trailingComma:-1,parenthesizedAssign:-1,parenthesizedBind:-1,doubleProto:-1},left=parser.parseMaybeConditional(void 0,refDestructuringErrors);if(parser.type!==JSParser.acorn.tokTypes.eof)return complete=!1,left;let pattern=parser.toAssignable(left,!1,refDestructuringErrors);return parser.checkLValPattern(pattern),pattern});if(!complete){context.root.comments.length=comments;return}let pattern=estree(node);return sawParenthesized?removeParens(pattern):pattern}function parseStatementAt(context,source,index){return estree(run(context,source,index,!1,(ParserClass,options)=>{let parser=new ParserClass(options,source,index);try{return parser.nextToken(),parser.parseStatement(null,!0,Object.create(null))}catch(error){if(isSyntaxErrorAt(error)&&error.pos===source.length)unexpected_eof(source.length);throw error}}))}function removeParens(node){let inner=node;while(inner.type==="ParenthesizedExpression")inner=inner.expression;return mapChildren(inner,removeParens),inner}var SKIP_WHITESPACE=/(?:\s|\/\/.*|\/\*[\s\S]*?\*\/)*/g,KEYWORD_TYPES=new Map([["any","TSAnyKeyword"],["bigint","TSBigIntKeyword"],["boolean","TSBooleanKeyword"],["never","TSNeverKeyword"],["null","TSNullKeyword"],["number","TSNumberKeyword"],["object","TSObjectKeyword"],["string","TSStringKeyword"],["symbol","TSSymbolKeyword"],["undefined","TSUndefinedKeyword"],["unknown","TSUnknownKeyword"],["void","TSVoidKeyword"]]),CLASS_MODIFIERS=new Set("public private protected readonly declare abstract override static accessor".split(" ")),PARAMETER_MODIFIERS=new Set("public private protected readonly override".split(" ")),DECLARE_TARGETS=new Set("var let const function class abstract enum interface type namespace module global".split(" ")),DECLARE_FIRST=new Set("var let const function class interface enum".split(" ")),TS_EXPRESSION_WRAPPERS=new Set(["TSAsExpression","TSSatisfiesExpression","TSNonNullExpression","TSTypeAssertion"]),SCOPE_TOP3=1,SCOPE_SIMPLE_CATCH3=32,SCOPE_CLASS_STATIC_BLOCK3=256,BIND_NONE2=0,BIND_VAR2=1,BIND_LEXICAL3=2,BIND_FUNCTION3=3,BIND_SIMPLE_CATCH3=4,BIND_TS_TYPE=6,BIND_TS_INTERFACE=7,BIND_FLAGS_TS_ENUM=256,BIND_FLAGS_TS_EXPORT_ONLY=1024,BIND_TS_NAMESPACE=8|BIND_FLAGS_TS_EXPORT_ONLY,BIND_TS_ENUM=BIND_LEXICAL3|BIND_FLAGS_TS_ENUM,FUNC_STATEMENT2=1,FUNC_HANGING_STATEMENT2=2,CHAR_PAREN_L=40,CHAR_PAREN_R=41,CHAR_COMMA=44,CHAR_DOT=46,CHAR_COLON=58,CHAR_EQ=61,CHAR_LT=60,CHAR_BRACE_L=123,CHAR_BRACKET_L=91,CHAR_STAR=42,CHAR_HASH=35,CHAR_DQUOTE=34,CHAR_SQUOTE=39,SPECULATION_FAILED=SyntaxError("speculative parse failed"),tsPlugin=definePlugin((Base)=>{let{tokTypes:tt,keywordTypes,isIdentifierChar,isIdentifierStart}=Base.acorn,atType=new Base.acorn.TokenType("@");class TSParser extends Base{inType=!1;$4=!1;$5=!1;$7=null;$k=null;$l=!1;$m=!1;$f=null;$9=[[]];$n=0;$t=0;$o=-1;constructor(options,input,startPos){super(options,input,startPos);let onComment=this.options.onComment;if(typeof onComment==="function")this.options.onComment=(block,text,start,end,startLoc,endLoc)=>{if(start<this.$t)return;this.$t=end,onComment.call(this,block,text,start,end,startLoc,endLoc)}}reset(){this.inType=!1,this.$4=!1,this.$5=!1,this.$7=null,this.$k=null,this.$l=!1,this.$m=!1,this.$f=null,this.$9=[[]],this.$n=0,this.$t=0,this.$o=-1}getTokenFromCode(code){if(code===64)return++this.pos,this.finishToken(atType);return super.getTokenFromCode(code)}readToken_lt_gt(code){if(this.inType)return this.finishOp(tt.relational,1);return super.readToken_lt_gt(code)}$a(fn){let old=this.inType;this.inType=!0;let result=fn();if(this.inType=old,!old&&this.type===tt.relational)this.pos=this.start,this.nextToken();return result}$1(){return this.type===tt.relational&&this.value==="<"}$p(){if(this.type===tt.bitShift&&this.value==="<<")this.pos=this.start+1,this.finishToken(tt.relational,"<");return this.$1()}$c(){return this.type===tt.relational&&this.value===">"}$u(){return this.type===tt.prefix&&this.value==="!"}hasPrecedingLineBreak(){return hasLineBreak(this.input,this.lastTokEnd,this.start)}$d(from=this.pos){return SKIP_WHITESPACE.lastIndex=from,SKIP_WHITESPACE.exec(this.input),SKIP_WHITESPACE.lastIndex}$2(){return this.input.charCodeAt(this.$d())}$3(){let start=this.$d(),end=start;while(end<this.input.length&&isIdentifierChar(this.input.charCodeAt(end)))end++;return this.input.slice(start,end)}$b(){return!hasLineBreak(this.input,this.pos,this.$d())}$14(){return this.$b()&&isIdentifierStart(this.$2())&&!Object.hasOwn(keywordTypes,this.$3())}$15(){return{pos:this.pos,type:this.type,value:this.value,start:this.start,end:this.end,startLoc:this.startLoc,endLoc:this.endLoc,lastTokStart:this.lastTokStart,lastTokEnd:this.lastTokEnd,lastTokStartLoc:this.lastTokStartLoc,lastTokEndLoc:this.lastTokEndLoc,curLine:this.curLine,lineStart:this.lineStart,context:this.context.slice(),exprAllowed:this.exprAllowed,containsEsc:this.containsEsc,inType:this.inType,$4:this.$4,$5:this.$5,$7:this.$7,scopes:this.scopeStack.length,privateNames:this.privateNameStack.length,labels:this.labels,labelCount:this.labels.length,strict:this.strict,yieldPos:this.yieldPos,awaitPos:this.awaitPos,awaitIdentPos:this.awaitIdentPos,potentialArrowAt:this.potentialArrowAt,potentialArrowInForAwait:this.potentialArrowInForAwait}}$16(state){this.pos=state.pos,this.type=state.type,this.value=state.value,this.start=state.start,this.end=state.end,this.startLoc=state.startLoc,this.endLoc=state.endLoc,this.lastTokStart=state.lastTokStart,this.lastTokEnd=state.lastTokEnd,this.lastTokStartLoc=state.lastTokStartLoc,this.lastTokEndLoc=state.lastTokEndLoc,this.curLine=state.curLine,this.lineStart=state.lineStart,this.context=state.context,this.exprAllowed=state.exprAllowed,this.containsEsc=state.containsEsc,this.inType=state.inType,this.$4=state.$4,this.$5=state.$5,this.$7=state.$7,this.scopeStack.length=state.scopes,this.privateNameStack.length=state.privateNames,this.labels=state.labels,this.labels.length=state.labelCount,this.strict=state.strict,this.yieldPos=state.yieldPos,this.awaitPos=state.awaitPos,this.awaitIdentPos=state.awaitIdentPos,this.potentialArrowAt=state.potentialArrowAt,this.potentialArrowInForAwait=state.potentialArrowInForAwait}raise(pos,message){if(this.$n>0)throw SPECULATION_FAILED;return super.raise(pos,message)}$1y(pos,message){try{super.raise(pos,message)}catch(error){if(error instanceof SyntaxError)error.$1z=!0;throw error}throw Error("unreachable")}$g(fn,lookahead=!1){let state=this.$15();this.$n++;try{let result=fn();if(lookahead||result===void 0)this.$16(state);return result}catch(error){if(!(error instanceof SyntaxError)||!lookahead&&error.$1z)throw error;this.$16(state);return}finally{this.$n--}}$v(fn){return this.$g(fn,!0)===!0}$17(node){if(node.end=this.lastTokEnd,this.options.locations)node.loc.end=this.lastTokEndLoc}$q(node,from){if(node.start=from.start,this.options.locations)node.loc.start=from.loc.start}$6(returnType=!1){let node=this.startNode();return node.typeAnnotation=this.$a(()=>(this.next(),returnType?this.$20():this.$0())),this.finishNode(node,"TSTypeAnnotation")}$h(node,optional){if(optional&&this.eat(tt.question))node.optional=!0,this.$17(node);if(this.type===tt.colon)node.typeAnnotation=this.$6(),this.$17(node);return node}$20(){if(this.type!==tt.name&&this.type!==tt._this)return this.$0();if(this.isContextual("asserts")&&this.$b()&&isIdentifierStart(this.$2())){let node=this.startNode();if(this.next(),node.parameterName=this.type===tt._this?this.$w():this.parseIdent(),this.isContextual("is")&&!this.hasPrecedingLineBreak())return this.$x(node,!0);return node.asserts=!0,node.typeAnnotation=null,this.finishNode(node,"TSTypePredicate")}if(this.$3()==="is"&&this.$b()){let node=this.startNode();return node.parameterName=this.type===tt._this?this.$w():this.parseIdent(!0),this.$x(node,!1)}return this.$0()}$x(node,asserts){this.next();let annotation=this.startNode();return annotation.typeAnnotation=this.$0(),node.typeAnnotation=this.finishNode(annotation,"TSTypeAnnotation"),node.asserts=asserts,this.finishNode(node,"TSTypePredicate")}$w(){let node=this.startNode();return this.next(),this.finishNode(node,"TSThisType")}parseWholeType(){this.inType=!0,this.nextToken();let type=this.$0();if(this.type!==tt.eof)this.unexpected();return type}$0(){let type=this.$18();if(this.$4||this.type!==tt._extends||this.hasPrecedingLineBreak())return type;let node=this.startNodeAt(type.start,type.loc?.start);return this.next(),node.checkType=type,node.extendsType=this.$i(!0,()=>this.$18()),this.expect(tt.question),node.trueType=this.$i(!1,()=>this.$0()),this.expect(tt.colon),node.falseType=this.$i(!1,()=>this.$0()),this.finishNode(node,"TSConditionalType")}$i(disallow,fn){let old=this.$4;this.$4=disallow;let result=fn();return this.$4=old,result}$18(){if(this.$21())return this.$19("TSFunctionType");if(this.type===tt._new||this.isContextual("abstract")&&this.$3()==="new")return this.$19("TSConstructorType");return this.$1a("TSUnionType",tt.bitwiseOR,()=>this.$1a("TSIntersectionType",tt.bitwiseAND,()=>this.$1b()))}$19(type){let node=this.startNode();if(type==="TSConstructorType"){if(node.abstract=this.isContextual("abstract"),node.abstract)this.next();this.next()}return this.$i(!1,()=>this.$r(node,tt.arrow)),this.finishNode(node,type)}$r(node,returnToken){if(this.$1())node.typeParameters=this.$8();if(this.expect(tt.parenL),node.parameters=this.parseBindingList(tt.parenR,!1,!0),this.type===returnToken)node.typeAnnotation=this.$6(!0);else if(returnToken===tt.arrow)this.unexpected()}$21(){if(this.$1())return!0;if(this.type!==tt.parenL)return!1;return this.$v(()=>{if(this.next(),this.type===tt.parenR||this.type===tt.ellipsis)return!0;if(this.type===tt.name||this.type===tt._this)this.next();else if(this.type===tt.braceL||this.type===tt.bracketL)this.parseBindingAtom();else return!1;let type=this.type;if(type===tt.colon||type===tt.comma||type===tt.question||type===tt.eq)return!0;if(type!==tt.parenR)return!1;return this.next(),this.type===tt.arrow})}$1a(type,operator,parseConstituent){let node=this.startNode(),hasLeadingOperator=this.eat(operator),types=[];do types.push(parseConstituent());while(this.eat(operator));if(types.length===1&&!hasLeadingOperator)return types[0];return node.types=types,this.finishNode(node,type)}$1b(){if(this.type===tt.name&&!this.containsEsc){let value=this.value;if(value==="keyof"||value==="unique"||value==="readonly"){let node=this.startNode();return this.next(),node.operator=value,node.typeAnnotation=this.$1b(),this.finishNode(node,"TSTypeOperator")}if(value==="infer"){let node=this.startNode();this.next();let parameter=this.startNode();parameter.name=this.$y();let constraint=this.$g(()=>this.$22());if(constraint)parameter.constraint=constraint;return node.typeParameter=this.finishNode(parameter,"TSTypeParameter"),this.finishNode(node,"TSInferType")}}return this.$i(!1,()=>this.$23())}$22(){if(!this.eat(tt._extends))return;let constraint=this.$i(!0,()=>this.$0());return this.$4||this.type!==tt.question?constraint:void 0}$y(){if(this.type!==tt.name&&!this.type.keyword)this.unexpected();let name=this.type===tt.name?this.value:this.type.keyword;return this.next(),name}$23(){let type=this.$24();while(!this.hasPrecedingLineBreak()&&this.eat(tt.bracketL)){let node=this.startNodeAt(type.start,type.loc?.start);if(this.eat(tt.bracketR))node.elementType=type,type=this.finishNode(node,"TSArrayType");else node.objectType=type,node.indexType=this.$0(),this.expect(tt.bracketR),type=this.finishNode(node,"TSIndexedAccessType")}return type}$24(){switch(this.type){case tt.name:case tt._void:case tt._null:{let keyword=KEYWORD_TYPES.get(this.value);if(keyword&&(this.type!==tt.name||!this.containsEsc&&this.$2()!==CHAR_DOT)){let node=this.startNode();return this.next(),this.finishNode(node,keyword)}return this.$1c()}case tt.string:case tt.num:case tt._true:case tt._false:{let node=this.startNode();return node.literal=this.parseExprAtom(),this.finishNode(node,"TSLiteralType")}case tt.plusMin:{if(this.value!=="-")break;let node=this.startNode(),unary=this.startNode();if(this.next(),this.type!==tt.num)this.unexpected();return unary.operator="-",unary.prefix=!0,unary.argument=this.parseExprAtom(),node.literal=this.finishNode(unary,"UnaryExpression"),this.finishNode(node,"TSLiteralType")}case tt.backQuote:return this.$25();case tt._this:{let thisType=this.$w();if(this.isContextual("is")&&!this.hasPrecedingLineBreak()){let node=this.startNodeAt(thisType.start,thisType.loc?.start);return node.parameterName=thisType,this.$x(node,!1)}return thisType}case tt._typeof:return this.$26();case tt._import:return this.$1d();case tt.braceL:return this.$27()?this.$28():this.$29();case tt.bracketL:return this.$2a();case tt.parenL:{let node=this.startNode();return this.next(),node.typeAnnotation=this.$0(),this.expect(tt.parenR),this.finishNode(node,"TSParenthesizedType")}default:if(this.type.keyword)return this.$1c()}return this.unexpected()}$1c(){let node=this.startNode();if(node.typeName=this.$j(),!this.hasPrecedingLineBreak()&&this.$1())node.typeArguments=this.$e();return this.finishNode(node,"TSTypeReference")}$j(){let entity=this.parseIdent(!0);while(this.eat(tt.dot)){let node=this.startNodeAt(entity.start,entity.loc?.start);node.left=entity,node.right=this.parseIdent(!0),entity=this.finishNode(node,"TSQualifiedName")}return entity}$26(){let node=this.startNode();if(this.next(),node.exprName=this.type===tt._import?this.$1d():this.$j(),!this.hasPrecedingLineBreak()&&this.$1())node.typeArguments=this.$e();return this.finishNode(node,"TSTypeQuery")}$1d(){let node=this.startNode();if(this.next(),node.argument=this.$1e(),this.eat(tt.dot))node.qualifier=this.$j();if(this.$1())node.typeArguments=this.$e();return this.finishNode(node,"TSImportType")}$z(){if(this.type!==tt.string)this.unexpected();return this.parseExprAtom()}$1e(){this.expect(tt.parenL);let string=this.$z();return this.expect(tt.parenR),string}$25(){let node=this.startNode(),literal=this.startNode();this.next(),literal.expressions=[];let element=this.parseTemplateElement({isTagged:!1});literal.quasis=[element];while(!element.tail){if(this.type===tt.eof)this.raise(this.pos,"Unterminated template literal");this.expect(tt.dollarBraceL),literal.expressions.push(this.$0()),this.expect(tt.braceR),element=this.parseTemplateElement({isTagged:!1}),literal.quasis.push(element)}return this.next(),node.literal=this.finishNode(literal,"TemplateLiteral"),this.finishNode(node,"TSLiteralType")}$27(){return this.$v(()=>{if(this.next(),this.type===tt.plusMin)return this.next(),this.isContextual("readonly");if(this.isContextual("readonly"))this.next();if(this.type!==tt.bracketL)return!1;if(this.next(),this.type!==tt.name)return!1;return this.next(),this.type===tt._in})}$28(){let node=this.startNode();if(this.expect(tt.braceL),this.type===tt.plusMin)node.readonly=this.value,this.next(),this.expectContextual("readonly");else if(this.eatContextual("readonly"))node.readonly=!0;this.expect(tt.bracketL);let parameter=this.startNode();if(parameter.name=this.$y(),this.expect(tt._in),parameter.constraint=this.$0(),node.typeParameter=this.finishNode(parameter,"TSTypeParameter"),node.nameType=this.eatContextual("as")?this.$0():null,this.expect(tt.bracketR),this.type===tt.plusMin)node.optional=this.value,this.next(),this.expect(tt.question);else if(this.eat(tt.question))node.optional=!0;if(this.eat(tt.colon))node.typeAnnotation=this.$0();return this.semicolon(),this.expect(tt.braceR),this.finishNode(node,"TSMappedType")}$29(){let node=this.startNode();return node.members=this.$1f(),this.finishNode(node,"TSTypeLiteral")}$1f(){this.expect(tt.braceL);let members=[];while(!this.eat(tt.braceR))members.push(this.$2b());return members}$2b(){let node=this.startNode(),type="TSPropertySignature",next=this.type===tt._new?this.$2():-1;if(this.type===tt.parenL||this.$1())type="TSCallSignatureDeclaration",this.$r(node,tt.colon);else if(next===CHAR_PAREN_L||next===CHAR_LT)type="TSConstructSignatureDeclaration",this.next(),this.$r(node,tt.colon);else{let newKey=this.type===tt._new?this.parseIdent(!0):null;if(this.isContextual("readonly")&&this.$s(!0))this.next(),node.readonly=!0;if(this.type===tt.bracketL&&this.$1g())return this.$1h(node);let kind="method";if(newKey)node.key=newKey;else{if((this.isContextual("get")||this.isContextual("set"))&&this.$s(!1))kind=this.value,this.next();this.parsePropertyName(node)}if(this.eat(tt.question))node.optional=!0;if(this.type===tt.parenL||this.$1()){if(type="TSMethodSignature",kind!=="method")node.kind=kind;this.$r(node,tt.colon),node.kind=kind}else if(this.type===tt.colon)node.typeAnnotation=this.$6()}return this.$1i(),this.finishNode(node,type)}$1i(){if(!this.eat(tt.comma))this.semicolon()}$1g(){return this.$v(()=>{if(this.next(),this.type!==tt.name)return!1;return this.next(),this.type===tt.colon})}$1h(node){if(this.expect(tt.bracketL),node.parameters=[this.$h(this.parseIdent(),!1)],this.expect(tt.bracketR),this.type===tt.colon)node.typeAnnotation=this.$6();return this.$1i(),this.finishNode(node,"TSIndexSignature")}$2a(){let node=this.startNode();this.expect(tt.bracketL),node.elementTypes=[];while(!this.eat(tt.bracketR))if(node.elementTypes.push(this.$2c()),this.type!==tt.bracketR)this.expect(tt.comma);return this.finishNode(node,"TSTupleType")}$2c(){let start=this.start,startLoc=this.startLoc,rest=this.eat(tt.ellipsis),element;if((this.type===tt.name||this.type.keyword)&&this.$2d()){let node=this.startNode();node.label=this.parseIdent(!0),node.optional=this.eat(tt.question),this.expect(tt.colon),node.elementType=this.$0(),element=this.finishNode(node,"TSNamedTupleMember")}else if(element=this.$0(),this.eat(tt.question)){let node=this.startNodeAt(element.start,element.loc?.start);node.typeAnnotation=element,element=this.finishNode(node,"TSOptionalType")}if(rest){let node=this.startNodeAt(start,startLoc);node.typeAnnotation=element,element=this.finishNode(node,"TSRestType")}return element}$2d(){let at=this.$d();if(this.input.charCodeAt(at)===63)at=this.$d(at+1);return this.input.charCodeAt(at)===CHAR_COLON}$8(){return this.$a(()=>{let node=this.startNode();this.next(),node.params=[];while(!this.$c()){let parameter=this.startNode();while((this.type===tt._const||this.type===tt._in||this.isContextual("out"))&&isIdentifierStart(this.$2()))parameter[this.value]=!0,this.next();if(parameter.name=this.$y(),this.eat(tt._extends))parameter.constraint=this.$0();if(this.eat(tt.eq))parameter.default=this.$0();if(node.params.push(this.finishNode(parameter,"TSTypeParameter")),!this.$c()){if(this.expect(tt.comma),this.$c())node.extra={trailingComma:this.lastTokStart}}}if(this.next(),node.params.length===0)this.$1y(this.start,"Type parameter list cannot be empty.");return this.finishNode(node,"TSTypeParameterDeclaration")})}$e(){return this.$a(()=>{let node=this.startNode();this.next(),node.params=[];while(!this.$c())if(node.params.push(this.$0()),!this.$c())this.expect(tt.comma);if(node.params.length===0)this.unexpected();return this.next(),this.finishNode(node,"TSTypeParameterInstantiation")})}$1j(){let list=[];do{let node=this.startNode();if(node.expression=this.$j(),this.$1())node.typeParameters=this.$e();list.push(this.finishNode(node,"TSExpressionWithTypeArguments"))}while(this.eat(tt.comma));return list}$1k(exported=!1){if(this.type!==tt.name||this.containsEsc){if(this.type===tt._const&&this.$3()==="enum")return this.$10(this.startNode());return}if(!this.$2e(this.value))return;if(this.value==="declare")return this.$2f(exported);return this.$1l(this.startNode(),this.value)}$2e(word){switch(word){case"interface":case"type":case"namespace":return this.$14();case"enum":return isIdentifierStart(this.$2());case"abstract":return this.$b()&&this.$3()==="class";case"module":{let next=this.$2();return this.$b()&&(next===CHAR_DQUOTE||next===CHAR_SQUOTE||isIdentifierStart(next))}case"declare":return this.$b()&&DECLARE_TARGETS.has(this.$3());case"global":return this.$b()&&this.$2()===CHAR_BRACE_L}return!1}$1l(node,word){switch(word){case"interface":return this.$1m(node);case"type":return this.$2g(node);case"enum":return this.$10(node);case"abstract":return this.$1n(node,!0);case"global":return node.global=!0,node.id=this.parseIdent(),node.body=this.$11(),this.finishNode(node,"TSModuleDeclaration")}return this.$2h(node)}$2f(exported){let old=this.$5;this.$5=!0;let node=this.startNode();this.next();let word=this.value;if(word==="const"&&this.$3()==="enum")node.const=!0;if(!exported&&DECLARE_FIRST.has(word))node.declare=!0;let declaration;if(node.const)declaration=this.$10(node);else if(word==="var"||word==="let"||word==="const")declaration=this.parseVarStatement(node,word,!0);else if(word==="function")this.next(),declaration=this.parseFunction(node,FUNC_STATEMENT2,!1,!1);else if(word==="class")declaration=this.parseClass(node,!0);else declaration=this.$1l(node,word);return declaration.declare=!0,this.$5=old,declaration}$1n(node,isStatement){return this.next(),node.abstract=!0,this.parseClass(node,isStatement)}$1m(node){if(this.next(),node.id=this.parseIdent(),this.checkLValSimple(node.id,BIND_TS_INTERFACE),this.$1())node.typeParameters=this.$8();return this.$a(()=>{if(this.eat(tt._extends))node.extends=this.$1j();let body=this.startNode();body.body=this.$1f(),node.body=this.finishNode(body,"TSInterfaceBody")}),this.finishNode(node,"TSInterfaceDeclaration")}$2g(node){if(this.next(),node.id=this.parseIdent(),this.checkLValSimple(node.id,BIND_TS_TYPE),this.$1())node.typeParameters=this.$8();return node.typeAnnotation=this.$a(()=>(this.expect(tt.eq),this.$0())),this.semicolon(),this.finishNode(node,"TSTypeAliasDeclaration")}$10(node){if(this.type===tt._const)node.const=!0,this.next();this.next(),node.id=this.parseIdent(),this.checkLValSimple(node.id,BIND_TS_ENUM),this.expect(tt.braceL),node.members=[];while(!this.eat(tt.braceR)){let member=this.startNode();if(member.id=this.type===tt.string?this.parseExprAtom():this.parseIdent(!0),this.eat(tt.eq))member.initializer=this.parseMaybeAssign();if(node.members.push(this.finishNode(member,"TSEnumMember")),this.type!==tt.braceR)this.expect(tt.comma)}return this.finishNode(node,"TSEnumDeclaration")}$2h(node){if(this.next(),this.type===tt.string){if(node.id=this.parseExprAtom(),this.type===tt.braceL)node.body=this.$11();else this.semicolon();return this.finishNode(node,"TSModuleDeclaration")}return node.id=this.parseIdent(),this.checkLValSimple(node.id,BIND_TS_NAMESPACE),this.$1o(node)}$1o(node){if(this.eat(tt.dot)){let inner=this.startNode();inner.id=this.parseIdent(),node.body=this.$1o(inner)}else node.body=this.$11();return this.finishNode(node,"TSModuleDeclaration")}$11(){this.enterScope(SCOPE_CLASS_STATIC_BLOCK3);let node=this.startNode();this.enterScope(0),this.expect(tt.braceL),node.body=[];while(!this.eat(tt.braceR))node.body.push(this.parseStatement(null,!0));return this.exitScope(),this.exitScope(),this.finishNode(node,"TSModuleBlock")}$1p(node,isExport){if(node.isExport=isExport,node.id=this.parseIdent(),this.checkLValSimple(node.id,BIND_LEXICAL3),this.expect(tt.eq),this.isContextual("require")&&this.$2()===CHAR_PAREN_L){let reference=this.startNode();this.next(),reference.expression=this.$1e(),node.moduleReference=this.finishNode(reference,"TSExternalModuleReference")}else node.moduleReference=this.$j();return this.semicolon(),this.finishNode(node,"TSImportEqualsDeclaration")}$2i(){let at=this.$d();if(this.input.charCodeAt(at)!==CHAR_EQ)return!1;let after=this.input.charCodeAt(at+1);return after!==CHAR_EQ&&after!==62}parseStatement(context,topLevel,exports){if(this.type===atType)this.$1q(!0);let declaration=this.$1k();if(declaration)return declaration;return super.parseStatement(context,topLevel,exports)}parseVarStatement(node,kind,allowMissingInitializer){return super.parseVarStatement(node,kind,allowMissingInitializer||this.$5)}parseVarId(decl,kind){if(super.parseVarId(decl,kind),decl.id.type==="Identifier"&&this.$u()&&!this.hasPrecedingLineBreak())this.next(),decl.definite=!0;this.$h(decl.id,!1)}parseCatchClauseParam(){let param=this.$h(this.parseBindingAtom(),!1),simple=param.type==="Identifier";return this.enterScope(simple?SCOPE_SIMPLE_CATCH3:0),this.checkLValPattern(param,simple?BIND_SIMPLE_CATCH3:BIND_LEXICAL3),this.expect(tt.parenR),param}parseImport(node){if(this.next(),node.importKind="value",this.type===tt.string)node.specifiers=[],node.source=this.parseExprAtom();else{if(this.isContextual("type")){let next=this.$2();if(next===CHAR_BRACE_L||next===CHAR_STAR||isIdentifierStart(next)&&this.$3()!=="from")node.importKind="type",this.next()}if(this.type===tt.name&&this.$2i())return this.$1p(node,!1);node.specifiers=this.parseImportSpecifiers(),this.expectContextual("from"),node.source=this.$z()}return this.$1r(node),this.semicolon(),this.finishNode(node,"ImportDeclaration")}parseWithClause(){if(this.isContextual("assert")&&!this.hasPrecedingLineBreak())this.type=tt._with;return this.type===tt._with?super.parseWithClause():void 0}$1r(node){let attributes=this.parseWithClause();if(attributes)node.attributes=attributes}parseImportSpecifier(){return this.$1s("importKind",()=>super.parseImportSpecifier())}parseExportSpecifier(exports){return this.$1s("exportKind",()=>super.parseExportSpecifier(exports))}$1s(kindKey,parse){let next=this.isContextual("type")?this.$2():-1;if(next===CHAR_DQUOTE||next===CHAR_SQUOTE||isIdentifierStart(next)&&this.$3()!=="as"){let modifier=this.startNode();this.next();let node=parse();return this.$q(node,modifier),node[kindKey]="type",node}let node=parse();return node[kindKey]="value",node}parseExport(node,exports){if(this.next(),this.eat(tt._import)){if(node.importKind="value",this.isContextual("type")&&isIdentifierStart(this.$2())&&this.$3()!=="from")node.importKind="type",this.next();return this.$1p(node,!0)}if(this.eat(tt.eq))return node.expression=this.parseExpression(),this.semicolon(),this.finishNode(node,"TSExportAssignment");if(this.eatContextual("as"))return this.expectContextual("namespace"),node.id=this.parseIdent(),this.semicolon(),this.finishNode(node,"TSNamespaceExportDeclaration");if(node.exportKind="value",this.isContextual("type")){let next=this.$2();if(next===CHAR_BRACE_L||next===CHAR_STAR)node.exportKind="type",this.next()}if(this.eat(tt.star))return this.parseExportAllDeclaration(node,exports);if(this.eat(tt._default)){if(this.isContextual("interface")&&this.$14())node.declaration=this.$1m(this.startNode());else if(this.isContextual("abstract")&&this.$3()==="class")node.declaration=this.$1n(this.startNode(),"nullableID");else node.declaration=this.parseExportDefaultDeclaration();return this.finishNode(node,"ExportDefaultDeclaration")}let isDeclare=this.isContextual("declare"),declaration=this.$1k(!0);if(declaration||this.shouldParseExportStatement()){if(node.declaration=declaration??this.parseStatement(null),isDeclare||node.declaration.type==="TSInterfaceDeclaration"||node.declaration.type==="TSTypeAliasDeclaration")node.exportKind="type";return node.specifiers=[],node.source=null,this.finishNode(node,"ExportNamedDeclaration")}if(node.declaration=null,node.specifiers=this.parseExportSpecifiers(exports),this.eatContextual("from"))node.source=this.$z(),this.$1r(node);else{for(let spec of node.specifiers)if(this.checkUnreserved(spec.local),this.checkLocalExport(spec.local),spec.local.type==="Literal")this.raise(spec.local.start,"A string literal cannot be used as an exported binding without `from`.");node.source=null}return this.semicolon(),this.finishNode(node,"ExportNamedDeclaration")}parseFunction(node,statement,allowExpressionBody,isAsync,forInit){let isDeclaration=statement&FUNC_STATEMENT2;if(isDeclaration)this.$f=node,this.$o=node.start;super.parseFunction(node,statement,allowExpressionBody,isAsync,forInit),this.$f=null;let bodiless=!node.body;if(bodiless)node.type="TSDeclareFunction";if(isDeclaration&&node.id){if(bodiless){if(this.$5&&this.currentScope().flags&SCOPE_TOP3)this.declareName(node.id.name,BIND_FLAGS_TS_EXPORT_ONLY,node.id.start);this.checkLValSimple(node.id,BIND_NONE2)}else if(!(statement&FUNC_HANGING_STATEMENT2)){let bindingType=BIND_FUNCTION3;if(this.strict||node.generator||node.async)bindingType=this.treatFunctionsAsVar?BIND_VAR2:BIND_LEXICAL3;this.checkLValSimple(node.id,bindingType)}}return node}parseFunctionParams(node){if(this.$1())node.typeParameters=this.$8();if(super.parseFunctionParams(node),this.type===tt.colon)node.returnType=this.$6(!0)}parseFunctionBody(node,isArrowFunction,isMethod,forInit){if(isMethod&&this.type===tt.colon)node.returnType=this.$6(!0);if(isArrowFunction||this.type===tt.braceL||node.start!==this.$o){super.parseFunctionBody(node,isArrowFunction,isMethod,forInit);return}this.semicolon(),this.exitScope()}parseMethod(isGenerator,isAsync,allowDirectSuper){let typeParameters=this.$k;this.$k=null;let node=super.parseMethod(isGenerator,isAsync,allowDirectSuper);if(!node.body)node.type="TSDeclareMethod";if(typeParameters)node.typeParameters=typeParameters;return node}parseBindingList(close,allowEmpty,allowTrailingComma,allowModifiers){let modifiers=allowModifiers===!0||this.$l;return this.$l=!1,super.parseBindingList(close,allowEmpty,allowTrailingComma,modifiers)}$s(allowLineBreak){if(!allowLineBreak&&!this.$b())return!1;let next=this.$2();return next===CHAR_BRACKET_L||next===CHAR_BRACE_L||next===CHAR_STAR||next===CHAR_DOT||next===CHAR_HASH||next===CHAR_DQUOTE||next===CHAR_SQUOTE||next>=48&&next<=57||isIdentifierStart(next)}parseAssignableListItem(allowModifiers){let decorators=this.$12(),start=this.start,startLoc=this.startLoc,accessibility,readonly=!1,override=!1;if(allowModifiers)while(this.type===tt.name&&PARAMETER_MODIFIERS.has(this.value)&&!this.containsEsc&&this.$s(!1)){if(this.value==="readonly")readonly=!0;else if(this.value==="override")override=!0;else accessibility=this.value;this.next()}let left;if(this.type===tt._this)left=this.startNode(),left.name="this",this.next(),this.finishNode(left,"Identifier");else left=this.parseBindingAtom();let element=this.type===tt.eq?this.parseMaybeDefault(start,startLoc,left):this.parseMaybeDefault(left.start,left.loc?.start,this.$h(left,!0));if(decorators.length>0)element.decorators=decorators;if(!accessibility&&!readonly&&!override)return element;let node=this.startNodeAt(start,startLoc);if(accessibility)node.accessibility=accessibility;if(readonly)node.readonly=!0;if(override)node.override=!0;return node.parameter=element,this.finishNode(node,"TSParameterProperty")}parseBindingListItem(param){if(param.type==="RestElement")this.$h(param,!0);return param}checkLValSimple(expr,bindingType,checkClashes){if(this.$f&&expr===this.$f.id){this.$f=null;return}if(!bindingType&&TS_EXPRESSION_WRAPPERS.has(expr.type)){this.checkLValSimple(expr.expression,bindingType,checkClashes);return}switch(expr.type){case"TSParameterProperty":this.checkLValInnerPattern(expr.parameter,bindingType,checkClashes);return;case"Identifier":if(expr.name==="this")return}super.checkLValSimple(expr,bindingType,checkClashes)}toAssignable(node,isBinding,refDestructuringErrors){if(node&&!isBinding&&TS_EXPRESSION_WRAPPERS.has(node.type))return node;return super.toAssignable(node,isBinding,refDestructuringErrors)}declareName(name,bindingType,pos){let scope=this.currentScope();if(bindingType&BIND_FLAGS_TS_EXPORT_ONLY){this.$1t(scope,name),scope.$1u??=[],scope.$1u.push(name);return}if(bindingType===BIND_TS_TYPE||bindingType===BIND_TS_INTERFACE){if(scope.$13??=[],bindingType===BIND_TS_TYPE&&hasName(scope.$13,name))this.raise(pos,`type '${name}' has already been declared.`);scope.$13.push(name),this.$1t(scope,name);return}if(bindingType&BIND_FLAGS_TS_ENUM){if(scope.$1v??=[],hasName(scope.$1v,name))return;super.declareName(name,BIND_LEXICAL3,pos),scope.$1v.push(name);return}super.declareName(name,bindingType,pos)}$1t(scope,name){if(this.inModule&&scope.flags&SCOPE_TOP3)delete this.undefinedExports[name]}checkLocalExport(id){for(let i=this.scopeStack.length-1;i>=0;i--){let scope=this.scopeStack[i];if(hasName(scope.$13,id.name)||hasName(scope.$1u,id.name))return}super.checkLocalExport(id)}checkExport(){}raiseRecoverable(pos,message){if(message==="Duplicate constructor in the same class")return;super.raiseRecoverable(pos,message)}$12(){let decorators=[];while(this.type===atType)decorators.push(this.$1w());return decorators}$1q(allowExport){let pending=this.$9[this.$9.length-1];while(this.type===atType)pending.push(this.$1w());if(this.type===tt._export){if(!allowExport)this.unexpected()}else if(this.type!==tt._class&&!((this.isContextual("abstract")||this.isContextual("declare"))&&this.$3()==="class"))this.raise(this.start,"Leading decorators must be attached to a class declaration.")}$1w(){let node=this.startNode();this.next(),this.$9.push([]);let startPos=this.start,startLoc=this.startLoc,expression;if(this.type===tt.parenL){if(this.next(),expression=this.parseExpression(),this.expect(tt.parenR),this.options.preserveParens){let paren=this.startNodeAt(startPos,startLoc);paren.expression=expression,expression=this.finishNode(paren,"ParenthesizedExpression")}}else{expression=this.parseIdent(!1);while(this.eat(tt.dot)){let member=this.startNodeAt(startPos,startLoc);member.object=expression,member.property=this.parseIdent(!0),member.computed=!1,expression=this.finishNode(member,"MemberExpression")}}let typeArguments=this.$p()?this.$e():void 0;if(this.eat(tt.parenL)){let call=this.startNodeAt(expression.start,expression.loc?.start);if(call.callee=expression,call.arguments=this.parseExprList(tt.parenR,!1,!1),typeArguments)call.typeArguments=typeArguments;expression=this.finishNode(call,"CallExpression")}else if(typeArguments){let instantiation=this.startNodeAt(expression.start,expression.loc?.start);instantiation.expression=expression,instantiation.typeArguments=typeArguments,expression=this.finishNode(instantiation,"TSInstantiationExpression")}return node.expression=expression,this.$9.pop(),this.finishNode(node,"Decorator")}shouldParseExportStatement(){return this.type===atType||super.shouldParseExportStatement()}parseExprAtom(refDestructuringErrors,forInit,forNew){if(this.type===atType)this.$1q(!1);return super.parseExprAtom(refDestructuringErrors,forInit,forNew)}parseProperty(isPattern,refDestructuringErrors){if(isPattern||this.type!==atType)return super.parseProperty(isPattern,refDestructuringErrors);let decorators=this.$12(),property=super.parseProperty(isPattern,refDestructuringErrors);if(property.type==="SpreadElement")this.raise(property.start,"Decorators can't be used with SpreadElement");return property.decorators=decorators,property}parseClassId(node,isStatement){let index=this.$9.length-1,decorators=this.$9[index];if(decorators.length>0)node.decorators=decorators,this.$q(node,decorators[0]),this.$9[index]=[];if(!this.isContextual("implements")||isStatement===!0)super.parseClassId(node,isStatement);if(this.$1())node.typeParameters=this.$8()}parseClassSuper(node){if(super.parseClassSuper(node),node.superClass&&this.$1())node.superTypeParameters=this.$e();if(this.eatContextual("implements"))node.implements=this.$a(()=>this.$1j())}parseClassElement(constructorAllowsSuper){if(this.type===atType){let decorators=this.$12();if(this.type===tt.braceR)this.raise(this.start,"Decorators must be attached to a class element.");let element=this.parseClassElement(constructorAllowsSuper);return element.decorators=decorators,this.$q(element,decorators[0]),element}if(this.eat(tt.semi))return null;let node=this.startNode();while(this.type===tt.name&&CLASS_MODIFIERS.has(this.value)&&!this.containsEsc&&this.$s(this.value==="static")){let modifier=this.value;if(this.next(),modifier==="static"&&this.type===tt.braceL)return this.next(),this.parseClassStaticBlock(node),node;if(modifier==="public"||modifier==="private"||modifier==="protected")node.accessibility=modifier;else node[modifier]=!0}if(this.type===tt.bracketL&&this.$1g())return this.$1h(node);node.static??=!1;let keyName="",isGenerator=!1,isAsync=!1,kind="method";if(this.eatContextual("async"))if((this.isClassElementNameStart()||this.type===tt.star)&&!this.canInsertSemicolon())isAsync=!0;else keyName="async";if(!keyName&&this.eat(tt.star))isGenerator=!0;if(!keyName&&!isAsync&&!isGenerator){let lastValue=this.value;if(this.eatContextual("get")||this.eatContextual("set"))if(this.isClassElementNameStart())kind=lastValue;else keyName=lastValue}if(keyName)node.computed=!1,node.key=this.startNodeAt(this.lastTokStart,this.lastTokStartLoc),node.key.name=keyName,this.finishNode(node.key,"Identifier");else this.parseClassElementName(node);if(this.eat(tt.question))node.optional=!0;if(this.type===tt.parenL||this.$1()||kind!=="method"||isGenerator||isAsync){let key=node.key,isConstructor=!node.static&&!node.computed&&(key.type==="Identifier"&&key.name==="constructor"||key.type==="Literal"&&key.value==="constructor");if(node.kind=isConstructor?"constructor":kind,this.$1())node.typeParameters=this.$8();this.$l=isConstructor,this.$o=this.start,this.parseClassMethod(node,isGenerator,isAsync,isConstructor&&constructorAllowsSuper)}else{if(!node.optional&&this.$u())this.next(),node.definite=!0;if(this.type===tt.colon)node.typeAnnotation=this.$6();this.parseClassField(node)}return node}parseMaybeAssign(forInit,refDestructuringErrors,afterLeftParse){if(this.$p()){let arrow=this.$g(()=>{let typeParameters=this.$8(),expr=super.parseMaybeAssign(forInit,refDestructuringErrors,afterLeftParse);if(expr.type!=="ArrowFunctionExpression")return;return expr.typeParameters=typeParameters,this.$q(expr,typeParameters),expr});if(arrow)return arrow}return super.parseMaybeAssign(forInit,refDestructuringErrors,afterLeftParse)}parseMaybeUnary(refDestructuringErrors,sawUnary,incDec,forInit){if(this.$p()){let node=this.startNode();return node.typeAnnotation=this.$a(()=>{this.next();let type=this.$0();if(!this.$c())this.unexpected();return this.next(),type}),node.expression=this.parseMaybeUnary(null,!1,!1,forInit),this.finishNode(node,"TSTypeAssertion")}return super.parseMaybeUnary(refDestructuringErrors,sawUnary,incDec,forInit)}parseMaybeConditional(forInit,refDestructuringErrors){let startPos=this.start,startLoc=this.startLoc,expr=this.parseExprOps(forInit,refDestructuringErrors);if(this.checkExpressionErrors(refDestructuringErrors))return expr;if(this.type===tt.question&&!(expr.type==="ArrowFunctionExpression"&&expr.start===startPos)&&!this.$2j()){this.next();let node=this.startNodeAt(startPos,startLoc);return node.test=expr,node.consequent=this.parseMaybeAssign(),this.expect(tt.colon),node.alternate=this.parseMaybeAssign(forInit),this.finishNode(node,"ConditionalExpression")}return expr}$2j(){let at=this.$d(),next=this.input.charCodeAt(at);if(next===CHAR_COLON||next===CHAR_COMMA||next===CHAR_PAREN_R)return!0;return next===CHAR_EQ&&this.input.charCodeAt(at+1)!==CHAR_EQ}parseParenItem(item){return this.$h(item,!0)}$1x(){if(this.type!==tt.colon)return!0;let returnType=this.$g(()=>{let type=this.$6(!0);return this.type===tt.arrow&&!this.canInsertSemicolon()?type:void 0});if(!returnType)return!1;return this.$7=returnType,!0}shouldParseArrow(exprList){return this.$1x()&&super.shouldParseArrow(exprList)}shouldParseAsyncArrow(){return this.$1x()&&super.shouldParseAsyncArrow()}parseArrowExpression(node,params,isAsync,forInit){if(this.$7)node.returnType=this.$7,this.$7=null;return super.parseArrowExpression(node,params,isAsync,forInit)}parseExprList(close,allowTrailingComma,allowEmpty,refDestructuringErrors){if(!this.$m)return super.parseExprList(close,allowTrailingComma,allowEmpty,refDestructuringErrors);this.$m=!1;let elements=[],first=!0;while(!this.eat(close)){if(first)first=!1;else if(this.expect(tt.comma),allowTrailingComma&&this.afterTrailingComma(close))break;if(this.type===tt.ellipsis){let spread=this.parseSpread(refDestructuringErrors);if(this.eat(tt.question))spread.optional=!0;if(this.type===tt.colon)spread.typeAnnotation=this.$6();elements.push(spread)}else elements.push(this.parseMaybeAssign(!1,refDestructuringErrors,this.parseParenItem))}return elements}parseSubscript(base,startPos,startLoc,noCalls,maybeAsyncArrow,optionalChained,forInit){if(this.$u()&&!this.hasPrecedingLineBreak()){let node=this.startNodeAt(startPos,startLoc);return this.exprAllowed=!1,this.next(),node.expression=base,this.finishNode(node,"TSNonNullExpression")}if(maybeAsyncArrow&&this.$1()){let arrow=this.$g(()=>this.$2k(startPos,startLoc,forInit));if(arrow)return arrow}let optional=this.type===tt.questionDot&&this.$2()===CHAR_LT;if(this.$1()||optional||this.type===tt.bitShift&&this.value==="<<"){let typeArguments=this.$g(()=>{if(optional)this.next();this.$p();let args=this.$e();if(this.type===tt.parenL&&!noCalls)return args;if(this.type===tt.backQuote)return optional?void 0:args;if(optional)return;if(this.$c()||this.type===tt.bitShift||this.type.startsExpr&&this.type!==tt.parenL&&!this.hasPrecedingLineBreak())return;return args});if(typeArguments){let node=this.startNodeAt(startPos,startLoc);if(this.type===tt.parenL&&!noCalls){if(this.next(),node.callee=base,node.arguments=this.parseExprList(tt.parenR,!0,!1),node.typeArguments=typeArguments,optional)base.optional=!0;if(optional||optionalChained)node.optional=optional;return this.finishNode(node,"CallExpression")}if(this.type===tt.backQuote)return node.tag=base,node.quasi=this.parseTemplate({isTagged:!0}),node.typeArguments=typeArguments,this.finishNode(node,"TaggedTemplateExpression");return node.expression=base,node.typeArguments=typeArguments,this.finishNode(node,"TSInstantiationExpression")}}if(maybeAsyncArrow&&this.type===tt.parenL)this.$m=!0;return super.parseSubscript(base,startPos,startLoc,noCalls,maybeAsyncArrow,optionalChained,forInit)}$2k(startPos,startLoc,forInit){let node=this.startNodeAt(startPos,startLoc);if(node.typeParameters=this.$8(),this.expect(tt.parenL),node.params=this.parseBindingList(tt.parenR,!1,!0),this.type===tt.colon)node.returnType=this.$6(!0);if(this.type!==tt.arrow||this.canInsertSemicolon())return;return this.next(),this.parseArrowExpression(node,node.params,!0,forInit)}parseDynamicImport(node){if(this.next(),node.source=this.parseMaybeAssign(),this.eat(tt.comma)&&this.type!==tt.parenR)node.arguments=[this.parseExpression()];return this.expect(tt.parenR),this.finishNode(node,"ImportExpression")}parseNew(){let node=super.parseNew();if(node.callee?.type!=="TSInstantiationExpression")return node;let result=this.startNodeAt(node.start,node.loc?.start);return result.callee=node.callee.expression,result.typeArguments=node.callee.typeArguments,result.arguments=node.arguments,this.finishNodeAt(result,"NewExpression",node.end,node.loc?.end)}parseExprOp(left,leftStartPos,leftStartLoc,minPrec,forInit){if(tt._in.binop>minPrec&&this.type===tt.name&&(this.value==="as"||this.value==="satisfies")&&!this.containsEsc&&!this.hasPrecedingLineBreak()){let isSatisfies=this.value==="satisfies",node=this.startNodeAt(leftStartPos,leftStartLoc);return node.expression=left,node.typeAnnotation=this.$a(()=>{if(this.next(),!isSatisfies&&this.type===tt._const){let reference=this.startNode();return reference.typeName=this.parseIdent(!0),this.finishNode(reference,"TSTypeReference")}return this.$0()}),this.finishNode(node,isSatisfies?"TSSatisfiesExpression":"TSAsExpression"),this.parseExprOp(node,leftStartPos,leftStartLoc,minPrec,forInit)}return super.parseExprOp(left,leftStartPos,leftStartLoc,minPrec,forInit)}parseGetterSetter(prop){prop.kind=prop.key.name,super.parseGetterSetter(prop)}parsePropertyValue(prop,isPattern,isGenerator,isAsync,startPos,startLoc,refDestructuringErrors,containsEsc){if(!isPattern&&this.$1()){if(this.$k=this.$8(),this.type!==tt.parenL)this.unexpected();prop.kind="init"}return super.parsePropertyValue(prop,isPattern,isGenerator,isAsync,startPos,startLoc,refDestructuringErrors,containsEsc)}}return TSParser});var TypeScriptParser=extendParser(declarations,tsPlugin,tweaks);function parseModuleWith(source,options,typescript){return setSource(source),parseProgram({isTypeScript:options.typescript??!1,typescript,loc:options.loc??!1,comments:options.comments??!0,root:{comments:[]}},source)}function parseModule(source,options={}){return parseModuleWith(source,options,TypeScriptParser)}var ROUTE_FILES=new Set(["+page","+layout","+page.server","+layout.server","+server"]),EXTENSION=/\.[^./]+$/,SCRIPT=/\.[cm]?[jt]s$/,TS_FILE=/\.[cm]?ts$/,JSDOC_BLOCK=/\/\*\*[\s\S]*?\*\//g,JSDOC_FUNCTION=/@(type|param)\b/,JSDOC_VARIABLE=/@(type|satisfies)\b/,API_METHODS=["GET","PUT","POST","PATCH","DELETE","OPTIONS","HEAD","fallback"],PAGE_OPTIONS=[["prerender","boolean | 'auto'"],["trailingSlash","'never' | 'always' | 'ignore'"],["ssr","boolean"],["csr","boolean"]];function isKitRouteFile2(basename){let name=basename.includes("@")?basename.split("@")[0]:basename.replace(EXTENSION,"");return ROUTE_FILES.has(name??"")}function isKitErrorFile2(basename){return basename.replace(EXTENSION,"")==="+error"}function isHooksFile(path,basename,hooks){return(basename==="index.ts"||basename==="index.js")&&path.slice(0,-basename.length-1).endsWith(hooks)||path.replace(EXTENSION,"").endsWith(hooks)}function isParamsFile(path,basename){return path.slice(0,-basename.length-1).endsWith("src/params")&&!basename.includes(".test")&&!basename.includes(".spec")}function isKitFile2(path){let posix=path.replaceAll("\\","/"),basename=posix.slice(posix.lastIndexOf("/")+1);if(!SCRIPT.test(basename))return!1;return isKitRouteFile2(basename)||["src/hooks.server","src/hooks.client","src/hooks"].some((hooks)=>isHooksFile(posix,basename,hooks))||isParamsFile(posix,basename)}function kitFile2(path,source,hooksModule){let posix=path.replaceAll("\\","/"),basename=posix.slice(posix.lastIndexOf("/")+1);if(!isKitFile2(posix))return;let isTs=TS_FILE.test(basename),inserts=[],insert=(at,text)=>inserts.push([at,text]),exports=exportsOf(source,isTs),paramEnd=(fn)=>fn.params[0].end,returnAt=(fn)=>fn.type==="ArrowFunctionExpression"?source.lastIndexOf("=>",fn.body.start):fn.body.start,jsdocAt=(e)=>e.node.type==="FunctionDeclaration"?e.statement.start:e.node.start,jsdocParam=(e,type)=>{let p=e.node.params[0],name=p?.type==="Identifier"?p.name:"arg0";insert(jsdocAt(e),`/** @param {${type}} ${name} */ `)},wrap=(init,before,after)=>{insert(init.start,before),insert(init.end,after)},typeFunction=(name,type,returnType,asyncReturnType)=>{let fn=exports.get(name);if(fn?.type!=="function"||fn.node.params.length!==1||fn.typed)return;if(!isTs){insert(jsdocAt(fn),`/** @type {${returnType===void 0?type:`(arg0: ${type}) => ${returnType}`}} */ `);return}if(insert(paramEnd(fn.node),returnType===void 0?`: Parameters<${type}>[0]`:`: ${type}`),fn.node.returnType||!fn.node.body)return;let effective=fn.node.async&&asyncReturnType?asyncReturnType:returnType;insert(returnAt(fn.node),effective===void 0?`: ReturnType<${type}> `:`: ${effective} `)},typeVariable=(name,type)=>{let v=exports.get(name);if(v?.type!=="var"||v.typed||!v.node.init)return;if(isTs)insert(v.node.id.end,` : ${type}`);else wrap(v.node.init,`/** @type {${type}} */ (`,")")};if(isKitRouteFile2(basename)){let kind=basename.includes("layout")?"Layout":"Page",loadType=`import('./$types.js').${kind}${basename.includes("server")?"Server":""}Load`,load=exports.get("load");if(load?.type==="function"&&load.node.params.length===1){if(!load.typed)if(isTs)insert(paramEnd(load.node),`: ${loadType}Event`);else jsdocParam(load,`${loadType}Event`)}else if(load?.type==="var"&&!load.typed&&load.node.init)if(isTs)wrap(load.node.init,"(",`) satisfies ${loadType}`);else wrap(load.node.init,`/** @satisfies {${loadType}} */ (`,")");let entries=exports.get("entries");if(entries?.type==="function"&&entries.node.params.length===0&&!entries.typed&&kind==="Page"){if(isTs&&!entries.node.returnType&&entries.node.body)insert(returnAt(entries.node),": ReturnType<import('./$types.js').EntryGenerator> ");else if(!isTs)insert(jsdocAt(entries),"/** @type {import('./$types.js').EntryGenerator} */ ")}let actions=exports.get("actions");if(actions?.type==="var"&&!actions.typed&&actions.node.init)if(isTs)insert(actions.node.init.end," satisfies import('./$types.js').Actions");else wrap(actions.node.init,"/** @satisfies {import('./$types.js').Actions} */ (",")");for(let[name,type]of PAGE_OPTIONS)typeVariable(name,type);for(let method of API_METHODS)typeFunction(method,"import('./$types.js').RequestEvent","Response | Promise<Response>","Promise<Response>")}else if(isHooksFile(posix,basename,"src/hooks.server"))typeFunction("handleError",`import('${hooksModule}').HandleServerError`),typeFunction("handle",`import('${hooksModule}').Handle`),typeFunction("handleFetch",`import('${hooksModule}').HandleFetch`);else if(isHooksFile(posix,basename,"src/hooks.client"))typeFunction("handleError",`import('${hooksModule}').HandleClientError`);else if(isHooksFile(posix,basename,"src/hooks"))typeFunction("reroute",`import('${hooksModule}').Reroute`);else typeFunction("match","string","boolean");inserts.sort((a,b)=>a[0]-b[0]);let out=new Output(source),at=0;for(let[pos,text]of inserts)out.copy(at,pos).raw(text),at=pos;return out.copy(at,source.length)}function exportsOf(source,isTs){let exports=new Map,previous=0;for(let statement of parseModule(source,{typescript:isTs}).body){let before=previous;if(previous=statement.end,statement.type!=="ExportNamedDeclaration")continue;let d=statement.declaration,jsdoc=(to,tags)=>!isTs&&[...source.slice(before,to).matchAll(JSDOC_BLOCK)].some((m)=>tags.test(m[0])),typedParameter=(fn)=>Boolean(paramType(fn.params[0]))||jsdoc(fn.start,JSDOC_FUNCTION);if(d?.type==="FunctionDeclaration"&&d.id)exports.set(d.id.name,{type:"function",node:d,statement,typed:typedParameter(d)});if(d?.type!=="VariableDeclaration"||d.declarations.length!==1)continue;let declarator=d.declarations[0],init=declarator.init,typed=Boolean(declarator.id.typeAnnotation)||jsdoc(declarator.id.start,JSDOC_VARIABLE)||init?.type==="TSSatisfiesExpression",fn=init?.type==="TSSatisfiesExpression"?init.expression:init;if(fn?.type==="FunctionExpression"||fn?.type==="ArrowFunctionExpression")exports.set(source.slice(declarator.id.start,declarator.id.end),{type:"function",node:fn,statement,typed:typed||typedParameter(fn)});else if(declarator.id.type==="Identifier")exports.set(declarator.id.name,{type:"var",node:declarator,statement,typed})}return exports}function paramType(p){if(!p)return;return p.type==="AssignmentPattern"?p.left.typeAnnotation:p.typeAnnotation}function kitPropType2(basename,name){if(!isKitRouteFile2(basename))return;let layout=basename.includes("layout");if(name==="data")return`import('./$types.js').${layout?"LayoutData":"PageData"}`;if(name==="form")return"import('./$types.js').ActionData";if(name==="snapshot")return"import('./$types.js').Snapshot";return}function kitRuneProp2(basename,name){if(isKitErrorFile2(basename))return name==="error"?"App.Error":void 0;if(!isKitRouteFile2(basename))return;let layout=basename.includes("layout");if(name==="params")return`import('./$types.js').${layout?"LayoutProps":"PageProps"}['params']`;if(name==="data"||name==="form"&&!layout)return kitPropType2(basename,name);return}
|
|
19
|
+
export{setSource,locate3,position,isNode,fieldsOf,mapChildren,assertType,isIdentifierStart,isIdentifierChar,missingTypeScript,ParseError2,attribute_duplicate,attribute_empty_shorthand,block_duplicate_clause,block_invalid_continuation_placement,block_invalid_elseif,block_invalid_placement,block_unclosed,block_unexpected_close,const_tag_invalid_expression,css_empty_declaration,css_expected_identifier,css_selector_invalid,debug_tag_invalid_arguments,declaration_tag_invalid_type,directive_invalid_value,directive_missing_name,element_invalid_closing_tag,element_invalid_closing_tag_autoclosed,element_unclosed,expected_attribute_value,expected_block_type,expected_identifier,expected_pattern,expected_tag,expected_token,expected_whitespace,render_tag_invalid_expression,script_duplicate,script_invalid_attribute_value,script_invalid_context,script_reserved_attribute,style_duplicate,svelte_component_invalid_this,svelte_component_missing_this,svelte_element_missing_this,svelte_meta_duplicate,svelte_meta_invalid_content,svelte_meta_invalid_placement,svelte_meta_invalid_tag,svelte_options_deprecated_tag,svelte_options_invalid_attribute,svelte_options_invalid_attribute_value,svelte_options_invalid_customelement,svelte_options_invalid_customelement_props,svelte_options_invalid_customelement_shadow,svelte_options_invalid_tagname,svelte_options_reserved_tagname,svelte_options_unknown_attribute,tag_invalid_name,tag_invalid_placement,unexpected_eof,unexpected_reserved_word,unterminated_string_constant,void_element_invalid_content,RESERVED_WORDS,parseProgram,parseExpressionAt,parsePatternAt,parseStatementAt,TypeScriptParser,parseModule,isKitRouteFile2,isKitErrorFile2,isKitFile2,kitFile2,kitPropType2,kitRuneProp2};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import{isDigit,isWordCode,scan,closingBracket,lineEnd,skipTrivia,isWordAt,lexComponent2}from"./shared-8badht7e.js";import{createLocator}from"./shared-atsj8zxq.js";function lexImportsExports(source,options={}){let lexer=new Lexer(source);lexer.exportLists=options.exportLists??!1;let statements=[];return scan(source,!1,(_start,keyword)=>{let statement=lexer.statement(keyword);return statements.push(statement),statement.end},lexer.exportLists),statements}class Lexer{source;pos=0;end=0;escapeEnd=0;exportLists=!1;constructor(source){this.source=source}statement(keyword){this.pos=this.end=keyword+6;let statement={kind:this.source.charCodeAt(keyword)===105?"import":"export",start:keyword,end:0,source:null,typeOnly:!1,specifiers:[]};if(!(statement.kind==="import"?this.import(statement):this.export(statement)))statement.source=null,statement.specifiers=[];return statement.end=this.end,statement}import(statement){let module=this.string();if(module!==null)return statement.source=module,this.finish();if(this.isWord("type")){let next=this.peekAfter(4);if(next===123||next===42||isIdentifierStart(next)&&!this.isWordAfter(4,"from"))statement.typeOnly=!0,this.advance(4)}let{specifiers,typeOnly}=statement,next=this.at();if(next!==123&&next!==42){let start=this.pos,local=this.name();if(local===null)return!1;if(this.at()===61)return this.importEquals();if(specifiers.push({kind:"default",imported:"default",local,typeOnly,start,end:this.end}),!this.eat(44))return this.from(statement);next=this.at()}if(next===42){let start=this.pos;if(this.advance(1),!this.eatWord("as"))return!1;let local=this.name();if(local===null)return!1;return specifiers.push({kind:"namespace",imported:"*",local,typeOnly,start,end:this.end}),this.from(statement)}if(!this.eat(123))return!1;while(!this.eat(125)){let start=this.skip(),named=this.typeModifier()||typeOnly,name=this.name(),imported=name??this.string()?.value;if(imported===void 0)return!1;let local=name;if(this.eatWord("as"))local=this.name();if(local===null)return!1;if(specifiers.push({kind:"named",imported,local,typeOnly:named,start,end:this.end}),!this.eat(44)&&this.at()!==125)return!1}return this.from(statement)}export(statement){if(this.eatWord("import")){if(this.isWord("type")&&isIdentifierStart(this.peekAfter(4))&&!this.isWordAfter(4,"from"))statement.typeOnly=!0,this.advance(4);return this.name()!==null&&this.at()===61&&this.importEquals()}if(this.isWord("type")){let next=this.peekAfter(4);if(next===123||next===42)statement.typeOnly=!0,this.advance(4)}let{specifiers,typeOnly}=statement;if(this.at()===42){let start=this.pos;this.advance(1);let exported=null;if(this.eatWord("as")){if(exported=this.moduleExportName(),exported===null)return!1}return specifiers.push({kind:exported===null?"all":"namespace",local:"*",exported,typeOnly,start,end:this.end}),this.from(statement)}if(!this.eat(123))return!1;while(!this.eat(125)){let start=this.skip(),named=this.typeModifier()||typeOnly,local=this.moduleExportName();if(local===null)return!1;let exported=local;if(this.eatWord("as"))exported=this.moduleExportName();if(exported===null)return!1;if(specifiers.push({kind:"named",local,exported,typeOnly:named,start,end:this.end}),!this.eat(44)&&this.at()!==125)return!1}if(this.exportLists&&!this.isWord("from")){for(let specifier of specifiers)specifier.kind="local";return this.eat(59),!0}return this.from(statement)}dynamicImport(start,member){let isImport=this.source.charCodeAt(start)===105;this.pos=this.end=start+(isImport?6:7);let kind=isImport?"import":"require";if(isImport&&this.eat(46)){if(!this.eatWord("meta")||!this.eat(46)||!this.eatWord("glob")||!this.typeArguments())return null;kind="glob"}if(!this.eat(40))return null;let argument=this.skip(),source=this.string()??this.template(),close=this.at()===41?this.pos:-1;if(close===-1){if(this.at()!==44)source=null;close=closingBracket(this.source,argument)}if(member&&kind!=="glob"){let after=this.source.charCodeAt(skipTrivia(this.source,close+1));if(after===123||after===58)return null}return{kind,source,start,end:Math.min(close+1,this.source.length)}}typeArguments(){if(this.at()!==60)return!0;let source=this.source,depth=0;for(let i=this.pos;i<source.length;i=skipTrivia(source,i+1)){let code=source.charCodeAt(i);if(code===34||code===39||code===96){let end=source.indexOf(source[i],i+1);if(end===-1)return!1;i=end}else if(code===60)depth++;else if(code===62&&source.charCodeAt(i-1)!==61){if(--depth===0)return this.advance(i+1-this.pos),!0}}return!1}template(){let source=this.source,start=this.skip();if(source.charCodeAt(start)!==96)return null;for(let i=start+1;i<source.length;i++){let code=source.charCodeAt(i);if(code===96){let value=this.cooked(start+1,i,!0);if(value===null)return null;return this.advance(i+1-start),{value,start,end:i+1}}if(code===92)i++;else if(code===36&&source.charCodeAt(i+1)===123)return null}return null}typeModifier(){if(!this.isWord("type"))return!1;let next=this.peekAfter(4);if(next===34||next===39||isIdentifierStart(next)&&!this.isWordAfter(4,"as"))return this.advance(4),!0;return!1}importEquals(){if(this.advance(1),this.isWord("require")&&this.peekAfter(7)===40){if(this.advance(7),this.eat(40),this.string()===null||!this.eat(41))return!1}else do if(this.name()===null)return!1;while(this.eat(46));return this.eat(59),!0}from(statement){if(!this.eatWord("from"))return!1;return statement.source=this.string(),statement.source!==null&&this.finish()}finish(){let keyword=this.isWord("with")?4:0;if(this.isWord("assert")&&lineEnd(this.source,this.end)>=this.pos)keyword=6;if(keyword!==0&&this.peekAfter(keyword)===123){this.advance(keyword),this.eat(123);while(!this.eat(125))if(this.string()===null&&this.name()===null&&!this.eat(58)&&!this.eat(44))return!1}return this.eat(59),!0}skip(){return this.pos=skipTrivia(this.source,this.pos),this.pos}at(){return this.source.charCodeAt(this.skip())}advance(length){this.pos+=length,this.end=this.pos}peekAfter(length){return this.source.charCodeAt(skipTrivia(this.source,this.pos+length))}isWordAfter(length,word){return isWordAt(this.source,skipTrivia(this.source,this.pos+length),word)}eat(code){if(this.at()!==code)return!1;return this.advance(1),!0}isWord(word){return isWordAt(this.source,this.skip(),word)}eatWord(word){if(!this.isWord(word))return!1;return this.advance(word.length),!0}moduleExportName(){return this.name()??this.string()?.value??null}name(){let source=this.source,start=this.skip();if(!isWordCode(source.charCodeAt(start))||isDigit(source.charCodeAt(start)))return null;let value="",chunk=start,i=start;while(i<source.length){let code=source.charCodeAt(i);if(code===92){if(source.charCodeAt(i+1)!==117)return null;let escaped=this.unicodeEscape(i+2);if(escaped===null)return null;value+=source.slice(chunk,i)+escaped,i=chunk=this.escapeEnd}else if(isWordCode(code))i++;else break}return this.advance(i-start),value+source.slice(chunk,i)}string(){let source=this.source,start=this.skip(),quote=source.charCodeAt(start);if(quote!==34&"e!==39)return null;let value="",chunk=start+1;for(let i=chunk;i<source.length;){let code=source.charCodeAt(i);if(code===quote)return this.advance(i+1-start),{value:value+source.slice(chunk,i),start,end:i+1};if(code===10||code===13)return null;if(code===92){let escaped=this.escape(i+1);if(escaped===null)return null;value+=source.slice(chunk,i)+escaped,i=chunk=this.escapeEnd}else i++}return null}cooked(from,to,template){let source=this.source,value="",chunk=from;for(let i=from;i<to;){let code=source.charCodeAt(i);if(code===92){let escaped=this.escape(i+1);if(escaped===null)return null;value+=source.slice(chunk,i)+escaped,i=chunk=this.escapeEnd}else if(code===13&&template)value+=`${source.slice(chunk,i)}
|
|
2
|
+
`,i+=source.charCodeAt(i+1)===10?2:1,chunk=i;else i++}return value+source.slice(chunk,to)}escape(pos){let code=this.source.charCodeAt(pos);switch(this.escapeEnd=pos+1,code){case 110:return`
|
|
3
|
+
`;case 114:return"\r";case 116:return"\t";case 98:return"\b";case 118:return"\v";case 102:return"\f";case 48:return isDigit(this.source.charCodeAt(pos+1))?null:"\x00";case 120:return this.hexEscape(pos+1,2);case 117:return this.unicodeEscape(pos+1);case 13:if(this.source.charCodeAt(pos+1)===10)this.escapeEnd++;return"";case 10:case 8232:case 8233:return"";default:return isDigit(code)||pos>=this.source.length?null:String.fromCharCode(code)}}unicodeEscape(pos){if(this.source.charCodeAt(pos)!==123)return this.hexEscape(pos,4);let value=0,i=pos+1;for(;this.source.charCodeAt(i)!==125;i++){let digit=hexValue(this.source.charCodeAt(i));if(digit===-1)return null;if(value=value*16+digit,value>1114111)return null}if(i===pos+1)return null;return this.escapeEnd=i+1,String.fromCodePoint(value)}hexEscape(pos,length){let value=0;for(let i=pos;i<pos+length;i++){let digit=hexValue(this.source.charCodeAt(i));if(digit===-1)return null;value=value*16+digit}return this.escapeEnd=pos+length,String.fromCharCode(value)}}function isIdentifierStart(code){return code!==92&&isWordCode(code)&&!isDigit(code)}function hexValue(code){if(isDigit(code))return code-48;let lower=code|32;return lower>=97&&lower<=102?lower-87:-1}import{createRequire as createRequire2}from"node:module";import{dirname as dirname2,join as join2,resolve}from"node:path";import{Worker}from"node:worker_threads";import{existsSync,readFileSync}from"node:fs";import{createRequire}from"node:module";import{basename,dirname,join}from"node:path";import{pathToFileURL}from"node:url";var VITE_CONFIGS=["js","mjs","ts","cjs","mts","cts"].map((ext)=>`vite.config.${ext}`),SVELTE_CONFIGS=["js","cjs","mjs",...process.versions.bun||process.features.typescript?["ts","mts"]:[]].map((ext)=>`svelte.config.${ext}`),SVELTE_CONFIG=/^svelte\.config\./;async function svelteConfigOf(dir,explicit){let config=(explicit?await fromFile(explicit):await fromDir(dir))??{},{preprocess}=config;return{preprocess:preprocess&&(Array.isArray(preprocess)?preprocess:[preprocess]),compilerOptions:{dev:!0,...config.compilerOptions}}}function configFingerprint(dir,explicit){let parts=[],add=(path)=>{try{parts.push(path,readFileSync(path,"utf-8"))}catch{}};if(explicit)add(explicit);else for(let at=dir;;at=dirname(at)){for(let name of[...VITE_CONFIGS,...SVELTE_CONFIGS]){let path=join(at,name);if(existsSync(path))add(path)}if(dirname(at)===at)break}return JSON.stringify(parts)}function configNeedsChdir(dir,explicit){let cwd=process.cwd();if(explicit)return!SVELTE_CONFIG.test(basename(explicit))&&dirname(explicit)!==cwd;for(let at=dir;;at=dirname(at)){if(at!==cwd&&firstIn(at,VITE_CONFIGS))return!0;if(dirname(at)===at)return!1}}var firstIn=(dir,names)=>names.map((name)=>join(dir,name)).find((path)=>existsSync(path));async function fromFile(path){if(SVELTE_CONFIG.test(basename(path)))return fromSvelteConfig(path);let result=await fromVite(dirname(path),path);return result==="error"?void 0:result??fromSvelteConfig(path)}async function fromDir(dir){for(let at=dir;;at=dirname(at)){let vite=firstIn(at,VITE_CONFIGS),result=vite?await fromVite(at,vite):void 0;if(result&&result!=="error")return result;let svelte=firstIn(at,SVELTE_CONFIGS);if(svelte)return fromSvelteConfig(svelte);if(result==="error"||dirname(at)===at)return}}async function fromSvelteConfig(path){try{return(await import(pathToFileURL(path).href)).default}catch{return}}var resolving=Promise.resolve();async function fromVite(root,configFile){let vite=await importVite(root);if(!vite)return;let previous=resolving,done=()=>{};resolving=new Promise((resolve)=>{done=resolve}),await previous;let cwd=process.cwd();try{process.chdir(root)}catch{}try{let{plugins}=await vite.resolveConfig({root,configFile,logLevel:"error"},"serve"),options=(name)=>plugins.find((p)=>p.name===name)?.api?.options;return options("vite-plugin-sveltekit-setup")??options("vite-plugin-svelte:config")}catch{return"error"}finally{try{process.chdir(cwd)}catch{}done()}}async function importVite(root){try{let pkgPath=createRequire(join(root,"package.json")).resolve("vite/package.json"),pkg=JSON.parse(readFileSync(pkgPath,"utf-8")),entry=importEntry(pkg.exports?.["."])??pkg.module??pkg.main;if(!entry)return;return await import(pathToFileURL(join(dirname(pkgPath),entry)).href)}catch{return}}function importEntry(entry){if(typeof entry==="string")return entry;if(!entry||typeof entry!=="object")return;let{import:imported,default:fallback}=entry;if(typeof imported==="string")return imported;if(imported&&typeof imported==="object"){let nested=imported.default;if(typeof nested==="string")return nested}return typeof fallback==="string"?fallback:void 0}var DIGITS=new Map([..."ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"].map((char,i)=>[char,i]));function decode(mappings){let lines=[],line=0,originalColumn=0;for(let encoded of mappings.split(";")){let segments=[],column=0;for(let segment of encoded.split(",")){if(!segment)continue;let fields=[],value=0,shift=0;for(let char of segment){let digit=DIGITS.get(char)??0;if(value+=(digit&31)<<shift,digit&32)shift+=5;else fields.push(value&1?-(value>>>1):value>>>1),value=0,shift=0}if(column+=fields[0]??0,fields.length<4)continue;line+=fields[2]??0,originalColumn+=fields[3]??0,segments.push([column,line,originalColumn])}lines.push(segments)}return lines}function originalPosition(map){if(!map)return(line,column)=>({line,column});let lines=decode(map.mappings);return(line,column)=>{let segments=lines[line-1]??[],found;for(let segment of segments){if(segment[0]>column-1)break;found=segment}if(!found)return{line,column};return{line:found[1]+1,column:found[2]+(column-1-found[0])+1}}}function svelteDirOf(cwd,svelte){return svelte?resolve(cwd,svelte):dirname2(createRequire2(join2(cwd,"package.json")).resolve("svelte/package.json"))}var compilers=new Map;function compilerOf(svelteDir){let compiler=compilers.get(svelteDir);if(!compiler)compiler=createRequire2(join2(svelteDir,"package.json"))("svelte/compiler"),compilers.set(svelteDir,compiler);return compiler}function diagnosticsOf(compiler,source,filename,compilerOptions={}){try{let{warnings}=compiler.compile(source,{...compilerOptions,filename,generate:!1});return warnings.map((w)=>({severity:"warning",code:w.code,message:w.message,...positionsOf(w)}))}catch(error){let e=error;return[{severity:"error",code:e.code??"compile_error",message:e.message,...positionsOf(e)}]}}function positionsOf(w){let line=w.start?.line??1,column=(w.start?.column??0)+1;return{line,column,endLine:w.end?.line??line,endColumn:w.end?w.end.column+1:column}}function compilerDiagnostics2(source,filename,options={}){let compiler=compilerOf(svelteDirOf(resolve(options.cwd??process.cwd()),options.svelte));return diagnosticsOf(compiler,source,filename)}async function preprocessedDiagnostics(source,filename,svelteDir,config){let compiler=compilerOf(svelteDir),{preprocess,compilerOptions}=config,diagnostics,processed=preprocess?await compiler.preprocess(source,preprocess,{filename}):void 0;if(!processed||processed.code===source)diagnostics=diagnosticsOf(compiler,source,filename,compilerOptions);else{let map=typeof processed.map==="string"?JSON.parse(processed.map):processed.map,toOriginal=originalPosition(map);diagnostics=diagnosticsOf(compiler,processed.code,filename,compilerOptions).map((d)=>{let start=toOriginal(d.line,d.column),end=toOriginal(d.endLine??d.line,d.endColumn??d.column);return{...d,...start,endLine:end.line,endColumn:end.column}})}return asSvelteCheck(diagnostics,source,Boolean(preprocess))}async function compileAll(request){let config=await svelteConfigOf(request.configDir,request.configFile);return Promise.all(request.components.map(({source,filename})=>preprocessedDiagnostics(source,filename,request.svelteDir,config)))}var worker,pending=new Map,nextId=0;function startWorker(){let file=import.meta.url.endsWith(".ts")?"compile-worker.ts":"compile-worker.js",started=new Worker(new URL(file,import.meta.url));started.on("message",(reply)=>{let job=pending.get(reply.id);if(!job)return;if(pending.delete(reply.id),pending.size===0)started.unref();if(reply.results)job.done(reply.results);else job.fail(Error(reply.error))});let fallBack=()=>{if(worker!==started)return;worker=void 0;let jobs=[...pending.values()];pending.clear();for(let job of jobs)compileAll(job.request).then(job.done,job.fail)};return started.on("error",fallBack),started.on("exit",fallBack),started}function compileOffThread(request){if(configNeedsChdir(request.configDir,request.configFile))return;try{worker??=startWorker()}catch{return}let id=nextId++,running=worker;return new Promise((done,fail)=>{pending.set(id,{request,done,fail}),running.ref(),running.postMessage({id,request})})}var TEXT_TYPE=/^text\//,EXPORTED_TYPE=(name)=>new RegExp(`\\bexport\\s+?(enum|namespace)\\s+?${name}\\b`);function asSvelteCheck(diagnostics,source,preprocessed){let lexed=lexComponent2(source),script=lexed.instance??lexed.module,langOf=(attributes=[])=>{let lang=attributes.find((a)=>a.name==="lang")??attributes.find((a)=>a.name==="type");return typeof lang?.value==="string"?lang.value.replace(TEXT_TYPE,""):""},scriptLang=langOf(script?.attributes),styleLang=langOf(lexed.css?.attributes),ignoreScript=!preprocessed&&scriptLang!==""&&scriptLang!=="ts",ignoreStyle=!preprocessed&&styleLang!=="",offsetOf=createLocator(source).offset,inside=(d,tag)=>{if(!tag)return!1;let at=offsetOf(d.line,d.column);return tag.content.start<=at&&at<=tag.content.end},kept=[];for(let d of diagnostics){if(d.severity==="error"){if(d.message.includes("expected")){if(!preprocessed&&(scriptLang||styleLang))continue;let inScript=inside(d,script);if(inScript||inside(d,lexed.css))d.message+=`
|
|
4
|
+
|
|
5
|
+
If you expect this syntax to work, here are some suggestions: `+(inScript?'\nIf you use typescript with `svelte-preprocess`, did you add `lang="ts"` to your `script` tag? ':'\nIf you use less/SCSS with `svelte-preprocess`, did you add `lang="scss"`/`lang="less"` to your `style` tag? If you use SCSS, it may be necessary to add the path to your NODE runtime to the setting `svelte.language-server.runtime`, or use `sass` instead of `node-sass`. ')+"\nDid you setup a `svelte.config.js` or `vite.config.js`? \nSee https://github.com/sveltejs/language-tools/tree/master/docs#using-with-preprocessors for more info."}kept.push(d);continue}if(ignoreScript&&!d.code.startsWith("a11y"))continue;if(ignoreStyle&&(d.code==="css_unused_selector"||d.code==="css-unused-selector"))continue;if(d.code==="export_let_unused"||d.code==="unused-export-let"){let name=d.message.slice(d.message.indexOf("'")+1,d.message.lastIndexOf("'"));if(EXPORTED_TYPE(name).test(source))continue}kept.push(d)}return kept}
|
|
6
|
+
export{lexImportsExports,configFingerprint,svelteDirOf,compilerDiagnostics2,compileAll,compileOffThread};
|