sveast 0.9.5 → 0.9.7
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/README.md +49 -4
- package/a11y.d.ts +1636 -0
- package/a11y.js +36 -0
- package/core.js +1 -1
- package/index.d.ts +39 -7
- package/index.js +1 -1
- package/is-valid-type.js +1 -1
- package/lexer.d.ts +39 -7
- package/lexer.js +2 -2
- package/module.js +1 -1
- package/package.json +6 -1
- package/parse-imports-exports.js +1 -1
- package/parse-module.js +1 -1
- package/parse-sections.js +1 -1
- package/parse.js +1 -1
- package/runes.js +1 -1
- package/{shared-rce4ty8a.js → shared-a23q4q40.js} +1 -1
- package/shared-dscc5xg8.js +2 -0
- package/shared-e4gbs4rb.js +3 -0
- package/{shared-cs1ezg1f.js → shared-f45stvzk.js} +1 -1
- package/{shared-rvkvagj5.js → shared-k0xcpcmz.js} +1 -1
- package/{shared-qkp49nav.js → shared-nb0h4j83.js} +1 -1
- package/{shared-xwzsb4m8.js → shared-qqrqzz29.js} +1 -1
- package/shared-s46wfvhw.js +10 -0
- package/{shared-nan648gn.js → shared-w3mxqtgj.js} +1 -1
- package/{shared-z9y4mrek.js → shared-x2vs5571.js} +1 -1
- package/{shared-y41kz9tv.js → shared-xmc2pnaf.js} +1 -1
- package/typescript.js +1 -1
- package/shared-2pngd0mg.js +0 -10
- package/shared-ke0fgd3r.js +0 -2
- package/shared-y3nf00py.js +0 -3
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{closingTagOmitted}from"./shared-dgdrqgdn.js";import{setSource,locate3,position,mapChildren,assertType}from"./shared-m0dcdh24.js";import{isIdentifierStart,isIdentifierChar}from"./shared-2pngd0mg.js";import{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}from"./shared-nan648gn.js";import{withoutByteOrderMark,isDigit,isWhitespace,skipWhitespace,isTypeScript,closingScriptTag,closingScriptTagEnd,isVoid,styleContentEnd,isQuote,nameEnd,endsUnquotedValue}from"./shared-5tpb3h6x.js";import{decodeCharacterReferences}from"./shared-bzqbnvee.js";import{missingTypeScript}from"./shared-h6z1kjbb.js";var REGEX_NON_LF_LINE_BREAK=/\r(?!\n)|[\u2028\u2029]/,REGEX_WHITESPACE_THEN_CLOSING_BRACE=/\s*}/y;function scanIdentifier(source,from){let code=source.codePointAt(from);if(code===void 0||!isIdentifierStart(code,!0))return from;let end=from+(code<=65535?1:2),next=source.codePointAt(end);while(next!==void 0&&isIdentifierChar(next,!0))end+=next<=65535?1:2,next=source.codePointAt(end);return end}class TemplateParserState{source;index=0;loc;lfOnly;isTypeScript;typescript;entityNames;css;script;comments;root;stack;fragments;metaTags=new Set;lastAutoClosedTag;nextAngle=-1;nextBrace=-1;constructor(source,originalLength,support,options={}){if(this.source=source,this.loc=options.loc??!1,this.lfOnly=this.loc&&!REGEX_NON_LF_LINE_BREAK.test(source),this.isTypeScript=isTypeScript(source),this.typescript=support.typescript,this.isTypeScript&&!this.typescript)missingTypeScript();this.entityNames=support.entityNames,this.css=options.css??!0,this.script=options.script??!0,this.comments=options.comments??!0,this.root={type:"Root",start:0,end:originalLength,css:null,js:[],options:null,fragment:{type:"Fragment",nodes:[]},comments:[]},this.stack=[this.root],this.fragments=[this.root.fragment]}match(str){if(str.length===1)return this.source.charCodeAt(this.index)===str.charCodeAt(0);return this.source.startsWith(str,this.index)}matchRegex(pattern){return pattern.lastIndex=this.index,pattern.exec(this.source)?.[0]??null}eat(str,required=!1){if(this.match(str))return this.index+=str.length,!0;if(required)expected_token(this.index,str);return!1}read(pattern){let result=this.matchRegex(pattern);if(result)this.index+=result.length;return result}readUntil(needle){if(this.index>=this.source.length)unexpected_eof(this.source.length);let found=this.source.indexOf(needle,this.index),end=found===-1?this.source.length:found,result=this.source.slice(this.index,end);return this.index=end,result}allowWhitespace(){this.index=skipWhitespace(this.source,this.index)}requireWhitespace(){if(!isWhitespace(this.source.charCodeAt(this.index)))expected_whitespace(this.index);this.allowWhitespace()}eatClosingBrace(){this.allowWhitespace(),this.eat("}",!0)}sourceLocation(start,end){return this.loc?{start:locate3(start),end:locate3(end)}:void 0}readIdentifierName(){let start=this.index,end=scanIdentifier(this.source,start),name=this.source.slice(start,end);if(this.index=end,RESERVED_WORDS.has(name))unexpected_reserved_word(start,name);let identifier={type:"Identifier",name,start,end};if(this.loc)identifier.loc=this.sourceLocation(start,end);return identifier}current(){return this.stack[this.stack.length-1]}append(node){this.fragments[this.fragments.length-1].nodes.push(node)}open(node,fragment){this.append(node),this.stack.push(node),this.fragments.push(fragment)}setFragment(fragment){this.fragments[this.fragments.length-1]=fragment}close(){this.stack.pop(),this.fragments.pop()}}var PRECEDENCE={"||":1,"??":1,"&&":2,"==":6,"!=":6,"===":6,"!==":6,"<":7,">":7,"<=":7,">=":7,"+":9,"-":9,"*":10,"/":10,"%":10};function literal(source,start,end,value){return{type:"Literal",start,end,value,raw:source.slice(start,end)}}function scanLiteral(source,from){let first=source.charCodeAt(from);if(first===34||first===39){for(let end=from+1;end<source.length;end++){let code=source.charCodeAt(end);if(code===first)return literal(source,from,end+1,source.slice(from+1,end));if(code===92||code===10||code===13)return null}return null}let end=from;for(;end<source.length;end++){let code=source.charCodeAt(end);if(code<48||code>57)break}if(end===from||first===48&&end-from>1)return null;return literal(source,from,end,Number(source.slice(from,end)))}function scanAtom(source,from,typescript){let identifierEnd=scanIdentifier(source,from);if(identifierEnd===from)return scanLiteral(source,from);let name=source.slice(from,identifierEnd);if(name==="true"||name==="false"||name==="null")return literal(source,from,identifierEnd,name==="null"?null:name==="true");if(RESERVED_WORDS.has(name))return null;let node={type:"Identifier",start:from,end:identifierEnd,name};for(let index=identifierEnd;;){let next=source.charCodeAt(index);if(next===40){let call=scanArguments(source,index+1,typescript);if(!call)return null;node={type:"CallExpression",start:from,end:call.end,callee:node,arguments:call.arguments,optional:!1},index=call.end;continue}let property,end;if(next===46){if(end=scanIdentifier(source,index+1),end===index+1)return null;property={type:"Identifier",start:index+1,end,name:source.slice(index+1,end)}}else if(next===91){if(property=scanLiteral(source,index+1),!property||source.charCodeAt(property.end)!==93)return null;end=property.end+1}else return node;node={type:"MemberExpression",start:from,end,object:node,property,computed:next===91,optional:!1},index=end}}function scanArguments(source,from,typescript){let args=[],index=skipWhitespace(source,from);if(source.charCodeAt(index)===41)return{arguments:args,end:index+1};for(;;){let argument=scanConditional(source,index,typescript);if(!argument)return null;args.push(argument),index=skipWhitespace(source,argument.end);let code=source.charCodeAt(index);if(code===41)return{arguments:args,end:index+1};if(code!==44)return null;if(index=skipWhitespace(source,index+1),source.charCodeAt(index)===41)return null}}function scanUnary(source,from,typescript){let code=source.charCodeAt(from),next=source.charCodeAt(from+1);if(!(code===33&&next!==61)&&!(code===45&&next!==45&&next!==61))return scanAtom(source,from,typescript);let argument=scanUnary(source,skipWhitespace(source,from+1),typescript);if(!argument)return null;return{type:"UnaryExpression",start:from,end:argument.end,operator:code===33?"!":"-",prefix:!0,argument}}function operatorAt(source,index,typescript){let code=source.charCodeAt(index),next=source.charCodeAt(index+1);switch(code){case 124:return next===124&&source.charCodeAt(index+2)!==61?"||":null;case 38:return next===38&&source.charCodeAt(index+2)!==61?"&&":null;case 63:return next===63&&source.charCodeAt(index+2)!==61?"??":null;case 61:if(next!==61)return null;return source.charCodeAt(index+2)===61?"===":"==";case 33:if(next!==61)return null;return source.charCodeAt(index+2)===61?"!==":"!=";case 60:case 62:if(typescript||next===code)return null;if(next===61)return code===60?"<=":">=";return code===60?"<":">";case 43:return next===43||next===61?null:"+";case 45:return next===45||next===61?null:"-";case 42:return next===42||next===61?null:"*";case 47:return next===47||next===42||next===61?null:"/";case 37:return next===61?null:"%";default:return null}}function scanBinary(source,left,minPrecedence,typescript){if(isClosing(source.charCodeAt(left.end)))return left;let index=skipWhitespace(source,left.end),operator=operatorAt(source,index,typescript);if(operator===null)return left;let precedence=PRECEDENCE[operator];if(precedence<=minPrecedence)return left;let operand=scanUnary(source,skipWhitespace(source,index+operator.length),typescript);if(!operand)return null;let right=scanBinary(source,operand,operator==="??"?2:precedence,typescript);if(!right)return null;let node;if(operator==="||"||operator==="&&"||operator==="??"){let after=operatorAt(source,skipWhitespace(source,right.end),typescript);if(operator==="??"?after==="||"||after==="&&":after==="??")return null;node={type:"LogicalExpression",start:left.start,end:right.end,left,operator,right}}else node={type:"BinaryExpression",start:left.start,end:right.end,left,operator,right};return scanBinary(source,node,minPrecedence,typescript)}function scanConditional(source,from,typescript){let operand=scanUnary(source,from,typescript);if(!operand)return null;let test=scanBinary(source,operand,-1,typescript);if(!test||isClosing(source.charCodeAt(test.end)))return test;let question=skipWhitespace(source,test.end);if(source.charCodeAt(question)!==63)return test;let next=source.charCodeAt(question+1);if(next===46||next===63)return null;let consequent=scanConditional(source,skipWhitespace(source,question+1),typescript);if(!consequent)return null;let colon=skipWhitespace(source,consequent.end);if(source.charCodeAt(colon)!==58)return null;let alternate=scanConditional(source,skipWhitespace(source,colon+1),typescript);if(!alternate)return null;return{type:"ConditionalExpression",start:test.start,end:alternate.end,test,consequent,alternate}}function isClosing(code){return code===125||code===41||code===44||code===58}function atTerminator(source,from){let code=source.charCodeAt(skipWhitespace(source,from));return code===125||code===41}function scanTrivialExpression(source,from,typescript){let node=scanConditional(source,from,typescript);return node&&atTerminator(source,node.end)?node:null}function addLocations(node){switch(node.loc={start:position(node.start),end:position(node.end)},node.type){case"MemberExpression":addLocations(node.object),addLocations(node.property);break;case"CallExpression":addLocations(node.callee);for(let argument of node.arguments)addLocations(argument);break;case"UnaryExpression":addLocations(node.argument);break;case"BinaryExpression":case"LogicalExpression":addLocations(node.left),addLocations(node.right);break;case"ConditionalExpression":addLocations(node.test),addLocations(node.consequent),addLocations(node.alternate);break}}function readExpression(state){let trivial=!state.loc||state.lfOnly?scanTrivialExpression(state.source,state.index,state.isTypeScript):null;if(trivial){if(state.index=trivial.end,state.loc)addLocations(trivial);return trivial}let{node,end}=parseExpressionAt(state,state.source,state.index);return state.index=end,node}var RESERVED_ATTRIBUTES=new Set(["server","client","worker","test","default"]);function readScript(state,start,attributes){let{source,index:scriptStart}=state;if(scriptStart>=source.length)unexpected_eof(source.length);let close=closingScriptTag(source,scriptStart);if(close===-1)element_unclosed(source.length,"script");state.index=closingScriptTagEnd(source,close);let program=state.script?parseProgram(state,source.slice(0,close),scriptStart):{type:"Program",start:scriptStart,end:close,body:[],sourceType:"module"};if(program.start=scriptStart,program.loc)Object.assign(program.loc.start,position(start)),Object.assign(program.loc.end,position(state.index));else if(state.loc)program.loc={start:position(start),end:position(state.index)};let context="default";for(let attribute of attributes){if(RESERVED_ATTRIBUTES.has(attribute.name))script_reserved_attribute(attribute,attribute.name);if(attribute.name==="module"){if(attribute.value!==!0)script_invalid_attribute_value(attribute,attribute.name);context="module"}if(attribute.name==="context"){let value=attribute.value;if(!Array.isArray(value)||value.length!==1||value[0].type!=="Text"||value[0].data!=="module")script_invalid_context(attribute);context="module"}}return{type:"Script",start,end:state.index,context,content:program,attributes}}var REGEX_NTH_OF=/(even|odd|\+?(\d+|\d*n(\s*[+-]\s*\d+)?)|-\d*n(\s*\+\s*\d+))((?=\s*[,)])|\s+of(\s+|(?=[.#[*:&])))/y,REGEX_PERCENTAGE=/\d+(\.\d+)?%/y,REGEX_UNICODE_SEQUENCE=/\\[0-9a-fA-F]{1,6}(\r\n|\s)?/y,REGEX_CLOSING_STYLE_TAG_END=/\s*>/y,NONE=-1,DOUBLE_QUOTE=34,HASH=35,DOLLAR=36,AMPERSAND=38,SINGLE_QUOTE=39,OPEN_PAREN=40,CLOSE_PAREN=41,ASTERISK=42,PLUS=43,HYPHEN=45,DOT=46,SLASH=47,COLON=58,SEMICOLON=59,LESS_THAN=60,EQUALS=61,GREATER_THAN=62,OPEN_BRACKET=91,BACKSLASH=92,CLOSE_BRACKET=93,CARET=94,OPEN_BRACE=123,PIPE=124,CLOSE_BRACE=125,TILDE=126,comments=[];function readStyle(state,start,attributes){let contentStart=state.index;comments=[];let children=state.css?readBody(state):skipBody(state),contentEnd=state.index;return state.eat("</style",!0),state.read(REGEX_CLOSING_STYLE_TAG_END),{type:"StyleSheet",start,end:state.index,attributes,children,comments,content:{start:contentStart,end:contentEnd,styles:state.source.slice(contentStart,contentEnd),comment:null}}}function skipBody(state){return state.index=styleContentEnd(state.source,state.index),[]}function readBody(state){let children=[];for(;;){if(allowCommentOrWhitespace(state,!0),state.match("</style")||state.index>=state.source.length)break;children.push(state.match("@")?readAtRule(state):readRule(state))}return children}function readAtRule(state){let start=state.index;state.eat("@",!0);let name=readIdentifier(state),prelude=readValue(state,!0),block=null;if(state.match("{"))block=readBlock(state);else state.eat(";",!0);return{type:"Atrule",start,end:state.index,name,prelude,block}}function readRule(state){let start=state.index;return{type:"Rule",prelude:readSelectorList(state,!1),block:readBlock(state),start,end:state.index}}function readSelectorList(state,insidePseudoClass){let children=[];allowCommentOrWhitespace(state,!0);let start=state.index;while(state.index<state.source.length){children.push(readSelector(state,insidePseudoClass));let end=state.index;if(allowCommentOrWhitespace(state,!0),state.match(insidePseudoClass?")":"{"))return{type:"SelectorList",start,end,children};state.eat(",",!0),allowCommentOrWhitespace(state,!0)}return unexpected_eof(state.source.length)}function createRelativeSelector(combinator,start){return{type:"RelativeSelector",combinator,selectors:[],start,end:-1}}function readSelector(state,insidePseudoClass){let{source,index:listStart}=state,children=[],relativeSelector=createRelativeSelector(null,state.index);while(state.index<source.length){let start=state.index,code=source.charCodeAt(start),selectors=relativeSelector.selectors;if(code===AMPERSAND)state.index++,selectors.push({type:"NestingSelector",name:"&",start,end:state.index});else if(code===ASTERISK)state.index++,selectors.push(readTypeSelectorRest(state,start,"*"));else if(code===HASH)state.index++,selectors.push({type:"IdSelector",name:readIdentifier(state),start,end:state.index});else if(code===DOT)state.index++,selectors.push({type:"ClassSelector",name:readIdentifier(state),start,end:state.index});else if(code===COLON){let isElement=source.charCodeAt(start+1)===COLON;state.index+=isElement?2:1;let name=readIdentifier(state),args=null;if(state.eat("("))args=readSelectorList(state,!0),state.eat(")",!0);if(isElement)selectors.push({type:"PseudoElementSelector",name,start,end:state.index,...args&&{args}});else selectors.push({type:"PseudoClassSelector",name,args,start,end:state.index})}else if(code===OPEN_BRACKET)state.index++,selectors.push(readAttributeSelector(state,start));else{let nth=insidePseudoClass?state.read(REGEX_NTH_OF):null,percentage=!nth&&isDigit(code)?state.read(REGEX_PERCENTAGE):null;if(nth)selectors.push({type:"Nth",value:nth,start,end:state.index});else if(percentage)selectors.push({type:"Percentage",value:percentage,start,end:state.index});else if(combinatorLength(source,start)===0){let name=readIdentifier(state);selectors.push(readTypeSelectorRest(state,start,name))}}let index=state.index;allowCommentOrWhitespace(state,!1);let end=state.match(",")||state.match(insidePseudoClass?")":"{");if(state.index=index,end)return relativeSelector.end=index,children.push(relativeSelector),{type:"ComplexSelector",start:listStart,end:index,children};let combinator=readCombinator(state);if(combinator){if(relativeSelector.selectors.length>0)relativeSelector.end=index,children.push(relativeSelector);if(relativeSelector=createRelativeSelector(combinator,combinator.start),state.allowWhitespace(),state.match(",")||state.match(insidePseudoClass?")":"{"))css_selector_invalid(state.index)}}return unexpected_eof(source.length)}function readTypeSelectorRest(state,start,first){let name=first,namespace;if(state.eat("|"))namespace=name,name=state.eat("*")?"*":readIdentifier(state);return{type:"TypeSelector",name,...namespace!==void 0&&{namespace},start,end:state.index}}function readAttributeSelector(state,start){let source=state.source;state.allowWhitespace();let name=readIdentifier(state);state.allowWhitespace();let value=null,matcher=null,code=source.charCodeAt(state.index);if(code===EQUALS)matcher="=";else if((code===TILDE||code===CARET||code===DOLLAR||code===ASTERISK||code===PIPE)&&source.charCodeAt(state.index+1)===EQUALS)matcher=source.slice(state.index,state.index+2);if(matcher)state.index+=matcher.length,state.allowWhitespace(),value=readAttributeValue(state);state.allowWhitespace();let flagsStart=state.index;while(isAsciiLetter(source.charCodeAt(state.index)))state.index++;let flags=state.index>flagsStart?source.slice(flagsStart,state.index):null;return state.allowWhitespace(),state.eat("]",!0),{type:"AttributeSelector",start,end:state.index,name,matcher,value,flags}}function combinatorLength(source,index){let code=source.charCodeAt(index);if(code===PLUS||code===TILDE||code===GREATER_THAN)return 1;if(code===PIPE&&source.charCodeAt(index+1)===PIPE)return 2;return 0}function readCombinator(state){let start=state.index;state.allowWhitespace();let index=state.index,length=combinatorLength(state.source,index);if(length>0){state.index+=length;let end=state.index;return state.allowWhitespace(),{type:"Combinator",name:state.source.slice(index,end),start:index,end}}if(state.index!==start)return{type:"Combinator",name:" ",start,end:state.index};return null}function readBlock(state){let start=state.index;state.eat("{",!0);let children=[];while(state.index<state.source.length){if(allowCommentOrWhitespace(state,!0),state.match("}"))break;children.push(readBlockItem(state))}return state.eat("}",!0),{type:"Block",start,end:state.index,children}}function readBlockItem(state){if(state.match("@"))return readAtRule(state);let start=state.index;readValue(state,!1);let code=state.source.charCodeAt(state.index);return state.index=start,code===OPEN_BRACE?readRule(state):readDeclaration(state)}function readDeclaration(state){let{source,index:start}=state;if(start>=source.length)unexpected_eof(source.length);let propertyEnd=start;while(propertyEnd<source.length){let code=source.charCodeAt(propertyEnd);if(code===COLON||isWhitespace(code))break;propertyEnd++}let property=source.slice(start,propertyEnd);state.index=propertyEnd,state.allowWhitespace(),state.eat(":");let index=state.index;state.allowWhitespace();let value=readValue(state,!0);if(!value&&!property.startsWith("--"))css_empty_declaration({start,end:index});let end=state.index;if(!state.match("}"))state.eat(";",!0);return{type:"Declaration",start,end,property,value}}function readValue(state,capture){let source=state.source,length=source.length,value="",segmentStart=state.index,valueComments=null,escaped=!1,inUrl=!1,quoteMark=NONE,i=state.index;while(i<length){let code=source.charCodeAt(i);if(escaped){escaped=!1,i++;continue}if(code===BACKSLASH){escaped=!0,i++;continue}if(code===quoteMark)quoteMark=NONE;else if(code===CLOSE_PAREN)inUrl=!1;else if(quoteMark===NONE&&(code===DOUBLE_QUOTE||code===SINGLE_QUOTE))quoteMark=code;else if(code===OPEN_PAREN){if(endsWithUrl(source,value,segmentStart,i))inUrl=!0}else if((code===SEMICOLON||code===OPEN_BRACE||code===CLOSE_BRACE)&&!inUrl&"eMark===NONE){if(state.index=i,!capture)return"";if(value+=source.slice(segmentStart,i),valueComments){let leadingWhitespace=value.length-value.trimStart().length;for(let comment of valueComments)comment.position=Math.max(0,(comment.position??0)-leadingWhitespace)}return value.trim()}else if(code===SLASH&&!inUrl&"eMark===NONE&&source.charCodeAt(i+1)===ASTERISK){value+=source.slice(segmentStart,i),state.index=i;let comment=readComment(state);if(capture)comment.position=value.length,comments.push(comment),valueComments??=[],valueComments.push(comment);i=state.index,segmentStart=i;continue}i++}return state.index=length,unexpected_eof(length)}function endsWithUrl(source,value,segmentStart,end){if(end-segmentStart>=3)return source.charCodeAt(end-3)===117&&source.charCodeAt(end-2)===114&&source.charCodeAt(end-1)===108;return(value+source.slice(segmentStart,end)).endsWith("url")}function readAttributeValue(state){let source=state.source,quoteMark=NONE;if(state.eat('"'))quoteMark=DOUBLE_QUOTE;else if(state.eat("'"))quoteMark=SINGLE_QUOTE;let start=state.index,escaped=!1,i=start;while(i<source.length){let code=source.charCodeAt(i);if(escaped)escaped=!1;else if(code===BACKSLASH)escaped=!0;else if(quoteMark===NONE?code===CLOSE_BRACKET||isWhitespace(code):code===quoteMark)return state.index=quoteMark===NONE?i:i+1,source.slice(start,i).trim();i++}return state.index=i,unexpected_eof(source.length)}function readIdentifier(state){let{source,index:start}=state,first=source.charCodeAt(start);if(isDigit(first)||first===HYPHEN&&isDigit(source.charCodeAt(start+1)))css_expected_identifier(start);let identifier="",runStart=start,i=start;while(i<source.length){let code=source.charCodeAt(i);if(code===BACKSLASH){identifier+=source.slice(runStart,i),state.index=i;let sequence=state.matchRegex(REGEX_UNICODE_SEQUENCE);if(sequence){let character=String.fromCodePoint(Number.parseInt(sequence.slice(1),16));identifier+=character==="\\"?"\\\\":character,i+=sequence.length}else identifier+=`\\${source[i+1]}`,i+=2;runStart=i}else if(code>=160||isIdentifierChar2(code))i++;else break}if(identifier+=source.slice(runStart,i),state.index=i,identifier==="")css_expected_identifier(start);return identifier}function allowCommentOrWhitespace(state,capture){let source=state.source;state.allowWhitespace();for(;;){let code=source.charCodeAt(state.index);if(code===SLASH&&source.charCodeAt(state.index+1)===ASTERISK){let comment=readComment(state);if(capture)comments.push(comment)}else if(code===LESS_THAN&&state.eat("<!--"))state.readUntil("-->"),state.eat("-->",!0);else break;state.allowWhitespace()}}function readComment(state){let start=state.index;state.eat("/*",!0);let value=state.readUntil("*/");return state.eat("*/",!0),{type:"CSSComment",value,start,end:state.index}}function isAsciiLetter(code){return code>=65&&code<=90||code>=97&&code<=122}function isIdentifierChar2(code){return isAsciiLetter(code)||isDigit(code)||code===95||code===45}var REGEX_CLOSING_TEXTAREA=/<\/textarea(\s[^>]*)?>/iy,REGEX_DOCTYPE_NAME=/^![a-zA-Z]+$/,REGEX_NAMESPACED_NAME=/^[a-zA-Z][a-zA-Z0-9]*:[a-zA-Z][a-zA-Z0-9-]*[a-zA-Z0-9]$/,REGEX_CUSTOM_ELEMENT_NAME=/^[a-zA-Z][a-zA-Z0-9]*(-[a-zA-Z0-9.\-_\u00B7\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u037D\u037F-\u1FFF\u200C-\u200D\u203F-\u2040\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u{10000}-\u{EFFFF}]*)?$/u,ID_JOINERS="\\u200C\\u200D",REGEX_COMPONENT_NAME=new RegExp(`^(?:\\p{Lu}[$${ID_JOINERS}\\p{ID_Continue}.]*|\\p{ID_Start}[$${ID_JOINERS}\\p{ID_Continue}]*(?:\\.[$${ID_JOINERS}\\p{ID_Continue}]+)+)$`,"u"),DIRECTIVES=new Map([["use","UseDirective"],["animate","AnimateDirective"],["bind","BindDirective"],["class","ClassDirective"],["style","StyleDirective"],["on","OnDirective"],["let","LetDirective"],["in","TransitionDirective"],["out","TransitionDirective"],["transition","TransitionDirective"]]),META_TAGS=new Map([["svelte:head",["SvelteHead",!0]],["svelte:options",["SvelteOptions",!0]],["svelte:window",["SvelteWindow",!0]],["svelte:document",["SvelteDocument",!0]],["svelte:body",["SvelteBody",!0]],["svelte:element",["SvelteElement",!1]],["svelte:component",["SvelteComponent",!1]],["svelte:self",["SvelteSelf",!1]],["svelte:fragment",["SvelteFragment",!1]],["svelte:boundary",["SvelteBoundary",!1]]]),META_TAG_NAMES=[...META_TAGS.keys()],META_TAG_LIST=`${META_TAG_NAMES.slice(0,-1).join(", ")} or ${META_TAG_NAMES.at(-1)}`,GT=62,BRACE=123;function readName(state,isAttribute){let start=state.index;if(start>=state.source.length)unexpected_eof(state.source.length);let end=nameEnd(state.source,start,isAttribute);return state.index=end,{name:state.source.slice(start,end),start,end,loc:state.sourceLocation(start,end)}}var text=(start,end,raw,data=raw)=>({start,end,type:"Text",raw,data});function isComponentName(name){let first=name.charCodeAt(0);if(first>=97&&first<=122&&!name.includes("."))return!1;return REGEX_COMPONENT_NAME.test(name)}function isElementName(name){let simple=!0;for(let i=0;i<name.length&&simple;i++){let code=name.charCodeAt(i);simple=code>=97&&code<=122||i>0&&code>=48&&code<=57}return simple&&name.length>0||REGEX_DOCTYPE_NAME.test(name)||REGEX_NAMESPACED_NAME.test(name)||REGEX_CUSTOM_ELEMENT_NAME.test(name)}function hasAncestor(stack,matches){for(let i=stack.length-1;i>=0;i--){let found=matches(stack[i]);if(found!==void 0)return found}return!1}function elementType(state,name,isComponent){let meta=META_TAGS.get(name);if(meta)return meta[0];if(isComponent)return"Component";if(name==="title"){if(hasAncestor(state.stack,({type})=>{if(type==="SvelteHead")return!0;return type==="RegularElement"||type==="Component"?!1:void 0}))return"TitleElement"}if(name==="slot"){if(!hasAncestor(state.stack,(node)=>node.type==="RegularElement"&&node.attributes.some((a)=>a.type==="Attribute"&&a.name==="shadowrootmode")?!0:void 0))return"SlotElement"}return"RegularElement"}function readElement(state){let start=state.index++;if(state.eat("!--")){let data=state.readUntil("-->");state.eat("-->",!0),state.append({type:"Comment",start,end:state.index,data})}else if(state.eat("/"))closeElement(state,start);else openElement(state,start)}function closeElement(state,start){let{name}=readName(state,!1);if(state.allowWhitespace(),state.eat(">",!0),isVoid(name))void_element_invalid_content(start);let open=state.current();while(!("name"in open)||open.name!==name){if(open.type!=="RegularElement"){let autoClosed=state.lastAutoClosedTag;if(autoClosed?.tag===name)element_invalid_closing_tag_autoclosed(start,name,autoClosed.reason);element_invalid_closing_tag(start,name)}open.end=start,state.close(),open=state.current()}if(open.end=state.index,state.close(),state.stack.length<(state.lastAutoClosedTag?.depth??0))state.lastAutoClosedTag=void 0}function createElement(type,start,name){return{type,start,end:-1,name}}function openElement(state,start){let tag=readName(state,!1),{name}=tag,meta=META_TAGS.get(name);if(!meta&&name.startsWith("svelte:"))svelte_meta_invalid_tag(tag,META_TAG_LIST);let isComponent=isComponentName(name);if(!isComponent&&!isElementName(name))tag_invalid_name(tag);if(meta?.[1]){if(state.metaTags.has(name))svelte_meta_duplicate(start,name);if(state.current().type!=="Root")svelte_meta_invalid_placement(start,name);state.metaTags.add(name)}let element=createElement(elementType(state,name,isComponent),start,name);if(state.loc)element.name_loc=tag.loc;element.attributes=[],element.fragment={type:"Fragment",nodes:[]},state.allowWhitespace();let parent=state.current();if(parent.type==="RegularElement"&&closingTagOmitted(parent.name,name))parent.end=start,state.close(),state.lastAutoClosedTag={tag:parent.name,reason:name,depth:state.stack.length};if((name==="script"||name==="style")&&state.current().type==="Root"){let attributes=[];element.attributes=attributes,readAttributes(state,attributes,readStaticAttribute),readTopLevelBlock(state,element,start,attributes);return}if(readAttributes(state,element.attributes,readAttribute),element.type==="SvelteComponent"){let definition=takeThis(element);if(!definition)svelte_component_missing_this(start);if(!isExpressionValue(definition.value))svelte_component_invalid_this(definition.start);element.expression=expressionOf(definition.value)}else if(element.type==="SvelteElement"){let definition=takeThis(element);if(!definition)svelte_element_missing_this(start);if(definition.value===!0)svelte_element_missing_this(definition);element.tag=isExpressionValue(definition.value)?expressionOf(definition.value):literalTag(definition.value[0])}if(!state.eat("/")&&!isVoid(name))if(state.eat(">",!0),name==="textarea")element.fragment.nodes=readSequence(state,(source,i)=>(REGEX_CLOSING_TEXTAREA.lastIndex=i,REGEX_CLOSING_TEXTAREA.test(source)),"inside <textarea>"),state.read(REGEX_CLOSING_TEXTAREA);else if(name==="script"||name==="style")element.fragment.nodes.push(readRawText(state,`</${name}>`));else{state.open(element,element.fragment);return}else state.eat(">",!0);element.end=state.index,state.append(element)}function readRawText(state,closer){let start=state.index,found=state.source.indexOf(closer,start);state.index=found===-1?state.source.length:found;let node=text(start,state.index,state.source.slice(start,state.index));return state.eat(closer,!0),node}function readTopLevelBlock(state,element,start,attributes){state.eat(">",!0);let comment=commentBefore(state.root.fragment.nodes,start);if(element.name==="style"){let css=readStyle(state,start,attributes);if(css.content.comment=comment,state.root.css)style_duplicate(start);state.root.css=css;return}let script=readScript(state,start,attributes);if(comment&&state.comments)script.content.leadingComments=[{type:"Line",value:comment.data}];let slot=script.context==="module"?"module":"instance";if(state.root[slot])script_duplicate(start);state.root[slot]=script}function commentBefore(nodes,start){let last=nodes.length-1;if(last<0||nodes[last].end!==start)return null;for(let i=last;i>=0;i--){let node=nodes[i];if(node.type==="Comment")return node;if(node.type!=="Text"||node.data.trim())return null}return null}var isThisAttribute=(node)=>node.type==="Attribute"&&node.name==="this";function takeThis(element){let found=element.attributes.find(isThisAttribute);if(found)element.attributes.splice(element.attributes.indexOf(found),1);return found}function isExpressionValue(value){if(value===!0)return!1;if(!Array.isArray(value))return!0;return value.length===1&&value[0].type==="ExpressionTag"}function expressionOf(value){return(Array.isArray(value)?value[0]:value).expression}function literalTag(chunk){if(chunk.type!=="Text")return chunk.expression;return{type:"Literal",value:chunk.data,raw:`'${chunk.raw}'`,start:chunk.start,end:chunk.end}}function readAttributes(state,into,read){let seen=new Set;for(;;){let parsed=read(state);if(!parsed)return;let{type}=parsed;if(type==="Attribute"||type==="BindDirective"||type==="StyleDirective"||type==="ClassDirective"){let key=`${type==="BindDirective"?"Attribute":type}${parsed.name}`;if(seen.has(key))attribute_duplicate(parsed);if(parsed.name!=="this")seen.add(key)}into.push(parsed),state.allowWhitespace()}}function createAttribute(state,name,start,end,value){return state.loc?{type:"Attribute",start,end,name:name.name,name_loc:name.loc,value}:{type:"Attribute",start,end,name:name.name,value}}function rejectQuote(state){if(isQuote(state.source.charCodeAt(state.index)))expected_token(state.index,"=")}function readStaticAttribute(state){let start=state.index,name=readName(state,!0);if(!name.name)return null;let value=!0;if(state.eat("=")){state.allowWhitespace();let{source}=state,at=state.index,quoted=isQuote(source.charCodeAt(at)),end=-1;if(quoted){let close=source.indexOf(source[at],at+1);if(close!==-1)end=close+1}if(end===-1){end=at;while(end<source.length&&source.charCodeAt(end)!==GT&&!isWhitespace(source.charCodeAt(end)))end++;if(end===at)expected_attribute_value(at)}state.index=end;let quotes=quoted?1:0,raw=source.slice(at+quotes,end-quotes);value=[text(end-raw.length-quotes,end-quotes,raw,decodeCharacterReferences(raw,!0,state.entityNames))]}return rejectQuote(state),createAttribute(state,name,start,state.index,value)}function readJsComment(state){let start=state.index,block=state.match("/*");if(!block&&!state.match("//"))return!1;state.index+=2;let value=state.readUntil(block?"*/":`
|
|
1
|
+
import{closingTagOmitted}from"./shared-dgdrqgdn.js";import{setSource,locate3,position,mapChildren,assertType}from"./shared-m0dcdh24.js";import{isIdentifierStart,isIdentifierChar}from"./shared-s46wfvhw.js";import{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}from"./shared-w3mxqtgj.js";import{withoutByteOrderMark,isDigit,isWhitespace,skipWhitespace,isTypeScript,closingScriptTag,closingScriptTagEnd,isVoid,styleContentEnd,isQuote,nameEnd,endsUnquotedValue}from"./shared-5tpb3h6x.js";import{decodeCharacterReferences}from"./shared-bzqbnvee.js";import{missingTypeScript}from"./shared-h6z1kjbb.js";var REGEX_NON_LF_LINE_BREAK=/\r(?!\n)|[\u2028\u2029]/,REGEX_WHITESPACE_THEN_CLOSING_BRACE=/\s*}/y;function scanIdentifier(source,from){let code=source.codePointAt(from);if(code===void 0||!isIdentifierStart(code,!0))return from;let end=from+(code<=65535?1:2),next=source.codePointAt(end);while(next!==void 0&&isIdentifierChar(next,!0))end+=next<=65535?1:2,next=source.codePointAt(end);return end}class TemplateParserState{source;index=0;loc;lfOnly;isTypeScript;typescript;entityNames;css;script;comments;root;stack;fragments;metaTags=new Set;lastAutoClosedTag;nextAngle=-1;nextBrace=-1;constructor(source,originalLength,support,options={}){if(this.source=source,this.loc=options.loc??!1,this.lfOnly=this.loc&&!REGEX_NON_LF_LINE_BREAK.test(source),this.isTypeScript=isTypeScript(source),this.typescript=support.typescript,this.isTypeScript&&!this.typescript)missingTypeScript();this.entityNames=support.entityNames,this.css=options.css??!0,this.script=options.script??!0,this.comments=options.comments??!0,this.root={type:"Root",start:0,end:originalLength,css:null,js:[],options:null,fragment:{type:"Fragment",nodes:[]},comments:[]},this.stack=[this.root],this.fragments=[this.root.fragment]}match(str){if(str.length===1)return this.source.charCodeAt(this.index)===str.charCodeAt(0);return this.source.startsWith(str,this.index)}matchRegex(pattern){return pattern.lastIndex=this.index,pattern.exec(this.source)?.[0]??null}eat(str,required=!1){if(this.match(str))return this.index+=str.length,!0;if(required)expected_token(this.index,str);return!1}read(pattern){let result=this.matchRegex(pattern);if(result)this.index+=result.length;return result}readUntil(needle){if(this.index>=this.source.length)unexpected_eof(this.source.length);let found=this.source.indexOf(needle,this.index),end=found===-1?this.source.length:found,result=this.source.slice(this.index,end);return this.index=end,result}allowWhitespace(){this.index=skipWhitespace(this.source,this.index)}requireWhitespace(){if(!isWhitespace(this.source.charCodeAt(this.index)))expected_whitespace(this.index);this.allowWhitespace()}eatClosingBrace(){this.allowWhitespace(),this.eat("}",!0)}sourceLocation(start,end){return this.loc?{start:locate3(start),end:locate3(end)}:void 0}readIdentifierName(){let start=this.index,end=scanIdentifier(this.source,start),name=this.source.slice(start,end);if(this.index=end,RESERVED_WORDS.has(name))unexpected_reserved_word(start,name);let identifier={type:"Identifier",name,start,end};if(this.loc)identifier.loc=this.sourceLocation(start,end);return identifier}current(){return this.stack[this.stack.length-1]}append(node){this.fragments[this.fragments.length-1].nodes.push(node)}open(node,fragment){this.append(node),this.stack.push(node),this.fragments.push(fragment)}setFragment(fragment){this.fragments[this.fragments.length-1]=fragment}close(){this.stack.pop(),this.fragments.pop()}}var PRECEDENCE={"||":1,"??":1,"&&":2,"==":6,"!=":6,"===":6,"!==":6,"<":7,">":7,"<=":7,">=":7,"+":9,"-":9,"*":10,"/":10,"%":10};function literal(source,start,end,value){return{type:"Literal",start,end,value,raw:source.slice(start,end)}}function scanLiteral(source,from){let first=source.charCodeAt(from);if(first===34||first===39){for(let end=from+1;end<source.length;end++){let code=source.charCodeAt(end);if(code===first)return literal(source,from,end+1,source.slice(from+1,end));if(code===92||code===10||code===13)return null}return null}let end=from;for(;end<source.length;end++){let code=source.charCodeAt(end);if(code<48||code>57)break}if(end===from||first===48&&end-from>1)return null;return literal(source,from,end,Number(source.slice(from,end)))}function scanAtom(source,from,typescript){let identifierEnd=scanIdentifier(source,from);if(identifierEnd===from)return scanLiteral(source,from);let name=source.slice(from,identifierEnd);if(name==="true"||name==="false"||name==="null")return literal(source,from,identifierEnd,name==="null"?null:name==="true");if(RESERVED_WORDS.has(name))return null;let node={type:"Identifier",start:from,end:identifierEnd,name};for(let index=identifierEnd;;){let next=source.charCodeAt(index);if(next===40){let call=scanArguments(source,index+1,typescript);if(!call)return null;node={type:"CallExpression",start:from,end:call.end,callee:node,arguments:call.arguments,optional:!1},index=call.end;continue}let property,end;if(next===46){if(end=scanIdentifier(source,index+1),end===index+1)return null;property={type:"Identifier",start:index+1,end,name:source.slice(index+1,end)}}else if(next===91){if(property=scanLiteral(source,index+1),!property||source.charCodeAt(property.end)!==93)return null;end=property.end+1}else return node;node={type:"MemberExpression",start:from,end,object:node,property,computed:next===91,optional:!1},index=end}}function scanArguments(source,from,typescript){let args=[],index=skipWhitespace(source,from);if(source.charCodeAt(index)===41)return{arguments:args,end:index+1};for(;;){let argument=scanConditional(source,index,typescript);if(!argument)return null;args.push(argument),index=skipWhitespace(source,argument.end);let code=source.charCodeAt(index);if(code===41)return{arguments:args,end:index+1};if(code!==44)return null;if(index=skipWhitespace(source,index+1),source.charCodeAt(index)===41)return null}}function scanUnary(source,from,typescript){let code=source.charCodeAt(from),next=source.charCodeAt(from+1);if(!(code===33&&next!==61)&&!(code===45&&next!==45&&next!==61))return scanAtom(source,from,typescript);let argument=scanUnary(source,skipWhitespace(source,from+1),typescript);if(!argument)return null;return{type:"UnaryExpression",start:from,end:argument.end,operator:code===33?"!":"-",prefix:!0,argument}}function operatorAt(source,index,typescript){let code=source.charCodeAt(index),next=source.charCodeAt(index+1);switch(code){case 124:return next===124&&source.charCodeAt(index+2)!==61?"||":null;case 38:return next===38&&source.charCodeAt(index+2)!==61?"&&":null;case 63:return next===63&&source.charCodeAt(index+2)!==61?"??":null;case 61:if(next!==61)return null;return source.charCodeAt(index+2)===61?"===":"==";case 33:if(next!==61)return null;return source.charCodeAt(index+2)===61?"!==":"!=";case 60:case 62:if(typescript||next===code)return null;if(next===61)return code===60?"<=":">=";return code===60?"<":">";case 43:return next===43||next===61?null:"+";case 45:return next===45||next===61?null:"-";case 42:return next===42||next===61?null:"*";case 47:return next===47||next===42||next===61?null:"/";case 37:return next===61?null:"%";default:return null}}function scanBinary(source,left,minPrecedence,typescript){if(isClosing(source.charCodeAt(left.end)))return left;let index=skipWhitespace(source,left.end),operator=operatorAt(source,index,typescript);if(operator===null)return left;let precedence=PRECEDENCE[operator];if(precedence<=minPrecedence)return left;let operand=scanUnary(source,skipWhitespace(source,index+operator.length),typescript);if(!operand)return null;let right=scanBinary(source,operand,operator==="??"?2:precedence,typescript);if(!right)return null;let node;if(operator==="||"||operator==="&&"||operator==="??"){let after=operatorAt(source,skipWhitespace(source,right.end),typescript);if(operator==="??"?after==="||"||after==="&&":after==="??")return null;node={type:"LogicalExpression",start:left.start,end:right.end,left,operator,right}}else node={type:"BinaryExpression",start:left.start,end:right.end,left,operator,right};return scanBinary(source,node,minPrecedence,typescript)}function scanConditional(source,from,typescript){let operand=scanUnary(source,from,typescript);if(!operand)return null;let test=scanBinary(source,operand,-1,typescript);if(!test||isClosing(source.charCodeAt(test.end)))return test;let question=skipWhitespace(source,test.end);if(source.charCodeAt(question)!==63)return test;let next=source.charCodeAt(question+1);if(next===46||next===63)return null;let consequent=scanConditional(source,skipWhitespace(source,question+1),typescript);if(!consequent)return null;let colon=skipWhitespace(source,consequent.end);if(source.charCodeAt(colon)!==58)return null;let alternate=scanConditional(source,skipWhitespace(source,colon+1),typescript);if(!alternate)return null;return{type:"ConditionalExpression",start:test.start,end:alternate.end,test,consequent,alternate}}function isClosing(code){return code===125||code===41||code===44||code===58}function atTerminator(source,from){let code=source.charCodeAt(skipWhitespace(source,from));return code===125||code===41}function scanTrivialExpression(source,from,typescript){let node=scanConditional(source,from,typescript);return node&&atTerminator(source,node.end)?node:null}function addLocations(node){switch(node.loc={start:position(node.start),end:position(node.end)},node.type){case"MemberExpression":addLocations(node.object),addLocations(node.property);break;case"CallExpression":addLocations(node.callee);for(let argument of node.arguments)addLocations(argument);break;case"UnaryExpression":addLocations(node.argument);break;case"BinaryExpression":case"LogicalExpression":addLocations(node.left),addLocations(node.right);break;case"ConditionalExpression":addLocations(node.test),addLocations(node.consequent),addLocations(node.alternate);break}}function readExpression(state){let trivial=!state.loc||state.lfOnly?scanTrivialExpression(state.source,state.index,state.isTypeScript):null;if(trivial){if(state.index=trivial.end,state.loc)addLocations(trivial);return trivial}let{node,end}=parseExpressionAt(state,state.source,state.index);return state.index=end,node}var RESERVED_ATTRIBUTES=new Set(["server","client","worker","test","default"]);function readScript(state,start,attributes){let{source,index:scriptStart}=state;if(scriptStart>=source.length)unexpected_eof(source.length);let close=closingScriptTag(source,scriptStart);if(close===-1)element_unclosed(source.length,"script");state.index=closingScriptTagEnd(source,close);let program=state.script?parseProgram(state,source.slice(0,close),scriptStart):{type:"Program",start:scriptStart,end:close,body:[],sourceType:"module"};if(program.start=scriptStart,program.loc)Object.assign(program.loc.start,position(start)),Object.assign(program.loc.end,position(state.index));else if(state.loc)program.loc={start:position(start),end:position(state.index)};let context="default";for(let attribute of attributes){if(RESERVED_ATTRIBUTES.has(attribute.name))script_reserved_attribute(attribute,attribute.name);if(attribute.name==="module"){if(attribute.value!==!0)script_invalid_attribute_value(attribute,attribute.name);context="module"}if(attribute.name==="context"){let value=attribute.value;if(!Array.isArray(value)||value.length!==1||value[0].type!=="Text"||value[0].data!=="module")script_invalid_context(attribute);context="module"}}return{type:"Script",start,end:state.index,context,content:program,attributes}}var REGEX_NTH_OF=/(even|odd|\+?(\d+|\d*n(\s*[+-]\s*\d+)?)|-\d*n(\s*\+\s*\d+))((?=\s*[,)])|\s+of(\s+|(?=[.#[*:&])))/y,REGEX_PERCENTAGE=/\d+(\.\d+)?%/y,REGEX_UNICODE_SEQUENCE=/\\[0-9a-fA-F]{1,6}(\r\n|\s)?/y,REGEX_CLOSING_STYLE_TAG_END=/\s*>/y,NONE=-1,DOUBLE_QUOTE=34,HASH=35,DOLLAR=36,AMPERSAND=38,SINGLE_QUOTE=39,OPEN_PAREN=40,CLOSE_PAREN=41,ASTERISK=42,PLUS=43,HYPHEN=45,DOT=46,SLASH=47,COLON=58,SEMICOLON=59,LESS_THAN=60,EQUALS=61,GREATER_THAN=62,OPEN_BRACKET=91,BACKSLASH=92,CLOSE_BRACKET=93,CARET=94,OPEN_BRACE=123,PIPE=124,CLOSE_BRACE=125,TILDE=126,comments=[];function readStyle(state,start,attributes){let contentStart=state.index;comments=[];let children=state.css?readBody(state):skipBody(state),contentEnd=state.index;return state.eat("</style",!0),state.read(REGEX_CLOSING_STYLE_TAG_END),{type:"StyleSheet",start,end:state.index,attributes,children,comments,content:{start:contentStart,end:contentEnd,styles:state.source.slice(contentStart,contentEnd),comment:null}}}function skipBody(state){return state.index=styleContentEnd(state.source,state.index),[]}function readBody(state){let children=[];for(;;){if(allowCommentOrWhitespace(state,!0),state.match("</style")||state.index>=state.source.length)break;children.push(state.match("@")?readAtRule(state):readRule(state))}return children}function readAtRule(state){let start=state.index;state.eat("@",!0);let name=readIdentifier(state),prelude=readValue(state,!0),block=null;if(state.match("{"))block=readBlock(state);else state.eat(";",!0);return{type:"Atrule",start,end:state.index,name,prelude,block}}function readRule(state){let start=state.index;return{type:"Rule",prelude:readSelectorList(state,!1),block:readBlock(state),start,end:state.index}}function readSelectorList(state,insidePseudoClass){let children=[];allowCommentOrWhitespace(state,!0);let start=state.index;while(state.index<state.source.length){children.push(readSelector(state,insidePseudoClass));let end=state.index;if(allowCommentOrWhitespace(state,!0),state.match(insidePseudoClass?")":"{"))return{type:"SelectorList",start,end,children};state.eat(",",!0),allowCommentOrWhitespace(state,!0)}return unexpected_eof(state.source.length)}function createRelativeSelector(combinator,start){return{type:"RelativeSelector",combinator,selectors:[],start,end:-1}}function readSelector(state,insidePseudoClass){let{source,index:listStart}=state,children=[],relativeSelector=createRelativeSelector(null,state.index);while(state.index<source.length){let start=state.index,code=source.charCodeAt(start),selectors=relativeSelector.selectors;if(code===AMPERSAND)state.index++,selectors.push({type:"NestingSelector",name:"&",start,end:state.index});else if(code===ASTERISK)state.index++,selectors.push(readTypeSelectorRest(state,start,"*"));else if(code===HASH)state.index++,selectors.push({type:"IdSelector",name:readIdentifier(state),start,end:state.index});else if(code===DOT)state.index++,selectors.push({type:"ClassSelector",name:readIdentifier(state),start,end:state.index});else if(code===COLON){let isElement=source.charCodeAt(start+1)===COLON;state.index+=isElement?2:1;let name=readIdentifier(state),args=null;if(state.eat("("))args=readSelectorList(state,!0),state.eat(")",!0);if(isElement)selectors.push({type:"PseudoElementSelector",name,start,end:state.index,...args&&{args}});else selectors.push({type:"PseudoClassSelector",name,args,start,end:state.index})}else if(code===OPEN_BRACKET)state.index++,selectors.push(readAttributeSelector(state,start));else{let nth=insidePseudoClass?state.read(REGEX_NTH_OF):null,percentage=!nth&&isDigit(code)?state.read(REGEX_PERCENTAGE):null;if(nth)selectors.push({type:"Nth",value:nth,start,end:state.index});else if(percentage)selectors.push({type:"Percentage",value:percentage,start,end:state.index});else if(combinatorLength(source,start)===0){let name=readIdentifier(state);selectors.push(readTypeSelectorRest(state,start,name))}}let index=state.index;allowCommentOrWhitespace(state,!1);let end=state.match(",")||state.match(insidePseudoClass?")":"{");if(state.index=index,end)return relativeSelector.end=index,children.push(relativeSelector),{type:"ComplexSelector",start:listStart,end:index,children};let combinator=readCombinator(state);if(combinator){if(relativeSelector.selectors.length>0)relativeSelector.end=index,children.push(relativeSelector);if(relativeSelector=createRelativeSelector(combinator,combinator.start),state.allowWhitespace(),state.match(",")||state.match(insidePseudoClass?")":"{"))css_selector_invalid(state.index)}}return unexpected_eof(source.length)}function readTypeSelectorRest(state,start,first){let name=first,namespace;if(state.eat("|"))namespace=name,name=state.eat("*")?"*":readIdentifier(state);return{type:"TypeSelector",name,...namespace!==void 0&&{namespace},start,end:state.index}}function readAttributeSelector(state,start){let source=state.source;state.allowWhitespace();let name=readIdentifier(state);state.allowWhitespace();let value=null,matcher=null,code=source.charCodeAt(state.index);if(code===EQUALS)matcher="=";else if((code===TILDE||code===CARET||code===DOLLAR||code===ASTERISK||code===PIPE)&&source.charCodeAt(state.index+1)===EQUALS)matcher=source.slice(state.index,state.index+2);if(matcher)state.index+=matcher.length,state.allowWhitespace(),value=readAttributeValue(state);state.allowWhitespace();let flagsStart=state.index;while(isAsciiLetter(source.charCodeAt(state.index)))state.index++;let flags=state.index>flagsStart?source.slice(flagsStart,state.index):null;return state.allowWhitespace(),state.eat("]",!0),{type:"AttributeSelector",start,end:state.index,name,matcher,value,flags}}function combinatorLength(source,index){let code=source.charCodeAt(index);if(code===PLUS||code===TILDE||code===GREATER_THAN)return 1;if(code===PIPE&&source.charCodeAt(index+1)===PIPE)return 2;return 0}function readCombinator(state){let start=state.index;state.allowWhitespace();let index=state.index,length=combinatorLength(state.source,index);if(length>0){state.index+=length;let end=state.index;return state.allowWhitespace(),{type:"Combinator",name:state.source.slice(index,end),start:index,end}}if(state.index!==start)return{type:"Combinator",name:" ",start,end:state.index};return null}function readBlock(state){let start=state.index;state.eat("{",!0);let children=[];while(state.index<state.source.length){if(allowCommentOrWhitespace(state,!0),state.match("}"))break;children.push(readBlockItem(state))}return state.eat("}",!0),{type:"Block",start,end:state.index,children}}function readBlockItem(state){if(state.match("@"))return readAtRule(state);let start=state.index;readValue(state,!1);let code=state.source.charCodeAt(state.index);return state.index=start,code===OPEN_BRACE?readRule(state):readDeclaration(state)}function readDeclaration(state){let{source,index:start}=state;if(start>=source.length)unexpected_eof(source.length);let propertyEnd=start;while(propertyEnd<source.length){let code=source.charCodeAt(propertyEnd);if(code===COLON||isWhitespace(code))break;propertyEnd++}let property=source.slice(start,propertyEnd);state.index=propertyEnd,state.allowWhitespace(),state.eat(":");let index=state.index;state.allowWhitespace();let value=readValue(state,!0);if(!value&&!property.startsWith("--"))css_empty_declaration({start,end:index});let end=state.index;if(!state.match("}"))state.eat(";",!0);return{type:"Declaration",start,end,property,value}}function readValue(state,capture){let source=state.source,length=source.length,value="",segmentStart=state.index,valueComments=null,escaped=!1,inUrl=!1,quoteMark=NONE,i=state.index;while(i<length){let code=source.charCodeAt(i);if(escaped){escaped=!1,i++;continue}if(code===BACKSLASH){escaped=!0,i++;continue}if(code===quoteMark)quoteMark=NONE;else if(code===CLOSE_PAREN)inUrl=!1;else if(quoteMark===NONE&&(code===DOUBLE_QUOTE||code===SINGLE_QUOTE))quoteMark=code;else if(code===OPEN_PAREN){if(endsWithUrl(source,value,segmentStart,i))inUrl=!0}else if((code===SEMICOLON||code===OPEN_BRACE||code===CLOSE_BRACE)&&!inUrl&"eMark===NONE){if(state.index=i,!capture)return"";if(value+=source.slice(segmentStart,i),valueComments){let leadingWhitespace=value.length-value.trimStart().length;for(let comment of valueComments)comment.position=Math.max(0,(comment.position??0)-leadingWhitespace)}return value.trim()}else if(code===SLASH&&!inUrl&"eMark===NONE&&source.charCodeAt(i+1)===ASTERISK){value+=source.slice(segmentStart,i),state.index=i;let comment=readComment(state);if(capture)comment.position=value.length,comments.push(comment),valueComments??=[],valueComments.push(comment);i=state.index,segmentStart=i;continue}i++}return state.index=length,unexpected_eof(length)}function endsWithUrl(source,value,segmentStart,end){if(end-segmentStart>=3)return source.charCodeAt(end-3)===117&&source.charCodeAt(end-2)===114&&source.charCodeAt(end-1)===108;return(value+source.slice(segmentStart,end)).endsWith("url")}function readAttributeValue(state){let source=state.source,quoteMark=NONE;if(state.eat('"'))quoteMark=DOUBLE_QUOTE;else if(state.eat("'"))quoteMark=SINGLE_QUOTE;let start=state.index,escaped=!1,i=start;while(i<source.length){let code=source.charCodeAt(i);if(escaped)escaped=!1;else if(code===BACKSLASH)escaped=!0;else if(quoteMark===NONE?code===CLOSE_BRACKET||isWhitespace(code):code===quoteMark)return state.index=quoteMark===NONE?i:i+1,source.slice(start,i).trim();i++}return state.index=i,unexpected_eof(source.length)}function readIdentifier(state){let{source,index:start}=state,first=source.charCodeAt(start);if(isDigit(first)||first===HYPHEN&&isDigit(source.charCodeAt(start+1)))css_expected_identifier(start);let identifier="",runStart=start,i=start;while(i<source.length){let code=source.charCodeAt(i);if(code===BACKSLASH){identifier+=source.slice(runStart,i),state.index=i;let sequence=state.matchRegex(REGEX_UNICODE_SEQUENCE);if(sequence){let character=String.fromCodePoint(Number.parseInt(sequence.slice(1),16));identifier+=character==="\\"?"\\\\":character,i+=sequence.length}else identifier+=`\\${source[i+1]}`,i+=2;runStart=i}else if(code>=160||isIdentifierChar2(code))i++;else break}if(identifier+=source.slice(runStart,i),state.index=i,identifier==="")css_expected_identifier(start);return identifier}function allowCommentOrWhitespace(state,capture){let source=state.source;state.allowWhitespace();for(;;){let code=source.charCodeAt(state.index);if(code===SLASH&&source.charCodeAt(state.index+1)===ASTERISK){let comment=readComment(state);if(capture)comments.push(comment)}else if(code===LESS_THAN&&state.eat("<!--"))state.readUntil("-->"),state.eat("-->",!0);else break;state.allowWhitespace()}}function readComment(state){let start=state.index;state.eat("/*",!0);let value=state.readUntil("*/");return state.eat("*/",!0),{type:"CSSComment",value,start,end:state.index}}function isAsciiLetter(code){return code>=65&&code<=90||code>=97&&code<=122}function isIdentifierChar2(code){return isAsciiLetter(code)||isDigit(code)||code===95||code===45}var REGEX_CLOSING_TEXTAREA=/<\/textarea(\s[^>]*)?>/iy,REGEX_DOCTYPE_NAME=/^![a-zA-Z]+$/,REGEX_NAMESPACED_NAME=/^[a-zA-Z][a-zA-Z0-9]*:[a-zA-Z][a-zA-Z0-9-]*[a-zA-Z0-9]$/,REGEX_CUSTOM_ELEMENT_NAME=/^[a-zA-Z][a-zA-Z0-9]*(-[a-zA-Z0-9.\-_\u00B7\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u037D\u037F-\u1FFF\u200C-\u200D\u203F-\u2040\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u{10000}-\u{EFFFF}]*)?$/u,ID_JOINERS="\\u200C\\u200D",REGEX_COMPONENT_NAME=new RegExp(`^(?:\\p{Lu}[$${ID_JOINERS}\\p{ID_Continue}.]*|\\p{ID_Start}[$${ID_JOINERS}\\p{ID_Continue}]*(?:\\.[$${ID_JOINERS}\\p{ID_Continue}]+)+)$`,"u"),DIRECTIVES=new Map([["use","UseDirective"],["animate","AnimateDirective"],["bind","BindDirective"],["class","ClassDirective"],["style","StyleDirective"],["on","OnDirective"],["let","LetDirective"],["in","TransitionDirective"],["out","TransitionDirective"],["transition","TransitionDirective"]]),META_TAGS=new Map([["svelte:head",["SvelteHead",!0]],["svelte:options",["SvelteOptions",!0]],["svelte:window",["SvelteWindow",!0]],["svelte:document",["SvelteDocument",!0]],["svelte:body",["SvelteBody",!0]],["svelte:element",["SvelteElement",!1]],["svelte:component",["SvelteComponent",!1]],["svelte:self",["SvelteSelf",!1]],["svelte:fragment",["SvelteFragment",!1]],["svelte:boundary",["SvelteBoundary",!1]]]),META_TAG_NAMES=[...META_TAGS.keys()],META_TAG_LIST=`${META_TAG_NAMES.slice(0,-1).join(", ")} or ${META_TAG_NAMES.at(-1)}`,GT=62,BRACE=123;function readName(state,isAttribute){let start=state.index;if(start>=state.source.length)unexpected_eof(state.source.length);let end=nameEnd(state.source,start,isAttribute);return state.index=end,{name:state.source.slice(start,end),start,end,loc:state.sourceLocation(start,end)}}var text=(start,end,raw,data=raw)=>({start,end,type:"Text",raw,data});function isComponentName(name){let first=name.charCodeAt(0);if(first>=97&&first<=122&&!name.includes("."))return!1;return REGEX_COMPONENT_NAME.test(name)}function isElementName(name){let simple=!0;for(let i=0;i<name.length&&simple;i++){let code=name.charCodeAt(i);simple=code>=97&&code<=122||i>0&&code>=48&&code<=57}return simple&&name.length>0||REGEX_DOCTYPE_NAME.test(name)||REGEX_NAMESPACED_NAME.test(name)||REGEX_CUSTOM_ELEMENT_NAME.test(name)}function hasAncestor(stack,matches){for(let i=stack.length-1;i>=0;i--){let found=matches(stack[i]);if(found!==void 0)return found}return!1}function elementType(state,name,isComponent){let meta=META_TAGS.get(name);if(meta)return meta[0];if(isComponent)return"Component";if(name==="title"){if(hasAncestor(state.stack,({type})=>{if(type==="SvelteHead")return!0;return type==="RegularElement"||type==="Component"?!1:void 0}))return"TitleElement"}if(name==="slot"){if(!hasAncestor(state.stack,(node)=>node.type==="RegularElement"&&node.attributes.some((a)=>a.type==="Attribute"&&a.name==="shadowrootmode")?!0:void 0))return"SlotElement"}return"RegularElement"}function readElement(state){let start=state.index++;if(state.eat("!--")){let data=state.readUntil("-->");state.eat("-->",!0),state.append({type:"Comment",start,end:state.index,data})}else if(state.eat("/"))closeElement(state,start);else openElement(state,start)}function closeElement(state,start){let{name}=readName(state,!1);if(state.allowWhitespace(),state.eat(">",!0),isVoid(name))void_element_invalid_content(start);let open=state.current();while(!("name"in open)||open.name!==name){if(open.type!=="RegularElement"){let autoClosed=state.lastAutoClosedTag;if(autoClosed?.tag===name)element_invalid_closing_tag_autoclosed(start,name,autoClosed.reason);element_invalid_closing_tag(start,name)}open.end=start,state.close(),open=state.current()}if(open.end=state.index,state.close(),state.stack.length<(state.lastAutoClosedTag?.depth??0))state.lastAutoClosedTag=void 0}function createElement(type,start,name){return{type,start,end:-1,name}}function openElement(state,start){let tag=readName(state,!1),{name}=tag,meta=META_TAGS.get(name);if(!meta&&name.startsWith("svelte:"))svelte_meta_invalid_tag(tag,META_TAG_LIST);let isComponent=isComponentName(name);if(!isComponent&&!isElementName(name))tag_invalid_name(tag);if(meta?.[1]){if(state.metaTags.has(name))svelte_meta_duplicate(start,name);if(state.current().type!=="Root")svelte_meta_invalid_placement(start,name);state.metaTags.add(name)}let element=createElement(elementType(state,name,isComponent),start,name);if(state.loc)element.name_loc=tag.loc;element.attributes=[],element.fragment={type:"Fragment",nodes:[]},state.allowWhitespace();let parent=state.current();if(parent.type==="RegularElement"&&closingTagOmitted(parent.name,name))parent.end=start,state.close(),state.lastAutoClosedTag={tag:parent.name,reason:name,depth:state.stack.length};if((name==="script"||name==="style")&&state.current().type==="Root"){let attributes=[];element.attributes=attributes,readAttributes(state,attributes,readStaticAttribute),readTopLevelBlock(state,element,start,attributes);return}if(readAttributes(state,element.attributes,readAttribute),element.type==="SvelteComponent"){let definition=takeThis(element);if(!definition)svelte_component_missing_this(start);if(!isExpressionValue(definition.value))svelte_component_invalid_this(definition.start);element.expression=expressionOf(definition.value)}else if(element.type==="SvelteElement"){let definition=takeThis(element);if(!definition)svelte_element_missing_this(start);if(definition.value===!0)svelte_element_missing_this(definition);element.tag=isExpressionValue(definition.value)?expressionOf(definition.value):literalTag(definition.value[0])}if(!state.eat("/")&&!isVoid(name))if(state.eat(">",!0),name==="textarea")element.fragment.nodes=readSequence(state,(source,i)=>(REGEX_CLOSING_TEXTAREA.lastIndex=i,REGEX_CLOSING_TEXTAREA.test(source)),"inside <textarea>"),state.read(REGEX_CLOSING_TEXTAREA);else if(name==="script"||name==="style")element.fragment.nodes.push(readRawText(state,`</${name}>`));else{state.open(element,element.fragment);return}else state.eat(">",!0);element.end=state.index,state.append(element)}function readRawText(state,closer){let start=state.index,found=state.source.indexOf(closer,start);state.index=found===-1?state.source.length:found;let node=text(start,state.index,state.source.slice(start,state.index));return state.eat(closer,!0),node}function readTopLevelBlock(state,element,start,attributes){state.eat(">",!0);let comment=commentBefore(state.root.fragment.nodes,start);if(element.name==="style"){let css=readStyle(state,start,attributes);if(css.content.comment=comment,state.root.css)style_duplicate(start);state.root.css=css;return}let script=readScript(state,start,attributes);if(comment&&state.comments)script.content.leadingComments=[{type:"Line",value:comment.data}];let slot=script.context==="module"?"module":"instance";if(state.root[slot])script_duplicate(start);state.root[slot]=script}function commentBefore(nodes,start){let last=nodes.length-1;if(last<0||nodes[last].end!==start)return null;for(let i=last;i>=0;i--){let node=nodes[i];if(node.type==="Comment")return node;if(node.type!=="Text"||node.data.trim())return null}return null}var isThisAttribute=(node)=>node.type==="Attribute"&&node.name==="this";function takeThis(element){let found=element.attributes.find(isThisAttribute);if(found)element.attributes.splice(element.attributes.indexOf(found),1);return found}function isExpressionValue(value){if(value===!0)return!1;if(!Array.isArray(value))return!0;return value.length===1&&value[0].type==="ExpressionTag"}function expressionOf(value){return(Array.isArray(value)?value[0]:value).expression}function literalTag(chunk){if(chunk.type!=="Text")return chunk.expression;return{type:"Literal",value:chunk.data,raw:`'${chunk.raw}'`,start:chunk.start,end:chunk.end}}function readAttributes(state,into,read){let seen=new Set;for(;;){let parsed=read(state);if(!parsed)return;let{type}=parsed;if(type==="Attribute"||type==="BindDirective"||type==="StyleDirective"||type==="ClassDirective"){let key=`${type==="BindDirective"?"Attribute":type}${parsed.name}`;if(seen.has(key))attribute_duplicate(parsed);if(parsed.name!=="this")seen.add(key)}into.push(parsed),state.allowWhitespace()}}function createAttribute(state,name,start,end,value){return state.loc?{type:"Attribute",start,end,name:name.name,name_loc:name.loc,value}:{type:"Attribute",start,end,name:name.name,value}}function rejectQuote(state){if(isQuote(state.source.charCodeAt(state.index)))expected_token(state.index,"=")}function readStaticAttribute(state){let start=state.index,name=readName(state,!0);if(!name.name)return null;let value=!0;if(state.eat("=")){state.allowWhitespace();let{source}=state,at=state.index,quoted=isQuote(source.charCodeAt(at)),end=-1;if(quoted){let close=source.indexOf(source[at],at+1);if(close!==-1)end=close+1}if(end===-1){end=at;while(end<source.length&&source.charCodeAt(end)!==GT&&!isWhitespace(source.charCodeAt(end)))end++;if(end===at)expected_attribute_value(at)}state.index=end;let quotes=quoted?1:0,raw=source.slice(at+quotes,end-quotes);value=[text(end-raw.length-quotes,end-quotes,raw,decodeCharacterReferences(raw,!0,state.entityNames))]}return rejectQuote(state),createAttribute(state,name,start,state.index,value)}function readJsComment(state){let start=state.index,block=state.match("/*");if(!block&&!state.match("//"))return!1;state.index+=2;let value=state.readUntil(block?"*/":`
|
|
2
2
|
`);if(block)state.eat("*/");let comment={type:block?"Block":"Line",start,end:state.index,value},loc=state.sourceLocation(start,state.index);if(loc)comment.loc=loc;if(state.comments)state.root.comments.push(comment);return!0}function readAttribute(state){while(readJsComment(state))state.allowWhitespace();let start=state.index;if(state.eat("{"))return readBraceAttribute(state,start);let name=readName(state,!0);if(!name.name)return null;let end=state.index;state.allowWhitespace();let value=!0;if(state.eat("=")){if(state.allowWhitespace(),state.match("/>"))value=[text(state.index,state.index+1,"/")],state.index++;else value=readAttributeValue2(state);end=state.index}else rejectQuote(state);let colon=name.name.indexOf(":"),type=colon>0?DIRECTIVES.get(name.name.slice(0,colon)):void 0;return type?directive(state,type,name,colon,start,end,value):createAttribute(state,name,start,end,value)}function readBraceAttribute(state,start){if(state.allowWhitespace(),state.eat("@attach")){state.requireWhitespace();let expression=readExpression(state);return state.eatClosingBrace(),{type:"AttachTag",start,end:state.index,expression}}if(state.eat("...")){let expression=readExpression(state);return state.eatClosingBrace(),{type:"SpreadAttribute",start,end:state.index,expression}}let id=state.readIdentifierName();if(id.name==="")attribute_empty_shorthand(start);state.eatClosingBrace();let value={type:"ExpressionTag",start:id.start,end:id.end,expression:id};return createAttribute(state,id,start,state.index,value)}function firstChunk(value){if(value===!0)return;return Array.isArray(value)?value[0]:value}function directive(state,type,tag,colon,start,end,value){let[name,...modifiers]=tag.name.slice(colon+1).split("|");if(name==="")directive_missing_name({start,end:start+colon+1},tag.name);let node={start,end,type,name};if(state.loc)node.name_loc=tag.loc;if(type==="StyleDirective")return node.modifiers=modifiers,node.value=value,node;let first=firstChunk(value);if(first&&(Array.isArray(value)&&value.length>1||first.type==="Text"))directive_invalid_value(first.start);if(node.expression=first?.expression??null,node.modifiers=modifiers,type==="TransitionDirective"){let direction=tag.name.slice(0,colon);node.intro=direction!=="out",node.outro=direction!=="in"}if((type==="BindDirective"||type==="ClassDirective")&&!node.expression)node.expression={start:start+colon+1,end,type:"Identifier",name};return node}function readAttributeValue2(state){let quote=state.source.charCodeAt(state.index),quoted=isQuote(quote);if(quoted){if(state.index++,state.source.charCodeAt(state.index)===quote)return state.index++,[text(state.index-1,state.index-1,"")]}let value;try{value=readSequence(state,quoted?(source,i)=>source.charCodeAt(i)===quote:endsUnquotedValue,"in attribute value",quoted?quote:void 0)}catch(error){let jsErrorAt=error instanceof ParseError2&&error.code==="js_parse_error"?error.position?.[0]:void 0;if(jsErrorAt!==void 0&&state.source.startsWith("/>",jsErrorAt-1))state.index=jsErrorAt,expected_token(jsErrorAt,quoted?String.fromCharCode(quote):"}");throw error}if(quoted)state.index++;else if(value.length===0)expected_attribute_value(state.index);return quoted||value.length>1||value[0].type==="Text"?value:value[0]}function readSequence(state,ends,location,quote){let{source}=state,chunks=[],textStart=state.index,flushText=(end)=>{if(end<=textStart)return;let raw=source.slice(textStart,end);chunks.push(text(textStart,end,raw,decodeCharacterReferences(raw,!0,state.entityNames)))};while(state.index<source.length){let at=state.index;if(ends(source,at))return flushText(at),chunks;if(source.charCodeAt(at)!==BRACE){if(state.index++,quote!==void 0)while(state.index<source.length&&source.charCodeAt(state.index)!==BRACE&&source.charCodeAt(state.index)!==quote)state.index++;continue}state.index++;let marker=source.charCodeAt(state.index);if(marker===35||marker===64){state.index++;let nameStart=state.index;while(state.index<source.length&&source.charCodeAt(state.index)>=97&&source.charCodeAt(state.index)<=122)state.index++;let name=source.slice(nameStart,state.index);(marker===35?block_invalid_placement:tag_invalid_placement)(at,name,location)}flushText(at),state.allowWhitespace();let expression=readExpression(state);state.eatClosingBrace(),chunks.push({type:"ExpressionTag",start:at,end:state.index,expression}),textStart=state.index}unexpected_eof(source.length)}var NAMESPACES=new Map([["html","html"],["svg","svg"],["mathml","mathml"],["http://www.w3.org/2000/svg","svg"],["http://www.w3.org/1998/Math/MathML","mathml"]]),PROP_READERS=new Map([["type",(prop,value)=>{if(value!=="String"&&value!=="Number"&&value!=="Boolean"&&value!=="Array"&&value!=="Object")return!1;return prop.type=value,!0}],["reflect",(prop,value)=>{if(typeof value!=="boolean")return!1;return prop.reflect=value,!0}],["attribute",(prop,value)=>{if(typeof value!=="string")return!1;return prop.attribute=value,!0}]]),NAME_CHAR="[a-z0-9_.\\xB7\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u203F-\\u2040\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\u{10000}-\\u{EFFFF}-]",REGEX_CUSTOM_ELEMENT_NAME2=new RegExp(`^[a-z]${NAME_CHAR}*-${NAME_CHAR}*$`,"u"),RESERVED_NAMES=new Set("annotation-xml color-profile font-face font-face-src font-face-uri font-face-format font-face-name missing-glyph".split(" ")),flag=(key)=>(options,attribute)=>{let value=staticValue(attribute);if(typeof value!=="boolean")svelte_options_invalid_attribute_value(attribute,"true or false");options[key]=value},READERS=new Map([["runes",flag("runes")],["immutable",flag("immutable")],["preserveWhitespace",flag("preserveWhitespace")],["accessors",flag("accessors")],["namespace",(options,attribute)=>{let namespace=NAMESPACES.get(staticValue(attribute));if(!namespace)svelte_options_invalid_attribute_value(attribute,'"html", "mathml" or "svg"');options.namespace=namespace}],["css",(options,attribute)=>{if(staticValue(attribute)!=="injected")svelte_options_invalid_attribute_value(attribute,'"injected"');options.css="injected"}],["tag",(_,attribute)=>svelte_options_deprecated_tag(attribute)],["customElement",(options,attribute)=>{let customElement=readCustomElement(attribute);if(customElement)options.customElement=customElement}]]);function readOptions(node){let attributes=[],options={start:node.start,end:node.end,attributes};for(let attribute of node.attributes){if(attribute.type!=="Attribute")svelte_options_invalid_attribute(attribute);attributes.push(attribute);let read=READERS.get(attribute.name);if(!read)svelte_options_unknown_attribute(attribute,attribute.name);read(options,attribute)}return options}function staticValue({value}){if(value===!0)return!0;let chunks=Array.isArray(value)?value:[value];if(chunks.length===0)return!0;if(chunks.length>1)return null;let[chunk]=chunks;if(chunk.type==="Text")return chunk.data;return chunk.expression.type==="Literal"?chunk.expression.value:null}function checkName(node,name){if(typeof name!=="string")svelte_options_invalid_tagname(node);if(!name)return;if(!REGEX_CUSTOM_ELEMENT_NAME2.test(name))svelte_options_invalid_tagname(node);if(RESERVED_NAMES.has(name))svelte_options_reserved_tagname(node)}function isNamedProperty(property){return property.type==="Property"&&!property.computed&&property.key.type==="Identifier"}function propertiesOf(object,fail){let properties=new Map;for(let property of object.properties){if(!isNamedProperty(property))fail();if(!properties.has(property.key.name))properties.set(property.key.name,property.value)}return properties}function readCustomElement(attribute){let fail=()=>svelte_options_invalid_customelement(attribute);if(attribute.value===!0)fail();let chunk=Array.isArray(attribute.value)?attribute.value[0]:attribute.value;if(chunk.type==="Text"){let tag=staticValue(attribute);return checkName(attribute,tag),{tag}}let{expression}=chunk;if(expression.type!=="ObjectExpression"){if(expression.type==="Literal"&&expression.value===null)return;fail()}let properties=propertiesOf(expression,fail),customElement={},tagValue=properties.get("tag");if(tagValue){let tag=tagValue.type==="Literal"?tagValue.value:void 0;checkName(null,tag),customElement.tag=tag}let props=properties.get("props");if(props){let failProps=()=>svelte_options_invalid_customelement_props(attribute);if(props.type!=="ObjectExpression")failProps();customElement.props={};for(let property of props.properties){if(!isNamedProperty(property)||property.value.type!=="ObjectExpression")failProps();let prop={};customElement.props[property.key.name]=prop;for(let field of property.value.properties){if(!isNamedProperty(field)||field.value.type!=="Literal")failProps();if(!PROP_READERS.get(field.key.name)?.(prop,field.value.value))failProps()}}}let shadow=properties.get("shadow");if(shadow)if(shadow.type==="ObjectExpression")customElement.shadow=shadow;else if(shadow.type==="Literal"&&(shadow.value==="open"||shadow.value==="none"))customElement.shadow=shadow.value;else svelte_options_invalid_customelement_shadow(attribute);let extend=properties.get("extend");if(extend)customElement.extend=extend;return customElement}var DEFAULT_BRACKETS={"{":"}","(":")","[":"]"};function matchBracket(source,start,brackets=DEFAULT_BRACKETS){let close=Object.values(brackets),stack=[],i=start;while(i<source.length){let char=source[i++];if(char==="'"||char==='"'||char==="`")i=matchQuote(source,i,char);else if(Object.hasOwn(brackets,char))stack.push(char);else if(close.includes(char)){let expected=brackets[stack.pop()??""];if(char!==expected)expected_token(i-1,expected);if(stack.length===0)return i}}unexpected_eof(source.length)}function matchQuote(source,start,quote){let i=start;while(i<source.length){let char=source[i++];if(char===quote)return i;if(char==="\\")i++;else if(quote==="`"&&char==="$"&&source[i]==="{")i=matchBracket(source,i)}unterminated_string_constant(start)}var REGEX_OPTIONAL_PARAM_COLON=/\?\s*:/g;function readPattern(state){let start=state.index,id=state.readIdentifierName();if(id.name!=="")return{...id,typeAnnotation:readTypeAnnotation(state)};let char=state.source[state.index];if(char!=="{"&&char!=="[")expected_pattern(state.index);state.index=matchBracket(state.source,start);let pattern=parsePatternAt(state,state.source.slice(0,state.index),start)??assignedPattern(state,start);assertType(pattern,"ObjectPattern","ArrayPattern");let typeAnnotation=readTypeAnnotation(state);if(pattern.typeAnnotation=typeAnnotation,typeAnnotation)pattern.end=typeAnnotation.end;return pattern}function assignedPattern(state,start){let{node}=parseExpressionAt(state,`${state.source.slice(0,state.index)} = 1`,start);return assertType(node,"AssignmentExpression"),node.left}function readTypeAnnotation(state){let start=state.index;if(state.allowWhitespace(),!state.eat(":")){state.index=start;return}let insert="_ as ",a=state.index-insert.length,synthetic=state.source.slice(0,a)+insert+state.source.slice(state.index).replace(REGEX_OPTIONAL_PARAM_COLON,":"),expression=parseExpressionAt(state,synthetic,a).node;if(expression.type==="AssignmentExpression"){let b=expression.right.start;while(synthetic[b]!=="=")b-=1;expression=parseExpressionAt(state,synthetic.slice(0,b),a).node}if(expression.type==="SequenceExpression")expression=expression.expressions[0];return assertType(expression,"TSAsExpression"),state.index=expression.end,{type:"TSTypeAnnotation",start,end:state.index,typeAnnotation:expression.typeAnnotation}}var CLOSING_WORDS={IfBlock:"if",EachBlock:"each",KeyBlock:"key",AwaitBlock:"await",SnippetBlock:"snippet"},fragment=()=>({type:"Fragment",nodes:[]});function openBlock(state,start){if(state.eat("if")){state.requireWhitespace();let test=readExpression(state);state.eatClosingBrace();let consequent=fragment();state.open({type:"IfBlock",elseif:!1,start,end:-1,test,consequent,alternate:null},consequent)}else if(state.eat("each"))openEach(state,start);else if(state.eat("await")){state.requireWhitespace();let expression=readExpression(state);state.allowWhitespace();let block={type:"AwaitBlock",start,end:-1,expression,value:null,error:null,pending:null,then:null,catch:null},body=fragment();if(state.eat("then"))block.value=readAwaitBinding(state),block.then=body;else if(state.eat("catch"))block.error=readAwaitBinding(state),block.catch=body;else block.pending=body;state.eat("}",!0),state.open(block,body)}else if(state.eat("key")){state.requireWhitespace();let expression=readExpression(state);state.eatClosingBrace();let body=fragment();state.open({type:"KeyBlock",start,end:-1,expression,fragment:body},body)}else if(state.eat("snippet"))openSnippet(state,start);else expected_block_type(state.index)}function readAwaitBinding(state){if(state.matchRegex(REGEX_WHITESPACE_THEN_CLOSING_BRACE))return state.allowWhitespace(),null;state.requireWhitespace();let pattern=readPattern(state);return state.allowWhitespace(),pattern}function stripTrailingAssertion(root){let found={assertion:null},end=root.end,unwrap=(node)=>{if(node.type==="TSAsExpression"&&node.end===root.end)return found.assertion=node,end=node.expression.end,node.expression;return mapChildren(node,unwrap),node},expression=root;if(root.type==="TSAsExpression")found.assertion=root,expression=root.expression,end=expression.end;else mapChildren(root,unwrap);return expression.end=end,{expression,assertion:found.assertion}}function openEach(state,start){state.requireWhitespace();let source=state.source,expression;while(!expression)try{expression=readExpression(state)}catch(error){let end=((error instanceof ParseError2?error.position:void 0)?.[0]??start)-2;while(end>start&&state.source.slice(end,end+2)!=="as")end-=1;if(end<=start)throw state.source=source,error;state.source=source.slice(0,end)}if(state.source=source,state.allowWhitespace(),!state.match("as")){if(expression.type==="SequenceExpression")expression=expression.expressions[0];let stripped=stripTrailingAssertion(expression);if(expression=stripped.expression,stripped.assertion){let rewind=stripped.assertion.typeAnnotation.start-2;while(state.source.slice(rewind,rewind+2)!=="as")rewind-=1;state.index=rewind}}let context=null,index,key;if(state.eat("as"))state.requireWhitespace(),context=readPattern(state);else state.index=expression.end;if(state.allowWhitespace(),state.eat(",")){if(state.allowWhitespace(),index=state.readIdentifierName().name,!index)expected_identifier(state.index);state.allowWhitespace()}if(state.eat("("))state.allowWhitespace(),key=readExpression(state),state.allowWhitespace(),state.eat(")",!0),state.allowWhitespace();state.eat("}",!0);let body=fragment();state.open({type:"EachBlock",start,end:-1,expression,body,context,index,key},body)}function openSnippet(state,start){state.requireWhitespace();let id=state.readIdentifierName();if(id.name==="")expected_identifier(state.index);state.allowWhitespace();let paramsStart=state.index,typeParams;if(state.isTypeScript&&state.match("<")){let end=matchBracket(state.source,paramsStart,{"<":">"});typeParams=state.source.slice(paramsStart+1,end-1),state.index=end}state.allowWhitespace(),state.eat("(",!0);let parentheses=1;while(state.index<state.source.length&&(!state.match(")")||parentheses!==1)){if(state.match("("))parentheses++;if(state.match(")"))parentheses--;state.index+=1}state.eat(")",!0);let{node}=parseExpressionAt(state,`${state.source.slice(0,state.index)} => {}`,paramsStart,!0);state.eatClosingBrace();let body=fragment();state.open({type:"SnippetBlock",start,end:-1,expression:id,typeParams,parameters:node.type==="ArrowFunctionExpression"?node.params:void 0,body},body)}function nextBlockClause(state,tagStart){let start=state.index-1,block=state.current();if(block.type==="IfBlock"){if(!state.eat("else"))expected_token(start,"{:else} or {:else if}");if(state.eat("if"))block_invalid_elseif(start);if(state.allowWhitespace(),block.alternate=fragment(),state.setFragment(block.alternate),state.eat("if")){state.requireWhitespace();let test=readExpression(state);state.eatClosingBrace();let consequent=fragment();state.open({start:tagStart,end:-1,type:"IfBlock",elseif:!0,test,consequent,alternate:null},consequent)}else state.eatClosingBrace()}else if(block.type==="EachBlock"){if(!state.eat("else"))expected_token(start,"{:else}");state.eatClosingBrace(),block.fallback=fragment(),state.setFragment(block.fallback)}else if(block.type==="AwaitBlock"){let clause;if(state.eat("then"))clause="then";else if(state.eat("catch"))clause="catch";else expected_token(start,"{:then ...} or {:catch ...}");if(block[clause])block_duplicate_clause(start,`{:${clause}}`);if(!state.eat("}")){state.requireWhitespace();let pattern=readPattern(state);if(clause==="then")block.value=pattern;else block.error=pattern;state.eatClosingBrace()}let body=fragment();block[clause]=body,state.setFragment(body)}else block_invalid_continuation_placement(start)}function closeBlock(state){let block=state.current(),word=CLOSING_WORDS[block.type];if(!word)block_unexpected_close(state.index-1);state.eat(word,!0),state.eatClosingBrace();while(block.type==="IfBlock"&&block.elseif)block.end=state.index,state.close(),block=state.current();block.end=state.index,state.close()}function isCall(expression){return expression.type==="CallExpression"||expression.type==="ChainExpression"&&expression.expression.type==="CallExpression"}function readSpecialTag(state,start){if(state.eat("html")){state.requireWhitespace();let expression=readExpression(state);state.eatClosingBrace(),state.append({type:"HtmlTag",start,end:state.index,expression})}else if(state.eat("debug")){let identifiers=[];if(!state.read(REGEX_WHITESPACE_THEN_CLOSING_BRACE)){let expression=readExpression(state),nodes=expression.type==="SequenceExpression"?expression.expressions:[expression];for(let node of nodes){if(node.type!=="Identifier")debug_tag_invalid_arguments(node.start);identifiers.push(node)}state.eatClosingBrace()}state.append({type:"DebugTag",start,end:state.index,identifiers})}else if(state.eat("const")){state.requireWhitespace();let id=readPattern(state);state.allowWhitespace(),state.eat("=",!0),state.allowWhitespace();let expressionStart=state.index,init=readExpression(state),declaratorEnd=state.index;if(init.type==="SequenceExpression"&&!state.source.slice(expressionStart,init.start).includes("("))const_tag_invalid_expression(init);state.eatClosingBrace();let declarator={type:"VariableDeclarator",id,init,start:id.start,end:declaratorEnd};state.append({type:"ConstTag",start,end:state.index,declaration:{type:"VariableDeclaration",kind:"const",declarations:[declarator],start:start+2,end:state.index-1}})}else if(state.eat("render")){state.requireWhitespace();let expression=readExpression(state);if(!isCall(expression))render_tag_invalid_expression(expression);state.eatClosingBrace(),state.append({type:"RenderTag",start,end:state.index,expression})}else expected_tag(state.index)}var REGEX_UNSUPPORTED_DECLARATION=/(?:var|interface|enum)\b/y,REGEX_MAYBE_DECLARATION=/(?:let|const|type)\b/y;function readTag(state){let start=state.index;if(state.index+=1,state.allowWhitespace(),state.eat("#"))openBlock(state,start);else if(state.eat(":"))nextBlockClause(state,start);else if(state.eat("@"))readSpecialTag(state,start);else if(state.match("/")&&!state.match("/*")&&!state.match("//"))state.index+=1,closeBlock(state);else if(!readDeclarationTag(state,start)){let expression=readExpression(state);state.eatClosingBrace(),state.append({type:"ExpressionTag",start,end:state.index,expression})}}function readDeclarationTag(state,tagStart){let start=state.index,unsupported=state.matchRegex(REGEX_UNSUPPORTED_DECLARATION);if(unsupported)declaration_tag_invalid_type({start,end:start+unsupported.length});if(!state.matchRegex(REGEX_MAYBE_DECLARATION))return!1;let commentsBefore=state.root.comments.length,statement=parseStatementAt(state,state.source,start);if(statement.type==="ExpressionStatement")return state.root.comments.length=commentsBefore,!1;if(statement.type!=="VariableDeclaration"||statement.kind!=="let"&&statement.kind!=="const")declaration_tag_invalid_type(statement);return state.index=statement.end,state.eatClosingBrace(),state.append({type:"DeclarationTag",start:tagStart,end:state.index,declaration:statement}),!0}function readText(state){let{source,index:start}=state;if(state.nextAngle<start)state.nextAngle=find(source,"<",start);if(state.nextBrace<start)state.nextBrace=find(source,"{",start);let end=Math.min(state.nextAngle,state.nextBrace);state.index=end;let raw=source.slice(start,end);state.append({type:"Text",start,end,raw,data:decodeCharacterReferences(raw,!1,state.entityNames)})}function find(source,char,from){let index=source.indexOf(char,from);return index===-1?source.length:index}function parseComponent(source,options,support){let state=componentState(source,options,support);while(state.index<state.source.length)readNode(state);return finishComponent(state)}function componentState(source,options,support){let template=withoutByteOrderMark(source);return setSource(template),new TemplateParserState(template.trimEnd(),template.length,support,options)}function finishComponent(state){if(state.stack.length>1){let current=state.current();if(current.end=current.start+1,current.type==="RegularElement")element_unclosed(current,current.name);block_unclosed(current)}let{nodes:rootNodes}=state.root.fragment,optionsIndex=rootNodes.findIndex((node)=>node.type==="SvelteOptions"),raw=rootNodes[optionsIndex];if(raw?.type==="SvelteOptions"){rootNodes.splice(optionsIndex,1),state.root.options=readOptions(raw);let{nodes}=raw.fragment;if(nodes.length>0)svelte_meta_invalid_content({start:nodes[0].start,end:nodes[nodes.length-1].end},raw.name)}return state.root}function readNode(state){if(state.match("<"))readElement(state);else if(state.match("{"))readTag(state);else readText(state)}
|
|
3
3
|
export{readElement,parseComponent,componentState,finishComponent,readNode};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
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.
|
|
2
|
+
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(`
|
|
3
|
+
`,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)==="="||next==="i"&&keywordOpAt(this,end))}if(start+=match[0].length,skipWhiteSpace.lastIndex=start,start+=skipWhiteSpace.exec(this.input)[0].length,this.input[start]===";")start++}};function keywordOpAt(parser,pos){var end=pos+1,stop=Math.min(parser.input.length,pos+11);while(end<stop){var ch=parser.fullCharCodeAt(end);if(!isIdentifierChar(ch,!0))break;end+=ch<=65535?1:2}return end===pos+2&&parser.input.slice(pos,end)==="in"||end===pos+10&&parser.input.slice(pos,end)==="instanceof"}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){if(refDestructuringErrors.parenthesizedAssign=refDestructuringErrors.trailingComma=-1,refDestructuringErrors.shorthandAssign>=left.start)refDestructuringErrors.shorthandAssign=-1;if(refDestructuringErrors.doubleProto>=left.start)refDestructuringErrors.doubleProto=-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,oldDoubleProto=-1,oldShorthandAssign=-1;if(refDestructuringErrors)oldDoubleProto=refDestructuringErrors.doubleProto,oldShorthandAssign=refDestructuringErrors.shorthandAssign,refDestructuringErrors.doubleProto=refDestructuringErrors.shorthandAssign=-1;var 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){if(result.end>expr.end){if(this.checkExpressionErrors(refDestructuringErrors,!0),refDestructuringErrors.parenthesizedAssign>=result.start)refDestructuringErrors.parenthesizedAssign=-1;if(refDestructuringErrors.parenthesizedBind>=result.start)refDestructuringErrors.parenthesizedBind=-1;if(refDestructuringErrors.trailingComma>=result.start)refDestructuringErrors.trailingComma=-1}if(oldDoubleProto>-1)refDestructuringErrors.doubleProto=oldDoubleProto;if(oldShorthandAssign>-1)refDestructuringErrors.shorthandAssign=oldShorthandAssign}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.end===base.end||element.type==="ArrowFunctionExpression"){if(optionalChained){var chainNode=this.startNodeAt(startPos,startLoc);chainNode.expression=element,element=this.finishNode(chainNode,"ChainExpression")}return element}base=element,maybeAsyncArrow=!1}};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,`
|
|
4
|
+
`),cooked:null}}else elem.value={raw:this.input.slice(this.start,this.end).replace(/\r\n?/g,`
|
|
5
|
+
`),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+=`
|
|
6
|
+
`;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]===`
|
|
7
|
+
`)++this.pos;case`
|
|
8
|
+
`: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`
|
|
9
|
+
`;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.19.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)}
|
|
10
|
+
export{isIdentifierStart,isIdentifierChar,Parser,definePlugin,extendParser,hasLineBreak,hasName};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{internName,locate3,lineBreaksBefore,lineText,isNode,fieldsOf,mapChildren}from"./shared-m0dcdh24.js";import{definePlugin,extendParser,hasLineBreak,hasName}from"./shared-
|
|
1
|
+
import{internName,locate3,lineBreaksBefore,lineText,isNode,fieldsOf,mapChildren}from"./shared-m0dcdh24.js";import{definePlugin,extendParser,hasLineBreak,hasName}from"./shared-s46wfvhw.js";import{missingTypeScript}from"./shared-h6z1kjbb.js";var REGEX_LEADING_TABS=/^\t+/;class ParseError2 extends Error{name="ParseError";code;reason;position;start;end;frame;constructor(node,code,reason){super(`${reason}
|
|
2
2
|
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}
|
|
3
3
|
${" ".repeat(digits+2+tabsToSpaces(text.slice(0,column)).length)}^`}).join(`
|
|
4
4
|
`)}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(`
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{setSource}from"./shared-m0dcdh24.js";import{parseProgram}from"./shared-
|
|
1
|
+
import{setSource}from"./shared-m0dcdh24.js";import{parseProgram}from"./shared-w3mxqtgj.js";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)}
|
|
2
2
|
export{parseModuleWith};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{decodeCharacterReferences}from"./shared-bzqbnvee.js";import{readElement,componentState,finishComponent,readNode}from"./shared-
|
|
1
|
+
import{decodeCharacterReferences}from"./shared-bzqbnvee.js";import{readElement,componentState,finishComponent,readNode}from"./shared-qqrqzz29.js";import{topLevelTags}from"./shared-a23q4q40.js";import{htmlEntityNames}from"./shared-drb44hb9.js";import{TypeScriptParser}from"./shared-dscc5xg8.js";function parseComponentSections(source,options,support){let state=componentState(source,options,support);return readTopLevelTags(state),finishComponent(state)}function readTopLevelTags(state){let{source}=state,{tags,comments}=topLevelTags(source),nodes=state.root.fragment.nodes,appendText=(start,end)=>{if(end<=start)return;let raw=source.slice(start,end),data=raw.includes("<")||raw.includes("{")?raw:decodeCharacterReferences(raw,!1,state.entityNames);nodes.push({type:"Text",start,end,raw,data})},index=0,comment=0;for(let start of tags){for(;comment<comments.length&&comments[comment]<start;comment+=2){let commentStart=comments[comment];if(commentStart<index)continue;let end=comments[comment+1];appendText(index,commentStart),nodes.push({type:"Comment",start:commentStart,end,data:source.slice(commentStart+4,end-3)}),index=end}if(start<index)continue;appendText(index,start),state.index=start,readElement(state);while(state.stack.length>1&&state.index<source.length)readNode(state);index=state.index}let options=nodes.filter((node)=>node.type==="SvelteOptions");nodes.length=0,nodes.push(...options)}var support={typescript:TypeScriptParser,entityNames:htmlEntityNames};function parseSections2(source,options){return parseComponentSections(source,options,support)}
|
|
2
2
|
export{parseSections2};
|
package/typescript.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./shared-
|
|
1
|
+
import"./shared-s46wfvhw.js";import"./shared-m0dcdh24.js";import"./shared-w3mxqtgj.js";import"./shared-f45stvzk.js";import{TypeScriptParser}from"./shared-dscc5xg8.js";import{typeScriptSupport}from"./shared-h6z1kjbb.js";var typescript=typeScriptSupport(TypeScriptParser);export{typescript};
|