@viji-dev/core 0.18.0 → 0.20.0

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.
@@ -1,33 +1,33 @@
1
- (()=>{const Tn=globalThis.fetch.bind(globalThis),sh=4,ih=3e4,rh=6e5,wo=12e4;class nh{pending=new Map;nextId=0;post;constructor(e){this.post=e;const s=this;globalThis.fetch=function(i,r){return s.fetch(i,r)}}fetch(e,s){const i=this.eligibleUrl(e,s);if(!i)return Tn(e,s);const r=s?.signal??(e instanceof Request?e.signal:null);if(r?.aborted)return Tn(e,s);const a=`asset_${++this.nextId}`;return new Promise((o,c)=>{const l={url:i,resolve:o,reject:c,input:e,init:s,controller:null,settled:false,nextSeq:0,timer:null,abortListener:null,signal:r??null};this.pending.set(a,l),l.timer=setTimeout(()=>this.fallThrough(a),ih),r&&(l.abortListener=()=>this.abort(a),r.addEventListener("abort",l.abortListener,{once:true})),this.post("cached-fetch",{id:a,url:i})})}eligibleUrl(e,s){try{let i,r=s?.headers;if(typeof e=="string"||e instanceof URL){if(i=String(e),s&&(s.method&&s.method.toUpperCase()!=="GET"||s.body!=null||s.credentials==="include"||s.mode&&s.mode!=="cors"||s.integrity||s.cache==="no-store"||s.cache==="reload"||s.cache==="no-cache"||s.redirect&&s.redirect!=="follow"))return null}else if(e instanceof Request){if(s||e.method!=="GET"||e.body!=null||e.credentials==="include"||e.mode!=="cors"||e.integrity||e.cache==="no-store"||e.cache==="reload"||e.cache==="no-cache"||e.redirect!=="follow")return null;i=e.url,r=e.headers}else return null;if(r&&[...(r instanceof Headers?r:new Headers(r)).keys()].length>0)return null;const a=new URL(i);return a.protocol!=="https:"?null:(a.hash="",a.toString())}catch{return null}}handleDirect(e){this.fallThrough(e.id)}handleWait(e){const s=this.pending.get(e.id);!s||s.settled||(this.clearTimer(s),s.timer=setTimeout(()=>this.fallThrough(e.id),rh))}handleBegin(e){const s=this.pending.get(e.id);if(!s||s.settled)return;this.clearTimer(s),s.settled=true;const i=this,r=new ReadableStream({start(o){s.controller=o},pull(){i.post("cached-fetch-ack",{id:e.id})},cancel(){i.cancel(e.id)}},new CountQueuingStrategy({highWaterMark:sh})),a=new Headers;e.contentType&&a.set("content-type",e.contentType),e.contentLength!==void 0&&a.set("content-length",String(e.contentLength)),s.timer=setTimeout(()=>this.streamError(e.id,"cached-fetch stream timed out"),wo),s.resolve(new Response(r,{status:e.status,headers:a}))}handleChunk(e){const s=this.pending.get(e.id);if(!(!s||!s.controller)){if(e.seq!==s.nextSeq){this.streamError(e.id,"cached-fetch stream out of order");return}s.nextSeq++,this.clearTimer(s),s.timer=setTimeout(()=>this.streamError(e.id,"cached-fetch stream timed out"),wo);try{s.controller.enqueue(new Uint8Array(e.bytes))}catch{this.cancel(e.id)}}}handleEnd(e){const s=this.pending.get(e.id);if(s){try{s.controller?.close()}catch{}this.cleanup(e.id)}}handleError(e){const s=this.pending.get(e.id);s&&(s.settled?this.streamError(e.id,e.message||"cached-fetch stream failed"):this.fallThrough(e.id))}fallThrough(e){const s=this.pending.get(e);!s||s.settled||(s.settled=true,this.cleanup(e),Tn(s.input,s.init).then(s.resolve,s.reject))}streamError(e,s){const i=this.pending.get(e);if(i){try{i.controller?.error(new TypeError(s))}catch{}this.post("cached-fetch-cancel",{id:e}),this.cleanup(e)}}abort(e){const s=this.pending.get(e);if(s){if(!s.settled)s.settled=true,this.cleanup(e),s.reject(new DOMException("The operation was aborted.","AbortError"));else{try{s.controller?.error(new DOMException("The operation was aborted.","AbortError"))}catch{}this.cleanup(e)}this.post("cached-fetch-cancel",{id:e})}}cancel(e){this.pending.has(e)&&(this.post("cached-fetch-cancel",{id:e}),this.cleanup(e))}clearTimer(e){e.timer!==null&&(clearTimeout(e.timer),e.timer=null)}cleanup(e){const s=this.pending.get(e);s&&(this.clearTimer(s),s.signal&&s.abortListener&&(s.signal.removeEventListener("abort",s.abortListener),s.abortListener=null),this.pending.delete(e))}}const So=/^#[0-9a-f]{6}$/,Eo=/^#[0-9a-f]{8}$/;function ji(t,e){const s=ah(t);if(!(e?.alpha===true)){if(s.a!==void 0)throw new Error(`Color ${hh(t)} carries an alpha channel but this parameter is opaque. Declare alpha: true on the parameter, or use rgb(), hsb(), or a 6-digit hex.`);return bi(s.r,s.g,s.b)}return Jc(s.r,s.g,s.b,s.a??1)}function Dt(t){const e=/^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})(?:[0-9a-f]{2})?$/i.exec(t);if(!e)throw new Error(`Expected canonical hex '#rrggbb' or '#rrggbbaa', got: ${t}`);return{r:parseInt(e[1],16),g:parseInt(e[2],16),b:parseInt(e[3],16)}}function ii(t){const e=/^#[0-9a-f]{6}([0-9a-f]{2})?$/i.exec(t);if(!e)throw new Error(`Expected canonical hex '#rrggbb' or '#rrggbbaa', got: ${t}`);return e[1]===void 0?1:parseInt(e[1],16)/255}function To(t){const{r:e,g:s,b:i}=Dt(t),r=e/255,a=s/255,o=i/255,c=Math.max(r,a,o),l=Math.min(r,a,o),h=c-l;let d=0;h>0&&(c===r?d=(a-o)/h%6:c===a?d=(o-r)/h+2:d=(r-a)/h+4,d*=60,d<0&&(d+=360));const m=c===0?0:h/c*100,_=c*100;return{h:An(d,4),s:An(m,4),b:An(_,4)}}function Ao(t){const{r:e,g:s,b:i}=Dt(t);return[e/255,s/255,i/255]}function Co(t){const{r:e,g:s,b:i}=Dt(t);return[e/255,s/255,i/255,ii(t)]}function bi(t,e,s){const i=Gt(t,"r"),r=Gt(e,"g"),a=Gt(s,"b");return"#"+Di(i)+Di(r)+Di(a)}function Jc(t,e,s,i){if(typeof i!="number"||!isFinite(i)||i<0||i>1)throw new Error(`Alpha must be a number in 0..1, got: ${i}`);return bi(t,e,s)+Di(Math.round(i*255))}function eu(t,e,s){if(typeof t!="number"||typeof e!="number"||typeof s!="number"||!isFinite(t)||!isFinite(e)||!isFinite(s))throw new Error(`Invalid HSB: h=${t}, s=${e}, b=${s}`);if(e<0||e>100)throw new Error(`HSB saturation must be 0..100, got: ${e}`);if(s<0||s>100)throw new Error(`HSB brightness must be 0..100, got: ${s}`);const i=(t%360+360)%360,r=e/100,a=s/100,o=a*r,c=i/60,l=o*(1-Math.abs(c%2-1));let h=0,d=0,m=0;c<1?(h=o,d=l,m=0):c<2?(h=l,d=o,m=0):c<3?(h=0,d=o,m=l):c<4?(h=0,d=l,m=o):c<5?(h=l,d=0,m=o):(h=o,d=0,m=l);const _=a-o;return bi(Math.round((h+_)*255),Math.round((d+_)*255),Math.round((m+_)*255))}function ah(t){if(typeof t=="string")return oh(t);if(t&&typeof t=="object"){const e=t,s="r"in e&&"g"in e&&"b"in e,i="h"in e&&"s"in e&&"b"in e,r="a"in e?pr(e.a):void 0;if(i&&!("r"in e)&&!("g"in e)){const a=eu(Ts(e.h,"h"),Ts(e.s,"s"),Ts(e.b,"b"));return{...Dt(a),a:r}}if(s)return{r:Gt(Ts(e.r,"r"),"r"),g:Gt(Ts(e.g,"g"),"g"),b:Gt(Ts(e.b,"b"),"b"),a:r};throw new Error(`Invalid color object: expected {r,g,b} or {h,s,b} keys (optional a), got ${JSON.stringify(t)}`)}throw new Error(`Invalid color input: expected string or object, got ${typeof t}`)}function oh(t){const e=t.trim();if(e.startsWith("#"))return ch(e);const s=e.match(/^(rgba|rgb|hsla|hsl|hsb|vec3|vec4)\s*\(([^)]*)\)$/i);if(s){const i=s[1].toLowerCase(),r=s[2];switch(i){case"rgb":return Io(r,false);case"rgba":return Io(r,true);case"hsl":return Ro(r,false);case"hsla":return Ro(r,true);case"hsb":return uh(r);case"vec3":return Po(r,false);case"vec4":return Po(r,true)}}throw new Error(`Invalid color string: '${t}'. Expected #rrggbb, #rgb, #rrggbbaa, #rgba, rgb(...), rgba(...), hsl(...), hsla(...), hsb(...), vec3(...), or vec4(...)`)}function ch(t){const e=t.slice(1);if(!/^[0-9a-fA-F]+$/.test(e))throw new Error(`Invalid hex color: '${t}'. Expected #rrggbb, #rgb, #rrggbbaa, or #rgba`);let s;switch(e.length){case 3:case 4:s=e.split("").map(r=>r+r).join("");break;case 6:case 8:s=e;break;default:throw new Error(`Invalid hex color: '${t}'. Expected #rrggbb, #rgb, #rrggbbaa, or #rgba`)}const i=s.toLowerCase();return{r:parseInt(i.slice(0,2),16),g:parseInt(i.slice(2,4),16),b:parseInt(i.slice(4,6),16),a:i.length===8?parseInt(i.slice(6,8),16)/255:void 0}}function Io(t,e){const s=e?"rgba":"rgb",i=dr(t),r=e?4:3;if(i.length!==r)throw new Error(`${s}() requires ${r} arguments, got ${i.length}: ${s}(${t})`);return{r:Gt(Je(i[0],"r"),"r"),g:Gt(Je(i[1],"g"),"g"),b:Gt(Je(i[2],"b"),"b"),a:e?pr(Je(i[3],"a")):void 0}}function Ro(t,e){const s=e?"hsla":"hsl",i=dr(t),r=e?4:3;if(i.length!==r)throw new Error(`${s}() requires ${r} arguments, got ${i.length}: ${s}(${t})`);const a=Je(i[0],"h"),o=Lo(i[1],"s"),c=Lo(i[2],"l"),l=lh(a,o,c);return{...Dt(l),a:e?pr(Je(i[3],"a")):void 0}}function uh(t){const e=dr(t);if(e.length!==3)throw new Error(`hsb() requires 3 arguments, got ${e.length}: hsb(${t})`);const s=Je(e[0],"h"),i=Je(e[1],"s"),r=Je(e[2],"b");return{...Dt(eu(s,i,r)),a:void 0}}function Po(t,e){const s=e?"vec4":"vec3",i=dr(t),r=e?4:3;if(i.length!==r)throw new Error(`${s}() requires ${r} arguments, got ${i.length}: ${s}(${t})`);const a=Je(i[0],"r"),o=Je(i[1],"g"),c=Je(i[2],"b");if(a<0||a>1||o<0||o>1||c<0||c>1)throw new Error(`${s}() components must be in 0..1, got: ${s}(${t})`);return{r:Math.round(a*255),g:Math.round(o*255),b:Math.round(c*255),a:e?pr(Je(i[3],"a")):void 0}}function lh(t,e,s){if(e<0||e>100)throw new Error(`HSL saturation must be 0..100%, got: ${e}%`);if(s<0||s>100)throw new Error(`HSL lightness must be 0..100%, got: ${s}%`);const i=(t%360+360)%360,r=e/100,a=s/100,o=(1-Math.abs(2*a-1))*r,c=i/60,l=o*(1-Math.abs(c%2-1));let h=0,d=0,m=0;c<1?(h=o,d=l,m=0):c<2?(h=l,d=o,m=0):c<3?(h=0,d=o,m=l):c<4?(h=0,d=l,m=o):c<5?(h=l,d=0,m=o):(h=o,d=0,m=l);const _=a-o/2;return bi(Math.round((h+_)*255),Math.round((d+_)*255),Math.round((m+_)*255))}function hh(t){if(typeof t=="string")return`'${t}'`;try{return JSON.stringify(t)}catch{return String(t)}}function dr(t){return t.split(",").map(e=>e.trim()).filter(e=>e.length>0)}function Je(t,e){const s=parseFloat(t);if(!isFinite(s))throw new Error(`Invalid number for '${e}': '${t}'`);return s}function Lo(t,e){if(!t.endsWith("%"))throw new Error(`Field '${e}' must use percent notation (e.g., 50%), got: '${t}'`);return Je(t.slice(0,-1),e)}function Ts(t,e){if(typeof t!="number"||!isFinite(t))throw new Error(`Invalid color field '${e}': expected finite number, got ${t}`);return t}function pr(t){if(typeof t!="number"||!isFinite(t)||t<0||t>1)throw new Error(`Alpha must be a number in 0..1, got: ${t}`);return t}function Gt(t,e){if(typeof t!="number"||!isFinite(t))throw new Error(`RGB component '${e}' must be a finite number, got: ${t}`);if(t<0||t>255)throw new Error(`RGB component '${e}' must be 0..255, got: ${t}`);return Math.round(t)}function Di(t){return t.toString(16).padStart(2,"0")}function An(t,e){const s=10**e;return Math.round(t*s)/s}const Do=2,No=32,fh=2,dh=8;function Ni(t){if(t.alpha!==void 0&&typeof t.alpha!="boolean")throw new Error(`Gradient 'alpha' must be a boolean, got: ${String(t.alpha)}`);const e=Fo(t.minStops,"minStops",fh),s=Fo(t.maxStops,"maxStops",dh);if(e>s)throw new Error(`Gradient 'minStops' (${e}) must not exceed 'maxStops' (${s})`);return{alpha:t.alpha===true,minStops:e,maxStops:s}}function Kn(t,e){if(!Array.isArray(t))throw new Error(`Gradient value must be an array of { color, position } stops, got ${Uo(t)}`);if(t.length<e.minStops||t.length>e.maxStops)throw new Error(`Gradient must have between ${e.minStops} and ${e.maxStops} stops, got ${t.length}`);const s=[];for(let i=0;i<t.length;i++){const r=t[i];if(!r||typeof r!="object"||!("color"in r)||!("position"in r))throw new Error(`Gradient stop ${i} must be an object with 'color' and 'position', got ${Uo(r)}`);const a=r;if(typeof a.position!="number"||!isFinite(a.position)||a.position<0||a.position>1)throw new Error(`Gradient stop ${i} position must be a number in 0..1, got ${String(a.position)}`);let o;try{o=ji(a.color,{alpha:e.alpha})}catch(c){throw new Error(`Gradient stop ${i}: ${c.message}`)}s.push({color:o,position:a.position})}s.sort((i,r)=>i.position-r.position);for(const i of s)Object.freeze(i);return Object.freeze(s)}function ph(t,e){if(!Array.isArray(t)||!Array.isArray(e)||t.length!==e.length)return false;for(let s=0;s<t.length;s++){const i=t[s],r=e[s];if(!i||!r||i.color!==r.color||i.position!==r.position)return false}return true}function mh(t,e,s){if(t.length===0)throw new Error("Cannot sample an empty gradient");const i=Number.isFinite(e)?Math.min(1,Math.max(0,e)):0,r=t[0];if(i<=r.position)return r.color;let a=r;for(let o=1;o<t.length;o++){const c=t[o];if(i<=c.position){const l=c.position-a.position,h=l>0?(i-a.position)/l:1;return h<=0?a.color:h>=1?c.color:gh(a.color,c.color,h,s.alpha)}a=c}return a.color}function gh(t,e,s,i){const r=Dt(t),a=Dt(e),o=ii(t),c=ii(e),l=o+(c-o)*s;let h,d,m;l<=0?(h=r.r+(a.r-r.r)*s,d=r.g+(a.g-r.g)*s,m=r.b+(a.b-r.b)*s):(h=(r.r*o+(a.r*c-r.r*o)*s)/l,d=(r.g*o+(a.g*c-r.g*o)*s)/l,m=(r.b*o+(a.b*c-r.b*o)*s)/l);const _=Cn(Math.round(h)),x=Cn(Math.round(d)),E=Cn(Math.round(m));return i?Jc(_,x,E,Math.min(1,Math.max(0,l))):bi(_,x,E)}function Fo(t,e,s){if(t===void 0)return s;if(typeof t!="number"||!Number.isInteger(t)||t<Do||t>No)throw new Error(`Gradient '${e}' must be an integer in ${Do}..${No}, got: ${String(t)}`);return t}function Cn(t){return Math.min(255,Math.max(0,t))}function Uo(t){try{return JSON.stringify(t)??String(t)}catch{return String(t)}}var bh=[509,0,227,0,150,4,294,9,1368,2,2,1,6,3,41,2,5,0,166,1,574,3,9,9,7,9,32,4,318,1,80,3,71,10,50,3,123,2,54,14,32,10,3,1,11,3,46,10,8,0,46,9,7,2,37,13,2,9,6,1,45,0,13,2,49,13,9,3,2,11,83,11,7,0,3,0,158,11,6,9,7,3,56,1,2,6,3,1,3,2,10,0,11,1,3,6,4,4,68,8,2,0,3,0,2,3,2,4,2,0,15,1,83,17,10,9,5,0,82,19,13,9,214,6,3,8,28,1,83,16,16,9,82,12,9,9,7,19,58,14,5,9,243,14,166,9,71,5,2,1,3,3,2,0,2,1,13,9,120,6,3,6,4,0,29,9,41,6,2,3,9,0,10,10,47,15,343,9,54,7,2,7,17,9,57,21,2,13,123,5,4,0,2,1,2,6,2,0,9,9,49,4,2,1,2,4,9,9,330,3,10,1,2,0,49,6,4,4,14,10,5350,0,7,14,11465,27,2343,9,87,9,39,4,60,6,26,9,535,9,470,0,2,54,8,3,82,0,12,1,19628,1,4178,9,519,45,3,22,543,4,4,5,9,7,3,6,31,3,149,2,1418,49,513,54,5,49,9,0,15,0,23,4,2,14,1361,6,2,16,3,6,2,1,2,4,101,0,161,6,10,9,357,0,62,13,499,13,245,1,2,9,726,6,110,6,6,9,4759,9,787719,239],tu=[0,11,2,25,2,18,2,1,2,14,3,13,35,122,70,52,268,28,4,48,48,31,14,29,6,37,11,29,3,35,5,7,2,4,43,157,19,35,5,35,5,39,9,51,13,10,2,14,2,6,2,1,2,10,2,14,2,6,2,1,4,51,13,310,10,21,11,7,25,5,2,41,2,8,70,5,3,0,2,43,2,1,4,0,3,22,11,22,10,30,66,18,2,1,11,21,11,25,71,55,7,1,65,0,16,3,2,2,2,28,43,28,4,28,36,7,2,27,28,53,11,21,11,18,14,17,111,72,56,50,14,50,14,35,39,27,10,22,251,41,7,1,17,2,60,28,11,0,9,21,43,17,47,20,28,22,13,52,58,1,3,0,14,44,33,24,27,35,30,0,3,0,9,34,4,0,13,47,15,3,22,0,2,0,36,17,2,24,20,1,64,6,2,0,2,3,2,14,2,9,8,46,39,7,3,1,3,21,2,6,2,1,2,4,4,0,19,0,13,4,31,9,2,0,3,0,2,37,2,0,26,0,2,0,45,52,19,3,21,2,31,47,21,1,2,0,185,46,42,3,37,47,21,0,60,42,14,0,72,26,38,6,186,43,117,63,32,7,3,0,3,7,2,1,2,23,16,0,2,0,95,7,3,38,17,0,2,0,29,0,11,39,8,0,22,0,12,45,20,0,19,72,200,32,32,8,2,36,18,0,50,29,113,6,2,1,2,37,22,0,26,5,2,1,2,31,15,0,328,18,16,0,2,12,2,33,125,0,80,921,103,110,18,195,2637,96,16,1071,18,5,26,3994,6,582,6842,29,1763,568,8,30,18,78,18,29,19,47,17,3,32,20,6,18,433,44,212,63,129,74,6,0,67,12,65,1,2,0,29,6135,9,1237,42,9,8936,3,2,6,2,1,2,290,16,0,30,2,3,0,15,3,9,395,2309,106,6,12,4,8,8,9,5991,84,2,70,2,1,3,0,3,1,3,3,2,11,2,0,2,6,2,64,2,3,3,7,2,6,2,27,2,3,2,4,2,0,4,6,2,339,3,24,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,7,1845,30,7,5,262,61,147,44,11,6,17,0,322,29,19,43,485,27,229,29,3,0,496,6,2,3,2,1,2,14,2,196,60,67,8,0,1205,3,2,26,2,1,2,0,3,0,2,9,2,3,2,0,2,0,7,0,5,0,2,0,2,0,2,2,2,1,2,0,3,0,2,0,2,0,2,0,2,0,2,1,2,0,3,3,2,6,2,3,2,3,2,0,2,9,2,16,6,2,2,4,2,16,4421,42719,33,4153,7,221,3,5761,15,7472,16,621,2467,541,1507,4938,6,4191],yh="‌‍·̀-ͯ·҃-֑҇-ׇֽֿׁׂׅׄؐ-ًؚ-٩ٰۖ-ۜ۟-۪ۤۧۨ-ۭ۰-۹ܑܰ-݊ަ-ް߀-߉߫-߽߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛ࢗ-࢟࣊-ࣣ࣡-ःऺ-़ा-ॏ॑-ॗॢॣ०-९ঁ-ঃ়া-ৄেৈো-্ৗৢৣ০-৯৾ਁ-ਃ਼ਾ-ੂੇੈੋ-੍ੑ੦-ੱੵઁ-ઃ઼ા-ૅે-ૉો-્ૢૣ૦-૯ૺ-૿ଁ-ଃ଼ା-ୄେୈୋ-୍୕-ୗୢୣ୦-୯ஂா-ூெ-ைொ-்ௗ௦-௯ఀ-ఄ఼ా-ౄె-ైొ-్ౕౖౢౣ౦-౯ಁ-ಃ಼ಾ-ೄೆ-ೈೊ-್ೕೖೢೣ೦-೯ೳഀ-ഃ഻഼ാ-ൄെ-ൈൊ-്ൗൢൣ൦-൯ඁ-ඃ්ා-ුූෘ-ෟ෦-෯ෲෳัิ-ฺ็-๎๐-๙ັິ-ຼ່-໎໐-໙༘༙༠-༩༹༵༷༾༿ཱ-྄྆྇ྍ-ྗྙ-ྼ࿆ါ-ှ၀-၉ၖ-ၙၞ-ၠၢ-ၤၧ-ၭၱ-ၴႂ-ႍႏ-ႝ፝-፟፩-፱ᜒ-᜕ᜲ-᜴ᝒᝓᝲᝳ឴-៓៝០-៩᠋-᠍᠏-᠙ᢩᤠ-ᤫᤰ-᤻᥆-᥏᧐-᧚ᨗ-ᨛᩕ-ᩞ᩠-᩿᩼-᪉᪐-᪙᪰-᪽ᪿ-ᫎᬀ-ᬄ᬴-᭄᭐-᭙᭫-᭳ᮀ-ᮂᮡ-ᮭ᮰-᮹᯦-᯳ᰤ-᰷᱀-᱉᱐-᱙᳐-᳔᳒-᳨᳭᳴᳷-᳹᷀-᷿‌‍‿⁀⁔⃐-⃥⃜⃡-⃰⳯-⵿⳱ⷠ-〪ⷿ-゙゚〯・꘠-꘩꙯ꙴ-꙽ꚞꚟ꛰꛱ꠂ꠆ꠋꠣ-ꠧ꠬ꢀꢁꢴ-ꣅ꣐-꣙꣠-꣱ꣿ-꤉ꤦ-꤭ꥇ-꥓ꦀ-ꦃ꦳-꧀꧐-꧙ꧥ꧰-꧹ꨩ-ꨶꩃꩌꩍ꩐-꩙ꩻ-ꩽꪰꪲ-ꪴꪷꪸꪾ꪿꫁ꫫ-ꫯꫵ꫶ꯣ-ꯪ꯬꯭꯰-꯹ﬞ︀-️︠-︯︳︴﹍-﹏0-9_・",su="ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԯԱ-Ֆՙՠ-ֈא-תׯ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࡠ-ࡪࡰ-ࢇࢉ-ࢎࢠ-ࣉऄ-हऽॐक़-ॡॱ-ঀঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱৼਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡૹଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-హఽౘ-ౚౝౠౡಀಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೝೞೠೡೱೲഄ-ഌഎ-ഐഒ-ഺഽൎൔ-ൖൟ-ൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄຆ-ຊຌ-ຣລວ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏽᏸ-ᏽᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜑᜟ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡸᢀ-ᢨᢪᢰ-ᣵᤀ-ᤞᥐ-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭌᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᲀ-ᲊᲐ-ᲺᲽ-Ჿᳩ-ᳬᳮ-ᳳᳵᳶᳺᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕ℘-ℝℤΩℨK-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞ々-〇〡-〩〱-〵〸-〼ぁ-ゖ゛-ゟァ-ヺー-ヿㄅ-ㄯㄱ-ㆎㆠ-ㆿㇰ-ㇿ㐀-䶿一-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚝꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ-ꟍꟐꟑꟓꟕ-Ƛꟲ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꣽꣾꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꧠ-ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꩾ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭩꭰ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ",In={3:"abstract boolean byte char class double enum export extends final float goto implements import int interface long native package private protected public short static super synchronized throws transient volatile",5:"class enum extends super const export import",6:"enum",strict:"implements interface let package private protected public static yield",strictBind:"eval arguments"},Rn="break case catch continue debugger default do else finally for function if return switch throw try var while with null true false instanceof typeof void delete new in this",_h={5:Rn,"5module":Rn+" export import",6:Rn+" const class extends export import super"},vh=/^in(stanceof)?$/,xh=new RegExp("["+su+"]"),kh=new RegExp("["+su+yh+"]");function Zn(t,e){for(var s=65536,i=0;i<e.length;i+=2){if(s+=e[i],s>t)return false;if(s+=e[i+1],s>=t)return true}return false}function Nt(t,e){return t<65?t===36:t<91?true:t<97?t===95:t<123?true:t<=65535?t>=170&&xh.test(String.fromCharCode(t)):e===false?false:Zn(t,tu)}function cs(t,e){return t<48?t===36:t<58?true:t<65?false:t<91?true:t<97?t===95:t<123?true:t<=65535?t>=170&&kh.test(String.fromCharCode(t)):e===false?false:Zn(t,tu)||Zn(t,bh)}var ye=function(e,s){s===void 0&&(s={}),this.label=e,this.keyword=s.keyword,this.beforeExpr=!!s.beforeExpr,this.startsExpr=!!s.startsExpr,this.isLoop=!!s.isLoop,this.isAssign=!!s.isAssign,this.prefix=!!s.prefix,this.postfix=!!s.postfix,this.binop=s.binop||null,this.updateContext=null};function at(t,e){return new ye(t,{beforeExpr:true,binop:e})}var ot={beforeExpr:true},Ke={startsExpr:true},Ta={};function be(t,e){return e===void 0&&(e={}),e.keyword=t,Ta[t]=new ye(t,e)}var f={num:new ye("num",Ke),regexp:new ye("regexp",Ke),string:new ye("string",Ke),name:new ye("name",Ke),privateId:new ye("privateId",Ke),eof:new ye("eof"),bracketL:new ye("[",{beforeExpr:true,startsExpr:true}),bracketR:new ye("]"),braceL:new ye("{",{beforeExpr:true,startsExpr:true}),braceR:new ye("}"),parenL:new ye("(",{beforeExpr:true,startsExpr:true}),parenR:new ye(")"),comma:new ye(",",ot),semi:new ye(";",ot),colon:new ye(":",ot),dot:new ye("."),question:new ye("?",ot),questionDot:new ye("?."),arrow:new ye("=>",ot),template:new ye("template"),invalidTemplate:new ye("invalidTemplate"),ellipsis:new ye("...",ot),backQuote:new ye("`",Ke),dollarBraceL:new ye("${",{beforeExpr:true,startsExpr:true}),eq:new ye("=",{beforeExpr:true,isAssign:true}),assign:new ye("_=",{beforeExpr:true,isAssign:true}),incDec:new ye("++/--",{prefix:true,postfix:true,startsExpr:true}),prefix:new ye("!/~",{beforeExpr:true,prefix:true,startsExpr:true}),logicalOR:at("||",1),logicalAND:at("&&",2),bitwiseOR:at("|",3),bitwiseXOR:at("^",4),bitwiseAND:at("&",5),equality:at("==/!=/===/!==",6),relational:at("</>/<=/>=",7),bitShift:at("<</>>/>>>",8),plusMin:new ye("+/-",{beforeExpr:true,binop:9,prefix:true,startsExpr:true}),modulo:at("%",10),star:at("*",10),slash:at("/",10),starstar:new ye("**",{beforeExpr:true}),coalesce:at("??",1),_break:be("break"),_case:be("case",ot),_catch:be("catch"),_continue:be("continue"),_debugger:be("debugger"),_default:be("default",ot),_do:be("do",{isLoop:true,beforeExpr:true}),_else:be("else",ot),_finally:be("finally"),_for:be("for",{isLoop:true}),_function:be("function",Ke),_if:be("if"),_return:be("return",ot),_switch:be("switch"),_throw:be("throw",ot),_try:be("try"),_var:be("var"),_const:be("const"),_while:be("while",{isLoop:true}),_with:be("with"),_new:be("new",{beforeExpr:true,startsExpr:true}),_this:be("this",Ke),_super:be("super",Ke),_class:be("class",Ke),_extends:be("extends",ot),_export:be("export"),_import:be("import",Ke),_null:be("null",Ke),_true:be("true",Ke),_false:be("false",Ke),_in:be("in",{beforeExpr:true,binop:7}),_instanceof:be("instanceof",{beforeExpr:true,binop:7}),_typeof:be("typeof",{beforeExpr:true,prefix:true,startsExpr:true}),_void:be("void",{beforeExpr:true,prefix:true,startsExpr:true}),_delete:be("delete",{beforeExpr:true,prefix:true,startsExpr:true})},st=/\r\n?|\n|\u2028|\u2029/,wh=new RegExp(st.source,"g");function Os(t){return t===10||t===13||t===8232||t===8233}function iu(t,e,s){s===void 0&&(s=t.length);for(var i=e;i<s;i++){var r=t.charCodeAt(i);if(Os(r))return i<s-1&&r===13&&t.charCodeAt(i+1)===10?i+2:i+1}return-1}var ru=/[\u1680\u2000-\u200a\u202f\u205f\u3000\ufeff]/,He=/(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g,nu=Object.prototype,Sh=nu.hasOwnProperty,Eh=nu.toString,Vs=Object.hasOwn||function(t,e){return Sh.call(t,e)},Mo=Array.isArray||function(t){return Eh.call(t)==="[object Array]"},Bo=Object.create(null);function es(t){return Bo[t]||(Bo[t]=new RegExp("^(?:"+t.replace(/ /g,"|")+")$"))}function Wt(t){return t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode((t>>10)+55296,(t&1023)+56320))}var Th=/(?:[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/,ri=function(e,s){this.line=e,this.column=s};ri.prototype.offset=function(e){return new ri(this.line,this.column+e)};var mr=function(e,s,i){this.start=s,this.end=i,e.sourceFile!==null&&(this.source=e.sourceFile)};function au(t,e){for(var s=1,i=0;;){var r=iu(t,i,e);if(r<0)return new ri(s,e-i);++s,i=r}}var Qn={ecmaVersion:null,sourceType:"script",onInsertedSemicolon:null,onTrailingComma:null,allowReserved:null,allowReturnOutsideFunction:false,allowImportExportEverywhere:false,allowAwaitOutsideFunction:null,allowSuperOutsideMethod:null,allowHashBang:false,checkPrivateFields:true,locations:false,onToken:null,onComment:null,ranges:false,program:null,sourceFile:null,directSourceFile:null,preserveParens:false},Oo=false;function Ah(t){var e={};for(var s in Qn)e[s]=t&&Vs(t,s)?t[s]:Qn[s];if(e.ecmaVersion==="latest"?e.ecmaVersion=1e8:e.ecmaVersion==null?(!Oo&&typeof console=="object"&&console.warn&&(Oo=true,console.warn(`Since Acorn 8.0.0, options.ecmaVersion is required.
2
- Defaulting to 2020, but this will stop working in the future.`)),e.ecmaVersion=11):e.ecmaVersion>=2015&&(e.ecmaVersion-=2009),e.allowReserved==null&&(e.allowReserved=e.ecmaVersion<5),(!t||t.allowHashBang==null)&&(e.allowHashBang=e.ecmaVersion>=14),Mo(e.onToken)){var i=e.onToken;e.onToken=function(r){return i.push(r)}}return Mo(e.onComment)&&(e.onComment=Ch(e,e.onComment)),e}function Ch(t,e){return function(s,i,r,a,o,c){var l={type:s?"Block":"Line",value:i,start:r,end:a};t.locations&&(l.loc=new mr(this,o,c)),t.ranges&&(l.range=[r,a]),e.push(l)}}var ni=1,$s=2,Aa=4,ou=8,Ca=16,cu=32,gr=64,uu=128,ks=256,yi=512,br=ni|$s|ks;function Ia(t,e){return $s|(t?Aa:0)|(e?ou:0)}var qi=0,Ra=1,Kt=2,lu=3,hu=4,fu=5,Ne=function(e,s,i){this.options=e=Ah(e),this.sourceFile=e.sourceFile,this.keywords=es(_h[e.ecmaVersion>=6?6:e.sourceType==="module"?"5module":5]);var r="";e.allowReserved!==true&&(r=In[e.ecmaVersion>=6?6:e.ecmaVersion===5?5:3],e.sourceType==="module"&&(r+=" await")),this.reservedWords=es(r);var a=(r?r+" ":"")+In.strict;this.reservedWordsStrict=es(a),this.reservedWordsStrictBind=es(a+" "+In.strictBind),this.input=String(s),this.containsEsc=false,i?(this.pos=i,this.lineStart=this.input.lastIndexOf(`
3
- `,i-1)+1,this.curLine=this.input.slice(0,this.lineStart).split(st).length):(this.pos=this.lineStart=0,this.curLine=1),this.type=f.eof,this.value=null,this.start=this.end=this.pos,this.startLoc=this.endLoc=this.curPosition(),this.lastTokEndLoc=this.lastTokStartLoc=null,this.lastTokStart=this.lastTokEnd=this.pos,this.context=this.initialContext(),this.exprAllowed=true,this.inModule=e.sourceType==="module",this.strict=this.inModule||this.strictDirective(this.pos),this.potentialArrowAt=-1,this.potentialArrowInForAwait=false,this.yieldPos=this.awaitPos=this.awaitIdentPos=0,this.labels=[],this.undefinedExports=Object.create(null),this.pos===0&&e.allowHashBang&&this.input.slice(0,2)==="#!"&&this.skipLineComment(2),this.scopeStack=[],this.enterScope(ni),this.regexpState=null,this.privateNameStack=[]},Mt={inFunction:{configurable:true},inGenerator:{configurable:true},inAsync:{configurable:true},canAwait:{configurable:true},allowSuper:{configurable:true},allowDirectSuper:{configurable:true},treatFunctionsAsVar:{configurable:true},allowNewDotTarget:{configurable:true},inClassStaticBlock:{configurable:true}};Ne.prototype.parse=function(){var e=this.options.program||this.startNode();return this.nextToken(),this.parseTopLevel(e)};Mt.inFunction.get=function(){return(this.currentVarScope().flags&$s)>0};Mt.inGenerator.get=function(){return(this.currentVarScope().flags&ou)>0};Mt.inAsync.get=function(){return(this.currentVarScope().flags&Aa)>0};Mt.canAwait.get=function(){for(var t=this.scopeStack.length-1;t>=0;t--){var e=this.scopeStack[t],s=e.flags;if(s&(ks|yi))return false;if(s&$s)return(s&Aa)>0}return this.inModule&&this.options.ecmaVersion>=13||this.options.allowAwaitOutsideFunction};Mt.allowSuper.get=function(){var t=this.currentThisScope(),e=t.flags;return(e&gr)>0||this.options.allowSuperOutsideMethod};Mt.allowDirectSuper.get=function(){return(this.currentThisScope().flags&uu)>0};Mt.treatFunctionsAsVar.get=function(){return this.treatFunctionsAsVarInScope(this.currentScope())};Mt.allowNewDotTarget.get=function(){for(var t=this.scopeStack.length-1;t>=0;t--){var e=this.scopeStack[t],s=e.flags;if(s&(ks|yi)||s&$s&&!(s&Ca))return true}return false};Mt.inClassStaticBlock.get=function(){return(this.currentVarScope().flags&ks)>0};Ne.extend=function(){for(var e=[],s=arguments.length;s--;)e[s]=arguments[s];for(var i=this,r=0;r<e.length;r++)i=e[r](i);return i};Ne.parse=function(e,s){return new this(s,e).parse()};Ne.parseExpressionAt=function(e,s,i){var r=new this(i,e,s);return r.nextToken(),r.parseExpression()};Ne.tokenizer=function(e,s){return new this(s,e)};Object.defineProperties(Ne.prototype,Mt);var ze=Ne.prototype,Ih=/^(?:'((?:\\[^]|[^'\\])*?)'|"((?:\\[^]|[^"\\])*?)")/;ze.strictDirective=function(t){if(this.options.ecmaVersion<5)return false;for(;;){He.lastIndex=t,t+=He.exec(this.input)[0].length;var e=Ih.exec(this.input.slice(t));if(!e)return false;if((e[1]||e[2])==="use strict"){He.lastIndex=t+e[0].length;var s=He.exec(this.input),i=s.index+s[0].length,r=this.input.charAt(i);return r===";"||r==="}"||st.test(s[0])&&!(/[(`.[+\-/*%<>=,?^&]/.test(r)||r==="!"&&this.input.charAt(i+1)==="=")}t+=e[0].length,He.lastIndex=t,t+=He.exec(this.input)[0].length,this.input[t]===";"&&t++}};ze.eat=function(t){return this.type===t?(this.next(),true):false};ze.isContextual=function(t){return this.type===f.name&&this.value===t&&!this.containsEsc};ze.eatContextual=function(t){return this.isContextual(t)?(this.next(),true):false};ze.expectContextual=function(t){this.eatContextual(t)||this.unexpected()};ze.canInsertSemicolon=function(){return this.type===f.eof||this.type===f.braceR||st.test(this.input.slice(this.lastTokEnd,this.start))};ze.insertSemicolon=function(){if(this.canInsertSemicolon())return this.options.onInsertedSemicolon&&this.options.onInsertedSemicolon(this.lastTokEnd,this.lastTokEndLoc),true};ze.semicolon=function(){!this.eat(f.semi)&&!this.insertSemicolon()&&this.unexpected()};ze.afterTrailingComma=function(t,e){if(this.type===t)return this.options.onTrailingComma&&this.options.onTrailingComma(this.lastTokStart,this.lastTokStartLoc),e||this.next(),true};ze.expect=function(t){this.eat(t)||this.unexpected()};ze.unexpected=function(t){this.raise(t??this.start,"Unexpected token")};var yr=function(){this.shorthandAssign=this.trailingComma=this.parenthesizedAssign=this.parenthesizedBind=this.doubleProto=-1};ze.checkPatternErrors=function(t,e){if(t){t.trailingComma>-1&&this.raiseRecoverable(t.trailingComma,"Comma is not permitted after the rest element");var s=e?t.parenthesizedAssign:t.parenthesizedBind;s>-1&&this.raiseRecoverable(s,e?"Assigning to rvalue":"Parenthesized pattern")}};ze.checkExpressionErrors=function(t,e){if(!t)return false;var s=t.shorthandAssign,i=t.doubleProto;if(!e)return s>=0||i>=0;s>=0&&this.raise(s,"Shorthand property assignments are valid only in destructuring patterns"),i>=0&&this.raiseRecoverable(i,"Redefinition of __proto__ property")};ze.checkYieldAwaitInDefaultParams=function(){this.yieldPos&&(!this.awaitPos||this.yieldPos<this.awaitPos)&&this.raise(this.yieldPos,"Yield expression cannot be a default value"),this.awaitPos&&this.raise(this.awaitPos,"Await expression cannot be a default value")};ze.isSimpleAssignTarget=function(t){return t.type==="ParenthesizedExpression"?this.isSimpleAssignTarget(t.expression):t.type==="Identifier"||t.type==="MemberExpression"};var K=Ne.prototype;K.parseTopLevel=function(t){var e=Object.create(null);for(t.body||(t.body=[]);this.type!==f.eof;){var s=this.parseStatement(null,true,e);t.body.push(s)}if(this.inModule)for(var i=0,r=Object.keys(this.undefinedExports);i<r.length;i+=1){var a=r[i];this.raiseRecoverable(this.undefinedExports[a].start,"Export '"+a+"' is not defined")}return this.adaptDirectivePrologue(t.body),this.next(),t.sourceType=this.options.sourceType,this.finishNode(t,"Program")};var Pa={kind:"loop"},Rh={kind:"switch"};K.isLet=function(t){if(this.options.ecmaVersion<6||!this.isContextual("let"))return false;He.lastIndex=this.pos;var e=He.exec(this.input),s=this.pos+e[0].length,i=this.input.charCodeAt(s);if(i===91||i===92)return true;if(t)return false;if(i===123||i>55295&&i<56320)return true;if(Nt(i,true)){for(var r=s+1;cs(i=this.input.charCodeAt(r),true);)++r;if(i===92||i>55295&&i<56320)return true;var a=this.input.slice(s,r);if(!vh.test(a))return true}return false};K.isAsyncFunction=function(){if(this.options.ecmaVersion<8||!this.isContextual("async"))return false;He.lastIndex=this.pos;var t=He.exec(this.input),e=this.pos+t[0].length,s;return!st.test(this.input.slice(this.pos,e))&&this.input.slice(e,e+8)==="function"&&(e+8===this.input.length||!(cs(s=this.input.charCodeAt(e+8))||s>55295&&s<56320))};K.isUsingKeyword=function(t,e){if(this.options.ecmaVersion<17||!this.isContextual(t?"await":"using"))return false;He.lastIndex=this.pos;var s=He.exec(this.input),i=this.pos+s[0].length;if(st.test(this.input.slice(this.pos,i)))return false;if(t){var r=i+5,a;if(this.input.slice(i,r)!=="using"||r===this.input.length||cs(a=this.input.charCodeAt(r))||a>55295&&a<56320)return false;He.lastIndex=r;var o=He.exec(this.input);if(o&&st.test(this.input.slice(r,r+o[0].length)))return false}if(e){var c=i+2,l;if(this.input.slice(i,c)==="of"&&(c===this.input.length||!cs(l=this.input.charCodeAt(c))&&!(l>55295&&l<56320)))return false}var h=this.input.charCodeAt(i);return Nt(h,true)||h===92};K.isAwaitUsing=function(t){return this.isUsingKeyword(true,t)};K.isUsing=function(t){return this.isUsingKeyword(false,t)};K.parseStatement=function(t,e,s){var i=this.type,r=this.startNode(),a;switch(this.isLet(t)&&(i=f._var,a="let"),i){case f._break:case f._continue:return this.parseBreakContinueStatement(r,i.keyword);case f._debugger:return this.parseDebuggerStatement(r);case f._do:return this.parseDoStatement(r);case f._for:return this.parseForStatement(r);case f._function:return t&&(this.strict||t!=="if"&&t!=="label")&&this.options.ecmaVersion>=6&&this.unexpected(),this.parseFunctionStatement(r,false,!t);case f._class:return t&&this.unexpected(),this.parseClass(r,true);case f._if:return this.parseIfStatement(r);case f._return:return this.parseReturnStatement(r);case f._switch:return this.parseSwitchStatement(r);case f._throw:return this.parseThrowStatement(r);case f._try:return this.parseTryStatement(r);case f._const:case f._var:return a=a||this.value,t&&a!=="var"&&this.unexpected(),this.parseVarStatement(r,a);case f._while:return this.parseWhileStatement(r);case f._with:return this.parseWithStatement(r);case f.braceL:return this.parseBlock(true,r);case f.semi:return this.parseEmptyStatement(r);case f._export:case f._import:if(this.options.ecmaVersion>10&&i===f._import){He.lastIndex=this.pos;var o=He.exec(this.input),c=this.pos+o[0].length,l=this.input.charCodeAt(c);if(l===40||l===46)return this.parseExpressionStatement(r,this.parseExpression())}return this.options.allowImportExportEverywhere||(e||this.raise(this.start,"'import' and 'export' may only appear at the top level"),this.inModule||this.raise(this.start,"'import' and 'export' may appear only with 'sourceType: module'")),i===f._import?this.parseImport(r):this.parseExport(r,s);default:if(this.isAsyncFunction())return t&&this.unexpected(),this.next(),this.parseFunctionStatement(r,true,!t);var h=this.isAwaitUsing(false)?"await using":this.isUsing(false)?"using":null;if(h)return e&&this.options.sourceType==="script"&&this.raise(this.start,"Using declaration cannot appear in the top level when source type is `script`"),h==="await using"&&(this.canAwait||this.raise(this.start,"Await using cannot appear outside of async function"),this.next()),this.next(),this.parseVar(r,false,h),this.semicolon(),this.finishNode(r,"VariableDeclaration");var d=this.value,m=this.parseExpression();return i===f.name&&m.type==="Identifier"&&this.eat(f.colon)?this.parseLabeledStatement(r,d,m,t):this.parseExpressionStatement(r,m)}};K.parseBreakContinueStatement=function(t,e){var s=e==="break";this.next(),this.eat(f.semi)||this.insertSemicolon()?t.label=null:this.type!==f.name?this.unexpected():(t.label=this.parseIdent(),this.semicolon());for(var i=0;i<this.labels.length;++i){var r=this.labels[i];if((t.label==null||r.name===t.label.name)&&(r.kind!=null&&(s||r.kind==="loop")||t.label&&s))break}return i===this.labels.length&&this.raise(t.start,"Unsyntactic "+e),this.finishNode(t,s?"BreakStatement":"ContinueStatement")};K.parseDebuggerStatement=function(t){return this.next(),this.semicolon(),this.finishNode(t,"DebuggerStatement")};K.parseDoStatement=function(t){return this.next(),this.labels.push(Pa),t.body=this.parseStatement("do"),this.labels.pop(),this.expect(f._while),t.test=this.parseParenExpression(),this.options.ecmaVersion>=6?this.eat(f.semi):this.semicolon(),this.finishNode(t,"DoWhileStatement")};K.parseForStatement=function(t){this.next();var e=this.options.ecmaVersion>=9&&this.canAwait&&this.eatContextual("await")?this.lastTokStart:-1;if(this.labels.push(Pa),this.enterScope(0),this.expect(f.parenL),this.type===f.semi)return e>-1&&this.unexpected(e),this.parseFor(t,null);var s=this.isLet();if(this.type===f._var||this.type===f._const||s){var i=this.startNode(),r=s?"let":this.value;return this.next(),this.parseVar(i,true,r),this.finishNode(i,"VariableDeclaration"),this.parseForAfterInit(t,i,e)}var a=this.isContextual("let"),o=false,c=this.isUsing(true)?"using":this.isAwaitUsing(true)?"await using":null;if(c){var l=this.startNode();return this.next(),c==="await using"&&this.next(),this.parseVar(l,true,c),this.finishNode(l,"VariableDeclaration"),this.parseForAfterInit(t,l,e)}var h=this.containsEsc,d=new yr,m=this.start,_=e>-1?this.parseExprSubscripts(d,"await"):this.parseExpression(true,d);return this.type===f._in||(o=this.options.ecmaVersion>=6&&this.isContextual("of"))?(e>-1?(this.type===f._in&&this.unexpected(e),t.await=true):o&&this.options.ecmaVersion>=8&&(_.start===m&&!h&&_.type==="Identifier"&&_.name==="async"?this.unexpected():this.options.ecmaVersion>=9&&(t.await=false)),a&&o&&this.raise(_.start,"The left-hand side of a for-of loop may not start with 'let'."),this.toAssignable(_,false,d),this.checkLValPattern(_),this.parseForIn(t,_)):(this.checkExpressionErrors(d,true),e>-1&&this.unexpected(e),this.parseFor(t,_))};K.parseForAfterInit=function(t,e,s){return(this.type===f._in||this.options.ecmaVersion>=6&&this.isContextual("of"))&&e.declarations.length===1?(this.options.ecmaVersion>=9&&(this.type===f._in?s>-1&&this.unexpected(s):t.await=s>-1),this.parseForIn(t,e)):(s>-1&&this.unexpected(s),this.parseFor(t,e))};K.parseFunctionStatement=function(t,e,s){return this.next(),this.parseFunction(t,ei|(s?0:Jn),false,e)};K.parseIfStatement=function(t){return this.next(),t.test=this.parseParenExpression(),t.consequent=this.parseStatement("if"),t.alternate=this.eat(f._else)?this.parseStatement("if"):null,this.finishNode(t,"IfStatement")};K.parseReturnStatement=function(t){return!this.inFunction&&!this.options.allowReturnOutsideFunction&&this.raise(this.start,"'return' outside of function"),this.next(),this.eat(f.semi)||this.insertSemicolon()?t.argument=null:(t.argument=this.parseExpression(),this.semicolon()),this.finishNode(t,"ReturnStatement")};K.parseSwitchStatement=function(t){this.next(),t.discriminant=this.parseParenExpression(),t.cases=[],this.expect(f.braceL),this.labels.push(Rh),this.enterScope(0);for(var e,s=false;this.type!==f.braceR;)if(this.type===f._case||this.type===f._default){var i=this.type===f._case;e&&this.finishNode(e,"SwitchCase"),t.cases.push(e=this.startNode()),e.consequent=[],this.next(),i?e.test=this.parseExpression():(s&&this.raiseRecoverable(this.lastTokStart,"Multiple default clauses"),s=true,e.test=null),this.expect(f.colon)}else e||this.unexpected(),e.consequent.push(this.parseStatement(null));return this.exitScope(),e&&this.finishNode(e,"SwitchCase"),this.next(),this.labels.pop(),this.finishNode(t,"SwitchStatement")};K.parseThrowStatement=function(t){return this.next(),st.test(this.input.slice(this.lastTokEnd,this.start))&&this.raise(this.lastTokEnd,"Illegal newline after throw"),t.argument=this.parseExpression(),this.semicolon(),this.finishNode(t,"ThrowStatement")};var Ph=[];K.parseCatchClauseParam=function(){var t=this.parseBindingAtom(),e=t.type==="Identifier";return this.enterScope(e?cu:0),this.checkLValPattern(t,e?hu:Kt),this.expect(f.parenR),t};K.parseTryStatement=function(t){if(this.next(),t.block=this.parseBlock(),t.handler=null,this.type===f._catch){var e=this.startNode();this.next(),this.eat(f.parenL)?e.param=this.parseCatchClauseParam():(this.options.ecmaVersion<10&&this.unexpected(),e.param=null,this.enterScope(0)),e.body=this.parseBlock(false),this.exitScope(),t.handler=this.finishNode(e,"CatchClause")}return t.finalizer=this.eat(f._finally)?this.parseBlock():null,!t.handler&&!t.finalizer&&this.raise(t.start,"Missing catch or finally clause"),this.finishNode(t,"TryStatement")};K.parseVarStatement=function(t,e,s){return this.next(),this.parseVar(t,false,e,s),this.semicolon(),this.finishNode(t,"VariableDeclaration")};K.parseWhileStatement=function(t){return this.next(),t.test=this.parseParenExpression(),this.labels.push(Pa),t.body=this.parseStatement("while"),this.labels.pop(),this.finishNode(t,"WhileStatement")};K.parseWithStatement=function(t){return this.strict&&this.raise(this.start,"'with' in strict mode"),this.next(),t.object=this.parseParenExpression(),t.body=this.parseStatement("with"),this.finishNode(t,"WithStatement")};K.parseEmptyStatement=function(t){return this.next(),this.finishNode(t,"EmptyStatement")};K.parseLabeledStatement=function(t,e,s,i){for(var r=0,a=this.labels;r<a.length;r+=1){var o=a[r];o.name===e&&this.raise(s.start,"Label '"+e+"' is already declared")}for(var c=this.type.isLoop?"loop":this.type===f._switch?"switch":null,l=this.labels.length-1;l>=0;l--){var h=this.labels[l];if(h.statementStart===t.start)h.statementStart=this.start,h.kind=c;else break}return this.labels.push({name:e,kind:c,statementStart:this.start}),t.body=this.parseStatement(i?i.indexOf("label")===-1?i+"label":i:"label"),this.labels.pop(),t.label=s,this.finishNode(t,"LabeledStatement")};K.parseExpressionStatement=function(t,e){return t.expression=e,this.semicolon(),this.finishNode(t,"ExpressionStatement")};K.parseBlock=function(t,e,s){for(t===void 0&&(t=true),e===void 0&&(e=this.startNode()),e.body=[],this.expect(f.braceL),t&&this.enterScope(0);this.type!==f.braceR;){var i=this.parseStatement(null);e.body.push(i)}return s&&(this.strict=false),this.next(),t&&this.exitScope(),this.finishNode(e,"BlockStatement")};K.parseFor=function(t,e){return t.init=e,this.expect(f.semi),t.test=this.type===f.semi?null:this.parseExpression(),this.expect(f.semi),t.update=this.type===f.parenR?null:this.parseExpression(),this.expect(f.parenR),t.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(t,"ForStatement")};K.parseForIn=function(t,e){var s=this.type===f._in;return this.next(),e.type==="VariableDeclaration"&&e.declarations[0].init!=null&&(!s||this.options.ecmaVersion<8||this.strict||e.kind!=="var"||e.declarations[0].id.type!=="Identifier")&&this.raise(e.start,(s?"for-in":"for-of")+" loop variable declaration may not have an initializer"),t.left=e,t.right=s?this.parseExpression():this.parseMaybeAssign(),this.expect(f.parenR),t.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(t,s?"ForInStatement":"ForOfStatement")};K.parseVar=function(t,e,s,i){for(t.declarations=[],t.kind=s;;){var r=this.startNode();if(this.parseVarId(r,s),this.eat(f.eq)?r.init=this.parseMaybeAssign(e):!i&&s==="const"&&!(this.type===f._in||this.options.ecmaVersion>=6&&this.isContextual("of"))?this.unexpected():!i&&(s==="using"||s==="await using")&&this.options.ecmaVersion>=17&&this.type!==f._in&&!this.isContextual("of")?this.raise(this.lastTokEnd,"Missing initializer in "+s+" declaration"):!i&&r.id.type!=="Identifier"&&!(e&&(this.type===f._in||this.isContextual("of")))?this.raise(this.lastTokEnd,"Complex binding patterns require an initialization value"):r.init=null,t.declarations.push(this.finishNode(r,"VariableDeclarator")),!this.eat(f.comma))break}return t};K.parseVarId=function(t,e){t.id=e==="using"||e==="await using"?this.parseIdent():this.parseBindingAtom(),this.checkLValPattern(t.id,e==="var"?Ra:Kt,false)};var ei=1,Jn=2,du=4;K.parseFunction=function(t,e,s,i,r){this.initFunction(t),(this.options.ecmaVersion>=9||this.options.ecmaVersion>=6&&!i)&&(this.type===f.star&&e&Jn&&this.unexpected(),t.generator=this.eat(f.star)),this.options.ecmaVersion>=8&&(t.async=!!i),e&ei&&(t.id=e&du&&this.type!==f.name?null:this.parseIdent(),t.id&&!(e&Jn)&&this.checkLValSimple(t.id,this.strict||t.generator||t.async?this.treatFunctionsAsVar?Ra:Kt:lu));var a=this.yieldPos,o=this.awaitPos,c=this.awaitIdentPos;return this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(Ia(t.async,t.generator)),e&ei||(t.id=this.type===f.name?this.parseIdent():null),this.parseFunctionParams(t),this.parseFunctionBody(t,s,false,r),this.yieldPos=a,this.awaitPos=o,this.awaitIdentPos=c,this.finishNode(t,e&ei?"FunctionDeclaration":"FunctionExpression")};K.parseFunctionParams=function(t){this.expect(f.parenL),t.params=this.parseBindingList(f.parenR,false,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams()};K.parseClass=function(t,e){this.next();var s=this.strict;this.strict=true,this.parseClassId(t,e),this.parseClassSuper(t);var i=this.enterClassBody(),r=this.startNode(),a=false;for(r.body=[],this.expect(f.braceL);this.type!==f.braceR;){var o=this.parseClassElement(t.superClass!==null);o&&(r.body.push(o),o.type==="MethodDefinition"&&o.kind==="constructor"?(a&&this.raiseRecoverable(o.start,"Duplicate constructor in the same class"),a=true):o.key&&o.key.type==="PrivateIdentifier"&&Lh(i,o)&&this.raiseRecoverable(o.key.start,"Identifier '#"+o.key.name+"' has already been declared"))}return this.strict=s,this.next(),t.body=this.finishNode(r,"ClassBody"),this.exitClassBody(),this.finishNode(t,e?"ClassDeclaration":"ClassExpression")};K.parseClassElement=function(t){if(this.eat(f.semi))return null;var e=this.options.ecmaVersion,s=this.startNode(),i="",r=false,a=false,o="method",c=false;if(this.eatContextual("static")){if(e>=13&&this.eat(f.braceL))return this.parseClassStaticBlock(s),s;this.isClassElementNameStart()||this.type===f.star?c=true:i="static"}if(s.static=c,!i&&e>=8&&this.eatContextual("async")&&((this.isClassElementNameStart()||this.type===f.star)&&!this.canInsertSemicolon()?a=true:i="async"),!i&&(e>=9||!a)&&this.eat(f.star)&&(r=true),!i&&!a&&!r){var l=this.value;(this.eatContextual("get")||this.eatContextual("set"))&&(this.isClassElementNameStart()?o=l:i=l)}if(i?(s.computed=false,s.key=this.startNodeAt(this.lastTokStart,this.lastTokStartLoc),s.key.name=i,this.finishNode(s.key,"Identifier")):this.parseClassElementName(s),e<13||this.type===f.parenL||o!=="method"||r||a){var h=!s.static&&Hi(s,"constructor"),d=h&&t;h&&o!=="method"&&this.raise(s.key.start,"Constructor can't have get/set modifier"),s.kind=h?"constructor":o,this.parseClassMethod(s,r,a,d)}else this.parseClassField(s);return s};K.isClassElementNameStart=function(){return this.type===f.name||this.type===f.privateId||this.type===f.num||this.type===f.string||this.type===f.bracketL||this.type.keyword};K.parseClassElementName=function(t){this.type===f.privateId?(this.value==="constructor"&&this.raise(this.start,"Classes can't have an element named '#constructor'"),t.computed=false,t.key=this.parsePrivateIdent()):this.parsePropertyName(t)};K.parseClassMethod=function(t,e,s,i){var r=t.key;t.kind==="constructor"?(e&&this.raise(r.start,"Constructor can't be a generator"),s&&this.raise(r.start,"Constructor can't be an async method")):t.static&&Hi(t,"prototype")&&this.raise(r.start,"Classes may not have a static property named prototype");var a=t.value=this.parseMethod(e,s,i);return t.kind==="get"&&a.params.length!==0&&this.raiseRecoverable(a.start,"getter should have no params"),t.kind==="set"&&a.params.length!==1&&this.raiseRecoverable(a.start,"setter should have exactly one param"),t.kind==="set"&&a.params[0].type==="RestElement"&&this.raiseRecoverable(a.params[0].start,"Setter cannot use rest params"),this.finishNode(t,"MethodDefinition")};K.parseClassField=function(t){return Hi(t,"constructor")?this.raise(t.key.start,"Classes can't have a field named 'constructor'"):t.static&&Hi(t,"prototype")&&this.raise(t.key.start,"Classes can't have a static field named 'prototype'"),this.eat(f.eq)?(this.enterScope(yi|gr),t.value=this.parseMaybeAssign(),this.exitScope()):t.value=null,this.semicolon(),this.finishNode(t,"PropertyDefinition")};K.parseClassStaticBlock=function(t){t.body=[];var e=this.labels;for(this.labels=[],this.enterScope(ks|gr);this.type!==f.braceR;){var s=this.parseStatement(null);t.body.push(s)}return this.next(),this.exitScope(),this.labels=e,this.finishNode(t,"StaticBlock")};K.parseClassId=function(t,e){this.type===f.name?(t.id=this.parseIdent(),e&&this.checkLValSimple(t.id,Kt,false)):(e===true&&this.unexpected(),t.id=null)};K.parseClassSuper=function(t){t.superClass=this.eat(f._extends)?this.parseExprSubscripts(null,false):null};K.enterClassBody=function(){var t={declared:Object.create(null),used:[]};return this.privateNameStack.push(t),t.declared};K.exitClassBody=function(){var t=this.privateNameStack.pop(),e=t.declared,s=t.used;if(this.options.checkPrivateFields)for(var i=this.privateNameStack.length,r=i===0?null:this.privateNameStack[i-1],a=0;a<s.length;++a){var o=s[a];Vs(e,o.name)||(r?r.used.push(o):this.raiseRecoverable(o.start,"Private field '#"+o.name+"' must be declared in an enclosing class"))}};function Lh(t,e){var s=e.key.name,i=t[s],r="true";return e.type==="MethodDefinition"&&(e.kind==="get"||e.kind==="set")&&(r=(e.static?"s":"i")+e.kind),i==="iget"&&r==="iset"||i==="iset"&&r==="iget"||i==="sget"&&r==="sset"||i==="sset"&&r==="sget"?(t[s]="true",false):i?true:(t[s]=r,false)}function Hi(t,e){var s=t.computed,i=t.key;return!s&&(i.type==="Identifier"&&i.name===e||i.type==="Literal"&&i.value===e)}K.parseExportAllDeclaration=function(t,e){return this.options.ecmaVersion>=11&&(this.eatContextual("as")?(t.exported=this.parseModuleExportName(),this.checkExport(e,t.exported,this.lastTokStart)):t.exported=null),this.expectContextual("from"),this.type!==f.string&&this.unexpected(),t.source=this.parseExprAtom(),this.options.ecmaVersion>=16&&(t.attributes=this.parseWithClause()),this.semicolon(),this.finishNode(t,"ExportAllDeclaration")};K.parseExport=function(t,e){if(this.next(),this.eat(f.star))return this.parseExportAllDeclaration(t,e);if(this.eat(f._default))return this.checkExport(e,"default",this.lastTokStart),t.declaration=this.parseExportDefaultDeclaration(),this.finishNode(t,"ExportDefaultDeclaration");if(this.shouldParseExportStatement())t.declaration=this.parseExportDeclaration(t),t.declaration.type==="VariableDeclaration"?this.checkVariableExport(e,t.declaration.declarations):this.checkExport(e,t.declaration.id,t.declaration.id.start),t.specifiers=[],t.source=null,this.options.ecmaVersion>=16&&(t.attributes=[]);else{if(t.declaration=null,t.specifiers=this.parseExportSpecifiers(e),this.eatContextual("from"))this.type!==f.string&&this.unexpected(),t.source=this.parseExprAtom(),this.options.ecmaVersion>=16&&(t.attributes=this.parseWithClause());else{for(var s=0,i=t.specifiers;s<i.length;s+=1){var r=i[s];this.checkUnreserved(r.local),this.checkLocalExport(r.local),r.local.type==="Literal"&&this.raise(r.local.start,"A string literal cannot be used as an exported binding without `from`.")}t.source=null,this.options.ecmaVersion>=16&&(t.attributes=[])}this.semicolon()}return this.finishNode(t,"ExportNamedDeclaration")};K.parseExportDeclaration=function(t){return this.parseStatement(null)};K.parseExportDefaultDeclaration=function(){var t;if(this.type===f._function||(t=this.isAsyncFunction())){var e=this.startNode();return this.next(),t&&this.next(),this.parseFunction(e,ei|du,false,t)}else if(this.type===f._class){var s=this.startNode();return this.parseClass(s,"nullableID")}else{var i=this.parseMaybeAssign();return this.semicolon(),i}};K.checkExport=function(t,e,s){t&&(typeof e!="string"&&(e=e.type==="Identifier"?e.name:e.value),Vs(t,e)&&this.raiseRecoverable(s,"Duplicate export '"+e+"'"),t[e]=true)};K.checkPatternExport=function(t,e){var s=e.type;if(s==="Identifier")this.checkExport(t,e,e.start);else if(s==="ObjectPattern")for(var i=0,r=e.properties;i<r.length;i+=1){var a=r[i];this.checkPatternExport(t,a)}else if(s==="ArrayPattern")for(var o=0,c=e.elements;o<c.length;o+=1){var l=c[o];l&&this.checkPatternExport(t,l)}else s==="Property"?this.checkPatternExport(t,e.value):s==="AssignmentPattern"?this.checkPatternExport(t,e.left):s==="RestElement"&&this.checkPatternExport(t,e.argument)};K.checkVariableExport=function(t,e){if(t)for(var s=0,i=e;s<i.length;s+=1){var r=i[s];this.checkPatternExport(t,r.id)}};K.shouldParseExportStatement=function(){return this.type.keyword==="var"||this.type.keyword==="const"||this.type.keyword==="class"||this.type.keyword==="function"||this.isLet()||this.isAsyncFunction()};K.parseExportSpecifier=function(t){var e=this.startNode();return e.local=this.parseModuleExportName(),e.exported=this.eatContextual("as")?this.parseModuleExportName():e.local,this.checkExport(t,e.exported,e.exported.start),this.finishNode(e,"ExportSpecifier")};K.parseExportSpecifiers=function(t){var e=[],s=true;for(this.expect(f.braceL);!this.eat(f.braceR);){if(s)s=false;else if(this.expect(f.comma),this.afterTrailingComma(f.braceR))break;e.push(this.parseExportSpecifier(t))}return e};K.parseImport=function(t){return this.next(),this.type===f.string?(t.specifiers=Ph,t.source=this.parseExprAtom()):(t.specifiers=this.parseImportSpecifiers(),this.expectContextual("from"),t.source=this.type===f.string?this.parseExprAtom():this.unexpected()),this.options.ecmaVersion>=16&&(t.attributes=this.parseWithClause()),this.semicolon(),this.finishNode(t,"ImportDeclaration")};K.parseImportSpecifier=function(){var t=this.startNode();return t.imported=this.parseModuleExportName(),this.eatContextual("as")?t.local=this.parseIdent():(this.checkUnreserved(t.imported),t.local=t.imported),this.checkLValSimple(t.local,Kt),this.finishNode(t,"ImportSpecifier")};K.parseImportDefaultSpecifier=function(){var t=this.startNode();return t.local=this.parseIdent(),this.checkLValSimple(t.local,Kt),this.finishNode(t,"ImportDefaultSpecifier")};K.parseImportNamespaceSpecifier=function(){var t=this.startNode();return this.next(),this.expectContextual("as"),t.local=this.parseIdent(),this.checkLValSimple(t.local,Kt),this.finishNode(t,"ImportNamespaceSpecifier")};K.parseImportSpecifiers=function(){var t=[],e=true;if(this.type===f.name&&(t.push(this.parseImportDefaultSpecifier()),!this.eat(f.comma)))return t;if(this.type===f.star)return t.push(this.parseImportNamespaceSpecifier()),t;for(this.expect(f.braceL);!this.eat(f.braceR);){if(e)e=false;else if(this.expect(f.comma),this.afterTrailingComma(f.braceR))break;t.push(this.parseImportSpecifier())}return t};K.parseWithClause=function(){var t=[];if(!this.eat(f._with))return t;this.expect(f.braceL);for(var e={},s=true;!this.eat(f.braceR);){if(s)s=false;else if(this.expect(f.comma),this.afterTrailingComma(f.braceR))break;var i=this.parseImportAttribute(),r=i.key.type==="Identifier"?i.key.name:i.key.value;Vs(e,r)&&this.raiseRecoverable(i.key.start,"Duplicate attribute key '"+r+"'"),e[r]=true,t.push(i)}return t};K.parseImportAttribute=function(){var t=this.startNode();return t.key=this.type===f.string?this.parseExprAtom():this.parseIdent(this.options.allowReserved!=="never"),this.expect(f.colon),this.type!==f.string&&this.unexpected(),t.value=this.parseExprAtom(),this.finishNode(t,"ImportAttribute")};K.parseModuleExportName=function(){if(this.options.ecmaVersion>=13&&this.type===f.string){var t=this.parseLiteral(this.value);return Th.test(t.value)&&this.raise(t.start,"An export name cannot include a lone surrogate."),t}return this.parseIdent(true)};K.adaptDirectivePrologue=function(t){for(var e=0;e<t.length&&this.isDirectiveCandidate(t[e]);++e)t[e].directive=t[e].expression.raw.slice(1,-1)};K.isDirectiveCandidate=function(t){return this.options.ecmaVersion>=5&&t.type==="ExpressionStatement"&&t.expression.type==="Literal"&&typeof t.expression.value=="string"&&(this.input[t.start]==='"'||this.input[t.start]==="'")};var ht=Ne.prototype;ht.toAssignable=function(t,e,s){if(this.options.ecmaVersion>=6&&t)switch(t.type){case"Identifier":this.inAsync&&t.name==="await"&&this.raise(t.start,"Cannot use 'await' as identifier inside an async function");break;case"ObjectPattern":case"ArrayPattern":case"AssignmentPattern":case"RestElement":break;case"ObjectExpression":t.type="ObjectPattern",s&&this.checkPatternErrors(s,true);for(var i=0,r=t.properties;i<r.length;i+=1){var a=r[i];this.toAssignable(a,e),a.type==="RestElement"&&(a.argument.type==="ArrayPattern"||a.argument.type==="ObjectPattern")&&this.raise(a.argument.start,"Unexpected token")}break;case"Property":t.kind!=="init"&&this.raise(t.key.start,"Object pattern can't contain getter or setter"),this.toAssignable(t.value,e);break;case"ArrayExpression":t.type="ArrayPattern",s&&this.checkPatternErrors(s,true),this.toAssignableList(t.elements,e);break;case"SpreadElement":t.type="RestElement",this.toAssignable(t.argument,e),t.argument.type==="AssignmentPattern"&&this.raise(t.argument.start,"Rest elements cannot have a default value");break;case"AssignmentExpression":t.operator!=="="&&this.raise(t.left.end,"Only '=' operator can be used for specifying default value."),t.type="AssignmentPattern",delete t.operator,this.toAssignable(t.left,e);break;case"ParenthesizedExpression":this.toAssignable(t.expression,e,s);break;case"ChainExpression":this.raiseRecoverable(t.start,"Optional chaining cannot appear in left-hand side");break;case"MemberExpression":if(!e)break;default:this.raise(t.start,"Assigning to rvalue")}else s&&this.checkPatternErrors(s,true);return t};ht.toAssignableList=function(t,e){for(var s=t.length,i=0;i<s;i++){var r=t[i];r&&this.toAssignable(r,e)}if(s){var a=t[s-1];this.options.ecmaVersion===6&&e&&a&&a.type==="RestElement"&&a.argument.type!=="Identifier"&&this.unexpected(a.argument.start)}return t};ht.parseSpread=function(t){var e=this.startNode();return this.next(),e.argument=this.parseMaybeAssign(false,t),this.finishNode(e,"SpreadElement")};ht.parseRestBinding=function(){var t=this.startNode();return this.next(),this.options.ecmaVersion===6&&this.type!==f.name&&this.unexpected(),t.argument=this.parseBindingAtom(),this.finishNode(t,"RestElement")};ht.parseBindingAtom=function(){if(this.options.ecmaVersion>=6)switch(this.type){case f.bracketL:var t=this.startNode();return this.next(),t.elements=this.parseBindingList(f.bracketR,true,true),this.finishNode(t,"ArrayPattern");case f.braceL:return this.parseObj(true)}return this.parseIdent()};ht.parseBindingList=function(t,e,s,i){for(var r=[],a=true;!this.eat(t);)if(a?a=false:this.expect(f.comma),e&&this.type===f.comma)r.push(null);else{if(s&&this.afterTrailingComma(t))break;if(this.type===f.ellipsis){var o=this.parseRestBinding();this.parseBindingListItem(o),r.push(o),this.type===f.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element"),this.expect(t);break}else r.push(this.parseAssignableListItem(i))}return r};ht.parseAssignableListItem=function(t){var e=this.parseMaybeDefault(this.start,this.startLoc);return this.parseBindingListItem(e),e};ht.parseBindingListItem=function(t){return t};ht.parseMaybeDefault=function(t,e,s){if(s=s||this.parseBindingAtom(),this.options.ecmaVersion<6||!this.eat(f.eq))return s;var i=this.startNodeAt(t,e);return i.left=s,i.right=this.parseMaybeAssign(),this.finishNode(i,"AssignmentPattern")};ht.checkLValSimple=function(t,e,s){e===void 0&&(e=qi);var i=e!==qi;switch(t.type){case"Identifier":this.strict&&this.reservedWordsStrictBind.test(t.name)&&this.raiseRecoverable(t.start,(i?"Binding ":"Assigning to ")+t.name+" in strict mode"),i&&(e===Kt&&t.name==="let"&&this.raiseRecoverable(t.start,"let is disallowed as a lexically bound name"),s&&(Vs(s,t.name)&&this.raiseRecoverable(t.start,"Argument name clash"),s[t.name]=true),e!==fu&&this.declareName(t.name,e,t.start));break;case"ChainExpression":this.raiseRecoverable(t.start,"Optional chaining cannot appear in left-hand side");break;case"MemberExpression":i&&this.raiseRecoverable(t.start,"Binding member expression");break;case"ParenthesizedExpression":return i&&this.raiseRecoverable(t.start,"Binding parenthesized expression"),this.checkLValSimple(t.expression,e,s);default:this.raise(t.start,(i?"Binding":"Assigning to")+" rvalue")}};ht.checkLValPattern=function(t,e,s){switch(e===void 0&&(e=qi),t.type){case"ObjectPattern":for(var i=0,r=t.properties;i<r.length;i+=1){var a=r[i];this.checkLValInnerPattern(a,e,s)}break;case"ArrayPattern":for(var o=0,c=t.elements;o<c.length;o+=1){var l=c[o];l&&this.checkLValInnerPattern(l,e,s)}break;default:this.checkLValSimple(t,e,s)}};ht.checkLValInnerPattern=function(t,e,s){switch(e===void 0&&(e=qi),t.type){case"Property":this.checkLValInnerPattern(t.value,e,s);break;case"AssignmentPattern":this.checkLValPattern(t.left,e,s);break;case"RestElement":this.checkLValPattern(t.argument,e,s);break;default:this.checkLValPattern(t,e,s)}};var ft=function(e,s,i,r,a){this.token=e,this.isExpr=!!s,this.preserveSpace=!!i,this.override=r,this.generator=!!a},Te={b_stat:new ft("{",false),b_expr:new ft("{",true),b_tmpl:new ft("${",false),p_stat:new ft("(",false),p_expr:new ft("(",true),q_tmpl:new ft("`",true,true,function(t){return t.tryReadTemplateToken()}),f_stat:new ft("function",false),f_expr:new ft("function",true),f_expr_gen:new ft("function",true,false,null,true),f_gen:new ft("function",false,false,null,true)},js=Ne.prototype;js.initialContext=function(){return[Te.b_stat]};js.curContext=function(){return this.context[this.context.length-1]};js.braceIsBlock=function(t){var e=this.curContext();return e===Te.f_expr||e===Te.f_stat?true:t===f.colon&&(e===Te.b_stat||e===Te.b_expr)?!e.isExpr:t===f._return||t===f.name&&this.exprAllowed?st.test(this.input.slice(this.lastTokEnd,this.start)):t===f._else||t===f.semi||t===f.eof||t===f.parenR||t===f.arrow?true:t===f.braceL?e===Te.b_stat:t===f._var||t===f._const||t===f.name?false:!this.exprAllowed};js.inGeneratorContext=function(){for(var t=this.context.length-1;t>=1;t--){var e=this.context[t];if(e.token==="function")return e.generator}return false};js.updateContext=function(t){var e,s=this.type;s.keyword&&t===f.dot?this.exprAllowed=false:(e=s.updateContext)?e.call(this,t):this.exprAllowed=s.beforeExpr};js.overrideContext=function(t){this.curContext()!==t&&(this.context[this.context.length-1]=t)};f.parenR.updateContext=f.braceR.updateContext=function(){if(this.context.length===1){this.exprAllowed=true;return}var t=this.context.pop();t===Te.b_stat&&this.curContext().token==="function"&&(t=this.context.pop()),this.exprAllowed=!t.isExpr};f.braceL.updateContext=function(t){this.context.push(this.braceIsBlock(t)?Te.b_stat:Te.b_expr),this.exprAllowed=true};f.dollarBraceL.updateContext=function(){this.context.push(Te.b_tmpl),this.exprAllowed=true};f.parenL.updateContext=function(t){var e=t===f._if||t===f._for||t===f._with||t===f._while;this.context.push(e?Te.p_stat:Te.p_expr),this.exprAllowed=true};f.incDec.updateContext=function(){};f._function.updateContext=f._class.updateContext=function(t){t.beforeExpr&&t!==f._else&&!(t===f.semi&&this.curContext()!==Te.p_stat)&&!(t===f._return&&st.test(this.input.slice(this.lastTokEnd,this.start)))&&!((t===f.colon||t===f.braceL)&&this.curContext()===Te.b_stat)?this.context.push(Te.f_expr):this.context.push(Te.f_stat),this.exprAllowed=false};f.colon.updateContext=function(){this.curContext().token==="function"&&this.context.pop(),this.exprAllowed=true};f.backQuote.updateContext=function(){this.curContext()===Te.q_tmpl?this.context.pop():this.context.push(Te.q_tmpl),this.exprAllowed=false};f.star.updateContext=function(t){if(t===f._function){var e=this.context.length-1;this.context[e]===Te.f_expr?this.context[e]=Te.f_expr_gen:this.context[e]=Te.f_gen}this.exprAllowed=true};f.name.updateContext=function(t){var e=false;this.options.ecmaVersion>=6&&t!==f.dot&&(this.value==="of"&&!this.exprAllowed||this.value==="yield"&&this.inGeneratorContext())&&(e=true),this.exprAllowed=e};var he=Ne.prototype;he.checkPropClash=function(t,e,s){if(!(this.options.ecmaVersion>=9&&t.type==="SpreadElement")&&!(this.options.ecmaVersion>=6&&(t.computed||t.method||t.shorthand))){var i=t.key,r;switch(i.type){case"Identifier":r=i.name;break;case"Literal":r=String(i.value);break;default:return}var a=t.kind;if(this.options.ecmaVersion>=6){r==="__proto__"&&a==="init"&&(e.proto&&(s?s.doubleProto<0&&(s.doubleProto=i.start):this.raiseRecoverable(i.start,"Redefinition of __proto__ property")),e.proto=true);return}r="$"+r;var o=e[r];if(o){var c;a==="init"?c=this.strict&&o.init||o.get||o.set:c=o.init||o[a],c&&this.raiseRecoverable(i.start,"Redefinition of property")}else o=e[r]={init:false,get:false,set:false};o[a]=true}};he.parseExpression=function(t,e){var s=this.start,i=this.startLoc,r=this.parseMaybeAssign(t,e);if(this.type===f.comma){var a=this.startNodeAt(s,i);for(a.expressions=[r];this.eat(f.comma);)a.expressions.push(this.parseMaybeAssign(t,e));return this.finishNode(a,"SequenceExpression")}return r};he.parseMaybeAssign=function(t,e,s){if(this.isContextual("yield")){if(this.inGenerator)return this.parseYield(t);this.exprAllowed=false}var i=false,r=-1,a=-1,o=-1;e?(r=e.parenthesizedAssign,a=e.trailingComma,o=e.doubleProto,e.parenthesizedAssign=e.trailingComma=-1):(e=new yr,i=true);var c=this.start,l=this.startLoc;(this.type===f.parenL||this.type===f.name)&&(this.potentialArrowAt=this.start,this.potentialArrowInForAwait=t==="await");var h=this.parseMaybeConditional(t,e);if(s&&(h=s.call(this,h,c,l)),this.type.isAssign){var d=this.startNodeAt(c,l);return d.operator=this.value,this.type===f.eq&&(h=this.toAssignable(h,false,e)),i||(e.parenthesizedAssign=e.trailingComma=e.doubleProto=-1),e.shorthandAssign>=h.start&&(e.shorthandAssign=-1),this.type===f.eq?this.checkLValPattern(h):this.checkLValSimple(h),d.left=h,this.next(),d.right=this.parseMaybeAssign(t),o>-1&&(e.doubleProto=o),this.finishNode(d,"AssignmentExpression")}else i&&this.checkExpressionErrors(e,true);return r>-1&&(e.parenthesizedAssign=r),a>-1&&(e.trailingComma=a),h};he.parseMaybeConditional=function(t,e){var s=this.start,i=this.startLoc,r=this.parseExprOps(t,e);if(this.checkExpressionErrors(e))return r;if(this.eat(f.question)){var a=this.startNodeAt(s,i);return a.test=r,a.consequent=this.parseMaybeAssign(),this.expect(f.colon),a.alternate=this.parseMaybeAssign(t),this.finishNode(a,"ConditionalExpression")}return r};he.parseExprOps=function(t,e){var s=this.start,i=this.startLoc,r=this.parseMaybeUnary(e,false,false,t);return this.checkExpressionErrors(e)||r.start===s&&r.type==="ArrowFunctionExpression"?r:this.parseExprOp(r,s,i,-1,t)};he.parseExprOp=function(t,e,s,i,r){var a=this.type.binop;if(a!=null&&(!r||this.type!==f._in)&&a>i){var o=this.type===f.logicalOR||this.type===f.logicalAND,c=this.type===f.coalesce;c&&(a=f.logicalAND.binop);var l=this.value;this.next();var h=this.start,d=this.startLoc,m=this.parseExprOp(this.parseMaybeUnary(null,false,false,r),h,d,a,r),_=this.buildBinary(e,s,t,m,l,o||c);return(o&&this.type===f.coalesce||c&&(this.type===f.logicalOR||this.type===f.logicalAND))&&this.raiseRecoverable(this.start,"Logical expressions and coalesce expressions cannot be mixed. Wrap either by parentheses"),this.parseExprOp(_,e,s,i,r)}return t};he.buildBinary=function(t,e,s,i,r,a){i.type==="PrivateIdentifier"&&this.raise(i.start,"Private identifier can only be left side of binary expression");var o=this.startNodeAt(t,e);return o.left=s,o.operator=r,o.right=i,this.finishNode(o,a?"LogicalExpression":"BinaryExpression")};he.parseMaybeUnary=function(t,e,s,i){var r=this.start,a=this.startLoc,o;if(this.isContextual("await")&&this.canAwait)o=this.parseAwait(i),e=true;else if(this.type.prefix){var c=this.startNode(),l=this.type===f.incDec;c.operator=this.value,c.prefix=true,this.next(),c.argument=this.parseMaybeUnary(null,true,l,i),this.checkExpressionErrors(t,true),l?this.checkLValSimple(c.argument):this.strict&&c.operator==="delete"&&pu(c.argument)?this.raiseRecoverable(c.start,"Deleting local variable in strict mode"):c.operator==="delete"&&ea(c.argument)?this.raiseRecoverable(c.start,"Private fields can not be deleted"):e=true,o=this.finishNode(c,l?"UpdateExpression":"UnaryExpression")}else if(!e&&this.type===f.privateId)(i||this.privateNameStack.length===0)&&this.options.checkPrivateFields&&this.unexpected(),o=this.parsePrivateIdent(),this.type!==f._in&&this.unexpected();else{if(o=this.parseExprSubscripts(t,i),this.checkExpressionErrors(t))return o;for(;this.type.postfix&&!this.canInsertSemicolon();){var h=this.startNodeAt(r,a);h.operator=this.value,h.prefix=false,h.argument=o,this.checkLValSimple(o),this.next(),o=this.finishNode(h,"UpdateExpression")}}if(!s&&this.eat(f.starstar))if(e)this.unexpected(this.lastTokStart);else return this.buildBinary(r,a,o,this.parseMaybeUnary(null,false,false,i),"**",false);else return o};function pu(t){return t.type==="Identifier"||t.type==="ParenthesizedExpression"&&pu(t.expression)}function ea(t){return t.type==="MemberExpression"&&t.property.type==="PrivateIdentifier"||t.type==="ChainExpression"&&ea(t.expression)||t.type==="ParenthesizedExpression"&&ea(t.expression)}he.parseExprSubscripts=function(t,e){var s=this.start,i=this.startLoc,r=this.parseExprAtom(t,e);if(r.type==="ArrowFunctionExpression"&&this.input.slice(this.lastTokStart,this.lastTokEnd)!==")")return r;var a=this.parseSubscripts(r,s,i,false,e);return t&&a.type==="MemberExpression"&&(t.parenthesizedAssign>=a.start&&(t.parenthesizedAssign=-1),t.parenthesizedBind>=a.start&&(t.parenthesizedBind=-1),t.trailingComma>=a.start&&(t.trailingComma=-1)),a};he.parseSubscripts=function(t,e,s,i,r){for(var a=this.options.ecmaVersion>=8&&t.type==="Identifier"&&t.name==="async"&&this.lastTokEnd===t.end&&!this.canInsertSemicolon()&&t.end-t.start===5&&this.potentialArrowAt===t.start,o=false;;){var c=this.parseSubscript(t,e,s,i,a,o,r);if(c.optional&&(o=true),c===t||c.type==="ArrowFunctionExpression"){if(o){var l=this.startNodeAt(e,s);l.expression=c,c=this.finishNode(l,"ChainExpression")}return c}t=c}};he.shouldParseAsyncArrow=function(){return!this.canInsertSemicolon()&&this.eat(f.arrow)};he.parseSubscriptAsyncArrow=function(t,e,s,i){return this.parseArrowExpression(this.startNodeAt(t,e),s,true,i)};he.parseSubscript=function(t,e,s,i,r,a,o){var c=this.options.ecmaVersion>=11,l=c&&this.eat(f.questionDot);i&&l&&this.raise(this.lastTokStart,"Optional chaining cannot appear in the callee of new expressions");var h=this.eat(f.bracketL);if(h||l&&this.type!==f.parenL&&this.type!==f.backQuote||this.eat(f.dot)){var d=this.startNodeAt(e,s);d.object=t,h?(d.property=this.parseExpression(),this.expect(f.bracketR)):this.type===f.privateId&&t.type!=="Super"?d.property=this.parsePrivateIdent():d.property=this.parseIdent(this.options.allowReserved!=="never"),d.computed=!!h,c&&(d.optional=l),t=this.finishNode(d,"MemberExpression")}else if(!i&&this.eat(f.parenL)){var m=new yr,_=this.yieldPos,x=this.awaitPos,E=this.awaitIdentPos;this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0;var N=this.parseExprList(f.parenR,this.options.ecmaVersion>=8,false,m);if(r&&!l&&this.shouldParseAsyncArrow())return this.checkPatternErrors(m,false),this.checkYieldAwaitInDefaultParams(),this.awaitIdentPos>0&&this.raise(this.awaitIdentPos,"Cannot use 'await' as identifier inside an async function"),this.yieldPos=_,this.awaitPos=x,this.awaitIdentPos=E,this.parseSubscriptAsyncArrow(e,s,N,o);this.checkExpressionErrors(m,true),this.yieldPos=_||this.yieldPos,this.awaitPos=x||this.awaitPos,this.awaitIdentPos=E||this.awaitIdentPos;var F=this.startNodeAt(e,s);F.callee=t,F.arguments=N,c&&(F.optional=l),t=this.finishNode(F,"CallExpression")}else if(this.type===f.backQuote){(l||a)&&this.raise(this.start,"Optional chaining cannot appear in the tag of tagged template expressions");var U=this.startNodeAt(e,s);U.tag=t,U.quasi=this.parseTemplate({isTagged:true}),t=this.finishNode(U,"TaggedTemplateExpression")}return t};he.parseExprAtom=function(t,e,s){this.type===f.slash&&this.readRegexp();var i,r=this.potentialArrowAt===this.start;switch(this.type){case f._super:return this.allowSuper||this.raise(this.start,"'super' keyword outside a method"),i=this.startNode(),this.next(),this.type===f.parenL&&!this.allowDirectSuper&&this.raise(i.start,"super() call outside constructor of a subclass"),this.type!==f.dot&&this.type!==f.bracketL&&this.type!==f.parenL&&this.unexpected(),this.finishNode(i,"Super");case f._this:return i=this.startNode(),this.next(),this.finishNode(i,"ThisExpression");case f.name:var a=this.start,o=this.startLoc,c=this.containsEsc,l=this.parseIdent(false);if(this.options.ecmaVersion>=8&&!c&&l.name==="async"&&!this.canInsertSemicolon()&&this.eat(f._function))return this.overrideContext(Te.f_expr),this.parseFunction(this.startNodeAt(a,o),0,false,true,e);if(r&&!this.canInsertSemicolon()){if(this.eat(f.arrow))return this.parseArrowExpression(this.startNodeAt(a,o),[l],false,e);if(this.options.ecmaVersion>=8&&l.name==="async"&&this.type===f.name&&!c&&(!this.potentialArrowInForAwait||this.value!=="of"||this.containsEsc))return l=this.parseIdent(false),(this.canInsertSemicolon()||!this.eat(f.arrow))&&this.unexpected(),this.parseArrowExpression(this.startNodeAt(a,o),[l],true,e)}return l;case f.regexp:var h=this.value;return i=this.parseLiteral(h.value),i.regex={pattern:h.pattern,flags:h.flags},i;case f.num:case f.string:return this.parseLiteral(this.value);case f._null:case f._true:case f._false:return i=this.startNode(),i.value=this.type===f._null?null:this.type===f._true,i.raw=this.type.keyword,this.next(),this.finishNode(i,"Literal");case f.parenL:var d=this.start,m=this.parseParenAndDistinguishExpression(r,e);return t&&(t.parenthesizedAssign<0&&!this.isSimpleAssignTarget(m)&&(t.parenthesizedAssign=d),t.parenthesizedBind<0&&(t.parenthesizedBind=d)),m;case f.bracketL:return i=this.startNode(),this.next(),i.elements=this.parseExprList(f.bracketR,true,true,t),this.finishNode(i,"ArrayExpression");case f.braceL:return this.overrideContext(Te.b_expr),this.parseObj(false,t);case f._function:return i=this.startNode(),this.next(),this.parseFunction(i,0);case f._class:return this.parseClass(this.startNode(),false);case f._new:return this.parseNew();case f.backQuote:return this.parseTemplate();case f._import:return this.options.ecmaVersion>=11?this.parseExprImport(s):this.unexpected();default:return this.parseExprAtomDefault()}};he.parseExprAtomDefault=function(){this.unexpected()};he.parseExprImport=function(t){var e=this.startNode();if(this.containsEsc&&this.raiseRecoverable(this.start,"Escape sequence in keyword import"),this.next(),this.type===f.parenL&&!t)return this.parseDynamicImport(e);if(this.type===f.dot){var s=this.startNodeAt(e.start,e.loc&&e.loc.start);return s.name="import",e.meta=this.finishNode(s,"Identifier"),this.parseImportMeta(e)}else this.unexpected()};he.parseDynamicImport=function(t){if(this.next(),t.source=this.parseMaybeAssign(),this.options.ecmaVersion>=16)this.eat(f.parenR)?t.options=null:(this.expect(f.comma),this.afterTrailingComma(f.parenR)?t.options=null:(t.options=this.parseMaybeAssign(),this.eat(f.parenR)||(this.expect(f.comma),this.afterTrailingComma(f.parenR)||this.unexpected())));else if(!this.eat(f.parenR)){var e=this.start;this.eat(f.comma)&&this.eat(f.parenR)?this.raiseRecoverable(e,"Trailing comma is not allowed in import()"):this.unexpected(e)}return this.finishNode(t,"ImportExpression")};he.parseImportMeta=function(t){this.next();var e=this.containsEsc;return t.property=this.parseIdent(true),t.property.name!=="meta"&&this.raiseRecoverable(t.property.start,"The only valid meta property for import is 'import.meta'"),e&&this.raiseRecoverable(t.start,"'import.meta' must not contain escaped characters"),this.options.sourceType!=="module"&&!this.options.allowImportExportEverywhere&&this.raiseRecoverable(t.start,"Cannot use 'import.meta' outside a module"),this.finishNode(t,"MetaProperty")};he.parseLiteral=function(t){var e=this.startNode();return e.value=t,e.raw=this.input.slice(this.start,this.end),e.raw.charCodeAt(e.raw.length-1)===110&&(e.bigint=e.value!=null?e.value.toString():e.raw.slice(0,-1).replace(/_/g,"")),this.next(),this.finishNode(e,"Literal")};he.parseParenExpression=function(){this.expect(f.parenL);var t=this.parseExpression();return this.expect(f.parenR),t};he.shouldParseArrow=function(t){return!this.canInsertSemicolon()};he.parseParenAndDistinguishExpression=function(t,e){var s=this.start,i=this.startLoc,r,a=this.options.ecmaVersion>=8;if(this.options.ecmaVersion>=6){this.next();var o=this.start,c=this.startLoc,l=[],h=true,d=false,m=new yr,_=this.yieldPos,x=this.awaitPos,E;for(this.yieldPos=0,this.awaitPos=0;this.type!==f.parenR;)if(h?h=false:this.expect(f.comma),a&&this.afterTrailingComma(f.parenR,true)){d=true;break}else if(this.type===f.ellipsis){E=this.start,l.push(this.parseParenItem(this.parseRestBinding())),this.type===f.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element");break}else l.push(this.parseMaybeAssign(false,m,this.parseParenItem));var N=this.lastTokEnd,F=this.lastTokEndLoc;if(this.expect(f.parenR),t&&this.shouldParseArrow(l)&&this.eat(f.arrow))return this.checkPatternErrors(m,false),this.checkYieldAwaitInDefaultParams(),this.yieldPos=_,this.awaitPos=x,this.parseParenArrowList(s,i,l,e);(!l.length||d)&&this.unexpected(this.lastTokStart),E&&this.unexpected(E),this.checkExpressionErrors(m,true),this.yieldPos=_||this.yieldPos,this.awaitPos=x||this.awaitPos,l.length>1?(r=this.startNodeAt(o,c),r.expressions=l,this.finishNodeAt(r,"SequenceExpression",N,F)):r=l[0]}else r=this.parseParenExpression();if(this.options.preserveParens){var U=this.startNodeAt(s,i);return U.expression=r,this.finishNode(U,"ParenthesizedExpression")}else return r};he.parseParenItem=function(t){return t};he.parseParenArrowList=function(t,e,s,i){return this.parseArrowExpression(this.startNodeAt(t,e),s,false,i)};var Dh=[];he.parseNew=function(){this.containsEsc&&this.raiseRecoverable(this.start,"Escape sequence in keyword new");var t=this.startNode();if(this.next(),this.options.ecmaVersion>=6&&this.type===f.dot){var e=this.startNodeAt(t.start,t.loc&&t.loc.start);e.name="new",t.meta=this.finishNode(e,"Identifier"),this.next();var s=this.containsEsc;return t.property=this.parseIdent(true),t.property.name!=="target"&&this.raiseRecoverable(t.property.start,"The only valid meta property for new is 'new.target'"),s&&this.raiseRecoverable(t.start,"'new.target' must not contain escaped characters"),this.allowNewDotTarget||this.raiseRecoverable(t.start,"'new.target' can only be used in functions and class static block"),this.finishNode(t,"MetaProperty")}var i=this.start,r=this.startLoc;return t.callee=this.parseSubscripts(this.parseExprAtom(null,false,true),i,r,true,false),this.eat(f.parenL)?t.arguments=this.parseExprList(f.parenR,this.options.ecmaVersion>=8,false):t.arguments=Dh,this.finishNode(t,"NewExpression")};he.parseTemplateElement=function(t){var e=t.isTagged,s=this.startNode();return this.type===f.invalidTemplate?(e||this.raiseRecoverable(this.start,"Bad escape sequence in untagged template literal"),s.value={raw:this.value.replace(/\r\n?/g,`
1
+ (()=>{const Tn=globalThis.fetch.bind(globalThis),sh=4,ih=3e4,rh=6e5,wa=12e4;class nh{pending=new Map;nextId=0;post;constructor(e){this.post=e;const s=this;globalThis.fetch=function(i,r){return s.fetch(i,r)}}fetch(e,s){const i=this.eligibleUrl(e,s);if(!i)return Tn(e,s);const r=s?.signal??(e instanceof Request?e.signal:null);if(r?.aborted)return Tn(e,s);const o=`asset_${++this.nextId}`;return new Promise((a,c)=>{const l={url:i,resolve:a,reject:c,input:e,init:s,controller:null,settled:false,nextSeq:0,timer:null,abortListener:null,signal:r??null};this.pending.set(o,l),l.timer=setTimeout(()=>this.fallThrough(o),ih),r&&(l.abortListener=()=>this.abort(o),r.addEventListener("abort",l.abortListener,{once:true})),this.post("cached-fetch",{id:o,url:i})})}eligibleUrl(e,s){try{let i,r=s?.headers;if(typeof e=="string"||e instanceof URL){if(i=String(e),s&&(s.method&&s.method.toUpperCase()!=="GET"||s.body!=null||s.credentials==="include"||s.mode&&s.mode!=="cors"||s.integrity||s.cache==="no-store"||s.cache==="reload"||s.cache==="no-cache"||s.redirect&&s.redirect!=="follow"))return null}else if(e instanceof Request){if(s||e.method!=="GET"||e.body!=null||e.credentials==="include"||e.mode!=="cors"||e.integrity||e.cache==="no-store"||e.cache==="reload"||e.cache==="no-cache"||e.redirect!=="follow")return null;i=e.url,r=e.headers}else return null;if(r&&[...(r instanceof Headers?r:new Headers(r)).keys()].length>0)return null;const o=new URL(i);return o.protocol!=="https:"?null:(o.hash="",o.toString())}catch{return null}}handleDirect(e){this.fallThrough(e.id)}handleWait(e){const s=this.pending.get(e.id);!s||s.settled||(this.clearTimer(s),s.timer=setTimeout(()=>this.fallThrough(e.id),rh))}handleBegin(e){const s=this.pending.get(e.id);if(!s||s.settled)return;this.clearTimer(s),s.settled=true;const i=this,r=new ReadableStream({start(a){s.controller=a},pull(){i.post("cached-fetch-ack",{id:e.id})},cancel(){i.cancel(e.id)}},new CountQueuingStrategy({highWaterMark:sh})),o=new Headers;e.contentType&&o.set("content-type",e.contentType),e.contentLength!==void 0&&o.set("content-length",String(e.contentLength)),s.timer=setTimeout(()=>this.streamError(e.id,"cached-fetch stream timed out"),wa),s.resolve(new Response(r,{status:e.status,headers:o}))}handleChunk(e){const s=this.pending.get(e.id);if(!(!s||!s.controller)){if(e.seq!==s.nextSeq){this.streamError(e.id,"cached-fetch stream out of order");return}s.nextSeq++,this.clearTimer(s),s.timer=setTimeout(()=>this.streamError(e.id,"cached-fetch stream timed out"),wa);try{s.controller.enqueue(new Uint8Array(e.bytes))}catch{this.cancel(e.id)}}}handleEnd(e){const s=this.pending.get(e.id);if(s){try{s.controller?.close()}catch{}this.cleanup(e.id)}}handleError(e){const s=this.pending.get(e.id);s&&(s.settled?this.streamError(e.id,e.message||"cached-fetch stream failed"):this.fallThrough(e.id))}fallThrough(e){const s=this.pending.get(e);!s||s.settled||(s.settled=true,this.cleanup(e),Tn(s.input,s.init).then(s.resolve,s.reject))}streamError(e,s){const i=this.pending.get(e);if(i){try{i.controller?.error(new TypeError(s))}catch{}this.post("cached-fetch-cancel",{id:e}),this.cleanup(e)}}abort(e){const s=this.pending.get(e);if(s){if(!s.settled)s.settled=true,this.cleanup(e),s.reject(new DOMException("The operation was aborted.","AbortError"));else{try{s.controller?.error(new DOMException("The operation was aborted.","AbortError"))}catch{}this.cleanup(e)}this.post("cached-fetch-cancel",{id:e})}}cancel(e){this.pending.has(e)&&(this.post("cached-fetch-cancel",{id:e}),this.cleanup(e))}clearTimer(e){e.timer!==null&&(clearTimeout(e.timer),e.timer=null)}cleanup(e){const s=this.pending.get(e);s&&(this.clearTimer(s),s.signal&&s.abortListener&&(s.signal.removeEventListener("abort",s.abortListener),s.abortListener=null),this.pending.delete(e))}}const Sa=/^#[0-9a-f]{6}$/,Ea=/^#[0-9a-f]{8}$/;function ji(t,e){const s=oh(t);if(!(e?.alpha===true)){if(s.a!==void 0)throw new Error(`Color ${hh(t)} carries an alpha channel but this parameter is opaque. Declare alpha: true on the parameter, or use rgb(), hsb(), or a 6-digit hex.`);return bi(s.r,s.g,s.b)}return Jc(s.r,s.g,s.b,s.a??1)}function Dt(t){const e=/^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})(?:[0-9a-f]{2})?$/i.exec(t);if(!e)throw new Error(`Expected canonical hex '#rrggbb' or '#rrggbbaa', got: ${t}`);return{r:parseInt(e[1],16),g:parseInt(e[2],16),b:parseInt(e[3],16)}}function ii(t){const e=/^#[0-9a-f]{6}([0-9a-f]{2})?$/i.exec(t);if(!e)throw new Error(`Expected canonical hex '#rrggbb' or '#rrggbbaa', got: ${t}`);return e[1]===void 0?1:parseInt(e[1],16)/255}function Ta(t){const{r:e,g:s,b:i}=Dt(t),r=e/255,o=s/255,a=i/255,c=Math.max(r,o,a),l=Math.min(r,o,a),h=c-l;let d=0;h>0&&(c===r?d=(o-a)/h%6:c===o?d=(a-r)/h+2:d=(r-o)/h+4,d*=60,d<0&&(d+=360));const m=c===0?0:h/c*100,_=c*100;return{h:An(d,4),s:An(m,4),b:An(_,4)}}function Aa(t){const{r:e,g:s,b:i}=Dt(t);return[e/255,s/255,i/255]}function Ca(t){const{r:e,g:s,b:i}=Dt(t);return[e/255,s/255,i/255,ii(t)]}function bi(t,e,s){const i=Gt(t,"r"),r=Gt(e,"g"),o=Gt(s,"b");return"#"+Di(i)+Di(r)+Di(o)}function Jc(t,e,s,i){if(typeof i!="number"||!isFinite(i)||i<0||i>1)throw new Error(`Alpha must be a number in 0..1, got: ${i}`);return bi(t,e,s)+Di(Math.round(i*255))}function eu(t,e,s){if(typeof t!="number"||typeof e!="number"||typeof s!="number"||!isFinite(t)||!isFinite(e)||!isFinite(s))throw new Error(`Invalid HSB: h=${t}, s=${e}, b=${s}`);if(e<0||e>100)throw new Error(`HSB saturation must be 0..100, got: ${e}`);if(s<0||s>100)throw new Error(`HSB brightness must be 0..100, got: ${s}`);const i=(t%360+360)%360,r=e/100,o=s/100,a=o*r,c=i/60,l=a*(1-Math.abs(c%2-1));let h=0,d=0,m=0;c<1?(h=a,d=l,m=0):c<2?(h=l,d=a,m=0):c<3?(h=0,d=a,m=l):c<4?(h=0,d=l,m=a):c<5?(h=l,d=0,m=a):(h=a,d=0,m=l);const _=o-a;return bi(Math.round((h+_)*255),Math.round((d+_)*255),Math.round((m+_)*255))}function oh(t){if(typeof t=="string")return ah(t);if(t&&typeof t=="object"){const e=t,s="r"in e&&"g"in e&&"b"in e,i="h"in e&&"s"in e&&"b"in e,r="a"in e?pr(e.a):void 0;if(i&&!("r"in e)&&!("g"in e)){const o=eu(Ts(e.h,"h"),Ts(e.s,"s"),Ts(e.b,"b"));return{...Dt(o),a:r}}if(s)return{r:Gt(Ts(e.r,"r"),"r"),g:Gt(Ts(e.g,"g"),"g"),b:Gt(Ts(e.b,"b"),"b"),a:r};throw new Error(`Invalid color object: expected {r,g,b} or {h,s,b} keys (optional a), got ${JSON.stringify(t)}`)}throw new Error(`Invalid color input: expected string or object, got ${typeof t}`)}function ah(t){const e=t.trim();if(e.startsWith("#"))return ch(e);const s=e.match(/^(rgba|rgb|hsla|hsl|hsb|vec3|vec4)\s*\(([^)]*)\)$/i);if(s){const i=s[1].toLowerCase(),r=s[2];switch(i){case"rgb":return Ia(r,false);case"rgba":return Ia(r,true);case"hsl":return Ra(r,false);case"hsla":return Ra(r,true);case"hsb":return uh(r);case"vec3":return Pa(r,false);case"vec4":return Pa(r,true)}}throw new Error(`Invalid color string: '${t}'. Expected #rrggbb, #rgb, #rrggbbaa, #rgba, rgb(...), rgba(...), hsl(...), hsla(...), hsb(...), vec3(...), or vec4(...)`)}function ch(t){const e=t.slice(1);if(!/^[0-9a-fA-F]+$/.test(e))throw new Error(`Invalid hex color: '${t}'. Expected #rrggbb, #rgb, #rrggbbaa, or #rgba`);let s;switch(e.length){case 3:case 4:s=e.split("").map(r=>r+r).join("");break;case 6:case 8:s=e;break;default:throw new Error(`Invalid hex color: '${t}'. Expected #rrggbb, #rgb, #rrggbbaa, or #rgba`)}const i=s.toLowerCase();return{r:parseInt(i.slice(0,2),16),g:parseInt(i.slice(2,4),16),b:parseInt(i.slice(4,6),16),a:i.length===8?parseInt(i.slice(6,8),16)/255:void 0}}function Ia(t,e){const s=e?"rgba":"rgb",i=dr(t),r=e?4:3;if(i.length!==r)throw new Error(`${s}() requires ${r} arguments, got ${i.length}: ${s}(${t})`);return{r:Gt(Je(i[0],"r"),"r"),g:Gt(Je(i[1],"g"),"g"),b:Gt(Je(i[2],"b"),"b"),a:e?pr(Je(i[3],"a")):void 0}}function Ra(t,e){const s=e?"hsla":"hsl",i=dr(t),r=e?4:3;if(i.length!==r)throw new Error(`${s}() requires ${r} arguments, got ${i.length}: ${s}(${t})`);const o=Je(i[0],"h"),a=La(i[1],"s"),c=La(i[2],"l"),l=lh(o,a,c);return{...Dt(l),a:e?pr(Je(i[3],"a")):void 0}}function uh(t){const e=dr(t);if(e.length!==3)throw new Error(`hsb() requires 3 arguments, got ${e.length}: hsb(${t})`);const s=Je(e[0],"h"),i=Je(e[1],"s"),r=Je(e[2],"b");return{...Dt(eu(s,i,r)),a:void 0}}function Pa(t,e){const s=e?"vec4":"vec3",i=dr(t),r=e?4:3;if(i.length!==r)throw new Error(`${s}() requires ${r} arguments, got ${i.length}: ${s}(${t})`);const o=Je(i[0],"r"),a=Je(i[1],"g"),c=Je(i[2],"b");if(o<0||o>1||a<0||a>1||c<0||c>1)throw new Error(`${s}() components must be in 0..1, got: ${s}(${t})`);return{r:Math.round(o*255),g:Math.round(a*255),b:Math.round(c*255),a:e?pr(Je(i[3],"a")):void 0}}function lh(t,e,s){if(e<0||e>100)throw new Error(`HSL saturation must be 0..100%, got: ${e}%`);if(s<0||s>100)throw new Error(`HSL lightness must be 0..100%, got: ${s}%`);const i=(t%360+360)%360,r=e/100,o=s/100,a=(1-Math.abs(2*o-1))*r,c=i/60,l=a*(1-Math.abs(c%2-1));let h=0,d=0,m=0;c<1?(h=a,d=l,m=0):c<2?(h=l,d=a,m=0):c<3?(h=0,d=a,m=l):c<4?(h=0,d=l,m=a):c<5?(h=l,d=0,m=a):(h=a,d=0,m=l);const _=o-a/2;return bi(Math.round((h+_)*255),Math.round((d+_)*255),Math.round((m+_)*255))}function hh(t){if(typeof t=="string")return`'${t}'`;try{return JSON.stringify(t)}catch{return String(t)}}function dr(t){return t.split(",").map(e=>e.trim()).filter(e=>e.length>0)}function Je(t,e){const s=parseFloat(t);if(!isFinite(s))throw new Error(`Invalid number for '${e}': '${t}'`);return s}function La(t,e){if(!t.endsWith("%"))throw new Error(`Field '${e}' must use percent notation (e.g., 50%), got: '${t}'`);return Je(t.slice(0,-1),e)}function Ts(t,e){if(typeof t!="number"||!isFinite(t))throw new Error(`Invalid color field '${e}': expected finite number, got ${t}`);return t}function pr(t){if(typeof t!="number"||!isFinite(t)||t<0||t>1)throw new Error(`Alpha must be a number in 0..1, got: ${t}`);return t}function Gt(t,e){if(typeof t!="number"||!isFinite(t))throw new Error(`RGB component '${e}' must be a finite number, got: ${t}`);if(t<0||t>255)throw new Error(`RGB component '${e}' must be 0..255, got: ${t}`);return Math.round(t)}function Di(t){return t.toString(16).padStart(2,"0")}function An(t,e){const s=10**e;return Math.round(t*s)/s}const Da=2,Na=32,fh=2,dh=8;function Ni(t){if(t.alpha!==void 0&&typeof t.alpha!="boolean")throw new Error(`Gradient 'alpha' must be a boolean, got: ${String(t.alpha)}`);const e=Fa(t.minStops,"minStops",fh),s=Fa(t.maxStops,"maxStops",dh);if(e>s)throw new Error(`Gradient 'minStops' (${e}) must not exceed 'maxStops' (${s})`);return{alpha:t.alpha===true,minStops:e,maxStops:s}}function Kn(t,e){if(!Array.isArray(t))throw new Error(`Gradient value must be an array of { color, position } stops, got ${Ua(t)}`);if(t.length<e.minStops||t.length>e.maxStops)throw new Error(`Gradient must have between ${e.minStops} and ${e.maxStops} stops, got ${t.length}`);const s=[];for(let i=0;i<t.length;i++){const r=t[i];if(!r||typeof r!="object"||!("color"in r)||!("position"in r))throw new Error(`Gradient stop ${i} must be an object with 'color' and 'position', got ${Ua(r)}`);const o=r;if(typeof o.position!="number"||!isFinite(o.position)||o.position<0||o.position>1)throw new Error(`Gradient stop ${i} position must be a number in 0..1, got ${String(o.position)}`);let a;try{a=ji(o.color,{alpha:e.alpha})}catch(c){throw new Error(`Gradient stop ${i}: ${c.message}`)}s.push({color:a,position:o.position})}s.sort((i,r)=>i.position-r.position);for(const i of s)Object.freeze(i);return Object.freeze(s)}function ph(t,e){if(!Array.isArray(t)||!Array.isArray(e)||t.length!==e.length)return false;for(let s=0;s<t.length;s++){const i=t[s],r=e[s];if(!i||!r||i.color!==r.color||i.position!==r.position)return false}return true}function mh(t,e,s){if(t.length===0)throw new Error("Cannot sample an empty gradient");const i=Number.isFinite(e)?Math.min(1,Math.max(0,e)):0,r=t[0];if(i<=r.position)return r.color;let o=r;for(let a=1;a<t.length;a++){const c=t[a];if(i<=c.position){const l=c.position-o.position,h=l>0?(i-o.position)/l:1;return h<=0?o.color:h>=1?c.color:gh(o.color,c.color,h,s.alpha)}o=c}return o.color}function gh(t,e,s,i){const r=Dt(t),o=Dt(e),a=ii(t),c=ii(e),l=a+(c-a)*s;let h,d,m;l<=0?(h=r.r+(o.r-r.r)*s,d=r.g+(o.g-r.g)*s,m=r.b+(o.b-r.b)*s):(h=(r.r*a+(o.r*c-r.r*a)*s)/l,d=(r.g*a+(o.g*c-r.g*a)*s)/l,m=(r.b*a+(o.b*c-r.b*a)*s)/l);const _=Cn(Math.round(h)),x=Cn(Math.round(d)),E=Cn(Math.round(m));return i?Jc(_,x,E,Math.min(1,Math.max(0,l))):bi(_,x,E)}function Fa(t,e,s){if(t===void 0)return s;if(typeof t!="number"||!Number.isInteger(t)||t<Da||t>Na)throw new Error(`Gradient '${e}' must be an integer in ${Da}..${Na}, got: ${String(t)}`);return t}function Cn(t){return Math.min(255,Math.max(0,t))}function Ua(t){try{return JSON.stringify(t)??String(t)}catch{return String(t)}}var bh=[509,0,227,0,150,4,294,9,1368,2,2,1,6,3,41,2,5,0,166,1,574,3,9,9,7,9,32,4,318,1,80,3,71,10,50,3,123,2,54,14,32,10,3,1,11,3,46,10,8,0,46,9,7,2,37,13,2,9,6,1,45,0,13,2,49,13,9,3,2,11,83,11,7,0,3,0,158,11,6,9,7,3,56,1,2,6,3,1,3,2,10,0,11,1,3,6,4,4,68,8,2,0,3,0,2,3,2,4,2,0,15,1,83,17,10,9,5,0,82,19,13,9,214,6,3,8,28,1,83,16,16,9,82,12,9,9,7,19,58,14,5,9,243,14,166,9,71,5,2,1,3,3,2,0,2,1,13,9,120,6,3,6,4,0,29,9,41,6,2,3,9,0,10,10,47,15,343,9,54,7,2,7,17,9,57,21,2,13,123,5,4,0,2,1,2,6,2,0,9,9,49,4,2,1,2,4,9,9,330,3,10,1,2,0,49,6,4,4,14,10,5350,0,7,14,11465,27,2343,9,87,9,39,4,60,6,26,9,535,9,470,0,2,54,8,3,82,0,12,1,19628,1,4178,9,519,45,3,22,543,4,4,5,9,7,3,6,31,3,149,2,1418,49,513,54,5,49,9,0,15,0,23,4,2,14,1361,6,2,16,3,6,2,1,2,4,101,0,161,6,10,9,357,0,62,13,499,13,245,1,2,9,726,6,110,6,6,9,4759,9,787719,239],tu=[0,11,2,25,2,18,2,1,2,14,3,13,35,122,70,52,268,28,4,48,48,31,14,29,6,37,11,29,3,35,5,7,2,4,43,157,19,35,5,35,5,39,9,51,13,10,2,14,2,6,2,1,2,10,2,14,2,6,2,1,4,51,13,310,10,21,11,7,25,5,2,41,2,8,70,5,3,0,2,43,2,1,4,0,3,22,11,22,10,30,66,18,2,1,11,21,11,25,71,55,7,1,65,0,16,3,2,2,2,28,43,28,4,28,36,7,2,27,28,53,11,21,11,18,14,17,111,72,56,50,14,50,14,35,39,27,10,22,251,41,7,1,17,2,60,28,11,0,9,21,43,17,47,20,28,22,13,52,58,1,3,0,14,44,33,24,27,35,30,0,3,0,9,34,4,0,13,47,15,3,22,0,2,0,36,17,2,24,20,1,64,6,2,0,2,3,2,14,2,9,8,46,39,7,3,1,3,21,2,6,2,1,2,4,4,0,19,0,13,4,31,9,2,0,3,0,2,37,2,0,26,0,2,0,45,52,19,3,21,2,31,47,21,1,2,0,185,46,42,3,37,47,21,0,60,42,14,0,72,26,38,6,186,43,117,63,32,7,3,0,3,7,2,1,2,23,16,0,2,0,95,7,3,38,17,0,2,0,29,0,11,39,8,0,22,0,12,45,20,0,19,72,200,32,32,8,2,36,18,0,50,29,113,6,2,1,2,37,22,0,26,5,2,1,2,31,15,0,328,18,16,0,2,12,2,33,125,0,80,921,103,110,18,195,2637,96,16,1071,18,5,26,3994,6,582,6842,29,1763,568,8,30,18,78,18,29,19,47,17,3,32,20,6,18,433,44,212,63,129,74,6,0,67,12,65,1,2,0,29,6135,9,1237,42,9,8936,3,2,6,2,1,2,290,16,0,30,2,3,0,15,3,9,395,2309,106,6,12,4,8,8,9,5991,84,2,70,2,1,3,0,3,1,3,3,2,11,2,0,2,6,2,64,2,3,3,7,2,6,2,27,2,3,2,4,2,0,4,6,2,339,3,24,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,7,1845,30,7,5,262,61,147,44,11,6,17,0,322,29,19,43,485,27,229,29,3,0,496,6,2,3,2,1,2,14,2,196,60,67,8,0,1205,3,2,26,2,1,2,0,3,0,2,9,2,3,2,0,2,0,7,0,5,0,2,0,2,0,2,2,2,1,2,0,3,0,2,0,2,0,2,0,2,0,2,1,2,0,3,3,2,6,2,3,2,3,2,0,2,9,2,16,6,2,2,4,2,16,4421,42719,33,4153,7,221,3,5761,15,7472,16,621,2467,541,1507,4938,6,4191],yh="‌‍·̀-ͯ·҃-֑҇-ׇֽֿׁׂׅׄؐ-ًؚ-٩ٰۖ-ۜ۟-۪ۤۧۨ-ۭ۰-۹ܑܰ-݊ަ-ް߀-߉߫-߽߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛ࢗ-࢟࣊-ࣣ࣡-ःऺ-़ा-ॏ॑-ॗॢॣ०-९ঁ-ঃ়া-ৄেৈো-্ৗৢৣ০-৯৾ਁ-ਃ਼ਾ-ੂੇੈੋ-੍ੑ੦-ੱੵઁ-ઃ઼ા-ૅે-ૉો-્ૢૣ૦-૯ૺ-૿ଁ-ଃ଼ା-ୄେୈୋ-୍୕-ୗୢୣ୦-୯ஂா-ூெ-ைொ-்ௗ௦-௯ఀ-ఄ఼ా-ౄె-ైొ-్ౕౖౢౣ౦-౯ಁ-ಃ಼ಾ-ೄೆ-ೈೊ-್ೕೖೢೣ೦-೯ೳഀ-ഃ഻഼ാ-ൄെ-ൈൊ-്ൗൢൣ൦-൯ඁ-ඃ්ා-ුූෘ-ෟ෦-෯ෲෳัิ-ฺ็-๎๐-๙ັິ-ຼ່-໎໐-໙༘༙༠-༩༹༵༷༾༿ཱ-྄྆྇ྍ-ྗྙ-ྼ࿆ါ-ှ၀-၉ၖ-ၙၞ-ၠၢ-ၤၧ-ၭၱ-ၴႂ-ႍႏ-ႝ፝-፟፩-፱ᜒ-᜕ᜲ-᜴ᝒᝓᝲᝳ឴-៓៝០-៩᠋-᠍᠏-᠙ᢩᤠ-ᤫᤰ-᤻᥆-᥏᧐-᧚ᨗ-ᨛᩕ-ᩞ᩠-᩿᩼-᪉᪐-᪙᪰-᪽ᪿ-ᫎᬀ-ᬄ᬴-᭄᭐-᭙᭫-᭳ᮀ-ᮂᮡ-ᮭ᮰-᮹᯦-᯳ᰤ-᰷᱀-᱉᱐-᱙᳐-᳔᳒-᳨᳭᳴᳷-᳹᷀-᷿‌‍‿⁀⁔⃐-⃥⃜⃡-⃰⳯-⵿⳱ⷠ-〪ⷿ-゙゚〯・꘠-꘩꙯ꙴ-꙽ꚞꚟ꛰꛱ꠂ꠆ꠋꠣ-ꠧ꠬ꢀꢁꢴ-ꣅ꣐-꣙꣠-꣱ꣿ-꤉ꤦ-꤭ꥇ-꥓ꦀ-ꦃ꦳-꧀꧐-꧙ꧥ꧰-꧹ꨩ-ꨶꩃꩌꩍ꩐-꩙ꩻ-ꩽꪰꪲ-ꪴꪷꪸꪾ꪿꫁ꫫ-ꫯꫵ꫶ꯣ-ꯪ꯬꯭꯰-꯹ﬞ︀-️︠-︯︳︴﹍-﹏0-9_・",su="ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԯԱ-Ֆՙՠ-ֈא-תׯ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࡠ-ࡪࡰ-ࢇࢉ-ࢎࢠ-ࣉऄ-हऽॐक़-ॡॱ-ঀঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱৼਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡૹଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-హఽౘ-ౚౝౠౡಀಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೝೞೠೡೱೲഄ-ഌഎ-ഐഒ-ഺഽൎൔ-ൖൟ-ൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄຆ-ຊຌ-ຣລວ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏽᏸ-ᏽᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜑᜟ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡸᢀ-ᢨᢪᢰ-ᣵᤀ-ᤞᥐ-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭌᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᲀ-ᲊᲐ-ᲺᲽ-Ჿᳩ-ᳬᳮ-ᳳᳵᳶᳺᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕ℘-ℝℤΩℨK-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞ々-〇〡-〩〱-〵〸-〼ぁ-ゖ゛-ゟァ-ヺー-ヿㄅ-ㄯㄱ-ㆎㆠ-ㆿㇰ-ㇿ㐀-䶿一-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚝꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ-ꟍꟐꟑꟓꟕ-Ƛꟲ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꣽꣾꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꧠ-ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꩾ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭩꭰ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ",In={3:"abstract boolean byte char class double enum export extends final float goto implements import int interface long native package private protected public short static super synchronized throws transient volatile",5:"class enum extends super const export import",6:"enum",strict:"implements interface let package private protected public static yield",strictBind:"eval arguments"},Rn="break case catch continue debugger default do else finally for function if return switch throw try var while with null true false instanceof typeof void delete new in this",_h={5:Rn,"5module":Rn+" export import",6:Rn+" const class extends export import super"},vh=/^in(stanceof)?$/,xh=new RegExp("["+su+"]"),kh=new RegExp("["+su+yh+"]");function Zn(t,e){for(var s=65536,i=0;i<e.length;i+=2){if(s+=e[i],s>t)return false;if(s+=e[i+1],s>=t)return true}return false}function Nt(t,e){return t<65?t===36:t<91?true:t<97?t===95:t<123?true:t<=65535?t>=170&&xh.test(String.fromCharCode(t)):e===false?false:Zn(t,tu)}function cs(t,e){return t<48?t===36:t<58?true:t<65?false:t<91?true:t<97?t===95:t<123?true:t<=65535?t>=170&&kh.test(String.fromCharCode(t)):e===false?false:Zn(t,tu)||Zn(t,bh)}var ye=function(e,s){s===void 0&&(s={}),this.label=e,this.keyword=s.keyword,this.beforeExpr=!!s.beforeExpr,this.startsExpr=!!s.startsExpr,this.isLoop=!!s.isLoop,this.isAssign=!!s.isAssign,this.prefix=!!s.prefix,this.postfix=!!s.postfix,this.binop=s.binop||null,this.updateContext=null};function ot(t,e){return new ye(t,{beforeExpr:true,binop:e})}var at={beforeExpr:true},Ke={startsExpr:true},Ao={};function be(t,e){return e===void 0&&(e={}),e.keyword=t,Ao[t]=new ye(t,e)}var f={num:new ye("num",Ke),regexp:new ye("regexp",Ke),string:new ye("string",Ke),name:new ye("name",Ke),privateId:new ye("privateId",Ke),eof:new ye("eof"),bracketL:new ye("[",{beforeExpr:true,startsExpr:true}),bracketR:new ye("]"),braceL:new ye("{",{beforeExpr:true,startsExpr:true}),braceR:new ye("}"),parenL:new ye("(",{beforeExpr:true,startsExpr:true}),parenR:new ye(")"),comma:new ye(",",at),semi:new ye(";",at),colon:new ye(":",at),dot:new ye("."),question:new ye("?",at),questionDot:new ye("?."),arrow:new ye("=>",at),template:new ye("template"),invalidTemplate:new ye("invalidTemplate"),ellipsis:new ye("...",at),backQuote:new ye("`",Ke),dollarBraceL:new ye("${",{beforeExpr:true,startsExpr:true}),eq:new ye("=",{beforeExpr:true,isAssign:true}),assign:new ye("_=",{beforeExpr:true,isAssign:true}),incDec:new ye("++/--",{prefix:true,postfix:true,startsExpr:true}),prefix:new ye("!/~",{beforeExpr:true,prefix:true,startsExpr:true}),logicalOR:ot("||",1),logicalAND:ot("&&",2),bitwiseOR:ot("|",3),bitwiseXOR:ot("^",4),bitwiseAND:ot("&",5),equality:ot("==/!=/===/!==",6),relational:ot("</>/<=/>=",7),bitShift:ot("<</>>/>>>",8),plusMin:new ye("+/-",{beforeExpr:true,binop:9,prefix:true,startsExpr:true}),modulo:ot("%",10),star:ot("*",10),slash:ot("/",10),starstar:new ye("**",{beforeExpr:true}),coalesce:ot("??",1),_break:be("break"),_case:be("case",at),_catch:be("catch"),_continue:be("continue"),_debugger:be("debugger"),_default:be("default",at),_do:be("do",{isLoop:true,beforeExpr:true}),_else:be("else",at),_finally:be("finally"),_for:be("for",{isLoop:true}),_function:be("function",Ke),_if:be("if"),_return:be("return",at),_switch:be("switch"),_throw:be("throw",at),_try:be("try"),_var:be("var"),_const:be("const"),_while:be("while",{isLoop:true}),_with:be("with"),_new:be("new",{beforeExpr:true,startsExpr:true}),_this:be("this",Ke),_super:be("super",Ke),_class:be("class",Ke),_extends:be("extends",at),_export:be("export"),_import:be("import",Ke),_null:be("null",Ke),_true:be("true",Ke),_false:be("false",Ke),_in:be("in",{beforeExpr:true,binop:7}),_instanceof:be("instanceof",{beforeExpr:true,binop:7}),_typeof:be("typeof",{beforeExpr:true,prefix:true,startsExpr:true}),_void:be("void",{beforeExpr:true,prefix:true,startsExpr:true}),_delete:be("delete",{beforeExpr:true,prefix:true,startsExpr:true})},st=/\r\n?|\n|\u2028|\u2029/,wh=new RegExp(st.source,"g");function Bs(t){return t===10||t===13||t===8232||t===8233}function iu(t,e,s){s===void 0&&(s=t.length);for(var i=e;i<s;i++){var r=t.charCodeAt(i);if(Bs(r))return i<s-1&&r===13&&t.charCodeAt(i+1)===10?i+2:i+1}return-1}var ru=/[\u1680\u2000-\u200a\u202f\u205f\u3000\ufeff]/,He=/(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g,nu=Object.prototype,Sh=nu.hasOwnProperty,Eh=nu.toString,Vs=Object.hasOwn||function(t,e){return Sh.call(t,e)},Ma=Array.isArray||function(t){return Eh.call(t)==="[object Array]"},Oa=Object.create(null);function es(t){return Oa[t]||(Oa[t]=new RegExp("^(?:"+t.replace(/ /g,"|")+")$"))}function Wt(t){return t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode((t>>10)+55296,(t&1023)+56320))}var Th=/(?:[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/,ri=function(e,s){this.line=e,this.column=s};ri.prototype.offset=function(e){return new ri(this.line,this.column+e)};var mr=function(e,s,i){this.start=s,this.end=i,e.sourceFile!==null&&(this.source=e.sourceFile)};function ou(t,e){for(var s=1,i=0;;){var r=iu(t,i,e);if(r<0)return new ri(s,e-i);++s,i=r}}var Qn={ecmaVersion:null,sourceType:"script",onInsertedSemicolon:null,onTrailingComma:null,allowReserved:null,allowReturnOutsideFunction:false,allowImportExportEverywhere:false,allowAwaitOutsideFunction:null,allowSuperOutsideMethod:null,allowHashBang:false,checkPrivateFields:true,locations:false,onToken:null,onComment:null,ranges:false,program:null,sourceFile:null,directSourceFile:null,preserveParens:false},Ba=false;function Ah(t){var e={};for(var s in Qn)e[s]=t&&Vs(t,s)?t[s]:Qn[s];if(e.ecmaVersion==="latest"?e.ecmaVersion=1e8:e.ecmaVersion==null?(!Ba&&typeof console=="object"&&console.warn&&(Ba=true,console.warn(`Since Acorn 8.0.0, options.ecmaVersion is required.
2
+ Defaulting to 2020, but this will stop working in the future.`)),e.ecmaVersion=11):e.ecmaVersion>=2015&&(e.ecmaVersion-=2009),e.allowReserved==null&&(e.allowReserved=e.ecmaVersion<5),(!t||t.allowHashBang==null)&&(e.allowHashBang=e.ecmaVersion>=14),Ma(e.onToken)){var i=e.onToken;e.onToken=function(r){return i.push(r)}}return Ma(e.onComment)&&(e.onComment=Ch(e,e.onComment)),e}function Ch(t,e){return function(s,i,r,o,a,c){var l={type:s?"Block":"Line",value:i,start:r,end:o};t.locations&&(l.loc=new mr(this,a,c)),t.ranges&&(l.range=[r,o]),e.push(l)}}var ni=1,$s=2,Co=4,au=8,Io=16,cu=32,gr=64,uu=128,ks=256,yi=512,br=ni|$s|ks;function Ro(t,e){return $s|(t?Co:0)|(e?au:0)}var qi=0,Po=1,Kt=2,lu=3,hu=4,fu=5,Ne=function(e,s,i){this.options=e=Ah(e),this.sourceFile=e.sourceFile,this.keywords=es(_h[e.ecmaVersion>=6?6:e.sourceType==="module"?"5module":5]);var r="";e.allowReserved!==true&&(r=In[e.ecmaVersion>=6?6:e.ecmaVersion===5?5:3],e.sourceType==="module"&&(r+=" await")),this.reservedWords=es(r);var o=(r?r+" ":"")+In.strict;this.reservedWordsStrict=es(o),this.reservedWordsStrictBind=es(o+" "+In.strictBind),this.input=String(s),this.containsEsc=false,i?(this.pos=i,this.lineStart=this.input.lastIndexOf(`
3
+ `,i-1)+1,this.curLine=this.input.slice(0,this.lineStart).split(st).length):(this.pos=this.lineStart=0,this.curLine=1),this.type=f.eof,this.value=null,this.start=this.end=this.pos,this.startLoc=this.endLoc=this.curPosition(),this.lastTokEndLoc=this.lastTokStartLoc=null,this.lastTokStart=this.lastTokEnd=this.pos,this.context=this.initialContext(),this.exprAllowed=true,this.inModule=e.sourceType==="module",this.strict=this.inModule||this.strictDirective(this.pos),this.potentialArrowAt=-1,this.potentialArrowInForAwait=false,this.yieldPos=this.awaitPos=this.awaitIdentPos=0,this.labels=[],this.undefinedExports=Object.create(null),this.pos===0&&e.allowHashBang&&this.input.slice(0,2)==="#!"&&this.skipLineComment(2),this.scopeStack=[],this.enterScope(ni),this.regexpState=null,this.privateNameStack=[]},Mt={inFunction:{configurable:true},inGenerator:{configurable:true},inAsync:{configurable:true},canAwait:{configurable:true},allowSuper:{configurable:true},allowDirectSuper:{configurable:true},treatFunctionsAsVar:{configurable:true},allowNewDotTarget:{configurable:true},inClassStaticBlock:{configurable:true}};Ne.prototype.parse=function(){var e=this.options.program||this.startNode();return this.nextToken(),this.parseTopLevel(e)};Mt.inFunction.get=function(){return(this.currentVarScope().flags&$s)>0};Mt.inGenerator.get=function(){return(this.currentVarScope().flags&au)>0};Mt.inAsync.get=function(){return(this.currentVarScope().flags&Co)>0};Mt.canAwait.get=function(){for(var t=this.scopeStack.length-1;t>=0;t--){var e=this.scopeStack[t],s=e.flags;if(s&(ks|yi))return false;if(s&$s)return(s&Co)>0}return this.inModule&&this.options.ecmaVersion>=13||this.options.allowAwaitOutsideFunction};Mt.allowSuper.get=function(){var t=this.currentThisScope(),e=t.flags;return(e&gr)>0||this.options.allowSuperOutsideMethod};Mt.allowDirectSuper.get=function(){return(this.currentThisScope().flags&uu)>0};Mt.treatFunctionsAsVar.get=function(){return this.treatFunctionsAsVarInScope(this.currentScope())};Mt.allowNewDotTarget.get=function(){for(var t=this.scopeStack.length-1;t>=0;t--){var e=this.scopeStack[t],s=e.flags;if(s&(ks|yi)||s&$s&&!(s&Io))return true}return false};Mt.inClassStaticBlock.get=function(){return(this.currentVarScope().flags&ks)>0};Ne.extend=function(){for(var e=[],s=arguments.length;s--;)e[s]=arguments[s];for(var i=this,r=0;r<e.length;r++)i=e[r](i);return i};Ne.parse=function(e,s){return new this(s,e).parse()};Ne.parseExpressionAt=function(e,s,i){var r=new this(i,e,s);return r.nextToken(),r.parseExpression()};Ne.tokenizer=function(e,s){return new this(s,e)};Object.defineProperties(Ne.prototype,Mt);var ze=Ne.prototype,Ih=/^(?:'((?:\\[^]|[^'\\])*?)'|"((?:\\[^]|[^"\\])*?)")/;ze.strictDirective=function(t){if(this.options.ecmaVersion<5)return false;for(;;){He.lastIndex=t,t+=He.exec(this.input)[0].length;var e=Ih.exec(this.input.slice(t));if(!e)return false;if((e[1]||e[2])==="use strict"){He.lastIndex=t+e[0].length;var s=He.exec(this.input),i=s.index+s[0].length,r=this.input.charAt(i);return r===";"||r==="}"||st.test(s[0])&&!(/[(`.[+\-/*%<>=,?^&]/.test(r)||r==="!"&&this.input.charAt(i+1)==="=")}t+=e[0].length,He.lastIndex=t,t+=He.exec(this.input)[0].length,this.input[t]===";"&&t++}};ze.eat=function(t){return this.type===t?(this.next(),true):false};ze.isContextual=function(t){return this.type===f.name&&this.value===t&&!this.containsEsc};ze.eatContextual=function(t){return this.isContextual(t)?(this.next(),true):false};ze.expectContextual=function(t){this.eatContextual(t)||this.unexpected()};ze.canInsertSemicolon=function(){return this.type===f.eof||this.type===f.braceR||st.test(this.input.slice(this.lastTokEnd,this.start))};ze.insertSemicolon=function(){if(this.canInsertSemicolon())return this.options.onInsertedSemicolon&&this.options.onInsertedSemicolon(this.lastTokEnd,this.lastTokEndLoc),true};ze.semicolon=function(){!this.eat(f.semi)&&!this.insertSemicolon()&&this.unexpected()};ze.afterTrailingComma=function(t,e){if(this.type===t)return this.options.onTrailingComma&&this.options.onTrailingComma(this.lastTokStart,this.lastTokStartLoc),e||this.next(),true};ze.expect=function(t){this.eat(t)||this.unexpected()};ze.unexpected=function(t){this.raise(t??this.start,"Unexpected token")};var yr=function(){this.shorthandAssign=this.trailingComma=this.parenthesizedAssign=this.parenthesizedBind=this.doubleProto=-1};ze.checkPatternErrors=function(t,e){if(t){t.trailingComma>-1&&this.raiseRecoverable(t.trailingComma,"Comma is not permitted after the rest element");var s=e?t.parenthesizedAssign:t.parenthesizedBind;s>-1&&this.raiseRecoverable(s,e?"Assigning to rvalue":"Parenthesized pattern")}};ze.checkExpressionErrors=function(t,e){if(!t)return false;var s=t.shorthandAssign,i=t.doubleProto;if(!e)return s>=0||i>=0;s>=0&&this.raise(s,"Shorthand property assignments are valid only in destructuring patterns"),i>=0&&this.raiseRecoverable(i,"Redefinition of __proto__ property")};ze.checkYieldAwaitInDefaultParams=function(){this.yieldPos&&(!this.awaitPos||this.yieldPos<this.awaitPos)&&this.raise(this.yieldPos,"Yield expression cannot be a default value"),this.awaitPos&&this.raise(this.awaitPos,"Await expression cannot be a default value")};ze.isSimpleAssignTarget=function(t){return t.type==="ParenthesizedExpression"?this.isSimpleAssignTarget(t.expression):t.type==="Identifier"||t.type==="MemberExpression"};var K=Ne.prototype;K.parseTopLevel=function(t){var e=Object.create(null);for(t.body||(t.body=[]);this.type!==f.eof;){var s=this.parseStatement(null,true,e);t.body.push(s)}if(this.inModule)for(var i=0,r=Object.keys(this.undefinedExports);i<r.length;i+=1){var o=r[i];this.raiseRecoverable(this.undefinedExports[o].start,"Export '"+o+"' is not defined")}return this.adaptDirectivePrologue(t.body),this.next(),t.sourceType=this.options.sourceType,this.finishNode(t,"Program")};var Lo={kind:"loop"},Rh={kind:"switch"};K.isLet=function(t){if(this.options.ecmaVersion<6||!this.isContextual("let"))return false;He.lastIndex=this.pos;var e=He.exec(this.input),s=this.pos+e[0].length,i=this.input.charCodeAt(s);if(i===91||i===92)return true;if(t)return false;if(i===123||i>55295&&i<56320)return true;if(Nt(i,true)){for(var r=s+1;cs(i=this.input.charCodeAt(r),true);)++r;if(i===92||i>55295&&i<56320)return true;var o=this.input.slice(s,r);if(!vh.test(o))return true}return false};K.isAsyncFunction=function(){if(this.options.ecmaVersion<8||!this.isContextual("async"))return false;He.lastIndex=this.pos;var t=He.exec(this.input),e=this.pos+t[0].length,s;return!st.test(this.input.slice(this.pos,e))&&this.input.slice(e,e+8)==="function"&&(e+8===this.input.length||!(cs(s=this.input.charCodeAt(e+8))||s>55295&&s<56320))};K.isUsingKeyword=function(t,e){if(this.options.ecmaVersion<17||!this.isContextual(t?"await":"using"))return false;He.lastIndex=this.pos;var s=He.exec(this.input),i=this.pos+s[0].length;if(st.test(this.input.slice(this.pos,i)))return false;if(t){var r=i+5,o;if(this.input.slice(i,r)!=="using"||r===this.input.length||cs(o=this.input.charCodeAt(r))||o>55295&&o<56320)return false;He.lastIndex=r;var a=He.exec(this.input);if(a&&st.test(this.input.slice(r,r+a[0].length)))return false}if(e){var c=i+2,l;if(this.input.slice(i,c)==="of"&&(c===this.input.length||!cs(l=this.input.charCodeAt(c))&&!(l>55295&&l<56320)))return false}var h=this.input.charCodeAt(i);return Nt(h,true)||h===92};K.isAwaitUsing=function(t){return this.isUsingKeyword(true,t)};K.isUsing=function(t){return this.isUsingKeyword(false,t)};K.parseStatement=function(t,e,s){var i=this.type,r=this.startNode(),o;switch(this.isLet(t)&&(i=f._var,o="let"),i){case f._break:case f._continue:return this.parseBreakContinueStatement(r,i.keyword);case f._debugger:return this.parseDebuggerStatement(r);case f._do:return this.parseDoStatement(r);case f._for:return this.parseForStatement(r);case f._function:return t&&(this.strict||t!=="if"&&t!=="label")&&this.options.ecmaVersion>=6&&this.unexpected(),this.parseFunctionStatement(r,false,!t);case f._class:return t&&this.unexpected(),this.parseClass(r,true);case f._if:return this.parseIfStatement(r);case f._return:return this.parseReturnStatement(r);case f._switch:return this.parseSwitchStatement(r);case f._throw:return this.parseThrowStatement(r);case f._try:return this.parseTryStatement(r);case f._const:case f._var:return o=o||this.value,t&&o!=="var"&&this.unexpected(),this.parseVarStatement(r,o);case f._while:return this.parseWhileStatement(r);case f._with:return this.parseWithStatement(r);case f.braceL:return this.parseBlock(true,r);case f.semi:return this.parseEmptyStatement(r);case f._export:case f._import:if(this.options.ecmaVersion>10&&i===f._import){He.lastIndex=this.pos;var a=He.exec(this.input),c=this.pos+a[0].length,l=this.input.charCodeAt(c);if(l===40||l===46)return this.parseExpressionStatement(r,this.parseExpression())}return this.options.allowImportExportEverywhere||(e||this.raise(this.start,"'import' and 'export' may only appear at the top level"),this.inModule||this.raise(this.start,"'import' and 'export' may appear only with 'sourceType: module'")),i===f._import?this.parseImport(r):this.parseExport(r,s);default:if(this.isAsyncFunction())return t&&this.unexpected(),this.next(),this.parseFunctionStatement(r,true,!t);var h=this.isAwaitUsing(false)?"await using":this.isUsing(false)?"using":null;if(h)return e&&this.options.sourceType==="script"&&this.raise(this.start,"Using declaration cannot appear in the top level when source type is `script`"),h==="await using"&&(this.canAwait||this.raise(this.start,"Await using cannot appear outside of async function"),this.next()),this.next(),this.parseVar(r,false,h),this.semicolon(),this.finishNode(r,"VariableDeclaration");var d=this.value,m=this.parseExpression();return i===f.name&&m.type==="Identifier"&&this.eat(f.colon)?this.parseLabeledStatement(r,d,m,t):this.parseExpressionStatement(r,m)}};K.parseBreakContinueStatement=function(t,e){var s=e==="break";this.next(),this.eat(f.semi)||this.insertSemicolon()?t.label=null:this.type!==f.name?this.unexpected():(t.label=this.parseIdent(),this.semicolon());for(var i=0;i<this.labels.length;++i){var r=this.labels[i];if((t.label==null||r.name===t.label.name)&&(r.kind!=null&&(s||r.kind==="loop")||t.label&&s))break}return i===this.labels.length&&this.raise(t.start,"Unsyntactic "+e),this.finishNode(t,s?"BreakStatement":"ContinueStatement")};K.parseDebuggerStatement=function(t){return this.next(),this.semicolon(),this.finishNode(t,"DebuggerStatement")};K.parseDoStatement=function(t){return this.next(),this.labels.push(Lo),t.body=this.parseStatement("do"),this.labels.pop(),this.expect(f._while),t.test=this.parseParenExpression(),this.options.ecmaVersion>=6?this.eat(f.semi):this.semicolon(),this.finishNode(t,"DoWhileStatement")};K.parseForStatement=function(t){this.next();var e=this.options.ecmaVersion>=9&&this.canAwait&&this.eatContextual("await")?this.lastTokStart:-1;if(this.labels.push(Lo),this.enterScope(0),this.expect(f.parenL),this.type===f.semi)return e>-1&&this.unexpected(e),this.parseFor(t,null);var s=this.isLet();if(this.type===f._var||this.type===f._const||s){var i=this.startNode(),r=s?"let":this.value;return this.next(),this.parseVar(i,true,r),this.finishNode(i,"VariableDeclaration"),this.parseForAfterInit(t,i,e)}var o=this.isContextual("let"),a=false,c=this.isUsing(true)?"using":this.isAwaitUsing(true)?"await using":null;if(c){var l=this.startNode();return this.next(),c==="await using"&&this.next(),this.parseVar(l,true,c),this.finishNode(l,"VariableDeclaration"),this.parseForAfterInit(t,l,e)}var h=this.containsEsc,d=new yr,m=this.start,_=e>-1?this.parseExprSubscripts(d,"await"):this.parseExpression(true,d);return this.type===f._in||(a=this.options.ecmaVersion>=6&&this.isContextual("of"))?(e>-1?(this.type===f._in&&this.unexpected(e),t.await=true):a&&this.options.ecmaVersion>=8&&(_.start===m&&!h&&_.type==="Identifier"&&_.name==="async"?this.unexpected():this.options.ecmaVersion>=9&&(t.await=false)),o&&a&&this.raise(_.start,"The left-hand side of a for-of loop may not start with 'let'."),this.toAssignable(_,false,d),this.checkLValPattern(_),this.parseForIn(t,_)):(this.checkExpressionErrors(d,true),e>-1&&this.unexpected(e),this.parseFor(t,_))};K.parseForAfterInit=function(t,e,s){return(this.type===f._in||this.options.ecmaVersion>=6&&this.isContextual("of"))&&e.declarations.length===1?(this.options.ecmaVersion>=9&&(this.type===f._in?s>-1&&this.unexpected(s):t.await=s>-1),this.parseForIn(t,e)):(s>-1&&this.unexpected(s),this.parseFor(t,e))};K.parseFunctionStatement=function(t,e,s){return this.next(),this.parseFunction(t,ei|(s?0:Jn),false,e)};K.parseIfStatement=function(t){return this.next(),t.test=this.parseParenExpression(),t.consequent=this.parseStatement("if"),t.alternate=this.eat(f._else)?this.parseStatement("if"):null,this.finishNode(t,"IfStatement")};K.parseReturnStatement=function(t){return!this.inFunction&&!this.options.allowReturnOutsideFunction&&this.raise(this.start,"'return' outside of function"),this.next(),this.eat(f.semi)||this.insertSemicolon()?t.argument=null:(t.argument=this.parseExpression(),this.semicolon()),this.finishNode(t,"ReturnStatement")};K.parseSwitchStatement=function(t){this.next(),t.discriminant=this.parseParenExpression(),t.cases=[],this.expect(f.braceL),this.labels.push(Rh),this.enterScope(0);for(var e,s=false;this.type!==f.braceR;)if(this.type===f._case||this.type===f._default){var i=this.type===f._case;e&&this.finishNode(e,"SwitchCase"),t.cases.push(e=this.startNode()),e.consequent=[],this.next(),i?e.test=this.parseExpression():(s&&this.raiseRecoverable(this.lastTokStart,"Multiple default clauses"),s=true,e.test=null),this.expect(f.colon)}else e||this.unexpected(),e.consequent.push(this.parseStatement(null));return this.exitScope(),e&&this.finishNode(e,"SwitchCase"),this.next(),this.labels.pop(),this.finishNode(t,"SwitchStatement")};K.parseThrowStatement=function(t){return this.next(),st.test(this.input.slice(this.lastTokEnd,this.start))&&this.raise(this.lastTokEnd,"Illegal newline after throw"),t.argument=this.parseExpression(),this.semicolon(),this.finishNode(t,"ThrowStatement")};var Ph=[];K.parseCatchClauseParam=function(){var t=this.parseBindingAtom(),e=t.type==="Identifier";return this.enterScope(e?cu:0),this.checkLValPattern(t,e?hu:Kt),this.expect(f.parenR),t};K.parseTryStatement=function(t){if(this.next(),t.block=this.parseBlock(),t.handler=null,this.type===f._catch){var e=this.startNode();this.next(),this.eat(f.parenL)?e.param=this.parseCatchClauseParam():(this.options.ecmaVersion<10&&this.unexpected(),e.param=null,this.enterScope(0)),e.body=this.parseBlock(false),this.exitScope(),t.handler=this.finishNode(e,"CatchClause")}return t.finalizer=this.eat(f._finally)?this.parseBlock():null,!t.handler&&!t.finalizer&&this.raise(t.start,"Missing catch or finally clause"),this.finishNode(t,"TryStatement")};K.parseVarStatement=function(t,e,s){return this.next(),this.parseVar(t,false,e,s),this.semicolon(),this.finishNode(t,"VariableDeclaration")};K.parseWhileStatement=function(t){return this.next(),t.test=this.parseParenExpression(),this.labels.push(Lo),t.body=this.parseStatement("while"),this.labels.pop(),this.finishNode(t,"WhileStatement")};K.parseWithStatement=function(t){return this.strict&&this.raise(this.start,"'with' in strict mode"),this.next(),t.object=this.parseParenExpression(),t.body=this.parseStatement("with"),this.finishNode(t,"WithStatement")};K.parseEmptyStatement=function(t){return this.next(),this.finishNode(t,"EmptyStatement")};K.parseLabeledStatement=function(t,e,s,i){for(var r=0,o=this.labels;r<o.length;r+=1){var a=o[r];a.name===e&&this.raise(s.start,"Label '"+e+"' is already declared")}for(var c=this.type.isLoop?"loop":this.type===f._switch?"switch":null,l=this.labels.length-1;l>=0;l--){var h=this.labels[l];if(h.statementStart===t.start)h.statementStart=this.start,h.kind=c;else break}return this.labels.push({name:e,kind:c,statementStart:this.start}),t.body=this.parseStatement(i?i.indexOf("label")===-1?i+"label":i:"label"),this.labels.pop(),t.label=s,this.finishNode(t,"LabeledStatement")};K.parseExpressionStatement=function(t,e){return t.expression=e,this.semicolon(),this.finishNode(t,"ExpressionStatement")};K.parseBlock=function(t,e,s){for(t===void 0&&(t=true),e===void 0&&(e=this.startNode()),e.body=[],this.expect(f.braceL),t&&this.enterScope(0);this.type!==f.braceR;){var i=this.parseStatement(null);e.body.push(i)}return s&&(this.strict=false),this.next(),t&&this.exitScope(),this.finishNode(e,"BlockStatement")};K.parseFor=function(t,e){return t.init=e,this.expect(f.semi),t.test=this.type===f.semi?null:this.parseExpression(),this.expect(f.semi),t.update=this.type===f.parenR?null:this.parseExpression(),this.expect(f.parenR),t.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(t,"ForStatement")};K.parseForIn=function(t,e){var s=this.type===f._in;return this.next(),e.type==="VariableDeclaration"&&e.declarations[0].init!=null&&(!s||this.options.ecmaVersion<8||this.strict||e.kind!=="var"||e.declarations[0].id.type!=="Identifier")&&this.raise(e.start,(s?"for-in":"for-of")+" loop variable declaration may not have an initializer"),t.left=e,t.right=s?this.parseExpression():this.parseMaybeAssign(),this.expect(f.parenR),t.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(t,s?"ForInStatement":"ForOfStatement")};K.parseVar=function(t,e,s,i){for(t.declarations=[],t.kind=s;;){var r=this.startNode();if(this.parseVarId(r,s),this.eat(f.eq)?r.init=this.parseMaybeAssign(e):!i&&s==="const"&&!(this.type===f._in||this.options.ecmaVersion>=6&&this.isContextual("of"))?this.unexpected():!i&&(s==="using"||s==="await using")&&this.options.ecmaVersion>=17&&this.type!==f._in&&!this.isContextual("of")?this.raise(this.lastTokEnd,"Missing initializer in "+s+" declaration"):!i&&r.id.type!=="Identifier"&&!(e&&(this.type===f._in||this.isContextual("of")))?this.raise(this.lastTokEnd,"Complex binding patterns require an initialization value"):r.init=null,t.declarations.push(this.finishNode(r,"VariableDeclarator")),!this.eat(f.comma))break}return t};K.parseVarId=function(t,e){t.id=e==="using"||e==="await using"?this.parseIdent():this.parseBindingAtom(),this.checkLValPattern(t.id,e==="var"?Po:Kt,false)};var ei=1,Jn=2,du=4;K.parseFunction=function(t,e,s,i,r){this.initFunction(t),(this.options.ecmaVersion>=9||this.options.ecmaVersion>=6&&!i)&&(this.type===f.star&&e&Jn&&this.unexpected(),t.generator=this.eat(f.star)),this.options.ecmaVersion>=8&&(t.async=!!i),e&ei&&(t.id=e&du&&this.type!==f.name?null:this.parseIdent(),t.id&&!(e&Jn)&&this.checkLValSimple(t.id,this.strict||t.generator||t.async?this.treatFunctionsAsVar?Po:Kt:lu));var o=this.yieldPos,a=this.awaitPos,c=this.awaitIdentPos;return this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(Ro(t.async,t.generator)),e&ei||(t.id=this.type===f.name?this.parseIdent():null),this.parseFunctionParams(t),this.parseFunctionBody(t,s,false,r),this.yieldPos=o,this.awaitPos=a,this.awaitIdentPos=c,this.finishNode(t,e&ei?"FunctionDeclaration":"FunctionExpression")};K.parseFunctionParams=function(t){this.expect(f.parenL),t.params=this.parseBindingList(f.parenR,false,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams()};K.parseClass=function(t,e){this.next();var s=this.strict;this.strict=true,this.parseClassId(t,e),this.parseClassSuper(t);var i=this.enterClassBody(),r=this.startNode(),o=false;for(r.body=[],this.expect(f.braceL);this.type!==f.braceR;){var a=this.parseClassElement(t.superClass!==null);a&&(r.body.push(a),a.type==="MethodDefinition"&&a.kind==="constructor"?(o&&this.raiseRecoverable(a.start,"Duplicate constructor in the same class"),o=true):a.key&&a.key.type==="PrivateIdentifier"&&Lh(i,a)&&this.raiseRecoverable(a.key.start,"Identifier '#"+a.key.name+"' has already been declared"))}return this.strict=s,this.next(),t.body=this.finishNode(r,"ClassBody"),this.exitClassBody(),this.finishNode(t,e?"ClassDeclaration":"ClassExpression")};K.parseClassElement=function(t){if(this.eat(f.semi))return null;var e=this.options.ecmaVersion,s=this.startNode(),i="",r=false,o=false,a="method",c=false;if(this.eatContextual("static")){if(e>=13&&this.eat(f.braceL))return this.parseClassStaticBlock(s),s;this.isClassElementNameStart()||this.type===f.star?c=true:i="static"}if(s.static=c,!i&&e>=8&&this.eatContextual("async")&&((this.isClassElementNameStart()||this.type===f.star)&&!this.canInsertSemicolon()?o=true:i="async"),!i&&(e>=9||!o)&&this.eat(f.star)&&(r=true),!i&&!o&&!r){var l=this.value;(this.eatContextual("get")||this.eatContextual("set"))&&(this.isClassElementNameStart()?a=l:i=l)}if(i?(s.computed=false,s.key=this.startNodeAt(this.lastTokStart,this.lastTokStartLoc),s.key.name=i,this.finishNode(s.key,"Identifier")):this.parseClassElementName(s),e<13||this.type===f.parenL||a!=="method"||r||o){var h=!s.static&&Hi(s,"constructor"),d=h&&t;h&&a!=="method"&&this.raise(s.key.start,"Constructor can't have get/set modifier"),s.kind=h?"constructor":a,this.parseClassMethod(s,r,o,d)}else this.parseClassField(s);return s};K.isClassElementNameStart=function(){return this.type===f.name||this.type===f.privateId||this.type===f.num||this.type===f.string||this.type===f.bracketL||this.type.keyword};K.parseClassElementName=function(t){this.type===f.privateId?(this.value==="constructor"&&this.raise(this.start,"Classes can't have an element named '#constructor'"),t.computed=false,t.key=this.parsePrivateIdent()):this.parsePropertyName(t)};K.parseClassMethod=function(t,e,s,i){var r=t.key;t.kind==="constructor"?(e&&this.raise(r.start,"Constructor can't be a generator"),s&&this.raise(r.start,"Constructor can't be an async method")):t.static&&Hi(t,"prototype")&&this.raise(r.start,"Classes may not have a static property named prototype");var o=t.value=this.parseMethod(e,s,i);return t.kind==="get"&&o.params.length!==0&&this.raiseRecoverable(o.start,"getter should have no params"),t.kind==="set"&&o.params.length!==1&&this.raiseRecoverable(o.start,"setter should have exactly one param"),t.kind==="set"&&o.params[0].type==="RestElement"&&this.raiseRecoverable(o.params[0].start,"Setter cannot use rest params"),this.finishNode(t,"MethodDefinition")};K.parseClassField=function(t){return Hi(t,"constructor")?this.raise(t.key.start,"Classes can't have a field named 'constructor'"):t.static&&Hi(t,"prototype")&&this.raise(t.key.start,"Classes can't have a static field named 'prototype'"),this.eat(f.eq)?(this.enterScope(yi|gr),t.value=this.parseMaybeAssign(),this.exitScope()):t.value=null,this.semicolon(),this.finishNode(t,"PropertyDefinition")};K.parseClassStaticBlock=function(t){t.body=[];var e=this.labels;for(this.labels=[],this.enterScope(ks|gr);this.type!==f.braceR;){var s=this.parseStatement(null);t.body.push(s)}return this.next(),this.exitScope(),this.labels=e,this.finishNode(t,"StaticBlock")};K.parseClassId=function(t,e){this.type===f.name?(t.id=this.parseIdent(),e&&this.checkLValSimple(t.id,Kt,false)):(e===true&&this.unexpected(),t.id=null)};K.parseClassSuper=function(t){t.superClass=this.eat(f._extends)?this.parseExprSubscripts(null,false):null};K.enterClassBody=function(){var t={declared:Object.create(null),used:[]};return this.privateNameStack.push(t),t.declared};K.exitClassBody=function(){var t=this.privateNameStack.pop(),e=t.declared,s=t.used;if(this.options.checkPrivateFields)for(var i=this.privateNameStack.length,r=i===0?null:this.privateNameStack[i-1],o=0;o<s.length;++o){var a=s[o];Vs(e,a.name)||(r?r.used.push(a):this.raiseRecoverable(a.start,"Private field '#"+a.name+"' must be declared in an enclosing class"))}};function Lh(t,e){var s=e.key.name,i=t[s],r="true";return e.type==="MethodDefinition"&&(e.kind==="get"||e.kind==="set")&&(r=(e.static?"s":"i")+e.kind),i==="iget"&&r==="iset"||i==="iset"&&r==="iget"||i==="sget"&&r==="sset"||i==="sset"&&r==="sget"?(t[s]="true",false):i?true:(t[s]=r,false)}function Hi(t,e){var s=t.computed,i=t.key;return!s&&(i.type==="Identifier"&&i.name===e||i.type==="Literal"&&i.value===e)}K.parseExportAllDeclaration=function(t,e){return this.options.ecmaVersion>=11&&(this.eatContextual("as")?(t.exported=this.parseModuleExportName(),this.checkExport(e,t.exported,this.lastTokStart)):t.exported=null),this.expectContextual("from"),this.type!==f.string&&this.unexpected(),t.source=this.parseExprAtom(),this.options.ecmaVersion>=16&&(t.attributes=this.parseWithClause()),this.semicolon(),this.finishNode(t,"ExportAllDeclaration")};K.parseExport=function(t,e){if(this.next(),this.eat(f.star))return this.parseExportAllDeclaration(t,e);if(this.eat(f._default))return this.checkExport(e,"default",this.lastTokStart),t.declaration=this.parseExportDefaultDeclaration(),this.finishNode(t,"ExportDefaultDeclaration");if(this.shouldParseExportStatement())t.declaration=this.parseExportDeclaration(t),t.declaration.type==="VariableDeclaration"?this.checkVariableExport(e,t.declaration.declarations):this.checkExport(e,t.declaration.id,t.declaration.id.start),t.specifiers=[],t.source=null,this.options.ecmaVersion>=16&&(t.attributes=[]);else{if(t.declaration=null,t.specifiers=this.parseExportSpecifiers(e),this.eatContextual("from"))this.type!==f.string&&this.unexpected(),t.source=this.parseExprAtom(),this.options.ecmaVersion>=16&&(t.attributes=this.parseWithClause());else{for(var s=0,i=t.specifiers;s<i.length;s+=1){var r=i[s];this.checkUnreserved(r.local),this.checkLocalExport(r.local),r.local.type==="Literal"&&this.raise(r.local.start,"A string literal cannot be used as an exported binding without `from`.")}t.source=null,this.options.ecmaVersion>=16&&(t.attributes=[])}this.semicolon()}return this.finishNode(t,"ExportNamedDeclaration")};K.parseExportDeclaration=function(t){return this.parseStatement(null)};K.parseExportDefaultDeclaration=function(){var t;if(this.type===f._function||(t=this.isAsyncFunction())){var e=this.startNode();return this.next(),t&&this.next(),this.parseFunction(e,ei|du,false,t)}else if(this.type===f._class){var s=this.startNode();return this.parseClass(s,"nullableID")}else{var i=this.parseMaybeAssign();return this.semicolon(),i}};K.checkExport=function(t,e,s){t&&(typeof e!="string"&&(e=e.type==="Identifier"?e.name:e.value),Vs(t,e)&&this.raiseRecoverable(s,"Duplicate export '"+e+"'"),t[e]=true)};K.checkPatternExport=function(t,e){var s=e.type;if(s==="Identifier")this.checkExport(t,e,e.start);else if(s==="ObjectPattern")for(var i=0,r=e.properties;i<r.length;i+=1){var o=r[i];this.checkPatternExport(t,o)}else if(s==="ArrayPattern")for(var a=0,c=e.elements;a<c.length;a+=1){var l=c[a];l&&this.checkPatternExport(t,l)}else s==="Property"?this.checkPatternExport(t,e.value):s==="AssignmentPattern"?this.checkPatternExport(t,e.left):s==="RestElement"&&this.checkPatternExport(t,e.argument)};K.checkVariableExport=function(t,e){if(t)for(var s=0,i=e;s<i.length;s+=1){var r=i[s];this.checkPatternExport(t,r.id)}};K.shouldParseExportStatement=function(){return this.type.keyword==="var"||this.type.keyword==="const"||this.type.keyword==="class"||this.type.keyword==="function"||this.isLet()||this.isAsyncFunction()};K.parseExportSpecifier=function(t){var e=this.startNode();return e.local=this.parseModuleExportName(),e.exported=this.eatContextual("as")?this.parseModuleExportName():e.local,this.checkExport(t,e.exported,e.exported.start),this.finishNode(e,"ExportSpecifier")};K.parseExportSpecifiers=function(t){var e=[],s=true;for(this.expect(f.braceL);!this.eat(f.braceR);){if(s)s=false;else if(this.expect(f.comma),this.afterTrailingComma(f.braceR))break;e.push(this.parseExportSpecifier(t))}return e};K.parseImport=function(t){return this.next(),this.type===f.string?(t.specifiers=Ph,t.source=this.parseExprAtom()):(t.specifiers=this.parseImportSpecifiers(),this.expectContextual("from"),t.source=this.type===f.string?this.parseExprAtom():this.unexpected()),this.options.ecmaVersion>=16&&(t.attributes=this.parseWithClause()),this.semicolon(),this.finishNode(t,"ImportDeclaration")};K.parseImportSpecifier=function(){var t=this.startNode();return t.imported=this.parseModuleExportName(),this.eatContextual("as")?t.local=this.parseIdent():(this.checkUnreserved(t.imported),t.local=t.imported),this.checkLValSimple(t.local,Kt),this.finishNode(t,"ImportSpecifier")};K.parseImportDefaultSpecifier=function(){var t=this.startNode();return t.local=this.parseIdent(),this.checkLValSimple(t.local,Kt),this.finishNode(t,"ImportDefaultSpecifier")};K.parseImportNamespaceSpecifier=function(){var t=this.startNode();return this.next(),this.expectContextual("as"),t.local=this.parseIdent(),this.checkLValSimple(t.local,Kt),this.finishNode(t,"ImportNamespaceSpecifier")};K.parseImportSpecifiers=function(){var t=[],e=true;if(this.type===f.name&&(t.push(this.parseImportDefaultSpecifier()),!this.eat(f.comma)))return t;if(this.type===f.star)return t.push(this.parseImportNamespaceSpecifier()),t;for(this.expect(f.braceL);!this.eat(f.braceR);){if(e)e=false;else if(this.expect(f.comma),this.afterTrailingComma(f.braceR))break;t.push(this.parseImportSpecifier())}return t};K.parseWithClause=function(){var t=[];if(!this.eat(f._with))return t;this.expect(f.braceL);for(var e={},s=true;!this.eat(f.braceR);){if(s)s=false;else if(this.expect(f.comma),this.afterTrailingComma(f.braceR))break;var i=this.parseImportAttribute(),r=i.key.type==="Identifier"?i.key.name:i.key.value;Vs(e,r)&&this.raiseRecoverable(i.key.start,"Duplicate attribute key '"+r+"'"),e[r]=true,t.push(i)}return t};K.parseImportAttribute=function(){var t=this.startNode();return t.key=this.type===f.string?this.parseExprAtom():this.parseIdent(this.options.allowReserved!=="never"),this.expect(f.colon),this.type!==f.string&&this.unexpected(),t.value=this.parseExprAtom(),this.finishNode(t,"ImportAttribute")};K.parseModuleExportName=function(){if(this.options.ecmaVersion>=13&&this.type===f.string){var t=this.parseLiteral(this.value);return Th.test(t.value)&&this.raise(t.start,"An export name cannot include a lone surrogate."),t}return this.parseIdent(true)};K.adaptDirectivePrologue=function(t){for(var e=0;e<t.length&&this.isDirectiveCandidate(t[e]);++e)t[e].directive=t[e].expression.raw.slice(1,-1)};K.isDirectiveCandidate=function(t){return this.options.ecmaVersion>=5&&t.type==="ExpressionStatement"&&t.expression.type==="Literal"&&typeof t.expression.value=="string"&&(this.input[t.start]==='"'||this.input[t.start]==="'")};var ht=Ne.prototype;ht.toAssignable=function(t,e,s){if(this.options.ecmaVersion>=6&&t)switch(t.type){case"Identifier":this.inAsync&&t.name==="await"&&this.raise(t.start,"Cannot use 'await' as identifier inside an async function");break;case"ObjectPattern":case"ArrayPattern":case"AssignmentPattern":case"RestElement":break;case"ObjectExpression":t.type="ObjectPattern",s&&this.checkPatternErrors(s,true);for(var i=0,r=t.properties;i<r.length;i+=1){var o=r[i];this.toAssignable(o,e),o.type==="RestElement"&&(o.argument.type==="ArrayPattern"||o.argument.type==="ObjectPattern")&&this.raise(o.argument.start,"Unexpected token")}break;case"Property":t.kind!=="init"&&this.raise(t.key.start,"Object pattern can't contain getter or setter"),this.toAssignable(t.value,e);break;case"ArrayExpression":t.type="ArrayPattern",s&&this.checkPatternErrors(s,true),this.toAssignableList(t.elements,e);break;case"SpreadElement":t.type="RestElement",this.toAssignable(t.argument,e),t.argument.type==="AssignmentPattern"&&this.raise(t.argument.start,"Rest elements cannot have a default value");break;case"AssignmentExpression":t.operator!=="="&&this.raise(t.left.end,"Only '=' operator can be used for specifying default value."),t.type="AssignmentPattern",delete t.operator,this.toAssignable(t.left,e);break;case"ParenthesizedExpression":this.toAssignable(t.expression,e,s);break;case"ChainExpression":this.raiseRecoverable(t.start,"Optional chaining cannot appear in left-hand side");break;case"MemberExpression":if(!e)break;default:this.raise(t.start,"Assigning to rvalue")}else s&&this.checkPatternErrors(s,true);return t};ht.toAssignableList=function(t,e){for(var s=t.length,i=0;i<s;i++){var r=t[i];r&&this.toAssignable(r,e)}if(s){var o=t[s-1];this.options.ecmaVersion===6&&e&&o&&o.type==="RestElement"&&o.argument.type!=="Identifier"&&this.unexpected(o.argument.start)}return t};ht.parseSpread=function(t){var e=this.startNode();return this.next(),e.argument=this.parseMaybeAssign(false,t),this.finishNode(e,"SpreadElement")};ht.parseRestBinding=function(){var t=this.startNode();return this.next(),this.options.ecmaVersion===6&&this.type!==f.name&&this.unexpected(),t.argument=this.parseBindingAtom(),this.finishNode(t,"RestElement")};ht.parseBindingAtom=function(){if(this.options.ecmaVersion>=6)switch(this.type){case f.bracketL:var t=this.startNode();return this.next(),t.elements=this.parseBindingList(f.bracketR,true,true),this.finishNode(t,"ArrayPattern");case f.braceL:return this.parseObj(true)}return this.parseIdent()};ht.parseBindingList=function(t,e,s,i){for(var r=[],o=true;!this.eat(t);)if(o?o=false:this.expect(f.comma),e&&this.type===f.comma)r.push(null);else{if(s&&this.afterTrailingComma(t))break;if(this.type===f.ellipsis){var a=this.parseRestBinding();this.parseBindingListItem(a),r.push(a),this.type===f.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element"),this.expect(t);break}else r.push(this.parseAssignableListItem(i))}return r};ht.parseAssignableListItem=function(t){var e=this.parseMaybeDefault(this.start,this.startLoc);return this.parseBindingListItem(e),e};ht.parseBindingListItem=function(t){return t};ht.parseMaybeDefault=function(t,e,s){if(s=s||this.parseBindingAtom(),this.options.ecmaVersion<6||!this.eat(f.eq))return s;var i=this.startNodeAt(t,e);return i.left=s,i.right=this.parseMaybeAssign(),this.finishNode(i,"AssignmentPattern")};ht.checkLValSimple=function(t,e,s){e===void 0&&(e=qi);var i=e!==qi;switch(t.type){case"Identifier":this.strict&&this.reservedWordsStrictBind.test(t.name)&&this.raiseRecoverable(t.start,(i?"Binding ":"Assigning to ")+t.name+" in strict mode"),i&&(e===Kt&&t.name==="let"&&this.raiseRecoverable(t.start,"let is disallowed as a lexically bound name"),s&&(Vs(s,t.name)&&this.raiseRecoverable(t.start,"Argument name clash"),s[t.name]=true),e!==fu&&this.declareName(t.name,e,t.start));break;case"ChainExpression":this.raiseRecoverable(t.start,"Optional chaining cannot appear in left-hand side");break;case"MemberExpression":i&&this.raiseRecoverable(t.start,"Binding member expression");break;case"ParenthesizedExpression":return i&&this.raiseRecoverable(t.start,"Binding parenthesized expression"),this.checkLValSimple(t.expression,e,s);default:this.raise(t.start,(i?"Binding":"Assigning to")+" rvalue")}};ht.checkLValPattern=function(t,e,s){switch(e===void 0&&(e=qi),t.type){case"ObjectPattern":for(var i=0,r=t.properties;i<r.length;i+=1){var o=r[i];this.checkLValInnerPattern(o,e,s)}break;case"ArrayPattern":for(var a=0,c=t.elements;a<c.length;a+=1){var l=c[a];l&&this.checkLValInnerPattern(l,e,s)}break;default:this.checkLValSimple(t,e,s)}};ht.checkLValInnerPattern=function(t,e,s){switch(e===void 0&&(e=qi),t.type){case"Property":this.checkLValInnerPattern(t.value,e,s);break;case"AssignmentPattern":this.checkLValPattern(t.left,e,s);break;case"RestElement":this.checkLValPattern(t.argument,e,s);break;default:this.checkLValPattern(t,e,s)}};var ft=function(e,s,i,r,o){this.token=e,this.isExpr=!!s,this.preserveSpace=!!i,this.override=r,this.generator=!!o},Te={b_stat:new ft("{",false),b_expr:new ft("{",true),b_tmpl:new ft("${",false),p_stat:new ft("(",false),p_expr:new ft("(",true),q_tmpl:new ft("`",true,true,function(t){return t.tryReadTemplateToken()}),f_stat:new ft("function",false),f_expr:new ft("function",true),f_expr_gen:new ft("function",true,false,null,true),f_gen:new ft("function",false,false,null,true)},js=Ne.prototype;js.initialContext=function(){return[Te.b_stat]};js.curContext=function(){return this.context[this.context.length-1]};js.braceIsBlock=function(t){var e=this.curContext();return e===Te.f_expr||e===Te.f_stat?true:t===f.colon&&(e===Te.b_stat||e===Te.b_expr)?!e.isExpr:t===f._return||t===f.name&&this.exprAllowed?st.test(this.input.slice(this.lastTokEnd,this.start)):t===f._else||t===f.semi||t===f.eof||t===f.parenR||t===f.arrow?true:t===f.braceL?e===Te.b_stat:t===f._var||t===f._const||t===f.name?false:!this.exprAllowed};js.inGeneratorContext=function(){for(var t=this.context.length-1;t>=1;t--){var e=this.context[t];if(e.token==="function")return e.generator}return false};js.updateContext=function(t){var e,s=this.type;s.keyword&&t===f.dot?this.exprAllowed=false:(e=s.updateContext)?e.call(this,t):this.exprAllowed=s.beforeExpr};js.overrideContext=function(t){this.curContext()!==t&&(this.context[this.context.length-1]=t)};f.parenR.updateContext=f.braceR.updateContext=function(){if(this.context.length===1){this.exprAllowed=true;return}var t=this.context.pop();t===Te.b_stat&&this.curContext().token==="function"&&(t=this.context.pop()),this.exprAllowed=!t.isExpr};f.braceL.updateContext=function(t){this.context.push(this.braceIsBlock(t)?Te.b_stat:Te.b_expr),this.exprAllowed=true};f.dollarBraceL.updateContext=function(){this.context.push(Te.b_tmpl),this.exprAllowed=true};f.parenL.updateContext=function(t){var e=t===f._if||t===f._for||t===f._with||t===f._while;this.context.push(e?Te.p_stat:Te.p_expr),this.exprAllowed=true};f.incDec.updateContext=function(){};f._function.updateContext=f._class.updateContext=function(t){t.beforeExpr&&t!==f._else&&!(t===f.semi&&this.curContext()!==Te.p_stat)&&!(t===f._return&&st.test(this.input.slice(this.lastTokEnd,this.start)))&&!((t===f.colon||t===f.braceL)&&this.curContext()===Te.b_stat)?this.context.push(Te.f_expr):this.context.push(Te.f_stat),this.exprAllowed=false};f.colon.updateContext=function(){this.curContext().token==="function"&&this.context.pop(),this.exprAllowed=true};f.backQuote.updateContext=function(){this.curContext()===Te.q_tmpl?this.context.pop():this.context.push(Te.q_tmpl),this.exprAllowed=false};f.star.updateContext=function(t){if(t===f._function){var e=this.context.length-1;this.context[e]===Te.f_expr?this.context[e]=Te.f_expr_gen:this.context[e]=Te.f_gen}this.exprAllowed=true};f.name.updateContext=function(t){var e=false;this.options.ecmaVersion>=6&&t!==f.dot&&(this.value==="of"&&!this.exprAllowed||this.value==="yield"&&this.inGeneratorContext())&&(e=true),this.exprAllowed=e};var he=Ne.prototype;he.checkPropClash=function(t,e,s){if(!(this.options.ecmaVersion>=9&&t.type==="SpreadElement")&&!(this.options.ecmaVersion>=6&&(t.computed||t.method||t.shorthand))){var i=t.key,r;switch(i.type){case"Identifier":r=i.name;break;case"Literal":r=String(i.value);break;default:return}var o=t.kind;if(this.options.ecmaVersion>=6){r==="__proto__"&&o==="init"&&(e.proto&&(s?s.doubleProto<0&&(s.doubleProto=i.start):this.raiseRecoverable(i.start,"Redefinition of __proto__ property")),e.proto=true);return}r="$"+r;var a=e[r];if(a){var c;o==="init"?c=this.strict&&a.init||a.get||a.set:c=a.init||a[o],c&&this.raiseRecoverable(i.start,"Redefinition of property")}else a=e[r]={init:false,get:false,set:false};a[o]=true}};he.parseExpression=function(t,e){var s=this.start,i=this.startLoc,r=this.parseMaybeAssign(t,e);if(this.type===f.comma){var o=this.startNodeAt(s,i);for(o.expressions=[r];this.eat(f.comma);)o.expressions.push(this.parseMaybeAssign(t,e));return this.finishNode(o,"SequenceExpression")}return r};he.parseMaybeAssign=function(t,e,s){if(this.isContextual("yield")){if(this.inGenerator)return this.parseYield(t);this.exprAllowed=false}var i=false,r=-1,o=-1,a=-1;e?(r=e.parenthesizedAssign,o=e.trailingComma,a=e.doubleProto,e.parenthesizedAssign=e.trailingComma=-1):(e=new yr,i=true);var c=this.start,l=this.startLoc;(this.type===f.parenL||this.type===f.name)&&(this.potentialArrowAt=this.start,this.potentialArrowInForAwait=t==="await");var h=this.parseMaybeConditional(t,e);if(s&&(h=s.call(this,h,c,l)),this.type.isAssign){var d=this.startNodeAt(c,l);return d.operator=this.value,this.type===f.eq&&(h=this.toAssignable(h,false,e)),i||(e.parenthesizedAssign=e.trailingComma=e.doubleProto=-1),e.shorthandAssign>=h.start&&(e.shorthandAssign=-1),this.type===f.eq?this.checkLValPattern(h):this.checkLValSimple(h),d.left=h,this.next(),d.right=this.parseMaybeAssign(t),a>-1&&(e.doubleProto=a),this.finishNode(d,"AssignmentExpression")}else i&&this.checkExpressionErrors(e,true);return r>-1&&(e.parenthesizedAssign=r),o>-1&&(e.trailingComma=o),h};he.parseMaybeConditional=function(t,e){var s=this.start,i=this.startLoc,r=this.parseExprOps(t,e);if(this.checkExpressionErrors(e))return r;if(this.eat(f.question)){var o=this.startNodeAt(s,i);return o.test=r,o.consequent=this.parseMaybeAssign(),this.expect(f.colon),o.alternate=this.parseMaybeAssign(t),this.finishNode(o,"ConditionalExpression")}return r};he.parseExprOps=function(t,e){var s=this.start,i=this.startLoc,r=this.parseMaybeUnary(e,false,false,t);return this.checkExpressionErrors(e)||r.start===s&&r.type==="ArrowFunctionExpression"?r:this.parseExprOp(r,s,i,-1,t)};he.parseExprOp=function(t,e,s,i,r){var o=this.type.binop;if(o!=null&&(!r||this.type!==f._in)&&o>i){var a=this.type===f.logicalOR||this.type===f.logicalAND,c=this.type===f.coalesce;c&&(o=f.logicalAND.binop);var l=this.value;this.next();var h=this.start,d=this.startLoc,m=this.parseExprOp(this.parseMaybeUnary(null,false,false,r),h,d,o,r),_=this.buildBinary(e,s,t,m,l,a||c);return(a&&this.type===f.coalesce||c&&(this.type===f.logicalOR||this.type===f.logicalAND))&&this.raiseRecoverable(this.start,"Logical expressions and coalesce expressions cannot be mixed. Wrap either by parentheses"),this.parseExprOp(_,e,s,i,r)}return t};he.buildBinary=function(t,e,s,i,r,o){i.type==="PrivateIdentifier"&&this.raise(i.start,"Private identifier can only be left side of binary expression");var a=this.startNodeAt(t,e);return a.left=s,a.operator=r,a.right=i,this.finishNode(a,o?"LogicalExpression":"BinaryExpression")};he.parseMaybeUnary=function(t,e,s,i){var r=this.start,o=this.startLoc,a;if(this.isContextual("await")&&this.canAwait)a=this.parseAwait(i),e=true;else if(this.type.prefix){var c=this.startNode(),l=this.type===f.incDec;c.operator=this.value,c.prefix=true,this.next(),c.argument=this.parseMaybeUnary(null,true,l,i),this.checkExpressionErrors(t,true),l?this.checkLValSimple(c.argument):this.strict&&c.operator==="delete"&&pu(c.argument)?this.raiseRecoverable(c.start,"Deleting local variable in strict mode"):c.operator==="delete"&&eo(c.argument)?this.raiseRecoverable(c.start,"Private fields can not be deleted"):e=true,a=this.finishNode(c,l?"UpdateExpression":"UnaryExpression")}else if(!e&&this.type===f.privateId)(i||this.privateNameStack.length===0)&&this.options.checkPrivateFields&&this.unexpected(),a=this.parsePrivateIdent(),this.type!==f._in&&this.unexpected();else{if(a=this.parseExprSubscripts(t,i),this.checkExpressionErrors(t))return a;for(;this.type.postfix&&!this.canInsertSemicolon();){var h=this.startNodeAt(r,o);h.operator=this.value,h.prefix=false,h.argument=a,this.checkLValSimple(a),this.next(),a=this.finishNode(h,"UpdateExpression")}}if(!s&&this.eat(f.starstar))if(e)this.unexpected(this.lastTokStart);else return this.buildBinary(r,o,a,this.parseMaybeUnary(null,false,false,i),"**",false);else return a};function pu(t){return t.type==="Identifier"||t.type==="ParenthesizedExpression"&&pu(t.expression)}function eo(t){return t.type==="MemberExpression"&&t.property.type==="PrivateIdentifier"||t.type==="ChainExpression"&&eo(t.expression)||t.type==="ParenthesizedExpression"&&eo(t.expression)}he.parseExprSubscripts=function(t,e){var s=this.start,i=this.startLoc,r=this.parseExprAtom(t,e);if(r.type==="ArrowFunctionExpression"&&this.input.slice(this.lastTokStart,this.lastTokEnd)!==")")return r;var o=this.parseSubscripts(r,s,i,false,e);return t&&o.type==="MemberExpression"&&(t.parenthesizedAssign>=o.start&&(t.parenthesizedAssign=-1),t.parenthesizedBind>=o.start&&(t.parenthesizedBind=-1),t.trailingComma>=o.start&&(t.trailingComma=-1)),o};he.parseSubscripts=function(t,e,s,i,r){for(var o=this.options.ecmaVersion>=8&&t.type==="Identifier"&&t.name==="async"&&this.lastTokEnd===t.end&&!this.canInsertSemicolon()&&t.end-t.start===5&&this.potentialArrowAt===t.start,a=false;;){var c=this.parseSubscript(t,e,s,i,o,a,r);if(c.optional&&(a=true),c===t||c.type==="ArrowFunctionExpression"){if(a){var l=this.startNodeAt(e,s);l.expression=c,c=this.finishNode(l,"ChainExpression")}return c}t=c}};he.shouldParseAsyncArrow=function(){return!this.canInsertSemicolon()&&this.eat(f.arrow)};he.parseSubscriptAsyncArrow=function(t,e,s,i){return this.parseArrowExpression(this.startNodeAt(t,e),s,true,i)};he.parseSubscript=function(t,e,s,i,r,o,a){var c=this.options.ecmaVersion>=11,l=c&&this.eat(f.questionDot);i&&l&&this.raise(this.lastTokStart,"Optional chaining cannot appear in the callee of new expressions");var h=this.eat(f.bracketL);if(h||l&&this.type!==f.parenL&&this.type!==f.backQuote||this.eat(f.dot)){var d=this.startNodeAt(e,s);d.object=t,h?(d.property=this.parseExpression(),this.expect(f.bracketR)):this.type===f.privateId&&t.type!=="Super"?d.property=this.parsePrivateIdent():d.property=this.parseIdent(this.options.allowReserved!=="never"),d.computed=!!h,c&&(d.optional=l),t=this.finishNode(d,"MemberExpression")}else if(!i&&this.eat(f.parenL)){var m=new yr,_=this.yieldPos,x=this.awaitPos,E=this.awaitIdentPos;this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0;var N=this.parseExprList(f.parenR,this.options.ecmaVersion>=8,false,m);if(r&&!l&&this.shouldParseAsyncArrow())return this.checkPatternErrors(m,false),this.checkYieldAwaitInDefaultParams(),this.awaitIdentPos>0&&this.raise(this.awaitIdentPos,"Cannot use 'await' as identifier inside an async function"),this.yieldPos=_,this.awaitPos=x,this.awaitIdentPos=E,this.parseSubscriptAsyncArrow(e,s,N,a);this.checkExpressionErrors(m,true),this.yieldPos=_||this.yieldPos,this.awaitPos=x||this.awaitPos,this.awaitIdentPos=E||this.awaitIdentPos;var F=this.startNodeAt(e,s);F.callee=t,F.arguments=N,c&&(F.optional=l),t=this.finishNode(F,"CallExpression")}else if(this.type===f.backQuote){(l||o)&&this.raise(this.start,"Optional chaining cannot appear in the tag of tagged template expressions");var U=this.startNodeAt(e,s);U.tag=t,U.quasi=this.parseTemplate({isTagged:true}),t=this.finishNode(U,"TaggedTemplateExpression")}return t};he.parseExprAtom=function(t,e,s){this.type===f.slash&&this.readRegexp();var i,r=this.potentialArrowAt===this.start;switch(this.type){case f._super:return this.allowSuper||this.raise(this.start,"'super' keyword outside a method"),i=this.startNode(),this.next(),this.type===f.parenL&&!this.allowDirectSuper&&this.raise(i.start,"super() call outside constructor of a subclass"),this.type!==f.dot&&this.type!==f.bracketL&&this.type!==f.parenL&&this.unexpected(),this.finishNode(i,"Super");case f._this:return i=this.startNode(),this.next(),this.finishNode(i,"ThisExpression");case f.name:var o=this.start,a=this.startLoc,c=this.containsEsc,l=this.parseIdent(false);if(this.options.ecmaVersion>=8&&!c&&l.name==="async"&&!this.canInsertSemicolon()&&this.eat(f._function))return this.overrideContext(Te.f_expr),this.parseFunction(this.startNodeAt(o,a),0,false,true,e);if(r&&!this.canInsertSemicolon()){if(this.eat(f.arrow))return this.parseArrowExpression(this.startNodeAt(o,a),[l],false,e);if(this.options.ecmaVersion>=8&&l.name==="async"&&this.type===f.name&&!c&&(!this.potentialArrowInForAwait||this.value!=="of"||this.containsEsc))return l=this.parseIdent(false),(this.canInsertSemicolon()||!this.eat(f.arrow))&&this.unexpected(),this.parseArrowExpression(this.startNodeAt(o,a),[l],true,e)}return l;case f.regexp:var h=this.value;return i=this.parseLiteral(h.value),i.regex={pattern:h.pattern,flags:h.flags},i;case f.num:case f.string:return this.parseLiteral(this.value);case f._null:case f._true:case f._false:return i=this.startNode(),i.value=this.type===f._null?null:this.type===f._true,i.raw=this.type.keyword,this.next(),this.finishNode(i,"Literal");case f.parenL:var d=this.start,m=this.parseParenAndDistinguishExpression(r,e);return t&&(t.parenthesizedAssign<0&&!this.isSimpleAssignTarget(m)&&(t.parenthesizedAssign=d),t.parenthesizedBind<0&&(t.parenthesizedBind=d)),m;case f.bracketL:return i=this.startNode(),this.next(),i.elements=this.parseExprList(f.bracketR,true,true,t),this.finishNode(i,"ArrayExpression");case f.braceL:return this.overrideContext(Te.b_expr),this.parseObj(false,t);case f._function:return i=this.startNode(),this.next(),this.parseFunction(i,0);case f._class:return this.parseClass(this.startNode(),false);case f._new:return this.parseNew();case f.backQuote:return this.parseTemplate();case f._import:return this.options.ecmaVersion>=11?this.parseExprImport(s):this.unexpected();default:return this.parseExprAtomDefault()}};he.parseExprAtomDefault=function(){this.unexpected()};he.parseExprImport=function(t){var e=this.startNode();if(this.containsEsc&&this.raiseRecoverable(this.start,"Escape sequence in keyword import"),this.next(),this.type===f.parenL&&!t)return this.parseDynamicImport(e);if(this.type===f.dot){var s=this.startNodeAt(e.start,e.loc&&e.loc.start);return s.name="import",e.meta=this.finishNode(s,"Identifier"),this.parseImportMeta(e)}else this.unexpected()};he.parseDynamicImport=function(t){if(this.next(),t.source=this.parseMaybeAssign(),this.options.ecmaVersion>=16)this.eat(f.parenR)?t.options=null:(this.expect(f.comma),this.afterTrailingComma(f.parenR)?t.options=null:(t.options=this.parseMaybeAssign(),this.eat(f.parenR)||(this.expect(f.comma),this.afterTrailingComma(f.parenR)||this.unexpected())));else if(!this.eat(f.parenR)){var e=this.start;this.eat(f.comma)&&this.eat(f.parenR)?this.raiseRecoverable(e,"Trailing comma is not allowed in import()"):this.unexpected(e)}return this.finishNode(t,"ImportExpression")};he.parseImportMeta=function(t){this.next();var e=this.containsEsc;return t.property=this.parseIdent(true),t.property.name!=="meta"&&this.raiseRecoverable(t.property.start,"The only valid meta property for import is 'import.meta'"),e&&this.raiseRecoverable(t.start,"'import.meta' must not contain escaped characters"),this.options.sourceType!=="module"&&!this.options.allowImportExportEverywhere&&this.raiseRecoverable(t.start,"Cannot use 'import.meta' outside a module"),this.finishNode(t,"MetaProperty")};he.parseLiteral=function(t){var e=this.startNode();return e.value=t,e.raw=this.input.slice(this.start,this.end),e.raw.charCodeAt(e.raw.length-1)===110&&(e.bigint=e.value!=null?e.value.toString():e.raw.slice(0,-1).replace(/_/g,"")),this.next(),this.finishNode(e,"Literal")};he.parseParenExpression=function(){this.expect(f.parenL);var t=this.parseExpression();return this.expect(f.parenR),t};he.shouldParseArrow=function(t){return!this.canInsertSemicolon()};he.parseParenAndDistinguishExpression=function(t,e){var s=this.start,i=this.startLoc,r,o=this.options.ecmaVersion>=8;if(this.options.ecmaVersion>=6){this.next();var a=this.start,c=this.startLoc,l=[],h=true,d=false,m=new yr,_=this.yieldPos,x=this.awaitPos,E;for(this.yieldPos=0,this.awaitPos=0;this.type!==f.parenR;)if(h?h=false:this.expect(f.comma),o&&this.afterTrailingComma(f.parenR,true)){d=true;break}else if(this.type===f.ellipsis){E=this.start,l.push(this.parseParenItem(this.parseRestBinding())),this.type===f.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element");break}else l.push(this.parseMaybeAssign(false,m,this.parseParenItem));var N=this.lastTokEnd,F=this.lastTokEndLoc;if(this.expect(f.parenR),t&&this.shouldParseArrow(l)&&this.eat(f.arrow))return this.checkPatternErrors(m,false),this.checkYieldAwaitInDefaultParams(),this.yieldPos=_,this.awaitPos=x,this.parseParenArrowList(s,i,l,e);(!l.length||d)&&this.unexpected(this.lastTokStart),E&&this.unexpected(E),this.checkExpressionErrors(m,true),this.yieldPos=_||this.yieldPos,this.awaitPos=x||this.awaitPos,l.length>1?(r=this.startNodeAt(a,c),r.expressions=l,this.finishNodeAt(r,"SequenceExpression",N,F)):r=l[0]}else r=this.parseParenExpression();if(this.options.preserveParens){var U=this.startNodeAt(s,i);return U.expression=r,this.finishNode(U,"ParenthesizedExpression")}else return r};he.parseParenItem=function(t){return t};he.parseParenArrowList=function(t,e,s,i){return this.parseArrowExpression(this.startNodeAt(t,e),s,false,i)};var Dh=[];he.parseNew=function(){this.containsEsc&&this.raiseRecoverable(this.start,"Escape sequence in keyword new");var t=this.startNode();if(this.next(),this.options.ecmaVersion>=6&&this.type===f.dot){var e=this.startNodeAt(t.start,t.loc&&t.loc.start);e.name="new",t.meta=this.finishNode(e,"Identifier"),this.next();var s=this.containsEsc;return t.property=this.parseIdent(true),t.property.name!=="target"&&this.raiseRecoverable(t.property.start,"The only valid meta property for new is 'new.target'"),s&&this.raiseRecoverable(t.start,"'new.target' must not contain escaped characters"),this.allowNewDotTarget||this.raiseRecoverable(t.start,"'new.target' can only be used in functions and class static block"),this.finishNode(t,"MetaProperty")}var i=this.start,r=this.startLoc;return t.callee=this.parseSubscripts(this.parseExprAtom(null,false,true),i,r,true,false),this.eat(f.parenL)?t.arguments=this.parseExprList(f.parenR,this.options.ecmaVersion>=8,false):t.arguments=Dh,this.finishNode(t,"NewExpression")};he.parseTemplateElement=function(t){var e=t.isTagged,s=this.startNode();return this.type===f.invalidTemplate?(e||this.raiseRecoverable(this.start,"Bad escape sequence in untagged template literal"),s.value={raw:this.value.replace(/\r\n?/g,`
4
4
  `),cooked:null}):s.value={raw:this.input.slice(this.start,this.end).replace(/\r\n?/g,`
5
- `),cooked:this.value},this.next(),s.tail=this.type===f.backQuote,this.finishNode(s,"TemplateElement")};he.parseTemplate=function(t){t===void 0&&(t={});var e=t.isTagged;e===void 0&&(e=false);var s=this.startNode();this.next(),s.expressions=[];var i=this.parseTemplateElement({isTagged:e});for(s.quasis=[i];!i.tail;)this.type===f.eof&&this.raise(this.pos,"Unterminated template literal"),this.expect(f.dollarBraceL),s.expressions.push(this.parseExpression()),this.expect(f.braceR),s.quasis.push(i=this.parseTemplateElement({isTagged:e}));return this.next(),this.finishNode(s,"TemplateLiteral")};he.isAsyncProp=function(t){return!t.computed&&t.key.type==="Identifier"&&t.key.name==="async"&&(this.type===f.name||this.type===f.num||this.type===f.string||this.type===f.bracketL||this.type.keyword||this.options.ecmaVersion>=9&&this.type===f.star)&&!st.test(this.input.slice(this.lastTokEnd,this.start))};he.parseObj=function(t,e){var s=this.startNode(),i=true,r={};for(s.properties=[],this.next();!this.eat(f.braceR);){if(i)i=false;else if(this.expect(f.comma),this.options.ecmaVersion>=5&&this.afterTrailingComma(f.braceR))break;var a=this.parseProperty(t,e);t||this.checkPropClash(a,r,e),s.properties.push(a)}return this.finishNode(s,t?"ObjectPattern":"ObjectExpression")};he.parseProperty=function(t,e){var s=this.startNode(),i,r,a,o;if(this.options.ecmaVersion>=9&&this.eat(f.ellipsis))return t?(s.argument=this.parseIdent(false),this.type===f.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element"),this.finishNode(s,"RestElement")):(s.argument=this.parseMaybeAssign(false,e),this.type===f.comma&&e&&e.trailingComma<0&&(e.trailingComma=this.start),this.finishNode(s,"SpreadElement"));this.options.ecmaVersion>=6&&(s.method=false,s.shorthand=false,(t||e)&&(a=this.start,o=this.startLoc),t||(i=this.eat(f.star)));var c=this.containsEsc;return this.parsePropertyName(s),!t&&!c&&this.options.ecmaVersion>=8&&!i&&this.isAsyncProp(s)?(r=true,i=this.options.ecmaVersion>=9&&this.eat(f.star),this.parsePropertyName(s)):r=false,this.parsePropertyValue(s,t,i,r,a,o,e,c),this.finishNode(s,"Property")};he.parseGetterSetter=function(t){var e=t.key.name;this.parsePropertyName(t),t.value=this.parseMethod(false),t.kind=e;var s=t.kind==="get"?0:1;if(t.value.params.length!==s){var i=t.value.start;t.kind==="get"?this.raiseRecoverable(i,"getter should have no params"):this.raiseRecoverable(i,"setter should have exactly one param")}else t.kind==="set"&&t.value.params[0].type==="RestElement"&&this.raiseRecoverable(t.value.params[0].start,"Setter cannot use rest params")};he.parsePropertyValue=function(t,e,s,i,r,a,o,c){(s||i)&&this.type===f.colon&&this.unexpected(),this.eat(f.colon)?(t.value=e?this.parseMaybeDefault(this.start,this.startLoc):this.parseMaybeAssign(false,o),t.kind="init"):this.options.ecmaVersion>=6&&this.type===f.parenL?(e&&this.unexpected(),t.method=true,t.value=this.parseMethod(s,i),t.kind="init"):!e&&!c&&this.options.ecmaVersion>=5&&!t.computed&&t.key.type==="Identifier"&&(t.key.name==="get"||t.key.name==="set")&&this.type!==f.comma&&this.type!==f.braceR&&this.type!==f.eq?((s||i)&&this.unexpected(),this.parseGetterSetter(t)):this.options.ecmaVersion>=6&&!t.computed&&t.key.type==="Identifier"?((s||i)&&this.unexpected(),this.checkUnreserved(t.key),t.key.name==="await"&&!this.awaitIdentPos&&(this.awaitIdentPos=r),e?t.value=this.parseMaybeDefault(r,a,this.copyNode(t.key)):this.type===f.eq&&o?(o.shorthandAssign<0&&(o.shorthandAssign=this.start),t.value=this.parseMaybeDefault(r,a,this.copyNode(t.key))):t.value=this.copyNode(t.key),t.kind="init",t.shorthand=true):this.unexpected()};he.parsePropertyName=function(t){if(this.options.ecmaVersion>=6){if(this.eat(f.bracketL))return t.computed=true,t.key=this.parseMaybeAssign(),this.expect(f.bracketR),t.key;t.computed=false}return t.key=this.type===f.num||this.type===f.string?this.parseExprAtom():this.parseIdent(this.options.allowReserved!=="never")};he.initFunction=function(t){t.id=null,this.options.ecmaVersion>=6&&(t.generator=t.expression=false),this.options.ecmaVersion>=8&&(t.async=false)};he.parseMethod=function(t,e,s){var i=this.startNode(),r=this.yieldPos,a=this.awaitPos,o=this.awaitIdentPos;return this.initFunction(i),this.options.ecmaVersion>=6&&(i.generator=t),this.options.ecmaVersion>=8&&(i.async=!!e),this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(Ia(e,i.generator)|gr|(s?uu:0)),this.expect(f.parenL),i.params=this.parseBindingList(f.parenR,false,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams(),this.parseFunctionBody(i,false,true,false),this.yieldPos=r,this.awaitPos=a,this.awaitIdentPos=o,this.finishNode(i,"FunctionExpression")};he.parseArrowExpression=function(t,e,s,i){var r=this.yieldPos,a=this.awaitPos,o=this.awaitIdentPos;return this.enterScope(Ia(s,false)|Ca),this.initFunction(t),this.options.ecmaVersion>=8&&(t.async=!!s),this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,t.params=this.toAssignableList(e,true),this.parseFunctionBody(t,true,false,i),this.yieldPos=r,this.awaitPos=a,this.awaitIdentPos=o,this.finishNode(t,"ArrowFunctionExpression")};he.parseFunctionBody=function(t,e,s,i){var r=e&&this.type!==f.braceL,a=this.strict,o=false;if(r)t.body=this.parseMaybeAssign(i),t.expression=true,this.checkParams(t,false);else{var c=this.options.ecmaVersion>=7&&!this.isSimpleParamList(t.params);(!a||c)&&(o=this.strictDirective(this.end),o&&c&&this.raiseRecoverable(t.start,"Illegal 'use strict' directive in function with non-simple parameter list"));var l=this.labels;this.labels=[],o&&(this.strict=true),this.checkParams(t,!a&&!o&&!e&&!s&&this.isSimpleParamList(t.params)),this.strict&&t.id&&this.checkLValSimple(t.id,fu),t.body=this.parseBlock(false,void 0,o&&!a),t.expression=false,this.adaptDirectivePrologue(t.body.body),this.labels=l}this.exitScope()};he.isSimpleParamList=function(t){for(var e=0,s=t;e<s.length;e+=1){var i=s[e];if(i.type!=="Identifier")return false}return true};he.checkParams=function(t,e){for(var s=Object.create(null),i=0,r=t.params;i<r.length;i+=1){var a=r[i];this.checkLValInnerPattern(a,Ra,e?null:s)}};he.parseExprList=function(t,e,s,i){for(var r=[],a=true;!this.eat(t);){if(a)a=false;else if(this.expect(f.comma),e&&this.afterTrailingComma(t))break;var o=void 0;s&&this.type===f.comma?o=null:this.type===f.ellipsis?(o=this.parseSpread(i),i&&this.type===f.comma&&i.trailingComma<0&&(i.trailingComma=this.start)):o=this.parseMaybeAssign(false,i),r.push(o)}return r};he.checkUnreserved=function(t){var e=t.start,s=t.end,i=t.name;if(this.inGenerator&&i==="yield"&&this.raiseRecoverable(e,"Cannot use 'yield' as identifier inside a generator"),this.inAsync&&i==="await"&&this.raiseRecoverable(e,"Cannot use 'await' as identifier inside an async function"),!(this.currentThisScope().flags&br)&&i==="arguments"&&this.raiseRecoverable(e,"Cannot use 'arguments' in class field initializer"),this.inClassStaticBlock&&(i==="arguments"||i==="await")&&this.raise(e,"Cannot use "+i+" in class static initialization block"),this.keywords.test(i)&&this.raise(e,"Unexpected keyword '"+i+"'"),!(this.options.ecmaVersion<6&&this.input.slice(e,s).indexOf("\\")!==-1)){var r=this.strict?this.reservedWordsStrict:this.reservedWords;r.test(i)&&(!this.inAsync&&i==="await"&&this.raiseRecoverable(e,"Cannot use keyword 'await' outside an async function"),this.raiseRecoverable(e,"The keyword '"+i+"' is reserved"))}};he.parseIdent=function(t){var e=this.parseIdentNode();return this.next(!!t),this.finishNode(e,"Identifier"),t||(this.checkUnreserved(e),e.name==="await"&&!this.awaitIdentPos&&(this.awaitIdentPos=e.start)),e};he.parseIdentNode=function(){var t=this.startNode();return this.type===f.name?t.name=this.value:this.type.keyword?(t.name=this.type.keyword,(t.name==="class"||t.name==="function")&&(this.lastTokEnd!==this.lastTokStart+1||this.input.charCodeAt(this.lastTokStart)!==46)&&this.context.pop(),this.type=f.name):this.unexpected(),t};he.parsePrivateIdent=function(){var t=this.startNode();return this.type===f.privateId?t.name=this.value:this.unexpected(),this.next(),this.finishNode(t,"PrivateIdentifier"),this.options.checkPrivateFields&&(this.privateNameStack.length===0?this.raise(t.start,"Private field '#"+t.name+"' must be declared in an enclosing class"):this.privateNameStack[this.privateNameStack.length-1].used.push(t)),t};he.parseYield=function(t){this.yieldPos||(this.yieldPos=this.start);var e=this.startNode();return this.next(),this.type===f.semi||this.canInsertSemicolon()||this.type!==f.star&&!this.type.startsExpr?(e.delegate=false,e.argument=null):(e.delegate=this.eat(f.star),e.argument=this.parseMaybeAssign(t)),this.finishNode(e,"YieldExpression")};he.parseAwait=function(t){this.awaitPos||(this.awaitPos=this.start);var e=this.startNode();return this.next(),e.argument=this.parseMaybeUnary(null,true,false,t),this.finishNode(e,"AwaitExpression")};var Gi=Ne.prototype;Gi.raise=function(t,e){var s=au(this.input,t);e+=" ("+s.line+":"+s.column+")",this.sourceFile&&(e+=" in "+this.sourceFile);var i=new SyntaxError(e);throw i.pos=t,i.loc=s,i.raisedAt=this.pos,i};Gi.raiseRecoverable=Gi.raise;Gi.curPosition=function(){if(this.options.locations)return new ri(this.curLine,this.pos-this.lineStart)};var ls=Ne.prototype,Nh=function(e){this.flags=e,this.var=[],this.lexical=[],this.functions=[]};ls.enterScope=function(t){this.scopeStack.push(new Nh(t))};ls.exitScope=function(){this.scopeStack.pop()};ls.treatFunctionsAsVarInScope=function(t){return t.flags&$s||!this.inModule&&t.flags&ni};ls.declareName=function(t,e,s){var i=false;if(e===Kt){var r=this.currentScope();i=r.lexical.indexOf(t)>-1||r.functions.indexOf(t)>-1||r.var.indexOf(t)>-1,r.lexical.push(t),this.inModule&&r.flags&ni&&delete this.undefinedExports[t]}else if(e===hu){var a=this.currentScope();a.lexical.push(t)}else if(e===lu){var o=this.currentScope();this.treatFunctionsAsVar?i=o.lexical.indexOf(t)>-1:i=o.lexical.indexOf(t)>-1||o.var.indexOf(t)>-1,o.functions.push(t)}else for(var c=this.scopeStack.length-1;c>=0;--c){var l=this.scopeStack[c];if(l.lexical.indexOf(t)>-1&&!(l.flags&cu&&l.lexical[0]===t)||!this.treatFunctionsAsVarInScope(l)&&l.functions.indexOf(t)>-1){i=true;break}if(l.var.push(t),this.inModule&&l.flags&ni&&delete this.undefinedExports[t],l.flags&br)break}i&&this.raiseRecoverable(s,"Identifier '"+t+"' has already been declared")};ls.checkLocalExport=function(t){this.scopeStack[0].lexical.indexOf(t.name)===-1&&this.scopeStack[0].var.indexOf(t.name)===-1&&(this.undefinedExports[t.name]=t)};ls.currentScope=function(){return this.scopeStack[this.scopeStack.length-1]};ls.currentVarScope=function(){for(var t=this.scopeStack.length-1;;t--){var e=this.scopeStack[t];if(e.flags&(br|yi|ks))return e}};ls.currentThisScope=function(){for(var t=this.scopeStack.length-1;;t--){var e=this.scopeStack[t];if(e.flags&(br|yi|ks)&&!(e.flags&Ca))return e}};var _r=function(e,s,i){this.type="",this.start=s,this.end=0,e.options.locations&&(this.loc=new mr(e,i)),e.options.directSourceFile&&(this.sourceFile=e.options.directSourceFile),e.options.ranges&&(this.range=[s,0])},_i=Ne.prototype;_i.startNode=function(){return new _r(this,this.start,this.startLoc)};_i.startNodeAt=function(t,e){return new _r(this,t,e)};function mu(t,e,s,i){return t.type=e,t.end=s,this.options.locations&&(t.loc.end=i),this.options.ranges&&(t.range[1]=s),t}_i.finishNode=function(t,e){return mu.call(this,t,e,this.lastTokEnd,this.lastTokEndLoc)};_i.finishNodeAt=function(t,e,s,i){return mu.call(this,t,e,s,i)};_i.copyNode=function(t){var e=new _r(this,t.start,this.startLoc);for(var s in t)e[s]=t[s];return e};var Fh="Gara Garay Gukh Gurung_Khema Hrkt Katakana_Or_Hiragana Kawi Kirat_Rai Krai Nag_Mundari Nagm Ol_Onal Onao Sunu Sunuwar Todhri Todr Tulu_Tigalari Tutg Unknown Zzzz",gu="ASCII ASCII_Hex_Digit AHex Alphabetic Alpha Any Assigned Bidi_Control Bidi_C Bidi_Mirrored Bidi_M Case_Ignorable CI Cased Changes_When_Casefolded CWCF Changes_When_Casemapped CWCM Changes_When_Lowercased CWL Changes_When_NFKC_Casefolded CWKCF Changes_When_Titlecased CWT Changes_When_Uppercased CWU Dash Default_Ignorable_Code_Point DI Deprecated Dep Diacritic Dia Emoji Emoji_Component Emoji_Modifier Emoji_Modifier_Base Emoji_Presentation Extender Ext Grapheme_Base Gr_Base Grapheme_Extend Gr_Ext Hex_Digit Hex IDS_Binary_Operator IDSB IDS_Trinary_Operator IDST ID_Continue IDC ID_Start IDS Ideographic Ideo Join_Control Join_C Logical_Order_Exception LOE Lowercase Lower Math Noncharacter_Code_Point NChar Pattern_Syntax Pat_Syn Pattern_White_Space Pat_WS Quotation_Mark QMark Radical Regional_Indicator RI Sentence_Terminal STerm Soft_Dotted SD Terminal_Punctuation Term Unified_Ideograph UIdeo Uppercase Upper Variation_Selector VS White_Space space XID_Continue XIDC XID_Start XIDS",bu=gu+" Extended_Pictographic",yu=bu,_u=yu+" EBase EComp EMod EPres ExtPict",vu=_u,Uh=vu,Mh={9:gu,10:bu,11:yu,12:_u,13:vu,14:Uh},Bh="Basic_Emoji Emoji_Keycap_Sequence RGI_Emoji_Modifier_Sequence RGI_Emoji_Flag_Sequence RGI_Emoji_Tag_Sequence RGI_Emoji_ZWJ_Sequence RGI_Emoji",Oh={9:"",10:"",11:"",12:"",13:"",14:Bh},Vo="Cased_Letter LC Close_Punctuation Pe Connector_Punctuation Pc Control Cc cntrl Currency_Symbol Sc Dash_Punctuation Pd Decimal_Number Nd digit Enclosing_Mark Me Final_Punctuation Pf Format Cf Initial_Punctuation Pi Letter L Letter_Number Nl Line_Separator Zl Lowercase_Letter Ll Mark M Combining_Mark Math_Symbol Sm Modifier_Letter Lm Modifier_Symbol Sk Nonspacing_Mark Mn Number N Open_Punctuation Ps Other C Other_Letter Lo Other_Number No Other_Punctuation Po Other_Symbol So Paragraph_Separator Zp Private_Use Co Punctuation P punct Separator Z Space_Separator Zs Spacing_Mark Mc Surrogate Cs Symbol S Titlecase_Letter Lt Unassigned Cn Uppercase_Letter Lu",xu="Adlam Adlm Ahom Anatolian_Hieroglyphs Hluw Arabic Arab Armenian Armn Avestan Avst Balinese Bali Bamum Bamu Bassa_Vah Bass Batak Batk Bengali Beng Bhaiksuki Bhks Bopomofo Bopo Brahmi Brah Braille Brai Buginese Bugi Buhid Buhd Canadian_Aboriginal Cans Carian Cari Caucasian_Albanian Aghb Chakma Cakm Cham Cham Cherokee Cher Common Zyyy Coptic Copt Qaac Cuneiform Xsux Cypriot Cprt Cyrillic Cyrl Deseret Dsrt Devanagari Deva Duployan Dupl Egyptian_Hieroglyphs Egyp Elbasan Elba Ethiopic Ethi Georgian Geor Glagolitic Glag Gothic Goth Grantha Gran Greek Grek Gujarati Gujr Gurmukhi Guru Han Hani Hangul Hang Hanunoo Hano Hatran Hatr Hebrew Hebr Hiragana Hira Imperial_Aramaic Armi Inherited Zinh Qaai Inscriptional_Pahlavi Phli Inscriptional_Parthian Prti Javanese Java Kaithi Kthi Kannada Knda Katakana Kana Kayah_Li Kali Kharoshthi Khar Khmer Khmr Khojki Khoj Khudawadi Sind Lao Laoo Latin Latn Lepcha Lepc Limbu Limb Linear_A Lina Linear_B Linb Lisu Lisu Lycian Lyci Lydian Lydi Mahajani Mahj Malayalam Mlym Mandaic Mand Manichaean Mani Marchen Marc Masaram_Gondi Gonm Meetei_Mayek Mtei Mende_Kikakui Mend Meroitic_Cursive Merc Meroitic_Hieroglyphs Mero Miao Plrd Modi Mongolian Mong Mro Mroo Multani Mult Myanmar Mymr Nabataean Nbat New_Tai_Lue Talu Newa Newa Nko Nkoo Nushu Nshu Ogham Ogam Ol_Chiki Olck Old_Hungarian Hung Old_Italic Ital Old_North_Arabian Narb Old_Permic Perm Old_Persian Xpeo Old_South_Arabian Sarb Old_Turkic Orkh Oriya Orya Osage Osge Osmanya Osma Pahawh_Hmong Hmng Palmyrene Palm Pau_Cin_Hau Pauc Phags_Pa Phag Phoenician Phnx Psalter_Pahlavi Phlp Rejang Rjng Runic Runr Samaritan Samr Saurashtra Saur Sharada Shrd Shavian Shaw Siddham Sidd SignWriting Sgnw Sinhala Sinh Sora_Sompeng Sora Soyombo Soyo Sundanese Sund Syloti_Nagri Sylo Syriac Syrc Tagalog Tglg Tagbanwa Tagb Tai_Le Tale Tai_Tham Lana Tai_Viet Tavt Takri Takr Tamil Taml Tangut Tang Telugu Telu Thaana Thaa Thai Thai Tibetan Tibt Tifinagh Tfng Tirhuta Tirh Ugaritic Ugar Vai Vaii Warang_Citi Wara Yi Yiii Zanabazar_Square Zanb",ku=xu+" Dogra Dogr Gunjala_Gondi Gong Hanifi_Rohingya Rohg Makasar Maka Medefaidrin Medf Old_Sogdian Sogo Sogdian Sogd",wu=ku+" Elymaic Elym Nandinagari Nand Nyiakeng_Puachue_Hmong Hmnp Wancho Wcho",Su=wu+" Chorasmian Chrs Diak Dives_Akuru Khitan_Small_Script Kits Yezi Yezidi",Eu=Su+" Cypro_Minoan Cpmn Old_Uyghur Ougr Tangsa Tnsa Toto Vithkuqi Vith",Vh=Eu+" "+Fh,$h={9:xu,10:ku,11:wu,12:Su,13:Eu,14:Vh},Tu={};function jh(t){var e=Tu[t]={binary:es(Mh[t]+" "+Vo),binaryOfStrings:es(Oh[t]),nonBinary:{General_Category:es(Vo),Script:es($h[t])}};e.nonBinary.Script_Extensions=e.nonBinary.Script,e.nonBinary.gc=e.nonBinary.General_Category,e.nonBinary.sc=e.nonBinary.Script,e.nonBinary.scx=e.nonBinary.Script_Extensions}for(var Pn=0,$o=[9,10,11,12,13,14];Pn<$o.length;Pn+=1){var qh=$o[Pn];jh(qh)}var Y=Ne.prototype,Wi=function(e,s){this.parent=e,this.base=s||this};Wi.prototype.separatedFrom=function(e){for(var s=this;s;s=s.parent)for(var i=e;i;i=i.parent)if(s.base===i.base&&s!==i)return true;return false};Wi.prototype.sibling=function(){return new Wi(this.parent,this.base)};var Bt=function(e){this.parser=e,this.validFlags="gim"+(e.options.ecmaVersion>=6?"uy":"")+(e.options.ecmaVersion>=9?"s":"")+(e.options.ecmaVersion>=13?"d":"")+(e.options.ecmaVersion>=15?"v":""),this.unicodeProperties=Tu[e.options.ecmaVersion>=14?14:e.options.ecmaVersion],this.source="",this.flags="",this.start=0,this.switchU=false,this.switchV=false,this.switchN=false,this.pos=0,this.lastIntValue=0,this.lastStringValue="",this.lastAssertionIsQuantifiable=false,this.numCapturingParens=0,this.maxBackReference=0,this.groupNames=Object.create(null),this.backReferenceNames=[],this.branchID=null};Bt.prototype.reset=function(e,s,i){var r=i.indexOf("v")!==-1,a=i.indexOf("u")!==-1;this.start=e|0,this.source=s+"",this.flags=i,r&&this.parser.options.ecmaVersion>=15?(this.switchU=true,this.switchV=true,this.switchN=true):(this.switchU=a&&this.parser.options.ecmaVersion>=6,this.switchV=false,this.switchN=a&&this.parser.options.ecmaVersion>=9)};Bt.prototype.raise=function(e){this.parser.raiseRecoverable(this.start,"Invalid regular expression: /"+this.source+"/: "+e)};Bt.prototype.at=function(e,s){s===void 0&&(s=false);var i=this.source,r=i.length;if(e>=r)return-1;var a=i.charCodeAt(e);if(!(s||this.switchU)||a<=55295||a>=57344||e+1>=r)return a;var o=i.charCodeAt(e+1);return o>=56320&&o<=57343?(a<<10)+o-56613888:a};Bt.prototype.nextIndex=function(e,s){s===void 0&&(s=false);var i=this.source,r=i.length;if(e>=r)return r;var a=i.charCodeAt(e),o;return!(s||this.switchU)||a<=55295||a>=57344||e+1>=r||(o=i.charCodeAt(e+1))<56320||o>57343?e+1:e+2};Bt.prototype.current=function(e){return e===void 0&&(e=false),this.at(this.pos,e)};Bt.prototype.lookahead=function(e){return e===void 0&&(e=false),this.at(this.nextIndex(this.pos,e),e)};Bt.prototype.advance=function(e){e===void 0&&(e=false),this.pos=this.nextIndex(this.pos,e)};Bt.prototype.eat=function(e,s){return s===void 0&&(s=false),this.current(s)===e?(this.advance(s),true):false};Bt.prototype.eatChars=function(e,s){s===void 0&&(s=false);for(var i=this.pos,r=0,a=e;r<a.length;r+=1){var o=a[r],c=this.at(i,s);if(c===-1||c!==o)return false;i=this.nextIndex(i,s)}return this.pos=i,true};Y.validateRegExpFlags=function(t){for(var e=t.validFlags,s=t.flags,i=false,r=false,a=0;a<s.length;a++){var o=s.charAt(a);e.indexOf(o)===-1&&this.raise(t.start,"Invalid regular expression flag"),s.indexOf(o,a+1)>-1&&this.raise(t.start,"Duplicate regular expression flag"),o==="u"&&(i=true),o==="v"&&(r=true)}this.options.ecmaVersion>=15&&i&&r&&this.raise(t.start,"Invalid regular expression flag")};function Hh(t){for(var e in t)return true;return false}Y.validateRegExpPattern=function(t){this.regexp_pattern(t),!t.switchN&&this.options.ecmaVersion>=9&&Hh(t.groupNames)&&(t.switchN=true,this.regexp_pattern(t))};Y.regexp_pattern=function(t){t.pos=0,t.lastIntValue=0,t.lastStringValue="",t.lastAssertionIsQuantifiable=false,t.numCapturingParens=0,t.maxBackReference=0,t.groupNames=Object.create(null),t.backReferenceNames.length=0,t.branchID=null,this.regexp_disjunction(t),t.pos!==t.source.length&&(t.eat(41)&&t.raise("Unmatched ')'"),(t.eat(93)||t.eat(125))&&t.raise("Lone quantifier brackets")),t.maxBackReference>t.numCapturingParens&&t.raise("Invalid escape");for(var e=0,s=t.backReferenceNames;e<s.length;e+=1){var i=s[e];t.groupNames[i]||t.raise("Invalid named capture referenced")}};Y.regexp_disjunction=function(t){var e=this.options.ecmaVersion>=16;for(e&&(t.branchID=new Wi(t.branchID,null)),this.regexp_alternative(t);t.eat(124);)e&&(t.branchID=t.branchID.sibling()),this.regexp_alternative(t);e&&(t.branchID=t.branchID.parent),this.regexp_eatQuantifier(t,true)&&t.raise("Nothing to repeat"),t.eat(123)&&t.raise("Lone quantifier brackets")};Y.regexp_alternative=function(t){for(;t.pos<t.source.length&&this.regexp_eatTerm(t););};Y.regexp_eatTerm=function(t){return this.regexp_eatAssertion(t)?(t.lastAssertionIsQuantifiable&&this.regexp_eatQuantifier(t)&&t.switchU&&t.raise("Invalid quantifier"),true):(t.switchU?this.regexp_eatAtom(t):this.regexp_eatExtendedAtom(t))?(this.regexp_eatQuantifier(t),true):false};Y.regexp_eatAssertion=function(t){var e=t.pos;if(t.lastAssertionIsQuantifiable=false,t.eat(94)||t.eat(36))return true;if(t.eat(92)){if(t.eat(66)||t.eat(98))return true;t.pos=e}if(t.eat(40)&&t.eat(63)){var s=false;if(this.options.ecmaVersion>=9&&(s=t.eat(60)),t.eat(61)||t.eat(33))return this.regexp_disjunction(t),t.eat(41)||t.raise("Unterminated group"),t.lastAssertionIsQuantifiable=!s,true}return t.pos=e,false};Y.regexp_eatQuantifier=function(t,e){return e===void 0&&(e=false),this.regexp_eatQuantifierPrefix(t,e)?(t.eat(63),true):false};Y.regexp_eatQuantifierPrefix=function(t,e){return t.eat(42)||t.eat(43)||t.eat(63)||this.regexp_eatBracedQuantifier(t,e)};Y.regexp_eatBracedQuantifier=function(t,e){var s=t.pos;if(t.eat(123)){var i=0,r=-1;if(this.regexp_eatDecimalDigits(t)&&(i=t.lastIntValue,t.eat(44)&&this.regexp_eatDecimalDigits(t)&&(r=t.lastIntValue),t.eat(125)))return r!==-1&&r<i&&!e&&t.raise("numbers out of order in {} quantifier"),true;t.switchU&&!e&&t.raise("Incomplete quantifier"),t.pos=s}return false};Y.regexp_eatAtom=function(t){return this.regexp_eatPatternCharacters(t)||t.eat(46)||this.regexp_eatReverseSolidusAtomEscape(t)||this.regexp_eatCharacterClass(t)||this.regexp_eatUncapturingGroup(t)||this.regexp_eatCapturingGroup(t)};Y.regexp_eatReverseSolidusAtomEscape=function(t){var e=t.pos;if(t.eat(92)){if(this.regexp_eatAtomEscape(t))return true;t.pos=e}return false};Y.regexp_eatUncapturingGroup=function(t){var e=t.pos;if(t.eat(40)){if(t.eat(63)){if(this.options.ecmaVersion>=16){var s=this.regexp_eatModifiers(t),i=t.eat(45);if(s||i){for(var r=0;r<s.length;r++){var a=s.charAt(r);s.indexOf(a,r+1)>-1&&t.raise("Duplicate regular expression modifiers")}if(i){var o=this.regexp_eatModifiers(t);!s&&!o&&t.current()===58&&t.raise("Invalid regular expression modifiers");for(var c=0;c<o.length;c++){var l=o.charAt(c);(o.indexOf(l,c+1)>-1||s.indexOf(l)>-1)&&t.raise("Duplicate regular expression modifiers")}}}}if(t.eat(58)){if(this.regexp_disjunction(t),t.eat(41))return true;t.raise("Unterminated group")}}t.pos=e}return false};Y.regexp_eatCapturingGroup=function(t){if(t.eat(40)){if(this.options.ecmaVersion>=9?this.regexp_groupSpecifier(t):t.current()===63&&t.raise("Invalid group"),this.regexp_disjunction(t),t.eat(41))return t.numCapturingParens+=1,true;t.raise("Unterminated group")}return false};Y.regexp_eatModifiers=function(t){for(var e="",s=0;(s=t.current())!==-1&&Gh(s);)e+=Wt(s),t.advance();return e};function Gh(t){return t===105||t===109||t===115}Y.regexp_eatExtendedAtom=function(t){return t.eat(46)||this.regexp_eatReverseSolidusAtomEscape(t)||this.regexp_eatCharacterClass(t)||this.regexp_eatUncapturingGroup(t)||this.regexp_eatCapturingGroup(t)||this.regexp_eatInvalidBracedQuantifier(t)||this.regexp_eatExtendedPatternCharacter(t)};Y.regexp_eatInvalidBracedQuantifier=function(t){return this.regexp_eatBracedQuantifier(t,true)&&t.raise("Nothing to repeat"),false};Y.regexp_eatSyntaxCharacter=function(t){var e=t.current();return Au(e)?(t.lastIntValue=e,t.advance(),true):false};function Au(t){return t===36||t>=40&&t<=43||t===46||t===63||t>=91&&t<=94||t>=123&&t<=125}Y.regexp_eatPatternCharacters=function(t){for(var e=t.pos,s=0;(s=t.current())!==-1&&!Au(s);)t.advance();return t.pos!==e};Y.regexp_eatExtendedPatternCharacter=function(t){var e=t.current();return e!==-1&&e!==36&&!(e>=40&&e<=43)&&e!==46&&e!==63&&e!==91&&e!==94&&e!==124?(t.advance(),true):false};Y.regexp_groupSpecifier=function(t){if(t.eat(63)){this.regexp_eatGroupName(t)||t.raise("Invalid group");var e=this.options.ecmaVersion>=16,s=t.groupNames[t.lastStringValue];if(s)if(e)for(var i=0,r=s;i<r.length;i+=1){var a=r[i];a.separatedFrom(t.branchID)||t.raise("Duplicate capture group name")}else t.raise("Duplicate capture group name");e?(s||(t.groupNames[t.lastStringValue]=[])).push(t.branchID):t.groupNames[t.lastStringValue]=true}};Y.regexp_eatGroupName=function(t){if(t.lastStringValue="",t.eat(60)){if(this.regexp_eatRegExpIdentifierName(t)&&t.eat(62))return true;t.raise("Invalid capture group name")}return false};Y.regexp_eatRegExpIdentifierName=function(t){if(t.lastStringValue="",this.regexp_eatRegExpIdentifierStart(t)){for(t.lastStringValue+=Wt(t.lastIntValue);this.regexp_eatRegExpIdentifierPart(t);)t.lastStringValue+=Wt(t.lastIntValue);return true}return false};Y.regexp_eatRegExpIdentifierStart=function(t){var e=t.pos,s=this.options.ecmaVersion>=11,i=t.current(s);return t.advance(s),i===92&&this.regexp_eatRegExpUnicodeEscapeSequence(t,s)&&(i=t.lastIntValue),Wh(i)?(t.lastIntValue=i,true):(t.pos=e,false)};function Wh(t){return Nt(t,true)||t===36||t===95}Y.regexp_eatRegExpIdentifierPart=function(t){var e=t.pos,s=this.options.ecmaVersion>=11,i=t.current(s);return t.advance(s),i===92&&this.regexp_eatRegExpUnicodeEscapeSequence(t,s)&&(i=t.lastIntValue),Xh(i)?(t.lastIntValue=i,true):(t.pos=e,false)};function Xh(t){return cs(t,true)||t===36||t===95||t===8204||t===8205}Y.regexp_eatAtomEscape=function(t){return this.regexp_eatBackReference(t)||this.regexp_eatCharacterClassEscape(t)||this.regexp_eatCharacterEscape(t)||t.switchN&&this.regexp_eatKGroupName(t)?true:(t.switchU&&(t.current()===99&&t.raise("Invalid unicode escape"),t.raise("Invalid escape")),false)};Y.regexp_eatBackReference=function(t){var e=t.pos;if(this.regexp_eatDecimalEscape(t)){var s=t.lastIntValue;if(t.switchU)return s>t.maxBackReference&&(t.maxBackReference=s),true;if(s<=t.numCapturingParens)return true;t.pos=e}return false};Y.regexp_eatKGroupName=function(t){if(t.eat(107)){if(this.regexp_eatGroupName(t))return t.backReferenceNames.push(t.lastStringValue),true;t.raise("Invalid named reference")}return false};Y.regexp_eatCharacterEscape=function(t){return this.regexp_eatControlEscape(t)||this.regexp_eatCControlLetter(t)||this.regexp_eatZero(t)||this.regexp_eatHexEscapeSequence(t)||this.regexp_eatRegExpUnicodeEscapeSequence(t,false)||!t.switchU&&this.regexp_eatLegacyOctalEscapeSequence(t)||this.regexp_eatIdentityEscape(t)};Y.regexp_eatCControlLetter=function(t){var e=t.pos;if(t.eat(99)){if(this.regexp_eatControlLetter(t))return true;t.pos=e}return false};Y.regexp_eatZero=function(t){return t.current()===48&&!vr(t.lookahead())?(t.lastIntValue=0,t.advance(),true):false};Y.regexp_eatControlEscape=function(t){var e=t.current();return e===116?(t.lastIntValue=9,t.advance(),true):e===110?(t.lastIntValue=10,t.advance(),true):e===118?(t.lastIntValue=11,t.advance(),true):e===102?(t.lastIntValue=12,t.advance(),true):e===114?(t.lastIntValue=13,t.advance(),true):false};Y.regexp_eatControlLetter=function(t){var e=t.current();return Cu(e)?(t.lastIntValue=e%32,t.advance(),true):false};function Cu(t){return t>=65&&t<=90||t>=97&&t<=122}Y.regexp_eatRegExpUnicodeEscapeSequence=function(t,e){e===void 0&&(e=false);var s=t.pos,i=e||t.switchU;if(t.eat(117)){if(this.regexp_eatFixedHexDigits(t,4)){var r=t.lastIntValue;if(i&&r>=55296&&r<=56319){var a=t.pos;if(t.eat(92)&&t.eat(117)&&this.regexp_eatFixedHexDigits(t,4)){var o=t.lastIntValue;if(o>=56320&&o<=57343)return t.lastIntValue=(r-55296)*1024+(o-56320)+65536,true}t.pos=a,t.lastIntValue=r}return true}if(i&&t.eat(123)&&this.regexp_eatHexDigits(t)&&t.eat(125)&&zh(t.lastIntValue))return true;i&&t.raise("Invalid unicode escape"),t.pos=s}return false};function zh(t){return t>=0&&t<=1114111}Y.regexp_eatIdentityEscape=function(t){if(t.switchU)return this.regexp_eatSyntaxCharacter(t)?true:t.eat(47)?(t.lastIntValue=47,true):false;var e=t.current();return e!==99&&(!t.switchN||e!==107)?(t.lastIntValue=e,t.advance(),true):false};Y.regexp_eatDecimalEscape=function(t){t.lastIntValue=0;var e=t.current();if(e>=49&&e<=57){do t.lastIntValue=10*t.lastIntValue+(e-48),t.advance();while((e=t.current())>=48&&e<=57);return true}return false};var Iu=0,Xt=1,ut=2;Y.regexp_eatCharacterClassEscape=function(t){var e=t.current();if(Yh(e))return t.lastIntValue=-1,t.advance(),Xt;var s=false;if(t.switchU&&this.options.ecmaVersion>=9&&((s=e===80)||e===112)){t.lastIntValue=-1,t.advance();var i;if(t.eat(123)&&(i=this.regexp_eatUnicodePropertyValueExpression(t))&&t.eat(125))return s&&i===ut&&t.raise("Invalid property name"),i;t.raise("Invalid property name")}return Iu};function Yh(t){return t===100||t===68||t===115||t===83||t===119||t===87}Y.regexp_eatUnicodePropertyValueExpression=function(t){var e=t.pos;if(this.regexp_eatUnicodePropertyName(t)&&t.eat(61)){var s=t.lastStringValue;if(this.regexp_eatUnicodePropertyValue(t)){var i=t.lastStringValue;return this.regexp_validateUnicodePropertyNameAndValue(t,s,i),Xt}}if(t.pos=e,this.regexp_eatLoneUnicodePropertyNameOrValue(t)){var r=t.lastStringValue;return this.regexp_validateUnicodePropertyNameOrValue(t,r)}return Iu};Y.regexp_validateUnicodePropertyNameAndValue=function(t,e,s){Vs(t.unicodeProperties.nonBinary,e)||t.raise("Invalid property name"),t.unicodeProperties.nonBinary[e].test(s)||t.raise("Invalid property value")};Y.regexp_validateUnicodePropertyNameOrValue=function(t,e){if(t.unicodeProperties.binary.test(e))return Xt;if(t.switchV&&t.unicodeProperties.binaryOfStrings.test(e))return ut;t.raise("Invalid property name")};Y.regexp_eatUnicodePropertyName=function(t){var e=0;for(t.lastStringValue="";Ru(e=t.current());)t.lastStringValue+=Wt(e),t.advance();return t.lastStringValue!==""};function Ru(t){return Cu(t)||t===95}Y.regexp_eatUnicodePropertyValue=function(t){var e=0;for(t.lastStringValue="";Kh(e=t.current());)t.lastStringValue+=Wt(e),t.advance();return t.lastStringValue!==""};function Kh(t){return Ru(t)||vr(t)}Y.regexp_eatLoneUnicodePropertyNameOrValue=function(t){return this.regexp_eatUnicodePropertyValue(t)};Y.regexp_eatCharacterClass=function(t){if(t.eat(91)){var e=t.eat(94),s=this.regexp_classContents(t);return t.eat(93)||t.raise("Unterminated character class"),e&&s===ut&&t.raise("Negated character class may contain strings"),true}return false};Y.regexp_classContents=function(t){return t.current()===93?Xt:t.switchV?this.regexp_classSetExpression(t):(this.regexp_nonEmptyClassRanges(t),Xt)};Y.regexp_nonEmptyClassRanges=function(t){for(;this.regexp_eatClassAtom(t);){var e=t.lastIntValue;if(t.eat(45)&&this.regexp_eatClassAtom(t)){var s=t.lastIntValue;t.switchU&&(e===-1||s===-1)&&t.raise("Invalid character class"),e!==-1&&s!==-1&&e>s&&t.raise("Range out of order in character class")}}};Y.regexp_eatClassAtom=function(t){var e=t.pos;if(t.eat(92)){if(this.regexp_eatClassEscape(t))return true;if(t.switchU){var s=t.current();(s===99||Du(s))&&t.raise("Invalid class escape"),t.raise("Invalid escape")}t.pos=e}var i=t.current();return i!==93?(t.lastIntValue=i,t.advance(),true):false};Y.regexp_eatClassEscape=function(t){var e=t.pos;if(t.eat(98))return t.lastIntValue=8,true;if(t.switchU&&t.eat(45))return t.lastIntValue=45,true;if(!t.switchU&&t.eat(99)){if(this.regexp_eatClassControlLetter(t))return true;t.pos=e}return this.regexp_eatCharacterClassEscape(t)||this.regexp_eatCharacterEscape(t)};Y.regexp_classSetExpression=function(t){var e=Xt,s;if(!this.regexp_eatClassSetRange(t))if(s=this.regexp_eatClassSetOperand(t)){s===ut&&(e=ut);for(var i=t.pos;t.eatChars([38,38]);){if(t.current()!==38&&(s=this.regexp_eatClassSetOperand(t))){s!==ut&&(e=Xt);continue}t.raise("Invalid character in character class")}if(i!==t.pos)return e;for(;t.eatChars([45,45]);)this.regexp_eatClassSetOperand(t)||t.raise("Invalid character in character class");if(i!==t.pos)return e}else t.raise("Invalid character in character class");for(;;)if(!this.regexp_eatClassSetRange(t)){if(s=this.regexp_eatClassSetOperand(t),!s)return e;s===ut&&(e=ut)}};Y.regexp_eatClassSetRange=function(t){var e=t.pos;if(this.regexp_eatClassSetCharacter(t)){var s=t.lastIntValue;if(t.eat(45)&&this.regexp_eatClassSetCharacter(t)){var i=t.lastIntValue;return s!==-1&&i!==-1&&s>i&&t.raise("Range out of order in character class"),true}t.pos=e}return false};Y.regexp_eatClassSetOperand=function(t){return this.regexp_eatClassSetCharacter(t)?Xt:this.regexp_eatClassStringDisjunction(t)||this.regexp_eatNestedClass(t)};Y.regexp_eatNestedClass=function(t){var e=t.pos;if(t.eat(91)){var s=t.eat(94),i=this.regexp_classContents(t);if(t.eat(93))return s&&i===ut&&t.raise("Negated character class may contain strings"),i;t.pos=e}if(t.eat(92)){var r=this.regexp_eatCharacterClassEscape(t);if(r)return r;t.pos=e}return null};Y.regexp_eatClassStringDisjunction=function(t){var e=t.pos;if(t.eatChars([92,113])){if(t.eat(123)){var s=this.regexp_classStringDisjunctionContents(t);if(t.eat(125))return s}else t.raise("Invalid escape");t.pos=e}return null};Y.regexp_classStringDisjunctionContents=function(t){for(var e=this.regexp_classString(t);t.eat(124);)this.regexp_classString(t)===ut&&(e=ut);return e};Y.regexp_classString=function(t){for(var e=0;this.regexp_eatClassSetCharacter(t);)e++;return e===1?Xt:ut};Y.regexp_eatClassSetCharacter=function(t){var e=t.pos;if(t.eat(92))return this.regexp_eatCharacterEscape(t)||this.regexp_eatClassSetReservedPunctuator(t)?true:t.eat(98)?(t.lastIntValue=8,true):(t.pos=e,false);var s=t.current();return s<0||s===t.lookahead()&&Zh(s)||Qh(s)?false:(t.advance(),t.lastIntValue=s,true)};function Zh(t){return t===33||t>=35&&t<=38||t>=42&&t<=44||t===46||t>=58&&t<=64||t===94||t===96||t===126}function Qh(t){return t===40||t===41||t===45||t===47||t>=91&&t<=93||t>=123&&t<=125}Y.regexp_eatClassSetReservedPunctuator=function(t){var e=t.current();return Jh(e)?(t.lastIntValue=e,t.advance(),true):false};function Jh(t){return t===33||t===35||t===37||t===38||t===44||t===45||t>=58&&t<=62||t===64||t===96||t===126}Y.regexp_eatClassControlLetter=function(t){var e=t.current();return vr(e)||e===95?(t.lastIntValue=e%32,t.advance(),true):false};Y.regexp_eatHexEscapeSequence=function(t){var e=t.pos;if(t.eat(120)){if(this.regexp_eatFixedHexDigits(t,2))return true;t.switchU&&t.raise("Invalid escape"),t.pos=e}return false};Y.regexp_eatDecimalDigits=function(t){var e=t.pos,s=0;for(t.lastIntValue=0;vr(s=t.current());)t.lastIntValue=10*t.lastIntValue+(s-48),t.advance();return t.pos!==e};function vr(t){return t>=48&&t<=57}Y.regexp_eatHexDigits=function(t){var e=t.pos,s=0;for(t.lastIntValue=0;Pu(s=t.current());)t.lastIntValue=16*t.lastIntValue+Lu(s),t.advance();return t.pos!==e};function Pu(t){return t>=48&&t<=57||t>=65&&t<=70||t>=97&&t<=102}function Lu(t){return t>=65&&t<=70?10+(t-65):t>=97&&t<=102?10+(t-97):t-48}Y.regexp_eatLegacyOctalEscapeSequence=function(t){if(this.regexp_eatOctalDigit(t)){var e=t.lastIntValue;if(this.regexp_eatOctalDigit(t)){var s=t.lastIntValue;e<=3&&this.regexp_eatOctalDigit(t)?t.lastIntValue=e*64+s*8+t.lastIntValue:t.lastIntValue=e*8+s}else t.lastIntValue=e;return true}return false};Y.regexp_eatOctalDigit=function(t){var e=t.current();return Du(e)?(t.lastIntValue=e-48,t.advance(),true):(t.lastIntValue=0,false)};function Du(t){return t>=48&&t<=55}Y.regexp_eatFixedHexDigits=function(t,e){var s=t.pos;t.lastIntValue=0;for(var i=0;i<e;++i){var r=t.current();if(!Pu(r))return t.pos=s,false;t.lastIntValue=16*t.lastIntValue+Lu(r),t.advance()}return true};var La=function(e){this.type=e.type,this.value=e.value,this.start=e.start,this.end=e.end,e.options.locations&&(this.loc=new mr(e,e.startLoc,e.endLoc)),e.options.ranges&&(this.range=[e.start,e.end])},ge=Ne.prototype;ge.next=function(t){!t&&this.type.keyword&&this.containsEsc&&this.raiseRecoverable(this.start,"Escape sequence in keyword "+this.type.keyword),this.options.onToken&&this.options.onToken(new La(this)),this.lastTokEnd=this.end,this.lastTokStart=this.start,this.lastTokEndLoc=this.endLoc,this.lastTokStartLoc=this.startLoc,this.nextToken()};ge.getToken=function(){return this.next(),new La(this)};typeof Symbol<"u"&&(ge[Symbol.iterator]=function(){var t=this;return{next:function(){var e=t.getToken();return{done:e.type===f.eof,value:e}}}});ge.nextToken=function(){var t=this.curContext();if((!t||!t.preserveSpace)&&this.skipSpace(),this.start=this.pos,this.options.locations&&(this.startLoc=this.curPosition()),this.pos>=this.input.length)return this.finishToken(f.eof);if(t.override)return t.override(this);this.readToken(this.fullCharCodeAtPos())};ge.readToken=function(t){return Nt(t,this.options.ecmaVersion>=6)||t===92?this.readWord():this.getTokenFromCode(t)};ge.fullCharCodeAtPos=function(){var t=this.input.charCodeAt(this.pos);if(t<=55295||t>=56320)return t;var e=this.input.charCodeAt(this.pos+1);return e<=56319||e>=57344?t:(t<<10)+e-56613888};ge.skipBlockComment=function(){var t=this.options.onComment&&this.curPosition(),e=this.pos,s=this.input.indexOf("*/",this.pos+=2);if(s===-1&&this.raise(this.pos-2,"Unterminated comment"),this.pos=s+2,this.options.locations)for(var i=void 0,r=e;(i=iu(this.input,r,this.pos))>-1;)++this.curLine,r=this.lineStart=i;this.options.onComment&&this.options.onComment(true,this.input.slice(e+2,s),e,this.pos,t,this.curPosition())};ge.skipLineComment=function(t){for(var e=this.pos,s=this.options.onComment&&this.curPosition(),i=this.input.charCodeAt(this.pos+=t);this.pos<this.input.length&&!Os(i);)i=this.input.charCodeAt(++this.pos);this.options.onComment&&this.options.onComment(false,this.input.slice(e+t,this.pos),e,this.pos,s,this.curPosition())};ge.skipSpace=function(){e:for(;this.pos<this.input.length;){var t=this.input.charCodeAt(this.pos);switch(t){case 32:case 160:++this.pos;break;case 13:this.input.charCodeAt(this.pos+1)===10&&++this.pos;case 10:case 8232:case 8233:++this.pos,this.options.locations&&(++this.curLine,this.lineStart=this.pos);break;case 47:switch(this.input.charCodeAt(this.pos+1)){case 42:this.skipBlockComment();break;case 47:this.skipLineComment(2);break;default:break e}break;default:if(t>8&&t<14||t>=5760&&ru.test(String.fromCharCode(t)))++this.pos;else break e}}};ge.finishToken=function(t,e){this.end=this.pos,this.options.locations&&(this.endLoc=this.curPosition());var s=this.type;this.type=t,this.value=e,this.updateContext(s)};ge.readToken_dot=function(){var t=this.input.charCodeAt(this.pos+1);if(t>=48&&t<=57)return this.readNumber(true);var e=this.input.charCodeAt(this.pos+2);return this.options.ecmaVersion>=6&&t===46&&e===46?(this.pos+=3,this.finishToken(f.ellipsis)):(++this.pos,this.finishToken(f.dot))};ge.readToken_slash=function(){var t=this.input.charCodeAt(this.pos+1);return this.exprAllowed?(++this.pos,this.readRegexp()):t===61?this.finishOp(f.assign,2):this.finishOp(f.slash,1)};ge.readToken_mult_modulo_exp=function(t){var e=this.input.charCodeAt(this.pos+1),s=1,i=t===42?f.star:f.modulo;return this.options.ecmaVersion>=7&&t===42&&e===42&&(++s,i=f.starstar,e=this.input.charCodeAt(this.pos+2)),e===61?this.finishOp(f.assign,s+1):this.finishOp(i,s)};ge.readToken_pipe_amp=function(t){var e=this.input.charCodeAt(this.pos+1);if(e===t){if(this.options.ecmaVersion>=12){var s=this.input.charCodeAt(this.pos+2);if(s===61)return this.finishOp(f.assign,3)}return this.finishOp(t===124?f.logicalOR:f.logicalAND,2)}return e===61?this.finishOp(f.assign,2):this.finishOp(t===124?f.bitwiseOR:f.bitwiseAND,1)};ge.readToken_caret=function(){var t=this.input.charCodeAt(this.pos+1);return t===61?this.finishOp(f.assign,2):this.finishOp(f.bitwiseXOR,1)};ge.readToken_plus_min=function(t){var e=this.input.charCodeAt(this.pos+1);return e===t?e===45&&!this.inModule&&this.input.charCodeAt(this.pos+2)===62&&(this.lastTokEnd===0||st.test(this.input.slice(this.lastTokEnd,this.pos)))?(this.skipLineComment(3),this.skipSpace(),this.nextToken()):this.finishOp(f.incDec,2):e===61?this.finishOp(f.assign,2):this.finishOp(f.plusMin,1)};ge.readToken_lt_gt=function(t){var e=this.input.charCodeAt(this.pos+1),s=1;return e===t?(s=t===62&&this.input.charCodeAt(this.pos+2)===62?3:2,this.input.charCodeAt(this.pos+s)===61?this.finishOp(f.assign,s+1):this.finishOp(f.bitShift,s)):e===33&&t===60&&!this.inModule&&this.input.charCodeAt(this.pos+2)===45&&this.input.charCodeAt(this.pos+3)===45?(this.skipLineComment(4),this.skipSpace(),this.nextToken()):(e===61&&(s=2),this.finishOp(f.relational,s))};ge.readToken_eq_excl=function(t){var e=this.input.charCodeAt(this.pos+1);return e===61?this.finishOp(f.equality,this.input.charCodeAt(this.pos+2)===61?3:2):t===61&&e===62&&this.options.ecmaVersion>=6?(this.pos+=2,this.finishToken(f.arrow)):this.finishOp(t===61?f.eq:f.prefix,1)};ge.readToken_question=function(){var t=this.options.ecmaVersion;if(t>=11){var e=this.input.charCodeAt(this.pos+1);if(e===46){var s=this.input.charCodeAt(this.pos+2);if(s<48||s>57)return this.finishOp(f.questionDot,2)}if(e===63){if(t>=12){var i=this.input.charCodeAt(this.pos+2);if(i===61)return this.finishOp(f.assign,3)}return this.finishOp(f.coalesce,2)}}return this.finishOp(f.question,1)};ge.readToken_numberSign=function(){var t=this.options.ecmaVersion,e=35;if(t>=13&&(++this.pos,e=this.fullCharCodeAtPos(),Nt(e,true)||e===92))return this.finishToken(f.privateId,this.readWord1());this.raise(this.pos,"Unexpected character '"+Wt(e)+"'")};ge.getTokenFromCode=function(t){switch(t){case 46:return this.readToken_dot();case 40:return++this.pos,this.finishToken(f.parenL);case 41:return++this.pos,this.finishToken(f.parenR);case 59:return++this.pos,this.finishToken(f.semi);case 44:return++this.pos,this.finishToken(f.comma);case 91:return++this.pos,this.finishToken(f.bracketL);case 93:return++this.pos,this.finishToken(f.bracketR);case 123:return++this.pos,this.finishToken(f.braceL);case 125:return++this.pos,this.finishToken(f.braceR);case 58:return++this.pos,this.finishToken(f.colon);case 96:if(this.options.ecmaVersion<6)break;return++this.pos,this.finishToken(f.backQuote);case 48:var e=this.input.charCodeAt(this.pos+1);if(e===120||e===88)return this.readRadixNumber(16);if(this.options.ecmaVersion>=6){if(e===111||e===79)return this.readRadixNumber(8);if(e===98||e===66)return this.readRadixNumber(2)}case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return this.readNumber(false);case 34:case 39:return this.readString(t);case 47:return this.readToken_slash();case 37:case 42:return this.readToken_mult_modulo_exp(t);case 124:case 38:return this.readToken_pipe_amp(t);case 94:return this.readToken_caret();case 43:case 45:return this.readToken_plus_min(t);case 60:case 62:return this.readToken_lt_gt(t);case 61:case 33:return this.readToken_eq_excl(t);case 63:return this.readToken_question();case 126:return this.finishOp(f.prefix,1);case 35:return this.readToken_numberSign()}this.raise(this.pos,"Unexpected character '"+Wt(t)+"'")};ge.finishOp=function(t,e){var s=this.input.slice(this.pos,this.pos+e);return this.pos+=e,this.finishToken(t,s)};ge.readRegexp=function(){for(var t,e,s=this.pos;;){this.pos>=this.input.length&&this.raise(s,"Unterminated regular expression");var i=this.input.charAt(this.pos);if(st.test(i)&&this.raise(s,"Unterminated regular expression"),t)t=false;else{if(i==="[")e=true;else if(i==="]"&&e)e=false;else if(i==="/"&&!e)break;t=i==="\\"}++this.pos}var r=this.input.slice(s,this.pos);++this.pos;var a=this.pos,o=this.readWord1();this.containsEsc&&this.unexpected(a);var c=this.regexpState||(this.regexpState=new Bt(this));c.reset(s,r,o),this.validateRegExpFlags(c),this.validateRegExpPattern(c);var l=null;try{l=new RegExp(r,o)}catch{}return this.finishToken(f.regexp,{pattern:r,flags:o,value:l})};ge.readInt=function(t,e,s){for(var i=this.options.ecmaVersion>=12&&e===void 0,r=s&&this.input.charCodeAt(this.pos)===48,a=this.pos,o=0,c=0,l=0,h=e??1/0;l<h;++l,++this.pos){var d=this.input.charCodeAt(this.pos),m=void 0;if(i&&d===95){r&&this.raiseRecoverable(this.pos,"Numeric separator is not allowed in legacy octal numeric literals"),c===95&&this.raiseRecoverable(this.pos,"Numeric separator must be exactly one underscore"),l===0&&this.raiseRecoverable(this.pos,"Numeric separator is not allowed at the first of digits"),c=d;continue}if(d>=97?m=d-97+10:d>=65?m=d-65+10:d>=48&&d<=57?m=d-48:m=1/0,m>=t)break;c=d,o=o*t+m}return i&&c===95&&this.raiseRecoverable(this.pos-1,"Numeric separator is not allowed at the last of digits"),this.pos===a||e!=null&&this.pos-a!==e?null:o};function ef(t,e){return e?parseInt(t,8):parseFloat(t.replace(/_/g,""))}function Nu(t){return typeof BigInt!="function"?null:BigInt(t.replace(/_/g,""))}ge.readRadixNumber=function(t){var e=this.pos;this.pos+=2;var s=this.readInt(t);return s==null&&this.raise(this.start+2,"Expected number in radix "+t),this.options.ecmaVersion>=11&&this.input.charCodeAt(this.pos)===110?(s=Nu(this.input.slice(e,this.pos)),++this.pos):Nt(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number"),this.finishToken(f.num,s)};ge.readNumber=function(t){var e=this.pos;!t&&this.readInt(10,void 0,true)===null&&this.raise(e,"Invalid number");var s=this.pos-e>=2&&this.input.charCodeAt(e)===48;s&&this.strict&&this.raise(e,"Invalid number");var i=this.input.charCodeAt(this.pos);if(!s&&!t&&this.options.ecmaVersion>=11&&i===110){var r=Nu(this.input.slice(e,this.pos));return++this.pos,Nt(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number"),this.finishToken(f.num,r)}s&&/[89]/.test(this.input.slice(e,this.pos))&&(s=false),i===46&&!s&&(++this.pos,this.readInt(10),i=this.input.charCodeAt(this.pos)),(i===69||i===101)&&!s&&(i=this.input.charCodeAt(++this.pos),(i===43||i===45)&&++this.pos,this.readInt(10)===null&&this.raise(e,"Invalid number")),Nt(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number");var a=ef(this.input.slice(e,this.pos),s);return this.finishToken(f.num,a)};ge.readCodePoint=function(){var t=this.input.charCodeAt(this.pos),e;if(t===123){this.options.ecmaVersion<6&&this.unexpected();var s=++this.pos;e=this.readHexChar(this.input.indexOf("}",this.pos)-this.pos),++this.pos,e>1114111&&this.invalidStringToken(s,"Code point out of bounds")}else e=this.readHexChar(4);return e};ge.readString=function(t){for(var e="",s=++this.pos;;){this.pos>=this.input.length&&this.raise(this.start,"Unterminated string constant");var i=this.input.charCodeAt(this.pos);if(i===t)break;i===92?(e+=this.input.slice(s,this.pos),e+=this.readEscapedChar(false),s=this.pos):i===8232||i===8233?(this.options.ecmaVersion<10&&this.raise(this.start,"Unterminated string constant"),++this.pos,this.options.locations&&(this.curLine++,this.lineStart=this.pos)):(Os(i)&&this.raise(this.start,"Unterminated string constant"),++this.pos)}return e+=this.input.slice(s,this.pos++),this.finishToken(f.string,e)};var Fu={};ge.tryReadTemplateToken=function(){this.inTemplateElement=true;try{this.readTmplToken()}catch(t){if(t===Fu)this.readInvalidTemplateToken();else throw t}this.inTemplateElement=false};ge.invalidStringToken=function(t,e){if(this.inTemplateElement&&this.options.ecmaVersion>=9)throw Fu;this.raise(t,e)};ge.readTmplToken=function(){for(var t="",e=this.pos;;){this.pos>=this.input.length&&this.raise(this.start,"Unterminated template");var s=this.input.charCodeAt(this.pos);if(s===96||s===36&&this.input.charCodeAt(this.pos+1)===123)return this.pos===this.start&&(this.type===f.template||this.type===f.invalidTemplate)?s===36?(this.pos+=2,this.finishToken(f.dollarBraceL)):(++this.pos,this.finishToken(f.backQuote)):(t+=this.input.slice(e,this.pos),this.finishToken(f.template,t));if(s===92)t+=this.input.slice(e,this.pos),t+=this.readEscapedChar(true),e=this.pos;else if(Os(s)){switch(t+=this.input.slice(e,this.pos),++this.pos,s){case 13:this.input.charCodeAt(this.pos)===10&&++this.pos;case 10:t+=`
5
+ `),cooked:this.value},this.next(),s.tail=this.type===f.backQuote,this.finishNode(s,"TemplateElement")};he.parseTemplate=function(t){t===void 0&&(t={});var e=t.isTagged;e===void 0&&(e=false);var s=this.startNode();this.next(),s.expressions=[];var i=this.parseTemplateElement({isTagged:e});for(s.quasis=[i];!i.tail;)this.type===f.eof&&this.raise(this.pos,"Unterminated template literal"),this.expect(f.dollarBraceL),s.expressions.push(this.parseExpression()),this.expect(f.braceR),s.quasis.push(i=this.parseTemplateElement({isTagged:e}));return this.next(),this.finishNode(s,"TemplateLiteral")};he.isAsyncProp=function(t){return!t.computed&&t.key.type==="Identifier"&&t.key.name==="async"&&(this.type===f.name||this.type===f.num||this.type===f.string||this.type===f.bracketL||this.type.keyword||this.options.ecmaVersion>=9&&this.type===f.star)&&!st.test(this.input.slice(this.lastTokEnd,this.start))};he.parseObj=function(t,e){var s=this.startNode(),i=true,r={};for(s.properties=[],this.next();!this.eat(f.braceR);){if(i)i=false;else if(this.expect(f.comma),this.options.ecmaVersion>=5&&this.afterTrailingComma(f.braceR))break;var o=this.parseProperty(t,e);t||this.checkPropClash(o,r,e),s.properties.push(o)}return this.finishNode(s,t?"ObjectPattern":"ObjectExpression")};he.parseProperty=function(t,e){var s=this.startNode(),i,r,o,a;if(this.options.ecmaVersion>=9&&this.eat(f.ellipsis))return t?(s.argument=this.parseIdent(false),this.type===f.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element"),this.finishNode(s,"RestElement")):(s.argument=this.parseMaybeAssign(false,e),this.type===f.comma&&e&&e.trailingComma<0&&(e.trailingComma=this.start),this.finishNode(s,"SpreadElement"));this.options.ecmaVersion>=6&&(s.method=false,s.shorthand=false,(t||e)&&(o=this.start,a=this.startLoc),t||(i=this.eat(f.star)));var c=this.containsEsc;return this.parsePropertyName(s),!t&&!c&&this.options.ecmaVersion>=8&&!i&&this.isAsyncProp(s)?(r=true,i=this.options.ecmaVersion>=9&&this.eat(f.star),this.parsePropertyName(s)):r=false,this.parsePropertyValue(s,t,i,r,o,a,e,c),this.finishNode(s,"Property")};he.parseGetterSetter=function(t){var e=t.key.name;this.parsePropertyName(t),t.value=this.parseMethod(false),t.kind=e;var s=t.kind==="get"?0:1;if(t.value.params.length!==s){var i=t.value.start;t.kind==="get"?this.raiseRecoverable(i,"getter should have no params"):this.raiseRecoverable(i,"setter should have exactly one param")}else t.kind==="set"&&t.value.params[0].type==="RestElement"&&this.raiseRecoverable(t.value.params[0].start,"Setter cannot use rest params")};he.parsePropertyValue=function(t,e,s,i,r,o,a,c){(s||i)&&this.type===f.colon&&this.unexpected(),this.eat(f.colon)?(t.value=e?this.parseMaybeDefault(this.start,this.startLoc):this.parseMaybeAssign(false,a),t.kind="init"):this.options.ecmaVersion>=6&&this.type===f.parenL?(e&&this.unexpected(),t.method=true,t.value=this.parseMethod(s,i),t.kind="init"):!e&&!c&&this.options.ecmaVersion>=5&&!t.computed&&t.key.type==="Identifier"&&(t.key.name==="get"||t.key.name==="set")&&this.type!==f.comma&&this.type!==f.braceR&&this.type!==f.eq?((s||i)&&this.unexpected(),this.parseGetterSetter(t)):this.options.ecmaVersion>=6&&!t.computed&&t.key.type==="Identifier"?((s||i)&&this.unexpected(),this.checkUnreserved(t.key),t.key.name==="await"&&!this.awaitIdentPos&&(this.awaitIdentPos=r),e?t.value=this.parseMaybeDefault(r,o,this.copyNode(t.key)):this.type===f.eq&&a?(a.shorthandAssign<0&&(a.shorthandAssign=this.start),t.value=this.parseMaybeDefault(r,o,this.copyNode(t.key))):t.value=this.copyNode(t.key),t.kind="init",t.shorthand=true):this.unexpected()};he.parsePropertyName=function(t){if(this.options.ecmaVersion>=6){if(this.eat(f.bracketL))return t.computed=true,t.key=this.parseMaybeAssign(),this.expect(f.bracketR),t.key;t.computed=false}return t.key=this.type===f.num||this.type===f.string?this.parseExprAtom():this.parseIdent(this.options.allowReserved!=="never")};he.initFunction=function(t){t.id=null,this.options.ecmaVersion>=6&&(t.generator=t.expression=false),this.options.ecmaVersion>=8&&(t.async=false)};he.parseMethod=function(t,e,s){var i=this.startNode(),r=this.yieldPos,o=this.awaitPos,a=this.awaitIdentPos;return this.initFunction(i),this.options.ecmaVersion>=6&&(i.generator=t),this.options.ecmaVersion>=8&&(i.async=!!e),this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(Ro(e,i.generator)|gr|(s?uu:0)),this.expect(f.parenL),i.params=this.parseBindingList(f.parenR,false,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams(),this.parseFunctionBody(i,false,true,false),this.yieldPos=r,this.awaitPos=o,this.awaitIdentPos=a,this.finishNode(i,"FunctionExpression")};he.parseArrowExpression=function(t,e,s,i){var r=this.yieldPos,o=this.awaitPos,a=this.awaitIdentPos;return this.enterScope(Ro(s,false)|Io),this.initFunction(t),this.options.ecmaVersion>=8&&(t.async=!!s),this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,t.params=this.toAssignableList(e,true),this.parseFunctionBody(t,true,false,i),this.yieldPos=r,this.awaitPos=o,this.awaitIdentPos=a,this.finishNode(t,"ArrowFunctionExpression")};he.parseFunctionBody=function(t,e,s,i){var r=e&&this.type!==f.braceL,o=this.strict,a=false;if(r)t.body=this.parseMaybeAssign(i),t.expression=true,this.checkParams(t,false);else{var c=this.options.ecmaVersion>=7&&!this.isSimpleParamList(t.params);(!o||c)&&(a=this.strictDirective(this.end),a&&c&&this.raiseRecoverable(t.start,"Illegal 'use strict' directive in function with non-simple parameter list"));var l=this.labels;this.labels=[],a&&(this.strict=true),this.checkParams(t,!o&&!a&&!e&&!s&&this.isSimpleParamList(t.params)),this.strict&&t.id&&this.checkLValSimple(t.id,fu),t.body=this.parseBlock(false,void 0,a&&!o),t.expression=false,this.adaptDirectivePrologue(t.body.body),this.labels=l}this.exitScope()};he.isSimpleParamList=function(t){for(var e=0,s=t;e<s.length;e+=1){var i=s[e];if(i.type!=="Identifier")return false}return true};he.checkParams=function(t,e){for(var s=Object.create(null),i=0,r=t.params;i<r.length;i+=1){var o=r[i];this.checkLValInnerPattern(o,Po,e?null:s)}};he.parseExprList=function(t,e,s,i){for(var r=[],o=true;!this.eat(t);){if(o)o=false;else if(this.expect(f.comma),e&&this.afterTrailingComma(t))break;var a=void 0;s&&this.type===f.comma?a=null:this.type===f.ellipsis?(a=this.parseSpread(i),i&&this.type===f.comma&&i.trailingComma<0&&(i.trailingComma=this.start)):a=this.parseMaybeAssign(false,i),r.push(a)}return r};he.checkUnreserved=function(t){var e=t.start,s=t.end,i=t.name;if(this.inGenerator&&i==="yield"&&this.raiseRecoverable(e,"Cannot use 'yield' as identifier inside a generator"),this.inAsync&&i==="await"&&this.raiseRecoverable(e,"Cannot use 'await' as identifier inside an async function"),!(this.currentThisScope().flags&br)&&i==="arguments"&&this.raiseRecoverable(e,"Cannot use 'arguments' in class field initializer"),this.inClassStaticBlock&&(i==="arguments"||i==="await")&&this.raise(e,"Cannot use "+i+" in class static initialization block"),this.keywords.test(i)&&this.raise(e,"Unexpected keyword '"+i+"'"),!(this.options.ecmaVersion<6&&this.input.slice(e,s).indexOf("\\")!==-1)){var r=this.strict?this.reservedWordsStrict:this.reservedWords;r.test(i)&&(!this.inAsync&&i==="await"&&this.raiseRecoverable(e,"Cannot use keyword 'await' outside an async function"),this.raiseRecoverable(e,"The keyword '"+i+"' is reserved"))}};he.parseIdent=function(t){var e=this.parseIdentNode();return this.next(!!t),this.finishNode(e,"Identifier"),t||(this.checkUnreserved(e),e.name==="await"&&!this.awaitIdentPos&&(this.awaitIdentPos=e.start)),e};he.parseIdentNode=function(){var t=this.startNode();return this.type===f.name?t.name=this.value:this.type.keyword?(t.name=this.type.keyword,(t.name==="class"||t.name==="function")&&(this.lastTokEnd!==this.lastTokStart+1||this.input.charCodeAt(this.lastTokStart)!==46)&&this.context.pop(),this.type=f.name):this.unexpected(),t};he.parsePrivateIdent=function(){var t=this.startNode();return this.type===f.privateId?t.name=this.value:this.unexpected(),this.next(),this.finishNode(t,"PrivateIdentifier"),this.options.checkPrivateFields&&(this.privateNameStack.length===0?this.raise(t.start,"Private field '#"+t.name+"' must be declared in an enclosing class"):this.privateNameStack[this.privateNameStack.length-1].used.push(t)),t};he.parseYield=function(t){this.yieldPos||(this.yieldPos=this.start);var e=this.startNode();return this.next(),this.type===f.semi||this.canInsertSemicolon()||this.type!==f.star&&!this.type.startsExpr?(e.delegate=false,e.argument=null):(e.delegate=this.eat(f.star),e.argument=this.parseMaybeAssign(t)),this.finishNode(e,"YieldExpression")};he.parseAwait=function(t){this.awaitPos||(this.awaitPos=this.start);var e=this.startNode();return this.next(),e.argument=this.parseMaybeUnary(null,true,false,t),this.finishNode(e,"AwaitExpression")};var Gi=Ne.prototype;Gi.raise=function(t,e){var s=ou(this.input,t);e+=" ("+s.line+":"+s.column+")",this.sourceFile&&(e+=" in "+this.sourceFile);var i=new SyntaxError(e);throw i.pos=t,i.loc=s,i.raisedAt=this.pos,i};Gi.raiseRecoverable=Gi.raise;Gi.curPosition=function(){if(this.options.locations)return new ri(this.curLine,this.pos-this.lineStart)};var ls=Ne.prototype,Nh=function(e){this.flags=e,this.var=[],this.lexical=[],this.functions=[]};ls.enterScope=function(t){this.scopeStack.push(new Nh(t))};ls.exitScope=function(){this.scopeStack.pop()};ls.treatFunctionsAsVarInScope=function(t){return t.flags&$s||!this.inModule&&t.flags&ni};ls.declareName=function(t,e,s){var i=false;if(e===Kt){var r=this.currentScope();i=r.lexical.indexOf(t)>-1||r.functions.indexOf(t)>-1||r.var.indexOf(t)>-1,r.lexical.push(t),this.inModule&&r.flags&ni&&delete this.undefinedExports[t]}else if(e===hu){var o=this.currentScope();o.lexical.push(t)}else if(e===lu){var a=this.currentScope();this.treatFunctionsAsVar?i=a.lexical.indexOf(t)>-1:i=a.lexical.indexOf(t)>-1||a.var.indexOf(t)>-1,a.functions.push(t)}else for(var c=this.scopeStack.length-1;c>=0;--c){var l=this.scopeStack[c];if(l.lexical.indexOf(t)>-1&&!(l.flags&cu&&l.lexical[0]===t)||!this.treatFunctionsAsVarInScope(l)&&l.functions.indexOf(t)>-1){i=true;break}if(l.var.push(t),this.inModule&&l.flags&ni&&delete this.undefinedExports[t],l.flags&br)break}i&&this.raiseRecoverable(s,"Identifier '"+t+"' has already been declared")};ls.checkLocalExport=function(t){this.scopeStack[0].lexical.indexOf(t.name)===-1&&this.scopeStack[0].var.indexOf(t.name)===-1&&(this.undefinedExports[t.name]=t)};ls.currentScope=function(){return this.scopeStack[this.scopeStack.length-1]};ls.currentVarScope=function(){for(var t=this.scopeStack.length-1;;t--){var e=this.scopeStack[t];if(e.flags&(br|yi|ks))return e}};ls.currentThisScope=function(){for(var t=this.scopeStack.length-1;;t--){var e=this.scopeStack[t];if(e.flags&(br|yi|ks)&&!(e.flags&Io))return e}};var _r=function(e,s,i){this.type="",this.start=s,this.end=0,e.options.locations&&(this.loc=new mr(e,i)),e.options.directSourceFile&&(this.sourceFile=e.options.directSourceFile),e.options.ranges&&(this.range=[s,0])},_i=Ne.prototype;_i.startNode=function(){return new _r(this,this.start,this.startLoc)};_i.startNodeAt=function(t,e){return new _r(this,t,e)};function mu(t,e,s,i){return t.type=e,t.end=s,this.options.locations&&(t.loc.end=i),this.options.ranges&&(t.range[1]=s),t}_i.finishNode=function(t,e){return mu.call(this,t,e,this.lastTokEnd,this.lastTokEndLoc)};_i.finishNodeAt=function(t,e,s,i){return mu.call(this,t,e,s,i)};_i.copyNode=function(t){var e=new _r(this,t.start,this.startLoc);for(var s in t)e[s]=t[s];return e};var Fh="Gara Garay Gukh Gurung_Khema Hrkt Katakana_Or_Hiragana Kawi Kirat_Rai Krai Nag_Mundari Nagm Ol_Onal Onao Sunu Sunuwar Todhri Todr Tulu_Tigalari Tutg Unknown Zzzz",gu="ASCII ASCII_Hex_Digit AHex Alphabetic Alpha Any Assigned Bidi_Control Bidi_C Bidi_Mirrored Bidi_M Case_Ignorable CI Cased Changes_When_Casefolded CWCF Changes_When_Casemapped CWCM Changes_When_Lowercased CWL Changes_When_NFKC_Casefolded CWKCF Changes_When_Titlecased CWT Changes_When_Uppercased CWU Dash Default_Ignorable_Code_Point DI Deprecated Dep Diacritic Dia Emoji Emoji_Component Emoji_Modifier Emoji_Modifier_Base Emoji_Presentation Extender Ext Grapheme_Base Gr_Base Grapheme_Extend Gr_Ext Hex_Digit Hex IDS_Binary_Operator IDSB IDS_Trinary_Operator IDST ID_Continue IDC ID_Start IDS Ideographic Ideo Join_Control Join_C Logical_Order_Exception LOE Lowercase Lower Math Noncharacter_Code_Point NChar Pattern_Syntax Pat_Syn Pattern_White_Space Pat_WS Quotation_Mark QMark Radical Regional_Indicator RI Sentence_Terminal STerm Soft_Dotted SD Terminal_Punctuation Term Unified_Ideograph UIdeo Uppercase Upper Variation_Selector VS White_Space space XID_Continue XIDC XID_Start XIDS",bu=gu+" Extended_Pictographic",yu=bu,_u=yu+" EBase EComp EMod EPres ExtPict",vu=_u,Uh=vu,Mh={9:gu,10:bu,11:yu,12:_u,13:vu,14:Uh},Oh="Basic_Emoji Emoji_Keycap_Sequence RGI_Emoji_Modifier_Sequence RGI_Emoji_Flag_Sequence RGI_Emoji_Tag_Sequence RGI_Emoji_ZWJ_Sequence RGI_Emoji",Bh={9:"",10:"",11:"",12:"",13:"",14:Oh},Va="Cased_Letter LC Close_Punctuation Pe Connector_Punctuation Pc Control Cc cntrl Currency_Symbol Sc Dash_Punctuation Pd Decimal_Number Nd digit Enclosing_Mark Me Final_Punctuation Pf Format Cf Initial_Punctuation Pi Letter L Letter_Number Nl Line_Separator Zl Lowercase_Letter Ll Mark M Combining_Mark Math_Symbol Sm Modifier_Letter Lm Modifier_Symbol Sk Nonspacing_Mark Mn Number N Open_Punctuation Ps Other C Other_Letter Lo Other_Number No Other_Punctuation Po Other_Symbol So Paragraph_Separator Zp Private_Use Co Punctuation P punct Separator Z Space_Separator Zs Spacing_Mark Mc Surrogate Cs Symbol S Titlecase_Letter Lt Unassigned Cn Uppercase_Letter Lu",xu="Adlam Adlm Ahom Anatolian_Hieroglyphs Hluw Arabic Arab Armenian Armn Avestan Avst Balinese Bali Bamum Bamu Bassa_Vah Bass Batak Batk Bengali Beng Bhaiksuki Bhks Bopomofo Bopo Brahmi Brah Braille Brai Buginese Bugi Buhid Buhd Canadian_Aboriginal Cans Carian Cari Caucasian_Albanian Aghb Chakma Cakm Cham Cham Cherokee Cher Common Zyyy Coptic Copt Qaac Cuneiform Xsux Cypriot Cprt Cyrillic Cyrl Deseret Dsrt Devanagari Deva Duployan Dupl Egyptian_Hieroglyphs Egyp Elbasan Elba Ethiopic Ethi Georgian Geor Glagolitic Glag Gothic Goth Grantha Gran Greek Grek Gujarati Gujr Gurmukhi Guru Han Hani Hangul Hang Hanunoo Hano Hatran Hatr Hebrew Hebr Hiragana Hira Imperial_Aramaic Armi Inherited Zinh Qaai Inscriptional_Pahlavi Phli Inscriptional_Parthian Prti Javanese Java Kaithi Kthi Kannada Knda Katakana Kana Kayah_Li Kali Kharoshthi Khar Khmer Khmr Khojki Khoj Khudawadi Sind Lao Laoo Latin Latn Lepcha Lepc Limbu Limb Linear_A Lina Linear_B Linb Lisu Lisu Lycian Lyci Lydian Lydi Mahajani Mahj Malayalam Mlym Mandaic Mand Manichaean Mani Marchen Marc Masaram_Gondi Gonm Meetei_Mayek Mtei Mende_Kikakui Mend Meroitic_Cursive Merc Meroitic_Hieroglyphs Mero Miao Plrd Modi Mongolian Mong Mro Mroo Multani Mult Myanmar Mymr Nabataean Nbat New_Tai_Lue Talu Newa Newa Nko Nkoo Nushu Nshu Ogham Ogam Ol_Chiki Olck Old_Hungarian Hung Old_Italic Ital Old_North_Arabian Narb Old_Permic Perm Old_Persian Xpeo Old_South_Arabian Sarb Old_Turkic Orkh Oriya Orya Osage Osge Osmanya Osma Pahawh_Hmong Hmng Palmyrene Palm Pau_Cin_Hau Pauc Phags_Pa Phag Phoenician Phnx Psalter_Pahlavi Phlp Rejang Rjng Runic Runr Samaritan Samr Saurashtra Saur Sharada Shrd Shavian Shaw Siddham Sidd SignWriting Sgnw Sinhala Sinh Sora_Sompeng Sora Soyombo Soyo Sundanese Sund Syloti_Nagri Sylo Syriac Syrc Tagalog Tglg Tagbanwa Tagb Tai_Le Tale Tai_Tham Lana Tai_Viet Tavt Takri Takr Tamil Taml Tangut Tang Telugu Telu Thaana Thaa Thai Thai Tibetan Tibt Tifinagh Tfng Tirhuta Tirh Ugaritic Ugar Vai Vaii Warang_Citi Wara Yi Yiii Zanabazar_Square Zanb",ku=xu+" Dogra Dogr Gunjala_Gondi Gong Hanifi_Rohingya Rohg Makasar Maka Medefaidrin Medf Old_Sogdian Sogo Sogdian Sogd",wu=ku+" Elymaic Elym Nandinagari Nand Nyiakeng_Puachue_Hmong Hmnp Wancho Wcho",Su=wu+" Chorasmian Chrs Diak Dives_Akuru Khitan_Small_Script Kits Yezi Yezidi",Eu=Su+" Cypro_Minoan Cpmn Old_Uyghur Ougr Tangsa Tnsa Toto Vithkuqi Vith",Vh=Eu+" "+Fh,$h={9:xu,10:ku,11:wu,12:Su,13:Eu,14:Vh},Tu={};function jh(t){var e=Tu[t]={binary:es(Mh[t]+" "+Va),binaryOfStrings:es(Bh[t]),nonBinary:{General_Category:es(Va),Script:es($h[t])}};e.nonBinary.Script_Extensions=e.nonBinary.Script,e.nonBinary.gc=e.nonBinary.General_Category,e.nonBinary.sc=e.nonBinary.Script,e.nonBinary.scx=e.nonBinary.Script_Extensions}for(var Pn=0,$a=[9,10,11,12,13,14];Pn<$a.length;Pn+=1){var qh=$a[Pn];jh(qh)}var Y=Ne.prototype,Wi=function(e,s){this.parent=e,this.base=s||this};Wi.prototype.separatedFrom=function(e){for(var s=this;s;s=s.parent)for(var i=e;i;i=i.parent)if(s.base===i.base&&s!==i)return true;return false};Wi.prototype.sibling=function(){return new Wi(this.parent,this.base)};var Ot=function(e){this.parser=e,this.validFlags="gim"+(e.options.ecmaVersion>=6?"uy":"")+(e.options.ecmaVersion>=9?"s":"")+(e.options.ecmaVersion>=13?"d":"")+(e.options.ecmaVersion>=15?"v":""),this.unicodeProperties=Tu[e.options.ecmaVersion>=14?14:e.options.ecmaVersion],this.source="",this.flags="",this.start=0,this.switchU=false,this.switchV=false,this.switchN=false,this.pos=0,this.lastIntValue=0,this.lastStringValue="",this.lastAssertionIsQuantifiable=false,this.numCapturingParens=0,this.maxBackReference=0,this.groupNames=Object.create(null),this.backReferenceNames=[],this.branchID=null};Ot.prototype.reset=function(e,s,i){var r=i.indexOf("v")!==-1,o=i.indexOf("u")!==-1;this.start=e|0,this.source=s+"",this.flags=i,r&&this.parser.options.ecmaVersion>=15?(this.switchU=true,this.switchV=true,this.switchN=true):(this.switchU=o&&this.parser.options.ecmaVersion>=6,this.switchV=false,this.switchN=o&&this.parser.options.ecmaVersion>=9)};Ot.prototype.raise=function(e){this.parser.raiseRecoverable(this.start,"Invalid regular expression: /"+this.source+"/: "+e)};Ot.prototype.at=function(e,s){s===void 0&&(s=false);var i=this.source,r=i.length;if(e>=r)return-1;var o=i.charCodeAt(e);if(!(s||this.switchU)||o<=55295||o>=57344||e+1>=r)return o;var a=i.charCodeAt(e+1);return a>=56320&&a<=57343?(o<<10)+a-56613888:o};Ot.prototype.nextIndex=function(e,s){s===void 0&&(s=false);var i=this.source,r=i.length;if(e>=r)return r;var o=i.charCodeAt(e),a;return!(s||this.switchU)||o<=55295||o>=57344||e+1>=r||(a=i.charCodeAt(e+1))<56320||a>57343?e+1:e+2};Ot.prototype.current=function(e){return e===void 0&&(e=false),this.at(this.pos,e)};Ot.prototype.lookahead=function(e){return e===void 0&&(e=false),this.at(this.nextIndex(this.pos,e),e)};Ot.prototype.advance=function(e){e===void 0&&(e=false),this.pos=this.nextIndex(this.pos,e)};Ot.prototype.eat=function(e,s){return s===void 0&&(s=false),this.current(s)===e?(this.advance(s),true):false};Ot.prototype.eatChars=function(e,s){s===void 0&&(s=false);for(var i=this.pos,r=0,o=e;r<o.length;r+=1){var a=o[r],c=this.at(i,s);if(c===-1||c!==a)return false;i=this.nextIndex(i,s)}return this.pos=i,true};Y.validateRegExpFlags=function(t){for(var e=t.validFlags,s=t.flags,i=false,r=false,o=0;o<s.length;o++){var a=s.charAt(o);e.indexOf(a)===-1&&this.raise(t.start,"Invalid regular expression flag"),s.indexOf(a,o+1)>-1&&this.raise(t.start,"Duplicate regular expression flag"),a==="u"&&(i=true),a==="v"&&(r=true)}this.options.ecmaVersion>=15&&i&&r&&this.raise(t.start,"Invalid regular expression flag")};function Hh(t){for(var e in t)return true;return false}Y.validateRegExpPattern=function(t){this.regexp_pattern(t),!t.switchN&&this.options.ecmaVersion>=9&&Hh(t.groupNames)&&(t.switchN=true,this.regexp_pattern(t))};Y.regexp_pattern=function(t){t.pos=0,t.lastIntValue=0,t.lastStringValue="",t.lastAssertionIsQuantifiable=false,t.numCapturingParens=0,t.maxBackReference=0,t.groupNames=Object.create(null),t.backReferenceNames.length=0,t.branchID=null,this.regexp_disjunction(t),t.pos!==t.source.length&&(t.eat(41)&&t.raise("Unmatched ')'"),(t.eat(93)||t.eat(125))&&t.raise("Lone quantifier brackets")),t.maxBackReference>t.numCapturingParens&&t.raise("Invalid escape");for(var e=0,s=t.backReferenceNames;e<s.length;e+=1){var i=s[e];t.groupNames[i]||t.raise("Invalid named capture referenced")}};Y.regexp_disjunction=function(t){var e=this.options.ecmaVersion>=16;for(e&&(t.branchID=new Wi(t.branchID,null)),this.regexp_alternative(t);t.eat(124);)e&&(t.branchID=t.branchID.sibling()),this.regexp_alternative(t);e&&(t.branchID=t.branchID.parent),this.regexp_eatQuantifier(t,true)&&t.raise("Nothing to repeat"),t.eat(123)&&t.raise("Lone quantifier brackets")};Y.regexp_alternative=function(t){for(;t.pos<t.source.length&&this.regexp_eatTerm(t););};Y.regexp_eatTerm=function(t){return this.regexp_eatAssertion(t)?(t.lastAssertionIsQuantifiable&&this.regexp_eatQuantifier(t)&&t.switchU&&t.raise("Invalid quantifier"),true):(t.switchU?this.regexp_eatAtom(t):this.regexp_eatExtendedAtom(t))?(this.regexp_eatQuantifier(t),true):false};Y.regexp_eatAssertion=function(t){var e=t.pos;if(t.lastAssertionIsQuantifiable=false,t.eat(94)||t.eat(36))return true;if(t.eat(92)){if(t.eat(66)||t.eat(98))return true;t.pos=e}if(t.eat(40)&&t.eat(63)){var s=false;if(this.options.ecmaVersion>=9&&(s=t.eat(60)),t.eat(61)||t.eat(33))return this.regexp_disjunction(t),t.eat(41)||t.raise("Unterminated group"),t.lastAssertionIsQuantifiable=!s,true}return t.pos=e,false};Y.regexp_eatQuantifier=function(t,e){return e===void 0&&(e=false),this.regexp_eatQuantifierPrefix(t,e)?(t.eat(63),true):false};Y.regexp_eatQuantifierPrefix=function(t,e){return t.eat(42)||t.eat(43)||t.eat(63)||this.regexp_eatBracedQuantifier(t,e)};Y.regexp_eatBracedQuantifier=function(t,e){var s=t.pos;if(t.eat(123)){var i=0,r=-1;if(this.regexp_eatDecimalDigits(t)&&(i=t.lastIntValue,t.eat(44)&&this.regexp_eatDecimalDigits(t)&&(r=t.lastIntValue),t.eat(125)))return r!==-1&&r<i&&!e&&t.raise("numbers out of order in {} quantifier"),true;t.switchU&&!e&&t.raise("Incomplete quantifier"),t.pos=s}return false};Y.regexp_eatAtom=function(t){return this.regexp_eatPatternCharacters(t)||t.eat(46)||this.regexp_eatReverseSolidusAtomEscape(t)||this.regexp_eatCharacterClass(t)||this.regexp_eatUncapturingGroup(t)||this.regexp_eatCapturingGroup(t)};Y.regexp_eatReverseSolidusAtomEscape=function(t){var e=t.pos;if(t.eat(92)){if(this.regexp_eatAtomEscape(t))return true;t.pos=e}return false};Y.regexp_eatUncapturingGroup=function(t){var e=t.pos;if(t.eat(40)){if(t.eat(63)){if(this.options.ecmaVersion>=16){var s=this.regexp_eatModifiers(t),i=t.eat(45);if(s||i){for(var r=0;r<s.length;r++){var o=s.charAt(r);s.indexOf(o,r+1)>-1&&t.raise("Duplicate regular expression modifiers")}if(i){var a=this.regexp_eatModifiers(t);!s&&!a&&t.current()===58&&t.raise("Invalid regular expression modifiers");for(var c=0;c<a.length;c++){var l=a.charAt(c);(a.indexOf(l,c+1)>-1||s.indexOf(l)>-1)&&t.raise("Duplicate regular expression modifiers")}}}}if(t.eat(58)){if(this.regexp_disjunction(t),t.eat(41))return true;t.raise("Unterminated group")}}t.pos=e}return false};Y.regexp_eatCapturingGroup=function(t){if(t.eat(40)){if(this.options.ecmaVersion>=9?this.regexp_groupSpecifier(t):t.current()===63&&t.raise("Invalid group"),this.regexp_disjunction(t),t.eat(41))return t.numCapturingParens+=1,true;t.raise("Unterminated group")}return false};Y.regexp_eatModifiers=function(t){for(var e="",s=0;(s=t.current())!==-1&&Gh(s);)e+=Wt(s),t.advance();return e};function Gh(t){return t===105||t===109||t===115}Y.regexp_eatExtendedAtom=function(t){return t.eat(46)||this.regexp_eatReverseSolidusAtomEscape(t)||this.regexp_eatCharacterClass(t)||this.regexp_eatUncapturingGroup(t)||this.regexp_eatCapturingGroup(t)||this.regexp_eatInvalidBracedQuantifier(t)||this.regexp_eatExtendedPatternCharacter(t)};Y.regexp_eatInvalidBracedQuantifier=function(t){return this.regexp_eatBracedQuantifier(t,true)&&t.raise("Nothing to repeat"),false};Y.regexp_eatSyntaxCharacter=function(t){var e=t.current();return Au(e)?(t.lastIntValue=e,t.advance(),true):false};function Au(t){return t===36||t>=40&&t<=43||t===46||t===63||t>=91&&t<=94||t>=123&&t<=125}Y.regexp_eatPatternCharacters=function(t){for(var e=t.pos,s=0;(s=t.current())!==-1&&!Au(s);)t.advance();return t.pos!==e};Y.regexp_eatExtendedPatternCharacter=function(t){var e=t.current();return e!==-1&&e!==36&&!(e>=40&&e<=43)&&e!==46&&e!==63&&e!==91&&e!==94&&e!==124?(t.advance(),true):false};Y.regexp_groupSpecifier=function(t){if(t.eat(63)){this.regexp_eatGroupName(t)||t.raise("Invalid group");var e=this.options.ecmaVersion>=16,s=t.groupNames[t.lastStringValue];if(s)if(e)for(var i=0,r=s;i<r.length;i+=1){var o=r[i];o.separatedFrom(t.branchID)||t.raise("Duplicate capture group name")}else t.raise("Duplicate capture group name");e?(s||(t.groupNames[t.lastStringValue]=[])).push(t.branchID):t.groupNames[t.lastStringValue]=true}};Y.regexp_eatGroupName=function(t){if(t.lastStringValue="",t.eat(60)){if(this.regexp_eatRegExpIdentifierName(t)&&t.eat(62))return true;t.raise("Invalid capture group name")}return false};Y.regexp_eatRegExpIdentifierName=function(t){if(t.lastStringValue="",this.regexp_eatRegExpIdentifierStart(t)){for(t.lastStringValue+=Wt(t.lastIntValue);this.regexp_eatRegExpIdentifierPart(t);)t.lastStringValue+=Wt(t.lastIntValue);return true}return false};Y.regexp_eatRegExpIdentifierStart=function(t){var e=t.pos,s=this.options.ecmaVersion>=11,i=t.current(s);return t.advance(s),i===92&&this.regexp_eatRegExpUnicodeEscapeSequence(t,s)&&(i=t.lastIntValue),Wh(i)?(t.lastIntValue=i,true):(t.pos=e,false)};function Wh(t){return Nt(t,true)||t===36||t===95}Y.regexp_eatRegExpIdentifierPart=function(t){var e=t.pos,s=this.options.ecmaVersion>=11,i=t.current(s);return t.advance(s),i===92&&this.regexp_eatRegExpUnicodeEscapeSequence(t,s)&&(i=t.lastIntValue),Xh(i)?(t.lastIntValue=i,true):(t.pos=e,false)};function Xh(t){return cs(t,true)||t===36||t===95||t===8204||t===8205}Y.regexp_eatAtomEscape=function(t){return this.regexp_eatBackReference(t)||this.regexp_eatCharacterClassEscape(t)||this.regexp_eatCharacterEscape(t)||t.switchN&&this.regexp_eatKGroupName(t)?true:(t.switchU&&(t.current()===99&&t.raise("Invalid unicode escape"),t.raise("Invalid escape")),false)};Y.regexp_eatBackReference=function(t){var e=t.pos;if(this.regexp_eatDecimalEscape(t)){var s=t.lastIntValue;if(t.switchU)return s>t.maxBackReference&&(t.maxBackReference=s),true;if(s<=t.numCapturingParens)return true;t.pos=e}return false};Y.regexp_eatKGroupName=function(t){if(t.eat(107)){if(this.regexp_eatGroupName(t))return t.backReferenceNames.push(t.lastStringValue),true;t.raise("Invalid named reference")}return false};Y.regexp_eatCharacterEscape=function(t){return this.regexp_eatControlEscape(t)||this.regexp_eatCControlLetter(t)||this.regexp_eatZero(t)||this.regexp_eatHexEscapeSequence(t)||this.regexp_eatRegExpUnicodeEscapeSequence(t,false)||!t.switchU&&this.regexp_eatLegacyOctalEscapeSequence(t)||this.regexp_eatIdentityEscape(t)};Y.regexp_eatCControlLetter=function(t){var e=t.pos;if(t.eat(99)){if(this.regexp_eatControlLetter(t))return true;t.pos=e}return false};Y.regexp_eatZero=function(t){return t.current()===48&&!vr(t.lookahead())?(t.lastIntValue=0,t.advance(),true):false};Y.regexp_eatControlEscape=function(t){var e=t.current();return e===116?(t.lastIntValue=9,t.advance(),true):e===110?(t.lastIntValue=10,t.advance(),true):e===118?(t.lastIntValue=11,t.advance(),true):e===102?(t.lastIntValue=12,t.advance(),true):e===114?(t.lastIntValue=13,t.advance(),true):false};Y.regexp_eatControlLetter=function(t){var e=t.current();return Cu(e)?(t.lastIntValue=e%32,t.advance(),true):false};function Cu(t){return t>=65&&t<=90||t>=97&&t<=122}Y.regexp_eatRegExpUnicodeEscapeSequence=function(t,e){e===void 0&&(e=false);var s=t.pos,i=e||t.switchU;if(t.eat(117)){if(this.regexp_eatFixedHexDigits(t,4)){var r=t.lastIntValue;if(i&&r>=55296&&r<=56319){var o=t.pos;if(t.eat(92)&&t.eat(117)&&this.regexp_eatFixedHexDigits(t,4)){var a=t.lastIntValue;if(a>=56320&&a<=57343)return t.lastIntValue=(r-55296)*1024+(a-56320)+65536,true}t.pos=o,t.lastIntValue=r}return true}if(i&&t.eat(123)&&this.regexp_eatHexDigits(t)&&t.eat(125)&&zh(t.lastIntValue))return true;i&&t.raise("Invalid unicode escape"),t.pos=s}return false};function zh(t){return t>=0&&t<=1114111}Y.regexp_eatIdentityEscape=function(t){if(t.switchU)return this.regexp_eatSyntaxCharacter(t)?true:t.eat(47)?(t.lastIntValue=47,true):false;var e=t.current();return e!==99&&(!t.switchN||e!==107)?(t.lastIntValue=e,t.advance(),true):false};Y.regexp_eatDecimalEscape=function(t){t.lastIntValue=0;var e=t.current();if(e>=49&&e<=57){do t.lastIntValue=10*t.lastIntValue+(e-48),t.advance();while((e=t.current())>=48&&e<=57);return true}return false};var Iu=0,Xt=1,ut=2;Y.regexp_eatCharacterClassEscape=function(t){var e=t.current();if(Yh(e))return t.lastIntValue=-1,t.advance(),Xt;var s=false;if(t.switchU&&this.options.ecmaVersion>=9&&((s=e===80)||e===112)){t.lastIntValue=-1,t.advance();var i;if(t.eat(123)&&(i=this.regexp_eatUnicodePropertyValueExpression(t))&&t.eat(125))return s&&i===ut&&t.raise("Invalid property name"),i;t.raise("Invalid property name")}return Iu};function Yh(t){return t===100||t===68||t===115||t===83||t===119||t===87}Y.regexp_eatUnicodePropertyValueExpression=function(t){var e=t.pos;if(this.regexp_eatUnicodePropertyName(t)&&t.eat(61)){var s=t.lastStringValue;if(this.regexp_eatUnicodePropertyValue(t)){var i=t.lastStringValue;return this.regexp_validateUnicodePropertyNameAndValue(t,s,i),Xt}}if(t.pos=e,this.regexp_eatLoneUnicodePropertyNameOrValue(t)){var r=t.lastStringValue;return this.regexp_validateUnicodePropertyNameOrValue(t,r)}return Iu};Y.regexp_validateUnicodePropertyNameAndValue=function(t,e,s){Vs(t.unicodeProperties.nonBinary,e)||t.raise("Invalid property name"),t.unicodeProperties.nonBinary[e].test(s)||t.raise("Invalid property value")};Y.regexp_validateUnicodePropertyNameOrValue=function(t,e){if(t.unicodeProperties.binary.test(e))return Xt;if(t.switchV&&t.unicodeProperties.binaryOfStrings.test(e))return ut;t.raise("Invalid property name")};Y.regexp_eatUnicodePropertyName=function(t){var e=0;for(t.lastStringValue="";Ru(e=t.current());)t.lastStringValue+=Wt(e),t.advance();return t.lastStringValue!==""};function Ru(t){return Cu(t)||t===95}Y.regexp_eatUnicodePropertyValue=function(t){var e=0;for(t.lastStringValue="";Kh(e=t.current());)t.lastStringValue+=Wt(e),t.advance();return t.lastStringValue!==""};function Kh(t){return Ru(t)||vr(t)}Y.regexp_eatLoneUnicodePropertyNameOrValue=function(t){return this.regexp_eatUnicodePropertyValue(t)};Y.regexp_eatCharacterClass=function(t){if(t.eat(91)){var e=t.eat(94),s=this.regexp_classContents(t);return t.eat(93)||t.raise("Unterminated character class"),e&&s===ut&&t.raise("Negated character class may contain strings"),true}return false};Y.regexp_classContents=function(t){return t.current()===93?Xt:t.switchV?this.regexp_classSetExpression(t):(this.regexp_nonEmptyClassRanges(t),Xt)};Y.regexp_nonEmptyClassRanges=function(t){for(;this.regexp_eatClassAtom(t);){var e=t.lastIntValue;if(t.eat(45)&&this.regexp_eatClassAtom(t)){var s=t.lastIntValue;t.switchU&&(e===-1||s===-1)&&t.raise("Invalid character class"),e!==-1&&s!==-1&&e>s&&t.raise("Range out of order in character class")}}};Y.regexp_eatClassAtom=function(t){var e=t.pos;if(t.eat(92)){if(this.regexp_eatClassEscape(t))return true;if(t.switchU){var s=t.current();(s===99||Du(s))&&t.raise("Invalid class escape"),t.raise("Invalid escape")}t.pos=e}var i=t.current();return i!==93?(t.lastIntValue=i,t.advance(),true):false};Y.regexp_eatClassEscape=function(t){var e=t.pos;if(t.eat(98))return t.lastIntValue=8,true;if(t.switchU&&t.eat(45))return t.lastIntValue=45,true;if(!t.switchU&&t.eat(99)){if(this.regexp_eatClassControlLetter(t))return true;t.pos=e}return this.regexp_eatCharacterClassEscape(t)||this.regexp_eatCharacterEscape(t)};Y.regexp_classSetExpression=function(t){var e=Xt,s;if(!this.regexp_eatClassSetRange(t))if(s=this.regexp_eatClassSetOperand(t)){s===ut&&(e=ut);for(var i=t.pos;t.eatChars([38,38]);){if(t.current()!==38&&(s=this.regexp_eatClassSetOperand(t))){s!==ut&&(e=Xt);continue}t.raise("Invalid character in character class")}if(i!==t.pos)return e;for(;t.eatChars([45,45]);)this.regexp_eatClassSetOperand(t)||t.raise("Invalid character in character class");if(i!==t.pos)return e}else t.raise("Invalid character in character class");for(;;)if(!this.regexp_eatClassSetRange(t)){if(s=this.regexp_eatClassSetOperand(t),!s)return e;s===ut&&(e=ut)}};Y.regexp_eatClassSetRange=function(t){var e=t.pos;if(this.regexp_eatClassSetCharacter(t)){var s=t.lastIntValue;if(t.eat(45)&&this.regexp_eatClassSetCharacter(t)){var i=t.lastIntValue;return s!==-1&&i!==-1&&s>i&&t.raise("Range out of order in character class"),true}t.pos=e}return false};Y.regexp_eatClassSetOperand=function(t){return this.regexp_eatClassSetCharacter(t)?Xt:this.regexp_eatClassStringDisjunction(t)||this.regexp_eatNestedClass(t)};Y.regexp_eatNestedClass=function(t){var e=t.pos;if(t.eat(91)){var s=t.eat(94),i=this.regexp_classContents(t);if(t.eat(93))return s&&i===ut&&t.raise("Negated character class may contain strings"),i;t.pos=e}if(t.eat(92)){var r=this.regexp_eatCharacterClassEscape(t);if(r)return r;t.pos=e}return null};Y.regexp_eatClassStringDisjunction=function(t){var e=t.pos;if(t.eatChars([92,113])){if(t.eat(123)){var s=this.regexp_classStringDisjunctionContents(t);if(t.eat(125))return s}else t.raise("Invalid escape");t.pos=e}return null};Y.regexp_classStringDisjunctionContents=function(t){for(var e=this.regexp_classString(t);t.eat(124);)this.regexp_classString(t)===ut&&(e=ut);return e};Y.regexp_classString=function(t){for(var e=0;this.regexp_eatClassSetCharacter(t);)e++;return e===1?Xt:ut};Y.regexp_eatClassSetCharacter=function(t){var e=t.pos;if(t.eat(92))return this.regexp_eatCharacterEscape(t)||this.regexp_eatClassSetReservedPunctuator(t)?true:t.eat(98)?(t.lastIntValue=8,true):(t.pos=e,false);var s=t.current();return s<0||s===t.lookahead()&&Zh(s)||Qh(s)?false:(t.advance(),t.lastIntValue=s,true)};function Zh(t){return t===33||t>=35&&t<=38||t>=42&&t<=44||t===46||t>=58&&t<=64||t===94||t===96||t===126}function Qh(t){return t===40||t===41||t===45||t===47||t>=91&&t<=93||t>=123&&t<=125}Y.regexp_eatClassSetReservedPunctuator=function(t){var e=t.current();return Jh(e)?(t.lastIntValue=e,t.advance(),true):false};function Jh(t){return t===33||t===35||t===37||t===38||t===44||t===45||t>=58&&t<=62||t===64||t===96||t===126}Y.regexp_eatClassControlLetter=function(t){var e=t.current();return vr(e)||e===95?(t.lastIntValue=e%32,t.advance(),true):false};Y.regexp_eatHexEscapeSequence=function(t){var e=t.pos;if(t.eat(120)){if(this.regexp_eatFixedHexDigits(t,2))return true;t.switchU&&t.raise("Invalid escape"),t.pos=e}return false};Y.regexp_eatDecimalDigits=function(t){var e=t.pos,s=0;for(t.lastIntValue=0;vr(s=t.current());)t.lastIntValue=10*t.lastIntValue+(s-48),t.advance();return t.pos!==e};function vr(t){return t>=48&&t<=57}Y.regexp_eatHexDigits=function(t){var e=t.pos,s=0;for(t.lastIntValue=0;Pu(s=t.current());)t.lastIntValue=16*t.lastIntValue+Lu(s),t.advance();return t.pos!==e};function Pu(t){return t>=48&&t<=57||t>=65&&t<=70||t>=97&&t<=102}function Lu(t){return t>=65&&t<=70?10+(t-65):t>=97&&t<=102?10+(t-97):t-48}Y.regexp_eatLegacyOctalEscapeSequence=function(t){if(this.regexp_eatOctalDigit(t)){var e=t.lastIntValue;if(this.regexp_eatOctalDigit(t)){var s=t.lastIntValue;e<=3&&this.regexp_eatOctalDigit(t)?t.lastIntValue=e*64+s*8+t.lastIntValue:t.lastIntValue=e*8+s}else t.lastIntValue=e;return true}return false};Y.regexp_eatOctalDigit=function(t){var e=t.current();return Du(e)?(t.lastIntValue=e-48,t.advance(),true):(t.lastIntValue=0,false)};function Du(t){return t>=48&&t<=55}Y.regexp_eatFixedHexDigits=function(t,e){var s=t.pos;t.lastIntValue=0;for(var i=0;i<e;++i){var r=t.current();if(!Pu(r))return t.pos=s,false;t.lastIntValue=16*t.lastIntValue+Lu(r),t.advance()}return true};var Do=function(e){this.type=e.type,this.value=e.value,this.start=e.start,this.end=e.end,e.options.locations&&(this.loc=new mr(e,e.startLoc,e.endLoc)),e.options.ranges&&(this.range=[e.start,e.end])},ge=Ne.prototype;ge.next=function(t){!t&&this.type.keyword&&this.containsEsc&&this.raiseRecoverable(this.start,"Escape sequence in keyword "+this.type.keyword),this.options.onToken&&this.options.onToken(new Do(this)),this.lastTokEnd=this.end,this.lastTokStart=this.start,this.lastTokEndLoc=this.endLoc,this.lastTokStartLoc=this.startLoc,this.nextToken()};ge.getToken=function(){return this.next(),new Do(this)};typeof Symbol<"u"&&(ge[Symbol.iterator]=function(){var t=this;return{next:function(){var e=t.getToken();return{done:e.type===f.eof,value:e}}}});ge.nextToken=function(){var t=this.curContext();if((!t||!t.preserveSpace)&&this.skipSpace(),this.start=this.pos,this.options.locations&&(this.startLoc=this.curPosition()),this.pos>=this.input.length)return this.finishToken(f.eof);if(t.override)return t.override(this);this.readToken(this.fullCharCodeAtPos())};ge.readToken=function(t){return Nt(t,this.options.ecmaVersion>=6)||t===92?this.readWord():this.getTokenFromCode(t)};ge.fullCharCodeAtPos=function(){var t=this.input.charCodeAt(this.pos);if(t<=55295||t>=56320)return t;var e=this.input.charCodeAt(this.pos+1);return e<=56319||e>=57344?t:(t<<10)+e-56613888};ge.skipBlockComment=function(){var t=this.options.onComment&&this.curPosition(),e=this.pos,s=this.input.indexOf("*/",this.pos+=2);if(s===-1&&this.raise(this.pos-2,"Unterminated comment"),this.pos=s+2,this.options.locations)for(var i=void 0,r=e;(i=iu(this.input,r,this.pos))>-1;)++this.curLine,r=this.lineStart=i;this.options.onComment&&this.options.onComment(true,this.input.slice(e+2,s),e,this.pos,t,this.curPosition())};ge.skipLineComment=function(t){for(var e=this.pos,s=this.options.onComment&&this.curPosition(),i=this.input.charCodeAt(this.pos+=t);this.pos<this.input.length&&!Bs(i);)i=this.input.charCodeAt(++this.pos);this.options.onComment&&this.options.onComment(false,this.input.slice(e+t,this.pos),e,this.pos,s,this.curPosition())};ge.skipSpace=function(){e:for(;this.pos<this.input.length;){var t=this.input.charCodeAt(this.pos);switch(t){case 32:case 160:++this.pos;break;case 13:this.input.charCodeAt(this.pos+1)===10&&++this.pos;case 10:case 8232:case 8233:++this.pos,this.options.locations&&(++this.curLine,this.lineStart=this.pos);break;case 47:switch(this.input.charCodeAt(this.pos+1)){case 42:this.skipBlockComment();break;case 47:this.skipLineComment(2);break;default:break e}break;default:if(t>8&&t<14||t>=5760&&ru.test(String.fromCharCode(t)))++this.pos;else break e}}};ge.finishToken=function(t,e){this.end=this.pos,this.options.locations&&(this.endLoc=this.curPosition());var s=this.type;this.type=t,this.value=e,this.updateContext(s)};ge.readToken_dot=function(){var t=this.input.charCodeAt(this.pos+1);if(t>=48&&t<=57)return this.readNumber(true);var e=this.input.charCodeAt(this.pos+2);return this.options.ecmaVersion>=6&&t===46&&e===46?(this.pos+=3,this.finishToken(f.ellipsis)):(++this.pos,this.finishToken(f.dot))};ge.readToken_slash=function(){var t=this.input.charCodeAt(this.pos+1);return this.exprAllowed?(++this.pos,this.readRegexp()):t===61?this.finishOp(f.assign,2):this.finishOp(f.slash,1)};ge.readToken_mult_modulo_exp=function(t){var e=this.input.charCodeAt(this.pos+1),s=1,i=t===42?f.star:f.modulo;return this.options.ecmaVersion>=7&&t===42&&e===42&&(++s,i=f.starstar,e=this.input.charCodeAt(this.pos+2)),e===61?this.finishOp(f.assign,s+1):this.finishOp(i,s)};ge.readToken_pipe_amp=function(t){var e=this.input.charCodeAt(this.pos+1);if(e===t){if(this.options.ecmaVersion>=12){var s=this.input.charCodeAt(this.pos+2);if(s===61)return this.finishOp(f.assign,3)}return this.finishOp(t===124?f.logicalOR:f.logicalAND,2)}return e===61?this.finishOp(f.assign,2):this.finishOp(t===124?f.bitwiseOR:f.bitwiseAND,1)};ge.readToken_caret=function(){var t=this.input.charCodeAt(this.pos+1);return t===61?this.finishOp(f.assign,2):this.finishOp(f.bitwiseXOR,1)};ge.readToken_plus_min=function(t){var e=this.input.charCodeAt(this.pos+1);return e===t?e===45&&!this.inModule&&this.input.charCodeAt(this.pos+2)===62&&(this.lastTokEnd===0||st.test(this.input.slice(this.lastTokEnd,this.pos)))?(this.skipLineComment(3),this.skipSpace(),this.nextToken()):this.finishOp(f.incDec,2):e===61?this.finishOp(f.assign,2):this.finishOp(f.plusMin,1)};ge.readToken_lt_gt=function(t){var e=this.input.charCodeAt(this.pos+1),s=1;return e===t?(s=t===62&&this.input.charCodeAt(this.pos+2)===62?3:2,this.input.charCodeAt(this.pos+s)===61?this.finishOp(f.assign,s+1):this.finishOp(f.bitShift,s)):e===33&&t===60&&!this.inModule&&this.input.charCodeAt(this.pos+2)===45&&this.input.charCodeAt(this.pos+3)===45?(this.skipLineComment(4),this.skipSpace(),this.nextToken()):(e===61&&(s=2),this.finishOp(f.relational,s))};ge.readToken_eq_excl=function(t){var e=this.input.charCodeAt(this.pos+1);return e===61?this.finishOp(f.equality,this.input.charCodeAt(this.pos+2)===61?3:2):t===61&&e===62&&this.options.ecmaVersion>=6?(this.pos+=2,this.finishToken(f.arrow)):this.finishOp(t===61?f.eq:f.prefix,1)};ge.readToken_question=function(){var t=this.options.ecmaVersion;if(t>=11){var e=this.input.charCodeAt(this.pos+1);if(e===46){var s=this.input.charCodeAt(this.pos+2);if(s<48||s>57)return this.finishOp(f.questionDot,2)}if(e===63){if(t>=12){var i=this.input.charCodeAt(this.pos+2);if(i===61)return this.finishOp(f.assign,3)}return this.finishOp(f.coalesce,2)}}return this.finishOp(f.question,1)};ge.readToken_numberSign=function(){var t=this.options.ecmaVersion,e=35;if(t>=13&&(++this.pos,e=this.fullCharCodeAtPos(),Nt(e,true)||e===92))return this.finishToken(f.privateId,this.readWord1());this.raise(this.pos,"Unexpected character '"+Wt(e)+"'")};ge.getTokenFromCode=function(t){switch(t){case 46:return this.readToken_dot();case 40:return++this.pos,this.finishToken(f.parenL);case 41:return++this.pos,this.finishToken(f.parenR);case 59:return++this.pos,this.finishToken(f.semi);case 44:return++this.pos,this.finishToken(f.comma);case 91:return++this.pos,this.finishToken(f.bracketL);case 93:return++this.pos,this.finishToken(f.bracketR);case 123:return++this.pos,this.finishToken(f.braceL);case 125:return++this.pos,this.finishToken(f.braceR);case 58:return++this.pos,this.finishToken(f.colon);case 96:if(this.options.ecmaVersion<6)break;return++this.pos,this.finishToken(f.backQuote);case 48:var e=this.input.charCodeAt(this.pos+1);if(e===120||e===88)return this.readRadixNumber(16);if(this.options.ecmaVersion>=6){if(e===111||e===79)return this.readRadixNumber(8);if(e===98||e===66)return this.readRadixNumber(2)}case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return this.readNumber(false);case 34:case 39:return this.readString(t);case 47:return this.readToken_slash();case 37:case 42:return this.readToken_mult_modulo_exp(t);case 124:case 38:return this.readToken_pipe_amp(t);case 94:return this.readToken_caret();case 43:case 45:return this.readToken_plus_min(t);case 60:case 62:return this.readToken_lt_gt(t);case 61:case 33:return this.readToken_eq_excl(t);case 63:return this.readToken_question();case 126:return this.finishOp(f.prefix,1);case 35:return this.readToken_numberSign()}this.raise(this.pos,"Unexpected character '"+Wt(t)+"'")};ge.finishOp=function(t,e){var s=this.input.slice(this.pos,this.pos+e);return this.pos+=e,this.finishToken(t,s)};ge.readRegexp=function(){for(var t,e,s=this.pos;;){this.pos>=this.input.length&&this.raise(s,"Unterminated regular expression");var i=this.input.charAt(this.pos);if(st.test(i)&&this.raise(s,"Unterminated regular expression"),t)t=false;else{if(i==="[")e=true;else if(i==="]"&&e)e=false;else if(i==="/"&&!e)break;t=i==="\\"}++this.pos}var r=this.input.slice(s,this.pos);++this.pos;var o=this.pos,a=this.readWord1();this.containsEsc&&this.unexpected(o);var c=this.regexpState||(this.regexpState=new Ot(this));c.reset(s,r,a),this.validateRegExpFlags(c),this.validateRegExpPattern(c);var l=null;try{l=new RegExp(r,a)}catch{}return this.finishToken(f.regexp,{pattern:r,flags:a,value:l})};ge.readInt=function(t,e,s){for(var i=this.options.ecmaVersion>=12&&e===void 0,r=s&&this.input.charCodeAt(this.pos)===48,o=this.pos,a=0,c=0,l=0,h=e??1/0;l<h;++l,++this.pos){var d=this.input.charCodeAt(this.pos),m=void 0;if(i&&d===95){r&&this.raiseRecoverable(this.pos,"Numeric separator is not allowed in legacy octal numeric literals"),c===95&&this.raiseRecoverable(this.pos,"Numeric separator must be exactly one underscore"),l===0&&this.raiseRecoverable(this.pos,"Numeric separator is not allowed at the first of digits"),c=d;continue}if(d>=97?m=d-97+10:d>=65?m=d-65+10:d>=48&&d<=57?m=d-48:m=1/0,m>=t)break;c=d,a=a*t+m}return i&&c===95&&this.raiseRecoverable(this.pos-1,"Numeric separator is not allowed at the last of digits"),this.pos===o||e!=null&&this.pos-o!==e?null:a};function ef(t,e){return e?parseInt(t,8):parseFloat(t.replace(/_/g,""))}function Nu(t){return typeof BigInt!="function"?null:BigInt(t.replace(/_/g,""))}ge.readRadixNumber=function(t){var e=this.pos;this.pos+=2;var s=this.readInt(t);return s==null&&this.raise(this.start+2,"Expected number in radix "+t),this.options.ecmaVersion>=11&&this.input.charCodeAt(this.pos)===110?(s=Nu(this.input.slice(e,this.pos)),++this.pos):Nt(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number"),this.finishToken(f.num,s)};ge.readNumber=function(t){var e=this.pos;!t&&this.readInt(10,void 0,true)===null&&this.raise(e,"Invalid number");var s=this.pos-e>=2&&this.input.charCodeAt(e)===48;s&&this.strict&&this.raise(e,"Invalid number");var i=this.input.charCodeAt(this.pos);if(!s&&!t&&this.options.ecmaVersion>=11&&i===110){var r=Nu(this.input.slice(e,this.pos));return++this.pos,Nt(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number"),this.finishToken(f.num,r)}s&&/[89]/.test(this.input.slice(e,this.pos))&&(s=false),i===46&&!s&&(++this.pos,this.readInt(10),i=this.input.charCodeAt(this.pos)),(i===69||i===101)&&!s&&(i=this.input.charCodeAt(++this.pos),(i===43||i===45)&&++this.pos,this.readInt(10)===null&&this.raise(e,"Invalid number")),Nt(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number");var o=ef(this.input.slice(e,this.pos),s);return this.finishToken(f.num,o)};ge.readCodePoint=function(){var t=this.input.charCodeAt(this.pos),e;if(t===123){this.options.ecmaVersion<6&&this.unexpected();var s=++this.pos;e=this.readHexChar(this.input.indexOf("}",this.pos)-this.pos),++this.pos,e>1114111&&this.invalidStringToken(s,"Code point out of bounds")}else e=this.readHexChar(4);return e};ge.readString=function(t){for(var e="",s=++this.pos;;){this.pos>=this.input.length&&this.raise(this.start,"Unterminated string constant");var i=this.input.charCodeAt(this.pos);if(i===t)break;i===92?(e+=this.input.slice(s,this.pos),e+=this.readEscapedChar(false),s=this.pos):i===8232||i===8233?(this.options.ecmaVersion<10&&this.raise(this.start,"Unterminated string constant"),++this.pos,this.options.locations&&(this.curLine++,this.lineStart=this.pos)):(Bs(i)&&this.raise(this.start,"Unterminated string constant"),++this.pos)}return e+=this.input.slice(s,this.pos++),this.finishToken(f.string,e)};var Fu={};ge.tryReadTemplateToken=function(){this.inTemplateElement=true;try{this.readTmplToken()}catch(t){if(t===Fu)this.readInvalidTemplateToken();else throw t}this.inTemplateElement=false};ge.invalidStringToken=function(t,e){if(this.inTemplateElement&&this.options.ecmaVersion>=9)throw Fu;this.raise(t,e)};ge.readTmplToken=function(){for(var t="",e=this.pos;;){this.pos>=this.input.length&&this.raise(this.start,"Unterminated template");var s=this.input.charCodeAt(this.pos);if(s===96||s===36&&this.input.charCodeAt(this.pos+1)===123)return this.pos===this.start&&(this.type===f.template||this.type===f.invalidTemplate)?s===36?(this.pos+=2,this.finishToken(f.dollarBraceL)):(++this.pos,this.finishToken(f.backQuote)):(t+=this.input.slice(e,this.pos),this.finishToken(f.template,t));if(s===92)t+=this.input.slice(e,this.pos),t+=this.readEscapedChar(true),e=this.pos;else if(Bs(s)){switch(t+=this.input.slice(e,this.pos),++this.pos,s){case 13:this.input.charCodeAt(this.pos)===10&&++this.pos;case 10:t+=`
6
6
  `;break;default:t+=String.fromCharCode(s);break}this.options.locations&&(++this.curLine,this.lineStart=this.pos),e=this.pos}else++this.pos}};ge.readInvalidTemplateToken=function(){for(;this.pos<this.input.length;this.pos++)switch(this.input[this.pos]){case"\\":++this.pos;break;case"$":if(this.input[this.pos+1]!=="{")break;case"`":return this.finishToken(f.invalidTemplate,this.input.slice(this.start,this.pos));case"\r":this.input[this.pos+1]===`
7
7
  `&&++this.pos;case`
8
8
  `:case"\u2028":case"\u2029":++this.curLine,this.lineStart=this.pos+1;break}this.raise(this.start,"Unterminated template")};ge.readEscapedChar=function(t){var e=this.input.charCodeAt(++this.pos);switch(++this.pos,e){case 110:return`
9
- `;case 114:return"\r";case 120:return String.fromCharCode(this.readHexChar(2));case 117:return Wt(this.readCodePoint());case 116:return" ";case 98:return"\b";case 118:return"\v";case 102:return"\f";case 13:this.input.charCodeAt(this.pos)===10&&++this.pos;case 10:return this.options.locations&&(this.lineStart=this.pos,++this.curLine),"";case 56:case 57:if(this.strict&&this.invalidStringToken(this.pos-1,"Invalid escape sequence"),t){var s=this.pos-1;this.invalidStringToken(s,"Invalid escape sequence in template string")}default:if(e>=48&&e<=55){var i=this.input.substr(this.pos-1,3).match(/^[0-7]+/)[0],r=parseInt(i,8);return r>255&&(i=i.slice(0,-1),r=parseInt(i,8)),this.pos+=i.length-1,e=this.input.charCodeAt(this.pos),(i!=="0"||e===56||e===57)&&(this.strict||t)&&this.invalidStringToken(this.pos-1-i.length,t?"Octal literal in template string":"Octal literal in strict mode"),String.fromCharCode(r)}return Os(e)?(this.options.locations&&(this.lineStart=this.pos,++this.curLine),""):String.fromCharCode(e)}};ge.readHexChar=function(t){var e=this.pos,s=this.readInt(16,t);return s===null&&this.invalidStringToken(e,"Bad character escape sequence"),s};ge.readWord1=function(){this.containsEsc=false;for(var t="",e=true,s=this.pos,i=this.options.ecmaVersion>=6;this.pos<this.input.length;){var r=this.fullCharCodeAtPos();if(cs(r,i))this.pos+=r<=65535?1:2;else if(r===92){this.containsEsc=true,t+=this.input.slice(s,this.pos);var a=this.pos;this.input.charCodeAt(++this.pos)!==117&&this.invalidStringToken(this.pos,"Expecting Unicode escape sequence \\uXXXX"),++this.pos;var o=this.readCodePoint();(e?Nt:cs)(o,i)||this.invalidStringToken(a,"Invalid Unicode escape"),t+=Wt(o),s=this.pos}else break;e=false}return t+this.input.slice(s,this.pos)};ge.readWord=function(){var t=this.readWord1(),e=f.name;return this.keywords.test(t)&&(e=Ta[t]),this.finishToken(e,t)};var tf="8.15.0";Ne.acorn={Parser:Ne,version:tf,defaultOptions:Qn,Position:ri,SourceLocation:mr,getLineInfo:au,Node:_r,TokenType:ye,tokTypes:f,keywordTypes:Ta,TokContext:ft,tokContexts:Te,isIdentifierChar:cs,isIdentifierStart:Nt,Token:La,isNewLine:Os,lineBreak:st,lineBreakG:wh,nonASCIIwhitespace:ru};function sf(t,e){return Ne.parse(t,e)}const rf=new Set(["slider","color","toggle","select","number","text","image","button","coordinate","gradient"]);function nf(t){return t==="button"?0:1}const Da="__vijiNameMissingLine";function af(t){if(t.type!=="CallExpression")return null;const e=t.callee;if(!e||e.type!=="MemberExpression"||e.computed)return null;const s=e.object,i=e.property;if(!s||s.type!=="Identifier"||s.name!=="viji"||!i||i.type!=="Identifier")return null;const r=i.name;return rf.has(r)?r:null}function of(t,e){if(!t)return null;if(t.type==="VariableDeclarator"&&t.init===e){const s=t.id;return s?.type==="Identifier"?s.name:null}if(t.type==="Property"&&t.value===e&&!t.computed){const s=t.key;return s?.type==="Identifier"?s.name:null}if(t.type==="AssignmentExpression"&&t.right===e&&t.operator==="="){const s=t.left;if(s?.type==="MemberExpression"&&!s.computed){const i=s.property;if(i?.type==="Identifier")return i.name}return null}return null}function cf(t){for(const e of t.properties){if(e.type!=="Property"||e.computed)continue;const s=e.key;if((s.type==="Identifier"?s.name:s.type==="Literal"&&typeof s.value=="string"?s.value:null)!=="name")continue;const r=e.value;return r.type==="Literal"&&typeof r.value=="string"?r.value:null}return null}function ta(t,e,s){s(t,e);for(const i of Object.keys(t)){if(i==="loc")continue;const r=t[i];if(Array.isArray(r))for(const a of r)a&&typeof a.type=="string"&&ta(a,t,s);else r&&typeof r.type=="string"&&ta(r,t,s)}}function uf(t){let e;const s=[];try{e=sf(t,{ecmaVersion:"latest",allowReturnOutsideFunction:true,allowAwaitOutsideFunction:true,locations:true,onComment:(c,l,h,d)=>s.push({start:h,end:d})})}catch(c){return{code:t,error:{code:"SCENE_PARSE_ERROR",message:`Scene code could not be parsed: ${c.message}`}}}const i=[],r=new Map,a=[];if(ta(e,null,(c,l)=>{const h=af(c);if(!h)return;const d=c.loc?.start.line??0,m=of(l,c),_=c.arguments,x=nf(h);if(_.some(P=>P.type==="SpreadElement"))return;const E=_.length>x?_[x]:null,N=E?.type==="ObjectExpression"?cf(E):null,F=N??m;if(F!==null){const P=r.get(F);P!==void 0?a.push({name:F,firstLine:P,line:d}):r.set(F,d)}let U;if(m!==null)U=`name:${JSON.stringify(m)},`;else{if(N!==null)return;U=`${Da}:${d},`}if(E)E.type==="ObjectExpression"?i.push({pos:E.start+1,text:U}):(i.push({pos:E.start,text:`{ ${U} ...`}),i.push({pos:E.end,text:" }"}));else{let P="";if(_.length>0){const X=_[_.length-1].end,$=c.end-1;let te=false;for(let ee=X;ee<$;ee++)if(t[ee]===","&&!s.some(Q=>ee>=Q.start&&ee<Q.end)){te=true;break}P=te?" ":", "}i.push({pos:c.end-1,text:`${P}{ ${U} }`})}}),a.length>0){const c=a[0];return{code:t,error:{code:"PARAM_NAME_DUPLICATE",message:`Duplicate parameter name '${c.name}' (line ${c.firstLine} and line ${c.line}). Parameter names are scene-global — rename one, or pass name:'...' to distinguish them.`+(a.length>1?` (${a.length-1} more duplicate${a.length>2?"s":""} after this one.)`:"")}}}if(i.length===0)return{code:t,error:null};i.sort((c,l)=>l.pos-c.pos);let o=t;for(const c of i)o=o.slice(0,c.pos)+c.text+o.slice(c.pos);return{code:o,error:null}}function jo(t,e){const s=Math.abs(e-t);if(s<=0)return 1;const i=Math.pow(10,Math.floor(Math.log10(s/100)));return Math.max(i,Number.EPSILON)}const lf=/^[A-Za-z_$][A-Za-z0-9_$]*$/,hf=new Set(["__proto__","constructor","prototype",Da]);function kt(t){const e=t?.name;if(typeof e=="string"&&e.length>0)return e;const s=t?.[Da];throw new Error("[PARAM_NAME_MISSING] Parameter created without a name"+(typeof s=="number"?` (line ${s})`:"")+": assign it to a variable or object key, or pass name:'...'.")}class ff{parameterDefinitions=new Map;parameterGroups=new Map;parameterValues=new Map;parameterObjects=new Map;parametersDefined=false;initialValuesSynced=false;debugMode=false;setDebugMode(e){this.debugMode=e}debugLog(e,...s){this.debugMode&&console.log(e,...s)}postMessageCallback;constructor(e){this.postMessageCallback=e}createSliderParameter(e,s){const i=kt(s),r=s.min??0,a=s.max??100,o={value:e,min:r,max:a,step:s.step??jo(r,a),...s.label!==void 0&&{label:s.label},description:s.description??"",group:s.group??"general",category:s.category??"general"},c={type:"slider",defaultValue:e,...o.label!==void 0&&{label:o.label},description:o.description,group:o.group,category:o.category,config:{min:o.min,max:o.max,step:o.step}};return this.storeParameterDefinition(i,c),this.parameterObjects.set(i,o),o}createColorParameter(e,s){const i=kt(s),r=s.alpha===true,a=ji(e,{alpha:r}),o={value:a,alpha:ii(a),rgb:Object.freeze(Dt(a)),hsb:Object.freeze(To(a)),...s.label!==void 0&&{label:s.label},description:s.description??"",group:s.group??"general",category:s.category??"general"},c={type:"color",defaultValue:a,...o.label!==void 0&&{label:o.label},description:o.description,group:o.group,category:o.category,config:{alpha:r}};return this.storeParameterDefinition(i,c),this.parameterObjects.set(i,o),o}createToggleParameter(e,s){const i=kt(s),r={value:e,...s.label!==void 0&&{label:s.label},description:s.description??"",group:s.group??"general",category:s.category??"general"},a={type:"toggle",defaultValue:e,...r.label!==void 0&&{label:r.label},description:r.description,group:r.group,category:r.category};return this.storeParameterDefinition(i,a),this.parameterObjects.set(i,r),r}createSelectParameter(e,s){const i=kt(s),r={value:e,options:s.options,...s.label!==void 0&&{label:s.label},description:s.description??"",group:s.group??"general",category:s.category??"general"},a={type:"select",defaultValue:e,...r.label!==void 0&&{label:r.label},description:r.description,group:r.group,category:r.category,config:{options:r.options}};return this.storeParameterDefinition(i,a),this.parameterObjects.set(i,r),r}createTextParameter(e,s){const i=kt(s),r={value:e,maxLength:s.maxLength??1e3,...s.label!==void 0&&{label:s.label},description:s.description??"",group:s.group??"general",category:s.category??"general"},a={type:"text",defaultValue:e,...r.label!==void 0&&{label:r.label},description:r.description,group:r.group,category:r.category,config:{maxLength:r.maxLength}};return this.storeParameterDefinition(i,a),this.parameterObjects.set(i,r),r}createNumberParameter(e,s){const i=kt(s),r=s.min??0,a=s.max??100,o={value:e,min:r,max:a,step:s.step??jo(r,a),...s.label!==void 0&&{label:s.label},description:s.description??"",group:s.group??"general",category:s.category??"general"},c={type:"number",defaultValue:e,...o.label!==void 0&&{label:o.label},description:o.description,group:o.group,category:o.category,config:{min:o.min,max:o.max,step:o.step}};return this.storeParameterDefinition(i,c),this.parameterObjects.set(i,o),o}createImageParameter(e,s){const i=kt(s),r={value:e,...s.label!==void 0&&{label:s.label},description:s.description??"",group:s.group??"general",category:s.category??"general"},a={type:"image",defaultValue:e,...r.label!==void 0&&{label:r.label},description:r.description,group:r.group,category:r.category};return this.storeParameterDefinition(i,a),this.parameterObjects.set(i,r),r}createButtonParameter(e){const s=kt(e),i={value:false,...e.label!==void 0&&{label:e.label},description:e.description??"",group:e.group??"general",category:e.category??"general"},r={type:"button",defaultValue:false,...i.label!==void 0&&{label:i.label},description:i.description,group:i.group,category:i.category};return this.storeParameterDefinition(s,r),this.parameterObjects.set(s,i),i}createCoordinateParameter(e,s){const i=kt(s),r={value:{x:e.x,y:e.y},step:s.step??.01,...s.label!==void 0&&{label:s.label},description:s.description??"",group:s.group??"general",category:s.category??"general"},a={type:"coordinate",defaultValue:{x:e.x,y:e.y},...r.label!==void 0&&{label:r.label},description:r.description,group:r.group,category:r.category,config:{min:-1,max:1,step:r.step}};return this.storeParameterDefinition(i,a),this.parameterObjects.set(i,r),r}createGradientParameter(e,s){const i=kt(s),r=Ni(s),a=Kn(e,r),o={value:a,at(l){return mh(o.value,l,{alpha:r.alpha})},...s.label!==void 0&&{label:s.label},description:s.description??"",group:s.group??"general",category:s.category??"general"},c={type:"gradient",defaultValue:a,...o.label!==void 0&&{label:o.label},description:o.description,group:o.group,category:o.category,config:{alpha:r.alpha,minStops:r.minStops,maxStops:r.maxStops}};return this.storeParameterDefinition(i,c),this.parameterObjects.set(i,o),o}storeParameterDefinition(e,s){if(!lf.test(e))throw new Error(`[PARAM_NAME_INVALID] Parameter name "${e}" is not a valid identifier (letters, digits, _ and $, not starting with a digit).`);if(hf.has(e))throw new Error(`[PARAM_NAME_INVALID] Parameter name "${e}" is reserved.`);if(this.parameterDefinitions.has(e))throw new Error(`[PARAM_NAME_DUPLICATE] Duplicate parameter name "${e}". Parameter names are scene-global — rename one, or pass name:'...' to distinguish them.`);const i={name:e,...s};this.parameterDefinitions.set(e,i),this.parameterValues.set(e,i.defaultValue)}updateParameterValue(e,s){const i=this.parameterDefinitions.get(e);if(!i)return console.warn(`Unknown parameter: ${e}. Available parameters:`,Array.from(this.parameterDefinitions.keys())),false;if(i.type==="color")try{s=ji(s,{alpha:i.config?.alpha===true})}catch(l){return console.error(`Parameter '${e}' invalid color: ${l.message}`),false}if(i.type==="gradient")try{s=Kn(s,Ni(i.config??{}))}catch(l){return console.error(`Parameter '${e}' invalid gradient: ${l.message}`),false}if(!this.validateParameterValue(e,s,i))return console.warn(`Validation failed for parameter ${e} = ${s}`),false;const r=this.parameterValues.get(e),a=!this.initialValuesSynced;if((i.type==="coordinate"?r&&s&&typeof r=="object"&&typeof s=="object"&&"x"in r&&"x"in s&&r.x===s.x&&r.y===s.y:i.type==="gradient"?ph(r,s):r===s)&&!a)return false;if(i.type==="image"&&r instanceof ImageBitmap&&r!==s&&!this.isHeldByLiveValue(r,e))try{r.close()}catch{}this.parameterValues.set(e,s);const c=this.parameterObjects.get(e);if(c&&(c.value=s,i.type==="color")){const l=s;c.alpha=ii(l),c.rgb=Object.freeze(Dt(l)),c.hsb=Object.freeze(To(l))}return true}validateParameterValue(e,s,i){if(i.validate&&!i.validate(s))return console.error(`Custom validation failed for parameter '${e}': ${s}`),false;switch(i.type){case"slider":case"number":if(typeof s!="number"||isNaN(s))return console.error(`Parameter '${e}' must be a number, got: ${s}`),false;if(i.config?.min!==void 0&&s<i.config.min)return console.error(`Parameter '${e}' value ${s} is below minimum ${i.config.min}`),false;if(i.config?.max!==void 0&&s>i.config.max)return console.error(`Parameter '${e}' value ${s} is above maximum ${i.config.max}`),false;break;case"color":{const r=i.config?.alpha===true;if(typeof s!="string"||!(r?Eo:So).test(s))return console.error(`Parameter '${e}' must be normalized lowercase hex '${r?"#rrggbbaa":"#rrggbb"}', got: ${s}`),false;break}case"toggle":if(typeof s!="boolean")return console.error(`Parameter '${e}' must be a boolean, got: ${s}`),false;break;case"select":if(!i.config?.options||!i.config.options.includes(s))return console.error(`Parameter '${e}' value ${s} is not in options: ${i.config?.options}`),false;break;case"text":if(typeof s!="string")return console.error(`Parameter '${e}' must be a string, got: ${s}`),false;if(i.config?.maxLength&&s.length>i.config.maxLength)return console.error(`Parameter '${e}' text too long: ${s.length} > ${i.config.maxLength}`),false;break;case"image":if(s!==null&&!(s instanceof ImageBitmap))return console.error(`Parameter '${e}' must be null or ImageBitmap, got: ${s}`),false;break;case"button":if(typeof s!="boolean")return console.error(`Parameter '${e}' must be a boolean, got: ${s}`),false;break;case"coordinate":{if(!s||typeof s!="object"||!("x"in s)||!("y"in s))return console.error(`Parameter '${e}' must be an object with x and y properties, got: ${s}`),false;const r=s;if(typeof r.x!="number"||isNaN(r.x)||typeof r.y!="number"||isNaN(r.y))return console.error(`Parameter '${e}' x and y must be numbers, got: x=${r.x}, y=${r.y}`),false;if(r.x<-1||r.x>1||r.y<-1||r.y>1)return console.error(`Parameter '${e}' x and y must be between -1 and 1, got: x=${r.x}, y=${r.y}`),false;break}case"gradient":{const r=Ni(i.config??{}),a=r.alpha?Eo:So;if(!Array.isArray(s)||s.length<r.minStops||s.length>r.maxStops)return console.error(`Parameter '${e}' must be an array of ${r.minStops}..${r.maxStops} gradient stops, got: ${s}`),false;let o=-1;for(const c of s){const l=c;if(!l||typeof l.color!="string"||!a.test(l.color)||typeof l.position!="number"||!isFinite(l.position)||l.position<0||l.position>1||l.position<o)return console.error(`Parameter '${e}' has an invalid or unsorted gradient stop: ${JSON.stringify(c)}`),false;o=l.position}break}}return true}resetParameterState(){for(const[e,s]of this.parameterDefinitions){if(s.type!=="image")continue;const i=this.parameterValues.get(e);if(typeof ImageBitmap<"u"&&i instanceof ImageBitmap)try{i.close()}catch{}}this.parametersDefined=false,this.initialValuesSynced=false,this.parameterDefinitions.clear(),this.parameterGroups.clear(),this.parameterValues.clear(),this.parameterObjects.clear()}sendAllParametersToHost(){if(!this.parametersDefined)try{const e=new Map;for(const[s,i]of this.parameterDefinitions){const r=i.group||"general";if(!e.has(r)){const o=i.category||"general";e.set(r,{groupName:r,category:o,parameters:{}})}const a=e.get(r);a.parameters[s]=i}this.parametersDefined=true,this.postMessageCallback("parameters-defined",{groups:Array.from(e.values())}),this.debugLog(`All parameters sent to host: ${this.parameterDefinitions.size} parameters in ${e.size} groups`)}catch(e){this.postMessageCallback("parameter-validation-error",{message:`Failed to send parameters to host: ${e.message}`,code:"PARAMETER_SENDING_ERROR"})}}markInitialValuesSynced(){this.initialValuesSynced=true}seedInitialValues(e){for(const[s,i]of Object.entries(e)){if(!this.parameterDefinitions.has(s)){this.debugLog(`Skipping initial value for undefined parameter: ${s}`),this.releaseUnappliedValue(s,i);continue}this.updateParameterValue(s,i)||this.releaseUnappliedValue(s,i)}this.markInitialValuesSynced()}releaseUnappliedValue(e,s){if(!(typeof ImageBitmap>"u"||!(s instanceof ImageBitmap))&&!(this.parameterValues.get(e)===s||this.isHeldByLiveValue(s)))try{s.close()}catch{}}isHeldByLiveValue(e,s){for(const[i,r]of this.parameterValues)if(i!==s&&r===e)return true;return false}releaseSeedBitmaps(e){for(const[s,i]of Object.entries(e))this.releaseUnappliedValue(s,i)}getParameterCount(){return this.parameterDefinitions.size}getAllParameterObjects(){return this.parameterObjects}resetButtonParameters(){for(const[e,s]of this.parameterDefinitions)if(s.type==="button"){const i=this.parameterObjects.get(e);i&&i.value===true&&(i.value=false,this.parameterValues.set(e,false))}}}class df{isEnabled=true;previousButtons=0;previousTouchPositions=new Map;mouseState={x:0,y:0,isInCanvas:false,isPressed:false,leftButton:false,rightButton:false,middleButton:false,deltaX:0,deltaY:0,wheelDelta:0,wheelX:0,wheelY:0,wasPressed:false,wasReleased:false,wasMoved:false};keyboardState={isPressed:e=>this.keyboardState.activeKeys.has(e.toLowerCase()),wasPressed:e=>this.keyboardState.pressedThisFrame.has(e.toLowerCase()),wasReleased:e=>this.keyboardState.releasedThisFrame.has(e.toLowerCase()),activeKeys:new Set,pressedThisFrame:new Set,releasedThisFrame:new Set,lastKeyPressed:"",lastKeyReleased:"",shift:false,ctrl:false,alt:false,meta:false,textureData:null};touchState={points:[],count:0,started:[],moved:[],ended:[],primary:null};keyboardTextureData=new Uint8Array(256*3);pointerState={x:0,y:0,deltaX:0,deltaY:0,isDown:false,wasPressed:false,wasReleased:false,isInCanvas:false,type:"none"};previousPointerDown=false;keyboardConsumedThisFrame=false;constructor(){this.keyboardState.textureData=this.keyboardTextureData;const e=this.keyboardState.isPressed,s=this.keyboardState.wasPressed,i=this.keyboardState.wasReleased;this.keyboardState.isPressed=r=>{const a=e(r);return a&&(this.keyboardConsumedThisFrame=true),a},this.keyboardState.wasPressed=r=>{const a=s(r);return a&&(this.keyboardConsumedThisFrame=true),a},this.keyboardState.wasReleased=r=>{const a=i(r);return a&&(this.keyboardConsumedThisFrame=true),a},this.handleMouseUpdate=this.handleMouseUpdate.bind(this),this.handleKeyboardUpdate=this.handleKeyboardUpdate.bind(this),this.handleTouchUpdate=this.handleTouchUpdate.bind(this),this.frameStart=this.frameStart.bind(this)}getKeyboardConsumed(){return this.keyboardConsumedThisFrame}getMouseState(){return this.mouseState}getPointerState(){return this.pointerState}getTouchCount(){return this.touchState.count}getInteractionAPIs(){return{mouse:this.mouseState,keyboard:this.keyboardState,touches:this.touchState,pointer:this.pointerState}}frameStart(){this.mouseState.wasPressed=false,this.mouseState.wasReleased=false,this.mouseState.wasMoved=false,this.mouseState.deltaX=0,this.mouseState.deltaY=0,this.mouseState.wheelDelta=0,this.mouseState.wheelX=0,this.mouseState.wheelY=0,this.keyboardState.pressedThisFrame.clear(),this.keyboardState.releasedThisFrame.clear(),this.keyboardTextureData.fill(0,256,512),this.touchState.started=[],this.touchState.moved=[],this.touchState.ended=[],this.keyboardConsumedThisFrame=false}handleMouseUpdate(e){if(!this.isEnabled)return;this.mouseState.x=e.x,this.mouseState.y=e.y,this.mouseState.isInCanvas=e.isInCanvas!==void 0?e.isInCanvas:true,this.mouseState.leftButton=(e.buttons&1)!==0,this.mouseState.rightButton=(e.buttons&2)!==0,this.mouseState.middleButton=(e.buttons&4)!==0,this.mouseState.isPressed=e.buttons>0,this.mouseState.deltaX+=e.deltaX||0,this.mouseState.deltaY+=e.deltaY||0,this.mouseState.wheelDelta+=e.wheelDeltaY||0,this.mouseState.wheelX+=e.wheelDeltaX||0,this.mouseState.wheelY+=e.wheelDeltaY||0;const s=e.buttons&~this.previousButtons,i=this.previousButtons&~e.buttons;this.mouseState.wasPressed=this.mouseState.wasPressed||s!==0,this.mouseState.wasReleased=this.mouseState.wasReleased||i!==0,this.mouseState.wasMoved=this.mouseState.wasMoved||e.deltaX!==0||e.deltaY!==0,this.previousButtons=e.buttons}handleKeyboardUpdate(e){if(!this.isEnabled)return;const s=e.key.toLowerCase();if(e.type==="keydown"){if(!this.keyboardState.activeKeys.has(s)){this.keyboardState.activeKeys.add(s),this.keyboardState.pressedThisFrame.add(s),this.keyboardState.lastKeyPressed=e.key;const i=e.keyCode;i!==void 0&&i>=0&&i<=255&&(this.keyboardTextureData[i]=255,this.keyboardTextureData[256+i]=255,this.keyboardTextureData[512+i]^=255)}}else if(e.type==="keyup"){this.keyboardState.activeKeys.delete(s),this.keyboardState.releasedThisFrame.add(s),this.keyboardState.lastKeyReleased=e.key;const i=e.keyCode;i!==void 0&&i>=0&&i<=255&&(this.keyboardTextureData[i]=0)}this.keyboardState.shift=e.shiftKey,this.keyboardState.ctrl=e.ctrlKey,this.keyboardState.alt=e.altKey,this.keyboardState.meta=e.metaKey}handleTouchUpdate(e){if(!this.isEnabled)return;const s=e.touches.map(a=>{const o=a.identifier,c=!!a.ended;let l=0,h=0,d=0,m=0;const _=this.previousTouchPositions.get(o);if(_){l=a.clientX-_.x,h=a.clientY-_.y;const x=(e.timestamp-_.timestamp)/1e3;x>0&&(d=l/x,m=h/x)}return c?this.previousTouchPositions.delete(o):this.previousTouchPositions.set(o,{x:a.clientX,y:a.clientY,timestamp:e.timestamp}),{id:o,x:a.clientX,y:a.clientY,pressure:a.force,radius:Math.max(a.radiusX,a.radiusY),radiusX:a.radiusX,radiusY:a.radiusY,rotationAngle:a.rotationAngle,force:a.force,isInCanvas:a.isInCanvas,deltaX:l,deltaY:h,velocity:{x:d,y:m},isNew:e.type==="touchstart"&&!_,isActive:!c,isEnding:c}}),i=s.filter(a=>a.isActive),r=s.filter(a=>a.isEnding);this.touchState.points=i,this.touchState.count=i.length,this.touchState.primary=i[0]||null,e.type==="touchstart"?this.touchState.started.push(...s.filter(a=>a.isNew)):e.type==="touchmove"?this.touchState.moved=i:(e.type==="touchend"||e.type==="touchcancel")&&this.touchState.ended.push(...r)}updatePointerState(){const e=this.touchState,s=this.mouseState;if(e.count>0&&e.primary){const i=e.primary;this.pointerState.x=i.x,this.pointerState.y=i.y,this.pointerState.deltaX=i.deltaX,this.pointerState.deltaY=i.deltaY,this.pointerState.isDown=true,this.pointerState.isInCanvas=i.isInCanvas,this.pointerState.type="touch"}else this.pointerState.x=s.x,this.pointerState.y=s.y,this.pointerState.deltaX=s.deltaX,this.pointerState.deltaY=s.deltaY,this.pointerState.isDown=s.leftButton,this.pointerState.isInCanvas=s.isInCanvas,this.pointerState.type=s.isInCanvas?"mouse":"none";this.pointerState.wasPressed=this.pointerState.isDown&&!this.previousPointerDown,this.pointerState.wasReleased=!this.pointerState.isDown&&this.previousPointerDown,this.previousPointerDown=this.pointerState.isDown}resetInteractionState(){Object.assign(this.mouseState,{x:0,y:0,isInCanvas:false,isPressed:false,leftButton:false,rightButton:false,middleButton:false,deltaX:0,deltaY:0,wheelDelta:0,wheelX:0,wheelY:0,wasPressed:false,wasReleased:false,wasMoved:false}),this.keyboardState.activeKeys.clear(),this.keyboardState.pressedThisFrame.clear(),this.keyboardState.releasedThisFrame.clear(),this.keyboardState.lastKeyPressed="",this.keyboardState.lastKeyReleased="",this.keyboardState.shift=false,this.keyboardState.ctrl=false,this.keyboardState.alt=false,this.keyboardState.meta=false,this.keyboardTextureData.fill(0),this.touchState.points=[],this.touchState.count=0,this.touchState.started=[],this.touchState.moved=[],this.touchState.ended=[],this.touchState.primary=null,this.previousTouchPositions.clear(),Object.assign(this.pointerState,{x:0,y:0,deltaX:0,deltaY:0,isDown:false,wasPressed:false,wasReleased:false,isInCanvas:false,type:"none"}),this.previousPointerDown=false}setInteractionEnabled(e){this.isEnabled=e,e||this.resetInteractionStates()}getInteractionEnabled(){return this.isEnabled}resetInteractionStates(){this.mouseState.x=0,this.mouseState.y=0,this.mouseState.isInCanvas=false,this.mouseState.isPressed=false,this.mouseState.leftButton=false,this.mouseState.rightButton=false,this.mouseState.middleButton=false,this.mouseState.deltaX=0,this.mouseState.deltaY=0,this.mouseState.wheelDelta=0,this.mouseState.wheelX=0,this.mouseState.wheelY=0,this.mouseState.wasPressed=false,this.mouseState.wasReleased=false,this.mouseState.wasMoved=false,this.keyboardState.activeKeys.clear(),this.keyboardState.pressedThisFrame.clear(),this.keyboardState.releasedThisFrame.clear(),this.keyboardState.lastKeyPressed="",this.keyboardState.lastKeyReleased="",this.keyboardState.shift=false,this.keyboardState.ctrl=false,this.keyboardState.alt=false,this.keyboardState.meta=false,this.keyboardTextureData.fill(0),this.touchState.points=[],this.touchState.count=0,this.touchState.started=[],this.touchState.moved=[],this.touchState.ended=[],this.touchState.primary=null,this.previousTouchPositions.clear(),this.pointerState.x=0,this.pointerState.y=0,this.pointerState.deltaX=0,this.pointerState.deltaY=0,this.pointerState.isDown=false,this.pointerState.wasPressed=false,this.pointerState.wasReleased=false,this.pointerState.isInCanvas=false,this.pointerState.type="none",this.previousPointerDown=false}}const qo={activeFeatures:[],processingTime:0,targetFPS:0,actualFPS:0,isProcessing:false},Ho={faceDetection:{active:false,meaningful:false},faceMesh:{active:false,meaningful:false},emotion:{active:false,meaningful:false},handTracking:{active:false,meaningful:false},poseDetection:{active:false,meaningful:false},segmentation:{active:false,meaningful:false}},pf={faceDetection:"faceDetection",faceMesh:"faceMesh",emotionDetection:"emotion",handTracking:"handTracking",poseDetection:"poseDetection",bodySegmentation:"segmentation"};class mf{desired=new Set;results={faces:[],hands:[],pose:null,segmentation:null};stats={...qo};activity=structuredClone(Ho);analysedCanvas=null;analysedCtx=null;analysedFrameValid=false;analysedFrameData=null;analysedFrameDataDirty=false;streamIndex=0;sendRequest=null;debugMode=false;setMessaging(e,s){this.streamIndex=e,this.sendRequest=s,this.desired.size>0&&this.sendRequest(this.streamIndex,[...this.desired])}setDebugMode(e){this.debugMode=e}handleResultsUpdate(e){this.results.faces=e.results.faces??[],this.results.hands=e.results.hands??[],this.results.pose=e.results.pose??null,this.results.segmentation=e.results.segmentation??null,this.stats=e.stats,this.activity=e.activity,e.analysedFrame&&this.acceptAnalysedFrame(e.analysedFrame),this.debugLog(`cv-results-update applied (stream ${e.streamIndex})`)}getResults(){return this.results}getAnalysedFrame(){return this.analysedFrameValid?this.analysedCanvas:null}getAnalysedFrameData(){return!this.analysedFrameValid||!this.analysedCanvas||!this.analysedCtx?null:((this.analysedFrameDataDirty||!this.analysedFrameData)&&(this.analysedFrameData=this.analysedCtx.getImageData(0,0,this.analysedCanvas.width,this.analysedCanvas.height),this.analysedFrameDataDirty=false),this.analysedFrameData)}getStats(){return{...this.stats}}getCVActivity(){const e=new Set([...this.desired].map(i=>pf[i])),s=i=>({active:e.has(i)&&this.activity[i].active,meaningful:this.activity[i].meaningful});return{faceDetection:s("faceDetection"),faceMesh:s("faceMesh"),emotion:s("emotion"),handTracking:s("handTracking"),poseDetection:s("poseDetection"),segmentation:s("segmentation")}}hasActiveFeatures(){return this.desired.size>0}reset(){const e=this.desired.size>0;this.desired.clear(),this.clearResults(),e&&this.sendRequest?.(this.streamIndex,[])}clearResults(){this.results.faces=[],this.results.hands=[],this.results.pose=null,this.results.segmentation=null,this.stats={...qo},this.activity=structuredClone(Ho),this.analysedFrameValid&&this.analysedCtx&&this.analysedCanvas&&this.analysedCtx.clearRect(0,0,this.analysedCanvas.width,this.analysedCanvas.height),this.analysedFrameValid=false,this.analysedFrameData=null,this.analysedFrameDataDirty=false}getControlInterface(){const e=i=>r=>this.setFeature(i,r!==false),s=i=>()=>this.setFeature(i,false);return{enableFaceDetection:e("faceDetection"),disableFaceDetection:s("faceDetection"),enableFaceMesh:e("faceMesh"),disableFaceMesh:s("faceMesh"),enableEmotionDetection:e("emotionDetection"),disableEmotionDetection:s("emotionDetection"),enableHandTracking:e("handTracking"),disableHandTracking:s("handTracking"),enablePoseDetection:e("poseDetection"),disablePoseDetection:s("poseDetection"),enableBodySegmentation:e("bodySegmentation"),disableBodySegmentation:s("bodySegmentation"),getActiveFeatures:()=>Array.from(this.desired),isProcessing:()=>this.stats.isProcessing,getStats:()=>this.getStats(),getWorkerStatus:()=>({healthy:true,restartCount:0,maxRestarts:3}),restartWorker:()=>Promise.resolve(),checkWebGLAvailability:()=>this.checkWebGLContextAvailability(),getResourceUsage:()=>({activeFeatures:this.desired.size,estimatedWebGLContexts:this.desired.size*2,webglAvailable:this.checkWebGLContextAvailability()})}}setFeature(e,s){const i=this.desired.has(e);return s===i||(s?this.desired.add(e):(this.desired.delete(e),this.clearFamilyLocally(e),this.desired.size===0&&(this.analysedFrameValid=false,this.analysedFrameData=null,this.analysedFrameDataDirty=false)),this.sendRequest?.(this.streamIndex,[...this.desired])),Promise.resolve()}clearFamilyLocally(e){const s=["faceDetection","faceMesh","emotionDetection"];s.includes(e)?s.some(i=>this.desired.has(i))||(this.results.faces=[]):e==="handTracking"?this.results.hands=[]:e==="poseDetection"?this.results.pose=null:e==="bodySegmentation"&&(this.results.segmentation=null)}acceptAnalysedFrame(e){try{if(this.analysedCanvas||(this.analysedCanvas=new OffscreenCanvas(e.width,e.height),this.analysedCtx=this.analysedCanvas.getContext("2d",{willReadFrequently:true})),!this.analysedCtx)return;(this.analysedCanvas.width!==e.width||this.analysedCanvas.height!==e.height)&&(this.analysedCanvas.width=e.width,this.analysedCanvas.height=e.height),this.analysedCtx.drawImage(e,0,0),this.analysedFrameValid=true,this.analysedFrameDataDirty=true}finally{try{e.close()}catch{}}}checkWebGLContextAvailability(){try{const e=new OffscreenCanvas(1,1);return(e.getContext("webgl2")??e.getContext("webgl"))!==null}catch{return false}}debugLog(e,...s){this.debugMode&&console.log(`[CVSurfaceState] ${e}`,...s)}}class Ti{offscreenCanvas=null;ctx=null;gl=null;debugMode=false;directGPUMode=false;deviceId;setDebugMode(e){this.debugMode=e,this.cvSurfaceState&&this.cvSurfaceState.setDebugMode(e)}debugLog(e,...s){this.debugMode&&console.log(e,...s)}targetFrameRate=30;lastFrameTime=0;frameInterval=1e3/this.targetFrameRate;hasLoggedFirstFrame=false;frameCount=0;videoState={isConnected:false,currentFrame:null,frameWidth:0,frameHeight:0,frameRate:0,frameData:null};frameDataDirty=false;cvSurfaceState;cvSurface;constructor(){this.cvSurfaceState=new mf;const e=this,s=this.cvSurfaceState.getControlInterface();this.cvSurface={analysedFrame:null,getAnalysedFrameData:()=>e.cvSurfaceState.getAnalysedFrameData(),faces:[],hands:[],pose:null,segmentation:null,...s}}getCvSurface(){return this.cvSurface}setCVMessaging(e,s){this.cvSurfaceState.setMessaging(e,s)}handleCVResultsUpdate(e){this.cvSurfaceState.handleResultsUpdate(e)}setDeviceId(e){this.deviceId=e}getDeviceId(){return this.deviceId}peekDebugState(){return{isConnected:this.videoState.isConnected,hasFrame:this.videoState.currentFrame!==null}}getVideoAPI(){const e=this.videoState.currentFrame;this.directGPUMode&&e instanceof ImageBitmap&&(this.videoState.currentFrame=null);const s=this.cvSurfaceState.getResults();return this.cvSurface.analysedFrame=this.cvSurfaceState.getAnalysedFrame(),this.cvSurface.faces=s.faces,this.cvSurface.hands=s.hands,this.cvSurface.pose=s.pose,this.cvSurface.segmentation=s.segmentation,{isConnected:this.videoState.isConnected,currentFrame:e,frameWidth:this.videoState.frameWidth,frameHeight:this.videoState.frameHeight,frameRate:this.videoState.frameRate,getFrameData:()=>this.extractFrameDataIfNeeded(),cv:this.cvSurface}}extractFrameDataIfNeeded(){return!this.offscreenCanvas||!this.ctx?null:((this.frameDataDirty||!this.videoState.frameData)&&(this.videoState.frameData=this.ctx.getImageData(0,0,this.offscreenCanvas.width,this.offscreenCanvas.height),this.frameDataDirty=false),this.videoState.frameData)}handleCanvasSetup(e){try{if(this.disconnectVideo(),this.offscreenCanvas=e.offscreenCanvas,this.ctx=this.offscreenCanvas.getContext("2d",{willReadFrequently:true}),!this.ctx)throw new Error("Failed to get 2D context from transferred OffscreenCanvas");try{this.gl=this.offscreenCanvas.getContext("webgl2")||this.offscreenCanvas.getContext("webgl")}catch{this.debugLog("WebGL not available, using 2D context only")}this.videoState.isConnected=true,this.videoState.currentFrame=this.offscreenCanvas,this.videoState.frameWidth=e.width,this.videoState.frameHeight=e.height,this.frameCount=0,this.hasLoggedFirstFrame=false,this.debugLog("✅ OffscreenCanvas received and setup completed (worker-side)",{width:e.width,height:e.height,hasWebGL:!!this.gl,targetFrameRate:this.targetFrameRate}),this.debugLog("🎬 CORRECT OffscreenCanvas approach - Worker has full GPU access!")}catch(s){console.error("Failed to setup OffscreenCanvas in worker:",s),this.disconnectVideo()}}handleFrameUpdate(e){if(!this.offscreenCanvas||!this.ctx){console.warn("🔴 Received frame but OffscreenCanvas not setup"),e.imageBitmap.close();return}try{this.frameCount%150===0&&this.debugLog("✅ Worker received ImageBitmap frame:",{bitmapSize:`${e.imageBitmap.width}x${e.imageBitmap.height}`,canvasSize:`${this.offscreenCanvas.width}x${this.offscreenCanvas.height}`,frameCount:this.frameCount,timestamp:e.timestamp}),this.ctx.clearRect(0,0,this.offscreenCanvas.width,this.offscreenCanvas.height),this.ctx.drawImage(e.imageBitmap,0,0,this.offscreenCanvas.width,this.offscreenCanvas.height),this.frameDataDirty=true,this.processCurrentFrame(e.timestamp),e.imageBitmap.close(),this.frameCount++}catch(s){console.error("🔴 Error processing video frame (worker-side):",s);try{e.imageBitmap.close()}catch{}}}processCurrentFrame(e){if(!(!this.offscreenCanvas||!this.ctx))try{const s=e-this.lastFrameTime;this.videoState.frameRate=s>0?1e3/s:0,this.hasLoggedFirstFrame||(this.debugLog(`🎯 Worker-side OffscreenCanvas processing active: ${this.videoState.frameRate.toFixed(1)} FPS (${this.offscreenCanvas.width}x${this.offscreenCanvas.height})`),this.debugLog("✅ Full GPU access available for custom effects and CV analysis"),this.hasLoggedFirstFrame=true),this.lastFrameTime=e}catch(s){console.error("Error processing video frame (worker-side):",s)}}handleVideoConfigUpdate(e){try{if(e.disconnect){this.disconnectVideo();return}e.width&&e.height&&this.offscreenCanvas&&this.resizeCanvas(e.width,e.height),e.targetFrameRate&&this.updateProcessingConfig(e.targetFrameRate)}catch(s){console.error("Error handling video config update:",s)}}resizeCanvas(e,s){if(this.offscreenCanvas)try{this.offscreenCanvas.width=e,this.offscreenCanvas.height=s,this.videoState.frameWidth=e,this.videoState.frameHeight=s,this.gl&&this.gl.viewport(0,0,e,s),this.debugLog(`📐 OffscreenCanvas resized to ${e}x${s} (worker-side)`)}catch(i){console.error("Error resizing OffscreenCanvas:",i)}}disconnectVideo(){this.offscreenCanvas&&this.ctx&&(this.ctx.clearRect(0,0,this.offscreenCanvas.width,this.offscreenCanvas.height),this.debugLog("🧹 Cleared OffscreenCanvas on disconnect")),this.offscreenCanvas=null,this.ctx=null,this.gl=null,this.videoState.isConnected=false,this.videoState.currentFrame=null,this.videoState.frameWidth=0,this.videoState.frameHeight=0,this.videoState.frameRate=0,this.videoState.frameData=null,this.frameDataDirty=false,this.lastFrameTime=0,this.cvSurfaceState.clearResults(),this.hasLoggedFirstFrame=false,this.frameCount=0,this.debugLog("Video disconnected (worker-side)")}updateProcessingConfig(e){this.targetFrameRate=Math.max(1,Math.min(60,e)),this.frameInterval=1e3/this.targetFrameRate,this.debugLog(`Video processing frame rate updated to ${this.targetFrameRate} FPS (worker-side)`)}resetVideoState(){this.disconnectVideo(),this.cvSurfaceState.reset()}getProcessingConfig(){return{targetFrameRate:this.targetFrameRate,frameInterval:this.frameInterval,frameCount:this.frameCount}}getWebGLContext(){return this.gl}getCanvasForArtistEffects(){return this.offscreenCanvas}getCVStats(){return this.cvSurfaceState.getStats()}getCVActivity(){return this.cvSurfaceState.getCVActivity()}initializeForDirectFrames(e){if(this.videoState.currentFrame instanceof ImageBitmap&&(this.videoState.currentFrame.close(),this.videoState.currentFrame=null),this.disconnectVideo(),this.directGPUMode=e==="shader",this.directGPUMode)this.debugLog("VideoSystem initialized in direct GPU mode (zero-copy, pre-flipped ImageBitmaps)");else{if(this.offscreenCanvas=new OffscreenCanvas(1920,1080),this.ctx=this.offscreenCanvas.getContext("2d",{willReadFrequently:true}),!this.ctx)throw new Error("Failed to get 2D context for direct frames");this.videoState.currentFrame=this.offscreenCanvas,this.debugLog("VideoSystem initialized with canvas (P5/Canvas consumer)")}this.videoState.isConnected=false}handleDirectFrame(e){this.directGPUMode?(this.videoState.currentFrame instanceof ImageBitmap&&this.videoState.currentFrame.close(),this.videoState.currentFrame=e.imageBitmap,this.videoState.frameWidth=e.imageBitmap.width,this.videoState.frameHeight=e.imageBitmap.height,this.videoState.isConnected=true):((!this.offscreenCanvas||!this.ctx)&&(this.debugLog("[Compositor] Initializing canvas for direct frames"),this.offscreenCanvas=new OffscreenCanvas(e.imageBitmap.width,e.imageBitmap.height),this.ctx=this.offscreenCanvas.getContext("2d",{willReadFrequently:true})),(this.offscreenCanvas.width!==e.imageBitmap.width||this.offscreenCanvas.height!==e.imageBitmap.height)&&(this.offscreenCanvas.width=e.imageBitmap.width,this.offscreenCanvas.height=e.imageBitmap.height),this.ctx.clearRect(0,0,this.offscreenCanvas.width,this.offscreenCanvas.height),this.ctx.drawImage(e.imageBitmap,0,0),this.videoState.currentFrame=this.offscreenCanvas,this.videoState.frameWidth=e.imageBitmap.width,this.videoState.frameHeight=e.imageBitmap.height,this.videoState.isConnected=true,this.frameDataDirty=true,this.processCurrentFrame(e.timestamp),e.imageBitmap.close())}}const gf=0,bf=100,yf=200,_f=1,Go=100;function As(t){return t===gf?"main":t<bf?"additional":t<yf?"device":"directFrame"}const Wo=["faceDetection","faceMesh","emotion","handTracking","poseDetection","segmentation"];function Pe(){return{trueCount:0,falseCount:0}}function Ln(){return{audio:Pe(),video:Pe(),mouse:Pe(),keyboard:Pe(),pointer:Pe(),touch:Pe(),sensors:Pe(),devices:Pe(),cv:{faceDetection:{active:Pe(),meaningful:Pe()},faceMesh:{active:Pe(),meaningful:Pe()},emotion:{active:Pe(),meaningful:Pe()},handTracking:{active:Pe(),meaningful:Pe()},poseDetection:{active:Pe(),meaningful:Pe()},segmentation:{active:Pe(),meaningful:Pe()}}}}class vf{enabled=false;usageMask={mouse:{position:false,left:false,right:false,middle:false},pointer:{position:false,down:false},touch:false};frames=[];counts=Ln();prev=null;onTransition=null;setEnabled(e){this.enabled=e,e||(this.frames=[],this.counts=Ln(),this.prev=null)}isEnabled(){return this.enabled}setUsageMask(e){this.usageMask=e}setTransitionCallback(e){this.onTransition=e}evaluate(e){const s=this.usageMask,i=s.mouse.position&&e.mouse.isInCanvas||s.mouse.left&&e.mouse.leftButton||s.mouse.right&&e.mouse.rightButton||s.mouse.middle&&e.mouse.middleButton,r=s.pointer.position&&e.pointer.isInCanvas&&e.pointer.active||s.pointer.down&&e.pointer.isDown,a=s.touch&&e.touchCount>0;return{audio:e.audioConnected,video:e.videoConnected,mouse:i,keyboard:e.keyboardConsumed,pointer:r,touch:a,sensors:e.sensorsConnected,devices:e.devicesConnected,cv:e.cv}}recordFrame(e){const s=this.evaluate(e);this.frames.push({frameIndex:e.frameIndex,timestamp:e.timestamp,cpuMs:e.cpuMs,gpuMs:null,frameIntervalMs:e.frameIntervalMs,capabilities:s}),this.tally(s),this.emitEdges(s,e.frameIndex,e.timestamp),this.prev=s}flush(){if(this.frames.length===0)return null;const e=this.frames,s=this.counts;return this.frames=[],this.counts=Ln(),{frames:e,timing:{cpuMs:Xo(e,i=>i.cpuMs),frameIntervalMs:Xo(e,i=>i.frameIntervalMs)},capabilities:s}}tally(e){const s=this.counts;wt(s.audio,e.audio),wt(s.video,e.video),wt(s.mouse,e.mouse),wt(s.keyboard,e.keyboard),wt(s.pointer,e.pointer),wt(s.touch,e.touch),wt(s.sensors,e.sensors),wt(s.devices,e.devices);for(const i of Wo)wt(s.cv[i].active,e.cv[i].active),wt(s.cv[i].meaningful,e.cv[i].meaningful)}emitEdges(e,s,i){if(!this.onTransition)return;const r=this.prev,a=[["audio",e.audio,r?r.audio:false],["video",e.video,r?r.video:false],["mouse",e.mouse,r?r.mouse:false],["keyboard",e.keyboard,r?r.keyboard:false],["pointer",e.pointer,r?r.pointer:false],["touch",e.touch,r?r.touch:false],["sensors",e.sensors,r?r.sensors:false],["devices",e.devices,r?r.devices:false]];for(const[o,c,l]of a)c!==l&&this.onTransition({capability:o,active:c,frameIndex:s,timestamp:i});for(const o of Wo){const c=e.cv[o].active,l=r?r.cv[o].active:false;c!==l&&this.onTransition({capability:"cv",cvType:o,level:"active",active:c,frameIndex:s,timestamp:i});const h=e.cv[o].meaningful,d=r?r.cv[o].meaningful:false;h!==d&&this.onTransition({capability:"cv",cvType:o,level:"meaningful",active:h,frameIndex:s,timestamp:i})}}}function wt(t,e){e?t.trueCount++:t.falseCount++}function Xo(t,e){let s=1/0,i=-1/0,r=0;for(const a of t){const o=e(a);o<s&&(s=o),o>i&&(i=o),r+=o}return{min:s,avg:r/t.length,max:i}}function Uu(t){return t instanceof Uint8Array||ArrayBuffer.isView(t)&&t.constructor.name==="Uint8Array"&&"BYTES_PER_ELEMENT"in t&&t.BYTES_PER_ELEMENT===1}function us(t,e=""){if(typeof t!="number"){const s=e&&`"${e}" `;throw new TypeError(`${s}expected number, got ${typeof t}`)}if(!Number.isSafeInteger(t)||t<0){const s=e&&`"${e}" `;throw new RangeError(`${s}expected integer >= 0, got ${t}`)}}function zt(t,e,s=""){const i=Uu(t),r=t?.length,a=e!==void 0;if(!i||a&&r!==e){const o=s&&`"${s}" `,c=a?` of length ${e}`:"",l=i?`length=${r}`:`type=${typeof t}`,h=o+"expected Uint8Array"+c+", got "+l;throw i?new RangeError(h):new TypeError(h)}return t}function xr(t){if(typeof t!="function"||typeof t.create!="function")throw new TypeError("Hash must wrapped by utils.createHasher");if(us(t.outputLen),us(t.blockLen),t.outputLen<1)throw new Error('"outputLen" must be >= 1');if(t.blockLen<1)throw new Error('"blockLen" must be >= 1')}function Xi(t,e=true){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(e&&t.finished)throw new Error("Hash#digest() has already been called")}function Mu(t,e){zt(t,void 0,"digestInto() output");const s=e.outputLen;if(t.length<s)throw new RangeError('"digestInto() output" expected to be of length >='+s)}function ai(...t){for(let e=0;e<t.length;e++)t[e].fill(0)}function Dn(t){return new DataView(t.buffer,t.byteOffset,t.byteLength)}function St(t,e){return t<<32-e|t>>>e}const Bu=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",xf=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function Na(t){if(zt(t),Bu)return t.toHex();let e="";for(let s=0;s<t.length;s++)e+=xf[t[s]];return e}const Ot={_0:48,_9:57,A:65,F:70,a:97,f:102};function zo(t){if(t>=Ot._0&&t<=Ot._9)return t-Ot._0;if(t>=Ot.A&&t<=Ot.F)return t-(Ot.A-10);if(t>=Ot.a&&t<=Ot.f)return t-(Ot.a-10)}function Ou(t){if(typeof t!="string")throw new TypeError("hex string expected, got "+typeof t);if(Bu)try{return Uint8Array.fromHex(t)}catch(r){throw r instanceof SyntaxError?new RangeError(r.message):r}const e=t.length,s=e/2;if(e%2)throw new RangeError("hex string expected, got unpadded hex of length "+e);const i=new Uint8Array(s);for(let r=0,a=0;r<s;r++,a+=2){const o=zo(t.charCodeAt(a)),c=zo(t.charCodeAt(a+1));if(o===void 0||c===void 0){const l=t[a]+t[a+1];throw new RangeError('hex string expected, got non-hex character "'+l+'" at index '+a)}i[r]=o*16+c}return i}function kf(...t){let e=0;for(let i=0;i<t.length;i++){const r=t[i];zt(r),e+=r.length}const s=new Uint8Array(e);for(let i=0,r=0;i<t.length;i++){const a=t[i];s.set(a,r),r+=a.length}return s}function wf(t,e={}){const s=(r,a)=>t(a).update(r).digest(),i=t(void 0);return s.outputLen=i.outputLen,s.blockLen=i.blockLen,s.canXOF=i.canXOF,s.create=r=>t(r),Object.assign(s,e),Object.freeze(s)}function Sf(t=32){us(t,"bytesLength");const e=typeof globalThis=="object"?globalThis.crypto:null;if(typeof e?.getRandomValues!="function")throw new Error("crypto.getRandomValues must be defined");if(t>65536)throw new RangeError(`"bytesLength" expected <= 65536, got ${t}`);return e.getRandomValues(new Uint8Array(t))}const Ef=t=>({oid:Uint8Array.from([6,9,96,134,72,1,101,3,4,2,t])});function Tf(t,e,s){return t&e^~t&s}function Af(t,e,s){return t&e^t&s^e&s}class Cf{blockLen;outputLen;canXOF=false;padOffset;isLE;buffer;view;finished=false;length=0;pos=0;destroyed=false;constructor(e,s,i,r){this.blockLen=e,this.outputLen=s,this.padOffset=i,this.isLE=r,this.buffer=new Uint8Array(e),this.view=Dn(this.buffer)}update(e){Xi(this),zt(e);const{view:s,buffer:i,blockLen:r}=this,a=e.length;for(let o=0;o<a;){const c=Math.min(r-this.pos,a-o);if(c===r){const l=Dn(e);for(;r<=a-o;o+=r)this.process(l,o);continue}i.set(e.subarray(o,o+c),this.pos),this.pos+=c,o+=c,this.pos===r&&(this.process(s,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){Xi(this),Mu(e,this),this.finished=true;const{buffer:s,view:i,blockLen:r,isLE:a}=this;let{pos:o}=this;s[o++]=128,ai(this.buffer.subarray(o)),this.padOffset>r-o&&(this.process(i,0),o=0);for(let m=o;m<r;m++)s[m]=0;i.setBigUint64(r-8,BigInt(this.length*8),a),this.process(i,0);const c=Dn(e),l=this.outputLen;if(l%4)throw new Error("_sha2: outputLen must be aligned to 32bit");const h=l/4,d=this.get();if(h>d.length)throw new Error("_sha2: outputLen bigger than state");for(let m=0;m<h;m++)c.setUint32(4*m,d[m],a)}digest(){const{buffer:e,outputLen:s}=this;this.digestInto(e);const i=e.slice(0,s);return this.destroy(),i}_cloneInto(e){e||=new this.constructor,e.set(...this.get());const{blockLen:s,buffer:i,length:r,finished:a,destroyed:o,pos:c}=this;return e.destroyed=o,e.finished=a,e.length=r,e.pos=c,r%s&&e.buffer.set(i),e}clone(){return this._cloneInto()}}const Zt=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),If=Uint32Array.from([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),Qt=new Uint32Array(64);class Rf extends Cf{constructor(e){super(64,e,8,false)}get(){const{A:e,B:s,C:i,D:r,E:a,F:o,G:c,H:l}=this;return[e,s,i,r,a,o,c,l]}set(e,s,i,r,a,o,c,l){this.A=e|0,this.B=s|0,this.C=i|0,this.D=r|0,this.E=a|0,this.F=o|0,this.G=c|0,this.H=l|0}process(e,s){for(let m=0;m<16;m++,s+=4)Qt[m]=e.getUint32(s,false);for(let m=16;m<64;m++){const _=Qt[m-15],x=Qt[m-2],E=St(_,7)^St(_,18)^_>>>3,N=St(x,17)^St(x,19)^x>>>10;Qt[m]=N+Qt[m-7]+E+Qt[m-16]|0}let{A:i,B:r,C:a,D:o,E:c,F:l,G:h,H:d}=this;for(let m=0;m<64;m++){const _=St(c,6)^St(c,11)^St(c,25),x=d+_+Tf(c,l,h)+If[m]+Qt[m]|0,N=(St(i,2)^St(i,13)^St(i,22))+Af(i,r,a)|0;d=h,h=l,l=c,c=o+x|0,o=a,a=r,r=i,i=x+N|0}i=i+this.A|0,r=r+this.B|0,a=a+this.C|0,o=o+this.D|0,c=c+this.E|0,l=l+this.F|0,h=h+this.G|0,d=d+this.H|0,this.set(i,r,a,o,c,l,h,d)}roundClean(){ai(Qt)}destroy(){this.destroyed=true,this.set(0,0,0,0,0,0,0,0),ai(this.buffer)}}class Pf extends Rf{A=Zt[0]|0;B=Zt[1]|0;C=Zt[2]|0;D=Zt[3]|0;E=Zt[4]|0;F=Zt[5]|0;G=Zt[6]|0;H=Zt[7]|0;constructor(){super(32)}}const Fa=wf(()=>new Pf,Ef(1)),Et={version:"1.9.4",url:"https://cdn.jsdelivr.net/npm/p5@1.9.4/lib/p5.min.js",sha256:"00a532c56e785c68d7c7bb6f9a084e2c856b71527f22c3260aff4a2f582d80c9"};async function Lf(){let t;try{t=await fetch(Et.url)}catch(a){throw new Error(`p5 ${Et.version} download failed (${Et.url}): ${a.message}`)}if(!t.ok)throw new Error(`p5 ${Et.version} download failed (${Et.url}): HTTP ${t.status}`);const e=new Uint8Array(await t.arrayBuffer()),s=Fa(e);let i="";for(let a=0;a<s.length;a++)i+=s[a].toString(16).padStart(2,"0");if(i!==Et.sha256)throw new Error(`p5 ${Et.version} integrity check failed for ${Et.url}: expected sha256 ${Et.sha256}, got ${i}; refusing to execute`);(0,eval)(new TextDecoder().decode(e)+`
10
- //# sourceURL=p5.min.js`);const r=self.window&&self.window.p5||self.p5;if(!r)throw new Error(`p5 ${Et.version} evaluated but did not attach a p5 constructor to the worker global`);return r}class Df{constructor(e,s,i){this.offscreenCanvas=e,this.setupFn=i.setup||null,this.renderFn=i.render,this.p5CanvasMode=i.canvasMode==="webgl"?"webgl":"2d",this.installMinimalShims()}p5Instance=null;setupFn=null;renderFn=null;p5InternalSetupComplete=false;artistSetupComplete=false;p5Class=null;imageParameterCache=new Map;mainCanvasCreated=false;p5CanvasMode;async init(){try{this.p5Class=await Lf(),await new Promise(s=>{new this.p5Class(i=>{this.p5Instance=i,i.setup=()=>{this.p5CanvasMode==="webgl"?i.createCanvas(this.offscreenCanvas.width,this.offscreenCanvas.height,i.WEBGL):i.createCanvas(this.offscreenCanvas.width,this.offscreenCanvas.height),i.noLoop(),this.p5InternalSetupComplete=true,s()},i.draw=()=>{},setTimeout(()=>{if(i.setup&&typeof i.setup=="function")try{i.setup()}catch(r){console.error("P5 setup failed:",r),s()}},0)})})}catch(e){throw console.error("Failed to initialize P5.js:",e),e}}installMinimalShims(){const e=globalThis;if(typeof e.document>"u"){const s=()=>new Proxy({},{get:()=>"",set:()=>true}),i={style:s(),appendChild:()=>{},removeChild:()=>{},children:[],childNodes:[],firstChild:null,lastChild:null,parentNode:null,ownerDocument:void 0,setAttribute:()=>{},getAttribute:()=>null,addEventListener:()=>{},removeEventListener:()=>{},tagName:"BODY"};e.document={createElement:r=>{if(r==="canvas"){let a;return this.mainCanvasCreated?a=new OffscreenCanvas(300,300):(a=this.offscreenCanvas,this.mainCanvasCreated=true),a.style=s(),a.dataset=new Proxy({},{get:()=>{},set:()=>true}),a.classList={add:()=>{},remove:()=>{},contains:()=>false,toggle:()=>false},a.getBoundingClientRect=()=>({left:0,top:0,width:a.width,height:a.height}),a}return{style:s(),appendChild:()=>{},removeChild:()=>{},setAttribute:()=>{},getAttribute:()=>null,tagName:r.toUpperCase(),addEventListener:()=>{},removeEventListener:()=>{}}},createElementNS:(r,a)=>e.document.createElement(a),body:i,documentElement:{style:s(),children:[],childNodes:[]},getElementById:()=>null,querySelector:()=>null,querySelectorAll:()=>[],getElementsByTagName:r=>r.toLowerCase()==="main"?[i]:[],addEventListener:()=>{},removeEventListener:()=>{},hasFocus:()=>true},i.ownerDocument=e.document}typeof e.window>"u"&&(e.window={devicePixelRatio:1,innerWidth:this.offscreenCanvas.width,innerHeight:this.offscreenCanvas.height,addEventListener:()=>{},removeEventListener:()=>{},requestAnimationFrame:s=>0,cancelAnimationFrame:()=>{},setTimeout:e.setTimeout.bind(e),clearTimeout:e.clearTimeout.bind(e),setInterval:e.setInterval.bind(e),clearInterval:e.clearInterval.bind(e),performance:e.performance,console:e.console,Math:e.Math,Date:e.Date,Array:e.Array,Object:e.Object}),typeof e.navigator>"u"&&(e.navigator={userAgent:"Viji-Worker-P5",platform:"Worker",language:"en-US"}),typeof e.screen>"u"&&(e.screen={width:this.offscreenCanvas.width,height:this.offscreenCanvas.height,availWidth:this.offscreenCanvas.width,availHeight:this.offscreenCanvas.height,colorDepth:24,pixelDepth:24}),typeof e.HTMLCanvasElement>"u"&&(e.HTMLCanvasElement=function(){},Object.setPrototypeOf(OffscreenCanvas.prototype,e.HTMLCanvasElement.prototype))}getOrCreateP5Image(e,s){if(!this.p5Instance)return null;if(s==null)return this.imageParameterCache.delete(e),null;const i=this.imageParameterCache.get(e);if(i&&i.source===s)return i.p5Image;try{const r=new OffscreenCanvas(s.width,s.height),a=r.getContext("2d");if(!a)throw new Error("Failed to get 2d context from OffscreenCanvas");a.drawImage(s,0,0);const o={canvas:r,elt:r,width:s.width,height:s.height};return this.imageParameterCache.set(e,{source:s,p5Image:o}),o}catch(r){return console.warn("Failed to convert image to P5-compatible object:",r),null}}wrapVideoFramesForP5(e){if(e.video?.currentFrame instanceof OffscreenCanvas){const s=e.video.currentFrame;e.video.currentFrame={canvas:s,elt:s,width:s.width,height:s.height}}else if(e.video?.currentFrame instanceof ImageBitmap){const s=e.video.currentFrame;e.video.currentFrame={elt:s,width:s.width,height:s.height}}if(e.video?.cv?.analysedFrame instanceof OffscreenCanvas){const s=e.video.cv.analysedFrame;e.video.cv.analysedFrame={canvas:s,elt:s,width:s.width,height:s.height}}if(Array.isArray(e.videoStreams)){for(const s of e.videoStreams)if(s?.currentFrame instanceof OffscreenCanvas){const i=s.currentFrame;s.currentFrame={canvas:i,elt:i,width:i.width,height:i.height}}else if(s?.currentFrame instanceof ImageBitmap){const i=s.currentFrame;s.currentFrame={elt:i,width:i.width,height:i.height}}}}addP5PropertyToImageParameters(e){if(!this.p5Instance)return;const s=i=>i instanceof ImageBitmap||i&&typeof i=="object"&&"width"in i&&"height"in i;for(const[i,r]of e)try{if(r&&typeof r=="object"&&"value"in r){const a=r.value;a&&s(a)&&!("p5"in r)&&Object.defineProperty(r,"p5",{get:()=>this.getOrCreateP5Image(i,r.value),enumerable:true,configurable:true})}}catch(a){console.warn(`Failed to add .p5 property to parameter '${i}':`,a);continue}}tick(e,s){if(!this.p5Instance||!this.p5InternalSetupComplete)return false;try{return this.addP5PropertyToImageParameters(s),this.wrapVideoFramesForP5(e),!this.artistSetupComplete&&this.setupFn&&(this.setupFn(e,this.p5Instance),this.artistSetupComplete=true),this.p5Instance._setProperty&&this.p5Instance._setProperty("frameCount",this.p5Instance.frameCount+1),this.renderFn?(this.renderFn(e,this.p5Instance),true):false}catch(i){throw console.error("P5 render error:",i),i}}resize(e,s){if(this.p5Instance){if(this.p5Instance._setProperty("width",e),this.p5Instance._setProperty("height",s),this.p5Instance._setProperty("_width",e),this.p5Instance._setProperty("_height",s),this.p5Instance._renderer&&(this.p5Instance._renderer.width=e,this.p5Instance._renderer.height=s),typeof this.p5Instance.resizeCanvas=="function")try{this.p5Instance.resizeCanvas(e,s,true)}catch(i){console.warn("P5 resize warning:",i)}this.p5Instance._renderer&&(this.p5Instance._renderer._cachedFillStyle=void 0,this.p5Instance._renderer._cachedStrokeStyle=void 0)}}destroy(){if(this.p5Instance){try{typeof this.p5Instance.remove=="function"&&this.p5Instance.remove()}catch(e){console.warn("P5 cleanup warning:",e)}this.p5Instance=null}this.setupFn=null,this.renderFn=null,this.p5InternalSetupComplete=false,this.artistSetupComplete=false,this.imageParameterCache.clear()}}const Nf=new Set(["main","mix","smoothstep","step","clamp","min","max","abs","sign","floor","ceil","fract","mod","sin","cos","tan","asin","acos","atan","pow","exp","log","exp2","log2","sqrt","inversesqrt","radians","degrees","length","distance","dot","cross","normalize","faceforward","reflect","refract","matrixCompMult","lessThan","lessThanEqual","greaterThan","greaterThanEqual","equal","notEqual","any","all","not","texture2D","texture2DProj","texture2DLod","textureCube","texture","textureProj","textureLod","textureSize","texelFetch","dFdx","dFdy","fwidth","round","trunc","isnan","isinf","floatBitsToInt","intBitsToFloat","transpose","determinant","inverse","outerProduct","modf"]),Ff=["_colors","_positions","_count"],Cs="viji_gradientMix4",sa=["faceDetection","faceMesh","emotionDetection","handTracking","poseDetection","bodySegmentation"];class Nn{static parseParameters(e){const{parameters:s,errors:i}=this.parse(e);if(i.length>0){const r=i.map(o=>`line ${o.line}: ${o.directive}: ${o.message}`).join(`
11
- `),a=new Error(`Shader directive error${i.length>1?"s":""}:
12
- ${r}`);throw a.__isShaderCompileError=true,a.__sourceLocation={line:i[0].line},a}return s}static collectDirectiveErrors(e){return this.parse(e).errors}static parse(e){const s=[],i=[],r=e.split(`
13
- `);for(let a=0;a<r.length;a++){const o=a+1,c=r[a].trim(),l=c.match(/\/\/\s*@viji-(\w+):(\w+)\s+(.+)/);if(l){const[,d,m,_]=l;try{if(!/^[A-Za-z_]\w*$/.test(m)||m.startsWith("gl_"))throw new Error(`Parameter name '${m}' is not a valid GLSL identifier (must start with a letter or underscore and must not use the gl_ prefix)`);const x=this.parseKeyValuePairs(_),E={type:d,uniformName:m,label:x.label||m,default:x.default,config:x,line:o};this.validateParameter(E),s.push(E)}catch(x){i.push({line:o,directive:`@viji-${d}:${m}`,message:x.message})}continue}const h=c.match(/^\/\/\s*@viji-cv:(\w+)\s*$/);if(h){const[,d]=h;try{const m={type:"cv",uniformName:d,label:d,default:void 0,config:{},line:o};this.validateParameter(m),s.push(m)}catch(m){i.push({line:o,directive:`@viji-cv:${d}`,message:m.message})}}}return this.crossValidateAccumulators(s),i.push(...this.crossValidateGradients(s,e)),i.sort((a,o)=>a.line-o.line),{parameters:s,errors:i}}static parseKeyValuePairs(e){const s={},i=/(\w+):((?:"[^"]*"|\[[^\]]*\]|#[0-9a-fA-F]{8}|#[0-9a-fA-F]{6}|#[0-9a-fA-F]{4}|#[0-9a-fA-F]{3}|(?:rgba|rgb|hsla|hsl|hsb|vec3|vec4)\s*\([^)]*\)|[^\s]+))/g;let r;for(;(r=i.exec(e))!==null;){const[,a,o]=r;s[a]=this.parseValue(o)}return s}static parseValue(e){if(e.startsWith('"')&&e.endsWith('"'))return e.slice(1,-1);if(e.startsWith("[")&&e.endsWith("]"))try{return JSON.parse(e)}catch{return e.slice(1,-1).split(",").map(r=>r.trim()).map(r=>{if(r.startsWith('"')&&r.endsWith('"'))return r.slice(1,-1);const a=parseFloat(r);return isNaN(a)?r:a})}if(e.startsWith("#")||/^(?:rgba|rgb|hsla|hsl|hsb|vec3|vec4)\s*\(/i.test(e))return e;if(e==="true")return true;if(e==="false")return false;const s=parseFloat(e);return isNaN(s)?e:s}static validateParameter(e){if(!e.type)throw new Error("Parameter type is required");if(!e.uniformName)throw new Error("Parameter uniformName is required");switch(e.type){case"slider":case"number":if(e.config.default===void 0)throw new Error(`Parameter ${e.uniformName} of type ${e.type} missing required 'default' key`);break;case"color":if(e.config.default===void 0)throw new Error(`Parameter ${e.uniformName} of type 'color' missing required 'default' key`);if(e.config.alpha!==void 0&&typeof e.config.alpha!="boolean")throw new Error(`Parameter ${e.uniformName} of type 'color' has non-boolean 'alpha' key`);try{e.config.default=ji(e.config.default,{alpha:e.config.alpha===true})}catch(s){throw new Error(`Parameter ${e.uniformName} of type 'color' has invalid default: ${s.message}`)}break;case"toggle":if(e.config.default===void 0)throw new Error(`Parameter ${e.uniformName} of type 'toggle' missing required 'default' key`);if(typeof e.config.default!="boolean")throw new Error(`Parameter ${e.uniformName} of type 'toggle' default must be boolean (true or false)`);break;case"select":if(e.config.default===void 0)throw new Error(`Parameter ${e.uniformName} of type 'select' missing required 'default' key`);if(!e.config.options||!Array.isArray(e.config.options))throw new Error(`Parameter ${e.uniformName} of type 'select' missing required 'options' key (array)`);break;case"image":break;case"button":e.config.default!==void 0&&console.warn(`Parameter ${e.uniformName} of type 'button' ignores 'default' — buttons always start as false`);break;case"coordinate":if(e.config.default===void 0)throw new Error(`Parameter ${e.uniformName} of type 'coordinate' missing required 'default' key (e.g., default:[0,0])`);if(!Array.isArray(e.config.default)||e.config.default.length!==2||typeof e.config.default[0]!="number"||typeof e.config.default[1]!="number")throw new Error(`Parameter ${e.uniformName} of type 'coordinate' default must be an array of 2 numbers (e.g., [0,0])`);break;case"gradient":{if(e.config.default===void 0)throw new Error(`Parameter ${e.uniformName} of type 'gradient' missing required 'default' key (e.g., default:[#ff0000@0,#0000ff@1])`);if(!Array.isArray(e.config.default))throw new Error(`Parameter ${e.uniformName} of type 'gradient' default must be a bracketed stop list (e.g., default:[#ff0000@0,#0000ff@1])`);if(Nf.has(e.uniformName))throw new Error(`Gradient '${e.uniformName}' shadows the GLSL built-in function of the same name; pick another name (the directive name becomes the sampler function)`);let s;try{s=Ni(e.config)}catch(a){throw new Error(`Parameter ${e.uniformName} of type 'gradient': ${a.message}`)}const i=e.config.default.map((a,o)=>{const c=String(a).trim(),l=/^(#[0-9a-fA-F]{3,8})@([-+]?(?:\d+\.?\d*|\.\d+)(?:[eE][-+]?\d+)?)$/.exec(c);if(!l)throw new Error(`Parameter ${e.uniformName} of type 'gradient': stop ${o} must be '#hex@position' (hex color and a 0..1 position; function color forms are not supported in directives), got '${c}'`);return{color:l[1],position:parseFloat(l[2])}});let r;try{r=Kn(i,s)}catch(a){throw new Error(`Parameter ${e.uniformName} of type 'gradient': ${a.message}`)}e.config.default=r,e.config.alpha=s.alpha,e.config.minStops=s.minStops,e.config.maxStops=s.maxStops;break}case"accumulator":if(e.config.rate===void 0)throw new Error(`Accumulator '${e.uniformName}' requires a 'rate' config key (parameter name or numeric constant)`);if(typeof e.config.rate!="string"&&typeof e.config.rate!="number")throw new Error(`Accumulator '${e.uniformName}' rate must be a parameter name or numeric constant`);break;case"cv":{if(!sa.includes(e.uniformName))throw new Error(`Unknown CV feature '${e.uniformName}'. Expected one of: ${sa.join(", ")}`);if(Object.keys(e.config).length>0){if(e.config.default===void 0)throw new Error(`Toggleable CV directive '${e.uniformName}' missing required 'default' key`);if(typeof e.config.default!="boolean")throw new Error(`Toggleable CV directive '${e.uniformName}' default must be boolean (true or false)`)}break}default:console.warn(`Unknown parameter type: ${e.type}`)}e.uniformName.startsWith("u_")&&console.warn(`Parameter name "${e.uniformName}" uses reserved prefix "u_". Consider renaming to avoid conflicts with built-in uniforms.`)}static generateUniformDeclaration(e){switch(e.type){case"slider":case"number":return`uniform float ${e.uniformName};`;case"color":return e.config.alpha===true?`uniform vec4 ${e.uniformName};`:`uniform vec3 ${e.uniformName};`;case"toggle":return`uniform bool ${e.uniformName};`;case"select":return`uniform int ${e.uniformName};`;case"image":return`uniform sampler2D ${e.uniformName};`;case"button":return`uniform bool ${e.uniformName};`;case"coordinate":return`uniform vec2 ${e.uniformName};`;case"gradient":{const s=e.config.alpha===true?"vec4":"vec3",i=e.config.maxStops;return[`uniform ${s} ${e.uniformName}_colors[${i}];`,`uniform float ${e.uniformName}_positions[${i}];`,`uniform int ${e.uniformName}_count;`].join(`
14
- `)}case"accumulator":return`uniform float ${e.uniformName}; // accumulator (rate: ${e.config.rate})`;case"cv":return Object.keys(e.config).length>0?`uniform bool ${e.uniformName};`:`// @viji-cv:${e.uniformName} (bare — no uniform)`;default:return`// Unknown parameter type: ${e.type}`}}static generateGradientFunctions(e){const s=e.filter(r=>r.type==="gradient");if(s.length===0)return"";const i=[];s.some(r=>r.config.alpha===true)&&i.push("// CSS linear-gradient semantics: interpolate premultiplied, un-premultiply on output.","// Both ends fully transparent: plain rgb blend (the continuous limit of the formula).",`vec4 ${Cs}(vec4 a, vec4 b, float k) {`," float al = mix(a.a, b.a, k);"," if (al <= 0.0) return vec4(mix(a.rgb, b.rgb, k), 0.0);"," vec3 p = mix(a.rgb * a.a, b.rgb * b.a, k);"," return vec4(p / al, al);","}");for(const r of s){const a=r.uniformName,o=r.config.maxStops,c=r.config.alpha===true?"vec4":"vec3",l=r.config.alpha===true?`${Cs}(c0, c1, k)`:"mix(c0, c1, k)";i.push("",`// @viji-gradient:${a} (maxStops:${o}) - mirrors ${a}.at(t) in JS`,`${c} ${a}(float t) {`,` if (${a}_count < 1) return ${c}(0.0);`," float tt = clamp(t, 0.0, 1.0);",` ${c} c0 = ${a}_colors[0];`,` float p0 = ${a}_positions[0];`," if (tt <= p0) return c0;",` for (int i = 1; i < ${o}; i++) {`,` if (i >= ${a}_count) break;`,` ${c} c1 = ${a}_colors[i];`,` float p1 = ${a}_positions[i];`," if (tt <= p1) {"," float span = p1 - p0;"," float k = span > 0.0 ? (tt - p0) / span : 1.0;",` return ${l};`," }"," c0 = c1;"," p0 = p1;"," }"," return c0;","}")}return i.join(`
15
- `)}static crossValidateGradients(e,s){const i=e.filter(c=>c.type==="gradient");if(i.length===0)return[];const r=new Set(e.map(c=>c.uniformName)),a=[];for(const c of i){const l=`@viji-gradient:${c.uniformName}`;for(const d of Ff){const m=`${c.uniformName}${d}`;r.has(m)&&a.push({line:c.line,directive:l,message:`'${m}' is reserved by gradient '${c.uniformName}' and cannot be another directive's name`})}r.has(Cs)&&a.push({line:c.line,directive:l,message:`'${Cs}' is reserved for the gradient mix helper`}),new RegExp(`\\b(?:void|float|int|bool|vec[234]|ivec[234]|bvec[234]|mat[234])\\s+${c.uniformName}\\s*\\(`).test(s)&&a.push({line:c.line,directive:l,message:`the shader defines a function named '${c.uniformName}', which is the gradient's sampler function; rename one of them`})}if(new RegExp(`\\b(?:void|float|int|bool|vec[234]|ivec[234]|bvec[234]|mat[234])\\s+${Cs}\\s*\\(`).test(s)){const c=i[0];a.push({line:c.line,directive:`@viji-gradient:${c.uniformName}`,message:`the shader defines a function named '${Cs}', which is reserved for the gradient mix helper`})}return a}static crossValidateAccumulators(e){const s=new Set(e.filter(i=>i.type!=="accumulator").map(i=>i.uniformName));for(const i of e){if(i.type!=="accumulator")continue;const r=i.config.rate;if(typeof r=="string"&&!s.has(r))if(r.startsWith("u_"))i.config._rateIsBuiltIn=true;else{const a=[...s].join(", ");console.warn(`Accumulator '${i.uniformName}' references parameter '${r}' which does not exist.`+(a?` Available parameters: ${a}`:" No parameters declared.")),i.config._rateInvalid=true}}}}function Uf(t){const e=t.match(/^\s*ERROR:\s*0:(\d+)/m);if(!e)return null;const s=parseInt(e[1],10);return Number.isFinite(s)&&s>0?s:null}class je{constructor(e,s,i,r=false){this.shaderCode=i,this.redactDriverInfoLogs=r,this.glslVersion=this.detectGLSLVersion(i),this.backbufferEnabled=i.includes("backbuffer");const a={alpha:true,premultipliedAlpha:true};if(this.glslVersion==="glsl300"){const o=e.getContext("webgl2",a);if(!o)throw new Error("WebGL 2 not supported. Use GLSL ES 1.00 syntax instead.");this.gl=o}else{const o=e.getContext("webgl",a);if(!o)throw new Error("WebGL not supported");this.gl=o}}static MAX_VIDEO_STREAMS=8;static MAX_EXTERNAL_DEVICES=8;static MAX_DEVICE_VIDEOS=8;static MAX_AUDIO_STREAMS=8;gl;program=null;uniformLocations=new Map;textureUnits=new Map;nextTextureUnit=0;textures=new Map;quadBuffer=null;parameters=[];glslVersion="glsl100";audioFFTTexture=null;audioWaveformTexture=null;videoTexture=null;analysedFrameTexture=null;analysedFrameFallbackTexture=null;segmentationTexture=null;keyboardTexture=null;videoStreamTextures=[];deviceTextures=new Array(je.MAX_DEVICE_VIDEOS).fill(null);accumulatorValues=new Map;accumulatorWarned=new Set;scalarUniformCache=new Map;colorUniformCache=new Map;colorUniformCacheKey=new Map;gradientBuffers=new Map;backbufferFramebuffer=null;backbufferTexture=null;currentFramebuffer=null;currentTexture=null;backbufferEnabled=false;cvDirectives=new Map;visibleFeatures=new Set;destroyed=false;async init(){try{this.parameters=Nn.parseParameters(this.shaderCode);const e=this.parameters.filter(r=>r.type==="gradient").reduce((r,a)=>r+2*a.config.maxStops+1,0);if(e>0){const r=this.gl.getParameter(this.gl.MAX_FRAGMENT_UNIFORM_VECTORS);if(e>r)throw je.tagCompileError(new Error(`Gradient directives need ${e} fragment uniform vectors but this GPU provides ${r}; lower maxStops or use fewer gradients`))}for(const r of this.parameters)r.type==="accumulator"&&this.accumulatorValues.set(r.uniformName,r.config.default??0);for(const r of this.parameters){if(r.type!=="cv")continue;const a=r.uniformName,o=Object.keys(r.config).length>0,c={toggleable:o,inFlight:false};o&&(c.paramName=a),this.cvDirectives.set(a,c),(o?!!r.config.default:true)&&this.visibleFeatures.add(a)}this.createFullscreenQuad();const{code:s,artistLineOffset:i}=this.injectUniformsWithOffset(this.shaderCode);this.compileAndLinkShader(this.applyPremultiplyEpilogue(s),i),this.cacheUniformLocations(),this.allocateTextureUnits(),this.backbufferEnabled&&this.createBackbufferFramebuffers()}catch(e){throw console.error("Failed to initialize ShaderWorkerAdapter:",e),e}}detectGLSLVersion(e){return e.includes("#version 300")?"glsl300":"glsl100"}applyPremultiplyEpilogue(e){const s=e.replace(/\bvoid\s+main\s*\(/g,"void viji_artist_main(");if(s===e)return e;const i=e.replace(/\/\/[^\n]*|\/\*[\s\S]*?\*\//g,"");if(this.glslVersion==="glsl300"){const a=i.match(/\bout\s+(?:lowp\s+|mediump\s+|highp\s+)?vec4\s+(\w+)\s*;/);return a?s+`
16
- void main() { viji_artist_main(); `+a[1]+".rgb *= "+a[1]+`.a; }
9
+ `;case 114:return"\r";case 120:return String.fromCharCode(this.readHexChar(2));case 117:return Wt(this.readCodePoint());case 116:return" ";case 98:return"\b";case 118:return"\v";case 102:return"\f";case 13:this.input.charCodeAt(this.pos)===10&&++this.pos;case 10:return this.options.locations&&(this.lineStart=this.pos,++this.curLine),"";case 56:case 57:if(this.strict&&this.invalidStringToken(this.pos-1,"Invalid escape sequence"),t){var s=this.pos-1;this.invalidStringToken(s,"Invalid escape sequence in template string")}default:if(e>=48&&e<=55){var i=this.input.substr(this.pos-1,3).match(/^[0-7]+/)[0],r=parseInt(i,8);return r>255&&(i=i.slice(0,-1),r=parseInt(i,8)),this.pos+=i.length-1,e=this.input.charCodeAt(this.pos),(i!=="0"||e===56||e===57)&&(this.strict||t)&&this.invalidStringToken(this.pos-1-i.length,t?"Octal literal in template string":"Octal literal in strict mode"),String.fromCharCode(r)}return Bs(e)?(this.options.locations&&(this.lineStart=this.pos,++this.curLine),""):String.fromCharCode(e)}};ge.readHexChar=function(t){var e=this.pos,s=this.readInt(16,t);return s===null&&this.invalidStringToken(e,"Bad character escape sequence"),s};ge.readWord1=function(){this.containsEsc=false;for(var t="",e=true,s=this.pos,i=this.options.ecmaVersion>=6;this.pos<this.input.length;){var r=this.fullCharCodeAtPos();if(cs(r,i))this.pos+=r<=65535?1:2;else if(r===92){this.containsEsc=true,t+=this.input.slice(s,this.pos);var o=this.pos;this.input.charCodeAt(++this.pos)!==117&&this.invalidStringToken(this.pos,"Expecting Unicode escape sequence \\uXXXX"),++this.pos;var a=this.readCodePoint();(e?Nt:cs)(a,i)||this.invalidStringToken(o,"Invalid Unicode escape"),t+=Wt(a),s=this.pos}else break;e=false}return t+this.input.slice(s,this.pos)};ge.readWord=function(){var t=this.readWord1(),e=f.name;return this.keywords.test(t)&&(e=Ao[t]),this.finishToken(e,t)};var tf="8.15.0";Ne.acorn={Parser:Ne,version:tf,defaultOptions:Qn,Position:ri,SourceLocation:mr,getLineInfo:ou,Node:_r,TokenType:ye,tokTypes:f,keywordTypes:Ao,TokContext:ft,tokContexts:Te,isIdentifierChar:cs,isIdentifierStart:Nt,Token:Do,isNewLine:Bs,lineBreak:st,lineBreakG:wh,nonASCIIwhitespace:ru};function sf(t,e){return Ne.parse(t,e)}const rf=new Set(["slider","color","toggle","select","number","text","image","button","coordinate","gradient"]);function nf(t){return t==="button"?0:1}const No="__vijiNameMissingLine";function of(t){if(t.type!=="CallExpression")return null;const e=t.callee;if(!e||e.type!=="MemberExpression"||e.computed)return null;const s=e.object,i=e.property;if(!s||s.type!=="Identifier"||s.name!=="viji"||!i||i.type!=="Identifier")return null;const r=i.name;return rf.has(r)?r:null}function af(t,e){if(!t)return null;if(t.type==="VariableDeclarator"&&t.init===e){const s=t.id;return s?.type==="Identifier"?s.name:null}if(t.type==="Property"&&t.value===e&&!t.computed){const s=t.key;return s?.type==="Identifier"?s.name:null}if(t.type==="AssignmentExpression"&&t.right===e&&t.operator==="="){const s=t.left;if(s?.type==="MemberExpression"&&!s.computed){const i=s.property;if(i?.type==="Identifier")return i.name}return null}return null}function cf(t){for(const e of t.properties){if(e.type!=="Property"||e.computed)continue;const s=e.key;if((s.type==="Identifier"?s.name:s.type==="Literal"&&typeof s.value=="string"?s.value:null)!=="name")continue;const r=e.value;return r.type==="Literal"&&typeof r.value=="string"?r.value:null}return null}function to(t,e,s){s(t,e);for(const i of Object.keys(t)){if(i==="loc")continue;const r=t[i];if(Array.isArray(r))for(const o of r)o&&typeof o.type=="string"&&to(o,t,s);else r&&typeof r.type=="string"&&to(r,t,s)}}function uf(t){let e;const s=[];try{e=sf(t,{ecmaVersion:"latest",allowReturnOutsideFunction:true,allowAwaitOutsideFunction:true,locations:true,onComment:(c,l,h,d)=>s.push({start:h,end:d})})}catch(c){return{code:t,error:{code:"SCENE_PARSE_ERROR",message:`Scene code could not be parsed: ${c.message}`}}}const i=[],r=new Map,o=[];if(to(e,null,(c,l)=>{const h=of(c);if(!h)return;const d=c.loc?.start.line??0,m=af(l,c),_=c.arguments,x=nf(h);if(_.some(P=>P.type==="SpreadElement"))return;const E=_.length>x?_[x]:null,N=E?.type==="ObjectExpression"?cf(E):null,F=N??m;if(F!==null){const P=r.get(F);P!==void 0?o.push({name:F,firstLine:P,line:d}):r.set(F,d)}let U;if(m!==null)U=`name:${JSON.stringify(m)},`;else{if(N!==null)return;U=`${No}:${d},`}if(E)E.type==="ObjectExpression"?i.push({pos:E.start+1,text:U}):(i.push({pos:E.start,text:`{ ${U} ...`}),i.push({pos:E.end,text:" }"}));else{let P="";if(_.length>0){const X=_[_.length-1].end,$=c.end-1;let te=false;for(let ee=X;ee<$;ee++)if(t[ee]===","&&!s.some(Q=>ee>=Q.start&&ee<Q.end)){te=true;break}P=te?" ":", "}i.push({pos:c.end-1,text:`${P}{ ${U} }`})}}),o.length>0){const c=o[0];return{code:t,error:{code:"PARAM_NAME_DUPLICATE",message:`Duplicate parameter name '${c.name}' (line ${c.firstLine} and line ${c.line}). Parameter names are scene-global — rename one, or pass name:'...' to distinguish them.`+(o.length>1?` (${o.length-1} more duplicate${o.length>2?"s":""} after this one.)`:"")}}}if(i.length===0)return{code:t,error:null};i.sort((c,l)=>l.pos-c.pos);let a=t;for(const c of i)a=a.slice(0,c.pos)+c.text+a.slice(c.pos);return{code:a,error:null}}function ja(t,e){const s=Math.abs(e-t);if(s<=0)return 1;const i=Math.pow(10,Math.floor(Math.log10(s/100)));return Math.max(i,Number.EPSILON)}const lf=/^[A-Za-z_$][A-Za-z0-9_$]*$/,hf=new Set(["__proto__","constructor","prototype",No]);function kt(t){const e=t?.name;if(typeof e=="string"&&e.length>0)return e;const s=t?.[No];throw new Error("[PARAM_NAME_MISSING] Parameter created without a name"+(typeof s=="number"?` (line ${s})`:"")+": assign it to a variable or object key, or pass name:'...'.")}class ff{parameterDefinitions=new Map;parameterGroups=new Map;parameterValues=new Map;parameterObjects=new Map;parametersDefined=false;initialValuesSynced=false;debugMode=false;setDebugMode(e){this.debugMode=e}debugLog(e,...s){this.debugMode&&console.log(e,...s)}postMessageCallback;constructor(e){this.postMessageCallback=e}createSliderParameter(e,s){const i=kt(s),r=s.min??0,o=s.max??100,a={value:e,min:r,max:o,step:s.step??ja(r,o),...s.label!==void 0&&{label:s.label},description:s.description??"",group:s.group??"general",category:s.category??"general"},c={type:"slider",defaultValue:e,...a.label!==void 0&&{label:a.label},description:a.description,group:a.group,category:a.category,config:{min:a.min,max:a.max,step:a.step}};return this.storeParameterDefinition(i,c),this.parameterObjects.set(i,a),a}createColorParameter(e,s){const i=kt(s),r=s.alpha===true,o=ji(e,{alpha:r}),a={value:o,alpha:ii(o),rgb:Object.freeze(Dt(o)),hsb:Object.freeze(Ta(o)),...s.label!==void 0&&{label:s.label},description:s.description??"",group:s.group??"general",category:s.category??"general"},c={type:"color",defaultValue:o,...a.label!==void 0&&{label:a.label},description:a.description,group:a.group,category:a.category,config:{alpha:r}};return this.storeParameterDefinition(i,c),this.parameterObjects.set(i,a),a}createToggleParameter(e,s){const i=kt(s),r={value:e,...s.label!==void 0&&{label:s.label},description:s.description??"",group:s.group??"general",category:s.category??"general"},o={type:"toggle",defaultValue:e,...r.label!==void 0&&{label:r.label},description:r.description,group:r.group,category:r.category};return this.storeParameterDefinition(i,o),this.parameterObjects.set(i,r),r}createSelectParameter(e,s){const i=kt(s),r={value:e,options:s.options,...s.label!==void 0&&{label:s.label},description:s.description??"",group:s.group??"general",category:s.category??"general"},o={type:"select",defaultValue:e,...r.label!==void 0&&{label:r.label},description:r.description,group:r.group,category:r.category,config:{options:r.options}};return this.storeParameterDefinition(i,o),this.parameterObjects.set(i,r),r}createTextParameter(e,s){const i=kt(s),r={value:e,maxLength:s.maxLength??1e3,...s.label!==void 0&&{label:s.label},description:s.description??"",group:s.group??"general",category:s.category??"general"},o={type:"text",defaultValue:e,...r.label!==void 0&&{label:r.label},description:r.description,group:r.group,category:r.category,config:{maxLength:r.maxLength}};return this.storeParameterDefinition(i,o),this.parameterObjects.set(i,r),r}createNumberParameter(e,s){const i=kt(s),r=s.min??0,o=s.max??100,a={value:e,min:r,max:o,step:s.step??ja(r,o),...s.label!==void 0&&{label:s.label},description:s.description??"",group:s.group??"general",category:s.category??"general"},c={type:"number",defaultValue:e,...a.label!==void 0&&{label:a.label},description:a.description,group:a.group,category:a.category,config:{min:a.min,max:a.max,step:a.step}};return this.storeParameterDefinition(i,c),this.parameterObjects.set(i,a),a}createImageParameter(e,s){const i=kt(s),r={value:e,...s.label!==void 0&&{label:s.label},description:s.description??"",group:s.group??"general",category:s.category??"general"},o={type:"image",defaultValue:e,...r.label!==void 0&&{label:r.label},description:r.description,group:r.group,category:r.category};return this.storeParameterDefinition(i,o),this.parameterObjects.set(i,r),r}createButtonParameter(e){const s=kt(e),i={value:false,...e.label!==void 0&&{label:e.label},description:e.description??"",group:e.group??"general",category:e.category??"general"},r={type:"button",defaultValue:false,...i.label!==void 0&&{label:i.label},description:i.description,group:i.group,category:i.category};return this.storeParameterDefinition(s,r),this.parameterObjects.set(s,i),i}createCoordinateParameter(e,s){const i=kt(s),r={value:{x:e.x,y:e.y},step:s.step??.01,...s.label!==void 0&&{label:s.label},description:s.description??"",group:s.group??"general",category:s.category??"general"},o={type:"coordinate",defaultValue:{x:e.x,y:e.y},...r.label!==void 0&&{label:r.label},description:r.description,group:r.group,category:r.category,config:{min:-1,max:1,step:r.step}};return this.storeParameterDefinition(i,o),this.parameterObjects.set(i,r),r}createGradientParameter(e,s){const i=kt(s),r=Ni(s),o=Kn(e,r),a={value:o,at(l){return mh(a.value,l,{alpha:r.alpha})},...s.label!==void 0&&{label:s.label},description:s.description??"",group:s.group??"general",category:s.category??"general"},c={type:"gradient",defaultValue:o,...a.label!==void 0&&{label:a.label},description:a.description,group:a.group,category:a.category,config:{alpha:r.alpha,minStops:r.minStops,maxStops:r.maxStops}};return this.storeParameterDefinition(i,c),this.parameterObjects.set(i,a),a}storeParameterDefinition(e,s){if(!lf.test(e))throw new Error(`[PARAM_NAME_INVALID] Parameter name "${e}" is not a valid identifier (letters, digits, _ and $, not starting with a digit).`);if(hf.has(e))throw new Error(`[PARAM_NAME_INVALID] Parameter name "${e}" is reserved.`);if(this.parameterDefinitions.has(e))throw new Error(`[PARAM_NAME_DUPLICATE] Duplicate parameter name "${e}". Parameter names are scene-global — rename one, or pass name:'...' to distinguish them.`);const i={name:e,...s};this.parameterDefinitions.set(e,i),this.parameterValues.set(e,i.defaultValue)}updateParameterValue(e,s){const i=this.parameterDefinitions.get(e);if(!i)return console.warn(`Unknown parameter: ${e}. Available parameters:`,Array.from(this.parameterDefinitions.keys())),false;if(i.type==="color")try{s=ji(s,{alpha:i.config?.alpha===true})}catch(l){return console.error(`Parameter '${e}' invalid color: ${l.message}`),false}if(i.type==="gradient")try{s=Kn(s,Ni(i.config??{}))}catch(l){return console.error(`Parameter '${e}' invalid gradient: ${l.message}`),false}if(!this.validateParameterValue(e,s,i))return console.warn(`Validation failed for parameter ${e} = ${s}`),false;const r=this.parameterValues.get(e),o=!this.initialValuesSynced;if((i.type==="coordinate"?r&&s&&typeof r=="object"&&typeof s=="object"&&"x"in r&&"x"in s&&r.x===s.x&&r.y===s.y:i.type==="gradient"?ph(r,s):r===s)&&!o)return false;if(i.type==="image"&&r instanceof ImageBitmap&&r!==s&&!this.isHeldByLiveValue(r,e))try{r.close()}catch{}this.parameterValues.set(e,s);const c=this.parameterObjects.get(e);if(c&&(c.value=s,i.type==="color")){const l=s;c.alpha=ii(l),c.rgb=Object.freeze(Dt(l)),c.hsb=Object.freeze(Ta(l))}return true}validateParameterValue(e,s,i){if(i.validate&&!i.validate(s))return console.error(`Custom validation failed for parameter '${e}': ${s}`),false;switch(i.type){case"slider":case"number":if(typeof s!="number"||isNaN(s))return console.error(`Parameter '${e}' must be a number, got: ${s}`),false;if(i.config?.min!==void 0&&s<i.config.min)return console.error(`Parameter '${e}' value ${s} is below minimum ${i.config.min}`),false;if(i.config?.max!==void 0&&s>i.config.max)return console.error(`Parameter '${e}' value ${s} is above maximum ${i.config.max}`),false;break;case"color":{const r=i.config?.alpha===true;if(typeof s!="string"||!(r?Ea:Sa).test(s))return console.error(`Parameter '${e}' must be normalized lowercase hex '${r?"#rrggbbaa":"#rrggbb"}', got: ${s}`),false;break}case"toggle":if(typeof s!="boolean")return console.error(`Parameter '${e}' must be a boolean, got: ${s}`),false;break;case"select":if(!i.config?.options||!i.config.options.includes(s))return console.error(`Parameter '${e}' value ${s} is not in options: ${i.config?.options}`),false;break;case"text":if(typeof s!="string")return console.error(`Parameter '${e}' must be a string, got: ${s}`),false;if(i.config?.maxLength&&s.length>i.config.maxLength)return console.error(`Parameter '${e}' text too long: ${s.length} > ${i.config.maxLength}`),false;break;case"image":if(s!==null&&!(s instanceof ImageBitmap))return console.error(`Parameter '${e}' must be null or ImageBitmap, got: ${s}`),false;break;case"button":if(typeof s!="boolean")return console.error(`Parameter '${e}' must be a boolean, got: ${s}`),false;break;case"coordinate":{if(!s||typeof s!="object"||!("x"in s)||!("y"in s))return console.error(`Parameter '${e}' must be an object with x and y properties, got: ${s}`),false;const r=s;if(typeof r.x!="number"||isNaN(r.x)||typeof r.y!="number"||isNaN(r.y))return console.error(`Parameter '${e}' x and y must be numbers, got: x=${r.x}, y=${r.y}`),false;if(r.x<-1||r.x>1||r.y<-1||r.y>1)return console.error(`Parameter '${e}' x and y must be between -1 and 1, got: x=${r.x}, y=${r.y}`),false;break}case"gradient":{const r=Ni(i.config??{}),o=r.alpha?Ea:Sa;if(!Array.isArray(s)||s.length<r.minStops||s.length>r.maxStops)return console.error(`Parameter '${e}' must be an array of ${r.minStops}..${r.maxStops} gradient stops, got: ${s}`),false;let a=-1;for(const c of s){const l=c;if(!l||typeof l.color!="string"||!o.test(l.color)||typeof l.position!="number"||!isFinite(l.position)||l.position<0||l.position>1||l.position<a)return console.error(`Parameter '${e}' has an invalid or unsorted gradient stop: ${JSON.stringify(c)}`),false;a=l.position}break}}return true}resetParameterState(){for(const[e,s]of this.parameterDefinitions){if(s.type!=="image")continue;const i=this.parameterValues.get(e);if(typeof ImageBitmap<"u"&&i instanceof ImageBitmap)try{i.close()}catch{}}this.parametersDefined=false,this.initialValuesSynced=false,this.parameterDefinitions.clear(),this.parameterGroups.clear(),this.parameterValues.clear(),this.parameterObjects.clear()}sendAllParametersToHost(){if(!this.parametersDefined)try{const e=new Map;for(const[s,i]of this.parameterDefinitions){const r=i.group||"general";if(!e.has(r)){const a=i.category||"general";e.set(r,{groupName:r,category:a,parameters:{}})}const o=e.get(r);o.parameters[s]=i}this.parametersDefined=true,this.postMessageCallback("parameters-defined",{groups:Array.from(e.values())}),this.debugLog(`All parameters sent to host: ${this.parameterDefinitions.size} parameters in ${e.size} groups`)}catch(e){this.postMessageCallback("parameter-validation-error",{message:`Failed to send parameters to host: ${e.message}`,code:"PARAMETER_SENDING_ERROR"})}}markInitialValuesSynced(){this.initialValuesSynced=true}seedInitialValues(e){for(const[s,i]of Object.entries(e)){if(!this.parameterDefinitions.has(s)){this.debugLog(`Skipping initial value for undefined parameter: ${s}`),this.releaseUnappliedValue(s,i);continue}this.updateParameterValue(s,i)||this.releaseUnappliedValue(s,i)}this.markInitialValuesSynced()}releaseUnappliedValue(e,s){if(!(typeof ImageBitmap>"u"||!(s instanceof ImageBitmap))&&!(this.parameterValues.get(e)===s||this.isHeldByLiveValue(s)))try{s.close()}catch{}}isHeldByLiveValue(e,s){for(const[i,r]of this.parameterValues)if(i!==s&&r===e)return true;return false}releaseSeedBitmaps(e){for(const[s,i]of Object.entries(e))this.releaseUnappliedValue(s,i)}getParameterCount(){return this.parameterDefinitions.size}getAllParameterObjects(){return this.parameterObjects}resetButtonParameters(){for(const[e,s]of this.parameterDefinitions)if(s.type==="button"){const i=this.parameterObjects.get(e);i&&i.value===true&&(i.value=false,this.parameterValues.set(e,false))}}}class df{isEnabled=true;previousButtons=0;previousTouchPositions=new Map;mouseState={x:0,y:0,isInCanvas:false,isPressed:false,leftButton:false,rightButton:false,middleButton:false,deltaX:0,deltaY:0,wheelDelta:0,wheelX:0,wheelY:0,wasPressed:false,wasReleased:false,wasMoved:false};keyboardState={isPressed:e=>this.keyboardState.activeKeys.has(e.toLowerCase()),wasPressed:e=>this.keyboardState.pressedThisFrame.has(e.toLowerCase()),wasReleased:e=>this.keyboardState.releasedThisFrame.has(e.toLowerCase()),activeKeys:new Set,pressedThisFrame:new Set,releasedThisFrame:new Set,lastKeyPressed:"",lastKeyReleased:"",shift:false,ctrl:false,alt:false,meta:false,textureData:null};touchState={points:[],count:0,started:[],moved:[],ended:[],primary:null};keyboardTextureData=new Uint8Array(256*3);pointerState={x:0,y:0,deltaX:0,deltaY:0,isDown:false,wasPressed:false,wasReleased:false,isInCanvas:false,type:"none"};previousPointerDown=false;keyboardConsumedThisFrame=false;constructor(){this.keyboardState.textureData=this.keyboardTextureData;const e=this.keyboardState.isPressed,s=this.keyboardState.wasPressed,i=this.keyboardState.wasReleased;this.keyboardState.isPressed=r=>{const o=e(r);return o&&(this.keyboardConsumedThisFrame=true),o},this.keyboardState.wasPressed=r=>{const o=s(r);return o&&(this.keyboardConsumedThisFrame=true),o},this.keyboardState.wasReleased=r=>{const o=i(r);return o&&(this.keyboardConsumedThisFrame=true),o},this.handleMouseUpdate=this.handleMouseUpdate.bind(this),this.handleKeyboardUpdate=this.handleKeyboardUpdate.bind(this),this.handleTouchUpdate=this.handleTouchUpdate.bind(this),this.frameStart=this.frameStart.bind(this)}getKeyboardConsumed(){return this.keyboardConsumedThisFrame}getMouseState(){return this.mouseState}getPointerState(){return this.pointerState}getTouchCount(){return this.touchState.count}getInteractionAPIs(){return{mouse:this.mouseState,keyboard:this.keyboardState,touches:this.touchState,pointer:this.pointerState}}frameStart(){this.mouseState.wasPressed=false,this.mouseState.wasReleased=false,this.mouseState.wasMoved=false,this.mouseState.deltaX=0,this.mouseState.deltaY=0,this.mouseState.wheelDelta=0,this.mouseState.wheelX=0,this.mouseState.wheelY=0,this.keyboardState.pressedThisFrame.clear(),this.keyboardState.releasedThisFrame.clear(),this.keyboardTextureData.fill(0,256,512),this.touchState.started=[],this.touchState.moved=[],this.touchState.ended=[],this.keyboardConsumedThisFrame=false}handleMouseUpdate(e){if(!this.isEnabled)return;this.mouseState.x=e.x,this.mouseState.y=e.y,this.mouseState.isInCanvas=e.isInCanvas!==void 0?e.isInCanvas:true,this.mouseState.leftButton=(e.buttons&1)!==0,this.mouseState.rightButton=(e.buttons&2)!==0,this.mouseState.middleButton=(e.buttons&4)!==0,this.mouseState.isPressed=e.buttons>0,this.mouseState.deltaX+=e.deltaX||0,this.mouseState.deltaY+=e.deltaY||0,this.mouseState.wheelDelta+=e.wheelDeltaY||0,this.mouseState.wheelX+=e.wheelDeltaX||0,this.mouseState.wheelY+=e.wheelDeltaY||0;const s=e.buttons&~this.previousButtons,i=this.previousButtons&~e.buttons;this.mouseState.wasPressed=this.mouseState.wasPressed||s!==0,this.mouseState.wasReleased=this.mouseState.wasReleased||i!==0,this.mouseState.wasMoved=this.mouseState.wasMoved||e.deltaX!==0||e.deltaY!==0,this.previousButtons=e.buttons}handleKeyboardUpdate(e){if(!this.isEnabled)return;const s=e.key.toLowerCase();if(e.type==="keydown"){if(!this.keyboardState.activeKeys.has(s)){this.keyboardState.activeKeys.add(s),this.keyboardState.pressedThisFrame.add(s),this.keyboardState.lastKeyPressed=e.key;const i=e.keyCode;i!==void 0&&i>=0&&i<=255&&(this.keyboardTextureData[i]=255,this.keyboardTextureData[256+i]=255,this.keyboardTextureData[512+i]^=255)}}else if(e.type==="keyup"){this.keyboardState.activeKeys.delete(s),this.keyboardState.releasedThisFrame.add(s),this.keyboardState.lastKeyReleased=e.key;const i=e.keyCode;i!==void 0&&i>=0&&i<=255&&(this.keyboardTextureData[i]=0)}this.keyboardState.shift=e.shiftKey,this.keyboardState.ctrl=e.ctrlKey,this.keyboardState.alt=e.altKey,this.keyboardState.meta=e.metaKey}handleTouchUpdate(e){if(!this.isEnabled)return;const s=e.touches.map(o=>{const a=o.identifier,c=!!o.ended;let l=0,h=0,d=0,m=0;const _=this.previousTouchPositions.get(a);if(_){l=o.clientX-_.x,h=o.clientY-_.y;const x=(e.timestamp-_.timestamp)/1e3;x>0&&(d=l/x,m=h/x)}return c?this.previousTouchPositions.delete(a):this.previousTouchPositions.set(a,{x:o.clientX,y:o.clientY,timestamp:e.timestamp}),{id:a,x:o.clientX,y:o.clientY,pressure:o.force,radius:Math.max(o.radiusX,o.radiusY),radiusX:o.radiusX,radiusY:o.radiusY,rotationAngle:o.rotationAngle,force:o.force,isInCanvas:o.isInCanvas,deltaX:l,deltaY:h,velocity:{x:d,y:m},isNew:e.type==="touchstart"&&!_,isActive:!c,isEnding:c}}),i=s.filter(o=>o.isActive),r=s.filter(o=>o.isEnding);this.touchState.points=i,this.touchState.count=i.length,this.touchState.primary=i[0]||null,e.type==="touchstart"?this.touchState.started.push(...s.filter(o=>o.isNew)):e.type==="touchmove"?this.touchState.moved=i:(e.type==="touchend"||e.type==="touchcancel")&&this.touchState.ended.push(...r)}updatePointerState(){const e=this.touchState,s=this.mouseState;if(e.count>0&&e.primary){const i=e.primary;this.pointerState.x=i.x,this.pointerState.y=i.y,this.pointerState.deltaX=i.deltaX,this.pointerState.deltaY=i.deltaY,this.pointerState.isDown=true,this.pointerState.isInCanvas=i.isInCanvas,this.pointerState.type="touch"}else this.pointerState.x=s.x,this.pointerState.y=s.y,this.pointerState.deltaX=s.deltaX,this.pointerState.deltaY=s.deltaY,this.pointerState.isDown=s.leftButton,this.pointerState.isInCanvas=s.isInCanvas,this.pointerState.type=s.isInCanvas?"mouse":"none";this.pointerState.wasPressed=this.pointerState.isDown&&!this.previousPointerDown,this.pointerState.wasReleased=!this.pointerState.isDown&&this.previousPointerDown,this.previousPointerDown=this.pointerState.isDown}resetInteractionState(){Object.assign(this.mouseState,{x:0,y:0,isInCanvas:false,isPressed:false,leftButton:false,rightButton:false,middleButton:false,deltaX:0,deltaY:0,wheelDelta:0,wheelX:0,wheelY:0,wasPressed:false,wasReleased:false,wasMoved:false}),this.keyboardState.activeKeys.clear(),this.keyboardState.pressedThisFrame.clear(),this.keyboardState.releasedThisFrame.clear(),this.keyboardState.lastKeyPressed="",this.keyboardState.lastKeyReleased="",this.keyboardState.shift=false,this.keyboardState.ctrl=false,this.keyboardState.alt=false,this.keyboardState.meta=false,this.keyboardTextureData.fill(0),this.touchState.points=[],this.touchState.count=0,this.touchState.started=[],this.touchState.moved=[],this.touchState.ended=[],this.touchState.primary=null,this.previousTouchPositions.clear(),Object.assign(this.pointerState,{x:0,y:0,deltaX:0,deltaY:0,isDown:false,wasPressed:false,wasReleased:false,isInCanvas:false,type:"none"}),this.previousPointerDown=false}setInteractionEnabled(e){this.isEnabled=e,e||this.resetInteractionStates()}getInteractionEnabled(){return this.isEnabled}resetInteractionStates(){this.mouseState.x=0,this.mouseState.y=0,this.mouseState.isInCanvas=false,this.mouseState.isPressed=false,this.mouseState.leftButton=false,this.mouseState.rightButton=false,this.mouseState.middleButton=false,this.mouseState.deltaX=0,this.mouseState.deltaY=0,this.mouseState.wheelDelta=0,this.mouseState.wheelX=0,this.mouseState.wheelY=0,this.mouseState.wasPressed=false,this.mouseState.wasReleased=false,this.mouseState.wasMoved=false,this.keyboardState.activeKeys.clear(),this.keyboardState.pressedThisFrame.clear(),this.keyboardState.releasedThisFrame.clear(),this.keyboardState.lastKeyPressed="",this.keyboardState.lastKeyReleased="",this.keyboardState.shift=false,this.keyboardState.ctrl=false,this.keyboardState.alt=false,this.keyboardState.meta=false,this.keyboardTextureData.fill(0),this.touchState.points=[],this.touchState.count=0,this.touchState.started=[],this.touchState.moved=[],this.touchState.ended=[],this.touchState.primary=null,this.previousTouchPositions.clear(),this.pointerState.x=0,this.pointerState.y=0,this.pointerState.deltaX=0,this.pointerState.deltaY=0,this.pointerState.isDown=false,this.pointerState.wasPressed=false,this.pointerState.wasReleased=false,this.pointerState.isInCanvas=false,this.pointerState.type="none",this.previousPointerDown=false}}const qa={activeFeatures:[],processingTime:0,targetFPS:0,actualFPS:0,isProcessing:false},Ha={faceDetection:{active:false,meaningful:false},faceMesh:{active:false,meaningful:false},emotion:{active:false,meaningful:false},handTracking:{active:false,meaningful:false},poseDetection:{active:false,meaningful:false},segmentation:{active:false,meaningful:false}},pf={faceDetection:"faceDetection",faceMesh:"faceMesh",emotionDetection:"emotion",handTracking:"handTracking",poseDetection:"poseDetection",bodySegmentation:"segmentation"};class mf{desired=new Set;results={faces:[],hands:[],pose:null,segmentation:null};stats={...qa};activity=structuredClone(Ha);analysedCanvas=null;analysedCtx=null;analysedFrameValid=false;analysedFrameData=null;analysedFrameDataDirty=false;streamIndex=0;sendRequest=null;debugMode=false;setMessaging(e,s){this.streamIndex=e,this.sendRequest=s,this.desired.size>0&&this.sendRequest(this.streamIndex,[...this.desired])}setDebugMode(e){this.debugMode=e}handleResultsUpdate(e){this.results.faces=e.results.faces??[],this.results.hands=e.results.hands??[],this.results.pose=e.results.pose??null,this.results.segmentation=e.results.segmentation??null,this.stats=e.stats,this.activity=e.activity,e.analysedFrame&&this.acceptAnalysedFrame(e.analysedFrame),this.debugLog(`cv-results-update applied (stream ${e.streamIndex})`)}getResults(){return this.results}getAnalysedFrame(){return this.analysedFrameValid?this.analysedCanvas:null}getAnalysedFrameData(){return!this.analysedFrameValid||!this.analysedCanvas||!this.analysedCtx?null:((this.analysedFrameDataDirty||!this.analysedFrameData)&&(this.analysedFrameData=this.analysedCtx.getImageData(0,0,this.analysedCanvas.width,this.analysedCanvas.height),this.analysedFrameDataDirty=false),this.analysedFrameData)}getStats(){return{...this.stats}}getCVActivity(){const e=new Set([...this.desired].map(i=>pf[i])),s=i=>({active:e.has(i)&&this.activity[i].active,meaningful:this.activity[i].meaningful});return{faceDetection:s("faceDetection"),faceMesh:s("faceMesh"),emotion:s("emotion"),handTracking:s("handTracking"),poseDetection:s("poseDetection"),segmentation:s("segmentation")}}hasActiveFeatures(){return this.desired.size>0}reset(){const e=this.desired.size>0;this.desired.clear(),this.clearResults(),e&&this.sendRequest?.(this.streamIndex,[])}clearResults(){this.results.faces=[],this.results.hands=[],this.results.pose=null,this.results.segmentation=null,this.stats={...qa},this.activity=structuredClone(Ha),this.analysedFrameValid&&this.analysedCtx&&this.analysedCanvas&&this.analysedCtx.clearRect(0,0,this.analysedCanvas.width,this.analysedCanvas.height),this.analysedFrameValid=false,this.analysedFrameData=null,this.analysedFrameDataDirty=false}getControlInterface(){const e=i=>r=>this.setFeature(i,r!==false),s=i=>()=>this.setFeature(i,false);return{enableFaceDetection:e("faceDetection"),disableFaceDetection:s("faceDetection"),enableFaceMesh:e("faceMesh"),disableFaceMesh:s("faceMesh"),enableEmotionDetection:e("emotionDetection"),disableEmotionDetection:s("emotionDetection"),enableHandTracking:e("handTracking"),disableHandTracking:s("handTracking"),enablePoseDetection:e("poseDetection"),disablePoseDetection:s("poseDetection"),enableBodySegmentation:e("bodySegmentation"),disableBodySegmentation:s("bodySegmentation"),getActiveFeatures:()=>Array.from(this.desired),isProcessing:()=>this.stats.isProcessing,getStats:()=>this.getStats(),getWorkerStatus:()=>({healthy:true,restartCount:0,maxRestarts:3}),restartWorker:()=>Promise.resolve(),checkWebGLAvailability:()=>this.checkWebGLContextAvailability(),getResourceUsage:()=>({activeFeatures:this.desired.size,estimatedWebGLContexts:this.desired.size*2,webglAvailable:this.checkWebGLContextAvailability()})}}setFeature(e,s){const i=this.desired.has(e);return s===i||(s?this.desired.add(e):(this.desired.delete(e),this.clearFamilyLocally(e),this.desired.size===0&&(this.analysedFrameValid=false,this.analysedFrameData=null,this.analysedFrameDataDirty=false)),this.sendRequest?.(this.streamIndex,[...this.desired])),Promise.resolve()}clearFamilyLocally(e){const s=["faceDetection","faceMesh","emotionDetection"];s.includes(e)?s.some(i=>this.desired.has(i))||(this.results.faces=[]):e==="handTracking"?this.results.hands=[]:e==="poseDetection"?this.results.pose=null:e==="bodySegmentation"&&(this.results.segmentation=null)}acceptAnalysedFrame(e){try{if(this.analysedCanvas||(this.analysedCanvas=new OffscreenCanvas(e.width,e.height),this.analysedCtx=this.analysedCanvas.getContext("2d",{willReadFrequently:true})),!this.analysedCtx)return;(this.analysedCanvas.width!==e.width||this.analysedCanvas.height!==e.height)&&(this.analysedCanvas.width=e.width,this.analysedCanvas.height=e.height),this.analysedCtx.drawImage(e,0,0),this.analysedFrameValid=true,this.analysedFrameDataDirty=true}finally{try{e.close()}catch{}}}checkWebGLContextAvailability(){try{const e=new OffscreenCanvas(1,1);return(e.getContext("webgl2")??e.getContext("webgl"))!==null}catch{return false}}debugLog(e,...s){this.debugMode&&console.log(`[CVSurfaceState] ${e}`,...s)}}class Ti{offscreenCanvas=null;ctx=null;gl=null;debugMode=false;directGPUMode=false;deviceId;setDebugMode(e){this.debugMode=e,this.cvSurfaceState&&this.cvSurfaceState.setDebugMode(e)}debugLog(e,...s){this.debugMode&&console.log(e,...s)}targetFrameRate=30;lastFrameTime=0;frameInterval=1e3/this.targetFrameRate;hasLoggedFirstFrame=false;frameCount=0;videoState={isConnected:false,currentFrame:null,frameWidth:0,frameHeight:0,frameRate:0,frameData:null};frameDataDirty=false;cvSurfaceState;cvSurface;constructor(){this.cvSurfaceState=new mf;const e=this,s=this.cvSurfaceState.getControlInterface();this.cvSurface={analysedFrame:null,getAnalysedFrameData:()=>e.cvSurfaceState.getAnalysedFrameData(),faces:[],hands:[],pose:null,segmentation:null,...s}}getCvSurface(){return this.cvSurface}setCVMessaging(e,s){this.cvSurfaceState.setMessaging(e,s)}handleCVResultsUpdate(e){this.cvSurfaceState.handleResultsUpdate(e)}setDeviceId(e){this.deviceId=e}getDeviceId(){return this.deviceId}peekDebugState(){return{isConnected:this.videoState.isConnected,hasFrame:this.videoState.currentFrame!==null}}getVideoAPI(){const e=this.videoState.currentFrame;this.directGPUMode&&e instanceof ImageBitmap&&(this.videoState.currentFrame=null);const s=this.cvSurfaceState.getResults();return this.cvSurface.analysedFrame=this.cvSurfaceState.getAnalysedFrame(),this.cvSurface.faces=s.faces,this.cvSurface.hands=s.hands,this.cvSurface.pose=s.pose,this.cvSurface.segmentation=s.segmentation,{isConnected:this.videoState.isConnected,currentFrame:e,frameWidth:this.videoState.frameWidth,frameHeight:this.videoState.frameHeight,frameRate:this.videoState.frameRate,getFrameData:()=>this.extractFrameDataIfNeeded(),cv:this.cvSurface}}extractFrameDataIfNeeded(){return!this.offscreenCanvas||!this.ctx?null:((this.frameDataDirty||!this.videoState.frameData)&&(this.videoState.frameData=this.ctx.getImageData(0,0,this.offscreenCanvas.width,this.offscreenCanvas.height),this.frameDataDirty=false),this.videoState.frameData)}handleCanvasSetup(e){try{if(this.disconnectVideo(),this.offscreenCanvas=e.offscreenCanvas,this.ctx=this.offscreenCanvas.getContext("2d",{willReadFrequently:true}),!this.ctx)throw new Error("Failed to get 2D context from transferred OffscreenCanvas");try{this.gl=this.offscreenCanvas.getContext("webgl2")||this.offscreenCanvas.getContext("webgl")}catch{this.debugLog("WebGL not available, using 2D context only")}this.videoState.isConnected=true,this.videoState.currentFrame=this.offscreenCanvas,this.videoState.frameWidth=e.width,this.videoState.frameHeight=e.height,this.frameCount=0,this.hasLoggedFirstFrame=false,this.debugLog("✅ OffscreenCanvas received and setup completed (worker-side)",{width:e.width,height:e.height,hasWebGL:!!this.gl,targetFrameRate:this.targetFrameRate}),this.debugLog("🎬 CORRECT OffscreenCanvas approach - Worker has full GPU access!")}catch(s){console.error("Failed to setup OffscreenCanvas in worker:",s),this.disconnectVideo()}}handleFrameUpdate(e){if(!this.offscreenCanvas||!this.ctx){console.warn("🔴 Received frame but OffscreenCanvas not setup"),e.imageBitmap.close();return}try{this.frameCount%150===0&&this.debugLog("✅ Worker received ImageBitmap frame:",{bitmapSize:`${e.imageBitmap.width}x${e.imageBitmap.height}`,canvasSize:`${this.offscreenCanvas.width}x${this.offscreenCanvas.height}`,frameCount:this.frameCount,timestamp:e.timestamp}),this.ctx.clearRect(0,0,this.offscreenCanvas.width,this.offscreenCanvas.height),this.ctx.drawImage(e.imageBitmap,0,0,this.offscreenCanvas.width,this.offscreenCanvas.height),this.frameDataDirty=true,this.processCurrentFrame(e.timestamp),e.imageBitmap.close(),this.frameCount++}catch(s){console.error("🔴 Error processing video frame (worker-side):",s);try{e.imageBitmap.close()}catch{}}}processCurrentFrame(e){if(!(!this.offscreenCanvas||!this.ctx))try{const s=e-this.lastFrameTime;this.videoState.frameRate=s>0?1e3/s:0,this.hasLoggedFirstFrame||(this.debugLog(`🎯 Worker-side OffscreenCanvas processing active: ${this.videoState.frameRate.toFixed(1)} FPS (${this.offscreenCanvas.width}x${this.offscreenCanvas.height})`),this.debugLog("✅ Full GPU access available for custom effects and CV analysis"),this.hasLoggedFirstFrame=true),this.lastFrameTime=e}catch(s){console.error("Error processing video frame (worker-side):",s)}}handleVideoConfigUpdate(e){try{if(e.disconnect){this.disconnectVideo();return}e.width&&e.height&&this.offscreenCanvas&&this.resizeCanvas(e.width,e.height),e.targetFrameRate&&this.updateProcessingConfig(e.targetFrameRate)}catch(s){console.error("Error handling video config update:",s)}}resizeCanvas(e,s){if(this.offscreenCanvas)try{this.offscreenCanvas.width=e,this.offscreenCanvas.height=s,this.videoState.frameWidth=e,this.videoState.frameHeight=s,this.gl&&this.gl.viewport(0,0,e,s),this.debugLog(`📐 OffscreenCanvas resized to ${e}x${s} (worker-side)`)}catch(i){console.error("Error resizing OffscreenCanvas:",i)}}disconnectVideo(){this.offscreenCanvas&&this.ctx&&(this.ctx.clearRect(0,0,this.offscreenCanvas.width,this.offscreenCanvas.height),this.debugLog("🧹 Cleared OffscreenCanvas on disconnect")),this.offscreenCanvas=null,this.ctx=null,this.gl=null,this.videoState.isConnected=false,this.videoState.currentFrame=null,this.videoState.frameWidth=0,this.videoState.frameHeight=0,this.videoState.frameRate=0,this.videoState.frameData=null,this.frameDataDirty=false,this.lastFrameTime=0,this.cvSurfaceState.clearResults(),this.hasLoggedFirstFrame=false,this.frameCount=0,this.debugLog("Video disconnected (worker-side)")}updateProcessingConfig(e){this.targetFrameRate=Math.max(1,Math.min(60,e)),this.frameInterval=1e3/this.targetFrameRate,this.debugLog(`Video processing frame rate updated to ${this.targetFrameRate} FPS (worker-side)`)}resetVideoState(){this.disconnectVideo(),this.cvSurfaceState.reset()}getProcessingConfig(){return{targetFrameRate:this.targetFrameRate,frameInterval:this.frameInterval,frameCount:this.frameCount}}getWebGLContext(){return this.gl}getCanvasForArtistEffects(){return this.offscreenCanvas}getCVStats(){return this.cvSurfaceState.getStats()}getCVActivity(){return this.cvSurfaceState.getCVActivity()}initializeForDirectFrames(e){if(this.videoState.currentFrame instanceof ImageBitmap&&(this.videoState.currentFrame.close(),this.videoState.currentFrame=null),this.disconnectVideo(),this.directGPUMode=e==="shader",this.directGPUMode)this.debugLog("VideoSystem initialized in direct GPU mode (zero-copy, pre-flipped ImageBitmaps)");else{if(this.offscreenCanvas=new OffscreenCanvas(1920,1080),this.ctx=this.offscreenCanvas.getContext("2d",{willReadFrequently:true}),!this.ctx)throw new Error("Failed to get 2D context for direct frames");this.videoState.currentFrame=this.offscreenCanvas,this.debugLog("VideoSystem initialized with canvas (P5/Canvas consumer)")}this.videoState.isConnected=false}handleDirectFrame(e){this.directGPUMode?(this.videoState.currentFrame instanceof ImageBitmap&&this.videoState.currentFrame.close(),this.videoState.currentFrame=e.imageBitmap,this.videoState.frameWidth=e.imageBitmap.width,this.videoState.frameHeight=e.imageBitmap.height,this.videoState.isConnected=true):((!this.offscreenCanvas||!this.ctx)&&(this.debugLog("[Compositor] Initializing canvas for direct frames"),this.offscreenCanvas=new OffscreenCanvas(e.imageBitmap.width,e.imageBitmap.height),this.ctx=this.offscreenCanvas.getContext("2d",{willReadFrequently:true})),(this.offscreenCanvas.width!==e.imageBitmap.width||this.offscreenCanvas.height!==e.imageBitmap.height)&&(this.offscreenCanvas.width=e.imageBitmap.width,this.offscreenCanvas.height=e.imageBitmap.height),this.ctx.clearRect(0,0,this.offscreenCanvas.width,this.offscreenCanvas.height),this.ctx.drawImage(e.imageBitmap,0,0),this.videoState.currentFrame=this.offscreenCanvas,this.videoState.frameWidth=e.imageBitmap.width,this.videoState.frameHeight=e.imageBitmap.height,this.videoState.isConnected=true,this.frameDataDirty=true,this.processCurrentFrame(e.timestamp),e.imageBitmap.close())}}const gf=0,bf=100,yf=200,_f=1,Ga=100;function As(t){return t===gf?"main":t<bf?"additional":t<yf?"device":"directFrame"}const Wa=["faceDetection","faceMesh","emotion","handTracking","poseDetection","segmentation"];function Pe(){return{trueCount:0,falseCount:0}}function Ln(){return{audio:Pe(),video:Pe(),mouse:Pe(),keyboard:Pe(),pointer:Pe(),touch:Pe(),sensors:Pe(),devices:Pe(),cv:{faceDetection:{active:Pe(),meaningful:Pe()},faceMesh:{active:Pe(),meaningful:Pe()},emotion:{active:Pe(),meaningful:Pe()},handTracking:{active:Pe(),meaningful:Pe()},poseDetection:{active:Pe(),meaningful:Pe()},segmentation:{active:Pe(),meaningful:Pe()}}}}class vf{enabled=false;usageMask={mouse:{position:false,left:false,right:false,middle:false},pointer:{position:false,down:false},touch:false};frames=[];counts=Ln();prev=null;onTransition=null;setEnabled(e){this.enabled=e,e||(this.frames=[],this.counts=Ln(),this.prev=null)}isEnabled(){return this.enabled}setUsageMask(e){this.usageMask=e}setTransitionCallback(e){this.onTransition=e}evaluate(e){const s=this.usageMask,i=s.mouse.position&&e.mouse.isInCanvas||s.mouse.left&&e.mouse.leftButton||s.mouse.right&&e.mouse.rightButton||s.mouse.middle&&e.mouse.middleButton,r=s.pointer.position&&e.pointer.isInCanvas&&e.pointer.active||s.pointer.down&&e.pointer.isDown,o=s.touch&&e.touchCount>0;return{audio:e.audioConnected,video:e.videoConnected,mouse:i,keyboard:e.keyboardConsumed,pointer:r,touch:o,sensors:e.sensorsConnected,devices:e.devicesConnected,cv:e.cv}}recordFrame(e){const s=this.evaluate(e);this.frames.push({frameIndex:e.frameIndex,timestamp:e.timestamp,cpuMs:e.cpuMs,gpuMs:null,frameIntervalMs:e.frameIntervalMs,capabilities:s}),this.tally(s),this.emitEdges(s,e.frameIndex,e.timestamp),this.prev=s}flush(){if(this.frames.length===0)return null;const e=this.frames,s=this.counts;return this.frames=[],this.counts=Ln(),{frames:e,timing:{cpuMs:Xa(e,i=>i.cpuMs),frameIntervalMs:Xa(e,i=>i.frameIntervalMs)},capabilities:s}}tally(e){const s=this.counts;wt(s.audio,e.audio),wt(s.video,e.video),wt(s.mouse,e.mouse),wt(s.keyboard,e.keyboard),wt(s.pointer,e.pointer),wt(s.touch,e.touch),wt(s.sensors,e.sensors),wt(s.devices,e.devices);for(const i of Wa)wt(s.cv[i].active,e.cv[i].active),wt(s.cv[i].meaningful,e.cv[i].meaningful)}emitEdges(e,s,i){if(!this.onTransition)return;const r=this.prev,o=[["audio",e.audio,r?r.audio:false],["video",e.video,r?r.video:false],["mouse",e.mouse,r?r.mouse:false],["keyboard",e.keyboard,r?r.keyboard:false],["pointer",e.pointer,r?r.pointer:false],["touch",e.touch,r?r.touch:false],["sensors",e.sensors,r?r.sensors:false],["devices",e.devices,r?r.devices:false]];for(const[a,c,l]of o)c!==l&&this.onTransition({capability:a,active:c,frameIndex:s,timestamp:i});for(const a of Wa){const c=e.cv[a].active,l=r?r.cv[a].active:false;c!==l&&this.onTransition({capability:"cv",cvType:a,level:"active",active:c,frameIndex:s,timestamp:i});const h=e.cv[a].meaningful,d=r?r.cv[a].meaningful:false;h!==d&&this.onTransition({capability:"cv",cvType:a,level:"meaningful",active:h,frameIndex:s,timestamp:i})}}}function wt(t,e){e?t.trueCount++:t.falseCount++}function Xa(t,e){let s=1/0,i=-1/0,r=0;for(const o of t){const a=e(o);a<s&&(s=a),a>i&&(i=a),r+=a}return{min:s,avg:r/t.length,max:i}}function Uu(t){return t instanceof Uint8Array||ArrayBuffer.isView(t)&&t.constructor.name==="Uint8Array"&&"BYTES_PER_ELEMENT"in t&&t.BYTES_PER_ELEMENT===1}function us(t,e=""){if(typeof t!="number"){const s=e&&`"${e}" `;throw new TypeError(`${s}expected number, got ${typeof t}`)}if(!Number.isSafeInteger(t)||t<0){const s=e&&`"${e}" `;throw new RangeError(`${s}expected integer >= 0, got ${t}`)}}function zt(t,e,s=""){const i=Uu(t),r=t?.length,o=e!==void 0;if(!i||o&&r!==e){const a=s&&`"${s}" `,c=o?` of length ${e}`:"",l=i?`length=${r}`:`type=${typeof t}`,h=a+"expected Uint8Array"+c+", got "+l;throw i?new RangeError(h):new TypeError(h)}return t}function xr(t){if(typeof t!="function"||typeof t.create!="function")throw new TypeError("Hash must wrapped by utils.createHasher");if(us(t.outputLen),us(t.blockLen),t.outputLen<1)throw new Error('"outputLen" must be >= 1');if(t.blockLen<1)throw new Error('"blockLen" must be >= 1')}function Xi(t,e=true){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(e&&t.finished)throw new Error("Hash#digest() has already been called")}function Mu(t,e){zt(t,void 0,"digestInto() output");const s=e.outputLen;if(t.length<s)throw new RangeError('"digestInto() output" expected to be of length >='+s)}function oi(...t){for(let e=0;e<t.length;e++)t[e].fill(0)}function Dn(t){return new DataView(t.buffer,t.byteOffset,t.byteLength)}function St(t,e){return t<<32-e|t>>>e}const Ou=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",xf=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function Fo(t){if(zt(t),Ou)return t.toHex();let e="";for(let s=0;s<t.length;s++)e+=xf[t[s]];return e}const Bt={_0:48,_9:57,A:65,F:70,a:97,f:102};function za(t){if(t>=Bt._0&&t<=Bt._9)return t-Bt._0;if(t>=Bt.A&&t<=Bt.F)return t-(Bt.A-10);if(t>=Bt.a&&t<=Bt.f)return t-(Bt.a-10)}function Bu(t){if(typeof t!="string")throw new TypeError("hex string expected, got "+typeof t);if(Ou)try{return Uint8Array.fromHex(t)}catch(r){throw r instanceof SyntaxError?new RangeError(r.message):r}const e=t.length,s=e/2;if(e%2)throw new RangeError("hex string expected, got unpadded hex of length "+e);const i=new Uint8Array(s);for(let r=0,o=0;r<s;r++,o+=2){const a=za(t.charCodeAt(o)),c=za(t.charCodeAt(o+1));if(a===void 0||c===void 0){const l=t[o]+t[o+1];throw new RangeError('hex string expected, got non-hex character "'+l+'" at index '+o)}i[r]=a*16+c}return i}function kf(...t){let e=0;for(let i=0;i<t.length;i++){const r=t[i];zt(r),e+=r.length}const s=new Uint8Array(e);for(let i=0,r=0;i<t.length;i++){const o=t[i];s.set(o,r),r+=o.length}return s}function wf(t,e={}){const s=(r,o)=>t(o).update(r).digest(),i=t(void 0);return s.outputLen=i.outputLen,s.blockLen=i.blockLen,s.canXOF=i.canXOF,s.create=r=>t(r),Object.assign(s,e),Object.freeze(s)}function Sf(t=32){us(t,"bytesLength");const e=typeof globalThis=="object"?globalThis.crypto:null;if(typeof e?.getRandomValues!="function")throw new Error("crypto.getRandomValues must be defined");if(t>65536)throw new RangeError(`"bytesLength" expected <= 65536, got ${t}`);return e.getRandomValues(new Uint8Array(t))}const Ef=t=>({oid:Uint8Array.from([6,9,96,134,72,1,101,3,4,2,t])});function Tf(t,e,s){return t&e^~t&s}function Af(t,e,s){return t&e^t&s^e&s}class Cf{blockLen;outputLen;canXOF=false;padOffset;isLE;buffer;view;finished=false;length=0;pos=0;destroyed=false;constructor(e,s,i,r){this.blockLen=e,this.outputLen=s,this.padOffset=i,this.isLE=r,this.buffer=new Uint8Array(e),this.view=Dn(this.buffer)}update(e){Xi(this),zt(e);const{view:s,buffer:i,blockLen:r}=this,o=e.length;for(let a=0;a<o;){const c=Math.min(r-this.pos,o-a);if(c===r){const l=Dn(e);for(;r<=o-a;a+=r)this.process(l,a);continue}i.set(e.subarray(a,a+c),this.pos),this.pos+=c,a+=c,this.pos===r&&(this.process(s,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){Xi(this),Mu(e,this),this.finished=true;const{buffer:s,view:i,blockLen:r,isLE:o}=this;let{pos:a}=this;s[a++]=128,oi(this.buffer.subarray(a)),this.padOffset>r-a&&(this.process(i,0),a=0);for(let m=a;m<r;m++)s[m]=0;i.setBigUint64(r-8,BigInt(this.length*8),o),this.process(i,0);const c=Dn(e),l=this.outputLen;if(l%4)throw new Error("_sha2: outputLen must be aligned to 32bit");const h=l/4,d=this.get();if(h>d.length)throw new Error("_sha2: outputLen bigger than state");for(let m=0;m<h;m++)c.setUint32(4*m,d[m],o)}digest(){const{buffer:e,outputLen:s}=this;this.digestInto(e);const i=e.slice(0,s);return this.destroy(),i}_cloneInto(e){e||=new this.constructor,e.set(...this.get());const{blockLen:s,buffer:i,length:r,finished:o,destroyed:a,pos:c}=this;return e.destroyed=a,e.finished=o,e.length=r,e.pos=c,r%s&&e.buffer.set(i),e}clone(){return this._cloneInto()}}const Zt=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),If=Uint32Array.from([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),Qt=new Uint32Array(64);class Rf extends Cf{constructor(e){super(64,e,8,false)}get(){const{A:e,B:s,C:i,D:r,E:o,F:a,G:c,H:l}=this;return[e,s,i,r,o,a,c,l]}set(e,s,i,r,o,a,c,l){this.A=e|0,this.B=s|0,this.C=i|0,this.D=r|0,this.E=o|0,this.F=a|0,this.G=c|0,this.H=l|0}process(e,s){for(let m=0;m<16;m++,s+=4)Qt[m]=e.getUint32(s,false);for(let m=16;m<64;m++){const _=Qt[m-15],x=Qt[m-2],E=St(_,7)^St(_,18)^_>>>3,N=St(x,17)^St(x,19)^x>>>10;Qt[m]=N+Qt[m-7]+E+Qt[m-16]|0}let{A:i,B:r,C:o,D:a,E:c,F:l,G:h,H:d}=this;for(let m=0;m<64;m++){const _=St(c,6)^St(c,11)^St(c,25),x=d+_+Tf(c,l,h)+If[m]+Qt[m]|0,N=(St(i,2)^St(i,13)^St(i,22))+Af(i,r,o)|0;d=h,h=l,l=c,c=a+x|0,a=o,o=r,r=i,i=x+N|0}i=i+this.A|0,r=r+this.B|0,o=o+this.C|0,a=a+this.D|0,c=c+this.E|0,l=l+this.F|0,h=h+this.G|0,d=d+this.H|0,this.set(i,r,o,a,c,l,h,d)}roundClean(){oi(Qt)}destroy(){this.destroyed=true,this.set(0,0,0,0,0,0,0,0),oi(this.buffer)}}class Pf extends Rf{A=Zt[0]|0;B=Zt[1]|0;C=Zt[2]|0;D=Zt[3]|0;E=Zt[4]|0;F=Zt[5]|0;G=Zt[6]|0;H=Zt[7]|0;constructor(){super(32)}}const Uo=wf(()=>new Pf,Ef(1)),Et={version:"1.9.4",url:"https://cdn.jsdelivr.net/npm/p5@1.9.4/lib/p5.min.js",sha256:"00a532c56e785c68d7c7bb6f9a084e2c856b71527f22c3260aff4a2f582d80c9"};async function Lf(){let t;try{t=await fetch(Et.url)}catch(o){throw new Error(`p5 ${Et.version} download failed (${Et.url}): ${o.message}`)}if(!t.ok)throw new Error(`p5 ${Et.version} download failed (${Et.url}): HTTP ${t.status}`);const e=new Uint8Array(await t.arrayBuffer()),s=Uo(e);let i="";for(let o=0;o<s.length;o++)i+=s[o].toString(16).padStart(2,"0");if(i!==Et.sha256)throw new Error(`p5 ${Et.version} integrity check failed for ${Et.url}: expected sha256 ${Et.sha256}, got ${i}; refusing to execute`);(0,eval)(new TextDecoder().decode(e)+`
10
+ //# sourceURL=p5.min.js`);const r=self.window&&self.window.p5||self.p5;if(!r)throw new Error(`p5 ${Et.version} evaluated but did not attach a p5 constructor to the worker global`);return r}class Df{constructor(e,s,i){this.offscreenCanvas=e,this.setupFn=i.setup||null,this.renderFn=i.render,this.p5CanvasMode=i.canvasMode==="webgl"?"webgl":"2d",this.installMinimalShims()}p5Instance=null;setupFn=null;renderFn=null;p5InternalSetupComplete=false;artistSetupComplete=false;p5Class=null;imageParameterCache=new Map;mainCanvasCreated=false;p5CanvasMode;async init(){try{this.p5Class=await Lf(),await new Promise(s=>{new this.p5Class(i=>{this.p5Instance=i,i.setup=()=>{this.p5CanvasMode==="webgl"?i.createCanvas(this.offscreenCanvas.width,this.offscreenCanvas.height,i.WEBGL):i.createCanvas(this.offscreenCanvas.width,this.offscreenCanvas.height),i.noLoop(),this.p5InternalSetupComplete=true,s()},i.draw=()=>{},setTimeout(()=>{if(i.setup&&typeof i.setup=="function")try{i.setup()}catch(r){console.error("P5 setup failed:",r),s()}},0)})})}catch(e){throw console.error("Failed to initialize P5.js:",e),e}}installMinimalShims(){const e=globalThis;if(typeof e.document>"u"){const s=()=>new Proxy({},{get:()=>"",set:()=>true}),i={style:s(),appendChild:()=>{},removeChild:()=>{},children:[],childNodes:[],firstChild:null,lastChild:null,parentNode:null,ownerDocument:void 0,setAttribute:()=>{},getAttribute:()=>null,addEventListener:()=>{},removeEventListener:()=>{},tagName:"BODY"};e.document={createElement:r=>{if(r==="canvas"){let o;return this.mainCanvasCreated?o=new OffscreenCanvas(300,300):(o=this.offscreenCanvas,this.mainCanvasCreated=true),o.style=s(),o.dataset=new Proxy({},{get:()=>{},set:()=>true}),o.classList={add:()=>{},remove:()=>{},contains:()=>false,toggle:()=>false},o.getBoundingClientRect=()=>({left:0,top:0,width:o.width,height:o.height}),o}return{style:s(),appendChild:()=>{},removeChild:()=>{},setAttribute:()=>{},getAttribute:()=>null,tagName:r.toUpperCase(),addEventListener:()=>{},removeEventListener:()=>{}}},createElementNS:(r,o)=>e.document.createElement(o),body:i,documentElement:{style:s(),children:[],childNodes:[]},getElementById:()=>null,querySelector:()=>null,querySelectorAll:()=>[],getElementsByTagName:r=>r.toLowerCase()==="main"?[i]:[],addEventListener:()=>{},removeEventListener:()=>{},hasFocus:()=>true},i.ownerDocument=e.document}typeof e.window>"u"&&(e.window={devicePixelRatio:1,innerWidth:this.offscreenCanvas.width,innerHeight:this.offscreenCanvas.height,addEventListener:()=>{},removeEventListener:()=>{},requestAnimationFrame:s=>0,cancelAnimationFrame:()=>{},setTimeout:e.setTimeout.bind(e),clearTimeout:e.clearTimeout.bind(e),setInterval:e.setInterval.bind(e),clearInterval:e.clearInterval.bind(e),performance:e.performance,console:e.console,Math:e.Math,Date:e.Date,Array:e.Array,Object:e.Object}),typeof e.navigator>"u"&&(e.navigator={userAgent:"Viji-Worker-P5",platform:"Worker",language:"en-US"}),typeof e.screen>"u"&&(e.screen={width:this.offscreenCanvas.width,height:this.offscreenCanvas.height,availWidth:this.offscreenCanvas.width,availHeight:this.offscreenCanvas.height,colorDepth:24,pixelDepth:24}),typeof e.HTMLCanvasElement>"u"&&(e.HTMLCanvasElement=function(){},Object.setPrototypeOf(OffscreenCanvas.prototype,e.HTMLCanvasElement.prototype))}getOrCreateP5Image(e,s){if(!this.p5Instance)return null;if(s==null)return this.imageParameterCache.delete(e),null;const i=this.imageParameterCache.get(e);if(i&&i.source===s)return i.p5Image;try{const r=new OffscreenCanvas(s.width,s.height),o=r.getContext("2d");if(!o)throw new Error("Failed to get 2d context from OffscreenCanvas");o.drawImage(s,0,0);const a={canvas:r,elt:r,width:s.width,height:s.height};return this.imageParameterCache.set(e,{source:s,p5Image:a}),a}catch(r){return console.warn("Failed to convert image to P5-compatible object:",r),null}}wrapVideoFramesForP5(e){if(e.video?.currentFrame instanceof OffscreenCanvas){const s=e.video.currentFrame;e.video.currentFrame={canvas:s,elt:s,width:s.width,height:s.height}}else if(e.video?.currentFrame instanceof ImageBitmap){const s=e.video.currentFrame;e.video.currentFrame={elt:s,width:s.width,height:s.height}}if(e.video?.cv?.analysedFrame instanceof OffscreenCanvas){const s=e.video.cv.analysedFrame;e.video.cv.analysedFrame={canvas:s,elt:s,width:s.width,height:s.height}}if(Array.isArray(e.videoStreams)){for(const s of e.videoStreams)if(s?.currentFrame instanceof OffscreenCanvas){const i=s.currentFrame;s.currentFrame={canvas:i,elt:i,width:i.width,height:i.height}}else if(s?.currentFrame instanceof ImageBitmap){const i=s.currentFrame;s.currentFrame={elt:i,width:i.width,height:i.height}}}}addP5PropertyToImageParameters(e){if(!this.p5Instance)return;const s=i=>i instanceof ImageBitmap||i&&typeof i=="object"&&"width"in i&&"height"in i;for(const[i,r]of e)try{if(r&&typeof r=="object"&&"value"in r){const o=r.value;o&&s(o)&&!("p5"in r)&&Object.defineProperty(r,"p5",{get:()=>this.getOrCreateP5Image(i,r.value),enumerable:true,configurable:true})}}catch(o){console.warn(`Failed to add .p5 property to parameter '${i}':`,o);continue}}tick(e,s){if(!this.p5Instance||!this.p5InternalSetupComplete)return false;try{return this.addP5PropertyToImageParameters(s),this.wrapVideoFramesForP5(e),!this.artistSetupComplete&&this.setupFn&&(this.setupFn(e,this.p5Instance),this.artistSetupComplete=true),this.p5Instance._setProperty&&this.p5Instance._setProperty("frameCount",this.p5Instance.frameCount+1),this.renderFn?(this.renderFn(e,this.p5Instance),true):false}catch(i){throw console.error("P5 render error:",i),i}}resize(e,s){if(this.p5Instance){if(this.p5Instance._setProperty("width",e),this.p5Instance._setProperty("height",s),this.p5Instance._setProperty("_width",e),this.p5Instance._setProperty("_height",s),this.p5Instance._renderer&&(this.p5Instance._renderer.width=e,this.p5Instance._renderer.height=s),typeof this.p5Instance.resizeCanvas=="function")try{this.p5Instance.resizeCanvas(e,s,true)}catch(i){console.warn("P5 resize warning:",i)}this.p5Instance._renderer&&(this.p5Instance._renderer._cachedFillStyle=void 0,this.p5Instance._renderer._cachedStrokeStyle=void 0)}}destroy(){if(this.p5Instance){try{typeof this.p5Instance.remove=="function"&&this.p5Instance.remove()}catch(e){console.warn("P5 cleanup warning:",e)}this.p5Instance=null}this.setupFn=null,this.renderFn=null,this.p5InternalSetupComplete=false,this.artistSetupComplete=false,this.imageParameterCache.clear()}}const Nf=new Set(["main","mix","smoothstep","step","clamp","min","max","abs","sign","floor","ceil","fract","mod","sin","cos","tan","asin","acos","atan","pow","exp","log","exp2","log2","sqrt","inversesqrt","radians","degrees","length","distance","dot","cross","normalize","faceforward","reflect","refract","matrixCompMult","lessThan","lessThanEqual","greaterThan","greaterThanEqual","equal","notEqual","any","all","not","texture2D","texture2DProj","texture2DLod","textureCube","texture","textureProj","textureLod","textureSize","texelFetch","dFdx","dFdy","fwidth","round","trunc","isnan","isinf","floatBitsToInt","intBitsToFloat","transpose","determinant","inverse","outerProduct","modf"]),Ff=["_colors","_positions","_count"],Cs="viji_gradientMix4",so=["faceDetection","faceMesh","emotionDetection","handTracking","poseDetection","bodySegmentation"];class Nn{static parseParameters(e){const{parameters:s,errors:i}=this.parse(e);if(i.length>0){const r=i.map(a=>`line ${a.line}: ${a.directive}: ${a.message}`).join(`
11
+ `),o=new Error(`Shader directive error${i.length>1?"s":""}:
12
+ ${r}`);throw o.__isShaderCompileError=true,o.__sourceLocation={line:i[0].line},o}return s}static collectDirectiveErrors(e){return this.parse(e).errors}static parse(e){const s=[],i=[],r=e.split(`
13
+ `);for(let o=0;o<r.length;o++){const a=o+1,c=r[o].trim(),l=c.match(/\/\/\s*@viji-(\w+):(\w+)\s+(.+)/);if(l){const[,d,m,_]=l;try{if(!/^[A-Za-z_]\w*$/.test(m)||m.startsWith("gl_"))throw new Error(`Parameter name '${m}' is not a valid GLSL identifier (must start with a letter or underscore and must not use the gl_ prefix)`);const x=this.parseKeyValuePairs(_),E={type:d,uniformName:m,label:x.label||m,default:x.default,config:x,line:a};this.validateParameter(E),s.push(E)}catch(x){i.push({line:a,directive:`@viji-${d}:${m}`,message:x.message})}continue}const h=c.match(/^\/\/\s*@viji-cv:(\w+)\s*$/);if(h){const[,d]=h;try{const m={type:"cv",uniformName:d,label:d,default:void 0,config:{},line:a};this.validateParameter(m),s.push(m)}catch(m){i.push({line:a,directive:`@viji-cv:${d}`,message:m.message})}}}return this.crossValidateAccumulators(s),i.push(...this.crossValidateGradients(s,e)),i.sort((o,a)=>o.line-a.line),{parameters:s,errors:i}}static parseKeyValuePairs(e){const s={},i=/(\w+):((?:"[^"]*"|\[[^\]]*\]|#[0-9a-fA-F]{8}|#[0-9a-fA-F]{6}|#[0-9a-fA-F]{4}|#[0-9a-fA-F]{3}|(?:rgba|rgb|hsla|hsl|hsb|vec3|vec4)\s*\([^)]*\)|[^\s]+))/g;let r;for(;(r=i.exec(e))!==null;){const[,o,a]=r;s[o]=this.parseValue(a)}return s}static parseValue(e){if(e.startsWith('"')&&e.endsWith('"'))return e.slice(1,-1);if(e.startsWith("[")&&e.endsWith("]"))try{return JSON.parse(e)}catch{return e.slice(1,-1).split(",").map(r=>r.trim()).map(r=>{if(r.startsWith('"')&&r.endsWith('"'))return r.slice(1,-1);const o=parseFloat(r);return isNaN(o)?r:o})}if(e.startsWith("#")||/^(?:rgba|rgb|hsla|hsl|hsb|vec3|vec4)\s*\(/i.test(e))return e;if(e==="true")return true;if(e==="false")return false;const s=parseFloat(e);return isNaN(s)?e:s}static validateParameter(e){if(!e.type)throw new Error("Parameter type is required");if(!e.uniformName)throw new Error("Parameter uniformName is required");switch(e.type){case"slider":case"number":if(e.config.default===void 0)throw new Error(`Parameter ${e.uniformName} of type ${e.type} missing required 'default' key`);break;case"color":if(e.config.default===void 0)throw new Error(`Parameter ${e.uniformName} of type 'color' missing required 'default' key`);if(e.config.alpha!==void 0&&typeof e.config.alpha!="boolean")throw new Error(`Parameter ${e.uniformName} of type 'color' has non-boolean 'alpha' key`);try{e.config.default=ji(e.config.default,{alpha:e.config.alpha===true})}catch(s){throw new Error(`Parameter ${e.uniformName} of type 'color' has invalid default: ${s.message}`)}break;case"toggle":if(e.config.default===void 0)throw new Error(`Parameter ${e.uniformName} of type 'toggle' missing required 'default' key`);if(typeof e.config.default!="boolean")throw new Error(`Parameter ${e.uniformName} of type 'toggle' default must be boolean (true or false)`);break;case"select":{if(e.config.default===void 0)throw new Error(`Parameter ${e.uniformName} of type 'select' missing required 'default' key`);const s=e.config.options;if(!Array.isArray(s))throw new Error(`Parameter ${e.uniformName} of type 'select' missing required 'options' key: a JSON-style array such as options:["A","B","C"]`);if(s.length===0)throw new Error(`Parameter ${e.uniformName} of type 'select' 'options' must be a non-empty array`);const i=typeof s[0];if(i!=="string"&&i!=="number"||!s.every(r=>typeof r===i))throw new Error(`Parameter ${e.uniformName} of type 'select' 'options' must be all strings or all numbers (got ${JSON.stringify(s)})`);if(!s.includes(e.config.default)){const r=JSON.stringify(s[0]),o=e.config.default,a=i==="string"&&Number.isInteger(o)&&o>=0&&o<s.length?" (the default is the option value, not its index)":"";throw new Error(`Parameter ${e.uniformName} of type 'select' default must be one of the options${a}: got ${JSON.stringify(e.config.default)}, expected e.g. default:${r}`)}break}case"image":break;case"button":e.config.default!==void 0&&console.warn(`Parameter ${e.uniformName} of type 'button' ignores 'default' — buttons always start as false`);break;case"coordinate":if(e.config.default===void 0)throw new Error(`Parameter ${e.uniformName} of type 'coordinate' missing required 'default' key (e.g., default:[0,0])`);if(!Array.isArray(e.config.default)||e.config.default.length!==2||typeof e.config.default[0]!="number"||typeof e.config.default[1]!="number")throw new Error(`Parameter ${e.uniformName} of type 'coordinate' default must be an array of 2 numbers (e.g., [0,0])`);break;case"gradient":{if(e.config.default===void 0)throw new Error(`Parameter ${e.uniformName} of type 'gradient' missing required 'default' key (e.g., default:[#ff0000@0,#0000ff@1])`);if(!Array.isArray(e.config.default))throw new Error(`Parameter ${e.uniformName} of type 'gradient' default must be a bracketed stop list (e.g., default:[#ff0000@0,#0000ff@1])`);if(Nf.has(e.uniformName))throw new Error(`Gradient '${e.uniformName}' shadows the GLSL built-in function of the same name; pick another name (the directive name becomes the sampler function)`);let s;try{s=Ni(e.config)}catch(o){throw new Error(`Parameter ${e.uniformName} of type 'gradient': ${o.message}`)}const i=e.config.default.map((o,a)=>{const c=String(o).trim(),l=/^(#[0-9a-fA-F]{3,8})@([-+]?(?:\d+\.?\d*|\.\d+)(?:[eE][-+]?\d+)?)$/.exec(c);if(!l)throw new Error(`Parameter ${e.uniformName} of type 'gradient': stop ${a} must be '#hex@position' (hex color and a 0..1 position; function color forms are not supported in directives), got '${c}'`);return{color:l[1],position:parseFloat(l[2])}});let r;try{r=Kn(i,s)}catch(o){throw new Error(`Parameter ${e.uniformName} of type 'gradient': ${o.message}`)}e.config.default=r,e.config.alpha=s.alpha,e.config.minStops=s.minStops,e.config.maxStops=s.maxStops;break}case"accumulator":if(e.config.rate===void 0)throw new Error(`Accumulator '${e.uniformName}' requires a 'rate' config key (parameter name or numeric constant)`);if(typeof e.config.rate!="string"&&typeof e.config.rate!="number")throw new Error(`Accumulator '${e.uniformName}' rate must be a parameter name or numeric constant`);break;case"cv":{if(!so.includes(e.uniformName))throw new Error(`Unknown CV feature '${e.uniformName}'. Expected one of: ${so.join(", ")}`);if(Object.keys(e.config).length>0){if(e.config.default===void 0)throw new Error(`Toggleable CV directive '${e.uniformName}' missing required 'default' key`);if(typeof e.config.default!="boolean")throw new Error(`Toggleable CV directive '${e.uniformName}' default must be boolean (true or false)`)}break}default:console.warn(`Unknown parameter type: ${e.type}`)}e.uniformName.startsWith("u_")&&console.warn(`Parameter name "${e.uniformName}" uses reserved prefix "u_". Consider renaming to avoid conflicts with built-in uniforms.`)}static generateUniformDeclaration(e){switch(e.type){case"slider":case"number":return`uniform float ${e.uniformName};`;case"color":return e.config.alpha===true?`uniform vec4 ${e.uniformName};`:`uniform vec3 ${e.uniformName};`;case"toggle":return`uniform bool ${e.uniformName};`;case"select":return`uniform int ${e.uniformName};`;case"image":return`uniform sampler2D ${e.uniformName};`;case"button":return`uniform bool ${e.uniformName};`;case"coordinate":return`uniform vec2 ${e.uniformName};`;case"gradient":{const s=e.config.alpha===true?"vec4":"vec3",i=e.config.maxStops;return[`uniform ${s} ${e.uniformName}_colors[${i}];`,`uniform float ${e.uniformName}_positions[${i}];`,`uniform int ${e.uniformName}_count;`].join(`
14
+ `)}case"accumulator":return`uniform float ${e.uniformName}; // accumulator (rate: ${e.config.rate})`;case"cv":return Object.keys(e.config).length>0?`uniform bool ${e.uniformName};`:`// @viji-cv:${e.uniformName} (bare — no uniform)`;default:return`// Unknown parameter type: ${e.type}`}}static generateGradientFunctions(e){const s=e.filter(r=>r.type==="gradient");if(s.length===0)return"";const i=[];s.some(r=>r.config.alpha===true)&&i.push("// CSS linear-gradient semantics: interpolate premultiplied, un-premultiply on output.","// Both ends fully transparent: plain rgb blend (the continuous limit of the formula).",`vec4 ${Cs}(vec4 a, vec4 b, float k) {`," float al = mix(a.a, b.a, k);"," if (al <= 0.0) return vec4(mix(a.rgb, b.rgb, k), 0.0);"," vec3 p = mix(a.rgb * a.a, b.rgb * b.a, k);"," return vec4(p / al, al);","}");for(const r of s){const o=r.uniformName,a=r.config.maxStops,c=r.config.alpha===true?"vec4":"vec3",l=r.config.alpha===true?`${Cs}(c0, c1, k)`:"mix(c0, c1, k)";i.push("",`// @viji-gradient:${o} (maxStops:${a}) - mirrors ${o}.at(t) in JS`,`${c} ${o}(float t) {`,` if (${o}_count < 1) return ${c}(0.0);`," float tt = clamp(t, 0.0, 1.0);",` ${c} c0 = ${o}_colors[0];`,` float p0 = ${o}_positions[0];`," if (tt <= p0) return c0;",` for (int i = 1; i < ${a}; i++) {`,` if (i >= ${o}_count) break;`,` ${c} c1 = ${o}_colors[i];`,` float p1 = ${o}_positions[i];`," if (tt <= p1) {"," float span = p1 - p0;"," float k = span > 0.0 ? (tt - p0) / span : 1.0;",` return ${l};`," }"," c0 = c1;"," p0 = p1;"," }"," return c0;","}")}return i.join(`
15
+ `)}static crossValidateGradients(e,s){const i=e.filter(c=>c.type==="gradient");if(i.length===0)return[];const r=new Set(e.map(c=>c.uniformName)),o=[];for(const c of i){const l=`@viji-gradient:${c.uniformName}`;for(const d of Ff){const m=`${c.uniformName}${d}`;r.has(m)&&o.push({line:c.line,directive:l,message:`'${m}' is reserved by gradient '${c.uniformName}' and cannot be another directive's name`})}r.has(Cs)&&o.push({line:c.line,directive:l,message:`'${Cs}' is reserved for the gradient mix helper`}),new RegExp(`\\b(?:void|float|int|bool|vec[234]|ivec[234]|bvec[234]|mat[234])\\s+${c.uniformName}\\s*\\(`).test(s)&&o.push({line:c.line,directive:l,message:`the shader defines a function named '${c.uniformName}', which is the gradient's sampler function; rename one of them`})}if(new RegExp(`\\b(?:void|float|int|bool|vec[234]|ivec[234]|bvec[234]|mat[234])\\s+${Cs}\\s*\\(`).test(s)){const c=i[0];o.push({line:c.line,directive:`@viji-gradient:${c.uniformName}`,message:`the shader defines a function named '${Cs}', which is reserved for the gradient mix helper`})}return o}static crossValidateAccumulators(e){const s=new Set(e.filter(i=>i.type!=="accumulator").map(i=>i.uniformName));for(const i of e){if(i.type!=="accumulator")continue;const r=i.config.rate;if(typeof r=="string"&&!s.has(r))if(r.startsWith("u_"))i.config._rateIsBuiltIn=true;else{const o=[...s].join(", ");console.warn(`Accumulator '${i.uniformName}' references parameter '${r}' which does not exist.`+(o?` Available parameters: ${o}`:" No parameters declared.")),i.config._rateInvalid=true}}}}function Uf(t){const e=t.match(/^\s*ERROR:\s*0:(\d+)/m);if(!e)return null;const s=parseInt(e[1],10);return Number.isFinite(s)&&s>0?s:null}class je{constructor(e,s,i,r=false){this.shaderCode=i,this.redactDriverInfoLogs=r,this.glslVersion=this.detectGLSLVersion(i),this.backbufferEnabled=i.includes("backbuffer");const o={alpha:true,premultipliedAlpha:true};if(this.glslVersion==="glsl300"){const a=e.getContext("webgl2",o);if(!a)throw new Error("WebGL 2 not supported. Use GLSL ES 1.00 syntax instead.");this.gl=a}else{const a=e.getContext("webgl",o);if(!a)throw new Error("WebGL not supported");this.gl=a}}static MAX_VIDEO_STREAMS=8;static MAX_EXTERNAL_DEVICES=8;static MAX_DEVICE_VIDEOS=8;static MAX_AUDIO_STREAMS=8;gl;program=null;uniformLocations=new Map;textureUnits=new Map;nextTextureUnit=0;textures=new Map;quadBuffer=null;parameters=[];glslVersion="glsl100";audioFFTTexture=null;audioWaveformTexture=null;videoTexture=null;analysedFrameTexture=null;analysedFrameFallbackTexture=null;segmentationTexture=null;keyboardTexture=null;videoStreamTextures=[];deviceTextures=new Array(je.MAX_DEVICE_VIDEOS).fill(null);accumulatorValues=new Map;accumulatorWarned=new Set;scalarUniformCache=new Map;colorUniformCache=new Map;colorUniformCacheKey=new Map;gradientBuffers=new Map;backbufferFramebuffer=null;backbufferTexture=null;currentFramebuffer=null;currentTexture=null;backbufferEnabled=false;cvDirectives=new Map;visibleFeatures=new Set;destroyed=false;async init(){try{this.parameters=Nn.parseParameters(this.shaderCode);const e=this.parameters.filter(r=>r.type==="gradient").reduce((r,o)=>r+2*o.config.maxStops+1,0);if(e>0){const r=this.gl.getParameter(this.gl.MAX_FRAGMENT_UNIFORM_VECTORS);if(e>r)throw je.tagCompileError(new Error(`Gradient directives need ${e} fragment uniform vectors but this GPU provides ${r}; lower maxStops or use fewer gradients`))}for(const r of this.parameters)r.type==="accumulator"&&this.accumulatorValues.set(r.uniformName,r.config.default??0);for(const r of this.parameters){if(r.type!=="cv")continue;const o=r.uniformName,a=Object.keys(r.config).length>0,c={toggleable:a,inFlight:false};a&&(c.paramName=o),this.cvDirectives.set(o,c),(a?!!r.config.default:true)&&this.visibleFeatures.add(o)}this.createFullscreenQuad();const{code:s,artistLineOffset:i}=this.injectUniformsWithOffset(this.shaderCode);this.compileAndLinkShader(this.applyPremultiplyEpilogue(s),i),this.cacheUniformLocations(),this.allocateTextureUnits(),this.backbufferEnabled&&this.createBackbufferFramebuffers()}catch(e){throw console.error("Failed to initialize ShaderWorkerAdapter:",e),e}}detectGLSLVersion(e){return e.includes("#version 300")?"glsl300":"glsl100"}applyPremultiplyEpilogue(e){const s=e.replace(/\bvoid\s+main\s*\(/g,"void viji_artist_main(");if(s===e)return e;const i=e.replace(/\/\/[^\n]*|\/\*[\s\S]*?\*\//g,"");if(this.glslVersion==="glsl300"){const o=i.match(/\bout\s+(?:lowp\s+|mediump\s+|highp\s+)?vec4\s+(\w+)\s*;/);return o?s+`
16
+ void main() { viji_artist_main(); `+o[1]+".rgb *= "+o[1]+`.a; }
17
17
  `:e}const r=/\bgl_FragData\b/.test(i)?"gl_FragData[0]":"gl_FragColor";return s+`
18
18
  void main() { viji_artist_main(); `+r+".rgb *= "+r+`.a; }
19
- `}createFullscreenQuad(){const e=new Float32Array([-1,-1,1,-1,-1,1,1,1]);this.quadBuffer=this.gl.createBuffer(),this.gl.bindBuffer(this.gl.ARRAY_BUFFER,this.quadBuffer),this.gl.bufferData(this.gl.ARRAY_BUFFER,e,this.gl.STATIC_DRAW)}injectUniformsWithOffset(e){const s=this.injectUniforms(e),r=s.indexOf("// ===== ARTIST CODE =====");if(r===-1)return{code:s,artistLineOffset:0};const o=(s.slice(0,r).match(/\n/g)||[]).length;return{code:s,artistLineOffset:o+1}}injectUniforms(e){let s="",i=e;const r=e.split(`
19
+ `}createFullscreenQuad(){const e=new Float32Array([-1,-1,1,-1,-1,1,1,1]);this.quadBuffer=this.gl.createBuffer(),this.gl.bindBuffer(this.gl.ARRAY_BUFFER,this.quadBuffer),this.gl.bufferData(this.gl.ARRAY_BUFFER,e,this.gl.STATIC_DRAW)}injectUniformsWithOffset(e){const s=this.injectUniforms(e),r=s.indexOf("// ===== ARTIST CODE =====");if(r===-1)return{code:s,artistLineOffset:0};const a=(s.slice(0,r).match(/\n/g)||[]).length;return{code:s,artistLineOffset:a+1}}injectUniforms(e){let s="",i=e;const r=e.split(`
20
20
  `);for(let E=0;E<r.length;E++){const N=r[E].trim();if(N.startsWith("#version")){s=N,r[E]="",i=r.join(`
21
- `);break}}const a=this.findInjectionPoint(i),o=this.getBuiltInUniforms(),c=this.parameters.map(E=>Nn.generateUniformDeclaration(E)).join(`
22
- `),l=e.includes("fwidth");l&&this.glslVersion==="glsl100"&&(this.gl.getExtension("OES_standard_derivatives")||console.warn("Shader uses fwidth() but OES_standard_derivatives extension is not supported. Shader may not compile."));const h=[];l&&this.glslVersion==="glsl100"&&h.push("#extension GL_OES_standard_derivatives : enable"),this.glslVersion==="glsl100"?(h.push(""),h.push("#ifdef GL_ES"),h.push("precision mediump float;"),h.push("#endif")):(h.push(""),h.push("precision mediump float;")),h.push(""),h.push("// ===== VIJI AUTO-INJECTED UNIFORMS ====="),h.push("// Built-in uniforms (auto-provided)"),h.push(o),h.push(""),h.push("// Parameter uniforms (from @viji-* declarations)"),h.push(c);const d=Nn.generateGradientFunctions(this.parameters);d&&(h.push(""),h.push("// Gradient samplers (from @viji-gradient declarations)"),h.push(d)),h.push(""),h.push("// ===== ARTIST CODE =====");const m=h.join(`
23
- `),_=i.slice(0,a)+`
21
+ `);break}}const o=this.findInjectionPoint(i),a=this.getBuiltInUniforms(),c=this.parameters.map(E=>Nn.generateUniformDeclaration(E)).join(`
22
+ `),l=e.includes("fwidth");l&&this.glslVersion==="glsl100"&&(this.gl.getExtension("OES_standard_derivatives")||console.warn("Shader uses fwidth() but OES_standard_derivatives extension is not supported. Shader may not compile."));const h=[];l&&this.glslVersion==="glsl100"&&h.push("#extension GL_OES_standard_derivatives : enable"),this.glslVersion==="glsl100"?(h.push(""),h.push("#ifdef GL_ES"),h.push("precision mediump float;"),h.push("#endif")):(h.push(""),h.push("precision mediump float;")),h.push(""),h.push("// ===== VIJI AUTO-INJECTED UNIFORMS ====="),h.push("// Built-in uniforms (auto-provided)"),h.push(a),h.push(""),h.push("// Parameter uniforms (from @viji-* declarations)"),h.push(c);const d=Nn.generateGradientFunctions(this.parameters);d&&(h.push(""),h.push("// Gradient samplers (from @viji-gradient declarations)"),h.push(d)),h.push(""),h.push("// ===== ARTIST CODE =====");const m=h.join(`
23
+ `),_=i.slice(0,o)+`
24
24
  `+m+`
25
- `+i.slice(a),x=s?s+`
25
+ `+i.slice(o),x=s?s+`
26
26
  `+_:_;return this.redactDriverInfoLogs||(console.log("=== INJECTED SHADER CODE (first 50 lines) ==="),console.log(x.split(`
27
27
  `).slice(0,50).join(`
28
28
  `)),console.log("=== END INJECTED CODE ===")),x}findInjectionPoint(e){const s=e.split(`
29
- `);for(let a=0;a<s.length;a++)if(s[a].trim().startsWith("#version"))return this.getLineEndPosition(e,a);let i=false,r=0;for(let a=0;a<s.length;a++){const o=s[a].trim();if(o.includes("/*")&&(i=true),o.includes("*/")){i=false,r=a+1;continue}if(!i){if(o===""||o.startsWith("//")){r=a+1;continue}break}}return r>0&&r<s.length?this.getLineEndPosition(e,r-1):0}getLineEndPosition(e,s){const i=e.split(`
30
- `);let r=0;for(let a=0;a<=s&&a<i.length;a++)r+=i[a].length+1;return r}getBuiltInUniforms(){return`// Core - Canvas & Timing
29
+ `);for(let o=0;o<s.length;o++)if(s[o].trim().startsWith("#version"))return this.getLineEndPosition(e,o);let i=false,r=0;for(let o=0;o<s.length;o++){const a=s[o].trim();if(a.includes("/*")&&(i=true),a.includes("*/")){i=false,r=o+1;continue}if(!i){if(a===""||a.startsWith("//")){r=o+1;continue}break}}return r>0&&r<s.length?this.getLineEndPosition(e,r-1):0}getLineEndPosition(e,s){const i=e.split(`
30
+ `);let r=0;for(let o=0;o<=s&&o<i.length;o++)r+=i[o].length+1;return r}getBuiltInUniforms(){return`// Core - Canvas & Timing
31
31
  uniform vec2 u_resolution; // Canvas width and height in pixels
32
32
  uniform float u_time; // Elapsed time in seconds since scene start
33
33
  uniform float u_deltaTime; // Time elapsed since last frame in seconds
@@ -436,8 +436,8 @@ ${this.backbufferEnabled?"uniform sampler2D backbuffer; // Previous frame textur
436
436
  }`:`attribute vec2 a_position;
437
437
  void main() {
438
438
  gl_Position = vec4(a_position, 0.0, 1.0);
439
- }`,a=this.compileShader(i.VERTEX_SHADER,r,0),o=this.compileShader(i.FRAGMENT_SHADER,e,s),c=i.createProgram();if(!c)throw new Error("Failed to create WebGL program");if(i.attachShader(c,a),i.attachShader(c,o),i.linkProgram(c),!i.getProgramParameter(c,i.LINK_STATUS)){const l=i.getParameter(i.MAX_TEXTURE_IMAGE_UNITS),h=je.countReferencedSamplers(e);if(h>l)throw je.tagCompileError(new Error(`Shader uses ${h} textures but this GPU supports ${l} in a fragment shader; read fewer texture uniforms`));const d=this.redactDriverInfoLogs?"(diagnostics unavailable)":i.getProgramInfoLog(c);throw je.tagCompileError(new Error(`Shader program link failed: ${d}`))}this.program=c,i.useProgram(c),i.deleteShader(a),i.deleteShader(o)}compileShader(e,s,i=0){const r=this.gl,a=r.createShader(e);if(!a)throw new Error("Failed to create shader");if(r.shaderSource(a,s),r.compileShader(a),!r.getShaderParameter(a,r.COMPILE_STATUS)){const o=r.getShaderInfoLog(a),c=e===r.VERTEX_SHADER?"vertex":"fragment",l=this.redactDriverInfoLogs?"(diagnostics unavailable)":o,h=new Error(`${c} shader compilation failed:
440
- ${l}`);if(e===r.FRAGMENT_SHADER){h.__isShaderCompileError=true;const d=Uf(o||"");if(d!==null){const m=d-i;m>=1&&(h.__sourceLocation={line:m})}}throw h}return a}cacheUniformLocations(){if(!this.program)return;const e=this.gl,s=e.getProgramParameter(this.program,e.ACTIVE_UNIFORMS),i=[];for(let r=0;r<s;r++){const a=e.getActiveUniform(this.program,r);if(a){const o=e.getUniformLocation(this.program,a.name);if(this.uniformLocations.set(a.name,o),a.name.endsWith("[0]")){const c=a.name.slice(0,-3);this.uniformLocations.set(c,e.getUniformLocation(this.program,c))}(a.name.includes("Stream")||a.name.includes("stream"))&&i.push(a.name)}}i.length>0?console.log("[ShaderAdapter] Stream-related uniforms found:",i):console.log("[ShaderAdapter] NO stream-related uniforms found in shader!")}allocateTextureUnits(){if(!this.program)return;const e=this.gl;this.textureUnits.clear(),this.nextTextureUnit=0;const s=e.getProgramParameter(this.program,e.ACTIVE_UNIFORMS);for(let i=0;i<s;i++){const r=e.getActiveUniform(this.program,i);r&&r.type===e.SAMPLER_2D&&this.textureUnits.set(r.name,this.nextTextureUnit++)}}static tagCompileError(e){return e.__isShaderCompileError=true,e}static countReferencedSamplers(e){const s="// ===== ARTIST CODE =====",i=e.indexOf(s),r=i===-1?e:e.slice(0,i),a=i===-1?e:e.slice(i+s.length),o=new Set;for(const l of r.matchAll(/uniform\s+sampler2D\s+(\w+)\s*;/g))o.add(l[1]);let c=0;for(const l of o)new RegExp(`\\b${l}\\b`).test(a)&&c++;return c}createBackbufferFramebuffers(){const e=this.gl,s=e.canvas.width,i=e.canvas.height,r=()=>{const c=e.createTexture();e.bindTexture(e.TEXTURE_2D,c),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,s,i,0,e.RGBA,e.UNSIGNED_BYTE,null),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE);const l=e.createFramebuffer();return e.bindFramebuffer(e.FRAMEBUFFER,l),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,c,0),{framebuffer:l,texture:c}},a=r(),o=r();this.backbufferFramebuffer=a.framebuffer,this.backbufferTexture=a.texture,this.currentFramebuffer=o.framebuffer,this.currentTexture=o.texture,e.bindFramebuffer(e.FRAMEBUFFER,null),e.bindTexture(e.TEXTURE_2D,null)}render(e,s){const i=this.gl;if(!this.program||!this.quadBuffer)return console.warn("Shader not initialized"),false;if(i.useProgram(this.program),this.syncCvVisibility(e,s),this.updateBuiltInUniforms(e),this.updateAccumulators(e,s),this.updateParameterUniforms(s),this.backbufferEnabled&&this.backbufferTexture){const a=this.textureUnits.get("backbuffer");a!==void 0&&(i.activeTexture(i.TEXTURE0+a),i.bindTexture(i.TEXTURE_2D,this.backbufferTexture),this.setUniform("backbuffer","sampler2D",a)),i.bindFramebuffer(i.FRAMEBUFFER,this.currentFramebuffer)}const r=i.getAttribLocation(this.program,"a_position");if(i.bindBuffer(i.ARRAY_BUFFER,this.quadBuffer),i.enableVertexAttribArray(r),i.vertexAttribPointer(r,2,i.FLOAT,false,0,0),i.drawArrays(i.TRIANGLE_STRIP,0,4),this.backbufferEnabled){i.bindFramebuffer(i.FRAMEBUFFER,null),i.activeTexture(i.TEXTURE0),i.bindTexture(i.TEXTURE_2D,this.currentTexture),i.drawArrays(i.TRIANGLE_STRIP,0,4);const a=this.backbufferFramebuffer,o=this.backbufferTexture;this.backbufferFramebuffer=this.currentFramebuffer,this.backbufferTexture=this.currentTexture,this.currentFramebuffer=a,this.currentTexture=o}return true}syncCvVisibility(e,s){if(!e.video?.isConnected)return;const i=e.video.cv,r=typeof i.getActiveFeatures=="function"?i.getActiveFeatures():[];for(const[a,o]of this.cvDirectives){let c;if(o.toggleable&&o.paramName){const h=s.get(o.paramName);if(!h)continue;c=h.value===true}else c=true;c?this.visibleFeatures.add(a):this.visibleFeatures.delete(a);const l=r.includes(a);if(c===l){o.lastValue=c;continue}if(o.inFlight){o.pendingValue=c;continue}this.dispatchCvEnable(i,a,c,o)}for(const a of sa)this.cvDirectives.has(a)||(r.includes(a)?this.visibleFeatures.add(a):this.visibleFeatures.delete(a))}dispatchCvEnable(e,s,i,r){const a=`enable${s.charAt(0).toUpperCase()}${s.slice(1)}`,o=e[a];typeof o=="function"&&(r.inFlight=true,r.lastValue=i,Promise.resolve(o.call(e,i)).catch(c=>{console.warn(`[ShaderAdapter] ${a}(${i}) failed:`,c)}).finally(()=>{this.destroyed||(r.inFlight=false,delete r.pendingValue)}))}updateBuiltInUniforms(e){this.setUniform("u_resolution","vec2",[e.width,e.height]),this.setUniform("u_time","float",e.time),this.setUniform("u_deltaTime","float",e.deltaTime),this.setUniform("u_frame","int",e.frameCount),this.setUniform("u_fps","float",e.fps),this.setUniform("u_mouse","vec2",[e.mouse.x,e.height-e.mouse.y]),this.setUniform("u_mouseInCanvas","bool",e.mouse.isInCanvas),this.setUniform("u_mousePressed","bool",e.mouse.isPressed),this.setUniform("u_mouseLeft","bool",e.mouse.leftButton),this.setUniform("u_mouseRight","bool",e.mouse.rightButton),this.setUniform("u_mouseMiddle","bool",e.mouse.middleButton),this.setUniform("u_mouseDelta","vec2",[e.mouse.deltaX,-e.mouse.deltaY]),this.setUniform("u_mouseWheel","float",e.mouse.wheelDelta),this.setUniform("u_mouseWasPressed","bool",e.mouse.wasPressed),this.setUniform("u_mouseWasReleased","bool",e.mouse.wasReleased),this.setUniform("u_keySpace","bool",e.keyboard.isPressed(" ")||e.keyboard.isPressed("space")),this.setUniform("u_keyShift","bool",e.keyboard.shift),this.setUniform("u_keyCtrl","bool",e.keyboard.ctrl),this.setUniform("u_keyAlt","bool",e.keyboard.alt),this.setUniform("u_keyW","bool",e.keyboard.isPressed("w")||e.keyboard.isPressed("W")),this.setUniform("u_keyA","bool",e.keyboard.isPressed("a")||e.keyboard.isPressed("A")),this.setUniform("u_keyS","bool",e.keyboard.isPressed("s")||e.keyboard.isPressed("S")),this.setUniform("u_keyD","bool",e.keyboard.isPressed("d")||e.keyboard.isPressed("D")),this.setUniform("u_keyUp","bool",e.keyboard.isPressed("ArrowUp")),this.setUniform("u_keyDown","bool",e.keyboard.isPressed("ArrowDown")),this.setUniform("u_keyLeft","bool",e.keyboard.isPressed("ArrowLeft")),this.setUniform("u_keyRight","bool",e.keyboard.isPressed("ArrowRight")),e.keyboard.textureData&&this.updateKeyboardTexture(e.keyboard.textureData),this.setUniform("u_touchCount","int",e.touches.count);for(let v=0;v<5;v++){const y=e.touches.points[v];y?this.setUniform(`u_touch${v}`,"vec2",[y.x,e.height-y.y]):this.setUniform(`u_touch${v}`,"vec2",[0,0])}this.setUniform("u_pointer","vec2",[e.pointer.x,e.height-e.pointer.y]),this.setUniform("u_pointerDelta","vec2",[e.pointer.deltaX,-e.pointer.deltaY]),this.setUniform("u_pointerDown","bool",e.pointer.isDown),this.setUniform("u_pointerWasPressed","bool",e.pointer.wasPressed),this.setUniform("u_pointerWasReleased","bool",e.pointer.wasReleased),this.setUniform("u_pointerInCanvas","bool",e.pointer.isInCanvas);const s=e.audio;if(this.setUniform("u_audioVolume","float",s.volume?.current||0),this.setUniform("u_audioPeak","float",s.volume?.peak||0),this.setUniform("u_audioVolumeSmoothed","float",s.volume?.smoothed||0),this.setUniform("u_audioLow","float",s.bands?.low||0),this.setUniform("u_audioLowMid","float",s.bands?.lowMid||0),this.setUniform("u_audioMid","float",s.bands?.mid||0),this.setUniform("u_audioHighMid","float",s.bands?.highMid||0),this.setUniform("u_audioHigh","float",s.bands?.high||0),this.setUniform("u_audioLowSmoothed","float",s.bands?.lowSmoothed||0),this.setUniform("u_audioLowMidSmoothed","float",s.bands?.lowMidSmoothed||0),this.setUniform("u_audioMidSmoothed","float",s.bands?.midSmoothed||0),this.setUniform("u_audioHighMidSmoothed","float",s.bands?.highMidSmoothed||0),this.setUniform("u_audioHighSmoothed","float",s.bands?.highSmoothed||0),this.setUniform("u_audioKick","float",s.beat?.kick||0),this.setUniform("u_audioSnare","float",s.beat?.snare||0),this.setUniform("u_audioHat","float",s.beat?.hat||0),this.setUniform("u_audioAny","float",s.beat?.any||0),this.setUniform("u_audioKickSmoothed","float",s.beat?.kickSmoothed||0),this.setUniform("u_audioSnareSmoothed","float",s.beat?.snareSmoothed||0),this.setUniform("u_audioHatSmoothed","float",s.beat?.hatSmoothed||0),this.setUniform("u_audioAnySmoothed","float",s.beat?.anySmoothed||0),this.setUniform("u_audioKickTrigger","bool",s.beat?.triggers?.kick||false),this.setUniform("u_audioSnareTrigger","bool",s.beat?.triggers?.snare||false),this.setUniform("u_audioHatTrigger","bool",s.beat?.triggers?.hat||false),this.setUniform("u_audioAnyTrigger","bool",s.beat?.triggers?.any||false),this.setUniform("u_audioBPM","float",s.beat?.bpm||120),this.setUniform("u_audioConfidence","float",s.beat?.confidence||0),this.setUniform("u_audioIsLocked","bool",s.beat?.isLocked||false),this.setUniform("u_audioBrightness","float",s.spectral?.brightness||0),this.setUniform("u_audioFlatness","float",s.spectral?.flatness||0),s.isConnected){this.updateAudioFFTTexture(s.getFrequencyData());const v=s.getWaveform();v.length>0&&this.updateAudioWaveformTexture(v)}const i=e.video;i.isConnected&&i.currentFrame?(this.updateVideoTexture(i.currentFrame),this.setUniform("u_videoResolution","vec2",[i.frameWidth,i.frameHeight]),this.setUniform("u_videoFrameRate","float",i.frameRate)):(this.setUniform("u_videoResolution","vec2",[0,0]),this.setUniform("u_videoFrameRate","float",0)),i.cv?.analysedFrame instanceof OffscreenCanvas?(this.updateAnalysedFrameTexture(i.cv.analysedFrame),this.setUniform("u_videoAnalysedAvailable","bool",true)):(this.bindAnalysedFrameFallback(),this.setUniform("u_videoAnalysedAvailable","bool",false));const r=e.videoStreams||[],a=Math.min(r.length,je.MAX_VIDEO_STREAMS);this.setUniform("u_videoStreamCount","int",a);for(let v=0;v<je.MAX_VIDEO_STREAMS;v++){const y=`u_videoStream${v}Connected`,k=`u_videoStream${v}Resolution`;v<a&&r[v]?.isConnected&&r[v]?.currentFrame?(this.updateVideoStreamTexture(v,r[v].currentFrame),this.setUniform(k,"vec2",[r[v].frameWidth,r[v].frameHeight]),this.setUniform(y,"bool",true)):(this.setUniform(k,"vec2",[0,0]),this.setUniform(y,"bool",false))}const o=e.devices||[],c=Math.min(o.length,je.MAX_DEVICE_VIDEOS);this.setUniform("u_deviceCount","int",c);for(let v=0;v<je.MAX_DEVICE_VIDEOS;v++){const y=`u_device${v}Connected`,k=`u_device${v}Resolution`;v<c&&o[v]?.video?.isConnected&&o[v].video.currentFrame?(this.updateDeviceTexture(v,o[v].video.currentFrame),this.setUniform(k,"vec2",[o[v].video.frameWidth,o[v].video.frameHeight]),this.setUniform(y,"bool",true)):(this.setUniform(k,"vec2",[0,0]),this.setUniform(y,"bool",false))}const l=e.audioStreams||[],h=Math.min(l.length,je.MAX_AUDIO_STREAMS);this.setUniform("u_audioStreamCount","int",h);for(let v=0;v<je.MAX_AUDIO_STREAMS;v++){const y=`u_audioStream${v}`;if(v<h&&l[v]?.isConnected){const k=l[v];this.setUniform(`${y}Connected`,"bool",true),this.setUniform(`${y}Volume`,"float",k.volume?.current||0),this.setUniform(`${y}Low`,"float",k.bands?.low||0),this.setUniform(`${y}LowMid`,"float",k.bands?.lowMid||0),this.setUniform(`${y}Mid`,"float",k.bands?.mid||0),this.setUniform(`${y}HighMid`,"float",k.bands?.highMid||0),this.setUniform(`${y}High`,"float",k.bands?.high||0),this.setUniform(`${y}Brightness`,"float",k.spectral?.brightness||0),this.setUniform(`${y}Flatness`,"float",k.spectral?.flatness||0)}else this.setUniform(`${y}Connected`,"bool",false),this.setUniform(`${y}Volume`,"float",0),this.setUniform(`${y}Low`,"float",0),this.setUniform(`${y}LowMid`,"float",0),this.setUniform(`${y}Mid`,"float",0),this.setUniform(`${y}HighMid`,"float",0),this.setUniform(`${y}High`,"float",0),this.setUniform(`${y}Brightness`,"float",0),this.setUniform(`${y}Flatness`,"float",0)}const d=i.cv?.faces||[],m=d[0],_=this.visibleFeatures.has("faceDetection")&&!!m,x=this.visibleFeatures.has("faceMesh")&&!!m,E=this.visibleFeatures.has("emotionDetection")&&!!m;if(this.setUniform("u_faceCount","int",this.visibleFeatures.has("faceDetection")?d.length:0),_){const v=m.bounds,y=m.center?.x||0,k=m.center?.y||0;this.setUniform("u_face0Bounds","vec4",[v?.x||0,1-(v?.y||0)-(v?.height||0),v?.width||0,v?.height||0]),this.setUniform("u_face0Center","vec2",[y,1-k]),this.setUniform("u_face0Confidence","float",m.confidence||0)}else this.setUniform("u_face0Bounds","vec4",[0,0,0,0]),this.setUniform("u_face0Center","vec2",[0,0]),this.setUniform("u_face0Confidence","float",0);if(x){const v=m.headPose||{};this.setUniform("u_face0HeadPose","vec3",[v.pitch||0,v.yaw||0,-(v.roll||0)])}else this.setUniform("u_face0HeadPose","vec3",[0,0,0]);if(E){const v=m.expressions||{},y=m.blendshapes||{};this.setUniform("u_face0Neutral","float",v.neutral||0),this.setUniform("u_face0Happy","float",v.happy||0),this.setUniform("u_face0Sad","float",v.sad||0),this.setUniform("u_face0Angry","float",v.angry||0),this.setUniform("u_face0Surprised","float",v.surprised||0),this.setUniform("u_face0Disgusted","float",v.disgusted||0),this.setUniform("u_face0Fearful","float",v.fearful||0),this.setUniform("u_face0BrowDownLeft","float",y.browDownLeft||0),this.setUniform("u_face0BrowDownRight","float",y.browDownRight||0),this.setUniform("u_face0BrowInnerUp","float",y.browInnerUp||0),this.setUniform("u_face0BrowOuterUpLeft","float",y.browOuterUpLeft||0),this.setUniform("u_face0BrowOuterUpRight","float",y.browOuterUpRight||0),this.setUniform("u_face0CheekPuff","float",y.cheekPuff||0),this.setUniform("u_face0CheekSquintLeft","float",y.cheekSquintLeft||0),this.setUniform("u_face0CheekSquintRight","float",y.cheekSquintRight||0),this.setUniform("u_face0EyeBlinkLeft","float",y.eyeBlinkLeft||0),this.setUniform("u_face0EyeBlinkRight","float",y.eyeBlinkRight||0),this.setUniform("u_face0EyeLookDownLeft","float",y.eyeLookDownLeft||0),this.setUniform("u_face0EyeLookDownRight","float",y.eyeLookDownRight||0),this.setUniform("u_face0EyeLookInLeft","float",y.eyeLookInLeft||0),this.setUniform("u_face0EyeLookInRight","float",y.eyeLookInRight||0),this.setUniform("u_face0EyeLookOutLeft","float",y.eyeLookOutLeft||0),this.setUniform("u_face0EyeLookOutRight","float",y.eyeLookOutRight||0),this.setUniform("u_face0EyeLookUpLeft","float",y.eyeLookUpLeft||0),this.setUniform("u_face0EyeLookUpRight","float",y.eyeLookUpRight||0),this.setUniform("u_face0EyeSquintLeft","float",y.eyeSquintLeft||0),this.setUniform("u_face0EyeSquintRight","float",y.eyeSquintRight||0),this.setUniform("u_face0EyeWideLeft","float",y.eyeWideLeft||0),this.setUniform("u_face0EyeWideRight","float",y.eyeWideRight||0),this.setUniform("u_face0JawForward","float",y.jawForward||0),this.setUniform("u_face0JawLeft","float",y.jawLeft||0),this.setUniform("u_face0JawOpen","float",y.jawOpen||0),this.setUniform("u_face0JawRight","float",y.jawRight||0),this.setUniform("u_face0MouthClose","float",y.mouthClose||0),this.setUniform("u_face0MouthDimpleLeft","float",y.mouthDimpleLeft||0),this.setUniform("u_face0MouthDimpleRight","float",y.mouthDimpleRight||0),this.setUniform("u_face0MouthFrownLeft","float",y.mouthFrownLeft||0),this.setUniform("u_face0MouthFrownRight","float",y.mouthFrownRight||0),this.setUniform("u_face0MouthFunnel","float",y.mouthFunnel||0),this.setUniform("u_face0MouthLeft","float",y.mouthLeft||0),this.setUniform("u_face0MouthLowerDownLeft","float",y.mouthLowerDownLeft||0),this.setUniform("u_face0MouthLowerDownRight","float",y.mouthLowerDownRight||0),this.setUniform("u_face0MouthPressLeft","float",y.mouthPressLeft||0),this.setUniform("u_face0MouthPressRight","float",y.mouthPressRight||0),this.setUniform("u_face0MouthPucker","float",y.mouthPucker||0),this.setUniform("u_face0MouthRight","float",y.mouthRight||0),this.setUniform("u_face0MouthRollLower","float",y.mouthRollLower||0),this.setUniform("u_face0MouthRollUpper","float",y.mouthRollUpper||0),this.setUniform("u_face0MouthShrugLower","float",y.mouthShrugLower||0),this.setUniform("u_face0MouthShrugUpper","float",y.mouthShrugUpper||0),this.setUniform("u_face0MouthSmileLeft","float",y.mouthSmileLeft||0),this.setUniform("u_face0MouthSmileRight","float",y.mouthSmileRight||0),this.setUniform("u_face0MouthStretchLeft","float",y.mouthStretchLeft||0),this.setUniform("u_face0MouthStretchRight","float",y.mouthStretchRight||0),this.setUniform("u_face0MouthUpperUpLeft","float",y.mouthUpperUpLeft||0),this.setUniform("u_face0MouthUpperUpRight","float",y.mouthUpperUpRight||0),this.setUniform("u_face0NoseSneerLeft","float",y.noseSneerLeft||0),this.setUniform("u_face0NoseSneerRight","float",y.noseSneerRight||0),this.setUniform("u_face0TongueOut","float",y.tongueOut||0)}else this.setUniform("u_face0Neutral","float",0),this.setUniform("u_face0Happy","float",0),this.setUniform("u_face0Sad","float",0),this.setUniform("u_face0Angry","float",0),this.setUniform("u_face0Surprised","float",0),this.setUniform("u_face0Disgusted","float",0),this.setUniform("u_face0Fearful","float",0),this.setUniform("u_face0BrowDownLeft","float",0),this.setUniform("u_face0BrowDownRight","float",0),this.setUniform("u_face0BrowInnerUp","float",0),this.setUniform("u_face0BrowOuterUpLeft","float",0),this.setUniform("u_face0BrowOuterUpRight","float",0),this.setUniform("u_face0CheekPuff","float",0),this.setUniform("u_face0CheekSquintLeft","float",0),this.setUniform("u_face0CheekSquintRight","float",0),this.setUniform("u_face0EyeBlinkLeft","float",0),this.setUniform("u_face0EyeBlinkRight","float",0),this.setUniform("u_face0EyeLookDownLeft","float",0),this.setUniform("u_face0EyeLookDownRight","float",0),this.setUniform("u_face0EyeLookInLeft","float",0),this.setUniform("u_face0EyeLookInRight","float",0),this.setUniform("u_face0EyeLookOutLeft","float",0),this.setUniform("u_face0EyeLookOutRight","float",0),this.setUniform("u_face0EyeLookUpLeft","float",0),this.setUniform("u_face0EyeLookUpRight","float",0),this.setUniform("u_face0EyeSquintLeft","float",0),this.setUniform("u_face0EyeSquintRight","float",0),this.setUniform("u_face0EyeWideLeft","float",0),this.setUniform("u_face0EyeWideRight","float",0),this.setUniform("u_face0JawForward","float",0),this.setUniform("u_face0JawLeft","float",0),this.setUniform("u_face0JawOpen","float",0),this.setUniform("u_face0JawRight","float",0),this.setUniform("u_face0MouthClose","float",0),this.setUniform("u_face0MouthDimpleLeft","float",0),this.setUniform("u_face0MouthDimpleRight","float",0),this.setUniform("u_face0MouthFrownLeft","float",0),this.setUniform("u_face0MouthFrownRight","float",0),this.setUniform("u_face0MouthFunnel","float",0),this.setUniform("u_face0MouthLeft","float",0),this.setUniform("u_face0MouthLowerDownLeft","float",0),this.setUniform("u_face0MouthLowerDownRight","float",0),this.setUniform("u_face0MouthPressLeft","float",0),this.setUniform("u_face0MouthPressRight","float",0),this.setUniform("u_face0MouthPucker","float",0),this.setUniform("u_face0MouthRight","float",0),this.setUniform("u_face0MouthRollLower","float",0),this.setUniform("u_face0MouthRollUpper","float",0),this.setUniform("u_face0MouthShrugLower","float",0),this.setUniform("u_face0MouthShrugUpper","float",0),this.setUniform("u_face0MouthSmileLeft","float",0),this.setUniform("u_face0MouthSmileRight","float",0),this.setUniform("u_face0MouthStretchLeft","float",0),this.setUniform("u_face0MouthStretchRight","float",0),this.setUniform("u_face0MouthUpperUpLeft","float",0),this.setUniform("u_face0MouthUpperUpRight","float",0),this.setUniform("u_face0NoseSneerLeft","float",0),this.setUniform("u_face0NoseSneerRight","float",0),this.setUniform("u_face0TongueOut","float",0);const N=i.cv?.hands||[],F=this.visibleFeatures.has("handTracking");this.setUniform("u_handCount","int",F?N.length:0);const U=F?N.find(v=>v.handedness==="left"):void 0,P=F?N.find(v=>v.handedness==="right"):void 0;if(U){const v=U.palm||U.landmarks?.[9],y=U.gestures||{},k=U.bounds;this.setUniform("u_leftHandPalm","vec3",[v?.x||0,1-(v?.y||0),v?.z||0]),this.setUniform("u_leftHandConfidence","float",U.confidence||0),this.setUniform("u_leftHandBounds","vec4",[k?.x||0,1-(k?.y||0)-(k?.height||0),k?.width||0,k?.height||0]),this.setUniform("u_leftHandFist","float",y.fist||0),this.setUniform("u_leftHandOpen","float",y.openPalm||0),this.setUniform("u_leftHandPeace","float",y.peace||0),this.setUniform("u_leftHandThumbsUp","float",y.thumbsUp||0),this.setUniform("u_leftHandThumbsDown","float",y.thumbsDown||0),this.setUniform("u_leftHandPointing","float",y.pointing||0),this.setUniform("u_leftHandILoveYou","float",y.iLoveYou||0)}else this.setUniform("u_leftHandPalm","vec3",[0,0,0]),this.setUniform("u_leftHandConfidence","float",0),this.setUniform("u_leftHandBounds","vec4",[0,0,0,0]),this.setUniform("u_leftHandFist","float",0),this.setUniform("u_leftHandOpen","float",0),this.setUniform("u_leftHandPeace","float",0),this.setUniform("u_leftHandThumbsUp","float",0),this.setUniform("u_leftHandThumbsDown","float",0),this.setUniform("u_leftHandPointing","float",0),this.setUniform("u_leftHandILoveYou","float",0);if(P){const v=P.palm||P.landmarks?.[9],y=P.gestures||{},k=P.bounds;this.setUniform("u_rightHandPalm","vec3",[v?.x||0,1-(v?.y||0),v?.z||0]),this.setUniform("u_rightHandConfidence","float",P.confidence||0),this.setUniform("u_rightHandBounds","vec4",[k?.x||0,1-(k?.y||0)-(k?.height||0),k?.width||0,k?.height||0]),this.setUniform("u_rightHandFist","float",y.fist||0),this.setUniform("u_rightHandOpen","float",y.openPalm||0),this.setUniform("u_rightHandPeace","float",y.peace||0),this.setUniform("u_rightHandThumbsUp","float",y.thumbsUp||0),this.setUniform("u_rightHandThumbsDown","float",y.thumbsDown||0),this.setUniform("u_rightHandPointing","float",y.pointing||0),this.setUniform("u_rightHandILoveYou","float",y.iLoveYou||0)}else this.setUniform("u_rightHandPalm","vec3",[0,0,0]),this.setUniform("u_rightHandConfidence","float",0),this.setUniform("u_rightHandBounds","vec4",[0,0,0,0]),this.setUniform("u_rightHandFist","float",0),this.setUniform("u_rightHandOpen","float",0),this.setUniform("u_rightHandPeace","float",0),this.setUniform("u_rightHandThumbsUp","float",0),this.setUniform("u_rightHandThumbsDown","float",0),this.setUniform("u_rightHandPointing","float",0),this.setUniform("u_rightHandILoveYou","float",0);const $=this.visibleFeatures.has("poseDetection")?i.cv?.pose??null:null;if(this.setUniform("u_poseDetected","bool",$!==null),$&&$.landmarks){const v=$.landmarks,y=k=>1-(v[k]?.y||0);this.setUniform("u_poseConfidence","float",$.confidence||0),this.setUniform("u_nosePosition","vec2",[v[0]?.x||0,y(0)]),this.setUniform("u_leftShoulderPosition","vec2",[v[11]?.x||0,y(11)]),this.setUniform("u_rightShoulderPosition","vec2",[v[12]?.x||0,y(12)]),this.setUniform("u_leftElbowPosition","vec2",[v[13]?.x||0,y(13)]),this.setUniform("u_rightElbowPosition","vec2",[v[14]?.x||0,y(14)]),this.setUniform("u_leftWristPosition","vec2",[v[15]?.x||0,y(15)]),this.setUniform("u_rightWristPosition","vec2",[v[16]?.x||0,y(16)]),this.setUniform("u_leftHipPosition","vec2",[v[23]?.x||0,y(23)]),this.setUniform("u_rightHipPosition","vec2",[v[24]?.x||0,y(24)]),this.setUniform("u_leftKneePosition","vec2",[v[25]?.x||0,y(25)]),this.setUniform("u_rightKneePosition","vec2",[v[26]?.x||0,y(26)]),this.setUniform("u_leftAnklePosition","vec2",[v[27]?.x||0,y(27)]),this.setUniform("u_rightAnklePosition","vec2",[v[28]?.x||0,y(28)])}else this.setUniform("u_poseConfidence","float",0),this.setUniform("u_nosePosition","vec2",[0,0]),this.setUniform("u_leftShoulderPosition","vec2",[0,0]),this.setUniform("u_rightShoulderPosition","vec2",[0,0]),this.setUniform("u_leftElbowPosition","vec2",[0,0]),this.setUniform("u_rightElbowPosition","vec2",[0,0]),this.setUniform("u_leftWristPosition","vec2",[0,0]),this.setUniform("u_rightWristPosition","vec2",[0,0]),this.setUniform("u_leftHipPosition","vec2",[0,0]),this.setUniform("u_rightHipPosition","vec2",[0,0]),this.setUniform("u_leftKneePosition","vec2",[0,0]),this.setUniform("u_rightKneePosition","vec2",[0,0]),this.setUniform("u_leftAnklePosition","vec2",[0,0]),this.setUniform("u_rightAnklePosition","vec2",[0,0]);const ee=this.visibleFeatures.has("bodySegmentation")?i.cv?.segmentation??null:null;ee?(this.updateSegmentationTexture(ee.mask,ee.width,ee.height),this.setUniform("u_segmentationRes","vec2",[ee.width,ee.height])):this.setUniform("u_segmentationRes","vec2",[0,0]);const Q=e.device;if(Q){const v=Q.motion;v?.acceleration?this.setUniform("u_deviceAcceleration","vec3",[v.acceleration.x??0,v.acceleration.y??0,v.acceleration.z??0]):this.setUniform("u_deviceAcceleration","vec3",[0,0,0]),v?.accelerationIncludingGravity?this.setUniform("u_deviceAccelerationGravity","vec3",[v.accelerationIncludingGravity.x??0,v.accelerationIncludingGravity.y??0,v.accelerationIncludingGravity.z??0]):this.setUniform("u_deviceAccelerationGravity","vec3",[0,0,0]),v?.rotationRate?this.setUniform("u_deviceRotationRate","vec3",[v.rotationRate.alpha??0,v.rotationRate.beta??0,v.rotationRate.gamma??0]):this.setUniform("u_deviceRotationRate","vec3",[0,0,0]);const y=Q.orientation;y?(this.setUniform("u_deviceOrientation","vec3",[y.alpha??0,y.beta??0,y.gamma??0]),this.setUniform("u_deviceOrientationAbsolute","bool",y.absolute)):(this.setUniform("u_deviceOrientation","vec3",[0,0,0]),this.setUniform("u_deviceOrientationAbsolute","bool",false))}else this.setUniform("u_deviceAcceleration","vec3",[0,0,0]),this.setUniform("u_deviceAccelerationGravity","vec3",[0,0,0]),this.setUniform("u_deviceRotationRate","vec3",[0,0,0]),this.setUniform("u_deviceOrientation","vec3",[0,0,0]),this.setUniform("u_deviceOrientationAbsolute","bool",false);const z=e.devices||[],ne=Math.min(z.length,je.MAX_EXTERNAL_DEVICES);this.setUniform("u_externalDeviceCount","int",ne);for(let v=0;v<je.MAX_EXTERNAL_DEVICES;v++)if(v<ne){const y=z[v],k=y.motion;k?.acceleration?this.setUniform(`u_device${v}Acceleration`,"vec3",[k.acceleration.x??0,k.acceleration.y??0,k.acceleration.z??0]):this.setUniform(`u_device${v}Acceleration`,"vec3",[0,0,0]),k?.accelerationIncludingGravity?this.setUniform(`u_device${v}AccelerationGravity`,"vec3",[k.accelerationIncludingGravity.x??0,k.accelerationIncludingGravity.y??0,k.accelerationIncludingGravity.z??0]):this.setUniform(`u_device${v}AccelerationGravity`,"vec3",[0,0,0]),k?.rotationRate?this.setUniform(`u_device${v}RotationRate`,"vec3",[k.rotationRate.alpha??0,k.rotationRate.beta??0,k.rotationRate.gamma??0]):this.setUniform(`u_device${v}RotationRate`,"vec3",[0,0,0]);const V=y.orientation;V?this.setUniform(`u_device${v}Orientation`,"vec3",[V.alpha??0,V.beta??0,V.gamma??0]):this.setUniform(`u_device${v}Orientation`,"vec3",[0,0,0])}else this.setUniform(`u_device${v}Acceleration`,"vec3",[0,0,0]),this.setUniform(`u_device${v}AccelerationGravity`,"vec3",[0,0,0]),this.setUniform(`u_device${v}RotationRate`,"vec3",[0,0,0]),this.setUniform(`u_device${v}Orientation`,"vec3",[0,0,0])}updateAccumulators(e,s){const i=e.deltaTime||0;for(const r of this.parameters){if(r.type!=="accumulator")continue;const a=r.config.rate;let o;if(typeof a=="number")o=a;else{const h=s.get(a);h!==void 0?o=h.value??0:this.scalarUniformCache.has(a)?o=this.scalarUniformCache.get(a):(this.accumulatorWarned.has(r.uniformName)||(console.warn(`Accumulator '${r.uniformName}': rate source '${a}' not found, using 0`),this.accumulatorWarned.add(r.uniformName)),o=0)}const l=(this.accumulatorValues.get(r.uniformName)??0)+o*i;this.accumulatorValues.set(r.uniformName,l),this.setUniform(r.uniformName,"float",l)}}updateParameterUniforms(e){for(const s of this.parameters){if(s.type==="accumulator")continue;const i=e.get(s.uniformName);if(!i){s.type!=="cv"&&Math.random()<.01&&console.log(`[ShaderAdapter] Parameter '${s.uniformName}' not found in parameterObjects`);continue}const r=i.value;switch(s.type){case"slider":case"number":this.setUniform(s.uniformName,"float",r);break;case"color":{const a=r,o=s.config.alpha===true;this.colorUniformCacheKey.get(s.uniformName)!==a&&(this.colorUniformCache.set(s.uniformName,o?Co(a):Ao(a)),this.colorUniformCacheKey.set(s.uniformName,a)),this.setUniform(s.uniformName,o?"vec4":"vec3",this.colorUniformCache.get(s.uniformName));break}case"toggle":case"cv":this.setUniform(s.uniformName,"bool",r);break;case"select":{const a=s.config.options?.indexOf(r)||0;this.setUniform(s.uniformName,"int",a);break}case"image":r&&this.updateImageTexture(s.uniformName,r);break;case"button":this.setUniform(s.uniformName,"bool",r);break;case"coordinate":r&&typeof r=="object"&&"x"in r&&"y"in r&&this.setUniform(s.uniformName,"vec2",[r.x,r.y]);break;case"gradient":{const a=r;if(!Array.isArray(a))break;const o=s.config.alpha===true,c=s.config.maxStops,l=o?4:3;let h=this.gradientBuffers.get(s.uniformName);if(h||(h={colors:new Float32Array(c*l),positions:new Float32Array(c),key:null},this.gradientBuffers.set(s.uniformName,h)),h.key!==a){const d=Math.min(a.length,c);for(let m=0;m<d;m++)h.colors.set(o?Co(a[m].color):Ao(a[m].color),m*l),h.positions[m]=a[m].position;h.key=a,this.setUniform(`${s.uniformName}_colors`,o?"vec4v":"vec3v",h.colors),this.setUniform(`${s.uniformName}_positions`,"floatv",h.positions),this.setUniform(`${s.uniformName}_count`,"int",d)}break}}}}setUniform(e,s,i){switch(s){case"float":this.scalarUniformCache.set(e,i);break;case"int":this.scalarUniformCache.set(e,i);break;case"bool":this.scalarUniformCache.set(e,i?1:0);break;case"vec2":this.scalarUniformCache.set(e+".x",i[0]),this.scalarUniformCache.set(e+".y",i[1]);break;case"vec3":this.scalarUniformCache.set(e+".x",i[0]),this.scalarUniformCache.set(e+".y",i[1]),this.scalarUniformCache.set(e+".z",i[2]);break;case"vec4":this.scalarUniformCache.set(e+".x",i[0]),this.scalarUniformCache.set(e+".y",i[1]),this.scalarUniformCache.set(e+".z",i[2]),this.scalarUniformCache.set(e+".w",i[3]);break}const r=this.uniformLocations.get(e);if(r==null)return;const a=this.gl;switch(s){case"float":a.uniform1f(r,i);break;case"int":a.uniform1i(r,i);break;case"bool":a.uniform1i(r,i?1:0);break;case"vec2":a.uniform2f(r,i[0],i[1]);break;case"vec3":a.uniform3f(r,i[0],i[1],i[2]);break;case"vec4":a.uniform4f(r,i[0],i[1],i[2],i[3]);break;case"floatv":a.uniform1fv(r,i);break;case"vec3v":a.uniform3fv(r,i);break;case"vec4v":a.uniform4fv(r,i);break}}updateAudioFFTTexture(e){const s=this.gl,i=this.textureUnits.get("u_audioFFT");if(i===void 0)return;this.audioFFTTexture||(this.audioFFTTexture=s.createTexture()),s.activeTexture(s.TEXTURE0+i),s.bindTexture(s.TEXTURE_2D,this.audioFFTTexture),s.texImage2D(s.TEXTURE_2D,0,s.LUMINANCE,e.length,1,0,s.LUMINANCE,s.UNSIGNED_BYTE,e),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MIN_FILTER,s.NEAREST),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MAG_FILTER,s.NEAREST),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_S,s.CLAMP_TO_EDGE),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_T,s.CLAMP_TO_EDGE);const r=this.uniformLocations.get("u_audioFFT");r&&s.uniform1i(r,i)}updateAudioWaveformTexture(e){const s=this.gl,i=this.textureUnits.get("u_audioWaveform");if(i===void 0)return;this.audioWaveformTexture||(this.audioWaveformTexture=s.createTexture());const r=new Uint8Array(e.length);for(let o=0;o<e.length;o++)r[o]=Math.round((e[o]*.5+.5)*255);s.activeTexture(s.TEXTURE0+i),s.bindTexture(s.TEXTURE_2D,this.audioWaveformTexture),s.texImage2D(s.TEXTURE_2D,0,s.LUMINANCE,r.length,1,0,s.LUMINANCE,s.UNSIGNED_BYTE,r),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MIN_FILTER,s.NEAREST),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MAG_FILTER,s.NEAREST),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_S,s.CLAMP_TO_EDGE),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_T,s.CLAMP_TO_EDGE);const a=this.uniformLocations.get("u_audioWaveform");a&&s.uniform1i(a,i)}updateVideoTexture(e){const s=this.gl,i=this.textureUnits.get("u_video");if(i===void 0){e instanceof ImageBitmap&&e.close();return}this.videoTexture||(this.videoTexture=s.createTexture()),s.activeTexture(s.TEXTURE0+i),s.bindTexture(s.TEXTURE_2D,this.videoTexture);const r=e instanceof OffscreenCanvas;r&&s.pixelStorei(s.UNPACK_FLIP_Y_WEBGL,true),s.texImage2D(s.TEXTURE_2D,0,s.RGBA,s.RGBA,s.UNSIGNED_BYTE,e),r&&s.pixelStorei(s.UNPACK_FLIP_Y_WEBGL,false),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MIN_FILTER,s.LINEAR),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MAG_FILTER,s.LINEAR),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_S,s.CLAMP_TO_EDGE),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_T,s.CLAMP_TO_EDGE);const a=this.uniformLocations.get("u_video");a&&s.uniform1i(a,i),e instanceof ImageBitmap&&e.close()}updateAnalysedFrameTexture(e){const s=this.gl,i=this.textureUnits.get("u_videoAnalysed");if(i===void 0)return;this.analysedFrameTexture||(this.analysedFrameTexture=s.createTexture()),s.activeTexture(s.TEXTURE0+i),s.bindTexture(s.TEXTURE_2D,this.analysedFrameTexture),s.pixelStorei(s.UNPACK_FLIP_Y_WEBGL,true),s.texImage2D(s.TEXTURE_2D,0,s.RGBA,s.RGBA,s.UNSIGNED_BYTE,e),s.pixelStorei(s.UNPACK_FLIP_Y_WEBGL,false),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MIN_FILTER,s.LINEAR),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MAG_FILTER,s.LINEAR),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_S,s.CLAMP_TO_EDGE),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_T,s.CLAMP_TO_EDGE);const r=this.uniformLocations.get("u_videoAnalysed");r&&s.uniform1i(r,i)}bindAnalysedFrameFallback(){const e=this.gl,s=this.textureUnits.get("u_videoAnalysed");if(s===void 0)return;if(this.analysedFrameFallbackTexture)e.activeTexture(e.TEXTURE0+s),e.bindTexture(e.TEXTURE_2D,this.analysedFrameFallbackTexture);else{this.analysedFrameFallbackTexture=e.createTexture(),e.activeTexture(e.TEXTURE0+s),e.bindTexture(e.TEXTURE_2D,this.analysedFrameFallbackTexture);const r=new Uint8Array([0,0,0,255]);e.texImage2D(e.TEXTURE_2D,0,e.RGBA,1,1,0,e.RGBA,e.UNSIGNED_BYTE,r),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.NEAREST),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.NEAREST),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE)}const i=this.uniformLocations.get("u_videoAnalysed");i&&e.uniform1i(i,s)}updateVideoStreamTexture(e,s){const i=this.gl,r=`u_videoStream${e}`,a=this.textureUnits.get(r);if(a===void 0){s instanceof ImageBitmap&&s.close();return}this.videoStreamTextures[e]||(this.videoStreamTextures[e]=i.createTexture()),i.activeTexture(i.TEXTURE0+a),i.bindTexture(i.TEXTURE_2D,this.videoStreamTextures[e]);const o=s instanceof OffscreenCanvas;o&&i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,true),i.texImage2D(i.TEXTURE_2D,0,i.RGBA,i.RGBA,i.UNSIGNED_BYTE,s),o&&i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,false),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MIN_FILTER,i.LINEAR),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MAG_FILTER,i.LINEAR),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_S,i.CLAMP_TO_EDGE),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_T,i.CLAMP_TO_EDGE);const c=this.uniformLocations.get(r);c&&i.uniform1i(c,a),s instanceof ImageBitmap&&s.close()}updateDeviceTexture(e,s){if(!this.gl||e>=je.MAX_DEVICE_VIDEOS)return;this.deviceTextures[e]||(this.deviceTextures[e]=this.gl.createTexture());const i=this.deviceTextures[e],r=this.textureUnits.get(`u_device${e}`);if(!i||r===void 0){s instanceof ImageBitmap&&s.close();return}this.gl.activeTexture(this.gl.TEXTURE0+r),this.gl.bindTexture(this.gl.TEXTURE_2D,i);const a=s instanceof OffscreenCanvas;a&&this.gl.pixelStorei(this.gl.UNPACK_FLIP_Y_WEBGL,true),this.gl.texImage2D(this.gl.TEXTURE_2D,0,this.gl.RGBA,this.gl.RGBA,this.gl.UNSIGNED_BYTE,s),a&&this.gl.pixelStorei(this.gl.UNPACK_FLIP_Y_WEBGL,false),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MIN_FILTER,this.gl.LINEAR),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MAG_FILTER,this.gl.LINEAR),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_S,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_T,this.gl.CLAMP_TO_EDGE);const o=`u_device${e}`,c=this.uniformLocations.get(o);c&&this.gl.uniform1i(c,r),s instanceof ImageBitmap&&s.close()}updateSegmentationTexture(e,s,i){const r=this.gl,a=this.textureUnits.get("u_segmentationMask");if(a===void 0)return;this.segmentationTexture||(this.segmentationTexture=r.createTexture()),r.activeTexture(r.TEXTURE0+a),r.bindTexture(r.TEXTURE_2D,this.segmentationTexture),r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,true),r.texImage2D(r.TEXTURE_2D,0,r.LUMINANCE,s,i,0,r.LUMINANCE,r.UNSIGNED_BYTE,e),r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,false),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,r.NEAREST),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MAG_FILTER,r.NEAREST),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,r.CLAMP_TO_EDGE);const o=this.uniformLocations.get("u_segmentationMask");o&&r.uniform1i(o,a)}updateKeyboardTexture(e){const s=this.gl,i=this.textureUnits.get("u_keyboard");if(i===void 0)return;this.keyboardTexture||(this.keyboardTexture=s.createTexture()),s.activeTexture(s.TEXTURE0+i),s.bindTexture(s.TEXTURE_2D,this.keyboardTexture),s.texImage2D(s.TEXTURE_2D,0,s.LUMINANCE,256,3,0,s.LUMINANCE,s.UNSIGNED_BYTE,e),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MIN_FILTER,s.NEAREST),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MAG_FILTER,s.NEAREST),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_S,s.CLAMP_TO_EDGE),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_T,s.CLAMP_TO_EDGE);const r=this.uniformLocations.get("u_keyboard");r&&s.uniform1i(r,i)}updateImageTexture(e,s){const i=this.gl,r=this.textureUnits.get(e);if(r===void 0)return;if(!this.textures.has(e)){const c=i.createTexture();c&&this.textures.set(e,c)}const a=this.textures.get(e);if(!a)return;i.activeTexture(i.TEXTURE0+r),i.bindTexture(i.TEXTURE_2D,a),i.texImage2D(i.TEXTURE_2D,0,i.RGBA,i.RGBA,i.UNSIGNED_BYTE,s),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MIN_FILTER,i.LINEAR),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MAG_FILTER,i.LINEAR),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_S,i.CLAMP_TO_EDGE),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_T,i.CLAMP_TO_EDGE);const o=this.uniformLocations.get(e);o&&i.uniform1i(o,r)}resize(e,s){this.gl.viewport(0,0,e,s),this.backbufferEnabled&&this.createBackbufferFramebuffers()}getParameterDefinitions(){return this.parameters}destroy(){this.destroyed=true;const e=this.gl;this.program&&(e.deleteProgram(this.program),this.program=null),this.audioFFTTexture&&e.deleteTexture(this.audioFFTTexture),this.audioWaveformTexture&&e.deleteTexture(this.audioWaveformTexture),this.videoTexture&&e.deleteTexture(this.videoTexture),this.analysedFrameTexture&&e.deleteTexture(this.analysedFrameTexture),this.analysedFrameFallbackTexture&&e.deleteTexture(this.analysedFrameFallbackTexture),this.segmentationTexture&&e.deleteTexture(this.segmentationTexture);for(const s of this.videoStreamTextures)s&&e.deleteTexture(s);this.videoStreamTextures=[];for(const s of this.deviceTextures)s&&e.deleteTexture(s);this.deviceTextures=[];for(const s of this.textures.values())s&&e.deleteTexture(s);this.textures.clear(),this.backbufferFramebuffer&&e.deleteFramebuffer(this.backbufferFramebuffer),this.backbufferTexture&&e.deleteTexture(this.backbufferTexture),this.currentFramebuffer&&e.deleteFramebuffer(this.currentFramebuffer),this.currentTexture&&e.deleteTexture(this.currentTexture),this.quadBuffer&&e.deleteBuffer(this.quadBuffer),this.gradientBuffers.clear(),this.colorUniformCache.clear(),this.colorUniformCacheKey.clear(),this.scalarUniformCache.clear(),this.accumulatorValues.clear(),this.uniformLocations.clear(),this.textureUnits.clear()}}const qe=(t,e,s)=>zt(t,e,s),Vu=us,$u=Na,ts=(...t)=>kf(...t),ia=t=>Ou(t),ju=Uu,qu=t=>Sf(t),zi=BigInt(0),ra=BigInt(1);function oi(t,e=""){if(typeof t!="boolean"){const s=e&&`"${e}" `;throw new TypeError(s+"expected boolean, got type="+typeof t)}return t}function Ua(t){if(typeof t=="bigint"){if(!Fi(t))throw new RangeError("positive bigint expected, got "+t)}else Vu(t);return t}function na(t,e=""){if(typeof t!="number"){const s=e&&`"${e}" `;throw new TypeError(s+"expected number, got type="+typeof t)}if(!Number.isSafeInteger(t)){const s=e&&`"${e}" `;throw new RangeError(s+"expected safe integer, got "+t)}}function Ai(t){const e=Ua(t).toString(16);return e.length&1?"0"+e:e}function Hu(t){if(typeof t!="string")throw new TypeError("hex string expected, got "+typeof t);return t===""?zi:BigInt("0x"+t)}function kr(t){return Hu(Na(t))}function Gu(t){return Hu(Na(Mf(zt(t)).reverse()))}function Ma(t,e){if(us(e),e===0)throw new RangeError("zero length");t=Ua(t);const s=t.toString(16);if(s.length>e*2)throw new RangeError("number too large");return Ou(s.padStart(e*2,"0"))}function Wu(t,e){return Ma(t,e).reverse()}function Mf(t){return Uint8Array.from(qe(t))}const Fi=t=>typeof t=="bigint"&&zi<=t;function Bf(t,e,s){return Fi(t)&&Fi(e)&&Fi(s)&&e<=t&&t<s}function Xu(t,e,s,i){if(!Bf(e,s,i))throw new RangeError("expected valid "+t+": "+s+" <= n < "+i+", got "+e)}function Ba(t){if(t<zi)throw new Error("expected non-negative bigint, got "+t);let e;for(e=0;t>zi;t>>=ra,e+=1);return e}const Oa=t=>(ra<<BigInt(t))-ra;function Of(t,e,s){if(us(t,"hashLen"),us(e,"qByteLen"),typeof s!="function")throw new TypeError("hmacFn must be a function");const i=F=>new Uint8Array(F),r=Uint8Array.of(),a=Uint8Array.of(0),o=Uint8Array.of(1),c=1e3;let l=i(t),h=i(t),d=0;const m=()=>{l.fill(1),h.fill(0),d=0},_=(...F)=>s(h,ts(l,...F)),x=(F=r)=>{h=_(a,F),l=_(),F.length!==0&&(h=_(o,F),l=_())},E=()=>{if(d++>=c)throw new Error("drbg: tried max amount of iterations");let F=0;const U=[];for(;F<e;){l=_();const P=l.slice();U.push(P),F+=l.length}return ts(...U)};return(F,U)=>{m(),x(F);let P;for(;(P=U(E()))===void 0;)x();return m(),P}}function wr(t,e={},s={}){if(Object.prototype.toString.call(t)!=="[object Object]")throw new TypeError("expected valid options object");function i(a,o,c){if(!c&&o!=="function"&&!Object.hasOwn(t,a))throw new TypeError(`param "${a}" is invalid: expected own property`);const l=t[a];if(c&&l===void 0)return;const h=typeof l;if(h!==o||l===null)throw new TypeError(`param "${a}" is invalid: expected ${o}, got ${h}`)}const r=(a,o)=>Object.entries(a).forEach(([c,l])=>i(c,l,o));r(e,false),r(s,true)}const et=BigInt(0),De=BigInt(1),ms=BigInt(2),zu=BigInt(3),Yu=BigInt(4),Ku=BigInt(5),Vf=BigInt(7),Zu=BigInt(8),$f=BigInt(9),Qu=BigInt(16);function dt(t,e){if(e<=et)throw new Error("mod: expected positive modulus, got "+e);const s=t%e;return s>=et?s:e+s}function Yo(t,e){if(t===et)throw new Error("invert: expected non-zero number");if(e<=et)throw new Error("invert: expected positive modulus, got "+e);let s=dt(t,e),i=e,r=et,a=De;for(;s!==et;){const c=i/s,l=i-s*c,h=r-a*c;i=s,s=l,r=a,a=h}if(i!==De)throw new Error("invert: does not exist");return dt(r,e)}function Va(t,e,s){const i=t;if(!i.eql(i.sqr(e),s))throw new Error("Cannot find square root")}function Ju(t,e){const s=t,i=(s.ORDER+De)/Yu,r=s.pow(e,i);return Va(s,r,e),r}function jf(t,e){const s=t,i=(s.ORDER-Ku)/Zu,r=s.mul(e,ms),a=s.pow(r,i),o=s.mul(e,a),c=s.mul(s.mul(o,ms),a),l=s.mul(o,s.sub(c,s.ONE));return Va(s,l,e),l}function qf(t){const e=$a(t),s=el(t),i=s(e,e.neg(e.ONE)),r=s(e,i),a=s(e,e.neg(i)),o=(t+Vf)/Qu;return(c,l)=>{const h=c;let d=h.pow(l,o),m=h.mul(d,i);const _=h.mul(d,r),x=h.mul(d,a),E=h.eql(h.sqr(m),l),N=h.eql(h.sqr(_),l);d=h.cmov(d,m,E),m=h.cmov(x,_,N);const F=h.eql(h.sqr(m),l),U=h.cmov(d,m,F);return Va(h,U,l),U}}function el(t){if(t<zu)throw new Error("sqrt is not defined for small field");let e=t-De,s=0;for(;e%ms===et;)e/=ms,s++;let i=ms;const r=$a(t);for(;Ko(r,i)===1;)if(i++>1e3)throw new Error("Cannot find square root: probably non-prime P");if(s===1)return Ju;let a=r.pow(i,e);const o=(e+De)/ms;return function(l,h){const d=l;if(d.is0(h))return h;if(Ko(d,h)!==1)throw new Error("Cannot find square root");let m=s,_=d.mul(d.ONE,a),x=d.pow(h,e),E=d.pow(h,o);for(;!d.eql(x,d.ONE);){if(d.is0(x))return d.ZERO;let N=1,F=d.sqr(x);for(;!d.eql(F,d.ONE);)if(N++,F=d.sqr(F),N===m)throw new Error("Cannot find square root");const U=De<<BigInt(m-N-1),P=d.pow(_,U);m=N,_=d.sqr(P),x=d.mul(x,_),E=d.mul(E,P)}return E}}function Hf(t){return t%Yu===zu?Ju:t%Zu===Ku?jf:t%Qu===$f?qf(t):el(t)}const Gf=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function Wf(t){const e={ORDER:"bigint",BYTES:"number",BITS:"number"},s=Gf.reduce((i,r)=>(i[r]="function",i),e);if(wr(t,s),na(t.BYTES,"BYTES"),na(t.BITS,"BITS"),t.BYTES<1||t.BITS<1)throw new Error("invalid field: expected BYTES/BITS > 0");if(t.ORDER<=De)throw new Error("invalid field: expected ORDER > 1, got "+t.ORDER);return t}function Xf(t,e,s){const i=t;if(s<et)throw new Error("invalid exponent, negatives unsupported");if(s===et)return i.ONE;if(s===De)return e;let r=i.ONE,a=e;for(;s>et;)s&De&&(r=i.mul(r,a)),a=i.sqr(a),s>>=De;return r}function tl(t,e,s=false){const i=t,r=new Array(e.length).fill(s?i.ZERO:void 0),a=e.reduce((c,l,h)=>i.is0(l)?c:(r[h]=c,i.mul(c,l)),i.ONE),o=i.inv(a);return e.reduceRight((c,l,h)=>i.is0(l)?c:(r[h]=i.mul(c,r[h]),i.mul(c,l)),o),r}function Ko(t,e){const s=t,i=(s.ORDER-De)/ms,r=s.pow(e,i),a=s.eql(r,s.ONE),o=s.eql(r,s.ZERO),c=s.eql(r,s.neg(s.ONE));if(!a&&!o&&!c)throw new Error("invalid Legendre symbol result");return a?1:o?0:-1}function zf(t,e){if(e!==void 0&&Vu(e),t<=et)throw new Error("invalid n length: expected positive n, got "+t);if(e!==void 0&&e<1)throw new Error("invalid n length: expected positive bit length, got "+e);const s=Ba(t);if(e!==void 0&&e<s)throw new Error(`invalid n length: expected bit length (${s}) >= n.length (${e})`);const i=e!==void 0?e:s,r=Math.ceil(i/8);return{nBitLength:i,nByteLength:r}}const Zo=new WeakMap;class sl{ORDER;BITS;BYTES;isLE;ZERO=et;ONE=De;_lengths;_mod;constructor(e,s={}){if(e<=De)throw new Error("invalid field: expected ORDER > 1, got "+e);let i;this.isLE=false,s!=null&&typeof s=="object"&&(typeof s.BITS=="number"&&(i=s.BITS),typeof s.sqrt=="function"&&Object.defineProperty(this,"sqrt",{value:s.sqrt,enumerable:true}),typeof s.isLE=="boolean"&&(this.isLE=s.isLE),s.allowedLengths&&(this._lengths=Object.freeze(s.allowedLengths.slice())),typeof s.modFromBytes=="boolean"&&(this._mod=s.modFromBytes));const{nBitLength:r,nByteLength:a}=zf(e,i);if(a>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");this.ORDER=e,this.BITS=r,this.BYTES=a,Object.freeze(this)}create(e){return dt(e,this.ORDER)}isValid(e){if(typeof e!="bigint")throw new TypeError("invalid field element: expected bigint, got "+typeof e);return et<=e&&e<this.ORDER}is0(e){return e===et}isValidNot0(e){return!this.is0(e)&&this.isValid(e)}isOdd(e){return(e&De)===De}neg(e){return dt(-e,this.ORDER)}eql(e,s){return e===s}sqr(e){return dt(e*e,this.ORDER)}add(e,s){return dt(e+s,this.ORDER)}sub(e,s){return dt(e-s,this.ORDER)}mul(e,s){return dt(e*s,this.ORDER)}pow(e,s){return Xf(this,e,s)}div(e,s){return dt(e*Yo(s,this.ORDER),this.ORDER)}sqrN(e){return e*e}addN(e,s){return e+s}subN(e,s){return e-s}mulN(e,s){return e*s}inv(e){return Yo(e,this.ORDER)}sqrt(e){let s=Zo.get(this);return s||Zo.set(this,s=Hf(this.ORDER)),s(this,e)}toBytes(e){return this.isLE?Wu(e,this.BYTES):Ma(e,this.BYTES)}fromBytes(e,s=false){qe(e);const{_lengths:i,BYTES:r,isLE:a,ORDER:o,_mod:c}=this;if(i){if(e.length<1||!i.includes(e.length)||e.length>r)throw new Error("Field.fromBytes: expected "+i+" bytes, got "+e.length);const h=new Uint8Array(r);h.set(e,a?0:h.length-e.length),e=h}if(e.length!==r)throw new Error("Field.fromBytes: expected "+r+" bytes, got "+e.length);let l=a?Gu(e):kr(e);if(c&&(l=dt(l,o)),!s&&!this.isValid(l))throw new Error("invalid field element: outside of range 0..ORDER");return l}invertBatch(e){return tl(this,e)}cmov(e,s,i){return oi(i,"condition"),i?s:e}}Object.freeze(sl.prototype);function $a(t,e={}){return new sl(t,e)}function il(t){if(typeof t!="bigint")throw new Error("field order must be bigint");if(t<=De)throw new Error("field order must be greater than 1");const e=Ba(t-De);return Math.ceil(e/8)}function rl(t){const e=il(t);return e+Math.ceil(e/2)}function Yf(t,e,s=false){qe(t);const i=t.length,r=il(e),a=Math.max(rl(e),16);if(i<a||i>1024)throw new Error("expected "+a+"-1024 bytes of input, got "+i);const o=s?Gu(t):kr(t),c=dt(o,e-De)+De;return s?Wu(c,r):Ma(c,r)}const Ms=BigInt(0),gs=BigInt(1);function Yi(t,e){const s=e.negate();return t?s:e}function Qo(t,e){const s=tl(t.Fp,e.map(i=>i.Z));return e.map((i,r)=>t.fromAffine(i.toAffine(s[r])))}function nl(t,e){if(!Number.isSafeInteger(t)||t<=0||t>e)throw new Error("invalid window size, expected [1.."+e+"], got W="+t)}function Fn(t,e){nl(t,e);const s=Math.ceil(e/t)+1,i=2**(t-1),r=2**t,a=Oa(t),o=BigInt(t);return{windows:s,windowSize:i,mask:a,maxNumber:r,shiftBy:o}}function Jo(t,e,s){const{windowSize:i,mask:r,maxNumber:a,shiftBy:o}=s;let c=Number(t&r),l=t>>o;c>i&&(c-=a,l+=gs);const h=e*i,d=h+Math.abs(c)-1,m=c===0,_=c<0,x=e%2!==0;return{nextN:l,offset:d,isZero:m,isNeg:_,isNegF:x,offsetF:h}}const Un=new WeakMap,al=new WeakMap;function Mn(t){return al.get(t)||1}function ec(t){if(t!==Ms)throw new Error("invalid wNAF")}class Kf{BASE;ZERO;Fn;bits;constructor(e,s){this.BASE=e.BASE,this.ZERO=e.ZERO,this.Fn=e.Fn,this.bits=s}_unsafeLadder(e,s,i=this.ZERO){let r=e;for(;s>Ms;)s&gs&&(i=i.add(r)),r=r.double(),s>>=gs;return i}precomputeWindow(e,s){const{windows:i,windowSize:r}=Fn(s,this.bits),a=[];let o=e,c=o;for(let l=0;l<i;l++){c=o,a.push(c);for(let h=1;h<r;h++)c=c.add(o),a.push(c);o=c.double()}return a}wNAF(e,s,i){if(!this.Fn.isValid(i))throw new Error("invalid scalar");let r=this.ZERO,a=this.BASE;const o=Fn(e,this.bits);for(let c=0;c<o.windows;c++){const{nextN:l,offset:h,isZero:d,isNeg:m,isNegF:_,offsetF:x}=Jo(i,c,o);i=l,d?a=a.add(Yi(_,s[x])):r=r.add(Yi(m,s[h]))}return ec(i),{p:r,f:a}}wNAFUnsafe(e,s,i,r=this.ZERO){const a=Fn(e,this.bits);for(let o=0;o<a.windows&&i!==Ms;o++){const{nextN:c,offset:l,isZero:h,isNeg:d}=Jo(i,o,a);if(i=c,!h){const m=s[l];r=r.add(d?m.negate():m)}}return ec(i),r}getPrecomputes(e,s,i){let r=Un.get(s);return r||(r=this.precomputeWindow(s,e),e!==1&&(typeof i=="function"&&(r=i(r)),Un.set(s,r))),r}cached(e,s,i){const r=Mn(e);return this.wNAF(r,this.getPrecomputes(r,e,i),s)}unsafe(e,s,i,r){const a=Mn(e);return a===1?this._unsafeLadder(e,s,r):this.wNAFUnsafe(a,this.getPrecomputes(a,e,i),s,r)}createCache(e,s){nl(s,this.bits),al.set(e,s),Un.delete(e)}hasCache(e){return Mn(e)!==1}}function Zf(t,e,s,i){let r=e,a=t.ZERO,o=t.ZERO;for(;s>Ms||i>Ms;)s&gs&&(a=a.add(r)),i&gs&&(o=o.add(r)),r=r.double(),s>>=gs,i>>=gs;return{p1:a,p2:o}}function tc(t,e,s){if(e){if(e.ORDER!==t)throw new Error("Field.ORDER must match order: Fp == p, Fn == n");return Wf(e),e}else return $a(t,{isLE:s})}function Qf(t,e,s={},i){if(i===void 0&&(i=t==="edwards"),!e||typeof e!="object")throw new Error(`expected valid ${t} CURVE object`);for(const l of["p","n","h"]){const h=e[l];if(!(typeof h=="bigint"&&h>Ms))throw new Error(`CURVE.${l} must be positive bigint`)}const r=tc(e.p,s.Fp,i),a=tc(e.n,s.Fn,i),c=["Gx","Gy","a","b"];for(const l of c)if(!r.isValid(e[l]))throw new Error(`CURVE.${l} must be valid field element of CURVE.Fp`);return e=Object.freeze(Object.assign({},e)),{CURVE:e,Fp:r,Fn:a}}function Jf(t,e){return function(i){const r=t(i);return{secretKey:r,publicKey:e(r)}}}class sc{oHash;iHash;blockLen;outputLen;canXOF=false;finished=false;destroyed=false;constructor(e,s){if(xr(e),zt(s,void 0,"key"),this.iHash=e.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const i=this.blockLen,r=new Uint8Array(i);r.set(s.length>i?e.create().update(s).digest():s);for(let a=0;a<r.length;a++)r[a]^=54;this.iHash.update(r),this.oHash=e.create();for(let a=0;a<r.length;a++)r[a]^=106;this.oHash.update(r),ai(r)}update(e){return Xi(this),this.iHash.update(e),this}digestInto(e){Xi(this),Mu(e,this),this.finished=true;const s=e.subarray(0,this.outputLen);this.iHash.digestInto(s),this.oHash.update(s),this.oHash.digestInto(s),this.destroy()}digest(){const e=new Uint8Array(this.oHash.outputLen);return this.digestInto(e),e}_cloneInto(e){e||=Object.create(Object.getPrototypeOf(this),{});const{oHash:s,iHash:i,finished:r,destroyed:a,blockLen:o,outputLen:c}=this;return e=e,e.finished=r,e.destroyed=a,e.blockLen=o,e.outputLen=c,e.oHash=s._cloneInto(e.oHash),e.iHash=i._cloneInto(e.iHash),e}clone(){return this._cloneInto()}destroy(){this.destroyed=true,this.oHash.destroy(),this.iHash.destroy()}}const ja=(()=>{const t=(e,s,i)=>new sc(e,s).update(i).digest();return t.create=(e,s)=>new sc(e,s),t})();const ic=(t,e)=>(t+(t>=0?e:-e)/ol)/e;function ed(t,e,s){Xu("scalar",t,At,s);const[[i,r],[a,o]]=e,c=ic(o*t,s),l=ic(-r*t,s);let h=t-c*i-l*a,d=-c*r-l*o;const m=h<At,_=d<At;m&&(h=-h),_&&(d=-d);const x=Oa(Math.ceil(Ba(s)/2))+ss;if(h<At||h>=x||d<At||d>=x)throw new Error("splitScalar (endomorphism): failed for k");return{k1neg:m,k1:h,k2neg:_,k2:d}}function aa(t){if(!["compact","recovered","der"].includes(t))throw new Error('Signature format must be "compact", "recovered", or "der"');return t}function Bn(t,e){wr(t);const s={};for(let i of Object.keys(e))s[i]=t[i]===void 0?e[i]:t[i];return oi(s.lowS,"lowS"),oi(s.prehash,"prehash"),s.format!==void 0&&aa(s.format),s}class td extends Error{constructor(e=""){super(e)}}const pt={Err:td,_tlv:{encode:(t,e)=>{const{Err:s}=pt;if(na(t,"tag"),t<0||t>255)throw new s("tlv.encode: wrong tag");if(typeof e!="string")throw new TypeError('"data" expected string, got type='+typeof e);if(e.length&1)throw new s("tlv.encode: unpadded data");const i=e.length/2,r=Ai(i);if(r.length/2&128)throw new s("tlv.encode: long form length too big");const a=i>127?Ai(r.length/2|128):"";return Ai(t)+a+r+e},decode(t,e){const{Err:s}=pt;e=qe(e,void 0,"DER data");let i=0;if(t<0||t>255)throw new s("tlv.encode: wrong tag");if(e.length<2||e[i++]!==t)throw new s("tlv.decode: wrong tlv");const r=e[i++],a=!!(r&128);let o=0;if(!a)o=r;else{const l=r&127;if(!l)throw new s("tlv.decode(long): indefinite length not supported");if(l>4)throw new s("tlv.decode(long): byte length is too big");const h=e.subarray(i,i+l);if(h.length!==l)throw new s("tlv.decode: length bytes not complete");if(h[0]===0)throw new s("tlv.decode(long): zero leftmost byte");for(const d of h)o=o<<8|d;if(i+=l,o<128)throw new s("tlv.decode(long): not minimal encoding")}const c=e.subarray(i,i+o);if(c.length!==o)throw new s("tlv.decode: wrong value length");return{v:c,l:e.subarray(i+o)}}},_int:{encode(t){const{Err:e}=pt;if(Ua(t),t<At)throw new e("integer: negative integers are not allowed");let s=Ai(t);if(Number.parseInt(s[0],16)&8&&(s="00"+s),s.length&1)throw new e("unexpected DER parsing assertion: unpadded hex");return s},decode(t){const{Err:e}=pt;if(t.length<1)throw new e("invalid signature integer: empty");if(t[0]&128)throw new e("invalid signature integer: negative");if(t.length>1&&t[0]===0&&!(t[1]&128))throw new e("invalid signature integer: unnecessary leading zero");return kr(t)}},toSig(t){const{Err:e,_int:s,_tlv:i}=pt,r=qe(t,void 0,"signature"),{v:a,l:o}=i.decode(48,r);if(o.length)throw new e("invalid signature: left bytes after parsing");const{v:c,l}=i.decode(2,a),{v:h,l:d}=i.decode(2,l);if(d.length)throw new e("invalid signature: left bytes after parsing");return{r:s.decode(c),s:s.decode(h)}},hexFromSig(t){const{_tlv:e,_int:s}=pt,i=e.encode(2,s.encode(t.r)),r=e.encode(2,s.encode(t.s)),a=i+r;return e.encode(48,a)}};Object.freeze(pt._tlv);Object.freeze(pt._int);Object.freeze(pt);const At=BigInt(0),ss=BigInt(1),ol=BigInt(2),Ci=BigInt(3),sd=BigInt(4);function id(t,e={}){const s=Qf("weierstrass",t,e),i=s.Fp,r=s.Fn;let a=s.CURVE;const{h:o,n:c}=a;wr(e,{},{allowInfinityPoint:"boolean",clearCofactor:"function",isTorsionFree:"function",fromBytes:"function",toBytes:"function",endo:"object"});const{endo:l,allowInfinityPoint:h}=e;if(l&&(!i.is0(a.a)||typeof l.beta!="bigint"||!Array.isArray(l.basises)))throw new Error('invalid endo: expected "beta": bigint and "basises": array');const d=ul(i,r);function m(){if(!i.isOdd)throw new Error("compression is not supported: Field does not have .isOdd()")}function _(y,k,V){if(h&&k.is0())return Uint8Array.of(0);const{x:G,y:B}=k.toAffine(),R=i.toBytes(G);if(oi(V,"isCompressed"),V){m();const O=!i.isOdd(B);return ts(cl(O),R)}else return ts(Uint8Array.of(4),R,i.toBytes(B))}function x(y){qe(y,void 0,"Point");const{publicKey:k,publicKeyUncompressed:V}=d,G=y.length,B=y[0],R=y.subarray(1);if(h&&G===1&&B===0)return{x:i.ZERO,y:i.ZERO};if(G===k&&(B===2||B===3)){const O=i.fromBytes(R);if(!i.isValid(O))throw new Error("bad point: is not on curve, wrong x");const M=F(O);let C;try{C=i.sqrt(M)}catch(J){const ce=J instanceof Error?": "+J.message:"";throw new Error("bad point: is not on curve, sqrt error"+ce)}m();const H=i.isOdd(C);return(B&1)===1!==H&&(C=i.neg(C)),{x:O,y:C}}else if(G===V&&B===4){const O=i.BYTES,M=i.fromBytes(R.subarray(0,O)),C=i.fromBytes(R.subarray(O,O*2));if(!U(M,C))throw new Error("bad point: is not on curve");return{x:M,y:C}}else throw new Error(`bad point: got length ${G}, expected compressed=${k} or uncompressed=${V}`)}const E=e.toBytes===void 0?_:e.toBytes,N=e.fromBytes===void 0?x:e.fromBytes;function F(y){const k=i.sqr(y),V=i.mul(k,y);return i.add(i.add(V,i.mul(y,a.a)),a.b)}function U(y,k){const V=i.sqr(k),G=F(y);return i.eql(V,G)}if(!U(a.Gx,a.Gy))throw new Error("bad curve params: generator point");const P=i.mul(i.pow(a.a,Ci),sd),X=i.mul(i.sqr(a.b),BigInt(27));if(i.is0(i.add(P,X)))throw new Error("bad curve params: a or b");function $(y,k,V=false){if(!i.isValid(k)||V&&i.is0(k))throw new Error(`bad point coordinate ${y}`);return k}function te(y){if(!(y instanceof z))throw new Error("Weierstrass Point expected")}function ee(y){if(!l||!l.basises)throw new Error("no endo");return ed(y,l.basises,r.ORDER)}function Q(y,k,V,G,B){return V=new z(i.mul(V.X,y),V.Y,V.Z),k=Yi(G,k),V=Yi(B,V),k.add(V)}class z{static BASE=new z(a.Gx,a.Gy,i.ONE);static ZERO=new z(i.ZERO,i.ONE,i.ZERO);static Fp=i;static Fn=r;X;Y;Z;constructor(k,V,G){this.X=$("x",k),this.Y=$("y",V,true),this.Z=$("z",G),Object.freeze(this)}static CURVE(){return a}static fromAffine(k){const{x:V,y:G}=k||{};if(!k||!i.isValid(V)||!i.isValid(G))throw new Error("invalid affine point");if(k instanceof z)throw new Error("projective point not allowed");return i.is0(V)&&i.is0(G)?z.ZERO:new z(V,G,i.ONE)}static fromBytes(k){const V=z.fromAffine(N(qe(k,void 0,"point")));return V.assertValidity(),V}static fromHex(k){return z.fromBytes(ia(k))}get x(){return this.toAffine().x}get y(){return this.toAffine().y}precompute(k=8,V=true){return v.createCache(this,k),V||this.multiply(Ci),this}assertValidity(){const k=this;if(k.is0()){if(e.allowInfinityPoint&&i.is0(k.X)&&i.eql(k.Y,i.ONE)&&i.is0(k.Z))return;throw new Error("bad point: ZERO")}const{x:V,y:G}=k.toAffine();if(!i.isValid(V)||!i.isValid(G))throw new Error("bad point: x or y not field elements");if(!U(V,G))throw new Error("bad point: equation left != right");if(!k.isTorsionFree())throw new Error("bad point: not in prime-order subgroup")}hasEvenY(){const{y:k}=this.toAffine();if(!i.isOdd)throw new Error("Field doesn't support isOdd");return!i.isOdd(k)}equals(k){te(k);const{X:V,Y:G,Z:B}=this,{X:R,Y:O,Z:M}=k,C=i.eql(i.mul(V,M),i.mul(R,B)),H=i.eql(i.mul(G,M),i.mul(O,B));return C&&H}negate(){return new z(this.X,i.neg(this.Y),this.Z)}double(){const{a:k,b:V}=a,G=i.mul(V,Ci),{X:B,Y:R,Z:O}=this;let M=i.ZERO,C=i.ZERO,H=i.ZERO,W=i.mul(B,B),J=i.mul(R,R),ce=i.mul(O,O),oe=i.mul(B,R);return oe=i.add(oe,oe),H=i.mul(B,O),H=i.add(H,H),M=i.mul(k,H),C=i.mul(G,ce),C=i.add(M,C),M=i.sub(J,C),C=i.add(J,C),C=i.mul(M,C),M=i.mul(oe,M),H=i.mul(G,H),ce=i.mul(k,ce),oe=i.sub(W,ce),oe=i.mul(k,oe),oe=i.add(oe,H),H=i.add(W,W),W=i.add(H,W),W=i.add(W,ce),W=i.mul(W,oe),C=i.add(C,W),ce=i.mul(R,O),ce=i.add(ce,ce),W=i.mul(ce,oe),M=i.sub(M,W),H=i.mul(ce,J),H=i.add(H,H),H=i.add(H,H),new z(M,C,H)}add(k){te(k);const{X:V,Y:G,Z:B}=this,{X:R,Y:O,Z:M}=k;let C=i.ZERO,H=i.ZERO,W=i.ZERO;const J=a.a,ce=i.mul(a.b,Ci);let oe=i.mul(V,R),w=i.mul(G,O),T=i.mul(B,M),D=i.add(V,G),L=i.add(R,O);D=i.mul(D,L),L=i.add(oe,w),D=i.sub(D,L),L=i.add(V,B);let j=i.add(R,M);return L=i.mul(L,j),j=i.add(oe,T),L=i.sub(L,j),j=i.add(G,B),C=i.add(O,M),j=i.mul(j,C),C=i.add(w,T),j=i.sub(j,C),W=i.mul(J,L),C=i.mul(ce,T),W=i.add(C,W),C=i.sub(w,W),W=i.add(w,W),H=i.mul(C,W),w=i.add(oe,oe),w=i.add(w,oe),T=i.mul(J,T),L=i.mul(ce,L),w=i.add(w,T),T=i.sub(oe,T),T=i.mul(J,T),L=i.add(L,T),oe=i.mul(w,L),H=i.add(H,oe),oe=i.mul(j,L),C=i.mul(D,C),C=i.sub(C,oe),oe=i.mul(D,w),W=i.mul(j,W),W=i.add(W,oe),new z(C,H,W)}subtract(k){return te(k),this.add(k.negate())}is0(){return this.equals(z.ZERO)}multiply(k){const{endo:V}=e;if(!r.isValidNot0(k))throw new RangeError("invalid scalar: out of range");let G,B;const R=O=>v.cached(this,O,M=>Qo(z,M));if(V){const{k1neg:O,k1:M,k2neg:C,k2:H}=ee(k),{p:W,f:J}=R(M),{p:ce,f:oe}=R(H);B=J.add(oe),G=Q(V.beta,W,ce,O,C)}else{const{p:O,f:M}=R(k);G=O,B=M}return Qo(z,[G,B])[0]}multiplyUnsafe(k){const{endo:V}=e,G=this,B=k;if(!r.isValid(B))throw new RangeError("invalid scalar: out of range");if(B===At||G.is0())return z.ZERO;if(B===ss)return G;if(v.hasCache(this))return this.multiply(B);if(V){const{k1neg:R,k1:O,k2neg:M,k2:C}=ee(B),{p1:H,p2:W}=Zf(z,G,O,C);return Q(V.beta,H,W,R,M)}else return v.unsafe(G,B)}toAffine(k){const V=this;let G=k;const{X:B,Y:R,Z:O}=V;if(i.eql(O,i.ONE))return{x:B,y:R};const M=V.is0();G==null&&(G=M?i.ONE:i.inv(O));const C=i.mul(B,G),H=i.mul(R,G),W=i.mul(O,G);if(M)return{x:i.ZERO,y:i.ZERO};if(!i.eql(W,i.ONE))throw new Error("invZ was invalid");return{x:C,y:H}}isTorsionFree(){const{isTorsionFree:k}=e;return o===ss?true:k?k(z,this):v.unsafe(this,c).is0()}clearCofactor(){const{clearCofactor:k}=e;return o===ss?this:k?k(z,this):this.multiplyUnsafe(o)}isSmallOrder(){return o===ss?this.is0():this.clearCofactor().is0()}toBytes(k=true){return oi(k,"isCompressed"),this.assertValidity(),E(z,this,k)}toHex(k=true){return $u(this.toBytes(k))}toString(){return`<Point ${this.is0()?"ZERO":this.toHex()}>`}}const ne=r.BITS,v=new Kf(z,e.endo?Math.ceil(ne/2):ne);return ne>=8&&z.BASE.precompute(8),Object.freeze(z.prototype),Object.freeze(z),z}function cl(t){return Uint8Array.of(t?2:3)}function ul(t,e){return{secretKey:e.BYTES,publicKey:1+t.BYTES,publicKeyUncompressed:1+2*t.BYTES,publicKeyHasPrefix:true,signature:2*e.BYTES}}function rd(t,e={}){const{Fn:s}=t,i=e.randomBytes===void 0?qu:e.randomBytes,r=Object.assign(ul(t.Fp,s),{seed:Math.max(rl(s.ORDER),16)});function a(x){try{const E=s.fromBytes(x);return s.isValidNot0(E)}catch{return false}}function o(x,E){const{publicKey:N,publicKeyUncompressed:F}=r;try{const U=x.length;return E===true&&U!==N||E===false&&U!==F?false:!!t.fromBytes(x)}catch{return false}}function c(x){return x=x===void 0?i(r.seed):x,Yf(qe(x,r.seed,"seed"),s.ORDER)}function l(x,E=true){return t.BASE.multiply(s.fromBytes(x)).toBytes(E)}function h(x){const{secretKey:E,publicKey:N,publicKeyUncompressed:F}=r,U=s._lengths;if(!ju(x))return;const P=qe(x,void 0,"key").length,X=P===N||P===F,$=P===E||!!U?.includes(P);if(!(X&&$))return X}function d(x,E,N=true){if(h(x)===true)throw new Error("first arg must be private key");if(h(E)===false)throw new Error("second arg must be public key");const F=s.fromBytes(x);return t.fromBytes(E).multiply(F).toBytes(N)}const m={isValidSecretKey:a,isValidPublicKey:o,randomSecretKey:c},_=Jf(c,l);return Object.freeze(m),Object.freeze(r),Object.freeze({getPublicKey:l,getSharedSecret:d,keygen:_,Point:t,utils:m,lengths:r})}function nd(t,e,s={}){const i=e;xr(i),wr(s,{},{hmac:"function",lowS:"boolean",randomBytes:"function",bits2int:"function",bits2int_modN:"function"}),s=Object.assign({},s);const r=s.randomBytes===void 0?qu:s.randomBytes,a=s.hmac===void 0?(B,R)=>ja(i,B,R):s.hmac,{Fp:o,Fn:c}=t,{ORDER:l,BITS:h}=c,{keygen:d,getPublicKey:m,getSharedSecret:_,utils:x,lengths:E}=rd(t,s),N={prehash:true,lowS:typeof s.lowS=="boolean"?s.lowS:true,format:"compact",extraEntropy:false},F=l*ol+ss<o.ORDER;function U(B){const R=l>>ss;return B>R}function P(B,R){if(!c.isValidNot0(R))throw new Error(`invalid signature ${B}: out of range 1..Point.Fn.ORDER`);return R}function X(){if(F)throw new Error('"recovered" sig type is not supported for cofactor >2 curves')}function $(B,R){aa(R);const O=E.signature,M=R==="compact"?O:R==="recovered"?O+1:void 0;return qe(B,M)}class te{r;s;recovery;constructor(R,O,M){if(this.r=P("r",R),this.s=P("s",O),M!=null){if(X(),![0,1,2,3].includes(M))throw new Error("invalid recovery id");this.recovery=M}Object.freeze(this)}static fromBytes(R,O=N.format){$(R,O);let M;if(O==="der"){const{r:J,s:ce}=pt.toSig(qe(R));return new te(J,ce)}O==="recovered"&&(M=R[0],O="compact",R=R.subarray(1));const C=E.signature/2,H=R.subarray(0,C),W=R.subarray(C,C*2);return new te(c.fromBytes(H),c.fromBytes(W),M)}static fromHex(R,O){return this.fromBytes(ia(R),O)}assertRecovery(){const{recovery:R}=this;if(R==null)throw new Error("invalid recovery id: must be present");return R}addRecoveryBit(R){return new te(this.r,this.s,R)}recoverPublicKey(R){const{r:O,s:M}=this,C=this.assertRecovery(),H=C===2||C===3?O+l:O;if(!o.isValid(H))throw new Error("invalid recovery id: sig.r+curve.n != R.x");const W=o.toBytes(H),J=t.fromBytes(ts(cl((C&1)===0),W)),ce=c.inv(H),oe=Q(qe(R,void 0,"msgHash")),w=c.create(-oe*ce),T=c.create(M*ce),D=t.BASE.multiplyUnsafe(w).add(J.multiplyUnsafe(T));if(D.is0())throw new Error("invalid recovery: point at infinify");return D.assertValidity(),D}hasHighS(){return U(this.s)}toBytes(R=N.format){if(aa(R),R==="der")return ia(pt.hexFromSig(this));const{r:O,s:M}=this,C=c.toBytes(O),H=c.toBytes(M);return R==="recovered"?(X(),ts(Uint8Array.of(this.assertRecovery()),C,H)):ts(C,H)}toHex(R){return $u(this.toBytes(R))}}Object.freeze(te.prototype),Object.freeze(te);const ee=s.bits2int===void 0?function(R){if(R.length>8192)throw new Error("input is too large");const O=kr(R),M=R.length*8-h;return M>0?O>>BigInt(M):O}:s.bits2int,Q=s.bits2int_modN===void 0?function(R){return c.create(ee(R))}:s.bits2int_modN,z=Oa(h);function ne(B){return Xu("num < 2^"+h,B,At,z),c.toBytes(B)}function v(B,R){return qe(B,void 0,"message"),R?qe(i(B),void 0,"prehashed message"):B}function y(B,R,O){const{lowS:M,prehash:C,extraEntropy:H}=Bn(O,N);B=v(B,C);const W=Q(B),J=c.fromBytes(R);if(!c.isValidNot0(J))throw new Error("invalid private key");const ce=[ne(J),ne(W)];if(H!=null&&H!==false){const D=H===true?r(E.secretKey):H;ce.push(qe(D,void 0,"extraEntropy"))}const oe=ts(...ce),w=W;function T(D){const L=ee(D);if(!c.isValidNot0(L))return;const j=c.inv(L),se=t.BASE.multiply(L).toAffine(),re=c.create(se.x);if(re===At)return;const pe=c.create(j*c.create(w+re*J));if(pe===At)return;let Se=(se.x===re?0:2)|Number(se.y&ss),ke=pe;return M&&U(pe)&&(ke=c.neg(pe),Se^=1),new te(re,ke,F?void 0:Se)}return{seed:oe,k2sig:T}}function k(B,R,O={}){const{seed:M,k2sig:C}=y(B,R,O);return Of(i.outputLen,c.BYTES,a)(M,C).toBytes(O.format)}function V(B,R,O,M={}){const{lowS:C,prehash:H,format:W}=Bn(M,N);if(O=qe(O,void 0,"publicKey"),R=v(R,H),!ju(B)){const J=B instanceof te?", use sig.toBytes()":"";throw new Error("verify expects Uint8Array signature"+J)}$(B,W);try{const J=te.fromBytes(B,W),ce=t.fromBytes(O);if(C&&J.hasHighS())return false;const{r:oe,s:w}=J,T=Q(R),D=c.inv(w),L=c.create(T*D),j=c.create(oe*D),se=t.BASE.multiplyUnsafe(L).add(ce.multiplyUnsafe(j));return se.is0()?false:c.create(se.x)===oe}catch{return false}}function G(B,R,O={}){const{prehash:M}=Bn(O,N);return R=v(R,M),te.fromBytes(B,"recovered").recoverPublicKey(R).toBytes()}return Object.freeze({keygen:d,getPublicKey:m,getSharedSecret:_,utils:x,lengths:E,Point:t,sign:k,verify:V,recoverPublicKey:G,Signature:te,hash:i})}const ad={p:BigInt("0xffffffff00000001000000000000000000000000ffffffffffffffffffffffff"),n:BigInt("0xffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551"),h:BigInt(1),a:BigInt("0xffffffff00000001000000000000000000000000fffffffffffffffffffffffc"),b:BigInt("0x5ac635d8aa3a93e7b3ebbd55769886bc651d06b0cc53b0f63bce3c3e27d2604b"),Gx:BigInt("0x6b17d1f2e12c4247f8bce6e563a440f277037d812deb33a0f4a13945d898c296"),Gy:BigInt("0x4fe342e2fe1a7f9b8ee7eb4a7c0f9e162bce33576b315ececbb6406837bf51f5")},od=id(ad),cd=nd(od,Fa),rc={x:"6bkPbVZXx-c08blVs6qIwm0gfSRLS2nnf2Tsz19ggtM",y:"lhi486ASKQkS8TGbVee-FpdAu7qKaO3gad_4ScX8qJI"},ud=60;let Ki=null,qa=false,Zs=null,oa=0;function Zi(t){const e=t.replace(/-/g,"+").replace(/_/g,"/"),s=atob(e),i=new Uint8Array(s.length);for(let r=0;r<s.length;r++)i[r]=s.charCodeAt(r);return i}function ld(t,e){try{const s=Zi(t),i=Zi(e);if(s.length!==32||i.length!==32)return null;const r=new Uint8Array(65);return r[0]=4,r.set(s,1),r.set(i,33),r}catch{return null}}function hd(t,e){try{const s=t.split(".");if(s.length!==3)return null;const i=new TextEncoder().encode(s[0]+"."+s[1]),r=Zi(s[2]);if(r.length!==64||!cd.verify(r,i,e,{lowS:false}))return null;const a=JSON.parse(new TextDecoder().decode(Zi(s[1])));return{c:a.c??{},e:a.e??0}}catch{return null}}function fd(t,e){return!(t>0&&t+ud<e)}async function dd(){Ki=ld(rc.x,rc.y),Ki||(qa=true,console.warn("[Viji] _SC: key import failed — restricted mode active"))}async function nc(t){const e=qa||!Ki?null:hd(t,Ki);Zs=e?.c??null,oa=e?.e??0}function ac(t,e){return qa||!Zs?e:fd(oa,Math.floor(Date.now()/1e3))?typeof Zs[t]=="number"?Zs[t]:e:(Zs=null,oa=0,e)}const pd="#F1F1F1",Ls=28,On=40,oc=24,md={paths:["M37.5801 32.0859L32.248 40.084C31.9699 40.5012 31.5015 40.7519 31 40.752C30.4985 40.7519 30.0302 40.5012 29.752 40.084L24.4199 32.0859L26.916 30.4219L31 36.5479L35.084 30.4219L37.5801 32.0859Z","M43.0059 39.25C43.0059 40.0784 43.6774 40.75 44.5059 40.75C45.3343 40.75 46.0059 40.0784 46.0059 39.25V31H43.0059V39.25Z","M61.0059 39.25C61.0059 40.0784 61.6774 40.75 62.5059 40.75C63.3343 40.75 64.0059 40.0784 64.0059 39.25V31H61.0059V39.25Z","M55.001 39.5C55.001 42.1883 53.9879 44.6433 52.3262 46.5C52.0009 46.8635 51.6509 47.2044 51.2783 47.5195L49.3408 45.2295C49.6074 45.004 49.858 44.7601 50.0908 44.5C51.2793 43.1721 52.001 41.4218 52.001 39.5H52.0059V31H55.0059V39.5H55.001Z"],dots:[[44.5,26.5],[53.5,26.5],[62.5,26.5]],minX:24.4199,minY:24.625,maxX:64.375,maxY:47.5195,shadowStd:11},gd={paths:["M77.6895 41.1893C78.2752 40.6036 79.2248 40.6036 79.8106 41.1893C80.3963 41.7751 80.3963 42.7246 79.8106 43.3104L43.8106 79.3104C43.2248 79.8962 42.2752 79.8962 41.6895 79.3104C41.1037 78.7246 41.1037 77.7751 41.6895 77.1893L77.6895 41.1893Z","M76.875 78.25C76.875 77.2145 77.7145 76.375 78.75 76.375C79.7855 76.375 80.625 77.2145 80.625 78.25C80.625 79.2855 79.7855 80.125 78.75 80.125C77.7145 80.125 76.875 79.2855 76.875 78.25Z","M77.6895 59.1893C78.2752 58.6036 79.2248 58.6036 79.8106 59.1893C80.3963 59.7751 80.3963 60.7246 79.8106 61.3104L61.8106 79.3104C61.2248 79.8962 60.2752 79.8962 59.6895 79.3104C59.1037 78.7246 59.1037 77.7751 59.6895 77.1893L77.6895 59.1893Z","M44.625 42.25C44.625 43.2855 43.7855 44.125 42.75 44.125C41.7145 44.125 40.875 43.2855 40.875 42.25C40.875 41.2145 41.7145 40.375 42.75 40.375C43.7855 40.375 44.625 41.2145 44.625 42.25Z","M43.8105 61.3107C43.2248 61.8964 42.2752 61.8964 41.6894 61.3107C41.1037 60.7249 41.1037 59.7754 41.6894 59.1896L59.6894 41.1896C60.2752 40.6038 61.2248 40.6038 61.8105 41.1896C62.3963 41.7754 62.3963 42.7249 61.8105 43.3107L43.8105 61.3107Z","M70.9911 99.5C70.9911 102.188 69.978 104.643 68.3163 106.5C67.991 106.863 67.6409 107.204 67.2684 107.52L65.3309 105.229C65.5974 105.004 65.8482 104.76 66.0809 104.5C67.2694 103.172 67.9911 101.422 67.9911 99.5H67.9969V91H70.9969V99.5H70.9911Z","M53.5702 92.2109L48.2382 100.209C47.96 100.626 47.4916 100.877 46.9901 100.877C46.4886 100.877 46.0203 100.626 45.7421 100.209L40.41 92.2109L42.9061 90.5469L46.9901 96.6729L51.0741 90.5469L53.5702 92.2109Z","M76.996 99.375C76.996 100.203 77.6675 100.875 78.496 100.875C79.3244 100.875 79.996 100.203 79.996 99.375V91.125H76.996V99.375Z","M58.9969 99.375C58.9969 100.203 59.6685 100.875 60.4969 100.875C61.3254 100.875 61.9969 100.203 61.9969 99.375V91.125H58.9969V99.375Z"],dots:[],minX:40.41,minY:40.375,maxX:80.625,maxY:107.52,shadowStd:12};let ci=null,ui=null,ll=null,hl=null,We=null,Ds=null,Qi=null,Jt=null,jt=-1,qt=-1,ca=null,Ze=null,Ns=null,Fs=null,fl=0,dl=0,Sr=0,Ha=-1,ua=null,Ji="srgb",bt=null,Vt=null,Tt=null,Ii=null;const bd=["clearRect","fillRect","strokeRect","fillText","strokeText","drawImage","putImageData","fill","stroke","reset"];let yt=null;function yd(t){if(yt!==t){yt=t,ua=null,Sr=0,Ha=-1,bt={save:t.save,restore:t.restore,setTransform:t.setTransform,clearRect:t.clearRect,drawImage:t.drawImage,getImageData:t.getImageData,putImageData:t.putImageData};try{Ji=t.getContextAttributes?.()?.colorSpace??"srgb"}catch{Ji="srgb"}}}function _d(t){if(!(ua===t||yt!==t)){ua=t;for(const e of bd){const s=t[e];if(typeof s!="function")continue;const i=s;t[e]=function(){return Sr++,i.apply(this,arguments)}}}}let $t=null,Ui=0,Mi=0,rs=null,cc=null,Vn=false;function pl(t,e,s,i,r,a){const o=Math.max(0,Math.floor(t)),c=Math.max(0,Math.floor(e)),l=Math.min(r,Math.ceil(t+s)),h=Math.min(a,Math.ceil(e+i));return l<=o||h<=c?null:{x:o,y:c,w:l-o,h:h-c}}function ml(t){const e=bt;e&&t===yt?e.setTransform.call(t,1,0,0,1,0,0):t.setTransform(1,0,0,1,0,0),t.globalAlpha=1,t.globalCompositeOperation="source-over",t.filter="none",t.shadowColor="transparent",t.shadowBlur=0,t.shadowOffsetX=0,t.shadowOffsetY=0,t.imageSmoothingEnabled=true,t.imageSmoothingQuality="low"}function gl(t){(bt&&t===yt?bt.save:t.save).call(t)}function bl(t){(bt&&t===yt?bt.restore:t.restore).call(t)}function vd(t,e,s,i,r){(bt&&t===yt?bt.clearRect:t.clearRect).call(t,e,s,i,r)}function yl(t,...e){(bt&&t===yt?bt.drawImage:t.drawImage).call(t,...e)}function xd(t){if(cc!==t){cc=t;try{Vn=!!t.getContextAttributes()?.preserveDrawingBuffer}catch{Vn=false}}return Vn}function kd(t,e,s){if(t){if(e&&Fs&&Ze){const i=Fs;Fs=null;try{t.width!==fl||t.height!==dl||(Sr===Ha?(gl(e),ml(e),vd(e,i.x,i.y,i.w,i.h),yl(e,Ze,0,0,i.w,i.h,i.x,i.y,i.w,i.h),bl(e)):wd(e,i))}catch(r){la(),console.warn("[Viji] overlay: restore failed",r)}}if(s&&rs&&$t&&s===ca){const i=rs;rs=null;try{kl(s,t,$t,i,false)}catch(r){la(),console.warn("[Viji] overlay: GL restore failed",r)}}}}function la(){Fs=null,Vt=null,rs=null}function wd(t,e){if(!Ze||!Vt)return;if(Tt)(Tt.width<e.w||Tt.height<e.h)&&(Tt.width=Math.max(e.w,Tt.width),Tt.height=Math.max(e.h,Tt.height));else try{Tt=new OffscreenCanvas(e.w,e.h),Ii=Tt.getContext("2d",{colorSpace:Ji})}catch{Tt=null,Ii=null}if(!Ii)return;const s=Ii;s.imageSmoothingEnabled=true,s.imageSmoothingQuality="low",s.clearRect(0,0,e.w,e.h),s.drawImage(Ze,0,0,e.w,e.h,0,0,e.w,e.h),s.drawImage(Vt.buffer,Vt.dx,Vt.dy,Vt.dw,Vt.dh);const i=bt,r=(i&&t===yt?i.getImageData:t.getImageData).call(t,e.x,e.y,e.w,e.h),a=s.getImageData(0,0,e.w,e.h),o=Ns.getImageData(0,0,e.w,e.h),c=r.data,l=a.data,h=o.data;for(let m=0;m<c.length;m+=4)c[m]===l[m]&&c[m+1]===l[m+1]&&c[m+2]===l[m+2]&&c[m+3]===l[m+3]&&(c[m]=h[m],c[m+1]=h[m+1],c[m+2]=h[m+2],c[m+3]=h[m+3]);(i&&t===yt?i.putImageData:t.putImageData).call(t,r,e.x,e.y)}function Sd(t,e){if(Ze)(Ze.width<t||Ze.height<e)&&(Ze.width=Math.max(t,Ze.width),Ze.height=Math.max(e,Ze.height));else try{Ze=new OffscreenCanvas(t,e),Ns=Ze.getContext("2d",{colorSpace:Ji})}catch{Ze=null,Ns=null}return!!Ns}function Ed(t,e,s){const i=t,r=typeof i.createVertexArray=="function",a=t.getParameter(t.ACTIVE_TEXTURE);t.activeTexture(t.TEXTURE0);const o=t.getParameter(t.TEXTURE_BINDING_2D),c=t.getParameter(t.FRAMEBUFFER_BINDING),l=r?t.getParameter(i.READ_FRAMEBUFFER_BINDING):null,h=r?t.getParameter(i.PIXEL_UNPACK_BUFFER_BINDING):null;h&&i.bindBuffer(i.PIXEL_UNPACK_BUFFER,null),t.bindFramebuffer(t.FRAMEBUFFER,null),$t?t.bindTexture(t.TEXTURE_2D,$t):($t=t.createTexture(),$t&&(t.bindTexture(t.TEXTURE_2D,$t),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),Ui=0,Mi=0)),$t?((Ui!==s.w||Mi!==s.h)&&(t.texImage2D(t.TEXTURE_2D,0,t.RGBA,s.w,s.h,0,t.RGBA,t.UNSIGNED_BYTE,null),Ui=s.w,Mi=s.h),t.copyTexSubImage2D(t.TEXTURE_2D,0,0,0,s.x,e.height-(s.y+s.h),s.w,s.h),rs=s):rs=null,t.bindTexture(t.TEXTURE_2D,o),t.bindFramebuffer(t.FRAMEBUFFER,c),r&&(i.bindFramebuffer(i.READ_FRAMEBUFFER,l),h&&i.bindBuffer(i.PIXEL_UNPACK_BUFFER,h)),t.activeTexture(a)}let Ga=0;const Td=`
439
+ }`,o=this.compileShader(i.VERTEX_SHADER,r,0),a=this.compileShader(i.FRAGMENT_SHADER,e,s),c=i.createProgram();if(!c)throw new Error("Failed to create WebGL program");if(i.attachShader(c,o),i.attachShader(c,a),i.linkProgram(c),!i.getProgramParameter(c,i.LINK_STATUS)){const l=i.getParameter(i.MAX_TEXTURE_IMAGE_UNITS),h=je.countReferencedSamplers(e);if(h>l)throw je.tagCompileError(new Error(`Shader uses ${h} textures but this GPU supports ${l} in a fragment shader; read fewer texture uniforms`));const d=this.redactDriverInfoLogs?"(diagnostics unavailable)":i.getProgramInfoLog(c);throw je.tagCompileError(new Error(`Shader program link failed: ${d}`))}this.program=c,i.useProgram(c),i.deleteShader(o),i.deleteShader(a)}compileShader(e,s,i=0){const r=this.gl,o=r.createShader(e);if(!o)throw new Error("Failed to create shader");if(r.shaderSource(o,s),r.compileShader(o),!r.getShaderParameter(o,r.COMPILE_STATUS)){const a=r.getShaderInfoLog(o),c=e===r.VERTEX_SHADER?"vertex":"fragment",l=this.redactDriverInfoLogs?"(diagnostics unavailable)":a,h=new Error(`${c} shader compilation failed:
440
+ ${l}`);if(e===r.FRAGMENT_SHADER){h.__isShaderCompileError=true;const d=Uf(a||"");if(d!==null){const m=d-i;m>=1&&(h.__sourceLocation={line:m})}}throw h}return o}cacheUniformLocations(){if(!this.program)return;const e=this.gl,s=e.getProgramParameter(this.program,e.ACTIVE_UNIFORMS),i=[];for(let r=0;r<s;r++){const o=e.getActiveUniform(this.program,r);if(o){const a=e.getUniformLocation(this.program,o.name);if(this.uniformLocations.set(o.name,a),o.name.endsWith("[0]")){const c=o.name.slice(0,-3);this.uniformLocations.set(c,e.getUniformLocation(this.program,c))}(o.name.includes("Stream")||o.name.includes("stream"))&&i.push(o.name)}}i.length>0?console.log("[ShaderAdapter] Stream-related uniforms found:",i):console.log("[ShaderAdapter] NO stream-related uniforms found in shader!")}allocateTextureUnits(){if(!this.program)return;const e=this.gl;this.textureUnits.clear(),this.nextTextureUnit=0;const s=e.getProgramParameter(this.program,e.ACTIVE_UNIFORMS);for(let i=0;i<s;i++){const r=e.getActiveUniform(this.program,i);r&&r.type===e.SAMPLER_2D&&this.textureUnits.set(r.name,this.nextTextureUnit++)}}static tagCompileError(e){return e.__isShaderCompileError=true,e}static countReferencedSamplers(e){const s="// ===== ARTIST CODE =====",i=e.indexOf(s),r=i===-1?e:e.slice(0,i),o=i===-1?e:e.slice(i+s.length),a=new Set;for(const l of r.matchAll(/uniform\s+sampler2D\s+(\w+)\s*;/g))a.add(l[1]);let c=0;for(const l of a)new RegExp(`\\b${l}\\b`).test(o)&&c++;return c}createBackbufferFramebuffers(){const e=this.gl,s=e.canvas.width,i=e.canvas.height,r=()=>{const c=e.createTexture();e.bindTexture(e.TEXTURE_2D,c),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,s,i,0,e.RGBA,e.UNSIGNED_BYTE,null),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE);const l=e.createFramebuffer();return e.bindFramebuffer(e.FRAMEBUFFER,l),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,c,0),{framebuffer:l,texture:c}},o=r(),a=r();this.backbufferFramebuffer=o.framebuffer,this.backbufferTexture=o.texture,this.currentFramebuffer=a.framebuffer,this.currentTexture=a.texture,e.bindFramebuffer(e.FRAMEBUFFER,null),e.bindTexture(e.TEXTURE_2D,null)}render(e,s){const i=this.gl;if(!this.program||!this.quadBuffer)return console.warn("Shader not initialized"),false;if(i.useProgram(this.program),this.syncCvVisibility(e,s),this.updateBuiltInUniforms(e),this.updateAccumulators(e,s),this.updateParameterUniforms(s),this.backbufferEnabled&&this.backbufferTexture){const o=this.textureUnits.get("backbuffer");o!==void 0&&(i.activeTexture(i.TEXTURE0+o),i.bindTexture(i.TEXTURE_2D,this.backbufferTexture),this.setUniform("backbuffer","sampler2D",o)),i.bindFramebuffer(i.FRAMEBUFFER,this.currentFramebuffer)}const r=i.getAttribLocation(this.program,"a_position");if(i.bindBuffer(i.ARRAY_BUFFER,this.quadBuffer),i.enableVertexAttribArray(r),i.vertexAttribPointer(r,2,i.FLOAT,false,0,0),i.drawArrays(i.TRIANGLE_STRIP,0,4),this.backbufferEnabled){i.bindFramebuffer(i.FRAMEBUFFER,null),i.activeTexture(i.TEXTURE0),i.bindTexture(i.TEXTURE_2D,this.currentTexture),i.drawArrays(i.TRIANGLE_STRIP,0,4);const o=this.backbufferFramebuffer,a=this.backbufferTexture;this.backbufferFramebuffer=this.currentFramebuffer,this.backbufferTexture=this.currentTexture,this.currentFramebuffer=o,this.currentTexture=a}return true}syncCvVisibility(e,s){if(!e.video?.isConnected)return;const i=e.video.cv,r=typeof i.getActiveFeatures=="function"?i.getActiveFeatures():[];for(const[o,a]of this.cvDirectives){let c;if(a.toggleable&&a.paramName){const h=s.get(a.paramName);if(!h)continue;c=h.value===true}else c=true;c?this.visibleFeatures.add(o):this.visibleFeatures.delete(o);const l=r.includes(o);if(c===l){a.lastValue=c;continue}if(a.inFlight){a.pendingValue=c;continue}this.dispatchCvEnable(i,o,c,a)}for(const o of so)this.cvDirectives.has(o)||(r.includes(o)?this.visibleFeatures.add(o):this.visibleFeatures.delete(o))}dispatchCvEnable(e,s,i,r){const o=`enable${s.charAt(0).toUpperCase()}${s.slice(1)}`,a=e[o];typeof a=="function"&&(r.inFlight=true,r.lastValue=i,Promise.resolve(a.call(e,i)).catch(c=>{console.warn(`[ShaderAdapter] ${o}(${i}) failed:`,c)}).finally(()=>{this.destroyed||(r.inFlight=false,delete r.pendingValue)}))}updateBuiltInUniforms(e){this.setUniform("u_resolution","vec2",[e.width,e.height]),this.setUniform("u_time","float",e.time),this.setUniform("u_deltaTime","float",e.deltaTime),this.setUniform("u_frame","int",e.frameCount),this.setUniform("u_fps","float",e.fps),this.setUniform("u_mouse","vec2",[e.mouse.x,e.height-e.mouse.y]),this.setUniform("u_mouseInCanvas","bool",e.mouse.isInCanvas),this.setUniform("u_mousePressed","bool",e.mouse.isPressed),this.setUniform("u_mouseLeft","bool",e.mouse.leftButton),this.setUniform("u_mouseRight","bool",e.mouse.rightButton),this.setUniform("u_mouseMiddle","bool",e.mouse.middleButton),this.setUniform("u_mouseDelta","vec2",[e.mouse.deltaX,-e.mouse.deltaY]),this.setUniform("u_mouseWheel","float",e.mouse.wheelDelta),this.setUniform("u_mouseWasPressed","bool",e.mouse.wasPressed),this.setUniform("u_mouseWasReleased","bool",e.mouse.wasReleased),this.setUniform("u_keySpace","bool",e.keyboard.isPressed(" ")||e.keyboard.isPressed("space")),this.setUniform("u_keyShift","bool",e.keyboard.shift),this.setUniform("u_keyCtrl","bool",e.keyboard.ctrl),this.setUniform("u_keyAlt","bool",e.keyboard.alt),this.setUniform("u_keyW","bool",e.keyboard.isPressed("w")||e.keyboard.isPressed("W")),this.setUniform("u_keyA","bool",e.keyboard.isPressed("a")||e.keyboard.isPressed("A")),this.setUniform("u_keyS","bool",e.keyboard.isPressed("s")||e.keyboard.isPressed("S")),this.setUniform("u_keyD","bool",e.keyboard.isPressed("d")||e.keyboard.isPressed("D")),this.setUniform("u_keyUp","bool",e.keyboard.isPressed("ArrowUp")),this.setUniform("u_keyDown","bool",e.keyboard.isPressed("ArrowDown")),this.setUniform("u_keyLeft","bool",e.keyboard.isPressed("ArrowLeft")),this.setUniform("u_keyRight","bool",e.keyboard.isPressed("ArrowRight")),e.keyboard.textureData&&this.updateKeyboardTexture(e.keyboard.textureData),this.setUniform("u_touchCount","int",e.touches.count);for(let v=0;v<5;v++){const y=e.touches.points[v];y?this.setUniform(`u_touch${v}`,"vec2",[y.x,e.height-y.y]):this.setUniform(`u_touch${v}`,"vec2",[0,0])}this.setUniform("u_pointer","vec2",[e.pointer.x,e.height-e.pointer.y]),this.setUniform("u_pointerDelta","vec2",[e.pointer.deltaX,-e.pointer.deltaY]),this.setUniform("u_pointerDown","bool",e.pointer.isDown),this.setUniform("u_pointerWasPressed","bool",e.pointer.wasPressed),this.setUniform("u_pointerWasReleased","bool",e.pointer.wasReleased),this.setUniform("u_pointerInCanvas","bool",e.pointer.isInCanvas);const s=e.audio;if(this.setUniform("u_audioVolume","float",s.volume?.current||0),this.setUniform("u_audioPeak","float",s.volume?.peak||0),this.setUniform("u_audioVolumeSmoothed","float",s.volume?.smoothed||0),this.setUniform("u_audioLow","float",s.bands?.low||0),this.setUniform("u_audioLowMid","float",s.bands?.lowMid||0),this.setUniform("u_audioMid","float",s.bands?.mid||0),this.setUniform("u_audioHighMid","float",s.bands?.highMid||0),this.setUniform("u_audioHigh","float",s.bands?.high||0),this.setUniform("u_audioLowSmoothed","float",s.bands?.lowSmoothed||0),this.setUniform("u_audioLowMidSmoothed","float",s.bands?.lowMidSmoothed||0),this.setUniform("u_audioMidSmoothed","float",s.bands?.midSmoothed||0),this.setUniform("u_audioHighMidSmoothed","float",s.bands?.highMidSmoothed||0),this.setUniform("u_audioHighSmoothed","float",s.bands?.highSmoothed||0),this.setUniform("u_audioKick","float",s.beat?.kick||0),this.setUniform("u_audioSnare","float",s.beat?.snare||0),this.setUniform("u_audioHat","float",s.beat?.hat||0),this.setUniform("u_audioAny","float",s.beat?.any||0),this.setUniform("u_audioKickSmoothed","float",s.beat?.kickSmoothed||0),this.setUniform("u_audioSnareSmoothed","float",s.beat?.snareSmoothed||0),this.setUniform("u_audioHatSmoothed","float",s.beat?.hatSmoothed||0),this.setUniform("u_audioAnySmoothed","float",s.beat?.anySmoothed||0),this.setUniform("u_audioKickTrigger","bool",s.beat?.triggers?.kick||false),this.setUniform("u_audioSnareTrigger","bool",s.beat?.triggers?.snare||false),this.setUniform("u_audioHatTrigger","bool",s.beat?.triggers?.hat||false),this.setUniform("u_audioAnyTrigger","bool",s.beat?.triggers?.any||false),this.setUniform("u_audioBPM","float",s.beat?.bpm||120),this.setUniform("u_audioConfidence","float",s.beat?.confidence||0),this.setUniform("u_audioIsLocked","bool",s.beat?.isLocked||false),this.setUniform("u_audioBrightness","float",s.spectral?.brightness||0),this.setUniform("u_audioFlatness","float",s.spectral?.flatness||0),s.isConnected){this.updateAudioFFTTexture(s.getFrequencyData());const v=s.getWaveform();v.length>0&&this.updateAudioWaveformTexture(v)}const i=e.video;i.isConnected&&i.currentFrame?(this.updateVideoTexture(i.currentFrame),this.setUniform("u_videoResolution","vec2",[i.frameWidth,i.frameHeight]),this.setUniform("u_videoFrameRate","float",i.frameRate)):(this.setUniform("u_videoResolution","vec2",[0,0]),this.setUniform("u_videoFrameRate","float",0)),i.cv?.analysedFrame instanceof OffscreenCanvas?(this.updateAnalysedFrameTexture(i.cv.analysedFrame),this.setUniform("u_videoAnalysedAvailable","bool",true)):(this.bindAnalysedFrameFallback(),this.setUniform("u_videoAnalysedAvailable","bool",false));const r=e.videoStreams||[],o=Math.min(r.length,je.MAX_VIDEO_STREAMS);this.setUniform("u_videoStreamCount","int",o);for(let v=0;v<je.MAX_VIDEO_STREAMS;v++){const y=`u_videoStream${v}Connected`,k=`u_videoStream${v}Resolution`;v<o&&r[v]?.isConnected&&r[v]?.currentFrame?(this.updateVideoStreamTexture(v,r[v].currentFrame),this.setUniform(k,"vec2",[r[v].frameWidth,r[v].frameHeight]),this.setUniform(y,"bool",true)):(this.setUniform(k,"vec2",[0,0]),this.setUniform(y,"bool",false))}const a=e.devices||[],c=Math.min(a.length,je.MAX_DEVICE_VIDEOS);this.setUniform("u_deviceCount","int",c);for(let v=0;v<je.MAX_DEVICE_VIDEOS;v++){const y=`u_device${v}Connected`,k=`u_device${v}Resolution`;v<c&&a[v]?.video?.isConnected&&a[v].video.currentFrame?(this.updateDeviceTexture(v,a[v].video.currentFrame),this.setUniform(k,"vec2",[a[v].video.frameWidth,a[v].video.frameHeight]),this.setUniform(y,"bool",true)):(this.setUniform(k,"vec2",[0,0]),this.setUniform(y,"bool",false))}const l=e.audioStreams||[],h=Math.min(l.length,je.MAX_AUDIO_STREAMS);this.setUniform("u_audioStreamCount","int",h);for(let v=0;v<je.MAX_AUDIO_STREAMS;v++){const y=`u_audioStream${v}`;if(v<h&&l[v]?.isConnected){const k=l[v];this.setUniform(`${y}Connected`,"bool",true),this.setUniform(`${y}Volume`,"float",k.volume?.current||0),this.setUniform(`${y}Low`,"float",k.bands?.low||0),this.setUniform(`${y}LowMid`,"float",k.bands?.lowMid||0),this.setUniform(`${y}Mid`,"float",k.bands?.mid||0),this.setUniform(`${y}HighMid`,"float",k.bands?.highMid||0),this.setUniform(`${y}High`,"float",k.bands?.high||0),this.setUniform(`${y}Brightness`,"float",k.spectral?.brightness||0),this.setUniform(`${y}Flatness`,"float",k.spectral?.flatness||0)}else this.setUniform(`${y}Connected`,"bool",false),this.setUniform(`${y}Volume`,"float",0),this.setUniform(`${y}Low`,"float",0),this.setUniform(`${y}LowMid`,"float",0),this.setUniform(`${y}Mid`,"float",0),this.setUniform(`${y}HighMid`,"float",0),this.setUniform(`${y}High`,"float",0),this.setUniform(`${y}Brightness`,"float",0),this.setUniform(`${y}Flatness`,"float",0)}const d=i.cv?.faces||[],m=d[0],_=this.visibleFeatures.has("faceDetection")&&!!m,x=this.visibleFeatures.has("faceMesh")&&!!m,E=this.visibleFeatures.has("emotionDetection")&&!!m;if(this.setUniform("u_faceCount","int",this.visibleFeatures.has("faceDetection")?d.length:0),_){const v=m.bounds,y=m.center?.x||0,k=m.center?.y||0;this.setUniform("u_face0Bounds","vec4",[v?.x||0,1-(v?.y||0)-(v?.height||0),v?.width||0,v?.height||0]),this.setUniform("u_face0Center","vec2",[y,1-k]),this.setUniform("u_face0Confidence","float",m.confidence||0)}else this.setUniform("u_face0Bounds","vec4",[0,0,0,0]),this.setUniform("u_face0Center","vec2",[0,0]),this.setUniform("u_face0Confidence","float",0);if(x){const v=m.headPose||{};this.setUniform("u_face0HeadPose","vec3",[v.pitch||0,v.yaw||0,-(v.roll||0)])}else this.setUniform("u_face0HeadPose","vec3",[0,0,0]);if(E){const v=m.expressions||{},y=m.blendshapes||{};this.setUniform("u_face0Neutral","float",v.neutral||0),this.setUniform("u_face0Happy","float",v.happy||0),this.setUniform("u_face0Sad","float",v.sad||0),this.setUniform("u_face0Angry","float",v.angry||0),this.setUniform("u_face0Surprised","float",v.surprised||0),this.setUniform("u_face0Disgusted","float",v.disgusted||0),this.setUniform("u_face0Fearful","float",v.fearful||0),this.setUniform("u_face0BrowDownLeft","float",y.browDownLeft||0),this.setUniform("u_face0BrowDownRight","float",y.browDownRight||0),this.setUniform("u_face0BrowInnerUp","float",y.browInnerUp||0),this.setUniform("u_face0BrowOuterUpLeft","float",y.browOuterUpLeft||0),this.setUniform("u_face0BrowOuterUpRight","float",y.browOuterUpRight||0),this.setUniform("u_face0CheekPuff","float",y.cheekPuff||0),this.setUniform("u_face0CheekSquintLeft","float",y.cheekSquintLeft||0),this.setUniform("u_face0CheekSquintRight","float",y.cheekSquintRight||0),this.setUniform("u_face0EyeBlinkLeft","float",y.eyeBlinkLeft||0),this.setUniform("u_face0EyeBlinkRight","float",y.eyeBlinkRight||0),this.setUniform("u_face0EyeLookDownLeft","float",y.eyeLookDownLeft||0),this.setUniform("u_face0EyeLookDownRight","float",y.eyeLookDownRight||0),this.setUniform("u_face0EyeLookInLeft","float",y.eyeLookInLeft||0),this.setUniform("u_face0EyeLookInRight","float",y.eyeLookInRight||0),this.setUniform("u_face0EyeLookOutLeft","float",y.eyeLookOutLeft||0),this.setUniform("u_face0EyeLookOutRight","float",y.eyeLookOutRight||0),this.setUniform("u_face0EyeLookUpLeft","float",y.eyeLookUpLeft||0),this.setUniform("u_face0EyeLookUpRight","float",y.eyeLookUpRight||0),this.setUniform("u_face0EyeSquintLeft","float",y.eyeSquintLeft||0),this.setUniform("u_face0EyeSquintRight","float",y.eyeSquintRight||0),this.setUniform("u_face0EyeWideLeft","float",y.eyeWideLeft||0),this.setUniform("u_face0EyeWideRight","float",y.eyeWideRight||0),this.setUniform("u_face0JawForward","float",y.jawForward||0),this.setUniform("u_face0JawLeft","float",y.jawLeft||0),this.setUniform("u_face0JawOpen","float",y.jawOpen||0),this.setUniform("u_face0JawRight","float",y.jawRight||0),this.setUniform("u_face0MouthClose","float",y.mouthClose||0),this.setUniform("u_face0MouthDimpleLeft","float",y.mouthDimpleLeft||0),this.setUniform("u_face0MouthDimpleRight","float",y.mouthDimpleRight||0),this.setUniform("u_face0MouthFrownLeft","float",y.mouthFrownLeft||0),this.setUniform("u_face0MouthFrownRight","float",y.mouthFrownRight||0),this.setUniform("u_face0MouthFunnel","float",y.mouthFunnel||0),this.setUniform("u_face0MouthLeft","float",y.mouthLeft||0),this.setUniform("u_face0MouthLowerDownLeft","float",y.mouthLowerDownLeft||0),this.setUniform("u_face0MouthLowerDownRight","float",y.mouthLowerDownRight||0),this.setUniform("u_face0MouthPressLeft","float",y.mouthPressLeft||0),this.setUniform("u_face0MouthPressRight","float",y.mouthPressRight||0),this.setUniform("u_face0MouthPucker","float",y.mouthPucker||0),this.setUniform("u_face0MouthRight","float",y.mouthRight||0),this.setUniform("u_face0MouthRollLower","float",y.mouthRollLower||0),this.setUniform("u_face0MouthRollUpper","float",y.mouthRollUpper||0),this.setUniform("u_face0MouthShrugLower","float",y.mouthShrugLower||0),this.setUniform("u_face0MouthShrugUpper","float",y.mouthShrugUpper||0),this.setUniform("u_face0MouthSmileLeft","float",y.mouthSmileLeft||0),this.setUniform("u_face0MouthSmileRight","float",y.mouthSmileRight||0),this.setUniform("u_face0MouthStretchLeft","float",y.mouthStretchLeft||0),this.setUniform("u_face0MouthStretchRight","float",y.mouthStretchRight||0),this.setUniform("u_face0MouthUpperUpLeft","float",y.mouthUpperUpLeft||0),this.setUniform("u_face0MouthUpperUpRight","float",y.mouthUpperUpRight||0),this.setUniform("u_face0NoseSneerLeft","float",y.noseSneerLeft||0),this.setUniform("u_face0NoseSneerRight","float",y.noseSneerRight||0),this.setUniform("u_face0TongueOut","float",y.tongueOut||0)}else this.setUniform("u_face0Neutral","float",0),this.setUniform("u_face0Happy","float",0),this.setUniform("u_face0Sad","float",0),this.setUniform("u_face0Angry","float",0),this.setUniform("u_face0Surprised","float",0),this.setUniform("u_face0Disgusted","float",0),this.setUniform("u_face0Fearful","float",0),this.setUniform("u_face0BrowDownLeft","float",0),this.setUniform("u_face0BrowDownRight","float",0),this.setUniform("u_face0BrowInnerUp","float",0),this.setUniform("u_face0BrowOuterUpLeft","float",0),this.setUniform("u_face0BrowOuterUpRight","float",0),this.setUniform("u_face0CheekPuff","float",0),this.setUniform("u_face0CheekSquintLeft","float",0),this.setUniform("u_face0CheekSquintRight","float",0),this.setUniform("u_face0EyeBlinkLeft","float",0),this.setUniform("u_face0EyeBlinkRight","float",0),this.setUniform("u_face0EyeLookDownLeft","float",0),this.setUniform("u_face0EyeLookDownRight","float",0),this.setUniform("u_face0EyeLookInLeft","float",0),this.setUniform("u_face0EyeLookInRight","float",0),this.setUniform("u_face0EyeLookOutLeft","float",0),this.setUniform("u_face0EyeLookOutRight","float",0),this.setUniform("u_face0EyeLookUpLeft","float",0),this.setUniform("u_face0EyeLookUpRight","float",0),this.setUniform("u_face0EyeSquintLeft","float",0),this.setUniform("u_face0EyeSquintRight","float",0),this.setUniform("u_face0EyeWideLeft","float",0),this.setUniform("u_face0EyeWideRight","float",0),this.setUniform("u_face0JawForward","float",0),this.setUniform("u_face0JawLeft","float",0),this.setUniform("u_face0JawOpen","float",0),this.setUniform("u_face0JawRight","float",0),this.setUniform("u_face0MouthClose","float",0),this.setUniform("u_face0MouthDimpleLeft","float",0),this.setUniform("u_face0MouthDimpleRight","float",0),this.setUniform("u_face0MouthFrownLeft","float",0),this.setUniform("u_face0MouthFrownRight","float",0),this.setUniform("u_face0MouthFunnel","float",0),this.setUniform("u_face0MouthLeft","float",0),this.setUniform("u_face0MouthLowerDownLeft","float",0),this.setUniform("u_face0MouthLowerDownRight","float",0),this.setUniform("u_face0MouthPressLeft","float",0),this.setUniform("u_face0MouthPressRight","float",0),this.setUniform("u_face0MouthPucker","float",0),this.setUniform("u_face0MouthRight","float",0),this.setUniform("u_face0MouthRollLower","float",0),this.setUniform("u_face0MouthRollUpper","float",0),this.setUniform("u_face0MouthShrugLower","float",0),this.setUniform("u_face0MouthShrugUpper","float",0),this.setUniform("u_face0MouthSmileLeft","float",0),this.setUniform("u_face0MouthSmileRight","float",0),this.setUniform("u_face0MouthStretchLeft","float",0),this.setUniform("u_face0MouthStretchRight","float",0),this.setUniform("u_face0MouthUpperUpLeft","float",0),this.setUniform("u_face0MouthUpperUpRight","float",0),this.setUniform("u_face0NoseSneerLeft","float",0),this.setUniform("u_face0NoseSneerRight","float",0),this.setUniform("u_face0TongueOut","float",0);const N=i.cv?.hands||[],F=this.visibleFeatures.has("handTracking");this.setUniform("u_handCount","int",F?N.length:0);const U=F?N.find(v=>v.handedness==="left"):void 0,P=F?N.find(v=>v.handedness==="right"):void 0;if(U){const v=U.palm||U.landmarks?.[9],y=U.gestures||{},k=U.bounds;this.setUniform("u_leftHandPalm","vec3",[v?.x||0,1-(v?.y||0),v?.z||0]),this.setUniform("u_leftHandConfidence","float",U.confidence||0),this.setUniform("u_leftHandBounds","vec4",[k?.x||0,1-(k?.y||0)-(k?.height||0),k?.width||0,k?.height||0]),this.setUniform("u_leftHandFist","float",y.fist||0),this.setUniform("u_leftHandOpen","float",y.openPalm||0),this.setUniform("u_leftHandPeace","float",y.peace||0),this.setUniform("u_leftHandThumbsUp","float",y.thumbsUp||0),this.setUniform("u_leftHandThumbsDown","float",y.thumbsDown||0),this.setUniform("u_leftHandPointing","float",y.pointing||0),this.setUniform("u_leftHandILoveYou","float",y.iLoveYou||0)}else this.setUniform("u_leftHandPalm","vec3",[0,0,0]),this.setUniform("u_leftHandConfidence","float",0),this.setUniform("u_leftHandBounds","vec4",[0,0,0,0]),this.setUniform("u_leftHandFist","float",0),this.setUniform("u_leftHandOpen","float",0),this.setUniform("u_leftHandPeace","float",0),this.setUniform("u_leftHandThumbsUp","float",0),this.setUniform("u_leftHandThumbsDown","float",0),this.setUniform("u_leftHandPointing","float",0),this.setUniform("u_leftHandILoveYou","float",0);if(P){const v=P.palm||P.landmarks?.[9],y=P.gestures||{},k=P.bounds;this.setUniform("u_rightHandPalm","vec3",[v?.x||0,1-(v?.y||0),v?.z||0]),this.setUniform("u_rightHandConfidence","float",P.confidence||0),this.setUniform("u_rightHandBounds","vec4",[k?.x||0,1-(k?.y||0)-(k?.height||0),k?.width||0,k?.height||0]),this.setUniform("u_rightHandFist","float",y.fist||0),this.setUniform("u_rightHandOpen","float",y.openPalm||0),this.setUniform("u_rightHandPeace","float",y.peace||0),this.setUniform("u_rightHandThumbsUp","float",y.thumbsUp||0),this.setUniform("u_rightHandThumbsDown","float",y.thumbsDown||0),this.setUniform("u_rightHandPointing","float",y.pointing||0),this.setUniform("u_rightHandILoveYou","float",y.iLoveYou||0)}else this.setUniform("u_rightHandPalm","vec3",[0,0,0]),this.setUniform("u_rightHandConfidence","float",0),this.setUniform("u_rightHandBounds","vec4",[0,0,0,0]),this.setUniform("u_rightHandFist","float",0),this.setUniform("u_rightHandOpen","float",0),this.setUniform("u_rightHandPeace","float",0),this.setUniform("u_rightHandThumbsUp","float",0),this.setUniform("u_rightHandThumbsDown","float",0),this.setUniform("u_rightHandPointing","float",0),this.setUniform("u_rightHandILoveYou","float",0);const $=this.visibleFeatures.has("poseDetection")?i.cv?.pose??null:null;if(this.setUniform("u_poseDetected","bool",$!==null),$&&$.landmarks){const v=$.landmarks,y=k=>1-(v[k]?.y||0);this.setUniform("u_poseConfidence","float",$.confidence||0),this.setUniform("u_nosePosition","vec2",[v[0]?.x||0,y(0)]),this.setUniform("u_leftShoulderPosition","vec2",[v[11]?.x||0,y(11)]),this.setUniform("u_rightShoulderPosition","vec2",[v[12]?.x||0,y(12)]),this.setUniform("u_leftElbowPosition","vec2",[v[13]?.x||0,y(13)]),this.setUniform("u_rightElbowPosition","vec2",[v[14]?.x||0,y(14)]),this.setUniform("u_leftWristPosition","vec2",[v[15]?.x||0,y(15)]),this.setUniform("u_rightWristPosition","vec2",[v[16]?.x||0,y(16)]),this.setUniform("u_leftHipPosition","vec2",[v[23]?.x||0,y(23)]),this.setUniform("u_rightHipPosition","vec2",[v[24]?.x||0,y(24)]),this.setUniform("u_leftKneePosition","vec2",[v[25]?.x||0,y(25)]),this.setUniform("u_rightKneePosition","vec2",[v[26]?.x||0,y(26)]),this.setUniform("u_leftAnklePosition","vec2",[v[27]?.x||0,y(27)]),this.setUniform("u_rightAnklePosition","vec2",[v[28]?.x||0,y(28)])}else this.setUniform("u_poseConfidence","float",0),this.setUniform("u_nosePosition","vec2",[0,0]),this.setUniform("u_leftShoulderPosition","vec2",[0,0]),this.setUniform("u_rightShoulderPosition","vec2",[0,0]),this.setUniform("u_leftElbowPosition","vec2",[0,0]),this.setUniform("u_rightElbowPosition","vec2",[0,0]),this.setUniform("u_leftWristPosition","vec2",[0,0]),this.setUniform("u_rightWristPosition","vec2",[0,0]),this.setUniform("u_leftHipPosition","vec2",[0,0]),this.setUniform("u_rightHipPosition","vec2",[0,0]),this.setUniform("u_leftKneePosition","vec2",[0,0]),this.setUniform("u_rightKneePosition","vec2",[0,0]),this.setUniform("u_leftAnklePosition","vec2",[0,0]),this.setUniform("u_rightAnklePosition","vec2",[0,0]);const ee=this.visibleFeatures.has("bodySegmentation")?i.cv?.segmentation??null:null;ee?(this.updateSegmentationTexture(ee.mask,ee.width,ee.height),this.setUniform("u_segmentationRes","vec2",[ee.width,ee.height])):this.setUniform("u_segmentationRes","vec2",[0,0]);const Q=e.device;if(Q){const v=Q.motion;v?.acceleration?this.setUniform("u_deviceAcceleration","vec3",[v.acceleration.x??0,v.acceleration.y??0,v.acceleration.z??0]):this.setUniform("u_deviceAcceleration","vec3",[0,0,0]),v?.accelerationIncludingGravity?this.setUniform("u_deviceAccelerationGravity","vec3",[v.accelerationIncludingGravity.x??0,v.accelerationIncludingGravity.y??0,v.accelerationIncludingGravity.z??0]):this.setUniform("u_deviceAccelerationGravity","vec3",[0,0,0]),v?.rotationRate?this.setUniform("u_deviceRotationRate","vec3",[v.rotationRate.alpha??0,v.rotationRate.beta??0,v.rotationRate.gamma??0]):this.setUniform("u_deviceRotationRate","vec3",[0,0,0]);const y=Q.orientation;y?(this.setUniform("u_deviceOrientation","vec3",[y.alpha??0,y.beta??0,y.gamma??0]),this.setUniform("u_deviceOrientationAbsolute","bool",y.absolute)):(this.setUniform("u_deviceOrientation","vec3",[0,0,0]),this.setUniform("u_deviceOrientationAbsolute","bool",false))}else this.setUniform("u_deviceAcceleration","vec3",[0,0,0]),this.setUniform("u_deviceAccelerationGravity","vec3",[0,0,0]),this.setUniform("u_deviceRotationRate","vec3",[0,0,0]),this.setUniform("u_deviceOrientation","vec3",[0,0,0]),this.setUniform("u_deviceOrientationAbsolute","bool",false);const z=e.devices||[],ne=Math.min(z.length,je.MAX_EXTERNAL_DEVICES);this.setUniform("u_externalDeviceCount","int",ne);for(let v=0;v<je.MAX_EXTERNAL_DEVICES;v++)if(v<ne){const y=z[v],k=y.motion;k?.acceleration?this.setUniform(`u_device${v}Acceleration`,"vec3",[k.acceleration.x??0,k.acceleration.y??0,k.acceleration.z??0]):this.setUniform(`u_device${v}Acceleration`,"vec3",[0,0,0]),k?.accelerationIncludingGravity?this.setUniform(`u_device${v}AccelerationGravity`,"vec3",[k.accelerationIncludingGravity.x??0,k.accelerationIncludingGravity.y??0,k.accelerationIncludingGravity.z??0]):this.setUniform(`u_device${v}AccelerationGravity`,"vec3",[0,0,0]),k?.rotationRate?this.setUniform(`u_device${v}RotationRate`,"vec3",[k.rotationRate.alpha??0,k.rotationRate.beta??0,k.rotationRate.gamma??0]):this.setUniform(`u_device${v}RotationRate`,"vec3",[0,0,0]);const V=y.orientation;V?this.setUniform(`u_device${v}Orientation`,"vec3",[V.alpha??0,V.beta??0,V.gamma??0]):this.setUniform(`u_device${v}Orientation`,"vec3",[0,0,0])}else this.setUniform(`u_device${v}Acceleration`,"vec3",[0,0,0]),this.setUniform(`u_device${v}AccelerationGravity`,"vec3",[0,0,0]),this.setUniform(`u_device${v}RotationRate`,"vec3",[0,0,0]),this.setUniform(`u_device${v}Orientation`,"vec3",[0,0,0])}updateAccumulators(e,s){const i=e.deltaTime||0;for(const r of this.parameters){if(r.type!=="accumulator")continue;const o=r.config.rate;let a;if(typeof o=="number")a=o;else{const h=s.get(o);h!==void 0?a=h.value??0:this.scalarUniformCache.has(o)?a=this.scalarUniformCache.get(o):(this.accumulatorWarned.has(r.uniformName)||(console.warn(`Accumulator '${r.uniformName}': rate source '${o}' not found, using 0`),this.accumulatorWarned.add(r.uniformName)),a=0)}const l=(this.accumulatorValues.get(r.uniformName)??0)+a*i;this.accumulatorValues.set(r.uniformName,l),this.setUniform(r.uniformName,"float",l)}}updateParameterUniforms(e){for(const s of this.parameters){if(s.type==="accumulator")continue;const i=e.get(s.uniformName);if(!i){s.type!=="cv"&&Math.random()<.01&&console.log(`[ShaderAdapter] Parameter '${s.uniformName}' not found in parameterObjects`);continue}const r=i.value;switch(s.type){case"slider":case"number":this.setUniform(s.uniformName,"float",r);break;case"color":{const o=r,a=s.config.alpha===true;this.colorUniformCacheKey.get(s.uniformName)!==o&&(this.colorUniformCache.set(s.uniformName,a?Ca(o):Aa(o)),this.colorUniformCacheKey.set(s.uniformName,o)),this.setUniform(s.uniformName,a?"vec4":"vec3",this.colorUniformCache.get(s.uniformName));break}case"toggle":case"cv":this.setUniform(s.uniformName,"bool",r);break;case"select":{const o=Math.max(0,s.config.options?.indexOf(r)??-1);this.setUniform(s.uniformName,"int",o);break}case"image":r&&this.updateImageTexture(s.uniformName,r);break;case"button":this.setUniform(s.uniformName,"bool",r);break;case"coordinate":r&&typeof r=="object"&&"x"in r&&"y"in r&&this.setUniform(s.uniformName,"vec2",[r.x,r.y]);break;case"gradient":{const o=r;if(!Array.isArray(o))break;const a=s.config.alpha===true,c=s.config.maxStops,l=a?4:3;let h=this.gradientBuffers.get(s.uniformName);if(h||(h={colors:new Float32Array(c*l),positions:new Float32Array(c),key:null},this.gradientBuffers.set(s.uniformName,h)),h.key!==o){const d=Math.min(o.length,c);for(let m=0;m<d;m++)h.colors.set(a?Ca(o[m].color):Aa(o[m].color),m*l),h.positions[m]=o[m].position;h.key=o,this.setUniform(`${s.uniformName}_colors`,a?"vec4v":"vec3v",h.colors),this.setUniform(`${s.uniformName}_positions`,"floatv",h.positions),this.setUniform(`${s.uniformName}_count`,"int",d)}break}}}}setUniform(e,s,i){switch(s){case"float":this.scalarUniformCache.set(e,i);break;case"int":this.scalarUniformCache.set(e,i);break;case"bool":this.scalarUniformCache.set(e,i?1:0);break;case"vec2":this.scalarUniformCache.set(e+".x",i[0]),this.scalarUniformCache.set(e+".y",i[1]);break;case"vec3":this.scalarUniformCache.set(e+".x",i[0]),this.scalarUniformCache.set(e+".y",i[1]),this.scalarUniformCache.set(e+".z",i[2]);break;case"vec4":this.scalarUniformCache.set(e+".x",i[0]),this.scalarUniformCache.set(e+".y",i[1]),this.scalarUniformCache.set(e+".z",i[2]),this.scalarUniformCache.set(e+".w",i[3]);break}const r=this.uniformLocations.get(e);if(r==null)return;const o=this.gl;switch(s){case"float":o.uniform1f(r,i);break;case"int":o.uniform1i(r,i);break;case"bool":o.uniform1i(r,i?1:0);break;case"vec2":o.uniform2f(r,i[0],i[1]);break;case"vec3":o.uniform3f(r,i[0],i[1],i[2]);break;case"vec4":o.uniform4f(r,i[0],i[1],i[2],i[3]);break;case"floatv":o.uniform1fv(r,i);break;case"vec3v":o.uniform3fv(r,i);break;case"vec4v":o.uniform4fv(r,i);break}}updateAudioFFTTexture(e){const s=this.gl,i=this.textureUnits.get("u_audioFFT");if(i===void 0)return;this.audioFFTTexture||(this.audioFFTTexture=s.createTexture()),s.activeTexture(s.TEXTURE0+i),s.bindTexture(s.TEXTURE_2D,this.audioFFTTexture),s.texImage2D(s.TEXTURE_2D,0,s.LUMINANCE,e.length,1,0,s.LUMINANCE,s.UNSIGNED_BYTE,e),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MIN_FILTER,s.NEAREST),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MAG_FILTER,s.NEAREST),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_S,s.CLAMP_TO_EDGE),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_T,s.CLAMP_TO_EDGE);const r=this.uniformLocations.get("u_audioFFT");r&&s.uniform1i(r,i)}updateAudioWaveformTexture(e){const s=this.gl,i=this.textureUnits.get("u_audioWaveform");if(i===void 0)return;this.audioWaveformTexture||(this.audioWaveformTexture=s.createTexture());const r=new Uint8Array(e.length);for(let a=0;a<e.length;a++)r[a]=Math.round((e[a]*.5+.5)*255);s.activeTexture(s.TEXTURE0+i),s.bindTexture(s.TEXTURE_2D,this.audioWaveformTexture),s.texImage2D(s.TEXTURE_2D,0,s.LUMINANCE,r.length,1,0,s.LUMINANCE,s.UNSIGNED_BYTE,r),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MIN_FILTER,s.NEAREST),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MAG_FILTER,s.NEAREST),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_S,s.CLAMP_TO_EDGE),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_T,s.CLAMP_TO_EDGE);const o=this.uniformLocations.get("u_audioWaveform");o&&s.uniform1i(o,i)}updateVideoTexture(e){const s=this.gl,i=this.textureUnits.get("u_video");if(i===void 0){e instanceof ImageBitmap&&e.close();return}this.videoTexture||(this.videoTexture=s.createTexture()),s.activeTexture(s.TEXTURE0+i),s.bindTexture(s.TEXTURE_2D,this.videoTexture);const r=e instanceof OffscreenCanvas;r&&s.pixelStorei(s.UNPACK_FLIP_Y_WEBGL,true),s.texImage2D(s.TEXTURE_2D,0,s.RGBA,s.RGBA,s.UNSIGNED_BYTE,e),r&&s.pixelStorei(s.UNPACK_FLIP_Y_WEBGL,false),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MIN_FILTER,s.LINEAR),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MAG_FILTER,s.LINEAR),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_S,s.CLAMP_TO_EDGE),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_T,s.CLAMP_TO_EDGE);const o=this.uniformLocations.get("u_video");o&&s.uniform1i(o,i),e instanceof ImageBitmap&&e.close()}updateAnalysedFrameTexture(e){const s=this.gl,i=this.textureUnits.get("u_videoAnalysed");if(i===void 0)return;this.analysedFrameTexture||(this.analysedFrameTexture=s.createTexture()),s.activeTexture(s.TEXTURE0+i),s.bindTexture(s.TEXTURE_2D,this.analysedFrameTexture),s.pixelStorei(s.UNPACK_FLIP_Y_WEBGL,true),s.texImage2D(s.TEXTURE_2D,0,s.RGBA,s.RGBA,s.UNSIGNED_BYTE,e),s.pixelStorei(s.UNPACK_FLIP_Y_WEBGL,false),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MIN_FILTER,s.LINEAR),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MAG_FILTER,s.LINEAR),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_S,s.CLAMP_TO_EDGE),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_T,s.CLAMP_TO_EDGE);const r=this.uniformLocations.get("u_videoAnalysed");r&&s.uniform1i(r,i)}bindAnalysedFrameFallback(){const e=this.gl,s=this.textureUnits.get("u_videoAnalysed");if(s===void 0)return;if(this.analysedFrameFallbackTexture)e.activeTexture(e.TEXTURE0+s),e.bindTexture(e.TEXTURE_2D,this.analysedFrameFallbackTexture);else{this.analysedFrameFallbackTexture=e.createTexture(),e.activeTexture(e.TEXTURE0+s),e.bindTexture(e.TEXTURE_2D,this.analysedFrameFallbackTexture);const r=new Uint8Array([0,0,0,255]);e.texImage2D(e.TEXTURE_2D,0,e.RGBA,1,1,0,e.RGBA,e.UNSIGNED_BYTE,r),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.NEAREST),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.NEAREST),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE)}const i=this.uniformLocations.get("u_videoAnalysed");i&&e.uniform1i(i,s)}updateVideoStreamTexture(e,s){const i=this.gl,r=`u_videoStream${e}`,o=this.textureUnits.get(r);if(o===void 0){s instanceof ImageBitmap&&s.close();return}this.videoStreamTextures[e]||(this.videoStreamTextures[e]=i.createTexture()),i.activeTexture(i.TEXTURE0+o),i.bindTexture(i.TEXTURE_2D,this.videoStreamTextures[e]);const a=s instanceof OffscreenCanvas;a&&i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,true),i.texImage2D(i.TEXTURE_2D,0,i.RGBA,i.RGBA,i.UNSIGNED_BYTE,s),a&&i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,false),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MIN_FILTER,i.LINEAR),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MAG_FILTER,i.LINEAR),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_S,i.CLAMP_TO_EDGE),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_T,i.CLAMP_TO_EDGE);const c=this.uniformLocations.get(r);c&&i.uniform1i(c,o),s instanceof ImageBitmap&&s.close()}updateDeviceTexture(e,s){if(!this.gl||e>=je.MAX_DEVICE_VIDEOS)return;this.deviceTextures[e]||(this.deviceTextures[e]=this.gl.createTexture());const i=this.deviceTextures[e],r=this.textureUnits.get(`u_device${e}`);if(!i||r===void 0){s instanceof ImageBitmap&&s.close();return}this.gl.activeTexture(this.gl.TEXTURE0+r),this.gl.bindTexture(this.gl.TEXTURE_2D,i);const o=s instanceof OffscreenCanvas;o&&this.gl.pixelStorei(this.gl.UNPACK_FLIP_Y_WEBGL,true),this.gl.texImage2D(this.gl.TEXTURE_2D,0,this.gl.RGBA,this.gl.RGBA,this.gl.UNSIGNED_BYTE,s),o&&this.gl.pixelStorei(this.gl.UNPACK_FLIP_Y_WEBGL,false),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MIN_FILTER,this.gl.LINEAR),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MAG_FILTER,this.gl.LINEAR),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_S,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_T,this.gl.CLAMP_TO_EDGE);const a=`u_device${e}`,c=this.uniformLocations.get(a);c&&this.gl.uniform1i(c,r),s instanceof ImageBitmap&&s.close()}updateSegmentationTexture(e,s,i){const r=this.gl,o=this.textureUnits.get("u_segmentationMask");if(o===void 0)return;this.segmentationTexture||(this.segmentationTexture=r.createTexture()),r.activeTexture(r.TEXTURE0+o),r.bindTexture(r.TEXTURE_2D,this.segmentationTexture),r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,true),r.texImage2D(r.TEXTURE_2D,0,r.LUMINANCE,s,i,0,r.LUMINANCE,r.UNSIGNED_BYTE,e),r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,false),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,r.NEAREST),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MAG_FILTER,r.NEAREST),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,r.CLAMP_TO_EDGE);const a=this.uniformLocations.get("u_segmentationMask");a&&r.uniform1i(a,o)}updateKeyboardTexture(e){const s=this.gl,i=this.textureUnits.get("u_keyboard");if(i===void 0)return;this.keyboardTexture||(this.keyboardTexture=s.createTexture()),s.activeTexture(s.TEXTURE0+i),s.bindTexture(s.TEXTURE_2D,this.keyboardTexture),s.texImage2D(s.TEXTURE_2D,0,s.LUMINANCE,256,3,0,s.LUMINANCE,s.UNSIGNED_BYTE,e),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MIN_FILTER,s.NEAREST),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MAG_FILTER,s.NEAREST),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_S,s.CLAMP_TO_EDGE),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_T,s.CLAMP_TO_EDGE);const r=this.uniformLocations.get("u_keyboard");r&&s.uniform1i(r,i)}updateImageTexture(e,s){const i=this.gl,r=this.textureUnits.get(e);if(r===void 0)return;if(!this.textures.has(e)){const c=i.createTexture();c&&this.textures.set(e,c)}const o=this.textures.get(e);if(!o)return;i.activeTexture(i.TEXTURE0+r),i.bindTexture(i.TEXTURE_2D,o),i.texImage2D(i.TEXTURE_2D,0,i.RGBA,i.RGBA,i.UNSIGNED_BYTE,s),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MIN_FILTER,i.LINEAR),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MAG_FILTER,i.LINEAR),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_S,i.CLAMP_TO_EDGE),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_T,i.CLAMP_TO_EDGE);const a=this.uniformLocations.get(e);a&&i.uniform1i(a,r)}resize(e,s){this.gl.viewport(0,0,e,s),this.backbufferEnabled&&this.createBackbufferFramebuffers()}getParameterDefinitions(){return this.parameters}destroy(){this.destroyed=true;const e=this.gl;this.program&&(e.deleteProgram(this.program),this.program=null),this.audioFFTTexture&&e.deleteTexture(this.audioFFTTexture),this.audioWaveformTexture&&e.deleteTexture(this.audioWaveformTexture),this.videoTexture&&e.deleteTexture(this.videoTexture),this.analysedFrameTexture&&e.deleteTexture(this.analysedFrameTexture),this.analysedFrameFallbackTexture&&e.deleteTexture(this.analysedFrameFallbackTexture),this.segmentationTexture&&e.deleteTexture(this.segmentationTexture);for(const s of this.videoStreamTextures)s&&e.deleteTexture(s);this.videoStreamTextures=[];for(const s of this.deviceTextures)s&&e.deleteTexture(s);this.deviceTextures=[];for(const s of this.textures.values())s&&e.deleteTexture(s);this.textures.clear(),this.backbufferFramebuffer&&e.deleteFramebuffer(this.backbufferFramebuffer),this.backbufferTexture&&e.deleteTexture(this.backbufferTexture),this.currentFramebuffer&&e.deleteFramebuffer(this.currentFramebuffer),this.currentTexture&&e.deleteTexture(this.currentTexture),this.quadBuffer&&e.deleteBuffer(this.quadBuffer),this.gradientBuffers.clear(),this.colorUniformCache.clear(),this.colorUniformCacheKey.clear(),this.scalarUniformCache.clear(),this.accumulatorValues.clear(),this.uniformLocations.clear(),this.textureUnits.clear()}}const qe=(t,e,s)=>zt(t,e,s),Vu=us,$u=Fo,ts=(...t)=>kf(...t),io=t=>Bu(t),ju=Uu,qu=t=>Sf(t),zi=BigInt(0),ro=BigInt(1);function ai(t,e=""){if(typeof t!="boolean"){const s=e&&`"${e}" `;throw new TypeError(s+"expected boolean, got type="+typeof t)}return t}function Mo(t){if(typeof t=="bigint"){if(!Fi(t))throw new RangeError("positive bigint expected, got "+t)}else Vu(t);return t}function no(t,e=""){if(typeof t!="number"){const s=e&&`"${e}" `;throw new TypeError(s+"expected number, got type="+typeof t)}if(!Number.isSafeInteger(t)){const s=e&&`"${e}" `;throw new RangeError(s+"expected safe integer, got "+t)}}function Ai(t){const e=Mo(t).toString(16);return e.length&1?"0"+e:e}function Hu(t){if(typeof t!="string")throw new TypeError("hex string expected, got "+typeof t);return t===""?zi:BigInt("0x"+t)}function kr(t){return Hu(Fo(t))}function Gu(t){return Hu(Fo(Mf(zt(t)).reverse()))}function Oo(t,e){if(us(e),e===0)throw new RangeError("zero length");t=Mo(t);const s=t.toString(16);if(s.length>e*2)throw new RangeError("number too large");return Bu(s.padStart(e*2,"0"))}function Wu(t,e){return Oo(t,e).reverse()}function Mf(t){return Uint8Array.from(qe(t))}const Fi=t=>typeof t=="bigint"&&zi<=t;function Of(t,e,s){return Fi(t)&&Fi(e)&&Fi(s)&&e<=t&&t<s}function Xu(t,e,s,i){if(!Of(e,s,i))throw new RangeError("expected valid "+t+": "+s+" <= n < "+i+", got "+e)}function Bo(t){if(t<zi)throw new Error("expected non-negative bigint, got "+t);let e;for(e=0;t>zi;t>>=ro,e+=1);return e}const Vo=t=>(ro<<BigInt(t))-ro;function Bf(t,e,s){if(us(t,"hashLen"),us(e,"qByteLen"),typeof s!="function")throw new TypeError("hmacFn must be a function");const i=F=>new Uint8Array(F),r=Uint8Array.of(),o=Uint8Array.of(0),a=Uint8Array.of(1),c=1e3;let l=i(t),h=i(t),d=0;const m=()=>{l.fill(1),h.fill(0),d=0},_=(...F)=>s(h,ts(l,...F)),x=(F=r)=>{h=_(o,F),l=_(),F.length!==0&&(h=_(a,F),l=_())},E=()=>{if(d++>=c)throw new Error("drbg: tried max amount of iterations");let F=0;const U=[];for(;F<e;){l=_();const P=l.slice();U.push(P),F+=l.length}return ts(...U)};return(F,U)=>{m(),x(F);let P;for(;(P=U(E()))===void 0;)x();return m(),P}}function wr(t,e={},s={}){if(Object.prototype.toString.call(t)!=="[object Object]")throw new TypeError("expected valid options object");function i(o,a,c){if(!c&&a!=="function"&&!Object.hasOwn(t,o))throw new TypeError(`param "${o}" is invalid: expected own property`);const l=t[o];if(c&&l===void 0)return;const h=typeof l;if(h!==a||l===null)throw new TypeError(`param "${o}" is invalid: expected ${a}, got ${h}`)}const r=(o,a)=>Object.entries(o).forEach(([c,l])=>i(c,l,a));r(e,false),r(s,true)}const et=BigInt(0),De=BigInt(1),ms=BigInt(2),zu=BigInt(3),Yu=BigInt(4),Ku=BigInt(5),Vf=BigInt(7),Zu=BigInt(8),$f=BigInt(9),Qu=BigInt(16);function dt(t,e){if(e<=et)throw new Error("mod: expected positive modulus, got "+e);const s=t%e;return s>=et?s:e+s}function Ya(t,e){if(t===et)throw new Error("invert: expected non-zero number");if(e<=et)throw new Error("invert: expected positive modulus, got "+e);let s=dt(t,e),i=e,r=et,o=De;for(;s!==et;){const c=i/s,l=i-s*c,h=r-o*c;i=s,s=l,r=o,o=h}if(i!==De)throw new Error("invert: does not exist");return dt(r,e)}function $o(t,e,s){const i=t;if(!i.eql(i.sqr(e),s))throw new Error("Cannot find square root")}function Ju(t,e){const s=t,i=(s.ORDER+De)/Yu,r=s.pow(e,i);return $o(s,r,e),r}function jf(t,e){const s=t,i=(s.ORDER-Ku)/Zu,r=s.mul(e,ms),o=s.pow(r,i),a=s.mul(e,o),c=s.mul(s.mul(a,ms),o),l=s.mul(a,s.sub(c,s.ONE));return $o(s,l,e),l}function qf(t){const e=jo(t),s=el(t),i=s(e,e.neg(e.ONE)),r=s(e,i),o=s(e,e.neg(i)),a=(t+Vf)/Qu;return(c,l)=>{const h=c;let d=h.pow(l,a),m=h.mul(d,i);const _=h.mul(d,r),x=h.mul(d,o),E=h.eql(h.sqr(m),l),N=h.eql(h.sqr(_),l);d=h.cmov(d,m,E),m=h.cmov(x,_,N);const F=h.eql(h.sqr(m),l),U=h.cmov(d,m,F);return $o(h,U,l),U}}function el(t){if(t<zu)throw new Error("sqrt is not defined for small field");let e=t-De,s=0;for(;e%ms===et;)e/=ms,s++;let i=ms;const r=jo(t);for(;Ka(r,i)===1;)if(i++>1e3)throw new Error("Cannot find square root: probably non-prime P");if(s===1)return Ju;let o=r.pow(i,e);const a=(e+De)/ms;return function(l,h){const d=l;if(d.is0(h))return h;if(Ka(d,h)!==1)throw new Error("Cannot find square root");let m=s,_=d.mul(d.ONE,o),x=d.pow(h,e),E=d.pow(h,a);for(;!d.eql(x,d.ONE);){if(d.is0(x))return d.ZERO;let N=1,F=d.sqr(x);for(;!d.eql(F,d.ONE);)if(N++,F=d.sqr(F),N===m)throw new Error("Cannot find square root");const U=De<<BigInt(m-N-1),P=d.pow(_,U);m=N,_=d.sqr(P),x=d.mul(x,_),E=d.mul(E,P)}return E}}function Hf(t){return t%Yu===zu?Ju:t%Zu===Ku?jf:t%Qu===$f?qf(t):el(t)}const Gf=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function Wf(t){const e={ORDER:"bigint",BYTES:"number",BITS:"number"},s=Gf.reduce((i,r)=>(i[r]="function",i),e);if(wr(t,s),no(t.BYTES,"BYTES"),no(t.BITS,"BITS"),t.BYTES<1||t.BITS<1)throw new Error("invalid field: expected BYTES/BITS > 0");if(t.ORDER<=De)throw new Error("invalid field: expected ORDER > 1, got "+t.ORDER);return t}function Xf(t,e,s){const i=t;if(s<et)throw new Error("invalid exponent, negatives unsupported");if(s===et)return i.ONE;if(s===De)return e;let r=i.ONE,o=e;for(;s>et;)s&De&&(r=i.mul(r,o)),o=i.sqr(o),s>>=De;return r}function tl(t,e,s=false){const i=t,r=new Array(e.length).fill(s?i.ZERO:void 0),o=e.reduce((c,l,h)=>i.is0(l)?c:(r[h]=c,i.mul(c,l)),i.ONE),a=i.inv(o);return e.reduceRight((c,l,h)=>i.is0(l)?c:(r[h]=i.mul(c,r[h]),i.mul(c,l)),a),r}function Ka(t,e){const s=t,i=(s.ORDER-De)/ms,r=s.pow(e,i),o=s.eql(r,s.ONE),a=s.eql(r,s.ZERO),c=s.eql(r,s.neg(s.ONE));if(!o&&!a&&!c)throw new Error("invalid Legendre symbol result");return o?1:a?0:-1}function zf(t,e){if(e!==void 0&&Vu(e),t<=et)throw new Error("invalid n length: expected positive n, got "+t);if(e!==void 0&&e<1)throw new Error("invalid n length: expected positive bit length, got "+e);const s=Bo(t);if(e!==void 0&&e<s)throw new Error(`invalid n length: expected bit length (${s}) >= n.length (${e})`);const i=e!==void 0?e:s,r=Math.ceil(i/8);return{nBitLength:i,nByteLength:r}}const Za=new WeakMap;class sl{ORDER;BITS;BYTES;isLE;ZERO=et;ONE=De;_lengths;_mod;constructor(e,s={}){if(e<=De)throw new Error("invalid field: expected ORDER > 1, got "+e);let i;this.isLE=false,s!=null&&typeof s=="object"&&(typeof s.BITS=="number"&&(i=s.BITS),typeof s.sqrt=="function"&&Object.defineProperty(this,"sqrt",{value:s.sqrt,enumerable:true}),typeof s.isLE=="boolean"&&(this.isLE=s.isLE),s.allowedLengths&&(this._lengths=Object.freeze(s.allowedLengths.slice())),typeof s.modFromBytes=="boolean"&&(this._mod=s.modFromBytes));const{nBitLength:r,nByteLength:o}=zf(e,i);if(o>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");this.ORDER=e,this.BITS=r,this.BYTES=o,Object.freeze(this)}create(e){return dt(e,this.ORDER)}isValid(e){if(typeof e!="bigint")throw new TypeError("invalid field element: expected bigint, got "+typeof e);return et<=e&&e<this.ORDER}is0(e){return e===et}isValidNot0(e){return!this.is0(e)&&this.isValid(e)}isOdd(e){return(e&De)===De}neg(e){return dt(-e,this.ORDER)}eql(e,s){return e===s}sqr(e){return dt(e*e,this.ORDER)}add(e,s){return dt(e+s,this.ORDER)}sub(e,s){return dt(e-s,this.ORDER)}mul(e,s){return dt(e*s,this.ORDER)}pow(e,s){return Xf(this,e,s)}div(e,s){return dt(e*Ya(s,this.ORDER),this.ORDER)}sqrN(e){return e*e}addN(e,s){return e+s}subN(e,s){return e-s}mulN(e,s){return e*s}inv(e){return Ya(e,this.ORDER)}sqrt(e){let s=Za.get(this);return s||Za.set(this,s=Hf(this.ORDER)),s(this,e)}toBytes(e){return this.isLE?Wu(e,this.BYTES):Oo(e,this.BYTES)}fromBytes(e,s=false){qe(e);const{_lengths:i,BYTES:r,isLE:o,ORDER:a,_mod:c}=this;if(i){if(e.length<1||!i.includes(e.length)||e.length>r)throw new Error("Field.fromBytes: expected "+i+" bytes, got "+e.length);const h=new Uint8Array(r);h.set(e,o?0:h.length-e.length),e=h}if(e.length!==r)throw new Error("Field.fromBytes: expected "+r+" bytes, got "+e.length);let l=o?Gu(e):kr(e);if(c&&(l=dt(l,a)),!s&&!this.isValid(l))throw new Error("invalid field element: outside of range 0..ORDER");return l}invertBatch(e){return tl(this,e)}cmov(e,s,i){return ai(i,"condition"),i?s:e}}Object.freeze(sl.prototype);function jo(t,e={}){return new sl(t,e)}function il(t){if(typeof t!="bigint")throw new Error("field order must be bigint");if(t<=De)throw new Error("field order must be greater than 1");const e=Bo(t-De);return Math.ceil(e/8)}function rl(t){const e=il(t);return e+Math.ceil(e/2)}function Yf(t,e,s=false){qe(t);const i=t.length,r=il(e),o=Math.max(rl(e),16);if(i<o||i>1024)throw new Error("expected "+o+"-1024 bytes of input, got "+i);const a=s?Gu(t):kr(t),c=dt(a,e-De)+De;return s?Wu(c,r):Oo(c,r)}const Ms=BigInt(0),gs=BigInt(1);function Yi(t,e){const s=e.negate();return t?s:e}function Qa(t,e){const s=tl(t.Fp,e.map(i=>i.Z));return e.map((i,r)=>t.fromAffine(i.toAffine(s[r])))}function nl(t,e){if(!Number.isSafeInteger(t)||t<=0||t>e)throw new Error("invalid window size, expected [1.."+e+"], got W="+t)}function Fn(t,e){nl(t,e);const s=Math.ceil(e/t)+1,i=2**(t-1),r=2**t,o=Vo(t),a=BigInt(t);return{windows:s,windowSize:i,mask:o,maxNumber:r,shiftBy:a}}function Ja(t,e,s){const{windowSize:i,mask:r,maxNumber:o,shiftBy:a}=s;let c=Number(t&r),l=t>>a;c>i&&(c-=o,l+=gs);const h=e*i,d=h+Math.abs(c)-1,m=c===0,_=c<0,x=e%2!==0;return{nextN:l,offset:d,isZero:m,isNeg:_,isNegF:x,offsetF:h}}const Un=new WeakMap,ol=new WeakMap;function Mn(t){return ol.get(t)||1}function ec(t){if(t!==Ms)throw new Error("invalid wNAF")}class Kf{BASE;ZERO;Fn;bits;constructor(e,s){this.BASE=e.BASE,this.ZERO=e.ZERO,this.Fn=e.Fn,this.bits=s}_unsafeLadder(e,s,i=this.ZERO){let r=e;for(;s>Ms;)s&gs&&(i=i.add(r)),r=r.double(),s>>=gs;return i}precomputeWindow(e,s){const{windows:i,windowSize:r}=Fn(s,this.bits),o=[];let a=e,c=a;for(let l=0;l<i;l++){c=a,o.push(c);for(let h=1;h<r;h++)c=c.add(a),o.push(c);a=c.double()}return o}wNAF(e,s,i){if(!this.Fn.isValid(i))throw new Error("invalid scalar");let r=this.ZERO,o=this.BASE;const a=Fn(e,this.bits);for(let c=0;c<a.windows;c++){const{nextN:l,offset:h,isZero:d,isNeg:m,isNegF:_,offsetF:x}=Ja(i,c,a);i=l,d?o=o.add(Yi(_,s[x])):r=r.add(Yi(m,s[h]))}return ec(i),{p:r,f:o}}wNAFUnsafe(e,s,i,r=this.ZERO){const o=Fn(e,this.bits);for(let a=0;a<o.windows&&i!==Ms;a++){const{nextN:c,offset:l,isZero:h,isNeg:d}=Ja(i,a,o);if(i=c,!h){const m=s[l];r=r.add(d?m.negate():m)}}return ec(i),r}getPrecomputes(e,s,i){let r=Un.get(s);return r||(r=this.precomputeWindow(s,e),e!==1&&(typeof i=="function"&&(r=i(r)),Un.set(s,r))),r}cached(e,s,i){const r=Mn(e);return this.wNAF(r,this.getPrecomputes(r,e,i),s)}unsafe(e,s,i,r){const o=Mn(e);return o===1?this._unsafeLadder(e,s,r):this.wNAFUnsafe(o,this.getPrecomputes(o,e,i),s,r)}createCache(e,s){nl(s,this.bits),ol.set(e,s),Un.delete(e)}hasCache(e){return Mn(e)!==1}}function Zf(t,e,s,i){let r=e,o=t.ZERO,a=t.ZERO;for(;s>Ms||i>Ms;)s&gs&&(o=o.add(r)),i&gs&&(a=a.add(r)),r=r.double(),s>>=gs,i>>=gs;return{p1:o,p2:a}}function tc(t,e,s){if(e){if(e.ORDER!==t)throw new Error("Field.ORDER must match order: Fp == p, Fn == n");return Wf(e),e}else return jo(t,{isLE:s})}function Qf(t,e,s={},i){if(i===void 0&&(i=t==="edwards"),!e||typeof e!="object")throw new Error(`expected valid ${t} CURVE object`);for(const l of["p","n","h"]){const h=e[l];if(!(typeof h=="bigint"&&h>Ms))throw new Error(`CURVE.${l} must be positive bigint`)}const r=tc(e.p,s.Fp,i),o=tc(e.n,s.Fn,i),c=["Gx","Gy","a","b"];for(const l of c)if(!r.isValid(e[l]))throw new Error(`CURVE.${l} must be valid field element of CURVE.Fp`);return e=Object.freeze(Object.assign({},e)),{CURVE:e,Fp:r,Fn:o}}function Jf(t,e){return function(i){const r=t(i);return{secretKey:r,publicKey:e(r)}}}class sc{oHash;iHash;blockLen;outputLen;canXOF=false;finished=false;destroyed=false;constructor(e,s){if(xr(e),zt(s,void 0,"key"),this.iHash=e.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const i=this.blockLen,r=new Uint8Array(i);r.set(s.length>i?e.create().update(s).digest():s);for(let o=0;o<r.length;o++)r[o]^=54;this.iHash.update(r),this.oHash=e.create();for(let o=0;o<r.length;o++)r[o]^=106;this.oHash.update(r),oi(r)}update(e){return Xi(this),this.iHash.update(e),this}digestInto(e){Xi(this),Mu(e,this),this.finished=true;const s=e.subarray(0,this.outputLen);this.iHash.digestInto(s),this.oHash.update(s),this.oHash.digestInto(s),this.destroy()}digest(){const e=new Uint8Array(this.oHash.outputLen);return this.digestInto(e),e}_cloneInto(e){e||=Object.create(Object.getPrototypeOf(this),{});const{oHash:s,iHash:i,finished:r,destroyed:o,blockLen:a,outputLen:c}=this;return e=e,e.finished=r,e.destroyed=o,e.blockLen=a,e.outputLen=c,e.oHash=s._cloneInto(e.oHash),e.iHash=i._cloneInto(e.iHash),e}clone(){return this._cloneInto()}destroy(){this.destroyed=true,this.oHash.destroy(),this.iHash.destroy()}}const qo=(()=>{const t=(e,s,i)=>new sc(e,s).update(i).digest();return t.create=(e,s)=>new sc(e,s),t})();const ic=(t,e)=>(t+(t>=0?e:-e)/al)/e;function ed(t,e,s){Xu("scalar",t,At,s);const[[i,r],[o,a]]=e,c=ic(a*t,s),l=ic(-r*t,s);let h=t-c*i-l*o,d=-c*r-l*a;const m=h<At,_=d<At;m&&(h=-h),_&&(d=-d);const x=Vo(Math.ceil(Bo(s)/2))+ss;if(h<At||h>=x||d<At||d>=x)throw new Error("splitScalar (endomorphism): failed for k");return{k1neg:m,k1:h,k2neg:_,k2:d}}function oo(t){if(!["compact","recovered","der"].includes(t))throw new Error('Signature format must be "compact", "recovered", or "der"');return t}function On(t,e){wr(t);const s={};for(let i of Object.keys(e))s[i]=t[i]===void 0?e[i]:t[i];return ai(s.lowS,"lowS"),ai(s.prehash,"prehash"),s.format!==void 0&&oo(s.format),s}class td extends Error{constructor(e=""){super(e)}}const pt={Err:td,_tlv:{encode:(t,e)=>{const{Err:s}=pt;if(no(t,"tag"),t<0||t>255)throw new s("tlv.encode: wrong tag");if(typeof e!="string")throw new TypeError('"data" expected string, got type='+typeof e);if(e.length&1)throw new s("tlv.encode: unpadded data");const i=e.length/2,r=Ai(i);if(r.length/2&128)throw new s("tlv.encode: long form length too big");const o=i>127?Ai(r.length/2|128):"";return Ai(t)+o+r+e},decode(t,e){const{Err:s}=pt;e=qe(e,void 0,"DER data");let i=0;if(t<0||t>255)throw new s("tlv.encode: wrong tag");if(e.length<2||e[i++]!==t)throw new s("tlv.decode: wrong tlv");const r=e[i++],o=!!(r&128);let a=0;if(!o)a=r;else{const l=r&127;if(!l)throw new s("tlv.decode(long): indefinite length not supported");if(l>4)throw new s("tlv.decode(long): byte length is too big");const h=e.subarray(i,i+l);if(h.length!==l)throw new s("tlv.decode: length bytes not complete");if(h[0]===0)throw new s("tlv.decode(long): zero leftmost byte");for(const d of h)a=a<<8|d;if(i+=l,a<128)throw new s("tlv.decode(long): not minimal encoding")}const c=e.subarray(i,i+a);if(c.length!==a)throw new s("tlv.decode: wrong value length");return{v:c,l:e.subarray(i+a)}}},_int:{encode(t){const{Err:e}=pt;if(Mo(t),t<At)throw new e("integer: negative integers are not allowed");let s=Ai(t);if(Number.parseInt(s[0],16)&8&&(s="00"+s),s.length&1)throw new e("unexpected DER parsing assertion: unpadded hex");return s},decode(t){const{Err:e}=pt;if(t.length<1)throw new e("invalid signature integer: empty");if(t[0]&128)throw new e("invalid signature integer: negative");if(t.length>1&&t[0]===0&&!(t[1]&128))throw new e("invalid signature integer: unnecessary leading zero");return kr(t)}},toSig(t){const{Err:e,_int:s,_tlv:i}=pt,r=qe(t,void 0,"signature"),{v:o,l:a}=i.decode(48,r);if(a.length)throw new e("invalid signature: left bytes after parsing");const{v:c,l}=i.decode(2,o),{v:h,l:d}=i.decode(2,l);if(d.length)throw new e("invalid signature: left bytes after parsing");return{r:s.decode(c),s:s.decode(h)}},hexFromSig(t){const{_tlv:e,_int:s}=pt,i=e.encode(2,s.encode(t.r)),r=e.encode(2,s.encode(t.s)),o=i+r;return e.encode(48,o)}};Object.freeze(pt._tlv);Object.freeze(pt._int);Object.freeze(pt);const At=BigInt(0),ss=BigInt(1),al=BigInt(2),Ci=BigInt(3),sd=BigInt(4);function id(t,e={}){const s=Qf("weierstrass",t,e),i=s.Fp,r=s.Fn;let o=s.CURVE;const{h:a,n:c}=o;wr(e,{},{allowInfinityPoint:"boolean",clearCofactor:"function",isTorsionFree:"function",fromBytes:"function",toBytes:"function",endo:"object"});const{endo:l,allowInfinityPoint:h}=e;if(l&&(!i.is0(o.a)||typeof l.beta!="bigint"||!Array.isArray(l.basises)))throw new Error('invalid endo: expected "beta": bigint and "basises": array');const d=ul(i,r);function m(){if(!i.isOdd)throw new Error("compression is not supported: Field does not have .isOdd()")}function _(y,k,V){if(h&&k.is0())return Uint8Array.of(0);const{x:G,y:O}=k.toAffine(),R=i.toBytes(G);if(ai(V,"isCompressed"),V){m();const B=!i.isOdd(O);return ts(cl(B),R)}else return ts(Uint8Array.of(4),R,i.toBytes(O))}function x(y){qe(y,void 0,"Point");const{publicKey:k,publicKeyUncompressed:V}=d,G=y.length,O=y[0],R=y.subarray(1);if(h&&G===1&&O===0)return{x:i.ZERO,y:i.ZERO};if(G===k&&(O===2||O===3)){const B=i.fromBytes(R);if(!i.isValid(B))throw new Error("bad point: is not on curve, wrong x");const M=F(B);let C;try{C=i.sqrt(M)}catch(J){const ce=J instanceof Error?": "+J.message:"";throw new Error("bad point: is not on curve, sqrt error"+ce)}m();const H=i.isOdd(C);return(O&1)===1!==H&&(C=i.neg(C)),{x:B,y:C}}else if(G===V&&O===4){const B=i.BYTES,M=i.fromBytes(R.subarray(0,B)),C=i.fromBytes(R.subarray(B,B*2));if(!U(M,C))throw new Error("bad point: is not on curve");return{x:M,y:C}}else throw new Error(`bad point: got length ${G}, expected compressed=${k} or uncompressed=${V}`)}const E=e.toBytes===void 0?_:e.toBytes,N=e.fromBytes===void 0?x:e.fromBytes;function F(y){const k=i.sqr(y),V=i.mul(k,y);return i.add(i.add(V,i.mul(y,o.a)),o.b)}function U(y,k){const V=i.sqr(k),G=F(y);return i.eql(V,G)}if(!U(o.Gx,o.Gy))throw new Error("bad curve params: generator point");const P=i.mul(i.pow(o.a,Ci),sd),X=i.mul(i.sqr(o.b),BigInt(27));if(i.is0(i.add(P,X)))throw new Error("bad curve params: a or b");function $(y,k,V=false){if(!i.isValid(k)||V&&i.is0(k))throw new Error(`bad point coordinate ${y}`);return k}function te(y){if(!(y instanceof z))throw new Error("Weierstrass Point expected")}function ee(y){if(!l||!l.basises)throw new Error("no endo");return ed(y,l.basises,r.ORDER)}function Q(y,k,V,G,O){return V=new z(i.mul(V.X,y),V.Y,V.Z),k=Yi(G,k),V=Yi(O,V),k.add(V)}class z{static BASE=new z(o.Gx,o.Gy,i.ONE);static ZERO=new z(i.ZERO,i.ONE,i.ZERO);static Fp=i;static Fn=r;X;Y;Z;constructor(k,V,G){this.X=$("x",k),this.Y=$("y",V,true),this.Z=$("z",G),Object.freeze(this)}static CURVE(){return o}static fromAffine(k){const{x:V,y:G}=k||{};if(!k||!i.isValid(V)||!i.isValid(G))throw new Error("invalid affine point");if(k instanceof z)throw new Error("projective point not allowed");return i.is0(V)&&i.is0(G)?z.ZERO:new z(V,G,i.ONE)}static fromBytes(k){const V=z.fromAffine(N(qe(k,void 0,"point")));return V.assertValidity(),V}static fromHex(k){return z.fromBytes(io(k))}get x(){return this.toAffine().x}get y(){return this.toAffine().y}precompute(k=8,V=true){return v.createCache(this,k),V||this.multiply(Ci),this}assertValidity(){const k=this;if(k.is0()){if(e.allowInfinityPoint&&i.is0(k.X)&&i.eql(k.Y,i.ONE)&&i.is0(k.Z))return;throw new Error("bad point: ZERO")}const{x:V,y:G}=k.toAffine();if(!i.isValid(V)||!i.isValid(G))throw new Error("bad point: x or y not field elements");if(!U(V,G))throw new Error("bad point: equation left != right");if(!k.isTorsionFree())throw new Error("bad point: not in prime-order subgroup")}hasEvenY(){const{y:k}=this.toAffine();if(!i.isOdd)throw new Error("Field doesn't support isOdd");return!i.isOdd(k)}equals(k){te(k);const{X:V,Y:G,Z:O}=this,{X:R,Y:B,Z:M}=k,C=i.eql(i.mul(V,M),i.mul(R,O)),H=i.eql(i.mul(G,M),i.mul(B,O));return C&&H}negate(){return new z(this.X,i.neg(this.Y),this.Z)}double(){const{a:k,b:V}=o,G=i.mul(V,Ci),{X:O,Y:R,Z:B}=this;let M=i.ZERO,C=i.ZERO,H=i.ZERO,W=i.mul(O,O),J=i.mul(R,R),ce=i.mul(B,B),ae=i.mul(O,R);return ae=i.add(ae,ae),H=i.mul(O,B),H=i.add(H,H),M=i.mul(k,H),C=i.mul(G,ce),C=i.add(M,C),M=i.sub(J,C),C=i.add(J,C),C=i.mul(M,C),M=i.mul(ae,M),H=i.mul(G,H),ce=i.mul(k,ce),ae=i.sub(W,ce),ae=i.mul(k,ae),ae=i.add(ae,H),H=i.add(W,W),W=i.add(H,W),W=i.add(W,ce),W=i.mul(W,ae),C=i.add(C,W),ce=i.mul(R,B),ce=i.add(ce,ce),W=i.mul(ce,ae),M=i.sub(M,W),H=i.mul(ce,J),H=i.add(H,H),H=i.add(H,H),new z(M,C,H)}add(k){te(k);const{X:V,Y:G,Z:O}=this,{X:R,Y:B,Z:M}=k;let C=i.ZERO,H=i.ZERO,W=i.ZERO;const J=o.a,ce=i.mul(o.b,Ci);let ae=i.mul(V,R),w=i.mul(G,B),T=i.mul(O,M),D=i.add(V,G),L=i.add(R,B);D=i.mul(D,L),L=i.add(ae,w),D=i.sub(D,L),L=i.add(V,O);let j=i.add(R,M);return L=i.mul(L,j),j=i.add(ae,T),L=i.sub(L,j),j=i.add(G,O),C=i.add(B,M),j=i.mul(j,C),C=i.add(w,T),j=i.sub(j,C),W=i.mul(J,L),C=i.mul(ce,T),W=i.add(C,W),C=i.sub(w,W),W=i.add(w,W),H=i.mul(C,W),w=i.add(ae,ae),w=i.add(w,ae),T=i.mul(J,T),L=i.mul(ce,L),w=i.add(w,T),T=i.sub(ae,T),T=i.mul(J,T),L=i.add(L,T),ae=i.mul(w,L),H=i.add(H,ae),ae=i.mul(j,L),C=i.mul(D,C),C=i.sub(C,ae),ae=i.mul(D,w),W=i.mul(j,W),W=i.add(W,ae),new z(C,H,W)}subtract(k){return te(k),this.add(k.negate())}is0(){return this.equals(z.ZERO)}multiply(k){const{endo:V}=e;if(!r.isValidNot0(k))throw new RangeError("invalid scalar: out of range");let G,O;const R=B=>v.cached(this,B,M=>Qa(z,M));if(V){const{k1neg:B,k1:M,k2neg:C,k2:H}=ee(k),{p:W,f:J}=R(M),{p:ce,f:ae}=R(H);O=J.add(ae),G=Q(V.beta,W,ce,B,C)}else{const{p:B,f:M}=R(k);G=B,O=M}return Qa(z,[G,O])[0]}multiplyUnsafe(k){const{endo:V}=e,G=this,O=k;if(!r.isValid(O))throw new RangeError("invalid scalar: out of range");if(O===At||G.is0())return z.ZERO;if(O===ss)return G;if(v.hasCache(this))return this.multiply(O);if(V){const{k1neg:R,k1:B,k2neg:M,k2:C}=ee(O),{p1:H,p2:W}=Zf(z,G,B,C);return Q(V.beta,H,W,R,M)}else return v.unsafe(G,O)}toAffine(k){const V=this;let G=k;const{X:O,Y:R,Z:B}=V;if(i.eql(B,i.ONE))return{x:O,y:R};const M=V.is0();G==null&&(G=M?i.ONE:i.inv(B));const C=i.mul(O,G),H=i.mul(R,G),W=i.mul(B,G);if(M)return{x:i.ZERO,y:i.ZERO};if(!i.eql(W,i.ONE))throw new Error("invZ was invalid");return{x:C,y:H}}isTorsionFree(){const{isTorsionFree:k}=e;return a===ss?true:k?k(z,this):v.unsafe(this,c).is0()}clearCofactor(){const{clearCofactor:k}=e;return a===ss?this:k?k(z,this):this.multiplyUnsafe(a)}isSmallOrder(){return a===ss?this.is0():this.clearCofactor().is0()}toBytes(k=true){return ai(k,"isCompressed"),this.assertValidity(),E(z,this,k)}toHex(k=true){return $u(this.toBytes(k))}toString(){return`<Point ${this.is0()?"ZERO":this.toHex()}>`}}const ne=r.BITS,v=new Kf(z,e.endo?Math.ceil(ne/2):ne);return ne>=8&&z.BASE.precompute(8),Object.freeze(z.prototype),Object.freeze(z),z}function cl(t){return Uint8Array.of(t?2:3)}function ul(t,e){return{secretKey:e.BYTES,publicKey:1+t.BYTES,publicKeyUncompressed:1+2*t.BYTES,publicKeyHasPrefix:true,signature:2*e.BYTES}}function rd(t,e={}){const{Fn:s}=t,i=e.randomBytes===void 0?qu:e.randomBytes,r=Object.assign(ul(t.Fp,s),{seed:Math.max(rl(s.ORDER),16)});function o(x){try{const E=s.fromBytes(x);return s.isValidNot0(E)}catch{return false}}function a(x,E){const{publicKey:N,publicKeyUncompressed:F}=r;try{const U=x.length;return E===true&&U!==N||E===false&&U!==F?false:!!t.fromBytes(x)}catch{return false}}function c(x){return x=x===void 0?i(r.seed):x,Yf(qe(x,r.seed,"seed"),s.ORDER)}function l(x,E=true){return t.BASE.multiply(s.fromBytes(x)).toBytes(E)}function h(x){const{secretKey:E,publicKey:N,publicKeyUncompressed:F}=r,U=s._lengths;if(!ju(x))return;const P=qe(x,void 0,"key").length,X=P===N||P===F,$=P===E||!!U?.includes(P);if(!(X&&$))return X}function d(x,E,N=true){if(h(x)===true)throw new Error("first arg must be private key");if(h(E)===false)throw new Error("second arg must be public key");const F=s.fromBytes(x);return t.fromBytes(E).multiply(F).toBytes(N)}const m={isValidSecretKey:o,isValidPublicKey:a,randomSecretKey:c},_=Jf(c,l);return Object.freeze(m),Object.freeze(r),Object.freeze({getPublicKey:l,getSharedSecret:d,keygen:_,Point:t,utils:m,lengths:r})}function nd(t,e,s={}){const i=e;xr(i),wr(s,{},{hmac:"function",lowS:"boolean",randomBytes:"function",bits2int:"function",bits2int_modN:"function"}),s=Object.assign({},s);const r=s.randomBytes===void 0?qu:s.randomBytes,o=s.hmac===void 0?(O,R)=>qo(i,O,R):s.hmac,{Fp:a,Fn:c}=t,{ORDER:l,BITS:h}=c,{keygen:d,getPublicKey:m,getSharedSecret:_,utils:x,lengths:E}=rd(t,s),N={prehash:true,lowS:typeof s.lowS=="boolean"?s.lowS:true,format:"compact",extraEntropy:false},F=l*al+ss<a.ORDER;function U(O){const R=l>>ss;return O>R}function P(O,R){if(!c.isValidNot0(R))throw new Error(`invalid signature ${O}: out of range 1..Point.Fn.ORDER`);return R}function X(){if(F)throw new Error('"recovered" sig type is not supported for cofactor >2 curves')}function $(O,R){oo(R);const B=E.signature,M=R==="compact"?B:R==="recovered"?B+1:void 0;return qe(O,M)}class te{r;s;recovery;constructor(R,B,M){if(this.r=P("r",R),this.s=P("s",B),M!=null){if(X(),![0,1,2,3].includes(M))throw new Error("invalid recovery id");this.recovery=M}Object.freeze(this)}static fromBytes(R,B=N.format){$(R,B);let M;if(B==="der"){const{r:J,s:ce}=pt.toSig(qe(R));return new te(J,ce)}B==="recovered"&&(M=R[0],B="compact",R=R.subarray(1));const C=E.signature/2,H=R.subarray(0,C),W=R.subarray(C,C*2);return new te(c.fromBytes(H),c.fromBytes(W),M)}static fromHex(R,B){return this.fromBytes(io(R),B)}assertRecovery(){const{recovery:R}=this;if(R==null)throw new Error("invalid recovery id: must be present");return R}addRecoveryBit(R){return new te(this.r,this.s,R)}recoverPublicKey(R){const{r:B,s:M}=this,C=this.assertRecovery(),H=C===2||C===3?B+l:B;if(!a.isValid(H))throw new Error("invalid recovery id: sig.r+curve.n != R.x");const W=a.toBytes(H),J=t.fromBytes(ts(cl((C&1)===0),W)),ce=c.inv(H),ae=Q(qe(R,void 0,"msgHash")),w=c.create(-ae*ce),T=c.create(M*ce),D=t.BASE.multiplyUnsafe(w).add(J.multiplyUnsafe(T));if(D.is0())throw new Error("invalid recovery: point at infinify");return D.assertValidity(),D}hasHighS(){return U(this.s)}toBytes(R=N.format){if(oo(R),R==="der")return io(pt.hexFromSig(this));const{r:B,s:M}=this,C=c.toBytes(B),H=c.toBytes(M);return R==="recovered"?(X(),ts(Uint8Array.of(this.assertRecovery()),C,H)):ts(C,H)}toHex(R){return $u(this.toBytes(R))}}Object.freeze(te.prototype),Object.freeze(te);const ee=s.bits2int===void 0?function(R){if(R.length>8192)throw new Error("input is too large");const B=kr(R),M=R.length*8-h;return M>0?B>>BigInt(M):B}:s.bits2int,Q=s.bits2int_modN===void 0?function(R){return c.create(ee(R))}:s.bits2int_modN,z=Vo(h);function ne(O){return Xu("num < 2^"+h,O,At,z),c.toBytes(O)}function v(O,R){return qe(O,void 0,"message"),R?qe(i(O),void 0,"prehashed message"):O}function y(O,R,B){const{lowS:M,prehash:C,extraEntropy:H}=On(B,N);O=v(O,C);const W=Q(O),J=c.fromBytes(R);if(!c.isValidNot0(J))throw new Error("invalid private key");const ce=[ne(J),ne(W)];if(H!=null&&H!==false){const D=H===true?r(E.secretKey):H;ce.push(qe(D,void 0,"extraEntropy"))}const ae=ts(...ce),w=W;function T(D){const L=ee(D);if(!c.isValidNot0(L))return;const j=c.inv(L),se=t.BASE.multiply(L).toAffine(),re=c.create(se.x);if(re===At)return;const pe=c.create(j*c.create(w+re*J));if(pe===At)return;let Se=(se.x===re?0:2)|Number(se.y&ss),ke=pe;return M&&U(pe)&&(ke=c.neg(pe),Se^=1),new te(re,ke,F?void 0:Se)}return{seed:ae,k2sig:T}}function k(O,R,B={}){const{seed:M,k2sig:C}=y(O,R,B);return Bf(i.outputLen,c.BYTES,o)(M,C).toBytes(B.format)}function V(O,R,B,M={}){const{lowS:C,prehash:H,format:W}=On(M,N);if(B=qe(B,void 0,"publicKey"),R=v(R,H),!ju(O)){const J=O instanceof te?", use sig.toBytes()":"";throw new Error("verify expects Uint8Array signature"+J)}$(O,W);try{const J=te.fromBytes(O,W),ce=t.fromBytes(B);if(C&&J.hasHighS())return false;const{r:ae,s:w}=J,T=Q(R),D=c.inv(w),L=c.create(T*D),j=c.create(ae*D),se=t.BASE.multiplyUnsafe(L).add(ce.multiplyUnsafe(j));return se.is0()?false:c.create(se.x)===ae}catch{return false}}function G(O,R,B={}){const{prehash:M}=On(B,N);return R=v(R,M),te.fromBytes(O,"recovered").recoverPublicKey(R).toBytes()}return Object.freeze({keygen:d,getPublicKey:m,getSharedSecret:_,utils:x,lengths:E,Point:t,sign:k,verify:V,recoverPublicKey:G,Signature:te,hash:i})}const od={p:BigInt("0xffffffff00000001000000000000000000000000ffffffffffffffffffffffff"),n:BigInt("0xffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551"),h:BigInt(1),a:BigInt("0xffffffff00000001000000000000000000000000fffffffffffffffffffffffc"),b:BigInt("0x5ac635d8aa3a93e7b3ebbd55769886bc651d06b0cc53b0f63bce3c3e27d2604b"),Gx:BigInt("0x6b17d1f2e12c4247f8bce6e563a440f277037d812deb33a0f4a13945d898c296"),Gy:BigInt("0x4fe342e2fe1a7f9b8ee7eb4a7c0f9e162bce33576b315ececbb6406837bf51f5")},ad=id(od),cd=nd(ad,Uo),rc={x:"6bkPbVZXx-c08blVs6qIwm0gfSRLS2nnf2Tsz19ggtM",y:"lhi486ASKQkS8TGbVee-FpdAu7qKaO3gad_4ScX8qJI"},ud=60;let Ki=null,Ho=false,Zs=null,ao=0;function Zi(t){const e=t.replace(/-/g,"+").replace(/_/g,"/"),s=atob(e),i=new Uint8Array(s.length);for(let r=0;r<s.length;r++)i[r]=s.charCodeAt(r);return i}function ld(t,e){try{const s=Zi(t),i=Zi(e);if(s.length!==32||i.length!==32)return null;const r=new Uint8Array(65);return r[0]=4,r.set(s,1),r.set(i,33),r}catch{return null}}function hd(t,e){try{const s=t.split(".");if(s.length!==3)return null;const i=new TextEncoder().encode(s[0]+"."+s[1]),r=Zi(s[2]);if(r.length!==64||!cd.verify(r,i,e,{lowS:false}))return null;const o=JSON.parse(new TextDecoder().decode(Zi(s[1])));return{c:o.c??{},e:o.e??0}}catch{return null}}function fd(t,e){return!(t>0&&t+ud<e)}async function dd(){Ki=ld(rc.x,rc.y),Ki||(Ho=true,console.warn("[Viji] _SC: key import failed — restricted mode active"))}async function nc(t){const e=Ho||!Ki?null:hd(t,Ki);Zs=e?.c??null,ao=e?.e??0}function oc(t,e){return Ho||!Zs?e:fd(ao,Math.floor(Date.now()/1e3))?typeof Zs[t]=="number"?Zs[t]:e:(Zs=null,ao=0,e)}const pd="#F1F1F1",Ls=28,Bn=40,ac=24,md={paths:["M37.5801 32.0859L32.248 40.084C31.9699 40.5012 31.5015 40.7519 31 40.752C30.4985 40.7519 30.0302 40.5012 29.752 40.084L24.4199 32.0859L26.916 30.4219L31 36.5479L35.084 30.4219L37.5801 32.0859Z","M43.0059 39.25C43.0059 40.0784 43.6774 40.75 44.5059 40.75C45.3343 40.75 46.0059 40.0784 46.0059 39.25V31H43.0059V39.25Z","M61.0059 39.25C61.0059 40.0784 61.6774 40.75 62.5059 40.75C63.3343 40.75 64.0059 40.0784 64.0059 39.25V31H61.0059V39.25Z","M55.001 39.5C55.001 42.1883 53.9879 44.6433 52.3262 46.5C52.0009 46.8635 51.6509 47.2044 51.2783 47.5195L49.3408 45.2295C49.6074 45.004 49.858 44.7601 50.0908 44.5C51.2793 43.1721 52.001 41.4218 52.001 39.5H52.0059V31H55.0059V39.5H55.001Z"],dots:[[44.5,26.5],[53.5,26.5],[62.5,26.5]],minX:24.4199,minY:24.625,maxX:64.375,maxY:47.5195,shadowStd:11},gd={paths:["M77.6895 41.1893C78.2752 40.6036 79.2248 40.6036 79.8106 41.1893C80.3963 41.7751 80.3963 42.7246 79.8106 43.3104L43.8106 79.3104C43.2248 79.8962 42.2752 79.8962 41.6895 79.3104C41.1037 78.7246 41.1037 77.7751 41.6895 77.1893L77.6895 41.1893Z","M76.875 78.25C76.875 77.2145 77.7145 76.375 78.75 76.375C79.7855 76.375 80.625 77.2145 80.625 78.25C80.625 79.2855 79.7855 80.125 78.75 80.125C77.7145 80.125 76.875 79.2855 76.875 78.25Z","M77.6895 59.1893C78.2752 58.6036 79.2248 58.6036 79.8106 59.1893C80.3963 59.7751 80.3963 60.7246 79.8106 61.3104L61.8106 79.3104C61.2248 79.8962 60.2752 79.8962 59.6895 79.3104C59.1037 78.7246 59.1037 77.7751 59.6895 77.1893L77.6895 59.1893Z","M44.625 42.25C44.625 43.2855 43.7855 44.125 42.75 44.125C41.7145 44.125 40.875 43.2855 40.875 42.25C40.875 41.2145 41.7145 40.375 42.75 40.375C43.7855 40.375 44.625 41.2145 44.625 42.25Z","M43.8105 61.3107C43.2248 61.8964 42.2752 61.8964 41.6894 61.3107C41.1037 60.7249 41.1037 59.7754 41.6894 59.1896L59.6894 41.1896C60.2752 40.6038 61.2248 40.6038 61.8105 41.1896C62.3963 41.7754 62.3963 42.7249 61.8105 43.3107L43.8105 61.3107Z","M70.9911 99.5C70.9911 102.188 69.978 104.643 68.3163 106.5C67.991 106.863 67.6409 107.204 67.2684 107.52L65.3309 105.229C65.5974 105.004 65.8482 104.76 66.0809 104.5C67.2694 103.172 67.9911 101.422 67.9911 99.5H67.9969V91H70.9969V99.5H70.9911Z","M53.5702 92.2109L48.2382 100.209C47.96 100.626 47.4916 100.877 46.9901 100.877C46.4886 100.877 46.0203 100.626 45.7421 100.209L40.41 92.2109L42.9061 90.5469L46.9901 96.6729L51.0741 90.5469L53.5702 92.2109Z","M76.996 99.375C76.996 100.203 77.6675 100.875 78.496 100.875C79.3244 100.875 79.996 100.203 79.996 99.375V91.125H76.996V99.375Z","M58.9969 99.375C58.9969 100.203 59.6685 100.875 60.4969 100.875C61.3254 100.875 61.9969 100.203 61.9969 99.375V91.125H58.9969V99.375Z"],dots:[],minX:40.41,minY:40.375,maxX:80.625,maxY:107.52,shadowStd:12};let ci=null,ui=null,ll=null,hl=null,We=null,Ds=null,Qi=null,Jt=null,jt=-1,qt=-1,co=null,Ze=null,Ns=null,Fs=null,fl=0,dl=0,Sr=0,Go=-1,uo=null,Ji="srgb",bt=null,Vt=null,Tt=null,Ii=null;const bd=["clearRect","fillRect","strokeRect","fillText","strokeText","drawImage","putImageData","fill","stroke","reset"];let yt=null;function yd(t){if(yt!==t){yt=t,uo=null,Sr=0,Go=-1,bt={save:t.save,restore:t.restore,setTransform:t.setTransform,clearRect:t.clearRect,drawImage:t.drawImage,getImageData:t.getImageData,putImageData:t.putImageData};try{Ji=t.getContextAttributes?.()?.colorSpace??"srgb"}catch{Ji="srgb"}}}function _d(t){if(!(uo===t||yt!==t)){uo=t;for(const e of bd){const s=t[e];if(typeof s!="function")continue;const i=s;t[e]=function(){return Sr++,i.apply(this,arguments)}}}}let $t=null,Ui=0,Mi=0,rs=null,cc=null,Vn=false;function pl(t,e,s,i,r,o){const a=Math.max(0,Math.floor(t)),c=Math.max(0,Math.floor(e)),l=Math.min(r,Math.ceil(t+s)),h=Math.min(o,Math.ceil(e+i));return l<=a||h<=c?null:{x:a,y:c,w:l-a,h:h-c}}function ml(t){const e=bt;e&&t===yt?e.setTransform.call(t,1,0,0,1,0,0):t.setTransform(1,0,0,1,0,0),t.globalAlpha=1,t.globalCompositeOperation="source-over",t.filter="none",t.shadowColor="transparent",t.shadowBlur=0,t.shadowOffsetX=0,t.shadowOffsetY=0,t.imageSmoothingEnabled=true,t.imageSmoothingQuality="low"}function gl(t){(bt&&t===yt?bt.save:t.save).call(t)}function bl(t){(bt&&t===yt?bt.restore:t.restore).call(t)}function vd(t,e,s,i,r){(bt&&t===yt?bt.clearRect:t.clearRect).call(t,e,s,i,r)}function yl(t,...e){(bt&&t===yt?bt.drawImage:t.drawImage).call(t,...e)}function xd(t){if(cc!==t){cc=t;try{Vn=!!t.getContextAttributes()?.preserveDrawingBuffer}catch{Vn=false}}return Vn}function kd(t,e,s){if(t){if(e&&Fs&&Ze){const i=Fs;Fs=null;try{t.width!==fl||t.height!==dl||(Sr===Go?(gl(e),ml(e),vd(e,i.x,i.y,i.w,i.h),yl(e,Ze,0,0,i.w,i.h,i.x,i.y,i.w,i.h),bl(e)):wd(e,i))}catch(r){lo(),console.warn("[Viji] overlay: restore failed",r)}}if(s&&rs&&$t&&s===co){const i=rs;rs=null;try{kl(s,t,$t,i,false)}catch(r){lo(),console.warn("[Viji] overlay: GL restore failed",r)}}}}function lo(){Fs=null,Vt=null,rs=null}function wd(t,e){if(!Ze||!Vt)return;if(Tt)(Tt.width<e.w||Tt.height<e.h)&&(Tt.width=Math.max(e.w,Tt.width),Tt.height=Math.max(e.h,Tt.height));else try{Tt=new OffscreenCanvas(e.w,e.h),Ii=Tt.getContext("2d",{colorSpace:Ji})}catch{Tt=null,Ii=null}if(!Ii)return;const s=Ii;s.imageSmoothingEnabled=true,s.imageSmoothingQuality="low",s.clearRect(0,0,e.w,e.h),s.drawImage(Ze,0,0,e.w,e.h,0,0,e.w,e.h),s.drawImage(Vt.buffer,Vt.dx,Vt.dy,Vt.dw,Vt.dh);const i=bt,r=(i&&t===yt?i.getImageData:t.getImageData).call(t,e.x,e.y,e.w,e.h),o=s.getImageData(0,0,e.w,e.h),a=Ns.getImageData(0,0,e.w,e.h),c=r.data,l=o.data,h=a.data;for(let m=0;m<c.length;m+=4)c[m]===l[m]&&c[m+1]===l[m+1]&&c[m+2]===l[m+2]&&c[m+3]===l[m+3]&&(c[m]=h[m],c[m+1]=h[m+1],c[m+2]=h[m+2],c[m+3]=h[m+3]);(i&&t===yt?i.putImageData:t.putImageData).call(t,r,e.x,e.y)}function Sd(t,e){if(Ze)(Ze.width<t||Ze.height<e)&&(Ze.width=Math.max(t,Ze.width),Ze.height=Math.max(e,Ze.height));else try{Ze=new OffscreenCanvas(t,e),Ns=Ze.getContext("2d",{colorSpace:Ji})}catch{Ze=null,Ns=null}return!!Ns}function Ed(t,e,s){const i=t,r=typeof i.createVertexArray=="function",o=t.getParameter(t.ACTIVE_TEXTURE);t.activeTexture(t.TEXTURE0);const a=t.getParameter(t.TEXTURE_BINDING_2D),c=t.getParameter(t.FRAMEBUFFER_BINDING),l=r?t.getParameter(i.READ_FRAMEBUFFER_BINDING):null,h=r?t.getParameter(i.PIXEL_UNPACK_BUFFER_BINDING):null;h&&i.bindBuffer(i.PIXEL_UNPACK_BUFFER,null),t.bindFramebuffer(t.FRAMEBUFFER,null),$t?t.bindTexture(t.TEXTURE_2D,$t):($t=t.createTexture(),$t&&(t.bindTexture(t.TEXTURE_2D,$t),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),Ui=0,Mi=0)),$t?((Ui!==s.w||Mi!==s.h)&&(t.texImage2D(t.TEXTURE_2D,0,t.RGBA,s.w,s.h,0,t.RGBA,t.UNSIGNED_BYTE,null),Ui=s.w,Mi=s.h),t.copyTexSubImage2D(t.TEXTURE_2D,0,0,0,s.x,e.height-(s.y+s.h),s.w,s.h),rs=s):rs=null,t.bindTexture(t.TEXTURE_2D,a),t.bindFramebuffer(t.FRAMEBUFFER,c),r&&(i.bindFramebuffer(i.READ_FRAMEBUFFER,l),h&&i.bindBuffer(i.PIXEL_UNPACK_BUFFER,h)),t.activeTexture(o)}let Wo=0;const Td=`
441
441
  attribute vec2 a_pos;
442
442
  attribute vec2 a_uv;
443
443
  varying vec2 v_uv;
@@ -451,7 +451,7 @@ uniform float u_alpha;
451
451
  varying vec2 v_uv;
452
452
  void main() {
453
453
  gl_FragColor = texture2D(u_tex, v_uv) * u_alpha;
454
- }`;function Cd(t){const e=new Path2D;for(const[s,i]of t.dots){const r=new Path2D;r.arc(s,i,1.875,0,Math.PI*2),e.addPath(r)}for(const s of t.paths)e.addPath(new Path2D(s));return e}function uc(t){const e=t.maxX-t.minX,s=t.maxY-t.minY,i=Math.ceil(e+Ls*2),r=Math.ceil(s+Ls*2),a=new OffscreenCanvas(i,r),o=a.getContext("2d");if(!o)return null;const c=Cd(t);o.translate(Ls-t.minX,Ls-t.minY),o.fillStyle=pd;const l=[[t.shadowStd*2,.5],[8,.2],[2,.1]];for(const[h,d]of l)o.save(),o.shadowColor=`rgba(0,0,0,${d})`,o.shadowBlur=h,o.fill(c),o.restore();return o.fill(c),{canvas:a,bufW:i,bufH:r,contentW:e,contentH:s}}function Id(t){try{ci=uc(md),ui=uc(gd)}catch(e){console.warn("[Viji] overlay: init failed",e)}}function lc(t){Ga=t}function _l(t,e,s,i){const r=t===0,a=r?ui:ci;if(!a)return null;const o=a.contentW*i,c=a.contentH*i;let l,h;return t===0?(l=On*i,h=On*i):t===2?(l=oc*i,h=s-c-oc*i):(l=(e-o)/2,h=On*i),{buffer:a,vertical:r,px:Math.round(l-Ls*i),py:Math.round(h-Ls*i),w:a.bufW*i,h:a.bufH*i}}function hc(t,e,s,i,r=1){if(i>=1)return;const a=_l(Ga,t.width,t.height,r||1);a&&(e?Ud(e,t,a):s&&Md(s,t,a))}const Rd=`
454
+ }`;function Cd(t){const e=new Path2D;for(const[s,i]of t.dots){const r=new Path2D;r.arc(s,i,1.875,0,Math.PI*2),e.addPath(r)}for(const s of t.paths)e.addPath(new Path2D(s));return e}function uc(t){const e=t.maxX-t.minX,s=t.maxY-t.minY,i=Math.ceil(e+Ls*2),r=Math.ceil(s+Ls*2),o=new OffscreenCanvas(i,r),a=o.getContext("2d");if(!a)return null;const c=Cd(t);a.translate(Ls-t.minX,Ls-t.minY),a.fillStyle=pd;const l=[[t.shadowStd*2,.5],[8,.2],[2,.1]];for(const[h,d]of l)a.save(),a.shadowColor=`rgba(0,0,0,${d})`,a.shadowBlur=h,a.fill(c),a.restore();return a.fill(c),{canvas:o,bufW:i,bufH:r,contentW:e,contentH:s}}function Id(t){try{ci=uc(md),ui=uc(gd)}catch(e){console.warn("[Viji] overlay: init failed",e)}}function lc(t){Wo=t}function _l(t,e,s,i){const r=t===0,o=r?ui:ci;if(!o)return null;const a=o.contentW*i,c=o.contentH*i;let l,h;return t===0?(l=Bn*i,h=Bn*i):t===2?(l=ac*i,h=s-c-ac*i):(l=(e-a)/2,h=Bn*i),{buffer:o,vertical:r,px:Math.round(l-Ls*i),py:Math.round(h-Ls*i),w:o.bufW*i,h:o.bufH*i}}function hc(t,e,s,i,r=1){if(i>=1)return;const o=_l(Wo,t.width,t.height,r||1);o&&(e?Ud(e,t,o):s&&Md(s,t,o))}const Rd=`
455
455
  struct VSOut {
456
456
  @builtin(position) pos: vec4f,
457
457
  @location(0) uv: vec2f,
@@ -468,17 +468,17 @@ fn vs(@location(0) pos: vec2f, @location(1) uv: vec2f) -> VSOut {
468
468
  @fragment
469
469
  fn fs(@location(0) uv: vec2f) -> @location(0) vec4f {
470
470
  return textureSample(tex, samp, uv);
471
- }`;let Qe=null,Ri=false,er=null,fc=null;function Pd(){er=null}function vl(){if(Qe){try{Qe.texHorizontal?.destroy(),Qe.texVertical?.destroy(),Qe.quadBuf.destroy()}catch{}Qe=null}}function dc(t,e){const s=t.createTexture({size:{width:e.bufW,height:e.bufH},format:"rgba8unorm",usage:22});return t.queue.copyExternalImageToTexture({source:e.canvas},{texture:s,premultipliedAlpha:true},{width:e.bufW,height:e.bufH}),s}function Ld(t,e){if(t===er)return null;if(Qe&&Qe.device===t&&Qe.format===e)return Qe;vl();const s=t.createShaderModule({code:Rd}),i={color:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"}},r=t.createRenderPipeline({layout:"auto",vertex:{module:s,entryPoint:"vs",buffers:[{arrayStride:16,attributes:[{shaderLocation:0,offset:0,format:"float32x2"},{shaderLocation:1,offset:8,format:"float32x2"}]}]},fragment:{module:s,entryPoint:"fs",targets:[{format:e,blend:i}]},primitive:{topology:"triangle-strip"}}),a=t.createSampler({magFilter:"linear",minFilter:"linear"}),o=t.createBuffer({size:4*16,usage:40}),c=d=>t.createBindGroup({layout:r.getBindGroupLayout(0),entries:[{binding:0,resource:a},{binding:1,resource:d.createView()}]}),l=ci?dc(t,ci):null,h=ui?dc(t,ui):null;return Qe={device:t,format:e,pipeline:r,sampler:a,texHorizontal:l,texVertical:h,bindHorizontal:l?c(l):null,bindVertical:h?c(h):null,quadBuf:o},fc!==t&&(fc=t,t.lost.then(()=>{Qe&&Qe.device===t&&(Qe=null)}).catch(()=>{})),Qe}function Dd(t,e,s,i,r,a=1){if(r>=1)return;const o=_l(Ga,i.width,i.height,a||1);if(o)try{const c=Ld(e,s);if(!c)return;const l=o.vertical?c.bindVertical:c.bindHorizontal;if(!l)return;const h=i.width,d=i.height,m=o.px/h*2-1,_=(o.px+o.w)/h*2-1,x=1-o.py/d*2,E=1-(o.py+o.h)/d*2,N=new Float32Array([m,x,0,0,_,x,1,0,m,E,0,1,_,E,1,1]);e.queue.writeBuffer(c.quadBuf,0,N),e.pushErrorScope("validation");const F=e.createCommandEncoder(),U=F.beginRenderPass({colorAttachments:[{view:t.getCurrentTexture().createView(),loadOp:"load",storeOp:"store"}]});U.setPipeline(c.pipeline),U.setBindGroup(0,l),U.setVertexBuffer(0,c.quadBuf),U.draw(4),U.end(),e.queue.submit([F.finish()]),e.popErrorScope().then(P=>{P&&!Ri&&(Ri=true,console.warn("[Viji] overlay: webgpu validation error",P.message))}).catch(()=>{})}catch(c){(!Ri||er!==e)&&(Ri=true,console.warn("[Viji] overlay: webgpu pass failed",c)),er=e,vl()}}const xl=34229;function Nd(t){const e=t;if(typeof e.createVertexArray=="function")return{create:()=>e.createVertexArray(),bind:i=>e.bindVertexArray(i)};const s=t.getExtension("OES_vertex_array_object");return s?{create:()=>s.createVertexArrayOES(),bind:i=>s.bindVertexArrayOES(i)}:null}function pc(t,e){if(!e)return null;const s=t.getParameter(t.TEXTURE_BINDING_2D),i=t.getParameter(t.UNPACK_FLIP_Y_WEBGL),r=t.getParameter(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL);t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,1),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,0);const a=t.createTexture();return t.bindTexture(t.TEXTURE_2D,a),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,e),t.bindTexture(t.TEXTURE_2D,s),t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,i?1:0),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,r?1:0),a}function Fd(t){if(ca===t)return;ca=t,$t=null,Ui=0,Mi=0,rs=null,ll=pc(t,ci?.canvas??null),hl=pc(t,ui?.canvas??null);const e=t.createShader(t.VERTEX_SHADER);t.shaderSource(e,Td),t.compileShader(e);const s=t.createShader(t.FRAGMENT_SHADER);if(t.shaderSource(s,Ad),t.compileShader(s),We=t.createProgram(),t.attachShader(We,e),t.attachShader(We,s),t.bindAttribLocation(We,0,"a_pos"),t.bindAttribLocation(We,1,"a_uv"),t.linkProgram(We),t.deleteShader(e),t.deleteShader(s),!t.getProgramParameter(We,t.LINK_STATUS)){console.warn("[Viji] overlay: shader link failed"),We=null;return}if(Ds=t.createBuffer(),jt=t.getAttribLocation(We,"a_pos"),qt=t.getAttribLocation(We,"a_uv"),Jt=Nd(t),Jt){const i=t.getParameter(xl),r=t.getParameter(t.ARRAY_BUFFER_BINDING);Qi=Jt.create(),Jt.bind(Qi),t.bindBuffer(t.ARRAY_BUFFER,Ds),jt>=0&&(t.enableVertexAttribArray(jt),t.vertexAttribPointer(jt,2,t.FLOAT,false,16,0)),qt>=0&&(t.enableVertexAttribArray(qt),t.vertexAttribPointer(qt,2,t.FLOAT,false,16,8)),Jt.bind(i),t.bindBuffer(t.ARRAY_BUFFER,r)}}function mc(t,e){return{index:e,buffer:t.getVertexAttrib(e,t.VERTEX_ATTRIB_ARRAY_BUFFER_BINDING),enabled:t.getVertexAttrib(e,t.VERTEX_ATTRIB_ARRAY_ENABLED),size:t.getVertexAttrib(e,t.VERTEX_ATTRIB_ARRAY_SIZE),type:t.getVertexAttrib(e,t.VERTEX_ATTRIB_ARRAY_TYPE),normalized:t.getVertexAttrib(e,t.VERTEX_ATTRIB_ARRAY_NORMALIZED),stride:t.getVertexAttrib(e,t.VERTEX_ATTRIB_ARRAY_STRIDE),offset:t.getVertexAttribOffset(e,t.VERTEX_ATTRIB_ARRAY_POINTER),currentValue:t.getVertexAttrib(e,t.CURRENT_VERTEX_ATTRIB)}}function gc(t,e){e.buffer&&(t.bindBuffer(t.ARRAY_BUFFER,e.buffer),t.vertexAttribPointer(e.index,e.size,e.type,e.normalized,e.stride,e.offset)),e.enabled?t.enableVertexAttribArray(e.index):t.disableVertexAttribArray(e.index),t.vertexAttrib4f(e.index,e.currentValue[0],e.currentValue[1],e.currentValue[2],e.currentValue[3])}function Ud(t,e,s){const i=t===yt;i&&_d(t);const r=i?pl(s.px,s.py,s.w,s.h,e.width,e.height):null;r&&Sd(r.w,r.h)?(Ns.clearRect(0,0,r.w,r.h),Ns.drawImage(e,r.x,r.y,r.w,r.h,0,0,r.w,r.h),Fs=r,fl=e.width,dl=e.height,Vt={buffer:s.buffer.canvas,dx:s.px-r.x,dy:s.py-r.y,dw:s.w,dh:s.h}):(Fs=null,Vt=null),gl(t),ml(t),yl(t,s.buffer.canvas,s.px,s.py,s.w,s.h),bl(t),Ha=Sr}function Md(t,e,s){if(Fd(t),!We||!Ds)return;const i=s.vertical?hl:ll;if(!i)return;const r=pl(s.px,s.py,s.w,s.h,e.width,e.height);r&&xd(t)?Ed(t,e,r):rs=null,kl(t,e,i,{x:s.px,y:s.py,w:s.w,h:s.h},true)}function kl(t,e,s,i,r){if(!We||!Ds)return;const a=e.width,o=e.height,c=i.x/a*2-1,l=1-(i.y+i.h)/o*2,h=(i.x+i.w)/a*2-1,d=1-i.y/o*2,m=!!(Jt&&Qi),_=t.getParameter(t.CURRENT_PROGRAM),x=t.getParameter(t.ACTIVE_TEXTURE);t.activeTexture(t.TEXTURE0);const E=t.getParameter(t.TEXTURE_BINDING_2D),N=t.getParameter(t.ARRAY_BUFFER_BINDING),F=t.getParameter(t.FRAMEBUFFER_BINDING),U=t,P=typeof U.createVertexArray=="function",X=P?t.getParameter(U.READ_FRAMEBUFFER_BINDING):null,$=t.getParameter(t.VIEWPORT),te=t.isEnabled(t.BLEND),ee=t.getParameter(t.BLEND_SRC_RGB),Q=t.getParameter(t.BLEND_DST_RGB),z=t.getParameter(t.BLEND_SRC_ALPHA),ne=t.getParameter(t.BLEND_DST_ALPHA),v=t.getParameter(t.BLEND_EQUATION_RGB),y=t.getParameter(t.BLEND_EQUATION_ALPHA),k=t.isEnabled(t.DEPTH_TEST),V=t.isEnabled(t.SCISSOR_TEST),G=t.isEnabled(t.STENCIL_TEST),B=t.isEnabled(t.CULL_FACE),R=t.getParameter(t.COLOR_WRITEMASK),O=t.getParameter(t.UNPACK_FLIP_Y_WEBGL),M=m?t.getParameter(xl):null,C=!m&&jt>=0?mc(t,jt):null,H=!m&&qt>=0?mc(t,qt):null;t.bindFramebuffer(t.FRAMEBUFFER,null),t.viewport(0,0,a,o),t.useProgram(We),r?(t.enable(t.BLEND),t.blendEquation(t.FUNC_ADD),t.blendFuncSeparate(t.SRC_ALPHA,t.ONE_MINUS_SRC_ALPHA,t.ONE,t.ONE_MINUS_SRC_ALPHA)):t.disable(t.BLEND),t.disable(t.DEPTH_TEST),t.disable(t.SCISSOR_TEST),t.disable(t.STENCIL_TEST),t.disable(t.CULL_FACE),t.colorMask(true,true,true,true),t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,0),t.bindTexture(t.TEXTURE_2D,s),t.uniform1i(t.getUniformLocation(We,"u_tex"),0),t.uniform1f(t.getUniformLocation(We,"u_alpha"),1);const W=new Float32Array([c,l,0,0,h,l,1,0,c,d,0,1,c,d,0,1,h,l,1,0,h,d,1,1]);m?(Jt.bind(Qi),t.bindBuffer(t.ARRAY_BUFFER,Ds),t.bufferData(t.ARRAY_BUFFER,W,t.DYNAMIC_DRAW)):(t.bindBuffer(t.ARRAY_BUFFER,Ds),t.bufferData(t.ARRAY_BUFFER,W,t.DYNAMIC_DRAW),jt>=0&&(t.enableVertexAttribArray(jt),t.vertexAttribPointer(jt,2,t.FLOAT,false,16,0)),qt>=0&&(t.enableVertexAttribArray(qt),t.vertexAttribPointer(qt,2,t.FLOAT,false,16,8))),t.drawArrays(t.TRIANGLES,0,6),m?Jt.bind(M):(H&&gc(t,H),C&&gc(t,C)),t.bindFramebuffer(t.FRAMEBUFFER,F),P&&U.bindFramebuffer(U.READ_FRAMEBUFFER,X),t.viewport($[0],$[1],$[2],$[3]),t.bindBuffer(t.ARRAY_BUFFER,N),t.colorMask(R[0],R[1],R[2],R[3]),t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,O?1:0),V?t.enable(t.SCISSOR_TEST):t.disable(t.SCISSOR_TEST),G?t.enable(t.STENCIL_TEST):t.disable(t.STENCIL_TEST),B?t.enable(t.CULL_FACE):t.disable(t.CULL_FACE),k?t.enable(t.DEPTH_TEST):t.disable(t.DEPTH_TEST),te?t.enable(t.BLEND):t.disable(t.BLEND),t.blendFuncSeparate(ee,Q,z,ne),t.blendEquationSeparate(v,y),t.activeTexture(t.TEXTURE0),t.bindTexture(t.TEXTURE_2D,E),t.activeTexture(x),t.useProgram(_)}class Wa{canvas=null;ctx=null;gl=null;contextAcquired=false;gpuCtx=null;gpuDevice=null;gpuFormat=null;gpuTextureAcquiredThisFrame=false;brCtx=null;brCleanScratch=null;brCleanCtx=null;brPresentScratch=null;brPresentCtx=null;isRunning=false;renderLoopPaused=false;rafScheduled=false;frameCount=0;lastTime=0;startTime=0;frameRateMode="full";frameSkipCounter=0;screenRefreshRate=60;debugMode=false;p5Adapter=null;shaderAdapter=null;rendererType="native";_isHeadless=false;_displayScale=1;sceneErrorReporter=null;controlPort=null;pendingCaptures=[];static CAPTURE_QUEUE_TTL_MS=1e4;setSceneErrorReporter(e){this.sceneErrorReporter=e}getSceneErrorReporter(){return this.sceneErrorReporter}setDebugMode(e){this.debugMode=e,this.videoSystems.forEach(s=>s?.setDebugMode(e)),this.parameterSystem&&"setDebugMode"in this.parameterSystem&&this.parameterSystem.setDebugMode(e),this.interactionSystem&&"setDebugMode"in this.interactionSystem&&this.interactionSystem.setDebugMode(e)}debugLog(e,...s){this.debugMode&&console.log(e,...s)}effectiveFrameTimes=[];lastEffectiveRateReport=0;effectiveRateReportInterval=1e3;fetchCacheClient;parameterSystem;interactionSystem;capabilityMonitor=new vf;benchmark=null;videoSystems=[];autoCaptureEnabled=false;autoCaptureFormat={flipY:true,frame:"plate"};audioFrequencyData=new Uint8Array(0);audioWaveformData=new Float32Array(0);deviceState={device:{motion:null,orientation:null},devices:[]};deviceVideoMap=new Map;audioStreamStates=new Map;deviceAudioMap=new Map;viji={canvas:null,ctx:null,gl:null,gpu:null,width:0,height:0,time:0,deltaTime:0,frameCount:0,fps:60,audio:{isConnected:false,volume:{current:0,peak:0,smoothed:0},bands:{low:0,lowMid:0,mid:0,highMid:0,high:0,lowSmoothed:0,lowMidSmoothed:0,midSmoothed:0,highMidSmoothed:0,highSmoothed:0},beat:{kick:0,snare:0,hat:0,any:0,kickSmoothed:0,snareSmoothed:0,hatSmoothed:0,anySmoothed:0,triggers:{any:false,kick:false,snare:false,hat:false},events:[],bpm:0,confidence:0,isLocked:false},spectral:{brightness:0,flatness:0},getFrequencyData:()=>new Uint8Array(0),getWaveform:()=>new Float32Array(0)},video:{isConnected:false,currentFrame:null,frameWidth:0,frameHeight:0,frameRate:0,getFrameData:()=>null,cv:null},videoStreams:[],audioStreams:[],mouse:{},keyboard:{},touches:{},device:{motion:null,orientation:null},devices:[],slider:(e,s)=>this.parameterSystem.createSliderParameter(e,s),color:(e,s)=>this.parameterSystem.createColorParameter(e,s),toggle:(e,s)=>this.parameterSystem.createToggleParameter(e,s),select:(e,s)=>this.parameterSystem.createSelectParameter(e,s),text:(e,s)=>this.parameterSystem.createTextParameter(e,s),number:(e,s)=>this.parameterSystem.createNumberParameter(e,s),image:(e,s)=>this.parameterSystem.createImageParameter(e,s),button:e=>this.parameterSystem.createButtonParameter(e),coordinate:(e,s)=>this.parameterSystem.createCoordinateParameter(e,s),gradient:(e,s)=>this.parameterSystem.createGradientParameter(e,s),useContext:e=>e==="webgpu"?this.canvas?this.canvas.getContext("webgpu"):null:e==="2d"?(!this.ctx&&this.canvas&&(this.ctx=this.canvas.getContext("2d"),this.viji.ctx=this.ctx),this.ctx):e==="webgl"||e==="webgl2"?(!this.gl&&this.canvas&&(this.gl=e==="webgl2"?this.canvas.getContext("webgl2"):this.canvas.getContext("webgl"),this.viji.gl=this.gl,this.gl&&this.gl.viewport(0,0,this.viji.width,this.viji.height)),this.gl):null};constructor(){this.fetchCacheClient=new nh((e,s)=>{this.postMessage(e,s)}),this.parameterSystem=new ff((e,s)=>{this.postMessage(e,s)}),this.interactionSystem=new df,this.videoSystems[0]=new Ti,this.videoSystems[0].setCVMessaging(0,(e,s)=>{this.postMessage("cv-feature-request",{streamIndex:e,desired:s})}),this.viji.video.cv=this.videoSystems[0].getCvSurface(),Object.assign(this.viji,this.interactionSystem.getInteractionAPIs()),this.viji.audio.getFrequencyData=()=>this.audioFrequencyData,this.viji.audio.getWaveform=()=>this.audioWaveformData,this.capabilityMonitor.setTransitionCallback(e=>{this.postMessage("capability-transition",e)}),this.setupMessageHandling()}setCapabilityUsageMask(e){this.capabilityMonitor.setUsageMask(e)}gatherCapabilityInput(e,s,i){const r=this.interactionSystem.getMouseState(),a=this.interactionSystem.getPointerState(),o=this.videoSystems[0]?this.videoSystems[0].getCVActivity():{faceDetection:{active:false,meaningful:false},faceMesh:{active:false,meaningful:false},emotion:{active:false,meaningful:false},handTracking:{active:false,meaningful:false},poseDetection:{active:false,meaningful:false},segmentation:{active:false,meaningful:false}};return{frameIndex:this.frameCount,timestamp:e,cpuMs:s,frameIntervalMs:i,audioConnected:this.viji.audio.isConnected,videoConnected:this.viji.video.isConnected,sensorsConnected:this.deviceState.device.motion!==null||this.deviceState.device.orientation!==null,devicesConnected:this.deviceState.devices.length>0,mouse:{isInCanvas:r.isInCanvas,leftButton:r.leftButton,rightButton:r.rightButton,middleButton:r.middleButton},pointer:{isDown:a.isDown,isInCanvas:a.isInCanvas,active:a.type!=="none"},touchCount:this.interactionSystem.getTouchCount(),keyboardConsumed:this.interactionSystem.getKeyboardConsumed(),cv:o}}recordCapabilityFrame(e,s,i){this.capabilityMonitor.recordFrame(this.gatherCapabilityInput(e,s,i))}getContextAndFinish(){const e=this.gl;return e&&e.finish(),e}detectContextType(){if(this.gpuCtx&&this.gpuDevice)return"webgpu";if(this.gl)return typeof WebGL2RenderingContext<"u"&&this.gl instanceof WebGL2RenderingContext?"webgl2":"webgl";if(this.ctx)return"2d"}trackWebGPUContext(e){if(this.gpuCtx===e)return;this.gpuCtx=e;const s=e.configure.bind(e),i=e.unconfigure.bind(e),r=e.getCurrentTexture.bind(e);e.configure=a=>{s(a);const o=this.gpuDevice!==a.device;this.gpuDevice=a.device,this.gpuFormat=a.format,Pd(),o&&a.device.lost.then(()=>{this.gpuDevice===a.device&&(this.gpuDevice=null,this.gpuFormat=null)}).catch(()=>{})},e.unconfigure=()=>{i(),this.gpuDevice=null,this.gpuFormat=null},e.getCurrentTexture=()=>(this.gpuTextureAcquiredThisFrame=true,r())}wrapBitmapRenderer(e){if(this.brCtx===e)return;this.brCtx=e;const s=e.transferFromImageBitmap.bind(e);e.transferFromImageBitmap=i=>{const r=ac("b",0);if(!i||r>=1||this._isHeadless){this.brCleanScratch=null,s(i);return}try{const a=i.width,o=i.height;if((!this.brCleanScratch||this.brCleanScratch.width!==a||this.brCleanScratch.height!==o)&&(this.brCleanScratch=new OffscreenCanvas(a,o),this.brCleanCtx=this.brCleanScratch.getContext("2d"),this.brPresentScratch=new OffscreenCanvas(a,o),this.brPresentCtx=this.brPresentScratch.getContext("2d")),!this.brCleanCtx||!this.brPresentCtx||!this.brPresentScratch){this.brCleanScratch=null,s(i);return}this.brCleanCtx.clearRect(0,0,a,o),this.brCleanCtx.drawImage(i,0,0),this.brPresentCtx.drawImage(i,0,0),hc(this.brPresentScratch,this.brPresentCtx,null,r,this._displayScale);const c=this.brPresentScratch.transferToImageBitmap();try{s(c)}catch(l){throw c.close(),l}i.close()}catch(a){this.debugLog("bitmaprenderer overlay composite failed",a),this.brCleanScratch=null;try{s(i)}catch{}}}}plateCaptureSource(e){return e!=="display"&&this.brCleanScratch?this.brCleanScratch:this.canvas}fence2dCanvas(){const e=this.ctx;if(!e)return null;try{const s=performance.now();return e.getImageData(0,0,1,1),performance.now()-s}catch{return null}}fenceWebGLReadback(e){try{e.readPixels(0,0,1,1,e.RGBA,e.UNSIGNED_BYTE,new Uint8Array(4))}catch{}}handleRunFencedBenchmark(e){const s=Math.max(1,Math.floor(e.data.frameCount));if(this.benchmark){this.postMessage("error",{id:e.id,message:"A fenced benchmark is already running",code:"BENCHMARK_BUSY"});return}this.benchmark={id:e.id,remaining:s,samples:[],lastTimestamp:null}}recordBenchmarkFrame(e,s){const i=this.benchmark;if(!i)return;const r=performance.now(),a=this.getContextAndFinish();a&&this.fenceWebGLReadback(a);const o=a?performance.now()-r:this.fence2dCanvas(),c=i.lastTimestamp===null?0:e-i.lastTimestamp;i.lastTimestamp=e;const l=this.capabilityMonitor.evaluate(this.gatherCapabilityInput(e,s,c));i.samples.push({frameIndex:this.frameCount,timestamp:e,cpuMs:s,gpuMs:o,frameIntervalMs:c,capabilities:l}),i.remaining--,i.remaining<=0&&(this.postMessage("run-fenced-benchmark-result",{id:i.id,frames:i.samples}),this.benchmark=null)}async initP5Mode(e,s,i){try{this.rendererType="p5",this.debugLog("🎨 Initializing P5.js mode..."),this.p5Adapter=new Df(this.canvas,this.viji,{setup:e,render:s,canvasMode:i?.canvasMode==="webgl"?"webgl":"2d"}),await this.p5Adapter.init(),this.debugLog("✅ P5.js mode initialized successfully")}catch(r){throw console.error("❌ Failed to initialize P5.js mode:",r),this.p5Adapter=null,r}}async initShaderMode(e,s){try{this.rendererType="shader",this.debugLog("🎨 Initializing Shader mode..."),this.shaderAdapter=new je(this.canvas,this.viji,e,s?.redactDriverInfoLogs??false),await this.shaderAdapter.init();const i=this.shaderAdapter.getParameterDefinitions();for(const r of i)this.registerShaderParameter(r);this.debugLog("✅ Shader mode initialized successfully")}catch(i){throw console.error("❌ Failed to initialize Shader mode:",i),this.shaderAdapter=null,this.videoSystems.forEach((r,a)=>{r&&As(a)==="directFrame"&&r.initializeForDirectFrames(this.directFrameConsumerType())}),i}}directFrameConsumerType(){return this.shaderAdapter&&this.rendererType==="shader"?"shader":"native"}registerShaderParameter(e){if(e.type==="accumulator")return;const s=e.config,i={...s,name:e.uniformName,label:e.label,description:s.description??""};switch(i.name!==e.uniformName&&(console.error(`[viji] Shader parameter identity mismatch for uniform "${e.uniformName}" — forcing name = uniformName.`),i.name=e.uniformName),e.type){case"slider":this.viji.slider(s.default,i);break;case"number":this.viji.number(s.default,i);break;case"color":this.viji.color(s.default,i);break;case"toggle":this.viji.toggle(s.default,i);break;case"select":this.viji.select(s.default,{...i,options:s.options});break;case"image":this.viji.image(null,i);break;case"button":this.viji.button(i);break;case"coordinate":{const r=Array.isArray(s.default)?s.default:[0,0];this.viji.coordinate({x:r[0],y:r[1]},i);break}case"gradient":this.viji.gradient(s.default,i);break;case"cv":{if(Object.keys(s).length===0)break;this.viji.toggle(s.default,i);break}}}resetParameterState(){this.parameterSystem.resetParameterState(),this.interactionSystem.resetInteractionState(),this.resetAudioState(),this.videoSystems.forEach(e=>e?.resetVideoState()),this.videoSystems[0]&&Object.assign(this.viji.video,this.videoSystems[0].getVideoAPI()),this.updateVijiVideoStreams()}updateVijiVideoStreams(){const e=[],s=[];this.videoSystems.forEach((r,a)=>{if(!r)return;const o=As(a);o==="additional"?e.push(r):o==="directFrame"&&s.push(r)});const i=[...e,...s].map(r=>r.getVideoAPI());this.viji.videoStreams.length=i.length;for(let r=0;r<i.length;r++)this.viji.videoStreams[r]=i[r];this.debugLogStreamTable()}lastStreamTableSignature="";debugLogStreamTable(){if(!this.debugMode)return;const e=[];this.videoSystems.forEach((i,r)=>{if(!i)return;const a=i.peekDebugState();e.push(`${r}:${As(r)}${a.isConnected?" connected":""}${a.hasFrame?" frame":""}`)});const s=`[${e.join(", ")}] → videoStreams(${this.viji.videoStreams.length})`;s!==this.lastStreamTableSignature&&(this.lastStreamTableSignature=s,this.debugLog(`[Streams] ${s}`))}updateVijiAudioStreams(){const e=[];for(const[s,i]of this.audioStreamStates)s>=_f&&s<Go&&e.push({index:s,...i});e.sort((s,i)=>s.index-i.index),this.viji.audioStreams.length=e.length;for(let s=0;s<e.length;s++){const i=e[s],r=i.frequencyData,a=i.waveformData;this.viji.audioStreams[s]={isConnected:i.isConnected,volume:i.volume,bands:i.bands,spectral:i.spectral,getFrequencyData:()=>r,getWaveform:()=>a}}}sendAllParametersToHost(){this.parameterSystem.sendAllParametersToHost()}seedInitialValues(e){this.parameterSystem.seedInitialValues(e)}releaseSeedBitmaps(e){this.parameterSystem.releaseSeedBitmaps(e)}setupMessageHandling(){self.onmessage=e=>{this.dispatchMessage(e.data)}}dispatchMessage(e){switch(e.type){case"init":this.handleInit(e).catch(s=>console.error("[Viji] handleInit failed:",s));break;case"frame-rate-update":this.handleFrameRateUpdate(e);break;case"refresh-rate-update":this.handleRefreshRateUpdate(e);break;case"cv-results-update":this.handleCVResultsUpdate(e);break;case"resolution-update":this.handleResolutionUpdate(e);break;case"set-scene-code":this.handleSetSceneCode(e);break;case"debug-mode":this.setDebugMode(e.data.enabled);break;case"parameter-update":this.handleParameterUpdate(e);break;case"parameter-batch-update":this.handleParameterBatchUpdate(e);break;case"audio-analysis-update":this.handleAudioAnalysisUpdate(e);break;case"audio-stream-setup":this.handleAudioStreamSetup(e);break;case"video-canvas-setup":this.handleVideoCanvasSetup(e);break;case"video-frame-update":this.handleVideoFrameUpdate(e);break;case"video-config-update":this.handleVideoConfigUpdate(e);break;case"video-streams-prepare":this.handleVideoStreamsPrepare(e);break;case"video-frame-direct":this.handleVideoFrameDirect(e);break;case"enable-auto-capture":this.autoCaptureEnabled=e.data.enabled,e.data.flipY!==void 0&&(this.autoCaptureFormat.flipY=e.data.flipY),e.data.frame!==void 0&&(this.autoCaptureFormat.frame=e.data.frame==="display"?"display":"plate"),this.debugLog(`[AutoCapture] ${e.data.enabled?"ENABLED":"DISABLED"} (flipY=${this.autoCaptureFormat.flipY}, frame=${this.autoCaptureFormat.frame})`);break;case"enable-capability-reporting":this.capabilityMonitor.setEnabled(e.data.enabled);break;case"set-render-loop-paused":this.setRenderLoopPaused(e.data.paused);break;case"run-fenced-benchmark":this.handleRunFencedBenchmark(e);break;case"mouse-update":this.handleMouseUpdate(e);break;case"keyboard-update":this.handleKeyboardUpdate(e);break;case"touch-update":this.handleTouchUpdate(e);break;case"interaction-enabled":this.handleInteractionEnabled(e);break;case"device-state-update":this.handleDeviceStateUpdate(e);break;case"performance-update":this.handlePerformanceUpdate(e);break;case"capture-frame":this.handleCaptureFrame(e);break;case"sc-update":nc(e.data.t);break;case"rh-update":lc(e.data.h);break;case"cached-fetch-begin":this.fetchCacheClient.handleBegin(e.data);break;case"cached-fetch-chunk":this.fetchCacheClient.handleChunk(e.data);break;case"cached-fetch-end":this.fetchCacheClient.handleEnd(e.data);break;case"cached-fetch-direct":this.fetchCacheClient.handleDirect(e.data);break;case"cached-fetch-wait":this.fetchCacheClient.handleWait(e.data);break;case"cached-fetch-error":this.fetchCacheClient.handleError(e.data);break}}async handleInit(e){try{this.canvas=e.data.canvas,this.viji.canvas=this.canvas,this._isHeadless=!!e.data.isHeadless,e.data.reporterConfig&&this.sceneErrorReporter&&this.sceneErrorReporter.applyConfig(e.data.reporterConfig);const s=this.canvas.getContext.bind(this.canvas);this.canvas.getContext=(i,r)=>{const a=s(i,r);return a&&(this.contextAcquired=true,i==="2d"?(this.ctx=a,this.viji.ctx=this.ctx,yd(this.ctx)):i==="webgl"||i==="webgl2"?(this.gl=a,this.viji.gl=this.gl):i==="webgpu"?(this.trackWebGPUContext(a),this.viji.gpu=a):i==="bitmaprenderer"&&this.wrapBitmapRenderer(a)),a},this.viji.width=this.canvas.width,this.viji.height=this.canvas.height,await dd(),e.data.sc&&await nc(e.data.sc),Id(this.canvas),e.data.rh!==void 0&&lc(e.data.rh),e.data.controlPort&&(this.controlPort=e.data.controlPort,this.controlPort.onmessage=i=>{this.dispatchMessage(i.data)}),this.startRenderLoop(),self.postMessage({type:"init-response",id:e.id,timestamp:Date.now(),data:{id:e.id}})}catch(s){this.postMessage("error",{id:e.id,message:s.message,code:"INIT_ERROR"})}}handleFrameRateUpdate(e){e.data&&e.data.mode&&(this.frameRateMode=e.data.mode,this.frameSkipCounter=0,this.debugLog("Frame rate mode updated to:",e.data.mode))}getFrameRateDivisor(){switch(this.frameRateMode){case"full":return 1;case"half":return 2;case"quarter":return 4;case"eighth":return 8;default:return 1}}handleRefreshRateUpdate(e){e.data&&e.data.screenRefreshRate&&(this.screenRefreshRate=e.data.screenRefreshRate,this.debugLog("Screen refresh rate updated to:",e.data.screenRefreshRate+"Hz"))}trackEffectiveFrameTime(e){this.effectiveFrameTimes.push(e),this.effectiveFrameTimes.length>60&&this.effectiveFrameTimes.shift()}reportPerformanceStats(e){if(e-this.lastEffectiveRateReport>=this.effectiveRateReportInterval){if(this.effectiveFrameTimes.length>=2){const s=this.effectiveFrameTimes[this.effectiveFrameTimes.length-1]-this.effectiveFrameTimes[0],i=this.effectiveFrameTimes.length-1,r=Math.round(i/s*1e3),a=this.capabilityMonitor.flush();this.postMessage("performance-update",{effectiveRefreshRate:r,frameRateMode:this.frameRateMode,screenRefreshRate:this.screenRefreshRate,contextType:this.detectContextType(),...a&&{frames:a.frames,timing:a.timing,capabilities:a.capabilities}})}this.lastEffectiveRateReport=e}}handleResolutionUpdate(e){if(e.data){const s=Math.round(e.data.effectiveWidth),i=Math.round(e.data.effectiveHeight);(this.viji.width!==s||this.viji.height!==i||this.canvas!==null&&(this.canvas.width!==s||this.canvas.height!==i))&&(this.canvas&&(this.canvas.width=s,this.canvas.height=i,la()),this.gl&&this.gl.viewport(0,0,s,i),this.p5Adapter&&this.rendererType==="p5"&&this.p5Adapter.resize(s,i),this.shaderAdapter&&this.rendererType==="shader"&&this.shaderAdapter.resize(s,i)),this.viji.width=s,this.viji.height=i,this._displayScale=e.data.displayScale??1,this.debugLog("Canvas resolution updated to:",this.viji.width+"x"+this.viji.height)}}handleParameterUpdate(e){e.data&&e.data.name!==void 0&&e.data.value!==void 0&&(this.parameterSystem.updateParameterValue(e.data.name,e.data.value)||this.parameterSystem.releaseUnappliedValue(e.data.name,e.data.value))}handleParameterBatchUpdate(e){if(e.data&&e.data.updates)for(const s of e.data.updates)this.parameterSystem.updateParameterValue(s.name,s.value)||this.parameterSystem.releaseUnappliedValue(s.name,s.value)}handleCVResultsUpdate(e){const s=this.videoSystems[e.data.streamIndex];if(s)s.handleCVResultsUpdate(e.data);else if(e.data.analysedFrame)try{e.data.analysedFrame.close()}catch{}}handleAudioAnalysisUpdate(e){const s=e.data,i=s.streamIndex??0;i===0?this.handleMainAudioUpdate(s):this.handleAdditionalAudioUpdate(i,s)}handleMainAudioUpdate(e){const s=this.viji.audio;if(s.isConnected=e.isConnected,s.volume.current=e.volume.current,s.volume.peak=e.volume.peak,s.volume.smoothed=e.volume.smoothed,s.bands.low=e.bands.low,s.bands.lowMid=e.bands.lowMid,s.bands.mid=e.bands.mid,s.bands.highMid=e.bands.highMid,s.bands.high=e.bands.high,s.bands.lowSmoothed=e.bands.lowSmoothed,s.bands.lowMidSmoothed=e.bands.lowMidSmoothed,s.bands.midSmoothed=e.bands.midSmoothed,s.bands.highMidSmoothed=e.bands.highMidSmoothed,s.bands.highSmoothed=e.bands.highSmoothed,e.beat){s.beat.kick=e.beat.kick,s.beat.snare=e.beat.snare,s.beat.hat=e.beat.hat,s.beat.any=e.beat.any,s.beat.kickSmoothed=e.beat.kickSmoothed,s.beat.snareSmoothed=e.beat.snareSmoothed,s.beat.hatSmoothed=e.beat.hatSmoothed,s.beat.anySmoothed=e.beat.anySmoothed;const i=e.beat.events||[];i.length>0&&(s.beat.triggers.kick=s.beat.triggers.kick||i.some(r=>r.type==="kick"),s.beat.triggers.snare=s.beat.triggers.snare||i.some(r=>r.type==="snare"),s.beat.triggers.hat=s.beat.triggers.hat||i.some(r=>r.type==="hat"),s.beat.triggers.any=true,s.beat.events.push(...i)),s.beat.bpm=e.beat.bpm,s.beat.confidence=e.beat.confidence,s.beat.isLocked=e.beat.isLocked}s.spectral.brightness=e.spectral.brightness,s.spectral.flatness=e.spectral.flatness,this.audioFrequencyData=new Uint8Array(e.frequencyData),this.audioWaveformData=e.waveformData?new Float32Array(e.waveformData):new Float32Array(0)}handleAdditionalAudioUpdate(e,s){const i=new Uint8Array(s.frequencyData),r=s.waveformData?new Float32Array(s.waveformData):new Float32Array(0),a=this.audioStreamStates.get(e);a?(a.isConnected=s.isConnected,Object.assign(a.volume,s.volume),Object.assign(a.bands,s.bands),Object.assign(a.spectral,s.spectral),a.frequencyData=i,a.waveformData=r):this.audioStreamStates.set(e,{isConnected:s.isConnected,volume:{...s.volume},bands:{...s.bands},spectral:{...s.spectral},frequencyData:i,waveformData:r}),this.updateVijiAudioStreams(),e>=Go&&this.wireDeviceAudio(e)}wireDeviceAudio(e){const s=this.audioStreamStates.get(e);if(!s)return;let i;for(const[a,o]of this.deviceAudioMap)if(o===e){i=a;break}if(!i)return;const r=this.viji.devices.find(a=>a.id===i);r&&(r.audio?r.audio.isConnected=s.isConnected:r.audio={isConnected:s.isConnected,volume:s.volume,bands:s.bands,spectral:s.spectral,getFrequencyData:()=>s.frequencyData,getWaveform:()=>s.waveformData})}handleAudioStreamSetup(e){const{streamIndex:s,streamType:i,deviceId:r}=e.data;switch(i){case"additional":this.updateVijiAudioStreams();break;case"device":r&&(this.deviceAudioMap.set(r,s),this.wireDeviceAudio(s));break}this.debugLog(`Audio stream setup at index ${s}, type: ${i}${r?`, deviceId: ${r}`:""}`)}resetAudioFrameEvents(){const e=this.viji.audio.beat.triggers;e.kick=false,e.snare=false,e.hat=false,e.any=false,this.viji.audio.beat.events.length=0}resetAudioState(){const e=this.viji.audio;e.isConnected=false,e.volume.current=0,e.volume.peak=0,e.volume.smoothed=0,e.bands.low=0,e.bands.lowMid=0,e.bands.mid=0,e.bands.highMid=0,e.bands.high=0,e.bands.lowSmoothed=0,e.bands.lowMidSmoothed=0,e.bands.midSmoothed=0,e.bands.highMidSmoothed=0,e.bands.highSmoothed=0,e.beat.kick=0,e.beat.snare=0,e.beat.hat=0,e.beat.any=0,e.beat.kickSmoothed=0,e.beat.snareSmoothed=0,e.beat.hatSmoothed=0,e.beat.anySmoothed=0,e.beat.triggers.kick=false,e.beat.triggers.snare=false,e.beat.triggers.hat=false,e.beat.triggers.any=false,e.beat.events.length=0,e.beat.bpm=0,e.beat.confidence=0,e.beat.isLocked=false,e.spectral.brightness=0,e.spectral.flatness=0,this.audioFrequencyData=new Uint8Array(0),this.audioWaveformData=new Float32Array(0),this.audioStreamStates.clear(),this.deviceAudioMap.clear(),this.viji.audioStreams.length=0}handleVideoCanvasSetup(e){const{streamIndex:s,deviceId:i}=e.data,r=s||0,a=As(r);let o=this.videoSystems[r];const c=!!o;switch(o||(o=new Ti,o.setDebugMode(this.debugMode),o.setCVMessaging(r,(l,h)=>{this.postMessage("cv-feature-request",{streamIndex:l,desired:h})}),this.videoSystems[r]=o),o.setDeviceId(i),o.handleCanvasSetup({offscreenCanvas:e.data.offscreenCanvas,width:e.data.width,height:e.data.height,timestamp:e.data.timestamp}),this.debugLog(`Video system ${c?"reused":"created"} at index ${r}, role: ${a}${i?`, deviceId: ${i}`:""}`),a){case"main":Object.assign(this.viji.video,o.getVideoAPI());break;case"additional":this.updateVijiVideoStreams();break;case"device":if(i){this.deviceVideoMap.set(i,r);const l=this.viji.devices.find(h=>h.id===i);l&&(l.video?Object.assign(l.video,o.getVideoAPI()):l.video=o.getVideoAPI())}break}}handleVideoFrameUpdate(e){const s=e.data.streamIndex||0,i=this.videoSystems[s];if(i){i.handleFrameUpdate({imageBitmap:e.data.imageBitmap,timestamp:e.data.timestamp});const r=As(s);if(r==="main")Object.assign(this.viji.video,i.getVideoAPI());else if(r==="device"){const a=i.getDeviceId();if(a){const o=this.viji.devices.find(c=>c.id===a);o&&(o.video?Object.assign(o.video,i.getVideoAPI()):o.video=i.getVideoAPI())}}}}handleVideoConfigUpdate(e){const s=e.data.streamIndex||0,i=this.videoSystems[s];if(i){const r=As(s),a=i.getDeviceId();if(e.data.disconnect&&r==="device"&&a){this.deviceVideoMap.delete(a);const o=this.viji.devices.find(c=>c.id===a);o&&(o.video=null)}if(i.handleVideoConfigUpdate({...e.data.targetFrameRate&&{targetFrameRate:e.data.targetFrameRate},...e.data.cvConfig&&{cvConfig:e.data.cvConfig},...e.data.width&&{width:e.data.width},...e.data.height&&{height:e.data.height},...e.data.disconnect&&{disconnect:e.data.disconnect},timestamp:e.data.timestamp}),r==="main")Object.assign(this.viji.video,i.getVideoAPI());else if(r==="device"&&a&&!e.data.disconnect){const o=this.viji.devices.find(c=>c.id===a);o&&(o.video?Object.assign(o.video,i.getVideoAPI()):o.video=i.getVideoAPI())}}}handleVideoStreamsPrepare(e){const{directFrameBaseIndex:s,directFrameCount:i}=e.data;this.debugLog(`[Compositor] Preparing ${i} direct frame slot(s) at base index ${s}`);for(let r=0;r<i;r++){const a=s+r;this.videoSystems[a]||(this.videoSystems[a]=new Ti),this.videoSystems[a].setDebugMode(this.debugMode),this.videoSystems[a].initializeForDirectFrames(this.directFrameConsumerType())}this.updateVijiVideoStreams(),this.debugLog(`[Compositor] Prepared ${i} direct frame slot(s)`)}handleVideoFrameDirect(e){const s=e.data.streamIndex||0;this.videoSystems[s]||(this.debugLog(`[Compositor] Creating new VideoSystem at index ${s} for direct frames`),this.videoSystems[s]=new Ti,this.videoSystems[s].setDebugMode(this.debugMode),this.videoSystems[s].initializeForDirectFrames(this.directFrameConsumerType())),this.videoSystems[s].handleDirectFrame(e.data)}handlePerformanceUpdate(e){this.debugLog("Performance update:",e.data)}async handleCaptureFrame(e){this.pendingCaptures.push({queuedAt:performance.now(),message:e}),this.debugLog(`Capture queued: ${e.data.format||"blob"} (${this.pendingCaptures.length} pending)`)}async executeCaptureFrame(e){try{if(!this.canvas)throw new Error("Canvas not initialized");if((e.data.format||"blob")==="bitmap"){const $=this.plateCaptureSource(e.data.frame),te=$===this.canvas?$.transferToImageBitmap():await createImageBitmap($);this.postMessage("capture-frame-result",{id:e.id,bitmap:te},[te]);return}const i=e.data.type||"image/png",r=this.canvas.width,a=this.canvas.height;let o=r,c=a;if(typeof e.data.resolution=="number"){const $=e.data.resolution>0?e.data.resolution:1;o=Math.max(1,Math.floor(r*$)),c=Math.max(1,Math.floor(a*$))}else e.data.resolution&&typeof e.data.resolution=="object"&&(o=Math.max(1,Math.floor(e.data.resolution.width)),c=Math.max(1,Math.floor(e.data.resolution.height)));const l=r/a,h=o/c;let d=0,m=0,_=r,x=a;Math.abs(l-h)>1e-6&&(h>l?(x=Math.floor(r/h),m=Math.floor((a-x)/2)):(_=Math.floor(a*h),d=Math.floor((r-_)/2))),this.getContextAndFinish();const E=this.plateCaptureSource(e.data.frame);this.debugLog("Captured frame from canvas directly (post-render)");const N=new OffscreenCanvas(o,c),F=N.getContext("2d");if(!F)throw new Error("Failed to get 2D context");F.drawImage(E,d,m,_,x,0,0,o,c);const U=e.data.quality,P=typeof U=="number"&&Number.isFinite(U)?Math.min(1,Math.max(0,U)):void 0,X=await N.convertToBlob(P!==void 0?{type:i,quality:P}:{type:i});this.postMessage("capture-frame-result",{id:e.id,blob:X})}catch(s){this.postMessage("error",{id:e.id,message:s.message,code:"CAPTURE_FRAME_ERROR"})}}handleSetSceneCode(e){let s=false;const i={resolve:c=>{s||(s=true,this.postMessage("scene-analysis",{id:e.id,...c}))},reject:c=>{s||(s=true,this.postMessage("error",{id:e.id,...c}))}},r=e.data?.sceneCode;if(typeof r!="string"){i.reject({message:"set-scene-code carried no scene code",code:"SCENE_ANALYSIS_ERROR"});return}const a={...e.data?.initialParameters&&{initialParameters:e.data.initialParameters},...e.data?.sk&&{keyComponent:e.data.sk}},o=self.setSceneCode;o(r,a,i).catch(c=>{const l=c;i.reject({message:`Scene load failed before analysis ack: ${l?.message??String(c)}`,code:"SCENE_ANALYSIS_ERROR"})})}startRenderLoop(){this.isRunning=true,this.startTime=performance.now(),this.lastTime=this.startTime,this.renderFrame()}runCaptures(e){for(const{message:s}of e)this.executeCaptureFrame(s).catch(i=>{console.error("Capture execution error:",i)})}runAutoCapture(){if(!(!this.autoCaptureEnabled||!this.canvas))try{const e=this.autoCaptureFormat.flipY?{imageOrientation:"flipY"}:{};createImageBitmap(this.plateCaptureSource(this.autoCaptureFormat.frame),e).then(s=>{this.postMessage("auto-capture-result",{bitmap:s,timestamp:performance.now()},[s])}).catch(s=>{console.warn("[AutoCapture] ImageBitmap creation failed:",s)})}catch(e){console.warn("[AutoCapture] Failed:",e)}}renderFrame(){if(!this.isRunning)return;this.gpuTextureAcquiredThisFrame=false;const e=performance.now();this.updateVijiVideoStreams(),this.updateVijiAudioStreams();const s=this.getFrameRateDivisor();this.viji.fps=this.screenRefreshRate/s;const i=this.frameSkipCounter%s===0;if(this.frameSkipCounter++,i){const r=e-this.lastTime;this.viji.deltaTime=(e-this.lastTime)/1e3,this.viji.time=(e-this.startTime)/1e3,this.viji.frameCount=++this.frameCount,this.trackEffectiveFrameTime(e),this.lastTime=e,this.interactionSystem.updatePointerState(),!this._isHeadless&&this.canvas&&kd(this.canvas,this.ctx,this.gl);const a=performance.now();let o=false;try{if(this.shaderAdapter&&this.rendererType==="shader"){const d=this.parameterSystem.getAllParameterObjects();o=this.shaderAdapter.render(this.viji,d)}else if(this.p5Adapter&&this.rendererType==="p5"){const d=this.parameterSystem.getAllParameterObjects();o=this.p5Adapter.tick(this.viji,d)}else{const d=self.renderFunction;d&&typeof d=="function"&&(d(this.viji),o=true)}}catch(d){const m=d;console.error("Render error:",m),this.sceneErrorReporter?this.sceneErrorReporter.reportSceneError({message:m.message,...m.stack!==void 0&&{stack:m.stack},code:"RENDER_ERROR"}):this.postMessage("error",{message:m.message,code:"RENDER_ERROR",stack:m.stack})}const c=o&&this.contextAcquired;if(c&&this.sceneErrorReporter&&this.sceneErrorReporter.markFirstFrameProduced(),this.benchmark){const d=performance.now()-a;this.recordBenchmarkFrame(e,d)}else if(this.capabilityMonitor.isEnabled()){const d=performance.now()-a;this.recordCapabilityFrame(e,d,r)}if(this.parameterSystem.resetButtonParameters(),this.pendingCaptures.length>0){const d=performance.now()-Wa.CAPTURE_QUEUE_TTL_MS;this.pendingCaptures=this.pendingCaptures.filter(m=>m.queuedAt>=d)}let l=[],h=[];if(c){const d=this.pendingCaptures;this.pendingCaptures=[],h=d.filter(m=>m.message.data.frame==="display"),l=d.filter(m=>m.message.data.frame!=="display")}if(this.runCaptures(l),c&&this.autoCaptureFormat.frame!=="display"&&this.runAutoCapture(),!this._isHeadless&&this.canvas){const d=ac("b",0);hc(this.canvas,this.ctx,this.gl,d,this._displayScale),c&&this.gpuTextureAcquiredThisFrame&&this.gpuCtx&&this.gpuDevice&&this.gpuFormat&&Dd(this.gpuCtx,this.gpuDevice,this.gpuFormat,this.canvas,d,this._displayScale)}this.runCaptures(h),c&&this.autoCaptureFormat.frame==="display"&&this.runAutoCapture()}this.benchmark||this.reportPerformanceStats(e),this.interactionSystem.frameStart(),this.resetAudioFrameEvents(),this.scheduleNextFrame()}scheduleNextFrame(){this.rafScheduled||!this.isRunning||(this.rafScheduled=true,requestAnimationFrame(()=>{this.rafScheduled=false,this.renderFrame()}))}setRenderLoopPaused(e){e!==this.renderLoopPaused&&(this.renderLoopPaused=e,e?this.isRunning=false:(this.isRunning=true,this.scheduleNextFrame()))}postMessage(e,s,i){const r={type:e,id:s?.id||`${e}_${Date.now()}`,timestamp:Date.now(),data:s};this.controlPort?this.controlPort.postMessage(r,i??[]):self.postMessage(r,i??[])}handleMouseUpdate(e){this.interactionSystem.handleMouseUpdate(e.data)}handleKeyboardUpdate(e){this.interactionSystem.handleKeyboardUpdate(e.data)}handleTouchUpdate(e){this.interactionSystem.handleTouchUpdate(e.data)}handleInteractionEnabled(e){this.interactionSystem.setInteractionEnabled(e.data.enabled)}handleDeviceStateUpdate(e){this.deviceState=e.data,this.viji.device=this.deviceState.device;const s=this.deviceState.devices.map(i=>{const r=this.viji.devices.find(d=>d.id===i.id),a=this.deviceVideoMap.get(i.id),o=a!==void 0?this.videoSystems[a]:void 0,c=this.deviceAudioMap.get(i.id),l=c!==void 0?this.audioStreamStates.get(c):void 0,h=l?{isConnected:l.isConnected,volume:l.volume,bands:l.bands,spectral:l.spectral,getFrequencyData:()=>l.frequencyData,getWaveform:()=>l.waveformData}:null;return r?(r.name=i.name,r.motion=i.motion,r.orientation=i.orientation,h&&(r.audio=h),r):{...i,video:o?o.getVideoAPI():null,audio:h}});this.viji.devices=s}}class Qs{static detectRendererType(e){return/\/\/\s*@renderer\s+shader|\/\*\s*@renderer\s+shader\s*\*\//.test(e)?"shader":/\/\/\s*@renderer\s+p5|\/\*\s*@renderer\s+p5\s*\*\//.test(e)?"p5":"native"}static detectP5CanvasMode(e){return/\/\/\s*@renderer\s+p5\s+webgl\b|\/\*\s*@renderer\s+p5\s+webgl\s*\*\//i.test(e)?"webgl":"2d"}static detectCapabilities(e,s){const i=this.stripCommentsAndStrings(e),r={audio:false,video:false,mouse:false,keyboard:false,pointer:false,touch:false,parameters:false,sensors:false,devices:false,cv:{faceDetection:false,faceMesh:false,emotion:false,handTracking:false,poseDetection:false,segmentation:false}};return s==="shader"?this.detectShaderCapabilities(i,r):this.detectScriptCapabilities(i,r),r}static stripCommentsAndStrings(e){let s="";const i=e.length;let r=0;for(;r<i;){const a=e[r],o=r+1<i?e[r+1]:"";if(a==="/"&&o==="/"){for(r+=2;r<i&&e[r]!==`
472
- `;)r++;continue}if(a==="/"&&o==="*"){for(r+=2;r<i&&!(e[r]==="*"&&e[r+1]==="/");)r++;r+=2,s+=" ";continue}if(a==='"'||a==="'"||a==="`"){const c=a;for(r++;r<i;){if(e[r]==="\\"){r+=2;continue}if(e[r]===c){r++;break}r++}s+=" ";continue}s+=a,r++}return s}static detectShaderCapabilities(e,s){/\bu_audio\w*/.test(e)&&(s.audio=true),/\bu_video\w*/.test(e)&&(s.video=true),/\bu_mouse\w*/.test(e)&&(s.mouse=true),/\bu_key\w*/.test(e)&&(s.keyboard=true),/\bu_touch\w*/.test(e)&&(s.touch=true),/\bu_pointer\w*/.test(e)&&(s.pointer=true),/\bu_device(Acceleration|AccelerationGravity|RotationRate|OrientationAbsolute|Orientation)\b/.test(e)&&(s.sensors=true),/\bu_device[0-7](AccelerationGravity|Acceleration|RotationRate|Orientation)\b/.test(e)&&(s.sensors=true,s.devices=true),/\bu_externalDeviceCount\b/.test(e)&&(s.devices=true,s.sensors=true),(/\bu_deviceCount\b/.test(e)||/\bu_device[0-7](Resolution|Connected)?\b/.test(e))&&(s.video=true,s.devices=true),/\bu_face\w*/.test(e)&&(s.cv.faceDetection=true),/\bu_face0(Neutral|Happy|Sad|Angry|Surprised|Disgusted|Fearful)\b/.test(e)&&(s.cv.emotion=true),(/\bu_face0HeadPose\b/.test(e)||/\bu_videoAnalysed\w*/.test(e)||/\bu_face0(Brow|Cheek|Eye|Jaw|Mouth|Nose|Tongue)\w*/.test(e))&&(s.cv.faceMesh=true),(/\bu_handCount\b/.test(e)||/\bu_(left|right)Hand\w*/.test(e))&&(s.cv.handTracking=true),(/\bu_pose\w*/.test(e)||/\bu_(nose|leftShoulder|rightShoulder|leftElbow|rightElbow|leftWrist|rightWrist|leftHip|rightHip|leftKnee|rightKnee|leftAnkle|rightAnkle)Position\b/.test(e))&&(s.cv.poseDetection=true),/\bu_segmentation\w*/.test(e)&&(s.cv.segmentation=true)}static detectScriptCapabilities(e,s){/\bviji\.audio/.test(e)&&(s.audio=true),/\bviji\.video/.test(e)&&(s.video=true),/\bviji\.mouse/.test(e)&&(s.mouse=true),/\bviji\.keyboard/.test(e)&&(s.keyboard=true),/\bviji\.touches/.test(e)&&(s.touch=true),/\bviji\.pointer/.test(e)&&(s.pointer=true),/\bviji\.device\b/.test(e)&&(s.sensors=true),/\bviji\.devices/.test(e)&&(s.devices=true),/\bviji\.(slider|color|toggle|select|text|number|image|button|coordinate|gradient)\s*\(/.test(e)&&(s.parameters=true),/\benableFaceDetection\b/.test(e)&&(s.cv.faceDetection=true),/\benableFaceMesh\b/.test(e)&&(s.cv.faceMesh=true),/\benableEmotionDetection\b/.test(e)&&(s.cv.emotion=true),/\benableHandTracking\b/.test(e)&&(s.cv.handTracking=true),/\benablePoseDetection\b/.test(e)&&(s.cv.poseDetection=true),/\benableBodySegmentation\b/.test(e)&&(s.cv.segmentation=true)}static detectAnalysedFrameUse(e){const s=this.stripCommentsAndStrings(e);return/\b(analysedFrame|getAnalysedFrameData)\b/.test(s)||/\bu_videoAnalysed\w*/.test(s)}static detectUsage(e,s){const i=this.stripCommentsAndStrings(e),r={mouse:{position:false,left:false,right:false,middle:false},pointer:{position:false,down:false},touch:false};return s==="shader"?(r.mouse.position=/\bu_mouse(\b|InCanvas|Delta|Wheel)/.test(i),r.mouse.left=/\bu_mouse(Left|Pressed|WasPressed|WasReleased)\b/.test(i),r.mouse.right=/\bu_mouseRight\b/.test(i),r.mouse.middle=/\bu_mouseMiddle\b/.test(i),r.pointer.position=/\bu_pointer(\b|Delta|InCanvas)/.test(i),r.pointer.down=/\bu_pointer(Down|WasPressed|WasReleased)\b/.test(i),r.touch=/\bu_touch/.test(i)):(r.mouse.position=/\bmouse\.(x|y|deltaX|deltaY|wheelDelta|wheelX|wheelY|wasMoved)\b/.test(i),r.mouse.left=/\bmouse\.(leftButton|isPressed|wasPressed|wasReleased)\b/.test(i),r.mouse.right=/\bmouse\.rightButton\b/.test(i),r.mouse.middle=/\bmouse\.middleButton\b/.test(i),r.pointer.position=/\bpointer\.(x|y|deltaX|deltaY)\b/.test(i),r.pointer.down=/\bpointer\.(isDown|wasPressed|wasReleased)\b/.test(i),r.touch=/\btouches\./.test(i)),r}}function Bd(t){const e=Qs.detectRendererType(t),s=e==="p5"?Qs.detectP5CanvasMode(t):void 0;return{renderer:e,...s!==void 0&&{p5CanvasMode:s},capabilities:Qs.detectCapabilities(t,e),consumesAnalysedFrame:Qs.detectAnalysedFrameUse(t)}}const Xa=5,Od=(1<<Xa)-1,Vd=1<<Xa,$d=(()=>{const t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",e=new Int8Array(128).fill(-1);for(let s=0;s<t.length;s++)e[t.charCodeAt(s)]=s;return e})();function Xs(t,e){let s=0,i=0,r;do{if(e.index>=t.length)throw new Error("VLQ decode: unexpected end of input");const o=t.charCodeAt(e.index++),c=o<128?$d[o]:-1;if(c<0)throw new Error(`VLQ decode: invalid base64 character '${t[e.index-1]}'`);r=c&Vd,s+=(c&Od)<<i,i+=Xa}while(r);const a=s&1;return s>>>=1,a?-s:s}function jd(t,e){const s=[];if(t.length===0)return s;let i=0;const r=t.split(",");for(const a of r){if(a.length===0)continue;const o={index:0};i+=Xs(a,o);const c={generatedColumn:i};o.index<a.length&&(e.sourceIndex+=Xs(a,o),e.sourceLine+=Xs(a,o),e.sourceColumn+=Xs(a,o),c.sourceLine=e.sourceLine,c.sourceColumn=e.sourceColumn,o.index<a.length&&(e.nameIndex+=Xs(a,o))),s.push(c)}return s}function qd(t){const e=t.split(";"),s=[],i={sourceIndex:0,sourceLine:0,sourceColumn:0,nameIndex:0};for(const r of e){const a=jd(r,i);s.push(a)}return{lines:s}}function Hd(t,e,s){if(e<1||e>t.lines.length)return null;const i=t.lines[e-1];if(i.length===0)return null;const r=s-1;let a=0,o=i.length-1,c=-1;for(;a<=o;){const h=a+o>>>1;i[h].generatedColumn<=r?(c=h,a=h+1):o=h-1}if(c<0)return null;const l=i[c];return l.sourceLine===void 0||l.sourceColumn===void 0?null:{line:l.sourceLine+1,column:l.sourceColumn+1}}const Gd={errorCoalescingWindowMs:1e3,consoleCoalescingWindowMs:1e3,consoleArgMaxBytes:512,consoleMaxArgsPerCall:8,consoleMaxUniqueSignaturesPerSecond:32},bc=8192,Wd=`
473
- ...[stack truncated by viji core]`;class Xd{config;post;errorChannel;consoleChannel;rateCapWindowMs=1e3;rateCapWindowStart=0;rateCapSignaturesInWindow=0;rateCapSuppressionFiredInWindow=false;functionBodyLineOffset=0;functionBodySourceId="<anonymous>";stackDialect="unknown";currentSourceMap=null;hasProducedFirstFrame=false;envelopeSeq=0;constructor(e,s={}){this.config={...Gd,...s},this.post=e,this.errorChannel=new yc(this.config.errorCoalescingWindowMs,i=>this.postEnvelope("scene-error",i)),this.consoleChannel=new yc(this.config.consoleCoalescingWindowMs,i=>this.postEnvelope("scene-console",i)),this.detectFunctionBodyOffset()}applyConfig(e){e.errorCoalescingWindowMs!==void 0&&(this.config.errorCoalescingWindowMs=e.errorCoalescingWindowMs,this.errorChannel.setWindowMs(e.errorCoalescingWindowMs)),e.consoleCoalescingWindowMs!==void 0&&(this.config.consoleCoalescingWindowMs=e.consoleCoalescingWindowMs,this.consoleChannel.setWindowMs(e.consoleCoalescingWindowMs)),e.consoleArgMaxBytes!==void 0&&(this.config.consoleArgMaxBytes=e.consoleArgMaxBytes),e.consoleMaxArgsPerCall!==void 0&&(this.config.consoleMaxArgsPerCall=e.consoleMaxArgsPerCall),e.consoleMaxUniqueSignaturesPerSecond!==void 0&&(this.config.consoleMaxUniqueSignaturesPerSecond=e.consoleMaxUniqueSignaturesPerSecond)}markFirstFrameProduced(){this.hasProducedFirstFrame=true}resetForSceneReload(){this.hasProducedFirstFrame=false,this.currentSourceMap=null,this.errorChannel.flushAndClear(),this.consoleChannel.flushAndClear()}destroy(){this.errorChannel.destroy(),this.consoleChannel.destroy(),this.currentSourceMap=null}setCurrentSourceMap(e){if(e===null){this.currentSourceMap=null;return}try{this.currentSourceMap=qd(e)}catch{this.currentSourceMap=null}}reportSceneError(e){const s=e.stack,i=e.sourceOverride?{source:e.sourceOverride,sourceLocation:e.sourceLocationOverride}:this.attributeFromStack(s),r=e.sourceLocationOverride??i.sourceLocation,a=this.hasProducedFirstFrame?"render":"init",o=_c([e.message,e.code,r?`${r.line}:${r.column??"?"}`:"no-loc"]),c=s!==void 0&&s.length>bc?s.slice(0,bc)+Wd:s,l={message:e.message,...c!==void 0&&{stack:c},source:i.source,phase:a,code:e.code,signatureHash:o,count:1,firstSeenAt:0,lastSeenAt:0,...r!==void 0&&{sourceLocation:r}};this.errorChannel.emit(o,l)}makeArtistConsole(e){const s=Object.create(e),i=["log","info","warn","error"];for(const r of i)s[r]=(...a)=>{try{e[r](...a)}catch{}this.forwardConsoleCall(r,a)};return s}forwardConsoleCall(e,s){const r=(s.length>this.config.consoleMaxArgsPerCall?[...s.slice(0,this.config.consoleMaxArgsPerCall),"…[truncated args]"]:s).map(d=>zd(d,this.config.consoleArgMaxBytes)),a=_c([e,...r]),o=Date.now();if(o-this.rateCapWindowStart>=this.rateCapWindowMs&&(this.rateCapWindowStart=o,this.rateCapSignaturesInWindow=0,this.rateCapSuppressionFiredInWindow=false),!this.consoleChannel.hasPending(a)){if(this.rateCapSignaturesInWindow>=this.config.consoleMaxUniqueSignaturesPerSecond){this.rateCapSuppressionFiredInWindow||(this.rateCapSuppressionFiredInWindow=true,this.emitSuppressionNotice());return}this.rateCapSignaturesInWindow++}const l=this.resolveCallSiteLocation(),h={level:e,args:r,signatureHash:a,count:1,firstSeenAt:0,lastSeenAt:0,...l!==void 0&&{sourceLocation:l}};this.consoleChannel.emit(a,h)}emitSuppressionNotice(){const s={level:"warn",args:["[viji] console output suppressed: too many distinct signatures this second"],signatureHash:"__console_suppressed__",count:1,firstSeenAt:0,lastSeenAt:0};this.postEnvelope("scene-console",s)}resolveCallSiteLocation(){const e=new Error().stack;if(e)return this.attributeFromStack(e).sourceLocation}attributeFromStack(e){if(!e)return{source:"engine"};const s=e.split(`
474
- `);if(this.stackDialect==="jsc"&&!s.some(i=>/@.+:\d+/.test(i)))return{source:"engine"};for(const i of s){const r=this.matchArtistFrame(i);if(!r)continue;if(r.line===void 0)return{source:"scene"};const a=this.resolveLocation(r.line,r.column??0);return a?{source:"scene",sourceLocation:a}:{source:"scene"}}return{source:"engine"}}matchArtistFrame(e){switch(this.stackDialect){case"spidermonkey":{const s=e.match(/> (?:Async)?Function:(\d+)(?::(\d+))?\s*$/);return s?{line:parseInt(s[1],10),...s[2]!==void 0&&{column:parseInt(s[2],10)}}:null}case"jsc":return/^[^@\s()]*@\s*$/.test(e.trim())?{}:null;case"v8":case"unknown":default:{const s=e.match(/\(?(<anonymous>):(\d+):(\d+)\)?$/);return!s||s[1]!==this.functionBodySourceId?null:{line:parseInt(s[2],10),column:parseInt(s[3],10)}}}}resolveLocation(e,s){const i=e-this.functionBodyLineOffset;if(!(i<1)){if(this.currentSourceMap){const r=Hd(this.currentSourceMap,i,s);if(r)return{line:r.line,column:r.column}}return{line:i}}}detectFunctionBodyOffset(){const e="__viji_offset_probe__";try{new Function("viji","console",`throw new Error(${JSON.stringify(e)});`)(null,null)}catch(s){const r=s?.stack;if(!r)return;const a=r.split(`
475
- `);for(const o of a){const c=o.match(/\(?(<anonymous>):(\d+):(\d+)\)?$/);if(c){this.stackDialect="v8",this.functionBodySourceId=c[1],this.functionBodyLineOffset=parseInt(c[2],10)-1;return}const l=o.match(/> (?:Async)?Function:(\d+)(?::\d+)?\s*$/);if(l){this.stackDialect="spidermonkey",this.functionBodyLineOffset=parseInt(l[1],10)-1;return}if(/^[^@\s()]*@\s*$/.test(o.trim())){this.stackDialect="jsc",this.functionBodyLineOffset=0;return}}console.debug("[SceneErrorReporter] unrecognized probe stack dialect:",a[0],a[1])}}postEnvelope(e,s){this.post({type:e,id:`${e}_${s.signatureHash}_${++this.envelopeSeq}`,timestamp:Date.now(),data:s})}}class yc{windowMs;emitFn;pending=new Map;constructor(e,s){this.windowMs=e,this.emitFn=s}setWindowMs(e){this.windowMs=e}hasPending(e){return this.pending.has(e)}emit(e,s){const i=Date.now(),r=this.pending.get(e);if(r){if(r.payload.count++,r.payload.lastSeenAt=i,r.timer!==null)return;this.emitFn(r.payload),r.lastEmittedCount=r.payload.count,r.timer=setTimeout(()=>this.flush(e),this.windowMs);return}s.count=1,s.firstSeenAt=i,s.lastSeenAt=i,this.emitFn(s);const a=setTimeout(()=>this.flush(e),this.windowMs);this.pending.set(e,{payload:s,timer:a,lastEmittedCount:1})}flush(e){const s=this.pending.get(e);!s||s.timer===null||(clearTimeout(s.timer),s.timer=null,s.payload.count>s.lastEmittedCount&&(this.emitFn(s.payload),s.lastEmittedCount=s.payload.count))}flushAndClear(){for(const e of this.pending.values())e.timer!==null&&(clearTimeout(e.timer),e.timer=null,e.payload.count>e.lastEmittedCount&&this.emitFn(e.payload));this.pending.clear()}destroy(){for(const e of this.pending.values())e.timer!==null&&clearTimeout(e.timer);this.pending.clear()}}function zd(t,e){const s="…[truncated]";let i;try{t===void 0?i="undefined":t===null?i="null":typeof t=="string"?i=t:typeof t=="number"||typeof t=="boolean"||typeof t=="bigint"?i=String(t):typeof t=="function"?i=`[Function: ${t.name||"anonymous"}]`:typeof t=="symbol"?i=t.toString():t instanceof Error?i=`${t.name}: ${t.message}`:i=Yd(t)}catch{i="[unstringifiable]"}return i.length>e?i.slice(0,Math.max(0,e-s.length))+s:i}function Yd(t){const e=new WeakSet;try{return JSON.stringify(t,function(s,i){if(typeof i=="object"&&i!==null){if(e.has(i))return"[Circular]";if(e.add(i),i instanceof Map||i instanceof Set)return Array.from(i.entries?i.entries():i)}return typeof i=="function"?`[Function: ${i.name||"anonymous"}]`:typeof i=="bigint"?`${i.toString()}n`:i})??"undefined"}catch{return"[unstringifiable]"}}function _c(t){let i=2166136261;const a=t.join("");for(let o=0;o<a.length;o++)i^=a.charCodeAt(o),i=Math.imul(i,16777619);return(i>>>0).toString(16).padStart(8,"0")}var g;(function(t){t[t.NONE=0]="NONE";const s=1;t[t._abstract=s]="_abstract";const i=s+1;t[t._accessor=i]="_accessor";const r=i+1;t[t._as=r]="_as";const a=r+1;t[t._assert=a]="_assert";const o=a+1;t[t._asserts=o]="_asserts";const c=o+1;t[t._async=c]="_async";const l=c+1;t[t._await=l]="_await";const h=l+1;t[t._checks=h]="_checks";const d=h+1;t[t._constructor=d]="_constructor";const m=d+1;t[t._declare=m]="_declare";const _=m+1;t[t._enum=_]="_enum";const x=_+1;t[t._exports=x]="_exports";const E=x+1;t[t._from=E]="_from";const N=E+1;t[t._get=N]="_get";const F=N+1;t[t._global=F]="_global";const U=F+1;t[t._implements=U]="_implements";const P=U+1;t[t._infer=P]="_infer";const X=P+1;t[t._interface=X]="_interface";const $=X+1;t[t._is=$]="_is";const te=$+1;t[t._keyof=te]="_keyof";const ee=te+1;t[t._mixins=ee]="_mixins";const Q=ee+1;t[t._module=Q]="_module";const z=Q+1;t[t._namespace=z]="_namespace";const ne=z+1;t[t._of=ne]="_of";const v=ne+1;t[t._opaque=v]="_opaque";const y=v+1;t[t._out=y]="_out";const k=y+1;t[t._override=k]="_override";const V=k+1;t[t._private=V]="_private";const G=V+1;t[t._protected=G]="_protected";const B=G+1;t[t._proto=B]="_proto";const R=B+1;t[t._public=R]="_public";const O=R+1;t[t._readonly=O]="_readonly";const M=O+1;t[t._require=M]="_require";const C=M+1;t[t._satisfies=C]="_satisfies";const H=C+1;t[t._set=H]="_set";const W=H+1;t[t._static=W]="_static";const J=W+1;t[t._symbol=J]="_symbol";const ce=J+1;t[t._type=ce]="_type";const oe=ce+1;t[t._unique=oe]="_unique";const w=oe+1;t[t._using=w]="_using"})(g||(g={}));var n;(function(t){t[t.PRECEDENCE_MASK=15]="PRECEDENCE_MASK";const s=16;t[t.IS_KEYWORD=s]="IS_KEYWORD";const i=32;t[t.IS_ASSIGN=i]="IS_ASSIGN";const r=64;t[t.IS_RIGHT_ASSOCIATIVE=r]="IS_RIGHT_ASSOCIATIVE";const a=128;t[t.IS_PREFIX=a]="IS_PREFIX";const o=256;t[t.IS_POSTFIX=o]="IS_POSTFIX";const c=512;t[t.IS_EXPRESSION_START=c]="IS_EXPRESSION_START";const l=512;t[t.num=l]="num";const h=1536;t[t.bigint=h]="bigint";const d=2560;t[t.decimal=d]="decimal";const m=3584;t[t.regexp=m]="regexp";const _=4608;t[t.string=_]="string";const x=5632;t[t.name=x]="name";const E=6144;t[t.eof=E]="eof";const N=7680;t[t.bracketL=N]="bracketL";const F=8192;t[t.bracketR=F]="bracketR";const U=9728;t[t.braceL=U]="braceL";const P=10752;t[t.braceBarL=P]="braceBarL";const X=11264;t[t.braceR=X]="braceR";const $=12288;t[t.braceBarR=$]="braceBarR";const te=13824;t[t.parenL=te]="parenL";const ee=14336;t[t.parenR=ee]="parenR";const Q=15360;t[t.comma=Q]="comma";const z=16384;t[t.semi=z]="semi";const ne=17408;t[t.colon=ne]="colon";const v=18432;t[t.doubleColon=v]="doubleColon";const y=19456;t[t.dot=y]="dot";const k=20480;t[t.question=k]="question";const V=21504;t[t.questionDot=V]="questionDot";const G=22528;t[t.arrow=G]="arrow";const B=23552;t[t.template=B]="template";const R=24576;t[t.ellipsis=R]="ellipsis";const O=25600;t[t.backQuote=O]="backQuote";const M=27136;t[t.dollarBraceL=M]="dollarBraceL";const C=27648;t[t.at=C]="at";const H=29184;t[t.hash=H]="hash";const W=29728;t[t.eq=W]="eq";const J=30752;t[t.assign=J]="assign";const ce=32640;t[t.preIncDec=ce]="preIncDec";const oe=33664;t[t.postIncDec=oe]="postIncDec";const w=34432;t[t.bang=w]="bang";const T=35456;t[t.tilde=T]="tilde";const D=35841;t[t.pipeline=D]="pipeline";const L=36866;t[t.nullishCoalescing=L]="nullishCoalescing";const j=37890;t[t.logicalOR=j]="logicalOR";const se=38915;t[t.logicalAND=se]="logicalAND";const re=39940;t[t.bitwiseOR=re]="bitwiseOR";const pe=40965;t[t.bitwiseXOR=pe]="bitwiseXOR";const Se=41990;t[t.bitwiseAND=Se]="bitwiseAND";const ke=43015;t[t.equality=ke]="equality";const Fe=44040;t[t.lessThan=Fe]="lessThan";const Ye=45064;t[t.greaterThan=Ye]="greaterThan";const Ie=46088;t[t.relationalOrEqual=Ie]="relationalOrEqual";const Ve=47113;t[t.bitShiftL=Ve]="bitShiftL";const $e=48137;t[t.bitShiftR=$e]="bitShiftR";const fs=49802;t[t.plus=fs]="plus";const Es=50826;t[t.minus=Es]="minus";const Ws=51723;t[t.modulo=Ws]="modulo";const Dr=52235;t[t.star=Dr]="star";const Nr=53259;t[t.slash=Nr]="slash";const Fr=54348;t[t.exponent=Fr]="exponent";const Ur=55296;t[t.jsxName=Ur]="jsxName";const Mr=56320;t[t.jsxText=Mr]="jsxText";const Br=57344;t[t.jsxEmptyText=Br]="jsxEmptyText";const Or=58880;t[t.jsxTagStart=Or]="jsxTagStart";const Vr=59392;t[t.jsxTagEnd=Vr]="jsxTagEnd";const $r=60928;t[t.typeParameterStart=$r]="typeParameterStart";const jr=61440;t[t.nonNullAssertion=jr]="nonNullAssertion";const qr=62480;t[t._break=qr]="_break";const Hr=63504;t[t._case=Hr]="_case";const Gr=64528;t[t._catch=Gr]="_catch";const Wr=65552;t[t._continue=Wr]="_continue";const Xr=66576;t[t._debugger=Xr]="_debugger";const zr=67600;t[t._default=zr]="_default";const Yr=68624;t[t._do=Yr]="_do";const Kr=69648;t[t._else=Kr]="_else";const Zr=70672;t[t._finally=Zr]="_finally";const Qr=71696;t[t._for=Qr]="_for";const Jr=73232;t[t._function=Jr]="_function";const en=73744;t[t._if=en]="_if";const tn=74768;t[t._return=tn]="_return";const sn=75792;t[t._switch=sn]="_switch";const rn=77456;t[t._throw=rn]="_throw";const nn=77840;t[t._try=nn]="_try";const an=78864;t[t._var=an]="_var";const on=79888;t[t._let=on]="_let";const cn=80912;t[t._const=cn]="_const";const un=81936;t[t._while=un]="_while";const ln=82960;t[t._with=ln]="_with";const hn=84496;t[t._new=hn]="_new";const fn=85520;t[t._this=fn]="_this";const dn=86544;t[t._super=dn]="_super";const pn=87568;t[t._class=pn]="_class";const mn=88080;t[t._extends=mn]="_extends";const gn=89104;t[t._export=gn]="_export";const bn=90640;t[t._import=bn]="_import";const yn=91664;t[t._yield=yn]="_yield";const _n=92688;t[t._null=_n]="_null";const vn=93712;t[t._true=vn]="_true";const xn=94736;t[t._false=xn]="_false";const kn=95256;t[t._in=kn]="_in";const wn=96280;t[t._instanceof=wn]="_instanceof";const Sn=97936;t[t._typeof=Sn]="_typeof";const En=98960;t[t._void=En]="_void";const V1=99984;t[t._delete=V1]="_delete";const $1=100880;t[t._async=$1]="_async";const j1=101904;t[t._get=j1]="_get";const q1=102928;t[t._set=q1]="_set";const H1=103952;t[t._declare=H1]="_declare";const G1=104976;t[t._readonly=G1]="_readonly";const W1=106e3;t[t._abstract=W1]="_abstract";const X1=107024;t[t._static=X1]="_static";const z1=107536;t[t._public=z1]="_public";const Y1=108560;t[t._private=Y1]="_private";const K1=109584;t[t._protected=K1]="_protected";const Z1=110608;t[t._override=Z1]="_override";const Q1=112144;t[t._as=Q1]="_as";const J1=113168;t[t._enum=J1]="_enum";const eh=114192;t[t._type=eh]="_type";const th=115216;t[t._implements=th]="_implements"})(n||(n={}));function Kd(t){switch(t){case n.num:return"num";case n.bigint:return"bigint";case n.decimal:return"decimal";case n.regexp:return"regexp";case n.string:return"string";case n.name:return"name";case n.eof:return"eof";case n.bracketL:return"[";case n.bracketR:return"]";case n.braceL:return"{";case n.braceBarL:return"{|";case n.braceR:return"}";case n.braceBarR:return"|}";case n.parenL:return"(";case n.parenR:return")";case n.comma:return",";case n.semi:return";";case n.colon:return":";case n.doubleColon:return"::";case n.dot:return".";case n.question:return"?";case n.questionDot:return"?.";case n.arrow:return"=>";case n.template:return"template";case n.ellipsis:return"...";case n.backQuote:return"`";case n.dollarBraceL:return"${";case n.at:return"@";case n.hash:return"#";case n.eq:return"=";case n.assign:return"_=";case n.preIncDec:return"++/--";case n.postIncDec:return"++/--";case n.bang:return"!";case n.tilde:return"~";case n.pipeline:return"|>";case n.nullishCoalescing:return"??";case n.logicalOR:return"||";case n.logicalAND:return"&&";case n.bitwiseOR:return"|";case n.bitwiseXOR:return"^";case n.bitwiseAND:return"&";case n.equality:return"==/!=";case n.lessThan:return"<";case n.greaterThan:return">";case n.relationalOrEqual:return"<=/>=";case n.bitShiftL:return"<<";case n.bitShiftR:return">>/>>>";case n.plus:return"+";case n.minus:return"-";case n.modulo:return"%";case n.star:return"*";case n.slash:return"/";case n.exponent:return"**";case n.jsxName:return"jsxName";case n.jsxText:return"jsxText";case n.jsxEmptyText:return"jsxEmptyText";case n.jsxTagStart:return"jsxTagStart";case n.jsxTagEnd:return"jsxTagEnd";case n.typeParameterStart:return"typeParameterStart";case n.nonNullAssertion:return"nonNullAssertion";case n._break:return"break";case n._case:return"case";case n._catch:return"catch";case n._continue:return"continue";case n._debugger:return"debugger";case n._default:return"default";case n._do:return"do";case n._else:return"else";case n._finally:return"finally";case n._for:return"for";case n._function:return"function";case n._if:return"if";case n._return:return"return";case n._switch:return"switch";case n._throw:return"throw";case n._try:return"try";case n._var:return"var";case n._let:return"let";case n._const:return"const";case n._while:return"while";case n._with:return"with";case n._new:return"new";case n._this:return"this";case n._super:return"super";case n._class:return"class";case n._extends:return"extends";case n._export:return"export";case n._import:return"import";case n._yield:return"yield";case n._null:return"null";case n._true:return"true";case n._false:return"false";case n._in:return"in";case n._instanceof:return"instanceof";case n._typeof:return"typeof";case n._void:return"void";case n._delete:return"delete";case n._async:return"async";case n._get:return"get";case n._set:return"set";case n._declare:return"declare";case n._readonly:return"readonly";case n._abstract:return"abstract";case n._static:return"static";case n._public:return"public";case n._private:return"private";case n._protected:return"protected";case n._override:return"override";case n._as:return"as";case n._enum:return"enum";case n._type:return"type";case n._implements:return"implements";default:return""}}class Ft{constructor(e,s,i){this.startTokenIndex=e,this.endTokenIndex=s,this.isFunctionScope=i}}class Zd{constructor(e,s,i,r,a,o,c,l,h,d,m,_,x){this.potentialArrowAt=e,this.noAnonFunctionType=s,this.inDisallowConditionalTypesContext=i,this.tokensLength=r,this.scopesLength=a,this.pos=o,this.type=c,this.contextualKeyword=l,this.start=h,this.end=d,this.isType=m,this.scopeDepth=_,this.error=x}}class Ge{constructor(){Ge.prototype.__init.call(this),Ge.prototype.__init2.call(this),Ge.prototype.__init3.call(this),Ge.prototype.__init4.call(this),Ge.prototype.__init5.call(this),Ge.prototype.__init6.call(this),Ge.prototype.__init7.call(this),Ge.prototype.__init8.call(this),Ge.prototype.__init9.call(this),Ge.prototype.__init10.call(this),Ge.prototype.__init11.call(this),Ge.prototype.__init12.call(this),Ge.prototype.__init13.call(this)}__init(){this.potentialArrowAt=-1}__init2(){this.noAnonFunctionType=false}__init3(){this.inDisallowConditionalTypesContext=false}__init4(){this.tokens=[]}__init5(){this.scopes=[]}__init6(){this.pos=0}__init7(){this.type=n.eof}__init8(){this.contextualKeyword=g.NONE}__init9(){this.start=0}__init10(){this.end=0}__init11(){this.isType=false}__init12(){this.scopeDepth=0}__init13(){this.error=null}snapshot(){return new Zd(this.potentialArrowAt,this.noAnonFunctionType,this.inDisallowConditionalTypesContext,this.tokens.length,this.scopes.length,this.pos,this.type,this.contextualKeyword,this.start,this.end,this.isType,this.scopeDepth,this.error)}restoreFromSnapshot(e){this.potentialArrowAt=e.potentialArrowAt,this.noAnonFunctionType=e.noAnonFunctionType,this.inDisallowConditionalTypesContext=e.inDisallowConditionalTypesContext,this.tokens.length=e.tokensLength,this.scopes.length=e.scopesLength,this.pos=e.pos,this.type=e.type,this.contextualKeyword=e.contextualKeyword,this.start=e.start,this.end=e.end,this.isType=e.isType,this.scopeDepth=e.scopeDepth,this.error=e.error}}var b;(function(t){t[t.backSpace=8]="backSpace";const s=10;t[t.lineFeed=s]="lineFeed";const i=9;t[t.tab=i]="tab";const r=13;t[t.carriageReturn=r]="carriageReturn";const a=14;t[t.shiftOut=a]="shiftOut";const o=32;t[t.space=o]="space";const c=33;t[t.exclamationMark=c]="exclamationMark";const l=34;t[t.quotationMark=l]="quotationMark";const h=35;t[t.numberSign=h]="numberSign";const d=36;t[t.dollarSign=d]="dollarSign";const m=37;t[t.percentSign=m]="percentSign";const _=38;t[t.ampersand=_]="ampersand";const x=39;t[t.apostrophe=x]="apostrophe";const E=40;t[t.leftParenthesis=E]="leftParenthesis";const N=41;t[t.rightParenthesis=N]="rightParenthesis";const F=42;t[t.asterisk=F]="asterisk";const U=43;t[t.plusSign=U]="plusSign";const P=44;t[t.comma=P]="comma";const X=45;t[t.dash=X]="dash";const $=46;t[t.dot=$]="dot";const te=47;t[t.slash=te]="slash";const ee=48;t[t.digit0=ee]="digit0";const Q=49;t[t.digit1=Q]="digit1";const z=50;t[t.digit2=z]="digit2";const ne=51;t[t.digit3=ne]="digit3";const v=52;t[t.digit4=v]="digit4";const y=53;t[t.digit5=y]="digit5";const k=54;t[t.digit6=k]="digit6";const V=55;t[t.digit7=V]="digit7";const G=56;t[t.digit8=G]="digit8";const B=57;t[t.digit9=B]="digit9";const R=58;t[t.colon=R]="colon";const O=59;t[t.semicolon=O]="semicolon";const M=60;t[t.lessThan=M]="lessThan";const C=61;t[t.equalsTo=C]="equalsTo";const H=62;t[t.greaterThan=H]="greaterThan";const W=63;t[t.questionMark=W]="questionMark";const J=64;t[t.atSign=J]="atSign";const ce=65;t[t.uppercaseA=ce]="uppercaseA";const oe=66;t[t.uppercaseB=oe]="uppercaseB";const w=67;t[t.uppercaseC=w]="uppercaseC";const T=68;t[t.uppercaseD=T]="uppercaseD";const D=69;t[t.uppercaseE=D]="uppercaseE";const L=70;t[t.uppercaseF=L]="uppercaseF";const j=71;t[t.uppercaseG=j]="uppercaseG";const se=72;t[t.uppercaseH=se]="uppercaseH";const re=73;t[t.uppercaseI=re]="uppercaseI";const pe=74;t[t.uppercaseJ=pe]="uppercaseJ";const Se=75;t[t.uppercaseK=Se]="uppercaseK";const ke=76;t[t.uppercaseL=ke]="uppercaseL";const Fe=77;t[t.uppercaseM=Fe]="uppercaseM";const Ye=78;t[t.uppercaseN=Ye]="uppercaseN";const Ie=79;t[t.uppercaseO=Ie]="uppercaseO";const Ve=80;t[t.uppercaseP=Ve]="uppercaseP";const $e=81;t[t.uppercaseQ=$e]="uppercaseQ";const fs=82;t[t.uppercaseR=fs]="uppercaseR";const Es=83;t[t.uppercaseS=Es]="uppercaseS";const Ws=84;t[t.uppercaseT=Ws]="uppercaseT";const Dr=85;t[t.uppercaseU=Dr]="uppercaseU";const Nr=86;t[t.uppercaseV=Nr]="uppercaseV";const Fr=87;t[t.uppercaseW=Fr]="uppercaseW";const Ur=88;t[t.uppercaseX=Ur]="uppercaseX";const Mr=89;t[t.uppercaseY=Mr]="uppercaseY";const Br=90;t[t.uppercaseZ=Br]="uppercaseZ";const Or=91;t[t.leftSquareBracket=Or]="leftSquareBracket";const Vr=92;t[t.backslash=Vr]="backslash";const $r=93;t[t.rightSquareBracket=$r]="rightSquareBracket";const jr=94;t[t.caret=jr]="caret";const qr=95;t[t.underscore=qr]="underscore";const Hr=96;t[t.graveAccent=Hr]="graveAccent";const Gr=97;t[t.lowercaseA=Gr]="lowercaseA";const Wr=98;t[t.lowercaseB=Wr]="lowercaseB";const Xr=99;t[t.lowercaseC=Xr]="lowercaseC";const zr=100;t[t.lowercaseD=zr]="lowercaseD";const Yr=101;t[t.lowercaseE=Yr]="lowercaseE";const Kr=102;t[t.lowercaseF=Kr]="lowercaseF";const Zr=103;t[t.lowercaseG=Zr]="lowercaseG";const Qr=104;t[t.lowercaseH=Qr]="lowercaseH";const Jr=105;t[t.lowercaseI=Jr]="lowercaseI";const en=106;t[t.lowercaseJ=en]="lowercaseJ";const tn=107;t[t.lowercaseK=tn]="lowercaseK";const sn=108;t[t.lowercaseL=sn]="lowercaseL";const rn=109;t[t.lowercaseM=rn]="lowercaseM";const nn=110;t[t.lowercaseN=nn]="lowercaseN";const an=111;t[t.lowercaseO=an]="lowercaseO";const on=112;t[t.lowercaseP=on]="lowercaseP";const cn=113;t[t.lowercaseQ=cn]="lowercaseQ";const un=114;t[t.lowercaseR=un]="lowercaseR";const ln=115;t[t.lowercaseS=ln]="lowercaseS";const hn=116;t[t.lowercaseT=hn]="lowercaseT";const fn=117;t[t.lowercaseU=fn]="lowercaseU";const dn=118;t[t.lowercaseV=dn]="lowercaseV";const pn=119;t[t.lowercaseW=pn]="lowercaseW";const mn=120;t[t.lowercaseX=mn]="lowercaseX";const gn=121;t[t.lowercaseY=gn]="lowercaseY";const bn=122;t[t.lowercaseZ=bn]="lowercaseZ";const yn=123;t[t.leftCurlyBrace=yn]="leftCurlyBrace";const _n=124;t[t.verticalBar=_n]="verticalBar";const vn=125;t[t.rightCurlyBrace=vn]="rightCurlyBrace";const xn=126;t[t.tilde=xn]="tilde";const kn=160;t[t.nonBreakingSpace=kn]="nonBreakingSpace";const wn=5760;t[t.oghamSpaceMark=wn]="oghamSpaceMark";const Sn=8232;t[t.lineSeparator=Sn]="lineSeparator";const En=8233;t[t.paragraphSeparator=En]="paragraphSeparator"})(b||(b={}));let Er,me,_e,u,q,wl;function li(){return wl++}function Qd(t){if("pos"in t){const e=ep(t.pos);t.message+=` (${e.line}:${e.column})`,t.loc=e}return t}class Jd{constructor(e,s){this.line=e,this.column=s}}function ep(t){let e=1,s=1;for(let i=0;i<t;i++)q.charCodeAt(i)===b.lineFeed?(e++,s=1):s++;return new Jd(e,s)}function tp(t,e,s,i){q=t,u=new Ge,wl=1,Er=e,me=s,_e=i}function Z(t){return u.contextualKeyword===t}function za(t){const e=xi();return e.type===n.name&&e.contextualKeyword===t}function Le(t){return u.contextualKeyword===t&&S(n.name)}function Re(t){Le(t)||le()}function rt(){return p(n.eof)||p(n.braceR)||Xe()}function Xe(){const t=u.tokens[u.tokens.length-1],e=t?t.end:0;for(let s=e;s<u.start;s++){const i=q.charCodeAt(s);if(i===b.lineFeed||i===b.carriageReturn||i===8232||i===8233)return true}return false}function Sl(){const t=Ya();for(let e=u.end;e<t;e++){const s=q.charCodeAt(e);if(s===b.lineFeed||s===b.carriageReturn||s===8232||s===8233)return true}return false}function Ct(){return S(n.semi)||rt()}function Ee(){Ct()||le('Unexpected token, expected ";"')}function A(t){S(t)||le(`Unexpected token, expected "${Kd(t)}"`)}function le(t="Unexpected token",e=u.start){if(u.error)return;const s=new SyntaxError(t);s.pos=e,u.error=s,u.pos=q.length,ue(n.eof)}const El=[9,11,12,b.space,b.nonBreakingSpace,b.oghamSpaceMark,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288,65279],vc=/(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g,Tl=new Uint8Array(65536);for(const t of El)Tl[t]=1;function sp(t){if(t<48)return t===36;if(t<58)return true;if(t<65)return false;if(t<91)return true;if(t<97)return t===95;if(t<123)return true;if(t<128)return false;throw new Error("Should not be called with non-ASCII char code.")}const _t=new Uint8Array(65536);for(let t=0;t<128;t++)_t[t]=sp(t)?1:0;for(let t=128;t<65536;t++)_t[t]=1;for(const t of El)_t[t]=0;_t[8232]=0;_t[8233]=0;const vi=_t.slice();for(let t=b.digit0;t<=b.digit9;t++)vi[t]=0;const xc=new Int32Array([-1,27,783,918,1755,2376,2862,3483,-1,3699,-1,4617,4752,4833,5130,5508,5940,-1,6480,6939,7749,8181,8451,8613,-1,8829,-1,-1,-1,54,243,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,432,-1,-1,-1,675,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,81,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,108,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,135,-1,-1,-1,-1,-1,-1,-1,-1,-1,162,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,189,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,216,-1,-1,-1,-1,-1,-1,g._abstract<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,270,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,297,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,324,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,351,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,378,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,405,-1,-1,-1,-1,-1,-1,-1,-1,g._accessor<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,g._as<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,459,-1,-1,-1,-1,-1,594,-1,-1,-1,-1,-1,-1,486,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,513,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,540,-1,-1,-1,-1,-1,-1,g._assert<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,567,-1,-1,-1,-1,-1,-1,-1,g._asserts<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,621,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,648,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,g._async<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,702,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,729,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,756,-1,-1,-1,-1,-1,-1,g._await<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,810,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,837,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,864,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,891,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,(n._break<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,945,-1,-1,-1,-1,-1,-1,1107,-1,-1,-1,1242,-1,-1,1350,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,972,1026,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,999,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,(n._case<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1053,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1080,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,(n._catch<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1134,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1161,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1188,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1215,-1,-1,-1,-1,-1,-1,-1,g._checks<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1269,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1296,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1323,-1,-1,-1,-1,-1,-1,-1,(n._class<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1377,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1404,1620,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1431,-1,-1,-1,-1,-1,-1,(n._const<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1458,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1485,-1,-1,-1,-1,-1,-1,-1,-1,1512,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1539,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1566,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1593,-1,-1,-1,-1,-1,-1,-1,-1,g._constructor<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1647,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1674,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1701,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1728,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,(n._continue<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1782,-1,-1,-1,-1,-1,-1,-1,-1,-1,2349,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1809,1971,-1,-1,2106,-1,-1,-1,-1,-1,2241,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1836,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1863,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1890,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1917,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1944,-1,-1,-1,-1,-1,-1,-1,-1,(n._debugger<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1998,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2025,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2052,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2079,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,g._declare<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2133,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2160,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2187,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2214,-1,-1,-1,-1,-1,-1,(n._default<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2268,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2295,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2322,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,(n._delete<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,(n._do<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2403,-1,2484,-1,-1,-1,-1,-1,-1,-1,-1,-1,2565,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2430,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2457,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,(n._else<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2511,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2538,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,g._enum<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2592,-1,-1,-1,2727,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2619,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2646,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2673,-1,-1,-1,-1,-1,-1,(n._export<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2700,-1,-1,-1,-1,-1,-1,-1,g._exports<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2754,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2781,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2808,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2835,-1,-1,-1,-1,-1,-1,-1,(n._extends<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2889,-1,-1,-1,-1,-1,-1,-1,2997,-1,-1,-1,-1,-1,3159,-1,-1,3213,-1,-1,3294,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2916,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2943,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2970,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,(n._false<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3024,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3051,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3078,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3105,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3132,-1,(n._finally<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3186,-1,-1,-1,-1,-1,-1,-1,-1,(n._for<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3240,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3267,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,g._from<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3321,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3348,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3375,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3402,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3429,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3456,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,(n._function<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3510,-1,-1,-1,-1,-1,-1,3564,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3537,-1,-1,-1,-1,-1,-1,g._get<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3591,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3618,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3645,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3672,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,g._global<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3726,-1,-1,-1,-1,-1,-1,3753,4077,-1,-1,-1,-1,4590,-1,-1,-1,-1,-1,-1,-1,(n._if<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3780,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3807,-1,-1,3996,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3834,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3861,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3888,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3915,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3942,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3969,-1,-1,-1,-1,-1,-1,-1,g._implements<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4023,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4050,-1,-1,-1,-1,-1,-1,(n._import<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,(n._in<<1)+1,-1,-1,-1,-1,-1,4104,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4185,4401,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4131,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4158,-1,-1,-1,-1,-1,-1,-1,-1,g._infer<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4212,-1,-1,-1,-1,-1,-1,-1,4239,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4266,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4293,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4320,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4347,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4374,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,(n._instanceof<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4428,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4455,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4482,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4509,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4536,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4563,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,g._interface<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,g._is<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4644,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4671,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4698,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4725,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,g._keyof<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4779,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4806,-1,-1,-1,-1,-1,-1,(n._let<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4860,-1,-1,-1,-1,-1,4995,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4887,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4914,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4941,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4968,-1,-1,-1,-1,-1,-1,-1,g._mixins<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,5022,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,5049,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,5076,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,5103,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,g._module<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,5157,-1,-1,-1,5373,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,5427,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,5184,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,5211,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,5238,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,5265,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,5292,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,5319,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,5346,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,g._namespace<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,5400,-1,-1,-1,(n._new<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,5454,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,5481,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,(n._null<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,5535,-1,-1,-1,-1,-1,-1,-1,-1,-1,5562,-1,-1,-1,-1,5697,5751,-1,-1,-1,-1,g._of<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,5589,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,5616,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,5643,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,5670,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,g._opaque<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,5724,-1,-1,-1,-1,-1,-1,g._out<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,5778,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,5805,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,5832,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,5859,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,5886,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,5913,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,g._override<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,5967,-1,-1,6345,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,5994,-1,-1,-1,-1,-1,6129,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,6021,-1,-1,-1,-1,-1,6048,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,6075,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,6102,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,g._private<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,6156,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,6183,-1,-1,-1,-1,-1,-1,-1,-1,-1,6318,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,6210,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,6237,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,6264,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,6291,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,g._protected<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,g._proto<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,6372,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,6399,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,6426,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,6453,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,g._public<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,6507,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,6534,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,6696,-1,-1,6831,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,6561,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,6588,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,6615,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,6642,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,6669,-1,g._readonly<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,6723,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,6750,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,6777,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,6804,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,g._require<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,6858,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,6885,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,6912,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,(n._return<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,6966,-1,-1,-1,7182,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7236,7371,-1,7479,-1,7614,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,6993,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7020,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7047,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7074,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7101,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7128,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7155,-1,-1,-1,-1,-1,-1,-1,g._satisfies<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7209,-1,-1,-1,-1,-1,-1,g._set<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7263,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7290,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7317,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7344,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,g._static<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7398,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7425,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7452,-1,-1,-1,-1,-1,-1,-1,-1,(n._super<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7506,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7533,-1,-1,-1,-1,-1,-1,-1,-1,-1,7560,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7587,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,(n._switch<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7641,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7668,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7695,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7722,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,g._symbol<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7776,-1,-1,-1,-1,-1,-1,-1,-1,-1,7938,-1,-1,-1,-1,-1,-1,8046,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7803,-1,-1,-1,-1,-1,-1,-1,-1,7857,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7830,-1,-1,-1,-1,-1,-1,-1,(n._this<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7884,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7911,-1,-1,-1,(n._throw<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7965,-1,-1,-1,8019,-1,-1,-1,-1,-1,-1,7992,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,(n._true<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,(n._try<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8073,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8100,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,g._type<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8127,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8154,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,(n._typeof<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8208,-1,-1,-1,-1,8343,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8235,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8262,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8289,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8316,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,g._unique<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8370,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8397,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8424,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,g._using<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8478,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8532,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8505,-1,-1,-1,-1,-1,-1,-1,-1,(n._var<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8559,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8586,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,(n._void<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8640,8748,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8667,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8694,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8721,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,(n._while<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8775,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8802,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,(n._with<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8856,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8883,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8910,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8937,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,(n._yield<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1]);function ip(){let t=0,e=0,s=u.pos;for(;s<q.length&&(e=q.charCodeAt(s),!(e<b.lowercaseA||e>b.lowercaseZ));){const r=xc[t+(e-b.lowercaseA)+1];if(r===-1)break;t=r,s++}const i=xc[t];if(i>-1&&!_t[e]){u.pos=s,i&1?ue(i>>>1):ue(n.name,i>>>1);return}for(;s<q.length;){const r=q.charCodeAt(s);if(_t[r])s++;else if(r===b.backslash){if(s+=2,q.charCodeAt(s)===b.leftCurlyBrace){for(;s<q.length&&q.charCodeAt(s)!==b.rightCurlyBrace;)s++;s++}}else if(r===b.atSign&&q.charCodeAt(s+1)===b.atSign)s+=2;else break}u.pos=s,ue(n.name)}var ie;(function(t){t[t.Access=0]="Access";const s=1;t[t.ExportAccess=s]="ExportAccess";const i=s+1;t[t.TopLevelDeclaration=i]="TopLevelDeclaration";const r=i+1;t[t.FunctionScopedDeclaration=r]="FunctionScopedDeclaration";const a=r+1;t[t.BlockScopedDeclaration=a]="BlockScopedDeclaration";const o=a+1;t[t.ObjectShorthandTopLevelDeclaration=o]="ObjectShorthandTopLevelDeclaration";const c=o+1;t[t.ObjectShorthandFunctionScopedDeclaration=c]="ObjectShorthandFunctionScopedDeclaration";const l=c+1;t[t.ObjectShorthandBlockScopedDeclaration=l]="ObjectShorthandBlockScopedDeclaration";const h=l+1;t[t.ObjectShorthand=h]="ObjectShorthand";const d=h+1;t[t.ImportDeclaration=d]="ImportDeclaration";const m=d+1;t[t.ObjectKey=m]="ObjectKey";const _=m+1;t[t.ImportAccess=_]="ImportAccess"})(ie||(ie={}));var mt;(function(t){t[t.NoChildren=0]="NoChildren";const s=1;t[t.OneChild=s]="OneChild";const i=s+1;t[t.StaticChildren=i]="StaticChildren";const r=i+1;t[t.KeyAfterPropSpread=r]="KeyAfterPropSpread"})(mt||(mt={}));function Al(t){const e=t.identifierRole;return e===ie.TopLevelDeclaration||e===ie.FunctionScopedDeclaration||e===ie.BlockScopedDeclaration||e===ie.ObjectShorthandTopLevelDeclaration||e===ie.ObjectShorthandFunctionScopedDeclaration||e===ie.ObjectShorthandBlockScopedDeclaration}function rp(t){const e=t.identifierRole;return e===ie.FunctionScopedDeclaration||e===ie.BlockScopedDeclaration||e===ie.ObjectShorthandFunctionScopedDeclaration||e===ie.ObjectShorthandBlockScopedDeclaration}function Cl(t){const e=t.identifierRole;return e===ie.TopLevelDeclaration||e===ie.ObjectShorthandTopLevelDeclaration||e===ie.ImportDeclaration}function np(t){const e=t.identifierRole;return e===ie.TopLevelDeclaration||e===ie.BlockScopedDeclaration||e===ie.ObjectShorthandTopLevelDeclaration||e===ie.ObjectShorthandBlockScopedDeclaration}function ap(t){const e=t.identifierRole;return e===ie.FunctionScopedDeclaration||e===ie.ObjectShorthandFunctionScopedDeclaration}function op(t){return t.identifierRole===ie.ObjectShorthandTopLevelDeclaration||t.identifierRole===ie.ObjectShorthandBlockScopedDeclaration||t.identifierRole===ie.ObjectShorthandFunctionScopedDeclaration}class Tr{constructor(){this.type=u.type,this.contextualKeyword=u.contextualKeyword,this.start=u.start,this.end=u.end,this.scopeDepth=u.scopeDepth,this.isType=u.isType,this.identifierRole=null,this.jsxRole=null,this.shadowsGlobal=false,this.isAsyncOperation=false,this.contextId=null,this.rhsEndIndex=null,this.isExpression=false,this.numNullishCoalesceStarts=0,this.numNullishCoalesceEnds=0,this.isOptionalChainStart=false,this.isOptionalChainEnd=false,this.subscriptStartIndex=null,this.nullishStartIndex=null}}function I(){u.tokens.push(new Tr),Ll()}function is(){u.tokens.push(new Tr),u.start=u.pos,Sp()}function cp(){u.type===n.assign&&--u.pos,xp()}function de(t){for(let s=u.tokens.length-t;s<u.tokens.length;s++)u.tokens[s].isType=true;const e=u.isType;return u.isType=true,e}function fe(t){u.isType=t}function S(t){return p(t)?(I(),true):false}function Il(t){const e=u.isType;u.isType=true,S(t),u.isType=e}function p(t){return u.type===t}function Ae(){const t=u.snapshot();I();const e=u.type;return u.restoreFromSnapshot(t),e}class up{constructor(e,s){this.type=e,this.contextualKeyword=s}}function xi(){const t=u.snapshot();I();const e=u.type,s=u.contextualKeyword;return u.restoreFromSnapshot(t),new up(e,s)}function Ya(){return Rl(u.pos)}function Rl(t){vc.lastIndex=t;const e=vc.exec(q);return t+e[0].length}function Pl(){return q.charCodeAt(Ya())}function Ll(){if(Nl(),u.start=u.pos,u.pos>=q.length){const t=u.tokens;t.length>=2&&t[t.length-1].start>=q.length&&t[t.length-2].start>=q.length&&le("Unexpectedly reached the end of input."),ue(n.eof);return}lp(q.charCodeAt(u.pos))}function lp(t){vi[t]||t===b.backslash||t===b.atSign&&q.charCodeAt(u.pos+1)===b.atSign?ip():Ml(t)}function hp(){for(;q.charCodeAt(u.pos)!==b.asterisk||q.charCodeAt(u.pos+1)!==b.slash;)if(u.pos++,u.pos>q.length){le("Unterminated comment",u.pos-2);return}u.pos+=2}function Dl(t){let e=q.charCodeAt(u.pos+=t);if(u.pos<q.length)for(;e!==b.lineFeed&&e!==b.carriageReturn&&e!==b.lineSeparator&&e!==b.paragraphSeparator&&++u.pos<q.length;)e=q.charCodeAt(u.pos)}function Nl(){for(;u.pos<q.length;){const t=q.charCodeAt(u.pos);switch(t){case b.carriageReturn:q.charCodeAt(u.pos+1)===b.lineFeed&&++u.pos;case b.lineFeed:case b.lineSeparator:case b.paragraphSeparator:++u.pos;break;case b.slash:switch(q.charCodeAt(u.pos+1)){case b.asterisk:u.pos+=2,hp();break;case b.slash:Dl(2);break;default:return}break;default:if(Tl[t])++u.pos;else return}}}function ue(t,e=g.NONE){u.end=u.pos,u.type=t,u.contextualKeyword=e}function fp(){const t=q.charCodeAt(u.pos+1);if(t>=b.digit0&&t<=b.digit9){Bl(true);return}t===b.dot&&q.charCodeAt(u.pos+2)===b.dot?(u.pos+=3,ue(n.ellipsis)):(++u.pos,ue(n.dot))}function dp(){q.charCodeAt(u.pos+1)===b.equalsTo?xe(n.assign,2):xe(n.slash,1)}function pp(t){let e=t===b.asterisk?n.star:n.modulo,s=1,i=q.charCodeAt(u.pos+1);t===b.asterisk&&i===b.asterisk&&(s++,i=q.charCodeAt(u.pos+2),e=n.exponent),i===b.equalsTo&&q.charCodeAt(u.pos+2)!==b.greaterThan&&(s++,e=n.assign),xe(e,s)}function mp(t){const e=q.charCodeAt(u.pos+1);if(e===t){q.charCodeAt(u.pos+2)===b.equalsTo?xe(n.assign,3):xe(t===b.verticalBar?n.logicalOR:n.logicalAND,2);return}if(t===b.verticalBar){if(e===b.greaterThan){xe(n.pipeline,2);return}else if(e===b.rightCurlyBrace&&_e){xe(n.braceBarR,2);return}}if(e===b.equalsTo){xe(n.assign,2);return}xe(t===b.verticalBar?n.bitwiseOR:n.bitwiseAND,1)}function gp(){q.charCodeAt(u.pos+1)===b.equalsTo?xe(n.assign,2):xe(n.bitwiseXOR,1)}function bp(t){const e=q.charCodeAt(u.pos+1);if(e===t){xe(n.preIncDec,2);return}e===b.equalsTo?xe(n.assign,2):t===b.plusSign?xe(n.plus,1):xe(n.minus,1)}function yp(){const t=q.charCodeAt(u.pos+1);if(t===b.lessThan){if(q.charCodeAt(u.pos+2)===b.equalsTo){xe(n.assign,3);return}u.isType?xe(n.lessThan,1):xe(n.bitShiftL,2);return}t===b.equalsTo?xe(n.relationalOrEqual,2):xe(n.lessThan,1)}function Fl(){if(u.isType){xe(n.greaterThan,1);return}const t=q.charCodeAt(u.pos+1);if(t===b.greaterThan){const e=q.charCodeAt(u.pos+2)===b.greaterThan?3:2;if(q.charCodeAt(u.pos+e)===b.equalsTo){xe(n.assign,e+1);return}xe(n.bitShiftR,e);return}t===b.equalsTo?xe(n.relationalOrEqual,2):xe(n.greaterThan,1)}function Ul(){u.type===n.greaterThan&&(u.pos-=1,Fl())}function _p(t){const e=q.charCodeAt(u.pos+1);if(e===b.equalsTo){xe(n.equality,q.charCodeAt(u.pos+2)===b.equalsTo?3:2);return}if(t===b.equalsTo&&e===b.greaterThan){u.pos+=2,ue(n.arrow);return}xe(t===b.equalsTo?n.eq:n.bang,1)}function vp(){const t=q.charCodeAt(u.pos+1),e=q.charCodeAt(u.pos+2);t===b.questionMark&&!(_e&&u.isType)?e===b.equalsTo?xe(n.assign,3):xe(n.nullishCoalescing,2):t===b.dot&&!(e>=b.digit0&&e<=b.digit9)?(u.pos+=2,ue(n.questionDot)):(++u.pos,ue(n.question))}function Ml(t){switch(t){case b.numberSign:++u.pos,ue(n.hash);return;case b.dot:fp();return;case b.leftParenthesis:++u.pos,ue(n.parenL);return;case b.rightParenthesis:++u.pos,ue(n.parenR);return;case b.semicolon:++u.pos,ue(n.semi);return;case b.comma:++u.pos,ue(n.comma);return;case b.leftSquareBracket:++u.pos,ue(n.bracketL);return;case b.rightSquareBracket:++u.pos,ue(n.bracketR);return;case b.leftCurlyBrace:_e&&q.charCodeAt(u.pos+1)===b.verticalBar?xe(n.braceBarL,2):(++u.pos,ue(n.braceL));return;case b.rightCurlyBrace:++u.pos,ue(n.braceR);return;case b.colon:q.charCodeAt(u.pos+1)===b.colon?xe(n.doubleColon,2):(++u.pos,ue(n.colon));return;case b.questionMark:vp();return;case b.atSign:++u.pos,ue(n.at);return;case b.graveAccent:++u.pos,ue(n.backQuote);return;case b.digit0:{const e=q.charCodeAt(u.pos+1);if(e===b.lowercaseX||e===b.uppercaseX||e===b.lowercaseO||e===b.uppercaseO||e===b.lowercaseB||e===b.uppercaseB){kp();return}}case b.digit1:case b.digit2:case b.digit3:case b.digit4:case b.digit5:case b.digit6:case b.digit7:case b.digit8:case b.digit9:Bl(false);return;case b.quotationMark:case b.apostrophe:wp(t);return;case b.slash:dp();return;case b.percentSign:case b.asterisk:pp(t);return;case b.verticalBar:case b.ampersand:mp(t);return;case b.caret:gp();return;case b.plusSign:case b.dash:bp(t);return;case b.lessThan:yp();return;case b.greaterThan:Fl();return;case b.equalsTo:case b.exclamationMark:_p(t);return;case b.tilde:xe(n.tilde,1);return}le(`Unexpected character '${String.fromCharCode(t)}'`,u.pos)}function xe(t,e){u.pos+=e,ue(t)}function xp(){const t=u.pos;let e=false,s=false;for(;;){if(u.pos>=q.length){le("Unterminated regular expression",t);return}const i=q.charCodeAt(u.pos);if(e)e=false;else{if(i===b.leftSquareBracket)s=true;else if(i===b.rightSquareBracket&&s)s=false;else if(i===b.slash&&!s)break;e=i===b.backslash}++u.pos}++u.pos,Ep(),ue(n.regexp)}function $n(){for(;;){const t=q.charCodeAt(u.pos);if(t>=b.digit0&&t<=b.digit9||t===b.underscore)u.pos++;else break}}function kp(){for(u.pos+=2;;){const e=q.charCodeAt(u.pos);if(e>=b.digit0&&e<=b.digit9||e>=b.lowercaseA&&e<=b.lowercaseF||e>=b.uppercaseA&&e<=b.uppercaseF||e===b.underscore)u.pos++;else break}q.charCodeAt(u.pos)===b.lowercaseN?(++u.pos,ue(n.bigint)):ue(n.num)}function Bl(t){let e=false,s=false;t||$n();let i=q.charCodeAt(u.pos);if(i===b.dot&&(++u.pos,$n(),i=q.charCodeAt(u.pos)),(i===b.uppercaseE||i===b.lowercaseE)&&(i=q.charCodeAt(++u.pos),(i===b.plusSign||i===b.dash)&&++u.pos,$n(),i=q.charCodeAt(u.pos)),i===b.lowercaseN?(++u.pos,e=true):i===b.lowercaseM&&(++u.pos,s=true),e){ue(n.bigint);return}if(s){ue(n.decimal);return}ue(n.num)}function wp(t){for(u.pos++;;){if(u.pos>=q.length){le("Unterminated string constant");return}const e=q.charCodeAt(u.pos);if(e===b.backslash)u.pos++;else if(e===t)break;u.pos++}u.pos++,ue(n.string)}function Sp(){for(;;){if(u.pos>=q.length){le("Unterminated template");return}const t=q.charCodeAt(u.pos);if(t===b.graveAccent||t===b.dollarSign&&q.charCodeAt(u.pos+1)===b.leftCurlyBrace){if(u.pos===u.start&&p(n.template))if(t===b.dollarSign){u.pos+=2,ue(n.dollarBraceL);return}else{++u.pos,ue(n.backQuote);return}ue(n.template);return}t===b.backslash&&u.pos++,u.pos++}}function Ep(){for(;u.pos<q.length;){const t=q.charCodeAt(u.pos);if(_t[t])u.pos++;else if(t===b.backslash){if(u.pos+=2,q.charCodeAt(u.pos)===b.leftCurlyBrace){for(;u.pos<q.length&&q.charCodeAt(u.pos)!==b.rightCurlyBrace;)u.pos++;u.pos++}}else break}}function hi(t,e=t.currentIndex()){let s=e+1;if(Pi(t,s)){const i=t.identifierNameAtIndex(e);return{isType:false,leftName:i,rightName:i,endIndex:s}}if(s++,Pi(t,s))return{isType:true,leftName:null,rightName:null,endIndex:s};if(s++,Pi(t,s))return{isType:false,leftName:t.identifierNameAtIndex(e),rightName:t.identifierNameAtIndex(e+2),endIndex:s};if(s++,Pi(t,s))return{isType:true,leftName:null,rightName:null,endIndex:s};throw new Error(`Unexpected import/export specifier at ${e}`)}function Pi(t,e){const s=t.tokens[e];return s.type===n.braceR||s.type===n.comma}var Tp=new Map([["quot",'"'],["amp","&"],["apos","'"],["lt","<"],["gt",">"],["nbsp"," "],["iexcl","¡"],["cent","¢"],["pound","£"],["curren","¤"],["yen","¥"],["brvbar","¦"],["sect","§"],["uml","¨"],["copy","©"],["ordf","ª"],["laquo","«"],["not","¬"],["shy","­"],["reg","®"],["macr","¯"],["deg","°"],["plusmn","±"],["sup2","²"],["sup3","³"],["acute","´"],["micro","µ"],["para","¶"],["middot","·"],["cedil","¸"],["sup1","¹"],["ordm","º"],["raquo","»"],["frac14","¼"],["frac12","½"],["frac34","¾"],["iquest","¿"],["Agrave","À"],["Aacute","Á"],["Acirc","Â"],["Atilde","Ã"],["Auml","Ä"],["Aring","Å"],["AElig","Æ"],["Ccedil","Ç"],["Egrave","È"],["Eacute","É"],["Ecirc","Ê"],["Euml","Ë"],["Igrave","Ì"],["Iacute","Í"],["Icirc","Î"],["Iuml","Ï"],["ETH","Ð"],["Ntilde","Ñ"],["Ograve","Ò"],["Oacute","Ó"],["Ocirc","Ô"],["Otilde","Õ"],["Ouml","Ö"],["times","×"],["Oslash","Ø"],["Ugrave","Ù"],["Uacute","Ú"],["Ucirc","Û"],["Uuml","Ü"],["Yacute","Ý"],["THORN","Þ"],["szlig","ß"],["agrave","à"],["aacute","á"],["acirc","â"],["atilde","ã"],["auml","ä"],["aring","å"],["aelig","æ"],["ccedil","ç"],["egrave","è"],["eacute","é"],["ecirc","ê"],["euml","ë"],["igrave","ì"],["iacute","í"],["icirc","î"],["iuml","ï"],["eth","ð"],["ntilde","ñ"],["ograve","ò"],["oacute","ó"],["ocirc","ô"],["otilde","õ"],["ouml","ö"],["divide","÷"],["oslash","ø"],["ugrave","ù"],["uacute","ú"],["ucirc","û"],["uuml","ü"],["yacute","ý"],["thorn","þ"],["yuml","ÿ"],["OElig","Œ"],["oelig","œ"],["Scaron","Š"],["scaron","š"],["Yuml","Ÿ"],["fnof","ƒ"],["circ","ˆ"],["tilde","˜"],["Alpha","Α"],["Beta","Β"],["Gamma","Γ"],["Delta","Δ"],["Epsilon","Ε"],["Zeta","Ζ"],["Eta","Η"],["Theta","Θ"],["Iota","Ι"],["Kappa","Κ"],["Lambda","Λ"],["Mu","Μ"],["Nu","Ν"],["Xi","Ξ"],["Omicron","Ο"],["Pi","Π"],["Rho","Ρ"],["Sigma","Σ"],["Tau","Τ"],["Upsilon","Υ"],["Phi","Φ"],["Chi","Χ"],["Psi","Ψ"],["Omega","Ω"],["alpha","α"],["beta","β"],["gamma","γ"],["delta","δ"],["epsilon","ε"],["zeta","ζ"],["eta","η"],["theta","θ"],["iota","ι"],["kappa","κ"],["lambda","λ"],["mu","μ"],["nu","ν"],["xi","ξ"],["omicron","ο"],["pi","π"],["rho","ρ"],["sigmaf","ς"],["sigma","σ"],["tau","τ"],["upsilon","υ"],["phi","φ"],["chi","χ"],["psi","ψ"],["omega","ω"],["thetasym","ϑ"],["upsih","ϒ"],["piv","ϖ"],["ensp"," "],["emsp"," "],["thinsp"," "],["zwnj","‌"],["zwj","‍"],["lrm","‎"],["rlm","‏"],["ndash","–"],["mdash","—"],["lsquo","‘"],["rsquo","’"],["sbquo","‚"],["ldquo","“"],["rdquo","”"],["bdquo","„"],["dagger","†"],["Dagger","‡"],["bull","•"],["hellip","…"],["permil","‰"],["prime","′"],["Prime","″"],["lsaquo","‹"],["rsaquo","›"],["oline","‾"],["frasl","⁄"],["euro","€"],["image","ℑ"],["weierp","℘"],["real","ℜ"],["trade","™"],["alefsym","ℵ"],["larr","←"],["uarr","↑"],["rarr","→"],["darr","↓"],["harr","↔"],["crarr","↵"],["lArr","⇐"],["uArr","⇑"],["rArr","⇒"],["dArr","⇓"],["hArr","⇔"],["forall","∀"],["part","∂"],["exist","∃"],["empty","∅"],["nabla","∇"],["isin","∈"],["notin","∉"],["ni","∋"],["prod","∏"],["sum","∑"],["minus","−"],["lowast","∗"],["radic","√"],["prop","∝"],["infin","∞"],["ang","∠"],["and","∧"],["or","∨"],["cap","∩"],["cup","∪"],["int","∫"],["there4","∴"],["sim","∼"],["cong","≅"],["asymp","≈"],["ne","≠"],["equiv","≡"],["le","≤"],["ge","≥"],["sub","⊂"],["sup","⊃"],["nsub","⊄"],["sube","⊆"],["supe","⊇"],["oplus","⊕"],["otimes","⊗"],["perp","⊥"],["sdot","⋅"],["lceil","⌈"],["rceil","⌉"],["lfloor","⌊"],["rfloor","⌋"],["lang","〈"],["rang","〉"],["loz","◊"],["spades","♠"],["clubs","♣"],["hearts","♥"],["diams","♦"]]);function Ol(t){const[e,s]=kc(t.jsxPragma||"React.createElement"),[i,r]=kc(t.jsxFragmentPragma||"React.Fragment");return{base:e,suffix:s,fragmentBase:i,fragmentSuffix:r}}function kc(t){let e=t.indexOf(".");return e===-1&&(e=t.length),[t.slice(0,e),t.slice(e)]}class vt{getPrefixCode(){return""}getHoistedCode(){return""}getSuffixCode(){return""}}class ds extends vt{__init(){this.lastLineNumber=1}__init2(){this.lastIndex=0}__init3(){this.filenameVarName=null}__init4(){this.esmAutomaticImportNameResolutions={}}__init5(){this.cjsAutomaticModuleNameResolutions={}}constructor(e,s,i,r,a){super(),this.rootTransformer=e,this.tokens=s,this.importProcessor=i,this.nameManager=r,this.options=a,ds.prototype.__init.call(this),ds.prototype.__init2.call(this),ds.prototype.__init3.call(this),ds.prototype.__init4.call(this),ds.prototype.__init5.call(this),this.jsxPragmaInfo=Ol(a),this.isAutomaticRuntime=a.jsxRuntime==="automatic",this.jsxImportSource=a.jsxImportSource||"react"}process(){return this.tokens.matches1(n.jsxTagStart)?(this.processJSXTag(),true):false}getPrefixCode(){let e="";if(this.filenameVarName&&(e+=`const ${this.filenameVarName} = ${JSON.stringify(this.options.filePath||"")};`),this.isAutomaticRuntime)if(this.importProcessor)for(const[s,i]of Object.entries(this.cjsAutomaticModuleNameResolutions))e+=`var ${i} = require("${s}");`;else{const{createElement:s,...i}=this.esmAutomaticImportNameResolutions;s&&(e+=`import {createElement as ${s}} from "${this.jsxImportSource}";`);const r=Object.entries(i).map(([a,o])=>`${a} as ${o}`).join(", ");if(r){const a=this.jsxImportSource+(this.options.production?"/jsx-runtime":"/jsx-dev-runtime");e+=`import {${r}} from "${a}";`}}return e}processJSXTag(){const{jsxRole:e,start:s}=this.tokens.currentToken(),i=this.options.production?null:this.getElementLocationCode(s);this.isAutomaticRuntime&&e!==mt.KeyAfterPropSpread?this.transformTagToJSXFunc(i,e):this.transformTagToCreateElement(i)}getElementLocationCode(e){return`lineNumber: ${this.getLineNumberForIndex(e)}`}getLineNumberForIndex(e){const s=this.tokens.code;for(;this.lastIndex<e&&this.lastIndex<s.length;)s[this.lastIndex]===`
476
- `&&this.lastLineNumber++,this.lastIndex++;return this.lastLineNumber}transformTagToJSXFunc(e,s){const i=s===mt.StaticChildren;this.tokens.replaceToken(this.getJSXFuncInvocationCode(i));let r=null;if(this.tokens.matches1(n.jsxTagEnd))this.tokens.replaceToken(`${this.getFragmentCode()}, {`),this.processAutomaticChildrenAndEndProps(s);else{if(this.processTagIntro(),this.tokens.appendCode(", {"),r=this.processProps(true),this.tokens.matches2(n.slash,n.jsxTagEnd))this.tokens.appendCode("}");else if(this.tokens.matches1(n.jsxTagEnd))this.tokens.removeToken(),this.processAutomaticChildrenAndEndProps(s);else throw new Error("Expected either /> or > at the end of the tag.");r&&this.tokens.appendCode(`, ${r}`)}for(this.options.production||(r===null&&this.tokens.appendCode(", void 0"),this.tokens.appendCode(`, ${i}, ${this.getDevSource(e)}, this`)),this.tokens.removeInitialToken();!this.tokens.matches1(n.jsxTagEnd);)this.tokens.removeToken();this.tokens.replaceToken(")")}transformTagToCreateElement(e){if(this.tokens.replaceToken(this.getCreateElementInvocationCode()),this.tokens.matches1(n.jsxTagEnd))this.tokens.replaceToken(`${this.getFragmentCode()}, null`),this.processChildren(true);else if(this.processTagIntro(),this.processPropsObjectWithDevInfo(e),!this.tokens.matches2(n.slash,n.jsxTagEnd))if(this.tokens.matches1(n.jsxTagEnd))this.tokens.removeToken(),this.processChildren(true);else throw new Error("Expected either /> or > at the end of the tag.");for(this.tokens.removeInitialToken();!this.tokens.matches1(n.jsxTagEnd);)this.tokens.removeToken();this.tokens.replaceToken(")")}getJSXFuncInvocationCode(e){return this.options.production?e?this.claimAutoImportedFuncInvocation("jsxs","/jsx-runtime"):this.claimAutoImportedFuncInvocation("jsx","/jsx-runtime"):this.claimAutoImportedFuncInvocation("jsxDEV","/jsx-dev-runtime")}getCreateElementInvocationCode(){if(this.isAutomaticRuntime)return this.claimAutoImportedFuncInvocation("createElement","");{const{jsxPragmaInfo:e}=this;return`${this.importProcessor&&this.importProcessor.getIdentifierReplacement(e.base)||e.base}${e.suffix}(`}}getFragmentCode(){if(this.isAutomaticRuntime)return this.claimAutoImportedName("Fragment",this.options.production?"/jsx-runtime":"/jsx-dev-runtime");{const{jsxPragmaInfo:e}=this;return(this.importProcessor&&this.importProcessor.getIdentifierReplacement(e.fragmentBase)||e.fragmentBase)+e.fragmentSuffix}}claimAutoImportedFuncInvocation(e,s){const i=this.claimAutoImportedName(e,s);return this.importProcessor?`${i}.call(void 0, `:`${i}(`}claimAutoImportedName(e,s){if(this.importProcessor){const i=this.jsxImportSource+s;return this.cjsAutomaticModuleNameResolutions[i]||(this.cjsAutomaticModuleNameResolutions[i]=this.importProcessor.getFreeIdentifierForPath(i)),`${this.cjsAutomaticModuleNameResolutions[i]}.${e}`}else return this.esmAutomaticImportNameResolutions[e]||(this.esmAutomaticImportNameResolutions[e]=this.nameManager.claimFreeName(`_${e}`)),this.esmAutomaticImportNameResolutions[e]}processTagIntro(){let e=this.tokens.currentIndex()+1;for(;this.tokens.tokens[e].isType||!this.tokens.matches2AtIndex(e-1,n.jsxName,n.jsxName)&&!this.tokens.matches2AtIndex(e-1,n.greaterThan,n.jsxName)&&!this.tokens.matches1AtIndex(e,n.braceL)&&!this.tokens.matches1AtIndex(e,n.jsxTagEnd)&&!this.tokens.matches2AtIndex(e,n.slash,n.jsxTagEnd);)e++;if(e===this.tokens.currentIndex()+1){const s=this.tokens.identifierName();Vl(s)&&this.tokens.replaceToken(`'${s}'`)}for(;this.tokens.currentIndex()<e;)this.rootTransformer.processToken()}processPropsObjectWithDevInfo(e){const s=this.options.production?"":`__self: this, __source: ${this.getDevSource(e)}`;if(!this.tokens.matches1(n.jsxName)&&!this.tokens.matches1(n.braceL)){s?this.tokens.appendCode(`, {${s}}`):this.tokens.appendCode(", null");return}this.tokens.appendCode(", {"),this.processProps(false),s?this.tokens.appendCode(` ${s}}`):this.tokens.appendCode("}")}processProps(e){let s=null;for(;;){if(this.tokens.matches2(n.jsxName,n.eq)){const i=this.tokens.identifierName();if(e&&i==="key"){s!==null&&this.tokens.appendCode(s.replace(/[^\n]/g,"")),this.tokens.removeToken(),this.tokens.removeToken();const r=this.tokens.snapshot();this.processPropValue(),s=this.tokens.dangerouslyGetAndRemoveCodeSinceSnapshot(r);continue}else this.processPropName(i),this.tokens.replaceToken(": "),this.processPropValue()}else if(this.tokens.matches1(n.jsxName)){const i=this.tokens.identifierName();this.processPropName(i),this.tokens.appendCode(": true")}else if(this.tokens.matches1(n.braceL))this.tokens.replaceToken(""),this.rootTransformer.processBalancedCode(),this.tokens.replaceToken("");else break;this.tokens.appendCode(",")}return s}processPropName(e){e.includes("-")?this.tokens.replaceToken(`'${e}'`):this.tokens.copyToken()}processPropValue(){this.tokens.matches1(n.braceL)?(this.tokens.replaceToken(""),this.rootTransformer.processBalancedCode(),this.tokens.replaceToken("")):this.tokens.matches1(n.jsxTagStart)?this.processJSXTag():this.processStringPropValue()}processStringPropValue(){const e=this.tokens.currentToken(),s=this.tokens.code.slice(e.start+1,e.end-1),i=wc(s),r=Cp(s);this.tokens.replaceToken(r+i)}processAutomaticChildrenAndEndProps(e){e===mt.StaticChildren?(this.tokens.appendCode(" children: ["),this.processChildren(false),this.tokens.appendCode("]}")):(e===mt.OneChild&&this.tokens.appendCode(" children: "),this.processChildren(false),this.tokens.appendCode("}"))}processChildren(e){let s=e;for(;;){if(this.tokens.matches2(n.jsxTagStart,n.slash))return;let i=false;if(this.tokens.matches1(n.braceL))this.tokens.matches2(n.braceL,n.braceR)?(this.tokens.replaceToken(""),this.tokens.replaceToken("")):(this.tokens.replaceToken(s?", ":""),this.rootTransformer.processBalancedCode(),this.tokens.replaceToken(""),i=true);else if(this.tokens.matches1(n.jsxTagStart))this.tokens.appendCode(s?", ":""),this.processJSXTag(),i=true;else if(this.tokens.matches1(n.jsxText)||this.tokens.matches1(n.jsxEmptyText))i=this.processChildTextElement(s);else throw new Error("Unexpected token when processing JSX children.");i&&(s=true)}}processChildTextElement(e){const s=this.tokens.currentToken(),i=this.tokens.code.slice(s.start,s.end),r=wc(i),a=Ap(i);return a==='""'?(this.tokens.replaceToken(r),false):(this.tokens.replaceToken(`${e?", ":""}${a}${r}`),true)}getDevSource(e){return`{fileName: ${this.getFilenameVarName()}, ${e}}`}getFilenameVarName(){return this.filenameVarName||(this.filenameVarName=this.nameManager.claimFreeName("_jsxFileName")),this.filenameVarName}}function Vl(t){const e=t.charCodeAt(0);return e>=b.lowercaseA&&e<=b.lowercaseZ}function Ap(t){let e="",s="",i=false,r=false;for(let a=0;a<t.length;a++){const o=t[a];if(o===" "||o===" "||o==="\r")i||(s+=o);else if(o===`
477
- `)s="",i=true;else{if(r&&i&&(e+=" "),e+=s,s="",o==="&"){const{entity:c,newI:l}=$l(t,a+1);a=l-1,e+=c}else e+=o;r=true,i=false}}return i||(e+=s),JSON.stringify(e)}function wc(t){let e=0,s=0;for(const i of t)i===`
471
+ }`;let Qe=null,Ri=false,er=null,fc=null;function Pd(){er=null}function vl(){if(Qe){try{Qe.texHorizontal?.destroy(),Qe.texVertical?.destroy(),Qe.quadBuf.destroy()}catch{}Qe=null}}function dc(t,e){const s=t.createTexture({size:{width:e.bufW,height:e.bufH},format:"rgba8unorm",usage:22});return t.queue.copyExternalImageToTexture({source:e.canvas},{texture:s,premultipliedAlpha:true},{width:e.bufW,height:e.bufH}),s}function Ld(t,e){if(t===er)return null;if(Qe&&Qe.device===t&&Qe.format===e)return Qe;vl();const s=t.createShaderModule({code:Rd}),i={color:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"}},r=t.createRenderPipeline({layout:"auto",vertex:{module:s,entryPoint:"vs",buffers:[{arrayStride:16,attributes:[{shaderLocation:0,offset:0,format:"float32x2"},{shaderLocation:1,offset:8,format:"float32x2"}]}]},fragment:{module:s,entryPoint:"fs",targets:[{format:e,blend:i}]},primitive:{topology:"triangle-strip"}}),o=t.createSampler({magFilter:"linear",minFilter:"linear"}),a=t.createBuffer({size:4*16,usage:40}),c=d=>t.createBindGroup({layout:r.getBindGroupLayout(0),entries:[{binding:0,resource:o},{binding:1,resource:d.createView()}]}),l=ci?dc(t,ci):null,h=ui?dc(t,ui):null;return Qe={device:t,format:e,pipeline:r,sampler:o,texHorizontal:l,texVertical:h,bindHorizontal:l?c(l):null,bindVertical:h?c(h):null,quadBuf:a},fc!==t&&(fc=t,t.lost.then(()=>{Qe&&Qe.device===t&&(Qe=null)}).catch(()=>{})),Qe}function Dd(t,e,s,i,r,o=1){if(r>=1)return;const a=_l(Wo,i.width,i.height,o||1);if(a)try{const c=Ld(e,s);if(!c)return;const l=a.vertical?c.bindVertical:c.bindHorizontal;if(!l)return;const h=i.width,d=i.height,m=a.px/h*2-1,_=(a.px+a.w)/h*2-1,x=1-a.py/d*2,E=1-(a.py+a.h)/d*2,N=new Float32Array([m,x,0,0,_,x,1,0,m,E,0,1,_,E,1,1]);e.queue.writeBuffer(c.quadBuf,0,N),e.pushErrorScope("validation");const F=e.createCommandEncoder(),U=F.beginRenderPass({colorAttachments:[{view:t.getCurrentTexture().createView(),loadOp:"load",storeOp:"store"}]});U.setPipeline(c.pipeline),U.setBindGroup(0,l),U.setVertexBuffer(0,c.quadBuf),U.draw(4),U.end(),e.queue.submit([F.finish()]),e.popErrorScope().then(P=>{P&&!Ri&&(Ri=true,console.warn("[Viji] overlay: webgpu validation error",P.message))}).catch(()=>{})}catch(c){(!Ri||er!==e)&&(Ri=true,console.warn("[Viji] overlay: webgpu pass failed",c)),er=e,vl()}}const xl=34229;function Nd(t){const e=t;if(typeof e.createVertexArray=="function")return{create:()=>e.createVertexArray(),bind:i=>e.bindVertexArray(i)};const s=t.getExtension("OES_vertex_array_object");return s?{create:()=>s.createVertexArrayOES(),bind:i=>s.bindVertexArrayOES(i)}:null}function pc(t,e){if(!e)return null;const s=t.getParameter(t.TEXTURE_BINDING_2D),i=t.getParameter(t.UNPACK_FLIP_Y_WEBGL),r=t.getParameter(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL);t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,1),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,0);const o=t.createTexture();return t.bindTexture(t.TEXTURE_2D,o),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,e),t.bindTexture(t.TEXTURE_2D,s),t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,i?1:0),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,r?1:0),o}function Fd(t){if(co===t)return;co=t,$t=null,Ui=0,Mi=0,rs=null,ll=pc(t,ci?.canvas??null),hl=pc(t,ui?.canvas??null);const e=t.createShader(t.VERTEX_SHADER);t.shaderSource(e,Td),t.compileShader(e);const s=t.createShader(t.FRAGMENT_SHADER);if(t.shaderSource(s,Ad),t.compileShader(s),We=t.createProgram(),t.attachShader(We,e),t.attachShader(We,s),t.bindAttribLocation(We,0,"a_pos"),t.bindAttribLocation(We,1,"a_uv"),t.linkProgram(We),t.deleteShader(e),t.deleteShader(s),!t.getProgramParameter(We,t.LINK_STATUS)){console.warn("[Viji] overlay: shader link failed"),We=null;return}if(Ds=t.createBuffer(),jt=t.getAttribLocation(We,"a_pos"),qt=t.getAttribLocation(We,"a_uv"),Jt=Nd(t),Jt){const i=t.getParameter(xl),r=t.getParameter(t.ARRAY_BUFFER_BINDING);Qi=Jt.create(),Jt.bind(Qi),t.bindBuffer(t.ARRAY_BUFFER,Ds),jt>=0&&(t.enableVertexAttribArray(jt),t.vertexAttribPointer(jt,2,t.FLOAT,false,16,0)),qt>=0&&(t.enableVertexAttribArray(qt),t.vertexAttribPointer(qt,2,t.FLOAT,false,16,8)),Jt.bind(i),t.bindBuffer(t.ARRAY_BUFFER,r)}}function mc(t,e){return{index:e,buffer:t.getVertexAttrib(e,t.VERTEX_ATTRIB_ARRAY_BUFFER_BINDING),enabled:t.getVertexAttrib(e,t.VERTEX_ATTRIB_ARRAY_ENABLED),size:t.getVertexAttrib(e,t.VERTEX_ATTRIB_ARRAY_SIZE),type:t.getVertexAttrib(e,t.VERTEX_ATTRIB_ARRAY_TYPE),normalized:t.getVertexAttrib(e,t.VERTEX_ATTRIB_ARRAY_NORMALIZED),stride:t.getVertexAttrib(e,t.VERTEX_ATTRIB_ARRAY_STRIDE),offset:t.getVertexAttribOffset(e,t.VERTEX_ATTRIB_ARRAY_POINTER),currentValue:t.getVertexAttrib(e,t.CURRENT_VERTEX_ATTRIB)}}function gc(t,e){e.buffer&&(t.bindBuffer(t.ARRAY_BUFFER,e.buffer),t.vertexAttribPointer(e.index,e.size,e.type,e.normalized,e.stride,e.offset)),e.enabled?t.enableVertexAttribArray(e.index):t.disableVertexAttribArray(e.index),t.vertexAttrib4f(e.index,e.currentValue[0],e.currentValue[1],e.currentValue[2],e.currentValue[3])}function Ud(t,e,s){const i=t===yt;i&&_d(t);const r=i?pl(s.px,s.py,s.w,s.h,e.width,e.height):null;r&&Sd(r.w,r.h)?(Ns.clearRect(0,0,r.w,r.h),Ns.drawImage(e,r.x,r.y,r.w,r.h,0,0,r.w,r.h),Fs=r,fl=e.width,dl=e.height,Vt={buffer:s.buffer.canvas,dx:s.px-r.x,dy:s.py-r.y,dw:s.w,dh:s.h}):(Fs=null,Vt=null),gl(t),ml(t),yl(t,s.buffer.canvas,s.px,s.py,s.w,s.h),bl(t),Go=Sr}function Md(t,e,s){if(Fd(t),!We||!Ds)return;const i=s.vertical?hl:ll;if(!i)return;const r=pl(s.px,s.py,s.w,s.h,e.width,e.height);r&&xd(t)?Ed(t,e,r):rs=null,kl(t,e,i,{x:s.px,y:s.py,w:s.w,h:s.h},true)}function kl(t,e,s,i,r){if(!We||!Ds)return;const o=e.width,a=e.height,c=i.x/o*2-1,l=1-(i.y+i.h)/a*2,h=(i.x+i.w)/o*2-1,d=1-i.y/a*2,m=!!(Jt&&Qi),_=t.getParameter(t.CURRENT_PROGRAM),x=t.getParameter(t.ACTIVE_TEXTURE);t.activeTexture(t.TEXTURE0);const E=t.getParameter(t.TEXTURE_BINDING_2D),N=t.getParameter(t.ARRAY_BUFFER_BINDING),F=t.getParameter(t.FRAMEBUFFER_BINDING),U=t,P=typeof U.createVertexArray=="function",X=P?t.getParameter(U.READ_FRAMEBUFFER_BINDING):null,$=t.getParameter(t.VIEWPORT),te=t.isEnabled(t.BLEND),ee=t.getParameter(t.BLEND_SRC_RGB),Q=t.getParameter(t.BLEND_DST_RGB),z=t.getParameter(t.BLEND_SRC_ALPHA),ne=t.getParameter(t.BLEND_DST_ALPHA),v=t.getParameter(t.BLEND_EQUATION_RGB),y=t.getParameter(t.BLEND_EQUATION_ALPHA),k=t.isEnabled(t.DEPTH_TEST),V=t.isEnabled(t.SCISSOR_TEST),G=t.isEnabled(t.STENCIL_TEST),O=t.isEnabled(t.CULL_FACE),R=t.getParameter(t.COLOR_WRITEMASK),B=t.getParameter(t.UNPACK_FLIP_Y_WEBGL),M=m?t.getParameter(xl):null,C=!m&&jt>=0?mc(t,jt):null,H=!m&&qt>=0?mc(t,qt):null;t.bindFramebuffer(t.FRAMEBUFFER,null),t.viewport(0,0,o,a),t.useProgram(We),r?(t.enable(t.BLEND),t.blendEquation(t.FUNC_ADD),t.blendFuncSeparate(t.SRC_ALPHA,t.ONE_MINUS_SRC_ALPHA,t.ONE,t.ONE_MINUS_SRC_ALPHA)):t.disable(t.BLEND),t.disable(t.DEPTH_TEST),t.disable(t.SCISSOR_TEST),t.disable(t.STENCIL_TEST),t.disable(t.CULL_FACE),t.colorMask(true,true,true,true),t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,0),t.bindTexture(t.TEXTURE_2D,s),t.uniform1i(t.getUniformLocation(We,"u_tex"),0),t.uniform1f(t.getUniformLocation(We,"u_alpha"),1);const W=new Float32Array([c,l,0,0,h,l,1,0,c,d,0,1,c,d,0,1,h,l,1,0,h,d,1,1]);m?(Jt.bind(Qi),t.bindBuffer(t.ARRAY_BUFFER,Ds),t.bufferData(t.ARRAY_BUFFER,W,t.DYNAMIC_DRAW)):(t.bindBuffer(t.ARRAY_BUFFER,Ds),t.bufferData(t.ARRAY_BUFFER,W,t.DYNAMIC_DRAW),jt>=0&&(t.enableVertexAttribArray(jt),t.vertexAttribPointer(jt,2,t.FLOAT,false,16,0)),qt>=0&&(t.enableVertexAttribArray(qt),t.vertexAttribPointer(qt,2,t.FLOAT,false,16,8))),t.drawArrays(t.TRIANGLES,0,6),m?Jt.bind(M):(H&&gc(t,H),C&&gc(t,C)),t.bindFramebuffer(t.FRAMEBUFFER,F),P&&U.bindFramebuffer(U.READ_FRAMEBUFFER,X),t.viewport($[0],$[1],$[2],$[3]),t.bindBuffer(t.ARRAY_BUFFER,N),t.colorMask(R[0],R[1],R[2],R[3]),t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,B?1:0),V?t.enable(t.SCISSOR_TEST):t.disable(t.SCISSOR_TEST),G?t.enable(t.STENCIL_TEST):t.disable(t.STENCIL_TEST),O?t.enable(t.CULL_FACE):t.disable(t.CULL_FACE),k?t.enable(t.DEPTH_TEST):t.disable(t.DEPTH_TEST),te?t.enable(t.BLEND):t.disable(t.BLEND),t.blendFuncSeparate(ee,Q,z,ne),t.blendEquationSeparate(v,y),t.activeTexture(t.TEXTURE0),t.bindTexture(t.TEXTURE_2D,E),t.activeTexture(x),t.useProgram(_)}class Xo{canvas=null;ctx=null;gl=null;contextAcquired=false;gpuCtx=null;gpuDevice=null;gpuFormat=null;gpuTextureAcquiredThisFrame=false;brCtx=null;brCleanScratch=null;brCleanCtx=null;brPresentScratch=null;brPresentCtx=null;isRunning=false;renderLoopPaused=false;rafScheduled=false;frameCount=0;lastTime=0;startTime=0;frameRateMode="full";frameSkipCounter=0;screenRefreshRate=60;debugMode=false;p5Adapter=null;shaderAdapter=null;rendererType="native";_isHeadless=false;_displayScale=1;sceneErrorReporter=null;controlPort=null;pendingCaptures=[];static CAPTURE_QUEUE_TTL_MS=1e4;setSceneErrorReporter(e){this.sceneErrorReporter=e}getSceneErrorReporter(){return this.sceneErrorReporter}setDebugMode(e){this.debugMode=e,this.videoSystems.forEach(s=>s?.setDebugMode(e)),this.parameterSystem&&"setDebugMode"in this.parameterSystem&&this.parameterSystem.setDebugMode(e),this.interactionSystem&&"setDebugMode"in this.interactionSystem&&this.interactionSystem.setDebugMode(e)}debugLog(e,...s){this.debugMode&&console.log(e,...s)}effectiveFrameTimes=[];lastEffectiveRateReport=0;effectiveRateReportInterval=1e3;fetchCacheClient;parameterSystem;interactionSystem;capabilityMonitor=new vf;benchmark=null;videoSystems=[];autoCaptureEnabled=false;autoCaptureFormat={flipY:true,frame:"plate"};audioFrequencyData=new Uint8Array(0);audioWaveformData=new Float32Array(0);deviceState={device:{motion:null,orientation:null},devices:[]};deviceVideoMap=new Map;audioStreamStates=new Map;deviceAudioMap=new Map;viji={canvas:null,ctx:null,gl:null,gpu:null,width:0,height:0,time:0,deltaTime:0,frameCount:0,fps:60,audio:{isConnected:false,volume:{current:0,peak:0,smoothed:0},bands:{low:0,lowMid:0,mid:0,highMid:0,high:0,lowSmoothed:0,lowMidSmoothed:0,midSmoothed:0,highMidSmoothed:0,highSmoothed:0},beat:{kick:0,snare:0,hat:0,any:0,kickSmoothed:0,snareSmoothed:0,hatSmoothed:0,anySmoothed:0,triggers:{any:false,kick:false,snare:false,hat:false},events:[],bpm:0,confidence:0,isLocked:false},spectral:{brightness:0,flatness:0},getFrequencyData:()=>new Uint8Array(0),getWaveform:()=>new Float32Array(0)},video:{isConnected:false,currentFrame:null,frameWidth:0,frameHeight:0,frameRate:0,getFrameData:()=>null,cv:null},videoStreams:[],audioStreams:[],mouse:{},keyboard:{},touches:{},device:{motion:null,orientation:null},devices:[],slider:(e,s)=>this.parameterSystem.createSliderParameter(e,s),color:(e,s)=>this.parameterSystem.createColorParameter(e,s),toggle:(e,s)=>this.parameterSystem.createToggleParameter(e,s),select:(e,s)=>this.parameterSystem.createSelectParameter(e,s),text:(e,s)=>this.parameterSystem.createTextParameter(e,s),number:(e,s)=>this.parameterSystem.createNumberParameter(e,s),image:(e,s)=>this.parameterSystem.createImageParameter(e,s),button:e=>this.parameterSystem.createButtonParameter(e),coordinate:(e,s)=>this.parameterSystem.createCoordinateParameter(e,s),gradient:(e,s)=>this.parameterSystem.createGradientParameter(e,s),useContext:e=>e==="webgpu"?this.canvas?this.canvas.getContext("webgpu"):null:e==="2d"?(!this.ctx&&this.canvas&&(this.ctx=this.canvas.getContext("2d"),this.viji.ctx=this.ctx),this.ctx):e==="webgl"||e==="webgl2"?(!this.gl&&this.canvas&&(this.gl=e==="webgl2"?this.canvas.getContext("webgl2"):this.canvas.getContext("webgl"),this.viji.gl=this.gl,this.gl&&this.gl.viewport(0,0,this.viji.width,this.viji.height)),this.gl):null};constructor(){this.fetchCacheClient=new nh((e,s)=>{this.postMessage(e,s)}),this.parameterSystem=new ff((e,s)=>{this.postMessage(e,s)}),this.interactionSystem=new df,this.videoSystems[0]=new Ti,this.videoSystems[0].setCVMessaging(0,(e,s)=>{this.postMessage("cv-feature-request",{streamIndex:e,desired:s})}),this.viji.video.cv=this.videoSystems[0].getCvSurface(),Object.assign(this.viji,this.interactionSystem.getInteractionAPIs()),this.viji.audio.getFrequencyData=()=>this.audioFrequencyData,this.viji.audio.getWaveform=()=>this.audioWaveformData,this.capabilityMonitor.setTransitionCallback(e=>{this.postMessage("capability-transition",e)}),this.setupMessageHandling()}setCapabilityUsageMask(e){this.capabilityMonitor.setUsageMask(e)}gatherCapabilityInput(e,s,i){const r=this.interactionSystem.getMouseState(),o=this.interactionSystem.getPointerState(),a=this.videoSystems[0]?this.videoSystems[0].getCVActivity():{faceDetection:{active:false,meaningful:false},faceMesh:{active:false,meaningful:false},emotion:{active:false,meaningful:false},handTracking:{active:false,meaningful:false},poseDetection:{active:false,meaningful:false},segmentation:{active:false,meaningful:false}};return{frameIndex:this.frameCount,timestamp:e,cpuMs:s,frameIntervalMs:i,audioConnected:this.viji.audio.isConnected,videoConnected:this.viji.video.isConnected,sensorsConnected:this.deviceState.device.motion!==null||this.deviceState.device.orientation!==null,devicesConnected:this.deviceState.devices.length>0,mouse:{isInCanvas:r.isInCanvas,leftButton:r.leftButton,rightButton:r.rightButton,middleButton:r.middleButton},pointer:{isDown:o.isDown,isInCanvas:o.isInCanvas,active:o.type!=="none"},touchCount:this.interactionSystem.getTouchCount(),keyboardConsumed:this.interactionSystem.getKeyboardConsumed(),cv:a}}recordCapabilityFrame(e,s,i){this.capabilityMonitor.recordFrame(this.gatherCapabilityInput(e,s,i))}getContextAndFinish(){const e=this.gl;return e&&e.finish(),e}detectContextType(){if(this.gpuCtx&&this.gpuDevice)return"webgpu";if(this.gl)return typeof WebGL2RenderingContext<"u"&&this.gl instanceof WebGL2RenderingContext?"webgl2":"webgl";if(this.ctx)return"2d"}trackWebGPUContext(e){if(this.gpuCtx===e)return;this.gpuCtx=e;const s=e.configure.bind(e),i=e.unconfigure.bind(e),r=e.getCurrentTexture.bind(e);e.configure=o=>{s(o);const a=this.gpuDevice!==o.device;this.gpuDevice=o.device,this.gpuFormat=o.format,Pd(),a&&o.device.lost.then(()=>{this.gpuDevice===o.device&&(this.gpuDevice=null,this.gpuFormat=null)}).catch(()=>{})},e.unconfigure=()=>{i(),this.gpuDevice=null,this.gpuFormat=null},e.getCurrentTexture=()=>(this.gpuTextureAcquiredThisFrame=true,r())}wrapBitmapRenderer(e){if(this.brCtx===e)return;this.brCtx=e;const s=e.transferFromImageBitmap.bind(e);e.transferFromImageBitmap=i=>{const r=oc("b",0);if(!i||r>=1||this._isHeadless){this.brCleanScratch=null,s(i);return}try{const o=i.width,a=i.height;if((!this.brCleanScratch||this.brCleanScratch.width!==o||this.brCleanScratch.height!==a)&&(this.brCleanScratch=new OffscreenCanvas(o,a),this.brCleanCtx=this.brCleanScratch.getContext("2d"),this.brPresentScratch=new OffscreenCanvas(o,a),this.brPresentCtx=this.brPresentScratch.getContext("2d")),!this.brCleanCtx||!this.brPresentCtx||!this.brPresentScratch){this.brCleanScratch=null,s(i);return}this.brCleanCtx.clearRect(0,0,o,a),this.brCleanCtx.drawImage(i,0,0),this.brPresentCtx.drawImage(i,0,0),hc(this.brPresentScratch,this.brPresentCtx,null,r,this._displayScale);const c=this.brPresentScratch.transferToImageBitmap();try{s(c)}catch(l){throw c.close(),l}i.close()}catch(o){this.debugLog("bitmaprenderer overlay composite failed",o),this.brCleanScratch=null;try{s(i)}catch{}}}}plateCaptureSource(e){return e!=="display"&&this.brCleanScratch?this.brCleanScratch:this.canvas}fence2dCanvas(){const e=this.ctx;if(!e)return null;try{const s=performance.now();return e.getImageData(0,0,1,1),performance.now()-s}catch{return null}}fenceWebGLReadback(e){try{e.readPixels(0,0,1,1,e.RGBA,e.UNSIGNED_BYTE,new Uint8Array(4))}catch{}}handleRunFencedBenchmark(e){const s=Math.max(1,Math.floor(e.data.frameCount));if(this.benchmark){this.postMessage("error",{id:e.id,message:"A fenced benchmark is already running",code:"BENCHMARK_BUSY"});return}this.benchmark={id:e.id,remaining:s,samples:[],lastTimestamp:null}}recordBenchmarkFrame(e,s){const i=this.benchmark;if(!i)return;const r=performance.now(),o=this.getContextAndFinish();o&&this.fenceWebGLReadback(o);const a=o?performance.now()-r:this.fence2dCanvas(),c=i.lastTimestamp===null?0:e-i.lastTimestamp;i.lastTimestamp=e;const l=this.capabilityMonitor.evaluate(this.gatherCapabilityInput(e,s,c));i.samples.push({frameIndex:this.frameCount,timestamp:e,cpuMs:s,gpuMs:a,frameIntervalMs:c,capabilities:l}),i.remaining--,i.remaining<=0&&(this.postMessage("run-fenced-benchmark-result",{id:i.id,frames:i.samples}),this.benchmark=null)}async initP5Mode(e,s,i){try{this.rendererType="p5",this.debugLog("🎨 Initializing P5.js mode..."),this.p5Adapter=new Df(this.canvas,this.viji,{setup:e,render:s,canvasMode:i?.canvasMode==="webgl"?"webgl":"2d"}),await this.p5Adapter.init(),this.debugLog("✅ P5.js mode initialized successfully")}catch(r){throw console.error("❌ Failed to initialize P5.js mode:",r),this.p5Adapter=null,r}}async initShaderMode(e,s){try{this.rendererType="shader",this.debugLog("🎨 Initializing Shader mode..."),this.shaderAdapter=new je(this.canvas,this.viji,e,s?.redactDriverInfoLogs??false),await this.shaderAdapter.init();const i=this.shaderAdapter.getParameterDefinitions();for(const r of i)this.registerShaderParameter(r);this.debugLog("✅ Shader mode initialized successfully")}catch(i){throw console.error("❌ Failed to initialize Shader mode:",i),this.shaderAdapter=null,this.videoSystems.forEach((r,o)=>{r&&As(o)==="directFrame"&&r.initializeForDirectFrames(this.directFrameConsumerType())}),i}}directFrameConsumerType(){return this.shaderAdapter&&this.rendererType==="shader"?"shader":"native"}registerShaderParameter(e){if(e.type==="accumulator")return;const s=e.config,i={...s,name:e.uniformName,label:e.label,description:s.description??""};switch(i.name!==e.uniformName&&(console.error(`[viji] Shader parameter identity mismatch for uniform "${e.uniformName}" — forcing name = uniformName.`),i.name=e.uniformName),e.type){case"slider":this.viji.slider(s.default,i);break;case"number":this.viji.number(s.default,i);break;case"color":this.viji.color(s.default,i);break;case"toggle":this.viji.toggle(s.default,i);break;case"select":this.viji.select(s.default,{...i,options:s.options});break;case"image":this.viji.image(null,i);break;case"button":this.viji.button(i);break;case"coordinate":{const r=Array.isArray(s.default)?s.default:[0,0];this.viji.coordinate({x:r[0],y:r[1]},i);break}case"gradient":this.viji.gradient(s.default,i);break;case"cv":{if(Object.keys(s).length===0)break;this.viji.toggle(s.default,i);break}}}resetParameterState(){this.parameterSystem.resetParameterState(),this.interactionSystem.resetInteractionState(),this.resetAudioState(),this.videoSystems.forEach(e=>e?.resetVideoState()),this.videoSystems[0]&&Object.assign(this.viji.video,this.videoSystems[0].getVideoAPI()),this.updateVijiVideoStreams()}updateVijiVideoStreams(){const e=[],s=[];this.videoSystems.forEach((r,o)=>{if(!r)return;const a=As(o);a==="additional"?e.push(r):a==="directFrame"&&s.push(r)});const i=[...e,...s].map(r=>r.getVideoAPI());this.viji.videoStreams.length=i.length;for(let r=0;r<i.length;r++)this.viji.videoStreams[r]=i[r];this.debugLogStreamTable()}lastStreamTableSignature="";debugLogStreamTable(){if(!this.debugMode)return;const e=[];this.videoSystems.forEach((i,r)=>{if(!i)return;const o=i.peekDebugState();e.push(`${r}:${As(r)}${o.isConnected?" connected":""}${o.hasFrame?" frame":""}`)});const s=`[${e.join(", ")}] → videoStreams(${this.viji.videoStreams.length})`;s!==this.lastStreamTableSignature&&(this.lastStreamTableSignature=s,this.debugLog(`[Streams] ${s}`))}updateVijiAudioStreams(){const e=[];for(const[s,i]of this.audioStreamStates)s>=_f&&s<Ga&&e.push({index:s,...i});e.sort((s,i)=>s.index-i.index),this.viji.audioStreams.length=e.length;for(let s=0;s<e.length;s++){const i=e[s],r=i.frequencyData,o=i.waveformData;this.viji.audioStreams[s]={isConnected:i.isConnected,volume:i.volume,bands:i.bands,spectral:i.spectral,getFrequencyData:()=>r,getWaveform:()=>o}}}sendAllParametersToHost(){this.parameterSystem.sendAllParametersToHost()}seedInitialValues(e){this.parameterSystem.seedInitialValues(e)}releaseSeedBitmaps(e){this.parameterSystem.releaseSeedBitmaps(e)}setupMessageHandling(){self.onmessage=e=>{this.dispatchMessage(e.data)}}dispatchMessage(e){switch(e.type){case"init":this.handleInit(e).catch(s=>console.error("[Viji] handleInit failed:",s));break;case"frame-rate-update":this.handleFrameRateUpdate(e);break;case"refresh-rate-update":this.handleRefreshRateUpdate(e);break;case"cv-results-update":this.handleCVResultsUpdate(e);break;case"resolution-update":this.handleResolutionUpdate(e);break;case"set-scene-code":this.handleSetSceneCode(e);break;case"debug-mode":this.setDebugMode(e.data.enabled);break;case"parameter-update":this.handleParameterUpdate(e);break;case"parameter-batch-update":this.handleParameterBatchUpdate(e);break;case"audio-analysis-update":this.handleAudioAnalysisUpdate(e);break;case"audio-stream-setup":this.handleAudioStreamSetup(e);break;case"video-canvas-setup":this.handleVideoCanvasSetup(e);break;case"video-frame-update":this.handleVideoFrameUpdate(e);break;case"video-config-update":this.handleVideoConfigUpdate(e);break;case"video-streams-prepare":this.handleVideoStreamsPrepare(e);break;case"video-frame-direct":this.handleVideoFrameDirect(e);break;case"enable-auto-capture":this.autoCaptureEnabled=e.data.enabled,e.data.flipY!==void 0&&(this.autoCaptureFormat.flipY=e.data.flipY),e.data.frame!==void 0&&(this.autoCaptureFormat.frame=e.data.frame==="display"?"display":"plate"),this.debugLog(`[AutoCapture] ${e.data.enabled?"ENABLED":"DISABLED"} (flipY=${this.autoCaptureFormat.flipY}, frame=${this.autoCaptureFormat.frame})`);break;case"enable-capability-reporting":this.capabilityMonitor.setEnabled(e.data.enabled);break;case"set-render-loop-paused":this.setRenderLoopPaused(e.data.paused);break;case"run-fenced-benchmark":this.handleRunFencedBenchmark(e);break;case"mouse-update":this.handleMouseUpdate(e);break;case"keyboard-update":this.handleKeyboardUpdate(e);break;case"touch-update":this.handleTouchUpdate(e);break;case"interaction-enabled":this.handleInteractionEnabled(e);break;case"device-state-update":this.handleDeviceStateUpdate(e);break;case"performance-update":this.handlePerformanceUpdate(e);break;case"capture-frame":this.handleCaptureFrame(e);break;case"sc-update":nc(e.data.t);break;case"rh-update":lc(e.data.h);break;case"cached-fetch-begin":this.fetchCacheClient.handleBegin(e.data);break;case"cached-fetch-chunk":this.fetchCacheClient.handleChunk(e.data);break;case"cached-fetch-end":this.fetchCacheClient.handleEnd(e.data);break;case"cached-fetch-direct":this.fetchCacheClient.handleDirect(e.data);break;case"cached-fetch-wait":this.fetchCacheClient.handleWait(e.data);break;case"cached-fetch-error":this.fetchCacheClient.handleError(e.data);break}}async handleInit(e){try{this.canvas=e.data.canvas,this.viji.canvas=this.canvas,this._isHeadless=!!e.data.isHeadless,e.data.reporterConfig&&this.sceneErrorReporter&&this.sceneErrorReporter.applyConfig(e.data.reporterConfig);const s=this.canvas.getContext.bind(this.canvas);this.canvas.getContext=(i,r)=>{const o=s(i,r);return o&&(this.contextAcquired=true,i==="2d"?(this.ctx=o,this.viji.ctx=this.ctx,yd(this.ctx)):i==="webgl"||i==="webgl2"?(this.gl=o,this.viji.gl=this.gl):i==="webgpu"?(this.trackWebGPUContext(o),this.viji.gpu=o):i==="bitmaprenderer"&&this.wrapBitmapRenderer(o)),o},this.viji.width=this.canvas.width,this.viji.height=this.canvas.height,await dd(),e.data.sc&&await nc(e.data.sc),Id(this.canvas),e.data.rh!==void 0&&lc(e.data.rh),e.data.controlPort&&(this.controlPort=e.data.controlPort,this.controlPort.onmessage=i=>{this.dispatchMessage(i.data)}),this.startRenderLoop(),self.postMessage({type:"init-response",id:e.id,timestamp:Date.now(),data:{id:e.id}})}catch(s){this.postMessage("error",{id:e.id,message:s.message,code:"INIT_ERROR"})}}handleFrameRateUpdate(e){e.data&&e.data.mode&&(this.frameRateMode=e.data.mode,this.frameSkipCounter=0,this.debugLog("Frame rate mode updated to:",e.data.mode))}getFrameRateDivisor(){switch(this.frameRateMode){case"full":return 1;case"half":return 2;case"quarter":return 4;case"eighth":return 8;default:return 1}}handleRefreshRateUpdate(e){e.data&&e.data.screenRefreshRate&&(this.screenRefreshRate=e.data.screenRefreshRate,this.debugLog("Screen refresh rate updated to:",e.data.screenRefreshRate+"Hz"))}trackEffectiveFrameTime(e){this.effectiveFrameTimes.push(e),this.effectiveFrameTimes.length>60&&this.effectiveFrameTimes.shift()}reportPerformanceStats(e){if(e-this.lastEffectiveRateReport>=this.effectiveRateReportInterval){if(this.effectiveFrameTimes.length>=2){const s=this.effectiveFrameTimes[this.effectiveFrameTimes.length-1]-this.effectiveFrameTimes[0],i=this.effectiveFrameTimes.length-1,r=Math.round(i/s*1e3),o=this.capabilityMonitor.flush();this.postMessage("performance-update",{effectiveRefreshRate:r,frameRateMode:this.frameRateMode,screenRefreshRate:this.screenRefreshRate,contextType:this.detectContextType(),...o&&{frames:o.frames,timing:o.timing,capabilities:o.capabilities}})}this.lastEffectiveRateReport=e}}handleResolutionUpdate(e){if(e.data){const s=Math.round(e.data.effectiveWidth),i=Math.round(e.data.effectiveHeight);(this.viji.width!==s||this.viji.height!==i||this.canvas!==null&&(this.canvas.width!==s||this.canvas.height!==i))&&(this.canvas&&(this.canvas.width=s,this.canvas.height=i,lo()),this.gl&&this.gl.viewport(0,0,s,i),this.p5Adapter&&this.rendererType==="p5"&&this.p5Adapter.resize(s,i),this.shaderAdapter&&this.rendererType==="shader"&&this.shaderAdapter.resize(s,i)),this.viji.width=s,this.viji.height=i,this._displayScale=e.data.displayScale??1,this.debugLog("Canvas resolution updated to:",this.viji.width+"x"+this.viji.height)}}handleParameterUpdate(e){e.data&&e.data.name!==void 0&&e.data.value!==void 0&&(this.parameterSystem.updateParameterValue(e.data.name,e.data.value)||this.parameterSystem.releaseUnappliedValue(e.data.name,e.data.value))}handleParameterBatchUpdate(e){if(e.data&&e.data.updates)for(const s of e.data.updates)this.parameterSystem.updateParameterValue(s.name,s.value)||this.parameterSystem.releaseUnappliedValue(s.name,s.value)}handleCVResultsUpdate(e){const s=this.videoSystems[e.data.streamIndex];if(s)s.handleCVResultsUpdate(e.data);else if(e.data.analysedFrame)try{e.data.analysedFrame.close()}catch{}}handleAudioAnalysisUpdate(e){const s=e.data,i=s.streamIndex??0;i===0?this.handleMainAudioUpdate(s):this.handleAdditionalAudioUpdate(i,s)}handleMainAudioUpdate(e){const s=this.viji.audio;if(s.isConnected=e.isConnected,s.volume.current=e.volume.current,s.volume.peak=e.volume.peak,s.volume.smoothed=e.volume.smoothed,s.bands.low=e.bands.low,s.bands.lowMid=e.bands.lowMid,s.bands.mid=e.bands.mid,s.bands.highMid=e.bands.highMid,s.bands.high=e.bands.high,s.bands.lowSmoothed=e.bands.lowSmoothed,s.bands.lowMidSmoothed=e.bands.lowMidSmoothed,s.bands.midSmoothed=e.bands.midSmoothed,s.bands.highMidSmoothed=e.bands.highMidSmoothed,s.bands.highSmoothed=e.bands.highSmoothed,e.beat){s.beat.kick=e.beat.kick,s.beat.snare=e.beat.snare,s.beat.hat=e.beat.hat,s.beat.any=e.beat.any,s.beat.kickSmoothed=e.beat.kickSmoothed,s.beat.snareSmoothed=e.beat.snareSmoothed,s.beat.hatSmoothed=e.beat.hatSmoothed,s.beat.anySmoothed=e.beat.anySmoothed;const i=e.beat.events||[];i.length>0&&(s.beat.triggers.kick=s.beat.triggers.kick||i.some(r=>r.type==="kick"),s.beat.triggers.snare=s.beat.triggers.snare||i.some(r=>r.type==="snare"),s.beat.triggers.hat=s.beat.triggers.hat||i.some(r=>r.type==="hat"),s.beat.triggers.any=true,s.beat.events.push(...i)),s.beat.bpm=e.beat.bpm,s.beat.confidence=e.beat.confidence,s.beat.isLocked=e.beat.isLocked}s.spectral.brightness=e.spectral.brightness,s.spectral.flatness=e.spectral.flatness,this.audioFrequencyData=new Uint8Array(e.frequencyData),this.audioWaveformData=e.waveformData?new Float32Array(e.waveformData):new Float32Array(0)}handleAdditionalAudioUpdate(e,s){const i=new Uint8Array(s.frequencyData),r=s.waveformData?new Float32Array(s.waveformData):new Float32Array(0),o=this.audioStreamStates.get(e);o?(o.isConnected=s.isConnected,Object.assign(o.volume,s.volume),Object.assign(o.bands,s.bands),Object.assign(o.spectral,s.spectral),o.frequencyData=i,o.waveformData=r):this.audioStreamStates.set(e,{isConnected:s.isConnected,volume:{...s.volume},bands:{...s.bands},spectral:{...s.spectral},frequencyData:i,waveformData:r}),this.updateVijiAudioStreams(),e>=Ga&&this.wireDeviceAudio(e)}wireDeviceAudio(e){const s=this.audioStreamStates.get(e);if(!s)return;let i;for(const[o,a]of this.deviceAudioMap)if(a===e){i=o;break}if(!i)return;const r=this.viji.devices.find(o=>o.id===i);r&&(r.audio?r.audio.isConnected=s.isConnected:r.audio={isConnected:s.isConnected,volume:s.volume,bands:s.bands,spectral:s.spectral,getFrequencyData:()=>s.frequencyData,getWaveform:()=>s.waveformData})}handleAudioStreamSetup(e){const{streamIndex:s,streamType:i,deviceId:r}=e.data;switch(i){case"additional":this.updateVijiAudioStreams();break;case"device":r&&(this.deviceAudioMap.set(r,s),this.wireDeviceAudio(s));break}this.debugLog(`Audio stream setup at index ${s}, type: ${i}${r?`, deviceId: ${r}`:""}`)}resetAudioFrameEvents(){const e=this.viji.audio.beat.triggers;e.kick=false,e.snare=false,e.hat=false,e.any=false,this.viji.audio.beat.events.length=0}resetAudioState(){const e=this.viji.audio;e.isConnected=false,e.volume.current=0,e.volume.peak=0,e.volume.smoothed=0,e.bands.low=0,e.bands.lowMid=0,e.bands.mid=0,e.bands.highMid=0,e.bands.high=0,e.bands.lowSmoothed=0,e.bands.lowMidSmoothed=0,e.bands.midSmoothed=0,e.bands.highMidSmoothed=0,e.bands.highSmoothed=0,e.beat.kick=0,e.beat.snare=0,e.beat.hat=0,e.beat.any=0,e.beat.kickSmoothed=0,e.beat.snareSmoothed=0,e.beat.hatSmoothed=0,e.beat.anySmoothed=0,e.beat.triggers.kick=false,e.beat.triggers.snare=false,e.beat.triggers.hat=false,e.beat.triggers.any=false,e.beat.events.length=0,e.beat.bpm=0,e.beat.confidence=0,e.beat.isLocked=false,e.spectral.brightness=0,e.spectral.flatness=0,this.audioFrequencyData=new Uint8Array(0),this.audioWaveformData=new Float32Array(0),this.audioStreamStates.clear(),this.deviceAudioMap.clear(),this.viji.audioStreams.length=0}handleVideoCanvasSetup(e){const{streamIndex:s,deviceId:i}=e.data,r=s||0,o=As(r);let a=this.videoSystems[r];const c=!!a;switch(a||(a=new Ti,a.setDebugMode(this.debugMode),a.setCVMessaging(r,(l,h)=>{this.postMessage("cv-feature-request",{streamIndex:l,desired:h})}),this.videoSystems[r]=a),a.setDeviceId(i),a.handleCanvasSetup({offscreenCanvas:e.data.offscreenCanvas,width:e.data.width,height:e.data.height,timestamp:e.data.timestamp}),this.debugLog(`Video system ${c?"reused":"created"} at index ${r}, role: ${o}${i?`, deviceId: ${i}`:""}`),o){case"main":Object.assign(this.viji.video,a.getVideoAPI());break;case"additional":this.updateVijiVideoStreams();break;case"device":if(i){this.deviceVideoMap.set(i,r);const l=this.viji.devices.find(h=>h.id===i);l&&(l.video?Object.assign(l.video,a.getVideoAPI()):l.video=a.getVideoAPI())}break}}handleVideoFrameUpdate(e){const s=e.data.streamIndex||0,i=this.videoSystems[s];if(i){i.handleFrameUpdate({imageBitmap:e.data.imageBitmap,timestamp:e.data.timestamp});const r=As(s);if(r==="main")Object.assign(this.viji.video,i.getVideoAPI());else if(r==="device"){const o=i.getDeviceId();if(o){const a=this.viji.devices.find(c=>c.id===o);a&&(a.video?Object.assign(a.video,i.getVideoAPI()):a.video=i.getVideoAPI())}}}}handleVideoConfigUpdate(e){const s=e.data.streamIndex||0,i=this.videoSystems[s];if(i){const r=As(s),o=i.getDeviceId();if(e.data.disconnect&&r==="device"&&o){this.deviceVideoMap.delete(o);const a=this.viji.devices.find(c=>c.id===o);a&&(a.video=null)}if(i.handleVideoConfigUpdate({...e.data.targetFrameRate&&{targetFrameRate:e.data.targetFrameRate},...e.data.cvConfig&&{cvConfig:e.data.cvConfig},...e.data.width&&{width:e.data.width},...e.data.height&&{height:e.data.height},...e.data.disconnect&&{disconnect:e.data.disconnect},timestamp:e.data.timestamp}),r==="main")Object.assign(this.viji.video,i.getVideoAPI());else if(r==="device"&&o&&!e.data.disconnect){const a=this.viji.devices.find(c=>c.id===o);a&&(a.video?Object.assign(a.video,i.getVideoAPI()):a.video=i.getVideoAPI())}}}handleVideoStreamsPrepare(e){const{directFrameBaseIndex:s,directFrameCount:i}=e.data;this.debugLog(`[Compositor] Preparing ${i} direct frame slot(s) at base index ${s}`);for(let r=0;r<i;r++){const o=s+r;this.videoSystems[o]||(this.videoSystems[o]=new Ti),this.videoSystems[o].setDebugMode(this.debugMode),this.videoSystems[o].initializeForDirectFrames(this.directFrameConsumerType())}this.updateVijiVideoStreams(),this.debugLog(`[Compositor] Prepared ${i} direct frame slot(s)`)}handleVideoFrameDirect(e){const s=e.data.streamIndex||0;this.videoSystems[s]||(this.debugLog(`[Compositor] Creating new VideoSystem at index ${s} for direct frames`),this.videoSystems[s]=new Ti,this.videoSystems[s].setDebugMode(this.debugMode),this.videoSystems[s].initializeForDirectFrames(this.directFrameConsumerType())),this.videoSystems[s].handleDirectFrame(e.data)}handlePerformanceUpdate(e){this.debugLog("Performance update:",e.data)}async handleCaptureFrame(e){this.pendingCaptures.push({queuedAt:performance.now(),message:e}),this.debugLog(`Capture queued: ${e.data.format||"blob"} (${this.pendingCaptures.length} pending)`)}async executeCaptureFrame(e){try{if(!this.canvas)throw new Error("Canvas not initialized");if((e.data.format||"blob")==="bitmap"){const $=this.plateCaptureSource(e.data.frame),te=$===this.canvas?$.transferToImageBitmap():await createImageBitmap($);this.postMessage("capture-frame-result",{id:e.id,bitmap:te},[te]);return}const i=e.data.type||"image/png",r=this.canvas.width,o=this.canvas.height;let a=r,c=o;if(typeof e.data.resolution=="number"){const $=e.data.resolution>0?e.data.resolution:1;a=Math.max(1,Math.floor(r*$)),c=Math.max(1,Math.floor(o*$))}else e.data.resolution&&typeof e.data.resolution=="object"&&(a=Math.max(1,Math.floor(e.data.resolution.width)),c=Math.max(1,Math.floor(e.data.resolution.height)));const l=r/o,h=a/c;let d=0,m=0,_=r,x=o;Math.abs(l-h)>1e-6&&(h>l?(x=Math.floor(r/h),m=Math.floor((o-x)/2)):(_=Math.floor(o*h),d=Math.floor((r-_)/2))),this.getContextAndFinish();const E=this.plateCaptureSource(e.data.frame);this.debugLog("Captured frame from canvas directly (post-render)");const N=new OffscreenCanvas(a,c),F=N.getContext("2d");if(!F)throw new Error("Failed to get 2D context");F.drawImage(E,d,m,_,x,0,0,a,c);const U=e.data.quality,P=typeof U=="number"&&Number.isFinite(U)?Math.min(1,Math.max(0,U)):void 0,X=await N.convertToBlob(P!==void 0?{type:i,quality:P}:{type:i});this.postMessage("capture-frame-result",{id:e.id,blob:X})}catch(s){this.postMessage("error",{id:e.id,message:s.message,code:"CAPTURE_FRAME_ERROR"})}}handleSetSceneCode(e){let s=false;const i={resolve:c=>{s||(s=true,this.postMessage("scene-analysis",{id:e.id,...c}))},reject:c=>{s||(s=true,this.postMessage("error",{id:e.id,...c}))}},r=e.data?.sceneCode;if(typeof r!="string"){i.reject({message:"set-scene-code carried no scene code",code:"SCENE_ANALYSIS_ERROR"});return}const o={...e.data?.initialParameters&&{initialParameters:e.data.initialParameters},...e.data?.sk&&{keyComponent:e.data.sk}},a=self.setSceneCode;a(r,o,i).catch(c=>{const l=c;i.reject({message:`Scene load failed before analysis ack: ${l?.message??String(c)}`,code:"SCENE_ANALYSIS_ERROR"})})}startRenderLoop(){this.isRunning=true,this.startTime=performance.now(),this.lastTime=this.startTime,this.renderFrame()}runCaptures(e){for(const{message:s}of e)this.executeCaptureFrame(s).catch(i=>{console.error("Capture execution error:",i)})}runAutoCapture(){if(!(!this.autoCaptureEnabled||!this.canvas))try{const e=this.autoCaptureFormat.flipY?{imageOrientation:"flipY"}:{};createImageBitmap(this.plateCaptureSource(this.autoCaptureFormat.frame),e).then(s=>{this.postMessage("auto-capture-result",{bitmap:s,timestamp:performance.now()},[s])}).catch(s=>{console.warn("[AutoCapture] ImageBitmap creation failed:",s)})}catch(e){console.warn("[AutoCapture] Failed:",e)}}renderFrame(){if(!this.isRunning)return;this.gpuTextureAcquiredThisFrame=false;const e=performance.now();this.updateVijiVideoStreams(),this.updateVijiAudioStreams();const s=this.getFrameRateDivisor();this.viji.fps=this.screenRefreshRate/s;const i=this.frameSkipCounter%s===0;if(this.frameSkipCounter++,i){const r=e-this.lastTime;this.viji.deltaTime=(e-this.lastTime)/1e3,this.viji.time=(e-this.startTime)/1e3,this.viji.frameCount=++this.frameCount,this.trackEffectiveFrameTime(e),this.lastTime=e,this.interactionSystem.updatePointerState(),!this._isHeadless&&this.canvas&&kd(this.canvas,this.ctx,this.gl);const o=performance.now();let a=false;try{if(this.shaderAdapter&&this.rendererType==="shader"){const d=this.parameterSystem.getAllParameterObjects();a=this.shaderAdapter.render(this.viji,d)}else if(this.p5Adapter&&this.rendererType==="p5"){const d=this.parameterSystem.getAllParameterObjects();a=this.p5Adapter.tick(this.viji,d)}else{const d=self.renderFunction;d&&typeof d=="function"&&(d(this.viji),a=true)}}catch(d){const m=d;console.error("Render error:",m),this.sceneErrorReporter?this.sceneErrorReporter.reportSceneError({message:m.message,...m.stack!==void 0&&{stack:m.stack},code:"RENDER_ERROR"}):this.postMessage("error",{message:m.message,code:"RENDER_ERROR",stack:m.stack})}const c=a&&this.contextAcquired;if(c&&this.sceneErrorReporter&&this.sceneErrorReporter.markFirstFrameProduced(),this.benchmark){const d=performance.now()-o;this.recordBenchmarkFrame(e,d)}else if(this.capabilityMonitor.isEnabled()){const d=performance.now()-o;this.recordCapabilityFrame(e,d,r)}if(this.parameterSystem.resetButtonParameters(),this.pendingCaptures.length>0){const d=performance.now()-Xo.CAPTURE_QUEUE_TTL_MS;this.pendingCaptures=this.pendingCaptures.filter(m=>m.queuedAt>=d)}let l=[],h=[];if(c){const d=this.pendingCaptures;this.pendingCaptures=[],h=d.filter(m=>m.message.data.frame==="display"),l=d.filter(m=>m.message.data.frame!=="display")}if(this.runCaptures(l),c&&this.autoCaptureFormat.frame!=="display"&&this.runAutoCapture(),!this._isHeadless&&this.canvas){const d=oc("b",0);hc(this.canvas,this.ctx,this.gl,d,this._displayScale),c&&this.gpuTextureAcquiredThisFrame&&this.gpuCtx&&this.gpuDevice&&this.gpuFormat&&Dd(this.gpuCtx,this.gpuDevice,this.gpuFormat,this.canvas,d,this._displayScale)}this.runCaptures(h),c&&this.autoCaptureFormat.frame==="display"&&this.runAutoCapture()}this.benchmark||this.reportPerformanceStats(e),this.interactionSystem.frameStart(),this.resetAudioFrameEvents(),this.scheduleNextFrame()}scheduleNextFrame(){this.rafScheduled||!this.isRunning||(this.rafScheduled=true,requestAnimationFrame(()=>{this.rafScheduled=false,this.renderFrame()}))}setRenderLoopPaused(e){e!==this.renderLoopPaused&&(this.renderLoopPaused=e,e?this.isRunning=false:(this.isRunning=true,this.scheduleNextFrame()))}postMessage(e,s,i){const r={type:e,id:s?.id||`${e}_${Date.now()}`,timestamp:Date.now(),data:s};this.controlPort?this.controlPort.postMessage(r,i??[]):self.postMessage(r,i??[])}handleMouseUpdate(e){this.interactionSystem.handleMouseUpdate(e.data)}handleKeyboardUpdate(e){this.interactionSystem.handleKeyboardUpdate(e.data)}handleTouchUpdate(e){this.interactionSystem.handleTouchUpdate(e.data)}handleInteractionEnabled(e){this.interactionSystem.setInteractionEnabled(e.data.enabled)}handleDeviceStateUpdate(e){this.deviceState=e.data,this.viji.device=this.deviceState.device;const s=this.deviceState.devices.map(i=>{const r=this.viji.devices.find(d=>d.id===i.id),o=this.deviceVideoMap.get(i.id),a=o!==void 0?this.videoSystems[o]:void 0,c=this.deviceAudioMap.get(i.id),l=c!==void 0?this.audioStreamStates.get(c):void 0,h=l?{isConnected:l.isConnected,volume:l.volume,bands:l.bands,spectral:l.spectral,getFrequencyData:()=>l.frequencyData,getWaveform:()=>l.waveformData}:null;return r?(r.name=i.name,r.motion=i.motion,r.orientation=i.orientation,h&&(r.audio=h),r):{...i,video:a?a.getVideoAPI():null,audio:h}});this.viji.devices=s}}class Qs{static detectRendererType(e){return/\/\/\s*@renderer\s+shader|\/\*\s*@renderer\s+shader\s*\*\//.test(e)?"shader":/\/\/\s*@renderer\s+p5|\/\*\s*@renderer\s+p5\s*\*\//.test(e)?"p5":"native"}static detectP5CanvasMode(e){return/\/\/\s*@renderer\s+p5\s+webgl\b|\/\*\s*@renderer\s+p5\s+webgl\s*\*\//i.test(e)?"webgl":"2d"}static detectCapabilities(e,s){const i=this.stripCommentsAndStrings(e),r={audio:false,video:false,mouse:false,keyboard:false,pointer:false,touch:false,parameters:false,sensors:false,devices:false,cv:{faceDetection:false,faceMesh:false,emotion:false,handTracking:false,poseDetection:false,segmentation:false},sources:{video:{main:false,streams:false,device:false},audio:{main:false,streams:false,device:false},sensors:{internal:false,device:false}}};return s==="shader"?(this.detectShaderCapabilities(i,r),this.detectShaderSources(i,r)):(this.detectScriptCapabilities(i,r),this.detectScriptSources(i,r)),r}static stripCommentsAndStrings(e){let s="";const i=e.length;let r=0;for(;r<i;){const o=e[r],a=r+1<i?e[r+1]:"";if(o==="/"&&a==="/"){for(r+=2;r<i&&e[r]!==`
472
+ `;)r++;continue}if(o==="/"&&a==="*"){for(r+=2;r<i&&!(e[r]==="*"&&e[r+1]==="/");)r++;r+=2,s+=" ";continue}if(o==='"'||o==="'"||o==="`"){const c=o;for(r++;r<i;){if(e[r]==="\\"){r+=2;continue}if(e[r]===c){r++;break}r++}s+=" ";continue}s+=o,r++}return s}static detectShaderCapabilities(e,s){/\bu_audio\w*/.test(e)&&(s.audio=true),/\bu_video\w*/.test(e)&&(s.video=true),/\bu_mouse\w*/.test(e)&&(s.mouse=true),/\bu_key\w*/.test(e)&&(s.keyboard=true),/\bu_touch\w*/.test(e)&&(s.touch=true),/\bu_pointer\w*/.test(e)&&(s.pointer=true),/\bu_device(Acceleration|AccelerationGravity|RotationRate|OrientationAbsolute|Orientation)\b/.test(e)&&(s.sensors=true),/\bu_device[0-7](AccelerationGravity|Acceleration|RotationRate|Orientation)\b/.test(e)&&(s.sensors=true,s.devices=true),/\bu_externalDeviceCount\b/.test(e)&&(s.devices=true,s.sensors=true),(/\bu_deviceCount\b/.test(e)||/\bu_device[0-7](Resolution|Connected)?\b/.test(e))&&(s.video=true,s.devices=true),/\bu_face\w*/.test(e)&&(s.cv.faceDetection=true),/\bu_face0(Neutral|Happy|Sad|Angry|Surprised|Disgusted|Fearful)\b/.test(e)&&(s.cv.emotion=true),(/\bu_face0HeadPose\b/.test(e)||/\bu_videoAnalysed\w*/.test(e)||/\bu_face0(Brow|Cheek|Eye|Jaw|Mouth|Nose|Tongue)\w*/.test(e))&&(s.cv.faceMesh=true),(/\bu_handCount\b/.test(e)||/\bu_(left|right)Hand\w*/.test(e))&&(s.cv.handTracking=true),(/\bu_pose\w*/.test(e)||/\bu_(nose|leftShoulder|rightShoulder|leftElbow|rightElbow|leftWrist|rightWrist|leftHip|rightHip|leftKnee|rightKnee|leftAnkle|rightAnkle)Position\b/.test(e))&&(s.cv.poseDetection=true),/\bu_segmentation\w*/.test(e)&&(s.cv.segmentation=true)}static detectScriptCapabilities(e,s){/\bviji\.audio/.test(e)&&(s.audio=true),/\bviji\.video/.test(e)&&(s.video=true),/\bviji\.mouse/.test(e)&&(s.mouse=true),/\bviji\.keyboard/.test(e)&&(s.keyboard=true),/\bviji\.touches/.test(e)&&(s.touch=true),/\bviji\.pointer/.test(e)&&(s.pointer=true),/\bviji\.device\b/.test(e)&&(s.sensors=true),/\bviji\.devices/.test(e)&&(s.devices=true),/\bviji\.(slider|color|toggle|select|text|number|image|button|coordinate|gradient)\s*\(/.test(e)&&(s.parameters=true),/\benableFaceDetection\b/.test(e)&&(s.cv.faceDetection=true),/\benableFaceMesh\b/.test(e)&&(s.cv.faceMesh=true),/\benableEmotionDetection\b/.test(e)&&(s.cv.emotion=true),/\benableHandTracking\b/.test(e)&&(s.cv.handTracking=true),/\benablePoseDetection\b/.test(e)&&(s.cv.poseDetection=true),/\benableBodySegmentation\b/.test(e)&&(s.cv.segmentation=true)}static detectShaderSources(e,s){const i=s.sources,r=Object.values(s.cv).some(Boolean);i.video.main=r||/\bu_video(?!Stream)\w*/.test(e),i.video.streams=/\bu_videoStream\w*/.test(e),i.video.device=/\bu_deviceCount\b/.test(e)||/\bu_device[0-7](Resolution|Connected)?\b/.test(e),i.audio.main=/\bu_audio(?!Stream)\w*/.test(e),i.audio.streams=/\bu_audioStream\w*/.test(e),i.sensors.internal=/\bu_device(Acceleration|AccelerationGravity|RotationRate|OrientationAbsolute|Orientation)\b/.test(e),i.sensors.device=/\bu_device[0-7](AccelerationGravity|Acceleration|RotationRate|Orientation)\b/.test(e)||/\bu_externalDeviceCount\b/.test(e)}static detectScriptSources(e,s){const i=s.sources;i.video.main=/\bviji\.video\b/.test(e),i.video.streams=/\bviji\.videoStreams\b/.test(e),i.audio.main=/\bviji\.audio\b/.test(e),i.audio.streams=/\bviji\.audioStreams\b/.test(e),i.sensors.internal=/\bviji\.device\b/.test(e),/\bviji\.devices\b/.test(e)&&this.detectScriptDeviceSources(e,s)}static detectScriptDeviceSources(e,s){const i=e.replace(/\bviji\.(video|audio|device)\b(\s*\??\.\s*[A-Za-z_$][\w$]*)*/g," "),r=/\.video\b/.test(i),o=/\.audio\b/.test(i),a=/\.(motion|orientation)\b/.test(i),c=!r&&!o&&!a,l=s.sources;l.video.device=r||c,l.audio.device=o||c,l.sensors.device=a||c}static detectAnalysedFrameUse(e){const s=this.stripCommentsAndStrings(e);return/\b(analysedFrame|getAnalysedFrameData)\b/.test(s)||/\bu_videoAnalysed\w*/.test(s)}static detectUsage(e,s){const i=this.stripCommentsAndStrings(e),r={mouse:{position:false,left:false,right:false,middle:false},pointer:{position:false,down:false},touch:false};return s==="shader"?(r.mouse.position=/\bu_mouse(\b|InCanvas|Delta|Wheel)/.test(i),r.mouse.left=/\bu_mouse(Left|Pressed|WasPressed|WasReleased)\b/.test(i),r.mouse.right=/\bu_mouseRight\b/.test(i),r.mouse.middle=/\bu_mouseMiddle\b/.test(i),r.pointer.position=/\bu_pointer(\b|Delta|InCanvas)/.test(i),r.pointer.down=/\bu_pointer(Down|WasPressed|WasReleased)\b/.test(i),r.touch=/\bu_touch/.test(i)):(r.mouse.position=/\bmouse\.(x|y|deltaX|deltaY|wheelDelta|wheelX|wheelY|wasMoved)\b/.test(i),r.mouse.left=/\bmouse\.(leftButton|isPressed|wasPressed|wasReleased)\b/.test(i),r.mouse.right=/\bmouse\.rightButton\b/.test(i),r.mouse.middle=/\bmouse\.middleButton\b/.test(i),r.pointer.position=/\bpointer\.(x|y|deltaX|deltaY)\b/.test(i),r.pointer.down=/\bpointer\.(isDown|wasPressed|wasReleased)\b/.test(i),r.touch=/\btouches\./.test(i)),r}}function Od(t){const e=Qs.detectRendererType(t),s=e==="p5"?Qs.detectP5CanvasMode(t):void 0;return{renderer:e,...s!==void 0&&{p5CanvasMode:s},capabilities:Qs.detectCapabilities(t,e),consumesAnalysedFrame:Qs.detectAnalysedFrameUse(t)}}const zo=5,Bd=(1<<zo)-1,Vd=1<<zo,$d=(()=>{const t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",e=new Int8Array(128).fill(-1);for(let s=0;s<t.length;s++)e[t.charCodeAt(s)]=s;return e})();function Xs(t,e){let s=0,i=0,r;do{if(e.index>=t.length)throw new Error("VLQ decode: unexpected end of input");const a=t.charCodeAt(e.index++),c=a<128?$d[a]:-1;if(c<0)throw new Error(`VLQ decode: invalid base64 character '${t[e.index-1]}'`);r=c&Vd,s+=(c&Bd)<<i,i+=zo}while(r);const o=s&1;return s>>>=1,o?-s:s}function jd(t,e){const s=[];if(t.length===0)return s;let i=0;const r=t.split(",");for(const o of r){if(o.length===0)continue;const a={index:0};i+=Xs(o,a);const c={generatedColumn:i};a.index<o.length&&(e.sourceIndex+=Xs(o,a),e.sourceLine+=Xs(o,a),e.sourceColumn+=Xs(o,a),c.sourceLine=e.sourceLine,c.sourceColumn=e.sourceColumn,a.index<o.length&&(e.nameIndex+=Xs(o,a))),s.push(c)}return s}function qd(t){const e=t.split(";"),s=[],i={sourceIndex:0,sourceLine:0,sourceColumn:0,nameIndex:0};for(const r of e){const o=jd(r,i);s.push(o)}return{lines:s}}function Hd(t,e,s){if(e<1||e>t.lines.length)return null;const i=t.lines[e-1];if(i.length===0)return null;const r=s-1;let o=0,a=i.length-1,c=-1;for(;o<=a;){const h=o+a>>>1;i[h].generatedColumn<=r?(c=h,o=h+1):a=h-1}if(c<0)return null;const l=i[c];return l.sourceLine===void 0||l.sourceColumn===void 0?null:{line:l.sourceLine+1,column:l.sourceColumn+1}}const Gd={errorCoalescingWindowMs:1e3,consoleCoalescingWindowMs:1e3,consoleArgMaxBytes:512,consoleMaxArgsPerCall:8,consoleMaxUniqueSignaturesPerSecond:32},bc=8192,Wd=`
473
+ ...[stack truncated by viji core]`;class Xd{config;post;errorChannel;consoleChannel;rateCapWindowMs=1e3;rateCapWindowStart=0;rateCapSignaturesInWindow=0;rateCapSuppressionFiredInWindow=false;functionBodyLineOffset=0;functionBodySourceId="<anonymous>";stackDialect="unknown";currentSourceMap=null;hasProducedFirstFrame=false;envelopeSeq=0;constructor(e,s={}){this.config={...Gd,...s},this.post=e,this.errorChannel=new yc(this.config.errorCoalescingWindowMs,i=>this.postEnvelope("scene-error",i)),this.consoleChannel=new yc(this.config.consoleCoalescingWindowMs,i=>this.postEnvelope("scene-console",i)),this.detectFunctionBodyOffset()}applyConfig(e){e.errorCoalescingWindowMs!==void 0&&(this.config.errorCoalescingWindowMs=e.errorCoalescingWindowMs,this.errorChannel.setWindowMs(e.errorCoalescingWindowMs)),e.consoleCoalescingWindowMs!==void 0&&(this.config.consoleCoalescingWindowMs=e.consoleCoalescingWindowMs,this.consoleChannel.setWindowMs(e.consoleCoalescingWindowMs)),e.consoleArgMaxBytes!==void 0&&(this.config.consoleArgMaxBytes=e.consoleArgMaxBytes),e.consoleMaxArgsPerCall!==void 0&&(this.config.consoleMaxArgsPerCall=e.consoleMaxArgsPerCall),e.consoleMaxUniqueSignaturesPerSecond!==void 0&&(this.config.consoleMaxUniqueSignaturesPerSecond=e.consoleMaxUniqueSignaturesPerSecond)}markFirstFrameProduced(){this.hasProducedFirstFrame=true}resetForSceneReload(){this.hasProducedFirstFrame=false,this.currentSourceMap=null,this.errorChannel.flushAndClear(),this.consoleChannel.flushAndClear()}destroy(){this.errorChannel.destroy(),this.consoleChannel.destroy(),this.currentSourceMap=null}setCurrentSourceMap(e){if(e===null){this.currentSourceMap=null;return}try{this.currentSourceMap=qd(e)}catch{this.currentSourceMap=null}}reportSceneError(e){const s=e.stack,i=e.sourceOverride?{source:e.sourceOverride,sourceLocation:e.sourceLocationOverride}:this.attributeFromStack(s),r=e.sourceLocationOverride??i.sourceLocation,o=this.hasProducedFirstFrame?"render":"init",a=_c([e.message,e.code,r?`${r.line}:${r.column??"?"}`:"no-loc"]),c=s!==void 0&&s.length>bc?s.slice(0,bc)+Wd:s,l={message:e.message,...c!==void 0&&{stack:c},source:i.source,phase:o,code:e.code,signatureHash:a,count:1,firstSeenAt:0,lastSeenAt:0,...r!==void 0&&{sourceLocation:r}};this.errorChannel.emit(a,l)}makeArtistConsole(e){const s=Object.create(e),i=["log","info","warn","error"];for(const r of i)s[r]=(...o)=>{try{e[r](...o)}catch{}this.forwardConsoleCall(r,o)};return s}forwardConsoleCall(e,s){const r=(s.length>this.config.consoleMaxArgsPerCall?[...s.slice(0,this.config.consoleMaxArgsPerCall),"…[truncated args]"]:s).map(d=>zd(d,this.config.consoleArgMaxBytes)),o=_c([e,...r]),a=Date.now();if(a-this.rateCapWindowStart>=this.rateCapWindowMs&&(this.rateCapWindowStart=a,this.rateCapSignaturesInWindow=0,this.rateCapSuppressionFiredInWindow=false),!this.consoleChannel.hasPending(o)){if(this.rateCapSignaturesInWindow>=this.config.consoleMaxUniqueSignaturesPerSecond){this.rateCapSuppressionFiredInWindow||(this.rateCapSuppressionFiredInWindow=true,this.emitSuppressionNotice());return}this.rateCapSignaturesInWindow++}const l=this.resolveCallSiteLocation(),h={level:e,args:r,signatureHash:o,count:1,firstSeenAt:0,lastSeenAt:0,...l!==void 0&&{sourceLocation:l}};this.consoleChannel.emit(o,h)}emitSuppressionNotice(){const s={level:"warn",args:["[viji] console output suppressed: too many distinct signatures this second"],signatureHash:"__console_suppressed__",count:1,firstSeenAt:0,lastSeenAt:0};this.postEnvelope("scene-console",s)}resolveCallSiteLocation(){const e=new Error().stack;if(e)return this.attributeFromStack(e).sourceLocation}attributeFromStack(e){if(!e)return{source:"engine"};const s=e.split(`
474
+ `);if(this.stackDialect==="jsc"&&!s.some(i=>/@.+:\d+/.test(i)))return{source:"engine"};for(const i of s){const r=this.matchArtistFrame(i);if(!r)continue;if(r.line===void 0)return{source:"scene"};const o=this.resolveLocation(r.line,r.column??0);return o?{source:"scene",sourceLocation:o}:{source:"scene"}}return{source:"engine"}}matchArtistFrame(e){switch(this.stackDialect){case"spidermonkey":{const s=e.match(/> (?:Async)?Function:(\d+)(?::(\d+))?\s*$/);return s?{line:parseInt(s[1],10),...s[2]!==void 0&&{column:parseInt(s[2],10)}}:null}case"jsc":return/^[^@\s()]*@\s*$/.test(e.trim())?{}:null;case"v8":case"unknown":default:{const s=e.match(/\(?(<anonymous>):(\d+):(\d+)\)?$/);return!s||s[1]!==this.functionBodySourceId?null:{line:parseInt(s[2],10),column:parseInt(s[3],10)}}}}resolveLocation(e,s){const i=e-this.functionBodyLineOffset;if(!(i<1)){if(this.currentSourceMap){const r=Hd(this.currentSourceMap,i,s);if(r)return{line:r.line,column:r.column}}return{line:i}}}detectFunctionBodyOffset(){const e="__viji_offset_probe__";try{new Function("viji","console",`throw new Error(${JSON.stringify(e)});`)(null,null)}catch(s){const r=s?.stack;if(!r)return;const o=r.split(`
475
+ `);for(const a of o){const c=a.match(/\(?(<anonymous>):(\d+):(\d+)\)?$/);if(c){this.stackDialect="v8",this.functionBodySourceId=c[1],this.functionBodyLineOffset=parseInt(c[2],10)-1;return}const l=a.match(/> (?:Async)?Function:(\d+)(?::\d+)?\s*$/);if(l){this.stackDialect="spidermonkey",this.functionBodyLineOffset=parseInt(l[1],10)-1;return}if(/^[^@\s()]*@\s*$/.test(a.trim())){this.stackDialect="jsc",this.functionBodyLineOffset=0;return}}console.debug("[SceneErrorReporter] unrecognized probe stack dialect:",o[0],o[1])}}postEnvelope(e,s){this.post({type:e,id:`${e}_${s.signatureHash}_${++this.envelopeSeq}`,timestamp:Date.now(),data:s})}}class yc{windowMs;emitFn;pending=new Map;constructor(e,s){this.windowMs=e,this.emitFn=s}setWindowMs(e){this.windowMs=e}hasPending(e){return this.pending.has(e)}emit(e,s){const i=Date.now(),r=this.pending.get(e);if(r){if(r.payload.count++,r.payload.lastSeenAt=i,r.timer!==null)return;this.emitFn(r.payload),r.lastEmittedCount=r.payload.count,r.timer=setTimeout(()=>this.flush(e),this.windowMs);return}s.count=1,s.firstSeenAt=i,s.lastSeenAt=i,this.emitFn(s);const o=setTimeout(()=>this.flush(e),this.windowMs);this.pending.set(e,{payload:s,timer:o,lastEmittedCount:1})}flush(e){const s=this.pending.get(e);!s||s.timer===null||(clearTimeout(s.timer),s.timer=null,s.payload.count>s.lastEmittedCount&&(this.emitFn(s.payload),s.lastEmittedCount=s.payload.count))}flushAndClear(){for(const e of this.pending.values())e.timer!==null&&(clearTimeout(e.timer),e.timer=null,e.payload.count>e.lastEmittedCount&&this.emitFn(e.payload));this.pending.clear()}destroy(){for(const e of this.pending.values())e.timer!==null&&clearTimeout(e.timer);this.pending.clear()}}function zd(t,e){const s="…[truncated]";let i;try{t===void 0?i="undefined":t===null?i="null":typeof t=="string"?i=t:typeof t=="number"||typeof t=="boolean"||typeof t=="bigint"?i=String(t):typeof t=="function"?i=`[Function: ${t.name||"anonymous"}]`:typeof t=="symbol"?i=t.toString():t instanceof Error?i=`${t.name}: ${t.message}`:i=Yd(t)}catch{i="[unstringifiable]"}return i.length>e?i.slice(0,Math.max(0,e-s.length))+s:i}function Yd(t){const e=new WeakSet;try{return JSON.stringify(t,function(s,i){if(typeof i=="object"&&i!==null){if(e.has(i))return"[Circular]";if(e.add(i),i instanceof Map||i instanceof Set)return Array.from(i.entries?i.entries():i)}return typeof i=="function"?`[Function: ${i.name||"anonymous"}]`:typeof i=="bigint"?`${i.toString()}n`:i})??"undefined"}catch{return"[unstringifiable]"}}function _c(t){let i=2166136261;const o=t.join("");for(let a=0;a<o.length;a++)i^=o.charCodeAt(a),i=Math.imul(i,16777619);return(i>>>0).toString(16).padStart(8,"0")}var g;(function(t){t[t.NONE=0]="NONE";const s=1;t[t._abstract=s]="_abstract";const i=s+1;t[t._accessor=i]="_accessor";const r=i+1;t[t._as=r]="_as";const o=r+1;t[t._assert=o]="_assert";const a=o+1;t[t._asserts=a]="_asserts";const c=a+1;t[t._async=c]="_async";const l=c+1;t[t._await=l]="_await";const h=l+1;t[t._checks=h]="_checks";const d=h+1;t[t._constructor=d]="_constructor";const m=d+1;t[t._declare=m]="_declare";const _=m+1;t[t._enum=_]="_enum";const x=_+1;t[t._exports=x]="_exports";const E=x+1;t[t._from=E]="_from";const N=E+1;t[t._get=N]="_get";const F=N+1;t[t._global=F]="_global";const U=F+1;t[t._implements=U]="_implements";const P=U+1;t[t._infer=P]="_infer";const X=P+1;t[t._interface=X]="_interface";const $=X+1;t[t._is=$]="_is";const te=$+1;t[t._keyof=te]="_keyof";const ee=te+1;t[t._mixins=ee]="_mixins";const Q=ee+1;t[t._module=Q]="_module";const z=Q+1;t[t._namespace=z]="_namespace";const ne=z+1;t[t._of=ne]="_of";const v=ne+1;t[t._opaque=v]="_opaque";const y=v+1;t[t._out=y]="_out";const k=y+1;t[t._override=k]="_override";const V=k+1;t[t._private=V]="_private";const G=V+1;t[t._protected=G]="_protected";const O=G+1;t[t._proto=O]="_proto";const R=O+1;t[t._public=R]="_public";const B=R+1;t[t._readonly=B]="_readonly";const M=B+1;t[t._require=M]="_require";const C=M+1;t[t._satisfies=C]="_satisfies";const H=C+1;t[t._set=H]="_set";const W=H+1;t[t._static=W]="_static";const J=W+1;t[t._symbol=J]="_symbol";const ce=J+1;t[t._type=ce]="_type";const ae=ce+1;t[t._unique=ae]="_unique";const w=ae+1;t[t._using=w]="_using"})(g||(g={}));var n;(function(t){t[t.PRECEDENCE_MASK=15]="PRECEDENCE_MASK";const s=16;t[t.IS_KEYWORD=s]="IS_KEYWORD";const i=32;t[t.IS_ASSIGN=i]="IS_ASSIGN";const r=64;t[t.IS_RIGHT_ASSOCIATIVE=r]="IS_RIGHT_ASSOCIATIVE";const o=128;t[t.IS_PREFIX=o]="IS_PREFIX";const a=256;t[t.IS_POSTFIX=a]="IS_POSTFIX";const c=512;t[t.IS_EXPRESSION_START=c]="IS_EXPRESSION_START";const l=512;t[t.num=l]="num";const h=1536;t[t.bigint=h]="bigint";const d=2560;t[t.decimal=d]="decimal";const m=3584;t[t.regexp=m]="regexp";const _=4608;t[t.string=_]="string";const x=5632;t[t.name=x]="name";const E=6144;t[t.eof=E]="eof";const N=7680;t[t.bracketL=N]="bracketL";const F=8192;t[t.bracketR=F]="bracketR";const U=9728;t[t.braceL=U]="braceL";const P=10752;t[t.braceBarL=P]="braceBarL";const X=11264;t[t.braceR=X]="braceR";const $=12288;t[t.braceBarR=$]="braceBarR";const te=13824;t[t.parenL=te]="parenL";const ee=14336;t[t.parenR=ee]="parenR";const Q=15360;t[t.comma=Q]="comma";const z=16384;t[t.semi=z]="semi";const ne=17408;t[t.colon=ne]="colon";const v=18432;t[t.doubleColon=v]="doubleColon";const y=19456;t[t.dot=y]="dot";const k=20480;t[t.question=k]="question";const V=21504;t[t.questionDot=V]="questionDot";const G=22528;t[t.arrow=G]="arrow";const O=23552;t[t.template=O]="template";const R=24576;t[t.ellipsis=R]="ellipsis";const B=25600;t[t.backQuote=B]="backQuote";const M=27136;t[t.dollarBraceL=M]="dollarBraceL";const C=27648;t[t.at=C]="at";const H=29184;t[t.hash=H]="hash";const W=29728;t[t.eq=W]="eq";const J=30752;t[t.assign=J]="assign";const ce=32640;t[t.preIncDec=ce]="preIncDec";const ae=33664;t[t.postIncDec=ae]="postIncDec";const w=34432;t[t.bang=w]="bang";const T=35456;t[t.tilde=T]="tilde";const D=35841;t[t.pipeline=D]="pipeline";const L=36866;t[t.nullishCoalescing=L]="nullishCoalescing";const j=37890;t[t.logicalOR=j]="logicalOR";const se=38915;t[t.logicalAND=se]="logicalAND";const re=39940;t[t.bitwiseOR=re]="bitwiseOR";const pe=40965;t[t.bitwiseXOR=pe]="bitwiseXOR";const Se=41990;t[t.bitwiseAND=Se]="bitwiseAND";const ke=43015;t[t.equality=ke]="equality";const Fe=44040;t[t.lessThan=Fe]="lessThan";const Ye=45064;t[t.greaterThan=Ye]="greaterThan";const Ie=46088;t[t.relationalOrEqual=Ie]="relationalOrEqual";const Ve=47113;t[t.bitShiftL=Ve]="bitShiftL";const $e=48137;t[t.bitShiftR=$e]="bitShiftR";const fs=49802;t[t.plus=fs]="plus";const Es=50826;t[t.minus=Es]="minus";const Ws=51723;t[t.modulo=Ws]="modulo";const Dr=52235;t[t.star=Dr]="star";const Nr=53259;t[t.slash=Nr]="slash";const Fr=54348;t[t.exponent=Fr]="exponent";const Ur=55296;t[t.jsxName=Ur]="jsxName";const Mr=56320;t[t.jsxText=Mr]="jsxText";const Or=57344;t[t.jsxEmptyText=Or]="jsxEmptyText";const Br=58880;t[t.jsxTagStart=Br]="jsxTagStart";const Vr=59392;t[t.jsxTagEnd=Vr]="jsxTagEnd";const $r=60928;t[t.typeParameterStart=$r]="typeParameterStart";const jr=61440;t[t.nonNullAssertion=jr]="nonNullAssertion";const qr=62480;t[t._break=qr]="_break";const Hr=63504;t[t._case=Hr]="_case";const Gr=64528;t[t._catch=Gr]="_catch";const Wr=65552;t[t._continue=Wr]="_continue";const Xr=66576;t[t._debugger=Xr]="_debugger";const zr=67600;t[t._default=zr]="_default";const Yr=68624;t[t._do=Yr]="_do";const Kr=69648;t[t._else=Kr]="_else";const Zr=70672;t[t._finally=Zr]="_finally";const Qr=71696;t[t._for=Qr]="_for";const Jr=73232;t[t._function=Jr]="_function";const en=73744;t[t._if=en]="_if";const tn=74768;t[t._return=tn]="_return";const sn=75792;t[t._switch=sn]="_switch";const rn=77456;t[t._throw=rn]="_throw";const nn=77840;t[t._try=nn]="_try";const on=78864;t[t._var=on]="_var";const an=79888;t[t._let=an]="_let";const cn=80912;t[t._const=cn]="_const";const un=81936;t[t._while=un]="_while";const ln=82960;t[t._with=ln]="_with";const hn=84496;t[t._new=hn]="_new";const fn=85520;t[t._this=fn]="_this";const dn=86544;t[t._super=dn]="_super";const pn=87568;t[t._class=pn]="_class";const mn=88080;t[t._extends=mn]="_extends";const gn=89104;t[t._export=gn]="_export";const bn=90640;t[t._import=bn]="_import";const yn=91664;t[t._yield=yn]="_yield";const _n=92688;t[t._null=_n]="_null";const vn=93712;t[t._true=vn]="_true";const xn=94736;t[t._false=xn]="_false";const kn=95256;t[t._in=kn]="_in";const wn=96280;t[t._instanceof=wn]="_instanceof";const Sn=97936;t[t._typeof=Sn]="_typeof";const En=98960;t[t._void=En]="_void";const V1=99984;t[t._delete=V1]="_delete";const $1=100880;t[t._async=$1]="_async";const j1=101904;t[t._get=j1]="_get";const q1=102928;t[t._set=q1]="_set";const H1=103952;t[t._declare=H1]="_declare";const G1=104976;t[t._readonly=G1]="_readonly";const W1=106e3;t[t._abstract=W1]="_abstract";const X1=107024;t[t._static=X1]="_static";const z1=107536;t[t._public=z1]="_public";const Y1=108560;t[t._private=Y1]="_private";const K1=109584;t[t._protected=K1]="_protected";const Z1=110608;t[t._override=Z1]="_override";const Q1=112144;t[t._as=Q1]="_as";const J1=113168;t[t._enum=J1]="_enum";const eh=114192;t[t._type=eh]="_type";const th=115216;t[t._implements=th]="_implements"})(n||(n={}));function Kd(t){switch(t){case n.num:return"num";case n.bigint:return"bigint";case n.decimal:return"decimal";case n.regexp:return"regexp";case n.string:return"string";case n.name:return"name";case n.eof:return"eof";case n.bracketL:return"[";case n.bracketR:return"]";case n.braceL:return"{";case n.braceBarL:return"{|";case n.braceR:return"}";case n.braceBarR:return"|}";case n.parenL:return"(";case n.parenR:return")";case n.comma:return",";case n.semi:return";";case n.colon:return":";case n.doubleColon:return"::";case n.dot:return".";case n.question:return"?";case n.questionDot:return"?.";case n.arrow:return"=>";case n.template:return"template";case n.ellipsis:return"...";case n.backQuote:return"`";case n.dollarBraceL:return"${";case n.at:return"@";case n.hash:return"#";case n.eq:return"=";case n.assign:return"_=";case n.preIncDec:return"++/--";case n.postIncDec:return"++/--";case n.bang:return"!";case n.tilde:return"~";case n.pipeline:return"|>";case n.nullishCoalescing:return"??";case n.logicalOR:return"||";case n.logicalAND:return"&&";case n.bitwiseOR:return"|";case n.bitwiseXOR:return"^";case n.bitwiseAND:return"&";case n.equality:return"==/!=";case n.lessThan:return"<";case n.greaterThan:return">";case n.relationalOrEqual:return"<=/>=";case n.bitShiftL:return"<<";case n.bitShiftR:return">>/>>>";case n.plus:return"+";case n.minus:return"-";case n.modulo:return"%";case n.star:return"*";case n.slash:return"/";case n.exponent:return"**";case n.jsxName:return"jsxName";case n.jsxText:return"jsxText";case n.jsxEmptyText:return"jsxEmptyText";case n.jsxTagStart:return"jsxTagStart";case n.jsxTagEnd:return"jsxTagEnd";case n.typeParameterStart:return"typeParameterStart";case n.nonNullAssertion:return"nonNullAssertion";case n._break:return"break";case n._case:return"case";case n._catch:return"catch";case n._continue:return"continue";case n._debugger:return"debugger";case n._default:return"default";case n._do:return"do";case n._else:return"else";case n._finally:return"finally";case n._for:return"for";case n._function:return"function";case n._if:return"if";case n._return:return"return";case n._switch:return"switch";case n._throw:return"throw";case n._try:return"try";case n._var:return"var";case n._let:return"let";case n._const:return"const";case n._while:return"while";case n._with:return"with";case n._new:return"new";case n._this:return"this";case n._super:return"super";case n._class:return"class";case n._extends:return"extends";case n._export:return"export";case n._import:return"import";case n._yield:return"yield";case n._null:return"null";case n._true:return"true";case n._false:return"false";case n._in:return"in";case n._instanceof:return"instanceof";case n._typeof:return"typeof";case n._void:return"void";case n._delete:return"delete";case n._async:return"async";case n._get:return"get";case n._set:return"set";case n._declare:return"declare";case n._readonly:return"readonly";case n._abstract:return"abstract";case n._static:return"static";case n._public:return"public";case n._private:return"private";case n._protected:return"protected";case n._override:return"override";case n._as:return"as";case n._enum:return"enum";case n._type:return"type";case n._implements:return"implements";default:return""}}class Ft{constructor(e,s,i){this.startTokenIndex=e,this.endTokenIndex=s,this.isFunctionScope=i}}class Zd{constructor(e,s,i,r,o,a,c,l,h,d,m,_,x){this.potentialArrowAt=e,this.noAnonFunctionType=s,this.inDisallowConditionalTypesContext=i,this.tokensLength=r,this.scopesLength=o,this.pos=a,this.type=c,this.contextualKeyword=l,this.start=h,this.end=d,this.isType=m,this.scopeDepth=_,this.error=x}}class Ge{constructor(){Ge.prototype.__init.call(this),Ge.prototype.__init2.call(this),Ge.prototype.__init3.call(this),Ge.prototype.__init4.call(this),Ge.prototype.__init5.call(this),Ge.prototype.__init6.call(this),Ge.prototype.__init7.call(this),Ge.prototype.__init8.call(this),Ge.prototype.__init9.call(this),Ge.prototype.__init10.call(this),Ge.prototype.__init11.call(this),Ge.prototype.__init12.call(this),Ge.prototype.__init13.call(this)}__init(){this.potentialArrowAt=-1}__init2(){this.noAnonFunctionType=false}__init3(){this.inDisallowConditionalTypesContext=false}__init4(){this.tokens=[]}__init5(){this.scopes=[]}__init6(){this.pos=0}__init7(){this.type=n.eof}__init8(){this.contextualKeyword=g.NONE}__init9(){this.start=0}__init10(){this.end=0}__init11(){this.isType=false}__init12(){this.scopeDepth=0}__init13(){this.error=null}snapshot(){return new Zd(this.potentialArrowAt,this.noAnonFunctionType,this.inDisallowConditionalTypesContext,this.tokens.length,this.scopes.length,this.pos,this.type,this.contextualKeyword,this.start,this.end,this.isType,this.scopeDepth,this.error)}restoreFromSnapshot(e){this.potentialArrowAt=e.potentialArrowAt,this.noAnonFunctionType=e.noAnonFunctionType,this.inDisallowConditionalTypesContext=e.inDisallowConditionalTypesContext,this.tokens.length=e.tokensLength,this.scopes.length=e.scopesLength,this.pos=e.pos,this.type=e.type,this.contextualKeyword=e.contextualKeyword,this.start=e.start,this.end=e.end,this.isType=e.isType,this.scopeDepth=e.scopeDepth,this.error=e.error}}var b;(function(t){t[t.backSpace=8]="backSpace";const s=10;t[t.lineFeed=s]="lineFeed";const i=9;t[t.tab=i]="tab";const r=13;t[t.carriageReturn=r]="carriageReturn";const o=14;t[t.shiftOut=o]="shiftOut";const a=32;t[t.space=a]="space";const c=33;t[t.exclamationMark=c]="exclamationMark";const l=34;t[t.quotationMark=l]="quotationMark";const h=35;t[t.numberSign=h]="numberSign";const d=36;t[t.dollarSign=d]="dollarSign";const m=37;t[t.percentSign=m]="percentSign";const _=38;t[t.ampersand=_]="ampersand";const x=39;t[t.apostrophe=x]="apostrophe";const E=40;t[t.leftParenthesis=E]="leftParenthesis";const N=41;t[t.rightParenthesis=N]="rightParenthesis";const F=42;t[t.asterisk=F]="asterisk";const U=43;t[t.plusSign=U]="plusSign";const P=44;t[t.comma=P]="comma";const X=45;t[t.dash=X]="dash";const $=46;t[t.dot=$]="dot";const te=47;t[t.slash=te]="slash";const ee=48;t[t.digit0=ee]="digit0";const Q=49;t[t.digit1=Q]="digit1";const z=50;t[t.digit2=z]="digit2";const ne=51;t[t.digit3=ne]="digit3";const v=52;t[t.digit4=v]="digit4";const y=53;t[t.digit5=y]="digit5";const k=54;t[t.digit6=k]="digit6";const V=55;t[t.digit7=V]="digit7";const G=56;t[t.digit8=G]="digit8";const O=57;t[t.digit9=O]="digit9";const R=58;t[t.colon=R]="colon";const B=59;t[t.semicolon=B]="semicolon";const M=60;t[t.lessThan=M]="lessThan";const C=61;t[t.equalsTo=C]="equalsTo";const H=62;t[t.greaterThan=H]="greaterThan";const W=63;t[t.questionMark=W]="questionMark";const J=64;t[t.atSign=J]="atSign";const ce=65;t[t.uppercaseA=ce]="uppercaseA";const ae=66;t[t.uppercaseB=ae]="uppercaseB";const w=67;t[t.uppercaseC=w]="uppercaseC";const T=68;t[t.uppercaseD=T]="uppercaseD";const D=69;t[t.uppercaseE=D]="uppercaseE";const L=70;t[t.uppercaseF=L]="uppercaseF";const j=71;t[t.uppercaseG=j]="uppercaseG";const se=72;t[t.uppercaseH=se]="uppercaseH";const re=73;t[t.uppercaseI=re]="uppercaseI";const pe=74;t[t.uppercaseJ=pe]="uppercaseJ";const Se=75;t[t.uppercaseK=Se]="uppercaseK";const ke=76;t[t.uppercaseL=ke]="uppercaseL";const Fe=77;t[t.uppercaseM=Fe]="uppercaseM";const Ye=78;t[t.uppercaseN=Ye]="uppercaseN";const Ie=79;t[t.uppercaseO=Ie]="uppercaseO";const Ve=80;t[t.uppercaseP=Ve]="uppercaseP";const $e=81;t[t.uppercaseQ=$e]="uppercaseQ";const fs=82;t[t.uppercaseR=fs]="uppercaseR";const Es=83;t[t.uppercaseS=Es]="uppercaseS";const Ws=84;t[t.uppercaseT=Ws]="uppercaseT";const Dr=85;t[t.uppercaseU=Dr]="uppercaseU";const Nr=86;t[t.uppercaseV=Nr]="uppercaseV";const Fr=87;t[t.uppercaseW=Fr]="uppercaseW";const Ur=88;t[t.uppercaseX=Ur]="uppercaseX";const Mr=89;t[t.uppercaseY=Mr]="uppercaseY";const Or=90;t[t.uppercaseZ=Or]="uppercaseZ";const Br=91;t[t.leftSquareBracket=Br]="leftSquareBracket";const Vr=92;t[t.backslash=Vr]="backslash";const $r=93;t[t.rightSquareBracket=$r]="rightSquareBracket";const jr=94;t[t.caret=jr]="caret";const qr=95;t[t.underscore=qr]="underscore";const Hr=96;t[t.graveAccent=Hr]="graveAccent";const Gr=97;t[t.lowercaseA=Gr]="lowercaseA";const Wr=98;t[t.lowercaseB=Wr]="lowercaseB";const Xr=99;t[t.lowercaseC=Xr]="lowercaseC";const zr=100;t[t.lowercaseD=zr]="lowercaseD";const Yr=101;t[t.lowercaseE=Yr]="lowercaseE";const Kr=102;t[t.lowercaseF=Kr]="lowercaseF";const Zr=103;t[t.lowercaseG=Zr]="lowercaseG";const Qr=104;t[t.lowercaseH=Qr]="lowercaseH";const Jr=105;t[t.lowercaseI=Jr]="lowercaseI";const en=106;t[t.lowercaseJ=en]="lowercaseJ";const tn=107;t[t.lowercaseK=tn]="lowercaseK";const sn=108;t[t.lowercaseL=sn]="lowercaseL";const rn=109;t[t.lowercaseM=rn]="lowercaseM";const nn=110;t[t.lowercaseN=nn]="lowercaseN";const on=111;t[t.lowercaseO=on]="lowercaseO";const an=112;t[t.lowercaseP=an]="lowercaseP";const cn=113;t[t.lowercaseQ=cn]="lowercaseQ";const un=114;t[t.lowercaseR=un]="lowercaseR";const ln=115;t[t.lowercaseS=ln]="lowercaseS";const hn=116;t[t.lowercaseT=hn]="lowercaseT";const fn=117;t[t.lowercaseU=fn]="lowercaseU";const dn=118;t[t.lowercaseV=dn]="lowercaseV";const pn=119;t[t.lowercaseW=pn]="lowercaseW";const mn=120;t[t.lowercaseX=mn]="lowercaseX";const gn=121;t[t.lowercaseY=gn]="lowercaseY";const bn=122;t[t.lowercaseZ=bn]="lowercaseZ";const yn=123;t[t.leftCurlyBrace=yn]="leftCurlyBrace";const _n=124;t[t.verticalBar=_n]="verticalBar";const vn=125;t[t.rightCurlyBrace=vn]="rightCurlyBrace";const xn=126;t[t.tilde=xn]="tilde";const kn=160;t[t.nonBreakingSpace=kn]="nonBreakingSpace";const wn=5760;t[t.oghamSpaceMark=wn]="oghamSpaceMark";const Sn=8232;t[t.lineSeparator=Sn]="lineSeparator";const En=8233;t[t.paragraphSeparator=En]="paragraphSeparator"})(b||(b={}));let Er,me,_e,u,q,wl;function li(){return wl++}function Qd(t){if("pos"in t){const e=ep(t.pos);t.message+=` (${e.line}:${e.column})`,t.loc=e}return t}class Jd{constructor(e,s){this.line=e,this.column=s}}function ep(t){let e=1,s=1;for(let i=0;i<t;i++)q.charCodeAt(i)===b.lineFeed?(e++,s=1):s++;return new Jd(e,s)}function tp(t,e,s,i){q=t,u=new Ge,wl=1,Er=e,me=s,_e=i}function Z(t){return u.contextualKeyword===t}function Yo(t){const e=xi();return e.type===n.name&&e.contextualKeyword===t}function Le(t){return u.contextualKeyword===t&&S(n.name)}function Re(t){Le(t)||le()}function rt(){return p(n.eof)||p(n.braceR)||Xe()}function Xe(){const t=u.tokens[u.tokens.length-1],e=t?t.end:0;for(let s=e;s<u.start;s++){const i=q.charCodeAt(s);if(i===b.lineFeed||i===b.carriageReturn||i===8232||i===8233)return true}return false}function Sl(){const t=Ko();for(let e=u.end;e<t;e++){const s=q.charCodeAt(e);if(s===b.lineFeed||s===b.carriageReturn||s===8232||s===8233)return true}return false}function Ct(){return S(n.semi)||rt()}function Ee(){Ct()||le('Unexpected token, expected ";"')}function A(t){S(t)||le(`Unexpected token, expected "${Kd(t)}"`)}function le(t="Unexpected token",e=u.start){if(u.error)return;const s=new SyntaxError(t);s.pos=e,u.error=s,u.pos=q.length,ue(n.eof)}const El=[9,11,12,b.space,b.nonBreakingSpace,b.oghamSpaceMark,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288,65279],vc=/(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g,Tl=new Uint8Array(65536);for(const t of El)Tl[t]=1;function sp(t){if(t<48)return t===36;if(t<58)return true;if(t<65)return false;if(t<91)return true;if(t<97)return t===95;if(t<123)return true;if(t<128)return false;throw new Error("Should not be called with non-ASCII char code.")}const _t=new Uint8Array(65536);for(let t=0;t<128;t++)_t[t]=sp(t)?1:0;for(let t=128;t<65536;t++)_t[t]=1;for(const t of El)_t[t]=0;_t[8232]=0;_t[8233]=0;const vi=_t.slice();for(let t=b.digit0;t<=b.digit9;t++)vi[t]=0;const xc=new Int32Array([-1,27,783,918,1755,2376,2862,3483,-1,3699,-1,4617,4752,4833,5130,5508,5940,-1,6480,6939,7749,8181,8451,8613,-1,8829,-1,-1,-1,54,243,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,432,-1,-1,-1,675,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,81,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,108,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,135,-1,-1,-1,-1,-1,-1,-1,-1,-1,162,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,189,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,216,-1,-1,-1,-1,-1,-1,g._abstract<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,270,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,297,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,324,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,351,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,378,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,405,-1,-1,-1,-1,-1,-1,-1,-1,g._accessor<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,g._as<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,459,-1,-1,-1,-1,-1,594,-1,-1,-1,-1,-1,-1,486,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,513,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,540,-1,-1,-1,-1,-1,-1,g._assert<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,567,-1,-1,-1,-1,-1,-1,-1,g._asserts<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,621,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,648,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,g._async<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,702,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,729,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,756,-1,-1,-1,-1,-1,-1,g._await<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,810,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,837,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,864,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,891,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,(n._break<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,945,-1,-1,-1,-1,-1,-1,1107,-1,-1,-1,1242,-1,-1,1350,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,972,1026,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,999,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,(n._case<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1053,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1080,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,(n._catch<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1134,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1161,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1188,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1215,-1,-1,-1,-1,-1,-1,-1,g._checks<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1269,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1296,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1323,-1,-1,-1,-1,-1,-1,-1,(n._class<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1377,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1404,1620,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1431,-1,-1,-1,-1,-1,-1,(n._const<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1458,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1485,-1,-1,-1,-1,-1,-1,-1,-1,1512,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1539,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1566,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1593,-1,-1,-1,-1,-1,-1,-1,-1,g._constructor<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1647,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1674,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1701,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1728,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,(n._continue<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1782,-1,-1,-1,-1,-1,-1,-1,-1,-1,2349,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1809,1971,-1,-1,2106,-1,-1,-1,-1,-1,2241,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1836,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1863,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1890,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1917,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1944,-1,-1,-1,-1,-1,-1,-1,-1,(n._debugger<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1998,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2025,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2052,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2079,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,g._declare<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2133,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2160,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2187,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2214,-1,-1,-1,-1,-1,-1,(n._default<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2268,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2295,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2322,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,(n._delete<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,(n._do<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2403,-1,2484,-1,-1,-1,-1,-1,-1,-1,-1,-1,2565,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2430,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2457,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,(n._else<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2511,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2538,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,g._enum<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2592,-1,-1,-1,2727,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2619,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2646,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2673,-1,-1,-1,-1,-1,-1,(n._export<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2700,-1,-1,-1,-1,-1,-1,-1,g._exports<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2754,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2781,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2808,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2835,-1,-1,-1,-1,-1,-1,-1,(n._extends<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2889,-1,-1,-1,-1,-1,-1,-1,2997,-1,-1,-1,-1,-1,3159,-1,-1,3213,-1,-1,3294,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2916,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2943,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2970,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,(n._false<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3024,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3051,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3078,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3105,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3132,-1,(n._finally<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3186,-1,-1,-1,-1,-1,-1,-1,-1,(n._for<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3240,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3267,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,g._from<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3321,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3348,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3375,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3402,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3429,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3456,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,(n._function<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3510,-1,-1,-1,-1,-1,-1,3564,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3537,-1,-1,-1,-1,-1,-1,g._get<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3591,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3618,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3645,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3672,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,g._global<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3726,-1,-1,-1,-1,-1,-1,3753,4077,-1,-1,-1,-1,4590,-1,-1,-1,-1,-1,-1,-1,(n._if<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3780,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3807,-1,-1,3996,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3834,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3861,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3888,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3915,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3942,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3969,-1,-1,-1,-1,-1,-1,-1,g._implements<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4023,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4050,-1,-1,-1,-1,-1,-1,(n._import<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,(n._in<<1)+1,-1,-1,-1,-1,-1,4104,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4185,4401,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4131,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4158,-1,-1,-1,-1,-1,-1,-1,-1,g._infer<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4212,-1,-1,-1,-1,-1,-1,-1,4239,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4266,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4293,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4320,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4347,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4374,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,(n._instanceof<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4428,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4455,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4482,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4509,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4536,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4563,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,g._interface<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,g._is<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4644,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4671,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4698,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4725,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,g._keyof<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4779,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4806,-1,-1,-1,-1,-1,-1,(n._let<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4860,-1,-1,-1,-1,-1,4995,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4887,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4914,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4941,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4968,-1,-1,-1,-1,-1,-1,-1,g._mixins<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,5022,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,5049,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,5076,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,5103,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,g._module<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,5157,-1,-1,-1,5373,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,5427,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,5184,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,5211,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,5238,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,5265,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,5292,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,5319,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,5346,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,g._namespace<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,5400,-1,-1,-1,(n._new<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,5454,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,5481,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,(n._null<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,5535,-1,-1,-1,-1,-1,-1,-1,-1,-1,5562,-1,-1,-1,-1,5697,5751,-1,-1,-1,-1,g._of<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,5589,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,5616,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,5643,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,5670,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,g._opaque<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,5724,-1,-1,-1,-1,-1,-1,g._out<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,5778,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,5805,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,5832,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,5859,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,5886,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,5913,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,g._override<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,5967,-1,-1,6345,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,5994,-1,-1,-1,-1,-1,6129,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,6021,-1,-1,-1,-1,-1,6048,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,6075,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,6102,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,g._private<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,6156,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,6183,-1,-1,-1,-1,-1,-1,-1,-1,-1,6318,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,6210,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,6237,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,6264,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,6291,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,g._protected<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,g._proto<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,6372,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,6399,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,6426,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,6453,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,g._public<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,6507,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,6534,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,6696,-1,-1,6831,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,6561,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,6588,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,6615,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,6642,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,6669,-1,g._readonly<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,6723,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,6750,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,6777,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,6804,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,g._require<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,6858,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,6885,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,6912,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,(n._return<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,6966,-1,-1,-1,7182,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7236,7371,-1,7479,-1,7614,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,6993,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7020,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7047,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7074,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7101,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7128,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7155,-1,-1,-1,-1,-1,-1,-1,g._satisfies<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7209,-1,-1,-1,-1,-1,-1,g._set<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7263,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7290,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7317,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7344,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,g._static<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7398,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7425,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7452,-1,-1,-1,-1,-1,-1,-1,-1,(n._super<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7506,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7533,-1,-1,-1,-1,-1,-1,-1,-1,-1,7560,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7587,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,(n._switch<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7641,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7668,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7695,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7722,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,g._symbol<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7776,-1,-1,-1,-1,-1,-1,-1,-1,-1,7938,-1,-1,-1,-1,-1,-1,8046,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7803,-1,-1,-1,-1,-1,-1,-1,-1,7857,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7830,-1,-1,-1,-1,-1,-1,-1,(n._this<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7884,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7911,-1,-1,-1,(n._throw<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7965,-1,-1,-1,8019,-1,-1,-1,-1,-1,-1,7992,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,(n._true<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,(n._try<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8073,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8100,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,g._type<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8127,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8154,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,(n._typeof<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8208,-1,-1,-1,-1,8343,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8235,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8262,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8289,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8316,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,g._unique<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8370,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8397,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8424,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,g._using<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8478,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8532,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8505,-1,-1,-1,-1,-1,-1,-1,-1,(n._var<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8559,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8586,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,(n._void<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8640,8748,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8667,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8694,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8721,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,(n._while<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8775,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8802,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,(n._with<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8856,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8883,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8910,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8937,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,(n._yield<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1]);function ip(){let t=0,e=0,s=u.pos;for(;s<q.length&&(e=q.charCodeAt(s),!(e<b.lowercaseA||e>b.lowercaseZ));){const r=xc[t+(e-b.lowercaseA)+1];if(r===-1)break;t=r,s++}const i=xc[t];if(i>-1&&!_t[e]){u.pos=s,i&1?ue(i>>>1):ue(n.name,i>>>1);return}for(;s<q.length;){const r=q.charCodeAt(s);if(_t[r])s++;else if(r===b.backslash){if(s+=2,q.charCodeAt(s)===b.leftCurlyBrace){for(;s<q.length&&q.charCodeAt(s)!==b.rightCurlyBrace;)s++;s++}}else if(r===b.atSign&&q.charCodeAt(s+1)===b.atSign)s+=2;else break}u.pos=s,ue(n.name)}var ie;(function(t){t[t.Access=0]="Access";const s=1;t[t.ExportAccess=s]="ExportAccess";const i=s+1;t[t.TopLevelDeclaration=i]="TopLevelDeclaration";const r=i+1;t[t.FunctionScopedDeclaration=r]="FunctionScopedDeclaration";const o=r+1;t[t.BlockScopedDeclaration=o]="BlockScopedDeclaration";const a=o+1;t[t.ObjectShorthandTopLevelDeclaration=a]="ObjectShorthandTopLevelDeclaration";const c=a+1;t[t.ObjectShorthandFunctionScopedDeclaration=c]="ObjectShorthandFunctionScopedDeclaration";const l=c+1;t[t.ObjectShorthandBlockScopedDeclaration=l]="ObjectShorthandBlockScopedDeclaration";const h=l+1;t[t.ObjectShorthand=h]="ObjectShorthand";const d=h+1;t[t.ImportDeclaration=d]="ImportDeclaration";const m=d+1;t[t.ObjectKey=m]="ObjectKey";const _=m+1;t[t.ImportAccess=_]="ImportAccess"})(ie||(ie={}));var mt;(function(t){t[t.NoChildren=0]="NoChildren";const s=1;t[t.OneChild=s]="OneChild";const i=s+1;t[t.StaticChildren=i]="StaticChildren";const r=i+1;t[t.KeyAfterPropSpread=r]="KeyAfterPropSpread"})(mt||(mt={}));function Al(t){const e=t.identifierRole;return e===ie.TopLevelDeclaration||e===ie.FunctionScopedDeclaration||e===ie.BlockScopedDeclaration||e===ie.ObjectShorthandTopLevelDeclaration||e===ie.ObjectShorthandFunctionScopedDeclaration||e===ie.ObjectShorthandBlockScopedDeclaration}function rp(t){const e=t.identifierRole;return e===ie.FunctionScopedDeclaration||e===ie.BlockScopedDeclaration||e===ie.ObjectShorthandFunctionScopedDeclaration||e===ie.ObjectShorthandBlockScopedDeclaration}function Cl(t){const e=t.identifierRole;return e===ie.TopLevelDeclaration||e===ie.ObjectShorthandTopLevelDeclaration||e===ie.ImportDeclaration}function np(t){const e=t.identifierRole;return e===ie.TopLevelDeclaration||e===ie.BlockScopedDeclaration||e===ie.ObjectShorthandTopLevelDeclaration||e===ie.ObjectShorthandBlockScopedDeclaration}function op(t){const e=t.identifierRole;return e===ie.FunctionScopedDeclaration||e===ie.ObjectShorthandFunctionScopedDeclaration}function ap(t){return t.identifierRole===ie.ObjectShorthandTopLevelDeclaration||t.identifierRole===ie.ObjectShorthandBlockScopedDeclaration||t.identifierRole===ie.ObjectShorthandFunctionScopedDeclaration}class Tr{constructor(){this.type=u.type,this.contextualKeyword=u.contextualKeyword,this.start=u.start,this.end=u.end,this.scopeDepth=u.scopeDepth,this.isType=u.isType,this.identifierRole=null,this.jsxRole=null,this.shadowsGlobal=false,this.isAsyncOperation=false,this.contextId=null,this.rhsEndIndex=null,this.isExpression=false,this.numNullishCoalesceStarts=0,this.numNullishCoalesceEnds=0,this.isOptionalChainStart=false,this.isOptionalChainEnd=false,this.subscriptStartIndex=null,this.nullishStartIndex=null}}function I(){u.tokens.push(new Tr),Ll()}function is(){u.tokens.push(new Tr),u.start=u.pos,Sp()}function cp(){u.type===n.assign&&--u.pos,xp()}function de(t){for(let s=u.tokens.length-t;s<u.tokens.length;s++)u.tokens[s].isType=true;const e=u.isType;return u.isType=true,e}function fe(t){u.isType=t}function S(t){return p(t)?(I(),true):false}function Il(t){const e=u.isType;u.isType=true,S(t),u.isType=e}function p(t){return u.type===t}function Ae(){const t=u.snapshot();I();const e=u.type;return u.restoreFromSnapshot(t),e}class up{constructor(e,s){this.type=e,this.contextualKeyword=s}}function xi(){const t=u.snapshot();I();const e=u.type,s=u.contextualKeyword;return u.restoreFromSnapshot(t),new up(e,s)}function Ko(){return Rl(u.pos)}function Rl(t){vc.lastIndex=t;const e=vc.exec(q);return t+e[0].length}function Pl(){return q.charCodeAt(Ko())}function Ll(){if(Nl(),u.start=u.pos,u.pos>=q.length){const t=u.tokens;t.length>=2&&t[t.length-1].start>=q.length&&t[t.length-2].start>=q.length&&le("Unexpectedly reached the end of input."),ue(n.eof);return}lp(q.charCodeAt(u.pos))}function lp(t){vi[t]||t===b.backslash||t===b.atSign&&q.charCodeAt(u.pos+1)===b.atSign?ip():Ml(t)}function hp(){for(;q.charCodeAt(u.pos)!==b.asterisk||q.charCodeAt(u.pos+1)!==b.slash;)if(u.pos++,u.pos>q.length){le("Unterminated comment",u.pos-2);return}u.pos+=2}function Dl(t){let e=q.charCodeAt(u.pos+=t);if(u.pos<q.length)for(;e!==b.lineFeed&&e!==b.carriageReturn&&e!==b.lineSeparator&&e!==b.paragraphSeparator&&++u.pos<q.length;)e=q.charCodeAt(u.pos)}function Nl(){for(;u.pos<q.length;){const t=q.charCodeAt(u.pos);switch(t){case b.carriageReturn:q.charCodeAt(u.pos+1)===b.lineFeed&&++u.pos;case b.lineFeed:case b.lineSeparator:case b.paragraphSeparator:++u.pos;break;case b.slash:switch(q.charCodeAt(u.pos+1)){case b.asterisk:u.pos+=2,hp();break;case b.slash:Dl(2);break;default:return}break;default:if(Tl[t])++u.pos;else return}}}function ue(t,e=g.NONE){u.end=u.pos,u.type=t,u.contextualKeyword=e}function fp(){const t=q.charCodeAt(u.pos+1);if(t>=b.digit0&&t<=b.digit9){Ol(true);return}t===b.dot&&q.charCodeAt(u.pos+2)===b.dot?(u.pos+=3,ue(n.ellipsis)):(++u.pos,ue(n.dot))}function dp(){q.charCodeAt(u.pos+1)===b.equalsTo?xe(n.assign,2):xe(n.slash,1)}function pp(t){let e=t===b.asterisk?n.star:n.modulo,s=1,i=q.charCodeAt(u.pos+1);t===b.asterisk&&i===b.asterisk&&(s++,i=q.charCodeAt(u.pos+2),e=n.exponent),i===b.equalsTo&&q.charCodeAt(u.pos+2)!==b.greaterThan&&(s++,e=n.assign),xe(e,s)}function mp(t){const e=q.charCodeAt(u.pos+1);if(e===t){q.charCodeAt(u.pos+2)===b.equalsTo?xe(n.assign,3):xe(t===b.verticalBar?n.logicalOR:n.logicalAND,2);return}if(t===b.verticalBar){if(e===b.greaterThan){xe(n.pipeline,2);return}else if(e===b.rightCurlyBrace&&_e){xe(n.braceBarR,2);return}}if(e===b.equalsTo){xe(n.assign,2);return}xe(t===b.verticalBar?n.bitwiseOR:n.bitwiseAND,1)}function gp(){q.charCodeAt(u.pos+1)===b.equalsTo?xe(n.assign,2):xe(n.bitwiseXOR,1)}function bp(t){const e=q.charCodeAt(u.pos+1);if(e===t){xe(n.preIncDec,2);return}e===b.equalsTo?xe(n.assign,2):t===b.plusSign?xe(n.plus,1):xe(n.minus,1)}function yp(){const t=q.charCodeAt(u.pos+1);if(t===b.lessThan){if(q.charCodeAt(u.pos+2)===b.equalsTo){xe(n.assign,3);return}u.isType?xe(n.lessThan,1):xe(n.bitShiftL,2);return}t===b.equalsTo?xe(n.relationalOrEqual,2):xe(n.lessThan,1)}function Fl(){if(u.isType){xe(n.greaterThan,1);return}const t=q.charCodeAt(u.pos+1);if(t===b.greaterThan){const e=q.charCodeAt(u.pos+2)===b.greaterThan?3:2;if(q.charCodeAt(u.pos+e)===b.equalsTo){xe(n.assign,e+1);return}xe(n.bitShiftR,e);return}t===b.equalsTo?xe(n.relationalOrEqual,2):xe(n.greaterThan,1)}function Ul(){u.type===n.greaterThan&&(u.pos-=1,Fl())}function _p(t){const e=q.charCodeAt(u.pos+1);if(e===b.equalsTo){xe(n.equality,q.charCodeAt(u.pos+2)===b.equalsTo?3:2);return}if(t===b.equalsTo&&e===b.greaterThan){u.pos+=2,ue(n.arrow);return}xe(t===b.equalsTo?n.eq:n.bang,1)}function vp(){const t=q.charCodeAt(u.pos+1),e=q.charCodeAt(u.pos+2);t===b.questionMark&&!(_e&&u.isType)?e===b.equalsTo?xe(n.assign,3):xe(n.nullishCoalescing,2):t===b.dot&&!(e>=b.digit0&&e<=b.digit9)?(u.pos+=2,ue(n.questionDot)):(++u.pos,ue(n.question))}function Ml(t){switch(t){case b.numberSign:++u.pos,ue(n.hash);return;case b.dot:fp();return;case b.leftParenthesis:++u.pos,ue(n.parenL);return;case b.rightParenthesis:++u.pos,ue(n.parenR);return;case b.semicolon:++u.pos,ue(n.semi);return;case b.comma:++u.pos,ue(n.comma);return;case b.leftSquareBracket:++u.pos,ue(n.bracketL);return;case b.rightSquareBracket:++u.pos,ue(n.bracketR);return;case b.leftCurlyBrace:_e&&q.charCodeAt(u.pos+1)===b.verticalBar?xe(n.braceBarL,2):(++u.pos,ue(n.braceL));return;case b.rightCurlyBrace:++u.pos,ue(n.braceR);return;case b.colon:q.charCodeAt(u.pos+1)===b.colon?xe(n.doubleColon,2):(++u.pos,ue(n.colon));return;case b.questionMark:vp();return;case b.atSign:++u.pos,ue(n.at);return;case b.graveAccent:++u.pos,ue(n.backQuote);return;case b.digit0:{const e=q.charCodeAt(u.pos+1);if(e===b.lowercaseX||e===b.uppercaseX||e===b.lowercaseO||e===b.uppercaseO||e===b.lowercaseB||e===b.uppercaseB){kp();return}}case b.digit1:case b.digit2:case b.digit3:case b.digit4:case b.digit5:case b.digit6:case b.digit7:case b.digit8:case b.digit9:Ol(false);return;case b.quotationMark:case b.apostrophe:wp(t);return;case b.slash:dp();return;case b.percentSign:case b.asterisk:pp(t);return;case b.verticalBar:case b.ampersand:mp(t);return;case b.caret:gp();return;case b.plusSign:case b.dash:bp(t);return;case b.lessThan:yp();return;case b.greaterThan:Fl();return;case b.equalsTo:case b.exclamationMark:_p(t);return;case b.tilde:xe(n.tilde,1);return}le(`Unexpected character '${String.fromCharCode(t)}'`,u.pos)}function xe(t,e){u.pos+=e,ue(t)}function xp(){const t=u.pos;let e=false,s=false;for(;;){if(u.pos>=q.length){le("Unterminated regular expression",t);return}const i=q.charCodeAt(u.pos);if(e)e=false;else{if(i===b.leftSquareBracket)s=true;else if(i===b.rightSquareBracket&&s)s=false;else if(i===b.slash&&!s)break;e=i===b.backslash}++u.pos}++u.pos,Ep(),ue(n.regexp)}function $n(){for(;;){const t=q.charCodeAt(u.pos);if(t>=b.digit0&&t<=b.digit9||t===b.underscore)u.pos++;else break}}function kp(){for(u.pos+=2;;){const e=q.charCodeAt(u.pos);if(e>=b.digit0&&e<=b.digit9||e>=b.lowercaseA&&e<=b.lowercaseF||e>=b.uppercaseA&&e<=b.uppercaseF||e===b.underscore)u.pos++;else break}q.charCodeAt(u.pos)===b.lowercaseN?(++u.pos,ue(n.bigint)):ue(n.num)}function Ol(t){let e=false,s=false;t||$n();let i=q.charCodeAt(u.pos);if(i===b.dot&&(++u.pos,$n(),i=q.charCodeAt(u.pos)),(i===b.uppercaseE||i===b.lowercaseE)&&(i=q.charCodeAt(++u.pos),(i===b.plusSign||i===b.dash)&&++u.pos,$n(),i=q.charCodeAt(u.pos)),i===b.lowercaseN?(++u.pos,e=true):i===b.lowercaseM&&(++u.pos,s=true),e){ue(n.bigint);return}if(s){ue(n.decimal);return}ue(n.num)}function wp(t){for(u.pos++;;){if(u.pos>=q.length){le("Unterminated string constant");return}const e=q.charCodeAt(u.pos);if(e===b.backslash)u.pos++;else if(e===t)break;u.pos++}u.pos++,ue(n.string)}function Sp(){for(;;){if(u.pos>=q.length){le("Unterminated template");return}const t=q.charCodeAt(u.pos);if(t===b.graveAccent||t===b.dollarSign&&q.charCodeAt(u.pos+1)===b.leftCurlyBrace){if(u.pos===u.start&&p(n.template))if(t===b.dollarSign){u.pos+=2,ue(n.dollarBraceL);return}else{++u.pos,ue(n.backQuote);return}ue(n.template);return}t===b.backslash&&u.pos++,u.pos++}}function Ep(){for(;u.pos<q.length;){const t=q.charCodeAt(u.pos);if(_t[t])u.pos++;else if(t===b.backslash){if(u.pos+=2,q.charCodeAt(u.pos)===b.leftCurlyBrace){for(;u.pos<q.length&&q.charCodeAt(u.pos)!==b.rightCurlyBrace;)u.pos++;u.pos++}}else break}}function hi(t,e=t.currentIndex()){let s=e+1;if(Pi(t,s)){const i=t.identifierNameAtIndex(e);return{isType:false,leftName:i,rightName:i,endIndex:s}}if(s++,Pi(t,s))return{isType:true,leftName:null,rightName:null,endIndex:s};if(s++,Pi(t,s))return{isType:false,leftName:t.identifierNameAtIndex(e),rightName:t.identifierNameAtIndex(e+2),endIndex:s};if(s++,Pi(t,s))return{isType:true,leftName:null,rightName:null,endIndex:s};throw new Error(`Unexpected import/export specifier at ${e}`)}function Pi(t,e){const s=t.tokens[e];return s.type===n.braceR||s.type===n.comma}var Tp=new Map([["quot",'"'],["amp","&"],["apos","'"],["lt","<"],["gt",">"],["nbsp"," "],["iexcl","¡"],["cent","¢"],["pound","£"],["curren","¤"],["yen","¥"],["brvbar","¦"],["sect","§"],["uml","¨"],["copy","©"],["ordf","ª"],["laquo","«"],["not","¬"],["shy","­"],["reg","®"],["macr","¯"],["deg","°"],["plusmn","±"],["sup2","²"],["sup3","³"],["acute","´"],["micro","µ"],["para","¶"],["middot","·"],["cedil","¸"],["sup1","¹"],["ordm","º"],["raquo","»"],["frac14","¼"],["frac12","½"],["frac34","¾"],["iquest","¿"],["Agrave","À"],["Aacute","Á"],["Acirc","Â"],["Atilde","Ã"],["Auml","Ä"],["Aring","Å"],["AElig","Æ"],["Ccedil","Ç"],["Egrave","È"],["Eacute","É"],["Ecirc","Ê"],["Euml","Ë"],["Igrave","Ì"],["Iacute","Í"],["Icirc","Î"],["Iuml","Ï"],["ETH","Ð"],["Ntilde","Ñ"],["Ograve","Ò"],["Oacute","Ó"],["Ocirc","Ô"],["Otilde","Õ"],["Ouml","Ö"],["times","×"],["Oslash","Ø"],["Ugrave","Ù"],["Uacute","Ú"],["Ucirc","Û"],["Uuml","Ü"],["Yacute","Ý"],["THORN","Þ"],["szlig","ß"],["agrave","à"],["aacute","á"],["acirc","â"],["atilde","ã"],["auml","ä"],["aring","å"],["aelig","æ"],["ccedil","ç"],["egrave","è"],["eacute","é"],["ecirc","ê"],["euml","ë"],["igrave","ì"],["iacute","í"],["icirc","î"],["iuml","ï"],["eth","ð"],["ntilde","ñ"],["ograve","ò"],["oacute","ó"],["ocirc","ô"],["otilde","õ"],["ouml","ö"],["divide","÷"],["oslash","ø"],["ugrave","ù"],["uacute","ú"],["ucirc","û"],["uuml","ü"],["yacute","ý"],["thorn","þ"],["yuml","ÿ"],["OElig","Œ"],["oelig","œ"],["Scaron","Š"],["scaron","š"],["Yuml","Ÿ"],["fnof","ƒ"],["circ","ˆ"],["tilde","˜"],["Alpha","Α"],["Beta","Β"],["Gamma","Γ"],["Delta","Δ"],["Epsilon","Ε"],["Zeta","Ζ"],["Eta","Η"],["Theta","Θ"],["Iota","Ι"],["Kappa","Κ"],["Lambda","Λ"],["Mu","Μ"],["Nu","Ν"],["Xi","Ξ"],["Omicron","Ο"],["Pi","Π"],["Rho","Ρ"],["Sigma","Σ"],["Tau","Τ"],["Upsilon","Υ"],["Phi","Φ"],["Chi","Χ"],["Psi","Ψ"],["Omega","Ω"],["alpha","α"],["beta","β"],["gamma","γ"],["delta","δ"],["epsilon","ε"],["zeta","ζ"],["eta","η"],["theta","θ"],["iota","ι"],["kappa","κ"],["lambda","λ"],["mu","μ"],["nu","ν"],["xi","ξ"],["omicron","ο"],["pi","π"],["rho","ρ"],["sigmaf","ς"],["sigma","σ"],["tau","τ"],["upsilon","υ"],["phi","φ"],["chi","χ"],["psi","ψ"],["omega","ω"],["thetasym","ϑ"],["upsih","ϒ"],["piv","ϖ"],["ensp"," "],["emsp"," "],["thinsp"," "],["zwnj","‌"],["zwj","‍"],["lrm","‎"],["rlm","‏"],["ndash","–"],["mdash","—"],["lsquo","‘"],["rsquo","’"],["sbquo","‚"],["ldquo","“"],["rdquo","”"],["bdquo","„"],["dagger","†"],["Dagger","‡"],["bull","•"],["hellip","…"],["permil","‰"],["prime","′"],["Prime","″"],["lsaquo","‹"],["rsaquo","›"],["oline","‾"],["frasl","⁄"],["euro","€"],["image","ℑ"],["weierp","℘"],["real","ℜ"],["trade","™"],["alefsym","ℵ"],["larr","←"],["uarr","↑"],["rarr","→"],["darr","↓"],["harr","↔"],["crarr","↵"],["lArr","⇐"],["uArr","⇑"],["rArr","⇒"],["dArr","⇓"],["hArr","⇔"],["forall","∀"],["part","∂"],["exist","∃"],["empty","∅"],["nabla","∇"],["isin","∈"],["notin","∉"],["ni","∋"],["prod","∏"],["sum","∑"],["minus","−"],["lowast","∗"],["radic","√"],["prop","∝"],["infin","∞"],["ang","∠"],["and","∧"],["or","∨"],["cap","∩"],["cup","∪"],["int","∫"],["there4","∴"],["sim","∼"],["cong","≅"],["asymp","≈"],["ne","≠"],["equiv","≡"],["le","≤"],["ge","≥"],["sub","⊂"],["sup","⊃"],["nsub","⊄"],["sube","⊆"],["supe","⊇"],["oplus","⊕"],["otimes","⊗"],["perp","⊥"],["sdot","⋅"],["lceil","⌈"],["rceil","⌉"],["lfloor","⌊"],["rfloor","⌋"],["lang","〈"],["rang","〉"],["loz","◊"],["spades","♠"],["clubs","♣"],["hearts","♥"],["diams","♦"]]);function Bl(t){const[e,s]=kc(t.jsxPragma||"React.createElement"),[i,r]=kc(t.jsxFragmentPragma||"React.Fragment");return{base:e,suffix:s,fragmentBase:i,fragmentSuffix:r}}function kc(t){let e=t.indexOf(".");return e===-1&&(e=t.length),[t.slice(0,e),t.slice(e)]}class vt{getPrefixCode(){return""}getHoistedCode(){return""}getSuffixCode(){return""}}class ds extends vt{__init(){this.lastLineNumber=1}__init2(){this.lastIndex=0}__init3(){this.filenameVarName=null}__init4(){this.esmAutomaticImportNameResolutions={}}__init5(){this.cjsAutomaticModuleNameResolutions={}}constructor(e,s,i,r,o){super(),this.rootTransformer=e,this.tokens=s,this.importProcessor=i,this.nameManager=r,this.options=o,ds.prototype.__init.call(this),ds.prototype.__init2.call(this),ds.prototype.__init3.call(this),ds.prototype.__init4.call(this),ds.prototype.__init5.call(this),this.jsxPragmaInfo=Bl(o),this.isAutomaticRuntime=o.jsxRuntime==="automatic",this.jsxImportSource=o.jsxImportSource||"react"}process(){return this.tokens.matches1(n.jsxTagStart)?(this.processJSXTag(),true):false}getPrefixCode(){let e="";if(this.filenameVarName&&(e+=`const ${this.filenameVarName} = ${JSON.stringify(this.options.filePath||"")};`),this.isAutomaticRuntime)if(this.importProcessor)for(const[s,i]of Object.entries(this.cjsAutomaticModuleNameResolutions))e+=`var ${i} = require("${s}");`;else{const{createElement:s,...i}=this.esmAutomaticImportNameResolutions;s&&(e+=`import {createElement as ${s}} from "${this.jsxImportSource}";`);const r=Object.entries(i).map(([o,a])=>`${o} as ${a}`).join(", ");if(r){const o=this.jsxImportSource+(this.options.production?"/jsx-runtime":"/jsx-dev-runtime");e+=`import {${r}} from "${o}";`}}return e}processJSXTag(){const{jsxRole:e,start:s}=this.tokens.currentToken(),i=this.options.production?null:this.getElementLocationCode(s);this.isAutomaticRuntime&&e!==mt.KeyAfterPropSpread?this.transformTagToJSXFunc(i,e):this.transformTagToCreateElement(i)}getElementLocationCode(e){return`lineNumber: ${this.getLineNumberForIndex(e)}`}getLineNumberForIndex(e){const s=this.tokens.code;for(;this.lastIndex<e&&this.lastIndex<s.length;)s[this.lastIndex]===`
476
+ `&&this.lastLineNumber++,this.lastIndex++;return this.lastLineNumber}transformTagToJSXFunc(e,s){const i=s===mt.StaticChildren;this.tokens.replaceToken(this.getJSXFuncInvocationCode(i));let r=null;if(this.tokens.matches1(n.jsxTagEnd))this.tokens.replaceToken(`${this.getFragmentCode()}, {`),this.processAutomaticChildrenAndEndProps(s);else{if(this.processTagIntro(),this.tokens.appendCode(", {"),r=this.processProps(true),this.tokens.matches2(n.slash,n.jsxTagEnd))this.tokens.appendCode("}");else if(this.tokens.matches1(n.jsxTagEnd))this.tokens.removeToken(),this.processAutomaticChildrenAndEndProps(s);else throw new Error("Expected either /> or > at the end of the tag.");r&&this.tokens.appendCode(`, ${r}`)}for(this.options.production||(r===null&&this.tokens.appendCode(", void 0"),this.tokens.appendCode(`, ${i}, ${this.getDevSource(e)}, this`)),this.tokens.removeInitialToken();!this.tokens.matches1(n.jsxTagEnd);)this.tokens.removeToken();this.tokens.replaceToken(")")}transformTagToCreateElement(e){if(this.tokens.replaceToken(this.getCreateElementInvocationCode()),this.tokens.matches1(n.jsxTagEnd))this.tokens.replaceToken(`${this.getFragmentCode()}, null`),this.processChildren(true);else if(this.processTagIntro(),this.processPropsObjectWithDevInfo(e),!this.tokens.matches2(n.slash,n.jsxTagEnd))if(this.tokens.matches1(n.jsxTagEnd))this.tokens.removeToken(),this.processChildren(true);else throw new Error("Expected either /> or > at the end of the tag.");for(this.tokens.removeInitialToken();!this.tokens.matches1(n.jsxTagEnd);)this.tokens.removeToken();this.tokens.replaceToken(")")}getJSXFuncInvocationCode(e){return this.options.production?e?this.claimAutoImportedFuncInvocation("jsxs","/jsx-runtime"):this.claimAutoImportedFuncInvocation("jsx","/jsx-runtime"):this.claimAutoImportedFuncInvocation("jsxDEV","/jsx-dev-runtime")}getCreateElementInvocationCode(){if(this.isAutomaticRuntime)return this.claimAutoImportedFuncInvocation("createElement","");{const{jsxPragmaInfo:e}=this;return`${this.importProcessor&&this.importProcessor.getIdentifierReplacement(e.base)||e.base}${e.suffix}(`}}getFragmentCode(){if(this.isAutomaticRuntime)return this.claimAutoImportedName("Fragment",this.options.production?"/jsx-runtime":"/jsx-dev-runtime");{const{jsxPragmaInfo:e}=this;return(this.importProcessor&&this.importProcessor.getIdentifierReplacement(e.fragmentBase)||e.fragmentBase)+e.fragmentSuffix}}claimAutoImportedFuncInvocation(e,s){const i=this.claimAutoImportedName(e,s);return this.importProcessor?`${i}.call(void 0, `:`${i}(`}claimAutoImportedName(e,s){if(this.importProcessor){const i=this.jsxImportSource+s;return this.cjsAutomaticModuleNameResolutions[i]||(this.cjsAutomaticModuleNameResolutions[i]=this.importProcessor.getFreeIdentifierForPath(i)),`${this.cjsAutomaticModuleNameResolutions[i]}.${e}`}else return this.esmAutomaticImportNameResolutions[e]||(this.esmAutomaticImportNameResolutions[e]=this.nameManager.claimFreeName(`_${e}`)),this.esmAutomaticImportNameResolutions[e]}processTagIntro(){let e=this.tokens.currentIndex()+1;for(;this.tokens.tokens[e].isType||!this.tokens.matches2AtIndex(e-1,n.jsxName,n.jsxName)&&!this.tokens.matches2AtIndex(e-1,n.greaterThan,n.jsxName)&&!this.tokens.matches1AtIndex(e,n.braceL)&&!this.tokens.matches1AtIndex(e,n.jsxTagEnd)&&!this.tokens.matches2AtIndex(e,n.slash,n.jsxTagEnd);)e++;if(e===this.tokens.currentIndex()+1){const s=this.tokens.identifierName();Vl(s)&&this.tokens.replaceToken(`'${s}'`)}for(;this.tokens.currentIndex()<e;)this.rootTransformer.processToken()}processPropsObjectWithDevInfo(e){const s=this.options.production?"":`__self: this, __source: ${this.getDevSource(e)}`;if(!this.tokens.matches1(n.jsxName)&&!this.tokens.matches1(n.braceL)){s?this.tokens.appendCode(`, {${s}}`):this.tokens.appendCode(", null");return}this.tokens.appendCode(", {"),this.processProps(false),s?this.tokens.appendCode(` ${s}}`):this.tokens.appendCode("}")}processProps(e){let s=null;for(;;){if(this.tokens.matches2(n.jsxName,n.eq)){const i=this.tokens.identifierName();if(e&&i==="key"){s!==null&&this.tokens.appendCode(s.replace(/[^\n]/g,"")),this.tokens.removeToken(),this.tokens.removeToken();const r=this.tokens.snapshot();this.processPropValue(),s=this.tokens.dangerouslyGetAndRemoveCodeSinceSnapshot(r);continue}else this.processPropName(i),this.tokens.replaceToken(": "),this.processPropValue()}else if(this.tokens.matches1(n.jsxName)){const i=this.tokens.identifierName();this.processPropName(i),this.tokens.appendCode(": true")}else if(this.tokens.matches1(n.braceL))this.tokens.replaceToken(""),this.rootTransformer.processBalancedCode(),this.tokens.replaceToken("");else break;this.tokens.appendCode(",")}return s}processPropName(e){e.includes("-")?this.tokens.replaceToken(`'${e}'`):this.tokens.copyToken()}processPropValue(){this.tokens.matches1(n.braceL)?(this.tokens.replaceToken(""),this.rootTransformer.processBalancedCode(),this.tokens.replaceToken("")):this.tokens.matches1(n.jsxTagStart)?this.processJSXTag():this.processStringPropValue()}processStringPropValue(){const e=this.tokens.currentToken(),s=this.tokens.code.slice(e.start+1,e.end-1),i=wc(s),r=Cp(s);this.tokens.replaceToken(r+i)}processAutomaticChildrenAndEndProps(e){e===mt.StaticChildren?(this.tokens.appendCode(" children: ["),this.processChildren(false),this.tokens.appendCode("]}")):(e===mt.OneChild&&this.tokens.appendCode(" children: "),this.processChildren(false),this.tokens.appendCode("}"))}processChildren(e){let s=e;for(;;){if(this.tokens.matches2(n.jsxTagStart,n.slash))return;let i=false;if(this.tokens.matches1(n.braceL))this.tokens.matches2(n.braceL,n.braceR)?(this.tokens.replaceToken(""),this.tokens.replaceToken("")):(this.tokens.replaceToken(s?", ":""),this.rootTransformer.processBalancedCode(),this.tokens.replaceToken(""),i=true);else if(this.tokens.matches1(n.jsxTagStart))this.tokens.appendCode(s?", ":""),this.processJSXTag(),i=true;else if(this.tokens.matches1(n.jsxText)||this.tokens.matches1(n.jsxEmptyText))i=this.processChildTextElement(s);else throw new Error("Unexpected token when processing JSX children.");i&&(s=true)}}processChildTextElement(e){const s=this.tokens.currentToken(),i=this.tokens.code.slice(s.start,s.end),r=wc(i),o=Ap(i);return o==='""'?(this.tokens.replaceToken(r),false):(this.tokens.replaceToken(`${e?", ":""}${o}${r}`),true)}getDevSource(e){return`{fileName: ${this.getFilenameVarName()}, ${e}}`}getFilenameVarName(){return this.filenameVarName||(this.filenameVarName=this.nameManager.claimFreeName("_jsxFileName")),this.filenameVarName}}function Vl(t){const e=t.charCodeAt(0);return e>=b.lowercaseA&&e<=b.lowercaseZ}function Ap(t){let e="",s="",i=false,r=false;for(let o=0;o<t.length;o++){const a=t[o];if(a===" "||a===" "||a==="\r")i||(s+=a);else if(a===`
477
+ `)s="",i=true;else{if(r&&i&&(e+=" "),e+=s,s="",a==="&"){const{entity:c,newI:l}=$l(t,o+1);o=l-1,e+=c}else e+=a;r=true,i=false}}return i||(e+=s),JSON.stringify(e)}function wc(t){let e=0,s=0;for(const i of t)i===`
478
478
  `?(e++,s=0):i===" "&&s++;return`
479
479
  `.repeat(e)+" ".repeat(s)}function Cp(t){let e="";for(let s=0;s<t.length;s++){const i=t[s];if(i===`
480
480
  `)if(/\s/.test(t[s+1]))for(e+=" ";s<t.length&&/\s/.test(t[s+1]);)s++;else e+=`
481
- `;else if(i==="&"){const{entity:r,newI:a}=$l(t,s+1);e+=r,s=a-1}else e+=i}return JSON.stringify(e)}function $l(t,e){let s="",i=0,r,a=e;if(t[a]==="#"){let o=10;a++;let c;if(t[a]==="x")for(o=16,a++,c=a;a<t.length&&Rp(t.charCodeAt(a));)a++;else for(c=a;a<t.length&&Ip(t.charCodeAt(a));)a++;if(t[a]===";"){const l=t.slice(c,a);l&&(a++,r=String.fromCodePoint(parseInt(l,o)))}}else for(;a<t.length&&i++<10;){const o=t[a];if(a++,o===";"){r=Tp.get(s);break}s+=o}return r?{entity:r,newI:a}:{entity:"&",newI:e}}function Ip(t){return t>=b.digit0&&t<=b.digit9}function Rp(t){return t>=b.digit0&&t<=b.digit9||t>=b.lowercaseA&&t<=b.lowercaseF||t>=b.uppercaseA&&t<=b.uppercaseF}function jl(t,e){const s=Ol(e),i=new Set;for(let r=0;r<t.tokens.length;r++){const a=t.tokens[r];if(a.type===n.name&&!a.isType&&(a.identifierRole===ie.Access||a.identifierRole===ie.ObjectShorthand||a.identifierRole===ie.ExportAccess)&&!a.shadowsGlobal&&i.add(t.identifierNameForToken(a)),a.type===n.jsxTagStart&&i.add(s.base),a.type===n.jsxTagStart&&r+1<t.tokens.length&&t.tokens[r+1].type===n.jsxTagEnd&&(i.add(s.base),i.add(s.fragmentBase)),a.type===n.jsxName&&a.identifierRole===ie.Access){const o=t.identifierNameForToken(a);(!Vl(o)||t.tokens[r+1].type===n.dot)&&i.add(t.identifierNameForToken(a))}}return i}class ps{__init(){this.nonTypeIdentifiers=new Set}__init2(){this.importInfoByPath=new Map}__init3(){this.importsToReplace=new Map}__init4(){this.identifierReplacements=new Map}__init5(){this.exportBindingsByLocalName=new Map}constructor(e,s,i,r,a,o,c){this.nameManager=e,this.tokens=s,this.enableLegacyTypeScriptModuleInterop=i,this.options=r,this.isTypeScriptTransformEnabled=a,this.keepUnusedImports=o,this.helperManager=c,ps.prototype.__init.call(this),ps.prototype.__init2.call(this),ps.prototype.__init3.call(this),ps.prototype.__init4.call(this),ps.prototype.__init5.call(this)}preprocessTokens(){for(let e=0;e<this.tokens.tokens.length;e++)this.tokens.matches1AtIndex(e,n._import)&&!this.tokens.matches3AtIndex(e,n._import,n.name,n.eq)&&this.preprocessImportAtIndex(e),this.tokens.matches1AtIndex(e,n._export)&&!this.tokens.matches2AtIndex(e,n._export,n.eq)&&this.preprocessExportAtIndex(e);this.generateImportReplacements()}pruneTypeOnlyImports(){this.nonTypeIdentifiers=jl(this.tokens,this.options);for(const[e,s]of this.importInfoByPath.entries()){if(s.hasBareImport||s.hasStarExport||s.exportStarNames.length>0||s.namedExports.length>0)continue;[...s.defaultNames,...s.wildcardNames,...s.namedImports.map(({localName:r})=>r)].every(r=>this.shouldAutomaticallyElideImportedName(r))&&this.importsToReplace.set(e,"")}}shouldAutomaticallyElideImportedName(e){return this.isTypeScriptTransformEnabled&&!this.keepUnusedImports&&!this.nonTypeIdentifiers.has(e)}generateImportReplacements(){for(const[e,s]of this.importInfoByPath.entries()){const{defaultNames:i,wildcardNames:r,namedImports:a,namedExports:o,exportStarNames:c,hasStarExport:l}=s;if(i.length===0&&r.length===0&&a.length===0&&o.length===0&&c.length===0&&!l){this.importsToReplace.set(e,`require('${e}');`);continue}const h=this.getFreeIdentifierForPath(e);let d;this.enableLegacyTypeScriptModuleInterop?d=h:d=r.length>0?r[0]:this.getFreeIdentifierForPath(e);let m=`var ${h} = require('${e}');`;if(r.length>0)for(const _ of r){const x=this.enableLegacyTypeScriptModuleInterop?h:`${this.helperManager.getHelperName("interopRequireWildcard")}(${h})`;m+=` var ${_} = ${x};`}else c.length>0&&d!==h?m+=` var ${d} = ${this.helperManager.getHelperName("interopRequireWildcard")}(${h});`:i.length>0&&d!==h&&(m+=` var ${d} = ${this.helperManager.getHelperName("interopRequireDefault")}(${h});`);for(const{importedName:_,localName:x}of o)m+=` ${this.helperManager.getHelperName("createNamedExportFrom")}(${h}, '${x}', '${_}');`;for(const _ of c)m+=` exports.${_} = ${d};`;l&&(m+=` ${this.helperManager.getHelperName("createStarExport")}(${h});`),this.importsToReplace.set(e,m);for(const _ of i)this.identifierReplacements.set(_,`${d}.default`);for(const{importedName:_,localName:x}of a)this.identifierReplacements.set(x,`${h}.${_}`)}}getFreeIdentifierForPath(e){const s=e.split("/"),r=s[s.length-1].replace(/\W/g,"");return this.nameManager.claimFreeName(`_${r}`)}preprocessImportAtIndex(e){const s=[],i=[],r=[];if(e++,(this.tokens.matchesContextualAtIndex(e,g._type)||this.tokens.matches1AtIndex(e,n._typeof))&&!this.tokens.matches1AtIndex(e+1,n.comma)&&!this.tokens.matchesContextualAtIndex(e+1,g._from)||this.tokens.matches1AtIndex(e,n.parenL))return;if(this.tokens.matches1AtIndex(e,n.name)&&(s.push(this.tokens.identifierNameAtIndex(e)),e++,this.tokens.matches1AtIndex(e,n.comma)&&e++),this.tokens.matches1AtIndex(e,n.star)&&(e+=2,i.push(this.tokens.identifierNameAtIndex(e)),e++),this.tokens.matches1AtIndex(e,n.braceL)){const c=this.getNamedImports(e+1);e=c.newIndex;for(const l of c.namedImports)l.importedName==="default"?s.push(l.localName):r.push(l)}if(this.tokens.matchesContextualAtIndex(e,g._from)&&e++,!this.tokens.matches1AtIndex(e,n.string))throw new Error("Expected string token at the end of import statement.");const a=this.tokens.stringValueAtIndex(e),o=this.getImportInfo(a);o.defaultNames.push(...s),o.wildcardNames.push(...i),o.namedImports.push(...r),s.length===0&&i.length===0&&r.length===0&&(o.hasBareImport=true)}preprocessExportAtIndex(e){if(this.tokens.matches2AtIndex(e,n._export,n._var)||this.tokens.matches2AtIndex(e,n._export,n._let)||this.tokens.matches2AtIndex(e,n._export,n._const))this.preprocessVarExportAtIndex(e);else if(this.tokens.matches2AtIndex(e,n._export,n._function)||this.tokens.matches2AtIndex(e,n._export,n._class)){const s=this.tokens.identifierNameAtIndex(e+2);this.addExportBinding(s,s)}else if(this.tokens.matches3AtIndex(e,n._export,n.name,n._function)){const s=this.tokens.identifierNameAtIndex(e+3);this.addExportBinding(s,s)}else this.tokens.matches2AtIndex(e,n._export,n.braceL)?this.preprocessNamedExportAtIndex(e):this.tokens.matches2AtIndex(e,n._export,n.star)&&this.preprocessExportStarAtIndex(e)}preprocessVarExportAtIndex(e){let s=0;for(let i=e+2;;i++)if(this.tokens.matches1AtIndex(i,n.braceL)||this.tokens.matches1AtIndex(i,n.dollarBraceL)||this.tokens.matches1AtIndex(i,n.bracketL))s++;else if(this.tokens.matches1AtIndex(i,n.braceR)||this.tokens.matches1AtIndex(i,n.bracketR))s--;else{if(s===0&&!this.tokens.matches1AtIndex(i,n.name))break;if(this.tokens.matches1AtIndex(1,n.eq)){const r=this.tokens.currentToken().rhsEndIndex;if(r==null)throw new Error("Expected = token with an end index.");i=r-1}else{const r=this.tokens.tokens[i];if(Al(r)){const a=this.tokens.identifierNameAtIndex(i);this.identifierReplacements.set(a,`exports.${a}`)}}}}preprocessNamedExportAtIndex(e){e+=2;const{newIndex:s,namedImports:i}=this.getNamedImports(e);if(e=s,this.tokens.matchesContextualAtIndex(e,g._from))e++;else{for(const{importedName:o,localName:c}of i)this.addExportBinding(o,c);return}if(!this.tokens.matches1AtIndex(e,n.string))throw new Error("Expected string token at the end of import statement.");const r=this.tokens.stringValueAtIndex(e);this.getImportInfo(r).namedExports.push(...i)}preprocessExportStarAtIndex(e){let s=null;if(this.tokens.matches3AtIndex(e,n._export,n.star,n._as)?(e+=3,s=this.tokens.identifierNameAtIndex(e),e+=2):e+=3,!this.tokens.matches1AtIndex(e,n.string))throw new Error("Expected string token at the end of star export statement.");const i=this.tokens.stringValueAtIndex(e),r=this.getImportInfo(i);s!==null?r.exportStarNames.push(s):r.hasStarExport=true}getNamedImports(e){const s=[];for(;;){if(this.tokens.matches1AtIndex(e,n.braceR)){e++;break}const i=hi(this.tokens,e);if(e=i.endIndex,i.isType||s.push({importedName:i.leftName,localName:i.rightName}),this.tokens.matches2AtIndex(e,n.comma,n.braceR)){e+=2;break}else if(this.tokens.matches1AtIndex(e,n.braceR)){e++;break}else if(this.tokens.matches1AtIndex(e,n.comma))e++;else throw new Error(`Unexpected token: ${JSON.stringify(this.tokens.tokens[e])}`)}return{newIndex:e,namedImports:s}}getImportInfo(e){const s=this.importInfoByPath.get(e);if(s)return s;const i={defaultNames:[],wildcardNames:[],namedImports:[],namedExports:[],hasBareImport:false,exportStarNames:[],hasStarExport:false};return this.importInfoByPath.set(e,i),i}addExportBinding(e,s){this.exportBindingsByLocalName.has(e)||this.exportBindingsByLocalName.set(e,[]),this.exportBindingsByLocalName.get(e).push(s)}claimImportCode(e){const s=this.importsToReplace.get(e);return this.importsToReplace.set(e,""),s||""}getIdentifierReplacement(e){return this.identifierReplacements.get(e)||null}resolveExportBinding(e){const s=this.exportBindingsByLocalName.get(e);return!s||s.length===0?null:s.map(i=>`exports.${i}`).join(" = ")}getGlobalNames(){return new Set([...this.identifierReplacements.keys(),...this.exportBindingsByLocalName.keys()])}}var Pp=44,Lp=59,Sc="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",ql=new Uint8Array(64),Dp=new Uint8Array(128);for(let t=0;t<Sc.length;t++){const e=Sc.charCodeAt(t);ql[t]=e,Dp[e]=t}function zs(t,e,s){let i=e-s;i=i<0?-i<<1|1:i<<1;do{let r=i&31;i>>>=5,i>0&&(r|=32),t.write(ql[r])}while(i>0);return e}var Ec=1024*16,Tc=typeof TextDecoder<"u"?new TextDecoder:typeof Buffer<"u"?{decode(t){return Buffer.from(t.buffer,t.byteOffset,t.byteLength).toString()}}:{decode(t){let e="";for(let s=0;s<t.length;s++)e+=String.fromCharCode(t[s]);return e}},Np=class{constructor(){this.pos=0,this.out="",this.buffer=new Uint8Array(Ec)}write(t){const{buffer:e}=this;e[this.pos++]=t,this.pos===Ec&&(this.out+=Tc.decode(e),this.pos=0)}flush(){const{buffer:t,out:e,pos:s}=this;return s>0?e+Tc.decode(t.subarray(0,s)):e}};function Fp(t){const e=new Np;let s=0,i=0,r=0,a=0;for(let o=0;o<t.length;o++){const c=t[o];if(o>0&&e.write(Lp),c.length===0)continue;let l=0;for(let h=0;h<c.length;h++){const d=c[h];h>0&&e.write(Pp),l=zs(e,d[0],l),d.length!==1&&(s=zs(e,d[1],s),i=zs(e,d[2],i),r=zs(e,d[3],r),d.length!==4&&(a=zs(e,d[4],a)))}}return e.flush()}var ys=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},Up={exports:{}};(function(t,e){(function(s,i){t.exports=i()})(ys,function(){const s=/^[\w+.-]+:\/\//,i=/^([\w+.-]+:)\/\/([^@/#?]*@)?([^:/#?]*)(:\d+)?(\/[^#?]*)?(\?[^#]*)?(#.*)?/,r=/^file:(?:\/\/((?![a-z]:)[^/#?]*)?)?(\/?[^#?]*)(\?[^#]*)?(#.*)?/i;function a(P){return s.test(P)}function o(P){return P.startsWith("//")}function c(P){return P.startsWith("/")}function l(P){return P.startsWith("file:")}function h(P){return/^[.?#]/.test(P)}function d(P){const X=i.exec(P);return _(X[1],X[2]||"",X[3],X[4]||"",X[5]||"/",X[6]||"",X[7]||"")}function m(P){const X=r.exec(P),$=X[2];return _("file:","",X[1]||"","",c($)?$:"/"+$,X[3]||"",X[4]||"")}function _(P,X,$,te,ee,Q,z){return{scheme:P,user:X,host:$,port:te,path:ee,query:Q,hash:z,type:7}}function x(P){if(o(P)){const $=d("http:"+P);return $.scheme="",$.type=6,$}if(c(P)){const $=d("http://foo.com"+P);return $.scheme="",$.host="",$.type=5,$}if(l(P))return m(P);if(a(P))return d(P);const X=d("http://foo.com/"+P);return X.scheme="",X.host="",X.type=P?P.startsWith("?")?3:P.startsWith("#")?2:4:1,X}function E(P){if(P.endsWith("/.."))return P;const X=P.lastIndexOf("/");return P.slice(0,X+1)}function N(P,X){F(X,X.type),P.path==="/"?P.path=X.path:P.path=E(X.path)+P.path}function F(P,X){const $=X<=4,te=P.path.split("/");let ee=1,Q=0,z=false;for(let v=1;v<te.length;v++){const y=te[v];if(!y){z=true;continue}if(z=false,y!=="."){if(y===".."){Q?(z=true,Q--,ee--):$&&(te[ee++]=y);continue}te[ee++]=y,Q++}}let ne="";for(let v=1;v<ee;v++)ne+="/"+te[v];(!ne||z&&!ne.endsWith("/.."))&&(ne+="/"),P.path=ne}function U(P,X){if(!P&&!X)return"";const $=x(P);let te=$.type;if(X&&te!==7){const Q=x(X),z=Q.type;switch(te){case 1:$.hash=Q.hash;case 2:$.query=Q.query;case 3:case 4:N($,Q);case 5:$.user=Q.user,$.host=Q.host,$.port=Q.port;case 6:$.scheme=Q.scheme}z>te&&(te=z)}F($,te);const ee=$.query+$.hash;switch(te){case 2:case 3:return ee;case 4:{const Q=$.path.slice(1);return Q?h(X||P)&&!h(Q)?"./"+Q+ee:Q+ee:ee||"."}case 5:return $.path+ee;default:return $.scheme+"//"+$.user+$.host+$.port+$.path+ee}}return U})})(Up);var jn=class{constructor(){this._indexes={__proto__:null},this.array=[]}};function Mp(t,e){return t._indexes[e]}function Bp(t,e){const s=Mp(t,e);if(s!==void 0)return s;const{array:i,_indexes:r}=t,a=i.push(e);return r[e]=a-1}var Op=0,Vp=1,$p=2,jp=3,qp=4,Hl=-1,Hp=class{constructor({file:t,sourceRoot:e}={}){this._names=new jn,this._sources=new jn,this._sourcesContent=[],this._mappings=[],this.file=t,this.sourceRoot=e,this._ignoreList=new jn}};var qn=(t,e,s,i,r,a,o,c)=>Xp(true,t,e,s,i,r,a);function Gp(t){const{_mappings:e,_sources:s,_sourcesContent:i,_names:r,_ignoreList:a}=t;return Kp(e),{version:3,file:t.file||void 0,names:r.array,sourceRoot:t.sourceRoot||void 0,sources:s.array,sourcesContent:i,mappings:e,ignoreList:a.array}}function Wp(t){const e=Gp(t);return Object.assign({},e,{mappings:Fp(e.mappings)})}function Xp(t,e,s,i,r,a,o,c,l){const{_mappings:h,_sources:d,_sourcesContent:m,_names:_}=e,x=zp(h,s),E=Yp(x,i);if(!r)return Zp(x,E)?void 0:Ac(x,E,[i]);const N=Bp(d,r),F=Hl;if(N===m.length&&(m[N]=null),!Qp(x,E,N,a,o,F))return Ac(x,E,[i,N,a,o])}function zp(t,e){for(let s=t.length;s<=e;s++)t[s]=[];return t[e]}function Yp(t,e){let s=t.length;for(let i=s-1;i>=0;s=i--){const r=t[i];if(e>=r[Op])break}return s}function Ac(t,e,s){for(let i=t.length;i>e;i--)t[i]=t[i-1];t[e]=s}function Kp(t){const{length:e}=t;let s=e;for(let i=s-1;i>=0&&!(t[i].length>0);s=i,i--);s<e&&(t.length=s)}function Zp(t,e){return e===0?true:t[e-1].length===1}function Qp(t,e,s,i,r,a){if(e===0)return false;const o=t[e-1];return o.length===1?false:s===o[Vp]&&i===o[$p]&&r===o[jp]&&a===(o.length===5?o[qp]:Hl)}function Jp({code:t,mappings:e},s,i,r,a){const o=em(r,a),c=new Hp({file:i.compiledFilename});let l=0,h=e[0];for(;h===void 0&&l<e.length-1;)l++,h=e[l];let d=0,m=0;h!==m&&qn(c,d,0,s,d,0);for(let N=0;N<t.length;N++){if(N===h){const F=h-m,U=o[l];for(qn(c,d,F,s,d,U);(h===N||h===void 0)&&l<e.length-1;)l++,h=e[l]}t.charCodeAt(N)===b.lineFeed&&(d++,m=N+1,h!==m&&qn(c,d,0,s,d,0))}const{sourceRoot:_,sourcesContent:x,...E}=Wp(c);return E}function em(t,e){const s=new Array(e.length);let i=0,r=e[i].start,a=0;for(let o=0;o<t.length;o++)o===r&&(s[i]=r-a,i++,r=e[i].start),t.charCodeAt(o)===b.lineFeed&&(a=o+1);return s}const tm={require:`
481
+ `;else if(i==="&"){const{entity:r,newI:o}=$l(t,s+1);e+=r,s=o-1}else e+=i}return JSON.stringify(e)}function $l(t,e){let s="",i=0,r,o=e;if(t[o]==="#"){let a=10;o++;let c;if(t[o]==="x")for(a=16,o++,c=o;o<t.length&&Rp(t.charCodeAt(o));)o++;else for(c=o;o<t.length&&Ip(t.charCodeAt(o));)o++;if(t[o]===";"){const l=t.slice(c,o);l&&(o++,r=String.fromCodePoint(parseInt(l,a)))}}else for(;o<t.length&&i++<10;){const a=t[o];if(o++,a===";"){r=Tp.get(s);break}s+=a}return r?{entity:r,newI:o}:{entity:"&",newI:e}}function Ip(t){return t>=b.digit0&&t<=b.digit9}function Rp(t){return t>=b.digit0&&t<=b.digit9||t>=b.lowercaseA&&t<=b.lowercaseF||t>=b.uppercaseA&&t<=b.uppercaseF}function jl(t,e){const s=Bl(e),i=new Set;for(let r=0;r<t.tokens.length;r++){const o=t.tokens[r];if(o.type===n.name&&!o.isType&&(o.identifierRole===ie.Access||o.identifierRole===ie.ObjectShorthand||o.identifierRole===ie.ExportAccess)&&!o.shadowsGlobal&&i.add(t.identifierNameForToken(o)),o.type===n.jsxTagStart&&i.add(s.base),o.type===n.jsxTagStart&&r+1<t.tokens.length&&t.tokens[r+1].type===n.jsxTagEnd&&(i.add(s.base),i.add(s.fragmentBase)),o.type===n.jsxName&&o.identifierRole===ie.Access){const a=t.identifierNameForToken(o);(!Vl(a)||t.tokens[r+1].type===n.dot)&&i.add(t.identifierNameForToken(o))}}return i}class ps{__init(){this.nonTypeIdentifiers=new Set}__init2(){this.importInfoByPath=new Map}__init3(){this.importsToReplace=new Map}__init4(){this.identifierReplacements=new Map}__init5(){this.exportBindingsByLocalName=new Map}constructor(e,s,i,r,o,a,c){this.nameManager=e,this.tokens=s,this.enableLegacyTypeScriptModuleInterop=i,this.options=r,this.isTypeScriptTransformEnabled=o,this.keepUnusedImports=a,this.helperManager=c,ps.prototype.__init.call(this),ps.prototype.__init2.call(this),ps.prototype.__init3.call(this),ps.prototype.__init4.call(this),ps.prototype.__init5.call(this)}preprocessTokens(){for(let e=0;e<this.tokens.tokens.length;e++)this.tokens.matches1AtIndex(e,n._import)&&!this.tokens.matches3AtIndex(e,n._import,n.name,n.eq)&&this.preprocessImportAtIndex(e),this.tokens.matches1AtIndex(e,n._export)&&!this.tokens.matches2AtIndex(e,n._export,n.eq)&&this.preprocessExportAtIndex(e);this.generateImportReplacements()}pruneTypeOnlyImports(){this.nonTypeIdentifiers=jl(this.tokens,this.options);for(const[e,s]of this.importInfoByPath.entries()){if(s.hasBareImport||s.hasStarExport||s.exportStarNames.length>0||s.namedExports.length>0)continue;[...s.defaultNames,...s.wildcardNames,...s.namedImports.map(({localName:r})=>r)].every(r=>this.shouldAutomaticallyElideImportedName(r))&&this.importsToReplace.set(e,"")}}shouldAutomaticallyElideImportedName(e){return this.isTypeScriptTransformEnabled&&!this.keepUnusedImports&&!this.nonTypeIdentifiers.has(e)}generateImportReplacements(){for(const[e,s]of this.importInfoByPath.entries()){const{defaultNames:i,wildcardNames:r,namedImports:o,namedExports:a,exportStarNames:c,hasStarExport:l}=s;if(i.length===0&&r.length===0&&o.length===0&&a.length===0&&c.length===0&&!l){this.importsToReplace.set(e,`require('${e}');`);continue}const h=this.getFreeIdentifierForPath(e);let d;this.enableLegacyTypeScriptModuleInterop?d=h:d=r.length>0?r[0]:this.getFreeIdentifierForPath(e);let m=`var ${h} = require('${e}');`;if(r.length>0)for(const _ of r){const x=this.enableLegacyTypeScriptModuleInterop?h:`${this.helperManager.getHelperName("interopRequireWildcard")}(${h})`;m+=` var ${_} = ${x};`}else c.length>0&&d!==h?m+=` var ${d} = ${this.helperManager.getHelperName("interopRequireWildcard")}(${h});`:i.length>0&&d!==h&&(m+=` var ${d} = ${this.helperManager.getHelperName("interopRequireDefault")}(${h});`);for(const{importedName:_,localName:x}of a)m+=` ${this.helperManager.getHelperName("createNamedExportFrom")}(${h}, '${x}', '${_}');`;for(const _ of c)m+=` exports.${_} = ${d};`;l&&(m+=` ${this.helperManager.getHelperName("createStarExport")}(${h});`),this.importsToReplace.set(e,m);for(const _ of i)this.identifierReplacements.set(_,`${d}.default`);for(const{importedName:_,localName:x}of o)this.identifierReplacements.set(x,`${h}.${_}`)}}getFreeIdentifierForPath(e){const s=e.split("/"),r=s[s.length-1].replace(/\W/g,"");return this.nameManager.claimFreeName(`_${r}`)}preprocessImportAtIndex(e){const s=[],i=[],r=[];if(e++,(this.tokens.matchesContextualAtIndex(e,g._type)||this.tokens.matches1AtIndex(e,n._typeof))&&!this.tokens.matches1AtIndex(e+1,n.comma)&&!this.tokens.matchesContextualAtIndex(e+1,g._from)||this.tokens.matches1AtIndex(e,n.parenL))return;if(this.tokens.matches1AtIndex(e,n.name)&&(s.push(this.tokens.identifierNameAtIndex(e)),e++,this.tokens.matches1AtIndex(e,n.comma)&&e++),this.tokens.matches1AtIndex(e,n.star)&&(e+=2,i.push(this.tokens.identifierNameAtIndex(e)),e++),this.tokens.matches1AtIndex(e,n.braceL)){const c=this.getNamedImports(e+1);e=c.newIndex;for(const l of c.namedImports)l.importedName==="default"?s.push(l.localName):r.push(l)}if(this.tokens.matchesContextualAtIndex(e,g._from)&&e++,!this.tokens.matches1AtIndex(e,n.string))throw new Error("Expected string token at the end of import statement.");const o=this.tokens.stringValueAtIndex(e),a=this.getImportInfo(o);a.defaultNames.push(...s),a.wildcardNames.push(...i),a.namedImports.push(...r),s.length===0&&i.length===0&&r.length===0&&(a.hasBareImport=true)}preprocessExportAtIndex(e){if(this.tokens.matches2AtIndex(e,n._export,n._var)||this.tokens.matches2AtIndex(e,n._export,n._let)||this.tokens.matches2AtIndex(e,n._export,n._const))this.preprocessVarExportAtIndex(e);else if(this.tokens.matches2AtIndex(e,n._export,n._function)||this.tokens.matches2AtIndex(e,n._export,n._class)){const s=this.tokens.identifierNameAtIndex(e+2);this.addExportBinding(s,s)}else if(this.tokens.matches3AtIndex(e,n._export,n.name,n._function)){const s=this.tokens.identifierNameAtIndex(e+3);this.addExportBinding(s,s)}else this.tokens.matches2AtIndex(e,n._export,n.braceL)?this.preprocessNamedExportAtIndex(e):this.tokens.matches2AtIndex(e,n._export,n.star)&&this.preprocessExportStarAtIndex(e)}preprocessVarExportAtIndex(e){let s=0;for(let i=e+2;;i++)if(this.tokens.matches1AtIndex(i,n.braceL)||this.tokens.matches1AtIndex(i,n.dollarBraceL)||this.tokens.matches1AtIndex(i,n.bracketL))s++;else if(this.tokens.matches1AtIndex(i,n.braceR)||this.tokens.matches1AtIndex(i,n.bracketR))s--;else{if(s===0&&!this.tokens.matches1AtIndex(i,n.name))break;if(this.tokens.matches1AtIndex(1,n.eq)){const r=this.tokens.currentToken().rhsEndIndex;if(r==null)throw new Error("Expected = token with an end index.");i=r-1}else{const r=this.tokens.tokens[i];if(Al(r)){const o=this.tokens.identifierNameAtIndex(i);this.identifierReplacements.set(o,`exports.${o}`)}}}}preprocessNamedExportAtIndex(e){e+=2;const{newIndex:s,namedImports:i}=this.getNamedImports(e);if(e=s,this.tokens.matchesContextualAtIndex(e,g._from))e++;else{for(const{importedName:a,localName:c}of i)this.addExportBinding(a,c);return}if(!this.tokens.matches1AtIndex(e,n.string))throw new Error("Expected string token at the end of import statement.");const r=this.tokens.stringValueAtIndex(e);this.getImportInfo(r).namedExports.push(...i)}preprocessExportStarAtIndex(e){let s=null;if(this.tokens.matches3AtIndex(e,n._export,n.star,n._as)?(e+=3,s=this.tokens.identifierNameAtIndex(e),e+=2):e+=3,!this.tokens.matches1AtIndex(e,n.string))throw new Error("Expected string token at the end of star export statement.");const i=this.tokens.stringValueAtIndex(e),r=this.getImportInfo(i);s!==null?r.exportStarNames.push(s):r.hasStarExport=true}getNamedImports(e){const s=[];for(;;){if(this.tokens.matches1AtIndex(e,n.braceR)){e++;break}const i=hi(this.tokens,e);if(e=i.endIndex,i.isType||s.push({importedName:i.leftName,localName:i.rightName}),this.tokens.matches2AtIndex(e,n.comma,n.braceR)){e+=2;break}else if(this.tokens.matches1AtIndex(e,n.braceR)){e++;break}else if(this.tokens.matches1AtIndex(e,n.comma))e++;else throw new Error(`Unexpected token: ${JSON.stringify(this.tokens.tokens[e])}`)}return{newIndex:e,namedImports:s}}getImportInfo(e){const s=this.importInfoByPath.get(e);if(s)return s;const i={defaultNames:[],wildcardNames:[],namedImports:[],namedExports:[],hasBareImport:false,exportStarNames:[],hasStarExport:false};return this.importInfoByPath.set(e,i),i}addExportBinding(e,s){this.exportBindingsByLocalName.has(e)||this.exportBindingsByLocalName.set(e,[]),this.exportBindingsByLocalName.get(e).push(s)}claimImportCode(e){const s=this.importsToReplace.get(e);return this.importsToReplace.set(e,""),s||""}getIdentifierReplacement(e){return this.identifierReplacements.get(e)||null}resolveExportBinding(e){const s=this.exportBindingsByLocalName.get(e);return!s||s.length===0?null:s.map(i=>`exports.${i}`).join(" = ")}getGlobalNames(){return new Set([...this.identifierReplacements.keys(),...this.exportBindingsByLocalName.keys()])}}var Pp=44,Lp=59,Sc="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",ql=new Uint8Array(64),Dp=new Uint8Array(128);for(let t=0;t<Sc.length;t++){const e=Sc.charCodeAt(t);ql[t]=e,Dp[e]=t}function zs(t,e,s){let i=e-s;i=i<0?-i<<1|1:i<<1;do{let r=i&31;i>>>=5,i>0&&(r|=32),t.write(ql[r])}while(i>0);return e}var Ec=1024*16,Tc=typeof TextDecoder<"u"?new TextDecoder:typeof Buffer<"u"?{decode(t){return Buffer.from(t.buffer,t.byteOffset,t.byteLength).toString()}}:{decode(t){let e="";for(let s=0;s<t.length;s++)e+=String.fromCharCode(t[s]);return e}},Np=class{constructor(){this.pos=0,this.out="",this.buffer=new Uint8Array(Ec)}write(t){const{buffer:e}=this;e[this.pos++]=t,this.pos===Ec&&(this.out+=Tc.decode(e),this.pos=0)}flush(){const{buffer:t,out:e,pos:s}=this;return s>0?e+Tc.decode(t.subarray(0,s)):e}};function Fp(t){const e=new Np;let s=0,i=0,r=0,o=0;for(let a=0;a<t.length;a++){const c=t[a];if(a>0&&e.write(Lp),c.length===0)continue;let l=0;for(let h=0;h<c.length;h++){const d=c[h];h>0&&e.write(Pp),l=zs(e,d[0],l),d.length!==1&&(s=zs(e,d[1],s),i=zs(e,d[2],i),r=zs(e,d[3],r),d.length!==4&&(o=zs(e,d[4],o)))}}return e.flush()}var ys=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},Up={exports:{}};(function(t,e){(function(s,i){t.exports=i()})(ys,function(){const s=/^[\w+.-]+:\/\//,i=/^([\w+.-]+:)\/\/([^@/#?]*@)?([^:/#?]*)(:\d+)?(\/[^#?]*)?(\?[^#]*)?(#.*)?/,r=/^file:(?:\/\/((?![a-z]:)[^/#?]*)?)?(\/?[^#?]*)(\?[^#]*)?(#.*)?/i;function o(P){return s.test(P)}function a(P){return P.startsWith("//")}function c(P){return P.startsWith("/")}function l(P){return P.startsWith("file:")}function h(P){return/^[.?#]/.test(P)}function d(P){const X=i.exec(P);return _(X[1],X[2]||"",X[3],X[4]||"",X[5]||"/",X[6]||"",X[7]||"")}function m(P){const X=r.exec(P),$=X[2];return _("file:","",X[1]||"","",c($)?$:"/"+$,X[3]||"",X[4]||"")}function _(P,X,$,te,ee,Q,z){return{scheme:P,user:X,host:$,port:te,path:ee,query:Q,hash:z,type:7}}function x(P){if(a(P)){const $=d("http:"+P);return $.scheme="",$.type=6,$}if(c(P)){const $=d("http://foo.com"+P);return $.scheme="",$.host="",$.type=5,$}if(l(P))return m(P);if(o(P))return d(P);const X=d("http://foo.com/"+P);return X.scheme="",X.host="",X.type=P?P.startsWith("?")?3:P.startsWith("#")?2:4:1,X}function E(P){if(P.endsWith("/.."))return P;const X=P.lastIndexOf("/");return P.slice(0,X+1)}function N(P,X){F(X,X.type),P.path==="/"?P.path=X.path:P.path=E(X.path)+P.path}function F(P,X){const $=X<=4,te=P.path.split("/");let ee=1,Q=0,z=false;for(let v=1;v<te.length;v++){const y=te[v];if(!y){z=true;continue}if(z=false,y!=="."){if(y===".."){Q?(z=true,Q--,ee--):$&&(te[ee++]=y);continue}te[ee++]=y,Q++}}let ne="";for(let v=1;v<ee;v++)ne+="/"+te[v];(!ne||z&&!ne.endsWith("/.."))&&(ne+="/"),P.path=ne}function U(P,X){if(!P&&!X)return"";const $=x(P);let te=$.type;if(X&&te!==7){const Q=x(X),z=Q.type;switch(te){case 1:$.hash=Q.hash;case 2:$.query=Q.query;case 3:case 4:N($,Q);case 5:$.user=Q.user,$.host=Q.host,$.port=Q.port;case 6:$.scheme=Q.scheme}z>te&&(te=z)}F($,te);const ee=$.query+$.hash;switch(te){case 2:case 3:return ee;case 4:{const Q=$.path.slice(1);return Q?h(X||P)&&!h(Q)?"./"+Q+ee:Q+ee:ee||"."}case 5:return $.path+ee;default:return $.scheme+"//"+$.user+$.host+$.port+$.path+ee}}return U})})(Up);var jn=class{constructor(){this._indexes={__proto__:null},this.array=[]}};function Mp(t,e){return t._indexes[e]}function Op(t,e){const s=Mp(t,e);if(s!==void 0)return s;const{array:i,_indexes:r}=t,o=i.push(e);return r[e]=o-1}var Bp=0,Vp=1,$p=2,jp=3,qp=4,Hl=-1,Hp=class{constructor({file:t,sourceRoot:e}={}){this._names=new jn,this._sources=new jn,this._sourcesContent=[],this._mappings=[],this.file=t,this.sourceRoot=e,this._ignoreList=new jn}};var qn=(t,e,s,i,r,o,a,c)=>Xp(true,t,e,s,i,r,o);function Gp(t){const{_mappings:e,_sources:s,_sourcesContent:i,_names:r,_ignoreList:o}=t;return Kp(e),{version:3,file:t.file||void 0,names:r.array,sourceRoot:t.sourceRoot||void 0,sources:s.array,sourcesContent:i,mappings:e,ignoreList:o.array}}function Wp(t){const e=Gp(t);return Object.assign({},e,{mappings:Fp(e.mappings)})}function Xp(t,e,s,i,r,o,a,c,l){const{_mappings:h,_sources:d,_sourcesContent:m,_names:_}=e,x=zp(h,s),E=Yp(x,i);if(!r)return Zp(x,E)?void 0:Ac(x,E,[i]);const N=Op(d,r),F=Hl;if(N===m.length&&(m[N]=null),!Qp(x,E,N,o,a,F))return Ac(x,E,[i,N,o,a])}function zp(t,e){for(let s=t.length;s<=e;s++)t[s]=[];return t[e]}function Yp(t,e){let s=t.length;for(let i=s-1;i>=0;s=i--){const r=t[i];if(e>=r[Bp])break}return s}function Ac(t,e,s){for(let i=t.length;i>e;i--)t[i]=t[i-1];t[e]=s}function Kp(t){const{length:e}=t;let s=e;for(let i=s-1;i>=0&&!(t[i].length>0);s=i,i--);s<e&&(t.length=s)}function Zp(t,e){return e===0?true:t[e-1].length===1}function Qp(t,e,s,i,r,o){if(e===0)return false;const a=t[e-1];return a.length===1?false:s===a[Vp]&&i===a[$p]&&r===a[jp]&&o===(a.length===5?a[qp]:Hl)}function Jp({code:t,mappings:e},s,i,r,o){const a=em(r,o),c=new Hp({file:i.compiledFilename});let l=0,h=e[0];for(;h===void 0&&l<e.length-1;)l++,h=e[l];let d=0,m=0;h!==m&&qn(c,d,0,s,d,0);for(let N=0;N<t.length;N++){if(N===h){const F=h-m,U=a[l];for(qn(c,d,F,s,d,U);(h===N||h===void 0)&&l<e.length-1;)l++,h=e[l]}t.charCodeAt(N)===b.lineFeed&&(d++,m=N+1,h!==m&&qn(c,d,0,s,d,0))}const{sourceRoot:_,sourcesContent:x,...E}=Wp(c);return E}function em(t,e){const s=new Array(e.length);let i=0,r=e[i].start,o=0;for(let a=0;a<t.length;a++)a===r&&(s[i]=r-o,i++,r=e[i].start),t.charCodeAt(a)===b.lineFeed&&(o=a+1);return s}const tm={require:`
482
482
  import {createRequire as CREATE_REQUIRE_NAME} from "module";
483
483
  const require = CREATE_REQUIRE_NAME(import.meta.url);
484
484
  `,interopRequireWildcard:`
@@ -587,9 +587,9 @@ fn fs(@location(0) uv: vec2f) -> @location(0) vec4f {
587
587
  const result = await ASYNC_OPTIONAL_CHAIN_NAME(ops);
588
588
  return result == null ? true : result;
589
589
  }
590
- `};class tr{__init(){this.helperNames={}}__init2(){this.createRequireName=null}constructor(e){this.nameManager=e,tr.prototype.__init.call(this),tr.prototype.__init2.call(this)}getHelperName(e){let s=this.helperNames[e];return s||(s=this.nameManager.claimFreeName(`_${e}`),this.helperNames[e]=s,s)}emitHelpers(){let e="";this.helperNames.optionalChainDelete&&this.getHelperName("optionalChain"),this.helperNames.asyncOptionalChainDelete&&this.getHelperName("asyncOptionalChain");for(const[s,i]of Object.entries(tm)){const r=this.helperNames[s];let a=i;s==="optionalChainDelete"?a=a.replace("OPTIONAL_CHAIN_NAME",this.helperNames.optionalChain):s==="asyncOptionalChainDelete"?a=a.replace("ASYNC_OPTIONAL_CHAIN_NAME",this.helperNames.asyncOptionalChain):s==="require"&&(this.createRequireName===null&&(this.createRequireName=this.nameManager.claimFreeName("_createRequire")),a=a.replace(/CREATE_REQUIRE_NAME/g,this.createRequireName)),r&&(e+=" ",e+=a.replace(s,r).replace(/\s+/g," ").trim())}return e}}function Cc(t,e,s){sm(t,s)&&im(t,e,s)}function sm(t,e){for(const s of t.tokens)if(s.type===n.name&&!s.isType&&rp(s)&&e.has(t.identifierNameForToken(s)))return true;return false}function im(t,e,s){const i=[];let r=e.length-1;for(let a=t.tokens.length-1;;a--){for(;i.length>0&&i[i.length-1].startTokenIndex===a+1;)i.pop();for(;r>=0&&e[r].endTokenIndex===a+1;)i.push(e[r]),r--;if(a<0)break;const o=t.tokens[a],c=t.identifierNameForToken(o);if(i.length>1&&!o.isType&&o.type===n.name&&s.has(c)){if(np(o))Ic(i[i.length-1],t,c);else if(ap(o)){let l=i.length-1;for(;l>0&&!i[l].isFunctionScope;)l--;if(l<0)throw new Error("Did not find parent function scope.");Ic(i[l],t,c)}}}if(i.length>0)throw new Error("Expected empty scope stack after processing file.")}function Ic(t,e,s){for(let i=t.startTokenIndex;i<t.endTokenIndex;i++){const r=e.tokens[i];(r.type===n.name||r.type===n.jsxName)&&e.identifierNameForToken(r)===s&&(r.shadowsGlobal=true)}}function rm(t,e){const s=[];for(const i of e)i.type===n.name&&s.push(t.slice(i.start,i.end));return s}class Ka{__init(){this.usedNames=new Set}constructor(e,s){Ka.prototype.__init.call(this),this.usedNames=new Set(rm(e,s))}claimFreeName(e){const s=this.findFreeName(e);return this.usedNames.add(s),s}findFreeName(e){if(!this.usedNames.has(e))return e;let s=2;for(;this.usedNames.has(e+String(s));)s++;return e+String(s)}}var we={},ha={},Rt={},nm=ys&&ys.__extends||function(){var t=function(e,s){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,r){i.__proto__=r}||function(i,r){for(var a in r)r.hasOwnProperty(a)&&(i[a]=r[a])},t(e,s)};return function(e,s){t(e,s);function i(){this.constructor=e}e.prototype=s===null?Object.create(s):(i.prototype=s.prototype,new i)}}();Object.defineProperty(Rt,"__esModule",{value:true});Rt.DetailContext=Rt.NoopContext=Rt.VError=void 0;var Gl=function(t){nm(e,t);function e(s,i){var r=t.call(this,i)||this;return r.path=s,Object.setPrototypeOf(r,e.prototype),r}return e}(Error);Rt.VError=Gl;var am=function(){function t(){}return t.prototype.fail=function(e,s,i){return false},t.prototype.unionResolver=function(){return this},t.prototype.createContext=function(){return this},t.prototype.resolveUnion=function(e){},t}();Rt.NoopContext=am;var Wl=function(){function t(){this._propNames=[""],this._messages=[null],this._score=0}return t.prototype.fail=function(e,s,i){return this._propNames.push(e),this._messages.push(s),this._score+=i,false},t.prototype.unionResolver=function(){return new om},t.prototype.resolveUnion=function(e){for(var s,i,r=e,a=null,o=0,c=r.contexts;o<c.length;o++){var l=c[o];(!a||l._score>=a._score)&&(a=l)}a&&a._score>0&&((s=this._propNames).push.apply(s,a._propNames),(i=this._messages).push.apply(i,a._messages))},t.prototype.getError=function(e){for(var s=[],i=this._propNames.length-1;i>=0;i--){var r=this._propNames[i];e+=typeof r=="number"?"["+r+"]":r?"."+r:"";var a=this._messages[i];a&&s.push(e+" "+a)}return new Gl(e,s.join("; "))},t.prototype.getErrorDetail=function(e){for(var s=[],i=this._propNames.length-1;i>=0;i--){var r=this._propNames[i];e+=typeof r=="number"?"["+r+"]":r?"."+r:"";var a=this._messages[i];a&&s.push({path:e,message:a})}for(var o=null,i=s.length-1;i>=0;i--)o&&(s[i].nested=[o]),o=s[i];return o},t}();Rt.DetailContext=Wl;var om=function(){function t(){this.contexts=[]}return t.prototype.createContext=function(){var e=new Wl;return this.contexts.push(e),e},t}();(function(t){var e=ys&&ys.__extends||function(){var w=function(T,D){return w=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(L,j){L.__proto__=j}||function(L,j){for(var se in j)j.hasOwnProperty(se)&&(L[se]=j[se])},w(T,D)};return function(T,D){w(T,D);function L(){this.constructor=T}T.prototype=D===null?Object.create(D):(L.prototype=D.prototype,new L)}}();Object.defineProperty(t,"__esModule",{value:true}),t.basicTypes=t.BasicType=t.TParamList=t.TParam=t.param=t.TFunc=t.func=t.TProp=t.TOptional=t.opt=t.TIface=t.iface=t.TEnumLiteral=t.enumlit=t.TEnumType=t.enumtype=t.TIntersection=t.intersection=t.TUnion=t.union=t.TTuple=t.tuple=t.TArray=t.array=t.TLiteral=t.lit=t.TName=t.name=t.TType=void 0;var s=Rt,i=function(){function w(){}return w}();t.TType=i;function r(w){return typeof w=="string"?o(w):w}function a(w,T){var D=w[T];if(!D)throw new Error("Unknown type "+T);return D}function o(w){return new c(w)}t.name=o;var c=function(w){e(T,w);function T(D){var L=w.call(this)||this;return L.name=D,L._failMsg="is not a "+D,L}return T.prototype.getChecker=function(D,L,j){var se=this,re=a(D,this.name),pe=re.getChecker(D,L,j);return re instanceof M||re instanceof T?pe:function(Se,ke){return pe(Se,ke)?true:ke.fail(null,se._failMsg,0)}},T}(i);t.TName=c;function l(w){return new h(w)}t.lit=l;var h=function(w){e(T,w);function T(D){var L=w.call(this)||this;return L.value=D,L.name=JSON.stringify(D),L._failMsg="is not "+L.name,L}return T.prototype.getChecker=function(D,L){var j=this;return function(se,re){return se===j.value?true:re.fail(null,j._failMsg,-1)}},T}(i);t.TLiteral=h;function d(w){return new m(r(w))}t.array=d;var m=function(w){e(T,w);function T(D){var L=w.call(this)||this;return L.ttype=D,L}return T.prototype.getChecker=function(D,L){var j=this.ttype.getChecker(D,L);return function(se,re){if(!Array.isArray(se))return re.fail(null,"is not an array",0);for(var pe=0;pe<se.length;pe++){var Se=j(se[pe],re);if(!Se)return re.fail(pe,null,1)}return true}},T}(i);t.TArray=m;function _(){for(var w=[],T=0;T<arguments.length;T++)w[T]=arguments[T];return new x(w.map(function(D){return r(D)}))}t.tuple=_;var x=function(w){e(T,w);function T(D){var L=w.call(this)||this;return L.ttypes=D,L}return T.prototype.getChecker=function(D,L){var j=this.ttypes.map(function(re){return re.getChecker(D,L)}),se=function(re,pe){if(!Array.isArray(re))return pe.fail(null,"is not an array",0);for(var Se=0;Se<j.length;Se++){var ke=j[Se](re[Se],pe);if(!ke)return pe.fail(Se,null,1)}return true};return L?function(re,pe){return se(re,pe)?re.length<=j.length?true:pe.fail(j.length,"is extraneous",2):false}:se},T}(i);t.TTuple=x;function E(){for(var w=[],T=0;T<arguments.length;T++)w[T]=arguments[T];return new N(w.map(function(D){return r(D)}))}t.union=E;var N=function(w){e(T,w);function T(D){var L=w.call(this)||this;L.ttypes=D;var j=D.map(function(re){return re instanceof c||re instanceof h?re.name:null}).filter(function(re){return re}),se=D.length-j.length;return j.length?(se>0&&j.push(se+" more"),L._failMsg="is none of "+j.join(", ")):L._failMsg="is none of "+se+" types",L}return T.prototype.getChecker=function(D,L){var j=this,se=this.ttypes.map(function(re){return re.getChecker(D,L)});return function(re,pe){for(var Se=pe.unionResolver(),ke=0;ke<se.length;ke++){var Fe=se[ke](re,Se.createContext());if(Fe)return true}return pe.resolveUnion(Se),pe.fail(null,j._failMsg,0)}},T}(i);t.TUnion=N;function F(){for(var w=[],T=0;T<arguments.length;T++)w[T]=arguments[T];return new U(w.map(function(D){return r(D)}))}t.intersection=F;var U=function(w){e(T,w);function T(D){var L=w.call(this)||this;return L.ttypes=D,L}return T.prototype.getChecker=function(D,L){var j=new Set,se=this.ttypes.map(function(re){return re.getChecker(D,L,j)});return function(re,pe){var Se=se.every(function(ke){return ke(re,pe)});return Se?true:pe.fail(null,null,0)}},T}(i);t.TIntersection=U;function P(w){return new X(w)}t.enumtype=P;var X=function(w){e(T,w);function T(D){var L=w.call(this)||this;return L.members=D,L.validValues=new Set,L._failMsg="is not a valid enum value",L.validValues=new Set(Object.keys(D).map(function(j){return D[j]})),L}return T.prototype.getChecker=function(D,L){var j=this;return function(se,re){return j.validValues.has(se)?true:re.fail(null,j._failMsg,0)}},T}(i);t.TEnumType=X;function $(w,T){return new te(w,T)}t.enumlit=$;var te=function(w){e(T,w);function T(D,L){var j=w.call(this)||this;return j.enumName=D,j.prop=L,j._failMsg="is not "+D+"."+L,j}return T.prototype.getChecker=function(D,L){var j=this,se=a(D,this.enumName);if(!(se instanceof X))throw new Error("Type "+this.enumName+" used in enumlit is not an enum type");var re=se.members[this.prop];if(!se.members.hasOwnProperty(this.prop))throw new Error("Unknown value "+this.enumName+"."+this.prop+" used in enumlit");return function(pe,Se){return pe===re?true:Se.fail(null,j._failMsg,-1)}},T}(i);t.TEnumLiteral=te;function ee(w){return Object.keys(w).map(function(T){return Q(T,w[T])})}function Q(w,T){return T instanceof y?new k(w,T.ttype,true):new k(w,r(T),false)}function z(w,T){return new ne(w,ee(T))}t.iface=z;var ne=function(w){e(T,w);function T(D,L){var j=w.call(this)||this;return j.bases=D,j.props=L,j.propSet=new Set(L.map(function(se){return se.name})),j}return T.prototype.getChecker=function(D,L,j){var se=this,re=this.bases.map(function(Ie){return a(D,Ie).getChecker(D,L)}),pe=this.props.map(function(Ie){return Ie.ttype.getChecker(D,L)}),Se=new s.NoopContext,ke=this.props.map(function(Ie,Ve){return!Ie.isOpt&&!pe[Ve](void 0,Se)}),Fe=function(Ie,Ve){if(typeof Ie!="object"||Ie===null)return Ve.fail(null,"is not an object",0);for(var $e=0;$e<re.length;$e++)if(!re[$e](Ie,Ve))return false;for(var $e=0;$e<pe.length;$e++){var fs=se.props[$e].name,Es=Ie[fs];if(Es===void 0){if(ke[$e])return Ve.fail(fs,"is missing",1)}else{var Ws=pe[$e](Es,Ve);if(!Ws)return Ve.fail(fs,null,1)}}return true};if(!L)return Fe;var Ye=this.propSet;return j&&(this.propSet.forEach(function(Ie){return j.add(Ie)}),Ye=j),function(Ie,Ve){if(!Fe(Ie,Ve))return false;for(var $e in Ie)if(!Ye.has($e))return Ve.fail($e,"is extraneous",2);return true}},T}(i);t.TIface=ne;function v(w){return new y(r(w))}t.opt=v;var y=function(w){e(T,w);function T(D){var L=w.call(this)||this;return L.ttype=D,L}return T.prototype.getChecker=function(D,L){var j=this.ttype.getChecker(D,L);return function(se,re){return se===void 0||j(se,re)}},T}(i);t.TOptional=y;var k=function(){function w(T,D,L){this.name=T,this.ttype=D,this.isOpt=L}return w}();t.TProp=k;function V(w){for(var T=[],D=1;D<arguments.length;D++)T[D-1]=arguments[D];return new G(new O(T),r(w))}t.func=V;var G=function(w){e(T,w);function T(D,L){var j=w.call(this)||this;return j.paramList=D,j.result=L,j}return T.prototype.getChecker=function(D,L){return function(j,se){return typeof j=="function"?true:se.fail(null,"is not a function",0)}},T}(i);t.TFunc=G;function B(w,T,D){return new R(w,r(T),!!D)}t.param=B;var R=function(){function w(T,D,L){this.name=T,this.ttype=D,this.isOpt=L}return w}();t.TParam=R;var O=function(w){e(T,w);function T(D){var L=w.call(this)||this;return L.params=D,L}return T.prototype.getChecker=function(D,L){var j=this,se=this.params.map(function(ke){return ke.ttype.getChecker(D,L)}),re=new s.NoopContext,pe=this.params.map(function(ke,Fe){return!ke.isOpt&&!se[Fe](void 0,re)}),Se=function(ke,Fe){if(!Array.isArray(ke))return Fe.fail(null,"is not an array",0);for(var Ye=0;Ye<se.length;Ye++){var Ie=j.params[Ye];if(ke[Ye]===void 0){if(pe[Ye])return Fe.fail(Ie.name,"is missing",1)}else{var Ve=se[Ye](ke[Ye],Fe);if(!Ve)return Fe.fail(Ie.name,null,1)}}return true};return L?function(ke,Fe){return Se(ke,Fe)?ke.length<=se.length?true:Fe.fail(se.length,"is extraneous",2):false}:Se},T}(i);t.TParamList=O;var M=function(w){e(T,w);function T(D,L){var j=w.call(this)||this;return j.validator=D,j.message=L,j}return T.prototype.getChecker=function(D,L){var j=this;return function(se,re){return j.validator(se)?true:re.fail(null,j.message,0)}},T}(i);t.BasicType=M,t.basicTypes={any:new M(function(w){return true},"is invalid"),number:new M(function(w){return typeof w=="number"},"is not a number"),object:new M(function(w){return typeof w=="object"&&w},"is not an object"),boolean:new M(function(w){return typeof w=="boolean"},"is not a boolean"),string:new M(function(w){return typeof w=="string"},"is not a string"),symbol:new M(function(w){return typeof w=="symbol"},"is not a symbol"),void:new M(function(w){return w==null},"is not void"),undefined:new M(function(w){return w===void 0},"is not undefined"),null:new M(function(w){return w===null},"is not null"),never:new M(function(w){return false},"is unexpected"),Date:new M(H("[object Date]"),"is not a Date"),RegExp:new M(H("[object RegExp]"),"is not a RegExp")};var C=Object.prototype.toString;function H(w){return function(T){return typeof T=="object"&&T&&C.call(T)===w}}typeof Buffer<"u"&&(t.basicTypes.Buffer=new M(function(w){return Buffer.isBuffer(w)},"is not a Buffer"));for(var W=function(w){t.basicTypes[w.name]=new M(function(T){return T instanceof w},"is not a "+w.name)},J=0,ce=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,ArrayBuffer];J<ce.length;J++){var oe=ce[J];W(oe)}})(ha);(function(t){var e=ys&&ys.__spreadArrays||function(){for(var l=0,h=0,d=arguments.length;h<d;h++)l+=arguments[h].length;for(var m=Array(l),_=0,h=0;h<d;h++)for(var x=arguments[h],E=0,N=x.length;E<N;E++,_++)m[_]=x[E];return m};Object.defineProperty(t,"__esModule",{value:true}),t.Checker=t.createCheckers=void 0;var s=ha,i=Rt,r=ha;Object.defineProperty(t,"TArray",{enumerable:true,get:function(){return r.TArray}}),Object.defineProperty(t,"TEnumType",{enumerable:true,get:function(){return r.TEnumType}}),Object.defineProperty(t,"TEnumLiteral",{enumerable:true,get:function(){return r.TEnumLiteral}}),Object.defineProperty(t,"TFunc",{enumerable:true,get:function(){return r.TFunc}}),Object.defineProperty(t,"TIface",{enumerable:true,get:function(){return r.TIface}}),Object.defineProperty(t,"TLiteral",{enumerable:true,get:function(){return r.TLiteral}}),Object.defineProperty(t,"TName",{enumerable:true,get:function(){return r.TName}}),Object.defineProperty(t,"TOptional",{enumerable:true,get:function(){return r.TOptional}}),Object.defineProperty(t,"TParam",{enumerable:true,get:function(){return r.TParam}}),Object.defineProperty(t,"TParamList",{enumerable:true,get:function(){return r.TParamList}}),Object.defineProperty(t,"TProp",{enumerable:true,get:function(){return r.TProp}}),Object.defineProperty(t,"TTuple",{enumerable:true,get:function(){return r.TTuple}}),Object.defineProperty(t,"TType",{enumerable:true,get:function(){return r.TType}}),Object.defineProperty(t,"TUnion",{enumerable:true,get:function(){return r.TUnion}}),Object.defineProperty(t,"TIntersection",{enumerable:true,get:function(){return r.TIntersection}}),Object.defineProperty(t,"array",{enumerable:true,get:function(){return r.array}}),Object.defineProperty(t,"enumlit",{enumerable:true,get:function(){return r.enumlit}}),Object.defineProperty(t,"enumtype",{enumerable:true,get:function(){return r.enumtype}}),Object.defineProperty(t,"func",{enumerable:true,get:function(){return r.func}}),Object.defineProperty(t,"iface",{enumerable:true,get:function(){return r.iface}}),Object.defineProperty(t,"lit",{enumerable:true,get:function(){return r.lit}}),Object.defineProperty(t,"name",{enumerable:true,get:function(){return r.name}}),Object.defineProperty(t,"opt",{enumerable:true,get:function(){return r.opt}}),Object.defineProperty(t,"param",{enumerable:true,get:function(){return r.param}}),Object.defineProperty(t,"tuple",{enumerable:true,get:function(){return r.tuple}}),Object.defineProperty(t,"union",{enumerable:true,get:function(){return r.union}}),Object.defineProperty(t,"intersection",{enumerable:true,get:function(){return r.intersection}}),Object.defineProperty(t,"BasicType",{enumerable:true,get:function(){return r.BasicType}});var a=Rt;Object.defineProperty(t,"VError",{enumerable:true,get:function(){return a.VError}});function o(){for(var l=[],h=0;h<arguments.length;h++)l[h]=arguments[h];for(var d=Object.assign.apply(Object,e([{},s.basicTypes],l)),m={},_=0,x=l;_<x.length;_++)for(var E=x[_],N=0,F=Object.keys(E);N<F.length;N++){var U=F[N];m[U]=new c(d,E[U])}return m}t.createCheckers=o;var c=function(){function l(h,d,m){if(m===void 0&&(m="value"),this.suite=h,this.ttype=d,this._path=m,this.props=new Map,d instanceof s.TIface)for(var _=0,x=d.props;_<x.length;_++){var E=x[_];this.props.set(E.name,E.ttype)}this.checkerPlain=this.ttype.getChecker(h,false),this.checkerStrict=this.ttype.getChecker(h,true)}return l.prototype.setReportedPath=function(h){this._path=h},l.prototype.check=function(h){return this._doCheck(this.checkerPlain,h)},l.prototype.test=function(h){return this.checkerPlain(h,new i.NoopContext)},l.prototype.validate=function(h){return this._doValidate(this.checkerPlain,h)},l.prototype.strictCheck=function(h){return this._doCheck(this.checkerStrict,h)},l.prototype.strictTest=function(h){return this.checkerStrict(h,new i.NoopContext)},l.prototype.strictValidate=function(h){return this._doValidate(this.checkerStrict,h)},l.prototype.getProp=function(h){var d=this.props.get(h);if(!d)throw new Error("Type has no property "+h);return new l(this.suite,d,this._path+"."+h)},l.prototype.methodArgs=function(h){var d=this._getMethod(h);return new l(this.suite,d.paramList)},l.prototype.methodResult=function(h){var d=this._getMethod(h);return new l(this.suite,d.result)},l.prototype.getArgs=function(){if(!(this.ttype instanceof s.TFunc))throw new Error("getArgs() applied to non-function");return new l(this.suite,this.ttype.paramList)},l.prototype.getResult=function(){if(!(this.ttype instanceof s.TFunc))throw new Error("getResult() applied to non-function");return new l(this.suite,this.ttype.result)},l.prototype.getType=function(){return this.ttype},l.prototype._doCheck=function(h,d){var m=new i.NoopContext;if(!h(d,m)){var _=new i.DetailContext;throw h(d,_),_.getError(this._path)}},l.prototype._doValidate=function(h,d){var m=new i.NoopContext;if(h(d,m))return null;var _=new i.DetailContext;return h(d,_),_.getErrorDetail(this._path)},l.prototype._getMethod=function(h){var d=this.props.get(h);if(!d)throw new Error("Type has no property "+h);if(!(d instanceof s.TFunc))throw new Error("Property "+h+" is not a method");return d},l}();t.Checker=c})(we);const cm=we.union(we.lit("jsx"),we.lit("typescript"),we.lit("flow"),we.lit("imports"),we.lit("react-hot-loader"),we.lit("jest")),um=we.iface([],{compiledFilename:"string"}),lm=we.iface([],{transforms:we.array("Transform"),disableESTransforms:we.opt("boolean"),jsxRuntime:we.opt(we.union(we.lit("classic"),we.lit("automatic"),we.lit("preserve"))),production:we.opt("boolean"),jsxImportSource:we.opt("string"),jsxPragma:we.opt("string"),jsxFragmentPragma:we.opt("string"),keepUnusedImports:we.opt("boolean"),preserveDynamicImport:we.opt("boolean"),injectCreateRequireForImportRequire:we.opt("boolean"),enableLegacyTypeScriptModuleInterop:we.opt("boolean"),enableLegacyBabel5ModuleInterop:we.opt("boolean"),sourceMapOptions:we.opt("SourceMapOptions"),filePath:we.opt("string")}),hm={Transform:cm,SourceMapOptions:um,Options:lm},{Options:fm}=we.createCheckers(hm);function dm(t){fm.strictCheck(t)}function Xl(){I(),Be(false)}function zl(t){I(),Ar(t)}function hs(t){ae(),Za(t)}function sr(){ae(),u.tokens[u.tokens.length-1].identifierRole=ie.ImportDeclaration}function Za(t){let e;u.scopeDepth===0?e=ie.TopLevelDeclaration:t?e=ie.BlockScopedDeclaration:e=ie.FunctionScopedDeclaration,u.tokens[u.tokens.length-1].identifierRole=e}function Ar(t){switch(u.type){case n._this:{const e=de(0);I(),fe(e);return}case n._yield:case n.name:{u.type=n.name,hs(t);return}case n.bracketL:{I(),Qa(n.bracketR,t,true);return}case n.braceL:uo(true,t);return;default:le()}}function Qa(t,e,s=false,i=false,r=0){let a=true,o=false;const c=u.tokens.length;for(;!S(t)&&!u.error;)if(a?a=false:(A(n.comma),u.tokens[u.tokens.length-1].contextId=r,!o&&u.tokens[c].isType&&(u.tokens[u.tokens.length-1].isType=true,o=true)),!(s&&p(n.comma))){if(S(t))break;if(p(n.ellipsis)){zl(e),Yl(),S(n.comma),A(t);break}else pm(i,e)}}function pm(t,e){t&&Ja([g._public,g._protected,g._private,g._readonly,g._override]),ir(e),Yl(),ir(e,true)}function Yl(){_e?Lg():me&&k0()}function ir(t,e=false){if(e||Ar(t),!S(n.eq))return;const s=u.tokens.length-1;Be(),u.tokens[s].rhsEndIndex=u.tokens.length}function fa(){return p(n.name)}function mm(){return p(n.name)||!!(u.type&n.IS_KEYWORD)||p(n.string)||p(n.num)||p(n.bigint)||p(n.decimal)}function Kl(){const t=u.snapshot();return I(),(p(n.bracketL)||p(n.braceL)||p(n.star)||p(n.ellipsis)||p(n.hash)||mm())&&!Xe()?true:(u.restoreFromSnapshot(t),false)}function Ja(t){for(;Zl(t)!==null;);}function Zl(t){if(!p(n.name))return null;const e=u.contextualKeyword;if(t.indexOf(e)!==-1&&Kl()){switch(e){case g._readonly:u.tokens[u.tokens.length-1].type=n._readonly;break;case g._abstract:u.tokens[u.tokens.length-1].type=n._abstract;break;case g._static:u.tokens[u.tokens.length-1].type=n._static;break;case g._public:u.tokens[u.tokens.length-1].type=n._public;break;case g._private:u.tokens[u.tokens.length-1].type=n._private;break;case g._protected:u.tokens[u.tokens.length-1].type=n._protected;break;case g._override:u.tokens[u.tokens.length-1].type=n._override;break;case g._declare:u.tokens[u.tokens.length-1].type=n._declare;break}return e}return null}function ki(){for(ae();S(n.dot);)ae()}function gm(){ki(),!Xe()&&p(n.lessThan)&&Hs()}function bm(){I(),wi()}function ym(){I()}function _m(){A(n._typeof),p(n._import)?Ql():ki(),!Xe()&&p(n.lessThan)&&Hs()}function Ql(){A(n._import),A(n.parenL),A(n.string),A(n.parenR),S(n.dot)&&ki(),p(n.lessThan)&&Hs()}function vm(){S(n._const);const t=S(n._in),e=Le(g._out);S(n._const),(t||e)&&!p(n.name)?u.tokens[u.tokens.length-1].type=n.name:ae(),S(n._extends)&&Ce(),S(n.eq)&&Ce()}function ws(){p(n.lessThan)&&Cr()}function Cr(){const t=de(0);for(p(n.lessThan)||p(n.typeParameterStart)?I():le();!S(n.greaterThan)&&!u.error;)vm(),S(n.comma);fe(t)}function eo(t){const e=t===n.arrow;ws(),A(n.parenL),u.scopeDepth++,xm(false),u.scopeDepth--,(e||p(t))&&fi(t)}function xm(t){Qa(n.parenR,t)}function rr(){S(n.comma)||Ee()}function Rc(){eo(n.colon),rr()}function km(){const t=u.snapshot();I();const e=S(n.name)&&p(n.colon);return u.restoreFromSnapshot(t),e}function Jl(){if(!(p(n.bracketL)&&km()))return false;const t=de(0);return A(n.bracketL),ae(),wi(),A(n.bracketR),qs(),rr(),fe(t),true}function Pc(t){S(n.question),!t&&(p(n.parenL)||p(n.lessThan))?(eo(n.colon),rr()):(qs(),rr())}function wm(){if(p(n.parenL)||p(n.lessThan)){Rc();return}if(p(n._new)){I(),p(n.parenL)||p(n.lessThan)?Rc():Pc(false);return}const t=!!Zl([g._readonly]);Jl()||((Z(g._get)||Z(g._set))&&Kl(),di(-1),Pc(t))}function Sm(){e1()}function e1(){for(A(n.braceL);!S(n.braceR)&&!u.error;)wm()}function Em(){const t=u.snapshot(),e=Tm();return u.restoreFromSnapshot(t),e}function Tm(){return I(),S(n.plus)||S(n.minus)?Z(g._readonly):(Z(g._readonly)&&I(),!p(n.bracketL)||(I(),!fa())?false:(I(),p(n._in)))}function Am(){ae(),A(n._in),Ce()}function Cm(){A(n.braceL),p(n.plus)||p(n.minus)?(I(),Re(g._readonly)):Le(g._readonly),A(n.bracketL),Am(),Le(g._as)&&Ce(),A(n.bracketR),p(n.plus)||p(n.minus)?(I(),A(n.question)):S(n.question),jm(),Ee(),A(n.braceR)}function Im(){for(A(n.bracketL);!S(n.bracketR)&&!u.error;)Rm(),S(n.comma)}function Rm(){S(n.ellipsis)?Ce():(Ce(),S(n.question)),S(n.colon)&&Ce()}function Pm(){A(n.parenL),Ce(),A(n.parenR)}function Lm(){for(is(),is();!p(n.backQuote)&&!u.error;)A(n.dollarBraceL),Ce(),is(),is();I()}var ns;(function(t){t[t.TSFunctionType=0]="TSFunctionType";const s=1;t[t.TSConstructorType=s]="TSConstructorType";const i=s+1;t[t.TSAbstractConstructorType=i]="TSAbstractConstructorType"})(ns||(ns={}));function Hn(t){t===ns.TSAbstractConstructorType&&Re(g._abstract),(t===ns.TSConstructorType||t===ns.TSAbstractConstructorType)&&A(n._new);const e=u.inDisallowConditionalTypesContext;u.inDisallowConditionalTypesContext=false,eo(n.arrow),u.inDisallowConditionalTypesContext=e}function Dm(){switch(u.type){case n.name:gm();return;case n._void:case n._null:I();return;case n.string:case n.num:case n.bigint:case n.decimal:case n._true:case n._false:Bs();return;case n.minus:I(),Bs();return;case n._this:{ym(),Z(g._is)&&!Xe()&&bm();return}case n._typeof:_m();return;case n._import:Ql();return;case n.braceL:Em()?Cm():Sm();return;case n.bracketL:Im();return;case n.parenL:Pm();return;case n.backQuote:Lm();return;default:if(u.type&n.IS_KEYWORD){I(),u.tokens[u.tokens.length-1].type=n.name;return}break}le()}function Nm(){for(Dm();!Xe()&&S(n.bracketL);)S(n.bracketR)||(Ce(),A(n.bracketR))}function Fm(){if(Re(g._infer),ae(),p(n._extends)){const t=u.snapshot();A(n._extends);const e=u.inDisallowConditionalTypesContext;u.inDisallowConditionalTypesContext=true,Ce(),u.inDisallowConditionalTypesContext=e,(u.error||!u.inDisallowConditionalTypesContext&&p(n.question))&&u.restoreFromSnapshot(t)}}function da(){if(Z(g._keyof)||Z(g._unique)||Z(g._readonly))I(),da();else if(Z(g._infer))Fm();else{const t=u.inDisallowConditionalTypesContext;u.inDisallowConditionalTypesContext=false,Nm(),u.inDisallowConditionalTypesContext=t}}function Lc(){if(S(n.bitwiseAND),da(),p(n.bitwiseAND))for(;S(n.bitwiseAND);)da()}function Um(){if(S(n.bitwiseOR),Lc(),p(n.bitwiseOR))for(;S(n.bitwiseOR);)Lc()}function Mm(){return p(n.lessThan)?true:p(n.parenL)&&Om()}function Bm(){if(p(n.name)||p(n._this))return I(),true;if(p(n.braceL)||p(n.bracketL)){let t=1;for(I();t>0&&!u.error;)p(n.braceL)||p(n.bracketL)?t++:(p(n.braceR)||p(n.bracketR))&&t--,I();return true}return false}function Om(){const t=u.snapshot(),e=Vm();return u.restoreFromSnapshot(t),e}function Vm(){return I(),!!(p(n.parenR)||p(n.ellipsis)||Bm()&&(p(n.colon)||p(n.comma)||p(n.question)||p(n.eq)||p(n.parenR)&&(I(),p(n.arrow))))}function fi(t){const e=de(0);A(t),qm()||Ce(),fe(e)}function $m(){p(n.colon)&&fi(n.colon)}function qs(){p(n.colon)&&wi()}function jm(){S(n.colon)&&Ce()}function qm(){const t=u.snapshot();return Z(g._asserts)?(I(),Le(g._is)?(Ce(),true):fa()||p(n._this)?(I(),Le(g._is)&&Ce(),true):(u.restoreFromSnapshot(t),false)):fa()||p(n._this)?(I(),Z(g._is)&&!Xe()?(I(),Ce(),true):(u.restoreFromSnapshot(t),false)):false}function wi(){const t=de(0);A(n.colon),Ce(),fe(t)}function Ce(){if(Dc(),u.inDisallowConditionalTypesContext||Xe()||!S(n._extends))return;const t=u.inDisallowConditionalTypesContext;u.inDisallowConditionalTypesContext=true,Dc(),u.inDisallowConditionalTypesContext=t,A(n.question),Ce(),A(n.colon),Ce()}function Hm(){return Z(g._abstract)&&Ae()===n._new}function Dc(){if(Mm()){Hn(ns.TSFunctionType);return}if(p(n._new)){Hn(ns.TSConstructorType);return}else if(Hm()){Hn(ns.TSAbstractConstructorType);return}Um()}function Gm(){const t=de(1);Ce(),A(n.greaterThan),fe(t),Si()}function Wm(){if(S(n.jsxTagStart)){u.tokens[u.tokens.length-1].type=n.typeParameterStart;const t=de(1);for(;!p(n.greaterThan)&&!u.error;)Ce(),S(n.comma);lt(),fe(t)}}function t1(){for(;!p(n.braceL)&&!u.error;)Xm(),S(n.comma)}function Xm(){ki(),p(n.lessThan)&&Hs()}function zm(){hs(false),ws(),S(n._extends)&&t1(),e1()}function Ym(){hs(false),ws(),A(n.eq),Ce(),Ee()}function Km(){if(p(n.string)?Bs():ae(),S(n.eq)){const t=u.tokens.length-1;Be(),u.tokens[t].rhsEndIndex=u.tokens.length}}function to(){for(hs(false),A(n.braceL);!S(n.braceR)&&!u.error;)Km(),S(n.comma)}function so(){A(n.braceL),Lr(n.braceR)}function pa(){hs(false),S(n.dot)?pa():so()}function s1(){Z(g._global)?ae():p(n.string)?Yt():le(),p(n.braceL)?so():Ee()}function ma(){sr(),A(n.eq),Qm(),Ee()}function Zm(){return Z(g._require)&&Ae()===n.parenL}function Qm(){Zm()?Jm():ki()}function Jm(){Re(g._require),A(n.parenL),p(n.string)||le(),Bs(),A(n.parenR)}function e0(){if(Ct())return false;switch(u.type){case n._function:{const t=de(1);I();const e=u.start;return vs(e,true),fe(t),true}case n._class:{const t=de(1);return xs(true,false),fe(t),true}case n._const:if(p(n._const)&&za(g._enum)){const t=de(1);return A(n._const),Re(g._enum),u.tokens[u.tokens.length-1].type=n._enum,to(),fe(t),true}case n._var:case n._let:{const t=de(1);return Vi(u.type!==n._var),fe(t),true}case n.name:{const t=de(1),e=u.contextualKeyword;let s=false;return e===g._global?(s1(),s=true):s=Ir(e,true),fe(t),s}default:return false}}function Nc(){return Ir(u.contextualKeyword,true)}function t0(t){switch(t){case g._declare:{const e=u.tokens.length-1;if(e0())return u.tokens[e].type=n._declare,true;break}case g._global:if(p(n.braceL))return so(),true;break;default:return Ir(t,false)}return false}function Ir(t,e){switch(t){case g._abstract:if(Is(e)&&p(n._class))return u.tokens[u.tokens.length-1].type=n._abstract,xs(true,false),true;break;case g._enum:if(Is(e)&&p(n.name))return u.tokens[u.tokens.length-1].type=n._enum,to(),true;break;case g._interface:if(Is(e)&&p(n.name)){const s=de(e?2:1);return zm(),fe(s),true}break;case g._module:if(Is(e)){if(p(n.string)){const s=de(e?2:1);return s1(),fe(s),true}else if(p(n.name)){const s=de(e?2:1);return pa(),fe(s),true}}break;case g._namespace:if(Is(e)&&p(n.name)){const s=de(e?2:1);return pa(),fe(s),true}break;case g._type:if(Is(e)&&p(n.name)){const s=de(e?2:1);return Ym(),fe(s),true}break}return false}function Is(t){return t?(I(),true):!Ct()}function s0(){const t=u.snapshot();return Cr(),Gs(),$m(),A(n.arrow),u.error?(u.restoreFromSnapshot(t),false):(Ei(true),true)}function io(){u.type===n.bitShiftL&&(u.pos-=1,ue(n.lessThan)),Hs()}function Hs(){const t=de(0);for(A(n.lessThan);!p(n.greaterThan)&&!u.error;)Ce(),S(n.comma);t?(A(n.greaterThan),fe(t)):(fe(t),Ul(),A(n.greaterThan),u.tokens[u.tokens.length-1].isType=true)}function i1(){if(p(n.name))switch(u.contextualKeyword){case g._abstract:case g._declare:case g._enum:case g._interface:case g._module:case g._namespace:case g._type:return true}return false}function i0(t,e){if(p(n.colon)&&fi(n.colon),!p(n.braceL)&&Ct()){let s=u.tokens.length-1;for(;s>=0&&(u.tokens[s].start>=t||u.tokens[s].type===n._default||u.tokens[s].type===n._export);)u.tokens[s].isType=true,s--;return}Ei(false,e)}function r0(t,e,s){if(!Xe()&&S(n.bang)){u.tokens[u.tokens.length-1].type=n.nonNullAssertion;return}if(p(n.lessThan)||p(n.bitShiftL)){const i=u.snapshot();if(!e&&h1()&&s0())return;if(io(),!e&&S(n.parenL)?(u.tokens[u.tokens.length-1].subscriptStartIndex=t,as()):p(n.backQuote)?co():(u.type===n.greaterThan||u.type!==n.parenL&&u.type&n.IS_EXPRESSION_START&&!Xe())&&le(),u.error)u.restoreFromSnapshot(i);else return}else!e&&p(n.questionDot)&&Ae()===n.lessThan&&(I(),u.tokens[t].isOptionalChainStart=true,u.tokens[u.tokens.length-1].subscriptStartIndex=t,Hs(),A(n.parenL),as());no(t,e,s)}function n0(){if(S(n._import))return Z(g._type)&&Ae()!==n.eq&&Re(g._type),ma(),true;if(S(n.eq))return Me(),Ee(),true;if(Le(g._as))return Re(g._namespace),ae(),Ee(),true;if(Z(g._type)){const t=Ae();(t===n.braceL||t===n.star)&&I()}return false}function a0(){if(ae(),p(n.comma)||p(n.braceR)){u.tokens[u.tokens.length-1].identifierRole=ie.ImportDeclaration;return}if(ae(),p(n.comma)||p(n.braceR)){u.tokens[u.tokens.length-1].identifierRole=ie.ImportDeclaration,u.tokens[u.tokens.length-2].isType=true,u.tokens[u.tokens.length-1].isType=true;return}if(ae(),p(n.comma)||p(n.braceR)){u.tokens[u.tokens.length-3].identifierRole=ie.ImportAccess,u.tokens[u.tokens.length-1].identifierRole=ie.ImportDeclaration;return}ae(),u.tokens[u.tokens.length-3].identifierRole=ie.ImportAccess,u.tokens[u.tokens.length-1].identifierRole=ie.ImportDeclaration,u.tokens[u.tokens.length-4].isType=true,u.tokens[u.tokens.length-3].isType=true,u.tokens[u.tokens.length-2].isType=true,u.tokens[u.tokens.length-1].isType=true}function o0(){if(ae(),p(n.comma)||p(n.braceR)){u.tokens[u.tokens.length-1].identifierRole=ie.ExportAccess;return}if(ae(),p(n.comma)||p(n.braceR)){u.tokens[u.tokens.length-1].identifierRole=ie.ExportAccess,u.tokens[u.tokens.length-2].isType=true,u.tokens[u.tokens.length-1].isType=true;return}if(ae(),p(n.comma)||p(n.braceR)){u.tokens[u.tokens.length-3].identifierRole=ie.ExportAccess;return}ae(),u.tokens[u.tokens.length-3].identifierRole=ie.ExportAccess,u.tokens[u.tokens.length-4].isType=true,u.tokens[u.tokens.length-3].isType=true,u.tokens[u.tokens.length-2].isType=true,u.tokens[u.tokens.length-1].isType=true}function c0(){if(Z(g._abstract)&&Ae()===n._class)return u.type=n._abstract,I(),xs(true,true),true;if(Z(g._interface)){const t=de(2);return Ir(g._interface,true),fe(t),true}return false}function u0(){if(u.type===n._const){const t=xi();if(t.type===n.name&&t.contextualKeyword===g._enum)return A(n._const),Re(g._enum),u.tokens[u.tokens.length-1].type=n._enum,to(),true}return false}function l0(t){const e=u.tokens.length;Ja([g._abstract,g._readonly,g._declare,g._static,g._override]);const s=u.tokens.length;if(Jl()){const r=t?e-1:e;for(let a=r;a<s;a++)u.tokens[a].isType=true;return true}return false}function h0(t){t0(t)||Ee()}function f0(){const t=Le(g._declare);t&&(u.tokens[u.tokens.length-1].type=n._declare);let e=false;if(p(n.name))if(t){const s=de(2);e=Nc(),fe(s)}else e=Nc();if(!e)if(t){const s=de(2);nt(true),fe(s)}else nt(true)}function d0(t){if(t&&(p(n.lessThan)||p(n.bitShiftL))&&io(),Le(g._implements)){u.tokens[u.tokens.length-1].type=n._implements;const e=de(1);t1(),fe(e)}}function p0(){ws()}function m0(){ws()}function g0(){const t=de(0);Xe()||S(n.bang),qs(),fe(t)}function b0(){p(n.colon)&&wi()}function y0(t,e){return Er?_0(t,e):v0(t,e)}function _0(t,e){if(!p(n.lessThan))return Pt(t,e);const s=u.snapshot();let i=Pt(t,e);if(u.error)u.restoreFromSnapshot(s);else return i;return u.type=n.typeParameterStart,Cr(),i=Pt(t,e),i||le(),i}function v0(t,e){if(!p(n.lessThan))return Pt(t,e);const s=u.snapshot();Cr();const i=Pt(t,e);if(i||le(),u.error)u.restoreFromSnapshot(s);else return i;return Pt(t,e)}function x0(){if(p(n.colon)){const t=u.snapshot();fi(n.colon),rt()&&le(),p(n.arrow)||le(),u.error&&u.restoreFromSnapshot(t)}return S(n.arrow)}function k0(){const t=de(0);S(n.question),qs(),fe(t)}function w0(){(p(n.lessThan)||p(n.bitShiftL))&&io(),w1()}function S0(){let t=false,e=false;for(;;){if(u.pos>=q.length){le("Unterminated JSX contents");return}const s=q.charCodeAt(u.pos);if(s===b.lessThan||s===b.leftCurlyBrace){if(u.pos===u.start){if(s===b.lessThan){u.pos++,ue(n.jsxTagStart);return}Ml(s);return}ue(t&&!e?n.jsxEmptyText:n.jsxText);return}s===b.lineFeed?t=true:s!==b.space&&s!==b.carriageReturn&&s!==b.tab&&(e=true),u.pos++}}function E0(t){for(u.pos++;;){if(u.pos>=q.length){le("Unterminated string constant");return}if(q.charCodeAt(u.pos)===t){u.pos++;break}u.pos++}ue(n.string)}function T0(){let t;do{if(u.pos>q.length){le("Unexpectedly reached the end of input.");return}t=q.charCodeAt(++u.pos)}while(_t[t]||t===b.dash);ue(n.jsxName)}function ga(){lt()}function r1(t){if(ga(),!S(n.colon)){u.tokens[u.tokens.length-1].identifierRole=t;return}ga()}function n1(){const t=u.tokens.length;r1(ie.Access);let e=false;for(;p(n.dot);)e=true,lt(),ga();if(!e){const s=u.tokens[t],i=q.charCodeAt(s.start);i>=b.lowercaseA&&i<=b.lowercaseZ&&(s.identifierRole=null)}}function A0(){switch(u.type){case n.braceL:I(),Me(),lt();return;case n.jsxTagStart:o1(),lt();return;case n.string:lt();return;default:le("JSX value should be either an expression or a quoted JSX text")}}function C0(){A(n.ellipsis),Me()}function I0(t){if(p(n.jsxTagEnd))return false;n1(),me&&Wm();let e=false;for(;!p(n.slash)&&!p(n.jsxTagEnd)&&!u.error;){if(S(n.braceL)){e=true,A(n.ellipsis),Be(),lt();continue}e&&u.end-u.start===3&&q.charCodeAt(u.start)===b.lowercaseK&&q.charCodeAt(u.start+1)===b.lowercaseE&&q.charCodeAt(u.start+2)===b.lowercaseY&&(u.tokens[t].jsxRole=mt.KeyAfterPropSpread),r1(ie.ObjectKey),p(n.eq)&&(lt(),A0())}const s=p(n.slash);return s&&lt(),s}function R0(){p(n.jsxTagEnd)||n1()}function a1(){const t=u.tokens.length-1;u.tokens[t].jsxRole=mt.NoChildren;let e=0;if(!I0(t))for(Rs();;)switch(u.type){case n.jsxTagStart:if(lt(),p(n.slash)){lt(),R0(),u.tokens[t].jsxRole!==mt.KeyAfterPropSpread&&(e===1?u.tokens[t].jsxRole=mt.OneChild:e>1&&(u.tokens[t].jsxRole=mt.StaticChildren));return}e++,a1(),Rs();break;case n.jsxText:e++,Rs();break;case n.jsxEmptyText:Rs();break;case n.braceL:I(),p(n.ellipsis)?(C0(),Rs(),e+=2):(p(n.braceR)||(e++,Me()),Rs());break;default:le();return}}function o1(){lt(),a1()}function lt(){u.tokens.push(new Tr),Nl(),u.start=u.pos;const t=q.charCodeAt(u.pos);if(vi[t])T0();else if(t===b.quotationMark||t===b.apostrophe)E0(t);else switch(++u.pos,t){case b.greaterThan:ue(n.jsxTagEnd);break;case b.lessThan:ue(n.jsxTagStart);break;case b.slash:ue(n.slash);break;case b.equalsTo:ue(n.eq);break;case b.leftCurlyBrace:ue(n.braceL);break;case b.dot:ue(n.dot);break;case b.colon:ue(n.colon);break;default:le()}}function Rs(){u.tokens.push(new Tr),u.start=u.pos,S0()}function P0(t){if(p(n.question)){const e=Ae();if(e===n.colon||e===n.comma||e===n.parenR)return}c1(t)}function L0(){Il(n.question),p(n.colon)&&(me?wi():_e&&Ss())}class D0{constructor(e){this.stop=e}}function Me(t=false){if(Be(t),p(n.comma))for(;S(n.comma);)Be(t)}function Be(t=false,e=false){return me?y0(t,e):_e?Bg(t,e):Pt(t,e)}function Pt(t,e){if(p(n._yield))return Y0(),false;(p(n.parenL)||p(n.name)||p(n._yield))&&(u.potentialArrowAt=u.start);const s=N0(t);return e&&oo(),u.type&n.IS_ASSIGN?(I(),Be(t),false):s}function N0(t){return U0(t)?true:(F0(t),false)}function F0(t){me||_e?P0(t):c1(t)}function c1(t){S(n.question)&&(Be(),A(n.colon),Be(t))}function U0(t){const e=u.tokens.length;return Si()?true:(Bi(e,-1,t),false)}function Bi(t,e,s){if(me&&(n._in&n.PRECEDENCE_MASK)>e&&!Xe()&&(Le(g._as)||Le(g._satisfies))){const r=de(1);Ce(),fe(r),Ul(),Bi(t,e,s);return}const i=u.type&n.PRECEDENCE_MASK;if(i>0&&(!s||!p(n._in))&&i>e){const r=u.type;I(),r===n.nullishCoalescing&&(u.tokens[u.tokens.length-1].nullishStartIndex=t);const a=u.tokens.length;Si(),Bi(a,r&n.IS_RIGHT_ASSOCIATIVE?i-1:i,s),r===n.nullishCoalescing&&(u.tokens[t].numNullishCoalesceStarts++,u.tokens[u.tokens.length-1].numNullishCoalesceEnds++),Bi(t,e,s)}}function Si(){if(me&&!Er&&S(n.lessThan))return Gm(),false;if(Z(g._module)&&Pl()===b.leftCurlyBrace&&!Sl())return K0(),false;if(u.type&n.IS_PREFIX)return I(),Si(),false;if(u1())return true;for(;u.type&n.IS_POSTFIX&&!rt();)u.type===n.preIncDec&&(u.type=n.postIncDec),I();return false}function u1(){const t=u.tokens.length;return Yt()?true:(ro(t),u.tokens.length>t&&u.tokens[t].isOptionalChainStart&&(u.tokens[u.tokens.length-1].isOptionalChainEnd=true),false)}function ro(t,e=false){_e?Vg(t,e):l1(t,e)}function l1(t,e=false){const s=new D0(false);do M0(t,e,s);while(!s.stop&&!u.error)}function M0(t,e,s){me?r0(t,e,s):_e?vg(t,e,s):no(t,e,s)}function no(t,e,s){if(!e&&S(n.doubleColon))ao(),s.stop=true,ro(t,e);else if(p(n.questionDot)){if(u.tokens[t].isOptionalChainStart=true,e&&Ae()===n.parenL){s.stop=true;return}I(),u.tokens[u.tokens.length-1].subscriptStartIndex=t,S(n.bracketL)?(Me(),A(n.bracketR)):S(n.parenL)?as():nr()}else if(S(n.dot))u.tokens[u.tokens.length-1].subscriptStartIndex=t,nr();else if(S(n.bracketL))u.tokens[u.tokens.length-1].subscriptStartIndex=t,Me(),A(n.bracketR);else if(!e&&p(n.parenL))if(h1()){const i=u.snapshot(),r=u.tokens.length;I(),u.tokens[u.tokens.length-1].subscriptStartIndex=t;const a=li();u.tokens[u.tokens.length-1].contextId=a,as(),u.tokens[u.tokens.length-1].contextId=a,B0()&&(u.restoreFromSnapshot(i),s.stop=true,u.scopeDepth++,Gs(),O0(r))}else{I(),u.tokens[u.tokens.length-1].subscriptStartIndex=t;const i=li();u.tokens[u.tokens.length-1].contextId=i,as(),u.tokens[u.tokens.length-1].contextId=i}else p(n.backQuote)?co():s.stop=true}function h1(){return u.tokens[u.tokens.length-1].contextualKeyword===g._async&&!rt()}function as(){let t=true;for(;!S(n.parenR)&&!u.error;){if(t)t=false;else if(A(n.comma),S(n.parenR))break;m1(false)}}function B0(){return p(n.colon)||p(n.arrow)}function O0(t){me?b0():_e&&Mg(),A(n.arrow),pi(t)}function ao(){const t=u.tokens.length;Yt(),ro(t,true)}function Yt(){if(S(n.modulo))return ae(),false;if(p(n.jsxText)||p(n.jsxEmptyText))return Bs(),false;if(p(n.lessThan)&&Er)return u.type=n.jsxTagStart,o1(),I(),false;const t=u.potentialArrowAt===u.start;switch(u.type){case n.slash:case n.assign:cp();case n._super:case n._this:case n.regexp:case n.num:case n.bigint:case n.decimal:case n.string:case n._null:case n._true:case n._false:return I(),false;case n._import:return I(),p(n.dot)&&(u.tokens[u.tokens.length-1].type=n.name,I(),ae()),false;case n.name:{const e=u.tokens.length,s=u.start,i=u.contextualKeyword;return ae(),i===g._await?(z0(),false):i===g._async&&p(n._function)&&!rt()?(I(),vs(s,false),false):t&&i===g._async&&!rt()&&p(n.name)?(u.scopeDepth++,hs(false),A(n.arrow),pi(e),true):p(n._do)&&!rt()?(I(),os(),false):t&&!rt()&&p(n.arrow)?(u.scopeDepth++,Za(false),A(n.arrow),pi(e),true):(u.tokens[u.tokens.length-1].identifierRole=ie.Access,false)}case n._do:return I(),os(),false;case n.parenL:return f1(t);case n.bracketL:return I(),p1(n.bracketR,true),false;case n.braceL:return uo(false,false),false;case n._function:return V0(),false;case n.at:_o();case n._class:return xs(false),false;case n._new:return j0(),false;case n.backQuote:return co(),false;case n.doubleColon:return I(),ao(),false;case n.hash:{const e=Pl();return vi[e]||e===b.backslash?nr():I(),false}default:return le(),false}}function nr(){S(n.hash),ae()}function V0(){const t=u.start;ae(),S(n.dot)&&ae(),vs(t,false)}function Bs(){I()}function Rr(){A(n.parenL),Me(),A(n.parenR)}function f1(t){const e=u.snapshot(),s=u.tokens.length;A(n.parenL);let i=true;for(;!p(n.parenR)&&!u.error;){if(i)i=false;else if(A(n.comma),p(n.parenR))break;if(p(n.ellipsis)){zl(false),oo();break}else Be(false,true)}return A(n.parenR),t&&$0()&&ba()?(u.restoreFromSnapshot(e),u.scopeDepth++,Gs(),ba(),pi(s),u.error?(u.restoreFromSnapshot(e),f1(false),false):true):false}function $0(){return p(n.colon)||!rt()}function ba(){return me?x0():_e?Og():S(n.arrow)}function oo(){(me||_e)&&L0()}function j0(){if(A(n._new),S(n.dot)){ae();return}q0(),_e&&xg(),S(n.parenL)&&p1(n.parenR)}function q0(){ao(),S(n.questionDot)}function co(){for(is(),is();!p(n.backQuote)&&!u.error;)A(n.dollarBraceL),Me(),is(),is();I()}function uo(t,e){const s=li();let i=true;for(I(),u.tokens[u.tokens.length-1].contextId=s;!S(n.braceR)&&!u.error;){if(i)i=false;else if(A(n.comma),S(n.braceR))break;let r=false;if(p(n.ellipsis)){const a=u.tokens.length;if(Xl(),t&&(u.tokens.length===a+2&&Za(e),S(n.braceR)))break;continue}t||(r=S(n.star)),!t&&Z(g._async)?(r&&le(),ae(),p(n.colon)||p(n.parenL)||p(n.braceR)||p(n.eq)||p(n.comma)||(p(n.star)&&(I(),r=true),di(s))):di(s),X0(t,e,s)}u.tokens[u.tokens.length-1].contextId=s}function H0(t){return!t&&(p(n.string)||p(n.num)||p(n.bracketL)||p(n.name)||!!(u.type&n.IS_KEYWORD))}function G0(t,e){const s=u.start;return p(n.parenL)?(t&&le(),ya(s,false),true):H0(t)?(di(e),ya(s,false),true):false}function W0(t,e){if(S(n.colon)){t?ir(e):Be(false);return}let s;t?u.scopeDepth===0?s=ie.ObjectShorthandTopLevelDeclaration:e?s=ie.ObjectShorthandBlockScopedDeclaration:s=ie.ObjectShorthandFunctionScopedDeclaration:s=ie.ObjectShorthand,u.tokens[u.tokens.length-1].identifierRole=s,ir(e,true)}function X0(t,e,s){me?p0():_e&&Pg(),G0(t,s)||W0(t,e)}function di(t){_e&&yo(),S(n.bracketL)?(u.tokens[u.tokens.length-1].contextId=t,Be(),A(n.bracketR),u.tokens[u.tokens.length-1].contextId=t):(p(n.num)||p(n.string)||p(n.bigint)||p(n.decimal)?Yt():nr(),u.tokens[u.tokens.length-1].identifierRole=ie.ObjectKey,u.tokens[u.tokens.length-1].contextId=t)}function ya(t,e){const s=li();u.scopeDepth++;const i=u.tokens.length;Gs(e,s),d1(t,s);const a=u.tokens.length;u.scopes.push(new Ft(i,a,true)),u.scopeDepth--}function pi(t){Ei(true);const e=u.tokens.length;u.scopes.push(new Ft(t,e,true)),u.scopeDepth--}function d1(t,e=0){me?i0(t,e):_e?_g(e):Ei(false,e)}function Ei(t,e=0){t&&!p(n.braceL)?Be():os(true,e)}function p1(t,e=false){let s=true;for(;!S(t)&&!u.error;){if(s)s=false;else if(A(n.comma),S(t))break;m1(e)}}function m1(t){t&&p(n.comma)||(p(n.ellipsis)?(Xl(),oo()):p(n.question)?I():Be(false,true))}function ae(){I(),u.tokens[u.tokens.length-1].type=n.name}function z0(){Si()}function Y0(){I(),!p(n.semi)&&!rt()&&(S(n.star),Be())}function K0(){Re(g._module),A(n.braceL),Lr(n.braceR)}function Z0(t){return(t.type===n.name||!!(t.type&n.IS_KEYWORD))&&t.contextualKeyword!==g._from}function Ut(t){const e=de(0);A(t||n.colon),tt(),fe(e)}function Fc(){A(n.modulo),Re(g._checks),S(n.parenL)&&(Me(),A(n.parenR))}function lo(){const t=de(0);A(n.colon),p(n.modulo)?Fc():(tt(),p(n.modulo)&&Fc()),fe(t)}function Q0(){I(),ho(true)}function J0(){I(),ae(),p(n.lessThan)&&xt(),A(n.parenL),va(),A(n.parenR),lo(),Ee()}function _a(){p(n._class)?Q0():p(n._function)?J0():p(n._var)?eg():Le(g._module)?S(n.dot)?ig():tg():Z(g._type)?rg():Z(g._opaque)?ng():Z(g._interface)?ag():p(n._export)?sg():le()}function eg(){I(),_1(),Ee()}function tg(){for(p(n.string)?Yt():ae(),A(n.braceL);!p(n.braceR)&&!u.error;)p(n._import)?(I(),I1()):le();A(n.braceR)}function sg(){A(n._export),S(n._default)?p(n._function)||p(n._class)?_a():(tt(),Ee()):p(n._var)||p(n._function)||p(n._class)||Z(g._opaque)?_a():p(n.star)||p(n.braceL)||Z(g._interface)||Z(g._type)||Z(g._opaque)?A1():le()}function ig(){Re(g._exports),Ss(),Ee()}function rg(){I(),po()}function ng(){I(),mo(true)}function ag(){I(),ho()}function ho(t=false){if(Pr(),p(n.lessThan)&&xt(),S(n._extends))do Oi();while(!t&&S(n.comma));if(Z(g._mixins)){I();do Oi();while(S(n.comma))}if(Z(g._implements)){I();do Oi();while(S(n.comma))}ar(t,false,t)}function Oi(){g1(false),p(n.lessThan)&&_s()}function fo(){ho()}function Pr(){ae()}function po(){Pr(),p(n.lessThan)&&xt(),Ut(n.eq),Ee()}function mo(t){Re(g._type),Pr(),p(n.lessThan)&&xt(),p(n.colon)&&Ut(n.colon),t||Ut(n.eq),Ee()}function og(){yo(),_1(),S(n.eq)&&tt()}function xt(){const t=de(0);p(n.lessThan)||p(n.typeParameterStart)?I():le();do og(),p(n.greaterThan)||A(n.comma);while(!p(n.greaterThan)&&!u.error);A(n.greaterThan),fe(t)}function _s(){const t=de(0);for(A(n.lessThan);!p(n.greaterThan)&&!u.error;)tt(),p(n.greaterThan)||A(n.comma);A(n.greaterThan),fe(t)}function cg(){if(Re(g._interface),S(n._extends))do Oi();while(S(n.comma));ar(false,false,false)}function go(){p(n.num)||p(n.string)?Yt():ae()}function ug(){Ae()===n.colon?(go(),Ut()):tt(),A(n.bracketR),Ut()}function lg(){go(),A(n.bracketR),A(n.bracketR),p(n.lessThan)||p(n.parenL)?bo():(S(n.question),Ut())}function bo(){for(p(n.lessThan)&&xt(),A(n.parenL);!p(n.parenR)&&!p(n.ellipsis)&&!u.error;)or(),p(n.parenR)||A(n.comma);S(n.ellipsis)&&or(),A(n.parenR),Ut()}function hg(){bo()}function ar(t,e,s){let i;for(e&&p(n.braceBarL)?(A(n.braceBarL),i=n.braceBarR):(A(n.braceL),i=n.braceR);!p(i)&&!u.error;){if(s&&Z(g._proto)){const r=Ae();r!==n.colon&&r!==n.question&&(I(),t=false)}if(t&&Z(g._static)){const r=Ae();r!==n.colon&&r!==n.question&&I()}if(yo(),S(n.bracketL))S(n.bracketL)?lg():ug();else if(p(n.parenL)||p(n.lessThan))hg();else{if(Z(g._get)||Z(g._set)){const r=Ae();(r===n.name||r===n.string||r===n.num)&&I()}fg()}dg()}A(i)}function fg(){if(p(n.ellipsis)){if(A(n.ellipsis),S(n.comma)||S(n.semi),p(n.braceR))return;tt()}else go(),p(n.lessThan)||p(n.parenL)?bo():(S(n.question),Ut())}function dg(){!S(n.semi)&&!S(n.comma)&&!p(n.braceR)&&!p(n.braceBarR)&&le()}function g1(t){for(t||ae();S(n.dot);)ae()}function pg(){g1(true),p(n.lessThan)&&_s()}function mg(){A(n._typeof),b1()}function gg(){for(A(n.bracketL);u.pos<q.length&&!p(n.bracketR)&&(tt(),!p(n.bracketR));)A(n.comma);A(n.bracketR)}function or(){const t=Ae();t===n.colon||t===n.question?(ae(),S(n.question),Ut()):tt()}function va(){for(;!p(n.parenR)&&!p(n.ellipsis)&&!u.error;)or(),p(n.parenR)||A(n.comma);S(n.ellipsis)&&or()}function b1(){let t=false;const e=u.noAnonFunctionType;switch(u.type){case n.name:{if(Z(g._interface)){cg();return}ae(),pg();return}case n.braceL:ar(false,false,false);return;case n.braceBarL:ar(false,true,false);return;case n.bracketL:gg();return;case n.lessThan:xt(),A(n.parenL),va(),A(n.parenR),A(n.arrow),tt();return;case n.parenL:if(I(),!p(n.parenR)&&!p(n.ellipsis))if(p(n.name)){const s=Ae();t=s!==n.question&&s!==n.colon}else t=true;if(t)if(u.noAnonFunctionType=false,tt(),u.noAnonFunctionType=e,u.noAnonFunctionType||!(p(n.comma)||p(n.parenR)&&Ae()===n.arrow)){A(n.parenR);return}else S(n.comma);va(),A(n.parenR),A(n.arrow),tt();return;case n.minus:I(),Bs();return;case n.string:case n.num:case n._true:case n._false:case n._null:case n._this:case n._void:case n.star:I();return;default:if(u.type===n._typeof){mg();return}else if(u.type&n.IS_KEYWORD){I(),u.tokens[u.tokens.length-1].type=n.name;return}}le()}function bg(){for(b1();!rt()&&(p(n.bracketL)||p(n.questionDot));)S(n.questionDot),A(n.bracketL),S(n.bracketR)||(tt(),A(n.bracketR))}function y1(){S(n.question)?y1():bg()}function Uc(){y1(),!u.noAnonFunctionType&&S(n.arrow)&&tt()}function Mc(){for(S(n.bitwiseAND),Uc();S(n.bitwiseAND);)Uc()}function yg(){for(S(n.bitwiseOR),Mc();S(n.bitwiseOR);)Mc()}function tt(){yg()}function Ss(){Ut()}function _1(){ae(),p(n.colon)&&Ss()}function yo(){(p(n.plus)||p(n.minus))&&(I(),u.tokens[u.tokens.length-1].isType=true)}function _g(t){p(n.colon)&&lo(),Ei(false,t)}function vg(t,e,s){if(p(n.questionDot)&&Ae()===n.lessThan){if(e){s.stop=true;return}I(),_s(),A(n.parenL),as();return}else if(!e&&p(n.lessThan)){const i=u.snapshot();if(_s(),A(n.parenL),as(),u.error)u.restoreFromSnapshot(i);else return}no(t,e,s)}function xg(){if(p(n.lessThan)){const t=u.snapshot();_s(),u.error&&u.restoreFromSnapshot(t)}}function kg(){if(p(n.name)&&u.contextualKeyword===g._interface){const t=de(0);return I(),fo(),fe(t),true}else if(Z(g._enum))return v1(),true;return false}function wg(){return Z(g._enum)?(v1(),true):false}function Sg(t){if(t===g._declare){if(p(n._class)||p(n.name)||p(n._function)||p(n._var)||p(n._export)){const e=de(1);_a(),fe(e)}}else if(p(n.name)){if(t===g._interface){const e=de(1);fo(),fe(e)}else if(t===g._type){const e=de(1);po(),fe(e)}else if(t===g._opaque){const e=de(1);mo(false),fe(e)}}Ee()}function Eg(){return Z(g._type)||Z(g._interface)||Z(g._opaque)||Z(g._enum)}function Tg(){return p(n.name)&&(u.contextualKeyword===g._type||u.contextualKeyword===g._interface||u.contextualKeyword===g._opaque||u.contextualKeyword===g._enum)}function Ag(){if(Z(g._type)){const t=de(1);I(),p(n.braceL)?(vo(),mi()):po(),fe(t)}else if(Z(g._opaque)){const t=de(1);I(),mo(false),fe(t)}else if(Z(g._interface)){const t=de(1);I(),fo(),fe(t)}else nt(true)}function Cg(){return p(n.star)||Z(g._type)&&Ae()===n.star}function Ig(){if(Le(g._type)){const t=de(2);xa(),fe(t)}else xa()}function Rg(t){if(t&&p(n.lessThan)&&_s(),Z(g._implements)){const e=de(0);I(),u.tokens[u.tokens.length-1].type=n._implements;do Pr(),p(n.lessThan)&&_s();while(S(n.comma));fe(e)}}function Pg(){p(n.lessThan)&&(xt(),p(n.parenL)||le())}function Lg(){const t=de(0);S(n.question),p(n.colon)&&Ss(),fe(t)}function Dg(){if(p(n._typeof)||Z(g._type)){const t=xi();(Z0(t)||t.type===n.braceL||t.type===n.star)&&I()}}function Ng(){const t=u.contextualKeyword===g._type||u.type===n._typeof;t?I():ae(),Z(g._as)&&!za(g._as)?(ae(),t&&!p(n.name)&&!(u.type&n.IS_KEYWORD)||ae()):(t&&(p(n.name)||u.type&n.IS_KEYWORD)&&ae(),Le(g._as)&&ae())}function Fg(){if(p(n.lessThan)){const t=de(0);xt(),fe(t)}}function Ug(){p(n.colon)&&Ss()}function Mg(){if(p(n.colon)){const t=u.noAnonFunctionType;u.noAnonFunctionType=true,Ss(),u.noAnonFunctionType=t}}function Bg(t,e){if(p(n.lessThan)){const s=u.snapshot();let i=Pt(t,e);if(u.error)u.restoreFromSnapshot(s),u.type=n.typeParameterStart;else return i;const r=de(0);if(xt(),fe(r),i=Pt(t,e),i)return true;le()}return Pt(t,e)}function Og(){if(p(n.colon)){const t=de(0),e=u.snapshot(),s=u.noAnonFunctionType;u.noAnonFunctionType=true,lo(),u.noAnonFunctionType=s,rt()&&le(),p(n.arrow)||le(),u.error&&u.restoreFromSnapshot(e),fe(t)}return S(n.arrow)}function Vg(t,e=false){if(u.tokens[u.tokens.length-1].contextualKeyword===g._async&&p(n.lessThan)){const s=u.snapshot();if($g()&&!u.error)return;u.restoreFromSnapshot(s)}l1(t,e)}function $g(){u.scopeDepth++;const t=u.tokens.length;return Gs(),ba()?(pi(t),true):false}function v1(){Re(g._enum),u.tokens[u.tokens.length-1].type=n._enum,ae(),jg()}function jg(){Le(g._of)&&I(),A(n.braceL),qg(),A(n.braceR)}function qg(){for(;!p(n.braceR)&&!u.error&&!S(n.ellipsis);)Hg(),p(n.braceR)||A(n.comma)}function Hg(){ae(),S(n.eq)&&I()}function Gg(){if(Lr(n.eof),u.scopes.push(new Ft(0,u.tokens.length,true)),u.scopeDepth!==0)throw new Error(`Invalid scope depth at end of file: ${u.scopeDepth}`);return new Pb(u.tokens,u.scopes)}function nt(t){_e&&kg()||(p(n.at)&&_o(),Wg(t))}function Wg(t){if(me&&u0())return;const e=u.type;switch(e){case n._break:case n._continue:zg();return;case n._debugger:Yg();return;case n._do:Kg();return;case n._for:Zg();return;case n._function:if(Ae()===n.dot)break;t||le(),eb();return;case n._class:t||le(),xs(true);return;case n._if:tb();return;case n._return:sb();return;case n._switch:ib();return;case n._throw:rb();return;case n._try:ab();return;case n._let:case n._const:t||le();case n._var:Vi(e!==n._var);return;case n._while:ob();return;case n.braceL:os();return;case n.semi:cb();return;case n._export:case n._import:{const r=Ae();if(r===n.parenL||r===n.dot)break;I(),e===n._import?I1():A1();return}case n.name:if(u.contextualKeyword===g._async){const r=u.start,a=u.snapshot();if(I(),p(n._function)&&!rt()){A(n._function),vs(r,true);return}else u.restoreFromSnapshot(a)}else if(u.contextualKeyword===g._using&&!Sl()&&Ae()===n.name){Vi(true);return}else if(x1()){Re(g._await),Vi(true);return}}const s=u.tokens.length;Me();let i=null;if(u.tokens.length===s+1){const r=u.tokens[u.tokens.length-1];r.type===n.name&&(i=r.contextualKeyword)}if(i==null){Ee();return}S(n.colon)?ub():lb(i)}function x1(){if(!Z(g._await))return false;const t=u.snapshot();return I(),!Z(g._using)||Xe()||(I(),!p(n.name)||Xe())?(u.restoreFromSnapshot(t),false):(u.restoreFromSnapshot(t),true)}function _o(){for(;p(n.at);)k1()}function k1(){if(I(),S(n.parenL))Me(),A(n.parenR);else{for(ae();S(n.dot);)ae();Xg()}}function Xg(){me?w0():w1()}function w1(){S(n.parenL)&&as()}function zg(){I(),Ct()||(ae(),Ee())}function Yg(){I(),Ee()}function Kg(){I(),nt(false),A(n._while),Rr(),S(n.semi)}function Zg(){u.scopeDepth++;const t=u.tokens.length;Jg();const e=u.tokens.length;u.scopes.push(new Ft(t,e,false)),u.scopeDepth--}function Qg(){return!(!Z(g._using)||za(g._of))}function Jg(){I();let t=false;if(Z(g._await)&&(t=true,I()),A(n.parenL),p(n.semi)){t&&le(),Gn();return}const e=x1();if(e||p(n._var)||p(n._let)||p(n._const)||Qg()){if(e&&Re(g._await),I(),S1(true,u.type!==n._var),p(n._in)||Z(g._of)){Bc(t);return}Gn();return}if(Me(true),p(n._in)||Z(g._of)){Bc(t);return}t&&le(),Gn()}function eb(){const t=u.start;I(),vs(t,true)}function tb(){I(),Rr(),nt(false),S(n._else)&&nt(false)}function sb(){I(),Ct()||(Me(),Ee())}function ib(){I(),Rr(),u.scopeDepth++;const t=u.tokens.length;for(A(n.braceL);!p(n.braceR)&&!u.error;)if(p(n._case)||p(n._default)){const s=p(n._case);I(),s&&Me(),A(n.colon)}else nt(true);I();const e=u.tokens.length;u.scopes.push(new Ft(t,e,false)),u.scopeDepth--}function rb(){I(),Me(),Ee()}function nb(){Ar(true),me&&qs()}function ab(){if(I(),os(),p(n._catch)){I();let t=null;if(p(n.parenL)&&(u.scopeDepth++,t=u.tokens.length,A(n.parenL),nb(),A(n.parenR)),os(),t!=null){const e=u.tokens.length;u.scopes.push(new Ft(t,e,false)),u.scopeDepth--}}S(n._finally)&&os()}function Vi(t){I(),S1(false,t),Ee()}function ob(){I(),Rr(),nt(false)}function cb(){I()}function ub(){nt(true)}function lb(t){me?h0(t):_e?Sg(t):Ee()}function os(t=false,e=0){const s=u.tokens.length;u.scopeDepth++,A(n.braceL),e&&(u.tokens[u.tokens.length-1].contextId=e),Lr(n.braceR),e&&(u.tokens[u.tokens.length-1].contextId=e);const i=u.tokens.length;u.scopes.push(new Ft(s,i,t)),u.scopeDepth--}function Lr(t){for(;!S(t)&&!u.error;)nt(true)}function Gn(){A(n.semi),p(n.semi)||Me(),A(n.semi),p(n.parenR)||Me(),A(n.parenR),nt(false)}function Bc(t){t?Le(g._of):I(),Me(),A(n.parenR),nt(false)}function S1(t,e){for(;;){if(hb(e),S(n.eq)){const s=u.tokens.length-1;Be(t),u.tokens[s].rhsEndIndex=u.tokens.length}if(!S(n.comma))break}}function hb(t){Ar(t),me?g0():_e&&Ug()}function vs(t,e,s=false){p(n.star)&&I(),e&&!s&&!p(n.name)&&!p(n._yield)&&le();let i=null;p(n.name)&&(e||(i=u.tokens.length,u.scopeDepth++),hs(false));const r=u.tokens.length;u.scopeDepth++,Gs(),d1(t);const a=u.tokens.length;u.scopes.push(new Ft(r,a,true)),u.scopeDepth--,i!==null&&(u.scopes.push(new Ft(i,a,true)),u.scopeDepth--)}function Gs(t=false,e=0){me?m0():_e&&Fg(),A(n.parenL),e&&(u.tokens[u.tokens.length-1].contextId=e),Qa(n.parenR,false,false,t,e),e&&(u.tokens[u.tokens.length-1].contextId=e)}function xs(t,e=false){const s=li();I(),u.tokens[u.tokens.length-1].contextId=s,u.tokens[u.tokens.length-1].isExpression=!t;let i=null;t||(i=u.tokens.length,u.scopeDepth++),mb(t,e),gb();const r=u.tokens.length;if(fb(s),!u.error&&(u.tokens[r].contextId=s,u.tokens[u.tokens.length-1].contextId=s,i!==null)){const a=u.tokens.length;u.scopes.push(new Ft(i,a,false)),u.scopeDepth--}}function E1(){return p(n.eq)||p(n.semi)||p(n.braceR)||p(n.bang)||p(n.colon)}function T1(){return p(n.parenL)||p(n.lessThan)}function fb(t){for(A(n.braceL);!S(n.braceR)&&!u.error;){if(S(n.semi))continue;if(p(n.at)){k1();continue}const e=u.start;db(e,t)}}function db(t,e){me&&Ja([g._declare,g._public,g._protected,g._private,g._override]);let s=false;if(p(n.name)&&u.contextualKeyword===g._static){if(ae(),T1()){Js(t,false);return}else if(E1()){$i();return}if(u.tokens[u.tokens.length-1].type=n._static,s=true,p(n.braceL)){u.tokens[u.tokens.length-1].contextId=e,os();return}}pb(t,s,e)}function pb(t,e,s){if(me&&l0(e))return;if(S(n.star)){Ys(s),Js(t,false);return}Ys(s);let i=false;const r=u.tokens[u.tokens.length-1];r.contextualKeyword===g._constructor&&(i=true),Oc(),T1()?Js(t,i):E1()?$i():r.contextualKeyword===g._async&&!Ct()?(u.tokens[u.tokens.length-1].type=n._async,p(n.star)&&I(),Ys(s),Oc(),Js(t,false)):(r.contextualKeyword===g._get||r.contextualKeyword===g._set)&&!(Ct()&&p(n.star))?(r.contextualKeyword===g._get?u.tokens[u.tokens.length-1].type=n._get:u.tokens[u.tokens.length-1].type=n._set,Ys(s),Js(t,false)):r.contextualKeyword===g._accessor&&!Ct()?(Ys(s),$i()):Ct()?$i():le()}function Js(t,e){me?ws():_e&&p(n.lessThan)&&xt(),ya(t,e)}function Ys(t){di(t)}function Oc(){if(me){const t=de(0);S(n.question),fe(t)}}function $i(){if(me?(Il(n.bang),qs()):_e&&p(n.colon)&&Ss(),p(n.eq)){const t=u.tokens.length;I(),Be(),u.tokens[t].rhsEndIndex=u.tokens.length}Ee()}function mb(t,e=false){me&&(!t||e)&&Z(g._implements)||(p(n.name)&&hs(true),me?ws():_e&&p(n.lessThan)&&xt())}function gb(){let t=false;S(n._extends)?(u1(),t=true):t=false,me?d0(t):_e&&Rg(t)}function A1(){const t=u.tokens.length-1;me&&n0()||(vb()?xb():_b()?(ae(),p(n.comma)&&Ae()===n.star?(A(n.comma),A(n.star),Re(g._as),ae()):C1(),mi()):S(n._default)?bb():wb()?yb():(vo(),mi()),u.tokens[t].rhsEndIndex=u.tokens.length)}function bb(){if(me&&c0()||_e&&wg())return;const t=u.start;S(n._function)?vs(t,true,true):Z(g._async)&&Ae()===n._function?(Le(g._async),S(n._function),vs(t,true,true)):p(n._class)?xs(true,true):p(n.at)?(_o(),xs(true,true)):(Be(),Ee())}function yb(){me?f0():_e?Ag():nt(true)}function _b(){if(me&&i1())return false;if(_e&&Tg())return false;if(p(n.name))return u.contextualKeyword!==g._async;if(!p(n._default))return false;const t=Ya(),e=xi(),s=e.type===n.name&&e.contextualKeyword===g._from;if(e.type===n.comma)return true;if(s){const i=q.charCodeAt(Rl(t+4));return i===b.quotationMark||i===b.apostrophe}return false}function C1(){S(n.comma)&&vo()}function mi(){Le(g._from)&&(Yt(),R1()),Ee()}function vb(){return _e?Cg():p(n.star)}function xb(){_e?Ig():xa()}function xa(){A(n.star),Z(g._as)?kb():mi()}function kb(){I(),u.tokens[u.tokens.length-1].type=n._as,ae(),C1(),mi()}function wb(){return me&&i1()||_e&&Eg()||u.type===n._var||u.type===n._const||u.type===n._let||u.type===n._function||u.type===n._class||Z(g._async)||p(n.at)}function vo(){let t=true;for(A(n.braceL);!S(n.braceR)&&!u.error;){if(t)t=false;else if(A(n.comma),S(n.braceR))break;Sb()}}function Sb(){if(me){o0();return}ae(),u.tokens[u.tokens.length-1].identifierRole=ie.ExportAccess,Le(g._as)&&ae()}function Eb(){const t=u.snapshot();return Re(g._module),Le(g._from)?Z(g._from)?(u.restoreFromSnapshot(t),true):(u.restoreFromSnapshot(t),false):p(n.comma)?(u.restoreFromSnapshot(t),false):(u.restoreFromSnapshot(t),true)}function Tb(){Z(g._module)&&Eb()&&I()}function I1(){if(me&&p(n.name)&&Ae()===n.eq){ma();return}if(me&&Z(g._type)){const t=xi();if(t.type===n.name&&t.contextualKeyword!==g._from){if(Re(g._type),Ae()===n.eq){ma();return}}else(t.type===n.star||t.type===n.braceL)&&Re(g._type)}p(n.string)||(Tb(),Cb(),Re(g._from)),Yt(),R1(),Ee()}function Ab(){return p(n.name)}function Vc(){sr()}function Cb(){_e&&Dg();let t=true;if(!(Ab()&&(Vc(),!S(n.comma)))){if(p(n.star)){I(),Re(g._as),Vc();return}for(A(n.braceL);!S(n.braceR)&&!u.error;){if(t)t=false;else if(S(n.colon)&&le("ES2015 named imports do not destructure. Use another statement for destructuring after the import."),A(n.comma),S(n.braceR))break;Ib()}}}function Ib(){if(me){a0();return}if(_e){Ng();return}sr(),Z(g._as)&&(u.tokens[u.tokens.length-1].identifierRole=ie.ImportAccess,I(),sr())}function R1(){(p(n._with)||Z(g._assert)&&!Xe())&&(I(),uo(false,false))}function Rb(){return u.pos===0&&q.charCodeAt(0)===b.numberSign&&q.charCodeAt(1)===b.exclamationMark&&Dl(2),Ll(),Gg()}class Pb{constructor(e,s){this.tokens=e,this.scopes=s}}function Lb(t,e,s,i){if(i&&s)throw new Error("Cannot combine flow and typescript plugins.");tp(t,e,s,i);const r=Rb();if(u.error)throw Qd(u.error);return r}function Db(t){let e=t.currentIndex(),s=0;const i=t.currentToken();do{const r=t.tokens[e];if(r.isOptionalChainStart&&s++,r.isOptionalChainEnd&&s--,s+=r.numNullishCoalesceStarts,s-=r.numNullishCoalesceEnds,r.contextualKeyword===g._await&&r.identifierRole==null&&r.scopeDepth===i.scopeDepth)return true;e+=1}while(s>0&&e<t.tokens.length);return false}class ti{__init(){this.resultCode=""}__init2(){this.resultMappings=new Array(this.tokens.length)}__init3(){this.tokenIndex=0}constructor(e,s,i,r,a){this.code=e,this.tokens=s,this.isFlowEnabled=i,this.disableESTransforms=r,this.helperManager=a,ti.prototype.__init.call(this),ti.prototype.__init2.call(this),ti.prototype.__init3.call(this)}snapshot(){return{resultCode:this.resultCode,tokenIndex:this.tokenIndex}}restoreToSnapshot(e){this.resultCode=e.resultCode,this.tokenIndex=e.tokenIndex}dangerouslyGetAndRemoveCodeSinceSnapshot(e){const s=this.resultCode.slice(e.resultCode.length);return this.resultCode=e.resultCode,s}reset(){this.resultCode="",this.resultMappings=new Array(this.tokens.length),this.tokenIndex=0}matchesContextualAtIndex(e,s){return this.matches1AtIndex(e,n.name)&&this.tokens[e].contextualKeyword===s}identifierNameAtIndex(e){return this.identifierNameForToken(this.tokens[e])}identifierNameAtRelativeIndex(e){return this.identifierNameForToken(this.tokenAtRelativeIndex(e))}identifierName(){return this.identifierNameForToken(this.currentToken())}identifierNameForToken(e){return this.code.slice(e.start,e.end)}rawCodeForToken(e){return this.code.slice(e.start,e.end)}stringValueAtIndex(e){return this.stringValueForToken(this.tokens[e])}stringValue(){return this.stringValueForToken(this.currentToken())}stringValueForToken(e){return this.code.slice(e.start+1,e.end-1)}matches1AtIndex(e,s){return this.tokens[e].type===s}matches2AtIndex(e,s,i){return this.tokens[e].type===s&&this.tokens[e+1].type===i}matches3AtIndex(e,s,i,r){return this.tokens[e].type===s&&this.tokens[e+1].type===i&&this.tokens[e+2].type===r}matches1(e){return this.tokens[this.tokenIndex].type===e}matches2(e,s){return this.tokens[this.tokenIndex].type===e&&this.tokens[this.tokenIndex+1].type===s}matches3(e,s,i){return this.tokens[this.tokenIndex].type===e&&this.tokens[this.tokenIndex+1].type===s&&this.tokens[this.tokenIndex+2].type===i}matches4(e,s,i,r){return this.tokens[this.tokenIndex].type===e&&this.tokens[this.tokenIndex+1].type===s&&this.tokens[this.tokenIndex+2].type===i&&this.tokens[this.tokenIndex+3].type===r}matches5(e,s,i,r,a){return this.tokens[this.tokenIndex].type===e&&this.tokens[this.tokenIndex+1].type===s&&this.tokens[this.tokenIndex+2].type===i&&this.tokens[this.tokenIndex+3].type===r&&this.tokens[this.tokenIndex+4].type===a}matchesContextual(e){return this.matchesContextualAtIndex(this.tokenIndex,e)}matchesContextIdAndLabel(e,s){return this.matches1(e)&&this.currentToken().contextId===s}previousWhitespaceAndComments(){let e=this.code.slice(this.tokenIndex>0?this.tokens[this.tokenIndex-1].end:0,this.tokenIndex<this.tokens.length?this.tokens[this.tokenIndex].start:this.code.length);return this.isFlowEnabled&&(e=e.replace(/@flow/g,"")),e}replaceToken(e){this.resultCode+=this.previousWhitespaceAndComments(),this.appendTokenPrefix(),this.resultMappings[this.tokenIndex]=this.resultCode.length,this.resultCode+=e,this.appendTokenSuffix(),this.tokenIndex++}replaceTokenTrimmingLeftWhitespace(e){this.resultCode+=this.previousWhitespaceAndComments().replace(/[^\r\n]/g,""),this.appendTokenPrefix(),this.resultMappings[this.tokenIndex]=this.resultCode.length,this.resultCode+=e,this.appendTokenSuffix(),this.tokenIndex++}removeInitialToken(){this.replaceToken("")}removeToken(){this.replaceTokenTrimmingLeftWhitespace("")}removeBalancedCode(){let e=0;for(;!this.isAtEnd();){if(this.matches1(n.braceL))e++;else if(this.matches1(n.braceR)){if(e===0)return;e--}this.removeToken()}}copyExpectedToken(e){if(this.tokens[this.tokenIndex].type!==e)throw new Error(`Expected token ${e}`);this.copyToken()}copyToken(){this.resultCode+=this.previousWhitespaceAndComments(),this.appendTokenPrefix(),this.resultMappings[this.tokenIndex]=this.resultCode.length,this.resultCode+=this.code.slice(this.tokens[this.tokenIndex].start,this.tokens[this.tokenIndex].end),this.appendTokenSuffix(),this.tokenIndex++}copyTokenWithPrefix(e){this.resultCode+=this.previousWhitespaceAndComments(),this.appendTokenPrefix(),this.resultCode+=e,this.resultMappings[this.tokenIndex]=this.resultCode.length,this.resultCode+=this.code.slice(this.tokens[this.tokenIndex].start,this.tokens[this.tokenIndex].end),this.appendTokenSuffix(),this.tokenIndex++}appendTokenPrefix(){const e=this.currentToken();if((e.numNullishCoalesceStarts||e.isOptionalChainStart)&&(e.isAsyncOperation=Db(this)),!this.disableESTransforms){if(e.numNullishCoalesceStarts)for(let s=0;s<e.numNullishCoalesceStarts;s++)e.isAsyncOperation?(this.resultCode+="await ",this.resultCode+=this.helperManager.getHelperName("asyncNullishCoalesce")):this.resultCode+=this.helperManager.getHelperName("nullishCoalesce"),this.resultCode+="(";e.isOptionalChainStart&&(e.isAsyncOperation&&(this.resultCode+="await "),this.tokenIndex>0&&this.tokenAtRelativeIndex(-1).type===n._delete?e.isAsyncOperation?this.resultCode+=this.helperManager.getHelperName("asyncOptionalChainDelete"):this.resultCode+=this.helperManager.getHelperName("optionalChainDelete"):e.isAsyncOperation?this.resultCode+=this.helperManager.getHelperName("asyncOptionalChain"):this.resultCode+=this.helperManager.getHelperName("optionalChain"),this.resultCode+="([")}}appendTokenSuffix(){const e=this.currentToken();if(e.isOptionalChainEnd&&!this.disableESTransforms&&(this.resultCode+="])"),e.numNullishCoalesceEnds&&!this.disableESTransforms)for(let s=0;s<e.numNullishCoalesceEnds;s++)this.resultCode+="))"}appendCode(e){this.resultCode+=e}currentToken(){return this.tokens[this.tokenIndex]}currentTokenCode(){const e=this.currentToken();return this.code.slice(e.start,e.end)}tokenAtRelativeIndex(e){return this.tokens[this.tokenIndex+e]}currentIndex(){return this.tokenIndex}nextToken(){if(this.tokenIndex===this.tokens.length)throw new Error("Unexpectedly reached end of input.");this.tokenIndex++}previousToken(){this.tokenIndex--}finish(){if(this.tokenIndex!==this.tokens.length)throw new Error("Tried to finish processing tokens before reaching the end.");return this.resultCode+=this.previousWhitespaceAndComments(),{code:this.resultCode,mappings:this.resultMappings}}isAtEnd(){return this.tokenIndex===this.tokens.length}}function Nb(t,e,s,i){const r=e.snapshot(),a=Fb(e);let o=[];const c=[],l=[];let h=null;const d=[],m=[],_=e.currentToken().contextId;if(_==null)throw new Error("Expected non-null class context ID on class open-brace.");for(e.nextToken();!e.matchesContextIdAndLabel(n.braceR,_);)if(e.matchesContextual(g._constructor)&&!e.currentToken().isType)({constructorInitializerStatements:o,constructorInsertPos:h}=$c(e));else if(e.matches1(n.semi))i||m.push({start:e.currentIndex(),end:e.currentIndex()+1}),e.nextToken();else if(e.currentToken().isType)e.nextToken();else{const x=e.currentIndex();let E=false,N=false,F=false;for(;cr(e.currentToken());)e.matches1(n._static)&&(E=true),e.matches1(n.hash)&&(N=true),(e.matches1(n._declare)||e.matches1(n._abstract))&&(F=true),e.nextToken();if(E&&e.matches1(n.braceL)){Wn(e,_);continue}if(N){Wn(e,_);continue}if(e.matchesContextual(g._constructor)&&!e.currentToken().isType){({constructorInitializerStatements:o,constructorInsertPos:h}=$c(e));continue}const U=e.currentIndex();if(Ub(e),e.matches1(n.lessThan)||e.matches1(n.parenL)){Wn(e,_);continue}for(;e.currentToken().isType;)e.nextToken();if(e.matches1(n.eq)){const P=e.currentIndex(),X=e.currentToken().rhsEndIndex;if(X==null)throw new Error("Expected rhsEndIndex on class field assignment.");for(e.nextToken();e.currentIndex()<X;)t.processToken();let $;E?($=s.claimFreeName("__initStatic"),l.push($)):($=s.claimFreeName("__init"),c.push($)),d.push({initializerName:$,equalsIndex:P,start:U,end:e.currentIndex()})}else(!i||F)&&m.push({start:x,end:e.currentIndex()})}return e.restoreToSnapshot(r),i?{headerInfo:a,constructorInitializerStatements:o,instanceInitializerNames:[],staticInitializerNames:[],constructorInsertPos:h,fields:[],rangesToRemove:m}:{headerInfo:a,constructorInitializerStatements:o,instanceInitializerNames:c,staticInitializerNames:l,constructorInsertPos:h,fields:d,rangesToRemove:m}}function Wn(t,e){for(t.nextToken();t.currentToken().contextId!==e;)t.nextToken();for(;cr(t.tokenAtRelativeIndex(-1));)t.previousToken()}function Fb(t){const e=t.currentToken(),s=e.contextId;if(s==null)throw new Error("Expected context ID on class token.");const i=e.isExpression;if(i==null)throw new Error("Expected isExpression on class token.");let r=null,a=false;for(t.nextToken(),t.matches1(n.name)&&(r=t.identifierName());!t.matchesContextIdAndLabel(n.braceL,s);)t.matches1(n._extends)&&!t.currentToken().isType&&(a=true),t.nextToken();return{isExpression:i,className:r,hasSuperclass:a}}function $c(t){const e=[];t.nextToken();const s=t.currentToken().contextId;if(s==null)throw new Error("Expected context ID on open-paren starting constructor params.");for(;!t.matchesContextIdAndLabel(n.parenR,s);)if(t.currentToken().contextId===s){if(t.nextToken(),cr(t.currentToken())){for(t.nextToken();cr(t.currentToken());)t.nextToken();const a=t.currentToken();if(a.type!==n.name)throw new Error("Expected identifier after access modifiers in constructor arg.");const o=t.identifierNameForToken(a);e.push(`this.${o} = ${o}`)}}else t.nextToken();for(t.nextToken();t.currentToken().isType;)t.nextToken();let i=t.currentIndex(),r=false;for(;!t.matchesContextIdAndLabel(n.braceR,s);){if(!r&&t.matches2(n._super,n.parenL)){t.nextToken();const a=t.currentToken().contextId;if(a==null)throw new Error("Expected a context ID on the super call");for(;!t.matchesContextIdAndLabel(n.parenR,a);)t.nextToken();i=t.currentIndex(),r=true}t.nextToken()}return t.nextToken(),{constructorInitializerStatements:e,constructorInsertPos:i}}function cr(t){return[n._async,n._get,n._set,n.plus,n.minus,n._readonly,n._static,n._public,n._private,n._protected,n._override,n._abstract,n.star,n._declare,n.hash].includes(t.type)}function Ub(t){if(t.matches1(n.bracketL)){const s=t.currentToken().contextId;if(s==null)throw new Error("Expected class context ID on computed name open bracket.");for(;!t.matchesContextIdAndLabel(n.bracketR,s);)t.nextToken();t.nextToken()}else t.nextToken()}function P1(t){if(t.removeInitialToken(),t.removeToken(),t.removeToken(),t.removeToken(),t.matches1(n.parenL))t.removeToken(),t.removeToken(),t.removeToken();else for(;t.matches1(n.dot);)t.removeToken(),t.removeToken()}const L1={typeDeclarations:new Set,valueDeclarations:new Set};function D1(t){const e=new Set,s=new Set;for(let i=0;i<t.tokens.length;i++){const r=t.tokens[i];r.type===n.name&&Cl(r)&&(r.isType?e.add(t.identifierNameForToken(r)):s.add(t.identifierNameForToken(r)))}return{typeDeclarations:e,valueDeclarations:s}}function N1(t){let e=t.currentIndex();for(;!t.matches1AtIndex(e,n.braceR);)e++;return t.matchesContextualAtIndex(e+1,g._from)&&t.matches1AtIndex(e+2,n.string)}function bs(t){(t.matches2(n._with,n.braceL)||t.matches2(n.name,n.braceL)&&t.matchesContextual(g._assert))&&(t.removeToken(),t.removeToken(),t.removeBalancedCode(),t.removeToken())}function F1(t,e,s,i){if(!t||e)return false;const r=s.currentToken();if(r.rhsEndIndex==null)throw new Error("Expected non-null rhsEndIndex on export token.");const a=r.rhsEndIndex-s.currentIndex();if(a!==3&&!(a===4&&s.matches1AtIndex(r.rhsEndIndex-1,n.semi)))return false;const o=s.tokenAtRelativeIndex(2);if(o.type!==n.name)return false;const c=s.identifierNameForToken(o);return i.typeDeclarations.has(c)&&!i.valueDeclarations.has(c)}class si extends vt{__init(){this.hadExport=false}__init2(){this.hadNamedExport=false}__init3(){this.hadDefaultExport=false}constructor(e,s,i,r,a,o,c,l,h,d,m,_){super(),this.rootTransformer=e,this.tokens=s,this.importProcessor=i,this.nameManager=r,this.helperManager=a,this.reactHotLoaderTransformer=o,this.enableLegacyBabel5ModuleInterop=c,this.enableLegacyTypeScriptModuleInterop=l,this.isTypeScriptTransformEnabled=h,this.isFlowTransformEnabled=d,this.preserveDynamicImport=m,this.keepUnusedImports=_,si.prototype.__init.call(this),si.prototype.__init2.call(this),si.prototype.__init3.call(this),this.declarationInfo=h?D1(s):L1}getPrefixCode(){let e="";return this.hadExport&&(e+='Object.defineProperty(exports, "__esModule", {value: true});'),e}getSuffixCode(){return this.enableLegacyBabel5ModuleInterop&&this.hadDefaultExport&&!this.hadNamedExport?`
590
+ `};class tr{__init(){this.helperNames={}}__init2(){this.createRequireName=null}constructor(e){this.nameManager=e,tr.prototype.__init.call(this),tr.prototype.__init2.call(this)}getHelperName(e){let s=this.helperNames[e];return s||(s=this.nameManager.claimFreeName(`_${e}`),this.helperNames[e]=s,s)}emitHelpers(){let e="";this.helperNames.optionalChainDelete&&this.getHelperName("optionalChain"),this.helperNames.asyncOptionalChainDelete&&this.getHelperName("asyncOptionalChain");for(const[s,i]of Object.entries(tm)){const r=this.helperNames[s];let o=i;s==="optionalChainDelete"?o=o.replace("OPTIONAL_CHAIN_NAME",this.helperNames.optionalChain):s==="asyncOptionalChainDelete"?o=o.replace("ASYNC_OPTIONAL_CHAIN_NAME",this.helperNames.asyncOptionalChain):s==="require"&&(this.createRequireName===null&&(this.createRequireName=this.nameManager.claimFreeName("_createRequire")),o=o.replace(/CREATE_REQUIRE_NAME/g,this.createRequireName)),r&&(e+=" ",e+=o.replace(s,r).replace(/\s+/g," ").trim())}return e}}function Cc(t,e,s){sm(t,s)&&im(t,e,s)}function sm(t,e){for(const s of t.tokens)if(s.type===n.name&&!s.isType&&rp(s)&&e.has(t.identifierNameForToken(s)))return true;return false}function im(t,e,s){const i=[];let r=e.length-1;for(let o=t.tokens.length-1;;o--){for(;i.length>0&&i[i.length-1].startTokenIndex===o+1;)i.pop();for(;r>=0&&e[r].endTokenIndex===o+1;)i.push(e[r]),r--;if(o<0)break;const a=t.tokens[o],c=t.identifierNameForToken(a);if(i.length>1&&!a.isType&&a.type===n.name&&s.has(c)){if(np(a))Ic(i[i.length-1],t,c);else if(op(a)){let l=i.length-1;for(;l>0&&!i[l].isFunctionScope;)l--;if(l<0)throw new Error("Did not find parent function scope.");Ic(i[l],t,c)}}}if(i.length>0)throw new Error("Expected empty scope stack after processing file.")}function Ic(t,e,s){for(let i=t.startTokenIndex;i<t.endTokenIndex;i++){const r=e.tokens[i];(r.type===n.name||r.type===n.jsxName)&&e.identifierNameForToken(r)===s&&(r.shadowsGlobal=true)}}function rm(t,e){const s=[];for(const i of e)i.type===n.name&&s.push(t.slice(i.start,i.end));return s}class Zo{__init(){this.usedNames=new Set}constructor(e,s){Zo.prototype.__init.call(this),this.usedNames=new Set(rm(e,s))}claimFreeName(e){const s=this.findFreeName(e);return this.usedNames.add(s),s}findFreeName(e){if(!this.usedNames.has(e))return e;let s=2;for(;this.usedNames.has(e+String(s));)s++;return e+String(s)}}var we={},ho={},Rt={},nm=ys&&ys.__extends||function(){var t=function(e,s){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,r){i.__proto__=r}||function(i,r){for(var o in r)r.hasOwnProperty(o)&&(i[o]=r[o])},t(e,s)};return function(e,s){t(e,s);function i(){this.constructor=e}e.prototype=s===null?Object.create(s):(i.prototype=s.prototype,new i)}}();Object.defineProperty(Rt,"__esModule",{value:true});Rt.DetailContext=Rt.NoopContext=Rt.VError=void 0;var Gl=function(t){nm(e,t);function e(s,i){var r=t.call(this,i)||this;return r.path=s,Object.setPrototypeOf(r,e.prototype),r}return e}(Error);Rt.VError=Gl;var om=function(){function t(){}return t.prototype.fail=function(e,s,i){return false},t.prototype.unionResolver=function(){return this},t.prototype.createContext=function(){return this},t.prototype.resolveUnion=function(e){},t}();Rt.NoopContext=om;var Wl=function(){function t(){this._propNames=[""],this._messages=[null],this._score=0}return t.prototype.fail=function(e,s,i){return this._propNames.push(e),this._messages.push(s),this._score+=i,false},t.prototype.unionResolver=function(){return new am},t.prototype.resolveUnion=function(e){for(var s,i,r=e,o=null,a=0,c=r.contexts;a<c.length;a++){var l=c[a];(!o||l._score>=o._score)&&(o=l)}o&&o._score>0&&((s=this._propNames).push.apply(s,o._propNames),(i=this._messages).push.apply(i,o._messages))},t.prototype.getError=function(e){for(var s=[],i=this._propNames.length-1;i>=0;i--){var r=this._propNames[i];e+=typeof r=="number"?"["+r+"]":r?"."+r:"";var o=this._messages[i];o&&s.push(e+" "+o)}return new Gl(e,s.join("; "))},t.prototype.getErrorDetail=function(e){for(var s=[],i=this._propNames.length-1;i>=0;i--){var r=this._propNames[i];e+=typeof r=="number"?"["+r+"]":r?"."+r:"";var o=this._messages[i];o&&s.push({path:e,message:o})}for(var a=null,i=s.length-1;i>=0;i--)a&&(s[i].nested=[a]),a=s[i];return a},t}();Rt.DetailContext=Wl;var am=function(){function t(){this.contexts=[]}return t.prototype.createContext=function(){var e=new Wl;return this.contexts.push(e),e},t}();(function(t){var e=ys&&ys.__extends||function(){var w=function(T,D){return w=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(L,j){L.__proto__=j}||function(L,j){for(var se in j)j.hasOwnProperty(se)&&(L[se]=j[se])},w(T,D)};return function(T,D){w(T,D);function L(){this.constructor=T}T.prototype=D===null?Object.create(D):(L.prototype=D.prototype,new L)}}();Object.defineProperty(t,"__esModule",{value:true}),t.basicTypes=t.BasicType=t.TParamList=t.TParam=t.param=t.TFunc=t.func=t.TProp=t.TOptional=t.opt=t.TIface=t.iface=t.TEnumLiteral=t.enumlit=t.TEnumType=t.enumtype=t.TIntersection=t.intersection=t.TUnion=t.union=t.TTuple=t.tuple=t.TArray=t.array=t.TLiteral=t.lit=t.TName=t.name=t.TType=void 0;var s=Rt,i=function(){function w(){}return w}();t.TType=i;function r(w){return typeof w=="string"?a(w):w}function o(w,T){var D=w[T];if(!D)throw new Error("Unknown type "+T);return D}function a(w){return new c(w)}t.name=a;var c=function(w){e(T,w);function T(D){var L=w.call(this)||this;return L.name=D,L._failMsg="is not a "+D,L}return T.prototype.getChecker=function(D,L,j){var se=this,re=o(D,this.name),pe=re.getChecker(D,L,j);return re instanceof M||re instanceof T?pe:function(Se,ke){return pe(Se,ke)?true:ke.fail(null,se._failMsg,0)}},T}(i);t.TName=c;function l(w){return new h(w)}t.lit=l;var h=function(w){e(T,w);function T(D){var L=w.call(this)||this;return L.value=D,L.name=JSON.stringify(D),L._failMsg="is not "+L.name,L}return T.prototype.getChecker=function(D,L){var j=this;return function(se,re){return se===j.value?true:re.fail(null,j._failMsg,-1)}},T}(i);t.TLiteral=h;function d(w){return new m(r(w))}t.array=d;var m=function(w){e(T,w);function T(D){var L=w.call(this)||this;return L.ttype=D,L}return T.prototype.getChecker=function(D,L){var j=this.ttype.getChecker(D,L);return function(se,re){if(!Array.isArray(se))return re.fail(null,"is not an array",0);for(var pe=0;pe<se.length;pe++){var Se=j(se[pe],re);if(!Se)return re.fail(pe,null,1)}return true}},T}(i);t.TArray=m;function _(){for(var w=[],T=0;T<arguments.length;T++)w[T]=arguments[T];return new x(w.map(function(D){return r(D)}))}t.tuple=_;var x=function(w){e(T,w);function T(D){var L=w.call(this)||this;return L.ttypes=D,L}return T.prototype.getChecker=function(D,L){var j=this.ttypes.map(function(re){return re.getChecker(D,L)}),se=function(re,pe){if(!Array.isArray(re))return pe.fail(null,"is not an array",0);for(var Se=0;Se<j.length;Se++){var ke=j[Se](re[Se],pe);if(!ke)return pe.fail(Se,null,1)}return true};return L?function(re,pe){return se(re,pe)?re.length<=j.length?true:pe.fail(j.length,"is extraneous",2):false}:se},T}(i);t.TTuple=x;function E(){for(var w=[],T=0;T<arguments.length;T++)w[T]=arguments[T];return new N(w.map(function(D){return r(D)}))}t.union=E;var N=function(w){e(T,w);function T(D){var L=w.call(this)||this;L.ttypes=D;var j=D.map(function(re){return re instanceof c||re instanceof h?re.name:null}).filter(function(re){return re}),se=D.length-j.length;return j.length?(se>0&&j.push(se+" more"),L._failMsg="is none of "+j.join(", ")):L._failMsg="is none of "+se+" types",L}return T.prototype.getChecker=function(D,L){var j=this,se=this.ttypes.map(function(re){return re.getChecker(D,L)});return function(re,pe){for(var Se=pe.unionResolver(),ke=0;ke<se.length;ke++){var Fe=se[ke](re,Se.createContext());if(Fe)return true}return pe.resolveUnion(Se),pe.fail(null,j._failMsg,0)}},T}(i);t.TUnion=N;function F(){for(var w=[],T=0;T<arguments.length;T++)w[T]=arguments[T];return new U(w.map(function(D){return r(D)}))}t.intersection=F;var U=function(w){e(T,w);function T(D){var L=w.call(this)||this;return L.ttypes=D,L}return T.prototype.getChecker=function(D,L){var j=new Set,se=this.ttypes.map(function(re){return re.getChecker(D,L,j)});return function(re,pe){var Se=se.every(function(ke){return ke(re,pe)});return Se?true:pe.fail(null,null,0)}},T}(i);t.TIntersection=U;function P(w){return new X(w)}t.enumtype=P;var X=function(w){e(T,w);function T(D){var L=w.call(this)||this;return L.members=D,L.validValues=new Set,L._failMsg="is not a valid enum value",L.validValues=new Set(Object.keys(D).map(function(j){return D[j]})),L}return T.prototype.getChecker=function(D,L){var j=this;return function(se,re){return j.validValues.has(se)?true:re.fail(null,j._failMsg,0)}},T}(i);t.TEnumType=X;function $(w,T){return new te(w,T)}t.enumlit=$;var te=function(w){e(T,w);function T(D,L){var j=w.call(this)||this;return j.enumName=D,j.prop=L,j._failMsg="is not "+D+"."+L,j}return T.prototype.getChecker=function(D,L){var j=this,se=o(D,this.enumName);if(!(se instanceof X))throw new Error("Type "+this.enumName+" used in enumlit is not an enum type");var re=se.members[this.prop];if(!se.members.hasOwnProperty(this.prop))throw new Error("Unknown value "+this.enumName+"."+this.prop+" used in enumlit");return function(pe,Se){return pe===re?true:Se.fail(null,j._failMsg,-1)}},T}(i);t.TEnumLiteral=te;function ee(w){return Object.keys(w).map(function(T){return Q(T,w[T])})}function Q(w,T){return T instanceof y?new k(w,T.ttype,true):new k(w,r(T),false)}function z(w,T){return new ne(w,ee(T))}t.iface=z;var ne=function(w){e(T,w);function T(D,L){var j=w.call(this)||this;return j.bases=D,j.props=L,j.propSet=new Set(L.map(function(se){return se.name})),j}return T.prototype.getChecker=function(D,L,j){var se=this,re=this.bases.map(function(Ie){return o(D,Ie).getChecker(D,L)}),pe=this.props.map(function(Ie){return Ie.ttype.getChecker(D,L)}),Se=new s.NoopContext,ke=this.props.map(function(Ie,Ve){return!Ie.isOpt&&!pe[Ve](void 0,Se)}),Fe=function(Ie,Ve){if(typeof Ie!="object"||Ie===null)return Ve.fail(null,"is not an object",0);for(var $e=0;$e<re.length;$e++)if(!re[$e](Ie,Ve))return false;for(var $e=0;$e<pe.length;$e++){var fs=se.props[$e].name,Es=Ie[fs];if(Es===void 0){if(ke[$e])return Ve.fail(fs,"is missing",1)}else{var Ws=pe[$e](Es,Ve);if(!Ws)return Ve.fail(fs,null,1)}}return true};if(!L)return Fe;var Ye=this.propSet;return j&&(this.propSet.forEach(function(Ie){return j.add(Ie)}),Ye=j),function(Ie,Ve){if(!Fe(Ie,Ve))return false;for(var $e in Ie)if(!Ye.has($e))return Ve.fail($e,"is extraneous",2);return true}},T}(i);t.TIface=ne;function v(w){return new y(r(w))}t.opt=v;var y=function(w){e(T,w);function T(D){var L=w.call(this)||this;return L.ttype=D,L}return T.prototype.getChecker=function(D,L){var j=this.ttype.getChecker(D,L);return function(se,re){return se===void 0||j(se,re)}},T}(i);t.TOptional=y;var k=function(){function w(T,D,L){this.name=T,this.ttype=D,this.isOpt=L}return w}();t.TProp=k;function V(w){for(var T=[],D=1;D<arguments.length;D++)T[D-1]=arguments[D];return new G(new B(T),r(w))}t.func=V;var G=function(w){e(T,w);function T(D,L){var j=w.call(this)||this;return j.paramList=D,j.result=L,j}return T.prototype.getChecker=function(D,L){return function(j,se){return typeof j=="function"?true:se.fail(null,"is not a function",0)}},T}(i);t.TFunc=G;function O(w,T,D){return new R(w,r(T),!!D)}t.param=O;var R=function(){function w(T,D,L){this.name=T,this.ttype=D,this.isOpt=L}return w}();t.TParam=R;var B=function(w){e(T,w);function T(D){var L=w.call(this)||this;return L.params=D,L}return T.prototype.getChecker=function(D,L){var j=this,se=this.params.map(function(ke){return ke.ttype.getChecker(D,L)}),re=new s.NoopContext,pe=this.params.map(function(ke,Fe){return!ke.isOpt&&!se[Fe](void 0,re)}),Se=function(ke,Fe){if(!Array.isArray(ke))return Fe.fail(null,"is not an array",0);for(var Ye=0;Ye<se.length;Ye++){var Ie=j.params[Ye];if(ke[Ye]===void 0){if(pe[Ye])return Fe.fail(Ie.name,"is missing",1)}else{var Ve=se[Ye](ke[Ye],Fe);if(!Ve)return Fe.fail(Ie.name,null,1)}}return true};return L?function(ke,Fe){return Se(ke,Fe)?ke.length<=se.length?true:Fe.fail(se.length,"is extraneous",2):false}:Se},T}(i);t.TParamList=B;var M=function(w){e(T,w);function T(D,L){var j=w.call(this)||this;return j.validator=D,j.message=L,j}return T.prototype.getChecker=function(D,L){var j=this;return function(se,re){return j.validator(se)?true:re.fail(null,j.message,0)}},T}(i);t.BasicType=M,t.basicTypes={any:new M(function(w){return true},"is invalid"),number:new M(function(w){return typeof w=="number"},"is not a number"),object:new M(function(w){return typeof w=="object"&&w},"is not an object"),boolean:new M(function(w){return typeof w=="boolean"},"is not a boolean"),string:new M(function(w){return typeof w=="string"},"is not a string"),symbol:new M(function(w){return typeof w=="symbol"},"is not a symbol"),void:new M(function(w){return w==null},"is not void"),undefined:new M(function(w){return w===void 0},"is not undefined"),null:new M(function(w){return w===null},"is not null"),never:new M(function(w){return false},"is unexpected"),Date:new M(H("[object Date]"),"is not a Date"),RegExp:new M(H("[object RegExp]"),"is not a RegExp")};var C=Object.prototype.toString;function H(w){return function(T){return typeof T=="object"&&T&&C.call(T)===w}}typeof Buffer<"u"&&(t.basicTypes.Buffer=new M(function(w){return Buffer.isBuffer(w)},"is not a Buffer"));for(var W=function(w){t.basicTypes[w.name]=new M(function(T){return T instanceof w},"is not a "+w.name)},J=0,ce=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,ArrayBuffer];J<ce.length;J++){var ae=ce[J];W(ae)}})(ho);(function(t){var e=ys&&ys.__spreadArrays||function(){for(var l=0,h=0,d=arguments.length;h<d;h++)l+=arguments[h].length;for(var m=Array(l),_=0,h=0;h<d;h++)for(var x=arguments[h],E=0,N=x.length;E<N;E++,_++)m[_]=x[E];return m};Object.defineProperty(t,"__esModule",{value:true}),t.Checker=t.createCheckers=void 0;var s=ho,i=Rt,r=ho;Object.defineProperty(t,"TArray",{enumerable:true,get:function(){return r.TArray}}),Object.defineProperty(t,"TEnumType",{enumerable:true,get:function(){return r.TEnumType}}),Object.defineProperty(t,"TEnumLiteral",{enumerable:true,get:function(){return r.TEnumLiteral}}),Object.defineProperty(t,"TFunc",{enumerable:true,get:function(){return r.TFunc}}),Object.defineProperty(t,"TIface",{enumerable:true,get:function(){return r.TIface}}),Object.defineProperty(t,"TLiteral",{enumerable:true,get:function(){return r.TLiteral}}),Object.defineProperty(t,"TName",{enumerable:true,get:function(){return r.TName}}),Object.defineProperty(t,"TOptional",{enumerable:true,get:function(){return r.TOptional}}),Object.defineProperty(t,"TParam",{enumerable:true,get:function(){return r.TParam}}),Object.defineProperty(t,"TParamList",{enumerable:true,get:function(){return r.TParamList}}),Object.defineProperty(t,"TProp",{enumerable:true,get:function(){return r.TProp}}),Object.defineProperty(t,"TTuple",{enumerable:true,get:function(){return r.TTuple}}),Object.defineProperty(t,"TType",{enumerable:true,get:function(){return r.TType}}),Object.defineProperty(t,"TUnion",{enumerable:true,get:function(){return r.TUnion}}),Object.defineProperty(t,"TIntersection",{enumerable:true,get:function(){return r.TIntersection}}),Object.defineProperty(t,"array",{enumerable:true,get:function(){return r.array}}),Object.defineProperty(t,"enumlit",{enumerable:true,get:function(){return r.enumlit}}),Object.defineProperty(t,"enumtype",{enumerable:true,get:function(){return r.enumtype}}),Object.defineProperty(t,"func",{enumerable:true,get:function(){return r.func}}),Object.defineProperty(t,"iface",{enumerable:true,get:function(){return r.iface}}),Object.defineProperty(t,"lit",{enumerable:true,get:function(){return r.lit}}),Object.defineProperty(t,"name",{enumerable:true,get:function(){return r.name}}),Object.defineProperty(t,"opt",{enumerable:true,get:function(){return r.opt}}),Object.defineProperty(t,"param",{enumerable:true,get:function(){return r.param}}),Object.defineProperty(t,"tuple",{enumerable:true,get:function(){return r.tuple}}),Object.defineProperty(t,"union",{enumerable:true,get:function(){return r.union}}),Object.defineProperty(t,"intersection",{enumerable:true,get:function(){return r.intersection}}),Object.defineProperty(t,"BasicType",{enumerable:true,get:function(){return r.BasicType}});var o=Rt;Object.defineProperty(t,"VError",{enumerable:true,get:function(){return o.VError}});function a(){for(var l=[],h=0;h<arguments.length;h++)l[h]=arguments[h];for(var d=Object.assign.apply(Object,e([{},s.basicTypes],l)),m={},_=0,x=l;_<x.length;_++)for(var E=x[_],N=0,F=Object.keys(E);N<F.length;N++){var U=F[N];m[U]=new c(d,E[U])}return m}t.createCheckers=a;var c=function(){function l(h,d,m){if(m===void 0&&(m="value"),this.suite=h,this.ttype=d,this._path=m,this.props=new Map,d instanceof s.TIface)for(var _=0,x=d.props;_<x.length;_++){var E=x[_];this.props.set(E.name,E.ttype)}this.checkerPlain=this.ttype.getChecker(h,false),this.checkerStrict=this.ttype.getChecker(h,true)}return l.prototype.setReportedPath=function(h){this._path=h},l.prototype.check=function(h){return this._doCheck(this.checkerPlain,h)},l.prototype.test=function(h){return this.checkerPlain(h,new i.NoopContext)},l.prototype.validate=function(h){return this._doValidate(this.checkerPlain,h)},l.prototype.strictCheck=function(h){return this._doCheck(this.checkerStrict,h)},l.prototype.strictTest=function(h){return this.checkerStrict(h,new i.NoopContext)},l.prototype.strictValidate=function(h){return this._doValidate(this.checkerStrict,h)},l.prototype.getProp=function(h){var d=this.props.get(h);if(!d)throw new Error("Type has no property "+h);return new l(this.suite,d,this._path+"."+h)},l.prototype.methodArgs=function(h){var d=this._getMethod(h);return new l(this.suite,d.paramList)},l.prototype.methodResult=function(h){var d=this._getMethod(h);return new l(this.suite,d.result)},l.prototype.getArgs=function(){if(!(this.ttype instanceof s.TFunc))throw new Error("getArgs() applied to non-function");return new l(this.suite,this.ttype.paramList)},l.prototype.getResult=function(){if(!(this.ttype instanceof s.TFunc))throw new Error("getResult() applied to non-function");return new l(this.suite,this.ttype.result)},l.prototype.getType=function(){return this.ttype},l.prototype._doCheck=function(h,d){var m=new i.NoopContext;if(!h(d,m)){var _=new i.DetailContext;throw h(d,_),_.getError(this._path)}},l.prototype._doValidate=function(h,d){var m=new i.NoopContext;if(h(d,m))return null;var _=new i.DetailContext;return h(d,_),_.getErrorDetail(this._path)},l.prototype._getMethod=function(h){var d=this.props.get(h);if(!d)throw new Error("Type has no property "+h);if(!(d instanceof s.TFunc))throw new Error("Property "+h+" is not a method");return d},l}();t.Checker=c})(we);const cm=we.union(we.lit("jsx"),we.lit("typescript"),we.lit("flow"),we.lit("imports"),we.lit("react-hot-loader"),we.lit("jest")),um=we.iface([],{compiledFilename:"string"}),lm=we.iface([],{transforms:we.array("Transform"),disableESTransforms:we.opt("boolean"),jsxRuntime:we.opt(we.union(we.lit("classic"),we.lit("automatic"),we.lit("preserve"))),production:we.opt("boolean"),jsxImportSource:we.opt("string"),jsxPragma:we.opt("string"),jsxFragmentPragma:we.opt("string"),keepUnusedImports:we.opt("boolean"),preserveDynamicImport:we.opt("boolean"),injectCreateRequireForImportRequire:we.opt("boolean"),enableLegacyTypeScriptModuleInterop:we.opt("boolean"),enableLegacyBabel5ModuleInterop:we.opt("boolean"),sourceMapOptions:we.opt("SourceMapOptions"),filePath:we.opt("string")}),hm={Transform:cm,SourceMapOptions:um,Options:lm},{Options:fm}=we.createCheckers(hm);function dm(t){fm.strictCheck(t)}function Xl(){I(),Oe(false)}function zl(t){I(),Ar(t)}function hs(t){oe(),Qo(t)}function sr(){oe(),u.tokens[u.tokens.length-1].identifierRole=ie.ImportDeclaration}function Qo(t){let e;u.scopeDepth===0?e=ie.TopLevelDeclaration:t?e=ie.BlockScopedDeclaration:e=ie.FunctionScopedDeclaration,u.tokens[u.tokens.length-1].identifierRole=e}function Ar(t){switch(u.type){case n._this:{const e=de(0);I(),fe(e);return}case n._yield:case n.name:{u.type=n.name,hs(t);return}case n.bracketL:{I(),Jo(n.bracketR,t,true);return}case n.braceL:la(true,t);return;default:le()}}function Jo(t,e,s=false,i=false,r=0){let o=true,a=false;const c=u.tokens.length;for(;!S(t)&&!u.error;)if(o?o=false:(A(n.comma),u.tokens[u.tokens.length-1].contextId=r,!a&&u.tokens[c].isType&&(u.tokens[u.tokens.length-1].isType=true,a=true)),!(s&&p(n.comma))){if(S(t))break;if(p(n.ellipsis)){zl(e),Yl(),S(n.comma),A(t);break}else pm(i,e)}}function pm(t,e){t&&ea([g._public,g._protected,g._private,g._readonly,g._override]),ir(e),Yl(),ir(e,true)}function Yl(){_e?Lg():me&&k0()}function ir(t,e=false){if(e||Ar(t),!S(n.eq))return;const s=u.tokens.length-1;Oe(),u.tokens[s].rhsEndIndex=u.tokens.length}function fo(){return p(n.name)}function mm(){return p(n.name)||!!(u.type&n.IS_KEYWORD)||p(n.string)||p(n.num)||p(n.bigint)||p(n.decimal)}function Kl(){const t=u.snapshot();return I(),(p(n.bracketL)||p(n.braceL)||p(n.star)||p(n.ellipsis)||p(n.hash)||mm())&&!Xe()?true:(u.restoreFromSnapshot(t),false)}function ea(t){for(;Zl(t)!==null;);}function Zl(t){if(!p(n.name))return null;const e=u.contextualKeyword;if(t.indexOf(e)!==-1&&Kl()){switch(e){case g._readonly:u.tokens[u.tokens.length-1].type=n._readonly;break;case g._abstract:u.tokens[u.tokens.length-1].type=n._abstract;break;case g._static:u.tokens[u.tokens.length-1].type=n._static;break;case g._public:u.tokens[u.tokens.length-1].type=n._public;break;case g._private:u.tokens[u.tokens.length-1].type=n._private;break;case g._protected:u.tokens[u.tokens.length-1].type=n._protected;break;case g._override:u.tokens[u.tokens.length-1].type=n._override;break;case g._declare:u.tokens[u.tokens.length-1].type=n._declare;break}return e}return null}function ki(){for(oe();S(n.dot);)oe()}function gm(){ki(),!Xe()&&p(n.lessThan)&&Hs()}function bm(){I(),wi()}function ym(){I()}function _m(){A(n._typeof),p(n._import)?Ql():ki(),!Xe()&&p(n.lessThan)&&Hs()}function Ql(){A(n._import),A(n.parenL),A(n.string),A(n.parenR),S(n.dot)&&ki(),p(n.lessThan)&&Hs()}function vm(){S(n._const);const t=S(n._in),e=Le(g._out);S(n._const),(t||e)&&!p(n.name)?u.tokens[u.tokens.length-1].type=n.name:oe(),S(n._extends)&&Ce(),S(n.eq)&&Ce()}function ws(){p(n.lessThan)&&Cr()}function Cr(){const t=de(0);for(p(n.lessThan)||p(n.typeParameterStart)?I():le();!S(n.greaterThan)&&!u.error;)vm(),S(n.comma);fe(t)}function ta(t){const e=t===n.arrow;ws(),A(n.parenL),u.scopeDepth++,xm(false),u.scopeDepth--,(e||p(t))&&fi(t)}function xm(t){Jo(n.parenR,t)}function rr(){S(n.comma)||Ee()}function Rc(){ta(n.colon),rr()}function km(){const t=u.snapshot();I();const e=S(n.name)&&p(n.colon);return u.restoreFromSnapshot(t),e}function Jl(){if(!(p(n.bracketL)&&km()))return false;const t=de(0);return A(n.bracketL),oe(),wi(),A(n.bracketR),qs(),rr(),fe(t),true}function Pc(t){S(n.question),!t&&(p(n.parenL)||p(n.lessThan))?(ta(n.colon),rr()):(qs(),rr())}function wm(){if(p(n.parenL)||p(n.lessThan)){Rc();return}if(p(n._new)){I(),p(n.parenL)||p(n.lessThan)?Rc():Pc(false);return}const t=!!Zl([g._readonly]);Jl()||((Z(g._get)||Z(g._set))&&Kl(),di(-1),Pc(t))}function Sm(){e1()}function e1(){for(A(n.braceL);!S(n.braceR)&&!u.error;)wm()}function Em(){const t=u.snapshot(),e=Tm();return u.restoreFromSnapshot(t),e}function Tm(){return I(),S(n.plus)||S(n.minus)?Z(g._readonly):(Z(g._readonly)&&I(),!p(n.bracketL)||(I(),!fo())?false:(I(),p(n._in)))}function Am(){oe(),A(n._in),Ce()}function Cm(){A(n.braceL),p(n.plus)||p(n.minus)?(I(),Re(g._readonly)):Le(g._readonly),A(n.bracketL),Am(),Le(g._as)&&Ce(),A(n.bracketR),p(n.plus)||p(n.minus)?(I(),A(n.question)):S(n.question),jm(),Ee(),A(n.braceR)}function Im(){for(A(n.bracketL);!S(n.bracketR)&&!u.error;)Rm(),S(n.comma)}function Rm(){S(n.ellipsis)?Ce():(Ce(),S(n.question)),S(n.colon)&&Ce()}function Pm(){A(n.parenL),Ce(),A(n.parenR)}function Lm(){for(is(),is();!p(n.backQuote)&&!u.error;)A(n.dollarBraceL),Ce(),is(),is();I()}var ns;(function(t){t[t.TSFunctionType=0]="TSFunctionType";const s=1;t[t.TSConstructorType=s]="TSConstructorType";const i=s+1;t[t.TSAbstractConstructorType=i]="TSAbstractConstructorType"})(ns||(ns={}));function Hn(t){t===ns.TSAbstractConstructorType&&Re(g._abstract),(t===ns.TSConstructorType||t===ns.TSAbstractConstructorType)&&A(n._new);const e=u.inDisallowConditionalTypesContext;u.inDisallowConditionalTypesContext=false,ta(n.arrow),u.inDisallowConditionalTypesContext=e}function Dm(){switch(u.type){case n.name:gm();return;case n._void:case n._null:I();return;case n.string:case n.num:case n.bigint:case n.decimal:case n._true:case n._false:Os();return;case n.minus:I(),Os();return;case n._this:{ym(),Z(g._is)&&!Xe()&&bm();return}case n._typeof:_m();return;case n._import:Ql();return;case n.braceL:Em()?Cm():Sm();return;case n.bracketL:Im();return;case n.parenL:Pm();return;case n.backQuote:Lm();return;default:if(u.type&n.IS_KEYWORD){I(),u.tokens[u.tokens.length-1].type=n.name;return}break}le()}function Nm(){for(Dm();!Xe()&&S(n.bracketL);)S(n.bracketR)||(Ce(),A(n.bracketR))}function Fm(){if(Re(g._infer),oe(),p(n._extends)){const t=u.snapshot();A(n._extends);const e=u.inDisallowConditionalTypesContext;u.inDisallowConditionalTypesContext=true,Ce(),u.inDisallowConditionalTypesContext=e,(u.error||!u.inDisallowConditionalTypesContext&&p(n.question))&&u.restoreFromSnapshot(t)}}function po(){if(Z(g._keyof)||Z(g._unique)||Z(g._readonly))I(),po();else if(Z(g._infer))Fm();else{const t=u.inDisallowConditionalTypesContext;u.inDisallowConditionalTypesContext=false,Nm(),u.inDisallowConditionalTypesContext=t}}function Lc(){if(S(n.bitwiseAND),po(),p(n.bitwiseAND))for(;S(n.bitwiseAND);)po()}function Um(){if(S(n.bitwiseOR),Lc(),p(n.bitwiseOR))for(;S(n.bitwiseOR);)Lc()}function Mm(){return p(n.lessThan)?true:p(n.parenL)&&Bm()}function Om(){if(p(n.name)||p(n._this))return I(),true;if(p(n.braceL)||p(n.bracketL)){let t=1;for(I();t>0&&!u.error;)p(n.braceL)||p(n.bracketL)?t++:(p(n.braceR)||p(n.bracketR))&&t--,I();return true}return false}function Bm(){const t=u.snapshot(),e=Vm();return u.restoreFromSnapshot(t),e}function Vm(){return I(),!!(p(n.parenR)||p(n.ellipsis)||Om()&&(p(n.colon)||p(n.comma)||p(n.question)||p(n.eq)||p(n.parenR)&&(I(),p(n.arrow))))}function fi(t){const e=de(0);A(t),qm()||Ce(),fe(e)}function $m(){p(n.colon)&&fi(n.colon)}function qs(){p(n.colon)&&wi()}function jm(){S(n.colon)&&Ce()}function qm(){const t=u.snapshot();return Z(g._asserts)?(I(),Le(g._is)?(Ce(),true):fo()||p(n._this)?(I(),Le(g._is)&&Ce(),true):(u.restoreFromSnapshot(t),false)):fo()||p(n._this)?(I(),Z(g._is)&&!Xe()?(I(),Ce(),true):(u.restoreFromSnapshot(t),false)):false}function wi(){const t=de(0);A(n.colon),Ce(),fe(t)}function Ce(){if(Dc(),u.inDisallowConditionalTypesContext||Xe()||!S(n._extends))return;const t=u.inDisallowConditionalTypesContext;u.inDisallowConditionalTypesContext=true,Dc(),u.inDisallowConditionalTypesContext=t,A(n.question),Ce(),A(n.colon),Ce()}function Hm(){return Z(g._abstract)&&Ae()===n._new}function Dc(){if(Mm()){Hn(ns.TSFunctionType);return}if(p(n._new)){Hn(ns.TSConstructorType);return}else if(Hm()){Hn(ns.TSAbstractConstructorType);return}Um()}function Gm(){const t=de(1);Ce(),A(n.greaterThan),fe(t),Si()}function Wm(){if(S(n.jsxTagStart)){u.tokens[u.tokens.length-1].type=n.typeParameterStart;const t=de(1);for(;!p(n.greaterThan)&&!u.error;)Ce(),S(n.comma);lt(),fe(t)}}function t1(){for(;!p(n.braceL)&&!u.error;)Xm(),S(n.comma)}function Xm(){ki(),p(n.lessThan)&&Hs()}function zm(){hs(false),ws(),S(n._extends)&&t1(),e1()}function Ym(){hs(false),ws(),A(n.eq),Ce(),Ee()}function Km(){if(p(n.string)?Os():oe(),S(n.eq)){const t=u.tokens.length-1;Oe(),u.tokens[t].rhsEndIndex=u.tokens.length}}function sa(){for(hs(false),A(n.braceL);!S(n.braceR)&&!u.error;)Km(),S(n.comma)}function ia(){A(n.braceL),Lr(n.braceR)}function mo(){hs(false),S(n.dot)?mo():ia()}function s1(){Z(g._global)?oe():p(n.string)?Yt():le(),p(n.braceL)?ia():Ee()}function go(){sr(),A(n.eq),Qm(),Ee()}function Zm(){return Z(g._require)&&Ae()===n.parenL}function Qm(){Zm()?Jm():ki()}function Jm(){Re(g._require),A(n.parenL),p(n.string)||le(),Os(),A(n.parenR)}function e0(){if(Ct())return false;switch(u.type){case n._function:{const t=de(1);I();const e=u.start;return vs(e,true),fe(t),true}case n._class:{const t=de(1);return xs(true,false),fe(t),true}case n._const:if(p(n._const)&&Yo(g._enum)){const t=de(1);return A(n._const),Re(g._enum),u.tokens[u.tokens.length-1].type=n._enum,sa(),fe(t),true}case n._var:case n._let:{const t=de(1);return Vi(u.type!==n._var),fe(t),true}case n.name:{const t=de(1),e=u.contextualKeyword;let s=false;return e===g._global?(s1(),s=true):s=Ir(e,true),fe(t),s}default:return false}}function Nc(){return Ir(u.contextualKeyword,true)}function t0(t){switch(t){case g._declare:{const e=u.tokens.length-1;if(e0())return u.tokens[e].type=n._declare,true;break}case g._global:if(p(n.braceL))return ia(),true;break;default:return Ir(t,false)}return false}function Ir(t,e){switch(t){case g._abstract:if(Is(e)&&p(n._class))return u.tokens[u.tokens.length-1].type=n._abstract,xs(true,false),true;break;case g._enum:if(Is(e)&&p(n.name))return u.tokens[u.tokens.length-1].type=n._enum,sa(),true;break;case g._interface:if(Is(e)&&p(n.name)){const s=de(e?2:1);return zm(),fe(s),true}break;case g._module:if(Is(e)){if(p(n.string)){const s=de(e?2:1);return s1(),fe(s),true}else if(p(n.name)){const s=de(e?2:1);return mo(),fe(s),true}}break;case g._namespace:if(Is(e)&&p(n.name)){const s=de(e?2:1);return mo(),fe(s),true}break;case g._type:if(Is(e)&&p(n.name)){const s=de(e?2:1);return Ym(),fe(s),true}break}return false}function Is(t){return t?(I(),true):!Ct()}function s0(){const t=u.snapshot();return Cr(),Gs(),$m(),A(n.arrow),u.error?(u.restoreFromSnapshot(t),false):(Ei(true),true)}function ra(){u.type===n.bitShiftL&&(u.pos-=1,ue(n.lessThan)),Hs()}function Hs(){const t=de(0);for(A(n.lessThan);!p(n.greaterThan)&&!u.error;)Ce(),S(n.comma);t?(A(n.greaterThan),fe(t)):(fe(t),Ul(),A(n.greaterThan),u.tokens[u.tokens.length-1].isType=true)}function i1(){if(p(n.name))switch(u.contextualKeyword){case g._abstract:case g._declare:case g._enum:case g._interface:case g._module:case g._namespace:case g._type:return true}return false}function i0(t,e){if(p(n.colon)&&fi(n.colon),!p(n.braceL)&&Ct()){let s=u.tokens.length-1;for(;s>=0&&(u.tokens[s].start>=t||u.tokens[s].type===n._default||u.tokens[s].type===n._export);)u.tokens[s].isType=true,s--;return}Ei(false,e)}function r0(t,e,s){if(!Xe()&&S(n.bang)){u.tokens[u.tokens.length-1].type=n.nonNullAssertion;return}if(p(n.lessThan)||p(n.bitShiftL)){const i=u.snapshot();if(!e&&h1()&&s0())return;if(ra(),!e&&S(n.parenL)?(u.tokens[u.tokens.length-1].subscriptStartIndex=t,os()):p(n.backQuote)?ua():(u.type===n.greaterThan||u.type!==n.parenL&&u.type&n.IS_EXPRESSION_START&&!Xe())&&le(),u.error)u.restoreFromSnapshot(i);else return}else!e&&p(n.questionDot)&&Ae()===n.lessThan&&(I(),u.tokens[t].isOptionalChainStart=true,u.tokens[u.tokens.length-1].subscriptStartIndex=t,Hs(),A(n.parenL),os());oa(t,e,s)}function n0(){if(S(n._import))return Z(g._type)&&Ae()!==n.eq&&Re(g._type),go(),true;if(S(n.eq))return Me(),Ee(),true;if(Le(g._as))return Re(g._namespace),oe(),Ee(),true;if(Z(g._type)){const t=Ae();(t===n.braceL||t===n.star)&&I()}return false}function o0(){if(oe(),p(n.comma)||p(n.braceR)){u.tokens[u.tokens.length-1].identifierRole=ie.ImportDeclaration;return}if(oe(),p(n.comma)||p(n.braceR)){u.tokens[u.tokens.length-1].identifierRole=ie.ImportDeclaration,u.tokens[u.tokens.length-2].isType=true,u.tokens[u.tokens.length-1].isType=true;return}if(oe(),p(n.comma)||p(n.braceR)){u.tokens[u.tokens.length-3].identifierRole=ie.ImportAccess,u.tokens[u.tokens.length-1].identifierRole=ie.ImportDeclaration;return}oe(),u.tokens[u.tokens.length-3].identifierRole=ie.ImportAccess,u.tokens[u.tokens.length-1].identifierRole=ie.ImportDeclaration,u.tokens[u.tokens.length-4].isType=true,u.tokens[u.tokens.length-3].isType=true,u.tokens[u.tokens.length-2].isType=true,u.tokens[u.tokens.length-1].isType=true}function a0(){if(oe(),p(n.comma)||p(n.braceR)){u.tokens[u.tokens.length-1].identifierRole=ie.ExportAccess;return}if(oe(),p(n.comma)||p(n.braceR)){u.tokens[u.tokens.length-1].identifierRole=ie.ExportAccess,u.tokens[u.tokens.length-2].isType=true,u.tokens[u.tokens.length-1].isType=true;return}if(oe(),p(n.comma)||p(n.braceR)){u.tokens[u.tokens.length-3].identifierRole=ie.ExportAccess;return}oe(),u.tokens[u.tokens.length-3].identifierRole=ie.ExportAccess,u.tokens[u.tokens.length-4].isType=true,u.tokens[u.tokens.length-3].isType=true,u.tokens[u.tokens.length-2].isType=true,u.tokens[u.tokens.length-1].isType=true}function c0(){if(Z(g._abstract)&&Ae()===n._class)return u.type=n._abstract,I(),xs(true,true),true;if(Z(g._interface)){const t=de(2);return Ir(g._interface,true),fe(t),true}return false}function u0(){if(u.type===n._const){const t=xi();if(t.type===n.name&&t.contextualKeyword===g._enum)return A(n._const),Re(g._enum),u.tokens[u.tokens.length-1].type=n._enum,sa(),true}return false}function l0(t){const e=u.tokens.length;ea([g._abstract,g._readonly,g._declare,g._static,g._override]);const s=u.tokens.length;if(Jl()){const r=t?e-1:e;for(let o=r;o<s;o++)u.tokens[o].isType=true;return true}return false}function h0(t){t0(t)||Ee()}function f0(){const t=Le(g._declare);t&&(u.tokens[u.tokens.length-1].type=n._declare);let e=false;if(p(n.name))if(t){const s=de(2);e=Nc(),fe(s)}else e=Nc();if(!e)if(t){const s=de(2);nt(true),fe(s)}else nt(true)}function d0(t){if(t&&(p(n.lessThan)||p(n.bitShiftL))&&ra(),Le(g._implements)){u.tokens[u.tokens.length-1].type=n._implements;const e=de(1);t1(),fe(e)}}function p0(){ws()}function m0(){ws()}function g0(){const t=de(0);Xe()||S(n.bang),qs(),fe(t)}function b0(){p(n.colon)&&wi()}function y0(t,e){return Er?_0(t,e):v0(t,e)}function _0(t,e){if(!p(n.lessThan))return Pt(t,e);const s=u.snapshot();let i=Pt(t,e);if(u.error)u.restoreFromSnapshot(s);else return i;return u.type=n.typeParameterStart,Cr(),i=Pt(t,e),i||le(),i}function v0(t,e){if(!p(n.lessThan))return Pt(t,e);const s=u.snapshot();Cr();const i=Pt(t,e);if(i||le(),u.error)u.restoreFromSnapshot(s);else return i;return Pt(t,e)}function x0(){if(p(n.colon)){const t=u.snapshot();fi(n.colon),rt()&&le(),p(n.arrow)||le(),u.error&&u.restoreFromSnapshot(t)}return S(n.arrow)}function k0(){const t=de(0);S(n.question),qs(),fe(t)}function w0(){(p(n.lessThan)||p(n.bitShiftL))&&ra(),w1()}function S0(){let t=false,e=false;for(;;){if(u.pos>=q.length){le("Unterminated JSX contents");return}const s=q.charCodeAt(u.pos);if(s===b.lessThan||s===b.leftCurlyBrace){if(u.pos===u.start){if(s===b.lessThan){u.pos++,ue(n.jsxTagStart);return}Ml(s);return}ue(t&&!e?n.jsxEmptyText:n.jsxText);return}s===b.lineFeed?t=true:s!==b.space&&s!==b.carriageReturn&&s!==b.tab&&(e=true),u.pos++}}function E0(t){for(u.pos++;;){if(u.pos>=q.length){le("Unterminated string constant");return}if(q.charCodeAt(u.pos)===t){u.pos++;break}u.pos++}ue(n.string)}function T0(){let t;do{if(u.pos>q.length){le("Unexpectedly reached the end of input.");return}t=q.charCodeAt(++u.pos)}while(_t[t]||t===b.dash);ue(n.jsxName)}function bo(){lt()}function r1(t){if(bo(),!S(n.colon)){u.tokens[u.tokens.length-1].identifierRole=t;return}bo()}function n1(){const t=u.tokens.length;r1(ie.Access);let e=false;for(;p(n.dot);)e=true,lt(),bo();if(!e){const s=u.tokens[t],i=q.charCodeAt(s.start);i>=b.lowercaseA&&i<=b.lowercaseZ&&(s.identifierRole=null)}}function A0(){switch(u.type){case n.braceL:I(),Me(),lt();return;case n.jsxTagStart:a1(),lt();return;case n.string:lt();return;default:le("JSX value should be either an expression or a quoted JSX text")}}function C0(){A(n.ellipsis),Me()}function I0(t){if(p(n.jsxTagEnd))return false;n1(),me&&Wm();let e=false;for(;!p(n.slash)&&!p(n.jsxTagEnd)&&!u.error;){if(S(n.braceL)){e=true,A(n.ellipsis),Oe(),lt();continue}e&&u.end-u.start===3&&q.charCodeAt(u.start)===b.lowercaseK&&q.charCodeAt(u.start+1)===b.lowercaseE&&q.charCodeAt(u.start+2)===b.lowercaseY&&(u.tokens[t].jsxRole=mt.KeyAfterPropSpread),r1(ie.ObjectKey),p(n.eq)&&(lt(),A0())}const s=p(n.slash);return s&&lt(),s}function R0(){p(n.jsxTagEnd)||n1()}function o1(){const t=u.tokens.length-1;u.tokens[t].jsxRole=mt.NoChildren;let e=0;if(!I0(t))for(Rs();;)switch(u.type){case n.jsxTagStart:if(lt(),p(n.slash)){lt(),R0(),u.tokens[t].jsxRole!==mt.KeyAfterPropSpread&&(e===1?u.tokens[t].jsxRole=mt.OneChild:e>1&&(u.tokens[t].jsxRole=mt.StaticChildren));return}e++,o1(),Rs();break;case n.jsxText:e++,Rs();break;case n.jsxEmptyText:Rs();break;case n.braceL:I(),p(n.ellipsis)?(C0(),Rs(),e+=2):(p(n.braceR)||(e++,Me()),Rs());break;default:le();return}}function a1(){lt(),o1()}function lt(){u.tokens.push(new Tr),Nl(),u.start=u.pos;const t=q.charCodeAt(u.pos);if(vi[t])T0();else if(t===b.quotationMark||t===b.apostrophe)E0(t);else switch(++u.pos,t){case b.greaterThan:ue(n.jsxTagEnd);break;case b.lessThan:ue(n.jsxTagStart);break;case b.slash:ue(n.slash);break;case b.equalsTo:ue(n.eq);break;case b.leftCurlyBrace:ue(n.braceL);break;case b.dot:ue(n.dot);break;case b.colon:ue(n.colon);break;default:le()}}function Rs(){u.tokens.push(new Tr),u.start=u.pos,S0()}function P0(t){if(p(n.question)){const e=Ae();if(e===n.colon||e===n.comma||e===n.parenR)return}c1(t)}function L0(){Il(n.question),p(n.colon)&&(me?wi():_e&&Ss())}class D0{constructor(e){this.stop=e}}function Me(t=false){if(Oe(t),p(n.comma))for(;S(n.comma);)Oe(t)}function Oe(t=false,e=false){return me?y0(t,e):_e?Og(t,e):Pt(t,e)}function Pt(t,e){if(p(n._yield))return Y0(),false;(p(n.parenL)||p(n.name)||p(n._yield))&&(u.potentialArrowAt=u.start);const s=N0(t);return e&&ca(),u.type&n.IS_ASSIGN?(I(),Oe(t),false):s}function N0(t){return U0(t)?true:(F0(t),false)}function F0(t){me||_e?P0(t):c1(t)}function c1(t){S(n.question)&&(Oe(),A(n.colon),Oe(t))}function U0(t){const e=u.tokens.length;return Si()?true:(Oi(e,-1,t),false)}function Oi(t,e,s){if(me&&(n._in&n.PRECEDENCE_MASK)>e&&!Xe()&&(Le(g._as)||Le(g._satisfies))){const r=de(1);Ce(),fe(r),Ul(),Oi(t,e,s);return}const i=u.type&n.PRECEDENCE_MASK;if(i>0&&(!s||!p(n._in))&&i>e){const r=u.type;I(),r===n.nullishCoalescing&&(u.tokens[u.tokens.length-1].nullishStartIndex=t);const o=u.tokens.length;Si(),Oi(o,r&n.IS_RIGHT_ASSOCIATIVE?i-1:i,s),r===n.nullishCoalescing&&(u.tokens[t].numNullishCoalesceStarts++,u.tokens[u.tokens.length-1].numNullishCoalesceEnds++),Oi(t,e,s)}}function Si(){if(me&&!Er&&S(n.lessThan))return Gm(),false;if(Z(g._module)&&Pl()===b.leftCurlyBrace&&!Sl())return K0(),false;if(u.type&n.IS_PREFIX)return I(),Si(),false;if(u1())return true;for(;u.type&n.IS_POSTFIX&&!rt();)u.type===n.preIncDec&&(u.type=n.postIncDec),I();return false}function u1(){const t=u.tokens.length;return Yt()?true:(na(t),u.tokens.length>t&&u.tokens[t].isOptionalChainStart&&(u.tokens[u.tokens.length-1].isOptionalChainEnd=true),false)}function na(t,e=false){_e?Vg(t,e):l1(t,e)}function l1(t,e=false){const s=new D0(false);do M0(t,e,s);while(!s.stop&&!u.error)}function M0(t,e,s){me?r0(t,e,s):_e?vg(t,e,s):oa(t,e,s)}function oa(t,e,s){if(!e&&S(n.doubleColon))aa(),s.stop=true,na(t,e);else if(p(n.questionDot)){if(u.tokens[t].isOptionalChainStart=true,e&&Ae()===n.parenL){s.stop=true;return}I(),u.tokens[u.tokens.length-1].subscriptStartIndex=t,S(n.bracketL)?(Me(),A(n.bracketR)):S(n.parenL)?os():nr()}else if(S(n.dot))u.tokens[u.tokens.length-1].subscriptStartIndex=t,nr();else if(S(n.bracketL))u.tokens[u.tokens.length-1].subscriptStartIndex=t,Me(),A(n.bracketR);else if(!e&&p(n.parenL))if(h1()){const i=u.snapshot(),r=u.tokens.length;I(),u.tokens[u.tokens.length-1].subscriptStartIndex=t;const o=li();u.tokens[u.tokens.length-1].contextId=o,os(),u.tokens[u.tokens.length-1].contextId=o,O0()&&(u.restoreFromSnapshot(i),s.stop=true,u.scopeDepth++,Gs(),B0(r))}else{I(),u.tokens[u.tokens.length-1].subscriptStartIndex=t;const i=li();u.tokens[u.tokens.length-1].contextId=i,os(),u.tokens[u.tokens.length-1].contextId=i}else p(n.backQuote)?ua():s.stop=true}function h1(){return u.tokens[u.tokens.length-1].contextualKeyword===g._async&&!rt()}function os(){let t=true;for(;!S(n.parenR)&&!u.error;){if(t)t=false;else if(A(n.comma),S(n.parenR))break;m1(false)}}function O0(){return p(n.colon)||p(n.arrow)}function B0(t){me?b0():_e&&Mg(),A(n.arrow),pi(t)}function aa(){const t=u.tokens.length;Yt(),na(t,true)}function Yt(){if(S(n.modulo))return oe(),false;if(p(n.jsxText)||p(n.jsxEmptyText))return Os(),false;if(p(n.lessThan)&&Er)return u.type=n.jsxTagStart,a1(),I(),false;const t=u.potentialArrowAt===u.start;switch(u.type){case n.slash:case n.assign:cp();case n._super:case n._this:case n.regexp:case n.num:case n.bigint:case n.decimal:case n.string:case n._null:case n._true:case n._false:return I(),false;case n._import:return I(),p(n.dot)&&(u.tokens[u.tokens.length-1].type=n.name,I(),oe()),false;case n.name:{const e=u.tokens.length,s=u.start,i=u.contextualKeyword;return oe(),i===g._await?(z0(),false):i===g._async&&p(n._function)&&!rt()?(I(),vs(s,false),false):t&&i===g._async&&!rt()&&p(n.name)?(u.scopeDepth++,hs(false),A(n.arrow),pi(e),true):p(n._do)&&!rt()?(I(),as(),false):t&&!rt()&&p(n.arrow)?(u.scopeDepth++,Qo(false),A(n.arrow),pi(e),true):(u.tokens[u.tokens.length-1].identifierRole=ie.Access,false)}case n._do:return I(),as(),false;case n.parenL:return f1(t);case n.bracketL:return I(),p1(n.bracketR,true),false;case n.braceL:return la(false,false),false;case n._function:return V0(),false;case n.at:_a();case n._class:return xs(false),false;case n._new:return j0(),false;case n.backQuote:return ua(),false;case n.doubleColon:return I(),aa(),false;case n.hash:{const e=Pl();return vi[e]||e===b.backslash?nr():I(),false}default:return le(),false}}function nr(){S(n.hash),oe()}function V0(){const t=u.start;oe(),S(n.dot)&&oe(),vs(t,false)}function Os(){I()}function Rr(){A(n.parenL),Me(),A(n.parenR)}function f1(t){const e=u.snapshot(),s=u.tokens.length;A(n.parenL);let i=true;for(;!p(n.parenR)&&!u.error;){if(i)i=false;else if(A(n.comma),p(n.parenR))break;if(p(n.ellipsis)){zl(false),ca();break}else Oe(false,true)}return A(n.parenR),t&&$0()&&yo()?(u.restoreFromSnapshot(e),u.scopeDepth++,Gs(),yo(),pi(s),u.error?(u.restoreFromSnapshot(e),f1(false),false):true):false}function $0(){return p(n.colon)||!rt()}function yo(){return me?x0():_e?Bg():S(n.arrow)}function ca(){(me||_e)&&L0()}function j0(){if(A(n._new),S(n.dot)){oe();return}q0(),_e&&xg(),S(n.parenL)&&p1(n.parenR)}function q0(){aa(),S(n.questionDot)}function ua(){for(is(),is();!p(n.backQuote)&&!u.error;)A(n.dollarBraceL),Me(),is(),is();I()}function la(t,e){const s=li();let i=true;for(I(),u.tokens[u.tokens.length-1].contextId=s;!S(n.braceR)&&!u.error;){if(i)i=false;else if(A(n.comma),S(n.braceR))break;let r=false;if(p(n.ellipsis)){const o=u.tokens.length;if(Xl(),t&&(u.tokens.length===o+2&&Qo(e),S(n.braceR)))break;continue}t||(r=S(n.star)),!t&&Z(g._async)?(r&&le(),oe(),p(n.colon)||p(n.parenL)||p(n.braceR)||p(n.eq)||p(n.comma)||(p(n.star)&&(I(),r=true),di(s))):di(s),X0(t,e,s)}u.tokens[u.tokens.length-1].contextId=s}function H0(t){return!t&&(p(n.string)||p(n.num)||p(n.bracketL)||p(n.name)||!!(u.type&n.IS_KEYWORD))}function G0(t,e){const s=u.start;return p(n.parenL)?(t&&le(),_o(s,false),true):H0(t)?(di(e),_o(s,false),true):false}function W0(t,e){if(S(n.colon)){t?ir(e):Oe(false);return}let s;t?u.scopeDepth===0?s=ie.ObjectShorthandTopLevelDeclaration:e?s=ie.ObjectShorthandBlockScopedDeclaration:s=ie.ObjectShorthandFunctionScopedDeclaration:s=ie.ObjectShorthand,u.tokens[u.tokens.length-1].identifierRole=s,ir(e,true)}function X0(t,e,s){me?p0():_e&&Pg(),G0(t,s)||W0(t,e)}function di(t){_e&&ya(),S(n.bracketL)?(u.tokens[u.tokens.length-1].contextId=t,Oe(),A(n.bracketR),u.tokens[u.tokens.length-1].contextId=t):(p(n.num)||p(n.string)||p(n.bigint)||p(n.decimal)?Yt():nr(),u.tokens[u.tokens.length-1].identifierRole=ie.ObjectKey,u.tokens[u.tokens.length-1].contextId=t)}function _o(t,e){const s=li();u.scopeDepth++;const i=u.tokens.length;Gs(e,s),d1(t,s);const o=u.tokens.length;u.scopes.push(new Ft(i,o,true)),u.scopeDepth--}function pi(t){Ei(true);const e=u.tokens.length;u.scopes.push(new Ft(t,e,true)),u.scopeDepth--}function d1(t,e=0){me?i0(t,e):_e?_g(e):Ei(false,e)}function Ei(t,e=0){t&&!p(n.braceL)?Oe():as(true,e)}function p1(t,e=false){let s=true;for(;!S(t)&&!u.error;){if(s)s=false;else if(A(n.comma),S(t))break;m1(e)}}function m1(t){t&&p(n.comma)||(p(n.ellipsis)?(Xl(),ca()):p(n.question)?I():Oe(false,true))}function oe(){I(),u.tokens[u.tokens.length-1].type=n.name}function z0(){Si()}function Y0(){I(),!p(n.semi)&&!rt()&&(S(n.star),Oe())}function K0(){Re(g._module),A(n.braceL),Lr(n.braceR)}function Z0(t){return(t.type===n.name||!!(t.type&n.IS_KEYWORD))&&t.contextualKeyword!==g._from}function Ut(t){const e=de(0);A(t||n.colon),tt(),fe(e)}function Fc(){A(n.modulo),Re(g._checks),S(n.parenL)&&(Me(),A(n.parenR))}function ha(){const t=de(0);A(n.colon),p(n.modulo)?Fc():(tt(),p(n.modulo)&&Fc()),fe(t)}function Q0(){I(),fa(true)}function J0(){I(),oe(),p(n.lessThan)&&xt(),A(n.parenL),xo(),A(n.parenR),ha(),Ee()}function vo(){p(n._class)?Q0():p(n._function)?J0():p(n._var)?eg():Le(g._module)?S(n.dot)?ig():tg():Z(g._type)?rg():Z(g._opaque)?ng():Z(g._interface)?og():p(n._export)?sg():le()}function eg(){I(),_1(),Ee()}function tg(){for(p(n.string)?Yt():oe(),A(n.braceL);!p(n.braceR)&&!u.error;)p(n._import)?(I(),I1()):le();A(n.braceR)}function sg(){A(n._export),S(n._default)?p(n._function)||p(n._class)?vo():(tt(),Ee()):p(n._var)||p(n._function)||p(n._class)||Z(g._opaque)?vo():p(n.star)||p(n.braceL)||Z(g._interface)||Z(g._type)||Z(g._opaque)?A1():le()}function ig(){Re(g._exports),Ss(),Ee()}function rg(){I(),pa()}function ng(){I(),ma(true)}function og(){I(),fa()}function fa(t=false){if(Pr(),p(n.lessThan)&&xt(),S(n._extends))do Bi();while(!t&&S(n.comma));if(Z(g._mixins)){I();do Bi();while(S(n.comma))}if(Z(g._implements)){I();do Bi();while(S(n.comma))}or(t,false,t)}function Bi(){g1(false),p(n.lessThan)&&_s()}function da(){fa()}function Pr(){oe()}function pa(){Pr(),p(n.lessThan)&&xt(),Ut(n.eq),Ee()}function ma(t){Re(g._type),Pr(),p(n.lessThan)&&xt(),p(n.colon)&&Ut(n.colon),t||Ut(n.eq),Ee()}function ag(){ya(),_1(),S(n.eq)&&tt()}function xt(){const t=de(0);p(n.lessThan)||p(n.typeParameterStart)?I():le();do ag(),p(n.greaterThan)||A(n.comma);while(!p(n.greaterThan)&&!u.error);A(n.greaterThan),fe(t)}function _s(){const t=de(0);for(A(n.lessThan);!p(n.greaterThan)&&!u.error;)tt(),p(n.greaterThan)||A(n.comma);A(n.greaterThan),fe(t)}function cg(){if(Re(g._interface),S(n._extends))do Bi();while(S(n.comma));or(false,false,false)}function ga(){p(n.num)||p(n.string)?Yt():oe()}function ug(){Ae()===n.colon?(ga(),Ut()):tt(),A(n.bracketR),Ut()}function lg(){ga(),A(n.bracketR),A(n.bracketR),p(n.lessThan)||p(n.parenL)?ba():(S(n.question),Ut())}function ba(){for(p(n.lessThan)&&xt(),A(n.parenL);!p(n.parenR)&&!p(n.ellipsis)&&!u.error;)ar(),p(n.parenR)||A(n.comma);S(n.ellipsis)&&ar(),A(n.parenR),Ut()}function hg(){ba()}function or(t,e,s){let i;for(e&&p(n.braceBarL)?(A(n.braceBarL),i=n.braceBarR):(A(n.braceL),i=n.braceR);!p(i)&&!u.error;){if(s&&Z(g._proto)){const r=Ae();r!==n.colon&&r!==n.question&&(I(),t=false)}if(t&&Z(g._static)){const r=Ae();r!==n.colon&&r!==n.question&&I()}if(ya(),S(n.bracketL))S(n.bracketL)?lg():ug();else if(p(n.parenL)||p(n.lessThan))hg();else{if(Z(g._get)||Z(g._set)){const r=Ae();(r===n.name||r===n.string||r===n.num)&&I()}fg()}dg()}A(i)}function fg(){if(p(n.ellipsis)){if(A(n.ellipsis),S(n.comma)||S(n.semi),p(n.braceR))return;tt()}else ga(),p(n.lessThan)||p(n.parenL)?ba():(S(n.question),Ut())}function dg(){!S(n.semi)&&!S(n.comma)&&!p(n.braceR)&&!p(n.braceBarR)&&le()}function g1(t){for(t||oe();S(n.dot);)oe()}function pg(){g1(true),p(n.lessThan)&&_s()}function mg(){A(n._typeof),b1()}function gg(){for(A(n.bracketL);u.pos<q.length&&!p(n.bracketR)&&(tt(),!p(n.bracketR));)A(n.comma);A(n.bracketR)}function ar(){const t=Ae();t===n.colon||t===n.question?(oe(),S(n.question),Ut()):tt()}function xo(){for(;!p(n.parenR)&&!p(n.ellipsis)&&!u.error;)ar(),p(n.parenR)||A(n.comma);S(n.ellipsis)&&ar()}function b1(){let t=false;const e=u.noAnonFunctionType;switch(u.type){case n.name:{if(Z(g._interface)){cg();return}oe(),pg();return}case n.braceL:or(false,false,false);return;case n.braceBarL:or(false,true,false);return;case n.bracketL:gg();return;case n.lessThan:xt(),A(n.parenL),xo(),A(n.parenR),A(n.arrow),tt();return;case n.parenL:if(I(),!p(n.parenR)&&!p(n.ellipsis))if(p(n.name)){const s=Ae();t=s!==n.question&&s!==n.colon}else t=true;if(t)if(u.noAnonFunctionType=false,tt(),u.noAnonFunctionType=e,u.noAnonFunctionType||!(p(n.comma)||p(n.parenR)&&Ae()===n.arrow)){A(n.parenR);return}else S(n.comma);xo(),A(n.parenR),A(n.arrow),tt();return;case n.minus:I(),Os();return;case n.string:case n.num:case n._true:case n._false:case n._null:case n._this:case n._void:case n.star:I();return;default:if(u.type===n._typeof){mg();return}else if(u.type&n.IS_KEYWORD){I(),u.tokens[u.tokens.length-1].type=n.name;return}}le()}function bg(){for(b1();!rt()&&(p(n.bracketL)||p(n.questionDot));)S(n.questionDot),A(n.bracketL),S(n.bracketR)||(tt(),A(n.bracketR))}function y1(){S(n.question)?y1():bg()}function Uc(){y1(),!u.noAnonFunctionType&&S(n.arrow)&&tt()}function Mc(){for(S(n.bitwiseAND),Uc();S(n.bitwiseAND);)Uc()}function yg(){for(S(n.bitwiseOR),Mc();S(n.bitwiseOR);)Mc()}function tt(){yg()}function Ss(){Ut()}function _1(){oe(),p(n.colon)&&Ss()}function ya(){(p(n.plus)||p(n.minus))&&(I(),u.tokens[u.tokens.length-1].isType=true)}function _g(t){p(n.colon)&&ha(),Ei(false,t)}function vg(t,e,s){if(p(n.questionDot)&&Ae()===n.lessThan){if(e){s.stop=true;return}I(),_s(),A(n.parenL),os();return}else if(!e&&p(n.lessThan)){const i=u.snapshot();if(_s(),A(n.parenL),os(),u.error)u.restoreFromSnapshot(i);else return}oa(t,e,s)}function xg(){if(p(n.lessThan)){const t=u.snapshot();_s(),u.error&&u.restoreFromSnapshot(t)}}function kg(){if(p(n.name)&&u.contextualKeyword===g._interface){const t=de(0);return I(),da(),fe(t),true}else if(Z(g._enum))return v1(),true;return false}function wg(){return Z(g._enum)?(v1(),true):false}function Sg(t){if(t===g._declare){if(p(n._class)||p(n.name)||p(n._function)||p(n._var)||p(n._export)){const e=de(1);vo(),fe(e)}}else if(p(n.name)){if(t===g._interface){const e=de(1);da(),fe(e)}else if(t===g._type){const e=de(1);pa(),fe(e)}else if(t===g._opaque){const e=de(1);ma(false),fe(e)}}Ee()}function Eg(){return Z(g._type)||Z(g._interface)||Z(g._opaque)||Z(g._enum)}function Tg(){return p(n.name)&&(u.contextualKeyword===g._type||u.contextualKeyword===g._interface||u.contextualKeyword===g._opaque||u.contextualKeyword===g._enum)}function Ag(){if(Z(g._type)){const t=de(1);I(),p(n.braceL)?(va(),mi()):pa(),fe(t)}else if(Z(g._opaque)){const t=de(1);I(),ma(false),fe(t)}else if(Z(g._interface)){const t=de(1);I(),da(),fe(t)}else nt(true)}function Cg(){return p(n.star)||Z(g._type)&&Ae()===n.star}function Ig(){if(Le(g._type)){const t=de(2);ko(),fe(t)}else ko()}function Rg(t){if(t&&p(n.lessThan)&&_s(),Z(g._implements)){const e=de(0);I(),u.tokens[u.tokens.length-1].type=n._implements;do Pr(),p(n.lessThan)&&_s();while(S(n.comma));fe(e)}}function Pg(){p(n.lessThan)&&(xt(),p(n.parenL)||le())}function Lg(){const t=de(0);S(n.question),p(n.colon)&&Ss(),fe(t)}function Dg(){if(p(n._typeof)||Z(g._type)){const t=xi();(Z0(t)||t.type===n.braceL||t.type===n.star)&&I()}}function Ng(){const t=u.contextualKeyword===g._type||u.type===n._typeof;t?I():oe(),Z(g._as)&&!Yo(g._as)?(oe(),t&&!p(n.name)&&!(u.type&n.IS_KEYWORD)||oe()):(t&&(p(n.name)||u.type&n.IS_KEYWORD)&&oe(),Le(g._as)&&oe())}function Fg(){if(p(n.lessThan)){const t=de(0);xt(),fe(t)}}function Ug(){p(n.colon)&&Ss()}function Mg(){if(p(n.colon)){const t=u.noAnonFunctionType;u.noAnonFunctionType=true,Ss(),u.noAnonFunctionType=t}}function Og(t,e){if(p(n.lessThan)){const s=u.snapshot();let i=Pt(t,e);if(u.error)u.restoreFromSnapshot(s),u.type=n.typeParameterStart;else return i;const r=de(0);if(xt(),fe(r),i=Pt(t,e),i)return true;le()}return Pt(t,e)}function Bg(){if(p(n.colon)){const t=de(0),e=u.snapshot(),s=u.noAnonFunctionType;u.noAnonFunctionType=true,ha(),u.noAnonFunctionType=s,rt()&&le(),p(n.arrow)||le(),u.error&&u.restoreFromSnapshot(e),fe(t)}return S(n.arrow)}function Vg(t,e=false){if(u.tokens[u.tokens.length-1].contextualKeyword===g._async&&p(n.lessThan)){const s=u.snapshot();if($g()&&!u.error)return;u.restoreFromSnapshot(s)}l1(t,e)}function $g(){u.scopeDepth++;const t=u.tokens.length;return Gs(),yo()?(pi(t),true):false}function v1(){Re(g._enum),u.tokens[u.tokens.length-1].type=n._enum,oe(),jg()}function jg(){Le(g._of)&&I(),A(n.braceL),qg(),A(n.braceR)}function qg(){for(;!p(n.braceR)&&!u.error&&!S(n.ellipsis);)Hg(),p(n.braceR)||A(n.comma)}function Hg(){oe(),S(n.eq)&&I()}function Gg(){if(Lr(n.eof),u.scopes.push(new Ft(0,u.tokens.length,true)),u.scopeDepth!==0)throw new Error(`Invalid scope depth at end of file: ${u.scopeDepth}`);return new Pb(u.tokens,u.scopes)}function nt(t){_e&&kg()||(p(n.at)&&_a(),Wg(t))}function Wg(t){if(me&&u0())return;const e=u.type;switch(e){case n._break:case n._continue:zg();return;case n._debugger:Yg();return;case n._do:Kg();return;case n._for:Zg();return;case n._function:if(Ae()===n.dot)break;t||le(),eb();return;case n._class:t||le(),xs(true);return;case n._if:tb();return;case n._return:sb();return;case n._switch:ib();return;case n._throw:rb();return;case n._try:ob();return;case n._let:case n._const:t||le();case n._var:Vi(e!==n._var);return;case n._while:ab();return;case n.braceL:as();return;case n.semi:cb();return;case n._export:case n._import:{const r=Ae();if(r===n.parenL||r===n.dot)break;I(),e===n._import?I1():A1();return}case n.name:if(u.contextualKeyword===g._async){const r=u.start,o=u.snapshot();if(I(),p(n._function)&&!rt()){A(n._function),vs(r,true);return}else u.restoreFromSnapshot(o)}else if(u.contextualKeyword===g._using&&!Sl()&&Ae()===n.name){Vi(true);return}else if(x1()){Re(g._await),Vi(true);return}}const s=u.tokens.length;Me();let i=null;if(u.tokens.length===s+1){const r=u.tokens[u.tokens.length-1];r.type===n.name&&(i=r.contextualKeyword)}if(i==null){Ee();return}S(n.colon)?ub():lb(i)}function x1(){if(!Z(g._await))return false;const t=u.snapshot();return I(),!Z(g._using)||Xe()||(I(),!p(n.name)||Xe())?(u.restoreFromSnapshot(t),false):(u.restoreFromSnapshot(t),true)}function _a(){for(;p(n.at);)k1()}function k1(){if(I(),S(n.parenL))Me(),A(n.parenR);else{for(oe();S(n.dot);)oe();Xg()}}function Xg(){me?w0():w1()}function w1(){S(n.parenL)&&os()}function zg(){I(),Ct()||(oe(),Ee())}function Yg(){I(),Ee()}function Kg(){I(),nt(false),A(n._while),Rr(),S(n.semi)}function Zg(){u.scopeDepth++;const t=u.tokens.length;Jg();const e=u.tokens.length;u.scopes.push(new Ft(t,e,false)),u.scopeDepth--}function Qg(){return!(!Z(g._using)||Yo(g._of))}function Jg(){I();let t=false;if(Z(g._await)&&(t=true,I()),A(n.parenL),p(n.semi)){t&&le(),Gn();return}const e=x1();if(e||p(n._var)||p(n._let)||p(n._const)||Qg()){if(e&&Re(g._await),I(),S1(true,u.type!==n._var),p(n._in)||Z(g._of)){Oc(t);return}Gn();return}if(Me(true),p(n._in)||Z(g._of)){Oc(t);return}t&&le(),Gn()}function eb(){const t=u.start;I(),vs(t,true)}function tb(){I(),Rr(),nt(false),S(n._else)&&nt(false)}function sb(){I(),Ct()||(Me(),Ee())}function ib(){I(),Rr(),u.scopeDepth++;const t=u.tokens.length;for(A(n.braceL);!p(n.braceR)&&!u.error;)if(p(n._case)||p(n._default)){const s=p(n._case);I(),s&&Me(),A(n.colon)}else nt(true);I();const e=u.tokens.length;u.scopes.push(new Ft(t,e,false)),u.scopeDepth--}function rb(){I(),Me(),Ee()}function nb(){Ar(true),me&&qs()}function ob(){if(I(),as(),p(n._catch)){I();let t=null;if(p(n.parenL)&&(u.scopeDepth++,t=u.tokens.length,A(n.parenL),nb(),A(n.parenR)),as(),t!=null){const e=u.tokens.length;u.scopes.push(new Ft(t,e,false)),u.scopeDepth--}}S(n._finally)&&as()}function Vi(t){I(),S1(false,t),Ee()}function ab(){I(),Rr(),nt(false)}function cb(){I()}function ub(){nt(true)}function lb(t){me?h0(t):_e?Sg(t):Ee()}function as(t=false,e=0){const s=u.tokens.length;u.scopeDepth++,A(n.braceL),e&&(u.tokens[u.tokens.length-1].contextId=e),Lr(n.braceR),e&&(u.tokens[u.tokens.length-1].contextId=e);const i=u.tokens.length;u.scopes.push(new Ft(s,i,t)),u.scopeDepth--}function Lr(t){for(;!S(t)&&!u.error;)nt(true)}function Gn(){A(n.semi),p(n.semi)||Me(),A(n.semi),p(n.parenR)||Me(),A(n.parenR),nt(false)}function Oc(t){t?Le(g._of):I(),Me(),A(n.parenR),nt(false)}function S1(t,e){for(;;){if(hb(e),S(n.eq)){const s=u.tokens.length-1;Oe(t),u.tokens[s].rhsEndIndex=u.tokens.length}if(!S(n.comma))break}}function hb(t){Ar(t),me?g0():_e&&Ug()}function vs(t,e,s=false){p(n.star)&&I(),e&&!s&&!p(n.name)&&!p(n._yield)&&le();let i=null;p(n.name)&&(e||(i=u.tokens.length,u.scopeDepth++),hs(false));const r=u.tokens.length;u.scopeDepth++,Gs(),d1(t);const o=u.tokens.length;u.scopes.push(new Ft(r,o,true)),u.scopeDepth--,i!==null&&(u.scopes.push(new Ft(i,o,true)),u.scopeDepth--)}function Gs(t=false,e=0){me?m0():_e&&Fg(),A(n.parenL),e&&(u.tokens[u.tokens.length-1].contextId=e),Jo(n.parenR,false,false,t,e),e&&(u.tokens[u.tokens.length-1].contextId=e)}function xs(t,e=false){const s=li();I(),u.tokens[u.tokens.length-1].contextId=s,u.tokens[u.tokens.length-1].isExpression=!t;let i=null;t||(i=u.tokens.length,u.scopeDepth++),mb(t,e),gb();const r=u.tokens.length;if(fb(s),!u.error&&(u.tokens[r].contextId=s,u.tokens[u.tokens.length-1].contextId=s,i!==null)){const o=u.tokens.length;u.scopes.push(new Ft(i,o,false)),u.scopeDepth--}}function E1(){return p(n.eq)||p(n.semi)||p(n.braceR)||p(n.bang)||p(n.colon)}function T1(){return p(n.parenL)||p(n.lessThan)}function fb(t){for(A(n.braceL);!S(n.braceR)&&!u.error;){if(S(n.semi))continue;if(p(n.at)){k1();continue}const e=u.start;db(e,t)}}function db(t,e){me&&ea([g._declare,g._public,g._protected,g._private,g._override]);let s=false;if(p(n.name)&&u.contextualKeyword===g._static){if(oe(),T1()){Js(t,false);return}else if(E1()){$i();return}if(u.tokens[u.tokens.length-1].type=n._static,s=true,p(n.braceL)){u.tokens[u.tokens.length-1].contextId=e,as();return}}pb(t,s,e)}function pb(t,e,s){if(me&&l0(e))return;if(S(n.star)){Ys(s),Js(t,false);return}Ys(s);let i=false;const r=u.tokens[u.tokens.length-1];r.contextualKeyword===g._constructor&&(i=true),Bc(),T1()?Js(t,i):E1()?$i():r.contextualKeyword===g._async&&!Ct()?(u.tokens[u.tokens.length-1].type=n._async,p(n.star)&&I(),Ys(s),Bc(),Js(t,false)):(r.contextualKeyword===g._get||r.contextualKeyword===g._set)&&!(Ct()&&p(n.star))?(r.contextualKeyword===g._get?u.tokens[u.tokens.length-1].type=n._get:u.tokens[u.tokens.length-1].type=n._set,Ys(s),Js(t,false)):r.contextualKeyword===g._accessor&&!Ct()?(Ys(s),$i()):Ct()?$i():le()}function Js(t,e){me?ws():_e&&p(n.lessThan)&&xt(),_o(t,e)}function Ys(t){di(t)}function Bc(){if(me){const t=de(0);S(n.question),fe(t)}}function $i(){if(me?(Il(n.bang),qs()):_e&&p(n.colon)&&Ss(),p(n.eq)){const t=u.tokens.length;I(),Oe(),u.tokens[t].rhsEndIndex=u.tokens.length}Ee()}function mb(t,e=false){me&&(!t||e)&&Z(g._implements)||(p(n.name)&&hs(true),me?ws():_e&&p(n.lessThan)&&xt())}function gb(){let t=false;S(n._extends)?(u1(),t=true):t=false,me?d0(t):_e&&Rg(t)}function A1(){const t=u.tokens.length-1;me&&n0()||(vb()?xb():_b()?(oe(),p(n.comma)&&Ae()===n.star?(A(n.comma),A(n.star),Re(g._as),oe()):C1(),mi()):S(n._default)?bb():wb()?yb():(va(),mi()),u.tokens[t].rhsEndIndex=u.tokens.length)}function bb(){if(me&&c0()||_e&&wg())return;const t=u.start;S(n._function)?vs(t,true,true):Z(g._async)&&Ae()===n._function?(Le(g._async),S(n._function),vs(t,true,true)):p(n._class)?xs(true,true):p(n.at)?(_a(),xs(true,true)):(Oe(),Ee())}function yb(){me?f0():_e?Ag():nt(true)}function _b(){if(me&&i1())return false;if(_e&&Tg())return false;if(p(n.name))return u.contextualKeyword!==g._async;if(!p(n._default))return false;const t=Ko(),e=xi(),s=e.type===n.name&&e.contextualKeyword===g._from;if(e.type===n.comma)return true;if(s){const i=q.charCodeAt(Rl(t+4));return i===b.quotationMark||i===b.apostrophe}return false}function C1(){S(n.comma)&&va()}function mi(){Le(g._from)&&(Yt(),R1()),Ee()}function vb(){return _e?Cg():p(n.star)}function xb(){_e?Ig():ko()}function ko(){A(n.star),Z(g._as)?kb():mi()}function kb(){I(),u.tokens[u.tokens.length-1].type=n._as,oe(),C1(),mi()}function wb(){return me&&i1()||_e&&Eg()||u.type===n._var||u.type===n._const||u.type===n._let||u.type===n._function||u.type===n._class||Z(g._async)||p(n.at)}function va(){let t=true;for(A(n.braceL);!S(n.braceR)&&!u.error;){if(t)t=false;else if(A(n.comma),S(n.braceR))break;Sb()}}function Sb(){if(me){a0();return}oe(),u.tokens[u.tokens.length-1].identifierRole=ie.ExportAccess,Le(g._as)&&oe()}function Eb(){const t=u.snapshot();return Re(g._module),Le(g._from)?Z(g._from)?(u.restoreFromSnapshot(t),true):(u.restoreFromSnapshot(t),false):p(n.comma)?(u.restoreFromSnapshot(t),false):(u.restoreFromSnapshot(t),true)}function Tb(){Z(g._module)&&Eb()&&I()}function I1(){if(me&&p(n.name)&&Ae()===n.eq){go();return}if(me&&Z(g._type)){const t=xi();if(t.type===n.name&&t.contextualKeyword!==g._from){if(Re(g._type),Ae()===n.eq){go();return}}else(t.type===n.star||t.type===n.braceL)&&Re(g._type)}p(n.string)||(Tb(),Cb(),Re(g._from)),Yt(),R1(),Ee()}function Ab(){return p(n.name)}function Vc(){sr()}function Cb(){_e&&Dg();let t=true;if(!(Ab()&&(Vc(),!S(n.comma)))){if(p(n.star)){I(),Re(g._as),Vc();return}for(A(n.braceL);!S(n.braceR)&&!u.error;){if(t)t=false;else if(S(n.colon)&&le("ES2015 named imports do not destructure. Use another statement for destructuring after the import."),A(n.comma),S(n.braceR))break;Ib()}}}function Ib(){if(me){o0();return}if(_e){Ng();return}sr(),Z(g._as)&&(u.tokens[u.tokens.length-1].identifierRole=ie.ImportAccess,I(),sr())}function R1(){(p(n._with)||Z(g._assert)&&!Xe())&&(I(),la(false,false))}function Rb(){return u.pos===0&&q.charCodeAt(0)===b.numberSign&&q.charCodeAt(1)===b.exclamationMark&&Dl(2),Ll(),Gg()}class Pb{constructor(e,s){this.tokens=e,this.scopes=s}}function Lb(t,e,s,i){if(i&&s)throw new Error("Cannot combine flow and typescript plugins.");tp(t,e,s,i);const r=Rb();if(u.error)throw Qd(u.error);return r}function Db(t){let e=t.currentIndex(),s=0;const i=t.currentToken();do{const r=t.tokens[e];if(r.isOptionalChainStart&&s++,r.isOptionalChainEnd&&s--,s+=r.numNullishCoalesceStarts,s-=r.numNullishCoalesceEnds,r.contextualKeyword===g._await&&r.identifierRole==null&&r.scopeDepth===i.scopeDepth)return true;e+=1}while(s>0&&e<t.tokens.length);return false}class ti{__init(){this.resultCode=""}__init2(){this.resultMappings=new Array(this.tokens.length)}__init3(){this.tokenIndex=0}constructor(e,s,i,r,o){this.code=e,this.tokens=s,this.isFlowEnabled=i,this.disableESTransforms=r,this.helperManager=o,ti.prototype.__init.call(this),ti.prototype.__init2.call(this),ti.prototype.__init3.call(this)}snapshot(){return{resultCode:this.resultCode,tokenIndex:this.tokenIndex}}restoreToSnapshot(e){this.resultCode=e.resultCode,this.tokenIndex=e.tokenIndex}dangerouslyGetAndRemoveCodeSinceSnapshot(e){const s=this.resultCode.slice(e.resultCode.length);return this.resultCode=e.resultCode,s}reset(){this.resultCode="",this.resultMappings=new Array(this.tokens.length),this.tokenIndex=0}matchesContextualAtIndex(e,s){return this.matches1AtIndex(e,n.name)&&this.tokens[e].contextualKeyword===s}identifierNameAtIndex(e){return this.identifierNameForToken(this.tokens[e])}identifierNameAtRelativeIndex(e){return this.identifierNameForToken(this.tokenAtRelativeIndex(e))}identifierName(){return this.identifierNameForToken(this.currentToken())}identifierNameForToken(e){return this.code.slice(e.start,e.end)}rawCodeForToken(e){return this.code.slice(e.start,e.end)}stringValueAtIndex(e){return this.stringValueForToken(this.tokens[e])}stringValue(){return this.stringValueForToken(this.currentToken())}stringValueForToken(e){return this.code.slice(e.start+1,e.end-1)}matches1AtIndex(e,s){return this.tokens[e].type===s}matches2AtIndex(e,s,i){return this.tokens[e].type===s&&this.tokens[e+1].type===i}matches3AtIndex(e,s,i,r){return this.tokens[e].type===s&&this.tokens[e+1].type===i&&this.tokens[e+2].type===r}matches1(e){return this.tokens[this.tokenIndex].type===e}matches2(e,s){return this.tokens[this.tokenIndex].type===e&&this.tokens[this.tokenIndex+1].type===s}matches3(e,s,i){return this.tokens[this.tokenIndex].type===e&&this.tokens[this.tokenIndex+1].type===s&&this.tokens[this.tokenIndex+2].type===i}matches4(e,s,i,r){return this.tokens[this.tokenIndex].type===e&&this.tokens[this.tokenIndex+1].type===s&&this.tokens[this.tokenIndex+2].type===i&&this.tokens[this.tokenIndex+3].type===r}matches5(e,s,i,r,o){return this.tokens[this.tokenIndex].type===e&&this.tokens[this.tokenIndex+1].type===s&&this.tokens[this.tokenIndex+2].type===i&&this.tokens[this.tokenIndex+3].type===r&&this.tokens[this.tokenIndex+4].type===o}matchesContextual(e){return this.matchesContextualAtIndex(this.tokenIndex,e)}matchesContextIdAndLabel(e,s){return this.matches1(e)&&this.currentToken().contextId===s}previousWhitespaceAndComments(){let e=this.code.slice(this.tokenIndex>0?this.tokens[this.tokenIndex-1].end:0,this.tokenIndex<this.tokens.length?this.tokens[this.tokenIndex].start:this.code.length);return this.isFlowEnabled&&(e=e.replace(/@flow/g,"")),e}replaceToken(e){this.resultCode+=this.previousWhitespaceAndComments(),this.appendTokenPrefix(),this.resultMappings[this.tokenIndex]=this.resultCode.length,this.resultCode+=e,this.appendTokenSuffix(),this.tokenIndex++}replaceTokenTrimmingLeftWhitespace(e){this.resultCode+=this.previousWhitespaceAndComments().replace(/[^\r\n]/g,""),this.appendTokenPrefix(),this.resultMappings[this.tokenIndex]=this.resultCode.length,this.resultCode+=e,this.appendTokenSuffix(),this.tokenIndex++}removeInitialToken(){this.replaceToken("")}removeToken(){this.replaceTokenTrimmingLeftWhitespace("")}removeBalancedCode(){let e=0;for(;!this.isAtEnd();){if(this.matches1(n.braceL))e++;else if(this.matches1(n.braceR)){if(e===0)return;e--}this.removeToken()}}copyExpectedToken(e){if(this.tokens[this.tokenIndex].type!==e)throw new Error(`Expected token ${e}`);this.copyToken()}copyToken(){this.resultCode+=this.previousWhitespaceAndComments(),this.appendTokenPrefix(),this.resultMappings[this.tokenIndex]=this.resultCode.length,this.resultCode+=this.code.slice(this.tokens[this.tokenIndex].start,this.tokens[this.tokenIndex].end),this.appendTokenSuffix(),this.tokenIndex++}copyTokenWithPrefix(e){this.resultCode+=this.previousWhitespaceAndComments(),this.appendTokenPrefix(),this.resultCode+=e,this.resultMappings[this.tokenIndex]=this.resultCode.length,this.resultCode+=this.code.slice(this.tokens[this.tokenIndex].start,this.tokens[this.tokenIndex].end),this.appendTokenSuffix(),this.tokenIndex++}appendTokenPrefix(){const e=this.currentToken();if((e.numNullishCoalesceStarts||e.isOptionalChainStart)&&(e.isAsyncOperation=Db(this)),!this.disableESTransforms){if(e.numNullishCoalesceStarts)for(let s=0;s<e.numNullishCoalesceStarts;s++)e.isAsyncOperation?(this.resultCode+="await ",this.resultCode+=this.helperManager.getHelperName("asyncNullishCoalesce")):this.resultCode+=this.helperManager.getHelperName("nullishCoalesce"),this.resultCode+="(";e.isOptionalChainStart&&(e.isAsyncOperation&&(this.resultCode+="await "),this.tokenIndex>0&&this.tokenAtRelativeIndex(-1).type===n._delete?e.isAsyncOperation?this.resultCode+=this.helperManager.getHelperName("asyncOptionalChainDelete"):this.resultCode+=this.helperManager.getHelperName("optionalChainDelete"):e.isAsyncOperation?this.resultCode+=this.helperManager.getHelperName("asyncOptionalChain"):this.resultCode+=this.helperManager.getHelperName("optionalChain"),this.resultCode+="([")}}appendTokenSuffix(){const e=this.currentToken();if(e.isOptionalChainEnd&&!this.disableESTransforms&&(this.resultCode+="])"),e.numNullishCoalesceEnds&&!this.disableESTransforms)for(let s=0;s<e.numNullishCoalesceEnds;s++)this.resultCode+="))"}appendCode(e){this.resultCode+=e}currentToken(){return this.tokens[this.tokenIndex]}currentTokenCode(){const e=this.currentToken();return this.code.slice(e.start,e.end)}tokenAtRelativeIndex(e){return this.tokens[this.tokenIndex+e]}currentIndex(){return this.tokenIndex}nextToken(){if(this.tokenIndex===this.tokens.length)throw new Error("Unexpectedly reached end of input.");this.tokenIndex++}previousToken(){this.tokenIndex--}finish(){if(this.tokenIndex!==this.tokens.length)throw new Error("Tried to finish processing tokens before reaching the end.");return this.resultCode+=this.previousWhitespaceAndComments(),{code:this.resultCode,mappings:this.resultMappings}}isAtEnd(){return this.tokenIndex===this.tokens.length}}function Nb(t,e,s,i){const r=e.snapshot(),o=Fb(e);let a=[];const c=[],l=[];let h=null;const d=[],m=[],_=e.currentToken().contextId;if(_==null)throw new Error("Expected non-null class context ID on class open-brace.");for(e.nextToken();!e.matchesContextIdAndLabel(n.braceR,_);)if(e.matchesContextual(g._constructor)&&!e.currentToken().isType)({constructorInitializerStatements:a,constructorInsertPos:h}=$c(e));else if(e.matches1(n.semi))i||m.push({start:e.currentIndex(),end:e.currentIndex()+1}),e.nextToken();else if(e.currentToken().isType)e.nextToken();else{const x=e.currentIndex();let E=false,N=false,F=false;for(;cr(e.currentToken());)e.matches1(n._static)&&(E=true),e.matches1(n.hash)&&(N=true),(e.matches1(n._declare)||e.matches1(n._abstract))&&(F=true),e.nextToken();if(E&&e.matches1(n.braceL)){Wn(e,_);continue}if(N){Wn(e,_);continue}if(e.matchesContextual(g._constructor)&&!e.currentToken().isType){({constructorInitializerStatements:a,constructorInsertPos:h}=$c(e));continue}const U=e.currentIndex();if(Ub(e),e.matches1(n.lessThan)||e.matches1(n.parenL)){Wn(e,_);continue}for(;e.currentToken().isType;)e.nextToken();if(e.matches1(n.eq)){const P=e.currentIndex(),X=e.currentToken().rhsEndIndex;if(X==null)throw new Error("Expected rhsEndIndex on class field assignment.");for(e.nextToken();e.currentIndex()<X;)t.processToken();let $;E?($=s.claimFreeName("__initStatic"),l.push($)):($=s.claimFreeName("__init"),c.push($)),d.push({initializerName:$,equalsIndex:P,start:U,end:e.currentIndex()})}else(!i||F)&&m.push({start:x,end:e.currentIndex()})}return e.restoreToSnapshot(r),i?{headerInfo:o,constructorInitializerStatements:a,instanceInitializerNames:[],staticInitializerNames:[],constructorInsertPos:h,fields:[],rangesToRemove:m}:{headerInfo:o,constructorInitializerStatements:a,instanceInitializerNames:c,staticInitializerNames:l,constructorInsertPos:h,fields:d,rangesToRemove:m}}function Wn(t,e){for(t.nextToken();t.currentToken().contextId!==e;)t.nextToken();for(;cr(t.tokenAtRelativeIndex(-1));)t.previousToken()}function Fb(t){const e=t.currentToken(),s=e.contextId;if(s==null)throw new Error("Expected context ID on class token.");const i=e.isExpression;if(i==null)throw new Error("Expected isExpression on class token.");let r=null,o=false;for(t.nextToken(),t.matches1(n.name)&&(r=t.identifierName());!t.matchesContextIdAndLabel(n.braceL,s);)t.matches1(n._extends)&&!t.currentToken().isType&&(o=true),t.nextToken();return{isExpression:i,className:r,hasSuperclass:o}}function $c(t){const e=[];t.nextToken();const s=t.currentToken().contextId;if(s==null)throw new Error("Expected context ID on open-paren starting constructor params.");for(;!t.matchesContextIdAndLabel(n.parenR,s);)if(t.currentToken().contextId===s){if(t.nextToken(),cr(t.currentToken())){for(t.nextToken();cr(t.currentToken());)t.nextToken();const o=t.currentToken();if(o.type!==n.name)throw new Error("Expected identifier after access modifiers in constructor arg.");const a=t.identifierNameForToken(o);e.push(`this.${a} = ${a}`)}}else t.nextToken();for(t.nextToken();t.currentToken().isType;)t.nextToken();let i=t.currentIndex(),r=false;for(;!t.matchesContextIdAndLabel(n.braceR,s);){if(!r&&t.matches2(n._super,n.parenL)){t.nextToken();const o=t.currentToken().contextId;if(o==null)throw new Error("Expected a context ID on the super call");for(;!t.matchesContextIdAndLabel(n.parenR,o);)t.nextToken();i=t.currentIndex(),r=true}t.nextToken()}return t.nextToken(),{constructorInitializerStatements:e,constructorInsertPos:i}}function cr(t){return[n._async,n._get,n._set,n.plus,n.minus,n._readonly,n._static,n._public,n._private,n._protected,n._override,n._abstract,n.star,n._declare,n.hash].includes(t.type)}function Ub(t){if(t.matches1(n.bracketL)){const s=t.currentToken().contextId;if(s==null)throw new Error("Expected class context ID on computed name open bracket.");for(;!t.matchesContextIdAndLabel(n.bracketR,s);)t.nextToken();t.nextToken()}else t.nextToken()}function P1(t){if(t.removeInitialToken(),t.removeToken(),t.removeToken(),t.removeToken(),t.matches1(n.parenL))t.removeToken(),t.removeToken(),t.removeToken();else for(;t.matches1(n.dot);)t.removeToken(),t.removeToken()}const L1={typeDeclarations:new Set,valueDeclarations:new Set};function D1(t){const e=new Set,s=new Set;for(let i=0;i<t.tokens.length;i++){const r=t.tokens[i];r.type===n.name&&Cl(r)&&(r.isType?e.add(t.identifierNameForToken(r)):s.add(t.identifierNameForToken(r)))}return{typeDeclarations:e,valueDeclarations:s}}function N1(t){let e=t.currentIndex();for(;!t.matches1AtIndex(e,n.braceR);)e++;return t.matchesContextualAtIndex(e+1,g._from)&&t.matches1AtIndex(e+2,n.string)}function bs(t){(t.matches2(n._with,n.braceL)||t.matches2(n.name,n.braceL)&&t.matchesContextual(g._assert))&&(t.removeToken(),t.removeToken(),t.removeBalancedCode(),t.removeToken())}function F1(t,e,s,i){if(!t||e)return false;const r=s.currentToken();if(r.rhsEndIndex==null)throw new Error("Expected non-null rhsEndIndex on export token.");const o=r.rhsEndIndex-s.currentIndex();if(o!==3&&!(o===4&&s.matches1AtIndex(r.rhsEndIndex-1,n.semi)))return false;const a=s.tokenAtRelativeIndex(2);if(a.type!==n.name)return false;const c=s.identifierNameForToken(a);return i.typeDeclarations.has(c)&&!i.valueDeclarations.has(c)}class si extends vt{__init(){this.hadExport=false}__init2(){this.hadNamedExport=false}__init3(){this.hadDefaultExport=false}constructor(e,s,i,r,o,a,c,l,h,d,m,_){super(),this.rootTransformer=e,this.tokens=s,this.importProcessor=i,this.nameManager=r,this.helperManager=o,this.reactHotLoaderTransformer=a,this.enableLegacyBabel5ModuleInterop=c,this.enableLegacyTypeScriptModuleInterop=l,this.isTypeScriptTransformEnabled=h,this.isFlowTransformEnabled=d,this.preserveDynamicImport=m,this.keepUnusedImports=_,si.prototype.__init.call(this),si.prototype.__init2.call(this),si.prototype.__init3.call(this),this.declarationInfo=h?D1(s):L1}getPrefixCode(){let e="";return this.hadExport&&(e+='Object.defineProperty(exports, "__esModule", {value: true});'),e}getSuffixCode(){return this.enableLegacyBabel5ModuleInterop&&this.hadDefaultExport&&!this.hadNamedExport?`
591
591
  module.exports = exports.default;
592
- `:""}process(){return this.tokens.matches3(n._import,n.name,n.eq)?this.processImportEquals():this.tokens.matches1(n._import)?(this.processImport(),true):this.tokens.matches2(n._export,n.eq)?(this.tokens.replaceToken("module.exports"),true):this.tokens.matches1(n._export)&&!this.tokens.currentToken().isType?(this.hadExport=true,this.processExport()):this.tokens.matches2(n.name,n.postIncDec)&&this.processPostIncDec()?true:this.tokens.matches1(n.name)||this.tokens.matches1(n.jsxName)?this.processIdentifier():this.tokens.matches1(n.eq)?this.processAssignment():this.tokens.matches1(n.assign)?this.processComplexAssignment():this.tokens.matches1(n.preIncDec)?this.processPreIncDec():false}processImportEquals(){const e=this.tokens.identifierNameAtIndex(this.tokens.currentIndex()+1);return this.importProcessor.shouldAutomaticallyElideImportedName(e)?P1(this.tokens):this.tokens.replaceToken("const"),true}processImport(){if(this.tokens.matches2(n._import,n.parenL)){if(this.preserveDynamicImport){this.tokens.copyToken();return}const s=this.enableLegacyTypeScriptModuleInterop?"":`${this.helperManager.getHelperName("interopRequireWildcard")}(`;this.tokens.replaceToken(`Promise.resolve().then(() => ${s}require`);const i=this.tokens.currentToken().contextId;if(i==null)throw new Error("Expected context ID on dynamic import invocation.");for(this.tokens.copyToken();!this.tokens.matchesContextIdAndLabel(n.parenR,i);)this.rootTransformer.processToken();this.tokens.replaceToken(s?")))":"))");return}if(this.removeImportAndDetectIfShouldElide())this.tokens.removeToken();else{const s=this.tokens.stringValue();this.tokens.replaceTokenTrimmingLeftWhitespace(this.importProcessor.claimImportCode(s)),this.tokens.appendCode(this.importProcessor.claimImportCode(s))}bs(this.tokens),this.tokens.matches1(n.semi)&&this.tokens.removeToken()}removeImportAndDetectIfShouldElide(){if(this.tokens.removeInitialToken(),this.tokens.matchesContextual(g._type)&&!this.tokens.matches1AtIndex(this.tokens.currentIndex()+1,n.comma)&&!this.tokens.matchesContextualAtIndex(this.tokens.currentIndex()+1,g._from))return this.removeRemainingImport(),true;if(this.tokens.matches1(n.name)||this.tokens.matches1(n.star))return this.removeRemainingImport(),false;if(this.tokens.matches1(n.string))return false;let e=false,s=false;for(;!this.tokens.matches1(n.string);)(!e&&this.tokens.matches1(n.braceL)||this.tokens.matches1(n.comma))&&(this.tokens.removeToken(),this.tokens.matches1(n.braceR)||(s=true),(this.tokens.matches2(n.name,n.comma)||this.tokens.matches2(n.name,n.braceR)||this.tokens.matches4(n.name,n.name,n.name,n.comma)||this.tokens.matches4(n.name,n.name,n.name,n.braceR))&&(e=true)),this.tokens.removeToken();return this.keepUnusedImports?false:this.isTypeScriptTransformEnabled?!e:this.isFlowTransformEnabled?s&&!e:false}removeRemainingImport(){for(;!this.tokens.matches1(n.string);)this.tokens.removeToken()}processIdentifier(){const e=this.tokens.currentToken();if(e.shadowsGlobal)return false;if(e.identifierRole===ie.ObjectShorthand)return this.processObjectShorthand();if(e.identifierRole!==ie.Access)return false;const s=this.importProcessor.getIdentifierReplacement(this.tokens.identifierNameForToken(e));if(!s)return false;let i=this.tokens.currentIndex()+1;for(;i<this.tokens.tokens.length&&this.tokens.tokens[i].type===n.parenR;)i++;return this.tokens.tokens[i].type===n.parenL?this.tokens.tokenAtRelativeIndex(1).type===n.parenL&&this.tokens.tokenAtRelativeIndex(-1).type!==n._new?(this.tokens.replaceToken(`${s}.call(void 0, `),this.tokens.removeToken(),this.rootTransformer.processBalancedCode(),this.tokens.copyExpectedToken(n.parenR)):this.tokens.replaceToken(`(0, ${s})`):this.tokens.replaceToken(s),true}processObjectShorthand(){const e=this.tokens.identifierName(),s=this.importProcessor.getIdentifierReplacement(e);return s?(this.tokens.replaceToken(`${e}: ${s}`),true):false}processExport(){if(this.tokens.matches2(n._export,n._enum)||this.tokens.matches3(n._export,n._const,n._enum))return this.hadNamedExport=true,false;if(this.tokens.matches2(n._export,n._default))return this.tokens.matches3(n._export,n._default,n._enum)?(this.hadDefaultExport=true,false):(this.processExportDefault(),true);if(this.tokens.matches2(n._export,n.braceL))return this.processExportBindings(),true;if(this.tokens.matches2(n._export,n.name)&&this.tokens.matchesContextualAtIndex(this.tokens.currentIndex()+1,g._type)){if(this.tokens.removeInitialToken(),this.tokens.removeToken(),this.tokens.matches1(n.braceL)){for(;!this.tokens.matches1(n.braceR);)this.tokens.removeToken();this.tokens.removeToken()}else this.tokens.removeToken(),this.tokens.matches1(n._as)&&(this.tokens.removeToken(),this.tokens.removeToken());return this.tokens.matchesContextual(g._from)&&this.tokens.matches1AtIndex(this.tokens.currentIndex()+1,n.string)&&(this.tokens.removeToken(),this.tokens.removeToken(),bs(this.tokens)),true}if(this.hadNamedExport=true,this.tokens.matches2(n._export,n._var)||this.tokens.matches2(n._export,n._let)||this.tokens.matches2(n._export,n._const))return this.processExportVar(),true;if(this.tokens.matches2(n._export,n._function)||this.tokens.matches3(n._export,n.name,n._function))return this.processExportFunction(),true;if(this.tokens.matches2(n._export,n._class)||this.tokens.matches3(n._export,n._abstract,n._class)||this.tokens.matches2(n._export,n.at))return this.processExportClass(),true;if(this.tokens.matches2(n._export,n.star))return this.processExportStar(),true;throw new Error("Unrecognized export syntax.")}processAssignment(){const e=this.tokens.currentIndex(),s=this.tokens.tokens[e-1];if(s.isType||s.type!==n.name||s.shadowsGlobal||e>=2&&this.tokens.matches1AtIndex(e-2,n.dot)||e>=2&&[n._var,n._let,n._const].includes(this.tokens.tokens[e-2].type))return false;const i=this.importProcessor.resolveExportBinding(this.tokens.identifierNameForToken(s));return i?(this.tokens.copyToken(),this.tokens.appendCode(` ${i} =`),true):false}processComplexAssignment(){const e=this.tokens.currentIndex(),s=this.tokens.tokens[e-1];if(s.type!==n.name||s.shadowsGlobal||e>=2&&this.tokens.matches1AtIndex(e-2,n.dot))return false;const i=this.importProcessor.resolveExportBinding(this.tokens.identifierNameForToken(s));return i?(this.tokens.appendCode(` = ${i}`),this.tokens.copyToken(),true):false}processPreIncDec(){const e=this.tokens.currentIndex(),s=this.tokens.tokens[e+1];if(s.type!==n.name||s.shadowsGlobal||e+2<this.tokens.tokens.length&&(this.tokens.matches1AtIndex(e+2,n.dot)||this.tokens.matches1AtIndex(e+2,n.bracketL)||this.tokens.matches1AtIndex(e+2,n.parenL)))return false;const i=this.tokens.identifierNameForToken(s),r=this.importProcessor.resolveExportBinding(i);return r?(this.tokens.appendCode(`${r} = `),this.tokens.copyToken(),true):false}processPostIncDec(){const e=this.tokens.currentIndex(),s=this.tokens.tokens[e],i=this.tokens.tokens[e+1];if(s.type!==n.name||s.shadowsGlobal||e>=1&&this.tokens.matches1AtIndex(e-1,n.dot))return false;const r=this.tokens.identifierNameForToken(s),a=this.importProcessor.resolveExportBinding(r);if(!a)return false;const o=this.tokens.rawCodeForToken(i),c=this.importProcessor.getIdentifierReplacement(r)||r;if(o==="++")this.tokens.replaceToken(`(${c} = ${a} = ${c} + 1, ${c} - 1)`);else if(o==="--")this.tokens.replaceToken(`(${c} = ${a} = ${c} - 1, ${c} + 1)`);else throw new Error(`Unexpected operator: ${o}`);return this.tokens.removeToken(),true}processExportDefault(){let e=true;if(this.tokens.matches4(n._export,n._default,n._function,n.name)||this.tokens.matches5(n._export,n._default,n.name,n._function,n.name)&&this.tokens.matchesContextualAtIndex(this.tokens.currentIndex()+2,g._async)){this.tokens.removeInitialToken(),this.tokens.removeToken();const s=this.processNamedFunction();this.tokens.appendCode(` exports.default = ${s};`)}else if(this.tokens.matches4(n._export,n._default,n._class,n.name)||this.tokens.matches5(n._export,n._default,n._abstract,n._class,n.name)||this.tokens.matches3(n._export,n._default,n.at)){this.tokens.removeInitialToken(),this.tokens.removeToken(),this.copyDecorators(),this.tokens.matches1(n._abstract)&&this.tokens.removeToken();const s=this.rootTransformer.processNamedClass();this.tokens.appendCode(` exports.default = ${s};`)}else if(F1(this.isTypeScriptTransformEnabled,this.keepUnusedImports,this.tokens,this.declarationInfo))e=false,this.tokens.removeInitialToken(),this.tokens.removeToken(),this.tokens.removeToken();else if(this.reactHotLoaderTransformer){const s=this.nameManager.claimFreeName("_default");this.tokens.replaceToken(`let ${s}; exports.`),this.tokens.copyToken(),this.tokens.appendCode(` = ${s} =`),this.reactHotLoaderTransformer.setExtractedDefaultExportName(s)}else this.tokens.replaceToken("exports."),this.tokens.copyToken(),this.tokens.appendCode(" =");e&&(this.hadDefaultExport=true)}copyDecorators(){for(;this.tokens.matches1(n.at);)if(this.tokens.copyToken(),this.tokens.matches1(n.parenL))this.tokens.copyExpectedToken(n.parenL),this.rootTransformer.processBalancedCode(),this.tokens.copyExpectedToken(n.parenR);else{for(this.tokens.copyExpectedToken(n.name);this.tokens.matches1(n.dot);)this.tokens.copyExpectedToken(n.dot),this.tokens.copyExpectedToken(n.name);this.tokens.matches1(n.parenL)&&(this.tokens.copyExpectedToken(n.parenL),this.rootTransformer.processBalancedCode(),this.tokens.copyExpectedToken(n.parenR))}}processExportVar(){this.isSimpleExportVar()?this.processSimpleExportVar():this.processComplexExportVar()}isSimpleExportVar(){let e=this.tokens.currentIndex();if(e++,e++,!this.tokens.matches1AtIndex(e,n.name))return false;for(e++;e<this.tokens.tokens.length&&this.tokens.tokens[e].isType;)e++;return!!this.tokens.matches1AtIndex(e,n.eq)}processSimpleExportVar(){this.tokens.removeInitialToken(),this.tokens.copyToken();const e=this.tokens.identifierName();for(;!this.tokens.matches1(n.eq);)this.rootTransformer.processToken();const s=this.tokens.currentToken().rhsEndIndex;if(s==null)throw new Error("Expected = token with an end index.");for(;this.tokens.currentIndex()<s;)this.rootTransformer.processToken();this.tokens.appendCode(`; exports.${e} = ${e}`)}processComplexExportVar(){this.tokens.removeInitialToken(),this.tokens.removeToken();const e=this.tokens.matches1(n.braceL);e&&this.tokens.appendCode("(");let s=0;for(;;)if(this.tokens.matches1(n.braceL)||this.tokens.matches1(n.dollarBraceL)||this.tokens.matches1(n.bracketL))s++,this.tokens.copyToken();else if(this.tokens.matches1(n.braceR)||this.tokens.matches1(n.bracketR))s--,this.tokens.copyToken();else{if(s===0&&!this.tokens.matches1(n.name)&&!this.tokens.currentToken().isType)break;if(this.tokens.matches1(n.eq)){const i=this.tokens.currentToken().rhsEndIndex;if(i==null)throw new Error("Expected = token with an end index.");for(;this.tokens.currentIndex()<i;)this.rootTransformer.processToken()}else{const i=this.tokens.currentToken();if(Al(i)){const r=this.tokens.identifierName();let a=this.importProcessor.getIdentifierReplacement(r);if(a===null)throw new Error(`Expected a replacement for ${r} in \`export var\` syntax.`);op(i)&&(a=`${r}: ${a}`),this.tokens.replaceToken(a)}else this.rootTransformer.processToken()}}if(e){const i=this.tokens.currentToken().rhsEndIndex;if(i==null)throw new Error("Expected = token with an end index.");for(;this.tokens.currentIndex()<i;)this.rootTransformer.processToken();this.tokens.appendCode(")")}}processExportFunction(){this.tokens.replaceToken("");const e=this.processNamedFunction();this.tokens.appendCode(` exports.${e} = ${e};`)}processNamedFunction(){if(this.tokens.matches1(n._function))this.tokens.copyToken();else if(this.tokens.matches2(n.name,n._function)){if(!this.tokens.matchesContextual(g._async))throw new Error("Expected async keyword in function export.");this.tokens.copyToken(),this.tokens.copyToken()}if(this.tokens.matches1(n.star)&&this.tokens.copyToken(),!this.tokens.matches1(n.name))throw new Error("Expected identifier for exported function name.");const e=this.tokens.identifierName();if(this.tokens.copyToken(),this.tokens.currentToken().isType)for(this.tokens.removeInitialToken();this.tokens.currentToken().isType;)this.tokens.removeToken();return this.tokens.copyExpectedToken(n.parenL),this.rootTransformer.processBalancedCode(),this.tokens.copyExpectedToken(n.parenR),this.rootTransformer.processPossibleTypeRange(),this.tokens.copyExpectedToken(n.braceL),this.rootTransformer.processBalancedCode(),this.tokens.copyExpectedToken(n.braceR),e}processExportClass(){this.tokens.removeInitialToken(),this.copyDecorators(),this.tokens.matches1(n._abstract)&&this.tokens.removeToken();const e=this.rootTransformer.processNamedClass();this.tokens.appendCode(` exports.${e} = ${e};`)}processExportBindings(){this.tokens.removeInitialToken(),this.tokens.removeToken();const e=N1(this.tokens),s=[];for(;;){if(this.tokens.matches1(n.braceR)){this.tokens.removeToken();break}const i=hi(this.tokens);for(;this.tokens.currentIndex()<i.endIndex;)this.tokens.removeToken();if(!(i.isType||!e&&this.shouldElideExportedIdentifier(i.leftName))){const a=i.rightName;a==="default"?this.hadDefaultExport=true:this.hadNamedExport=true;const o=i.leftName,c=this.importProcessor.getIdentifierReplacement(o);s.push(`exports.${a} = ${c||o};`)}if(this.tokens.matches1(n.braceR)){this.tokens.removeToken();break}if(this.tokens.matches2(n.comma,n.braceR)){this.tokens.removeToken(),this.tokens.removeToken();break}else if(this.tokens.matches1(n.comma))this.tokens.removeToken();else throw new Error(`Unexpected token: ${JSON.stringify(this.tokens.currentToken())}`)}if(this.tokens.matchesContextual(g._from)){this.tokens.removeToken();const i=this.tokens.stringValue();this.tokens.replaceTokenTrimmingLeftWhitespace(this.importProcessor.claimImportCode(i)),bs(this.tokens)}else this.tokens.appendCode(s.join(" "));this.tokens.matches1(n.semi)&&this.tokens.removeToken()}processExportStar(){for(this.tokens.removeInitialToken();!this.tokens.matches1(n.string);)this.tokens.removeToken();const e=this.tokens.stringValue();this.tokens.replaceTokenTrimmingLeftWhitespace(this.importProcessor.claimImportCode(e)),bs(this.tokens),this.tokens.matches1(n.semi)&&this.tokens.removeToken()}shouldElideExportedIdentifier(e){return this.isTypeScriptTransformEnabled&&!this.keepUnusedImports&&!this.declarationInfo.valueDeclarations.has(e)}}class Mb extends vt{constructor(e,s,i,r,a,o,c,l){super(),this.tokens=e,this.nameManager=s,this.helperManager=i,this.reactHotLoaderTransformer=r,this.isTypeScriptTransformEnabled=a,this.isFlowTransformEnabled=o,this.keepUnusedImports=c,this.nonTypeIdentifiers=a&&!c?jl(e,l):new Set,this.declarationInfo=a&&!c?D1(e):L1,this.injectCreateRequireForImportRequire=!!l.injectCreateRequireForImportRequire}process(){if(this.tokens.matches3(n._import,n.name,n.eq))return this.processImportEquals();if(this.tokens.matches4(n._import,n.name,n.name,n.eq)&&this.tokens.matchesContextualAtIndex(this.tokens.currentIndex()+1,g._type)){this.tokens.removeInitialToken();for(let e=0;e<7;e++)this.tokens.removeToken();return true}if(this.tokens.matches2(n._export,n.eq))return this.tokens.replaceToken("module.exports"),true;if(this.tokens.matches5(n._export,n._import,n.name,n.name,n.eq)&&this.tokens.matchesContextualAtIndex(this.tokens.currentIndex()+2,g._type)){this.tokens.removeInitialToken();for(let e=0;e<8;e++)this.tokens.removeToken();return true}if(this.tokens.matches1(n._import))return this.processImport();if(this.tokens.matches2(n._export,n._default))return this.processExportDefault();if(this.tokens.matches2(n._export,n.braceL))return this.processNamedExports();if(this.tokens.matches2(n._export,n.name)&&this.tokens.matchesContextualAtIndex(this.tokens.currentIndex()+1,g._type)){if(this.tokens.removeInitialToken(),this.tokens.removeToken(),this.tokens.matches1(n.braceL)){for(;!this.tokens.matches1(n.braceR);)this.tokens.removeToken();this.tokens.removeToken()}else this.tokens.removeToken(),this.tokens.matches1(n._as)&&(this.tokens.removeToken(),this.tokens.removeToken());return this.tokens.matchesContextual(g._from)&&this.tokens.matches1AtIndex(this.tokens.currentIndex()+1,n.string)&&(this.tokens.removeToken(),this.tokens.removeToken(),bs(this.tokens)),true}return false}processImportEquals(){const e=this.tokens.identifierNameAtIndex(this.tokens.currentIndex()+1);return this.shouldAutomaticallyElideImportedName(e)?P1(this.tokens):this.injectCreateRequireForImportRequire?(this.tokens.replaceToken("const"),this.tokens.copyToken(),this.tokens.copyToken(),this.tokens.replaceToken(this.helperManager.getHelperName("require"))):this.tokens.replaceToken("const"),true}processImport(){if(this.tokens.matches2(n._import,n.parenL))return false;const e=this.tokens.snapshot();if(this.removeImportTypeBindings()){for(this.tokens.restoreToSnapshot(e);!this.tokens.matches1(n.string);)this.tokens.removeToken();this.tokens.removeToken(),bs(this.tokens),this.tokens.matches1(n.semi)&&this.tokens.removeToken()}return true}removeImportTypeBindings(){if(this.tokens.copyExpectedToken(n._import),this.tokens.matchesContextual(g._type)&&!this.tokens.matches1AtIndex(this.tokens.currentIndex()+1,n.comma)&&!this.tokens.matchesContextualAtIndex(this.tokens.currentIndex()+1,g._from))return true;if(this.tokens.matches1(n.string))return this.tokens.copyToken(),false;this.tokens.matchesContextual(g._module)&&this.tokens.matchesContextualAtIndex(this.tokens.currentIndex()+2,g._from)&&this.tokens.copyToken();let e=false,s=false,i=false;if(this.tokens.matches1(n.name)&&(this.shouldAutomaticallyElideImportedName(this.tokens.identifierName())?(this.tokens.removeToken(),this.tokens.matches1(n.comma)&&this.tokens.removeToken()):(e=true,this.tokens.copyToken(),this.tokens.matches1(n.comma)&&(i=true,this.tokens.removeToken()))),this.tokens.matches1(n.star))this.shouldAutomaticallyElideImportedName(this.tokens.identifierNameAtRelativeIndex(2))?(this.tokens.removeToken(),this.tokens.removeToken(),this.tokens.removeToken()):(i&&this.tokens.appendCode(","),e=true,this.tokens.copyExpectedToken(n.star),this.tokens.copyExpectedToken(n.name),this.tokens.copyExpectedToken(n.name));else if(this.tokens.matches1(n.braceL)){for(i&&this.tokens.appendCode(","),this.tokens.copyToken();!this.tokens.matches1(n.braceR);){s=true;const r=hi(this.tokens);if(r.isType||this.shouldAutomaticallyElideImportedName(r.rightName)){for(;this.tokens.currentIndex()<r.endIndex;)this.tokens.removeToken();this.tokens.matches1(n.comma)&&this.tokens.removeToken()}else{for(e=true;this.tokens.currentIndex()<r.endIndex;)this.tokens.copyToken();this.tokens.matches1(n.comma)&&this.tokens.copyToken()}}this.tokens.copyExpectedToken(n.braceR)}return this.keepUnusedImports?false:this.isTypeScriptTransformEnabled?!e:this.isFlowTransformEnabled?s&&!e:false}shouldAutomaticallyElideImportedName(e){return this.isTypeScriptTransformEnabled&&!this.keepUnusedImports&&!this.nonTypeIdentifiers.has(e)}processExportDefault(){if(F1(this.isTypeScriptTransformEnabled,this.keepUnusedImports,this.tokens,this.declarationInfo))return this.tokens.removeInitialToken(),this.tokens.removeToken(),this.tokens.removeToken(),true;if(!(this.tokens.matches4(n._export,n._default,n._function,n.name)||this.tokens.matches5(n._export,n._default,n.name,n._function,n.name)&&this.tokens.matchesContextualAtIndex(this.tokens.currentIndex()+2,g._async)||this.tokens.matches4(n._export,n._default,n._class,n.name)||this.tokens.matches5(n._export,n._default,n._abstract,n._class,n.name))&&this.reactHotLoaderTransformer){const s=this.nameManager.claimFreeName("_default");return this.tokens.replaceToken(`let ${s}; export`),this.tokens.copyToken(),this.tokens.appendCode(` ${s} =`),this.reactHotLoaderTransformer.setExtractedDefaultExportName(s),true}return false}processNamedExports(){if(!this.isTypeScriptTransformEnabled)return false;this.tokens.copyExpectedToken(n._export),this.tokens.copyExpectedToken(n.braceL);const e=N1(this.tokens);let s=false;for(;!this.tokens.matches1(n.braceR);){const i=hi(this.tokens);if(i.isType||!e&&this.shouldElideExportedName(i.leftName)){for(;this.tokens.currentIndex()<i.endIndex;)this.tokens.removeToken();this.tokens.matches1(n.comma)&&this.tokens.removeToken()}else{for(s=true;this.tokens.currentIndex()<i.endIndex;)this.tokens.copyToken();this.tokens.matches1(n.comma)&&this.tokens.copyToken()}}return this.tokens.copyExpectedToken(n.braceR),!this.keepUnusedImports&&e&&!s&&(this.tokens.removeToken(),this.tokens.removeToken(),bs(this.tokens)),true}shouldElideExportedName(e){return this.isTypeScriptTransformEnabled&&!this.keepUnusedImports&&this.declarationInfo.typeDeclarations.has(e)&&!this.declarationInfo.valueDeclarations.has(e)}}class Bb extends vt{constructor(e,s,i){super(),this.rootTransformer=e,this.tokens=s,this.isImportsTransformEnabled=i}process(){return this.rootTransformer.processPossibleArrowParamEnd()||this.rootTransformer.processPossibleAsyncArrowWithTypeParams()||this.rootTransformer.processPossibleTypeRange()?true:this.tokens.matches1(n._enum)?(this.processEnum(),true):this.tokens.matches2(n._export,n._enum)?(this.processNamedExportEnum(),true):this.tokens.matches3(n._export,n._default,n._enum)?(this.processDefaultExportEnum(),true):false}processNamedExportEnum(){if(this.isImportsTransformEnabled){this.tokens.removeInitialToken();const e=this.tokens.identifierNameAtRelativeIndex(1);this.processEnum(),this.tokens.appendCode(` exports.${e} = ${e};`)}else this.tokens.copyToken(),this.processEnum()}processDefaultExportEnum(){this.tokens.removeInitialToken(),this.tokens.removeToken();const e=this.tokens.identifierNameAtRelativeIndex(1);this.processEnum(),this.isImportsTransformEnabled?this.tokens.appendCode(` exports.default = ${e};`):this.tokens.appendCode(` export default ${e};`)}processEnum(){this.tokens.replaceToken("const"),this.tokens.copyExpectedToken(n.name);let e=false;this.tokens.matchesContextual(g._of)&&(this.tokens.removeToken(),e=this.tokens.matchesContextual(g._symbol),this.tokens.removeToken());const s=this.tokens.matches3(n.braceL,n.name,n.eq);this.tokens.appendCode(' = require("flow-enums-runtime")');const i=!e&&!s;for(this.tokens.replaceTokenTrimmingLeftWhitespace(i?".Mirrored([":"({");!this.tokens.matches1(n.braceR);){if(this.tokens.matches1(n.ellipsis)){this.tokens.removeToken();break}this.processEnumElement(e,s),this.tokens.matches1(n.comma)&&this.tokens.copyToken()}this.tokens.replaceToken(i?"]);":"});")}processEnumElement(e,s){if(e){const i=this.tokens.identifierName();this.tokens.copyToken(),this.tokens.appendCode(`: Symbol("${i}")`)}else s?(this.tokens.copyToken(),this.tokens.replaceTokenTrimmingLeftWhitespace(":"),this.tokens.copyToken()):this.tokens.replaceToken(`"${this.tokens.identifierName()}"`)}}function Ob(t){let e,s=t[0],i=1;for(;i<t.length;){const r=t[i],a=t[i+1];if(i+=2,(r==="optionalAccess"||r==="optionalCall")&&s==null)return;r==="access"||r==="optionalAccess"?(e=s,s=a(s)):(r==="call"||r==="optionalCall")&&(s=a((...o)=>s.call(e,...o)),e=void 0)}return s}const Li="jest",Vb=["mock","unmock","enableAutomock","disableAutomock"];class xo extends vt{__init(){this.hoistedFunctionNames=[]}constructor(e,s,i,r){super(),this.rootTransformer=e,this.tokens=s,this.nameManager=i,this.importProcessor=r,xo.prototype.__init.call(this)}process(){return this.tokens.currentToken().scopeDepth===0&&this.tokens.matches4(n.name,n.dot,n.name,n.parenL)&&this.tokens.identifierName()===Li?Ob([this,"access",e=>e.importProcessor,"optionalAccess",e=>e.getGlobalNames,"call",e=>e(),"optionalAccess",e=>e.has,"call",e=>e(Li)])?false:this.extractHoistedCalls():false}getHoistedCode(){return this.hoistedFunctionNames.length>0?this.hoistedFunctionNames.map(e=>`${e}();`).join(""):""}extractHoistedCalls(){this.tokens.removeToken();let e=false;for(;this.tokens.matches3(n.dot,n.name,n.parenL);){const s=this.tokens.identifierNameAtIndex(this.tokens.currentIndex()+1);if(Vb.includes(s)){const r=this.nameManager.claimFreeName("__jestHoist");this.hoistedFunctionNames.push(r),this.tokens.replaceToken(`function ${r}(){${Li}.`),this.tokens.copyToken(),this.tokens.copyToken(),this.rootTransformer.processBalancedCode(),this.tokens.copyExpectedToken(n.parenR),this.tokens.appendCode(";}"),e=false}else e?this.tokens.copyToken():this.tokens.replaceToken(`${Li}.`),this.tokens.copyToken(),this.tokens.copyToken(),this.rootTransformer.processBalancedCode(),this.tokens.copyExpectedToken(n.parenR),e=true}return true}}class $b extends vt{constructor(e){super(),this.tokens=e}process(){if(this.tokens.matches1(n.num)){const e=this.tokens.currentTokenCode();if(e.includes("_"))return this.tokens.replaceToken(e.replace(/_/g,"")),true}return false}}class jb extends vt{constructor(e,s){super(),this.tokens=e,this.nameManager=s}process(){return this.tokens.matches2(n._catch,n.braceL)?(this.tokens.copyToken(),this.tokens.appendCode(` (${this.nameManager.claimFreeName("e")})`),true):false}}class qb extends vt{constructor(e,s){super(),this.tokens=e,this.nameManager=s}process(){if(this.tokens.matches1(n.nullishCoalescing)){const i=this.tokens.currentToken();return this.tokens.tokens[i.nullishStartIndex].isAsyncOperation?this.tokens.replaceTokenTrimmingLeftWhitespace(", async () => ("):this.tokens.replaceTokenTrimmingLeftWhitespace(", () => ("),true}if(this.tokens.matches1(n._delete)&&this.tokens.tokenAtRelativeIndex(1).isOptionalChainStart)return this.tokens.removeInitialToken(),true;const s=this.tokens.currentToken().subscriptStartIndex;if(s!=null&&this.tokens.tokens[s].isOptionalChainStart&&this.tokens.tokenAtRelativeIndex(-1).type!==n._super){const i=this.nameManager.claimFreeName("_");let r;if(s>0&&this.tokens.matches1AtIndex(s-1,n._delete)&&this.isLastSubscriptInChain()?r=`${i} => delete ${i}`:r=`${i} => ${i}`,this.tokens.tokens[s].isAsyncOperation&&(r=`async ${r}`),this.tokens.matches2(n.questionDot,n.parenL)||this.tokens.matches2(n.questionDot,n.lessThan))this.justSkippedSuper()&&this.tokens.appendCode(".bind(this)"),this.tokens.replaceTokenTrimmingLeftWhitespace(`, 'optionalCall', ${r}`);else if(this.tokens.matches2(n.questionDot,n.bracketL))this.tokens.replaceTokenTrimmingLeftWhitespace(`, 'optionalAccess', ${r}`);else if(this.tokens.matches1(n.questionDot))this.tokens.replaceTokenTrimmingLeftWhitespace(`, 'optionalAccess', ${r}.`);else if(this.tokens.matches1(n.dot))this.tokens.replaceTokenTrimmingLeftWhitespace(`, 'access', ${r}.`);else if(this.tokens.matches1(n.bracketL))this.tokens.replaceTokenTrimmingLeftWhitespace(`, 'access', ${r}[`);else if(this.tokens.matches1(n.parenL))this.justSkippedSuper()&&this.tokens.appendCode(".bind(this)"),this.tokens.replaceTokenTrimmingLeftWhitespace(`, 'call', ${r}(`);else throw new Error("Unexpected subscript operator in optional chain.");return true}return false}isLastSubscriptInChain(){let e=0;for(let s=this.tokens.currentIndex()+1;;s++){if(s>=this.tokens.tokens.length)throw new Error("Reached the end of the code while finding the end of the access chain.");if(this.tokens.tokens[s].isOptionalChainStart?e++:this.tokens.tokens[s].isOptionalChainEnd&&e--,e<0)return true;if(e===0&&this.tokens.tokens[s].subscriptStartIndex!=null)return false}}justSkippedSuper(){let e=0,s=this.tokens.currentIndex()-1;for(;;){if(s<0)throw new Error("Reached the start of the code while finding the start of the access chain.");if(this.tokens.tokens[s].isOptionalChainStart?e--:this.tokens.tokens[s].isOptionalChainEnd&&e++,e<0)return false;if(e===0&&this.tokens.tokens[s].subscriptStartIndex!=null)return this.tokens.tokens[s-1].type===n._super;s--}}}class Hb extends vt{constructor(e,s,i,r){super(),this.rootTransformer=e,this.tokens=s,this.importProcessor=i,this.options=r}process(){const e=this.tokens.currentIndex();if(this.tokens.identifierName()==="createReactClass"){const s=this.importProcessor&&this.importProcessor.getIdentifierReplacement("createReactClass");return s?this.tokens.replaceToken(`(0, ${s})`):this.tokens.copyToken(),this.tryProcessCreateClassCall(e),true}if(this.tokens.matches3(n.name,n.dot,n.name)&&this.tokens.identifierName()==="React"&&this.tokens.identifierNameAtIndex(this.tokens.currentIndex()+2)==="createClass"){const s=this.importProcessor&&this.importProcessor.getIdentifierReplacement("React")||"React";return s?(this.tokens.replaceToken(s),this.tokens.copyToken(),this.tokens.copyToken()):(this.tokens.copyToken(),this.tokens.copyToken(),this.tokens.copyToken()),this.tryProcessCreateClassCall(e),true}return false}tryProcessCreateClassCall(e){const s=this.findDisplayName(e);s&&this.classNeedsDisplayName()&&(this.tokens.copyExpectedToken(n.parenL),this.tokens.copyExpectedToken(n.braceL),this.tokens.appendCode(`displayName: '${s}',`),this.rootTransformer.processBalancedCode(),this.tokens.copyExpectedToken(n.braceR),this.tokens.copyExpectedToken(n.parenR))}findDisplayName(e){return e<2?null:this.tokens.matches2AtIndex(e-2,n.name,n.eq)?this.tokens.identifierNameAtIndex(e-2):e>=2&&this.tokens.tokens[e-2].identifierRole===ie.ObjectKey?this.tokens.identifierNameAtIndex(e-2):this.tokens.matches2AtIndex(e-2,n._export,n._default)?this.getDisplayNameFromFilename():null}getDisplayNameFromFilename(){const s=(this.options.filePath||"unknown").split("/"),i=s[s.length-1],r=i.lastIndexOf("."),a=r===-1?i:i.slice(0,r);return a==="index"&&s[s.length-2]?s[s.length-2]:a}classNeedsDisplayName(){let e=this.tokens.currentIndex();if(!this.tokens.matches2(n.parenL,n.braceL))return false;const s=e+1,i=this.tokens.tokens[s].contextId;if(i==null)throw new Error("Expected non-null context ID on object open-brace.");for(;e<this.tokens.tokens.length;e++){const r=this.tokens.tokens[e];if(r.type===n.braceR&&r.contextId===i){e++;break}if(this.tokens.identifierNameAtIndex(e)==="displayName"&&this.tokens.tokens[e].identifierRole===ie.ObjectKey&&r.contextId===i)return false}if(e===this.tokens.tokens.length)throw new Error("Unexpected end of input when processing React class.");return this.tokens.matches1AtIndex(e,n.parenR)||this.tokens.matches2AtIndex(e,n.comma,n.parenR)}}class ko extends vt{__init(){this.extractedDefaultExportName=null}constructor(e,s){super(),this.tokens=e,this.filePath=s,ko.prototype.__init.call(this)}setExtractedDefaultExportName(e){this.extractedDefaultExportName=e}getPrefixCode(){return`
592
+ `:""}process(){return this.tokens.matches3(n._import,n.name,n.eq)?this.processImportEquals():this.tokens.matches1(n._import)?(this.processImport(),true):this.tokens.matches2(n._export,n.eq)?(this.tokens.replaceToken("module.exports"),true):this.tokens.matches1(n._export)&&!this.tokens.currentToken().isType?(this.hadExport=true,this.processExport()):this.tokens.matches2(n.name,n.postIncDec)&&this.processPostIncDec()?true:this.tokens.matches1(n.name)||this.tokens.matches1(n.jsxName)?this.processIdentifier():this.tokens.matches1(n.eq)?this.processAssignment():this.tokens.matches1(n.assign)?this.processComplexAssignment():this.tokens.matches1(n.preIncDec)?this.processPreIncDec():false}processImportEquals(){const e=this.tokens.identifierNameAtIndex(this.tokens.currentIndex()+1);return this.importProcessor.shouldAutomaticallyElideImportedName(e)?P1(this.tokens):this.tokens.replaceToken("const"),true}processImport(){if(this.tokens.matches2(n._import,n.parenL)){if(this.preserveDynamicImport){this.tokens.copyToken();return}const s=this.enableLegacyTypeScriptModuleInterop?"":`${this.helperManager.getHelperName("interopRequireWildcard")}(`;this.tokens.replaceToken(`Promise.resolve().then(() => ${s}require`);const i=this.tokens.currentToken().contextId;if(i==null)throw new Error("Expected context ID on dynamic import invocation.");for(this.tokens.copyToken();!this.tokens.matchesContextIdAndLabel(n.parenR,i);)this.rootTransformer.processToken();this.tokens.replaceToken(s?")))":"))");return}if(this.removeImportAndDetectIfShouldElide())this.tokens.removeToken();else{const s=this.tokens.stringValue();this.tokens.replaceTokenTrimmingLeftWhitespace(this.importProcessor.claimImportCode(s)),this.tokens.appendCode(this.importProcessor.claimImportCode(s))}bs(this.tokens),this.tokens.matches1(n.semi)&&this.tokens.removeToken()}removeImportAndDetectIfShouldElide(){if(this.tokens.removeInitialToken(),this.tokens.matchesContextual(g._type)&&!this.tokens.matches1AtIndex(this.tokens.currentIndex()+1,n.comma)&&!this.tokens.matchesContextualAtIndex(this.tokens.currentIndex()+1,g._from))return this.removeRemainingImport(),true;if(this.tokens.matches1(n.name)||this.tokens.matches1(n.star))return this.removeRemainingImport(),false;if(this.tokens.matches1(n.string))return false;let e=false,s=false;for(;!this.tokens.matches1(n.string);)(!e&&this.tokens.matches1(n.braceL)||this.tokens.matches1(n.comma))&&(this.tokens.removeToken(),this.tokens.matches1(n.braceR)||(s=true),(this.tokens.matches2(n.name,n.comma)||this.tokens.matches2(n.name,n.braceR)||this.tokens.matches4(n.name,n.name,n.name,n.comma)||this.tokens.matches4(n.name,n.name,n.name,n.braceR))&&(e=true)),this.tokens.removeToken();return this.keepUnusedImports?false:this.isTypeScriptTransformEnabled?!e:this.isFlowTransformEnabled?s&&!e:false}removeRemainingImport(){for(;!this.tokens.matches1(n.string);)this.tokens.removeToken()}processIdentifier(){const e=this.tokens.currentToken();if(e.shadowsGlobal)return false;if(e.identifierRole===ie.ObjectShorthand)return this.processObjectShorthand();if(e.identifierRole!==ie.Access)return false;const s=this.importProcessor.getIdentifierReplacement(this.tokens.identifierNameForToken(e));if(!s)return false;let i=this.tokens.currentIndex()+1;for(;i<this.tokens.tokens.length&&this.tokens.tokens[i].type===n.parenR;)i++;return this.tokens.tokens[i].type===n.parenL?this.tokens.tokenAtRelativeIndex(1).type===n.parenL&&this.tokens.tokenAtRelativeIndex(-1).type!==n._new?(this.tokens.replaceToken(`${s}.call(void 0, `),this.tokens.removeToken(),this.rootTransformer.processBalancedCode(),this.tokens.copyExpectedToken(n.parenR)):this.tokens.replaceToken(`(0, ${s})`):this.tokens.replaceToken(s),true}processObjectShorthand(){const e=this.tokens.identifierName(),s=this.importProcessor.getIdentifierReplacement(e);return s?(this.tokens.replaceToken(`${e}: ${s}`),true):false}processExport(){if(this.tokens.matches2(n._export,n._enum)||this.tokens.matches3(n._export,n._const,n._enum))return this.hadNamedExport=true,false;if(this.tokens.matches2(n._export,n._default))return this.tokens.matches3(n._export,n._default,n._enum)?(this.hadDefaultExport=true,false):(this.processExportDefault(),true);if(this.tokens.matches2(n._export,n.braceL))return this.processExportBindings(),true;if(this.tokens.matches2(n._export,n.name)&&this.tokens.matchesContextualAtIndex(this.tokens.currentIndex()+1,g._type)){if(this.tokens.removeInitialToken(),this.tokens.removeToken(),this.tokens.matches1(n.braceL)){for(;!this.tokens.matches1(n.braceR);)this.tokens.removeToken();this.tokens.removeToken()}else this.tokens.removeToken(),this.tokens.matches1(n._as)&&(this.tokens.removeToken(),this.tokens.removeToken());return this.tokens.matchesContextual(g._from)&&this.tokens.matches1AtIndex(this.tokens.currentIndex()+1,n.string)&&(this.tokens.removeToken(),this.tokens.removeToken(),bs(this.tokens)),true}if(this.hadNamedExport=true,this.tokens.matches2(n._export,n._var)||this.tokens.matches2(n._export,n._let)||this.tokens.matches2(n._export,n._const))return this.processExportVar(),true;if(this.tokens.matches2(n._export,n._function)||this.tokens.matches3(n._export,n.name,n._function))return this.processExportFunction(),true;if(this.tokens.matches2(n._export,n._class)||this.tokens.matches3(n._export,n._abstract,n._class)||this.tokens.matches2(n._export,n.at))return this.processExportClass(),true;if(this.tokens.matches2(n._export,n.star))return this.processExportStar(),true;throw new Error("Unrecognized export syntax.")}processAssignment(){const e=this.tokens.currentIndex(),s=this.tokens.tokens[e-1];if(s.isType||s.type!==n.name||s.shadowsGlobal||e>=2&&this.tokens.matches1AtIndex(e-2,n.dot)||e>=2&&[n._var,n._let,n._const].includes(this.tokens.tokens[e-2].type))return false;const i=this.importProcessor.resolveExportBinding(this.tokens.identifierNameForToken(s));return i?(this.tokens.copyToken(),this.tokens.appendCode(` ${i} =`),true):false}processComplexAssignment(){const e=this.tokens.currentIndex(),s=this.tokens.tokens[e-1];if(s.type!==n.name||s.shadowsGlobal||e>=2&&this.tokens.matches1AtIndex(e-2,n.dot))return false;const i=this.importProcessor.resolveExportBinding(this.tokens.identifierNameForToken(s));return i?(this.tokens.appendCode(` = ${i}`),this.tokens.copyToken(),true):false}processPreIncDec(){const e=this.tokens.currentIndex(),s=this.tokens.tokens[e+1];if(s.type!==n.name||s.shadowsGlobal||e+2<this.tokens.tokens.length&&(this.tokens.matches1AtIndex(e+2,n.dot)||this.tokens.matches1AtIndex(e+2,n.bracketL)||this.tokens.matches1AtIndex(e+2,n.parenL)))return false;const i=this.tokens.identifierNameForToken(s),r=this.importProcessor.resolveExportBinding(i);return r?(this.tokens.appendCode(`${r} = `),this.tokens.copyToken(),true):false}processPostIncDec(){const e=this.tokens.currentIndex(),s=this.tokens.tokens[e],i=this.tokens.tokens[e+1];if(s.type!==n.name||s.shadowsGlobal||e>=1&&this.tokens.matches1AtIndex(e-1,n.dot))return false;const r=this.tokens.identifierNameForToken(s),o=this.importProcessor.resolveExportBinding(r);if(!o)return false;const a=this.tokens.rawCodeForToken(i),c=this.importProcessor.getIdentifierReplacement(r)||r;if(a==="++")this.tokens.replaceToken(`(${c} = ${o} = ${c} + 1, ${c} - 1)`);else if(a==="--")this.tokens.replaceToken(`(${c} = ${o} = ${c} - 1, ${c} + 1)`);else throw new Error(`Unexpected operator: ${a}`);return this.tokens.removeToken(),true}processExportDefault(){let e=true;if(this.tokens.matches4(n._export,n._default,n._function,n.name)||this.tokens.matches5(n._export,n._default,n.name,n._function,n.name)&&this.tokens.matchesContextualAtIndex(this.tokens.currentIndex()+2,g._async)){this.tokens.removeInitialToken(),this.tokens.removeToken();const s=this.processNamedFunction();this.tokens.appendCode(` exports.default = ${s};`)}else if(this.tokens.matches4(n._export,n._default,n._class,n.name)||this.tokens.matches5(n._export,n._default,n._abstract,n._class,n.name)||this.tokens.matches3(n._export,n._default,n.at)){this.tokens.removeInitialToken(),this.tokens.removeToken(),this.copyDecorators(),this.tokens.matches1(n._abstract)&&this.tokens.removeToken();const s=this.rootTransformer.processNamedClass();this.tokens.appendCode(` exports.default = ${s};`)}else if(F1(this.isTypeScriptTransformEnabled,this.keepUnusedImports,this.tokens,this.declarationInfo))e=false,this.tokens.removeInitialToken(),this.tokens.removeToken(),this.tokens.removeToken();else if(this.reactHotLoaderTransformer){const s=this.nameManager.claimFreeName("_default");this.tokens.replaceToken(`let ${s}; exports.`),this.tokens.copyToken(),this.tokens.appendCode(` = ${s} =`),this.reactHotLoaderTransformer.setExtractedDefaultExportName(s)}else this.tokens.replaceToken("exports."),this.tokens.copyToken(),this.tokens.appendCode(" =");e&&(this.hadDefaultExport=true)}copyDecorators(){for(;this.tokens.matches1(n.at);)if(this.tokens.copyToken(),this.tokens.matches1(n.parenL))this.tokens.copyExpectedToken(n.parenL),this.rootTransformer.processBalancedCode(),this.tokens.copyExpectedToken(n.parenR);else{for(this.tokens.copyExpectedToken(n.name);this.tokens.matches1(n.dot);)this.tokens.copyExpectedToken(n.dot),this.tokens.copyExpectedToken(n.name);this.tokens.matches1(n.parenL)&&(this.tokens.copyExpectedToken(n.parenL),this.rootTransformer.processBalancedCode(),this.tokens.copyExpectedToken(n.parenR))}}processExportVar(){this.isSimpleExportVar()?this.processSimpleExportVar():this.processComplexExportVar()}isSimpleExportVar(){let e=this.tokens.currentIndex();if(e++,e++,!this.tokens.matches1AtIndex(e,n.name))return false;for(e++;e<this.tokens.tokens.length&&this.tokens.tokens[e].isType;)e++;return!!this.tokens.matches1AtIndex(e,n.eq)}processSimpleExportVar(){this.tokens.removeInitialToken(),this.tokens.copyToken();const e=this.tokens.identifierName();for(;!this.tokens.matches1(n.eq);)this.rootTransformer.processToken();const s=this.tokens.currentToken().rhsEndIndex;if(s==null)throw new Error("Expected = token with an end index.");for(;this.tokens.currentIndex()<s;)this.rootTransformer.processToken();this.tokens.appendCode(`; exports.${e} = ${e}`)}processComplexExportVar(){this.tokens.removeInitialToken(),this.tokens.removeToken();const e=this.tokens.matches1(n.braceL);e&&this.tokens.appendCode("(");let s=0;for(;;)if(this.tokens.matches1(n.braceL)||this.tokens.matches1(n.dollarBraceL)||this.tokens.matches1(n.bracketL))s++,this.tokens.copyToken();else if(this.tokens.matches1(n.braceR)||this.tokens.matches1(n.bracketR))s--,this.tokens.copyToken();else{if(s===0&&!this.tokens.matches1(n.name)&&!this.tokens.currentToken().isType)break;if(this.tokens.matches1(n.eq)){const i=this.tokens.currentToken().rhsEndIndex;if(i==null)throw new Error("Expected = token with an end index.");for(;this.tokens.currentIndex()<i;)this.rootTransformer.processToken()}else{const i=this.tokens.currentToken();if(Al(i)){const r=this.tokens.identifierName();let o=this.importProcessor.getIdentifierReplacement(r);if(o===null)throw new Error(`Expected a replacement for ${r} in \`export var\` syntax.`);ap(i)&&(o=`${r}: ${o}`),this.tokens.replaceToken(o)}else this.rootTransformer.processToken()}}if(e){const i=this.tokens.currentToken().rhsEndIndex;if(i==null)throw new Error("Expected = token with an end index.");for(;this.tokens.currentIndex()<i;)this.rootTransformer.processToken();this.tokens.appendCode(")")}}processExportFunction(){this.tokens.replaceToken("");const e=this.processNamedFunction();this.tokens.appendCode(` exports.${e} = ${e};`)}processNamedFunction(){if(this.tokens.matches1(n._function))this.tokens.copyToken();else if(this.tokens.matches2(n.name,n._function)){if(!this.tokens.matchesContextual(g._async))throw new Error("Expected async keyword in function export.");this.tokens.copyToken(),this.tokens.copyToken()}if(this.tokens.matches1(n.star)&&this.tokens.copyToken(),!this.tokens.matches1(n.name))throw new Error("Expected identifier for exported function name.");const e=this.tokens.identifierName();if(this.tokens.copyToken(),this.tokens.currentToken().isType)for(this.tokens.removeInitialToken();this.tokens.currentToken().isType;)this.tokens.removeToken();return this.tokens.copyExpectedToken(n.parenL),this.rootTransformer.processBalancedCode(),this.tokens.copyExpectedToken(n.parenR),this.rootTransformer.processPossibleTypeRange(),this.tokens.copyExpectedToken(n.braceL),this.rootTransformer.processBalancedCode(),this.tokens.copyExpectedToken(n.braceR),e}processExportClass(){this.tokens.removeInitialToken(),this.copyDecorators(),this.tokens.matches1(n._abstract)&&this.tokens.removeToken();const e=this.rootTransformer.processNamedClass();this.tokens.appendCode(` exports.${e} = ${e};`)}processExportBindings(){this.tokens.removeInitialToken(),this.tokens.removeToken();const e=N1(this.tokens),s=[];for(;;){if(this.tokens.matches1(n.braceR)){this.tokens.removeToken();break}const i=hi(this.tokens);for(;this.tokens.currentIndex()<i.endIndex;)this.tokens.removeToken();if(!(i.isType||!e&&this.shouldElideExportedIdentifier(i.leftName))){const o=i.rightName;o==="default"?this.hadDefaultExport=true:this.hadNamedExport=true;const a=i.leftName,c=this.importProcessor.getIdentifierReplacement(a);s.push(`exports.${o} = ${c||a};`)}if(this.tokens.matches1(n.braceR)){this.tokens.removeToken();break}if(this.tokens.matches2(n.comma,n.braceR)){this.tokens.removeToken(),this.tokens.removeToken();break}else if(this.tokens.matches1(n.comma))this.tokens.removeToken();else throw new Error(`Unexpected token: ${JSON.stringify(this.tokens.currentToken())}`)}if(this.tokens.matchesContextual(g._from)){this.tokens.removeToken();const i=this.tokens.stringValue();this.tokens.replaceTokenTrimmingLeftWhitespace(this.importProcessor.claimImportCode(i)),bs(this.tokens)}else this.tokens.appendCode(s.join(" "));this.tokens.matches1(n.semi)&&this.tokens.removeToken()}processExportStar(){for(this.tokens.removeInitialToken();!this.tokens.matches1(n.string);)this.tokens.removeToken();const e=this.tokens.stringValue();this.tokens.replaceTokenTrimmingLeftWhitespace(this.importProcessor.claimImportCode(e)),bs(this.tokens),this.tokens.matches1(n.semi)&&this.tokens.removeToken()}shouldElideExportedIdentifier(e){return this.isTypeScriptTransformEnabled&&!this.keepUnusedImports&&!this.declarationInfo.valueDeclarations.has(e)}}class Mb extends vt{constructor(e,s,i,r,o,a,c,l){super(),this.tokens=e,this.nameManager=s,this.helperManager=i,this.reactHotLoaderTransformer=r,this.isTypeScriptTransformEnabled=o,this.isFlowTransformEnabled=a,this.keepUnusedImports=c,this.nonTypeIdentifiers=o&&!c?jl(e,l):new Set,this.declarationInfo=o&&!c?D1(e):L1,this.injectCreateRequireForImportRequire=!!l.injectCreateRequireForImportRequire}process(){if(this.tokens.matches3(n._import,n.name,n.eq))return this.processImportEquals();if(this.tokens.matches4(n._import,n.name,n.name,n.eq)&&this.tokens.matchesContextualAtIndex(this.tokens.currentIndex()+1,g._type)){this.tokens.removeInitialToken();for(let e=0;e<7;e++)this.tokens.removeToken();return true}if(this.tokens.matches2(n._export,n.eq))return this.tokens.replaceToken("module.exports"),true;if(this.tokens.matches5(n._export,n._import,n.name,n.name,n.eq)&&this.tokens.matchesContextualAtIndex(this.tokens.currentIndex()+2,g._type)){this.tokens.removeInitialToken();for(let e=0;e<8;e++)this.tokens.removeToken();return true}if(this.tokens.matches1(n._import))return this.processImport();if(this.tokens.matches2(n._export,n._default))return this.processExportDefault();if(this.tokens.matches2(n._export,n.braceL))return this.processNamedExports();if(this.tokens.matches2(n._export,n.name)&&this.tokens.matchesContextualAtIndex(this.tokens.currentIndex()+1,g._type)){if(this.tokens.removeInitialToken(),this.tokens.removeToken(),this.tokens.matches1(n.braceL)){for(;!this.tokens.matches1(n.braceR);)this.tokens.removeToken();this.tokens.removeToken()}else this.tokens.removeToken(),this.tokens.matches1(n._as)&&(this.tokens.removeToken(),this.tokens.removeToken());return this.tokens.matchesContextual(g._from)&&this.tokens.matches1AtIndex(this.tokens.currentIndex()+1,n.string)&&(this.tokens.removeToken(),this.tokens.removeToken(),bs(this.tokens)),true}return false}processImportEquals(){const e=this.tokens.identifierNameAtIndex(this.tokens.currentIndex()+1);return this.shouldAutomaticallyElideImportedName(e)?P1(this.tokens):this.injectCreateRequireForImportRequire?(this.tokens.replaceToken("const"),this.tokens.copyToken(),this.tokens.copyToken(),this.tokens.replaceToken(this.helperManager.getHelperName("require"))):this.tokens.replaceToken("const"),true}processImport(){if(this.tokens.matches2(n._import,n.parenL))return false;const e=this.tokens.snapshot();if(this.removeImportTypeBindings()){for(this.tokens.restoreToSnapshot(e);!this.tokens.matches1(n.string);)this.tokens.removeToken();this.tokens.removeToken(),bs(this.tokens),this.tokens.matches1(n.semi)&&this.tokens.removeToken()}return true}removeImportTypeBindings(){if(this.tokens.copyExpectedToken(n._import),this.tokens.matchesContextual(g._type)&&!this.tokens.matches1AtIndex(this.tokens.currentIndex()+1,n.comma)&&!this.tokens.matchesContextualAtIndex(this.tokens.currentIndex()+1,g._from))return true;if(this.tokens.matches1(n.string))return this.tokens.copyToken(),false;this.tokens.matchesContextual(g._module)&&this.tokens.matchesContextualAtIndex(this.tokens.currentIndex()+2,g._from)&&this.tokens.copyToken();let e=false,s=false,i=false;if(this.tokens.matches1(n.name)&&(this.shouldAutomaticallyElideImportedName(this.tokens.identifierName())?(this.tokens.removeToken(),this.tokens.matches1(n.comma)&&this.tokens.removeToken()):(e=true,this.tokens.copyToken(),this.tokens.matches1(n.comma)&&(i=true,this.tokens.removeToken()))),this.tokens.matches1(n.star))this.shouldAutomaticallyElideImportedName(this.tokens.identifierNameAtRelativeIndex(2))?(this.tokens.removeToken(),this.tokens.removeToken(),this.tokens.removeToken()):(i&&this.tokens.appendCode(","),e=true,this.tokens.copyExpectedToken(n.star),this.tokens.copyExpectedToken(n.name),this.tokens.copyExpectedToken(n.name));else if(this.tokens.matches1(n.braceL)){for(i&&this.tokens.appendCode(","),this.tokens.copyToken();!this.tokens.matches1(n.braceR);){s=true;const r=hi(this.tokens);if(r.isType||this.shouldAutomaticallyElideImportedName(r.rightName)){for(;this.tokens.currentIndex()<r.endIndex;)this.tokens.removeToken();this.tokens.matches1(n.comma)&&this.tokens.removeToken()}else{for(e=true;this.tokens.currentIndex()<r.endIndex;)this.tokens.copyToken();this.tokens.matches1(n.comma)&&this.tokens.copyToken()}}this.tokens.copyExpectedToken(n.braceR)}return this.keepUnusedImports?false:this.isTypeScriptTransformEnabled?!e:this.isFlowTransformEnabled?s&&!e:false}shouldAutomaticallyElideImportedName(e){return this.isTypeScriptTransformEnabled&&!this.keepUnusedImports&&!this.nonTypeIdentifiers.has(e)}processExportDefault(){if(F1(this.isTypeScriptTransformEnabled,this.keepUnusedImports,this.tokens,this.declarationInfo))return this.tokens.removeInitialToken(),this.tokens.removeToken(),this.tokens.removeToken(),true;if(!(this.tokens.matches4(n._export,n._default,n._function,n.name)||this.tokens.matches5(n._export,n._default,n.name,n._function,n.name)&&this.tokens.matchesContextualAtIndex(this.tokens.currentIndex()+2,g._async)||this.tokens.matches4(n._export,n._default,n._class,n.name)||this.tokens.matches5(n._export,n._default,n._abstract,n._class,n.name))&&this.reactHotLoaderTransformer){const s=this.nameManager.claimFreeName("_default");return this.tokens.replaceToken(`let ${s}; export`),this.tokens.copyToken(),this.tokens.appendCode(` ${s} =`),this.reactHotLoaderTransformer.setExtractedDefaultExportName(s),true}return false}processNamedExports(){if(!this.isTypeScriptTransformEnabled)return false;this.tokens.copyExpectedToken(n._export),this.tokens.copyExpectedToken(n.braceL);const e=N1(this.tokens);let s=false;for(;!this.tokens.matches1(n.braceR);){const i=hi(this.tokens);if(i.isType||!e&&this.shouldElideExportedName(i.leftName)){for(;this.tokens.currentIndex()<i.endIndex;)this.tokens.removeToken();this.tokens.matches1(n.comma)&&this.tokens.removeToken()}else{for(s=true;this.tokens.currentIndex()<i.endIndex;)this.tokens.copyToken();this.tokens.matches1(n.comma)&&this.tokens.copyToken()}}return this.tokens.copyExpectedToken(n.braceR),!this.keepUnusedImports&&e&&!s&&(this.tokens.removeToken(),this.tokens.removeToken(),bs(this.tokens)),true}shouldElideExportedName(e){return this.isTypeScriptTransformEnabled&&!this.keepUnusedImports&&this.declarationInfo.typeDeclarations.has(e)&&!this.declarationInfo.valueDeclarations.has(e)}}class Ob extends vt{constructor(e,s,i){super(),this.rootTransformer=e,this.tokens=s,this.isImportsTransformEnabled=i}process(){return this.rootTransformer.processPossibleArrowParamEnd()||this.rootTransformer.processPossibleAsyncArrowWithTypeParams()||this.rootTransformer.processPossibleTypeRange()?true:this.tokens.matches1(n._enum)?(this.processEnum(),true):this.tokens.matches2(n._export,n._enum)?(this.processNamedExportEnum(),true):this.tokens.matches3(n._export,n._default,n._enum)?(this.processDefaultExportEnum(),true):false}processNamedExportEnum(){if(this.isImportsTransformEnabled){this.tokens.removeInitialToken();const e=this.tokens.identifierNameAtRelativeIndex(1);this.processEnum(),this.tokens.appendCode(` exports.${e} = ${e};`)}else this.tokens.copyToken(),this.processEnum()}processDefaultExportEnum(){this.tokens.removeInitialToken(),this.tokens.removeToken();const e=this.tokens.identifierNameAtRelativeIndex(1);this.processEnum(),this.isImportsTransformEnabled?this.tokens.appendCode(` exports.default = ${e};`):this.tokens.appendCode(` export default ${e};`)}processEnum(){this.tokens.replaceToken("const"),this.tokens.copyExpectedToken(n.name);let e=false;this.tokens.matchesContextual(g._of)&&(this.tokens.removeToken(),e=this.tokens.matchesContextual(g._symbol),this.tokens.removeToken());const s=this.tokens.matches3(n.braceL,n.name,n.eq);this.tokens.appendCode(' = require("flow-enums-runtime")');const i=!e&&!s;for(this.tokens.replaceTokenTrimmingLeftWhitespace(i?".Mirrored([":"({");!this.tokens.matches1(n.braceR);){if(this.tokens.matches1(n.ellipsis)){this.tokens.removeToken();break}this.processEnumElement(e,s),this.tokens.matches1(n.comma)&&this.tokens.copyToken()}this.tokens.replaceToken(i?"]);":"});")}processEnumElement(e,s){if(e){const i=this.tokens.identifierName();this.tokens.copyToken(),this.tokens.appendCode(`: Symbol("${i}")`)}else s?(this.tokens.copyToken(),this.tokens.replaceTokenTrimmingLeftWhitespace(":"),this.tokens.copyToken()):this.tokens.replaceToken(`"${this.tokens.identifierName()}"`)}}function Bb(t){let e,s=t[0],i=1;for(;i<t.length;){const r=t[i],o=t[i+1];if(i+=2,(r==="optionalAccess"||r==="optionalCall")&&s==null)return;r==="access"||r==="optionalAccess"?(e=s,s=o(s)):(r==="call"||r==="optionalCall")&&(s=o((...a)=>s.call(e,...a)),e=void 0)}return s}const Li="jest",Vb=["mock","unmock","enableAutomock","disableAutomock"];class xa extends vt{__init(){this.hoistedFunctionNames=[]}constructor(e,s,i,r){super(),this.rootTransformer=e,this.tokens=s,this.nameManager=i,this.importProcessor=r,xa.prototype.__init.call(this)}process(){return this.tokens.currentToken().scopeDepth===0&&this.tokens.matches4(n.name,n.dot,n.name,n.parenL)&&this.tokens.identifierName()===Li?Bb([this,"access",e=>e.importProcessor,"optionalAccess",e=>e.getGlobalNames,"call",e=>e(),"optionalAccess",e=>e.has,"call",e=>e(Li)])?false:this.extractHoistedCalls():false}getHoistedCode(){return this.hoistedFunctionNames.length>0?this.hoistedFunctionNames.map(e=>`${e}();`).join(""):""}extractHoistedCalls(){this.tokens.removeToken();let e=false;for(;this.tokens.matches3(n.dot,n.name,n.parenL);){const s=this.tokens.identifierNameAtIndex(this.tokens.currentIndex()+1);if(Vb.includes(s)){const r=this.nameManager.claimFreeName("__jestHoist");this.hoistedFunctionNames.push(r),this.tokens.replaceToken(`function ${r}(){${Li}.`),this.tokens.copyToken(),this.tokens.copyToken(),this.rootTransformer.processBalancedCode(),this.tokens.copyExpectedToken(n.parenR),this.tokens.appendCode(";}"),e=false}else e?this.tokens.copyToken():this.tokens.replaceToken(`${Li}.`),this.tokens.copyToken(),this.tokens.copyToken(),this.rootTransformer.processBalancedCode(),this.tokens.copyExpectedToken(n.parenR),e=true}return true}}class $b extends vt{constructor(e){super(),this.tokens=e}process(){if(this.tokens.matches1(n.num)){const e=this.tokens.currentTokenCode();if(e.includes("_"))return this.tokens.replaceToken(e.replace(/_/g,"")),true}return false}}class jb extends vt{constructor(e,s){super(),this.tokens=e,this.nameManager=s}process(){return this.tokens.matches2(n._catch,n.braceL)?(this.tokens.copyToken(),this.tokens.appendCode(` (${this.nameManager.claimFreeName("e")})`),true):false}}class qb extends vt{constructor(e,s){super(),this.tokens=e,this.nameManager=s}process(){if(this.tokens.matches1(n.nullishCoalescing)){const i=this.tokens.currentToken();return this.tokens.tokens[i.nullishStartIndex].isAsyncOperation?this.tokens.replaceTokenTrimmingLeftWhitespace(", async () => ("):this.tokens.replaceTokenTrimmingLeftWhitespace(", () => ("),true}if(this.tokens.matches1(n._delete)&&this.tokens.tokenAtRelativeIndex(1).isOptionalChainStart)return this.tokens.removeInitialToken(),true;const s=this.tokens.currentToken().subscriptStartIndex;if(s!=null&&this.tokens.tokens[s].isOptionalChainStart&&this.tokens.tokenAtRelativeIndex(-1).type!==n._super){const i=this.nameManager.claimFreeName("_");let r;if(s>0&&this.tokens.matches1AtIndex(s-1,n._delete)&&this.isLastSubscriptInChain()?r=`${i} => delete ${i}`:r=`${i} => ${i}`,this.tokens.tokens[s].isAsyncOperation&&(r=`async ${r}`),this.tokens.matches2(n.questionDot,n.parenL)||this.tokens.matches2(n.questionDot,n.lessThan))this.justSkippedSuper()&&this.tokens.appendCode(".bind(this)"),this.tokens.replaceTokenTrimmingLeftWhitespace(`, 'optionalCall', ${r}`);else if(this.tokens.matches2(n.questionDot,n.bracketL))this.tokens.replaceTokenTrimmingLeftWhitespace(`, 'optionalAccess', ${r}`);else if(this.tokens.matches1(n.questionDot))this.tokens.replaceTokenTrimmingLeftWhitespace(`, 'optionalAccess', ${r}.`);else if(this.tokens.matches1(n.dot))this.tokens.replaceTokenTrimmingLeftWhitespace(`, 'access', ${r}.`);else if(this.tokens.matches1(n.bracketL))this.tokens.replaceTokenTrimmingLeftWhitespace(`, 'access', ${r}[`);else if(this.tokens.matches1(n.parenL))this.justSkippedSuper()&&this.tokens.appendCode(".bind(this)"),this.tokens.replaceTokenTrimmingLeftWhitespace(`, 'call', ${r}(`);else throw new Error("Unexpected subscript operator in optional chain.");return true}return false}isLastSubscriptInChain(){let e=0;for(let s=this.tokens.currentIndex()+1;;s++){if(s>=this.tokens.tokens.length)throw new Error("Reached the end of the code while finding the end of the access chain.");if(this.tokens.tokens[s].isOptionalChainStart?e++:this.tokens.tokens[s].isOptionalChainEnd&&e--,e<0)return true;if(e===0&&this.tokens.tokens[s].subscriptStartIndex!=null)return false}}justSkippedSuper(){let e=0,s=this.tokens.currentIndex()-1;for(;;){if(s<0)throw new Error("Reached the start of the code while finding the start of the access chain.");if(this.tokens.tokens[s].isOptionalChainStart?e--:this.tokens.tokens[s].isOptionalChainEnd&&e++,e<0)return false;if(e===0&&this.tokens.tokens[s].subscriptStartIndex!=null)return this.tokens.tokens[s-1].type===n._super;s--}}}class Hb extends vt{constructor(e,s,i,r){super(),this.rootTransformer=e,this.tokens=s,this.importProcessor=i,this.options=r}process(){const e=this.tokens.currentIndex();if(this.tokens.identifierName()==="createReactClass"){const s=this.importProcessor&&this.importProcessor.getIdentifierReplacement("createReactClass");return s?this.tokens.replaceToken(`(0, ${s})`):this.tokens.copyToken(),this.tryProcessCreateClassCall(e),true}if(this.tokens.matches3(n.name,n.dot,n.name)&&this.tokens.identifierName()==="React"&&this.tokens.identifierNameAtIndex(this.tokens.currentIndex()+2)==="createClass"){const s=this.importProcessor&&this.importProcessor.getIdentifierReplacement("React")||"React";return s?(this.tokens.replaceToken(s),this.tokens.copyToken(),this.tokens.copyToken()):(this.tokens.copyToken(),this.tokens.copyToken(),this.tokens.copyToken()),this.tryProcessCreateClassCall(e),true}return false}tryProcessCreateClassCall(e){const s=this.findDisplayName(e);s&&this.classNeedsDisplayName()&&(this.tokens.copyExpectedToken(n.parenL),this.tokens.copyExpectedToken(n.braceL),this.tokens.appendCode(`displayName: '${s}',`),this.rootTransformer.processBalancedCode(),this.tokens.copyExpectedToken(n.braceR),this.tokens.copyExpectedToken(n.parenR))}findDisplayName(e){return e<2?null:this.tokens.matches2AtIndex(e-2,n.name,n.eq)?this.tokens.identifierNameAtIndex(e-2):e>=2&&this.tokens.tokens[e-2].identifierRole===ie.ObjectKey?this.tokens.identifierNameAtIndex(e-2):this.tokens.matches2AtIndex(e-2,n._export,n._default)?this.getDisplayNameFromFilename():null}getDisplayNameFromFilename(){const s=(this.options.filePath||"unknown").split("/"),i=s[s.length-1],r=i.lastIndexOf("."),o=r===-1?i:i.slice(0,r);return o==="index"&&s[s.length-2]?s[s.length-2]:o}classNeedsDisplayName(){let e=this.tokens.currentIndex();if(!this.tokens.matches2(n.parenL,n.braceL))return false;const s=e+1,i=this.tokens.tokens[s].contextId;if(i==null)throw new Error("Expected non-null context ID on object open-brace.");for(;e<this.tokens.tokens.length;e++){const r=this.tokens.tokens[e];if(r.type===n.braceR&&r.contextId===i){e++;break}if(this.tokens.identifierNameAtIndex(e)==="displayName"&&this.tokens.tokens[e].identifierRole===ie.ObjectKey&&r.contextId===i)return false}if(e===this.tokens.tokens.length)throw new Error("Unexpected end of input when processing React class.");return this.tokens.matches1AtIndex(e,n.parenR)||this.tokens.matches2AtIndex(e,n.comma,n.parenR)}}class ka extends vt{__init(){this.extractedDefaultExportName=null}constructor(e,s){super(),this.tokens=e,this.filePath=s,ka.prototype.__init.call(this)}setExtractedDefaultExportName(e){this.extractedDefaultExportName=e}getPrefixCode(){return`
593
593
  (function () {
594
594
  var enterModule = require('react-hot-loader').enterModule;
595
595
  enterModule && enterModule(module);
@@ -603,14 +603,14 @@ module.exports = exports.default;
603
603
  ${s.map(({variableName:i,uniqueLocalName:r})=>` reactHotLoader.register(${i}, "${r}", ${JSON.stringify(this.filePath||"")});`).join(`
604
604
  `)}
605
605
  leaveModule(module);
606
- })();`}process(){return false}}const Gb=new Set(["break","case","catch","class","const","continue","debugger","default","delete","do","else","export","extends","finally","for","function","if","import","in","instanceof","new","return","super","switch","this","throw","try","typeof","var","void","while","with","yield","enum","implements","interface","let","package","private","protected","public","static","await","false","null","true"]);function jc(t){if(t.length===0||!vi[t.charCodeAt(0)])return false;for(let e=1;e<t.length;e++)if(!_t[t.charCodeAt(e)])return false;return!Gb.has(t)}class Wb extends vt{constructor(e,s,i){super(),this.rootTransformer=e,this.tokens=s,this.isImportsTransformEnabled=i}process(){return this.rootTransformer.processPossibleArrowParamEnd()||this.rootTransformer.processPossibleAsyncArrowWithTypeParams()||this.rootTransformer.processPossibleTypeRange()?true:this.tokens.matches1(n._public)||this.tokens.matches1(n._protected)||this.tokens.matches1(n._private)||this.tokens.matches1(n._abstract)||this.tokens.matches1(n._readonly)||this.tokens.matches1(n._override)||this.tokens.matches1(n.nonNullAssertion)?(this.tokens.removeInitialToken(),true):this.tokens.matches1(n._enum)||this.tokens.matches2(n._const,n._enum)?(this.processEnum(),true):this.tokens.matches2(n._export,n._enum)||this.tokens.matches3(n._export,n._const,n._enum)?(this.processEnum(true),true):false}processEnum(e=false){for(this.tokens.removeInitialToken();this.tokens.matches1(n._const)||this.tokens.matches1(n._enum);)this.tokens.removeToken();const s=this.tokens.identifierName();this.tokens.removeToken(),e&&!this.isImportsTransformEnabled&&this.tokens.appendCode("export "),this.tokens.appendCode(`var ${s}; (function (${s})`),this.tokens.copyExpectedToken(n.braceL),this.processEnumBody(s),this.tokens.copyExpectedToken(n.braceR),e&&this.isImportsTransformEnabled?this.tokens.appendCode(`)(${s} || (exports.${s} = ${s} = {}));`):this.tokens.appendCode(`)(${s} || (${s} = {}));`)}processEnumBody(e){let s=null;for(;!this.tokens.matches1(n.braceR);){const{nameStringCode:i,variableName:r}=this.extractEnumKeyInfo(this.tokens.currentToken());this.tokens.removeInitialToken(),this.tokens.matches3(n.eq,n.string,n.comma)||this.tokens.matches3(n.eq,n.string,n.braceR)?this.processStringLiteralEnumMember(e,i,r):this.tokens.matches1(n.eq)?this.processExplicitValueEnumMember(e,i,r):this.processImplicitValueEnumMember(e,i,r,s),this.tokens.matches1(n.comma)&&this.tokens.removeToken(),r!=null?s=r:s=`${e}[${i}]`}}extractEnumKeyInfo(e){if(e.type===n.name){const s=this.tokens.identifierNameForToken(e);return{nameStringCode:`"${s}"`,variableName:jc(s)?s:null}}else if(e.type===n.string){const s=this.tokens.stringValueForToken(e);return{nameStringCode:this.tokens.code.slice(e.start,e.end),variableName:jc(s)?s:null}}else throw new Error("Expected name or string at beginning of enum element.")}processStringLiteralEnumMember(e,s,i){i!=null?(this.tokens.appendCode(`const ${i}`),this.tokens.copyToken(),this.tokens.copyToken(),this.tokens.appendCode(`; ${e}[${s}] = ${i};`)):(this.tokens.appendCode(`${e}[${s}]`),this.tokens.copyToken(),this.tokens.copyToken(),this.tokens.appendCode(";"))}processExplicitValueEnumMember(e,s,i){const r=this.tokens.currentToken().rhsEndIndex;if(r==null)throw new Error("Expected rhsEndIndex on enum assign.");if(i!=null){for(this.tokens.appendCode(`const ${i}`),this.tokens.copyToken();this.tokens.currentIndex()<r;)this.rootTransformer.processToken();this.tokens.appendCode(`; ${e}[${e}[${s}] = ${i}] = ${s};`)}else{for(this.tokens.appendCode(`${e}[${e}[${s}]`),this.tokens.copyToken();this.tokens.currentIndex()<r;)this.rootTransformer.processToken();this.tokens.appendCode(`] = ${s};`)}}processImplicitValueEnumMember(e,s,i,r){let a=r!=null?`${r} + 1`:"0";i!=null&&(this.tokens.appendCode(`const ${i} = ${a}; `),a=i),this.tokens.appendCode(`${e}[${e}[${s}] = ${a}] = ${s};`)}}class ur{__init(){this.transformers=[]}__init2(){this.generatedVariables=[]}constructor(e,s,i,r){ur.prototype.__init.call(this),ur.prototype.__init2.call(this),this.nameManager=e.nameManager,this.helperManager=e.helperManager;const{tokenProcessor:a,importProcessor:o}=e;this.tokens=a,this.isImportsTransformEnabled=s.includes("imports"),this.isReactHotLoaderTransformEnabled=s.includes("react-hot-loader"),this.disableESTransforms=!!r.disableESTransforms,r.disableESTransforms||(this.transformers.push(new qb(a,this.nameManager)),this.transformers.push(new $b(a)),this.transformers.push(new jb(a,this.nameManager))),s.includes("jsx")&&(r.jsxRuntime!=="preserve"&&this.transformers.push(new ds(this,a,o,this.nameManager,r)),this.transformers.push(new Hb(this,a,o,r)));let c=null;if(s.includes("react-hot-loader")){if(!r.filePath)throw new Error("filePath is required when using the react-hot-loader transform.");c=new ko(a,r.filePath),this.transformers.push(c)}if(s.includes("imports")){if(o===null)throw new Error("Expected non-null importProcessor with imports transform enabled.");this.transformers.push(new si(this,a,o,this.nameManager,this.helperManager,c,i,!!r.enableLegacyTypeScriptModuleInterop,s.includes("typescript"),s.includes("flow"),!!r.preserveDynamicImport,!!r.keepUnusedImports))}else this.transformers.push(new Mb(a,this.nameManager,this.helperManager,c,s.includes("typescript"),s.includes("flow"),!!r.keepUnusedImports,r));s.includes("flow")&&this.transformers.push(new Bb(this,a,s.includes("imports"))),s.includes("typescript")&&this.transformers.push(new Wb(this,a,s.includes("imports"))),s.includes("jest")&&this.transformers.push(new xo(this,a,this.nameManager,o))}transform(){this.tokens.reset(),this.processBalancedCode();let s=this.isImportsTransformEnabled?'"use strict";':"";for(const o of this.transformers)s+=o.getPrefixCode();s+=this.helperManager.emitHelpers(),s+=this.generatedVariables.map(o=>` var ${o};`).join("");for(const o of this.transformers)s+=o.getHoistedCode();let i="";for(const o of this.transformers)i+=o.getSuffixCode();const r=this.tokens.finish();let{code:a}=r;if(a.startsWith("#!")){let o=a.indexOf(`
607
- `);return o===-1&&(o=a.length,a+=`
608
- `),{code:a.slice(0,o+1)+s+a.slice(o+1)+i,mappings:this.shiftMappings(r.mappings,s.length)}}else return{code:s+a+i,mappings:this.shiftMappings(r.mappings,s.length)}}processBalancedCode(){let e=0,s=0;for(;!this.tokens.isAtEnd();){if(this.tokens.matches1(n.braceL)||this.tokens.matches1(n.dollarBraceL))e++;else if(this.tokens.matches1(n.braceR)){if(e===0)return;e--}if(this.tokens.matches1(n.parenL))s++;else if(this.tokens.matches1(n.parenR)){if(s===0)return;s--}this.processToken()}}processToken(){if(this.tokens.matches1(n._class)){this.processClass();return}for(const e of this.transformers)if(e.process())return;this.tokens.copyToken()}processNamedClass(){if(!this.tokens.matches2(n._class,n.name))throw new Error("Expected identifier for exported class name.");const e=this.tokens.identifierNameAtIndex(this.tokens.currentIndex()+1);return this.processClass(),e}processClass(){const e=Nb(this,this.tokens,this.nameManager,this.disableESTransforms),s=(e.headerInfo.isExpression||!e.headerInfo.className)&&e.staticInitializerNames.length+e.instanceInitializerNames.length>0;let i=e.headerInfo.className;s&&(i=this.nameManager.claimFreeName("_class"),this.generatedVariables.push(i),this.tokens.appendCode(` (${i} =`));const a=this.tokens.currentToken().contextId;if(a==null)throw new Error("Expected class to have a context ID.");for(this.tokens.copyExpectedToken(n._class);!this.tokens.matchesContextIdAndLabel(n.braceL,a);)this.processToken();this.processClassBody(e,i);const o=e.staticInitializerNames.map(c=>`${i}.${c}()`);s?this.tokens.appendCode(`, ${o.map(c=>`${c}, `).join("")}${i})`):e.staticInitializerNames.length>0&&this.tokens.appendCode(` ${o.map(c=>`${c};`).join(" ")}`)}processClassBody(e,s){const{headerInfo:i,constructorInsertPos:r,constructorInitializerStatements:a,fields:o,instanceInitializerNames:c,rangesToRemove:l}=e;let h=0,d=0;const m=this.tokens.currentToken().contextId;if(m==null)throw new Error("Expected non-null context ID on class.");this.tokens.copyExpectedToken(n.braceL),this.isReactHotLoaderTransformEnabled&&this.tokens.appendCode("__reactstandin__regenerateByEval(key, code) {this[key] = eval(code);}");const _=a.length+c.length>0;if(r===null&&_){const x=this.makeConstructorInitCode(a,c,s);if(i.hasSuperclass){const E=this.nameManager.claimFreeName("args");this.tokens.appendCode(`constructor(...${E}) { super(...${E}); ${x}; }`)}else this.tokens.appendCode(`constructor() { ${x}; }`)}for(;!this.tokens.matchesContextIdAndLabel(n.braceR,m);)if(h<o.length&&this.tokens.currentIndex()===o[h].start){let x=false;for(this.tokens.matches1(n.bracketL)?this.tokens.copyTokenWithPrefix(`${o[h].initializerName}() {this`):this.tokens.matches1(n.string)||this.tokens.matches1(n.num)?(this.tokens.copyTokenWithPrefix(`${o[h].initializerName}() {this[`),x=true):this.tokens.copyTokenWithPrefix(`${o[h].initializerName}() {this.`);this.tokens.currentIndex()<o[h].end;)x&&this.tokens.currentIndex()===o[h].equalsIndex&&this.tokens.appendCode("]"),this.processToken();this.tokens.appendCode("}"),h++}else if(d<l.length&&this.tokens.currentIndex()>=l[d].start){for(this.tokens.currentIndex()<l[d].end&&this.tokens.removeInitialToken();this.tokens.currentIndex()<l[d].end;)this.tokens.removeToken();d++}else this.tokens.currentIndex()===r?(this.tokens.copyToken(),_&&this.tokens.appendCode(`;${this.makeConstructorInitCode(a,c,s)};`),this.processToken()):this.processToken();this.tokens.copyExpectedToken(n.braceR)}makeConstructorInitCode(e,s,i){return[...e,...s.map(r=>`${i}.prototype.${r}.call(this)`)].join(";")}processPossibleArrowParamEnd(){if(this.tokens.matches2(n.parenR,n.colon)&&this.tokens.tokenAtRelativeIndex(1).isType){let e=this.tokens.currentIndex()+1;for(;this.tokens.tokens[e].isType;)e++;if(this.tokens.matches1AtIndex(e,n.arrow)){for(this.tokens.removeInitialToken();this.tokens.currentIndex()<e;)this.tokens.removeToken();return this.tokens.replaceTokenTrimmingLeftWhitespace(") =>"),true}}return false}processPossibleAsyncArrowWithTypeParams(){if(!this.tokens.matchesContextual(g._async)&&!this.tokens.matches1(n._async))return false;const e=this.tokens.tokenAtRelativeIndex(1);if(e.type!==n.lessThan||!e.isType)return false;let s=this.tokens.currentIndex()+1;for(;this.tokens.tokens[s].isType;)s++;if(this.tokens.matches1AtIndex(s,n.parenL)){for(this.tokens.replaceToken("async ("),this.tokens.removeInitialToken();this.tokens.currentIndex()<s;)this.tokens.removeToken();return this.tokens.removeToken(),this.processBalancedCode(),this.processToken(),true}return false}processPossibleTypeRange(){if(this.tokens.currentToken().isType){for(this.tokens.removeInitialToken();this.tokens.currentToken().isType;)this.tokens.removeToken();return true}return false}shiftMappings(e,s){for(let i=0;i<e.length;i++){const r=e[i];r!==void 0&&(e[i]=r+s)}return e}}var Xb={};(function(t){t.__esModule=true,t.LinesAndColumns=void 0;var e=`
609
- `,s="\r",i=function(){function r(a){this.string=a;for(var o=[0],c=0;c<a.length;)switch(a[c]){case e:c+=e.length,o.push(c);break;case s:c+=s.length,a[c]===e&&(c+=e.length),o.push(c);break;default:c++;break}this.offsets=o}return r.prototype.locationForIndex=function(a){if(a<0||a>this.string.length)return null;for(var o=0,c=this.offsets;c[o+1]<=a;)o++;var l=a-c[o];return{line:o,column:l}},r.prototype.indexForLocation=function(a){var o=a.line,c=a.column;return o<0||o>=this.offsets.length||c<0||c>this.lengthOfLine(o)?null:this.offsets[o]+c},r.prototype.lengthOfLine=function(a){var o=this.offsets[a],c=a===this.offsets.length-1?this.string.length:this.offsets[a+1];return c-o},r}();t.LinesAndColumns=i,t.default=i})(Xb);function zb(t){const e=new Set;for(let s=0;s<t.tokens.length;s++)t.matches1AtIndex(s,n._import)&&!t.matches3AtIndex(s,n._import,n.name,n.eq)&&Yb(t,s,e);return e}function Yb(t,e,s){e++,!t.matches1AtIndex(e,n.parenL)&&(t.matches1AtIndex(e,n.name)&&(s.add(t.identifierNameAtIndex(e)),e++,t.matches1AtIndex(e,n.comma)&&e++),t.matches1AtIndex(e,n.star)&&(e+=2,s.add(t.identifierNameAtIndex(e)),e++),t.matches1AtIndex(e,n.braceL)&&(e++,Kb(t,e,s)))}function Kb(t,e,s){for(;;){if(t.matches1AtIndex(e,n.braceR))return;const i=hi(t,e);if(e=i.endIndex,i.isType||s.add(i.rightName),t.matches2AtIndex(e,n.comma,n.braceR))return;if(t.matches1AtIndex(e,n.braceR))return;if(t.matches1AtIndex(e,n.comma))e++;else throw new Error(`Unexpected token: ${JSON.stringify(t.tokens[e])}`)}}function Zb(t,e){dm(e);try{const s=Qb(t,e),r=new ur(s,e.transforms,!!e.enableLegacyBabel5ModuleInterop,e).transform();let a={code:r.code};if(e.sourceMapOptions){if(!e.filePath)throw new Error("filePath must be specified when generating a source map.");a={...a,sourceMap:Jp(r,e.filePath,e.sourceMapOptions,t,s.tokenProcessor.tokens)}}return a}catch(s){throw e.filePath&&(s.message=`Error transforming ${e.filePath}: ${s.message}`),s}}function Qb(t,e){const s=e.transforms.includes("jsx"),i=e.transforms.includes("typescript"),r=e.transforms.includes("flow"),a=e.disableESTransforms===true,o=Lb(t,s,i,r),c=o.tokens,l=o.scopes,h=new Ka(t,c),d=new tr(h),m=new ti(t,c,r,a,d),_=!!e.enableLegacyTypeScriptModuleInterop;let x=null;return e.transforms.includes("imports")?(x=new ps(h,m,_,e,e.transforms.includes("typescript"),!!e.keepUnusedImports,d),x.preprocessTokens(),Cc(m,l,x.getGlobalNames()),e.transforms.includes("typescript")&&!e.keepUnusedImports&&x.pruneTypeOnlyImports()):e.transforms.includes("typescript")&&!e.keepUnusedImports&&Cc(m,l,zb(m)),{tokenProcessor:m,scopes:l,nameManager:h,importProcessor:x,helperManager:d}}function ka(t){return t instanceof Uint8Array||ArrayBuffer.isView(t)&&t.constructor.name==="Uint8Array"&&"BYTES_PER_ELEMENT"in t&&t.BYTES_PER_ELEMENT===1}const lr=t=>t?`"${t}" `:"";function wa(t,e=""){if(typeof t!="boolean")throw new TypeError(lr(e)+"expected boolean, got type="+typeof t);return t}function Us(t,e=""){if(typeof t!="number")throw new TypeError(lr(e)+"expected number, got "+typeof t);if(!Number.isSafeInteger(t)||t<0)throw new RangeError(lr(e)+"expected integer >= 0, got "+t);return t}function Ue(t,e,s=""){if(ka(t)&&(e===void 0||t.length===e))return t;e!==void 0&&Us(e,"length");const i=ka(t),r=e!==void 0?` of length ${e}`:"",a=i?`length=${t.length}`:`type=${typeof t}`,o=lr(s)+"expected Uint8Array"+r+", got "+a;throw i?new RangeError(o):new TypeError(o)}const qc=(t,e)=>{if(t===null||typeof t!="object"||Array.isArray(t))throw new TypeError(e==="object"?"expected valid options object":`"${e}" expected object, got type=${typeof t}`)};function Hc(t,e=true){if(t.destroyed)throw new Error("hash was destroyed");if(e&&t.finished)throw new Error("digest() was already called")}function Jb(t,e){Ue(t,void 0,"output");const s=e.outputLen;if(!(t.length>=s))throw new RangeError('"output" expected length >= '+s)}function Ht(t){return new Uint32Array(t.buffer,t.byteOffset,Math.floor(t.byteLength/4))}function Lt(...t){for(let e=0;e<t.length;e++)t[e].fill(0)}function ey(t){return new DataView(t.buffer,t.byteOffset,t.byteLength)}const It=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function ty(t){return t<<24&4278190080|t<<8&16711680|t>>>8&65280|t>>>24&255}function sy(t){for(let e=0;e<t.length;e++)t[e]=ty(t[e]);return t}const gt=It?t=>t:sy;function iy(t,e){return qc(t,"defaults"),qc(e,"opts"),Object.assign(t,e)}function ry(t,e){if(t=Ue(t),e=Ue(e),t.length!==e.length)return false;let s=0;for(let i=0;i<t.length;i++)s|=t[i]^e[i];return s===0}function ny(t,e,s){const i=e,r=()=>[],a=(c,l)=>i(l,...r(c)).update(c).digest(),o=i(new Uint8Array(t),...r(new Uint8Array(0)));return a.outputLen=o.outputLen,a.blockLen=o.blockLen,a.create=(c,...l)=>i(c,...l),a}const ay=(t,e)=>{function s(i,...r){if(Ue(i,void 0,"key"),t.nonceLength!==void 0){const m=r[0];Ue(m,t.varSizeNonce?void 0:t.nonceLength,"nonce")}const a=t.tagLength,o=t.nonceLength!==void 0?1:0;if(!t.withAAD){for(let m=o;m<r.length;m++)if(ka(r[m]))throw new Error("AAD not supported")}t.withAAD&&r[o]!==void 0&&Ue(r[o],void 0,"AAD");const c=e(i,...r),l=(m,_)=>{if(_!==void 0){if(m!==2)throw new Error("cipher output not supported");Ue(_,void 0,"output")}};let h=false;return{encrypt(m,_){if(h)throw new Error("cannot encrypt() twice with same key + nonce");return h=true,Ue(m,void 0,"data"),l(c.encrypt.length,_),c.encrypt(m,_)},decrypt(m,_){if(Ue(m,void 0,"data"),a&&m.length<a)throw new Error('"ciphertext" expected length >= tagLength='+a);return l(c.decrypt.length,_),c.decrypt(m,_)}}}return Object.assign(s,t),s};function Sa(t,e,s=true){if(e===void 0)return new Uint8Array(t);if(Ue(e,t,"output"),s&&!hr(e))throw new Error("invalid output, must be aligned");return e}function oy(t,e,s){Us(t),Us(e),wa(s);const i=new Uint8Array(16),r=ey(i);return r.setBigUint64(0,BigInt(e),s),r.setBigUint64(8,BigInt(t),s),i}function hr(t){return t.byteOffset%4===0}function fr(t){return Uint8Array.from(Ue(t))}const U1=t=>Uint8Array.from(t.split(""),e=>e.charCodeAt(0)),cy=gt(Ht(U1("expand 16-byte k"))),uy=gt(Ht(U1("expand 32-byte k")));function ve(t,e){return t<<e|t>>>32-e}const Ks=64,ly=16,Ea=2**32-1,Gc=Uint32Array.of();function hy(t,e,s,i,r,a,o,c){const l=r.length,h=new Uint8Array(Ks),d=Ht(h),m=It&&hr(r)&&hr(a),_=m?Ht(r):Gc,x=m?Ht(a):Gc;if(!It){for(let E=0;E<l;o++){if(t(e,s,i,d,o,c),gt(d),o>=Ea)throw new Error("arx: counter overflow");const N=Math.min(Ks,l-E);for(let F=0,U;F<N;F++)U=E+F,a[U]=r[U]^h[F];E+=N}return}for(let E=0;E<l;o++){if(t(e,s,i,d,o,c),o>=Ea)throw new Error("arx: counter overflow");const N=Math.min(Ks,l-E);if(m&&N===Ks){const F=E/4;if(E%4!==0)throw new Error("arx: invalid block position");for(let U=0,P;U<ly;U++)P=F+U,x[P]=_[P]^d[U];E+=Ks;continue}for(let F=0,U;F<N;F++)U=E+F,a[U]=r[U]^h[F];E+=N}}function fy(t,e){const{allowShortKeys:s,extendNonceFn:i,counterLength:r,counterRight:a,rounds:o}=iy({allowShortKeys:false,counterLength:8,counterRight:false,rounds:20},e);if(typeof t!="function")throw new Error("core must be a function");return Us(r),Us(o),wa(a),wa(s),(c,l,h,d,m=0)=>{Ue(c,void 0,"key"),Ue(l,void 0,"nonce"),Ue(h,void 0,"data");const _=h.length;if(d=Sa(_,d,false),Us(m),m<0||m>=Ea)throw new Error("arx: counter overflow");const x=[];let E=c.length,N,F;if(E===32)x.push(N=fr(c)),F=uy;else if(E===16&&s)N=new Uint8Array(32),N.set(c),N.set(c,16),F=cy,x.push(N);else throw Ue(c,32,"arx key"),new Error("invalid key size");(!It||!hr(l))&&x.push(l=fr(l));let U=Ht(N);if(i){if(l.length!==24)throw new Error("arx: extended nonce must be 24 bytes");const $=l.subarray(0,16);if(It)i(F,U,Ht($),U);else{const te=gt(Uint32Array.from(F));i(te,U,Ht($),U),Lt(te),gt(U)}l=l.subarray(16)}else It||gt(U);const P=16-r;if(P!==l.length)throw new Error(`arx: nonce must be ${P} or 16 bytes`);if(P!==12){const $=new Uint8Array(12);$.set(l,a?0:12-l.length),l=$,x.push(l)}const X=gt(Ht(l));try{return hy(t,F,U,X,h,d,m,o),d}finally{Lt(...x)}}}function Oe(t,e){return t[e++]&255|(t[e++]&255)<<8}class dy{blockLen=16;outputLen=16;buffer=new Uint8Array(16);r=new Uint16Array(10);h=new Uint16Array(10);pad=new Uint16Array(8);pos=0;finished=false;destroyed=false;constructor(e){e=fr(Ue(e,32,"key"));const s=Oe(e,0),i=Oe(e,2),r=Oe(e,4),a=Oe(e,6),o=Oe(e,8),c=Oe(e,10),l=Oe(e,12),h=Oe(e,14);this.r[0]=s&8191,this.r[1]=(s>>>13|i<<3)&8191,this.r[2]=(i>>>10|r<<6)&7939,this.r[3]=(r>>>7|a<<9)&8191,this.r[4]=(a>>>4|o<<12)&255,this.r[5]=o>>>1&8190,this.r[6]=(o>>>14|c<<2)&8191,this.r[7]=(c>>>11|l<<5)&8065,this.r[8]=(l>>>8|h<<8)&8191,this.r[9]=h>>>5&127;for(let d=0;d<8;d++)this.pad[d]=Oe(e,16+2*d)}process(e,s,i=false){const r=i?0:2048,{h:a,r:o}=this,c=o[0],l=o[1],h=o[2],d=o[3],m=o[4],_=o[5],x=o[6],E=o[7],N=o[8],F=o[9],U=Oe(e,s+0),P=Oe(e,s+2),X=Oe(e,s+4),$=Oe(e,s+6),te=Oe(e,s+8),ee=Oe(e,s+10),Q=Oe(e,s+12),z=Oe(e,s+14);let ne=a[0]+(U&8191),v=a[1]+((U>>>13|P<<3)&8191),y=a[2]+((P>>>10|X<<6)&8191),k=a[3]+((X>>>7|$<<9)&8191),V=a[4]+(($>>>4|te<<12)&8191),G=a[5]+(te>>>1&8191),B=a[6]+((te>>>14|ee<<2)&8191),R=a[7]+((ee>>>11|Q<<5)&8191),O=a[8]+((Q>>>8|z<<8)&8191),M=a[9]+(z>>>5|r),C=0,H=C+ne*c+v*(5*F)+y*(5*N)+k*(5*E)+V*(5*x);C=H>>>13,H&=8191,H+=G*(5*_)+B*(5*m)+R*(5*d)+O*(5*h)+M*(5*l),C+=H>>>13,H&=8191;let W=C+ne*l+v*c+y*(5*F)+k*(5*N)+V*(5*E);C=W>>>13,W&=8191,W+=G*(5*x)+B*(5*_)+R*(5*m)+O*(5*d)+M*(5*h),C+=W>>>13,W&=8191;let J=C+ne*h+v*l+y*c+k*(5*F)+V*(5*N);C=J>>>13,J&=8191,J+=G*(5*E)+B*(5*x)+R*(5*_)+O*(5*m)+M*(5*d),C+=J>>>13,J&=8191;let ce=C+ne*d+v*h+y*l+k*c+V*(5*F);C=ce>>>13,ce&=8191,ce+=G*(5*N)+B*(5*E)+R*(5*x)+O*(5*_)+M*(5*m),C+=ce>>>13,ce&=8191;let oe=C+ne*m+v*d+y*h+k*l+V*c;C=oe>>>13,oe&=8191,oe+=G*(5*F)+B*(5*N)+R*(5*E)+O*(5*x)+M*(5*_),C+=oe>>>13,oe&=8191;let w=C+ne*_+v*m+y*d+k*h+V*l;C=w>>>13,w&=8191,w+=G*c+B*(5*F)+R*(5*N)+O*(5*E)+M*(5*x),C+=w>>>13,w&=8191;let T=C+ne*x+v*_+y*m+k*d+V*h;C=T>>>13,T&=8191,T+=G*l+B*c+R*(5*F)+O*(5*N)+M*(5*E),C+=T>>>13,T&=8191;let D=C+ne*E+v*x+y*_+k*m+V*d;C=D>>>13,D&=8191,D+=G*h+B*l+R*c+O*(5*F)+M*(5*N),C+=D>>>13,D&=8191;let L=C+ne*N+v*E+y*x+k*_+V*m;C=L>>>13,L&=8191,L+=G*d+B*h+R*l+O*c+M*(5*F),C+=L>>>13,L&=8191;let j=C+ne*F+v*N+y*E+k*x+V*_;C=j>>>13,j&=8191,j+=G*m+B*d+R*h+O*l+M*c,C+=j>>>13,j&=8191,C=(C<<2)+C|0,C=C+H|0,H=C&8191,C=C>>>13,W+=C,a[0]=H,a[1]=W,a[2]=J,a[3]=ce,a[4]=oe,a[5]=w,a[6]=T,a[7]=D,a[8]=L,a[9]=j}finalize(){const{h:e,pad:s}=this,i=new Uint16Array(10);let r=e[1]>>>13;e[1]&=8191;for(let c=2;c<10;c++)e[c]+=r,r=e[c]>>>13,e[c]&=8191;e[0]+=r*5,r=e[0]>>>13,e[0]&=8191,e[1]+=r,r=e[1]>>>13,e[1]&=8191,e[2]+=r,i[0]=e[0]+5,r=i[0]>>>13,i[0]&=8191;for(let c=1;c<10;c++)i[c]=e[c]+r,r=i[c]>>>13,i[c]&=8191;i[9]-=8192;let a=(r^1)-1;for(let c=0;c<10;c++)i[c]&=a;a=~a;for(let c=0;c<10;c++)e[c]=e[c]&a|i[c];e[0]=(e[0]|e[1]<<13)&65535,e[1]=(e[1]>>>3|e[2]<<10)&65535,e[2]=(e[2]>>>6|e[3]<<7)&65535,e[3]=(e[3]>>>9|e[4]<<4)&65535,e[4]=(e[4]>>>12|e[5]<<1|e[6]<<14)&65535,e[5]=(e[6]>>>2|e[7]<<11)&65535,e[6]=(e[7]>>>5|e[8]<<8)&65535,e[7]=(e[8]>>>8|e[9]<<5)&65535;let o=e[0]+s[0];e[0]=o&65535;for(let c=1;c<8;c++)o=(e[c]+s[c]|0)+(o>>>16)|0,e[c]=o&65535;Lt(i)}update(e){Hc(this),Ue(e),e=fr(e);const{buffer:s,blockLen:i}=this,r=e.length;for(let a=0;a<r;){const o=Math.min(i-this.pos,r-a);if(o===i){for(;i<=r-a;a+=i)this.process(e,a);continue}s.set(e.subarray(a,a+o),this.pos),this.pos+=o,a+=o,this.pos===i&&(this.process(s,0,false),this.pos=0)}return this}destroy(){this.destroyed=true,Lt(this.h,this.r,this.buffer,this.pad)}digestInto(e){Hc(this),Jb(e,this),this.finished=true;const{buffer:s,h:i}=this;let{pos:r}=this;if(r){for(s[r++]=1;r<16;r++)s[r]=0;this.process(s,0,true)}this.finalize();let a=0;for(let o=0;o<8;o++)e[a++]=i[o]>>>0,e[a++]=i[o]>>>8}digest(){const{buffer:e,outputLen:s}=this;this.digestInto(e);const i=e.slice(0,s);return this.destroy(),i}}const py=ny(32,t=>new dy(t));function M1(t,e,s,i,r,a=20){let o=t[0],c=t[1],l=t[2],h=t[3],d=e[0],m=e[1],_=e[2],x=e[3],E=e[4],N=e[5],F=e[6],U=e[7],P=r,X=s[0],$=s[1],te=s[2],ee=o,Q=c,z=l,ne=h,v=d,y=m,k=_,V=x,G=E,B=N,R=F,O=U,M=P,C=X,H=$,W=te;for(let ce=0;ce<a;ce+=2)ee=ee+v|0,M=ve(M^ee,16),G=G+M|0,v=ve(v^G,12),ee=ee+v|0,M=ve(M^ee,8),G=G+M|0,v=ve(v^G,7),Q=Q+y|0,C=ve(C^Q,16),B=B+C|0,y=ve(y^B,12),Q=Q+y|0,C=ve(C^Q,8),B=B+C|0,y=ve(y^B,7),z=z+k|0,H=ve(H^z,16),R=R+H|0,k=ve(k^R,12),z=z+k|0,H=ve(H^z,8),R=R+H|0,k=ve(k^R,7),ne=ne+V|0,W=ve(W^ne,16),O=O+W|0,V=ve(V^O,12),ne=ne+V|0,W=ve(W^ne,8),O=O+W|0,V=ve(V^O,7),ee=ee+y|0,W=ve(W^ee,16),R=R+W|0,y=ve(y^R,12),ee=ee+y|0,W=ve(W^ee,8),R=R+W|0,y=ve(y^R,7),Q=Q+k|0,M=ve(M^Q,16),O=O+M|0,k=ve(k^O,12),Q=Q+k|0,M=ve(M^Q,8),O=O+M|0,k=ve(k^O,7),z=z+V|0,C=ve(C^z,16),G=G+C|0,V=ve(V^G,12),z=z+V|0,C=ve(C^z,8),G=G+C|0,V=ve(V^G,7),ne=ne+v|0,H=ve(H^ne,16),B=B+H|0,v=ve(v^B,12),ne=ne+v|0,H=ve(H^ne,8),B=B+H|0,v=ve(v^B,7);let J=0;i[J++]=o+ee|0,i[J++]=c+Q|0,i[J++]=l+z|0,i[J++]=h+ne|0,i[J++]=d+v|0,i[J++]=m+y|0,i[J++]=_+k|0,i[J++]=x+V|0,i[J++]=E+G|0,i[J++]=N+B|0,i[J++]=F+R|0,i[J++]=U+O|0,i[J++]=P+M|0,i[J++]=X+C|0,i[J++]=$+H|0,i[J++]=te+W|0}function my(t,e,s,i){const r=It?t:gt(t.slice(0,4)),a=It?e:gt(e.slice(0,8)),o=It?s:gt(s.slice(0,4)),c=new Uint32Array(16);M1(r,a,o.subarray(1),c,o[0]);let l=0;i[l++]=c[0]-r[0]|0,i[l++]=c[1]-r[1]|0,i[l++]=c[2]-r[2]|0,i[l++]=c[3]-r[3]|0,i[l++]=c[12]-o[0]|0,i[l++]=c[13]-o[1]|0,i[l++]=c[14]-o[2]|0,i[l++]=c[15]-o[3]|0,gt(i),It||Lt(r,a,o),Lt(c)}const gy=fy(M1,{counterRight:false,counterLength:8,extendNonceFn:my,allowShortKeys:false}),by=new Uint8Array(16),Wc=(t,e)=>{t.update(e);const s=e.length%16;s&&t.update(by.subarray(s))},yy=new Uint8Array(32);function Xc(t,e,s,i,r){r!==void 0&&Ue(r,void 0,"AAD");const a=t(e,s,yy),o=oy(i.length,r?r.length:0,true),c=py.create(a);r&&Wc(c,r),Wc(c,i),c.update(o);const l=c.digest();return Lt(a,o),l}const _y=t=>(e,s,i)=>({encrypt(a,o){const c=a.length;o=Sa(c+16,o,false),o.set(a);const l=o.subarray(0,-16);t(e,s,l,l,1);const h=Xc(t,e,s,l,i);return o.set(h,c),Lt(h),o},decrypt(a,o){o=Sa(a.length-16,o,false);const c=a.subarray(0,-16),l=a.subarray(-16),h=Xc(t,e,s,c,i);if(!ry(l,h))throw Lt(h),new Error("invalid tag");return o.set(a.subarray(0,-16)),t(e,s,o,o,1),Lt(h),o}}),vy=ay({blockSize:64,nonceLength:24,tagLength:16,withAAD:true},_y(gy));function xy(t,e,s){return xr(t),s===void 0&&(s=new Uint8Array(t.outputLen)),ja(t,s,e)}const Xn=Uint8Array.of(0),zc=Uint8Array.of();function ky(t,e,s,i=32){xr(t),us(i,"length"),zt(e,void 0,"prk");const r=t.outputLen;if(e.length<r)throw new Error('"prk" must be at least HashLen octets');if(i>255*r)throw new Error("Length must be <= 255*HashLen");const a=Math.ceil(i/r);s===void 0?s=zc:zt(s,void 0,"info");const o=new Uint8Array(a*r),c=ja.create(t,e),l=c._cloneInto(),h=new Uint8Array(c.outputLen);for(let d=0;d<a;d++)Xn[0]=d+1,l.update(d===0?zc:h).update(s).update(Xn).digestInto(h),o.set(h,r*d),c._cloneInto(l);return c.destroy(),l.destroy(),ai(h,Xn),o.slice(0,i)}const wy=(t,e,s,i,r)=>ky(t,xy(t,e,s),i,r),Sy="viji-enc:",Yc="viji-enc:v1:",Ey="viji-enc:v1",zn=24,Ty=16,Kc=new Uint8Array([224,50,225,138,167,25,229,194,14,250,248,86,248,204,11,44,195,247,74,184,14,218,196,108,241,52,118,61,221,57,106,31]),Ay=new Uint8Array([82,90,117,206,53,86,209,181,176,177,126,23,140,253,33,242,212,132,84,23,243,195,189,90,217,131,25,10,37,241,167,245]);function Cy(){const t=new Uint8Array(Kc.length);for(let e=0;e<t.length;e++)t[e]=Kc[e]^Ay[e];return t}class Ps extends Error{constructor(e,s){super(e),this.reason=s,this.name="SceneEnvelopeError"}}function Iy(t){return t.startsWith(Sy)}function B1(t){const e=atob(t),s=new Uint8Array(e.length);for(let i=0;i<e.length;i++)s[i]=e.charCodeAt(i);return s}function Ry(t){return B1(t.replace(/-/g,"+").replace(/_/g,"/"))}function Py(t){return wy(Fa,Cy(),new TextEncoder().encode(Ey),Ry(t),32)}function Ly(t,e){if(!t.startsWith(Yc))throw new Ps("Unsupported scene envelope version (this core supports viji-enc:v1)","UNSUPPORTED_VERSION");if(!e)throw new Ps("Encrypted scene received without a key component","MISSING_KEY_COMPONENT");let s,i;try{s=B1(t.slice(Yc.length)),i=Py(e)}catch{throw new Ps("Malformed scene envelope","MALFORMED_ENVELOPE")}if(s.length<zn+Ty)throw new Ps("Truncated scene envelope","MALFORMED_ENVELOPE");const r=s.subarray(0,zn),a=s.subarray(zn);try{const o=vy(i,r).decrypt(a);return new TextDecoder().decode(o)}catch{throw new Ps("Scene envelope authentication failed","DECRYPT_FAILED")}}function O1(t){self.postMessage({type:"error",id:`${t.code.toLowerCase()}_${Date.now()}`,timestamp:Date.now(),data:t})}const gi={current:null};self.addEventListener("error",t=>{const e=t.error,s=e?.stack,i=e?.message??t.message??String(t);gi.current?gi.current.reportSceneError({message:i,...s!==void 0&&{stack:s},code:"UNCAUGHT_ERROR"}):O1({message:i,code:"UNCAUGHT_ERROR",...s!==void 0&&{stack:s}}),t.preventDefault()});self.addEventListener("unhandledrejection",t=>{const e=t.reason,s=e?.stack,i=e?.message??String(t.reason);gi.current?gi.current.reportSceneError({message:i,...s!==void 0&&{stack:s},code:"UNHANDLED_REJECTION"}):O1({message:i,code:"UNHANDLED_REJECTION",...s!==void 0&&{stack:s}}),t.preventDefault()});const ct=new Wa,it=new Xd(t=>self.postMessage(t));gi.current=it;ct.setSceneErrorReporter(it);let Yn=null;function Zc(t){const e=Zb(t,{transforms:["typescript"],disableESTransforms:true,sourceMapOptions:{compiledFilename:"scene.js"},filePath:"scene.ts"});return{code:e.code,mappings:e.sourceMap?.mappings??null}}function Qc(t){const{code:e,error:s}=uf(t);return s?(it.reportSceneError({message:s.message,code:s.code,sourceOverride:"scene"}),null):e}async function Dy(t,e,s){const i=e.initialParameters;let r=false;const a=()=>{!r&&i&&ct.releaseSeedBitmaps(i)};let o,c,l=false;try{Iy(t)&&(l=true,t=Ly(t,e.keyComponent)),it.resetForSceneReload(),Yn=null,self.renderFunction=null,ct.resetParameterState();const h=Bd(t);o=h.renderer,c=h.p5CanvasMode,ct.setCapabilityUsageMask(Qs.detectUsage(t,o)),s.resolve(h)}catch(h){if(h instanceof Ps){s.reject({message:`Scene decrypt failed: ${h.message}`,code:"SCENE_DECRYPT_ERROR"}),a();return}const d=h;s.reject({message:`Scene analysis failed: ${d.message}`,code:"SCENE_ANALYSIS_ERROR"}),a();return}try{if(o==="shader"){it.setCurrentSourceMap(null);try{await ct.initShaderMode(t,{redactDriverInfoLogs:l})}catch(h){const d=h;if(d.__isShaderCompileError)throw d;it.reportSceneError({message:`Scene code error: ${d.message}`,...d.stack!==void 0&&{stack:d.stack},code:"SCENE_CODE_ERROR",sourceOverride:"scene"});return}ct.sendAllParametersToHost()}else if(o==="p5"){const h=Zc(t),{code:d,mappings:m}=h;it.setCurrentSourceMap(m);const _=Qc(d);if(_===null)return;const x=_+`
606
+ })();`}process(){return false}}const Gb=new Set(["break","case","catch","class","const","continue","debugger","default","delete","do","else","export","extends","finally","for","function","if","import","in","instanceof","new","return","super","switch","this","throw","try","typeof","var","void","while","with","yield","enum","implements","interface","let","package","private","protected","public","static","await","false","null","true"]);function jc(t){if(t.length===0||!vi[t.charCodeAt(0)])return false;for(let e=1;e<t.length;e++)if(!_t[t.charCodeAt(e)])return false;return!Gb.has(t)}class Wb extends vt{constructor(e,s,i){super(),this.rootTransformer=e,this.tokens=s,this.isImportsTransformEnabled=i}process(){return this.rootTransformer.processPossibleArrowParamEnd()||this.rootTransformer.processPossibleAsyncArrowWithTypeParams()||this.rootTransformer.processPossibleTypeRange()?true:this.tokens.matches1(n._public)||this.tokens.matches1(n._protected)||this.tokens.matches1(n._private)||this.tokens.matches1(n._abstract)||this.tokens.matches1(n._readonly)||this.tokens.matches1(n._override)||this.tokens.matches1(n.nonNullAssertion)?(this.tokens.removeInitialToken(),true):this.tokens.matches1(n._enum)||this.tokens.matches2(n._const,n._enum)?(this.processEnum(),true):this.tokens.matches2(n._export,n._enum)||this.tokens.matches3(n._export,n._const,n._enum)?(this.processEnum(true),true):false}processEnum(e=false){for(this.tokens.removeInitialToken();this.tokens.matches1(n._const)||this.tokens.matches1(n._enum);)this.tokens.removeToken();const s=this.tokens.identifierName();this.tokens.removeToken(),e&&!this.isImportsTransformEnabled&&this.tokens.appendCode("export "),this.tokens.appendCode(`var ${s}; (function (${s})`),this.tokens.copyExpectedToken(n.braceL),this.processEnumBody(s),this.tokens.copyExpectedToken(n.braceR),e&&this.isImportsTransformEnabled?this.tokens.appendCode(`)(${s} || (exports.${s} = ${s} = {}));`):this.tokens.appendCode(`)(${s} || (${s} = {}));`)}processEnumBody(e){let s=null;for(;!this.tokens.matches1(n.braceR);){const{nameStringCode:i,variableName:r}=this.extractEnumKeyInfo(this.tokens.currentToken());this.tokens.removeInitialToken(),this.tokens.matches3(n.eq,n.string,n.comma)||this.tokens.matches3(n.eq,n.string,n.braceR)?this.processStringLiteralEnumMember(e,i,r):this.tokens.matches1(n.eq)?this.processExplicitValueEnumMember(e,i,r):this.processImplicitValueEnumMember(e,i,r,s),this.tokens.matches1(n.comma)&&this.tokens.removeToken(),r!=null?s=r:s=`${e}[${i}]`}}extractEnumKeyInfo(e){if(e.type===n.name){const s=this.tokens.identifierNameForToken(e);return{nameStringCode:`"${s}"`,variableName:jc(s)?s:null}}else if(e.type===n.string){const s=this.tokens.stringValueForToken(e);return{nameStringCode:this.tokens.code.slice(e.start,e.end),variableName:jc(s)?s:null}}else throw new Error("Expected name or string at beginning of enum element.")}processStringLiteralEnumMember(e,s,i){i!=null?(this.tokens.appendCode(`const ${i}`),this.tokens.copyToken(),this.tokens.copyToken(),this.tokens.appendCode(`; ${e}[${s}] = ${i};`)):(this.tokens.appendCode(`${e}[${s}]`),this.tokens.copyToken(),this.tokens.copyToken(),this.tokens.appendCode(";"))}processExplicitValueEnumMember(e,s,i){const r=this.tokens.currentToken().rhsEndIndex;if(r==null)throw new Error("Expected rhsEndIndex on enum assign.");if(i!=null){for(this.tokens.appendCode(`const ${i}`),this.tokens.copyToken();this.tokens.currentIndex()<r;)this.rootTransformer.processToken();this.tokens.appendCode(`; ${e}[${e}[${s}] = ${i}] = ${s};`)}else{for(this.tokens.appendCode(`${e}[${e}[${s}]`),this.tokens.copyToken();this.tokens.currentIndex()<r;)this.rootTransformer.processToken();this.tokens.appendCode(`] = ${s};`)}}processImplicitValueEnumMember(e,s,i,r){let o=r!=null?`${r} + 1`:"0";i!=null&&(this.tokens.appendCode(`const ${i} = ${o}; `),o=i),this.tokens.appendCode(`${e}[${e}[${s}] = ${o}] = ${s};`)}}class ur{__init(){this.transformers=[]}__init2(){this.generatedVariables=[]}constructor(e,s,i,r){ur.prototype.__init.call(this),ur.prototype.__init2.call(this),this.nameManager=e.nameManager,this.helperManager=e.helperManager;const{tokenProcessor:o,importProcessor:a}=e;this.tokens=o,this.isImportsTransformEnabled=s.includes("imports"),this.isReactHotLoaderTransformEnabled=s.includes("react-hot-loader"),this.disableESTransforms=!!r.disableESTransforms,r.disableESTransforms||(this.transformers.push(new qb(o,this.nameManager)),this.transformers.push(new $b(o)),this.transformers.push(new jb(o,this.nameManager))),s.includes("jsx")&&(r.jsxRuntime!=="preserve"&&this.transformers.push(new ds(this,o,a,this.nameManager,r)),this.transformers.push(new Hb(this,o,a,r)));let c=null;if(s.includes("react-hot-loader")){if(!r.filePath)throw new Error("filePath is required when using the react-hot-loader transform.");c=new ka(o,r.filePath),this.transformers.push(c)}if(s.includes("imports")){if(a===null)throw new Error("Expected non-null importProcessor with imports transform enabled.");this.transformers.push(new si(this,o,a,this.nameManager,this.helperManager,c,i,!!r.enableLegacyTypeScriptModuleInterop,s.includes("typescript"),s.includes("flow"),!!r.preserveDynamicImport,!!r.keepUnusedImports))}else this.transformers.push(new Mb(o,this.nameManager,this.helperManager,c,s.includes("typescript"),s.includes("flow"),!!r.keepUnusedImports,r));s.includes("flow")&&this.transformers.push(new Ob(this,o,s.includes("imports"))),s.includes("typescript")&&this.transformers.push(new Wb(this,o,s.includes("imports"))),s.includes("jest")&&this.transformers.push(new xa(this,o,this.nameManager,a))}transform(){this.tokens.reset(),this.processBalancedCode();let s=this.isImportsTransformEnabled?'"use strict";':"";for(const a of this.transformers)s+=a.getPrefixCode();s+=this.helperManager.emitHelpers(),s+=this.generatedVariables.map(a=>` var ${a};`).join("");for(const a of this.transformers)s+=a.getHoistedCode();let i="";for(const a of this.transformers)i+=a.getSuffixCode();const r=this.tokens.finish();let{code:o}=r;if(o.startsWith("#!")){let a=o.indexOf(`
607
+ `);return a===-1&&(a=o.length,o+=`
608
+ `),{code:o.slice(0,a+1)+s+o.slice(a+1)+i,mappings:this.shiftMappings(r.mappings,s.length)}}else return{code:s+o+i,mappings:this.shiftMappings(r.mappings,s.length)}}processBalancedCode(){let e=0,s=0;for(;!this.tokens.isAtEnd();){if(this.tokens.matches1(n.braceL)||this.tokens.matches1(n.dollarBraceL))e++;else if(this.tokens.matches1(n.braceR)){if(e===0)return;e--}if(this.tokens.matches1(n.parenL))s++;else if(this.tokens.matches1(n.parenR)){if(s===0)return;s--}this.processToken()}}processToken(){if(this.tokens.matches1(n._class)){this.processClass();return}for(const e of this.transformers)if(e.process())return;this.tokens.copyToken()}processNamedClass(){if(!this.tokens.matches2(n._class,n.name))throw new Error("Expected identifier for exported class name.");const e=this.tokens.identifierNameAtIndex(this.tokens.currentIndex()+1);return this.processClass(),e}processClass(){const e=Nb(this,this.tokens,this.nameManager,this.disableESTransforms),s=(e.headerInfo.isExpression||!e.headerInfo.className)&&e.staticInitializerNames.length+e.instanceInitializerNames.length>0;let i=e.headerInfo.className;s&&(i=this.nameManager.claimFreeName("_class"),this.generatedVariables.push(i),this.tokens.appendCode(` (${i} =`));const o=this.tokens.currentToken().contextId;if(o==null)throw new Error("Expected class to have a context ID.");for(this.tokens.copyExpectedToken(n._class);!this.tokens.matchesContextIdAndLabel(n.braceL,o);)this.processToken();this.processClassBody(e,i);const a=e.staticInitializerNames.map(c=>`${i}.${c}()`);s?this.tokens.appendCode(`, ${a.map(c=>`${c}, `).join("")}${i})`):e.staticInitializerNames.length>0&&this.tokens.appendCode(` ${a.map(c=>`${c};`).join(" ")}`)}processClassBody(e,s){const{headerInfo:i,constructorInsertPos:r,constructorInitializerStatements:o,fields:a,instanceInitializerNames:c,rangesToRemove:l}=e;let h=0,d=0;const m=this.tokens.currentToken().contextId;if(m==null)throw new Error("Expected non-null context ID on class.");this.tokens.copyExpectedToken(n.braceL),this.isReactHotLoaderTransformEnabled&&this.tokens.appendCode("__reactstandin__regenerateByEval(key, code) {this[key] = eval(code);}");const _=o.length+c.length>0;if(r===null&&_){const x=this.makeConstructorInitCode(o,c,s);if(i.hasSuperclass){const E=this.nameManager.claimFreeName("args");this.tokens.appendCode(`constructor(...${E}) { super(...${E}); ${x}; }`)}else this.tokens.appendCode(`constructor() { ${x}; }`)}for(;!this.tokens.matchesContextIdAndLabel(n.braceR,m);)if(h<a.length&&this.tokens.currentIndex()===a[h].start){let x=false;for(this.tokens.matches1(n.bracketL)?this.tokens.copyTokenWithPrefix(`${a[h].initializerName}() {this`):this.tokens.matches1(n.string)||this.tokens.matches1(n.num)?(this.tokens.copyTokenWithPrefix(`${a[h].initializerName}() {this[`),x=true):this.tokens.copyTokenWithPrefix(`${a[h].initializerName}() {this.`);this.tokens.currentIndex()<a[h].end;)x&&this.tokens.currentIndex()===a[h].equalsIndex&&this.tokens.appendCode("]"),this.processToken();this.tokens.appendCode("}"),h++}else if(d<l.length&&this.tokens.currentIndex()>=l[d].start){for(this.tokens.currentIndex()<l[d].end&&this.tokens.removeInitialToken();this.tokens.currentIndex()<l[d].end;)this.tokens.removeToken();d++}else this.tokens.currentIndex()===r?(this.tokens.copyToken(),_&&this.tokens.appendCode(`;${this.makeConstructorInitCode(o,c,s)};`),this.processToken()):this.processToken();this.tokens.copyExpectedToken(n.braceR)}makeConstructorInitCode(e,s,i){return[...e,...s.map(r=>`${i}.prototype.${r}.call(this)`)].join(";")}processPossibleArrowParamEnd(){if(this.tokens.matches2(n.parenR,n.colon)&&this.tokens.tokenAtRelativeIndex(1).isType){let e=this.tokens.currentIndex()+1;for(;this.tokens.tokens[e].isType;)e++;if(this.tokens.matches1AtIndex(e,n.arrow)){for(this.tokens.removeInitialToken();this.tokens.currentIndex()<e;)this.tokens.removeToken();return this.tokens.replaceTokenTrimmingLeftWhitespace(") =>"),true}}return false}processPossibleAsyncArrowWithTypeParams(){if(!this.tokens.matchesContextual(g._async)&&!this.tokens.matches1(n._async))return false;const e=this.tokens.tokenAtRelativeIndex(1);if(e.type!==n.lessThan||!e.isType)return false;let s=this.tokens.currentIndex()+1;for(;this.tokens.tokens[s].isType;)s++;if(this.tokens.matches1AtIndex(s,n.parenL)){for(this.tokens.replaceToken("async ("),this.tokens.removeInitialToken();this.tokens.currentIndex()<s;)this.tokens.removeToken();return this.tokens.removeToken(),this.processBalancedCode(),this.processToken(),true}return false}processPossibleTypeRange(){if(this.tokens.currentToken().isType){for(this.tokens.removeInitialToken();this.tokens.currentToken().isType;)this.tokens.removeToken();return true}return false}shiftMappings(e,s){for(let i=0;i<e.length;i++){const r=e[i];r!==void 0&&(e[i]=r+s)}return e}}var Xb={};(function(t){t.__esModule=true,t.LinesAndColumns=void 0;var e=`
609
+ `,s="\r",i=function(){function r(o){this.string=o;for(var a=[0],c=0;c<o.length;)switch(o[c]){case e:c+=e.length,a.push(c);break;case s:c+=s.length,o[c]===e&&(c+=e.length),a.push(c);break;default:c++;break}this.offsets=a}return r.prototype.locationForIndex=function(o){if(o<0||o>this.string.length)return null;for(var a=0,c=this.offsets;c[a+1]<=o;)a++;var l=o-c[a];return{line:a,column:l}},r.prototype.indexForLocation=function(o){var a=o.line,c=o.column;return a<0||a>=this.offsets.length||c<0||c>this.lengthOfLine(a)?null:this.offsets[a]+c},r.prototype.lengthOfLine=function(o){var a=this.offsets[o],c=o===this.offsets.length-1?this.string.length:this.offsets[o+1];return c-a},r}();t.LinesAndColumns=i,t.default=i})(Xb);function zb(t){const e=new Set;for(let s=0;s<t.tokens.length;s++)t.matches1AtIndex(s,n._import)&&!t.matches3AtIndex(s,n._import,n.name,n.eq)&&Yb(t,s,e);return e}function Yb(t,e,s){e++,!t.matches1AtIndex(e,n.parenL)&&(t.matches1AtIndex(e,n.name)&&(s.add(t.identifierNameAtIndex(e)),e++,t.matches1AtIndex(e,n.comma)&&e++),t.matches1AtIndex(e,n.star)&&(e+=2,s.add(t.identifierNameAtIndex(e)),e++),t.matches1AtIndex(e,n.braceL)&&(e++,Kb(t,e,s)))}function Kb(t,e,s){for(;;){if(t.matches1AtIndex(e,n.braceR))return;const i=hi(t,e);if(e=i.endIndex,i.isType||s.add(i.rightName),t.matches2AtIndex(e,n.comma,n.braceR))return;if(t.matches1AtIndex(e,n.braceR))return;if(t.matches1AtIndex(e,n.comma))e++;else throw new Error(`Unexpected token: ${JSON.stringify(t.tokens[e])}`)}}function Zb(t,e){dm(e);try{const s=Qb(t,e),r=new ur(s,e.transforms,!!e.enableLegacyBabel5ModuleInterop,e).transform();let o={code:r.code};if(e.sourceMapOptions){if(!e.filePath)throw new Error("filePath must be specified when generating a source map.");o={...o,sourceMap:Jp(r,e.filePath,e.sourceMapOptions,t,s.tokenProcessor.tokens)}}return o}catch(s){throw e.filePath&&(s.message=`Error transforming ${e.filePath}: ${s.message}`),s}}function Qb(t,e){const s=e.transforms.includes("jsx"),i=e.transforms.includes("typescript"),r=e.transforms.includes("flow"),o=e.disableESTransforms===true,a=Lb(t,s,i,r),c=a.tokens,l=a.scopes,h=new Zo(t,c),d=new tr(h),m=new ti(t,c,r,o,d),_=!!e.enableLegacyTypeScriptModuleInterop;let x=null;return e.transforms.includes("imports")?(x=new ps(h,m,_,e,e.transforms.includes("typescript"),!!e.keepUnusedImports,d),x.preprocessTokens(),Cc(m,l,x.getGlobalNames()),e.transforms.includes("typescript")&&!e.keepUnusedImports&&x.pruneTypeOnlyImports()):e.transforms.includes("typescript")&&!e.keepUnusedImports&&Cc(m,l,zb(m)),{tokenProcessor:m,scopes:l,nameManager:h,importProcessor:x,helperManager:d}}function wo(t){return t instanceof Uint8Array||ArrayBuffer.isView(t)&&t.constructor.name==="Uint8Array"&&"BYTES_PER_ELEMENT"in t&&t.BYTES_PER_ELEMENT===1}const lr=t=>t?`"${t}" `:"";function So(t,e=""){if(typeof t!="boolean")throw new TypeError(lr(e)+"expected boolean, got type="+typeof t);return t}function Us(t,e=""){if(typeof t!="number")throw new TypeError(lr(e)+"expected number, got "+typeof t);if(!Number.isSafeInteger(t)||t<0)throw new RangeError(lr(e)+"expected integer >= 0, got "+t);return t}function Ue(t,e,s=""){if(wo(t)&&(e===void 0||t.length===e))return t;e!==void 0&&Us(e,"length");const i=wo(t),r=e!==void 0?` of length ${e}`:"",o=i?`length=${t.length}`:`type=${typeof t}`,a=lr(s)+"expected Uint8Array"+r+", got "+o;throw i?new RangeError(a):new TypeError(a)}const qc=(t,e)=>{if(t===null||typeof t!="object"||Array.isArray(t))throw new TypeError(e==="object"?"expected valid options object":`"${e}" expected object, got type=${typeof t}`)};function Hc(t,e=true){if(t.destroyed)throw new Error("hash was destroyed");if(e&&t.finished)throw new Error("digest() was already called")}function Jb(t,e){Ue(t,void 0,"output");const s=e.outputLen;if(!(t.length>=s))throw new RangeError('"output" expected length >= '+s)}function Ht(t){return new Uint32Array(t.buffer,t.byteOffset,Math.floor(t.byteLength/4))}function Lt(...t){for(let e=0;e<t.length;e++)t[e].fill(0)}function ey(t){return new DataView(t.buffer,t.byteOffset,t.byteLength)}const It=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function ty(t){return t<<24&4278190080|t<<8&16711680|t>>>8&65280|t>>>24&255}function sy(t){for(let e=0;e<t.length;e++)t[e]=ty(t[e]);return t}const gt=It?t=>t:sy;function iy(t,e){return qc(t,"defaults"),qc(e,"opts"),Object.assign(t,e)}function ry(t,e){if(t=Ue(t),e=Ue(e),t.length!==e.length)return false;let s=0;for(let i=0;i<t.length;i++)s|=t[i]^e[i];return s===0}function ny(t,e,s){const i=e,r=()=>[],o=(c,l)=>i(l,...r(c)).update(c).digest(),a=i(new Uint8Array(t),...r(new Uint8Array(0)));return o.outputLen=a.outputLen,o.blockLen=a.blockLen,o.create=(c,...l)=>i(c,...l),o}const oy=(t,e)=>{function s(i,...r){if(Ue(i,void 0,"key"),t.nonceLength!==void 0){const m=r[0];Ue(m,t.varSizeNonce?void 0:t.nonceLength,"nonce")}const o=t.tagLength,a=t.nonceLength!==void 0?1:0;if(!t.withAAD){for(let m=a;m<r.length;m++)if(wo(r[m]))throw new Error("AAD not supported")}t.withAAD&&r[a]!==void 0&&Ue(r[a],void 0,"AAD");const c=e(i,...r),l=(m,_)=>{if(_!==void 0){if(m!==2)throw new Error("cipher output not supported");Ue(_,void 0,"output")}};let h=false;return{encrypt(m,_){if(h)throw new Error("cannot encrypt() twice with same key + nonce");return h=true,Ue(m,void 0,"data"),l(c.encrypt.length,_),c.encrypt(m,_)},decrypt(m,_){if(Ue(m,void 0,"data"),o&&m.length<o)throw new Error('"ciphertext" expected length >= tagLength='+o);return l(c.decrypt.length,_),c.decrypt(m,_)}}}return Object.assign(s,t),s};function Eo(t,e,s=true){if(e===void 0)return new Uint8Array(t);if(Ue(e,t,"output"),s&&!hr(e))throw new Error("invalid output, must be aligned");return e}function ay(t,e,s){Us(t),Us(e),So(s);const i=new Uint8Array(16),r=ey(i);return r.setBigUint64(0,BigInt(e),s),r.setBigUint64(8,BigInt(t),s),i}function hr(t){return t.byteOffset%4===0}function fr(t){return Uint8Array.from(Ue(t))}const U1=t=>Uint8Array.from(t.split(""),e=>e.charCodeAt(0)),cy=gt(Ht(U1("expand 16-byte k"))),uy=gt(Ht(U1("expand 32-byte k")));function ve(t,e){return t<<e|t>>>32-e}const Ks=64,ly=16,To=2**32-1,Gc=Uint32Array.of();function hy(t,e,s,i,r,o,a,c){const l=r.length,h=new Uint8Array(Ks),d=Ht(h),m=It&&hr(r)&&hr(o),_=m?Ht(r):Gc,x=m?Ht(o):Gc;if(!It){for(let E=0;E<l;a++){if(t(e,s,i,d,a,c),gt(d),a>=To)throw new Error("arx: counter overflow");const N=Math.min(Ks,l-E);for(let F=0,U;F<N;F++)U=E+F,o[U]=r[U]^h[F];E+=N}return}for(let E=0;E<l;a++){if(t(e,s,i,d,a,c),a>=To)throw new Error("arx: counter overflow");const N=Math.min(Ks,l-E);if(m&&N===Ks){const F=E/4;if(E%4!==0)throw new Error("arx: invalid block position");for(let U=0,P;U<ly;U++)P=F+U,x[P]=_[P]^d[U];E+=Ks;continue}for(let F=0,U;F<N;F++)U=E+F,o[U]=r[U]^h[F];E+=N}}function fy(t,e){const{allowShortKeys:s,extendNonceFn:i,counterLength:r,counterRight:o,rounds:a}=iy({allowShortKeys:false,counterLength:8,counterRight:false,rounds:20},e);if(typeof t!="function")throw new Error("core must be a function");return Us(r),Us(a),So(o),So(s),(c,l,h,d,m=0)=>{Ue(c,void 0,"key"),Ue(l,void 0,"nonce"),Ue(h,void 0,"data");const _=h.length;if(d=Eo(_,d,false),Us(m),m<0||m>=To)throw new Error("arx: counter overflow");const x=[];let E=c.length,N,F;if(E===32)x.push(N=fr(c)),F=uy;else if(E===16&&s)N=new Uint8Array(32),N.set(c),N.set(c,16),F=cy,x.push(N);else throw Ue(c,32,"arx key"),new Error("invalid key size");(!It||!hr(l))&&x.push(l=fr(l));let U=Ht(N);if(i){if(l.length!==24)throw new Error("arx: extended nonce must be 24 bytes");const $=l.subarray(0,16);if(It)i(F,U,Ht($),U);else{const te=gt(Uint32Array.from(F));i(te,U,Ht($),U),Lt(te),gt(U)}l=l.subarray(16)}else It||gt(U);const P=16-r;if(P!==l.length)throw new Error(`arx: nonce must be ${P} or 16 bytes`);if(P!==12){const $=new Uint8Array(12);$.set(l,o?0:12-l.length),l=$,x.push(l)}const X=gt(Ht(l));try{return hy(t,F,U,X,h,d,m,a),d}finally{Lt(...x)}}}function Be(t,e){return t[e++]&255|(t[e++]&255)<<8}class dy{blockLen=16;outputLen=16;buffer=new Uint8Array(16);r=new Uint16Array(10);h=new Uint16Array(10);pad=new Uint16Array(8);pos=0;finished=false;destroyed=false;constructor(e){e=fr(Ue(e,32,"key"));const s=Be(e,0),i=Be(e,2),r=Be(e,4),o=Be(e,6),a=Be(e,8),c=Be(e,10),l=Be(e,12),h=Be(e,14);this.r[0]=s&8191,this.r[1]=(s>>>13|i<<3)&8191,this.r[2]=(i>>>10|r<<6)&7939,this.r[3]=(r>>>7|o<<9)&8191,this.r[4]=(o>>>4|a<<12)&255,this.r[5]=a>>>1&8190,this.r[6]=(a>>>14|c<<2)&8191,this.r[7]=(c>>>11|l<<5)&8065,this.r[8]=(l>>>8|h<<8)&8191,this.r[9]=h>>>5&127;for(let d=0;d<8;d++)this.pad[d]=Be(e,16+2*d)}process(e,s,i=false){const r=i?0:2048,{h:o,r:a}=this,c=a[0],l=a[1],h=a[2],d=a[3],m=a[4],_=a[5],x=a[6],E=a[7],N=a[8],F=a[9],U=Be(e,s+0),P=Be(e,s+2),X=Be(e,s+4),$=Be(e,s+6),te=Be(e,s+8),ee=Be(e,s+10),Q=Be(e,s+12),z=Be(e,s+14);let ne=o[0]+(U&8191),v=o[1]+((U>>>13|P<<3)&8191),y=o[2]+((P>>>10|X<<6)&8191),k=o[3]+((X>>>7|$<<9)&8191),V=o[4]+(($>>>4|te<<12)&8191),G=o[5]+(te>>>1&8191),O=o[6]+((te>>>14|ee<<2)&8191),R=o[7]+((ee>>>11|Q<<5)&8191),B=o[8]+((Q>>>8|z<<8)&8191),M=o[9]+(z>>>5|r),C=0,H=C+ne*c+v*(5*F)+y*(5*N)+k*(5*E)+V*(5*x);C=H>>>13,H&=8191,H+=G*(5*_)+O*(5*m)+R*(5*d)+B*(5*h)+M*(5*l),C+=H>>>13,H&=8191;let W=C+ne*l+v*c+y*(5*F)+k*(5*N)+V*(5*E);C=W>>>13,W&=8191,W+=G*(5*x)+O*(5*_)+R*(5*m)+B*(5*d)+M*(5*h),C+=W>>>13,W&=8191;let J=C+ne*h+v*l+y*c+k*(5*F)+V*(5*N);C=J>>>13,J&=8191,J+=G*(5*E)+O*(5*x)+R*(5*_)+B*(5*m)+M*(5*d),C+=J>>>13,J&=8191;let ce=C+ne*d+v*h+y*l+k*c+V*(5*F);C=ce>>>13,ce&=8191,ce+=G*(5*N)+O*(5*E)+R*(5*x)+B*(5*_)+M*(5*m),C+=ce>>>13,ce&=8191;let ae=C+ne*m+v*d+y*h+k*l+V*c;C=ae>>>13,ae&=8191,ae+=G*(5*F)+O*(5*N)+R*(5*E)+B*(5*x)+M*(5*_),C+=ae>>>13,ae&=8191;let w=C+ne*_+v*m+y*d+k*h+V*l;C=w>>>13,w&=8191,w+=G*c+O*(5*F)+R*(5*N)+B*(5*E)+M*(5*x),C+=w>>>13,w&=8191;let T=C+ne*x+v*_+y*m+k*d+V*h;C=T>>>13,T&=8191,T+=G*l+O*c+R*(5*F)+B*(5*N)+M*(5*E),C+=T>>>13,T&=8191;let D=C+ne*E+v*x+y*_+k*m+V*d;C=D>>>13,D&=8191,D+=G*h+O*l+R*c+B*(5*F)+M*(5*N),C+=D>>>13,D&=8191;let L=C+ne*N+v*E+y*x+k*_+V*m;C=L>>>13,L&=8191,L+=G*d+O*h+R*l+B*c+M*(5*F),C+=L>>>13,L&=8191;let j=C+ne*F+v*N+y*E+k*x+V*_;C=j>>>13,j&=8191,j+=G*m+O*d+R*h+B*l+M*c,C+=j>>>13,j&=8191,C=(C<<2)+C|0,C=C+H|0,H=C&8191,C=C>>>13,W+=C,o[0]=H,o[1]=W,o[2]=J,o[3]=ce,o[4]=ae,o[5]=w,o[6]=T,o[7]=D,o[8]=L,o[9]=j}finalize(){const{h:e,pad:s}=this,i=new Uint16Array(10);let r=e[1]>>>13;e[1]&=8191;for(let c=2;c<10;c++)e[c]+=r,r=e[c]>>>13,e[c]&=8191;e[0]+=r*5,r=e[0]>>>13,e[0]&=8191,e[1]+=r,r=e[1]>>>13,e[1]&=8191,e[2]+=r,i[0]=e[0]+5,r=i[0]>>>13,i[0]&=8191;for(let c=1;c<10;c++)i[c]=e[c]+r,r=i[c]>>>13,i[c]&=8191;i[9]-=8192;let o=(r^1)-1;for(let c=0;c<10;c++)i[c]&=o;o=~o;for(let c=0;c<10;c++)e[c]=e[c]&o|i[c];e[0]=(e[0]|e[1]<<13)&65535,e[1]=(e[1]>>>3|e[2]<<10)&65535,e[2]=(e[2]>>>6|e[3]<<7)&65535,e[3]=(e[3]>>>9|e[4]<<4)&65535,e[4]=(e[4]>>>12|e[5]<<1|e[6]<<14)&65535,e[5]=(e[6]>>>2|e[7]<<11)&65535,e[6]=(e[7]>>>5|e[8]<<8)&65535,e[7]=(e[8]>>>8|e[9]<<5)&65535;let a=e[0]+s[0];e[0]=a&65535;for(let c=1;c<8;c++)a=(e[c]+s[c]|0)+(a>>>16)|0,e[c]=a&65535;Lt(i)}update(e){Hc(this),Ue(e),e=fr(e);const{buffer:s,blockLen:i}=this,r=e.length;for(let o=0;o<r;){const a=Math.min(i-this.pos,r-o);if(a===i){for(;i<=r-o;o+=i)this.process(e,o);continue}s.set(e.subarray(o,o+a),this.pos),this.pos+=a,o+=a,this.pos===i&&(this.process(s,0,false),this.pos=0)}return this}destroy(){this.destroyed=true,Lt(this.h,this.r,this.buffer,this.pad)}digestInto(e){Hc(this),Jb(e,this),this.finished=true;const{buffer:s,h:i}=this;let{pos:r}=this;if(r){for(s[r++]=1;r<16;r++)s[r]=0;this.process(s,0,true)}this.finalize();let o=0;for(let a=0;a<8;a++)e[o++]=i[a]>>>0,e[o++]=i[a]>>>8}digest(){const{buffer:e,outputLen:s}=this;this.digestInto(e);const i=e.slice(0,s);return this.destroy(),i}}const py=ny(32,t=>new dy(t));function M1(t,e,s,i,r,o=20){let a=t[0],c=t[1],l=t[2],h=t[3],d=e[0],m=e[1],_=e[2],x=e[3],E=e[4],N=e[5],F=e[6],U=e[7],P=r,X=s[0],$=s[1],te=s[2],ee=a,Q=c,z=l,ne=h,v=d,y=m,k=_,V=x,G=E,O=N,R=F,B=U,M=P,C=X,H=$,W=te;for(let ce=0;ce<o;ce+=2)ee=ee+v|0,M=ve(M^ee,16),G=G+M|0,v=ve(v^G,12),ee=ee+v|0,M=ve(M^ee,8),G=G+M|0,v=ve(v^G,7),Q=Q+y|0,C=ve(C^Q,16),O=O+C|0,y=ve(y^O,12),Q=Q+y|0,C=ve(C^Q,8),O=O+C|0,y=ve(y^O,7),z=z+k|0,H=ve(H^z,16),R=R+H|0,k=ve(k^R,12),z=z+k|0,H=ve(H^z,8),R=R+H|0,k=ve(k^R,7),ne=ne+V|0,W=ve(W^ne,16),B=B+W|0,V=ve(V^B,12),ne=ne+V|0,W=ve(W^ne,8),B=B+W|0,V=ve(V^B,7),ee=ee+y|0,W=ve(W^ee,16),R=R+W|0,y=ve(y^R,12),ee=ee+y|0,W=ve(W^ee,8),R=R+W|0,y=ve(y^R,7),Q=Q+k|0,M=ve(M^Q,16),B=B+M|0,k=ve(k^B,12),Q=Q+k|0,M=ve(M^Q,8),B=B+M|0,k=ve(k^B,7),z=z+V|0,C=ve(C^z,16),G=G+C|0,V=ve(V^G,12),z=z+V|0,C=ve(C^z,8),G=G+C|0,V=ve(V^G,7),ne=ne+v|0,H=ve(H^ne,16),O=O+H|0,v=ve(v^O,12),ne=ne+v|0,H=ve(H^ne,8),O=O+H|0,v=ve(v^O,7);let J=0;i[J++]=a+ee|0,i[J++]=c+Q|0,i[J++]=l+z|0,i[J++]=h+ne|0,i[J++]=d+v|0,i[J++]=m+y|0,i[J++]=_+k|0,i[J++]=x+V|0,i[J++]=E+G|0,i[J++]=N+O|0,i[J++]=F+R|0,i[J++]=U+B|0,i[J++]=P+M|0,i[J++]=X+C|0,i[J++]=$+H|0,i[J++]=te+W|0}function my(t,e,s,i){const r=It?t:gt(t.slice(0,4)),o=It?e:gt(e.slice(0,8)),a=It?s:gt(s.slice(0,4)),c=new Uint32Array(16);M1(r,o,a.subarray(1),c,a[0]);let l=0;i[l++]=c[0]-r[0]|0,i[l++]=c[1]-r[1]|0,i[l++]=c[2]-r[2]|0,i[l++]=c[3]-r[3]|0,i[l++]=c[12]-a[0]|0,i[l++]=c[13]-a[1]|0,i[l++]=c[14]-a[2]|0,i[l++]=c[15]-a[3]|0,gt(i),It||Lt(r,o,a),Lt(c)}const gy=fy(M1,{counterRight:false,counterLength:8,extendNonceFn:my,allowShortKeys:false}),by=new Uint8Array(16),Wc=(t,e)=>{t.update(e);const s=e.length%16;s&&t.update(by.subarray(s))},yy=new Uint8Array(32);function Xc(t,e,s,i,r){r!==void 0&&Ue(r,void 0,"AAD");const o=t(e,s,yy),a=ay(i.length,r?r.length:0,true),c=py.create(o);r&&Wc(c,r),Wc(c,i),c.update(a);const l=c.digest();return Lt(o,a),l}const _y=t=>(e,s,i)=>({encrypt(o,a){const c=o.length;a=Eo(c+16,a,false),a.set(o);const l=a.subarray(0,-16);t(e,s,l,l,1);const h=Xc(t,e,s,l,i);return a.set(h,c),Lt(h),a},decrypt(o,a){a=Eo(o.length-16,a,false);const c=o.subarray(0,-16),l=o.subarray(-16),h=Xc(t,e,s,c,i);if(!ry(l,h))throw Lt(h),new Error("invalid tag");return a.set(o.subarray(0,-16)),t(e,s,a,a,1),Lt(h),a}}),vy=oy({blockSize:64,nonceLength:24,tagLength:16,withAAD:true},_y(gy));function xy(t,e,s){return xr(t),s===void 0&&(s=new Uint8Array(t.outputLen)),qo(t,s,e)}const Xn=Uint8Array.of(0),zc=Uint8Array.of();function ky(t,e,s,i=32){xr(t),us(i,"length"),zt(e,void 0,"prk");const r=t.outputLen;if(e.length<r)throw new Error('"prk" must be at least HashLen octets');if(i>255*r)throw new Error("Length must be <= 255*HashLen");const o=Math.ceil(i/r);s===void 0?s=zc:zt(s,void 0,"info");const a=new Uint8Array(o*r),c=qo.create(t,e),l=c._cloneInto(),h=new Uint8Array(c.outputLen);for(let d=0;d<o;d++)Xn[0]=d+1,l.update(d===0?zc:h).update(s).update(Xn).digestInto(h),a.set(h,r*d),c._cloneInto(l);return c.destroy(),l.destroy(),oi(h,Xn),a.slice(0,i)}const wy=(t,e,s,i,r)=>ky(t,xy(t,e,s),i,r),Sy="viji-enc:",Yc="viji-enc:v1:",Ey="viji-enc:v1",zn=24,Ty=16,Kc=new Uint8Array([224,50,225,138,167,25,229,194,14,250,248,86,248,204,11,44,195,247,74,184,14,218,196,108,241,52,118,61,221,57,106,31]),Ay=new Uint8Array([82,90,117,206,53,86,209,181,176,177,126,23,140,253,33,242,212,132,84,23,243,195,189,90,217,131,25,10,37,241,167,245]);function Cy(){const t=new Uint8Array(Kc.length);for(let e=0;e<t.length;e++)t[e]=Kc[e]^Ay[e];return t}class Ps extends Error{constructor(e,s){super(e),this.reason=s,this.name="SceneEnvelopeError"}}function Iy(t){return t.startsWith(Sy)}function O1(t){const e=atob(t),s=new Uint8Array(e.length);for(let i=0;i<e.length;i++)s[i]=e.charCodeAt(i);return s}function Ry(t){return O1(t.replace(/-/g,"+").replace(/_/g,"/"))}function Py(t){return wy(Uo,Cy(),new TextEncoder().encode(Ey),Ry(t),32)}function Ly(t,e){if(!t.startsWith(Yc))throw new Ps("Unsupported scene envelope version (this core supports viji-enc:v1)","UNSUPPORTED_VERSION");if(!e)throw new Ps("Encrypted scene received without a key component","MISSING_KEY_COMPONENT");let s,i;try{s=O1(t.slice(Yc.length)),i=Py(e)}catch{throw new Ps("Malformed scene envelope","MALFORMED_ENVELOPE")}if(s.length<zn+Ty)throw new Ps("Truncated scene envelope","MALFORMED_ENVELOPE");const r=s.subarray(0,zn),o=s.subarray(zn);try{const a=vy(i,r).decrypt(o);return new TextDecoder().decode(a)}catch{throw new Ps("Scene envelope authentication failed","DECRYPT_FAILED")}}function B1(t){self.postMessage({type:"error",id:`${t.code.toLowerCase()}_${Date.now()}`,timestamp:Date.now(),data:t})}const gi={current:null};self.addEventListener("error",t=>{const e=t.error,s=e?.stack,i=e?.message??t.message??String(t);gi.current?gi.current.reportSceneError({message:i,...s!==void 0&&{stack:s},code:"UNCAUGHT_ERROR"}):B1({message:i,code:"UNCAUGHT_ERROR",...s!==void 0&&{stack:s}}),t.preventDefault()});self.addEventListener("unhandledrejection",t=>{const e=t.reason,s=e?.stack,i=e?.message??String(t.reason);gi.current?gi.current.reportSceneError({message:i,...s!==void 0&&{stack:s},code:"UNHANDLED_REJECTION"}):B1({message:i,code:"UNHANDLED_REJECTION",...s!==void 0&&{stack:s}}),t.preventDefault()});const ct=new Xo,it=new Xd(t=>self.postMessage(t));gi.current=it;ct.setSceneErrorReporter(it);let Yn=null;function Zc(t){const e=Zb(t,{transforms:["typescript"],disableESTransforms:true,sourceMapOptions:{compiledFilename:"scene.js"},filePath:"scene.ts"});return{code:e.code,mappings:e.sourceMap?.mappings??null}}function Qc(t){const{code:e,error:s}=uf(t);return s?(it.reportSceneError({message:s.message,code:s.code,sourceOverride:"scene"}),null):e}async function Dy(t,e,s){const i=e.initialParameters;let r=false;const o=()=>{!r&&i&&ct.releaseSeedBitmaps(i)};let a,c,l=false;try{Iy(t)&&(l=true,t=Ly(t,e.keyComponent)),it.resetForSceneReload(),Yn=null,self.renderFunction=null,ct.resetParameterState();const h=Od(t);a=h.renderer,c=h.p5CanvasMode,ct.setCapabilityUsageMask(Qs.detectUsage(t,a)),s.resolve(h)}catch(h){if(h instanceof Ps){s.reject({message:`Scene decrypt failed: ${h.message}`,code:"SCENE_DECRYPT_ERROR"}),o();return}const d=h;s.reject({message:`Scene analysis failed: ${d.message}`,code:"SCENE_ANALYSIS_ERROR"}),o();return}try{if(a==="shader"){it.setCurrentSourceMap(null);try{await ct.initShaderMode(t,{redactDriverInfoLogs:l})}catch(h){const d=h;if(d.__isShaderCompileError)throw d;it.reportSceneError({message:`Scene code error: ${d.message}`,...d.stack!==void 0&&{stack:d.stack},code:"SCENE_CODE_ERROR",sourceOverride:"scene"});return}ct.sendAllParametersToHost()}else if(a==="p5"){const h=Zc(t),{code:d,mappings:m}=h;it.setCurrentSourceMap(m);const _=Qc(d);if(_===null)return;const x=_+`
610
610
  return { setup: typeof setup !== "undefined" ? setup : null, render: typeof render !== "undefined" ? render : null };`,E=new Function("viji","p5","console",x),N=it.makeArtistConsole(globalThis.console),{setup:F,render:U}=E(ct.viji,null,N);if(!U){it.reportSceneError({message:"P5 mode requires a render(viji, p5) function",code:"P5_INIT_ERROR",sourceOverride:"scene"});return}try{await ct.initP5Mode(F,U,{...c!==void 0&&{canvasMode:c}})}catch(P){const X=P;it.reportSceneError({message:`P5 init error: ${X.message}`,...X.stack!==void 0&&{stack:X.stack},code:"P5_INIT_ERROR",sourceOverride:"scene"});return}ct.sendAllParametersToHost()}else{const{code:h,mappings:d}=Zc(t);it.setCurrentSourceMap(d);const m=Qc(h);if(m===null)return;const _=m+`
611
611
  if (typeof render === "function") {
612
612
  return render;
613
613
  }
614
- throw new Error("Scene code must define a render function");`,x=Object.getPrototypeOf(async function(){}).constructor,E=new x("viji","console",_),N=it.makeArtistConsole(globalThis.console);Yn=await E(ct.viji,N),self.renderFunction=Yn,ct.sendAllParametersToHost()}ct.seedInitialValues(i??{}),r=true}catch(h){const d=h;console.error("Failed to load scene code:",d),it.reportSceneError({message:`Scene code error: ${d.message}`,...d.stack!==void 0&&{stack:d.stack},code:d.__isShaderCompileError?"SHADER_COMPILE_ERROR":"SCENE_CODE_ERROR",sourceOverride:"scene",...d.__sourceLocation&&{sourceLocationOverride:d.__sourceLocation}})}finally{a()}}self.setSceneCode=Dy;
614
+ throw new Error("Scene code must define a render function");`,x=Object.getPrototypeOf(async function(){}).constructor,E=new x("viji","console",_),N=it.makeArtistConsole(globalThis.console);Yn=await E(ct.viji,N),self.renderFunction=Yn,ct.sendAllParametersToHost()}ct.seedInitialValues(i??{}),r=true}catch(h){const d=h;console.error("Failed to load scene code:",d),it.reportSceneError({message:`Scene code error: ${d.message}`,...d.stack!==void 0&&{stack:d.stack},code:d.__isShaderCompileError?"SHADER_COMPILE_ERROR":"SCENE_CODE_ERROR",sourceOverride:"scene",...d.__sourceLocation&&{sourceLocationOverride:d.__sourceLocation}})}finally{o()}}self.setSceneCode=Dy;
615
615
 
616
616
  })();