isomorfeus-asset-manager 0.14.19 → 0.14.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,10 +1,17 @@
1
1
  (module=>{
2
- var ke=Object.defineProperty,lt=Object.defineProperties,it=Object.getOwnPropertyDescriptor,st=Object.getOwnPropertyDescriptors,ot=Object.getOwnPropertyNames,Ie=Object.getOwnPropertySymbols;var Ke=Object.prototype.hasOwnProperty,at=Object.prototype.propertyIsEnumerable;var ze=(e,t,r)=>t in e?ke(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Ae=(e,t)=>{for(var r in t||(t={}))Ke.call(t,r)&&ze(e,r,t[r]);if(Ie)for(var r of Ie(t))at.call(t,r)&&ze(e,r,t[r]);return e},Ne=(e,t)=>lt(e,st(t)),ut=e=>ke(e,"__esModule",{value:!0});var ft=(e,t)=>{for(var r in t)ke(e,r,{get:t[r],enumerable:!0})},ct=(e,t,r,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let u of ot(t))!Ke.call(e,u)&&(r||u!=="default")&&ke(e,u,{get:()=>t[u],enumerable:!(i=it(t,u))||i.enumerable});return e};var dt=(e=>(t,r)=>e&&e.get(t)||(r=ct(ut({}),t,1),e&&e.set(t,r),r))(typeof WeakMap!="undefined"?new WeakMap:0);var de=(e,t,r)=>new Promise((i,u)=>{var l=d=>{try{s(r.next(d))}catch(O){u(O)}},c=d=>{try{s(r.throw(d))}catch(O){u(O)}},s=d=>d.done?i(d.value):Promise.resolve(d.value).then(l,c);s((r=r.apply(e,t)).next())});var Be={};ft(Be,{analyzeMetafile:()=>Mt,analyzeMetafileSync:()=>Bt,build:()=>xt,buildSync:()=>Ct,default:()=>Nt,formatMessages:()=>$t,formatMessagesSync:()=>Tt,initialize:()=>Dt,serve:()=>kt,transform:()=>Et,transformSync:()=>Pt,version:()=>St});function je(e){let t=i=>{if(i===null)r.write8(0);else if(typeof i=="boolean")r.write8(1),r.write8(+i);else if(typeof i=="number")r.write8(2),r.write32(i|0);else if(typeof i=="string")r.write8(3),r.write(pe(i));else if(i instanceof Uint8Array)r.write8(4),r.write(i);else if(i instanceof Array){r.write8(5),r.write32(i.length);for(let u of i)t(u)}else{let u=Object.keys(i);r.write8(6),r.write32(u.length);for(let l of u)r.write(pe(l)),t(i[l])}},r=new Le;return r.write32(0),r.write32(e.id<<1|+!e.isRequest),t(e.value),Fe(r.buf,r.len-4,0),r.buf.subarray(0,r.len)}function _e(e){let t=()=>{switch(r.read8()){case 0:return null;case 1:return!!r.read8();case 2:return r.read32();case 3:return he(r.read());case 4:return r.read();case 5:{let c=r.read32(),s=[];for(let d=0;d<c;d++)s.push(t());return s}case 6:{let c=r.read32(),s={};for(let d=0;d<c;d++)s[he(r.read())]=t();return s}default:throw new Error("Invalid packet")}},r=new Le(e),i=r.read32(),u=(i&1)===0;i>>>=1;let l=t();if(r.ptr!==e.length)throw new Error("Invalid packet");return{id:i,isRequest:u,value:l}}var Le=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 r=new Uint8Array((this.len+t)*2);r.set(this.buf),this.buf=r}return this.len+=t,this.len-t}write8(t){let r=this._write(1);this.buf[r]=t}write32(t){let r=this._write(4);Fe(this.buf,t,r)}write(t){let r=this._write(4+t.length);Fe(this.buf,t.length,r),this.buf.set(t,r+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 Ue(this.buf,this._read(4))}read(){let t=this.read32(),r=new Uint8Array(t),i=this._read(r.length);return r.set(this.buf.subarray(i,i+t)),r}},pe,he;if(typeof TextEncoder!="undefined"&&typeof TextDecoder!="undefined"){let e=new TextEncoder,t=new TextDecoder;pe=r=>e.encode(r),he=r=>t.decode(r)}else if(typeof Buffer!="undefined")pe=e=>{let t=Buffer.from(e);return t instanceof Uint8Array||(t=new Uint8Array(t)),t},he=e=>{let{buffer:t,byteOffset:r,byteLength:i}=e;return Buffer.from(t,r,i).toString()};else throw new Error("No UTF-8 codec found");function Ue(e,t){return e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24}function Fe(e,t,r){e[r++]=t,e[r++]=t>>8,e[r++]=t>>16,e[r++]=t>>24}function Ve(e){if(e+="",e.indexOf(",")>=0)throw new Error(`Invalid target: ${e}`);return e}var Me=()=>null,I=e=>typeof e=="boolean"?null:"a boolean",gt=e=>typeof e=="boolean"||typeof e=="object"&&!Array.isArray(e)?null:"a boolean or an object",y=e=>typeof e=="string"?null:"a string",Ce=e=>e instanceof RegExp?null:"a RegExp object",Oe=e=>typeof e=="number"&&e===(e|0)?null:"an integer",qe=e=>typeof e=="function"?null:"a function",_=e=>Array.isArray(e)?null:"an array",me=e=>typeof e=="object"&&e!==null&&!Array.isArray(e)?null:"an object",mt=e=>typeof e=="object"&&e!==null?null:"an array or an object",Je=e=>typeof e=="object"&&!Array.isArray(e)?null:"an object or null",Ge=e=>typeof e=="string"||typeof e=="boolean"?null:"a string or a boolean",yt=e=>typeof e=="string"||typeof e=="object"&&e!==null&&!Array.isArray(e)?null:"a string or an object",ht=e=>typeof e=="string"||Array.isArray(e)?null:"a string or an array",bt=e=>typeof e=="string"||e instanceof Uint8Array?null:"a string or a Uint8Array";function n(e,t,r,i){let u=e[r];if(t[r+""]=!0,u===void 0)return;let l=i(u);if(l!==null)throw new Error(`"${r}" must be ${l}`);return u}function J(e,t,r){for(let i in e)if(!(i in t))throw new Error(`Invalid option ${r}: "${i}"`)}function Qe(e){let t=Object.create(null),r=n(e,t,"wasmURL",y),i=n(e,t,"worker",I);return J(e,t,"in startService() call"),{wasmURL:r,worker:i}}function Xe(e){let t;if(e!==void 0){t=Object.create(null);for(let r of Object.keys(e)){let i=e[r];if(typeof i=="string"||i===!1)t[r]=i;else throw new Error(`Expected ${JSON.stringify(r)} in mangle cache to map to either a string or false`)}}return t}function Pe(e,t,r,i,u){let l=n(t,r,"color",I),c=n(t,r,"logLevel",y),s=n(t,r,"logLimit",Oe);l!==void 0?e.push(`--color=${l}`):i&&e.push("--color=true"),e.push(`--log-level=${c||u}`),e.push(`--log-limit=${s||0}`)}function Ze(e,t,r){let i=n(t,r,"legalComments",y),u=n(t,r,"sourceRoot",y),l=n(t,r,"sourcesContent",I),c=n(t,r,"target",ht),s=n(t,r,"format",y),d=n(t,r,"globalName",y),O=n(t,r,"mangleProps",Ce),T=n(t,r,"reserveProps",Ce),L=n(t,r,"minify",I),x=n(t,r,"minifySyntax",I),S=n(t,r,"minifyWhitespace",I),ae=n(t,r,"minifyIdentifiers",I),re=n(t,r,"drop",_),le=n(t,r,"charset",y),ie=n(t,r,"treeShaking",I),ue=n(t,r,"ignoreAnnotations",I),fe=n(t,r,"jsx",y),ce=n(t,r,"jsxFactory",y),ye=n(t,r,"jsxFragment",y),se=n(t,r,"define",me),we=n(t,r,"pure",_),xe=n(t,r,"keepNames",I);if(i&&e.push(`--legal-comments=${i}`),u!==void 0&&e.push(`--source-root=${u}`),l!==void 0&&e.push(`--sources-content=${l}`),c&&(Array.isArray(c)?e.push(`--target=${Array.from(c).map(Ve).join(",")}`):e.push(`--target=${Ve(c)}`)),s&&e.push(`--format=${s}`),d&&e.push(`--global-name=${d}`),L&&e.push("--minify"),x&&e.push("--minify-syntax"),S&&e.push("--minify-whitespace"),ae&&e.push("--minify-identifiers"),le&&e.push(`--charset=${le}`),ie!==void 0&&e.push(`--tree-shaking=${ie}`),ue&&e.push("--ignore-annotations"),re)for(let te of re)e.push(`--drop:${te}`);if(O&&e.push(`--mangle-props=${O.source}`),T&&e.push(`--reserve-props=${T.source}`),fe&&e.push(`--jsx=${fe}`),ce&&e.push(`--jsx-factory=${ce}`),ye&&e.push(`--jsx-fragment=${ye}`),se)for(let te in se){if(te.indexOf("=")>=0)throw new Error(`Invalid define: ${te}`);e.push(`--define:${te}=${se[te]}`)}if(we)for(let te of we)e.push(`--pure:${te}`);xe&&e.push("--keep-names")}function wt(e,t,r,i,u){var w;let l=[],c=[],s=Object.create(null),d=null,O=null,T=null;Pe(l,t,s,r,i),Ze(l,t,s);let L=n(t,s,"sourcemap",Ge),x=n(t,s,"bundle",I),S=n(t,s,"watch",gt),ae=n(t,s,"splitting",I),re=n(t,s,"preserveSymlinks",I),le=n(t,s,"metafile",I),ie=n(t,s,"outfile",y),ue=n(t,s,"outdir",y),fe=n(t,s,"outbase",y),ce=n(t,s,"platform",y),ye=n(t,s,"tsconfig",y),se=n(t,s,"resolveExtensions",_),we=n(t,s,"nodePaths",_),xe=n(t,s,"mainFields",_),te=n(t,s,"conditions",_),m=n(t,s,"external",_),f=n(t,s,"loader",me),a=n(t,s,"outExtension",me),p=n(t,s,"publicPath",y),F=n(t,s,"entryNames",y),D=n(t,s,"chunkNames",y),C=n(t,s,"assetNames",y),E=n(t,s,"inject",_),B=n(t,s,"banner",me),P=n(t,s,"footer",me),R=n(t,s,"entryPoints",mt),U=n(t,s,"absWorkingDir",y),k=n(t,s,"stdin",me),A=(w=n(t,s,"write",I))!=null?w:u,q=n(t,s,"allowOverwrite",I),ee=n(t,s,"incremental",I)===!0,$=n(t,s,"mangleCache",me);if(s.plugins=!0,J(t,s,`in ${e}() call`),L&&l.push(`--sourcemap${L===!0?"":`=${L}`}`),x&&l.push("--bundle"),q&&l.push("--allow-overwrite"),S)if(l.push("--watch"),typeof S=="boolean")T={};else{let o=Object.create(null),v=n(S,o,"onRebuild",qe);J(S,o,`on "watch" in ${e}() call`),T={onRebuild:v}}if(ae&&l.push("--splitting"),re&&l.push("--preserve-symlinks"),le&&l.push("--metafile"),ie&&l.push(`--outfile=${ie}`),ue&&l.push(`--outdir=${ue}`),fe&&l.push(`--outbase=${fe}`),ce&&l.push(`--platform=${ce}`),ye&&l.push(`--tsconfig=${ye}`),se){let o=[];for(let v of se){if(v+="",v.indexOf(",")>=0)throw new Error(`Invalid resolve extension: ${v}`);o.push(v)}l.push(`--resolve-extensions=${o.join(",")}`)}if(p&&l.push(`--public-path=${p}`),F&&l.push(`--entry-names=${F}`),D&&l.push(`--chunk-names=${D}`),C&&l.push(`--asset-names=${C}`),xe){let o=[];for(let v of xe){if(v+="",v.indexOf(",")>=0)throw new Error(`Invalid main field: ${v}`);o.push(v)}l.push(`--main-fields=${o.join(",")}`)}if(te){let o=[];for(let v of te){if(v+="",v.indexOf(",")>=0)throw new Error(`Invalid condition: ${v}`);o.push(v)}l.push(`--conditions=${o.join(",")}`)}if(m)for(let o of m)l.push(`--external:${o}`);if(B)for(let o in B){if(o.indexOf("=")>=0)throw new Error(`Invalid banner file type: ${o}`);l.push(`--banner:${o}=${B[o]}`)}if(P)for(let o in P){if(o.indexOf("=")>=0)throw new Error(`Invalid footer file type: ${o}`);l.push(`--footer:${o}=${P[o]}`)}if(E)for(let o of E)l.push(`--inject:${o}`);if(f)for(let o in f){if(o.indexOf("=")>=0)throw new Error(`Invalid loader extension: ${o}`);l.push(`--loader:${o}=${f[o]}`)}if(a)for(let o in a){if(o.indexOf("=")>=0)throw new Error(`Invalid out extension: ${o}`);l.push(`--out-extension:${o}=${a[o]}`)}if(R)if(Array.isArray(R))for(let o of R)c.push(["",o+""]);else for(let[o,v]of Object.entries(R))c.push([o+"",v+""]);if(k){let o=Object.create(null),v=n(k,o,"contents",y),Y=n(k,o,"resolveDir",y),h=n(k,o,"sourcefile",y),g=n(k,o,"loader",y);J(k,o,'in "stdin" object'),h&&l.push(`--sourcefile=${h}`),g&&l.push(`--loader=${g}`),Y&&(O=Y+""),d=v?v+"":""}let b=[];if(we)for(let o of we)o+="",b.push(o);return{entries:c,flags:l,write:A,stdinContents:d,stdinResolveDir:O,absWorkingDir:U,incremental:ee,nodePaths:b,watch:T,mangleCache:Xe($)}}function vt(e,t,r,i){let u=[],l=Object.create(null);Pe(u,t,l,r,i),Ze(u,t,l);let c=n(t,l,"sourcemap",Ge),s=n(t,l,"tsconfigRaw",yt),d=n(t,l,"sourcefile",y),O=n(t,l,"loader",y),T=n(t,l,"banner",y),L=n(t,l,"footer",y),x=n(t,l,"mangleCache",me);return J(t,l,`in ${e}() call`),c&&u.push(`--sourcemap=${c===!0?"external":c}`),s&&u.push(`--tsconfig-raw=${typeof s=="string"?s:JSON.stringify(s)}`),d&&u.push(`--sourcefile=${d}`),O&&u.push(`--loader=${O}`),T&&u.push(`--banner=${T}`),L&&u.push(`--footer=${L}`),{flags:u,mangleCache:Xe(x)}}function et(e){let t=new Map,r=new Map,i=new Map,u=new Map,l=!1,c=0,s=0,d=new Uint8Array(16*1024),O=0,T=m=>{let f=O+m.length;if(f>d.length){let p=new Uint8Array(f*2);p.set(d),d=p}d.set(m,O),O+=m.length;let a=0;for(;a+4<=O;){let p=Ue(d,a);if(a+4+p>O)break;a+=4,le(d.subarray(a,a+p)),a+=p}a>0&&(d.copyWithin(0,a,O),O-=a)},L=()=>{l=!0;for(let m of t.values())m("The service was stopped",null);t.clear();for(let m of u.values())m.onWait("The service was stopped");u.clear();for(let m of i.values())try{m(new Error("The service was stopped"),null)}catch(f){console.error(f)}i.clear()},x=(m,f,a)=>{if(l)return a("The service is no longer running",null);let p=c++;t.set(p,(F,D)=>{try{a(F,D)}finally{m&&m.unref()}}),m&&m.ref(),e.writeToStdin(je({id:p,isRequest:!0,value:f}))},S=(m,f)=>{if(l)throw new Error("The service is no longer running");e.writeToStdin(je({id:m,isRequest:!1,value:f}))},ae=(m,f)=>de(this,null,function*(){try{switch(f.command){case"ping":{S(m,{});break}case"on-start":{let a=r.get(f.key);a?S(m,yield a(f)):S(m,{});break}case"on-resolve":{let a=r.get(f.key);a?S(m,yield a(f)):S(m,{});break}case"on-load":{let a=r.get(f.key);a?S(m,yield a(f)):S(m,{});break}case"serve-request":{let a=u.get(f.key);a&&a.onRequest&&a.onRequest(f.args),S(m,{});break}case"serve-wait":{let a=u.get(f.key);a&&a.onWait(f.error),S(m,{});break}case"watch-rebuild":{let a=i.get(f.key);try{a&&a(null,f.args)}catch(p){console.error(p)}S(m,{});break}default:throw new Error("Invalid command: "+f.command)}}catch(a){S(m,{errors:[ve(a,e,null,void 0,"")]})}}),re=!0,le=m=>{if(re){re=!1;let a=String.fromCharCode(...m);if(a!=="0.14.23")throw new Error(`Cannot start service: Host version "0.14.23" does not match binary version ${JSON.stringify(a)}`);return}let f=_e(m);if(f.isRequest)ae(f.id,f.value);else{let a=t.get(f.id);t.delete(f.id),f.value.error?a(f.value.error,{}):a(null,f.value)}},ie=(m,f,a,p,F)=>de(this,null,function*(){let D=[],C=[],E={},B={},P=0,R=0,U=[],k=!1;f=[...f];for(let $ of f){let b={};if(typeof $!="object")throw new Error(`Plugin at index ${R} must be an object`);let w=n($,b,"name",y);if(typeof w!="string"||w==="")throw new Error(`Plugin at index ${R} is missing a name`);try{let o=n($,b,"setup",qe);if(typeof o!="function")throw new Error("Plugin is missing a setup function");J($,b,`on plugin ${JSON.stringify(w)}`);let v={name:w,onResolve:[],onLoad:[]};R++;let h=o({initialOptions:m,resolve:(g,N={})=>{if(!k)throw new Error('Cannot call "resolve" before plugin setup has completed');if(typeof g!="string")throw new Error("The path to resolve must be a string");let M=Object.create(null),H=n(N,M,"pluginName",y),W=n(N,M,"importer",y),K=n(N,M,"namespace",y),X=n(N,M,"resolveDir",y),G=n(N,M,"kind",y),j=n(N,M,"pluginData",Me);return J(N,M,"in resolve() call"),new Promise((V,Q)=>{let z={command:"resolve",path:g,key:a,pluginName:w};H!=null&&(z.pluginName=H),W!=null&&(z.importer=W),K!=null&&(z.namespace=K),X!=null&&(z.resolveDir=X),G!=null&&(z.kind=G),j!=null&&(z.pluginData=p.store(j)),x(F,z,(oe,Z)=>{oe!==null?Q(new Error(oe)):V({errors:ge(Z.errors,p),warnings:ge(Z.warnings,p),path:Z.path,external:Z.external,sideEffects:Z.sideEffects,namespace:Z.namespace,suffix:Z.suffix,pluginData:p.load(Z.pluginData)})})})},onStart(g){let N='This error came from the "onStart" callback registered here:',M=Ee(new Error(N),e,"onStart");D.push({name:w,callback:g,note:M})},onEnd(g){let N='This error came from the "onEnd" callback registered here:',M=Ee(new Error(N),e,"onEnd");C.push({name:w,callback:g,note:M})},onResolve(g,N){let M='This error came from the "onResolve" callback registered here:',H=Ee(new Error(M),e,"onResolve"),W={},K=n(g,W,"filter",Ce),X=n(g,W,"namespace",y);if(J(g,W,`in onResolve() call for plugin ${JSON.stringify(w)}`),K==null)throw new Error("onResolve() call is missing a filter");let G=P++;E[G]={name:w,callback:N,note:H},v.onResolve.push({id:G,filter:K.source,namespace:X||""})},onLoad(g,N){let M='This error came from the "onLoad" callback registered here:',H=Ee(new Error(M),e,"onLoad"),W={},K=n(g,W,"filter",Ce),X=n(g,W,"namespace",y);if(J(g,W,`in onLoad() call for plugin ${JSON.stringify(w)}`),K==null)throw new Error("onLoad() call is missing a filter");let G=P++;B[G]={name:w,callback:N,note:H},v.onLoad.push({id:G,filter:K.source,namespace:X||""})},esbuild:e.esbuild});h&&(yield h),U.push(v)}catch(o){return{ok:!1,error:o,pluginName:w}}}let A=$=>de(this,null,function*(){switch($.command){case"on-start":{let b={errors:[],warnings:[]};return yield Promise.all(D.map(Y=>de(this,[Y],function*({name:w,callback:o,note:v}){try{let h=yield o();if(h!=null){if(typeof h!="object")throw new Error(`Expected onStart() callback in plugin ${JSON.stringify(w)} to return an object`);let g={},N=n(h,g,"errors",_),M=n(h,g,"warnings",_);J(h,g,`from onStart() callback in plugin ${JSON.stringify(w)}`),N!=null&&b.errors.push(...be(N,"errors",p,w)),M!=null&&b.warnings.push(...be(M,"warnings",p,w))}}catch(h){b.errors.push(ve(h,e,p,v&&v(),w))}}))),b}case"on-resolve":{let b={},w="",o,v;for(let Y of $.ids)try{({name:w,callback:o,note:v}=E[Y]);let h=yield o({path:$.path,importer:$.importer,namespace:$.namespace,resolveDir:$.resolveDir,kind:$.kind,pluginData:p.load($.pluginData)});if(h!=null){if(typeof h!="object")throw new Error(`Expected onResolve() callback in plugin ${JSON.stringify(w)} to return an object`);let g={},N=n(h,g,"pluginName",y),M=n(h,g,"path",y),H=n(h,g,"namespace",y),W=n(h,g,"suffix",y),K=n(h,g,"external",I),X=n(h,g,"sideEffects",I),G=n(h,g,"pluginData",Me),j=n(h,g,"errors",_),V=n(h,g,"warnings",_),Q=n(h,g,"watchFiles",_),z=n(h,g,"watchDirs",_);J(h,g,`from onResolve() callback in plugin ${JSON.stringify(w)}`),b.id=Y,N!=null&&(b.pluginName=N),M!=null&&(b.path=M),H!=null&&(b.namespace=H),W!=null&&(b.suffix=W),K!=null&&(b.external=K),X!=null&&(b.sideEffects=X),G!=null&&(b.pluginData=p.store(G)),j!=null&&(b.errors=be(j,"errors",p,w)),V!=null&&(b.warnings=be(V,"warnings",p,w)),Q!=null&&(b.watchFiles=$e(Q,"watchFiles")),z!=null&&(b.watchDirs=$e(z,"watchDirs"));break}}catch(h){return{id:Y,errors:[ve(h,e,p,v&&v(),w)]}}return b}case"on-load":{let b={},w="",o,v;for(let Y of $.ids)try{({name:w,callback:o,note:v}=B[Y]);let h=yield o({path:$.path,namespace:$.namespace,suffix:$.suffix,pluginData:p.load($.pluginData)});if(h!=null){if(typeof h!="object")throw new Error(`Expected onLoad() callback in plugin ${JSON.stringify(w)} to return an object`);let g={},N=n(h,g,"pluginName",y),M=n(h,g,"contents",bt),H=n(h,g,"resolveDir",y),W=n(h,g,"pluginData",Me),K=n(h,g,"loader",y),X=n(h,g,"errors",_),G=n(h,g,"warnings",_),j=n(h,g,"watchFiles",_),V=n(h,g,"watchDirs",_);J(h,g,`from onLoad() callback in plugin ${JSON.stringify(w)}`),b.id=Y,N!=null&&(b.pluginName=N),M instanceof Uint8Array?b.contents=M:M!=null&&(b.contents=pe(M)),H!=null&&(b.resolveDir=H),W!=null&&(b.pluginData=p.store(W)),K!=null&&(b.loader=K),X!=null&&(b.errors=be(X,"errors",p,w)),G!=null&&(b.warnings=be(G,"warnings",p,w)),j!=null&&(b.watchFiles=$e(j,"watchFiles")),V!=null&&(b.watchDirs=$e(V,"watchDirs"));break}}catch(h){return{id:Y,errors:[ve(h,e,p,v&&v(),w)]}}return b}default:throw new Error("Invalid command: "+$.command)}}),q=($,b,w)=>w();C.length>0&&(q=($,b,w)=>{(()=>de(this,null,function*(){for(let{name:o,callback:v,note:Y}of C)try{yield v($)}catch(h){$.errors.push(yield new Promise(g=>b(h,o,Y&&Y(),g)))}}))().then(w)}),k=!0;let ee=0;return{ok:!0,requestPlugins:U,runOnEndCallbacks:q,pluginRefs:{ref(){++ee===1&&r.set(a,A)},unref(){--ee===0&&r.delete(a)}}}}),ue=(m,f,a,p)=>{let F={},D=n(f,F,"port",Oe),C=n(f,F,"host",y),E=n(f,F,"servedir",y),B=n(f,F,"onRequest",qe),P,R=new Promise((U,k)=>{P=A=>{u.delete(p),A!==null?k(new Error(A)):U()}});return a.serve={},J(f,F,"in serve() call"),D!==void 0&&(a.serve.port=D),C!==void 0&&(a.serve.host=C),E!==void 0&&(a.serve.servedir=E),u.set(p,{onRequest:B,onWait:P}),{wait:R,stop(){x(m,{command:"serve-stop",key:p},()=>{})}}},fe="warning",ce="silent",ye=m=>{let f=s++,a=Ye(),p,{refs:F,options:D,isTTY:C,callback:E}=m;if(typeof D=="object"){let R=D.plugins;if(R!==void 0){if(!Array.isArray(R))throw new Error('"plugins" must be an array');p=R}}let B=(R,U,k,A)=>{let q=[];try{Pe(q,D,{},C,fe)}catch($){}let ee=ve(R,e,a,k,U);x(F,{command:"error",flags:q,error:ee},()=>{ee.detail=a.load(ee.detail),A(ee)})},P=(R,U)=>{B(R,U,void 0,k=>{E(Re("Build failed",[k],[]),null)})};if(p&&p.length>0){if(e.isSync)return P(new Error("Cannot use plugins in synchronous API calls"),"");ie(D,p,f,a,F).then(R=>{if(!R.ok)P(R.error,R.pluginName);else try{se(Ne(Ae({},m),{key:f,details:a,logPluginError:B,requestPlugins:R.requestPlugins,runOnEndCallbacks:R.runOnEndCallbacks,pluginRefs:R.pluginRefs}))}catch(U){P(U,"")}},R=>P(R,""))}else try{se(Ne(Ae({},m),{key:f,details:a,logPluginError:B,requestPlugins:null,runOnEndCallbacks:(R,U,k)=>k(),pluginRefs:null}))}catch(R){P(R,"")}},se=({callName:m,refs:f,serveOptions:a,options:p,isTTY:F,defaultWD:D,callback:C,key:E,details:B,logPluginError:P,requestPlugins:R,runOnEndCallbacks:U,pluginRefs:k})=>{let A={ref(){k&&k.ref(),f&&f.ref()},unref(){k&&k.unref(),f&&f.unref()}},q=!e.isBrowser,{entries:ee,flags:$,write:b,stdinContents:w,stdinResolveDir:o,absWorkingDir:v,incremental:Y,nodePaths:h,watch:g,mangleCache:N}=wt(m,p,F,fe,q),M={command:"build",key:E,entries:ee,flags:$,write:b,stdinContents:w,stdinResolveDir:o,absWorkingDir:v||D,incremental:Y,nodePaths:h};R&&(M.plugins=R),N&&(M.mangleCache=N);let H=a&&ue(A,a,M,E),W,K,X=(j,V)=>{j.outputFiles&&(V.outputFiles=j.outputFiles.map(Rt)),j.metafile&&(V.metafile=JSON.parse(j.metafile)),j.mangleCache&&(V.mangleCache=j.mangleCache),j.writeToStdout!==void 0&&console.log(he(j.writeToStdout).replace(/\n$/,""))},G=(j,V)=>{let Q={errors:ge(j.errors,B),warnings:ge(j.warnings,B)};X(j,Q),U(Q,P,()=>{if(Q.errors.length>0)return V(Re("Build failed",Q.errors,Q.warnings),null);if(j.rebuild){if(!W){let z=!1;W=()=>new Promise((oe,Z)=>{if(z||l)throw new Error("Cannot rebuild");x(A,{command:"rebuild",key:E},(ne,rt)=>{if(ne)return V(Re("Build failed",[{pluginName:"",text:ne,location:null,notes:[],detail:void 0}],[]),null);G(rt,(De,nt)=>{De?Z(De):oe(nt)})})}),A.ref(),W.dispose=()=>{z||(z=!0,x(A,{command:"rebuild-dispose",key:E},()=>{}),A.unref())}}Q.rebuild=W}if(j.watch){if(!K){let z=!1;A.ref(),K=()=>{z||(z=!0,i.delete(E),x(A,{command:"watch-stop",key:E},()=>{}),A.unref())},g&&i.set(E,(oe,Z)=>{if(oe){g.onRebuild&&g.onRebuild(oe,null);return}let ne={errors:ge(Z.errors,B),warnings:ge(Z.warnings,B)};X(Z,ne),U(ne,P,()=>{if(ne.errors.length>0){g.onRebuild&&g.onRebuild(Re("Build failed",ne.errors,ne.warnings),null);return}Z.rebuildID!==void 0&&(ne.rebuild=W),ne.stop=K,g.onRebuild&&g.onRebuild(null,ne)})})}Q.stop=K}V(null,Q)})};if(b&&e.isBrowser)throw new Error('Cannot enable "write" in the browser');if(Y&&e.isSync)throw new Error('Cannot use "incremental" with a synchronous build');if(g&&e.isSync)throw new Error('Cannot use "watch" with a synchronous build');x(A,M,(j,V)=>{if(j)return C(new Error(j),null);if(H){let Q=V,z=!1;A.ref();let oe={port:Q.port,host:Q.host,wait:H.wait,stop(){z||(z=!0,H.stop(),A.unref())}};return A.ref(),H.wait.then(A.unref,A.unref),C(null,oe)}return G(V,C)})};return{readFromStdout:T,afterClose:L,service:{buildOrServe:ye,transform:({callName:m,refs:f,input:a,options:p,isTTY:F,fs:D,callback:C})=>{let E=Ye(),B=P=>{try{if(typeof a!="string")throw new Error('The input to "transform" must be a string');let{flags:R,mangleCache:U}=vt(m,p,F,ce),k={command:"transform",flags:R,inputFS:P!==null,input:P!==null?P:a};U&&(k.mangleCache=U),x(f,k,(A,q)=>{if(A)return C(new Error(A),null);let ee=ge(q.errors,E),$=ge(q.warnings,E),b=1,w=()=>{if(--b===0){let o={warnings:$,code:q.code,map:q.map};q.mangleCache&&(o.mangleCache=q==null?void 0:q.mangleCache),C(null,o)}};if(ee.length>0)return C(Re("Transform failed",ee,$),null);q.codeFS&&(b++,D.readFile(q.code,(o,v)=>{o!==null?C(o,null):(q.code=v,w())})),q.mapFS&&(b++,D.readFile(q.map,(o,v)=>{o!==null?C(o,null):(q.map=v,w())})),w()})}catch(R){let U=[];try{Pe(U,p,{},F,ce)}catch(A){}let k=ve(R,e,E,void 0,"");x(f,{command:"error",flags:U,error:k},()=>{k.detail=E.load(k.detail),C(Re("Transform failed",[k],[]),null)})}};if(typeof a=="string"&&a.length>1024*1024){let P=B;B=()=>D.writeFile(a,P)}B(null)},formatMessages:({callName:m,refs:f,messages:a,options:p,callback:F})=>{let D=be(a,"messages",null,"");if(!p)throw new Error(`Missing second argument in ${m}() call`);let C={},E=n(p,C,"kind",y),B=n(p,C,"color",I),P=n(p,C,"terminalWidth",Oe);if(J(p,C,`in ${m}() call`),E===void 0)throw new Error(`Missing "kind" in ${m}() call`);if(E!=="error"&&E!=="warning")throw new Error(`Expected "kind" to be "error" or "warning" in ${m}() call`);let R={command:"format-msgs",messages:D,isWarning:E==="warning"};B!==void 0&&(R.color=B),P!==void 0&&(R.terminalWidth=P),x(f,R,(U,k)=>{if(U)return F(new Error(U),null);F(null,k.messages)})},analyzeMetafile:({callName:m,refs:f,metafile:a,options:p,callback:F})=>{p===void 0&&(p={});let D={},C=n(p,D,"color",I),E=n(p,D,"verbose",I);J(p,D,`in ${m}() call`);let B={command:"analyze-metafile",metafile:a};C!==void 0&&(B.color=C),E!==void 0&&(B.verbose=E),x(f,B,(P,R)=>{if(P)return F(new Error(P),null);F(null,R.result)})}}}}function Ye(){let e=new Map,t=0;return{load(r){return e.get(r)},store(r){if(r===void 0)return-1;let i=t++;return e.set(i,r),i}}}function Ee(e,t,r){let i,u=!1;return()=>{if(u)return i;u=!0;try{let l=(e.stack+"").split(`
3
- `);l.splice(1,1);let c=tt(t,l,r);if(c)return i={text:e.message,location:c},i}catch(l){}}}function ve(e,t,r,i,u){let l="Internal error",c=null;try{l=(e&&e.message||e)+""}catch(s){}try{c=tt(t,(e.stack+"").split(`
4
- `),"")}catch(s){}return{pluginName:u,text:l,location:c,notes:i?[i]:[],detail:r?r.store(e):-1}}function tt(e,t,r){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 c=/^(?:new |async )?\S+ \((.*)\)$/.exec(l);if(c){l=c[1];continue}if(c=/^eval at \S+ \((.*)\)(?:, \S+:\d+:\d+)?$/.exec(l),c){l=c[1];continue}if(c=/^(\S+):(\d+):(\d+)$/.exec(l),c){let s;try{s=e.readFileSync(c[1],"utf8")}catch(L){break}let d=s.split(/\r\n|\r|\n|\u2028|\u2029/)[+c[2]-1]||"",O=+c[3]-1,T=d.slice(O,O+r.length)===r?r.length:0;return{file:c[1],namespace:"file",line:+c[2],column:pe(d.slice(0,O)).length,length:pe(d.slice(O,O+T)).length,lineText:d+`
2
+ var Ee=Object.defineProperty,lt=Object.defineProperties,it=Object.getOwnPropertyDescriptor,st=Object.getOwnPropertyDescriptors,ot=Object.getOwnPropertyNames,Ie=Object.getOwnPropertySymbols;var Ke=Object.prototype.hasOwnProperty,at=Object.prototype.propertyIsEnumerable;var ze=(e,t,r)=>t in e?Ee(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Ne=(e,t)=>{for(var r in t||(t={}))Ke.call(t,r)&&ze(e,r,t[r]);if(Ie)for(var r of Ie(t))at.call(t,r)&&ze(e,r,t[r]);return e},Fe=(e,t)=>lt(e,st(t));var ut=(e,t)=>{for(var r in t)Ee(e,r,{get:t[r],enumerable:!0})},ft=(e,t,r,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let u of ot(t))!Ke.call(e,u)&&u!==r&&Ee(e,u,{get:()=>t[u],enumerable:!(s=it(t,u))||s.enumerable});return e};var ct=e=>ft(Ee({},"__esModule",{value:!0}),e);var fe=(e,t,r)=>new Promise((s,u)=>{var i=m=>{try{l(r.next(m))}catch(O){u(O)}},c=m=>{try{l(r.throw(m))}catch(O){u(O)}},l=m=>m.done?s(m.value):Promise.resolve(m.value).then(i,c);l((r=r.apply(e,t)).next())});var Te={};ut(Te,{analyzeMetafile:()=>$t,analyzeMetafileSync:()=>Bt,build:()=>xt,buildSync:()=>Ct,default:()=>Nt,formatMessages:()=>Mt,formatMessagesSync:()=>At,initialize:()=>Tt,serve:()=>Et,transform:()=>kt,transformSync:()=>Pt,version:()=>St});module.exports=ct(Te);function Le(e){let t=s=>{if(s===null)r.write8(0);else if(typeof s=="boolean")r.write8(1),r.write8(+s);else if(typeof s=="number")r.write8(2),r.write32(s|0);else if(typeof s=="string")r.write8(3),r.write(ce(s));else if(s instanceof Uint8Array)r.write8(4),r.write(s);else if(s instanceof Array){r.write8(5),r.write32(s.length);for(let u of s)t(u)}else{let u=Object.keys(s);r.write8(6),r.write32(u.length);for(let i of u)r.write(ce(i)),t(s[i])}},r=new ke;return r.write32(0),r.write32(e.id<<1|+!e.isRequest),t(e.value),je(r.buf,r.len-4,0),r.buf.subarray(0,r.len)}function _e(e){let t=()=>{switch(r.read8()){case 0:return null;case 1:return!!r.read8();case 2:return r.read32();case 3:return he(r.read());case 4:return r.read();case 5:{let c=r.read32(),l=[];for(let m=0;m<c;m++)l.push(t());return l}case 6:{let c=r.read32(),l={};for(let m=0;m<c;m++)l[he(r.read())]=t();return l}default:throw new Error("Invalid packet")}},r=new ke(e),s=r.read32(),u=(s&1)===0;s>>>=1;let i=t();if(r.ptr!==e.length)throw new Error("Invalid packet");return{id:s,isRequest:u,value:i}}var ke=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 r=new Uint8Array((this.len+t)*2);r.set(this.buf),this.buf=r}return this.len+=t,this.len-t}write8(t){let r=this._write(1);this.buf[r]=t}write32(t){let r=this._write(4);je(this.buf,t,r)}write(t){let r=this._write(4+t.length);je(this.buf,t.length,r),this.buf.set(t,r+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 Ue(this.buf,this._read(4))}read(){let t=this.read32(),r=new Uint8Array(t),s=this._read(r.length);return r.set(this.buf.subarray(s,s+t)),r}},ce,he;if(typeof TextEncoder!="undefined"&&typeof TextDecoder!="undefined"){let e=new TextEncoder,t=new TextDecoder;ce=r=>e.encode(r),he=r=>t.decode(r)}else if(typeof Buffer!="undefined")ce=e=>{let t=Buffer.from(e);return t instanceof Uint8Array||(t=new Uint8Array(t)),t},he=e=>{let{buffer:t,byteOffset:r,byteLength:s}=e;return Buffer.from(t,r,s).toString()};else throw new Error("No UTF-8 codec found");function Ue(e,t){return e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24}function je(e,t,r){e[r++]=t,e[r++]=t>>8,e[r++]=t>>16,e[r++]=t>>24}function Ve(e){if(e+="",e.indexOf(",")>=0)throw new Error(`Invalid target: ${e}`);return e}var Ce=()=>null,q=e=>typeof e=="boolean"?null:"a boolean",pt=e=>typeof e=="boolean"||typeof e=="object"&&!Array.isArray(e)?null:"a boolean or an object",y=e=>typeof e=="string"?null:"a string",Pe=e=>e instanceof RegExp?null:"a RegExp object",Oe=e=>typeof e=="number"&&e===(e|0)?null:"an integer",We=e=>typeof e=="function"?null:"a function",_=e=>Array.isArray(e)?null:"an array",pe=e=>typeof e=="object"&&e!==null&&!Array.isArray(e)?null:"an object",gt=e=>e instanceof WebAssembly.Module?null:"a WebAssembly.Module",mt=e=>typeof e=="object"&&e!==null?null:"an array or an object",Je=e=>typeof e=="object"&&!Array.isArray(e)?null:"an object or null",He=e=>typeof e=="string"||typeof e=="boolean"?null:"a string or a boolean",yt=e=>typeof e=="string"||typeof e=="object"&&e!==null&&!Array.isArray(e)?null:"a string or an object",ht=e=>typeof e=="string"||Array.isArray(e)?null:"a string or an array",bt=e=>typeof e=="string"||e instanceof Uint8Array?null:"a string or a Uint8Array";function n(e,t,r,s){let u=e[r];if(t[r+""]=!0,u===void 0)return;let i=s(u);if(i!==null)throw new Error(`"${r}" must be ${i}`);return u}function J(e,t,r){for(let s in e)if(!(s in t))throw new Error(`Invalid option ${r}: "${s}"`)}function Ge(e){let t=Object.create(null),r=n(e,t,"wasmURL",y),s=n(e,t,"wasmModule",gt),u=n(e,t,"worker",q);return J(e,t,"in initialize() call"),{wasmURL:r,wasmModule:s,worker:u}}function Xe(e){let t;if(e!==void 0){t=Object.create(null);for(let r of Object.keys(e)){let s=e[r];if(typeof s=="string"||s===!1)t[r]=s;else throw new Error(`Expected ${JSON.stringify(r)} in mangle cache to map to either a string or false`)}}return t}function Ae(e,t,r,s,u){let i=n(t,r,"color",q),c=n(t,r,"logLevel",y),l=n(t,r,"logLimit",Oe);i!==void 0?e.push(`--color=${i}`):s&&e.push("--color=true"),e.push(`--log-level=${c||u}`),e.push(`--log-limit=${l||0}`)}function Ze(e,t,r){let s=n(t,r,"legalComments",y),u=n(t,r,"sourceRoot",y),i=n(t,r,"sourcesContent",q),c=n(t,r,"target",ht),l=n(t,r,"format",y),m=n(t,r,"globalName",y),O=n(t,r,"mangleProps",Pe),N=n(t,r,"reserveProps",Pe),M=n(t,r,"mangleQuoted",q),P=n(t,r,"minify",q),W=n(t,r,"minifySyntax",q),oe=n(t,r,"minifyWhitespace",q),re=n(t,r,"minifyIdentifiers",q),ne=n(t,r,"drop",_),le=n(t,r,"charset",y),ie=n(t,r,"treeShaking",q),ge=n(t,r,"ignoreAnnotations",q),ae=n(t,r,"jsx",y),me=n(t,r,"jsxFactory",y),ue=n(t,r,"jsxFragment",y),ye=n(t,r,"define",pe),we=n(t,r,"pure",_),xe=n(t,r,"keepNames",q);if(s&&e.push(`--legal-comments=${s}`),u!==void 0&&e.push(`--source-root=${u}`),i!==void 0&&e.push(`--sources-content=${i}`),c&&(Array.isArray(c)?e.push(`--target=${Array.from(c).map(Ve).join(",")}`):e.push(`--target=${Ve(c)}`)),l&&e.push(`--format=${l}`),m&&e.push(`--global-name=${m}`),P&&e.push("--minify"),W&&e.push("--minify-syntax"),oe&&e.push("--minify-whitespace"),re&&e.push("--minify-identifiers"),le&&e.push(`--charset=${le}`),ie!==void 0&&e.push(`--tree-shaking=${ie}`),ge&&e.push("--ignore-annotations"),ne)for(let d of ne)e.push(`--drop:${d}`);if(O&&e.push(`--mangle-props=${O.source}`),N&&e.push(`--reserve-props=${N.source}`),M!==void 0&&e.push(`--mangle-quoted=${M}`),ae&&e.push(`--jsx=${ae}`),me&&e.push(`--jsx-factory=${me}`),ue&&e.push(`--jsx-fragment=${ue}`),ye)for(let d in ye){if(d.indexOf("=")>=0)throw new Error(`Invalid define: ${d}`);e.push(`--define:${d}=${ye[d]}`)}if(we)for(let d of we)e.push(`--pure:${d}`);xe&&e.push("--keep-names")}function wt(e,t,r,s,u){var w;let i=[],c=[],l=Object.create(null),m=null,O=null,N=null;Ae(i,t,l,r,s),Ze(i,t,l);let M=n(t,l,"sourcemap",He),P=n(t,l,"bundle",q),W=n(t,l,"watch",pt),oe=n(t,l,"splitting",q),re=n(t,l,"preserveSymlinks",q),ne=n(t,l,"metafile",q),le=n(t,l,"outfile",y),ie=n(t,l,"outdir",y),ge=n(t,l,"outbase",y),ae=n(t,l,"platform",y),me=n(t,l,"tsconfig",y),ue=n(t,l,"resolveExtensions",_),ye=n(t,l,"nodePaths",_),we=n(t,l,"mainFields",_),xe=n(t,l,"conditions",_),d=n(t,l,"external",_),f=n(t,l,"loader",pe),o=n(t,l,"outExtension",pe),p=n(t,l,"publicPath",y),F=n(t,l,"entryNames",y),B=n(t,l,"chunkNames",y),$=n(t,l,"assetNames",y),x=n(t,l,"inject",_),A=n(t,l,"banner",pe),C=n(t,l,"footer",pe),R=n(t,l,"entryPoints",mt),L=n(t,l,"absWorkingDir",y),S=n(t,l,"stdin",pe),T=(w=n(t,l,"write",q))!=null?w:u,U=n(t,l,"allowOverwrite",q),ee=n(t,l,"incremental",q)===!0,E=n(t,l,"mangleCache",pe);if(l.plugins=!0,J(t,l,`in ${e}() call`),M&&i.push(`--sourcemap${M===!0?"":`=${M}`}`),P&&i.push("--bundle"),U&&i.push("--allow-overwrite"),W)if(i.push("--watch"),typeof W=="boolean")N={};else{let a=Object.create(null),v=n(W,a,"onRebuild",We);J(W,a,`on "watch" in ${e}() call`),N={onRebuild:v}}if(oe&&i.push("--splitting"),re&&i.push("--preserve-symlinks"),ne&&i.push("--metafile"),le&&i.push(`--outfile=${le}`),ie&&i.push(`--outdir=${ie}`),ge&&i.push(`--outbase=${ge}`),ae&&i.push(`--platform=${ae}`),me&&i.push(`--tsconfig=${me}`),ue){let a=[];for(let v of ue){if(v+="",v.indexOf(",")>=0)throw new Error(`Invalid resolve extension: ${v}`);a.push(v)}i.push(`--resolve-extensions=${a.join(",")}`)}if(p&&i.push(`--public-path=${p}`),F&&i.push(`--entry-names=${F}`),B&&i.push(`--chunk-names=${B}`),$&&i.push(`--asset-names=${$}`),we){let a=[];for(let v of we){if(v+="",v.indexOf(",")>=0)throw new Error(`Invalid main field: ${v}`);a.push(v)}i.push(`--main-fields=${a.join(",")}`)}if(xe){let a=[];for(let v of xe){if(v+="",v.indexOf(",")>=0)throw new Error(`Invalid condition: ${v}`);a.push(v)}i.push(`--conditions=${a.join(",")}`)}if(d)for(let a of d)i.push(`--external:${a}`);if(A)for(let a in A){if(a.indexOf("=")>=0)throw new Error(`Invalid banner file type: ${a}`);i.push(`--banner:${a}=${A[a]}`)}if(C)for(let a in C){if(a.indexOf("=")>=0)throw new Error(`Invalid footer file type: ${a}`);i.push(`--footer:${a}=${C[a]}`)}if(x)for(let a of x)i.push(`--inject:${a}`);if(f)for(let a in f){if(a.indexOf("=")>=0)throw new Error(`Invalid loader extension: ${a}`);i.push(`--loader:${a}=${f[a]}`)}if(o)for(let a in o){if(a.indexOf("=")>=0)throw new Error(`Invalid out extension: ${a}`);i.push(`--out-extension:${a}=${o[a]}`)}if(R)if(Array.isArray(R))for(let a of R)c.push(["",a+""]);else for(let[a,v]of Object.entries(R))c.push([a+"",v+""]);if(S){let a=Object.create(null),v=n(S,a,"contents",y),Y=n(S,a,"resolveDir",y),h=n(S,a,"sourcefile",y),g=n(S,a,"loader",y);J(S,a,'in "stdin" object'),h&&i.push(`--sourcefile=${h}`),g&&i.push(`--loader=${g}`),Y&&(O=Y+""),m=v?v+"":""}let b=[];if(ye)for(let a of ye)a+="",b.push(a);return{entries:c,flags:i,write:T,stdinContents:m,stdinResolveDir:O,absWorkingDir:L,incremental:ee,nodePaths:b,watch:N,mangleCache:Xe(E)}}function vt(e,t,r,s){let u=[],i=Object.create(null);Ae(u,t,i,r,s),Ze(u,t,i);let c=n(t,i,"sourcemap",He),l=n(t,i,"tsconfigRaw",yt),m=n(t,i,"sourcefile",y),O=n(t,i,"loader",y),N=n(t,i,"banner",y),M=n(t,i,"footer",y),P=n(t,i,"mangleCache",pe);return J(t,i,`in ${e}() call`),c&&u.push(`--sourcemap=${c===!0?"external":c}`),l&&u.push(`--tsconfig-raw=${typeof l=="string"?l:JSON.stringify(l)}`),m&&u.push(`--sourcefile=${m}`),O&&u.push(`--loader=${O}`),N&&u.push(`--banner=${N}`),M&&u.push(`--footer=${M}`),{flags:u,mangleCache:Xe(P)}}function et(e){let t=new Map,r=new Map,s=new Map,u=new Map,i=null,c=0,l=0,m=new Uint8Array(16*1024),O=0,N=d=>{let f=O+d.length;if(f>m.length){let p=new Uint8Array(f*2);p.set(m),m=p}m.set(d,O),O+=d.length;let o=0;for(;o+4<=O;){let p=Ue(m,o);if(o+4+p>O)break;o+=4,ne(m.subarray(o,o+p)),o+=p}o>0&&(m.copyWithin(0,o,O),O-=o)},M=d=>{i={reason:d?": "+(d.message||d):""};let f="The service was stopped"+i.reason;for(let o of t.values())o(f,null);t.clear();for(let o of u.values())o.onWait(f);u.clear();for(let o of s.values())try{o(new Error(f),null)}catch(p){console.error(p)}s.clear()},P=(d,f,o)=>{if(i)return o("The service is no longer running"+i.reason,null);let p=c++;t.set(p,(F,B)=>{try{o(F,B)}finally{d&&d.unref()}}),d&&d.ref(),e.writeToStdin(Le({id:p,isRequest:!0,value:f}))},W=(d,f)=>{if(i)throw new Error("The service is no longer running"+i.reason);e.writeToStdin(Le({id:d,isRequest:!1,value:f}))},oe=(d,f)=>fe(this,null,function*(){try{switch(f.command){case"ping":{W(d,{});break}case"on-start":{let o=r.get(f.key);o?W(d,yield o(f)):W(d,{});break}case"on-resolve":{let o=r.get(f.key);o?W(d,yield o(f)):W(d,{});break}case"on-load":{let o=r.get(f.key);o?W(d,yield o(f)):W(d,{});break}case"serve-request":{let o=u.get(f.key);o&&o.onRequest&&o.onRequest(f.args),W(d,{});break}case"serve-wait":{let o=u.get(f.key);o&&o.onWait(f.error),W(d,{});break}case"watch-rebuild":{let o=s.get(f.key);try{o&&o(null,f.args)}catch(p){console.error(p)}W(d,{});break}default:throw new Error("Invalid command: "+f.command)}}catch(o){W(d,{errors:[ve(o,e,null,void 0,"")]})}}),re=!0,ne=d=>{if(re){re=!1;let o=String.fromCharCode(...d);if(o!=="0.14.36")throw new Error(`Cannot start service: Host version "0.14.36" does not match binary version ${JSON.stringify(o)}`);return}let f=_e(d);if(f.isRequest)oe(f.id,f.value);else{let o=t.get(f.id);t.delete(f.id),f.value.error?o(f.value.error,{}):o(null,f.value)}},le=(d,f,o,p,F)=>fe(this,null,function*(){let B=[],$=[],x={},A={},C=0,R=0,L=[],S=!1;f=[...f];for(let E of f){let b={};if(typeof E!="object")throw new Error(`Plugin at index ${R} must be an object`);let w=n(E,b,"name",y);if(typeof w!="string"||w==="")throw new Error(`Plugin at index ${R} is missing a name`);try{let a=n(E,b,"setup",We);if(typeof a!="function")throw new Error("Plugin is missing a setup function");J(E,b,`on plugin ${JSON.stringify(w)}`);let v={name:w,onResolve:[],onLoad:[]};R++;let h=a({initialOptions:d,resolve:(g,D={})=>{if(!S)throw new Error('Cannot call "resolve" before plugin setup has completed');if(typeof g!="string")throw new Error("The path to resolve must be a string");let k=Object.create(null),Q=n(D,k,"pluginName",y),I=n(D,k,"importer",y),K=n(D,k,"namespace",y),X=n(D,k,"resolveDir",y),H=n(D,k,"kind",y),j=n(D,k,"pluginData",Ce);return J(D,k,"in resolve() call"),new Promise((V,G)=>{let z={command:"resolve",path:g,key:o,pluginName:w};Q!=null&&(z.pluginName=Q),I!=null&&(z.importer=I),K!=null&&(z.namespace=K),X!=null&&(z.resolveDir=X),H!=null&&(z.kind=H),j!=null&&(z.pluginData=p.store(j)),P(F,z,(se,Z)=>{se!==null?G(new Error(se)):V({errors:de(Z.errors,p),warnings:de(Z.warnings,p),path:Z.path,external:Z.external,sideEffects:Z.sideEffects,namespace:Z.namespace,suffix:Z.suffix,pluginData:p.load(Z.pluginData)})})})},onStart(g){let D='This error came from the "onStart" callback registered here:',k=Me(new Error(D),e,"onStart");B.push({name:w,callback:g,note:k})},onEnd(g){let D='This error came from the "onEnd" callback registered here:',k=Me(new Error(D),e,"onEnd");$.push({name:w,callback:g,note:k})},onResolve(g,D){let k='This error came from the "onResolve" callback registered here:',Q=Me(new Error(k),e,"onResolve"),I={},K=n(g,I,"filter",Pe),X=n(g,I,"namespace",y);if(J(g,I,`in onResolve() call for plugin ${JSON.stringify(w)}`),K==null)throw new Error("onResolve() call is missing a filter");let H=C++;x[H]={name:w,callback:D,note:Q},v.onResolve.push({id:H,filter:K.source,namespace:X||""})},onLoad(g,D){let k='This error came from the "onLoad" callback registered here:',Q=Me(new Error(k),e,"onLoad"),I={},K=n(g,I,"filter",Pe),X=n(g,I,"namespace",y);if(J(g,I,`in onLoad() call for plugin ${JSON.stringify(w)}`),K==null)throw new Error("onLoad() call is missing a filter");let H=C++;A[H]={name:w,callback:D,note:Q},v.onLoad.push({id:H,filter:K.source,namespace:X||""})},esbuild:e.esbuild});h&&(yield h),L.push(v)}catch(a){return{ok:!1,error:a,pluginName:w}}}let T=E=>fe(this,null,function*(){switch(E.command){case"on-start":{let b={errors:[],warnings:[]};return yield Promise.all(B.map(Y=>fe(this,[Y],function*({name:w,callback:a,note:v}){try{let h=yield a();if(h!=null){if(typeof h!="object")throw new Error(`Expected onStart() callback in plugin ${JSON.stringify(w)} to return an object`);let g={},D=n(h,g,"errors",_),k=n(h,g,"warnings",_);J(h,g,`from onStart() callback in plugin ${JSON.stringify(w)}`),D!=null&&b.errors.push(...be(D,"errors",p,w)),k!=null&&b.warnings.push(...be(k,"warnings",p,w))}}catch(h){b.errors.push(ve(h,e,p,v&&v(),w))}}))),b}case"on-resolve":{let b={},w="",a,v;for(let Y of E.ids)try{({name:w,callback:a,note:v}=x[Y]);let h=yield a({path:E.path,importer:E.importer,namespace:E.namespace,resolveDir:E.resolveDir,kind:E.kind,pluginData:p.load(E.pluginData)});if(h!=null){if(typeof h!="object")throw new Error(`Expected onResolve() callback in plugin ${JSON.stringify(w)} to return an object`);let g={},D=n(h,g,"pluginName",y),k=n(h,g,"path",y),Q=n(h,g,"namespace",y),I=n(h,g,"suffix",y),K=n(h,g,"external",q),X=n(h,g,"sideEffects",q),H=n(h,g,"pluginData",Ce),j=n(h,g,"errors",_),V=n(h,g,"warnings",_),G=n(h,g,"watchFiles",_),z=n(h,g,"watchDirs",_);J(h,g,`from onResolve() callback in plugin ${JSON.stringify(w)}`),b.id=Y,D!=null&&(b.pluginName=D),k!=null&&(b.path=k),Q!=null&&(b.namespace=Q),I!=null&&(b.suffix=I),K!=null&&(b.external=K),X!=null&&(b.sideEffects=X),H!=null&&(b.pluginData=p.store(H)),j!=null&&(b.errors=be(j,"errors",p,w)),V!=null&&(b.warnings=be(V,"warnings",p,w)),G!=null&&(b.watchFiles=$e(G,"watchFiles")),z!=null&&(b.watchDirs=$e(z,"watchDirs"));break}}catch(h){return{id:Y,errors:[ve(h,e,p,v&&v(),w)]}}return b}case"on-load":{let b={},w="",a,v;for(let Y of E.ids)try{({name:w,callback:a,note:v}=A[Y]);let h=yield a({path:E.path,namespace:E.namespace,suffix:E.suffix,pluginData:p.load(E.pluginData)});if(h!=null){if(typeof h!="object")throw new Error(`Expected onLoad() callback in plugin ${JSON.stringify(w)} to return an object`);let g={},D=n(h,g,"pluginName",y),k=n(h,g,"contents",bt),Q=n(h,g,"resolveDir",y),I=n(h,g,"pluginData",Ce),K=n(h,g,"loader",y),X=n(h,g,"errors",_),H=n(h,g,"warnings",_),j=n(h,g,"watchFiles",_),V=n(h,g,"watchDirs",_);J(h,g,`from onLoad() callback in plugin ${JSON.stringify(w)}`),b.id=Y,D!=null&&(b.pluginName=D),k instanceof Uint8Array?b.contents=k:k!=null&&(b.contents=ce(k)),Q!=null&&(b.resolveDir=Q),I!=null&&(b.pluginData=p.store(I)),K!=null&&(b.loader=K),X!=null&&(b.errors=be(X,"errors",p,w)),H!=null&&(b.warnings=be(H,"warnings",p,w)),j!=null&&(b.watchFiles=$e(j,"watchFiles")),V!=null&&(b.watchDirs=$e(V,"watchDirs"));break}}catch(h){return{id:Y,errors:[ve(h,e,p,v&&v(),w)]}}return b}default:throw new Error("Invalid command: "+E.command)}}),U=(E,b,w)=>w();$.length>0&&(U=(E,b,w)=>{(()=>fe(this,null,function*(){for(let{name:a,callback:v,note:Y}of $)try{yield v(E)}catch(h){E.errors.push(yield new Promise(g=>b(h,a,Y&&Y(),g)))}}))().then(w)}),S=!0;let ee=0;return{ok:!0,requestPlugins:L,runOnEndCallbacks:U,pluginRefs:{ref(){++ee===1&&r.set(o,T)},unref(){--ee===0&&r.delete(o)}}}}),ie=(d,f,o,p)=>{let F={},B=n(f,F,"port",Oe),$=n(f,F,"host",y),x=n(f,F,"servedir",y),A=n(f,F,"onRequest",We),C,R=new Promise((L,S)=>{C=T=>{u.delete(p),T!==null?S(new Error(T)):L()}});return o.serve={},J(f,F,"in serve() call"),B!==void 0&&(o.serve.port=B),$!==void 0&&(o.serve.host=$),x!==void 0&&(o.serve.servedir=x),u.set(p,{onRequest:A,onWait:C}),{wait:R,stop(){P(d,{command:"serve-stop",key:p},()=>{})}}},ge="warning",ae="silent",me=d=>{let f=l++,o=Ye(),p,{refs:F,options:B,isTTY:$,callback:x}=d;if(typeof B=="object"){let R=B.plugins;if(R!==void 0){if(!Array.isArray(R))throw new Error('"plugins" must be an array');p=R}}let A=(R,L,S,T)=>{let U=[];try{Ae(U,B,{},$,ge)}catch(E){}let ee=ve(R,e,o,S,L);P(F,{command:"error",flags:U,error:ee},()=>{ee.detail=o.load(ee.detail),T(ee)})},C=(R,L)=>{A(R,L,void 0,S=>{x(Re("Build failed",[S],[]),null)})};if(p&&p.length>0){if(e.isSync)return C(new Error("Cannot use plugins in synchronous API calls"),"");le(B,p,f,o,F).then(R=>{if(!R.ok)C(R.error,R.pluginName);else try{ue(Fe(Ne({},d),{key:f,details:o,logPluginError:A,requestPlugins:R.requestPlugins,runOnEndCallbacks:R.runOnEndCallbacks,pluginRefs:R.pluginRefs}))}catch(L){C(L,"")}},R=>C(R,""))}else try{ue(Fe(Ne({},d),{key:f,details:o,logPluginError:A,requestPlugins:null,runOnEndCallbacks:(R,L,S)=>S(),pluginRefs:null}))}catch(R){C(R,"")}},ue=({callName:d,refs:f,serveOptions:o,options:p,isTTY:F,defaultWD:B,callback:$,key:x,details:A,logPluginError:C,requestPlugins:R,runOnEndCallbacks:L,pluginRefs:S})=>{let T={ref(){S&&S.ref(),f&&f.ref()},unref(){S&&S.unref(),f&&f.unref()}},U=!e.isBrowser,{entries:ee,flags:E,write:b,stdinContents:w,stdinResolveDir:a,absWorkingDir:v,incremental:Y,nodePaths:h,watch:g,mangleCache:D}=wt(d,p,F,ge,U),k={command:"build",key:x,entries:ee,flags:E,write:b,stdinContents:w,stdinResolveDir:a,absWorkingDir:v||B,incremental:Y,nodePaths:h};R&&(k.plugins=R),D&&(k.mangleCache=D);let Q=o&&ie(T,o,k,x),I,K,X=(j,V)=>{j.outputFiles&&(V.outputFiles=j.outputFiles.map(Rt)),j.metafile&&(V.metafile=JSON.parse(j.metafile)),j.mangleCache&&(V.mangleCache=j.mangleCache),j.writeToStdout!==void 0&&console.log(he(j.writeToStdout).replace(/\n$/,""))},H=(j,V)=>{let G={errors:de(j.errors,A),warnings:de(j.warnings,A)};X(j,G),L(G,C,()=>{if(G.errors.length>0)return V(Re("Build failed",G.errors,G.warnings),null);if(j.rebuild){if(!I){let z=!1;I=()=>new Promise((se,Z)=>{if(z||i)throw new Error("Cannot rebuild");P(T,{command:"rebuild",key:x},(te,rt)=>{if(te)return V(Re("Build failed",[{pluginName:"",text:te,location:null,notes:[],detail:void 0}],[]),null);H(rt,(De,nt)=>{De?Z(De):se(nt)})})}),T.ref(),I.dispose=()=>{z||(z=!0,P(T,{command:"rebuild-dispose",key:x},()=>{}),T.unref())}}G.rebuild=I}if(j.watch){if(!K){let z=!1;T.ref(),K=()=>{z||(z=!0,s.delete(x),P(T,{command:"watch-stop",key:x},()=>{}),T.unref())},g&&s.set(x,(se,Z)=>{if(se){g.onRebuild&&g.onRebuild(se,null);return}let te={errors:de(Z.errors,A),warnings:de(Z.warnings,A)};X(Z,te),L(te,C,()=>{if(te.errors.length>0){g.onRebuild&&g.onRebuild(Re("Build failed",te.errors,te.warnings),null);return}Z.rebuildID!==void 0&&(te.rebuild=I),te.stop=K,g.onRebuild&&g.onRebuild(null,te)})})}G.stop=K}V(null,G)})};if(b&&e.isBrowser)throw new Error('Cannot enable "write" in the browser');if(Y&&e.isSync)throw new Error('Cannot use "incremental" with a synchronous build');if(g&&e.isSync)throw new Error('Cannot use "watch" with a synchronous build');P(T,k,(j,V)=>{if(j)return $(new Error(j),null);if(Q){let G=V,z=!1;T.ref();let se={port:G.port,host:G.host,wait:Q.wait,stop(){z||(z=!0,Q.stop(),T.unref())}};return T.ref(),Q.wait.then(T.unref,T.unref),$(null,se)}return H(V,$)})};return{readFromStdout:N,afterClose:M,service:{buildOrServe:me,transform:({callName:d,refs:f,input:o,options:p,isTTY:F,fs:B,callback:$})=>{let x=Ye(),A=C=>{try{if(typeof o!="string")throw new Error('The input to "transform" must be a string');let{flags:R,mangleCache:L}=vt(d,p,F,ae),S={command:"transform",flags:R,inputFS:C!==null,input:C!==null?C:o};L&&(S.mangleCache=L),P(f,S,(T,U)=>{if(T)return $(new Error(T),null);let ee=de(U.errors,x),E=de(U.warnings,x),b=1,w=()=>{if(--b===0){let a={warnings:E,code:U.code,map:U.map};U.mangleCache&&(a.mangleCache=U==null?void 0:U.mangleCache),$(null,a)}};if(ee.length>0)return $(Re("Transform failed",ee,E),null);U.codeFS&&(b++,B.readFile(U.code,(a,v)=>{a!==null?$(a,null):(U.code=v,w())})),U.mapFS&&(b++,B.readFile(U.map,(a,v)=>{a!==null?$(a,null):(U.map=v,w())})),w()})}catch(R){let L=[];try{Ae(L,p,{},F,ae)}catch(T){}let S=ve(R,e,x,void 0,"");P(f,{command:"error",flags:L,error:S},()=>{S.detail=x.load(S.detail),$(Re("Transform failed",[S],[]),null)})}};if(typeof o=="string"&&o.length>1024*1024){let C=A;A=()=>B.writeFile(o,C)}A(null)},formatMessages:({callName:d,refs:f,messages:o,options:p,callback:F})=>{let B=be(o,"messages",null,"");if(!p)throw new Error(`Missing second argument in ${d}() call`);let $={},x=n(p,$,"kind",y),A=n(p,$,"color",q),C=n(p,$,"terminalWidth",Oe);if(J(p,$,`in ${d}() call`),x===void 0)throw new Error(`Missing "kind" in ${d}() call`);if(x!=="error"&&x!=="warning")throw new Error(`Expected "kind" to be "error" or "warning" in ${d}() call`);let R={command:"format-msgs",messages:B,isWarning:x==="warning"};A!==void 0&&(R.color=A),C!==void 0&&(R.terminalWidth=C),P(f,R,(L,S)=>{if(L)return F(new Error(L),null);F(null,S.messages)})},analyzeMetafile:({callName:d,refs:f,metafile:o,options:p,callback:F})=>{p===void 0&&(p={});let B={},$=n(p,B,"color",q),x=n(p,B,"verbose",q);J(p,B,`in ${d}() call`);let A={command:"analyze-metafile",metafile:o};$!==void 0&&(A.color=$),x!==void 0&&(A.verbose=x),P(f,A,(C,R)=>{if(C)return F(new Error(C),null);F(null,R.result)})}}}}function Ye(){let e=new Map,t=0;return{load(r){return e.get(r)},store(r){if(r===void 0)return-1;let s=t++;return e.set(s,r),s}}}function Me(e,t,r){let s,u=!1;return()=>{if(u)return s;u=!0;try{let i=(e.stack+"").split(`
3
+ `);i.splice(1,1);let c=tt(t,i,r);if(c)return s={text:e.message,location:c},s}catch(i){}}}function ve(e,t,r,s,u){let i="Internal error",c=null;try{i=(e&&e.message||e)+""}catch(l){}try{c=tt(t,(e.stack+"").split(`
4
+ `),"")}catch(l){}return{pluginName:u,text:i,location:c,notes:s?[s]:[],detail:r?r.store(e):-1}}function tt(e,t,r){let s=" at ";if(e.readFileSync&&!t[0].startsWith(s)&&t[1].startsWith(s))for(let u=1;u<t.length;u++){let i=t[u];if(!!i.startsWith(s))for(i=i.slice(s.length);;){let c=/^(?:new |async )?\S+ \((.*)\)$/.exec(i);if(c){i=c[1];continue}if(c=/^eval at \S+ \((.*)\)(?:, \S+:\d+:\d+)?$/.exec(i),c){i=c[1];continue}if(c=/^(\S+):(\d+):(\d+)$/.exec(i),c){let l;try{l=e.readFileSync(c[1],"utf8")}catch(M){break}let m=l.split(/\r\n|\r|\n|\u2028|\u2029/)[+c[2]-1]||"",O=+c[3]-1,N=m.slice(O,O+r.length)===r?r.length:0;return{file:c[1],namespace:"file",line:+c[2],column:ce(m.slice(0,O)).length,length:ce(m.slice(O,O+N)).length,lineText:m+`
5
5
  `+t.slice(1).join(`
6
- `),suggestion:""}}break}}return null}function Re(e,t,r){let i=5,u=t.length<1?"":` with ${t.length} error${t.length<2?"":"s"}:`+t.slice(0,i+1).map((c,s)=>{if(s===i)return`
6
+ `),suggestion:""}}break}}return null}function Re(e,t,r){let s=5,u=t.length<1?"":` with ${t.length} error${t.length<2?"":"s"}:`+t.slice(0,s+1).map((c,l)=>{if(l===s)return`
7
7
  ...`;if(!c.location)return`
8
- error: ${c.text}`;let{file:d,line:O,column:T}=c.location,L=c.pluginName?`[plugin: ${c.pluginName}] `:"";return`
9
- ${d}:${O}:${T}: ERROR: ${L}${c.text}`}).join(""),l=new Error(`${e}${u}`);return l.errors=t,l.warnings=r,l}function ge(e,t){for(let r of e)r.detail=t.load(r.detail);return e}function He(e,t){if(e==null)return null;let r={},i=n(e,r,"file",y),u=n(e,r,"namespace",y),l=n(e,r,"line",Oe),c=n(e,r,"column",Oe),s=n(e,r,"length",Oe),d=n(e,r,"lineText",y),O=n(e,r,"suggestion",y);return J(e,r,t),{file:i||"",namespace:u||"",line:l||0,column:c||0,length:s||0,lineText:d||"",suggestion:O||""}}function be(e,t,r,i){let u=[],l=0;for(let c of e){let s={},d=n(c,s,"pluginName",y),O=n(c,s,"text",y),T=n(c,s,"location",Je),L=n(c,s,"notes",_),x=n(c,s,"detail",Me),S=`in element ${l} of "${t}"`;J(c,s,S);let ae=[];if(L)for(let re of L){let le={},ie=n(re,le,"text",y),ue=n(re,le,"location",Je);J(re,le,S),ae.push({text:ie||"",location:He(ue,S)})}u.push({pluginName:d||i,text:O||"",location:He(T,S),notes:ae,detail:r?r.store(x):-1}),l++}return u}function $e(e,t){let r=[];for(let i of e){if(typeof i!="string")throw new Error(`${JSON.stringify(t)} must be an array of strings`);r.push(i)}return r}function Rt({path:e,contents:t}){let r=null;return{path:e,contents:t,get text(){return r===null&&(r=he(t)),r}}}var St="0.14.23",xt=e=>Te().build(e),kt=()=>{throw new Error('The "serve" API only works in node')},Et=(e,t)=>Te().transform(e,t),$t=(e,t)=>Te().formatMessages(e,t),Mt=(e,t)=>Te().analyzeMetafile(e,t),Ct=()=>{throw new Error('The "buildSync" API only works in node')},Pt=()=>{throw new Error('The "transformSync" API only works in node')},Tt=()=>{throw new Error('The "formatMessagesSync" API only works in node')},Bt=()=>{throw new Error('The "analyzeMetafileSync" API only works in node')},Se,We,Te=()=>{if(We)return We;throw Se?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=Qe(e||{});let t=e.wasmURL,r=e.worker!==!1;if(!t)throw new Error('Must provide the "wasmURL" option');if(t+="",Se)throw new Error('Cannot call "initialize" more than once');return Se=At(t,r),Se.catch(()=>{Se=void 0}),Se},At=(e,t)=>de(void 0,null,function*(){let r=yield fetch(e);if(!r.ok)throw new Error(`Failed to download ${JSON.stringify(e)}`);let i=yield r.arrayBuffer(),u='{let global={};for(let o=self;o;o=Object.getPrototypeOf(o))for(let k of Object.getOwnPropertyNames(o))if(!(k in global))Object.defineProperty(global,k,{get:()=>self[k]});\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.\nvar w=(a,g,f)=>new Promise((y,r)=>{var n=o=>{try{i(f.next(o))}catch(m){r(m)}},s=o=>{try{i(f.throw(o))}catch(m){r(m)}},i=o=>o.done?y(o.value):Promise.resolve(o.value).then(n,s);i((f=f.apply(a,g)).next())});(()=>{if(typeof global=="undefined")if(typeof window!="undefined")window.global=window;else if(typeof self!="undefined")self.global=self;else throw new Error("cannot export Go (neither global, window nor self is defined)");if(!global.require&&typeof require!="undefined"&&(global.require=require),!global.fs&&global.require){const r=require("fs");typeof r=="object"&&r!==null&&Object.keys(r).length!==0&&(global.fs=Object.assign({},r,{write(n,s,i,o,m,u){if(i===0&&o===s.length&&m===null){if(n===process.stdout.fd){try{process.stdout.write(s,h=>h?u(h,0,null):u(null,o,s))}catch(h){u(h,0,null)}return}if(n===process.stderr.fd){try{process.stderr.write(s,h=>h?u(h,0,null):u(null,o,s))}catch(h){u(h,0,null)}return}}r.write(n,s,i,o,m,u)}}))}const a=()=>{const r=new Error("not implemented");return r.code="ENOSYS",r};if(!global.fs){let r="";global.fs={constants:{O_WRONLY:-1,O_RDWR:-1,O_CREAT:-1,O_TRUNC:-1,O_APPEND:-1,O_EXCL:-1},writeSync(n,s){r+=y.decode(s);const i=r.lastIndexOf(`\n`);return i!=-1&&(console.log(r.substr(0,i)),r=r.substr(i+1)),s.length},write(n,s,i,o,m,u){if(i!==0||o!==s.length||m!==null){u(a());return}const h=this.writeSync(n,s);u(null,h)},chmod(n,s,i){i(a())},chown(n,s,i,o){o(a())},close(n,s){s(a())},fchmod(n,s,i){i(a())},fchown(n,s,i,o){o(a())},fstat(n,s){s(a())},fsync(n,s){s(null)},ftruncate(n,s,i){i(a())},lchown(n,s,i,o){o(a())},link(n,s,i){i(a())},lstat(n,s){s(a())},mkdir(n,s,i){i(a())},open(n,s,i,o){o(a())},read(n,s,i,o,m,u){u(a())},readdir(n,s){s(a())},readlink(n,s){s(a())},rename(n,s,i){i(a())},rmdir(n,s){s(a())},stat(n,s){s(a())},symlink(n,s,i){i(a())},truncate(n,s,i){i(a())},unlink(n,s){s(a())},utimes(n,s,i,o){o(a())}}}if(global.process||(global.process={getuid(){return-1},getgid(){return-1},geteuid(){return-1},getegid(){return-1},getgroups(){throw a()},pid:-1,ppid:-1,umask(){throw a()},cwd(){throw a()},chdir(){throw a()}}),!global.crypto&&global.require){const r=require("crypto");global.crypto={getRandomValues(n){r.randomFillSync(n)}}}if(!global.crypto)throw new Error("global.crypto is not available, polyfill required (getRandomValues only)");if(global.performance||(global.performance={now(){const[r,n]=process.hrtime();return r*1e3+n/1e6}}),!global.TextEncoder&&global.require&&(global.TextEncoder=require("util").TextEncoder),!global.TextEncoder)throw new Error("global.TextEncoder is not available, polyfill required");if(!global.TextDecoder&&global.require&&(global.TextDecoder=require("util").TextDecoder),!global.TextDecoder)throw new Error("global.TextDecoder is not available, polyfill required");const{fs:g}=global,f=new TextEncoder("utf-8"),y=new TextDecoder("utf-8");if(global.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 r=(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),l=this.mem.getInt32(e+4,!0);return t+l*4294967296},s=e=>{const t=this.mem.getFloat64(e,!0);if(t===0)return;if(!isNaN(t))return t;const l=this.mem.getUint32(e,!0);return this._values[l]},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 c=this._ids.get(t);c===void 0&&(c=this._idPool.pop(),c===void 0&&(c=this._values.length),this._values[c]=t,this._goRefCounts[c]=0,this._ids.set(t,c)),this._goRefCounts[c]++;let d=0;switch(typeof t){case"object":t!==null&&(d=1);break;case"string":d=2;break;case"symbol":d=3;break;case"function":d=4;break}this.mem.setUint32(e+4,2146959360|d,!0),this.mem.setUint32(e,c,!0)},o=e=>{const t=n(e+0),l=n(e+8);return new Uint8Array(this._inst.exports.mem.buffer,t,l)},m=e=>{const t=n(e+0),l=n(e+8),c=new Array(l);for(let d=0;d<l;d++)c[d]=s(t+d*8);return c},u=e=>{const t=n(e+0),l=n(e+8);return y.decode(new DataView(this._inst.exports.mem.buffer,t,l))},h=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),l=n(e+16),c=this.mem.getInt32(e+24,!0);g.writeSync(t,new Uint8Array(this._inst.exports.mem.buffer,l,c))},"runtime.resetMemoryDataView":e=>{e>>>=0,this.mem=new DataView(this._inst.exports.mem.buffer)},"runtime.nanotime1":e=>{e>>>=0,r(e+8,(h+performance.now())*1e6)},"runtime.walltime":e=>{e>>>=0;const t=new Date().getTime();r(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(o(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 l=this._values[t];this._values[t]=null,this._ids.delete(l),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),l=Reflect.get(t,u(e+16)),c=m(e+32),d=Reflect.apply(l,t,c);e=this._inst.exports.getsp()>>>0,i(e+56,d),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),l=m(e+16),c=Reflect.apply(t,void 0,l);e=this._inst.exports.getsp()>>>0,i(e+40,c),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),l=m(e+16),c=Reflect.construct(t,l);e=this._inst.exports.getsp()>>>0,i(e+40,c),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,r(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),r(e+24,t.length)},"syscall/js.valueLoadString":e=>{e>>>=0;const t=s(e+8);o(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=o(e+8),l=s(e+32);if(!(l instanceof Uint8Array||l instanceof Uint8ClampedArray)){this.mem.setUint8(e+48,0);return}const c=l.subarray(0,t.length);t.set(c),r(e+40,c.length),this.mem.setUint8(e+48,1)},"syscall/js.copyBytesToJS":e=>{e>>>=0;const t=s(e+8),l=o(e+16);if(!(t instanceof Uint8Array||t instanceof Uint8ClampedArray)){this.mem.setUint8(e+48,0);return}const c=l.subarray(0,t.length);t.set(c),r(e+40,c.length),this.mem.setUint8(e+48,1)},debug:e=>{console.log(e)}}}}run(r){return w(this,null,function*(){if(!(r instanceof WebAssembly.Instance))throw new Error("Go.run: WebAssembly.Instance expected");this._inst=r,this.mem=new DataView(this._inst.exports.mem.buffer),this._values=[NaN,0,null,!0,!1,global,this],this._goRefCounts=new Array(this._values.length).fill(1/0),this._ids=new Map([[0,1],[null,2],[!0,3],[!1,4],[global,5],[this,6]]),this._idPool=[],this.exited=!1;let n=4096;const s=e=>{const t=n,l=f.encode(e+"\\0");return new Uint8Array(this.mem.buffer,n,l.length).set(l),n+=l.length,n%8!==0&&(n+=8-n%8),t},i=this.argv.length,o=[];this.argv.forEach(e=>{o.push(s(e))}),o.push(0),Object.keys(this.env).sort().forEach(e=>{o.push(s(`${e}=${this.env[e]}`))}),o.push(0);const u=n;o.forEach(e=>{this.mem.setUint32(n,e,!0),this.mem.setUint32(n+4,0,!0),n+=8});const h=4096+8192;if(n>=h)throw new Error("total length of command line and environment variables exceeds limit");this._inst.exports.run(i,u),this.exited&&this._resolveExitPromise(),yield this._exitPromise})}_resume(){if(this.exited)throw new Error("Go program has already exited");this._inst.exports.resume(),this.exited&&this._resolveExitPromise()}_makeFuncWrapper(r){const n=this;return function(){const s={id:r,this:this,args:arguments};return n._pendingEvent=s,n._resume(),s.result}}},typeof module!="undefined"&&global.require&&global.require.main===module&&global.process&&global.process.versions&&!global.process.versions.electron){process.argv.length<3&&(console.error("usage: go_js_wasm_exec [wasm binary] [arguments]"),process.exit(1));const r=new Go;r.argv=process.argv.slice(2),r.env=Object.assign({TMPDIR:require("os").tmpdir()},process.env),r.exit=process.exit,WebAssembly.instantiate(g.readFileSync(process.argv[2]),r.importObject).then(n=>(process.on("exit",s=>{s===0&&!r.exited&&(r._pendingEvent={id:0},r._resume())}),r.run(n.instance))).catch(n=>{console.error(n),process.exit(1)})}})();\nonmessage=({data:c})=>{let y=new TextDecoder,s=global.fs,a="";s.writeSync=(e,t)=>{if(e===1)postMessage(t);else if(e===2){a+=y.decode(t);let n=a.split(`\n`);n.length>1&&console.log(n.slice(0,-1).join(`\n`)),a=n[n.length-1]}else throw new Error("Bad write");return t.length};let l=[],i,r=0;onmessage=({data:e})=>{e.length>0&&(l.push(e),i&&i())},s.read=(e,t,n,d,h,m)=>{if(e!==0||n!==0||d!==t.length||h!==null)throw new Error("Bad read");if(l.length===0){i=()=>s.read(e,t,n,d,h,m);return}let g=l[0],u=Math.max(0,Math.min(d,g.length-r));t.set(g.subarray(r,r+u),n),r+=u,r===g.length&&(l.shift(),r=0),m(null,u)};let o=new global.Go;o.argv=["","--service=0.14.23"],WebAssembly.instantiate(c,o.importObject).then(({instance:e})=>o.run(e))};}',l;if(t){let d=new Blob([u],{type:"text/javascript"});l=new Worker(URL.createObjectURL(d))}else{let O=new Function("postMessage",u+"var onmessage; return m => onmessage(m)")(T=>l.onmessage({data:T}));l={onmessage:null,postMessage:T=>O({data:T}),terminate(){}}}l.postMessage(i),l.onmessage=({data:d})=>c(d);let{readFromStdout:c,service:s}=et({writeToStdin(d){l.postMessage(d)},isSync:!1,isBrowser:!0,esbuild:Be});We={build:d=>new Promise((O,T)=>s.buildOrServe({callName:"build",refs:null,serveOptions:null,options:d,isTTY:!1,defaultWD:"/",callback:(L,x)=>L?T(L):O(x)})),transform:(d,O)=>new Promise((T,L)=>s.transform({callName:"transform",refs:null,input:d,options:O||{},isTTY:!1,fs:{readFile(x,S){S(new Error("Internal error"),null)},writeFile(x,S){S(null)}},callback:(x,S)=>x?L(x):T(S)})),formatMessages:(d,O)=>new Promise((T,L)=>s.formatMessages({callName:"formatMessages",refs:null,messages:d,options:O,callback:(x,S)=>x?L(x):T(S)})),analyzeMetafile:(d,O)=>new Promise((T,L)=>s.analyzeMetafile({callName:"analyzeMetafile",refs:null,metafile:typeof d=="string"?d:JSON.stringify(d),options:O,callback:(x,S)=>x?L(x):T(S)}))}}),Nt=Be;module.exports=dt(Be);
8
+ error: ${c.text}`;let{file:m,line:O,column:N}=c.location,M=c.pluginName?`[plugin: ${c.pluginName}] `:"";return`
9
+ ${m}:${O}:${N}: ERROR: ${M}${c.text}`}).join(""),i=new Error(`${e}${u}`);return i.errors=t,i.warnings=r,i}function de(e,t){for(let r of e)r.detail=t.load(r.detail);return e}function Qe(e,t){if(e==null)return null;let r={},s=n(e,r,"file",y),u=n(e,r,"namespace",y),i=n(e,r,"line",Oe),c=n(e,r,"column",Oe),l=n(e,r,"length",Oe),m=n(e,r,"lineText",y),O=n(e,r,"suggestion",y);return J(e,r,t),{file:s||"",namespace:u||"",line:i||0,column:c||0,length:l||0,lineText:m||"",suggestion:O||""}}function be(e,t,r,s){let u=[],i=0;for(let c of e){let l={},m=n(c,l,"pluginName",y),O=n(c,l,"text",y),N=n(c,l,"location",Je),M=n(c,l,"notes",_),P=n(c,l,"detail",Ce),W=`in element ${i} of "${t}"`;J(c,l,W);let oe=[];if(M)for(let re of M){let ne={},le=n(re,ne,"text",y),ie=n(re,ne,"location",Je);J(re,ne,W),oe.push({text:le||"",location:Qe(ie,W)})}u.push({pluginName:m||s,text:O||"",location:Qe(N,W),notes:oe,detail:r?r.store(P):-1}),i++}return u}function $e(e,t){let r=[];for(let s of e){if(typeof s!="string")throw new Error(`${JSON.stringify(t)} must be an array of strings`);r.push(s)}return r}function Rt({path:e,contents:t}){let r=null;return{path:e,contents:t,get text(){return r===null&&(r=he(t)),r}}}var St="0.14.36",xt=e=>Be().build(e),Et=()=>{throw new Error('The "serve" API only works in node')},kt=(e,t)=>Be().transform(e,t),Mt=(e,t)=>Be().formatMessages(e,t),$t=(e,t)=>Be().analyzeMetafile(e,t),Ct=()=>{throw new Error('The "buildSync" API only works in node')},Pt=()=>{throw new Error('The "transformSync" API only works in node')},At=()=>{throw new Error('The "formatMessagesSync" API only works in node')},Bt=()=>{throw new Error('The "analyzeMetafileSync" API only works in node')},Se,qe,Be=()=>{if(qe)return qe;throw Se?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')},Tt=e=>{e=Ge(e||{});let t=e.wasmURL,r=e.wasmModule,s=e.worker!==!1;if(!t&&!r)throw new Error('Must provide either the "wasmURL" option or the "wasmModule" option');if(Se)throw new Error('Cannot call "initialize" more than once');return Se=Dt(t||"",r,s),Se.catch(()=>{Se=void 0}),Se},Dt=(e,t,r)=>fe(void 0,null,function*(){let s;if(t)s=t;else{let l=yield fetch(e);if(!l.ok)throw new Error(`Failed to download ${JSON.stringify(e)}`);s=yield l.arrayBuffer()}let u;if(r){let l=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.\nvar y=(r,g,f)=>new Promise((h,n)=>{var s=c=>{try{l(f.next(c))}catch(u){n(u)}},i=c=>{try{l(f.throw(c))}catch(u){n(u)}},l=c=>c.done?h(c.value):Promise.resolve(c.value).then(s,i);l((f=f.apply(r,g)).next())});let onmessage,globalThis={};for(let r=self;r;r=Object.getPrototypeOf(r))for(let g of Object.getOwnPropertyNames(r))g in globalThis||Object.defineProperty(globalThis,g,{get:()=>self[g]});return(()=>{const r=()=>{const h=new Error("not implemented");return h.code="ENOSYS",h};if(!globalThis.fs){let h="";globalThis.fs={constants:{O_WRONLY:-1,O_RDWR:-1,O_CREAT:-1,O_TRUNC:-1,O_APPEND:-1,O_EXCL:-1},writeSync(n,s){h+=f.decode(s);const i=h.lastIndexOf(`\n`);return i!=-1&&(console.log(h.substr(0,i)),h=h.substr(i+1)),s.length},write(n,s,i,l,c,u){if(i!==0||l!==s.length||c!==null){u(r());return}const d=this.writeSync(n,s);u(null,d)},chmod(n,s,i){i(r())},chown(n,s,i,l){l(r())},close(n,s){s(r())},fchmod(n,s,i){i(r())},fchown(n,s,i,l){l(r())},fstat(n,s){s(r())},fsync(n,s){s(null)},ftruncate(n,s,i){i(r())},lchown(n,s,i,l){l(r())},link(n,s,i){i(r())},lstat(n,s){s(r())},mkdir(n,s,i){i(r())},open(n,s,i,l){l(r())},read(n,s,i,l,c,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,l){l(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 g=new TextEncoder("utf-8"),f=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 h=(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 a=this._ids.get(t);a===void 0&&(a=this._idPool.pop(),a===void 0&&(a=this._values.length),this._values[a]=t,this._goRefCounts[a]=0,this._ids.set(t,a)),this._goRefCounts[a]++;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,a,!0)},l=e=>{const t=n(e+0),o=n(e+8);return new Uint8Array(this._inst.exports.mem.buffer,t,o)},c=e=>{const t=n(e+0),o=n(e+8),a=new Array(o);for(let m=0;m<o;m++)a[m]=s(t+m*8);return a},u=e=>{const t=n(e+0),o=n(e+8);return f.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),a=this.mem.getInt32(e+24,!0);globalThis.fs.writeSync(t,new Uint8Array(this._inst.exports.mem.buffer,o,a))},"runtime.resetMemoryDataView":e=>{e>>>=0,this.mem=new DataView(this._inst.exports.mem.buffer)},"runtime.nanotime1":e=>{e>>>=0,h(e+8,(d+performance.now())*1e6)},"runtime.walltime":e=>{e>>>=0;const t=new Date().getTime();h(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(l(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)),a=c(e+32),m=Reflect.apply(o,t,a);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=c(e+16),a=Reflect.apply(t,void 0,o);e=this._inst.exports.getsp()>>>0,i(e+40,a),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=c(e+16),a=Reflect.construct(t,o);e=this._inst.exports.getsp()>>>0,i(e+40,a),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,h(e+16,parseInt(s(e+8).length))},"syscall/js.valuePrepareString":e=>{e>>>=0;const t=g.encode(String(s(e+8)));i(e+16,t),h(e+24,t.length)},"syscall/js.valueLoadString":e=>{e>>>=0;const t=s(e+8);l(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=l(e+8),o=s(e+32);if(!(o instanceof Uint8Array||o instanceof Uint8ClampedArray)){this.mem.setUint8(e+48,0);return}const a=o.subarray(0,t.length);t.set(a),h(e+40,a.length),this.mem.setUint8(e+48,1)},"syscall/js.copyBytesToJS":e=>{e>>>=0;const t=s(e+8),o=l(e+16);if(!(t instanceof Uint8Array||t instanceof Uint8ClampedArray)){this.mem.setUint8(e+48,0);return}const a=o.subarray(0,t.length);t.set(a),h(e+40,a.length),this.mem.setUint8(e+48,1)},debug:e=>{console.log(e)}}}}run(h){return y(this,null,function*(){if(!(h instanceof WebAssembly.Instance))throw new Error("Go.run: WebAssembly.Instance expected");this._inst=h,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=g.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,l=[];this.argv.forEach(e=>{l.push(s(e))}),l.push(0),Object.keys(this.env).sort().forEach(e=>{l.push(s(`${e}=${this.env[e]}`))}),l.push(0);const u=n;l.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(),yield this._exitPromise})}_resume(){if(this.exited)throw new Error("Go program has already exited");this._inst.exports.resume(),this.exited&&this._resolveExitPromise()}_makeFuncWrapper(h){const n=this;return function(){const s={id:h,this:this,args:arguments};return n._pendingEvent=s,n._resume(),s.result}}}})(),onmessage=({data:r})=>{let g=new TextDecoder,f=globalThis.fs,h="";f.writeSync=(c,u)=>{if(c===1)postMessage(u);else if(c===2){h+=g.decode(u);let d=h.split(`\n`);d.length>1&&console.log(d.slice(0,-1).join(`\n`)),h=d[d.length-1]}else throw new Error("Bad write");return u.length};let n=[],s,i=0;onmessage=({data:c})=>{c.length>0&&(n.push(c),s&&s())},f.read=(c,u,d,e,t,o)=>{if(c!==0||d!==0||e!==u.length||t!==null)throw new Error("Bad read");if(n.length===0){s=()=>f.read(c,u,d,e,t,o);return}let a=n[0],m=Math.max(0,Math.min(e,a.length-i));u.set(a.subarray(i,i+m),d),i+=m,i===a.length&&(n.shift(),i=0),o(null,m)};let l=new globalThis.Go;l.argv=["","--service=0.14.36"],r instanceof WebAssembly.Module?WebAssembly.instantiate(r,l.importObject).then(c=>l.run(c)):WebAssembly.instantiate(r,l.importObject).then(({instance:c})=>l.run(c))},r=>onmessage(r);})(postMessage)'],{type:"text/javascript"});u=new Worker(URL.createObjectURL(l))}else{let l=(postMessage=>{
10
+ // Copyright 2018 The Go Authors. All rights reserved.
11
+ // Use of this source code is governed by a BSD-style
12
+ // license that can be found in the LICENSE file.
13
+ var y=(r,g,f)=>new Promise((h,n)=>{var s=c=>{try{l(f.next(c))}catch(u){n(u)}},i=c=>{try{l(f.throw(c))}catch(u){n(u)}},l=c=>c.done?h(c.value):Promise.resolve(c.value).then(s,i);l((f=f.apply(r,g)).next())});let onmessage,globalThis={};for(let r=self;r;r=Object.getPrototypeOf(r))for(let g of Object.getOwnPropertyNames(r))g in globalThis||Object.defineProperty(globalThis,g,{get:()=>self[g]});return(()=>{const r=()=>{const h=new Error("not implemented");return h.code="ENOSYS",h};if(!globalThis.fs){let h="";globalThis.fs={constants:{O_WRONLY:-1,O_RDWR:-1,O_CREAT:-1,O_TRUNC:-1,O_APPEND:-1,O_EXCL:-1},writeSync(n,s){h+=f.decode(s);const i=h.lastIndexOf(`
14
+ `);return i!=-1&&(console.log(h.substr(0,i)),h=h.substr(i+1)),s.length},write(n,s,i,l,c,u){if(i!==0||l!==s.length||c!==null){u(r());return}const d=this.writeSync(n,s);u(null,d)},chmod(n,s,i){i(r())},chown(n,s,i,l){l(r())},close(n,s){s(r())},fchmod(n,s,i){i(r())},fchown(n,s,i,l){l(r())},fstat(n,s){s(r())},fsync(n,s){s(null)},ftruncate(n,s,i){i(r())},lchown(n,s,i,l){l(r())},link(n,s,i){i(r())},lstat(n,s){s(r())},mkdir(n,s,i){i(r())},open(n,s,i,l){l(r())},read(n,s,i,l,c,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,l){l(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 g=new TextEncoder("utf-8"),f=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 h=(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 a=this._ids.get(t);a===void 0&&(a=this._idPool.pop(),a===void 0&&(a=this._values.length),this._values[a]=t,this._goRefCounts[a]=0,this._ids.set(t,a)),this._goRefCounts[a]++;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,a,!0)},l=e=>{const t=n(e+0),o=n(e+8);return new Uint8Array(this._inst.exports.mem.buffer,t,o)},c=e=>{const t=n(e+0),o=n(e+8),a=new Array(o);for(let m=0;m<o;m++)a[m]=s(t+m*8);return a},u=e=>{const t=n(e+0),o=n(e+8);return f.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),a=this.mem.getInt32(e+24,!0);globalThis.fs.writeSync(t,new Uint8Array(this._inst.exports.mem.buffer,o,a))},"runtime.resetMemoryDataView":e=>{e>>>=0,this.mem=new DataView(this._inst.exports.mem.buffer)},"runtime.nanotime1":e=>{e>>>=0,h(e+8,(d+performance.now())*1e6)},"runtime.walltime":e=>{e>>>=0;const t=new Date().getTime();h(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(l(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)),a=c(e+32),m=Reflect.apply(o,t,a);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=c(e+16),a=Reflect.apply(t,void 0,o);e=this._inst.exports.getsp()>>>0,i(e+40,a),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=c(e+16),a=Reflect.construct(t,o);e=this._inst.exports.getsp()>>>0,i(e+40,a),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,h(e+16,parseInt(s(e+8).length))},"syscall/js.valuePrepareString":e=>{e>>>=0;const t=g.encode(String(s(e+8)));i(e+16,t),h(e+24,t.length)},"syscall/js.valueLoadString":e=>{e>>>=0;const t=s(e+8);l(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=l(e+8),o=s(e+32);if(!(o instanceof Uint8Array||o instanceof Uint8ClampedArray)){this.mem.setUint8(e+48,0);return}const a=o.subarray(0,t.length);t.set(a),h(e+40,a.length),this.mem.setUint8(e+48,1)},"syscall/js.copyBytesToJS":e=>{e>>>=0;const t=s(e+8),o=l(e+16);if(!(t instanceof Uint8Array||t instanceof Uint8ClampedArray)){this.mem.setUint8(e+48,0);return}const a=o.subarray(0,t.length);t.set(a),h(e+40,a.length),this.mem.setUint8(e+48,1)},debug:e=>{console.log(e)}}}}run(h){return y(this,null,function*(){if(!(h instanceof WebAssembly.Instance))throw new Error("Go.run: WebAssembly.Instance expected");this._inst=h,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=g.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,l=[];this.argv.forEach(e=>{l.push(s(e))}),l.push(0),Object.keys(this.env).sort().forEach(e=>{l.push(s(`${e}=${this.env[e]}`))}),l.push(0);const u=n;l.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(),yield this._exitPromise})}_resume(){if(this.exited)throw new Error("Go program has already exited");this._inst.exports.resume(),this.exited&&this._resolveExitPromise()}_makeFuncWrapper(h){const n=this;return function(){const s={id:h,this:this,args:arguments};return n._pendingEvent=s,n._resume(),s.result}}}})(),onmessage=({data:r})=>{let g=new TextDecoder,f=globalThis.fs,h="";f.writeSync=(c,u)=>{if(c===1)postMessage(u);else if(c===2){h+=g.decode(u);let d=h.split(`
15
+ `);d.length>1&&console.log(d.slice(0,-1).join(`
16
+ `)),h=d[d.length-1]}else throw new Error("Bad write");return u.length};let n=[],s,i=0;onmessage=({data:c})=>{c.length>0&&(n.push(c),s&&s())},f.read=(c,u,d,e,t,o)=>{if(c!==0||d!==0||e!==u.length||t!==null)throw new Error("Bad read");if(n.length===0){s=()=>f.read(c,u,d,e,t,o);return}let a=n[0],m=Math.max(0,Math.min(e,a.length-i));u.set(a.subarray(i,i+m),d),i+=m,i===a.length&&(n.shift(),i=0),o(null,m)};let l=new globalThis.Go;l.argv=["","--service=0.14.36"],r instanceof WebAssembly.Module?WebAssembly.instantiate(r,l.importObject).then(c=>l.run(c)):WebAssembly.instantiate(r,l.importObject).then(({instance:c})=>l.run(c))},r=>onmessage(r);})(m=>u.onmessage({data:m}));u={onmessage:null,postMessage:m=>setTimeout(()=>l({data:m})),terminate(){}}}u.postMessage(s),u.onmessage=({data:l})=>i(l);let{readFromStdout:i,service:c}=et({writeToStdin(l){u.postMessage(l)},isSync:!1,isBrowser:!0,esbuild:Te});qe={build:l=>new Promise((m,O)=>c.buildOrServe({callName:"build",refs:null,serveOptions:null,options:l,isTTY:!1,defaultWD:"/",callback:(N,M)=>N?O(N):m(M)})),transform:(l,m)=>new Promise((O,N)=>c.transform({callName:"transform",refs:null,input:l,options:m||{},isTTY:!1,fs:{readFile(M,P){P(new Error("Internal error"),null)},writeFile(M,P){P(null)}},callback:(M,P)=>M?N(M):O(P)})),formatMessages:(l,m)=>new Promise((O,N)=>c.formatMessages({callName:"formatMessages",refs:null,messages:l,options:m,callback:(M,P)=>M?N(M):O(P)})),analyzeMetafile:(l,m)=>new Promise((O,N)=>c.analyzeMetafile({callName:"analyzeMetafile",refs:null,metafile:typeof l=="string"?l:JSON.stringify(l),options:m,callback:(M,P)=>M?N(M):O(P)}))}}),Nt=Te;
10
17
  })(typeof module==="object"?module:{set exports(x){(typeof self!=="undefined"?self:this).esbuild=x}});
