subscript 10.4.2 → 10.4.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/feature/asi.js +4 -1
- package/feature/op/spread.js +2 -2
- package/jessie.min.js +6 -6
- package/justin.min.js +3 -3
- package/package.json +1 -1
package/feature/asi.js
CHANGED
|
@@ -65,8 +65,11 @@ parse.step = (a, p, cc, expr) => {
|
|
|
65
65
|
return baseStep(a, p, cc, expr) ?? (a && nl ? asi(a, p, expr) ?? null : null);
|
|
66
66
|
};
|
|
67
67
|
|
|
68
|
+
// Runaway-recursion guard: asi recurses once per consecutive statement in a
|
|
69
|
+
// block, so depth ~ statement count. Cap well below the JS call-stack limit
|
|
70
|
+
// (which blows ~5–10k statements) but high enough for realistic generated code.
|
|
68
71
|
let asiDepth = 0;
|
|
69
|
-
const MAX_ASI_DEPTH =
|
|
72
|
+
const MAX_ASI_DEPTH = 2000;
|
|
70
73
|
|
|
71
74
|
const asi = parse.asi = (a, p, expr, b, items) => {
|
|
72
75
|
if (p >= lvl || asiDepth >= MAX_ASI_DEPTH) return;
|
package/feature/op/spread.js
CHANGED
package/jessie.min.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
var u,c,m=r=>(u=0,c=r,m.enter?.(),r=A(),c[u]?
|
|
1
|
+
var u,c,m=r=>(u=0,c=r,m.enter?.(),r=A(),c[u]?R():r||""),R=(r="Unexpected token",t=u,e=c.slice(0,t).split(`
|
|
2
2
|
`),o=e.pop(),n=c.slice(Math.max(0,t-40),t),s="\u032D",l=(c[t]||" ")+s,f=c.slice(t+1,t+20))=>{throw SyntaxError(`${r} at ${e.length+1}:${o.length+1}
|
|
3
3
|
${c[t-41]!==`
|
|
4
|
-
`,""+n}${l}${f}`)},Lr=(r,t=u)=>(Array.isArray(r)&&(r.loc=t),r),
|
|
5
|
-
`,r:"\r",t:" ",b:"\b",f:"\f",v:"\v",0:"\0"},Hr=r=>r>=48&&r<=57?r-48:r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:-1,jr=r=>(t,e,o="",n=String.fromCharCode(r))=>{if(t||!m.string?.[n])return;h();let s=()=>{let l=c.charCodeAt(u+1);if(l===Kr)return 2;if(l===Pt)return c.charCodeAt(u+2)===Kr?3:2;if(l===
|
|
4
|
+
`,""+n}${l}${f}`)},Lr=(r,t=u)=>(Array.isArray(r)&&(r.loc=t),r),N=(r,t=u,e)=>{for(;e=r(c.charCodeAt(u));)u+=e;return c.slice(t,u)},h=(r=1)=>c[u+=r],P=r=>u=r,A=(r=0,t)=>{let e,o,n;for(t&&m.enter?.(r,t);(e=a())&&e!==t&&(n=fr(o,r,e,A));)o=n;return t&&(e==t?(u++,m.exit?.(r,t)):R("Unclosed "+String.fromCharCode(t-(t>42?2:1)))),o},fr=(r,t,e,o,n)=>(n=T[e])&&n(r,t)||(r?null:N(m.id)||null),a=r=>{for(;(r=c.charCodeAt(u))<=32;)u++;return r},Y=(r=u)=>{for(;c.charCodeAt(r)<=32;)r++;return c.charCodeAt(r)},Je=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,I=(r,t=r.length)=>c.substr(u,t)===r&&!m.id(c.charCodeAt(u+t)),v=()=>(h(),A(0,41)),T=[],$={},k=(r,t=32,e,o=r.charCodeAt(0),n=r.length,s=T[o],l=r.toUpperCase()!==r,f,d)=>(t=$[r]=!s&&$[r]||t,T[o]=(g,E,S,w=u)=>(f=S,(S?r==S:(n<2||r.charCodeAt(1)===c.charCodeAt(u+1)&&(n<3||c.substr(u,n)==r))&&(!l||!m.id(c.charCodeAt(u+n)))&&(f=S=r))&&E<t&&(u+=n,(d=e(g))?Lr(d,w):(u=w,f=0,!l&&!s&&!g&&R()),d)||s?.(g,E,f))),y=(r,t,e=!1)=>k(r,t,o=>o&&(n=>n&&[r,o,n])(A(t-(e?.5:0)))),O=(r,t,e)=>k(r,t,o=>e?o&&[r,o]:!o&&(o=A(t-.5))&&[r,o]),j=(r,t)=>k(r,200,e=>!e&&[,t]),lr=(r,t,e)=>k(r,t,(o,n)=>(n=A(t-(e?.5:0)),o?.[0]!==r&&(o=[r,o||null]),n?.[0]===r?o.push(...n.slice(1)):o.push(n||null),o)),x=(r,t)=>k(r[0],t,e=>!e&&[r,A(0,r.charCodeAt(1))||null]),mr=(r,t)=>k(r[0],t,e=>e&&[r,e,A(0,r.charCodeAt(1))||null]),C=(r,t,e,o=r.charCodeAt(0),n=r.length,s=T[o],l)=>T[o]=(f,d,g,E=u)=>!f&&(g?r==g:(n<2||c.substr(u,n)==r)&&(g=r))&&d<t&&!m.id(c.charCodeAt(u+n))&&(!m.prop||m.prop(u+n))&&(P(u+n),(l=e())?Lr(l,E):P(E),l)||s?.(f,d,g);Object.defineProperty(m,"space",{configurable:!0,enumerable:!0,get:()=>a,set:r=>a=r});Object.defineProperty(m,"step",{configurable:!0,enumerable:!0,get:()=>fr,set:r=>fr=r});var ur={},p=(r,t,e=ur[r])=>ur[r]=(...o)=>t(...o)||e?.(...o),i=r=>Array.isArray(r)?r[0]==null?(t=>()=>t)(r[1]):ur[r[0]]?.(...r.slice(1))??R(`Unknown operator: ${r[0]}`,r?.loc):r===void 0?()=>{}:t=>t?.[r];var q=46,W=48,b=57,gt=69,Ct=101,wt=43,Et=45,Z=95,Mr=110,St=97,kt=102,It=65,Tt=70,Ur=r=>r.indexOf("_")<0?r:r.replaceAll("_",""),cr=r=>{let t=Ur(N(e=>e===q&&c.charCodeAt(u+1)!==q||e>=W&&e<=b||e===Z||((e===gt||e===Ct)&&((e=c.charCodeAt(u+1))>=W&&e<=b||e===wt||e===Et)?2:0)));return c.charCodeAt(u)===Mr?(h(),[,BigInt(t)]):(r=+t)!=r?R():[,r]},Nt={2:r=>r===48||r===49||r===Z,8:r=>r>=48&&r<=55||r===Z,16:r=>r>=W&&r<=b||r>=St&&r<=kt||r>=It&&r<=Tt||r===Z};m.number=null;T[q]=r=>!r&&c.charCodeAt(u+1)!==q&&cr();for(let r=W;r<=b;r++)T[r]=t=>t?void 0:cr();T[W]=r=>{if(r)return;let t=m.number;if(t){for(let[e,o]of Object.entries(t))if(e[0]==="0"&&c[u+1]?.toLowerCase()===e[1]){h(2);let n=Ur(N(Nt[o]));return c.charCodeAt(u)===Mr?(h(),[,BigInt("0"+e[1]+n)]):[,parseInt(n,o)]}}return cr()};var Rt=92,Dr=34,Fr=39,Gr=117,Xr=120,_t=123,Ot=125,Kr=10,Pt=13,vt={n:`
|
|
5
|
+
`,r:"\r",t:" ",b:"\b",f:"\f",v:"\v",0:"\0"},Hr=r=>r>=48&&r<=57?r-48:r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:-1,jr=r=>(t,e,o="",n=String.fromCharCode(r))=>{if(t||!m.string?.[n])return;h();let s=()=>{let l=c.charCodeAt(u+1);if(l===Kr)return 2;if(l===Pt)return c.charCodeAt(u+2)===Kr?3:2;if(l===Xr||l===Gr&&c.charCodeAt(u+2)!==_t){let f=l===Xr?2:4,d=0,g;for(let E=0;E<f;E++){if((g=Hr(c.charCodeAt(u+2+E)))<0)return o+=c[u+1],2;d=d*16+g}return o+=String.fromCharCode(d),2+f}if(l===Gr){let f=0,d=u+3,g;for(;(g=Hr(c.charCodeAt(d)))>=0;)f=f*16+g,d++;return d>u+3&&f<=1114111&&c.charCodeAt(d)===Ot?(o+=String.fromCodePoint(f),d-u+1):(o+=c[u+1],2)}return o+=vt[c[u+1]]||c[u+1],2};return N(l=>l-r&&(l!==Rt?(o+=c[u],1):s())),c[u]===n?h():R("Bad string"),[,o]};T[Dr]=jr(Dr);T[Fr]=jr(Fr);m.string={'"':!0};var Bt=20;"= += -= *= /= %= |= &= ^= >>= <<=".split(" ").map(r=>y(r,Bt,!0));var Lt=30,Mt=40,Ut=140;O("!",Ut);y("||",Lt);y("&&",Mt);var Dt=50,Ft=60,Gt=70,Qr=100,Xt=140;y("|",Dt);y("&",Gt);y("^",Ft);y(">>",Qr);y("<<",Qr);O("~",Xt);var rr=90;y("<",rr);y(">",rr);y("<=",rr);y(">=",rr);var $r=80;y("==",$r);y("!=",$r);var xr=110,dr=120,Wr=140;y("+",xr);y("-",xr);y("*",dr);y("/",dr);y("%",dr);O("+",Wr);O("-",Wr);var tr=150;k("++",tr,r=>r?["++",r,null]:["++",A(tr-1)]);k("--",tr,r=>r?["--",r,null]:["--",A(tr-1)]);var Kt=5,Ht=10;lr(",",Ht);lr(";",Kt,!0);var jt=170;x("()",jt);var ar=170;mr("[]",ar);y(".",ar);mr("()",ar);var Qt=32,$t=m.space;m.comment??={"//":`
|
|
6
6
|
`,"/*":"*/"};var hr;m.space=()=>{hr||(hr=Object.entries(m.comment).map(([n,s])=>[n,s,n.charCodeAt(0)]));for(var r;r=$t();){for(var t=0,e;e=hr[t++];)if(r===e[2]&&c.substr(u,e[0].length)===e[0]){var o=u+e[0].length;if(e[1]===`
|
|
7
|
-
`)for(;c.charCodeAt(o)>=Qt;)o++;else{for(;c[o]&&c.substr(o,e[1].length)!==e[1];)o++;c[o]&&(o+=e[1].length)}P(o),r=0;break}if(r)return r}return r};var zr=80;y("===",zr);y("!==",zr);var xt=30;y("??",xt);var Wt=130,zt=20;y("**",Wt,!0);y("**=",zt,!0);var Jr=90;y("in",Jr);y("of",Jr);var Jt=20,Vt=100;y(">>>",Vt);y(">>>=",Jt,!0);var Ar=20;y("||=",Ar,!0);y("&&=",Ar,!0);y("??=",Ar,!0);j("true",!0);j("false",!1);j("null",null);C("undefined",200,()=>[]);j("NaN",NaN);j("Infinity",1/0);var yr=20;k("?",yr,(r,t,e)=>r&&(t=A(yr-1))&&
|
|
8
|
-
`,r:"\r",t:" ",b:"\b",f:"\f",v:"\v"},Zr=()=>{let r=[];for(let t="",e;(e=c.charCodeAt(u))!==er;)e?e===ee?(h(),t+=oe[c[u]]||c[u],h()):e===re&&c.charCodeAt(u+1)===te?(t&&r.push([,t]),t="",h(2),r.push(A(0,125))):(t+=c[u],h(),e=c.charCodeAt(u),e===er&&t&&r.push([,t])):
|
|
9
|
-
`;var mt=32,Or=10,Ne=59,_e=125,Oe=91,Pe=40,_r=$.asi??$[";"],ve=m._baseSpace??=m.space,Be=m._baseStep??=m.step,Le=(r,t)=>{for(;(t=c.charCodeAt(r))<=mt;){if(t===Or)return!0;r++}return!1},Me=(r=u,t)=>{for(;r-- >0&&(t=c.charCodeAt(r))<=mt;)if(t===Or)return!0;return!1};m.space=(r,t)=>{for(;;){for(t=u,r=ve();t<u;)if(c.charCodeAt(t++)===Or){m.newline=!0;break}if(r===Ne&&Le(u+1)){P(u+1),m.newline=m.semi=!0;continue}return r}};m.enter=()=>m.newline=m.semi=!1;m.exit=(r,t)=>{t===_e&&(m.newline=!0)};m.step=(r,t,e,o)=>{if(m.semi&&t>=_r)return!1;if(r&&(m.semi||(e===Oe||e===Pe)&&Me()))return lt(r,t,o)??null;let n=m.newline;return Be(r,t,e,o)??(r&&n?lt(r,t,o)??null:null)};var Nr=0,Ue=100,lt=m.asi=(r,t,e,o,n)=>{if(t>=_r||Nr>=Ue)return;m.semi=!1;let s=u;Nr++;try{o=e(_r-.5)}finally{Nr--}if(!(!o||u===s))return n=o?.[0]===";"?o.slice(1):[o],r?.[0]===";"?(r.push(...n),r):[";",r,...n]};var dt=(r,t,e,o)=>typeof r=="string"?n=>t(n,r,n):r[0]==="."?(e=i(r[1]),o=r[2],n=>t(e(n),o,n)):r[0]==="[]"&&r.length===3?(e=i(r[1]),o=i(r[2]),n=>t(e(n),o(n),n)):r[0]==="()"&&r.length===2?dt(r[1],t):(()=>{throw Error("Invalid assignment target")})(),ct={"=":(r,t,e)=>r[t]=e,"+=":(r,t,e)=>r[t]+=e,"-=":(r,t,e)=>r[t]-=e,"*=":(r,t,e)=>r[t]*=e,"/=":(r,t,e)=>r[t]/=e,"%=":(r,t,e)=>r[t]%=e,"|=":(r,t,e)=>r[t]|=e,"&=":(r,t,e)=>r[t]&=e,"^=":(r,t,e)=>r[t]^=e,">>=":(r,t,e)=>r[t]>>=e,"<<=":(r,t,e)=>r[t]<<=e};for(let r in ct)p(r,(t,e)=>(e=i(e),dt(t,(o,n,s)=>ct[r](o,n,e(s)))));p("!",r=>(r=i(r),t=>!r(t)));p("||",(r,t)=>(r=i(r),t=i(t),e=>r(e)||t(e)));p("&&",(r,t)=>(r=i(r),t=i(t),e=>r(e)&&t(e)));p("~",r=>(r=i(r),t=>~r(t)));p("|",(r,t)=>(r=i(r),t=i(t),e=>r(e)|t(e)));p("&",(r,t)=>(r=i(r),t=i(t),e=>r(e)&t(e)));p("^",(r,t)=>(r=i(r),t=i(t),e=>r(e)^t(e)));p(">>",(r,t)=>(r=i(r),t=i(t),e=>r(e)>>t(e)));p("<<",(r,t)=>(r=i(r),t=i(t),e=>r(e)<<t(e)));p(">",(r,t)=>(r=i(r),t=i(t),e=>r(e)>t(e)));p("<",(r,t)=>(r=i(r),t=i(t),e=>r(e)<t(e)));p(">=",(r,t)=>(r=i(r),t=i(t),e=>r(e)>=t(e)));p("<=",(r,t)=>(r=i(r),t=i(t),e=>r(e)<=t(e)));p("==",(r,t)=>(r=i(r),t=i(t),e=>r(e)==t(e)));p("!=",(r,t)=>(r=i(r),t=i(t),e=>r(e)!=t(e)));p("+",(r,t)=>t!==void 0?(r=i(r),t=i(t),e=>r(e)+t(e)):(r=i(r),e=>+r(e)));p("-",(r,t)=>t!==void 0?(r=i(r),t=i(t),e=>r(e)-t(e)):(r=i(r),e=>-r(e)));p("*",(r,t)=>(r=i(r),t=i(t),e=>r(e)*t(e)));p("/",(r,t)=>(r=i(r),t=i(t),e=>r(e)/t(e)));p("%",(r,t)=>(r=i(r),t=i(t),e=>r(e)%t(e)));var Pr=(r,t,e,o)=>typeof r=="string"?n=>t(n,r):r[0]==="."?(e=i(r[1]),o=r[2],n=>t(e(n),o)):r[0]==="[]"&&r.length===3?(e=i(r[1]),o=i(r[2]),n=>t(e(n),o(n))):r[0]==="()"&&r.length===2?Pr(r[1],t):(()=>{throw Error("Invalid increment target")})();p("++",(r,t)=>Pr(r,t===null?(e,o)=>e[o]++:(e,o)=>++e[o]));p("--",(r,t)=>Pr(r,t===null?(e,o)=>e[o]--:(e,o)=>--e[o]));var at=(...r)=>(r=r.map(i),t=>{let e;for(let o of r)e=o(t);return e});p(",",at);p(";",at);var D=r=>r?.[0]==="_"&&r[1]==="_"||r==="constructor"||r==="prototype",ir=r=>{throw Error(r)};p("[]",(r,t)=>t===void 0?(r=r?r[0]===","?r.slice(1):[r]:[],r=r.map(e=>e==null?(()=>{}):e[0]==="..."?(e=i(e[1]),o=>e(o)):(e=i(e),o=>[e(o)])),e=>r.flatMap(o=>o(e))):(t==null&&ir("Missing index"),r=i(r),t=i(t),e=>{let o=t(e);return D(o)?void 0:r(e)[o]}));p(".",(r,t)=>(r=i(r),t=t[0]?t:t[1],D(t)?()=>{}:e=>r(e)[t]));p("()",(r,t)=>{if(t===void 0)return r==null?ir("Empty ()"):i(r);let e=n=>n?.[0]===","&&n.slice(1).some(s=>s==null||e(s));e(t)&&ir("Empty argument");let o=t?t[0]===","?(t=t.slice(1).map(i),n=>t.map(s=>s(n))):(t=i(t),n=>[t(n)]):()=>[];return vr(r,(n,s,l)=>n[s](...o(l)))});var M=r=>typeof r=="string"||Array.isArray(r)&&(r[0]==="."||r[0]==="?."||r[0]==="[]"&&r.length===3||r[0]==="?.[]"||r[0]==="()"&&r.length===2&&M(r[1])||r[0]==="{}"),vr=(r,t,e,o)=>r==null?ir("Empty ()"):r[0]==="()"&&r.length==2?vr(r[1],t):typeof r=="string"?n=>t(n,r,n):r[0]==="."?(e=i(r[1]),o=r[2],n=>t(e(n),o,n)):r[0]==="?."?(e=i(r[1]),o=r[2],n=>{let s=e(n);return s==null?void 0:t(s,o,n)}):r[0]==="[]"&&r.length===3?(e=i(r[1]),o=i(r[2]),n=>t(e(n),o(n),n)):r[0]==="?.[]"?(e=i(r[1]),o=i(r[2]),n=>{let s=e(n);return s==null?void 0:t(s,o(n),n)}):(r=i(r),n=>t([r(n)],0,n)),X=vr;p("===",(r,t)=>(r=i(r),t=i(t),e=>r(e)===t(e)));p("!==",(r,t)=>(r=i(r),t=i(t),e=>r(e)!==t(e)));p("??",(r,t)=>(r=i(r),t=i(t),e=>r(e)??t(e)));var Fe=r=>{throw Error(r)};p("**",(r,t)=>(r=i(r),t=i(t),e=>r(e)**t(e)));p("**=",(r,t)=>(M(r)||Fe("Invalid assignment target"),t=i(t),X(r,(e,o,n)=>e[o]**=t(n))));p("in",(r,t)=>(r=i(r),t=i(t),e=>r(e)in t(e)));var De=r=>{throw Error(r)};p(">>>",(r,t)=>(r=i(r),t=i(t),e=>r(e)>>>t(e)));p(">>>=",(r,t)=>(M(r)||De("Invalid assignment target"),t=i(t),X(r,(e,o,n)=>e[o]>>>=t(n))));var Xe=r=>r[0]?.[0]===","?r[0].slice(1):r,G=(r,t,e)=>{if(typeof r=="string"){e[r]=t;return}let[o,...n]=r,s=Xe(n);if(o==="{}"){let l=[];for(let f of s){if(Array.isArray(f)&&f[0]==="..."){let w={};for(let _ in t)l.includes(_)||(w[_]=t[_]);e[f[1]]=w;break}let d,g,E;typeof f=="string"?d=g=f:f[0]==="="?(typeof f[1]=="string"?d=g=f[1]:[,d,g]=f[1],E=f[2]):[,d,g]=f,l.push(d);let S=t[d];S===void 0&&E&&(S=i(E)(e)),G(g,S,e)}}else if(o==="[]"){let l=0;for(let f of s){if(f===null){l++;continue}if(Array.isArray(f)&&f[0]==="..."){e[f[1]]=t.slice(l);break}let d=f,g;Array.isArray(f)&&f[0]==="="&&([,d,g]=f);let E=t[l++];E===void 0&&g&&(E=i(g)(e)),G(d,E,e)}}},Br=(...r)=>(r=r.map(t=>{if(typeof t=="string")return e=>{e[t]=void 0};if(t[0]==="="){let[,e,o]=t,n=i(o);return typeof e=="string"?s=>{s[e]=n(s)}:s=>G(e,n(s),s)}return i(t)}),t=>{for(let e of r)e(t)});p("let",Br);p("const",Br);p("var",Br);var sr=r=>{throw Error(r)};p("=",(r,t)=>{if(Array.isArray(r)&&(r[0]==="let"||r[0]==="const"||r[0]==="var")){let e=r[1];return t=i(t),typeof e=="string"?o=>{o[e]=t(o)}:o=>G(e,t(o),o)}return M(r)||sr("Invalid assignment target"),t=i(t),X(r,(e,o,n)=>e[o]=t(n))});p("||=",(r,t)=>(M(r)||sr("Invalid assignment target"),t=i(t),X(r,(e,o,n)=>e[o]||=t(n))));p("&&=",(r,t)=>(M(r)||sr("Invalid assignment target"),t=i(t),X(r,(e,o,n)=>e[o]&&=t(n))));p("??=",(r,t)=>(M(r)||sr("Invalid assignment target"),t=i(t),X(r,(e,o,n)=>e[o]??=t(n))));p("?",(r,t,e)=>(r=i(r),t=i(t),e=i(e),o=>r(o)?t(o):e(o)));var B=[];p("=>",(r,t)=>{r=r?.[0]==="()"?r[1]:r;let e=r?r[0]===","?r.slice(1):[r]:[],o=-1,n=null,s=e[e.length-1];Array.isArray(s)&&s[0]==="..."&&(o=e.length-1,n=s[1],e.length--);let l=t?.[0]==="{}";return t=i(l?["{",t[1]]:t),f=>(...d)=>{let g={};e.forEach((S,w)=>g[S]=d[w]),n&&(g[n]=d.slice(o));let E=new Proxy(g,{get:(S,w)=>w in S?S[w]:f?.[w],set:(S,w,_)=>((w in S?S:f)[w]=_,!0),has:(S,w)=>w in S||(f?w in f:!1)});try{let S=t(E);return l?void 0:S}catch(S){if(S===B)return S[0];throw S}}});p("...",r=>(r=i(r),t=>Object.entries(r(t))));p("?.",(r,t)=>(r=i(r),D(t)?()=>{}:e=>r(e)?.[t]));p("?.[]",(r,t)=>(r=i(r),t=i(t),e=>{let o=t(e);return D(o)?void 0:r(e)?.[o]}));p("?.()",(r,t)=>{let e=t?t[0]===","?(t=t.slice(1).map(i),n=>t.map(s=>s(n))):(t=i(t),n=>[t(n)]):()=>[];if(r[0]==="?."){let n=i(r[1]),s=r[2];return D(s)?()=>{}:l=>n(l)?.[s]?.(...e(l))}if(r[0]==="?.[]"){let n=i(r[1]),s=i(r[2]);return l=>{let f=n(l),d=s(l);return D(d)?void 0:f?.[d]?.(...e(l))}}if(r[0]==="."){let n=i(r[1]),s=r[2];return D(s)?()=>{}:l=>n(l)?.[s]?.(...e(l))}if(r[0]==="[]"&&r.length===3){let n=i(r[1]),s=i(r[2]);return l=>{let f=n(l),d=s(l);return D(d)?void 0:f?.[d]?.(...e(l))}}let o=i(r);return n=>o(n)?.(...e(n))});p("typeof",r=>(r=i(r),t=>typeof r(t)));p("void",r=>(r=i(r),t=>(r(t),void 0)));p("delete",r=>{if(r[0]==="."){let t=i(r[1]),e=r[2];return o=>delete t(o)[e]}if(r[0]==="[]"){let t=i(r[1]),e=i(r[2]);return o=>delete t(o)[e(o)]}return()=>!0});p("new",r=>{let t=i(r?.[0]==="()"?r[1]:r),e=r?.[0]==="()"?r[2]:null,o=e?e[0]===","?(n=>s=>n.map(l=>l(s)))(e.slice(1).map(i)):(n=>s=>[n(s)])(i(e)):()=>[];return n=>new(t(n))(...o(n))});var pr=Symbol("accessor");p("get",(r,t)=>(t=t?i(t):()=>{},e=>[[pr,r,{get:function(){let o=Object.create(e||{});return o.this=this,t(o)}}]]));p("set",(r,t,e)=>(e=e?i(e):()=>{},o=>[[pr,r,{set:function(n){let s=Object.create(o||{});s.this=this,s[t]=n,e(s)}}]]));var Ge=r=>r==null||typeof r=="string"||[":",",","...","get","set"].includes(r[0]);p("{}",(r,t)=>{if(t!==void 0)return;if(!Ge(r))return i(["{",r]);r=r?r[0]!==","?[r]:r.slice(1):[];let e=r.map(o=>i(typeof o=="string"?[":",o,o]:o));return o=>{let n={},s={};for(let l of e.flatMap(f=>f(o)))if(l[0]===pr){let[,f,d]=l;s[f]={...s[f],...d,configurable:!0,enumerable:!0}}else n[l[0]]=l[1];for(let l in s)Object.defineProperty(n,l,s[l]);return n}});p("{",r=>(r=r?i(r):()=>{},t=>r(Object.create(t))));p(":",(r,t)=>(t=i(t),Array.isArray(r)?(r=i(r),e=>[[r(e),t(e)]]):e=>[[r,t(e)]]));p("`",(...r)=>(r=r.map(i),t=>r.map(e=>e(t)).join("")));p("``",(r,...t)=>{r=i(r);let e=[],o=[];for(let s of t)Array.isArray(s)&&s[0]===void 0?e.push(s[1]):o.push(i(s));let n=Object.assign([...e],{raw:e});return s=>r(s)(n,...o.map(l=>l(s)))});p("function",(r,t,e)=>{e=e?i(e):()=>{};let o=t?t[0]===","?t.slice(1):[t]:[],n=null,s=-1,l=o[o.length-1];return Array.isArray(l)&&l[0]==="..."&&(s=o.length-1,n=l[1],o.length--),f=>{let d=(...g)=>{let E={};o.forEach((w,_)=>E[w]=g[_]),n&&(E[n]=g.slice(s));let S=new Proxy(E,{get:(w,_)=>_ in w?w[_]:f[_],set:(w,_,yt)=>((_ in w?w:f)[_]=yt,!0),has:(w,_)=>_ in w||_ in f});try{return e(S)}catch(w){if(w===B)return w[0];throw w}};return r&&(f[r]=d),d}});p("function*",(r,t,e)=>{throw Error("Generator functions are not supported in evaluation")});p("async",r=>{let t=i(r);return e=>{let o=t(e);return async function(...n){return o(...n)}}});p("await",r=>(r=i(r),async t=>await r(t)));p("yield",r=>(r=r?i(r):null,t=>{throw{__yield__:r?r(t):void 0}}));p("yield*",r=>(r=i(r),t=>{throw{__yield_all__:r(t)}}));var Ke=Symbol("static"),He=r=>{throw Error(r)};p("instanceof",(r,t)=>(r=i(r),t=i(t),e=>r(e)instanceof t(e)));p("class",(r,t,e)=>(t=t?i(t):null,e=e?i(e):null,o=>{let n=t?t(o):Object,s=function(...l){if(!(this instanceof s))return He("Class constructor must be called with new");let f=t?Reflect.construct(n,l,s):this;return s.prototype.__constructor__&&s.prototype.__constructor__.apply(f,l),f};if(Object.setPrototypeOf(s.prototype,n.prototype),Object.setPrototypeOf(s,n),e){let l=Object.create(o);l.super=n;let f=e(l),d=Array.isArray(f)&&typeof f[0]?.[0]=="string"?f:[];for(let[g,E]of d)g==="constructor"?s.prototype.__constructor__=E:s.prototype[g]=E}return r&&(o[r]=s),s}));p("static",r=>(r=i(r),t=>[[Ke,r(t)]]));p("//",(r,t)=>{let e=new RegExp(r,t||"");return()=>e});p("if",(r,t,e)=>(r=i(r),t=i(t),e=e!==void 0?i(e):null,o=>r(o)?t(o):e?.(o)));var U=Symbol("break"),K=Symbol("continue");p("while",(r,t)=>(r=i(r),t=i(t),e=>{let o;for(;r(e);)try{o=t(e)}catch(n){if(n===U)break;if(n===K)continue;if(n===B)return n[0];throw n}return o}));p("do",(r,t)=>(r=i(r),t=i(t),e=>{let o;do try{o=r(e)}catch(n){if(n===U)break;if(n===K)continue;if(n===B)return n[0];throw n}while(t(e));return o}));p("for",(r,t)=>{if(Array.isArray(r)&&r[0]===";"){let[,e,o,n]=r;return e=e?i(e):null,o=o?i(o):()=>!0,n=n?i(n):null,t=i(t),s=>{let l;for(e?.(s);o(s);n?.(s))try{l=t(s)}catch(f){if(f===U)break;if(f===K)continue;if(f===B)return f[0];throw f}return l}}if(Array.isArray(r)&&(r[0]==="in"||r[0]==="of")){let[e,o,n]=r;if(Array.isArray(o)&&(o[0]==="let"||o[0]==="const"||o[0]==="var")&&(o=o[1]),e==="in")return Qe(o,n,t);if(e==="of")return je(o,n,t)}});var je=(r,t,e)=>{t=i(t),e=i(e);let o=Array.isArray(r);return n=>{let s,l=o?null:n[r];for(let f of t(n)){o?G(r,f,n):n[r]=f;try{s=e(n)}catch(d){if(d===U)break;if(d===K)continue;if(d===B)return d[0];throw d}}return o||(n[r]=l),s}},Qe=(r,t,e)=>{t=i(t),e=i(e);let o=Array.isArray(r);return n=>{let s,l=o?null:n[r];for(let f in t(n)){o?G(r,f,n):n[r]=f;try{s=e(n)}catch(d){if(d===U)break;if(d===K)continue;if(d===B)return d[0];throw d}}return o||(n[r]=l),s}};p("break",()=>()=>{throw U});p("continue",()=>()=>{throw K});p("return",r=>(r=r!==void 0?i(r):null,t=>{throw B[0]=r?.(t),B}));p("try",(r,...t)=>{r=r?i(r):null;let e=t.find(f=>f?.[0]==="catch"),o=t.find(f=>f?.[0]==="finally"),n=e?.[1],s=e?.[2]?i(e[2]):null,l=o?.[1]?i(o[1]):null;return f=>{let d;try{d=r?.(f)}catch(g){if(g===U||g===K||g===B)throw g;if(n!=null&&s){let E=n in f,S=f[n];f[n]=g;try{d=s(f)}finally{E?f[n]=S:delete f[n]}}else if(!s)throw g}finally{l?.(f)}return d}});p("throw",r=>(r=i(r),t=>{throw r(t)}));p("switch",(r,...t)=>(r=i(r),t.length?(t=t.map(e=>[e[0]==="case"?i(e[1]):null,(e[0]==="case"?e[2]:e[1])?.[0]===";"?(e[0]==="case"?e[2]:e[1]).slice(1).map(i):(e[0]==="case"?e[2]:e[1])?[i(e[0]==="case"?e[2]:e[1])]:[]]),e=>{let o=r(e),n=!1,s;for(let[f,d]of t)if(n||f===null||f(e)===o)for(n=!0,l=0;l<d.length;l++)try{s=d[l](e)}catch(g){if(g===U)return s;throw g}var l;return s}):e=>r(e)));p("import",()=>()=>{});p("export",()=>()=>{});p("from",(r,t)=>()=>{});p("as",(r,t)=>()=>{});p("default",r=>i(r));var ht=new WeakMap,$e=(r,...t)=>typeof r=="string"?i(m(r)):ht.get(r)||ht.set(r,xe(r,t)).get(r),At=57344,xe=(r,t)=>{let e=r.reduce((s,l,f)=>s+(f?String.fromCharCode(At+f-1):"")+l,""),o=m(e),n=s=>{if(typeof s=="string"&&s.length===1){let l=s.charCodeAt(0)-At,f;if(l>=0&&l<t.length)return f=t[l],We(f)?f:[,f]}return Array.isArray(s)?s.map(n):s};return i(n(o))},We=r=>typeof r=="string"||Array.isArray(r)&&(typeof r[0]=="string"||r[0]===void 0),ze=$e;export{mr as access,y as binary,i as compile,c as cur,ze as default,N as err,A as expr,x as group,Je as id,u as idx,C as keyword,j as literal,Lr as loc,T as lookup,lr as nary,R as next,p as operator,ur as operators,v as parens,m as parse,Y as peek,$ as prec,P as seek,h as skip,a as space,fr as step,k as token,O as unary,I as word};
|
|
7
|
+
`)for(;c.charCodeAt(o)>=Qt;)o++;else{for(;c[o]&&c.substr(o,e[1].length)!==e[1];)o++;c[o]&&(o+=e[1].length)}P(o),r=0;break}if(r)return r}return r};var zr=80;y("===",zr);y("!==",zr);var xt=30;y("??",xt);var Wt=130,zt=20;y("**",Wt,!0);y("**=",zt,!0);var Jr=90;y("in",Jr);y("of",Jr);var Jt=20,Vt=100;y(">>>",Vt);y(">>>=",Jt,!0);var Ar=20;y("||=",Ar,!0);y("&&=",Ar,!0);y("??=",Ar,!0);j("true",!0);j("false",!1);j("null",null);C("undefined",200,()=>[]);j("NaN",NaN);j("Infinity",1/0);var yr=20;k("?",yr,(r,t,e)=>r&&(t=A(yr-1))&&N(o=>o===58)&&(e=A(yr-1),["?",r,t,e]));var Yt=20;y("=>",Yt,!0);var Zt=20;O("...",Zt);var Vr=170;k("?.",Vr,(r,t)=>{if(!r)return;let e=a();return e===40?(h(),["?.()",r,A(0,41)||null]):e===91?(h(),["?.[]",r,A(0,93)]):(t=A(Vr),t?["?.",r,t]:void 0)});var z=140;O("typeof",z);O("void",z);O("delete",z);C("new",z,()=>I(".target")?(h(7),["new.target"]):["new",A(z)]);var qt=20,Yr=200;m.prop=r=>Y(r)!==58;x("[]",Yr);x("{}",Yr);y(":",qt-1,!0);var bt=170,er=96,re=36,te=123,ee=92,oe={n:`
|
|
8
|
+
`,r:"\r",t:" ",b:"\b",f:"\f",v:"\v"},Zr=()=>{let r=[];for(let t="",e;(e=c.charCodeAt(u))!==er;)e?e===ee?(h(),t+=oe[c[u]]||c[u],h()):e===re&&c.charCodeAt(u+1)===te?(t&&r.push([,t]),t="",h(2),r.push(A(0,125))):(t+=c[u],h(),e=c.charCodeAt(u),e===er&&t&&r.push([,t])):R("Unterminated template");return h(),r},ne=T[er];T[er]=(r,t)=>r&&t<bt?m.asi&&m.newline?void 0:(h(),["``",r,...Zr()]):r?ne?.(r,t):(h(),(e=>e.length<2&&e[0]?.[0]===void 0?e[0]||[,""]:["`",...e])(Zr()));m.string["'"]=!0;m.number={"0x":16,"0b":2,"0o":8};var ie=92,se=117,pe=123,fe=125,ue=183,le=m.id,qr=r=>r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102,me=(r=u+2,t,e=0,o=0)=>{if(c.charCodeAt(u)!==ie||c.charCodeAt(u+1)!==se)return 0;if(c.charCodeAt(r)===pe){for(;qr(t=c.charCodeAt(++r));)e=e*16+(t<=57?t-48:(t&31)+9);return r>u+3&&e<=1114111&&c.charCodeAt(r)===fe?r-u+1:0}for(;o<4&&qr(c.charCodeAt(r+o));)o++;return o===4?6:0};m.id=r=>le(r)||r===ue||me();var gr=5,ce=10,Cr=r=>{let t=u,e=A(ce-1);return e==null?r:r==="let"&&(e==="in"||e==="of")?(P(t),r):e[0]==="in"||e[0]==="of"?[e[0],[r,e[1]],e[2]]:e[0]===","?[r,...e.slice(1)]:[r,e]};C("let",gr+1,()=>Cr("let"));C("const",gr+1,()=>Cr("const"));C("var",gr+1,()=>Cr("var"));var or=5,de=59,L=()=>(a()===123||R("Expected {"),h(),A(or-.5,125)||null),D=()=>a()!==123?A(or+.5):(h(),A(or-.5,125)||null),ae=()=>{let r=u;return a()===de&&h(),a(),I("else")?(h(4),!0):(P(r),!1)};C("if",or+1,()=>{a();let r=["if",v(),D()];return ae()&&r.push(D()),r});var he=200;C("function",he,()=>{a();let r=!1;c[u]==="*"&&(r=!0,h(),a());let t=N(m.id);return t&&a(),r?["function*",t,v()||null,L()]:["function",t,v()||null,L()]});var nr=140,wr=20;O("await",nr);C("yield",nr,()=>(a(),c[u]==="*"?(h(),a(),["yield*",A(wr)]):["yield",A(wr)]));C("async",nr,()=>{if(a(),I("function"))return["async",A(nr)];let r=A(wr-.5);return r&&["async",r]});var Er=200,Ae=140,ye=90;O("static",Ae);y("instanceof",ye);k("#",Er,r=>{if(r)return;let t=N(m.id);return t?"#"+t:void 0});C("class",Er,()=>{a();let r=N(m.id)||null;if(r==="extends")r=null,a();else{if(a(),!I("extends"))return["class",r,null,L()];h(7),a()}return["class",r,A(Er),L()]});var ge=140,Sr=47,Ce=92,we=r=>r===Ce?2:r&&r!==Sr,Ee=r=>r===103||r===105||r===109||r===115||r===117||r===121;k("/",ge,r=>{if(r)return;let t=c.charCodeAt(u);if(t===Sr||t===42||t===43||t===63||t===61)return;let e=N(we);c.charCodeAt(u)===Sr||R("Unterminated regex"),h();let o=N(Ee);try{new RegExp(e,o)}catch(n){R("Invalid regex: "+n.message)}return o?["//",e,o]:["//",e]});var H=5,J=125,V=59;C("while",H+1,()=>(a(),["while",v(),D()]));C("do",H+1,()=>(r=>(a(),h(5),a(),["do",r,v()]))(D()));C("for",H+1,()=>(a(),I("await")?(h(5),a(),["for await",v(),D()]):["for",v(),D()]));C("break",H+1,()=>{m.asi&&(m.newline=!1);let r=u;a();let t=c.charCodeAt(u);if(!t||t===J||t===V||m.newline)return["break"];let e=N(m.id);if(!e)return["break"];a();let o=c.charCodeAt(u);return!o||o===J||o===V||m.newline?["break",e]:(P(r),["break"])});C("continue",H+1,()=>{m.asi&&(m.newline=!1);let r=u;a();let t=c.charCodeAt(u);if(!t||t===J||t===V||m.newline)return["continue"];let e=N(m.id);if(!e)return["continue"];a();let o=c.charCodeAt(u);return!o||o===J||o===V||m.newline?["continue",e]:(P(r),["continue"])});C("return",H+1,()=>{m.asi&&(m.newline=!1);let r=a();return!r||r===J||r===V||m.newline?["return"]:["return",A(H)]});var kr=5;C("try",kr+1,()=>{let r=["try",L()];return a(),I("catch")&&(h(5),a(),r.push(["catch",Y()===40?v():null,L()])),a(),I("finally")&&(h(7),r.push(["finally",L()])),r});C("throw",kr+1,()=>{if(m.asi&&(m.newline=!1),a(),m.newline)throw SyntaxError("Unexpected newline after throw");return["throw",A(kr)]});var tt=5,Se=20,br=58,ke=59,et=125,Ir=0,ot=(r,t=r.length,e=r.charCodeAt(0),o=T[e])=>T[e]=(n,s,l)=>I(r)&&!n&&Ir||o?.(n,s,l);ot("case");ot("default");var rt=r=>{let t=[];for(;(r=a())!==et&&!I("case")&&!I("default");){if(r===ke){h();continue}t.push(A(tt-.5))||R()}return t.length>1?[";",...t]:t[0]||null},Ie=()=>{a()===123||R("Expected {"),h(),Ir++;let r=[];try{for(;a()!==et;)if(I("case")){P(u+4),a();let t=A(Se-.5);a()===br&&h(),r.push(["case",t,rt()])}else I("default")?(P(u+7),a()===br&&h(),r.push(["default",rt()])):R("Expected case or default")}finally{Ir--}return h(),r};C("switch",tt+1,()=>a()===40&&["switch",v(),...Ie()]);var nt=5;C("debugger",nt+1,()=>["debugger"]);C("with",nt+1,()=>(a(),["with",v(),D()]));var Tr=5,Q=10,it=42,Te=T[it];T[it]=(r,t)=>r?Te?.(r,t):(h(),"*");k("from",Q+1,r=>r?r[0]!=="="&&r[0]!==","&&(a(),["from",r,A(Q+1)]):!1);k("as",Q+2,r=>r?(a(),["as",r,A(Q+2)]):!1);C("import",Tr,()=>I(".meta")?(h(5),["import.meta"]):["import",A(Q)]);C("export",Tr,()=>(a(),I("default")?(h(7),["export",["default",A(Q)]]):["export",A(Tr)]));var Nr=20,Ne=40,st=41,pt=123,ft=125,ut=r=>t=>{if(t)return;a();let e=N(m.id);if(!e||(a(),c.charCodeAt(u)!==Ne))return!1;h();let o=A(0,st);return a(),c.charCodeAt(u)!==pt?!1:(h(),[r,e,o,A(0,ft)])};k("get",Nr-1,ut("get"));k("set",Nr-1,ut("set"));k("(",Nr-1,r=>{if(!r||typeof r!="string")return;let t=A(0,st)||null;if(a(),c.charCodeAt(u)===pt)return h(),[":",r,["=>",["()",t],A(0,ft)||null]]});m.comment["#!"]=`
|
|
9
|
+
`;var mt=32,Or=10,Re=59,_e=125,Oe=91,Pe=40,_r=$.asi??$[";"],ve=m._baseSpace??=m.space,Be=m._baseStep??=m.step,Le=(r,t)=>{for(;(t=c.charCodeAt(r))<=mt;){if(t===Or)return!0;r++}return!1},Me=(r=u,t)=>{for(;r-- >0&&(t=c.charCodeAt(r))<=mt;)if(t===Or)return!0;return!1};m.space=(r,t)=>{for(;;){for(t=u,r=ve();t<u;)if(c.charCodeAt(t++)===Or){m.newline=!0;break}if(r===Re&&Le(u+1)){P(u+1),m.newline=m.semi=!0;continue}return r}};m.enter=()=>m.newline=m.semi=!1;m.exit=(r,t)=>{t===_e&&(m.newline=!0)};m.step=(r,t,e,o)=>{if(m.semi&&t>=_r)return!1;if(r&&(m.semi||(e===Oe||e===Pe)&&Me()))return lt(r,t,o)??null;let n=m.newline;return Be(r,t,e,o)??(r&&n?lt(r,t,o)??null:null)};var Rr=0,Ue=2e3,lt=m.asi=(r,t,e,o,n)=>{if(t>=_r||Rr>=Ue)return;m.semi=!1;let s=u;Rr++;try{o=e(_r-.5)}finally{Rr--}if(!(!o||u===s))return n=o?.[0]===";"?o.slice(1):[o],r?.[0]===";"?(r.push(...n),r):[";",r,...n]};var dt=(r,t,e,o)=>typeof r=="string"?n=>t(n,r,n):r[0]==="."?(e=i(r[1]),o=r[2],n=>t(e(n),o,n)):r[0]==="[]"&&r.length===3?(e=i(r[1]),o=i(r[2]),n=>t(e(n),o(n),n)):r[0]==="()"&&r.length===2?dt(r[1],t):(()=>{throw Error("Invalid assignment target")})(),ct={"=":(r,t,e)=>r[t]=e,"+=":(r,t,e)=>r[t]+=e,"-=":(r,t,e)=>r[t]-=e,"*=":(r,t,e)=>r[t]*=e,"/=":(r,t,e)=>r[t]/=e,"%=":(r,t,e)=>r[t]%=e,"|=":(r,t,e)=>r[t]|=e,"&=":(r,t,e)=>r[t]&=e,"^=":(r,t,e)=>r[t]^=e,">>=":(r,t,e)=>r[t]>>=e,"<<=":(r,t,e)=>r[t]<<=e};for(let r in ct)p(r,(t,e)=>(e=i(e),dt(t,(o,n,s)=>ct[r](o,n,e(s)))));p("!",r=>(r=i(r),t=>!r(t)));p("||",(r,t)=>(r=i(r),t=i(t),e=>r(e)||t(e)));p("&&",(r,t)=>(r=i(r),t=i(t),e=>r(e)&&t(e)));p("~",r=>(r=i(r),t=>~r(t)));p("|",(r,t)=>(r=i(r),t=i(t),e=>r(e)|t(e)));p("&",(r,t)=>(r=i(r),t=i(t),e=>r(e)&t(e)));p("^",(r,t)=>(r=i(r),t=i(t),e=>r(e)^t(e)));p(">>",(r,t)=>(r=i(r),t=i(t),e=>r(e)>>t(e)));p("<<",(r,t)=>(r=i(r),t=i(t),e=>r(e)<<t(e)));p(">",(r,t)=>(r=i(r),t=i(t),e=>r(e)>t(e)));p("<",(r,t)=>(r=i(r),t=i(t),e=>r(e)<t(e)));p(">=",(r,t)=>(r=i(r),t=i(t),e=>r(e)>=t(e)));p("<=",(r,t)=>(r=i(r),t=i(t),e=>r(e)<=t(e)));p("==",(r,t)=>(r=i(r),t=i(t),e=>r(e)==t(e)));p("!=",(r,t)=>(r=i(r),t=i(t),e=>r(e)!=t(e)));p("+",(r,t)=>t!==void 0?(r=i(r),t=i(t),e=>r(e)+t(e)):(r=i(r),e=>+r(e)));p("-",(r,t)=>t!==void 0?(r=i(r),t=i(t),e=>r(e)-t(e)):(r=i(r),e=>-r(e)));p("*",(r,t)=>(r=i(r),t=i(t),e=>r(e)*t(e)));p("/",(r,t)=>(r=i(r),t=i(t),e=>r(e)/t(e)));p("%",(r,t)=>(r=i(r),t=i(t),e=>r(e)%t(e)));var Pr=(r,t,e,o)=>typeof r=="string"?n=>t(n,r):r[0]==="."?(e=i(r[1]),o=r[2],n=>t(e(n),o)):r[0]==="[]"&&r.length===3?(e=i(r[1]),o=i(r[2]),n=>t(e(n),o(n))):r[0]==="()"&&r.length===2?Pr(r[1],t):(()=>{throw Error("Invalid increment target")})();p("++",(r,t)=>Pr(r,t===null?(e,o)=>e[o]++:(e,o)=>++e[o]));p("--",(r,t)=>Pr(r,t===null?(e,o)=>e[o]--:(e,o)=>--e[o]));var at=(...r)=>(r=r.map(i),t=>{let e;for(let o of r)e=o(t);return e});p(",",at);p(";",at);var F=r=>r?.[0]==="_"&&r[1]==="_"||r==="constructor"||r==="prototype",ir=r=>{throw Error(r)};p("[]",(r,t)=>t===void 0?(r=r?r[0]===","?r.slice(1):[r]:[],r=r.map(e=>e==null?(()=>{}):e[0]==="..."?(e=i(e[1]),o=>e(o)):(e=i(e),o=>[e(o)])),e=>r.flatMap(o=>o(e))):(t==null&&ir("Missing index"),r=i(r),t=i(t),e=>{let o=t(e);return F(o)?void 0:r(e)[o]}));p(".",(r,t)=>(r=i(r),t=t[0]?t:t[1],F(t)?()=>{}:e=>r(e)[t]));p("()",(r,t)=>{if(t===void 0)return r==null?ir("Empty ()"):i(r);let e=n=>n?.[0]===","&&n.slice(1).some(s=>s==null||e(s));e(t)&&ir("Empty argument");let o=t?t[0]===","?(t=t.slice(1).map(i),n=>t.map(s=>s(n))):(t=i(t),n=>[t(n)]):()=>[];return vr(r,(n,s,l)=>n[s](...o(l)))});var M=r=>typeof r=="string"||Array.isArray(r)&&(r[0]==="."||r[0]==="?."||r[0]==="[]"&&r.length===3||r[0]==="?.[]"||r[0]==="()"&&r.length===2&&M(r[1])||r[0]==="{}"),vr=(r,t,e,o)=>r==null?ir("Empty ()"):r[0]==="()"&&r.length==2?vr(r[1],t):typeof r=="string"?n=>t(n,r,n):r[0]==="."?(e=i(r[1]),o=r[2],n=>t(e(n),o,n)):r[0]==="?."?(e=i(r[1]),o=r[2],n=>{let s=e(n);return s==null?void 0:t(s,o,n)}):r[0]==="[]"&&r.length===3?(e=i(r[1]),o=i(r[2]),n=>t(e(n),o(n),n)):r[0]==="?.[]"?(e=i(r[1]),o=i(r[2]),n=>{let s=e(n);return s==null?void 0:t(s,o(n),n)}):(r=i(r),n=>t([r(n)],0,n)),G=vr;p("===",(r,t)=>(r=i(r),t=i(t),e=>r(e)===t(e)));p("!==",(r,t)=>(r=i(r),t=i(t),e=>r(e)!==t(e)));p("??",(r,t)=>(r=i(r),t=i(t),e=>r(e)??t(e)));var De=r=>{throw Error(r)};p("**",(r,t)=>(r=i(r),t=i(t),e=>r(e)**t(e)));p("**=",(r,t)=>(M(r)||De("Invalid assignment target"),t=i(t),G(r,(e,o,n)=>e[o]**=t(n))));p("in",(r,t)=>(r=i(r),t=i(t),e=>r(e)in t(e)));var Fe=r=>{throw Error(r)};p(">>>",(r,t)=>(r=i(r),t=i(t),e=>r(e)>>>t(e)));p(">>>=",(r,t)=>(M(r)||Fe("Invalid assignment target"),t=i(t),G(r,(e,o,n)=>e[o]>>>=t(n))));var Ge=r=>r[0]?.[0]===","?r[0].slice(1):r,X=(r,t,e)=>{if(typeof r=="string"){e[r]=t;return}let[o,...n]=r,s=Ge(n);if(o==="{}"){let l=[];for(let f of s){if(Array.isArray(f)&&f[0]==="..."){let w={};for(let _ in t)l.includes(_)||(w[_]=t[_]);e[f[1]]=w;break}let d,g,E;typeof f=="string"?d=g=f:f[0]==="="?(typeof f[1]=="string"?d=g=f[1]:[,d,g]=f[1],E=f[2]):[,d,g]=f,l.push(d);let S=t[d];S===void 0&&E&&(S=i(E)(e)),X(g,S,e)}}else if(o==="[]"){let l=0;for(let f of s){if(f===null){l++;continue}if(Array.isArray(f)&&f[0]==="..."){e[f[1]]=t.slice(l);break}let d=f,g;Array.isArray(f)&&f[0]==="="&&([,d,g]=f);let E=t[l++];E===void 0&&g&&(E=i(g)(e)),X(d,E,e)}}},Br=(...r)=>(r=r.map(t=>{if(typeof t=="string")return e=>{e[t]=void 0};if(t[0]==="="){let[,e,o]=t,n=i(o);return typeof e=="string"?s=>{s[e]=n(s)}:s=>X(e,n(s),s)}return i(t)}),t=>{for(let e of r)e(t)});p("let",Br);p("const",Br);p("var",Br);var sr=r=>{throw Error(r)};p("=",(r,t)=>{if(Array.isArray(r)&&(r[0]==="let"||r[0]==="const"||r[0]==="var")){let e=r[1];return t=i(t),typeof e=="string"?o=>{o[e]=t(o)}:o=>X(e,t(o),o)}return M(r)||sr("Invalid assignment target"),t=i(t),G(r,(e,o,n)=>e[o]=t(n))});p("||=",(r,t)=>(M(r)||sr("Invalid assignment target"),t=i(t),G(r,(e,o,n)=>e[o]||=t(n))));p("&&=",(r,t)=>(M(r)||sr("Invalid assignment target"),t=i(t),G(r,(e,o,n)=>e[o]&&=t(n))));p("??=",(r,t)=>(M(r)||sr("Invalid assignment target"),t=i(t),G(r,(e,o,n)=>e[o]??=t(n))));p("?",(r,t,e)=>(r=i(r),t=i(t),e=i(e),o=>r(o)?t(o):e(o)));var B=[];p("=>",(r,t)=>{r=r?.[0]==="()"?r[1]:r;let e=r?r[0]===","?r.slice(1):[r]:[],o=-1,n=null,s=e[e.length-1];Array.isArray(s)&&s[0]==="..."&&(o=e.length-1,n=s[1],e.length--);let l=t?.[0]==="{}";return t=i(l?["{",t[1]]:t),f=>(...d)=>{let g={};e.forEach((S,w)=>g[S]=d[w]),n&&(g[n]=d.slice(o));let E=new Proxy(g,{get:(S,w)=>w in S?S[w]:f?.[w],set:(S,w,_)=>((w in S?S:f)[w]=_,!0),has:(S,w)=>w in S||(f?w in f:!1)});try{let S=t(E);return l?void 0:S}catch(S){if(S===B)return S[0];throw S}}});p("...",r=>(r=i(r),t=>Object.entries(r(t))));p("?.",(r,t)=>(r=i(r),F(t)?()=>{}:e=>r(e)?.[t]));p("?.[]",(r,t)=>(r=i(r),t=i(t),e=>{let o=t(e);return F(o)?void 0:r(e)?.[o]}));p("?.()",(r,t)=>{let e=t?t[0]===","?(t=t.slice(1).map(i),n=>t.map(s=>s(n))):(t=i(t),n=>[t(n)]):()=>[];if(r[0]==="?."){let n=i(r[1]),s=r[2];return F(s)?()=>{}:l=>n(l)?.[s]?.(...e(l))}if(r[0]==="?.[]"){let n=i(r[1]),s=i(r[2]);return l=>{let f=n(l),d=s(l);return F(d)?void 0:f?.[d]?.(...e(l))}}if(r[0]==="."){let n=i(r[1]),s=r[2];return F(s)?()=>{}:l=>n(l)?.[s]?.(...e(l))}if(r[0]==="[]"&&r.length===3){let n=i(r[1]),s=i(r[2]);return l=>{let f=n(l),d=s(l);return F(d)?void 0:f?.[d]?.(...e(l))}}let o=i(r);return n=>o(n)?.(...e(n))});p("typeof",r=>(r=i(r),t=>typeof r(t)));p("void",r=>(r=i(r),t=>(r(t),void 0)));p("delete",r=>{if(r[0]==="."){let t=i(r[1]),e=r[2];return o=>delete t(o)[e]}if(r[0]==="[]"){let t=i(r[1]),e=i(r[2]);return o=>delete t(o)[e(o)]}return()=>!0});p("new",r=>{let t=i(r?.[0]==="()"?r[1]:r),e=r?.[0]==="()"?r[2]:null,o=e?e[0]===","?(n=>s=>n.map(l=>l(s)))(e.slice(1).map(i)):(n=>s=>[n(s)])(i(e)):()=>[];return n=>new(t(n))(...o(n))});var pr=Symbol("accessor");p("get",(r,t)=>(t=t?i(t):()=>{},e=>[[pr,r,{get:function(){let o=Object.create(e||{});return o.this=this,t(o)}}]]));p("set",(r,t,e)=>(e=e?i(e):()=>{},o=>[[pr,r,{set:function(n){let s=Object.create(o||{});s.this=this,s[t]=n,e(s)}}]]));var Xe=r=>r==null||typeof r=="string"||[":",",","...","get","set"].includes(r[0]);p("{}",(r,t)=>{if(t!==void 0)return;if(!Xe(r))return i(["{",r]);r=r?r[0]!==","?[r]:r.slice(1):[];let e=r.map(o=>i(typeof o=="string"?[":",o,o]:o));return o=>{let n={},s={};for(let l of e.flatMap(f=>f(o)))if(l[0]===pr){let[,f,d]=l;s[f]={...s[f],...d,configurable:!0,enumerable:!0}}else n[l[0]]=l[1];for(let l in s)Object.defineProperty(n,l,s[l]);return n}});p("{",r=>(r=r?i(r):()=>{},t=>r(Object.create(t))));p(":",(r,t)=>(t=i(t),Array.isArray(r)?(r=i(r),e=>[[r(e),t(e)]]):e=>[[r,t(e)]]));p("`",(...r)=>(r=r.map(i),t=>r.map(e=>e(t)).join("")));p("``",(r,...t)=>{r=i(r);let e=[],o=[];for(let s of t)Array.isArray(s)&&s[0]===void 0?e.push(s[1]):o.push(i(s));let n=Object.assign([...e],{raw:e});return s=>r(s)(n,...o.map(l=>l(s)))});p("function",(r,t,e)=>{e=e?i(e):()=>{};let o=t?t[0]===","?t.slice(1):[t]:[],n=null,s=-1,l=o[o.length-1];return Array.isArray(l)&&l[0]==="..."&&(s=o.length-1,n=l[1],o.length--),f=>{let d=(...g)=>{let E={};o.forEach((w,_)=>E[w]=g[_]),n&&(E[n]=g.slice(s));let S=new Proxy(E,{get:(w,_)=>_ in w?w[_]:f[_],set:(w,_,yt)=>((_ in w?w:f)[_]=yt,!0),has:(w,_)=>_ in w||_ in f});try{return e(S)}catch(w){if(w===B)return w[0];throw w}};return r&&(f[r]=d),d}});p("function*",(r,t,e)=>{throw Error("Generator functions are not supported in evaluation")});p("async",r=>{let t=i(r);return e=>{let o=t(e);return async function(...n){return o(...n)}}});p("await",r=>(r=i(r),async t=>await r(t)));p("yield",r=>(r=r?i(r):null,t=>{throw{__yield__:r?r(t):void 0}}));p("yield*",r=>(r=i(r),t=>{throw{__yield_all__:r(t)}}));var Ke=Symbol("static"),He=r=>{throw Error(r)};p("instanceof",(r,t)=>(r=i(r),t=i(t),e=>r(e)instanceof t(e)));p("class",(r,t,e)=>(t=t?i(t):null,e=e?i(e):null,o=>{let n=t?t(o):Object,s=function(...l){if(!(this instanceof s))return He("Class constructor must be called with new");let f=t?Reflect.construct(n,l,s):this;return s.prototype.__constructor__&&s.prototype.__constructor__.apply(f,l),f};if(Object.setPrototypeOf(s.prototype,n.prototype),Object.setPrototypeOf(s,n),e){let l=Object.create(o);l.super=n;let f=e(l),d=Array.isArray(f)&&typeof f[0]?.[0]=="string"?f:[];for(let[g,E]of d)g==="constructor"?s.prototype.__constructor__=E:s.prototype[g]=E}return r&&(o[r]=s),s}));p("static",r=>(r=i(r),t=>[[Ke,r(t)]]));p("//",(r,t)=>{let e=new RegExp(r,t||"");return()=>e});p("if",(r,t,e)=>(r=i(r),t=i(t),e=e!==void 0?i(e):null,o=>r(o)?t(o):e?.(o)));var U=Symbol("break"),K=Symbol("continue");p("while",(r,t)=>(r=i(r),t=i(t),e=>{let o;for(;r(e);)try{o=t(e)}catch(n){if(n===U)break;if(n===K)continue;if(n===B)return n[0];throw n}return o}));p("do",(r,t)=>(r=i(r),t=i(t),e=>{let o;do try{o=r(e)}catch(n){if(n===U)break;if(n===K)continue;if(n===B)return n[0];throw n}while(t(e));return o}));p("for",(r,t)=>{if(Array.isArray(r)&&r[0]===";"){let[,e,o,n]=r;return e=e?i(e):null,o=o?i(o):()=>!0,n=n?i(n):null,t=i(t),s=>{let l;for(e?.(s);o(s);n?.(s))try{l=t(s)}catch(f){if(f===U)break;if(f===K)continue;if(f===B)return f[0];throw f}return l}}if(Array.isArray(r)&&(r[0]==="in"||r[0]==="of")){let[e,o,n]=r;if(Array.isArray(o)&&(o[0]==="let"||o[0]==="const"||o[0]==="var")&&(o=o[1]),e==="in")return Qe(o,n,t);if(e==="of")return je(o,n,t)}});var je=(r,t,e)=>{t=i(t),e=i(e);let o=Array.isArray(r);return n=>{let s,l=o?null:n[r];for(let f of t(n)){o?X(r,f,n):n[r]=f;try{s=e(n)}catch(d){if(d===U)break;if(d===K)continue;if(d===B)return d[0];throw d}}return o||(n[r]=l),s}},Qe=(r,t,e)=>{t=i(t),e=i(e);let o=Array.isArray(r);return n=>{let s,l=o?null:n[r];for(let f in t(n)){o?X(r,f,n):n[r]=f;try{s=e(n)}catch(d){if(d===U)break;if(d===K)continue;if(d===B)return d[0];throw d}}return o||(n[r]=l),s}};p("break",()=>()=>{throw U});p("continue",()=>()=>{throw K});p("return",r=>(r=r!==void 0?i(r):null,t=>{throw B[0]=r?.(t),B}));p("try",(r,...t)=>{r=r?i(r):null;let e=t.find(f=>f?.[0]==="catch"),o=t.find(f=>f?.[0]==="finally"),n=e?.[1],s=e?.[2]?i(e[2]):null,l=o?.[1]?i(o[1]):null;return f=>{let d;try{d=r?.(f)}catch(g){if(g===U||g===K||g===B)throw g;if(n!=null&&s){let E=n in f,S=f[n];f[n]=g;try{d=s(f)}finally{E?f[n]=S:delete f[n]}}else if(!s)throw g}finally{l?.(f)}return d}});p("throw",r=>(r=i(r),t=>{throw r(t)}));p("switch",(r,...t)=>(r=i(r),t.length?(t=t.map(e=>[e[0]==="case"?i(e[1]):null,(e[0]==="case"?e[2]:e[1])?.[0]===";"?(e[0]==="case"?e[2]:e[1]).slice(1).map(i):(e[0]==="case"?e[2]:e[1])?[i(e[0]==="case"?e[2]:e[1])]:[]]),e=>{let o=r(e),n=!1,s;for(let[f,d]of t)if(n||f===null||f(e)===o)for(n=!0,l=0;l<d.length;l++)try{s=d[l](e)}catch(g){if(g===U)return s;throw g}var l;return s}):e=>r(e)));p("import",()=>()=>{});p("export",()=>()=>{});p("from",(r,t)=>()=>{});p("as",(r,t)=>()=>{});p("default",r=>i(r));var ht=new WeakMap,$e=(r,...t)=>typeof r=="string"?i(m(r)):ht.get(r)||ht.set(r,xe(r,t)).get(r),At=57344,xe=(r,t)=>{let e=r.reduce((s,l,f)=>s+(f?String.fromCharCode(At+f-1):"")+l,""),o=m(e),n=s=>{if(typeof s=="string"&&s.length===1){let l=s.charCodeAt(0)-At,f;if(l>=0&&l<t.length)return f=t[l],We(f)?f:[,f]}return Array.isArray(s)?s.map(n):s};return i(n(o))},We=r=>typeof r=="string"||Array.isArray(r)&&(typeof r[0]=="string"||r[0]===void 0),ze=$e;export{mr as access,y as binary,i as compile,c as cur,ze as default,R as err,A as expr,x as group,Je as id,u as idx,C as keyword,j as literal,Lr as loc,T as lookup,lr as nary,N as next,p as operator,ur as operators,v as parens,m as parse,Y as peek,$ as prec,P as seek,h as skip,a as space,fr as step,k as token,O as unary,I as word};
|
package/justin.min.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
var u,l,A=r=>(u=0,l=r,A.enter?.(),r=y(),l[u]?v():r||""),v=(r="Unexpected token",t=u,e=l.slice(0,t).split(`
|
|
2
2
|
`),o=e.pop(),i=l.slice(Math.max(0,t-40),t),p="\u032D",m=(l[t]||" ")+p,f=l.slice(t+1,t+20))=>{throw SyntaxError(`${r} at ${e.length+1}:${o.length+1}
|
|
3
3
|
${l[t-41]!==`
|
|
4
|
-
`,""+i}${m}${f}`)},pr=(r,t=u)=>(Array.isArray(r)&&(r.loc=t),r),R=(r,t=u,e)=>{for(;e=r(l.charCodeAt(u));)u+=e;return l.slice(t,u)},C=(r=1)=>l[u+=r],
|
|
4
|
+
`,""+i}${m}${f}`)},pr=(r,t=u)=>(Array.isArray(r)&&(r.loc=t),r),R=(r,t=u,e)=>{for(;e=r(l.charCodeAt(u));)u+=e;return l.slice(t,u)},C=(r=1)=>l[u+=r],D=r=>u=r,y=(r=0,t)=>{let e,o,i;for(t&&A.enter?.(r,t);(e=U())&&e!==t&&(i=J(o,r,e,y));)o=i;return t&&(e==t?(u++,A.exit?.(r,t)):v("Unclosed "+String.fromCharCode(t-(t>42?2:1)))),o},J=(r,t,e,o,i)=>(i=w[e])&&i(r,t)||(r?null:R(A.id)||null),U=r=>{for(;(r=l.charCodeAt(u))<=32;)u++;return r},mr=(r=u)=>{for(;l.charCodeAt(r)<=32;)r++;return l.charCodeAt(r)},Lt=A.id=r=>r>=48&&r<=57||r>=65&&r<=90||r>=97&&r<=122||r==36||r==95||r>=192&&r!=215&&r!=247,fr=(r,t=r.length)=>l.substr(u,t)===r&&!A.id(l.charCodeAt(u+t)),Tt=()=>(C(),y(0,41)),w=[],sr={},I=(r,t=32,e,o=r.charCodeAt(0),i=r.length,p=w[o],m=r.toUpperCase()!==r,f,d)=>(t=sr[r]=!p&&sr[r]||t,w[o]=(g,S,h,E=u)=>(f=h,(h?r==h:(i<2||r.charCodeAt(1)===l.charCodeAt(u+1)&&(i<3||l.substr(u,i)==r))&&(!m||!A.id(l.charCodeAt(u+i)))&&(f=h=r))&&S<t&&(u+=i,(d=e(g))?pr(d,E):(u=E,f=0,!m&&!p&&!g&&v()),d)||p?.(g,S,f))),c=(r,t,e=!1)=>I(r,t,o=>o&&(i=>i&&[r,o,i])(y(t-(e?.5:0)))),k=(r,t,e)=>I(r,t,o=>e?o&&[r,o]:!o&&(o=y(t-.5))&&[r,o]),L=(r,t)=>I(r,200,e=>!e&&[,t]),Y=(r,t,e)=>I(r,t,(o,i)=>(i=y(t-(e?.5:0)),o?.[0]!==r&&(o=[r,o||null]),i?.[0]===r?o.push(...i.slice(1)):o.push(i||null),o)),_=(r,t)=>I(r[0],t,e=>!e&&[r,y(0,r.charCodeAt(1))||null]),Z=(r,t)=>I(r[0],t,e=>e&&[r,e,y(0,r.charCodeAt(1))||null]),F=(r,t,e,o=r.charCodeAt(0),i=r.length,p=w[o],m)=>w[o]=(f,d,g,S=u)=>!f&&(g?r==g:(i<2||l.substr(u,i)==r)&&(g=r))&&d<t&&!A.id(l.charCodeAt(u+i))&&(!A.prop||A.prop(u+i))&&(D(u+i),(m=e())?pr(m,S):D(S),m)||p?.(f,d,g);Object.defineProperty(A,"space",{configurable:!0,enumerable:!0,get:()=>U,set:r=>U=r});Object.defineProperty(A,"step",{configurable:!0,enumerable:!0,get:()=>J,set:r=>J=r});var V={},s=(r,t,e=V[r])=>V[r]=(...o)=>t(...o)||e?.(...o),n=r=>Array.isArray(r)?r[0]==null?(t=>()=>t)(r[1]):V[r[0]]?.(...r.slice(1))??v(`Unknown operator: ${r[0]}`,r?.loc):r===void 0?()=>{}:t=>t?.[r];var X=46,a=48,$=57,ar=69,Br=101,Mr=43,Dr=45,G=95,ur=110,Fr=97,Gr=102,Xr=65,$r=70,lr=r=>r.indexOf("_")<0?r:r.replaceAll("_",""),q=r=>{let t=lr(R(e=>e===X&&l.charCodeAt(u+1)!==X||e>=a&&e<=$||e===G||((e===ar||e===Br)&&((e=l.charCodeAt(u+1))>=a&&e<=$||e===Mr||e===Dr)?2:0)));return l.charCodeAt(u)===ur?(C(),[,BigInt(t)]):(r=+t)!=r?v():[,r]},jr={2:r=>r===48||r===49||r===G,8:r=>r>=48&&r<=55||r===G,16:r=>r>=a&&r<=$||r>=Fr&&r<=Gr||r>=Xr&&r<=$r||r===G};A.number=null;w[X]=r=>!r&&l.charCodeAt(u+1)!==X&&q();for(let r=a;r<=$;r++)w[r]=t=>t?void 0:q();w[a]=r=>{if(r)return;let t=A.number;if(t){for(let[e,o]of Object.entries(t))if(e[0]==="0"&&l[u+1]?.toLowerCase()===e[1]){C(2);let i=lr(R(jr[o]));return l.charCodeAt(u)===ur?(C(),[,BigInt("0"+e[1]+i)]):[,parseInt(i,o)]}}return q()};var Qr=92,cr=34,dr=39,Ar=117,gr=120,Hr=123,Kr=125,hr=10,Wr=13,zr={n:`
|
|
5
5
|
`,r:"\r",t:" ",b:"\b",f:"\f",v:"\v",0:"\0"},yr=r=>r>=48&&r<=57?r-48:r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:-1,Cr=r=>(t,e,o="",i=String.fromCharCode(r))=>{if(t||!A.string?.[i])return;C();let p=()=>{let m=l.charCodeAt(u+1);if(m===hr)return 2;if(m===Wr)return l.charCodeAt(u+2)===hr?3:2;if(m===gr||m===Ar&&l.charCodeAt(u+2)!==Hr){let f=m===gr?2:4,d=0,g;for(let S=0;S<f;S++){if((g=yr(l.charCodeAt(u+2+S)))<0)return o+=l[u+1],2;d=d*16+g}return o+=String.fromCharCode(d),2+f}if(m===Ar){let f=0,d=u+3,g;for(;(g=yr(l.charCodeAt(d)))>=0;)f=f*16+g,d++;return d>u+3&&f<=1114111&&l.charCodeAt(d)===Kr?(o+=String.fromCodePoint(f),d-u+1):(o+=l[u+1],2)}return o+=zr[l[u+1]]||l[u+1],2};return R(m=>m-r&&(m!==Qr?(o+=l[u],1):p())),l[u]===i?C():v("Bad string"),[,o]};w[cr]=Cr(cr);w[dr]=Cr(dr);A.string={'"':!0};var Jr=20;"= += -= *= /= %= |= &= ^= >>= <<=".split(" ").map(r=>c(r,Jr,!0));var Vr=30,Yr=40,Zr=140;k("!",Zr);c("||",Vr);c("&&",Yr);var qr=50,xr=60,br=70,Sr=100,rt=140;c("|",qr);c("&",br);c("^",xr);c(">>",Sr);c("<<",Sr);k("~",rt);var j=90;c("<",j);c(">",j);c("<=",j);c(">=",j);var Er=80;c("==",Er);c("!=",Er);var wr=110,x=120,Ir=140;c("+",wr);c("-",wr);c("*",x);c("/",x);c("%",x);k("+",Ir);k("-",Ir);var Q=150;I("++",Q,r=>r?["++",r,null]:["++",y(Q-1)]);I("--",Q,r=>r?["--",r,null]:["--",y(Q-1)]);var tt=5,et=10;Y(",",et);Y(";",tt,!0);var ot=170;_("()",ot);var b=170;Z("[]",b);c(".",b);Z("()",b);var nt=32,it=A.space;A.comment??={"//":`
|
|
6
6
|
`,"/*":"*/"};var rr;A.space=()=>{rr||(rr=Object.entries(A.comment).map(([i,p])=>[i,p,i.charCodeAt(0)]));for(var r;r=it();){for(var t=0,e;e=rr[t++];)if(r===e[2]&&l.substr(u,e[0].length)===e[0]){var o=u+e[0].length;if(e[1]===`
|
|
7
|
-
`)for(;l.charCodeAt(o)>=nt;)o++;else{for(;l[o]&&l.substr(o,e[1].length)!==e[1];)o++;l[o]&&(o+=e[1].length)}
|
|
8
|
-
`,r:"\r",t:" ",b:"\b",f:"\f",v:"\v"},Pr=()=>{let r=[];for(let t="",e;(e=l.charCodeAt(u))!==H;)e?e===yt?(C(),t+=Ct[l[u]]||l[u],C()):e===gt&&l.charCodeAt(u+1)===ht?(t&&r.push([,t]),t="",C(2),r.push(y(0,125))):(t+=l[u],C(),e=l.charCodeAt(u),e===H&&t&&r.push([,t])):v("Unterminated template");return C(),r},St=w[H];w[H]=(r,t)=>r&&t<At?A.asi&&A.newline?void 0:(C(),["``",r,...Pr()]):r?St?.(r,t):(C(),(e=>e.length<2&&e[0]?.[0]===void 0?e[0]||[,""]:["`",...e])(Pr()));A.string["'"]=!0;A.number={"0x":16,"0b":2,"0o":8};var Lr=(r,t,e,o)=>typeof r=="string"?i=>t(i,r,i):r[0]==="."?(e=n(r[1]),o=r[2],i=>t(e(i),o,i)):r[0]==="[]"&&r.length===3?(e=n(r[1]),o=n(r[2]),i=>t(e(i),o(i),i)):r[0]==="()"&&r.length===2?Lr(r[1],t):(()=>{throw Error("Invalid assignment target")})(),Rr={"=":(r,t,e)=>r[t]=e,"+=":(r,t,e)=>r[t]+=e,"-=":(r,t,e)=>r[t]-=e,"*=":(r,t,e)=>r[t]*=e,"/=":(r,t,e)=>r[t]/=e,"%=":(r,t,e)=>r[t]%=e,"|=":(r,t,e)=>r[t]|=e,"&=":(r,t,e)=>r[t]&=e,"^=":(r,t,e)=>r[t]^=e,">>=":(r,t,e)=>r[t]>>=e,"<<=":(r,t,e)=>r[t]<<=e};for(let r in Rr)s(r,(t,e)=>(e=n(e),Lr(t,(o,i,p)=>Rr[r](o,i,e(p)))));s("!",r=>(r=n(r),t=>!r(t)));s("||",(r,t)=>(r=n(r),t=n(t),e=>r(e)||t(e)));s("&&",(r,t)=>(r=n(r),t=n(t),e=>r(e)&&t(e)));s("~",r=>(r=n(r),t=>~r(t)));s("|",(r,t)=>(r=n(r),t=n(t),e=>r(e)|t(e)));s("&",(r,t)=>(r=n(r),t=n(t),e=>r(e)&t(e)));s("^",(r,t)=>(r=n(r),t=n(t),e=>r(e)^t(e)));s(">>",(r,t)=>(r=n(r),t=n(t),e=>r(e)>>t(e)));s("<<",(r,t)=>(r=n(r),t=n(t),e=>r(e)<<t(e)));s(">",(r,t)=>(r=n(r),t=n(t),e=>r(e)>t(e)));s("<",(r,t)=>(r=n(r),t=n(t),e=>r(e)<t(e)));s(">=",(r,t)=>(r=n(r),t=n(t),e=>r(e)>=t(e)));s("<=",(r,t)=>(r=n(r),t=n(t),e=>r(e)<=t(e)));s("==",(r,t)=>(r=n(r),t=n(t),e=>r(e)==t(e)));s("!=",(r,t)=>(r=n(r),t=n(t),e=>r(e)!=t(e)));s("+",(r,t)=>t!==void 0?(r=n(r),t=n(t),e=>r(e)+t(e)):(r=n(r),e=>+r(e)));s("-",(r,t)=>t!==void 0?(r=n(r),t=n(t),e=>r(e)-t(e)):(r=n(r),e=>-r(e)));s("*",(r,t)=>(r=n(r),t=n(t),e=>r(e)*t(e)));s("/",(r,t)=>(r=n(r),t=n(t),e=>r(e)/t(e)));s("%",(r,t)=>(r=n(r),t=n(t),e=>r(e)%t(e)));var or=(r,t,e,o)=>typeof r=="string"?i=>t(i,r):r[0]==="."?(e=n(r[1]),o=r[2],i=>t(e(i),o)):r[0]==="[]"&&r.length===3?(e=n(r[1]),o=n(r[2]),i=>t(e(i),o(i))):r[0]==="()"&&r.length===2?or(r[1],t):(()=>{throw Error("Invalid increment target")})();s("++",(r,t)=>or(r,t===null?(e,o)=>e[o]++:(e,o)=>++e[o]));s("--",(r,t)=>or(r,t===null?(e,o)=>e[o]--:(e,o)=>--e[o]));var Tr=(...r)=>(r=r.map(n),t=>{let e;for(let o of r)e=o(t);return e});s(",",Tr);s(";",Tr);var
|
|
7
|
+
`)for(;l.charCodeAt(o)>=nt;)o++;else{for(;l[o]&&l.substr(o,e[1].length)!==e[1];)o++;l[o]&&(o+=e[1].length)}D(o),r=0;break}if(r)return r}return r};var kr=80;c("===",kr);c("!==",kr);var st=30;c("??",st);var pt=130,mt=20;c("**",pt,!0);c("**=",mt,!0);var vr=90;c("in",vr);c("of",vr);var ft=20,ut=100;c(">>>",ut);c(">>>=",ft,!0);var tr=20;c("||=",tr,!0);c("&&=",tr,!0);c("??=",tr,!0);L("true",!0);L("false",!1);L("null",null);F("undefined",200,()=>[]);L("NaN",NaN);L("Infinity",1/0);var er=20;I("?",er,(r,t,e)=>r&&(t=y(er-1))&&R(o=>o===58)&&(e=y(er-1),["?",r,t,e]));var lt=20;c("=>",lt,!0);var ct=20;k("...",ct);var Nr=170;I("?.",Nr,(r,t)=>{if(!r)return;let e=U();return e===40?(C(),["?.()",r,y(0,41)||null]):e===91?(C(),["?.[]",r,y(0,93)]):(t=y(Nr),t?["?.",r,t]:void 0)});var B=140;k("typeof",B);k("void",B);k("delete",B);F("new",B,()=>fr(".target")?(C(7),["new.target"]):["new",y(B)]);var dt=20,Or=200;A.prop=r=>mr(r)!==58;_("[]",Or);_("{}",Or);c(":",dt-1,!0);var At=170,H=96,gt=36,ht=123,yt=92,Ct={n:`
|
|
8
|
+
`,r:"\r",t:" ",b:"\b",f:"\f",v:"\v"},Pr=()=>{let r=[];for(let t="",e;(e=l.charCodeAt(u))!==H;)e?e===yt?(C(),t+=Ct[l[u]]||l[u],C()):e===gt&&l.charCodeAt(u+1)===ht?(t&&r.push([,t]),t="",C(2),r.push(y(0,125))):(t+=l[u],C(),e=l.charCodeAt(u),e===H&&t&&r.push([,t])):v("Unterminated template");return C(),r},St=w[H];w[H]=(r,t)=>r&&t<At?A.asi&&A.newline?void 0:(C(),["``",r,...Pr()]):r?St?.(r,t):(C(),(e=>e.length<2&&e[0]?.[0]===void 0?e[0]||[,""]:["`",...e])(Pr()));A.string["'"]=!0;A.number={"0x":16,"0b":2,"0o":8};var Lr=(r,t,e,o)=>typeof r=="string"?i=>t(i,r,i):r[0]==="."?(e=n(r[1]),o=r[2],i=>t(e(i),o,i)):r[0]==="[]"&&r.length===3?(e=n(r[1]),o=n(r[2]),i=>t(e(i),o(i),i)):r[0]==="()"&&r.length===2?Lr(r[1],t):(()=>{throw Error("Invalid assignment target")})(),Rr={"=":(r,t,e)=>r[t]=e,"+=":(r,t,e)=>r[t]+=e,"-=":(r,t,e)=>r[t]-=e,"*=":(r,t,e)=>r[t]*=e,"/=":(r,t,e)=>r[t]/=e,"%=":(r,t,e)=>r[t]%=e,"|=":(r,t,e)=>r[t]|=e,"&=":(r,t,e)=>r[t]&=e,"^=":(r,t,e)=>r[t]^=e,">>=":(r,t,e)=>r[t]>>=e,"<<=":(r,t,e)=>r[t]<<=e};for(let r in Rr)s(r,(t,e)=>(e=n(e),Lr(t,(o,i,p)=>Rr[r](o,i,e(p)))));s("!",r=>(r=n(r),t=>!r(t)));s("||",(r,t)=>(r=n(r),t=n(t),e=>r(e)||t(e)));s("&&",(r,t)=>(r=n(r),t=n(t),e=>r(e)&&t(e)));s("~",r=>(r=n(r),t=>~r(t)));s("|",(r,t)=>(r=n(r),t=n(t),e=>r(e)|t(e)));s("&",(r,t)=>(r=n(r),t=n(t),e=>r(e)&t(e)));s("^",(r,t)=>(r=n(r),t=n(t),e=>r(e)^t(e)));s(">>",(r,t)=>(r=n(r),t=n(t),e=>r(e)>>t(e)));s("<<",(r,t)=>(r=n(r),t=n(t),e=>r(e)<<t(e)));s(">",(r,t)=>(r=n(r),t=n(t),e=>r(e)>t(e)));s("<",(r,t)=>(r=n(r),t=n(t),e=>r(e)<t(e)));s(">=",(r,t)=>(r=n(r),t=n(t),e=>r(e)>=t(e)));s("<=",(r,t)=>(r=n(r),t=n(t),e=>r(e)<=t(e)));s("==",(r,t)=>(r=n(r),t=n(t),e=>r(e)==t(e)));s("!=",(r,t)=>(r=n(r),t=n(t),e=>r(e)!=t(e)));s("+",(r,t)=>t!==void 0?(r=n(r),t=n(t),e=>r(e)+t(e)):(r=n(r),e=>+r(e)));s("-",(r,t)=>t!==void 0?(r=n(r),t=n(t),e=>r(e)-t(e)):(r=n(r),e=>-r(e)));s("*",(r,t)=>(r=n(r),t=n(t),e=>r(e)*t(e)));s("/",(r,t)=>(r=n(r),t=n(t),e=>r(e)/t(e)));s("%",(r,t)=>(r=n(r),t=n(t),e=>r(e)%t(e)));var or=(r,t,e,o)=>typeof r=="string"?i=>t(i,r):r[0]==="."?(e=n(r[1]),o=r[2],i=>t(e(i),o)):r[0]==="[]"&&r.length===3?(e=n(r[1]),o=n(r[2]),i=>t(e(i),o(i))):r[0]==="()"&&r.length===2?or(r[1],t):(()=>{throw Error("Invalid increment target")})();s("++",(r,t)=>or(r,t===null?(e,o)=>e[o]++:(e,o)=>++e[o]));s("--",(r,t)=>or(r,t===null?(e,o)=>e[o]--:(e,o)=>--e[o]));var Tr=(...r)=>(r=r.map(n),t=>{let e;for(let o of r)e=o(t);return e});s(",",Tr);s(";",Tr);var O=r=>r?.[0]==="_"&&r[1]==="_"||r==="constructor"||r==="prototype",K=r=>{throw Error(r)};s("[]",(r,t)=>t===void 0?(r=r?r[0]===","?r.slice(1):[r]:[],r=r.map(e=>e==null?(()=>{}):e[0]==="..."?(e=n(e[1]),o=>e(o)):(e=n(e),o=>[e(o)])),e=>r.flatMap(o=>o(e))):(t==null&&K("Missing index"),r=n(r),t=n(t),e=>{let o=t(e);return O(o)?void 0:r(e)[o]}));s(".",(r,t)=>(r=n(r),t=t[0]?t:t[1],O(t)?()=>{}:e=>r(e)[t]));s("()",(r,t)=>{if(t===void 0)return r==null?K("Empty ()"):n(r);let e=i=>i?.[0]===","&&i.slice(1).some(p=>p==null||e(p));e(t)&&K("Empty argument");let o=t?t[0]===","?(t=t.slice(1).map(n),i=>t.map(p=>p(i))):(t=n(t),i=>[t(i)]):()=>[];return nr(r,(i,p,m)=>i[p](...o(m)))});var N=r=>typeof r=="string"||Array.isArray(r)&&(r[0]==="."||r[0]==="?."||r[0]==="[]"&&r.length===3||r[0]==="?.[]"||r[0]==="()"&&r.length===2&&N(r[1])||r[0]==="{}"),nr=(r,t,e,o)=>r==null?K("Empty ()"):r[0]==="()"&&r.length==2?nr(r[1],t):typeof r=="string"?i=>t(i,r,i):r[0]==="."?(e=n(r[1]),o=r[2],i=>t(e(i),o,i)):r[0]==="?."?(e=n(r[1]),o=r[2],i=>{let p=e(i);return p==null?void 0:t(p,o,i)}):r[0]==="[]"&&r.length===3?(e=n(r[1]),o=n(r[2]),i=>t(e(i),o(i),i)):r[0]==="?.[]"?(e=n(r[1]),o=n(r[2]),i=>{let p=e(i);return p==null?void 0:t(p,o(i),i)}):(r=n(r),i=>t([r(i)],0,i)),P=nr;s("===",(r,t)=>(r=n(r),t=n(t),e=>r(e)===t(e)));s("!==",(r,t)=>(r=n(r),t=n(t),e=>r(e)!==t(e)));s("??",(r,t)=>(r=n(r),t=n(t),e=>r(e)??t(e)));var Et=r=>{throw Error(r)};s("**",(r,t)=>(r=n(r),t=n(t),e=>r(e)**t(e)));s("**=",(r,t)=>(N(r)||Et("Invalid assignment target"),t=n(t),P(r,(e,o,i)=>e[o]**=t(i))));s("in",(r,t)=>(r=n(r),t=n(t),e=>r(e)in t(e)));var wt=r=>{throw Error(r)};s(">>>",(r,t)=>(r=n(r),t=n(t),e=>r(e)>>>t(e)));s(">>>=",(r,t)=>(N(r)||wt("Invalid assignment target"),t=n(t),P(r,(e,o,i)=>e[o]>>>=t(i))));var It=r=>r[0]?.[0]===","?r[0].slice(1):r,M=(r,t,e)=>{if(typeof r=="string"){e[r]=t;return}let[o,...i]=r,p=It(i);if(o==="{}"){let m=[];for(let f of p){if(Array.isArray(f)&&f[0]==="..."){let E={};for(let T in t)m.includes(T)||(E[T]=t[T]);e[f[1]]=E;break}let d,g,S;typeof f=="string"?d=g=f:f[0]==="="?(typeof f[1]=="string"?d=g=f[1]:[,d,g]=f[1],S=f[2]):[,d,g]=f,m.push(d);let h=t[d];h===void 0&&S&&(h=n(S)(e)),M(g,h,e)}}else if(o==="[]"){let m=0;for(let f of p){if(f===null){m++;continue}if(Array.isArray(f)&&f[0]==="..."){e[f[1]]=t.slice(m);break}let d=f,g;Array.isArray(f)&&f[0]==="="&&([,d,g]=f);let S=t[m++];S===void 0&&g&&(S=n(g)(e)),M(d,S,e)}}},ir=(...r)=>(r=r.map(t=>{if(typeof t=="string")return e=>{e[t]=void 0};if(t[0]==="="){let[,e,o]=t,i=n(o);return typeof e=="string"?p=>{p[e]=i(p)}:p=>M(e,i(p),p)}return n(t)}),t=>{for(let e of r)e(t)});s("let",ir);s("const",ir);s("var",ir);var W=r=>{throw Error(r)};s("=",(r,t)=>{if(Array.isArray(r)&&(r[0]==="let"||r[0]==="const"||r[0]==="var")){let e=r[1];return t=n(t),typeof e=="string"?o=>{o[e]=t(o)}:o=>M(e,t(o),o)}return N(r)||W("Invalid assignment target"),t=n(t),P(r,(e,o,i)=>e[o]=t(i))});s("||=",(r,t)=>(N(r)||W("Invalid assignment target"),t=n(t),P(r,(e,o,i)=>e[o]||=t(i))));s("&&=",(r,t)=>(N(r)||W("Invalid assignment target"),t=n(t),P(r,(e,o,i)=>e[o]&&=t(i))));s("??=",(r,t)=>(N(r)||W("Invalid assignment target"),t=n(t),P(r,(e,o,i)=>e[o]??=t(i))));s("?",(r,t,e)=>(r=n(r),t=n(t),e=n(e),o=>r(o)?t(o):e(o)));var kt=[];s("=>",(r,t)=>{r=r?.[0]==="()"?r[1]:r;let e=r?r[0]===","?r.slice(1):[r]:[],o=-1,i=null,p=e[e.length-1];Array.isArray(p)&&p[0]==="..."&&(o=e.length-1,i=p[1],e.length--);let m=t?.[0]==="{}";return t=n(m?["{",t[1]]:t),f=>(...d)=>{let g={};e.forEach((h,E)=>g[h]=d[E]),i&&(g[i]=d.slice(o));let S=new Proxy(g,{get:(h,E)=>E in h?h[E]:f?.[E],set:(h,E,T)=>((E in h?h:f)[E]=T,!0),has:(h,E)=>E in h||(f?E in f:!1)});try{let h=t(S);return m?void 0:h}catch(h){if(h===kt)return h[0];throw h}}});s("...",r=>(r=n(r),t=>Object.entries(r(t))));s("?.",(r,t)=>(r=n(r),O(t)?()=>{}:e=>r(e)?.[t]));s("?.[]",(r,t)=>(r=n(r),t=n(t),e=>{let o=t(e);return O(o)?void 0:r(e)?.[o]}));s("?.()",(r,t)=>{let e=t?t[0]===","?(t=t.slice(1).map(n),i=>t.map(p=>p(i))):(t=n(t),i=>[t(i)]):()=>[];if(r[0]==="?."){let i=n(r[1]),p=r[2];return O(p)?()=>{}:m=>i(m)?.[p]?.(...e(m))}if(r[0]==="?.[]"){let i=n(r[1]),p=n(r[2]);return m=>{let f=i(m),d=p(m);return O(d)?void 0:f?.[d]?.(...e(m))}}if(r[0]==="."){let i=n(r[1]),p=r[2];return O(p)?()=>{}:m=>i(m)?.[p]?.(...e(m))}if(r[0]==="[]"&&r.length===3){let i=n(r[1]),p=n(r[2]);return m=>{let f=i(m),d=p(m);return O(d)?void 0:f?.[d]?.(...e(m))}}let o=n(r);return i=>o(i)?.(...e(i))});s("typeof",r=>(r=n(r),t=>typeof r(t)));s("void",r=>(r=n(r),t=>(r(t),void 0)));s("delete",r=>{if(r[0]==="."){let t=n(r[1]),e=r[2];return o=>delete t(o)[e]}if(r[0]==="[]"){let t=n(r[1]),e=n(r[2]);return o=>delete t(o)[e(o)]}return()=>!0});s("new",r=>{let t=n(r?.[0]==="()"?r[1]:r),e=r?.[0]==="()"?r[2]:null,o=e?e[0]===","?(i=>p=>i.map(m=>m(p)))(e.slice(1).map(n)):(i=>p=>[i(p)])(n(e)):()=>[];return i=>new(t(i))(...o(i))});var z=Symbol("accessor");s("get",(r,t)=>(t=t?n(t):()=>{},e=>[[z,r,{get:function(){let o=Object.create(e||{});return o.this=this,t(o)}}]]));s("set",(r,t,e)=>(e=e?n(e):()=>{},o=>[[z,r,{set:function(i){let p=Object.create(o||{});p.this=this,p[t]=i,e(p)}}]]));var vt=r=>r==null||typeof r=="string"||[":",",","...","get","set"].includes(r[0]);s("{}",(r,t)=>{if(t!==void 0)return;if(!vt(r))return n(["{",r]);r=r?r[0]!==","?[r]:r.slice(1):[];let e=r.map(o=>n(typeof o=="string"?[":",o,o]:o));return o=>{let i={},p={};for(let m of e.flatMap(f=>f(o)))if(m[0]===z){let[,f,d]=m;p[f]={...p[f],...d,configurable:!0,enumerable:!0}}else i[m[0]]=m[1];for(let m in p)Object.defineProperty(i,m,p[m]);return i}});s("{",r=>(r=r?n(r):()=>{},t=>r(Object.create(t))));s(":",(r,t)=>(t=n(t),Array.isArray(r)?(r=n(r),e=>[[r(e),t(e)]]):e=>[[r,t(e)]]));s("`",(...r)=>(r=r.map(n),t=>r.map(e=>e(t)).join("")));s("``",(r,...t)=>{r=n(r);let e=[],o=[];for(let p of t)Array.isArray(p)&&p[0]===void 0?e.push(p[1]):o.push(n(p));let i=Object.assign([...e],{raw:e});return p=>r(p)(i,...o.map(m=>m(p)))});var Ur=new WeakMap,Nt=(r,...t)=>typeof r=="string"?n(A(r)):Ur.get(r)||Ur.set(r,Ot(r,t)).get(r),_r=57344,Ot=(r,t)=>{let e=r.reduce((p,m,f)=>p+(f?String.fromCharCode(_r+f-1):"")+m,""),o=A(e),i=p=>{if(typeof p=="string"&&p.length===1){let m=p.charCodeAt(0)-_r,f;if(m>=0&&m<t.length)return f=t[m],Pt(f)?f:[,f]}return Array.isArray(p)?p.map(i):p};return n(i(o))},Pt=r=>typeof r=="string"||Array.isArray(r)&&(typeof r[0]=="string"||r[0]===void 0),Rt=Nt;export{Z as access,c as binary,n as compile,l as cur,Rt as default,v as err,y as expr,_ as group,Lt as id,u as idx,F as keyword,L as literal,pr as loc,w as lookup,Y as nary,R as next,s as operator,V as operators,Tt as parens,A as parse,mr as peek,sr as prec,D as seek,C as skip,U as space,J as step,I as token,k as unary,fr as word};
|