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