@viji-dev/core 0.13.0 → 0.15.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.
@@ -0,0 +1,608 @@
1
+ (()=>{const _n=globalThis.fetch.bind(globalThis),O1=4,B1=3e4,V1=6e5,go=12e4;class j1{pending=new Map;nextId=0;post;constructor(t){this.post=t;const s=this;globalThis.fetch=function(i,r){return s.fetch(i,r)}}fetch(t,s){const i=this.eligibleUrl(t,s);if(!i)return _n(t,s);const r=s?.signal??(t instanceof Request?t.signal:null);if(r?.aborted)return _n(t,s);const a=`asset_${++this.nextId}`;return new Promise((o,u)=>{const l={url:i,resolve:o,reject:u,input:t,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),B1),r&&(l.abortListener=()=>this.abort(a),r.addEventListener("abort",l.abortListener,{once:true})),this.post("cached-fetch",{id:a,url:i})})}eligibleUrl(t,s){try{let i,r=s?.headers;if(typeof t=="string"||t instanceof URL){if(i=String(t),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(t instanceof Request){if(s||t.method!=="GET"||t.body!=null||t.credentials==="include"||t.mode!=="cors"||t.integrity||t.cache==="no-store"||t.cache==="reload"||t.cache==="no-cache"||t.redirect!=="follow")return null;i=t.url,r=t.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(t){this.fallThrough(t.id)}handleWait(t){const s=this.pending.get(t.id);!s||s.settled||(this.clearTimer(s),s.timer=setTimeout(()=>this.fallThrough(t.id),V1))}handleBegin(t){const s=this.pending.get(t.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:t.id})},cancel(){i.cancel(t.id)}},new CountQueuingStrategy({highWaterMark:O1})),a=new Headers;t.contentType&&a.set("content-type",t.contentType),t.contentLength!==void 0&&a.set("content-length",String(t.contentLength)),s.timer=setTimeout(()=>this.streamError(t.id,"cached-fetch stream timed out"),go),s.resolve(new Response(r,{status:t.status,headers:a}))}handleChunk(t){const s=this.pending.get(t.id);if(!(!s||!s.controller)){if(t.seq!==s.nextSeq){this.streamError(t.id,"cached-fetch stream out of order");return}s.nextSeq++,this.clearTimer(s),s.timer=setTimeout(()=>this.streamError(t.id,"cached-fetch stream timed out"),go);try{s.controller.enqueue(new Uint8Array(t.bytes))}catch{this.cancel(t.id)}}}handleEnd(t){const s=this.pending.get(t.id);if(s){try{s.controller?.close()}catch{}this.cleanup(t.id)}}handleError(t){const s=this.pending.get(t.id);s&&(s.settled?this.streamError(t.id,t.message||"cached-fetch stream failed"):this.fallThrough(t.id))}fallThrough(t){const s=this.pending.get(t);!s||s.settled||(s.settled=true,this.cleanup(t),_n(s.input,s.init).then(s.resolve,s.reject))}streamError(t,s){const i=this.pending.get(t);if(i){try{i.controller?.error(new TypeError(s))}catch{}this.post("cached-fetch-cancel",{id:t}),this.cleanup(t)}}abort(t){const s=this.pending.get(t);if(s){if(!s.settled)s.settled=true,this.cleanup(t),s.reject(new DOMException("The operation was aborted.","AbortError"));else{try{s.controller?.error(new DOMException("The operation was aborted.","AbortError"))}catch{}this.cleanup(t)}this.post("cached-fetch-cancel",{id:t})}}cancel(t){this.pending.has(t)&&(this.post("cached-fetch-cancel",{id:t}),this.cleanup(t))}clearTimer(t){t.timer!==null&&(clearTimeout(t.timer),t.timer=null)}cleanup(t){const s=this.pending.get(t);s&&(this.clearTimer(s),s.signal&&s.abortListener&&(s.signal.removeEventListener("abort",s.abortListener),s.abortListener=null),this.pending.delete(t))}}function qn(e){if(typeof e=="string")return q1(e);if(e&&typeof e=="object"){const t=e,s="r"in t&&"g"in t&&"b"in t;if("h"in t&&"s"in t&&"b"in t&&!("r"in t)&&!("g"in t))return K1(t);if(s)return Y1(t);throw new Error(`Invalid color object: expected {r,g,b} or {h,s,b} keys, got ${JSON.stringify(e)}`)}throw new Error(`Invalid color input: expected string or object, got ${typeof e}`)}function Ui(e){const t=/^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i.exec(e);if(!t)throw new Error(`Expected canonical hex '#rrggbb', got: ${e}`);return{r:parseInt(t[1],16),g:parseInt(t[2],16),b:parseInt(t[3],16)}}function bo(e){const{r:t,g:s,b:i}=Ui(e),r=t/255,a=s/255,o=i/255,u=Math.max(r,a,o),l=Math.min(r,a,o),h=u-l;let p=0;h>0&&(u===r?p=(a-o)/h%6:u===a?p=(o-r)/h+2:p=(r-a)/h+4,p*=60,p<0&&(p+=360));const m=u===0?0:h/u*100,_=u*100;return{h:kn(p,4),s:kn(m,4),b:kn(_,4)}}function $1(e){const{r:t,g:s,b:i}=Ui(e);return[t/255,s/255,i/255]}function di(e,t,s){const i=xn(e,"r"),r=xn(t,"g"),a=xn(s,"b");return"#"+vn(i)+vn(r)+vn(a)}function Uc(e,t,s){if(typeof e!="number"||typeof t!="number"||typeof s!="number"||!isFinite(e)||!isFinite(t)||!isFinite(s))throw new Error(`Invalid HSB: h=${e}, s=${t}, b=${s}`);if(t<0||t>100)throw new Error(`HSB saturation must be 0..100, got: ${t}`);if(s<0||s>100)throw new Error(`HSB brightness must be 0..100, got: ${s}`);const i=(e%360+360)%360,r=t/100,a=s/100,o=a*r,u=i/60,l=o*(1-Math.abs(u%2-1));let h=0,p=0,m=0;u<1?(h=o,p=l,m=0):u<2?(h=l,p=o,m=0):u<3?(h=0,p=o,m=l):u<4?(h=0,p=l,m=o):u<5?(h=l,p=0,m=o):(h=o,p=0,m=l);const _=a-o;return di(Math.round((h+_)*255),Math.round((p+_)*255),Math.round((m+_)*255))}function q1(e){const t=e.trim();if(t.startsWith("#"))return H1(t);const s=t.match(/^(rgb|hsl|hsb|vec3)\s*\(([^)]*)\)$/i);if(s){const i=s[1].toLowerCase(),r=s[2];switch(i){case"rgb":return W1(r);case"hsl":return G1(r);case"hsb":return X1(r);case"vec3":return z1(r)}}throw new Error(`Invalid color string: '${e}'. Expected #rrggbb, #rgb, rgb(...), hsl(...), hsb(...), or vec3(...)`)}function H1(e){if(/^#[0-9a-fA-F]{6}$/.test(e))return e.toLowerCase();if(/^#[0-9a-fA-F]{3}$/.test(e)){const t=e[1],s=e[2],i=e[3];return("#"+t+t+s+s+i+i).toLowerCase()}throw new Error(`Invalid hex color: '${e}'. Expected #rrggbb or #rgb`)}function W1(e){const t=or(e);if(t.length!==3)throw new Error(`rgb() requires 3 arguments, got ${t.length}: rgb(${e})`);const s=gt(t[0],"r"),i=gt(t[1],"g"),r=gt(t[2],"b");return di(s,i,r)}function G1(e){const t=or(e);if(t.length!==3)throw new Error(`hsl() requires 3 arguments, got ${t.length}: hsl(${e})`);const s=gt(t[0],"h"),i=yo(t[1],"s"),r=yo(t[2],"l");return Z1(s,i,r)}function X1(e){const t=or(e);if(t.length!==3)throw new Error(`hsb() requires 3 arguments, got ${t.length}: hsb(${e})`);const s=gt(t[0],"h"),i=gt(t[1],"s"),r=gt(t[2],"b");return Uc(s,i,r)}function z1(e){const t=or(e);if(t.length!==3)throw new Error(`vec3() requires 3 arguments, got ${t.length}: vec3(${e})`);const s=gt(t[0],"r"),i=gt(t[1],"g"),r=gt(t[2],"b");if(s<0||s>1||i<0||i>1||r<0||r>1)throw new Error(`vec3() components must be in 0..1, got: vec3(${s}, ${i}, ${r})`);return di(Math.round(s*255),Math.round(i*255),Math.round(r*255))}function Y1(e){const t=As(e.r,"r"),s=As(e.g,"g"),i=As(e.b,"b");return di(t,s,i)}function K1(e){const t=As(e.h,"h"),s=As(e.s,"s"),i=As(e.b,"b");return Uc(t,s,i)}function Z1(e,t,s){if(t<0||t>100)throw new Error(`HSL saturation must be 0..100%, got: ${t}%`);if(s<0||s>100)throw new Error(`HSL lightness must be 0..100%, got: ${s}%`);const i=(e%360+360)%360,r=t/100,a=s/100,o=(1-Math.abs(2*a-1))*r,u=i/60,l=o*(1-Math.abs(u%2-1));let h=0,p=0,m=0;u<1?(h=o,p=l,m=0):u<2?(h=l,p=o,m=0):u<3?(h=0,p=o,m=l):u<4?(h=0,p=l,m=o):u<5?(h=l,p=0,m=o):(h=o,p=0,m=l);const _=a-o/2;return di(Math.round((h+_)*255),Math.round((p+_)*255),Math.round((m+_)*255))}function or(e){return e.split(",").map(t=>t.trim()).filter(t=>t.length>0)}function gt(e,t){const s=parseFloat(e);if(!isFinite(s))throw new Error(`Invalid number for '${t}': '${e}'`);return s}function yo(e,t){if(!e.endsWith("%"))throw new Error(`Field '${t}' must use percent notation (e.g., 50%), got: '${e}'`);return gt(e.slice(0,-1),t)}function As(e,t){if(typeof e!="number"||!isFinite(e))throw new Error(`Invalid color field '${t}': expected finite number, got ${e}`);return e}function xn(e,t){if(typeof e!="number"||!isFinite(e))throw new Error(`RGB component '${t}' must be a finite number, got: ${e}`);if(e<0||e>255)throw new Error(`RGB component '${t}' must be 0..255, got: ${e}`);return Math.round(e)}function vn(e){return e.toString(16).padStart(2,"0")}function kn(e,t){const s=10**t;return Math.round(e*s)/s}var Q1=[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],Mc=[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],J1="‌‍·̀-ͯ·҃-֑҇-ׇֽֿׁׂׅׄؐ-ًؚ-٩ٰۖ-ۜ۟-۪ۤۧۨ-ۭ۰-۹ܑܰ-݊ަ-ް߀-߉߫-߽߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛ࢗ-࢟࣊-ࣣ࣡-ःऺ-़ा-ॏ॑-ॗॢॣ०-९ঁ-ঃ়া-ৄেৈো-্ৗৢৣ০-৯৾ਁ-ਃ਼ਾ-ੂੇੈੋ-੍ੑ੦-ੱੵઁ-ઃ઼ા-ૅે-ૉો-્ૢૣ૦-૯ૺ-૿ଁ-ଃ଼ା-ୄେୈୋ-୍୕-ୗୢୣ୦-୯ஂா-ூெ-ைொ-்ௗ௦-௯ఀ-ఄ఼ా-ౄె-ైొ-్ౕౖౢౣ౦-౯ಁ-ಃ಼ಾ-ೄೆ-ೈೊ-್ೕೖೢೣ೦-೯ೳഀ-ഃ഻഼ാ-ൄെ-ൈൊ-്ൗൢൣ൦-൯ඁ-ඃ්ා-ුූෘ-ෟ෦-෯ෲෳัิ-ฺ็-๎๐-๙ັິ-ຼ່-໎໐-໙༘༙༠-༩༹༵༷༾༿ཱ-྄྆྇ྍ-ྗྙ-ྼ࿆ါ-ှ၀-၉ၖ-ၙၞ-ၠၢ-ၤၧ-ၭၱ-ၴႂ-ႍႏ-ႝ፝-፟፩-፱ᜒ-᜕ᜲ-᜴ᝒᝓᝲᝳ឴-៓៝០-៩᠋-᠍᠏-᠙ᢩᤠ-ᤫᤰ-᤻᥆-᥏᧐-᧚ᨗ-ᨛᩕ-ᩞ᩠-᩿᩼-᪉᪐-᪙᪰-᪽ᪿ-ᫎᬀ-ᬄ᬴-᭄᭐-᭙᭫-᭳ᮀ-ᮂᮡ-ᮭ᮰-᮹᯦-᯳ᰤ-᰷᱀-᱉᱐-᱙᳐-᳔᳒-᳨᳭᳴᳷-᳹᷀-᷿‌‍‿⁀⁔⃐-⃥⃜⃡-⃰⳯-⵿⳱ⷠ-〪ⷿ-゙゚〯・꘠-꘩꙯ꙴ-꙽ꚞꚟ꛰꛱ꠂ꠆ꠋꠣ-ꠧ꠬ꢀꢁꢴ-ꣅ꣐-꣙꣠-꣱ꣿ-꤉ꤦ-꤭ꥇ-꥓ꦀ-ꦃ꦳-꧀꧐-꧙ꧥ꧰-꧹ꨩ-ꨶꩃꩌꩍ꩐-꩙ꩻ-ꩽꪰꪲ-ꪴꪷꪸꪾ꪿꫁ꫫ-ꫯꫵ꫶ꯣ-ꯪ꯬꯭꯰-꯹ﬞ︀-️︠-︯︳︴﹍-﹏0-9_・",Oc="ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԯԱ-Ֆՙՠ-ֈא-תׯ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࡠ-ࡪࡰ-ࢇࢉ-ࢎࢠ-ࣉऄ-हऽॐक़-ॡॱ-ঀঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱৼਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡૹଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-హఽౘ-ౚౝౠౡಀಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೝೞೠೡೱೲഄ-ഌഎ-ഐഒ-ഺഽൎൔ-ൖൟ-ൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄຆ-ຊຌ-ຣລວ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏽᏸ-ᏽᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜑᜟ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡸᢀ-ᢨᢪᢰ-ᣵᤀ-ᤞᥐ-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭌᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᲀ-ᲊᲐ-ᲺᲽ-Ჿᳩ-ᳬᳮ-ᳳᳵᳶᳺᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕ℘-ℝℤΩℨK-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞ々-〇〡-〩〱-〵〸-〼ぁ-ゖ゛-ゟァ-ヺー-ヿㄅ-ㄯㄱ-ㆎㆠ-ㆿㇰ-ㇿ㐀-䶿一-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚝꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ-ꟍꟐꟑꟓꟕ-Ƛꟲ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꣽꣾꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꧠ-ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꩾ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭩꭰ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ",wn={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"},En="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",eh={5:En,"5module":En+" export import",6:En+" const class extends export import super"},th=/^in(stanceof)?$/,sh=new RegExp("["+Oc+"]"),ih=new RegExp("["+Oc+J1+"]");function Hn(e,t){for(var s=65536,i=0;i<t.length;i+=2){if(s+=t[i],s>e)return false;if(s+=t[i+1],s>=e)return true}return false}function Lt(e,t){return e<65?e===36:e<91?true:e<97?e===95:e<123?true:e<=65535?e>=170&&sh.test(String.fromCharCode(e)):t===false?false:Hn(e,Mc)}function as(e,t){return e<48?e===36:e<58?true:e<65?false:e<91?true:e<97?e===95:e<123?true:e<=65535?e>=170&&ih.test(String.fromCharCode(e)):t===false?false:Hn(e,Mc)||Hn(e,Q1)}var ye=function(t,s){s===void 0&&(s={}),this.label=t,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 nt(e,t){return new ye(e,{beforeExpr:true,binop:t})}var at={beforeExpr:true},Ye={startsExpr:true},_a={};function be(e,t){return t===void 0&&(t={}),t.keyword=e,_a[e]=new ye(e,t)}var f={num:new ye("num",Ye),regexp:new ye("regexp",Ye),string:new ye("string",Ye),name:new ye("name",Ye),privateId:new ye("privateId",Ye),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("`",Ye),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:nt("||",1),logicalAND:nt("&&",2),bitwiseOR:nt("|",3),bitwiseXOR:nt("^",4),bitwiseAND:nt("&",5),equality:nt("==/!=/===/!==",6),relational:nt("</>/<=/>=",7),bitShift:nt("<</>>/>>>",8),plusMin:new ye("+/-",{beforeExpr:true,binop:9,prefix:true,startsExpr:true}),modulo:nt("%",10),star:nt("*",10),slash:nt("/",10),starstar:new ye("**",{beforeExpr:true}),coalesce:nt("??",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",Ye),_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",Ye),_super:be("super",Ye),_class:be("class",Ye),_extends:be("extends",at),_export:be("export"),_import:be("import",Ye),_null:be("null",Ye),_true:be("true",Ye),_false:be("false",Ye),_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})},tt=/\r\n?|\n|\u2028|\u2029/,rh=new RegExp(tt.source,"g");function Fs(e){return e===10||e===13||e===8232||e===8233}function Bc(e,t,s){s===void 0&&(s=e.length);for(var i=t;i<s;i++){var r=e.charCodeAt(i);if(Fs(r))return i<s-1&&r===13&&e.charCodeAt(i+1)===10?i+2:i+1}return-1}var Vc=/[\u1680\u2000-\u200a\u202f\u205f\u3000\ufeff]/,qe=/(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g,jc=Object.prototype,nh=jc.hasOwnProperty,ah=jc.toString,Us=Object.hasOwn||function(e,t){return nh.call(e,t)},_o=Array.isArray||function(e){return ah.call(e)==="[object Array]"},xo=Object.create(null);function Qt(e){return xo[e]||(xo[e]=new RegExp("^(?:"+e.replace(/ /g,"|")+")$"))}function Ht(e){return e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode((e>>10)+55296,(e&1023)+56320))}var oh=/(?:[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/,ei=function(t,s){this.line=t,this.column=s};ei.prototype.offset=function(t){return new ei(this.line,this.column+t)};var cr=function(t,s,i){this.start=s,this.end=i,t.sourceFile!==null&&(this.source=t.sourceFile)};function $c(e,t){for(var s=1,i=0;;){var r=Bc(e,i,t);if(r<0)return new ei(s,t-i);++s,i=r}}var Wn={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},vo=false;function ch(e){var t={};for(var s in Wn)t[s]=e&&Us(e,s)?e[s]:Wn[s];if(t.ecmaVersion==="latest"?t.ecmaVersion=1e8:t.ecmaVersion==null?(!vo&&typeof console=="object"&&console.warn&&(vo=true,console.warn(`Since Acorn 8.0.0, options.ecmaVersion is required.
2
+ Defaulting to 2020, but this will stop working in the future.`)),t.ecmaVersion=11):t.ecmaVersion>=2015&&(t.ecmaVersion-=2009),t.allowReserved==null&&(t.allowReserved=t.ecmaVersion<5),(!e||e.allowHashBang==null)&&(t.allowHashBang=t.ecmaVersion>=14),_o(t.onToken)){var i=t.onToken;t.onToken=function(r){return i.push(r)}}return _o(t.onComment)&&(t.onComment=uh(t,t.onComment)),t}function uh(e,t){return function(s,i,r,a,o,u){var l={type:s?"Block":"Line",value:i,start:r,end:a};e.locations&&(l.loc=new cr(this,o,u)),e.ranges&&(l.range=[r,a]),t.push(l)}}var ti=1,Ms=2,xa=4,qc=8,va=16,Hc=32,ur=64,Wc=128,xs=256,pi=512,lr=ti|Ms|xs;function ka(e,t){return Ms|(e?xa:0)|(t?qc:0)}var Mi=0,wa=1,zt=2,Gc=3,Xc=4,zc=5,Ne=function(t,s,i){this.options=t=ch(t),this.sourceFile=t.sourceFile,this.keywords=Qt(eh[t.ecmaVersion>=6?6:t.sourceType==="module"?"5module":5]);var r="";t.allowReserved!==true&&(r=wn[t.ecmaVersion>=6?6:t.ecmaVersion===5?5:3],t.sourceType==="module"&&(r+=" await")),this.reservedWords=Qt(r);var a=(r?r+" ":"")+wn.strict;this.reservedWordsStrict=Qt(a),this.reservedWordsStrictBind=Qt(a+" "+wn.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(tt).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=t.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&&t.allowHashBang&&this.input.slice(0,2)==="#!"&&this.skipLineComment(2),this.scopeStack=[],this.enterScope(ti),this.regexpState=null,this.privateNameStack=[]},Ft={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 t=this.options.program||this.startNode();return this.nextToken(),this.parseTopLevel(t)};Ft.inFunction.get=function(){return(this.currentVarScope().flags&Ms)>0};Ft.inGenerator.get=function(){return(this.currentVarScope().flags&qc)>0};Ft.inAsync.get=function(){return(this.currentVarScope().flags&xa)>0};Ft.canAwait.get=function(){for(var e=this.scopeStack.length-1;e>=0;e--){var t=this.scopeStack[e],s=t.flags;if(s&(xs|pi))return false;if(s&Ms)return(s&xa)>0}return this.inModule&&this.options.ecmaVersion>=13||this.options.allowAwaitOutsideFunction};Ft.allowSuper.get=function(){var e=this.currentThisScope(),t=e.flags;return(t&ur)>0||this.options.allowSuperOutsideMethod};Ft.allowDirectSuper.get=function(){return(this.currentThisScope().flags&Wc)>0};Ft.treatFunctionsAsVar.get=function(){return this.treatFunctionsAsVarInScope(this.currentScope())};Ft.allowNewDotTarget.get=function(){for(var e=this.scopeStack.length-1;e>=0;e--){var t=this.scopeStack[e],s=t.flags;if(s&(xs|pi)||s&Ms&&!(s&va))return true}return false};Ft.inClassStaticBlock.get=function(){return(this.currentVarScope().flags&xs)>0};Ne.extend=function(){for(var t=[],s=arguments.length;s--;)t[s]=arguments[s];for(var i=this,r=0;r<t.length;r++)i=t[r](i);return i};Ne.parse=function(t,s){return new this(s,t).parse()};Ne.parseExpressionAt=function(t,s,i){var r=new this(i,t,s);return r.nextToken(),r.parseExpression()};Ne.tokenizer=function(t,s){return new this(s,t)};Object.defineProperties(Ne.prototype,Ft);var Xe=Ne.prototype,lh=/^(?:'((?:\\[^]|[^'\\])*?)'|"((?:\\[^]|[^"\\])*?)")/;Xe.strictDirective=function(e){if(this.options.ecmaVersion<5)return false;for(;;){qe.lastIndex=e,e+=qe.exec(this.input)[0].length;var t=lh.exec(this.input.slice(e));if(!t)return false;if((t[1]||t[2])==="use strict"){qe.lastIndex=e+t[0].length;var s=qe.exec(this.input),i=s.index+s[0].length,r=this.input.charAt(i);return r===";"||r==="}"||tt.test(s[0])&&!(/[(`.[+\-/*%<>=,?^&]/.test(r)||r==="!"&&this.input.charAt(i+1)==="=")}e+=t[0].length,qe.lastIndex=e,e+=qe.exec(this.input)[0].length,this.input[e]===";"&&e++}};Xe.eat=function(e){return this.type===e?(this.next(),true):false};Xe.isContextual=function(e){return this.type===f.name&&this.value===e&&!this.containsEsc};Xe.eatContextual=function(e){return this.isContextual(e)?(this.next(),true):false};Xe.expectContextual=function(e){this.eatContextual(e)||this.unexpected()};Xe.canInsertSemicolon=function(){return this.type===f.eof||this.type===f.braceR||tt.test(this.input.slice(this.lastTokEnd,this.start))};Xe.insertSemicolon=function(){if(this.canInsertSemicolon())return this.options.onInsertedSemicolon&&this.options.onInsertedSemicolon(this.lastTokEnd,this.lastTokEndLoc),true};Xe.semicolon=function(){!this.eat(f.semi)&&!this.insertSemicolon()&&this.unexpected()};Xe.afterTrailingComma=function(e,t){if(this.type===e)return this.options.onTrailingComma&&this.options.onTrailingComma(this.lastTokStart,this.lastTokStartLoc),t||this.next(),true};Xe.expect=function(e){this.eat(e)||this.unexpected()};Xe.unexpected=function(e){this.raise(e??this.start,"Unexpected token")};var hr=function(){this.shorthandAssign=this.trailingComma=this.parenthesizedAssign=this.parenthesizedBind=this.doubleProto=-1};Xe.checkPatternErrors=function(e,t){if(e){e.trailingComma>-1&&this.raiseRecoverable(e.trailingComma,"Comma is not permitted after the rest element");var s=t?e.parenthesizedAssign:e.parenthesizedBind;s>-1&&this.raiseRecoverable(s,t?"Assigning to rvalue":"Parenthesized pattern")}};Xe.checkExpressionErrors=function(e,t){if(!e)return false;var s=e.shorthandAssign,i=e.doubleProto;if(!t)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")};Xe.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")};Xe.isSimpleAssignTarget=function(e){return e.type==="ParenthesizedExpression"?this.isSimpleAssignTarget(e.expression):e.type==="Identifier"||e.type==="MemberExpression"};var J=Ne.prototype;J.parseTopLevel=function(e){var t=Object.create(null);for(e.body||(e.body=[]);this.type!==f.eof;){var s=this.parseStatement(null,true,t);e.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(e.body),this.next(),e.sourceType=this.options.sourceType,this.finishNode(e,"Program")};var Ea={kind:"loop"},hh={kind:"switch"};J.isLet=function(e){if(this.options.ecmaVersion<6||!this.isContextual("let"))return false;qe.lastIndex=this.pos;var t=qe.exec(this.input),s=this.pos+t[0].length,i=this.input.charCodeAt(s);if(i===91||i===92)return true;if(e)return false;if(i===123||i>55295&&i<56320)return true;if(Lt(i,true)){for(var r=s+1;as(i=this.input.charCodeAt(r),true);)++r;if(i===92||i>55295&&i<56320)return true;var a=this.input.slice(s,r);if(!th.test(a))return true}return false};J.isAsyncFunction=function(){if(this.options.ecmaVersion<8||!this.isContextual("async"))return false;qe.lastIndex=this.pos;var e=qe.exec(this.input),t=this.pos+e[0].length,s;return!tt.test(this.input.slice(this.pos,t))&&this.input.slice(t,t+8)==="function"&&(t+8===this.input.length||!(as(s=this.input.charCodeAt(t+8))||s>55295&&s<56320))};J.isUsingKeyword=function(e,t){if(this.options.ecmaVersion<17||!this.isContextual(e?"await":"using"))return false;qe.lastIndex=this.pos;var s=qe.exec(this.input),i=this.pos+s[0].length;if(tt.test(this.input.slice(this.pos,i)))return false;if(e){var r=i+5,a;if(this.input.slice(i,r)!=="using"||r===this.input.length||as(a=this.input.charCodeAt(r))||a>55295&&a<56320)return false;qe.lastIndex=r;var o=qe.exec(this.input);if(o&&tt.test(this.input.slice(r,r+o[0].length)))return false}if(t){var u=i+2,l;if(this.input.slice(i,u)==="of"&&(u===this.input.length||!as(l=this.input.charCodeAt(u))&&!(l>55295&&l<56320)))return false}var h=this.input.charCodeAt(i);return Lt(h,true)||h===92};J.isAwaitUsing=function(e){return this.isUsingKeyword(true,e)};J.isUsing=function(e){return this.isUsingKeyword(false,e)};J.parseStatement=function(e,t,s){var i=this.type,r=this.startNode(),a;switch(this.isLet(e)&&(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 e&&(this.strict||e!=="if"&&e!=="label")&&this.options.ecmaVersion>=6&&this.unexpected(),this.parseFunctionStatement(r,false,!e);case f._class:return e&&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,e&&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){qe.lastIndex=this.pos;var o=qe.exec(this.input),u=this.pos+o[0].length,l=this.input.charCodeAt(u);if(l===40||l===46)return this.parseExpressionStatement(r,this.parseExpression())}return this.options.allowImportExportEverywhere||(t||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 e&&this.unexpected(),this.next(),this.parseFunctionStatement(r,true,!e);var h=this.isAwaitUsing(false)?"await using":this.isUsing(false)?"using":null;if(h)return t&&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 p=this.value,m=this.parseExpression();return i===f.name&&m.type==="Identifier"&&this.eat(f.colon)?this.parseLabeledStatement(r,p,m,e):this.parseExpressionStatement(r,m)}};J.parseBreakContinueStatement=function(e,t){var s=t==="break";this.next(),this.eat(f.semi)||this.insertSemicolon()?e.label=null:this.type!==f.name?this.unexpected():(e.label=this.parseIdent(),this.semicolon());for(var i=0;i<this.labels.length;++i){var r=this.labels[i];if((e.label==null||r.name===e.label.name)&&(r.kind!=null&&(s||r.kind==="loop")||e.label&&s))break}return i===this.labels.length&&this.raise(e.start,"Unsyntactic "+t),this.finishNode(e,s?"BreakStatement":"ContinueStatement")};J.parseDebuggerStatement=function(e){return this.next(),this.semicolon(),this.finishNode(e,"DebuggerStatement")};J.parseDoStatement=function(e){return this.next(),this.labels.push(Ea),e.body=this.parseStatement("do"),this.labels.pop(),this.expect(f._while),e.test=this.parseParenExpression(),this.options.ecmaVersion>=6?this.eat(f.semi):this.semicolon(),this.finishNode(e,"DoWhileStatement")};J.parseForStatement=function(e){this.next();var t=this.options.ecmaVersion>=9&&this.canAwait&&this.eatContextual("await")?this.lastTokStart:-1;if(this.labels.push(Ea),this.enterScope(0),this.expect(f.parenL),this.type===f.semi)return t>-1&&this.unexpected(t),this.parseFor(e,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(e,i,t)}var a=this.isContextual("let"),o=false,u=this.isUsing(true)?"using":this.isAwaitUsing(true)?"await using":null;if(u){var l=this.startNode();return this.next(),u==="await using"&&this.next(),this.parseVar(l,true,u),this.finishNode(l,"VariableDeclaration"),this.parseForAfterInit(e,l,t)}var h=this.containsEsc,p=new hr,m=this.start,_=t>-1?this.parseExprSubscripts(p,"await"):this.parseExpression(true,p);return this.type===f._in||(o=this.options.ecmaVersion>=6&&this.isContextual("of"))?(t>-1?(this.type===f._in&&this.unexpected(t),e.await=true):o&&this.options.ecmaVersion>=8&&(_.start===m&&!h&&_.type==="Identifier"&&_.name==="async"?this.unexpected():this.options.ecmaVersion>=9&&(e.await=false)),a&&o&&this.raise(_.start,"The left-hand side of a for-of loop may not start with 'let'."),this.toAssignable(_,false,p),this.checkLValPattern(_),this.parseForIn(e,_)):(this.checkExpressionErrors(p,true),t>-1&&this.unexpected(t),this.parseFor(e,_))};J.parseForAfterInit=function(e,t,s){return(this.type===f._in||this.options.ecmaVersion>=6&&this.isContextual("of"))&&t.declarations.length===1?(this.options.ecmaVersion>=9&&(this.type===f._in?s>-1&&this.unexpected(s):e.await=s>-1),this.parseForIn(e,t)):(s>-1&&this.unexpected(s),this.parseFor(e,t))};J.parseFunctionStatement=function(e,t,s){return this.next(),this.parseFunction(e,Zs|(s?0:Gn),false,t)};J.parseIfStatement=function(e){return this.next(),e.test=this.parseParenExpression(),e.consequent=this.parseStatement("if"),e.alternate=this.eat(f._else)?this.parseStatement("if"):null,this.finishNode(e,"IfStatement")};J.parseReturnStatement=function(e){return!this.inFunction&&!this.options.allowReturnOutsideFunction&&this.raise(this.start,"'return' outside of function"),this.next(),this.eat(f.semi)||this.insertSemicolon()?e.argument=null:(e.argument=this.parseExpression(),this.semicolon()),this.finishNode(e,"ReturnStatement")};J.parseSwitchStatement=function(e){this.next(),e.discriminant=this.parseParenExpression(),e.cases=[],this.expect(f.braceL),this.labels.push(hh),this.enterScope(0);for(var t,s=false;this.type!==f.braceR;)if(this.type===f._case||this.type===f._default){var i=this.type===f._case;t&&this.finishNode(t,"SwitchCase"),e.cases.push(t=this.startNode()),t.consequent=[],this.next(),i?t.test=this.parseExpression():(s&&this.raiseRecoverable(this.lastTokStart,"Multiple default clauses"),s=true,t.test=null),this.expect(f.colon)}else t||this.unexpected(),t.consequent.push(this.parseStatement(null));return this.exitScope(),t&&this.finishNode(t,"SwitchCase"),this.next(),this.labels.pop(),this.finishNode(e,"SwitchStatement")};J.parseThrowStatement=function(e){return this.next(),tt.test(this.input.slice(this.lastTokEnd,this.start))&&this.raise(this.lastTokEnd,"Illegal newline after throw"),e.argument=this.parseExpression(),this.semicolon(),this.finishNode(e,"ThrowStatement")};var fh=[];J.parseCatchClauseParam=function(){var e=this.parseBindingAtom(),t=e.type==="Identifier";return this.enterScope(t?Hc:0),this.checkLValPattern(e,t?Xc:zt),this.expect(f.parenR),e};J.parseTryStatement=function(e){if(this.next(),e.block=this.parseBlock(),e.handler=null,this.type===f._catch){var t=this.startNode();this.next(),this.eat(f.parenL)?t.param=this.parseCatchClauseParam():(this.options.ecmaVersion<10&&this.unexpected(),t.param=null,this.enterScope(0)),t.body=this.parseBlock(false),this.exitScope(),e.handler=this.finishNode(t,"CatchClause")}return e.finalizer=this.eat(f._finally)?this.parseBlock():null,!e.handler&&!e.finalizer&&this.raise(e.start,"Missing catch or finally clause"),this.finishNode(e,"TryStatement")};J.parseVarStatement=function(e,t,s){return this.next(),this.parseVar(e,false,t,s),this.semicolon(),this.finishNode(e,"VariableDeclaration")};J.parseWhileStatement=function(e){return this.next(),e.test=this.parseParenExpression(),this.labels.push(Ea),e.body=this.parseStatement("while"),this.labels.pop(),this.finishNode(e,"WhileStatement")};J.parseWithStatement=function(e){return this.strict&&this.raise(this.start,"'with' in strict mode"),this.next(),e.object=this.parseParenExpression(),e.body=this.parseStatement("with"),this.finishNode(e,"WithStatement")};J.parseEmptyStatement=function(e){return this.next(),this.finishNode(e,"EmptyStatement")};J.parseLabeledStatement=function(e,t,s,i){for(var r=0,a=this.labels;r<a.length;r+=1){var o=a[r];o.name===t&&this.raise(s.start,"Label '"+t+"' is already declared")}for(var u=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===e.start)h.statementStart=this.start,h.kind=u;else break}return this.labels.push({name:t,kind:u,statementStart:this.start}),e.body=this.parseStatement(i?i.indexOf("label")===-1?i+"label":i:"label"),this.labels.pop(),e.label=s,this.finishNode(e,"LabeledStatement")};J.parseExpressionStatement=function(e,t){return e.expression=t,this.semicolon(),this.finishNode(e,"ExpressionStatement")};J.parseBlock=function(e,t,s){for(e===void 0&&(e=true),t===void 0&&(t=this.startNode()),t.body=[],this.expect(f.braceL),e&&this.enterScope(0);this.type!==f.braceR;){var i=this.parseStatement(null);t.body.push(i)}return s&&(this.strict=false),this.next(),e&&this.exitScope(),this.finishNode(t,"BlockStatement")};J.parseFor=function(e,t){return e.init=t,this.expect(f.semi),e.test=this.type===f.semi?null:this.parseExpression(),this.expect(f.semi),e.update=this.type===f.parenR?null:this.parseExpression(),this.expect(f.parenR),e.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(e,"ForStatement")};J.parseForIn=function(e,t){var s=this.type===f._in;return this.next(),t.type==="VariableDeclaration"&&t.declarations[0].init!=null&&(!s||this.options.ecmaVersion<8||this.strict||t.kind!=="var"||t.declarations[0].id.type!=="Identifier")&&this.raise(t.start,(s?"for-in":"for-of")+" loop variable declaration may not have an initializer"),e.left=t,e.right=s?this.parseExpression():this.parseMaybeAssign(),this.expect(f.parenR),e.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(e,s?"ForInStatement":"ForOfStatement")};J.parseVar=function(e,t,s,i){for(e.declarations=[],e.kind=s;;){var r=this.startNode();if(this.parseVarId(r,s),this.eat(f.eq)?r.init=this.parseMaybeAssign(t):!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"&&!(t&&(this.type===f._in||this.isContextual("of")))?this.raise(this.lastTokEnd,"Complex binding patterns require an initialization value"):r.init=null,e.declarations.push(this.finishNode(r,"VariableDeclarator")),!this.eat(f.comma))break}return e};J.parseVarId=function(e,t){e.id=t==="using"||t==="await using"?this.parseIdent():this.parseBindingAtom(),this.checkLValPattern(e.id,t==="var"?wa:zt,false)};var Zs=1,Gn=2,Yc=4;J.parseFunction=function(e,t,s,i,r){this.initFunction(e),(this.options.ecmaVersion>=9||this.options.ecmaVersion>=6&&!i)&&(this.type===f.star&&t&Gn&&this.unexpected(),e.generator=this.eat(f.star)),this.options.ecmaVersion>=8&&(e.async=!!i),t&Zs&&(e.id=t&Yc&&this.type!==f.name?null:this.parseIdent(),e.id&&!(t&Gn)&&this.checkLValSimple(e.id,this.strict||e.generator||e.async?this.treatFunctionsAsVar?wa:zt:Gc));var a=this.yieldPos,o=this.awaitPos,u=this.awaitIdentPos;return this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(ka(e.async,e.generator)),t&Zs||(e.id=this.type===f.name?this.parseIdent():null),this.parseFunctionParams(e),this.parseFunctionBody(e,s,false,r),this.yieldPos=a,this.awaitPos=o,this.awaitIdentPos=u,this.finishNode(e,t&Zs?"FunctionDeclaration":"FunctionExpression")};J.parseFunctionParams=function(e){this.expect(f.parenL),e.params=this.parseBindingList(f.parenR,false,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams()};J.parseClass=function(e,t){this.next();var s=this.strict;this.strict=true,this.parseClassId(e,t),this.parseClassSuper(e);var i=this.enterClassBody(),r=this.startNode(),a=false;for(r.body=[],this.expect(f.braceL);this.type!==f.braceR;){var o=this.parseClassElement(e.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"&&dh(i,o)&&this.raiseRecoverable(o.key.start,"Identifier '#"+o.key.name+"' has already been declared"))}return this.strict=s,this.next(),e.body=this.finishNode(r,"ClassBody"),this.exitClassBody(),this.finishNode(e,t?"ClassDeclaration":"ClassExpression")};J.parseClassElement=function(e){if(this.eat(f.semi))return null;var t=this.options.ecmaVersion,s=this.startNode(),i="",r=false,a=false,o="method",u=false;if(this.eatContextual("static")){if(t>=13&&this.eat(f.braceL))return this.parseClassStaticBlock(s),s;this.isClassElementNameStart()||this.type===f.star?u=true:i="static"}if(s.static=u,!i&&t>=8&&this.eatContextual("async")&&((this.isClassElementNameStart()||this.type===f.star)&&!this.canInsertSemicolon()?a=true:i="async"),!i&&(t>=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),t<13||this.type===f.parenL||o!=="method"||r||a){var h=!s.static&&Oi(s,"constructor"),p=h&&e;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,p)}else this.parseClassField(s);return s};J.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};J.parseClassElementName=function(e){this.type===f.privateId?(this.value==="constructor"&&this.raise(this.start,"Classes can't have an element named '#constructor'"),e.computed=false,e.key=this.parsePrivateIdent()):this.parsePropertyName(e)};J.parseClassMethod=function(e,t,s,i){var r=e.key;e.kind==="constructor"?(t&&this.raise(r.start,"Constructor can't be a generator"),s&&this.raise(r.start,"Constructor can't be an async method")):e.static&&Oi(e,"prototype")&&this.raise(r.start,"Classes may not have a static property named prototype");var a=e.value=this.parseMethod(t,s,i);return e.kind==="get"&&a.params.length!==0&&this.raiseRecoverable(a.start,"getter should have no params"),e.kind==="set"&&a.params.length!==1&&this.raiseRecoverable(a.start,"setter should have exactly one param"),e.kind==="set"&&a.params[0].type==="RestElement"&&this.raiseRecoverable(a.params[0].start,"Setter cannot use rest params"),this.finishNode(e,"MethodDefinition")};J.parseClassField=function(e){return Oi(e,"constructor")?this.raise(e.key.start,"Classes can't have a field named 'constructor'"):e.static&&Oi(e,"prototype")&&this.raise(e.key.start,"Classes can't have a static field named 'prototype'"),this.eat(f.eq)?(this.enterScope(pi|ur),e.value=this.parseMaybeAssign(),this.exitScope()):e.value=null,this.semicolon(),this.finishNode(e,"PropertyDefinition")};J.parseClassStaticBlock=function(e){e.body=[];var t=this.labels;for(this.labels=[],this.enterScope(xs|ur);this.type!==f.braceR;){var s=this.parseStatement(null);e.body.push(s)}return this.next(),this.exitScope(),this.labels=t,this.finishNode(e,"StaticBlock")};J.parseClassId=function(e,t){this.type===f.name?(e.id=this.parseIdent(),t&&this.checkLValSimple(e.id,zt,false)):(t===true&&this.unexpected(),e.id=null)};J.parseClassSuper=function(e){e.superClass=this.eat(f._extends)?this.parseExprSubscripts(null,false):null};J.enterClassBody=function(){var e={declared:Object.create(null),used:[]};return this.privateNameStack.push(e),e.declared};J.exitClassBody=function(){var e=this.privateNameStack.pop(),t=e.declared,s=e.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];Us(t,o.name)||(r?r.used.push(o):this.raiseRecoverable(o.start,"Private field '#"+o.name+"' must be declared in an enclosing class"))}};function dh(e,t){var s=t.key.name,i=e[s],r="true";return t.type==="MethodDefinition"&&(t.kind==="get"||t.kind==="set")&&(r=(t.static?"s":"i")+t.kind),i==="iget"&&r==="iset"||i==="iset"&&r==="iget"||i==="sget"&&r==="sset"||i==="sset"&&r==="sget"?(e[s]="true",false):i?true:(e[s]=r,false)}function Oi(e,t){var s=e.computed,i=e.key;return!s&&(i.type==="Identifier"&&i.name===t||i.type==="Literal"&&i.value===t)}J.parseExportAllDeclaration=function(e,t){return this.options.ecmaVersion>=11&&(this.eatContextual("as")?(e.exported=this.parseModuleExportName(),this.checkExport(t,e.exported,this.lastTokStart)):e.exported=null),this.expectContextual("from"),this.type!==f.string&&this.unexpected(),e.source=this.parseExprAtom(),this.options.ecmaVersion>=16&&(e.attributes=this.parseWithClause()),this.semicolon(),this.finishNode(e,"ExportAllDeclaration")};J.parseExport=function(e,t){if(this.next(),this.eat(f.star))return this.parseExportAllDeclaration(e,t);if(this.eat(f._default))return this.checkExport(t,"default",this.lastTokStart),e.declaration=this.parseExportDefaultDeclaration(),this.finishNode(e,"ExportDefaultDeclaration");if(this.shouldParseExportStatement())e.declaration=this.parseExportDeclaration(e),e.declaration.type==="VariableDeclaration"?this.checkVariableExport(t,e.declaration.declarations):this.checkExport(t,e.declaration.id,e.declaration.id.start),e.specifiers=[],e.source=null,this.options.ecmaVersion>=16&&(e.attributes=[]);else{if(e.declaration=null,e.specifiers=this.parseExportSpecifiers(t),this.eatContextual("from"))this.type!==f.string&&this.unexpected(),e.source=this.parseExprAtom(),this.options.ecmaVersion>=16&&(e.attributes=this.parseWithClause());else{for(var s=0,i=e.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`.")}e.source=null,this.options.ecmaVersion>=16&&(e.attributes=[])}this.semicolon()}return this.finishNode(e,"ExportNamedDeclaration")};J.parseExportDeclaration=function(e){return this.parseStatement(null)};J.parseExportDefaultDeclaration=function(){var e;if(this.type===f._function||(e=this.isAsyncFunction())){var t=this.startNode();return this.next(),e&&this.next(),this.parseFunction(t,Zs|Yc,false,e)}else if(this.type===f._class){var s=this.startNode();return this.parseClass(s,"nullableID")}else{var i=this.parseMaybeAssign();return this.semicolon(),i}};J.checkExport=function(e,t,s){e&&(typeof t!="string"&&(t=t.type==="Identifier"?t.name:t.value),Us(e,t)&&this.raiseRecoverable(s,"Duplicate export '"+t+"'"),e[t]=true)};J.checkPatternExport=function(e,t){var s=t.type;if(s==="Identifier")this.checkExport(e,t,t.start);else if(s==="ObjectPattern")for(var i=0,r=t.properties;i<r.length;i+=1){var a=r[i];this.checkPatternExport(e,a)}else if(s==="ArrayPattern")for(var o=0,u=t.elements;o<u.length;o+=1){var l=u[o];l&&this.checkPatternExport(e,l)}else s==="Property"?this.checkPatternExport(e,t.value):s==="AssignmentPattern"?this.checkPatternExport(e,t.left):s==="RestElement"&&this.checkPatternExport(e,t.argument)};J.checkVariableExport=function(e,t){if(e)for(var s=0,i=t;s<i.length;s+=1){var r=i[s];this.checkPatternExport(e,r.id)}};J.shouldParseExportStatement=function(){return this.type.keyword==="var"||this.type.keyword==="const"||this.type.keyword==="class"||this.type.keyword==="function"||this.isLet()||this.isAsyncFunction()};J.parseExportSpecifier=function(e){var t=this.startNode();return t.local=this.parseModuleExportName(),t.exported=this.eatContextual("as")?this.parseModuleExportName():t.local,this.checkExport(e,t.exported,t.exported.start),this.finishNode(t,"ExportSpecifier")};J.parseExportSpecifiers=function(e){var t=[],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;t.push(this.parseExportSpecifier(e))}return t};J.parseImport=function(e){return this.next(),this.type===f.string?(e.specifiers=fh,e.source=this.parseExprAtom()):(e.specifiers=this.parseImportSpecifiers(),this.expectContextual("from"),e.source=this.type===f.string?this.parseExprAtom():this.unexpected()),this.options.ecmaVersion>=16&&(e.attributes=this.parseWithClause()),this.semicolon(),this.finishNode(e,"ImportDeclaration")};J.parseImportSpecifier=function(){var e=this.startNode();return e.imported=this.parseModuleExportName(),this.eatContextual("as")?e.local=this.parseIdent():(this.checkUnreserved(e.imported),e.local=e.imported),this.checkLValSimple(e.local,zt),this.finishNode(e,"ImportSpecifier")};J.parseImportDefaultSpecifier=function(){var e=this.startNode();return e.local=this.parseIdent(),this.checkLValSimple(e.local,zt),this.finishNode(e,"ImportDefaultSpecifier")};J.parseImportNamespaceSpecifier=function(){var e=this.startNode();return this.next(),this.expectContextual("as"),e.local=this.parseIdent(),this.checkLValSimple(e.local,zt),this.finishNode(e,"ImportNamespaceSpecifier")};J.parseImportSpecifiers=function(){var e=[],t=true;if(this.type===f.name&&(e.push(this.parseImportDefaultSpecifier()),!this.eat(f.comma)))return e;if(this.type===f.star)return e.push(this.parseImportNamespaceSpecifier()),e;for(this.expect(f.braceL);!this.eat(f.braceR);){if(t)t=false;else if(this.expect(f.comma),this.afterTrailingComma(f.braceR))break;e.push(this.parseImportSpecifier())}return e};J.parseWithClause=function(){var e=[];if(!this.eat(f._with))return e;this.expect(f.braceL);for(var t={},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;Us(t,r)&&this.raiseRecoverable(i.key.start,"Duplicate attribute key '"+r+"'"),t[r]=true,e.push(i)}return e};J.parseImportAttribute=function(){var e=this.startNode();return e.key=this.type===f.string?this.parseExprAtom():this.parseIdent(this.options.allowReserved!=="never"),this.expect(f.colon),this.type!==f.string&&this.unexpected(),e.value=this.parseExprAtom(),this.finishNode(e,"ImportAttribute")};J.parseModuleExportName=function(){if(this.options.ecmaVersion>=13&&this.type===f.string){var e=this.parseLiteral(this.value);return oh.test(e.value)&&this.raise(e.start,"An export name cannot include a lone surrogate."),e}return this.parseIdent(true)};J.adaptDirectivePrologue=function(e){for(var t=0;t<e.length&&this.isDirectiveCandidate(e[t]);++t)e[t].directive=e[t].expression.raw.slice(1,-1)};J.isDirectiveCandidate=function(e){return this.options.ecmaVersion>=5&&e.type==="ExpressionStatement"&&e.expression.type==="Literal"&&typeof e.expression.value=="string"&&(this.input[e.start]==='"'||this.input[e.start]==="'")};var ut=Ne.prototype;ut.toAssignable=function(e,t,s){if(this.options.ecmaVersion>=6&&e)switch(e.type){case"Identifier":this.inAsync&&e.name==="await"&&this.raise(e.start,"Cannot use 'await' as identifier inside an async function");break;case"ObjectPattern":case"ArrayPattern":case"AssignmentPattern":case"RestElement":break;case"ObjectExpression":e.type="ObjectPattern",s&&this.checkPatternErrors(s,true);for(var i=0,r=e.properties;i<r.length;i+=1){var a=r[i];this.toAssignable(a,t),a.type==="RestElement"&&(a.argument.type==="ArrayPattern"||a.argument.type==="ObjectPattern")&&this.raise(a.argument.start,"Unexpected token")}break;case"Property":e.kind!=="init"&&this.raise(e.key.start,"Object pattern can't contain getter or setter"),this.toAssignable(e.value,t);break;case"ArrayExpression":e.type="ArrayPattern",s&&this.checkPatternErrors(s,true),this.toAssignableList(e.elements,t);break;case"SpreadElement":e.type="RestElement",this.toAssignable(e.argument,t),e.argument.type==="AssignmentPattern"&&this.raise(e.argument.start,"Rest elements cannot have a default value");break;case"AssignmentExpression":e.operator!=="="&&this.raise(e.left.end,"Only '=' operator can be used for specifying default value."),e.type="AssignmentPattern",delete e.operator,this.toAssignable(e.left,t);break;case"ParenthesizedExpression":this.toAssignable(e.expression,t,s);break;case"ChainExpression":this.raiseRecoverable(e.start,"Optional chaining cannot appear in left-hand side");break;case"MemberExpression":if(!t)break;default:this.raise(e.start,"Assigning to rvalue")}else s&&this.checkPatternErrors(s,true);return e};ut.toAssignableList=function(e,t){for(var s=e.length,i=0;i<s;i++){var r=e[i];r&&this.toAssignable(r,t)}if(s){var a=e[s-1];this.options.ecmaVersion===6&&t&&a&&a.type==="RestElement"&&a.argument.type!=="Identifier"&&this.unexpected(a.argument.start)}return e};ut.parseSpread=function(e){var t=this.startNode();return this.next(),t.argument=this.parseMaybeAssign(false,e),this.finishNode(t,"SpreadElement")};ut.parseRestBinding=function(){var e=this.startNode();return this.next(),this.options.ecmaVersion===6&&this.type!==f.name&&this.unexpected(),e.argument=this.parseBindingAtom(),this.finishNode(e,"RestElement")};ut.parseBindingAtom=function(){if(this.options.ecmaVersion>=6)switch(this.type){case f.bracketL:var e=this.startNode();return this.next(),e.elements=this.parseBindingList(f.bracketR,true,true),this.finishNode(e,"ArrayPattern");case f.braceL:return this.parseObj(true)}return this.parseIdent()};ut.parseBindingList=function(e,t,s,i){for(var r=[],a=true;!this.eat(e);)if(a?a=false:this.expect(f.comma),t&&this.type===f.comma)r.push(null);else{if(s&&this.afterTrailingComma(e))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(e);break}else r.push(this.parseAssignableListItem(i))}return r};ut.parseAssignableListItem=function(e){var t=this.parseMaybeDefault(this.start,this.startLoc);return this.parseBindingListItem(t),t};ut.parseBindingListItem=function(e){return e};ut.parseMaybeDefault=function(e,t,s){if(s=s||this.parseBindingAtom(),this.options.ecmaVersion<6||!this.eat(f.eq))return s;var i=this.startNodeAt(e,t);return i.left=s,i.right=this.parseMaybeAssign(),this.finishNode(i,"AssignmentPattern")};ut.checkLValSimple=function(e,t,s){t===void 0&&(t=Mi);var i=t!==Mi;switch(e.type){case"Identifier":this.strict&&this.reservedWordsStrictBind.test(e.name)&&this.raiseRecoverable(e.start,(i?"Binding ":"Assigning to ")+e.name+" in strict mode"),i&&(t===zt&&e.name==="let"&&this.raiseRecoverable(e.start,"let is disallowed as a lexically bound name"),s&&(Us(s,e.name)&&this.raiseRecoverable(e.start,"Argument name clash"),s[e.name]=true),t!==zc&&this.declareName(e.name,t,e.start));break;case"ChainExpression":this.raiseRecoverable(e.start,"Optional chaining cannot appear in left-hand side");break;case"MemberExpression":i&&this.raiseRecoverable(e.start,"Binding member expression");break;case"ParenthesizedExpression":return i&&this.raiseRecoverable(e.start,"Binding parenthesized expression"),this.checkLValSimple(e.expression,t,s);default:this.raise(e.start,(i?"Binding":"Assigning to")+" rvalue")}};ut.checkLValPattern=function(e,t,s){switch(t===void 0&&(t=Mi),e.type){case"ObjectPattern":for(var i=0,r=e.properties;i<r.length;i+=1){var a=r[i];this.checkLValInnerPattern(a,t,s)}break;case"ArrayPattern":for(var o=0,u=e.elements;o<u.length;o+=1){var l=u[o];l&&this.checkLValInnerPattern(l,t,s)}break;default:this.checkLValSimple(e,t,s)}};ut.checkLValInnerPattern=function(e,t,s){switch(t===void 0&&(t=Mi),e.type){case"Property":this.checkLValInnerPattern(e.value,t,s);break;case"AssignmentPattern":this.checkLValPattern(e.left,t,s);break;case"RestElement":this.checkLValPattern(e.argument,t,s);break;default:this.checkLValPattern(e,t,s)}};var lt=function(t,s,i,r,a){this.token=t,this.isExpr=!!s,this.preserveSpace=!!i,this.override=r,this.generator=!!a},Te={b_stat:new lt("{",false),b_expr:new lt("{",true),b_tmpl:new lt("${",false),p_stat:new lt("(",false),p_expr:new lt("(",true),q_tmpl:new lt("`",true,true,function(e){return e.tryReadTemplateToken()}),f_stat:new lt("function",false),f_expr:new lt("function",true),f_expr_gen:new lt("function",true,false,null,true),f_gen:new lt("function",false,false,null,true)},Os=Ne.prototype;Os.initialContext=function(){return[Te.b_stat]};Os.curContext=function(){return this.context[this.context.length-1]};Os.braceIsBlock=function(e){var t=this.curContext();return t===Te.f_expr||t===Te.f_stat?true:e===f.colon&&(t===Te.b_stat||t===Te.b_expr)?!t.isExpr:e===f._return||e===f.name&&this.exprAllowed?tt.test(this.input.slice(this.lastTokEnd,this.start)):e===f._else||e===f.semi||e===f.eof||e===f.parenR||e===f.arrow?true:e===f.braceL?t===Te.b_stat:e===f._var||e===f._const||e===f.name?false:!this.exprAllowed};Os.inGeneratorContext=function(){for(var e=this.context.length-1;e>=1;e--){var t=this.context[e];if(t.token==="function")return t.generator}return false};Os.updateContext=function(e){var t,s=this.type;s.keyword&&e===f.dot?this.exprAllowed=false:(t=s.updateContext)?t.call(this,e):this.exprAllowed=s.beforeExpr};Os.overrideContext=function(e){this.curContext()!==e&&(this.context[this.context.length-1]=e)};f.parenR.updateContext=f.braceR.updateContext=function(){if(this.context.length===1){this.exprAllowed=true;return}var e=this.context.pop();e===Te.b_stat&&this.curContext().token==="function"&&(e=this.context.pop()),this.exprAllowed=!e.isExpr};f.braceL.updateContext=function(e){this.context.push(this.braceIsBlock(e)?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(e){var t=e===f._if||e===f._for||e===f._with||e===f._while;this.context.push(t?Te.p_stat:Te.p_expr),this.exprAllowed=true};f.incDec.updateContext=function(){};f._function.updateContext=f._class.updateContext=function(e){e.beforeExpr&&e!==f._else&&!(e===f.semi&&this.curContext()!==Te.p_stat)&&!(e===f._return&&tt.test(this.input.slice(this.lastTokEnd,this.start)))&&!((e===f.colon||e===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(e){if(e===f._function){var t=this.context.length-1;this.context[t]===Te.f_expr?this.context[t]=Te.f_expr_gen:this.context[t]=Te.f_gen}this.exprAllowed=true};f.name.updateContext=function(e){var t=false;this.options.ecmaVersion>=6&&e!==f.dot&&(this.value==="of"&&!this.exprAllowed||this.value==="yield"&&this.inGeneratorContext())&&(t=true),this.exprAllowed=t};var he=Ne.prototype;he.checkPropClash=function(e,t,s){if(!(this.options.ecmaVersion>=9&&e.type==="SpreadElement")&&!(this.options.ecmaVersion>=6&&(e.computed||e.method||e.shorthand))){var i=e.key,r;switch(i.type){case"Identifier":r=i.name;break;case"Literal":r=String(i.value);break;default:return}var a=e.kind;if(this.options.ecmaVersion>=6){r==="__proto__"&&a==="init"&&(t.proto&&(s?s.doubleProto<0&&(s.doubleProto=i.start):this.raiseRecoverable(i.start,"Redefinition of __proto__ property")),t.proto=true);return}r="$"+r;var o=t[r];if(o){var u;a==="init"?u=this.strict&&o.init||o.get||o.set:u=o.init||o[a],u&&this.raiseRecoverable(i.start,"Redefinition of property")}else o=t[r]={init:false,get:false,set:false};o[a]=true}};he.parseExpression=function(e,t){var s=this.start,i=this.startLoc,r=this.parseMaybeAssign(e,t);if(this.type===f.comma){var a=this.startNodeAt(s,i);for(a.expressions=[r];this.eat(f.comma);)a.expressions.push(this.parseMaybeAssign(e,t));return this.finishNode(a,"SequenceExpression")}return r};he.parseMaybeAssign=function(e,t,s){if(this.isContextual("yield")){if(this.inGenerator)return this.parseYield(e);this.exprAllowed=false}var i=false,r=-1,a=-1,o=-1;t?(r=t.parenthesizedAssign,a=t.trailingComma,o=t.doubleProto,t.parenthesizedAssign=t.trailingComma=-1):(t=new hr,i=true);var u=this.start,l=this.startLoc;(this.type===f.parenL||this.type===f.name)&&(this.potentialArrowAt=this.start,this.potentialArrowInForAwait=e==="await");var h=this.parseMaybeConditional(e,t);if(s&&(h=s.call(this,h,u,l)),this.type.isAssign){var p=this.startNodeAt(u,l);return p.operator=this.value,this.type===f.eq&&(h=this.toAssignable(h,false,t)),i||(t.parenthesizedAssign=t.trailingComma=t.doubleProto=-1),t.shorthandAssign>=h.start&&(t.shorthandAssign=-1),this.type===f.eq?this.checkLValPattern(h):this.checkLValSimple(h),p.left=h,this.next(),p.right=this.parseMaybeAssign(e),o>-1&&(t.doubleProto=o),this.finishNode(p,"AssignmentExpression")}else i&&this.checkExpressionErrors(t,true);return r>-1&&(t.parenthesizedAssign=r),a>-1&&(t.trailingComma=a),h};he.parseMaybeConditional=function(e,t){var s=this.start,i=this.startLoc,r=this.parseExprOps(e,t);if(this.checkExpressionErrors(t))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(e),this.finishNode(a,"ConditionalExpression")}return r};he.parseExprOps=function(e,t){var s=this.start,i=this.startLoc,r=this.parseMaybeUnary(t,false,false,e);return this.checkExpressionErrors(t)||r.start===s&&r.type==="ArrowFunctionExpression"?r:this.parseExprOp(r,s,i,-1,e)};he.parseExprOp=function(e,t,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,u=this.type===f.coalesce;u&&(a=f.logicalAND.binop);var l=this.value;this.next();var h=this.start,p=this.startLoc,m=this.parseExprOp(this.parseMaybeUnary(null,false,false,r),h,p,a,r),_=this.buildBinary(t,s,e,m,l,o||u);return(o&&this.type===f.coalesce||u&&(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(_,t,s,i,r)}return e};he.buildBinary=function(e,t,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(e,t);return o.left=s,o.operator=r,o.right=i,this.finishNode(o,a?"LogicalExpression":"BinaryExpression")};he.parseMaybeUnary=function(e,t,s,i){var r=this.start,a=this.startLoc,o;if(this.isContextual("await")&&this.canAwait)o=this.parseAwait(i),t=true;else if(this.type.prefix){var u=this.startNode(),l=this.type===f.incDec;u.operator=this.value,u.prefix=true,this.next(),u.argument=this.parseMaybeUnary(null,true,l,i),this.checkExpressionErrors(e,true),l?this.checkLValSimple(u.argument):this.strict&&u.operator==="delete"&&Kc(u.argument)?this.raiseRecoverable(u.start,"Deleting local variable in strict mode"):u.operator==="delete"&&Xn(u.argument)?this.raiseRecoverable(u.start,"Private fields can not be deleted"):t=true,o=this.finishNode(u,l?"UpdateExpression":"UnaryExpression")}else if(!t&&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(e,i),this.checkExpressionErrors(e))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(t)this.unexpected(this.lastTokStart);else return this.buildBinary(r,a,o,this.parseMaybeUnary(null,false,false,i),"**",false);else return o};function Kc(e){return e.type==="Identifier"||e.type==="ParenthesizedExpression"&&Kc(e.expression)}function Xn(e){return e.type==="MemberExpression"&&e.property.type==="PrivateIdentifier"||e.type==="ChainExpression"&&Xn(e.expression)||e.type==="ParenthesizedExpression"&&Xn(e.expression)}he.parseExprSubscripts=function(e,t){var s=this.start,i=this.startLoc,r=this.parseExprAtom(e,t);if(r.type==="ArrowFunctionExpression"&&this.input.slice(this.lastTokStart,this.lastTokEnd)!==")")return r;var a=this.parseSubscripts(r,s,i,false,t);return e&&a.type==="MemberExpression"&&(e.parenthesizedAssign>=a.start&&(e.parenthesizedAssign=-1),e.parenthesizedBind>=a.start&&(e.parenthesizedBind=-1),e.trailingComma>=a.start&&(e.trailingComma=-1)),a};he.parseSubscripts=function(e,t,s,i,r){for(var a=this.options.ecmaVersion>=8&&e.type==="Identifier"&&e.name==="async"&&this.lastTokEnd===e.end&&!this.canInsertSemicolon()&&e.end-e.start===5&&this.potentialArrowAt===e.start,o=false;;){var u=this.parseSubscript(e,t,s,i,a,o,r);if(u.optional&&(o=true),u===e||u.type==="ArrowFunctionExpression"){if(o){var l=this.startNodeAt(t,s);l.expression=u,u=this.finishNode(l,"ChainExpression")}return u}e=u}};he.shouldParseAsyncArrow=function(){return!this.canInsertSemicolon()&&this.eat(f.arrow)};he.parseSubscriptAsyncArrow=function(e,t,s,i){return this.parseArrowExpression(this.startNodeAt(e,t),s,true,i)};he.parseSubscript=function(e,t,s,i,r,a,o){var u=this.options.ecmaVersion>=11,l=u&&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 p=this.startNodeAt(t,s);p.object=e,h?(p.property=this.parseExpression(),this.expect(f.bracketR)):this.type===f.privateId&&e.type!=="Super"?p.property=this.parsePrivateIdent():p.property=this.parseIdent(this.options.allowReserved!=="never"),p.computed=!!h,u&&(p.optional=l),e=this.finishNode(p,"MemberExpression")}else if(!i&&this.eat(f.parenL)){var m=new hr,_=this.yieldPos,k=this.awaitPos,T=this.awaitIdentPos;this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0;var P=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=k,this.awaitIdentPos=T,this.parseSubscriptAsyncArrow(t,s,P,o);this.checkExpressionErrors(m,true),this.yieldPos=_||this.yieldPos,this.awaitPos=k||this.awaitPos,this.awaitIdentPos=T||this.awaitIdentPos;var F=this.startNodeAt(t,s);F.callee=e,F.arguments=P,u&&(F.optional=l),e=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(t,s);U.tag=e,U.quasi=this.parseTemplate({isTagged:true}),e=this.finishNode(U,"TaggedTemplateExpression")}return e};he.parseExprAtom=function(e,t,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,u=this.containsEsc,l=this.parseIdent(false);if(this.options.ecmaVersion>=8&&!u&&l.name==="async"&&!this.canInsertSemicolon()&&this.eat(f._function))return this.overrideContext(Te.f_expr),this.parseFunction(this.startNodeAt(a,o),0,false,true,t);if(r&&!this.canInsertSemicolon()){if(this.eat(f.arrow))return this.parseArrowExpression(this.startNodeAt(a,o),[l],false,t);if(this.options.ecmaVersion>=8&&l.name==="async"&&this.type===f.name&&!u&&(!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,t)}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 p=this.start,m=this.parseParenAndDistinguishExpression(r,t);return e&&(e.parenthesizedAssign<0&&!this.isSimpleAssignTarget(m)&&(e.parenthesizedAssign=p),e.parenthesizedBind<0&&(e.parenthesizedBind=p)),m;case f.bracketL:return i=this.startNode(),this.next(),i.elements=this.parseExprList(f.bracketR,true,true,e),this.finishNode(i,"ArrayExpression");case f.braceL:return this.overrideContext(Te.b_expr),this.parseObj(false,e);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(e){var t=this.startNode();if(this.containsEsc&&this.raiseRecoverable(this.start,"Escape sequence in keyword import"),this.next(),this.type===f.parenL&&!e)return this.parseDynamicImport(t);if(this.type===f.dot){var s=this.startNodeAt(t.start,t.loc&&t.loc.start);return s.name="import",t.meta=this.finishNode(s,"Identifier"),this.parseImportMeta(t)}else this.unexpected()};he.parseDynamicImport=function(e){if(this.next(),e.source=this.parseMaybeAssign(),this.options.ecmaVersion>=16)this.eat(f.parenR)?e.options=null:(this.expect(f.comma),this.afterTrailingComma(f.parenR)?e.options=null:(e.options=this.parseMaybeAssign(),this.eat(f.parenR)||(this.expect(f.comma),this.afterTrailingComma(f.parenR)||this.unexpected())));else if(!this.eat(f.parenR)){var t=this.start;this.eat(f.comma)&&this.eat(f.parenR)?this.raiseRecoverable(t,"Trailing comma is not allowed in import()"):this.unexpected(t)}return this.finishNode(e,"ImportExpression")};he.parseImportMeta=function(e){this.next();var t=this.containsEsc;return e.property=this.parseIdent(true),e.property.name!=="meta"&&this.raiseRecoverable(e.property.start,"The only valid meta property for import is 'import.meta'"),t&&this.raiseRecoverable(e.start,"'import.meta' must not contain escaped characters"),this.options.sourceType!=="module"&&!this.options.allowImportExportEverywhere&&this.raiseRecoverable(e.start,"Cannot use 'import.meta' outside a module"),this.finishNode(e,"MetaProperty")};he.parseLiteral=function(e){var t=this.startNode();return t.value=e,t.raw=this.input.slice(this.start,this.end),t.raw.charCodeAt(t.raw.length-1)===110&&(t.bigint=t.value!=null?t.value.toString():t.raw.slice(0,-1).replace(/_/g,"")),this.next(),this.finishNode(t,"Literal")};he.parseParenExpression=function(){this.expect(f.parenL);var e=this.parseExpression();return this.expect(f.parenR),e};he.shouldParseArrow=function(e){return!this.canInsertSemicolon()};he.parseParenAndDistinguishExpression=function(e,t){var s=this.start,i=this.startLoc,r,a=this.options.ecmaVersion>=8;if(this.options.ecmaVersion>=6){this.next();var o=this.start,u=this.startLoc,l=[],h=true,p=false,m=new hr,_=this.yieldPos,k=this.awaitPos,T;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)){p=true;break}else if(this.type===f.ellipsis){T=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 P=this.lastTokEnd,F=this.lastTokEndLoc;if(this.expect(f.parenR),e&&this.shouldParseArrow(l)&&this.eat(f.arrow))return this.checkPatternErrors(m,false),this.checkYieldAwaitInDefaultParams(),this.yieldPos=_,this.awaitPos=k,this.parseParenArrowList(s,i,l,t);(!l.length||p)&&this.unexpected(this.lastTokStart),T&&this.unexpected(T),this.checkExpressionErrors(m,true),this.yieldPos=_||this.yieldPos,this.awaitPos=k||this.awaitPos,l.length>1?(r=this.startNodeAt(o,u),r.expressions=l,this.finishNodeAt(r,"SequenceExpression",P,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(e){return e};he.parseParenArrowList=function(e,t,s,i){return this.parseArrowExpression(this.startNodeAt(e,t),s,false,i)};var ph=[];he.parseNew=function(){this.containsEsc&&this.raiseRecoverable(this.start,"Escape sequence in keyword new");var e=this.startNode();if(this.next(),this.options.ecmaVersion>=6&&this.type===f.dot){var t=this.startNodeAt(e.start,e.loc&&e.loc.start);t.name="new",e.meta=this.finishNode(t,"Identifier"),this.next();var s=this.containsEsc;return e.property=this.parseIdent(true),e.property.name!=="target"&&this.raiseRecoverable(e.property.start,"The only valid meta property for new is 'new.target'"),s&&this.raiseRecoverable(e.start,"'new.target' must not contain escaped characters"),this.allowNewDotTarget||this.raiseRecoverable(e.start,"'new.target' can only be used in functions and class static block"),this.finishNode(e,"MetaProperty")}var i=this.start,r=this.startLoc;return e.callee=this.parseSubscripts(this.parseExprAtom(null,false,true),i,r,true,false),this.eat(f.parenL)?e.arguments=this.parseExprList(f.parenR,this.options.ecmaVersion>=8,false):e.arguments=ph,this.finishNode(e,"NewExpression")};he.parseTemplateElement=function(e){var t=e.isTagged,s=this.startNode();return this.type===f.invalidTemplate?(t||this.raiseRecoverable(this.start,"Bad escape sequence in untagged template literal"),s.value={raw:this.value.replace(/\r\n?/g,`
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(e){e===void 0&&(e={});var t=e.isTagged;t===void 0&&(t=false);var s=this.startNode();this.next(),s.expressions=[];var i=this.parseTemplateElement({isTagged:t});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:t}));return this.next(),this.finishNode(s,"TemplateLiteral")};he.isAsyncProp=function(e){return!e.computed&&e.key.type==="Identifier"&&e.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)&&!tt.test(this.input.slice(this.lastTokEnd,this.start))};he.parseObj=function(e,t){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(e,t);e||this.checkPropClash(a,r,t),s.properties.push(a)}return this.finishNode(s,e?"ObjectPattern":"ObjectExpression")};he.parseProperty=function(e,t){var s=this.startNode(),i,r,a,o;if(this.options.ecmaVersion>=9&&this.eat(f.ellipsis))return e?(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,t),this.type===f.comma&&t&&t.trailingComma<0&&(t.trailingComma=this.start),this.finishNode(s,"SpreadElement"));this.options.ecmaVersion>=6&&(s.method=false,s.shorthand=false,(e||t)&&(a=this.start,o=this.startLoc),e||(i=this.eat(f.star)));var u=this.containsEsc;return this.parsePropertyName(s),!e&&!u&&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,e,i,r,a,o,t,u),this.finishNode(s,"Property")};he.parseGetterSetter=function(e){var t=e.key.name;this.parsePropertyName(e),e.value=this.parseMethod(false),e.kind=t;var s=e.kind==="get"?0:1;if(e.value.params.length!==s){var i=e.value.start;e.kind==="get"?this.raiseRecoverable(i,"getter should have no params"):this.raiseRecoverable(i,"setter should have exactly one param")}else e.kind==="set"&&e.value.params[0].type==="RestElement"&&this.raiseRecoverable(e.value.params[0].start,"Setter cannot use rest params")};he.parsePropertyValue=function(e,t,s,i,r,a,o,u){(s||i)&&this.type===f.colon&&this.unexpected(),this.eat(f.colon)?(e.value=t?this.parseMaybeDefault(this.start,this.startLoc):this.parseMaybeAssign(false,o),e.kind="init"):this.options.ecmaVersion>=6&&this.type===f.parenL?(t&&this.unexpected(),e.method=true,e.value=this.parseMethod(s,i),e.kind="init"):!t&&!u&&this.options.ecmaVersion>=5&&!e.computed&&e.key.type==="Identifier"&&(e.key.name==="get"||e.key.name==="set")&&this.type!==f.comma&&this.type!==f.braceR&&this.type!==f.eq?((s||i)&&this.unexpected(),this.parseGetterSetter(e)):this.options.ecmaVersion>=6&&!e.computed&&e.key.type==="Identifier"?((s||i)&&this.unexpected(),this.checkUnreserved(e.key),e.key.name==="await"&&!this.awaitIdentPos&&(this.awaitIdentPos=r),t?e.value=this.parseMaybeDefault(r,a,this.copyNode(e.key)):this.type===f.eq&&o?(o.shorthandAssign<0&&(o.shorthandAssign=this.start),e.value=this.parseMaybeDefault(r,a,this.copyNode(e.key))):e.value=this.copyNode(e.key),e.kind="init",e.shorthand=true):this.unexpected()};he.parsePropertyName=function(e){if(this.options.ecmaVersion>=6){if(this.eat(f.bracketL))return e.computed=true,e.key=this.parseMaybeAssign(),this.expect(f.bracketR),e.key;e.computed=false}return e.key=this.type===f.num||this.type===f.string?this.parseExprAtom():this.parseIdent(this.options.allowReserved!=="never")};he.initFunction=function(e){e.id=null,this.options.ecmaVersion>=6&&(e.generator=e.expression=false),this.options.ecmaVersion>=8&&(e.async=false)};he.parseMethod=function(e,t,s){var i=this.startNode(),r=this.yieldPos,a=this.awaitPos,o=this.awaitIdentPos;return this.initFunction(i),this.options.ecmaVersion>=6&&(i.generator=e),this.options.ecmaVersion>=8&&(i.async=!!t),this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(ka(t,i.generator)|ur|(s?Wc: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(e,t,s,i){var r=this.yieldPos,a=this.awaitPos,o=this.awaitIdentPos;return this.enterScope(ka(s,false)|va),this.initFunction(e),this.options.ecmaVersion>=8&&(e.async=!!s),this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,e.params=this.toAssignableList(t,true),this.parseFunctionBody(e,true,false,i),this.yieldPos=r,this.awaitPos=a,this.awaitIdentPos=o,this.finishNode(e,"ArrowFunctionExpression")};he.parseFunctionBody=function(e,t,s,i){var r=t&&this.type!==f.braceL,a=this.strict,o=false;if(r)e.body=this.parseMaybeAssign(i),e.expression=true,this.checkParams(e,false);else{var u=this.options.ecmaVersion>=7&&!this.isSimpleParamList(e.params);(!a||u)&&(o=this.strictDirective(this.end),o&&u&&this.raiseRecoverable(e.start,"Illegal 'use strict' directive in function with non-simple parameter list"));var l=this.labels;this.labels=[],o&&(this.strict=true),this.checkParams(e,!a&&!o&&!t&&!s&&this.isSimpleParamList(e.params)),this.strict&&e.id&&this.checkLValSimple(e.id,zc),e.body=this.parseBlock(false,void 0,o&&!a),e.expression=false,this.adaptDirectivePrologue(e.body.body),this.labels=l}this.exitScope()};he.isSimpleParamList=function(e){for(var t=0,s=e;t<s.length;t+=1){var i=s[t];if(i.type!=="Identifier")return false}return true};he.checkParams=function(e,t){for(var s=Object.create(null),i=0,r=e.params;i<r.length;i+=1){var a=r[i];this.checkLValInnerPattern(a,wa,t?null:s)}};he.parseExprList=function(e,t,s,i){for(var r=[],a=true;!this.eat(e);){if(a)a=false;else if(this.expect(f.comma),t&&this.afterTrailingComma(e))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(e){var t=e.start,s=e.end,i=e.name;if(this.inGenerator&&i==="yield"&&this.raiseRecoverable(t,"Cannot use 'yield' as identifier inside a generator"),this.inAsync&&i==="await"&&this.raiseRecoverable(t,"Cannot use 'await' as identifier inside an async function"),!(this.currentThisScope().flags&lr)&&i==="arguments"&&this.raiseRecoverable(t,"Cannot use 'arguments' in class field initializer"),this.inClassStaticBlock&&(i==="arguments"||i==="await")&&this.raise(t,"Cannot use "+i+" in class static initialization block"),this.keywords.test(i)&&this.raise(t,"Unexpected keyword '"+i+"'"),!(this.options.ecmaVersion<6&&this.input.slice(t,s).indexOf("\\")!==-1)){var r=this.strict?this.reservedWordsStrict:this.reservedWords;r.test(i)&&(!this.inAsync&&i==="await"&&this.raiseRecoverable(t,"Cannot use keyword 'await' outside an async function"),this.raiseRecoverable(t,"The keyword '"+i+"' is reserved"))}};he.parseIdent=function(e){var t=this.parseIdentNode();return this.next(!!e),this.finishNode(t,"Identifier"),e||(this.checkUnreserved(t),t.name==="await"&&!this.awaitIdentPos&&(this.awaitIdentPos=t.start)),t};he.parseIdentNode=function(){var e=this.startNode();return this.type===f.name?e.name=this.value:this.type.keyword?(e.name=this.type.keyword,(e.name==="class"||e.name==="function")&&(this.lastTokEnd!==this.lastTokStart+1||this.input.charCodeAt(this.lastTokStart)!==46)&&this.context.pop(),this.type=f.name):this.unexpected(),e};he.parsePrivateIdent=function(){var e=this.startNode();return this.type===f.privateId?e.name=this.value:this.unexpected(),this.next(),this.finishNode(e,"PrivateIdentifier"),this.options.checkPrivateFields&&(this.privateNameStack.length===0?this.raise(e.start,"Private field '#"+e.name+"' must be declared in an enclosing class"):this.privateNameStack[this.privateNameStack.length-1].used.push(e)),e};he.parseYield=function(e){this.yieldPos||(this.yieldPos=this.start);var t=this.startNode();return this.next(),this.type===f.semi||this.canInsertSemicolon()||this.type!==f.star&&!this.type.startsExpr?(t.delegate=false,t.argument=null):(t.delegate=this.eat(f.star),t.argument=this.parseMaybeAssign(e)),this.finishNode(t,"YieldExpression")};he.parseAwait=function(e){this.awaitPos||(this.awaitPos=this.start);var t=this.startNode();return this.next(),t.argument=this.parseMaybeUnary(null,true,false,e),this.finishNode(t,"AwaitExpression")};var Bi=Ne.prototype;Bi.raise=function(e,t){var s=$c(this.input,e);t+=" ("+s.line+":"+s.column+")",this.sourceFile&&(t+=" in "+this.sourceFile);var i=new SyntaxError(t);throw i.pos=e,i.loc=s,i.raisedAt=this.pos,i};Bi.raiseRecoverable=Bi.raise;Bi.curPosition=function(){if(this.options.locations)return new ei(this.curLine,this.pos-this.lineStart)};var cs=Ne.prototype,mh=function(t){this.flags=t,this.var=[],this.lexical=[],this.functions=[]};cs.enterScope=function(e){this.scopeStack.push(new mh(e))};cs.exitScope=function(){this.scopeStack.pop()};cs.treatFunctionsAsVarInScope=function(e){return e.flags&Ms||!this.inModule&&e.flags&ti};cs.declareName=function(e,t,s){var i=false;if(t===zt){var r=this.currentScope();i=r.lexical.indexOf(e)>-1||r.functions.indexOf(e)>-1||r.var.indexOf(e)>-1,r.lexical.push(e),this.inModule&&r.flags&ti&&delete this.undefinedExports[e]}else if(t===Xc){var a=this.currentScope();a.lexical.push(e)}else if(t===Gc){var o=this.currentScope();this.treatFunctionsAsVar?i=o.lexical.indexOf(e)>-1:i=o.lexical.indexOf(e)>-1||o.var.indexOf(e)>-1,o.functions.push(e)}else for(var u=this.scopeStack.length-1;u>=0;--u){var l=this.scopeStack[u];if(l.lexical.indexOf(e)>-1&&!(l.flags&Hc&&l.lexical[0]===e)||!this.treatFunctionsAsVarInScope(l)&&l.functions.indexOf(e)>-1){i=true;break}if(l.var.push(e),this.inModule&&l.flags&ti&&delete this.undefinedExports[e],l.flags&lr)break}i&&this.raiseRecoverable(s,"Identifier '"+e+"' has already been declared")};cs.checkLocalExport=function(e){this.scopeStack[0].lexical.indexOf(e.name)===-1&&this.scopeStack[0].var.indexOf(e.name)===-1&&(this.undefinedExports[e.name]=e)};cs.currentScope=function(){return this.scopeStack[this.scopeStack.length-1]};cs.currentVarScope=function(){for(var e=this.scopeStack.length-1;;e--){var t=this.scopeStack[e];if(t.flags&(lr|pi|xs))return t}};cs.currentThisScope=function(){for(var e=this.scopeStack.length-1;;e--){var t=this.scopeStack[e];if(t.flags&(lr|pi|xs)&&!(t.flags&va))return t}};var fr=function(t,s,i){this.type="",this.start=s,this.end=0,t.options.locations&&(this.loc=new cr(t,i)),t.options.directSourceFile&&(this.sourceFile=t.options.directSourceFile),t.options.ranges&&(this.range=[s,0])},mi=Ne.prototype;mi.startNode=function(){return new fr(this,this.start,this.startLoc)};mi.startNodeAt=function(e,t){return new fr(this,e,t)};function Zc(e,t,s,i){return e.type=t,e.end=s,this.options.locations&&(e.loc.end=i),this.options.ranges&&(e.range[1]=s),e}mi.finishNode=function(e,t){return Zc.call(this,e,t,this.lastTokEnd,this.lastTokEndLoc)};mi.finishNodeAt=function(e,t,s,i){return Zc.call(this,e,t,s,i)};mi.copyNode=function(e){var t=new fr(this,e.start,this.startLoc);for(var s in e)t[s]=e[s];return t};var gh="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",Qc="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",Jc=Qc+" Extended_Pictographic",eu=Jc,tu=eu+" EBase EComp EMod EPres ExtPict",su=tu,bh=su,yh={9:Qc,10:Jc,11:eu,12:tu,13:su,14:bh},_h="Basic_Emoji Emoji_Keycap_Sequence RGI_Emoji_Modifier_Sequence RGI_Emoji_Flag_Sequence RGI_Emoji_Tag_Sequence RGI_Emoji_ZWJ_Sequence RGI_Emoji",xh={9:"",10:"",11:"",12:"",13:"",14:_h},ko="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",iu="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",ru=iu+" Dogra Dogr Gunjala_Gondi Gong Hanifi_Rohingya Rohg Makasar Maka Medefaidrin Medf Old_Sogdian Sogo Sogdian Sogd",nu=ru+" Elymaic Elym Nandinagari Nand Nyiakeng_Puachue_Hmong Hmnp Wancho Wcho",au=nu+" Chorasmian Chrs Diak Dives_Akuru Khitan_Small_Script Kits Yezi Yezidi",ou=au+" Cypro_Minoan Cpmn Old_Uyghur Ougr Tangsa Tnsa Toto Vithkuqi Vith",vh=ou+" "+gh,kh={9:iu,10:ru,11:nu,12:au,13:ou,14:vh},cu={};function wh(e){var t=cu[e]={binary:Qt(yh[e]+" "+ko),binaryOfStrings:Qt(xh[e]),nonBinary:{General_Category:Qt(ko),Script:Qt(kh[e])}};t.nonBinary.Script_Extensions=t.nonBinary.Script,t.nonBinary.gc=t.nonBinary.General_Category,t.nonBinary.sc=t.nonBinary.Script,t.nonBinary.scx=t.nonBinary.Script_Extensions}for(var Sn=0,wo=[9,10,11,12,13,14];Sn<wo.length;Sn+=1){var Eh=wo[Sn];wh(Eh)}var Q=Ne.prototype,Vi=function(t,s){this.parent=t,this.base=s||this};Vi.prototype.separatedFrom=function(t){for(var s=this;s;s=s.parent)for(var i=t;i;i=i.parent)if(s.base===i.base&&s!==i)return true;return false};Vi.prototype.sibling=function(){return new Vi(this.parent,this.base)};var Ut=function(t){this.parser=t,this.validFlags="gim"+(t.options.ecmaVersion>=6?"uy":"")+(t.options.ecmaVersion>=9?"s":"")+(t.options.ecmaVersion>=13?"d":"")+(t.options.ecmaVersion>=15?"v":""),this.unicodeProperties=cu[t.options.ecmaVersion>=14?14:t.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};Ut.prototype.reset=function(t,s,i){var r=i.indexOf("v")!==-1,a=i.indexOf("u")!==-1;this.start=t|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)};Ut.prototype.raise=function(t){this.parser.raiseRecoverable(this.start,"Invalid regular expression: /"+this.source+"/: "+t)};Ut.prototype.at=function(t,s){s===void 0&&(s=false);var i=this.source,r=i.length;if(t>=r)return-1;var a=i.charCodeAt(t);if(!(s||this.switchU)||a<=55295||a>=57344||t+1>=r)return a;var o=i.charCodeAt(t+1);return o>=56320&&o<=57343?(a<<10)+o-56613888:a};Ut.prototype.nextIndex=function(t,s){s===void 0&&(s=false);var i=this.source,r=i.length;if(t>=r)return r;var a=i.charCodeAt(t),o;return!(s||this.switchU)||a<=55295||a>=57344||t+1>=r||(o=i.charCodeAt(t+1))<56320||o>57343?t+1:t+2};Ut.prototype.current=function(t){return t===void 0&&(t=false),this.at(this.pos,t)};Ut.prototype.lookahead=function(t){return t===void 0&&(t=false),this.at(this.nextIndex(this.pos,t),t)};Ut.prototype.advance=function(t){t===void 0&&(t=false),this.pos=this.nextIndex(this.pos,t)};Ut.prototype.eat=function(t,s){return s===void 0&&(s=false),this.current(s)===t?(this.advance(s),true):false};Ut.prototype.eatChars=function(t,s){s===void 0&&(s=false);for(var i=this.pos,r=0,a=t;r<a.length;r+=1){var o=a[r],u=this.at(i,s);if(u===-1||u!==o)return false;i=this.nextIndex(i,s)}return this.pos=i,true};Q.validateRegExpFlags=function(e){for(var t=e.validFlags,s=e.flags,i=false,r=false,a=0;a<s.length;a++){var o=s.charAt(a);t.indexOf(o)===-1&&this.raise(e.start,"Invalid regular expression flag"),s.indexOf(o,a+1)>-1&&this.raise(e.start,"Duplicate regular expression flag"),o==="u"&&(i=true),o==="v"&&(r=true)}this.options.ecmaVersion>=15&&i&&r&&this.raise(e.start,"Invalid regular expression flag")};function Sh(e){for(var t in e)return true;return false}Q.validateRegExpPattern=function(e){this.regexp_pattern(e),!e.switchN&&this.options.ecmaVersion>=9&&Sh(e.groupNames)&&(e.switchN=true,this.regexp_pattern(e))};Q.regexp_pattern=function(e){e.pos=0,e.lastIntValue=0,e.lastStringValue="",e.lastAssertionIsQuantifiable=false,e.numCapturingParens=0,e.maxBackReference=0,e.groupNames=Object.create(null),e.backReferenceNames.length=0,e.branchID=null,this.regexp_disjunction(e),e.pos!==e.source.length&&(e.eat(41)&&e.raise("Unmatched ')'"),(e.eat(93)||e.eat(125))&&e.raise("Lone quantifier brackets")),e.maxBackReference>e.numCapturingParens&&e.raise("Invalid escape");for(var t=0,s=e.backReferenceNames;t<s.length;t+=1){var i=s[t];e.groupNames[i]||e.raise("Invalid named capture referenced")}};Q.regexp_disjunction=function(e){var t=this.options.ecmaVersion>=16;for(t&&(e.branchID=new Vi(e.branchID,null)),this.regexp_alternative(e);e.eat(124);)t&&(e.branchID=e.branchID.sibling()),this.regexp_alternative(e);t&&(e.branchID=e.branchID.parent),this.regexp_eatQuantifier(e,true)&&e.raise("Nothing to repeat"),e.eat(123)&&e.raise("Lone quantifier brackets")};Q.regexp_alternative=function(e){for(;e.pos<e.source.length&&this.regexp_eatTerm(e););};Q.regexp_eatTerm=function(e){return this.regexp_eatAssertion(e)?(e.lastAssertionIsQuantifiable&&this.regexp_eatQuantifier(e)&&e.switchU&&e.raise("Invalid quantifier"),true):(e.switchU?this.regexp_eatAtom(e):this.regexp_eatExtendedAtom(e))?(this.regexp_eatQuantifier(e),true):false};Q.regexp_eatAssertion=function(e){var t=e.pos;if(e.lastAssertionIsQuantifiable=false,e.eat(94)||e.eat(36))return true;if(e.eat(92)){if(e.eat(66)||e.eat(98))return true;e.pos=t}if(e.eat(40)&&e.eat(63)){var s=false;if(this.options.ecmaVersion>=9&&(s=e.eat(60)),e.eat(61)||e.eat(33))return this.regexp_disjunction(e),e.eat(41)||e.raise("Unterminated group"),e.lastAssertionIsQuantifiable=!s,true}return e.pos=t,false};Q.regexp_eatQuantifier=function(e,t){return t===void 0&&(t=false),this.regexp_eatQuantifierPrefix(e,t)?(e.eat(63),true):false};Q.regexp_eatQuantifierPrefix=function(e,t){return e.eat(42)||e.eat(43)||e.eat(63)||this.regexp_eatBracedQuantifier(e,t)};Q.regexp_eatBracedQuantifier=function(e,t){var s=e.pos;if(e.eat(123)){var i=0,r=-1;if(this.regexp_eatDecimalDigits(e)&&(i=e.lastIntValue,e.eat(44)&&this.regexp_eatDecimalDigits(e)&&(r=e.lastIntValue),e.eat(125)))return r!==-1&&r<i&&!t&&e.raise("numbers out of order in {} quantifier"),true;e.switchU&&!t&&e.raise("Incomplete quantifier"),e.pos=s}return false};Q.regexp_eatAtom=function(e){return this.regexp_eatPatternCharacters(e)||e.eat(46)||this.regexp_eatReverseSolidusAtomEscape(e)||this.regexp_eatCharacterClass(e)||this.regexp_eatUncapturingGroup(e)||this.regexp_eatCapturingGroup(e)};Q.regexp_eatReverseSolidusAtomEscape=function(e){var t=e.pos;if(e.eat(92)){if(this.regexp_eatAtomEscape(e))return true;e.pos=t}return false};Q.regexp_eatUncapturingGroup=function(e){var t=e.pos;if(e.eat(40)){if(e.eat(63)){if(this.options.ecmaVersion>=16){var s=this.regexp_eatModifiers(e),i=e.eat(45);if(s||i){for(var r=0;r<s.length;r++){var a=s.charAt(r);s.indexOf(a,r+1)>-1&&e.raise("Duplicate regular expression modifiers")}if(i){var o=this.regexp_eatModifiers(e);!s&&!o&&e.current()===58&&e.raise("Invalid regular expression modifiers");for(var u=0;u<o.length;u++){var l=o.charAt(u);(o.indexOf(l,u+1)>-1||s.indexOf(l)>-1)&&e.raise("Duplicate regular expression modifiers")}}}}if(e.eat(58)){if(this.regexp_disjunction(e),e.eat(41))return true;e.raise("Unterminated group")}}e.pos=t}return false};Q.regexp_eatCapturingGroup=function(e){if(e.eat(40)){if(this.options.ecmaVersion>=9?this.regexp_groupSpecifier(e):e.current()===63&&e.raise("Invalid group"),this.regexp_disjunction(e),e.eat(41))return e.numCapturingParens+=1,true;e.raise("Unterminated group")}return false};Q.regexp_eatModifiers=function(e){for(var t="",s=0;(s=e.current())!==-1&&Th(s);)t+=Ht(s),e.advance();return t};function Th(e){return e===105||e===109||e===115}Q.regexp_eatExtendedAtom=function(e){return e.eat(46)||this.regexp_eatReverseSolidusAtomEscape(e)||this.regexp_eatCharacterClass(e)||this.regexp_eatUncapturingGroup(e)||this.regexp_eatCapturingGroup(e)||this.regexp_eatInvalidBracedQuantifier(e)||this.regexp_eatExtendedPatternCharacter(e)};Q.regexp_eatInvalidBracedQuantifier=function(e){return this.regexp_eatBracedQuantifier(e,true)&&e.raise("Nothing to repeat"),false};Q.regexp_eatSyntaxCharacter=function(e){var t=e.current();return uu(t)?(e.lastIntValue=t,e.advance(),true):false};function uu(e){return e===36||e>=40&&e<=43||e===46||e===63||e>=91&&e<=94||e>=123&&e<=125}Q.regexp_eatPatternCharacters=function(e){for(var t=e.pos,s=0;(s=e.current())!==-1&&!uu(s);)e.advance();return e.pos!==t};Q.regexp_eatExtendedPatternCharacter=function(e){var t=e.current();return t!==-1&&t!==36&&!(t>=40&&t<=43)&&t!==46&&t!==63&&t!==91&&t!==94&&t!==124?(e.advance(),true):false};Q.regexp_groupSpecifier=function(e){if(e.eat(63)){this.regexp_eatGroupName(e)||e.raise("Invalid group");var t=this.options.ecmaVersion>=16,s=e.groupNames[e.lastStringValue];if(s)if(t)for(var i=0,r=s;i<r.length;i+=1){var a=r[i];a.separatedFrom(e.branchID)||e.raise("Duplicate capture group name")}else e.raise("Duplicate capture group name");t?(s||(e.groupNames[e.lastStringValue]=[])).push(e.branchID):e.groupNames[e.lastStringValue]=true}};Q.regexp_eatGroupName=function(e){if(e.lastStringValue="",e.eat(60)){if(this.regexp_eatRegExpIdentifierName(e)&&e.eat(62))return true;e.raise("Invalid capture group name")}return false};Q.regexp_eatRegExpIdentifierName=function(e){if(e.lastStringValue="",this.regexp_eatRegExpIdentifierStart(e)){for(e.lastStringValue+=Ht(e.lastIntValue);this.regexp_eatRegExpIdentifierPart(e);)e.lastStringValue+=Ht(e.lastIntValue);return true}return false};Q.regexp_eatRegExpIdentifierStart=function(e){var t=e.pos,s=this.options.ecmaVersion>=11,i=e.current(s);return e.advance(s),i===92&&this.regexp_eatRegExpUnicodeEscapeSequence(e,s)&&(i=e.lastIntValue),Ch(i)?(e.lastIntValue=i,true):(e.pos=t,false)};function Ch(e){return Lt(e,true)||e===36||e===95}Q.regexp_eatRegExpIdentifierPart=function(e){var t=e.pos,s=this.options.ecmaVersion>=11,i=e.current(s);return e.advance(s),i===92&&this.regexp_eatRegExpUnicodeEscapeSequence(e,s)&&(i=e.lastIntValue),Ah(i)?(e.lastIntValue=i,true):(e.pos=t,false)};function Ah(e){return as(e,true)||e===36||e===95||e===8204||e===8205}Q.regexp_eatAtomEscape=function(e){return this.regexp_eatBackReference(e)||this.regexp_eatCharacterClassEscape(e)||this.regexp_eatCharacterEscape(e)||e.switchN&&this.regexp_eatKGroupName(e)?true:(e.switchU&&(e.current()===99&&e.raise("Invalid unicode escape"),e.raise("Invalid escape")),false)};Q.regexp_eatBackReference=function(e){var t=e.pos;if(this.regexp_eatDecimalEscape(e)){var s=e.lastIntValue;if(e.switchU)return s>e.maxBackReference&&(e.maxBackReference=s),true;if(s<=e.numCapturingParens)return true;e.pos=t}return false};Q.regexp_eatKGroupName=function(e){if(e.eat(107)){if(this.regexp_eatGroupName(e))return e.backReferenceNames.push(e.lastStringValue),true;e.raise("Invalid named reference")}return false};Q.regexp_eatCharacterEscape=function(e){return this.regexp_eatControlEscape(e)||this.regexp_eatCControlLetter(e)||this.regexp_eatZero(e)||this.regexp_eatHexEscapeSequence(e)||this.regexp_eatRegExpUnicodeEscapeSequence(e,false)||!e.switchU&&this.regexp_eatLegacyOctalEscapeSequence(e)||this.regexp_eatIdentityEscape(e)};Q.regexp_eatCControlLetter=function(e){var t=e.pos;if(e.eat(99)){if(this.regexp_eatControlLetter(e))return true;e.pos=t}return false};Q.regexp_eatZero=function(e){return e.current()===48&&!dr(e.lookahead())?(e.lastIntValue=0,e.advance(),true):false};Q.regexp_eatControlEscape=function(e){var t=e.current();return t===116?(e.lastIntValue=9,e.advance(),true):t===110?(e.lastIntValue=10,e.advance(),true):t===118?(e.lastIntValue=11,e.advance(),true):t===102?(e.lastIntValue=12,e.advance(),true):t===114?(e.lastIntValue=13,e.advance(),true):false};Q.regexp_eatControlLetter=function(e){var t=e.current();return lu(t)?(e.lastIntValue=t%32,e.advance(),true):false};function lu(e){return e>=65&&e<=90||e>=97&&e<=122}Q.regexp_eatRegExpUnicodeEscapeSequence=function(e,t){t===void 0&&(t=false);var s=e.pos,i=t||e.switchU;if(e.eat(117)){if(this.regexp_eatFixedHexDigits(e,4)){var r=e.lastIntValue;if(i&&r>=55296&&r<=56319){var a=e.pos;if(e.eat(92)&&e.eat(117)&&this.regexp_eatFixedHexDigits(e,4)){var o=e.lastIntValue;if(o>=56320&&o<=57343)return e.lastIntValue=(r-55296)*1024+(o-56320)+65536,true}e.pos=a,e.lastIntValue=r}return true}if(i&&e.eat(123)&&this.regexp_eatHexDigits(e)&&e.eat(125)&&Ih(e.lastIntValue))return true;i&&e.raise("Invalid unicode escape"),e.pos=s}return false};function Ih(e){return e>=0&&e<=1114111}Q.regexp_eatIdentityEscape=function(e){if(e.switchU)return this.regexp_eatSyntaxCharacter(e)?true:e.eat(47)?(e.lastIntValue=47,true):false;var t=e.current();return t!==99&&(!e.switchN||t!==107)?(e.lastIntValue=t,e.advance(),true):false};Q.regexp_eatDecimalEscape=function(e){e.lastIntValue=0;var t=e.current();if(t>=49&&t<=57){do e.lastIntValue=10*e.lastIntValue+(t-48),e.advance();while((t=e.current())>=48&&t<=57);return true}return false};var hu=0,Wt=1,ot=2;Q.regexp_eatCharacterClassEscape=function(e){var t=e.current();if(Rh(t))return e.lastIntValue=-1,e.advance(),Wt;var s=false;if(e.switchU&&this.options.ecmaVersion>=9&&((s=t===80)||t===112)){e.lastIntValue=-1,e.advance();var i;if(e.eat(123)&&(i=this.regexp_eatUnicodePropertyValueExpression(e))&&e.eat(125))return s&&i===ot&&e.raise("Invalid property name"),i;e.raise("Invalid property name")}return hu};function Rh(e){return e===100||e===68||e===115||e===83||e===119||e===87}Q.regexp_eatUnicodePropertyValueExpression=function(e){var t=e.pos;if(this.regexp_eatUnicodePropertyName(e)&&e.eat(61)){var s=e.lastStringValue;if(this.regexp_eatUnicodePropertyValue(e)){var i=e.lastStringValue;return this.regexp_validateUnicodePropertyNameAndValue(e,s,i),Wt}}if(e.pos=t,this.regexp_eatLoneUnicodePropertyNameOrValue(e)){var r=e.lastStringValue;return this.regexp_validateUnicodePropertyNameOrValue(e,r)}return hu};Q.regexp_validateUnicodePropertyNameAndValue=function(e,t,s){Us(e.unicodeProperties.nonBinary,t)||e.raise("Invalid property name"),e.unicodeProperties.nonBinary[t].test(s)||e.raise("Invalid property value")};Q.regexp_validateUnicodePropertyNameOrValue=function(e,t){if(e.unicodeProperties.binary.test(t))return Wt;if(e.switchV&&e.unicodeProperties.binaryOfStrings.test(t))return ot;e.raise("Invalid property name")};Q.regexp_eatUnicodePropertyName=function(e){var t=0;for(e.lastStringValue="";fu(t=e.current());)e.lastStringValue+=Ht(t),e.advance();return e.lastStringValue!==""};function fu(e){return lu(e)||e===95}Q.regexp_eatUnicodePropertyValue=function(e){var t=0;for(e.lastStringValue="";Ph(t=e.current());)e.lastStringValue+=Ht(t),e.advance();return e.lastStringValue!==""};function Ph(e){return fu(e)||dr(e)}Q.regexp_eatLoneUnicodePropertyNameOrValue=function(e){return this.regexp_eatUnicodePropertyValue(e)};Q.regexp_eatCharacterClass=function(e){if(e.eat(91)){var t=e.eat(94),s=this.regexp_classContents(e);return e.eat(93)||e.raise("Unterminated character class"),t&&s===ot&&e.raise("Negated character class may contain strings"),true}return false};Q.regexp_classContents=function(e){return e.current()===93?Wt:e.switchV?this.regexp_classSetExpression(e):(this.regexp_nonEmptyClassRanges(e),Wt)};Q.regexp_nonEmptyClassRanges=function(e){for(;this.regexp_eatClassAtom(e);){var t=e.lastIntValue;if(e.eat(45)&&this.regexp_eatClassAtom(e)){var s=e.lastIntValue;e.switchU&&(t===-1||s===-1)&&e.raise("Invalid character class"),t!==-1&&s!==-1&&t>s&&e.raise("Range out of order in character class")}}};Q.regexp_eatClassAtom=function(e){var t=e.pos;if(e.eat(92)){if(this.regexp_eatClassEscape(e))return true;if(e.switchU){var s=e.current();(s===99||mu(s))&&e.raise("Invalid class escape"),e.raise("Invalid escape")}e.pos=t}var i=e.current();return i!==93?(e.lastIntValue=i,e.advance(),true):false};Q.regexp_eatClassEscape=function(e){var t=e.pos;if(e.eat(98))return e.lastIntValue=8,true;if(e.switchU&&e.eat(45))return e.lastIntValue=45,true;if(!e.switchU&&e.eat(99)){if(this.regexp_eatClassControlLetter(e))return true;e.pos=t}return this.regexp_eatCharacterClassEscape(e)||this.regexp_eatCharacterEscape(e)};Q.regexp_classSetExpression=function(e){var t=Wt,s;if(!this.regexp_eatClassSetRange(e))if(s=this.regexp_eatClassSetOperand(e)){s===ot&&(t=ot);for(var i=e.pos;e.eatChars([38,38]);){if(e.current()!==38&&(s=this.regexp_eatClassSetOperand(e))){s!==ot&&(t=Wt);continue}e.raise("Invalid character in character class")}if(i!==e.pos)return t;for(;e.eatChars([45,45]);)this.regexp_eatClassSetOperand(e)||e.raise("Invalid character in character class");if(i!==e.pos)return t}else e.raise("Invalid character in character class");for(;;)if(!this.regexp_eatClassSetRange(e)){if(s=this.regexp_eatClassSetOperand(e),!s)return t;s===ot&&(t=ot)}};Q.regexp_eatClassSetRange=function(e){var t=e.pos;if(this.regexp_eatClassSetCharacter(e)){var s=e.lastIntValue;if(e.eat(45)&&this.regexp_eatClassSetCharacter(e)){var i=e.lastIntValue;return s!==-1&&i!==-1&&s>i&&e.raise("Range out of order in character class"),true}e.pos=t}return false};Q.regexp_eatClassSetOperand=function(e){return this.regexp_eatClassSetCharacter(e)?Wt:this.regexp_eatClassStringDisjunction(e)||this.regexp_eatNestedClass(e)};Q.regexp_eatNestedClass=function(e){var t=e.pos;if(e.eat(91)){var s=e.eat(94),i=this.regexp_classContents(e);if(e.eat(93))return s&&i===ot&&e.raise("Negated character class may contain strings"),i;e.pos=t}if(e.eat(92)){var r=this.regexp_eatCharacterClassEscape(e);if(r)return r;e.pos=t}return null};Q.regexp_eatClassStringDisjunction=function(e){var t=e.pos;if(e.eatChars([92,113])){if(e.eat(123)){var s=this.regexp_classStringDisjunctionContents(e);if(e.eat(125))return s}else e.raise("Invalid escape");e.pos=t}return null};Q.regexp_classStringDisjunctionContents=function(e){for(var t=this.regexp_classString(e);e.eat(124);)this.regexp_classString(e)===ot&&(t=ot);return t};Q.regexp_classString=function(e){for(var t=0;this.regexp_eatClassSetCharacter(e);)t++;return t===1?Wt:ot};Q.regexp_eatClassSetCharacter=function(e){var t=e.pos;if(e.eat(92))return this.regexp_eatCharacterEscape(e)||this.regexp_eatClassSetReservedPunctuator(e)?true:e.eat(98)?(e.lastIntValue=8,true):(e.pos=t,false);var s=e.current();return s<0||s===e.lookahead()&&Lh(s)||Dh(s)?false:(e.advance(),e.lastIntValue=s,true)};function Lh(e){return e===33||e>=35&&e<=38||e>=42&&e<=44||e===46||e>=58&&e<=64||e===94||e===96||e===126}function Dh(e){return e===40||e===41||e===45||e===47||e>=91&&e<=93||e>=123&&e<=125}Q.regexp_eatClassSetReservedPunctuator=function(e){var t=e.current();return Nh(t)?(e.lastIntValue=t,e.advance(),true):false};function Nh(e){return e===33||e===35||e===37||e===38||e===44||e===45||e>=58&&e<=62||e===64||e===96||e===126}Q.regexp_eatClassControlLetter=function(e){var t=e.current();return dr(t)||t===95?(e.lastIntValue=t%32,e.advance(),true):false};Q.regexp_eatHexEscapeSequence=function(e){var t=e.pos;if(e.eat(120)){if(this.regexp_eatFixedHexDigits(e,2))return true;e.switchU&&e.raise("Invalid escape"),e.pos=t}return false};Q.regexp_eatDecimalDigits=function(e){var t=e.pos,s=0;for(e.lastIntValue=0;dr(s=e.current());)e.lastIntValue=10*e.lastIntValue+(s-48),e.advance();return e.pos!==t};function dr(e){return e>=48&&e<=57}Q.regexp_eatHexDigits=function(e){var t=e.pos,s=0;for(e.lastIntValue=0;du(s=e.current());)e.lastIntValue=16*e.lastIntValue+pu(s),e.advance();return e.pos!==t};function du(e){return e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102}function pu(e){return e>=65&&e<=70?10+(e-65):e>=97&&e<=102?10+(e-97):e-48}Q.regexp_eatLegacyOctalEscapeSequence=function(e){if(this.regexp_eatOctalDigit(e)){var t=e.lastIntValue;if(this.regexp_eatOctalDigit(e)){var s=e.lastIntValue;t<=3&&this.regexp_eatOctalDigit(e)?e.lastIntValue=t*64+s*8+e.lastIntValue:e.lastIntValue=t*8+s}else e.lastIntValue=t;return true}return false};Q.regexp_eatOctalDigit=function(e){var t=e.current();return mu(t)?(e.lastIntValue=t-48,e.advance(),true):(e.lastIntValue=0,false)};function mu(e){return e>=48&&e<=55}Q.regexp_eatFixedHexDigits=function(e,t){var s=e.pos;e.lastIntValue=0;for(var i=0;i<t;++i){var r=e.current();if(!du(r))return e.pos=s,false;e.lastIntValue=16*e.lastIntValue+pu(r),e.advance()}return true};var Sa=function(t){this.type=t.type,this.value=t.value,this.start=t.start,this.end=t.end,t.options.locations&&(this.loc=new cr(t,t.startLoc,t.endLoc)),t.options.ranges&&(this.range=[t.start,t.end])},ge=Ne.prototype;ge.next=function(e){!e&&this.type.keyword&&this.containsEsc&&this.raiseRecoverable(this.start,"Escape sequence in keyword "+this.type.keyword),this.options.onToken&&this.options.onToken(new Sa(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 Sa(this)};typeof Symbol<"u"&&(ge[Symbol.iterator]=function(){var e=this;return{next:function(){var t=e.getToken();return{done:t.type===f.eof,value:t}}}});ge.nextToken=function(){var e=this.curContext();if((!e||!e.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(e.override)return e.override(this);this.readToken(this.fullCharCodeAtPos())};ge.readToken=function(e){return Lt(e,this.options.ecmaVersion>=6)||e===92?this.readWord():this.getTokenFromCode(e)};ge.fullCharCodeAtPos=function(){var e=this.input.charCodeAt(this.pos);if(e<=55295||e>=56320)return e;var t=this.input.charCodeAt(this.pos+1);return t<=56319||t>=57344?e:(e<<10)+t-56613888};ge.skipBlockComment=function(){var e=this.options.onComment&&this.curPosition(),t=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=t;(i=Bc(this.input,r,this.pos))>-1;)++this.curLine,r=this.lineStart=i;this.options.onComment&&this.options.onComment(true,this.input.slice(t+2,s),t,this.pos,e,this.curPosition())};ge.skipLineComment=function(e){for(var t=this.pos,s=this.options.onComment&&this.curPosition(),i=this.input.charCodeAt(this.pos+=e);this.pos<this.input.length&&!Fs(i);)i=this.input.charCodeAt(++this.pos);this.options.onComment&&this.options.onComment(false,this.input.slice(t+e,this.pos),t,this.pos,s,this.curPosition())};ge.skipSpace=function(){e:for(;this.pos<this.input.length;){var e=this.input.charCodeAt(this.pos);switch(e){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(e>8&&e<14||e>=5760&&Vc.test(String.fromCharCode(e)))++this.pos;else break e}}};ge.finishToken=function(e,t){this.end=this.pos,this.options.locations&&(this.endLoc=this.curPosition());var s=this.type;this.type=e,this.value=t,this.updateContext(s)};ge.readToken_dot=function(){var e=this.input.charCodeAt(this.pos+1);if(e>=48&&e<=57)return this.readNumber(true);var t=this.input.charCodeAt(this.pos+2);return this.options.ecmaVersion>=6&&e===46&&t===46?(this.pos+=3,this.finishToken(f.ellipsis)):(++this.pos,this.finishToken(f.dot))};ge.readToken_slash=function(){var e=this.input.charCodeAt(this.pos+1);return this.exprAllowed?(++this.pos,this.readRegexp()):e===61?this.finishOp(f.assign,2):this.finishOp(f.slash,1)};ge.readToken_mult_modulo_exp=function(e){var t=this.input.charCodeAt(this.pos+1),s=1,i=e===42?f.star:f.modulo;return this.options.ecmaVersion>=7&&e===42&&t===42&&(++s,i=f.starstar,t=this.input.charCodeAt(this.pos+2)),t===61?this.finishOp(f.assign,s+1):this.finishOp(i,s)};ge.readToken_pipe_amp=function(e){var t=this.input.charCodeAt(this.pos+1);if(t===e){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(e===124?f.logicalOR:f.logicalAND,2)}return t===61?this.finishOp(f.assign,2):this.finishOp(e===124?f.bitwiseOR:f.bitwiseAND,1)};ge.readToken_caret=function(){var e=this.input.charCodeAt(this.pos+1);return e===61?this.finishOp(f.assign,2):this.finishOp(f.bitwiseXOR,1)};ge.readToken_plus_min=function(e){var t=this.input.charCodeAt(this.pos+1);return t===e?t===45&&!this.inModule&&this.input.charCodeAt(this.pos+2)===62&&(this.lastTokEnd===0||tt.test(this.input.slice(this.lastTokEnd,this.pos)))?(this.skipLineComment(3),this.skipSpace(),this.nextToken()):this.finishOp(f.incDec,2):t===61?this.finishOp(f.assign,2):this.finishOp(f.plusMin,1)};ge.readToken_lt_gt=function(e){var t=this.input.charCodeAt(this.pos+1),s=1;return t===e?(s=e===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)):t===33&&e===60&&!this.inModule&&this.input.charCodeAt(this.pos+2)===45&&this.input.charCodeAt(this.pos+3)===45?(this.skipLineComment(4),this.skipSpace(),this.nextToken()):(t===61&&(s=2),this.finishOp(f.relational,s))};ge.readToken_eq_excl=function(e){var t=this.input.charCodeAt(this.pos+1);return t===61?this.finishOp(f.equality,this.input.charCodeAt(this.pos+2)===61?3:2):e===61&&t===62&&this.options.ecmaVersion>=6?(this.pos+=2,this.finishToken(f.arrow)):this.finishOp(e===61?f.eq:f.prefix,1)};ge.readToken_question=function(){var e=this.options.ecmaVersion;if(e>=11){var t=this.input.charCodeAt(this.pos+1);if(t===46){var s=this.input.charCodeAt(this.pos+2);if(s<48||s>57)return this.finishOp(f.questionDot,2)}if(t===63){if(e>=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 e=this.options.ecmaVersion,t=35;if(e>=13&&(++this.pos,t=this.fullCharCodeAtPos(),Lt(t,true)||t===92))return this.finishToken(f.privateId,this.readWord1());this.raise(this.pos,"Unexpected character '"+Ht(t)+"'")};ge.getTokenFromCode=function(e){switch(e){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 t=this.input.charCodeAt(this.pos+1);if(t===120||t===88)return this.readRadixNumber(16);if(this.options.ecmaVersion>=6){if(t===111||t===79)return this.readRadixNumber(8);if(t===98||t===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(e);case 47:return this.readToken_slash();case 37:case 42:return this.readToken_mult_modulo_exp(e);case 124:case 38:return this.readToken_pipe_amp(e);case 94:return this.readToken_caret();case 43:case 45:return this.readToken_plus_min(e);case 60:case 62:return this.readToken_lt_gt(e);case 61:case 33:return this.readToken_eq_excl(e);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 '"+Ht(e)+"'")};ge.finishOp=function(e,t){var s=this.input.slice(this.pos,this.pos+t);return this.pos+=t,this.finishToken(e,s)};ge.readRegexp=function(){for(var e,t,s=this.pos;;){this.pos>=this.input.length&&this.raise(s,"Unterminated regular expression");var i=this.input.charAt(this.pos);if(tt.test(i)&&this.raise(s,"Unterminated regular expression"),e)e=false;else{if(i==="[")t=true;else if(i==="]"&&t)t=false;else if(i==="/"&&!t)break;e=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 u=this.regexpState||(this.regexpState=new Ut(this));u.reset(s,r,o),this.validateRegExpFlags(u),this.validateRegExpPattern(u);var l=null;try{l=new RegExp(r,o)}catch{}return this.finishToken(f.regexp,{pattern:r,flags:o,value:l})};ge.readInt=function(e,t,s){for(var i=this.options.ecmaVersion>=12&&t===void 0,r=s&&this.input.charCodeAt(this.pos)===48,a=this.pos,o=0,u=0,l=0,h=t??1/0;l<h;++l,++this.pos){var p=this.input.charCodeAt(this.pos),m=void 0;if(i&&p===95){r&&this.raiseRecoverable(this.pos,"Numeric separator is not allowed in legacy octal numeric literals"),u===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"),u=p;continue}if(p>=97?m=p-97+10:p>=65?m=p-65+10:p>=48&&p<=57?m=p-48:m=1/0,m>=e)break;u=p,o=o*e+m}return i&&u===95&&this.raiseRecoverable(this.pos-1,"Numeric separator is not allowed at the last of digits"),this.pos===a||t!=null&&this.pos-a!==t?null:o};function Fh(e,t){return t?parseInt(e,8):parseFloat(e.replace(/_/g,""))}function gu(e){return typeof BigInt!="function"?null:BigInt(e.replace(/_/g,""))}ge.readRadixNumber=function(e){var t=this.pos;this.pos+=2;var s=this.readInt(e);return s==null&&this.raise(this.start+2,"Expected number in radix "+e),this.options.ecmaVersion>=11&&this.input.charCodeAt(this.pos)===110?(s=gu(this.input.slice(t,this.pos)),++this.pos):Lt(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number"),this.finishToken(f.num,s)};ge.readNumber=function(e){var t=this.pos;!e&&this.readInt(10,void 0,true)===null&&this.raise(t,"Invalid number");var s=this.pos-t>=2&&this.input.charCodeAt(t)===48;s&&this.strict&&this.raise(t,"Invalid number");var i=this.input.charCodeAt(this.pos);if(!s&&!e&&this.options.ecmaVersion>=11&&i===110){var r=gu(this.input.slice(t,this.pos));return++this.pos,Lt(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number"),this.finishToken(f.num,r)}s&&/[89]/.test(this.input.slice(t,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(t,"Invalid number")),Lt(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number");var a=Fh(this.input.slice(t,this.pos),s);return this.finishToken(f.num,a)};ge.readCodePoint=function(){var e=this.input.charCodeAt(this.pos),t;if(e===123){this.options.ecmaVersion<6&&this.unexpected();var s=++this.pos;t=this.readHexChar(this.input.indexOf("}",this.pos)-this.pos),++this.pos,t>1114111&&this.invalidStringToken(s,"Code point out of bounds")}else t=this.readHexChar(4);return t};ge.readString=function(e){for(var t="",s=++this.pos;;){this.pos>=this.input.length&&this.raise(this.start,"Unterminated string constant");var i=this.input.charCodeAt(this.pos);if(i===e)break;i===92?(t+=this.input.slice(s,this.pos),t+=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)):(Fs(i)&&this.raise(this.start,"Unterminated string constant"),++this.pos)}return t+=this.input.slice(s,this.pos++),this.finishToken(f.string,t)};var bu={};ge.tryReadTemplateToken=function(){this.inTemplateElement=true;try{this.readTmplToken()}catch(e){if(e===bu)this.readInvalidTemplateToken();else throw e}this.inTemplateElement=false};ge.invalidStringToken=function(e,t){if(this.inTemplateElement&&this.options.ecmaVersion>=9)throw bu;this.raise(e,t)};ge.readTmplToken=function(){for(var e="",t=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)):(e+=this.input.slice(t,this.pos),this.finishToken(f.template,e));if(s===92)e+=this.input.slice(t,this.pos),e+=this.readEscapedChar(true),t=this.pos;else if(Fs(s)){switch(e+=this.input.slice(t,this.pos),++this.pos,s){case 13:this.input.charCodeAt(this.pos)===10&&++this.pos;case 10:e+=`
6
+ `;break;default:e+=String.fromCharCode(s);break}this.options.locations&&(++this.curLine,this.lineStart=this.pos),t=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
+ `&&++this.pos;case`
8
+ `:case"\u2028":case"\u2029":++this.curLine,this.lineStart=this.pos+1;break}this.raise(this.start,"Unterminated template")};ge.readEscapedChar=function(e){var t=this.input.charCodeAt(++this.pos);switch(++this.pos,t){case 110:return`
9
+ `;case 114:return"\r";case 120:return String.fromCharCode(this.readHexChar(2));case 117:return Ht(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"),e){var s=this.pos-1;this.invalidStringToken(s,"Invalid escape sequence in template string")}default:if(t>=48&&t<=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,t=this.input.charCodeAt(this.pos),(i!=="0"||t===56||t===57)&&(this.strict||e)&&this.invalidStringToken(this.pos-1-i.length,e?"Octal literal in template string":"Octal literal in strict mode"),String.fromCharCode(r)}return Fs(t)?(this.options.locations&&(this.lineStart=this.pos,++this.curLine),""):String.fromCharCode(t)}};ge.readHexChar=function(e){var t=this.pos,s=this.readInt(16,e);return s===null&&this.invalidStringToken(t,"Bad character escape sequence"),s};ge.readWord1=function(){this.containsEsc=false;for(var e="",t=true,s=this.pos,i=this.options.ecmaVersion>=6;this.pos<this.input.length;){var r=this.fullCharCodeAtPos();if(as(r,i))this.pos+=r<=65535?1:2;else if(r===92){this.containsEsc=true,e+=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();(t?Lt:as)(o,i)||this.invalidStringToken(a,"Invalid Unicode escape"),e+=Ht(o),s=this.pos}else break;t=false}return e+this.input.slice(s,this.pos)};ge.readWord=function(){var e=this.readWord1(),t=f.name;return this.keywords.test(e)&&(t=_a[e]),this.finishToken(t,e)};var Uh="8.15.0";Ne.acorn={Parser:Ne,version:Uh,defaultOptions:Wn,Position:ei,SourceLocation:cr,getLineInfo:$c,Node:fr,TokenType:ye,tokTypes:f,keywordTypes:_a,TokContext:lt,tokContexts:Te,isIdentifierChar:as,isIdentifierStart:Lt,Token:Sa,isNewLine:Fs,lineBreak:tt,lineBreakG:rh,nonASCIIwhitespace:Vc};function Mh(e,t){return Ne.parse(e,t)}const Oh=new Set(["slider","color","toggle","select","number","text","image","button","coordinate"]);function Bh(e){return e==="button"?0:1}const Ta="__vijiNameMissingLine";function Vh(e){if(e.type!=="CallExpression")return null;const t=e.callee;if(!t||t.type!=="MemberExpression"||t.computed)return null;const s=t.object,i=t.property;if(!s||s.type!=="Identifier"||s.name!=="viji"||!i||i.type!=="Identifier")return null;const r=i.name;return Oh.has(r)?r:null}function jh(e,t){if(!e)return null;if(e.type==="VariableDeclarator"&&e.init===t){const s=e.id;return s?.type==="Identifier"?s.name:null}if(e.type==="Property"&&e.value===t&&!e.computed){const s=e.key;return s?.type==="Identifier"?s.name:null}if(e.type==="AssignmentExpression"&&e.right===t&&e.operator==="="){const s=e.left;if(s?.type==="MemberExpression"&&!s.computed){const i=s.property;if(i?.type==="Identifier")return i.name}return null}return null}function $h(e){for(const t of e.properties){if(t.type!=="Property"||t.computed)continue;const s=t.key;if((s.type==="Identifier"?s.name:s.type==="Literal"&&typeof s.value=="string"?s.value:null)!=="name")continue;const r=t.value;return r.type==="Literal"&&typeof r.value=="string"?r.value:null}return null}function zn(e,t,s){s(e,t);for(const i of Object.keys(e)){if(i==="loc")continue;const r=e[i];if(Array.isArray(r))for(const a of r)a&&typeof a.type=="string"&&zn(a,e,s);else r&&typeof r.type=="string"&&zn(r,e,s)}}function qh(e){let t;const s=[];try{t=Mh(e,{ecmaVersion:"latest",allowReturnOutsideFunction:true,allowAwaitOutsideFunction:true,locations:true,onComment:(u,l,h,p)=>s.push({start:h,end:p})})}catch(u){return{code:e,error:{code:"SCENE_PARSE_ERROR",message:`Scene code could not be parsed: ${u.message}`}}}const i=[],r=new Map,a=[];if(zn(t,null,(u,l)=>{const h=Vh(u);if(!h)return;const p=u.loc?.start.line??0,m=jh(l,u),_=u.arguments,k=Bh(h);if(_.some(D=>D.type==="SpreadElement"))return;const T=_.length>k?_[k]:null,P=T?.type==="ObjectExpression"?$h(T):null,F=P??m;if(F!==null){const D=r.get(F);D!==void 0?a.push({name:F,firstLine:D,line:p}):r.set(F,p)}let U;if(m!==null)U=`name:${JSON.stringify(m)},`;else{if(P!==null)return;U=`${Ta}:${p},`}if(T)T.type==="ObjectExpression"?i.push({pos:T.start+1,text:U}):(i.push({pos:T.start,text:`{ ${U} ...`}),i.push({pos:T.end,text:" }"}));else{let D="";if(_.length>0){const z=_[_.length-1].end,q=u.end-1;let Y=false;for(let K=z;K<q;K++)if(e[K]===","&&!s.some(Z=>K>=Z.start&&K<Z.end)){Y=true;break}D=Y?" ":", "}i.push({pos:u.end-1,text:`${D}{ ${U} }`})}}),a.length>0){const u=a[0];return{code:e,error:{code:"PARAM_NAME_DUPLICATE",message:`Duplicate parameter name '${u.name}' (line ${u.firstLine} and line ${u.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:e,error:null};i.sort((u,l)=>l.pos-u.pos);let o=e;for(const u of i)o=o.slice(0,u.pos)+u.text+o.slice(u.pos);return{code:o,error:null}}function Eo(e,t){const s=Math.abs(t-e);if(s<=0)return 1;const i=Math.pow(10,Math.floor(Math.log10(s/100)));return Math.max(i,Number.EPSILON)}const Hh=/^[A-Za-z_$][A-Za-z0-9_$]*$/,Wh=new Set(["__proto__","constructor","prototype",Ta]);function Mt(e){const t=e?.name;if(typeof t=="string"&&t.length>0)return t;const s=e?.[Ta];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 Gh{parameterDefinitions=new Map;parameterGroups=new Map;parameterValues=new Map;parameterObjects=new Map;parametersDefined=false;initialValuesSynced=false;debugMode=false;setDebugMode(t){this.debugMode=t}debugLog(t,...s){this.debugMode&&console.log(t,...s)}postMessageCallback;constructor(t){this.postMessageCallback=t}createSliderParameter(t,s){const i=Mt(s),r=s.min??0,a=s.max??100,o={value:t,min:r,max:a,step:s.step??Eo(r,a),...s.label!==void 0&&{label:s.label},description:s.description??"",group:s.group??"general",category:s.category??"general"},u={type:"slider",defaultValue:t,...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,u),this.parameterObjects.set(i,o),o}createColorParameter(t,s){const i=Mt(s),r=qn(t),a={value:r,rgb:Object.freeze(Ui(r)),hsb:Object.freeze(bo(r)),...s.label!==void 0&&{label:s.label},description:s.description??"",group:s.group??"general",category:s.category??"general"},o={type:"color",defaultValue:r,...a.label!==void 0&&{label:a.label},description:a.description,group:a.group,category:a.category};return this.storeParameterDefinition(i,o),this.parameterObjects.set(i,a),a}createToggleParameter(t,s){const i=Mt(s),r={value:t,...s.label!==void 0&&{label:s.label},description:s.description??"",group:s.group??"general",category:s.category??"general"},a={type:"toggle",defaultValue:t,...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(t,s){const i=Mt(s),r={value:t,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:t,...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(t,s){const i=Mt(s),r={value:t,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:t,...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(t,s){const i=Mt(s),r=s.min??0,a=s.max??100,o={value:t,min:r,max:a,step:s.step??Eo(r,a),...s.label!==void 0&&{label:s.label},description:s.description??"",group:s.group??"general",category:s.category??"general"},u={type:"number",defaultValue:t,...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,u),this.parameterObjects.set(i,o),o}createImageParameter(t,s){const i=Mt(s),r={value:t,...s.label!==void 0&&{label:s.label},description:s.description??"",group:s.group??"general",category:s.category??"general"},a={type:"image",defaultValue:t,...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(t){const s=Mt(t),i={value:false,...t.label!==void 0&&{label:t.label},description:t.description??"",group:t.group??"general",category:t.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(t,s){const i=Mt(s),r={value:{x:t.x,y:t.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:t.x,y:t.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}storeParameterDefinition(t,s){if(!Hh.test(t))throw new Error(`[PARAM_NAME_INVALID] Parameter name "${t}" is not a valid identifier (letters, digits, _ and $, not starting with a digit).`);if(Wh.has(t))throw new Error(`[PARAM_NAME_INVALID] Parameter name "${t}" is reserved.`);if(this.parameterDefinitions.has(t))throw new Error(`[PARAM_NAME_DUPLICATE] Duplicate parameter name "${t}". Parameter names are scene-global — rename one, or pass name:'...' to distinguish them.`);const i={name:t,...s};this.parameterDefinitions.set(t,i),this.parameterValues.set(t,i.defaultValue)}updateParameterValue(t,s){const i=this.parameterDefinitions.get(t);if(!i)return console.warn(`Unknown parameter: ${t}. Available parameters:`,Array.from(this.parameterDefinitions.keys())),false;if(i.type==="color")try{s=qn(s)}catch(l){return console.error(`Parameter '${t}' invalid color: ${l.message}`),false}if(!this.validateParameterValue(t,s,i))return console.warn(`Validation failed for parameter ${t} = ${s}`),false;const r=this.parameterValues.get(t),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:r===s)&&!a)return false;this.parameterValues.set(t,s);const u=this.parameterObjects.get(t);if(u&&(u.value=s,i.type==="color")){const l=s;u.rgb=Object.freeze(Ui(l)),u.hsb=Object.freeze(bo(l))}return true}validateParameterValue(t,s,i){if(i.validate&&!i.validate(s))return console.error(`Custom validation failed for parameter '${t}': ${s}`),false;switch(i.type){case"slider":case"number":if(typeof s!="number"||isNaN(s))return console.error(`Parameter '${t}' must be a number, got: ${s}`),false;if(i.config?.min!==void 0&&s<i.config.min)return console.error(`Parameter '${t}' value ${s} is below minimum ${i.config.min}`),false;if(i.config?.max!==void 0&&s>i.config.max)return console.error(`Parameter '${t}' value ${s} is above maximum ${i.config.max}`),false;break;case"color":if(typeof s!="string"||!/^#[0-9a-f]{6}$/.test(s))return console.error(`Parameter '${t}' must be normalized lowercase hex '#rrggbb', got: ${s}`),false;break;case"toggle":if(typeof s!="boolean")return console.error(`Parameter '${t}' must be a boolean, got: ${s}`),false;break;case"select":if(!i.config?.options||!i.config.options.includes(s))return console.error(`Parameter '${t}' value ${s} is not in options: ${i.config?.options}`),false;break;case"text":if(typeof s!="string")return console.error(`Parameter '${t}' must be a string, got: ${s}`),false;if(i.config?.maxLength&&s.length>i.config.maxLength)return console.error(`Parameter '${t}' text too long: ${s.length} > ${i.config.maxLength}`),false;break;case"image":if(s!==null&&!(s instanceof ImageBitmap))return console.error(`Parameter '${t}' must be null or ImageBitmap, got: ${s}`),false;break;case"button":if(typeof s!="boolean")return console.error(`Parameter '${t}' 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 '${t}' 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 '${t}' 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 '${t}' x and y must be between -1 and 1, got: x=${r.x}, y=${r.y}`),false;break}}return true}resetParameterState(){this.parametersDefined=false,this.initialValuesSynced=false,this.parameterDefinitions.clear(),this.parameterGroups.clear(),this.parameterValues.clear(),this.parameterObjects.clear()}sendAllParametersToHost(){if(!this.parametersDefined)try{const t=new Map;for(const[s,i]of this.parameterDefinitions){const r=i.group||"general";if(!t.has(r)){const o=i.category||"general";t.set(r,{groupName:r,category:o,parameters:{}})}const a=t.get(r);a.parameters[s]=i}this.parametersDefined=true,this.postMessageCallback("parameters-defined",{groups:Array.from(t.values())}),this.debugLog(`All parameters sent to host: ${this.parameterDefinitions.size} parameters in ${t.size} groups`)}catch(t){this.postMessageCallback("parameter-validation-error",{message:`Failed to send parameters to host: ${t.message}`,code:"PARAMETER_SENDING_ERROR"})}}markInitialValuesSynced(){this.initialValuesSynced=true}seedInitialValues(t){for(const[s,i]of Object.entries(t)){if(!this.parameterDefinitions.has(s)){this.debugLog(`Skipping initial value for undefined parameter: ${s}`);continue}this.updateParameterValue(s,i)}this.markInitialValuesSynced()}getParameterCount(){return this.parameterDefinitions.size}getAllParameterObjects(){return this.parameterObjects}resetButtonParameters(){for(const[t,s]of this.parameterDefinitions)if(s.type==="button"){const i=this.parameterObjects.get(t);i&&i.value===true&&(i.value=false,this.parameterValues.set(t,false))}}}class Xh{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:t=>this.keyboardState.activeKeys.has(t.toLowerCase()),wasPressed:t=>this.keyboardState.pressedThisFrame.has(t.toLowerCase()),wasReleased:t=>this.keyboardState.releasedThisFrame.has(t.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 t=this.keyboardState.isPressed,s=this.keyboardState.wasPressed,i=this.keyboardState.wasReleased;this.keyboardState.isPressed=r=>{const a=t(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(t){if(!this.isEnabled)return;this.mouseState.x=t.x,this.mouseState.y=t.y,this.mouseState.isInCanvas=t.isInCanvas!==void 0?t.isInCanvas:true,this.mouseState.leftButton=(t.buttons&1)!==0,this.mouseState.rightButton=(t.buttons&2)!==0,this.mouseState.middleButton=(t.buttons&4)!==0,this.mouseState.isPressed=t.buttons>0,this.mouseState.deltaX+=t.deltaX||0,this.mouseState.deltaY+=t.deltaY||0,this.mouseState.wheelDelta+=t.wheelDeltaY||0,this.mouseState.wheelX+=t.wheelDeltaX||0,this.mouseState.wheelY+=t.wheelDeltaY||0;const s=t.buttons&~this.previousButtons,i=this.previousButtons&~t.buttons;this.mouseState.wasPressed=this.mouseState.wasPressed||s!==0,this.mouseState.wasReleased=this.mouseState.wasReleased||i!==0,this.mouseState.wasMoved=this.mouseState.wasMoved||t.deltaX!==0||t.deltaY!==0,this.previousButtons=t.buttons}handleKeyboardUpdate(t){if(!this.isEnabled)return;const s=t.key.toLowerCase();if(t.type==="keydown"){if(!this.keyboardState.activeKeys.has(s)){this.keyboardState.activeKeys.add(s),this.keyboardState.pressedThisFrame.add(s),this.keyboardState.lastKeyPressed=t.key;const i=t.keyCode;i!==void 0&&i>=0&&i<=255&&(this.keyboardTextureData[i]=255,this.keyboardTextureData[256+i]=255,this.keyboardTextureData[512+i]^=255)}}else if(t.type==="keyup"){this.keyboardState.activeKeys.delete(s),this.keyboardState.releasedThisFrame.add(s),this.keyboardState.lastKeyReleased=t.key;const i=t.keyCode;i!==void 0&&i>=0&&i<=255&&(this.keyboardTextureData[i]=0)}this.keyboardState.shift=t.shiftKey,this.keyboardState.ctrl=t.ctrlKey,this.keyboardState.alt=t.altKey,this.keyboardState.meta=t.metaKey}handleTouchUpdate(t){if(!this.isEnabled)return;const s=t.touches.map(a=>{const o=a.identifier,u=!!a.ended;let l=0,h=0,p=0,m=0;const _=this.previousTouchPositions.get(o);if(_){l=a.clientX-_.x,h=a.clientY-_.y;const k=(t.timestamp-_.timestamp)/1e3;k>0&&(p=l/k,m=h/k)}return u?this.previousTouchPositions.delete(o):this.previousTouchPositions.set(o,{x:a.clientX,y:a.clientY,timestamp:t.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:p,y:m},isNew:t.type==="touchstart"&&!_,isActive:!u,isEnding:u}}),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,t.type==="touchstart"?this.touchState.started.push(...s.filter(a=>a.isNew)):t.type==="touchmove"?this.touchState.moved=i:(t.type==="touchend"||t.type==="touchcancel")&&this.touchState.ended.push(...r)}updatePointerState(){const t=this.touchState,s=this.mouseState;if(t.count>0&&t.primary){const i=t.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(t){this.isEnabled=t,t||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 So={activeFeatures:[],processingTime:0,targetFPS:0,actualFPS:0,isProcessing:false},To={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}},zh={faceDetection:"faceDetection",faceMesh:"faceMesh",emotionDetection:"emotion",handTracking:"handTracking",poseDetection:"poseDetection",bodySegmentation:"segmentation"};class Yh{desired=new Set;results={faces:[],hands:[],pose:null,segmentation:null};stats={...So};activity=structuredClone(To);analysedCanvas=null;analysedCtx=null;analysedFrameValid=false;analysedFrameData=null;analysedFrameDataDirty=false;streamIndex=0;sendRequest=null;debugMode=false;setMessaging(t,s){this.streamIndex=t,this.sendRequest=s,this.desired.size>0&&this.sendRequest(this.streamIndex,[...this.desired])}setDebugMode(t){this.debugMode=t}handleResultsUpdate(t){this.results.faces=t.results.faces??[],this.results.hands=t.results.hands??[],this.results.pose=t.results.pose??null,this.results.segmentation=t.results.segmentation??null,this.stats=t.stats,this.activity=t.activity,t.analysedFrame&&this.acceptAnalysedFrame(t.analysedFrame),this.debugLog(`cv-results-update applied (stream ${t.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 t=new Set([...this.desired].map(i=>zh[i])),s=i=>({active:t.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 t=this.desired.size>0;this.desired.clear(),this.clearResults(),t&&this.sendRequest?.(this.streamIndex,[])}clearResults(){this.results.faces=[],this.results.hands=[],this.results.pose=null,this.results.segmentation=null,this.stats={...So},this.activity=structuredClone(To),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 t=i=>r=>this.setFeature(i,r!==false),s=i=>()=>this.setFeature(i,false);return{enableFaceDetection:t("faceDetection"),disableFaceDetection:s("faceDetection"),enableFaceMesh:t("faceMesh"),disableFaceMesh:s("faceMesh"),enableEmotionDetection:t("emotionDetection"),disableEmotionDetection:s("emotionDetection"),enableHandTracking:t("handTracking"),disableHandTracking:s("handTracking"),enablePoseDetection:t("poseDetection"),disablePoseDetection:s("poseDetection"),enableBodySegmentation:t("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(t,s){const i=this.desired.has(t);return s===i||(s?this.desired.add(t):(this.desired.delete(t),this.clearFamilyLocally(t),this.desired.size===0&&(this.analysedFrameValid=false,this.analysedFrameData=null,this.analysedFrameDataDirty=false)),this.sendRequest?.(this.streamIndex,[...this.desired])),Promise.resolve()}clearFamilyLocally(t){const s=["faceDetection","faceMesh","emotionDetection"];s.includes(t)?s.some(i=>this.desired.has(i))||(this.results.faces=[]):t==="handTracking"?this.results.hands=[]:t==="poseDetection"?this.results.pose=null:t==="bodySegmentation"&&(this.results.segmentation=null)}acceptAnalysedFrame(t){try{if(this.analysedCanvas||(this.analysedCanvas=new OffscreenCanvas(t.width,t.height),this.analysedCtx=this.analysedCanvas.getContext("2d",{willReadFrequently:true})),!this.analysedCtx)return;(this.analysedCanvas.width!==t.width||this.analysedCanvas.height!==t.height)&&(this.analysedCanvas.width=t.width,this.analysedCanvas.height=t.height),this.analysedCtx.drawImage(t,0,0),this.analysedFrameValid=true,this.analysedFrameDataDirty=true}finally{try{t.close()}catch{}}}checkWebGLContextAvailability(){try{const t=new OffscreenCanvas(1,1);return(t.getContext("webgl2")??t.getContext("webgl"))!==null}catch{return false}}debugLog(t,...s){this.debugMode&&console.log(`[CVSurfaceState] ${t}`,...s)}}class ki{offscreenCanvas=null;ctx=null;gl=null;debugMode=false;directGPUMode=false;deviceId;setDebugMode(t){this.debugMode=t,this.cvSurfaceState&&this.cvSurfaceState.setDebugMode(t)}debugLog(t,...s){this.debugMode&&console.log(t,...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 Yh;const t=this,s=this.cvSurfaceState.getControlInterface();this.cvSurface={analysedFrame:null,getAnalysedFrameData:()=>t.cvSurfaceState.getAnalysedFrameData(),faces:[],hands:[],pose:null,segmentation:null,...s}}getCvSurface(){return this.cvSurface}setCVMessaging(t,s){this.cvSurfaceState.setMessaging(t,s)}handleCVResultsUpdate(t){this.cvSurfaceState.handleResultsUpdate(t)}setDeviceId(t){this.deviceId=t}getDeviceId(){return this.deviceId}peekDebugState(){return{isConnected:this.videoState.isConnected,hasFrame:this.videoState.currentFrame!==null}}getVideoAPI(){const t=this.videoState.currentFrame;this.directGPUMode&&t 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:t,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(t){try{if(this.disconnectVideo(),this.offscreenCanvas=t.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=t.width,this.videoState.frameHeight=t.height,this.frameCount=0,this.hasLoggedFirstFrame=false,this.debugLog("✅ OffscreenCanvas received and setup completed (worker-side)",{width:t.width,height:t.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(t){if(!this.offscreenCanvas||!this.ctx){console.warn("🔴 Received frame but OffscreenCanvas not setup"),t.imageBitmap.close();return}try{this.frameCount%150===0&&this.debugLog("✅ Worker received ImageBitmap frame:",{bitmapSize:`${t.imageBitmap.width}x${t.imageBitmap.height}`,canvasSize:`${this.offscreenCanvas.width}x${this.offscreenCanvas.height}`,frameCount:this.frameCount,timestamp:t.timestamp}),this.ctx.clearRect(0,0,this.offscreenCanvas.width,this.offscreenCanvas.height),this.ctx.drawImage(t.imageBitmap,0,0,this.offscreenCanvas.width,this.offscreenCanvas.height),this.frameDataDirty=true,this.processCurrentFrame(t.timestamp),t.imageBitmap.close(),this.frameCount++}catch(s){console.error("🔴 Error processing video frame (worker-side):",s);try{t.imageBitmap.close()}catch{}}}processCurrentFrame(t){if(!(!this.offscreenCanvas||!this.ctx))try{const s=t-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=t}catch(s){console.error("Error processing video frame (worker-side):",s)}}handleVideoConfigUpdate(t){try{if(t.disconnect){this.disconnectVideo();return}t.width&&t.height&&this.offscreenCanvas&&this.resizeCanvas(t.width,t.height),t.targetFrameRate&&this.updateProcessingConfig(t.targetFrameRate)}catch(s){console.error("Error handling video config update:",s)}}resizeCanvas(t,s){if(this.offscreenCanvas)try{this.offscreenCanvas.width=t,this.offscreenCanvas.height=s,this.videoState.frameWidth=t,this.videoState.frameHeight=s,this.gl&&this.gl.viewport(0,0,t,s),this.debugLog(`📐 OffscreenCanvas resized to ${t}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(t){this.targetFrameRate=Math.max(1,Math.min(60,t)),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(t){if(this.disconnectVideo(),this.directGPUMode=t==="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(t){this.directGPUMode?(this.videoState.currentFrame instanceof ImageBitmap&&this.videoState.currentFrame.close(),this.videoState.currentFrame=t.imageBitmap,this.videoState.frameWidth=t.imageBitmap.width,this.videoState.frameHeight=t.imageBitmap.height,this.videoState.isConnected=true):((!this.offscreenCanvas||!this.ctx)&&(this.debugLog("[Compositor] Initializing canvas for direct frames"),this.offscreenCanvas=new OffscreenCanvas(t.imageBitmap.width,t.imageBitmap.height),this.ctx=this.offscreenCanvas.getContext("2d",{willReadFrequently:true})),(this.offscreenCanvas.width!==t.imageBitmap.width||this.offscreenCanvas.height!==t.imageBitmap.height)&&(this.offscreenCanvas.width=t.imageBitmap.width,this.offscreenCanvas.height=t.imageBitmap.height),this.ctx.clearRect(0,0,this.offscreenCanvas.width,this.offscreenCanvas.height),this.ctx.drawImage(t.imageBitmap,0,0),this.videoState.currentFrame=this.offscreenCanvas,this.videoState.frameWidth=t.imageBitmap.width,this.videoState.frameHeight=t.imageBitmap.height,this.videoState.isConnected=true,this.frameDataDirty=true,this.processCurrentFrame(t.timestamp),t.imageBitmap.close())}}const Kh=0,Zh=100,Qh=200,Jh=1,Co=100;function qs(e){return e===Kh?"main":e<Zh?"additional":e<Qh?"device":"directFrame"}const Ao=["faceDetection","faceMesh","emotion","handTracking","poseDetection","segmentation"];function Pe(){return{trueCount:0,falseCount:0}}function Tn(){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 ef{enabled=false;usageMask={mouse:{position:false,left:false,right:false,middle:false},pointer:{position:false,down:false},touch:false};frames=[];counts=Tn();prev=null;onTransition=null;setEnabled(t){this.enabled=t,t||(this.frames=[],this.counts=Tn(),this.prev=null)}isEnabled(){return this.enabled}setUsageMask(t){this.usageMask=t}setTransitionCallback(t){this.onTransition=t}evaluate(t){const s=this.usageMask,i=s.mouse.position&&t.mouse.isInCanvas||s.mouse.left&&t.mouse.leftButton||s.mouse.right&&t.mouse.rightButton||s.mouse.middle&&t.mouse.middleButton,r=s.pointer.position&&t.pointer.isInCanvas&&t.pointer.active||s.pointer.down&&t.pointer.isDown,a=s.touch&&t.touchCount>0;return{audio:t.audioConnected,video:t.videoConnected,mouse:i,keyboard:t.keyboardConsumed,pointer:r,touch:a,sensors:t.sensorsConnected,devices:t.devicesConnected,cv:t.cv}}recordFrame(t){const s=this.evaluate(t);this.frames.push({frameIndex:t.frameIndex,timestamp:t.timestamp,cpuMs:t.cpuMs,gpuMs:null,frameIntervalMs:t.frameIntervalMs,capabilities:s}),this.tally(s),this.emitEdges(s,t.frameIndex,t.timestamp),this.prev=s}flush(){if(this.frames.length===0)return null;const t=this.frames,s=this.counts;return this.frames=[],this.counts=Tn(),{frames:t,timing:{cpuMs:Io(t,i=>i.cpuMs),frameIntervalMs:Io(t,i=>i.frameIntervalMs)},capabilities:s}}tally(t){const s=this.counts;kt(s.audio,t.audio),kt(s.video,t.video),kt(s.mouse,t.mouse),kt(s.keyboard,t.keyboard),kt(s.pointer,t.pointer),kt(s.touch,t.touch),kt(s.sensors,t.sensors),kt(s.devices,t.devices);for(const i of Ao)kt(s.cv[i].active,t.cv[i].active),kt(s.cv[i].meaningful,t.cv[i].meaningful)}emitEdges(t,s,i){if(!this.onTransition)return;const r=this.prev,a=[["audio",t.audio,r?r.audio:false],["video",t.video,r?r.video:false],["mouse",t.mouse,r?r.mouse:false],["keyboard",t.keyboard,r?r.keyboard:false],["pointer",t.pointer,r?r.pointer:false],["touch",t.touch,r?r.touch:false],["sensors",t.sensors,r?r.sensors:false],["devices",t.devices,r?r.devices:false]];for(const[o,u,l]of a)u!==l&&this.onTransition({capability:o,active:u,frameIndex:s,timestamp:i});for(const o of Ao){const u=t.cv[o].active,l=r?r.cv[o].active:false;u!==l&&this.onTransition({capability:"cv",cvType:o,level:"active",active:u,frameIndex:s,timestamp:i});const h=t.cv[o].meaningful,p=r?r.cv[o].meaningful:false;h!==p&&this.onTransition({capability:"cv",cvType:o,level:"meaningful",active:h,frameIndex:s,timestamp:i})}}}function kt(e,t){t?e.trueCount++:e.falseCount++}function Io(e,t){let s=1/0,i=-1/0,r=0;for(const a of e){const o=t(a);o<s&&(s=o),o>i&&(i=o),r+=o}return{min:s,avg:r/e.length,max:i}}function yu(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"&&"BYTES_PER_ELEMENT"in e&&e.BYTES_PER_ELEMENT===1}function os(e,t=""){if(typeof e!="number"){const s=t&&`"${t}" `;throw new TypeError(`${s}expected number, got ${typeof e}`)}if(!Number.isSafeInteger(e)||e<0){const s=t&&`"${t}" `;throw new RangeError(`${s}expected integer >= 0, got ${e}`)}}function Gt(e,t,s=""){const i=yu(e),r=e?.length,a=t!==void 0;if(!i||a&&r!==t){const o=s&&`"${s}" `,u=a?` of length ${t}`:"",l=i?`length=${r}`:`type=${typeof e}`,h=o+"expected Uint8Array"+u+", got "+l;throw i?new RangeError(h):new TypeError(h)}return e}function pr(e){if(typeof e!="function"||typeof e.create!="function")throw new TypeError("Hash must wrapped by utils.createHasher");if(os(e.outputLen),os(e.blockLen),e.outputLen<1)throw new Error('"outputLen" must be >= 1');if(e.blockLen<1)throw new Error('"blockLen" must be >= 1')}function ji(e,t=true){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function _u(e,t){Gt(e,void 0,"digestInto() output");const s=t.outputLen;if(e.length<s)throw new RangeError('"digestInto() output" expected to be of length >='+s)}function si(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function Cn(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function wt(e,t){return e<<32-t|e>>>t}const xu=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",tf=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function Ca(e){if(Gt(e),xu)return e.toHex();let t="";for(let s=0;s<e.length;s++)t+=tf[e[s]];return t}const Ot={_0:48,_9:57,A:65,F:70,a:97,f:102};function Ro(e){if(e>=Ot._0&&e<=Ot._9)return e-Ot._0;if(e>=Ot.A&&e<=Ot.F)return e-(Ot.A-10);if(e>=Ot.a&&e<=Ot.f)return e-(Ot.a-10)}function vu(e){if(typeof e!="string")throw new TypeError("hex string expected, got "+typeof e);if(xu)try{return Uint8Array.fromHex(e)}catch(r){throw r instanceof SyntaxError?new RangeError(r.message):r}const t=e.length,s=t/2;if(t%2)throw new RangeError("hex string expected, got unpadded hex of length "+t);const i=new Uint8Array(s);for(let r=0,a=0;r<s;r++,a+=2){const o=Ro(e.charCodeAt(a)),u=Ro(e.charCodeAt(a+1));if(o===void 0||u===void 0){const l=e[a]+e[a+1];throw new RangeError('hex string expected, got non-hex character "'+l+'" at index '+a)}i[r]=o*16+u}return i}function sf(...e){let t=0;for(let i=0;i<e.length;i++){const r=e[i];Gt(r),t+=r.length}const s=new Uint8Array(t);for(let i=0,r=0;i<e.length;i++){const a=e[i];s.set(a,r),r+=a.length}return s}function rf(e,t={}){const s=(r,a)=>e(a).update(r).digest(),i=e(void 0);return s.outputLen=i.outputLen,s.blockLen=i.blockLen,s.canXOF=i.canXOF,s.create=r=>e(r),Object.assign(s,t),Object.freeze(s)}function nf(e=32){os(e,"bytesLength");const t=typeof globalThis=="object"?globalThis.crypto:null;if(typeof t?.getRandomValues!="function")throw new Error("crypto.getRandomValues must be defined");if(e>65536)throw new RangeError(`"bytesLength" expected <= 65536, got ${e}`);return t.getRandomValues(new Uint8Array(e))}const af=e=>({oid:Uint8Array.from([6,9,96,134,72,1,101,3,4,2,e])});function of(e,t,s){return e&t^~e&s}function cf(e,t,s){return e&t^e&s^t&s}class uf{blockLen;outputLen;canXOF=false;padOffset;isLE;buffer;view;finished=false;length=0;pos=0;destroyed=false;constructor(t,s,i,r){this.blockLen=t,this.outputLen=s,this.padOffset=i,this.isLE=r,this.buffer=new Uint8Array(t),this.view=Cn(this.buffer)}update(t){ji(this),Gt(t);const{view:s,buffer:i,blockLen:r}=this,a=t.length;for(let o=0;o<a;){const u=Math.min(r-this.pos,a-o);if(u===r){const l=Cn(t);for(;r<=a-o;o+=r)this.process(l,o);continue}i.set(t.subarray(o,o+u),this.pos),this.pos+=u,o+=u,this.pos===r&&(this.process(s,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){ji(this),_u(t,this),this.finished=true;const{buffer:s,view:i,blockLen:r,isLE:a}=this;let{pos:o}=this;s[o++]=128,si(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 u=Cn(t),l=this.outputLen;if(l%4)throw new Error("_sha2: outputLen must be aligned to 32bit");const h=l/4,p=this.get();if(h>p.length)throw new Error("_sha2: outputLen bigger than state");for(let m=0;m<h;m++)u.setUint32(4*m,p[m],a)}digest(){const{buffer:t,outputLen:s}=this;this.digestInto(t);const i=t.slice(0,s);return this.destroy(),i}_cloneInto(t){t||=new this.constructor,t.set(...this.get());const{blockLen:s,buffer:i,length:r,finished:a,destroyed:o,pos:u}=this;return t.destroyed=o,t.finished=a,t.length=r,t.pos=u,r%s&&t.buffer.set(i),t}clone(){return this._cloneInto()}}const Yt=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),lf=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]),Kt=new Uint32Array(64);class hf extends uf{constructor(t){super(64,t,8,false)}get(){const{A:t,B:s,C:i,D:r,E:a,F:o,G:u,H:l}=this;return[t,s,i,r,a,o,u,l]}set(t,s,i,r,a,o,u,l){this.A=t|0,this.B=s|0,this.C=i|0,this.D=r|0,this.E=a|0,this.F=o|0,this.G=u|0,this.H=l|0}process(t,s){for(let m=0;m<16;m++,s+=4)Kt[m]=t.getUint32(s,false);for(let m=16;m<64;m++){const _=Kt[m-15],k=Kt[m-2],T=wt(_,7)^wt(_,18)^_>>>3,P=wt(k,17)^wt(k,19)^k>>>10;Kt[m]=P+Kt[m-7]+T+Kt[m-16]|0}let{A:i,B:r,C:a,D:o,E:u,F:l,G:h,H:p}=this;for(let m=0;m<64;m++){const _=wt(u,6)^wt(u,11)^wt(u,25),k=p+_+of(u,l,h)+lf[m]+Kt[m]|0,P=(wt(i,2)^wt(i,13)^wt(i,22))+cf(i,r,a)|0;p=h,h=l,l=u,u=o+k|0,o=a,a=r,r=i,i=k+P|0}i=i+this.A|0,r=r+this.B|0,a=a+this.C|0,o=o+this.D|0,u=u+this.E|0,l=l+this.F|0,h=h+this.G|0,p=p+this.H|0,this.set(i,r,a,o,u,l,h,p)}roundClean(){si(Kt)}destroy(){this.destroyed=true,this.set(0,0,0,0,0,0,0,0),si(this.buffer)}}class ff extends hf{A=Yt[0]|0;B=Yt[1]|0;C=Yt[2]|0;D=Yt[3]|0;E=Yt[4]|0;F=Yt[5]|0;G=Yt[6]|0;H=Yt[7]|0;constructor(){super(32)}}const Aa=rf(()=>new ff,af(1)),Et={version:"1.9.4",url:"https://cdn.jsdelivr.net/npm/p5@1.9.4/lib/p5.min.js",sha256:"00a532c56e785c68d7c7bb6f9a084e2c856b71527f22c3260aff4a2f582d80c9"};async function df(){let e;try{e=await fetch(Et.url)}catch(a){throw new Error(`p5 ${Et.version} download failed (${Et.url}): ${a.message}`)}if(!e.ok)throw new Error(`p5 ${Et.version} download failed (${Et.url}): HTTP ${e.status}`);const t=new Uint8Array(await e.arrayBuffer()),s=Aa(t);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(t)+`
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 pf{constructor(t,s,i){this.offscreenCanvas=t,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 df(),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(t){throw console.error("Failed to initialize P5.js:",t),t}}installMinimalShims(){const t=globalThis;if(typeof t.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"};t.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)=>t.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=t.document}typeof t.window>"u"&&(t.window={devicePixelRatio:1,innerWidth:this.offscreenCanvas.width,innerHeight:this.offscreenCanvas.height,addEventListener:()=>{},removeEventListener:()=>{},requestAnimationFrame:s=>0,cancelAnimationFrame:()=>{},setTimeout:t.setTimeout.bind(t),clearTimeout:t.clearTimeout.bind(t),setInterval:t.setInterval.bind(t),clearInterval:t.clearInterval.bind(t),performance:t.performance,console:t.console,Math:t.Math,Date:t.Date,Array:t.Array,Object:t.Object}),typeof t.navigator>"u"&&(t.navigator={userAgent:"Viji-Worker-P5",platform:"Worker",language:"en-US"}),typeof t.screen>"u"&&(t.screen={width:this.offscreenCanvas.width,height:this.offscreenCanvas.height,availWidth:this.offscreenCanvas.width,availHeight:this.offscreenCanvas.height,colorDepth:24,pixelDepth:24}),typeof t.HTMLCanvasElement>"u"&&(t.HTMLCanvasElement=function(){},Object.setPrototypeOf(OffscreenCanvas.prototype,t.HTMLCanvasElement.prototype))}getOrCreateP5Image(t,s){if(!this.p5Instance)return null;const i=this.imageParameterCache.get(t);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(t,{source:s,p5Image:o}),o}catch(r){return console.warn("Failed to convert image to P5-compatible object:",r),null}}wrapVideoFramesForP5(t){if(t.video?.currentFrame instanceof OffscreenCanvas){const s=t.video.currentFrame;t.video.currentFrame={canvas:s,elt:s,width:s.width,height:s.height}}else if(t.video?.currentFrame instanceof ImageBitmap){const s=t.video.currentFrame;t.video.currentFrame={elt:s,width:s.width,height:s.height}}if(t.video?.cv?.analysedFrame instanceof OffscreenCanvas){const s=t.video.cv.analysedFrame;t.video.cv.analysedFrame={canvas:s,elt:s,width:s.width,height:s.height}}if(Array.isArray(t.videoStreams)){for(const s of t.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(t){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 t)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(t,s){if(!this.p5Instance||!this.p5InternalSetupComplete)return false;try{return this.addP5PropertyToImageParameters(s),this.wrapVideoFramesForP5(t),!this.artistSetupComplete&&this.setupFn&&(this.setupFn(t,this.p5Instance),this.artistSetupComplete=true),this.p5Instance._setProperty&&this.p5Instance._setProperty("frameCount",this.p5Instance.frameCount+1),this.renderFn?(this.renderFn(t,this.p5Instance),true):false}catch(i){throw console.error("P5 render error:",i),i}}resize(t,s){if(this.p5Instance){if(this.p5Instance._setProperty("width",t),this.p5Instance._setProperty("height",s),this.p5Instance._setProperty("_width",t),this.p5Instance._setProperty("_height",s),this.p5Instance._renderer&&(this.p5Instance._renderer.width=t,this.p5Instance._renderer.height=s),typeof this.p5Instance.resizeCanvas=="function")try{this.p5Instance.resizeCanvas(t,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(t){console.warn("P5 cleanup warning:",t)}this.p5Instance=null}this.setupFn=null,this.renderFn=null,this.p5InternalSetupComplete=false,this.artistSetupComplete=false}}const Yn=["faceDetection","faceMesh","emotionDetection","handTracking","poseDetection","bodySegmentation"];class Po{static parseParameters(t){const s=[],i=t.split(`
11
+ `);for(const r of i){const a=r.trim(),o=a.match(/\/\/\s*@viji-(\w+):(\w+)\s+(.+)/);if(o){const[,l,h,p]=o;try{const m=this.parseKeyValuePairs(p),_={type:l,uniformName:h,label:m.label||h,default:m.default,config:m};this.validateParameter(_),s.push(_)}catch(m){console.warn(`Failed to parse shader parameter: ${r}`,m)}continue}const u=a.match(/^\/\/\s*@viji-cv:(\w+)\s*$/);if(u){const[,l]=u;try{const h={type:"cv",uniformName:l,label:l,default:void 0,config:{}};this.validateParameter(h),s.push(h)}catch(h){console.warn(`Failed to parse shader parameter: ${r}`,h)}}}return this.crossValidateAccumulators(s),s}static parseKeyValuePairs(t){const s={},i=/(\w+):((?:"[^"]*"|\[[^\]]*\]|#[0-9a-fA-F]{6}|#[0-9a-fA-F]{3}|(?:rgb|hsl|hsb|vec3)\s*\([^)]*\)|[^\s]+))/g;let r;for(;(r=i.exec(t))!==null;){const[,a,o]=r;s[a]=this.parseValue(o)}return s}static parseValue(t){if(t.startsWith('"')&&t.endsWith('"'))return t.slice(1,-1);if(t.startsWith("[")&&t.endsWith("]"))try{return JSON.parse(t)}catch{return t.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(t.startsWith("#")||/^(?:rgb|hsl|hsb|vec3)\s*\(/i.test(t))return t;if(t==="true")return true;if(t==="false")return false;const s=parseFloat(t);return isNaN(s)?t:s}static validateParameter(t){if(!t.type)throw new Error("Parameter type is required");if(!t.uniformName)throw new Error("Parameter uniformName is required");switch(t.type){case"slider":case"number":if(t.config.default===void 0)throw new Error(`Parameter ${t.uniformName} of type ${t.type} missing required 'default' key`);break;case"color":if(t.config.default===void 0)throw new Error(`Parameter ${t.uniformName} of type 'color' missing required 'default' key`);try{t.config.default=qn(t.config.default)}catch(s){throw new Error(`Parameter ${t.uniformName} of type 'color' has invalid default: ${s.message}`)}break;case"toggle":if(t.config.default===void 0)throw new Error(`Parameter ${t.uniformName} of type 'toggle' missing required 'default' key`);if(typeof t.config.default!="boolean")throw new Error(`Parameter ${t.uniformName} of type 'toggle' default must be boolean (true or false)`);break;case"select":if(t.config.default===void 0)throw new Error(`Parameter ${t.uniformName} of type 'select' missing required 'default' key`);if(!t.config.options||!Array.isArray(t.config.options))throw new Error(`Parameter ${t.uniformName} of type 'select' missing required 'options' key (array)`);break;case"image":break;case"button":t.config.default!==void 0&&console.warn(`Parameter ${t.uniformName} of type 'button' ignores 'default' — buttons always start as false`);break;case"coordinate":if(t.config.default===void 0)throw new Error(`Parameter ${t.uniformName} of type 'coordinate' missing required 'default' key (e.g., default:[0,0])`);if(!Array.isArray(t.config.default)||t.config.default.length!==2||typeof t.config.default[0]!="number"||typeof t.config.default[1]!="number")throw new Error(`Parameter ${t.uniformName} of type 'coordinate' default must be an array of 2 numbers (e.g., [0,0])`);break;case"accumulator":if(t.config.rate===void 0)throw new Error(`Accumulator '${t.uniformName}' requires a 'rate' config key (parameter name or numeric constant)`);if(typeof t.config.rate!="string"&&typeof t.config.rate!="number")throw new Error(`Accumulator '${t.uniformName}' rate must be a parameter name or numeric constant`);break;case"cv":{if(!Yn.includes(t.uniformName))throw new Error(`Unknown CV feature '${t.uniformName}'. Expected one of: ${Yn.join(", ")}`);if(Object.keys(t.config).length>0){if(t.config.default===void 0)throw new Error(`Toggleable CV directive '${t.uniformName}' missing required 'default' key`);if(typeof t.config.default!="boolean")throw new Error(`Toggleable CV directive '${t.uniformName}' default must be boolean (true or false)`)}break}default:console.warn(`Unknown parameter type: ${t.type}`)}t.uniformName.startsWith("u_")&&console.warn(`Parameter name "${t.uniformName}" uses reserved prefix "u_". Consider renaming to avoid conflicts with built-in uniforms.`)}static generateUniformDeclaration(t){switch(t.type){case"slider":case"number":return`uniform float ${t.uniformName};`;case"color":return`uniform vec3 ${t.uniformName};`;case"toggle":return`uniform bool ${t.uniformName};`;case"select":return`uniform int ${t.uniformName};`;case"image":return`uniform sampler2D ${t.uniformName};`;case"button":return`uniform bool ${t.uniformName};`;case"coordinate":return`uniform vec2 ${t.uniformName};`;case"accumulator":return`uniform float ${t.uniformName}; // accumulator (rate: ${t.config.rate})`;case"cv":return Object.keys(t.config).length>0?`uniform bool ${t.uniformName};`:`// @viji-cv:${t.uniformName} (bare — no uniform)`;default:return`// Unknown parameter type: ${t.type}`}}static crossValidateAccumulators(t){const s=new Set(t.filter(i=>i.type!=="accumulator").map(i=>i.uniformName));for(const i of t){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 mf(e){const t=e.match(/^\s*ERROR:\s*0:(\d+)/m);if(!t)return null;const s=parseInt(t[1],10);return Number.isFinite(s)&&s>0?s:null}class Ke{constructor(t,s,i,r=false){if(this.shaderCode=i,this.redactDriverInfoLogs=r,this.glslVersion=this.detectGLSLVersion(i),this.backbufferEnabled=i.includes("backbuffer"),this.glslVersion==="glsl300"){const a=t.getContext("webgl2");if(!a)throw new Error("WebGL 2 not supported. Use GLSL ES 1.00 syntax instead.");this.gl=a}else{const a=t.getContext("webgl");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(Ke.MAX_DEVICE_VIDEOS).fill(null);accumulatorValues=new Map;accumulatorWarned=new Set;scalarUniformCache=new Map;colorVec3Cache=new Map;colorVec3CacheKey=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=Po.parseParameters(this.shaderCode);for(const i of this.parameters)i.type==="accumulator"&&this.accumulatorValues.set(i.uniformName,i.config.default??0);for(const i of this.parameters){if(i.type!=="cv")continue;const r=i.uniformName,a=Object.keys(i.config).length>0,o={toggleable:a,inFlight:false};a&&(o.paramName=r),this.cvDirectives.set(r,o),(a?!!i.config.default:true)&&this.visibleFeatures.add(r)}this.createFullscreenQuad();const{code:t,artistLineOffset:s}=this.injectUniformsWithOffset(this.shaderCode);this.compileAndLinkShader(t,s),this.cacheUniformLocations(),this.reserveTextureUnits(),this.backbufferEnabled&&this.createBackbufferFramebuffers()}catch(t){throw console.error("Failed to initialize ShaderWorkerAdapter:",t),t}}detectGLSLVersion(t){return t.includes("#version 300")?"glsl300":"glsl100"}createFullscreenQuad(){const t=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,t,this.gl.STATIC_DRAW)}injectUniformsWithOffset(t){const s=this.injectUniforms(t),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(t){let s="",i=t;const r=t.split(`
12
+ `);for(let k=0;k<r.length;k++){const T=r[k].trim();if(T.startsWith("#version")){s=T,r[k]="",i=r.join(`
13
+ `);break}}const a=this.findInjectionPoint(i),o=this.getBuiltInUniforms(),u=this.parameters.map(k=>Po.generateUniformDeclaration(k)).join(`
14
+ `),l=t.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(u),h.push(""),h.push("// ===== ARTIST CODE =====");const p=h.join(`
15
+ `),m=i.slice(0,a)+`
16
+ `+p+`
17
+ `+i.slice(a),_=s?s+`
18
+ `+m:m;return this.redactDriverInfoLogs||(console.log("=== INJECTED SHADER CODE (first 50 lines) ==="),console.log(_.split(`
19
+ `).slice(0,50).join(`
20
+ `)),console.log("=== END INJECTED CODE ===")),_}findInjectionPoint(t){const s=t.split(`
21
+ `);for(let a=0;a<s.length;a++)if(s[a].trim().startsWith("#version"))return this.getLineEndPosition(t,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(t,r-1):0}getLineEndPosition(t,s){const i=t.split(`
22
+ `);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
23
+ uniform vec2 u_resolution; // Canvas width and height in pixels
24
+ uniform float u_time; // Elapsed time in seconds since scene start
25
+ uniform float u_deltaTime; // Time elapsed since last frame in seconds
26
+ uniform int u_frame; // Current frame number
27
+ uniform float u_fps; // Target frame rate (based on host frame-rate mode)
28
+
29
+ // Mouse API
30
+ uniform vec2 u_mouse; // Mouse position in pixels (WebGL coords: bottom-left origin)
31
+ uniform bool u_mouseInCanvas; // True if mouse is inside canvas bounds
32
+ uniform bool u_mousePressed; // True if any mouse button is pressed
33
+ uniform bool u_mouseLeft; // True if left mouse button is pressed
34
+ uniform bool u_mouseRight; // True if right mouse button is pressed
35
+ uniform bool u_mouseMiddle; // True if middle mouse button is pressed
36
+ uniform vec2 u_mouseDelta; // Mouse movement delta in pixels (per frame)
37
+ uniform float u_mouseWheel; // Mouse wheel scroll delta (per frame)
38
+ uniform bool u_mouseWasPressed; // True on the frame a mouse button was pressed
39
+ uniform bool u_mouseWasReleased; // True on the frame a mouse button was released
40
+
41
+ // Keyboard API - Common keys
42
+ uniform bool u_keySpace; // True if spacebar is pressed
43
+ uniform bool u_keyShift; // True if Shift key is pressed
44
+ uniform bool u_keyCtrl; // True if Ctrl/Cmd key is pressed
45
+ uniform bool u_keyAlt; // True if Alt/Option key is pressed
46
+ uniform bool u_keyW; // True if W key is pressed
47
+ uniform bool u_keyA; // True if A key is pressed
48
+ uniform bool u_keyS; // True if S key is pressed
49
+ uniform bool u_keyD; // True if D key is pressed
50
+ uniform bool u_keyUp; // True if Up arrow key is pressed
51
+ uniform bool u_keyDown; // True if Down arrow key is pressed
52
+ uniform bool u_keyLeft; // True if Left arrow key is pressed
53
+ uniform bool u_keyRight; // True if Right arrow key is pressed
54
+
55
+ // Keyboard Texture (Shadertoy-compatible 256x3)
56
+ // Row 0: held state, Row 1: pressed this frame, Row 2: toggle
57
+ uniform sampler2D u_keyboard; // Keyboard state texture (256x3, LUMINANCE)
58
+
59
+ // Touch API
60
+ uniform int u_touchCount; // Number of active touch points (0-5)
61
+ uniform vec2 u_touch0; // First touch point position in pixels
62
+ uniform vec2 u_touch1; // Second touch point position in pixels
63
+ uniform vec2 u_touch2; // Third touch point position in pixels
64
+ uniform vec2 u_touch3; // Fourth touch point position in pixels
65
+ uniform vec2 u_touch4; // Fifth touch point position in pixels
66
+
67
+ // Pointer API (unified mouse/touch)
68
+ uniform vec2 u_pointer; // Primary input position in pixels (WebGL coords)
69
+ uniform vec2 u_pointerDelta; // Primary input movement delta (per frame)
70
+ uniform bool u_pointerDown; // True if primary input is active (left-click or touch)
71
+ uniform bool u_pointerWasPressed; // True on the frame primary input became active
72
+ uniform bool u_pointerWasReleased; // True on the frame primary input was released
73
+ uniform bool u_pointerInCanvas; // True if primary input is inside canvas bounds
74
+
75
+ // Audio - Volume
76
+ uniform float u_audioVolume; // RMS volume level (0-1)
77
+ uniform float u_audioPeak; // Peak amplitude (0-1)
78
+ uniform float u_audioVolumeSmoothed; // Smoothed volume for animation (200ms decay)
79
+
80
+ // Audio - Frequency Bands (instant)
81
+ uniform float u_audioLow; // Low 20-120 Hz (0-1)
82
+ uniform float u_audioLowMid; // Low-mid 120-400 Hz (0-1)
83
+ uniform float u_audioMid; // Mid 400-1600 Hz (0-1)
84
+ uniform float u_audioHighMid; // High-mid 1600-6000 Hz (0-1)
85
+ uniform float u_audioHigh; // High 6000-16000 Hz (0-1)
86
+
87
+ // Audio - Frequency Bands (smoothed, 150ms decay)
88
+ uniform float u_audioLowSmoothed; // Smoothed low band (0-1)
89
+ uniform float u_audioLowMidSmoothed; // Smoothed low-mid band (0-1)
90
+ uniform float u_audioMidSmoothed; // Smoothed mid band (0-1)
91
+ uniform float u_audioHighMidSmoothed; // Smoothed high-mid band (0-1)
92
+ uniform float u_audioHighSmoothed; // Smoothed high band (0-1)
93
+
94
+ // Audio - Beat Energy (fast 300ms decay)
95
+ uniform float u_audioKick; // Kick energy (0-1)
96
+ uniform float u_audioSnare; // Snare energy (0-1)
97
+ uniform float u_audioHat; // Hi-hat energy (0-1)
98
+ uniform float u_audioAny; // Any beat energy (0-1)
99
+
100
+ // Audio - Beat Energy (smoothed 500ms decay)
101
+ uniform float u_audioKickSmoothed; // Smoothed kick energy (0-1)
102
+ uniform float u_audioSnareSmoothed; // Smoothed snare energy (0-1)
103
+ uniform float u_audioHatSmoothed; // Smoothed hi-hat energy (0-1)
104
+ uniform float u_audioAnySmoothed; // Smoothed any-beat energy (0-1)
105
+
106
+ // Audio - Beat Triggers (true for one frame on beat)
107
+ uniform bool u_audioKickTrigger; // True on kick beat frame
108
+ uniform bool u_audioSnareTrigger; // True on snare beat frame
109
+ uniform bool u_audioHatTrigger; // True on hi-hat beat frame
110
+ uniform bool u_audioAnyTrigger; // True on any beat frame
111
+
112
+ // Audio - Tempo & Tracking
113
+ uniform float u_audioBPM; // Current BPM (60-240)
114
+ uniform float u_audioConfidence; // Beat tracking confidence (0-1)
115
+ uniform bool u_audioIsLocked; // True when beat tracking is locked
116
+
117
+ // Audio - Spectral Features
118
+ uniform float u_audioBrightness; // Spectral brightness / centroid (0-1)
119
+ uniform float u_audioFlatness; // Spectral flatness / noisiness (0-1)
120
+
121
+ // Audio - Textures
122
+ uniform sampler2D u_audioFFT; // FFT frequency spectrum (1024 bins, 0-255)
123
+ uniform sampler2D u_audioWaveform; // Time-domain waveform (fftSize samples, -1 to 1)
124
+
125
+ // Video
126
+ uniform sampler2D u_video; // Current video frame as texture
127
+ uniform vec2 u_videoResolution; // Video frame width and height in pixels
128
+ uniform float u_videoFrameRate; // Video frame rate in frames per second
129
+ uniform sampler2D u_videoAnalysed; // The exact frame MediaPipe analysed; pair with u_face*/u_hand*/u_pose* uniforms for pixel-precise CV-driven effects (face mesh masks, segmentation overlays). Shares u_videoResolution.
130
+ uniform bool u_videoAnalysedAvailable; // True after the first CV result lands; before that, u_videoAnalysed samples a 1x1 black fallback. Use to gate effects that require valid analysed pixels.
131
+
132
+ // Multi-Stream Compositor Support (using individual uniforms due to WebGL 1.0 limitations)
133
+ uniform int u_videoStreamCount; // Number of available compositor input streams (0-8)
134
+ uniform sampler2D u_videoStream0; // Video stream 0 texture
135
+ uniform sampler2D u_videoStream1; // Video stream 1 texture
136
+ uniform sampler2D u_videoStream2; // Video stream 2 texture
137
+ uniform sampler2D u_videoStream3; // Video stream 3 texture
138
+ uniform sampler2D u_videoStream4; // Video stream 4 texture
139
+ uniform sampler2D u_videoStream5; // Video stream 5 texture
140
+ uniform sampler2D u_videoStream6; // Video stream 6 texture
141
+ uniform sampler2D u_videoStream7; // Video stream 7 texture
142
+ uniform vec2 u_videoStream0Resolution; // Video stream 0 resolution
143
+ uniform vec2 u_videoStream1Resolution; // Video stream 1 resolution
144
+ uniform vec2 u_videoStream2Resolution; // Video stream 2 resolution
145
+ uniform vec2 u_videoStream3Resolution; // Video stream 3 resolution
146
+ uniform vec2 u_videoStream4Resolution; // Video stream 4 resolution
147
+ uniform vec2 u_videoStream5Resolution; // Video stream 5 resolution
148
+ uniform vec2 u_videoStream6Resolution; // Video stream 6 resolution
149
+ uniform vec2 u_videoStream7Resolution; // Video stream 7 resolution
150
+ uniform bool u_videoStream0Connected; // Video stream 0 connection status
151
+ uniform bool u_videoStream1Connected; // Video stream 1 connection status
152
+ uniform bool u_videoStream2Connected; // Video stream 2 connection status
153
+ uniform bool u_videoStream3Connected; // Video stream 3 connection status
154
+ uniform bool u_videoStream4Connected; // Video stream 4 connection status
155
+ uniform bool u_videoStream5Connected; // Video stream 5 connection status
156
+ uniform bool u_videoStream6Connected; // Video stream 6 connection status
157
+ uniform bool u_videoStream7Connected; // Video stream 7 connection status
158
+
159
+ // Device Video Support (device cameras)
160
+ uniform int u_deviceCount; // Number of device videos (0-8)
161
+ uniform sampler2D u_device0; // Device 0 camera texture
162
+ uniform sampler2D u_device1; // Device 1 camera texture
163
+ uniform sampler2D u_device2; // Device 2 camera texture
164
+ uniform sampler2D u_device3; // Device 3 camera texture
165
+ uniform sampler2D u_device4; // Device 4 camera texture
166
+ uniform sampler2D u_device5; // Device 5 camera texture
167
+ uniform sampler2D u_device6; // Device 6 camera texture
168
+ uniform sampler2D u_device7; // Device 7 camera texture
169
+ uniform vec2 u_device0Resolution; // Device 0 resolution
170
+ uniform vec2 u_device1Resolution; // Device 1 resolution
171
+ uniform vec2 u_device2Resolution; // Device 2 resolution
172
+ uniform vec2 u_device3Resolution; // Device 3 resolution
173
+ uniform vec2 u_device4Resolution; // Device 4 resolution
174
+ uniform vec2 u_device5Resolution; // Device 5 resolution
175
+ uniform vec2 u_device6Resolution; // Device 6 resolution
176
+ uniform vec2 u_device7Resolution; // Device 7 resolution
177
+ uniform bool u_device0Connected; // Device 0 connection status
178
+ uniform bool u_device1Connected; // Device 1 connection status
179
+ uniform bool u_device2Connected; // Device 2 connection status
180
+ uniform bool u_device3Connected; // Device 3 connection status
181
+ uniform bool u_device4Connected; // Device 4 connection status
182
+ uniform bool u_device5Connected; // Device 5 connection status
183
+ uniform bool u_device6Connected; // Device 6 connection status
184
+ uniform bool u_device7Connected; // Device 7 connection status
185
+
186
+ // Additional Audio Streams (lightweight analysis, no beat/FFT)
187
+ uniform int u_audioStreamCount; // Number of additional audio streams (0-8)
188
+ uniform bool u_audioStream0Connected; // Stream 0 connection status
189
+ uniform float u_audioStream0Volume; // Stream 0 volume (0-1)
190
+ uniform float u_audioStream0Low; // Stream 0 low band (0-1)
191
+ uniform float u_audioStream0LowMid; // Stream 0 low-mid band (0-1)
192
+ uniform float u_audioStream0Mid; // Stream 0 mid band (0-1)
193
+ uniform float u_audioStream0HighMid; // Stream 0 high-mid band (0-1)
194
+ uniform float u_audioStream0High; // Stream 0 high band (0-1)
195
+ uniform float u_audioStream0Brightness; // Stream 0 spectral brightness (0-1)
196
+ uniform float u_audioStream0Flatness; // Stream 0 spectral flatness (0-1)
197
+ uniform bool u_audioStream1Connected;
198
+ uniform float u_audioStream1Volume;
199
+ uniform float u_audioStream1Low;
200
+ uniform float u_audioStream1LowMid;
201
+ uniform float u_audioStream1Mid;
202
+ uniform float u_audioStream1HighMid;
203
+ uniform float u_audioStream1High;
204
+ uniform float u_audioStream1Brightness;
205
+ uniform float u_audioStream1Flatness;
206
+ uniform bool u_audioStream2Connected;
207
+ uniform float u_audioStream2Volume;
208
+ uniform float u_audioStream2Low;
209
+ uniform float u_audioStream2LowMid;
210
+ uniform float u_audioStream2Mid;
211
+ uniform float u_audioStream2HighMid;
212
+ uniform float u_audioStream2High;
213
+ uniform float u_audioStream2Brightness;
214
+ uniform float u_audioStream2Flatness;
215
+ uniform bool u_audioStream3Connected;
216
+ uniform float u_audioStream3Volume;
217
+ uniform float u_audioStream3Low;
218
+ uniform float u_audioStream3LowMid;
219
+ uniform float u_audioStream3Mid;
220
+ uniform float u_audioStream3HighMid;
221
+ uniform float u_audioStream3High;
222
+ uniform float u_audioStream3Brightness;
223
+ uniform float u_audioStream3Flatness;
224
+ uniform bool u_audioStream4Connected;
225
+ uniform float u_audioStream4Volume;
226
+ uniform float u_audioStream4Low;
227
+ uniform float u_audioStream4LowMid;
228
+ uniform float u_audioStream4Mid;
229
+ uniform float u_audioStream4HighMid;
230
+ uniform float u_audioStream4High;
231
+ uniform float u_audioStream4Brightness;
232
+ uniform float u_audioStream4Flatness;
233
+ uniform bool u_audioStream5Connected;
234
+ uniform float u_audioStream5Volume;
235
+ uniform float u_audioStream5Low;
236
+ uniform float u_audioStream5LowMid;
237
+ uniform float u_audioStream5Mid;
238
+ uniform float u_audioStream5HighMid;
239
+ uniform float u_audioStream5High;
240
+ uniform float u_audioStream5Brightness;
241
+ uniform float u_audioStream5Flatness;
242
+ uniform bool u_audioStream6Connected;
243
+ uniform float u_audioStream6Volume;
244
+ uniform float u_audioStream6Low;
245
+ uniform float u_audioStream6LowMid;
246
+ uniform float u_audioStream6Mid;
247
+ uniform float u_audioStream6HighMid;
248
+ uniform float u_audioStream6High;
249
+ uniform float u_audioStream6Brightness;
250
+ uniform float u_audioStream6Flatness;
251
+ uniform bool u_audioStream7Connected;
252
+ uniform float u_audioStream7Volume;
253
+ uniform float u_audioStream7Low;
254
+ uniform float u_audioStream7LowMid;
255
+ uniform float u_audioStream7Mid;
256
+ uniform float u_audioStream7HighMid;
257
+ uniform float u_audioStream7High;
258
+ uniform float u_audioStream7Brightness;
259
+ uniform float u_audioStream7Flatness;
260
+
261
+ // CV - Face Detection & Expressions
262
+ uniform int u_faceCount; // Number of detected faces (0-1)
263
+ uniform vec4 u_face0Bounds; // First face bounding box (x, y, width, height) normalized 0-1
264
+ uniform vec2 u_face0Center; // First face bounding box center (x, y) normalized 0-1
265
+ uniform vec3 u_face0HeadPose; // First face head rotation (pitch, yaw, roll) in degrees
266
+ uniform float u_face0Confidence; // First face detection confidence (0-1)
267
+ uniform float u_face0Neutral; // First face neutral expression (0-1)
268
+ uniform float u_face0Happy; // First face happy expression (0-1)
269
+ uniform float u_face0Sad; // First face sad expression (0-1)
270
+ uniform float u_face0Angry; // First face angry expression (0-1)
271
+ uniform float u_face0Surprised; // First face surprised expression (0-1)
272
+ uniform float u_face0Disgusted; // First face disgusted expression (0-1)
273
+ uniform float u_face0Fearful; // First face fearful expression (0-1)
274
+
275
+ // CV - Face Blendshapes (52 ARKit-compatible coefficients, 0-1 each)
276
+ // Brow
277
+ uniform float u_face0BrowDownLeft;
278
+ uniform float u_face0BrowDownRight;
279
+ uniform float u_face0BrowInnerUp;
280
+ uniform float u_face0BrowOuterUpLeft;
281
+ uniform float u_face0BrowOuterUpRight;
282
+ // Cheek
283
+ uniform float u_face0CheekPuff;
284
+ uniform float u_face0CheekSquintLeft;
285
+ uniform float u_face0CheekSquintRight;
286
+ // Eye
287
+ uniform float u_face0EyeBlinkLeft;
288
+ uniform float u_face0EyeBlinkRight;
289
+ uniform float u_face0EyeLookDownLeft;
290
+ uniform float u_face0EyeLookDownRight;
291
+ uniform float u_face0EyeLookInLeft;
292
+ uniform float u_face0EyeLookInRight;
293
+ uniform float u_face0EyeLookOutLeft;
294
+ uniform float u_face0EyeLookOutRight;
295
+ uniform float u_face0EyeLookUpLeft;
296
+ uniform float u_face0EyeLookUpRight;
297
+ uniform float u_face0EyeSquintLeft;
298
+ uniform float u_face0EyeSquintRight;
299
+ uniform float u_face0EyeWideLeft;
300
+ uniform float u_face0EyeWideRight;
301
+ // Jaw
302
+ uniform float u_face0JawForward;
303
+ uniform float u_face0JawLeft;
304
+ uniform float u_face0JawOpen;
305
+ uniform float u_face0JawRight;
306
+ // Mouth
307
+ uniform float u_face0MouthClose;
308
+ uniform float u_face0MouthDimpleLeft;
309
+ uniform float u_face0MouthDimpleRight;
310
+ uniform float u_face0MouthFrownLeft;
311
+ uniform float u_face0MouthFrownRight;
312
+ uniform float u_face0MouthFunnel;
313
+ uniform float u_face0MouthLeft;
314
+ uniform float u_face0MouthLowerDownLeft;
315
+ uniform float u_face0MouthLowerDownRight;
316
+ uniform float u_face0MouthPressLeft;
317
+ uniform float u_face0MouthPressRight;
318
+ uniform float u_face0MouthPucker;
319
+ uniform float u_face0MouthRight;
320
+ uniform float u_face0MouthRollLower;
321
+ uniform float u_face0MouthRollUpper;
322
+ uniform float u_face0MouthShrugLower;
323
+ uniform float u_face0MouthShrugUpper;
324
+ uniform float u_face0MouthSmileLeft;
325
+ uniform float u_face0MouthSmileRight;
326
+ uniform float u_face0MouthStretchLeft;
327
+ uniform float u_face0MouthStretchRight;
328
+ uniform float u_face0MouthUpperUpLeft;
329
+ uniform float u_face0MouthUpperUpRight;
330
+ // Nose & Tongue
331
+ uniform float u_face0NoseSneerLeft;
332
+ uniform float u_face0NoseSneerRight;
333
+ uniform float u_face0TongueOut;
334
+
335
+ // CV - Hand Tracking
336
+ uniform int u_handCount; // Number of detected hands (0-2)
337
+ uniform vec3 u_leftHandPalm; // Left hand palm position (x, y, z)
338
+ uniform vec3 u_rightHandPalm; // Right hand palm position (x, y, z)
339
+ uniform float u_leftHandConfidence; // Left hand detection confidence (0-1)
340
+ uniform float u_rightHandConfidence; // Right hand detection confidence (0-1)
341
+ uniform vec4 u_leftHandBounds; // Left hand bounding box (x, y, width, height) normalized 0-1
342
+ uniform vec4 u_rightHandBounds; // Right hand bounding box (x, y, width, height) normalized 0-1
343
+ uniform float u_leftHandFist; // Left hand fist gesture confidence (0-1)
344
+ uniform float u_leftHandOpen; // Left hand open palm gesture confidence (0-1)
345
+ uniform float u_leftHandPeace; // Left hand peace/victory gesture confidence (0-1)
346
+ uniform float u_leftHandThumbsUp; // Left hand thumbs up gesture confidence (0-1)
347
+ uniform float u_leftHandThumbsDown; // Left hand thumbs down gesture confidence (0-1)
348
+ uniform float u_leftHandPointing; // Left hand pointing gesture confidence (0-1)
349
+ uniform float u_leftHandILoveYou; // Left hand I-love-you gesture confidence (0-1)
350
+ uniform float u_rightHandFist; // Right hand fist gesture confidence (0-1)
351
+ uniform float u_rightHandOpen; // Right hand open palm gesture confidence (0-1)
352
+ uniform float u_rightHandPeace; // Right hand peace/victory gesture confidence (0-1)
353
+ uniform float u_rightHandThumbsUp; // Right hand thumbs up gesture confidence (0-1)
354
+ uniform float u_rightHandThumbsDown; // Right hand thumbs down gesture confidence (0-1)
355
+ uniform float u_rightHandPointing; // Right hand pointing gesture confidence (0-1)
356
+ uniform float u_rightHandILoveYou; // Right hand I-love-you gesture confidence (0-1)
357
+
358
+ // CV - Pose Detection
359
+ uniform bool u_poseDetected; // True if a pose is currently detected
360
+ uniform float u_poseConfidence; // Pose detection confidence (0-1)
361
+ uniform vec2 u_nosePosition; // Nose landmark position (normalized 0-1)
362
+ uniform vec2 u_leftShoulderPosition; // Left shoulder position (normalized 0-1)
363
+ uniform vec2 u_rightShoulderPosition; // Right shoulder position (normalized 0-1)
364
+ uniform vec2 u_leftElbowPosition; // Left elbow position (normalized 0-1)
365
+ uniform vec2 u_rightElbowPosition; // Right elbow position (normalized 0-1)
366
+ uniform vec2 u_leftWristPosition; // Left wrist position (normalized 0-1)
367
+ uniform vec2 u_rightWristPosition; // Right wrist position (normalized 0-1)
368
+ uniform vec2 u_leftHipPosition; // Left hip position (normalized 0-1)
369
+ uniform vec2 u_rightHipPosition; // Right hip position (normalized 0-1)
370
+ uniform vec2 u_leftKneePosition; // Left knee position (normalized 0-1)
371
+ uniform vec2 u_rightKneePosition; // Right knee position (normalized 0-1)
372
+ uniform vec2 u_leftAnklePosition; // Left ankle position (normalized 0-1)
373
+ uniform vec2 u_rightAnklePosition; // Right ankle position (normalized 0-1)
374
+
375
+ // CV - Segmentation
376
+ uniform sampler2D u_segmentationMask; // Body segmentation mask texture (0=background, 1=person)
377
+ uniform vec2 u_segmentationRes; // Segmentation mask resolution in pixels
378
+
379
+ // Device Sensors - Internal Device (viji.device)
380
+ uniform vec3 u_deviceAcceleration; // Acceleration without gravity (m/s²) - x, y, z
381
+ uniform vec3 u_deviceAccelerationGravity; // Acceleration with gravity (m/s²) - x, y, z
382
+ uniform vec3 u_deviceRotationRate; // Rotation rate (deg/s) - alpha, beta, gamma
383
+ uniform vec3 u_deviceOrientation; // Device orientation (degrees) - alpha, beta, gamma
384
+ uniform bool u_deviceOrientationAbsolute; // True if orientation uses magnetometer (compass)
385
+
386
+ // Device Sensors - External Devices (viji.devices[0-7])
387
+ uniform int u_externalDeviceCount; // Number of connected external devices (0-8)
388
+ uniform vec3 u_device0Acceleration; // Device 0 acceleration without gravity (m/s²)
389
+ uniform vec3 u_device0AccelerationGravity; // Device 0 acceleration with gravity (m/s²)
390
+ uniform vec3 u_device0RotationRate; // Device 0 rotation rate (deg/s)
391
+ uniform vec3 u_device0Orientation; // Device 0 orientation (degrees) - alpha, beta, gamma
392
+ uniform vec3 u_device1Acceleration; // Device 1 acceleration without gravity (m/s²)
393
+ uniform vec3 u_device1AccelerationGravity; // Device 1 acceleration with gravity (m/s²)
394
+ uniform vec3 u_device1RotationRate; // Device 1 rotation rate (deg/s)
395
+ uniform vec3 u_device1Orientation; // Device 1 orientation (degrees) - alpha, beta, gamma
396
+ uniform vec3 u_device2Acceleration; // Device 2 acceleration without gravity (m/s²)
397
+ uniform vec3 u_device2AccelerationGravity; // Device 2 acceleration with gravity (m/s²)
398
+ uniform vec3 u_device2RotationRate; // Device 2 rotation rate (deg/s)
399
+ uniform vec3 u_device2Orientation; // Device 2 orientation (degrees) - alpha, beta, gamma
400
+ uniform vec3 u_device3Acceleration; // Device 3 acceleration without gravity (m/s²)
401
+ uniform vec3 u_device3AccelerationGravity; // Device 3 acceleration with gravity (m/s²)
402
+ uniform vec3 u_device3RotationRate; // Device 3 rotation rate (deg/s)
403
+ uniform vec3 u_device3Orientation; // Device 3 orientation (degrees) - alpha, beta, gamma
404
+ uniform vec3 u_device4Acceleration; // Device 4 acceleration without gravity (m/s²)
405
+ uniform vec3 u_device4AccelerationGravity; // Device 4 acceleration with gravity (m/s²)
406
+ uniform vec3 u_device4RotationRate; // Device 4 rotation rate (deg/s)
407
+ uniform vec3 u_device4Orientation; // Device 4 orientation (degrees) - alpha, beta, gamma
408
+ uniform vec3 u_device5Acceleration; // Device 5 acceleration without gravity (m/s²)
409
+ uniform vec3 u_device5AccelerationGravity; // Device 5 acceleration with gravity (m/s²)
410
+ uniform vec3 u_device5RotationRate; // Device 5 rotation rate (deg/s)
411
+ uniform vec3 u_device5Orientation; // Device 5 orientation (degrees) - alpha, beta, gamma
412
+ uniform vec3 u_device6Acceleration; // Device 6 acceleration without gravity (m/s²)
413
+ uniform vec3 u_device6AccelerationGravity; // Device 6 acceleration with gravity (m/s²)
414
+ uniform vec3 u_device6RotationRate; // Device 6 rotation rate (deg/s)
415
+ uniform vec3 u_device6Orientation; // Device 6 orientation (degrees) - alpha, beta, gamma
416
+ uniform vec3 u_device7Acceleration; // Device 7 acceleration without gravity (m/s²)
417
+ uniform vec3 u_device7AccelerationGravity; // Device 7 acceleration with gravity (m/s²)
418
+ uniform vec3 u_device7RotationRate; // Device 7 rotation rate (deg/s)
419
+ uniform vec3 u_device7Orientation; // Device 7 orientation (degrees) - alpha, beta, gamma
420
+
421
+ // Backbuffer (previous frame feedback)
422
+ ${this.backbufferEnabled?"uniform sampler2D backbuffer; // Previous frame texture for feedback effects":"// backbuffer not enabled"}
423
+ `}compileAndLinkShader(t,s=0){const i=this.gl,r=this.glslVersion==="glsl300"?`#version 300 es
424
+ precision mediump float;
425
+ in vec2 a_position;
426
+ void main() {
427
+ gl_Position = vec4(a_position, 0.0, 1.0);
428
+ }`:`attribute vec2 a_position;
429
+ void main() {
430
+ gl_Position = vec4(a_position, 0.0, 1.0);
431
+ }`,a=this.compileShader(i.VERTEX_SHADER,r,0),o=this.compileShader(i.FRAGMENT_SHADER,t,s),u=i.createProgram();if(!u)throw new Error("Failed to create WebGL program");if(i.attachShader(u,a),i.attachShader(u,o),i.linkProgram(u),!i.getProgramParameter(u,i.LINK_STATUS)){const l=this.redactDriverInfoLogs?"(diagnostics unavailable)":i.getProgramInfoLog(u);throw new Error(`Shader program link failed: ${l}`)}this.program=u,i.useProgram(u),i.deleteShader(a),i.deleteShader(o)}compileShader(t,s,i=0){const r=this.gl,a=r.createShader(t);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),u=t===r.VERTEX_SHADER?"vertex":"fragment",l=this.redactDriverInfoLogs?"(diagnostics unavailable)":o,h=new Error(`${u} shader compilation failed:
432
+ ${l}`);if(t===r.FRAGMENT_SHADER){h.__isShaderCompileError=true;const p=mf(o||"");if(p!==null){const m=p-i;m>=1&&(h.__sourceLocation={line:m})}}throw h}return a}cacheUniformLocations(){if(!this.program)return;const t=this.gl,s=t.getProgramParameter(this.program,t.ACTIVE_UNIFORMS),i=[];for(let r=0;r<s;r++){const a=t.getActiveUniform(this.program,r);if(a){const o=t.getUniformLocation(this.program,a.name);this.uniformLocations.set(a.name,o),(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!")}reserveTextureUnits(){this.textureUnits.set("u_audioFFT",this.nextTextureUnit++),this.textureUnits.set("u_audioWaveform",this.nextTextureUnit++),this.textureUnits.set("u_video",this.nextTextureUnit++),this.textureUnits.set("u_videoAnalysed",this.nextTextureUnit++),this.textureUnits.set("u_segmentationMask",this.nextTextureUnit++),this.textureUnits.set("u_keyboard",this.nextTextureUnit++);for(let t=0;t<Ke.MAX_VIDEO_STREAMS;t++)this.textureUnits.set(`u_videoStream${t}`,this.nextTextureUnit++);for(let t=0;t<Ke.MAX_DEVICE_VIDEOS;t++)this.textureUnits.set(`u_device${t}`,this.nextTextureUnit++);this.backbufferEnabled&&this.textureUnits.set("backbuffer",this.nextTextureUnit++)}createBackbufferFramebuffers(){const t=this.gl,s=t.canvas.width,i=t.canvas.height,r=()=>{const u=t.createTexture();t.bindTexture(t.TEXTURE_2D,u),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,s,i,0,t.RGBA,t.UNSIGNED_BYTE,null),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);const l=t.createFramebuffer();return t.bindFramebuffer(t.FRAMEBUFFER,l),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,u,0),{framebuffer:l,texture:u}},a=r(),o=r();this.backbufferFramebuffer=a.framebuffer,this.backbufferTexture=a.texture,this.currentFramebuffer=o.framebuffer,this.currentTexture=o.texture,t.bindFramebuffer(t.FRAMEBUFFER,null),t.bindTexture(t.TEXTURE_2D,null)}render(t,s){const i=this.gl;if(!this.program||!this.quadBuffer)return console.warn("Shader not initialized"),false;if(i.useProgram(this.program),this.syncCvVisibility(t,s),this.updateBuiltInUniforms(t),this.updateAccumulators(t,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(t,s){if(!t.video?.isConnected)return;const i=t.video.cv,r=typeof i.getActiveFeatures=="function"?i.getActiveFeatures():[];for(const[a,o]of this.cvDirectives){let u;if(o.toggleable&&o.paramName){const h=s.get(o.paramName);if(!h)continue;u=h.value===true}else u=true;u?this.visibleFeatures.add(a):this.visibleFeatures.delete(a);const l=r.includes(a);if(u===l){o.lastValue=u;continue}if(o.inFlight){o.pendingValue=u;continue}this.dispatchCvEnable(i,a,u,o)}for(const a of Yn)this.cvDirectives.has(a)||(r.includes(a)?this.visibleFeatures.add(a):this.visibleFeatures.delete(a))}dispatchCvEnable(t,s,i,r){const a=`enable${s.charAt(0).toUpperCase()}${s.slice(1)}`,o=t[a];typeof o=="function"&&(r.inFlight=true,r.lastValue=i,Promise.resolve(o.call(t,i)).catch(u=>{console.warn(`[ShaderAdapter] ${a}(${i}) failed:`,u)}).finally(()=>{this.destroyed||(r.inFlight=false,delete r.pendingValue)}))}updateBuiltInUniforms(t){this.setUniform("u_resolution","vec2",[t.width,t.height]),this.setUniform("u_time","float",t.time),this.setUniform("u_deltaTime","float",t.deltaTime),this.setUniform("u_frame","int",t.frameCount),this.setUniform("u_fps","float",t.fps),this.setUniform("u_mouse","vec2",[t.mouse.x,t.height-t.mouse.y]),this.setUniform("u_mouseInCanvas","bool",t.mouse.isInCanvas),this.setUniform("u_mousePressed","bool",t.mouse.isPressed),this.setUniform("u_mouseLeft","bool",t.mouse.leftButton),this.setUniform("u_mouseRight","bool",t.mouse.rightButton),this.setUniform("u_mouseMiddle","bool",t.mouse.middleButton),this.setUniform("u_mouseDelta","vec2",[t.mouse.deltaX,-t.mouse.deltaY]),this.setUniform("u_mouseWheel","float",t.mouse.wheelDelta),this.setUniform("u_mouseWasPressed","bool",t.mouse.wasPressed),this.setUniform("u_mouseWasReleased","bool",t.mouse.wasReleased),this.setUniform("u_keySpace","bool",t.keyboard.isPressed(" ")||t.keyboard.isPressed("space")),this.setUniform("u_keyShift","bool",t.keyboard.shift),this.setUniform("u_keyCtrl","bool",t.keyboard.ctrl),this.setUniform("u_keyAlt","bool",t.keyboard.alt),this.setUniform("u_keyW","bool",t.keyboard.isPressed("w")||t.keyboard.isPressed("W")),this.setUniform("u_keyA","bool",t.keyboard.isPressed("a")||t.keyboard.isPressed("A")),this.setUniform("u_keyS","bool",t.keyboard.isPressed("s")||t.keyboard.isPressed("S")),this.setUniform("u_keyD","bool",t.keyboard.isPressed("d")||t.keyboard.isPressed("D")),this.setUniform("u_keyUp","bool",t.keyboard.isPressed("ArrowUp")),this.setUniform("u_keyDown","bool",t.keyboard.isPressed("ArrowDown")),this.setUniform("u_keyLeft","bool",t.keyboard.isPressed("ArrowLeft")),this.setUniform("u_keyRight","bool",t.keyboard.isPressed("ArrowRight")),t.keyboard.textureData&&this.updateKeyboardTexture(t.keyboard.textureData),this.setUniform("u_touchCount","int",t.touches.count);for(let x=0;x<5;x++){const b=t.touches.points[x];b?this.setUniform(`u_touch${x}`,"vec2",[b.x,t.height-b.y]):this.setUniform(`u_touch${x}`,"vec2",[0,0])}this.setUniform("u_pointer","vec2",[t.pointer.x,t.height-t.pointer.y]),this.setUniform("u_pointerDelta","vec2",[t.pointer.deltaX,-t.pointer.deltaY]),this.setUniform("u_pointerDown","bool",t.pointer.isDown),this.setUniform("u_pointerWasPressed","bool",t.pointer.wasPressed),this.setUniform("u_pointerWasReleased","bool",t.pointer.wasReleased),this.setUniform("u_pointerInCanvas","bool",t.pointer.isInCanvas);const s=t.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 x=s.getWaveform();x.length>0&&this.updateAudioWaveformTexture(x)}const i=t.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=t.videoStreams||[],a=Math.min(r.length,Ke.MAX_VIDEO_STREAMS);this.setUniform("u_videoStreamCount","int",a);for(let x=0;x<Ke.MAX_VIDEO_STREAMS;x++){const b=`u_videoStream${x}Connected`,v=`u_videoStream${x}Resolution`;x<a&&r[x]?.isConnected&&r[x]?.currentFrame?(this.updateVideoStreamTexture(x,r[x].currentFrame),this.setUniform(v,"vec2",[r[x].frameWidth,r[x].frameHeight]),this.setUniform(b,"bool",true)):(this.setUniform(v,"vec2",[0,0]),this.setUniform(b,"bool",false))}const o=t.devices||[],u=Math.min(o.length,Ke.MAX_DEVICE_VIDEOS);this.setUniform("u_deviceCount","int",u);for(let x=0;x<Ke.MAX_DEVICE_VIDEOS;x++){const b=`u_device${x}Connected`,v=`u_device${x}Resolution`;x<u&&o[x]?.video?.isConnected&&o[x].video.currentFrame?(this.updateDeviceTexture(x,o[x].video.currentFrame),this.setUniform(v,"vec2",[o[x].video.frameWidth,o[x].video.frameHeight]),this.setUniform(b,"bool",true)):(this.setUniform(v,"vec2",[0,0]),this.setUniform(b,"bool",false))}const l=t.audioStreams||[],h=Math.min(l.length,Ke.MAX_AUDIO_STREAMS);this.setUniform("u_audioStreamCount","int",h);for(let x=0;x<Ke.MAX_AUDIO_STREAMS;x++){const b=`u_audioStream${x}`;if(x<h&&l[x]?.isConnected){const v=l[x];this.setUniform(`${b}Connected`,"bool",true),this.setUniform(`${b}Volume`,"float",v.volume?.current||0),this.setUniform(`${b}Low`,"float",v.bands?.low||0),this.setUniform(`${b}LowMid`,"float",v.bands?.lowMid||0),this.setUniform(`${b}Mid`,"float",v.bands?.mid||0),this.setUniform(`${b}HighMid`,"float",v.bands?.highMid||0),this.setUniform(`${b}High`,"float",v.bands?.high||0),this.setUniform(`${b}Brightness`,"float",v.spectral?.brightness||0),this.setUniform(`${b}Flatness`,"float",v.spectral?.flatness||0)}else this.setUniform(`${b}Connected`,"bool",false),this.setUniform(`${b}Volume`,"float",0),this.setUniform(`${b}Low`,"float",0),this.setUniform(`${b}LowMid`,"float",0),this.setUniform(`${b}Mid`,"float",0),this.setUniform(`${b}HighMid`,"float",0),this.setUniform(`${b}High`,"float",0),this.setUniform(`${b}Brightness`,"float",0),this.setUniform(`${b}Flatness`,"float",0)}const p=i.cv?.faces||[],m=p[0],_=this.visibleFeatures.has("faceDetection")&&!!m,k=this.visibleFeatures.has("faceMesh")&&!!m,T=this.visibleFeatures.has("emotionDetection")&&!!m;if(this.setUniform("u_faceCount","int",this.visibleFeatures.has("faceDetection")?p.length:0),_){const x=m.bounds,b=m.center?.x||0,v=m.center?.y||0;this.setUniform("u_face0Bounds","vec4",[x?.x||0,1-(x?.y||0)-(x?.height||0),x?.width||0,x?.height||0]),this.setUniform("u_face0Center","vec2",[b,1-v]),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(k){const x=m.headPose||{};this.setUniform("u_face0HeadPose","vec3",[x.pitch||0,x.yaw||0,-(x.roll||0)])}else this.setUniform("u_face0HeadPose","vec3",[0,0,0]);if(T){const x=m.expressions||{},b=m.blendshapes||{};this.setUniform("u_face0Neutral","float",x.neutral||0),this.setUniform("u_face0Happy","float",x.happy||0),this.setUniform("u_face0Sad","float",x.sad||0),this.setUniform("u_face0Angry","float",x.angry||0),this.setUniform("u_face0Surprised","float",x.surprised||0),this.setUniform("u_face0Disgusted","float",x.disgusted||0),this.setUniform("u_face0Fearful","float",x.fearful||0),this.setUniform("u_face0BrowDownLeft","float",b.browDownLeft||0),this.setUniform("u_face0BrowDownRight","float",b.browDownRight||0),this.setUniform("u_face0BrowInnerUp","float",b.browInnerUp||0),this.setUniform("u_face0BrowOuterUpLeft","float",b.browOuterUpLeft||0),this.setUniform("u_face0BrowOuterUpRight","float",b.browOuterUpRight||0),this.setUniform("u_face0CheekPuff","float",b.cheekPuff||0),this.setUniform("u_face0CheekSquintLeft","float",b.cheekSquintLeft||0),this.setUniform("u_face0CheekSquintRight","float",b.cheekSquintRight||0),this.setUniform("u_face0EyeBlinkLeft","float",b.eyeBlinkLeft||0),this.setUniform("u_face0EyeBlinkRight","float",b.eyeBlinkRight||0),this.setUniform("u_face0EyeLookDownLeft","float",b.eyeLookDownLeft||0),this.setUniform("u_face0EyeLookDownRight","float",b.eyeLookDownRight||0),this.setUniform("u_face0EyeLookInLeft","float",b.eyeLookInLeft||0),this.setUniform("u_face0EyeLookInRight","float",b.eyeLookInRight||0),this.setUniform("u_face0EyeLookOutLeft","float",b.eyeLookOutLeft||0),this.setUniform("u_face0EyeLookOutRight","float",b.eyeLookOutRight||0),this.setUniform("u_face0EyeLookUpLeft","float",b.eyeLookUpLeft||0),this.setUniform("u_face0EyeLookUpRight","float",b.eyeLookUpRight||0),this.setUniform("u_face0EyeSquintLeft","float",b.eyeSquintLeft||0),this.setUniform("u_face0EyeSquintRight","float",b.eyeSquintRight||0),this.setUniform("u_face0EyeWideLeft","float",b.eyeWideLeft||0),this.setUniform("u_face0EyeWideRight","float",b.eyeWideRight||0),this.setUniform("u_face0JawForward","float",b.jawForward||0),this.setUniform("u_face0JawLeft","float",b.jawLeft||0),this.setUniform("u_face0JawOpen","float",b.jawOpen||0),this.setUniform("u_face0JawRight","float",b.jawRight||0),this.setUniform("u_face0MouthClose","float",b.mouthClose||0),this.setUniform("u_face0MouthDimpleLeft","float",b.mouthDimpleLeft||0),this.setUniform("u_face0MouthDimpleRight","float",b.mouthDimpleRight||0),this.setUniform("u_face0MouthFrownLeft","float",b.mouthFrownLeft||0),this.setUniform("u_face0MouthFrownRight","float",b.mouthFrownRight||0),this.setUniform("u_face0MouthFunnel","float",b.mouthFunnel||0),this.setUniform("u_face0MouthLeft","float",b.mouthLeft||0),this.setUniform("u_face0MouthLowerDownLeft","float",b.mouthLowerDownLeft||0),this.setUniform("u_face0MouthLowerDownRight","float",b.mouthLowerDownRight||0),this.setUniform("u_face0MouthPressLeft","float",b.mouthPressLeft||0),this.setUniform("u_face0MouthPressRight","float",b.mouthPressRight||0),this.setUniform("u_face0MouthPucker","float",b.mouthPucker||0),this.setUniform("u_face0MouthRight","float",b.mouthRight||0),this.setUniform("u_face0MouthRollLower","float",b.mouthRollLower||0),this.setUniform("u_face0MouthRollUpper","float",b.mouthRollUpper||0),this.setUniform("u_face0MouthShrugLower","float",b.mouthShrugLower||0),this.setUniform("u_face0MouthShrugUpper","float",b.mouthShrugUpper||0),this.setUniform("u_face0MouthSmileLeft","float",b.mouthSmileLeft||0),this.setUniform("u_face0MouthSmileRight","float",b.mouthSmileRight||0),this.setUniform("u_face0MouthStretchLeft","float",b.mouthStretchLeft||0),this.setUniform("u_face0MouthStretchRight","float",b.mouthStretchRight||0),this.setUniform("u_face0MouthUpperUpLeft","float",b.mouthUpperUpLeft||0),this.setUniform("u_face0MouthUpperUpRight","float",b.mouthUpperUpRight||0),this.setUniform("u_face0NoseSneerLeft","float",b.noseSneerLeft||0),this.setUniform("u_face0NoseSneerRight","float",b.noseSneerRight||0),this.setUniform("u_face0TongueOut","float",b.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 P=i.cv?.hands||[],F=this.visibleFeatures.has("handTracking");this.setUniform("u_handCount","int",F?P.length:0);const U=F?P.find(x=>x.handedness==="left"):void 0,D=F?P.find(x=>x.handedness==="right"):void 0;if(U){const x=U.palm||U.landmarks?.[9],b=U.gestures||{},v=U.bounds;this.setUniform("u_leftHandPalm","vec3",[x?.x||0,1-(x?.y||0),x?.z||0]),this.setUniform("u_leftHandConfidence","float",U.confidence||0),this.setUniform("u_leftHandBounds","vec4",[v?.x||0,1-(v?.y||0)-(v?.height||0),v?.width||0,v?.height||0]),this.setUniform("u_leftHandFist","float",b.fist||0),this.setUniform("u_leftHandOpen","float",b.openPalm||0),this.setUniform("u_leftHandPeace","float",b.peace||0),this.setUniform("u_leftHandThumbsUp","float",b.thumbsUp||0),this.setUniform("u_leftHandThumbsDown","float",b.thumbsDown||0),this.setUniform("u_leftHandPointing","float",b.pointing||0),this.setUniform("u_leftHandILoveYou","float",b.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(D){const x=D.palm||D.landmarks?.[9],b=D.gestures||{},v=D.bounds;this.setUniform("u_rightHandPalm","vec3",[x?.x||0,1-(x?.y||0),x?.z||0]),this.setUniform("u_rightHandConfidence","float",D.confidence||0),this.setUniform("u_rightHandBounds","vec4",[v?.x||0,1-(v?.y||0)-(v?.height||0),v?.width||0,v?.height||0]),this.setUniform("u_rightHandFist","float",b.fist||0),this.setUniform("u_rightHandOpen","float",b.openPalm||0),this.setUniform("u_rightHandPeace","float",b.peace||0),this.setUniform("u_rightHandThumbsUp","float",b.thumbsUp||0),this.setUniform("u_rightHandThumbsDown","float",b.thumbsDown||0),this.setUniform("u_rightHandPointing","float",b.pointing||0),this.setUniform("u_rightHandILoveYou","float",b.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 q=this.visibleFeatures.has("poseDetection")?i.cv?.pose??null:null;if(this.setUniform("u_poseDetected","bool",q!==null),q&&q.landmarks){const x=q.landmarks,b=v=>1-(x[v]?.y||0);this.setUniform("u_poseConfidence","float",q.confidence||0),this.setUniform("u_nosePosition","vec2",[x[0]?.x||0,b(0)]),this.setUniform("u_leftShoulderPosition","vec2",[x[11]?.x||0,b(11)]),this.setUniform("u_rightShoulderPosition","vec2",[x[12]?.x||0,b(12)]),this.setUniform("u_leftElbowPosition","vec2",[x[13]?.x||0,b(13)]),this.setUniform("u_rightElbowPosition","vec2",[x[14]?.x||0,b(14)]),this.setUniform("u_leftWristPosition","vec2",[x[15]?.x||0,b(15)]),this.setUniform("u_rightWristPosition","vec2",[x[16]?.x||0,b(16)]),this.setUniform("u_leftHipPosition","vec2",[x[23]?.x||0,b(23)]),this.setUniform("u_rightHipPosition","vec2",[x[24]?.x||0,b(24)]),this.setUniform("u_leftKneePosition","vec2",[x[25]?.x||0,b(25)]),this.setUniform("u_rightKneePosition","vec2",[x[26]?.x||0,b(26)]),this.setUniform("u_leftAnklePosition","vec2",[x[27]?.x||0,b(27)]),this.setUniform("u_rightAnklePosition","vec2",[x[28]?.x||0,b(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 K=this.visibleFeatures.has("bodySegmentation")?i.cv?.segmentation??null:null;K?(this.updateSegmentationTexture(K.mask,K.width,K.height),this.setUniform("u_segmentationRes","vec2",[K.width,K.height])):this.setUniform("u_segmentationRes","vec2",[0,0]);const Z=t.device;if(Z){const x=Z.motion;x?.acceleration?this.setUniform("u_deviceAcceleration","vec3",[x.acceleration.x??0,x.acceleration.y??0,x.acceleration.z??0]):this.setUniform("u_deviceAcceleration","vec3",[0,0,0]),x?.accelerationIncludingGravity?this.setUniform("u_deviceAccelerationGravity","vec3",[x.accelerationIncludingGravity.x??0,x.accelerationIncludingGravity.y??0,x.accelerationIncludingGravity.z??0]):this.setUniform("u_deviceAccelerationGravity","vec3",[0,0,0]),x?.rotationRate?this.setUniform("u_deviceRotationRate","vec3",[x.rotationRate.alpha??0,x.rotationRate.beta??0,x.rotationRate.gamma??0]):this.setUniform("u_deviceRotationRate","vec3",[0,0,0]);const b=Z.orientation;b?(this.setUniform("u_deviceOrientation","vec3",[b.alpha??0,b.beta??0,b.gamma??0]),this.setUniform("u_deviceOrientationAbsolute","bool",b.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 X=t.devices||[],re=Math.min(X.length,Ke.MAX_EXTERNAL_DEVICES);this.setUniform("u_externalDeviceCount","int",re);for(let x=0;x<Ke.MAX_EXTERNAL_DEVICES;x++)if(x<re){const b=X[x],v=b.motion;v?.acceleration?this.setUniform(`u_device${x}Acceleration`,"vec3",[v.acceleration.x??0,v.acceleration.y??0,v.acceleration.z??0]):this.setUniform(`u_device${x}Acceleration`,"vec3",[0,0,0]),v?.accelerationIncludingGravity?this.setUniform(`u_device${x}AccelerationGravity`,"vec3",[v.accelerationIncludingGravity.x??0,v.accelerationIncludingGravity.y??0,v.accelerationIncludingGravity.z??0]):this.setUniform(`u_device${x}AccelerationGravity`,"vec3",[0,0,0]),v?.rotationRate?this.setUniform(`u_device${x}RotationRate`,"vec3",[v.rotationRate.alpha??0,v.rotationRate.beta??0,v.rotationRate.gamma??0]):this.setUniform(`u_device${x}RotationRate`,"vec3",[0,0,0]);const V=b.orientation;V?this.setUniform(`u_device${x}Orientation`,"vec3",[V.alpha??0,V.beta??0,V.gamma??0]):this.setUniform(`u_device${x}Orientation`,"vec3",[0,0,0])}else this.setUniform(`u_device${x}Acceleration`,"vec3",[0,0,0]),this.setUniform(`u_device${x}AccelerationGravity`,"vec3",[0,0,0]),this.setUniform(`u_device${x}RotationRate`,"vec3",[0,0,0]),this.setUniform(`u_device${x}Orientation`,"vec3",[0,0,0])}updateAccumulators(t,s){const i=t.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(t){for(const s of this.parameters){if(s.type==="accumulator")continue;const i=t.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;this.colorVec3CacheKey.get(s.uniformName)!==a&&(this.colorVec3Cache.set(s.uniformName,$1(a)),this.colorVec3CacheKey.set(s.uniformName,a)),this.setUniform(s.uniformName,"vec3",this.colorVec3Cache.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}}}setUniform(t,s,i){switch(s){case"float":this.scalarUniformCache.set(t,i);break;case"int":this.scalarUniformCache.set(t,i);break;case"bool":this.scalarUniformCache.set(t,i?1:0);break;case"vec2":this.scalarUniformCache.set(t+".x",i[0]),this.scalarUniformCache.set(t+".y",i[1]);break;case"vec3":this.scalarUniformCache.set(t+".x",i[0]),this.scalarUniformCache.set(t+".y",i[1]),this.scalarUniformCache.set(t+".z",i[2]);break;case"vec4":this.scalarUniformCache.set(t+".x",i[0]),this.scalarUniformCache.set(t+".y",i[1]),this.scalarUniformCache.set(t+".z",i[2]),this.scalarUniformCache.set(t+".w",i[3]);break}const r=this.uniformLocations.get(t);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}}updateAudioFFTTexture(t){const s=this.gl,i=this.textureUnits.get("u_audioFFT");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,t.length,1,0,s.LUMINANCE,s.UNSIGNED_BYTE,t),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(t){const s=this.gl,i=this.textureUnits.get("u_audioWaveform");this.audioWaveformTexture||(this.audioWaveformTexture=s.createTexture());const r=new Uint8Array(t.length);for(let o=0;o<t.length;o++)r[o]=Math.round((t[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(t){const s=this.gl,i=this.textureUnits.get("u_video");this.videoTexture||(this.videoTexture=s.createTexture()),s.activeTexture(s.TEXTURE0+i),s.bindTexture(s.TEXTURE_2D,this.videoTexture);const r=t instanceof OffscreenCanvas;r&&s.pixelStorei(s.UNPACK_FLIP_Y_WEBGL,true),s.texImage2D(s.TEXTURE_2D,0,s.RGBA,s.RGBA,s.UNSIGNED_BYTE,t),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),t instanceof ImageBitmap&&t.close()}updateAnalysedFrameTexture(t){const s=this.gl,i=this.textureUnits.get("u_videoAnalysed");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,t),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 t=this.gl,s=this.textureUnits.get("u_videoAnalysed");if(this.analysedFrameFallbackTexture)t.activeTexture(t.TEXTURE0+s),t.bindTexture(t.TEXTURE_2D,this.analysedFrameFallbackTexture);else{this.analysedFrameFallbackTexture=t.createTexture(),t.activeTexture(t.TEXTURE0+s),t.bindTexture(t.TEXTURE_2D,this.analysedFrameFallbackTexture);const r=new Uint8Array([0,0,0,255]);t.texImage2D(t.TEXTURE_2D,0,t.RGBA,1,1,0,t.RGBA,t.UNSIGNED_BYTE,r),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)}const i=this.uniformLocations.get("u_videoAnalysed");i&&t.uniform1i(i,s)}updateVideoStreamTexture(t,s){const i=this.gl,r=`u_videoStream${t}`,a=this.textureUnits.get(r);this.videoStreamTextures[t]||(this.videoStreamTextures[t]=i.createTexture()),i.activeTexture(i.TEXTURE0+a),i.bindTexture(i.TEXTURE_2D,this.videoStreamTextures[t]);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 u=this.uniformLocations.get(r);u&&i.uniform1i(u,a),s instanceof ImageBitmap&&s.close()}updateDeviceTexture(t,s){if(!this.gl||t>=Ke.MAX_DEVICE_VIDEOS)return;this.deviceTextures[t]||(this.deviceTextures[t]=this.gl.createTexture());const i=this.deviceTextures[t];if(!i)return;const r=this.textureUnits.get(`u_device${t}`);if(r===void 0)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${t}`,u=this.uniformLocations.get(o);u&&this.gl.uniform1i(u,r),s instanceof ImageBitmap&&s.close()}updateSegmentationTexture(t,s,i){const r=this.gl,a=this.textureUnits.get("u_segmentationMask");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,t),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(t){const s=this.gl,i=this.textureUnits.get("u_keyboard");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,t),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(t,s){const i=this.gl;this.textureUnits.has(t)||this.textureUnits.set(t,this.nextTextureUnit++);const r=this.textureUnits.get(t);if(!this.textures.has(t)){const u=i.createTexture();u&&this.textures.set(t,u)}const a=this.textures.get(t);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(t);o&&i.uniform1i(o,r)}resize(t,s){this.gl.viewport(0,0,t,s),this.backbufferEnabled&&this.createBackbufferFramebuffers()}getParameterDefinitions(){return this.parameters}destroy(){this.destroyed=true;const t=this.gl;this.program&&(t.deleteProgram(this.program),this.program=null),this.audioFFTTexture&&t.deleteTexture(this.audioFFTTexture),this.audioWaveformTexture&&t.deleteTexture(this.audioWaveformTexture),this.videoTexture&&t.deleteTexture(this.videoTexture),this.analysedFrameTexture&&t.deleteTexture(this.analysedFrameTexture),this.analysedFrameFallbackTexture&&t.deleteTexture(this.analysedFrameFallbackTexture),this.segmentationTexture&&t.deleteTexture(this.segmentationTexture);for(const s of this.videoStreamTextures)s&&t.deleteTexture(s);this.videoStreamTextures=[];for(const s of this.deviceTextures)s&&t.deleteTexture(s);this.deviceTextures=[];for(const s of this.textures.values())s&&t.deleteTexture(s);this.textures.clear(),this.backbufferFramebuffer&&t.deleteFramebuffer(this.backbufferFramebuffer),this.backbufferTexture&&t.deleteTexture(this.backbufferTexture),this.currentFramebuffer&&t.deleteFramebuffer(this.currentFramebuffer),this.currentTexture&&t.deleteTexture(this.currentTexture),this.quadBuffer&&t.deleteBuffer(this.quadBuffer)}}const $e=(e,t,s)=>Gt(e,t,s),ku=os,wu=Ca,Jt=(...e)=>sf(...e),Kn=e=>vu(e),Eu=yu,Su=e=>nf(e),$i=BigInt(0),Zn=BigInt(1);function ii(e,t=""){if(typeof e!="boolean"){const s=t&&`"${t}" `;throw new TypeError(s+"expected boolean, got type="+typeof e)}return e}function Ia(e){if(typeof e=="bigint"){if(!Ii(e))throw new RangeError("positive bigint expected, got "+e)}else ku(e);return e}function Qn(e,t=""){if(typeof e!="number"){const s=t&&`"${t}" `;throw new TypeError(s+"expected number, got type="+typeof e)}if(!Number.isSafeInteger(e)){const s=t&&`"${t}" `;throw new RangeError(s+"expected safe integer, got "+e)}}function wi(e){const t=Ia(e).toString(16);return t.length&1?"0"+t:t}function Tu(e){if(typeof e!="string")throw new TypeError("hex string expected, got "+typeof e);return e===""?$i:BigInt("0x"+e)}function mr(e){return Tu(Ca(e))}function Cu(e){return Tu(Ca(gf(Gt(e)).reverse()))}function Ra(e,t){if(os(t),t===0)throw new RangeError("zero length");e=Ia(e);const s=e.toString(16);if(s.length>t*2)throw new RangeError("number too large");return vu(s.padStart(t*2,"0"))}function Au(e,t){return Ra(e,t).reverse()}function gf(e){return Uint8Array.from($e(e))}const Ii=e=>typeof e=="bigint"&&$i<=e;function bf(e,t,s){return Ii(e)&&Ii(t)&&Ii(s)&&t<=e&&e<s}function Iu(e,t,s,i){if(!bf(t,s,i))throw new RangeError("expected valid "+e+": "+s+" <= n < "+i+", got "+t)}function Pa(e){if(e<$i)throw new Error("expected non-negative bigint, got "+e);let t;for(t=0;e>$i;e>>=Zn,t+=1);return t}const La=e=>(Zn<<BigInt(e))-Zn;function yf(e,t,s){if(os(e,"hashLen"),os(t,"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),u=1e3;let l=i(e),h=i(e),p=0;const m=()=>{l.fill(1),h.fill(0),p=0},_=(...F)=>s(h,Jt(l,...F)),k=(F=r)=>{h=_(a,F),l=_(),F.length!==0&&(h=_(o,F),l=_())},T=()=>{if(p++>=u)throw new Error("drbg: tried max amount of iterations");let F=0;const U=[];for(;F<t;){l=_();const D=l.slice();U.push(D),F+=l.length}return Jt(...U)};return(F,U)=>{m(),k(F);let D;for(;(D=U(T()))===void 0;)k();return m(),D}}function gr(e,t={},s={}){if(Object.prototype.toString.call(e)!=="[object Object]")throw new TypeError("expected valid options object");function i(a,o,u){if(!u&&o!=="function"&&!Object.hasOwn(e,a))throw new TypeError(`param "${a}" is invalid: expected own property`);const l=e[a];if(u&&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(([u,l])=>i(u,l,o));r(t,false),r(s,true)}const Je=BigInt(0),De=BigInt(1),ds=BigInt(2),Ru=BigInt(3),Pu=BigInt(4),Lu=BigInt(5),_f=BigInt(7),Du=BigInt(8),xf=BigInt(9),Nu=BigInt(16);function ft(e,t){if(t<=Je)throw new Error("mod: expected positive modulus, got "+t);const s=e%t;return s>=Je?s:t+s}function Lo(e,t){if(e===Je)throw new Error("invert: expected non-zero number");if(t<=Je)throw new Error("invert: expected positive modulus, got "+t);let s=ft(e,t),i=t,r=Je,a=De;for(;s!==Je;){const u=i/s,l=i-s*u,h=r-a*u;i=s,s=l,r=a,a=h}if(i!==De)throw new Error("invert: does not exist");return ft(r,t)}function Da(e,t,s){const i=e;if(!i.eql(i.sqr(t),s))throw new Error("Cannot find square root")}function Fu(e,t){const s=e,i=(s.ORDER+De)/Pu,r=s.pow(t,i);return Da(s,r,t),r}function vf(e,t){const s=e,i=(s.ORDER-Lu)/Du,r=s.mul(t,ds),a=s.pow(r,i),o=s.mul(t,a),u=s.mul(s.mul(o,ds),a),l=s.mul(o,s.sub(u,s.ONE));return Da(s,l,t),l}function kf(e){const t=Na(e),s=Uu(e),i=s(t,t.neg(t.ONE)),r=s(t,i),a=s(t,t.neg(i)),o=(e+_f)/Nu;return(u,l)=>{const h=u;let p=h.pow(l,o),m=h.mul(p,i);const _=h.mul(p,r),k=h.mul(p,a),T=h.eql(h.sqr(m),l),P=h.eql(h.sqr(_),l);p=h.cmov(p,m,T),m=h.cmov(k,_,P);const F=h.eql(h.sqr(m),l),U=h.cmov(p,m,F);return Da(h,U,l),U}}function Uu(e){if(e<Ru)throw new Error("sqrt is not defined for small field");let t=e-De,s=0;for(;t%ds===Je;)t/=ds,s++;let i=ds;const r=Na(e);for(;Do(r,i)===1;)if(i++>1e3)throw new Error("Cannot find square root: probably non-prime P");if(s===1)return Fu;let a=r.pow(i,t);const o=(t+De)/ds;return function(l,h){const p=l;if(p.is0(h))return h;if(Do(p,h)!==1)throw new Error("Cannot find square root");let m=s,_=p.mul(p.ONE,a),k=p.pow(h,t),T=p.pow(h,o);for(;!p.eql(k,p.ONE);){if(p.is0(k))return p.ZERO;let P=1,F=p.sqr(k);for(;!p.eql(F,p.ONE);)if(P++,F=p.sqr(F),P===m)throw new Error("Cannot find square root");const U=De<<BigInt(m-P-1),D=p.pow(_,U);m=P,_=p.sqr(D),k=p.mul(k,_),T=p.mul(T,D)}return T}}function wf(e){return e%Pu===Ru?Fu:e%Du===Lu?vf:e%Nu===xf?kf(e):Uu(e)}const Ef=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function Sf(e){const t={ORDER:"bigint",BYTES:"number",BITS:"number"},s=Ef.reduce((i,r)=>(i[r]="function",i),t);if(gr(e,s),Qn(e.BYTES,"BYTES"),Qn(e.BITS,"BITS"),e.BYTES<1||e.BITS<1)throw new Error("invalid field: expected BYTES/BITS > 0");if(e.ORDER<=De)throw new Error("invalid field: expected ORDER > 1, got "+e.ORDER);return e}function Tf(e,t,s){const i=e;if(s<Je)throw new Error("invalid exponent, negatives unsupported");if(s===Je)return i.ONE;if(s===De)return t;let r=i.ONE,a=t;for(;s>Je;)s&De&&(r=i.mul(r,a)),a=i.sqr(a),s>>=De;return r}function Mu(e,t,s=false){const i=e,r=new Array(t.length).fill(s?i.ZERO:void 0),a=t.reduce((u,l,h)=>i.is0(l)?u:(r[h]=u,i.mul(u,l)),i.ONE),o=i.inv(a);return t.reduceRight((u,l,h)=>i.is0(l)?u:(r[h]=i.mul(u,r[h]),i.mul(u,l)),o),r}function Do(e,t){const s=e,i=(s.ORDER-De)/ds,r=s.pow(t,i),a=s.eql(r,s.ONE),o=s.eql(r,s.ZERO),u=s.eql(r,s.neg(s.ONE));if(!a&&!o&&!u)throw new Error("invalid Legendre symbol result");return a?1:o?0:-1}function Cf(e,t){if(t!==void 0&&ku(t),e<=Je)throw new Error("invalid n length: expected positive n, got "+e);if(t!==void 0&&t<1)throw new Error("invalid n length: expected positive bit length, got "+t);const s=Pa(e);if(t!==void 0&&t<s)throw new Error(`invalid n length: expected bit length (${s}) >= n.length (${t})`);const i=t!==void 0?t:s,r=Math.ceil(i/8);return{nBitLength:i,nByteLength:r}}const No=new WeakMap;class Ou{ORDER;BITS;BYTES;isLE;ZERO=Je;ONE=De;_lengths;_mod;constructor(t,s={}){if(t<=De)throw new Error("invalid field: expected ORDER > 1, got "+t);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}=Cf(t,i);if(a>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");this.ORDER=t,this.BITS=r,this.BYTES=a,Object.freeze(this)}create(t){return ft(t,this.ORDER)}isValid(t){if(typeof t!="bigint")throw new TypeError("invalid field element: expected bigint, got "+typeof t);return Je<=t&&t<this.ORDER}is0(t){return t===Je}isValidNot0(t){return!this.is0(t)&&this.isValid(t)}isOdd(t){return(t&De)===De}neg(t){return ft(-t,this.ORDER)}eql(t,s){return t===s}sqr(t){return ft(t*t,this.ORDER)}add(t,s){return ft(t+s,this.ORDER)}sub(t,s){return ft(t-s,this.ORDER)}mul(t,s){return ft(t*s,this.ORDER)}pow(t,s){return Tf(this,t,s)}div(t,s){return ft(t*Lo(s,this.ORDER),this.ORDER)}sqrN(t){return t*t}addN(t,s){return t+s}subN(t,s){return t-s}mulN(t,s){return t*s}inv(t){return Lo(t,this.ORDER)}sqrt(t){let s=No.get(this);return s||No.set(this,s=wf(this.ORDER)),s(this,t)}toBytes(t){return this.isLE?Au(t,this.BYTES):Ra(t,this.BYTES)}fromBytes(t,s=false){$e(t);const{_lengths:i,BYTES:r,isLE:a,ORDER:o,_mod:u}=this;if(i){if(t.length<1||!i.includes(t.length)||t.length>r)throw new Error("Field.fromBytes: expected "+i+" bytes, got "+t.length);const h=new Uint8Array(r);h.set(t,a?0:h.length-t.length),t=h}if(t.length!==r)throw new Error("Field.fromBytes: expected "+r+" bytes, got "+t.length);let l=a?Cu(t):mr(t);if(u&&(l=ft(l,o)),!s&&!this.isValid(l))throw new Error("invalid field element: outside of range 0..ORDER");return l}invertBatch(t){return Mu(this,t)}cmov(t,s,i){return ii(i,"condition"),i?s:t}}Object.freeze(Ou.prototype);function Na(e,t={}){return new Ou(e,t)}function Bu(e){if(typeof e!="bigint")throw new Error("field order must be bigint");if(e<=De)throw new Error("field order must be greater than 1");const t=Pa(e-De);return Math.ceil(t/8)}function Vu(e){const t=Bu(e);return t+Math.ceil(t/2)}function Af(e,t,s=false){$e(e);const i=e.length,r=Bu(t),a=Math.max(Vu(t),16);if(i<a||i>1024)throw new Error("expected "+a+"-1024 bytes of input, got "+i);const o=s?Cu(e):mr(e),u=ft(o,t-De)+De;return s?Au(u,r):Ra(u,r)}const Ds=BigInt(0),ps=BigInt(1);function qi(e,t){const s=t.negate();return e?s:t}function Fo(e,t){const s=Mu(e.Fp,t.map(i=>i.Z));return t.map((i,r)=>e.fromAffine(i.toAffine(s[r])))}function ju(e,t){if(!Number.isSafeInteger(e)||e<=0||e>t)throw new Error("invalid window size, expected [1.."+t+"], got W="+e)}function An(e,t){ju(e,t);const s=Math.ceil(t/e)+1,i=2**(e-1),r=2**e,a=La(e),o=BigInt(e);return{windows:s,windowSize:i,mask:a,maxNumber:r,shiftBy:o}}function Uo(e,t,s){const{windowSize:i,mask:r,maxNumber:a,shiftBy:o}=s;let u=Number(e&r),l=e>>o;u>i&&(u-=a,l+=ps);const h=t*i,p=h+Math.abs(u)-1,m=u===0,_=u<0,k=t%2!==0;return{nextN:l,offset:p,isZero:m,isNeg:_,isNegF:k,offsetF:h}}const In=new WeakMap,$u=new WeakMap;function Rn(e){return $u.get(e)||1}function Mo(e){if(e!==Ds)throw new Error("invalid wNAF")}class If{BASE;ZERO;Fn;bits;constructor(t,s){this.BASE=t.BASE,this.ZERO=t.ZERO,this.Fn=t.Fn,this.bits=s}_unsafeLadder(t,s,i=this.ZERO){let r=t;for(;s>Ds;)s&ps&&(i=i.add(r)),r=r.double(),s>>=ps;return i}precomputeWindow(t,s){const{windows:i,windowSize:r}=An(s,this.bits),a=[];let o=t,u=o;for(let l=0;l<i;l++){u=o,a.push(u);for(let h=1;h<r;h++)u=u.add(o),a.push(u);o=u.double()}return a}wNAF(t,s,i){if(!this.Fn.isValid(i))throw new Error("invalid scalar");let r=this.ZERO,a=this.BASE;const o=An(t,this.bits);for(let u=0;u<o.windows;u++){const{nextN:l,offset:h,isZero:p,isNeg:m,isNegF:_,offsetF:k}=Uo(i,u,o);i=l,p?a=a.add(qi(_,s[k])):r=r.add(qi(m,s[h]))}return Mo(i),{p:r,f:a}}wNAFUnsafe(t,s,i,r=this.ZERO){const a=An(t,this.bits);for(let o=0;o<a.windows&&i!==Ds;o++){const{nextN:u,offset:l,isZero:h,isNeg:p}=Uo(i,o,a);if(i=u,!h){const m=s[l];r=r.add(p?m.negate():m)}}return Mo(i),r}getPrecomputes(t,s,i){let r=In.get(s);return r||(r=this.precomputeWindow(s,t),t!==1&&(typeof i=="function"&&(r=i(r)),In.set(s,r))),r}cached(t,s,i){const r=Rn(t);return this.wNAF(r,this.getPrecomputes(r,t,i),s)}unsafe(t,s,i,r){const a=Rn(t);return a===1?this._unsafeLadder(t,s,r):this.wNAFUnsafe(a,this.getPrecomputes(a,t,i),s,r)}createCache(t,s){ju(s,this.bits),$u.set(t,s),In.delete(t)}hasCache(t){return Rn(t)!==1}}function Rf(e,t,s,i){let r=t,a=e.ZERO,o=e.ZERO;for(;s>Ds||i>Ds;)s&ps&&(a=a.add(r)),i&ps&&(o=o.add(r)),r=r.double(),s>>=ps,i>>=ps;return{p1:a,p2:o}}function Oo(e,t,s){if(t){if(t.ORDER!==e)throw new Error("Field.ORDER must match order: Fp == p, Fn == n");return Sf(t),t}else return Na(e,{isLE:s})}function Pf(e,t,s={},i){if(i===void 0&&(i=e==="edwards"),!t||typeof t!="object")throw new Error(`expected valid ${e} CURVE object`);for(const l of["p","n","h"]){const h=t[l];if(!(typeof h=="bigint"&&h>Ds))throw new Error(`CURVE.${l} must be positive bigint`)}const r=Oo(t.p,s.Fp,i),a=Oo(t.n,s.Fn,i),u=["Gx","Gy","a","b"];for(const l of u)if(!r.isValid(t[l]))throw new Error(`CURVE.${l} must be valid field element of CURVE.Fp`);return t=Object.freeze(Object.assign({},t)),{CURVE:t,Fp:r,Fn:a}}function Lf(e,t){return function(i){const r=e(i);return{secretKey:r,publicKey:t(r)}}}class Bo{oHash;iHash;blockLen;outputLen;canXOF=false;finished=false;destroyed=false;constructor(t,s){if(pr(t),Gt(s,void 0,"key"),this.iHash=t.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?t.create().update(s).digest():s);for(let a=0;a<r.length;a++)r[a]^=54;this.iHash.update(r),this.oHash=t.create();for(let a=0;a<r.length;a++)r[a]^=106;this.oHash.update(r),si(r)}update(t){return ji(this),this.iHash.update(t),this}digestInto(t){ji(this),_u(t,this),this.finished=true;const s=t.subarray(0,this.outputLen);this.iHash.digestInto(s),this.oHash.update(s),this.oHash.digestInto(s),this.destroy()}digest(){const t=new Uint8Array(this.oHash.outputLen);return this.digestInto(t),t}_cloneInto(t){t||=Object.create(Object.getPrototypeOf(this),{});const{oHash:s,iHash:i,finished:r,destroyed:a,blockLen:o,outputLen:u}=this;return t=t,t.finished=r,t.destroyed=a,t.blockLen=o,t.outputLen=u,t.oHash=s._cloneInto(t.oHash),t.iHash=i._cloneInto(t.iHash),t}clone(){return this._cloneInto()}destroy(){this.destroyed=true,this.oHash.destroy(),this.iHash.destroy()}}const Fa=(()=>{const e=(t,s,i)=>new Bo(t,s).update(i).digest();return e.create=(t,s)=>new Bo(t,s),e})();const Vo=(e,t)=>(e+(e>=0?t:-t)/qu)/t;function Df(e,t,s){Iu("scalar",e,Tt,s);const[[i,r],[a,o]]=t,u=Vo(o*e,s),l=Vo(-r*e,s);let h=e-u*i-l*a,p=-u*r-l*o;const m=h<Tt,_=p<Tt;m&&(h=-h),_&&(p=-p);const k=La(Math.ceil(Pa(s)/2))+es;if(h<Tt||h>=k||p<Tt||p>=k)throw new Error("splitScalar (endomorphism): failed for k");return{k1neg:m,k1:h,k2neg:_,k2:p}}function Jn(e){if(!["compact","recovered","der"].includes(e))throw new Error('Signature format must be "compact", "recovered", or "der"');return e}function Pn(e,t){gr(e);const s={};for(let i of Object.keys(t))s[i]=e[i]===void 0?t[i]:e[i];return ii(s.lowS,"lowS"),ii(s.prehash,"prehash"),s.format!==void 0&&Jn(s.format),s}class Nf extends Error{constructor(t=""){super(t)}}const dt={Err:Nf,_tlv:{encode:(e,t)=>{const{Err:s}=dt;if(Qn(e,"tag"),e<0||e>255)throw new s("tlv.encode: wrong tag");if(typeof t!="string")throw new TypeError('"data" expected string, got type='+typeof t);if(t.length&1)throw new s("tlv.encode: unpadded data");const i=t.length/2,r=wi(i);if(r.length/2&128)throw new s("tlv.encode: long form length too big");const a=i>127?wi(r.length/2|128):"";return wi(e)+a+r+t},decode(e,t){const{Err:s}=dt;t=$e(t,void 0,"DER data");let i=0;if(e<0||e>255)throw new s("tlv.encode: wrong tag");if(t.length<2||t[i++]!==e)throw new s("tlv.decode: wrong tlv");const r=t[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=t.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 p of h)o=o<<8|p;if(i+=l,o<128)throw new s("tlv.decode(long): not minimal encoding")}const u=t.subarray(i,i+o);if(u.length!==o)throw new s("tlv.decode: wrong value length");return{v:u,l:t.subarray(i+o)}}},_int:{encode(e){const{Err:t}=dt;if(Ia(e),e<Tt)throw new t("integer: negative integers are not allowed");let s=wi(e);if(Number.parseInt(s[0],16)&8&&(s="00"+s),s.length&1)throw new t("unexpected DER parsing assertion: unpadded hex");return s},decode(e){const{Err:t}=dt;if(e.length<1)throw new t("invalid signature integer: empty");if(e[0]&128)throw new t("invalid signature integer: negative");if(e.length>1&&e[0]===0&&!(e[1]&128))throw new t("invalid signature integer: unnecessary leading zero");return mr(e)}},toSig(e){const{Err:t,_int:s,_tlv:i}=dt,r=$e(e,void 0,"signature"),{v:a,l:o}=i.decode(48,r);if(o.length)throw new t("invalid signature: left bytes after parsing");const{v:u,l}=i.decode(2,a),{v:h,l:p}=i.decode(2,l);if(p.length)throw new t("invalid signature: left bytes after parsing");return{r:s.decode(u),s:s.decode(h)}},hexFromSig(e){const{_tlv:t,_int:s}=dt,i=t.encode(2,s.encode(e.r)),r=t.encode(2,s.encode(e.s)),a=i+r;return t.encode(48,a)}};Object.freeze(dt._tlv);Object.freeze(dt._int);Object.freeze(dt);const Tt=BigInt(0),es=BigInt(1),qu=BigInt(2),Ei=BigInt(3),Ff=BigInt(4);function Uf(e,t={}){const s=Pf("weierstrass",e,t),i=s.Fp,r=s.Fn;let a=s.CURVE;const{h:o,n:u}=a;gr(t,{},{allowInfinityPoint:"boolean",clearCofactor:"function",isTorsionFree:"function",fromBytes:"function",toBytes:"function",endo:"object"});const{endo:l,allowInfinityPoint:h}=t;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 p=Wu(i,r);function m(){if(!i.isOdd)throw new Error("compression is not supported: Field does not have .isOdd()")}function _(b,v,V){if(h&&v.is0())return Uint8Array.of(0);const{x:W,y:O}=v.toAffine(),R=i.toBytes(W);if(ii(V,"isCompressed"),V){m();const B=!i.isOdd(O);return Jt(Hu(B),R)}else return Jt(Uint8Array.of(4),R,i.toBytes(O))}function k(b){$e(b,void 0,"Point");const{publicKey:v,publicKeyUncompressed:V}=p,W=b.length,O=b[0],R=b.subarray(1);if(h&&W===1&&O===0)return{x:i.ZERO,y:i.ZERO};if(W===v&&(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 A;try{A=i.sqrt(M)}catch(te){const ce=te instanceof Error?": "+te.message:"";throw new Error("bad point: is not on curve, sqrt error"+ce)}m();const H=i.isOdd(A);return(O&1)===1!==H&&(A=i.neg(A)),{x:B,y:A}}else if(W===V&&O===4){const B=i.BYTES,M=i.fromBytes(R.subarray(0,B)),A=i.fromBytes(R.subarray(B,B*2));if(!U(M,A))throw new Error("bad point: is not on curve");return{x:M,y:A}}else throw new Error(`bad point: got length ${W}, expected compressed=${v} or uncompressed=${V}`)}const T=t.toBytes===void 0?_:t.toBytes,P=t.fromBytes===void 0?k:t.fromBytes;function F(b){const v=i.sqr(b),V=i.mul(v,b);return i.add(i.add(V,i.mul(b,a.a)),a.b)}function U(b,v){const V=i.sqr(v),W=F(b);return i.eql(V,W)}if(!U(a.Gx,a.Gy))throw new Error("bad curve params: generator point");const D=i.mul(i.pow(a.a,Ei),Ff),z=i.mul(i.sqr(a.b),BigInt(27));if(i.is0(i.add(D,z)))throw new Error("bad curve params: a or b");function q(b,v,V=false){if(!i.isValid(v)||V&&i.is0(v))throw new Error(`bad point coordinate ${b}`);return v}function Y(b){if(!(b instanceof X))throw new Error("Weierstrass Point expected")}function K(b){if(!l||!l.basises)throw new Error("no endo");return Df(b,l.basises,r.ORDER)}function Z(b,v,V,W,O){return V=new X(i.mul(V.X,b),V.Y,V.Z),v=qi(W,v),V=qi(O,V),v.add(V)}class X{static BASE=new X(a.Gx,a.Gy,i.ONE);static ZERO=new X(i.ZERO,i.ONE,i.ZERO);static Fp=i;static Fn=r;X;Y;Z;constructor(v,V,W){this.X=q("x",v),this.Y=q("y",V,true),this.Z=q("z",W),Object.freeze(this)}static CURVE(){return a}static fromAffine(v){const{x:V,y:W}=v||{};if(!v||!i.isValid(V)||!i.isValid(W))throw new Error("invalid affine point");if(v instanceof X)throw new Error("projective point not allowed");return i.is0(V)&&i.is0(W)?X.ZERO:new X(V,W,i.ONE)}static fromBytes(v){const V=X.fromAffine(P($e(v,void 0,"point")));return V.assertValidity(),V}static fromHex(v){return X.fromBytes(Kn(v))}get x(){return this.toAffine().x}get y(){return this.toAffine().y}precompute(v=8,V=true){return x.createCache(this,v),V||this.multiply(Ei),this}assertValidity(){const v=this;if(v.is0()){if(t.allowInfinityPoint&&i.is0(v.X)&&i.eql(v.Y,i.ONE)&&i.is0(v.Z))return;throw new Error("bad point: ZERO")}const{x:V,y:W}=v.toAffine();if(!i.isValid(V)||!i.isValid(W))throw new Error("bad point: x or y not field elements");if(!U(V,W))throw new Error("bad point: equation left != right");if(!v.isTorsionFree())throw new Error("bad point: not in prime-order subgroup")}hasEvenY(){const{y:v}=this.toAffine();if(!i.isOdd)throw new Error("Field doesn't support isOdd");return!i.isOdd(v)}equals(v){Y(v);const{X:V,Y:W,Z:O}=this,{X:R,Y:B,Z:M}=v,A=i.eql(i.mul(V,M),i.mul(R,O)),H=i.eql(i.mul(W,M),i.mul(B,O));return A&&H}negate(){return new X(this.X,i.neg(this.Y),this.Z)}double(){const{a:v,b:V}=a,W=i.mul(V,Ei),{X:O,Y:R,Z:B}=this;let M=i.ZERO,A=i.ZERO,H=i.ZERO,G=i.mul(O,O),te=i.mul(R,R),ce=i.mul(B,B),oe=i.mul(O,R);return oe=i.add(oe,oe),H=i.mul(O,B),H=i.add(H,H),M=i.mul(v,H),A=i.mul(W,ce),A=i.add(M,A),M=i.sub(te,A),A=i.add(te,A),A=i.mul(M,A),M=i.mul(oe,M),H=i.mul(W,H),ce=i.mul(v,ce),oe=i.sub(G,ce),oe=i.mul(v,oe),oe=i.add(oe,H),H=i.add(G,G),G=i.add(H,G),G=i.add(G,ce),G=i.mul(G,oe),A=i.add(A,G),ce=i.mul(R,B),ce=i.add(ce,ce),G=i.mul(ce,oe),M=i.sub(M,G),H=i.mul(ce,te),H=i.add(H,H),H=i.add(H,H),new X(M,A,H)}add(v){Y(v);const{X:V,Y:W,Z:O}=this,{X:R,Y:B,Z:M}=v;let A=i.ZERO,H=i.ZERO,G=i.ZERO;const te=a.a,ce=i.mul(a.b,Ei);let oe=i.mul(V,R),w=i.mul(W,B),S=i.mul(O,M),N=i.add(V,W),L=i.add(R,B);N=i.mul(N,L),L=i.add(oe,w),N=i.sub(N,L),L=i.add(V,O);let j=i.add(R,M);return L=i.mul(L,j),j=i.add(oe,S),L=i.sub(L,j),j=i.add(W,O),A=i.add(B,M),j=i.mul(j,A),A=i.add(w,S),j=i.sub(j,A),G=i.mul(te,L),A=i.mul(ce,S),G=i.add(A,G),A=i.sub(w,G),G=i.add(w,G),H=i.mul(A,G),w=i.add(oe,oe),w=i.add(w,oe),S=i.mul(te,S),L=i.mul(ce,L),w=i.add(w,S),S=i.sub(oe,S),S=i.mul(te,S),L=i.add(L,S),oe=i.mul(w,L),H=i.add(H,oe),oe=i.mul(j,L),A=i.mul(N,A),A=i.sub(A,oe),oe=i.mul(N,w),G=i.mul(j,G),G=i.add(G,oe),new X(A,H,G)}subtract(v){return Y(v),this.add(v.negate())}is0(){return this.equals(X.ZERO)}multiply(v){const{endo:V}=t;if(!r.isValidNot0(v))throw new RangeError("invalid scalar: out of range");let W,O;const R=B=>x.cached(this,B,M=>Fo(X,M));if(V){const{k1neg:B,k1:M,k2neg:A,k2:H}=K(v),{p:G,f:te}=R(M),{p:ce,f:oe}=R(H);O=te.add(oe),W=Z(V.beta,G,ce,B,A)}else{const{p:B,f:M}=R(v);W=B,O=M}return Fo(X,[W,O])[0]}multiplyUnsafe(v){const{endo:V}=t,W=this,O=v;if(!r.isValid(O))throw new RangeError("invalid scalar: out of range");if(O===Tt||W.is0())return X.ZERO;if(O===es)return W;if(x.hasCache(this))return this.multiply(O);if(V){const{k1neg:R,k1:B,k2neg:M,k2:A}=K(O),{p1:H,p2:G}=Rf(X,W,B,A);return Z(V.beta,H,G,R,M)}else return x.unsafe(W,O)}toAffine(v){const V=this;let W=v;const{X:O,Y:R,Z:B}=V;if(i.eql(B,i.ONE))return{x:O,y:R};const M=V.is0();W==null&&(W=M?i.ONE:i.inv(B));const A=i.mul(O,W),H=i.mul(R,W),G=i.mul(B,W);if(M)return{x:i.ZERO,y:i.ZERO};if(!i.eql(G,i.ONE))throw new Error("invZ was invalid");return{x:A,y:H}}isTorsionFree(){const{isTorsionFree:v}=t;return o===es?true:v?v(X,this):x.unsafe(this,u).is0()}clearCofactor(){const{clearCofactor:v}=t;return o===es?this:v?v(X,this):this.multiplyUnsafe(o)}isSmallOrder(){return o===es?this.is0():this.clearCofactor().is0()}toBytes(v=true){return ii(v,"isCompressed"),this.assertValidity(),T(X,this,v)}toHex(v=true){return wu(this.toBytes(v))}toString(){return`<Point ${this.is0()?"ZERO":this.toHex()}>`}}const re=r.BITS,x=new If(X,t.endo?Math.ceil(re/2):re);return re>=8&&X.BASE.precompute(8),Object.freeze(X.prototype),Object.freeze(X),X}function Hu(e){return Uint8Array.of(e?2:3)}function Wu(e,t){return{secretKey:t.BYTES,publicKey:1+e.BYTES,publicKeyUncompressed:1+2*e.BYTES,publicKeyHasPrefix:true,signature:2*t.BYTES}}function Mf(e,t={}){const{Fn:s}=e,i=t.randomBytes===void 0?Su:t.randomBytes,r=Object.assign(Wu(e.Fp,s),{seed:Math.max(Vu(s.ORDER),16)});function a(k){try{const T=s.fromBytes(k);return s.isValidNot0(T)}catch{return false}}function o(k,T){const{publicKey:P,publicKeyUncompressed:F}=r;try{const U=k.length;return T===true&&U!==P||T===false&&U!==F?false:!!e.fromBytes(k)}catch{return false}}function u(k){return k=k===void 0?i(r.seed):k,Af($e(k,r.seed,"seed"),s.ORDER)}function l(k,T=true){return e.BASE.multiply(s.fromBytes(k)).toBytes(T)}function h(k){const{secretKey:T,publicKey:P,publicKeyUncompressed:F}=r,U=s._lengths;if(!Eu(k))return;const D=$e(k,void 0,"key").length,z=D===P||D===F,q=D===T||!!U?.includes(D);if(!(z&&q))return z}function p(k,T,P=true){if(h(k)===true)throw new Error("first arg must be private key");if(h(T)===false)throw new Error("second arg must be public key");const F=s.fromBytes(k);return e.fromBytes(T).multiply(F).toBytes(P)}const m={isValidSecretKey:a,isValidPublicKey:o,randomSecretKey:u},_=Lf(u,l);return Object.freeze(m),Object.freeze(r),Object.freeze({getPublicKey:l,getSharedSecret:p,keygen:_,Point:e,utils:m,lengths:r})}function Of(e,t,s={}){const i=t;pr(i),gr(s,{},{hmac:"function",lowS:"boolean",randomBytes:"function",bits2int:"function",bits2int_modN:"function"}),s=Object.assign({},s);const r=s.randomBytes===void 0?Su:s.randomBytes,a=s.hmac===void 0?(O,R)=>Fa(i,O,R):s.hmac,{Fp:o,Fn:u}=e,{ORDER:l,BITS:h}=u,{keygen:p,getPublicKey:m,getSharedSecret:_,utils:k,lengths:T}=Mf(e,s),P={prehash:true,lowS:typeof s.lowS=="boolean"?s.lowS:true,format:"compact",extraEntropy:false},F=l*qu+es<o.ORDER;function U(O){const R=l>>es;return O>R}function D(O,R){if(!u.isValidNot0(R))throw new Error(`invalid signature ${O}: out of range 1..Point.Fn.ORDER`);return R}function z(){if(F)throw new Error('"recovered" sig type is not supported for cofactor >2 curves')}function q(O,R){Jn(R);const B=T.signature,M=R==="compact"?B:R==="recovered"?B+1:void 0;return $e(O,M)}class Y{r;s;recovery;constructor(R,B,M){if(this.r=D("r",R),this.s=D("s",B),M!=null){if(z(),![0,1,2,3].includes(M))throw new Error("invalid recovery id");this.recovery=M}Object.freeze(this)}static fromBytes(R,B=P.format){q(R,B);let M;if(B==="der"){const{r:te,s:ce}=dt.toSig($e(R));return new Y(te,ce)}B==="recovered"&&(M=R[0],B="compact",R=R.subarray(1));const A=T.signature/2,H=R.subarray(0,A),G=R.subarray(A,A*2);return new Y(u.fromBytes(H),u.fromBytes(G),M)}static fromHex(R,B){return this.fromBytes(Kn(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 Y(this.r,this.s,R)}recoverPublicKey(R){const{r:B,s:M}=this,A=this.assertRecovery(),H=A===2||A===3?B+l:B;if(!o.isValid(H))throw new Error("invalid recovery id: sig.r+curve.n != R.x");const G=o.toBytes(H),te=e.fromBytes(Jt(Hu((A&1)===0),G)),ce=u.inv(H),oe=Z($e(R,void 0,"msgHash")),w=u.create(-oe*ce),S=u.create(M*ce),N=e.BASE.multiplyUnsafe(w).add(te.multiplyUnsafe(S));if(N.is0())throw new Error("invalid recovery: point at infinify");return N.assertValidity(),N}hasHighS(){return U(this.s)}toBytes(R=P.format){if(Jn(R),R==="der")return Kn(dt.hexFromSig(this));const{r:B,s:M}=this,A=u.toBytes(B),H=u.toBytes(M);return R==="recovered"?(z(),Jt(Uint8Array.of(this.assertRecovery()),A,H)):Jt(A,H)}toHex(R){return wu(this.toBytes(R))}}Object.freeze(Y.prototype),Object.freeze(Y);const K=s.bits2int===void 0?function(R){if(R.length>8192)throw new Error("input is too large");const B=mr(R),M=R.length*8-h;return M>0?B>>BigInt(M):B}:s.bits2int,Z=s.bits2int_modN===void 0?function(R){return u.create(K(R))}:s.bits2int_modN,X=La(h);function re(O){return Iu("num < 2^"+h,O,Tt,X),u.toBytes(O)}function x(O,R){return $e(O,void 0,"message"),R?$e(i(O),void 0,"prehashed message"):O}function b(O,R,B){const{lowS:M,prehash:A,extraEntropy:H}=Pn(B,P);O=x(O,A);const G=Z(O),te=u.fromBytes(R);if(!u.isValidNot0(te))throw new Error("invalid private key");const ce=[re(te),re(G)];if(H!=null&&H!==false){const N=H===true?r(T.secretKey):H;ce.push($e(N,void 0,"extraEntropy"))}const oe=Jt(...ce),w=G;function S(N){const L=K(N);if(!u.isValidNot0(L))return;const j=u.inv(L),se=e.BASE.multiply(L).toAffine(),ne=u.create(se.x);if(ne===Tt)return;const pe=u.create(j*u.create(w+ne*te));if(pe===Tt)return;let Ee=(se.x===ne?0:2)|Number(se.y&es),ke=pe;return M&&U(pe)&&(ke=u.neg(pe),Ee^=1),new Y(ne,ke,F?void 0:Ee)}return{seed:oe,k2sig:S}}function v(O,R,B={}){const{seed:M,k2sig:A}=b(O,R,B);return yf(i.outputLen,u.BYTES,a)(M,A).toBytes(B.format)}function V(O,R,B,M={}){const{lowS:A,prehash:H,format:G}=Pn(M,P);if(B=$e(B,void 0,"publicKey"),R=x(R,H),!Eu(O)){const te=O instanceof Y?", use sig.toBytes()":"";throw new Error("verify expects Uint8Array signature"+te)}q(O,G);try{const te=Y.fromBytes(O,G),ce=e.fromBytes(B);if(A&&te.hasHighS())return false;const{r:oe,s:w}=te,S=Z(R),N=u.inv(w),L=u.create(S*N),j=u.create(oe*N),se=e.BASE.multiplyUnsafe(L).add(ce.multiplyUnsafe(j));return se.is0()?false:u.create(se.x)===oe}catch{return false}}function W(O,R,B={}){const{prehash:M}=Pn(B,P);return R=x(R,M),Y.fromBytes(O,"recovered").recoverPublicKey(R).toBytes()}return Object.freeze({keygen:p,getPublicKey:m,getSharedSecret:_,utils:k,lengths:T,Point:e,sign:v,verify:V,recoverPublicKey:W,Signature:Y,hash:i})}const Bf={p:BigInt("0xffffffff00000001000000000000000000000000ffffffffffffffffffffffff"),n:BigInt("0xffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551"),h:BigInt(1),a:BigInt("0xffffffff00000001000000000000000000000000fffffffffffffffffffffffc"),b:BigInt("0x5ac635d8aa3a93e7b3ebbd55769886bc651d06b0cc53b0f63bce3c3e27d2604b"),Gx:BigInt("0x6b17d1f2e12c4247f8bce6e563a440f277037d812deb33a0f4a13945d898c296"),Gy:BigInt("0x4fe342e2fe1a7f9b8ee7eb4a7c0f9e162bce33576b315ececbb6406837bf51f5")},Vf=Uf(Bf),jf=Of(Vf,Aa),jo={x:"6bkPbVZXx-c08blVs6qIwm0gfSRLS2nnf2Tsz19ggtM",y:"lhi486ASKQkS8TGbVee-FpdAu7qKaO3gad_4ScX8qJI"},$f=60;let Hi=null,Ua=false,zs=null,ea=0;function Wi(e){const t=e.replace(/-/g,"+").replace(/_/g,"/"),s=atob(t),i=new Uint8Array(s.length);for(let r=0;r<s.length;r++)i[r]=s.charCodeAt(r);return i}function qf(e,t){try{const s=Wi(e),i=Wi(t);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 Hf(e,t){try{const s=e.split(".");if(s.length!==3)return null;const i=new TextEncoder().encode(s[0]+"."+s[1]),r=Wi(s[2]);if(r.length!==64||!jf.verify(r,i,t,{lowS:false}))return null;const a=JSON.parse(new TextDecoder().decode(Wi(s[1])));return{c:a.c??{},e:a.e??0}}catch{return null}}function Wf(e,t){return!(e>0&&e+$f<t)}async function Gf(){Hi=qf(jo.x,jo.y),Hi||(Ua=true,console.warn("[Viji] _SC: key import failed — restricted mode active"))}async function $o(e){const t=Ua||!Hi?null:Hf(e,Hi);zs=t?.c??null,ea=t?.e??0}function qo(e,t){return Ua||!zs?t:Wf(ea,Math.floor(Date.now()/1e3))?typeof zs[e]=="number"?zs[e]:t:(zs=null,ea=0,t)}const Xf="#F1F1F1",Cs=28,Ln=40,Ho=24,zf={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},Yf={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 ri=null,ni=null,Gu=null,Xu=null,We=null,Is=null,Gi=null,Zt=null,jt=-1,$t=-1,ta=null,Ze=null,Rs=null,Ps=null,zu=0,Yu=0,br=0,Ma=-1,sa=null,Xi="srgb",bt=null,Bt=null,St=null,Si=null;const Kf=["clearRect","fillRect","strokeRect","fillText","strokeText","drawImage","putImageData","fill","stroke","reset"];let yt=null;function Zf(e){if(yt!==e){yt=e,sa=null,br=0,Ma=-1,bt={save:e.save,restore:e.restore,setTransform:e.setTransform,clearRect:e.clearRect,drawImage:e.drawImage,getImageData:e.getImageData,putImageData:e.putImageData};try{Xi=e.getContextAttributes?.()?.colorSpace??"srgb"}catch{Xi="srgb"}}}function Qf(e){if(!(sa===e||yt!==e)){sa=e;for(const t of Kf){const s=e[t];if(typeof s!="function")continue;const i=s;e[t]=function(){return br++,i.apply(this,arguments)}}}}let Vt=null,Ri=0,Pi=0,ss=null,Wo=null,Dn=false;function Ku(e,t,s,i,r,a){const o=Math.max(0,Math.floor(e)),u=Math.max(0,Math.floor(t)),l=Math.min(r,Math.ceil(e+s)),h=Math.min(a,Math.ceil(t+i));return l<=o||h<=u?null:{x:o,y:u,w:l-o,h:h-u}}function Zu(e){const t=bt;t&&e===yt?t.setTransform.call(e,1,0,0,1,0,0):e.setTransform(1,0,0,1,0,0),e.globalAlpha=1,e.globalCompositeOperation="source-over",e.filter="none",e.shadowColor="transparent",e.shadowBlur=0,e.shadowOffsetX=0,e.shadowOffsetY=0,e.imageSmoothingEnabled=true,e.imageSmoothingQuality="low"}function Qu(e){(bt&&e===yt?bt.save:e.save).call(e)}function Ju(e){(bt&&e===yt?bt.restore:e.restore).call(e)}function Jf(e,t,s,i,r){(bt&&e===yt?bt.clearRect:e.clearRect).call(e,t,s,i,r)}function el(e,...t){(bt&&e===yt?bt.drawImage:e.drawImage).call(e,...t)}function ed(e){if(Wo!==e){Wo=e;try{Dn=!!e.getContextAttributes()?.preserveDrawingBuffer}catch{Dn=false}}return Dn}function td(e,t,s){if(e){if(t&&Ps&&Ze){const i=Ps;Ps=null;try{e.width!==zu||e.height!==Yu||(br===Ma?(Qu(t),Zu(t),Jf(t,i.x,i.y,i.w,i.h),el(t,Ze,0,0,i.w,i.h,i.x,i.y,i.w,i.h),Ju(t)):sd(t,i))}catch(r){ia(),console.warn("[Viji] overlay: restore failed",r)}}if(s&&ss&&Vt&&s===ta){const i=ss;ss=null;try{rl(s,e,Vt,i,false)}catch(r){ia(),console.warn("[Viji] overlay: GL restore failed",r)}}}}function ia(){Ps=null,Bt=null,ss=null}function sd(e,t){if(!Ze||!Bt)return;if(St)(St.width<t.w||St.height<t.h)&&(St.width=Math.max(t.w,St.width),St.height=Math.max(t.h,St.height));else try{St=new OffscreenCanvas(t.w,t.h),Si=St.getContext("2d",{colorSpace:Xi})}catch{St=null,Si=null}if(!Si)return;const s=Si;s.imageSmoothingEnabled=true,s.imageSmoothingQuality="low",s.clearRect(0,0,t.w,t.h),s.drawImage(Ze,0,0,t.w,t.h,0,0,t.w,t.h),s.drawImage(Bt.buffer,Bt.dx,Bt.dy,Bt.dw,Bt.dh);const i=bt,r=(i&&e===yt?i.getImageData:e.getImageData).call(e,t.x,t.y,t.w,t.h),a=s.getImageData(0,0,t.w,t.h),o=Rs.getImageData(0,0,t.w,t.h),u=r.data,l=a.data,h=o.data;for(let m=0;m<u.length;m+=4)u[m]===l[m]&&u[m+1]===l[m+1]&&u[m+2]===l[m+2]&&u[m+3]===l[m+3]&&(u[m]=h[m],u[m+1]=h[m+1],u[m+2]=h[m+2],u[m+3]=h[m+3]);(i&&e===yt?i.putImageData:e.putImageData).call(e,r,t.x,t.y)}function id(e,t){if(Ze)(Ze.width<e||Ze.height<t)&&(Ze.width=Math.max(e,Ze.width),Ze.height=Math.max(t,Ze.height));else try{Ze=new OffscreenCanvas(e,t),Rs=Ze.getContext("2d",{colorSpace:Xi})}catch{Ze=null,Rs=null}return!!Rs}function rd(e,t,s){const i=e,r=typeof i.createVertexArray=="function",a=e.getParameter(e.ACTIVE_TEXTURE);e.activeTexture(e.TEXTURE0);const o=e.getParameter(e.TEXTURE_BINDING_2D),u=e.getParameter(e.FRAMEBUFFER_BINDING),l=r?e.getParameter(i.READ_FRAMEBUFFER_BINDING):null,h=r?e.getParameter(i.PIXEL_UNPACK_BUFFER_BINDING):null;h&&i.bindBuffer(i.PIXEL_UNPACK_BUFFER,null),e.bindFramebuffer(e.FRAMEBUFFER,null),Vt?e.bindTexture(e.TEXTURE_2D,Vt):(Vt=e.createTexture(),Vt&&(e.bindTexture(e.TEXTURE_2D,Vt),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),Ri=0,Pi=0)),Vt?((Ri!==s.w||Pi!==s.h)&&(e.texImage2D(e.TEXTURE_2D,0,e.RGBA,s.w,s.h,0,e.RGBA,e.UNSIGNED_BYTE,null),Ri=s.w,Pi=s.h),e.copyTexSubImage2D(e.TEXTURE_2D,0,0,0,s.x,t.height-(s.y+s.h),s.w,s.h),ss=s):ss=null,e.bindTexture(e.TEXTURE_2D,o),e.bindFramebuffer(e.FRAMEBUFFER,u),r&&(i.bindFramebuffer(i.READ_FRAMEBUFFER,l),h&&i.bindBuffer(i.PIXEL_UNPACK_BUFFER,h)),e.activeTexture(a)}let Oa=0;const nd=`
433
+ attribute vec2 a_pos;
434
+ attribute vec2 a_uv;
435
+ varying vec2 v_uv;
436
+ void main() {
437
+ v_uv = a_uv;
438
+ gl_Position = vec4(a_pos, 0.0, 1.0);
439
+ }`,ad=`
440
+ precision mediump float;
441
+ uniform sampler2D u_tex;
442
+ uniform float u_alpha;
443
+ varying vec2 v_uv;
444
+ void main() {
445
+ gl_FragColor = texture2D(u_tex, v_uv) * u_alpha;
446
+ }`;function od(e){const t=new Path2D;for(const[s,i]of e.dots){const r=new Path2D;r.arc(s,i,1.875,0,Math.PI*2),t.addPath(r)}for(const s of e.paths)t.addPath(new Path2D(s));return t}function Go(e){const t=e.maxX-e.minX,s=e.maxY-e.minY,i=Math.ceil(t+Cs*2),r=Math.ceil(s+Cs*2),a=new OffscreenCanvas(i,r),o=a.getContext("2d");if(!o)return null;const u=od(e);o.translate(Cs-e.minX,Cs-e.minY),o.fillStyle=Xf;const l=[[e.shadowStd*2,.5],[8,.2],[2,.1]];for(const[h,p]of l)o.save(),o.shadowColor=`rgba(0,0,0,${p})`,o.shadowBlur=h,o.fill(u),o.restore();return o.fill(u),{canvas:a,bufW:i,bufH:r,contentW:t,contentH:s}}function cd(e){try{ri=Go(zf),ni=Go(Yf)}catch(t){console.warn("[Viji] overlay: init failed",t)}}function Xo(e){Oa=e}function tl(e,t,s,i){const r=e===0,a=r?ni:ri;if(!a)return null;const o=a.contentW*i,u=a.contentH*i;let l,h;return e===0?(l=Ln*i,h=Ln*i):e===2?(l=Ho*i,h=s-u-Ho*i):(l=(t-o)/2,h=Ln*i),{buffer:a,vertical:r,px:Math.round(l-Cs*i),py:Math.round(h-Cs*i),w:a.bufW*i,h:a.bufH*i}}function zo(e,t,s,i,r=1){if(i>=1)return;const a=tl(Oa,e.width,e.height,r||1);a&&(t?md(t,e,a):s&&gd(s,e,a))}const ud=`
447
+ struct VSOut {
448
+ @builtin(position) pos: vec4f,
449
+ @location(0) uv: vec2f,
450
+ };
451
+ @vertex
452
+ fn vs(@location(0) pos: vec2f, @location(1) uv: vec2f) -> VSOut {
453
+ var out: VSOut;
454
+ out.pos = vec4f(pos, 0.0, 1.0);
455
+ out.uv = uv;
456
+ return out;
457
+ }
458
+ @group(0) @binding(0) var samp: sampler;
459
+ @group(0) @binding(1) var tex: texture_2d<f32>;
460
+ @fragment
461
+ fn fs(@location(0) uv: vec2f) -> @location(0) vec4f {
462
+ return textureSample(tex, samp, uv);
463
+ }`;let Qe=null,Ti=false,zi=null,Yo=null;function ld(){zi=null}function sl(){if(Qe){try{Qe.texHorizontal?.destroy(),Qe.texVertical?.destroy(),Qe.quadBuf.destroy()}catch{}Qe=null}}function Ko(e,t){const s=e.createTexture({size:{width:t.bufW,height:t.bufH},format:"rgba8unorm",usage:22});return e.queue.copyExternalImageToTexture({source:t.canvas},{texture:s,premultipliedAlpha:true},{width:t.bufW,height:t.bufH}),s}function hd(e,t){if(e===zi)return null;if(Qe&&Qe.device===e&&Qe.format===t)return Qe;sl();const s=e.createShaderModule({code:ud}),i={color:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"}},r=e.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:t,blend:i}]},primitive:{topology:"triangle-strip"}}),a=e.createSampler({magFilter:"linear",minFilter:"linear"}),o=e.createBuffer({size:4*16,usage:40}),u=p=>e.createBindGroup({layout:r.getBindGroupLayout(0),entries:[{binding:0,resource:a},{binding:1,resource:p.createView()}]}),l=ri?Ko(e,ri):null,h=ni?Ko(e,ni):null;return Qe={device:e,format:t,pipeline:r,sampler:a,texHorizontal:l,texVertical:h,bindHorizontal:l?u(l):null,bindVertical:h?u(h):null,quadBuf:o},Yo!==e&&(Yo=e,e.lost.then(()=>{Qe&&Qe.device===e&&(Qe=null)}).catch(()=>{})),Qe}function fd(e,t,s,i,r,a=1){if(r>=1)return;const o=tl(Oa,i.width,i.height,a||1);if(o)try{const u=hd(t,s);if(!u)return;const l=o.vertical?u.bindVertical:u.bindHorizontal;if(!l)return;const h=i.width,p=i.height,m=o.px/h*2-1,_=(o.px+o.w)/h*2-1,k=1-o.py/p*2,T=1-(o.py+o.h)/p*2,P=new Float32Array([m,k,0,0,_,k,1,0,m,T,0,1,_,T,1,1]);t.queue.writeBuffer(u.quadBuf,0,P),t.pushErrorScope("validation");const F=t.createCommandEncoder(),U=F.beginRenderPass({colorAttachments:[{view:e.getCurrentTexture().createView(),loadOp:"load",storeOp:"store"}]});U.setPipeline(u.pipeline),U.setBindGroup(0,l),U.setVertexBuffer(0,u.quadBuf),U.draw(4),U.end(),t.queue.submit([F.finish()]),t.popErrorScope().then(D=>{D&&!Ti&&(Ti=true,console.warn("[Viji] overlay: webgpu validation error",D.message))}).catch(()=>{})}catch(u){(!Ti||zi!==t)&&(Ti=true,console.warn("[Viji] overlay: webgpu pass failed",u)),zi=t,sl()}}const il=34229;function dd(e){const t=e;if(typeof t.createVertexArray=="function")return{create:()=>t.createVertexArray(),bind:i=>t.bindVertexArray(i)};const s=e.getExtension("OES_vertex_array_object");return s?{create:()=>s.createVertexArrayOES(),bind:i=>s.bindVertexArrayOES(i)}:null}function Zo(e,t){if(!t)return null;const s=e.getParameter(e.TEXTURE_BINDING_2D),i=e.getParameter(e.UNPACK_FLIP_Y_WEBGL),r=e.getParameter(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL);e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,1),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,0);const a=e.createTexture();return e.bindTexture(e.TEXTURE_2D,a),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),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,t),e.bindTexture(e.TEXTURE_2D,s),e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,i?1:0),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,r?1:0),a}function pd(e){if(ta===e)return;ta=e,Vt=null,Ri=0,Pi=0,ss=null,Gu=Zo(e,ri?.canvas??null),Xu=Zo(e,ni?.canvas??null);const t=e.createShader(e.VERTEX_SHADER);e.shaderSource(t,nd),e.compileShader(t);const s=e.createShader(e.FRAGMENT_SHADER);if(e.shaderSource(s,ad),e.compileShader(s),We=e.createProgram(),e.attachShader(We,t),e.attachShader(We,s),e.bindAttribLocation(We,0,"a_pos"),e.bindAttribLocation(We,1,"a_uv"),e.linkProgram(We),e.deleteShader(t),e.deleteShader(s),!e.getProgramParameter(We,e.LINK_STATUS)){console.warn("[Viji] overlay: shader link failed"),We=null;return}if(Is=e.createBuffer(),jt=e.getAttribLocation(We,"a_pos"),$t=e.getAttribLocation(We,"a_uv"),Zt=dd(e),Zt){const i=e.getParameter(il),r=e.getParameter(e.ARRAY_BUFFER_BINDING);Gi=Zt.create(),Zt.bind(Gi),e.bindBuffer(e.ARRAY_BUFFER,Is),jt>=0&&(e.enableVertexAttribArray(jt),e.vertexAttribPointer(jt,2,e.FLOAT,false,16,0)),$t>=0&&(e.enableVertexAttribArray($t),e.vertexAttribPointer($t,2,e.FLOAT,false,16,8)),Zt.bind(i),e.bindBuffer(e.ARRAY_BUFFER,r)}}function Qo(e,t){return{index:t,buffer:e.getVertexAttrib(t,e.VERTEX_ATTRIB_ARRAY_BUFFER_BINDING),enabled:e.getVertexAttrib(t,e.VERTEX_ATTRIB_ARRAY_ENABLED),size:e.getVertexAttrib(t,e.VERTEX_ATTRIB_ARRAY_SIZE),type:e.getVertexAttrib(t,e.VERTEX_ATTRIB_ARRAY_TYPE),normalized:e.getVertexAttrib(t,e.VERTEX_ATTRIB_ARRAY_NORMALIZED),stride:e.getVertexAttrib(t,e.VERTEX_ATTRIB_ARRAY_STRIDE),offset:e.getVertexAttribOffset(t,e.VERTEX_ATTRIB_ARRAY_POINTER),currentValue:e.getVertexAttrib(t,e.CURRENT_VERTEX_ATTRIB)}}function Jo(e,t){t.buffer&&(e.bindBuffer(e.ARRAY_BUFFER,t.buffer),e.vertexAttribPointer(t.index,t.size,t.type,t.normalized,t.stride,t.offset)),t.enabled?e.enableVertexAttribArray(t.index):e.disableVertexAttribArray(t.index),e.vertexAttrib4f(t.index,t.currentValue[0],t.currentValue[1],t.currentValue[2],t.currentValue[3])}function md(e,t,s){const i=e===yt;i&&Qf(e);const r=i?Ku(s.px,s.py,s.w,s.h,t.width,t.height):null;r&&id(r.w,r.h)?(Rs.clearRect(0,0,r.w,r.h),Rs.drawImage(t,r.x,r.y,r.w,r.h,0,0,r.w,r.h),Ps=r,zu=t.width,Yu=t.height,Bt={buffer:s.buffer.canvas,dx:s.px-r.x,dy:s.py-r.y,dw:s.w,dh:s.h}):(Ps=null,Bt=null),Qu(e),Zu(e),el(e,s.buffer.canvas,s.px,s.py,s.w,s.h),Ju(e),Ma=br}function gd(e,t,s){if(pd(e),!We||!Is)return;const i=s.vertical?Xu:Gu;if(!i)return;const r=Ku(s.px,s.py,s.w,s.h,t.width,t.height);r&&ed(e)?rd(e,t,r):ss=null,rl(e,t,i,{x:s.px,y:s.py,w:s.w,h:s.h},true)}function rl(e,t,s,i,r){if(!We||!Is)return;const a=t.width,o=t.height,u=i.x/a*2-1,l=1-(i.y+i.h)/o*2,h=(i.x+i.w)/a*2-1,p=1-i.y/o*2,m=!!(Zt&&Gi),_=e.getParameter(e.CURRENT_PROGRAM),k=e.getParameter(e.ACTIVE_TEXTURE);e.activeTexture(e.TEXTURE0);const T=e.getParameter(e.TEXTURE_BINDING_2D),P=e.getParameter(e.ARRAY_BUFFER_BINDING),F=e.getParameter(e.FRAMEBUFFER_BINDING),U=e,D=typeof U.createVertexArray=="function",z=D?e.getParameter(U.READ_FRAMEBUFFER_BINDING):null,q=e.getParameter(e.VIEWPORT),Y=e.isEnabled(e.BLEND),K=e.getParameter(e.BLEND_SRC_RGB),Z=e.getParameter(e.BLEND_DST_RGB),X=e.getParameter(e.BLEND_SRC_ALPHA),re=e.getParameter(e.BLEND_DST_ALPHA),x=e.getParameter(e.BLEND_EQUATION_RGB),b=e.getParameter(e.BLEND_EQUATION_ALPHA),v=e.isEnabled(e.DEPTH_TEST),V=e.isEnabled(e.SCISSOR_TEST),W=e.isEnabled(e.STENCIL_TEST),O=e.isEnabled(e.CULL_FACE),R=e.getParameter(e.COLOR_WRITEMASK),B=e.getParameter(e.UNPACK_FLIP_Y_WEBGL),M=m?e.getParameter(il):null,A=!m&&jt>=0?Qo(e,jt):null,H=!m&&$t>=0?Qo(e,$t):null;e.bindFramebuffer(e.FRAMEBUFFER,null),e.viewport(0,0,a,o),e.useProgram(We),r?(e.enable(e.BLEND),e.blendEquation(e.FUNC_ADD),e.blendFuncSeparate(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA)):e.disable(e.BLEND),e.disable(e.DEPTH_TEST),e.disable(e.SCISSOR_TEST),e.disable(e.STENCIL_TEST),e.disable(e.CULL_FACE),e.colorMask(true,true,true,true),e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,0),e.bindTexture(e.TEXTURE_2D,s),e.uniform1i(e.getUniformLocation(We,"u_tex"),0),e.uniform1f(e.getUniformLocation(We,"u_alpha"),1);const G=new Float32Array([u,l,0,0,h,l,1,0,u,p,0,1,u,p,0,1,h,l,1,0,h,p,1,1]);m?(Zt.bind(Gi),e.bindBuffer(e.ARRAY_BUFFER,Is),e.bufferData(e.ARRAY_BUFFER,G,e.DYNAMIC_DRAW)):(e.bindBuffer(e.ARRAY_BUFFER,Is),e.bufferData(e.ARRAY_BUFFER,G,e.DYNAMIC_DRAW),jt>=0&&(e.enableVertexAttribArray(jt),e.vertexAttribPointer(jt,2,e.FLOAT,false,16,0)),$t>=0&&(e.enableVertexAttribArray($t),e.vertexAttribPointer($t,2,e.FLOAT,false,16,8))),e.drawArrays(e.TRIANGLES,0,6),m?Zt.bind(M):(H&&Jo(e,H),A&&Jo(e,A)),e.bindFramebuffer(e.FRAMEBUFFER,F),D&&U.bindFramebuffer(U.READ_FRAMEBUFFER,z),e.viewport(q[0],q[1],q[2],q[3]),e.bindBuffer(e.ARRAY_BUFFER,P),e.colorMask(R[0],R[1],R[2],R[3]),e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,B?1:0),V?e.enable(e.SCISSOR_TEST):e.disable(e.SCISSOR_TEST),W?e.enable(e.STENCIL_TEST):e.disable(e.STENCIL_TEST),O?e.enable(e.CULL_FACE):e.disable(e.CULL_FACE),v?e.enable(e.DEPTH_TEST):e.disable(e.DEPTH_TEST),Y?e.enable(e.BLEND):e.disable(e.BLEND),e.blendFuncSeparate(K,Z,X,re),e.blendEquationSeparate(x,b),e.activeTexture(e.TEXTURE0),e.bindTexture(e.TEXTURE_2D,T),e.activeTexture(k),e.useProgram(_)}class Ba{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(t){this.sceneErrorReporter=t}getSceneErrorReporter(){return this.sceneErrorReporter}setDebugMode(t){this.debugMode=t,this.videoSystems.forEach(s=>s?.setDebugMode(t)),this.parameterSystem&&"setDebugMode"in this.parameterSystem&&this.parameterSystem.setDebugMode(t),this.interactionSystem&&"setDebugMode"in this.interactionSystem&&this.interactionSystem.setDebugMode(t)}debugLog(t,...s){this.debugMode&&console.log(t,...s)}effectiveFrameTimes=[];lastEffectiveRateReport=0;effectiveRateReportInterval=1e3;fetchCacheClient;parameterSystem;interactionSystem;capabilityMonitor=new ef;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:(t,s)=>this.parameterSystem.createSliderParameter(t,s),color:(t,s)=>this.parameterSystem.createColorParameter(t,s),toggle:(t,s)=>this.parameterSystem.createToggleParameter(t,s),select:(t,s)=>this.parameterSystem.createSelectParameter(t,s),text:(t,s)=>this.parameterSystem.createTextParameter(t,s),number:(t,s)=>this.parameterSystem.createNumberParameter(t,s),image:(t,s)=>this.parameterSystem.createImageParameter(t,s),button:t=>this.parameterSystem.createButtonParameter(t),coordinate:(t,s)=>this.parameterSystem.createCoordinateParameter(t,s),useContext:t=>t==="webgpu"?this.canvas?this.canvas.getContext("webgpu"):null:t==="2d"?(!this.ctx&&this.canvas&&(this.ctx=this.canvas.getContext("2d"),this.viji.ctx=this.ctx),this.ctx):t==="webgl"||t==="webgl2"?(!this.gl&&this.canvas&&(this.gl=t==="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 j1((t,s)=>{this.postMessage(t,s)}),this.parameterSystem=new Gh((t,s)=>{this.postMessage(t,s)}),this.interactionSystem=new Xh,this.videoSystems[0]=new ki,this.videoSystems[0].setCVMessaging(0,(t,s)=>{this.postMessage("cv-feature-request",{streamIndex:t,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(t=>{this.postMessage("capability-transition",t)}),this.setupMessageHandling()}setCapabilityUsageMask(t){this.capabilityMonitor.setUsageMask(t)}gatherCapabilityInput(t,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:t,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(t,s,i){this.capabilityMonitor.recordFrame(this.gatherCapabilityInput(t,s,i))}getContextAndFinish(){const t=this.gl;return t&&t.finish(),t}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(t){if(this.gpuCtx===t)return;this.gpuCtx=t;const s=t.configure.bind(t),i=t.unconfigure.bind(t),r=t.getCurrentTexture.bind(t);t.configure=a=>{s(a);const o=this.gpuDevice!==a.device;this.gpuDevice=a.device,this.gpuFormat=a.format,ld(),o&&a.device.lost.then(()=>{this.gpuDevice===a.device&&(this.gpuDevice=null,this.gpuFormat=null)}).catch(()=>{})},t.unconfigure=()=>{i(),this.gpuDevice=null,this.gpuFormat=null},t.getCurrentTexture=()=>(this.gpuTextureAcquiredThisFrame=true,r())}wrapBitmapRenderer(t){if(this.brCtx===t)return;this.brCtx=t;const s=t.transferFromImageBitmap.bind(t);t.transferFromImageBitmap=i=>{const r=qo("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),zo(this.brPresentScratch,this.brPresentCtx,null,r,this._displayScale);const u=this.brPresentScratch.transferToImageBitmap();try{s(u)}catch(l){throw u.close(),l}i.close()}catch(a){this.debugLog("bitmaprenderer overlay composite failed",a),this.brCleanScratch=null;try{s(i)}catch{}}}}plateCaptureSource(t){return t!=="display"&&this.brCleanScratch?this.brCleanScratch:this.canvas}fence2dCanvas(){const t=this.ctx;if(!t)return null;try{const s=performance.now();return t.getImageData(0,0,1,1),performance.now()-s}catch{return null}}fenceWebGLReadback(t){try{t.readPixels(0,0,1,1,t.RGBA,t.UNSIGNED_BYTE,new Uint8Array(4))}catch{}}handleRunFencedBenchmark(t){const s=Math.max(1,Math.floor(t.data.frameCount));if(this.benchmark){this.postMessage("error",{id:t.id,message:"A fenced benchmark is already running",code:"BENCHMARK_BUSY"});return}this.benchmark={id:t.id,remaining:s,samples:[],lastTimestamp:null}}recordBenchmarkFrame(t,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(),u=i.lastTimestamp===null?0:t-i.lastTimestamp;i.lastTimestamp=t;const l=this.capabilityMonitor.evaluate(this.gatherCapabilityInput(t,s,u));i.samples.push({frameIndex:this.frameCount,timestamp:t,cpuMs:s,gpuMs:o,frameIntervalMs:u,capabilities:l}),i.remaining--,i.remaining<=0&&(this.postMessage("run-fenced-benchmark-result",{id:i.id,frames:i.samples}),this.benchmark=null)}async initP5Mode(t,s,i){try{this.rendererType="p5",this.debugLog("🎨 Initializing P5.js mode..."),this.p5Adapter=new pf(this.canvas,this.viji,{setup:t,render:s,canvasMode:i?.canvasMode==="webgl"?"webgl":"2d"}),await this.p5Adapter.init(),this.debugLog("✅ P5.js mode initialized successfully")}catch(r){console.error("❌ Failed to initialize P5.js mode:",r),this.postMessage("error",{message:`P5.js initialization failed: ${r.message}`,code:"P5_INIT_ERROR"}),this.rendererType="native",this.p5Adapter=null}}async initShaderMode(t,s){try{this.rendererType="shader",this.debugLog("🎨 Initializing Shader mode..."),this.shaderAdapter=new Ke(this.canvas,this.viji,t,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){console.error("❌ Failed to initialize Shader mode:",i),this.postMessage("error",{message:`Shader initialization failed: ${i.message}`,code:"SHADER_INIT_ERROR"}),this.rendererType="native",this.shaderAdapter=null}}registerShaderParameter(t){if(t.type==="accumulator")return;const s=t.config,i={...s,name:t.uniformName,label:t.label,description:s.description??""};switch(i.name!==t.uniformName&&(console.error(`[viji] Shader parameter identity mismatch for uniform "${t.uniformName}" — forcing name = uniformName.`),i.name=t.uniformName),t.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"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(t=>t?.resetVideoState()),this.videoSystems[0]&&Object.assign(this.viji.video,this.videoSystems[0].getVideoAPI()),this.updateVijiVideoStreams()}updateVijiVideoStreams(){const t=[],s=[];this.videoSystems.forEach((r,a)=>{if(!r)return;const o=qs(a);o==="additional"?t.push(r):o==="directFrame"&&s.push(r)});const i=[...t,...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 t=[];this.videoSystems.forEach((i,r)=>{if(!i)return;const a=i.peekDebugState();t.push(`${r}:${qs(r)}${a.isConnected?" connected":""}${a.hasFrame?" frame":""}`)});const s=`[${t.join(", ")}] → videoStreams(${this.viji.videoStreams.length})`;s!==this.lastStreamTableSignature&&(this.lastStreamTableSignature=s,this.debugLog(`[Streams] ${s}`))}updateVijiAudioStreams(){const t=[];for(const[s,i]of this.audioStreamStates)s>=Jh&&s<Co&&t.push({index:s,...i});t.sort((s,i)=>s.index-i.index),this.viji.audioStreams.length=t.length;for(let s=0;s<t.length;s++){const i=t[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(t){this.parameterSystem.seedInitialValues(t)}setupMessageHandling(){self.onmessage=t=>{this.dispatchMessage(t.data)}}dispatchMessage(t){switch(t.type){case"init":this.handleInit(t).catch(s=>console.error("[Viji] handleInit failed:",s));break;case"frame-rate-update":this.handleFrameRateUpdate(t);break;case"refresh-rate-update":this.handleRefreshRateUpdate(t);break;case"cv-results-update":this.handleCVResultsUpdate(t);break;case"resolution-update":this.handleResolutionUpdate(t);break;case"set-scene-code":this.handleSetSceneCode(t);break;case"debug-mode":this.setDebugMode(t.data.enabled);break;case"parameter-update":this.handleParameterUpdate(t);break;case"parameter-batch-update":this.handleParameterBatchUpdate(t);break;case"audio-analysis-update":this.handleAudioAnalysisUpdate(t);break;case"audio-stream-setup":this.handleAudioStreamSetup(t);break;case"video-canvas-setup":this.handleVideoCanvasSetup(t);break;case"video-frame-update":this.handleVideoFrameUpdate(t);break;case"video-config-update":this.handleVideoConfigUpdate(t);break;case"video-streams-prepare":this.handleVideoStreamsPrepare(t);break;case"video-frame-direct":this.handleVideoFrameDirect(t);break;case"enable-auto-capture":this.autoCaptureEnabled=t.data.enabled,t.data.flipY!==void 0&&(this.autoCaptureFormat.flipY=t.data.flipY),t.data.frame!==void 0&&(this.autoCaptureFormat.frame=t.data.frame==="display"?"display":"plate"),this.debugLog(`[AutoCapture] ${t.data.enabled?"ENABLED":"DISABLED"} (flipY=${this.autoCaptureFormat.flipY}, frame=${this.autoCaptureFormat.frame})`);break;case"enable-capability-reporting":this.capabilityMonitor.setEnabled(t.data.enabled);break;case"set-render-loop-paused":this.setRenderLoopPaused(t.data.paused);break;case"run-fenced-benchmark":this.handleRunFencedBenchmark(t);break;case"mouse-update":this.handleMouseUpdate(t);break;case"keyboard-update":this.handleKeyboardUpdate(t);break;case"touch-update":this.handleTouchUpdate(t);break;case"interaction-enabled":this.handleInteractionEnabled(t);break;case"device-state-update":this.handleDeviceStateUpdate(t);break;case"performance-update":this.handlePerformanceUpdate(t);break;case"capture-frame":this.handleCaptureFrame(t);break;case"sc-update":$o(t.data.t);break;case"rh-update":Xo(t.data.h);break;case"cached-fetch-begin":this.fetchCacheClient.handleBegin(t.data);break;case"cached-fetch-chunk":this.fetchCacheClient.handleChunk(t.data);break;case"cached-fetch-end":this.fetchCacheClient.handleEnd(t.data);break;case"cached-fetch-direct":this.fetchCacheClient.handleDirect(t.data);break;case"cached-fetch-wait":this.fetchCacheClient.handleWait(t.data);break;case"cached-fetch-error":this.fetchCacheClient.handleError(t.data);break}}async handleInit(t){try{this.canvas=t.data.canvas,this.viji.canvas=this.canvas,this._isHeadless=!!t.data.isHeadless,t.data.reporterConfig&&this.sceneErrorReporter&&this.sceneErrorReporter.applyConfig(t.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,Zf(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 Gf(),t.data.sc&&await $o(t.data.sc),cd(this.canvas),t.data.rh!==void 0&&Xo(t.data.rh),t.data.controlPort&&(this.controlPort=t.data.controlPort,this.controlPort.onmessage=i=>{this.dispatchMessage(i.data)}),this.startRenderLoop(),self.postMessage({type:"init-response",id:t.id,timestamp:Date.now(),data:{id:t.id}})}catch(s){this.postMessage("error",{id:t.id,message:s.message,code:"INIT_ERROR"})}}handleFrameRateUpdate(t){t.data&&t.data.mode&&(this.frameRateMode=t.data.mode,this.frameSkipCounter=0,this.debugLog("Frame rate mode updated to:",t.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(t){t.data&&t.data.screenRefreshRate&&(this.screenRefreshRate=t.data.screenRefreshRate,this.debugLog("Screen refresh rate updated to:",t.data.screenRefreshRate+"Hz"))}trackEffectiveFrameTime(t){this.effectiveFrameTimes.push(t),this.effectiveFrameTimes.length>60&&this.effectiveFrameTimes.shift()}reportPerformanceStats(t){if(t-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=t}}handleResolutionUpdate(t){if(t.data){const s=Math.round(t.data.effectiveWidth),i=Math.round(t.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,ia()),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=t.data.displayScale??1,this.debugLog("Canvas resolution updated to:",this.viji.width+"x"+this.viji.height)}}handleParameterUpdate(t){t.data&&t.data.name!==void 0&&t.data.value!==void 0&&this.parameterSystem.updateParameterValue(t.data.name,t.data.value)}handleParameterBatchUpdate(t){if(t.data&&t.data.updates){for(const s of t.data.updates)this.parameterSystem.updateParameterValue(s.name,s.value);this.parameterSystem.markInitialValuesSynced(),this.debugLog("Parameter system initialized successfully")}}handleCVResultsUpdate(t){const s=this.videoSystems[t.data.streamIndex];if(s)s.handleCVResultsUpdate(t.data);else if(t.data.analysedFrame)try{t.data.analysedFrame.close()}catch{}}handleAudioAnalysisUpdate(t){const s=t.data,i=s.streamIndex??0;i===0?this.handleMainAudioUpdate(s):this.handleAdditionalAudioUpdate(i,s)}handleMainAudioUpdate(t){const s=this.viji.audio;if(s.isConnected=t.isConnected,s.volume.current=t.volume.current,s.volume.peak=t.volume.peak,s.volume.smoothed=t.volume.smoothed,s.bands.low=t.bands.low,s.bands.lowMid=t.bands.lowMid,s.bands.mid=t.bands.mid,s.bands.highMid=t.bands.highMid,s.bands.high=t.bands.high,s.bands.lowSmoothed=t.bands.lowSmoothed,s.bands.lowMidSmoothed=t.bands.lowMidSmoothed,s.bands.midSmoothed=t.bands.midSmoothed,s.bands.highMidSmoothed=t.bands.highMidSmoothed,s.bands.highSmoothed=t.bands.highSmoothed,t.beat){s.beat.kick=t.beat.kick,s.beat.snare=t.beat.snare,s.beat.hat=t.beat.hat,s.beat.any=t.beat.any,s.beat.kickSmoothed=t.beat.kickSmoothed,s.beat.snareSmoothed=t.beat.snareSmoothed,s.beat.hatSmoothed=t.beat.hatSmoothed,s.beat.anySmoothed=t.beat.anySmoothed;const i=t.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=t.beat.bpm,s.beat.confidence=t.beat.confidence,s.beat.isLocked=t.beat.isLocked}s.spectral.brightness=t.spectral.brightness,s.spectral.flatness=t.spectral.flatness,this.audioFrequencyData=new Uint8Array(t.frequencyData),this.audioWaveformData=t.waveformData?new Float32Array(t.waveformData):new Float32Array(0)}handleAdditionalAudioUpdate(t,s){const i=new Uint8Array(s.frequencyData),r=s.waveformData?new Float32Array(s.waveformData):new Float32Array(0),a=this.audioStreamStates.get(t);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(t,{isConnected:s.isConnected,volume:{...s.volume},bands:{...s.bands},spectral:{...s.spectral},frequencyData:i,waveformData:r}),this.updateVijiAudioStreams(),t>=Co&&this.wireDeviceAudio(t)}wireDeviceAudio(t){const s=this.audioStreamStates.get(t);if(!s)return;let i;for(const[a,o]of this.deviceAudioMap)if(o===t){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(t){const{streamIndex:s,streamType:i,deviceId:r}=t.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 t=this.viji.audio.beat.triggers;t.kick=false,t.snare=false,t.hat=false,t.any=false,this.viji.audio.beat.events.length=0}resetAudioState(){const t=this.viji.audio;t.isConnected=false,t.volume.current=0,t.volume.peak=0,t.volume.smoothed=0,t.bands.low=0,t.bands.lowMid=0,t.bands.mid=0,t.bands.highMid=0,t.bands.high=0,t.bands.lowSmoothed=0,t.bands.lowMidSmoothed=0,t.bands.midSmoothed=0,t.bands.highMidSmoothed=0,t.bands.highSmoothed=0,t.beat.kick=0,t.beat.snare=0,t.beat.hat=0,t.beat.any=0,t.beat.kickSmoothed=0,t.beat.snareSmoothed=0,t.beat.hatSmoothed=0,t.beat.anySmoothed=0,t.beat.triggers.kick=false,t.beat.triggers.snare=false,t.beat.triggers.hat=false,t.beat.triggers.any=false,t.beat.events.length=0,t.beat.bpm=0,t.beat.confidence=0,t.beat.isLocked=false,t.spectral.brightness=0,t.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(t){const{streamIndex:s,deviceId:i}=t.data,r=s||0,a=qs(r);let o=this.videoSystems[r];const u=!!o;switch(o||(o=new ki,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:t.data.offscreenCanvas,width:t.data.width,height:t.data.height,timestamp:t.data.timestamp}),this.debugLog(`Video system ${u?"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(t){const s=t.data.streamIndex||0,i=this.videoSystems[s];if(i){i.handleFrameUpdate({imageBitmap:t.data.imageBitmap,timestamp:t.data.timestamp});const r=qs(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(u=>u.id===a);o&&(o.video?Object.assign(o.video,i.getVideoAPI()):o.video=i.getVideoAPI())}}}}handleVideoConfigUpdate(t){const s=t.data.streamIndex||0,i=this.videoSystems[s];if(i){const r=qs(s),a=i.getDeviceId();if(t.data.disconnect&&r==="device"&&a){this.deviceVideoMap.delete(a);const o=this.viji.devices.find(u=>u.id===a);o&&(o.video=null)}if(i.handleVideoConfigUpdate({...t.data.targetFrameRate&&{targetFrameRate:t.data.targetFrameRate},...t.data.cvConfig&&{cvConfig:t.data.cvConfig},...t.data.width&&{width:t.data.width},...t.data.height&&{height:t.data.height},...t.data.disconnect&&{disconnect:t.data.disconnect},timestamp:t.data.timestamp}),r==="main")Object.assign(this.viji.video,i.getVideoAPI());else if(r==="device"&&a&&!t.data.disconnect){const o=this.viji.devices.find(u=>u.id===a);o&&(o.video?Object.assign(o.video,i.getVideoAPI()):o.video=i.getVideoAPI())}}}handleVideoStreamsPrepare(t){const{directFrameBaseIndex:s,directFrameCount:i}=t.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 ki),this.videoSystems[a].setDebugMode(this.debugMode),this.videoSystems[a].initializeForDirectFrames(this.rendererType)}this.updateVijiVideoStreams(),this.debugLog(`[Compositor] Prepared ${i} direct frame slot(s)`)}handleVideoFrameDirect(t){const s=t.data.streamIndex||0;this.videoSystems[s]||(this.debugLog(`[Compositor] Creating new VideoSystem at index ${s} for direct frames`),this.videoSystems[s]=new ki,this.videoSystems[s].setDebugMode(this.debugMode),this.videoSystems[s].initializeForDirectFrames(this.rendererType)),this.videoSystems[s].handleDirectFrame(t.data)}handlePerformanceUpdate(t){this.debugLog("Performance update:",t.data)}async handleCaptureFrame(t){this.pendingCaptures.push({queuedAt:performance.now(),message:t}),this.debugLog(`Capture queued: ${t.data.format||"blob"} (${this.pendingCaptures.length} pending)`)}async executeCaptureFrame(t){try{if(!this.canvas)throw new Error("Canvas not initialized");if((t.data.format||"blob")==="bitmap"){const Y=this.plateCaptureSource(t.data.frame),K=Y===this.canvas?Y.transferToImageBitmap():await createImageBitmap(Y);this.postMessage("capture-frame-result",{id:t.id,bitmap:K},[K]);return}const i=t.data.type||"image/jpeg",r=this.canvas.width,a=this.canvas.height;let o=r,u=a;if(typeof t.data.resolution=="number"){const Y=t.data.resolution>0?t.data.resolution:1;o=Math.max(1,Math.floor(r*Y)),u=Math.max(1,Math.floor(a*Y))}else t.data.resolution&&typeof t.data.resolution=="object"&&(o=Math.max(1,Math.floor(t.data.resolution.width)),u=Math.max(1,Math.floor(t.data.resolution.height)));const l=r/a,h=o/u;let p=0,m=0,_=r,k=a;Math.abs(l-h)>1e-6&&(h>l?(k=Math.floor(r/h),m=Math.floor((a-k)/2)):(_=Math.floor(a*h),p=Math.floor((r-_)/2)));let T;const P=this.getContextAndFinish();if(P){const Y=t.data.frame==="display",K=Y?P.getParameter(P.FRAMEBUFFER_BINDING):null;Y&&P.bindFramebuffer(P.FRAMEBUFFER,null);const Z=new Uint8Array(r*a*4);P.readPixels(0,0,r,a,P.RGBA,P.UNSIGNED_BYTE,Z),Y&&P.bindFramebuffer(P.FRAMEBUFFER,K);const X=new Uint8ClampedArray(r*a*4);for(let b=0;b<a;b++){const v=(a-1-b)*r*4,V=b*r*4;X.set(Z.subarray(v,v+r*4),V)}T=new OffscreenCanvas(r,a);const re=T.getContext("2d");if(!re)throw new Error("Failed to create source context");const x=new ImageData(X,r,a);re.putImageData(x,0,0),this.debugLog("Captured frame from WebGL using readPixels (post-render)")}else T=this.plateCaptureSource(t.data.frame),this.debugLog("Captured frame from canvas directly (post-render)");const F=new OffscreenCanvas(o,u),U=F.getContext("2d");if(!U)throw new Error("Failed to get 2D context");U.drawImage(T,p,m,_,k,0,0,o,u);const D=t.data.quality,z=typeof D=="number"&&Number.isFinite(D)?Math.min(1,Math.max(0,D)):void 0,q=await F.convertToBlob(z!==void 0?{type:i,quality:z}:{type:i});this.postMessage("capture-frame-result",{id:t.id,blob:q})}catch(s){this.postMessage("error",{id:t.id,message:s.message,code:"CAPTURE_FRAME_ERROR"})}}handleSetSceneCode(t){let s=false;const i={resolve:u=>{s||(s=true,this.postMessage("scene-analysis",{id:t.id,...u}))},reject:u=>{s||(s=true,this.postMessage("error",{id:t.id,...u}))}},r=t.data?.sceneCode;if(typeof r!="string"){i.reject({message:"set-scene-code carried no scene code",code:"SCENE_ANALYSIS_ERROR"});return}const a={...t.data?.initialParameters&&{initialParameters:t.data.initialParameters},...t.data?.sk&&{keyComponent:t.data.sk}},o=self.setSceneCode;o(r,a,i).catch(u=>{const l=u;i.reject({message:`Scene load failed before analysis ack: ${l?.message??String(u)}`,code:"SCENE_ANALYSIS_ERROR"})})}startRenderLoop(){this.isRunning=true,this.startTime=performance.now(),this.lastTime=this.startTime,this.renderFrame()}runCaptures(t){for(const{message:s}of t)this.executeCaptureFrame(s).catch(i=>{console.error("Capture execution error:",i)})}runAutoCapture(){if(!(!this.autoCaptureEnabled||!this.canvas))try{const t=this.autoCaptureFormat.flipY?{imageOrientation:"flipY"}:{};createImageBitmap(this.plateCaptureSource(this.autoCaptureFormat.frame),t).then(s=>{this.postMessage("auto-capture-result",{bitmap:s,timestamp:performance.now()},[s])}).catch(s=>{console.warn("[AutoCapture] ImageBitmap creation failed:",s)})}catch(t){console.warn("[AutoCapture] Failed:",t)}}renderFrame(){if(!this.isRunning)return;this.gpuTextureAcquiredThisFrame=false;const t=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=t-this.lastTime;this.viji.deltaTime=(t-this.lastTime)/1e3,this.viji.time=(t-this.startTime)/1e3,this.viji.frameCount=++this.frameCount,this.trackEffectiveFrameTime(t),this.lastTime=t,this.interactionSystem.updatePointerState(),!this._isHeadless&&this.canvas&&td(this.canvas,this.ctx,this.gl);const a=performance.now();let o=false;try{if(this.shaderAdapter&&this.rendererType==="shader"){const p=this.parameterSystem.getAllParameterObjects();o=this.shaderAdapter.render(this.viji,p)}else if(this.p5Adapter&&this.rendererType==="p5"){const p=this.parameterSystem.getAllParameterObjects();o=this.p5Adapter.tick(this.viji,p)}else{const p=self.renderFunction;p&&typeof p=="function"&&(p(this.viji),o=true)}}catch(p){const m=p;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 u=o&&this.contextAcquired;if(u&&this.sceneErrorReporter&&this.sceneErrorReporter.markFirstFrameProduced(),this.benchmark){const p=performance.now()-a;this.recordBenchmarkFrame(t,p)}else if(this.capabilityMonitor.isEnabled()){const p=performance.now()-a;this.recordCapabilityFrame(t,p,r)}if(this.parameterSystem.resetButtonParameters(),this.pendingCaptures.length>0){const p=performance.now()-Ba.CAPTURE_QUEUE_TTL_MS;this.pendingCaptures=this.pendingCaptures.filter(m=>m.queuedAt>=p)}let l=[],h=[];if(u){const p=this.pendingCaptures;this.pendingCaptures=[],h=p.filter(m=>m.message.data.frame==="display"),l=p.filter(m=>m.message.data.frame!=="display")}if(this.runCaptures(l),u&&this.autoCaptureFormat.frame!=="display"&&this.runAutoCapture(),!this._isHeadless&&this.canvas){const p=qo("b",0);zo(this.canvas,this.ctx,this.gl,p,this._displayScale),u&&this.gpuTextureAcquiredThisFrame&&this.gpuCtx&&this.gpuDevice&&this.gpuFormat&&fd(this.gpuCtx,this.gpuDevice,this.gpuFormat,this.canvas,p,this._displayScale)}this.runCaptures(h),u&&this.autoCaptureFormat.frame==="display"&&this.runAutoCapture()}this.benchmark||this.reportPerformanceStats(t),this.interactionSystem.frameStart(),this.resetAudioFrameEvents(),this.scheduleNextFrame()}scheduleNextFrame(){this.rafScheduled||!this.isRunning||(this.rafScheduled=true,requestAnimationFrame(()=>{this.rafScheduled=false,this.renderFrame()}))}setRenderLoopPaused(t){t!==this.renderLoopPaused&&(this.renderLoopPaused=t,t?this.isRunning=false:(this.isRunning=true,this.scheduleNextFrame()))}postMessage(t,s,i){const r={type:t,id:s?.id||`${t}_${Date.now()}`,timestamp:Date.now(),data:s};this.controlPort?this.controlPort.postMessage(r,i??[]):self.postMessage(r,i??[])}handleMouseUpdate(t){this.interactionSystem.handleMouseUpdate(t.data)}handleKeyboardUpdate(t){this.interactionSystem.handleKeyboardUpdate(t.data)}handleTouchUpdate(t){this.interactionSystem.handleTouchUpdate(t.data)}handleInteractionEnabled(t){this.interactionSystem.setInteractionEnabled(t.data.enabled)}handleDeviceStateUpdate(t){this.deviceState=t.data,this.viji.device=this.deviceState.device;const s=this.deviceState.devices.map(i=>{const r=this.viji.devices.find(p=>p.id===i.id),a=this.deviceVideoMap.get(i.id),o=a!==void 0?this.videoSystems[a]:void 0,u=this.deviceAudioMap.get(i.id),l=u!==void 0?this.audioStreamStates.get(u):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 Ys{static detectRendererType(t){return/\/\/\s*@renderer\s+shader|\/\*\s*@renderer\s+shader\s*\*\//.test(t)?"shader":/\/\/\s*@renderer\s+p5|\/\*\s*@renderer\s+p5\s*\*\//.test(t)?"p5":"native"}static detectP5CanvasMode(t){return/\/\/\s*@renderer\s+p5\s+webgl\b|\/\*\s*@renderer\s+p5\s+webgl\s*\*\//i.test(t)?"webgl":"2d"}static detectCapabilities(t,s){const i=this.stripCommentsAndStrings(t),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(t){let s="";const i=t.length;let r=0;for(;r<i;){const a=t[r],o=r+1<i?t[r+1]:"";if(a==="/"&&o==="/"){for(r+=2;r<i&&t[r]!==`
464
+ `;)r++;continue}if(a==="/"&&o==="*"){for(r+=2;r<i&&!(t[r]==="*"&&t[r+1]==="/");)r++;r+=2,s+=" ";continue}if(a==='"'||a==="'"||a==="`"){const u=a;for(r++;r<i;){if(t[r]==="\\"){r+=2;continue}if(t[r]===u){r++;break}r++}s+=" ";continue}s+=a,r++}return s}static detectShaderCapabilities(t,s){/\bu_audio\w*/.test(t)&&(s.audio=true),/\bu_video\w*/.test(t)&&(s.video=true),/\bu_mouse\w*/.test(t)&&(s.mouse=true),/\bu_key\w*/.test(t)&&(s.keyboard=true),/\bu_touch\w*/.test(t)&&(s.touch=true),/\bu_pointer\w*/.test(t)&&(s.pointer=true),/\bu_device(Acceleration|AccelerationGravity|RotationRate|OrientationAbsolute|Orientation)\b/.test(t)&&(s.sensors=true),/\bu_device[0-7](AccelerationGravity|Acceleration|RotationRate|Orientation)\b/.test(t)&&(s.sensors=true,s.devices=true),/\bu_externalDeviceCount\b/.test(t)&&(s.devices=true,s.sensors=true),(/\bu_deviceCount\b/.test(t)||/\bu_device[0-7](Resolution|Connected)?\b/.test(t))&&(s.video=true,s.devices=true),/\bu_face\w*/.test(t)&&(s.cv.faceDetection=true),/\bu_face0(Neutral|Happy|Sad|Angry|Surprised|Disgusted|Fearful)\b/.test(t)&&(s.cv.emotion=true),(/\bu_face0HeadPose\b/.test(t)||/\bu_videoAnalysed\w*/.test(t)||/\bu_face0(Brow|Cheek|Eye|Jaw|Mouth|Nose|Tongue)\w*/.test(t))&&(s.cv.faceMesh=true),(/\bu_handCount\b/.test(t)||/\bu_(left|right)Hand\w*/.test(t))&&(s.cv.handTracking=true),(/\bu_pose\w*/.test(t)||/\bu_(nose|leftShoulder|rightShoulder|leftElbow|rightElbow|leftWrist|rightWrist|leftHip|rightHip|leftKnee|rightKnee|leftAnkle|rightAnkle)Position\b/.test(t))&&(s.cv.poseDetection=true),/\bu_segmentation\w*/.test(t)&&(s.cv.segmentation=true)}static detectScriptCapabilities(t,s){/\bviji\.audio/.test(t)&&(s.audio=true),/\bviji\.video/.test(t)&&(s.video=true),/\bviji\.mouse/.test(t)&&(s.mouse=true),/\bviji\.keyboard/.test(t)&&(s.keyboard=true),/\bviji\.touches/.test(t)&&(s.touch=true),/\bviji\.pointer/.test(t)&&(s.pointer=true),/\bviji\.device\b/.test(t)&&(s.sensors=true),/\bviji\.devices/.test(t)&&(s.devices=true),/\bviji\.(slider|color|toggle|select|text|number|image|button|coordinate)\s*\(/.test(t)&&(s.parameters=true),/\benableFaceDetection\b/.test(t)&&(s.cv.faceDetection=true),/\benableFaceMesh\b/.test(t)&&(s.cv.faceMesh=true),/\benableEmotionDetection\b/.test(t)&&(s.cv.emotion=true),/\benableHandTracking\b/.test(t)&&(s.cv.handTracking=true),/\benablePoseDetection\b/.test(t)&&(s.cv.poseDetection=true),/\benableBodySegmentation\b/.test(t)&&(s.cv.segmentation=true)}static detectAnalysedFrameUse(t){const s=this.stripCommentsAndStrings(t);return/\b(analysedFrame|getAnalysedFrameData)\b/.test(s)||/\bu_videoAnalysed\w*/.test(s)}static detectUsage(t,s){const i=this.stripCommentsAndStrings(t),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(e){const t=Ys.detectRendererType(e),s=t==="p5"?Ys.detectP5CanvasMode(e):void 0;return{renderer:t,...s!==void 0&&{p5CanvasMode:s},capabilities:Ys.detectCapabilities(e,t),consumesAnalysedFrame:Ys.detectAnalysedFrameUse(e)}}const Va=5,yd=(1<<Va)-1,_d=1<<Va,xd=(()=>{const e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t=new Int8Array(128).fill(-1);for(let s=0;s<e.length;s++)t[e.charCodeAt(s)]=s;return t})();function Hs(e,t){let s=0,i=0,r;do{if(t.index>=e.length)throw new Error("VLQ decode: unexpected end of input");const o=e.charCodeAt(t.index++),u=o<128?xd[o]:-1;if(u<0)throw new Error(`VLQ decode: invalid base64 character '${e[t.index-1]}'`);r=u&_d,s+=(u&yd)<<i,i+=Va}while(r);const a=s&1;return s>>>=1,a?-s:s}function vd(e,t){const s=[];if(e.length===0)return s;let i=0;const r=e.split(",");for(const a of r){if(a.length===0)continue;const o={index:0};i+=Hs(a,o);const u={generatedColumn:i};o.index<a.length&&(t.sourceIndex+=Hs(a,o),t.sourceLine+=Hs(a,o),t.sourceColumn+=Hs(a,o),u.sourceLine=t.sourceLine,u.sourceColumn=t.sourceColumn,o.index<a.length&&(t.nameIndex+=Hs(a,o))),s.push(u)}return s}function kd(e){const t=e.split(";"),s=[],i={sourceIndex:0,sourceLine:0,sourceColumn:0,nameIndex:0};for(const r of t){const a=vd(r,i);s.push(a)}return{lines:s}}function wd(e,t,s){if(t<1||t>e.lines.length)return null;const i=e.lines[t-1];if(i.length===0)return null;const r=s-1;let a=0,o=i.length-1,u=-1;for(;a<=o;){const h=a+o>>>1;i[h].generatedColumn<=r?(u=h,a=h+1):o=h-1}if(u<0)return null;const l=i[u];return l.sourceLine===void 0||l.sourceColumn===void 0?null:{line:l.sourceLine+1,column:l.sourceColumn+1}}const Ed={errorCoalescingWindowMs:1e3,consoleCoalescingWindowMs:1e3,consoleArgMaxBytes:512,consoleMaxArgsPerCall:8,consoleMaxUniqueSignaturesPerSecond:32},ec=8192,Sd=`
465
+ ...[stack truncated by viji core]`;class Td{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(t,s={}){this.config={...Ed,...s},this.post=t,this.errorChannel=new tc(this.config.errorCoalescingWindowMs,i=>this.postEnvelope("scene-error",i)),this.consoleChannel=new tc(this.config.consoleCoalescingWindowMs,i=>this.postEnvelope("scene-console",i)),this.detectFunctionBodyOffset()}applyConfig(t){t.errorCoalescingWindowMs!==void 0&&(this.config.errorCoalescingWindowMs=t.errorCoalescingWindowMs,this.errorChannel.setWindowMs(t.errorCoalescingWindowMs)),t.consoleCoalescingWindowMs!==void 0&&(this.config.consoleCoalescingWindowMs=t.consoleCoalescingWindowMs,this.consoleChannel.setWindowMs(t.consoleCoalescingWindowMs)),t.consoleArgMaxBytes!==void 0&&(this.config.consoleArgMaxBytes=t.consoleArgMaxBytes),t.consoleMaxArgsPerCall!==void 0&&(this.config.consoleMaxArgsPerCall=t.consoleMaxArgsPerCall),t.consoleMaxUniqueSignaturesPerSecond!==void 0&&(this.config.consoleMaxUniqueSignaturesPerSecond=t.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(t){if(t===null){this.currentSourceMap=null;return}try{this.currentSourceMap=kd(t)}catch{this.currentSourceMap=null}}reportSceneError(t){const s=t.stack,i=t.sourceOverride?{source:t.sourceOverride,sourceLocation:t.sourceLocationOverride}:this.attributeFromStack(s),r=t.sourceLocationOverride??i.sourceLocation,a=this.hasProducedFirstFrame?"render":"init",o=sc([t.message,t.code,r?`${r.line}:${r.column??"?"}`:"no-loc"]),u=s!==void 0&&s.length>ec?s.slice(0,ec)+Sd:s,l={message:t.message,...u!==void 0&&{stack:u},source:i.source,phase:a,code:t.code,signatureHash:o,count:1,firstSeenAt:0,lastSeenAt:0,...r!==void 0&&{sourceLocation:r}};this.errorChannel.emit(o,l)}makeArtistConsole(t){const s=Object.create(t),i=["log","info","warn","error"];for(const r of i)s[r]=(...a)=>{try{t[r](...a)}catch{}this.forwardConsoleCall(r,a)};return s}forwardConsoleCall(t,s){const r=(s.length>this.config.consoleMaxArgsPerCall?[...s.slice(0,this.config.consoleMaxArgsPerCall),"…[truncated args]"]:s).map(p=>Cd(p,this.config.consoleArgMaxBytes)),a=sc([t,...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:t,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 t=new Error().stack;if(t)return this.attributeFromStack(t).sourceLocation}attributeFromStack(t){if(!t)return{source:"engine"};const s=t.split(`
466
+ `);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(t){switch(this.stackDialect){case"spidermonkey":{const s=t.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(t.trim())?{}:null;case"v8":case"unknown":default:{const s=t.match(/\(?(<anonymous>):(\d+):(\d+)\)?$/);return!s||s[1]!==this.functionBodySourceId?null:{line:parseInt(s[2],10),column:parseInt(s[3],10)}}}}resolveLocation(t,s){const i=t-this.functionBodyLineOffset;if(!(i<1)){if(this.currentSourceMap){const r=wd(this.currentSourceMap,i,s);if(r)return{line:r.line,column:r.column}}return{line:i}}}detectFunctionBodyOffset(){const t="__viji_offset_probe__";try{new Function("viji","console",`throw new Error(${JSON.stringify(t)});`)(null,null)}catch(s){const r=s?.stack;if(!r)return;const a=r.split(`
467
+ `);for(const o of a){const u=o.match(/\(?(<anonymous>):(\d+):(\d+)\)?$/);if(u){this.stackDialect="v8",this.functionBodySourceId=u[1],this.functionBodyLineOffset=parseInt(u[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(t,s){this.post({type:t,id:`${t}_${s.signatureHash}_${++this.envelopeSeq}`,timestamp:Date.now(),data:s})}}class tc{windowMs;emitFn;pending=new Map;constructor(t,s){this.windowMs=t,this.emitFn=s}setWindowMs(t){this.windowMs=t}hasPending(t){return this.pending.has(t)}emit(t,s){const i=Date.now(),r=this.pending.get(t);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(t),this.windowMs);return}s.count=1,s.firstSeenAt=i,s.lastSeenAt=i,this.emitFn(s);const a=setTimeout(()=>this.flush(t),this.windowMs);this.pending.set(t,{payload:s,timer:a,lastEmittedCount:1})}flush(t){const s=this.pending.get(t);!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 t of this.pending.values())t.timer!==null&&(clearTimeout(t.timer),t.timer=null,t.payload.count>t.lastEmittedCount&&this.emitFn(t.payload));this.pending.clear()}destroy(){for(const t of this.pending.values())t.timer!==null&&clearTimeout(t.timer);this.pending.clear()}}function Cd(e,t){const s="…[truncated]";let i;try{e===void 0?i="undefined":e===null?i="null":typeof e=="string"?i=e:typeof e=="number"||typeof e=="boolean"||typeof e=="bigint"?i=String(e):typeof e=="function"?i=`[Function: ${e.name||"anonymous"}]`:typeof e=="symbol"?i=e.toString():e instanceof Error?i=`${e.name}: ${e.message}`:i=Ad(e)}catch{i="[unstringifiable]"}return i.length>t?i.slice(0,Math.max(0,t-s.length))+s:i}function Ad(e){const t=new WeakSet;try{return JSON.stringify(e,function(s,i){if(typeof i=="object"&&i!==null){if(t.has(i))return"[Circular]";if(t.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 sc(e){let i=2166136261;const a=e.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(e){e[e.NONE=0]="NONE";const s=1;e[e._abstract=s]="_abstract";const i=s+1;e[e._accessor=i]="_accessor";const r=i+1;e[e._as=r]="_as";const a=r+1;e[e._assert=a]="_assert";const o=a+1;e[e._asserts=o]="_asserts";const u=o+1;e[e._async=u]="_async";const l=u+1;e[e._await=l]="_await";const h=l+1;e[e._checks=h]="_checks";const p=h+1;e[e._constructor=p]="_constructor";const m=p+1;e[e._declare=m]="_declare";const _=m+1;e[e._enum=_]="_enum";const k=_+1;e[e._exports=k]="_exports";const T=k+1;e[e._from=T]="_from";const P=T+1;e[e._get=P]="_get";const F=P+1;e[e._global=F]="_global";const U=F+1;e[e._implements=U]="_implements";const D=U+1;e[e._infer=D]="_infer";const z=D+1;e[e._interface=z]="_interface";const q=z+1;e[e._is=q]="_is";const Y=q+1;e[e._keyof=Y]="_keyof";const K=Y+1;e[e._mixins=K]="_mixins";const Z=K+1;e[e._module=Z]="_module";const X=Z+1;e[e._namespace=X]="_namespace";const re=X+1;e[e._of=re]="_of";const x=re+1;e[e._opaque=x]="_opaque";const b=x+1;e[e._out=b]="_out";const v=b+1;e[e._override=v]="_override";const V=v+1;e[e._private=V]="_private";const W=V+1;e[e._protected=W]="_protected";const O=W+1;e[e._proto=O]="_proto";const R=O+1;e[e._public=R]="_public";const B=R+1;e[e._readonly=B]="_readonly";const M=B+1;e[e._require=M]="_require";const A=M+1;e[e._satisfies=A]="_satisfies";const H=A+1;e[e._set=H]="_set";const G=H+1;e[e._static=G]="_static";const te=G+1;e[e._symbol=te]="_symbol";const ce=te+1;e[e._type=ce]="_type";const oe=ce+1;e[e._unique=oe]="_unique";const w=oe+1;e[e._using=w]="_using"})(g||(g={}));var n;(function(e){e[e.PRECEDENCE_MASK=15]="PRECEDENCE_MASK";const s=16;e[e.IS_KEYWORD=s]="IS_KEYWORD";const i=32;e[e.IS_ASSIGN=i]="IS_ASSIGN";const r=64;e[e.IS_RIGHT_ASSOCIATIVE=r]="IS_RIGHT_ASSOCIATIVE";const a=128;e[e.IS_PREFIX=a]="IS_PREFIX";const o=256;e[e.IS_POSTFIX=o]="IS_POSTFIX";const u=512;e[e.IS_EXPRESSION_START=u]="IS_EXPRESSION_START";const l=512;e[e.num=l]="num";const h=1536;e[e.bigint=h]="bigint";const p=2560;e[e.decimal=p]="decimal";const m=3584;e[e.regexp=m]="regexp";const _=4608;e[e.string=_]="string";const k=5632;e[e.name=k]="name";const T=6144;e[e.eof=T]="eof";const P=7680;e[e.bracketL=P]="bracketL";const F=8192;e[e.bracketR=F]="bracketR";const U=9728;e[e.braceL=U]="braceL";const D=10752;e[e.braceBarL=D]="braceBarL";const z=11264;e[e.braceR=z]="braceR";const q=12288;e[e.braceBarR=q]="braceBarR";const Y=13824;e[e.parenL=Y]="parenL";const K=14336;e[e.parenR=K]="parenR";const Z=15360;e[e.comma=Z]="comma";const X=16384;e[e.semi=X]="semi";const re=17408;e[e.colon=re]="colon";const x=18432;e[e.doubleColon=x]="doubleColon";const b=19456;e[e.dot=b]="dot";const v=20480;e[e.question=v]="question";const V=21504;e[e.questionDot=V]="questionDot";const W=22528;e[e.arrow=W]="arrow";const O=23552;e[e.template=O]="template";const R=24576;e[e.ellipsis=R]="ellipsis";const B=25600;e[e.backQuote=B]="backQuote";const M=27136;e[e.dollarBraceL=M]="dollarBraceL";const A=27648;e[e.at=A]="at";const H=29184;e[e.hash=H]="hash";const G=29728;e[e.eq=G]="eq";const te=30752;e[e.assign=te]="assign";const ce=32640;e[e.preIncDec=ce]="preIncDec";const oe=33664;e[e.postIncDec=oe]="postIncDec";const w=34432;e[e.bang=w]="bang";const S=35456;e[e.tilde=S]="tilde";const N=35841;e[e.pipeline=N]="pipeline";const L=36866;e[e.nullishCoalescing=L]="nullishCoalescing";const j=37890;e[e.logicalOR=j]="logicalOR";const se=38915;e[e.logicalAND=se]="logicalAND";const ne=39940;e[e.bitwiseOR=ne]="bitwiseOR";const pe=40965;e[e.bitwiseXOR=pe]="bitwiseXOR";const Ee=41990;e[e.bitwiseAND=Ee]="bitwiseAND";const ke=43015;e[e.equality=ke]="equality";const Fe=44040;e[e.lessThan=Fe]="lessThan";const ze=45064;e[e.greaterThan=ze]="greaterThan";const Ie=46088;e[e.relationalOrEqual=Ie]="relationalOrEqual";const Ve=47113;e[e.bitShiftL=Ve]="bitShiftL";const je=48137;e[e.bitShiftR=je]="bitShiftR";const ls=49802;e[e.plus=ls]="plus";const ws=50826;e[e.minus=ws]="minus";const $s=51723;e[e.modulo=$s]="modulo";const Tr=52235;e[e.star=Tr]="star";const Cr=53259;e[e.slash=Cr]="slash";const Ar=54348;e[e.exponent=Ar]="exponent";const Ir=55296;e[e.jsxName=Ir]="jsxName";const Rr=56320;e[e.jsxText=Rr]="jsxText";const Pr=57344;e[e.jsxEmptyText=Pr]="jsxEmptyText";const Lr=58880;e[e.jsxTagStart=Lr]="jsxTagStart";const Dr=59392;e[e.jsxTagEnd=Dr]="jsxTagEnd";const Nr=60928;e[e.typeParameterStart=Nr]="typeParameterStart";const Fr=61440;e[e.nonNullAssertion=Fr]="nonNullAssertion";const Ur=62480;e[e._break=Ur]="_break";const Mr=63504;e[e._case=Mr]="_case";const Or=64528;e[e._catch=Or]="_catch";const Br=65552;e[e._continue=Br]="_continue";const Vr=66576;e[e._debugger=Vr]="_debugger";const jr=67600;e[e._default=jr]="_default";const $r=68624;e[e._do=$r]="_do";const qr=69648;e[e._else=qr]="_else";const Hr=70672;e[e._finally=Hr]="_finally";const Wr=71696;e[e._for=Wr]="_for";const Gr=73232;e[e._function=Gr]="_function";const Xr=73744;e[e._if=Xr]="_if";const zr=74768;e[e._return=zr]="_return";const Yr=75792;e[e._switch=Yr]="_switch";const Kr=77456;e[e._throw=Kr]="_throw";const Zr=77840;e[e._try=Zr]="_try";const Qr=78864;e[e._var=Qr]="_var";const Jr=79888;e[e._let=Jr]="_let";const en=80912;e[e._const=en]="_const";const tn=81936;e[e._while=tn]="_while";const sn=82960;e[e._with=sn]="_with";const rn=84496;e[e._new=rn]="_new";const nn=85520;e[e._this=nn]="_this";const an=86544;e[e._super=an]="_super";const on=87568;e[e._class=on]="_class";const cn=88080;e[e._extends=cn]="_extends";const un=89104;e[e._export=un]="_export";const ln=90640;e[e._import=ln]="_import";const hn=91664;e[e._yield=hn]="_yield";const fn=92688;e[e._null=fn]="_null";const dn=93712;e[e._true=dn]="_true";const pn=94736;e[e._false=pn]="_false";const mn=95256;e[e._in=mn]="_in";const gn=96280;e[e._instanceof=gn]="_instanceof";const bn=97936;e[e._typeof=bn]="_typeof";const yn=98960;e[e._void=yn]="_void";const k1=99984;e[e._delete=k1]="_delete";const w1=100880;e[e._async=w1]="_async";const E1=101904;e[e._get=E1]="_get";const S1=102928;e[e._set=S1]="_set";const T1=103952;e[e._declare=T1]="_declare";const C1=104976;e[e._readonly=C1]="_readonly";const A1=106e3;e[e._abstract=A1]="_abstract";const I1=107024;e[e._static=I1]="_static";const R1=107536;e[e._public=R1]="_public";const P1=108560;e[e._private=P1]="_private";const L1=109584;e[e._protected=L1]="_protected";const D1=110608;e[e._override=D1]="_override";const N1=112144;e[e._as=N1]="_as";const F1=113168;e[e._enum=F1]="_enum";const U1=114192;e[e._type=U1]="_type";const M1=115216;e[e._implements=M1]="_implements"})(n||(n={}));function Id(e){switch(e){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 Dt{constructor(t,s,i){this.startTokenIndex=t,this.endTokenIndex=s,this.isFunctionScope=i}}class Rd{constructor(t,s,i,r,a,o,u,l,h,p,m,_,k){this.potentialArrowAt=t,this.noAnonFunctionType=s,this.inDisallowConditionalTypesContext=i,this.tokensLength=r,this.scopesLength=a,this.pos=o,this.type=u,this.contextualKeyword=l,this.start=h,this.end=p,this.isType=m,this.scopeDepth=_,this.error=k}}class He{constructor(){He.prototype.__init.call(this),He.prototype.__init2.call(this),He.prototype.__init3.call(this),He.prototype.__init4.call(this),He.prototype.__init5.call(this),He.prototype.__init6.call(this),He.prototype.__init7.call(this),He.prototype.__init8.call(this),He.prototype.__init9.call(this),He.prototype.__init10.call(this),He.prototype.__init11.call(this),He.prototype.__init12.call(this),He.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 Rd(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(t){this.potentialArrowAt=t.potentialArrowAt,this.noAnonFunctionType=t.noAnonFunctionType,this.inDisallowConditionalTypesContext=t.inDisallowConditionalTypesContext,this.tokens.length=t.tokensLength,this.scopes.length=t.scopesLength,this.pos=t.pos,this.type=t.type,this.contextualKeyword=t.contextualKeyword,this.start=t.start,this.end=t.end,this.isType=t.isType,this.scopeDepth=t.scopeDepth,this.error=t.error}}var y;(function(e){e[e.backSpace=8]="backSpace";const s=10;e[e.lineFeed=s]="lineFeed";const i=9;e[e.tab=i]="tab";const r=13;e[e.carriageReturn=r]="carriageReturn";const a=14;e[e.shiftOut=a]="shiftOut";const o=32;e[e.space=o]="space";const u=33;e[e.exclamationMark=u]="exclamationMark";const l=34;e[e.quotationMark=l]="quotationMark";const h=35;e[e.numberSign=h]="numberSign";const p=36;e[e.dollarSign=p]="dollarSign";const m=37;e[e.percentSign=m]="percentSign";const _=38;e[e.ampersand=_]="ampersand";const k=39;e[e.apostrophe=k]="apostrophe";const T=40;e[e.leftParenthesis=T]="leftParenthesis";const P=41;e[e.rightParenthesis=P]="rightParenthesis";const F=42;e[e.asterisk=F]="asterisk";const U=43;e[e.plusSign=U]="plusSign";const D=44;e[e.comma=D]="comma";const z=45;e[e.dash=z]="dash";const q=46;e[e.dot=q]="dot";const Y=47;e[e.slash=Y]="slash";const K=48;e[e.digit0=K]="digit0";const Z=49;e[e.digit1=Z]="digit1";const X=50;e[e.digit2=X]="digit2";const re=51;e[e.digit3=re]="digit3";const x=52;e[e.digit4=x]="digit4";const b=53;e[e.digit5=b]="digit5";const v=54;e[e.digit6=v]="digit6";const V=55;e[e.digit7=V]="digit7";const W=56;e[e.digit8=W]="digit8";const O=57;e[e.digit9=O]="digit9";const R=58;e[e.colon=R]="colon";const B=59;e[e.semicolon=B]="semicolon";const M=60;e[e.lessThan=M]="lessThan";const A=61;e[e.equalsTo=A]="equalsTo";const H=62;e[e.greaterThan=H]="greaterThan";const G=63;e[e.questionMark=G]="questionMark";const te=64;e[e.atSign=te]="atSign";const ce=65;e[e.uppercaseA=ce]="uppercaseA";const oe=66;e[e.uppercaseB=oe]="uppercaseB";const w=67;e[e.uppercaseC=w]="uppercaseC";const S=68;e[e.uppercaseD=S]="uppercaseD";const N=69;e[e.uppercaseE=N]="uppercaseE";const L=70;e[e.uppercaseF=L]="uppercaseF";const j=71;e[e.uppercaseG=j]="uppercaseG";const se=72;e[e.uppercaseH=se]="uppercaseH";const ne=73;e[e.uppercaseI=ne]="uppercaseI";const pe=74;e[e.uppercaseJ=pe]="uppercaseJ";const Ee=75;e[e.uppercaseK=Ee]="uppercaseK";const ke=76;e[e.uppercaseL=ke]="uppercaseL";const Fe=77;e[e.uppercaseM=Fe]="uppercaseM";const ze=78;e[e.uppercaseN=ze]="uppercaseN";const Ie=79;e[e.uppercaseO=Ie]="uppercaseO";const Ve=80;e[e.uppercaseP=Ve]="uppercaseP";const je=81;e[e.uppercaseQ=je]="uppercaseQ";const ls=82;e[e.uppercaseR=ls]="uppercaseR";const ws=83;e[e.uppercaseS=ws]="uppercaseS";const $s=84;e[e.uppercaseT=$s]="uppercaseT";const Tr=85;e[e.uppercaseU=Tr]="uppercaseU";const Cr=86;e[e.uppercaseV=Cr]="uppercaseV";const Ar=87;e[e.uppercaseW=Ar]="uppercaseW";const Ir=88;e[e.uppercaseX=Ir]="uppercaseX";const Rr=89;e[e.uppercaseY=Rr]="uppercaseY";const Pr=90;e[e.uppercaseZ=Pr]="uppercaseZ";const Lr=91;e[e.leftSquareBracket=Lr]="leftSquareBracket";const Dr=92;e[e.backslash=Dr]="backslash";const Nr=93;e[e.rightSquareBracket=Nr]="rightSquareBracket";const Fr=94;e[e.caret=Fr]="caret";const Ur=95;e[e.underscore=Ur]="underscore";const Mr=96;e[e.graveAccent=Mr]="graveAccent";const Or=97;e[e.lowercaseA=Or]="lowercaseA";const Br=98;e[e.lowercaseB=Br]="lowercaseB";const Vr=99;e[e.lowercaseC=Vr]="lowercaseC";const jr=100;e[e.lowercaseD=jr]="lowercaseD";const $r=101;e[e.lowercaseE=$r]="lowercaseE";const qr=102;e[e.lowercaseF=qr]="lowercaseF";const Hr=103;e[e.lowercaseG=Hr]="lowercaseG";const Wr=104;e[e.lowercaseH=Wr]="lowercaseH";const Gr=105;e[e.lowercaseI=Gr]="lowercaseI";const Xr=106;e[e.lowercaseJ=Xr]="lowercaseJ";const zr=107;e[e.lowercaseK=zr]="lowercaseK";const Yr=108;e[e.lowercaseL=Yr]="lowercaseL";const Kr=109;e[e.lowercaseM=Kr]="lowercaseM";const Zr=110;e[e.lowercaseN=Zr]="lowercaseN";const Qr=111;e[e.lowercaseO=Qr]="lowercaseO";const Jr=112;e[e.lowercaseP=Jr]="lowercaseP";const en=113;e[e.lowercaseQ=en]="lowercaseQ";const tn=114;e[e.lowercaseR=tn]="lowercaseR";const sn=115;e[e.lowercaseS=sn]="lowercaseS";const rn=116;e[e.lowercaseT=rn]="lowercaseT";const nn=117;e[e.lowercaseU=nn]="lowercaseU";const an=118;e[e.lowercaseV=an]="lowercaseV";const on=119;e[e.lowercaseW=on]="lowercaseW";const cn=120;e[e.lowercaseX=cn]="lowercaseX";const un=121;e[e.lowercaseY=un]="lowercaseY";const ln=122;e[e.lowercaseZ=ln]="lowercaseZ";const hn=123;e[e.leftCurlyBrace=hn]="leftCurlyBrace";const fn=124;e[e.verticalBar=fn]="verticalBar";const dn=125;e[e.rightCurlyBrace=dn]="rightCurlyBrace";const pn=126;e[e.tilde=pn]="tilde";const mn=160;e[e.nonBreakingSpace=mn]="nonBreakingSpace";const gn=5760;e[e.oghamSpaceMark=gn]="oghamSpaceMark";const bn=8232;e[e.lineSeparator=bn]="lineSeparator";const yn=8233;e[e.paragraphSeparator=yn]="paragraphSeparator"})(y||(y={}));let yr,me,_e,c,$,nl;function ai(){return nl++}function Pd(e){if("pos"in e){const t=Dd(e.pos);e.message+=` (${t.line}:${t.column})`,e.loc=t}return e}class Ld{constructor(t,s){this.line=t,this.column=s}}function Dd(e){let t=1,s=1;for(let i=0;i<e;i++)$.charCodeAt(i)===y.lineFeed?(t++,s=1):s++;return new Ld(t,s)}function Nd(e,t,s,i){$=e,c=new He,nl=1,yr=t,me=s,_e=i}function ee(e){return c.contextualKeyword===e}function ja(e){const t=bi();return t.type===n.name&&t.contextualKeyword===e}function Le(e){return c.contextualKeyword===e&&E(n.name)}function Re(e){Le(e)||le()}function it(){return d(n.eof)||d(n.braceR)||Ge()}function Ge(){const e=c.tokens[c.tokens.length-1],t=e?e.end:0;for(let s=t;s<c.start;s++){const i=$.charCodeAt(s);if(i===y.lineFeed||i===y.carriageReturn||i===8232||i===8233)return true}return false}function al(){const e=$a();for(let t=c.end;t<e;t++){const s=$.charCodeAt(t);if(s===y.lineFeed||s===y.carriageReturn||s===8232||s===8233)return true}return false}function Ct(){return E(n.semi)||it()}function Se(){Ct()||le('Unexpected token, expected ";"')}function C(e){E(e)||le(`Unexpected token, expected "${Id(e)}"`)}function le(e="Unexpected token",t=c.start){if(c.error)return;const s=new SyntaxError(e);s.pos=t,c.error=s,c.pos=$.length,ue(n.eof)}const ol=[9,11,12,y.space,y.nonBreakingSpace,y.oghamSpaceMark,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288,65279],ic=/(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g,cl=new Uint8Array(65536);for(const e of ol)cl[e]=1;function Fd(e){if(e<48)return e===36;if(e<58)return true;if(e<65)return false;if(e<91)return true;if(e<97)return e===95;if(e<123)return true;if(e<128)return false;throw new Error("Should not be called with non-ASCII char code.")}const _t=new Uint8Array(65536);for(let e=0;e<128;e++)_t[e]=Fd(e)?1:0;for(let e=128;e<65536;e++)_t[e]=1;for(const e of ol)_t[e]=0;_t[8232]=0;_t[8233]=0;const gi=_t.slice();for(let e=y.digit0;e<=y.digit9;e++)gi[e]=0;const rc=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 Ud(){let e=0,t=0,s=c.pos;for(;s<$.length&&(t=$.charCodeAt(s),!(t<y.lowercaseA||t>y.lowercaseZ));){const r=rc[e+(t-y.lowercaseA)+1];if(r===-1)break;e=r,s++}const i=rc[e];if(i>-1&&!_t[t]){c.pos=s,i&1?ue(i>>>1):ue(n.name,i>>>1);return}for(;s<$.length;){const r=$.charCodeAt(s);if(_t[r])s++;else if(r===y.backslash){if(s+=2,$.charCodeAt(s)===y.leftCurlyBrace){for(;s<$.length&&$.charCodeAt(s)!==y.rightCurlyBrace;)s++;s++}}else if(r===y.atSign&&$.charCodeAt(s+1)===y.atSign)s+=2;else break}c.pos=s,ue(n.name)}var ie;(function(e){e[e.Access=0]="Access";const s=1;e[e.ExportAccess=s]="ExportAccess";const i=s+1;e[e.TopLevelDeclaration=i]="TopLevelDeclaration";const r=i+1;e[e.FunctionScopedDeclaration=r]="FunctionScopedDeclaration";const a=r+1;e[e.BlockScopedDeclaration=a]="BlockScopedDeclaration";const o=a+1;e[e.ObjectShorthandTopLevelDeclaration=o]="ObjectShorthandTopLevelDeclaration";const u=o+1;e[e.ObjectShorthandFunctionScopedDeclaration=u]="ObjectShorthandFunctionScopedDeclaration";const l=u+1;e[e.ObjectShorthandBlockScopedDeclaration=l]="ObjectShorthandBlockScopedDeclaration";const h=l+1;e[e.ObjectShorthand=h]="ObjectShorthand";const p=h+1;e[e.ImportDeclaration=p]="ImportDeclaration";const m=p+1;e[e.ObjectKey=m]="ObjectKey";const _=m+1;e[e.ImportAccess=_]="ImportAccess"})(ie||(ie={}));var pt;(function(e){e[e.NoChildren=0]="NoChildren";const s=1;e[e.OneChild=s]="OneChild";const i=s+1;e[e.StaticChildren=i]="StaticChildren";const r=i+1;e[e.KeyAfterPropSpread=r]="KeyAfterPropSpread"})(pt||(pt={}));function ul(e){const t=e.identifierRole;return t===ie.TopLevelDeclaration||t===ie.FunctionScopedDeclaration||t===ie.BlockScopedDeclaration||t===ie.ObjectShorthandTopLevelDeclaration||t===ie.ObjectShorthandFunctionScopedDeclaration||t===ie.ObjectShorthandBlockScopedDeclaration}function Md(e){const t=e.identifierRole;return t===ie.FunctionScopedDeclaration||t===ie.BlockScopedDeclaration||t===ie.ObjectShorthandFunctionScopedDeclaration||t===ie.ObjectShorthandBlockScopedDeclaration}function ll(e){const t=e.identifierRole;return t===ie.TopLevelDeclaration||t===ie.ObjectShorthandTopLevelDeclaration||t===ie.ImportDeclaration}function Od(e){const t=e.identifierRole;return t===ie.TopLevelDeclaration||t===ie.BlockScopedDeclaration||t===ie.ObjectShorthandTopLevelDeclaration||t===ie.ObjectShorthandBlockScopedDeclaration}function Bd(e){const t=e.identifierRole;return t===ie.FunctionScopedDeclaration||t===ie.ObjectShorthandFunctionScopedDeclaration}function Vd(e){return e.identifierRole===ie.ObjectShorthandTopLevelDeclaration||e.identifierRole===ie.ObjectShorthandBlockScopedDeclaration||e.identifierRole===ie.ObjectShorthandFunctionScopedDeclaration}class _r{constructor(){this.type=c.type,this.contextualKeyword=c.contextualKeyword,this.start=c.start,this.end=c.end,this.scopeDepth=c.scopeDepth,this.isType=c.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(){c.tokens.push(new _r),pl()}function ts(){c.tokens.push(new _r),c.start=c.pos,ip()}function jd(){c.type===n.assign&&--c.pos,ep()}function de(e){for(let s=c.tokens.length-e;s<c.tokens.length;s++)c.tokens[s].isType=true;const t=c.isType;return c.isType=true,t}function fe(e){c.isType=e}function E(e){return d(e)?(I(),true):false}function hl(e){const t=c.isType;c.isType=true,E(e),c.isType=t}function d(e){return c.type===e}function Ce(){const e=c.snapshot();I();const t=c.type;return c.restoreFromSnapshot(e),t}class $d{constructor(t,s){this.type=t,this.contextualKeyword=s}}function bi(){const e=c.snapshot();I();const t=c.type,s=c.contextualKeyword;return c.restoreFromSnapshot(e),new $d(t,s)}function $a(){return fl(c.pos)}function fl(e){ic.lastIndex=e;const t=ic.exec($);return e+t[0].length}function dl(){return $.charCodeAt($a())}function pl(){if(gl(),c.start=c.pos,c.pos>=$.length){const e=c.tokens;e.length>=2&&e[e.length-1].start>=$.length&&e[e.length-2].start>=$.length&&le("Unexpectedly reached the end of input."),ue(n.eof);return}qd($.charCodeAt(c.pos))}function qd(e){gi[e]||e===y.backslash||e===y.atSign&&$.charCodeAt(c.pos+1)===y.atSign?Ud():_l(e)}function Hd(){for(;$.charCodeAt(c.pos)!==y.asterisk||$.charCodeAt(c.pos+1)!==y.slash;)if(c.pos++,c.pos>$.length){le("Unterminated comment",c.pos-2);return}c.pos+=2}function ml(e){let t=$.charCodeAt(c.pos+=e);if(c.pos<$.length)for(;t!==y.lineFeed&&t!==y.carriageReturn&&t!==y.lineSeparator&&t!==y.paragraphSeparator&&++c.pos<$.length;)t=$.charCodeAt(c.pos)}function gl(){for(;c.pos<$.length;){const e=$.charCodeAt(c.pos);switch(e){case y.carriageReturn:$.charCodeAt(c.pos+1)===y.lineFeed&&++c.pos;case y.lineFeed:case y.lineSeparator:case y.paragraphSeparator:++c.pos;break;case y.slash:switch($.charCodeAt(c.pos+1)){case y.asterisk:c.pos+=2,Hd();break;case y.slash:ml(2);break;default:return}break;default:if(cl[e])++c.pos;else return}}}function ue(e,t=g.NONE){c.end=c.pos,c.type=e,c.contextualKeyword=t}function Wd(){const e=$.charCodeAt(c.pos+1);if(e>=y.digit0&&e<=y.digit9){xl(true);return}e===y.dot&&$.charCodeAt(c.pos+2)===y.dot?(c.pos+=3,ue(n.ellipsis)):(++c.pos,ue(n.dot))}function Gd(){$.charCodeAt(c.pos+1)===y.equalsTo?ve(n.assign,2):ve(n.slash,1)}function Xd(e){let t=e===y.asterisk?n.star:n.modulo,s=1,i=$.charCodeAt(c.pos+1);e===y.asterisk&&i===y.asterisk&&(s++,i=$.charCodeAt(c.pos+2),t=n.exponent),i===y.equalsTo&&$.charCodeAt(c.pos+2)!==y.greaterThan&&(s++,t=n.assign),ve(t,s)}function zd(e){const t=$.charCodeAt(c.pos+1);if(t===e){$.charCodeAt(c.pos+2)===y.equalsTo?ve(n.assign,3):ve(e===y.verticalBar?n.logicalOR:n.logicalAND,2);return}if(e===y.verticalBar){if(t===y.greaterThan){ve(n.pipeline,2);return}else if(t===y.rightCurlyBrace&&_e){ve(n.braceBarR,2);return}}if(t===y.equalsTo){ve(n.assign,2);return}ve(e===y.verticalBar?n.bitwiseOR:n.bitwiseAND,1)}function Yd(){$.charCodeAt(c.pos+1)===y.equalsTo?ve(n.assign,2):ve(n.bitwiseXOR,1)}function Kd(e){const t=$.charCodeAt(c.pos+1);if(t===e){ve(n.preIncDec,2);return}t===y.equalsTo?ve(n.assign,2):e===y.plusSign?ve(n.plus,1):ve(n.minus,1)}function Zd(){const e=$.charCodeAt(c.pos+1);if(e===y.lessThan){if($.charCodeAt(c.pos+2)===y.equalsTo){ve(n.assign,3);return}c.isType?ve(n.lessThan,1):ve(n.bitShiftL,2);return}e===y.equalsTo?ve(n.relationalOrEqual,2):ve(n.lessThan,1)}function bl(){if(c.isType){ve(n.greaterThan,1);return}const e=$.charCodeAt(c.pos+1);if(e===y.greaterThan){const t=$.charCodeAt(c.pos+2)===y.greaterThan?3:2;if($.charCodeAt(c.pos+t)===y.equalsTo){ve(n.assign,t+1);return}ve(n.bitShiftR,t);return}e===y.equalsTo?ve(n.relationalOrEqual,2):ve(n.greaterThan,1)}function yl(){c.type===n.greaterThan&&(c.pos-=1,bl())}function Qd(e){const t=$.charCodeAt(c.pos+1);if(t===y.equalsTo){ve(n.equality,$.charCodeAt(c.pos+2)===y.equalsTo?3:2);return}if(e===y.equalsTo&&t===y.greaterThan){c.pos+=2,ue(n.arrow);return}ve(e===y.equalsTo?n.eq:n.bang,1)}function Jd(){const e=$.charCodeAt(c.pos+1),t=$.charCodeAt(c.pos+2);e===y.questionMark&&!(_e&&c.isType)?t===y.equalsTo?ve(n.assign,3):ve(n.nullishCoalescing,2):e===y.dot&&!(t>=y.digit0&&t<=y.digit9)?(c.pos+=2,ue(n.questionDot)):(++c.pos,ue(n.question))}function _l(e){switch(e){case y.numberSign:++c.pos,ue(n.hash);return;case y.dot:Wd();return;case y.leftParenthesis:++c.pos,ue(n.parenL);return;case y.rightParenthesis:++c.pos,ue(n.parenR);return;case y.semicolon:++c.pos,ue(n.semi);return;case y.comma:++c.pos,ue(n.comma);return;case y.leftSquareBracket:++c.pos,ue(n.bracketL);return;case y.rightSquareBracket:++c.pos,ue(n.bracketR);return;case y.leftCurlyBrace:_e&&$.charCodeAt(c.pos+1)===y.verticalBar?ve(n.braceBarL,2):(++c.pos,ue(n.braceL));return;case y.rightCurlyBrace:++c.pos,ue(n.braceR);return;case y.colon:$.charCodeAt(c.pos+1)===y.colon?ve(n.doubleColon,2):(++c.pos,ue(n.colon));return;case y.questionMark:Jd();return;case y.atSign:++c.pos,ue(n.at);return;case y.graveAccent:++c.pos,ue(n.backQuote);return;case y.digit0:{const t=$.charCodeAt(c.pos+1);if(t===y.lowercaseX||t===y.uppercaseX||t===y.lowercaseO||t===y.uppercaseO||t===y.lowercaseB||t===y.uppercaseB){tp();return}}case y.digit1:case y.digit2:case y.digit3:case y.digit4:case y.digit5:case y.digit6:case y.digit7:case y.digit8:case y.digit9:xl(false);return;case y.quotationMark:case y.apostrophe:sp(e);return;case y.slash:Gd();return;case y.percentSign:case y.asterisk:Xd(e);return;case y.verticalBar:case y.ampersand:zd(e);return;case y.caret:Yd();return;case y.plusSign:case y.dash:Kd(e);return;case y.lessThan:Zd();return;case y.greaterThan:bl();return;case y.equalsTo:case y.exclamationMark:Qd(e);return;case y.tilde:ve(n.tilde,1);return}le(`Unexpected character '${String.fromCharCode(e)}'`,c.pos)}function ve(e,t){c.pos+=t,ue(e)}function ep(){const e=c.pos;let t=false,s=false;for(;;){if(c.pos>=$.length){le("Unterminated regular expression",e);return}const i=$.charCodeAt(c.pos);if(t)t=false;else{if(i===y.leftSquareBracket)s=true;else if(i===y.rightSquareBracket&&s)s=false;else if(i===y.slash&&!s)break;t=i===y.backslash}++c.pos}++c.pos,rp(),ue(n.regexp)}function Nn(){for(;;){const e=$.charCodeAt(c.pos);if(e>=y.digit0&&e<=y.digit9||e===y.underscore)c.pos++;else break}}function tp(){for(c.pos+=2;;){const t=$.charCodeAt(c.pos);if(t>=y.digit0&&t<=y.digit9||t>=y.lowercaseA&&t<=y.lowercaseF||t>=y.uppercaseA&&t<=y.uppercaseF||t===y.underscore)c.pos++;else break}$.charCodeAt(c.pos)===y.lowercaseN?(++c.pos,ue(n.bigint)):ue(n.num)}function xl(e){let t=false,s=false;e||Nn();let i=$.charCodeAt(c.pos);if(i===y.dot&&(++c.pos,Nn(),i=$.charCodeAt(c.pos)),(i===y.uppercaseE||i===y.lowercaseE)&&(i=$.charCodeAt(++c.pos),(i===y.plusSign||i===y.dash)&&++c.pos,Nn(),i=$.charCodeAt(c.pos)),i===y.lowercaseN?(++c.pos,t=true):i===y.lowercaseM&&(++c.pos,s=true),t){ue(n.bigint);return}if(s){ue(n.decimal);return}ue(n.num)}function sp(e){for(c.pos++;;){if(c.pos>=$.length){le("Unterminated string constant");return}const t=$.charCodeAt(c.pos);if(t===y.backslash)c.pos++;else if(t===e)break;c.pos++}c.pos++,ue(n.string)}function ip(){for(;;){if(c.pos>=$.length){le("Unterminated template");return}const e=$.charCodeAt(c.pos);if(e===y.graveAccent||e===y.dollarSign&&$.charCodeAt(c.pos+1)===y.leftCurlyBrace){if(c.pos===c.start&&d(n.template))if(e===y.dollarSign){c.pos+=2,ue(n.dollarBraceL);return}else{++c.pos,ue(n.backQuote);return}ue(n.template);return}e===y.backslash&&c.pos++,c.pos++}}function rp(){for(;c.pos<$.length;){const e=$.charCodeAt(c.pos);if(_t[e])c.pos++;else if(e===y.backslash){if(c.pos+=2,$.charCodeAt(c.pos)===y.leftCurlyBrace){for(;c.pos<$.length&&$.charCodeAt(c.pos)!==y.rightCurlyBrace;)c.pos++;c.pos++}}else break}}function oi(e,t=e.currentIndex()){let s=t+1;if(Ci(e,s)){const i=e.identifierNameAtIndex(t);return{isType:false,leftName:i,rightName:i,endIndex:s}}if(s++,Ci(e,s))return{isType:true,leftName:null,rightName:null,endIndex:s};if(s++,Ci(e,s))return{isType:false,leftName:e.identifierNameAtIndex(t),rightName:e.identifierNameAtIndex(t+2),endIndex:s};if(s++,Ci(e,s))return{isType:true,leftName:null,rightName:null,endIndex:s};throw new Error(`Unexpected import/export specifier at ${t}`)}function Ci(e,t){const s=e.tokens[t];return s.type===n.braceR||s.type===n.comma}var np=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 vl(e){const[t,s]=nc(e.jsxPragma||"React.createElement"),[i,r]=nc(e.jsxFragmentPragma||"React.Fragment");return{base:t,suffix:s,fragmentBase:i,fragmentSuffix:r}}function nc(e){let t=e.indexOf(".");return t===-1&&(t=e.length),[e.slice(0,t),e.slice(t)]}class xt{getPrefixCode(){return""}getHoistedCode(){return""}getSuffixCode(){return""}}class hs extends xt{__init(){this.lastLineNumber=1}__init2(){this.lastIndex=0}__init3(){this.filenameVarName=null}__init4(){this.esmAutomaticImportNameResolutions={}}__init5(){this.cjsAutomaticModuleNameResolutions={}}constructor(t,s,i,r,a){super(),this.rootTransformer=t,this.tokens=s,this.importProcessor=i,this.nameManager=r,this.options=a,hs.prototype.__init.call(this),hs.prototype.__init2.call(this),hs.prototype.__init3.call(this),hs.prototype.__init4.call(this),hs.prototype.__init5.call(this),this.jsxPragmaInfo=vl(a),this.isAutomaticRuntime=a.jsxRuntime==="automatic",this.jsxImportSource=a.jsxImportSource||"react"}process(){return this.tokens.matches1(n.jsxTagStart)?(this.processJSXTag(),true):false}getPrefixCode(){let t="";if(this.filenameVarName&&(t+=`const ${this.filenameVarName} = ${JSON.stringify(this.options.filePath||"")};`),this.isAutomaticRuntime)if(this.importProcessor)for(const[s,i]of Object.entries(this.cjsAutomaticModuleNameResolutions))t+=`var ${i} = require("${s}");`;else{const{createElement:s,...i}=this.esmAutomaticImportNameResolutions;s&&(t+=`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");t+=`import {${r}} from "${a}";`}}return t}processJSXTag(){const{jsxRole:t,start:s}=this.tokens.currentToken(),i=this.options.production?null:this.getElementLocationCode(s);this.isAutomaticRuntime&&t!==pt.KeyAfterPropSpread?this.transformTagToJSXFunc(i,t):this.transformTagToCreateElement(i)}getElementLocationCode(t){return`lineNumber: ${this.getLineNumberForIndex(t)}`}getLineNumberForIndex(t){const s=this.tokens.code;for(;this.lastIndex<t&&this.lastIndex<s.length;)s[this.lastIndex]===`
468
+ `&&this.lastLineNumber++,this.lastIndex++;return this.lastLineNumber}transformTagToJSXFunc(t,s){const i=s===pt.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(t)}, this`)),this.tokens.removeInitialToken();!this.tokens.matches1(n.jsxTagEnd);)this.tokens.removeToken();this.tokens.replaceToken(")")}transformTagToCreateElement(t){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(t),!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(t){return this.options.production?t?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:t}=this;return`${this.importProcessor&&this.importProcessor.getIdentifierReplacement(t.base)||t.base}${t.suffix}(`}}getFragmentCode(){if(this.isAutomaticRuntime)return this.claimAutoImportedName("Fragment",this.options.production?"/jsx-runtime":"/jsx-dev-runtime");{const{jsxPragmaInfo:t}=this;return(this.importProcessor&&this.importProcessor.getIdentifierReplacement(t.fragmentBase)||t.fragmentBase)+t.fragmentSuffix}}claimAutoImportedFuncInvocation(t,s){const i=this.claimAutoImportedName(t,s);return this.importProcessor?`${i}.call(void 0, `:`${i}(`}claimAutoImportedName(t,s){if(this.importProcessor){const i=this.jsxImportSource+s;return this.cjsAutomaticModuleNameResolutions[i]||(this.cjsAutomaticModuleNameResolutions[i]=this.importProcessor.getFreeIdentifierForPath(i)),`${this.cjsAutomaticModuleNameResolutions[i]}.${t}`}else return this.esmAutomaticImportNameResolutions[t]||(this.esmAutomaticImportNameResolutions[t]=this.nameManager.claimFreeName(`_${t}`)),this.esmAutomaticImportNameResolutions[t]}processTagIntro(){let t=this.tokens.currentIndex()+1;for(;this.tokens.tokens[t].isType||!this.tokens.matches2AtIndex(t-1,n.jsxName,n.jsxName)&&!this.tokens.matches2AtIndex(t-1,n.greaterThan,n.jsxName)&&!this.tokens.matches1AtIndex(t,n.braceL)&&!this.tokens.matches1AtIndex(t,n.jsxTagEnd)&&!this.tokens.matches2AtIndex(t,n.slash,n.jsxTagEnd);)t++;if(t===this.tokens.currentIndex()+1){const s=this.tokens.identifierName();kl(s)&&this.tokens.replaceToken(`'${s}'`)}for(;this.tokens.currentIndex()<t;)this.rootTransformer.processToken()}processPropsObjectWithDevInfo(t){const s=this.options.production?"":`__self: this, __source: ${this.getDevSource(t)}`;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(t){let s=null;for(;;){if(this.tokens.matches2(n.jsxName,n.eq)){const i=this.tokens.identifierName();if(t&&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(t){t.includes("-")?this.tokens.replaceToken(`'${t}'`):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 t=this.tokens.currentToken(),s=this.tokens.code.slice(t.start+1,t.end-1),i=ac(s),r=op(s);this.tokens.replaceToken(r+i)}processAutomaticChildrenAndEndProps(t){t===pt.StaticChildren?(this.tokens.appendCode(" children: ["),this.processChildren(false),this.tokens.appendCode("]}")):(t===pt.OneChild&&this.tokens.appendCode(" children: "),this.processChildren(false),this.tokens.appendCode("}"))}processChildren(t){let s=t;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(t){const s=this.tokens.currentToken(),i=this.tokens.code.slice(s.start,s.end),r=ac(i),a=ap(i);return a==='""'?(this.tokens.replaceToken(r),false):(this.tokens.replaceToken(`${t?", ":""}${a}${r}`),true)}getDevSource(t){return`{fileName: ${this.getFilenameVarName()}, ${t}}`}getFilenameVarName(){return this.filenameVarName||(this.filenameVarName=this.nameManager.claimFreeName("_jsxFileName")),this.filenameVarName}}function kl(e){const t=e.charCodeAt(0);return t>=y.lowercaseA&&t<=y.lowercaseZ}function ap(e){let t="",s="",i=false,r=false;for(let a=0;a<e.length;a++){const o=e[a];if(o===" "||o===" "||o==="\r")i||(s+=o);else if(o===`
469
+ `)s="",i=true;else{if(r&&i&&(t+=" "),t+=s,s="",o==="&"){const{entity:u,newI:l}=wl(e,a+1);a=l-1,t+=u}else t+=o;r=true,i=false}}return i||(t+=s),JSON.stringify(t)}function ac(e){let t=0,s=0;for(const i of e)i===`
470
+ `?(t++,s=0):i===" "&&s++;return`
471
+ `.repeat(t)+" ".repeat(s)}function op(e){let t="";for(let s=0;s<e.length;s++){const i=e[s];if(i===`
472
+ `)if(/\s/.test(e[s+1]))for(t+=" ";s<e.length&&/\s/.test(e[s+1]);)s++;else t+=`
473
+ `;else if(i==="&"){const{entity:r,newI:a}=wl(e,s+1);t+=r,s=a-1}else t+=i}return JSON.stringify(t)}function wl(e,t){let s="",i=0,r,a=t;if(e[a]==="#"){let o=10;a++;let u;if(e[a]==="x")for(o=16,a++,u=a;a<e.length&&up(e.charCodeAt(a));)a++;else for(u=a;a<e.length&&cp(e.charCodeAt(a));)a++;if(e[a]===";"){const l=e.slice(u,a);l&&(a++,r=String.fromCodePoint(parseInt(l,o)))}}else for(;a<e.length&&i++<10;){const o=e[a];if(a++,o===";"){r=np.get(s);break}s+=o}return r?{entity:r,newI:a}:{entity:"&",newI:t}}function cp(e){return e>=y.digit0&&e<=y.digit9}function up(e){return e>=y.digit0&&e<=y.digit9||e>=y.lowercaseA&&e<=y.lowercaseF||e>=y.uppercaseA&&e<=y.uppercaseF}function El(e,t){const s=vl(t),i=new Set;for(let r=0;r<e.tokens.length;r++){const a=e.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(e.identifierNameForToken(a)),a.type===n.jsxTagStart&&i.add(s.base),a.type===n.jsxTagStart&&r+1<e.tokens.length&&e.tokens[r+1].type===n.jsxTagEnd&&(i.add(s.base),i.add(s.fragmentBase)),a.type===n.jsxName&&a.identifierRole===ie.Access){const o=e.identifierNameForToken(a);(!kl(o)||e.tokens[r+1].type===n.dot)&&i.add(e.identifierNameForToken(a))}}return i}class fs{__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(t,s,i,r,a,o,u){this.nameManager=t,this.tokens=s,this.enableLegacyTypeScriptModuleInterop=i,this.options=r,this.isTypeScriptTransformEnabled=a,this.keepUnusedImports=o,this.helperManager=u,fs.prototype.__init.call(this),fs.prototype.__init2.call(this),fs.prototype.__init3.call(this),fs.prototype.__init4.call(this),fs.prototype.__init5.call(this)}preprocessTokens(){for(let t=0;t<this.tokens.tokens.length;t++)this.tokens.matches1AtIndex(t,n._import)&&!this.tokens.matches3AtIndex(t,n._import,n.name,n.eq)&&this.preprocessImportAtIndex(t),this.tokens.matches1AtIndex(t,n._export)&&!this.tokens.matches2AtIndex(t,n._export,n.eq)&&this.preprocessExportAtIndex(t);this.generateImportReplacements()}pruneTypeOnlyImports(){this.nonTypeIdentifiers=El(this.tokens,this.options);for(const[t,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(t,"")}}shouldAutomaticallyElideImportedName(t){return this.isTypeScriptTransformEnabled&&!this.keepUnusedImports&&!this.nonTypeIdentifiers.has(t)}generateImportReplacements(){for(const[t,s]of this.importInfoByPath.entries()){const{defaultNames:i,wildcardNames:r,namedImports:a,namedExports:o,exportStarNames:u,hasStarExport:l}=s;if(i.length===0&&r.length===0&&a.length===0&&o.length===0&&u.length===0&&!l){this.importsToReplace.set(t,`require('${t}');`);continue}const h=this.getFreeIdentifierForPath(t);let p;this.enableLegacyTypeScriptModuleInterop?p=h:p=r.length>0?r[0]:this.getFreeIdentifierForPath(t);let m=`var ${h} = require('${t}');`;if(r.length>0)for(const _ of r){const k=this.enableLegacyTypeScriptModuleInterop?h:`${this.helperManager.getHelperName("interopRequireWildcard")}(${h})`;m+=` var ${_} = ${k};`}else u.length>0&&p!==h?m+=` var ${p} = ${this.helperManager.getHelperName("interopRequireWildcard")}(${h});`:i.length>0&&p!==h&&(m+=` var ${p} = ${this.helperManager.getHelperName("interopRequireDefault")}(${h});`);for(const{importedName:_,localName:k}of o)m+=` ${this.helperManager.getHelperName("createNamedExportFrom")}(${h}, '${k}', '${_}');`;for(const _ of u)m+=` exports.${_} = ${p};`;l&&(m+=` ${this.helperManager.getHelperName("createStarExport")}(${h});`),this.importsToReplace.set(t,m);for(const _ of i)this.identifierReplacements.set(_,`${p}.default`);for(const{importedName:_,localName:k}of a)this.identifierReplacements.set(k,`${h}.${_}`)}}getFreeIdentifierForPath(t){const s=t.split("/"),r=s[s.length-1].replace(/\W/g,"");return this.nameManager.claimFreeName(`_${r}`)}preprocessImportAtIndex(t){const s=[],i=[],r=[];if(t++,(this.tokens.matchesContextualAtIndex(t,g._type)||this.tokens.matches1AtIndex(t,n._typeof))&&!this.tokens.matches1AtIndex(t+1,n.comma)&&!this.tokens.matchesContextualAtIndex(t+1,g._from)||this.tokens.matches1AtIndex(t,n.parenL))return;if(this.tokens.matches1AtIndex(t,n.name)&&(s.push(this.tokens.identifierNameAtIndex(t)),t++,this.tokens.matches1AtIndex(t,n.comma)&&t++),this.tokens.matches1AtIndex(t,n.star)&&(t+=2,i.push(this.tokens.identifierNameAtIndex(t)),t++),this.tokens.matches1AtIndex(t,n.braceL)){const u=this.getNamedImports(t+1);t=u.newIndex;for(const l of u.namedImports)l.importedName==="default"?s.push(l.localName):r.push(l)}if(this.tokens.matchesContextualAtIndex(t,g._from)&&t++,!this.tokens.matches1AtIndex(t,n.string))throw new Error("Expected string token at the end of import statement.");const a=this.tokens.stringValueAtIndex(t),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(t){if(this.tokens.matches2AtIndex(t,n._export,n._var)||this.tokens.matches2AtIndex(t,n._export,n._let)||this.tokens.matches2AtIndex(t,n._export,n._const))this.preprocessVarExportAtIndex(t);else if(this.tokens.matches2AtIndex(t,n._export,n._function)||this.tokens.matches2AtIndex(t,n._export,n._class)){const s=this.tokens.identifierNameAtIndex(t+2);this.addExportBinding(s,s)}else if(this.tokens.matches3AtIndex(t,n._export,n.name,n._function)){const s=this.tokens.identifierNameAtIndex(t+3);this.addExportBinding(s,s)}else this.tokens.matches2AtIndex(t,n._export,n.braceL)?this.preprocessNamedExportAtIndex(t):this.tokens.matches2AtIndex(t,n._export,n.star)&&this.preprocessExportStarAtIndex(t)}preprocessVarExportAtIndex(t){let s=0;for(let i=t+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(ul(r)){const a=this.tokens.identifierNameAtIndex(i);this.identifierReplacements.set(a,`exports.${a}`)}}}}preprocessNamedExportAtIndex(t){t+=2;const{newIndex:s,namedImports:i}=this.getNamedImports(t);if(t=s,this.tokens.matchesContextualAtIndex(t,g._from))t++;else{for(const{importedName:o,localName:u}of i)this.addExportBinding(o,u);return}if(!this.tokens.matches1AtIndex(t,n.string))throw new Error("Expected string token at the end of import statement.");const r=this.tokens.stringValueAtIndex(t);this.getImportInfo(r).namedExports.push(...i)}preprocessExportStarAtIndex(t){let s=null;if(this.tokens.matches3AtIndex(t,n._export,n.star,n._as)?(t+=3,s=this.tokens.identifierNameAtIndex(t),t+=2):t+=3,!this.tokens.matches1AtIndex(t,n.string))throw new Error("Expected string token at the end of star export statement.");const i=this.tokens.stringValueAtIndex(t),r=this.getImportInfo(i);s!==null?r.exportStarNames.push(s):r.hasStarExport=true}getNamedImports(t){const s=[];for(;;){if(this.tokens.matches1AtIndex(t,n.braceR)){t++;break}const i=oi(this.tokens,t);if(t=i.endIndex,i.isType||s.push({importedName:i.leftName,localName:i.rightName}),this.tokens.matches2AtIndex(t,n.comma,n.braceR)){t+=2;break}else if(this.tokens.matches1AtIndex(t,n.braceR)){t++;break}else if(this.tokens.matches1AtIndex(t,n.comma))t++;else throw new Error(`Unexpected token: ${JSON.stringify(this.tokens.tokens[t])}`)}return{newIndex:t,namedImports:s}}getImportInfo(t){const s=this.importInfoByPath.get(t);if(s)return s;const i={defaultNames:[],wildcardNames:[],namedImports:[],namedExports:[],hasBareImport:false,exportStarNames:[],hasStarExport:false};return this.importInfoByPath.set(t,i),i}addExportBinding(t,s){this.exportBindingsByLocalName.has(t)||this.exportBindingsByLocalName.set(t,[]),this.exportBindingsByLocalName.get(t).push(s)}claimImportCode(t){const s=this.importsToReplace.get(t);return this.importsToReplace.set(t,""),s||""}getIdentifierReplacement(t){return this.identifierReplacements.get(t)||null}resolveExportBinding(t){const s=this.exportBindingsByLocalName.get(t);return!s||s.length===0?null:s.map(i=>`exports.${i}`).join(" = ")}getGlobalNames(){return new Set([...this.identifierReplacements.keys(),...this.exportBindingsByLocalName.keys()])}}var lp=44,hp=59,oc="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Sl=new Uint8Array(64),fp=new Uint8Array(128);for(let e=0;e<oc.length;e++){const t=oc.charCodeAt(e);Sl[e]=t,fp[t]=e}function Ws(e,t,s){let i=t-s;i=i<0?-i<<1|1:i<<1;do{let r=i&31;i>>>=5,i>0&&(r|=32),e.write(Sl[r])}while(i>0);return t}var cc=1024*16,uc=typeof TextDecoder<"u"?new TextDecoder:typeof Buffer<"u"?{decode(e){return Buffer.from(e.buffer,e.byteOffset,e.byteLength).toString()}}:{decode(e){let t="";for(let s=0;s<e.length;s++)t+=String.fromCharCode(e[s]);return t}},dp=class{constructor(){this.pos=0,this.out="",this.buffer=new Uint8Array(cc)}write(e){const{buffer:t}=this;t[this.pos++]=e,this.pos===cc&&(this.out+=uc.decode(t),this.pos=0)}flush(){const{buffer:e,out:t,pos:s}=this;return s>0?t+uc.decode(e.subarray(0,s)):t}};function pp(e){const t=new dp;let s=0,i=0,r=0,a=0;for(let o=0;o<e.length;o++){const u=e[o];if(o>0&&t.write(hp),u.length===0)continue;let l=0;for(let h=0;h<u.length;h++){const p=u[h];h>0&&t.write(lp),l=Ws(t,p[0],l),p.length!==1&&(s=Ws(t,p[1],s),i=Ws(t,p[2],i),r=Ws(t,p[3],r),p.length!==4&&(a=Ws(t,p[4],a)))}}return t.flush()}var gs=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},mp={exports:{}};(function(e,t){(function(s,i){e.exports=i()})(gs,function(){const s=/^[\w+.-]+:\/\//,i=/^([\w+.-]+:)\/\/([^@/#?]*@)?([^:/#?]*)(:\d+)?(\/[^#?]*)?(\?[^#]*)?(#.*)?/,r=/^file:(?:\/\/((?![a-z]:)[^/#?]*)?)?(\/?[^#?]*)(\?[^#]*)?(#.*)?/i;function a(D){return s.test(D)}function o(D){return D.startsWith("//")}function u(D){return D.startsWith("/")}function l(D){return D.startsWith("file:")}function h(D){return/^[.?#]/.test(D)}function p(D){const z=i.exec(D);return _(z[1],z[2]||"",z[3],z[4]||"",z[5]||"/",z[6]||"",z[7]||"")}function m(D){const z=r.exec(D),q=z[2];return _("file:","",z[1]||"","",u(q)?q:"/"+q,z[3]||"",z[4]||"")}function _(D,z,q,Y,K,Z,X){return{scheme:D,user:z,host:q,port:Y,path:K,query:Z,hash:X,type:7}}function k(D){if(o(D)){const q=p("http:"+D);return q.scheme="",q.type=6,q}if(u(D)){const q=p("http://foo.com"+D);return q.scheme="",q.host="",q.type=5,q}if(l(D))return m(D);if(a(D))return p(D);const z=p("http://foo.com/"+D);return z.scheme="",z.host="",z.type=D?D.startsWith("?")?3:D.startsWith("#")?2:4:1,z}function T(D){if(D.endsWith("/.."))return D;const z=D.lastIndexOf("/");return D.slice(0,z+1)}function P(D,z){F(z,z.type),D.path==="/"?D.path=z.path:D.path=T(z.path)+D.path}function F(D,z){const q=z<=4,Y=D.path.split("/");let K=1,Z=0,X=false;for(let x=1;x<Y.length;x++){const b=Y[x];if(!b){X=true;continue}if(X=false,b!=="."){if(b===".."){Z?(X=true,Z--,K--):q&&(Y[K++]=b);continue}Y[K++]=b,Z++}}let re="";for(let x=1;x<K;x++)re+="/"+Y[x];(!re||X&&!re.endsWith("/.."))&&(re+="/"),D.path=re}function U(D,z){if(!D&&!z)return"";const q=k(D);let Y=q.type;if(z&&Y!==7){const Z=k(z),X=Z.type;switch(Y){case 1:q.hash=Z.hash;case 2:q.query=Z.query;case 3:case 4:P(q,Z);case 5:q.user=Z.user,q.host=Z.host,q.port=Z.port;case 6:q.scheme=Z.scheme}X>Y&&(Y=X)}F(q,Y);const K=q.query+q.hash;switch(Y){case 2:case 3:return K;case 4:{const Z=q.path.slice(1);return Z?h(z||D)&&!h(Z)?"./"+Z+K:Z+K:K||"."}case 5:return q.path+K;default:return q.scheme+"//"+q.user+q.host+q.port+q.path+K}}return U})})(mp);var Fn=class{constructor(){this._indexes={__proto__:null},this.array=[]}};function gp(e,t){return e._indexes[t]}function bp(e,t){const s=gp(e,t);if(s!==void 0)return s;const{array:i,_indexes:r}=e,a=i.push(t);return r[t]=a-1}var yp=0,_p=1,xp=2,vp=3,kp=4,Tl=-1,wp=class{constructor({file:e,sourceRoot:t}={}){this._names=new Fn,this._sources=new Fn,this._sourcesContent=[],this._mappings=[],this.file=e,this.sourceRoot=t,this._ignoreList=new Fn}};var Un=(e,t,s,i,r,a,o,u)=>Tp(true,e,t,s,i,r,a);function Ep(e){const{_mappings:t,_sources:s,_sourcesContent:i,_names:r,_ignoreList:a}=e;return Ip(t),{version:3,file:e.file||void 0,names:r.array,sourceRoot:e.sourceRoot||void 0,sources:s.array,sourcesContent:i,mappings:t,ignoreList:a.array}}function Sp(e){const t=Ep(e);return Object.assign({},t,{mappings:pp(t.mappings)})}function Tp(e,t,s,i,r,a,o,u,l){const{_mappings:h,_sources:p,_sourcesContent:m,_names:_}=t,k=Cp(h,s),T=Ap(k,i);if(!r)return Rp(k,T)?void 0:lc(k,T,[i]);const P=bp(p,r),F=Tl;if(P===m.length&&(m[P]=null),!Pp(k,T,P,a,o,F))return lc(k,T,[i,P,a,o])}function Cp(e,t){for(let s=e.length;s<=t;s++)e[s]=[];return e[t]}function Ap(e,t){let s=e.length;for(let i=s-1;i>=0;s=i--){const r=e[i];if(t>=r[yp])break}return s}function lc(e,t,s){for(let i=e.length;i>t;i--)e[i]=e[i-1];e[t]=s}function Ip(e){const{length:t}=e;let s=t;for(let i=s-1;i>=0&&!(e[i].length>0);s=i,i--);s<t&&(e.length=s)}function Rp(e,t){return t===0?true:e[t-1].length===1}function Pp(e,t,s,i,r,a){if(t===0)return false;const o=e[t-1];return o.length===1?false:s===o[_p]&&i===o[xp]&&r===o[vp]&&a===(o.length===5?o[kp]:Tl)}function Lp({code:e,mappings:t},s,i,r,a){const o=Dp(r,a),u=new wp({file:i.compiledFilename});let l=0,h=t[0];for(;h===void 0&&l<t.length-1;)l++,h=t[l];let p=0,m=0;h!==m&&Un(u,p,0,s,p,0);for(let P=0;P<e.length;P++){if(P===h){const F=h-m,U=o[l];for(Un(u,p,F,s,p,U);(h===P||h===void 0)&&l<t.length-1;)l++,h=t[l]}e.charCodeAt(P)===y.lineFeed&&(p++,m=P+1,h!==m&&Un(u,p,0,s,p,0))}const{sourceRoot:_,sourcesContent:k,...T}=Sp(u);return T}function Dp(e,t){const s=new Array(t.length);let i=0,r=t[i].start,a=0;for(let o=0;o<e.length;o++)o===r&&(s[i]=r-a,i++,r=t[i].start),e.charCodeAt(o)===y.lineFeed&&(a=o+1);return s}const Np={require:`
474
+ import {createRequire as CREATE_REQUIRE_NAME} from "module";
475
+ const require = CREATE_REQUIRE_NAME(import.meta.url);
476
+ `,interopRequireWildcard:`
477
+ function interopRequireWildcard(obj) {
478
+ if (obj && obj.__esModule) {
479
+ return obj;
480
+ } else {
481
+ var newObj = {};
482
+ if (obj != null) {
483
+ for (var key in obj) {
484
+ if (Object.prototype.hasOwnProperty.call(obj, key)) {
485
+ newObj[key] = obj[key];
486
+ }
487
+ }
488
+ }
489
+ newObj.default = obj;
490
+ return newObj;
491
+ }
492
+ }
493
+ `,interopRequireDefault:`
494
+ function interopRequireDefault(obj) {
495
+ return obj && obj.__esModule ? obj : { default: obj };
496
+ }
497
+ `,createNamedExportFrom:`
498
+ function createNamedExportFrom(obj, localName, importedName) {
499
+ Object.defineProperty(exports, localName, {enumerable: true, configurable: true, get: () => obj[importedName]});
500
+ }
501
+ `,createStarExport:`
502
+ function createStarExport(obj) {
503
+ Object.keys(obj)
504
+ .filter((key) => key !== "default" && key !== "__esModule")
505
+ .forEach((key) => {
506
+ if (exports.hasOwnProperty(key)) {
507
+ return;
508
+ }
509
+ Object.defineProperty(exports, key, {enumerable: true, configurable: true, get: () => obj[key]});
510
+ });
511
+ }
512
+ `,nullishCoalesce:`
513
+ function nullishCoalesce(lhs, rhsFn) {
514
+ if (lhs != null) {
515
+ return lhs;
516
+ } else {
517
+ return rhsFn();
518
+ }
519
+ }
520
+ `,asyncNullishCoalesce:`
521
+ async function asyncNullishCoalesce(lhs, rhsFn) {
522
+ if (lhs != null) {
523
+ return lhs;
524
+ } else {
525
+ return await rhsFn();
526
+ }
527
+ }
528
+ `,optionalChain:`
529
+ function optionalChain(ops) {
530
+ let lastAccessLHS = undefined;
531
+ let value = ops[0];
532
+ let i = 1;
533
+ while (i < ops.length) {
534
+ const op = ops[i];
535
+ const fn = ops[i + 1];
536
+ i += 2;
537
+ if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) {
538
+ return undefined;
539
+ }
540
+ if (op === 'access' || op === 'optionalAccess') {
541
+ lastAccessLHS = value;
542
+ value = fn(value);
543
+ } else if (op === 'call' || op === 'optionalCall') {
544
+ value = fn((...args) => value.call(lastAccessLHS, ...args));
545
+ lastAccessLHS = undefined;
546
+ }
547
+ }
548
+ return value;
549
+ }
550
+ `,asyncOptionalChain:`
551
+ async function asyncOptionalChain(ops) {
552
+ let lastAccessLHS = undefined;
553
+ let value = ops[0];
554
+ let i = 1;
555
+ while (i < ops.length) {
556
+ const op = ops[i];
557
+ const fn = ops[i + 1];
558
+ i += 2;
559
+ if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) {
560
+ return undefined;
561
+ }
562
+ if (op === 'access' || op === 'optionalAccess') {
563
+ lastAccessLHS = value;
564
+ value = await fn(value);
565
+ } else if (op === 'call' || op === 'optionalCall') {
566
+ value = await fn((...args) => value.call(lastAccessLHS, ...args));
567
+ lastAccessLHS = undefined;
568
+ }
569
+ }
570
+ return value;
571
+ }
572
+ `,optionalChainDelete:`
573
+ function optionalChainDelete(ops) {
574
+ const result = OPTIONAL_CHAIN_NAME(ops);
575
+ return result == null ? true : result;
576
+ }
577
+ `,asyncOptionalChainDelete:`
578
+ async function asyncOptionalChainDelete(ops) {
579
+ const result = await ASYNC_OPTIONAL_CHAIN_NAME(ops);
580
+ return result == null ? true : result;
581
+ }
582
+ `};class Yi{__init(){this.helperNames={}}__init2(){this.createRequireName=null}constructor(t){this.nameManager=t,Yi.prototype.__init.call(this),Yi.prototype.__init2.call(this)}getHelperName(t){let s=this.helperNames[t];return s||(s=this.nameManager.claimFreeName(`_${t}`),this.helperNames[t]=s,s)}emitHelpers(){let t="";this.helperNames.optionalChainDelete&&this.getHelperName("optionalChain"),this.helperNames.asyncOptionalChainDelete&&this.getHelperName("asyncOptionalChain");for(const[s,i]of Object.entries(Np)){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&&(t+=" ",t+=a.replace(s,r).replace(/\s+/g," ").trim())}return t}}function hc(e,t,s){Fp(e,s)&&Up(e,t,s)}function Fp(e,t){for(const s of e.tokens)if(s.type===n.name&&!s.isType&&Md(s)&&t.has(e.identifierNameForToken(s)))return true;return false}function Up(e,t,s){const i=[];let r=t.length-1;for(let a=e.tokens.length-1;;a--){for(;i.length>0&&i[i.length-1].startTokenIndex===a+1;)i.pop();for(;r>=0&&t[r].endTokenIndex===a+1;)i.push(t[r]),r--;if(a<0)break;const o=e.tokens[a],u=e.identifierNameForToken(o);if(i.length>1&&!o.isType&&o.type===n.name&&s.has(u)){if(Od(o))fc(i[i.length-1],e,u);else if(Bd(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.");fc(i[l],e,u)}}}if(i.length>0)throw new Error("Expected empty scope stack after processing file.")}function fc(e,t,s){for(let i=e.startTokenIndex;i<e.endTokenIndex;i++){const r=t.tokens[i];(r.type===n.name||r.type===n.jsxName)&&t.identifierNameForToken(r)===s&&(r.shadowsGlobal=true)}}function Mp(e,t){const s=[];for(const i of t)i.type===n.name&&s.push(e.slice(i.start,i.end));return s}class qa{__init(){this.usedNames=new Set}constructor(t,s){qa.prototype.__init.call(this),this.usedNames=new Set(Mp(t,s))}claimFreeName(t){const s=this.findFreeName(t);return this.usedNames.add(s),s}findFreeName(t){if(!this.usedNames.has(t))return t;let s=2;for(;this.usedNames.has(t+String(s));)s++;return t+String(s)}}var we={},ra={},It={},Op=gs&&gs.__extends||function(){var e=function(t,s){return e=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])},e(t,s)};return function(t,s){e(t,s);function i(){this.constructor=t}t.prototype=s===null?Object.create(s):(i.prototype=s.prototype,new i)}}();Object.defineProperty(It,"__esModule",{value:true});It.DetailContext=It.NoopContext=It.VError=void 0;var Cl=function(e){Op(t,e);function t(s,i){var r=e.call(this,i)||this;return r.path=s,Object.setPrototypeOf(r,t.prototype),r}return t}(Error);It.VError=Cl;var Bp=function(){function e(){}return e.prototype.fail=function(t,s,i){return false},e.prototype.unionResolver=function(){return this},e.prototype.createContext=function(){return this},e.prototype.resolveUnion=function(t){},e}();It.NoopContext=Bp;var Al=function(){function e(){this._propNames=[""],this._messages=[null],this._score=0}return e.prototype.fail=function(t,s,i){return this._propNames.push(t),this._messages.push(s),this._score+=i,false},e.prototype.unionResolver=function(){return new Vp},e.prototype.resolveUnion=function(t){for(var s,i,r=t,a=null,o=0,u=r.contexts;o<u.length;o++){var l=u[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))},e.prototype.getError=function(t){for(var s=[],i=this._propNames.length-1;i>=0;i--){var r=this._propNames[i];t+=typeof r=="number"?"["+r+"]":r?"."+r:"";var a=this._messages[i];a&&s.push(t+" "+a)}return new Cl(t,s.join("; "))},e.prototype.getErrorDetail=function(t){for(var s=[],i=this._propNames.length-1;i>=0;i--){var r=this._propNames[i];t+=typeof r=="number"?"["+r+"]":r?"."+r:"";var a=this._messages[i];a&&s.push({path:t,message:a})}for(var o=null,i=s.length-1;i>=0;i--)o&&(s[i].nested=[o]),o=s[i];return o},e}();It.DetailContext=Al;var Vp=function(){function e(){this.contexts=[]}return e.prototype.createContext=function(){var t=new Al;return this.contexts.push(t),t},e}();(function(e){var t=gs&&gs.__extends||function(){var w=function(S,N){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(S,N)};return function(S,N){w(S,N);function L(){this.constructor=S}S.prototype=N===null?Object.create(N):(L.prototype=N.prototype,new L)}}();Object.defineProperty(e,"__esModule",{value:true}),e.basicTypes=e.BasicType=e.TParamList=e.TParam=e.param=e.TFunc=e.func=e.TProp=e.TOptional=e.opt=e.TIface=e.iface=e.TEnumLiteral=e.enumlit=e.TEnumType=e.enumtype=e.TIntersection=e.intersection=e.TUnion=e.union=e.TTuple=e.tuple=e.TArray=e.array=e.TLiteral=e.lit=e.TName=e.name=e.TType=void 0;var s=It,i=function(){function w(){}return w}();e.TType=i;function r(w){return typeof w=="string"?o(w):w}function a(w,S){var N=w[S];if(!N)throw new Error("Unknown type "+S);return N}function o(w){return new u(w)}e.name=o;var u=function(w){t(S,w);function S(N){var L=w.call(this)||this;return L.name=N,L._failMsg="is not a "+N,L}return S.prototype.getChecker=function(N,L,j){var se=this,ne=a(N,this.name),pe=ne.getChecker(N,L,j);return ne instanceof M||ne instanceof S?pe:function(Ee,ke){return pe(Ee,ke)?true:ke.fail(null,se._failMsg,0)}},S}(i);e.TName=u;function l(w){return new h(w)}e.lit=l;var h=function(w){t(S,w);function S(N){var L=w.call(this)||this;return L.value=N,L.name=JSON.stringify(N),L._failMsg="is not "+L.name,L}return S.prototype.getChecker=function(N,L){var j=this;return function(se,ne){return se===j.value?true:ne.fail(null,j._failMsg,-1)}},S}(i);e.TLiteral=h;function p(w){return new m(r(w))}e.array=p;var m=function(w){t(S,w);function S(N){var L=w.call(this)||this;return L.ttype=N,L}return S.prototype.getChecker=function(N,L){var j=this.ttype.getChecker(N,L);return function(se,ne){if(!Array.isArray(se))return ne.fail(null,"is not an array",0);for(var pe=0;pe<se.length;pe++){var Ee=j(se[pe],ne);if(!Ee)return ne.fail(pe,null,1)}return true}},S}(i);e.TArray=m;function _(){for(var w=[],S=0;S<arguments.length;S++)w[S]=arguments[S];return new k(w.map(function(N){return r(N)}))}e.tuple=_;var k=function(w){t(S,w);function S(N){var L=w.call(this)||this;return L.ttypes=N,L}return S.prototype.getChecker=function(N,L){var j=this.ttypes.map(function(ne){return ne.getChecker(N,L)}),se=function(ne,pe){if(!Array.isArray(ne))return pe.fail(null,"is not an array",0);for(var Ee=0;Ee<j.length;Ee++){var ke=j[Ee](ne[Ee],pe);if(!ke)return pe.fail(Ee,null,1)}return true};return L?function(ne,pe){return se(ne,pe)?ne.length<=j.length?true:pe.fail(j.length,"is extraneous",2):false}:se},S}(i);e.TTuple=k;function T(){for(var w=[],S=0;S<arguments.length;S++)w[S]=arguments[S];return new P(w.map(function(N){return r(N)}))}e.union=T;var P=function(w){t(S,w);function S(N){var L=w.call(this)||this;L.ttypes=N;var j=N.map(function(ne){return ne instanceof u||ne instanceof h?ne.name:null}).filter(function(ne){return ne}),se=N.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 S.prototype.getChecker=function(N,L){var j=this,se=this.ttypes.map(function(ne){return ne.getChecker(N,L)});return function(ne,pe){for(var Ee=pe.unionResolver(),ke=0;ke<se.length;ke++){var Fe=se[ke](ne,Ee.createContext());if(Fe)return true}return pe.resolveUnion(Ee),pe.fail(null,j._failMsg,0)}},S}(i);e.TUnion=P;function F(){for(var w=[],S=0;S<arguments.length;S++)w[S]=arguments[S];return new U(w.map(function(N){return r(N)}))}e.intersection=F;var U=function(w){t(S,w);function S(N){var L=w.call(this)||this;return L.ttypes=N,L}return S.prototype.getChecker=function(N,L){var j=new Set,se=this.ttypes.map(function(ne){return ne.getChecker(N,L,j)});return function(ne,pe){var Ee=se.every(function(ke){return ke(ne,pe)});return Ee?true:pe.fail(null,null,0)}},S}(i);e.TIntersection=U;function D(w){return new z(w)}e.enumtype=D;var z=function(w){t(S,w);function S(N){var L=w.call(this)||this;return L.members=N,L.validValues=new Set,L._failMsg="is not a valid enum value",L.validValues=new Set(Object.keys(N).map(function(j){return N[j]})),L}return S.prototype.getChecker=function(N,L){var j=this;return function(se,ne){return j.validValues.has(se)?true:ne.fail(null,j._failMsg,0)}},S}(i);e.TEnumType=z;function q(w,S){return new Y(w,S)}e.enumlit=q;var Y=function(w){t(S,w);function S(N,L){var j=w.call(this)||this;return j.enumName=N,j.prop=L,j._failMsg="is not "+N+"."+L,j}return S.prototype.getChecker=function(N,L){var j=this,se=a(N,this.enumName);if(!(se instanceof z))throw new Error("Type "+this.enumName+" used in enumlit is not an enum type");var ne=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,Ee){return pe===ne?true:Ee.fail(null,j._failMsg,-1)}},S}(i);e.TEnumLiteral=Y;function K(w){return Object.keys(w).map(function(S){return Z(S,w[S])})}function Z(w,S){return S instanceof b?new v(w,S.ttype,true):new v(w,r(S),false)}function X(w,S){return new re(w,K(S))}e.iface=X;var re=function(w){t(S,w);function S(N,L){var j=w.call(this)||this;return j.bases=N,j.props=L,j.propSet=new Set(L.map(function(se){return se.name})),j}return S.prototype.getChecker=function(N,L,j){var se=this,ne=this.bases.map(function(Ie){return a(N,Ie).getChecker(N,L)}),pe=this.props.map(function(Ie){return Ie.ttype.getChecker(N,L)}),Ee=new s.NoopContext,ke=this.props.map(function(Ie,Ve){return!Ie.isOpt&&!pe[Ve](void 0,Ee)}),Fe=function(Ie,Ve){if(typeof Ie!="object"||Ie===null)return Ve.fail(null,"is not an object",0);for(var je=0;je<ne.length;je++)if(!ne[je](Ie,Ve))return false;for(var je=0;je<pe.length;je++){var ls=se.props[je].name,ws=Ie[ls];if(ws===void 0){if(ke[je])return Ve.fail(ls,"is missing",1)}else{var $s=pe[je](ws,Ve);if(!$s)return Ve.fail(ls,null,1)}}return true};if(!L)return Fe;var ze=this.propSet;return j&&(this.propSet.forEach(function(Ie){return j.add(Ie)}),ze=j),function(Ie,Ve){if(!Fe(Ie,Ve))return false;for(var je in Ie)if(!ze.has(je))return Ve.fail(je,"is extraneous",2);return true}},S}(i);e.TIface=re;function x(w){return new b(r(w))}e.opt=x;var b=function(w){t(S,w);function S(N){var L=w.call(this)||this;return L.ttype=N,L}return S.prototype.getChecker=function(N,L){var j=this.ttype.getChecker(N,L);return function(se,ne){return se===void 0||j(se,ne)}},S}(i);e.TOptional=b;var v=function(){function w(S,N,L){this.name=S,this.ttype=N,this.isOpt=L}return w}();e.TProp=v;function V(w){for(var S=[],N=1;N<arguments.length;N++)S[N-1]=arguments[N];return new W(new B(S),r(w))}e.func=V;var W=function(w){t(S,w);function S(N,L){var j=w.call(this)||this;return j.paramList=N,j.result=L,j}return S.prototype.getChecker=function(N,L){return function(j,se){return typeof j=="function"?true:se.fail(null,"is not a function",0)}},S}(i);e.TFunc=W;function O(w,S,N){return new R(w,r(S),!!N)}e.param=O;var R=function(){function w(S,N,L){this.name=S,this.ttype=N,this.isOpt=L}return w}();e.TParam=R;var B=function(w){t(S,w);function S(N){var L=w.call(this)||this;return L.params=N,L}return S.prototype.getChecker=function(N,L){var j=this,se=this.params.map(function(ke){return ke.ttype.getChecker(N,L)}),ne=new s.NoopContext,pe=this.params.map(function(ke,Fe){return!ke.isOpt&&!se[Fe](void 0,ne)}),Ee=function(ke,Fe){if(!Array.isArray(ke))return Fe.fail(null,"is not an array",0);for(var ze=0;ze<se.length;ze++){var Ie=j.params[ze];if(ke[ze]===void 0){if(pe[ze])return Fe.fail(Ie.name,"is missing",1)}else{var Ve=se[ze](ke[ze],Fe);if(!Ve)return Fe.fail(Ie.name,null,1)}}return true};return L?function(ke,Fe){return Ee(ke,Fe)?ke.length<=se.length?true:Fe.fail(se.length,"is extraneous",2):false}:Ee},S}(i);e.TParamList=B;var M=function(w){t(S,w);function S(N,L){var j=w.call(this)||this;return j.validator=N,j.message=L,j}return S.prototype.getChecker=function(N,L){var j=this;return function(se,ne){return j.validator(se)?true:ne.fail(null,j.message,0)}},S}(i);e.BasicType=M,e.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 A=Object.prototype.toString;function H(w){return function(S){return typeof S=="object"&&S&&A.call(S)===w}}typeof Buffer<"u"&&(e.basicTypes.Buffer=new M(function(w){return Buffer.isBuffer(w)},"is not a Buffer"));for(var G=function(w){e.basicTypes[w.name]=new M(function(S){return S instanceof w},"is not a "+w.name)},te=0,ce=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,ArrayBuffer];te<ce.length;te++){var oe=ce[te];G(oe)}})(ra);(function(e){var t=gs&&gs.__spreadArrays||function(){for(var l=0,h=0,p=arguments.length;h<p;h++)l+=arguments[h].length;for(var m=Array(l),_=0,h=0;h<p;h++)for(var k=arguments[h],T=0,P=k.length;T<P;T++,_++)m[_]=k[T];return m};Object.defineProperty(e,"__esModule",{value:true}),e.Checker=e.createCheckers=void 0;var s=ra,i=It,r=ra;Object.defineProperty(e,"TArray",{enumerable:true,get:function(){return r.TArray}}),Object.defineProperty(e,"TEnumType",{enumerable:true,get:function(){return r.TEnumType}}),Object.defineProperty(e,"TEnumLiteral",{enumerable:true,get:function(){return r.TEnumLiteral}}),Object.defineProperty(e,"TFunc",{enumerable:true,get:function(){return r.TFunc}}),Object.defineProperty(e,"TIface",{enumerable:true,get:function(){return r.TIface}}),Object.defineProperty(e,"TLiteral",{enumerable:true,get:function(){return r.TLiteral}}),Object.defineProperty(e,"TName",{enumerable:true,get:function(){return r.TName}}),Object.defineProperty(e,"TOptional",{enumerable:true,get:function(){return r.TOptional}}),Object.defineProperty(e,"TParam",{enumerable:true,get:function(){return r.TParam}}),Object.defineProperty(e,"TParamList",{enumerable:true,get:function(){return r.TParamList}}),Object.defineProperty(e,"TProp",{enumerable:true,get:function(){return r.TProp}}),Object.defineProperty(e,"TTuple",{enumerable:true,get:function(){return r.TTuple}}),Object.defineProperty(e,"TType",{enumerable:true,get:function(){return r.TType}}),Object.defineProperty(e,"TUnion",{enumerable:true,get:function(){return r.TUnion}}),Object.defineProperty(e,"TIntersection",{enumerable:true,get:function(){return r.TIntersection}}),Object.defineProperty(e,"array",{enumerable:true,get:function(){return r.array}}),Object.defineProperty(e,"enumlit",{enumerable:true,get:function(){return r.enumlit}}),Object.defineProperty(e,"enumtype",{enumerable:true,get:function(){return r.enumtype}}),Object.defineProperty(e,"func",{enumerable:true,get:function(){return r.func}}),Object.defineProperty(e,"iface",{enumerable:true,get:function(){return r.iface}}),Object.defineProperty(e,"lit",{enumerable:true,get:function(){return r.lit}}),Object.defineProperty(e,"name",{enumerable:true,get:function(){return r.name}}),Object.defineProperty(e,"opt",{enumerable:true,get:function(){return r.opt}}),Object.defineProperty(e,"param",{enumerable:true,get:function(){return r.param}}),Object.defineProperty(e,"tuple",{enumerable:true,get:function(){return r.tuple}}),Object.defineProperty(e,"union",{enumerable:true,get:function(){return r.union}}),Object.defineProperty(e,"intersection",{enumerable:true,get:function(){return r.intersection}}),Object.defineProperty(e,"BasicType",{enumerable:true,get:function(){return r.BasicType}});var a=It;Object.defineProperty(e,"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 p=Object.assign.apply(Object,t([{},s.basicTypes],l)),m={},_=0,k=l;_<k.length;_++)for(var T=k[_],P=0,F=Object.keys(T);P<F.length;P++){var U=F[P];m[U]=new u(p,T[U])}return m}e.createCheckers=o;var u=function(){function l(h,p,m){if(m===void 0&&(m="value"),this.suite=h,this.ttype=p,this._path=m,this.props=new Map,p instanceof s.TIface)for(var _=0,k=p.props;_<k.length;_++){var T=k[_];this.props.set(T.name,T.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 p=this.props.get(h);if(!p)throw new Error("Type has no property "+h);return new l(this.suite,p,this._path+"."+h)},l.prototype.methodArgs=function(h){var p=this._getMethod(h);return new l(this.suite,p.paramList)},l.prototype.methodResult=function(h){var p=this._getMethod(h);return new l(this.suite,p.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,p){var m=new i.NoopContext;if(!h(p,m)){var _=new i.DetailContext;throw h(p,_),_.getError(this._path)}},l.prototype._doValidate=function(h,p){var m=new i.NoopContext;if(h(p,m))return null;var _=new i.DetailContext;return h(p,_),_.getErrorDetail(this._path)},l.prototype._getMethod=function(h){var p=this.props.get(h);if(!p)throw new Error("Type has no property "+h);if(!(p instanceof s.TFunc))throw new Error("Property "+h+" is not a method");return p},l}();e.Checker=u})(we);const jp=we.union(we.lit("jsx"),we.lit("typescript"),we.lit("flow"),we.lit("imports"),we.lit("react-hot-loader"),we.lit("jest")),$p=we.iface([],{compiledFilename:"string"}),qp=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")}),Hp={Transform:jp,SourceMapOptions:$p,Options:qp},{Options:Wp}=we.createCheckers(Hp);function Gp(e){Wp.strictCheck(e)}function Il(){I(),Oe(false)}function Rl(e){I(),xr(e)}function us(e){ae(),Ha(e)}function Ki(){ae(),c.tokens[c.tokens.length-1].identifierRole=ie.ImportDeclaration}function Ha(e){let t;c.scopeDepth===0?t=ie.TopLevelDeclaration:e?t=ie.BlockScopedDeclaration:t=ie.FunctionScopedDeclaration,c.tokens[c.tokens.length-1].identifierRole=t}function xr(e){switch(c.type){case n._this:{const t=de(0);I(),fe(t);return}case n._yield:case n.name:{c.type=n.name,us(e);return}case n.bracketL:{I(),Wa(n.bracketR,e,true);return}case n.braceL:so(true,e);return;default:le()}}function Wa(e,t,s=false,i=false,r=0){let a=true,o=false;const u=c.tokens.length;for(;!E(e)&&!c.error;)if(a?a=false:(C(n.comma),c.tokens[c.tokens.length-1].contextId=r,!o&&c.tokens[u].isType&&(c.tokens[c.tokens.length-1].isType=true,o=true)),!(s&&d(n.comma))){if(E(e))break;if(d(n.ellipsis)){Rl(t),Pl(),E(n.comma),C(e);break}else Xp(i,t)}}function Xp(e,t){e&&Ga([g._public,g._protected,g._private,g._readonly,g._override]),Zi(t),Pl(),Zi(t,true)}function Pl(){_e?hg():me&&t0()}function Zi(e,t=false){if(t||xr(e),!E(n.eq))return;const s=c.tokens.length-1;Oe(),c.tokens[s].rhsEndIndex=c.tokens.length}function na(){return d(n.name)}function zp(){return d(n.name)||!!(c.type&n.IS_KEYWORD)||d(n.string)||d(n.num)||d(n.bigint)||d(n.decimal)}function Ll(){const e=c.snapshot();return I(),(d(n.bracketL)||d(n.braceL)||d(n.star)||d(n.ellipsis)||d(n.hash)||zp())&&!Ge()?true:(c.restoreFromSnapshot(e),false)}function Ga(e){for(;Dl(e)!==null;);}function Dl(e){if(!d(n.name))return null;const t=c.contextualKeyword;if(e.indexOf(t)!==-1&&Ll()){switch(t){case g._readonly:c.tokens[c.tokens.length-1].type=n._readonly;break;case g._abstract:c.tokens[c.tokens.length-1].type=n._abstract;break;case g._static:c.tokens[c.tokens.length-1].type=n._static;break;case g._public:c.tokens[c.tokens.length-1].type=n._public;break;case g._private:c.tokens[c.tokens.length-1].type=n._private;break;case g._protected:c.tokens[c.tokens.length-1].type=n._protected;break;case g._override:c.tokens[c.tokens.length-1].type=n._override;break;case g._declare:c.tokens[c.tokens.length-1].type=n._declare;break}return t}return null}function yi(){for(ae();E(n.dot);)ae()}function Yp(){yi(),!Ge()&&d(n.lessThan)&&Vs()}function Kp(){I(),_i()}function Zp(){I()}function Qp(){C(n._typeof),d(n._import)?Nl():yi(),!Ge()&&d(n.lessThan)&&Vs()}function Nl(){C(n._import),C(n.parenL),C(n.string),C(n.parenR),E(n.dot)&&yi(),d(n.lessThan)&&Vs()}function Jp(){E(n._const);const e=E(n._in),t=Le(g._out);E(n._const),(e||t)&&!d(n.name)?c.tokens[c.tokens.length-1].type=n.name:ae(),E(n._extends)&&Ae(),E(n.eq)&&Ae()}function vs(){d(n.lessThan)&&vr()}function vr(){const e=de(0);for(d(n.lessThan)||d(n.typeParameterStart)?I():le();!E(n.greaterThan)&&!c.error;)Jp(),E(n.comma);fe(e)}function Xa(e){const t=e===n.arrow;vs(),C(n.parenL),c.scopeDepth++,em(false),c.scopeDepth--,(t||d(e))&&ci(e)}function em(e){Wa(n.parenR,e)}function Qi(){E(n.comma)||Se()}function dc(){Xa(n.colon),Qi()}function tm(){const e=c.snapshot();I();const t=E(n.name)&&d(n.colon);return c.restoreFromSnapshot(e),t}function Fl(){if(!(d(n.bracketL)&&tm()))return false;const e=de(0);return C(n.bracketL),ae(),_i(),C(n.bracketR),Bs(),Qi(),fe(e),true}function pc(e){E(n.question),!e&&(d(n.parenL)||d(n.lessThan))?(Xa(n.colon),Qi()):(Bs(),Qi())}function sm(){if(d(n.parenL)||d(n.lessThan)){dc();return}if(d(n._new)){I(),d(n.parenL)||d(n.lessThan)?dc():pc(false);return}const e=!!Dl([g._readonly]);Fl()||((ee(g._get)||ee(g._set))&&Ll(),ui(-1),pc(e))}function im(){Ul()}function Ul(){for(C(n.braceL);!E(n.braceR)&&!c.error;)sm()}function rm(){const e=c.snapshot(),t=nm();return c.restoreFromSnapshot(e),t}function nm(){return I(),E(n.plus)||E(n.minus)?ee(g._readonly):(ee(g._readonly)&&I(),!d(n.bracketL)||(I(),!na())?false:(I(),d(n._in)))}function am(){ae(),C(n._in),Ae()}function om(){C(n.braceL),d(n.plus)||d(n.minus)?(I(),Re(g._readonly)):Le(g._readonly),C(n.bracketL),am(),Le(g._as)&&Ae(),C(n.bracketR),d(n.plus)||d(n.minus)?(I(),C(n.question)):E(n.question),vm(),Se(),C(n.braceR)}function cm(){for(C(n.bracketL);!E(n.bracketR)&&!c.error;)um(),E(n.comma)}function um(){E(n.ellipsis)?Ae():(Ae(),E(n.question)),E(n.colon)&&Ae()}function lm(){C(n.parenL),Ae(),C(n.parenR)}function hm(){for(ts(),ts();!d(n.backQuote)&&!c.error;)C(n.dollarBraceL),Ae(),ts(),ts();I()}var is;(function(e){e[e.TSFunctionType=0]="TSFunctionType";const s=1;e[e.TSConstructorType=s]="TSConstructorType";const i=s+1;e[e.TSAbstractConstructorType=i]="TSAbstractConstructorType"})(is||(is={}));function Mn(e){e===is.TSAbstractConstructorType&&Re(g._abstract),(e===is.TSConstructorType||e===is.TSAbstractConstructorType)&&C(n._new);const t=c.inDisallowConditionalTypesContext;c.inDisallowConditionalTypesContext=false,Xa(n.arrow),c.inDisallowConditionalTypesContext=t}function fm(){switch(c.type){case n.name:Yp();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:Ns();return;case n.minus:I(),Ns();return;case n._this:{Zp(),ee(g._is)&&!Ge()&&Kp();return}case n._typeof:Qp();return;case n._import:Nl();return;case n.braceL:rm()?om():im();return;case n.bracketL:cm();return;case n.parenL:lm();return;case n.backQuote:hm();return;default:if(c.type&n.IS_KEYWORD){I(),c.tokens[c.tokens.length-1].type=n.name;return}break}le()}function dm(){for(fm();!Ge()&&E(n.bracketL);)E(n.bracketR)||(Ae(),C(n.bracketR))}function pm(){if(Re(g._infer),ae(),d(n._extends)){const e=c.snapshot();C(n._extends);const t=c.inDisallowConditionalTypesContext;c.inDisallowConditionalTypesContext=true,Ae(),c.inDisallowConditionalTypesContext=t,(c.error||!c.inDisallowConditionalTypesContext&&d(n.question))&&c.restoreFromSnapshot(e)}}function aa(){if(ee(g._keyof)||ee(g._unique)||ee(g._readonly))I(),aa();else if(ee(g._infer))pm();else{const e=c.inDisallowConditionalTypesContext;c.inDisallowConditionalTypesContext=false,dm(),c.inDisallowConditionalTypesContext=e}}function mc(){if(E(n.bitwiseAND),aa(),d(n.bitwiseAND))for(;E(n.bitwiseAND);)aa()}function mm(){if(E(n.bitwiseOR),mc(),d(n.bitwiseOR))for(;E(n.bitwiseOR);)mc()}function gm(){return d(n.lessThan)?true:d(n.parenL)&&ym()}function bm(){if(d(n.name)||d(n._this))return I(),true;if(d(n.braceL)||d(n.bracketL)){let e=1;for(I();e>0&&!c.error;)d(n.braceL)||d(n.bracketL)?e++:(d(n.braceR)||d(n.bracketR))&&e--,I();return true}return false}function ym(){const e=c.snapshot(),t=_m();return c.restoreFromSnapshot(e),t}function _m(){return I(),!!(d(n.parenR)||d(n.ellipsis)||bm()&&(d(n.colon)||d(n.comma)||d(n.question)||d(n.eq)||d(n.parenR)&&(I(),d(n.arrow))))}function ci(e){const t=de(0);C(e),km()||Ae(),fe(t)}function xm(){d(n.colon)&&ci(n.colon)}function Bs(){d(n.colon)&&_i()}function vm(){E(n.colon)&&Ae()}function km(){const e=c.snapshot();return ee(g._asserts)?(I(),Le(g._is)?(Ae(),true):na()||d(n._this)?(I(),Le(g._is)&&Ae(),true):(c.restoreFromSnapshot(e),false)):na()||d(n._this)?(I(),ee(g._is)&&!Ge()?(I(),Ae(),true):(c.restoreFromSnapshot(e),false)):false}function _i(){const e=de(0);C(n.colon),Ae(),fe(e)}function Ae(){if(gc(),c.inDisallowConditionalTypesContext||Ge()||!E(n._extends))return;const e=c.inDisallowConditionalTypesContext;c.inDisallowConditionalTypesContext=true,gc(),c.inDisallowConditionalTypesContext=e,C(n.question),Ae(),C(n.colon),Ae()}function wm(){return ee(g._abstract)&&Ce()===n._new}function gc(){if(gm()){Mn(is.TSFunctionType);return}if(d(n._new)){Mn(is.TSConstructorType);return}else if(wm()){Mn(is.TSAbstractConstructorType);return}mm()}function Em(){const e=de(1);Ae(),C(n.greaterThan),fe(e),xi()}function Sm(){if(E(n.jsxTagStart)){c.tokens[c.tokens.length-1].type=n.typeParameterStart;const e=de(1);for(;!d(n.greaterThan)&&!c.error;)Ae(),E(n.comma);ct(),fe(e)}}function Ml(){for(;!d(n.braceL)&&!c.error;)Tm(),E(n.comma)}function Tm(){yi(),d(n.lessThan)&&Vs()}function Cm(){us(false),vs(),E(n._extends)&&Ml(),Ul()}function Am(){us(false),vs(),C(n.eq),Ae(),Se()}function Im(){if(d(n.string)?Ns():ae(),E(n.eq)){const e=c.tokens.length-1;Oe(),c.tokens[e].rhsEndIndex=c.tokens.length}}function za(){for(us(false),C(n.braceL);!E(n.braceR)&&!c.error;)Im(),E(n.comma)}function Ya(){C(n.braceL),Sr(n.braceR)}function oa(){us(false),E(n.dot)?oa():Ya()}function Ol(){ee(g._global)?ae():d(n.string)?Xt():le(),d(n.braceL)?Ya():Se()}function ca(){Ki(),C(n.eq),Pm(),Se()}function Rm(){return ee(g._require)&&Ce()===n.parenL}function Pm(){Rm()?Lm():yi()}function Lm(){Re(g._require),C(n.parenL),d(n.string)||le(),Ns(),C(n.parenR)}function Dm(){if(Ct())return false;switch(c.type){case n._function:{const e=de(1);I();const t=c.start;return ys(t,true),fe(e),true}case n._class:{const e=de(1);return _s(true,false),fe(e),true}case n._const:if(d(n._const)&&ja(g._enum)){const e=de(1);return C(n._const),Re(g._enum),c.tokens[c.tokens.length-1].type=n._enum,za(),fe(e),true}case n._var:case n._let:{const e=de(1);return Ni(c.type!==n._var),fe(e),true}case n.name:{const e=de(1),t=c.contextualKeyword;let s=false;return t===g._global?(Ol(),s=true):s=kr(t,true),fe(e),s}default:return false}}function bc(){return kr(c.contextualKeyword,true)}function Nm(e){switch(e){case g._declare:{const t=c.tokens.length-1;if(Dm())return c.tokens[t].type=n._declare,true;break}case g._global:if(d(n.braceL))return Ya(),true;break;default:return kr(e,false)}return false}function kr(e,t){switch(e){case g._abstract:if(Es(t)&&d(n._class))return c.tokens[c.tokens.length-1].type=n._abstract,_s(true,false),true;break;case g._enum:if(Es(t)&&d(n.name))return c.tokens[c.tokens.length-1].type=n._enum,za(),true;break;case g._interface:if(Es(t)&&d(n.name)){const s=de(t?2:1);return Cm(),fe(s),true}break;case g._module:if(Es(t)){if(d(n.string)){const s=de(t?2:1);return Ol(),fe(s),true}else if(d(n.name)){const s=de(t?2:1);return oa(),fe(s),true}}break;case g._namespace:if(Es(t)&&d(n.name)){const s=de(t?2:1);return oa(),fe(s),true}break;case g._type:if(Es(t)&&d(n.name)){const s=de(t?2:1);return Am(),fe(s),true}break}return false}function Es(e){return e?(I(),true):!Ct()}function Fm(){const e=c.snapshot();return vr(),js(),xm(),C(n.arrow),c.error?(c.restoreFromSnapshot(e),false):(vi(true),true)}function Ka(){c.type===n.bitShiftL&&(c.pos-=1,ue(n.lessThan)),Vs()}function Vs(){const e=de(0);for(C(n.lessThan);!d(n.greaterThan)&&!c.error;)Ae(),E(n.comma);e?(C(n.greaterThan),fe(e)):(fe(e),yl(),C(n.greaterThan),c.tokens[c.tokens.length-1].isType=true)}function Bl(){if(d(n.name))switch(c.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 Um(e,t){if(d(n.colon)&&ci(n.colon),!d(n.braceL)&&Ct()){let s=c.tokens.length-1;for(;s>=0&&(c.tokens[s].start>=e||c.tokens[s].type===n._default||c.tokens[s].type===n._export);)c.tokens[s].isType=true,s--;return}vi(false,t)}function Mm(e,t,s){if(!Ge()&&E(n.bang)){c.tokens[c.tokens.length-1].type=n.nonNullAssertion;return}if(d(n.lessThan)||d(n.bitShiftL)){const i=c.snapshot();if(!t&&Xl()&&Fm())return;if(Ka(),!t&&E(n.parenL)?(c.tokens[c.tokens.length-1].subscriptStartIndex=e,rs()):d(n.backQuote)?to():(c.type===n.greaterThan||c.type!==n.parenL&&c.type&n.IS_EXPRESSION_START&&!Ge())&&le(),c.error)c.restoreFromSnapshot(i);else return}else!t&&d(n.questionDot)&&Ce()===n.lessThan&&(I(),c.tokens[e].isOptionalChainStart=true,c.tokens[c.tokens.length-1].subscriptStartIndex=e,Vs(),C(n.parenL),rs());Qa(e,t,s)}function Om(){if(E(n._import))return ee(g._type)&&Ce()!==n.eq&&Re(g._type),ca(),true;if(E(n.eq))return Me(),Se(),true;if(Le(g._as))return Re(g._namespace),ae(),Se(),true;if(ee(g._type)){const e=Ce();(e===n.braceL||e===n.star)&&I()}return false}function Bm(){if(ae(),d(n.comma)||d(n.braceR)){c.tokens[c.tokens.length-1].identifierRole=ie.ImportDeclaration;return}if(ae(),d(n.comma)||d(n.braceR)){c.tokens[c.tokens.length-1].identifierRole=ie.ImportDeclaration,c.tokens[c.tokens.length-2].isType=true,c.tokens[c.tokens.length-1].isType=true;return}if(ae(),d(n.comma)||d(n.braceR)){c.tokens[c.tokens.length-3].identifierRole=ie.ImportAccess,c.tokens[c.tokens.length-1].identifierRole=ie.ImportDeclaration;return}ae(),c.tokens[c.tokens.length-3].identifierRole=ie.ImportAccess,c.tokens[c.tokens.length-1].identifierRole=ie.ImportDeclaration,c.tokens[c.tokens.length-4].isType=true,c.tokens[c.tokens.length-3].isType=true,c.tokens[c.tokens.length-2].isType=true,c.tokens[c.tokens.length-1].isType=true}function Vm(){if(ae(),d(n.comma)||d(n.braceR)){c.tokens[c.tokens.length-1].identifierRole=ie.ExportAccess;return}if(ae(),d(n.comma)||d(n.braceR)){c.tokens[c.tokens.length-1].identifierRole=ie.ExportAccess,c.tokens[c.tokens.length-2].isType=true,c.tokens[c.tokens.length-1].isType=true;return}if(ae(),d(n.comma)||d(n.braceR)){c.tokens[c.tokens.length-3].identifierRole=ie.ExportAccess;return}ae(),c.tokens[c.tokens.length-3].identifierRole=ie.ExportAccess,c.tokens[c.tokens.length-4].isType=true,c.tokens[c.tokens.length-3].isType=true,c.tokens[c.tokens.length-2].isType=true,c.tokens[c.tokens.length-1].isType=true}function jm(){if(ee(g._abstract)&&Ce()===n._class)return c.type=n._abstract,I(),_s(true,true),true;if(ee(g._interface)){const e=de(2);return kr(g._interface,true),fe(e),true}return false}function $m(){if(c.type===n._const){const e=bi();if(e.type===n.name&&e.contextualKeyword===g._enum)return C(n._const),Re(g._enum),c.tokens[c.tokens.length-1].type=n._enum,za(),true}return false}function qm(e){const t=c.tokens.length;Ga([g._abstract,g._readonly,g._declare,g._static,g._override]);const s=c.tokens.length;if(Fl()){const r=e?t-1:t;for(let a=r;a<s;a++)c.tokens[a].isType=true;return true}return false}function Hm(e){Nm(e)||Se()}function Wm(){const e=Le(g._declare);e&&(c.tokens[c.tokens.length-1].type=n._declare);let t=false;if(d(n.name))if(e){const s=de(2);t=bc(),fe(s)}else t=bc();if(!t)if(e){const s=de(2);rt(true),fe(s)}else rt(true)}function Gm(e){if(e&&(d(n.lessThan)||d(n.bitShiftL))&&Ka(),Le(g._implements)){c.tokens[c.tokens.length-1].type=n._implements;const t=de(1);Ml(),fe(t)}}function Xm(){vs()}function zm(){vs()}function Ym(){const e=de(0);Ge()||E(n.bang),Bs(),fe(e)}function Km(){d(n.colon)&&_i()}function Zm(e,t){return yr?Qm(e,t):Jm(e,t)}function Qm(e,t){if(!d(n.lessThan))return Rt(e,t);const s=c.snapshot();let i=Rt(e,t);if(c.error)c.restoreFromSnapshot(s);else return i;return c.type=n.typeParameterStart,vr(),i=Rt(e,t),i||le(),i}function Jm(e,t){if(!d(n.lessThan))return Rt(e,t);const s=c.snapshot();vr();const i=Rt(e,t);if(i||le(),c.error)c.restoreFromSnapshot(s);else return i;return Rt(e,t)}function e0(){if(d(n.colon)){const e=c.snapshot();ci(n.colon),it()&&le(),d(n.arrow)||le(),c.error&&c.restoreFromSnapshot(e)}return E(n.arrow)}function t0(){const e=de(0);E(n.question),Bs(),fe(e)}function s0(){(d(n.lessThan)||d(n.bitShiftL))&&Ka(),n1()}function i0(){let e=false,t=false;for(;;){if(c.pos>=$.length){le("Unterminated JSX contents");return}const s=$.charCodeAt(c.pos);if(s===y.lessThan||s===y.leftCurlyBrace){if(c.pos===c.start){if(s===y.lessThan){c.pos++,ue(n.jsxTagStart);return}_l(s);return}ue(e&&!t?n.jsxEmptyText:n.jsxText);return}s===y.lineFeed?e=true:s!==y.space&&s!==y.carriageReturn&&s!==y.tab&&(t=true),c.pos++}}function r0(e){for(c.pos++;;){if(c.pos>=$.length){le("Unterminated string constant");return}if($.charCodeAt(c.pos)===e){c.pos++;break}c.pos++}ue(n.string)}function n0(){let e;do{if(c.pos>$.length){le("Unexpectedly reached the end of input.");return}e=$.charCodeAt(++c.pos)}while(_t[e]||e===y.dash);ue(n.jsxName)}function ua(){ct()}function Vl(e){if(ua(),!E(n.colon)){c.tokens[c.tokens.length-1].identifierRole=e;return}ua()}function jl(){const e=c.tokens.length;Vl(ie.Access);let t=false;for(;d(n.dot);)t=true,ct(),ua();if(!t){const s=c.tokens[e],i=$.charCodeAt(s.start);i>=y.lowercaseA&&i<=y.lowercaseZ&&(s.identifierRole=null)}}function a0(){switch(c.type){case n.braceL:I(),Me(),ct();return;case n.jsxTagStart:ql(),ct();return;case n.string:ct();return;default:le("JSX value should be either an expression or a quoted JSX text")}}function o0(){C(n.ellipsis),Me()}function c0(e){if(d(n.jsxTagEnd))return false;jl(),me&&Sm();let t=false;for(;!d(n.slash)&&!d(n.jsxTagEnd)&&!c.error;){if(E(n.braceL)){t=true,C(n.ellipsis),Oe(),ct();continue}t&&c.end-c.start===3&&$.charCodeAt(c.start)===y.lowercaseK&&$.charCodeAt(c.start+1)===y.lowercaseE&&$.charCodeAt(c.start+2)===y.lowercaseY&&(c.tokens[e].jsxRole=pt.KeyAfterPropSpread),Vl(ie.ObjectKey),d(n.eq)&&(ct(),a0())}const s=d(n.slash);return s&&ct(),s}function u0(){d(n.jsxTagEnd)||jl()}function $l(){const e=c.tokens.length-1;c.tokens[e].jsxRole=pt.NoChildren;let t=0;if(!c0(e))for(Ss();;)switch(c.type){case n.jsxTagStart:if(ct(),d(n.slash)){ct(),u0(),c.tokens[e].jsxRole!==pt.KeyAfterPropSpread&&(t===1?c.tokens[e].jsxRole=pt.OneChild:t>1&&(c.tokens[e].jsxRole=pt.StaticChildren));return}t++,$l(),Ss();break;case n.jsxText:t++,Ss();break;case n.jsxEmptyText:Ss();break;case n.braceL:I(),d(n.ellipsis)?(o0(),Ss(),t+=2):(d(n.braceR)||(t++,Me()),Ss());break;default:le();return}}function ql(){ct(),$l()}function ct(){c.tokens.push(new _r),gl(),c.start=c.pos;const e=$.charCodeAt(c.pos);if(gi[e])n0();else if(e===y.quotationMark||e===y.apostrophe)r0(e);else switch(++c.pos,e){case y.greaterThan:ue(n.jsxTagEnd);break;case y.lessThan:ue(n.jsxTagStart);break;case y.slash:ue(n.slash);break;case y.equalsTo:ue(n.eq);break;case y.leftCurlyBrace:ue(n.braceL);break;case y.dot:ue(n.dot);break;case y.colon:ue(n.colon);break;default:le()}}function Ss(){c.tokens.push(new _r),c.start=c.pos,i0()}function l0(e){if(d(n.question)){const t=Ce();if(t===n.colon||t===n.comma||t===n.parenR)return}Hl(e)}function h0(){hl(n.question),d(n.colon)&&(me?_i():_e&&ks())}class f0{constructor(t){this.stop=t}}function Me(e=false){if(Oe(e),d(n.comma))for(;E(n.comma);)Oe(e)}function Oe(e=false,t=false){return me?Zm(e,t):_e?bg(e,t):Rt(e,t)}function Rt(e,t){if(d(n._yield))return A0(),false;(d(n.parenL)||d(n.name)||d(n._yield))&&(c.potentialArrowAt=c.start);const s=d0(e);return t&&eo(),c.type&n.IS_ASSIGN?(I(),Oe(e),false):s}function d0(e){return m0(e)?true:(p0(e),false)}function p0(e){me||_e?l0(e):Hl(e)}function Hl(e){E(n.question)&&(Oe(),C(n.colon),Oe(e))}function m0(e){const t=c.tokens.length;return xi()?true:(Li(t,-1,e),false)}function Li(e,t,s){if(me&&(n._in&n.PRECEDENCE_MASK)>t&&!Ge()&&(Le(g._as)||Le(g._satisfies))){const r=de(1);Ae(),fe(r),yl(),Li(e,t,s);return}const i=c.type&n.PRECEDENCE_MASK;if(i>0&&(!s||!d(n._in))&&i>t){const r=c.type;I(),r===n.nullishCoalescing&&(c.tokens[c.tokens.length-1].nullishStartIndex=e);const a=c.tokens.length;xi(),Li(a,r&n.IS_RIGHT_ASSOCIATIVE?i-1:i,s),r===n.nullishCoalescing&&(c.tokens[e].numNullishCoalesceStarts++,c.tokens[c.tokens.length-1].numNullishCoalesceEnds++),Li(e,t,s)}}function xi(){if(me&&!yr&&E(n.lessThan))return Em(),false;if(ee(g._module)&&dl()===y.leftCurlyBrace&&!al())return I0(),false;if(c.type&n.IS_PREFIX)return I(),xi(),false;if(Wl())return true;for(;c.type&n.IS_POSTFIX&&!it();)c.type===n.preIncDec&&(c.type=n.postIncDec),I();return false}function Wl(){const e=c.tokens.length;return Xt()?true:(Za(e),c.tokens.length>e&&c.tokens[e].isOptionalChainStart&&(c.tokens[c.tokens.length-1].isOptionalChainEnd=true),false)}function Za(e,t=false){_e?_g(e,t):Gl(e,t)}function Gl(e,t=false){const s=new f0(false);do g0(e,t,s);while(!s.stop&&!c.error)}function g0(e,t,s){me?Mm(e,t,s):_e?J0(e,t,s):Qa(e,t,s)}function Qa(e,t,s){if(!t&&E(n.doubleColon))Ja(),s.stop=true,Za(e,t);else if(d(n.questionDot)){if(c.tokens[e].isOptionalChainStart=true,t&&Ce()===n.parenL){s.stop=true;return}I(),c.tokens[c.tokens.length-1].subscriptStartIndex=e,E(n.bracketL)?(Me(),C(n.bracketR)):E(n.parenL)?rs():Ji()}else if(E(n.dot))c.tokens[c.tokens.length-1].subscriptStartIndex=e,Ji();else if(E(n.bracketL))c.tokens[c.tokens.length-1].subscriptStartIndex=e,Me(),C(n.bracketR);else if(!t&&d(n.parenL))if(Xl()){const i=c.snapshot(),r=c.tokens.length;I(),c.tokens[c.tokens.length-1].subscriptStartIndex=e;const a=ai();c.tokens[c.tokens.length-1].contextId=a,rs(),c.tokens[c.tokens.length-1].contextId=a,b0()&&(c.restoreFromSnapshot(i),s.stop=true,c.scopeDepth++,js(),y0(r))}else{I(),c.tokens[c.tokens.length-1].subscriptStartIndex=e;const i=ai();c.tokens[c.tokens.length-1].contextId=i,rs(),c.tokens[c.tokens.length-1].contextId=i}else d(n.backQuote)?to():s.stop=true}function Xl(){return c.tokens[c.tokens.length-1].contextualKeyword===g._async&&!it()}function rs(){let e=true;for(;!E(n.parenR)&&!c.error;){if(e)e=false;else if(C(n.comma),E(n.parenR))break;Zl(false)}}function b0(){return d(n.colon)||d(n.arrow)}function y0(e){me?Km():_e&&gg(),C(n.arrow),li(e)}function Ja(){const e=c.tokens.length;Xt(),Za(e,true)}function Xt(){if(E(n.modulo))return ae(),false;if(d(n.jsxText)||d(n.jsxEmptyText))return Ns(),false;if(d(n.lessThan)&&yr)return c.type=n.jsxTagStart,ql(),I(),false;const e=c.potentialArrowAt===c.start;switch(c.type){case n.slash:case n.assign:jd();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(),d(n.dot)&&(c.tokens[c.tokens.length-1].type=n.name,I(),ae()),false;case n.name:{const t=c.tokens.length,s=c.start,i=c.contextualKeyword;return ae(),i===g._await?(C0(),false):i===g._async&&d(n._function)&&!it()?(I(),ys(s,false),false):e&&i===g._async&&!it()&&d(n.name)?(c.scopeDepth++,us(false),C(n.arrow),li(t),true):d(n._do)&&!it()?(I(),ns(),false):e&&!it()&&d(n.arrow)?(c.scopeDepth++,Ha(false),C(n.arrow),li(t),true):(c.tokens[c.tokens.length-1].identifierRole=ie.Access,false)}case n._do:return I(),ns(),false;case n.parenL:return zl(e);case n.bracketL:return I(),Kl(n.bracketR,true),false;case n.braceL:return so(false,false),false;case n._function:return _0(),false;case n.at:ho();case n._class:return _s(false),false;case n._new:return v0(),false;case n.backQuote:return to(),false;case n.doubleColon:return I(),Ja(),false;case n.hash:{const t=dl();return gi[t]||t===y.backslash?Ji():I(),false}default:return le(),false}}function Ji(){E(n.hash),ae()}function _0(){const e=c.start;ae(),E(n.dot)&&ae(),ys(e,false)}function Ns(){I()}function wr(){C(n.parenL),Me(),C(n.parenR)}function zl(e){const t=c.snapshot(),s=c.tokens.length;C(n.parenL);let i=true;for(;!d(n.parenR)&&!c.error;){if(i)i=false;else if(C(n.comma),d(n.parenR))break;if(d(n.ellipsis)){Rl(false),eo();break}else Oe(false,true)}return C(n.parenR),e&&x0()&&la()?(c.restoreFromSnapshot(t),c.scopeDepth++,js(),la(),li(s),c.error?(c.restoreFromSnapshot(t),zl(false),false):true):false}function x0(){return d(n.colon)||!it()}function la(){return me?e0():_e?yg():E(n.arrow)}function eo(){(me||_e)&&h0()}function v0(){if(C(n._new),E(n.dot)){ae();return}k0(),_e&&eg(),E(n.parenL)&&Kl(n.parenR)}function k0(){Ja(),E(n.questionDot)}function to(){for(ts(),ts();!d(n.backQuote)&&!c.error;)C(n.dollarBraceL),Me(),ts(),ts();I()}function so(e,t){const s=ai();let i=true;for(I(),c.tokens[c.tokens.length-1].contextId=s;!E(n.braceR)&&!c.error;){if(i)i=false;else if(C(n.comma),E(n.braceR))break;let r=false;if(d(n.ellipsis)){const a=c.tokens.length;if(Il(),e&&(c.tokens.length===a+2&&Ha(t),E(n.braceR)))break;continue}e||(r=E(n.star)),!e&&ee(g._async)?(r&&le(),ae(),d(n.colon)||d(n.parenL)||d(n.braceR)||d(n.eq)||d(n.comma)||(d(n.star)&&(I(),r=true),ui(s))):ui(s),T0(e,t,s)}c.tokens[c.tokens.length-1].contextId=s}function w0(e){return!e&&(d(n.string)||d(n.num)||d(n.bracketL)||d(n.name)||!!(c.type&n.IS_KEYWORD))}function E0(e,t){const s=c.start;return d(n.parenL)?(e&&le(),ha(s,false),true):w0(e)?(ui(t),ha(s,false),true):false}function S0(e,t){if(E(n.colon)){e?Zi(t):Oe(false);return}let s;e?c.scopeDepth===0?s=ie.ObjectShorthandTopLevelDeclaration:t?s=ie.ObjectShorthandBlockScopedDeclaration:s=ie.ObjectShorthandFunctionScopedDeclaration:s=ie.ObjectShorthand,c.tokens[c.tokens.length-1].identifierRole=s,Zi(t,true)}function T0(e,t,s){me?Xm():_e&&lg(),E0(e,s)||S0(e,t)}function ui(e){_e&&lo(),E(n.bracketL)?(c.tokens[c.tokens.length-1].contextId=e,Oe(),C(n.bracketR),c.tokens[c.tokens.length-1].contextId=e):(d(n.num)||d(n.string)||d(n.bigint)||d(n.decimal)?Xt():Ji(),c.tokens[c.tokens.length-1].identifierRole=ie.ObjectKey,c.tokens[c.tokens.length-1].contextId=e)}function ha(e,t){const s=ai();c.scopeDepth++;const i=c.tokens.length;js(t,s),Yl(e,s);const a=c.tokens.length;c.scopes.push(new Dt(i,a,true)),c.scopeDepth--}function li(e){vi(true);const t=c.tokens.length;c.scopes.push(new Dt(e,t,true)),c.scopeDepth--}function Yl(e,t=0){me?Um(e,t):_e?Q0(t):vi(false,t)}function vi(e,t=0){e&&!d(n.braceL)?Oe():ns(true,t)}function Kl(e,t=false){let s=true;for(;!E(e)&&!c.error;){if(s)s=false;else if(C(n.comma),E(e))break;Zl(t)}}function Zl(e){e&&d(n.comma)||(d(n.ellipsis)?(Il(),eo()):d(n.question)?I():Oe(false,true))}function ae(){I(),c.tokens[c.tokens.length-1].type=n.name}function C0(){xi()}function A0(){I(),!d(n.semi)&&!it()&&(E(n.star),Oe())}function I0(){Re(g._module),C(n.braceL),Sr(n.braceR)}function R0(e){return(e.type===n.name||!!(e.type&n.IS_KEYWORD))&&e.contextualKeyword!==g._from}function Nt(e){const t=de(0);C(e||n.colon),et(),fe(t)}function yc(){C(n.modulo),Re(g._checks),E(n.parenL)&&(Me(),C(n.parenR))}function io(){const e=de(0);C(n.colon),d(n.modulo)?yc():(et(),d(n.modulo)&&yc()),fe(e)}function P0(){I(),ro(true)}function L0(){I(),ae(),d(n.lessThan)&&vt(),C(n.parenL),da(),C(n.parenR),io(),Se()}function fa(){d(n._class)?P0():d(n._function)?L0():d(n._var)?D0():Le(g._module)?E(n.dot)?U0():N0():ee(g._type)?M0():ee(g._opaque)?O0():ee(g._interface)?B0():d(n._export)?F0():le()}function D0(){I(),t1(),Se()}function N0(){for(d(n.string)?Xt():ae(),C(n.braceL);!d(n.braceR)&&!c.error;)d(n._import)?(I(),h1()):le();C(n.braceR)}function F0(){C(n._export),E(n._default)?d(n._function)||d(n._class)?fa():(et(),Se()):d(n._var)||d(n._function)||d(n._class)||ee(g._opaque)?fa():d(n.star)||d(n.braceL)||ee(g._interface)||ee(g._type)||ee(g._opaque)?u1():le()}function U0(){Re(g._exports),ks(),Se()}function M0(){I(),ao()}function O0(){I(),oo(true)}function B0(){I(),ro()}function ro(e=false){if(Er(),d(n.lessThan)&&vt(),E(n._extends))do Di();while(!e&&E(n.comma));if(ee(g._mixins)){I();do Di();while(E(n.comma))}if(ee(g._implements)){I();do Di();while(E(n.comma))}er(e,false,e)}function Di(){Ql(false),d(n.lessThan)&&bs()}function no(){ro()}function Er(){ae()}function ao(){Er(),d(n.lessThan)&&vt(),Nt(n.eq),Se()}function oo(e){Re(g._type),Er(),d(n.lessThan)&&vt(),d(n.colon)&&Nt(n.colon),e||Nt(n.eq),Se()}function V0(){lo(),t1(),E(n.eq)&&et()}function vt(){const e=de(0);d(n.lessThan)||d(n.typeParameterStart)?I():le();do V0(),d(n.greaterThan)||C(n.comma);while(!d(n.greaterThan)&&!c.error);C(n.greaterThan),fe(e)}function bs(){const e=de(0);for(C(n.lessThan);!d(n.greaterThan)&&!c.error;)et(),d(n.greaterThan)||C(n.comma);C(n.greaterThan),fe(e)}function j0(){if(Re(g._interface),E(n._extends))do Di();while(E(n.comma));er(false,false,false)}function co(){d(n.num)||d(n.string)?Xt():ae()}function $0(){Ce()===n.colon?(co(),Nt()):et(),C(n.bracketR),Nt()}function q0(){co(),C(n.bracketR),C(n.bracketR),d(n.lessThan)||d(n.parenL)?uo():(E(n.question),Nt())}function uo(){for(d(n.lessThan)&&vt(),C(n.parenL);!d(n.parenR)&&!d(n.ellipsis)&&!c.error;)tr(),d(n.parenR)||C(n.comma);E(n.ellipsis)&&tr(),C(n.parenR),Nt()}function H0(){uo()}function er(e,t,s){let i;for(t&&d(n.braceBarL)?(C(n.braceBarL),i=n.braceBarR):(C(n.braceL),i=n.braceR);!d(i)&&!c.error;){if(s&&ee(g._proto)){const r=Ce();r!==n.colon&&r!==n.question&&(I(),e=false)}if(e&&ee(g._static)){const r=Ce();r!==n.colon&&r!==n.question&&I()}if(lo(),E(n.bracketL))E(n.bracketL)?q0():$0();else if(d(n.parenL)||d(n.lessThan))H0();else{if(ee(g._get)||ee(g._set)){const r=Ce();(r===n.name||r===n.string||r===n.num)&&I()}W0()}G0()}C(i)}function W0(){if(d(n.ellipsis)){if(C(n.ellipsis),E(n.comma)||E(n.semi),d(n.braceR))return;et()}else co(),d(n.lessThan)||d(n.parenL)?uo():(E(n.question),Nt())}function G0(){!E(n.semi)&&!E(n.comma)&&!d(n.braceR)&&!d(n.braceBarR)&&le()}function Ql(e){for(e||ae();E(n.dot);)ae()}function X0(){Ql(true),d(n.lessThan)&&bs()}function z0(){C(n._typeof),Jl()}function Y0(){for(C(n.bracketL);c.pos<$.length&&!d(n.bracketR)&&(et(),!d(n.bracketR));)C(n.comma);C(n.bracketR)}function tr(){const e=Ce();e===n.colon||e===n.question?(ae(),E(n.question),Nt()):et()}function da(){for(;!d(n.parenR)&&!d(n.ellipsis)&&!c.error;)tr(),d(n.parenR)||C(n.comma);E(n.ellipsis)&&tr()}function Jl(){let e=false;const t=c.noAnonFunctionType;switch(c.type){case n.name:{if(ee(g._interface)){j0();return}ae(),X0();return}case n.braceL:er(false,false,false);return;case n.braceBarL:er(false,true,false);return;case n.bracketL:Y0();return;case n.lessThan:vt(),C(n.parenL),da(),C(n.parenR),C(n.arrow),et();return;case n.parenL:if(I(),!d(n.parenR)&&!d(n.ellipsis))if(d(n.name)){const s=Ce();e=s!==n.question&&s!==n.colon}else e=true;if(e)if(c.noAnonFunctionType=false,et(),c.noAnonFunctionType=t,c.noAnonFunctionType||!(d(n.comma)||d(n.parenR)&&Ce()===n.arrow)){C(n.parenR);return}else E(n.comma);da(),C(n.parenR),C(n.arrow),et();return;case n.minus:I(),Ns();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(c.type===n._typeof){z0();return}else if(c.type&n.IS_KEYWORD){I(),c.tokens[c.tokens.length-1].type=n.name;return}}le()}function K0(){for(Jl();!it()&&(d(n.bracketL)||d(n.questionDot));)E(n.questionDot),C(n.bracketL),E(n.bracketR)||(et(),C(n.bracketR))}function e1(){E(n.question)?e1():K0()}function _c(){e1(),!c.noAnonFunctionType&&E(n.arrow)&&et()}function xc(){for(E(n.bitwiseAND),_c();E(n.bitwiseAND);)_c()}function Z0(){for(E(n.bitwiseOR),xc();E(n.bitwiseOR);)xc()}function et(){Z0()}function ks(){Nt()}function t1(){ae(),d(n.colon)&&ks()}function lo(){(d(n.plus)||d(n.minus))&&(I(),c.tokens[c.tokens.length-1].isType=true)}function Q0(e){d(n.colon)&&io(),vi(false,e)}function J0(e,t,s){if(d(n.questionDot)&&Ce()===n.lessThan){if(t){s.stop=true;return}I(),bs(),C(n.parenL),rs();return}else if(!t&&d(n.lessThan)){const i=c.snapshot();if(bs(),C(n.parenL),rs(),c.error)c.restoreFromSnapshot(i);else return}Qa(e,t,s)}function eg(){if(d(n.lessThan)){const e=c.snapshot();bs(),c.error&&c.restoreFromSnapshot(e)}}function tg(){if(d(n.name)&&c.contextualKeyword===g._interface){const e=de(0);return I(),no(),fe(e),true}else if(ee(g._enum))return s1(),true;return false}function sg(){return ee(g._enum)?(s1(),true):false}function ig(e){if(e===g._declare){if(d(n._class)||d(n.name)||d(n._function)||d(n._var)||d(n._export)){const t=de(1);fa(),fe(t)}}else if(d(n.name)){if(e===g._interface){const t=de(1);no(),fe(t)}else if(e===g._type){const t=de(1);ao(),fe(t)}else if(e===g._opaque){const t=de(1);oo(false),fe(t)}}Se()}function rg(){return ee(g._type)||ee(g._interface)||ee(g._opaque)||ee(g._enum)}function ng(){return d(n.name)&&(c.contextualKeyword===g._type||c.contextualKeyword===g._interface||c.contextualKeyword===g._opaque||c.contextualKeyword===g._enum)}function ag(){if(ee(g._type)){const e=de(1);I(),d(n.braceL)?(fo(),hi()):ao(),fe(e)}else if(ee(g._opaque)){const e=de(1);I(),oo(false),fe(e)}else if(ee(g._interface)){const e=de(1);I(),no(),fe(e)}else rt(true)}function og(){return d(n.star)||ee(g._type)&&Ce()===n.star}function cg(){if(Le(g._type)){const e=de(2);pa(),fe(e)}else pa()}function ug(e){if(e&&d(n.lessThan)&&bs(),ee(g._implements)){const t=de(0);I(),c.tokens[c.tokens.length-1].type=n._implements;do Er(),d(n.lessThan)&&bs();while(E(n.comma));fe(t)}}function lg(){d(n.lessThan)&&(vt(),d(n.parenL)||le())}function hg(){const e=de(0);E(n.question),d(n.colon)&&ks(),fe(e)}function fg(){if(d(n._typeof)||ee(g._type)){const e=bi();(R0(e)||e.type===n.braceL||e.type===n.star)&&I()}}function dg(){const e=c.contextualKeyword===g._type||c.type===n._typeof;e?I():ae(),ee(g._as)&&!ja(g._as)?(ae(),e&&!d(n.name)&&!(c.type&n.IS_KEYWORD)||ae()):(e&&(d(n.name)||c.type&n.IS_KEYWORD)&&ae(),Le(g._as)&&ae())}function pg(){if(d(n.lessThan)){const e=de(0);vt(),fe(e)}}function mg(){d(n.colon)&&ks()}function gg(){if(d(n.colon)){const e=c.noAnonFunctionType;c.noAnonFunctionType=true,ks(),c.noAnonFunctionType=e}}function bg(e,t){if(d(n.lessThan)){const s=c.snapshot();let i=Rt(e,t);if(c.error)c.restoreFromSnapshot(s),c.type=n.typeParameterStart;else return i;const r=de(0);if(vt(),fe(r),i=Rt(e,t),i)return true;le()}return Rt(e,t)}function yg(){if(d(n.colon)){const e=de(0),t=c.snapshot(),s=c.noAnonFunctionType;c.noAnonFunctionType=true,io(),c.noAnonFunctionType=s,it()&&le(),d(n.arrow)||le(),c.error&&c.restoreFromSnapshot(t),fe(e)}return E(n.arrow)}function _g(e,t=false){if(c.tokens[c.tokens.length-1].contextualKeyword===g._async&&d(n.lessThan)){const s=c.snapshot();if(xg()&&!c.error)return;c.restoreFromSnapshot(s)}Gl(e,t)}function xg(){c.scopeDepth++;const e=c.tokens.length;return js(),la()?(li(e),true):false}function s1(){Re(g._enum),c.tokens[c.tokens.length-1].type=n._enum,ae(),vg()}function vg(){Le(g._of)&&I(),C(n.braceL),kg(),C(n.braceR)}function kg(){for(;!d(n.braceR)&&!c.error&&!E(n.ellipsis);)wg(),d(n.braceR)||C(n.comma)}function wg(){ae(),E(n.eq)&&I()}function Eg(){if(Sr(n.eof),c.scopes.push(new Dt(0,c.tokens.length,true)),c.scopeDepth!==0)throw new Error(`Invalid scope depth at end of file: ${c.scopeDepth}`);return new lb(c.tokens,c.scopes)}function rt(e){_e&&tg()||(d(n.at)&&ho(),Sg(e))}function Sg(e){if(me&&$m())return;const t=c.type;switch(t){case n._break:case n._continue:Cg();return;case n._debugger:Ag();return;case n._do:Ig();return;case n._for:Rg();return;case n._function:if(Ce()===n.dot)break;e||le(),Dg();return;case n._class:e||le(),_s(true);return;case n._if:Ng();return;case n._return:Fg();return;case n._switch:Ug();return;case n._throw:Mg();return;case n._try:Bg();return;case n._let:case n._const:e||le();case n._var:Ni(t!==n._var);return;case n._while:Vg();return;case n.braceL:ns();return;case n.semi:jg();return;case n._export:case n._import:{const r=Ce();if(r===n.parenL||r===n.dot)break;I(),t===n._import?h1():u1();return}case n.name:if(c.contextualKeyword===g._async){const r=c.start,a=c.snapshot();if(I(),d(n._function)&&!it()){C(n._function),ys(r,true);return}else c.restoreFromSnapshot(a)}else if(c.contextualKeyword===g._using&&!al()&&Ce()===n.name){Ni(true);return}else if(i1()){Re(g._await),Ni(true);return}}const s=c.tokens.length;Me();let i=null;if(c.tokens.length===s+1){const r=c.tokens[c.tokens.length-1];r.type===n.name&&(i=r.contextualKeyword)}if(i==null){Se();return}E(n.colon)?$g():qg(i)}function i1(){if(!ee(g._await))return false;const e=c.snapshot();return I(),!ee(g._using)||Ge()||(I(),!d(n.name)||Ge())?(c.restoreFromSnapshot(e),false):(c.restoreFromSnapshot(e),true)}function ho(){for(;d(n.at);)r1()}function r1(){if(I(),E(n.parenL))Me(),C(n.parenR);else{for(ae();E(n.dot);)ae();Tg()}}function Tg(){me?s0():n1()}function n1(){E(n.parenL)&&rs()}function Cg(){I(),Ct()||(ae(),Se())}function Ag(){I(),Se()}function Ig(){I(),rt(false),C(n._while),wr(),E(n.semi)}function Rg(){c.scopeDepth++;const e=c.tokens.length;Lg();const t=c.tokens.length;c.scopes.push(new Dt(e,t,false)),c.scopeDepth--}function Pg(){return!(!ee(g._using)||ja(g._of))}function Lg(){I();let e=false;if(ee(g._await)&&(e=true,I()),C(n.parenL),d(n.semi)){e&&le(),On();return}const t=i1();if(t||d(n._var)||d(n._let)||d(n._const)||Pg()){if(t&&Re(g._await),I(),a1(true,c.type!==n._var),d(n._in)||ee(g._of)){vc(e);return}On();return}if(Me(true),d(n._in)||ee(g._of)){vc(e);return}e&&le(),On()}function Dg(){const e=c.start;I(),ys(e,true)}function Ng(){I(),wr(),rt(false),E(n._else)&&rt(false)}function Fg(){I(),Ct()||(Me(),Se())}function Ug(){I(),wr(),c.scopeDepth++;const e=c.tokens.length;for(C(n.braceL);!d(n.braceR)&&!c.error;)if(d(n._case)||d(n._default)){const s=d(n._case);I(),s&&Me(),C(n.colon)}else rt(true);I();const t=c.tokens.length;c.scopes.push(new Dt(e,t,false)),c.scopeDepth--}function Mg(){I(),Me(),Se()}function Og(){xr(true),me&&Bs()}function Bg(){if(I(),ns(),d(n._catch)){I();let e=null;if(d(n.parenL)&&(c.scopeDepth++,e=c.tokens.length,C(n.parenL),Og(),C(n.parenR)),ns(),e!=null){const t=c.tokens.length;c.scopes.push(new Dt(e,t,false)),c.scopeDepth--}}E(n._finally)&&ns()}function Ni(e){I(),a1(false,e),Se()}function Vg(){I(),wr(),rt(false)}function jg(){I()}function $g(){rt(true)}function qg(e){me?Hm(e):_e?ig(e):Se()}function ns(e=false,t=0){const s=c.tokens.length;c.scopeDepth++,C(n.braceL),t&&(c.tokens[c.tokens.length-1].contextId=t),Sr(n.braceR),t&&(c.tokens[c.tokens.length-1].contextId=t);const i=c.tokens.length;c.scopes.push(new Dt(s,i,e)),c.scopeDepth--}function Sr(e){for(;!E(e)&&!c.error;)rt(true)}function On(){C(n.semi),d(n.semi)||Me(),C(n.semi),d(n.parenR)||Me(),C(n.parenR),rt(false)}function vc(e){e?Le(g._of):I(),Me(),C(n.parenR),rt(false)}function a1(e,t){for(;;){if(Hg(t),E(n.eq)){const s=c.tokens.length-1;Oe(e),c.tokens[s].rhsEndIndex=c.tokens.length}if(!E(n.comma))break}}function Hg(e){xr(e),me?Ym():_e&&mg()}function ys(e,t,s=false){d(n.star)&&I(),t&&!s&&!d(n.name)&&!d(n._yield)&&le();let i=null;d(n.name)&&(t||(i=c.tokens.length,c.scopeDepth++),us(false));const r=c.tokens.length;c.scopeDepth++,js(),Yl(e);const a=c.tokens.length;c.scopes.push(new Dt(r,a,true)),c.scopeDepth--,i!==null&&(c.scopes.push(new Dt(i,a,true)),c.scopeDepth--)}function js(e=false,t=0){me?zm():_e&&pg(),C(n.parenL),t&&(c.tokens[c.tokens.length-1].contextId=t),Wa(n.parenR,false,false,e,t),t&&(c.tokens[c.tokens.length-1].contextId=t)}function _s(e,t=false){const s=ai();I(),c.tokens[c.tokens.length-1].contextId=s,c.tokens[c.tokens.length-1].isExpression=!e;let i=null;e||(i=c.tokens.length,c.scopeDepth++),zg(e,t),Yg();const r=c.tokens.length;if(Wg(s),!c.error&&(c.tokens[r].contextId=s,c.tokens[c.tokens.length-1].contextId=s,i!==null)){const a=c.tokens.length;c.scopes.push(new Dt(i,a,false)),c.scopeDepth--}}function o1(){return d(n.eq)||d(n.semi)||d(n.braceR)||d(n.bang)||d(n.colon)}function c1(){return d(n.parenL)||d(n.lessThan)}function Wg(e){for(C(n.braceL);!E(n.braceR)&&!c.error;){if(E(n.semi))continue;if(d(n.at)){r1();continue}const t=c.start;Gg(t,e)}}function Gg(e,t){me&&Ga([g._declare,g._public,g._protected,g._private,g._override]);let s=false;if(d(n.name)&&c.contextualKeyword===g._static){if(ae(),c1()){Ks(e,false);return}else if(o1()){Fi();return}if(c.tokens[c.tokens.length-1].type=n._static,s=true,d(n.braceL)){c.tokens[c.tokens.length-1].contextId=t,ns();return}}Xg(e,s,t)}function Xg(e,t,s){if(me&&qm(t))return;if(E(n.star)){Gs(s),Ks(e,false);return}Gs(s);let i=false;const r=c.tokens[c.tokens.length-1];r.contextualKeyword===g._constructor&&(i=true),kc(),c1()?Ks(e,i):o1()?Fi():r.contextualKeyword===g._async&&!Ct()?(c.tokens[c.tokens.length-1].type=n._async,d(n.star)&&I(),Gs(s),kc(),Ks(e,false)):(r.contextualKeyword===g._get||r.contextualKeyword===g._set)&&!(Ct()&&d(n.star))?(r.contextualKeyword===g._get?c.tokens[c.tokens.length-1].type=n._get:c.tokens[c.tokens.length-1].type=n._set,Gs(s),Ks(e,false)):r.contextualKeyword===g._accessor&&!Ct()?(Gs(s),Fi()):Ct()?Fi():le()}function Ks(e,t){me?vs():_e&&d(n.lessThan)&&vt(),ha(e,t)}function Gs(e){ui(e)}function kc(){if(me){const e=de(0);E(n.question),fe(e)}}function Fi(){if(me?(hl(n.bang),Bs()):_e&&d(n.colon)&&ks(),d(n.eq)){const e=c.tokens.length;I(),Oe(),c.tokens[e].rhsEndIndex=c.tokens.length}Se()}function zg(e,t=false){me&&(!e||t)&&ee(g._implements)||(d(n.name)&&us(true),me?vs():_e&&d(n.lessThan)&&vt())}function Yg(){let e=false;E(n._extends)?(Wl(),e=true):e=false,me?Gm(e):_e&&ug(e)}function u1(){const e=c.tokens.length-1;me&&Om()||(Jg()?eb():Qg()?(ae(),d(n.comma)&&Ce()===n.star?(C(n.comma),C(n.star),Re(g._as),ae()):l1(),hi()):E(n._default)?Kg():sb()?Zg():(fo(),hi()),c.tokens[e].rhsEndIndex=c.tokens.length)}function Kg(){if(me&&jm()||_e&&sg())return;const e=c.start;E(n._function)?ys(e,true,true):ee(g._async)&&Ce()===n._function?(Le(g._async),E(n._function),ys(e,true,true)):d(n._class)?_s(true,true):d(n.at)?(ho(),_s(true,true)):(Oe(),Se())}function Zg(){me?Wm():_e?ag():rt(true)}function Qg(){if(me&&Bl())return false;if(_e&&ng())return false;if(d(n.name))return c.contextualKeyword!==g._async;if(!d(n._default))return false;const e=$a(),t=bi(),s=t.type===n.name&&t.contextualKeyword===g._from;if(t.type===n.comma)return true;if(s){const i=$.charCodeAt(fl(e+4));return i===y.quotationMark||i===y.apostrophe}return false}function l1(){E(n.comma)&&fo()}function hi(){Le(g._from)&&(Xt(),f1()),Se()}function Jg(){return _e?og():d(n.star)}function eb(){_e?cg():pa()}function pa(){C(n.star),ee(g._as)?tb():hi()}function tb(){I(),c.tokens[c.tokens.length-1].type=n._as,ae(),l1(),hi()}function sb(){return me&&Bl()||_e&&rg()||c.type===n._var||c.type===n._const||c.type===n._let||c.type===n._function||c.type===n._class||ee(g._async)||d(n.at)}function fo(){let e=true;for(C(n.braceL);!E(n.braceR)&&!c.error;){if(e)e=false;else if(C(n.comma),E(n.braceR))break;ib()}}function ib(){if(me){Vm();return}ae(),c.tokens[c.tokens.length-1].identifierRole=ie.ExportAccess,Le(g._as)&&ae()}function rb(){const e=c.snapshot();return Re(g._module),Le(g._from)?ee(g._from)?(c.restoreFromSnapshot(e),true):(c.restoreFromSnapshot(e),false):d(n.comma)?(c.restoreFromSnapshot(e),false):(c.restoreFromSnapshot(e),true)}function nb(){ee(g._module)&&rb()&&I()}function h1(){if(me&&d(n.name)&&Ce()===n.eq){ca();return}if(me&&ee(g._type)){const e=bi();if(e.type===n.name&&e.contextualKeyword!==g._from){if(Re(g._type),Ce()===n.eq){ca();return}}else(e.type===n.star||e.type===n.braceL)&&Re(g._type)}d(n.string)||(nb(),ob(),Re(g._from)),Xt(),f1(),Se()}function ab(){return d(n.name)}function wc(){Ki()}function ob(){_e&&fg();let e=true;if(!(ab()&&(wc(),!E(n.comma)))){if(d(n.star)){I(),Re(g._as),wc();return}for(C(n.braceL);!E(n.braceR)&&!c.error;){if(e)e=false;else if(E(n.colon)&&le("ES2015 named imports do not destructure. Use another statement for destructuring after the import."),C(n.comma),E(n.braceR))break;cb()}}}function cb(){if(me){Bm();return}if(_e){dg();return}Ki(),ee(g._as)&&(c.tokens[c.tokens.length-1].identifierRole=ie.ImportAccess,I(),Ki())}function f1(){(d(n._with)||ee(g._assert)&&!Ge())&&(I(),so(false,false))}function ub(){return c.pos===0&&$.charCodeAt(0)===y.numberSign&&$.charCodeAt(1)===y.exclamationMark&&ml(2),pl(),Eg()}class lb{constructor(t,s){this.tokens=t,this.scopes=s}}function hb(e,t,s,i){if(i&&s)throw new Error("Cannot combine flow and typescript plugins.");Nd(e,t,s,i);const r=ub();if(c.error)throw Pd(c.error);return r}function fb(e){let t=e.currentIndex(),s=0;const i=e.currentToken();do{const r=e.tokens[t];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;t+=1}while(s>0&&t<e.tokens.length);return false}class Qs{__init(){this.resultCode=""}__init2(){this.resultMappings=new Array(this.tokens.length)}__init3(){this.tokenIndex=0}constructor(t,s,i,r,a){this.code=t,this.tokens=s,this.isFlowEnabled=i,this.disableESTransforms=r,this.helperManager=a,Qs.prototype.__init.call(this),Qs.prototype.__init2.call(this),Qs.prototype.__init3.call(this)}snapshot(){return{resultCode:this.resultCode,tokenIndex:this.tokenIndex}}restoreToSnapshot(t){this.resultCode=t.resultCode,this.tokenIndex=t.tokenIndex}dangerouslyGetAndRemoveCodeSinceSnapshot(t){const s=this.resultCode.slice(t.resultCode.length);return this.resultCode=t.resultCode,s}reset(){this.resultCode="",this.resultMappings=new Array(this.tokens.length),this.tokenIndex=0}matchesContextualAtIndex(t,s){return this.matches1AtIndex(t,n.name)&&this.tokens[t].contextualKeyword===s}identifierNameAtIndex(t){return this.identifierNameForToken(this.tokens[t])}identifierNameAtRelativeIndex(t){return this.identifierNameForToken(this.tokenAtRelativeIndex(t))}identifierName(){return this.identifierNameForToken(this.currentToken())}identifierNameForToken(t){return this.code.slice(t.start,t.end)}rawCodeForToken(t){return this.code.slice(t.start,t.end)}stringValueAtIndex(t){return this.stringValueForToken(this.tokens[t])}stringValue(){return this.stringValueForToken(this.currentToken())}stringValueForToken(t){return this.code.slice(t.start+1,t.end-1)}matches1AtIndex(t,s){return this.tokens[t].type===s}matches2AtIndex(t,s,i){return this.tokens[t].type===s&&this.tokens[t+1].type===i}matches3AtIndex(t,s,i,r){return this.tokens[t].type===s&&this.tokens[t+1].type===i&&this.tokens[t+2].type===r}matches1(t){return this.tokens[this.tokenIndex].type===t}matches2(t,s){return this.tokens[this.tokenIndex].type===t&&this.tokens[this.tokenIndex+1].type===s}matches3(t,s,i){return this.tokens[this.tokenIndex].type===t&&this.tokens[this.tokenIndex+1].type===s&&this.tokens[this.tokenIndex+2].type===i}matches4(t,s,i,r){return this.tokens[this.tokenIndex].type===t&&this.tokens[this.tokenIndex+1].type===s&&this.tokens[this.tokenIndex+2].type===i&&this.tokens[this.tokenIndex+3].type===r}matches5(t,s,i,r,a){return this.tokens[this.tokenIndex].type===t&&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(t){return this.matchesContextualAtIndex(this.tokenIndex,t)}matchesContextIdAndLabel(t,s){return this.matches1(t)&&this.currentToken().contextId===s}previousWhitespaceAndComments(){let t=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&&(t=t.replace(/@flow/g,"")),t}replaceToken(t){this.resultCode+=this.previousWhitespaceAndComments(),this.appendTokenPrefix(),this.resultMappings[this.tokenIndex]=this.resultCode.length,this.resultCode+=t,this.appendTokenSuffix(),this.tokenIndex++}replaceTokenTrimmingLeftWhitespace(t){this.resultCode+=this.previousWhitespaceAndComments().replace(/[^\r\n]/g,""),this.appendTokenPrefix(),this.resultMappings[this.tokenIndex]=this.resultCode.length,this.resultCode+=t,this.appendTokenSuffix(),this.tokenIndex++}removeInitialToken(){this.replaceToken("")}removeToken(){this.replaceTokenTrimmingLeftWhitespace("")}removeBalancedCode(){let t=0;for(;!this.isAtEnd();){if(this.matches1(n.braceL))t++;else if(this.matches1(n.braceR)){if(t===0)return;t--}this.removeToken()}}copyExpectedToken(t){if(this.tokens[this.tokenIndex].type!==t)throw new Error(`Expected token ${t}`);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(t){this.resultCode+=this.previousWhitespaceAndComments(),this.appendTokenPrefix(),this.resultCode+=t,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 t=this.currentToken();if((t.numNullishCoalesceStarts||t.isOptionalChainStart)&&(t.isAsyncOperation=fb(this)),!this.disableESTransforms){if(t.numNullishCoalesceStarts)for(let s=0;s<t.numNullishCoalesceStarts;s++)t.isAsyncOperation?(this.resultCode+="await ",this.resultCode+=this.helperManager.getHelperName("asyncNullishCoalesce")):this.resultCode+=this.helperManager.getHelperName("nullishCoalesce"),this.resultCode+="(";t.isOptionalChainStart&&(t.isAsyncOperation&&(this.resultCode+="await "),this.tokenIndex>0&&this.tokenAtRelativeIndex(-1).type===n._delete?t.isAsyncOperation?this.resultCode+=this.helperManager.getHelperName("asyncOptionalChainDelete"):this.resultCode+=this.helperManager.getHelperName("optionalChainDelete"):t.isAsyncOperation?this.resultCode+=this.helperManager.getHelperName("asyncOptionalChain"):this.resultCode+=this.helperManager.getHelperName("optionalChain"),this.resultCode+="([")}}appendTokenSuffix(){const t=this.currentToken();if(t.isOptionalChainEnd&&!this.disableESTransforms&&(this.resultCode+="])"),t.numNullishCoalesceEnds&&!this.disableESTransforms)for(let s=0;s<t.numNullishCoalesceEnds;s++)this.resultCode+="))"}appendCode(t){this.resultCode+=t}currentToken(){return this.tokens[this.tokenIndex]}currentTokenCode(){const t=this.currentToken();return this.code.slice(t.start,t.end)}tokenAtRelativeIndex(t){return this.tokens[this.tokenIndex+t]}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 db(e,t,s,i){const r=t.snapshot(),a=pb(t);let o=[];const u=[],l=[];let h=null;const p=[],m=[],_=t.currentToken().contextId;if(_==null)throw new Error("Expected non-null class context ID on class open-brace.");for(t.nextToken();!t.matchesContextIdAndLabel(n.braceR,_);)if(t.matchesContextual(g._constructor)&&!t.currentToken().isType)({constructorInitializerStatements:o,constructorInsertPos:h}=Ec(t));else if(t.matches1(n.semi))i||m.push({start:t.currentIndex(),end:t.currentIndex()+1}),t.nextToken();else if(t.currentToken().isType)t.nextToken();else{const k=t.currentIndex();let T=false,P=false,F=false;for(;sr(t.currentToken());)t.matches1(n._static)&&(T=true),t.matches1(n.hash)&&(P=true),(t.matches1(n._declare)||t.matches1(n._abstract))&&(F=true),t.nextToken();if(T&&t.matches1(n.braceL)){Bn(t,_);continue}if(P){Bn(t,_);continue}if(t.matchesContextual(g._constructor)&&!t.currentToken().isType){({constructorInitializerStatements:o,constructorInsertPos:h}=Ec(t));continue}const U=t.currentIndex();if(mb(t),t.matches1(n.lessThan)||t.matches1(n.parenL)){Bn(t,_);continue}for(;t.currentToken().isType;)t.nextToken();if(t.matches1(n.eq)){const D=t.currentIndex(),z=t.currentToken().rhsEndIndex;if(z==null)throw new Error("Expected rhsEndIndex on class field assignment.");for(t.nextToken();t.currentIndex()<z;)e.processToken();let q;T?(q=s.claimFreeName("__initStatic"),l.push(q)):(q=s.claimFreeName("__init"),u.push(q)),p.push({initializerName:q,equalsIndex:D,start:U,end:t.currentIndex()})}else(!i||F)&&m.push({start:k,end:t.currentIndex()})}return t.restoreToSnapshot(r),i?{headerInfo:a,constructorInitializerStatements:o,instanceInitializerNames:[],staticInitializerNames:[],constructorInsertPos:h,fields:[],rangesToRemove:m}:{headerInfo:a,constructorInitializerStatements:o,instanceInitializerNames:u,staticInitializerNames:l,constructorInsertPos:h,fields:p,rangesToRemove:m}}function Bn(e,t){for(e.nextToken();e.currentToken().contextId!==t;)e.nextToken();for(;sr(e.tokenAtRelativeIndex(-1));)e.previousToken()}function pb(e){const t=e.currentToken(),s=t.contextId;if(s==null)throw new Error("Expected context ID on class token.");const i=t.isExpression;if(i==null)throw new Error("Expected isExpression on class token.");let r=null,a=false;for(e.nextToken(),e.matches1(n.name)&&(r=e.identifierName());!e.matchesContextIdAndLabel(n.braceL,s);)e.matches1(n._extends)&&!e.currentToken().isType&&(a=true),e.nextToken();return{isExpression:i,className:r,hasSuperclass:a}}function Ec(e){const t=[];e.nextToken();const s=e.currentToken().contextId;if(s==null)throw new Error("Expected context ID on open-paren starting constructor params.");for(;!e.matchesContextIdAndLabel(n.parenR,s);)if(e.currentToken().contextId===s){if(e.nextToken(),sr(e.currentToken())){for(e.nextToken();sr(e.currentToken());)e.nextToken();const a=e.currentToken();if(a.type!==n.name)throw new Error("Expected identifier after access modifiers in constructor arg.");const o=e.identifierNameForToken(a);t.push(`this.${o} = ${o}`)}}else e.nextToken();for(e.nextToken();e.currentToken().isType;)e.nextToken();let i=e.currentIndex(),r=false;for(;!e.matchesContextIdAndLabel(n.braceR,s);){if(!r&&e.matches2(n._super,n.parenL)){e.nextToken();const a=e.currentToken().contextId;if(a==null)throw new Error("Expected a context ID on the super call");for(;!e.matchesContextIdAndLabel(n.parenR,a);)e.nextToken();i=e.currentIndex(),r=true}e.nextToken()}return e.nextToken(),{constructorInitializerStatements:t,constructorInsertPos:i}}function sr(e){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(e.type)}function mb(e){if(e.matches1(n.bracketL)){const s=e.currentToken().contextId;if(s==null)throw new Error("Expected class context ID on computed name open bracket.");for(;!e.matchesContextIdAndLabel(n.bracketR,s);)e.nextToken();e.nextToken()}else e.nextToken()}function d1(e){if(e.removeInitialToken(),e.removeToken(),e.removeToken(),e.removeToken(),e.matches1(n.parenL))e.removeToken(),e.removeToken(),e.removeToken();else for(;e.matches1(n.dot);)e.removeToken(),e.removeToken()}const p1={typeDeclarations:new Set,valueDeclarations:new Set};function m1(e){const t=new Set,s=new Set;for(let i=0;i<e.tokens.length;i++){const r=e.tokens[i];r.type===n.name&&ll(r)&&(r.isType?t.add(e.identifierNameForToken(r)):s.add(e.identifierNameForToken(r)))}return{typeDeclarations:t,valueDeclarations:s}}function g1(e){let t=e.currentIndex();for(;!e.matches1AtIndex(t,n.braceR);)t++;return e.matchesContextualAtIndex(t+1,g._from)&&e.matches1AtIndex(t+2,n.string)}function ms(e){(e.matches2(n._with,n.braceL)||e.matches2(n.name,n.braceL)&&e.matchesContextual(g._assert))&&(e.removeToken(),e.removeToken(),e.removeBalancedCode(),e.removeToken())}function b1(e,t,s,i){if(!e||t)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 u=s.identifierNameForToken(o);return i.typeDeclarations.has(u)&&!i.valueDeclarations.has(u)}class Js extends xt{__init(){this.hadExport=false}__init2(){this.hadNamedExport=false}__init3(){this.hadDefaultExport=false}constructor(t,s,i,r,a,o,u,l,h,p,m,_){super(),this.rootTransformer=t,this.tokens=s,this.importProcessor=i,this.nameManager=r,this.helperManager=a,this.reactHotLoaderTransformer=o,this.enableLegacyBabel5ModuleInterop=u,this.enableLegacyTypeScriptModuleInterop=l,this.isTypeScriptTransformEnabled=h,this.isFlowTransformEnabled=p,this.preserveDynamicImport=m,this.keepUnusedImports=_,Js.prototype.__init.call(this),Js.prototype.__init2.call(this),Js.prototype.__init3.call(this),this.declarationInfo=h?m1(s):p1}getPrefixCode(){let t="";return this.hadExport&&(t+='Object.defineProperty(exports, "__esModule", {value: true});'),t}getSuffixCode(){return this.enableLegacyBabel5ModuleInterop&&this.hadDefaultExport&&!this.hadNamedExport?`
583
+ module.exports = exports.default;
584
+ `:""}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 t=this.tokens.identifierNameAtIndex(this.tokens.currentIndex()+1);return this.importProcessor.shouldAutomaticallyElideImportedName(t)?d1(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))}ms(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 t=false,s=false;for(;!this.tokens.matches1(n.string);)(!t&&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))&&(t=true)),this.tokens.removeToken();return this.keepUnusedImports?false:this.isTypeScriptTransformEnabled?!t:this.isFlowTransformEnabled?s&&!t:false}removeRemainingImport(){for(;!this.tokens.matches1(n.string);)this.tokens.removeToken()}processIdentifier(){const t=this.tokens.currentToken();if(t.shadowsGlobal)return false;if(t.identifierRole===ie.ObjectShorthand)return this.processObjectShorthand();if(t.identifierRole!==ie.Access)return false;const s=this.importProcessor.getIdentifierReplacement(this.tokens.identifierNameForToken(t));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 t=this.tokens.identifierName(),s=this.importProcessor.getIdentifierReplacement(t);return s?(this.tokens.replaceToken(`${t}: ${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(),ms(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 t=this.tokens.currentIndex(),s=this.tokens.tokens[t-1];if(s.isType||s.type!==n.name||s.shadowsGlobal||t>=2&&this.tokens.matches1AtIndex(t-2,n.dot)||t>=2&&[n._var,n._let,n._const].includes(this.tokens.tokens[t-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 t=this.tokens.currentIndex(),s=this.tokens.tokens[t-1];if(s.type!==n.name||s.shadowsGlobal||t>=2&&this.tokens.matches1AtIndex(t-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 t=this.tokens.currentIndex(),s=this.tokens.tokens[t+1];if(s.type!==n.name||s.shadowsGlobal||t+2<this.tokens.tokens.length&&(this.tokens.matches1AtIndex(t+2,n.dot)||this.tokens.matches1AtIndex(t+2,n.bracketL)||this.tokens.matches1AtIndex(t+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 t=this.tokens.currentIndex(),s=this.tokens.tokens[t],i=this.tokens.tokens[t+1];if(s.type!==n.name||s.shadowsGlobal||t>=1&&this.tokens.matches1AtIndex(t-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),u=this.importProcessor.getIdentifierReplacement(r)||r;if(o==="++")this.tokens.replaceToken(`(${u} = ${a} = ${u} + 1, ${u} - 1)`);else if(o==="--")this.tokens.replaceToken(`(${u} = ${a} = ${u} - 1, ${u} + 1)`);else throw new Error(`Unexpected operator: ${o}`);return this.tokens.removeToken(),true}processExportDefault(){let t=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(b1(this.isTypeScriptTransformEnabled,this.keepUnusedImports,this.tokens,this.declarationInfo))t=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(" =");t&&(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 t=this.tokens.currentIndex();if(t++,t++,!this.tokens.matches1AtIndex(t,n.name))return false;for(t++;t<this.tokens.tokens.length&&this.tokens.tokens[t].isType;)t++;return!!this.tokens.matches1AtIndex(t,n.eq)}processSimpleExportVar(){this.tokens.removeInitialToken(),this.tokens.copyToken();const t=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.${t} = ${t}`)}processComplexExportVar(){this.tokens.removeInitialToken(),this.tokens.removeToken();const t=this.tokens.matches1(n.braceL);t&&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(ul(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.`);Vd(i)&&(a=`${r}: ${a}`),this.tokens.replaceToken(a)}else this.rootTransformer.processToken()}}if(t){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 t=this.processNamedFunction();this.tokens.appendCode(` exports.${t} = ${t};`)}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 t=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),t}processExportClass(){this.tokens.removeInitialToken(),this.copyDecorators(),this.tokens.matches1(n._abstract)&&this.tokens.removeToken();const t=this.rootTransformer.processNamedClass();this.tokens.appendCode(` exports.${t} = ${t};`)}processExportBindings(){this.tokens.removeInitialToken(),this.tokens.removeToken();const t=g1(this.tokens),s=[];for(;;){if(this.tokens.matches1(n.braceR)){this.tokens.removeToken();break}const i=oi(this.tokens);for(;this.tokens.currentIndex()<i.endIndex;)this.tokens.removeToken();if(!(i.isType||!t&&this.shouldElideExportedIdentifier(i.leftName))){const a=i.rightName;a==="default"?this.hadDefaultExport=true:this.hadNamedExport=true;const o=i.leftName,u=this.importProcessor.getIdentifierReplacement(o);s.push(`exports.${a} = ${u||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)),ms(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 t=this.tokens.stringValue();this.tokens.replaceTokenTrimmingLeftWhitespace(this.importProcessor.claimImportCode(t)),ms(this.tokens),this.tokens.matches1(n.semi)&&this.tokens.removeToken()}shouldElideExportedIdentifier(t){return this.isTypeScriptTransformEnabled&&!this.keepUnusedImports&&!this.declarationInfo.valueDeclarations.has(t)}}class gb extends xt{constructor(t,s,i,r,a,o,u,l){super(),this.tokens=t,this.nameManager=s,this.helperManager=i,this.reactHotLoaderTransformer=r,this.isTypeScriptTransformEnabled=a,this.isFlowTransformEnabled=o,this.keepUnusedImports=u,this.nonTypeIdentifiers=a&&!u?El(t,l):new Set,this.declarationInfo=a&&!u?m1(t):p1,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 t=0;t<7;t++)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 t=0;t<8;t++)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(),ms(this.tokens)),true}return false}processImportEquals(){const t=this.tokens.identifierNameAtIndex(this.tokens.currentIndex()+1);return this.shouldAutomaticallyElideImportedName(t)?d1(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 t=this.tokens.snapshot();if(this.removeImportTypeBindings()){for(this.tokens.restoreToSnapshot(t);!this.tokens.matches1(n.string);)this.tokens.removeToken();this.tokens.removeToken(),ms(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 t=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()):(t=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(","),t=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=oi(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(t=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?!t:this.isFlowTransformEnabled?s&&!t:false}shouldAutomaticallyElideImportedName(t){return this.isTypeScriptTransformEnabled&&!this.keepUnusedImports&&!this.nonTypeIdentifiers.has(t)}processExportDefault(){if(b1(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 t=g1(this.tokens);let s=false;for(;!this.tokens.matches1(n.braceR);){const i=oi(this.tokens);if(i.isType||!t&&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&&t&&!s&&(this.tokens.removeToken(),this.tokens.removeToken(),ms(this.tokens)),true}shouldElideExportedName(t){return this.isTypeScriptTransformEnabled&&!this.keepUnusedImports&&this.declarationInfo.typeDeclarations.has(t)&&!this.declarationInfo.valueDeclarations.has(t)}}class bb extends xt{constructor(t,s,i){super(),this.rootTransformer=t,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 t=this.tokens.identifierNameAtRelativeIndex(1);this.processEnum(),this.tokens.appendCode(` exports.${t} = ${t};`)}else this.tokens.copyToken(),this.processEnum()}processDefaultExportEnum(){this.tokens.removeInitialToken(),this.tokens.removeToken();const t=this.tokens.identifierNameAtRelativeIndex(1);this.processEnum(),this.isImportsTransformEnabled?this.tokens.appendCode(` exports.default = ${t};`):this.tokens.appendCode(` export default ${t};`)}processEnum(){this.tokens.replaceToken("const"),this.tokens.copyExpectedToken(n.name);let t=false;this.tokens.matchesContextual(g._of)&&(this.tokens.removeToken(),t=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=!t&&!s;for(this.tokens.replaceTokenTrimmingLeftWhitespace(i?".Mirrored([":"({");!this.tokens.matches1(n.braceR);){if(this.tokens.matches1(n.ellipsis)){this.tokens.removeToken();break}this.processEnumElement(t,s),this.tokens.matches1(n.comma)&&this.tokens.copyToken()}this.tokens.replaceToken(i?"]);":"});")}processEnumElement(t,s){if(t){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 yb(e){let t,s=e[0],i=1;for(;i<e.length;){const r=e[i],a=e[i+1];if(i+=2,(r==="optionalAccess"||r==="optionalCall")&&s==null)return;r==="access"||r==="optionalAccess"?(t=s,s=a(s)):(r==="call"||r==="optionalCall")&&(s=a((...o)=>s.call(t,...o)),t=void 0)}return s}const Ai="jest",_b=["mock","unmock","enableAutomock","disableAutomock"];class po extends xt{__init(){this.hoistedFunctionNames=[]}constructor(t,s,i,r){super(),this.rootTransformer=t,this.tokens=s,this.nameManager=i,this.importProcessor=r,po.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()===Ai?yb([this,"access",t=>t.importProcessor,"optionalAccess",t=>t.getGlobalNames,"call",t=>t(),"optionalAccess",t=>t.has,"call",t=>t(Ai)])?false:this.extractHoistedCalls():false}getHoistedCode(){return this.hoistedFunctionNames.length>0?this.hoistedFunctionNames.map(t=>`${t}();`).join(""):""}extractHoistedCalls(){this.tokens.removeToken();let t=false;for(;this.tokens.matches3(n.dot,n.name,n.parenL);){const s=this.tokens.identifierNameAtIndex(this.tokens.currentIndex()+1);if(_b.includes(s)){const r=this.nameManager.claimFreeName("__jestHoist");this.hoistedFunctionNames.push(r),this.tokens.replaceToken(`function ${r}(){${Ai}.`),this.tokens.copyToken(),this.tokens.copyToken(),this.rootTransformer.processBalancedCode(),this.tokens.copyExpectedToken(n.parenR),this.tokens.appendCode(";}"),t=false}else t?this.tokens.copyToken():this.tokens.replaceToken(`${Ai}.`),this.tokens.copyToken(),this.tokens.copyToken(),this.rootTransformer.processBalancedCode(),this.tokens.copyExpectedToken(n.parenR),t=true}return true}}class xb extends xt{constructor(t){super(),this.tokens=t}process(){if(this.tokens.matches1(n.num)){const t=this.tokens.currentTokenCode();if(t.includes("_"))return this.tokens.replaceToken(t.replace(/_/g,"")),true}return false}}class vb extends xt{constructor(t,s){super(),this.tokens=t,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 kb extends xt{constructor(t,s){super(),this.tokens=t,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 t=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?t++:this.tokens.tokens[s].isOptionalChainEnd&&t--,t<0)return true;if(t===0&&this.tokens.tokens[s].subscriptStartIndex!=null)return false}}justSkippedSuper(){let t=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?t--:this.tokens.tokens[s].isOptionalChainEnd&&t++,t<0)return false;if(t===0&&this.tokens.tokens[s].subscriptStartIndex!=null)return this.tokens.tokens[s-1].type===n._super;s--}}}class wb extends xt{constructor(t,s,i,r){super(),this.rootTransformer=t,this.tokens=s,this.importProcessor=i,this.options=r}process(){const t=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(t),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(t),true}return false}tryProcessCreateClassCall(t){const s=this.findDisplayName(t);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(t){return t<2?null:this.tokens.matches2AtIndex(t-2,n.name,n.eq)?this.tokens.identifierNameAtIndex(t-2):t>=2&&this.tokens.tokens[t-2].identifierRole===ie.ObjectKey?this.tokens.identifierNameAtIndex(t-2):this.tokens.matches2AtIndex(t-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 t=this.tokens.currentIndex();if(!this.tokens.matches2(n.parenL,n.braceL))return false;const s=t+1,i=this.tokens.tokens[s].contextId;if(i==null)throw new Error("Expected non-null context ID on object open-brace.");for(;t<this.tokens.tokens.length;t++){const r=this.tokens.tokens[t];if(r.type===n.braceR&&r.contextId===i){t++;break}if(this.tokens.identifierNameAtIndex(t)==="displayName"&&this.tokens.tokens[t].identifierRole===ie.ObjectKey&&r.contextId===i)return false}if(t===this.tokens.tokens.length)throw new Error("Unexpected end of input when processing React class.");return this.tokens.matches1AtIndex(t,n.parenR)||this.tokens.matches2AtIndex(t,n.comma,n.parenR)}}class mo extends xt{__init(){this.extractedDefaultExportName=null}constructor(t,s){super(),this.tokens=t,this.filePath=s,mo.prototype.__init.call(this)}setExtractedDefaultExportName(t){this.extractedDefaultExportName=t}getPrefixCode(){return`
585
+ (function () {
586
+ var enterModule = require('react-hot-loader').enterModule;
587
+ enterModule && enterModule(module);
588
+ })();`.replace(/\s+/g," ").trim()}getSuffixCode(){const t=new Set;for(const i of this.tokens.tokens)!i.isType&&ll(i)&&i.identifierRole!==ie.ImportDeclaration&&t.add(this.tokens.identifierNameForToken(i));const s=Array.from(t).map(i=>({variableName:i,uniqueLocalName:i}));return this.extractedDefaultExportName&&s.push({variableName:this.extractedDefaultExportName,uniqueLocalName:"default"}),`
589
+ ;(function () {
590
+ var reactHotLoader = require('react-hot-loader').default;
591
+ var leaveModule = require('react-hot-loader').leaveModule;
592
+ if (!reactHotLoader) {
593
+ return;
594
+ }
595
+ ${s.map(({variableName:i,uniqueLocalName:r})=>` reactHotLoader.register(${i}, "${r}", ${JSON.stringify(this.filePath||"")});`).join(`
596
+ `)}
597
+ leaveModule(module);
598
+ })();`}process(){return false}}const Eb=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 Sc(e){if(e.length===0||!gi[e.charCodeAt(0)])return false;for(let t=1;t<e.length;t++)if(!_t[e.charCodeAt(t)])return false;return!Eb.has(e)}class Sb extends xt{constructor(t,s,i){super(),this.rootTransformer=t,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(t=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(),t&&!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),t&&this.isImportsTransformEnabled?this.tokens.appendCode(`)(${s} || (exports.${s} = ${s} = {}));`):this.tokens.appendCode(`)(${s} || (${s} = {}));`)}processEnumBody(t){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(t,i,r):this.tokens.matches1(n.eq)?this.processExplicitValueEnumMember(t,i,r):this.processImplicitValueEnumMember(t,i,r,s),this.tokens.matches1(n.comma)&&this.tokens.removeToken(),r!=null?s=r:s=`${t}[${i}]`}}extractEnumKeyInfo(t){if(t.type===n.name){const s=this.tokens.identifierNameForToken(t);return{nameStringCode:`"${s}"`,variableName:Sc(s)?s:null}}else if(t.type===n.string){const s=this.tokens.stringValueForToken(t);return{nameStringCode:this.tokens.code.slice(t.start,t.end),variableName:Sc(s)?s:null}}else throw new Error("Expected name or string at beginning of enum element.")}processStringLiteralEnumMember(t,s,i){i!=null?(this.tokens.appendCode(`const ${i}`),this.tokens.copyToken(),this.tokens.copyToken(),this.tokens.appendCode(`; ${t}[${s}] = ${i};`)):(this.tokens.appendCode(`${t}[${s}]`),this.tokens.copyToken(),this.tokens.copyToken(),this.tokens.appendCode(";"))}processExplicitValueEnumMember(t,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(`; ${t}[${t}[${s}] = ${i}] = ${s};`)}else{for(this.tokens.appendCode(`${t}[${t}[${s}]`),this.tokens.copyToken();this.tokens.currentIndex()<r;)this.rootTransformer.processToken();this.tokens.appendCode(`] = ${s};`)}}processImplicitValueEnumMember(t,s,i,r){let a=r!=null?`${r} + 1`:"0";i!=null&&(this.tokens.appendCode(`const ${i} = ${a}; `),a=i),this.tokens.appendCode(`${t}[${t}[${s}] = ${a}] = ${s};`)}}class ir{__init(){this.transformers=[]}__init2(){this.generatedVariables=[]}constructor(t,s,i,r){ir.prototype.__init.call(this),ir.prototype.__init2.call(this),this.nameManager=t.nameManager,this.helperManager=t.helperManager;const{tokenProcessor:a,importProcessor:o}=t;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 kb(a,this.nameManager)),this.transformers.push(new xb(a)),this.transformers.push(new vb(a,this.nameManager))),s.includes("jsx")&&(r.jsxRuntime!=="preserve"&&this.transformers.push(new hs(this,a,o,this.nameManager,r)),this.transformers.push(new wb(this,a,o,r)));let u=null;if(s.includes("react-hot-loader")){if(!r.filePath)throw new Error("filePath is required when using the react-hot-loader transform.");u=new mo(a,r.filePath),this.transformers.push(u)}if(s.includes("imports")){if(o===null)throw new Error("Expected non-null importProcessor with imports transform enabled.");this.transformers.push(new Js(this,a,o,this.nameManager,this.helperManager,u,i,!!r.enableLegacyTypeScriptModuleInterop,s.includes("typescript"),s.includes("flow"),!!r.preserveDynamicImport,!!r.keepUnusedImports))}else this.transformers.push(new gb(a,this.nameManager,this.helperManager,u,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 Sb(this,a,s.includes("imports"))),s.includes("jest")&&this.transformers.push(new po(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(`
599
+ `);return o===-1&&(o=a.length,a+=`
600
+ `),{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 t=0,s=0;for(;!this.tokens.isAtEnd();){if(this.tokens.matches1(n.braceL)||this.tokens.matches1(n.dollarBraceL))t++;else if(this.tokens.matches1(n.braceR)){if(t===0)return;t--}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 t of this.transformers)if(t.process())return;this.tokens.copyToken()}processNamedClass(){if(!this.tokens.matches2(n._class,n.name))throw new Error("Expected identifier for exported class name.");const t=this.tokens.identifierNameAtIndex(this.tokens.currentIndex()+1);return this.processClass(),t}processClass(){const t=db(this,this.tokens,this.nameManager,this.disableESTransforms),s=(t.headerInfo.isExpression||!t.headerInfo.className)&&t.staticInitializerNames.length+t.instanceInitializerNames.length>0;let i=t.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(t,i);const o=t.staticInitializerNames.map(u=>`${i}.${u}()`);s?this.tokens.appendCode(`, ${o.map(u=>`${u}, `).join("")}${i})`):t.staticInitializerNames.length>0&&this.tokens.appendCode(` ${o.map(u=>`${u};`).join(" ")}`)}processClassBody(t,s){const{headerInfo:i,constructorInsertPos:r,constructorInitializerStatements:a,fields:o,instanceInitializerNames:u,rangesToRemove:l}=t;let h=0,p=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+u.length>0;if(r===null&&_){const k=this.makeConstructorInitCode(a,u,s);if(i.hasSuperclass){const T=this.nameManager.claimFreeName("args");this.tokens.appendCode(`constructor(...${T}) { super(...${T}); ${k}; }`)}else this.tokens.appendCode(`constructor() { ${k}; }`)}for(;!this.tokens.matchesContextIdAndLabel(n.braceR,m);)if(h<o.length&&this.tokens.currentIndex()===o[h].start){let k=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[`),k=true):this.tokens.copyTokenWithPrefix(`${o[h].initializerName}() {this.`);this.tokens.currentIndex()<o[h].end;)k&&this.tokens.currentIndex()===o[h].equalsIndex&&this.tokens.appendCode("]"),this.processToken();this.tokens.appendCode("}"),h++}else if(p<l.length&&this.tokens.currentIndex()>=l[p].start){for(this.tokens.currentIndex()<l[p].end&&this.tokens.removeInitialToken();this.tokens.currentIndex()<l[p].end;)this.tokens.removeToken();p++}else this.tokens.currentIndex()===r?(this.tokens.copyToken(),_&&this.tokens.appendCode(`;${this.makeConstructorInitCode(a,u,s)};`),this.processToken()):this.processToken();this.tokens.copyExpectedToken(n.braceR)}makeConstructorInitCode(t,s,i){return[...t,...s.map(r=>`${i}.prototype.${r}.call(this)`)].join(";")}processPossibleArrowParamEnd(){if(this.tokens.matches2(n.parenR,n.colon)&&this.tokens.tokenAtRelativeIndex(1).isType){let t=this.tokens.currentIndex()+1;for(;this.tokens.tokens[t].isType;)t++;if(this.tokens.matches1AtIndex(t,n.arrow)){for(this.tokens.removeInitialToken();this.tokens.currentIndex()<t;)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 t=this.tokens.tokenAtRelativeIndex(1);if(t.type!==n.lessThan||!t.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(t,s){for(let i=0;i<t.length;i++){const r=t[i];r!==void 0&&(t[i]=r+s)}return t}}var Tb={};(function(e){e.__esModule=true,e.LinesAndColumns=void 0;var t=`
601
+ `,s="\r",i=function(){function r(a){this.string=a;for(var o=[0],u=0;u<a.length;)switch(a[u]){case t:u+=t.length,o.push(u);break;case s:u+=s.length,a[u]===t&&(u+=t.length),o.push(u);break;default:u++;break}this.offsets=o}return r.prototype.locationForIndex=function(a){if(a<0||a>this.string.length)return null;for(var o=0,u=this.offsets;u[o+1]<=a;)o++;var l=a-u[o];return{line:o,column:l}},r.prototype.indexForLocation=function(a){var o=a.line,u=a.column;return o<0||o>=this.offsets.length||u<0||u>this.lengthOfLine(o)?null:this.offsets[o]+u},r.prototype.lengthOfLine=function(a){var o=this.offsets[a],u=a===this.offsets.length-1?this.string.length:this.offsets[a+1];return u-o},r}();e.LinesAndColumns=i,e.default=i})(Tb);function Cb(e){const t=new Set;for(let s=0;s<e.tokens.length;s++)e.matches1AtIndex(s,n._import)&&!e.matches3AtIndex(s,n._import,n.name,n.eq)&&Ab(e,s,t);return t}function Ab(e,t,s){t++,!e.matches1AtIndex(t,n.parenL)&&(e.matches1AtIndex(t,n.name)&&(s.add(e.identifierNameAtIndex(t)),t++,e.matches1AtIndex(t,n.comma)&&t++),e.matches1AtIndex(t,n.star)&&(t+=2,s.add(e.identifierNameAtIndex(t)),t++),e.matches1AtIndex(t,n.braceL)&&(t++,Ib(e,t,s)))}function Ib(e,t,s){for(;;){if(e.matches1AtIndex(t,n.braceR))return;const i=oi(e,t);if(t=i.endIndex,i.isType||s.add(i.rightName),e.matches2AtIndex(t,n.comma,n.braceR))return;if(e.matches1AtIndex(t,n.braceR))return;if(e.matches1AtIndex(t,n.comma))t++;else throw new Error(`Unexpected token: ${JSON.stringify(e.tokens[t])}`)}}function Rb(e,t){Gp(t);try{const s=Pb(e,t),r=new ir(s,t.transforms,!!t.enableLegacyBabel5ModuleInterop,t).transform();let a={code:r.code};if(t.sourceMapOptions){if(!t.filePath)throw new Error("filePath must be specified when generating a source map.");a={...a,sourceMap:Lp(r,t.filePath,t.sourceMapOptions,e,s.tokenProcessor.tokens)}}return a}catch(s){throw t.filePath&&(s.message=`Error transforming ${t.filePath}: ${s.message}`),s}}function Pb(e,t){const s=t.transforms.includes("jsx"),i=t.transforms.includes("typescript"),r=t.transforms.includes("flow"),a=t.disableESTransforms===true,o=hb(e,s,i,r),u=o.tokens,l=o.scopes,h=new qa(e,u),p=new Yi(h),m=new Qs(e,u,r,a,p),_=!!t.enableLegacyTypeScriptModuleInterop;let k=null;return t.transforms.includes("imports")?(k=new fs(h,m,_,t,t.transforms.includes("typescript"),!!t.keepUnusedImports,p),k.preprocessTokens(),hc(m,l,k.getGlobalNames()),t.transforms.includes("typescript")&&!t.keepUnusedImports&&k.pruneTypeOnlyImports()):t.transforms.includes("typescript")&&!t.keepUnusedImports&&hc(m,l,Cb(m)),{tokenProcessor:m,scopes:l,nameManager:h,importProcessor:k,helperManager:p}}function ma(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"&&"BYTES_PER_ELEMENT"in e&&e.BYTES_PER_ELEMENT===1}const rr=e=>e?`"${e}" `:"";function ga(e,t=""){if(typeof e!="boolean")throw new TypeError(rr(t)+"expected boolean, got type="+typeof e);return e}function Ls(e,t=""){if(typeof e!="number")throw new TypeError(rr(t)+"expected number, got "+typeof e);if(!Number.isSafeInteger(e)||e<0)throw new RangeError(rr(t)+"expected integer >= 0, got "+e);return e}function Ue(e,t,s=""){if(ma(e)&&(t===void 0||e.length===t))return e;t!==void 0&&Ls(t,"length");const i=ma(e),r=t!==void 0?` of length ${t}`:"",a=i?`length=${e.length}`:`type=${typeof e}`,o=rr(s)+"expected Uint8Array"+r+", got "+a;throw i?new RangeError(o):new TypeError(o)}const Tc=(e,t)=>{if(e===null||typeof e!="object"||Array.isArray(e))throw new TypeError(t==="object"?"expected valid options object":`"${t}" expected object, got type=${typeof e}`)};function Cc(e,t=true){if(e.destroyed)throw new Error("hash was destroyed");if(t&&e.finished)throw new Error("digest() was already called")}function Lb(e,t){Ue(e,void 0,"output");const s=t.outputLen;if(!(e.length>=s))throw new RangeError('"output" expected length >= '+s)}function qt(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}function Pt(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function Db(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}const At=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function Nb(e){return e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255}function Fb(e){for(let t=0;t<e.length;t++)e[t]=Nb(e[t]);return e}const mt=At?e=>e:Fb;function Ub(e,t){return Tc(e,"defaults"),Tc(t,"opts"),Object.assign(e,t)}function Mb(e,t){if(e=Ue(e),t=Ue(t),e.length!==t.length)return false;let s=0;for(let i=0;i<e.length;i++)s|=e[i]^t[i];return s===0}function Ob(e,t,s){const i=t,r=()=>[],a=(u,l)=>i(l,...r(u)).update(u).digest(),o=i(new Uint8Array(e),...r(new Uint8Array(0)));return a.outputLen=o.outputLen,a.blockLen=o.blockLen,a.create=(u,...l)=>i(u,...l),a}const Bb=(e,t)=>{function s(i,...r){if(Ue(i,void 0,"key"),e.nonceLength!==void 0){const m=r[0];Ue(m,e.varSizeNonce?void 0:e.nonceLength,"nonce")}const a=e.tagLength,o=e.nonceLength!==void 0?1:0;if(!e.withAAD){for(let m=o;m<r.length;m++)if(ma(r[m]))throw new Error("AAD not supported")}e.withAAD&&r[o]!==void 0&&Ue(r[o],void 0,"AAD");const u=t(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(u.encrypt.length,_),u.encrypt(m,_)},decrypt(m,_){if(Ue(m,void 0,"data"),a&&m.length<a)throw new Error('"ciphertext" expected length >= tagLength='+a);return l(u.decrypt.length,_),u.decrypt(m,_)}}}return Object.assign(s,e),s};function ba(e,t,s=true){if(t===void 0)return new Uint8Array(e);if(Ue(t,e,"output"),s&&!nr(t))throw new Error("invalid output, must be aligned");return t}function Vb(e,t,s){Ls(e),Ls(t),ga(s);const i=new Uint8Array(16),r=Db(i);return r.setBigUint64(0,BigInt(t),s),r.setBigUint64(8,BigInt(e),s),i}function nr(e){return e.byteOffset%4===0}function ar(e){return Uint8Array.from(Ue(e))}const y1=e=>Uint8Array.from(e.split(""),t=>t.charCodeAt(0)),jb=mt(qt(y1("expand 16-byte k"))),$b=mt(qt(y1("expand 32-byte k")));function xe(e,t){return e<<t|e>>>32-t}const Xs=64,qb=16,ya=2**32-1,Ac=Uint32Array.of();function Hb(e,t,s,i,r,a,o,u){const l=r.length,h=new Uint8Array(Xs),p=qt(h),m=At&&nr(r)&&nr(a),_=m?qt(r):Ac,k=m?qt(a):Ac;if(!At){for(let T=0;T<l;o++){if(e(t,s,i,p,o,u),mt(p),o>=ya)throw new Error("arx: counter overflow");const P=Math.min(Xs,l-T);for(let F=0,U;F<P;F++)U=T+F,a[U]=r[U]^h[F];T+=P}return}for(let T=0;T<l;o++){if(e(t,s,i,p,o,u),o>=ya)throw new Error("arx: counter overflow");const P=Math.min(Xs,l-T);if(m&&P===Xs){const F=T/4;if(T%4!==0)throw new Error("arx: invalid block position");for(let U=0,D;U<qb;U++)D=F+U,k[D]=_[D]^p[U];T+=Xs;continue}for(let F=0,U;F<P;F++)U=T+F,a[U]=r[U]^h[F];T+=P}}function Wb(e,t){const{allowShortKeys:s,extendNonceFn:i,counterLength:r,counterRight:a,rounds:o}=Ub({allowShortKeys:false,counterLength:8,counterRight:false,rounds:20},t);if(typeof e!="function")throw new Error("core must be a function");return Ls(r),Ls(o),ga(a),ga(s),(u,l,h,p,m=0)=>{Ue(u,void 0,"key"),Ue(l,void 0,"nonce"),Ue(h,void 0,"data");const _=h.length;if(p=ba(_,p,false),Ls(m),m<0||m>=ya)throw new Error("arx: counter overflow");const k=[];let T=u.length,P,F;if(T===32)k.push(P=ar(u)),F=$b;else if(T===16&&s)P=new Uint8Array(32),P.set(u),P.set(u,16),F=jb,k.push(P);else throw Ue(u,32,"arx key"),new Error("invalid key size");(!At||!nr(l))&&k.push(l=ar(l));let U=qt(P);if(i){if(l.length!==24)throw new Error("arx: extended nonce must be 24 bytes");const q=l.subarray(0,16);if(At)i(F,U,qt(q),U);else{const Y=mt(Uint32Array.from(F));i(Y,U,qt(q),U),Pt(Y),mt(U)}l=l.subarray(16)}else At||mt(U);const D=16-r;if(D!==l.length)throw new Error(`arx: nonce must be ${D} or 16 bytes`);if(D!==12){const q=new Uint8Array(12);q.set(l,a?0:12-l.length),l=q,k.push(l)}const z=mt(qt(l));try{return Hb(e,F,U,z,h,p,m,o),p}finally{Pt(...k)}}}function Be(e,t){return e[t++]&255|(e[t++]&255)<<8}class Gb{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(t){t=ar(Ue(t,32,"key"));const s=Be(t,0),i=Be(t,2),r=Be(t,4),a=Be(t,6),o=Be(t,8),u=Be(t,10),l=Be(t,12),h=Be(t,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|u<<2)&8191,this.r[7]=(u>>>11|l<<5)&8065,this.r[8]=(l>>>8|h<<8)&8191,this.r[9]=h>>>5&127;for(let p=0;p<8;p++)this.pad[p]=Be(t,16+2*p)}process(t,s,i=false){const r=i?0:2048,{h:a,r:o}=this,u=o[0],l=o[1],h=o[2],p=o[3],m=o[4],_=o[5],k=o[6],T=o[7],P=o[8],F=o[9],U=Be(t,s+0),D=Be(t,s+2),z=Be(t,s+4),q=Be(t,s+6),Y=Be(t,s+8),K=Be(t,s+10),Z=Be(t,s+12),X=Be(t,s+14);let re=a[0]+(U&8191),x=a[1]+((U>>>13|D<<3)&8191),b=a[2]+((D>>>10|z<<6)&8191),v=a[3]+((z>>>7|q<<9)&8191),V=a[4]+((q>>>4|Y<<12)&8191),W=a[5]+(Y>>>1&8191),O=a[6]+((Y>>>14|K<<2)&8191),R=a[7]+((K>>>11|Z<<5)&8191),B=a[8]+((Z>>>8|X<<8)&8191),M=a[9]+(X>>>5|r),A=0,H=A+re*u+x*(5*F)+b*(5*P)+v*(5*T)+V*(5*k);A=H>>>13,H&=8191,H+=W*(5*_)+O*(5*m)+R*(5*p)+B*(5*h)+M*(5*l),A+=H>>>13,H&=8191;let G=A+re*l+x*u+b*(5*F)+v*(5*P)+V*(5*T);A=G>>>13,G&=8191,G+=W*(5*k)+O*(5*_)+R*(5*m)+B*(5*p)+M*(5*h),A+=G>>>13,G&=8191;let te=A+re*h+x*l+b*u+v*(5*F)+V*(5*P);A=te>>>13,te&=8191,te+=W*(5*T)+O*(5*k)+R*(5*_)+B*(5*m)+M*(5*p),A+=te>>>13,te&=8191;let ce=A+re*p+x*h+b*l+v*u+V*(5*F);A=ce>>>13,ce&=8191,ce+=W*(5*P)+O*(5*T)+R*(5*k)+B*(5*_)+M*(5*m),A+=ce>>>13,ce&=8191;let oe=A+re*m+x*p+b*h+v*l+V*u;A=oe>>>13,oe&=8191,oe+=W*(5*F)+O*(5*P)+R*(5*T)+B*(5*k)+M*(5*_),A+=oe>>>13,oe&=8191;let w=A+re*_+x*m+b*p+v*h+V*l;A=w>>>13,w&=8191,w+=W*u+O*(5*F)+R*(5*P)+B*(5*T)+M*(5*k),A+=w>>>13,w&=8191;let S=A+re*k+x*_+b*m+v*p+V*h;A=S>>>13,S&=8191,S+=W*l+O*u+R*(5*F)+B*(5*P)+M*(5*T),A+=S>>>13,S&=8191;let N=A+re*T+x*k+b*_+v*m+V*p;A=N>>>13,N&=8191,N+=W*h+O*l+R*u+B*(5*F)+M*(5*P),A+=N>>>13,N&=8191;let L=A+re*P+x*T+b*k+v*_+V*m;A=L>>>13,L&=8191,L+=W*p+O*h+R*l+B*u+M*(5*F),A+=L>>>13,L&=8191;let j=A+re*F+x*P+b*T+v*k+V*_;A=j>>>13,j&=8191,j+=W*m+O*p+R*h+B*l+M*u,A+=j>>>13,j&=8191,A=(A<<2)+A|0,A=A+H|0,H=A&8191,A=A>>>13,G+=A,a[0]=H,a[1]=G,a[2]=te,a[3]=ce,a[4]=oe,a[5]=w,a[6]=S,a[7]=N,a[8]=L,a[9]=j}finalize(){const{h:t,pad:s}=this,i=new Uint16Array(10);let r=t[1]>>>13;t[1]&=8191;for(let u=2;u<10;u++)t[u]+=r,r=t[u]>>>13,t[u]&=8191;t[0]+=r*5,r=t[0]>>>13,t[0]&=8191,t[1]+=r,r=t[1]>>>13,t[1]&=8191,t[2]+=r,i[0]=t[0]+5,r=i[0]>>>13,i[0]&=8191;for(let u=1;u<10;u++)i[u]=t[u]+r,r=i[u]>>>13,i[u]&=8191;i[9]-=8192;let a=(r^1)-1;for(let u=0;u<10;u++)i[u]&=a;a=~a;for(let u=0;u<10;u++)t[u]=t[u]&a|i[u];t[0]=(t[0]|t[1]<<13)&65535,t[1]=(t[1]>>>3|t[2]<<10)&65535,t[2]=(t[2]>>>6|t[3]<<7)&65535,t[3]=(t[3]>>>9|t[4]<<4)&65535,t[4]=(t[4]>>>12|t[5]<<1|t[6]<<14)&65535,t[5]=(t[6]>>>2|t[7]<<11)&65535,t[6]=(t[7]>>>5|t[8]<<8)&65535,t[7]=(t[8]>>>8|t[9]<<5)&65535;let o=t[0]+s[0];t[0]=o&65535;for(let u=1;u<8;u++)o=(t[u]+s[u]|0)+(o>>>16)|0,t[u]=o&65535;Pt(i)}update(t){Cc(this),Ue(t),t=ar(t);const{buffer:s,blockLen:i}=this,r=t.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(t,a);continue}s.set(t.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,Pt(this.h,this.r,this.buffer,this.pad)}digestInto(t){Cc(this),Lb(t,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++)t[a++]=i[o]>>>0,t[a++]=i[o]>>>8}digest(){const{buffer:t,outputLen:s}=this;this.digestInto(t);const i=t.slice(0,s);return this.destroy(),i}}const Xb=Ob(32,e=>new Gb(e));function _1(e,t,s,i,r,a=20){let o=e[0],u=e[1],l=e[2],h=e[3],p=t[0],m=t[1],_=t[2],k=t[3],T=t[4],P=t[5],F=t[6],U=t[7],D=r,z=s[0],q=s[1],Y=s[2],K=o,Z=u,X=l,re=h,x=p,b=m,v=_,V=k,W=T,O=P,R=F,B=U,M=D,A=z,H=q,G=Y;for(let ce=0;ce<a;ce+=2)K=K+x|0,M=xe(M^K,16),W=W+M|0,x=xe(x^W,12),K=K+x|0,M=xe(M^K,8),W=W+M|0,x=xe(x^W,7),Z=Z+b|0,A=xe(A^Z,16),O=O+A|0,b=xe(b^O,12),Z=Z+b|0,A=xe(A^Z,8),O=O+A|0,b=xe(b^O,7),X=X+v|0,H=xe(H^X,16),R=R+H|0,v=xe(v^R,12),X=X+v|0,H=xe(H^X,8),R=R+H|0,v=xe(v^R,7),re=re+V|0,G=xe(G^re,16),B=B+G|0,V=xe(V^B,12),re=re+V|0,G=xe(G^re,8),B=B+G|0,V=xe(V^B,7),K=K+b|0,G=xe(G^K,16),R=R+G|0,b=xe(b^R,12),K=K+b|0,G=xe(G^K,8),R=R+G|0,b=xe(b^R,7),Z=Z+v|0,M=xe(M^Z,16),B=B+M|0,v=xe(v^B,12),Z=Z+v|0,M=xe(M^Z,8),B=B+M|0,v=xe(v^B,7),X=X+V|0,A=xe(A^X,16),W=W+A|0,V=xe(V^W,12),X=X+V|0,A=xe(A^X,8),W=W+A|0,V=xe(V^W,7),re=re+x|0,H=xe(H^re,16),O=O+H|0,x=xe(x^O,12),re=re+x|0,H=xe(H^re,8),O=O+H|0,x=xe(x^O,7);let te=0;i[te++]=o+K|0,i[te++]=u+Z|0,i[te++]=l+X|0,i[te++]=h+re|0,i[te++]=p+x|0,i[te++]=m+b|0,i[te++]=_+v|0,i[te++]=k+V|0,i[te++]=T+W|0,i[te++]=P+O|0,i[te++]=F+R|0,i[te++]=U+B|0,i[te++]=D+M|0,i[te++]=z+A|0,i[te++]=q+H|0,i[te++]=Y+G|0}function zb(e,t,s,i){const r=At?e:mt(e.slice(0,4)),a=At?t:mt(t.slice(0,8)),o=At?s:mt(s.slice(0,4)),u=new Uint32Array(16);_1(r,a,o.subarray(1),u,o[0]);let l=0;i[l++]=u[0]-r[0]|0,i[l++]=u[1]-r[1]|0,i[l++]=u[2]-r[2]|0,i[l++]=u[3]-r[3]|0,i[l++]=u[12]-o[0]|0,i[l++]=u[13]-o[1]|0,i[l++]=u[14]-o[2]|0,i[l++]=u[15]-o[3]|0,mt(i),At||Pt(r,a,o),Pt(u)}const Yb=Wb(_1,{counterRight:false,counterLength:8,extendNonceFn:zb,allowShortKeys:false}),Kb=new Uint8Array(16),Ic=(e,t)=>{e.update(t);const s=t.length%16;s&&e.update(Kb.subarray(s))},Zb=new Uint8Array(32);function Rc(e,t,s,i,r){r!==void 0&&Ue(r,void 0,"AAD");const a=e(t,s,Zb),o=Vb(i.length,r?r.length:0,true),u=Xb.create(a);r&&Ic(u,r),Ic(u,i),u.update(o);const l=u.digest();return Pt(a,o),l}const Qb=e=>(t,s,i)=>({encrypt(a,o){const u=a.length;o=ba(u+16,o,false),o.set(a);const l=o.subarray(0,-16);e(t,s,l,l,1);const h=Rc(e,t,s,l,i);return o.set(h,u),Pt(h),o},decrypt(a,o){o=ba(a.length-16,o,false);const u=a.subarray(0,-16),l=a.subarray(-16),h=Rc(e,t,s,u,i);if(!Mb(l,h))throw Pt(h),new Error("invalid tag");return o.set(a.subarray(0,-16)),e(t,s,o,o,1),Pt(h),o}}),Jb=Bb({blockSize:64,nonceLength:24,tagLength:16,withAAD:true},Qb(Yb));function ey(e,t,s){return pr(e),s===void 0&&(s=new Uint8Array(e.outputLen)),Fa(e,s,t)}const Vn=Uint8Array.of(0),Pc=Uint8Array.of();function ty(e,t,s,i=32){pr(e),os(i,"length"),Gt(t,void 0,"prk");const r=e.outputLen;if(t.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=Pc:Gt(s,void 0,"info");const o=new Uint8Array(a*r),u=Fa.create(e,t),l=u._cloneInto(),h=new Uint8Array(u.outputLen);for(let p=0;p<a;p++)Vn[0]=p+1,l.update(p===0?Pc:h).update(s).update(Vn).digestInto(h),o.set(h,r*p),u._cloneInto(l);return u.destroy(),l.destroy(),si(h,Vn),o.slice(0,i)}const sy=(e,t,s,i,r)=>ty(e,ey(e,t,s),i,r),iy="viji-enc:",Lc="viji-enc:v1:",ry="viji-enc:v1",jn=24,ny=16,Dc=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 oy(){const e=new Uint8Array(Dc.length);for(let t=0;t<e.length;t++)e[t]=Dc[t]^ay[t];return e}class Ts extends Error{constructor(t,s){super(t),this.reason=s,this.name="SceneEnvelopeError"}}function cy(e){return e.startsWith(iy)}function x1(e){const t=atob(e),s=new Uint8Array(t.length);for(let i=0;i<t.length;i++)s[i]=t.charCodeAt(i);return s}function uy(e){return x1(e.replace(/-/g,"+").replace(/_/g,"/"))}function ly(e){return sy(Aa,oy(),new TextEncoder().encode(ry),uy(e),32)}function hy(e,t){if(!e.startsWith(Lc))throw new Ts("Unsupported scene envelope version (this core supports viji-enc:v1)","UNSUPPORTED_VERSION");if(!t)throw new Ts("Encrypted scene received without a key component","MISSING_KEY_COMPONENT");let s,i;try{s=x1(e.slice(Lc.length)),i=ly(t)}catch{throw new Ts("Malformed scene envelope","MALFORMED_ENVELOPE")}if(s.length<jn+ny)throw new Ts("Truncated scene envelope","MALFORMED_ENVELOPE");const r=s.subarray(0,jn),a=s.subarray(jn);try{const o=Jb(i,r).decrypt(a);return new TextDecoder().decode(o)}catch{throw new Ts("Scene envelope authentication failed","DECRYPT_FAILED")}}function v1(e){self.postMessage({type:"error",id:`${e.code.toLowerCase()}_${Date.now()}`,timestamp:Date.now(),data:e})}const fi={current:null};self.addEventListener("error",e=>{const t=e.error,s=t?.stack,i=t?.message??e.message??String(e);fi.current?fi.current.reportSceneError({message:i,...s!==void 0&&{stack:s},code:"UNCAUGHT_ERROR"}):v1({message:i,code:"UNCAUGHT_ERROR",...s!==void 0&&{stack:s}}),e.preventDefault()});self.addEventListener("unhandledrejection",e=>{const t=e.reason,s=t?.stack,i=t?.message??String(e.reason);fi.current?fi.current.reportSceneError({message:i,...s!==void 0&&{stack:s},code:"UNHANDLED_REJECTION"}):v1({message:i,code:"UNHANDLED_REJECTION",...s!==void 0&&{stack:s}}),e.preventDefault()});const ht=new Ba,st=new Td(e=>self.postMessage(e));fi.current=st;ht.setSceneErrorReporter(st);let $n=null;function Nc(e){const t=Rb(e,{transforms:["typescript"],disableESTransforms:true,sourceMapOptions:{compiledFilename:"scene.js"},filePath:"scene.ts"});return{code:t.code,mappings:t.sourceMap?.mappings??null}}function Fc(e){const{code:t,error:s}=qh(e);return s?(st.reportSceneError({message:s.message,code:s.code,sourceOverride:"scene"}),null):t}async function fy(e,t,s){const i=t.initialParameters;let r,a,o=false;try{cy(e)&&(o=true,e=hy(e,t.keyComponent)),st.resetForSceneReload(),$n=null,self.renderFunction=null,ht.resetParameterState();const u=bd(e);r=u.renderer,a=u.p5CanvasMode,ht.setCapabilityUsageMask(Ys.detectUsage(e,r)),s.resolve(u)}catch(u){if(u instanceof Ts){s.reject({message:`Scene decrypt failed: ${u.message}`,code:"SCENE_DECRYPT_ERROR"});return}const l=u;s.reject({message:`Scene analysis failed: ${l.message}`,code:"SCENE_ANALYSIS_ERROR"});return}try{if(r==="shader"){st.setCurrentSourceMap(null);try{await ht.initShaderMode(e,{redactDriverInfoLogs:o})}catch(u){const l=u;if(l.__isShaderCompileError)throw l;st.reportSceneError({message:`Scene code error: ${l.message}`,...l.stack!==void 0&&{stack:l.stack},code:"SCENE_CODE_ERROR",sourceOverride:"scene"});return}ht.sendAllParametersToHost()}else if(r==="p5"){const u=Nc(e),{code:l,mappings:h}=u;st.setCurrentSourceMap(h);const p=Fc(l);if(p===null)return;const m=p+`
602
+ return { setup: typeof setup !== "undefined" ? setup : null, render: typeof render !== "undefined" ? render : null };`,_=new Function("viji","p5","console",m),k=st.makeArtistConsole(globalThis.console),{setup:T,render:P}=_(ht.viji,null,k);if(!P){st.reportSceneError({message:"P5 mode requires a render(viji, p5) function",code:"P5_INIT_ERROR",sourceOverride:"scene"});return}try{await ht.initP5Mode(T,P,{...a!==void 0&&{canvasMode:a}})}catch(F){const U=F;st.reportSceneError({message:`P5 init error: ${U.message}`,...U.stack!==void 0&&{stack:U.stack},code:"P5_INIT_ERROR",sourceOverride:"scene"});return}ht.sendAllParametersToHost()}else{const{code:u,mappings:l}=Nc(e);st.setCurrentSourceMap(l);const h=Fc(u);if(h===null)return;const p=h+`
603
+ if (typeof render === "function") {
604
+ return render;
605
+ }
606
+ throw new Error("Scene code must define a render function");`,m=Object.getPrototypeOf(async function(){}).constructor,_=new m("viji","console",p),k=st.makeArtistConsole(globalThis.console);$n=await _(ht.viji,k),self.renderFunction=$n,ht.sendAllParametersToHost()}i&&ht.seedInitialValues(i)}catch(u){const l=u;console.error("Failed to load scene code:",l),st.reportSceneError({message:`Scene code error: ${l.message}`,...l.stack!==void 0&&{stack:l.stack},code:l.__isShaderCompileError?"SHADER_COMPILE_ERROR":"SCENE_CODE_ERROR",sourceOverride:"scene",...l.__sourceLocation&&{sourceLocationOverride:l.__sourceLocation}})}}self.setSceneCode=fy;
607
+
608
+ })();