subscript 10.3.3 → 10.3.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -165,6 +165,7 @@ console.log(await bundle('main.js', {
165
165
  ## Used by
166
166
 
167
167
  * [jz](https://github.com/dy/jz) — JS subset → WASM compiler
168
+ * [sprae](https://github.com/dy/jz) — DOM framework
168
169
  <!-- * [prepr](https://github.com/dy/prepr) -->
169
170
  <!-- * [glsl-transpiler](https://github.com/stackgl/glsl-transpiler) -->
170
171
  <!-- * [piezo](https://github.com/dy/piezo) -->
package/feature/asi.js CHANGED
@@ -4,7 +4,15 @@ import { parse, prec } from '../parse.js';
4
4
  // Set prec.asi before importing to customize (default: prec[';'])
5
5
  const lvl = prec.asi ?? prec[';'];
6
6
 
7
- parse.asi = (a, p, expr, b, items) => p < lvl && (b = expr(lvl - .5)) && (
8
- items = b?.[0] === ';' ? b.slice(1) : [b],
9
- a?.[0] === ';' ? (a.push(...items), a) : [';', a, ...items]
10
- );
7
+ let asiDepth = 0;
8
+ const MAX_ASI_DEPTH = 100;
9
+
10
+ parse.asi = (a, p, expr, b, items) => {
11
+ if (p >= lvl || asiDepth >= MAX_ASI_DEPTH) return;
12
+ asiDepth++;
13
+ try { b = expr(lvl - .5); }
14
+ finally { asiDepth--; }
15
+ if (!b) return;
16
+ items = b?.[0] === ';' ? b.slice(1) : [b];
17
+ return a?.[0] === ';' ? (a.push(...items), a) : [';', a, ...items];
18
+ };
package/feature/var.js CHANGED
@@ -8,7 +8,7 @@
8
8
  * for (let x in o) → ['for', ['in', ['let', 'x'], 'o'], body]
9
9
  * var x → ['var', 'x'] (acts as assignment target)
10
10
  */
11
- import { expr, space, keyword, operator, compile } from '../parse.js';
11
+ import { expr, space, keyword, operator, compile, seek, word, idx } from '../parse.js';
12
12
 
13
13
  const STATEMENT = 5, SEQ = 10, ASSIGN = 20;
14
14
 
@@ -61,6 +61,13 @@ export const destructure = (pattern, value, ctx) => {
61
61
  // For for-in/of, return ['in/of', ['let', x], iterable] not ['let', ['in', x, it]]
62
62
  // For comma, return ['let', decl1, decl2, ...] not ['let', [',', ...]]
63
63
  const decl = keyword => {
64
+ // let as identifier in for-in: for (let in obj)
65
+ if (keyword === 'let') {
66
+ const from = idx;
67
+ space();
68
+ if (word('in')) { seek(from); return; }
69
+ seek(from);
70
+ }
64
71
  let node = expr(SEQ - 1);
65
72
  // for (let x in obj) - restructure so for-loop sees in/of at top
66
73
  if (node?.[0] === 'in' || node?.[0] === 'of')
package/jessie.min.js CHANGED
@@ -1,8 +1,8 @@
1
- var pr,u,d,c=r=>(u=0,d=r,c.newline=!1,r=a(),d[u]?R():r||""),R=(r="Unexpected token",e=u,t=d.slice(0,e).split(`
2
- `),n=t.pop(),o=d.slice(Math.max(0,e-40),e),p="\u032D",l=(d[e]||" ")+p,f=d.slice(e+1,e+20))=>{throw SyntaxError(`${r} at ${t.length+1}:${n.length+1}
3
- ${d[e-41]!==`
4
- `,""+o}${l}${f}`)},Rr=(r,e=u)=>(Array.isArray(r)&&(r.loc=e),r),T=(r,e=u,t)=>{for(;t=r(d.charCodeAt(u));)u+=t;return d.slice(e,u)},h=(r=1)=>d[u+=r],M=r=>u=r,a=(r=0,e)=>{let t,n,o,p,l;for(e&&c.asi&&(c.newline=!1);(t=c.space())&&(l=c.newline,1)&&t!==e&&(o=(n&&t===91&&pr&&c.asi?.(n,r,a)||null)??((p=I[t])&&p(n,r))??(n&&l&&c.asi?.(n,r,a))??(!n&&T(c.id)));)n=o;return e&&(t==e?(u++,e===125&&c.asi&&(c.newline=!0)):R("Unclosed "+String.fromCharCode(e-(e>42?2:1)))),n},m=(r,e=u)=>{for(pr=!1;(r=d.charCodeAt(u))<=32;)c.asi&&r===10&&(c.newline=pr=!0),u++;return r},Or=(r=u)=>{for(;d.charCodeAt(r)<=32;)r++;return d.charCodeAt(r)},Ct=c.id=r=>r>=48&&r<=57||r>=65&&r<=90||r>=97&&r<=122||r==36||r==95||r>=192&&r!=215&&r!=247,N=(r,e=r.length)=>d.substr(u,e)===r&&!c.id(d.charCodeAt(u+e)),P=()=>(h(),a(0,41)),I=[],H={},k=(r,e=32,t,n=r.charCodeAt(0),o=r.length,p=I[n],l=r.toUpperCase()!==r,f,y)=>(e=H[r]=!p&&H[r]||e,I[n]=(g,S,C,E=u)=>(f=C,(C?r==C:(o<2||r.charCodeAt(1)===d.charCodeAt(u+1)&&(o<3||d.substr(u,o)==r))&&(!l||!c.id(d.charCodeAt(u+o)))&&(f=C=r))&&S<e&&(u+=o,(y=t(g))?Rr(y,E):(u=E,f=0,!l&&!p&&!g&&R()),y)||p?.(g,S,f))),A=(r,e,t=!1)=>k(r,e,n=>n&&(o=>o&&[r,n,o])(a(e-(t?.5:0)))),_=(r,e,t)=>k(r,e,n=>t?n&&[r,n]:!n&&(n=a(e-.5))&&[r,n]),j=(r,e)=>k(r,200,t=>!t&&[,e]),lr=(r,e,t)=>k(r,e,(n,o)=>(o=a(e-(t?.5:0)),n?.[0]!==r&&(n=[r,n||null]),o?.[0]===r?n.push(...o.slice(1)):n.push(o||null),n)),W=(r,e)=>k(r[0],e,t=>!t&&[r,a(0,r.charCodeAt(1))||null]),ur=(r,e)=>k(r[0],e,t=>t&&[r,t,a(0,r.charCodeAt(1))||null]),w=(r,e,t,n=r.charCodeAt(0),o=r.length,p=I[n],l)=>I[n]=(f,y,g,S=u)=>!f&&(g?r==g:(o<2||d.substr(u,o)==r)&&(g=r))&&y<e&&!c.id(d.charCodeAt(u+o))&&(!c.prop||c.prop(u+o))&&(M(u+o),(l=t())?Rr(l,S):M(S),l)||p?.(f,y,g);Object.defineProperty(c,"space",{configurable:!0,enumerable:!0,get:()=>m,set:r=>m=r});var fr={},s=(r,e,t=fr[r])=>fr[r]=(...n)=>e(...n)||t?.(...n),i=r=>Array.isArray(r)?r[0]==null?(e=>()=>e)(r[1]):fr[r[0]]?.(...r.slice(1))??R(`Unknown operator: ${r[0]}`,r?.loc):r===void 0?()=>{}:e=>e?.[r];var q=46,z=48,x=57,ue=69,ce=101,me=43,de=45,Z=95,_r=110,ae=97,he=102,ye=65,Ae=70,Pr=r=>r.indexOf("_")<0?r:r.replaceAll("_",""),cr=r=>{let e=Pr(T(t=>t===q&&d.charCodeAt(u+1)!==q||t>=z&&t<=x||t===Z||((t===ue||t===ce)&&((t=d.charCodeAt(u+1))>=z&&t<=x||t===me||t===de)?2:0)));return d.charCodeAt(u)===_r?(h(),[,BigInt(e)]):(r=+e)!=r?R():[,r]},ge={2:r=>r===48||r===49||r===Z,8:r=>r>=48&&r<=55||r===Z,16:r=>r>=z&&r<=x||r>=ae&&r<=he||r>=ye&&r<=Ae||r===Z};c.number=null;I[q]=r=>!r&&d.charCodeAt(u+1)!==q&&cr();for(let r=z;r<=x;r++)I[r]=e=>e?void 0:cr();I[z]=r=>{if(r)return;let e=c.number;if(e){for(let[t,n]of Object.entries(e))if(t[0]==="0"&&d[u+1]?.toLowerCase()===t[1]){h(2);let o=Pr(T(ge[n]));return d.charCodeAt(u)===_r?(h(),[,BigInt("0"+t[1]+o)]):[,parseInt(o,n)]}}return cr()};var we=92,vr=34,Mr=39,Ee={n:`
5
- `,r:"\r",t:" ",b:"\b",f:"\f",v:"\v"},Ur=r=>(e,t,n="")=>{if(!(e||!c.string?.[String.fromCharCode(r)]))return h(),T(o=>o-r&&(o===we?(n+=Ee[d[u+1]]||d[u+1],2):(n+=d[u],1))),d[u]===String.fromCharCode(r)?h():R("Bad string"),[,n]};I[vr]=Ur(vr);I[Mr]=Ur(Mr);c.string={'"':!0};var Ce=20;"= += -= *= /= %= |= &= ^= >>= <<=".split(" ").map(r=>A(r,Ce,!0));var Lr=(r,e,t,n)=>typeof r=="string"?o=>e(o,r,o):r[0]==="."?(t=i(r[1]),n=r[2],o=>e(t(o),n,o)):r[0]==="[]"&&r.length===3?(t=i(r[1]),n=i(r[2]),o=>e(t(o),n(o),o)):r[0]==="()"&&r.length===2?Lr(r[1],e):(()=>{throw Error("Invalid assignment target")})(),Br={"=":(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 Br)s(r,(e,t)=>(t=i(t),Lr(e,(n,o,p)=>Br[r](n,o,t(p)))));var Se=30,ke=40,Ie=140;_("!",Ie);A("||",Se);A("&&",ke);s("!",r=>(r=i(r),e=>!r(e)));s("||",(r,e)=>(r=i(r),e=i(e),t=>r(t)||e(t)));s("&&",(r,e)=>(r=i(r),e=i(e),t=>r(t)&&e(t)));var Te=50,Ne=60,Re=70,Fr=100,Oe=140;A("|",Te);A("&",Re);A("^",Ne);A(">>",Fr);A("<<",Fr);_("~",Oe);s("~",r=>(r=i(r),e=>~r(e)));s("|",(r,e)=>(r=i(r),e=i(e),t=>r(t)|e(t)));s("&",(r,e)=>(r=i(r),e=i(e),t=>r(t)&e(t)));s("^",(r,e)=>(r=i(r),e=i(e),t=>r(t)^e(t)));s(">>",(r,e)=>(r=i(r),e=i(e),t=>r(t)>>e(t)));s("<<",(r,e)=>(r=i(r),e=i(e),t=>r(t)<<e(t)));var b=90;A("<",b);A(">",b);A("<=",b);A(">=",b);s(">",(r,e)=>(r=i(r),e=i(e),t=>r(t)>e(t)));s("<",(r,e)=>(r=i(r),e=i(e),t=>r(t)<e(t)));s(">=",(r,e)=>(r=i(r),e=i(e),t=>r(t)>=e(t)));s("<=",(r,e)=>(r=i(r),e=i(e),t=>r(t)<=e(t)));var Gr=80;A("==",Gr);A("!=",Gr);s("==",(r,e)=>(r=i(r),e=i(e),t=>r(t)==e(t)));s("!=",(r,e)=>(r=i(r),e=i(e),t=>r(t)!=e(t)));var Xr=110,mr=120,Dr=140;A("+",Xr);A("-",Xr);A("*",mr);A("/",mr);A("%",mr);_("+",Dr);_("-",Dr);s("+",(r,e)=>e!==void 0?(r=i(r),e=i(e),t=>r(t)+e(t)):(r=i(r),t=>+r(t)));s("-",(r,e)=>e!==void 0?(r=i(r),e=i(e),t=>r(t)-e(t)):(r=i(r),t=>-r(t)));s("*",(r,e)=>(r=i(r),e=i(e),t=>r(t)*e(t)));s("/",(r,e)=>(r=i(r),e=i(e),t=>r(t)/e(t)));s("%",(r,e)=>(r=i(r),e=i(e),t=>r(t)%e(t)));var rr=150;k("++",rr,r=>r?["++",r,null]:["++",a(rr-1)]);k("--",rr,r=>r?["--",r,null]:["--",a(rr-1)]);var dr=(r,e,t,n)=>typeof r=="string"?o=>e(o,r):r[0]==="."?(t=i(r[1]),n=r[2],o=>e(t(o),n)):r[0]==="[]"&&r.length===3?(t=i(r[1]),n=i(r[2]),o=>e(t(o),n(o))):r[0]==="()"&&r.length===2?dr(r[1],e):(()=>{throw Error("Invalid increment target")})();s("++",(r,e)=>dr(r,e===null?(t,n)=>t[n]++:(t,n)=>++t[n]));s("--",(r,e)=>dr(r,e===null?(t,n)=>t[n]--:(t,n)=>--t[n]));var _e=5,Pe=10;lr(",",Pe);lr(";",_e,!0);var Kr=(...r)=>(r=r.map(i),e=>{let t;for(let n of r)t=n(e);return t});s(",",Kr);s(";",Kr);var ve=170;W("()",ve);var F=r=>r?.[0]==="_"&&r[1]==="_"||r==="constructor"||r==="prototype",ar=170;ur("[]",ar);A(".",ar);ur("()",ar);var er=r=>{throw Error(r)};s("[]",(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]),n=>t(n)):(t=i(t),n=>[t(n)])),t=>r.flatMap(n=>n(t))):(e==null&&er("Missing index"),r=i(r),e=i(e),t=>{let n=e(t);return F(n)?void 0:r(t)[n]}));s(".",(r,e)=>(r=i(r),e=e[0]?e:e[1],F(e)?()=>{}:t=>r(t)[e]));s("()",(r,e)=>{if(e===void 0)return r==null?er("Empty ()"):i(r);let t=o=>o?.[0]===","&&o.slice(1).some(p=>p==null||t(p));t(e)&&er("Empty argument");let n=e?e[0]===","?(e=e.slice(1).map(i),o=>e.map(p=>p(o))):(e=i(e),o=>[e(o)]):()=>[];return hr(r,(o,p,l)=>o[p](...n(l)))});var U=r=>typeof r=="string"||Array.isArray(r)&&(r[0]==="."||r[0]==="?."||r[0]==="[]"&&r.length===3||r[0]==="?.[]"||r[0]==="()"&&r.length===2&&U(r[1])||r[0]==="{}"),hr=(r,e,t,n)=>r==null?er("Empty ()"):r[0]==="()"&&r.length==2?hr(r[1],e):typeof r=="string"?o=>e(o,r,o):r[0]==="."?(t=i(r[1]),n=r[2],o=>e(t(o),n,o)):r[0]==="?."?(t=i(r[1]),n=r[2],o=>{let p=t(o);return p==null?void 0:e(p,n,o)}):r[0]==="[]"&&r.length===3?(t=i(r[1]),n=i(r[2]),o=>e(t(o),n(o),o)):r[0]==="?.[]"?(t=i(r[1]),n=i(r[2]),o=>{let p=t(o);return p==null?void 0:e(p,n(o),o)}):(r=i(r),o=>e([r(o)],0,o)),G=hr;var Qr=new WeakMap,Me=(r,...e)=>typeof r=="string"?i(c(r)):Qr.get(r)||Qr.set(r,Ue(r,e)).get(r),$r=57344,Ue=(r,e)=>{let t=r.reduce((p,l,f)=>p+(f?String.fromCharCode($r+f-1):"")+l,""),n=c(t),o=p=>{if(typeof p=="string"&&p.length===1){let l=p.charCodeAt(0)-$r,f;if(l>=0&&l<e.length)return f=e[l],Be(f)?f:[,f]}return Array.isArray(p)?p.map(o):p};return i(o(n))},Be=r=>typeof r=="string"||Array.isArray(r)&&(typeof r[0]=="string"||r[0]===void 0),jr=Me;var Le=32,Fe=c.space;c.comment??={"//":`
6
- `,"/*":"*/"};var yr;c.space=()=>{yr||(yr=Object.entries(c.comment).map(([o,p])=>[o,p,o.charCodeAt(0)]));for(var r;r=Fe();){for(var e=0,t;t=yr[e++];)if(r===t[2]&&d.substr(u,t[0].length)===t[0]){var n=u+t[0].length;if(t[1]===`
7
- `)for(;d.charCodeAt(n)>=Le;)n++;else{for(;d[n]&&d.substr(n,t[1].length)!==t[1];)n++;d[n]&&(n+=t[1].length)}M(n),r=0;break}if(r)return r}return r};var Hr=80;A("===",Hr);A("!==",Hr);s("===",(r,e)=>(r=i(r),e=i(e),t=>r(t)===e(t)));s("!==",(r,e)=>(r=i(r),e=i(e),t=>r(t)!==e(t)));var Ge=30;A("??",Ge);s("??",(r,e)=>(r=i(r),e=i(e),t=>r(t)??e(t)));var Xe=130,De=20;A("**",Xe,!0);A("**=",De,!0);s("**",(r,e)=>(r=i(r),e=i(e),t=>r(t)**e(t)));var Ke=r=>{throw Error(r)};s("**=",(r,e)=>(U(r)||Ke("Invalid assignment target"),e=i(e),G(r,(t,n,o)=>t[n]**=e(o))));var Wr=90;A("in",Wr);A("of",Wr);s("in",(r,e)=>(r=i(r),e=i(e),t=>r(t)in e(t)));var Qe=20,$e=100,je=r=>{throw Error(r)};A(">>>",$e);A(">>>=",Qe,!0);s(">>>",(r,e)=>(r=i(r),e=i(e),t=>r(t)>>>e(t)));s(">>>=",(r,e)=>(U(r)||je("Invalid assignment target"),e=i(e),G(r,(t,n,o)=>t[n]>>>=e(o))));var Ar=5,He=10,We=20,ze=r=>r[0]?.[0]===","?r[0].slice(1):r,D=(r,e,t)=>{if(typeof r=="string"){t[r]=e;return}let[n,...o]=r,p=ze(o);if(n==="{}"){let l=[];for(let f of p){if(Array.isArray(f)&&f[0]==="..."){let E={};for(let O in e)l.includes(O)||(E[O]=e[O]);t[f[1]]=E;break}let y,g,S;typeof f=="string"?y=g=f:f[0]==="="?(typeof f[1]=="string"?y=g=f[1]:[,y,g]=f[1],S=f[2]):[,y,g]=f,l.push(y);let C=e[y];C===void 0&&S&&(C=i(S)(t)),D(g,C,t)}}else if(n==="[]"){let l=0;for(let f of p){if(f===null){l++;continue}if(Array.isArray(f)&&f[0]==="..."){t[f[1]]=e.slice(l);break}let y=f,g;Array.isArray(f)&&f[0]==="="&&([,y,g]=f);let S=e[l++];S===void 0&&g&&(S=i(g)(t)),D(y,S,t)}}},zr=r=>{let e=a(He-1);return e?.[0]==="in"||e?.[0]==="of"?[e[0],[r,e[1]],e[2]]:e?.[0]===","?[r,...e.slice(1)]:[r,e]};w("let",Ar+1,()=>zr("let"));w("const",Ar+1,()=>zr("const"));w("var",Ar,()=>(m(),["var",a(We)]));var Jr=(...r)=>(r=r.map(e=>{if(typeof e=="string")return t=>{t[e]=void 0};if(e[0]==="="){let[,t,n]=e,o=i(n);return typeof t=="string"?p=>{p[t]=o(p)}:p=>D(t,o(p),p)}return i(e)}),e=>{for(let t of r)t(e)});s("let",Jr);s("const",Jr);s("var",r=>typeof r=="string"?e=>{e[r]=void 0}:()=>{});var gr=20,tr=r=>{throw Error(r)};A("||=",gr,!0);A("&&=",gr,!0);A("??=",gr,!0);s("=",(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"?n=>{n[t]=e(n)}:n=>D(t,e(n),n)}return U(r)||tr("Invalid assignment target"),e=i(e),G(r,(t,n,o)=>t[n]=e(o))});s("||=",(r,e)=>(U(r)||tr("Invalid assignment target"),e=i(e),G(r,(t,n,o)=>t[n]||=e(o))));s("&&=",(r,e)=>(U(r)||tr("Invalid assignment target"),e=i(e),G(r,(t,n,o)=>t[n]&&=e(o))));s("??=",(r,e)=>(U(r)||tr("Invalid assignment target"),e=i(e),G(r,(t,n,o)=>t[n]??=e(o))));j("true",!0);j("false",!1);j("null",null);w("undefined",200,()=>[]);j("NaN",NaN);j("Infinity",1/0);var wr=20;k("?",wr,(r,e,t)=>r&&(e=a(wr-1))&&T(n=>n===58)&&(t=a(wr-1),["?",r,e,t]));s("?",(r,e,t)=>(r=i(r),e=i(e),t=i(t),n=>r(n)?e(n):t(n)));var v=[],Je=20;A("=>",Je,!0);s("=>",(r,e)=>{r=r?.[0]==="()"?r[1]:r;let t=r?r[0]===","?r.slice(1):[r]:[],n=-1,o=null,p=t[t.length-1];Array.isArray(p)&&p[0]==="..."&&(n=t.length-1,o=p[1],t.length--);let l=e?.[0]==="{}";return e=i(l?["{",e[1]]:e),f=>(...y)=>{let g={};t.forEach((C,E)=>g[C]=y[E]),o&&(g[o]=y.slice(n));let S=new Proxy(g,{get:(C,E)=>E in C?C[E]:f?.[E],set:(C,E,O)=>((E in C?C:f)[E]=O,!0),has:(C,E)=>E in C||(f?E in f:!1)});try{let C=e(S);return l?void 0:C}catch(C){if(C===v)return C[0];throw C}}});var Ve=140;_("...",Ve);s("...",r=>(r=i(r),e=>Object.entries(r(e))));var Vr=170;k("?.",Vr,(r,e)=>{if(!r)return;let t=m();return t===40?(h(),["?.()",r,a(0,41)||null]):t===91?(h(),["?.[]",r,a(0,93)]):(e=a(Vr),e?["?.",r,e]:void 0)});s("?.",(r,e)=>(r=i(r),F(e)?()=>{}:t=>r(t)?.[e]));s("?.[]",(r,e)=>(r=i(r),e=i(e),t=>{let n=e(t);return F(n)?void 0:r(t)?.[n]}));s("?.()",(r,e)=>{let t=e?e[0]===","?(e=e.slice(1).map(i),o=>e.map(p=>p(o))):(e=i(e),o=>[e(o)]):()=>[];if(r[0]==="?."){let o=i(r[1]),p=r[2];return F(p)?()=>{}:l=>o(l)?.[p]?.(...t(l))}if(r[0]==="?.[]"){let o=i(r[1]),p=i(r[2]);return l=>{let f=o(l),y=p(l);return F(y)?void 0:f?.[y]?.(...t(l))}}if(r[0]==="."){let o=i(r[1]),p=r[2];return F(p)?()=>{}:l=>o(l)?.[p]?.(...t(l))}if(r[0]==="[]"&&r.length===3){let o=i(r[1]),p=i(r[2]);return l=>{let f=o(l),y=p(l);return F(y)?void 0:f?.[y]?.(...t(l))}}let n=i(r);return o=>n(o)?.(...t(o))});var J=140;_("typeof",J);_("void",J);_("delete",J);w("new",J,()=>N(".target")?(h(7),["new.target"]):["new",a(J)]);s("typeof",r=>(r=i(r),e=>typeof r(e)));s("void",r=>(r=i(r),e=>(r(e),void 0)));s("delete",r=>{if(r[0]==="."){let e=i(r[1]),t=r[2];return n=>delete e(n)[t]}if(r[0]==="[]"){let e=i(r[1]),t=i(r[2]);return n=>delete e(n)[t(n)]}return()=>!0});s("new",r=>{let e=i(r?.[0]==="()"?r[1]:r),t=r?.[0]==="()"?r[2]:null,n=t?t[0]===","?(o=>p=>o.map(l=>l(p)))(t.slice(1).map(i)):(o=>p=>[o(p)])(i(t)):()=>[];return o=>new(e(o))(...n(o))});var nr=Symbol("accessor"),Er=20,Ye=40,Yr=41,Zr=123,qr=125,xr=r=>e=>{if(e)return;m();let t=T(c.id);if(!t||(m(),d.charCodeAt(u)!==Ye))return!1;h();let n=a(0,Yr);return m(),d.charCodeAt(u)!==Zr?!1:(h(),[r,t,n,a(0,qr)])};k("get",Er-1,xr("get"));k("set",Er-1,xr("set"));k("(",Er-1,r=>{if(!r||typeof r!="string")return;let e=a(0,Yr)||null;if(m(),d.charCodeAt(u)===Zr)return h(),[":",r,["=>",["()",e],a(0,qr)||null]]});s("get",(r,e)=>(e=e?i(e):()=>{},t=>[[nr,r,{get:function(){let n=Object.create(t||{});return n.this=this,e(n)}}]]));s("set",(r,e,t)=>(t=t?i(t):()=>{},n=>[[nr,r,{set:function(o){let p=Object.create(n||{});p.this=this,p[e]=o,t(p)}}]]));var Ze=20,br=200;c.prop=r=>Or(r)!==58;var qe=r=>r==null||typeof r=="string"||[":",",","...","get","set"].includes(r[0]);W("[]",br);W("{}",br);A(":",Ze-1,!0);s("{}",(r,e)=>{if(e!==void 0)return;if(!qe(r))return i(["{",r]);r=r?r[0]!==","?[r]:r.slice(1):[];let t=r.map(n=>i(typeof n=="string"?[":",n,n]:n));return n=>{let o={},p={};for(let l of t.flatMap(f=>f(n)))if(l[0]===nr){let[,f,y]=l;p[f]={...p[f],...y,configurable:!0,enumerable:!0}}else o[l[0]]=l[1];for(let l in p)Object.defineProperty(o,l,p[l]);return o}});s("{",r=>(r=r?i(r):()=>{},e=>r(Object.create(e))));s(":",(r,e)=>(e=i(e),Array.isArray(r)?(r=i(r),t=>[[r(t),e(t)]]):t=>[[r,e(t)]]));var xe=170,or=96,be=36,rt=123,et=92,tt={n:`
8
- `,r:"\r",t:" ",b:"\b",f:"\f",v:"\v"},re=()=>{let r=[];for(let e="",t;(t=d.charCodeAt(u))!==or;)t?t===et?(h(),e+=tt[d[u]]||d[u],h()):t===be&&d.charCodeAt(u+1)===rt?(e&&r.push([,e]),e="",h(2),r.push(a(0,125))):(e+=d[u],h(),t=d.charCodeAt(u),t===or&&e&&r.push([,e])):R("Unterminated template");return h(),r},nt=I[or];I[or]=(r,e)=>r&&e<xe?c.asi&&c.newline?void 0:(h(),["``",r,...re()]):r?nt?.(r,e):(h(),(t=>t.length<2&&t[0]?.[0]===void 0?t[0]||[,""]:["`",...t])(re()));s("`",(...r)=>(r=r.map(i),e=>r.map(t=>t(e)).join("")));s("``",(r,...e)=>{r=i(r);let t=[],n=[];for(let p of e)Array.isArray(p)&&p[0]===void 0?t.push(p[1]):n.push(i(p));let o=Object.assign([...t],{raw:t});return p=>r(p)(o,...n.map(l=>l(p)))});c.string["'"]=!0;c.number={"0x":16,"0b":2,"0o":8};var ir=5,ot=59,B=()=>(m()===123||R("Expected {"),h(),a(ir-.5,125)||null),X=()=>m()!==123?a(ir+.5):(h(),a(ir-.5,125)||null),it=()=>{let r=u;return m()===ot&&h(),m(),N("else")?(h(4),!0):(M(r),!1)};w("if",ir+1,()=>{m();let r=["if",P(),X()];return it()&&r.push(X()),r});s("if",(r,e,t)=>(r=i(r),e=i(e),t=t!==void 0?i(t):null,n=>r(n)?e(n):t?.(n)));var st=200;w("function",st,()=>{m();let r=!1;d[u]==="*"&&(r=!0,h(),m());let e=T(c.id);return e&&m(),r?["function*",e,P()||null,B()]:["function",e,P()||null,B()]});s("function",(r,e,t)=>{t=t?i(t):()=>{};let n=e?e[0]===","?e.slice(1):[e]:[],o=null,p=-1,l=n[n.length-1];return Array.isArray(l)&&l[0]==="..."&&(p=n.length-1,o=l[1],n.length--),f=>{let y=(...g)=>{let S={};n.forEach((E,O)=>S[E]=g[O]),o&&(S[o]=g.slice(p));let C=new Proxy(S,{get:(E,O)=>O in E?E[O]:f[O],set:(E,O,le)=>((O in E?E:f)[O]=le,!0),has:(E,O)=>O in E||O in f});try{return t(C)}catch(E){if(E===v)return E[0];throw E}};return r&&(f[r]=y),y}});s("function*",(r,e,t)=>{throw Error("Generator functions are not supported in evaluation")});var sr=140,Cr=20;_("await",sr);w("yield",sr,()=>(m(),d[u]==="*"?(h(),m(),["yield*",a(Cr)]):["yield",a(Cr)]));w("async",sr,()=>{if(m(),N("function"))return["async",a(sr)];let r=a(Cr-.5);return r&&["async",r]});s("async",r=>{let e=i(r);return t=>{let n=e(t);return async function(...o){return n(...o)}}});s("await",r=>(r=i(r),async e=>await r(e)));s("yield",r=>(r=r?i(r):null,e=>{throw{__yield__:r?r(e):void 0}}));s("yield*",r=>(r=i(r),e=>{throw{__yield_all__:r(e)}}));var Sr=200,pt=140,ft=90,lt=Symbol("static");_("static",pt);A("instanceof",ft);k("#",Sr,r=>{if(r)return;let e=T(c.id);return e?"#"+e:void 0});w("class",Sr,()=>{m();let r=T(c.id)||null;if(r==="extends")r=null,m();else{if(m(),!N("extends"))return["class",r,null,B()];h(7),m()}return["class",r,a(Sr),B()]});var ut=r=>{throw Error(r)};s("instanceof",(r,e)=>(r=i(r),e=i(e),t=>r(t)instanceof e(t)));s("class",(r,e,t)=>(e=e?i(e):null,t=t?i(t):null,n=>{let o=e?e(n):Object,p=function(...l){if(!(this instanceof p))return ut("Class constructor must be called with new");let f=e?Reflect.construct(o,l,p):this;return p.prototype.__constructor__&&p.prototype.__constructor__.apply(f,l),f};if(Object.setPrototypeOf(p.prototype,o.prototype),Object.setPrototypeOf(p,o),t){let l=Object.create(n);l.super=o;let f=t(l),y=Array.isArray(f)&&typeof f[0]?.[0]=="string"?f:[];for(let[g,S]of y)g==="constructor"?p.prototype.__constructor__=S:p.prototype[g]=S}return r&&(n[r]=p),p}));s("static",r=>(r=i(r),e=>[[lt,r(e)]]));var ct=140,kr=47,mt=92,dt=r=>r===mt?2:r&&r!==kr,at=r=>r===103||r===105||r===109||r===115||r===117||r===121;k("/",ct,r=>{if(r)return;let e=d.charCodeAt(u);if(e===kr||e===42||e===43||e===63||e===61)return;let t=T(dt);d.charCodeAt(u)===kr||R("Unterminated regex"),h();let n=T(at);try{new RegExp(t,n)}catch(o){R("Invalid regex: "+o.message)}return n?["//",t,n]:["//",t]});s("//",(r,e)=>{let t=new RegExp(r,e||"");return()=>t});var L=Symbol("break"),K=Symbol("continue"),Q=5,V=125,Y=59;w("while",Q+1,()=>(m(),["while",P(),X()]));w("do",Q+1,()=>(r=>(m(),h(5),m(),["do",r,P()]))(X()));w("for",Q+1,()=>(m(),N("await")?(h(5),m(),["for await",P(),X()]):["for",P(),X()]));w("break",Q+1,()=>{c.asi&&(c.newline=!1);let r=u;m();let e=d.charCodeAt(u);if(!e||e===V||e===Y||c.newline)return["break"];let t=T(c.id);if(!t)return["break"];m();let n=d.charCodeAt(u);return!n||n===V||n===Y||c.newline?["break",t]:(M(r),["break"])});w("continue",Q+1,()=>{c.asi&&(c.newline=!1);let r=u;m();let e=d.charCodeAt(u);if(!e||e===V||e===Y||c.newline)return["continue"];let t=T(c.id);if(!t)return["continue"];m();let n=d.charCodeAt(u);return!n||n===V||n===Y||c.newline?["continue",t]:(M(r),["continue"])});w("return",Q+1,()=>{c.asi&&(c.newline=!1);let r=m();return!r||r===V||r===Y||c.newline?["return"]:["return",a(Q)]});s("while",(r,e)=>(r=i(r),e=i(e),t=>{let n;for(;r(t);)try{n=e(t)}catch(o){if(o===L)break;if(o===K)continue;if(o===v)return o[0];throw o}return n}));s("do",(r,e)=>(r=i(r),e=i(e),t=>{let n;do try{n=r(t)}catch(o){if(o===L)break;if(o===K)continue;if(o===v)return o[0];throw o}while(e(t));return n}));s("for",(r,e)=>{if(Array.isArray(r)&&r[0]===";"){let[,t,n,o]=r;return t=t?i(t):null,n=n?i(n):()=>!0,o=o?i(o):null,e=i(e),p=>{let l;for(t?.(p);n(p);o?.(p))try{l=e(p)}catch(f){if(f===L)break;if(f===K)continue;if(f===v)return f[0];throw f}return l}}if(Array.isArray(r)&&(r[0]==="in"||r[0]==="of")){let[t,n,o]=r;if(Array.isArray(n)&&(n[0]==="let"||n[0]==="const"||n[0]==="var")&&(n=n[1]),t==="in")return yt(n,o,e);if(t==="of")return ht(n,o,e)}});var ht=(r,e,t)=>{e=i(e),t=i(t);let n=Array.isArray(r);return o=>{let p,l=n?null:o[r];for(let f of e(o)){n?D(r,f,o):o[r]=f;try{p=t(o)}catch(y){if(y===L)break;if(y===K)continue;if(y===v)return y[0];throw y}}return n||(o[r]=l),p}},yt=(r,e,t)=>{e=i(e),t=i(t);let n=Array.isArray(r);return o=>{let p,l=n?null:o[r];for(let f in e(o)){n?D(r,f,o):o[r]=f;try{p=t(o)}catch(y){if(y===L)break;if(y===K)continue;if(y===v)return y[0];throw y}}return n||(o[r]=l),p}};s("break",()=>()=>{throw L});s("continue",()=>()=>{throw K});s("return",r=>(r=r!==void 0?i(r):null,e=>{throw v[0]=r?.(e),v}));var Ir=5;w("try",Ir+1,()=>{let r=["try",B()];return m(),N("catch")&&(h(5),m(),r.push(["catch",P(),B()])),m(),N("finally")&&(h(7),r.push(["finally",B()])),r});w("throw",Ir+1,()=>{if(c.asi&&(c.newline=!1),m(),c.newline)throw SyntaxError("Unexpected newline after throw");return["throw",a(Ir)]});s("try",(r,...e)=>{r=r?i(r):null;let t=e.find(f=>f?.[0]==="catch"),n=e.find(f=>f?.[0]==="finally"),o=t?.[1],p=t?.[2]?i(t[2]):null,l=n?.[1]?i(n[1]):null;return f=>{let y;try{y=r?.(f)}catch(g){if(g===L||g===K||g===v)throw g;if(o!=null&&p){let S=o in f,C=f[o];f[o]=g;try{y=p(f)}finally{S?f[o]=C:delete f[o]}}else if(!p)throw g}finally{l?.(f)}return y}});s("throw",r=>(r=i(r),e=>{throw r(e)}));var ne=5,At=20,ee=58,gt=59,oe=125,Tr=0,ie=(r,e=r.length,t=r.charCodeAt(0),n=I[t])=>I[t]=(o,p,l)=>N(r)&&!o&&Tr||n?.(o,p,l);ie("case");ie("default");var te=r=>{let e=[];for(;(r=m())!==oe&&!N("case")&&!N("default");){if(r===gt){h();continue}e.push(a(ne-.5))||R()}return e.length>1?[";",...e]:e[0]||null},wt=()=>{m()===123||R("Expected {"),h(),Tr++;let r=[];try{for(;m()!==oe;)if(N("case")){M(u+4),m();let e=a(At-.5);m()===ee&&h(),r.push(["case",e,te()])}else N("default")?(M(u+7),m()===ee&&h(),r.push(["default",te()])):R("Expected case or default")}finally{Tr--}return h(),r};w("switch",ne+1,()=>m()===40&&["switch",P(),...wt()]);s("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 n=r(t),o=!1,p;for(let[f,y]of e)if(o||f===null||f(t)===n)for(o=!0,l=0;l<y.length;l++)try{p=y[l](t)}catch(g){if(g===L)return p;throw g}var l;return p}):t=>r(t)));var se=5;w("debugger",se+1,()=>["debugger"]);w("with",se+1,()=>(m(),["with",P(),X()]));var Nr=5,$=10,pe=42,Et=I[pe];I[pe]=(r,e)=>r?Et?.(r,e):(h(),"*");k("from",$+1,r=>r?r[0]!=="="&&r[0]!==","&&(m(),["from",r,a($+1)]):!1);k("as",$+2,r=>r?(m(),["as",r,a($+2)]):!1);w("import",Nr,()=>N(".meta")?(h(5),["import.meta"]):["import",a($)]);w("export",Nr,()=>(m(),["export",a(Nr)]));w("default",$+1,()=>m()!==58&&(m(),["default",a($)]));s("import",()=>()=>{});s("export",()=>()=>{});s("from",(r,e)=>()=>{});s("as",(r,e)=>()=>{});s("default",r=>i(r));var fe=H.asi??H[";"];c.asi=(r,e,t,n,o)=>e<fe&&(n=t(fe-.5))&&(o=n?.[0]===";"?n.slice(1):[n],r?.[0]===";"?(r.push(...o),r):[";",r,...o]);export{ur as access,A as binary,i as compile,d as cur,jr as default,R as err,a as expr,W as group,Ct as id,u as idx,w as keyword,j as literal,Rr as loc,I as lookup,lr as nary,T as next,s as operator,fr as operators,P as parens,c as parse,Or as peek,H as prec,M as seek,h as skip,m as space,k as token,_ as unary,N as word};
1
+ var _r=r=>r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102,me=(r=u+2,e,t=0,n=0)=>{if(m.charCodeAt(u)!==92||m.charCodeAt(u+1)!==117)return 0;if(m.charCodeAt(r)===123){for(;_r(e=m.charCodeAt(++r));)t=t*16+(e<=57?e-48:(e&31)+9);return r>u+3&&t<=1114111&&m.charCodeAt(r)===125?r-u+1:0}for(;n<4&&_r(m.charCodeAt(r+n));)n++;return n===4?6:0},fr,u,m,c=r=>(u=0,m=r,c.newline=!1,r=a(),m[u]?R():r||""),R=(r="Unexpected token",e=u,t=m.slice(0,e).split(`
2
+ `),n=t.pop(),o=m.slice(Math.max(0,e-40),e),f="\u032D",p=(m[e]||" ")+f,l=m.slice(e+1,e+20))=>{throw SyntaxError(`${r} at ${t.length+1}:${n.length+1}
3
+ ${m[e-41]!==`
4
+ `,""+o}${p}${l}`)},Or=(r,e=u)=>(Array.isArray(r)&&(r.loc=e),r),N=(r,e=u,t)=>{for(;t=r(m.charCodeAt(u))||r===c.id&&me();)u+=t;return m.slice(e,u)},h=(r=1)=>m[u+=r],v=r=>u=r,a=(r=0,e)=>{let t,n,o,f,p;for(e&&c.asi&&(c.newline=!1);(t=c.space())&&(p=c.newline,1)&&t!==e&&(o=(n&&t===91&&fr&&c.asi?.(n,r,a)||null)??((f=T[t])&&f(n,r))??(n&&p&&c.asi?.(n,r,a))??(!n&&N(c.id)));)n=o;return e&&(t==e?(u++,e===125&&c.asi&&(c.newline=!0)):R("Unclosed "+String.fromCharCode(e-(e>42?2:1)))),n},d=(r,e=u)=>{for(fr=!1;(r=m.charCodeAt(u))<=32;)c.asi&&r===10&&(c.newline=fr=!0),u++;return r},Pr=(r=u)=>{for(;m.charCodeAt(r)<=32;)r++;return m.charCodeAt(r)},Tt=c.id=r=>r>=48&&r<=57||r>=65&&r<=90||r>=97&&r<=122||r==36||r==95||r>=192&&r!=215&&r!=247,I=(r,e=r.length)=>m.substr(u,e)===r&&!c.id(m.charCodeAt(u+e)),P=()=>(h(),a(0,41)),T=[],j={},k=(r,e=32,t,n=r.charCodeAt(0),o=r.length,f=T[n],p=r.toUpperCase()!==r,l,A)=>(e=j[r]=!f&&j[r]||e,T[n]=(g,S,E,C=u)=>(l=E,(E?r==E:(o<2||r.charCodeAt(1)===m.charCodeAt(u+1)&&(o<3||m.substr(u,o)==r))&&(!p||!c.id(m.charCodeAt(u+o)))&&(l=E=r))&&S<e&&(u+=o,(A=t(g))?Or(A,C):(u=C,l=0,!p&&!f&&!g&&R()),A)||f?.(g,S,l))),y=(r,e,t=!1)=>k(r,e,n=>n&&(o=>o&&[r,n,o])(a(e-(t?.5:0)))),O=(r,e,t)=>k(r,e,n=>t?n&&[r,n]:!n&&(n=a(e-.5))&&[r,n]),$=(r,e)=>k(r,200,t=>!t&&[,e]),pr=(r,e,t)=>k(r,e,(n,o)=>(o=a(e-(t?.5:0)),n?.[0]!==r&&(n=[r,n||null]),o?.[0]===r?n.push(...o.slice(1)):n.push(o||null),n)),W=(r,e)=>k(r[0],e,t=>!t&&[r,a(0,r.charCodeAt(1))||null]),ur=(r,e)=>k(r[0],e,t=>t&&[r,t,a(0,r.charCodeAt(1))||null]),w=(r,e,t,n=r.charCodeAt(0),o=r.length,f=T[n],p)=>T[n]=(l,A,g,S=u)=>!l&&(g?r==g:(o<2||m.substr(u,o)==r)&&(g=r))&&A<e&&!c.id(m.charCodeAt(u+o))&&(!c.prop||c.prop(u+o))&&(v(u+o),(p=t())?Or(p,S):v(S),p)||f?.(l,A,g);Object.defineProperty(c,"space",{configurable:!0,enumerable:!0,get:()=>d,set:r=>d=r});var lr={},s=(r,e,t=lr[r])=>lr[r]=(...n)=>e(...n)||t?.(...n),i=r=>Array.isArray(r)?r[0]==null?(e=>()=>e)(r[1]):lr[r[0]]?.(...r.slice(1))??R(`Unknown operator: ${r[0]}`,r?.loc):r===void 0?()=>{}:e=>e?.[r];var q=46,z=48,x=57,de=69,ae=101,he=43,Ae=45,Z=95,vr=110,ye=97,ge=102,we=65,Ce=70,Br=r=>r.indexOf("_")<0?r:r.replaceAll("_",""),cr=r=>{let e=Br(N(t=>t===q&&m.charCodeAt(u+1)!==q||t>=z&&t<=x||t===Z||((t===de||t===ae)&&((t=m.charCodeAt(u+1))>=z&&t<=x||t===he||t===Ae)?2:0)));return m.charCodeAt(u)===vr?(h(),[,BigInt(e)]):(r=+e)!=r?R():[,r]},Ee={2:r=>r===48||r===49||r===Z,8:r=>r>=48&&r<=55||r===Z,16:r=>r>=z&&r<=x||r>=ye&&r<=ge||r>=we&&r<=Ce||r===Z};c.number=null;T[q]=r=>!r&&m.charCodeAt(u+1)!==q&&cr();for(let r=z;r<=x;r++)T[r]=e=>e?void 0:cr();T[z]=r=>{if(r)return;let e=c.number;if(e){for(let[t,n]of Object.entries(e))if(t[0]==="0"&&m[u+1]?.toLowerCase()===t[1]){h(2);let o=Br(N(Ee[n]));return m.charCodeAt(u)===vr?(h(),[,BigInt("0"+t[1]+o)]):[,parseInt(o,n)]}}return cr()};var Se=92,Lr=34,Mr=39,ke={n:`
5
+ `,r:"\r",t:" ",b:"\b",f:"\f",v:"\v"},Ur=r=>(e,t,n="")=>{if(!(e||!c.string?.[String.fromCharCode(r)]))return h(),N(o=>o-r&&(o===Se?(n+=ke[m[u+1]]||m[u+1],2):(n+=m[u],1))),m[u]===String.fromCharCode(r)?h():R("Bad string"),[,n]};T[Lr]=Ur(Lr);T[Mr]=Ur(Mr);c.string={'"':!0};var Ie=20;"= += -= *= /= %= |= &= ^= >>= <<=".split(" ").map(r=>y(r,Ie,!0));var Gr=(r,e,t,n)=>typeof r=="string"?o=>e(o,r,o):r[0]==="."?(t=i(r[1]),n=r[2],o=>e(t(o),n,o)):r[0]==="[]"&&r.length===3?(t=i(r[1]),n=i(r[2]),o=>e(t(o),n(o),o)):r[0]==="()"&&r.length===2?Gr(r[1],e):(()=>{throw Error("Invalid assignment target")})(),Fr={"=":(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 Fr)s(r,(e,t)=>(t=i(t),Gr(e,(n,o,f)=>Fr[r](n,o,t(f)))));var Te=30,Ne=40,Re=140;O("!",Re);y("||",Te);y("&&",Ne);s("!",r=>(r=i(r),e=>!r(e)));s("||",(r,e)=>(r=i(r),e=i(e),t=>r(t)||e(t)));s("&&",(r,e)=>(r=i(r),e=i(e),t=>r(t)&&e(t)));var _e=50,Oe=60,Pe=70,Xr=100,ve=140;y("|",_e);y("&",Pe);y("^",Oe);y(">>",Xr);y("<<",Xr);O("~",ve);s("~",r=>(r=i(r),e=>~r(e)));s("|",(r,e)=>(r=i(r),e=i(e),t=>r(t)|e(t)));s("&",(r,e)=>(r=i(r),e=i(e),t=>r(t)&e(t)));s("^",(r,e)=>(r=i(r),e=i(e),t=>r(t)^e(t)));s(">>",(r,e)=>(r=i(r),e=i(e),t=>r(t)>>e(t)));s("<<",(r,e)=>(r=i(r),e=i(e),t=>r(t)<<e(t)));var b=90;y("<",b);y(">",b);y("<=",b);y(">=",b);s(">",(r,e)=>(r=i(r),e=i(e),t=>r(t)>e(t)));s("<",(r,e)=>(r=i(r),e=i(e),t=>r(t)<e(t)));s(">=",(r,e)=>(r=i(r),e=i(e),t=>r(t)>=e(t)));s("<=",(r,e)=>(r=i(r),e=i(e),t=>r(t)<=e(t)));var Dr=80;y("==",Dr);y("!=",Dr);s("==",(r,e)=>(r=i(r),e=i(e),t=>r(t)==e(t)));s("!=",(r,e)=>(r=i(r),e=i(e),t=>r(t)!=e(t)));var Hr=110,mr=120,Kr=140;y("+",Hr);y("-",Hr);y("*",mr);y("/",mr);y("%",mr);O("+",Kr);O("-",Kr);s("+",(r,e)=>e!==void 0?(r=i(r),e=i(e),t=>r(t)+e(t)):(r=i(r),t=>+r(t)));s("-",(r,e)=>e!==void 0?(r=i(r),e=i(e),t=>r(t)-e(t)):(r=i(r),t=>-r(t)));s("*",(r,e)=>(r=i(r),e=i(e),t=>r(t)*e(t)));s("/",(r,e)=>(r=i(r),e=i(e),t=>r(t)/e(t)));s("%",(r,e)=>(r=i(r),e=i(e),t=>r(t)%e(t)));var rr=150;k("++",rr,r=>r?["++",r,null]:["++",a(rr-1)]);k("--",rr,r=>r?["--",r,null]:["--",a(rr-1)]);var dr=(r,e,t,n)=>typeof r=="string"?o=>e(o,r):r[0]==="."?(t=i(r[1]),n=r[2],o=>e(t(o),n)):r[0]==="[]"&&r.length===3?(t=i(r[1]),n=i(r[2]),o=>e(t(o),n(o))):r[0]==="()"&&r.length===2?dr(r[1],e):(()=>{throw Error("Invalid increment target")})();s("++",(r,e)=>dr(r,e===null?(t,n)=>t[n]++:(t,n)=>++t[n]));s("--",(r,e)=>dr(r,e===null?(t,n)=>t[n]--:(t,n)=>--t[n]));var Be=5,Le=10;pr(",",Le);pr(";",Be,!0);var Qr=(...r)=>(r=r.map(i),e=>{let t;for(let n of r)t=n(e);return t});s(",",Qr);s(";",Qr);var Me=170;W("()",Me);var F=r=>r?.[0]==="_"&&r[1]==="_"||r==="constructor"||r==="prototype",ar=170;ur("[]",ar);y(".",ar);ur("()",ar);var er=r=>{throw Error(r)};s("[]",(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]),n=>t(n)):(t=i(t),n=>[t(n)])),t=>r.flatMap(n=>n(t))):(e==null&&er("Missing index"),r=i(r),e=i(e),t=>{let n=e(t);return F(n)?void 0:r(t)[n]}));s(".",(r,e)=>(r=i(r),e=e[0]?e:e[1],F(e)?()=>{}:t=>r(t)[e]));s("()",(r,e)=>{if(e===void 0)return r==null?er("Empty ()"):i(r);let t=o=>o?.[0]===","&&o.slice(1).some(f=>f==null||t(f));t(e)&&er("Empty argument");let n=e?e[0]===","?(e=e.slice(1).map(i),o=>e.map(f=>f(o))):(e=i(e),o=>[e(o)]):()=>[];return hr(r,(o,f,p)=>o[f](...n(p)))});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]==="{}"),hr=(r,e,t,n)=>r==null?er("Empty ()"):r[0]==="()"&&r.length==2?hr(r[1],e):typeof r=="string"?o=>e(o,r,o):r[0]==="."?(t=i(r[1]),n=r[2],o=>e(t(o),n,o)):r[0]==="?."?(t=i(r[1]),n=r[2],o=>{let f=t(o);return f==null?void 0:e(f,n,o)}):r[0]==="[]"&&r.length===3?(t=i(r[1]),n=i(r[2]),o=>e(t(o),n(o),o)):r[0]==="?.[]"?(t=i(r[1]),n=i(r[2]),o=>{let f=t(o);return f==null?void 0:e(f,n(o),o)}):(r=i(r),o=>e([r(o)],0,o)),G=hr;var $r=new WeakMap,Ue=(r,...e)=>typeof r=="string"?i(c(r)):$r.get(r)||$r.set(r,Fe(r,e)).get(r),jr=57344,Fe=(r,e)=>{let t=r.reduce((f,p,l)=>f+(l?String.fromCharCode(jr+l-1):"")+p,""),n=c(t),o=f=>{if(typeof f=="string"&&f.length===1){let p=f.charCodeAt(0)-jr,l;if(p>=0&&p<e.length)return l=e[p],Ge(l)?l:[,l]}return Array.isArray(f)?f.map(o):f};return i(o(n))},Ge=r=>typeof r=="string"||Array.isArray(r)&&(typeof r[0]=="string"||r[0]===void 0),Wr=Ue;var Xe=32,De=c.space;c.comment??={"//":`
6
+ `,"/*":"*/"};var Ar;c.space=()=>{Ar||(Ar=Object.entries(c.comment).map(([o,f])=>[o,f,o.charCodeAt(0)]));for(var r;r=De();){for(var e=0,t;t=Ar[e++];)if(r===t[2]&&m.substr(u,t[0].length)===t[0]){var n=u+t[0].length;if(t[1]===`
7
+ `)for(;m.charCodeAt(n)>=Xe;)n++;else{for(;m[n]&&m.substr(n,t[1].length)!==t[1];)n++;m[n]&&(n+=t[1].length)}v(n),r=0;break}if(r)return r}return r};var zr=80;y("===",zr);y("!==",zr);s("===",(r,e)=>(r=i(r),e=i(e),t=>r(t)===e(t)));s("!==",(r,e)=>(r=i(r),e=i(e),t=>r(t)!==e(t)));var He=30;y("??",He);s("??",(r,e)=>(r=i(r),e=i(e),t=>r(t)??e(t)));var Ke=130,Qe=20;y("**",Ke,!0);y("**=",Qe,!0);s("**",(r,e)=>(r=i(r),e=i(e),t=>r(t)**e(t)));var $e=r=>{throw Error(r)};s("**=",(r,e)=>(L(r)||$e("Invalid assignment target"),e=i(e),G(r,(t,n,o)=>t[n]**=e(o))));var Jr=90;y("in",Jr);y("of",Jr);s("in",(r,e)=>(r=i(r),e=i(e),t=>r(t)in e(t)));var je=20,We=100,ze=r=>{throw Error(r)};y(">>>",We);y(">>>=",je,!0);s(">>>",(r,e)=>(r=i(r),e=i(e),t=>r(t)>>>e(t)));s(">>>=",(r,e)=>(L(r)||ze("Invalid assignment target"),e=i(e),G(r,(t,n,o)=>t[n]>>>=e(o))));var yr=5,Je=10,Ve=20,Ye=r=>r[0]?.[0]===","?r[0].slice(1):r,D=(r,e,t)=>{if(typeof r=="string"){t[r]=e;return}let[n,...o]=r,f=Ye(o);if(n==="{}"){let p=[];for(let l of f){if(Array.isArray(l)&&l[0]==="..."){let C={};for(let _ in e)p.includes(_)||(C[_]=e[_]);t[l[1]]=C;break}let A,g,S;typeof l=="string"?A=g=l:l[0]==="="?(typeof l[1]=="string"?A=g=l[1]:[,A,g]=l[1],S=l[2]):[,A,g]=l,p.push(A);let E=e[A];E===void 0&&S&&(E=i(S)(t)),D(g,E,t)}}else if(n==="[]"){let p=0;for(let l of f){if(l===null){p++;continue}if(Array.isArray(l)&&l[0]==="..."){t[l[1]]=e.slice(p);break}let A=l,g;Array.isArray(l)&&l[0]==="="&&([,A,g]=l);let S=e[p++];S===void 0&&g&&(S=i(g)(t)),D(A,S,t)}}},Vr=r=>{if(r==="let"){let t=u;if(d(),I("in")){v(t);return}v(t)}let e=a(Je-1);return e?.[0]==="in"||e?.[0]==="of"?[e[0],[r,e[1]],e[2]]:e?.[0]===","?[r,...e.slice(1)]:[r,e]};w("let",yr+1,()=>Vr("let"));w("const",yr+1,()=>Vr("const"));w("var",yr,()=>(d(),["var",a(Ve)]));var Yr=(...r)=>(r=r.map(e=>{if(typeof e=="string")return t=>{t[e]=void 0};if(e[0]==="="){let[,t,n]=e,o=i(n);return typeof t=="string"?f=>{f[t]=o(f)}:f=>D(t,o(f),f)}return i(e)}),e=>{for(let t of r)t(e)});s("let",Yr);s("const",Yr);s("var",r=>typeof r=="string"?e=>{e[r]=void 0}:()=>{});var gr=20,tr=r=>{throw Error(r)};y("||=",gr,!0);y("&&=",gr,!0);y("??=",gr,!0);s("=",(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"?n=>{n[t]=e(n)}:n=>D(t,e(n),n)}return L(r)||tr("Invalid assignment target"),e=i(e),G(r,(t,n,o)=>t[n]=e(o))});s("||=",(r,e)=>(L(r)||tr("Invalid assignment target"),e=i(e),G(r,(t,n,o)=>t[n]||=e(o))));s("&&=",(r,e)=>(L(r)||tr("Invalid assignment target"),e=i(e),G(r,(t,n,o)=>t[n]&&=e(o))));s("??=",(r,e)=>(L(r)||tr("Invalid assignment target"),e=i(e),G(r,(t,n,o)=>t[n]??=e(o))));$("true",!0);$("false",!1);$("null",null);w("undefined",200,()=>[]);$("NaN",NaN);$("Infinity",1/0);var wr=20;k("?",wr,(r,e,t)=>r&&(e=a(wr-1))&&N(n=>n===58)&&(t=a(wr-1),["?",r,e,t]));s("?",(r,e,t)=>(r=i(r),e=i(e),t=i(t),n=>r(n)?e(n):t(n)));var B=[],Ze=20;y("=>",Ze,!0);s("=>",(r,e)=>{r=r?.[0]==="()"?r[1]:r;let t=r?r[0]===","?r.slice(1):[r]:[],n=-1,o=null,f=t[t.length-1];Array.isArray(f)&&f[0]==="..."&&(n=t.length-1,o=f[1],t.length--);let p=e?.[0]==="{}";return e=i(p?["{",e[1]]:e),l=>(...A)=>{let g={};t.forEach((E,C)=>g[E]=A[C]),o&&(g[o]=A.slice(n));let S=new Proxy(g,{get:(E,C)=>C in E?E[C]:l?.[C],set:(E,C,_)=>((C in E?E:l)[C]=_,!0),has:(E,C)=>C in E||(l?C in l:!1)});try{let E=e(S);return p?void 0:E}catch(E){if(E===B)return E[0];throw E}}});var qe=140;O("...",qe);s("...",r=>(r=i(r),e=>Object.entries(r(e))));var Zr=170;k("?.",Zr,(r,e)=>{if(!r)return;let t=d();return t===40?(h(),["?.()",r,a(0,41)||null]):t===91?(h(),["?.[]",r,a(0,93)]):(e=a(Zr),e?["?.",r,e]:void 0)});s("?.",(r,e)=>(r=i(r),F(e)?()=>{}:t=>r(t)?.[e]));s("?.[]",(r,e)=>(r=i(r),e=i(e),t=>{let n=e(t);return F(n)?void 0:r(t)?.[n]}));s("?.()",(r,e)=>{let t=e?e[0]===","?(e=e.slice(1).map(i),o=>e.map(f=>f(o))):(e=i(e),o=>[e(o)]):()=>[];if(r[0]==="?."){let o=i(r[1]),f=r[2];return F(f)?()=>{}:p=>o(p)?.[f]?.(...t(p))}if(r[0]==="?.[]"){let o=i(r[1]),f=i(r[2]);return p=>{let l=o(p),A=f(p);return F(A)?void 0:l?.[A]?.(...t(p))}}if(r[0]==="."){let o=i(r[1]),f=r[2];return F(f)?()=>{}:p=>o(p)?.[f]?.(...t(p))}if(r[0]==="[]"&&r.length===3){let o=i(r[1]),f=i(r[2]);return p=>{let l=o(p),A=f(p);return F(A)?void 0:l?.[A]?.(...t(p))}}let n=i(r);return o=>n(o)?.(...t(o))});var J=140;O("typeof",J);O("void",J);O("delete",J);w("new",J,()=>I(".target")?(h(7),["new.target"]):["new",a(J)]);s("typeof",r=>(r=i(r),e=>typeof r(e)));s("void",r=>(r=i(r),e=>(r(e),void 0)));s("delete",r=>{if(r[0]==="."){let e=i(r[1]),t=r[2];return n=>delete e(n)[t]}if(r[0]==="[]"){let e=i(r[1]),t=i(r[2]);return n=>delete e(n)[t(n)]}return()=>!0});s("new",r=>{let e=i(r?.[0]==="()"?r[1]:r),t=r?.[0]==="()"?r[2]:null,n=t?t[0]===","?(o=>f=>o.map(p=>p(f)))(t.slice(1).map(i)):(o=>f=>[o(f)])(i(t)):()=>[];return o=>new(e(o))(...n(o))});var nr=Symbol("accessor"),Cr=20,xe=40,qr=41,xr=123,br=125,re=r=>e=>{if(e)return;d();let t=N(c.id);if(!t||(d(),m.charCodeAt(u)!==xe))return!1;h();let n=a(0,qr);return d(),m.charCodeAt(u)!==xr?!1:(h(),[r,t,n,a(0,br)])};k("get",Cr-1,re("get"));k("set",Cr-1,re("set"));k("(",Cr-1,r=>{if(!r||typeof r!="string")return;let e=a(0,qr)||null;if(d(),m.charCodeAt(u)===xr)return h(),[":",r,["=>",["()",e],a(0,br)||null]]});s("get",(r,e)=>(e=e?i(e):()=>{},t=>[[nr,r,{get:function(){let n=Object.create(t||{});return n.this=this,e(n)}}]]));s("set",(r,e,t)=>(t=t?i(t):()=>{},n=>[[nr,r,{set:function(o){let f=Object.create(n||{});f.this=this,f[e]=o,t(f)}}]]));var be=20,ee=200;c.prop=r=>Pr(r)!==58;var rt=r=>r==null||typeof r=="string"||[":",",","...","get","set"].includes(r[0]);W("[]",ee);W("{}",ee);y(":",be-1,!0);s("{}",(r,e)=>{if(e!==void 0)return;if(!rt(r))return i(["{",r]);r=r?r[0]!==","?[r]:r.slice(1):[];let t=r.map(n=>i(typeof n=="string"?[":",n,n]:n));return n=>{let o={},f={};for(let p of t.flatMap(l=>l(n)))if(p[0]===nr){let[,l,A]=p;f[l]={...f[l],...A,configurable:!0,enumerable:!0}}else o[p[0]]=p[1];for(let p in f)Object.defineProperty(o,p,f[p]);return o}});s("{",r=>(r=r?i(r):()=>{},e=>r(Object.create(e))));s(":",(r,e)=>(e=i(e),Array.isArray(r)?(r=i(r),t=>[[r(t),e(t)]]):t=>[[r,e(t)]]));var et=170,or=96,tt=36,nt=123,ot=92,it={n:`
8
+ `,r:"\r",t:" ",b:"\b",f:"\f",v:"\v"},te=()=>{let r=[];for(let e="",t;(t=m.charCodeAt(u))!==or;)t?t===ot?(h(),e+=it[m[u]]||m[u],h()):t===tt&&m.charCodeAt(u+1)===nt?(e&&r.push([,e]),e="",h(2),r.push(a(0,125))):(e+=m[u],h(),t=m.charCodeAt(u),t===or&&e&&r.push([,e])):R("Unterminated template");return h(),r},st=T[or];T[or]=(r,e)=>r&&e<et?c.asi&&c.newline?void 0:(h(),["``",r,...te()]):r?st?.(r,e):(h(),(t=>t.length<2&&t[0]?.[0]===void 0?t[0]||[,""]:["`",...t])(te()));s("`",(...r)=>(r=r.map(i),e=>r.map(t=>t(e)).join("")));s("``",(r,...e)=>{r=i(r);let t=[],n=[];for(let f of e)Array.isArray(f)&&f[0]===void 0?t.push(f[1]):n.push(i(f));let o=Object.assign([...t],{raw:t});return f=>r(f)(o,...n.map(p=>p(f)))});c.string["'"]=!0;c.number={"0x":16,"0b":2,"0o":8};var ir=5,ft=59,M=()=>(d()===123||R("Expected {"),h(),a(ir-.5,125)||null),X=()=>d()!==123?a(ir+.5):(h(),a(ir-.5,125)||null),lt=()=>{let r=u;return d()===ft&&h(),d(),I("else")?(h(4),!0):(v(r),!1)};w("if",ir+1,()=>{d();let r=["if",P(),X()];return lt()&&r.push(X()),r});s("if",(r,e,t)=>(r=i(r),e=i(e),t=t!==void 0?i(t):null,n=>r(n)?e(n):t?.(n)));var pt=200;w("function",pt,()=>{d();let r=!1;m[u]==="*"&&(r=!0,h(),d());let e=N(c.id);return e&&d(),r?["function*",e,P()||null,M()]:["function",e,P()||null,M()]});s("function",(r,e,t)=>{t=t?i(t):()=>{};let n=e?e[0]===","?e.slice(1):[e]:[],o=null,f=-1,p=n[n.length-1];return Array.isArray(p)&&p[0]==="..."&&(f=n.length-1,o=p[1],n.length--),l=>{let A=(...g)=>{let S={};n.forEach((C,_)=>S[C]=g[_]),o&&(S[o]=g.slice(f));let E=new Proxy(S,{get:(C,_)=>_ in C?C[_]:l[_],set:(C,_,ce)=>((_ in C?C:l)[_]=ce,!0),has:(C,_)=>_ in C||_ in l});try{return t(E)}catch(C){if(C===B)return C[0];throw C}};return r&&(l[r]=A),A}});s("function*",(r,e,t)=>{throw Error("Generator functions are not supported in evaluation")});var sr=140,Er=20;O("await",sr);w("yield",sr,()=>(d(),m[u]==="*"?(h(),d(),["yield*",a(Er)]):["yield",a(Er)]));w("async",sr,()=>{if(d(),I("function"))return["async",a(sr)];let r=a(Er-.5);return r&&["async",r]});s("async",r=>{let e=i(r);return t=>{let n=e(t);return async function(...o){return n(...o)}}});s("await",r=>(r=i(r),async e=>await r(e)));s("yield",r=>(r=r?i(r):null,e=>{throw{__yield__:r?r(e):void 0}}));s("yield*",r=>(r=i(r),e=>{throw{__yield_all__:r(e)}}));var Sr=200,ut=140,ct=90,mt=Symbol("static");O("static",ut);y("instanceof",ct);k("#",Sr,r=>{if(r)return;let e=N(c.id);return e?"#"+e:void 0});w("class",Sr,()=>{d();let r=N(c.id)||null;if(r==="extends")r=null,d();else{if(d(),!I("extends"))return["class",r,null,M()];h(7),d()}return["class",r,a(Sr),M()]});var dt=r=>{throw Error(r)};s("instanceof",(r,e)=>(r=i(r),e=i(e),t=>r(t)instanceof e(t)));s("class",(r,e,t)=>(e=e?i(e):null,t=t?i(t):null,n=>{let o=e?e(n):Object,f=function(...p){if(!(this instanceof f))return dt("Class constructor must be called with new");let l=e?Reflect.construct(o,p,f):this;return f.prototype.__constructor__&&f.prototype.__constructor__.apply(l,p),l};if(Object.setPrototypeOf(f.prototype,o.prototype),Object.setPrototypeOf(f,o),t){let p=Object.create(n);p.super=o;let l=t(p),A=Array.isArray(l)&&typeof l[0]?.[0]=="string"?l:[];for(let[g,S]of A)g==="constructor"?f.prototype.__constructor__=S:f.prototype[g]=S}return r&&(n[r]=f),f}));s("static",r=>(r=i(r),e=>[[mt,r(e)]]));var at=140,kr=47,ht=92,At=r=>r===ht?2:r&&r!==kr,yt=r=>r===103||r===105||r===109||r===115||r===117||r===121;k("/",at,r=>{if(r)return;let e=m.charCodeAt(u);if(e===kr||e===42||e===43||e===63||e===61)return;let t=N(At);m.charCodeAt(u)===kr||R("Unterminated regex"),h();let n=N(yt);try{new RegExp(t,n)}catch(o){R("Invalid regex: "+o.message)}return n?["//",t,n]:["//",t]});s("//",(r,e)=>{let t=new RegExp(r,e||"");return()=>t});var U=Symbol("break"),H=Symbol("continue"),K=5,V=125,Y=59;w("while",K+1,()=>(d(),["while",P(),X()]));w("do",K+1,()=>(r=>(d(),h(5),d(),["do",r,P()]))(X()));w("for",K+1,()=>(d(),I("await")?(h(5),d(),["for await",P(),X()]):["for",P(),X()]));w("break",K+1,()=>{c.asi&&(c.newline=!1);let r=u;d();let e=m.charCodeAt(u);if(!e||e===V||e===Y||c.newline)return["break"];let t=N(c.id);if(!t)return["break"];d();let n=m.charCodeAt(u);return!n||n===V||n===Y||c.newline?["break",t]:(v(r),["break"])});w("continue",K+1,()=>{c.asi&&(c.newline=!1);let r=u;d();let e=m.charCodeAt(u);if(!e||e===V||e===Y||c.newline)return["continue"];let t=N(c.id);if(!t)return["continue"];d();let n=m.charCodeAt(u);return!n||n===V||n===Y||c.newline?["continue",t]:(v(r),["continue"])});w("return",K+1,()=>{c.asi&&(c.newline=!1);let r=d();return!r||r===V||r===Y||c.newline?["return"]:["return",a(K)]});s("while",(r,e)=>(r=i(r),e=i(e),t=>{let n;for(;r(t);)try{n=e(t)}catch(o){if(o===U)break;if(o===H)continue;if(o===B)return o[0];throw o}return n}));s("do",(r,e)=>(r=i(r),e=i(e),t=>{let n;do try{n=r(t)}catch(o){if(o===U)break;if(o===H)continue;if(o===B)return o[0];throw o}while(e(t));return n}));s("for",(r,e)=>{if(Array.isArray(r)&&r[0]===";"){let[,t,n,o]=r;return t=t?i(t):null,n=n?i(n):()=>!0,o=o?i(o):null,e=i(e),f=>{let p;for(t?.(f);n(f);o?.(f))try{p=e(f)}catch(l){if(l===U)break;if(l===H)continue;if(l===B)return l[0];throw l}return p}}if(Array.isArray(r)&&(r[0]==="in"||r[0]==="of")){let[t,n,o]=r;if(Array.isArray(n)&&(n[0]==="let"||n[0]==="const"||n[0]==="var")&&(n=n[1]),t==="in")return wt(n,o,e);if(t==="of")return gt(n,o,e)}});var gt=(r,e,t)=>{e=i(e),t=i(t);let n=Array.isArray(r);return o=>{let f,p=n?null:o[r];for(let l of e(o)){n?D(r,l,o):o[r]=l;try{f=t(o)}catch(A){if(A===U)break;if(A===H)continue;if(A===B)return A[0];throw A}}return n||(o[r]=p),f}},wt=(r,e,t)=>{e=i(e),t=i(t);let n=Array.isArray(r);return o=>{let f,p=n?null:o[r];for(let l in e(o)){n?D(r,l,o):o[r]=l;try{f=t(o)}catch(A){if(A===U)break;if(A===H)continue;if(A===B)return A[0];throw A}}return n||(o[r]=p),f}};s("break",()=>()=>{throw U});s("continue",()=>()=>{throw H});s("return",r=>(r=r!==void 0?i(r):null,e=>{throw B[0]=r?.(e),B}));var Ir=5;w("try",Ir+1,()=>{let r=["try",M()];return d(),I("catch")&&(h(5),d(),r.push(["catch",P(),M()])),d(),I("finally")&&(h(7),r.push(["finally",M()])),r});w("throw",Ir+1,()=>{if(c.asi&&(c.newline=!1),d(),c.newline)throw SyntaxError("Unexpected newline after throw");return["throw",a(Ir)]});s("try",(r,...e)=>{r=r?i(r):null;let t=e.find(l=>l?.[0]==="catch"),n=e.find(l=>l?.[0]==="finally"),o=t?.[1],f=t?.[2]?i(t[2]):null,p=n?.[1]?i(n[1]):null;return l=>{let A;try{A=r?.(l)}catch(g){if(g===U||g===H||g===B)throw g;if(o!=null&&f){let S=o in l,E=l[o];l[o]=g;try{A=f(l)}finally{S?l[o]=E:delete l[o]}}else if(!f)throw g}finally{p?.(l)}return A}});s("throw",r=>(r=i(r),e=>{throw r(e)}));var ie=5,Ct=20,ne=58,Et=59,se=125,Tr=0,fe=(r,e=r.length,t=r.charCodeAt(0),n=T[t])=>T[t]=(o,f,p)=>I(r)&&!o&&Tr||n?.(o,f,p);fe("case");fe("default");var oe=r=>{let e=[];for(;(r=d())!==se&&!I("case")&&!I("default");){if(r===Et){h();continue}e.push(a(ie-.5))||R()}return e.length>1?[";",...e]:e[0]||null},St=()=>{d()===123||R("Expected {"),h(),Tr++;let r=[];try{for(;d()!==se;)if(I("case")){v(u+4),d();let e=a(Ct-.5);d()===ne&&h(),r.push(["case",e,oe()])}else I("default")?(v(u+7),d()===ne&&h(),r.push(["default",oe()])):R("Expected case or default")}finally{Tr--}return h(),r};w("switch",ie+1,()=>d()===40&&["switch",P(),...St()]);s("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 n=r(t),o=!1,f;for(let[l,A]of e)if(o||l===null||l(t)===n)for(o=!0,p=0;p<A.length;p++)try{f=A[p](t)}catch(g){if(g===U)return f;throw g}var p;return f}):t=>r(t)));var le=5;w("debugger",le+1,()=>["debugger"]);w("with",le+1,()=>(d(),["with",P(),X()]));var Nr=5,Q=10,pe=42,kt=T[pe];T[pe]=(r,e)=>r?kt?.(r,e):(h(),"*");k("from",Q+1,r=>r?r[0]!=="="&&r[0]!==","&&(d(),["from",r,a(Q+1)]):!1);k("as",Q+2,r=>r?(d(),["as",r,a(Q+2)]):!1);w("import",Nr,()=>I(".meta")?(h(5),["import.meta"]):["import",a(Q)]);w("export",Nr,()=>(d(),["export",a(Nr)]));w("default",Q+1,()=>d()!==58&&(d(),["default",a(Q)]));s("import",()=>()=>{});s("export",()=>()=>{});s("from",(r,e)=>()=>{});s("as",(r,e)=>()=>{});s("default",r=>i(r));var ue=j.asi??j[";"],Rr=0,It=100;c.asi=(r,e,t,n,o)=>{if(!(e>=ue||Rr>=It)){Rr++;try{n=t(ue-.5)}finally{Rr--}if(n)return o=n?.[0]===";"?n.slice(1):[n],r?.[0]===";"?(r.push(...o),r):[";",r,...o]}};export{ur as access,y as binary,i as compile,m as cur,Wr as default,R as err,a as expr,W as group,Tt as id,u as idx,w as keyword,$ as literal,Or as loc,T as lookup,pr as nary,N as next,s as operator,lr as operators,P as parens,c as parse,Pr as peek,j as prec,v as seek,h as skip,d as space,k as token,O as unary,I as word};
package/justin.min.js CHANGED
@@ -1,8 +1,8 @@
1
- var J,u,m,d=r=>(u=0,m=r,d.newline=!1,r=A(),m[u]?k():r||""),k=(r="Unexpected token",e=u,t=m.slice(0,e).split(`
2
- `),n=t.pop(),i=m.slice(Math.max(0,e-40),e),p="\u032D",f=(m[e]||" ")+p,l=m.slice(e+1,e+20))=>{throw SyntaxError(`${r} at ${t.length+1}:${n.length+1}
3
- ${m[e-41]!==`
4
- `,""+i}${f}${l}`)},fr=(r,e=u)=>(Array.isArray(r)&&(r.loc=e),r),v=(r,e=u,t)=>{for(;t=r(m.charCodeAt(u));)u+=t;return m.slice(e,u)},h=(r=1)=>m[u+=r],F=r=>u=r,A=(r=0,e)=>{let t,n,i,p,f;for(e&&d.asi&&(d.newline=!1);(t=d.space())&&(f=d.newline,1)&&t!==e&&(i=(n&&t===91&&J&&d.asi?.(n,r,A)||null)??((p=I[t])&&p(n,r))??(n&&f&&d.asi?.(n,r,A))??(!n&&v(d.id)));)n=i;return e&&(t==e?(u++,e===125&&d.asi&&(d.newline=!0)):k("Unclosed "+String.fromCharCode(e-(e>42?2:1)))),n},N=(r,e=u)=>{for(J=!1;(r=m.charCodeAt(u))<=32;)d.asi&&r===10&&(d.newline=J=!0),u++;return r},lr=(r=u)=>{for(;m.charCodeAt(r)<=32;)r++;return m.charCodeAt(r)},_e=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,ur=(r,e=r.length)=>m.substr(u,e)===r&&!d.id(m.charCodeAt(u+e)),Ue=()=>(h(),A(0,41)),I=[],pr={},E=(r,e=32,t,n=r.charCodeAt(0),i=r.length,p=I[n],f=r.toUpperCase()!==r,l,g)=>(e=pr[r]=!p&&pr[r]||e,I[n]=(C,w,y,S=u)=>(l=y,(y?r==y:(i<2||r.charCodeAt(1)===m.charCodeAt(u+1)&&(i<3||m.substr(u,i)==r))&&(!f||!d.id(m.charCodeAt(u+i)))&&(l=y=r))&&w<e&&(u+=i,(g=t(C))?fr(g,S):(u=S,l=0,!f&&!p&&!C&&k()),g)||p?.(C,w,l))),c=(r,e,t=!1)=>E(r,e,n=>n&&(i=>i&&[r,n,i])(A(e-(t?.5:0)))),a=(r,e,t)=>E(r,e,n=>t?n&&[r,n]:!n&&(n=A(e-.5))&&[r,n]),L=(r,e)=>E(r,200,t=>!t&&[,e]),Y=(r,e,t)=>E(r,e,(n,i)=>(i=A(e-(t?.5:0)),n?.[0]!==r&&(n=[r,n||null]),i?.[0]===r?n.push(...i.slice(1)):n.push(i||null),n)),U=(r,e)=>E(r[0],e,t=>!t&&[r,A(0,r.charCodeAt(1))||null]),Z=(r,e)=>E(r[0],e,t=>t&&[r,t,A(0,r.charCodeAt(1))||null]),T=(r,e,t,n=r.charCodeAt(0),i=r.length,p=I[n],f)=>I[n]=(l,g,C,w=u)=>!l&&(C?r==C:(i<2||m.substr(u,i)==r)&&(C=r))&&g<e&&!d.id(m.charCodeAt(u+i))&&(!d.prop||d.prop(u+i))&&(F(u+i),(f=t())?fr(f,w):F(w),f)||p?.(l,g,C);Object.defineProperty(d,"space",{configurable:!0,enumerable:!0,get:()=>N,set:r=>N=r});var V={},s=(r,e,t=V[r])=>V[r]=(...n)=>e(...n)||t?.(...n),o=r=>Array.isArray(r)?r[0]==null?(e=>()=>e)(r[1]):V[r[0]]?.(...r.slice(1))??k(`Unknown operator: ${r[0]}`,r?.loc):r===void 0?()=>{}:e=>e?.[r];var X=46,B=48,$=57,Dr=69,Fr=101,Gr=43,Xr=45,G=95,mr=110,$r=97,Qr=102,jr=65,Hr=70,cr=r=>r.indexOf("_")<0?r:r.replaceAll("_",""),q=r=>{let e=cr(v(t=>t===X&&m.charCodeAt(u+1)!==X||t>=B&&t<=$||t===G||((t===Dr||t===Fr)&&((t=m.charCodeAt(u+1))>=B&&t<=$||t===Gr||t===Xr)?2:0)));return m.charCodeAt(u)===mr?(h(),[,BigInt(e)]):(r=+e)!=r?k():[,r]},Kr={2:r=>r===48||r===49||r===G,8:r=>r>=48&&r<=55||r===G,16:r=>r>=B&&r<=$||r>=$r&&r<=Qr||r>=jr&&r<=Hr||r===G};d.number=null;I[X]=r=>!r&&m.charCodeAt(u+1)!==X&&q();for(let r=B;r<=$;r++)I[r]=e=>e?void 0:q();I[B]=r=>{if(r)return;let e=d.number;if(e){for(let[t,n]of Object.entries(e))if(t[0]==="0"&&m[u+1]?.toLowerCase()===t[1]){h(2);let i=cr(v(Kr[n]));return m.charCodeAt(u)===mr?(h(),[,BigInt("0"+t[1]+i)]):[,parseInt(i,n)]}}return q()};var Wr=92,dr=34,Ar=39,zr={n:`
5
- `,r:"\r",t:" ",b:"\b",f:"\f",v:"\v"},gr=r=>(e,t,n="")=>{if(!(e||!d.string?.[String.fromCharCode(r)]))return h(),v(i=>i-r&&(i===Wr?(n+=zr[m[u+1]]||m[u+1],2):(n+=m[u],1))),m[u]===String.fromCharCode(r)?h():k("Bad string"),[,n]};I[dr]=gr(dr);I[Ar]=gr(Ar);d.string={'"':!0};var Jr=20;"= += -= *= /= %= |= &= ^= >>= <<=".split(" ").map(r=>c(r,Jr,!0));var yr=(r,e,t,n)=>typeof r=="string"?i=>e(i,r,i):r[0]==="."?(t=o(r[1]),n=r[2],i=>e(t(i),n,i)):r[0]==="[]"&&r.length===3?(t=o(r[1]),n=o(r[2]),i=>e(t(i),n(i),i)):r[0]==="()"&&r.length===2?yr(r[1],e):(()=>{throw Error("Invalid assignment target")})(),hr={"=":(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 hr)s(r,(e,t)=>(t=o(t),yr(e,(n,i,p)=>hr[r](n,i,t(p)))));var Vr=30,Yr=40,Zr=140;a("!",Zr);c("||",Vr);c("&&",Yr);s("!",r=>(r=o(r),e=>!r(e)));s("||",(r,e)=>(r=o(r),e=o(e),t=>r(t)||e(t)));s("&&",(r,e)=>(r=o(r),e=o(e),t=>r(t)&&e(t)));var qr=50,xr=60,br=70,Cr=100,re=140;c("|",qr);c("&",br);c("^",xr);c(">>",Cr);c("<<",Cr);a("~",re);s("~",r=>(r=o(r),e=>~r(e)));s("|",(r,e)=>(r=o(r),e=o(e),t=>r(t)|e(t)));s("&",(r,e)=>(r=o(r),e=o(e),t=>r(t)&e(t)));s("^",(r,e)=>(r=o(r),e=o(e),t=>r(t)^e(t)));s(">>",(r,e)=>(r=o(r),e=o(e),t=>r(t)>>e(t)));s("<<",(r,e)=>(r=o(r),e=o(e),t=>r(t)<<e(t)));var Q=90;c("<",Q);c(">",Q);c("<=",Q);c(">=",Q);s(">",(r,e)=>(r=o(r),e=o(e),t=>r(t)>e(t)));s("<",(r,e)=>(r=o(r),e=o(e),t=>r(t)<e(t)));s(">=",(r,e)=>(r=o(r),e=o(e),t=>r(t)>=e(t)));s("<=",(r,e)=>(r=o(r),e=o(e),t=>r(t)<=e(t)));var Sr=80;c("==",Sr);c("!=",Sr);s("==",(r,e)=>(r=o(r),e=o(e),t=>r(t)==e(t)));s("!=",(r,e)=>(r=o(r),e=o(e),t=>r(t)!=e(t)));var Er=110,x=120,wr=140;c("+",Er);c("-",Er);c("*",x);c("/",x);c("%",x);a("+",wr);a("-",wr);s("+",(r,e)=>e!==void 0?(r=o(r),e=o(e),t=>r(t)+e(t)):(r=o(r),t=>+r(t)));s("-",(r,e)=>e!==void 0?(r=o(r),e=o(e),t=>r(t)-e(t)):(r=o(r),t=>-r(t)));s("*",(r,e)=>(r=o(r),e=o(e),t=>r(t)*e(t)));s("/",(r,e)=>(r=o(r),e=o(e),t=>r(t)/e(t)));s("%",(r,e)=>(r=o(r),e=o(e),t=>r(t)%e(t)));var j=150;E("++",j,r=>r?["++",r,null]:["++",A(j-1)]);E("--",j,r=>r?["--",r,null]:["--",A(j-1)]);var b=(r,e,t,n)=>typeof r=="string"?i=>e(i,r):r[0]==="."?(t=o(r[1]),n=r[2],i=>e(t(i),n)):r[0]==="[]"&&r.length===3?(t=o(r[1]),n=o(r[2]),i=>e(t(i),n(i))):r[0]==="()"&&r.length===2?b(r[1],e):(()=>{throw Error("Invalid increment target")})();s("++",(r,e)=>b(r,e===null?(t,n)=>t[n]++:(t,n)=>++t[n]));s("--",(r,e)=>b(r,e===null?(t,n)=>t[n]--:(t,n)=>--t[n]));var ee=5,te=10;Y(",",te);Y(";",ee,!0);var Ir=(...r)=>(r=r.map(o),e=>{let t;for(let n of r)t=n(e);return t});s(",",Ir);s(";",Ir);var ne=170;U("()",ne);var P=r=>r?.[0]==="_"&&r[1]==="_"||r==="constructor"||r==="prototype",rr=170;Z("[]",rr);c(".",rr);Z("()",rr);var H=r=>{throw Error(r)};s("[]",(r,e)=>e===void 0?(r=r?r[0]===","?r.slice(1):[r]:[],r=r.map(t=>t==null?(()=>{}):t[0]==="..."?(t=o(t[1]),n=>t(n)):(t=o(t),n=>[t(n)])),t=>r.flatMap(n=>n(t))):(e==null&&H("Missing index"),r=o(r),e=o(e),t=>{let n=e(t);return P(n)?void 0:r(t)[n]}));s(".",(r,e)=>(r=o(r),e=e[0]?e:e[1],P(e)?()=>{}:t=>r(t)[e]));s("()",(r,e)=>{if(e===void 0)return r==null?H("Empty ()"):o(r);let t=i=>i?.[0]===","&&i.slice(1).some(p=>p==null||t(p));t(e)&&H("Empty argument");let n=e?e[0]===","?(e=e.slice(1).map(o),i=>e.map(p=>p(i))):(e=o(e),i=>[e(i)]):()=>[];return er(r,(i,p,f)=>i[p](...n(f)))});var O=r=>typeof r=="string"||Array.isArray(r)&&(r[0]==="."||r[0]==="?."||r[0]==="[]"&&r.length===3||r[0]==="?.[]"||r[0]==="()"&&r.length===2&&O(r[1])||r[0]==="{}"),er=(r,e,t,n)=>r==null?H("Empty ()"):r[0]==="()"&&r.length==2?er(r[1],e):typeof r=="string"?i=>e(i,r,i):r[0]==="."?(t=o(r[1]),n=r[2],i=>e(t(i),n,i)):r[0]==="?."?(t=o(r[1]),n=r[2],i=>{let p=t(i);return p==null?void 0:e(p,n,i)}):r[0]==="[]"&&r.length===3?(t=o(r[1]),n=o(r[2]),i=>e(t(i),n(i),i)):r[0]==="?.[]"?(t=o(r[1]),n=o(r[2]),i=>{let p=t(i);return p==null?void 0:e(p,n(i),i)}):(r=o(r),i=>e([r(i)],0,i)),R=er;var ar=new WeakMap,oe=(r,...e)=>typeof r=="string"?o(d(r)):ar.get(r)||ar.set(r,ie(r,e)).get(r),Nr=57344,ie=(r,e)=>{let t=r.reduce((p,f,l)=>p+(l?String.fromCharCode(Nr+l-1):"")+f,""),n=d(t),i=p=>{if(typeof p=="string"&&p.length===1){let f=p.charCodeAt(0)-Nr,l;if(f>=0&&f<e.length)return l=e[f],se(l)?l:[,l]}return Array.isArray(p)?p.map(i):p};return o(i(n))},se=r=>typeof r=="string"||Array.isArray(r)&&(typeof r[0]=="string"||r[0]===void 0),pe=oe;var fe=32,le=d.space;d.comment??={"//":`
6
- `,"/*":"*/"};var tr;d.space=()=>{tr||(tr=Object.entries(d.comment).map(([i,p])=>[i,p,i.charCodeAt(0)]));for(var r;r=le();){for(var e=0,t;t=tr[e++];)if(r===t[2]&&m.substr(u,t[0].length)===t[0]){var n=u+t[0].length;if(t[1]===`
7
- `)for(;m.charCodeAt(n)>=fe;)n++;else{for(;m[n]&&m.substr(n,t[1].length)!==t[1];)n++;m[n]&&(n+=t[1].length)}F(n),r=0;break}if(r)return r}return r};var kr=80;c("===",kr);c("!==",kr);s("===",(r,e)=>(r=o(r),e=o(e),t=>r(t)===e(t)));s("!==",(r,e)=>(r=o(r),e=o(e),t=>r(t)!==e(t)));var ue=30;c("??",ue);s("??",(r,e)=>(r=o(r),e=o(e),t=>r(t)??e(t)));var me=130,ce=20;c("**",me,!0);c("**=",ce,!0);s("**",(r,e)=>(r=o(r),e=o(e),t=>r(t)**e(t)));var de=r=>{throw Error(r)};s("**=",(r,e)=>(O(r)||de("Invalid assignment target"),e=o(e),R(r,(t,n,i)=>t[n]**=e(i))));var vr=90;c("in",vr);c("of",vr);s("in",(r,e)=>(r=o(r),e=o(e),t=>r(t)in e(t)));var Ae=20,ge=100,he=r=>{throw Error(r)};c(">>>",ge);c(">>>=",Ae,!0);s(">>>",(r,e)=>(r=o(r),e=o(e),t=>r(t)>>>e(t)));s(">>>=",(r,e)=>(O(r)||he("Invalid assignment target"),e=o(e),R(r,(t,n,i)=>t[n]>>>=e(i))));var nr=5,ye=10,Ce=20,Se=r=>r[0]?.[0]===","?r[0].slice(1):r,M=(r,e,t)=>{if(typeof r=="string"){t[r]=e;return}let[n,...i]=r,p=Se(i);if(n==="{}"){let f=[];for(let l of p){if(Array.isArray(l)&&l[0]==="..."){let S={};for(let _ in e)f.includes(_)||(S[_]=e[_]);t[l[1]]=S;break}let g,C,w;typeof l=="string"?g=C=l:l[0]==="="?(typeof l[1]=="string"?g=C=l[1]:[,g,C]=l[1],w=l[2]):[,g,C]=l,f.push(g);let y=e[g];y===void 0&&w&&(y=o(w)(t)),M(C,y,t)}}else if(n==="[]"){let f=0;for(let l of p){if(l===null){f++;continue}if(Array.isArray(l)&&l[0]==="..."){t[l[1]]=e.slice(f);break}let g=l,C;Array.isArray(l)&&l[0]==="="&&([,g,C]=l);let w=e[f++];w===void 0&&C&&(w=o(C)(t)),M(g,w,t)}}},Or=r=>{let e=A(ye-1);return e?.[0]==="in"||e?.[0]==="of"?[e[0],[r,e[1]],e[2]]:e?.[0]===","?[r,...e.slice(1)]:[r,e]};T("let",nr+1,()=>Or("let"));T("const",nr+1,()=>Or("const"));T("var",nr,()=>(N(),["var",A(Ce)]));var Pr=(...r)=>(r=r.map(e=>{if(typeof e=="string")return t=>{t[e]=void 0};if(e[0]==="="){let[,t,n]=e,i=o(n);return typeof t=="string"?p=>{p[t]=i(p)}:p=>M(t,i(p),p)}return o(e)}),e=>{for(let t of r)t(e)});s("let",Pr);s("const",Pr);s("var",r=>typeof r=="string"?e=>{e[r]=void 0}:()=>{});var or=20,K=r=>{throw Error(r)};c("||=",or,!0);c("&&=",or,!0);c("??=",or,!0);s("=",(r,e)=>{if(Array.isArray(r)&&(r[0]==="let"||r[0]==="const"||r[0]==="var")){let t=r[1];return e=o(e),typeof t=="string"?n=>{n[t]=e(n)}:n=>M(t,e(n),n)}return O(r)||K("Invalid assignment target"),e=o(e),R(r,(t,n,i)=>t[n]=e(i))});s("||=",(r,e)=>(O(r)||K("Invalid assignment target"),e=o(e),R(r,(t,n,i)=>t[n]||=e(i))));s("&&=",(r,e)=>(O(r)||K("Invalid assignment target"),e=o(e),R(r,(t,n,i)=>t[n]&&=e(i))));s("??=",(r,e)=>(O(r)||K("Invalid assignment target"),e=o(e),R(r,(t,n,i)=>t[n]??=e(i))));L("true",!0);L("false",!1);L("null",null);T("undefined",200,()=>[]);L("NaN",NaN);L("Infinity",1/0);var ir=20;E("?",ir,(r,e,t)=>r&&(e=A(ir-1))&&v(n=>n===58)&&(t=A(ir-1),["?",r,e,t]));s("?",(r,e,t)=>(r=o(r),e=o(e),t=o(t),n=>r(n)?e(n):t(n)));var Ee=[],we=20;c("=>",we,!0);s("=>",(r,e)=>{r=r?.[0]==="()"?r[1]:r;let t=r?r[0]===","?r.slice(1):[r]:[],n=-1,i=null,p=t[t.length-1];Array.isArray(p)&&p[0]==="..."&&(n=t.length-1,i=p[1],t.length--);let f=e?.[0]==="{}";return e=o(f?["{",e[1]]:e),l=>(...g)=>{let C={};t.forEach((y,S)=>C[y]=g[S]),i&&(C[i]=g.slice(n));let w=new Proxy(C,{get:(y,S)=>S in y?y[S]:l?.[S],set:(y,S,_)=>((S in y?y:l)[S]=_,!0),has:(y,S)=>S in y||(l?S in l:!1)});try{let y=e(w);return f?void 0:y}catch(y){if(y===Ee)return y[0];throw y}}});var Ie=140;a("...",Ie);s("...",r=>(r=o(r),e=>Object.entries(r(e))));var Rr=170;E("?.",Rr,(r,e)=>{if(!r)return;let t=N();return t===40?(h(),["?.()",r,A(0,41)||null]):t===91?(h(),["?.[]",r,A(0,93)]):(e=A(Rr),e?["?.",r,e]:void 0)});s("?.",(r,e)=>(r=o(r),P(e)?()=>{}:t=>r(t)?.[e]));s("?.[]",(r,e)=>(r=o(r),e=o(e),t=>{let n=e(t);return P(n)?void 0:r(t)?.[n]}));s("?.()",(r,e)=>{let t=e?e[0]===","?(e=e.slice(1).map(o),i=>e.map(p=>p(i))):(e=o(e),i=>[e(i)]):()=>[];if(r[0]==="?."){let i=o(r[1]),p=r[2];return P(p)?()=>{}:f=>i(f)?.[p]?.(...t(f))}if(r[0]==="?.[]"){let i=o(r[1]),p=o(r[2]);return f=>{let l=i(f),g=p(f);return P(g)?void 0:l?.[g]?.(...t(f))}}if(r[0]==="."){let i=o(r[1]),p=r[2];return P(p)?()=>{}:f=>i(f)?.[p]?.(...t(f))}if(r[0]==="[]"&&r.length===3){let i=o(r[1]),p=o(r[2]);return f=>{let l=i(f),g=p(f);return P(g)?void 0:l?.[g]?.(...t(f))}}let n=o(r);return i=>n(i)?.(...t(i))});var D=140;a("typeof",D);a("void",D);a("delete",D);T("new",D,()=>ur(".target")?(h(7),["new.target"]):["new",A(D)]);s("typeof",r=>(r=o(r),e=>typeof r(e)));s("void",r=>(r=o(r),e=>(r(e),void 0)));s("delete",r=>{if(r[0]==="."){let e=o(r[1]),t=r[2];return n=>delete e(n)[t]}if(r[0]==="[]"){let e=o(r[1]),t=o(r[2]);return n=>delete e(n)[t(n)]}return()=>!0});s("new",r=>{let e=o(r?.[0]==="()"?r[1]:r),t=r?.[0]==="()"?r[2]:null,n=t?t[0]===","?(i=>p=>i.map(f=>f(p)))(t.slice(1).map(o)):(i=>p=>[i(p)])(o(t)):()=>[];return i=>new(e(i))(...n(i))});var W=Symbol("accessor"),sr=20,ae=40,Tr=41,Lr=123,_r=125,Ur=r=>e=>{if(e)return;N();let t=v(d.id);if(!t||(N(),m.charCodeAt(u)!==ae))return!1;h();let n=A(0,Tr);return N(),m.charCodeAt(u)!==Lr?!1:(h(),[r,t,n,A(0,_r)])};E("get",sr-1,Ur("get"));E("set",sr-1,Ur("set"));E("(",sr-1,r=>{if(!r||typeof r!="string")return;let e=A(0,Tr)||null;if(N(),m.charCodeAt(u)===Lr)return h(),[":",r,["=>",["()",e],A(0,_r)||null]]});s("get",(r,e)=>(e=e?o(e):()=>{},t=>[[W,r,{get:function(){let n=Object.create(t||{});return n.this=this,e(n)}}]]));s("set",(r,e,t)=>(t=t?o(t):()=>{},n=>[[W,r,{set:function(i){let p=Object.create(n||{});p.this=this,p[e]=i,t(p)}}]]));var Ne=20,Br=200;d.prop=r=>lr(r)!==58;var ke=r=>r==null||typeof r=="string"||[":",",","...","get","set"].includes(r[0]);U("[]",Br);U("{}",Br);c(":",Ne-1,!0);s("{}",(r,e)=>{if(e!==void 0)return;if(!ke(r))return o(["{",r]);r=r?r[0]!==","?[r]:r.slice(1):[];let t=r.map(n=>o(typeof n=="string"?[":",n,n]:n));return n=>{let i={},p={};for(let f of t.flatMap(l=>l(n)))if(f[0]===W){let[,l,g]=f;p[l]={...p[l],...g,configurable:!0,enumerable:!0}}else i[f[0]]=f[1];for(let f in p)Object.defineProperty(i,f,p[f]);return i}});s("{",r=>(r=r?o(r):()=>{},e=>r(Object.create(e))));s(":",(r,e)=>(e=o(e),Array.isArray(r)?(r=o(r),t=>[[r(t),e(t)]]):t=>[[r,e(t)]]));var ve=170,z=96,Oe=36,Pe=123,Re=92,Te={n:`
8
- `,r:"\r",t:" ",b:"\b",f:"\f",v:"\v"},Mr=()=>{let r=[];for(let e="",t;(t=m.charCodeAt(u))!==z;)t?t===Re?(h(),e+=Te[m[u]]||m[u],h()):t===Oe&&m.charCodeAt(u+1)===Pe?(e&&r.push([,e]),e="",h(2),r.push(A(0,125))):(e+=m[u],h(),t=m.charCodeAt(u),t===z&&e&&r.push([,e])):k("Unterminated template");return h(),r},Le=I[z];I[z]=(r,e)=>r&&e<ve?d.asi&&d.newline?void 0:(h(),["``",r,...Mr()]):r?Le?.(r,e):(h(),(t=>t.length<2&&t[0]?.[0]===void 0?t[0]||[,""]:["`",...t])(Mr()));s("`",(...r)=>(r=r.map(o),e=>r.map(t=>t(e)).join("")));s("``",(r,...e)=>{r=o(r);let t=[],n=[];for(let p of e)Array.isArray(p)&&p[0]===void 0?t.push(p[1]):n.push(o(p));let i=Object.assign([...t],{raw:t});return p=>r(p)(i,...n.map(f=>f(p)))});d.string["'"]=!0;d.number={"0x":16,"0b":2,"0o":8};export{Z as access,c as binary,o as compile,m as cur,pe as default,k as err,A as expr,U as group,_e as id,u as idx,T as keyword,L as literal,fr as loc,I as lookup,Y as nary,v as next,s as operator,V as operators,Ue as parens,d as parse,lr as peek,pr as prec,F as seek,h as skip,N as space,E as token,a as unary,ur as word};
1
+ var fr=r=>r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102,Fr=(r=f+2,e,t=0,n=0)=>{if(l.charCodeAt(f)!==92||l.charCodeAt(f+1)!==117)return 0;if(l.charCodeAt(r)===123){for(;fr(e=l.charCodeAt(++r));)t=t*16+(e<=57?e-48:(e&31)+9);return r>f+3&&t<=1114111&&l.charCodeAt(r)===125?r-f+1:0}for(;n<4&&fr(l.charCodeAt(r+n));)n++;return n===4?6:0},V,f,l,d=r=>(f=0,l=r,d.newline=!1,r=A(),l[f]?N():r||""),N=(r="Unexpected token",e=f,t=l.slice(0,e).split(`
2
+ `),n=t.pop(),i=l.slice(Math.max(0,e-40),e),p="\u032D",u=(l[e]||" ")+p,m=l.slice(e+1,e+20))=>{throw SyntaxError(`${r} at ${t.length+1}:${n.length+1}
3
+ ${l[e-41]!==`
4
+ `,""+i}${u}${m}`)},lr=(r,e=f)=>(Array.isArray(r)&&(r.loc=e),r),k=(r,e=f,t)=>{for(;t=r(l.charCodeAt(f))||r===d.id&&Fr();)f+=t;return l.slice(e,f)},h=(r=1)=>l[f+=r],B=r=>f=r,A=(r=0,e)=>{let t,n,i,p,u;for(e&&d.asi&&(d.newline=!1);(t=d.space())&&(u=d.newline,1)&&t!==e&&(i=(n&&t===91&&V&&d.asi?.(n,r,A)||null)??((p=a[t])&&p(n,r))??(n&&u&&d.asi?.(n,r,A))??(!n&&k(d.id)));)n=i;return e&&(t==e?(f++,e===125&&d.asi&&(d.newline=!0)):N("Unclosed "+String.fromCharCode(e-(e>42?2:1)))),n},R=(r,e=f)=>{for(V=!1;(r=l.charCodeAt(f))<=32;)d.asi&&r===10&&(d.newline=V=!0),f++;return r},mr=(r=f)=>{for(;l.charCodeAt(r)<=32;)r++;return l.charCodeAt(r)},_e=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,G=(r,e=r.length)=>l.substr(f,e)===r&&!d.id(l.charCodeAt(f+e)),Me=()=>(h(),A(0,41)),a=[],ur={},E=(r,e=32,t,n=r.charCodeAt(0),i=r.length,p=a[n],u=r.toUpperCase()!==r,m,g)=>(e=ur[r]=!p&&ur[r]||e,a[n]=(y,w,C,S=f)=>(m=C,(C?r==C:(i<2||r.charCodeAt(1)===l.charCodeAt(f+1)&&(i<3||l.substr(f,i)==r))&&(!u||!d.id(l.charCodeAt(f+i)))&&(m=C=r))&&w<e&&(f+=i,(g=t(y))?lr(g,S):(f=S,m=0,!u&&!p&&!y&&N()),g)||p?.(y,w,m))),c=(r,e,t=!1)=>E(r,e,n=>n&&(i=>i&&[r,n,i])(A(e-(t?.5:0)))),I=(r,e,t)=>E(r,e,n=>t?n&&[r,n]:!n&&(n=A(e-.5))&&[r,n]),T=(r,e)=>E(r,200,t=>!t&&[,e]),Z=(r,e,t)=>E(r,e,(n,i)=>(i=A(e-(t?.5:0)),n?.[0]!==r&&(n=[r,n||null]),i?.[0]===r?n.push(...i.slice(1)):n.push(i||null),n)),_=(r,e)=>E(r[0],e,t=>!t&&[r,A(0,r.charCodeAt(1))||null]),q=(r,e)=>E(r[0],e,t=>t&&[r,t,A(0,r.charCodeAt(1))||null]),L=(r,e,t,n=r.charCodeAt(0),i=r.length,p=a[n],u)=>a[n]=(m,g,y,w=f)=>!m&&(y?r==y:(i<2||l.substr(f,i)==r)&&(y=r))&&g<e&&!d.id(l.charCodeAt(f+i))&&(!d.prop||d.prop(f+i))&&(B(f+i),(u=t())?lr(u,w):B(w),u)||p?.(m,g,y);Object.defineProperty(d,"space",{configurable:!0,enumerable:!0,get:()=>R,set:r=>R=r});var Y={},s=(r,e,t=Y[r])=>Y[r]=(...n)=>e(...n)||t?.(...n),o=r=>Array.isArray(r)?r[0]==null?(e=>()=>e)(r[1]):Y[r[0]]?.(...r.slice(1))??N(`Unknown operator: ${r[0]}`,r?.loc):r===void 0?()=>{}:e=>e?.[r];var $=46,M=48,H=57,Gr=69,Xr=101,$r=43,Hr=45,X=95,cr=110,Qr=97,jr=102,Kr=65,Wr=70,dr=r=>r.indexOf("_")<0?r:r.replaceAll("_",""),x=r=>{let e=dr(k(t=>t===$&&l.charCodeAt(f+1)!==$||t>=M&&t<=H||t===X||((t===Gr||t===Xr)&&((t=l.charCodeAt(f+1))>=M&&t<=H||t===$r||t===Hr)?2:0)));return l.charCodeAt(f)===cr?(h(),[,BigInt(e)]):(r=+e)!=r?N():[,r]},zr={2:r=>r===48||r===49||r===X,8:r=>r>=48&&r<=55||r===X,16:r=>r>=M&&r<=H||r>=Qr&&r<=jr||r>=Kr&&r<=Wr||r===X};d.number=null;a[$]=r=>!r&&l.charCodeAt(f+1)!==$&&x();for(let r=M;r<=H;r++)a[r]=e=>e?void 0:x();a[M]=r=>{if(r)return;let e=d.number;if(e){for(let[t,n]of Object.entries(e))if(t[0]==="0"&&l[f+1]?.toLowerCase()===t[1]){h(2);let i=dr(k(zr[n]));return l.charCodeAt(f)===cr?(h(),[,BigInt("0"+t[1]+i)]):[,parseInt(i,n)]}}return x()};var Jr=92,Ar=34,gr=39,Vr={n:`
5
+ `,r:"\r",t:" ",b:"\b",f:"\f",v:"\v"},hr=r=>(e,t,n="")=>{if(!(e||!d.string?.[String.fromCharCode(r)]))return h(),k(i=>i-r&&(i===Jr?(n+=Vr[l[f+1]]||l[f+1],2):(n+=l[f],1))),l[f]===String.fromCharCode(r)?h():N("Bad string"),[,n]};a[Ar]=hr(Ar);a[gr]=hr(gr);d.string={'"':!0};var Yr=20;"= += -= *= /= %= |= &= ^= >>= <<=".split(" ").map(r=>c(r,Yr,!0));var yr=(r,e,t,n)=>typeof r=="string"?i=>e(i,r,i):r[0]==="."?(t=o(r[1]),n=r[2],i=>e(t(i),n,i)):r[0]==="[]"&&r.length===3?(t=o(r[1]),n=o(r[2]),i=>e(t(i),n(i),i)):r[0]==="()"&&r.length===2?yr(r[1],e):(()=>{throw Error("Invalid assignment target")})(),Cr={"=":(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 Cr)s(r,(e,t)=>(t=o(t),yr(e,(n,i,p)=>Cr[r](n,i,t(p)))));var Zr=30,qr=40,xr=140;I("!",xr);c("||",Zr);c("&&",qr);s("!",r=>(r=o(r),e=>!r(e)));s("||",(r,e)=>(r=o(r),e=o(e),t=>r(t)||e(t)));s("&&",(r,e)=>(r=o(r),e=o(e),t=>r(t)&&e(t)));var br=50,re=60,ee=70,Sr=100,te=140;c("|",br);c("&",ee);c("^",re);c(">>",Sr);c("<<",Sr);I("~",te);s("~",r=>(r=o(r),e=>~r(e)));s("|",(r,e)=>(r=o(r),e=o(e),t=>r(t)|e(t)));s("&",(r,e)=>(r=o(r),e=o(e),t=>r(t)&e(t)));s("^",(r,e)=>(r=o(r),e=o(e),t=>r(t)^e(t)));s(">>",(r,e)=>(r=o(r),e=o(e),t=>r(t)>>e(t)));s("<<",(r,e)=>(r=o(r),e=o(e),t=>r(t)<<e(t)));var Q=90;c("<",Q);c(">",Q);c("<=",Q);c(">=",Q);s(">",(r,e)=>(r=o(r),e=o(e),t=>r(t)>e(t)));s("<",(r,e)=>(r=o(r),e=o(e),t=>r(t)<e(t)));s(">=",(r,e)=>(r=o(r),e=o(e),t=>r(t)>=e(t)));s("<=",(r,e)=>(r=o(r),e=o(e),t=>r(t)<=e(t)));var Er=80;c("==",Er);c("!=",Er);s("==",(r,e)=>(r=o(r),e=o(e),t=>r(t)==e(t)));s("!=",(r,e)=>(r=o(r),e=o(e),t=>r(t)!=e(t)));var wr=110,b=120,ar=140;c("+",wr);c("-",wr);c("*",b);c("/",b);c("%",b);I("+",ar);I("-",ar);s("+",(r,e)=>e!==void 0?(r=o(r),e=o(e),t=>r(t)+e(t)):(r=o(r),t=>+r(t)));s("-",(r,e)=>e!==void 0?(r=o(r),e=o(e),t=>r(t)-e(t)):(r=o(r),t=>-r(t)));s("*",(r,e)=>(r=o(r),e=o(e),t=>r(t)*e(t)));s("/",(r,e)=>(r=o(r),e=o(e),t=>r(t)/e(t)));s("%",(r,e)=>(r=o(r),e=o(e),t=>r(t)%e(t)));var j=150;E("++",j,r=>r?["++",r,null]:["++",A(j-1)]);E("--",j,r=>r?["--",r,null]:["--",A(j-1)]);var rr=(r,e,t,n)=>typeof r=="string"?i=>e(i,r):r[0]==="."?(t=o(r[1]),n=r[2],i=>e(t(i),n)):r[0]==="[]"&&r.length===3?(t=o(r[1]),n=o(r[2]),i=>e(t(i),n(i))):r[0]==="()"&&r.length===2?rr(r[1],e):(()=>{throw Error("Invalid increment target")})();s("++",(r,e)=>rr(r,e===null?(t,n)=>t[n]++:(t,n)=>++t[n]));s("--",(r,e)=>rr(r,e===null?(t,n)=>t[n]--:(t,n)=>--t[n]));var ne=5,oe=10;Z(",",oe);Z(";",ne,!0);var Ir=(...r)=>(r=r.map(o),e=>{let t;for(let n of r)t=n(e);return t});s(",",Ir);s(";",Ir);var ie=170;_("()",ie);var O=r=>r?.[0]==="_"&&r[1]==="_"||r==="constructor"||r==="prototype",er=170;q("[]",er);c(".",er);q("()",er);var K=r=>{throw Error(r)};s("[]",(r,e)=>e===void 0?(r=r?r[0]===","?r.slice(1):[r]:[],r=r.map(t=>t==null?(()=>{}):t[0]==="..."?(t=o(t[1]),n=>t(n)):(t=o(t),n=>[t(n)])),t=>r.flatMap(n=>n(t))):(e==null&&K("Missing index"),r=o(r),e=o(e),t=>{let n=e(t);return O(n)?void 0:r(t)[n]}));s(".",(r,e)=>(r=o(r),e=e[0]?e:e[1],O(e)?()=>{}:t=>r(t)[e]));s("()",(r,e)=>{if(e===void 0)return r==null?K("Empty ()"):o(r);let t=i=>i?.[0]===","&&i.slice(1).some(p=>p==null||t(p));t(e)&&K("Empty argument");let n=e?e[0]===","?(e=e.slice(1).map(o),i=>e.map(p=>p(i))):(e=o(e),i=>[e(i)]):()=>[];return tr(r,(i,p,u)=>i[p](...n(u)))});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,e,t,n)=>r==null?K("Empty ()"):r[0]==="()"&&r.length==2?tr(r[1],e):typeof r=="string"?i=>e(i,r,i):r[0]==="."?(t=o(r[1]),n=r[2],i=>e(t(i),n,i)):r[0]==="?."?(t=o(r[1]),n=r[2],i=>{let p=t(i);return p==null?void 0:e(p,n,i)}):r[0]==="[]"&&r.length===3?(t=o(r[1]),n=o(r[2]),i=>e(t(i),n(i),i)):r[0]==="?.[]"?(t=o(r[1]),n=o(r[2]),i=>{let p=t(i);return p==null?void 0:e(p,n(i),i)}):(r=o(r),i=>e([r(i)],0,i)),P=tr;var Rr=new WeakMap,se=(r,...e)=>typeof r=="string"?o(d(r)):Rr.get(r)||Rr.set(r,pe(r,e)).get(r),Nr=57344,pe=(r,e)=>{let t=r.reduce((p,u,m)=>p+(m?String.fromCharCode(Nr+m-1):"")+u,""),n=d(t),i=p=>{if(typeof p=="string"&&p.length===1){let u=p.charCodeAt(0)-Nr,m;if(u>=0&&u<e.length)return m=e[u],fe(m)?m:[,m]}return Array.isArray(p)?p.map(i):p};return o(i(n))},fe=r=>typeof r=="string"||Array.isArray(r)&&(typeof r[0]=="string"||r[0]===void 0),ue=se;var le=32,me=d.space;d.comment??={"//":`
6
+ `,"/*":"*/"};var nr;d.space=()=>{nr||(nr=Object.entries(d.comment).map(([i,p])=>[i,p,i.charCodeAt(0)]));for(var r;r=me();){for(var e=0,t;t=nr[e++];)if(r===t[2]&&l.substr(f,t[0].length)===t[0]){var n=f+t[0].length;if(t[1]===`
7
+ `)for(;l.charCodeAt(n)>=le;)n++;else{for(;l[n]&&l.substr(n,t[1].length)!==t[1];)n++;l[n]&&(n+=t[1].length)}B(n),r=0;break}if(r)return r}return r};var kr=80;c("===",kr);c("!==",kr);s("===",(r,e)=>(r=o(r),e=o(e),t=>r(t)===e(t)));s("!==",(r,e)=>(r=o(r),e=o(e),t=>r(t)!==e(t)));var ce=30;c("??",ce);s("??",(r,e)=>(r=o(r),e=o(e),t=>r(t)??e(t)));var de=130,Ae=20;c("**",de,!0);c("**=",Ae,!0);s("**",(r,e)=>(r=o(r),e=o(e),t=>r(t)**e(t)));var ge=r=>{throw Error(r)};s("**=",(r,e)=>(v(r)||ge("Invalid assignment target"),e=o(e),P(r,(t,n,i)=>t[n]**=e(i))));var vr=90;c("in",vr);c("of",vr);s("in",(r,e)=>(r=o(r),e=o(e),t=>r(t)in e(t)));var he=20,Ce=100,ye=r=>{throw Error(r)};c(">>>",Ce);c(">>>=",he,!0);s(">>>",(r,e)=>(r=o(r),e=o(e),t=>r(t)>>>e(t)));s(">>>=",(r,e)=>(v(r)||ye("Invalid assignment target"),e=o(e),P(r,(t,n,i)=>t[n]>>>=e(i))));var or=5,Se=10,Ee=20,we=r=>r[0]?.[0]===","?r[0].slice(1):r,D=(r,e,t)=>{if(typeof r=="string"){t[r]=e;return}let[n,...i]=r,p=we(i);if(n==="{}"){let u=[];for(let m of p){if(Array.isArray(m)&&m[0]==="..."){let S={};for(let U in e)u.includes(U)||(S[U]=e[U]);t[m[1]]=S;break}let g,y,w;typeof m=="string"?g=y=m:m[0]==="="?(typeof m[1]=="string"?g=y=m[1]:[,g,y]=m[1],w=m[2]):[,g,y]=m,u.push(g);let C=e[g];C===void 0&&w&&(C=o(w)(t)),D(y,C,t)}}else if(n==="[]"){let u=0;for(let m of p){if(m===null){u++;continue}if(Array.isArray(m)&&m[0]==="..."){t[m[1]]=e.slice(u);break}let g=m,y;Array.isArray(m)&&m[0]==="="&&([,g,y]=m);let w=e[u++];w===void 0&&y&&(w=o(y)(t)),D(g,w,t)}}},Or=r=>{if(r==="let"){let t=f;if(R(),G("in")){B(t);return}B(t)}let e=A(Se-1);return e?.[0]==="in"||e?.[0]==="of"?[e[0],[r,e[1]],e[2]]:e?.[0]===","?[r,...e.slice(1)]:[r,e]};L("let",or+1,()=>Or("let"));L("const",or+1,()=>Or("const"));L("var",or,()=>(R(),["var",A(Ee)]));var Pr=(...r)=>(r=r.map(e=>{if(typeof e=="string")return t=>{t[e]=void 0};if(e[0]==="="){let[,t,n]=e,i=o(n);return typeof t=="string"?p=>{p[t]=i(p)}:p=>D(t,i(p),p)}return o(e)}),e=>{for(let t of r)t(e)});s("let",Pr);s("const",Pr);s("var",r=>typeof r=="string"?e=>{e[r]=void 0}:()=>{});var ir=20,W=r=>{throw Error(r)};c("||=",ir,!0);c("&&=",ir,!0);c("??=",ir,!0);s("=",(r,e)=>{if(Array.isArray(r)&&(r[0]==="let"||r[0]==="const"||r[0]==="var")){let t=r[1];return e=o(e),typeof t=="string"?n=>{n[t]=e(n)}:n=>D(t,e(n),n)}return v(r)||W("Invalid assignment target"),e=o(e),P(r,(t,n,i)=>t[n]=e(i))});s("||=",(r,e)=>(v(r)||W("Invalid assignment target"),e=o(e),P(r,(t,n,i)=>t[n]||=e(i))));s("&&=",(r,e)=>(v(r)||W("Invalid assignment target"),e=o(e),P(r,(t,n,i)=>t[n]&&=e(i))));s("??=",(r,e)=>(v(r)||W("Invalid assignment target"),e=o(e),P(r,(t,n,i)=>t[n]??=e(i))));T("true",!0);T("false",!1);T("null",null);L("undefined",200,()=>[]);T("NaN",NaN);T("Infinity",1/0);var sr=20;E("?",sr,(r,e,t)=>r&&(e=A(sr-1))&&k(n=>n===58)&&(t=A(sr-1),["?",r,e,t]));s("?",(r,e,t)=>(r=o(r),e=o(e),t=o(t),n=>r(n)?e(n):t(n)));var ae=[],Ie=20;c("=>",Ie,!0);s("=>",(r,e)=>{r=r?.[0]==="()"?r[1]:r;let t=r?r[0]===","?r.slice(1):[r]:[],n=-1,i=null,p=t[t.length-1];Array.isArray(p)&&p[0]==="..."&&(n=t.length-1,i=p[1],t.length--);let u=e?.[0]==="{}";return e=o(u?["{",e[1]]:e),m=>(...g)=>{let y={};t.forEach((C,S)=>y[C]=g[S]),i&&(y[i]=g.slice(n));let w=new Proxy(y,{get:(C,S)=>S in C?C[S]:m?.[S],set:(C,S,U)=>((S in C?C:m)[S]=U,!0),has:(C,S)=>S in C||(m?S in m:!1)});try{let C=e(w);return u?void 0:C}catch(C){if(C===ae)return C[0];throw C}}});var Re=140;I("...",Re);s("...",r=>(r=o(r),e=>Object.entries(r(e))));var Lr=170;E("?.",Lr,(r,e)=>{if(!r)return;let t=R();return t===40?(h(),["?.()",r,A(0,41)||null]):t===91?(h(),["?.[]",r,A(0,93)]):(e=A(Lr),e?["?.",r,e]:void 0)});s("?.",(r,e)=>(r=o(r),O(e)?()=>{}:t=>r(t)?.[e]));s("?.[]",(r,e)=>(r=o(r),e=o(e),t=>{let n=e(t);return O(n)?void 0:r(t)?.[n]}));s("?.()",(r,e)=>{let t=e?e[0]===","?(e=e.slice(1).map(o),i=>e.map(p=>p(i))):(e=o(e),i=>[e(i)]):()=>[];if(r[0]==="?."){let i=o(r[1]),p=r[2];return O(p)?()=>{}:u=>i(u)?.[p]?.(...t(u))}if(r[0]==="?.[]"){let i=o(r[1]),p=o(r[2]);return u=>{let m=i(u),g=p(u);return O(g)?void 0:m?.[g]?.(...t(u))}}if(r[0]==="."){let i=o(r[1]),p=r[2];return O(p)?()=>{}:u=>i(u)?.[p]?.(...t(u))}if(r[0]==="[]"&&r.length===3){let i=o(r[1]),p=o(r[2]);return u=>{let m=i(u),g=p(u);return O(g)?void 0:m?.[g]?.(...t(u))}}let n=o(r);return i=>n(i)?.(...t(i))});var F=140;I("typeof",F);I("void",F);I("delete",F);L("new",F,()=>G(".target")?(h(7),["new.target"]):["new",A(F)]);s("typeof",r=>(r=o(r),e=>typeof r(e)));s("void",r=>(r=o(r),e=>(r(e),void 0)));s("delete",r=>{if(r[0]==="."){let e=o(r[1]),t=r[2];return n=>delete e(n)[t]}if(r[0]==="[]"){let e=o(r[1]),t=o(r[2]);return n=>delete e(n)[t(n)]}return()=>!0});s("new",r=>{let e=o(r?.[0]==="()"?r[1]:r),t=r?.[0]==="()"?r[2]:null,n=t?t[0]===","?(i=>p=>i.map(u=>u(p)))(t.slice(1).map(o)):(i=>p=>[i(p)])(o(t)):()=>[];return i=>new(e(i))(...n(i))});var z=Symbol("accessor"),pr=20,Ne=40,Br=41,Tr=123,Ur=125,_r=r=>e=>{if(e)return;R();let t=k(d.id);if(!t||(R(),l.charCodeAt(f)!==Ne))return!1;h();let n=A(0,Br);return R(),l.charCodeAt(f)!==Tr?!1:(h(),[r,t,n,A(0,Ur)])};E("get",pr-1,_r("get"));E("set",pr-1,_r("set"));E("(",pr-1,r=>{if(!r||typeof r!="string")return;let e=A(0,Br)||null;if(R(),l.charCodeAt(f)===Tr)return h(),[":",r,["=>",["()",e],A(0,Ur)||null]]});s("get",(r,e)=>(e=e?o(e):()=>{},t=>[[z,r,{get:function(){let n=Object.create(t||{});return n.this=this,e(n)}}]]));s("set",(r,e,t)=>(t=t?o(t):()=>{},n=>[[z,r,{set:function(i){let p=Object.create(n||{});p.this=this,p[e]=i,t(p)}}]]));var ke=20,Mr=200;d.prop=r=>mr(r)!==58;var ve=r=>r==null||typeof r=="string"||[":",",","...","get","set"].includes(r[0]);_("[]",Mr);_("{}",Mr);c(":",ke-1,!0);s("{}",(r,e)=>{if(e!==void 0)return;if(!ve(r))return o(["{",r]);r=r?r[0]!==","?[r]:r.slice(1):[];let t=r.map(n=>o(typeof n=="string"?[":",n,n]:n));return n=>{let i={},p={};for(let u of t.flatMap(m=>m(n)))if(u[0]===z){let[,m,g]=u;p[m]={...p[m],...g,configurable:!0,enumerable:!0}}else i[u[0]]=u[1];for(let u in p)Object.defineProperty(i,u,p[u]);return i}});s("{",r=>(r=r?o(r):()=>{},e=>r(Object.create(e))));s(":",(r,e)=>(e=o(e),Array.isArray(r)?(r=o(r),t=>[[r(t),e(t)]]):t=>[[r,e(t)]]));var Oe=170,J=96,Pe=36,Le=123,Be=92,Te={n:`
8
+ `,r:"\r",t:" ",b:"\b",f:"\f",v:"\v"},Dr=()=>{let r=[];for(let e="",t;(t=l.charCodeAt(f))!==J;)t?t===Be?(h(),e+=Te[l[f]]||l[f],h()):t===Pe&&l.charCodeAt(f+1)===Le?(e&&r.push([,e]),e="",h(2),r.push(A(0,125))):(e+=l[f],h(),t=l.charCodeAt(f),t===J&&e&&r.push([,e])):N("Unterminated template");return h(),r},Ue=a[J];a[J]=(r,e)=>r&&e<Oe?d.asi&&d.newline?void 0:(h(),["``",r,...Dr()]):r?Ue?.(r,e):(h(),(t=>t.length<2&&t[0]?.[0]===void 0?t[0]||[,""]:["`",...t])(Dr()));s("`",(...r)=>(r=r.map(o),e=>r.map(t=>t(e)).join("")));s("``",(r,...e)=>{r=o(r);let t=[],n=[];for(let p of e)Array.isArray(p)&&p[0]===void 0?t.push(p[1]):n.push(o(p));let i=Object.assign([...t],{raw:t});return p=>r(p)(i,...n.map(u=>u(p)))});d.string["'"]=!0;d.number={"0x":16,"0b":2,"0o":8};export{q as access,c as binary,o as compile,l as cur,ue as default,N as err,A as expr,_ as group,_e as id,f as idx,L as keyword,T as literal,lr as loc,a as lookup,Z as nary,k as next,s as operator,Y as operators,Me as parens,d as parse,mr as peek,ur as prec,B as seek,h as skip,R as space,E as token,I as unary,G as word};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "subscript",
3
- "version": "10.3.3",
3
+ "version": "10.3.4",
4
4
  "description": "Modular expression parser & evaluator",
5
5
  "main": "subscript.js",
6
6
  "module": "subscript.js",
package/parse.js CHANGED
@@ -1,6 +1,21 @@
1
1
  // Pratt parser core + operator registry + compile
2
2
  // Character codes
3
- const SPACE = 32;
3
+ const SPACE = 32, BSLASH = 92, U = 117, LBRACE = 123, RBRACE = 125;
4
+
5
+ const hex = c =>
6
+ (c >= 48 && c <= 57) ||
7
+ (c >= 65 && c <= 70) ||
8
+ (c >= 97 && c <= 102),
9
+
10
+ uesc = (n = idx + 2, c, cp = 0, i = 0) => {
11
+ if (cur.charCodeAt(idx) !== BSLASH || cur.charCodeAt(idx + 1) !== U) return 0;
12
+ if (cur.charCodeAt(n) === LBRACE) {
13
+ while (hex(c = cur.charCodeAt(++n))) cp = cp * 16 + (c <= 57 ? c - 48 : (c & 31) + 9);
14
+ return n > idx + 3 && cp <= 0x10ffff && cur.charCodeAt(n) === RBRACE ? n - idx + 1 : 0;
15
+ }
16
+ while (i < 4 && hex(cur.charCodeAt(n + i))) i++;
17
+ return i === 4 ? 6 : 0;
18
+ };
4
19
 
5
20
  let lineBreak;
6
21
 
@@ -27,7 +42,7 @@ export let idx, cur,
27
42
 
28
43
  // advance until condition meets
29
44
  next = (is, from = idx, l) => {
30
- while (l = is(cur.charCodeAt(idx))) idx += l;
45
+ while (l = is(cur.charCodeAt(idx)) || (is === parse.id && uesc())) idx += l;
31
46
  return cur.slice(from, idx);
32
47
  },
33
48
 
package/subscript.min.js CHANGED
@@ -1,5 +1,5 @@
1
- var N,s,u,m=r=>(s=0,u=r,m.newline=!1,r=c(),u[s]?y():r||""),y=(r="Unexpected token",e=s,t=u.slice(0,e).split(`
2
- `),n=t.pop(),o=u.slice(Math.max(0,e-40),e),p="\u032D",d=(u[e]||" ")+p,A=u.slice(e+1,e+20))=>{throw SyntaxError(`${r} at ${t.length+1}:${n.length+1}
3
- ${u[e-41]!==`
4
- `,""+o}${d}${A}`)},J=(r,e=s)=>(Array.isArray(r)&&(r.loc=e),r),_=(r,e=s,t)=>{for(;t=r(u.charCodeAt(s));)s+=t;return u.slice(e,s)},S=(r=1)=>u[s+=r],G=r=>s=r,c=(r=0,e)=>{let t,n,o,p,d;for(e&&m.asi&&(m.newline=!1);(t=m.space())&&(d=m.newline,1)&&t!==e&&(o=(n&&t===91&&N&&m.asi?.(n,r,c)||null)??((p=h[t])&&p(n,r))??(n&&d&&m.asi?.(n,r,c))??(!n&&_(m.id)));)n=o;return e&&(t==e?(s++,e===125&&m.asi&&(m.newline=!0)):y("Unclosed "+String.fromCharCode(e-(e>42?2:1)))),n},W=(r,e=s)=>{for(N=!1;(r=u.charCodeAt(s))<=32;)m.asi&&r===10&&(m.newline=N=!0),s++;return r},$r=(r=s)=>{for(;u.charCodeAt(r)<=32;)r++;return u.charCodeAt(r)},Fr=m.id=r=>r>=48&&r<=57||r>=65&&r<=90||r>=97&&r<=122||r==36||r==95||r>=192&&r!=215&&r!=247,Or=(r,e=r.length)=>u.substr(s,e)===r&&!m.id(u.charCodeAt(s+e)),Br=()=>(S(),c(0,41)),h=[],z={},g=(r,e=32,t,n=r.charCodeAt(0),o=r.length,p=h[n],d=r.toUpperCase()!==r,A,w)=>(e=z[r]=!p&&z[r]||e,h[n]=(C,I,T,v=s)=>(A=T,(T?r==T:(o<2||r.charCodeAt(1)===u.charCodeAt(s+1)&&(o<3||u.substr(s,o)==r))&&(!d||!m.id(u.charCodeAt(s+o)))&&(A=T=r))&&I<e&&(s+=o,(w=t(C))?J(w,v):(s=v,A=0,!d&&!p&&!C&&y()),w)||p?.(C,I,A))),f=(r,e,t=!1)=>g(r,e,n=>n&&(o=>o&&[r,n,o])(c(e-(t?.5:0)))),E=(r,e,t)=>g(r,e,n=>t?n&&[r,n]:!n&&(n=c(e-.5))&&[r,n]),Xr=(r,e)=>g(r,200,t=>!t&&[,e]),F=(r,e,t)=>g(r,e,(n,o)=>(o=c(e-(t?.5:0)),n?.[0]!==r&&(n=[r,n||null]),o?.[0]===r?n.push(...o.slice(1)):n.push(o||null),n)),K=(r,e)=>g(r[0],e,t=>!t&&[r,c(0,r.charCodeAt(1))||null]),O=(r,e)=>g(r[0],e,t=>t&&[r,t,c(0,r.charCodeAt(1))||null]),Qr=(r,e,t,n=r.charCodeAt(0),o=r.length,p=h[n],d)=>h[n]=(A,w,C,I=s)=>!A&&(C?r==C:(o<2||u.substr(s,o)==r)&&(C=r))&&w<e&&!m.id(u.charCodeAt(s+o))&&(!m.prop||m.prop(s+o))&&(G(s+o),(d=t())?J(d,I):G(I),d)||p?.(A,w,C);Object.defineProperty(m,"space",{configurable:!0,enumerable:!0,get:()=>W,set:r=>W=r});var $={},l=(r,e,t=$[r])=>$[r]=(...n)=>e(...n)||t?.(...n),i=r=>Array.isArray(r)?r[0]==null?(e=>()=>e)(r[1]):$[r[0]]?.(...r.slice(1))??y(`Unknown operator: ${r[0]}`,r?.loc):r===void 0?()=>{}:e=>e?.[r];var R=46,P=48,k=57,pr=69,ur=101,mr=43,fr=45,U=95,V=110,dr=97,Ar=102,cr=65,hr=70,Y=r=>r.indexOf("_")<0?r:r.replaceAll("_",""),B=r=>{let e=Y(_(t=>t===R&&u.charCodeAt(s+1)!==R||t>=P&&t<=k||t===U||((t===pr||t===ur)&&((t=u.charCodeAt(s+1))>=P&&t<=k||t===mr||t===fr)?2:0)));return u.charCodeAt(s)===V?(S(),[,BigInt(e)]):(r=+e)!=r?y():[,r]},gr={2:r=>r===48||r===49||r===U,8:r=>r>=48&&r<=55||r===U,16:r=>r>=P&&r<=k||r>=dr&&r<=Ar||r>=cr&&r<=hr||r===U};m.number=null;h[R]=r=>!r&&u.charCodeAt(s+1)!==R&&B();for(let r=P;r<=k;r++)h[r]=e=>e?void 0:B();h[P]=r=>{if(r)return;let e=m.number;if(e){for(let[t,n]of Object.entries(e))if(t[0]==="0"&&u[s+1]?.toLowerCase()===t[1]){S(2);let o=Y(_(gr[n]));return u.charCodeAt(s)===V?(S(),[,BigInt("0"+t[1]+o)]):[,parseInt(o,n)]}}return B()};var Cr=92,Z=34,q=39,yr={n:`
5
- `,r:"\r",t:" ",b:"\b",f:"\f",v:"\v"},x=r=>(e,t,n="")=>{if(!(e||!m.string?.[String.fromCharCode(r)]))return S(),_(o=>o-r&&(o===Cr?(n+=yr[u[s+1]]||u[s+1],2):(n+=u[s],1))),u[s]===String.fromCharCode(r)?S():y("Bad string"),[,n]};h[Z]=x(Z);h[q]=x(q);m.string={'"':!0};var Sr=20;"= += -= *= /= %= |= &= ^= >>= <<=".split(" ").map(r=>f(r,Sr,!0));var a=(r,e,t,n)=>typeof r=="string"?o=>e(o,r,o):r[0]==="."?(t=i(r[1]),n=r[2],o=>e(t(o),n,o)):r[0]==="[]"&&r.length===3?(t=i(r[1]),n=i(r[2]),o=>e(t(o),n(o),o)):r[0]==="()"&&r.length===2?a(r[1],e):(()=>{throw Error("Invalid assignment target")})(),j={"=":(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 j)l(r,(e,t)=>(t=i(t),a(e,(n,o,p)=>j[r](n,o,t(p)))));var Er=30,wr=40,_r=140;E("!",_r);f("||",Er);f("&&",wr);l("!",r=>(r=i(r),e=>!r(e)));l("||",(r,e)=>(r=i(r),e=i(e),t=>r(t)||e(t)));l("&&",(r,e)=>(r=i(r),e=i(e),t=>r(t)&&e(t)));var Ir=50,Pr=60,Tr=70,b=100,Ur=140;f("|",Ir);f("&",Tr);f("^",Pr);f(">>",b);f("<<",b);E("~",Ur);l("~",r=>(r=i(r),e=>~r(e)));l("|",(r,e)=>(r=i(r),e=i(e),t=>r(t)|e(t)));l("&",(r,e)=>(r=i(r),e=i(e),t=>r(t)&e(t)));l("^",(r,e)=>(r=i(r),e=i(e),t=>r(t)^e(t)));l(">>",(r,e)=>(r=i(r),e=i(e),t=>r(t)>>e(t)));l("<<",(r,e)=>(r=i(r),e=i(e),t=>r(t)<<e(t)));var D=90;f("<",D);f(">",D);f("<=",D);f(">=",D);l(">",(r,e)=>(r=i(r),e=i(e),t=>r(t)>e(t)));l("<",(r,e)=>(r=i(r),e=i(e),t=>r(t)<e(t)));l(">=",(r,e)=>(r=i(r),e=i(e),t=>r(t)>=e(t)));l("<=",(r,e)=>(r=i(r),e=i(e),t=>r(t)<=e(t)));var rr=80;f("==",rr);f("!=",rr);l("==",(r,e)=>(r=i(r),e=i(e),t=>r(t)==e(t)));l("!=",(r,e)=>(r=i(r),e=i(e),t=>r(t)!=e(t)));var er=110,X=120,tr=140;f("+",er);f("-",er);f("*",X);f("/",X);f("%",X);E("+",tr);E("-",tr);l("+",(r,e)=>e!==void 0?(r=i(r),e=i(e),t=>r(t)+e(t)):(r=i(r),t=>+r(t)));l("-",(r,e)=>e!==void 0?(r=i(r),e=i(e),t=>r(t)-e(t)):(r=i(r),t=>-r(t)));l("*",(r,e)=>(r=i(r),e=i(e),t=>r(t)*e(t)));l("/",(r,e)=>(r=i(r),e=i(e),t=>r(t)/e(t)));l("%",(r,e)=>(r=i(r),e=i(e),t=>r(t)%e(t)));var M=150;g("++",M,r=>r?["++",r,null]:["++",c(M-1)]);g("--",M,r=>r?["--",r,null]:["--",c(M-1)]);var Q=(r,e,t,n)=>typeof r=="string"?o=>e(o,r):r[0]==="."?(t=i(r[1]),n=r[2],o=>e(t(o),n)):r[0]==="[]"&&r.length===3?(t=i(r[1]),n=i(r[2]),o=>e(t(o),n(o))):r[0]==="()"&&r.length===2?Q(r[1],e):(()=>{throw Error("Invalid increment target")})();l("++",(r,e)=>Q(r,e===null?(t,n)=>t[n]++:(t,n)=>++t[n]));l("--",(r,e)=>Q(r,e===null?(t,n)=>t[n]--:(t,n)=>--t[n]));var Rr=5,kr=10;F(",",kr);F(";",Rr,!0);var nr=(...r)=>(r=r.map(i),e=>{let t;for(let n of r)t=n(e);return t});l(",",nr);l(";",nr);var Dr=170;K("()",Dr);var or=r=>r?.[0]==="_"&&r[1]==="_"||r==="constructor"||r==="prototype",H=170;O("[]",H);f(".",H);O("()",H);var L=r=>{throw Error(r)};l("[]",(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]),n=>t(n)):(t=i(t),n=>[t(n)])),t=>r.flatMap(n=>n(t))):(e==null&&L("Missing index"),r=i(r),e=i(e),t=>{let n=e(t);return or(n)?void 0:r(t)[n]}));l(".",(r,e)=>(r=i(r),e=e[0]?e:e[1],or(e)?()=>{}:t=>r(t)[e]));l("()",(r,e)=>{if(e===void 0)return r==null?L("Empty ()"):i(r);let t=o=>o?.[0]===","&&o.slice(1).some(p=>p==null||t(p));t(e)&&L("Empty argument");let n=e?e[0]===","?(e=e.slice(1).map(i),o=>e.map(p=>p(o))):(e=i(e),o=>[e(o)]):()=>[];return ir(r,(o,p,d)=>o[p](...n(d)))});var ir=(r,e,t,n)=>r==null?L("Empty ()"):r[0]==="()"&&r.length==2?ir(r[1],e):typeof r=="string"?o=>e(o,r,o):r[0]==="."?(t=i(r[1]),n=r[2],o=>e(t(o),n,o)):r[0]==="?."?(t=i(r[1]),n=r[2],o=>{let p=t(o);return p==null?void 0:e(p,n,o)}):r[0]==="[]"&&r.length===3?(t=i(r[1]),n=i(r[2]),o=>e(t(o),n(o),o)):r[0]==="?.[]"?(t=i(r[1]),n=i(r[2]),o=>{let p=t(o);return p==null?void 0:e(p,n(o),o)}):(r=i(r),o=>e([r(o)],0,o));var sr=new WeakMap,Mr=(r,...e)=>typeof r=="string"?i(m(r)):sr.get(r)||sr.set(r,Lr(r,e)).get(r),lr=57344,Lr=(r,e)=>{let t=r.reduce((p,d,A)=>p+(A?String.fromCharCode(lr+A-1):"")+d,""),n=m(t),o=p=>{if(typeof p=="string"&&p.length===1){let d=p.charCodeAt(0)-lr,A;if(d>=0&&d<e.length)return A=e[d],Nr(A)?A:[,A]}return Array.isArray(p)?p.map(o):p};return i(o(n))},Nr=r=>typeof r=="string"||Array.isArray(r)&&(typeof r[0]=="string"||r[0]===void 0),Ae=Mr;export{O as access,f as binary,i as compile,u as cur,Ae as default,y as err,c as expr,K as group,Fr as id,s as idx,Qr as keyword,Xr as literal,J as loc,h as lookup,F as nary,_ as next,l as operator,$ as operators,Br as parens,m as parse,$r as peek,z as prec,G as seek,S as skip,W as space,g as token,E as unary,Or as word};
1
+ var G=r=>r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102,pr=(r=s+2,e,t=0,o=0)=>{if(l.charCodeAt(s)!==92||l.charCodeAt(s+1)!==117)return 0;if(l.charCodeAt(r)===123){for(;G(e=l.charCodeAt(++r));)t=t*16+(e<=57?e-48:(e&31)+9);return r>s+3&&t<=1114111&&l.charCodeAt(r)===125?r-s+1:0}for(;o<4&&G(l.charCodeAt(r+o));)o++;return o===4?6:0},M,s,l,m=r=>(s=0,l=r,m.newline=!1,r=h(),l[s]?y():r||""),y=(r="Unexpected token",e=s,t=l.slice(0,e).split(`
2
+ `),o=t.pop(),n=l.slice(Math.max(0,e-40),e),p="\u032D",A=(l[e]||" ")+p,d=l.slice(e+1,e+20))=>{throw SyntaxError(`${r} at ${t.length+1}:${o.length+1}
3
+ ${l[e-41]!==`
4
+ `,""+n}${A}${d}`)},K=(r,e=s)=>(Array.isArray(r)&&(r.loc=e),r),R=(r,e=s,t)=>{for(;t=r(l.charCodeAt(s))||r===m.id&&pr();)s+=t;return l.slice(e,s)},S=(r=1)=>l[s+=r],W=r=>s=r,h=(r=0,e)=>{let t,o,n,p,A;for(e&&m.asi&&(m.newline=!1);(t=m.space())&&(A=m.newline,1)&&t!==e&&(n=(o&&t===91&&M&&m.asi?.(o,r,h)||null)??((p=C[t])&&p(o,r))??(o&&A&&m.asi?.(o,r,h))??(!o&&R(m.id)));)o=n;return e&&(t==e?(s++,e===125&&m.asi&&(m.newline=!0)):y("Unclosed "+String.fromCharCode(e-(e>42?2:1)))),o},z=(r,e=s)=>{for(M=!1;(r=l.charCodeAt(s))<=32;)m.asi&&r===10&&(m.newline=M=!0),s++;return r},Fr=(r=s)=>{for(;l.charCodeAt(r)<=32;)r++;return l.charCodeAt(r)},Or=m.id=r=>r>=48&&r<=57||r>=65&&r<=90||r>=97&&r<=122||r==36||r==95||r>=192&&r!=215&&r!=247,Xr=(r,e=r.length)=>l.substr(s,e)===r&&!m.id(l.charCodeAt(s+e)),Hr=()=>(S(),h(0,41)),C=[],J={},c=(r,e=32,t,o=r.charCodeAt(0),n=r.length,p=C[o],A=r.toUpperCase()!==r,d,w)=>(e=J[r]=!p&&J[r]||e,C[o]=(g,_,U,v=s)=>(d=U,(U?r==U:(n<2||r.charCodeAt(1)===l.charCodeAt(s+1)&&(n<3||l.substr(s,n)==r))&&(!A||!m.id(l.charCodeAt(s+n)))&&(d=U=r))&&_<e&&(s+=n,(w=t(g))?K(w,v):(s=v,d=0,!A&&!p&&!g&&y()),w)||p?.(g,_,d))),f=(r,e,t=!1)=>c(r,e,o=>o&&(n=>n&&[r,o,n])(h(e-(t?.5:0)))),E=(r,e,t)=>c(r,e,o=>t?o&&[r,o]:!o&&(o=h(e-.5))&&[r,o]),Qr=(r,e)=>c(r,200,t=>!t&&[,e]),$=(r,e,t)=>c(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)),V=(r,e)=>c(r[0],e,t=>!t&&[r,h(0,r.charCodeAt(1))||null]),F=(r,e)=>c(r[0],e,t=>t&&[r,t,h(0,r.charCodeAt(1))||null]),vr=(r,e,t,o=r.charCodeAt(0),n=r.length,p=C[o],A)=>C[o]=(d,w,g,_=s)=>!d&&(g?r==g:(n<2||l.substr(s,n)==r)&&(g=r))&&w<e&&!m.id(l.charCodeAt(s+n))&&(!m.prop||m.prop(s+n))&&(W(s+n),(A=t())?K(A,_):W(_),A)||p?.(d,w,g);Object.defineProperty(m,"space",{configurable:!0,enumerable:!0,get:()=>z,set:r=>z=r});var N={},u=(r,e,t=N[r])=>N[r]=(...o)=>e(...o)||t?.(...o),i=r=>Array.isArray(r)?r[0]==null?(e=>()=>e)(r[1]):N[r[0]]?.(...r.slice(1))??y(`Unknown operator: ${r[0]}`,r?.loc):r===void 0?()=>{}:e=>e?.[r];var L=46,I=48,P=57,mr=69,fr=101,Ar=43,dr=45,B=95,Y=110,hr=97,Cr=102,cr=65,gr=70,Z=r=>r.indexOf("_")<0?r:r.replaceAll("_",""),O=r=>{let e=Z(R(t=>t===L&&l.charCodeAt(s+1)!==L||t>=I&&t<=P||t===B||((t===mr||t===fr)&&((t=l.charCodeAt(s+1))>=I&&t<=P||t===Ar||t===dr)?2:0)));return l.charCodeAt(s)===Y?(S(),[,BigInt(e)]):(r=+e)!=r?y():[,r]},yr={2:r=>r===48||r===49||r===B,8:r=>r>=48&&r<=55||r===B,16:r=>r>=I&&r<=P||r>=hr&&r<=Cr||r>=cr&&r<=gr||r===B};m.number=null;C[L]=r=>!r&&l.charCodeAt(s+1)!==L&&O();for(let r=I;r<=P;r++)C[r]=e=>e?void 0:O();C[I]=r=>{if(r)return;let e=m.number;if(e){for(let[t,o]of Object.entries(e))if(t[0]==="0"&&l[s+1]?.toLowerCase()===t[1]){S(2);let n=Z(R(yr[o]));return l.charCodeAt(s)===Y?(S(),[,BigInt("0"+t[1]+n)]):[,parseInt(n,o)]}}return O()};var Sr=92,q=34,x=39,Er={n:`
5
+ `,r:"\r",t:" ",b:"\b",f:"\f",v:"\v"},j=r=>(e,t,o="")=>{if(!(e||!m.string?.[String.fromCharCode(r)]))return S(),R(n=>n-r&&(n===Sr?(o+=Er[l[s+1]]||l[s+1],2):(o+=l[s],1))),l[s]===String.fromCharCode(r)?S():y("Bad string"),[,o]};C[q]=j(q);C[x]=j(x);m.string={'"':!0};var wr=20;"= += -= *= /= %= |= &= ^= >>= <<=".split(" ").map(r=>f(r,wr,!0));var b=(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?b(r[1],e):(()=>{throw Error("Invalid assignment target")})(),a={"=":(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 a)u(r,(e,t)=>(t=i(t),b(e,(o,n,p)=>a[r](o,n,t(p)))));var Rr=30,_r=40,Ir=140;E("!",Ir);f("||",Rr);f("&&",_r);u("!",r=>(r=i(r),e=>!r(e)));u("||",(r,e)=>(r=i(r),e=i(e),t=>r(t)||e(t)));u("&&",(r,e)=>(r=i(r),e=i(e),t=>r(t)&&e(t)));var Ur=50,Br=60,Lr=70,rr=100,Pr=140;f("|",Ur);f("&",Lr);f("^",Br);f(">>",rr);f("<<",rr);E("~",Pr);u("~",r=>(r=i(r),e=>~r(e)));u("|",(r,e)=>(r=i(r),e=i(e),t=>r(t)|e(t)));u("&",(r,e)=>(r=i(r),e=i(e),t=>r(t)&e(t)));u("^",(r,e)=>(r=i(r),e=i(e),t=>r(t)^e(t)));u(">>",(r,e)=>(r=i(r),e=i(e),t=>r(t)>>e(t)));u("<<",(r,e)=>(r=i(r),e=i(e),t=>r(t)<<e(t)));var T=90;f("<",T);f(">",T);f("<=",T);f(">=",T);u(">",(r,e)=>(r=i(r),e=i(e),t=>r(t)>e(t)));u("<",(r,e)=>(r=i(r),e=i(e),t=>r(t)<e(t)));u(">=",(r,e)=>(r=i(r),e=i(e),t=>r(t)>=e(t)));u("<=",(r,e)=>(r=i(r),e=i(e),t=>r(t)<=e(t)));var er=80;f("==",er);f("!=",er);u("==",(r,e)=>(r=i(r),e=i(e),t=>r(t)==e(t)));u("!=",(r,e)=>(r=i(r),e=i(e),t=>r(t)!=e(t)));var tr=110,X=120,or=140;f("+",tr);f("-",tr);f("*",X);f("/",X);f("%",X);E("+",or);E("-",or);u("+",(r,e)=>e!==void 0?(r=i(r),e=i(e),t=>r(t)+e(t)):(r=i(r),t=>+r(t)));u("-",(r,e)=>e!==void 0?(r=i(r),e=i(e),t=>r(t)-e(t)):(r=i(r),t=>-r(t)));u("*",(r,e)=>(r=i(r),e=i(e),t=>r(t)*e(t)));u("/",(r,e)=>(r=i(r),e=i(e),t=>r(t)/e(t)));u("%",(r,e)=>(r=i(r),e=i(e),t=>r(t)%e(t)));var k=150;c("++",k,r=>r?["++",r,null]:["++",h(k-1)]);c("--",k,r=>r?["--",r,null]:["--",h(k-1)]);var H=(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?H(r[1],e):(()=>{throw Error("Invalid increment target")})();u("++",(r,e)=>H(r,e===null?(t,o)=>t[o]++:(t,o)=>++t[o]));u("--",(r,e)=>H(r,e===null?(t,o)=>t[o]--:(t,o)=>--t[o]));var Tr=5,kr=10;$(",",kr);$(";",Tr,!0);var nr=(...r)=>(r=r.map(i),e=>{let t;for(let o of r)t=o(e);return t});u(",",nr);u(";",nr);var Dr=170;V("()",Dr);var ir=r=>r?.[0]==="_"&&r[1]==="_"||r==="constructor"||r==="prototype",Q=170;F("[]",Q);f(".",Q);F("()",Q);var D=r=>{throw Error(r)};u("[]",(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&&D("Missing index"),r=i(r),e=i(e),t=>{let o=e(t);return ir(o)?void 0:r(t)[o]}));u(".",(r,e)=>(r=i(r),e=e[0]?e:e[1],ir(e)?()=>{}:t=>r(t)[e]));u("()",(r,e)=>{if(e===void 0)return r==null?D("Empty ()"):i(r);let t=n=>n?.[0]===","&&n.slice(1).some(p=>p==null||t(p));t(e)&&D("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 sr(r,(n,p,A)=>n[p](...o(A)))});var sr=(r,e,t,o)=>r==null?D("Empty ()"):r[0]==="()"&&r.length==2?sr(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));var lr=new WeakMap,Mr=(r,...e)=>typeof r=="string"?i(m(r)):lr.get(r)||lr.set(r,Nr(r,e)).get(r),ur=57344,Nr=(r,e)=>{let t=r.reduce((p,A,d)=>p+(d?String.fromCharCode(ur+d-1):"")+A,""),o=m(t),n=p=>{if(typeof p=="string"&&p.length===1){let A=p.charCodeAt(0)-ur,d;if(A>=0&&A<e.length)return d=e[A],$r(d)?d:[,d]}return Array.isArray(p)?p.map(n):p};return i(n(o))},$r=r=>typeof r=="string"||Array.isArray(r)&&(typeof r[0]=="string"||r[0]===void 0),Ce=Mr;export{F as access,f as binary,i as compile,l as cur,Ce as default,y as err,h as expr,V as group,Or as id,s as idx,vr as keyword,Qr as literal,K as loc,C as lookup,$ as nary,R as next,u as operator,N as operators,Hr as parens,m as parse,Fr as peek,J as prec,W as seek,S as skip,z as space,c as token,E as unary,Xr as word};