subscript 10.4.10 → 10.4.12

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/feature/access.js CHANGED
@@ -2,15 +2,17 @@
2
2
  * Property access: a.b, a[b], a(b), [1,2,3] - parse half
3
3
  * For private fields (#x), see class.js
4
4
  */
5
- import { access, binary } from '../parse.js';
5
+ import { access, member } from '../parse.js';
6
6
 
7
- const ACCESS = 170;
7
+ // A call binds looser than member access (`.` `[]`): the JS grammar puts them
8
+ // on separate levels so `new` can sit between — see feature/op/unary.js.
9
+ const ACCESS = 170, CALL = 160;
8
10
 
9
11
  // a[b]
10
12
  access('[]', ACCESS);
11
13
 
12
- // a.b
13
- binary('.', ACCESS);
14
+ // a.b - property name is an IdentifierName (reserved words allowed)
15
+ member('.', ACCESS);
14
16
 
15
17
  // a(b,c,d), a()
16
- access('()', ACCESS);
18
+ access('()', CALL);
package/feature/asi.js CHANGED
@@ -15,6 +15,15 @@ const baseSpace = parse._baseSpace ??= parse.space;
15
15
  const baseStep = parse._baseStep ??= parse.step;
16
16
  const isNode = a => Array.isArray(a) || typeof a === 'string';
17
17
 
18
+ // A node is a *statement* (vs an expression) when its operator sits at
19
+ // statement precedence — `;` and the statement keywords register at or just
20
+ // above prec[';']. A bare `{…}` is a block statement when its body is one.
21
+ // Used to decide ASI before `[`/`(`: a statement can't be indexed or called,
22
+ // so `{a;b}[x]` and `if(c){}\n(x)` split, while `a\n(b)` stays a call.
23
+ const STMT = (prec[';'] ?? 5) + 1;
24
+ const isStmt = n => Array.isArray(n) &&
25
+ (prec[n[0]] <= STMT || (n[0] === '{}' && isStmt(n[1])));
26
+
18
27
  // LF immediately preceding the next non-space at i (used to detect `;\n`).
19
28
  const hasLineBreak = (i, c) => {
20
29
  while ((c = cur.charCodeAt(i)) <= SPACE) {
@@ -59,11 +68,22 @@ parse.enter = () => parse.newline = parse.semi = false;
59
68
  parse.exit = (p, end) => { if (end === BLOCK_END) parse.newline = true, parse.semi = false; };
60
69
 
61
70
  // Wrap iteration step: bail at high prec when `;\n` consumed; fire ASI before
62
- // `[`/`(` on a new line; fire ASI when no operator continues across newline.
71
+ // `[`/`(` that begin a new statement; fire ASI when no operator continues
72
+ // across a newline.
63
73
  parse.step = (a, p, cc, expr) => {
64
74
  if (parse.semi && p >= lvl) return false;
65
75
  if (a && !isNode(a)) return null;
66
- if (isNode(a) && (parse.semi || ((cc === BRACKET || cc === PAREN) && lineBreak()))) return asi(a, p, expr) ?? null;
76
+ if (isNode(a)) {
77
+ // `[` continues an expression as a member index, but on a new line or
78
+ // after a statement it starts one. `(` continues an expression as a call;
79
+ // it only starts a new statement after a statement node, or — at
80
+ // sub-expression precedence — acts as a boundary on a new line (`let a\n(x)`).
81
+ const brk = (cc === BRACKET || cc === PAREN) && lineBreak();
82
+ if (parse.semi ||
83
+ (cc === BRACKET && (brk || isStmt(a))) ||
84
+ (cc === PAREN && (isStmt(a) || (brk && p >= lvl))))
85
+ return asi(a, p, expr) ?? null;
86
+ }
67
87
  const nl = parse.newline;
68
88
  return baseStep(a, p, cc, expr) ?? (isNode(a) && nl ? asi(a, p, expr) ?? null : null);
69
89
  };
@@ -5,7 +5,7 @@
5
5
  * a?.[x] → optional computed access
6
6
  * a?.() → optional call
7
7
  */
8
- import { parse, token, expr, skip } from '../../parse.js';
8
+ import { parse, token, expr, skip, propName } from '../../parse.js';
9
9
 
10
10
  const ACCESS = 170;
11
11
 
@@ -16,7 +16,7 @@ token('?.', ACCESS, (a, b) => {
16
16
  if (cc === 40) { skip(); return ['?.()', a, expr(0, 41) || null]; }
17
17
  // Optional computed: a?.[x]
18
18
  if (cc === 91) { skip(); return ['?.[]', a, expr(0, 93)]; }
19
- // Optional member: a?.b
20
- b = expr(ACCESS);
19
+ // Optional member: a?.b - property name is an IdentifierName
20
+ b = propName(ACCESS);
21
21
  return b ? ['?.', a, b] : void 0;
22
22
  });
@@ -6,14 +6,21 @@
6
6
  * delete x → remove property
7
7
  * new X() → construct instance
8
8
  */
9
- import { unary, keyword, skip, expr, word } from '../../parse.js';
9
+ import { unary, keyword, skip, expr, word, parse } from '../../parse.js';
10
10
 
11
- const PREFIX = 140;
11
+ const PREFIX = 140, CALL = 160, NEW = CALL + 1;
12
12
 
13
13
  unary('typeof', PREFIX);
14
14
  unary('void', PREFIX);
15
15
  unary('delete', PREFIX);
16
- // new X() or new.target
17
- keyword('new', PREFIX, () =>
18
- word('.target') ? (skip(7), ['new.target']) : ['new', expr(PREFIX)]
16
+
17
+ // new X(a).m(b) ((new X(a)).m(b)). `new` binds exactly one call: it sits
18
+ // between member access (`.` `[]`, ACCESS) and the call `()` (CALL), so
19
+ // expr(CALL) reads the constructor reference — name and member chain — but
20
+ // stops before the argument list. We attach one optional `(...)` ourselves;
21
+ // any trailing `.m(b)` then applies to the result via the normal Pratt loop.
22
+ const args = a => parse.space() === 40 ? (skip(), ['()', a, expr(0, 41) || null]) : a;
23
+
24
+ keyword('new', NEW, () =>
25
+ word('.target') ? (skip(7), ['new.target']) : ['new', args(expr(CALL))]
19
26
  );
package/feature/prop.js CHANGED
@@ -2,15 +2,15 @@
2
2
  * Minimal property access: a.b, a[b], f() - parse half
3
3
  * For array literals, private fields, see member.js
4
4
  */
5
- import { access, binary, group } from '../parse.js';
5
+ import { access, member, group } from '../parse.js';
6
6
 
7
7
  const ACCESS = 170;
8
8
 
9
9
  // a[b] - computed member access only (no array literal support)
10
10
  access('[]', ACCESS);
11
11
 
12
- // a.b - dot member access
13
- binary('.', ACCESS);
12
+ // a.b - dot member access; property name is an IdentifierName
13
+ member('.', ACCESS);
14
14
 
15
15
  // (a) - grouping only (no sequences)
16
16
  group('()', ACCESS);
package/feature/regex.js CHANGED
@@ -11,13 +11,20 @@
11
11
  */
12
12
  import { token, skip, err, next, idx, cur } from '../parse.js';
13
13
 
14
- const SLASH = 47, BSLASH = 92;
14
+ const SLASH = 47, BSLASH = 92, LBRACK = 91, RBRACK = 93;
15
15
 
16
16
  token('/', 140, a => {
17
- // left operand = division; `//` `/*` `/?` `/+` `/=` = not a regex start
17
+ // left operand = division or assignment; `//` `/*` `/?` `/+` = not a regex start
18
18
  const c = cur.charCodeAt(idx);
19
- if (a || c === SLASH || c === 42 || c === 43 || c === 63 || c === 61) return;
20
- const pattern = next(c => c === BSLASH ? 2 : c && c !== SLASH); // \x = 2 chars, else 1 until /
19
+ if (a || c === SLASH || c === 42 || c === 43 || c === 63) return;
20
+ // \x = 2 chars; `/` inside a [...] class is literal (classes don't nest), else `/` ends pattern
21
+ let cls = false;
22
+ const pattern = next(c =>
23
+ c === BSLASH ? 2 :
24
+ c === LBRACK ? (cls = true, 1) :
25
+ c === RBRACK ? (cls = false, 1) :
26
+ c && (cls || c !== SLASH)
27
+ );
21
28
  cur.charCodeAt(idx) === SLASH || err('Unterminated regex');
22
29
  skip();
23
30
  const flags = next(c => c === 103 || c === 105 || c === 109 || c === 115 || c === 117 || c === 121); // gimsuy
package/feature/seq.js CHANGED
@@ -8,5 +8,5 @@ import { nary } from '../parse.js';
8
8
  const STATEMENT = 5, SEQ = 10;
9
9
 
10
10
  // Sequences
11
- nary(',', SEQ);
12
- nary(';', STATEMENT, true); // right-assoc to allow same-prec statements
11
+ nary(',', SEQ); // list separator: trailing comma drops the slot
12
+ nary(';', STATEMENT, true, true); // statement separator: right-assoc, every slot kept
@@ -1,13 +1,25 @@
1
- // Additional JS statements: debugger, with (parse-only)
2
- // debugger → ['debugger']
3
- // with (obj) body → ['with', obj, body]
4
- import { parse, keyword, parens } from '../parse.js';
1
+ // Additional JS statements: debugger, with, labeled statements (parse-only)
2
+ // debugger → ['debugger']
3
+ // with (obj) body → ['with', obj, body]
4
+ // label: while (…) … → [':', label, ['while', …]]
5
+ import { parse, keyword, token, parens, expr, word } from '../parse.js';
5
6
  import { body } from './if.js';
6
7
 
7
- const STATEMENT = 5;
8
+ const STATEMENT = 5, ASSIGN = 20;
8
9
 
9
10
  // debugger statement
10
11
  keyword('debugger', STATEMENT + 1, () => ['debugger']);
11
12
 
12
13
  // with statement
13
14
  keyword('with', STATEMENT + 1, () => (parse.space(), ['with', parens(), body()]));
15
+
16
+ // Labeled statement: `label: while (…) …`. A control keyword outranks the
17
+ // object-property `:`, so the default `:` would parse its right side too low
18
+ // to reach the keyword — reading `while` as a plain identifier (method
19
+ // shorthand `while(){}`). Register `:` at the property `:` precedence: when an
20
+ // identifier is followed by `: <control-keyword>`, parse the right side at
21
+ // statement precedence; otherwise decline and let the property `:` handle it.
22
+ const control = ['if', 'for', 'while', 'do', 'switch', 'try'];
23
+ token(':', ASSIGN - 1, a =>
24
+ typeof a === 'string' && (parse.space(), control.some(w => word(w))) && [':', a, expr(STATEMENT)]
25
+ );
@@ -8,15 +8,18 @@ import { parse, skip, err, expr, lookup, cur, idx } from '../parse.js';
8
8
  const ACCESS = 170, BACKTICK = 96, DOLLAR = 36, OBRACE = 123, BSLASH = 92;
9
9
  const esc = { n: '\n', r: '\r', t: '\t', b: '\b', f: '\f', v: '\v' };
10
10
 
11
- // Parse template body after opening `
11
+ // Parse template body after opening ` — string and expression segments
12
+ // strictly alternate (string, expr, string, …), so every interpolation is
13
+ // flanked by a string part even when empty: `${x}${y}` → [,''] x [,''] y [,''].
12
14
  const parseBody = () => {
13
15
  const parts = [];
14
- for (let s = '', c; (c = cur.charCodeAt(idx)) !== BACKTICK; )
16
+ let s = '', c;
17
+ for (; (c = cur.charCodeAt(idx)) !== BACKTICK; )
15
18
  !c ? err('Unterminated template') :
16
19
  c === BSLASH ? (skip(), s += esc[cur[idx]] || cur[idx], skip()) :
17
- c === DOLLAR && cur.charCodeAt(idx + 1) === OBRACE ? (s && parts.push([, s]), s = '', skip(2), parts.push(expr(0, 125))) :
18
- (s += cur[idx], skip(), c = cur.charCodeAt(idx), c === BACKTICK && s && parts.push([, s]));
19
- return skip(), parts;
20
+ c === DOLLAR && cur.charCodeAt(idx + 1) === OBRACE ? (parts.push([, s]), s = '', skip(2), parts.push(expr(0, 125))) :
21
+ (s += cur[idx], skip());
22
+ return parts.push([, s]), skip(), parts;
20
23
  };
21
24
 
22
25
  // Collapse a single-part body to that part (string or expression); else keep as ['`', ...parts]
package/jessie.min.js CHANGED
@@ -1,9 +1,9 @@
1
- var l,c,s=r=>(l=0,c=r,s.enter?.(),r=h(),c[l]?N():r||""),N=(r="Unexpected token",e=l,t=c.slice(0,e).split(`
2
- `),o=t.pop(),n=c.slice(Math.max(0,e-40),e),p="\u032D",m=(c[e]||" ")+p,u=c.slice(e+1,e+20))=>{throw SyntaxError(`${r} at ${t.length+1}:${o.length+1}
1
+ var u,c,s=r=>(u=0,c=r,s.enter?.(),r=d(),c[u]?N():r||""),N=(r="Unexpected token",e=u,t=c.slice(0,e).split(`
2
+ `),o=t.pop(),n=c.slice(Math.max(0,e-40),e),p="\u032D",m=(c[e]||" ")+p,l=c.slice(e+1,e+20))=>{throw SyntaxError(`${r} at ${t.length+1}:${o.length+1}
3
3
  ${c[e-41]!==`
4
- `,""+n}${m}${u}`)},Br=(r,e=l)=>(Array.isArray(r)&&(r.loc=e),r),I=(r,e=l,t)=>{for(;t=r(c.charCodeAt(l));)l+=t;return c.slice(e,l)},d=(r=1)=>c[l+=r],O=r=>l=r,h=(r=0,e)=>{let t,o,n;for(e&&s.enter?.(r,e);(t=s.space())&&t!==e&&(n=s.step(o,r,t,h));)o=n;return e&&(t==e?(l++,s.exit?.(r,e)):N("Unclosed "+String.fromCharCode(e-(e>42?2:1)))),o},Y=(r=l)=>{for(;c.charCodeAt(r)<=32;)r++;return c.charCodeAt(r)},Vt=s.id=r=>r>=48&&r<=57||r>=65&&r<=90||r>=97&&r<=122||r==36||r==95||r>=192&&r!=215&&r!=247,k=(r,e=r.length)=>c.substr(l,e)===r&&!s.id(c.charCodeAt(l+e)),P=()=>(d(),h(0,41)),T=[],$={},S=(r,e=32,t,o=r.charCodeAt(0),n=r.length,p=T[o],m=r.toUpperCase()!==r,u,a)=>(e=$[r]=!p&&$[r]||e,T[o]=(y,g,E,w=l)=>(u=E,(E?r==E:(n<2||r.charCodeAt(1)===c.charCodeAt(l+1)&&(n<3||c.substr(l,n)==r))&&(!m||!s.id(c.charCodeAt(l+n)))&&(u=E=r))&&g<e&&(l+=n,(a=t(y))?Br(a,w):(l=w,u=0,!m&&!p&&!y&&N()),a)||p?.(y,g,u))),A=(r,e,t=!1)=>S(r,e,o=>o&&(n=>n&&[r,o,n])(h(e-(t?.5:0)))),_=(r,e,t)=>S(r,e,o=>t?o&&[r,o]:!o&&(o=h(e-.5))&&[r,o]),H=(r,e)=>S(r,200,t=>!t&&[,e]),fr=(r,e,t)=>S(r,e,(o,n)=>(n=h(e-(t?.5:0)),o?.[0]!==r&&(o=[r,o||null]),n?.[0]===r?o.push(...n.slice(1)):o.push(n||null),o)),j=(r,e)=>S(r[0],e,t=>!t&&[r,h(0,r.charCodeAt(1))||null]),ur=(r,e)=>S(r[0],e,t=>t&&[r,t,h(0,r.charCodeAt(1))||null]),C=(r,e,t,o=r.charCodeAt(0),n=r.length,p=T[o],m)=>T[o]=(u,a,y,g=l)=>!u&&(y?r==y:(n<2||c.substr(l,n)==r)&&(y=r))&&a<e&&!s.id(c.charCodeAt(l+n))&&(!s.prop||s.prop(l+n))&&(O(l+n),(m=t())?Br(m,g):O(g),m)||p?.(u,a,y);s.space=r=>{for(;(r=c.charCodeAt(l))<=32;)l++;return r};s.step=(r,e,t,o,n)=>(n=T[t])&&n(r,e)||(r?null:I(s.id)||null);var pr={},f=(r,e,t=pr[r])=>pr[r]=(...o)=>e(...o)||t?.(...o),i=r=>Array.isArray(r)?r[0]==null?(e=>()=>e)(r[1]):pr[r[0]]?.(...r.slice(1))??N(`Unknown operator: ${r[0]}`,r?.loc):r===void 0?()=>{}:e=>e?.[r];var q=46,W=48,x=57,ye=69,Ce=101,we=43,ge=45,Z=95,Lr=110,Ee=97,Se=102,ke=65,Te=70,Mr=r=>r.indexOf("_")<0?r:r.replaceAll("_",""),lr=r=>{let e=Mr(I(t=>t===q&&c.charCodeAt(l+1)!==q||t>=W&&t<=x||t===Z||((t===ye||t===Ce)&&((t=c.charCodeAt(l+1))>=W&&t<=x||t===we||t===ge)?2:0)));return c.charCodeAt(l)===Lr?(d(),[,BigInt(e)]):(r=+e)!=r?N():[,r]},Ie={2:r=>r===48||r===49||r===Z,8:r=>r>=48&&r<=55||r===Z,16:r=>r>=W&&r<=x||r>=Ee&&r<=Se||r>=ke&&r<=Te||r===Z};s.number=null;T[q]=r=>!r&&c.charCodeAt(l+1)!==q&&lr();for(let r=W;r<=x;r++)T[r]=e=>e?void 0:lr();T[W]=r=>{if(r)return;let e=s.number;if(e){for(let[t,o]of Object.entries(e))if(t[0]==="0"&&c[l+1]?.toLowerCase()===t[1]){d(2);let n=Mr(I(Ie[o]));return c.charCodeAt(l)===Lr?(d(),[,BigInt("0"+t[1]+n)]):[,parseInt(n,o)]}}return lr()};var Ne=92,Ur=34,Dr=39,Fr=117,Gr=120,Re=123,_e=125,Xr=10,Oe=13,Pe={n:`
5
- `,r:"\r",t:" ",b:"\b",f:"\f",v:"\v",0:"\0"},Kr=r=>r>=48&&r<=57?r-48:r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:-1,Hr=r=>(e,t,o="",n=String.fromCharCode(r))=>{if(e||!s.string?.[n])return;d();let p=()=>{let m=c.charCodeAt(l+1);if(m===Xr)return 2;if(m===Oe)return c.charCodeAt(l+2)===Xr?3:2;if(m===Gr||m===Fr&&c.charCodeAt(l+2)!==Re){let u=m===Gr?2:4,a=0,y;for(let g=0;g<u;g++){if((y=Kr(c.charCodeAt(l+2+g)))<0)return o+=c[l+1],2;a=a*16+y}return o+=String.fromCharCode(a),2+u}if(m===Fr){let u=0,a=l+3,y;for(;(y=Kr(c.charCodeAt(a)))>=0;)u=u*16+y,a++;return a>l+3&&u<=1114111&&c.charCodeAt(a)===_e?(o+=String.fromCodePoint(u),a-l+1):(o+=c[l+1],2)}return o+=Pe[c[l+1]]||c[l+1],2};return I(m=>m-r&&(m!==Ne?(o+=c[l],1):p())),c[l]===n?d():N("Bad string"),[,o]};T[Ur]=Hr(Ur);T[Dr]=Hr(Dr);s.string={'"':!0};var ve=20;"= += -= *= /= %= |= &= ^= >>= <<=".split(" ").map(r=>A(r,ve,!0));var Be=30,Le=40,Me=140;_("!",Me);A("||",Be);A("&&",Le);var Ue=50,De=60,Fe=70,Qr=100,Ge=140;A("|",Ue);A("&",Fe);A("^",De);A(">>",Qr);A("<<",Qr);_("~",Ge);var b=90;A("<",b);A(">",b);A("<=",b);A(">=",b);var $r=80;A("==",$r);A("!=",$r);var jr=110,mr=120,Wr=140;A("+",jr);A("-",jr);A("*",mr);A("/",mr);A("%",mr);_("+",Wr);_("-",Wr);var rr=150;S("++",rr,r=>r?["++",r,null]:["++",h(rr-1)]);S("--",rr,r=>r?["--",r,null]:["--",h(rr-1)]);var Xe=5,Ke=10;fr(",",Ke);fr(";",Xe,!0);var He=170;j("()",He);var cr=170;ur("[]",cr);A(".",cr);ur("()",cr);var Qe=32,$e=s.space;s.comment??={"//":`
6
- `,"/*":"*/"};var ar;s.space=()=>{ar||(ar=Object.entries(s.comment).map(([n,p])=>[n,p,n.charCodeAt(0)]));for(var r;r=$e();){for(var e=0,t;t=ar[e++];)if(r===t[2]&&c.substr(l,t[0].length)===t[0]){var o=l+t[0].length;if(t[1]===`
7
- `)for(;c.charCodeAt(o)>=Qe;)o++;else{for(;c[o]&&c.substr(o,t[1].length)!==t[1];)o++;c[o]&&(o+=t[1].length)}O(o),r=0;break}if(r)return r}return r};var zr=80;A("===",zr);A("!==",zr);var je=30;A("??",je);var We=130,ze=20;A("**",We,!0);A("**=",ze,!0);var Jr=90;A("in",Jr);A("of",Jr);var Je=20,Ve=100;A(">>>",Ve);A(">>>=",Je,!0);var dr=20;A("||=",dr,!0);A("&&=",dr,!0);A("??=",dr,!0);H("true",!0);H("false",!1);H("null",null);C("undefined",200,()=>[]);H("NaN",NaN);H("Infinity",1/0);var hr=20;S("?",hr,(r,e,t)=>r&&(e=h(hr-1))&&I(o=>o===58)&&(t=h(hr-1),["?",r,e,t]));var Ye=20;A("=>",Ye,!0);var Ze=20;_("...",Ze);var Vr=170;S("?.",Vr,(r,e)=>{if(!r)return;let t=s.space();return t===40?(d(),["?.()",r,h(0,41)||null]):t===91?(d(),["?.[]",r,h(0,93)]):(e=h(Vr),e?["?.",r,e]:void 0)});var z=140;_("typeof",z);_("void",z);_("delete",z);C("new",z,()=>k(".target")?(d(7),["new.target"]):["new",h(z)]);var qe=20,Yr=200;s.prop=r=>Y(r)!==58;j("[]",Yr);j("{}",Yr);A(":",qe-1,!0);var xe=170,er=96,be=36,rt=123,et=92,tt={n:`
8
- `,r:"\r",t:" ",b:"\b",f:"\f",v:"\v"},Zr=()=>{let r=[];for(let e="",t;(t=c.charCodeAt(l))!==er;)t?t===et?(d(),e+=tt[c[l]]||c[l],d()):t===be&&c.charCodeAt(l+1)===rt?(e&&r.push([,e]),e="",d(2),r.push(h(0,125))):(e+=c[l],d(),t=c.charCodeAt(l),t===er&&e&&r.push([,e])):N("Unterminated template");return d(),r},ot=r=>r.length<2&&r[0]?.[0]===void 0?r[0]||[,""]:["`",...r],nt=T[er];T[er]=(r,e)=>r&&e<xe?s.asi&&s.newline?void 0:(d(),["``",r,...Zr()]):r?nt?.(r,e):(d(),ot(Zr()));s.string["'"]=!0;s.number={"0x":16,"0b":2,"0o":8};var it=92,st=117,pt=123,ft=125,ut=183,lt=s.id,qr=r=>r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102,mt=(r=l+2,e,t=0,o=0)=>{if(c.charCodeAt(l)!==it||c.charCodeAt(l+1)!==st)return 0;if(c.charCodeAt(r)===pt){for(;qr(e=c.charCodeAt(++r));)t=t*16+(e<=57?e-48:(e&31)+9);return r>l+3&&t<=1114111&&c.charCodeAt(r)===ft?r-l+1:0}for(;o<4&&qr(c.charCodeAt(r+o));)o++;return o===4?6:0};s.id=r=>lt(r)||r===ut||mt();var Ar=5,ct=10,yr=r=>{let e=l,t=h(ct-1);return t==null?r:r==="let"&&(t==="in"||t==="of")?(O(e),r):t[0]==="in"||t[0]==="of"?[t[0],[r,t[1]],t[2]]:t[0]===","?[r,...t.slice(1)]:[r,t]};C("let",Ar+1,()=>yr("let"));C("const",Ar+1,()=>yr("const"));C("var",Ar+1,()=>yr("var"));var tr=5,at=59,B=()=>(s.space()===123||N("Expected {"),d(),h(tr-.5,125)||null),U=()=>s.space()!==123?h(tr+.5):(d(),h(tr-.5,125)||null),dt=()=>{let r=l;return s.space()===at&&d(),s.space(),k("else")?(d(4),s.semi=!1,!0):(O(r),!1)};C("if",tr+1,()=>{s.space();let r=["if",P(),U()];return dt()&&r.push(U()),r});var ht=200;C("function",ht,()=>{s.space();let r=!1;c[l]==="*"&&(r=!0,d(),s.space());let e=I(s.id);return e&&s.space(),r?["function*",e,P()||null,B()]:["function",e,P()||null,B()]});var or=140,Cr=20;_("await",or);C("yield",or,()=>(s.space(),c[l]==="*"?(d(),s.space(),["yield*",h(Cr)]):["yield",h(Cr)]));C("async",or,()=>{if(s.space(),k("function"))return["async",h(or)];let r=h(Cr-.5);return r&&["async",r]});var wr=200;var At=90,yt=175;_("static",yt);A("instanceof",At);S("#",wr,r=>{if(r)return;let e=I(s.id);return e?"#"+e:void 0});C("class",wr,()=>{s.space();let r=I(s.id)||null;if(r==="extends")r=null,s.space();else{if(s.space(),!k("extends"))return["class",r,null,B()];d(7),s.space()}return["class",r,h(wr),B()]});var gr=47,Ct=92;S("/",140,r=>{let e=c.charCodeAt(l);if(r||e===gr||e===42||e===43||e===63||e===61)return;let t=I(n=>n===Ct?2:n&&n!==gr);c.charCodeAt(l)===gr||N("Unterminated regex"),d();let o=I(n=>n===103||n===105||n===109||n===115||n===117||n===121);return o?["//",t,o]:["//",t]});var K=5,J=125,V=59;C("while",K+1,()=>(s.space(),["while",P(),U()]));C("do",K+1,()=>(r=>(s.space(),d(5),s.space(),["do",r,P()]))(U()));C("for",K+1,()=>(s.space(),k("await")?(d(5),s.space(),["for await",P(),U()]):["for",P(),U()]));C("break",K+1,()=>{s.asi&&(s.newline=!1);let r=l;s.space();let e=c.charCodeAt(l);if(!e||e===J||e===V||s.newline)return["break"];let t=I(s.id);if(!t)return["break"];s.space();let o=c.charCodeAt(l);return!o||o===J||o===V||s.newline?["break",t]:(O(r),["break"])});C("continue",K+1,()=>{s.asi&&(s.newline=!1);let r=l;s.space();let e=c.charCodeAt(l);if(!e||e===J||e===V||s.newline)return["continue"];let t=I(s.id);if(!t)return["continue"];s.space();let o=c.charCodeAt(l);return!o||o===J||o===V||s.newline?["continue",t]:(O(r),["continue"])});C("return",K+1,()=>{s.asi&&(s.newline=!1);let r=s.space();return!r||r===J||r===V||s.newline?["return"]:["return",h(K)]});var Er=5;C("try",Er+1,()=>{let r=["try",B()];return s.space(),k("catch")&&(d(5),s.space(),r.push(["catch",Y()===40?P():null,B()])),s.space(),k("finally")&&(d(7),r.push(["finally",B()])),r});C("throw",Er+1,()=>{if(s.asi&&(s.newline=!1),s.space(),s.newline)throw SyntaxError("Unexpected newline after throw");return["throw",h(Er)]});var re=5,wt=20,xr=58,gt=59,ee=125,Sr=0,te=(r,e=r.length,t=r.charCodeAt(0),o=T[t])=>T[t]=(n,p,m)=>k(r)&&!n&&Sr||o?.(n,p,m);te("case");te("default");var br=r=>{let e=[];for(;(r=s.space())!==ee&&!k("case")&&!k("default");){if(r===gt){d();continue}e.push(h(re-.5))||N()}return e.length>1?[";",...e]:e[0]||null},Et=()=>{s.space()===123||N("Expected {"),d(),Sr++;let r=[];try{for(;s.space()!==ee;)if(k("case")){O(l+4),s.space();let e=h(wt-.5);s.space()===xr&&d(),r.push(["case",e,br()])}else k("default")?(O(l+7),s.space()===xr&&d(),r.push(["default",br()])):N("Expected case or default")}finally{Sr--}return d(),r};C("switch",re+1,()=>s.space()===40&&["switch",P(),...Et()]);var oe=5;C("debugger",oe+1,()=>["debugger"]);C("with",oe+1,()=>(s.space(),["with",P(),U()]));var kr=5,Q=10,ne=42,St=T[ne];T[ne]=(r,e)=>r?St?.(r,e):(d(),"*");S("from",Q+1,r=>r?r[0]!=="="&&r[0]!==","&&(s.space(),["from",r,h(Q+1)]):!1);S("as",Q+2,r=>r?(s.space(),["as",r,h(Q+2)]):!1);C("import",kr,()=>k(".meta")?(d(5),["import.meta"]):["import",h(Q)]);C("export",kr,()=>(s.space(),k("default")?(d(7),["export",["default",h(Q)]]):["export",h(kr)]));var Tr=20,kt=10,Tt=13,It=40,ie=41,se=123,pe=125,Nt=(r,e)=>{for(;r<e;){let t=c.charCodeAt(r++);if(t===kt||t===Tt)return!0}return!1},fe=r=>e=>{if(e)return;let t=l;if(s.space(),s.semi||Nt(t,l))return!1;let o=I(s.id);if(!o||(s.space(),c.charCodeAt(l)!==It))return!1;d();let n=h(0,ie);return s.space(),c.charCodeAt(l)!==se?!1:(d(),[r,o,n,h(0,pe)])};S("get",Tr-1,fe("get"));S("set",Tr-1,fe("set"));S("(",Tr-1,r=>{if(!r)return;let e;if(Array.isArray(r)&&r[0]==="static"&&(e="static",r=r[1]),typeof r!="string"&&!(Array.isArray(r)&&r[0]===void 0))return;let t=h(0,ie)||null;if(s.space(),c.charCodeAt(l)!==se)return;d();let o=[":",r,["=>",["()",t],h(0,pe)||null]];return e?[e,o]:o});s.comment["#!"]=`
9
- `;var le=32,_r=10,Rt=59,_t=125,Ot=91,Pt=40,Rr=$.asi??$[";"],vt=s._baseSpace??=s.space,Bt=s._baseStep??=s.step,Ir=r=>Array.isArray(r)||typeof r=="string",Lt=(r,e)=>{for(;(e=c.charCodeAt(r))<=le;){if(e===_r)return!0;r++}return!1},Mt=(r=l,e)=>{for(;r-- >0&&(e=c.charCodeAt(r))<=le;)if(e===_r)return!0;return!1};s.space=(r,e)=>{for(;;){for(e=l,r=vt();e<l;)if(c.charCodeAt(e++)===_r){s.newline=!0;break}if(r===Rt&&Lt(l+1)){O(l+1),s.newline=s.semi=!0;continue}return r}};s.enter=()=>s.newline=s.semi=!1;s.exit=(r,e)=>{e===_t&&(s.newline=!0,s.semi=!1)};s.step=(r,e,t,o)=>{if(s.semi&&e>=Rr)return!1;if(r&&!Ir(r))return null;if(Ir(r)&&(s.semi||(t===Ot||t===Pt)&&Mt()))return ue(r,e,o)??null;let n=s.newline;return Bt(r,e,t,o)??(Ir(r)&&n?ue(r,e,o)??null:null)};var Nr=0,Ut=2e3,ue=s.asi=(r,e,t,o,n)=>{if(e>=Rr||Nr>=Ut)return;s.semi=!1;let p=l;Nr++;try{o=t(Rr-.5)}finally{Nr--}if(!(!o||l===p))return n=o?.[0]===";"?o.slice(1):[o],r?.[0]===";"?(r.push(...n),r):[";",r,...n]};var ce=(r,e,t,o)=>typeof r=="string"?n=>e(n,r,n):r[0]==="."?(t=i(r[1]),o=r[2],n=>e(t(n),o,n)):r[0]==="[]"&&r.length===3?(t=i(r[1]),o=i(r[2]),n=>e(t(n),o(n),n)):r[0]==="()"&&r.length===2?ce(r[1],e):(()=>{throw Error("Invalid assignment target")})(),me={"=":(r,e,t)=>r[e]=t,"+=":(r,e,t)=>r[e]+=t,"-=":(r,e,t)=>r[e]-=t,"*=":(r,e,t)=>r[e]*=t,"/=":(r,e,t)=>r[e]/=t,"%=":(r,e,t)=>r[e]%=t,"|=":(r,e,t)=>r[e]|=t,"&=":(r,e,t)=>r[e]&=t,"^=":(r,e,t)=>r[e]^=t,">>=":(r,e,t)=>r[e]>>=t,"<<=":(r,e,t)=>r[e]<<=t};for(let r in me)f(r,(e,t)=>(t=i(t),ce(e,(o,n,p)=>me[r](o,n,t(p)))));f("!",r=>(r=i(r),e=>!r(e)));f("||",(r,e)=>(r=i(r),e=i(e),t=>r(t)||e(t)));f("&&",(r,e)=>(r=i(r),e=i(e),t=>r(t)&&e(t)));f("~",r=>(r=i(r),e=>~r(e)));f("|",(r,e)=>(r=i(r),e=i(e),t=>r(t)|e(t)));f("&",(r,e)=>(r=i(r),e=i(e),t=>r(t)&e(t)));f("^",(r,e)=>(r=i(r),e=i(e),t=>r(t)^e(t)));f(">>",(r,e)=>(r=i(r),e=i(e),t=>r(t)>>e(t)));f("<<",(r,e)=>(r=i(r),e=i(e),t=>r(t)<<e(t)));f(">",(r,e)=>(r=i(r),e=i(e),t=>r(t)>e(t)));f("<",(r,e)=>(r=i(r),e=i(e),t=>r(t)<e(t)));f(">=",(r,e)=>(r=i(r),e=i(e),t=>r(t)>=e(t)));f("<=",(r,e)=>(r=i(r),e=i(e),t=>r(t)<=e(t)));f("==",(r,e)=>(r=i(r),e=i(e),t=>r(t)==e(t)));f("!=",(r,e)=>(r=i(r),e=i(e),t=>r(t)!=e(t)));f("+",(r,e)=>e!==void 0?(r=i(r),e=i(e),t=>r(t)+e(t)):(r=i(r),t=>+r(t)));f("-",(r,e)=>e!==void 0?(r=i(r),e=i(e),t=>r(t)-e(t)):(r=i(r),t=>-r(t)));f("*",(r,e)=>(r=i(r),e=i(e),t=>r(t)*e(t)));f("/",(r,e)=>(r=i(r),e=i(e),t=>r(t)/e(t)));f("%",(r,e)=>(r=i(r),e=i(e),t=>r(t)%e(t)));var Or=(r,e,t,o)=>typeof r=="string"?n=>e(n,r):r[0]==="."?(t=i(r[1]),o=r[2],n=>e(t(n),o)):r[0]==="[]"&&r.length===3?(t=i(r[1]),o=i(r[2]),n=>e(t(n),o(n))):r[0]==="()"&&r.length===2?Or(r[1],e):(()=>{throw Error("Invalid increment target")})();f("++",(r,e)=>Or(r,e===null?(t,o)=>t[o]++:(t,o)=>++t[o]));f("--",(r,e)=>Or(r,e===null?(t,o)=>t[o]--:(t,o)=>--t[o]));var ae=(...r)=>(r=r.map(i),e=>{let t;for(let o of r)t=o(e);return t});f(",",ae);f(";",ae);var D=r=>r?.[0]==="_"&&r[1]==="_"||r==="constructor"||r==="prototype",nr=r=>{throw Error(r)};f("[]",(r,e)=>e===void 0?(r=r?r[0]===","?r.slice(1):[r]:[],r=r.map(t=>t==null?(()=>{}):t[0]==="..."?(t=i(t[1]),o=>t(o)):(t=i(t),o=>[t(o)])),t=>r.flatMap(o=>o(t))):(e==null&&nr("Missing index"),r=i(r),e=i(e),t=>{let o=e(t);return D(o)?void 0:r(t)[o]}));f(".",(r,e)=>(r=i(r),e=e[0]?e:e[1],D(e)?()=>{}:t=>r(t)[e]));f("()",(r,e)=>{if(e===void 0)return r==null?nr("Empty ()"):i(r);let t=n=>n?.[0]===","&&n.slice(1).some(p=>p==null||t(p));t(e)&&nr("Empty argument");let o=e?e[0]===","?(e=e.slice(1).map(i),n=>e.map(p=>p(n))):(e=i(e),n=>[e(n)]):()=>[];return Pr(r,(n,p,m)=>n[p](...o(m)))});var L=r=>typeof r=="string"||Array.isArray(r)&&(r[0]==="."||r[0]==="?."||r[0]==="[]"&&r.length===3||r[0]==="?.[]"||r[0]==="()"&&r.length===2&&L(r[1])||r[0]==="{}"),Pr=(r,e,t,o)=>r==null?nr("Empty ()"):r[0]==="()"&&r.length==2?Pr(r[1],e):typeof r=="string"?n=>e(n,r,n):r[0]==="."?(t=i(r[1]),o=r[2],n=>e(t(n),o,n)):r[0]==="?."?(t=i(r[1]),o=r[2],n=>{let p=t(n);return p==null?void 0:e(p,o,n)}):r[0]==="[]"&&r.length===3?(t=i(r[1]),o=i(r[2]),n=>e(t(n),o(n),n)):r[0]==="?.[]"?(t=i(r[1]),o=i(r[2]),n=>{let p=t(n);return p==null?void 0:e(p,o(n),n)}):(r=i(r),n=>e([r(n)],0,n)),F=Pr;f("===",(r,e)=>(r=i(r),e=i(e),t=>r(t)===e(t)));f("!==",(r,e)=>(r=i(r),e=i(e),t=>r(t)!==e(t)));f("??",(r,e)=>(r=i(r),e=i(e),t=>r(t)??e(t)));var Dt=r=>{throw Error(r)};f("**",(r,e)=>(r=i(r),e=i(e),t=>r(t)**e(t)));f("**=",(r,e)=>(L(r)||Dt("Invalid assignment target"),e=i(e),F(r,(t,o,n)=>t[o]**=e(n))));f("in",(r,e)=>(r=i(r),e=i(e),t=>r(t)in e(t)));var Ft=r=>{throw Error(r)};f(">>>",(r,e)=>(r=i(r),e=i(e),t=>r(t)>>>e(t)));f(">>>=",(r,e)=>(L(r)||Ft("Invalid assignment target"),e=i(e),F(r,(t,o,n)=>t[o]>>>=e(n))));var Gt=r=>r[0]?.[0]===","?r[0].slice(1):r,G=(r,e,t)=>{if(typeof r=="string"){t[r]=e;return}let[o,...n]=r,p=Gt(n);if(o==="{}"){let m=[];for(let u of p){if(Array.isArray(u)&&u[0]==="..."){let w={};for(let R in e)m.includes(R)||(w[R]=e[R]);t[u[1]]=w;break}let a,y,g;typeof u=="string"?a=y=u:u[0]==="="?(typeof u[1]=="string"?a=y=u[1]:[,a,y]=u[1],g=u[2]):[,a,y]=u,m.push(a);let E=e[a];E===void 0&&g&&(E=i(g)(t)),G(y,E,t)}}else if(o==="[]"){let m=0;for(let u of p){if(u===null){m++;continue}if(Array.isArray(u)&&u[0]==="..."){t[u[1]]=e.slice(m);break}let a=u,y;Array.isArray(u)&&u[0]==="="&&([,a,y]=u);let g=e[m++];g===void 0&&y&&(g=i(y)(t)),G(a,g,t)}}},vr=(...r)=>(r=r.map(e=>{if(typeof e=="string")return t=>{t[e]=void 0};if(e[0]==="="){let[,t,o]=e,n=i(o);return typeof t=="string"?p=>{p[t]=n(p)}:p=>G(t,n(p),p)}return i(e)}),e=>{for(let t of r)t(e)});f("let",vr);f("const",vr);f("var",vr);var ir=r=>{throw Error(r)};f("=",(r,e)=>{if(Array.isArray(r)&&(r[0]==="let"||r[0]==="const"||r[0]==="var")){let t=r[1];return e=i(e),typeof t=="string"?o=>{o[t]=e(o)}:o=>G(t,e(o),o)}return L(r)||ir("Invalid assignment target"),e=i(e),F(r,(t,o,n)=>t[o]=e(n))});f("||=",(r,e)=>(L(r)||ir("Invalid assignment target"),e=i(e),F(r,(t,o,n)=>t[o]||=e(n))));f("&&=",(r,e)=>(L(r)||ir("Invalid assignment target"),e=i(e),F(r,(t,o,n)=>t[o]&&=e(n))));f("??=",(r,e)=>(L(r)||ir("Invalid assignment target"),e=i(e),F(r,(t,o,n)=>t[o]??=e(n))));f("?",(r,e,t)=>(r=i(r),e=i(e),t=i(t),o=>r(o)?e(o):t(o)));var v=[];f("=>",(r,e)=>{r=r?.[0]==="()"?r[1]:r;let t=r?r[0]===","?r.slice(1):[r]:[],o=-1,n=null,p=t[t.length-1];Array.isArray(p)&&p[0]==="..."&&(o=t.length-1,n=p[1],t.length--);let m=e?.[0]==="{}";return e=i(m?["{",e[1]]:e),u=>(...a)=>{let y={};t.forEach((E,w)=>y[E]=a[w]),n&&(y[n]=a.slice(o));let g=new Proxy(y,{get:(E,w)=>w in E?E[w]:u?.[w],set:(E,w,R)=>((w in E?E:u)[w]=R,!0),has:(E,w)=>w in E||(u?w in u:!1)});try{let E=e(g);return m?void 0:E}catch(E){if(E===v)return E[0];throw E}}});f("...",r=>(r=i(r),e=>Object.entries(r(e))));f("?.",(r,e)=>(r=i(r),D(e)?()=>{}:t=>r(t)?.[e]));f("?.[]",(r,e)=>(r=i(r),e=i(e),t=>{let o=e(t);return D(o)?void 0:r(t)?.[o]}));f("?.()",(r,e)=>{let t=e?e[0]===","?(e=e.slice(1).map(i),n=>e.map(p=>p(n))):(e=i(e),n=>[e(n)]):()=>[];if(r[0]==="?."){let n=i(r[1]),p=r[2];return D(p)?()=>{}:m=>n(m)?.[p]?.(...t(m))}if(r[0]==="?.[]"){let n=i(r[1]),p=i(r[2]);return m=>{let u=n(m),a=p(m);return D(a)?void 0:u?.[a]?.(...t(m))}}if(r[0]==="."){let n=i(r[1]),p=r[2];return D(p)?()=>{}:m=>n(m)?.[p]?.(...t(m))}if(r[0]==="[]"&&r.length===3){let n=i(r[1]),p=i(r[2]);return m=>{let u=n(m),a=p(m);return D(a)?void 0:u?.[a]?.(...t(m))}}let o=i(r);return n=>o(n)?.(...t(n))});f("typeof",r=>(r=i(r),e=>typeof r(e)));f("void",r=>(r=i(r),e=>(r(e),void 0)));f("delete",r=>{if(r[0]==="."){let e=i(r[1]),t=r[2];return o=>delete e(o)[t]}if(r[0]==="[]"){let e=i(r[1]),t=i(r[2]);return o=>delete e(o)[t(o)]}return()=>!0});f("new",r=>{let e=i(r?.[0]==="()"?r[1]:r),t=r?.[0]==="()"?r[2]:null,o=t?t[0]===","?(n=>p=>n.map(m=>m(p)))(t.slice(1).map(i)):(n=>p=>[n(p)])(i(t)):()=>[];return n=>new(e(n))(...o(n))});var sr=Symbol("accessor");f("get",(r,e)=>(e=e?i(e):()=>{},t=>[[sr,r,{get:function(){let o=Object.create(t||{});return o.this=this,e(o)}}]]));f("set",(r,e,t)=>(t=t?i(t):()=>{},o=>[[sr,r,{set:function(n){let p=Object.create(o||{});p.this=this,p[e]=n,t(p)}}]]));var Xt=r=>r==null||typeof r=="string"||[":",",","...","get","set"].includes(r[0]);f("{}",(r,e)=>{if(e!==void 0)return;if(!Xt(r))return i(["{",r]);r=r?r[0]!==","?[r]:r.slice(1):[];let t=r.map(o=>i(typeof o=="string"?[":",o,o]:o));return o=>{let n={},p={};for(let m of t.flatMap(u=>u(o)))if(m[0]===sr){let[,u,a]=m;p[u]={...p[u],...a,configurable:!0,enumerable:!0}}else n[m[0]]=m[1];for(let m in p)Object.defineProperty(n,m,p[m]);return n}});f("{",r=>(r=r?i(r):()=>{},e=>r(Object.create(e))));f(":",(r,e)=>(e=i(e),Array.isArray(r)?(r=i(r),t=>[[r(t),e(t)]]):t=>[[r,e(t)]]));f("`",(...r)=>(r=r.map(i),e=>r.map(t=>t(e)).join("")));f("``",(r,...e)=>{r=i(r);let t=[],o=[];for(let p of e)Array.isArray(p)&&p[0]===void 0?t.push(p[1]):o.push(i(p));let n=Object.assign([...t],{raw:t});return p=>r(p)(n,...o.map(m=>m(p)))});f("function",(r,e,t)=>{t=t?i(t):()=>{};let o=e?e[0]===","?e.slice(1):[e]:[],n=null,p=-1,m=o[o.length-1];return Array.isArray(m)&&m[0]==="..."&&(p=o.length-1,n=m[1],o.length--),u=>{let a=(...y)=>{let g={};o.forEach((w,R)=>g[w]=y[R]),n&&(g[n]=y.slice(p));let E=new Proxy(g,{get:(w,R)=>R in w?w[R]:u[R],set:(w,R,Ae)=>((R in w?w:u)[R]=Ae,!0),has:(w,R)=>R in w||R in u});try{return t(E)}catch(w){if(w===v)return w[0];throw w}};return r&&(u[r]=a),a}});f("function*",(r,e,t)=>{throw Error("Generator functions are not supported in evaluation")});f("async",r=>{let e=i(r);return t=>{let o=e(t);return async function(...n){return o(...n)}}});f("await",r=>(r=i(r),async e=>await r(e)));f("yield",r=>(r=r?i(r):null,e=>{throw{__yield__:r?r(e):void 0}}));f("yield*",r=>(r=i(r),e=>{throw{__yield_all__:r(e)}}));var Kt=Symbol("static"),Ht=r=>{throw Error(r)};f("instanceof",(r,e)=>(r=i(r),e=i(e),t=>r(t)instanceof e(t)));f("class",(r,e,t)=>(e=e?i(e):null,t=t?i(t):null,o=>{let n=e?e(o):Object,p=function(...m){if(!(this instanceof p))return Ht("Class constructor must be called with new");let u=e?Reflect.construct(n,m,p):this;return p.prototype.__constructor__&&p.prototype.__constructor__.apply(u,m),u};if(Object.setPrototypeOf(p.prototype,n.prototype),Object.setPrototypeOf(p,n),t){let m=Object.create(o);m.super=n;let u=t(m),a=Array.isArray(u)&&typeof u[0]?.[0]=="string"?u:[];for(let[y,g]of a)y==="constructor"?p.prototype.__constructor__=g:p.prototype[y]=g}return r&&(o[r]=p),p}));f("static",r=>(r=i(r),e=>[[Kt,r(e)]]));f("//",(r,e)=>{let t=new RegExp(r,e||"");return()=>t});f("if",(r,e,t)=>(r=i(r),e=i(e),t=t!==void 0?i(t):null,o=>r(o)?e(o):t?.(o)));var M=Symbol("break"),X=Symbol("continue");f("while",(r,e)=>(r=i(r),e=i(e),t=>{let o;for(;r(t);)try{o=e(t)}catch(n){if(n===M)break;if(n===X)continue;if(n===v)return n[0];throw n}return o}));f("do",(r,e)=>(r=i(r),e=i(e),t=>{let o;do try{o=r(t)}catch(n){if(n===M)break;if(n===X)continue;if(n===v)return n[0];throw n}while(e(t));return o}));f("for",(r,e)=>{if(Array.isArray(r)&&r[0]===";"){let[,t,o,n]=r;return t=t?i(t):null,o=o?i(o):()=>!0,n=n?i(n):null,e=i(e),p=>{let m;for(t?.(p);o(p);n?.(p))try{m=e(p)}catch(u){if(u===M)break;if(u===X)continue;if(u===v)return u[0];throw u}return m}}if(Array.isArray(r)&&(r[0]==="in"||r[0]==="of")){let[t,o,n]=r;if(Array.isArray(o)&&(o[0]==="let"||o[0]==="const"||o[0]==="var")&&(o=o[1]),t==="in")return $t(o,n,e);if(t==="of")return Qt(o,n,e)}});var Qt=(r,e,t)=>{e=i(e),t=i(t);let o=Array.isArray(r);return n=>{let p,m=o?null:n[r];for(let u of e(n)){o?G(r,u,n):n[r]=u;try{p=t(n)}catch(a){if(a===M)break;if(a===X)continue;if(a===v)return a[0];throw a}}return o||(n[r]=m),p}},$t=(r,e,t)=>{e=i(e),t=i(t);let o=Array.isArray(r);return n=>{let p,m=o?null:n[r];for(let u in e(n)){o?G(r,u,n):n[r]=u;try{p=t(n)}catch(a){if(a===M)break;if(a===X)continue;if(a===v)return a[0];throw a}}return o||(n[r]=m),p}};f("break",()=>()=>{throw M});f("continue",()=>()=>{throw X});f("return",r=>(r=r!==void 0?i(r):null,e=>{throw v[0]=r?.(e),v}));f("try",(r,...e)=>{r=r?i(r):null;let t=e.find(u=>u?.[0]==="catch"),o=e.find(u=>u?.[0]==="finally"),n=t?.[1],p=t?.[2]?i(t[2]):null,m=o?.[1]?i(o[1]):null;return u=>{let a;try{a=r?.(u)}catch(y){if(y===M||y===X||y===v)throw y;if(n!=null&&p){let g=n in u,E=u[n];u[n]=y;try{a=p(u)}finally{g?u[n]=E:delete u[n]}}else if(!p)throw y}finally{m?.(u)}return a}});f("throw",r=>(r=i(r),e=>{throw r(e)}));f("switch",(r,...e)=>(r=i(r),e.length?(e=e.map(t=>[t[0]==="case"?i(t[1]):null,(t[0]==="case"?t[2]:t[1])?.[0]===";"?(t[0]==="case"?t[2]:t[1]).slice(1).map(i):(t[0]==="case"?t[2]:t[1])?[i(t[0]==="case"?t[2]:t[1])]:[]]),t=>{let o=r(t),n=!1,p;for(let[u,a]of e)if(n||u===null||u(t)===o)for(n=!0,m=0;m<a.length;m++)try{p=a[m](t)}catch(y){if(y===M)return p;throw y}var m;return p}):t=>r(t)));f("import",()=>()=>{});f("export",()=>()=>{});f("from",(r,e)=>()=>{});f("as",(r,e)=>()=>{});f("default",r=>i(r));var de=new WeakMap,jt=(r,...e)=>typeof r=="string"?i(s(r)):de.get(r)||de.set(r,Wt(r,e)).get(r),he=57344,Wt=(r,e)=>{let t=r.reduce((p,m,u)=>p+(u?String.fromCharCode(he+u-1):"")+m,""),o=s(t),n=p=>{if(typeof p=="string"&&p.length===1){let m=p.charCodeAt(0)-he,u;if(m>=0&&m<e.length)return u=e[m],zt(u)?u:[,u]}return Array.isArray(p)?p.map(n):p};return i(n(o))},zt=r=>typeof r=="string"||Array.isArray(r)&&(typeof r[0]=="string"||r[0]===void 0),Jt=jt;export{ur as access,A as binary,i as compile,c as cur,Jt as default,N as err,h as expr,j as group,Vt as id,l as idx,C as keyword,H as literal,Br as loc,T as lookup,fr as nary,I as next,f as operator,pr as operators,P as parens,s as parse,Y as peek,$ as prec,O as seek,d as skip,S as token,_ as unary,k as word};
4
+ `,""+n}${m}${l}`)},Mr=(r,e=u)=>(Array.isArray(r)&&(r.loc=e),r),T=(r,e=u,t)=>{for(;t=r(c.charCodeAt(u));)u+=t;return c.slice(e,u)},h=(r=1)=>c[u+=r],O=r=>u=r,d=(r=0,e)=>{let t,o,n;for(e&&s.enter?.(r,e);(t=s.space())&&t!==e&&(n=s.step(o,r,t,d));)o=n;return e&&(t==e?(u++,s.exit?.(r,e)):N("Unclosed "+String.fromCharCode(e-(e>42?2:1)))),o},j=(r=u)=>{for(;c.charCodeAt(r)<=32;)r++;return c.charCodeAt(r)},so=s.id=r=>r>=48&&r<=57||r>=65&&r<=90||r>=97&&r<=122||r==36||r==95||r>=192&&r!=215&&r!=247,k=(r,e=r.length)=>c.substr(u,e)===r&&!s.id(c.charCodeAt(u+e)),L=()=>(h(),d(0,41)),I=[],G={},S=(r,e=32,t,o=r.charCodeAt(0),n=r.length,p=I[o],m=r.toUpperCase()!==r,l,a)=>(e=G[r]=!p&&G[r]||e,I[o]=(y,g,E,w=u)=>(l=E,(E?r==E:(n<2||r.charCodeAt(1)===c.charCodeAt(u+1)&&(n<3||c.substr(u,n)==r))&&(!m||!s.id(c.charCodeAt(u+n)))&&(l=E=r))&&g<e&&(u+=n,(a=t(y))?Mr(a,w):(u=w,l=0,!m&&!p&&!y&&N()),a)||p?.(y,g,l))),A=(r,e,t=!1)=>S(r,e,o=>o&&(n=>n&&[r,o,n])(d(e-(t?.5:0)))),_=(r,e,t)=>S(r,e,o=>t?o&&[r,o]:!o&&(o=d(e-.5))&&[r,o]),Q=(r,e)=>S(r,200,t=>!t&&[,e]),pr=(r,e,t,o)=>S(r,e,(n,p)=>(p=d(e-(t?.5:0)),n?.[0]!==r&&(n=[r,n||null]),p?.[0]===r?n.push(...p.slice(1)):p?n.push(p):(o||j()===r.charCodeAt(0))&&n.push(null),n)),W=(r,e)=>S(r[0],e,t=>!t&&[r,d(0,r.charCodeAt(1))||null]),fr=(r,e)=>S(r[0],e,t=>t&&[r,t,d(0,r.charCodeAt(1))||null]),lr=(r,e)=>(s.space(),e=c.charCodeAt(u),s.id(e)&&(e<48||e>57)?T(s.id):d(r)),Ur=(r,e)=>S(r,e,t=>t&&(o=>o&&[r,t,o])(lr(e))),C=(r,e,t,o=r.charCodeAt(0),n=r.length,p=I[o],m)=>(G[r]??=e,I[o]=(l,a,y,g=u)=>!l&&(y?r==y:(n<2||c.substr(u,n)==r)&&(y=r))&&a<e&&!s.id(c.charCodeAt(u+n))&&(!s.prop||s.prop(u+n))&&(O(u+n),(m=t())?Mr(m,g):O(g),m)||p?.(l,a,y));s.space=r=>{for(;(r=c.charCodeAt(u))<=32;)u++;return r};s.step=(r,e,t,o,n)=>(n=I[t])&&n(r,e)||(r?null:T(s.id)||null);var sr={},f=(r,e,t=sr[r])=>sr[r]=(...o)=>e(...o)||t?.(...o),i=r=>Array.isArray(r)?r[0]==null?(e=>()=>e)(r[1]):sr[r[0]]?.(...r.slice(1))??N(`Unknown operator: ${r[0]}`,r?.loc):r===void 0?()=>{}:e=>e?.[r];var Z=46,z=48,q=57,ke=69,Te=101,Ie=43,Ne=45,Y=95,Dr=110,Re=97,_e=102,Oe=65,Le=70,Fr=r=>r.indexOf("_")<0?r:r.replaceAll("_",""),ur=r=>{let e=Fr(T(t=>t===Z&&c.charCodeAt(u+1)!==Z||t>=z&&t<=q||t===Y||((t===ke||t===Te)&&((t=c.charCodeAt(u+1))>=z&&t<=q||t===Ie||t===Ne)?2:0)));return c.charCodeAt(u)===Dr?(h(),[,BigInt(e)]):(r=+e)!=r?N():[,r]},Pe={2:r=>r===48||r===49||r===Y,8:r=>r>=48&&r<=55||r===Y,16:r=>r>=z&&r<=q||r>=Re&&r<=_e||r>=Oe&&r<=Le||r===Y};s.number=null;I[Z]=r=>!r&&c.charCodeAt(u+1)!==Z&&ur();for(let r=z;r<=q;r++)I[r]=e=>e?void 0:ur();I[z]=r=>{if(r)return;let e=s.number;if(e){for(let[t,o]of Object.entries(e))if(t[0]==="0"&&c[u+1]?.toLowerCase()===t[1]){h(2);let n=Fr(T(Pe[o]));return c.charCodeAt(u)===Dr?(h(),[,BigInt("0"+t[1]+n)]):[,parseInt(n,o)]}}return ur()};var Be=92,Gr=34,Kr=39,Xr=117,Hr=120,ve=123,Me=125,Qr=10,Ue=13,De={n:`
5
+ `,r:"\r",t:" ",b:"\b",f:"\f",v:"\v",0:"\0"},$r=r=>r>=48&&r<=57?r-48:r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:-1,jr=r=>(e,t,o="",n=String.fromCharCode(r))=>{if(e||!s.string?.[n])return;h();let p=()=>{let m=c.charCodeAt(u+1);if(m===Qr)return 2;if(m===Ue)return c.charCodeAt(u+2)===Qr?3:2;if(m===Hr||m===Xr&&c.charCodeAt(u+2)!==ve){let l=m===Hr?2:4,a=0,y;for(let g=0;g<l;g++){if((y=$r(c.charCodeAt(u+2+g)))<0)return o+=c[u+1],2;a=a*16+y}return o+=String.fromCharCode(a),2+l}if(m===Xr){let l=0,a=u+3,y;for(;(y=$r(c.charCodeAt(a)))>=0;)l=l*16+y,a++;return a>u+3&&l<=1114111&&c.charCodeAt(a)===Me?(o+=String.fromCodePoint(l),a-u+1):(o+=c[u+1],2)}return o+=De[c[u+1]]||c[u+1],2};return T(m=>m-r&&(m!==Be?(o+=c[u],1):p())),c[u]===n?h():N("Bad string"),[,o]};I[Gr]=jr(Gr);I[Kr]=jr(Kr);s.string={'"':!0};var Fe=20;"= += -= *= /= %= |= &= ^= >>= <<=".split(" ").map(r=>A(r,Fe,!0));var Ge=30,Ke=40,Xe=140;_("!",Xe);A("||",Ge);A("&&",Ke);var He=50,Qe=60,$e=70,Wr=100,je=140;A("|",He);A("&",$e);A("^",Qe);A(">>",Wr);A("<<",Wr);_("~",je);var x=90;A("<",x);A(">",x);A("<=",x);A(">=",x);var zr=80;A("==",zr);A("!=",zr);var Jr=110,mr=120,Vr=140;A("+",Jr);A("-",Jr);A("*",mr);A("/",mr);A("%",mr);_("+",Vr);_("-",Vr);var b=150;S("++",b,r=>r?["++",r,null]:["++",d(b-1)]);S("--",b,r=>r?["--",r,null]:["--",d(b-1)]);var We=5,ze=10;pr(",",ze);pr(";",We,!0,!0);var Je=170;W("()",Je);var Yr=170,Ve=160;fr("[]",Yr);Ur(".",Yr);fr("()",Ve);var Ye=32,Ze=s.space;s.comment??={"//":`
6
+ `,"/*":"*/"};var cr;s.space=()=>{cr||(cr=Object.entries(s.comment).map(([n,p])=>[n,p,n.charCodeAt(0)]));for(var r;r=Ze();){for(var e=0,t;t=cr[e++];)if(r===t[2]&&c.substr(u,t[0].length)===t[0]){var o=u+t[0].length;if(t[1]===`
7
+ `)for(;c.charCodeAt(o)>=Ye;)o++;else{for(;c[o]&&c.substr(o,t[1].length)!==t[1];)o++;c[o]&&(o+=t[1].length)}O(o),r=0;break}if(r)return r}return r};var Zr=80;A("===",Zr);A("!==",Zr);var qe=30;A("??",qe);var xe=130,be=20;A("**",xe,!0);A("**=",be,!0);var qr=90;A("in",qr);A("of",qr);var rt=20,et=100;A(">>>",et);A(">>>=",rt,!0);var ar=20;A("||=",ar,!0);A("&&=",ar,!0);A("??=",ar,!0);Q("true",!0);Q("false",!1);Q("null",null);C("undefined",200,()=>[]);Q("NaN",NaN);Q("Infinity",1/0);var dr=20;S("?",dr,(r,e,t)=>r&&(e=d(dr-1))&&T(o=>o===58)&&(t=d(dr-1),["?",r,e,t]));var tt=20;A("=>",tt,!0);var ot=20;_("...",ot);var xr=170;S("?.",xr,(r,e)=>{if(!r)return;let t=s.space();return t===40?(h(),["?.()",r,d(0,41)||null]):t===91?(h(),["?.[]",r,d(0,93)]):(e=lr(xr),e?["?.",r,e]:void 0)});var hr=140,br=160,nt=br+1;_("typeof",hr);_("void",hr);_("delete",hr);var it=r=>s.space()===40?(h(),["()",r,d(0,41)||null]):r;C("new",nt,()=>k(".target")?(h(7),["new.target"]):["new",it(d(br))]);var st=20,re=200;s.prop=r=>j(r)!==58;W("[]",re);W("{}",re);A(":",st-1,!0);var pt=170,Ar=96,ft=36,lt=123,ut=92,mt={n:`
8
+ `,r:"\r",t:" ",b:"\b",f:"\f",v:"\v"},ee=()=>{let r=[],e="",t;for(;(t=c.charCodeAt(u))!==Ar;)t?t===ut?(h(),e+=mt[c[u]]||c[u],h()):t===ft&&c.charCodeAt(u+1)===lt?(r.push([,e]),e="",h(2),r.push(d(0,125))):(e+=c[u],h()):N("Unterminated template");return r.push([,e]),h(),r},ct=r=>r.length<2&&r[0]?.[0]===void 0?r[0]||[,""]:["`",...r],at=I[Ar];I[Ar]=(r,e)=>r&&e<pt?s.asi&&s.newline?void 0:(h(),["``",r,...ee()]):r?at?.(r,e):(h(),ct(ee()));s.string["'"]=!0;s.number={"0x":16,"0b":2,"0o":8};var dt=92,ht=117,At=123,yt=125,Ct=183,wt=s.id,te=r=>r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102,gt=(r=u+2,e,t=0,o=0)=>{if(c.charCodeAt(u)!==dt||c.charCodeAt(u+1)!==ht)return 0;if(c.charCodeAt(r)===At){for(;te(e=c.charCodeAt(++r));)t=t*16+(e<=57?e-48:(e&31)+9);return r>u+3&&t<=1114111&&c.charCodeAt(r)===yt?r-u+1:0}for(;o<4&&te(c.charCodeAt(r+o));)o++;return o===4?6:0};s.id=r=>wt(r)||r===Ct||gt();var yr=5,Et=10,Cr=r=>{let e=u,t=d(Et-1);return t==null?r:r==="let"&&(t==="in"||t==="of")?(O(e),r):t[0]==="in"||t[0]==="of"?[t[0],[r,t[1]],t[2]]:t[0]===","?[r,...t.slice(1)]:[r,t]};C("let",yr+1,()=>Cr("let"));C("const",yr+1,()=>Cr("const"));C("var",yr+1,()=>Cr("var"));var rr=5,St=59,B=()=>(s.space()===123||N("Expected {"),h(),d(rr-.5,125)||null),U=()=>s.space()!==123?d(rr+.5):(h(),d(rr-.5,125)||null),kt=()=>{let r=u;return s.space()===St&&h(),s.space(),k("else")?(h(4),s.semi=!1,!0):(O(r),!1)};C("if",rr+1,()=>{s.space();let r=["if",L(),U()];return kt()&&r.push(U()),r});var Tt=200;C("function",Tt,()=>{s.space();let r=!1;c[u]==="*"&&(r=!0,h(),s.space());let e=T(s.id);return e&&s.space(),r?["function*",e,L()||null,B()]:["function",e,L()||null,B()]});var er=140,wr=20;_("await",er);C("yield",er,()=>(s.space(),c[u]==="*"?(h(),s.space(),["yield*",d(wr)]):["yield",d(wr)]));C("async",er,()=>{if(s.space(),k("function"))return["async",d(er)];let r=d(wr-.5);return r&&["async",r]});var gr=200;var It=90,Nt=175;_("static",Nt);A("instanceof",It);S("#",gr,r=>{if(r)return;let e=T(s.id);return e?"#"+e:void 0});C("class",gr,()=>{s.space();let r=T(s.id)||null;if(r==="extends")r=null,s.space();else{if(s.space(),!k("extends"))return["class",r,null,B()];h(7),s.space()}return["class",r,d(gr),B()]});var Er=47,Rt=92,_t=91,Ot=93;S("/",140,r=>{let e=c.charCodeAt(u);if(r||e===Er||e===42||e===43||e===63)return;let t=!1,o=T(p=>p===Rt?2:p===_t?(t=!0,1):p===Ot?(t=!1,1):p&&(t||p!==Er));c.charCodeAt(u)===Er||N("Unterminated regex"),h();let n=T(p=>p===103||p===105||p===109||p===115||p===117||p===121);return n?["//",o,n]:["//",o]});var H=5,J=125,V=59;C("while",H+1,()=>(s.space(),["while",L(),U()]));C("do",H+1,()=>(r=>(s.space(),h(5),s.space(),["do",r,L()]))(U()));C("for",H+1,()=>(s.space(),k("await")?(h(5),s.space(),["for await",L(),U()]):["for",L(),U()]));C("break",H+1,()=>{s.asi&&(s.newline=!1);let r=u;s.space();let e=c.charCodeAt(u);if(!e||e===J||e===V||s.newline)return["break"];let t=T(s.id);if(!t)return["break"];s.space();let o=c.charCodeAt(u);return!o||o===J||o===V||s.newline?["break",t]:(O(r),["break"])});C("continue",H+1,()=>{s.asi&&(s.newline=!1);let r=u;s.space();let e=c.charCodeAt(u);if(!e||e===J||e===V||s.newline)return["continue"];let t=T(s.id);if(!t)return["continue"];s.space();let o=c.charCodeAt(u);return!o||o===J||o===V||s.newline?["continue",t]:(O(r),["continue"])});C("return",H+1,()=>{s.asi&&(s.newline=!1);let r=s.space();return!r||r===J||r===V||s.newline?["return"]:["return",d(H)]});var Sr=5;C("try",Sr+1,()=>{let r=["try",B()];return s.space(),k("catch")&&(h(5),s.space(),r.push(["catch",j()===40?L():null,B()])),s.space(),k("finally")&&(h(7),r.push(["finally",B()])),r});C("throw",Sr+1,()=>{if(s.asi&&(s.newline=!1),s.space(),s.newline)throw SyntaxError("Unexpected newline after throw");return["throw",d(Sr)]});var ie=5,Lt=20,oe=58,Pt=59,se=125,kr=0,pe=(r,e=r.length,t=r.charCodeAt(0),o=I[t])=>I[t]=(n,p,m)=>k(r)&&!n&&kr||o?.(n,p,m);pe("case");pe("default");var ne=r=>{let e=[];for(;(r=s.space())!==se&&!k("case")&&!k("default");){if(r===Pt){h();continue}e.push(d(ie-.5))||N()}return e.length>1?[";",...e]:e[0]||null},Bt=()=>{s.space()===123||N("Expected {"),h(),kr++;let r=[];try{for(;s.space()!==se;)if(k("case")){O(u+4),s.space();let e=d(Lt-.5);s.space()===oe&&h(),r.push(["case",e,ne()])}else k("default")?(O(u+7),s.space()===oe&&h(),r.push(["default",ne()])):N("Expected case or default")}finally{kr--}return h(),r};C("switch",ie+1,()=>s.space()===40&&["switch",L(),...Bt()]);var Tr=5,vt=20;C("debugger",Tr+1,()=>["debugger"]);C("with",Tr+1,()=>(s.space(),["with",L(),U()]));var Mt=["if","for","while","do","switch","try"];S(":",vt-1,r=>typeof r=="string"&&(s.space(),Mt.some(e=>k(e)))&&[":",r,d(Tr)]);var Ir=5,$=10,fe=42,Ut=I[fe];I[fe]=(r,e)=>r?Ut?.(r,e):(h(),"*");S("from",$+1,r=>r?r[0]!=="="&&r[0]!==","&&(s.space(),["from",r,d($+1)]):!1);S("as",$+2,r=>r?(s.space(),["as",r,d($+2)]):!1);C("import",Ir,()=>k(".meta")?(h(5),["import.meta"]):["import",d($)]);C("export",Ir,()=>(s.space(),k("default")?(h(7),["export",["default",d($)]]):["export",d(Ir)]));var Nr=20,Dt=10,Ft=13,Gt=40,le=41,ue=123,me=125,Kt=(r,e)=>{for(;r<e;){let t=c.charCodeAt(r++);if(t===Dt||t===Ft)return!0}return!1},ce=r=>e=>{if(e)return;let t=u;if(s.space(),s.semi||Kt(t,u))return!1;let o=T(s.id);if(!o||(s.space(),c.charCodeAt(u)!==Gt))return!1;h();let n=d(0,le);return s.space(),c.charCodeAt(u)!==ue?!1:(h(),[r,o,n,d(0,me)])};S("get",Nr-1,ce("get"));S("set",Nr-1,ce("set"));S("(",Nr-1,r=>{if(!r)return;let e;if(Array.isArray(r)&&r[0]==="static"&&(e="static",r=r[1]),typeof r!="string"&&!(Array.isArray(r)&&r[0]===void 0))return;let t=d(0,le)||null;if(s.space(),c.charCodeAt(u)!==ue)return;h();let o=[":",r,["=>",["()",t],d(0,me)||null]];return e?[e,o]:o});s.comment["#!"]=`
9
+ `;var Ae=32,Lr=10,Xt=59,Ht=125,ae=91,de=40,tr=G.asi??G[";"],Qt=s._baseSpace??=s.space,$t=s._baseStep??=s.step,Rr=r=>Array.isArray(r)||typeof r=="string",jt=(G[";"]??5)+1,Or=r=>Array.isArray(r)&&(G[r[0]]<=jt||r[0]==="{}"&&Or(r[1])),Wt=(r,e)=>{for(;(e=c.charCodeAt(r))<=Ae;){if(e===Lr)return!0;r++}return!1},zt=(r=u,e)=>{for(;r-- >0&&(e=c.charCodeAt(r))<=Ae;)if(e===Lr)return!0;return!1};s.space=(r,e)=>{for(;;){for(e=u,r=Qt();e<u;)if(c.charCodeAt(e++)===Lr){s.newline=!0;break}if(r===Xt&&Wt(u+1)){O(u+1),s.newline=s.semi=!0;continue}return r}};s.enter=()=>s.newline=s.semi=!1;s.exit=(r,e)=>{e===Ht&&(s.newline=!0,s.semi=!1)};s.step=(r,e,t,o)=>{if(s.semi&&e>=tr)return!1;if(r&&!Rr(r))return null;if(Rr(r)){let p=(t===ae||t===de)&&zt();if(s.semi||t===ae&&(p||Or(r))||t===de&&(Or(r)||p&&e>=tr))return he(r,e,o)??null}let n=s.newline;return $t(r,e,t,o)??(Rr(r)&&n?he(r,e,o)??null:null)};var _r=0,Jt=2e3,he=s.asi=(r,e,t,o,n)=>{if(e>=tr||_r>=Jt)return;s.semi=!1;let p=u;_r++;try{o=t(tr-.5)}finally{_r--}if(!(!o||u===p))return n=o?.[0]===";"?o.slice(1):[o],r?.[0]===";"?(r.push(...n),r):[";",r,...n]};var Ce=(r,e,t,o)=>typeof r=="string"?n=>e(n,r,n):r[0]==="."?(t=i(r[1]),o=r[2],n=>e(t(n),o,n)):r[0]==="[]"&&r.length===3?(t=i(r[1]),o=i(r[2]),n=>e(t(n),o(n),n)):r[0]==="()"&&r.length===2?Ce(r[1],e):(()=>{throw Error("Invalid assignment target")})(),ye={"=":(r,e,t)=>r[e]=t,"+=":(r,e,t)=>r[e]+=t,"-=":(r,e,t)=>r[e]-=t,"*=":(r,e,t)=>r[e]*=t,"/=":(r,e,t)=>r[e]/=t,"%=":(r,e,t)=>r[e]%=t,"|=":(r,e,t)=>r[e]|=t,"&=":(r,e,t)=>r[e]&=t,"^=":(r,e,t)=>r[e]^=t,">>=":(r,e,t)=>r[e]>>=t,"<<=":(r,e,t)=>r[e]<<=t};for(let r in ye)f(r,(e,t)=>(t=i(t),Ce(e,(o,n,p)=>ye[r](o,n,t(p)))));f("!",r=>(r=i(r),e=>!r(e)));f("||",(r,e)=>(r=i(r),e=i(e),t=>r(t)||e(t)));f("&&",(r,e)=>(r=i(r),e=i(e),t=>r(t)&&e(t)));f("~",r=>(r=i(r),e=>~r(e)));f("|",(r,e)=>(r=i(r),e=i(e),t=>r(t)|e(t)));f("&",(r,e)=>(r=i(r),e=i(e),t=>r(t)&e(t)));f("^",(r,e)=>(r=i(r),e=i(e),t=>r(t)^e(t)));f(">>",(r,e)=>(r=i(r),e=i(e),t=>r(t)>>e(t)));f("<<",(r,e)=>(r=i(r),e=i(e),t=>r(t)<<e(t)));f(">",(r,e)=>(r=i(r),e=i(e),t=>r(t)>e(t)));f("<",(r,e)=>(r=i(r),e=i(e),t=>r(t)<e(t)));f(">=",(r,e)=>(r=i(r),e=i(e),t=>r(t)>=e(t)));f("<=",(r,e)=>(r=i(r),e=i(e),t=>r(t)<=e(t)));f("==",(r,e)=>(r=i(r),e=i(e),t=>r(t)==e(t)));f("!=",(r,e)=>(r=i(r),e=i(e),t=>r(t)!=e(t)));f("+",(r,e)=>e!==void 0?(r=i(r),e=i(e),t=>r(t)+e(t)):(r=i(r),t=>+r(t)));f("-",(r,e)=>e!==void 0?(r=i(r),e=i(e),t=>r(t)-e(t)):(r=i(r),t=>-r(t)));f("*",(r,e)=>(r=i(r),e=i(e),t=>r(t)*e(t)));f("/",(r,e)=>(r=i(r),e=i(e),t=>r(t)/e(t)));f("%",(r,e)=>(r=i(r),e=i(e),t=>r(t)%e(t)));var Pr=(r,e,t,o)=>typeof r=="string"?n=>e(n,r):r[0]==="."?(t=i(r[1]),o=r[2],n=>e(t(n),o)):r[0]==="[]"&&r.length===3?(t=i(r[1]),o=i(r[2]),n=>e(t(n),o(n))):r[0]==="()"&&r.length===2?Pr(r[1],e):(()=>{throw Error("Invalid increment target")})();f("++",(r,e)=>Pr(r,e===null?(t,o)=>t[o]++:(t,o)=>++t[o]));f("--",(r,e)=>Pr(r,e===null?(t,o)=>t[o]--:(t,o)=>--t[o]));var we=(...r)=>(r=r.map(i),e=>{let t;for(let o of r)t=o(e);return t});f(",",we);f(";",we);var D=r=>r?.[0]==="_"&&r[1]==="_"||r==="constructor"||r==="prototype",or=r=>{throw Error(r)};f("[]",(r,e)=>e===void 0?(r=r?r[0]===","?r.slice(1):[r]:[],r=r.map(t=>t==null?(()=>{}):t[0]==="..."?(t=i(t[1]),o=>t(o)):(t=i(t),o=>[t(o)])),t=>r.flatMap(o=>o(t))):(e==null&&or("Missing index"),r=i(r),e=i(e),t=>{let o=e(t);return D(o)?void 0:r(t)[o]}));f(".",(r,e)=>(r=i(r),e=e[0]?e:e[1],D(e)?()=>{}:t=>r(t)[e]));f("()",(r,e)=>{if(e===void 0)return r==null?or("Empty ()"):i(r);let t=n=>n?.[0]===","&&n.slice(1).some(p=>p==null||t(p));t(e)&&or("Empty argument");let o=e?e[0]===","?(e=e.slice(1).map(i),n=>e.map(p=>p(n))):(e=i(e),n=>[e(n)]):()=>[];return Br(r,(n,p,m)=>n[p](...o(m)))});var v=r=>typeof r=="string"||Array.isArray(r)&&(r[0]==="."||r[0]==="?."||r[0]==="[]"&&r.length===3||r[0]==="?.[]"||r[0]==="()"&&r.length===2&&v(r[1])||r[0]==="{}"),Br=(r,e,t,o)=>r==null?or("Empty ()"):r[0]==="()"&&r.length==2?Br(r[1],e):typeof r=="string"?n=>e(n,r,n):r[0]==="."?(t=i(r[1]),o=r[2],n=>e(t(n),o,n)):r[0]==="?."?(t=i(r[1]),o=r[2],n=>{let p=t(n);return p==null?void 0:e(p,o,n)}):r[0]==="[]"&&r.length===3?(t=i(r[1]),o=i(r[2]),n=>e(t(n),o(n),n)):r[0]==="?.[]"?(t=i(r[1]),o=i(r[2]),n=>{let p=t(n);return p==null?void 0:e(p,o(n),n)}):(r=i(r),n=>e([r(n)],0,n)),F=Br;f("===",(r,e)=>(r=i(r),e=i(e),t=>r(t)===e(t)));f("!==",(r,e)=>(r=i(r),e=i(e),t=>r(t)!==e(t)));f("??",(r,e)=>(r=i(r),e=i(e),t=>r(t)??e(t)));var Vt=r=>{throw Error(r)};f("**",(r,e)=>(r=i(r),e=i(e),t=>r(t)**e(t)));f("**=",(r,e)=>(v(r)||Vt("Invalid assignment target"),e=i(e),F(r,(t,o,n)=>t[o]**=e(n))));f("in",(r,e)=>(r=i(r),e=i(e),t=>r(t)in e(t)));var Yt=r=>{throw Error(r)};f(">>>",(r,e)=>(r=i(r),e=i(e),t=>r(t)>>>e(t)));f(">>>=",(r,e)=>(v(r)||Yt("Invalid assignment target"),e=i(e),F(r,(t,o,n)=>t[o]>>>=e(n))));var Zt=r=>r[0]?.[0]===","?r[0].slice(1):r,K=(r,e,t)=>{if(typeof r=="string"){t[r]=e;return}let[o,...n]=r,p=Zt(n);if(o==="{}"){let m=[];for(let l of p){if(Array.isArray(l)&&l[0]==="..."){let w={};for(let R in e)m.includes(R)||(w[R]=e[R]);t[l[1]]=w;break}let a,y,g;typeof l=="string"?a=y=l:l[0]==="="?(typeof l[1]=="string"?a=y=l[1]:[,a,y]=l[1],g=l[2]):[,a,y]=l,m.push(a);let E=e[a];E===void 0&&g&&(E=i(g)(t)),K(y,E,t)}}else if(o==="[]"){let m=0;for(let l of p){if(l===null){m++;continue}if(Array.isArray(l)&&l[0]==="..."){t[l[1]]=e.slice(m);break}let a=l,y;Array.isArray(l)&&l[0]==="="&&([,a,y]=l);let g=e[m++];g===void 0&&y&&(g=i(y)(t)),K(a,g,t)}}},vr=(...r)=>(r=r.map(e=>{if(typeof e=="string")return t=>{t[e]=void 0};if(e[0]==="="){let[,t,o]=e,n=i(o);return typeof t=="string"?p=>{p[t]=n(p)}:p=>K(t,n(p),p)}return i(e)}),e=>{for(let t of r)t(e)});f("let",vr);f("const",vr);f("var",vr);var nr=r=>{throw Error(r)};f("=",(r,e)=>{if(Array.isArray(r)&&(r[0]==="let"||r[0]==="const"||r[0]==="var")){let t=r[1];return e=i(e),typeof t=="string"?o=>{o[t]=e(o)}:o=>K(t,e(o),o)}return v(r)||nr("Invalid assignment target"),e=i(e),F(r,(t,o,n)=>t[o]=e(n))});f("||=",(r,e)=>(v(r)||nr("Invalid assignment target"),e=i(e),F(r,(t,o,n)=>t[o]||=e(n))));f("&&=",(r,e)=>(v(r)||nr("Invalid assignment target"),e=i(e),F(r,(t,o,n)=>t[o]&&=e(n))));f("??=",(r,e)=>(v(r)||nr("Invalid assignment target"),e=i(e),F(r,(t,o,n)=>t[o]??=e(n))));f("?",(r,e,t)=>(r=i(r),e=i(e),t=i(t),o=>r(o)?e(o):t(o)));var P=[];f("=>",(r,e)=>{r=r?.[0]==="()"?r[1]:r;let t=r?r[0]===","?r.slice(1):[r]:[],o=-1,n=null,p=t[t.length-1];Array.isArray(p)&&p[0]==="..."&&(o=t.length-1,n=p[1],t.length--);let m=e?.[0]==="{}";return e=i(m?["{",e[1]]:e),l=>(...a)=>{let y={};t.forEach((E,w)=>y[E]=a[w]),n&&(y[n]=a.slice(o));let g=new Proxy(y,{get:(E,w)=>w in E?E[w]:l?.[w],set:(E,w,R)=>((w in E?E:l)[w]=R,!0),has:(E,w)=>w in E||(l?w in l:!1)});try{let E=e(g);return m?void 0:E}catch(E){if(E===P)return E[0];throw E}}});f("...",r=>(r=i(r),e=>Object.entries(r(e))));f("?.",(r,e)=>(r=i(r),D(e)?()=>{}:t=>r(t)?.[e]));f("?.[]",(r,e)=>(r=i(r),e=i(e),t=>{let o=e(t);return D(o)?void 0:r(t)?.[o]}));f("?.()",(r,e)=>{let t=e?e[0]===","?(e=e.slice(1).map(i),n=>e.map(p=>p(n))):(e=i(e),n=>[e(n)]):()=>[];if(r[0]==="?."){let n=i(r[1]),p=r[2];return D(p)?()=>{}:m=>n(m)?.[p]?.(...t(m))}if(r[0]==="?.[]"){let n=i(r[1]),p=i(r[2]);return m=>{let l=n(m),a=p(m);return D(a)?void 0:l?.[a]?.(...t(m))}}if(r[0]==="."){let n=i(r[1]),p=r[2];return D(p)?()=>{}:m=>n(m)?.[p]?.(...t(m))}if(r[0]==="[]"&&r.length===3){let n=i(r[1]),p=i(r[2]);return m=>{let l=n(m),a=p(m);return D(a)?void 0:l?.[a]?.(...t(m))}}let o=i(r);return n=>o(n)?.(...t(n))});f("typeof",r=>(r=i(r),e=>typeof r(e)));f("void",r=>(r=i(r),e=>(r(e),void 0)));f("delete",r=>{if(r[0]==="."){let e=i(r[1]),t=r[2];return o=>delete e(o)[t]}if(r[0]==="[]"){let e=i(r[1]),t=i(r[2]);return o=>delete e(o)[t(o)]}return()=>!0});f("new",r=>{let e=i(r?.[0]==="()"?r[1]:r),t=r?.[0]==="()"?r[2]:null,o=t?t[0]===","?(n=>p=>n.map(m=>m(p)))(t.slice(1).map(i)):(n=>p=>[n(p)])(i(t)):()=>[];return n=>new(e(n))(...o(n))});var ir=Symbol("accessor");f("get",(r,e)=>(e=e?i(e):()=>{},t=>[[ir,r,{get:function(){let o=Object.create(t||{});return o.this=this,e(o)}}]]));f("set",(r,e,t)=>(t=t?i(t):()=>{},o=>[[ir,r,{set:function(n){let p=Object.create(o||{});p.this=this,p[e]=n,t(p)}}]]));var qt=r=>r==null||typeof r=="string"||[":",",","...","get","set"].includes(r[0]);f("{}",(r,e)=>{if(e!==void 0)return;if(!qt(r))return i(["{",r]);r=r?r[0]!==","?[r]:r.slice(1):[];let t=r.map(o=>i(typeof o=="string"?[":",o,o]:o));return o=>{let n={},p={};for(let m of t.flatMap(l=>l(o)))if(m[0]===ir){let[,l,a]=m;p[l]={...p[l],...a,configurable:!0,enumerable:!0}}else n[m[0]]=m[1];for(let m in p)Object.defineProperty(n,m,p[m]);return n}});f("{",r=>(r=r?i(r):()=>{},e=>r(Object.create(e))));f(":",(r,e)=>(e=i(e),Array.isArray(r)?(r=i(r),t=>[[r(t),e(t)]]):t=>[[r,e(t)]]));f("`",(...r)=>(r=r.map(i),e=>r.map(t=>t(e)).join("")));f("``",(r,...e)=>{r=i(r);let t=[],o=[];for(let p of e)Array.isArray(p)&&p[0]===void 0?t.push(p[1]):o.push(i(p));let n=Object.assign([...t],{raw:t});return p=>r(p)(n,...o.map(m=>m(p)))});f("function",(r,e,t)=>{t=t?i(t):()=>{};let o=e?e[0]===","?e.slice(1):[e]:[],n=null,p=-1,m=o[o.length-1];return Array.isArray(m)&&m[0]==="..."&&(p=o.length-1,n=m[1],o.length--),l=>{let a=(...y)=>{let g={};o.forEach((w,R)=>g[w]=y[R]),n&&(g[n]=y.slice(p));let E=new Proxy(g,{get:(w,R)=>R in w?w[R]:l[R],set:(w,R,Se)=>((R in w?w:l)[R]=Se,!0),has:(w,R)=>R in w||R in l});try{return t(E)}catch(w){if(w===P)return w[0];throw w}};return r&&(l[r]=a),a}});f("function*",(r,e,t)=>{throw Error("Generator functions are not supported in evaluation")});f("async",r=>{let e=i(r);return t=>{let o=e(t);return async function(...n){return o(...n)}}});f("await",r=>(r=i(r),async e=>await r(e)));f("yield",r=>(r=r?i(r):null,e=>{throw{__yield__:r?r(e):void 0}}));f("yield*",r=>(r=i(r),e=>{throw{__yield_all__:r(e)}}));var xt=Symbol("static"),bt=r=>{throw Error(r)};f("instanceof",(r,e)=>(r=i(r),e=i(e),t=>r(t)instanceof e(t)));f("class",(r,e,t)=>(e=e?i(e):null,t=t?i(t):null,o=>{let n=e?e(o):Object,p=function(...m){if(!(this instanceof p))return bt("Class constructor must be called with new");let l=e?Reflect.construct(n,m,p):this;return p.prototype.__constructor__&&p.prototype.__constructor__.apply(l,m),l};if(Object.setPrototypeOf(p.prototype,n.prototype),Object.setPrototypeOf(p,n),t){let m=Object.create(o);m.super=n;let l=t(m),a=Array.isArray(l)&&typeof l[0]?.[0]=="string"?l:[];for(let[y,g]of a)y==="constructor"?p.prototype.__constructor__=g:p.prototype[y]=g}return r&&(o[r]=p),p}));f("static",r=>(r=i(r),e=>[[xt,r(e)]]));f("//",(r,e)=>{let t=new RegExp(r,e||"");return()=>t});f("if",(r,e,t)=>(r=i(r),e=i(e),t=t!==void 0?i(t):null,o=>r(o)?e(o):t?.(o)));var M=Symbol("break"),X=Symbol("continue");f("while",(r,e)=>(r=i(r),e=i(e),t=>{let o;for(;r(t);)try{o=e(t)}catch(n){if(n===M)break;if(n===X)continue;if(n===P)return n[0];throw n}return o}));f("do",(r,e)=>(r=i(r),e=i(e),t=>{let o;do try{o=r(t)}catch(n){if(n===M)break;if(n===X)continue;if(n===P)return n[0];throw n}while(e(t));return o}));f("for",(r,e)=>{if(Array.isArray(r)&&r[0]===";"){let[,t,o,n]=r;return t=t?i(t):null,o=o?i(o):()=>!0,n=n?i(n):null,e=i(e),p=>{let m;for(t?.(p);o(p);n?.(p))try{m=e(p)}catch(l){if(l===M)break;if(l===X)continue;if(l===P)return l[0];throw l}return m}}if(Array.isArray(r)&&(r[0]==="in"||r[0]==="of")){let[t,o,n]=r;if(Array.isArray(o)&&(o[0]==="let"||o[0]==="const"||o[0]==="var")&&(o=o[1]),t==="in")return eo(o,n,e);if(t==="of")return ro(o,n,e)}});var ro=(r,e,t)=>{e=i(e),t=i(t);let o=Array.isArray(r);return n=>{let p,m=o?null:n[r];for(let l of e(n)){o?K(r,l,n):n[r]=l;try{p=t(n)}catch(a){if(a===M)break;if(a===X)continue;if(a===P)return a[0];throw a}}return o||(n[r]=m),p}},eo=(r,e,t)=>{e=i(e),t=i(t);let o=Array.isArray(r);return n=>{let p,m=o?null:n[r];for(let l in e(n)){o?K(r,l,n):n[r]=l;try{p=t(n)}catch(a){if(a===M)break;if(a===X)continue;if(a===P)return a[0];throw a}}return o||(n[r]=m),p}};f("break",()=>()=>{throw M});f("continue",()=>()=>{throw X});f("return",r=>(r=r!==void 0?i(r):null,e=>{throw P[0]=r?.(e),P}));f("try",(r,...e)=>{r=r?i(r):null;let t=e.find(l=>l?.[0]==="catch"),o=e.find(l=>l?.[0]==="finally"),n=t?.[1],p=t?.[2]?i(t[2]):null,m=o?.[1]?i(o[1]):null;return l=>{let a;try{a=r?.(l)}catch(y){if(y===M||y===X||y===P)throw y;if(n!=null&&p){let g=n in l,E=l[n];l[n]=y;try{a=p(l)}finally{g?l[n]=E:delete l[n]}}else if(!p)throw y}finally{m?.(l)}return a}});f("throw",r=>(r=i(r),e=>{throw r(e)}));f("switch",(r,...e)=>(r=i(r),e.length?(e=e.map(t=>[t[0]==="case"?i(t[1]):null,(t[0]==="case"?t[2]:t[1])?.[0]===";"?(t[0]==="case"?t[2]:t[1]).slice(1).map(i):(t[0]==="case"?t[2]:t[1])?[i(t[0]==="case"?t[2]:t[1])]:[]]),t=>{let o=r(t),n=!1,p;for(let[l,a]of e)if(n||l===null||l(t)===o)for(n=!0,m=0;m<a.length;m++)try{p=a[m](t)}catch(y){if(y===M)return p;throw y}var m;return p}):t=>r(t)));f("import",()=>()=>{});f("export",()=>()=>{});f("from",(r,e)=>()=>{});f("as",(r,e)=>()=>{});f("default",r=>i(r));var ge=new WeakMap,to=(r,...e)=>typeof r=="string"?i(s(r)):ge.get(r)||ge.set(r,oo(r,e)).get(r),Ee=57344,oo=(r,e)=>{let t=r.reduce((p,m,l)=>p+(l?String.fromCharCode(Ee+l-1):"")+m,""),o=s(t),n=p=>{if(typeof p=="string"&&p.length===1){let m=p.charCodeAt(0)-Ee,l;if(m>=0&&m<e.length)return l=e[m],no(l)?l:[,l]}return Array.isArray(p)?p.map(n):p};return i(n(o))},no=r=>typeof r=="string"||Array.isArray(r)&&(typeof r[0]=="string"||r[0]===void 0),io=to;export{fr as access,A as binary,i as compile,c as cur,io as default,N as err,d as expr,W as group,so as id,u as idx,C as keyword,Q as literal,Mr as loc,I as lookup,Ur as member,pr as nary,T as next,f as operator,sr as operators,L as parens,s as parse,j as peek,G as prec,lr as propName,O as seek,h as skip,S as token,_ as unary,k as word};
package/justin.min.js CHANGED
@@ -1,8 +1,8 @@
1
- var u,l,d=r=>(u=0,l=r,d.enter?.(),r=y(),l[u]?v():r||""),v=(r="Unexpected token",t=u,e=l.slice(0,t).split(`
2
- `),o=e.pop(),i=l.slice(Math.max(0,t-40),t),p="\u032D",m=(l[t]||" ")+p,f=l.slice(t+1,t+20))=>{throw SyntaxError(`${r} at ${e.length+1}:${o.length+1}
1
+ var u,l,d=r=>(u=0,l=r,d.enter?.(),r=C(),l[u]?N():r||""),N=(r="Unexpected token",t=u,e=l.slice(0,t).split(`
2
+ `),o=e.pop(),i=l.slice(Math.max(0,t-40),t),s="\u032D",m=(l[t]||" ")+s,f=l.slice(t+1,t+20))=>{throw SyntaxError(`${r} at ${e.length+1}:${o.length+1}
3
3
  ${l[t-41]!==`
4
- `,""+i}${m}${f}`)},ir=(r,t=u)=>(Array.isArray(r)&&(r.loc=t),r),L=(r,t=u,e)=>{for(;e=r(l.charCodeAt(u));)u+=e;return l.slice(t,u)},C=(r=1)=>l[u+=r],M=r=>u=r,y=(r=0,t)=>{let e,o,i;for(t&&d.enter?.(r,t);(e=d.space())&&e!==t&&(i=d.step(o,r,e,y));)o=i;return t&&(e==t?(u++,d.exit?.(r,t)):v("Unclosed "+String.fromCharCode(t-(t>42?2:1)))),o},sr=(r=u)=>{for(;l.charCodeAt(r)<=32;)r++;return l.charCodeAt(r)},Lt=d.id=r=>r>=48&&r<=57||r>=65&&r<=90||r>=97&&r<=122||r==36||r==95||r>=192&&r!=215&&r!=247,pr=(r,t=r.length)=>l.substr(u,t)===r&&!d.id(l.charCodeAt(u+t)),Pt=()=>(C(),y(0,41)),w=[],nr={},I=(r,t=32,e,o=r.charCodeAt(0),i=r.length,p=w[o],m=r.toUpperCase()!==r,f,A)=>(t=nr[r]=!p&&nr[r]||t,w[o]=(h,S,g,E=u)=>(f=g,(g?r==g:(i<2||r.charCodeAt(1)===l.charCodeAt(u+1)&&(i<3||l.substr(u,i)==r))&&(!m||!d.id(l.charCodeAt(u+i)))&&(f=g=r))&&S<t&&(u+=i,(A=e(h))?ir(A,E):(u=E,f=0,!m&&!p&&!h&&v()),A)||p?.(h,S,f))),c=(r,t,e=!1)=>I(r,t,o=>o&&(i=>i&&[r,o,i])(y(t-(e?.5:0)))),k=(r,t,e)=>I(r,t,o=>e?o&&[r,o]:!o&&(o=y(t-.5))&&[r,o]),P=(r,t)=>I(r,200,e=>!e&&[,t]),J=(r,t,e)=>I(r,t,(o,i)=>(i=y(t-(e?.5:0)),o?.[0]!==r&&(o=[r,o||null]),i?.[0]===r?o.push(...i.slice(1)):o.push(i||null),o)),U=(r,t)=>I(r[0],t,e=>!e&&[r,y(0,r.charCodeAt(1))||null]),V=(r,t)=>I(r[0],t,e=>e&&[r,e,y(0,r.charCodeAt(1))||null]),D=(r,t,e,o=r.charCodeAt(0),i=r.length,p=w[o],m)=>w[o]=(f,A,h,S=u)=>!f&&(h?r==h:(i<2||l.substr(u,i)==r)&&(h=r))&&A<t&&!d.id(l.charCodeAt(u+i))&&(!d.prop||d.prop(u+i))&&(M(u+i),(m=e())?ir(m,S):M(S),m)||p?.(f,A,h);d.space=r=>{for(;(r=l.charCodeAt(u))<=32;)u++;return r};d.step=(r,t,e,o,i)=>(i=w[e])&&i(r,t)||(r?null:L(d.id)||null);var z={},s=(r,t,e=z[r])=>z[r]=(...o)=>t(...o)||e?.(...o),n=r=>Array.isArray(r)?r[0]==null?(t=>()=>t)(r[1]):z[r[0]]?.(...r.slice(1))??v(`Unknown operator: ${r[0]}`,r?.loc):r===void 0?()=>{}:t=>t?.[r];var G=46,_=48,X=57,Ur=69,_r=101,Br=43,ar=45,F=95,mr=110,Mr=97,Dr=102,Fr=65,Gr=70,fr=r=>r.indexOf("_")<0?r:r.replaceAll("_",""),Y=r=>{let t=fr(L(e=>e===G&&l.charCodeAt(u+1)!==G||e>=_&&e<=X||e===F||((e===Ur||e===_r)&&((e=l.charCodeAt(u+1))>=_&&e<=X||e===Br||e===ar)?2:0)));return l.charCodeAt(u)===mr?(C(),[,BigInt(t)]):(r=+t)!=r?v():[,r]},Xr={2:r=>r===48||r===49||r===F,8:r=>r>=48&&r<=55||r===F,16:r=>r>=_&&r<=X||r>=Mr&&r<=Dr||r>=Fr&&r<=Gr||r===F};d.number=null;w[G]=r=>!r&&l.charCodeAt(u+1)!==G&&Y();for(let r=_;r<=X;r++)w[r]=t=>t?void 0:Y();w[_]=r=>{if(r)return;let t=d.number;if(t){for(let[e,o]of Object.entries(t))if(e[0]==="0"&&l[u+1]?.toLowerCase()===e[1]){C(2);let i=fr(L(Xr[o]));return l.charCodeAt(u)===mr?(C(),[,BigInt("0"+e[1]+i)]):[,parseInt(i,o)]}}return Y()};var $r=92,ur=34,lr=39,cr=117,dr=120,Qr=123,Hr=125,Ar=10,jr=13,Kr={n:`
5
- `,r:"\r",t:" ",b:"\b",f:"\f",v:"\v",0:"\0"},hr=r=>r>=48&&r<=57?r-48:r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:-1,gr=r=>(t,e,o="",i=String.fromCharCode(r))=>{if(t||!d.string?.[i])return;C();let p=()=>{let m=l.charCodeAt(u+1);if(m===Ar)return 2;if(m===jr)return l.charCodeAt(u+2)===Ar?3:2;if(m===dr||m===cr&&l.charCodeAt(u+2)!==Qr){let f=m===dr?2:4,A=0,h;for(let S=0;S<f;S++){if((h=hr(l.charCodeAt(u+2+S)))<0)return o+=l[u+1],2;A=A*16+h}return o+=String.fromCharCode(A),2+f}if(m===cr){let f=0,A=u+3,h;for(;(h=hr(l.charCodeAt(A)))>=0;)f=f*16+h,A++;return A>u+3&&f<=1114111&&l.charCodeAt(A)===Hr?(o+=String.fromCodePoint(f),A-u+1):(o+=l[u+1],2)}return o+=Kr[l[u+1]]||l[u+1],2};return L(m=>m-r&&(m!==$r?(o+=l[u],1):p())),l[u]===i?C():v("Bad string"),[,o]};w[ur]=gr(ur);w[lr]=gr(lr);d.string={'"':!0};var Wr=20;"= += -= *= /= %= |= &= ^= >>= <<=".split(" ").map(r=>c(r,Wr,!0));var zr=30,Jr=40,Vr=140;k("!",Vr);c("||",zr);c("&&",Jr);var Yr=50,Zr=60,qr=70,yr=100,xr=140;c("|",Yr);c("&",qr);c("^",Zr);c(">>",yr);c("<<",yr);k("~",xr);var $=90;c("<",$);c(">",$);c("<=",$);c(">=",$);var Cr=80;c("==",Cr);c("!=",Cr);var Sr=110,Z=120,Er=140;c("+",Sr);c("-",Sr);c("*",Z);c("/",Z);c("%",Z);k("+",Er);k("-",Er);var Q=150;I("++",Q,r=>r?["++",r,null]:["++",y(Q-1)]);I("--",Q,r=>r?["--",r,null]:["--",y(Q-1)]);var br=5,rt=10;J(",",rt);J(";",br,!0);var tt=170;U("()",tt);var q=170;V("[]",q);c(".",q);V("()",q);var et=32,ot=d.space;d.comment??={"//":`
6
- `,"/*":"*/"};var x;d.space=()=>{x||(x=Object.entries(d.comment).map(([i,p])=>[i,p,i.charCodeAt(0)]));for(var r;r=ot();){for(var t=0,e;e=x[t++];)if(r===e[2]&&l.substr(u,e[0].length)===e[0]){var o=u+e[0].length;if(e[1]===`
7
- `)for(;l.charCodeAt(o)>=et;)o++;else{for(;l[o]&&l.substr(o,e[1].length)!==e[1];)o++;l[o]&&(o+=e[1].length)}M(o),r=0;break}if(r)return r}return r};var wr=80;c("===",wr);c("!==",wr);var nt=30;c("??",nt);var it=130,st=20;c("**",it,!0);c("**=",st,!0);var Ir=90;c("in",Ir);c("of",Ir);var pt=20,mt=100;c(">>>",mt);c(">>>=",pt,!0);var b=20;c("||=",b,!0);c("&&=",b,!0);c("??=",b,!0);P("true",!0);P("false",!1);P("null",null);D("undefined",200,()=>[]);P("NaN",NaN);P("Infinity",1/0);var rr=20;I("?",rr,(r,t,e)=>r&&(t=y(rr-1))&&L(o=>o===58)&&(e=y(rr-1),["?",r,t,e]));var ft=20;c("=>",ft,!0);var ut=20;k("...",ut);var kr=170;I("?.",kr,(r,t)=>{if(!r)return;let e=d.space();return e===40?(C(),["?.()",r,y(0,41)||null]):e===91?(C(),["?.[]",r,y(0,93)]):(t=y(kr),t?["?.",r,t]:void 0)});var B=140;k("typeof",B);k("void",B);k("delete",B);D("new",B,()=>pr(".target")?(C(7),["new.target"]):["new",y(B)]);var lt=20,vr=200;d.prop=r=>sr(r)!==58;U("[]",vr);U("{}",vr);c(":",lt-1,!0);var ct=170,H=96,dt=36,At=123,ht=92,gt={n:`
8
- `,r:"\r",t:" ",b:"\b",f:"\f",v:"\v"},Nr=()=>{let r=[];for(let t="",e;(e=l.charCodeAt(u))!==H;)e?e===ht?(C(),t+=gt[l[u]]||l[u],C()):e===dt&&l.charCodeAt(u+1)===At?(t&&r.push([,t]),t="",C(2),r.push(y(0,125))):(t+=l[u],C(),e=l.charCodeAt(u),e===H&&t&&r.push([,t])):v("Unterminated template");return C(),r},yt=r=>r.length<2&&r[0]?.[0]===void 0?r[0]||[,""]:["`",...r],Ct=w[H];w[H]=(r,t)=>r&&t<ct?d.asi&&d.newline?void 0:(C(),["``",r,...Nr()]):r?Ct?.(r,t):(C(),yt(Nr()));d.string["'"]=!0;d.number={"0x":16,"0b":2,"0o":8};var Rr=(r,t,e,o)=>typeof r=="string"?i=>t(i,r,i):r[0]==="."?(e=n(r[1]),o=r[2],i=>t(e(i),o,i)):r[0]==="[]"&&r.length===3?(e=n(r[1]),o=n(r[2]),i=>t(e(i),o(i),i)):r[0]==="()"&&r.length===2?Rr(r[1],t):(()=>{throw Error("Invalid assignment target")})(),Or={"=":(r,t,e)=>r[t]=e,"+=":(r,t,e)=>r[t]+=e,"-=":(r,t,e)=>r[t]-=e,"*=":(r,t,e)=>r[t]*=e,"/=":(r,t,e)=>r[t]/=e,"%=":(r,t,e)=>r[t]%=e,"|=":(r,t,e)=>r[t]|=e,"&=":(r,t,e)=>r[t]&=e,"^=":(r,t,e)=>r[t]^=e,">>=":(r,t,e)=>r[t]>>=e,"<<=":(r,t,e)=>r[t]<<=e};for(let r in Or)s(r,(t,e)=>(e=n(e),Rr(t,(o,i,p)=>Or[r](o,i,e(p)))));s("!",r=>(r=n(r),t=>!r(t)));s("||",(r,t)=>(r=n(r),t=n(t),e=>r(e)||t(e)));s("&&",(r,t)=>(r=n(r),t=n(t),e=>r(e)&&t(e)));s("~",r=>(r=n(r),t=>~r(t)));s("|",(r,t)=>(r=n(r),t=n(t),e=>r(e)|t(e)));s("&",(r,t)=>(r=n(r),t=n(t),e=>r(e)&t(e)));s("^",(r,t)=>(r=n(r),t=n(t),e=>r(e)^t(e)));s(">>",(r,t)=>(r=n(r),t=n(t),e=>r(e)>>t(e)));s("<<",(r,t)=>(r=n(r),t=n(t),e=>r(e)<<t(e)));s(">",(r,t)=>(r=n(r),t=n(t),e=>r(e)>t(e)));s("<",(r,t)=>(r=n(r),t=n(t),e=>r(e)<t(e)));s(">=",(r,t)=>(r=n(r),t=n(t),e=>r(e)>=t(e)));s("<=",(r,t)=>(r=n(r),t=n(t),e=>r(e)<=t(e)));s("==",(r,t)=>(r=n(r),t=n(t),e=>r(e)==t(e)));s("!=",(r,t)=>(r=n(r),t=n(t),e=>r(e)!=t(e)));s("+",(r,t)=>t!==void 0?(r=n(r),t=n(t),e=>r(e)+t(e)):(r=n(r),e=>+r(e)));s("-",(r,t)=>t!==void 0?(r=n(r),t=n(t),e=>r(e)-t(e)):(r=n(r),e=>-r(e)));s("*",(r,t)=>(r=n(r),t=n(t),e=>r(e)*t(e)));s("/",(r,t)=>(r=n(r),t=n(t),e=>r(e)/t(e)));s("%",(r,t)=>(r=n(r),t=n(t),e=>r(e)%t(e)));var tr=(r,t,e,o)=>typeof r=="string"?i=>t(i,r):r[0]==="."?(e=n(r[1]),o=r[2],i=>t(e(i),o)):r[0]==="[]"&&r.length===3?(e=n(r[1]),o=n(r[2]),i=>t(e(i),o(i))):r[0]==="()"&&r.length===2?tr(r[1],t):(()=>{throw Error("Invalid increment target")})();s("++",(r,t)=>tr(r,t===null?(e,o)=>e[o]++:(e,o)=>++e[o]));s("--",(r,t)=>tr(r,t===null?(e,o)=>e[o]--:(e,o)=>--e[o]));var Lr=(...r)=>(r=r.map(n),t=>{let e;for(let o of r)e=o(t);return e});s(",",Lr);s(";",Lr);var O=r=>r?.[0]==="_"&&r[1]==="_"||r==="constructor"||r==="prototype",j=r=>{throw Error(r)};s("[]",(r,t)=>t===void 0?(r=r?r[0]===","?r.slice(1):[r]:[],r=r.map(e=>e==null?(()=>{}):e[0]==="..."?(e=n(e[1]),o=>e(o)):(e=n(e),o=>[e(o)])),e=>r.flatMap(o=>o(e))):(t==null&&j("Missing index"),r=n(r),t=n(t),e=>{let o=t(e);return O(o)?void 0:r(e)[o]}));s(".",(r,t)=>(r=n(r),t=t[0]?t:t[1],O(t)?()=>{}:e=>r(e)[t]));s("()",(r,t)=>{if(t===void 0)return r==null?j("Empty ()"):n(r);let e=i=>i?.[0]===","&&i.slice(1).some(p=>p==null||e(p));e(t)&&j("Empty argument");let o=t?t[0]===","?(t=t.slice(1).map(n),i=>t.map(p=>p(i))):(t=n(t),i=>[t(i)]):()=>[];return er(r,(i,p,m)=>i[p](...o(m)))});var N=r=>typeof r=="string"||Array.isArray(r)&&(r[0]==="."||r[0]==="?."||r[0]==="[]"&&r.length===3||r[0]==="?.[]"||r[0]==="()"&&r.length===2&&N(r[1])||r[0]==="{}"),er=(r,t,e,o)=>r==null?j("Empty ()"):r[0]==="()"&&r.length==2?er(r[1],t):typeof r=="string"?i=>t(i,r,i):r[0]==="."?(e=n(r[1]),o=r[2],i=>t(e(i),o,i)):r[0]==="?."?(e=n(r[1]),o=r[2],i=>{let p=e(i);return p==null?void 0:t(p,o,i)}):r[0]==="[]"&&r.length===3?(e=n(r[1]),o=n(r[2]),i=>t(e(i),o(i),i)):r[0]==="?.[]"?(e=n(r[1]),o=n(r[2]),i=>{let p=e(i);return p==null?void 0:t(p,o(i),i)}):(r=n(r),i=>t([r(i)],0,i)),R=er;s("===",(r,t)=>(r=n(r),t=n(t),e=>r(e)===t(e)));s("!==",(r,t)=>(r=n(r),t=n(t),e=>r(e)!==t(e)));s("??",(r,t)=>(r=n(r),t=n(t),e=>r(e)??t(e)));var St=r=>{throw Error(r)};s("**",(r,t)=>(r=n(r),t=n(t),e=>r(e)**t(e)));s("**=",(r,t)=>(N(r)||St("Invalid assignment target"),t=n(t),R(r,(e,o,i)=>e[o]**=t(i))));s("in",(r,t)=>(r=n(r),t=n(t),e=>r(e)in t(e)));var Et=r=>{throw Error(r)};s(">>>",(r,t)=>(r=n(r),t=n(t),e=>r(e)>>>t(e)));s(">>>=",(r,t)=>(N(r)||Et("Invalid assignment target"),t=n(t),R(r,(e,o,i)=>e[o]>>>=t(i))));var wt=r=>r[0]?.[0]===","?r[0].slice(1):r,a=(r,t,e)=>{if(typeof r=="string"){e[r]=t;return}let[o,...i]=r,p=wt(i);if(o==="{}"){let m=[];for(let f of p){if(Array.isArray(f)&&f[0]==="..."){let E={};for(let T in t)m.includes(T)||(E[T]=t[T]);e[f[1]]=E;break}let A,h,S;typeof f=="string"?A=h=f:f[0]==="="?(typeof f[1]=="string"?A=h=f[1]:[,A,h]=f[1],S=f[2]):[,A,h]=f,m.push(A);let g=t[A];g===void 0&&S&&(g=n(S)(e)),a(h,g,e)}}else if(o==="[]"){let m=0;for(let f of p){if(f===null){m++;continue}if(Array.isArray(f)&&f[0]==="..."){e[f[1]]=t.slice(m);break}let A=f,h;Array.isArray(f)&&f[0]==="="&&([,A,h]=f);let S=t[m++];S===void 0&&h&&(S=n(h)(e)),a(A,S,e)}}},or=(...r)=>(r=r.map(t=>{if(typeof t=="string")return e=>{e[t]=void 0};if(t[0]==="="){let[,e,o]=t,i=n(o);return typeof e=="string"?p=>{p[e]=i(p)}:p=>a(e,i(p),p)}return n(t)}),t=>{for(let e of r)e(t)});s("let",or);s("const",or);s("var",or);var K=r=>{throw Error(r)};s("=",(r,t)=>{if(Array.isArray(r)&&(r[0]==="let"||r[0]==="const"||r[0]==="var")){let e=r[1];return t=n(t),typeof e=="string"?o=>{o[e]=t(o)}:o=>a(e,t(o),o)}return N(r)||K("Invalid assignment target"),t=n(t),R(r,(e,o,i)=>e[o]=t(i))});s("||=",(r,t)=>(N(r)||K("Invalid assignment target"),t=n(t),R(r,(e,o,i)=>e[o]||=t(i))));s("&&=",(r,t)=>(N(r)||K("Invalid assignment target"),t=n(t),R(r,(e,o,i)=>e[o]&&=t(i))));s("??=",(r,t)=>(N(r)||K("Invalid assignment target"),t=n(t),R(r,(e,o,i)=>e[o]??=t(i))));s("?",(r,t,e)=>(r=n(r),t=n(t),e=n(e),o=>r(o)?t(o):e(o)));var It=[];s("=>",(r,t)=>{r=r?.[0]==="()"?r[1]:r;let e=r?r[0]===","?r.slice(1):[r]:[],o=-1,i=null,p=e[e.length-1];Array.isArray(p)&&p[0]==="..."&&(o=e.length-1,i=p[1],e.length--);let m=t?.[0]==="{}";return t=n(m?["{",t[1]]:t),f=>(...A)=>{let h={};e.forEach((g,E)=>h[g]=A[E]),i&&(h[i]=A.slice(o));let S=new Proxy(h,{get:(g,E)=>E in g?g[E]:f?.[E],set:(g,E,T)=>((E in g?g:f)[E]=T,!0),has:(g,E)=>E in g||(f?E in f:!1)});try{let g=t(S);return m?void 0:g}catch(g){if(g===It)return g[0];throw g}}});s("...",r=>(r=n(r),t=>Object.entries(r(t))));s("?.",(r,t)=>(r=n(r),O(t)?()=>{}:e=>r(e)?.[t]));s("?.[]",(r,t)=>(r=n(r),t=n(t),e=>{let o=t(e);return O(o)?void 0:r(e)?.[o]}));s("?.()",(r,t)=>{let e=t?t[0]===","?(t=t.slice(1).map(n),i=>t.map(p=>p(i))):(t=n(t),i=>[t(i)]):()=>[];if(r[0]==="?."){let i=n(r[1]),p=r[2];return O(p)?()=>{}:m=>i(m)?.[p]?.(...e(m))}if(r[0]==="?.[]"){let i=n(r[1]),p=n(r[2]);return m=>{let f=i(m),A=p(m);return O(A)?void 0:f?.[A]?.(...e(m))}}if(r[0]==="."){let i=n(r[1]),p=r[2];return O(p)?()=>{}:m=>i(m)?.[p]?.(...e(m))}if(r[0]==="[]"&&r.length===3){let i=n(r[1]),p=n(r[2]);return m=>{let f=i(m),A=p(m);return O(A)?void 0:f?.[A]?.(...e(m))}}let o=n(r);return i=>o(i)?.(...e(i))});s("typeof",r=>(r=n(r),t=>typeof r(t)));s("void",r=>(r=n(r),t=>(r(t),void 0)));s("delete",r=>{if(r[0]==="."){let t=n(r[1]),e=r[2];return o=>delete t(o)[e]}if(r[0]==="[]"){let t=n(r[1]),e=n(r[2]);return o=>delete t(o)[e(o)]}return()=>!0});s("new",r=>{let t=n(r?.[0]==="()"?r[1]:r),e=r?.[0]==="()"?r[2]:null,o=e?e[0]===","?(i=>p=>i.map(m=>m(p)))(e.slice(1).map(n)):(i=>p=>[i(p)])(n(e)):()=>[];return i=>new(t(i))(...o(i))});var W=Symbol("accessor");s("get",(r,t)=>(t=t?n(t):()=>{},e=>[[W,r,{get:function(){let o=Object.create(e||{});return o.this=this,t(o)}}]]));s("set",(r,t,e)=>(e=e?n(e):()=>{},o=>[[W,r,{set:function(i){let p=Object.create(o||{});p.this=this,p[t]=i,e(p)}}]]));var kt=r=>r==null||typeof r=="string"||[":",",","...","get","set"].includes(r[0]);s("{}",(r,t)=>{if(t!==void 0)return;if(!kt(r))return n(["{",r]);r=r?r[0]!==","?[r]:r.slice(1):[];let e=r.map(o=>n(typeof o=="string"?[":",o,o]:o));return o=>{let i={},p={};for(let m of e.flatMap(f=>f(o)))if(m[0]===W){let[,f,A]=m;p[f]={...p[f],...A,configurable:!0,enumerable:!0}}else i[m[0]]=m[1];for(let m in p)Object.defineProperty(i,m,p[m]);return i}});s("{",r=>(r=r?n(r):()=>{},t=>r(Object.create(t))));s(":",(r,t)=>(t=n(t),Array.isArray(r)?(r=n(r),e=>[[r(e),t(e)]]):e=>[[r,t(e)]]));s("`",(...r)=>(r=r.map(n),t=>r.map(e=>e(t)).join("")));s("``",(r,...t)=>{r=n(r);let e=[],o=[];for(let p of t)Array.isArray(p)&&p[0]===void 0?e.push(p[1]):o.push(n(p));let i=Object.assign([...e],{raw:e});return p=>r(p)(i,...o.map(m=>m(p)))});var Pr=new WeakMap,vt=(r,...t)=>typeof r=="string"?n(d(r)):Pr.get(r)||Pr.set(r,Nt(r,t)).get(r),Tr=57344,Nt=(r,t)=>{let e=r.reduce((p,m,f)=>p+(f?String.fromCharCode(Tr+f-1):"")+m,""),o=d(e),i=p=>{if(typeof p=="string"&&p.length===1){let m=p.charCodeAt(0)-Tr,f;if(m>=0&&m<t.length)return f=t[m],Ot(f)?f:[,f]}return Array.isArray(p)?p.map(i):p};return n(i(o))},Ot=r=>typeof r=="string"||Array.isArray(r)&&(typeof r[0]=="string"||r[0]===void 0),Rt=vt;export{V as access,c as binary,n as compile,l as cur,Rt as default,v as err,y as expr,U as group,Lt as id,u as idx,D as keyword,P as literal,ir as loc,w as lookup,J as nary,L as next,s as operator,z as operators,Pt as parens,d as parse,sr as peek,nr as prec,M as seek,C as skip,I as token,k as unary,pr as word};
4
+ `,""+i}${m}${f}`)},sr=(r,t=u)=>(Array.isArray(r)&&(r.loc=t),r),L=(r,t=u,e)=>{for(;e=r(l.charCodeAt(u));)u+=e;return l.slice(t,u)},y=(r=1)=>l[u+=r],B=r=>u=r,C=(r=0,t)=>{let e,o,i;for(t&&d.enter?.(r,t);(e=d.space())&&e!==t&&(i=d.step(o,r,e,C));)o=i;return t&&(e==t?(u++,d.exit?.(r,t)):N("Unclosed "+String.fromCharCode(t-(t>42?2:1)))),o},z=(r=u)=>{for(;l.charCodeAt(r)<=32;)r++;return l.charCodeAt(r)},Bt=d.id=r=>r>=48&&r<=57||r>=65&&r<=90||r>=97&&r<=122||r==36||r==95||r>=192&&r!=215&&r!=247,pr=(r,t=r.length)=>l.substr(u,t)===r&&!d.id(l.charCodeAt(u+t)),Mt=()=>(y(),C(0,41)),w=[],K={},I=(r,t=32,e,o=r.charCodeAt(0),i=r.length,s=w[o],m=r.toUpperCase()!==r,f,A)=>(t=K[r]=!s&&K[r]||t,w[o]=(h,S,g,E=u)=>(f=g,(g?r==g:(i<2||r.charCodeAt(1)===l.charCodeAt(u+1)&&(i<3||l.substr(u,i)==r))&&(!m||!d.id(l.charCodeAt(u+i)))&&(f=g=r))&&S<t&&(u+=i,(A=e(h))?sr(A,E):(u=E,f=0,!m&&!s&&!h&&N()),A)||s?.(h,S,f))),c=(r,t,e=!1)=>I(r,t,o=>o&&(i=>i&&[r,o,i])(C(t-(e?.5:0)))),k=(r,t,e)=>I(r,t,o=>e?o&&[r,o]:!o&&(o=C(t-.5))&&[r,o]),P=(r,t)=>I(r,200,e=>!e&&[,t]),J=(r,t,e,o)=>I(r,t,(i,s)=>(s=C(t-(e?.5:0)),i?.[0]!==r&&(i=[r,i||null]),s?.[0]===r?i.push(...s.slice(1)):s?i.push(s):(o||z()===r.charCodeAt(0))&&i.push(null),i)),a=(r,t)=>I(r[0],t,e=>!e&&[r,C(0,r.charCodeAt(1))||null]),V=(r,t)=>I(r[0],t,e=>e&&[r,e,C(0,r.charCodeAt(1))||null]),Y=(r,t)=>(d.space(),t=l.charCodeAt(u),d.id(t)&&(t<48||t>57)?L(d.id):C(r)),mr=(r,t)=>I(r,t,e=>e&&(o=>o&&[r,e,o])(Y(t))),M=(r,t,e,o=r.charCodeAt(0),i=r.length,s=w[o],m)=>(K[r]??=t,w[o]=(f,A,h,S=u)=>!f&&(h?r==h:(i<2||l.substr(u,i)==r)&&(h=r))&&A<t&&!d.id(l.charCodeAt(u+i))&&(!d.prop||d.prop(u+i))&&(B(u+i),(m=e())?sr(m,S):B(S),m)||s?.(f,A,h));d.space=r=>{for(;(r=l.charCodeAt(u))<=32;)u++;return r};d.step=(r,t,e,o,i)=>(i=w[e])&&i(r,t)||(r?null:L(d.id)||null);var W={},p=(r,t,e=W[r])=>W[r]=(...o)=>t(...o)||e?.(...o),n=r=>Array.isArray(r)?r[0]==null?(t=>()=>t)(r[1]):W[r[0]]?.(...r.slice(1))??N(`Unknown operator: ${r[0]}`,r?.loc):r===void 0?()=>{}:t=>t?.[r];var F=46,U=48,G=57,Br=69,Mr=101,Dr=43,Fr=45,D=95,fr=110,Gr=97,Xr=102,$r=65,Qr=70,ur=r=>r.indexOf("_")<0?r:r.replaceAll("_",""),Z=r=>{let t=ur(L(e=>e===F&&l.charCodeAt(u+1)!==F||e>=U&&e<=G||e===D||((e===Br||e===Mr)&&((e=l.charCodeAt(u+1))>=U&&e<=G||e===Dr||e===Fr)?2:0)));return l.charCodeAt(u)===fr?(y(),[,BigInt(t)]):(r=+t)!=r?N():[,r]},Hr={2:r=>r===48||r===49||r===D,8:r=>r>=48&&r<=55||r===D,16:r=>r>=U&&r<=G||r>=Gr&&r<=Xr||r>=$r&&r<=Qr||r===D};d.number=null;w[F]=r=>!r&&l.charCodeAt(u+1)!==F&&Z();for(let r=U;r<=G;r++)w[r]=t=>t?void 0:Z();w[U]=r=>{if(r)return;let t=d.number;if(t){for(let[e,o]of Object.entries(t))if(e[0]==="0"&&l[u+1]?.toLowerCase()===e[1]){y(2);let i=ur(L(Hr[o]));return l.charCodeAt(u)===fr?(y(),[,BigInt("0"+e[1]+i)]):[,parseInt(i,o)]}}return Z()};var jr=92,lr=34,cr=39,dr=117,Ar=120,Kr=123,Wr=125,hr=10,zr=13,Jr={n:`
5
+ `,r:"\r",t:" ",b:"\b",f:"\f",v:"\v",0:"\0"},gr=r=>r>=48&&r<=57?r-48:r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:-1,Cr=r=>(t,e,o="",i=String.fromCharCode(r))=>{if(t||!d.string?.[i])return;y();let s=()=>{let m=l.charCodeAt(u+1);if(m===hr)return 2;if(m===zr)return l.charCodeAt(u+2)===hr?3:2;if(m===Ar||m===dr&&l.charCodeAt(u+2)!==Kr){let f=m===Ar?2:4,A=0,h;for(let S=0;S<f;S++){if((h=gr(l.charCodeAt(u+2+S)))<0)return o+=l[u+1],2;A=A*16+h}return o+=String.fromCharCode(A),2+f}if(m===dr){let f=0,A=u+3,h;for(;(h=gr(l.charCodeAt(A)))>=0;)f=f*16+h,A++;return A>u+3&&f<=1114111&&l.charCodeAt(A)===Wr?(o+=String.fromCodePoint(f),A-u+1):(o+=l[u+1],2)}return o+=Jr[l[u+1]]||l[u+1],2};return L(m=>m-r&&(m!==jr?(o+=l[u],1):s())),l[u]===i?y():N("Bad string"),[,o]};w[lr]=Cr(lr);w[cr]=Cr(cr);d.string={'"':!0};var Vr=20;"= += -= *= /= %= |= &= ^= >>= <<=".split(" ").map(r=>c(r,Vr,!0));var Yr=30,Zr=40,qr=140;k("!",qr);c("||",Yr);c("&&",Zr);var xr=50,br=60,rt=70,yr=100,tt=140;c("|",xr);c("&",rt);c("^",br);c(">>",yr);c("<<",yr);k("~",tt);var X=90;c("<",X);c(">",X);c("<=",X);c(">=",X);var Sr=80;c("==",Sr);c("!=",Sr);var Er=110,q=120,wr=140;c("+",Er);c("-",Er);c("*",q);c("/",q);c("%",q);k("+",wr);k("-",wr);var $=150;I("++",$,r=>r?["++",r,null]:["++",C($-1)]);I("--",$,r=>r?["--",r,null]:["--",C($-1)]);var et=5,ot=10;J(",",ot);J(";",et,!0,!0);var nt=170;a("()",nt);var Ir=170,it=160;V("[]",Ir);mr(".",Ir);V("()",it);var st=32,pt=d.space;d.comment??={"//":`
6
+ `,"/*":"*/"};var x;d.space=()=>{x||(x=Object.entries(d.comment).map(([i,s])=>[i,s,i.charCodeAt(0)]));for(var r;r=pt();){for(var t=0,e;e=x[t++];)if(r===e[2]&&l.substr(u,e[0].length)===e[0]){var o=u+e[0].length;if(e[1]===`
7
+ `)for(;l.charCodeAt(o)>=st;)o++;else{for(;l[o]&&l.substr(o,e[1].length)!==e[1];)o++;l[o]&&(o+=e[1].length)}B(o),r=0;break}if(r)return r}return r};var kr=80;c("===",kr);c("!==",kr);var mt=30;c("??",mt);var ft=130,ut=20;c("**",ft,!0);c("**=",ut,!0);var Nr=90;c("in",Nr);c("of",Nr);var lt=20,ct=100;c(">>>",ct);c(">>>=",lt,!0);var b=20;c("||=",b,!0);c("&&=",b,!0);c("??=",b,!0);P("true",!0);P("false",!1);P("null",null);M("undefined",200,()=>[]);P("NaN",NaN);P("Infinity",1/0);var rr=20;I("?",rr,(r,t,e)=>r&&(t=C(rr-1))&&L(o=>o===58)&&(e=C(rr-1),["?",r,t,e]));var dt=20;c("=>",dt,!0);var At=20;k("...",At);var vr=170;I("?.",vr,(r,t)=>{if(!r)return;let e=d.space();return e===40?(y(),["?.()",r,C(0,41)||null]):e===91?(y(),["?.[]",r,C(0,93)]):(t=Y(vr),t?["?.",r,t]:void 0)});var tr=140,Lr=160,ht=Lr+1;k("typeof",tr);k("void",tr);k("delete",tr);var gt=r=>d.space()===40?(y(),["()",r,C(0,41)||null]):r;M("new",ht,()=>pr(".target")?(y(7),["new.target"]):["new",gt(C(Lr))]);var Ct=20,Or=200;d.prop=r=>z(r)!==58;a("[]",Or);a("{}",Or);c(":",Ct-1,!0);var yt=170,er=96,St=36,Et=123,wt=92,It={n:`
8
+ `,r:"\r",t:" ",b:"\b",f:"\f",v:"\v"},Rr=()=>{let r=[],t="",e;for(;(e=l.charCodeAt(u))!==er;)e?e===wt?(y(),t+=It[l[u]]||l[u],y()):e===St&&l.charCodeAt(u+1)===Et?(r.push([,t]),t="",y(2),r.push(C(0,125))):(t+=l[u],y()):N("Unterminated template");return r.push([,t]),y(),r},kt=r=>r.length<2&&r[0]?.[0]===void 0?r[0]||[,""]:["`",...r],Nt=w[er];w[er]=(r,t)=>r&&t<yt?d.asi&&d.newline?void 0:(y(),["``",r,...Rr()]):r?Nt?.(r,t):(y(),kt(Rr()));d.string["'"]=!0;d.number={"0x":16,"0b":2,"0o":8};var Tr=(r,t,e,o)=>typeof r=="string"?i=>t(i,r,i):r[0]==="."?(e=n(r[1]),o=r[2],i=>t(e(i),o,i)):r[0]==="[]"&&r.length===3?(e=n(r[1]),o=n(r[2]),i=>t(e(i),o(i),i)):r[0]==="()"&&r.length===2?Tr(r[1],t):(()=>{throw Error("Invalid assignment target")})(),Pr={"=":(r,t,e)=>r[t]=e,"+=":(r,t,e)=>r[t]+=e,"-=":(r,t,e)=>r[t]-=e,"*=":(r,t,e)=>r[t]*=e,"/=":(r,t,e)=>r[t]/=e,"%=":(r,t,e)=>r[t]%=e,"|=":(r,t,e)=>r[t]|=e,"&=":(r,t,e)=>r[t]&=e,"^=":(r,t,e)=>r[t]^=e,">>=":(r,t,e)=>r[t]>>=e,"<<=":(r,t,e)=>r[t]<<=e};for(let r in Pr)p(r,(t,e)=>(e=n(e),Tr(t,(o,i,s)=>Pr[r](o,i,e(s)))));p("!",r=>(r=n(r),t=>!r(t)));p("||",(r,t)=>(r=n(r),t=n(t),e=>r(e)||t(e)));p("&&",(r,t)=>(r=n(r),t=n(t),e=>r(e)&&t(e)));p("~",r=>(r=n(r),t=>~r(t)));p("|",(r,t)=>(r=n(r),t=n(t),e=>r(e)|t(e)));p("&",(r,t)=>(r=n(r),t=n(t),e=>r(e)&t(e)));p("^",(r,t)=>(r=n(r),t=n(t),e=>r(e)^t(e)));p(">>",(r,t)=>(r=n(r),t=n(t),e=>r(e)>>t(e)));p("<<",(r,t)=>(r=n(r),t=n(t),e=>r(e)<<t(e)));p(">",(r,t)=>(r=n(r),t=n(t),e=>r(e)>t(e)));p("<",(r,t)=>(r=n(r),t=n(t),e=>r(e)<t(e)));p(">=",(r,t)=>(r=n(r),t=n(t),e=>r(e)>=t(e)));p("<=",(r,t)=>(r=n(r),t=n(t),e=>r(e)<=t(e)));p("==",(r,t)=>(r=n(r),t=n(t),e=>r(e)==t(e)));p("!=",(r,t)=>(r=n(r),t=n(t),e=>r(e)!=t(e)));p("+",(r,t)=>t!==void 0?(r=n(r),t=n(t),e=>r(e)+t(e)):(r=n(r),e=>+r(e)));p("-",(r,t)=>t!==void 0?(r=n(r),t=n(t),e=>r(e)-t(e)):(r=n(r),e=>-r(e)));p("*",(r,t)=>(r=n(r),t=n(t),e=>r(e)*t(e)));p("/",(r,t)=>(r=n(r),t=n(t),e=>r(e)/t(e)));p("%",(r,t)=>(r=n(r),t=n(t),e=>r(e)%t(e)));var or=(r,t,e,o)=>typeof r=="string"?i=>t(i,r):r[0]==="."?(e=n(r[1]),o=r[2],i=>t(e(i),o)):r[0]==="[]"&&r.length===3?(e=n(r[1]),o=n(r[2]),i=>t(e(i),o(i))):r[0]==="()"&&r.length===2?or(r[1],t):(()=>{throw Error("Invalid increment target")})();p("++",(r,t)=>or(r,t===null?(e,o)=>e[o]++:(e,o)=>++e[o]));p("--",(r,t)=>or(r,t===null?(e,o)=>e[o]--:(e,o)=>--e[o]));var ar=(...r)=>(r=r.map(n),t=>{let e;for(let o of r)e=o(t);return e});p(",",ar);p(";",ar);var O=r=>r?.[0]==="_"&&r[1]==="_"||r==="constructor"||r==="prototype",Q=r=>{throw Error(r)};p("[]",(r,t)=>t===void 0?(r=r?r[0]===","?r.slice(1):[r]:[],r=r.map(e=>e==null?(()=>{}):e[0]==="..."?(e=n(e[1]),o=>e(o)):(e=n(e),o=>[e(o)])),e=>r.flatMap(o=>o(e))):(t==null&&Q("Missing index"),r=n(r),t=n(t),e=>{let o=t(e);return O(o)?void 0:r(e)[o]}));p(".",(r,t)=>(r=n(r),t=t[0]?t:t[1],O(t)?()=>{}:e=>r(e)[t]));p("()",(r,t)=>{if(t===void 0)return r==null?Q("Empty ()"):n(r);let e=i=>i?.[0]===","&&i.slice(1).some(s=>s==null||e(s));e(t)&&Q("Empty argument");let o=t?t[0]===","?(t=t.slice(1).map(n),i=>t.map(s=>s(i))):(t=n(t),i=>[t(i)]):()=>[];return nr(r,(i,s,m)=>i[s](...o(m)))});var v=r=>typeof r=="string"||Array.isArray(r)&&(r[0]==="."||r[0]==="?."||r[0]==="[]"&&r.length===3||r[0]==="?.[]"||r[0]==="()"&&r.length===2&&v(r[1])||r[0]==="{}"),nr=(r,t,e,o)=>r==null?Q("Empty ()"):r[0]==="()"&&r.length==2?nr(r[1],t):typeof r=="string"?i=>t(i,r,i):r[0]==="."?(e=n(r[1]),o=r[2],i=>t(e(i),o,i)):r[0]==="?."?(e=n(r[1]),o=r[2],i=>{let s=e(i);return s==null?void 0:t(s,o,i)}):r[0]==="[]"&&r.length===3?(e=n(r[1]),o=n(r[2]),i=>t(e(i),o(i),i)):r[0]==="?.[]"?(e=n(r[1]),o=n(r[2]),i=>{let s=e(i);return s==null?void 0:t(s,o(i),i)}):(r=n(r),i=>t([r(i)],0,i)),R=nr;p("===",(r,t)=>(r=n(r),t=n(t),e=>r(e)===t(e)));p("!==",(r,t)=>(r=n(r),t=n(t),e=>r(e)!==t(e)));p("??",(r,t)=>(r=n(r),t=n(t),e=>r(e)??t(e)));var vt=r=>{throw Error(r)};p("**",(r,t)=>(r=n(r),t=n(t),e=>r(e)**t(e)));p("**=",(r,t)=>(v(r)||vt("Invalid assignment target"),t=n(t),R(r,(e,o,i)=>e[o]**=t(i))));p("in",(r,t)=>(r=n(r),t=n(t),e=>r(e)in t(e)));var Lt=r=>{throw Error(r)};p(">>>",(r,t)=>(r=n(r),t=n(t),e=>r(e)>>>t(e)));p(">>>=",(r,t)=>(v(r)||Lt("Invalid assignment target"),t=n(t),R(r,(e,o,i)=>e[o]>>>=t(i))));var Ot=r=>r[0]?.[0]===","?r[0].slice(1):r,_=(r,t,e)=>{if(typeof r=="string"){e[r]=t;return}let[o,...i]=r,s=Ot(i);if(o==="{}"){let m=[];for(let f of s){if(Array.isArray(f)&&f[0]==="..."){let E={};for(let T in t)m.includes(T)||(E[T]=t[T]);e[f[1]]=E;break}let A,h,S;typeof f=="string"?A=h=f:f[0]==="="?(typeof f[1]=="string"?A=h=f[1]:[,A,h]=f[1],S=f[2]):[,A,h]=f,m.push(A);let g=t[A];g===void 0&&S&&(g=n(S)(e)),_(h,g,e)}}else if(o==="[]"){let m=0;for(let f of s){if(f===null){m++;continue}if(Array.isArray(f)&&f[0]==="..."){e[f[1]]=t.slice(m);break}let A=f,h;Array.isArray(f)&&f[0]==="="&&([,A,h]=f);let S=t[m++];S===void 0&&h&&(S=n(h)(e)),_(A,S,e)}}},ir=(...r)=>(r=r.map(t=>{if(typeof t=="string")return e=>{e[t]=void 0};if(t[0]==="="){let[,e,o]=t,i=n(o);return typeof e=="string"?s=>{s[e]=i(s)}:s=>_(e,i(s),s)}return n(t)}),t=>{for(let e of r)e(t)});p("let",ir);p("const",ir);p("var",ir);var H=r=>{throw Error(r)};p("=",(r,t)=>{if(Array.isArray(r)&&(r[0]==="let"||r[0]==="const"||r[0]==="var")){let e=r[1];return t=n(t),typeof e=="string"?o=>{o[e]=t(o)}:o=>_(e,t(o),o)}return v(r)||H("Invalid assignment target"),t=n(t),R(r,(e,o,i)=>e[o]=t(i))});p("||=",(r,t)=>(v(r)||H("Invalid assignment target"),t=n(t),R(r,(e,o,i)=>e[o]||=t(i))));p("&&=",(r,t)=>(v(r)||H("Invalid assignment target"),t=n(t),R(r,(e,o,i)=>e[o]&&=t(i))));p("??=",(r,t)=>(v(r)||H("Invalid assignment target"),t=n(t),R(r,(e,o,i)=>e[o]??=t(i))));p("?",(r,t,e)=>(r=n(r),t=n(t),e=n(e),o=>r(o)?t(o):e(o)));var Rt=[];p("=>",(r,t)=>{r=r?.[0]==="()"?r[1]:r;let e=r?r[0]===","?r.slice(1):[r]:[],o=-1,i=null,s=e[e.length-1];Array.isArray(s)&&s[0]==="..."&&(o=e.length-1,i=s[1],e.length--);let m=t?.[0]==="{}";return t=n(m?["{",t[1]]:t),f=>(...A)=>{let h={};e.forEach((g,E)=>h[g]=A[E]),i&&(h[i]=A.slice(o));let S=new Proxy(h,{get:(g,E)=>E in g?g[E]:f?.[E],set:(g,E,T)=>((E in g?g:f)[E]=T,!0),has:(g,E)=>E in g||(f?E in f:!1)});try{let g=t(S);return m?void 0:g}catch(g){if(g===Rt)return g[0];throw g}}});p("...",r=>(r=n(r),t=>Object.entries(r(t))));p("?.",(r,t)=>(r=n(r),O(t)?()=>{}:e=>r(e)?.[t]));p("?.[]",(r,t)=>(r=n(r),t=n(t),e=>{let o=t(e);return O(o)?void 0:r(e)?.[o]}));p("?.()",(r,t)=>{let e=t?t[0]===","?(t=t.slice(1).map(n),i=>t.map(s=>s(i))):(t=n(t),i=>[t(i)]):()=>[];if(r[0]==="?."){let i=n(r[1]),s=r[2];return O(s)?()=>{}:m=>i(m)?.[s]?.(...e(m))}if(r[0]==="?.[]"){let i=n(r[1]),s=n(r[2]);return m=>{let f=i(m),A=s(m);return O(A)?void 0:f?.[A]?.(...e(m))}}if(r[0]==="."){let i=n(r[1]),s=r[2];return O(s)?()=>{}:m=>i(m)?.[s]?.(...e(m))}if(r[0]==="[]"&&r.length===3){let i=n(r[1]),s=n(r[2]);return m=>{let f=i(m),A=s(m);return O(A)?void 0:f?.[A]?.(...e(m))}}let o=n(r);return i=>o(i)?.(...e(i))});p("typeof",r=>(r=n(r),t=>typeof r(t)));p("void",r=>(r=n(r),t=>(r(t),void 0)));p("delete",r=>{if(r[0]==="."){let t=n(r[1]),e=r[2];return o=>delete t(o)[e]}if(r[0]==="[]"){let t=n(r[1]),e=n(r[2]);return o=>delete t(o)[e(o)]}return()=>!0});p("new",r=>{let t=n(r?.[0]==="()"?r[1]:r),e=r?.[0]==="()"?r[2]:null,o=e?e[0]===","?(i=>s=>i.map(m=>m(s)))(e.slice(1).map(n)):(i=>s=>[i(s)])(n(e)):()=>[];return i=>new(t(i))(...o(i))});var j=Symbol("accessor");p("get",(r,t)=>(t=t?n(t):()=>{},e=>[[j,r,{get:function(){let o=Object.create(e||{});return o.this=this,t(o)}}]]));p("set",(r,t,e)=>(e=e?n(e):()=>{},o=>[[j,r,{set:function(i){let s=Object.create(o||{});s.this=this,s[t]=i,e(s)}}]]));var Pt=r=>r==null||typeof r=="string"||[":",",","...","get","set"].includes(r[0]);p("{}",(r,t)=>{if(t!==void 0)return;if(!Pt(r))return n(["{",r]);r=r?r[0]!==","?[r]:r.slice(1):[];let e=r.map(o=>n(typeof o=="string"?[":",o,o]:o));return o=>{let i={},s={};for(let m of e.flatMap(f=>f(o)))if(m[0]===j){let[,f,A]=m;s[f]={...s[f],...A,configurable:!0,enumerable:!0}}else i[m[0]]=m[1];for(let m in s)Object.defineProperty(i,m,s[m]);return i}});p("{",r=>(r=r?n(r):()=>{},t=>r(Object.create(t))));p(":",(r,t)=>(t=n(t),Array.isArray(r)?(r=n(r),e=>[[r(e),t(e)]]):e=>[[r,t(e)]]));p("`",(...r)=>(r=r.map(n),t=>r.map(e=>e(t)).join("")));p("``",(r,...t)=>{r=n(r);let e=[],o=[];for(let s of t)Array.isArray(s)&&s[0]===void 0?e.push(s[1]):o.push(n(s));let i=Object.assign([...e],{raw:e});return s=>r(s)(i,...o.map(m=>m(s)))});var Ur=new WeakMap,Tt=(r,...t)=>typeof r=="string"?n(d(r)):Ur.get(r)||Ur.set(r,at(r,t)).get(r),_r=57344,at=(r,t)=>{let e=r.reduce((s,m,f)=>s+(f?String.fromCharCode(_r+f-1):"")+m,""),o=d(e),i=s=>{if(typeof s=="string"&&s.length===1){let m=s.charCodeAt(0)-_r,f;if(m>=0&&m<t.length)return f=t[m],Ut(f)?f:[,f]}return Array.isArray(s)?s.map(i):s};return n(i(o))},Ut=r=>typeof r=="string"||Array.isArray(r)&&(typeof r[0]=="string"||r[0]===void 0),_t=Tt;export{V as access,c as binary,n as compile,l as cur,_t as default,N as err,C as expr,a as group,Bt as id,u as idx,M as keyword,P as literal,sr as loc,w as lookup,mr as member,J as nary,L as next,p as operator,W as operators,Mt as parens,d as parse,z as peek,K as prec,Y as propName,B as seek,y as skip,I as token,k as unary,pr as word};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "subscript",
3
- "version": "10.4.10",
3
+ "version": "10.4.12",
4
4
  "description": "Modular expression parser & evaluator",
5
5
  "main": "subscript.js",
6
6
  "module": "subscript.js",
package/parse.js CHANGED
@@ -1,4 +1,12 @@
1
- // Pratt parser core + operator registry + compile
1
+ // Pratt parser core + operator registry + compile.
2
+ //
3
+ // Language-agnostic by design: the core (token / lookup / prec / the expr loop)
4
+ // assumes no particular language. The registrars below — binary, unary, nary,
5
+ // literal, group, access, member, keyword — are a shared toolkit of common
6
+ // operator *shapes*; each is parameterized by operator string + precedence, so a
7
+ // dialect composes its grammar from them. Keep language-specific rules in
8
+ // feature/*, not here.
9
+
2
10
  // Character codes
3
11
  const SPACE = 32;
4
12
 
@@ -100,33 +108,52 @@ export let idx, cur,
100
108
 
101
109
  literal = (op, val) => token(op, 200, a => !a && [, val]),
102
110
 
103
- nary = (op, p, right) =>
111
+ // nary list (`,` `;`). With no rhs after a separator, the empty slot is a
112
+ // hole only when another separator follows (`[1,,2]`); a separator with
113
+ // nothing else after it is trailing, and its slot is dropped (`[1,2,]` is
114
+ // `[1,2]`). `trail` keeps that trailing slot, for separators whose positions
115
+ // are significant (`;` → `for(;;)` is [;,null,null,null]).
116
+ nary = (op, p, right, trail) =>
104
117
  token(op, p,
105
118
  (a, b) => (
106
119
  b = expr(p - (right ? .5 : 0)),
107
- (
108
- (a?.[0] !== op) && (a = [op, a || null]),
109
- b?.[0] === op ? a.push(...b.slice(1)) : a.push(b || null),
110
- a
111
- ))
112
- )
120
+ (a?.[0] !== op) && (a = [op, a || null]),
121
+ b?.[0] === op ? a.push(...b.slice(1)) :
122
+ b ? a.push(b) :
123
+ (trail || peek() === op.charCodeAt(0)) && a.push(null),
124
+ a
125
+ ))
113
126
  ,
114
127
 
115
128
  group = (op, p) => token(op[0], p, a => (!a && [op, expr(0, op.charCodeAt(1)) || null])),
116
129
 
117
130
  access = (op, p) => token(op[0], p, a => (a && [op, a, expr(0, op.charCodeAt(1)) || null])),
118
131
 
119
- // keyword(op, prec, fn) - prefix word token with property name support
120
- // parse.prop set by collection.js to prevent matching {keyword: value}
121
- keyword = (op, prec, map, c = op.charCodeAt(0), l = op.length, prev = lookup[c], r) =>
132
+ // propName(p) - parse the right side of a name-access operator. A bare name
133
+ // beats keyword/operator matching, so reserved words read as plain identifiers
134
+ // (a.class). Non-name starts (digit, #, ...) fall back to expr(p), keeping the
135
+ // door open for any dialect-defined token there. Uses the live parse.id.
136
+ propName = (p, c) => (parse.space(), c = cur.charCodeAt(idx), parse.id(c) && (c < 48 || c > 57) ? next(parse.id) : expr(p)),
137
+
138
+ // member(op, p) - binary operator whose right side is a name, not an expression
139
+ // (a.b, a::b, a->b). Same [op, a, b] shape as binary().
140
+ member = (op, p) => token(op, p, a => a && (b => b && [op, a, b])(propName(p))),
141
+
142
+ // keyword(op, p, fn) - prefix word token with property name support.
143
+ // Records p in the prec registry (like token does) so dialects can
144
+ // introspect keyword precedence. parse.prop set by collection.js to
145
+ // prevent matching {keyword: value}.
146
+ keyword = (op, p, map, c = op.charCodeAt(0), l = op.length, prev = lookup[c], r) => (
147
+ prec[op] ??= p,
122
148
  lookup[c] = (a, curPrec, curOp, from = idx) =>
123
149
  !a &&
124
150
  (curOp ? op == curOp : (l < 2 || cur.substr(idx, l) == op) && (curOp = op)) &&
125
- curPrec < prec &&
151
+ curPrec < p &&
126
152
  !parse.id(cur.charCodeAt(idx + l)) &&
127
153
  (!parse.prop || parse.prop(idx + l)) &&
128
154
  (seek(idx + l), (r = map()) ? loc(r, from) : seek(from), r) ||
129
- prev?.(a, curPrec, curOp);
155
+ prev?.(a, curPrec, curOp)
156
+ );
130
157
 
131
158
  // Skip space chars, return first non-space character.
132
159
  // Wrappers (comment, asi) compose by reading the previous parse.space first.
package/subscript.d.ts CHANGED
@@ -28,6 +28,8 @@ export function literal(op: string, val: any): void;
28
28
  export function nary(op: string, prec: number, right?: boolean): void;
29
29
  export function group(op: string, prec: number): void;
30
30
  export function access(op: string, prec: number): void;
31
+ export function member(op: string, prec: number): void;
32
+ export function propName(prec: number): AST;
31
33
 
32
34
  // Compile exports
33
35
  export const operators: Record<string, Operator>;
package/subscript.min.js CHANGED
@@ -1,5 +1,5 @@
1
- var s,p,d=r=>(s=0,p=r,d.enter?.(),r=g(),p[s]?S():r||""),S=(r="Unexpected token",t=s,e=p.slice(0,t).split(`
2
- `),o=e.pop(),n=p.slice(Math.max(0,t-40),t),m="\u032D",f=(p[t]||" ")+m,A=p.slice(t+1,t+20))=>{throw SyntaxError(`${r} at ${e.length+1}:${o.length+1}
1
+ var s,p,f=r=>(s=0,p=r,f.enter?.(),r=g(),p[s]?S():r||""),S=(r="Unexpected token",t=s,e=p.slice(0,t).split(`
2
+ `),n=e.pop(),o=p.slice(Math.max(0,t-40),t),m="\u032D",u=(p[t]||" ")+m,d=p.slice(t+1,t+20))=>{throw SyntaxError(`${r} at ${e.length+1}:${n.length+1}
3
3
  ${p[t-41]!==`
4
- `,""+n}${f}${A}`)},W=(r,t=s)=>(Array.isArray(r)&&(r.loc=t),r),I=(r,t=s,e)=>{for(;e=r(p.charCodeAt(s));)s+=e;return p.slice(t,s)},w=(r=1)=>p[s+=r],v=r=>s=r,g=(r=0,t)=>{let e,o,n;for(t&&d.enter?.(r,t);(e=d.space())&&e!==t&&(n=d.step(o,r,e,g));)o=n;return t&&(e==t?(s++,d.exit?.(r,t)):S("Unclosed "+String.fromCharCode(t-(t>42?2:1)))),o},Qr=(r=s)=>{for(;p.charCodeAt(r)<=32;)r++;return p.charCodeAt(r)},Hr=d.id=r=>r>=48&&r<=57||r>=65&&r<=90||r>=97&&r<=122||r==36||r==95||r>=192&&r!=215&&r!=247,vr=(r,t=r.length)=>p.substr(s,t)===r&&!d.id(p.charCodeAt(s+t)),Gr=()=>(w(),g(0,41)),c=[],G={},E=(r,t=32,e,o=r.charCodeAt(0),n=r.length,m=c[o],f=r.toUpperCase()!==r,A,h)=>(t=G[r]=!m&&G[r]||t,c[o]=(C,y,U,H=s)=>(A=U,(U?r==U:(n<2||r.charCodeAt(1)===p.charCodeAt(s+1)&&(n<3||p.substr(s,n)==r))&&(!f||!d.id(p.charCodeAt(s+n)))&&(A=U=r))&&y<t&&(s+=n,(h=e(C))?W(h,H):(s=H,A=0,!f&&!m&&!C&&S()),h)||m?.(C,y,A))),u=(r,t,e=!1)=>E(r,t,o=>o&&(n=>n&&[r,o,n])(g(t-(e?.5:0)))),_=(r,t,e)=>E(r,t,o=>e?o&&[r,o]:!o&&(o=g(t-.5))&&[r,o]),Wr=(r,t)=>E(r,200,e=>!e&&[,t]),N=(r,t,e)=>E(r,t,(o,n)=>(n=g(t-(e?.5:0)),o?.[0]!==r&&(o=[r,o||null]),n?.[0]===r?o.push(...n.slice(1)):o.push(n||null),o)),z=(r,t)=>E(r[0],t,e=>!e&&[r,g(0,r.charCodeAt(1))||null]),$=(r,t)=>E(r[0],t,e=>e&&[r,e,g(0,r.charCodeAt(1))||null]),zr=(r,t,e,o=r.charCodeAt(0),n=r.length,m=c[o],f)=>c[o]=(A,h,C,y=s)=>!A&&(C?r==C:(n<2||p.substr(s,n)==r)&&(C=r))&&h<t&&!d.id(p.charCodeAt(s+n))&&(!d.prop||d.prop(s+n))&&(v(s+n),(f=e())?W(f,y):v(y),f)||m?.(A,h,C);d.space=r=>{for(;(r=p.charCodeAt(s))<=32;)s++;return r};d.step=(r,t,e,o,n)=>(n=c[e])&&n(r,t)||(r?null:I(d.id)||null);var F={},l=(r,t,e=F[r])=>F[r]=(...o)=>t(...o)||e?.(...o),i=r=>Array.isArray(r)?r[0]==null?(t=>()=>t)(r[1]):F[r[0]]?.(...r.slice(1))??S(`Unknown operator: ${r[0]}`,r?.loc):r===void 0?()=>{}:t=>t?.[r];var T=46,R=48,k=57,ur=69,fr=101,Ar=43,dr=45,P=95,J=110,hr=97,Cr=102,cr=65,gr=70,K=r=>r.indexOf("_")<0?r:r.replaceAll("_",""),B=r=>{let t=K(I(e=>e===T&&p.charCodeAt(s+1)!==T||e>=R&&e<=k||e===P||((e===ur||e===fr)&&((e=p.charCodeAt(s+1))>=R&&e<=k||e===Ar||e===dr)?2:0)));return p.charCodeAt(s)===J?(w(),[,BigInt(t)]):(r=+t)!=r?S():[,r]},yr={2:r=>r===48||r===49||r===P,8:r=>r>=48&&r<=55||r===P,16:r=>r>=R&&r<=k||r>=hr&&r<=Cr||r>=cr&&r<=gr||r===P};d.number=null;c[T]=r=>!r&&p.charCodeAt(s+1)!==T&&B();for(let r=R;r<=k;r++)c[r]=t=>t?void 0:B();c[R]=r=>{if(r)return;let t=d.number;if(t){for(let[e,o]of Object.entries(t))if(e[0]==="0"&&p[s+1]?.toLowerCase()===e[1]){w(2);let n=K(I(yr[o]));return p.charCodeAt(s)===J?(w(),[,BigInt("0"+e[1]+n)]):[,parseInt(n,o)]}}return B()};var Er=92,V=34,Y=39,Z=117,q=120,Sr=123,wr=125,x=10,_r=13,Ir={n:`
5
- `,r:"\r",t:" ",b:"\b",f:"\f",v:"\v",0:"\0"},j=r=>r>=48&&r<=57?r-48:r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:-1,a=r=>(t,e,o="",n=String.fromCharCode(r))=>{if(t||!d.string?.[n])return;w();let m=()=>{let f=p.charCodeAt(s+1);if(f===x)return 2;if(f===_r)return p.charCodeAt(s+2)===x?3:2;if(f===q||f===Z&&p.charCodeAt(s+2)!==Sr){let A=f===q?2:4,h=0,C;for(let y=0;y<A;y++){if((C=j(p.charCodeAt(s+2+y)))<0)return o+=p[s+1],2;h=h*16+C}return o+=String.fromCharCode(h),2+A}if(f===Z){let A=0,h=s+3,C;for(;(C=j(p.charCodeAt(h)))>=0;)A=A*16+C,h++;return h>s+3&&A<=1114111&&p.charCodeAt(h)===wr?(o+=String.fromCodePoint(A),h-s+1):(o+=p[s+1],2)}return o+=Ir[p[s+1]]||p[s+1],2};return I(f=>f-r&&(f!==Er?(o+=p[s],1):m())),p[s]===n?w():S("Bad string"),[,o]};c[V]=a(V);c[Y]=a(Y);d.string={'"':!0};var Rr=20;"= += -= *= /= %= |= &= ^= >>= <<=".split(" ").map(r=>u(r,Rr,!0));var Ur=30,Pr=40,Tr=140;_("!",Tr);u("||",Ur);u("&&",Pr);var kr=50,Lr=60,Dr=70,b=100,Mr=140;u("|",kr);u("&",Dr);u("^",Lr);u(">>",b);u("<<",b);_("~",Mr);var L=90;u("<",L);u(">",L);u("<=",L);u(">=",L);var rr=80;u("==",rr);u("!=",rr);var tr=110,X=120,er=140;u("+",tr);u("-",tr);u("*",X);u("/",X);u("%",X);_("+",er);_("-",er);var D=150;E("++",D,r=>r?["++",r,null]:["++",g(D-1)]);E("--",D,r=>r?["--",r,null]:["--",g(D-1)]);var Fr=5,Nr=10;N(",",Nr);N(";",Fr,!0);var $r=170;z("()",$r);var O=170;$("[]",O);u(".",O);$("()",O);var nr=(r,t,e,o)=>typeof r=="string"?n=>t(n,r,n):r[0]==="."?(e=i(r[1]),o=r[2],n=>t(e(n),o,n)):r[0]==="[]"&&r.length===3?(e=i(r[1]),o=i(r[2]),n=>t(e(n),o(n),n)):r[0]==="()"&&r.length===2?nr(r[1],t):(()=>{throw Error("Invalid assignment target")})(),or={"=":(r,t,e)=>r[t]=e,"+=":(r,t,e)=>r[t]+=e,"-=":(r,t,e)=>r[t]-=e,"*=":(r,t,e)=>r[t]*=e,"/=":(r,t,e)=>r[t]/=e,"%=":(r,t,e)=>r[t]%=e,"|=":(r,t,e)=>r[t]|=e,"&=":(r,t,e)=>r[t]&=e,"^=":(r,t,e)=>r[t]^=e,">>=":(r,t,e)=>r[t]>>=e,"<<=":(r,t,e)=>r[t]<<=e};for(let r in or)l(r,(t,e)=>(e=i(e),nr(t,(o,n,m)=>or[r](o,n,e(m)))));l("!",r=>(r=i(r),t=>!r(t)));l("||",(r,t)=>(r=i(r),t=i(t),e=>r(e)||t(e)));l("&&",(r,t)=>(r=i(r),t=i(t),e=>r(e)&&t(e)));l("~",r=>(r=i(r),t=>~r(t)));l("|",(r,t)=>(r=i(r),t=i(t),e=>r(e)|t(e)));l("&",(r,t)=>(r=i(r),t=i(t),e=>r(e)&t(e)));l("^",(r,t)=>(r=i(r),t=i(t),e=>r(e)^t(e)));l(">>",(r,t)=>(r=i(r),t=i(t),e=>r(e)>>t(e)));l("<<",(r,t)=>(r=i(r),t=i(t),e=>r(e)<<t(e)));l(">",(r,t)=>(r=i(r),t=i(t),e=>r(e)>t(e)));l("<",(r,t)=>(r=i(r),t=i(t),e=>r(e)<t(e)));l(">=",(r,t)=>(r=i(r),t=i(t),e=>r(e)>=t(e)));l("<=",(r,t)=>(r=i(r),t=i(t),e=>r(e)<=t(e)));l("==",(r,t)=>(r=i(r),t=i(t),e=>r(e)==t(e)));l("!=",(r,t)=>(r=i(r),t=i(t),e=>r(e)!=t(e)));l("+",(r,t)=>t!==void 0?(r=i(r),t=i(t),e=>r(e)+t(e)):(r=i(r),e=>+r(e)));l("-",(r,t)=>t!==void 0?(r=i(r),t=i(t),e=>r(e)-t(e)):(r=i(r),e=>-r(e)));l("*",(r,t)=>(r=i(r),t=i(t),e=>r(e)*t(e)));l("/",(r,t)=>(r=i(r),t=i(t),e=>r(e)/t(e)));l("%",(r,t)=>(r=i(r),t=i(t),e=>r(e)%t(e)));var Q=(r,t,e,o)=>typeof r=="string"?n=>t(n,r):r[0]==="."?(e=i(r[1]),o=r[2],n=>t(e(n),o)):r[0]==="[]"&&r.length===3?(e=i(r[1]),o=i(r[2]),n=>t(e(n),o(n))):r[0]==="()"&&r.length===2?Q(r[1],t):(()=>{throw Error("Invalid increment target")})();l("++",(r,t)=>Q(r,t===null?(e,o)=>e[o]++:(e,o)=>++e[o]));l("--",(r,t)=>Q(r,t===null?(e,o)=>e[o]--:(e,o)=>--e[o]));var ir=(...r)=>(r=r.map(i),t=>{let e;for(let o of r)e=o(t);return e});l(",",ir);l(";",ir);var sr=r=>r?.[0]==="_"&&r[1]==="_"||r==="constructor"||r==="prototype",M=r=>{throw Error(r)};l("[]",(r,t)=>t===void 0?(r=r?r[0]===","?r.slice(1):[r]:[],r=r.map(e=>e==null?(()=>{}):e[0]==="..."?(e=i(e[1]),o=>e(o)):(e=i(e),o=>[e(o)])),e=>r.flatMap(o=>o(e))):(t==null&&M("Missing index"),r=i(r),t=i(t),e=>{let o=t(e);return sr(o)?void 0:r(e)[o]}));l(".",(r,t)=>(r=i(r),t=t[0]?t:t[1],sr(t)?()=>{}:e=>r(e)[t]));l("()",(r,t)=>{if(t===void 0)return r==null?M("Empty ()"):i(r);let e=n=>n?.[0]===","&&n.slice(1).some(m=>m==null||e(m));e(t)&&M("Empty argument");let o=t?t[0]===","?(t=t.slice(1).map(i),n=>t.map(m=>m(n))):(t=i(t),n=>[t(n)]):()=>[];return pr(r,(n,m,f)=>n[m](...o(f)))});var pr=(r,t,e,o)=>r==null?M("Empty ()"):r[0]==="()"&&r.length==2?pr(r[1],t):typeof r=="string"?n=>t(n,r,n):r[0]==="."?(e=i(r[1]),o=r[2],n=>t(e(n),o,n)):r[0]==="?."?(e=i(r[1]),o=r[2],n=>{let m=e(n);return m==null?void 0:t(m,o,n)}):r[0]==="[]"&&r.length===3?(e=i(r[1]),o=i(r[2]),n=>t(e(n),o(n),n)):r[0]==="?.[]"?(e=i(r[1]),o=i(r[2]),n=>{let m=e(n);return m==null?void 0:t(m,o(n),n)}):(r=i(r),n=>t([r(n)],0,n));var lr=new WeakMap,Br=(r,...t)=>typeof r=="string"?i(d(r)):lr.get(r)||lr.set(r,Xr(r,t)).get(r),mr=57344,Xr=(r,t)=>{let e=r.reduce((m,f,A)=>m+(A?String.fromCharCode(mr+A-1):"")+f,""),o=d(e),n=m=>{if(typeof m=="string"&&m.length===1){let f=m.charCodeAt(0)-mr,A;if(f>=0&&f<t.length)return A=t[f],Or(A)?A:[,A]}return Array.isArray(m)?m.map(n):m};return i(n(o))},Or=r=>typeof r=="string"||Array.isArray(r)&&(typeof r[0]=="string"||r[0]===void 0),vt=Br;export{$ as access,u as binary,i as compile,p as cur,vt as default,S as err,g as expr,z as group,Hr as id,s as idx,zr as keyword,Wr as literal,W as loc,c as lookup,N as nary,I as next,l as operator,F as operators,Gr as parens,d as parse,Qr as peek,G as prec,v as seek,w as skip,E as token,_ as unary,vr as word};
4
+ `,""+o}${u}${d}`)},G=(r,t=s)=>(Array.isArray(r)&&(r.loc=t),r),_=(r,t=s,e)=>{for(;e=r(p.charCodeAt(s));)s+=e;return p.slice(t,s)},w=(r=1)=>p[s+=r],v=r=>s=r,g=(r=0,t)=>{let e,n,o;for(t&&f.enter?.(r,t);(e=f.space())&&e!==t&&(o=f.step(n,r,e,g));)n=o;return t&&(e==t?(s++,f.exit?.(r,t)):S("Unclosed "+String.fromCharCode(t-(t>42?2:1)))),n},fr=(r=s)=>{for(;p.charCodeAt(r)<=32;)r++;return p.charCodeAt(r)},Wr=f.id=r=>r>=48&&r<=57||r>=65&&r<=90||r>=97&&r<=122||r==36||r==95||r>=192&&r!=215&&r!=247,zr=(r,t=r.length)=>p.substr(s,t)===r&&!f.id(p.charCodeAt(s+t)),Jr=()=>(w(),g(0,41)),c=[],N={},y=(r,t=32,e,n=r.charCodeAt(0),o=r.length,m=c[n],u=r.toUpperCase()!==r,d,h)=>(t=N[r]=!m&&N[r]||t,c[n]=(C,E,U,H=s)=>(d=U,(U?r==U:(o<2||r.charCodeAt(1)===p.charCodeAt(s+1)&&(o<3||p.substr(s,o)==r))&&(!u||!f.id(p.charCodeAt(s+o)))&&(d=U=r))&&E<t&&(s+=o,(h=e(C))?G(h,H):(s=H,d=0,!u&&!m&&!C&&S()),h)||m?.(C,E,d))),A=(r,t,e=!1)=>y(r,t,n=>n&&(o=>o&&[r,n,o])(g(t-(e?.5:0)))),I=(r,t,e)=>y(r,t,n=>e?n&&[r,n]:!n&&(n=g(t-.5))&&[r,n]),Kr=(r,t)=>y(r,200,e=>!e&&[,t]),$=(r,t,e,n)=>y(r,t,(o,m)=>(m=g(t-(e?.5:0)),o?.[0]!==r&&(o=[r,o||null]),m?.[0]===r?o.push(...m.slice(1)):m?o.push(m):(n||fr()===r.charCodeAt(0))&&o.push(null),o)),W=(r,t)=>y(r[0],t,e=>!e&&[r,g(0,r.charCodeAt(1))||null]),B=(r,t)=>y(r[0],t,e=>e&&[r,e,g(0,r.charCodeAt(1))||null]),dr=(r,t)=>(f.space(),t=p.charCodeAt(s),f.id(t)&&(t<48||t>57)?_(f.id):g(r)),z=(r,t)=>y(r,t,e=>e&&(n=>n&&[r,e,n])(dr(t))),Vr=(r,t,e,n=r.charCodeAt(0),o=r.length,m=c[n],u)=>(N[r]??=t,c[n]=(d,h,C,E=s)=>!d&&(C?r==C:(o<2||p.substr(s,o)==r)&&(C=r))&&h<t&&!f.id(p.charCodeAt(s+o))&&(!f.prop||f.prop(s+o))&&(v(s+o),(u=e())?G(u,E):v(E),u)||m?.(d,h,C));f.space=r=>{for(;(r=p.charCodeAt(s))<=32;)s++;return r};f.step=(r,t,e,n,o)=>(o=c[e])&&o(r,t)||(r?null:_(f.id)||null);var F={},l=(r,t,e=F[r])=>F[r]=(...n)=>t(...n)||e?.(...n),i=r=>Array.isArray(r)?r[0]==null?(t=>()=>t)(r[1]):F[r[0]]?.(...r.slice(1))??S(`Unknown operator: ${r[0]}`,r?.loc):r===void 0?()=>{}:t=>t?.[r];var P=46,R=48,T=57,Ar=69,hr=101,Cr=43,cr=45,L=95,J=110,gr=97,yr=102,Er=65,Sr=70,K=r=>r.indexOf("_")<0?r:r.replaceAll("_",""),X=r=>{let t=K(_(e=>e===P&&p.charCodeAt(s+1)!==P||e>=R&&e<=T||e===L||((e===Ar||e===hr)&&((e=p.charCodeAt(s+1))>=R&&e<=T||e===Cr||e===cr)?2:0)));return p.charCodeAt(s)===J?(w(),[,BigInt(t)]):(r=+t)!=r?S():[,r]},wr={2:r=>r===48||r===49||r===L,8:r=>r>=48&&r<=55||r===L,16:r=>r>=R&&r<=T||r>=gr&&r<=yr||r>=Er&&r<=Sr||r===L};f.number=null;c[P]=r=>!r&&p.charCodeAt(s+1)!==P&&X();for(let r=R;r<=T;r++)c[r]=t=>t?void 0:X();c[R]=r=>{if(r)return;let t=f.number;if(t){for(let[e,n]of Object.entries(t))if(e[0]==="0"&&p[s+1]?.toLowerCase()===e[1]){w(2);let o=K(_(wr[n]));return p.charCodeAt(s)===J?(w(),[,BigInt("0"+e[1]+o)]):[,parseInt(o,n)]}}return X()};var _r=92,V=34,Y=39,Z=117,q=120,Ir=123,Rr=125,x=10,Ur=13,Lr={n:`
5
+ `,r:"\r",t:" ",b:"\b",f:"\f",v:"\v",0:"\0"},j=r=>r>=48&&r<=57?r-48:r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:-1,a=r=>(t,e,n="",o=String.fromCharCode(r))=>{if(t||!f.string?.[o])return;w();let m=()=>{let u=p.charCodeAt(s+1);if(u===x)return 2;if(u===Ur)return p.charCodeAt(s+2)===x?3:2;if(u===q||u===Z&&p.charCodeAt(s+2)!==Ir){let d=u===q?2:4,h=0,C;for(let E=0;E<d;E++){if((C=j(p.charCodeAt(s+2+E)))<0)return n+=p[s+1],2;h=h*16+C}return n+=String.fromCharCode(h),2+d}if(u===Z){let d=0,h=s+3,C;for(;(C=j(p.charCodeAt(h)))>=0;)d=d*16+C,h++;return h>s+3&&d<=1114111&&p.charCodeAt(h)===Rr?(n+=String.fromCodePoint(d),h-s+1):(n+=p[s+1],2)}return n+=Lr[p[s+1]]||p[s+1],2};return _(u=>u-r&&(u!==_r?(n+=p[s],1):m())),p[s]===o?w():S("Bad string"),[,n]};c[V]=a(V);c[Y]=a(Y);f.string={'"':!0};var Pr=20;"= += -= *= /= %= |= &= ^= >>= <<=".split(" ").map(r=>A(r,Pr,!0));var Tr=30,kr=40,Dr=140;I("!",Dr);A("||",Tr);A("&&",kr);var Mr=50,Nr=60,Fr=70,b=100,$r=140;A("|",Mr);A("&",Fr);A("^",Nr);A(">>",b);A("<<",b);I("~",$r);var k=90;A("<",k);A(">",k);A("<=",k);A(">=",k);var rr=80;A("==",rr);A("!=",rr);var tr=110,O=120,er=140;A("+",tr);A("-",tr);A("*",O);A("/",O);A("%",O);I("+",er);I("-",er);var D=150;y("++",D,r=>r?["++",r,null]:["++",g(D-1)]);y("--",D,r=>r?["--",r,null]:["--",g(D-1)]);var Br=5,Xr=10;$(",",Xr);$(";",Br,!0,!0);var Or=170;W("()",Or);var or=170,Qr=160;B("[]",or);z(".",or);B("()",Qr);var ir=(r,t,e,n)=>typeof r=="string"?o=>t(o,r,o):r[0]==="."?(e=i(r[1]),n=r[2],o=>t(e(o),n,o)):r[0]==="[]"&&r.length===3?(e=i(r[1]),n=i(r[2]),o=>t(e(o),n(o),o)):r[0]==="()"&&r.length===2?ir(r[1],t):(()=>{throw Error("Invalid assignment target")})(),nr={"=":(r,t,e)=>r[t]=e,"+=":(r,t,e)=>r[t]+=e,"-=":(r,t,e)=>r[t]-=e,"*=":(r,t,e)=>r[t]*=e,"/=":(r,t,e)=>r[t]/=e,"%=":(r,t,e)=>r[t]%=e,"|=":(r,t,e)=>r[t]|=e,"&=":(r,t,e)=>r[t]&=e,"^=":(r,t,e)=>r[t]^=e,">>=":(r,t,e)=>r[t]>>=e,"<<=":(r,t,e)=>r[t]<<=e};for(let r in nr)l(r,(t,e)=>(e=i(e),ir(t,(n,o,m)=>nr[r](n,o,e(m)))));l("!",r=>(r=i(r),t=>!r(t)));l("||",(r,t)=>(r=i(r),t=i(t),e=>r(e)||t(e)));l("&&",(r,t)=>(r=i(r),t=i(t),e=>r(e)&&t(e)));l("~",r=>(r=i(r),t=>~r(t)));l("|",(r,t)=>(r=i(r),t=i(t),e=>r(e)|t(e)));l("&",(r,t)=>(r=i(r),t=i(t),e=>r(e)&t(e)));l("^",(r,t)=>(r=i(r),t=i(t),e=>r(e)^t(e)));l(">>",(r,t)=>(r=i(r),t=i(t),e=>r(e)>>t(e)));l("<<",(r,t)=>(r=i(r),t=i(t),e=>r(e)<<t(e)));l(">",(r,t)=>(r=i(r),t=i(t),e=>r(e)>t(e)));l("<",(r,t)=>(r=i(r),t=i(t),e=>r(e)<t(e)));l(">=",(r,t)=>(r=i(r),t=i(t),e=>r(e)>=t(e)));l("<=",(r,t)=>(r=i(r),t=i(t),e=>r(e)<=t(e)));l("==",(r,t)=>(r=i(r),t=i(t),e=>r(e)==t(e)));l("!=",(r,t)=>(r=i(r),t=i(t),e=>r(e)!=t(e)));l("+",(r,t)=>t!==void 0?(r=i(r),t=i(t),e=>r(e)+t(e)):(r=i(r),e=>+r(e)));l("-",(r,t)=>t!==void 0?(r=i(r),t=i(t),e=>r(e)-t(e)):(r=i(r),e=>-r(e)));l("*",(r,t)=>(r=i(r),t=i(t),e=>r(e)*t(e)));l("/",(r,t)=>(r=i(r),t=i(t),e=>r(e)/t(e)));l("%",(r,t)=>(r=i(r),t=i(t),e=>r(e)%t(e)));var Q=(r,t,e,n)=>typeof r=="string"?o=>t(o,r):r[0]==="."?(e=i(r[1]),n=r[2],o=>t(e(o),n)):r[0]==="[]"&&r.length===3?(e=i(r[1]),n=i(r[2]),o=>t(e(o),n(o))):r[0]==="()"&&r.length===2?Q(r[1],t):(()=>{throw Error("Invalid increment target")})();l("++",(r,t)=>Q(r,t===null?(e,n)=>e[n]++:(e,n)=>++e[n]));l("--",(r,t)=>Q(r,t===null?(e,n)=>e[n]--:(e,n)=>--e[n]));var sr=(...r)=>(r=r.map(i),t=>{let e;for(let n of r)e=n(t);return e});l(",",sr);l(";",sr);var pr=r=>r?.[0]==="_"&&r[1]==="_"||r==="constructor"||r==="prototype",M=r=>{throw Error(r)};l("[]",(r,t)=>t===void 0?(r=r?r[0]===","?r.slice(1):[r]:[],r=r.map(e=>e==null?(()=>{}):e[0]==="..."?(e=i(e[1]),n=>e(n)):(e=i(e),n=>[e(n)])),e=>r.flatMap(n=>n(e))):(t==null&&M("Missing index"),r=i(r),t=i(t),e=>{let n=t(e);return pr(n)?void 0:r(e)[n]}));l(".",(r,t)=>(r=i(r),t=t[0]?t:t[1],pr(t)?()=>{}:e=>r(e)[t]));l("()",(r,t)=>{if(t===void 0)return r==null?M("Empty ()"):i(r);let e=o=>o?.[0]===","&&o.slice(1).some(m=>m==null||e(m));e(t)&&M("Empty argument");let n=t?t[0]===","?(t=t.slice(1).map(i),o=>t.map(m=>m(o))):(t=i(t),o=>[t(o)]):()=>[];return mr(r,(o,m,u)=>o[m](...n(u)))});var mr=(r,t,e,n)=>r==null?M("Empty ()"):r[0]==="()"&&r.length==2?mr(r[1],t):typeof r=="string"?o=>t(o,r,o):r[0]==="."?(e=i(r[1]),n=r[2],o=>t(e(o),n,o)):r[0]==="?."?(e=i(r[1]),n=r[2],o=>{let m=e(o);return m==null?void 0:t(m,n,o)}):r[0]==="[]"&&r.length===3?(e=i(r[1]),n=i(r[2]),o=>t(e(o),n(o),o)):r[0]==="?.[]"?(e=i(r[1]),n=i(r[2]),o=>{let m=e(o);return m==null?void 0:t(m,n(o),o)}):(r=i(r),o=>t([r(o)],0,o));var lr=new WeakMap,Hr=(r,...t)=>typeof r=="string"?i(f(r)):lr.get(r)||lr.set(r,vr(r,t)).get(r),ur=57344,vr=(r,t)=>{let e=r.reduce((m,u,d)=>m+(d?String.fromCharCode(ur+d-1):"")+u,""),n=f(e),o=m=>{if(typeof m=="string"&&m.length===1){let u=m.charCodeAt(0)-ur,d;if(u>=0&&u<t.length)return d=t[u],Gr(d)?d:[,d]}return Array.isArray(m)?m.map(o):m};return i(o(n))},Gr=r=>typeof r=="string"||Array.isArray(r)&&(typeof r[0]=="string"||r[0]===void 0),zt=Hr;export{B as access,A as binary,i as compile,p as cur,zt as default,S as err,g as expr,W as group,Wr as id,s as idx,Vr as keyword,Kr as literal,G as loc,c as lookup,z as member,$ as nary,_ as next,l as operator,F as operators,Jr as parens,f as parse,fr as peek,N as prec,dr as propName,v as seek,w as skip,y as token,I as unary,zr as word};