driftjs-shared 0.0.4 → 0.0.6

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Hrutav Modha
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,31 @@
1
+ # driftjs-shared
2
+
3
+ > Shared core utilities, ISA constants, and instruction encoders for **DriftJS**.
4
+
5
+ Provides opcode declarations and 32-bit binary instruction encoders used across the compiler, client VM runtime, and server renderer packages.
6
+
7
+ ## Installation
8
+
9
+ ```bash
10
+ pnpm add driftjs-shared
11
+ # or
12
+ npm install driftjs-shared
13
+ ```
14
+
15
+ ## Features
16
+
17
+ - **Opcode Definitions:** Exports `Opcodes` const object defining instructions (`LOAD_CONST`, `CREATE_ELEMENT`, `EXEC_THUNK`, etc.).
18
+ - **Binary Encoders:** Functions for bitpacking opcodes and registers into 32-bit unsigned integer arrays (`encodeInstruction`, `encodeJump`, `encodeInstruction24`).
19
+
20
+ ## Usage
21
+
22
+ ```typescript
23
+ import { Opcodes, encodeInstruction } from 'driftjs-shared';
24
+
25
+ // Encode: CREATE_ELEMENT node_a = 0, node_b = 1
26
+ const word = encodeInstruction(Opcodes.CREATE_ELEMENT, 0, 1, 0);
27
+ ```
28
+
29
+ ## License
30
+
31
+ MIT © [Hrutav Modha](https://github.com/hrutavmodha)
@@ -0,0 +1,9 @@
1
+ (function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports):typeof define==`function`&&define.amd?define([`exports`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.DriftUtils={}))})(this,function(e){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var t=256;function n(e,t,n){if(!e||typeof e!=`object`)return;let r=e,i=null,a=new Set;for(;r&&r!==Object.prototype;){if(Object.prototype.hasOwnProperty.call(r,t)){r[t]=n,i=r;break}r=Object.getPrototypeOf(r)}i||=(e[t]=n,e);let o=e;for(;o&&o!==Object.prototype&&(typeof o.__drift_mark_dirty__==`function`&&a.add(o.__drift_mark_dirty__),o!==i);)o=Object.getPrototypeOf(o);for(let e of a)try{e(t)}catch{}}function r(e,t,r){if(r)for(let i of r)Object.prototype.hasOwnProperty.call(e,i)&&n(t,i,e[i])}function i(e,t){if(!e||typeof e!=`object`)return!1;let n=e;for(;n&&n!==Object.prototype;){if(Object.prototype.hasOwnProperty.call(n,t))return!0;n=Object.getPrototypeOf(n)}return!1}var a={Data:`Data`,TagOpen:`TagOpen`,EndTagOpen:`EndTagOpen`,BeforeAttributeName:`BeforeAttributeName`,AttributeName:`AttributeName`,AfterAttributeName:`AfterAttributeName`,BeforeAttributeValue:`BeforeAttributeValue`,AttributeValueQuoted:`AttributeValueQuoted`,AttributeValueInterpolation:`AttributeValueInterpolation`,Comment:`Comment`,Interpolation:`Interpolation`,RawText:`RawText`,EOF:`EOF`};a.Data,a.Comment,a.EndTagOpen,a.TagOpen,a.Interpolation,a.Data,a.EOF,a.TagOpen,a.BeforeAttributeName,a.EndTagOpen,a.BeforeAttributeName,a.BeforeAttributeName,a.AttributeName,a.Data,a.RawText,a.Data,a.AttributeName,a.AfterAttributeName,a.AfterAttributeName,a.BeforeAttributeValue,a.BeforeAttributeName,a.BeforeAttributeValue,a.AttributeValueQuoted,a.AttributeValueInterpolation,a.AttributeValueQuoted,a.BeforeAttributeName,a.AttributeValueInterpolation,a.BeforeAttributeName,a.Comment,a.Data,a.Interpolation,a.Data,a.BeforeAttributeName,a.RawText,a.RawText,a.EndTagOpen,a.EOF,a.EOF,a.EOF;var o=[509,0,227,0,150,4,294,9,1368,2,2,1,6,3,41,2,5,0,166,1,574,3,9,9,7,9,32,4,318,1,78,5,71,10,50,3,123,2,54,14,32,10,3,1,11,3,46,10,8,0,46,9,7,2,37,13,2,9,6,1,45,0,13,2,49,13,9,3,2,11,83,11,7,0,3,0,158,11,6,9,7,3,56,1,2,6,3,1,3,2,10,0,11,1,3,6,4,4,68,8,2,0,3,0,2,3,2,4,2,0,15,1,83,17,10,9,5,0,82,19,13,9,214,6,3,8,28,1,83,16,16,9,82,12,9,9,7,19,58,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,199,7,137,9,54,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,55,9,266,3,10,1,2,0,49,6,4,4,14,10,5350,0,7,14,11465,27,2343,9,87,9,39,4,60,6,26,9,535,9,470,0,2,54,8,3,82,0,12,1,19628,1,4178,9,519,45,3,22,543,4,4,5,9,7,3,6,31,3,149,2,1418,49,513,54,5,49,9,0,15,0,23,4,2,14,1361,6,2,16,3,6,2,1,2,4,101,0,161,6,10,9,357,0,62,13,499,13,245,1,2,9,233,0,3,0,8,1,6,0,475,6,110,6,6,9,4759,9,787719,239],s=[0,11,2,25,2,18,2,1,2,14,3,13,35,122,70,52,268,28,4,48,48,31,14,29,6,37,11,29,3,35,5,7,2,4,43,157,19,35,5,35,5,39,9,51,13,10,2,14,2,6,2,1,2,10,2,14,2,6,2,1,4,51,13,310,10,21,11,7,25,5,2,41,2,8,70,5,3,0,2,43,2,1,4,0,3,22,11,22,10,30,66,18,2,1,11,21,11,25,7,25,39,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,39,27,10,22,251,41,7,1,17,5,57,28,11,0,9,21,43,17,47,20,28,22,13,52,58,1,3,0,14,44,33,24,27,35,30,0,3,0,9,34,4,0,13,47,15,3,22,0,2,0,36,17,2,24,20,1,64,6,2,0,2,3,2,14,2,9,8,46,39,7,3,1,3,21,2,6,2,1,2,4,4,0,19,0,13,4,31,9,2,0,3,0,2,37,2,0,26,0,2,0,45,52,19,3,21,2,31,47,21,1,2,0,185,46,42,3,37,47,21,0,60,42,14,0,72,26,38,6,186,43,117,63,32,7,3,0,3,7,2,1,2,23,16,0,2,0,95,7,3,38,17,0,2,0,29,0,11,39,8,0,22,0,12,45,20,0,19,72,200,32,32,8,2,36,18,0,50,29,113,6,2,1,2,37,22,0,26,5,2,1,2,31,15,0,24,43,261,18,16,0,2,12,2,33,125,0,80,921,103,110,18,195,2637,96,16,1071,18,5,26,3994,6,582,6842,29,1763,568,8,30,18,78,18,29,19,47,17,3,32,20,6,18,433,44,212,63,33,24,3,24,45,74,6,0,67,12,65,1,2,0,15,4,10,7381,42,31,98,114,8702,3,2,6,2,1,2,290,16,0,30,2,3,0,15,3,9,395,2309,106,6,12,4,8,8,9,5991,84,2,70,2,1,3,0,3,1,3,3,2,11,2,0,2,6,2,64,2,3,3,7,2,6,2,27,2,3,2,4,2,0,4,6,2,339,3,24,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,7,1845,30,7,5,262,61,147,44,11,6,17,0,322,29,19,43,485,27,229,29,3,0,208,30,2,2,2,1,2,6,3,4,10,1,225,6,2,3,2,1,2,14,2,196,60,67,8,0,1205,3,2,26,2,1,2,0,3,0,2,9,2,3,2,0,2,0,7,0,5,0,2,0,2,0,2,2,2,1,2,0,3,0,2,0,2,0,2,0,2,0,2,1,2,0,3,3,2,6,2,3,2,3,2,0,2,9,2,16,6,2,2,4,2,16,4421,42719,33,4381,3,5773,3,7472,16,621,2467,541,1507,4938,6,8489],c=`‌‍·̀-ͯ·҃-֑҇-ׇֽֿׁׂׅׄؐ-ًؚ-٩ٰۖ-ۜ۟-۪ۤۧۨ-ۭ۰-۹ܑܰ-݊ަ-ް߀-߉߫-߽߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛ࢗ-࢟࣊-ࣣ࣡-ःऺ-़ा-ॏ॑-ॗॢॣ०-९ঁ-ঃ়া-ৄেৈো-্ৗৢৣ০-৯৾ਁ-ਃ਼ਾ-ੂੇੈੋ-੍ੑ੦-ੱੵઁ-ઃ઼ા-ૅે-ૉો-્ૢૣ૦-૯ૺ-૿ଁ-ଃ଼ା-ୄେୈୋ-୍୕-ୗୢୣ୦-୯ஂா-ூெ-ைொ-்ௗ௦-௯ఀ-ఄ఼ా-ౄె-ైొ-్ౕౖౢౣ౦-౯ಁ-ಃ಼ಾ-ೄೆ-ೈೊ-್ೕೖೢೣ೦-೯ೳഀ-ഃ഻഼ാ-ൄെ-ൈൊ-്ൗൢൣ൦-൯ඁ-ඃ්ා-ුූෘ-ෟ෦-෯ෲෳัิ-ฺ็-๎๐-๙ັິ-ຼ່-໎໐-໙༘༙༠-༩༹༵༷༾༿ཱ-྄྆྇ྍ-ྗྙ-ྼ࿆ါ-ှ၀-၉ၖ-ၙၞ-ၠၢ-ၤၧ-ၭၱ-ၴႂ-ႍႏ-ႝ፝-፟፩-፱ᜒ-᜕ᜲ-᜴ᝒᝓᝲᝳ឴-៓៝០-៩᠋-᠍᠏-᠙ᢩᤠ-ᤫᤰ-᤻᥆-᥏᧐-᧚ᨗ-ᨛᩕ-ᩞ᩠-᩿᩼-᪉᪐-᪙᪰-᪽ᪿ-᫝᫠-᫫ᬀ-ᬄ᬴-᭄᭐-᭙᭫-᭳ᮀ-ᮂᮡ-ᮭ᮰-᮹᯦-᯳ᰤ-᰷᱀-᱉᱐-᱙᳐-᳔᳒-᳨᳭᳴᳷-᳹᷀-᷿‌‍‿⁀⁔⃐-⃥⃜⃡-⃰⳯-⵿⳱ⷠ-〪ⷿ-゙゚〯・꘠-꘩꙯ꙴ-꙽ꚞꚟ꛰꛱ꠂ꠆ꠋꠣ-ꠧ꠬ꢀꢁꢴ-ꣅ꣐-꣙꣠-꣱ꣿ-꤉ꤦ-꤭ꥇ-꥓ꦀ-ꦃ꦳-꧀꧐-꧙ꧥ꧰-꧹ꨩ-ꨶꩃꩌꩍ꩐-꩙ꩻ-ꩽꪰꪲ-ꪴꪷꪸꪾ꪿꫁ꫫ-ꫯꫵ꫶ꯣ-ꯪ꯬꯭꯰-꯹ﬞ︀-️︠-︯︳︴﹍-﹏0-9_・`,l=`ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԯԱ-Ֆՙՠ-ֈא-תׯ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࡠ-ࡪࡰ-ࢇࢉ-࢏ࢠ-ࣉऄ-हऽॐक़-ॡॱ-ঀঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱৼਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡૹଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-హఽౘ-ౚ౜ౝౠౡಀಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽ೜-ೞೠೡೱೲഄ-ഌഎ-ഐഒ-ഺഽൎൔ-ൖൟ-ൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄຆ-ຊຌ-ຣລວ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏽᏸ-ᏽᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜑᜟ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡸᢀ-ᢨᢪᢰ-ᣵᤀ-ᤞᥐ-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭌᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᲀ-ᲊᲐ-ᲺᲽ-Ჿᳩ-ᳬᳮ-ᳳᳵᳶᳺᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕ℘-ℝℤΩℨK-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞ々-〇〡-〩〱-〵〸-〼ぁ-ゖ゛-ゟァ-ヺー-ヿㄅ-ㄯㄱ-ㆎㆠ-ㆿㇰ-ㇿ㐀-䶿一-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚝꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ-Ƛ꟱-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꣽꣾꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꧠ-ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꩾ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭩꭰ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ`,u={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`},d=`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`,f={5:d,"5module":d+` export import`,6:d+` const class extends export import super`},p=/^in(stanceof)?$/,m=RegExp(`[`+l+`]`),ee=RegExp(`[`+l+c+`]`);function h(e,t){for(var n=65536,r=0;r<t.length;r+=2){if(n+=t[r],n>e)return!1;if(n+=t[r+1],n>=e)return!0}return!1}function g(e,t){return e<65?e===36:e<91?!0:e<97?e===95:e<123?!0:e<=65535?e>=170&&m.test(String.fromCharCode(e)):t!==!1&&h(e,s)}function _(e,t){return e<48?e===36:e<58?!0:e<65?!1:e<91?!0:e<97?e===95:e<123?!0:e<=65535?e>=170&&ee.test(String.fromCharCode(e)):t===!1?!1:h(e,s)||h(e,o)}var v=function(e,t){t===void 0&&(t={}),this.label=e,this.keyword=t.keyword,this.beforeExpr=!!t.beforeExpr,this.startsExpr=!!t.startsExpr,this.isLoop=!!t.isLoop,this.isAssign=!!t.isAssign,this.prefix=!!t.prefix,this.postfix=!!t.postfix,this.binop=t.binop||null,this.updateContext=null};function y(e,t){return new v(e,{beforeExpr:!0,binop:t})}var b={beforeExpr:!0},x={startsExpr:!0},te={};function S(e,t){return t===void 0&&(t={}),t.keyword=e,te[e]=new v(e,t)}var C={num:new v(`num`,x),regexp:new v(`regexp`,x),string:new v(`string`,x),name:new v(`name`,x),privateId:new v(`privateId`,x),eof:new v(`eof`),bracketL:new v(`[`,{beforeExpr:!0,startsExpr:!0}),bracketR:new v(`]`),braceL:new v(`{`,{beforeExpr:!0,startsExpr:!0}),braceR:new v(`}`),parenL:new v(`(`,{beforeExpr:!0,startsExpr:!0}),parenR:new v(`)`),comma:new v(`,`,b),semi:new v(`;`,b),colon:new v(`:`,b),dot:new v(`.`),question:new v(`?`,b),questionDot:new v(`?.`),arrow:new v(`=>`,b),template:new v(`template`),invalidTemplate:new v(`invalidTemplate`),ellipsis:new v(`...`,b),backQuote:new v("`",x),dollarBraceL:new v("${",{beforeExpr:!0,startsExpr:!0}),eq:new v(`=`,{beforeExpr:!0,isAssign:!0}),assign:new v(`_=`,{beforeExpr:!0,isAssign:!0}),incDec:new v(`++/--`,{prefix:!0,postfix:!0,startsExpr:!0}),prefix:new v(`!/~`,{beforeExpr:!0,prefix:!0,startsExpr:!0}),logicalOR:y(`||`,1),logicalAND:y(`&&`,2),bitwiseOR:y(`|`,3),bitwiseXOR:y(`^`,4),bitwiseAND:y(`&`,5),equality:y(`==/!=/===/!==`,6),relational:y(`</>/<=/>=`,7),bitShift:y(`<</>>/>>>`,8),plusMin:new v(`+/-`,{beforeExpr:!0,binop:9,prefix:!0,startsExpr:!0}),modulo:y(`%`,10),star:y(`*`,10),slash:y(`/`,10),starstar:new v(`**`,{beforeExpr:!0}),coalesce:y(`??`,1),_break:S(`break`),_case:S(`case`,b),_catch:S(`catch`),_continue:S(`continue`),_debugger:S(`debugger`),_default:S(`default`,b),_do:S(`do`,{isLoop:!0,beforeExpr:!0}),_else:S(`else`,b),_finally:S(`finally`),_for:S(`for`,{isLoop:!0}),_function:S(`function`,x),_if:S(`if`),_return:S(`return`,b),_switch:S(`switch`),_throw:S(`throw`,b),_try:S(`try`),_var:S(`var`),_const:S(`const`),_while:S(`while`,{isLoop:!0}),_with:S(`with`),_new:S(`new`,{beforeExpr:!0,startsExpr:!0}),_this:S(`this`,x),_super:S(`super`,x),_class:S(`class`,x),_extends:S(`extends`,b),_export:S(`export`),_import:S(`import`,x),_null:S(`null`,x),_true:S(`true`,x),_false:S(`false`,x),_in:S(`in`,{beforeExpr:!0,binop:7}),_instanceof:S(`instanceof`,{beforeExpr:!0,binop:7}),_typeof:S(`typeof`,{beforeExpr:!0,prefix:!0,startsExpr:!0}),_void:S(`void`,{beforeExpr:!0,prefix:!0,startsExpr:!0}),_delete:S(`delete`,{beforeExpr:!0,prefix:!0,startsExpr:!0})},w=/\r\n?|\n|\u2028|\u2029/,ne=new RegExp(w.source,`g`);function T(e){return e===10||e===13||e===8232||e===8233}function re(e,t,n){n===void 0&&(n=e.length);for(var r=t;r<n;r++){var i=e.charCodeAt(r);if(T(i))return r<n-1&&i===13&&e.charCodeAt(r+1)===10?r+2:r+1}return-1}var ie=/[\u1680\u2000-\u200a\u202f\u205f\u3000\ufeff]/,E=/(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g,ae=Object.prototype,oe=ae.hasOwnProperty,se=ae.toString,D=Object.hasOwn||(function(e,t){return oe.call(e,t)}),ce=Array.isArray||(function(e){return se.call(e)===`[object Array]`}),le=Object.create(null);function O(e){return le[e]||(le[e]=RegExp(`^(?:`+e.replace(/ /g,`|`)+`)$`))}function k(e){return e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode((e>>10)+55296,(e&1023)+56320))}var ue=/(?:[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/,A=function(e,t){this.line=e,this.column=t};A.prototype.offset=function(e){return new A(this.line,this.column+e)};var de=function(e,t,n){this.start=t,this.end=n,e.sourceFile!==null&&(this.source=e.sourceFile)};function fe(e,t){for(var n=1,r=0;;){var i=re(e,r,t);if(i<0)return new A(n,t-r);++n,r=i}}var pe={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,onToken:null,onComment:null,ranges:!1,program:null,sourceFile:null,directSourceFile:null,preserveParens:!1},me=!1;function he(e){var t={};for(var n in pe)t[n]=e&&D(e,n)?e[n]:pe[n];if(t.ecmaVersion===`latest`?t.ecmaVersion=1e8:t.ecmaVersion==null?(!me&&typeof console==`object`&&console.warn&&(me=!0,console.warn(`Since Acorn 8.0.0, options.ecmaVersion is required.
2
+ Defaulting to 2020, but this will stop working in the future.`)),t.ecmaVersion=11):t.ecmaVersion>=2015&&(t.ecmaVersion-=2009),t.allowReserved??=t.ecmaVersion<5,(!e||e.allowHashBang==null)&&(t.allowHashBang=t.ecmaVersion>=14),ce(t.onToken)){var r=t.onToken;t.onToken=function(e){return r.push(e)}}if(ce(t.onComment)&&(t.onComment=ge(t,t.onComment)),t.sourceType===`commonjs`&&t.allowAwaitOutsideFunction)throw Error(`Cannot use allowAwaitOutsideFunction with sourceType: commonjs`);return t}function ge(e,t){return function(n,r,i,a,o,s){var c={type:n?`Block`:`Line`,value:r,start:i,end:a};e.locations&&(c.loc=new de(this,o,s)),e.ranges&&(c.range=[i,a]),t.push(c)}}var j=1,M=2,_e=4,ve=8,ye=16,be=32,xe=64,Se=128,N=256,P=512,Ce=1024,we=j|M|N;function Te(e,t){return M|(e?_e:0)|(t?ve:0)}var Ee=0,De=1,F=2,Oe=3,ke=4,Ae=5,I=function(e,t,n){this.options=e=he(e),this.sourceFile=e.sourceFile,this.keywords=O(f[e.ecmaVersion>=6?6:e.sourceType===`module`?`5module`:5]);var r=``;e.allowReserved!==!0&&(r=u[e.ecmaVersion>=6?6:e.ecmaVersion===5?5:3],e.sourceType===`module`&&(r+=` await`)),this.reservedWords=O(r);var i=(r?r+` `:``)+u.strict;this.reservedWordsStrict=O(i),this.reservedWordsStrictBind=O(i+` `+u.strictBind),this.input=String(t),this.containsEsc=!1,n?(this.pos=n,this.lineStart=this.input.lastIndexOf(`
3
+ `,n-1)+1,this.curLine=this.input.slice(0,this.lineStart).split(w).length):(this.pos=this.lineStart=0,this.curLine=1),this.type=C.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=e.sourceType===`module`,this.strict=this.inModule||e.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&&e.allowHashBang&&this.input.slice(0,2)===`#!`&&this.skipLineComment(2),this.scopeStack=[],this.enterScope(this.options.sourceType===`commonjs`?M:j),this.regexpState=null,this.privateNameStack=[]},L={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}};I.prototype.parse=function(){var e=this,t=this.options.program||this.startNode();return this.nextToken(),this.catchStackOverflow(function(){return e.parseTopLevel(t)})},L.inFunction.get=function(){return(this.currentVarScope().flags&M)>0},L.inGenerator.get=function(){return(this.currentVarScope().flags&ve)>0},L.inAsync.get=function(){return(this.currentVarScope().flags&_e)>0},L.canAwait.get=function(){for(var e=this.scopeStack.length-1;e>=0;e--){var t=this.scopeStack[e].flags;if(t&(N|P))return!1;if(t&M)return(t&_e)>0}return this.inModule&&this.options.ecmaVersion>=13||this.options.allowAwaitOutsideFunction},L.allowReturn.get=function(){return!!(this.inFunction||this.options.allowReturnOutsideFunction&&this.currentVarScope().flags&j)},L.allowSuper.get=function(){return(this.currentThisScope().flags&xe)>0||this.options.allowSuperOutsideMethod},L.allowDirectSuper.get=function(){return(this.currentThisScope().flags&Se)>0},L.treatFunctionsAsVar.get=function(){return this.treatFunctionsAsVarInScope(this.currentScope())},L.allowNewDotTarget.get=function(){for(var e=this.scopeStack.length-1;e>=0;e--){var t=this.scopeStack[e].flags;if(t&(N|P)||t&M&&!(t&ye))return!0}return!1},L.allowUsing.get=function(){var e=this.currentScope().flags;return!(e&Ce||!this.inModule&&e&j)},L.inClassStaticBlock.get=function(){return(this.currentVarScope().flags&N)>0},I.extend=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];for(var n=this,r=0;r<e.length;r++)n=e[r](n);return n},I.parse=function(e,t){return new this(t,e).parse()},I.parseExpressionAt=function(e,t,n){var r=new this(n,e,t);return r.nextToken(),r.parseExpression()},I.tokenizer=function(e,t){return new this(t,e)},Object.defineProperties(I.prototype,L);var R=I.prototype,je=/^(?:'((?:\\[^]|[^'\\])*?)'|"((?:\\[^]|[^"\\])*?)")/;R.strictDirective=function(e){if(this.options.ecmaVersion<5)return!1;for(;;){E.lastIndex=e,e+=E.exec(this.input)[0].length;var t=je.exec(this.input.slice(e));if(!t)return!1;if((t[1]||t[2])===`use strict`){E.lastIndex=e+t[0].length;var n=E.exec(this.input),r=n.index+n[0].length,i=this.input.charAt(r);return i===`;`||i===`}`||w.test(n[0])&&!(/[(`.[+\-/*%<>=,?^&]/.test(i)||i===`!`&&this.input.charAt(r+1)===`=`)}e+=t[0].length,E.lastIndex=e,e+=E.exec(this.input)[0].length,this.input[e]===`;`&&e++}},R.eat=function(e){return this.type===e?(this.next(),!0):!1},R.isContextual=function(e){return this.type===C.name&&this.value===e&&!this.containsEsc},R.eatContextual=function(e){return this.isContextual(e)?(this.next(),!0):!1},R.catchStackOverflow=function(e){try{return e()}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}},R.expectContextual=function(e){this.eatContextual(e)||this.unexpected()},R.canInsertSemicolon=function(){return this.type===C.eof||this.type===C.braceR||w.test(this.input.slice(this.lastTokEnd,this.start))},R.insertSemicolon=function(){if(this.canInsertSemicolon())return this.options.onInsertedSemicolon&&this.options.onInsertedSemicolon(this.lastTokEnd,this.lastTokEndLoc),!0},R.semicolon=function(){!this.eat(C.semi)&&!this.insertSemicolon()&&this.unexpected()},R.afterTrailingComma=function(e,t){if(this.type===e)return this.options.onTrailingComma&&this.options.onTrailingComma(this.lastTokStart,this.lastTokStartLoc),t||this.next(),!0},R.expect=function(e){this.eat(e)||this.unexpected()},R.unexpected=function(e){this.raise(e??this.start,`Unexpected token`)};var Me=function(){this.shorthandAssign=this.trailingComma=this.parenthesizedAssign=this.parenthesizedBind=this.doubleProto=-1};R.checkPatternErrors=function(e,t){if(e){e.trailingComma>-1&&this.raiseRecoverable(e.trailingComma,`Comma is not permitted after the rest element`);var n=t?e.parenthesizedAssign:e.parenthesizedBind;n>-1&&this.raiseRecoverable(n,t?`Assigning to rvalue`:`Parenthesized pattern`)}},R.checkExpressionErrors=function(e,t){if(!e)return!1;var n=e.shorthandAssign,r=e.doubleProto;if(!t)return n>=0||r>=0;n>=0&&this.raise(n,`Shorthand property assignments are valid only in destructuring patterns`),r>=0&&this.raiseRecoverable(r,`Redefinition of __proto__ property`)},R.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`)},R.isSimpleAssignTarget=function(e){return e.type===`ParenthesizedExpression`?this.isSimpleAssignTarget(e.expression):e.type===`Identifier`||e.type===`MemberExpression`};var z=I.prototype;z.parseTopLevel=function(e){var t=Object.create(null);for(e.body||=[];this.type!==C.eof;){var n=this.parseStatement(null,!0,t);e.body.push(n)}if(this.inModule)for(var r=0,i=Object.keys(this.undefinedExports);r<i.length;r+=1){var a=i[r];this.raiseRecoverable(this.undefinedExports[a].start,`Export '`+a+`' is not defined`)}return this.adaptDirectivePrologue(e.body),this.next(),e.sourceType=this.options.sourceType===`commonjs`?`script`:this.options.sourceType,this.finishNode(e,`Program`)};var Ne={kind:`loop`},Pe={kind:`switch`};z.isLet=function(e){if(this.options.ecmaVersion<6||!this.isContextual(`let`))return!1;E.lastIndex=this.pos;var t=E.exec(this.input),n=this.pos+t[0].length,r=this.fullCharCodeAt(n);if(r===91||r===92)return!0;if(e)return!1;if(r===123)return!0;if(g(r)){var i=n;do n+=r<=65535?1:2;while(_(r=this.fullCharCodeAt(n)));if(r===92)return!0;var a=this.input.slice(i,n);if(!p.test(a))return!0}return!1},z.isAsyncFunction=function(){if(this.options.ecmaVersion<8||!this.isContextual(`async`))return!1;E.lastIndex=this.pos;var e=E.exec(this.input),t=this.pos+e[0].length,n;return!w.test(this.input.slice(this.pos,t))&&this.input.slice(t,t+8)===`function`&&(t+8===this.input.length||!(_(n=this.fullCharCodeAt(t+8))||n===92))},z.isUsingKeyword=function(e,t){if(this.options.ecmaVersion<17||!this.isContextual(e?`await`:`using`))return!1;E.lastIndex=this.pos;var n=E.exec(this.input),r=this.pos+n[0].length;if(w.test(this.input.slice(this.pos,r)))return!1;if(e){var i=r+5,a;if(this.input.slice(r,i)!==`using`||i===this.input.length||_(a=this.fullCharCodeAt(i))||a===92)return!1;E.lastIndex=i;var o=E.exec(this.input);if(r=i+o[0].length,o&&w.test(this.input.slice(i,r)))return!1}var s=this.fullCharCodeAt(r);if(!g(s)&&s!==92)return!1;var c=r;do r+=s<=65535?1:2;while(_(s=this.fullCharCodeAt(r)));if(s===92)return!0;var l=this.input.slice(c,r);if(p.test(l))return!1;if(t&&!e&&l===`of`){E.lastIndex=r;var u=E.exec(this.input);if(r+=u[0].length,this.input.charCodeAt(r)!==61||(s=this.input.charCodeAt(r+1))===61||s===62)return!1}return!0},z.isAwaitUsing=function(e){return this.isUsingKeyword(!0,e)},z.isUsing=function(e){return this.isUsingKeyword(!1,e)},z.parseStatement=function(e,t,n){var r=this.type,i=this.startNode(),a;switch(this.isLet(e)&&(r=C._var,a=`let`),r){case C._break:case C._continue:return this.parseBreakContinueStatement(i,r.keyword);case C._debugger:return this.parseDebuggerStatement(i);case C._do:return this.parseDoStatement(i);case C._for:return this.parseForStatement(i);case C._function:return e&&(this.strict||e!==`if`&&e!==`label`)&&this.options.ecmaVersion>=6&&this.unexpected(),this.parseFunctionStatement(i,!1,!e);case C._class:return e&&this.unexpected(),this.parseClass(i,!0);case C._if:return this.parseIfStatement(i);case C._return:return this.parseReturnStatement(i);case C._switch:return this.parseSwitchStatement(i);case C._throw:return this.parseThrowStatement(i);case C._try:return this.parseTryStatement(i);case C._const:case C._var:return a||=this.value,e&&a!==`var`&&this.unexpected(),this.parseVarStatement(i,a);case C._while:return this.parseWhileStatement(i);case C._with:return this.parseWithStatement(i);case C.braceL:return this.parseBlock(!0,i);case C.semi:return this.parseEmptyStatement(i);case C._export:case C._import:if(this.options.ecmaVersion>10&&r===C._import){E.lastIndex=this.pos;var o=E.exec(this.input),s=this.pos+o[0].length,c=this.input.charCodeAt(s);if(c===40||c===46)return this.parseExpressionStatement(i,this.parseExpression())}return this.options.allowImportExportEverywhere||(t||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'`)),r===C._import?this.parseImport(i):this.parseExport(i,n);default:if(this.isAsyncFunction())return e&&this.unexpected(),this.next(),this.parseFunctionStatement(i,!0,!e);var l=this.isAwaitUsing(!1)?`await using`:this.isUsing(!1)?`using`:null;if(l)return 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"),e&&this.raise(this.start,`Using declaration is not allowed in single-statement positions`),l===`await using`&&(this.canAwait||this.raise(this.start,`Await using cannot appear outside of async function`),this.next()),this.next(),this.parseVar(i,!1,l),this.semicolon(),this.finishNode(i,`VariableDeclaration`);var u=this.value,d=this.parseExpression();return r===C.name&&d.type===`Identifier`&&this.eat(C.colon)?this.parseLabeledStatement(i,u,d,e):this.parseExpressionStatement(i,d)}},z.parseBreakContinueStatement=function(e,t){var n=t===`break`;this.next(),this.eat(C.semi)||this.insertSemicolon()?e.label=null:this.type===C.name?(e.label=this.parseIdent(),this.semicolon()):this.unexpected();for(var r=0;r<this.labels.length;++r){var i=this.labels[r];if((e.label==null||i.name===e.label.name)&&(i.kind!=null&&(n||i.kind===`loop`)||e.label&&n))break}return r===this.labels.length&&this.raise(e.start,`Unsyntactic `+t),this.finishNode(e,n?`BreakStatement`:`ContinueStatement`)},z.parseDebuggerStatement=function(e){return this.next(),this.semicolon(),this.finishNode(e,`DebuggerStatement`)},z.parseDoStatement=function(e){return this.next(),this.labels.push(Ne),e.body=this.parseStatement(`do`),this.labels.pop(),this.expect(C._while),e.test=this.parseParenExpression(),this.options.ecmaVersion>=6?this.eat(C.semi):this.semicolon(),this.finishNode(e,`DoWhileStatement`)},z.parseForStatement=function(e){this.next();var t=this.options.ecmaVersion>=9&&this.canAwait&&this.eatContextual(`await`)?this.lastTokStart:-1;if(this.labels.push(Ne),this.enterScope(0),this.expect(C.parenL),this.type===C.semi)return t>-1&&this.unexpected(t),this.parseFor(e,null);var n=this.isLet();if(this.type===C._var||this.type===C._const||n){var r=this.startNode(),i=n?`let`:this.value;return this.next(),this.parseVar(r,!0,i),this.finishNode(r,`VariableDeclaration`),this.parseForAfterInit(e,r,t)}var a=this.isContextual(`let`),o=!1,s=this.isUsing(!0)?`using`:this.isAwaitUsing(!0)?`await using`:null;if(s){var c=this.startNode();return this.next(),s===`await using`&&(this.canAwait||this.raise(this.start,`Await using cannot appear outside of async function`),this.next()),this.parseVar(c,!0,s),this.finishNode(c,`VariableDeclaration`),this.parseForAfterInit(e,c,t)}var l=this.containsEsc,u=new Me,d=this.start,f=t>-1?this.parseExprSubscripts(u,`await`):this.parseExpression(!0,u);return this.type===C._in||(o=this.options.ecmaVersion>=6&&this.isContextual(`of`))?(t>-1?(this.type===C._in&&this.unexpected(t),e.await=!0):o&&this.options.ecmaVersion>=8&&(f.start===d&&!l&&f.type===`Identifier`&&f.name===`async`?this.unexpected():this.options.ecmaVersion>=9&&(e.await=!1)),a&&o&&this.raise(f.start,`The left-hand side of a for-of loop may not start with 'let'.`),this.toAssignable(f,!1,u),this.checkLValPattern(f),this.parseForIn(e,f)):(this.checkExpressionErrors(u,!0),t>-1&&this.unexpected(t),this.parseFor(e,f))},z.parseForAfterInit=function(e,t,n){return(this.type===C._in||this.options.ecmaVersion>=6&&this.isContextual(`of`))&&t.declarations.length===1?(this.type===C._in?((t.kind===`using`||t.kind===`await using`)&&!t.declarations[0].init&&this.raise(this.start,`Using declaration is not allowed in for-in loops`),this.options.ecmaVersion>=9&&n>-1&&this.unexpected(n)):this.options.ecmaVersion>=9&&(e.await=n>-1),this.parseForIn(e,t)):(n>-1&&this.unexpected(n),this.parseFor(e,t))},z.parseFunctionStatement=function(e,t,n){return this.next(),this.parseFunction(e,B|(n?0:Ie),!1,t)},z.parseIfStatement=function(e){return this.next(),e.test=this.parseParenExpression(),e.consequent=this.parseStatement(`if`),e.alternate=this.eat(C._else)?this.parseStatement(`if`):null,this.finishNode(e,`IfStatement`)},z.parseReturnStatement=function(e){return this.allowReturn||this.raise(this.start,`'return' outside of function`),this.next(),this.eat(C.semi)||this.insertSemicolon()?e.argument=null:(e.argument=this.parseExpression(),this.semicolon()),this.finishNode(e,`ReturnStatement`)},z.parseSwitchStatement=function(e){this.next(),e.discriminant=this.parseParenExpression(),e.cases=[],this.expect(C.braceL),this.labels.push(Pe),this.enterScope(Ce);for(var t,n=!1;this.type!==C.braceR;)if(this.type===C._case||this.type===C._default){var r=this.type===C._case;t&&this.finishNode(t,`SwitchCase`),e.cases.push(t=this.startNode()),t.consequent=[],this.next(),r?t.test=this.parseExpression():(n&&this.raiseRecoverable(this.lastTokStart,`Multiple default clauses`),n=!0,t.test=null),this.expect(C.colon)}else t||this.unexpected(),t.consequent.push(this.parseStatement(null));return this.exitScope(),t&&this.finishNode(t,`SwitchCase`),this.next(),this.labels.pop(),this.finishNode(e,`SwitchStatement`)},z.parseThrowStatement=function(e){return this.next(),w.test(this.input.slice(this.lastTokEnd,this.start))&&this.raise(this.lastTokEnd,`Illegal newline after throw`),e.argument=this.parseExpression(),this.semicolon(),this.finishNode(e,`ThrowStatement`)};var Fe=[];z.parseCatchClauseParam=function(){var e=this.parseBindingAtom(),t=e.type===`Identifier`;return this.enterScope(t?be:0),this.checkLValPattern(e,t?ke:F),this.expect(C.parenR),e},z.parseTryStatement=function(e){if(this.next(),e.block=this.parseBlock(),e.handler=null,this.type===C._catch){var t=this.startNode();this.next(),this.eat(C.parenL)?t.param=this.parseCatchClauseParam():(this.options.ecmaVersion<10&&this.unexpected(),t.param=null,this.enterScope(0)),t.body=this.parseBlock(!1),this.exitScope(),e.handler=this.finishNode(t,`CatchClause`)}return e.finalizer=this.eat(C._finally)?this.parseBlock():null,!e.handler&&!e.finalizer&&this.raise(e.start,`Missing catch or finally clause`),this.finishNode(e,`TryStatement`)},z.parseVarStatement=function(e,t,n){return this.next(),this.parseVar(e,!1,t,n),this.semicolon(),this.finishNode(e,`VariableDeclaration`)},z.parseWhileStatement=function(e){return this.next(),e.test=this.parseParenExpression(),this.labels.push(Ne),e.body=this.parseStatement(`while`),this.labels.pop(),this.finishNode(e,`WhileStatement`)},z.parseWithStatement=function(e){return this.strict&&this.raise(this.start,`'with' in strict mode`),this.next(),e.object=this.parseParenExpression(),e.body=this.parseStatement(`with`),this.finishNode(e,`WithStatement`)},z.parseEmptyStatement=function(e){return this.next(),this.finishNode(e,`EmptyStatement`)},z.parseLabeledStatement=function(e,t,n,r){for(var i=0,a=this.labels;i<a.length;i+=1)a[i].name===t&&this.raise(n.start,`Label '`+t+`' is already declared`);for(var o=this.type.isLoop?`loop`:this.type===C._switch?`switch`:null,s=this.labels.length-1;s>=0;s--){var c=this.labels[s];if(c.statementStart===e.start)c.statementStart=this.start,c.kind=o;else break}return this.labels.push({name:t,kind:o,statementStart:this.start}),e.body=this.parseStatement(r?r.indexOf(`label`)===-1?r+`label`:r:`label`),this.labels.pop(),e.label=n,this.finishNode(e,`LabeledStatement`)},z.parseExpressionStatement=function(e,t){return e.expression=t,this.semicolon(),this.finishNode(e,`ExpressionStatement`)},z.parseBlock=function(e,t,n){for(e===void 0&&(e=!0),t===void 0&&(t=this.startNode()),t.body=[],this.expect(C.braceL),e&&this.enterScope(0);this.type!==C.braceR;){var r=this.parseStatement(null);t.body.push(r)}return n&&(this.strict=!1),this.next(),e&&this.exitScope(),this.finishNode(t,`BlockStatement`)},z.parseFor=function(e,t){return e.init=t,this.expect(C.semi),e.test=this.type===C.semi?null:this.parseExpression(),this.expect(C.semi),e.update=this.type===C.parenR?null:this.parseExpression(),this.expect(C.parenR),e.body=this.parseStatement(`for`),this.exitScope(),this.labels.pop(),this.finishNode(e,`ForStatement`)},z.parseForIn=function(e,t){var n=this.type===C._in;return this.next(),t.type===`VariableDeclaration`&&t.declarations[0].init!=null&&(!n||this.options.ecmaVersion<8||this.strict||t.kind!==`var`||t.declarations[0].id.type!==`Identifier`)&&this.raise(t.start,(n?`for-in`:`for-of`)+` loop variable declaration may not have an initializer`),e.left=t,e.right=n?this.parseExpression():this.parseMaybeAssign(),this.expect(C.parenR),e.body=this.parseStatement(`for`),this.exitScope(),this.labels.pop(),this.finishNode(e,n?`ForInStatement`:`ForOfStatement`)},z.parseVar=function(e,t,n,r){for(e.declarations=[],e.kind=n;;){var i=this.startNode();if(this.parseVarId(i,n),this.eat(C.eq)?i.init=this.parseMaybeAssign(t):!r&&n===`const`&&!(this.type===C._in||this.options.ecmaVersion>=6&&this.isContextual(`of`))?this.unexpected():!r&&(n===`using`||n===`await using`)&&this.options.ecmaVersion>=17&&this.type!==C._in&&!this.isContextual(`of`)?this.raise(this.lastTokEnd,`Missing initializer in `+n+` declaration`):!r&&i.id.type!==`Identifier`&&!(t&&(this.type===C._in||this.isContextual(`of`)))?this.raise(this.lastTokEnd,`Complex binding patterns require an initialization value`):i.init=null,e.declarations.push(this.finishNode(i,`VariableDeclarator`)),!this.eat(C.comma))break}return e},z.parseVarId=function(e,t){e.id=t===`using`||t===`await using`?this.parseIdent():this.parseBindingAtom(),this.checkLValPattern(e.id,t===`var`?De:F,!1)};var B=1,Ie=2,Le=4;z.parseFunction=function(e,t,n,r,i){this.initFunction(e),(this.options.ecmaVersion>=9||this.options.ecmaVersion>=6&&!r)&&(this.type===C.star&&t&Ie&&this.unexpected(),e.generator=this.eat(C.star)),this.options.ecmaVersion>=8&&(e.async=!!r),t&B&&(e.id=t&Le&&this.type!==C.name?null:this.parseIdent(),e.id&&!(t&Ie)&&this.checkLValSimple(e.id,this.strict||e.generator||e.async?this.treatFunctionsAsVar?De:F:Oe));var a=this.yieldPos,o=this.awaitPos,s=this.awaitIdentPos;return this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(Te(e.async,e.generator)),t&B||(e.id=this.type===C.name?this.parseIdent():null),this.parseFunctionParams(e),this.parseFunctionBody(e,n,!1,i),this.yieldPos=a,this.awaitPos=o,this.awaitIdentPos=s,this.finishNode(e,t&B?`FunctionDeclaration`:`FunctionExpression`)},z.parseFunctionParams=function(e){this.expect(C.parenL),e.params=this.parseBindingList(C.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams()},z.parseClass=function(e,t){this.next();var n=this.strict;this.strict=!0,this.parseClassId(e,t),this.parseClassSuper(e);var r=this.enterClassBody(),i=this.startNode(),a=!1;for(i.body=[],this.expect(C.braceL);this.type!==C.braceR;){var o=this.parseClassElement(e.superClass!==null);o&&(i.body.push(o),o.type===`MethodDefinition`&&o.kind===`constructor`?(a&&this.raiseRecoverable(o.start,`Duplicate constructor in the same class`),a=!0):o.key&&o.key.type===`PrivateIdentifier`&&Re(r,o)&&this.raiseRecoverable(o.key.start,`Identifier '#`+o.key.name+`' has already been declared`))}return this.strict=n,this.next(),e.body=this.finishNode(i,`ClassBody`),this.exitClassBody(),this.finishNode(e,t?`ClassDeclaration`:`ClassExpression`)},z.parseClassElement=function(e){if(this.eat(C.semi))return null;var t=this.options.ecmaVersion,n=this.startNode(),r=``,i=!1,a=!1,o=`method`,s=!1;if(this.eatContextual(`static`)){if(t>=13&&this.eat(C.braceL))return this.parseClassStaticBlock(n),n;this.isClassElementNameStart()||this.type===C.star?s=!0:r=`static`}if(n.static=s,!r&&t>=8&&this.eatContextual(`async`)&&((this.isClassElementNameStart()||this.type===C.star)&&!this.canInsertSemicolon()?a=!0:r=`async`),!r&&(t>=9||!a)&&this.eat(C.star)&&(i=!0),!r&&!a&&!i){var c=this.value;(this.eatContextual(`get`)||this.eatContextual(`set`))&&(this.isClassElementNameStart()?o=c:r=c)}if(r?(n.computed=!1,n.key=this.startNodeAt(this.lastTokStart,this.lastTokStartLoc),n.key.name=r,this.finishNode(n.key,`Identifier`)):this.parseClassElementName(n),t<13||this.type===C.parenL||o!==`method`||i||a){var l=!n.static&&ze(n,`constructor`),u=l&&e;l&&o!==`method`&&this.raise(n.key.start,`Constructor can't have get/set modifier`),n.kind=l?`constructor`:o,this.parseClassMethod(n,i,a,u)}else this.parseClassField(n);return n},z.isClassElementNameStart=function(){return this.type===C.name||this.type===C.privateId||this.type===C.num||this.type===C.string||this.type===C.bracketL||this.type.keyword},z.parseClassElementName=function(e){this.type===C.privateId?(this.value===`constructor`&&this.raise(this.start,`Classes can't have an element named '#constructor'`),e.computed=!1,e.key=this.parsePrivateIdent()):this.parsePropertyName(e)},z.parseClassMethod=function(e,t,n,r){var i=e.key;e.kind===`constructor`?(t&&this.raise(i.start,`Constructor can't be a generator`),n&&this.raise(i.start,`Constructor can't be an async method`)):e.static&&ze(e,`prototype`)&&this.raise(i.start,`Classes may not have a static property named prototype`);var a=e.value=this.parseMethod(t,n,r);return e.kind===`get`&&a.params.length!==0&&this.raiseRecoverable(a.start,`getter should have no params`),e.kind===`set`&&a.params.length!==1&&this.raiseRecoverable(a.start,`setter should have exactly one param`),e.kind===`set`&&a.params[0].type===`RestElement`&&this.raiseRecoverable(a.params[0].start,`Setter cannot use rest params`),this.finishNode(e,`MethodDefinition`)},z.parseClassField=function(e){return ze(e,`constructor`)?this.raise(e.key.start,`Classes can't have a field named 'constructor'`):e.static&&ze(e,`prototype`)&&this.raise(e.key.start,`Classes can't have a static field named 'prototype'`),this.eat(C.eq)?(this.enterScope(P|xe),e.value=this.parseMaybeAssign(),this.exitScope()):e.value=null,this.semicolon(),this.finishNode(e,`PropertyDefinition`)},z.parseClassStaticBlock=function(e){e.body=[];var t=this.labels;for(this.labels=[],this.enterScope(N|xe);this.type!==C.braceR;){var n=this.parseStatement(null);e.body.push(n)}return this.next(),this.exitScope(),this.labels=t,this.finishNode(e,`StaticBlock`)},z.parseClassId=function(e,t){this.type===C.name?(e.id=this.parseIdent(),t&&this.checkLValSimple(e.id,F,!1)):(t===!0&&this.unexpected(),e.id=null)},z.parseClassSuper=function(e){e.superClass=this.eat(C._extends)?this.parseExprSubscripts(null,!1):null},z.enterClassBody=function(){var e={declared:Object.create(null),used:[]};return this.privateNameStack.push(e),e.declared},z.exitClassBody=function(){var e=this.privateNameStack.pop(),t=e.declared,n=e.used;if(this.options.checkPrivateFields)for(var r=this.privateNameStack.length,i=r===0?null:this.privateNameStack[r-1],a=0;a<n.length;++a){var o=n[a];D(t,o.name)||(i?i.used.push(o):this.raiseRecoverable(o.start,`Private field '#`+o.name+`' must be declared in an enclosing class`))}};function Re(e,t){var n=t.key.name,r=e[n],i=`true`;return t.type===`MethodDefinition`&&(t.kind===`get`||t.kind===`set`)&&(i=(t.static?`s`:`i`)+t.kind),r===`iget`&&i===`iset`||r===`iset`&&i===`iget`||r===`sget`&&i===`sset`||r===`sset`&&i===`sget`?(e[n]=`true`,!1):r?!0:(e[n]=i,!1)}function ze(e,t){var n=e.computed,r=e.key;return!n&&(r.type===`Identifier`&&r.name===t||r.type===`Literal`&&r.value===t)}z.parseExportAllDeclaration=function(e,t){return this.options.ecmaVersion>=11&&(this.eatContextual(`as`)?(e.exported=this.parseModuleExportName(),this.checkExport(t,e.exported,this.lastTokStart)):e.exported=null),this.expectContextual(`from`),this.type!==C.string&&this.unexpected(),e.source=this.parseExprAtom(),this.options.ecmaVersion>=16&&(e.attributes=this.parseWithClause()),this.semicolon(),this.finishNode(e,`ExportAllDeclaration`)},z.parseExport=function(e,t){if(this.next(),this.eat(C.star))return this.parseExportAllDeclaration(e,t);if(this.eat(C._default))return this.checkExport(t,`default`,this.lastTokStart),e.declaration=this.parseExportDefaultDeclaration(),this.finishNode(e,`ExportDefaultDeclaration`);if(this.shouldParseExportStatement())e.declaration=this.parseExportDeclaration(e),e.declaration.type===`VariableDeclaration`?this.checkVariableExport(t,e.declaration.declarations):this.checkExport(t,e.declaration.id,e.declaration.id.start),e.specifiers=[],e.source=null,this.options.ecmaVersion>=16&&(e.attributes=[]);else{if(e.declaration=null,e.specifiers=this.parseExportSpecifiers(t),this.eatContextual(`from`))this.type!==C.string&&this.unexpected(),e.source=this.parseExprAtom(),this.options.ecmaVersion>=16&&(e.attributes=this.parseWithClause());else{for(var n=0,r=e.specifiers;n<r.length;n+=1){var i=r[n];this.checkUnreserved(i.local),this.checkLocalExport(i.local),i.local.type===`Literal`&&this.raise(i.local.start,"A string literal cannot be used as an exported binding without `from`.")}e.source=null,this.options.ecmaVersion>=16&&(e.attributes=[])}this.semicolon()}return this.finishNode(e,`ExportNamedDeclaration`)},z.parseExportDeclaration=function(e){return this.parseStatement(null)},z.parseExportDefaultDeclaration=function(){var e;if(this.type===C._function||(e=this.isAsyncFunction())){var t=this.startNode();return this.next(),e&&this.next(),this.parseFunction(t,B|Le,!1,e)}else if(this.type===C._class){var n=this.startNode();return this.parseClass(n,`nullableID`)}else{var r=this.parseMaybeAssign();return this.semicolon(),r}},z.checkExport=function(e,t,n){e&&(typeof t!=`string`&&(t=t.type===`Identifier`?t.name:t.value),D(e,t)&&this.raiseRecoverable(n,`Duplicate export '`+t+`'`),e[t]=!0)},z.checkPatternExport=function(e,t){var n=t.type;if(n===`Identifier`)this.checkExport(e,t,t.start);else if(n===`ObjectPattern`)for(var r=0,i=t.properties;r<i.length;r+=1){var a=i[r];this.checkPatternExport(e,a)}else if(n===`ArrayPattern`)for(var o=0,s=t.elements;o<s.length;o+=1){var c=s[o];c&&this.checkPatternExport(e,c)}else n===`Property`?this.checkPatternExport(e,t.value):n===`AssignmentPattern`?this.checkPatternExport(e,t.left):n===`RestElement`&&this.checkPatternExport(e,t.argument)},z.checkVariableExport=function(e,t){if(e)for(var n=0,r=t;n<r.length;n+=1){var i=r[n];this.checkPatternExport(e,i.id)}},z.shouldParseExportStatement=function(){return this.type.keyword===`var`||this.type.keyword===`const`||this.type.keyword===`class`||this.type.keyword===`function`||this.isLet()||this.isAsyncFunction()},z.parseExportSpecifier=function(e){var t=this.startNode();return t.local=this.parseModuleExportName(),t.exported=this.eatContextual(`as`)?this.parseModuleExportName():t.local,this.checkExport(e,t.exported,t.exported.start),this.finishNode(t,`ExportSpecifier`)},z.parseExportSpecifiers=function(e){var t=[],n=!0;for(this.expect(C.braceL);!this.eat(C.braceR);){if(n)n=!1;else if(this.expect(C.comma),this.afterTrailingComma(C.braceR))break;t.push(this.parseExportSpecifier(e))}return t},z.parseImport=function(e){return this.next(),this.type===C.string?(e.specifiers=Fe,e.source=this.parseExprAtom()):(e.specifiers=this.parseImportSpecifiers(),this.expectContextual(`from`),e.source=this.type===C.string?this.parseExprAtom():this.unexpected()),this.options.ecmaVersion>=16&&(e.attributes=this.parseWithClause()),this.semicolon(),this.finishNode(e,`ImportDeclaration`)},z.parseImportSpecifier=function(){var e=this.startNode();return e.imported=this.parseModuleExportName(),this.eatContextual(`as`)?e.local=this.parseIdent():(this.checkUnreserved(e.imported),e.local=e.imported),this.checkLValSimple(e.local,F),this.finishNode(e,`ImportSpecifier`)},z.parseImportDefaultSpecifier=function(){var e=this.startNode();return e.local=this.parseIdent(),this.checkLValSimple(e.local,F),this.finishNode(e,`ImportDefaultSpecifier`)},z.parseImportNamespaceSpecifier=function(){var e=this.startNode();return this.next(),this.expectContextual(`as`),e.local=this.parseIdent(),this.checkLValSimple(e.local,F),this.finishNode(e,`ImportNamespaceSpecifier`)},z.parseImportSpecifiers=function(){var e=[],t=!0;if(this.type===C.name&&(e.push(this.parseImportDefaultSpecifier()),!this.eat(C.comma)))return e;if(this.type===C.star)return e.push(this.parseImportNamespaceSpecifier()),e;for(this.expect(C.braceL);!this.eat(C.braceR);){if(t)t=!1;else if(this.expect(C.comma),this.afterTrailingComma(C.braceR))break;e.push(this.parseImportSpecifier())}return e},z.parseWithClause=function(){var e=[];if(!this.eat(C._with))return e;this.expect(C.braceL);for(var t={},n=!0;!this.eat(C.braceR);){if(n)n=!1;else if(this.expect(C.comma),this.afterTrailingComma(C.braceR))break;var r=this.parseImportAttribute(),i=r.key.type===`Identifier`?r.key.name:r.key.value;D(t,i)&&this.raiseRecoverable(r.key.start,`Duplicate attribute key '`+i+`'`),t[i]=!0,e.push(r)}return e},z.parseImportAttribute=function(){var e=this.startNode();return e.key=this.type===C.string?this.parseExprAtom():this.parseIdent(this.options.allowReserved!==`never`),this.expect(C.colon),this.type!==C.string&&this.unexpected(),e.value=this.parseExprAtom(),this.finishNode(e,`ImportAttribute`)},z.parseModuleExportName=function(){if(this.options.ecmaVersion>=13&&this.type===C.string){var e=this.parseLiteral(this.value);return ue.test(e.value)&&this.raise(e.start,`An export name cannot include a lone surrogate.`),e}return this.parseIdent(!0)},z.adaptDirectivePrologue=function(e){for(var t=0;t<e.length&&this.isDirectiveCandidate(e[t]);++t)e[t].directive=e[t].expression.raw.slice(1,-1)},z.isDirectiveCandidate=function(e){return this.options.ecmaVersion>=5&&e.type===`ExpressionStatement`&&e.expression.type===`Literal`&&typeof e.expression.value==`string`&&(this.input[e.start]===`"`||this.input[e.start]===`'`)};var V=I.prototype;V.toAssignable=function(e,t,n){if(this.options.ecmaVersion>=6&&e)switch(e.type){case`Identifier`:this.inAsync&&e.name===`await`&&this.raise(e.start,`Cannot use 'await' as identifier inside an async function`);break;case`ObjectPattern`:case`ArrayPattern`:case`AssignmentPattern`:case`RestElement`:break;case`ObjectExpression`:e.type=`ObjectPattern`,n&&this.checkPatternErrors(n,!0);for(var r=0,i=e.properties;r<i.length;r+=1){var a=i[r];this.toAssignable(a,t),a.type===`RestElement`&&(a.argument.type===`ArrayPattern`||a.argument.type===`ObjectPattern`)&&this.raise(a.argument.start,`Unexpected token`)}break;case`Property`:e.kind!==`init`&&this.raise(e.key.start,`Object pattern can't contain getter or setter`),this.toAssignable(e.value,t);break;case`ArrayExpression`:e.type=`ArrayPattern`,n&&this.checkPatternErrors(n,!0),this.toAssignableList(e.elements,t);break;case`SpreadElement`:e.type=`RestElement`,this.toAssignable(e.argument,t),e.argument.type===`AssignmentPattern`&&this.raise(e.argument.start,`Rest elements cannot have a default value`);break;case`AssignmentExpression`:e.operator!==`=`&&this.raise(e.left.end,`Only '=' operator can be used for specifying default value.`),e.type=`AssignmentPattern`,delete e.operator,this.toAssignable(e.left,t);break;case`ParenthesizedExpression`:this.toAssignable(e.expression,t,n);break;case`ChainExpression`:this.raiseRecoverable(e.start,`Optional chaining cannot appear in left-hand side`);break;case`MemberExpression`:if(!t)break;default:this.raise(e.start,`Assigning to rvalue`)}else n&&this.checkPatternErrors(n,!0);return e},V.toAssignableList=function(e,t){for(var n=e.length,r=0;r<n;r++){var i=e[r];i&&this.toAssignable(i,t)}if(n){var a=e[n-1];this.options.ecmaVersion===6&&t&&a&&a.type===`RestElement`&&a.argument.type!==`Identifier`&&this.unexpected(a.argument.start)}return e},V.parseSpread=function(e){var t=this.startNode();return this.next(),t.argument=this.parseMaybeAssign(!1,e),this.finishNode(t,`SpreadElement`)},V.parseRestBinding=function(){var e=this.startNode();return this.next(),this.options.ecmaVersion===6&&this.type!==C.name&&this.unexpected(),e.argument=this.parseBindingAtom(),this.finishNode(e,`RestElement`)},V.parseBindingAtom=function(){if(this.options.ecmaVersion>=6)switch(this.type){case C.bracketL:var e=this.startNode();return this.next(),e.elements=this.parseBindingList(C.bracketR,!0,!0),this.finishNode(e,`ArrayPattern`);case C.braceL:return this.parseObj(!0)}return this.parseIdent()},V.parseBindingList=function(e,t,n,r){for(var i=[],a=!0;!this.eat(e);)if(a?a=!1:this.expect(C.comma),t&&this.type===C.comma)i.push(null);else if(n&&this.afterTrailingComma(e))break;else if(this.type===C.ellipsis){var o=this.parseRestBinding();this.parseBindingListItem(o),i.push(o),this.type===C.comma&&this.raiseRecoverable(this.start,`Comma is not permitted after the rest element`),this.expect(e);break}else i.push(this.parseAssignableListItem(r));return i},V.parseAssignableListItem=function(e){var t=this.parseMaybeDefault(this.start,this.startLoc);return this.parseBindingListItem(t),t},V.parseBindingListItem=function(e){return e},V.parseMaybeDefault=function(e,t,n){if(n||=this.parseBindingAtom(),this.options.ecmaVersion<6||!this.eat(C.eq))return n;var r=this.startNodeAt(e,t);return r.left=n,r.right=this.parseMaybeAssign(),this.finishNode(r,`AssignmentPattern`)},V.checkLValSimple=function(e,t,n){t===void 0&&(t=Ee);var r=t!==Ee;switch(e.type){case`Identifier`:this.strict&&this.reservedWordsStrictBind.test(e.name)&&this.raiseRecoverable(e.start,(r?`Binding `:`Assigning to `)+e.name+` in strict mode`),r&&(t===F&&e.name===`let`&&this.raiseRecoverable(e.start,`let is disallowed as a lexically bound name`),n&&(D(n,e.name)&&this.raiseRecoverable(e.start,`Argument name clash`),n[e.name]=!0),t!==Ae&&this.declareName(e.name,t,e.start));break;case`ChainExpression`:this.raiseRecoverable(e.start,`Optional chaining cannot appear in left-hand side`);break;case`MemberExpression`:r&&this.raiseRecoverable(e.start,`Binding member expression`);break;case`ParenthesizedExpression`:return r&&this.raiseRecoverable(e.start,`Binding parenthesized expression`),this.checkLValSimple(e.expression,t,n);default:this.raise(e.start,(r?`Binding`:`Assigning to`)+` rvalue`)}},V.checkLValPattern=function(e,t,n){switch(t===void 0&&(t=Ee),e.type){case`ObjectPattern`:for(var r=0,i=e.properties;r<i.length;r+=1){var a=i[r];this.checkLValInnerPattern(a,t,n)}break;case`ArrayPattern`:for(var o=0,s=e.elements;o<s.length;o+=1){var c=s[o];c&&this.checkLValInnerPattern(c,t,n)}break;default:this.checkLValSimple(e,t,n)}},V.checkLValInnerPattern=function(e,t,n){switch(t===void 0&&(t=Ee),e.type){case`Property`:this.checkLValInnerPattern(e.value,t,n);break;case`AssignmentPattern`:this.checkLValPattern(e.left,t,n);break;case`RestElement`:this.checkLValPattern(e.argument,t,n);break;default:this.checkLValPattern(e,t,n)}};var H=function(e,t,n,r,i){this.token=e,this.isExpr=!!t,this.preserveSpace=!!n,this.override=r,this.generator=!!i},U={b_stat:new H(`{`,!1),b_expr:new H(`{`,!0),b_tmpl:new H("${",!1),p_stat:new H(`(`,!1),p_expr:new H(`(`,!0),q_tmpl:new H("`",!0,!0,function(e){return e.tryReadTemplateToken()}),f_stat:new H(`function`,!1),f_expr:new H(`function`,!0),f_expr_gen:new H(`function`,!0,!1,null,!0),f_gen:new H(`function`,!1,!1,null,!0)},W=I.prototype;W.initialContext=function(){return[U.b_stat]},W.curContext=function(){return this.context[this.context.length-1]},W.braceIsBlock=function(e){var t=this.curContext();return t===U.f_expr||t===U.f_stat?!0:e===C.colon&&(t===U.b_stat||t===U.b_expr)?!t.isExpr:e===C._return||e===C.name&&this.exprAllowed?w.test(this.input.slice(this.lastTokEnd,this.start)):e===C._else||e===C.semi||e===C.eof||e===C.parenR||e===C.arrow?!0:e===C.braceL?t===U.b_stat:e===C._var||e===C._const||e===C.name?!1:!this.exprAllowed},W.inGeneratorContext=function(){for(var e=this.context.length-1;e>=1;e--){var t=this.context[e];if(t.token===`function`)return t.generator}return!1},W.updateContext=function(e){var t,n=this.type;n.keyword&&e===C.dot?this.exprAllowed=!1:(t=n.updateContext)?t.call(this,e):this.exprAllowed=n.beforeExpr},W.overrideContext=function(e){this.curContext()!==e&&(this.context[this.context.length-1]=e)},C.parenR.updateContext=C.braceR.updateContext=function(){if(this.context.length===1){this.exprAllowed=!0;return}var e=this.context.pop();e===U.b_stat&&this.curContext().token===`function`&&(e=this.context.pop()),this.exprAllowed=!e.isExpr},C.braceL.updateContext=function(e){this.context.push(this.braceIsBlock(e)?U.b_stat:U.b_expr),this.exprAllowed=!0},C.dollarBraceL.updateContext=function(){this.context.push(U.b_tmpl),this.exprAllowed=!0},C.parenL.updateContext=function(e){var t=e===C._if||e===C._for||e===C._with||e===C._while;this.context.push(t?U.p_stat:U.p_expr),this.exprAllowed=!0},C.incDec.updateContext=function(){},C._function.updateContext=C._class.updateContext=function(e){e.beforeExpr&&e!==C._else&&!(e===C.semi&&this.curContext()!==U.p_stat)&&!(e===C._return&&w.test(this.input.slice(this.lastTokEnd,this.start)))&&!((e===C.colon||e===C.braceL)&&this.curContext()===U.b_stat)?this.context.push(U.f_expr):this.context.push(U.f_stat),this.exprAllowed=!1},C.colon.updateContext=function(){this.curContext().token===`function`&&this.context.pop(),this.exprAllowed=!0},C.backQuote.updateContext=function(){this.curContext()===U.q_tmpl?this.context.pop():this.context.push(U.q_tmpl),this.exprAllowed=!1},C.star.updateContext=function(e){if(e===C._function){var t=this.context.length-1;this.context[t]===U.f_expr?this.context[t]=U.f_expr_gen:this.context[t]=U.f_gen}this.exprAllowed=!0},C.name.updateContext=function(e){var t=!1;this.options.ecmaVersion>=6&&e!==C.dot&&(this.value===`of`&&!this.exprAllowed||this.value===`yield`&&this.inGeneratorContext())&&(t=!0),this.exprAllowed=t};var G=I.prototype;G.checkPropClash=function(e,t,n){if(!(this.options.ecmaVersion>=9&&e.type===`SpreadElement`)&&!(this.options.ecmaVersion>=6&&(e.computed||e.method||e.shorthand))){var r=e.key,i;switch(r.type){case`Identifier`:i=r.name;break;case`Literal`:i=String(r.value);break;default:return}var a=e.kind;if(this.options.ecmaVersion>=6){i===`__proto__`&&a===`init`&&(t.proto&&(n?n.doubleProto<0&&(n.doubleProto=r.start):this.raiseRecoverable(r.start,`Redefinition of __proto__ property`)),t.proto=!0);return}i=`$`+i;var o=t[i];o?(a===`init`?this.strict&&o.init||o.get||o.set:o.init||o[a])&&this.raiseRecoverable(r.start,`Redefinition of property`):o=t[i]={init:!1,get:!1,set:!1},o[a]=!0}},G.parseExpression=function(e,t){var n=this;return this.catchStackOverflow(function(){var r=n.start,i=n.startLoc,a=n.parseMaybeAssign(e,t);if(n.type===C.comma){var o=n.startNodeAt(r,i);for(o.expressions=[a];n.eat(C.comma);)o.expressions.push(n.parseMaybeAssign(e,t));return n.finishNode(o,`SequenceExpression`)}return a})},G.parseMaybeAssign=function(e,t,n){if(this.isContextual(`yield`)){if(this.inGenerator)return this.parseYield(e);this.exprAllowed=!1}var r=!1,i=-1,a=-1,o=-1;t?(i=t.parenthesizedAssign,a=t.trailingComma,o=t.doubleProto,t.parenthesizedAssign=t.trailingComma=-1):(t=new Me,r=!0);var s=this.start,c=this.startLoc;(this.type===C.parenL||this.type===C.name)&&(this.potentialArrowAt=this.start,this.potentialArrowInForAwait=e===`await`);var l=this.parseMaybeConditional(e,t);if(n&&(l=n.call(this,l,s,c)),this.type.isAssign){var u=this.startNodeAt(s,c);return u.operator=this.value,this.type===C.eq&&(l=this.toAssignable(l,!1,t)),r||(t.parenthesizedAssign=t.trailingComma=t.doubleProto=-1),t.shorthandAssign>=l.start&&(t.shorthandAssign=-1),this.type===C.eq?this.checkLValPattern(l):this.checkLValSimple(l),u.left=l,this.next(),u.right=this.parseMaybeAssign(e),o>-1&&(t.doubleProto=o),this.finishNode(u,`AssignmentExpression`)}else r&&this.checkExpressionErrors(t,!0);return i>-1&&(t.parenthesizedAssign=i),a>-1&&(t.trailingComma=a),l},G.parseMaybeConditional=function(e,t){var n=this.start,r=this.startLoc,i=this.parseExprOps(e,t);if(this.checkExpressionErrors(t))return i;if(!(i.type===`ArrowFunctionExpression`&&i.start===n)&&this.eat(C.question)){var a=this.startNodeAt(n,r);return a.test=i,a.consequent=this.parseMaybeAssign(),this.expect(C.colon),a.alternate=this.parseMaybeAssign(e),this.finishNode(a,`ConditionalExpression`)}return i},G.parseExprOps=function(e,t){var n=this.start,r=this.startLoc,i=this.parseMaybeUnary(t,!1,!1,e);return this.checkExpressionErrors(t)||i.start===n&&i.type===`ArrowFunctionExpression`?i:this.parseExprOp(i,n,r,-1,e)},G.parseExprOp=function(e,t,n,r,i){var a=this.type.binop;if(a!=null&&(!i||this.type!==C._in)&&a>r){var o=this.type===C.logicalOR||this.type===C.logicalAND,s=this.type===C.coalesce;s&&(a=C.logicalAND.binop);var c=this.value;this.next();var l=this.start,u=this.startLoc,d=this.parseExprOp(this.parseMaybeUnary(null,!1,!1,i),l,u,a,i),f=this.buildBinary(t,n,e,d,c,o||s);return(o&&this.type===C.coalesce||s&&(this.type===C.logicalOR||this.type===C.logicalAND))&&this.raiseRecoverable(this.start,`Logical expressions and coalesce expressions cannot be mixed. Wrap either by parentheses`),this.parseExprOp(f,t,n,r,i)}return e},G.buildBinary=function(e,t,n,r,i,a){r.type===`PrivateIdentifier`&&this.raise(r.start,`Private identifier can only be left side of binary expression`);var o=this.startNodeAt(e,t);return o.left=n,o.operator=i,o.right=r,this.finishNode(o,a?`LogicalExpression`:`BinaryExpression`)},G.parseMaybeUnary=function(e,t,n,r){var i=this.start,a=this.startLoc,o;if(this.isContextual(`await`)&&this.canAwait)o=this.parseAwait(r),t=!0;else if(this.type.prefix){var s=this.startNode(),c=this.type===C.incDec;s.operator=this.value,s.prefix=!0,this.next(),s.argument=this.parseMaybeUnary(null,!0,c,r),this.checkExpressionErrors(e,!0),c?this.checkLValSimple(s.argument):this.strict&&s.operator===`delete`&&Be(s.argument)?this.raiseRecoverable(s.start,`Deleting local variable in strict mode`):s.operator===`delete`&&Ve(s.argument)?this.raiseRecoverable(s.start,`Private fields can not be deleted`):t=!0,o=this.finishNode(s,c?`UpdateExpression`:`UnaryExpression`)}else if(!t&&this.type===C.privateId)(r||this.privateNameStack.length===0)&&this.options.checkPrivateFields&&this.unexpected(),o=this.parsePrivateIdent(),this.type!==C._in&&this.unexpected();else{if(o=this.parseExprSubscripts(e,r),this.checkExpressionErrors(e))return o;for(;this.type.postfix&&!this.canInsertSemicolon();){var l=this.startNodeAt(i,a);l.operator=this.value,l.prefix=!1,l.argument=o,this.checkLValSimple(o),this.next(),o=this.finishNode(l,`UpdateExpression`)}}if(!n&&this.eat(C.starstar))if(t)this.unexpected(this.lastTokStart);else return this.buildBinary(i,a,o,this.parseMaybeUnary(null,!1,!1,r),`**`,!1);else return o};function Be(e){return e.type===`Identifier`||e.type===`ParenthesizedExpression`&&Be(e.expression)}function Ve(e){return e.type===`MemberExpression`&&e.property.type===`PrivateIdentifier`||e.type===`ChainExpression`&&Ve(e.expression)||e.type===`ParenthesizedExpression`&&Ve(e.expression)}G.parseExprSubscripts=function(e,t){var n=this.start,r=this.startLoc,i=this.parseExprAtom(e,t);if(i.type===`ArrowFunctionExpression`&&this.input.slice(this.lastTokStart,this.lastTokEnd)!==`)`)return i;var a=this.parseSubscripts(i,n,r,!1,t);return e&&a.type===`MemberExpression`&&(e.parenthesizedAssign>=a.start&&(e.parenthesizedAssign=-1),e.parenthesizedBind>=a.start&&(e.parenthesizedBind=-1),e.trailingComma>=a.start&&(e.trailingComma=-1)),a},G.parseSubscripts=function(e,t,n,r,i){for(var a=this.options.ecmaVersion>=8&&e.type===`Identifier`&&e.name===`async`&&this.lastTokEnd===e.end&&!this.canInsertSemicolon()&&e.end-e.start===5&&this.potentialArrowAt===e.start,o=!1;;){var s=this.parseSubscript(e,t,n,r,a,o,i);if(s.optional&&(o=!0),s===e||s.type===`ArrowFunctionExpression`){if(o){var c=this.startNodeAt(t,n);c.expression=s,s=this.finishNode(c,`ChainExpression`)}return s}e=s}},G.shouldParseAsyncArrow=function(){return!this.canInsertSemicolon()&&this.eat(C.arrow)},G.parseSubscriptAsyncArrow=function(e,t,n,r){return this.parseArrowExpression(this.startNodeAt(e,t),n,!0,r)},G.parseSubscript=function(e,t,n,r,i,a,o){var s=this.options.ecmaVersion>=11,c=s&&this.eat(C.questionDot);r&&c&&this.raise(this.lastTokStart,`Optional chaining cannot appear in the callee of new expressions`);var l=this.eat(C.bracketL);if(l||c&&this.type!==C.parenL&&this.type!==C.backQuote||this.eat(C.dot)){var u=this.startNodeAt(t,n);u.object=e,l?(u.property=this.parseExpression(),this.expect(C.bracketR)):this.type===C.privateId&&e.type!==`Super`?u.property=this.parsePrivateIdent():u.property=this.parseIdent(this.options.allowReserved!==`never`),u.computed=!!l,s&&(u.optional=c),e=this.finishNode(u,`MemberExpression`)}else if(!r&&this.eat(C.parenL)){var d=new Me,f=this.yieldPos,p=this.awaitPos,m=this.awaitIdentPos;this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0;var ee=this.parseExprList(C.parenR,this.options.ecmaVersion>=8,!1,d);if(i&&!c&&this.shouldParseAsyncArrow())return this.checkPatternErrors(d,!1),this.checkYieldAwaitInDefaultParams(),this.awaitIdentPos>0&&this.raise(this.awaitIdentPos,`Cannot use 'await' as identifier inside an async function`),this.yieldPos=f,this.awaitPos=p,this.awaitIdentPos=m,this.parseSubscriptAsyncArrow(t,n,ee,o);this.checkExpressionErrors(d,!0),this.yieldPos=f||this.yieldPos,this.awaitPos=p||this.awaitPos,this.awaitIdentPos=m||this.awaitIdentPos;var h=this.startNodeAt(t,n);h.callee=e,h.arguments=ee,s&&(h.optional=c),e=this.finishNode(h,`CallExpression`)}else if(this.type===C.backQuote){(c||a)&&this.raise(this.start,`Optional chaining cannot appear in the tag of tagged template expressions`);var g=this.startNodeAt(t,n);g.tag=e,g.quasi=this.parseTemplate({isTagged:!0}),e=this.finishNode(g,`TaggedTemplateExpression`)}return e},G.parseExprAtom=function(e,t,n){this.type===C.slash&&this.readRegexp();var r,i=this.potentialArrowAt===this.start;switch(this.type){case C._super:return this.allowSuper||this.raise(this.start,`'super' keyword outside a method`),r=this.startNode(),this.next(),this.type===C.parenL&&!this.allowDirectSuper&&this.raise(r.start,`super() call outside constructor of a subclass`),this.type!==C.dot&&this.type!==C.bracketL&&this.type!==C.parenL&&this.unexpected(),this.finishNode(r,`Super`);case C._this:return r=this.startNode(),this.next(),this.finishNode(r,`ThisExpression`);case C.name:var a=this.start,o=this.startLoc,s=this.containsEsc,c=this.parseIdent(!1);if(this.options.ecmaVersion>=8&&!s&&c.name===`async`&&!this.canInsertSemicolon()&&this.eat(C._function))return this.overrideContext(U.f_expr),this.parseFunction(this.startNodeAt(a,o),0,!1,!0,t);if(i&&!this.canInsertSemicolon()){if(this.eat(C.arrow))return this.parseArrowExpression(this.startNodeAt(a,o),[c],!1,t);if(this.options.ecmaVersion>=8&&c.name===`async`&&this.type===C.name&&!s&&(!this.potentialArrowInForAwait||this.value!==`of`||this.containsEsc))return c=this.parseIdent(!1),(this.canInsertSemicolon()||!this.eat(C.arrow))&&this.unexpected(),this.parseArrowExpression(this.startNodeAt(a,o),[c],!0,t)}return c;case C.regexp:var l=this.value;return r=this.parseLiteral(l.value),r.regex={pattern:l.pattern,flags:l.flags},r;case C.num:case C.string:return this.parseLiteral(this.value);case C._null:case C._true:case C._false:return r=this.startNode(),r.value=this.type===C._null?null:this.type===C._true,r.raw=this.type.keyword,this.next(),this.finishNode(r,`Literal`);case C.parenL:var u=this.start,d=this.parseParenAndDistinguishExpression(i,t);return e&&(e.parenthesizedAssign<0&&!this.isSimpleAssignTarget(d)&&(e.parenthesizedAssign=u),e.parenthesizedBind<0&&(e.parenthesizedBind=u)),d;case C.bracketL:return r=this.startNode(),this.next(),r.elements=this.parseExprList(C.bracketR,!0,!0,e),this.finishNode(r,`ArrayExpression`);case C.braceL:return this.overrideContext(U.b_expr),this.parseObj(!1,e);case C._function:return r=this.startNode(),this.next(),this.parseFunction(r,0);case C._class:return this.parseClass(this.startNode(),!1);case C._new:return this.parseNew();case C.backQuote:return this.parseTemplate();case C._import:return this.options.ecmaVersion>=11?this.parseExprImport(n):this.unexpected();default:return this.parseExprAtomDefault()}},G.parseExprAtomDefault=function(){this.unexpected()},G.parseExprImport=function(e){var t=this.startNode();if(this.containsEsc&&this.raiseRecoverable(this.start,`Escape sequence in keyword import`),this.next(),this.type===C.parenL&&!e)return this.parseDynamicImport(t);if(this.type===C.dot){var n=this.startNodeAt(t.start,t.loc&&t.loc.start);return n.name=`import`,t.meta=this.finishNode(n,`Identifier`),this.parseImportMeta(t)}else this.unexpected()},G.parseDynamicImport=function(e){if(this.next(),e.source=this.parseMaybeAssign(),this.options.ecmaVersion>=16)this.eat(C.parenR)?e.options=null:(this.expect(C.comma),this.afterTrailingComma(C.parenR)?e.options=null:(e.options=this.parseMaybeAssign(),this.eat(C.parenR)||(this.expect(C.comma),this.afterTrailingComma(C.parenR)||this.unexpected())));else if(!this.eat(C.parenR)){var t=this.start;this.eat(C.comma)&&this.eat(C.parenR)?this.raiseRecoverable(t,`Trailing comma is not allowed in import()`):this.unexpected(t)}return this.finishNode(e,`ImportExpression`)},G.parseImportMeta=function(e){this.next();var t=this.containsEsc;return e.property=this.parseIdent(!0),e.property.name!==`meta`&&this.raiseRecoverable(e.property.start,`The only valid meta property for import is 'import.meta'`),t&&this.raiseRecoverable(e.start,`'import.meta' must not contain escaped characters`),this.options.sourceType!==`module`&&!this.options.allowImportExportEverywhere&&this.raiseRecoverable(e.start,`Cannot use 'import.meta' outside a module`),this.finishNode(e,`MetaProperty`)},G.parseLiteral=function(e){var t=this.startNode();return t.value=e,t.raw=this.input.slice(this.start,this.end),t.raw.charCodeAt(t.raw.length-1)===110&&(t.bigint=t.value==null?t.raw.slice(0,-1).replace(/_/g,``):t.value.toString()),this.next(),this.finishNode(t,`Literal`)},G.parseParenExpression=function(){this.expect(C.parenL);var e=this.parseExpression();return this.expect(C.parenR),e},G.shouldParseArrow=function(e){return!this.canInsertSemicolon()},G.parseParenAndDistinguishExpression=function(e,t){var n=this.start,r=this.startLoc,i,a=this.options.ecmaVersion>=8;if(this.options.ecmaVersion>=6){this.next();var o=this.start,s=this.startLoc,c=[],l=!0,u=!1,d=new Me,f=this.yieldPos,p=this.awaitPos,m;for(this.yieldPos=0,this.awaitPos=0;this.type!==C.parenR;)if(l?l=!1:this.expect(C.comma),a&&this.afterTrailingComma(C.parenR,!0)){u=!0;break}else if(this.type===C.ellipsis){m=this.start,c.push(this.parseParenItem(this.parseRestBinding())),this.type===C.comma&&this.raiseRecoverable(this.start,`Comma is not permitted after the rest element`);break}else c.push(this.parseMaybeAssign(!1,d,this.parseParenItem));var ee=this.lastTokEnd,h=this.lastTokEndLoc;if(this.expect(C.parenR),e&&this.shouldParseArrow(c)&&this.eat(C.arrow))return this.checkPatternErrors(d,!1),this.checkYieldAwaitInDefaultParams(),this.yieldPos=f,this.awaitPos=p,this.parseParenArrowList(n,r,c,t);(!c.length||u)&&this.unexpected(this.lastTokStart),m&&this.unexpected(m),this.checkExpressionErrors(d,!0),this.yieldPos=f||this.yieldPos,this.awaitPos=p||this.awaitPos,c.length>1?(i=this.startNodeAt(o,s),i.expressions=c,this.finishNodeAt(i,`SequenceExpression`,ee,h)):i=c[0]}else i=this.parseParenExpression();if(this.options.preserveParens){var g=this.startNodeAt(n,r);return g.expression=i,this.finishNode(g,`ParenthesizedExpression`)}else return i},G.parseParenItem=function(e){return e},G.parseParenArrowList=function(e,t,n,r){return this.parseArrowExpression(this.startNodeAt(e,t),n,!1,r)};var He=[];G.parseNew=function(){this.containsEsc&&this.raiseRecoverable(this.start,`Escape sequence in keyword new`);var e=this.startNode();if(this.next(),this.options.ecmaVersion>=6&&this.type===C.dot){var t=this.startNodeAt(e.start,e.loc&&e.loc.start);t.name=`new`,e.meta=this.finishNode(t,`Identifier`),this.next();var n=this.containsEsc;return e.property=this.parseIdent(!0),e.property.name!==`target`&&this.raiseRecoverable(e.property.start,`The only valid meta property for new is 'new.target'`),n&&this.raiseRecoverable(e.start,`'new.target' must not contain escaped characters`),this.allowNewDotTarget||this.raiseRecoverable(e.start,`'new.target' can only be used in functions and class static block`),this.finishNode(e,`MetaProperty`)}var r=this.start,i=this.startLoc;return e.callee=this.parseSubscripts(this.parseExprAtom(null,!1,!0),r,i,!0,!1),e.callee.type===`Super`&&this.raiseRecoverable(r,`Invalid use of 'super'`),this.eat(C.parenL)?e.arguments=this.parseExprList(C.parenR,this.options.ecmaVersion>=8,!1):e.arguments=He,this.finishNode(e,`NewExpression`)},G.parseTemplateElement=function(e){var t=e.isTagged,n=this.startNode();return this.type===C.invalidTemplate?(t||this.raiseRecoverable(this.start,`Bad escape sequence in untagged template literal`),n.value={raw:this.value.replace(/\r\n?/g,`
4
+ `),cooked:null}):n.value={raw:this.input.slice(this.start,this.end).replace(/\r\n?/g,`
5
+ `),cooked:this.value},this.next(),n.tail=this.type===C.backQuote,this.finishNode(n,`TemplateElement`)},G.parseTemplate=function(e){e===void 0&&(e={});var t=e.isTagged;t===void 0&&(t=!1);var n=this.startNode();this.next(),n.expressions=[];var r=this.parseTemplateElement({isTagged:t});for(n.quasis=[r];!r.tail;)this.type===C.eof&&this.raise(this.pos,`Unterminated template literal`),this.expect(C.dollarBraceL),n.expressions.push(this.parseExpression()),this.expect(C.braceR),n.quasis.push(r=this.parseTemplateElement({isTagged:t}));return this.next(),this.finishNode(n,`TemplateLiteral`)},G.isAsyncProp=function(e){return!e.computed&&e.key.type===`Identifier`&&e.key.name===`async`&&(this.type===C.name||this.type===C.num||this.type===C.string||this.type===C.bracketL||this.type.keyword||this.options.ecmaVersion>=9&&this.type===C.star)&&!w.test(this.input.slice(this.lastTokEnd,this.start))},G.parseObj=function(e,t){var n=this.startNode(),r=!0,i={};for(n.properties=[],this.next();!this.eat(C.braceR);){if(r)r=!1;else if(this.expect(C.comma),this.options.ecmaVersion>=5&&this.afterTrailingComma(C.braceR))break;var a=this.parseProperty(e,t);e||this.checkPropClash(a,i,t),n.properties.push(a)}return this.finishNode(n,e?`ObjectPattern`:`ObjectExpression`)},G.parseProperty=function(e,t){var n=this.startNode(),r,i,a,o;if(this.options.ecmaVersion>=9&&this.eat(C.ellipsis))return e?(n.argument=this.parseIdent(!1),this.type===C.comma&&this.raiseRecoverable(this.start,`Comma is not permitted after the rest element`),this.finishNode(n,`RestElement`)):(n.argument=this.parseMaybeAssign(!1,t),this.type===C.comma&&t&&t.trailingComma<0&&(t.trailingComma=this.start),this.finishNode(n,`SpreadElement`));this.options.ecmaVersion>=6&&(n.method=!1,n.shorthand=!1,(e||t)&&(a=this.start,o=this.startLoc),e||(r=this.eat(C.star)));var s=this.containsEsc;return this.parsePropertyName(n),!e&&!s&&this.options.ecmaVersion>=8&&!r&&this.isAsyncProp(n)?(i=!0,r=this.options.ecmaVersion>=9&&this.eat(C.star),this.parsePropertyName(n)):i=!1,this.parsePropertyValue(n,e,r,i,a,o,t,s),this.finishNode(n,`Property`)},G.parseGetterSetter=function(e){var t=e.key.name;this.parsePropertyName(e),e.value=this.parseMethod(!1),e.kind=t;var n=e.kind===`get`?0:1;if(e.value.params.length!==n){var r=e.value.start;e.kind===`get`?this.raiseRecoverable(r,`getter should have no params`):this.raiseRecoverable(r,`setter should have exactly one param`)}else e.kind===`set`&&e.value.params[0].type===`RestElement`&&this.raiseRecoverable(e.value.params[0].start,`Setter cannot use rest params`)},G.parsePropertyValue=function(e,t,n,r,i,a,o,s){(n||r)&&this.type===C.colon&&this.unexpected(),this.eat(C.colon)?(e.value=t?this.parseMaybeDefault(this.start,this.startLoc):this.parseMaybeAssign(!1,o),e.kind=`init`):this.options.ecmaVersion>=6&&this.type===C.parenL?(t&&this.unexpected(),e.method=!0,e.value=this.parseMethod(n,r),e.kind=`init`):!t&&!s&&this.options.ecmaVersion>=5&&!e.computed&&e.key.type===`Identifier`&&(e.key.name===`get`||e.key.name===`set`)&&this.type!==C.comma&&this.type!==C.braceR&&this.type!==C.eq?((n||r)&&this.unexpected(),this.parseGetterSetter(e)):this.options.ecmaVersion>=6&&!e.computed&&e.key.type===`Identifier`?((n||r)&&this.unexpected(),this.checkUnreserved(e.key),e.key.name===`await`&&!this.awaitIdentPos&&(this.awaitIdentPos=i),t?e.value=this.parseMaybeDefault(i,a,this.copyNode(e.key)):this.type===C.eq&&o?(o.shorthandAssign<0&&(o.shorthandAssign=this.start),e.value=this.parseMaybeDefault(i,a,this.copyNode(e.key))):e.value=this.copyNode(e.key),e.kind=`init`,e.shorthand=!0):this.unexpected()},G.parsePropertyName=function(e){if(this.options.ecmaVersion>=6){if(this.eat(C.bracketL))return e.computed=!0,e.key=this.parseMaybeAssign(),this.expect(C.bracketR),e.key;e.computed=!1}return e.key=this.type===C.num||this.type===C.string?this.parseExprAtom():this.parseIdent(this.options.allowReserved!==`never`)},G.initFunction=function(e){e.id=null,this.options.ecmaVersion>=6&&(e.generator=e.expression=!1),this.options.ecmaVersion>=8&&(e.async=!1)},G.parseMethod=function(e,t,n){var r=this.startNode(),i=this.yieldPos,a=this.awaitPos,o=this.awaitIdentPos;return this.initFunction(r),this.options.ecmaVersion>=6&&(r.generator=e),this.options.ecmaVersion>=8&&(r.async=!!t),this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(Te(t,r.generator)|xe|(n?Se:0)),this.expect(C.parenL),r.params=this.parseBindingList(C.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams(),this.parseFunctionBody(r,!1,!0,!1),this.yieldPos=i,this.awaitPos=a,this.awaitIdentPos=o,this.finishNode(r,`FunctionExpression`)},G.parseArrowExpression=function(e,t,n,r){var i=this.yieldPos,a=this.awaitPos,o=this.awaitIdentPos;return this.enterScope(Te(n,!1)|ye),this.initFunction(e),this.options.ecmaVersion>=8&&(e.async=!!n),this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,e.params=this.toAssignableList(t,!0),this.parseFunctionBody(e,!0,!1,r),this.yieldPos=i,this.awaitPos=a,this.awaitIdentPos=o,this.finishNode(e,`ArrowFunctionExpression`)},G.parseFunctionBody=function(e,t,n,r){var i=t&&this.type!==C.braceL,a=this.strict,o=!1;if(i)e.body=this.parseMaybeAssign(r),e.expression=!0,this.checkParams(e,!1);else{var s=this.options.ecmaVersion>=7&&!this.isSimpleParamList(e.params);(!a||s)&&(o=this.strictDirective(this.end),o&&s&&this.raiseRecoverable(e.start,`Illegal 'use strict' directive in function with non-simple parameter list`));var c=this.labels;this.labels=[],o&&(this.strict=!0),this.checkParams(e,!a&&!o&&!t&&!n&&this.isSimpleParamList(e.params)),this.strict&&e.id&&this.checkLValSimple(e.id,Ae),e.body=this.parseBlock(!1,void 0,o&&!a),e.expression=!1,this.adaptDirectivePrologue(e.body.body),this.labels=c}this.exitScope()},G.isSimpleParamList=function(e){for(var t=0,n=e;t<n.length;t+=1)if(n[t].type!==`Identifier`)return!1;return!0},G.checkParams=function(e,t){for(var n=Object.create(null),r=0,i=e.params;r<i.length;r+=1){var a=i[r];this.checkLValInnerPattern(a,De,t?null:n)}},G.parseExprList=function(e,t,n,r){for(var i=[],a=!0;!this.eat(e);){if(a)a=!1;else if(this.expect(C.comma),t&&this.afterTrailingComma(e))break;var o=void 0;n&&this.type===C.comma?o=null:this.type===C.ellipsis?(o=this.parseSpread(r),r&&this.type===C.comma&&r.trailingComma<0&&(r.trailingComma=this.start)):o=this.parseMaybeAssign(!1,r),i.push(o)}return i},G.checkUnreserved=function(e){var t=e.start,n=e.end,r=e.name;this.inGenerator&&r===`yield`&&this.raiseRecoverable(t,`Cannot use 'yield' as identifier inside a generator`),this.inAsync&&r===`await`&&this.raiseRecoverable(t,`Cannot use 'await' as identifier inside an async function`),!(this.currentThisScope().flags&we)&&r===`arguments`&&this.raiseRecoverable(t,`Cannot use 'arguments' in class field initializer`),this.inClassStaticBlock&&(r===`arguments`||r===`await`)&&this.raise(t,`Cannot use `+r+` in class static initialization block`),this.keywords.test(r)&&this.raise(t,`Unexpected keyword '`+r+`'`),!(this.options.ecmaVersion<6&&this.input.slice(t,n).indexOf(`\\`)!==-1)&&(this.strict?this.reservedWordsStrict:this.reservedWords).test(r)&&(!this.inAsync&&r===`await`&&this.raiseRecoverable(t,`Cannot use keyword 'await' outside an async function`),this.raiseRecoverable(t,`The keyword '`+r+`' is reserved`))},G.parseIdent=function(e){var t=this.parseIdentNode();return this.next(!!e),this.finishNode(t,`Identifier`),e||(this.checkUnreserved(t),t.name===`await`&&!this.awaitIdentPos&&(this.awaitIdentPos=t.start)),t},G.parseIdentNode=function(){var e=this.startNode();return this.type===C.name?e.name=this.value:this.type.keyword?(e.name=this.type.keyword,(e.name===`class`||e.name===`function`)&&(this.lastTokEnd!==this.lastTokStart+1||this.input.charCodeAt(this.lastTokStart)!==46)&&this.context.pop(),this.type=C.name):this.unexpected(),e},G.parsePrivateIdent=function(){var e=this.startNode();return this.type===C.privateId?e.name=this.value:this.unexpected(),this.next(),this.finishNode(e,`PrivateIdentifier`),this.options.checkPrivateFields&&(this.privateNameStack.length===0?this.raise(e.start,`Private field '#`+e.name+`' must be declared in an enclosing class`):this.privateNameStack[this.privateNameStack.length-1].used.push(e)),e},G.parseYield=function(e){this.yieldPos||=this.start;var t=this.startNode();return this.next(),this.type===C.semi||this.canInsertSemicolon()||this.type!==C.star&&!this.type.startsExpr?(t.delegate=!1,t.argument=null):(t.delegate=this.eat(C.star),t.argument=this.parseMaybeAssign(e)),this.finishNode(t,`YieldExpression`)},G.parseAwait=function(e){this.awaitPos||=this.start;var t=this.startNode();return this.next(),t.argument=this.parseMaybeUnary(null,!0,!1,e),this.finishNode(t,`AwaitExpression`)};var Ue=I.prototype;Ue.raise=function(e,t){var n=fe(this.input,e);t+=` (`+n.line+`:`+n.column+`)`,this.sourceFile&&(t+=` in `+this.sourceFile);var r=SyntaxError(t);throw r.pos=e,r.loc=n,r.raisedAt=this.pos,r},Ue.raiseRecoverable=Ue.raise,Ue.curPosition=function(){if(this.options.locations)return new A(this.curLine,this.pos-this.lineStart)};var K=I.prototype,We=function(e){this.flags=e,this.var=[],this.lexical=[],this.functions=[]};K.enterScope=function(e){this.scopeStack.push(new We(e))},K.exitScope=function(){this.scopeStack.pop()},K.treatFunctionsAsVarInScope=function(e){return e.flags&M||!this.inModule&&e.flags&j},K.declareName=function(e,t,n){var r=!1;if(t===F){var i=this.currentScope();r=i.lexical.indexOf(e)>-1||i.functions.indexOf(e)>-1||i.var.indexOf(e)>-1,i.lexical.push(e),this.inModule&&i.flags&j&&delete this.undefinedExports[e]}else if(t===ke)this.currentScope().lexical.push(e);else if(t===Oe){var a=this.currentScope();r=this.treatFunctionsAsVar?a.lexical.indexOf(e)>-1:a.lexical.indexOf(e)>-1||a.var.indexOf(e)>-1,a.functions.push(e)}else for(var o=this.scopeStack.length-1;o>=0;--o){var s=this.scopeStack[o];if(s.lexical.indexOf(e)>-1&&!(s.flags&be&&s.lexical[0]===e)||!this.treatFunctionsAsVarInScope(s)&&s.functions.indexOf(e)>-1){r=!0;break}if(s.var.push(e),this.inModule&&s.flags&j&&delete this.undefinedExports[e],s.flags&we)break}r&&this.raiseRecoverable(n,`Identifier '`+e+`' has already been declared`)},K.checkLocalExport=function(e){this.scopeStack[0].lexical.indexOf(e.name)===-1&&this.scopeStack[0].var.indexOf(e.name)===-1&&(this.undefinedExports[e.name]=e)},K.currentScope=function(){return this.scopeStack[this.scopeStack.length-1]},K.currentVarScope=function(){for(var e=this.scopeStack.length-1;;e--){var t=this.scopeStack[e];if(t.flags&(we|P|N))return t}},K.currentThisScope=function(){for(var e=this.scopeStack.length-1;;e--){var t=this.scopeStack[e];if(t.flags&(we|P|N)&&!(t.flags&ye))return t}};var Ge=function(e,t,n){this.type=``,this.start=t,this.end=0,e.options.locations&&(this.loc=new de(e,n)),e.options.directSourceFile&&(this.sourceFile=e.options.directSourceFile),e.options.ranges&&(this.range=[t,0])},q=I.prototype;q.startNode=function(){return new Ge(this,this.start,this.startLoc)},q.startNodeAt=function(e,t){return new Ge(this,e,t)};function Ke(e,t,n,r){return e.type=t,e.end=n,this.options.locations&&(e.loc.end=r),this.options.ranges&&(e.range[1]=n),e}q.finishNode=function(e,t){return Ke.call(this,e,t,this.lastTokEnd,this.lastTokEndLoc)},q.finishNodeAt=function(e,t,n,r){return Ke.call(this,e,t,n,r)},q.copyNode=function(e){var t=new Ge(this,e.start,this.startLoc);for(var n in e)t[n]=e[n];return t};var qe=`Berf Beria_Erfe Gara Garay Gukh Gurung_Khema Hrkt Katakana_Or_Hiragana Kawi Kirat_Rai Krai Nag_Mundari Nagm Ol_Onal Onao Sidetic Sidt Sunu Sunuwar Tai_Yo Tayo Todhri Todr Tolong_Siki Tols Tulu_Tigalari Tutg Unknown Zzzz`,Je=`ASCII ASCII_Hex_Digit AHex Alphabetic Alpha Any Assigned Bidi_Control Bidi_C Bidi_Mirrored Bidi_M Case_Ignorable CI Cased Changes_When_Casefolded CWCF Changes_When_Casemapped CWCM Changes_When_Lowercased CWL Changes_When_NFKC_Casefolded CWKCF Changes_When_Titlecased CWT Changes_When_Uppercased CWU Dash Default_Ignorable_Code_Point DI Deprecated Dep Diacritic Dia Emoji Emoji_Component Emoji_Modifier Emoji_Modifier_Base Emoji_Presentation Extender Ext Grapheme_Base Gr_Base Grapheme_Extend Gr_Ext Hex_Digit Hex IDS_Binary_Operator IDSB IDS_Trinary_Operator IDST ID_Continue IDC ID_Start IDS Ideographic Ideo Join_Control Join_C Logical_Order_Exception LOE Lowercase Lower Math Noncharacter_Code_Point NChar Pattern_Syntax Pat_Syn Pattern_White_Space Pat_WS Quotation_Mark QMark Radical Regional_Indicator RI Sentence_Terminal STerm Soft_Dotted SD Terminal_Punctuation Term Unified_Ideograph UIdeo Uppercase Upper Variation_Selector VS White_Space space XID_Continue XIDC XID_Start XIDS`,Ye=Je+` Extended_Pictographic`,Xe=Ye,Ze=Xe+` EBase EComp EMod EPres ExtPict`,Qe=Ze,$e={9:Je,10:Ye,11:Xe,12:Ze,13:Qe,14:Qe},et={9:``,10:``,11:``,12:``,13:``,14:`Basic_Emoji Emoji_Keycap_Sequence RGI_Emoji_Modifier_Sequence RGI_Emoji_Flag_Sequence RGI_Emoji_Tag_Sequence RGI_Emoji_ZWJ_Sequence RGI_Emoji`},tt=`Cased_Letter LC Close_Punctuation Pe Connector_Punctuation Pc Control Cc cntrl Currency_Symbol Sc Dash_Punctuation Pd Decimal_Number Nd digit Enclosing_Mark Me Final_Punctuation Pf Format Cf Initial_Punctuation Pi Letter L Letter_Number Nl Line_Separator Zl Lowercase_Letter Ll Mark M Combining_Mark Math_Symbol Sm Modifier_Letter Lm Modifier_Symbol Sk Nonspacing_Mark Mn Number N Open_Punctuation Ps Other C Other_Letter Lo Other_Number No Other_Punctuation Po Other_Symbol So Paragraph_Separator Zp Private_Use Co Punctuation P punct Separator Z Space_Separator Zs Spacing_Mark Mc Surrogate Cs Symbol S Titlecase_Letter Lt Unassigned Cn Uppercase_Letter Lu`,nt=`Adlam Adlm Ahom Anatolian_Hieroglyphs Hluw Arabic Arab Armenian Armn Avestan Avst Balinese Bali Bamum Bamu Bassa_Vah Bass Batak Batk Bengali Beng Bhaiksuki Bhks Bopomofo Bopo Brahmi Brah Braille Brai Buginese Bugi Buhid Buhd Canadian_Aboriginal Cans Carian Cari Caucasian_Albanian Aghb Chakma Cakm Cham Cham Cherokee Cher Common Zyyy Coptic Copt Qaac Cuneiform Xsux Cypriot Cprt Cyrillic Cyrl Deseret Dsrt Devanagari Deva Duployan Dupl Egyptian_Hieroglyphs Egyp Elbasan Elba Ethiopic Ethi Georgian Geor Glagolitic Glag Gothic Goth Grantha Gran Greek Grek Gujarati Gujr Gurmukhi Guru Han Hani Hangul Hang Hanunoo Hano Hatran Hatr Hebrew Hebr Hiragana Hira Imperial_Aramaic Armi Inherited Zinh Qaai Inscriptional_Pahlavi Phli Inscriptional_Parthian Prti Javanese Java Kaithi Kthi Kannada Knda Katakana Kana Kayah_Li Kali Kharoshthi Khar Khmer Khmr Khojki Khoj Khudawadi Sind Lao Laoo Latin Latn Lepcha Lepc Limbu Limb Linear_A Lina Linear_B Linb Lisu Lisu Lycian Lyci Lydian Lydi Mahajani Mahj Malayalam Mlym Mandaic Mand Manichaean Mani Marchen Marc Masaram_Gondi Gonm Meetei_Mayek Mtei Mende_Kikakui Mend Meroitic_Cursive Merc Meroitic_Hieroglyphs Mero Miao Plrd Modi Mongolian Mong Mro Mroo Multani Mult Myanmar Mymr Nabataean Nbat New_Tai_Lue Talu Newa Newa Nko Nkoo Nushu Nshu Ogham Ogam Ol_Chiki Olck Old_Hungarian Hung Old_Italic Ital Old_North_Arabian Narb Old_Permic Perm Old_Persian Xpeo Old_South_Arabian Sarb Old_Turkic Orkh Oriya Orya Osage Osge Osmanya Osma Pahawh_Hmong Hmng Palmyrene Palm Pau_Cin_Hau Pauc Phags_Pa Phag Phoenician Phnx Psalter_Pahlavi Phlp Rejang Rjng Runic Runr Samaritan Samr Saurashtra Saur Sharada Shrd Shavian Shaw Siddham Sidd SignWriting Sgnw Sinhala Sinh Sora_Sompeng Sora Soyombo Soyo Sundanese Sund Syloti_Nagri Sylo Syriac Syrc Tagalog Tglg Tagbanwa Tagb Tai_Le Tale Tai_Tham Lana Tai_Viet Tavt Takri Takr Tamil Taml Tangut Tang Telugu Telu Thaana Thaa Thai Thai Tibetan Tibt Tifinagh Tfng Tirhuta Tirh Ugaritic Ugar Vai Vaii Warang_Citi Wara Yi Yiii Zanabazar_Square Zanb`,rt=nt+` Dogra Dogr Gunjala_Gondi Gong Hanifi_Rohingya Rohg Makasar Maka Medefaidrin Medf Old_Sogdian Sogo Sogdian Sogd`,it=rt+` Elymaic Elym Nandinagari Nand Nyiakeng_Puachue_Hmong Hmnp Wancho Wcho`,at=it+` Chorasmian Chrs Diak Dives_Akuru Khitan_Small_Script Kits Yezi Yezidi`,ot=at+` Cypro_Minoan Cpmn Old_Uyghur Ougr Tangsa Tnsa Toto Vithkuqi Vith`,st={9:nt,10:rt,11:it,12:at,13:ot,14:ot+` `+qe},ct={};function lt(e){var t=ct[e]={binary:O($e[e]+` `+tt),binaryOfStrings:O(et[e]),nonBinary:{General_Category:O(tt),Script:O(st[e])}};t.nonBinary.Script_Extensions=t.nonBinary.Script,t.nonBinary.gc=t.nonBinary.General_Category,t.nonBinary.sc=t.nonBinary.Script,t.nonBinary.scx=t.nonBinary.Script_Extensions}for(var ut=0,dt=[9,10,11,12,13,14];ut<dt.length;ut+=1){var ft=dt[ut];lt(ft)}var J=I.prototype,pt=function(e,t){this.parent=e,this.base=t||this};pt.prototype.separatedFrom=function(e){for(var t=this;t;t=t.parent)for(var n=e;n;n=n.parent)if(t.base===n.base&&t!==n)return!0;return!1},pt.prototype.sibling=function(){return new pt(this.parent,this.base)};var Y=function(e){this.parser=e,this.validFlags=`gim`+(e.options.ecmaVersion>=6?`uy`:``)+(e.options.ecmaVersion>=9?`s`:``)+(e.options.ecmaVersion>=13?`d`:``)+(e.options.ecmaVersion>=15?`v`:``),this.unicodeProperties=ct[e.options.ecmaVersion>=14?14:e.options.ecmaVersion],this.source=``,this.flags=``,this.start=0,this.switchU=!1,this.switchV=!1,this.switchN=!1,this.pos=0,this.lastIntValue=0,this.lastStringValue=``,this.lastAssertionIsQuantifiable=!1,this.numCapturingParens=0,this.maxBackReference=0,this.groupNames=Object.create(null),this.backReferenceNames=[],this.branchID=null};Y.prototype.reset=function(e,t,n){var r=n.indexOf(`v`)!==-1,i=n.indexOf(`u`)!==-1;this.start=e|0,this.source=t+``,this.flags=n,r&&this.parser.options.ecmaVersion>=15?(this.switchU=!0,this.switchV=!0,this.switchN=!0):(this.switchU=i&&this.parser.options.ecmaVersion>=6,this.switchV=!1,this.switchN=i&&this.parser.options.ecmaVersion>=9)},Y.prototype.raise=function(e){this.parser.raiseRecoverable(this.start,`Invalid regular expression: /`+this.source+`/: `+e)},Y.prototype.at=function(e,t){t===void 0&&(t=!1);var n=this.source,r=n.length;if(e>=r)return-1;var i=n.charCodeAt(e);if(!(t||this.switchU)||i<=55295||i>=57344||e+1>=r)return i;var a=n.charCodeAt(e+1);return a>=56320&&a<=57343?(i<<10)+a-56613888:i},Y.prototype.nextIndex=function(e,t){t===void 0&&(t=!1);var n=this.source,r=n.length;if(e>=r)return r;var i=n.charCodeAt(e),a;return!(t||this.switchU)||i<=55295||i>=57344||e+1>=r||(a=n.charCodeAt(e+1))<56320||a>57343?e+1:e+2},Y.prototype.current=function(e){return e===void 0&&(e=!1),this.at(this.pos,e)},Y.prototype.lookahead=function(e){return e===void 0&&(e=!1),this.at(this.nextIndex(this.pos,e),e)},Y.prototype.advance=function(e){e===void 0&&(e=!1),this.pos=this.nextIndex(this.pos,e)},Y.prototype.eat=function(e,t){return t===void 0&&(t=!1),this.current(t)===e?(this.advance(t),!0):!1},Y.prototype.eatChars=function(e,t){t===void 0&&(t=!1);for(var n=this.pos,r=0,i=e;r<i.length;r+=1){var a=i[r],o=this.at(n,t);if(o===-1||o!==a)return!1;n=this.nextIndex(n,t)}return this.pos=n,!0},J.validateRegExpFlags=function(e){for(var t=e.validFlags,n=e.flags,r=!1,i=!1,a=0;a<n.length;a++){var o=n.charAt(a);t.indexOf(o)===-1&&this.raise(e.start,`Invalid regular expression flag`),n.indexOf(o,a+1)>-1&&this.raise(e.start,`Duplicate regular expression flag`),o===`u`&&(r=!0),o===`v`&&(i=!0)}this.options.ecmaVersion>=15&&r&&i&&this.raise(e.start,`Invalid regular expression flag`)};function mt(e){for(var t in e)return!0;return!1}J.validateRegExpPattern=function(e){this.regexp_pattern(e),!e.switchN&&this.options.ecmaVersion>=9&&mt(e.groupNames)&&(e.switchN=!0,this.regexp_pattern(e))},J.regexp_pattern=function(e){e.pos=0,e.lastIntValue=0,e.lastStringValue=``,e.lastAssertionIsQuantifiable=!1,e.numCapturingParens=0,e.maxBackReference=0,e.groupNames=Object.create(null),e.backReferenceNames.length=0,e.branchID=null,this.regexp_disjunction(e),e.pos!==e.source.length&&(e.eat(41)&&e.raise(`Unmatched ')'`),(e.eat(93)||e.eat(125))&&e.raise(`Lone quantifier brackets`)),e.maxBackReference>e.numCapturingParens&&e.raise(`Invalid escape`);for(var t=0,n=e.backReferenceNames;t<n.length;t+=1){var r=n[t];e.groupNames[r]||e.raise(`Invalid named capture referenced`)}},J.regexp_disjunction=function(e){var t=this.options.ecmaVersion>=16;for(t&&(e.branchID=new pt(e.branchID,null)),this.regexp_alternative(e);e.eat(124);)t&&(e.branchID=e.branchID.sibling()),this.regexp_alternative(e);t&&(e.branchID=e.branchID.parent),this.regexp_eatQuantifier(e,!0)&&e.raise(`Nothing to repeat`),e.eat(123)&&e.raise(`Lone quantifier brackets`)},J.regexp_alternative=function(e){for(;e.pos<e.source.length&&this.regexp_eatTerm(e););},J.regexp_eatTerm=function(e){return this.regexp_eatAssertion(e)?(e.lastAssertionIsQuantifiable&&this.regexp_eatQuantifier(e)&&e.switchU&&e.raise(`Invalid quantifier`),!0):(e.switchU?this.regexp_eatAtom(e):this.regexp_eatExtendedAtom(e))?(this.regexp_eatQuantifier(e),!0):!1},J.regexp_eatAssertion=function(e){var t=e.pos;if(e.lastAssertionIsQuantifiable=!1,e.eat(94)||e.eat(36))return!0;if(e.eat(92)){if(e.eat(66)||e.eat(98))return!0;e.pos=t}if(e.eat(40)&&e.eat(63)){var n=!1;if(this.options.ecmaVersion>=9&&(n=e.eat(60)),e.eat(61)||e.eat(33))return this.regexp_disjunction(e),e.eat(41)||e.raise(`Unterminated group`),e.lastAssertionIsQuantifiable=!n,!0}return e.pos=t,!1},J.regexp_eatQuantifier=function(e,t){return t===void 0&&(t=!1),this.regexp_eatQuantifierPrefix(e,t)?(e.eat(63),!0):!1},J.regexp_eatQuantifierPrefix=function(e,t){return e.eat(42)||e.eat(43)||e.eat(63)||this.regexp_eatBracedQuantifier(e,t)},J.regexp_eatBracedQuantifier=function(e,t){var n=e.pos;if(e.eat(123)){var r=0,i=-1;if(this.regexp_eatDecimalDigits(e)&&(r=e.lastIntValue,e.eat(44)&&this.regexp_eatDecimalDigits(e)&&(i=e.lastIntValue),e.eat(125)))return i!==-1&&i<r&&!t&&e.raise(`numbers out of order in {} quantifier`),!0;e.switchU&&!t&&e.raise(`Incomplete quantifier`),e.pos=n}return!1},J.regexp_eatAtom=function(e){return this.regexp_eatPatternCharacters(e)||e.eat(46)||this.regexp_eatReverseSolidusAtomEscape(e)||this.regexp_eatCharacterClass(e)||this.regexp_eatUncapturingGroup(e)||this.regexp_eatCapturingGroup(e)},J.regexp_eatReverseSolidusAtomEscape=function(e){var t=e.pos;if(e.eat(92)){if(this.regexp_eatAtomEscape(e))return!0;e.pos=t}return!1},J.regexp_eatUncapturingGroup=function(e){var t=e.pos;if(e.eat(40)){if(e.eat(63)){if(this.options.ecmaVersion>=16){var n=this.regexp_eatModifiers(e),r=e.eat(45);if(n||r){for(var i=0;i<n.length;i++){var a=n.charAt(i);n.indexOf(a,i+1)>-1&&e.raise(`Duplicate regular expression modifiers`)}if(r){var o=this.regexp_eatModifiers(e);!n&&!o&&e.current()===58&&e.raise(`Invalid regular expression modifiers`);for(var s=0;s<o.length;s++){var c=o.charAt(s);(o.indexOf(c,s+1)>-1||n.indexOf(c)>-1)&&e.raise(`Duplicate regular expression modifiers`)}}}}if(e.eat(58)){if(this.regexp_disjunction(e),e.eat(41))return!0;e.raise(`Unterminated group`)}}e.pos=t}return!1},J.regexp_eatCapturingGroup=function(e){if(e.eat(40)){if(this.options.ecmaVersion>=9?this.regexp_groupSpecifier(e):e.current()===63&&e.raise(`Invalid group`),this.regexp_disjunction(e),e.eat(41))return e.numCapturingParens+=1,!0;e.raise(`Unterminated group`)}return!1},J.regexp_eatModifiers=function(e){for(var t=``,n=0;(n=e.current())!==-1&&ht(n);)t+=k(n),e.advance();return t};function ht(e){return e===105||e===109||e===115}J.regexp_eatExtendedAtom=function(e){return e.eat(46)||this.regexp_eatReverseSolidusAtomEscape(e)||this.regexp_eatCharacterClass(e)||this.regexp_eatUncapturingGroup(e)||this.regexp_eatCapturingGroup(e)||this.regexp_eatInvalidBracedQuantifier(e)||this.regexp_eatExtendedPatternCharacter(e)},J.regexp_eatInvalidBracedQuantifier=function(e){return this.regexp_eatBracedQuantifier(e,!0)&&e.raise(`Nothing to repeat`),!1},J.regexp_eatSyntaxCharacter=function(e){var t=e.current();return gt(t)?(e.lastIntValue=t,e.advance(),!0):!1};function gt(e){return e===36||e>=40&&e<=43||e===46||e===63||e>=91&&e<=94||e>=123&&e<=125}J.regexp_eatPatternCharacters=function(e){for(var t=e.pos,n=0;(n=e.current())!==-1&&!gt(n);)e.advance();return e.pos!==t},J.regexp_eatExtendedPatternCharacter=function(e){var t=e.current();return t!==-1&&t!==36&&!(t>=40&&t<=43)&&t!==46&&t!==63&&t!==91&&t!==94&&t!==124?(e.advance(),!0):!1},J.regexp_groupSpecifier=function(e){if(e.eat(63)){this.regexp_eatGroupName(e)||e.raise(`Invalid group`);var t=this.options.ecmaVersion>=16,n=e.groupNames[e.lastStringValue];if(n)if(t)for(var r=0,i=n;r<i.length;r+=1)i[r].separatedFrom(e.branchID)||e.raise(`Duplicate capture group name`);else e.raise(`Duplicate capture group name`);t?(n||(e.groupNames[e.lastStringValue]=[])).push(e.branchID):e.groupNames[e.lastStringValue]=!0}},J.regexp_eatGroupName=function(e){if(e.lastStringValue=``,e.eat(60)){if(this.regexp_eatRegExpIdentifierName(e)&&e.eat(62))return!0;e.raise(`Invalid capture group name`)}return!1},J.regexp_eatRegExpIdentifierName=function(e){if(e.lastStringValue=``,this.regexp_eatRegExpIdentifierStart(e)){for(e.lastStringValue+=k(e.lastIntValue);this.regexp_eatRegExpIdentifierPart(e);)e.lastStringValue+=k(e.lastIntValue);return!0}return!1},J.regexp_eatRegExpIdentifierStart=function(e){var t=e.pos,n=this.options.ecmaVersion>=11,r=e.current(n);return e.advance(n),r===92&&this.regexp_eatRegExpUnicodeEscapeSequence(e,n)&&(r=e.lastIntValue),_t(r)?(e.lastIntValue=r,!0):(e.pos=t,!1)};function _t(e){return g(e,!0)||e===36||e===95}J.regexp_eatRegExpIdentifierPart=function(e){var t=e.pos,n=this.options.ecmaVersion>=11,r=e.current(n);return e.advance(n),r===92&&this.regexp_eatRegExpUnicodeEscapeSequence(e,n)&&(r=e.lastIntValue),vt(r)?(e.lastIntValue=r,!0):(e.pos=t,!1)};function vt(e){return _(e,!0)||e===36||e===95||e===8204||e===8205}J.regexp_eatAtomEscape=function(e){return this.regexp_eatBackReference(e)||this.regexp_eatCharacterClassEscape(e)||this.regexp_eatCharacterEscape(e)||e.switchN&&this.regexp_eatKGroupName(e)?!0:(e.switchU&&(e.current()===99&&e.raise(`Invalid unicode escape`),e.raise(`Invalid escape`)),!1)},J.regexp_eatBackReference=function(e){var t=e.pos;if(this.regexp_eatDecimalEscape(e)){var n=e.lastIntValue;if(e.switchU)return n>e.maxBackReference&&(e.maxBackReference=n),!0;if(n<=e.numCapturingParens)return!0;e.pos=t}return!1},J.regexp_eatKGroupName=function(e){if(e.eat(107)){if(this.regexp_eatGroupName(e))return e.backReferenceNames.push(e.lastStringValue),!0;e.raise(`Invalid named reference`)}return!1},J.regexp_eatCharacterEscape=function(e){return this.regexp_eatControlEscape(e)||this.regexp_eatCControlLetter(e)||this.regexp_eatZero(e)||this.regexp_eatHexEscapeSequence(e)||this.regexp_eatRegExpUnicodeEscapeSequence(e,!1)||!e.switchU&&this.regexp_eatLegacyOctalEscapeSequence(e)||this.regexp_eatIdentityEscape(e)},J.regexp_eatCControlLetter=function(e){var t=e.pos;if(e.eat(99)){if(this.regexp_eatControlLetter(e))return!0;e.pos=t}return!1},J.regexp_eatZero=function(e){return e.current()===48&&!Ot(e.lookahead())?(e.lastIntValue=0,e.advance(),!0):!1},J.regexp_eatControlEscape=function(e){var t=e.current();return t===116?(e.lastIntValue=9,e.advance(),!0):t===110?(e.lastIntValue=10,e.advance(),!0):t===118?(e.lastIntValue=11,e.advance(),!0):t===102?(e.lastIntValue=12,e.advance(),!0):t===114?(e.lastIntValue=13,e.advance(),!0):!1},J.regexp_eatControlLetter=function(e){var t=e.current();return yt(t)?(e.lastIntValue=t%32,e.advance(),!0):!1};function yt(e){return e>=65&&e<=90||e>=97&&e<=122}J.regexp_eatRegExpUnicodeEscapeSequence=function(e,t){t===void 0&&(t=!1);var n=e.pos,r=t||e.switchU;if(e.eat(117)){if(this.regexp_eatFixedHexDigits(e,4)){var i=e.lastIntValue;if(r&&i>=55296&&i<=56319){var a=e.pos;if(e.eat(92)&&e.eat(117)&&this.regexp_eatFixedHexDigits(e,4)){var o=e.lastIntValue;if(o>=56320&&o<=57343)return e.lastIntValue=(i-55296)*1024+(o-56320)+65536,!0}e.pos=a,e.lastIntValue=i}return!0}if(r&&e.eat(123)&&this.regexp_eatHexDigits(e)&&e.eat(125)&&bt(e.lastIntValue))return!0;r&&e.raise(`Invalid unicode escape`),e.pos=n}return!1};function bt(e){return e>=0&&e<=1114111}J.regexp_eatIdentityEscape=function(e){if(e.switchU)return this.regexp_eatSyntaxCharacter(e)?!0:e.eat(47)?(e.lastIntValue=47,!0):!1;var t=e.current();return t!==99&&(!e.switchN||t!==107)?(e.lastIntValue=t,e.advance(),!0):!1},J.regexp_eatDecimalEscape=function(e){e.lastIntValue=0;var t=e.current();if(t>=49&&t<=57){do e.lastIntValue=10*e.lastIntValue+(t-48),e.advance();while((t=e.current())>=48&&t<=57);return!0}return!1};var xt=0,X=1,Z=2;J.regexp_eatCharacterClassEscape=function(e){var t=e.current();if(St(t))return e.lastIntValue=-1,e.advance(),X;var n=!1;if(e.switchU&&this.options.ecmaVersion>=9&&((n=t===80)||t===112)){e.lastIntValue=-1,e.advance();var r;if(e.eat(123)&&(r=this.regexp_eatUnicodePropertyValueExpression(e))&&e.eat(125))return n&&r===Z&&e.raise(`Invalid property name`),r;e.raise(`Invalid property name`)}return xt};function St(e){return e===100||e===68||e===115||e===83||e===119||e===87}J.regexp_eatUnicodePropertyValueExpression=function(e){var t=e.pos;if(this.regexp_eatUnicodePropertyName(e)&&e.eat(61)){var n=e.lastStringValue;if(this.regexp_eatUnicodePropertyValue(e)){var r=e.lastStringValue;return this.regexp_validateUnicodePropertyNameAndValue(e,n,r),X}}if(e.pos=t,this.regexp_eatLoneUnicodePropertyNameOrValue(e)){var i=e.lastStringValue;return this.regexp_validateUnicodePropertyNameOrValue(e,i)}return xt},J.regexp_validateUnicodePropertyNameAndValue=function(e,t,n){D(e.unicodeProperties.nonBinary,t)||e.raise(`Invalid property name`),e.unicodeProperties.nonBinary[t].test(n)||e.raise(`Invalid property value`)},J.regexp_validateUnicodePropertyNameOrValue=function(e,t){if(e.unicodeProperties.binary.test(t))return X;if(e.switchV&&e.unicodeProperties.binaryOfStrings.test(t))return Z;e.raise(`Invalid property name`)},J.regexp_eatUnicodePropertyName=function(e){var t=0;for(e.lastStringValue=``;Ct(t=e.current());)e.lastStringValue+=k(t),e.advance();return e.lastStringValue!==``};function Ct(e){return yt(e)||e===95}J.regexp_eatUnicodePropertyValue=function(e){var t=0;for(e.lastStringValue=``;wt(t=e.current());)e.lastStringValue+=k(t),e.advance();return e.lastStringValue!==``};function wt(e){return Ct(e)||Ot(e)}J.regexp_eatLoneUnicodePropertyNameOrValue=function(e){return this.regexp_eatUnicodePropertyValue(e)},J.regexp_eatCharacterClass=function(e){if(e.eat(91)){var t=e.eat(94),n=this.regexp_classContents(e);return e.eat(93)||e.raise(`Unterminated character class`),t&&n===Z&&e.raise(`Negated character class may contain strings`),!0}return!1},J.regexp_classContents=function(e){return e.current()===93?X:e.switchV?this.regexp_classSetExpression(e):(this.regexp_nonEmptyClassRanges(e),X)},J.regexp_nonEmptyClassRanges=function(e){for(;this.regexp_eatClassAtom(e);){var t=e.lastIntValue;if(e.eat(45)&&this.regexp_eatClassAtom(e)){var n=e.lastIntValue;e.switchU&&(t===-1||n===-1)&&e.raise(`Invalid character class`),t!==-1&&n!==-1&&t>n&&e.raise(`Range out of order in character class`)}}},J.regexp_eatClassAtom=function(e){var t=e.pos;if(e.eat(92)){if(this.regexp_eatClassEscape(e))return!0;if(e.switchU){var n=e.current();(n===99||jt(n))&&e.raise(`Invalid class escape`),e.raise(`Invalid escape`)}e.pos=t}var r=e.current();return r===93?!1:(e.lastIntValue=r,e.advance(),!0)},J.regexp_eatClassEscape=function(e){var t=e.pos;if(e.eat(98))return e.lastIntValue=8,!0;if(e.switchU&&e.eat(45))return e.lastIntValue=45,!0;if(!e.switchU&&e.eat(99)){if(this.regexp_eatClassControlLetter(e))return!0;e.pos=t}return this.regexp_eatCharacterClassEscape(e)||this.regexp_eatCharacterEscape(e)},J.regexp_classSetExpression=function(e){var t=X,n;if(!this.regexp_eatClassSetRange(e))if(n=this.regexp_eatClassSetOperand(e)){n===Z&&(t=Z);for(var r=e.pos;e.eatChars([38,38]);){if(e.current()!==38&&(n=this.regexp_eatClassSetOperand(e))){n!==Z&&(t=X);continue}e.raise(`Invalid character in character class`)}if(r!==e.pos)return t;for(;e.eatChars([45,45]);)this.regexp_eatClassSetOperand(e)||e.raise(`Invalid character in character class`);if(r!==e.pos)return t}else e.raise(`Invalid character in character class`);for(;;)if(!this.regexp_eatClassSetRange(e)){if(n=this.regexp_eatClassSetOperand(e),!n)return t;n===Z&&(t=Z)}},J.regexp_eatClassSetRange=function(e){var t=e.pos;if(this.regexp_eatClassSetCharacter(e)){var n=e.lastIntValue;if(e.eat(45)&&this.regexp_eatClassSetCharacter(e)){var r=e.lastIntValue;return n!==-1&&r!==-1&&n>r&&e.raise(`Range out of order in character class`),!0}e.pos=t}return!1},J.regexp_eatClassSetOperand=function(e){return this.regexp_eatClassSetCharacter(e)?X:this.regexp_eatClassStringDisjunction(e)||this.regexp_eatNestedClass(e)},J.regexp_eatNestedClass=function(e){var t=e.pos;if(e.eat(91)){var n=e.eat(94),r=this.regexp_classContents(e);if(e.eat(93))return n&&r===Z&&e.raise(`Negated character class may contain strings`),r;e.pos=t}if(e.eat(92)){var i=this.regexp_eatCharacterClassEscape(e);if(i)return i;e.pos=t}return null},J.regexp_eatClassStringDisjunction=function(e){var t=e.pos;if(e.eatChars([92,113])){if(e.eat(123)){var n=this.regexp_classStringDisjunctionContents(e);if(e.eat(125))return n}else e.raise(`Invalid escape`);e.pos=t}return null},J.regexp_classStringDisjunctionContents=function(e){for(var t=this.regexp_classString(e);e.eat(124);)this.regexp_classString(e)===Z&&(t=Z);return t},J.regexp_classString=function(e){for(var t=0;this.regexp_eatClassSetCharacter(e);)t++;return t===1?X:Z},J.regexp_eatClassSetCharacter=function(e){var t=e.pos;if(e.eat(92))return this.regexp_eatCharacterEscape(e)||this.regexp_eatClassSetReservedPunctuator(e)?!0:e.eat(98)?(e.lastIntValue=8,!0):(e.pos=t,!1);var n=e.current();return n<0||n===e.lookahead()&&Tt(n)||Et(n)?!1:(e.advance(),e.lastIntValue=n,!0)};function Tt(e){return e===33||e>=35&&e<=38||e>=42&&e<=44||e===46||e>=58&&e<=64||e===94||e===96||e===126}function Et(e){return e===40||e===41||e===45||e===47||e>=91&&e<=93||e>=123&&e<=125}J.regexp_eatClassSetReservedPunctuator=function(e){var t=e.current();return Dt(t)?(e.lastIntValue=t,e.advance(),!0):!1};function Dt(e){return e===33||e===35||e===37||e===38||e===44||e===45||e>=58&&e<=62||e===64||e===96||e===126}J.regexp_eatClassControlLetter=function(e){var t=e.current();return Ot(t)||t===95?(e.lastIntValue=t%32,e.advance(),!0):!1},J.regexp_eatHexEscapeSequence=function(e){var t=e.pos;if(e.eat(120)){if(this.regexp_eatFixedHexDigits(e,2))return!0;e.switchU&&e.raise(`Invalid escape`),e.pos=t}return!1},J.regexp_eatDecimalDigits=function(e){var t=e.pos,n=0;for(e.lastIntValue=0;Ot(n=e.current());)e.lastIntValue=10*e.lastIntValue+(n-48),e.advance();return e.pos!==t};function Ot(e){return e>=48&&e<=57}J.regexp_eatHexDigits=function(e){var t=e.pos,n=0;for(e.lastIntValue=0;kt(n=e.current());)e.lastIntValue=16*e.lastIntValue+At(n),e.advance();return e.pos!==t};function kt(e){return e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102}function At(e){return e>=65&&e<=70?10+(e-65):e>=97&&e<=102?10+(e-97):e-48}J.regexp_eatLegacyOctalEscapeSequence=function(e){if(this.regexp_eatOctalDigit(e)){var t=e.lastIntValue;if(this.regexp_eatOctalDigit(e)){var n=e.lastIntValue;t<=3&&this.regexp_eatOctalDigit(e)?e.lastIntValue=t*64+n*8+e.lastIntValue:e.lastIntValue=t*8+n}else e.lastIntValue=t;return!0}return!1},J.regexp_eatOctalDigit=function(e){var t=e.current();return jt(t)?(e.lastIntValue=t-48,e.advance(),!0):(e.lastIntValue=0,!1)};function jt(e){return e>=48&&e<=55}J.regexp_eatFixedHexDigits=function(e,t){var n=e.pos;e.lastIntValue=0;for(var r=0;r<t;++r){var i=e.current();if(!kt(i))return e.pos=n,!1;e.lastIntValue=16*e.lastIntValue+At(i),e.advance()}return!0};var Mt=function(e){this.type=e.type,this.value=e.value,this.start=e.start,this.end=e.end,e.options.locations&&(this.loc=new de(e,e.startLoc,e.endLoc)),e.options.ranges&&(this.range=[e.start,e.end])},Q=I.prototype;Q.next=function(e){!e&&this.type.keyword&&this.containsEsc&&this.raiseRecoverable(this.start,`Escape sequence in keyword `+this.type.keyword),this.options.onToken&&this.options.onToken(new Mt(this)),this.lastTokEnd=this.end,this.lastTokStart=this.start,this.lastTokEndLoc=this.endLoc,this.lastTokStartLoc=this.startLoc,this.nextToken()},Q.getToken=function(){return this.next(),new Mt(this)},typeof Symbol<`u`&&(Q[Symbol.iterator]=function(){var e=this;return{next:function(){var t=e.getToken();return{done:t.type===C.eof,value:t}}}}),Q.nextToken=function(){var e=this.curContext();if((!e||!e.preserveSpace)&&this.skipSpace(),this.start=this.pos,this.options.locations&&(this.startLoc=this.curPosition()),this.pos>=this.input.length)return this.finishToken(C.eof);if(e.override)return e.override(this);this.readToken(this.fullCharCodeAtPos())},Q.readToken=function(e){return g(e,this.options.ecmaVersion>=6)||e===92?this.readWord():this.getTokenFromCode(e)},Q.fullCharCodeAt=function(e){var t=this.input.charCodeAt(e);if(t<=55295||t>=56320)return t;var n=this.input.charCodeAt(e+1);return n<=56319||n>=57344?t:(t<<10)+n-56613888},Q.fullCharCodeAtPos=function(){return this.fullCharCodeAt(this.pos)},Q.skipBlockComment=function(){var e=this.options.onComment&&this.curPosition(),t=this.pos,n=this.input.indexOf(`*/`,this.pos+=2);if(n===-1&&this.raise(this.pos-2,`Unterminated comment`),this.pos=n+2,this.options.locations)for(var r=void 0,i=t;(r=re(this.input,i,this.pos))>-1;)++this.curLine,i=this.lineStart=r;this.options.onComment&&this.options.onComment(!0,this.input.slice(t+2,n),t,this.pos,e,this.curPosition())},Q.skipLineComment=function(e){for(var t=this.pos,n=this.options.onComment&&this.curPosition(),r=this.input.charCodeAt(this.pos+=e);this.pos<this.input.length&&!T(r);)r=this.input.charCodeAt(++this.pos);this.options.onComment&&this.options.onComment(!1,this.input.slice(t+e,this.pos),t,this.pos,n,this.curPosition())},Q.skipSpace=function(){loop:for(;this.pos<this.input.length;){var e=this.input.charCodeAt(this.pos);switch(e){case 32:case 160:++this.pos;break;case 13:this.input.charCodeAt(this.pos+1)===10&&++this.pos;case 10:case 8232:case 8233:++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(e>8&&e<14||e>=5760&&ie.test(String.fromCharCode(e)))++this.pos;else break loop}}},Q.finishToken=function(e,t){this.end=this.pos,this.options.locations&&(this.endLoc=this.curPosition());var n=this.type;this.type=e,this.value=t,this.updateContext(n)},Q.readToken_dot=function(){var e=this.input.charCodeAt(this.pos+1);if(e>=48&&e<=57)return this.readNumber(!0);var t=this.input.charCodeAt(this.pos+2);return this.options.ecmaVersion>=6&&e===46&&t===46?(this.pos+=3,this.finishToken(C.ellipsis)):(++this.pos,this.finishToken(C.dot))},Q.readToken_slash=function(){var e=this.input.charCodeAt(this.pos+1);return this.exprAllowed?(++this.pos,this.readRegexp()):e===61?this.finishOp(C.assign,2):this.finishOp(C.slash,1)},Q.readToken_mult_modulo_exp=function(e){var t=this.input.charCodeAt(this.pos+1),n=1,r=e===42?C.star:C.modulo;return this.options.ecmaVersion>=7&&e===42&&t===42&&(++n,r=C.starstar,t=this.input.charCodeAt(this.pos+2)),t===61?this.finishOp(C.assign,n+1):this.finishOp(r,n)},Q.readToken_pipe_amp=function(e){var t=this.input.charCodeAt(this.pos+1);return t===e?this.options.ecmaVersion>=12&&this.input.charCodeAt(this.pos+2)===61?this.finishOp(C.assign,3):this.finishOp(e===124?C.logicalOR:C.logicalAND,2):t===61?this.finishOp(C.assign,2):this.finishOp(e===124?C.bitwiseOR:C.bitwiseAND,1)},Q.readToken_caret=function(){return this.input.charCodeAt(this.pos+1)===61?this.finishOp(C.assign,2):this.finishOp(C.bitwiseXOR,1)},Q.readToken_plus_min=function(e){var t=this.input.charCodeAt(this.pos+1);return t===e?t===45&&!this.inModule&&this.input.charCodeAt(this.pos+2)===62&&(this.lastTokEnd===0||w.test(this.input.slice(this.lastTokEnd,this.pos)))?(this.skipLineComment(3),this.skipSpace(),this.nextToken()):this.finishOp(C.incDec,2):t===61?this.finishOp(C.assign,2):this.finishOp(C.plusMin,1)},Q.readToken_lt_gt=function(e){var t=this.input.charCodeAt(this.pos+1),n=1;return t===e?(n=e===62&&this.input.charCodeAt(this.pos+2)===62?3:2,this.input.charCodeAt(this.pos+n)===61?this.finishOp(C.assign,n+1):this.finishOp(C.bitShift,n)):t===33&&e===60&&!this.inModule&&this.input.charCodeAt(this.pos+2)===45&&this.input.charCodeAt(this.pos+3)===45?(this.skipLineComment(4),this.skipSpace(),this.nextToken()):(t===61&&(n=2),this.finishOp(C.relational,n))},Q.readToken_eq_excl=function(e){var t=this.input.charCodeAt(this.pos+1);return t===61?this.finishOp(C.equality,this.input.charCodeAt(this.pos+2)===61?3:2):e===61&&t===62&&this.options.ecmaVersion>=6?(this.pos+=2,this.finishToken(C.arrow)):this.finishOp(e===61?C.eq:C.prefix,1)},Q.readToken_question=function(){var e=this.options.ecmaVersion;if(e>=11){var t=this.input.charCodeAt(this.pos+1);if(t===46){var n=this.input.charCodeAt(this.pos+2);if(n<48||n>57)return this.finishOp(C.questionDot,2)}if(t===63)return e>=12&&this.input.charCodeAt(this.pos+2)===61?this.finishOp(C.assign,3):this.finishOp(C.coalesce,2)}return this.finishOp(C.question,1)},Q.readToken_numberSign=function(){var e=this.options.ecmaVersion,t=35;if(e>=13&&(++this.pos,t=this.fullCharCodeAtPos(),g(t,!0)||t===92))return this.finishToken(C.privateId,this.readWord1());this.raise(this.pos,`Unexpected character '`+k(t)+`'`)},Q.getTokenFromCode=function(e){switch(e){case 46:return this.readToken_dot();case 40:return++this.pos,this.finishToken(C.parenL);case 41:return++this.pos,this.finishToken(C.parenR);case 59:return++this.pos,this.finishToken(C.semi);case 44:return++this.pos,this.finishToken(C.comma);case 91:return++this.pos,this.finishToken(C.bracketL);case 93:return++this.pos,this.finishToken(C.bracketR);case 123:return++this.pos,this.finishToken(C.braceL);case 125:return++this.pos,this.finishToken(C.braceR);case 58:return++this.pos,this.finishToken(C.colon);case 96:if(this.options.ecmaVersion<6)break;return++this.pos,this.finishToken(C.backQuote);case 48:var t=this.input.charCodeAt(this.pos+1);if(t===120||t===88)return this.readRadixNumber(16);if(this.options.ecmaVersion>=6){if(t===111||t===79)return this.readRadixNumber(8);if(t===98||t===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(e);case 47:return this.readToken_slash();case 37:case 42:return this.readToken_mult_modulo_exp(e);case 124:case 38:return this.readToken_pipe_amp(e);case 94:return this.readToken_caret();case 43:case 45:return this.readToken_plus_min(e);case 60:case 62:return this.readToken_lt_gt(e);case 61:case 33:return this.readToken_eq_excl(e);case 63:return this.readToken_question();case 126:return this.finishOp(C.prefix,1);case 35:return this.readToken_numberSign()}this.raise(this.pos,`Unexpected character '`+k(e)+`'`)},Q.finishOp=function(e,t){var n=this.input.slice(this.pos,this.pos+t);return this.pos+=t,this.finishToken(e,n)},Q.readRegexp=function(){for(var e,t,n=this.pos;;){this.pos>=this.input.length&&this.raise(n,`Unterminated regular expression`);var r=this.input.charAt(this.pos);if(w.test(r)&&this.raise(n,`Unterminated regular expression`),e)e=!1;else{if(r===`[`)t=!0;else if(r===`]`&&t)t=!1;else if(r===`/`&&!t)break;e=r===`\\`}++this.pos}var i=this.input.slice(n,this.pos);++this.pos;var a=this.pos,o=this.readWord1();this.containsEsc&&this.unexpected(a);var s=this.regexpState||=new Y(this);s.reset(n,i,o),this.validateRegExpFlags(s),this.validateRegExpPattern(s);var c=null;try{c=new RegExp(i,o)}catch{}return this.finishToken(C.regexp,{pattern:i,flags:o,value:c})},Q.readInt=function(e,t,n){for(var r=this.options.ecmaVersion>=12&&t===void 0,i=n&&this.input.charCodeAt(this.pos)===48,a=this.pos,o=0,s=0,c=0,l=t??1/0;c<l;++c,++this.pos){var u=this.input.charCodeAt(this.pos),d=void 0;if(r&&u===95){i&&this.raiseRecoverable(this.pos,`Numeric separator is not allowed in legacy octal numeric literals`),s===95&&this.raiseRecoverable(this.pos,`Numeric separator must be exactly one underscore`),c===0&&this.raiseRecoverable(this.pos,`Numeric separator is not allowed at the first of digits`),s=u;continue}if(d=u>=97?u-97+10:u>=65?u-65+10:u>=48&&u<=57?u-48:1/0,d>=e)break;s=u,o=o*e+d}return r&&s===95&&this.raiseRecoverable(this.pos-1,`Numeric separator is not allowed at the last of digits`),this.pos===a||t!=null&&this.pos-a!==t?null:o};function Nt(e,t){return t?parseInt(e,8):parseFloat(e.replace(/_/g,``))}function Pt(e){return typeof BigInt==`function`?BigInt(e.replace(/_/g,``)):null}Q.readRadixNumber=function(e){var t=this.pos;this.pos+=2;var n=this.readInt(e);return n??this.raise(this.start+2,`Expected number in radix `+e),this.options.ecmaVersion>=11&&this.input.charCodeAt(this.pos)===110?(n=Pt(this.input.slice(t,this.pos)),++this.pos):g(this.fullCharCodeAtPos())&&this.raise(this.pos,`Identifier directly after number`),this.finishToken(C.num,n)},Q.readNumber=function(e){var t=this.pos;!e&&this.readInt(10,void 0,!0)===null&&this.raise(t,`Invalid number`);var n=this.pos-t>=2&&this.input.charCodeAt(t)===48;n&&this.strict&&this.raise(t,`Invalid number`);var r=this.input.charCodeAt(this.pos);if(!n&&!e&&this.options.ecmaVersion>=11&&r===110){var i=Pt(this.input.slice(t,this.pos));return++this.pos,g(this.fullCharCodeAtPos())&&this.raise(this.pos,`Identifier directly after number`),this.finishToken(C.num,i)}n&&/[89]/.test(this.input.slice(t,this.pos))&&(n=!1),r===46&&!n&&(++this.pos,this.readInt(10),r=this.input.charCodeAt(this.pos)),(r===69||r===101)&&!n&&(r=this.input.charCodeAt(++this.pos),(r===43||r===45)&&++this.pos,this.readInt(10)===null&&this.raise(t,`Invalid number`)),g(this.fullCharCodeAtPos())&&this.raise(this.pos,`Identifier directly after number`);var a=Nt(this.input.slice(t,this.pos),n);return this.finishToken(C.num,a)},Q.readCodePoint=function(){var e=this.input.charCodeAt(this.pos),t;if(e===123){this.options.ecmaVersion<6&&this.unexpected();var n=++this.pos;t=this.readHexChar(this.input.indexOf(`}`,this.pos)-this.pos),++this.pos,t>1114111&&this.invalidStringToken(n,`Code point out of bounds`)}else t=this.readHexChar(4);return t},Q.readString=function(e){for(var t=``,n=++this.pos;;){this.pos>=this.input.length&&this.raise(this.start,`Unterminated string constant`);var r=this.input.charCodeAt(this.pos);if(r===e)break;r===92?(t+=this.input.slice(n,this.pos),t+=this.readEscapedChar(!1),n=this.pos):r===8232||r===8233?(this.options.ecmaVersion<10&&this.raise(this.start,`Unterminated string constant`),++this.pos,this.options.locations&&(this.curLine++,this.lineStart=this.pos)):(T(r)&&this.raise(this.start,`Unterminated string constant`),++this.pos)}return t+=this.input.slice(n,this.pos++),this.finishToken(C.string,t)};var Ft={};Q.tryReadTemplateToken=function(){this.inTemplateElement=!0;try{this.readTmplToken()}catch(e){if(e===Ft)this.readInvalidTemplateToken();else throw e}this.inTemplateElement=!1},Q.invalidStringToken=function(e,t){if(this.inTemplateElement&&this.options.ecmaVersion>=9)throw Ft;this.raise(e,t)},Q.readTmplToken=function(){for(var e=``,t=this.pos;;){this.pos>=this.input.length&&this.raise(this.start,`Unterminated template`);var n=this.input.charCodeAt(this.pos);if(n===96||n===36&&this.input.charCodeAt(this.pos+1)===123)return this.pos===this.start&&(this.type===C.template||this.type===C.invalidTemplate)?n===36?(this.pos+=2,this.finishToken(C.dollarBraceL)):(++this.pos,this.finishToken(C.backQuote)):(e+=this.input.slice(t,this.pos),this.finishToken(C.template,e));if(n===92)e+=this.input.slice(t,this.pos),e+=this.readEscapedChar(!0),t=this.pos;else if(T(n)){switch(e+=this.input.slice(t,this.pos),++this.pos,n){case 13:this.input.charCodeAt(this.pos)===10&&++this.pos;case 10:e+=`
6
+ `;break;default:e+=String.fromCharCode(n);break}this.options.locations&&(++this.curLine,this.lineStart=this.pos),t=this.pos}else++this.pos}},Q.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(C.invalidTemplate,this.input.slice(this.start,this.pos));case`\r`: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`)},Q.readEscapedChar=function(e){var t=this.input.charCodeAt(++this.pos);switch(++this.pos,t){case 110:return`
9
+ `;case 114:return`\r`;case 120:return String.fromCharCode(this.readHexChar(2));case 117:return k(this.readCodePoint());case 116:return` `;case 98:return`\b`;case 118:return`\v`;case 102:return`\f`;case 13:this.input.charCodeAt(this.pos)===10&&++this.pos;case 10:return this.options.locations&&(this.lineStart=this.pos,++this.curLine),``;case 56:case 57:if(this.strict&&this.invalidStringToken(this.pos-1,`Invalid escape sequence`),e){var n=this.pos-1;this.invalidStringToken(n,`Invalid escape sequence in template string`)}default:if(t>=48&&t<=55){var r=this.input.substr(this.pos-1,3).match(/^[0-7]+/)[0],i=parseInt(r,8);return i>255&&(r=r.slice(0,-1),i=parseInt(r,8)),this.pos+=r.length-1,t=this.input.charCodeAt(this.pos),(r!==`0`||t===56||t===57)&&(this.strict||e)&&this.invalidStringToken(this.pos-1-r.length,e?`Octal literal in template string`:`Octal literal in strict mode`),String.fromCharCode(i)}return T(t)?(this.options.locations&&(this.lineStart=this.pos,++this.curLine),``):String.fromCharCode(t)}},Q.readHexChar=function(e){var t=this.pos,n=this.readInt(16,e);return n===null&&this.invalidStringToken(t,`Bad character escape sequence`),n},Q.readWord1=function(){this.containsEsc=!1;for(var e=``,t=!0,n=this.pos,r=this.options.ecmaVersion>=6;this.pos<this.input.length;){var i=this.fullCharCodeAtPos();if(_(i,r))this.pos+=i<=65535?1:2;else if(i===92){this.containsEsc=!0,e+=this.input.slice(n,this.pos);var a=this.pos;this.input.charCodeAt(++this.pos)!==117&&this.invalidStringToken(this.pos,`Expecting Unicode escape sequence \\uXXXX`),++this.pos;var o=this.readCodePoint();(t?g:_)(o,r)||this.invalidStringToken(a,`Invalid Unicode escape`),e+=k(o),n=this.pos}else break;t=!1}return e+this.input.slice(n,this.pos)},Q.readWord=function(){var e=this.readWord1(),t=C.name;return this.keywords.test(e)&&(t=te[e]),this.finishToken(t,e)},I.acorn={Parser:I,version:`8.17.0`,defaultOptions:pe,Position:A,SourceLocation:de,getLineInfo:fe,Node:Ge,TokenType:v,tokTypes:C,keywordTypes:te,TokContext:H,tokContexts:U,isIdentifierChar:_,isIdentifierStart:g,Token:Mt,isNewLine:T,lineBreak:w,lineBreakG:ne,nonASCIIwhitespace:ie};function It(e){return!e||typeof e!=`object`?null:e.type===`Identifier`?e.name:e.type===`MemberExpression`?It(e.object):null}function $(e,t){if(e==null)return`undefined`;if(typeof e!=`object`)return typeof e==`string`?JSON.stringify(e):String(e);if(Array.isArray(e))return e.map(e=>$(e,t)).join(`; `);switch(e.type){case`Identifier`:return t&&t.has(e.name)?e.name:`((typeof inScopeChain === 'function' ? inScopeChain(scope, ${JSON.stringify(e.name)}) : Object.prototype.hasOwnProperty.call(scope || {}, ${JSON.stringify(e.name)})) ? scope[${JSON.stringify(e.name)}] : (typeof globalThis !== 'undefined' && Object.prototype.hasOwnProperty.call(globalThis, ${JSON.stringify(e.name)}) ? globalThis[${JSON.stringify(e.name)}] : undefined))`;case`Literal`:return typeof e.raw==`string`?e.raw:typeof e.value==`string`?JSON.stringify(e.value):String(e.value);case`BinaryExpression`:case`LogicalExpression`:return`(${$(e.left,t)} ${e.operator} ${$(e.right,t)})`;case`UnaryExpression`:return`(${e.operator} ${$(e.argument,t)})`;case`ConditionalExpression`:return`(${$(e.test,t)} ? ${$(e.consequent,t)} : ${$(e.alternate,t)})`;case`MemberExpression`:return e.computed?`(${$(e.object,t)}[${$(e.property,t)}])`:`(${$(e.object,t)}.${e.property.name})`;case`CallExpression`:{let n=`(${$(e.callee,t)}(${e.arguments?e.arguments.map(e=>$(e,t)).join(`, `):``}))`;if(e.callee?.type===`MemberExpression`&&e.callee.property?.type===`Identifier`){let r=It(e.callee.object),i=e.callee.property.name;if(r&&[`push`,`pop`,`shift`,`unshift`,`splice`,`sort`,`reverse`].includes(i)&&(!t||!t.has(r)))return`(() => { const _res = ${n}; if (typeof setScopeValue === 'function' && scope) setScopeValue(scope, ${JSON.stringify(r)}, scope[${JSON.stringify(r)}]); return _res; })()`}return n}case`AssignmentExpression`:{let n=$(e.right,t);if(e.left?.type===`Identifier`){let r=e.left.name;if(t&&t.has(r))return`(${r} ${e.operator} ${n})`;if(e.operator===`=`)return`(typeof setScopeValue === 'function' ? setScopeValue(scope, ${JSON.stringify(r)}, ${n}) : ((scope || {})[${JSON.stringify(r)}] = ${n}))`;{let t=e.operator.slice(0,-1);return`(typeof setScopeValue === 'function' ? setScopeValue(scope, ${JSON.stringify(r)}, (scope[${JSON.stringify(r)}] ${t} ${n})) : ((scope || {})[${JSON.stringify(r)}] ${e.operator} ${n}))`}}if(e.left?.type===`MemberExpression`){let r=It(e.left),i=`(${$(e.left,t)} ${e.operator} ${n})`;if(r&&(!t||!t.has(r)))return`(() => { const _res = ${i}; if (typeof setScopeValue === 'function' && scope) setScopeValue(scope, ${JSON.stringify(r)}, scope[${JSON.stringify(r)}]); return _res; })()`}if(e.left?.type===`ArrayPattern`){let r=[],i=e.left.elements||[];for(let e=0;e<i.length;e++){let n=i[e];if(n?.type===`Identifier`){let i=n.name;(!t||!t.has(i))&&r.push(`if (typeof setScopeValue === 'function' && scope) setScopeValue(scope, ${JSON.stringify(i)}, _val[${e}]);`)}}return`(() => { const _val = ${n} || []; ${r.join(` `)} return _val; })()`}if(e.left?.type===`ObjectPattern`){let r=[],i=e.left.properties||[];for(let e of i)if(e.type===`Property`&&e.value?.type===`Identifier`){let n=e.key?.name||(typeof e.key?.value==`string`?e.key.value:String(e.key?.value)),i=e.value.name;(!t||!t.has(i))&&r.push(`if (typeof setScopeValue === 'function' && scope) setScopeValue(scope, ${JSON.stringify(i)}, _val[${JSON.stringify(n)}]);`)}return`(() => { const _val = ${n} || {}; ${r.join(` `)} return _val; })()`}return`(${$(e.left,t)} ${e.operator} ${n})`}case`UpdateExpression`:if(e.argument?.type===`Identifier`){let n=e.argument.name;if(t&&t.has(n))return e.prefix?`(${e.operator}${n})`:`(${n}${e.operator})`;let r=e.operator===`++`?`+`:`-`;return e.prefix?`(typeof setScopeValue === 'function' ? (setScopeValue(scope, ${JSON.stringify(n)}, (Number(scope[${JSON.stringify(n)}]) || 0) ${r} 1), scope[${JSON.stringify(n)}]) : ((scope || {})[${JSON.stringify(n)}] = (Number((scope || {})[${JSON.stringify(n)}]) || 0) ${r} 1))`:`(() => { const _v = Number(scope[${JSON.stringify(n)}]) || 0; if (typeof setScopeValue === 'function') setScopeValue(scope, ${JSON.stringify(n)}, _v ${r} 1); else (scope || {})[${JSON.stringify(n)}] = _v ${r} 1; return _v; })()`}if(e.argument?.type===`MemberExpression`){let n=It(e.argument),r=e.prefix?`(${e.operator}${$(e.argument,t)})`:`(${$(e.argument,t)}${e.operator})`;if(n&&(!t||!t.has(n)))return`(() => { const _res = ${r}; if (typeof setScopeValue === 'function' && scope) setScopeValue(scope, ${JSON.stringify(n)}, scope[${JSON.stringify(n)}]); return _res; })()`}return e.prefix?`(${e.operator}${$(e.argument,t)})`:`(${$(e.argument,t)}${e.operator})`;case`SequenceExpression`:return`(${e.expressions?e.expressions.map(e=>$(e,t)).join(`, `):``})`;case`ArrayExpression`:return`[${e.elements?e.elements.map(e=>e?.type===`SpreadElement`?`...`+$(e.argument,t):$(e,t)).join(`, `):``}]`;case`ObjectExpression`:return`{${e.properties?e.properties.map(e=>e.type===`SpreadElement`?`...`+$(e.argument,t):`${e.computed?`[`+$(e.key,t)+`]`:e.key.name}: ${$(e.value,t)}`).join(`, `):``}}`;case`SpreadElement`:return`...${$(e.argument,t)}`;case`TemplateLiteral`:return`\`${e.quasis?e.quasis.map((n,r)=>(n.value?.raw??``)+(e.expressions&&e.expressions[r]?"${"+$(e.expressions[r],t)+`}`:``)).join(``):``}\``;case`TaggedTemplateExpression`:return`${$(e.tag,t)}${$(e.quasi,t)}`;case`ThisExpression`:return`scope`;case`BlockStatement`:{let n=new Set(t);return`{ ${(e.body?e.body.map(e=>$(e,n)).filter(Boolean):[]).join(`; `)}; }`}case`ExpressionStatement`:return $(e.expression,t);case`ReturnStatement`:return`return ${e.argument?$(e.argument,t):``}`;case`BreakStatement`:return e.label?`break ${e.label.name}`:`break`;case`ContinueStatement`:return e.label?`continue ${e.label.name}`:`continue`;case`IfStatement`:return`if (${$(e.test,t)}) ${e.consequent.type===`BlockStatement`?$(e.consequent,t):`{ ${$(e.consequent,t)}; }`}${e.alternate?` else ${e.alternate.type===`BlockStatement`||e.alternate.type===`IfStatement`?$(e.alternate,t):`{ ${$(e.alternate,t)}; }`}`:``}`;case`ForStatement`:{let n=new Set(t);if(e.init?.type===`VariableDeclaration`&&e.init.declarations)for(let t of e.init.declarations){let e=t.id?.name;e&&n.add(e)}let r=``;e.init?.type===`VariableDeclaration`&&e.init.declarations?r=`let `+e.init.declarations.map(e=>`${e.id.name} = ${e.init?$(e.init,n):`undefined`}`).join(`, `):e.init&&(r=$(e.init,n));let i=e.test?$(e.test,n):``,a=e.update?$(e.update,n):``,o=e.body?$(e.body,n):``;return`(() => { for (${r}; ${i}; ${a}) ${o}; })()`}case`ForOfStatement`:{let n=new Set(t),r=e.left?.type===`VariableDeclaration`?e.left.declarations[0]?.id?.name:e.left?.name;return r&&n.add(r),`(() => { const _iter = (typeof resolveIterable === 'function' ? resolveIterable(${$(e.right,t)}) : (${$(e.right,t)} || [])); for (let ${r} of _iter) { if (scope) scope[${JSON.stringify(r)}] = ${r}; ${$(e.body,n)}; } })()`}case`ForInStatement`:{let n=new Set(t),r=e.left?.type===`VariableDeclaration`?e.left.declarations[0]?.id?.name:e.left?.name;return r&&n.add(r),`(() => { const _obj = ${$(e.right,t)}; if (_obj) { for (let ${r} in _obj) { if (scope) scope[${JSON.stringify(r)}] = ${r}; ${$(e.body,n)}; } } })()`}case`WhileStatement`:return`(() => { while (${$(e.test,t)}) ${$(e.body,t)}; })()`;case`DoWhileStatement`:return`(() => { do ${$(e.body,t)} while (${$(e.test,t)}); })()`;case`ArrayPattern`:return`[ ${e.elements?e.elements.map(e=>e?e.type===`RestElement`?`...`+$(e.argument,t):e.type===`AssignmentPattern`?`${$(e.left,t)} = ${$(e.right,t)}`:e.name||$(e,t):``).join(`, `):``} ]`;case`ObjectPattern`:return`{ ${e.properties?e.properties.map(e=>{if(e.type===`Property`){let n=e.key?.name||$(e.key,t),r=e.value?.name||$(e.value,t);return n===r?n:`${n}: ${r}`}return e.type===`RestElement`?`...${$(e.argument,t)}`:``}).filter(Boolean).join(`, `):``} }`;case`VariableDeclaration`:{let n=new Set(t),r=[];if(e.declarations)for(let i of e.declarations)if(i.id?.type===`ObjectPattern`){let e=i.init?$(i.init,t):`undefined`;for(let a of i.id.properties||[])if(a.type===`Property`){let i=a.key?.name||(typeof a.key?.value==`string`?a.key.value:$(a.key,t)),o=a.value?.name,s=null;if(a.value?.type===`AssignmentPattern`?(o=a.value.left?.name||$(a.value.left,t),s=$(a.value.right,t)):o||=$(a.value,t),o){n.add(o);let t=`((${e} && (${JSON.stringify(i)} in ${e})) ? ${e}[${JSON.stringify(i)}] : ${s??`undefined`})`;r.push(`(typeof setScopeValue === 'function' ? setScopeValue(scope, ${JSON.stringify(o)}, ${t}) : ((scope || {})[${JSON.stringify(o)}] = ${t}))`)}}}else{let e=i.id?.name||$(i.id,t);i.id?.name&&n.add(i.id.name);let a=i.init?$(i.init,t):`undefined`;t&&i.id?.name&&t.has(i.id.name)?r.push(`${i.id.name} = ${a}`):r.push(`(typeof setScopeValue === 'function' ? setScopeValue(scope, ${JSON.stringify(e)}, ${a}) : ((scope || {})[${JSON.stringify(e)}] = ${a}))`)}return`(${r.filter(Boolean).join(`, `)||`undefined`})`}case`FunctionDeclaration`:{let n=e.id?.name,r=new Set(t);n&&r.add(n);let i=[];if(e.params)for(let n of e.params)if(n.type===`AssignmentPattern`){let e=n.left?.name||$(n.left,t),a=$(n.right,t);n.left?.name&&r.add(n.left.name),i.push(`${e} = ${a}`)}else{let e=n.name||n.id?.name||n.left&&n.left.name||$(n,t);e&&(i.push(e),r.add(e))}if(e.body?.type===`BlockStatement`&&Array.isArray(e.body.body))for(let t of e.body.body)if(t.type===`VariableDeclaration`&&t.declarations)for(let e of t.declarations)e.id?.name&&r.add(e.id.name);else t.type===`FunctionDeclaration`&&t.id?.name&&r.add(t.id.name);let a=i.join(`, `),o=e.body?.type===`BlockStatement`?`{ ${e.body.body.map(e=>$(e,r)).filter(Boolean).join(`; `)}; }`:`{ ${$(e.body,r)}; }`,s=`function ${n||``}(${a}) ${o}`;return n?`(typeof setScopeValue === 'function' ? setScopeValue(scope, ${JSON.stringify(n)}, ${s}) : ((scope || {})[${JSON.stringify(n)}] = ${s}))`:s}case`ArrowFunctionExpression`:case`FunctionExpression`:{let n=new Set(t),r=[];if(e.params)for(let i of e.params)if(i.type===`AssignmentPattern`){let e=i.left?.name||$(i.left,t),a=$(i.right,t);i.left?.name&&n.add(i.left.name),r.push(`${e} = ${a}`)}else{let e=i.name||i.id?.name||i.left&&i.left.name||$(i,t);e&&(r.push(e),n.add(e))}if(e.body?.type===`BlockStatement`&&Array.isArray(e.body.body))for(let t of e.body.body)if(t.type===`VariableDeclaration`&&t.declarations)for(let e of t.declarations)e.id?.name&&n.add(e.id.name);else t.type===`FunctionDeclaration`&&t.id?.name&&n.add(t.id.name);let i=r.join(`, `);return e.body?.type===`BlockStatement`?`((${i}) => ${`{ ${e.body.body.map(e=>$(e,n)).filter(Boolean).join(`; `)}; }`})`:`((${i}) => ${$(e.body,n)})`}case`NewExpression`:return`new (${$(e.callee,t)})(${e.arguments?e.arguments.map(e=>$(e,t)).join(`, `):``})`;case`EmptyStatement`:case`ImportDeclaration`:case`ImportSpecifier`:case`ImportDefaultSpecifier`:case`ImportNamespaceSpecifier`:return``;case`ParenthesizedExpression`:case`ChainExpression`:return $(e.expression,t);default:return``}}function Lt(e){return Array.isArray(e)?e:e&&typeof e[Symbol.iterator]==`function`?Array.from(e):[]}function Rt(e,t,r){return typeof e.__drift_fn__==`function`?e.__drift_fn__(t,r,n,i,Lt):(e._executableFn||=typeof e.__drift_fn__==`string`?Function(`return (`+e.__drift_fn__+`)`)():e.__drift_fn__,e._executableFn(t,r,n,i,Lt))}function zt(e,t,r){if(e==null)return e;if(typeof e==`function`)return e(t,r,n,i,Lt);if(typeof e==`object`&&e&&`__drift_fn__`in e)return Rt(e,t,r);if(typeof e!=`object`||!e)return e;let a=$(e);if(!a||a.trim().length===0)return;let o;try{o=Function(`scope`,`declaredVars`,`setScopeValue`,`inScopeChain`,`resolveIterable`,`return (`+a+`)`)}catch{o=Function(`scope`,`declaredVars`,`setScopeValue`,`inScopeChain`,`resolveIterable`,a)}return o(t,r,n,i,Lt)}function Bt(e,t,n){return e==null?e:typeof e==`string`?i(t,e)?t[e]:e:typeof e==`object`&&(e.type||`__drift_fn__`in e||typeof e._executableFn==`function`)?zt(e,t,n):e}function Vt(e){return!e||typeof e!=`object`?null:Array.isArray(e.bytecode)||ArrayBuffer.isView(e.bytecode)?e:e.program&&(Array.isArray(e.program.bytecode)||ArrayBuffer.isView(e.program.bytecode))?e.program:e.default?Vt(e.default):e.compiledModule?Vt(e.compiledModule):null}function Ht(e,t,n){if(!e||typeof e!=`object`)return{};let r={};for(let i of Object.keys(e)){if(i===`__drift_props__`)continue;let a=e[i];r[i]=zt(a,t,n)}return r}function Ut(e,t,r){let i;if(!e)return i;if(typeof e==`function`)return e(t,r,n);if(typeof e==`object`&&e&&`__drift_fn__`in e)return Rt(e,t,r);if(Array.isArray(e))for(let n of e)i=zt(n,t,r);else e&&typeof e==`object`&&(i=zt(e,t,r));return i}e.MAX_REGISTERS=t,e.evaluateExpression=zt,e.evaluatePropsSpec=Ht,e.executeBlockStatement=Ut,e.executePrecompiledFn=Rt,e.inScopeChain=i,e.resolveComponentModule=Vt,e.resolveIterable=Lt,e.resolveValue=Bt,e.setScopeValue=n,e.syncDeclaredVars=r});
package/package.json CHANGED
@@ -1,7 +1,11 @@
1
1
  {
2
2
  "name": "driftjs-shared",
3
- "version": "0.0.4",
3
+ "version": "0.0.6",
4
4
  "type": "module",
5
+ "files": [
6
+ "dist",
7
+ "README.md"
8
+ ],
5
9
  "main": "./dist/index-es.js",
6
10
  "exports": {
7
11
  ".": {
@@ -11,7 +15,7 @@
11
15
  },
12
16
  "license": "MIT",
13
17
  "dependencies": {
14
- "driftjs-compiler": "0.0.4"
18
+ "driftjs-compiler": "0.0.6"
15
19
  },
16
20
  "devDependencies": {
17
21
  "typescript": "^7.0.2",
package/src/constants.ts DELETED
@@ -1,3 +0,0 @@
1
- /** Maximum registers allowed per Virtual Machine execution frame */
2
- export const MAX_REGISTERS = 256;
3
-
package/src/evaluator.ts DELETED
@@ -1,101 +0,0 @@
1
- import { setScopeValue, inScopeChain } from './scope.js';
2
- import { astToJS } from 'driftjs-compiler';
3
-
4
- /**
5
- * Safely resolves an iterable object or array.
6
- */
7
- export function resolveIterable(rawIter: any): any[] {
8
- if (Array.isArray(rawIter)) return rawIter;
9
- if (rawIter && typeof rawIter[Symbol.iterator] === 'function') {
10
- return Array.from(rawIter);
11
- }
12
- return [];
13
- }
14
-
15
- /**
16
- * Executes a pre-compiled function string stored on AST constant nodes.
17
- */
18
- export function executePrecompiledFn(node: any, scope: Record<string, any>, declaredVars?: Set<string>): any {
19
- if (typeof node.__drift_fn__ === 'function') {
20
- return node.__drift_fn__(scope, declaredVars, setScopeValue, inScopeChain, resolveIterable);
21
- }
22
- if (!node._executableFn) {
23
- node._executableFn = typeof node.__drift_fn__ === 'string'
24
- ? new Function('return (' + node.__drift_fn__ + ')')()
25
- : node.__drift_fn__;
26
- }
27
- return node._executableFn(scope, declaredVars, setScopeValue, inScopeChain, resolveIterable);
28
- }
29
-
30
- /**
31
- * Evaluates any JS expression (AST node, pre-compiled wrapper, function, or primitive).
32
- */
33
- export function evaluateExpression(node: any, scope: Record<string, any>, declaredVars?: Set<string>): any {
34
- if (node === null || node === undefined) return node;
35
-
36
- if (typeof node === 'function') {
37
- return node(scope, declaredVars, setScopeValue, inScopeChain, resolveIterable);
38
- }
39
-
40
- if (typeof node === 'object' && node !== null && '__drift_fn__' in node) {
41
- return executePrecompiledFn(node, scope, declaredVars);
42
- }
43
-
44
- if (typeof node !== 'object' || node === null) {
45
- return node;
46
- }
47
-
48
- const codeStr = astToJS(node);
49
- if (!codeStr || codeStr.trim().length === 0) {
50
- return undefined;
51
- }
52
-
53
- let executableFn: any;
54
- try {
55
- executableFn = new Function('scope', 'declaredVars', 'setScopeValue', 'inScopeChain', 'resolveIterable', 'return (' + codeStr + ')');
56
- } catch {
57
- executableFn = new Function('scope', 'declaredVars', 'setScopeValue', 'inScopeChain', 'resolveIterable', codeStr);
58
- }
59
-
60
- return executableFn(scope, declaredVars, setScopeValue, inScopeChain, resolveIterable);
61
- }
62
-
63
- /**
64
- * Resolves constant or variable values against scope.
65
- */
66
- export function resolveValue(val: any, scope: Record<string, any>, declaredVars?: Set<string>): any {
67
- if (val === null || val === undefined) return val;
68
- if (typeof val === 'string') return inScopeChain(scope, val) ? scope[val] : val;
69
- if (typeof val === 'object' && (val.type || '__drift_fn__' in val || typeof val._executableFn === 'function')) {
70
- return evaluateExpression(val, scope, declaredVars);
71
- }
72
- return val;
73
- }
74
-
75
- /**
76
- * Safely unwraps an imported component module (handling ESM default exports,
77
- * CompiledModule wrappers, and program objects).
78
- */
79
- export function resolveComponentModule(raw: any): any | null {
80
- if (!raw || typeof raw !== 'object') return null;
81
- if (Array.isArray(raw.bytecode) || ArrayBuffer.isView(raw.bytecode)) return raw;
82
- if (raw.program && (Array.isArray(raw.program.bytecode) || ArrayBuffer.isView(raw.program.bytecode))) return raw.program;
83
- if (raw.default) return resolveComponentModule(raw.default);
84
- if (raw.compiledModule) return resolveComponentModule(raw.compiledModule);
85
- return null;
86
- }
87
-
88
- /**
89
- * Evaluates a props specification object (mapping prop keys to static values or expression ASTs)
90
- * against a VM scope, returning a plain JavaScript props object.
91
- */
92
- export function evaluatePropsSpec(propsSpec: Record<string, any> | null | undefined, scope: Record<string, any>, declaredVars?: Set<string>): Record<string, any> {
93
- if (!propsSpec || typeof propsSpec !== 'object') return {};
94
- const res: Record<string, any> = {};
95
- for (const key of Object.keys(propsSpec)) {
96
- if (key === '__drift_props__') continue;
97
- const rawVal = propsSpec[key];
98
- res[key] = evaluateExpression(rawVal, scope, declaredVars);
99
- }
100
- return res;
101
- }
package/src/index.ts DELETED
@@ -1,5 +0,0 @@
1
- export * from '../types/index.js';
2
- export * from './constants.js';
3
- export * from './scope.js';
4
- export * from './evaluator.js';
5
- export * from './interpreter.js';
@@ -1,27 +0,0 @@
1
- import { evaluateExpression, executePrecompiledFn } from './evaluator.js';
2
- import { setScopeValue } from './scope.js';
3
-
4
- /**
5
- * Interprets a block of Acorn AST statements (used by <script> AST and functions).
6
- */
7
- export function executeBlockStatement(statements: any, scope: Record<string, any>, declaredVars?: Set<string>): any {
8
- let result: any;
9
- if (!statements) return result;
10
-
11
- if (typeof statements === 'function') {
12
- return statements(scope, declaredVars, setScopeValue);
13
- }
14
-
15
- if (typeof statements === 'object' && statements !== null && '__drift_fn__' in statements) {
16
- return executePrecompiledFn(statements, scope, declaredVars);
17
- }
18
-
19
- if (Array.isArray(statements)) {
20
- for (const stmt of statements) {
21
- result = evaluateExpression(stmt, scope, declaredVars);
22
- }
23
- } else if (statements && typeof statements === 'object') {
24
- result = evaluateExpression(statements, scope, declaredVars);
25
- }
26
- return result;
27
- }
package/src/scope.ts DELETED
@@ -1,75 +0,0 @@
1
- /**
2
- * Sets a variable in scope, updating parent scope if it exists higher in prototype chain.
3
- */
4
- export function setScopeValue(targetScope: Record<string, any>, name: string, val: any): void {
5
- if (!targetScope || typeof targetScope !== 'object') return;
6
-
7
- let curr: any = targetScope;
8
- let setOn: any = null;
9
- const dirtyFns: Set<(name: string) => void> = new Set();
10
-
11
- // 1. Traverse targetScope's prototype chain to find which scope object owns `name`
12
- while (curr && curr !== Object.prototype) {
13
- if (Object.prototype.hasOwnProperty.call(curr, name)) {
14
- curr[name] = val;
15
- setOn = curr;
16
- break;
17
- }
18
- curr = Object.getPrototypeOf(curr);
19
- }
20
-
21
- // 2. If `name` was not found on any prototype in the chain, declare it as an own property on targetScope
22
- if (!setOn) {
23
- targetScope[name] = val;
24
- setOn = targetScope;
25
- }
26
-
27
- // 3. Collect dirty notification functions from targetScope up to setOn
28
- let scan: any = targetScope;
29
- while (scan && scan !== Object.prototype) {
30
- if (typeof scan.__drift_mark_dirty__ === 'function') {
31
- dirtyFns.add(scan.__drift_mark_dirty__);
32
- }
33
- if (scan === setOn) {
34
- break;
35
- }
36
- scan = Object.getPrototypeOf(scan);
37
- }
38
-
39
- // 4. Trigger dirty marking on all affected scope VMs
40
- for (const fn of dirtyFns) {
41
- try {
42
- fn(name);
43
- } catch {
44
- // ignore errors
45
- }
46
- }
47
- }
48
-
49
- /**
50
- * Writes back declared variables from function scope to enclosing target scope.
51
- */
52
- export function syncDeclaredVars(fromScope: Record<string, any>, toScope: Record<string, any>, declaredVars?: Set<string>): void {
53
- if (!declaredVars) return;
54
- for (const name of declaredVars) {
55
- if (Object.prototype.hasOwnProperty.call(fromScope, name)) {
56
- setScopeValue(toScope, name, fromScope[name]);
57
- }
58
- }
59
- }
60
-
61
- /**
62
- * Safely checks if a property exists on scope or any of its parent scopes,
63
- * stopping before Object.prototype to prevent prototype pollution / scope hijacking.
64
- */
65
- export function inScopeChain(scope: any, name: string): boolean {
66
- if (!scope || typeof scope !== 'object') return false;
67
- let curr: any = scope;
68
- while (curr && curr !== Object.prototype) {
69
- if (Object.prototype.hasOwnProperty.call(curr, name)) {
70
- return true;
71
- }
72
- curr = Object.getPrototypeOf(curr);
73
- }
74
- return false;
75
- }
@@ -1,78 +0,0 @@
1
- import { describe, it, expect } from 'vitest';
2
- import {
3
- evaluateExpression,
4
- executeBlockStatement,
5
- setScopeValue,
6
- syncDeclaredVars,
7
- resolveIterable,
8
- MAX_REGISTERS,
9
- } from '../src/index.js';
10
-
11
- describe('driftjs-shared Module', () => {
12
- it('exports MAX_REGISTERS constant equal to 256', () => {
13
- expect(MAX_REGISTERS).toBe(256);
14
- });
15
-
16
- it('evaluates binary, logical, and member expressions', () => {
17
- const scope = { user: { age: 25 }, threshold: 20 };
18
- const expr = {
19
- type: 'BinaryExpression',
20
- operator: '>',
21
- left: {
22
- type: 'MemberExpression',
23
- object: { type: 'Identifier', name: 'user' },
24
- property: { type: 'Identifier', name: 'age' },
25
- },
26
- right: { type: 'Identifier', name: 'threshold' },
27
- };
28
-
29
- expect(evaluateExpression(expr, scope)).toBe(true);
30
- });
31
-
32
- it('sets scope value up the prototype chain', () => {
33
- const parentScope = { count: 0 };
34
- const childScope = Object.create(parentScope);
35
-
36
- setScopeValue(childScope, 'count', 5);
37
- expect(parentScope.count).toBe(5);
38
- });
39
-
40
- it('resolves iterables cleanly', () => {
41
- expect(resolveIterable([1, 2, 3])).toEqual([1, 2, 3]);
42
- expect(resolveIterable(new Set(['a', 'b']))).toEqual(['a', 'b']);
43
- expect(resolveIterable(null)).toEqual([]);
44
- });
45
-
46
- it('executes block statements and updates scope', () => {
47
- const scope = { val: 10 };
48
- const statements = [
49
- {
50
- type: 'ExpressionStatement',
51
- expression: {
52
- type: 'AssignmentExpression',
53
- operator: '=',
54
- left: { type: 'Identifier', name: 'val' },
55
- right: { type: 'Literal', value: 42 },
56
- },
57
- },
58
- ];
59
-
60
- executeBlockStatement(statements, scope);
61
- expect(scope.val).toBe(42);
62
- });
63
-
64
- it('prevents prototype pollution & scope lookup hijacking for built-in Object properties', () => {
65
- const scope = { name: 'Alice' };
66
- const exprToString = { type: 'Identifier', name: 'toString' };
67
- const exprValueOf = { type: 'Identifier', name: 'valueOf' };
68
- const exprConstructor = { type: 'Identifier', name: 'constructor' };
69
-
70
- expect(evaluateExpression(exprToString, scope)).toBeUndefined();
71
- expect(evaluateExpression(exprValueOf, scope)).toBeUndefined();
72
- expect(evaluateExpression(exprConstructor, scope)).toBeUndefined();
73
-
74
- // User-declared toString override should resolve correctly
75
- const customScope = { toString: 'Custom String' };
76
- expect(evaluateExpression(exprToString, customScope)).toBe('Custom String');
77
- });
78
- });
package/types/index.ts DELETED
@@ -1,3 +0,0 @@
1
- export interface BaseVMExecutionOptions {
2
- readonly scope?: Record<string, any>;
3
- }
package/vite.config.ts DELETED
@@ -1,15 +0,0 @@
1
- import { defineConfig } from 'vite';
2
- import path from 'path';
3
-
4
- export default defineConfig({
5
- build: {
6
- lib: {
7
- entry: path.resolve(__dirname, 'src/index.ts'),
8
- name: 'DriftUtils',
9
- fileName: (format) => `index-${format}.js`,
10
- },
11
- rollupOptions: {
12
- external: [],
13
- },
14
- },
15
- });