isomorfeus-asset-manager 0.13.0 → 0.13.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,10 +1,10 @@
1
1
  (exports=>{
2
- var Me=Object.defineProperty,tt=Object.defineProperties;var rt=Object.getOwnPropertyDescriptors;var Ue=Object.getOwnPropertySymbols;var nt=Object.prototype.hasOwnProperty,lt=Object.prototype.propertyIsEnumerable;var qe=(e,t,r)=>t in e?Me(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Be=(e,t)=>{for(var r in t||(t={}))nt.call(t,r)&&qe(e,r,t[r]);if(Ue)for(var r of Ue(t))lt.call(t,r)&&qe(e,r,t[r]);return e},Te=(e,t)=>tt(e,rt(t)),it=e=>Me(e,"__esModule",{value:!0});var st=(e,t)=>{it(e);for(var r in t)Me(e,r,{get:t[r],enumerable:!0})};var ae=(e,t,r)=>new Promise((s,d)=>{var l=m=>{try{i(r.next(m))}catch(R){d(R)}},u=m=>{try{i(r.throw(m))}catch(R){d(R)}},i=m=>m.done?s(m.value):Promise.resolve(m.value).then(l,u);i((r=r.apply(e,t)).next())});st(exports,{analyzeMetafile:()=>vt,analyzeMetafileSync:()=>xt,build:()=>yt,buildSync:()=>Rt,formatMessages:()=>wt,formatMessagesSync:()=>St,initialize:()=>kt,serve:()=>ht,transform:()=>bt,transformSync:()=>Ot,version:()=>mt});function Ae(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(ue(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 d of s)t(d)}else{let d=Object.keys(s);r.write8(6),r.write32(d.length);for(let l of d)r.write(ue(l)),t(s[l])}},r=new Fe;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 We(e){let t=()=>{switch(r.read8()){case 0:return null;case 1:return!!r.read8();case 2:return r.read32();case 3:return fe(r.read());case 4:return r.read();case 5:{let u=r.read32(),i=[];for(let m=0;m<u;m++)i.push(t());return i}case 6:{let u=r.read32(),i={};for(let m=0;m<u;m++)i[fe(r.read())]=t();return i}default:throw new Error("Invalid packet")}},r=new Fe(e),s=r.read32(),d=(s&1)==0;s>>>=1;let l=t();if(r.ptr!==e.length)throw new Error("Invalid packet");return{id:s,isRequest:d,value:l}}var Fe=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 Ne(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}},ue,fe;if(typeof TextEncoder!="undefined"&&typeof TextDecoder!="undefined"){let e=new TextEncoder,t=new TextDecoder;ue=r=>e.encode(r),fe=r=>t.decode(r)}else if(typeof Buffer!="undefined")ue=e=>{let t=Buffer.from(e);return t instanceof Uint8Array||(t=new Uint8Array(t)),t},fe=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 Ne(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 ze(e){if(e+="",e.indexOf(",")>=0)throw new Error(`Invalid target: ${e}`);return e}var Ie=()=>null,L=e=>typeof e=="boolean"?null:"a boolean",ot=e=>typeof e=="boolean"||typeof e=="object"&&!Array.isArray(e)?null:"a boolean or an object",h=e=>typeof e=="string"?null:"a string",Ke=e=>e instanceof RegExp?null:"a RegExp object",me=e=>typeof e=="number"&&e===(e|0)?null:"an integer",Ce=e=>typeof e=="function"?null:"a function",z=e=>Array.isArray(e)?null:"an array",ye=e=>typeof e=="object"&&e!==null&&!Array.isArray(e)?null:"an object",at=e=>typeof e=="object"&&e!==null?null:"an array or an object",_e=e=>typeof e=="object"&&!Array.isArray(e)?null:"an object or null",Ve=e=>typeof e=="string"||typeof e=="boolean"?null:"a string or a boolean",ut=e=>typeof e=="string"||typeof e=="object"&&e!==null&&!Array.isArray(e)?null:"a string or an object",ct=e=>typeof e=="string"||Array.isArray(e)?null:"a string or an array",ft=e=>typeof e=="string"||e instanceof Uint8Array?null:"a string or a Uint8Array";function n(e,t,r,s){let d=e[r];if(t[r+""]=!0,d===void 0)return;let l=s(d);if(l!==null)throw new Error(`"${r}" must be ${l}`);return d}function _(e,t,r){for(let s in e)if(!(s in t))throw new Error(`Invalid option ${r}: "${s}"`)}function Je(e){let t=Object.create(null),r=n(e,t,"wasmURL",h),s=n(e,t,"worker",L);return _(e,t,"in startService() call"),{wasmURL:r,worker:s}}function Oe(e,t,r,s,d){let l=n(t,r,"color",L),u=n(t,r,"logLevel",h),i=n(t,r,"logLimit",me);l!==void 0?e.push(`--color=${l}`):s&&e.push("--color=true"),e.push(`--log-level=${u||d}`),e.push(`--log-limit=${i||0}`)}function Ye(e,t,r){let s=n(t,r,"legalComments",h),d=n(t,r,"sourceRoot",h),l=n(t,r,"sourcesContent",L),u=n(t,r,"target",ct),i=n(t,r,"format",h),m=n(t,r,"globalName",h),R=n(t,r,"minify",L),x=n(t,r,"minifySyntax",L),F=n(t,r,"minifyWhitespace",L),U=n(t,r,"minifyIdentifiers",L),k=n(t,r,"charset",h),q=n(t,r,"treeShaking",L),ee=n(t,r,"ignoreAnnotations",L),G=n(t,r,"jsx",h),te=n(t,r,"jsxFactory",h),re=n(t,r,"jsxFragment",h),le=n(t,r,"define",ye),ie=n(t,r,"pure",z),ce=n(t,r,"keepNames",L);if(s&&e.push(`--legal-comments=${s}`),d!==void 0&&e.push(`--source-root=${d}`),l!==void 0&&e.push(`--sources-content=${l}`),u&&(Array.isArray(u)?e.push(`--target=${Array.from(u).map(ze).join(",")}`):e.push(`--target=${ze(u)}`)),i&&e.push(`--format=${i}`),m&&e.push(`--global-name=${m}`),R&&e.push("--minify"),x&&e.push("--minify-syntax"),F&&e.push("--minify-whitespace"),U&&e.push("--minify-identifiers"),k&&e.push(`--charset=${k}`),q!==void 0&&e.push(`--tree-shaking=${q}`),ee&&e.push("--ignore-annotations"),G&&e.push(`--jsx=${G}`),te&&e.push(`--jsx-factory=${te}`),re&&e.push(`--jsx-fragment=${re}`),le)for(let Q in le){if(Q.indexOf("=")>=0)throw new Error(`Invalid define: ${Q}`);e.push(`--define:${Q}=${le[Q]}`)}if(ie)for(let Q of ie)e.push(`--pure:${Q}`);ce&&e.push("--keep-names")}function dt(e,t,r,s,d){var w;let l=[],u=[],i=Object.create(null),m=null,R=null,x=null;Oe(l,t,i,r,s),Ye(l,t,i);let F=n(t,i,"sourcemap",Ve),U=n(t,i,"bundle",L),k=n(t,i,"watch",ot),q=n(t,i,"splitting",L),ee=n(t,i,"preserveSymlinks",L),G=n(t,i,"metafile",L),te=n(t,i,"outfile",h),re=n(t,i,"outdir",h),le=n(t,i,"outbase",h),ie=n(t,i,"platform",h),ce=n(t,i,"tsconfig",h),Q=n(t,i,"resolveExtensions",z),Re=n(t,i,"nodePaths",z),Ee=n(t,i,"mainFields",z),$e=n(t,i,"conditions",z),De=n(t,i,"external",z),g=n(t,i,"loader",ye),c=n(t,i,"outExtension",ye),o=n(t,i,"publicPath",h),p=n(t,i,"entryNames",h),j=n(t,i,"chunkNames",h),M=n(t,i,"assetNames",h),P=n(t,i,"inject",z),N=n(t,i,"banner",ye),D=n(t,i,"footer",ye),E=n(t,i,"entryPoints",at),O=n(t,i,"absWorkingDir",h),B=n(t,i,"stdin",ye),T=(w=n(t,i,"write",L))!=null?w:d,S=n(t,i,"allowOverwrite",L),$=n(t,i,"incremental",L)===!0;if(i.plugins=!0,_(t,i,`in ${e}() call`),F&&l.push(`--sourcemap${F===!0?"":`=${F}`}`),U&&l.push("--bundle"),S&&l.push("--allow-overwrite"),k)if(l.push("--watch"),typeof k=="boolean")x={};else{let a=Object.create(null),b=n(k,a,"onRebuild",Ce);_(k,a,`on "watch" in ${e}() call`),x={onRebuild:b}}if(q&&l.push("--splitting"),ee&&l.push("--preserve-symlinks"),G&&l.push("--metafile"),te&&l.push(`--outfile=${te}`),re&&l.push(`--outdir=${re}`),le&&l.push(`--outbase=${le}`),ie&&l.push(`--platform=${ie}`),ce&&l.push(`--tsconfig=${ce}`),Q){let a=[];for(let b of Q){if(b+="",b.indexOf(",")>=0)throw new Error(`Invalid resolve extension: ${b}`);a.push(b)}l.push(`--resolve-extensions=${a.join(",")}`)}if(o&&l.push(`--public-path=${o}`),p&&l.push(`--entry-names=${p}`),j&&l.push(`--chunk-names=${j}`),M&&l.push(`--asset-names=${M}`),Ee){let a=[];for(let b of Ee){if(b+="",b.indexOf(",")>=0)throw new Error(`Invalid main field: ${b}`);a.push(b)}l.push(`--main-fields=${a.join(",")}`)}if($e){let a=[];for(let b of $e){if(b+="",b.indexOf(",")>=0)throw new Error(`Invalid condition: ${b}`);a.push(b)}l.push(`--conditions=${a.join(",")}`)}if(De)for(let a of De)l.push(`--external:${a}`);if(N)for(let a in N){if(a.indexOf("=")>=0)throw new Error(`Invalid banner file type: ${a}`);l.push(`--banner:${a}=${N[a]}`)}if(D)for(let a in D){if(a.indexOf("=")>=0)throw new Error(`Invalid footer file type: ${a}`);l.push(`--footer:${a}=${D[a]}`)}if(P)for(let a of P)l.push(`--inject:${a}`);if(g)for(let a in g){if(a.indexOf("=")>=0)throw new Error(`Invalid loader extension: ${a}`);l.push(`--loader:${a}=${g[a]}`)}if(c)for(let a in c){if(a.indexOf("=")>=0)throw new Error(`Invalid out extension: ${a}`);l.push(`--out-extension:${a}=${c[a]}`)}if(E)if(Array.isArray(E))for(let a of E)u.push(["",a+""]);else for(let[a,b]of Object.entries(E))u.push([a+"",b+""]);if(B){let a=Object.create(null),b=n(B,a,"contents",h),C=n(B,a,"resolveDir",h),f=n(B,a,"sourcefile",h),v=n(B,a,"loader",h);_(B,a,'in "stdin" object'),f&&l.push(`--sourcefile=${f}`),v&&l.push(`--loader=${v}`),C&&(R=C+""),m=b?b+"":""}let y=[];if(Re)for(let a of Re)a+="",y.push(a);return{entries:u,flags:l,write:T,stdinContents:m,stdinResolveDir:R,absWorkingDir:O,incremental:$,nodePaths:y,watch:x}}function pt(e,t,r,s){let d=[],l=Object.create(null);Oe(d,t,l,r,s),Ye(d,t,l);let u=n(t,l,"sourcemap",Ve),i=n(t,l,"tsconfigRaw",ut),m=n(t,l,"sourcefile",h),R=n(t,l,"loader",h),x=n(t,l,"banner",h),F=n(t,l,"footer",h);return _(t,l,`in ${e}() call`),u&&d.push(`--sourcemap=${u===!0?"external":u}`),i&&d.push(`--tsconfig-raw=${typeof i=="string"?i:JSON.stringify(i)}`),m&&d.push(`--sourcefile=${m}`),R&&d.push(`--loader=${R}`),x&&d.push(`--banner=${x}`),F&&d.push(`--footer=${F}`),d}function He(e){let t=new Map,r=new Map,s=new Map,d=new Map,l=0,u=!1,i=0,m=0,R=new Uint8Array(16*1024),x=0,F=g=>{let c=x+g.length;if(c>R.length){let p=new Uint8Array(c*2);p.set(R),R=p}R.set(g,x),x+=g.length;let o=0;for(;o+4<=x;){let p=Ne(R,o);if(o+4+p>x)break;o+=4,te(R.subarray(o,o+p)),o+=p}o>0&&(R.copyWithin(0,o,x),x-=o)},U=()=>{u=!0;for(let g of t.values())g("The service was stopped",null);t.clear();for(let g of d.values())g.onWait("The service was stopped");d.clear();for(let g of s.values())try{g(new Error("The service was stopped"),null)}catch(c){console.error(c)}s.clear()},k=(g,c,o)=>{if(u)return o("The service is no longer running",null);let p=i++;t.set(p,(j,M)=>{try{o(j,M)}finally{g&&g.unref()}}),g&&g.ref(),e.writeToStdin(Ae({id:p,isRequest:!0,value:c}))},q=(g,c)=>{if(u)throw new Error("The service is no longer running");e.writeToStdin(Ae({id:g,isRequest:!1,value:c}))},ee=(g,c)=>ae(this,null,function*(){try{switch(c.command){case"ping":{q(g,{});break}case"start":{let o=r.get(c.key);o?q(g,yield o(c)):q(g,{});break}case"resolve":{let o=r.get(c.key);o?q(g,yield o(c)):q(g,{});break}case"load":{let o=r.get(c.key);o?q(g,yield o(c)):q(g,{});break}case"serve-request":{let o=d.get(c.serveID);o&&o.onRequest&&o.onRequest(c.args),q(g,{});break}case"serve-wait":{let o=d.get(c.serveID);o&&o.onWait(c.error),q(g,{});break}case"watch-rebuild":{let o=s.get(c.watchID);try{o&&o(null,c.args)}catch(p){console.error(p)}q(g,{});break}default:throw new Error("Invalid command: "+c.command)}}catch(o){q(g,{errors:[he(o,e,null,void 0,"")]})}}),G=!0,te=g=>{if(G){G=!1;let o=String.fromCharCode(...g);if(o!=="0.13.4")throw new Error(`Cannot start service: Host version "0.13.4" does not match binary version ${JSON.stringify(o)}`);return}let c=We(g);if(c.isRequest)ee(c.id,c.value);else{let o=t.get(c.id);t.delete(c.id),c.value.error?o(c.value.error,{}):o(null,c.value)}},re=(g,c,o,p)=>ae(this,null,function*(){let j=[],M=[],P={},N={},D=0,E=0,O=[];c=[...c];for(let $ of c){let y={};if(typeof $!="object")throw new Error(`Plugin at index ${E} must be an object`);let w=n($,y,"name",h);if(typeof w!="string"||w==="")throw new Error(`Plugin at index ${E} is missing a name`);try{let a=n($,y,"setup",Ce);if(typeof a!="function")throw new Error("Plugin is missing a setup function");_($,y,`on plugin ${JSON.stringify(w)}`);let b={name:w,onResolve:[],onLoad:[]};E++;let C=a({initialOptions:g,onStart(f){let v='This error came from the "onStart" callback registered here',W=Se(new Error(v),e,"onStart");j.push({name:w,callback:f,note:W})},onEnd(f){let v='This error came from the "onEnd" callback registered here',W=Se(new Error(v),e,"onEnd");M.push({name:w,callback:f,note:W})},onResolve(f,v){let W='This error came from the "onResolve" callback registered here',I=Se(new Error(W),e,"onResolve"),K={},V=n(f,K,"filter",Ke),Y=n(f,K,"namespace",h);if(_(f,K,`in onResolve() call for plugin ${JSON.stringify(w)}`),V==null)throw new Error("onResolve() call is missing a filter");let J=D++;P[J]={name:w,callback:v,note:I},b.onResolve.push({id:J,filter:V.source,namespace:Y||""})},onLoad(f,v){let W='This error came from the "onLoad" callback registered here',I=Se(new Error(W),e,"onLoad"),K={},V=n(f,K,"filter",Ke),Y=n(f,K,"namespace",h);if(_(f,K,`in onLoad() call for plugin ${JSON.stringify(w)}`),V==null)throw new Error("onLoad() call is missing a filter");let J=D++;N[J]={name:w,callback:v,note:I},b.onLoad.push({id:J,filter:V.source,namespace:Y||""})}});C&&(yield C),O.push(b)}catch(a){return{ok:!1,error:a,pluginName:w}}}let B=$=>ae(this,null,function*(){switch($.command){case"start":{let y={errors:[],warnings:[]};return yield Promise.all(j.map(C=>ae(this,[C],function*({name:w,callback:a,note:b}){try{let f=yield a();if(f!=null){if(typeof f!="object")throw new Error(`Expected onStart() callback in plugin ${JSON.stringify(w)} to return an object`);let v={},W=n(f,v,"errors",z),I=n(f,v,"warnings",z);_(f,v,`from onStart() callback in plugin ${JSON.stringify(w)}`),W!=null&&y.errors.push(...de(W,"errors",p,w)),I!=null&&y.warnings.push(...de(I,"warnings",p,w))}}catch(f){y.errors.push(he(f,e,p,b&&b(),w))}}))),y}case"resolve":{let y={},w="",a,b;for(let C of $.ids)try{({name:w,callback:a,note:b}=P[C]);let f=yield a({path:$.path,importer:$.importer,namespace:$.namespace,resolveDir:$.resolveDir,kind:$.kind,pluginData:p.load($.pluginData)});if(f!=null){if(typeof f!="object")throw new Error(`Expected onResolve() callback in plugin ${JSON.stringify(w)} to return an object`);let v={},W=n(f,v,"pluginName",h),I=n(f,v,"path",h),K=n(f,v,"namespace",h),V=n(f,v,"external",L),Y=n(f,v,"sideEffects",L),J=n(f,v,"pluginData",Ie),se=n(f,v,"errors",z),oe=n(f,v,"warnings",z),A=n(f,v,"watchFiles",z),H=n(f,v,"watchDirs",z);_(f,v,`from onResolve() callback in plugin ${JSON.stringify(w)}`),y.id=C,W!=null&&(y.pluginName=W),I!=null&&(y.path=I),K!=null&&(y.namespace=K),V!=null&&(y.external=V),Y!=null&&(y.sideEffects=Y),J!=null&&(y.pluginData=p.store(J)),se!=null&&(y.errors=de(se,"errors",p,w)),oe!=null&&(y.warnings=de(oe,"warnings",p,w)),A!=null&&(y.watchFiles=xe(A,"watchFiles")),H!=null&&(y.watchDirs=xe(H,"watchDirs"));break}}catch(f){return{id:C,errors:[he(f,e,p,b&&b(),w)]}}return y}case"load":{let y={},w="",a,b;for(let C of $.ids)try{({name:w,callback:a,note:b}=N[C]);let f=yield a({path:$.path,namespace:$.namespace,pluginData:p.load($.pluginData)});if(f!=null){if(typeof f!="object")throw new Error(`Expected onLoad() callback in plugin ${JSON.stringify(w)} to return an object`);let v={},W=n(f,v,"pluginName",h),I=n(f,v,"contents",ft),K=n(f,v,"resolveDir",h),V=n(f,v,"pluginData",Ie),Y=n(f,v,"loader",h),J=n(f,v,"errors",z),se=n(f,v,"warnings",z),oe=n(f,v,"watchFiles",z),A=n(f,v,"watchDirs",z);_(f,v,`from onLoad() callback in plugin ${JSON.stringify(w)}`),y.id=C,W!=null&&(y.pluginName=W),I instanceof Uint8Array?y.contents=I:I!=null&&(y.contents=ue(I)),K!=null&&(y.resolveDir=K),V!=null&&(y.pluginData=p.store(V)),Y!=null&&(y.loader=Y),J!=null&&(y.errors=de(J,"errors",p,w)),se!=null&&(y.warnings=de(se,"warnings",p,w)),oe!=null&&(y.watchFiles=xe(oe,"watchFiles")),A!=null&&(y.watchDirs=xe(A,"watchDirs"));break}}catch(f){return{id:C,errors:[he(f,e,p,b&&b(),w)]}}return y}default:throw new Error("Invalid command: "+$.command)}}),T=($,y,w)=>w();M.length>0&&(T=($,y,w)=>{(()=>ae(this,null,function*(){for(let{name:a,callback:b,note:C}of M)try{yield b($)}catch(f){$.errors.push(yield new Promise(v=>y(f,a,C&&C(),v)))}}))().then(w)});let S=0;return{ok:!0,requestPlugins:O,runOnEndCallbacks:T,pluginRefs:{ref(){++S==1&&r.set(o,B)},unref(){--S==0&&r.delete(o)}}}}),le=(g,c,o)=>{let p={},j=n(c,p,"port",me),M=n(c,p,"host",h),P=n(c,p,"servedir",h),N=n(c,p,"onRequest",Ce),D=l++,E,O=new Promise((B,T)=>{E=S=>{d.delete(D),S!==null?T(new Error(S)):B()}});return o.serve={serveID:D},_(c,p,"in serve() call"),j!==void 0&&(o.serve.port=j),M!==void 0&&(o.serve.host=M),P!==void 0&&(o.serve.servedir=P),d.set(D,{onRequest:N,onWait:E}),{wait:O,stop(){k(g,{command:"serve-stop",serveID:D},()=>{})}}},ie="warning",ce="silent",Q=g=>{let c=m++,o=Ge(),p,{refs:j,options:M,isTTY:P,callback:N}=g;if(typeof M=="object"){let O=M.plugins;if(O!==void 0){if(!Array.isArray(O))throw new Error('"plugins" must be an array');p=O}}let D=(O,B,T,S)=>{let $=[];try{Oe($,M,{},P,ie)}catch(w){}let y=he(O,e,o,T,B);k(j,{command:"error",flags:$,error:y},()=>{y.detail=o.load(y.detail),S(y)})},E=(O,B)=>{D(O,B,void 0,T=>{N(be("Build failed",[T],[]),null)})};if(p&&p.length>0){if(e.isSync)return E(new Error("Cannot use plugins in synchronous API calls"),"");re(M,p,c,o).then(O=>{if(!O.ok)E(O.error,O.pluginName);else try{Re(Te(Be({},g),{key:c,details:o,logPluginError:D,requestPlugins:O.requestPlugins,runOnEndCallbacks:O.runOnEndCallbacks,pluginRefs:O.pluginRefs}))}catch(B){E(B,"")}},O=>E(O,""))}else try{Re(Te(Be({},g),{key:c,details:o,logPluginError:D,requestPlugins:null,runOnEndCallbacks:(O,B,T)=>T(),pluginRefs:null}))}catch(O){E(O,"")}},Re=({callName:g,refs:c,serveOptions:o,options:p,isTTY:j,defaultWD:M,callback:P,key:N,details:D,logPluginError:E,requestPlugins:O,runOnEndCallbacks:B,pluginRefs:T})=>{let S={ref(){T&&T.ref(),c&&c.ref()},unref(){T&&T.unref(),c&&c.unref()}},$=!e.isBrowser,{entries:y,flags:w,write:a,stdinContents:b,stdinResolveDir:C,absWorkingDir:f,incremental:v,nodePaths:W,watch:I}=dt(g,p,j,ie,$),K={command:"build",key:N,entries:y,flags:w,write:a,stdinContents:b,stdinResolveDir:C,absWorkingDir:f||M,incremental:v,nodePaths:W};O&&(K.plugins=O);let V=o&&le(S,o,K),Y,J,se=(A,H)=>{A.outputFiles&&(H.outputFiles=A.outputFiles.map(gt)),A.metafile&&(H.metafile=JSON.parse(A.metafile)),A.writeToStdout!==void 0&&console.log(fe(A.writeToStdout).replace(/\n$/,""))},oe=(A,H)=>{let X={errors:we(A.errors,D),warnings:we(A.warnings,D)};se(A,X),B(X,E,()=>{if(X.errors.length>0)return H(be("Build failed",X.errors,X.warnings),null);if(A.rebuildID!==void 0){if(!Y){let ne=!1;Y=()=>new Promise((pe,ge)=>{if(ne||u)throw new Error("Cannot rebuild");k(S,{command:"rebuild",rebuildID:A.rebuildID},(Z,Ze)=>{if(Z)return H(be("Build failed",[{pluginName:"",text:Z,location:null,notes:[],detail:void 0}],[]),null);oe(Ze,(Pe,et)=>{Pe?ge(Pe):pe(et)})})}),S.ref(),Y.dispose=()=>{ne||(ne=!0,k(S,{command:"rebuild-dispose",rebuildID:A.rebuildID},()=>{}),S.unref())}}X.rebuild=Y}if(A.watchID!==void 0){if(!J){let ne=!1;S.ref(),J=()=>{ne||(ne=!0,s.delete(A.watchID),k(S,{command:"watch-stop",watchID:A.watchID},()=>{}),S.unref())},I&&s.set(A.watchID,(pe,ge)=>{if(pe){I.onRebuild&&I.onRebuild(pe,null);return}let Z={errors:we(ge.errors,D),warnings:we(ge.warnings,D)};se(ge,Z),B(Z,E,()=>{if(Z.errors.length>0){I.onRebuild&&I.onRebuild(be("Build failed",Z.errors,Z.warnings),null);return}ge.rebuildID!==void 0&&(Z.rebuild=Y),Z.stop=J,I.onRebuild&&I.onRebuild(null,Z)})})}X.stop=J}H(null,X)})};if(a&&e.isBrowser)throw new Error('Cannot enable "write" in the browser');if(v&&e.isSync)throw new Error('Cannot use "incremental" with a synchronous build');if(I&&e.isSync)throw new Error('Cannot use "watch" with a synchronous build');k(S,K,(A,H)=>{if(A)return P(new Error(A),null);if(V){let X=H,ne=!1;S.ref();let pe={port:X.port,host:X.host,wait:V.wait,stop(){ne||(ne=!0,V.stop(),S.unref())}};return S.ref(),V.wait.then(S.unref,S.unref),P(null,pe)}return oe(H,P)})};return{readFromStdout:F,afterClose:U,service:{buildOrServe:Q,transform:({callName:g,refs:c,input:o,options:p,isTTY:j,fs:M,callback:P})=>{let N=Ge(),D=E=>{try{if(typeof o!="string")throw new Error('The input to "transform" must be a string');let O=pt(g,p,j,ce);k(c,{command:"transform",flags:O,inputFS:E!==null,input:E!==null?E:o},(T,S)=>{if(T)return P(new Error(T),null);let $=we(S.errors,N),y=we(S.warnings,N),w=1,a=()=>--w==0&&P(null,{warnings:y,code:S.code,map:S.map});if($.length>0)return P(be("Transform failed",$,y),null);S.codeFS&&(w++,M.readFile(S.code,(b,C)=>{b!==null?P(b,null):(S.code=C,a())})),S.mapFS&&(w++,M.readFile(S.map,(b,C)=>{b!==null?P(b,null):(S.map=C,a())})),a()})}catch(O){let B=[];try{Oe(B,p,{},j,ce)}catch(S){}let T=he(O,e,N,void 0,"");k(c,{command:"error",flags:B,error:T},()=>{T.detail=N.load(T.detail),P(be("Transform failed",[T],[]),null)})}};if(typeof o=="string"&&o.length>1024*1024){let E=D;D=()=>M.writeFile(o,E)}D(null)},formatMessages:({callName:g,refs:c,messages:o,options:p,callback:j})=>{let M=de(o,"messages",null,"");if(!p)throw new Error(`Missing second argument in ${g}() call`);let P={},N=n(p,P,"kind",h),D=n(p,P,"color",L),E=n(p,P,"terminalWidth",me);if(_(p,P,`in ${g}() call`),N===void 0)throw new Error(`Missing "kind" in ${g}() call`);if(N!=="error"&&N!=="warning")throw new Error(`Expected "kind" to be "error" or "warning" in ${g}() call`);let O={command:"format-msgs",messages:M,isWarning:N==="warning"};D!==void 0&&(O.color=D),E!==void 0&&(O.terminalWidth=E),k(c,O,(B,T)=>{if(B)return j(new Error(B),null);j(null,T.messages)})},analyzeMetafile:({callName:g,refs:c,metafile:o,options:p,callback:j})=>{p===void 0&&(p={});let M={},P=n(p,M,"color",L),N=n(p,M,"verbose",L);_(p,M,`in ${g}() call`);let D={command:"analyze-metafile",metafile:o};P!==void 0&&(D.color=P),N!==void 0&&(D.verbose=N),k(c,D,(E,O)=>{if(E)return j(new Error(E),null);j(null,O.result)})}}}}function Ge(){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 Se(e,t,r){let s,d=!1;return()=>{if(d)return s;d=!0;try{let l=(e.stack+"").split(`
2
+ var Me=Object.defineProperty,tt=Object.defineProperties;var rt=Object.getOwnPropertyDescriptors;var Ue=Object.getOwnPropertySymbols;var nt=Object.prototype.hasOwnProperty,lt=Object.prototype.propertyIsEnumerable;var qe=(e,t,r)=>t in e?Me(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Be=(e,t)=>{for(var r in t||(t={}))nt.call(t,r)&&qe(e,r,t[r]);if(Ue)for(var r of Ue(t))lt.call(t,r)&&qe(e,r,t[r]);return e},Te=(e,t)=>tt(e,rt(t)),it=e=>Me(e,"__esModule",{value:!0});var st=(e,t)=>{it(e);for(var r in t)Me(e,r,{get:t[r],enumerable:!0})};var ae=(e,t,r)=>new Promise((s,d)=>{var l=m=>{try{i(r.next(m))}catch(R){d(R)}},u=m=>{try{i(r.throw(m))}catch(R){d(R)}},i=m=>m.done?s(m.value):Promise.resolve(m.value).then(l,u);i((r=r.apply(e,t)).next())});st(exports,{analyzeMetafile:()=>vt,analyzeMetafileSync:()=>xt,build:()=>yt,buildSync:()=>Rt,formatMessages:()=>wt,formatMessagesSync:()=>St,initialize:()=>kt,serve:()=>ht,transform:()=>bt,transformSync:()=>Ot,version:()=>mt});function Ae(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(ue(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 d of s)t(d)}else{let d=Object.keys(s);r.write8(6),r.write32(d.length);for(let l of d)r.write(ue(l)),t(s[l])}},r=new Fe;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 We(e){let t=()=>{switch(r.read8()){case 0:return null;case 1:return!!r.read8();case 2:return r.read32();case 3:return fe(r.read());case 4:return r.read();case 5:{let u=r.read32(),i=[];for(let m=0;m<u;m++)i.push(t());return i}case 6:{let u=r.read32(),i={};for(let m=0;m<u;m++)i[fe(r.read())]=t();return i}default:throw new Error("Invalid packet")}},r=new Fe(e),s=r.read32(),d=(s&1)==0;s>>>=1;let l=t();if(r.ptr!==e.length)throw new Error("Invalid packet");return{id:s,isRequest:d,value:l}}var Fe=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 Ne(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}},ue,fe;if(typeof TextEncoder!="undefined"&&typeof TextDecoder!="undefined"){let e=new TextEncoder,t=new TextDecoder;ue=r=>e.encode(r),fe=r=>t.decode(r)}else if(typeof Buffer!="undefined")ue=e=>{let t=Buffer.from(e);return t instanceof Uint8Array||(t=new Uint8Array(t)),t},fe=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 Ne(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 ze(e){if(e+="",e.indexOf(",")>=0)throw new Error(`Invalid target: ${e}`);return e}var Ie=()=>null,L=e=>typeof e=="boolean"?null:"a boolean",ot=e=>typeof e=="boolean"||typeof e=="object"&&!Array.isArray(e)?null:"a boolean or an object",h=e=>typeof e=="string"?null:"a string",Ke=e=>e instanceof RegExp?null:"a RegExp object",me=e=>typeof e=="number"&&e===(e|0)?null:"an integer",Ce=e=>typeof e=="function"?null:"a function",z=e=>Array.isArray(e)?null:"an array",ye=e=>typeof e=="object"&&e!==null&&!Array.isArray(e)?null:"an object",at=e=>typeof e=="object"&&e!==null?null:"an array or an object",_e=e=>typeof e=="object"&&!Array.isArray(e)?null:"an object or null",Ve=e=>typeof e=="string"||typeof e=="boolean"?null:"a string or a boolean",ut=e=>typeof e=="string"||typeof e=="object"&&e!==null&&!Array.isArray(e)?null:"a string or an object",ct=e=>typeof e=="string"||Array.isArray(e)?null:"a string or an array",ft=e=>typeof e=="string"||e instanceof Uint8Array?null:"a string or a Uint8Array";function n(e,t,r,s){let d=e[r];if(t[r+""]=!0,d===void 0)return;let l=s(d);if(l!==null)throw new Error(`"${r}" must be ${l}`);return d}function _(e,t,r){for(let s in e)if(!(s in t))throw new Error(`Invalid option ${r}: "${s}"`)}function Je(e){let t=Object.create(null),r=n(e,t,"wasmURL",h),s=n(e,t,"worker",L);return _(e,t,"in startService() call"),{wasmURL:r,worker:s}}function Oe(e,t,r,s,d){let l=n(t,r,"color",L),u=n(t,r,"logLevel",h),i=n(t,r,"logLimit",me);l!==void 0?e.push(`--color=${l}`):s&&e.push("--color=true"),e.push(`--log-level=${u||d}`),e.push(`--log-limit=${i||0}`)}function Ye(e,t,r){let s=n(t,r,"legalComments",h),d=n(t,r,"sourceRoot",h),l=n(t,r,"sourcesContent",L),u=n(t,r,"target",ct),i=n(t,r,"format",h),m=n(t,r,"globalName",h),R=n(t,r,"minify",L),x=n(t,r,"minifySyntax",L),F=n(t,r,"minifyWhitespace",L),U=n(t,r,"minifyIdentifiers",L),k=n(t,r,"charset",h),q=n(t,r,"treeShaking",L),ee=n(t,r,"ignoreAnnotations",L),G=n(t,r,"jsx",h),te=n(t,r,"jsxFactory",h),re=n(t,r,"jsxFragment",h),le=n(t,r,"define",ye),ie=n(t,r,"pure",z),ce=n(t,r,"keepNames",L);if(s&&e.push(`--legal-comments=${s}`),d!==void 0&&e.push(`--source-root=${d}`),l!==void 0&&e.push(`--sources-content=${l}`),u&&(Array.isArray(u)?e.push(`--target=${Array.from(u).map(ze).join(",")}`):e.push(`--target=${ze(u)}`)),i&&e.push(`--format=${i}`),m&&e.push(`--global-name=${m}`),R&&e.push("--minify"),x&&e.push("--minify-syntax"),F&&e.push("--minify-whitespace"),U&&e.push("--minify-identifiers"),k&&e.push(`--charset=${k}`),q!==void 0&&e.push(`--tree-shaking=${q}`),ee&&e.push("--ignore-annotations"),G&&e.push(`--jsx=${G}`),te&&e.push(`--jsx-factory=${te}`),re&&e.push(`--jsx-fragment=${re}`),le)for(let Q in le){if(Q.indexOf("=")>=0)throw new Error(`Invalid define: ${Q}`);e.push(`--define:${Q}=${le[Q]}`)}if(ie)for(let Q of ie)e.push(`--pure:${Q}`);ce&&e.push("--keep-names")}function dt(e,t,r,s,d){var w;let l=[],u=[],i=Object.create(null),m=null,R=null,x=null;Oe(l,t,i,r,s),Ye(l,t,i);let F=n(t,i,"sourcemap",Ve),U=n(t,i,"bundle",L),k=n(t,i,"watch",ot),q=n(t,i,"splitting",L),ee=n(t,i,"preserveSymlinks",L),G=n(t,i,"metafile",L),te=n(t,i,"outfile",h),re=n(t,i,"outdir",h),le=n(t,i,"outbase",h),ie=n(t,i,"platform",h),ce=n(t,i,"tsconfig",h),Q=n(t,i,"resolveExtensions",z),Re=n(t,i,"nodePaths",z),Ee=n(t,i,"mainFields",z),$e=n(t,i,"conditions",z),De=n(t,i,"external",z),g=n(t,i,"loader",ye),c=n(t,i,"outExtension",ye),o=n(t,i,"publicPath",h),p=n(t,i,"entryNames",h),j=n(t,i,"chunkNames",h),M=n(t,i,"assetNames",h),P=n(t,i,"inject",z),N=n(t,i,"banner",ye),D=n(t,i,"footer",ye),E=n(t,i,"entryPoints",at),O=n(t,i,"absWorkingDir",h),B=n(t,i,"stdin",ye),T=(w=n(t,i,"write",L))!=null?w:d,S=n(t,i,"allowOverwrite",L),$=n(t,i,"incremental",L)===!0;if(i.plugins=!0,_(t,i,`in ${e}() call`),F&&l.push(`--sourcemap${F===!0?"":`=${F}`}`),U&&l.push("--bundle"),S&&l.push("--allow-overwrite"),k)if(l.push("--watch"),typeof k=="boolean")x={};else{let a=Object.create(null),b=n(k,a,"onRebuild",Ce);_(k,a,`on "watch" in ${e}() call`),x={onRebuild:b}}if(q&&l.push("--splitting"),ee&&l.push("--preserve-symlinks"),G&&l.push("--metafile"),te&&l.push(`--outfile=${te}`),re&&l.push(`--outdir=${re}`),le&&l.push(`--outbase=${le}`),ie&&l.push(`--platform=${ie}`),ce&&l.push(`--tsconfig=${ce}`),Q){let a=[];for(let b of Q){if(b+="",b.indexOf(",")>=0)throw new Error(`Invalid resolve extension: ${b}`);a.push(b)}l.push(`--resolve-extensions=${a.join(",")}`)}if(o&&l.push(`--public-path=${o}`),p&&l.push(`--entry-names=${p}`),j&&l.push(`--chunk-names=${j}`),M&&l.push(`--asset-names=${M}`),Ee){let a=[];for(let b of Ee){if(b+="",b.indexOf(",")>=0)throw new Error(`Invalid main field: ${b}`);a.push(b)}l.push(`--main-fields=${a.join(",")}`)}if($e){let a=[];for(let b of $e){if(b+="",b.indexOf(",")>=0)throw new Error(`Invalid condition: ${b}`);a.push(b)}l.push(`--conditions=${a.join(",")}`)}if(De)for(let a of De)l.push(`--external:${a}`);if(N)for(let a in N){if(a.indexOf("=")>=0)throw new Error(`Invalid banner file type: ${a}`);l.push(`--banner:${a}=${N[a]}`)}if(D)for(let a in D){if(a.indexOf("=")>=0)throw new Error(`Invalid footer file type: ${a}`);l.push(`--footer:${a}=${D[a]}`)}if(P)for(let a of P)l.push(`--inject:${a}`);if(g)for(let a in g){if(a.indexOf("=")>=0)throw new Error(`Invalid loader extension: ${a}`);l.push(`--loader:${a}=${g[a]}`)}if(c)for(let a in c){if(a.indexOf("=")>=0)throw new Error(`Invalid out extension: ${a}`);l.push(`--out-extension:${a}=${c[a]}`)}if(E)if(Array.isArray(E))for(let a of E)u.push(["",a+""]);else for(let[a,b]of Object.entries(E))u.push([a+"",b+""]);if(B){let a=Object.create(null),b=n(B,a,"contents",h),C=n(B,a,"resolveDir",h),f=n(B,a,"sourcefile",h),v=n(B,a,"loader",h);_(B,a,'in "stdin" object'),f&&l.push(`--sourcefile=${f}`),v&&l.push(`--loader=${v}`),C&&(R=C+""),m=b?b+"":""}let y=[];if(Re)for(let a of Re)a+="",y.push(a);return{entries:u,flags:l,write:T,stdinContents:m,stdinResolveDir:R,absWorkingDir:O,incremental:$,nodePaths:y,watch:x}}function pt(e,t,r,s){let d=[],l=Object.create(null);Oe(d,t,l,r,s),Ye(d,t,l);let u=n(t,l,"sourcemap",Ve),i=n(t,l,"tsconfigRaw",ut),m=n(t,l,"sourcefile",h),R=n(t,l,"loader",h),x=n(t,l,"banner",h),F=n(t,l,"footer",h);return _(t,l,`in ${e}() call`),u&&d.push(`--sourcemap=${u===!0?"external":u}`),i&&d.push(`--tsconfig-raw=${typeof i=="string"?i:JSON.stringify(i)}`),m&&d.push(`--sourcefile=${m}`),R&&d.push(`--loader=${R}`),x&&d.push(`--banner=${x}`),F&&d.push(`--footer=${F}`),d}function He(e){let t=new Map,r=new Map,s=new Map,d=new Map,l=0,u=!1,i=0,m=0,R=new Uint8Array(16*1024),x=0,F=g=>{let c=x+g.length;if(c>R.length){let p=new Uint8Array(c*2);p.set(R),R=p}R.set(g,x),x+=g.length;let o=0;for(;o+4<=x;){let p=Ne(R,o);if(o+4+p>x)break;o+=4,te(R.subarray(o,o+p)),o+=p}o>0&&(R.copyWithin(0,o,x),x-=o)},U=()=>{u=!0;for(let g of t.values())g("The service was stopped",null);t.clear();for(let g of d.values())g.onWait("The service was stopped");d.clear();for(let g of s.values())try{g(new Error("The service was stopped"),null)}catch(c){console.error(c)}s.clear()},k=(g,c,o)=>{if(u)return o("The service is no longer running",null);let p=i++;t.set(p,(j,M)=>{try{o(j,M)}finally{g&&g.unref()}}),g&&g.ref(),e.writeToStdin(Ae({id:p,isRequest:!0,value:c}))},q=(g,c)=>{if(u)throw new Error("The service is no longer running");e.writeToStdin(Ae({id:g,isRequest:!1,value:c}))},ee=(g,c)=>ae(this,null,function*(){try{switch(c.command){case"ping":{q(g,{});break}case"start":{let o=r.get(c.key);o?q(g,yield o(c)):q(g,{});break}case"resolve":{let o=r.get(c.key);o?q(g,yield o(c)):q(g,{});break}case"load":{let o=r.get(c.key);o?q(g,yield o(c)):q(g,{});break}case"serve-request":{let o=d.get(c.serveID);o&&o.onRequest&&o.onRequest(c.args),q(g,{});break}case"serve-wait":{let o=d.get(c.serveID);o&&o.onWait(c.error),q(g,{});break}case"watch-rebuild":{let o=s.get(c.watchID);try{o&&o(null,c.args)}catch(p){console.error(p)}q(g,{});break}default:throw new Error("Invalid command: "+c.command)}}catch(o){q(g,{errors:[he(o,e,null,void 0,"")]})}}),G=!0,te=g=>{if(G){G=!1;let o=String.fromCharCode(...g);if(o!=="0.13.13")throw new Error(`Cannot start service: Host version "0.13.13" does not match binary version ${JSON.stringify(o)}`);return}let c=We(g);if(c.isRequest)ee(c.id,c.value);else{let o=t.get(c.id);t.delete(c.id),c.value.error?o(c.value.error,{}):o(null,c.value)}},re=(g,c,o,p)=>ae(this,null,function*(){let j=[],M=[],P={},N={},D=0,E=0,O=[];c=[...c];for(let $ of c){let y={};if(typeof $!="object")throw new Error(`Plugin at index ${E} must be an object`);let w=n($,y,"name",h);if(typeof w!="string"||w==="")throw new Error(`Plugin at index ${E} is missing a name`);try{let a=n($,y,"setup",Ce);if(typeof a!="function")throw new Error("Plugin is missing a setup function");_($,y,`on plugin ${JSON.stringify(w)}`);let b={name:w,onResolve:[],onLoad:[]};E++;let C=a({initialOptions:g,onStart(f){let v='This error came from the "onStart" callback registered here',W=Se(new Error(v),e,"onStart");j.push({name:w,callback:f,note:W})},onEnd(f){let v='This error came from the "onEnd" callback registered here',W=Se(new Error(v),e,"onEnd");M.push({name:w,callback:f,note:W})},onResolve(f,v){let W='This error came from the "onResolve" callback registered here',I=Se(new Error(W),e,"onResolve"),K={},V=n(f,K,"filter",Ke),Y=n(f,K,"namespace",h);if(_(f,K,`in onResolve() call for plugin ${JSON.stringify(w)}`),V==null)throw new Error("onResolve() call is missing a filter");let J=D++;P[J]={name:w,callback:v,note:I},b.onResolve.push({id:J,filter:V.source,namespace:Y||""})},onLoad(f,v){let W='This error came from the "onLoad" callback registered here',I=Se(new Error(W),e,"onLoad"),K={},V=n(f,K,"filter",Ke),Y=n(f,K,"namespace",h);if(_(f,K,`in onLoad() call for plugin ${JSON.stringify(w)}`),V==null)throw new Error("onLoad() call is missing a filter");let J=D++;N[J]={name:w,callback:v,note:I},b.onLoad.push({id:J,filter:V.source,namespace:Y||""})}});C&&(yield C),O.push(b)}catch(a){return{ok:!1,error:a,pluginName:w}}}let B=$=>ae(this,null,function*(){switch($.command){case"start":{let y={errors:[],warnings:[]};return yield Promise.all(j.map(C=>ae(this,[C],function*({name:w,callback:a,note:b}){try{let f=yield a();if(f!=null){if(typeof f!="object")throw new Error(`Expected onStart() callback in plugin ${JSON.stringify(w)} to return an object`);let v={},W=n(f,v,"errors",z),I=n(f,v,"warnings",z);_(f,v,`from onStart() callback in plugin ${JSON.stringify(w)}`),W!=null&&y.errors.push(...de(W,"errors",p,w)),I!=null&&y.warnings.push(...de(I,"warnings",p,w))}}catch(f){y.errors.push(he(f,e,p,b&&b(),w))}}))),y}case"resolve":{let y={},w="",a,b;for(let C of $.ids)try{({name:w,callback:a,note:b}=P[C]);let f=yield a({path:$.path,importer:$.importer,namespace:$.namespace,resolveDir:$.resolveDir,kind:$.kind,pluginData:p.load($.pluginData)});if(f!=null){if(typeof f!="object")throw new Error(`Expected onResolve() callback in plugin ${JSON.stringify(w)} to return an object`);let v={},W=n(f,v,"pluginName",h),I=n(f,v,"path",h),K=n(f,v,"namespace",h),V=n(f,v,"external",L),Y=n(f,v,"sideEffects",L),J=n(f,v,"pluginData",Ie),se=n(f,v,"errors",z),oe=n(f,v,"warnings",z),A=n(f,v,"watchFiles",z),H=n(f,v,"watchDirs",z);_(f,v,`from onResolve() callback in plugin ${JSON.stringify(w)}`),y.id=C,W!=null&&(y.pluginName=W),I!=null&&(y.path=I),K!=null&&(y.namespace=K),V!=null&&(y.external=V),Y!=null&&(y.sideEffects=Y),J!=null&&(y.pluginData=p.store(J)),se!=null&&(y.errors=de(se,"errors",p,w)),oe!=null&&(y.warnings=de(oe,"warnings",p,w)),A!=null&&(y.watchFiles=xe(A,"watchFiles")),H!=null&&(y.watchDirs=xe(H,"watchDirs"));break}}catch(f){return{id:C,errors:[he(f,e,p,b&&b(),w)]}}return y}case"load":{let y={},w="",a,b;for(let C of $.ids)try{({name:w,callback:a,note:b}=N[C]);let f=yield a({path:$.path,namespace:$.namespace,pluginData:p.load($.pluginData)});if(f!=null){if(typeof f!="object")throw new Error(`Expected onLoad() callback in plugin ${JSON.stringify(w)} to return an object`);let v={},W=n(f,v,"pluginName",h),I=n(f,v,"contents",ft),K=n(f,v,"resolveDir",h),V=n(f,v,"pluginData",Ie),Y=n(f,v,"loader",h),J=n(f,v,"errors",z),se=n(f,v,"warnings",z),oe=n(f,v,"watchFiles",z),A=n(f,v,"watchDirs",z);_(f,v,`from onLoad() callback in plugin ${JSON.stringify(w)}`),y.id=C,W!=null&&(y.pluginName=W),I instanceof Uint8Array?y.contents=I:I!=null&&(y.contents=ue(I)),K!=null&&(y.resolveDir=K),V!=null&&(y.pluginData=p.store(V)),Y!=null&&(y.loader=Y),J!=null&&(y.errors=de(J,"errors",p,w)),se!=null&&(y.warnings=de(se,"warnings",p,w)),oe!=null&&(y.watchFiles=xe(oe,"watchFiles")),A!=null&&(y.watchDirs=xe(A,"watchDirs"));break}}catch(f){return{id:C,errors:[he(f,e,p,b&&b(),w)]}}return y}default:throw new Error("Invalid command: "+$.command)}}),T=($,y,w)=>w();M.length>0&&(T=($,y,w)=>{(()=>ae(this,null,function*(){for(let{name:a,callback:b,note:C}of M)try{yield b($)}catch(f){$.errors.push(yield new Promise(v=>y(f,a,C&&C(),v)))}}))().then(w)});let S=0;return{ok:!0,requestPlugins:O,runOnEndCallbacks:T,pluginRefs:{ref(){++S==1&&r.set(o,B)},unref(){--S==0&&r.delete(o)}}}}),le=(g,c,o)=>{let p={},j=n(c,p,"port",me),M=n(c,p,"host",h),P=n(c,p,"servedir",h),N=n(c,p,"onRequest",Ce),D=l++,E,O=new Promise((B,T)=>{E=S=>{d.delete(D),S!==null?T(new Error(S)):B()}});return o.serve={serveID:D},_(c,p,"in serve() call"),j!==void 0&&(o.serve.port=j),M!==void 0&&(o.serve.host=M),P!==void 0&&(o.serve.servedir=P),d.set(D,{onRequest:N,onWait:E}),{wait:O,stop(){k(g,{command:"serve-stop",serveID:D},()=>{})}}},ie="warning",ce="silent",Q=g=>{let c=m++,o=Ge(),p,{refs:j,options:M,isTTY:P,callback:N}=g;if(typeof M=="object"){let O=M.plugins;if(O!==void 0){if(!Array.isArray(O))throw new Error('"plugins" must be an array');p=O}}let D=(O,B,T,S)=>{let $=[];try{Oe($,M,{},P,ie)}catch(w){}let y=he(O,e,o,T,B);k(j,{command:"error",flags:$,error:y},()=>{y.detail=o.load(y.detail),S(y)})},E=(O,B)=>{D(O,B,void 0,T=>{N(be("Build failed",[T],[]),null)})};if(p&&p.length>0){if(e.isSync)return E(new Error("Cannot use plugins in synchronous API calls"),"");re(M,p,c,o).then(O=>{if(!O.ok)E(O.error,O.pluginName);else try{Re(Te(Be({},g),{key:c,details:o,logPluginError:D,requestPlugins:O.requestPlugins,runOnEndCallbacks:O.runOnEndCallbacks,pluginRefs:O.pluginRefs}))}catch(B){E(B,"")}},O=>E(O,""))}else try{Re(Te(Be({},g),{key:c,details:o,logPluginError:D,requestPlugins:null,runOnEndCallbacks:(O,B,T)=>T(),pluginRefs:null}))}catch(O){E(O,"")}},Re=({callName:g,refs:c,serveOptions:o,options:p,isTTY:j,defaultWD:M,callback:P,key:N,details:D,logPluginError:E,requestPlugins:O,runOnEndCallbacks:B,pluginRefs:T})=>{let S={ref(){T&&T.ref(),c&&c.ref()},unref(){T&&T.unref(),c&&c.unref()}},$=!e.isBrowser,{entries:y,flags:w,write:a,stdinContents:b,stdinResolveDir:C,absWorkingDir:f,incremental:v,nodePaths:W,watch:I}=dt(g,p,j,ie,$),K={command:"build",key:N,entries:y,flags:w,write:a,stdinContents:b,stdinResolveDir:C,absWorkingDir:f||M,incremental:v,nodePaths:W};O&&(K.plugins=O);let V=o&&le(S,o,K),Y,J,se=(A,H)=>{A.outputFiles&&(H.outputFiles=A.outputFiles.map(gt)),A.metafile&&(H.metafile=JSON.parse(A.metafile)),A.writeToStdout!==void 0&&console.log(fe(A.writeToStdout).replace(/\n$/,""))},oe=(A,H)=>{let X={errors:we(A.errors,D),warnings:we(A.warnings,D)};se(A,X),B(X,E,()=>{if(X.errors.length>0)return H(be("Build failed",X.errors,X.warnings),null);if(A.rebuildID!==void 0){if(!Y){let ne=!1;Y=()=>new Promise((pe,ge)=>{if(ne||u)throw new Error("Cannot rebuild");k(S,{command:"rebuild",rebuildID:A.rebuildID},(Z,Ze)=>{if(Z)return H(be("Build failed",[{pluginName:"",text:Z,location:null,notes:[],detail:void 0}],[]),null);oe(Ze,(Pe,et)=>{Pe?ge(Pe):pe(et)})})}),S.ref(),Y.dispose=()=>{ne||(ne=!0,k(S,{command:"rebuild-dispose",rebuildID:A.rebuildID},()=>{}),S.unref())}}X.rebuild=Y}if(A.watchID!==void 0){if(!J){let ne=!1;S.ref(),J=()=>{ne||(ne=!0,s.delete(A.watchID),k(S,{command:"watch-stop",watchID:A.watchID},()=>{}),S.unref())},I&&s.set(A.watchID,(pe,ge)=>{if(pe){I.onRebuild&&I.onRebuild(pe,null);return}let Z={errors:we(ge.errors,D),warnings:we(ge.warnings,D)};se(ge,Z),B(Z,E,()=>{if(Z.errors.length>0){I.onRebuild&&I.onRebuild(be("Build failed",Z.errors,Z.warnings),null);return}ge.rebuildID!==void 0&&(Z.rebuild=Y),Z.stop=J,I.onRebuild&&I.onRebuild(null,Z)})})}X.stop=J}H(null,X)})};if(a&&e.isBrowser)throw new Error('Cannot enable "write" in the browser');if(v&&e.isSync)throw new Error('Cannot use "incremental" with a synchronous build');if(I&&e.isSync)throw new Error('Cannot use "watch" with a synchronous build');k(S,K,(A,H)=>{if(A)return P(new Error(A),null);if(V){let X=H,ne=!1;S.ref();let pe={port:X.port,host:X.host,wait:V.wait,stop(){ne||(ne=!0,V.stop(),S.unref())}};return S.ref(),V.wait.then(S.unref,S.unref),P(null,pe)}return oe(H,P)})};return{readFromStdout:F,afterClose:U,service:{buildOrServe:Q,transform:({callName:g,refs:c,input:o,options:p,isTTY:j,fs:M,callback:P})=>{let N=Ge(),D=E=>{try{if(typeof o!="string")throw new Error('The input to "transform" must be a string');let O=pt(g,p,j,ce);k(c,{command:"transform",flags:O,inputFS:E!==null,input:E!==null?E:o},(T,S)=>{if(T)return P(new Error(T),null);let $=we(S.errors,N),y=we(S.warnings,N),w=1,a=()=>--w==0&&P(null,{warnings:y,code:S.code,map:S.map});if($.length>0)return P(be("Transform failed",$,y),null);S.codeFS&&(w++,M.readFile(S.code,(b,C)=>{b!==null?P(b,null):(S.code=C,a())})),S.mapFS&&(w++,M.readFile(S.map,(b,C)=>{b!==null?P(b,null):(S.map=C,a())})),a()})}catch(O){let B=[];try{Oe(B,p,{},j,ce)}catch(S){}let T=he(O,e,N,void 0,"");k(c,{command:"error",flags:B,error:T},()=>{T.detail=N.load(T.detail),P(be("Transform failed",[T],[]),null)})}};if(typeof o=="string"&&o.length>1024*1024){let E=D;D=()=>M.writeFile(o,E)}D(null)},formatMessages:({callName:g,refs:c,messages:o,options:p,callback:j})=>{let M=de(o,"messages",null,"");if(!p)throw new Error(`Missing second argument in ${g}() call`);let P={},N=n(p,P,"kind",h),D=n(p,P,"color",L),E=n(p,P,"terminalWidth",me);if(_(p,P,`in ${g}() call`),N===void 0)throw new Error(`Missing "kind" in ${g}() call`);if(N!=="error"&&N!=="warning")throw new Error(`Expected "kind" to be "error" or "warning" in ${g}() call`);let O={command:"format-msgs",messages:M,isWarning:N==="warning"};D!==void 0&&(O.color=D),E!==void 0&&(O.terminalWidth=E),k(c,O,(B,T)=>{if(B)return j(new Error(B),null);j(null,T.messages)})},analyzeMetafile:({callName:g,refs:c,metafile:o,options:p,callback:j})=>{p===void 0&&(p={});let M={},P=n(p,M,"color",L),N=n(p,M,"verbose",L);_(p,M,`in ${g}() call`);let D={command:"analyze-metafile",metafile:o};P!==void 0&&(D.color=P),N!==void 0&&(D.verbose=N),k(c,D,(E,O)=>{if(E)return j(new Error(E),null);j(null,O.result)})}}}}function Ge(){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 Se(e,t,r){let s,d=!1;return()=>{if(d)return s;d=!0;try{let l=(e.stack+"").split(`
3
3
  `);l.splice(1,1);let u=Qe(t,l,r);if(u)return s={text:e.message,location:u},s}catch(l){}}}function he(e,t,r,s,d){let l="Internal error",u=null;try{l=(e&&e.message||e)+""}catch(i){}try{u=Qe(t,(e.stack+"").split(`
4
4
  `),"")}catch(i){}return{pluginName:d,text:l,location:u,notes:s?[s]:[],detail:r?r.store(e):-1}}function Qe(e,t,r){let s=" at ";if(e.readFileSync&&!t[0].startsWith(s)&&t[1].startsWith(s))for(let d=1;d<t.length;d++){let l=t[d];if(!!l.startsWith(s))for(l=l.slice(s.length);;){let u=/^(?:new |async )?\S+ \((.*)\)$/.exec(l);if(u){l=u[1];continue}if(u=/^eval at \S+ \((.*)\)(?:, \S+:\d+:\d+)?$/.exec(l),u){l=u[1];continue}if(u=/^(\S+):(\d+):(\d+)$/.exec(l),u){let i;try{i=e.readFileSync(u[1],"utf8")}catch(F){break}let m=i.split(/\r\n|\r|\n|\u2028|\u2029/)[+u[2]-1]||"",R=+u[3]-1,x=m.slice(R,R+r.length)===r?r.length:0;return{file:u[1],namespace:"file",line:+u[2],column:ue(m.slice(0,R)).length,length:ue(m.slice(R,R+x)).length,lineText:m+`
5
5
  `+t.slice(1).join(`
6
6
  `),suggestion:""}}break}}return null}function be(e,t,r){let s=5,d=t.length<1?"":` with ${t.length} error${t.length<2?"":"s"}:`+t.slice(0,s+1).map((u,i)=>{if(i===s)return`
7
7
  ...`;if(!u.location)return`
8
8
  error: ${u.text}`;let{file:m,line:R,column:x}=u.location,F=u.pluginName?`[plugin: ${u.pluginName}] `:"";return`
9
- ${m}:${R}:${x}: error: ${F}${u.text}`}).join(""),l=new Error(`${e}${d}`);return l.errors=t,l.warnings=r,l}function we(e,t){for(let r of e)r.detail=t.load(r.detail);return e}function Xe(e,t){if(e==null)return null;let r={},s=n(e,r,"file",h),d=n(e,r,"namespace",h),l=n(e,r,"line",me),u=n(e,r,"column",me),i=n(e,r,"length",me),m=n(e,r,"lineText",h),R=n(e,r,"suggestion",h);return _(e,r,t),{file:s||"",namespace:d||"",line:l||0,column:u||0,length:i||0,lineText:m||"",suggestion:R||""}}function de(e,t,r,s){let d=[],l=0;for(let u of e){let i={},m=n(u,i,"pluginName",h),R=n(u,i,"text",h),x=n(u,i,"location",_e),F=n(u,i,"notes",z),U=n(u,i,"detail",Ie),k=`in element ${l} of "${t}"`;_(u,i,k);let q=[];if(F)for(let ee of F){let G={},te=n(ee,G,"text",h),re=n(ee,G,"location",_e);_(ee,G,k),q.push({text:te||"",location:Xe(re,k)})}d.push({pluginName:m||s,text:R||"",location:Xe(x,k),notes:q,detail:r?r.store(U):-1}),l++}return d}function xe(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 gt({path:e,contents:t}){let r=null;return{path:e,contents:t,get text(){return r===null&&(r=fe(t)),r}}}var mt="0.13.4",yt=e=>ke().build(e),ht=()=>{throw new Error('The "serve" API only works in node')},bt=(e,t)=>ke().transform(e,t),wt=(e,t)=>ke().formatMessages(e,t),vt=(e,t)=>ke().analyzeMetafile(e,t),Rt=()=>{throw new Error('The "buildSync" API only works in node')},Ot=()=>{throw new Error('The "transformSync" API only works in node')},St=()=>{throw new Error('The "formatMessagesSync" API only works in node')},xt=()=>{throw new Error('The "analyzeMetafileSync" API only works in node')},ve,Le,ke=()=>{if(Le)return Le;throw ve?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')},kt=e=>{e=Je(e||{});let t=e.wasmURL,r=e.worker!==!1;if(!t)throw new Error('Must provide the "wasmURL" option');if(t+="",ve)throw new Error('Cannot call "initialize" more than once');return ve=Et(t,r),ve.catch(()=>{ve=void 0}),ve},Et=(e,t)=>ae(void 0,null,function*(){let r=yield fetch(e);if(!r.ok)throw new Error(`Failed to download ${JSON.stringify(e)}`);let s=yield r.arrayBuffer(),d='{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 y=(l,g,d)=>new Promise((r,i)=>{var s=m=>{try{o(d.next(m))}catch(u){i(u)}},n=m=>{try{o(d.throw(m))}catch(u){i(u)}},o=m=>m.done?r(m.value):Promise.resolve(m.value).then(s,n);o((d=d.apply(l,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(i,s,n,o,m,u){if(n===0&&o===s.length&&m===null){if(i===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(i===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(i,s,n,o,m,u)}}))}const l=()=>{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(i,s){r+=d.decode(s);const n=r.lastIndexOf(`\n`);return n!=-1&&(console.log(r.substr(0,n)),r=r.substr(n+1)),s.length},write(i,s,n,o,m,u){if(n!==0||o!==s.length||m!==null){u(l());return}const h=this.writeSync(i,s);u(null,h)},chmod(i,s,n){n(l())},chown(i,s,n,o){o(l())},close(i,s){s(l())},fchmod(i,s,n){n(l())},fchown(i,s,n,o){o(l())},fstat(i,s){s(l())},fsync(i,s){s(null)},ftruncate(i,s,n){n(l())},lchown(i,s,n,o){o(l())},link(i,s,n){n(l())},lstat(i,s){s(l())},mkdir(i,s,n){n(l())},open(i,s,n,o){o(l())},read(i,s,n,o,m,u){u(l())},readdir(i,s){s(l())},readlink(i,s){s(l())},rename(i,s,n){n(l())},rmdir(i,s){s(l())},stat(i,s){s(l())},symlink(i,s,n){n(l())},truncate(i,s,n){n(l())},unlink(i,s){s(l())},utimes(i,s,n,o){o(l())}}}if(global.process||(global.process={getuid(){return-1},getgid(){return-1},geteuid(){return-1},getegid(){return-1},getgroups(){throw l()},pid:-1,ppid:-1,umask(){throw l()},cwd(){throw l()},chdir(){throw l()}}),!global.crypto&&global.require){const r=require("crypto");global.crypto={getRandomValues(i){r.randomFillSync(i)}}}if(!global.crypto)throw new Error("global.crypto is not available, polyfill required (getRandomValues only)");if(global.performance||(global.performance={now(){const[r,i]=process.hrtime();return r*1e3+i/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 g=new TextEncoder("utf-8"),d=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)},i=e=>{const t=this.mem.getUint32(e+0,!0),a=this.mem.getInt32(e+4,!0);return t+a*4294967296},s=e=>{const t=this.mem.getFloat64(e,!0);if(t===0)return;if(!isNaN(t))return t;const a=this.mem.getUint32(e,!0);return this._values[a]},n=(e,t)=>{const a=2146959360;if(typeof t=="number"&&t!==0){if(isNaN(t)){this.mem.setUint32(e+4,a,!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 f=0;switch(typeof t){case"object":t!==null&&(f=1);break;case"string":f=2;break;case"symbol":f=3;break;case"function":f=4;break}this.mem.setUint32(e+4,a|f,!0),this.mem.setUint32(e,c,!0)},o=e=>{const t=i(e+0),a=i(e+8);return new Uint8Array(this._inst.exports.mem.buffer,t,a)},m=e=>{const t=i(e+0),a=i(e+8),c=new Array(a);for(let f=0;f<a;f++)c[f]=s(t+f*8);return c},u=e=>{const t=i(e+0),a=i(e+8);return d.decode(new DataView(this._inst.exports.mem.buffer,t,a))},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=i(e+8),a=i(e+16),c=this.mem.getInt32(e+24,!0);fs.writeSync(t,new Uint8Array(this._inst.exports.mem.buffer,a,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()},i(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 a=this._values[t];this._values[t]=null,this._ids.delete(a),this._idPool.push(t)}},"syscall/js.stringVal":e=>{e>>>=0,n(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,n(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,n(e+24,Reflect.get(s(e+8),i(e+16)))},"syscall/js.valueSetIndex":e=>{e>>>=0,Reflect.set(s(e+8),i(e+16),s(e+24))},"syscall/js.valueCall":e=>{e>>>=0;try{const t=s(e+8),a=Reflect.get(t,u(e+16)),c=m(e+32),f=Reflect.apply(a,t,c);e=this._inst.exports.getsp()>>>0,n(e+56,f),this.mem.setUint8(e+64,1)}catch(t){e=this._inst.exports.getsp()>>>0,n(e+56,t),this.mem.setUint8(e+64,0)}},"syscall/js.valueInvoke":e=>{e>>>=0;try{const t=s(e+8),a=m(e+16),c=Reflect.apply(t,void 0,a);e=this._inst.exports.getsp()>>>0,n(e+40,c),this.mem.setUint8(e+48,1)}catch(t){e=this._inst.exports.getsp()>>>0,n(e+40,t),this.mem.setUint8(e+48,0)}},"syscall/js.valueNew":e=>{e>>>=0;try{const t=s(e+8),a=m(e+16),c=Reflect.construct(t,a);e=this._inst.exports.getsp()>>>0,n(e+40,c),this.mem.setUint8(e+48,1)}catch(t){e=this._inst.exports.getsp()>>>0,n(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=g.encode(String(s(e+8)));n(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),a=s(e+32);if(!(a instanceof Uint8Array||a instanceof Uint8ClampedArray)){this.mem.setUint8(e+48,0);return}const c=a.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),a=o(e+16);if(!(t instanceof Uint8Array||t instanceof Uint8ClampedArray)){this.mem.setUint8(e+48,0);return}const c=a.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 y(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 i=4096;const s=h=>{const e=i,t=g.encode(h+"\\0");return new Uint8Array(this.mem.buffer,i,t.length).set(t),i+=t.length,i%8!=0&&(i+=8-i%8),e},n=this.argv.length,o=[];this.argv.forEach(h=>{o.push(s(h))}),o.push(0),Object.keys(this.env).sort().forEach(h=>{o.push(s(`${h}=${this.env[h]}`))}),o.push(0);const u=i;o.forEach(h=>{this.mem.setUint32(i,h,!0),this.mem.setUint32(i+4,0,!0),i+=8}),this._inst.exports.run(n,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 i=this;return function(){const s={id:r,this:this,args:arguments};return i._pendingEvent=s,i._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(fs.readFileSync(process.argv[2]),r.importObject).then(i=>(process.on("exit",s=>{s===0&&!r.exited&&(r._pendingEvent={id:0},r._resume())}),r.run(i.instance))).catch(i=>{console.error(i),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.13.4"],WebAssembly.instantiate(c,o.importObject).then(({instance:e})=>o.run(e))};}',l;if(t){let m=new Blob([d],{type:"text/javascript"});l=new Worker(URL.createObjectURL(m))}else{let R=new Function("postMessage",d+"var onmessage; return m => onmessage(m)")(x=>l.onmessage({data:x}));l={onmessage:null,postMessage:x=>R({data:x}),terminate(){}}}l.postMessage(s),l.onmessage=({data:m})=>u(m);let{readFromStdout:u,service:i}=He({writeToStdin(m){l.postMessage(m)},isSync:!1,isBrowser:!0});Le={build:m=>new Promise((R,x)=>i.buildOrServe({callName:"build",refs:null,serveOptions:null,options:m,isTTY:!1,defaultWD:"/",callback:(F,U)=>F?x(F):R(U)})),transform:(m,R)=>new Promise((x,F)=>i.transform({callName:"transform",refs:null,input:m,options:R||{},isTTY:!1,fs:{readFile(U,k){k(new Error("Internal error"),null)},writeFile(U,k){k(null)}},callback:(U,k)=>U?F(U):x(k)})),formatMessages:(m,R)=>new Promise((x,F)=>i.formatMessages({callName:"formatMessages",refs:null,messages:m,options:R,callback:(U,k)=>U?F(U):x(k)})),analyzeMetafile:(m,R)=>new Promise((x,F)=>i.analyzeMetafile({callName:"analyzeMetafile",refs:null,metafile:typeof m=="string"?m:JSON.stringify(m),options:R,callback:(U,k)=>U?F(U):x(k)}))}});
9
+ ${m}:${R}:${x}: error: ${F}${u.text}`}).join(""),l=new Error(`${e}${d}`);return l.errors=t,l.warnings=r,l}function we(e,t){for(let r of e)r.detail=t.load(r.detail);return e}function Xe(e,t){if(e==null)return null;let r={},s=n(e,r,"file",h),d=n(e,r,"namespace",h),l=n(e,r,"line",me),u=n(e,r,"column",me),i=n(e,r,"length",me),m=n(e,r,"lineText",h),R=n(e,r,"suggestion",h);return _(e,r,t),{file:s||"",namespace:d||"",line:l||0,column:u||0,length:i||0,lineText:m||"",suggestion:R||""}}function de(e,t,r,s){let d=[],l=0;for(let u of e){let i={},m=n(u,i,"pluginName",h),R=n(u,i,"text",h),x=n(u,i,"location",_e),F=n(u,i,"notes",z),U=n(u,i,"detail",Ie),k=`in element ${l} of "${t}"`;_(u,i,k);let q=[];if(F)for(let ee of F){let G={},te=n(ee,G,"text",h),re=n(ee,G,"location",_e);_(ee,G,k),q.push({text:te||"",location:Xe(re,k)})}d.push({pluginName:m||s,text:R||"",location:Xe(x,k),notes:q,detail:r?r.store(U):-1}),l++}return d}function xe(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 gt({path:e,contents:t}){let r=null;return{path:e,contents:t,get text(){return r===null&&(r=fe(t)),r}}}var mt="0.13.13",yt=e=>ke().build(e),ht=()=>{throw new Error('The "serve" API only works in node')},bt=(e,t)=>ke().transform(e,t),wt=(e,t)=>ke().formatMessages(e,t),vt=(e,t)=>ke().analyzeMetafile(e,t),Rt=()=>{throw new Error('The "buildSync" API only works in node')},Ot=()=>{throw new Error('The "transformSync" API only works in node')},St=()=>{throw new Error('The "formatMessagesSync" API only works in node')},xt=()=>{throw new Error('The "analyzeMetafileSync" API only works in node')},ve,Le,ke=()=>{if(Le)return Le;throw ve?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')},kt=e=>{e=Je(e||{});let t=e.wasmURL,r=e.worker!==!1;if(!t)throw new Error('Must provide the "wasmURL" option');if(t+="",ve)throw new Error('Cannot call "initialize" more than once');return ve=Et(t,r),ve.catch(()=>{ve=void 0}),ve},Et=(e,t)=>ae(void 0,null,function*(){let r=yield fetch(e);if(!r.ok)throw new Error(`Failed to download ${JSON.stringify(e)}`);let s=yield r.arrayBuffer(),d='{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 y=(a,g,f)=>new Promise((r,n)=>{var s=h=>{try{l(f.next(h))}catch(u){n(u)}},i=h=>{try{l(f.throw(h))}catch(u){n(u)}},l=h=>h.done?r(h.value):Promise.resolve(h.value).then(s,i);l((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,l,h,u){if(i===0&&l===s.length&&h===null){if(n===process.stdout.fd){try{process.stdout.write(s,m=>m?u(m,0,null):u(null,l,s))}catch(m){u(m,0,null)}return}if(n===process.stderr.fd){try{process.stderr.write(s,m=>m?u(m,0,null):u(null,l,s))}catch(m){u(m,0,null)}return}}r.write(n,s,i,l,h,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+=f.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,l,h,u){if(i!==0||l!==s.length||h!==null){u(a());return}const m=this.writeSync(n,s);u(null,m)},chmod(n,s,i){i(a())},chown(n,s,i,l){l(a())},close(n,s){s(a())},fchmod(n,s,i){i(a())},fchown(n,s,i,l){l(a())},fstat(n,s){s(a())},fsync(n,s){s(null)},ftruncate(n,s,i){i(a())},lchown(n,s,i,l){l(a())},link(n,s,i){i(a())},lstat(n,s){s(a())},mkdir(n,s,i){i(a())},open(n,s,i,l){l(a())},read(n,s,i,l,h,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,l){l(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 g=new TextEncoder("utf-8"),f=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),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)=>{const o=2146959360;if(typeof t=="number"&&t!==0){if(isNaN(t)){this.mem.setUint32(e+4,o,!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,o|d,!0),this.mem.setUint32(e,c,!0)},l=e=>{const t=n(e+0),o=n(e+8);return new Uint8Array(this._inst.exports.mem.buffer,t,o)},h=e=>{const t=n(e+0),o=n(e+8),c=new Array(o);for(let d=0;d<o;d++)c[d]=s(t+d*8);return c},u=e=>{const t=n(e+0),o=n(e+8);return f.decode(new DataView(this._inst.exports.mem.buffer,t,o))},m=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),c=this.mem.getInt32(e+24,!0);fs.writeSync(t,new Uint8Array(this._inst.exports.mem.buffer,o,c))},"runtime.resetMemoryDataView":e=>{e>>>=0,this.mem=new DataView(this._inst.exports.mem.buffer)},"runtime.nanotime1":e=>{e>>>=0,r(e+8,(m+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(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)),c=h(e+32),d=Reflect.apply(o,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),o=h(e+16),c=Reflect.apply(t,void 0,o);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),o=h(e+16),c=Reflect.construct(t,o);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=g.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);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 c=o.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),o=l(e+16);if(!(t instanceof Uint8Array||t instanceof Uint8ClampedArray)){this.mem.setUint8(e+48,0);return}const c=o.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 y(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,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 m=4096+4096;if(n>=m)throw new Error("command line too long");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(fs.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.13.13"],WebAssembly.instantiate(c,o.importObject).then(({instance:e})=>o.run(e))};}',l;if(t){let m=new Blob([d],{type:"text/javascript"});l=new Worker(URL.createObjectURL(m))}else{let R=new Function("postMessage",d+"var onmessage; return m => onmessage(m)")(x=>l.onmessage({data:x}));l={onmessage:null,postMessage:x=>R({data:x}),terminate(){}}}l.postMessage(s),l.onmessage=({data:m})=>u(m);let{readFromStdout:u,service:i}=He({writeToStdin(m){l.postMessage(m)},isSync:!1,isBrowser:!0});Le={build:m=>new Promise((R,x)=>i.buildOrServe({callName:"build",refs:null,serveOptions:null,options:m,isTTY:!1,defaultWD:"/",callback:(F,U)=>F?x(F):R(U)})),transform:(m,R)=>new Promise((x,F)=>i.transform({callName:"transform",refs:null,input:m,options:R||{},isTTY:!1,fs:{readFile(U,k){k(new Error("Internal error"),null)},writeFile(U,k){k(null)}},callback:(U,k)=>U?F(U):x(k)})),formatMessages:(m,R)=>new Promise((x,F)=>i.formatMessages({callName:"formatMessages",refs:null,messages:m,options:R,callback:(U,k)=>U?F(U):x(k)})),analyzeMetafile:(m,R)=>new Promise((x,F)=>i.analyzeMetafile({callName:"analyzeMetafile",refs:null,metafile:typeof m=="string"?m:JSON.stringify(m),options:R,callback:(U,k)=>U?F(U):x(k)}))}});
10
10
  })(typeof exports==="object"?exports:(typeof self!=="undefined"?self:this).esbuild={});
@@ -5,67 +5,121 @@ export type LogLevel = 'verbose' | 'debug' | 'info' | 'warning' | 'error' | 'sil
5
5
  export type Charset = 'ascii' | 'utf8';
6
6
 
7
7
  interface CommonOptions {
8
+ /** Documentation: https://esbuild.github.io/api/#sourcemap */
8
9
  sourcemap?: boolean | 'inline' | 'external' | 'both';
10
+ /** Documentation: https://esbuild.github.io/api/#legal-comments */
9
11
  legalComments?: 'none' | 'inline' | 'eof' | 'linked' | 'external';
12
+ /** Documentation: https://esbuild.github.io/api/#source-root */
10
13
  sourceRoot?: string;
14
+ /** Documentation: https://esbuild.github.io/api/#sources-content */
11
15
  sourcesContent?: boolean;
12
16
 
17
+ /** Documentation: https://esbuild.github.io/api/#format */
13
18
  format?: Format;
19
+ /** Documentation: https://esbuild.github.io/api/#globalName */
14
20
  globalName?: string;
21
+ /** Documentation: https://esbuild.github.io/api/#target */
15
22
  target?: string | string[];
16
23
 
24
+ /** Documentation: https://esbuild.github.io/api/#minify */
17
25
  minify?: boolean;
26
+ /** Documentation: https://esbuild.github.io/api/#minify */
18
27
  minifyWhitespace?: boolean;
28
+ /** Documentation: https://esbuild.github.io/api/#minify */
19
29
  minifyIdentifiers?: boolean;
30
+ /** Documentation: https://esbuild.github.io/api/#minify */
20
31
  minifySyntax?: boolean;
32
+ /** Documentation: https://esbuild.github.io/api/#charset */
21
33
  charset?: Charset;
34
+ /** Documentation: https://esbuild.github.io/api/#tree-shaking */
22
35
  treeShaking?: boolean;
36
+ /** Documentation: https://esbuild.github.io/api/#ignore-annotations */
23
37
  ignoreAnnotations?: boolean;
24
38
 
39
+ /** Documentation: https://esbuild.github.io/api/#jsx */
25
40
  jsx?: 'transform' | 'preserve';
41
+ /** Documentation: https://esbuild.github.io/api/#jsx-factory */
26
42
  jsxFactory?: string;
43
+ /** Documentation: https://esbuild.github.io/api/#jsx-fragment */
27
44
  jsxFragment?: string;
28
45
 
46
+ /** Documentation: https://esbuild.github.io/api/#define */
29
47
  define?: { [key: string]: string };
48
+ /** Documentation: https://esbuild.github.io/api/#pure */
30
49
  pure?: string[];
50
+ /** Documentation: https://esbuild.github.io/api/#keep-names */
31
51
  keepNames?: boolean;
32
52
 
53
+ /** Documentation: https://esbuild.github.io/api/#color */
33
54
  color?: boolean;
55
+ /** Documentation: https://esbuild.github.io/api/#log-level */
34
56
  logLevel?: LogLevel;
57
+ /** Documentation: https://esbuild.github.io/api/#log-limit */
35
58
  logLimit?: number;
36
59
  }
37
60
 
38
61
  export interface BuildOptions extends CommonOptions {
62
+ /** Documentation: https://esbuild.github.io/api/#bundle */
39
63
  bundle?: boolean;
64
+ /** Documentation: https://esbuild.github.io/api/#splitting */
40
65
  splitting?: boolean;
66
+ /** Documentation: https://esbuild.github.io/api/#preserve-symlinks */
41
67
  preserveSymlinks?: boolean;
68
+ /** Documentation: https://esbuild.github.io/api/#outfile */
42
69
  outfile?: string;
70
+ /** Documentation: https://esbuild.github.io/api/#metafile */
43
71
  metafile?: boolean;
72
+ /** Documentation: https://esbuild.github.io/api/#outdir */
44
73
  outdir?: string;
74
+ /** Documentation: https://esbuild.github.io/api/#outbase */
45
75
  outbase?: string;
76
+ /** Documentation: https://esbuild.github.io/api/#platform */
46
77
  platform?: Platform;
78
+ /** Documentation: https://esbuild.github.io/api/#external */
47
79
  external?: string[];
80
+ /** Documentation: https://esbuild.github.io/api/#loader */
48
81
  loader?: { [ext: string]: Loader };
82
+ /** Documentation: https://esbuild.github.io/api/#resolve-extensions */
49
83
  resolveExtensions?: string[];
84
+ /** Documentation: https://esbuild.github.io/api/#mainFields */
50
85
  mainFields?: string[];
86
+ /** Documentation: https://esbuild.github.io/api/#conditions */
51
87
  conditions?: string[];
88
+ /** Documentation: https://esbuild.github.io/api/#write */
52
89
  write?: boolean;
90
+ /** Documentation: https://esbuild.github.io/api/#allow-overwrite */
53
91
  allowOverwrite?: boolean;
92
+ /** Documentation: https://esbuild.github.io/api/#tsconfig */
54
93
  tsconfig?: string;
94
+ /** Documentation: https://esbuild.github.io/api/#out-extension */
55
95
  outExtension?: { [ext: string]: string };
96
+ /** Documentation: https://esbuild.github.io/api/#public-path */
56
97
  publicPath?: string;
98
+ /** Documentation: https://esbuild.github.io/api/#entry-names */
57
99
  entryNames?: string;
100
+ /** Documentation: https://esbuild.github.io/api/#chunk-names */
58
101
  chunkNames?: string;
102
+ /** Documentation: https://esbuild.github.io/api/#asset-names */
59
103
  assetNames?: string;
104
+ /** Documentation: https://esbuild.github.io/api/#inject */
60
105
  inject?: string[];
106
+ /** Documentation: https://esbuild.github.io/api/#banner */
61
107
  banner?: { [type: string]: string };
108
+ /** Documentation: https://esbuild.github.io/api/#footer */
62
109
  footer?: { [type: string]: string };
110
+ /** Documentation: https://esbuild.github.io/api/#incremental */
63
111
  incremental?: boolean;
112
+ /** Documentation: https://esbuild.github.io/api/#entry-points */
64
113
  entryPoints?: string[] | Record<string, string>;
114
+ /** Documentation: https://esbuild.github.io/api/#stdin */
65
115
  stdin?: StdinOptions;
116
+ /** Documentation: https://esbuild.github.io/plugins/ */
66
117
  plugins?: Plugin[];
118
+ /** Documentation: https://esbuild.github.io/api/#working-directory */
67
119
  absWorkingDir?: string;
120
+ /** Documentation: https://esbuild.github.io/api/#node-paths */
68
121
  nodePaths?: string[]; // The "NODE_PATH" variable from Node.js
122
+ /** Documentation: https://esbuild.github.io/api/#watch */
69
123
  watch?: boolean | WatchMode;
70
124
  }
71
125
 
@@ -86,8 +140,10 @@ export interface Message {
86
140
  location: Location | null;
87
141
  notes: Note[];
88
142
 
89
- // Optional user-specified data that is passed through unmodified. You can
90
- // use this to stash the original error, for example.
143
+ /**
144
+ * Optional user-specified data that is passed through unmodified. You can
145
+ * use this to stash the original error, for example.
146
+ */
91
147
  detail: any;
92
148
  }
93
149
 
@@ -99,17 +155,22 @@ export interface Note {
99
155
  export interface Location {
100
156
  file: string;
101
157
  namespace: string;
102
- line: number; // 1-based
103
- column: number; // 0-based, in bytes
104
- length: number; // in bytes
158
+ /** 1-based */
159
+ line: number;
160
+ /** 0-based, in bytes */
161
+ column: number;
162
+ /** in bytes */
163
+ length: number;
105
164
  lineText: string;
106
165
  suggestion: string;
107
166
  }
108
167
 
109
168
  export interface OutputFile {
110
169
  path: string;
111
- contents: Uint8Array; // "text" as bytes
112
- text: string; // "contents" as text
170
+ /** "text" as bytes */
171
+ contents: Uint8Array;
172
+ /** "contents" as text */
173
+ text: string;
113
174
  }
114
175
 
115
176
  export interface BuildInvalidate {
@@ -124,10 +185,14 @@ export interface BuildIncremental extends BuildResult {
124
185
  export interface BuildResult {
125
186
  errors: Message[];
126
187
  warnings: Message[];
127
- outputFiles?: OutputFile[]; // Only when "write: false"
128
- rebuild?: BuildInvalidate; // Only when "incremental: true"
129
- stop?: () => void; // Only when "watch: true"
130
- metafile?: Metafile; // Only when "metafile: true"
188
+ /** Only when "write: false" */
189
+ outputFiles?: OutputFile[];
190
+ /** Only when "incremental: true" */
191
+ rebuild?: BuildInvalidate;
192
+ /** Only when "watch: true" */
193
+ stop?: () => void;
194
+ /** Only when "metafile: true" */
195
+ metafile?: Metafile;
131
196
  }
132
197
 
133
198
  export interface BuildFailure extends Error {
@@ -135,6 +200,7 @@ export interface BuildFailure extends Error {
135
200
  warnings: Message[];
136
201
  }
137
202
 
203
+ /** Documentation: https://esbuild.github.io/api/#serve-arguments */
138
204
  export interface ServeOptions {
139
205
  port?: number;
140
206
  host?: string;
@@ -147,9 +213,11 @@ export interface ServeOnRequestArgs {
147
213
  method: string;
148
214
  path: string;
149
215
  status: number;
150
- timeInMS: number; // The time to generate the response, not to send it
216
+ /** The time to generate the response, not to send it */
217
+ timeInMS: number;
151
218
  }
152
219
 
220
+ /** Documentation: https://esbuild.github.io/api/#serve-return-values */
153
221
  export interface ServeResult {
154
222
  port: number;
155
223
  host: string;
@@ -327,89 +395,129 @@ export interface AnalyzeMetafileOptions {
327
395
  verbose?: boolean;
328
396
  }
329
397
 
330
- // This function invokes the "esbuild" command-line tool for you. It returns a
331
- // promise that either resolves with a "BuildResult" object or rejects with a
332
- // "BuildFailure" object.
333
- //
334
- // Works in node: yes
335
- // Works in browser: yes
398
+ /**
399
+ * This function invokes the "esbuild" command-line tool for you. It returns a
400
+ * promise that either resolves with a "BuildResult" object or rejects with a
401
+ * "BuildFailure" object.
402
+ *
403
+ * - Works in node: yes
404
+ * - Works in browser: yes
405
+ *
406
+ * Documentation: https://esbuild.github.io/api/#build-api
407
+ */
336
408
  export declare function build(options: BuildOptions & { write: false }): Promise<BuildResult & { outputFiles: OutputFile[] }>;
337
409
  export declare function build(options: BuildOptions & { incremental: true }): Promise<BuildIncremental>;
338
410
  export declare function build(options: BuildOptions): Promise<BuildResult>;
339
411
 
340
- // This function is similar to "build" but it serves the resulting files over
341
- // HTTP on a localhost address with the specified port.
342
- //
343
- // Works in node: yes
344
- // Works in browser: no
412
+ /**
413
+ * This function is similar to "build" but it serves the resulting files over
414
+ * HTTP on a localhost address with the specified port.
415
+ *
416
+ * - Works in node: yes
417
+ * - Works in browser: no
418
+ *
419
+ * Documentation: https://esbuild.github.io/api/#serve
420
+ */
345
421
  export declare function serve(serveOptions: ServeOptions, buildOptions: BuildOptions): Promise<ServeResult>;
346
422
 
347
- // This function transforms a single JavaScript file. It can be used to minify
348
- // JavaScript, convert TypeScript/JSX to JavaScript, or convert newer JavaScript
349
- // to older JavaScript. It returns a promise that is either resolved with a
350
- // "TransformResult" object or rejected with a "TransformFailure" object.
351
- //
352
- // Works in node: yes
353
- // Works in browser: yes
423
+ /**
424
+ * This function transforms a single JavaScript file. It can be used to minify
425
+ * JavaScript, convert TypeScript/JSX to JavaScript, or convert newer JavaScript
426
+ * to older JavaScript. It returns a promise that is either resolved with a
427
+ * "TransformResult" object or rejected with a "TransformFailure" object.
428
+ *
429
+ * - Works in node: yes
430
+ * - Works in browser: yes
431
+ *
432
+ * Documentation: https://esbuild.github.io/api/#transform-api
433
+ */
354
434
  export declare function transform(input: string, options?: TransformOptions): Promise<TransformResult>;
355
435
 
356
- // Converts log messages to formatted message strings suitable for printing in
357
- // the terminal. This allows you to reuse the built-in behavior of esbuild's
358
- // log message formatter. This is a batch-oriented API for efficiency.
359
- //
360
- // Works in node: yes
361
- // Works in browser: yes
436
+ /**
437
+ * Converts log messages to formatted message strings suitable for printing in
438
+ * the terminal. This allows you to reuse the built-in behavior of esbuild's
439
+ * log message formatter. This is a batch-oriented API for efficiency.
440
+ *
441
+ * - Works in node: yes
442
+ * - Works in browser: yes
443
+ */
362
444
  export declare function formatMessages(messages: PartialMessage[], options: FormatMessagesOptions): Promise<string[]>;
363
445
 
364
- // Pretty-prints an analysis of the metafile JSON to a string. This is just for
365
- // convenience to be able to match esbuild's pretty-printing exactly. If you want
366
- // to customize it, you can just inspect the data in the metafile yourself.
367
- //
368
- // Works in node: yes
369
- // Works in browser: yes
446
+ /**
447
+ * Pretty-prints an analysis of the metafile JSON to a string. This is just for
448
+ * convenience to be able to match esbuild's pretty-printing exactly. If you want
449
+ * to customize it, you can just inspect the data in the metafile yourself.
450
+ *
451
+ * - Works in node: yes
452
+ * - Works in browser: yes
453
+ *
454
+ * Documentation: https://esbuild.github.io/api/#analyze
455
+ */
370
456
  export declare function analyzeMetafile(metafile: Metafile | string, options?: AnalyzeMetafileOptions): Promise<string>;
371
457
 
372
- // A synchronous version of "build".
373
- //
374
- // Works in node: yes
375
- // Works in browser: no
458
+ /**
459
+ * A synchronous version of "build".
460
+ *
461
+ * - Works in node: yes
462
+ * - Works in browser: no
463
+ *
464
+ * Documentation: https://esbuild.github.io/api/#build-api
465
+ */
376
466
  export declare function buildSync(options: BuildOptions & { write: false }): BuildResult & { outputFiles: OutputFile[] };
377
467
  export declare function buildSync(options: BuildOptions): BuildResult;
378
468
 
379
- // A synchronous version of "transform".
380
- //
381
- // Works in node: yes
382
- // Works in browser: no
469
+ /**
470
+ * A synchronous version of "transform".
471
+ *
472
+ * - Works in node: yes
473
+ * - Works in browser: no
474
+ *
475
+ * Documentation: https://esbuild.github.io/api/#transform-api
476
+ */
383
477
  export declare function transformSync(input: string, options?: TransformOptions): TransformResult;
384
478
 
385
- // A synchronous version of "formatMessages".
386
- //
387
- // Works in node: yes
388
- // Works in browser: no
479
+ /**
480
+ * A synchronous version of "formatMessages".
481
+ *
482
+ * - Works in node: yes
483
+ * - Works in browser: no
484
+ */
389
485
  export declare function formatMessagesSync(messages: PartialMessage[], options: FormatMessagesOptions): string[];
390
486
 
391
- // A synchronous version of "analyzeMetafile".
392
- //
393
- // Works in node: yes
394
- // Works in browser: no
487
+ /**
488
+ * A synchronous version of "analyzeMetafile".
489
+ *
490
+ * - Works in node: yes
491
+ * - Works in browser: no
492
+ *
493
+ * Documentation: https://esbuild.github.io/api/#analyze
494
+ */
395
495
  export declare function analyzeMetafileSync(metafile: Metafile | string, options?: AnalyzeMetafileOptions): string;
396
496
 
397
- // This configures the browser-based version of esbuild. It is necessary to
398
- // call this first and wait for the returned promise to be resolved before
399
- // making other API calls when using esbuild in the browser.
400
- //
401
- // Works in node: yes
402
- // Works in browser: yes ("options" is required)
497
+ /**
498
+ * This configures the browser-based version of esbuild. It is necessary to
499
+ * call this first and wait for the returned promise to be resolved before
500
+ * making other API calls when using esbuild in the browser.
501
+ *
502
+ * - Works in node: yes
503
+ * - Works in browser: yes ("options" is required)
504
+ *
505
+ * Documentation: https://esbuild.github.io/api/#running-in-the-browser
506
+ */
403
507
  export declare function initialize(options: InitializeOptions): Promise<void>;
404
508
 
405
509
  export interface InitializeOptions {
406
- // The URL of the "esbuild.wasm" file. This must be provided when running
407
- // esbuild in the browser.
510
+ /**
511
+ * The URL of the "esbuild.wasm" file. This must be provided when running
512
+ * esbuild in the browser.
513
+ */
408
514
  wasmURL?: string
409
515
 
410
- // By default esbuild runs the WebAssembly-based browser API in a web worker
411
- // to avoid blocking the UI thread. This can be disabled by setting "worker"
412
- // to false.
516
+ /**
517
+ * By default esbuild runs the WebAssembly-based browser API in a web worker
518
+ * to avoid blocking the UI thread. This can be disabled by setting "worker"
519
+ * to false.
520
+ */
413
521
  worker?: boolean
414
522
  }
415
523