subscript 10.7.0 → 10.7.1
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/eval/bigint.js +7 -0
- package/feature/bigint.js +33 -0
- package/feature/number.js +2 -5
- package/feature/string.js +31 -27
- package/feature/template.js +6 -3
- package/jessie.min.js +5 -6
- package/justin.min.js +6 -7
- package/package.json +1 -1
- package/subscript.min.js +4 -4
package/eval/bigint.js
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* BigInt literals - parse half: 123n, 0xFFn, 0b101n, 1_000n
|
|
3
|
+
*
|
|
4
|
+
* AST (token form, JSON-serializable):
|
|
5
|
+
* 123n → ['n', '123']
|
|
6
|
+
* 0xFFn → ['n', '0xFF']
|
|
7
|
+
*
|
|
8
|
+
* Not part of any dialect: import 'subscript/feature/bigint.js' to enable.
|
|
9
|
+
* Pair with 'subscript/eval/bigint.js' for runtime.
|
|
10
|
+
*/
|
|
11
|
+
import { lookup, idx, cur, skip, err } from '../parse.js';
|
|
12
|
+
|
|
13
|
+
const _n = 110, PERIOD = 46, _0 = 48, _9 = 57, _x = 120;
|
|
14
|
+
|
|
15
|
+
// Wrap number handler to check for `n` suffix (mirrors feature/unit.js)
|
|
16
|
+
const wrapNum = cc => {
|
|
17
|
+
const orig = lookup[cc];
|
|
18
|
+
if (!orig) return;
|
|
19
|
+
lookup[cc] = (a, prec) => {
|
|
20
|
+
const start = idx;
|
|
21
|
+
const r = orig(a, prec);
|
|
22
|
+
if (!r || r[0] !== undefined || cur.charCodeAt(idx) !== _n) return r;
|
|
23
|
+
const digits = cur.slice(start, idx).replace(/_/g, '');
|
|
24
|
+
// integer literals only: 1.5n, 1e3n are invalid (hex digits may contain e/E)
|
|
25
|
+
if ((cur.charCodeAt(start + 1) | 32) !== _x && /[.eE]/.test(digits)) err('Invalid BigInt');
|
|
26
|
+
skip();
|
|
27
|
+
return ['n', digits];
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
// Wrap digit and period handlers
|
|
32
|
+
for (let i = _0; i <= _9; i++) wrapNum(i);
|
|
33
|
+
wrapNum(PERIOD);
|
package/feature/number.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import { parse, lookup, next, err, skip, idx, cur } from '../parse.js';
|
|
7
7
|
|
|
8
|
-
const PERIOD = 46, _0 = 48, _9 = 57, _E = 69, _e = 101, PLUS = 43, MINUS = 45, UNDERSCORE = 95
|
|
8
|
+
const PERIOD = 46, _0 = 48, _9 = 57, _E = 69, _e = 101, PLUS = 43, MINUS = 45, UNDERSCORE = 95;
|
|
9
9
|
const _a = 97, _f = 102, _A = 65, _F = 70;
|
|
10
10
|
|
|
11
11
|
// Strip underscores only if present (avoid allocation for common case)
|
|
@@ -20,11 +20,9 @@ const dec = c =>
|
|
|
20
20
|
c === UNDERSCORE ||
|
|
21
21
|
((c === _E || c === _e) && ((c = cur.charCodeAt(idx + 1)) >= _0 && c <= _9 || c === PLUS || c === MINUS) ? 2 : 0);
|
|
22
22
|
|
|
23
|
-
// Decimal number
|
|
23
|
+
// Decimal number: 123, 1.5, 1e-3, 1_000
|
|
24
24
|
const num = a => {
|
|
25
25
|
let str = strip(next(dec));
|
|
26
|
-
// BigInt suffix
|
|
27
|
-
if (cur.charCodeAt(idx) === _n) { skip(); return [, BigInt(str)]; }
|
|
28
26
|
return (a = +str) != a ? err() : [, a];
|
|
29
27
|
};
|
|
30
28
|
|
|
@@ -48,7 +46,6 @@ lookup[_0] = (a, base) => {
|
|
|
48
46
|
if (pre[0] === '0' && (cur.charCodeAt(idx + 1) | 32) === pre.charCodeAt(1)) {
|
|
49
47
|
skip(2);
|
|
50
48
|
const str = strip(next(charTest(base = parse.number[pre])));
|
|
51
|
-
if (cur.charCodeAt(idx) === _n) { skip(); return [, BigInt('0' + pre[1] + str)]; }
|
|
52
49
|
return [, parseInt(str, base)];
|
|
53
50
|
}
|
|
54
51
|
}
|
package/feature/string.js
CHANGED
|
@@ -13,37 +13,41 @@ const hex = c =>
|
|
|
13
13
|
c >= 65 && c <= 70 ? c - 55 :
|
|
14
14
|
c >= 97 && c <= 102 ? c - 87 : -1;
|
|
15
15
|
|
|
16
|
+
// Decode the escape at idx (a BSLASH) → [decodedText, sourceCharsConsumed].
|
|
17
|
+
// Malformed escapes fall back to the literal next char; line continuations
|
|
18
|
+
// (\<LF>, \<CR><LF>) decode to ''. Shared by string literals and template
|
|
19
|
+
// literal text chunks (feature/template.js) — cooked semantics are identical.
|
|
20
|
+
const decodeEscape = () => {
|
|
21
|
+
const n = cur.charCodeAt(idx + 1);
|
|
22
|
+
if (n === LF) return ['', 2];
|
|
23
|
+
if (n === CR) return ['', cur.charCodeAt(idx + 2) === LF ? 3 : 2];
|
|
24
|
+
// \xHH or \uHHHH
|
|
25
|
+
if (n === X || (n === U && cur.charCodeAt(idx + 2) !== LBRACE)) {
|
|
26
|
+
const w = n === X ? 2 : 4;
|
|
27
|
+
let cp = 0, h;
|
|
28
|
+
for (let k = 0; k < w; k++) {
|
|
29
|
+
if ((h = hex(cur.charCodeAt(idx + 2 + k))) < 0) return [cur[idx + 1], 2];
|
|
30
|
+
cp = cp * 16 + h;
|
|
31
|
+
}
|
|
32
|
+
return [String.fromCharCode(cp), 2 + w];
|
|
33
|
+
}
|
|
34
|
+
// \u{H...H}
|
|
35
|
+
if (n === U) {
|
|
36
|
+
let cp = 0, k = idx + 3, h;
|
|
37
|
+
while ((h = hex(cur.charCodeAt(k))) >= 0) cp = cp * 16 + h, k++;
|
|
38
|
+
if (k > idx + 3 && cp <= 0x10ffff && cur.charCodeAt(k) === RBRACE)
|
|
39
|
+
return [String.fromCodePoint(cp), k - idx + 1];
|
|
40
|
+
return [cur[idx + 1], 2];
|
|
41
|
+
}
|
|
42
|
+
return [esc[cur[idx + 1]] || cur[idx + 1], 2];
|
|
43
|
+
};
|
|
44
|
+
|
|
16
45
|
// `s` is the closed-over accumulator shared with the escape handler.
|
|
17
46
|
const parseString = q => (a, _, s = '', qc = String.fromCharCode(q)) => {
|
|
18
47
|
if (a || !parse.string?.[qc]) return;
|
|
19
48
|
skip();
|
|
20
49
|
|
|
21
|
-
|
|
22
|
-
// Malformed escapes fall back to literal next char.
|
|
23
|
-
const escape = () => {
|
|
24
|
-
const n = cur.charCodeAt(idx + 1);
|
|
25
|
-
if (n === LF) return 2;
|
|
26
|
-
if (n === CR) return cur.charCodeAt(idx + 2) === LF ? 3 : 2;
|
|
27
|
-
// \xHH or \uHHHH
|
|
28
|
-
if (n === X || (n === U && cur.charCodeAt(idx + 2) !== LBRACE)) {
|
|
29
|
-
const w = n === X ? 2 : 4;
|
|
30
|
-
let cp = 0, h;
|
|
31
|
-
for (let k = 0; k < w; k++) {
|
|
32
|
-
if ((h = hex(cur.charCodeAt(idx + 2 + k))) < 0) return s += cur[idx + 1], 2;
|
|
33
|
-
cp = cp * 16 + h;
|
|
34
|
-
}
|
|
35
|
-
return s += String.fromCharCode(cp), 2 + w;
|
|
36
|
-
}
|
|
37
|
-
// \u{H...H}
|
|
38
|
-
if (n === U) {
|
|
39
|
-
let cp = 0, k = idx + 3, h;
|
|
40
|
-
while ((h = hex(cur.charCodeAt(k))) >= 0) cp = cp * 16 + h, k++;
|
|
41
|
-
if (k > idx + 3 && cp <= 0x10ffff && cur.charCodeAt(k) === RBRACE)
|
|
42
|
-
return s += String.fromCodePoint(cp), k - idx + 1;
|
|
43
|
-
return s += cur[idx + 1], 2;
|
|
44
|
-
}
|
|
45
|
-
return s += esc[cur[idx + 1]] || cur[idx + 1], 2;
|
|
46
|
-
};
|
|
50
|
+
const escape = () => { const [t, w] = decodeEscape(); s += t; return w; };
|
|
47
51
|
|
|
48
52
|
// c - q is 0 at close, NaN at EOF — both falsy, terminating the loop.
|
|
49
53
|
next(c => c - q && (c !== BSLASH ? (s += cur[idx], 1) : escape()));
|
|
@@ -55,4 +59,4 @@ lookup[DQUOTE] = parseString(DQUOTE);
|
|
|
55
59
|
lookup[SQUOTE] = parseString(SQUOTE);
|
|
56
60
|
parse.string = { '"': true };
|
|
57
61
|
|
|
58
|
-
export { esc };
|
|
62
|
+
export { esc, decodeEscape };
|
package/feature/template.js
CHANGED
|
@@ -4,19 +4,22 @@
|
|
|
4
4
|
* Tagged: tag`...` → ['``', 'tag', ...]
|
|
5
5
|
*/
|
|
6
6
|
import { parse, skip, err, expr, lookup, cur, idx } from '../parse.js';
|
|
7
|
+
import { decodeEscape } from './string.js';
|
|
7
8
|
|
|
8
9
|
const ACCESS = 170, BACKTICK = 96, DOLLAR = 36, OBRACE = 123, BSLASH = 92;
|
|
9
|
-
const esc = { n: '\n', r: '\r', t: '\t', b: '\b', f: '\f', v: '\v' };
|
|
10
10
|
|
|
11
11
|
// Parse template body after opening ` — string and expression segments
|
|
12
12
|
// strictly alternate (string, expr, string, …), so every interpolation is
|
|
13
13
|
// flanked by a string part even when empty: `${x}${y}` → [,''] x [,''] y [,''].
|
|
14
|
+
// Escapes cook exactly like string literals (decodeEscape: \n \xHH \uHHHH
|
|
15
|
+
// \u{H…H}, line continuations) — a template chunk `` must yield the
|
|
16
|
+
// same code point as the '' literal.
|
|
14
17
|
const parseBody = () => {
|
|
15
18
|
const parts = [];
|
|
16
|
-
let s = '', c;
|
|
19
|
+
let s = '', c, e;
|
|
17
20
|
for (; (c = cur.charCodeAt(idx)) !== BACKTICK; )
|
|
18
21
|
!c ? err('Unterminated template') :
|
|
19
|
-
c === BSLASH ? (
|
|
22
|
+
c === BSLASH ? (e = decodeEscape(), s += e[0], skip(e[1])) :
|
|
20
23
|
c === DOLLAR && cur.charCodeAt(idx + 1) === OBRACE ? (parts.push([, s]), s = '', skip(2), parts.push(expr(0, 125))) :
|
|
21
24
|
(s += cur[idx], skip());
|
|
22
25
|
return parts.push([, s]), skip(), parts;
|
package/jessie.min.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
var l,c,s=r=>(l=0,c=r,s.enter?.(),r=
|
|
1
|
+
var l,c,s=r=>(l=0,c=r,s.enter?.(),r=a(),c[l]?I():r||""),I=(r="Unexpected token",e=l,t=c.slice(0,e).split(`
|
|
2
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}
|
|
3
|
-
${n}${m}${u}`)},Be=(r,e=l)=>(Array.isArray(r)&&(r.loc=e),r),E=(r,e=l,t)=>{for(;t=r(c.charCodeAt(l));)l+=t;return c.slice(e,l)},h=(r=1)=>c[l+=r],T=r=>l=r,
|
|
4
|
-
`,r:"\r",t:" ",b:"\b",f:"\f",v:"\v",0:"\0"},Yr=r=>r>=48&&r<=57?r-48:r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:-1,
|
|
3
|
+
${n}${m}${u}`)},Be=(r,e=l)=>(Array.isArray(r)&&(r.loc=e),r),E=(r,e=l,t)=>{for(;t=r(c.charCodeAt(l));)l+=t;return c.slice(e,l)},h=(r=1)=>c[l+=r],T=r=>l=r,a=(r=0,e)=>{let t,o,n;for(e&&s.enter?.(r,e);(t=s.space())&&t!==e&&(n=s.step(o,r,t,a));)o=n;return e&&(t==e?(l++,s.exit?.(r,e)):I("Unclosed "+String.fromCharCode(e-(e>42?2:1)))),o},W=(r=l)=>{for(;c.charCodeAt(r)<=32;)r++;return c.charCodeAt(r)},Ro=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,S=(r,e=r.length)=>c.substr(l,e)===r&&!s.id(c.charCodeAt(l+e)),L=()=>(h(),a(0,41)),N=[],v={},g=(r,e=32,t,o=r.charCodeAt(0))=>Hr({op:r,l:r.length,p:v[r]=!N[o]&&v[r]||e,map:t,word:r.toUpperCase()!==r,kw:!1}),A=(r,e,t=!1)=>g(r,e,(o,n)=>o&&(n=a(e-(t?.5:0)))&&[r,o,n]),_=(r,e,t)=>g(r,e,o=>t?o&&[r,o]:!o&&(o=a(e-.5))&&[r,o]),$=(r,e)=>g(r,200,t=>!t&&[,e]),ir=(r,e,t,o)=>g(r,e,(n,p,m=n)=>(p=a(e-(t?.5:0)),n?.[0]!==r&&(n=[r,n||null]),p?.[0]===r?n.push(...p.slice(1)):p?n.push(p):o||W()===r.charCodeAt(0)?n.push(null):m&&n.length===2&&(n=n[1]),n)),z=(r,e)=>g(r[0],e,t=>!t&&[r,a(0,r.charCodeAt(1))||null]),sr=(r,e)=>g(r[0],e,t=>t&&[r,t,a(0,r.charCodeAt(1))||null]),pr=(r,e)=>(s.space(),e=c.charCodeAt(l),s.id(e)&&(e<48||e>57)?E(s.id):a(r)),Gr=(r,e)=>g(r,e,(t,o)=>t&&(o=pr(e))&&[r,t,o]),y=(r,e,t)=>(v[r]??=e,Hr({op:r,l:r.length,p:e,map:t,word:!0,kw:!0})),Fr=(r,e,t=(o,n,p,m=l,u,d,w)=>{for(w=0;d=r[w++];)if(!(d.kw&&o)&&!(p?d.op!==p:!((d.l<2||d.op.charCodeAt(1)===c.charCodeAt(l+1)&&(d.l<3||c.substr(l,d.l)===d.op))&&(!d.word||!s.id(c.charCodeAt(l+d.l)))&&(p=d.op)))&&!(n>=d.p)&&!(d.kw&&s.prop&&!s.prop(l+d.l))){if(l+=d.l,u=d.map(o))return Be(u,m);l=m,p=0,d.word||o||e||r[w]||I()}return e?.(o,n,p)})=>(t.ops=r,t.tail=e,t),Hr=(r,e=r.op.charCodeAt(0),t=N[e])=>N[e]=t?.ops?Fr([r,...t.ops],t.tail):Fr([r],t);s.space=r=>{for(;(r=c.charCodeAt(l))<=32;)l++;return r};s.step=(r,e,t,o,n)=>(n=N[t])&&n(r,e)||(r?null:E(s.id)||null);var nr={},f=(r,e,t=nr[r])=>nr[r]=(...o)=>e(...o)||t?.(...o),i=r=>Array.isArray(r)?r[0]==null?(e=>()=>e)(r[1]):nr[r[0]]?.(...r.slice(1))??I(`Unknown operator: ${r[0]}`,r?.loc):r===void 0?()=>{}:e=>e?.[r];var fr=46,H=48,x=57,Xr=69,Qr=101,Me=43,Ue=45,$r=95,Ke=97,De=102,Fe=65,Ge=70,xr=r=>r.indexOf("_")<0?r:r.replaceAll("_",""),He=r=>r===fr&&(r=c.charCodeAt(l+1))!==fr&&!(s.id(r)&&r>x&&r!==Qr&&r!==Xr)||r>=H&&r<=x||r===$r||((r===Xr||r===Qr)&&((r=c.charCodeAt(l+1))>=H&&r<=x||r===Me||r===Ue)?2:0),lr=r=>(r=+xr(E(He)))!=r?I():[,r],Xe=r=>e=>e===$r||e>=H&&e<=x&&e-H<r||r===16&&(e>=Ke&&e<=De||e>=Fe&&e<=Ge);s.number=null;N[fr]=r=>!r&&c.charCodeAt(l+1)>=H&&c.charCodeAt(l+1)<=x&&lr();for(let r=H;r<=x;r++)N[r]=e=>e?void 0:lr();N[H]=(r,e)=>{if(!r){for(let t in s.number)if(t[0]==="0"&&(c.charCodeAt(l+1)|32)===t.charCodeAt(1)){h(2);let o=xr(E(Xe(e=s.number[t])));return[,parseInt(o,e)]}return lr()}};var Qe=92,jr=34,Wr=39,zr=117,Jr=120,$e=123,xe=125,Vr=10,je=13,We={n:`
|
|
4
|
+
`,r:"\r",t:" ",b:"\b",f:"\f",v:"\v",0:"\0"},Yr=r=>r>=48&&r<=57?r-48:r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:-1,ur=()=>{let r=c.charCodeAt(l+1);if(r===Vr)return["",2];if(r===je)return["",c.charCodeAt(l+2)===Vr?3:2];if(r===Jr||r===zr&&c.charCodeAt(l+2)!==$e){let e=r===Jr?2:4,t=0,o;for(let n=0;n<e;n++){if((o=Yr(c.charCodeAt(l+2+n)))<0)return[c[l+1],2];t=t*16+o}return[String.fromCharCode(t),2+e]}if(r===zr){let e=0,t=l+3,o;for(;(o=Yr(c.charCodeAt(t)))>=0;)e=e*16+o,t++;return t>l+3&&e<=1114111&&c.charCodeAt(t)===xe?[String.fromCodePoint(e),t-l+1]:[c[l+1],2]}return[We[c[l+1]]||c[l+1],2]},Zr=r=>(e,t,o="",n=String.fromCharCode(r))=>{if(e||!s.string?.[n])return;h();let p=()=>{let[m,u]=ur();return o+=m,u};return E(m=>m-r&&(m!==Qe?(o+=c[l],1):p())),c[l]===n?h():I("Bad string"),[,o]};N[jr]=Zr(jr);N[Wr]=Zr(Wr);s.string={'"':!0};var ze=20;"= += -= *= /= %= |= &= ^= >>= <<=".split(" ").map(r=>A(r,ze,!0));var Je=30,Ve=40,Ye=140;_("!",Ye);A("||",Je);A("&&",Ve);var Ze=50,qe=60,be=70,qr=100,rt=140;A("|",Ze);A("&",be);A("^",qe);A(">>",qr);A("<<",qr);_("~",rt);var Y=90;A("<",Y);A(">",Y);A("<=",Y);A(">=",Y);var br=80;A("==",br);A("!=",br);var re=110,cr=120,ee=140;A("+",re);A("-",re);A("*",cr);A("/",cr);A("%",cr);_("+",ee);_("-",ee);var Z=150;g("++",Z,r=>r?["++",r,null]:["++",a(Z-1)]);g("--",Z,r=>r?["--",r,null]:["--",a(Z-1)]);var et=5,tt=10;ir(",",tt);ir(";",et,!0,!0);var ot=170;z("()",ot);var te=170,nt=160;sr("[]",te);Gr(".",te);sr("()",nt);var it=s.space;s.comment??={"//":`
|
|
5
5
|
`,"/*":"*/"};s.space=()=>{for(var r,e,t,o,n;r=it();){for(t in e=s.comment)if(r===t.charCodeAt(0)&&(t.length<2||c.charCodeAt(l+1)===t.charCodeAt(1))&&(t.length<3||c.substr(l,t.length)===t)){o=e[t],n=c.indexOf(o,l+t.length),T(n<0?c.length:o===`
|
|
6
|
-
`?n:n+o.length),r=0;break}if(r)return r}return r};var oe=80;A("===",oe);A("!==",oe);var st=30;A("??",st);var pt=130,ft=20;A("**",pt,!0);A("**=",ft,!0);var ne=90;A("in",ne);A("of",ne);var lt=20,ut=100;A(">>>",ut);A(">>>=",lt,!0);var
|
|
7
|
-
`,r:"\r",t:" ",b:"\b",f:"\f",v:"\v"},fe=()=>{let r=[],e="",t;for(;(t=c.charCodeAt(l))!==dr;)t?t===wt?(h(),e+=gt[c[l]]||c[l],h()):t===yt&&c.charCodeAt(l+1)===Ct?(r.push([,e]),e="",h(2),r.push(d(0,125))):(e+=c[l],h()):R("Unterminated template");return r.push([,e]),h(),r},Et=r=>r.length<2&&r[0]?.[0]===void 0?r[0]||[,""]:["`",...r],St=I[dr];I[dr]=(r,e)=>r&&e<At?s.asi&&s.newline?void 0:(h(),["``",r,...fe()]):r?St?.(r,e):(h(),Et(fe()));s.string["'"]=!0;s.number={"0x":16,"0b":2,"0o":8};var kt=92,Tt=117,Nt=123,It=125,Rt=183,Ot=s.id,le=r=>r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102,_t=(r=l+2,e,t=0,o=0)=>{if(c.charCodeAt(l)!==kt||c.charCodeAt(l+1)!==Tt)return 0;if(c.charCodeAt(r)===Nt){for(;le(e=c.charCodeAt(++r));)t=t*16+(e<=57?e-48:(e&31)+9);return r>l+3&&t<=1114111&&c.charCodeAt(r)===It?r-l+1:0}for(;o<4&&le(c.charCodeAt(r+o));)o++;return o===4?6:0};s.id=r=>Ot(r)||r===Rt||_t();var hr=5,ce=10,Ar=r=>{let e=l,t=d(ce-1);return t==null?r:r==="let"&&(t==="in"||t==="of")?(T(e),r):t[0]===","?[r,...t.slice(1)]:[r,t]};C("let",hr+1,()=>Ar("let"));C("const",hr+1,()=>Ar("const"));C("var",hr+1,()=>Ar("var"));var ue=r=>Array.isArray(r)&&r[0]==="="&&typeof r[1]=="string";C("using",200,()=>{let r=l;s.space();let e=c.charCodeAt(l);if(s.id(e)&&(e<48||e>57)){let t=l;if(E(s.id),s.space(),c.charCodeAt(l)===61&&c.charCodeAt(l+1)!==61&&c.charCodeAt(l+1)!==62){T(t);let o=d(ce-1);if(o[0]===","?o.slice(1).every(ue):ue(o))return o[0]===","?["using",...o.slice(1)]:["using",o]}}return T(r),"using"});var q=5,vt=59,B=()=>(s.space()===123||R("Expected {"),h(),d(q-.5,125)||null),K=()=>s.space()!==123?d(q+.5):(h(),d(q-.5,125)||null),Lt=()=>{let r=l;return s.space()===vt&&h(),s.space(),S("else")?(h(4),s.semi=!1,!0):(T(r),!1)};C("if",q+1,()=>{s.space();let r=["if",v(),K()];return Lt()&&r.push(K()),r});var Pt=200;C("function",Pt,()=>{s.space();let r=!1;c[l]==="*"&&(r=!0,h(),s.space());let e=E(s.id);return e&&s.space(),r?["function*",e,v()||null,B()]:["function",e,v()||null,B()]});var b=140,yr=20,Bt=40;_("await",b);var Mt=10,Ut=13,Kt=r=>{let e;for(;(e=c.charCodeAt(r))<=32;){if(e===Mt||e===Ut)return!0;r++}return!1};C("yield",b,()=>Kt(l)?["yield"]:(s.space(),c[l]==="*"?(h(),s.space(),["yield*",d(yr)]):["yield",d(yr)]));C("async",b,()=>{if(s.space(),S("function"))return["async",d(b)];let r=l,e=E(s.id);if(e){if(s.space(),c.charCodeAt(l)===Bt)return["async",e];T(r)}let t=d(yr-.5);return t&&["async",t]});var me=200;var Dt=90,Ft=175,Gt=160,Ht=Gt-.5;_("static",Ft);A("instanceof",Dt);g("#",me,r=>{if(r)return;let e=E(s.id);return e?"#"+e:void 0});C("class",me,()=>{s.space();let r=E(s.id)||null;if(r==="extends")r=null,s.space();else{if(s.space(),!S("extends"))return["class",r,null,B()];h(7),s.space()}return["class",r,d(Ht),B()]});var Cr=47,Xt=92,Qt=91,$t=93;g("/",140,r=>{let e=c.charCodeAt(l);if(r||e===Cr||e===42||e===43||e===63)return;let t=!1,o=E(p=>p===Xt?2:p===Qt?(t=!0,1):p===$t?(t=!1,1):p&&(t||p!==Cr));c.charCodeAt(l)===Cr||R("Unterminated regex"),h();let n=E(p=>p===103||p===105||p===109||p===115||p===117||p===121);return n?["//",o,n]:["//",o]});var X=5,J=125,V=59;C("while",X+1,()=>(s.space(),["while",v(),K()]));C("do",X+1,r=>(r=K(),s.space(),h(5),s.space(),["do",r,v()]));var ae={let:1,const:1,var:1},wr=(r,e=r,t)=>{if(ae[r?.[0]]&&Array.isArray(r[1]))return(e=wr(r[1]))?.[0]==="in"||e?.[0]==="of"?[e[0],[r[0],e[1]],r.length>2?[",",e[2],...r.slice(2)]:e[2]]:r;for(;Array.isArray(e)&&L[e[0]]<L.in&&!ae[e[0]];)t=e,e=e[1];return t&&Array.isArray(e)&&(e[0]==="in"||e[0]==="of")?(t[1]=e[2],[e[0],e[1],r]):r};C("for",X+1,()=>(s.space(),S("await")?(h(5),s.space(),["for await",wr(v()),K()]):["for",wr(v()),K()]));C("break",X+1,()=>{s.asi&&(s.newline=!1);let r=l,e=s.space();if(!e||e===J||e===V||s.newline)return["break"];let t=E(s.id);if(!t)return["break"];let o=s.space();return!o||o===J||o===V||s.newline?["break",t]:(T(r),["break"])});C("continue",X+1,()=>{s.asi&&(s.newline=!1);let r=l,e=s.space();if(!e||e===J||e===V||s.newline)return["continue"];let t=E(s.id);if(!t)return["continue"];let o=s.space();return!o||o===J||o===V||s.newline?["continue",t]:(T(r),["continue"])});C("return",X+1,()=>{s.asi&&(s.newline=!1);let r=s.space();return!r||r===J||r===V||s.newline?["return"]:["return",d(X)]});var gr=5;C("try",gr+1,()=>{let r=["try",B()];return s.space(),S("catch")&&(h(5),s.space(),r.push(["catch",W()===40?v():null,B()])),s.space(),S("finally")&&(h(7),r.push(["finally",B()])),r});C("throw",gr+1,()=>{if(s.asi&&(s.newline=!1),s.space(),s.newline)throw SyntaxError("Unexpected newline after throw");return["throw",d(gr)]});var Ae=5,xt=20,de=58,jt=59,Er=125,Sr=0,ye=(r,e=r.length,t=r.charCodeAt(0),o=I[t])=>I[t]=(n,p,m)=>S(r)&&!n&&Sr&&(!s.prop||s.prop(l+e))||o?.(n,p,m);ye("case");ye("default");var he=r=>{let e=[];for(;(r=s.space())!==Er&&!S("case")&&!S("default");){if(r===jt){h();continue}s.semi=!1,e.push(d(Ae+.5))||R()}return e.length>1?[";",...e]:e[0]||null},Wt=()=>{s.space()===123||R("Expected {"),h(),Sr++;let r=[];try{for(;s.space()!==Er;)if(S("case")){T(l+4),s.space(),s.semi=!1;let e=d(xt-.5);s.space()===de&&h(),r.push(["case",e,he()])}else S("default")?(T(l+7),s.space()===de&&h(),r.push(["default",he()])):R("Expected case or default")}finally{Sr--}return h(),s.exit?.(0,Er),r};C("switch",Ae+1,()=>s.space()===40&&["switch",v(),...Wt()]);var kr=5,zt=20;C("debugger",kr+1,()=>["debugger"]);C("with",kr+1,()=>(s.space(),["with",v(),K()]));var Jt=["if","for","while","do","switch","try"];g(":",zt-1,r=>typeof r=="string"&&(s.space(),Jt.some(e=>S(e)))&&[":",r,d(kr)]);var Tr=5,j=10,Ce=42,Vt=I[Ce];I[Ce]=(r,e)=>r?Vt?.(r,e):(h(),"*");g("from",j+1,r=>r?r[0]!=="="&&r[0]!==","&&(s.space(),["from",r,d(j+1)]):!1);g("as",j+2,r=>r?(s.space(),["as",r,d(j+2)]):!1);C("import",Tr,()=>S(".meta")?(h(5),["import.meta"]):["import",d(j)]);C("export",Tr,()=>(s.space(),S("default")?(h(7),["export",["default",d(j)]]):["export",d(Tr)]));var Ir=20,we=200,Yt=10,Zt=13,qt=34,bt=35,ro=39,ge=40,Rr=41,eo=91,Or=123,_r=125,to=(r,e)=>{for(;r<e;){let t=c.charCodeAt(r++);if(t===Yt||t===Zt)return!0}return!1},oo=r=>r===qt||r===ro||r===eo||r===bt,Ee=()=>E(s.id)||(oo(c.charCodeAt(l))?d(we-.5):null),no=r=>typeof r=="string"||Array.isArray(r)&&(r[0]===void 0||r[0]==="[]"),Se=r=>e=>{if(e)return;let t=l;if(s.space(),s.semi||to(t,l))return!1;let o=Ee();if(!o||(s.space(),c.charCodeAt(l)!==ge))return!1;h();let n=d(0,Rr);return s.space(),c.charCodeAt(l)!==Or?!1:(h(),[r,o,n,d(0,_r)])};g("get",Ir-1,Se("get"));g("set",Ir-1,Se("set"));var Nr=r=>r==null||typeof r=="string"||Array.isArray(r)&&(r[0]===","?r.slice(1).every(Nr):r[0]==="="?typeof r[1]=="string"||Nr(r[1]):r[0]==="..."||r[0]==="{}"||r[0]==="[]"),io=L["*"];g("*",we,r=>{let e=r&&s.newline;if(r&&!e)return;let t=l,o=Ee();if(!o)return r?(T(t),void 0):!1;if(s.space(),c.charCodeAt(l)!==ge)return r?(T(t),void 0):!1;h();let n=d(0,Rr)||null;if(r&&!Nr(n))return T(t),void 0;if(s.space(),c.charCodeAt(l)!==Or)return r?(T(t),void 0):!1;h();let p=[":",o,["function*",null,n,d(0,_r)||null]];return r?r[0]===";"?(r.push(p),r):[";",r,p]:p});L["*"]=io;g("(",Ir-1,r=>{if(!r)return;let e,t;if(Array.isArray(r)&&r[0]==="static"&&(e="static",r=r[1]),Array.isArray(r)&&r[0]==="async"&&(t=!0,r=r[1]),!no(r))return;let o=d(0,Rr)||null;if(s.space(),c.charCodeAt(l)!==Or)return;h();let n=["=>",["()",o],d(0,_r)||null];t&&(n=["async",n]);let p=[":",r,n];return e?[e,p]:p});s.comment["#!"]=`
|
|
8
|
-
`;var Ie=32,Br=10,so=59,po=125,ke=91,Te=40,rr=L.asi??L[";"],fo=s._baseSpace??=s.space,lo=s._baseStep??=s.step,vr=r=>Array.isArray(r)||typeof r=="string",uo=(L[";"]??5)+1,Pr=r=>Array.isArray(r)&&(L[r[0]]<=uo||r[0]==="{}"&&Pr(r[1])),co=(r,e)=>{for(;(e=c.charCodeAt(r))<=Ie;){if(e===Br)return!0;r++}return!1},mo=(r=l,e)=>{for(;r-- >0&&(e=c.charCodeAt(r))<=Ie;)if(e===Br)return!0;return!1};s.space=(r,e)=>{for(;;){for(e=l,r=fo();e<l;)if(c.charCodeAt(e++)===Br){s.newline=!0;break}if(r===so&&co(l+1)){T(l+1),s.newline=s.semi=!0;continue}return r}};s.enter=()=>s.newline=s.semi=!1;s.exit=(r,e)=>{e===po&&(s.newline=!0,s.semi=!1)};s.step=(r,e,t,o)=>{if(s.semi&&e>=rr)return!1;if(r&&!vr(r))return null;if(vr(r)){let p=(t===ke||t===Te)&&mo();if(s.semi||t===ke&&(p||Pr(r))||t===Te&&(Pr(r)||p&&e>=rr))return Ne(r,e,o)??null}let n=s.newline;return lo(r,e,t,o)??(vr(r)&&n?Ne(r,e,o)??null:null)};var Lr=0,ao=2e3,Ne=s.asi=(r,e,t,o,n)=>{if(e>=rr||Lr>=ao)return;s.semi=!1;let p=l;Lr++;try{o=t(rr-.5)}finally{Lr--}if(!(!o||l===p))return n=o?.[0]===";"?o.slice(1):[o],r?.[0]===";"?(r.push(...n),r):[";",r,...n]};var Oe=(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?Oe(r[1],e):(()=>{throw Error("Invalid assignment target")})(),Re={"=":(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 Re)f(r,(e,t)=>(t=i(t),Oe(e,(o,n,p)=>Re[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 Mr=(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?Mr(r[1],e):(()=>{throw Error("Invalid increment target")})();f("++",(r,e)=>Mr(r,e===null?(t,o)=>t[o]++:(t,o)=>++t[o]));f("--",(r,e)=>Mr(r,e===null?(t,o)=>t[o]--:(t,o)=>--t[o]));var _e=(...r)=>(r=r.map(i),e=>{let t;for(let o of r)t=o(e);return t});f(",",_e);f(";",_e);var Q=r=>r?.[0]==="_"&&r[1]==="_"||r==="constructor"||r==="prototype",er=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&&er("Missing index"),r=i(r),e=i(e),t=>{let o=e(t);return Q(o)?void 0:r(t)[o]}));f(".",(r,e)=>(r=i(r),e=e[0]?e:e[1],Q(e)?()=>{}:t=>r(t)[e]));f("()",(r,e)=>{if(e===void 0)return r==null?er("Empty ()"):i(r);let t=n=>n?.[0]===","&&n.slice(1).some(p=>p==null||t(p));t(e)&&er("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 Ur(r,(n,p,m)=>n[p](...o(m)))});var M=r=>typeof r=="string"||Array.isArray(r)&&(r[0]==="."||r[0]==="?."||r[0]==="[]"&&r.length===3||r[0]==="?.[]"||r[0]==="()"&&r.length===2&&M(r[1])||r[0]==="{}"),Ur=(r,e,t,o)=>r==null?er("Empty ()"):r[0]==="()"&&r.length==2?Ur(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)),D=Ur;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 ho=r=>{throw Error(r)};f("**",(r,e)=>(r=i(r),e=i(e),t=>r(t)**e(t)));f("**=",(r,e)=>(M(r)||ho("Invalid assignment target"),e=i(e),D(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 Ao=r=>{throw Error(r)};f(">>>",(r,e)=>(r=i(r),e=i(e),t=>r(t)>>>e(t)));f(">>>=",(r,e)=>(M(r)||Ao("Invalid assignment target"),e=i(e),D(r,(t,o,n)=>t[o]>>>=e(n))));var yo=r=>r[0]?.[0]===","?r[0].slice(1):r,F=(r,e,t)=>{if(typeof r=="string"){t[r]=e;return}let[o,...n]=r,p=yo(n);if(o==="{}"){let m=[];for(let u of p){if(Array.isArray(u)&&u[0]==="..."){let w={};for(let O in e)m.includes(O)||(w[O]=e[O]);t[u[1]]=w;break}let a,y,N;typeof u=="string"?a=y=u:u[0]==="="?(typeof u[1]=="string"?a=y=u[1]:[,a,y]=u[1],N=u[2]):[,a,y]=u,m.push(a);let k=e[a];k===void 0&&N&&(k=i(N)(t)),F(y,k,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 N=e[m++];N===void 0&&y&&(N=i(y)(t)),F(a,N,t)}}},Kr=(...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=>F(t,n(p),p)}return i(e)}),e=>{for(let t of r)t(e)});f("let",Kr);f("const",Kr);f("var",Kr);var tr=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=>F(t,e(o),o)}return M(r)||tr("Invalid assignment target"),e=i(e),D(r,(t,o,n)=>t[o]=e(n))});f("||=",(r,e)=>(M(r)||tr("Invalid assignment target"),e=i(e),D(r,(t,o,n)=>t[o]||=e(n))));f("&&=",(r,e)=>(M(r)||tr("Invalid assignment target"),e=i(e),D(r,(t,o,n)=>t[o]&&=e(n))));f("??=",(r,e)=>(M(r)||tr("Invalid assignment target"),e=i(e),D(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),u=>(...a)=>{let y={};t.forEach((k,w)=>y[k]=a[w]),n&&(y[n]=a.slice(o));let N=new Proxy(y,{get:(k,w)=>w in k?k[w]:u?.[w],set:(k,w,O)=>((w in k?k:u)[w]=O,!0),has:(k,w)=>w in k||(u?w in u:!1)});try{let k=e(N);return m?void 0:k}catch(k){if(k===P)return k[0];throw k}}});f("...",r=>(r=i(r),e=>Object.entries(r(e))));f("?.",(r,e)=>(r=i(r),Q(e)?()=>{}:t=>r(t)?.[e]));f("?.[]",(r,e)=>(r=i(r),e=i(e),t=>{let o=e(t);return Q(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]==="."||r[0]==="?."){let n=i(r[1]),p=r[2];return Q(p)?()=>{}:m=>n(m)?.[p]?.(...t(m))}if((r[0]==="[]"||r[0]==="?.[]")&&r.length===3){let n=i(r[1]),p=i(r[2]);return m=>{let u=p(m);return Q(u)?void 0:n(m)?.[u]?.(...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 or=Symbol("accessor");f("get",(r,e)=>(e=e?i(e):()=>{},t=>[[or,r,{get:function(){let o=Object.create(t||{});return o.this=this,e(o)}}]]));f("set",(r,e,t)=>(t=t?i(t):()=>{},o=>[[or,r,{set:function(n){let p=Object.create(o||{});p.this=this,p[e]=n,t(p)}}]]));var Co=r=>r==null||typeof r=="string"||[":",",","...","get","set"].includes(r[0]);f("{}",(r,e)=>{if(e!==void 0)return;if(!Co(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]===or){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 N={};o.forEach((w,O)=>N[w]=y[O]),n&&(N[n]=y.slice(p));let k=new Proxy(N,{get:(w,O)=>O in w?w[O]:u[O],set:(w,O,Pe)=>((O in w?w:u)[O]=Pe,!0),has:(w,O)=>O in w||O in u});try{return t(k)}catch(w){if(w===P)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 wo=Symbol("static"),go=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 go("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,N]of a)y==="constructor"?p.prototype.__constructor__=N:p.prototype[y]=N}return r&&(o[r]=p),p}));f("static",r=>(r=i(r),e=>[[wo,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 U=Symbol("break"),G=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===U)break;if(n===G)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===U)break;if(n===G)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(u){if(u===U)break;if(u===G)continue;if(u===P)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 So(o,n,e);if(t==="of")return Eo(o,n,e)}});var 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 u of e(n)){o?F(r,u,n):n[r]=u;try{p=t(n)}catch(a){if(a===U)break;if(a===G)continue;if(a===P)return a[0];throw a}}return o||(n[r]=m),p}},So=(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?F(r,u,n):n[r]=u;try{p=t(n)}catch(a){if(a===U)break;if(a===G)continue;if(a===P)return a[0];throw a}}return o||(n[r]=m),p}};f("break",()=>()=>{throw U});f("continue",()=>()=>{throw G});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(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===U||y===G||y===P)throw y;if(n!=null&&p){let N=n in u,k=u[n];u[n]=y;try{a=p(u)}finally{N?u[n]=k: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===U)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 ve=new WeakMap,ko=(r,...e)=>typeof r=="string"?i(s(r)):ve.get(r)||ve.set(r,To(r,e)).get(r),Le=57344,To=(r,e)=>{let t=r.reduce((p,m,u)=>p+(u?String.fromCharCode(Le+u-1):"")+m,""),o=s(t),n=p=>{if(typeof p=="string"&&p.length===1){let m=p.charCodeAt(0)-Le,u;if(m>=0&&m<e.length)return u=e[m],No(u)?u:[,u]}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=ko;export{sr as access,A as binary,i as compile,c as cur,Io as default,R as err,d as expr,z as group,Ro as id,l as idx,C as keyword,$ as literal,Be as loc,I as lookup,Fr as member,ir as nary,E as next,f as operator,nr as operators,v as parens,s as parse,W as peek,L as prec,pr as propName,T as seek,h as skip,g as token,_ as unary,S as word};
|
|
6
|
+
`?n:n+o.length),r=0;break}if(r)return r}return r};var oe=80;A("===",oe);A("!==",oe);var st=30;A("??",st);var pt=130,ft=20;A("**",pt,!0);A("**=",ft,!0);var ne=90;A("in",ne);A("of",ne);var lt=20,ut=100;A(">>>",ut);A(">>>=",lt,!0);var mr=20;A("||=",mr,!0);A("&&=",mr,!0);A("??=",mr,!0);$("true",!0);$("false",!1);$("null",null);y("undefined",200,()=>[]);$("NaN",NaN);$("Infinity",1/0);var ar=20;g("?",ar,(r,e,t)=>r&&(e=a(ar-1))&&E(o=>o===58)&&(t=a(ar-1),["?",r,e,t]));var ct=20;A("=>",ct,!0);var mt=20;_("...",mt);var ie=170;g("?.",ie,(r,e)=>{if(!r)return;let t=s.space();return t===40?(h(),["?.()",r,a(0,41)||null]):t===91?(h(),["?.[]",r,a(0,93)]):(e=pr(ie),e?["?.",r,e]:void 0)});var dr=140,se=160,at=se+1;_("typeof",dr);_("void",dr);_("delete",dr);var dt=r=>s.space()===40?(h(),["()",r,a(0,41)||null]):r;y("new",at,()=>S(".target")?(h(7),["new.target"]):["new",dt(a(se))]);var ht=20,pe=200;s.prop=r=>W(r)!==58;z("[]",pe);z("{}",pe);A(":",ht-1,!0);var At=170,hr=96,yt=36,wt=123,Ct=92,fe=()=>{let r=[],e="",t,o;for(;(t=c.charCodeAt(l))!==hr;)t?t===Ct?(o=ur(),e+=o[0],h(o[1])):t===yt&&c.charCodeAt(l+1)===wt?(r.push([,e]),e="",h(2),r.push(a(0,125))):(e+=c[l],h()):I("Unterminated template");return r.push([,e]),h(),r},gt=r=>r.length<2&&r[0]?.[0]===void 0?r[0]||[,""]:["`",...r],Et=N[hr];N[hr]=(r,e)=>r&&e<At?s.asi&&s.newline?void 0:(h(),["``",r,...fe()]):r?Et?.(r,e):(h(),gt(fe()));s.string["'"]=!0;s.number={"0x":16,"0b":2,"0o":8};var St=92,kt=117,Tt=123,Nt=125,Rt=183,It=s.id,le=r=>r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102,Ot=(r=l+2,e,t=0,o=0)=>{if(c.charCodeAt(l)!==St||c.charCodeAt(l+1)!==kt)return 0;if(c.charCodeAt(r)===Tt){for(;le(e=c.charCodeAt(++r));)t=t*16+(e<=57?e-48:(e&31)+9);return r>l+3&&t<=1114111&&c.charCodeAt(r)===Nt?r-l+1:0}for(;o<4&&le(c.charCodeAt(r+o));)o++;return o===4?6:0};s.id=r=>It(r)||r===Rt||Ot();var Ar=5,ce=10,yr=r=>{let e=l,t=a(ce-1);return t==null?r:r==="let"&&(t==="in"||t==="of")?(T(e),r):t[0]===","?[r,...t.slice(1)]:[r,t]};y("let",Ar+1,()=>yr("let"));y("const",Ar+1,()=>yr("const"));y("var",Ar+1,()=>yr("var"));var ue=r=>Array.isArray(r)&&r[0]==="="&&typeof r[1]=="string";y("using",200,()=>{let r=l;s.space();let e=c.charCodeAt(l);if(s.id(e)&&(e<48||e>57)){let t=l;if(E(s.id),s.space(),c.charCodeAt(l)===61&&c.charCodeAt(l+1)!==61&&c.charCodeAt(l+1)!==62){T(t);let o=a(ce-1);if(o[0]===","?o.slice(1).every(ue):ue(o))return o[0]===","?["using",...o.slice(1)]:["using",o]}}return T(r),"using"});var q=5,_t=59,B=()=>(s.space()===123||I("Expected {"),h(),a(q-.5,125)||null),K=()=>s.space()!==123?a(q+.5):(h(),a(q-.5,125)||null),Lt=()=>{let r=l;return s.space()===_t&&h(),s.space(),S("else")?(h(4),s.semi=!1,!0):(T(r),!1)};y("if",q+1,()=>{s.space();let r=["if",L(),K()];return Lt()&&r.push(K()),r});var vt=200;y("function",vt,()=>{s.space();let r=!1;c[l]==="*"&&(r=!0,h(),s.space());let e=E(s.id);return e&&s.space(),r?["function*",e,L()||null,B()]:["function",e,L()||null,B()]});var b=140,wr=20,Pt=40;_("await",b);var Bt=10,Mt=13,Ut=r=>{let e;for(;(e=c.charCodeAt(r))<=32;){if(e===Bt||e===Mt)return!0;r++}return!1};y("yield",b,()=>Ut(l)?["yield"]:(s.space(),c[l]==="*"?(h(),s.space(),["yield*",a(wr)]):["yield",a(wr)]));y("async",b,()=>{if(s.space(),S("function"))return["async",a(b)];let r=l,e=E(s.id);if(e){if(s.space(),c.charCodeAt(l)===Pt)return["async",e];T(r)}let t=a(wr-.5);return t&&["async",t]});var me=200;var Kt=90,Dt=175,Ft=160,Gt=Ft-.5;_("static",Dt);A("instanceof",Kt);g("#",me,r=>{if(r)return;let e=E(s.id);return e?"#"+e:void 0});y("class",me,()=>{s.space();let r=E(s.id)||null;if(r==="extends")r=null,s.space();else{if(s.space(),!S("extends"))return["class",r,null,B()];h(7),s.space()}return["class",r,a(Gt),B()]});var Cr=47,Ht=92,Xt=91,Qt=93;g("/",140,r=>{let e=c.charCodeAt(l);if(r||e===Cr||e===42||e===43||e===63)return;let t=!1,o=E(p=>p===Ht?2:p===Xt?(t=!0,1):p===Qt?(t=!1,1):p&&(t||p!==Cr));c.charCodeAt(l)===Cr||I("Unterminated regex"),h();let n=E(p=>p===103||p===105||p===109||p===115||p===117||p===121);return n?["//",o,n]:["//",o]});var X=5,J=125,V=59;y("while",X+1,()=>(s.space(),["while",L(),K()]));y("do",X+1,r=>(r=K(),s.space(),h(5),s.space(),["do",r,L()]));var ae={let:1,const:1,var:1},gr=(r,e=r,t)=>{if(ae[r?.[0]]&&Array.isArray(r[1]))return(e=gr(r[1]))?.[0]==="in"||e?.[0]==="of"?[e[0],[r[0],e[1]],r.length>2?[",",e[2],...r.slice(2)]:e[2]]:r;for(;Array.isArray(e)&&v[e[0]]<v.in&&!ae[e[0]];)t=e,e=e[1];return t&&Array.isArray(e)&&(e[0]==="in"||e[0]==="of")?(t[1]=e[2],[e[0],e[1],r]):r};y("for",X+1,()=>(s.space(),S("await")?(h(5),s.space(),["for await",gr(L()),K()]):["for",gr(L()),K()]));y("break",X+1,()=>{s.asi&&(s.newline=!1);let r=l,e=s.space();if(!e||e===J||e===V||s.newline)return["break"];let t=E(s.id);if(!t)return["break"];let o=s.space();return!o||o===J||o===V||s.newline?["break",t]:(T(r),["break"])});y("continue",X+1,()=>{s.asi&&(s.newline=!1);let r=l,e=s.space();if(!e||e===J||e===V||s.newline)return["continue"];let t=E(s.id);if(!t)return["continue"];let o=s.space();return!o||o===J||o===V||s.newline?["continue",t]:(T(r),["continue"])});y("return",X+1,()=>{s.asi&&(s.newline=!1);let r=s.space();return!r||r===J||r===V||s.newline?["return"]:["return",a(X)]});var Er=5;y("try",Er+1,()=>{let r=["try",B()];return s.space(),S("catch")&&(h(5),s.space(),r.push(["catch",W()===40?L():null,B()])),s.space(),S("finally")&&(h(7),r.push(["finally",B()])),r});y("throw",Er+1,()=>{if(s.asi&&(s.newline=!1),s.space(),s.newline)throw SyntaxError("Unexpected newline after throw");return["throw",a(Er)]});var Ae=5,$t=20,de=58,xt=59,Sr=125,kr=0,ye=(r,e=r.length,t=r.charCodeAt(0),o=N[t])=>N[t]=(n,p,m)=>S(r)&&!n&&kr&&(!s.prop||s.prop(l+e))||o?.(n,p,m);ye("case");ye("default");var he=r=>{let e=[];for(;(r=s.space())!==Sr&&!S("case")&&!S("default");){if(r===xt){h();continue}s.semi=!1,e.push(a(Ae+.5))||I()}return e.length>1?[";",...e]:e[0]||null},jt=()=>{s.space()===123||I("Expected {"),h(),kr++;let r=[];try{for(;s.space()!==Sr;)if(S("case")){T(l+4),s.space(),s.semi=!1;let e=a($t-.5);s.space()===de&&h(),r.push(["case",e,he()])}else S("default")?(T(l+7),s.space()===de&&h(),r.push(["default",he()])):I("Expected case or default")}finally{kr--}return h(),s.exit?.(0,Sr),r};y("switch",Ae+1,()=>s.space()===40&&["switch",L(),...jt()]);var Tr=5,Wt=20;y("debugger",Tr+1,()=>["debugger"]);y("with",Tr+1,()=>(s.space(),["with",L(),K()]));var zt=["if","for","while","do","switch","try"];g(":",Wt-1,r=>typeof r=="string"&&(s.space(),zt.some(e=>S(e)))&&[":",r,a(Tr)]);var Nr=5,j=10,we=42,Jt=N[we];N[we]=(r,e)=>r?Jt?.(r,e):(h(),"*");g("from",j+1,r=>r?r[0]!=="="&&r[0]!==","&&(s.space(),["from",r,a(j+1)]):!1);g("as",j+2,r=>r?(s.space(),["as",r,a(j+2)]):!1);y("import",Nr,()=>S(".meta")?(h(5),["import.meta"]):["import",a(j)]);y("export",Nr,()=>(s.space(),S("default")?(h(7),["export",["default",a(j)]]):["export",a(Nr)]));var Ir=20,Ce=200,Vt=10,Yt=13,Zt=34,qt=35,bt=39,ge=40,Or=41,ro=91,_r=123,Lr=125,eo=(r,e)=>{for(;r<e;){let t=c.charCodeAt(r++);if(t===Vt||t===Yt)return!0}return!1},to=r=>r===Zt||r===bt||r===ro||r===qt,Ee=()=>E(s.id)||(to(c.charCodeAt(l))?a(Ce-.5):null),oo=r=>typeof r=="string"||Array.isArray(r)&&(r[0]===void 0||r[0]==="[]"),Se=r=>e=>{if(e)return;let t=l;if(s.space(),s.semi||eo(t,l))return!1;let o=Ee();if(!o||(s.space(),c.charCodeAt(l)!==ge))return!1;h();let n=a(0,Or);return s.space(),c.charCodeAt(l)!==_r?!1:(h(),[r,o,n,a(0,Lr)])};g("get",Ir-1,Se("get"));g("set",Ir-1,Se("set"));var Rr=r=>r==null||typeof r=="string"||Array.isArray(r)&&(r[0]===","?r.slice(1).every(Rr):r[0]==="="?typeof r[1]=="string"||Rr(r[1]):r[0]==="..."||r[0]==="{}"||r[0]==="[]"),no=v["*"];g("*",Ce,r=>{let e=r&&s.newline;if(r&&!e)return;let t=l,o=Ee();if(!o)return r?(T(t),void 0):!1;if(s.space(),c.charCodeAt(l)!==ge)return r?(T(t),void 0):!1;h();let n=a(0,Or)||null;if(r&&!Rr(n))return T(t),void 0;if(s.space(),c.charCodeAt(l)!==_r)return r?(T(t),void 0):!1;h();let p=[":",o,["function*",null,n,a(0,Lr)||null]];return r?r[0]===";"?(r.push(p),r):[";",r,p]:p});v["*"]=no;g("(",Ir-1,r=>{if(!r)return;let e,t;if(Array.isArray(r)&&r[0]==="static"&&(e="static",r=r[1]),Array.isArray(r)&&r[0]==="async"&&(t=!0,r=r[1]),!oo(r))return;let o=a(0,Or)||null;if(s.space(),c.charCodeAt(l)!==_r)return;h();let n=["=>",["()",o],a(0,Lr)||null];t&&(n=["async",n]);let p=[":",r,n];return e?[e,p]:p});s.comment["#!"]=`
|
|
7
|
+
`;var Re=32,Mr=10,io=59,so=125,ke=91,Te=40,rr=v.asi??v[";"],po=s._baseSpace??=s.space,fo=s._baseStep??=s.step,vr=r=>Array.isArray(r)||typeof r=="string",lo=(v[";"]??5)+1,Br=r=>Array.isArray(r)&&(v[r[0]]<=lo||r[0]==="{}"&&Br(r[1])),uo=(r,e)=>{for(;(e=c.charCodeAt(r))<=Re;){if(e===Mr)return!0;r++}return!1},co=(r=l,e)=>{for(;r-- >0&&(e=c.charCodeAt(r))<=Re;)if(e===Mr)return!0;return!1};s.space=(r,e)=>{for(;;){for(e=l,r=po();e<l;)if(c.charCodeAt(e++)===Mr){s.newline=!0;break}if(r===io&&uo(l+1)){T(l+1),s.newline=s.semi=!0;continue}return r}};s.enter=()=>s.newline=s.semi=!1;s.exit=(r,e)=>{e===so&&(s.newline=!0,s.semi=!1)};s.step=(r,e,t,o)=>{if(s.semi&&e>=rr)return!1;if(r&&!vr(r))return null;if(vr(r)){let p=(t===ke||t===Te)&&co();if(s.semi||t===ke&&(p||Br(r))||t===Te&&(Br(r)||p&&e>=rr))return Ne(r,e,o)??null}let n=s.newline;return fo(r,e,t,o)??(vr(r)&&n?Ne(r,e,o)??null:null)};var Pr=0,mo=2e3,Ne=s.asi=(r,e,t,o,n)=>{if(e>=rr||Pr>=mo)return;s.semi=!1;let p=l;Pr++;try{o=t(rr-.5)}finally{Pr--}if(!(!o||l===p))return n=o?.[0]===";"?o.slice(1):[o],r?.[0]===";"?(r.push(...n),r):[";",r,...n]};var Oe=(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?Oe(r[1],e):(()=>{throw Error("Invalid assignment target")})(),Ie={"=":(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 Ie)f(r,(e,t)=>(t=i(t),Oe(e,(o,n,p)=>Ie[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 Ur=(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?Ur(r[1],e):(()=>{throw Error("Invalid increment target")})();f("++",(r,e)=>Ur(r,e===null?(t,o)=>t[o]++:(t,o)=>++t[o]));f("--",(r,e)=>Ur(r,e===null?(t,o)=>t[o]--:(t,o)=>--t[o]));var _e=(...r)=>(r=r.map(i),e=>{let t;for(let o of r)t=o(e);return t});f(",",_e);f(";",_e);var Q=r=>r?.[0]==="_"&&r[1]==="_"||r==="constructor"||r==="prototype",er=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&&er("Missing index"),r=i(r),e=i(e),t=>{let o=e(t);return Q(o)?void 0:r(t)[o]}));f(".",(r,e)=>(r=i(r),e=e[0]?e:e[1],Q(e)?()=>{}:t=>r(t)[e]));f("()",(r,e)=>{if(e===void 0)return r==null?er("Empty ()"):i(r);let t=n=>n?.[0]===","&&n.slice(1).some(p=>p==null||t(p));t(e)&&er("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 Kr(r,(n,p,m)=>n[p](...o(m)))});var M=r=>typeof r=="string"||Array.isArray(r)&&(r[0]==="."||r[0]==="?."||r[0]==="[]"&&r.length===3||r[0]==="?.[]"||r[0]==="()"&&r.length===2&&M(r[1])||r[0]==="{}"),Kr=(r,e,t,o)=>r==null?er("Empty ()"):r[0]==="()"&&r.length==2?Kr(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)),D=Kr;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 ao=r=>{throw Error(r)};f("**",(r,e)=>(r=i(r),e=i(e),t=>r(t)**e(t)));f("**=",(r,e)=>(M(r)||ao("Invalid assignment target"),e=i(e),D(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 ho=r=>{throw Error(r)};f(">>>",(r,e)=>(r=i(r),e=i(e),t=>r(t)>>>e(t)));f(">>>=",(r,e)=>(M(r)||ho("Invalid assignment target"),e=i(e),D(r,(t,o,n)=>t[o]>>>=e(n))));var Ao=r=>r[0]?.[0]===","?r[0].slice(1):r,F=(r,e,t)=>{if(typeof r=="string"){t[r]=e;return}let[o,...n]=r,p=Ao(n);if(o==="{}"){let m=[];for(let u of p){if(Array.isArray(u)&&u[0]==="..."){let C={};for(let O in e)m.includes(O)||(C[O]=e[O]);t[u[1]]=C;break}let d,w,R;typeof u=="string"?d=w=u:u[0]==="="?(typeof u[1]=="string"?d=w=u[1]:[,d,w]=u[1],R=u[2]):[,d,w]=u,m.push(d);let k=e[d];k===void 0&&R&&(k=i(R)(t)),F(w,k,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 d=u,w;Array.isArray(u)&&u[0]==="="&&([,d,w]=u);let R=e[m++];R===void 0&&w&&(R=i(w)(t)),F(d,R,t)}}},Dr=(...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=>F(t,n(p),p)}return i(e)}),e=>{for(let t of r)t(e)});f("let",Dr);f("const",Dr);f("var",Dr);var tr=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=>F(t,e(o),o)}return M(r)||tr("Invalid assignment target"),e=i(e),D(r,(t,o,n)=>t[o]=e(n))});f("||=",(r,e)=>(M(r)||tr("Invalid assignment target"),e=i(e),D(r,(t,o,n)=>t[o]||=e(n))));f("&&=",(r,e)=>(M(r)||tr("Invalid assignment target"),e=i(e),D(r,(t,o,n)=>t[o]&&=e(n))));f("??=",(r,e)=>(M(r)||tr("Invalid assignment target"),e=i(e),D(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),u=>(...d)=>{let w={};t.forEach((k,C)=>w[k]=d[C]),n&&(w[n]=d.slice(o));let R=new Proxy(w,{get:(k,C)=>C in k?k[C]:u?.[C],set:(k,C,O)=>((C in k?k:u)[C]=O,!0),has:(k,C)=>C in k||(u?C in u:!1)});try{let k=e(R);return m?void 0:k}catch(k){if(k===P)return k[0];throw k}}});f("...",r=>(r=i(r),e=>Object.entries(r(e))));f("?.",(r,e)=>(r=i(r),Q(e)?()=>{}:t=>r(t)?.[e]));f("?.[]",(r,e)=>(r=i(r),e=i(e),t=>{let o=e(t);return Q(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]==="."||r[0]==="?."){let n=i(r[1]),p=r[2];return Q(p)?()=>{}:m=>n(m)?.[p]?.(...t(m))}if((r[0]==="[]"||r[0]==="?.[]")&&r.length===3){let n=i(r[1]),p=i(r[2]);return m=>{let u=p(m);return Q(u)?void 0:n(m)?.[u]?.(...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 or=Symbol("accessor");f("get",(r,e)=>(e=e?i(e):()=>{},t=>[[or,r,{get:function(){let o=Object.create(t||{});return o.this=this,e(o)}}]]));f("set",(r,e,t)=>(t=t?i(t):()=>{},o=>[[or,r,{set:function(n){let p=Object.create(o||{});p.this=this,p[e]=n,t(p)}}]]));var yo=r=>r==null||typeof r=="string"||[":",",","...","get","set"].includes(r[0]);f("{}",(r,e)=>{if(e!==void 0)return;if(!yo(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]===or){let[,u,d]=m;p[u]={...p[u],...d,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 d=(...w)=>{let R={};o.forEach((C,O)=>R[C]=w[O]),n&&(R[n]=w.slice(p));let k=new Proxy(R,{get:(C,O)=>O in C?C[O]:u[O],set:(C,O,Pe)=>((O in C?C:u)[O]=Pe,!0),has:(C,O)=>O in C||O in u});try{return t(k)}catch(C){if(C===P)return C[0];throw C}};return r&&(u[r]=d),d}});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 wo=Symbol("static"),Co=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 Co("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),d=Array.isArray(u)&&typeof u[0]?.[0]=="string"?u:[];for(let[w,R]of d)w==="constructor"?p.prototype.__constructor__=R:p.prototype[w]=R}return r&&(o[r]=p),p}));f("static",r=>(r=i(r),e=>[[wo,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 U=Symbol("break"),G=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===U)break;if(n===G)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===U)break;if(n===G)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(u){if(u===U)break;if(u===G)continue;if(u===P)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 Eo(o,n,e);if(t==="of")return go(o,n,e)}});var go=(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?F(r,u,n):n[r]=u;try{p=t(n)}catch(d){if(d===U)break;if(d===G)continue;if(d===P)return d[0];throw d}}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 u in e(n)){o?F(r,u,n):n[r]=u;try{p=t(n)}catch(d){if(d===U)break;if(d===G)continue;if(d===P)return d[0];throw d}}return o||(n[r]=m),p}};f("break",()=>()=>{throw U});f("continue",()=>()=>{throw G});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(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 d;try{d=r?.(u)}catch(w){if(w===U||w===G||w===P)throw w;if(n!=null&&p){let R=n in u,k=u[n];u[n]=w;try{d=p(u)}finally{R?u[n]=k:delete u[n]}}else if(!p)throw w}finally{m?.(u)}return d}});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,d]of e)if(n||u===null||u(t)===o)for(n=!0,m=0;m<d.length;m++)try{p=d[m](t)}catch(w){if(w===U)return p;throw w}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 Le=new WeakMap,So=(r,...e)=>typeof r=="string"?i(s(r)):Le.get(r)||Le.set(r,ko(r,e)).get(r),ve=57344,ko=(r,e)=>{let t=r.reduce((p,m,u)=>p+(u?String.fromCharCode(ve+u-1):"")+m,""),o=s(t),n=p=>{if(typeof p=="string"&&p.length===1){let m=p.charCodeAt(0)-ve,u;if(m>=0&&m<e.length)return u=e[m],To(u)?u:[,u]}return Array.isArray(p)?p.map(n):p};return i(n(o))},To=r=>typeof r=="string"||Array.isArray(r)&&(typeof r[0]=="string"||r[0]===void 0),No=So;export{sr as access,A as binary,i as compile,c as cur,No as default,I as err,a as expr,z as group,Ro as id,l as idx,y as keyword,$ as literal,Be as loc,N as lookup,Gr as member,ir as nary,E as next,f as operator,nr as operators,L as parens,s as parse,W as peek,v as prec,pr as propName,T as seek,h as skip,g as token,_ as unary,S as word};
|
package/justin.min.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
var m,
|
|
2
|
-
`),o=e.pop(),i=
|
|
3
|
-
${i}${
|
|
4
|
-
`,r:"\r",t:" ",b:"\b",f:"\f",v:"\v",0:"\0"},Cr=r=>r>=48&&r<=57?r-48:r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:-1,
|
|
5
|
-
`,"/*":"*/"};d.space=()=>{for(var r,t,e,o,i;r=mt();){for(e in t=d.comment)if(r===e.charCodeAt(0)&&(e.length<2||
|
|
6
|
-
`?i:i+o.length),r=0;break}if(r)return r}return r};var vr=80;
|
|
7
|
-
`,r:"\r",t:" ",b:"\b",f:"\f",v:"\v"},ar=()=>{let r=[],t="",e;for(;(e=u.charCodeAt(m))!==b;)e?e===It?(y(),t+=kt[u[m]]||u[m],y()):e===Et&&u.charCodeAt(m+1)===wt?(r.push([,t]),t="",y(2),r.push(g(0,125))):(t+=u[m],y()):N("Unterminated template");return r.push([,t]),y(),r},Nt=r=>r.length<2&&r[0]?.[0]===void 0?r[0]||[,""]:["`",...r],vt=E[b];E[b]=(r,t)=>r&&t<St?d.asi&&d.newline?void 0:(y(),["``",r,...ar()]):r?vt?.(r,t):(y(),Nt(ar()));d.string["'"]=!0;d.number={"0x":16,"0b":2,"0o":8};var Ur=(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?Ur(r[1],t):(()=>{throw Error("Invalid assignment target")})(),Tr={"=":(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 Tr)p(r,(t,e)=>(e=n(e),Ur(t,(o,i,s)=>Tr[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 rr=(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?rr(r[1],t):(()=>{throw Error("Invalid increment target")})();p("++",(r,t)=>rr(r,t===null?(e,o)=>e[o]++:(e,o)=>++e[o]));p("--",(r,t)=>rr(r,t===null?(e,o)=>e[o]--:(e,o)=>--e[o]));var _r=(...r)=>(r=r.map(n),t=>{let e;for(let o of r)e=o(t);return e});p(",",_r);p(";",_r);var P=r=>r?.[0]==="_"&&r[1]==="_"||r==="constructor"||r==="prototype",G=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&&G("Missing index"),r=n(r),t=n(t),e=>{let o=t(e);return P(o)?void 0:r(e)[o]}));p(".",(r,t)=>(r=n(r),t=t[0]?t:t[1],P(t)?()=>{}:e=>r(e)[t]));p("()",(r,t)=>{if(t===void 0)return r==null?G("Empty ()"):n(r);let e=i=>i?.[0]===","&&i.slice(1).some(s=>s==null||e(s));e(t)&&G("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 tr(r,(i,s,l)=>i[s](...o(l)))});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]==="{}"),tr=(r,t,e,o)=>r==null?G("Empty ()"):r[0]==="()"&&r.length==2?tr(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)),O=tr;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 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),O(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 Ot=r=>{throw Error(r)};p(">>>",(r,t)=>(r=n(r),t=n(t),e=>r(e)>>>t(e)));p(">>>=",(r,t)=>(v(r)||Ot("Invalid assignment target"),t=n(t),O(r,(e,o,i)=>e[o]>>>=t(i))));var Rt=r=>r[0]?.[0]===","?r[0].slice(1):r,B=(r,t,e)=>{if(typeof r=="string"){e[r]=t;return}let[o,...i]=r,s=Rt(i);if(o==="{}"){let l=[];for(let f of s){if(Array.isArray(f)&&f[0]==="..."){let S={};for(let U in t)l.includes(U)||(S[U]=t[U]);e[f[1]]=S;break}let h,A,I;typeof f=="string"?h=A=f:f[0]==="="?(typeof f[1]=="string"?h=A=f[1]:[,h,A]=f[1],I=f[2]):[,h,A]=f,l.push(h);let C=t[h];C===void 0&&I&&(C=n(I)(e)),B(A,C,e)}}else if(o==="[]"){let l=0;for(let f of s){if(f===null){l++;continue}if(Array.isArray(f)&&f[0]==="..."){e[f[1]]=t.slice(l);break}let h=f,A;Array.isArray(f)&&f[0]==="="&&([,h,A]=f);let I=t[l++];I===void 0&&A&&(I=n(A)(e)),B(h,I,e)}}},er=(...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=>B(e,i(s),s)}return n(t)}),t=>{for(let e of r)e(t)});p("let",er);p("const",er);p("var",er);var X=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=>B(e,t(o),o)}return v(r)||X("Invalid assignment target"),t=n(t),O(r,(e,o,i)=>e[o]=t(i))});p("||=",(r,t)=>(v(r)||X("Invalid assignment target"),t=n(t),O(r,(e,o,i)=>e[o]||=t(i))));p("&&=",(r,t)=>(v(r)||X("Invalid assignment target"),t=n(t),O(r,(e,o,i)=>e[o]&&=t(i))));p("??=",(r,t)=>(v(r)||X("Invalid assignment target"),t=n(t),O(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 Pt=[];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 l=t?.[0]==="{}";return t=n(l?["{",t[1]]:t),f=>(...h)=>{let A={};e.forEach((C,S)=>A[C]=h[S]),i&&(A[i]=h.slice(o));let I=new Proxy(A,{get:(C,S)=>S in C?C[S]:f?.[S],set:(C,S,U)=>((S in C?C:f)[S]=U,!0),has:(C,S)=>S in C||(f?S in f:!1)});try{let C=t(I);return l?void 0:C}catch(C){if(C===Pt)return C[0];throw C}}});p("...",r=>(r=n(r),t=>Object.entries(r(t))));p("?.",(r,t)=>(r=n(r),P(t)?()=>{}:e=>r(e)?.[t]));p("?.[]",(r,t)=>(r=n(r),t=n(t),e=>{let o=t(e);return P(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]==="."||r[0]==="?."){let i=n(r[1]),s=r[2];return P(s)?()=>{}:l=>i(l)?.[s]?.(...e(l))}if((r[0]==="[]"||r[0]==="?.[]")&&r.length===3){let i=n(r[1]),s=n(r[2]);return l=>{let f=s(l);return P(f)?void 0:i(l)?.[f]?.(...e(l))}}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(l=>l(s)))(e.slice(1).map(n)):(i=>s=>[i(s)])(n(e)):()=>[];return i=>new(t(i))(...o(i))});var $=Symbol("accessor");p("get",(r,t)=>(t=t?n(t):()=>{},e=>[[$,r,{get:function(){let o=Object.create(e||{});return o.this=this,t(o)}}]]));p("set",(r,t,e)=>(e=e?n(e):()=>{},o=>[[$,r,{set:function(i){let s=Object.create(o||{});s.this=this,s[t]=i,e(s)}}]]));var at=r=>r==null||typeof r=="string"||[":",",","...","get","set"].includes(r[0]);p("{}",(r,t)=>{if(t!==void 0)return;if(!at(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 l of e.flatMap(f=>f(o)))if(l[0]===$){let[,f,h]=l;s[f]={...s[f],...h,configurable:!0,enumerable:!0}}else i[l[0]]=l[1];for(let l in s)Object.defineProperty(i,l,s[l]);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(l=>l(s)))});var Br=new WeakMap,Tt=(r,...t)=>typeof r=="string"?n(d(r)):Br.get(r)||Br.set(r,Ut(r,t)).get(r),Mr=57344,Ut=(r,t)=>{let e=r.reduce((s,l,f)=>s+(f?String.fromCharCode(Mr+f-1):"")+l,""),o=d(e),i=s=>{if(typeof s=="string"&&s.length===1){let l=s.charCodeAt(0)-Mr,f;if(l>=0&&l<t.length)return f=t[l],_t(f)?f:[,f]}return Array.isArray(s)?s.map(i):s};return n(i(o))},_t=r=>typeof r=="string"||Array.isArray(r)&&(typeof r[0]=="string"||r[0]===void 0),Bt=Tt;export{j as access,c as binary,n as compile,u as cur,Bt as default,N as err,g as expr,_ as group,Mt as id,m as idx,M as keyword,a as literal,Dr as loc,E as lookup,pr as member,W as nary,L as next,p as operator,H as operators,Dt as parens,d as parse,K as peek,Q as prec,z as propName,nr as seek,y as skip,w as token,k as unary,ir as word};
|
|
1
|
+
var m,c,d=r=>(m=0,c=r,d.enter?.(),r=A(),c[m]?I():r||""),I=(r="Unexpected token",t=m,e=c.slice(0,t).split(`
|
|
2
|
+
`),o=e.pop(),i=c.slice(Math.max(0,t-40),t),s="\u032D",f=(c[t]||" ")+s,l=c.slice(t+1,t+20))=>{throw SyntaxError(`${r} at ${e.length+1}:${o.length+1}
|
|
3
|
+
${i}${f}${l}`)},Dr=(r,t=m)=>(Array.isArray(r)&&(r.loc=t),r),L=(r,t=m,e)=>{for(;e=r(c.charCodeAt(m));)m+=e;return c.slice(t,m)},y=(r=1)=>c[m+=r],ir=r=>m=r,A=(r=0,t)=>{let e,o,i;for(t&&d.enter?.(r,t);(e=d.space())&&e!==t&&(i=d.step(o,r,e,A));)o=i;return t&&(e==t?(m++,d.exit?.(r,t)):I("Unclosed "+String.fromCharCode(t-(t>42?2:1)))),o},K=(r=m)=>{for(;c.charCodeAt(r)<=32;)r++;return c.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)=>c.substr(m,t)===r&&!d.id(c.charCodeAt(m+t)),Mt=()=>(y(),A(0,41)),E=[],Q={},w=(r,t=32,e,o=r.charCodeAt(0))=>mr({op:r,l:r.length,p:Q[r]=!E[o]&&Q[r]||t,map:e,word:r.toUpperCase()!==r,kw:!1}),u=(r,t,e=!1)=>w(r,t,(o,i)=>o&&(i=A(t-(e?.5:0)))&&[r,o,i]),k=(r,t,e)=>w(r,t,o=>e?o&&[r,o]:!o&&(o=A(t-.5))&&[r,o]),a=(r,t)=>w(r,200,e=>!e&&[,t]),W=(r,t,e,o)=>w(r,t,(i,s,f=i)=>(s=A(t-(e?.5:0)),i?.[0]!==r&&(i=[r,i||null]),s?.[0]===r?i.push(...s.slice(1)):s?i.push(s):o||K()===r.charCodeAt(0)?i.push(null):f&&i.length===2&&(i=i[1]),i)),_=(r,t)=>w(r[0],t,e=>!e&&[r,A(0,r.charCodeAt(1))||null]),j=(r,t)=>w(r[0],t,e=>e&&[r,e,A(0,r.charCodeAt(1))||null]),z=(r,t)=>(d.space(),t=c.charCodeAt(m),d.id(t)&&(t<48||t>57)?L(d.id):A(r)),sr=(r,t)=>w(r,t,(e,o)=>e&&(o=z(t))&&[r,e,o]),M=(r,t,e)=>(Q[r]??=t,mr({op:r,l:r.length,p:t,map:e,word:!0,kw:!0})),nr=(r,t,e=(o,i,s,f=m,l,h,C)=>{for(C=0;h=r[C++];)if(!(h.kw&&o)&&!(s?h.op!==s:!((h.l<2||h.op.charCodeAt(1)===c.charCodeAt(m+1)&&(h.l<3||c.substr(m,h.l)===h.op))&&(!h.word||!d.id(c.charCodeAt(m+h.l)))&&(s=h.op)))&&!(i>=h.p)&&!(h.kw&&d.prop&&!d.prop(m+h.l))){if(m+=h.l,l=h.map(o))return Dr(l,f);m=f,s=0,h.word||o||t||r[C]||I()}return t?.(o,i,s)})=>(e.ops=r,e.tail=t,e),mr=(r,t=r.op.charCodeAt(0),e=E[t])=>E[t]=e?.ops?nr([r,...e.ops],e.tail):nr([r],e);d.space=r=>{for(;(r=c.charCodeAt(m))<=32;)m++;return r};d.step=(r,t,e,o,i)=>(i=E[e])&&i(r,t)||(r?null:L(d.id)||null);var H={},p=(r,t,e=H[r])=>H[r]=(...o)=>t(...o)||e?.(...o),n=r=>Array.isArray(r)?r[0]==null?(t=>()=>t)(r[1]):H[r[0]]?.(...r.slice(1))??I(`Unknown operator: ${r[0]}`,r?.loc):r===void 0?()=>{}:t=>t?.[r];var J=46,R=48,T=57,fr=69,lr=101,Fr=43,Gr=45,ur=95,Xr=97,$r=102,Qr=65,Hr=70,cr=r=>r.indexOf("_")<0?r:r.replaceAll("_",""),Kr=r=>r===J&&(r=c.charCodeAt(m+1))!==J&&!(d.id(r)&&r>T&&r!==lr&&r!==fr)||r>=R&&r<=T||r===ur||((r===fr||r===lr)&&((r=c.charCodeAt(m+1))>=R&&r<=T||r===Fr||r===Gr)?2:0),V=r=>(r=+cr(L(Kr)))!=r?I():[,r],Wr=r=>t=>t===ur||t>=R&&t<=T&&t-R<r||r===16&&(t>=Xr&&t<=$r||t>=Qr&&t<=Hr);d.number=null;E[J]=r=>!r&&c.charCodeAt(m+1)>=R&&c.charCodeAt(m+1)<=T&&V();for(let r=R;r<=T;r++)E[r]=t=>t?void 0:V();E[R]=(r,t)=>{if(!r){for(let e in d.number)if(e[0]==="0"&&(c.charCodeAt(m+1)|32)===e.charCodeAt(1)){y(2);let o=cr(L(Wr(t=d.number[e])));return[,parseInt(o,t)]}return V()}};var jr=92,dr=34,hr=39,Ar=117,gr=120,zr=123,Jr=125,yr=10,Vr=13,Yr={n:`
|
|
4
|
+
`,r:"\r",t:" ",b:"\b",f:"\f",v:"\v",0:"\0"},Cr=r=>r>=48&&r<=57?r-48:r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:-1,Y=()=>{let r=c.charCodeAt(m+1);if(r===yr)return["",2];if(r===Vr)return["",c.charCodeAt(m+2)===yr?3:2];if(r===gr||r===Ar&&c.charCodeAt(m+2)!==zr){let t=r===gr?2:4,e=0,o;for(let i=0;i<t;i++){if((o=Cr(c.charCodeAt(m+2+i)))<0)return[c[m+1],2];e=e*16+o}return[String.fromCharCode(e),2+t]}if(r===Ar){let t=0,e=m+3,o;for(;(o=Cr(c.charCodeAt(e)))>=0;)t=t*16+o,e++;return e>m+3&&t<=1114111&&c.charCodeAt(e)===Jr?[String.fromCodePoint(t),e-m+1]:[c[m+1],2]}return[Yr[c[m+1]]||c[m+1],2]},Sr=r=>(t,e,o="",i=String.fromCharCode(r))=>{if(t||!d.string?.[i])return;y();let s=()=>{let[f,l]=Y();return o+=f,l};return L(f=>f-r&&(f!==jr?(o+=c[m],1):s())),c[m]===i?y():I("Bad string"),[,o]};E[dr]=Sr(dr);E[hr]=Sr(hr);d.string={'"':!0};var Zr=20;"= += -= *= /= %= |= &= ^= >>= <<=".split(" ").map(r=>u(r,Zr,!0));var qr=30,xr=40,br=140;k("!",br);u("||",qr);u("&&",xr);var rt=50,tt=60,et=70,Er=100,ot=140;u("|",rt);u("&",et);u("^",tt);u(">>",Er);u("<<",Er);k("~",ot);var D=90;u("<",D);u(">",D);u("<=",D);u(">=",D);var wr=80;u("==",wr);u("!=",wr);var kr=110,Z=120,Ir=140;u("+",kr);u("-",kr);u("*",Z);u("/",Z);u("%",Z);k("+",Ir);k("-",Ir);var F=150;w("++",F,r=>r?["++",r,null]:["++",A(F-1)]);w("--",F,r=>r?["--",r,null]:["--",A(F-1)]);var nt=5,it=10;W(",",it);W(";",nt,!0,!0);var pt=170;_("()",pt);var Nr=170,st=160;j("[]",Nr);sr(".",Nr);j("()",st);var mt=d.space;d.comment??={"//":`
|
|
5
|
+
`,"/*":"*/"};d.space=()=>{for(var r,t,e,o,i;r=mt();){for(e in t=d.comment)if(r===e.charCodeAt(0)&&(e.length<2||c.charCodeAt(m+1)===e.charCodeAt(1))&&(e.length<3||c.substr(m,e.length)===e)){o=t[e],i=c.indexOf(o,m+e.length),ir(i<0?c.length:o===`
|
|
6
|
+
`?i:i+o.length),r=0;break}if(r)return r}return r};var vr=80;u("===",vr);u("!==",vr);var ft=30;u("??",ft);var lt=130,ut=20;u("**",lt,!0);u("**=",ut,!0);var Lr=90;u("in",Lr);u("of",Lr);var ct=20,dt=100;u(">>>",dt);u(">>>=",ct,!0);var q=20;u("||=",q,!0);u("&&=",q,!0);u("??=",q,!0);a("true",!0);a("false",!1);a("null",null);M("undefined",200,()=>[]);a("NaN",NaN);a("Infinity",1/0);var x=20;w("?",x,(r,t,e)=>r&&(t=A(x-1))&&L(o=>o===58)&&(e=A(x-1),["?",r,t,e]));var ht=20;u("=>",ht,!0);var At=20;k("...",At);var Or=170;w("?.",Or,(r,t)=>{if(!r)return;let e=d.space();return e===40?(y(),["?.()",r,A(0,41)||null]):e===91?(y(),["?.[]",r,A(0,93)]):(t=z(Or),t?["?.",r,t]:void 0)});var b=140,Rr=160,gt=Rr+1;k("typeof",b);k("void",b);k("delete",b);var yt=r=>d.space()===40?(y(),["()",r,A(0,41)||null]):r;M("new",gt,()=>pr(".target")?(y(7),["new.target"]):["new",yt(A(Rr))]);var Ct=20,Pr=200;d.prop=r=>K(r)!==58;_("[]",Pr);_("{}",Pr);u(":",Ct-1,!0);var St=170,rr=96,Et=36,wt=123,kt=92,ar=()=>{let r=[],t="",e,o;for(;(e=c.charCodeAt(m))!==rr;)e?e===kt?(o=Y(),t+=o[0],y(o[1])):e===Et&&c.charCodeAt(m+1)===wt?(r.push([,t]),t="",y(2),r.push(A(0,125))):(t+=c[m],y()):I("Unterminated template");return r.push([,t]),y(),r},It=r=>r.length<2&&r[0]?.[0]===void 0?r[0]||[,""]:["`",...r],Nt=E[rr];E[rr]=(r,t)=>r&&t<St?d.asi&&d.newline?void 0:(y(),["``",r,...ar()]):r?Nt?.(r,t):(y(),It(ar()));d.string["'"]=!0;d.number={"0x":16,"0b":2,"0o":8};var Ur=(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?Ur(r[1],t):(()=>{throw Error("Invalid assignment target")})(),Tr={"=":(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 Tr)p(r,(t,e)=>(e=n(e),Ur(t,(o,i,s)=>Tr[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 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")})();p("++",(r,t)=>tr(r,t===null?(e,o)=>e[o]++:(e,o)=>++e[o]));p("--",(r,t)=>tr(r,t===null?(e,o)=>e[o]--:(e,o)=>--e[o]));var _r=(...r)=>(r=r.map(n),t=>{let e;for(let o of r)e=o(t);return e});p(",",_r);p(";",_r);var P=r=>r?.[0]==="_"&&r[1]==="_"||r==="constructor"||r==="prototype",G=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&&G("Missing index"),r=n(r),t=n(t),e=>{let o=t(e);return P(o)?void 0:r(e)[o]}));p(".",(r,t)=>(r=n(r),t=t[0]?t:t[1],P(t)?()=>{}:e=>r(e)[t]));p("()",(r,t)=>{if(t===void 0)return r==null?G("Empty ()"):n(r);let e=i=>i?.[0]===","&&i.slice(1).some(s=>s==null||e(s));e(t)&&G("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 er(r,(i,s,f)=>i[s](...o(f)))});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?G("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 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)),O=er;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)=>(N(r)||vt("Invalid assignment target"),t=n(t),O(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)=>(N(r)||Lt("Invalid assignment target"),t=n(t),O(r,(e,o,i)=>e[o]>>>=t(i))));var Ot=r=>r[0]?.[0]===","?r[0].slice(1):r,B=(r,t,e)=>{if(typeof r=="string"){e[r]=t;return}let[o,...i]=r,s=Ot(i);if(o==="{}"){let f=[];for(let l of s){if(Array.isArray(l)&&l[0]==="..."){let S={};for(let U in t)f.includes(U)||(S[U]=t[U]);e[l[1]]=S;break}let h,C,v;typeof l=="string"?h=C=l:l[0]==="="?(typeof l[1]=="string"?h=C=l[1]:[,h,C]=l[1],v=l[2]):[,h,C]=l,f.push(h);let g=t[h];g===void 0&&v&&(g=n(v)(e)),B(C,g,e)}}else if(o==="[]"){let f=0;for(let l of s){if(l===null){f++;continue}if(Array.isArray(l)&&l[0]==="..."){e[l[1]]=t.slice(f);break}let h=l,C;Array.isArray(l)&&l[0]==="="&&([,h,C]=l);let v=t[f++];v===void 0&&C&&(v=n(C)(e)),B(h,v,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"?s=>{s[e]=i(s)}:s=>B(e,i(s),s)}return n(t)}),t=>{for(let e of r)e(t)});p("let",or);p("const",or);p("var",or);var X=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=>B(e,t(o),o)}return N(r)||X("Invalid assignment target"),t=n(t),O(r,(e,o,i)=>e[o]=t(i))});p("||=",(r,t)=>(N(r)||X("Invalid assignment target"),t=n(t),O(r,(e,o,i)=>e[o]||=t(i))));p("&&=",(r,t)=>(N(r)||X("Invalid assignment target"),t=n(t),O(r,(e,o,i)=>e[o]&&=t(i))));p("??=",(r,t)=>(N(r)||X("Invalid assignment target"),t=n(t),O(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 f=t?.[0]==="{}";return t=n(f?["{",t[1]]:t),l=>(...h)=>{let C={};e.forEach((g,S)=>C[g]=h[S]),i&&(C[i]=h.slice(o));let v=new Proxy(C,{get:(g,S)=>S in g?g[S]:l?.[S],set:(g,S,U)=>((S in g?g:l)[S]=U,!0),has:(g,S)=>S in g||(l?S in l:!1)});try{let g=t(v);return f?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),P(t)?()=>{}:e=>r(e)?.[t]));p("?.[]",(r,t)=>(r=n(r),t=n(t),e=>{let o=t(e);return P(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]==="."||r[0]==="?."){let i=n(r[1]),s=r[2];return P(s)?()=>{}:f=>i(f)?.[s]?.(...e(f))}if((r[0]==="[]"||r[0]==="?.[]")&&r.length===3){let i=n(r[1]),s=n(r[2]);return f=>{let l=s(f);return P(l)?void 0:i(f)?.[l]?.(...e(f))}}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(f=>f(s)))(e.slice(1).map(n)):(i=>s=>[i(s)])(n(e)):()=>[];return i=>new(t(i))(...o(i))});var $=Symbol("accessor");p("get",(r,t)=>(t=t?n(t):()=>{},e=>[[$,r,{get:function(){let o=Object.create(e||{});return o.this=this,t(o)}}]]));p("set",(r,t,e)=>(e=e?n(e):()=>{},o=>[[$,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 f of e.flatMap(l=>l(o)))if(f[0]===$){let[,l,h]=f;s[l]={...s[l],...h,configurable:!0,enumerable:!0}}else i[f[0]]=f[1];for(let f in s)Object.defineProperty(i,f,s[f]);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(f=>f(s)))});var Br=new WeakMap,at=(r,...t)=>typeof r=="string"?n(d(r)):Br.get(r)||Br.set(r,Tt(r,t)).get(r),Mr=57344,Tt=(r,t)=>{let e=r.reduce((s,f,l)=>s+(l?String.fromCharCode(Mr+l-1):"")+f,""),o=d(e),i=s=>{if(typeof s=="string"&&s.length===1){let f=s.charCodeAt(0)-Mr,l;if(f>=0&&f<t.length)return l=t[f],Ut(l)?l:[,l]}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=at;export{j as access,u as binary,n as compile,c as cur,_t as default,I as err,A as expr,_ as group,Bt as id,m as idx,M as keyword,a as literal,Dr as loc,E as lookup,sr as member,W as nary,L as next,p as operator,H as operators,Mt as parens,d as parse,K as peek,Q as prec,z as propName,ir as seek,y as skip,w as token,k as unary,pr as word};
|
package/package.json
CHANGED
package/subscript.min.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var p,
|
|
2
|
-
`),o=e.pop(),n=
|
|
3
|
-
${n}${c}${A}`)},
|
|
4
|
-
`,r:"\r",t:" ",b:"\b",f:"\f",v:"\v",0:"\0"},
|
|
1
|
+
var p,l,u=r=>(p=0,l=r,u.enter?.(),r=C(),l[p]?y():r||""),y=(r="Unexpected token",t=p,e=l.slice(0,t).split(`
|
|
2
|
+
`),o=e.pop(),n=l.slice(Math.max(0,t-40),t),s="\u032D",c=(l[t]||" ")+s,A=l.slice(t+1,t+20))=>{throw SyntaxError(`${r} at ${e.length+1}:${o.length+1}
|
|
3
|
+
${n}${c}${A}`)},mr=(r,t=p)=>(Array.isArray(r)&&(r.loc=t),r),E=(r,t=p,e)=>{for(;e=r(l.charCodeAt(p));)p+=e;return l.slice(t,p)},k=(r=1)=>l[p+=r],Gr=r=>p=r,C=(r=0,t)=>{let e,o,n;for(t&&u.enter?.(r,t);(e=u.space())&&e!==t&&(n=u.step(o,r,e,C));)o=n;return t&&(e==t?(p++,u.exit?.(r,t)):y("Unclosed "+String.fromCharCode(t-(t>42?2:1)))),o},ur=(r=p)=>{for(;l.charCodeAt(r)<=32;)r++;return l.charCodeAt(r)},Wr=u.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)=>l.substr(p,t)===r&&!u.id(l.charCodeAt(p+t)),Jr=()=>(k(),C(0,41)),d=[],T={},g=(r,t=32,e,o=r.charCodeAt(0))=>v({op:r,l:r.length,p:T[r]=!d[o]&&T[r]||t,map:e,word:r.toUpperCase()!==r,kw:!1}),f=(r,t,e=!1)=>g(r,t,(o,n)=>o&&(n=C(t-(e?.5:0)))&&[r,o,n]),S=(r,t,e)=>g(r,t,o=>e?o&&[r,o]:!o&&(o=C(t-.5))&&[r,o]),Kr=(r,t)=>g(r,200,e=>!e&&[,t]),D=(r,t,e,o)=>g(r,t,(n,s,c=n)=>(s=C(t-(e?.5:0)),n?.[0]!==r&&(n=[r,n||null]),s?.[0]===r?n.push(...s.slice(1)):s?n.push(s):o||ur()===r.charCodeAt(0)?n.push(null):c&&n.length===2&&(n=n[1]),n)),B=(r,t)=>g(r[0],t,e=>!e&&[r,C(0,r.charCodeAt(1))||null]),M=(r,t)=>g(r[0],t,e=>e&&[r,e,C(0,r.charCodeAt(1))||null]),fr=(r,t)=>(u.space(),t=l.charCodeAt(p),u.id(t)&&(t<48||t>57)?E(u.id):C(r)),Q=(r,t)=>g(r,t,(e,o)=>e&&(o=fr(t))&&[r,e,o]),Vr=(r,t,e)=>(T[r]??=t,v({op:r,l:r.length,p:t,map:e,word:!0,kw:!0})),X=(r,t,e=(o,n,s,c=p,A,h,I)=>{for(I=0;h=r[I++];)if(!(h.kw&&o)&&!(s?h.op!==s:!((h.l<2||h.op.charCodeAt(1)===l.charCodeAt(p+1)&&(h.l<3||l.substr(p,h.l)===h.op))&&(!h.word||!u.id(l.charCodeAt(p+h.l)))&&(s=h.op)))&&!(n>=h.p)&&!(h.kw&&u.prop&&!u.prop(p+h.l))){if(p+=h.l,A=h.map(o))return mr(A,c);p=c,s=0,h.word||o||t||r[I]||y()}return t?.(o,n,s)})=>(e.ops=r,e.tail=t,e),v=(r,t=r.op.charCodeAt(0),e=d[t])=>d[t]=e?.ops?X([r,...e.ops],e.tail):X([r],e);u.space=r=>{for(;(r=l.charCodeAt(p))<=32;)p++;return r};u.step=(r,t,e,o,n)=>(n=d[e])&&n(r,t)||(r?null:E(u.id)||null);var L={},m=(r,t,e=L[r])=>L[r]=(...o)=>t(...o)||e?.(...o),i=r=>Array.isArray(r)?r[0]==null?(t=>()=>t)(r[1]):L[r[0]]?.(...r.slice(1))??y(`Unknown operator: ${r[0]}`,r?.loc):r===void 0?()=>{}:t=>t?.[r];var N=46,w=48,R=57,H=69,G=101,cr=43,hr=45,W=95,Ar=97,Cr=102,dr=65,gr=70,z=r=>r.indexOf("_")<0?r:r.replaceAll("_",""),yr=r=>r===N&&(r=l.charCodeAt(p+1))!==N&&!(u.id(r)&&r>R&&r!==G&&r!==H)||r>=w&&r<=R||r===W||((r===H||r===G)&&((r=l.charCodeAt(p+1))>=w&&r<=R||r===cr||r===hr)?2:0),F=r=>(r=+z(E(yr)))!=r?y():[,r],Er=r=>t=>t===W||t>=w&&t<=R&&t-w<r||r===16&&(t>=Ar&&t<=Cr||t>=dr&&t<=gr);u.number=null;d[N]=r=>!r&&l.charCodeAt(p+1)>=w&&l.charCodeAt(p+1)<=R&&F();for(let r=w;r<=R;r++)d[r]=t=>t?void 0:F();d[w]=(r,t)=>{if(!r){for(let e in u.number)if(e[0]==="0"&&(l.charCodeAt(p+1)|32)===e.charCodeAt(1)){k(2);let o=z(E(Er(t=u.number[e])));return[,parseInt(o,t)]}return F()}};var Sr=92,J=34,K=39,V=117,Y=120,wr=123,kr=125,Z=10,Rr=13,_r={n:`
|
|
4
|
+
`,r:"\r",t:" ",b:"\b",f:"\f",v:"\v",0:"\0"},q=r=>r>=48&&r<=57?r-48:r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:-1,Pr=()=>{let r=l.charCodeAt(p+1);if(r===Z)return["",2];if(r===Rr)return["",l.charCodeAt(p+2)===Z?3:2];if(r===Y||r===V&&l.charCodeAt(p+2)!==wr){let t=r===Y?2:4,e=0,o;for(let n=0;n<t;n++){if((o=q(l.charCodeAt(p+2+n)))<0)return[l[p+1],2];e=e*16+o}return[String.fromCharCode(e),2+t]}if(r===V){let t=0,e=p+3,o;for(;(o=q(l.charCodeAt(e)))>=0;)t=t*16+o,e++;return e>p+3&&t<=1114111&&l.charCodeAt(e)===kr?[String.fromCodePoint(t),e-p+1]:[l[p+1],2]}return[_r[l[p+1]]||l[p+1],2]},x=r=>(t,e,o="",n=String.fromCharCode(r))=>{if(t||!u.string?.[n])return;k();let s=()=>{let[c,A]=Pr();return o+=c,A};return E(c=>c-r&&(c!==Sr?(o+=l[p],1):s())),l[p]===n?k():y("Bad string"),[,o]};d[J]=x(J);d[K]=x(K);u.string={'"':!0};var Ur=20;"= += -= *= /= %= |= &= ^= >>= <<=".split(" ").map(r=>f(r,Ur,!0));var Ir=30,Tr=40,Lr=140;S("!",Lr);f("||",Ir);f("&&",Tr);var Dr=50,Mr=60,Nr=70,j=100,Fr=140;f("|",Dr);f("&",Nr);f("^",Mr);f(">>",j);f("<<",j);S("~",Fr);var _=90;f("<",_);f(">",_);f("<=",_);f(">=",_);var a=80;f("==",a);f("!=",a);var b=110,$=120,rr=140;f("+",b);f("-",b);f("*",$);f("/",$);f("%",$);S("+",rr);S("-",rr);var P=150;g("++",P,r=>r?["++",r,null]:["++",C(P-1)]);g("--",P,r=>r?["--",r,null]:["--",C(P-1)]);var $r=5,Or=10;D(",",Or);D(";",$r,!0,!0);var Xr=170;B("()",Xr);var tr=170,Br=160;M("[]",tr);Q(".",tr);M("()",Br);var or=(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?or(r[1],t):(()=>{throw Error("Invalid assignment target")})(),er={"=":(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 er)m(r,(t,e)=>(e=i(e),or(t,(o,n,s)=>er[r](o,n,e(s)))));m("!",r=>(r=i(r),t=>!r(t)));m("||",(r,t)=>(r=i(r),t=i(t),e=>r(e)||t(e)));m("&&",(r,t)=>(r=i(r),t=i(t),e=>r(e)&&t(e)));m("~",r=>(r=i(r),t=>~r(t)));m("|",(r,t)=>(r=i(r),t=i(t),e=>r(e)|t(e)));m("&",(r,t)=>(r=i(r),t=i(t),e=>r(e)&t(e)));m("^",(r,t)=>(r=i(r),t=i(t),e=>r(e)^t(e)));m(">>",(r,t)=>(r=i(r),t=i(t),e=>r(e)>>t(e)));m("<<",(r,t)=>(r=i(r),t=i(t),e=>r(e)<<t(e)));m(">",(r,t)=>(r=i(r),t=i(t),e=>r(e)>t(e)));m("<",(r,t)=>(r=i(r),t=i(t),e=>r(e)<t(e)));m(">=",(r,t)=>(r=i(r),t=i(t),e=>r(e)>=t(e)));m("<=",(r,t)=>(r=i(r),t=i(t),e=>r(e)<=t(e)));m("==",(r,t)=>(r=i(r),t=i(t),e=>r(e)==t(e)));m("!=",(r,t)=>(r=i(r),t=i(t),e=>r(e)!=t(e)));m("+",(r,t)=>t!==void 0?(r=i(r),t=i(t),e=>r(e)+t(e)):(r=i(r),e=>+r(e)));m("-",(r,t)=>t!==void 0?(r=i(r),t=i(t),e=>r(e)-t(e)):(r=i(r),e=>-r(e)));m("*",(r,t)=>(r=i(r),t=i(t),e=>r(e)*t(e)));m("/",(r,t)=>(r=i(r),t=i(t),e=>r(e)/t(e)));m("%",(r,t)=>(r=i(r),t=i(t),e=>r(e)%t(e)));var O=(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?O(r[1],t):(()=>{throw Error("Invalid increment target")})();m("++",(r,t)=>O(r,t===null?(e,o)=>e[o]++:(e,o)=>++e[o]));m("--",(r,t)=>O(r,t===null?(e,o)=>e[o]--:(e,o)=>--e[o]));var nr=(...r)=>(r=r.map(i),t=>{let e;for(let o of r)e=o(t);return e});m(",",nr);m(";",nr);var ir=r=>r?.[0]==="_"&&r[1]==="_"||r==="constructor"||r==="prototype",U=r=>{throw Error(r)};m("[]",(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&&U("Missing index"),r=i(r),t=i(t),e=>{let o=t(e);return ir(o)?void 0:r(e)[o]}));m(".",(r,t)=>(r=i(r),t=t[0]?t:t[1],ir(t)?()=>{}:e=>r(e)[t]));m("()",(r,t)=>{if(t===void 0)return r==null?U("Empty ()"):i(r);let e=n=>n?.[0]===","&&n.slice(1).some(s=>s==null||e(s));e(t)&&U("Empty argument");let o=t?t[0]===","?(t=t.slice(1).map(i),n=>t.map(s=>s(n))):(t=i(t),n=>[t(n)]):()=>[];return pr(r,(n,s,c)=>n[s](...o(c)))});var pr=(r,t,e,o)=>r==null?U("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 s=e(n);return s==null?void 0:t(s,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 s=e(n);return s==null?void 0:t(s,o(n),n)}):(r=i(r),n=>t([r(n)],0,n));var sr=new WeakMap,Qr=(r,...t)=>typeof r=="string"?i(u(r)):sr.get(r)||sr.set(r,vr(r,t)).get(r),lr=57344,vr=(r,t)=>{let e=r.reduce((s,c,A)=>s+(A?String.fromCharCode(lr+A-1):"")+c,""),o=u(e),n=s=>{if(typeof s=="string"&&s.length===1){let c=s.charCodeAt(0)-lr,A;if(c>=0&&c<t.length)return A=t[c],Hr(A)?A:[,A]}return Array.isArray(s)?s.map(n):s};return i(n(o))},Hr=r=>typeof r=="string"||Array.isArray(r)&&(typeof r[0]=="string"||r[0]===void 0),zt=Qr;export{M as access,f as binary,i as compile,l as cur,zt as default,y as err,C as expr,B as group,Wr as id,p as idx,Vr as keyword,Kr as literal,mr as loc,d as lookup,Q as member,D as nary,E as next,m as operator,L as operators,Jr as parens,u as parse,ur as peek,T as prec,fr as propName,Gr as seek,k as skip,g as token,S as unary,zr as word};
|