@@ -7,7 +7,7 @@ export type Drop = 'console' | 'debugger';
7
7
 
8
8
  interface CommonOptions {
9
9
  /** Documentation: https://esbuild.github.io/api/#sourcemap */
10
- sourcemap?: boolean | 'inline' | 'external' | 'both';
10
+ sourcemap?: boolean | 'linked' | 'inline' | 'external' | 'both';
11
11
  /** Documentation: https://esbuild.github.io/api/#legal-comments */
12
12
  legalComments?: 'none' | 'inline' | 'eof' | 'linked' | 'external';
13
13
  /** Documentation: https://esbuild.github.io/api/#source-root */
@@ -27,6 +27,8 @@ interface CommonOptions {
27
27
  /** Documentation: https://esbuild.github.io/api/#mangle-props */
28
28
  reserveProps?: RegExp;
29
29
  /** Documentation: https://esbuild.github.io/api/#mangle-props */
30
+ mangleQuoted?: boolean;
31
+ /** Documentation: https://esbuild.github.io/api/#mangle-props */
30
32
  mangleCache?: Record<string, string | false>;
31
33
  /** Documentation: https://esbuild.github.io/api/#drop */
32
34
  drop?: Drop[];
@@ -569,6 +571,16 @@ export interface InitializeOptions {
569
571
  */
570
572
  wasmURL?: string
571
573
 
574
+ /**
575
+ * The result of calling "new WebAssembly.Module(buffer)" where "buffer"
576
+ * is a typed array or ArrayBuffer containing the binary code of the
577
+ * "esbuild.wasm" file.
578
+ *
579
+ * You can use this as an alternative to "wasmURL" for environments where it's
580
+ * not possible to download the WebAssembly module.
581
+ */
582
+ wasmModule?: WebAssembly.Module
583
+
572
584
  /**
573
585
  * By default esbuild runs the WebAssembly-based browser API in a web worker
574
586
  * to avoid blocking the UI thread. This can be disabled by setting "worker"
@@ -21,27 +21,20 @@ var __spreadValues = (a, b) => {
21
21
  return a;
22
22
  };
23
23
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
24
- var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
25
24
  var __export = (target, all) => {
26
25
  for (var name in all)
27
26
  __defProp(target, name, { get: all[name], enumerable: true });
28
27
  };
29
- var __reExport = (target, module2, copyDefault, desc) => {
30
- if (module2 && typeof module2 === "object" || typeof module2 === "function") {
31
- for (let key of __getOwnPropNames(module2))
32
- if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
33
- __defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
28
+ var __copyProps = (to, from, except, desc) => {
29
+ if (from && typeof from === "object" || typeof from === "function") {
30
+ for (let key of __getOwnPropNames(from))
31
+ if (!__hasOwnProp.call(to, key) && key !== except)
32
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
34
33
  }
35
- return target;
36
- };
37
- var __toESM = (module2, isNodeMode) => {
38
- return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
34
+ return to;
39
35
  };
40
- var __toCommonJS = /* @__PURE__ */ ((cache) => {
41
- return (module2, temp) => {
42
- return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
43
- };
44
- })(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
36
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
37
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
45
38
 
46
39
  // lib/npm/node.ts
47
40
  var node_exports = {};
@@ -59,6 +52,7 @@ __export(node_exports, {
59
52
  transformSync: () => transformSync,
60
53
  version: () => version
61
54
  });
55
+ module.exports = __toCommonJS(node_exports);
62
56
 
63
57
  // lib/shared/stdio_protocol.ts
64
58
  function encodePacket(packet) {
@@ -240,6 +234,7 @@ var mustBeInteger = (value) => typeof value === "number" && value === (value | 0
240
234
  var mustBeFunction = (value) => typeof value === "function" ? null : "a function";
241
235
  var mustBeArray = (value) => Array.isArray(value) ? null : "an array";
242
236
  var mustBeObject = (value) => typeof value === "object" && value !== null && !Array.isArray(value) ? null : "an object";
237
+ var mustBeWebAssemblyModule = (value) => value instanceof WebAssembly.Module ? null : "a WebAssembly.Module";
243
238
  var mustBeArrayOrRecord = (value) => typeof value === "object" && value !== null ? null : "an array or an object";
244
239
  var mustBeObjectOrNull = (value) => typeof value === "object" && !Array.isArray(value) ? null : "an object or null";
245
240
  var mustBeStringOrBoolean = (value) => typeof value === "string" || typeof value === "boolean" ? null : "a string or a boolean";
@@ -266,10 +261,12 @@ function checkForInvalidFlags(object, keys, where) {
266
261
  function validateInitializeOptions(options) {
267
262
  let keys = /* @__PURE__ */ Object.create(null);
268
263
  let wasmURL = getFlag(options, keys, "wasmURL", mustBeString);
264
+ let wasmModule = getFlag(options, keys, "wasmModule", mustBeWebAssemblyModule);
269
265
  let worker = getFlag(options, keys, "worker", mustBeBoolean);
270
- checkForInvalidFlags(options, keys, "in startService() call");
266
+ checkForInvalidFlags(options, keys, "in initialize() call");
271
267
  return {
272
268
  wasmURL,
269
+ wasmModule,
273
270
  worker
274
271
  };
275
272
  }
@@ -308,6 +305,7 @@ function pushCommonFlags(flags, options, keys) {
308
305
  let globalName = getFlag(options, keys, "globalName", mustBeString);
309
306
  let mangleProps = getFlag(options, keys, "mangleProps", mustBeRegExp);
310
307
  let reserveProps = getFlag(options, keys, "reserveProps", mustBeRegExp);
308
+ let mangleQuoted = getFlag(options, keys, "mangleQuoted", mustBeBoolean);
311
309
  let minify = getFlag(options, keys, "minify", mustBeBoolean);
312
310
  let minifySyntax = getFlag(options, keys, "minifySyntax", mustBeBoolean);
313
311
  let minifyWhitespace = getFlag(options, keys, "minifyWhitespace", mustBeBoolean);
@@ -359,6 +357,8 @@ function pushCommonFlags(flags, options, keys) {
359
357
  flags.push(`--mangle-props=${mangleProps.source}`);
360
358
  if (reserveProps)
361
359
  flags.push(`--reserve-props=${reserveProps.source}`);
360
+ if (mangleQuoted !== void 0)
361
+ flags.push(`--mangle-quoted=${mangleQuoted}`);
362
362
  if (jsx)
363
363
  flags.push(`--jsx=${jsx}`);
364
364
  if (jsxFactory)
@@ -608,7 +608,7 @@ function createChannel(streamIn) {
608
608
  let pluginCallbacks = /* @__PURE__ */ new Map();
609
609
  let watchCallbacks = /* @__PURE__ */ new Map();
610
610
  let serveCallbacks = /* @__PURE__ */ new Map();
611
- let isClosed = false;
611
+ let closeData = null;
612
612
  let nextRequestID = 0;
613
613
  let nextBuildKey = 0;
614
614
  let stdout = new Uint8Array(16 * 1024);
@@ -637,19 +637,20 @@ function createChannel(streamIn) {
637
637
  stdoutUsed -= offset;
638
638
  }
639
639
  };
640
- let afterClose = () => {
641
- isClosed = true;
640
+ let afterClose = (error) => {
641
+ closeData = { reason: error ? ": " + (error.message || error) : "" };
642
+ const text = "The service was stopped" + closeData.reason;
642
643
  for (let callback of responseCallbacks.values()) {
643
- callback("The service was stopped", null);
644
+ callback(text, null);
644
645
  }
645
646
  responseCallbacks.clear();
646
647
  for (let callbacks of serveCallbacks.values()) {
647
- callbacks.onWait("The service was stopped");
648
+ callbacks.onWait(text);
648
649
  }
649
650
  serveCallbacks.clear();
650
651
  for (let callback of watchCallbacks.values()) {
651
652
  try {
652
- callback(new Error("The service was stopped"), null);
653
+ callback(new Error(text), null);
653
654
  } catch (e) {
654
655
  console.error(e);
655
656
  }
@@ -657,8 +658,8 @@ function createChannel(streamIn) {
657
658
  watchCallbacks.clear();
658
659
  };
659
660
  let sendRequest = (refs, value, callback) => {
660
- if (isClosed)
661
- return callback("The service is no longer running", null);
661
+ if (closeData)
662
+ return callback("The service is no longer running" + closeData.reason, null);
662
663
  let id = nextRequestID++;
663
664
  responseCallbacks.set(id, (error, response) => {
664
665
  try {
@@ -673,8 +674,8 @@ function createChannel(streamIn) {
673
674
  streamIn.writeToStdin(encodePacket({ id, isRequest: true, value }));
674
675
  };
675
676
  let sendResponse = (id, value) => {
676
- if (isClosed)
677
- throw new Error("The service is no longer running");
677
+ if (closeData)
678
+ throw new Error("The service is no longer running" + closeData.reason);
678
679
  streamIn.writeToStdin(encodePacket({ id, isRequest: false, value }));
679
680
  };
680
681
  let handleRequest = async (id, request) => {
@@ -745,8 +746,8 @@ function createChannel(streamIn) {
745
746
  if (isFirstPacket) {
746
747
  isFirstPacket = false;
747
748
  let binaryVersion = String.fromCharCode(...bytes);
748
- if (binaryVersion !== "0.14.23") {
749
- throw new Error(`Cannot start service: Host version "${"0.14.23"}" does not match binary version ${JSON.stringify(binaryVersion)}`);
749
+ if (binaryVersion !== "0.14.36") {
750
+ throw new Error(`Cannot start service: Host version "${"0.14.36"}" does not match binary version ${JSON.stringify(binaryVersion)}`);
750
751
  }
751
752
  return;
752
753
  }
@@ -1251,7 +1252,7 @@ function createChannel(streamIn) {
1251
1252
  if (!rebuild) {
1252
1253
  let isDisposed = false;
1253
1254
  rebuild = () => new Promise((resolve, reject) => {
1254
- if (isDisposed || isClosed)
1255
+ if (isDisposed || closeData)
1255
1256
  throw new Error("Cannot rebuild");
1256
1257
  sendRequest(refs, { command: "rebuild", key }, (error2, response2) => {
1257
1258
  if (error2) {
@@ -1718,9 +1719,13 @@ var knownUnixlikePackages = {
1718
1719
  "openbsd x64 LE": "esbuild-openbsd-64",
1719
1720
  "sunos x64 LE": "esbuild-sunos-64"
1720
1721
  };
1722
+ var knownWebAssemblyFallbackPackages = {
1723
+ "android x64 LE": "esbuild-android-64"
1724
+ };
1721
1725
  function pkgAndSubpathForCurrentPlatform() {
1722
1726
  let pkg;
1723
1727
  let subpath;
1728
+ let isWASM = false;
1724
1729
  let platformKey = `${process.platform} ${os.arch()} ${os.endianness()}`;
1725
1730
  if (platformKey in knownWindowsPackages) {
1726
1731
  pkg = knownWindowsPackages[platformKey];
@@ -1728,10 +1733,14 @@ function pkgAndSubpathForCurrentPlatform() {
1728
1733
  } else if (platformKey in knownUnixlikePackages) {
1729
1734
  pkg = knownUnixlikePackages[platformKey];
1730
1735
  subpath = "bin/esbuild";
1736
+ } else if (platformKey in knownWebAssemblyFallbackPackages) {
1737
+ pkg = knownWebAssemblyFallbackPackages[platformKey];
1738
+ subpath = "bin/esbuild";
1739
+ isWASM = true;
1731
1740
  } else {
1732
1741
  throw new Error(`Unsupported platform: ${platformKey}`);
1733
1742
  }
1734
- return { pkg, subpath };
1743
+ return { pkg, subpath, isWASM };
1735
1744
  }
1736
1745
  function pkgForSomeOtherPlatform() {
1737
1746
  const libMainJS = require.resolve("esbuild");
@@ -1762,9 +1771,9 @@ function downloadedBinPath(pkg, subpath) {
1762
1771
  }
1763
1772
  function generateBinPath() {
1764
1773
  if (ESBUILD_BINARY_PATH) {
1765
- return ESBUILD_BINARY_PATH;
1774
+ return { binPath: ESBUILD_BINARY_PATH, isWASM: false };
1766
1775
  }
1767
- const { pkg, subpath } = pkgAndSubpathForCurrentPlatform();
1776
+ const { pkg, subpath, isWASM } = pkgAndSubpathForCurrentPlatform();
1768
1777
  let binPath;
1769
1778
  try {
1770
1779
  binPath = require.resolve(`${pkg}/${subpath}`);
@@ -1826,9 +1835,9 @@ by esbuild to install the correct binary executable for your current platform.`)
1826
1835
  fs.copyFileSync(binPath, binTargetPath);
1827
1836
  fs.chmodSync(binTargetPath, 493);
1828
1837
  }
1829
- return binTargetPath;
1838
+ return { binPath: binTargetPath, isWASM };
1830
1839
  }
1831
- return binPath;
1840
+ return { binPath, isWASM };
1832
1841
  }
1833
1842
 
1834
1843
  // lib/npm/node.ts
@@ -1850,7 +1859,7 @@ if (process.env.ESBUILD_WORKER_THREADS !== "0") {
1850
1859
  }
1851
1860
  }
1852
1861
  var _a;
1853
- var isInternalWorkerThread = ((_a = worker_threads == null ? void 0 : worker_threads.workerData) == null ? void 0 : _a.esbuildVersion) === "0.14.23";
1862
+ var isInternalWorkerThread = ((_a = worker_threads == null ? void 0 : worker_threads.workerData) == null ? void 0 : _a.esbuildVersion) === "0.14.36";
1854
1863
  var esbuildCommandAndArgs = () => {
1855
1864
  if ((!ESBUILD_BINARY_PATH || true) && (path2.basename(__filename) !== "main.js" || path2.basename(__dirname) !== "lib")) {
1856
1865
  throw new Error(`The esbuild JavaScript API cannot be bundled. Please mark the "esbuild" package as external so it's not included in the bundle.
@@ -1860,7 +1869,12 @@ More information: The file containing the code for esbuild's JavaScript API (${_
1860
1869
  if (true) {
1861
1870
  return ["node", [path2.join(__dirname, "..", "bin", "esbuild")]];
1862
1871
  }
1863
- return [generateBinPath(), []];
1872
+ const { binPath, isWASM } = generateBinPath();
1873
+ if (isWASM) {
1874
+ return ["node", [binPath]];
1875
+ } else {
1876
+ return [binPath, []];
1877
+ }
1864
1878
  };
1865
1879
  var isTTY = () => tty.isatty(2);
1866
1880
  var fsSync = {
@@ -1909,7 +1923,7 @@ var fsAsync = {
1909
1923
  }
1910
1924
  }
1911
1925
  };
1912
- var version = "0.14.23";
1926
+ var version = "0.14.36";
1913
1927
  var build = (options) => ensureServiceIsRunning().build(options);
1914
1928
  var serve = (serveOptions, buildOptions) => ensureServiceIsRunning().serve(serveOptions, buildOptions);
1915
1929
  var transform = (input, options) => ensureServiceIsRunning().transform(input, options);
@@ -2018,7 +2032,7 @@ var ensureServiceIsRunning = () => {
2018
2032
  if (longLivedService)
2019
2033
  return longLivedService;
2020
2034
  let [command, args] = esbuildCommandAndArgs();
2021
- let child = child_process.spawn(command, args.concat(`--service=${"0.14.23"}`, "--ping"), {
2035
+ let child = child_process.spawn(command, args.concat(`--service=${"0.14.36"}`, "--ping"), {
2022
2036
  windowsHide: true,
2023
2037
  stdio: ["pipe", "pipe", "inherit"],
2024
2038
  cwd: defaultWD
@@ -2027,7 +2041,7 @@ var ensureServiceIsRunning = () => {
2027
2041
  writeToStdin(bytes) {
2028
2042
  child.stdin.write(bytes, (err) => {
2029
2043
  if (err)
2030
- afterClose();
2044
+ afterClose(err);
2031
2045
  });
2032
2046
  },
2033
2047
  readFileSync: fs2.readFileSync,
@@ -2036,6 +2050,7 @@ var ensureServiceIsRunning = () => {
2036
2050
  esbuild: node_exports
2037
2051
  });
2038
2052
  child.stdin.on("error", afterClose);
2053
+ child.on("error", afterClose);
2039
2054
  const stdin = child.stdin;
2040
2055
  const stdout = child.stdout;
2041
2056
  stdout.on("data", readFromStdout);
@@ -2131,14 +2146,14 @@ var runServiceSync = (callback) => {
2131
2146
  esbuild: node_exports
2132
2147
  });
2133
2148
  callback(service);
2134
- let stdout = child_process.execFileSync(command, args.concat(`--service=${"0.14.23"}`), {
2149
+ let stdout = child_process.execFileSync(command, args.concat(`--service=${"0.14.36"}`), {
2135
2150
  cwd: defaultWD,
2136
2151
  windowsHide: true,
2137
2152
  input: stdin,
2138
2153
  maxBuffer: +process.env.ESBUILD_MAX_BUFFER || 16 * 1024 * 1024
2139
2154
  });
2140
2155
  readFromStdout(stdout);
2141
- afterClose();
2156
+ afterClose(null);
2142
2157
  };
2143
2158
  var randomFileName = () => {
2144
2159
  return path2.join(os2.tmpdir(), `esbuild-${crypto.randomBytes(32).toString("hex")}`);
@@ -2147,7 +2162,7 @@ var workerThreadService = null;
2147
2162
  var startWorkerThreadService = (worker_threads2) => {
2148
2163
  let { port1: mainPort, port2: workerPort } = new worker_threads2.MessageChannel();
2149
2164
  let worker = new worker_threads2.Worker(__filename, {
2150
- workerData: { workerPort, defaultWD, esbuildVersion: "0.14.23" },
2165
+ workerData: { workerPort, defaultWD, esbuildVersion: "0.14.36" },
2151
2166
  transferList: [workerPort],
2152
2167
  execArgv: []
2153
2168
  });
@@ -2263,7 +2278,6 @@ if (isInternalWorkerThread) {
2263
2278
  startSyncServiceWorker();
2264
2279
  }
2265
2280
  var node_default = node_exports;
2266
- module.exports = __toCommonJS(node_exports);
2267
2281
  // Annotate the CommonJS export names for ESM import in node:
2268
2282
  0 && (module.exports = {
2269
2283
  analyzeMetafile,
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "esbuild-wasm",
3
- "version": "0.14.23",
3
+ "version": "0.14.36",
4
4
  "description": "The cross-platform WebAssembly binary for esbuild, a JavaScript bundler.",
5
5
  "repository": "https://github.com/evanw/esbuild",
6
6
  "license": "MIT",