esbuild-wasm
Version:
The cross-platform WebAssembly binary for esbuild, a JavaScript bundler.
19 lines (18 loc) • 52.8 kB
JavaScript
var Ge=Object.defineProperty;var He=(e,t)=>{for(var n in t)Ge(e,n,{get:t[n],enumerable:!0})};var Ce={};He(Ce,{analyzeMetafile:()=>ht,analyzeMetafileSync:()=>vt,build:()=>pt,buildSync:()=>wt,context:()=>gt,default:()=>Et,formatMessages:()=>yt,formatMessagesSync:()=>xt,initialize:()=>Ot,stop:()=>Rt,transform:()=>mt,transformSync:()=>bt,version:()=>dt});function De(e){let t=i=>{if(i===null)n.write8(0);else if(typeof i=="boolean")n.write8(1),n.write8(+i);else if(typeof i=="number")n.write8(2),n.write32(i|0);else if(typeof i=="string")n.write8(3),n.write(Z(i));else if(i instanceof Uint8Array)n.write8(4),n.write(i);else if(i instanceof Array){n.write8(5),n.write32(i.length);for(let u of i)t(u)}else{let u=Object.keys(i);n.write8(6),n.write32(u.length);for(let l of u)n.write(Z(l)),t(i[l])}},n=new we;return n.write32(0),n.write32(e.id<<1|+!e.isRequest),t(e.value),Ae(n.buf,n.len-4,0),n.buf.subarray(0,n.len)}function Me(e){let t=()=>{switch(n.read8()){case 0:return null;case 1:return!!n.read8();case 2:return n.read32();case 3:return ae(n.read());case 4:return n.read();case 5:{let f=n.read32(),s=[];for(let o=0;o<f;o++)s.push(t());return s}case 6:{let f=n.read32(),s={};for(let o=0;o<f;o++)s[ae(n.read())]=t();return s}default:throw new Error("Invalid packet")}},n=new we(e),i=n.read32(),u=(i&1)===0;i>>>=1;let l=t();if(n.ptr!==e.length)throw new Error("Invalid packet");return{id:i,isRequest:u,value:l}}var we=class{constructor(t=new Uint8Array(1024)){this.buf=t;this.len=0;this.ptr=0}_write(t){if(this.len+t>this.buf.length){let n=new Uint8Array((this.len+t)*2);n.set(this.buf),this.buf=n}return this.len+=t,this.len-t}write8(t){let n=this._write(1);this.buf[n]=t}write32(t){let n=this._write(4);Ae(this.buf,t,n)}write(t){let n=this._write(4+t.length);Ae(this.buf,t.length,n),this.buf.set(t,n+4)}_read(t){if(this.ptr+t>this.buf.length)throw new Error("Invalid packet");return this.ptr+=t,this.ptr-t}read8(){return this.buf[this._read(1)]}read32(){return Fe(this.buf,this._read(4))}read(){let t=this.read32(),n=new Uint8Array(t),i=this._read(n.length);return n.set(this.buf.subarray(i,i+t)),n}},Z,ae,$e;if(typeof TextEncoder!="undefined"&&typeof TextDecoder!="undefined"){let e=new TextEncoder,t=new TextDecoder;Z=n=>e.encode(n),ae=n=>t.decode(n),$e='new TextEncoder().encode("")'}else if(typeof Buffer!="undefined")Z=e=>Buffer.from(e),ae=e=>{let{buffer:t,byteOffset:n,byteLength:i}=e;return Buffer.from(t,n,i).toString()},$e='Buffer.from("")';else throw new Error("No UTF-8 codec found");if(!(Z("")instanceof Uint8Array))throw new Error(`Invariant violation: "${$e} instanceof Uint8Array" is incorrectly false
This indicates that your JavaScript environment is broken. You cannot use
esbuild in this environment because esbuild relies on this invariant. This
is not a problem with esbuild. You need to fix your environment instead.
`);function Fe(e,t){return(e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24)>>>0}function Ae(e,t,n){e[n++]=t,e[n++]=t>>8,e[n++]=t>>16,e[n++]=t>>24}var le=String.fromCharCode;function ee(e,t,n){let i=e[t],u=1,l=0;for(let f=0;f<t;f++)e[f]===10?(u++,l=0):l++;throw new SyntaxError(n||(t===e.length?"Unexpected end of input while parsing JSON":i>=32&&i<=126?`Unexpected character ${le(i)} in JSON at position ${t} (line ${u}, column ${l})`:`Unexpected byte 0x${i.toString(16)} in JSON at position ${t} (line ${u}, column ${l})`))}function Be(e){if(!(e instanceof Uint8Array))throw new Error("JSON input must be a Uint8Array");let t=[],n=[],i=[],u=e.length,l=null,f=0,s,o=0;for(;o<u;){let m=e[o++];if(m<=32)continue;let p;switch(f===2&&l===null&&m!==34&&m!==125&&ee(e,--o),m){case 116:{(e[o++]!==114||e[o++]!==117||e[o++]!==101)&&ee(e,--o),p=!0;break}case 102:{(e[o++]!==97||e[o++]!==108||e[o++]!==115||e[o++]!==101)&&ee(e,--o),p=!1;break}case 110:{(e[o++]!==117||e[o++]!==108||e[o++]!==108)&&ee(e,--o),p=null;break}case 45:case 46:case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:{let y=o;for(p=le(m),m=e[o];;){switch(m){case 43:case 45:case 46:case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:case 101:case 69:{p+=le(m),m=e[++o];continue}}break}p=+p,isNaN(p)&&ee(e,--y,"Invalid number");break}case 34:{for(p="";o>=u&&ee(e,u),m=e[o++],m!==34;)if(m===92)switch(e[o++]){case 34:p+='"';break;case 47:p+="/";break;case 92:p+="\\";break;case 98:p+="\b";break;case 102:p+="\f";break;case 110:p+=`
`;break;case 114:p+="\r";break;case 116:p+=" ";break;case 117:{let y=0;for(let P=0;P<4;P++)m=e[o++],y<<=4,m>=48&&m<=57?y|=m-48:m>=97&&m<=102?y|=m+-87:m>=65&&m<=70?y|=m+-55:ee(e,--o);p+=le(y);break}default:ee(e,--o);break}else if(m<=127)p+=le(m);else if((m&224)===192)p+=le((m&31)<<6|e[o++]&63);else if((m&240)===224)p+=le((m&15)<<12|(e[o++]&63)<<6|e[o++]&63);else if((m&248)==240){let y=(m&7)<<18|(e[o++]&63)<<12|(e[o++]&63)<<6|e[o++]&63;y>65535&&(y-=65536,p+=le(y>>10&1023|55296),y=56320|y&1023),p+=le(y)}p[0];break}case 91:{p=[],t.push(l),n.push(s),i.push(f),l=null,s=p,f=1;continue}case 123:{p={},t.push(l),n.push(s),i.push(f),l=null,s=p,f=2;continue}case 93:{f!==1&&ee(e,--o),p=s,l=t.pop(),s=n.pop(),f=i.pop();break}case 125:{f!==2&&ee(e,--o),p=s,l=t.pop(),s=n.pop(),f=i.pop();break}default:ee(e,--o)}for(m=e[o];m<=32;)m=e[++o];switch(f){case 0:{if(o===u)return p;break}case 1:{if(s.push(p),m===44){o++;continue}if(m===93)continue;break}case 2:{if(l===null){if(l=p,m===58){o++;continue}}else{if(s[l]=p,l=null,m===44){o++;continue}if(m===125)continue}break}}break}ee(e,o)}var _=JSON.stringify,Le="warning",Ue="silent";function pe(e,t){let n=[];for(let i of e){if(Q(i,t),i.indexOf(",")>=0)throw new Error(`Invalid ${t}: ${i}`);n.push(i)}return n.join(",")}var ve=()=>null,I=e=>typeof e=="boolean"?null:"a boolean",b=e=>typeof e=="string"?null:"a string",Re=e=>e instanceof RegExp?null:"a RegExp object",ce=e=>typeof e=="number"&&e===(e|0)?null:"an integer",Ze=e=>typeof e=="number"&&e===(e|0)&&e>=0&&e<=65535?null:"a valid port number",je=e=>typeof e=="function"?null:"a function",oe=e=>Array.isArray(e)?null:"an array",Y=e=>Array.isArray(e)&&e.every(t=>typeof t=="string")?null:"an array of strings",G=e=>typeof e=="object"&&e!==null&&!Array.isArray(e)?null:"an object",et=e=>typeof e=="object"&&e!==null?null:"an array or an object",tt=e=>e instanceof WebAssembly.Module?null:"a WebAssembly.Module",Pe=e=>typeof e=="object"&&!Array.isArray(e)?null:"an object or null",Ne=e=>typeof e=="string"||typeof e=="boolean"?null:"a string or a boolean",nt=e=>typeof e=="string"||typeof e=="object"&&e!==null&&!Array.isArray(e)?null:"a string or an object",qe=e=>typeof e=="string"||Array.isArray(e)&&e.every(t=>typeof t=="string")?null:"a string or an array of strings",Ie=e=>typeof e=="string"||e instanceof Uint8Array?null:"a string or a Uint8Array",rt=e=>typeof e=="string"||e instanceof URL?null:"a string or a URL";function r(e,t,n,i){let u=e[n];if(t[n+""]=!0,u===void 0)return;let l=i(u);if(l!==null)throw new Error(`${_(n)} must be ${l}`);return u}function K(e,t,n){for(let i in e)if(!(i in t))throw new Error(`Invalid option ${n}: ${_(i)}`)}function We(e){let t=Object.create(null),n=r(e,t,"wasmURL",rt),i=r(e,t,"wasmModule",tt),u=r(e,t,"worker",I);return K(e,t,"in initialize() call"),{wasmURL:n,wasmModule:i,worker:u}}function ze(e){let t;if(e!==void 0){t=Object.create(null);for(let n in e){let i=e[n];if(typeof i=="string"||i===!1)t[n]=i;else throw new Error(`Expected ${_(n)} in mangle cache to map to either a string or false`)}}return t}function Se(e,t,n,i,u){let l=r(t,n,"color",I),f=r(t,n,"logLevel",b),s=r(t,n,"logLimit",ce);l!==void 0?e.push(`--color=${l}`):i&&e.push("--color=true"),e.push(`--log-level=${f||u}`),e.push(`--log-limit=${s||0}`)}function Q(e,t,n){if(typeof e!="string")throw new Error(`Expected value for ${t}${n!==void 0?" "+_(n):""} to be a string, got ${typeof e} instead`);return e}function Ke(e,t,n){let i=r(t,n,"legalComments",b),u=r(t,n,"sourceRoot",b),l=r(t,n,"sourcesContent",I),f=r(t,n,"target",qe),s=r(t,n,"format",b),o=r(t,n,"globalName",b),m=r(t,n,"mangleProps",Re),p=r(t,n,"reserveProps",Re),y=r(t,n,"mangleQuoted",I),P=r(t,n,"minify",I),L=r(t,n,"minifySyntax",I),T=r(t,n,"minifyWhitespace",I),j=r(t,n,"minifyIdentifiers",I),C=r(t,n,"lineLimit",ce),z=r(t,n,"drop",Y),V=r(t,n,"dropLabels",Y),R=r(t,n,"charset",b),h=r(t,n,"treeShaking",I),g=r(t,n,"ignoreAnnotations",I),a=r(t,n,"jsx",b),O=r(t,n,"jsxFactory",b),E=r(t,n,"jsxFragment",b),A=r(t,n,"jsxImportSource",b),k=r(t,n,"jsxDev",I),c=r(t,n,"jsxSideEffects",I),d=r(t,n,"define",G),v=r(t,n,"logOverride",G),D=r(t,n,"supported",G),B=r(t,n,"pure",Y),$=r(t,n,"keepNames",I),S=r(t,n,"platform",b),F=r(t,n,"tsconfigRaw",nt),q=r(t,n,"absPaths",Y);if(i&&e.push(`--legal-comments=${i}`),u!==void 0&&e.push(`--source-root=${u}`),l!==void 0&&e.push(`--sources-content=${l}`),f&&e.push(`--target=${pe(Array.isArray(f)?f:[f],"target")}`),s&&e.push(`--format=${s}`),o&&e.push(`--global-name=${o}`),S&&e.push(`--platform=${S}`),F&&e.push(`--tsconfig-raw=${typeof F=="string"?F:JSON.stringify(F)}`),P&&e.push("--minify"),L&&e.push("--minify-syntax"),T&&e.push("--minify-whitespace"),j&&e.push("--minify-identifiers"),C&&e.push(`--line-limit=${C}`),R&&e.push(`--charset=${R}`),h!==void 0&&e.push(`--tree-shaking=${h}`),g&&e.push("--ignore-annotations"),z)for(let w of z)e.push(`--drop:${Q(w,"drop")}`);if(V&&e.push(`--drop-labels=${pe(V,"drop label")}`),q&&e.push(`--abs-paths=${pe(q,"abs paths")}`),m&&e.push(`--mangle-props=${Oe(m)}`),p&&e.push(`--reserve-props=${Oe(p)}`),y!==void 0&&e.push(`--mangle-quoted=${y}`),a&&e.push(`--jsx=${a}`),O&&e.push(`--jsx-factory=${O}`),E&&e.push(`--jsx-fragment=${E}`),A&&e.push(`--jsx-import-source=${A}`),k&&e.push("--jsx-dev"),c&&e.push("--jsx-side-effects"),d)for(let w in d){if(w.indexOf("=")>=0)throw new Error(`Invalid define: ${w}`);e.push(`--define:${w}=${Q(d[w],"define",w)}`)}if(v)for(let w in v){if(w.indexOf("=")>=0)throw new Error(`Invalid log override: ${w}`);e.push(`--log-override:${w}=${Q(v[w],"log override",w)}`)}if(D)for(let w in D){if(w.indexOf("=")>=0)throw new Error(`Invalid supported: ${w}`);let M=D[w];if(typeof M!="boolean")throw new Error(`Expected value for supported ${_(w)} to be a boolean, got ${typeof M} instead`);e.push(`--supported:${w}=${M}`)}if(B)for(let w of B)e.push(`--pure:${Q(w,"pure")}`);$&&e.push("--keep-names")}function it(e,t,n,i,u){var ne;let l=[],f=[],s=Object.create(null),o=null,m=null;Se(l,t,s,n,i),Ke(l,t,s);let p=r(t,s,"sourcemap",Ne),y=r(t,s,"bundle",I),P=r(t,s,"splitting",I),L=r(t,s,"preserveSymlinks",I),T=r(t,s,"metafile",I),j=r(t,s,"outfile",b),C=r(t,s,"outdir",b),z=r(t,s,"outbase",b),V=r(t,s,"tsconfig",b),R=r(t,s,"resolveExtensions",Y),h=r(t,s,"nodePaths",Y),g=r(t,s,"mainFields",Y),a=r(t,s,"conditions",Y),O=r(t,s,"external",Y),E=r(t,s,"packages",b),A=r(t,s,"alias",G),k=r(t,s,"loader",G),c=r(t,s,"outExtension",G),d=r(t,s,"publicPath",b),v=r(t,s,"entryNames",b),D=r(t,s,"chunkNames",b),B=r(t,s,"assetNames",b),$=r(t,s,"inject",Y),S=r(t,s,"banner",G),F=r(t,s,"footer",G),q=r(t,s,"entryPoints",et),w=r(t,s,"absWorkingDir",b),M=r(t,s,"stdin",G),N=(ne=r(t,s,"write",I))!=null?ne:u,U=r(t,s,"allowOverwrite",I),J=r(t,s,"mangleCache",G);if(s.plugins=!0,K(t,s,`in ${e}() call`),p&&l.push(`--sourcemap${p===!0?"":`=${p}`}`),y&&l.push("--bundle"),U&&l.push("--allow-overwrite"),P&&l.push("--splitting"),L&&l.push("--preserve-symlinks"),T&&l.push("--metafile"),j&&l.push(`--outfile=${j}`),C&&l.push(`--outdir=${C}`),z&&l.push(`--outbase=${z}`),V&&l.push(`--tsconfig=${V}`),E&&l.push(`--packages=${E}`),R&&l.push(`--resolve-extensions=${pe(R,"resolve extension")}`),d&&l.push(`--public-path=${d}`),v&&l.push(`--entry-names=${v}`),D&&l.push(`--chunk-names=${D}`),B&&l.push(`--asset-names=${B}`),g&&l.push(`--main-fields=${pe(g,"main field")}`),a&&l.push(`--conditions=${pe(a,"condition")}`),O)for(let x of O)l.push(`--external:${Q(x,"external")}`);if(A)for(let x in A){if(x.indexOf("=")>=0)throw new Error(`Invalid package name in alias: ${x}`);l.push(`--alias:${x}=${Q(A[x],"alias",x)}`)}if(S)for(let x in S){if(x.indexOf("=")>=0)throw new Error(`Invalid banner file type: ${x}`);l.push(`--banner:${x}=${Q(S[x],"banner",x)}`)}if(F)for(let x in F){if(x.indexOf("=")>=0)throw new Error(`Invalid footer file type: ${x}`);l.push(`--footer:${x}=${Q(F[x],"footer",x)}`)}if($)for(let x of $)l.push(`--inject:${Q(x,"inject")}`);if(k)for(let x in k){if(x.indexOf("=")>=0)throw new Error(`Invalid loader extension: ${x}`);l.push(`--loader:${x}=${Q(k[x],"loader",x)}`)}if(c)for(let x in c){if(x.indexOf("=")>=0)throw new Error(`Invalid out extension: ${x}`);l.push(`--out-extension:${x}=${Q(c[x],"out extension",x)}`)}if(q)if(Array.isArray(q))for(let x=0,re=q.length;x<re;x++){let H=q[x];if(typeof H=="object"&&H!==null){let te=Object.create(null),ie=r(H,te,"in",b),X=r(H,te,"out",b);if(K(H,te,"in entry point at index "+x),ie===void 0)throw new Error('Missing property "in" for entry point at index '+x);if(X===void 0)throw new Error('Missing property "out" for entry point at index '+x);f.push([X,ie])}else f.push(["",Q(H,"entry point at index "+x)])}else for(let x in q)f.push([x,Q(q[x],"entry point",x)]);if(M){let x=Object.create(null),re=r(M,x,"contents",Ie),H=r(M,x,"resolveDir",b),te=r(M,x,"sourcefile",b),ie=r(M,x,"loader",b);K(M,x,'in "stdin" object'),te&&l.push(`--sourcefile=${te}`),ie&&l.push(`--loader=${ie}`),H&&(m=H),typeof re=="string"?o=Z(re):re instanceof Uint8Array&&(o=re)}let W=[];if(h)for(let x of h)x+="",W.push(x);return{entries:f,flags:l,write:N,stdinContents:o,stdinResolveDir:m,absWorkingDir:w,nodePaths:W,mangleCache:ze(J)}}function lt(e,t,n,i){let u=[],l=Object.create(null);Se(u,t,l,n,i),Ke(u,t,l);let f=r(t,l,"sourcemap",Ne),s=r(t,l,"sourcefile",b),o=r(t,l,"loader",b),m=r(t,l,"banner",b),p=r(t,l,"footer",b),y=r(t,l,"mangleCache",G);return K(t,l,`in ${e}() call`),f&&u.push(`--sourcemap=${f===!0?"external":f}`),s&&u.push(`--sourcefile=${s}`),o&&u.push(`--loader=${o}`),m&&u.push(`--banner=${m}`),p&&u.push(`--footer=${p}`),{flags:u,mangleCache:ze(y)}}function _e(e){let t={},n={didClose:!1,reason:""},i={},u=0,l=0,f=new Uint8Array(16*1024),s=0,o=R=>{let h=s+R.length;if(h>f.length){let a=new Uint8Array(h*2);a.set(f),f=a}f.set(R,s),s+=R.length;let g=0;for(;g+4<=s;){let a=Fe(f,g);if(g+4+a>s)break;g+=4,T(f.subarray(g,g+a)),g+=a}g>0&&(f.copyWithin(0,g,s),s-=g)},m=R=>{n.didClose=!0,R&&(n.reason=": "+(R.message||R));let h="The service was stopped"+n.reason;for(let g in i)i[g](h,null);i={}},p=(R,h,g)=>{if(n.didClose)return g("The service is no longer running"+n.reason,null);let a=u++;i[a]=(O,E)=>{try{g(O,E)}finally{R&&R.unref()}},R&&R.ref(),e.writeToStdin(De({id:a,isRequest:!0,value:h}))},y=(R,h)=>{if(n.didClose)throw new Error("The service is no longer running"+n.reason);e.writeToStdin(De({id:R,isRequest:!1,value:h}))},P=async(R,h)=>{try{if(h.command==="ping"){y(R,{});return}if(typeof h.key=="number"){let g=t[h.key];if(!g)return;let a=g[h.command];if(a){await a(R,h);return}}throw new Error("Invalid command: "+h.command)}catch(g){let a=[ue(g,e,null,void 0,"")];try{y(R,{errors:a})}catch(O){}}},L=!0,T=R=>{if(L){L=!1;let g=String.fromCharCode(...R);if(g!=="0.28.1")throw new Error(`Cannot start service: Host version "0.28.1" does not match binary version ${_(g)}`);return}let h=Me(R);if(h.isRequest)P(h.id,h.value);else{let g=i[h.id];delete i[h.id],h.value.error?g(h.value.error,{}):g(null,h.value)}};return{readFromStdout:o,afterClose:m,service:{buildOrContext:({callName:R,refs:h,options:g,isTTY:a,defaultWD:O,callback:E})=>{let A=0,k=l++,c={},d={ref(){++A===1&&h&&h.ref()},unref(){--A===0&&(delete t[k],h&&h.unref())}};t[k]=c,d.ref(),ot(R,k,p,y,d,e,c,g,a,O,(v,D)=>{try{E(v,D)}finally{d.unref()}})},transform:({callName:R,refs:h,input:g,options:a,isTTY:O,fs:E,callback:A})=>{let k=Ve(),c=d=>{try{if(typeof g!="string"&&!(g instanceof Uint8Array))throw new Error('The input to "transform" must be a string or a Uint8Array');let{flags:v,mangleCache:D}=lt(R,a,O,Ue),B={command:"transform",flags:v,inputFS:d!==null,input:d!==null?Z(d):typeof g=="string"?Z(g):g};D&&(B.mangleCache=D),p(h,B,($,S)=>{if($)return A(new Error($),null);let F=ge(S.errors,k),q=ge(S.warnings,k),w=1,M=()=>{if(--w===0){let N={warnings:q,code:S.code,map:S.map,mangleCache:void 0,legalComments:void 0};"legalComments"in S&&(N.legalComments=S==null?void 0:S.legalComments),S.mangleCache&&(N.mangleCache=S==null?void 0:S.mangleCache),A(null,N)}};if(F.length>0)return A(ye("Transform failed",F,q),null);S.codeFS&&(w++,E.readFile(S.code,(N,U)=>{N!==null?A(N,null):(S.code=U,M())})),S.mapFS&&(w++,E.readFile(S.map,(N,U)=>{N!==null?A(N,null):(S.map=U,M())})),M()})}catch(v){let D=[];try{Se(D,a,{},O,Ue)}catch($){}let B=ue(v,e,k,void 0,"");p(h,{command:"error",flags:D,error:B},()=>{B.detail=k.load(B.detail),A(ye("Transform failed",[B],[]),null)})}};if((typeof g=="string"||g instanceof Uint8Array)&&g.length>1024*1024){let d=c;c=()=>E.writeFile(g,d)}c(null)},formatMessages:({callName:R,refs:h,messages:g,options:a,callback:O})=>{if(!a)throw new Error(`Missing second argument in ${R}() call`);let E={},A=r(a,E,"kind",b),k=r(a,E,"color",I),c=r(a,E,"terminalWidth",ce);if(K(a,E,`in ${R}() call`),A===void 0)throw new Error(`Missing "kind" in ${R}() call`);if(A!=="error"&&A!=="warning")throw new Error(`Expected "kind" to be "error" or "warning" in ${R}() call`);let d={command:"format-msgs",messages:se(g,"messages",null,"",c),isWarning:A==="warning"};k!==void 0&&(d.color=k),c!==void 0&&(d.terminalWidth=c),p(h,d,(v,D)=>{if(v)return O(new Error(v),null);O(null,D.messages)})},analyzeMetafile:({callName:R,refs:h,metafile:g,options:a,callback:O})=>{a===void 0&&(a={});let E={},A=r(a,E,"color",I),k=r(a,E,"verbose",I);K(a,E,`in ${R}() call`);let c={command:"analyze-metafile",metafile:g};A!==void 0&&(c.color=A),k!==void 0&&(c.verbose=k),p(h,c,(d,v)=>{if(d)return O(new Error(d),null);O(null,v.result)})}}}}function ot(e,t,n,i,u,l,f,s,o,m,p){let y=Ve(),P=e==="context",L=(C,z)=>{let V=[];try{Se(V,s,{},o,Le)}catch(h){}let R=ue(C,l,y,void 0,z);n(u,{command:"error",flags:V,error:R},()=>{R.detail=y.load(R.detail),p(ye(P?"Context failed":"Build failed",[R],[]),null)})},T;if(typeof s=="object"){let C=s.plugins;if(C!==void 0){if(!Array.isArray(C))return L(new Error('"plugins" must be an array'),"");T=C}}if(T&&T.length>0){if(l.isSync)return L(new Error("Cannot use plugins in synchronous API calls"),"");st(t,n,i,u,l,f,s,T,y).then(C=>{if(!C.ok)return L(C.error,C.pluginName);try{j(C.requestPlugins,C.runOnEndCallbacks,C.scheduleOnDisposeCallbacks)}catch(z){L(z,"")}},C=>L(C,""));return}try{j(null,(C,z)=>z([],[]),()=>{})}catch(C){L(C,"")}function j(C,z,V){let R=l.hasFS,{entries:h,flags:g,write:a,stdinContents:O,stdinResolveDir:E,absWorkingDir:A,nodePaths:k,mangleCache:c}=it(e,s,o,Le,R);if(a&&!l.hasFS)throw new Error('The "write" option is unavailable in this environment');let d={command:"build",key:t,entries:h,flags:g,write:a,stdinContents:O,stdinResolveDir:E,absWorkingDir:A||m,nodePaths:k,context:P};C&&(d.plugins=C),c&&(d.mangleCache=c);let v=($,S)=>{let F={errors:ge($.errors,y),warnings:ge($.warnings,y),outputFiles:void 0,metafile:void 0,mangleCache:void 0},q=F.errors.slice(),w=F.warnings.slice();$.outputFiles&&(F.outputFiles=$.outputFiles.map(ut)),$.metafile&&$.metafile.length&&(F.metafile=ct($.metafile)),$.mangleCache&&(F.mangleCache=$.mangleCache),$.writeToStdout!==void 0&&console.log(ae($.writeToStdout).replace(/\n$/,"")),z(F,(M,N)=>{if(q.length>0||M.length>0){let U=ye("Build failed",q.concat(M),w.concat(N));return S(U,null,M,N)}S(null,F,M,N)})},D,B;P&&(f["on-end"]=($,S)=>new Promise(F=>{v(S,(q,w,M,N)=>{let U={errors:M,warnings:N};B&&B(q,w),D=void 0,B=void 0,i($,U),F()})})),n(u,d,($,S)=>{if($)return p(new Error($),null);if(!P)return v(S,(w,M)=>(V(),p(w,M)));if(S.errors.length>0)return p(ye("Context failed",S.errors,S.warnings),null);let F=!1,q={rebuild:()=>(D||(D=new Promise((w,M)=>{let N;B=(J,W)=>{N||(N=()=>J?M(J):w(W))};let U=()=>{n(u,{command:"rebuild",key:t},(W,ne)=>{W?M(new Error(W)):N?N():U()})};U()})),D),watch:(w={})=>new Promise((M,N)=>{if(!l.hasFS)throw new Error('Cannot use the "watch" API in this environment');let U={},J=r(w,U,"delay",ce);K(w,U,"in watch() call");let W={command:"watch",key:t};J&&(W.delay=J),n(u,W,ne=>{ne?N(new Error(ne)):M(void 0)})}),serve:(w={})=>new Promise((M,N)=>{if(!l.hasFS)throw new Error('Cannot use the "serve" API in this environment');let U={},J=r(w,U,"port",Ze),W=r(w,U,"host",b),ne=r(w,U,"servedir",b),x=r(w,U,"keyfile",b),re=r(w,U,"certfile",b),H=r(w,U,"fallback",b),te=r(w,U,"cors",G),ie=r(w,U,"onRequest",je);K(w,U,"in serve() call");let X={command:"serve",key:t,onRequest:!!ie};if(J!==void 0&&(X.port=J),W!==void 0&&(X.host=W),ne!==void 0&&(X.servedir=ne),x!==void 0&&(X.keyfile=x),re!==void 0&&(X.certfile=re),H!==void 0&&(X.fallback=H),te){let me={},de=r(te,me,"origin",qe);K(te,me,'on "cors" object'),Array.isArray(de)?X.corsOrigin=de:de!==void 0&&(X.corsOrigin=[de])}n(u,X,(me,de)=>{if(me)return N(new Error(me));ie&&(f["serve-request"]=(Qe,Ye)=>{ie(Ye.args),i(Qe,{})}),M(de)})}),cancel:()=>new Promise(w=>{if(F)return w();n(u,{command:"cancel",key:t},()=>{w()})}),dispose:()=>new Promise(w=>{if(F)return w();F=!0,n(u,{command:"dispose",key:t},()=>{w(),V(),u.unref()})})};u.ref(),p(null,q)})}}var st=async(e,t,n,i,u,l,f,s,o)=>{let m=[],p=[],y={},P={},L=[],T=0,j=0,C=[],z=!1;s=[...s];for(let h of s){let g={};if(typeof h!="object")throw new Error(`Plugin at index ${j} must be an object`);let a=r(h,g,"name",b);if(typeof a!="string"||a==="")throw new Error(`Plugin at index ${j} is missing a name`);try{let O=r(h,g,"setup",je);if(typeof O!="function")throw new Error("Plugin is missing a setup function");K(h,g,`on plugin ${_(a)}`);let E={name:a,onStart:!1,onEnd:!1,onResolve:[],onLoad:[]};j++;let k=O({initialOptions:f,resolve:(c,d={})=>{if(!z)throw new Error('Cannot call "resolve" before plugin setup has completed');if(typeof c!="string")throw new Error("The path to resolve must be a string");let v=Object.create(null),D=r(d,v,"pluginName",b),B=r(d,v,"importer",b),$=r(d,v,"namespace",b),S=r(d,v,"resolveDir",b),F=r(d,v,"kind",b),q=r(d,v,"pluginData",ve),w=r(d,v,"with",G);return K(d,v,"in resolve() call"),new Promise((M,N)=>{let U={command:"resolve",path:c,key:e,pluginName:a};if(D!=null&&(U.pluginName=D),B!=null&&(U.importer=B),$!=null&&(U.namespace=$),S!=null&&(U.resolveDir=S),F!=null)U.kind=F;else throw new Error('Must specify "kind" when calling "resolve"');q!=null&&(U.pluginData=o.store(q)),w!=null&&(U.with=at(w,"with")),t(i,U,(J,W)=>{J!==null?N(new Error(J)):M({errors:ge(W.errors,o),warnings:ge(W.warnings,o),path:W.path,external:W.external,sideEffects:W.sideEffects,namespace:W.namespace,suffix:W.suffix,pluginData:o.load(W.pluginData)})})})},onStart(c){let d='This error came from the "onStart" callback registered here:',v=be(new Error(d),u,"onStart");m.push({name:a,callback:c,note:v}),E.onStart=!0},onEnd(c){let d='This error came from the "onEnd" callback registered here:',v=be(new Error(d),u,"onEnd");p.push({name:a,callback:c,note:v}),E.onEnd=!0},onResolve(c,d){let v='This error came from the "onResolve" callback registered here:',D=be(new Error(v),u,"onResolve"),B={},$=r(c,B,"filter",Re),S=r(c,B,"namespace",b);if(K(c,B,`in onResolve() call for plugin ${_(a)}`),$==null)throw new Error("onResolve() call is missing a filter");let F=T++;y[F]={name:a,callback:d,note:D},E.onResolve.push({id:F,filter:Oe($),namespace:S||""})},onLoad(c,d){let v='This error came from the "onLoad" callback registered here:',D=be(new Error(v),u,"onLoad"),B={},$=r(c,B,"filter",Re),S=r(c,B,"namespace",b);if(K(c,B,`in onLoad() call for plugin ${_(a)}`),$==null)throw new Error("onLoad() call is missing a filter");let F=T++;P[F]={name:a,callback:d,note:D},E.onLoad.push({id:F,filter:Oe($),namespace:S||""})},onDispose(c){L.push(c)},esbuild:u.esbuild});k&&await k,C.push(E)}catch(O){return{ok:!1,error:O,pluginName:a}}}l["on-start"]=async(h,g)=>{o.clear();let a={errors:[],warnings:[]};await Promise.all(m.map(async({name:O,callback:E,note:A})=>{try{let k=await E();if(k!=null){if(typeof k!="object")throw new Error(`Expected onStart() callback in plugin ${_(O)} to return an object`);let c={},d=r(k,c,"errors",oe),v=r(k,c,"warnings",oe);K(k,c,`from onStart() callback in plugin ${_(O)}`),d!=null&&a.errors.push(...se(d,"errors",o,O,void 0)),v!=null&&a.warnings.push(...se(v,"warnings",o,O,void 0))}}catch(k){a.errors.push(ue(k,u,o,A&&A(),O))}})),n(h,a)},l["on-resolve"]=async(h,g)=>{let a={},O="",E,A;for(let k of g.ids)try{({name:O,callback:E,note:A}=y[k]);let c=await E({path:g.path,importer:g.importer,namespace:g.namespace,resolveDir:g.resolveDir,kind:g.kind,pluginData:o.load(g.pluginData),with:g.with});if(c!=null){if(typeof c!="object")throw new Error(`Expected onResolve() callback in plugin ${_(O)} to return an object`);let d={},v=r(c,d,"pluginName",b),D=r(c,d,"path",b),B=r(c,d,"namespace",b),$=r(c,d,"suffix",b),S=r(c,d,"external",I),F=r(c,d,"sideEffects",I),q=r(c,d,"pluginData",ve),w=r(c,d,"errors",oe),M=r(c,d,"warnings",oe),N=r(c,d,"watchFiles",Y),U=r(c,d,"watchDirs",Y);K(c,d,`from onResolve() callback in plugin ${_(O)}`),a.id=k,v!=null&&(a.pluginName=v),D!=null&&(a.path=D),B!=null&&(a.namespace=B),$!=null&&(a.suffix=$),S!=null&&(a.external=S),F!=null&&(a.sideEffects=F),q!=null&&(a.pluginData=o.store(q)),w!=null&&(a.errors=se(w,"errors",o,O,void 0)),M!=null&&(a.warnings=se(M,"warnings",o,O,void 0)),N!=null&&(a.watchFiles=xe(N,"watchFiles")),U!=null&&(a.watchDirs=xe(U,"watchDirs"));break}}catch(c){a={id:k,errors:[ue(c,u,o,A&&A(),O)]};break}n(h,a)},l["on-load"]=async(h,g)=>{let a={},O="",E,A;for(let k of g.ids)try{({name:O,callback:E,note:A}=P[k]);let c=await E({path:g.path,namespace:g.namespace,suffix:g.suffix,pluginData:o.load(g.pluginData),with:g.with});if(c!=null){if(typeof c!="object")throw new Error(`Expected onLoad() callback in plugin ${_(O)} to return an object`);let d={},v=r(c,d,"pluginName",b),D=r(c,d,"contents",Ie),B=r(c,d,"resolveDir",b),$=r(c,d,"pluginData",ve),S=r(c,d,"loader",b),F=r(c,d,"errors",oe),q=r(c,d,"warnings",oe),w=r(c,d,"watchFiles",Y),M=r(c,d,"watchDirs",Y);K(c,d,`from onLoad() callback in plugin ${_(O)}`),a.id=k,v!=null&&(a.pluginName=v),D instanceof Uint8Array?a.contents=D:D!=null&&(a.contents=Z(D)),B!=null&&(a.resolveDir=B),$!=null&&(a.pluginData=o.store($)),S!=null&&(a.loader=S),F!=null&&(a.errors=se(F,"errors",o,O,void 0)),q!=null&&(a.warnings=se(q,"warnings",o,O,void 0)),w!=null&&(a.watchFiles=xe(w,"watchFiles")),M!=null&&(a.watchDirs=xe(M,"watchDirs"));break}}catch(c){a={id:k,errors:[ue(c,u,o,A&&A(),O)]};break}n(h,a)};let V=(h,g)=>g([],[]);p.length>0&&(V=(h,g)=>{(async()=>{let a=[],O=[];for(let{name:E,callback:A,note:k}of p){let c,d;try{let v=await A(h);if(v!=null){if(typeof v!="object")throw new Error(`Expected onEnd() callback in plugin ${_(E)} to return an object`);let D={},B=r(v,D,"errors",oe),$=r(v,D,"warnings",oe);K(v,D,`from onEnd() callback in plugin ${_(E)}`),B!=null&&(c=se(B,"errors",o,E,void 0)),$!=null&&(d=se($,"warnings",o,E,void 0))}}catch(v){c=[ue(v,u,o,k&&k(),E)]}if(c){a.push(...c);try{h.errors.push(...c)}catch(v){}}if(d){O.push(...d);try{h.warnings.push(...d)}catch(v){}}}g(a,O)})()});let R=()=>{for(let h of L)setTimeout(()=>h(),0)};return z=!0,{ok:!0,requestPlugins:C,runOnEndCallbacks:V,scheduleOnDisposeCallbacks:R}};function Ve(){let e=new Map,t=0;return{clear(){e.clear()},load(n){return e.get(n)},store(n){if(n===void 0)return-1;let i=t++;return e.set(i,n),i}}}function be(e,t,n){let i,u=!1;return()=>{if(u)return i;u=!0;try{let l=(e.stack+"").split(`
`);l.splice(1,1);let f=Je(t,l,n);if(f)return i={text:e.message,location:f},i}catch(l){}}}function ue(e,t,n,i,u){let l="Internal error",f=null;try{l=(e&&e.message||e)+""}catch(s){}try{f=Je(t,(e.stack+"").split(`
`),"")}catch(s){}return{id:"",pluginName:u,text:l,location:f,notes:i?[i]:[],detail:n?n.store(e):-1}}function Je(e,t,n){let i=" at ";if(e.readFileSync&&!t[0].startsWith(i)&&t[1].startsWith(i))for(let u=1;u<t.length;u++){let l=t[u];if(l.startsWith(i))for(l=l.slice(i.length);;){let f=/^(?:new |async )?\S+ \((.*)\)$/.exec(l);if(f){l=f[1];continue}if(f=/^eval at \S+ \((.*)\)(?:, \S+:\d+:\d+)?$/.exec(l),f){l=f[1];continue}if(f=/^(\S+):(\d+):(\d+)$/.exec(l),f){let s;try{s=e.readFileSync(f[1],"utf8")}catch(y){break}let o=s.split(/\r\n|\r|\n|\u2028|\u2029/)[+f[2]-1]||"",m=+f[3]-1,p=o.slice(m,m+n.length)===n?n.length:0;return{file:f[1],namespace:"file",line:+f[2],column:Z(o.slice(0,m)).length,length:Z(o.slice(m,m+p)).length,lineText:o+`
`+t.slice(1).join(`
`),suggestion:""}}break}}return null}function ye(e,t,n){let i=5;e+=t.length<1?"":` with ${t.length} error${t.length<2?"":"s"}:`+t.slice(0,i+1).map((l,f)=>{if(f===i)return`
...`;if(!l.location)return`
error: ${l.text}`;let{file:s,line:o,column:m}=l.location,p=l.pluginName?`[plugin: ${l.pluginName}] `:"";return`
${s}:${o}:${m}: ERROR: ${p}${l.text}`}).join("");let u=new Error(e);for(let[l,f]of[["errors",t],["warnings",n]])Object.defineProperty(u,l,{configurable:!0,enumerable:!0,get:()=>f,set:s=>Object.defineProperty(u,l,{configurable:!0,enumerable:!0,value:s})});return u}function ge(e,t){for(let n of e)n.detail=t.load(n.detail);return e}function Te(e,t,n){if(e==null)return null;let i={},u=r(e,i,"file",b),l=r(e,i,"namespace",b),f=r(e,i,"line",ce),s=r(e,i,"column",ce),o=r(e,i,"length",ce),m=r(e,i,"lineText",b),p=r(e,i,"suggestion",b);if(K(e,i,t),m){let y=m.slice(0,(s&&s>0?s:0)+(o&&o>0?o:0)+(n&&n>0?n:80));!/[\x7F-\uFFFF]/.test(y)&&!/\n/.test(m)&&(m=y)}return{file:u||"",namespace:l||"",line:f||0,column:s||0,length:o||0,lineText:m||"",suggestion:p||""}}function se(e,t,n,i,u){let l=[],f=0;for(let s of e){let o={},m=r(s,o,"id",b),p=r(s,o,"pluginName",b),y=r(s,o,"text",b),P=r(s,o,"location",Pe),L=r(s,o,"notes",oe),T=r(s,o,"detail",ve),j=`in element ${f} of "${t}"`;K(s,o,j);let C=[];if(L)for(let z of L){let V={},R=r(z,V,"text",b),h=r(z,V,"location",Pe);K(z,V,j),C.push({text:R||"",location:Te(h,j,u)})}l.push({id:m||"",pluginName:p||i,text:y||"",location:Te(P,j,u),notes:C,detail:n?n.store(T):-1}),f++}return l}function xe(e,t){let n=[];for(let i of e){if(typeof i!="string")throw new Error(`${_(t)} must be an array of strings`);n.push(i)}return n}function at(e,t){let n=Object.create(null);for(let i in e){let u=e[i];if(typeof u!="string")throw new Error(`key ${_(i)} in object ${_(t)} must be a string`);n[i]=u}return n}function ut({path:e,contents:t,hash:n}){let i=null;return{path:e,contents:t,hash:n,get text(){let u=this.contents;return(i===null||u!==t)&&(t=u,i=ae(u)),i}}}function Oe(e){let t=e.source;return e.flags&&(t=`(?${e.flags})${t}`),t}function ct(e){let t;try{t=ae(e)}catch(n){return Be(e)}return JSON.parse(t)}var dt="0.28.1",pt=e=>he().build(e),gt=e=>he().context(e),mt=(e,t)=>he().transform(e,t),yt=(e,t)=>he().formatMessages(e,t),ht=(e,t)=>he().analyzeMetafile(e,t),wt=()=>{throw new Error('The "buildSync" API only works in node')},bt=()=>{throw new Error('The "transformSync" API only works in node')},xt=()=>{throw new Error('The "formatMessagesSync" API only works in node')},vt=()=>{throw new Error('The "analyzeMetafileSync" API only works in node')},Rt=()=>(Ee&&Ee(),Promise.resolve()),fe,Ee,ke,he=()=>{if(ke)return ke;throw fe?new Error('You need to wait for the promise returned from "initialize" to be resolved before calling this'):new Error('You need to call "initialize" before calling this')},Ot=e=>{e=We(e||{});let t=e.wasmURL,n=e.wasmModule,i=e.worker!==!1;if(!t&&!n)throw new Error('Must provide either the "wasmURL" option or the "wasmModule" option');if(fe)throw new Error('Cannot call "initialize" more than once');return fe=St(t||"",n,i),fe.catch(()=>{fe=void 0}),fe},St=async(e,t,n)=>{let i,u,l=new Promise(y=>u=y);if(n){let y=new Blob(['onmessage=(postMessage=>{\n// Copyright 2018 The Go Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// license that can be found in the LICENSE file.\nlet onmessage,globalThis={};for(let r=self;r;r=Object.getPrototypeOf(r))for(let f of Object.getOwnPropertyNames(r))f in globalThis||Object.defineProperty(globalThis,f,{get:()=>self[f]});(()=>{const r=()=>{const a=new Error("not implemented");return a.code="ENOSYS",a};if(!globalThis.fs){let a="";globalThis.fs={constants:{O_WRONLY:-1,O_RDWR:-1,O_CREAT:-1,O_TRUNC:-1,O_APPEND:-1,O_EXCL:-1,O_DIRECTORY:-1},writeSync(i,s){a+=y.decode(s);const n=a.lastIndexOf(`\n`);return n!=-1&&(console.log(a.substring(0,n)),a=a.substring(n+1)),s.length},write(i,s,n,o,h,u){if(n!==0||o!==s.length||h!==null){u(r());return}const m=this.writeSync(i,s);u(null,m)},chmod(i,s,n){n(r())},chown(i,s,n,o){o(r())},close(i,s){s(r())},fchmod(i,s,n){n(r())},fchown(i,s,n,o){o(r())},fstat(i,s){s(r())},fsync(i,s){s(null)},ftruncate(i,s,n){n(r())},lchown(i,s,n,o){o(r())},link(i,s,n){n(r())},lstat(i,s){s(r())},mkdir(i,s,n){n(r())},open(i,s,n,o){o(r())},read(i,s,n,o,h,u){u(r())},readdir(i,s){s(r())},readlink(i,s){s(r())},rename(i,s,n){n(r())},rmdir(i,s){s(r())},stat(i,s){s(r())},symlink(i,s,n){n(r())},truncate(i,s,n){n(r())},unlink(i,s){s(r())},utimes(i,s,n,o){o(r())}}}if(globalThis.process||(globalThis.process={getuid(){return-1},getgid(){return-1},geteuid(){return-1},getegid(){return-1},getgroups(){throw r()},pid:-1,ppid:-1,umask(){throw r()},cwd(){throw r()},chdir(){throw r()}}),globalThis.path||(globalThis.path={resolve(...a){return a.join("/")}}),!globalThis.crypto)throw new Error("globalThis.crypto is not available, polyfill required (crypto.getRandomValues only)");if(!globalThis.performance)throw new Error("globalThis.performance is not available, polyfill required (performance.now only)");if(!globalThis.TextEncoder)throw new Error("globalThis.TextEncoder is not available, polyfill required");if(!globalThis.TextDecoder)throw new Error("globalThis.TextDecoder is not available, polyfill required");const f=new TextEncoder("utf-8"),y=new TextDecoder("utf-8");globalThis.Go=class{constructor(){this.argv=["js"],this.env={},this.exit=t=>{t!==0&&console.warn("exit code:",t)},this._exitPromise=new Promise(t=>{this._resolveExitPromise=t}),this._pendingEvent=null,this._scheduledTimeouts=new Map,this._nextCallbackTimeoutID=1;const a=(t,e)=>{this.mem.setUint32(t+0,e,!0),this.mem.setUint32(t+4,Math.floor(e/4294967296),!0)},i=(t,e)=>{this.mem.setUint32(t+0,e,!0)},s=t=>{const e=this.mem.getUint32(t+0,!0),l=this.mem.getInt32(t+4,!0);return e+l*4294967296},n=t=>{const e=this.mem.getFloat64(t,!0);if(e===0)return;if(!isNaN(e))return e;const l=this.mem.getUint32(t,!0);return this._values[l]},o=(t,e)=>{if(typeof e=="number"&&e!==0){if(isNaN(e)){this.mem.setUint32(t+4,2146959360,!0),this.mem.setUint32(t,0,!0);return}this.mem.setFloat64(t,e,!0);return}if(e===void 0){this.mem.setFloat64(t,0,!0);return}let c=this._ids.get(e);c===void 0&&(c=this._idPool.pop(),c===void 0&&(c=this._values.length),this._values[c]=e,this._goRefCounts[c]=0,this._ids.set(e,c)),this._goRefCounts[c]++;let g=0;switch(typeof e){case"object":e!==null&&(g=1);break;case"string":g=2;break;case"symbol":g=3;break;case"function":g=4;break}this.mem.setUint32(t+4,2146959360|g,!0),this.mem.setUint32(t,c,!0)},h=t=>{const e=s(t+0),l=s(t+8);return new Uint8Array(this._inst.exports.mem.buffer,e,l)},u=t=>{const e=s(t+0),l=s(t+8),c=new Array(l);for(let g=0;g<l;g++)c[g]=n(e+g*8);return c},m=t=>{const e=s(t+0),l=s(t+8);return y.decode(new DataView(this._inst.exports.mem.buffer,e,l))},d=(t,e)=>(this._inst.exports.testExport0(),this._inst.exports.testExport(t,e)),w=Date.now()-performance.now();this.importObject={_gotest:{add:(t,e)=>t+e,callExport:d},gojs:{"runtime.wasmExit":t=>{t>>>=0;const e=this.mem.getInt32(t+8,!0);this.exited=!0,delete this._inst,delete this._values,delete this._goRefCounts,delete this._ids,delete this._idPool,this.exit(e)},"runtime.wasmWrite":t=>{t>>>=0;const e=s(t+8),l=s(t+16),c=this.mem.getInt32(t+24,!0);globalThis.fs.writeSync(e,new Uint8Array(this._inst.exports.mem.buffer,l,c))},"runtime.resetMemoryDataView":t=>{t>>>=0,this.mem=new DataView(this._inst.exports.mem.buffer)},"runtime.nanotime1":t=>{t>>>=0,a(t+8,(w+performance.now())*1e6)},"runtime.walltime":t=>{t>>>=0;const e=new Date().getTime();a(t+8,e/1e3),this.mem.setInt32(t+16,e%1e3*1e6,!0)},"runtime.scheduleTimeoutEvent":t=>{t>>>=0;const e=this._nextCallbackTimeoutID;this._nextCallbackTimeoutID++,this._scheduledTimeouts.set(e,setTimeout(()=>{for(this._resume();this._scheduledTimeouts.has(e);)console.warn("scheduleTimeoutEvent: missed timeout event"),this._resume()},s(t+8))),this.mem.setInt32(t+16,e,!0)},"runtime.clearTimeoutEvent":t=>{t>>>=0;const e=this.mem.getInt32(t+8,!0);clearTimeout(this._scheduledTimeouts.get(e)),this._scheduledTimeouts.delete(e)},"runtime.getRandomData":t=>{t>>>=0,crypto.getRandomValues(h(t+8))},"syscall/js.finalizeRef":t=>{t>>>=0;const e=this.mem.getUint32(t+8,!0);if(this._goRefCounts[e]--,this._goRefCounts[e]===0){const l=this._values[e];this._values[e]=null,this._ids.delete(l),this._idPool.push(e)}},"syscall/js.stringVal":t=>{t>>>=0,o(t+24,m(t+8))},"syscall/js.valueGet":t=>{t>>>=0;const e=Reflect.get(n(t+8),m(t+16));t=this._inst.exports.getsp()>>>0,o(t+32,e)},"syscall/js.valueSet":t=>{t>>>=0,Reflect.set(n(t+8),m(t+16),n(t+32))},"syscall/js.valueDelete":t=>{t>>>=0,Reflect.deleteProperty(n(t+8),m(t+16))},"syscall/js.valueIndex":t=>{t>>>=0,o(t+24,Reflect.get(n(t+8),s(t+16)))},"syscall/js.valueSetIndex":t=>{t>>>=0,Reflect.set(n(t+8),s(t+16),n(t+24))},"syscall/js.valueCall":t=>{t>>>=0;try{const e=n(t+8),l=Reflect.get(e,m(t+16)),c=u(t+32),g=Reflect.apply(l,e,c);t=this._inst.exports.getsp()>>>0,o(t+56,g),this.mem.setUint8(t+64,1)}catch(e){t=this._inst.exports.getsp()>>>0,o(t+56,e),this.mem.setUint8(t+64,0)}},"syscall/js.valueInvoke":t=>{t>>>=0;try{const e=n(t+8),l=u(t+16),c=Reflect.apply(e,void 0,l);t=this._inst.exports.getsp()>>>0,o(t+40,c),this.mem.setUint8(t+48,1)}catch(e){t=this._inst.exports.getsp()>>>0,o(t+40,e),this.mem.setUint8(t+48,0)}},"syscall/js.valueNew":t=>{t>>>=0;try{const e=n(t+8),l=u(t+16),c=Reflect.construct(e,l);t=this._inst.exports.getsp()>>>0,o(t+40,c),this.mem.setUint8(t+48,1)}catch(e){t=this._inst.exports.getsp()>>>0,o(t+40,e),this.mem.setUint8(t+48,0)}},"syscall/js.valueLength":t=>{t>>>=0,a(t+16,parseInt(n(t+8).length))},"syscall/js.valuePrepareString":t=>{t>>>=0;const e=f.encode(String(n(t+8)));o(t+16,e),a(t+24,e.length)},"syscall/js.valueLoadString":t=>{t>>>=0;const e=n(t+8);h(t+16).set(e)},"syscall/js.valueInstanceOf":t=>{t>>>=0,this.mem.setUint8(t+24,n(t+8)instanceof n(t+16)?1:0)},"syscall/js.copyBytesToGo":t=>{t>>>=0;const e=h(t+8),l=n(t+32);if(!(l instanceof Uint8Array||l instanceof Uint8ClampedArray)){this.mem.setUint8(t+48,0);return}const c=l.subarray(0,e.length);e.set(c),a(t+40,c.length),this.mem.setUint8(t+48,1)},"syscall/js.copyBytesToJS":t=>{t>>>=0;const e=n(t+8),l=h(t+16);if(!(e instanceof Uint8Array||e instanceof Uint8ClampedArray)){this.mem.setUint8(t+48,0);return}const c=l.subarray(0,e.length);e.set(c),a(t+40,c.length),this.mem.setUint8(t+48,1)},debug:t=>{console.log(t)}}}}async run(a){if(!(a instanceof WebAssembly.Instance))throw new Error("Go.run: WebAssembly.Instance expected");this._inst=a,this.mem=new DataView(this._inst.exports.mem.buffer),this._values=[NaN,0,null,!0,!1,globalThis,this],this._goRefCounts=new Array(this._values.length).fill(1/0),this._ids=new Map([[0,1],[null,2],[!0,3],[!1,4],[globalThis,5],[this,6]]),this._idPool=[],this.exited=!1;let i=4096;const s=d=>{const w=i,t=f.encode(d+"\\0");return new Uint8Array(this.mem.buffer,i,t.length).set(t),i+=t.length,i%8!==0&&(i+=8-i%8),w},n=this.argv.length,o=[];this.argv.forEach(d=>{o.push(s(d))}),o.push(0),Object.keys(this.env).sort().forEach(d=>{o.push(s(`${d}=${this.env[d]}`))}),o.push(0);const u=i;if(o.forEach(d=>{this.mem.setUint32(i,d,!0),this.mem.setUint32(i+4,0,!0),i+=8}),i>=12288)throw new Error("total length of command line and environment variables exceeds limit");this._inst.exports.run(n,u),this.exited&&this._resolveExitPromise(),await this._exitPromise}_resume(){if(this.exited)throw new Error("Go program has already exited");this._inst.exports.resume(),this.exited&&this._resolveExitPromise()}_makeFuncWrapper(a){const i=this;return function(){const s={id:a,this:this,args:arguments};return i._pendingEvent=s,i._resume(),s.result}}}})(),onmessage=({data:r})=>{let f=new TextDecoder,y=globalThis.fs,a="";y.writeSync=(h,u)=>{if(h===1)postMessage(u);else if(h===2){a+=f.decode(u);let m=a.split(`\n`);m.length>1&&console.log(m.slice(0,-1).join(`\n`)),a=m[m.length-1]}else throw new Error("Bad write");return u.length};let i=[],s,n=0;onmessage=({data:h})=>(h.length>0&&(i.push(h),s&&s()),o),y.read=(h,u,m,d,w,t)=>{if(h!==0||m!==0||d!==u.length||w!==null)throw new Error("Bad read");if(i.length===0){s=()=>y.read(h,u,m,d,w,t);return}let e=i[0],l=Math.max(0,Math.min(d,e.length-n));u.set(e.subarray(n,n+l),m),n+=l,n===e.length&&(i.shift(),n=0),t(null,l)};let o=new globalThis.Go;return o.argv=["","--service=0.28.1"],tryToInstantiateModule(r,o).then(h=>{postMessage(null),o.run(h)},h=>{postMessage(h)}),o};async function tryToInstantiateModule(r,f){if(r instanceof WebAssembly.Module)return WebAssembly.instantiate(r,f.importObject);const y=await fetch(r);if(!y.ok)throw new Error(`Failed to download ${JSON.stringify(r)}`);if("instantiateStreaming"in WebAssembly&&/^application\\/wasm($|;)/i.test(y.headers.get("Content-Type")||""))return(await WebAssembly.instantiateStreaming(y,f.importObject)).instance;const a=await y.arrayBuffer();return(await WebAssembly.instantiate(a,f.importObject)).instance}return r=>onmessage(r);})(postMessage)'],{type:"text/javascript"});i=new Worker(URL.createObjectURL(y))}else{let y=(postMessage=>{
// Copyright 2018 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
let onmessage,globalThis={};for(let r=self;r;r=Object.getPrototypeOf(r))for(let f of Object.getOwnPropertyNames(r))f in globalThis||Object.defineProperty(globalThis,f,{get:()=>self[f]});(()=>{const r=()=>{const a=new Error("not implemented");return a.code="ENOSYS",a};if(!globalThis.fs){let a="";globalThis.fs={constants:{O_WRONLY:-1,O_RDWR:-1,O_CREAT:-1,O_TRUNC:-1,O_APPEND:-1,O_EXCL:-1,O_DIRECTORY:-1},writeSync(i,s){a+=y.decode(s);const n=a.lastIndexOf(`
`);return n!=-1&&(console.log(a.substring(0,n)),a=a.substring(n+1)),s.length},write(i,s,n,o,h,u){if(n!==0||o!==s.length||h!==null){u(r());return}const m=this.writeSync(i,s);u(null,m)},chmod(i,s,n){n(r())},chown(i,s,n,o){o(r())},close(i,s){s(r())},fchmod(i,s,n){n(r())},fchown(i,s,n,o){o(r())},fstat(i,s){s(r())},fsync(i,s){s(null)},ftruncate(i,s,n){n(r())},lchown(i,s,n,o){o(r())},link(i,s,n){n(r())},lstat(i,s){s(r())},mkdir(i,s,n){n(r())},open(i,s,n,o){o(r())},read(i,s,n,o,h,u){u(r())},readdir(i,s){s(r())},readlink(i,s){s(r())},rename(i,s,n){n(r())},rmdir(i,s){s(r())},stat(i,s){s(r())},symlink(i,s,n){n(r())},truncate(i,s,n){n(r())},unlink(i,s){s(r())},utimes(i,s,n,o){o(r())}}}if(globalThis.process||(globalThis.process={getuid(){return-1},getgid(){return-1},geteuid(){return-1},getegid(){return-1},getgroups(){throw r()},pid:-1,ppid:-1,umask(){throw r()},cwd(){throw r()},chdir(){throw r()}}),globalThis.path||(globalThis.path={resolve(...a){return a.join("/")}}),!globalThis.crypto)throw new Error("globalThis.crypto is not available, polyfill required (crypto.getRandomValues only)");if(!globalThis.performance)throw new Error("globalThis.performance is not available, polyfill required (performance.now only)");if(!globalThis.TextEncoder)throw new Error("globalThis.TextEncoder is not available, polyfill required");if(!globalThis.TextDecoder)throw new Error("globalThis.TextDecoder is not available, polyfill required");const f=new TextEncoder("utf-8"),y=new TextDecoder("utf-8");globalThis.Go=class{constructor(){this.argv=["js"],this.env={},this.exit=t=>{t!==0&&console.warn("exit code:",t)},this._exitPromise=new Promise(t=>{this._resolveExitPromise=t}),this._pendingEvent=null,this._scheduledTimeouts=new Map,this._nextCallbackTimeoutID=1;const a=(t,e)=>{this.mem.setUint32(t+0,e,!0),this.mem.setUint32(t+4,Math.floor(e/4294967296),!0)},i=(t,e)=>{this.mem.setUint32(t+0,e,!0)},s=t=>{const e=this.mem.getUint32(t+0,!0),l=this.mem.getInt32(t+4,!0);return e+l*4294967296},n=t=>{const e=this.mem.getFloat64(t,!0);if(e===0)return;if(!isNaN(e))return e;const l=this.mem.getUint32(t,!0);return this._values[l]},o=(t,e)=>{if(typeof e=="number"&&e!==0){if(isNaN(e)){this.mem.setUint32(t+4,2146959360,!0),this.mem.setUint32(t,0,!0);return}this.mem.setFloat64(t,e,!0);return}if(e===void 0){this.mem.setFloat64(t,0,!0);return}let c=this._ids.get(e);c===void 0&&(c=this._idPool.pop(),c===void 0&&(c=this._values.length),this._values[c]=e,this._goRefCounts[c]=0,this._ids.set(e,c)),this._goRefCounts[c]++;let g=0;switch(typeof e){case"object":e!==null&&(g=1);break;case"string":g=2;break;case"symbol":g=3;break;case"function":g=4;break}this.mem.setUint32(t+4,2146959360|g,!0),this.mem.setUint32(t,c,!0)},h=t=>{const e=s(t+0),l=s(t+8);return new Uint8Array(this._inst.exports.mem.buffer,e,l)},u=t=>{const e=s(t+0),l=s(t+8),c=new Array(l);for(let g=0;g<l;g++)c[g]=n(e+g*8);return c},m=t=>{const e=s(t+0),l=s(t+8);return y.decode(new DataView(this._inst.exports.mem.buffer,e,l))},d=(t,e)=>(this._inst.exports.testExport0(),this._inst.exports.testExport(t,e)),w=Date.now()-performance.now();this.importObject={_gotest:{add:(t,e)=>t+e,callExport:d},gojs:{"runtime.wasmExit":t=>{t>>>=0;const e=this.mem.getInt32(t+8,!0);this.exited=!0,delete this._inst,delete this._values,delete this._goRefCounts,delete this._ids,delete this._idPool,this.exit(e)},"runtime.wasmWrite":t=>{t>>>=0;const e=s(t+8),l=s(t+16),c=this.mem.getInt32(t+24,!0);globalThis.fs.writeSync(e,new Uint8Array(this._inst.exports.mem.buffer,l,c))},"runtime.resetMemoryDataView":t=>{t>>>=0,this.mem=new DataView(this._inst.exports.mem.buffer)},"runtime.nanotime1":t=>{t>>>=0,a(t+8,(w+performance.now())*1e6)},"runtime.walltime":t=>{t>>>=0;const e=new Date().getTime();a(t+8,e/1e3),this.mem.setInt32(t+16,e%1e3*1e6,!0)},"runtime.scheduleTimeoutEvent":t=>{t>>>=0;const e=this._nextCallbackTimeoutID;this._nextCallbackTimeoutID++,this._scheduledTimeouts.set(e,setTimeout(()=>{for(this._resume();this._scheduledTimeouts.has(e);)console.warn("scheduleTimeoutEvent: missed timeout event"),this._resume()},s(t+8))),this.mem.setInt32(t+16,e,!0)},"runtime.clearTimeoutEvent":t=>{t>>>=0;const e=this.mem.getInt32(t+8,!0);clearTimeout(this._scheduledTimeouts.get(e)),this._scheduledTimeouts.delete(e)},"runtime.getRandomData":t=>{t>>>=0,crypto.getRandomValues(h(t+8))},"syscall/js.finalizeRef":t=>{t>>>=0;const e=this.mem.getUint32(t+8,!0);if(this._goRefCounts[e]--,this._goRefCounts[e]===0){const l=this._values[e];this._values[e]=null,this._ids.delete(l),this._idPool.push(e)}},"syscall/js.stringVal":t=>{t>>>=0,o(t+24,m(t+8))},"syscall/js.valueGet":t=>{t>>>=0;const e=Reflect.get(n(t+8),m(t+16));t=this._inst.exports.getsp()>>>0,o(t+32,e)},"syscall/js.valueSet":t=>{t>>>=0,Reflect.set(n(t+8),m(t+16),n(t+32))},"syscall/js.valueDelete":t=>{t>>>=0,Reflect.deleteProperty(n(t+8),m(t+16))},"syscall/js.valueIndex":t=>{t>>>=0,o(t+24,Reflect.get(n(t+8),s(t+16)))},"syscall/js.valueSetIndex":t=>{t>>>=0,Reflect.set(n(t+8),s(t+16),n(t+24))},"syscall/js.valueCall":t=>{t>>>=0;try{const e=n(t+8),l=Reflect.get(e,m(t+16)),c=u(t+32),g=Reflect.apply(l,e,c);t=this._inst.exports.getsp()>>>0,o(t+56,g),this.mem.setUint8(t+64,1)}catch(e){t=this._inst.exports.getsp()>>>0,o(t+56,e),this.mem.setUint8(t+64,0)}},"syscall/js.valueInvoke":t=>{t>>>=0;try{const e=n(t+8),l=u(t+16),c=Reflect.apply(e,void 0,l);t=this._inst.exports.getsp()>>>0,o(t+40,c),this.mem.setUint8(t+48,1)}catch(e){t=this._inst.exports.getsp()>>>0,o(t+40,e),this.mem.setUint8(t+48,0)}},"syscall/js.valueNew":t=>{t>>>=0;try{const e=n(t+8),l=u(t+16),c=Reflect.construct(e,l);t=this._inst.exports.getsp()>>>0,o(t+40,c),this.mem.setUint8(t+48,1)}catch(e){t=this._inst.exports.getsp()>>>0,o(t+40,e),this.mem.setUint8(t+48,0)}},"syscall/js.valueLength":t=>{t>>>=0,a(t+16,parseInt(n(t+8).length))},"syscall/js.valuePrepareString":t=>{t>>>=0;const e=f.encode(String(n(t+8)));o(t+16,e),a(t+24,e.length)},"syscall/js.valueLoadString":t=>{t>>>=0;const e=n(t+8);h(t+16).set(e)},"syscall/js.valueInstanceOf":t=>{t>>>=0,this.mem.setUint8(t+24,n(t+8)instanceof n(t+16)?1:0)},"syscall/js.copyBytesToGo":t=>{t>>>=0;const e=h(t+8),l=n(t+32);if(!(l instanceof Uint8Array||l instanceof Uint8ClampedArray)){this.mem.setUint8(t+48,0);return}const c=l.subarray(0,e.length);e.set(c),a(t+40,c.length),this.mem.setUint8(t+48,1)},"syscall/js.copyBytesToJS":t=>{t>>>=0;const e=n(t+8),l=h(t+16);if(!(e instanceof Uint8Array||e instanceof Uint8ClampedArray)){this.mem.setUint8(t+48,0);return}const c=l.subarray(0,e.length);e.set(c),a(t+40,c.length),this.mem.setUint8(t+48,1)},debug:t=>{console.log(t)}}}}async run(a){if(!(a instanceof WebAssembly.Instance))throw new Error("Go.run: WebAssembly.Instance expected");this._inst=a,this.mem=new DataView(this._inst.exports.mem.buffer),this._values=[NaN,0,null,!0,!1,globalThis,this],this._goRefCounts=new Array(this._values.length).fill(1/0),this._ids=new Map([[0,1],[null,2],[!0,3],[!1,4],[globalThis,5],[this,6]]),this._idPool=[],this.exited=!1;let i=4096;const s=d=>{const w=i,t=f.encode(d+"\0");return new Uint8Array(this.mem.buffer,i,t.length).set(t),i+=t.length,i%8!==0&&(i+=8-i%8),w},n=this.argv.length,o=[];this.argv.forEach(d=>{o.push(s(d))}),o.push(0),Object.keys(this.env).sort().forEach(d=>{o.push(s(`${d}=${this.env[d]}`))}),o.push(0);const u=i;if(o.forEach(d=>{this.mem.setUint32(i,d,!0),this.mem.setUint32(i+4,0,!0),i+=8}),i>=12288)throw new Error("total length of command line and environment variables exceeds limit");this._inst.exports.run(n,u),this.exited&&this._resolveExitPromise(),await this._exitPromise}_resume(){if(this.exited)throw new Error("Go program has already exited");this._inst.exports.resume(),this.exited&&this._resolveExitPromise()}_makeFuncWrapper(a){const i=this;return function(){const s={id:a,this:this,args:arguments};return i._pendingEvent=s,i._resume(),s.result}}}})(),onmessage=({data:r})=>{let f=new TextDecoder,y=globalThis.fs,a="";y.writeSync=(h,u)=>{if(h===1)postMessage(u);else if(h===2){