eval5
Version:
A JavaScript interpreter written in JavaScript
6 lines • 129 kB
JavaScript
/*!
* @license eval5 v1.4.8
* Copyright (c) 2019-2020 nobo (MIT Licensed)
* https://github.com/bplok20010/eval5
*/
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).eval5=e()}(this,(function(){"use strict";var t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function e(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function r(t){if(t.__esModule)return t;var e=t.default;if("function"==typeof e){var r=function t(){return this instanceof t?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};r.prototype=e.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(t).forEach((function(e){var i=Object.getOwnPropertyDescriptor(t,e);Object.defineProperty(r,e,i.get?i:{enumerable:!0,get:function(){return t[e]}})})),r}var i={},s={},n={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"},a="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",o={5:a,"5module":a+" export import",6:a+" const class extends export import super"},h=/^in(stanceof)?$/,c="ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԯԱ-Ֆՙՠ-ֈא-תׯ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࡠ-ࡪࢠ-ࢴࢶ-ࣇऄ-हऽॐक़-ॡॱ-ঀঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱৼਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡૹଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-హఽౘ-ౚౠౡಀಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೞೠೡೱೲഄ-ഌഎ-ഐഒ-ഺഽൎൔ-ൖൟ-ൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄຆ-ຊຌ-ຣລວ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏽᏸ-ᏽᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜌᜎ-ᜑᜠ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡸᢀ-ᢨᢪᢰ-ᣵᤀ-ᤞᥐ-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭋᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᲀ-ᲈᲐ-ᲺᲽ-Ჿᳩ-ᳬᳮ-ᳳᳵᳶᳺᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕ℘-ℝℤΩℨK-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞ々-〇〡-〩〱-〵〸-〼ぁ-ゖ゛-ゟァ-ヺー-ヿㄅ-ㄯㄱ-ㆎㆠ-ㆿㇰ-ㇿ㐀-䶿一-鿼ꀀ-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚝꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ-ꞿꟂ-ꟊꟵ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꣽꣾꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꧠ-ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꩾ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭩꭰ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ",p="·̀-ͯ·҃-֑҇-ׇֽֿׁׂׅׄؐ-ًؚ-٩ٰۖ-ۜ۟-۪ۤۧۨ-ۭ۰-۹ܑܰ-݊ަ-ް߀-߉߫-߽߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛࣓-ࣣ࣡-ःऺ-़ा-ॏ॑-ॗॢॣ०-९ঁ-ঃ়া-ৄেৈো-্ৗৢৣ০-৯৾ਁ-ਃ਼ਾ-ੂੇੈੋ-੍ੑ੦-ੱੵઁ-ઃ઼ા-ૅે-ૉો-્ૢૣ૦-૯ૺ-૿ଁ-ଃ଼ା-ୄେୈୋ-୍୕-ୗୢୣ୦-୯ஂா-ூெ-ைொ-்ௗ௦-௯ఀ-ఄా-ౄె-ైొ-్ౕౖౢౣ౦-౯ಁ-ಃ಼ಾ-ೄೆ-ೈೊ-್ೕೖೢೣ೦-೯ഀ-ഃ഻഼ാ-ൄെ-ൈൊ-്ൗൢൣ൦-൯ඁ-ඃ්ා-ුූෘ-ෟ෦-෯ෲෳัิ-ฺ็-๎๐-๙ັິ-ຼ່-ໍ໐-໙༘༙༠-༩༹༵༷༾༿ཱ-྄྆྇ྍ-ྗྙ-ྼ࿆ါ-ှ၀-၉ၖ-ၙၞ-ၠၢ-ၤၧ-ၭၱ-ၴႂ-ႍႏ-ႝ፝-፟፩-፱ᜒ-᜔ᜲ-᜴ᝒᝓᝲᝳ឴-៓៝០-៩᠋-᠍᠐-᠙ᢩᤠ-ᤫᤰ-᤻᥆-᥏᧐-᧚ᨗ-ᨛᩕ-ᩞ᩠-᩿᩼-᪉᪐-᪙᪰-᪽ᪿᫀᬀ-ᬄ᬴-᭄᭐-᭙᭫-᭳ᮀ-ᮂᮡ-ᮭ᮰-᮹᯦-᯳ᰤ-᰷᱀-᱉᱐-᱙᳐-᳔᳒-᳨᳭᳴᳷-᳹᷀-᷹᷻-᷿‿⁀⁔⃐-⃥⃜⃡-⃰⳯-⵿⳱ⷠ-〪ⷿ-゙゚〯꘠-꘩꙯ꙴ-꙽ꚞꚟ꛰꛱ꠂ꠆ꠋꠣ-ꠧ꠬ꢀꢁꢴ-ꣅ꣐-꣙꣠-꣱ꣿ-꤉ꤦ-꤭ꥇ-꥓ꦀ-ꦃ꦳-꧀꧐-꧙ꧥ꧰-꧹ꨩ-ꨶꩃꩌꩍ꩐-꩙ꩻ-ꩽꪰꪲ-ꪴꪷꪸꪾ꪿꫁ꫫ-ꫯꫵ꫶ꯣ-ꯪ꯬꯭꯰-꯹ﬞ︀-️︠-︯︳︴﹍-﹏0-9_",u=new RegExp("["+c+"]"),l=new RegExp("["+c+p+"]");c=p=null;var d=[0,11,2,25,2,18,2,1,2,14,3,13,35,122,70,52,268,28,4,48,48,31,14,29,6,37,11,29,3,35,5,7,2,4,43,157,19,35,5,35,5,39,9,51,157,310,10,21,11,7,153,5,3,0,2,43,2,1,4,0,3,22,11,22,10,30,66,18,2,1,11,21,11,25,71,55,7,1,65,0,16,3,2,2,2,28,43,28,4,28,36,7,2,27,28,53,11,21,11,18,14,17,111,72,56,50,14,50,14,35,349,41,7,1,79,28,11,0,9,21,107,20,28,22,13,52,76,44,33,24,27,35,30,0,3,0,9,34,4,0,13,47,15,3,22,0,2,0,36,17,2,24,85,6,2,0,2,3,2,14,2,9,8,46,39,7,3,1,3,21,2,6,2,1,2,4,4,0,19,0,13,4,159,52,19,3,21,2,31,47,21,1,2,0,185,46,42,3,37,47,21,0,60,42,14,0,72,26,230,43,117,63,32,7,3,0,3,7,2,1,2,23,16,0,2,0,95,7,3,38,17,0,2,0,29,0,11,39,8,0,22,0,12,45,20,0,35,56,264,8,2,36,18,0,50,29,113,6,2,1,2,37,22,0,26,5,2,1,2,31,15,0,328,18,190,0,80,921,103,110,18,195,2749,1070,4050,582,8634,568,8,30,114,29,19,47,17,3,32,20,6,18,689,63,129,74,6,0,67,12,65,1,2,0,29,6135,9,1237,43,8,8952,286,50,2,18,3,9,395,2309,106,6,12,4,8,8,9,5991,84,2,70,2,1,3,0,3,1,3,3,2,11,2,0,2,6,2,64,2,3,3,7,2,6,2,27,2,3,2,4,2,0,4,6,2,339,3,24,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,7,2357,44,11,6,17,0,370,43,1301,196,60,67,8,0,1205,3,2,26,2,1,2,0,3,0,2,9,2,3,2,0,2,0,7,0,5,0,2,0,2,0,2,2,2,1,2,0,3,0,2,0,2,0,2,0,2,0,2,1,2,0,3,3,2,6,2,3,2,3,2,0,2,9,2,16,6,2,2,4,2,16,4421,42717,35,4148,12,221,3,5761,15,7472,3104,541,1507,4938],f=[509,0,227,0,150,4,294,9,1368,2,2,1,6,3,41,2,5,0,166,1,574,3,9,9,370,1,154,10,176,2,54,14,32,9,16,3,46,10,54,9,7,2,37,13,2,9,6,1,45,0,13,2,49,13,9,3,2,11,83,11,7,0,161,11,6,9,7,3,56,1,2,6,3,1,3,2,10,0,11,1,3,6,4,4,193,17,10,9,5,0,82,19,13,9,214,6,3,8,28,1,83,16,16,9,82,12,9,9,84,14,5,9,243,14,166,9,71,5,2,1,3,3,2,0,2,1,13,9,120,6,3,6,4,0,29,9,41,6,2,3,9,0,10,10,47,15,406,7,2,7,17,9,57,21,2,13,123,5,4,0,2,1,2,6,2,0,9,9,49,4,2,1,2,4,9,9,330,3,19306,9,135,4,60,6,26,9,1014,0,2,54,8,3,82,0,12,1,19628,1,5319,4,4,5,9,7,3,6,31,3,149,2,1418,49,513,54,5,49,9,0,15,0,23,4,2,14,1361,6,2,16,3,6,2,1,2,4,262,6,10,9,419,13,1495,6,110,6,6,9,4759,9,787719,239];function m(t,e){for(var r=65536,i=0;i<e.length;i+=2){if((r+=e[i])>t)return!1;if((r+=e[i+1])>=t)return!0}}function g(t,e){return t<65?36===t:t<91||(t<97?95===t:t<123||(t<=65535?t>=170&&u.test(String.fromCharCode(t)):!1!==e&&m(t,d)))}function x(t,e){return t<48?36===t:t<58||!(t<65)&&(t<91||(t<97?95===t:t<123||(t<=65535?t>=170&&l.test(String.fromCharCode(t)):!1!==e&&(m(t,d)||m(t,f)))))}var y=function(t,e){void 0===e&&(e={}),this.label=t,this.keyword=e.keyword,this.beforeExpr=!!e.beforeExpr,this.startsExpr=!!e.startsExpr,this.isLoop=!!e.isLoop,this.isAssign=!!e.isAssign,this.prefix=!!e.prefix,this.postfix=!!e.postfix,this.binop=e.binop||null,this.updateContext=null};function v(t,e){return new y(t,{beforeExpr:!0,binop:e})}var b={beforeExpr:!0},S={startsExpr:!0},k={};function C(t,e){return void 0===e&&(e={}),e.keyword=t,k[t]=new y(t,e)}var _={num:new y("num",S),regexp:new y("regexp",S),string:new y("string",S),name:new y("name",S),eof:new y("eof"),bracketL:new y("[",{beforeExpr:!0,startsExpr:!0}),bracketR:new y("]"),braceL:new y("{",{beforeExpr:!0,startsExpr:!0}),braceR:new y("}"),parenL:new y("(",{beforeExpr:!0,startsExpr:!0}),parenR:new y(")"),comma:new y(",",b),semi:new y(";",b),colon:new y(":",b),dot:new y("."),question:new y("?",b),questionDot:new y("?."),arrow:new y("=>",b),template:new y("template"),invalidTemplate:new y("invalidTemplate"),ellipsis:new y("...",b),backQuote:new y("`",S),dollarBraceL:new y("${",{beforeExpr:!0,startsExpr:!0}),eq:new y("=",{beforeExpr:!0,isAssign:!0}),assign:new y("_=",{beforeExpr:!0,isAssign:!0}),incDec:new y("++/--",{prefix:!0,postfix:!0,startsExpr:!0}),prefix:new y("!/~",{beforeExpr:!0,prefix:!0,startsExpr:!0}),logicalOR:v("||",1),logicalAND:v("&&",2),bitwiseOR:v("|",3),bitwiseXOR:v("^",4),bitwiseAND:v("&",5),equality:v("==/!=/===/!==",6),relational:v("</>/<=/>=",7),bitShift:v("<</>>/>>>",8),plusMin:new y("+/-",{beforeExpr:!0,binop:9,prefix:!0,startsExpr:!0}),modulo:v("%",10),star:v("*",10),slash:v("/",10),starstar:new y("**",{beforeExpr:!0}),coalesce:v("??",1),_break:C("break"),_case:C("case",b),_catch:C("catch"),_continue:C("continue"),_debugger:C("debugger"),_default:C("default",b),_do:C("do",{isLoop:!0,beforeExpr:!0}),_else:C("else",b),_finally:C("finally"),_for:C("for",{isLoop:!0}),_function:C("function",S),_if:C("if"),_return:C("return",b),_switch:C("switch"),_throw:C("throw",b),_try:C("try"),_var:C("var"),_const:C("const"),_while:C("while",{isLoop:!0}),_with:C("with"),_new:C("new",{beforeExpr:!0,startsExpr:!0}),_this:C("this",S),_super:C("super",S),_class:C("class",S),_extends:C("extends",b),_export:C("export"),_import:C("import",S),_null:C("null",S),_true:C("true",S),_false:C("false",S),_in:C("in",{beforeExpr:!0,binop:7}),_instanceof:C("instanceof",{beforeExpr:!0,binop:7}),_typeof:C("typeof",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_void:C("void",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_delete:C("delete",{beforeExpr:!0,prefix:!0,startsExpr:!0})},E=/\r\n?|\n|\u2028|\u2029/,w=new RegExp(E.source,"g");function I(t,e){return 10===t||13===t||!e&&(8232===t||8233===t)}var A=/[\u1680\u2000-\u200a\u202f\u205f\u3000\ufeff]/,T=/(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g,P=Object.prototype,N=P.hasOwnProperty,V=P.toString;function L(t,e){return N.call(t,e)}var O=Array.isArray||function(t){return"[object Array]"===V.call(t)};function R(t){return new RegExp("^(?:"+t.replace(/ /g,"|")+")$")}var D=function(t,e){this.line=t,this.column=e};D.prototype.offset=function(t){return new D(this.line,this.column+t)};var M=function(t,e,r){this.start=e,this.end=r,null!==t.sourceFile&&(this.source=t.sourceFile)};function F(t,e){for(var r=1,i=0;;){w.lastIndex=i;var s=w.exec(t);if(!(s&&s.index<e))return new D(r,e-i);++r,i=s.index+s[0].length}}var B={ecmaVersion:10,sourceType:"script",onInsertedSemicolon:null,onTrailingComma:null,allowReserved:null,allowReturnOutsideFunction:!1,allowImportExportEverywhere:!1,allowAwaitOutsideFunction:!1,allowHashBang:!1,locations:!1,onToken:null,onComment:null,ranges:!1,program:null,sourceFile:null,directSourceFile:null,preserveParens:!1};function U(t){var e={};for(var r in B)e[r]=t&&L(t,r)?t[r]:B[r];if(e.ecmaVersion>=2015&&(e.ecmaVersion-=2009),null==e.allowReserved&&(e.allowReserved=e.ecmaVersion<5),O(e.onToken)){var i=e.onToken;e.onToken=function(t){return i.push(t)}}return O(e.onComment)&&(e.onComment=function(t,e){return function(r,i,s,n,a,o){var h={type:r?"Block":"Line",value:i,start:s,end:n};t.locations&&(h.loc=new M(this,a,o)),t.ranges&&(h.range=[s,n]),e.push(h)}}(e,e.onComment)),e}function H(t,e){return 2|(t?4:0)|(e?8:0)}var j=function(t,e,r){this.options=t=U(t),this.sourceFile=t.sourceFile,this.keywords=R(o[t.ecmaVersion>=6?6:"module"===t.sourceType?"5module":5]);var i="";if(!0!==t.allowReserved){for(var s=t.ecmaVersion;!(i=n[s]);s--);"module"===t.sourceType&&(i+=" await")}this.reservedWords=R(i);var a=(i?i+" ":"")+n.strict;this.reservedWordsStrict=R(a),this.reservedWordsStrictBind=R(a+" "+n.strictBind),this.input=String(e),this.containsEsc=!1,r?(this.pos=r,this.lineStart=this.input.lastIndexOf("\n",r-1)+1,this.curLine=this.input.slice(0,this.lineStart).split(E).length):(this.pos=this.lineStart=0,this.curLine=1),this.type=_.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="module"===t.sourceType,this.strict=this.inModule||this.strictDirective(this.pos),this.potentialArrowAt=-1,this.yieldPos=this.awaitPos=this.awaitIdentPos=0,this.labels=[],this.undefinedExports={},0===this.pos&&t.allowHashBang&&"#!"===this.input.slice(0,2)&&this.skipLineComment(2),this.scopeStack=[],this.enterScope(1),this.regexpState=null},G={inFunction:{configurable:!0},inGenerator:{configurable:!0},inAsync:{configurable:!0},allowSuper:{configurable:!0},allowDirectSuper:{configurable:!0},treatFunctionsAsVar:{configurable:!0}};j.prototype.parse=function(){var t=this.options.program||this.startNode();return this.nextToken(),this.parseTopLevel(t)},G.inFunction.get=function(){return(2&this.currentVarScope().flags)>0},G.inGenerator.get=function(){return(8&this.currentVarScope().flags)>0},G.inAsync.get=function(){return(4&this.currentVarScope().flags)>0},G.allowSuper.get=function(){return(64&this.currentThisScope().flags)>0},G.allowDirectSuper.get=function(){return(128&this.currentThisScope().flags)>0},G.treatFunctionsAsVar.get=function(){return this.treatFunctionsAsVarInScope(this.currentScope())},j.prototype.inNonArrowFunction=function(){return(2&this.currentThisScope().flags)>0},j.extend=function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];for(var r=this,i=0;i<t.length;i++)r=t[i](r);return r},j.parse=function(t,e){return new this(e,t).parse()},j.parseExpressionAt=function(t,e,r){var i=new this(r,t,e);return i.nextToken(),i.parseExpression()},j.tokenizer=function(t,e){return new this(e,t)},Object.defineProperties(j.prototype,G);var q=j.prototype,W=/^(?:'((?:\\.|[^'\\])*?)'|"((?:\\.|[^"\\])*?)")/;function z(){this.shorthandAssign=this.trailingComma=this.parenthesizedAssign=this.parenthesizedBind=this.doubleProto=-1}q.strictDirective=function(t){for(;;){T.lastIndex=t,t+=T.exec(this.input)[0].length;var e=W.exec(this.input.slice(t));if(!e)return!1;if("use strict"===(e[1]||e[2])){T.lastIndex=t+e[0].length;var r=T.exec(this.input),i=r.index+r[0].length,s=this.input.charAt(i);return";"===s||"}"===s||E.test(r[0])&&!(/[(`.[+\-/*%<>=,?^&]/.test(s)||"!"===s&&"="===this.input.charAt(i+1))}t+=e[0].length,T.lastIndex=t,t+=T.exec(this.input)[0].length,";"===this.input[t]&&t++}},q.eat=function(t){return this.type===t&&(this.next(),!0)},q.isContextual=function(t){return this.type===_.name&&this.value===t&&!this.containsEsc},q.eatContextual=function(t){return!!this.isContextual(t)&&(this.next(),!0)},q.expectContextual=function(t){this.eatContextual(t)||this.unexpected()},q.canInsertSemicolon=function(){return this.type===_.eof||this.type===_.braceR||E.test(this.input.slice(this.lastTokEnd,this.start))},q.insertSemicolon=function(){if(this.canInsertSemicolon())return this.options.onInsertedSemicolon&&this.options.onInsertedSemicolon(this.lastTokEnd,this.lastTokEndLoc),!0},q.semicolon=function(){this.eat(_.semi)||this.insertSemicolon()||this.unexpected()},q.afterTrailingComma=function(t,e){if(this.type===t)return this.options.onTrailingComma&&this.options.onTrailingComma(this.lastTokStart,this.lastTokStartLoc),e||this.next(),!0},q.expect=function(t){this.eat(t)||this.unexpected()},q.unexpected=function(t){this.raise(null!=t?t:this.start,"Unexpected token")},q.checkPatternErrors=function(t,e){if(t){t.trailingComma>-1&&this.raiseRecoverable(t.trailingComma,"Comma is not permitted after the rest element");var r=e?t.parenthesizedAssign:t.parenthesizedBind;r>-1&&this.raiseRecoverable(r,"Parenthesized pattern")}},q.checkExpressionErrors=function(t,e){if(!t)return!1;var r=t.shorthandAssign,i=t.doubleProto;if(!e)return r>=0||i>=0;r>=0&&this.raise(r,"Shorthand property assignments are valid only in destructuring patterns"),i>=0&&this.raiseRecoverable(i,"Redefinition of __proto__ property")},q.checkYieldAwaitInDefaultParams=function(){this.yieldPos&&(!this.awaitPos||this.yieldPos<this.awaitPos)&&this.raise(this.yieldPos,"Yield expression cannot be a default value"),this.awaitPos&&this.raise(this.awaitPos,"Await expression cannot be a default value")},q.isSimpleAssignTarget=function(t){return"ParenthesizedExpression"===t.type?this.isSimpleAssignTarget(t.expression):"Identifier"===t.type||"MemberExpression"===t.type};var Q=j.prototype;Q.parseTopLevel=function(t){var e={};for(t.body||(t.body=[]);this.type!==_.eof;){var r=this.parseStatement(null,!0,e);t.body.push(r)}if(this.inModule)for(var i=0,s=Object.keys(this.undefinedExports);i<s.length;i+=1){var n=s[i];this.raiseRecoverable(this.undefinedExports[n].start,"Export '"+n+"' is not defined")}return this.adaptDirectivePrologue(t.body),this.next(),t.sourceType=this.options.sourceType,this.finishNode(t,"Program")};var K={kind:"loop"},X={kind:"switch"};Q.isLet=function(t){if(this.options.ecmaVersion<6||!this.isContextual("let"))return!1;T.lastIndex=this.pos;var e=T.exec(this.input),r=this.pos+e[0].length,i=this.input.charCodeAt(r);if(91===i)return!0;if(t)return!1;if(123===i)return!0;if(g(i,!0)){for(var s=r+1;x(this.input.charCodeAt(s),!0);)++s;var n=this.input.slice(r,s);if(!h.test(n))return!0}return!1},Q.isAsyncFunction=function(){if(this.options.ecmaVersion<8||!this.isContextual("async"))return!1;T.lastIndex=this.pos;var t=T.exec(this.input),e=this.pos+t[0].length;return!(E.test(this.input.slice(this.pos,e))||"function"!==this.input.slice(e,e+8)||e+8!==this.input.length&&x(this.input.charAt(e+8)))},Q.parseStatement=function(t,e,r){var i,s=this.type,n=this.startNode();switch(this.isLet(t)&&(s=_._var,i="let"),s){case _._break:case _._continue:return this.parseBreakContinueStatement(n,s.keyword);case _._debugger:return this.parseDebuggerStatement(n);case _._do:return this.parseDoStatement(n);case _._for:return this.parseForStatement(n);case _._function:return t&&(this.strict||"if"!==t&&"label"!==t)&&this.options.ecmaVersion>=6&&this.unexpected(),this.parseFunctionStatement(n,!1,!t);case _._class:return t&&this.unexpected(),this.parseClass(n,!0);case _._if:return this.parseIfStatement(n);case _._return:return this.parseReturnStatement(n);case _._switch:return this.parseSwitchStatement(n);case _._throw:return this.parseThrowStatement(n);case _._try:return this.parseTryStatement(n);case _._const:case _._var:return i=i||this.value,t&&"var"!==i&&this.unexpected(),this.parseVarStatement(n,i);case _._while:return this.parseWhileStatement(n);case _._with:return this.parseWithStatement(n);case _.braceL:return this.parseBlock(!0,n);case _.semi:return this.parseEmptyStatement(n);case _._export:case _._import:if(this.options.ecmaVersion>10&&s===_._import){T.lastIndex=this.pos;var a=T.exec(this.input),o=this.pos+a[0].length,h=this.input.charCodeAt(o);if(40===h||46===h)return this.parseExpressionStatement(n,this.parseExpression())}return this.options.allowImportExportEverywhere||(e||this.raise(this.start,"'import' and 'export' may only appear at the top level"),this.inModule||this.raise(this.start,"'import' and 'export' may appear only with 'sourceType: module'")),s===_._import?this.parseImport(n):this.parseExport(n,r);default:if(this.isAsyncFunction())return t&&this.unexpected(),this.next(),this.parseFunctionStatement(n,!0,!t);var c=this.value,p=this.parseExpression();return s===_.name&&"Identifier"===p.type&&this.eat(_.colon)?this.parseLabeledStatement(n,c,p,t):this.parseExpressionStatement(n,p)}},Q.parseBreakContinueStatement=function(t,e){var r="break"===e;this.next(),this.eat(_.semi)||this.insertSemicolon()?t.label=null:this.type!==_.name?this.unexpected():(t.label=this.parseIdent(),this.semicolon());for(var i=0;i<this.labels.length;++i){var s=this.labels[i];if(null==t.label||s.name===t.label.name){if(null!=s.kind&&(r||"loop"===s.kind))break;if(t.label&&r)break}}return i===this.labels.length&&this.raise(t.start,"Unsyntactic "+e),this.finishNode(t,r?"BreakStatement":"ContinueStatement")},Q.parseDebuggerStatement=function(t){return this.next(),this.semicolon(),this.finishNode(t,"DebuggerStatement")},Q.parseDoStatement=function(t){return this.next(),this.labels.push(K),t.body=this.parseStatement("do"),this.labels.pop(),this.expect(_._while),t.test=this.parseParenExpression(),this.options.ecmaVersion>=6?this.eat(_.semi):this.semicolon(),this.finishNode(t,"DoWhileStatement")},Q.parseForStatement=function(t){this.next();var e=this.options.ecmaVersion>=9&&(this.inAsync||!this.inFunction&&this.options.allowAwaitOutsideFunction)&&this.eatContextual("await")?this.lastTokStart:-1;if(this.labels.push(K),this.enterScope(0),this.expect(_.parenL),this.type===_.semi)return e>-1&&this.unexpected(e),this.parseFor(t,null);var r=this.isLet();if(this.type===_._var||this.type===_._const||r){var i=this.startNode(),s=r?"let":this.value;return this.next(),this.parseVar(i,!0,s),this.finishNode(i,"VariableDeclaration"),(this.type===_._in||this.options.ecmaVersion>=6&&this.isContextual("of"))&&1===i.declarations.length?(this.options.ecmaVersion>=9&&(this.type===_._in?e>-1&&this.unexpected(e):t.await=e>-1),this.parseForIn(t,i)):(e>-1&&this.unexpected(e),this.parseFor(t,i))}var n=new z,a=this.parseExpression(!0,n);return this.type===_._in||this.options.ecmaVersion>=6&&this.isContextual("of")?(this.options.ecmaVersion>=9&&(this.type===_._in?e>-1&&this.unexpected(e):t.await=e>-1),this.toAssignable(a,!1,n),this.checkLVal(a),this.parseForIn(t,a)):(this.checkExpressionErrors(n,!0),e>-1&&this.unexpected(e),this.parseFor(t,a))},Q.parseFunctionStatement=function(t,e,r){return this.next(),this.parseFunction(t,Z|(r?0:J),!1,e)},Q.parseIfStatement=function(t){return this.next(),t.test=this.parseParenExpression(),t.consequent=this.parseStatement("if"),t.alternate=this.eat(_._else)?this.parseStatement("if"):null,this.finishNode(t,"IfStatement")},Q.parseReturnStatement=function(t){return this.inFunction||this.options.allowReturnOutsideFunction||this.raise(this.start,"'return' outside of function"),this.next(),this.eat(_.semi)||this.insertSemicolon()?t.argument=null:(t.argument=this.parseExpression(),this.semicolon()),this.finishNode(t,"ReturnStatement")},Q.parseSwitchStatement=function(t){var e;this.next(),t.discriminant=this.parseParenExpression(),t.cases=[],this.expect(_.braceL),this.labels.push(X),this.enterScope(0);for(var r=!1;this.type!==_.braceR;)if(this.type===_._case||this.type===_._default){var i=this.type===_._case;e&&this.finishNode(e,"SwitchCase"),t.cases.push(e=this.startNode()),e.consequent=[],this.next(),i?e.test=this.parseExpression():(r&&this.raiseRecoverable(this.lastTokStart,"Multiple default clauses"),r=!0,e.test=null),this.expect(_.colon)}else e||this.unexpected(),e.consequent.push(this.parseStatement(null));return this.exitScope(),e&&this.finishNode(e,"SwitchCase"),this.next(),this.labels.pop(),this.finishNode(t,"SwitchStatement")},Q.parseThrowStatement=function(t){return this.next(),E.test(this.input.slice(this.lastTokEnd,this.start))&&this.raise(this.lastTokEnd,"Illegal newline after throw"),t.argument=this.parseExpression(),this.semicolon(),this.finishNode(t,"ThrowStatement")};var Y=[];Q.parseTryStatement=function(t){if(this.next(),t.block=this.parseBlock(),t.handler=null,this.type===_._catch){var e=this.startNode();if(this.next(),this.eat(_.parenL)){e.param=this.parseBindingAtom();var r="Identifier"===e.param.type;this.enterScope(r?32:0),this.checkLVal(e.param,r?4:2),this.expect(_.parenR)}else this.options.ecmaVersion<10&&this.unexpected(),e.param=null,this.enterScope(0);e.body=this.parseBlock(!1),this.exitScope(),t.handler=this.finishNode(e,"CatchClause")}return t.finalizer=this.eat(_._finally)?this.parseBlock():null,t.handler||t.finalizer||this.raise(t.start,"Missing catch or finally clause"),this.finishNode(t,"TryStatement")},Q.parseVarStatement=function(t,e){return this.next(),this.parseVar(t,!1,e),this.semicolon(),this.finishNode(t,"VariableDeclaration")},Q.parseWhileStatement=function(t){return this.next(),t.test=this.parseParenExpression(),this.labels.push(K),t.body=this.parseStatement("while"),this.labels.pop(),this.finishNode(t,"WhileStatement")},Q.parseWithStatement=function(t){return this.strict&&this.raise(this.start,"'with' in strict mode"),this.next(),t.object=this.parseParenExpression(),t.body=this.parseStatement("with"),this.finishNode(t,"WithStatement")},Q.parseEmptyStatement=function(t){return this.next(),this.finishNode(t,"EmptyStatement")},Q.parseLabeledStatement=function(t,e,r,i){for(var s=0,n=this.labels;s<n.length;s+=1){n[s].name===e&&this.raise(r.start,"Label '"+e+"' is already declared")}for(var a=this.type.isLoop?"loop":this.type===_._switch?"switch":null,o=this.labels.length-1;o>=0;o--){var h=this.labels[o];if(h.statementStart!==t.start)break;h.statementStart=this.start,h.kind=a}return this.labels.push({name:e,kind:a,statementStart:this.start}),t.body=this.parseStatement(i?-1===i.indexOf("label")?i+"label":i:"label"),this.labels.pop(),t.label=r,this.finishNode(t,"LabeledStatement")},Q.parseExpressionStatement=function(t,e){return t.expression=e,this.semicolon(),this.finishNode(t,"ExpressionStatement")},Q.parseBlock=function(t,e,r){for(void 0===t&&(t=!0),void 0===e&&(e=this.startNode()),e.body=[],this.expect(_.braceL),t&&this.enterScope(0);this.type!==_.braceR;){var i=this.parseStatement(null);e.body.push(i)}return r&&(this.strict=!1),this.next(),t&&this.exitScope(),this.finishNode(e,"BlockStatement")},Q.parseFor=function(t,e){return t.init=e,this.expect(_.semi),t.test=this.type===_.semi?null:this.parseExpression(),this.expect(_.semi),t.update=this.type===_.parenR?null:this.parseExpression(),this.expect(_.parenR),t.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(t,"ForStatement")},Q.parseForIn=function(t,e){var r=this.type===_._in;return this.next(),"VariableDeclaration"===e.type&&null!=e.declarations[0].init&&(!r||this.options.ecmaVersion<8||this.strict||"var"!==e.kind||"Identifier"!==e.declarations[0].id.type)?this.raise(e.start,(r?"for-in":"for-of")+" loop variable declaration may not have an initializer"):"AssignmentPattern"===e.type&&this.raise(e.start,"Invalid left-hand side in for-loop"),t.left=e,t.right=r?this.parseExpression():this.parseMaybeAssign(),this.expect(_.parenR),t.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(t,r?"ForInStatement":"ForOfStatement")},Q.parseVar=function(t,e,r){for(t.declarations=[],t.kind=r;;){var i=this.startNode();if(this.parseVarId(i,r),this.eat(_.eq)?i.init=this.parseMaybeAssign(e):"const"!==r||this.type===_._in||this.options.ecmaVersion>=6&&this.isContextual("of")?"Identifier"===i.id.type||e&&(this.type===_._in||this.isContextual("of"))?i.init=null:this.raise(this.lastTokEnd,"Complex binding patterns require an initialization value"):this.unexpected(),t.declarations.push(this.finishNode(i,"VariableDeclarator")),!this.eat(_.comma))break}return t},Q.parseVarId=function(t,e){t.id=this.parseBindingAtom(),this.checkLVal(t.id,"var"===e?1:2,!1)};var Z=1,J=2;Q.parseFunction=function(t,e,r,i){this.initFunction(t),(this.options.ecmaVersion>=9||this.options.ecmaVersion>=6&&!i)&&(this.type===_.star&&e&J&&this.unexpected(),t.generator=this.eat(_.star)),this.options.ecmaVersion>=8&&(t.async=!!i),e&Z&&(t.id=4&e&&this.type!==_.name?null:this.parseIdent(),!t.id||e&J||this.checkLVal(t.id,this.strict||t.generator||t.async?this.treatFunctionsAsVar?1:2:3));var s=this.yieldPos,n=this.awaitPos,a=this.awaitIdentPos;return this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(H(t.async,t.generator)),e&Z||(t.id=this.type===_.name?this.parseIdent():null),this.parseFunctionParams(t),this.parseFunctionBody(t,r,!1),this.yieldPos=s,this.awaitPos=n,this.awaitIdentPos=a,this.finishNode(t,e&Z?"FunctionDeclaration":"FunctionExpression")},Q.parseFunctionParams=function(t){this.expect(_.parenL),t.params=this.parseBindingList(_.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams()},Q.parseClass=function(t,e){this.next();var r=this.strict;this.strict=!0,this.parseClassId(t,e),this.parseClassSuper(t);var i=this.startNode(),s=!1;for(i.body=[],this.expect(_.braceL);this.type!==_.braceR;){var n=this.parseClassElement(null!==t.superClass);n&&(i.body.push(n),"MethodDefinition"===n.type&&"constructor"===n.kind&&(s&&this.raise(n.start,"Duplicate constructor in the same class"),s=!0))}return this.strict=r,this.next(),t.body=this.finishNode(i,"ClassBody"),this.finishNode(t,e?"ClassDeclaration":"ClassExpression")},Q.parseClassElement=function(t){var e=this;if(this.eat(_.semi))return null;var r=this.startNode(),i=function(t,i){void 0===i&&(i=!1);var s=e.start,n=e.startLoc;return!!e.eatContextual(t)&&(!(e.type===_.parenL||i&&e.canInsertSemicolon())||(r.key&&e.unexpected(),r.computed=!1,r.key=e.startNodeAt(s,n),r.key.name=t,e.finishNode(r.key,"Identifier"),!1))};r.kind="method",r.static=i("static");var s=this.eat(_.star),n=!1;s||(this.options.ecmaVersion>=8&&i("async",!0)?(n=!0,s=this.options.ecmaVersion>=9&&this.eat(_.star)):i("get")?r.kind="get":i("set")&&(r.kind="set")),r.key||this.parsePropertyName(r);var a=r.key,o=!1;return r.computed||r.static||!("Identifier"===a.type&&"constructor"===a.name||"Literal"===a.type&&"constructor"===a.value)?r.static&&"Identifier"===a.type&&"prototype"===a.name&&this.raise(a.start,"Classes may not have a static property named prototype"):("method"!==r.kind&&this.raise(a.start,"Constructor can't have get/set modifier"),s&&this.raise(a.start,"Constructor can't be a generator"),n&&this.raise(a.start,"Constructor can't be an async method"),r.kind="constructor",o=t),this.parseClassMethod(r,s,n,o),"get"===r.kind&&0!==r.value.params.length&&this.raiseRecoverable(r.value.start,"getter should have no params"),"set"===r.kind&&1!==r.value.params.length&&this.raiseRecoverable(r.value.start,"setter should have exactly one param"),"set"===r.kind&&"RestElement"===r.value.params[0].type&&this.raiseRecoverable(r.value.params[0].start,"Setter cannot use rest params"),r},Q.parseClassMethod=function(t,e,r,i){return t.value=this.parseMethod(e,r,i),this.finishNode(t,"MethodDefinition")},Q.parseClassId=function(t,e){this.type===_.name?(t.id=this.parseIdent(),e&&this.checkLVal(t.id,2,!1)):(!0===e&&this.unexpected(),t.id=null)},Q.parseClassSuper=function(t){t.superClass=this.eat(_._extends)?this.parseExprSubscripts():null},Q.parseExport=function(t,e){if(this.next(),this.eat(_.star))return this.options.ecmaVersion>=11&&(this.eatContextual("as")?(t.exported=this.parseIdent(!0),this.checkExport(e,t.exported.name,this.lastTokStart)):t.exported=null),this.expectContextual("from"),this.type!==_.string&&this.unexpected(),t.source=this.parseExprAtom(),this.semicolon(),this.finishNode(t,"ExportAllDeclaration");if(this.eat(_._default)){var r;if(this.checkExport(e,"default",this.lastTokStart),this.type===_._function||(r=this.isAsyncFunction())){var i=this.startNode();this.next(),r&&this.next(),t.declaration=this.parseFunction(i,4|Z,!1,r)}else if(this.type===_._class){var s=this.startNode();t.declaration=this.parseClass(s,"nullableID")}else t.declaration=this.parseMaybeAssign(),this.semicolon();return this.finishNode(t,"ExportDefaultDeclaration")}if(this.shouldParseExportStatement())t.declaration=this.parseStatement(null),"VariableDeclaration"===t.declaration.type?this.checkVariableExport(e,t.declaration.declarations):this.checkExport(e,t.declaration.id.name,t.declaration.id.start),t.specifiers=[],t.source=null;else{if(t.declaration=null,t.specifiers=this.parseExportSpecifiers(e),this.eatContextual("from"))this.type!==_.string&&this.unexpected(),t.source=this.parseExprAtom();else{for(var n=0,a=t.specifiers;n<a.length;n+=1){var o=a[n];this.checkUnreserved(o.local),this.checkLocalExport(o.local)}t.source=null}this.semicolon()}return this.finishNode(t,"ExportNamedDeclaration")},Q.checkExport=function(t,e,r){t&&(L(t,e)&&this.raiseRecoverable(r,"Duplicate export '"+e+"'"),t[e]=!0)},Q.checkPatternExport=function(t,e){var r=e.type;if("Identifier"===r)this.checkExport(t,e.name,e.start);else if("ObjectPattern"===r)for(var i=0,s=e.properties;i<s.length;i+=1){var n=s[i];this.checkPatternExport(t,n)}else if("ArrayPattern"===r)for(var a=0,o=e.elements;a<o.length;a+=1){var h=o[a];h&&this.checkPatternExport(t,h)}else"Property"===r?this.checkPatternExport(t,e.value):"AssignmentPattern"===r?this.checkPatternExport(t,e.left):"RestElement"===r?this.checkPatternExport(t,e.argument):"ParenthesizedExpression"===r&&this.checkPatternExport(t,e.expression)},Q.checkVariableExport=function(t,e){if(t)for(var r=0,i=e;r<i.length;r+=1){var s=i[r];this.checkPatternExport(t,s.id)}},Q.shouldParseExportStatement=function(){return"var"===this.type.keyword||"const"===this.type.keyword||"class"===this.type.keyword||"function"===this.type.keyword||this.isLet()||this.isAsyncFunction()},Q.parseExportSpecifiers=function(t){var e=[],r=!0;for(this.expect(_.braceL);!this.eat(_.braceR);){if(r)r=!1;else if(this.expect(_.comma),this.afterTrailingComma(_.braceR))break;var i=this.startNode();i.local=this.parseIdent(!0),i.exported=this.eatContextual("as")?this.parseIdent(!0):i.local,this.checkExport(t,i.exported.name,i.exported.start),e.push(this.finishNode(i,"ExportSpecifier"))}return e},Q.parseImport=function(t){return this.next(),this.type===_.string?(t.specifiers=Y,t.source=this.parseExprAtom()):(t.specifiers=this.parseImportSpecifiers(),this.expectContextual("from"),t.source=this.type===_.string?this.parseExprAtom():this.unexpected()),this.semicolon(),this.finishNode(t,"ImportDeclaration")},Q.parseImportSpecifiers=function(){var t=[],e=!0;if(this.type===_.name){var r=this.startNode();if(r.local=this.parseIdent(),this.checkLVal(r.local,2),t.push(this.finishNode(r,"ImportDefaultSpecifier")),!this.eat(_.comma))return t}if(this.type===_.star){var i=this.startNode();return this.next(),this.expectContextual("as"),i.local=this.parseIdent(),this.checkLVal(i.local,2),t.push(this.finishNode(i,"ImportNamespaceSpecifier")),t}for(this.expect(_.braceL);!this.eat(_.braceR);){if(e)e=!1;else if(this.expect(_.comma),this.afterTrailingComma(_.braceR))break;var s=this.startNode();s.imported=this.parseIdent(!0),this.eatContextual("as")?s.local=this.parseIdent():(this.checkUnreserved(s.imported),s.local=s.imported),this.checkLVal(s.local,2),t.push(this.finishNode(s,"ImportSpecifier"))}return t},Q.adaptDirectivePrologue=function(t){for(var e=0;e<t.length&&this.isDirectiveCandidate(t[e]);++e)t[e].directive=t[e].expression.raw.slice(1,-1)},Q.isDirectiveCandidate=function(t){return"ExpressionStatement"===t.type&&"Literal"===t.expression.type&&"string"==typeof t.expression.value&&('"'===this.input[t.start]||"'"===this.input[t.start])};var $=j.prototype;$.toAssignable=function(t,e,r){if(this.options.ecmaVersion>=6&&t)switch(t.type){case"Identifier":this.inAsync&&"await"===t.name&&this.raise(t.start,"Cannot use 'await' as identifier inside an async function");break;case"ObjectPattern":case"ArrayPattern":case"RestElement":break;case"ObjectExpression":t.type="ObjectPattern",r&&this.checkPatternErrors(r,!0);for(var i=0,s=t.properties;i<s.length;i+=1){var n=s[i];this.toAssignable(n,e),"RestElement"!==n.type||"ArrayPattern"!==n.argument.type&&"ObjectPattern"!==n.argument.type||this.raise(n.argument.start,"Unexpected token")}break;case"Property":"init"!==t.kind&&this.raise(t.key.start,"Object pattern can't contain getter or setter"),this.toAssignable(t.value,e);break;case"ArrayExpression":t.type="ArrayPattern",r&&this.checkPatternErrors(r,!0),this.toAssignableList(t.elements,e);break;case"SpreadElement":t.type="RestElement",this.toAssignable(t.argument,e),"AssignmentPattern"===t.argument.type&&this.raise(t.argument.start,"Rest elements cannot have a default value");break;case"AssignmentExpression":"="!==t.operator&&this.raise(t.left.end,"Only '=' operator can be used for specifying default value."),t.type="AssignmentPattern",delete t.operator,this.toAssignable(t.left,e);case"AssignmentPattern":break;case"ParenthesizedExpression":this.toAssignable(t.expression,e,r);break;case"ChainExpression":this.raiseRecoverable(t.start,"Optional chaining cannot appear in left-hand side");break;case"MemberExpression":if(!e)break;default:this.raise(t.start,"Assigning to rvalue")}else r&&this.checkPatternErrors(r,!0);return t},$.toAssignableList=function(t,e){for(var r=t.length,i=0;i<r;i++){var s=t[i];s&&this.toAssignable(s,e)}if(r){var n=t[r-1];6===this.options.ecmaVersion&&e&&n&&"RestElement"===n.type&&"Identifier"!==n.argument.type&&this.unexpected(n.argument.start)}return t},$.parseSpread=function(t){var e=this.startNode();return this.next(),e.argument=this.parseMaybeAssign(!1,t),this.finishNode(e,"SpreadElement")},$.parseRestBinding=function(){var t=this.startNode();return this.next(),6===this.options.ecmaVersion&&this.type!==_.name&&this.unexpected(),t.argument=this.parseBindingAtom(),this.finishNode(t,"RestElement")},$.parseBindingAtom=function(){if(this.options.ecmaVersion>=6)switch(this.type){case _.bracketL:var t=this.startNode();return this.next(),t.elements=this.parseBindingList(_.bracketR,!0,!0),this.finishNode(t,"ArrayPattern");case _.braceL:return this.parseObj(!0)}return this.parseIdent()},$.parseBindingList=function(t,e,r){for(var i=[],s=!0;!this.eat(t);)if(s?s=!1:this.expect(_.comma),e&&this.type===_.comma)i.push(null);else{if(r&&this.afterTrailingComma(t))break;if(this.type===_.ellipsis){var n=this.parseRestBinding();this.parseBindingListItem(n),i.push(n),this.type===_.comma&&this.raise(this.start,"Comma is not permitted after the rest element"),this.expect(t);break}var a=this.parseMaybeDefault(this.start,this.startLoc);this.parseBindingListItem(a),i.push(a)}return i},$.parseBindingListItem=function(t){return t},$.parseMaybeDefault=function(t,e,r){if(r=r||this.parseBindingAtom(),this.options.ecmaVersion<6||!this.eat(_.eq))return r;var i=this.startNodeAt(t,e);return i.left=r,i.right=this.parseMaybeAssign(),this.finishNode(i,"AssignmentPattern")},$.checkLVal=function(t,e,r){switch(void 0===e&&(e=0),t.type){case"Identifier":2===e&&"let"===t.name&&this.raiseRecoverable(t.start,"let is disallowed as a lexically bound name"),this.strict&&this.reservedWordsStrictBind.test(t.name)&&this.raiseRecoverable(t.start,(e?"Binding ":"Assigning to ")+t.name+" in strict mode"),r&&(L(r,t.name)&&this.raiseRecoverable(t.start,"Argument name clash"),r[t.name]=!0),0!==e&&5!==e&&this.declareName(t.name,e,t.start);break;case"ChainExpression":this.raiseRecoverable(t.start,"Optional chaining cannot appear in left-hand side");break;case"MemberExpression":e&&this.raiseRecoverable(t.start,"Binding member expression");break;case"ObjectPattern":for(var i=0,s=t.properties;i<s.length;i+=1){var n=s[i];this.checkLVal(n,e,r)}break;case"Property":this.checkLVal(t.value,e,r);break;case"ArrayPattern":for(var a=0,o=t.elements;a<o.length;a+=1){var h=o[a];h&&this.checkLVal(h,e,r)}break;case"AssignmentPattern":this.checkLVal(t.left,e,r);break;case"RestElement":this.checkLVal(t.argument,e,r);break;case"ParenthesizedExpression":this.checkLVal(t.expression,e,r);break;default:this.raise(t.start,(e?"Binding":"Assigning to")+" rvalue")}};var tt=j.prototype;tt.checkPropClash=function(t,e,r){if(!(this.options.ecmaVersion>=9&&"SpreadElement"===t.type||this.options.ecmaVersion>=6&&(t.computed||t.method||t.shorthand))){var i,s=t.key;switch(s.type){case"Identifier":i=s.name;break;case"Literal":i=String(s.value);break;default:return}var n=t.kind;if(this.options.ecmaVersion>=6)"__proto__"===i&&"init"===n&&(e.proto&&(r?r.doubleProto<0&&(r.doubleProto=s.start):this.raiseRecoverable(s.start,"Redefinition of __proto__ property")),e.proto=!0);else{var a=e[i="$"+i];if(a)("init"===n?this.strict&&a.init||a.get||a.set:a.init||a[n])&&this.raiseRecoverable(s.start,"Redefinition of property");else a=e[i]={init:!1,get:!1,set:!1};a[n]=!0}}},tt.parseExpression=function(t,e){var r=this.start,i=this.startLoc,s=this.parseMaybeAssign(t,e);if(this.type===_.comma){var n=this.startNodeAt(r,i);for(n.expressions=[s];this.eat(_.comma);)n.expressions.push(this.parseMaybeAssign(t,e));return this.finishNode(n,"SequenceExpression")}return s},tt.parseMaybeAssign=function(t,e,r){if(this.isContextual("yield")){if(this.inGenerator)return this.parseYield(t);this.exprAllowed=!1}var i=!1,s=-1,n=-1;e?(s=e.parenthesizedAssign,n=e.trailingComma,e.parenthesizedAssign=e.trailingComma=-1):(e=new z,i=!0);var a=this.start,o=this.startLoc;this.type!==_.parenL&&this.type!==_.name||(this.potentialArrowAt=this.start);var h=this.parseMaybeConditional(t,e);if(r&&(h=r.call(this,h,a,o)),this.type.isAssign){var c=this.startNodeAt(a,o);return c.operator=this.value,c.left=this.type===_.eq?this.toAssignable(h,!1,e):h,i||(e.parenthesizedAssign=e.trailingComma=e.doubleProto=-1),e.shorthandAssign>=c.left.start&&(e.shorthandAssign=-1),this.checkLVal(h),this.next(),c.right=this.parseMaybeAssign(t),this.finishNode(c,"AssignmentExpression")}return i&&this.checkExpressionErrors(e,!0),s>-1&&(e.parenthesizedAssign=s),n>-1&&(e.trailingComma=n),h},tt.parseMaybeConditional=function(t,e){var r=this.start,i=this.startLoc,s=this.parseExprOps(t,e);if(this.checkExpressionErrors(e))return s;if(this.eat(_.question)){var n=this.startNodeAt(r,i);return n.test=s,n.consequent=this.parseMaybeAssign(),this.expect(_.colon),n.alternate=this.parseMaybeAssign(t),this.finishNode(n,"ConditionalExpression")}return s},tt.parseExprOps=function(t,e){var r=this.start,i=this.startLoc,s=this.parseMaybeUnary(e,!1);return this.checkExpressionErrors(e)||s.start===r&&"ArrowFunctionExpression"===s.type?s:this.parseExprOp(s,r,i,-1,t)},tt.parseExprOp=function(t,e,r,i,s){var n=this.type.binop;if(null!=n&&(!s||this.type!==_._in)&&n>i){var a=this.type===_.logicalOR||this.type===_.logicalAND,o=this.type===_.coalesce;o&&(n=_.logicalAND.binop);var h=this.value;this.next();var c=this.start,p=this.startLoc,u=this.parseExprOp(this.parseMaybeUnary(null,!1),c,p,n,s),l=this.buildBinary(e,r,t,u,h,a||o);return(a&&this.type===_.coalesce||o&&(this.type===_.logicalOR||this.type===_.logicalAND))&&this.raiseRecoverable(this.start,"Logical expressions and coalesce expressions cannot be mixed. Wrap either by parentheses"),this.parseExprOp(l,e,r,i,s)}return t},tt.buildBinary=function(t,e,r,i,s,n){var a=this.startNodeAt(t,e);return a.left=r,a.operator=s,a.right=i,this.finishNode(a,n?"LogicalExpression":"BinaryExpression")},tt.parseMaybeUnary=function(t,e){var r,i=this.start,s=this.startLoc;if(this.isContextual("await")&&(this.inAsync||!this.inFunction&&this.options.allowAwaitOutsideFunction))r=this.parseAwait(),e=!0;else if(this.type.prefix){var n=this.startNode(),a=this.type===_.incDec;n.operator=this.value,n.prefix=!0,this.next(),n.argument=this.parseMaybeUnary(null,!0),this.checkExpressionErrors(t,!0),a?this.checkLVal(n.argument):this.strict&&"delete"===n.operator&&"Identifier"===n.argument.type?this.raiseRecoverable(n.start,"Deleting local variable in strict mode"):e=!0,r=this.finishNode(n,a?"UpdateExpression":"UnaryExpression")}else{if(r=this.parseExprSubscripts(t),this.checkExpressionErrors(t))return r;for(;this.type.postfix&&!this.canInsertSemicolon();){var o=this.startNodeAt(i,s);o.operator=this.value,o.prefix=!1,o.argument=r,this.checkLVal(r),this.next(),r=this.finishNode(o,"UpdateExpression")}}return!e&&this.eat(_.starstar)?this.buildBinary(i,s,r,this.parseMaybeUnary(null,!1),"**",!1):r},tt.parseExprSubscripts=function(t){var e=this.start,r=this.startLoc,i=this.parseExprAtom(t);if("ArrowFunctionExpression"===i.type&&")"!==this.input.slice(this.lastTokStart,this.lastTokEnd))return i;var s=this.parseSubscripts(i,e,r);return t&&"MemberExpression"===s.type&&(t.parenthesizedAssign>=s.start&&(t.parenthesizedAssign=-1),t.parenthesizedBind>=s.start&&(t.parenthesizedBind=-1)),s},tt.parseSubscripts=function(t,e,r,i){for(var s=this.options.ecmaVersion>=8&&"Identifier"===t.type&&"async"===t.name&&this.lastTokEnd===t.end&&!this.canInsertSemicolon()&&t.end-t.start==5&&this.potentialArrowAt===t.start,n=!1;;){var a=this.parseSubscript(t,e,r,i,s,n);if(a.optional&&(n=!0),a===t||"ArrowFunctionExpression"===a.type){if(n){var o=this.startNodeAt(e,r);o.expression=a,a=this.finishNode(o,"ChainExpression")}return a}t=a}},tt.parseSubscript=function(t,e,r,i,s,n){var a=this.options.ecmaVersion>=11,o=a&&this.eat(_.questionDot);i&&o&&this.raise(this.lastTokStart,"Optional chaining cannot appear in the callee of new expressions");var h=this.eat(_.bracketL);if(h||o&&this.type!==_.parenL&&this.type!==_.backQuote||this.eat(_.dot)){var c=this.startNodeAt(e,r);c.object=t,c.property=h?this.parseExpression():this.parseIdent("never"!==this.options.allowReserved),c.computed=!!h,h&&this.expect(_.bracketR),a&&(c.optional=o),t=this.finishNode(c,"MemberExpression")}else if(!i&&this.eat(_.parenL)){var p=new z,u=this.yieldPos,l=this.awaitPos,d=this.awaitIdentPos;this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0;var f=this.parseExprList(_.parenR,this.options.ecmaVersion>=8,!1,p);if(s&&!o&&!this.canInsertSemicolon()&&this.eat(_.arrow))return this.checkPatternErrors(p,!1),this.checkYieldAwaitInDefaultParams(),this.awaitIdentPos>0&&this.raise(this.awaitIdentPos,"Cannot use 'await' as identifier inside an async function"),this.yieldPos=u,this.awaitPos=l,this.awaitIdentPos=d,this.parseArrowExpression(this.startNodeAt(e,r),f,!0);this.checkExpressionErrors(p,!0),this.yieldPos=u||this.yieldPos,this.awaitPos=l||this.awaitPos,this.awaitIdentPos=d||this.awaitIdentPos;var m=this.startNodeAt(e,r);m.callee=t,m.arguments=f,a&&(m.optional=o),t=this.finishNode(m,"CallExpression")}else if(this.type===_.backQuote){(o||n)&&this.raise(this.start,"Optional chaining cannot appear in the tag of tagged template expressions");var g=this.startNodeAt(e,r);g.tag=t,g.quasi=this.parseTemplate({isTagged:!0}),t=this.finishNode(g,"TaggedTemplateExpression")}return t},tt.parseExprAtom=function(t){this.type===_.slash&&this.readRegexp();var e,r=this.potentialArrowAt===this.start;switch(this.type){case _._super:return this.allowSuper||this.raise(this.start,"'super' keyword outside a method"),e=this.startNode(),this.next(),this.type!==_.parenL||this.allowDirectSuper||this.raise(e.start,"super() call outside constructor of a subclass"),this.type!==_.dot&&this.type!==_.bracketL&&this.type!==_.parenL&&this.unexpected(),this.finishNode(e,"Super");case _._this:return e=this.startNode(),this.next(),this.finishNode(e,"ThisExpression");case _.name:var i=this.start,s=this.startLoc,n=this.containsEsc,a=this.parseIdent(!1);if(this.options.ecmaVersion>=8&&!n&&"async"===a.name&&!this.canInsertSemicolon()&&this.eat(_._function))return this.parseFunction(this.startNodeAt(i,s),0,!1,!0);if(r&&!this.canInsertSemicolon()){if(this.eat(_.arrow))return this.parseArrowExpression(this.startNodeAt(i,s),[a],!1);if(this.options.ecmaVersion>=8&&"async"===a.name&&this.type===_.name&&!n)return a=this.parseIdent(!1),!this.canInsertSemicolon()&&this.eat(_.arrow)||this.unexpected(),this.parseArrowExpression(this.startNodeAt(i,s),[a],!0)}return a;case _.regexp:var o=this.value;return(e=this.parseLiteral(o.value)).regex={pattern:o.pattern,flags:o.flags},e;case _.num:case _.string:return this.parseLiteral(this.value);case _._null:case _._true:case _._false:return(e=this.startNode()).value=this.type===_._null?null:this.type===_._true,e.raw=this.type.keyword,this.next(),this.finishNode(e,"Literal");case _.parenL:var h=this.start,c=this.parseParenAndDistinguishExpression(r);return t&&(t.parenthesizedAssign<0&&!this.isSimpleAssignTarget(c)&&(t.parenthesizedAssign=h),t.parenthesizedBind<0&&(t.parenthesizedBind=h)),c;case _.bracketL:return e=this.startNode(),this.next(),e.elements=this.parseExprList(_.bracketR,!0,!0,t),this.finishNode(e,"ArrayExpression");case _.braceL:return this.parseObj(!1,t);case _._function:return e=this.startNode(),this.next(),this.parseFunction(e,0);case _._class:return this.parseClass(this.startNode(),!1);case _._new:return this.parseNew();case _.backQuote:return this.parseTemplate();case _._import:return this.options.ecmaVersion>=11?this.parseExprImport():this.unexpected();default:this.unexpected()}},tt.parseExprImport=function(){var t=this.startNode();this.containsEsc&&this.raiseRecoverable(this.start,"Escape sequence in keyword import");var e=this.parseIdent(!0);switch(this.type){case _.parenL:return this.parseDynamicImport(t);case _.dot:return t.meta=e,this.parseImportMeta(t);default:this.unexpected()}},tt.parseDynamicImport=function(t){if(this.next(),t.source=this.parseMaybeAssign(),!this.eat(_.parenR)){var e=this.start;this.eat(_.comma)&&this.eat(_.parenR)?this.raiseRecoverable(e,"Trailing comma is not allowed in import()"):this.unexpected(e)}return this.finishNode(t,"ImportExpression")},tt.parseImportMeta=function(t){this.next();var e=this.containsEsc;return t.property=this.parseIdent(!0),"meta"!==t.property.name&&this.raiseRecoverable(t.property.start,"The only valid meta property for import is 'import.meta'"),e&&this.raiseRecoverable(t.start,"'import.meta' must not contain escaped characters"),"module"!==this.options.sourceType&&this.raiseRecoverable(t.start,"Cannot use 'import.meta' outside a module"),this.finishNode(t,"MetaProperty")},tt.parseLiteral=function(t){var e=this.startNode();return e.value=t,e.raw=this.input.slice(this.start,this.end),110===e.raw.charCodeAt(e.raw.length-1)&&(e.bigint=e.raw.slice(0,-1).replace(/_/g,"")),this.next(),this.finishNode(e,"Literal")},tt.parseParenExpression=function(){this.expect(_.parenL);var t=this.parseExpression();return this.expect(_.parenR),t},tt.parseParenAndDistinguishExpression=function(t){var e,r=this.start,i=this.startLoc,s=this.options.ecmaVersion>=8;if(this.options.ecmaVersion>=6){this.next();var n,a=this.start,o=this.startLoc,h=[],c=!0,p=!1,u=new z,l=this.yieldPos,d=this.awaitPos;for(this.yieldPos=0,this.awaitPos=0;this.type!==_.parenR;){if(c?c=!1:this.expect(_.comma),s&&this.afterTrailingComma(_.parenR,!0)){p=!0;break}if(this.type===_.ellipsis){n=this.start,h.push(this.parseParenItem(this.parseRestBinding())),this.type===_.comma&&this.raise(this.start,"Comma is not permitted after the rest element");break}h.push(this.parseMaybeAssign(!1,u,this.parseParenItem))}var f=this.start,m=this.startLoc;if(this.expect(_.parenR),t&&!this.canInsertSemicolon()&&this.eat(_.arrow))return this.checkPatternErrors(u,!1),this.checkYieldAwaitInDefaultParams(),this.yieldPos=l,this.awaitPos=d,this.parseParenArrowList(r,i,h);h.length&&!p||this.unexpected(this.lastTokStart),n&&this.unexpected(n),this.checkExpressionErrors(u,!0),this.yieldPos=l||this.yieldPos,this.awaitPos=d||this.awaitPos,h.length>1?((e=this.startNodeAt(a,o)).expressions=h,this.finishNodeAt(e,"SequenceExpression",f,m)):e=h[0]}else e=this.parseParenExpression();if(this.options.preserveParens){var g=this.startNodeAt(r,i);return g.expression=e,this.finishNode(g,"ParenthesizedExpression")}return e},tt.parseParenItem=function(t){return t},tt.parseParenArrowList=function(t,e,r){return this.parseArrowExpression(this.startNodeAt(t,e),r)};var et=[];tt.parseNew=function(){this.containsEsc&&this.raiseRecoverable(this.start,"Escape sequence in keyword new");var t=this.startNode(),e=this.parseIdent(!0);if(this.options.ecmaVersion>=6&&this.eat(_.dot)){t.meta=e;var r=this.containsEsc;return t.property=this.parseIdent(!0),"target"!==t.property.name&&this.raiseRecoverable(t.property.start,"The only valid meta property for new is 'new.target'"),r&&this.raiseRecoverable(t.start,"'new.target' must not contain escaped characters"),this.inNonArrowFunction()||this.raiseRecoverable(t.start,"'new.target' can only be used in functions"),this.finishNode(t,"MetaProperty")}var i=this.start,s=this.startLoc,n=this.type===_._import;return