@amaster.ai/vite-plugins 1.0.0-beta.40 → 1.0.0-beta.41

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.
package/dist/index.cjs CHANGED
@@ -1,16 +1,16 @@
1
- 'use strict';Object.defineProperty(exports,'__esModule',{value:true});var crypto=require('crypto'),Te=require('fs'),ye=require('path'),url=require('url'),et=require('process'),Ne=require('fs/promises'),buffer=require('buffer');var _documentCurrentScript=typeof document!=='undefined'?document.currentScript:null;function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var Te__default=/*#__PURE__*/_interopDefault(Te);var ye__default=/*#__PURE__*/_interopDefault(ye);var et__default=/*#__PURE__*/_interopDefault(et);var Ne__default=/*#__PURE__*/_interopDefault(Ne);var jt=Object.create;var Qe=Object.defineProperty;var Ct=Object.getOwnPropertyDescriptor;var It=Object.getOwnPropertyNames;var Lt=Object.getPrototypeOf,Dt=Object.prototype.hasOwnProperty;var V=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,r)=>(typeof require<"u"?require:t)[r]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var Mt=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var Ft=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of It(t))!Dt.call(e,i)&&i!==r&&Qe(e,i,{get:()=>t[i],enumerable:!(n=Ct(t,i))||n.enumerable});return e};var Bt=(e,t,r)=>(r=e!=null?jt(Lt(e)):{},Ft(Qe(r,"default",{value:e,enumerable:true}),e));var Pt=Mt((nn,Ot)=>{var Ve=Object.defineProperty,Qt=Object.getOwnPropertyDescriptor,Gt=Object.getOwnPropertyNames,Zt=Object.prototype.hasOwnProperty,er=(e,t)=>{for(var r in t)Ve(e,r,{get:t[r],enumerable:true});},tr=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Gt(t))!Zt.call(e,i)&&i!==r&&Ve(e,i,{get:()=>t[i],enumerable:!(n=Qt(t,i))||n.enumerable});return e},rr=e=>tr(Ve({},"__esModule",{value:true}),e),Oe={};er(Oe,{analyzeMetafile:()=>$r,analyzeMetafileSync:()=>Lr,build:()=>Pr,buildSync:()=>jr,context:()=>Tr,default:()=>Br,formatMessages:()=>Rr,formatMessagesSync:()=>Ir,initialize:()=>Mr,stop:()=>Dr,transform:()=>Ar,transformSync:()=>Cr,version:()=>Or});Ot.exports=rr(Oe);function rt(e){let t=n=>{if(n===null)r.write8(0);else if(typeof n=="boolean")r.write8(1),r.write8(+n);else if(typeof n=="number")r.write8(2),r.write32(n|0);else if(typeof n=="string")r.write8(3),r.write(ne(n));else if(n instanceof Uint8Array)r.write8(4),r.write(n);else if(n instanceof Array){r.write8(5),r.write32(n.length);for(let i of n)t(i);}else {let i=Object.keys(n);r.write8(6),r.write32(i.length);for(let l of i)r.write(ne(l)),t(n[l]);}},r=new dt;return r.write32(0),r.write32(e.id<<1|+!e.isRequest),t(e.value),ze(r.buf,r.len-4,0),r.buf.subarray(0,r.len)}function nr(e){let t=()=>{switch(r.read8()){case 0:return null;case 1:return !!r.read8();case 2:return r.read32();case 3:return be(r.read());case 4:return r.read();case 5:{let s=r.read32(),d=[];for(let a=0;a<s;a++)d.push(t());return d}case 6:{let s=r.read32(),d={};for(let a=0;a<s;a++)d[be(r.read())]=t();return d}default:throw new Error("Invalid packet")}},r=new dt(e),n=r.read32(),i=(n&1)===0;n>>>=1;let l=t();if(r.ptr!==e.length)throw new Error("Invalid packet");return {id:n,isRequest:i,value:l}}var dt=class{constructor(e=new Uint8Array(1024)){this.buf=e,this.len=0,this.ptr=0;}_write(e){if(this.len+e>this.buf.length){let t=new Uint8Array((this.len+e)*2);t.set(this.buf),this.buf=t;}return this.len+=e,this.len-e}write8(e){let t=this._write(1);this.buf[t]=e;}write32(e){let t=this._write(4);ze(this.buf,e,t);}write(e){let t=this._write(4+e.length);ze(this.buf,e.length,t),this.buf.set(e,t+4);}_read(e){if(this.ptr+e>this.buf.length)throw new Error("Invalid packet");return this.ptr+=e,this.ptr-e}read8(){return this.buf[this._read(1)]}read32(){return pt(this.buf,this._read(4))}read(){let e=this.read32(),t=new Uint8Array(e),r=this._read(t.length);return t.set(this.buf.subarray(r,r+e)),t}},ne,be,He;if(typeof TextEncoder<"u"&&typeof TextDecoder<"u"){let e=new TextEncoder,t=new TextDecoder;ne=r=>e.encode(r),be=r=>t.decode(r),He='new TextEncoder().encode("")';}else if(typeof Buffer<"u")ne=e=>Buffer.from(e),be=e=>{let{buffer:t,byteOffset:r,byteLength:n}=e;return Buffer.from(t,r,n).toString()},He='Buffer.from("")';else throw new Error("No UTF-8 codec found");if(!(ne("")instanceof Uint8Array))throw new Error(`Invariant violation: "${He} instanceof Uint8Array" is incorrectly false
1
+ 'use strict';Object.defineProperty(exports,'__esModule',{value:true});var crypto=require('crypto'),Te=require('fs'),ye=require('path'),et=require('process'),Ne=require('fs/promises'),buffer=require('buffer');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var Te__default=/*#__PURE__*/_interopDefault(Te);var ye__default=/*#__PURE__*/_interopDefault(ye);var et__default=/*#__PURE__*/_interopDefault(et);var Ne__default=/*#__PURE__*/_interopDefault(Ne);var Ct=Object.create;var Qe=Object.defineProperty;var $t=Object.getOwnPropertyDescriptor;var It=Object.getOwnPropertyNames;var Lt=Object.getPrototypeOf,Dt=Object.prototype.hasOwnProperty;var V=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,r)=>(typeof require<"u"?require:t)[r]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var Mt=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var Bt=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of It(t))!Dt.call(e,i)&&i!==r&&Qe(e,i,{get:()=>t[i],enumerable:!(n=$t(t,i))||n.enumerable});return e};var Ft=(e,t,r)=>(r=e!=null?Ct(Lt(e)):{},Bt(Qe(r,"default",{value:e,enumerable:true}),e));var Pt=Mt((Kr,Ot)=>{var Ve=Object.defineProperty,Vt=Object.getOwnPropertyDescriptor,Yt=Object.getOwnPropertyNames,Xt=Object.prototype.hasOwnProperty,Kt=(e,t)=>{for(var r in t)Ve(e,r,{get:t[r],enumerable:true});},Qt=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Yt(t))!Xt.call(e,i)&&i!==r&&Ve(e,i,{get:()=>t[i],enumerable:!(n=Vt(t,i))||n.enumerable});return e},Gt=e=>Qt(Ve({},"__esModule",{value:true}),e),Oe={};Kt(Oe,{analyzeMetafile:()=>Pr,analyzeMetafileSync:()=>jr,build:()=>Er,buildSync:()=>Tr,context:()=>_r,default:()=>Lr,formatMessages:()=>Or,formatMessagesSync:()=>Rr,initialize:()=>$r,stop:()=>Cr,transform:()=>kr,transformSync:()=>Ar,version:()=>xr});Ot.exports=Gt(Oe);function rt(e){let t=n=>{if(n===null)r.write8(0);else if(typeof n=="boolean")r.write8(1),r.write8(+n);else if(typeof n=="number")r.write8(2),r.write32(n|0);else if(typeof n=="string")r.write8(3),r.write(ne(n));else if(n instanceof Uint8Array)r.write8(4),r.write(n);else if(n instanceof Array){r.write8(5),r.write32(n.length);for(let i of n)t(i);}else {let i=Object.keys(n);r.write8(6),r.write32(i.length);for(let l of i)r.write(ne(l)),t(n[l]);}},r=new dt;return r.write32(0),r.write32(e.id<<1|+!e.isRequest),t(e.value),He(r.buf,r.len-4,0),r.buf.subarray(0,r.len)}function Zt(e){let t=()=>{switch(r.read8()){case 0:return null;case 1:return !!r.read8();case 2:return r.read32();case 3:return be(r.read());case 4:return r.read();case 5:{let s=r.read32(),d=[];for(let a=0;a<s;a++)d.push(t());return d}case 6:{let s=r.read32(),d={};for(let a=0;a<s;a++)d[be(r.read())]=t();return d}default:throw new Error("Invalid packet")}},r=new dt(e),n=r.read32(),i=(n&1)===0;n>>>=1;let l=t();if(r.ptr!==e.length)throw new Error("Invalid packet");return {id:n,isRequest:i,value:l}}var dt=class{constructor(e=new Uint8Array(1024)){this.buf=e,this.len=0,this.ptr=0;}_write(e){if(this.len+e>this.buf.length){let t=new Uint8Array((this.len+e)*2);t.set(this.buf),this.buf=t;}return this.len+=e,this.len-e}write8(e){let t=this._write(1);this.buf[t]=e;}write32(e){let t=this._write(4);He(this.buf,e,t);}write(e){let t=this._write(4+e.length);He(this.buf,e.length,t),this.buf.set(e,t+4);}_read(e){if(this.ptr+e>this.buf.length)throw new Error("Invalid packet");return this.ptr+=e,this.ptr-e}read8(){return this.buf[this._read(1)]}read32(){return pt(this.buf,this._read(4))}read(){let e=this.read32(),t=new Uint8Array(e),r=this._read(t.length);return t.set(this.buf.subarray(r,r+e)),t}},ne,be,ze;if(typeof TextEncoder<"u"&&typeof TextDecoder<"u"){let e=new TextEncoder,t=new TextDecoder;ne=r=>e.encode(r),be=r=>t.decode(r),ze='new TextEncoder().encode("")';}else if(typeof Buffer<"u")ne=e=>Buffer.from(e),be=e=>{let{buffer:t,byteOffset:r,byteLength:n}=e;return Buffer.from(t,r,n).toString()},ze='Buffer.from("")';else throw new Error("No UTF-8 codec found");if(!(ne("")instanceof Uint8Array))throw new Error(`Invariant violation: "${ze} instanceof Uint8Array" is incorrectly false
2
2
 
3
3
  This indicates that your JavaScript environment is broken. You cannot use
4
4
  esbuild in this environment because esbuild relies on this invariant. This
5
5
  is not a problem with esbuild. You need to fix your environment instead.
6
- `);function pt(e,t){return e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24}function ze(e,t,r){e[r++]=t,e[r++]=t>>8,e[r++]=t>>16,e[r++]=t>>24;}var J=JSON.stringify,nt="warning",it="silent";function ve(e,t){let r=[];for(let n of e){if(Q(n,t),n.indexOf(",")>=0)throw new Error(`Invalid ${t}: ${n}`);r.push(n);}return r.join(",")}var $e=()=>null,q=e=>typeof e=="boolean"?null:"a boolean",v=e=>typeof e=="string"?null:"a string",je=e=>e instanceof RegExp?null:"a RegExp object",de=e=>typeof e=="number"&&e===(e|0)?null:"an integer",ir=e=>typeof e=="number"&&e===(e|0)&&e>=0&&e<=65535?null:"a valid port number",gt=e=>typeof e=="function"?null:"a function",le=e=>Array.isArray(e)?null:"an array",G=e=>Array.isArray(e)&&e.every(t=>typeof t=="string")?null:"an array of strings",Z=e=>typeof e=="object"&&e!==null&&!Array.isArray(e)?null:"an object",or=e=>typeof e=="object"&&e!==null?null:"an array or an object",sr=e=>e instanceof WebAssembly.Module?null:"a WebAssembly.Module",ot=e=>typeof e=="object"&&!Array.isArray(e)?null:"an object or null",mt=e=>typeof e=="string"||typeof e=="boolean"?null:"a string or a boolean",ar=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)&&e.every(t=>typeof t=="string")?null:"a string or an array of strings",yt=e=>typeof e=="string"||e instanceof Uint8Array?null:"a string or a Uint8Array",lr=e=>typeof e=="string"||e instanceof URL?null:"a string or a URL";function o(e,t,r,n){let i=e[r];if(t[r+""]=true,i===void 0)return;let l=n(i);if(l!==null)throw new Error(`${J(r)} must be ${l}`);return i}function W(e,t,r){for(let n in e)if(!(n in t))throw new Error(`Invalid option ${r}: ${J(n)}`)}function ur(e){let t=Object.create(null),r=o(e,t,"wasmURL",lr),n=o(e,t,"wasmModule",sr),i=o(e,t,"worker",q);return W(e,t,"in initialize() call"),{wasmURL:r,wasmModule:n,worker:i}}function wt(e){let t;if(e!==void 0){t=Object.create(null);for(let r in e){let n=e[r];if(typeof n=="string"||n===false)t[r]=n;else throw new Error(`Expected ${J(r)} in mangle cache to map to either a string or false`)}}return t}function Me(e,t,r,n,i){let l=o(t,r,"color",q),s=o(t,r,"logLevel",v),d=o(t,r,"logLimit",de);l!==void 0?e.push(`--color=${l}`):n&&e.push("--color=true"),e.push(`--log-level=${s||i}`),e.push(`--log-limit=${d||0}`);}function Q(e,t,r){if(typeof e!="string")throw new Error(`Expected value for ${t}${r!==void 0?" "+J(r):""} to be a string, got ${typeof e} instead`);return e}function vt(e,t,r){let n=o(t,r,"legalComments",v),i=o(t,r,"sourceRoot",v),l=o(t,r,"sourcesContent",q),s=o(t,r,"target",ht),d=o(t,r,"format",v),a=o(t,r,"globalName",v),c=o(t,r,"mangleProps",je),u=o(t,r,"reserveProps",je),y=o(t,r,"mangleQuoted",q),k=o(t,r,"minify",q),E=o(t,r,"minifySyntax",q),A=o(t,r,"minifyWhitespace",q),B=o(t,r,"minifyIdentifiers",q),L=o(t,r,"lineLimit",de),U=o(t,r,"drop",G),H=o(t,r,"dropLabels",G),x=o(t,r,"charset",v),w=o(t,r,"treeShaking",q),m=o(t,r,"ignoreAnnotations",q),f=o(t,r,"jsx",v),_=o(t,r,"jsxFactory",v),P=o(t,r,"jsxFragment",v),C=o(t,r,"jsxImportSource",v),T=o(t,r,"jsxDev",q),p=o(t,r,"jsxSideEffects",q),g=o(t,r,"define",Z),S=o(t,r,"logOverride",Z),$=o(t,r,"supported",Z),I=o(t,r,"pure",G),R=o(t,r,"keepNames",q),O=o(t,r,"platform",v),j=o(t,r,"tsconfigRaw",ar),N=o(t,r,"absPaths",G);if(n&&e.push(`--legal-comments=${n}`),i!==void 0&&e.push(`--source-root=${i}`),l!==void 0&&e.push(`--sources-content=${l}`),s&&e.push(`--target=${ve(Array.isArray(s)?s:[s],"target")}`),d&&e.push(`--format=${d}`),a&&e.push(`--global-name=${a}`),O&&e.push(`--platform=${O}`),j&&e.push(`--tsconfig-raw=${typeof j=="string"?j:JSON.stringify(j)}`),k&&e.push("--minify"),E&&e.push("--minify-syntax"),A&&e.push("--minify-whitespace"),B&&e.push("--minify-identifiers"),L&&e.push(`--line-limit=${L}`),x&&e.push(`--charset=${x}`),w!==void 0&&e.push(`--tree-shaking=${w}`),m&&e.push("--ignore-annotations"),U)for(let h of U)e.push(`--drop:${Q(h,"drop")}`);if(H&&e.push(`--drop-labels=${ve(H,"drop label")}`),N&&e.push(`--abs-paths=${ve(N,"abs paths")}`),c&&e.push(`--mangle-props=${Ce(c)}`),u&&e.push(`--reserve-props=${Ce(u)}`),y!==void 0&&e.push(`--mangle-quoted=${y}`),f&&e.push(`--jsx=${f}`),_&&e.push(`--jsx-factory=${_}`),P&&e.push(`--jsx-fragment=${P}`),C&&e.push(`--jsx-import-source=${C}`),T&&e.push("--jsx-dev"),p&&e.push("--jsx-side-effects"),g)for(let h in g){if(h.indexOf("=")>=0)throw new Error(`Invalid define: ${h}`);e.push(`--define:${h}=${Q(g[h],"define",h)}`);}if(S)for(let h in S){if(h.indexOf("=")>=0)throw new Error(`Invalid log override: ${h}`);e.push(`--log-override:${h}=${Q(S[h],"log override",h)}`);}if($)for(let h in $){if(h.indexOf("=")>=0)throw new Error(`Invalid supported: ${h}`);let F=$[h];if(typeof F!="boolean")throw new Error(`Expected value for supported ${J(h)} to be a boolean, got ${typeof F} instead`);e.push(`--supported:${h}=${F}`);}if(I)for(let h of I)e.push(`--pure:${Q(h,"pure")}`);R&&e.push("--keep-names");}function cr(e,t,r,n,i){var l;let s=[],d=[],a=Object.create(null),c=null,u=null;Me(s,t,a,r,n),vt(s,t,a);let y=o(t,a,"sourcemap",mt),k=o(t,a,"bundle",q),E=o(t,a,"splitting",q),A=o(t,a,"preserveSymlinks",q),B=o(t,a,"metafile",q),L=o(t,a,"outfile",v),U=o(t,a,"outdir",v),H=o(t,a,"outbase",v),x=o(t,a,"tsconfig",v),w=o(t,a,"resolveExtensions",G),m=o(t,a,"nodePaths",G),f=o(t,a,"mainFields",G),_=o(t,a,"conditions",G),P=o(t,a,"external",G),C=o(t,a,"packages",v),T=o(t,a,"alias",Z),p=o(t,a,"loader",Z),g=o(t,a,"outExtension",Z),S=o(t,a,"publicPath",v),$=o(t,a,"entryNames",v),I=o(t,a,"chunkNames",v),R=o(t,a,"assetNames",v),O=o(t,a,"inject",G),j=o(t,a,"banner",Z),N=o(t,a,"footer",Z),h=o(t,a,"entryPoints",or),F=o(t,a,"absWorkingDir",v),M=o(t,a,"stdin",Z),D=(l=o(t,a,"write",q))!=null?l:i,K=o(t,a,"allowOverwrite",q),z=o(t,a,"mangleCache",Z);if(a.plugins=true,W(t,a,`in ${e}() call`),y&&s.push(`--sourcemap${y===true?"":`=${y}`}`),k&&s.push("--bundle"),K&&s.push("--allow-overwrite"),E&&s.push("--splitting"),A&&s.push("--preserve-symlinks"),B&&s.push("--metafile"),L&&s.push(`--outfile=${L}`),U&&s.push(`--outdir=${U}`),H&&s.push(`--outbase=${H}`),x&&s.push(`--tsconfig=${x}`),C&&s.push(`--packages=${C}`),w&&s.push(`--resolve-extensions=${ve(w,"resolve extension")}`),S&&s.push(`--public-path=${S}`),$&&s.push(`--entry-names=${$}`),I&&s.push(`--chunk-names=${I}`),R&&s.push(`--asset-names=${R}`),f&&s.push(`--main-fields=${ve(f,"main field")}`),_&&s.push(`--conditions=${ve(_,"condition")}`),P)for(let b of P)s.push(`--external:${Q(b,"external")}`);if(T)for(let b in T){if(b.indexOf("=")>=0)throw new Error(`Invalid package name in alias: ${b}`);s.push(`--alias:${b}=${Q(T[b],"alias",b)}`);}if(j)for(let b in j){if(b.indexOf("=")>=0)throw new Error(`Invalid banner file type: ${b}`);s.push(`--banner:${b}=${Q(j[b],"banner",b)}`);}if(N)for(let b in N){if(b.indexOf("=")>=0)throw new Error(`Invalid footer file type: ${b}`);s.push(`--footer:${b}=${Q(N[b],"footer",b)}`);}if(O)for(let b of O)s.push(`--inject:${Q(b,"inject")}`);if(p)for(let b in p){if(b.indexOf("=")>=0)throw new Error(`Invalid loader extension: ${b}`);s.push(`--loader:${b}=${Q(p[b],"loader",b)}`);}if(g)for(let b in g){if(b.indexOf("=")>=0)throw new Error(`Invalid out extension: ${b}`);s.push(`--out-extension:${b}=${Q(g[b],"out extension",b)}`);}if(h)if(Array.isArray(h))for(let b=0,se=h.length;b<se;b++){let ee=h[b];if(typeof ee=="object"&&ee!==null){let ie=Object.create(null),ae=o(ee,ie,"in",v),te=o(ee,ie,"out",v);if(W(ee,ie,"in entry point at index "+b),ae===void 0)throw new Error('Missing property "in" for entry point at index '+b);if(te===void 0)throw new Error('Missing property "out" for entry point at index '+b);d.push([te,ae]);}else d.push(["",Q(ee,"entry point at index "+b)]);}else for(let b in h)d.push([b,Q(h[b],"entry point",b)]);if(M){let b=Object.create(null),se=o(M,b,"contents",yt),ee=o(M,b,"resolveDir",v),ie=o(M,b,"sourcefile",v),ae=o(M,b,"loader",v);W(M,b,'in "stdin" object'),ie&&s.push(`--sourcefile=${ie}`),ae&&s.push(`--loader=${ae}`),ee&&(u=ee),typeof se=="string"?c=ne(se):se instanceof Uint8Array&&(c=se);}let oe=[];if(m)for(let b of m)b+="",oe.push(b);return {entries:d,flags:s,write:D,stdinContents:c,stdinResolveDir:u,absWorkingDir:F,nodePaths:oe,mangleCache:wt(z)}}function fr(e,t,r,n){let i=[],l=Object.create(null);Me(i,t,l,r,n),vt(i,t,l);let s=o(t,l,"sourcemap",mt),d=o(t,l,"sourcefile",v),a=o(t,l,"loader",v),c=o(t,l,"banner",v),u=o(t,l,"footer",v),y=o(t,l,"mangleCache",Z);return W(t,l,`in ${e}() call`),s&&i.push(`--sourcemap=${s===true?"external":s}`),d&&i.push(`--sourcefile=${d}`),a&&i.push(`--loader=${a}`),c&&i.push(`--banner=${c}`),u&&i.push(`--footer=${u}`),{flags:i,mangleCache:wt(y)}}function bt(e){let t={},r={didClose:false,reason:""},n={},i=0,l=0,s=new Uint8Array(16*1024),d=0,a=x=>{let w=d+x.length;if(w>s.length){let f=new Uint8Array(w*2);f.set(s),s=f;}s.set(x,d),d+=x.length;let m=0;for(;m+4<=d;){let f=pt(s,m);if(m+4+f>d)break;m+=4,A(s.subarray(m,m+f)),m+=f;}m>0&&(s.copyWithin(0,m,d),d-=m);},c=x=>{r.didClose=true,x&&(r.reason=": "+(x.message||x));let w="The service was stopped"+r.reason;for(let m in n)n[m](w,null);n={};},u=(x,w,m)=>{if(r.didClose)return m("The service is no longer running"+r.reason,null);let f=i++;n[f]=(_,P)=>{try{m(_,P);}finally{x&&x.unref();}},x&&x.ref(),e.writeToStdin(rt({id:f,isRequest:true,value:w}));},y=(x,w)=>{if(r.didClose)throw new Error("The service is no longer running"+r.reason);e.writeToStdin(rt({id:x,isRequest:false,value:w}));},k=async(x,w)=>{try{if(w.command==="ping"){y(x,{});return}if(typeof w.key=="number"){let m=t[w.key];if(!m)return;let f=m[w.command];if(f){await f(x,w);return}}throw new Error("Invalid command: "+w.command)}catch(m){let f=[fe(m,e,null,void 0,"")];try{y(x,{errors:f});}catch{}}},E=true,A=x=>{if(E){E=false;let m=String.fromCharCode(...x);if(m!=="0.27.2")throw new Error(`Cannot start service: Host version "0.27.2" does not match binary version ${J(m)}`);return}let w=nr(x);if(w.isRequest)k(w.id,w.value);else {let m=n[w.id];delete n[w.id],w.value.error?m(w.value.error,{}):m(null,w.value);}};return {readFromStdout:a,afterClose:c,service:{buildOrContext:({callName:x,refs:w,options:m,isTTY:f,defaultWD:_,callback:P})=>{let C=0,T=l++,p={},g={ref(){++C===1&&w&&w.ref();},unref(){--C===0&&(delete t[T],w&&w.unref());}};t[T]=p,g.ref(),dr(x,T,u,y,g,e,p,m,f,_,(S,$)=>{try{P(S,$);}finally{g.unref();}});},transform:({callName:x,refs:w,input:m,options:f,isTTY:_,fs:P,callback:C})=>{let T=St(),p=g=>{try{if(typeof m!="string"&&!(m instanceof Uint8Array))throw new Error('The input to "transform" must be a string or a Uint8Array');let{flags:S,mangleCache:$}=fr(x,f,_,it),I={command:"transform",flags:S,inputFS:g!==null,input:g!==null?ne(g):typeof m=="string"?ne(m):m};$&&(I.mangleCache=$),u(w,I,(R,O)=>{if(R)return C(new Error(R),null);let j=Se(O.errors,T),N=Se(O.warnings,T),h=1,F=()=>{if(--h===0){let M={warnings:N,code:O.code,map:O.map,mangleCache:void 0,legalComments:void 0};"legalComments"in O&&(M.legalComments=O?.legalComments),O.mangleCache&&(M.mangleCache=O?.mangleCache),C(null,M);}};if(j.length>0)return C(_e("Transform failed",j,N),null);O.codeFS&&(h++,P.readFile(O.code,(M,D)=>{M!==null?C(M,null):(O.code=D,F());})),O.mapFS&&(h++,P.readFile(O.map,(M,D)=>{M!==null?C(M,null):(O.map=D,F());})),F();});}catch(S){let $=[];try{Me($,f,{},_,it);}catch{}let I=fe(S,e,T,void 0,"");u(w,{command:"error",flags:$,error:I},()=>{I.detail=T.load(I.detail),C(_e("Transform failed",[I],[]),null);});}};if((typeof m=="string"||m instanceof Uint8Array)&&m.length>1024*1024){let g=p;p=()=>P.writeFile(m,g);}p(null);},formatMessages:({callName:x,refs:w,messages:m,options:f,callback:_})=>{if(!f)throw new Error(`Missing second argument in ${x}() call`);let P={},C=o(f,P,"kind",v),T=o(f,P,"color",q),p=o(f,P,"terminalWidth",de);if(W(f,P,`in ${x}() call`),C===void 0)throw new Error(`Missing "kind" in ${x}() call`);if(C!=="error"&&C!=="warning")throw new Error(`Expected "kind" to be "error" or "warning" in ${x}() call`);let g={command:"format-msgs",messages:ue(m,"messages",null,"",p),isWarning:C==="warning"};T!==void 0&&(g.color=T),p!==void 0&&(g.terminalWidth=p),u(w,g,(S,$)=>{if(S)return _(new Error(S),null);_(null,$.messages);});},analyzeMetafile:({callName:x,refs:w,metafile:m,options:f,callback:_})=>{f===void 0&&(f={});let P={},C=o(f,P,"color",q),T=o(f,P,"verbose",q);W(f,P,`in ${x}() call`);let p={command:"analyze-metafile",metafile:m};C!==void 0&&(p.color=C),T!==void 0&&(p.verbose=T),u(w,p,(g,S)=>{if(g)return _(new Error(g),null);_(null,S.result);});}}}}function dr(e,t,r,n,i,l,s,d,a,c,u){let y=St(),k=e==="context",E=(L,U)=>{let H=[];try{Me(H,d,{},a,nt);}catch{}let x=fe(L,l,y,void 0,U);r(i,{command:"error",flags:H,error:x},()=>{x.detail=y.load(x.detail),u(_e(k?"Context failed":"Build failed",[x],[]),null);});},A;if(typeof d=="object"){let L=d.plugins;if(L!==void 0){if(!Array.isArray(L))return E(new Error('"plugins" must be an array'),"");A=L;}}if(A&&A.length>0){if(l.isSync)return E(new Error("Cannot use plugins in synchronous API calls"),"");pr(t,r,n,i,l,s,d,A,y).then(L=>{if(!L.ok)return E(L.error,L.pluginName);try{B(L.requestPlugins,L.runOnEndCallbacks,L.scheduleOnDisposeCallbacks);}catch(U){E(U,"");}},L=>E(L,""));return}try{B(null,(L,U)=>U([],[]),()=>{});}catch(L){E(L,"");}function B(L,U,H){let x=l.hasFS,{entries:w,flags:m,write:f,stdinContents:_,stdinResolveDir:P,absWorkingDir:C,nodePaths:T,mangleCache:p}=cr(e,d,a,nt,x);if(f&&!l.hasFS)throw new Error('The "write" option is unavailable in this environment');let g={command:"build",key:t,entries:w,flags:m,write:f,stdinContents:_,stdinResolveDir:P,absWorkingDir:C||c,nodePaths:T,context:k};L&&(g.plugins=L),p&&(g.mangleCache=p);let S=(R,O)=>{let j={errors:Se(R.errors,y),warnings:Se(R.warnings,y),outputFiles:void 0,metafile:void 0,mangleCache:void 0},N=j.errors.slice(),h=j.warnings.slice();R.outputFiles&&(j.outputFiles=R.outputFiles.map(mr)),R.metafile&&(j.metafile=JSON.parse(R.metafile)),R.mangleCache&&(j.mangleCache=R.mangleCache),R.writeToStdout!==void 0&&console.log(be(R.writeToStdout).replace(/\n$/,"")),U(j,(F,M)=>{if(N.length>0||F.length>0){let D=_e("Build failed",N.concat(F),h.concat(M));return O(D,null,F,M)}O(null,j,F,M);});},$,I;k&&(s["on-end"]=(R,O)=>new Promise(j=>{S(O,(N,h,F,M)=>{let D={errors:F,warnings:M};I&&I(N,h),$=void 0,I=void 0,n(R,D),j();});})),r(i,g,(R,O)=>{if(R)return u(new Error(R),null);if(!k)return S(O,(h,F)=>(H(),u(h,F)));if(O.errors.length>0)return u(_e("Context failed",O.errors,O.warnings),null);let j=false,N={rebuild:()=>($||($=new Promise((h,F)=>{let M;I=(K,z)=>{M||(M=()=>K?F(K):h(z));};let D=()=>{r(i,{command:"rebuild",key:t},(z,oe)=>{z?F(new Error(z)):M?M():D();});};D();})),$),watch:(h={})=>new Promise((F,M)=>{if(!l.hasFS)throw new Error('Cannot use the "watch" API in this environment');let D={},K=o(h,D,"delay",de);W(h,D,"in watch() call");let z={command:"watch",key:t};K&&(z.delay=K),r(i,z,oe=>{oe?M(new Error(oe)):F(void 0);});}),serve:(h={})=>new Promise((F,M)=>{if(!l.hasFS)throw new Error('Cannot use the "serve" API in this environment');let D={},K=o(h,D,"port",ir),z=o(h,D,"host",v),oe=o(h,D,"servedir",v),b=o(h,D,"keyfile",v),se=o(h,D,"certfile",v),ee=o(h,D,"fallback",v),ie=o(h,D,"cors",Z),ae=o(h,D,"onRequest",gt);W(h,D,"in serve() call");let te={command:"serve",key:t,onRequest:!!ae};if(K!==void 0&&(te.port=K),z!==void 0&&(te.host=z),oe!==void 0&&(te.servedir=oe),b!==void 0&&(te.keyfile=b),se!==void 0&&(te.certfile=se),ee!==void 0&&(te.fallback=ee),ie){let xe={},he=o(ie,xe,"origin",ht);W(ie,xe,'on "cors" object'),Array.isArray(he)?te.corsOrigin=he:he!==void 0&&(te.corsOrigin=[he]);}r(i,te,(xe,he)=>{if(xe)return M(new Error(xe));ae&&(s["serve-request"]=(Rt,$t)=>{ae($t.args),n(Rt,{});}),F(he);});}),cancel:()=>new Promise(h=>{if(j)return h();r(i,{command:"cancel",key:t},()=>{h();});}),dispose:()=>new Promise(h=>{if(j)return h();j=true,r(i,{command:"dispose",key:t},()=>{h(),H(),i.unref();});})};i.ref(),u(null,N);});}}var pr=async(e,t,r,n,i,l,s,d,a)=>{let c=[],u=[],y={},k={},E=[],A=0,B=0,L=[],U=false;d=[...d];for(let w of d){let m={};if(typeof w!="object")throw new Error(`Plugin at index ${B} must be an object`);let f=o(w,m,"name",v);if(typeof f!="string"||f==="")throw new Error(`Plugin at index ${B} is missing a name`);try{let _=o(w,m,"setup",gt);if(typeof _!="function")throw new Error("Plugin is missing a setup function");W(w,m,`on plugin ${J(f)}`);let P={name:f,onStart:!1,onEnd:!1,onResolve:[],onLoad:[]};B++;let T=_({initialOptions:s,resolve:(p,g={})=>{if(!U)throw new Error('Cannot call "resolve" before plugin setup has completed');if(typeof p!="string")throw new Error("The path to resolve must be a string");let S=Object.create(null),$=o(g,S,"pluginName",v),I=o(g,S,"importer",v),R=o(g,S,"namespace",v),O=o(g,S,"resolveDir",v),j=o(g,S,"kind",v),N=o(g,S,"pluginData",$e),h=o(g,S,"with",Z);return W(g,S,"in resolve() call"),new Promise((F,M)=>{let D={command:"resolve",path:p,key:e,pluginName:f};if($!=null&&(D.pluginName=$),I!=null&&(D.importer=I),R!=null&&(D.namespace=R),O!=null&&(D.resolveDir=O),j!=null)D.kind=j;else throw new Error('Must specify "kind" when calling "resolve"');N!=null&&(D.pluginData=a.store(N)),h!=null&&(D.with=gr(h,"with")),t(n,D,(K,z)=>{K!==null?M(new Error(K)):F({errors:Se(z.errors,a),warnings:Se(z.warnings,a),path:z.path,external:z.external,sideEffects:z.sideEffects,namespace:z.namespace,suffix:z.suffix,pluginData:a.load(z.pluginData)});});})},onStart(p){let g='This error came from the "onStart" callback registered here:',S=Ae(new Error(g),i,"onStart");c.push({name:f,callback:p,note:S}),P.onStart=!0;},onEnd(p){let g='This error came from the "onEnd" callback registered here:',S=Ae(new Error(g),i,"onEnd");u.push({name:f,callback:p,note:S}),P.onEnd=!0;},onResolve(p,g){let S='This error came from the "onResolve" callback registered here:',$=Ae(new Error(S),i,"onResolve"),I={},R=o(p,I,"filter",je),O=o(p,I,"namespace",v);if(W(p,I,`in onResolve() call for plugin ${J(f)}`),R==null)throw new Error("onResolve() call is missing a filter");let j=A++;y[j]={name:f,callback:g,note:$},P.onResolve.push({id:j,filter:Ce(R),namespace:O||""});},onLoad(p,g){let S='This error came from the "onLoad" callback registered here:',$=Ae(new Error(S),i,"onLoad"),I={},R=o(p,I,"filter",je),O=o(p,I,"namespace",v);if(W(p,I,`in onLoad() call for plugin ${J(f)}`),R==null)throw new Error("onLoad() call is missing a filter");let j=A++;k[j]={name:f,callback:g,note:$},P.onLoad.push({id:j,filter:Ce(R),namespace:O||""});},onDispose(p){E.push(p);},esbuild:i.esbuild});T&&await T,L.push(P);}catch(_){return {ok:false,error:_,pluginName:f}}}l["on-start"]=async(w,m)=>{a.clear();let f={errors:[],warnings:[]};await Promise.all(c.map(async({name:_,callback:P,note:C})=>{try{let T=await P();if(T!=null){if(typeof T!="object")throw new Error(`Expected onStart() callback in plugin ${J(_)} to return an object`);let p={},g=o(T,p,"errors",le),S=o(T,p,"warnings",le);W(T,p,`from onStart() callback in plugin ${J(_)}`),g!=null&&f.errors.push(...ue(g,"errors",a,_,void 0)),S!=null&&f.warnings.push(...ue(S,"warnings",a,_,void 0));}}catch(T){f.errors.push(fe(T,i,a,C&&C(),_));}})),r(w,f);},l["on-resolve"]=async(w,m)=>{let f={},_="",P,C;for(let T of m.ids)try{({name:_,callback:P,note:C}=y[T]);let p=await P({path:m.path,importer:m.importer,namespace:m.namespace,resolveDir:m.resolveDir,kind:m.kind,pluginData:a.load(m.pluginData),with:m.with});if(p!=null){if(typeof p!="object")throw new Error(`Expected onResolve() callback in plugin ${J(_)} to return an object`);let g={},S=o(p,g,"pluginName",v),$=o(p,g,"path",v),I=o(p,g,"namespace",v),R=o(p,g,"suffix",v),O=o(p,g,"external",q),j=o(p,g,"sideEffects",q),N=o(p,g,"pluginData",$e),h=o(p,g,"errors",le),F=o(p,g,"warnings",le),M=o(p,g,"watchFiles",G),D=o(p,g,"watchDirs",G);W(p,g,`from onResolve() callback in plugin ${J(_)}`),f.id=T,S!=null&&(f.pluginName=S),$!=null&&(f.path=$),I!=null&&(f.namespace=I),R!=null&&(f.suffix=R),O!=null&&(f.external=O),j!=null&&(f.sideEffects=j),N!=null&&(f.pluginData=a.store(N)),h!=null&&(f.errors=ue(h,"errors",a,_,void 0)),F!=null&&(f.warnings=ue(F,"warnings",a,_,void 0)),M!=null&&(f.watchFiles=Re(M,"watchFiles")),D!=null&&(f.watchDirs=Re(D,"watchDirs"));break}}catch(p){f={id:T,errors:[fe(p,i,a,C&&C(),_)]};break}r(w,f);},l["on-load"]=async(w,m)=>{let f={},_="",P,C;for(let T of m.ids)try{({name:_,callback:P,note:C}=k[T]);let p=await P({path:m.path,namespace:m.namespace,suffix:m.suffix,pluginData:a.load(m.pluginData),with:m.with});if(p!=null){if(typeof p!="object")throw new Error(`Expected onLoad() callback in plugin ${J(_)} to return an object`);let g={},S=o(p,g,"pluginName",v),$=o(p,g,"contents",yt),I=o(p,g,"resolveDir",v),R=o(p,g,"pluginData",$e),O=o(p,g,"loader",v),j=o(p,g,"errors",le),N=o(p,g,"warnings",le),h=o(p,g,"watchFiles",G),F=o(p,g,"watchDirs",G);W(p,g,`from onLoad() callback in plugin ${J(_)}`),f.id=T,S!=null&&(f.pluginName=S),$ instanceof Uint8Array?f.contents=$:$!=null&&(f.contents=ne($)),I!=null&&(f.resolveDir=I),R!=null&&(f.pluginData=a.store(R)),O!=null&&(f.loader=O),j!=null&&(f.errors=ue(j,"errors",a,_,void 0)),N!=null&&(f.warnings=ue(N,"warnings",a,_,void 0)),h!=null&&(f.watchFiles=Re(h,"watchFiles")),F!=null&&(f.watchDirs=Re(F,"watchDirs"));break}}catch(p){f={id:T,errors:[fe(p,i,a,C&&C(),_)]};break}r(w,f);};let H=(w,m)=>m([],[]);u.length>0&&(H=(w,m)=>{(async()=>{let f=[],_=[];for(let{name:P,callback:C,note:T}of u){let p,g;try{let S=await C(w);if(S!=null){if(typeof S!="object")throw new Error(`Expected onEnd() callback in plugin ${J(P)} to return an object`);let $={},I=o(S,$,"errors",le),R=o(S,$,"warnings",le);W(S,$,`from onEnd() callback in plugin ${J(P)}`),I!=null&&(p=ue(I,"errors",a,P,void 0)),R!=null&&(g=ue(R,"warnings",a,P,void 0));}}catch(S){p=[fe(S,i,a,T&&T(),P)];}if(p){f.push(...p);try{w.errors.push(...p);}catch{}}if(g){_.push(...g);try{w.warnings.push(...g);}catch{}}}m(f,_);})();});let x=()=>{for(let w of E)setTimeout(()=>w(),0);};return U=true,{ok:true,requestPlugins:L,runOnEndCallbacks:H,scheduleOnDisposeCallbacks:x}};function St(){let e=new Map,t=0;return {clear(){e.clear();},load(r){return e.get(r)},store(r){if(r===void 0)return -1;let n=t++;return e.set(n,r),n}}}function Ae(e,t,r){let n,i=false;return ()=>{if(i)return n;i=true;try{let l=(e.stack+"").split(`
6
+ `);function pt(e,t){return e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24}function He(e,t,r){e[r++]=t,e[r++]=t>>8,e[r++]=t>>16,e[r++]=t>>24;}var J=JSON.stringify,nt="warning",it="silent";function ve(e,t){let r=[];for(let n of e){if(Q(n,t),n.indexOf(",")>=0)throw new Error(`Invalid ${t}: ${n}`);r.push(n);}return r.join(",")}var je=()=>null,q=e=>typeof e=="boolean"?null:"a boolean",v=e=>typeof e=="string"?null:"a string",Ce=e=>e instanceof RegExp?null:"a RegExp object",de=e=>typeof e=="number"&&e===(e|0)?null:"an integer",er=e=>typeof e=="number"&&e===(e|0)&&e>=0&&e<=65535?null:"a valid port number",gt=e=>typeof e=="function"?null:"a function",le=e=>Array.isArray(e)?null:"an array",G=e=>Array.isArray(e)&&e.every(t=>typeof t=="string")?null:"an array of strings",Z=e=>typeof e=="object"&&e!==null&&!Array.isArray(e)?null:"an object",tr=e=>typeof e=="object"&&e!==null?null:"an array or an object",rr=e=>e instanceof WebAssembly.Module?null:"a WebAssembly.Module",ot=e=>typeof e=="object"&&!Array.isArray(e)?null:"an object or null",mt=e=>typeof e=="string"||typeof e=="boolean"?null:"a string or a boolean",nr=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)&&e.every(t=>typeof t=="string")?null:"a string or an array of strings",yt=e=>typeof e=="string"||e instanceof Uint8Array?null:"a string or a Uint8Array",ir=e=>typeof e=="string"||e instanceof URL?null:"a string or a URL";function o(e,t,r,n){let i=e[r];if(t[r+""]=true,i===void 0)return;let l=n(i);if(l!==null)throw new Error(`${J(r)} must be ${l}`);return i}function W(e,t,r){for(let n in e)if(!(n in t))throw new Error(`Invalid option ${r}: ${J(n)}`)}function or(e){let t=Object.create(null),r=o(e,t,"wasmURL",ir),n=o(e,t,"wasmModule",rr),i=o(e,t,"worker",q);return W(e,t,"in initialize() call"),{wasmURL:r,wasmModule:n,worker:i}}function wt(e){let t;if(e!==void 0){t=Object.create(null);for(let r in e){let n=e[r];if(typeof n=="string"||n===false)t[r]=n;else throw new Error(`Expected ${J(r)} in mangle cache to map to either a string or false`)}}return t}function Me(e,t,r,n,i){let l=o(t,r,"color",q),s=o(t,r,"logLevel",v),d=o(t,r,"logLimit",de);l!==void 0?e.push(`--color=${l}`):n&&e.push("--color=true"),e.push(`--log-level=${s||i}`),e.push(`--log-limit=${d||0}`);}function Q(e,t,r){if(typeof e!="string")throw new Error(`Expected value for ${t}${r!==void 0?" "+J(r):""} to be a string, got ${typeof e} instead`);return e}function vt(e,t,r){let n=o(t,r,"legalComments",v),i=o(t,r,"sourceRoot",v),l=o(t,r,"sourcesContent",q),s=o(t,r,"target",ht),d=o(t,r,"format",v),a=o(t,r,"globalName",v),c=o(t,r,"mangleProps",Ce),u=o(t,r,"reserveProps",Ce),y=o(t,r,"mangleQuoted",q),k=o(t,r,"minify",q),E=o(t,r,"minifySyntax",q),A=o(t,r,"minifyWhitespace",q),F=o(t,r,"minifyIdentifiers",q),L=o(t,r,"lineLimit",de),U=o(t,r,"drop",G),z=o(t,r,"dropLabels",G),x=o(t,r,"charset",v),w=o(t,r,"treeShaking",q),m=o(t,r,"ignoreAnnotations",q),f=o(t,r,"jsx",v),_=o(t,r,"jsxFactory",v),P=o(t,r,"jsxFragment",v),$=o(t,r,"jsxImportSource",v),T=o(t,r,"jsxDev",q),p=o(t,r,"jsxSideEffects",q),g=o(t,r,"define",Z),S=o(t,r,"logOverride",Z),j=o(t,r,"supported",Z),I=o(t,r,"pure",G),R=o(t,r,"keepNames",q),O=o(t,r,"platform",v),C=o(t,r,"tsconfigRaw",nr),N=o(t,r,"absPaths",G);if(n&&e.push(`--legal-comments=${n}`),i!==void 0&&e.push(`--source-root=${i}`),l!==void 0&&e.push(`--sources-content=${l}`),s&&e.push(`--target=${ve(Array.isArray(s)?s:[s],"target")}`),d&&e.push(`--format=${d}`),a&&e.push(`--global-name=${a}`),O&&e.push(`--platform=${O}`),C&&e.push(`--tsconfig-raw=${typeof C=="string"?C:JSON.stringify(C)}`),k&&e.push("--minify"),E&&e.push("--minify-syntax"),A&&e.push("--minify-whitespace"),F&&e.push("--minify-identifiers"),L&&e.push(`--line-limit=${L}`),x&&e.push(`--charset=${x}`),w!==void 0&&e.push(`--tree-shaking=${w}`),m&&e.push("--ignore-annotations"),U)for(let h of U)e.push(`--drop:${Q(h,"drop")}`);if(z&&e.push(`--drop-labels=${ve(z,"drop label")}`),N&&e.push(`--abs-paths=${ve(N,"abs paths")}`),c&&e.push(`--mangle-props=${$e(c)}`),u&&e.push(`--reserve-props=${$e(u)}`),y!==void 0&&e.push(`--mangle-quoted=${y}`),f&&e.push(`--jsx=${f}`),_&&e.push(`--jsx-factory=${_}`),P&&e.push(`--jsx-fragment=${P}`),$&&e.push(`--jsx-import-source=${$}`),T&&e.push("--jsx-dev"),p&&e.push("--jsx-side-effects"),g)for(let h in g){if(h.indexOf("=")>=0)throw new Error(`Invalid define: ${h}`);e.push(`--define:${h}=${Q(g[h],"define",h)}`);}if(S)for(let h in S){if(h.indexOf("=")>=0)throw new Error(`Invalid log override: ${h}`);e.push(`--log-override:${h}=${Q(S[h],"log override",h)}`);}if(j)for(let h in j){if(h.indexOf("=")>=0)throw new Error(`Invalid supported: ${h}`);let B=j[h];if(typeof B!="boolean")throw new Error(`Expected value for supported ${J(h)} to be a boolean, got ${typeof B} instead`);e.push(`--supported:${h}=${B}`);}if(I)for(let h of I)e.push(`--pure:${Q(h,"pure")}`);R&&e.push("--keep-names");}function sr(e,t,r,n,i){var l;let s=[],d=[],a=Object.create(null),c=null,u=null;Me(s,t,a,r,n),vt(s,t,a);let y=o(t,a,"sourcemap",mt),k=o(t,a,"bundle",q),E=o(t,a,"splitting",q),A=o(t,a,"preserveSymlinks",q),F=o(t,a,"metafile",q),L=o(t,a,"outfile",v),U=o(t,a,"outdir",v),z=o(t,a,"outbase",v),x=o(t,a,"tsconfig",v),w=o(t,a,"resolveExtensions",G),m=o(t,a,"nodePaths",G),f=o(t,a,"mainFields",G),_=o(t,a,"conditions",G),P=o(t,a,"external",G),$=o(t,a,"packages",v),T=o(t,a,"alias",Z),p=o(t,a,"loader",Z),g=o(t,a,"outExtension",Z),S=o(t,a,"publicPath",v),j=o(t,a,"entryNames",v),I=o(t,a,"chunkNames",v),R=o(t,a,"assetNames",v),O=o(t,a,"inject",G),C=o(t,a,"banner",Z),N=o(t,a,"footer",Z),h=o(t,a,"entryPoints",tr),B=o(t,a,"absWorkingDir",v),M=o(t,a,"stdin",Z),D=(l=o(t,a,"write",q))!=null?l:i,K=o(t,a,"allowOverwrite",q),H=o(t,a,"mangleCache",Z);if(a.plugins=true,W(t,a,`in ${e}() call`),y&&s.push(`--sourcemap${y===true?"":`=${y}`}`),k&&s.push("--bundle"),K&&s.push("--allow-overwrite"),E&&s.push("--splitting"),A&&s.push("--preserve-symlinks"),F&&s.push("--metafile"),L&&s.push(`--outfile=${L}`),U&&s.push(`--outdir=${U}`),z&&s.push(`--outbase=${z}`),x&&s.push(`--tsconfig=${x}`),$&&s.push(`--packages=${$}`),w&&s.push(`--resolve-extensions=${ve(w,"resolve extension")}`),S&&s.push(`--public-path=${S}`),j&&s.push(`--entry-names=${j}`),I&&s.push(`--chunk-names=${I}`),R&&s.push(`--asset-names=${R}`),f&&s.push(`--main-fields=${ve(f,"main field")}`),_&&s.push(`--conditions=${ve(_,"condition")}`),P)for(let b of P)s.push(`--external:${Q(b,"external")}`);if(T)for(let b in T){if(b.indexOf("=")>=0)throw new Error(`Invalid package name in alias: ${b}`);s.push(`--alias:${b}=${Q(T[b],"alias",b)}`);}if(C)for(let b in C){if(b.indexOf("=")>=0)throw new Error(`Invalid banner file type: ${b}`);s.push(`--banner:${b}=${Q(C[b],"banner",b)}`);}if(N)for(let b in N){if(b.indexOf("=")>=0)throw new Error(`Invalid footer file type: ${b}`);s.push(`--footer:${b}=${Q(N[b],"footer",b)}`);}if(O)for(let b of O)s.push(`--inject:${Q(b,"inject")}`);if(p)for(let b in p){if(b.indexOf("=")>=0)throw new Error(`Invalid loader extension: ${b}`);s.push(`--loader:${b}=${Q(p[b],"loader",b)}`);}if(g)for(let b in g){if(b.indexOf("=")>=0)throw new Error(`Invalid out extension: ${b}`);s.push(`--out-extension:${b}=${Q(g[b],"out extension",b)}`);}if(h)if(Array.isArray(h))for(let b=0,se=h.length;b<se;b++){let ee=h[b];if(typeof ee=="object"&&ee!==null){let ie=Object.create(null),ae=o(ee,ie,"in",v),te=o(ee,ie,"out",v);if(W(ee,ie,"in entry point at index "+b),ae===void 0)throw new Error('Missing property "in" for entry point at index '+b);if(te===void 0)throw new Error('Missing property "out" for entry point at index '+b);d.push([te,ae]);}else d.push(["",Q(ee,"entry point at index "+b)]);}else for(let b in h)d.push([b,Q(h[b],"entry point",b)]);if(M){let b=Object.create(null),se=o(M,b,"contents",yt),ee=o(M,b,"resolveDir",v),ie=o(M,b,"sourcefile",v),ae=o(M,b,"loader",v);W(M,b,'in "stdin" object'),ie&&s.push(`--sourcefile=${ie}`),ae&&s.push(`--loader=${ae}`),ee&&(u=ee),typeof se=="string"?c=ne(se):se instanceof Uint8Array&&(c=se);}let oe=[];if(m)for(let b of m)b+="",oe.push(b);return {entries:d,flags:s,write:D,stdinContents:c,stdinResolveDir:u,absWorkingDir:B,nodePaths:oe,mangleCache:wt(H)}}function ar(e,t,r,n){let i=[],l=Object.create(null);Me(i,t,l,r,n),vt(i,t,l);let s=o(t,l,"sourcemap",mt),d=o(t,l,"sourcefile",v),a=o(t,l,"loader",v),c=o(t,l,"banner",v),u=o(t,l,"footer",v),y=o(t,l,"mangleCache",Z);return W(t,l,`in ${e}() call`),s&&i.push(`--sourcemap=${s===true?"external":s}`),d&&i.push(`--sourcefile=${d}`),a&&i.push(`--loader=${a}`),c&&i.push(`--banner=${c}`),u&&i.push(`--footer=${u}`),{flags:i,mangleCache:wt(y)}}function bt(e){let t={},r={didClose:false,reason:""},n={},i=0,l=0,s=new Uint8Array(16*1024),d=0,a=x=>{let w=d+x.length;if(w>s.length){let f=new Uint8Array(w*2);f.set(s),s=f;}s.set(x,d),d+=x.length;let m=0;for(;m+4<=d;){let f=pt(s,m);if(m+4+f>d)break;m+=4,A(s.subarray(m,m+f)),m+=f;}m>0&&(s.copyWithin(0,m,d),d-=m);},c=x=>{r.didClose=true,x&&(r.reason=": "+(x.message||x));let w="The service was stopped"+r.reason;for(let m in n)n[m](w,null);n={};},u=(x,w,m)=>{if(r.didClose)return m("The service is no longer running"+r.reason,null);let f=i++;n[f]=(_,P)=>{try{m(_,P);}finally{x&&x.unref();}},x&&x.ref(),e.writeToStdin(rt({id:f,isRequest:true,value:w}));},y=(x,w)=>{if(r.didClose)throw new Error("The service is no longer running"+r.reason);e.writeToStdin(rt({id:x,isRequest:false,value:w}));},k=async(x,w)=>{try{if(w.command==="ping"){y(x,{});return}if(typeof w.key=="number"){let m=t[w.key];if(!m)return;let f=m[w.command];if(f){await f(x,w);return}}throw new Error("Invalid command: "+w.command)}catch(m){let f=[fe(m,e,null,void 0,"")];try{y(x,{errors:f});}catch{}}},E=true,A=x=>{if(E){E=false;let m=String.fromCharCode(...x);if(m!=="0.27.2")throw new Error(`Cannot start service: Host version "0.27.2" does not match binary version ${J(m)}`);return}let w=Zt(x);if(w.isRequest)k(w.id,w.value);else {let m=n[w.id];delete n[w.id],w.value.error?m(w.value.error,{}):m(null,w.value);}};return {readFromStdout:a,afterClose:c,service:{buildOrContext:({callName:x,refs:w,options:m,isTTY:f,defaultWD:_,callback:P})=>{let $=0,T=l++,p={},g={ref(){++$===1&&w&&w.ref();},unref(){--$===0&&(delete t[T],w&&w.unref());}};t[T]=p,g.ref(),lr(x,T,u,y,g,e,p,m,f,_,(S,j)=>{try{P(S,j);}finally{g.unref();}});},transform:({callName:x,refs:w,input:m,options:f,isTTY:_,fs:P,callback:$})=>{let T=St(),p=g=>{try{if(typeof m!="string"&&!(m instanceof Uint8Array))throw new Error('The input to "transform" must be a string or a Uint8Array');let{flags:S,mangleCache:j}=ar(x,f,_,it),I={command:"transform",flags:S,inputFS:g!==null,input:g!==null?ne(g):typeof m=="string"?ne(m):m};j&&(I.mangleCache=j),u(w,I,(R,O)=>{if(R)return $(new Error(R),null);let C=Se(O.errors,T),N=Se(O.warnings,T),h=1,B=()=>{if(--h===0){let M={warnings:N,code:O.code,map:O.map,mangleCache:void 0,legalComments:void 0};"legalComments"in O&&(M.legalComments=O?.legalComments),O.mangleCache&&(M.mangleCache=O?.mangleCache),$(null,M);}};if(C.length>0)return $(_e("Transform failed",C,N),null);O.codeFS&&(h++,P.readFile(O.code,(M,D)=>{M!==null?$(M,null):(O.code=D,B());})),O.mapFS&&(h++,P.readFile(O.map,(M,D)=>{M!==null?$(M,null):(O.map=D,B());})),B();});}catch(S){let j=[];try{Me(j,f,{},_,it);}catch{}let I=fe(S,e,T,void 0,"");u(w,{command:"error",flags:j,error:I},()=>{I.detail=T.load(I.detail),$(_e("Transform failed",[I],[]),null);});}};if((typeof m=="string"||m instanceof Uint8Array)&&m.length>1024*1024){let g=p;p=()=>P.writeFile(m,g);}p(null);},formatMessages:({callName:x,refs:w,messages:m,options:f,callback:_})=>{if(!f)throw new Error(`Missing second argument in ${x}() call`);let P={},$=o(f,P,"kind",v),T=o(f,P,"color",q),p=o(f,P,"terminalWidth",de);if(W(f,P,`in ${x}() call`),$===void 0)throw new Error(`Missing "kind" in ${x}() call`);if($!=="error"&&$!=="warning")throw new Error(`Expected "kind" to be "error" or "warning" in ${x}() call`);let g={command:"format-msgs",messages:ue(m,"messages",null,"",p),isWarning:$==="warning"};T!==void 0&&(g.color=T),p!==void 0&&(g.terminalWidth=p),u(w,g,(S,j)=>{if(S)return _(new Error(S),null);_(null,j.messages);});},analyzeMetafile:({callName:x,refs:w,metafile:m,options:f,callback:_})=>{f===void 0&&(f={});let P={},$=o(f,P,"color",q),T=o(f,P,"verbose",q);W(f,P,`in ${x}() call`);let p={command:"analyze-metafile",metafile:m};$!==void 0&&(p.color=$),T!==void 0&&(p.verbose=T),u(w,p,(g,S)=>{if(g)return _(new Error(g),null);_(null,S.result);});}}}}function lr(e,t,r,n,i,l,s,d,a,c,u){let y=St(),k=e==="context",E=(L,U)=>{let z=[];try{Me(z,d,{},a,nt);}catch{}let x=fe(L,l,y,void 0,U);r(i,{command:"error",flags:z,error:x},()=>{x.detail=y.load(x.detail),u(_e(k?"Context failed":"Build failed",[x],[]),null);});},A;if(typeof d=="object"){let L=d.plugins;if(L!==void 0){if(!Array.isArray(L))return E(new Error('"plugins" must be an array'),"");A=L;}}if(A&&A.length>0){if(l.isSync)return E(new Error("Cannot use plugins in synchronous API calls"),"");ur(t,r,n,i,l,s,d,A,y).then(L=>{if(!L.ok)return E(L.error,L.pluginName);try{F(L.requestPlugins,L.runOnEndCallbacks,L.scheduleOnDisposeCallbacks);}catch(U){E(U,"");}},L=>E(L,""));return}try{F(null,(L,U)=>U([],[]),()=>{});}catch(L){E(L,"");}function F(L,U,z){let x=l.hasFS,{entries:w,flags:m,write:f,stdinContents:_,stdinResolveDir:P,absWorkingDir:$,nodePaths:T,mangleCache:p}=sr(e,d,a,nt,x);if(f&&!l.hasFS)throw new Error('The "write" option is unavailable in this environment');let g={command:"build",key:t,entries:w,flags:m,write:f,stdinContents:_,stdinResolveDir:P,absWorkingDir:$||c,nodePaths:T,context:k};L&&(g.plugins=L),p&&(g.mangleCache=p);let S=(R,O)=>{let C={errors:Se(R.errors,y),warnings:Se(R.warnings,y),outputFiles:void 0,metafile:void 0,mangleCache:void 0},N=C.errors.slice(),h=C.warnings.slice();R.outputFiles&&(C.outputFiles=R.outputFiles.map(fr)),R.metafile&&(C.metafile=JSON.parse(R.metafile)),R.mangleCache&&(C.mangleCache=R.mangleCache),R.writeToStdout!==void 0&&console.log(be(R.writeToStdout).replace(/\n$/,"")),U(C,(B,M)=>{if(N.length>0||B.length>0){let D=_e("Build failed",N.concat(B),h.concat(M));return O(D,null,B,M)}O(null,C,B,M);});},j,I;k&&(s["on-end"]=(R,O)=>new Promise(C=>{S(O,(N,h,B,M)=>{let D={errors:B,warnings:M};I&&I(N,h),j=void 0,I=void 0,n(R,D),C();});})),r(i,g,(R,O)=>{if(R)return u(new Error(R),null);if(!k)return S(O,(h,B)=>(z(),u(h,B)));if(O.errors.length>0)return u(_e("Context failed",O.errors,O.warnings),null);let C=false,N={rebuild:()=>(j||(j=new Promise((h,B)=>{let M;I=(K,H)=>{M||(M=()=>K?B(K):h(H));};let D=()=>{r(i,{command:"rebuild",key:t},(H,oe)=>{H?B(new Error(H)):M?M():D();});};D();})),j),watch:(h={})=>new Promise((B,M)=>{if(!l.hasFS)throw new Error('Cannot use the "watch" API in this environment');let D={},K=o(h,D,"delay",de);W(h,D,"in watch() call");let H={command:"watch",key:t};K&&(H.delay=K),r(i,H,oe=>{oe?M(new Error(oe)):B(void 0);});}),serve:(h={})=>new Promise((B,M)=>{if(!l.hasFS)throw new Error('Cannot use the "serve" API in this environment');let D={},K=o(h,D,"port",er),H=o(h,D,"host",v),oe=o(h,D,"servedir",v),b=o(h,D,"keyfile",v),se=o(h,D,"certfile",v),ee=o(h,D,"fallback",v),ie=o(h,D,"cors",Z),ae=o(h,D,"onRequest",gt);W(h,D,"in serve() call");let te={command:"serve",key:t,onRequest:!!ae};if(K!==void 0&&(te.port=K),H!==void 0&&(te.host=H),oe!==void 0&&(te.servedir=oe),b!==void 0&&(te.keyfile=b),se!==void 0&&(te.certfile=se),ee!==void 0&&(te.fallback=ee),ie){let xe={},he=o(ie,xe,"origin",ht);W(ie,xe,'on "cors" object'),Array.isArray(he)?te.corsOrigin=he:he!==void 0&&(te.corsOrigin=[he]);}r(i,te,(xe,he)=>{if(xe)return M(new Error(xe));ae&&(s["serve-request"]=(Rt,jt)=>{ae(jt.args),n(Rt,{});}),B(he);});}),cancel:()=>new Promise(h=>{if(C)return h();r(i,{command:"cancel",key:t},()=>{h();});}),dispose:()=>new Promise(h=>{if(C)return h();C=true,r(i,{command:"dispose",key:t},()=>{h(),z(),i.unref();});})};i.ref(),u(null,N);});}}var ur=async(e,t,r,n,i,l,s,d,a)=>{let c=[],u=[],y={},k={},E=[],A=0,F=0,L=[],U=false;d=[...d];for(let w of d){let m={};if(typeof w!="object")throw new Error(`Plugin at index ${F} must be an object`);let f=o(w,m,"name",v);if(typeof f!="string"||f==="")throw new Error(`Plugin at index ${F} is missing a name`);try{let _=o(w,m,"setup",gt);if(typeof _!="function")throw new Error("Plugin is missing a setup function");W(w,m,`on plugin ${J(f)}`);let P={name:f,onStart:!1,onEnd:!1,onResolve:[],onLoad:[]};F++;let T=_({initialOptions:s,resolve:(p,g={})=>{if(!U)throw new Error('Cannot call "resolve" before plugin setup has completed');if(typeof p!="string")throw new Error("The path to resolve must be a string");let S=Object.create(null),j=o(g,S,"pluginName",v),I=o(g,S,"importer",v),R=o(g,S,"namespace",v),O=o(g,S,"resolveDir",v),C=o(g,S,"kind",v),N=o(g,S,"pluginData",je),h=o(g,S,"with",Z);return W(g,S,"in resolve() call"),new Promise((B,M)=>{let D={command:"resolve",path:p,key:e,pluginName:f};if(j!=null&&(D.pluginName=j),I!=null&&(D.importer=I),R!=null&&(D.namespace=R),O!=null&&(D.resolveDir=O),C!=null)D.kind=C;else throw new Error('Must specify "kind" when calling "resolve"');N!=null&&(D.pluginData=a.store(N)),h!=null&&(D.with=cr(h,"with")),t(n,D,(K,H)=>{K!==null?M(new Error(K)):B({errors:Se(H.errors,a),warnings:Se(H.warnings,a),path:H.path,external:H.external,sideEffects:H.sideEffects,namespace:H.namespace,suffix:H.suffix,pluginData:a.load(H.pluginData)});});})},onStart(p){let g='This error came from the "onStart" callback registered here:',S=Ae(new Error(g),i,"onStart");c.push({name:f,callback:p,note:S}),P.onStart=!0;},onEnd(p){let g='This error came from the "onEnd" callback registered here:',S=Ae(new Error(g),i,"onEnd");u.push({name:f,callback:p,note:S}),P.onEnd=!0;},onResolve(p,g){let S='This error came from the "onResolve" callback registered here:',j=Ae(new Error(S),i,"onResolve"),I={},R=o(p,I,"filter",Ce),O=o(p,I,"namespace",v);if(W(p,I,`in onResolve() call for plugin ${J(f)}`),R==null)throw new Error("onResolve() call is missing a filter");let C=A++;y[C]={name:f,callback:g,note:j},P.onResolve.push({id:C,filter:$e(R),namespace:O||""});},onLoad(p,g){let S='This error came from the "onLoad" callback registered here:',j=Ae(new Error(S),i,"onLoad"),I={},R=o(p,I,"filter",Ce),O=o(p,I,"namespace",v);if(W(p,I,`in onLoad() call for plugin ${J(f)}`),R==null)throw new Error("onLoad() call is missing a filter");let C=A++;k[C]={name:f,callback:g,note:j},P.onLoad.push({id:C,filter:$e(R),namespace:O||""});},onDispose(p){E.push(p);},esbuild:i.esbuild});T&&await T,L.push(P);}catch(_){return {ok:false,error:_,pluginName:f}}}l["on-start"]=async(w,m)=>{a.clear();let f={errors:[],warnings:[]};await Promise.all(c.map(async({name:_,callback:P,note:$})=>{try{let T=await P();if(T!=null){if(typeof T!="object")throw new Error(`Expected onStart() callback in plugin ${J(_)} to return an object`);let p={},g=o(T,p,"errors",le),S=o(T,p,"warnings",le);W(T,p,`from onStart() callback in plugin ${J(_)}`),g!=null&&f.errors.push(...ue(g,"errors",a,_,void 0)),S!=null&&f.warnings.push(...ue(S,"warnings",a,_,void 0));}}catch(T){f.errors.push(fe(T,i,a,$&&$(),_));}})),r(w,f);},l["on-resolve"]=async(w,m)=>{let f={},_="",P,$;for(let T of m.ids)try{({name:_,callback:P,note:$}=y[T]);let p=await P({path:m.path,importer:m.importer,namespace:m.namespace,resolveDir:m.resolveDir,kind:m.kind,pluginData:a.load(m.pluginData),with:m.with});if(p!=null){if(typeof p!="object")throw new Error(`Expected onResolve() callback in plugin ${J(_)} to return an object`);let g={},S=o(p,g,"pluginName",v),j=o(p,g,"path",v),I=o(p,g,"namespace",v),R=o(p,g,"suffix",v),O=o(p,g,"external",q),C=o(p,g,"sideEffects",q),N=o(p,g,"pluginData",je),h=o(p,g,"errors",le),B=o(p,g,"warnings",le),M=o(p,g,"watchFiles",G),D=o(p,g,"watchDirs",G);W(p,g,`from onResolve() callback in plugin ${J(_)}`),f.id=T,S!=null&&(f.pluginName=S),j!=null&&(f.path=j),I!=null&&(f.namespace=I),R!=null&&(f.suffix=R),O!=null&&(f.external=O),C!=null&&(f.sideEffects=C),N!=null&&(f.pluginData=a.store(N)),h!=null&&(f.errors=ue(h,"errors",a,_,void 0)),B!=null&&(f.warnings=ue(B,"warnings",a,_,void 0)),M!=null&&(f.watchFiles=Re(M,"watchFiles")),D!=null&&(f.watchDirs=Re(D,"watchDirs"));break}}catch(p){f={id:T,errors:[fe(p,i,a,$&&$(),_)]};break}r(w,f);},l["on-load"]=async(w,m)=>{let f={},_="",P,$;for(let T of m.ids)try{({name:_,callback:P,note:$}=k[T]);let p=await P({path:m.path,namespace:m.namespace,suffix:m.suffix,pluginData:a.load(m.pluginData),with:m.with});if(p!=null){if(typeof p!="object")throw new Error(`Expected onLoad() callback in plugin ${J(_)} to return an object`);let g={},S=o(p,g,"pluginName",v),j=o(p,g,"contents",yt),I=o(p,g,"resolveDir",v),R=o(p,g,"pluginData",je),O=o(p,g,"loader",v),C=o(p,g,"errors",le),N=o(p,g,"warnings",le),h=o(p,g,"watchFiles",G),B=o(p,g,"watchDirs",G);W(p,g,`from onLoad() callback in plugin ${J(_)}`),f.id=T,S!=null&&(f.pluginName=S),j instanceof Uint8Array?f.contents=j:j!=null&&(f.contents=ne(j)),I!=null&&(f.resolveDir=I),R!=null&&(f.pluginData=a.store(R)),O!=null&&(f.loader=O),C!=null&&(f.errors=ue(C,"errors",a,_,void 0)),N!=null&&(f.warnings=ue(N,"warnings",a,_,void 0)),h!=null&&(f.watchFiles=Re(h,"watchFiles")),B!=null&&(f.watchDirs=Re(B,"watchDirs"));break}}catch(p){f={id:T,errors:[fe(p,i,a,$&&$(),_)]};break}r(w,f);};let z=(w,m)=>m([],[]);u.length>0&&(z=(w,m)=>{(async()=>{let f=[],_=[];for(let{name:P,callback:$,note:T}of u){let p,g;try{let S=await $(w);if(S!=null){if(typeof S!="object")throw new Error(`Expected onEnd() callback in plugin ${J(P)} to return an object`);let j={},I=o(S,j,"errors",le),R=o(S,j,"warnings",le);W(S,j,`from onEnd() callback in plugin ${J(P)}`),I!=null&&(p=ue(I,"errors",a,P,void 0)),R!=null&&(g=ue(R,"warnings",a,P,void 0));}}catch(S){p=[fe(S,i,a,T&&T(),P)];}if(p){f.push(...p);try{w.errors.push(...p);}catch{}}if(g){_.push(...g);try{w.warnings.push(...g);}catch{}}}m(f,_);})();});let x=()=>{for(let w of E)setTimeout(()=>w(),0);};return U=true,{ok:true,requestPlugins:L,runOnEndCallbacks:z,scheduleOnDisposeCallbacks:x}};function St(){let e=new Map,t=0;return {clear(){e.clear();},load(r){return e.get(r)},store(r){if(r===void 0)return -1;let n=t++;return e.set(n,r),n}}}function Ae(e,t,r){let n,i=false;return ()=>{if(i)return n;i=true;try{let l=(e.stack+"").split(`
7
7
  `);l.splice(1,1);let s=xt(t,l,r);if(s)return n={text:e.message,location:s},n}catch{}}}function fe(e,t,r,n,i){let l="Internal error",s=null;try{l=(e&&e.message||e)+"";}catch{}try{s=xt(t,(e.stack+"").split(`
8
8
  `),"");}catch{}return {id:"",pluginName:i,text:l,location:s,notes:n?[n]:[],detail:r?r.store(e):-1}}function xt(e,t,r){let n=" at ";if(e.readFileSync&&!t[0].startsWith(n)&&t[1].startsWith(n))for(let i=1;i<t.length;i++){let l=t[i];if(l.startsWith(n))for(l=l.slice(n.length);;){let s=/^(?:new |async )?\S+ \((.*)\)$/.exec(l);if(s){l=s[1];continue}if(s=/^eval at \S+ \((.*)\)(?:, \S+:\d+:\d+)?$/.exec(l),s){l=s[1];continue}if(s=/^(\S+):(\d+):(\d+)$/.exec(l),s){let d;try{d=e.readFileSync(s[1],"utf8");}catch{break}let a=d.split(/\r\n|\r|\n|\u2028|\u2029/)[+s[2]-1]||"",c=+s[3]-1,u=a.slice(c,c+r.length)===r?r.length:0;return {file:s[1],namespace:"file",line:+s[2],column:ne(a.slice(0,c)).length,length:ne(a.slice(c,c+u)).length,lineText:a+`
9
9
  `+t.slice(1).join(`
10
10
  `),suggestion:""}}break}}return null}function _e(e,t,r){let n=5;e+=t.length<1?"":` with ${t.length} error${t.length<2?"":"s"}:`+t.slice(0,n+1).map((l,s)=>{if(s===n)return `
11
11
  ...`;if(!l.location)return `
12
12
  error: ${l.text}`;let{file:d,line:a,column:c}=l.location,u=l.pluginName?`[plugin: ${l.pluginName}] `:"";return `
13
- ${d}:${a}:${c}: ERROR: ${u}${l.text}`}).join("");let i=new Error(e);for(let[l,s]of [["errors",t],["warnings",r]])Object.defineProperty(i,l,{configurable:true,enumerable:true,get:()=>s,set:d=>Object.defineProperty(i,l,{configurable:true,enumerable:true,value:d})});return i}function Se(e,t){for(let r of e)r.detail=t.load(r.detail);return e}function st(e,t,r){if(e==null)return null;let n={},i=o(e,n,"file",v),l=o(e,n,"namespace",v),s=o(e,n,"line",de),d=o(e,n,"column",de),a=o(e,n,"length",de),c=o(e,n,"lineText",v),u=o(e,n,"suggestion",v);if(W(e,n,t),c){let y=c.slice(0,(d&&d>0?d:0)+(a&&a>0?a:0)+(r&&r>0?r:80));!/[\x7F-\uFFFF]/.test(y)&&!/\n/.test(c)&&(c=y);}return {file:i||"",namespace:l||"",line:s||0,column:d||0,length:a||0,lineText:c||"",suggestion:u||""}}function ue(e,t,r,n,i){let l=[],s=0;for(let d of e){let a={},c=o(d,a,"id",v),u=o(d,a,"pluginName",v),y=o(d,a,"text",v),k=o(d,a,"location",ot),E=o(d,a,"notes",le),A=o(d,a,"detail",$e),B=`in element ${s} of "${t}"`;W(d,a,B);let L=[];if(E)for(let U of E){let H={},x=o(U,H,"text",v),w=o(U,H,"location",ot);W(U,H,B),L.push({text:x||"",location:st(w,B,i)});}l.push({id:c||"",pluginName:u||n,text:y||"",location:st(k,B,i),notes:L,detail:r?r.store(A):-1}),s++;}return l}function Re(e,t){let r=[];for(let n of e){if(typeof n!="string")throw new Error(`${J(t)} must be an array of strings`);r.push(n);}return r}function gr(e,t){let r=Object.create(null);for(let n in e){let i=e[n];if(typeof i!="string")throw new Error(`key ${J(n)} in object ${J(t)} must be a string`);r[n]=i;}return r}function mr({path:e,contents:t,hash:r}){let n=null;return {path:e,contents:t,hash:r,get text(){let i=this.contents;return (n===null||i!==t)&&(t=i,n=be(i)),n}}}function Ce(e){let t=e.source;return e.flags&&(t=`(?${e.flags})${t}`),t}var ce=V("fs"),at=V("os"),re=V("path"),we=process.env.ESBUILD_BINARY_PATH||we,hr=e=>!!e&&e!=="/usr/bin/esbuild",lt="@esbuild/darwin-arm64",ut="@esbuild/darwin-x64",Ie={"win32 arm64 LE":"@esbuild/win32-arm64","win32 ia32 LE":"@esbuild/win32-ia32","win32 x64 LE":"@esbuild/win32-x64"},Le={"aix ppc64 BE":"@esbuild/aix-ppc64","android arm64 LE":"@esbuild/android-arm64","darwin arm64 LE":"@esbuild/darwin-arm64","darwin x64 LE":"@esbuild/darwin-x64","freebsd arm64 LE":"@esbuild/freebsd-arm64","freebsd x64 LE":"@esbuild/freebsd-x64","linux arm LE":"@esbuild/linux-arm","linux arm64 LE":"@esbuild/linux-arm64","linux ia32 LE":"@esbuild/linux-ia32","linux mips64el LE":"@esbuild/linux-mips64el","linux ppc64 LE":"@esbuild/linux-ppc64","linux riscv64 LE":"@esbuild/linux-riscv64","linux s390x BE":"@esbuild/linux-s390x","linux x64 LE":"@esbuild/linux-x64","linux loong64 LE":"@esbuild/linux-loong64","netbsd arm64 LE":"@esbuild/netbsd-arm64","netbsd x64 LE":"@esbuild/netbsd-x64","openbsd arm64 LE":"@esbuild/openbsd-arm64","openbsd x64 LE":"@esbuild/openbsd-x64","sunos x64 LE":"@esbuild/sunos-x64"},ct={"android arm LE":"@esbuild/android-arm","android x64 LE":"@esbuild/android-x64","openharmony arm64 LE":"@esbuild/openharmony-arm64"};function yr(){let e,t,r=false,n=`${process.platform} ${at.arch()} ${at.endianness()}`;if(n in Ie)e=Ie[n],t="esbuild.exe";else if(n in Le)e=Le[n],t="bin/esbuild";else if(n in ct)e=ct[n],t="bin/esbuild",r=true;else throw new Error(`Unsupported platform: ${n}`);return {pkg:e,subpath:t,isWASM:r}}function wr(){let e=V.resolve("esbuild"),t=re.dirname(re.dirname(re.dirname(e)));if(re.basename(t)==="node_modules"){for(let r in Le)try{let n=Le[r];if(ce.existsSync(re.join(t,n)))return n}catch{}for(let r in Ie)try{let n=Ie[r];if(ce.existsSync(re.join(t,n)))return n}catch{}}return null}function vr(e,t){let r=re.dirname(V.resolve("esbuild"));return re.join(r,`downloaded-${e.replace("/","-")}-${re.basename(t)}`)}function br(){if(hr(we))if(!ce.existsSync(we))console.warn(`[esbuild] Ignoring bad configuration: ESBUILD_BINARY_PATH=${we}`);else return {binPath:we,isWASM:false};let{pkg:e,subpath:t,isWASM:r}=yr(),n;try{n=V.resolve(`${e}/${t}`);}catch(i){if(n=vr(e,t),!ce.existsSync(n)){try{V.resolve(e);}catch{let l=wr();if(l){let s=`
13
+ ${d}:${a}:${c}: ERROR: ${u}${l.text}`}).join("");let i=new Error(e);for(let[l,s]of [["errors",t],["warnings",r]])Object.defineProperty(i,l,{configurable:true,enumerable:true,get:()=>s,set:d=>Object.defineProperty(i,l,{configurable:true,enumerable:true,value:d})});return i}function Se(e,t){for(let r of e)r.detail=t.load(r.detail);return e}function st(e,t,r){if(e==null)return null;let n={},i=o(e,n,"file",v),l=o(e,n,"namespace",v),s=o(e,n,"line",de),d=o(e,n,"column",de),a=o(e,n,"length",de),c=o(e,n,"lineText",v),u=o(e,n,"suggestion",v);if(W(e,n,t),c){let y=c.slice(0,(d&&d>0?d:0)+(a&&a>0?a:0)+(r&&r>0?r:80));!/[\x7F-\uFFFF]/.test(y)&&!/\n/.test(c)&&(c=y);}return {file:i||"",namespace:l||"",line:s||0,column:d||0,length:a||0,lineText:c||"",suggestion:u||""}}function ue(e,t,r,n,i){let l=[],s=0;for(let d of e){let a={},c=o(d,a,"id",v),u=o(d,a,"pluginName",v),y=o(d,a,"text",v),k=o(d,a,"location",ot),E=o(d,a,"notes",le),A=o(d,a,"detail",je),F=`in element ${s} of "${t}"`;W(d,a,F);let L=[];if(E)for(let U of E){let z={},x=o(U,z,"text",v),w=o(U,z,"location",ot);W(U,z,F),L.push({text:x||"",location:st(w,F,i)});}l.push({id:c||"",pluginName:u||n,text:y||"",location:st(k,F,i),notes:L,detail:r?r.store(A):-1}),s++;}return l}function Re(e,t){let r=[];for(let n of e){if(typeof n!="string")throw new Error(`${J(t)} must be an array of strings`);r.push(n);}return r}function cr(e,t){let r=Object.create(null);for(let n in e){let i=e[n];if(typeof i!="string")throw new Error(`key ${J(n)} in object ${J(t)} must be a string`);r[n]=i;}return r}function fr({path:e,contents:t,hash:r}){let n=null;return {path:e,contents:t,hash:r,get text(){let i=this.contents;return (n===null||i!==t)&&(t=i,n=be(i)),n}}}function $e(e){let t=e.source;return e.flags&&(t=`(?${e.flags})${t}`),t}var ce=V("fs"),at=V("os"),re=V("path"),we=process.env.ESBUILD_BINARY_PATH||we,dr=e=>!!e&&e!=="/usr/bin/esbuild",lt="@esbuild/darwin-arm64",ut="@esbuild/darwin-x64",Ie={"win32 arm64 LE":"@esbuild/win32-arm64","win32 ia32 LE":"@esbuild/win32-ia32","win32 x64 LE":"@esbuild/win32-x64"},Le={"aix ppc64 BE":"@esbuild/aix-ppc64","android arm64 LE":"@esbuild/android-arm64","darwin arm64 LE":"@esbuild/darwin-arm64","darwin x64 LE":"@esbuild/darwin-x64","freebsd arm64 LE":"@esbuild/freebsd-arm64","freebsd x64 LE":"@esbuild/freebsd-x64","linux arm LE":"@esbuild/linux-arm","linux arm64 LE":"@esbuild/linux-arm64","linux ia32 LE":"@esbuild/linux-ia32","linux mips64el LE":"@esbuild/linux-mips64el","linux ppc64 LE":"@esbuild/linux-ppc64","linux riscv64 LE":"@esbuild/linux-riscv64","linux s390x BE":"@esbuild/linux-s390x","linux x64 LE":"@esbuild/linux-x64","linux loong64 LE":"@esbuild/linux-loong64","netbsd arm64 LE":"@esbuild/netbsd-arm64","netbsd x64 LE":"@esbuild/netbsd-x64","openbsd arm64 LE":"@esbuild/openbsd-arm64","openbsd x64 LE":"@esbuild/openbsd-x64","sunos x64 LE":"@esbuild/sunos-x64"},ct={"android arm LE":"@esbuild/android-arm","android x64 LE":"@esbuild/android-x64","openharmony arm64 LE":"@esbuild/openharmony-arm64"};function pr(){let e,t,r=false,n=`${process.platform} ${at.arch()} ${at.endianness()}`;if(n in Ie)e=Ie[n],t="esbuild.exe";else if(n in Le)e=Le[n],t="bin/esbuild";else if(n in ct)e=ct[n],t="bin/esbuild",r=true;else throw new Error(`Unsupported platform: ${n}`);return {pkg:e,subpath:t,isWASM:r}}function gr(){let e=V.resolve("esbuild"),t=re.dirname(re.dirname(re.dirname(e)));if(re.basename(t)==="node_modules"){for(let r in Le)try{let n=Le[r];if(ce.existsSync(re.join(t,n)))return n}catch{}for(let r in Ie)try{let n=Ie[r];if(ce.existsSync(re.join(t,n)))return n}catch{}}return null}function mr(e,t){let r=re.dirname(V.resolve("esbuild"));return re.join(r,`downloaded-${e.replace("/","-")}-${re.basename(t)}`)}function hr(){if(dr(we))if(!ce.existsSync(we))console.warn(`[esbuild] Ignoring bad configuration: ESBUILD_BINARY_PATH=${we}`);else return {binPath:we,isWASM:false};let{pkg:e,subpath:t,isWASM:r}=pr(),n;try{n=V.resolve(`${e}/${t}`);}catch(i){if(n=mr(e,t),!ce.existsSync(n)){try{V.resolve(e);}catch{let l=gr();if(l){let s=`
14
14
  Specifically the "${l}" package is present but this platform
15
15
  needs the "${e}" package instead. People often get into this
16
16
  situation by installing esbuild on Windows or macOS and copying "node_modules"
@@ -59,10 +59,10 @@ want to do that.
59
59
  If you are installing esbuild with npm, make sure that you don't specify the
60
60
  "--no-optional" or "--omit=optional" flags. The "optionalDependencies" feature
61
61
  of "package.json" is used by esbuild to install the correct binary executable
62
- for your current platform.`)}throw i}}if(/\.zip\//.test(n)){let i;try{i=V("pnpapi");}catch{}if(i){let l=i.getPackageInformation(i.topLevel).packageLocation,s=re.join(l,"node_modules",".cache","esbuild",`pnpapi-${e.replace("/","-")}-0.27.2-${re.basename(t)}`);return ce.existsSync(s)||(ce.mkdirSync(re.dirname(s),{recursive:true}),ce.copyFileSync(n,s),ce.chmodSync(s,493)),{binPath:s,isWASM:r}}}return {binPath:n,isWASM:r}}var Et=V("child_process"),Sr=V("crypto"),We=V("path"),pe=V("fs"),xr=V("os"),Er=V("tty"),X;if(process.env.ESBUILD_WORKER_THREADS!=="0"){try{X=V("worker_threads");}catch{}let[e,t]=process.versions.node.split(".");(+e<12||+e==12&&+t<17||+e==13&&+t<13)&&(X=void 0);}var ft,Pe=((ft=X?.workerData)==null?void 0:ft.esbuildVersion)==="0.27.2",_t=()=>{if(!we&&(We.basename(__filename)!=="main.js"||We.basename(__dirname)!=="lib"))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.
62
+ for your current platform.`)}throw i}}if(/\.zip\//.test(n)){let i;try{i=V("pnpapi");}catch{}if(i){let l=i.getPackageInformation(i.topLevel).packageLocation,s=re.join(l,"node_modules",".cache","esbuild",`pnpapi-${e.replace("/","-")}-0.27.2-${re.basename(t)}`);return ce.existsSync(s)||(ce.mkdirSync(re.dirname(s),{recursive:true}),ce.copyFileSync(n,s),ce.chmodSync(s,493)),{binPath:s,isWASM:r}}}return {binPath:n,isWASM:r}}var Et=V("child_process"),yr=V("crypto"),We=V("path"),pe=V("fs"),wr=V("os"),vr=V("tty"),Y;if(process.env.ESBUILD_WORKER_THREADS!=="0"){try{Y=V("worker_threads");}catch{}let[e,t]=process.versions.node.split(".");(+e<12||+e==12&&+t<17||+e==13&&+t<13)&&(Y=void 0);}var ft,Pe=((ft=Y?.workerData)==null?void 0:ft.esbuildVersion)==="0.27.2",_t=()=>{if(!we&&(We.basename(__filename)!=="main.js"||We.basename(__dirname)!=="lib"))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.
63
63
 
64
- More information: The file containing the code for esbuild's JavaScript API (${__filename}) does not appear to be inside the esbuild package on the file system, which usually means that the esbuild package was bundled into another file. This is problematic because the API needs to run a binary executable inside the esbuild package which is located using a relative path from the API code to the executable. If the esbuild package is bundled, the relative path will be incorrect and the executable won't be found.`);{let{binPath:e,isWASM:t}=br();return t?["node",[e]]:[e,[]]}},ke=()=>Er.isatty(2),_r={readFile(e,t){try{let r=pe.readFileSync(e,"utf8");try{pe.unlinkSync(e);}catch{}t(null,r);}catch(r){t(r,null);}},writeFile(e,t){try{let r=kt();pe.writeFileSync(r,e),t(r);}catch{t(null);}}},kr={readFile(e,t){try{pe.readFile(e,"utf8",(r,n)=>{try{pe.unlink(e,()=>t(r,n));}catch{t(r,n);}});}catch(r){t(r,null);}},writeFile(e,t){try{let r=kt();pe.writeFile(r,e,n=>t(n!==null?null:r));}catch{t(null);}}},Or="0.27.2",Pr=e=>me().build(e),Tr=e=>me().context(e),Ar=(e,t)=>me().transform(e,t),Rr=(e,t)=>me().formatMessages(e,t),$r=(e,t)=>me().analyzeMetafile(e,t),jr=e=>{if(X&&!Pe)return Y||(Y=Be(X)),Y.buildSync(e);let t;return Fe(r=>r.buildOrContext({callName:"buildSync",refs:null,options:e,isTTY:ke(),defaultWD:ge,callback:(n,i)=>{if(n)throw n;t=i;}})),t},Cr=(e,t)=>{if(X&&!Pe)return Y||(Y=Be(X)),Y.transformSync(e,t);let r;return Fe(n=>n.transform({callName:"transformSync",refs:null,input:e,options:t||{},isTTY:ke(),fs:_r,callback:(i,l)=>{if(i)throw i;r=l;}})),r},Ir=(e,t)=>{if(X&&!Pe)return Y||(Y=Be(X)),Y.formatMessagesSync(e,t);let r;return Fe(n=>n.formatMessages({callName:"formatMessagesSync",refs:null,messages:e,options:t,callback:(i,l)=>{if(i)throw i;r=l;}})),r},Lr=(e,t)=>{if(X&&!Pe)return Y||(Y=Be(X)),Y.analyzeMetafileSync(e,t);let r;return Fe(n=>n.analyzeMetafile({callName:"analyzeMetafileSync",refs:null,metafile:typeof e=="string"?e:JSON.stringify(e),options:t,callback:(i,l)=>{if(i)throw i;r=l;}})),r},Dr=()=>(De&&De(),Y&&Y.stop(),Promise.resolve()),Je=false,Mr=e=>{if(e=ur(e||{}),e.wasmURL)throw new Error('The "wasmURL" option only works in the browser');if(e.wasmModule)throw new Error('The "wasmModule" option only works in the browser');if(e.worker)throw new Error('The "worker" option only works in the browser');if(Je)throw new Error('Cannot call "initialize" more than once');return me(),Je=true,Promise.resolve()},ge=process.cwd(),Ee,De,me=()=>{if(Ee)return Ee;let[e,t]=_t(),r=Et.spawn(e,t.concat("--service=0.27.2","--ping"),{windowsHide:true,stdio:["pipe","pipe","inherit"],cwd:ge}),{readFromStdout:n,afterClose:i,service:l}=bt({writeToStdin(u){r.stdin.write(u,y=>{y&&i(y);});},readFileSync:pe.readFileSync,isSync:false,hasFS:true,esbuild:Oe});r.stdin.on("error",i),r.on("error",i);let s=r.stdin,d=r.stdout;d.on("data",n),d.on("end",i),De=()=>{s.destroy(),d.destroy(),r.kill(),Je=false,Ee=void 0,De=void 0;};let a=0;r.unref(),s.unref&&s.unref(),d.unref&&d.unref();let c={ref(){++a===1&&r.ref();},unref(){--a===0&&r.unref();}};return Ee={build:u=>new Promise((y,k)=>{l.buildOrContext({callName:"build",refs:c,options:u,isTTY:ke(),defaultWD:ge,callback:(E,A)=>E?k(E):y(A)});}),context:u=>new Promise((y,k)=>l.buildOrContext({callName:"context",refs:c,options:u,isTTY:ke(),defaultWD:ge,callback:(E,A)=>E?k(E):y(A)})),transform:(u,y)=>new Promise((k,E)=>l.transform({callName:"transform",refs:c,input:u,options:y||{},isTTY:ke(),fs:kr,callback:(A,B)=>A?E(A):k(B)})),formatMessages:(u,y)=>new Promise((k,E)=>l.formatMessages({callName:"formatMessages",refs:c,messages:u,options:y,callback:(A,B)=>A?E(A):k(B)})),analyzeMetafile:(u,y)=>new Promise((k,E)=>l.analyzeMetafile({callName:"analyzeMetafile",refs:c,metafile:typeof u=="string"?u:JSON.stringify(u),options:y,callback:(A,B)=>A?E(A):k(B)}))},Ee},Fe=e=>{let[t,r]=_t(),n=new Uint8Array,{readFromStdout:i,afterClose:l,service:s}=bt({writeToStdin(a){if(n.length!==0)throw new Error("Must run at most one command");n=a;},isSync:true,hasFS:true,esbuild:Oe});e(s);let d=Et.execFileSync(t,r.concat("--service=0.27.2"),{cwd:ge,windowsHide:true,input:n,maxBuffer:+process.env.ESBUILD_MAX_BUFFER||16*1024*1024});i(d),l(null);},kt=()=>We.join(xr.tmpdir(),`esbuild-${Sr.randomBytes(32).toString("hex")}`),Y=null,Be=e=>{let{port1:t,port2:r}=new e.MessageChannel,n=new e.Worker(__filename,{workerData:{workerPort:r,defaultWD:ge,esbuildVersion:"0.27.2"},transferList:[r],execArgv:[]}),i=0,l=c=>{let u=new Error(`Build failed with 1 error:
65
- error: ${c}`),y=[{id:"",pluginName:"",text:c,location:null,notes:[],detail:void 0}];return u.errors=y,u.warnings=[],u},s=c=>{if(!c)return;let u=c.plugins;if(u&&u.length>0)throw l("Cannot use plugins in synchronous API calls")},d=(c,u)=>{for(let y in u)c[y]=u[y];},a=(c,u)=>{let y=i++,k=new SharedArrayBuffer(8),E=new Int32Array(k),A={sharedBuffer:k,id:y,command:c,args:u};n.postMessage(A);let B=Atomics.wait(E,0,0);if(B!=="ok"&&B!=="not-equal")throw new Error("Internal error: Atomics.wait() failed: "+B);let{message:{id:L,resolve:U,reject:H,properties:x}}=e.receiveMessageOnPort(t);if(y!==L)throw new Error(`Internal error: Expected id ${y} but got id ${L}`);if(H)throw d(H,x),H;return U};return n.unref(),{buildSync(c){return s(c),a("build",[c])},transformSync(c,u){return a("transform",[c,u])},formatMessagesSync(c,u){return a("formatMessages",[c,u])},analyzeMetafileSync(c,u){return a("analyzeMetafile",[c,u])},stop(){n.terminate(),Y=null;}}},Fr=()=>{let e=X.workerData.workerPort,t=X.parentPort,r=n=>{let i={};if(n&&typeof n=="object")for(let l in n)i[l]=n[l];return i};try{let n=me();ge=X.workerData.defaultWD,t.on("message",i=>{(async()=>{let{sharedBuffer:l,id:s,command:d,args:a}=i,c=new Int32Array(l);try{switch(d){case "build":e.postMessage({id:s,resolve:await n.build(a[0])});break;case "transform":e.postMessage({id:s,resolve:await n.transform(a[0],a[1])});break;case "formatMessages":e.postMessage({id:s,resolve:await n.formatMessages(a[0],a[1])});break;case "analyzeMetafile":e.postMessage({id:s,resolve:await n.analyzeMetafile(a[0],a[1])});break;default:throw new Error(`Invalid command: ${d}`)}}catch(u){e.postMessage({id:s,reject:u,properties:r(u)});}Atomics.add(c,0,1),Atomics.notify(c,0,1/0);})();});}catch(n){t.on("message",i=>{let{sharedBuffer:l,id:s}=i,d=new Int32Array(l);e.postMessage({id:s,reject:n,properties:r(n)}),Atomics.add(d,0,1),Atomics.notify(d,0,1/0);});}};Pe&&Fr();var Br=Oe;});function qt(e,t){let r=`${e}:${t}`;return crypto.createHash("md5").update(r).digest("hex").substring(0,12)}var Ut=new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","link","main","map","mark","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","small","source","span","strong","style","sub","summary","sup","svg","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr"]);function Ht(){let e=false;return {name:"vite-plugin-component-id",enforce:"pre",configResolved(t){e=t.command==="serve";},transform(t,r){if(!e||!/\.(tsx|jsx)$/.test(r)||r.includes("node_modules")||!/<[a-z]/.test(t))return null;try{let n=t,i=/<([a-z][\da-z]*)(?=[\s/>])/g,l,s=[],d=c=>{let u=!1,y=!1,k=!1,E=0;for(;E<c;){let A=t[E];if((E>0?t[E-1]:"")==="\\"){E++;continue}A==="'"&&!y&&!k?u=!u:A==='"'&&!u&&!k?y=!y:A==="`"&&!u&&!y&&(k=!k),E++;}return u||y||k};for(;(l=i.exec(t))!==null;){let c=l[1];if(!c)continue;let u=l.index,y=l.index+l[0].length;if(!Ut.has(c)||d(u))continue;let k=y,E=!1,A=!1;for(;k<t.length&&!E;)t[k]===">"&&(E=!0,t.substring(u,k).includes("data-node-component-id")&&(A=!0)),k++;A||s.push({index:u,tag:c,tagEndIndex:y});}let a=t;for(let c=s.length-1;c>=0;c--){let u=s[c];if(!u)continue;let{index:y,tagEndIndex:k}=u,E=qt(r,y),A=a.substring(0,k),B=a.substring(k);n=`${A} data-node-component-id="${E}"${B}`,a=n;}return {code:n,map:null}}catch{return null}}}}var Xt=`<script>
64
+ More information: The file containing the code for esbuild's JavaScript API (${__filename}) does not appear to be inside the esbuild package on the file system, which usually means that the esbuild package was bundled into another file. This is problematic because the API needs to run a binary executable inside the esbuild package which is located using a relative path from the API code to the executable. If the esbuild package is bundled, the relative path will be incorrect and the executable won't be found.`);{let{binPath:e,isWASM:t}=hr();return t?["node",[e]]:[e,[]]}},ke=()=>vr.isatty(2),br={readFile(e,t){try{let r=pe.readFileSync(e,"utf8");try{pe.unlinkSync(e);}catch{}t(null,r);}catch(r){t(r,null);}},writeFile(e,t){try{let r=kt();pe.writeFileSync(r,e),t(r);}catch{t(null);}}},Sr={readFile(e,t){try{pe.readFile(e,"utf8",(r,n)=>{try{pe.unlink(e,()=>t(r,n));}catch{t(r,n);}});}catch(r){t(r,null);}},writeFile(e,t){try{let r=kt();pe.writeFile(r,e,n=>t(n!==null?null:r));}catch{t(null);}}},xr="0.27.2",Er=e=>me().build(e),_r=e=>me().context(e),kr=(e,t)=>me().transform(e,t),Or=(e,t)=>me().formatMessages(e,t),Pr=(e,t)=>me().analyzeMetafile(e,t),Tr=e=>{if(Y&&!Pe)return X||(X=Fe(Y)),X.buildSync(e);let t;return Be(r=>r.buildOrContext({callName:"buildSync",refs:null,options:e,isTTY:ke(),defaultWD:ge,callback:(n,i)=>{if(n)throw n;t=i;}})),t},Ar=(e,t)=>{if(Y&&!Pe)return X||(X=Fe(Y)),X.transformSync(e,t);let r;return Be(n=>n.transform({callName:"transformSync",refs:null,input:e,options:t||{},isTTY:ke(),fs:br,callback:(i,l)=>{if(i)throw i;r=l;}})),r},Rr=(e,t)=>{if(Y&&!Pe)return X||(X=Fe(Y)),X.formatMessagesSync(e,t);let r;return Be(n=>n.formatMessages({callName:"formatMessagesSync",refs:null,messages:e,options:t,callback:(i,l)=>{if(i)throw i;r=l;}})),r},jr=(e,t)=>{if(Y&&!Pe)return X||(X=Fe(Y)),X.analyzeMetafileSync(e,t);let r;return Be(n=>n.analyzeMetafile({callName:"analyzeMetafileSync",refs:null,metafile:typeof e=="string"?e:JSON.stringify(e),options:t,callback:(i,l)=>{if(i)throw i;r=l;}})),r},Cr=()=>(De&&De(),X&&X.stop(),Promise.resolve()),Je=false,$r=e=>{if(e=or(e||{}),e.wasmURL)throw new Error('The "wasmURL" option only works in the browser');if(e.wasmModule)throw new Error('The "wasmModule" option only works in the browser');if(e.worker)throw new Error('The "worker" option only works in the browser');if(Je)throw new Error('Cannot call "initialize" more than once');return me(),Je=true,Promise.resolve()},ge=process.cwd(),Ee,De,me=()=>{if(Ee)return Ee;let[e,t]=_t(),r=Et.spawn(e,t.concat("--service=0.27.2","--ping"),{windowsHide:true,stdio:["pipe","pipe","inherit"],cwd:ge}),{readFromStdout:n,afterClose:i,service:l}=bt({writeToStdin(u){r.stdin.write(u,y=>{y&&i(y);});},readFileSync:pe.readFileSync,isSync:false,hasFS:true,esbuild:Oe});r.stdin.on("error",i),r.on("error",i);let s=r.stdin,d=r.stdout;d.on("data",n),d.on("end",i),De=()=>{s.destroy(),d.destroy(),r.kill(),Je=false,Ee=void 0,De=void 0;};let a=0;r.unref(),s.unref&&s.unref(),d.unref&&d.unref();let c={ref(){++a===1&&r.ref();},unref(){--a===0&&r.unref();}};return Ee={build:u=>new Promise((y,k)=>{l.buildOrContext({callName:"build",refs:c,options:u,isTTY:ke(),defaultWD:ge,callback:(E,A)=>E?k(E):y(A)});}),context:u=>new Promise((y,k)=>l.buildOrContext({callName:"context",refs:c,options:u,isTTY:ke(),defaultWD:ge,callback:(E,A)=>E?k(E):y(A)})),transform:(u,y)=>new Promise((k,E)=>l.transform({callName:"transform",refs:c,input:u,options:y||{},isTTY:ke(),fs:Sr,callback:(A,F)=>A?E(A):k(F)})),formatMessages:(u,y)=>new Promise((k,E)=>l.formatMessages({callName:"formatMessages",refs:c,messages:u,options:y,callback:(A,F)=>A?E(A):k(F)})),analyzeMetafile:(u,y)=>new Promise((k,E)=>l.analyzeMetafile({callName:"analyzeMetafile",refs:c,metafile:typeof u=="string"?u:JSON.stringify(u),options:y,callback:(A,F)=>A?E(A):k(F)}))},Ee},Be=e=>{let[t,r]=_t(),n=new Uint8Array,{readFromStdout:i,afterClose:l,service:s}=bt({writeToStdin(a){if(n.length!==0)throw new Error("Must run at most one command");n=a;},isSync:true,hasFS:true,esbuild:Oe});e(s);let d=Et.execFileSync(t,r.concat("--service=0.27.2"),{cwd:ge,windowsHide:true,input:n,maxBuffer:+process.env.ESBUILD_MAX_BUFFER||16*1024*1024});i(d),l(null);},kt=()=>We.join(wr.tmpdir(),`esbuild-${yr.randomBytes(32).toString("hex")}`),X=null,Fe=e=>{let{port1:t,port2:r}=new e.MessageChannel,n=new e.Worker(__filename,{workerData:{workerPort:r,defaultWD:ge,esbuildVersion:"0.27.2"},transferList:[r],execArgv:[]}),i=0,l=c=>{let u=new Error(`Build failed with 1 error:
65
+ error: ${c}`),y=[{id:"",pluginName:"",text:c,location:null,notes:[],detail:void 0}];return u.errors=y,u.warnings=[],u},s=c=>{if(!c)return;let u=c.plugins;if(u&&u.length>0)throw l("Cannot use plugins in synchronous API calls")},d=(c,u)=>{for(let y in u)c[y]=u[y];},a=(c,u)=>{let y=i++,k=new SharedArrayBuffer(8),E=new Int32Array(k),A={sharedBuffer:k,id:y,command:c,args:u};n.postMessage(A);let F=Atomics.wait(E,0,0);if(F!=="ok"&&F!=="not-equal")throw new Error("Internal error: Atomics.wait() failed: "+F);let{message:{id:L,resolve:U,reject:z,properties:x}}=e.receiveMessageOnPort(t);if(y!==L)throw new Error(`Internal error: Expected id ${y} but got id ${L}`);if(z)throw d(z,x),z;return U};return n.unref(),{buildSync(c){return s(c),a("build",[c])},transformSync(c,u){return a("transform",[c,u])},formatMessagesSync(c,u){return a("formatMessages",[c,u])},analyzeMetafileSync(c,u){return a("analyzeMetafile",[c,u])},stop(){n.terminate(),X=null;}}},Ir=()=>{let e=Y.workerData.workerPort,t=Y.parentPort,r=n=>{let i={};if(n&&typeof n=="object")for(let l in n)i[l]=n[l];return i};try{let n=me();ge=Y.workerData.defaultWD,t.on("message",i=>{(async()=>{let{sharedBuffer:l,id:s,command:d,args:a}=i,c=new Int32Array(l);try{switch(d){case "build":e.postMessage({id:s,resolve:await n.build(a[0])});break;case "transform":e.postMessage({id:s,resolve:await n.transform(a[0],a[1])});break;case "formatMessages":e.postMessage({id:s,resolve:await n.formatMessages(a[0],a[1])});break;case "analyzeMetafile":e.postMessage({id:s,resolve:await n.analyzeMetafile(a[0],a[1])});break;default:throw new Error(`Invalid command: ${d}`)}}catch(u){e.postMessage({id:s,reject:u,properties:r(u)});}Atomics.add(c,0,1),Atomics.notify(c,0,1/0);})();});}catch(n){t.on("message",i=>{let{sharedBuffer:l,id:s}=i,d=new Int32Array(l);e.postMessage({id:s,reject:n,properties:r(n)}),Atomics.add(d,0,1),Atomics.notify(d,0,1/0);});}};Pe&&Ir();var Lr=Oe;});function qt(e,t){let r=`${e}:${t}`;return crypto.createHash("md5").update(r).digest("hex").substring(0,12)}var Ut=new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","link","main","map","mark","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","small","source","span","strong","style","sub","summary","sup","svg","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr"]);function zt(){let e=false;return {name:"vite-plugin-component-id",enforce:"pre",configResolved(t){e=t.command==="serve";},transform(t,r){if(!e||!/\.(tsx|jsx)$/.test(r)||r.includes("node_modules")||!/<[a-z]/.test(t))return null;try{let n=t,i=/<([a-z][\da-z]*)(?=[\s/>])/g,l,s=[],d=c=>{let u=!1,y=!1,k=!1,E=0;for(;E<c;){let A=t[E];if((E>0?t[E-1]:"")==="\\"){E++;continue}A==="'"&&!y&&!k?u=!u:A==='"'&&!u&&!k?y=!y:A==="`"&&!u&&!y&&(k=!k),E++;}return u||y||k};for(;(l=i.exec(t))!==null;){let c=l[1];if(!c)continue;let u=l.index,y=l.index+l[0].length;if(!Ut.has(c)||d(u))continue;let k=y,E=!1,A=!1;for(;k<t.length&&!E;)t[k]===">"&&(E=!0,t.substring(u,k).includes("data-node-component-id")&&(A=!0)),k++;A||s.push({index:u,tag:c,tagEndIndex:y});}let a=t;for(let c=s.length-1;c>=0;c--){let u=s[c];if(!u)continue;let{index:y,tagEndIndex:k}=u,E=qt(r,y),A=a.substring(0,k),F=a.substring(k);n=`${A} data-node-component-id="${E}"${F}`,a=n;}return {code:n,map:null}}catch{return null}}}}var Ht=`<script>
66
66
  document.addEventListener("click", (e) => {
67
67
  const element = e.target;
68
68
  const noJumpOut = document.body.classList.contains("forbid-jump-out")
@@ -80,9 +80,49 @@ document.addEventListener("click", (e) => {
80
80
  e.preventDefault();
81
81
  }
82
82
  });
83
- </script>`;function Yt(){try{let e=url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.cjs', document.baseURI).href))),t=ye.dirname(e),r=ye.resolve(t,"../dist/bridge.bridge.js");return `<script>
84
- ${Te.readFileSync(r,"utf-8")}
85
- </script>`}catch(e){return console.warn("Failed to read bridge script:",e),""}}function Ge(){let e=false,t="";return {name:"vite-plugin-editor-bridge",configResolved(r){e=r.command==="serve",e&&(t=Yt());},transformIndexHtml(r){if(!e)return r;let n=`${Xt}${t}</body>`;return r.replace("</body>",n)}}}function Ze(e){let t=false,r=e?.routesFilePath||"src/routes.tsx";return {name:"vite-plugin-routes-expose",enforce:"post",configResolved(n){t=n.command==="serve";},transform(n,i){if(!t||!i.endsWith(r))return null;try{return n.includes("window.__APP_ROUTES__")?null:{code:`${n}
83
+ </script>`,Wt=`<script>
84
+ (function() {
85
+ const SOURCE_KEY = Symbol.for("__jsxSource__");
86
+ const SESSION_KEY = import.meta.env.VITE_AMASTER_KEY;
87
+
88
+ // Expose minimal API for external bridge script
89
+ window.__AMASTER_BRIDGE__ = {
90
+ getSourceInfo: (element) => element?.[SOURCE_KEY],
91
+ getSourceMap: () => window.sourceElementMap,
92
+ postToParent: (type, data) => {
93
+ window.parent.postMessage({ type, data, key: SESSION_KEY }, "*");
94
+ },
95
+ isDev: import.meta.env.DEV,
96
+ };
97
+
98
+ // Listen for bridge script URL from platform
99
+ window.addEventListener("message", (event) => {
100
+ const { type, data, key } = event.data;
101
+
102
+ if (key !== SESSION_KEY) {
103
+ console.warn("[Bridge] Invalid session key");
104
+ return;
105
+ }
106
+
107
+ if (type === "amaster.loadBridge" && data?.scriptUrl) {
108
+ const script = document.createElement("script");
109
+ script.src = data.scriptUrl;
110
+ script.onload = () => {
111
+ console.log("[Bridge] External script loaded");
112
+ window.__AMASTER_BRIDGE__?.postToParent("amaster.bridge.ready", {});
113
+ };
114
+ script.onerror = () => {
115
+ console.error("[Bridge] Failed to load external script");
116
+ };
117
+ document.head.appendChild(script);
118
+ }
119
+ });
120
+
121
+ window.addEventListener("load", () => {
122
+ window.__AMASTER_BRIDGE__?.postToParent("amaster.bridge.initialized", {});
123
+ });
124
+ })();
125
+ </script>`;function Ge(){let e=false;return {name:"vite-plugin-editor-bridge",configResolved(t){e=t.command==="serve";},transformIndexHtml(t){if(!e)return t;let r=`${Ht}${Wt}</body>`;return t.replace("</body>",r)}}}function Ze(e){let t=false,r=e?.routesFilePath||"src/routes.tsx";return {name:"vite-plugin-routes-expose",enforce:"post",configResolved(n){t=n.command==="serve";},transform(n,i){if(!t||!i.endsWith(r))return null;try{return n.includes("window.__APP_ROUTES__")?null:{code:`${n}
86
126
 
87
127
  // Development mode: Expose routes to window.__APP_ROUTES__
88
128
  if (typeof window !== 'undefined') {
@@ -770,7 +810,7 @@ if (typeof window !== 'undefined') {
770
810
  originalConsole.log('[BrowserLogs] Log collection started');
771
811
  })();
772
812
  </script>`;return {name:"vite-plugin-browser-logs",configResolved(r){let n=et__default.default.env.WORKSPACE_DIR;if(n)e=ye__default.default.join(n,"browser.log");else {let i=r.root||et__default.default.cwd();for(;i!==ye__default.default.dirname(i)&&!Te__default.default.existsSync(ye__default.default.join(i,"package.json"));)i=ye__default.default.dirname(i);e=ye__default.default.join(i,"browser.log");}},configureServer(r){r.middlewares.use((n,i,l)=>{if(n.url==="/__browser__"&&n.method==="POST"){let s=n.headers.origin||"*",d="";n.on("data",a=>{d+=a.toString();}),n.on("end",()=>{try{let a=ye__default.default.dirname(e);Te__default.default.existsSync(a)||Te__default.default.mkdirSync(a,{recursive:!0}),Te__default.default.appendFileSync(e,`${d}
773
- `,"utf-8"),i.writeHead(200,{"Content-Type":"application/json","Access-Control-Allow-Origin":s,"Access-Control-Allow-Methods":"POST, OPTIONS","Access-Control-Allow-Headers":"Content-Type"}),i.end(JSON.stringify({success:!0}));}catch(a){console.error("[BrowserLogs] Write error:",a),i.writeHead(500,{"Content-Type":"application/json","Access-Control-Allow-Origin":s,"Access-Control-Allow-Methods":"POST, OPTIONS","Access-Control-Allow-Headers":"Content-Type"}),i.end(JSON.stringify({success:false,error:String(a)}));}});}else if(n.url==="/__browser__"&&n.method==="OPTIONS"){let s=n.headers.origin||"*";i.writeHead(204,{"Access-Control-Allow-Origin":s,"Access-Control-Allow-Methods":"POST, OPTIONS","Access-Control-Allow-Headers":"Content-Type","Access-Control-Max-Age":"86400"}),i.end();}else if(n.url==="/__browser__"){let s=n.headers.origin||"*";i.writeHead(405,{"Content-Type":"application/json","Access-Control-Allow-Origin":s}),i.end(JSON.stringify({error:"Method not allowed"}));}else l();}),console.log("[BrowserLogs] Logs will be written to:",e);},transformIndexHtml(r){return r.replace(/<head([^>]*)>/i,`<head$1>${t}`)}}}var Kt=`
813
+ `,"utf-8"),i.writeHead(200,{"Content-Type":"application/json","Access-Control-Allow-Origin":s,"Access-Control-Allow-Methods":"POST, OPTIONS","Access-Control-Allow-Headers":"Content-Type"}),i.end(JSON.stringify({success:!0}));}catch(a){console.error("[BrowserLogs] Write error:",a),i.writeHead(500,{"Content-Type":"application/json","Access-Control-Allow-Origin":s,"Access-Control-Allow-Methods":"POST, OPTIONS","Access-Control-Allow-Headers":"Content-Type"}),i.end(JSON.stringify({success:false,error:String(a)}));}});}else if(n.url==="/__browser__"&&n.method==="OPTIONS"){let s=n.headers.origin||"*";i.writeHead(204,{"Access-Control-Allow-Origin":s,"Access-Control-Allow-Methods":"POST, OPTIONS","Access-Control-Allow-Headers":"Content-Type","Access-Control-Max-Age":"86400"}),i.end();}else if(n.url==="/__browser__"){let s=n.headers.origin||"*";i.writeHead(405,{"Content-Type":"application/json","Access-Control-Allow-Origin":s}),i.end(JSON.stringify({error:"Method not allowed"}));}else l();}),console.log("[BrowserLogs] Logs will be written to:",e);},transformIndexHtml(r){return r.replace(/<head([^>]*)>/i,`<head$1>${t}`)}}}var Jt=`
774
814
  import * as React from "react";
775
815
  import * as ReactJSXDevRuntime from "react/jsx-dev-runtime";
776
816
 
@@ -902,7 +942,7 @@ export function jsxDEV(type, props, key, isStatic, source, self) {
902
942
 
903
943
  return _jsxDEV(type, props, key, isStatic, source, self);
904
944
  }
905
- `;function Ue(){let e=false,t="";return {name:"vite-plugin-jsx-source-tagger",enforce:"pre",configResolved(r){e=r.command==="serve",t=r.root;},resolveId(r,n){return e&&r==="react/jsx-dev-runtime"&&!n?.includes("\0jsx-source")?"\0jsx-source/jsx-dev-runtime":null},load(r){return e&&r==="\0jsx-source/jsx-dev-runtime"?Kt.replace('const PROJECT_ROOT = "";',`const PROJECT_ROOT = ${JSON.stringify(t)};`):null}}}var Tt=Bt(Pt());function Ye(e){let t="",r=false,n=null,i=e?.configPath||"./tailwind.config.ts",l="@amaster/tailwind-config",s="\0"+l,d=async()=>{let c=ye__default.default.resolve(t,i);try{return await Ne__default.default.access(c),c}catch{if(i.endsWith(".ts")){let u=c.replace(/\.ts$/,".js");try{return await Ne__default.default.access(u),u}catch{return null}}else if(i.endsWith(".js")){let u=c.replace(/\.js$/,".ts");try{return await Ne__default.default.access(u),u}catch{return null}}return null}},a=async()=>{try{let c=await d();if(!c)return null;let u=await Ne__default.default.readFile(c,"utf-8"),y=await Tt.transform(u,{loader:c.endsWith(".ts")?"ts":"js",format:"esm",platform:"node"}),E=await import(`data:text/javascript;base64,${buffer.Buffer.from(y.code).toString("base64")}`);if(!E?.default)throw new Error("Invalid Tailwind config structure");try{let A=(await import('tailwindcss/resolveConfig.js')).default;n=A(E.default);}catch{n=E.default;}return n}catch{return null}};return {name:"vite-plugin-tailwind-config-sync",configResolved(c){t=c.root,r=c.command==="serve";},async buildStart(){r&&await a();},resolveId(c){if(c===l)return s},async load(c){if(c===s)return n||await a(),`
945
+ `;function Ue(){let e=false,t="";return {name:"vite-plugin-jsx-source-tagger",enforce:"pre",configResolved(r){e=r.command==="serve",t=r.root;},resolveId(r,n){return e&&r==="react/jsx-dev-runtime"&&!n?.includes("\0jsx-source")?"\0jsx-source/jsx-dev-runtime":null},load(r){return e&&r==="\0jsx-source/jsx-dev-runtime"?Jt.replace('const PROJECT_ROOT = "";',`const PROJECT_ROOT = ${JSON.stringify(t)};`):null}}}var Tt=Ft(Pt());function Xe(e){let t="",r=false,n=null,i=e?.configPath||"./tailwind.config.ts",l="@amaster/tailwind-config",s="\0"+l,d=async()=>{let c=ye__default.default.resolve(t,i);try{return await Ne__default.default.access(c),c}catch{if(i.endsWith(".ts")){let u=c.replace(/\.ts$/,".js");try{return await Ne__default.default.access(u),u}catch{return null}}else if(i.endsWith(".js")){let u=c.replace(/\.js$/,".ts");try{return await Ne__default.default.access(u),u}catch{return null}}return null}},a=async()=>{try{let c=await d();if(!c)return null;let u=await Ne__default.default.readFile(c,"utf-8"),y=await Tt.transform(u,{loader:c.endsWith(".ts")?"ts":"js",format:"esm",platform:"node"}),E=await import(`data:text/javascript;base64,${buffer.Buffer.from(y.code).toString("base64")}`);if(!E?.default)throw new Error("Invalid Tailwind config structure");try{let A=(await import('tailwindcss/resolveConfig.js')).default;n=A(E.default);}catch{n=E.default;}return n}catch{return null}};return {name:"vite-plugin-tailwind-config-sync",configResolved(c){t=c.root,r=c.command==="serve";},async buildStart(){r&&await a();},resolveId(c){if(c===l)return s},async load(c){if(c===s)return n||await a(),`
906
946
  let config = ${JSON.stringify(n)};
907
947
 
908
948
  let _updateConfig;
@@ -1011,5 +1051,5 @@ export default new Proxy(config, {
1011
1051
  object-fit: contain;
1012
1052
  }
1013
1053
  </style>
1014
- </head>`)}}}function qe(e={}){let{ratio:t=2}=e;return {postcssPlugin:"postcss-rpx2px",Declaration(r){r.value.includes("rpx")&&(r.value=r.value.replace(/(-?\d*\.?\d+)rpx/gi,(n,i)=>{let l=parseFloat(i)/t;return l===0?"0":`${l}px`}));}}}qe.postcss=true;function qr(e={}){let{additional:t=[],autoInjectTaroApp:r=true,autoInjectVite:n=true}=e,i={},l=new Set(t);return r&&Object.keys(process.env).forEach(s=>{s.startsWith("TARO_APP_")&&l.add(s);}),n&&Object.keys(process.env).forEach(s=>{s.startsWith("VITE_")&&l.add(s);}),l.forEach(s=>{let d=process.env[s]||"";i[`process.env.${s}`]=JSON.stringify(d);}),i}function Ur(){return {"process.env.TARO_APP_API_BASE_URL":JSON.stringify(process.env.TARO_APP_API_BASE_URL||""),"process.env.VITE_API_BASE_URL":JSON.stringify(process.env.VITE_API_BASE_URL||"")}}function Hr(e={}){let t=e.isTaro??et__default.default.env.TARO_ENV==="h5",r=[Ge(),Ze()];return e.jsxSourceTagger!==false&&r.push(Ue()),e.tailwindConfigSync!==false&&r.push(Ye({configPath:e.tailwindConfigPath})),t&&(r.unshift(Ke(e.styleAdapter)),r.unshift({name:"dev-postcss-rpx2px-plugin",apply:"serve",config(n){typeof n.css?.postcss=="object"&&n.css?.postcss.plugins?.unshift(qe());}})),et__default.default.env.WORKSPACE_GIT_REPO&&r.push(tt()),r}exports.componentIdPlugin=Ht;exports.default=Hr;exports.editorBridgePlugin=Ge;exports.injectAmasterEnv=Ur;exports.injectTaroEnv=qr;exports.jsxSourceTaggerPlugin=Ue;exports.routesExposePlugin=Ze;exports.rpx2pxPlugin=qe;exports.tailwindConfigSyncPlugin=Ye;exports.taroStyleAdapterPlugin=Ke;//# sourceMappingURL=index.cjs.map
1054
+ </head>`)}}}function qe(e={}){let{ratio:t=2}=e;return {postcssPlugin:"postcss-rpx2px",Declaration(r){r.value.includes("rpx")&&(r.value=r.value.replace(/(-?\d*\.?\d+)rpx/gi,(n,i)=>{let l=parseFloat(i)/t;return l===0?"0":`${l}px`}));}}}qe.postcss=true;function Mr(e={}){let{additional:t=[],autoInjectTaroApp:r=true,autoInjectVite:n=true}=e,i={},l=new Set(t);return r&&Object.keys(process.env).forEach(s=>{s.startsWith("TARO_APP_")&&l.add(s);}),n&&Object.keys(process.env).forEach(s=>{s.startsWith("VITE_")&&l.add(s);}),l.forEach(s=>{let d=process.env[s]||"";i[`process.env.${s}`]=JSON.stringify(d);}),i}function Br(){return {"process.env.TARO_APP_API_BASE_URL":JSON.stringify(process.env.TARO_APP_API_BASE_URL||""),"process.env.VITE_API_BASE_URL":JSON.stringify(process.env.VITE_API_BASE_URL||"")}}function Fr(e={}){let t=e.isTaro??et__default.default.env.TARO_ENV==="h5",r=[Ge(),Ze()];return e.jsxSourceTagger!==false&&r.push(Ue()),e.tailwindConfigSync!==false&&r.push(Xe({configPath:e.tailwindConfigPath})),t&&(r.unshift(Ke(e.styleAdapter)),r.unshift({name:"dev-postcss-rpx2px-plugin",apply:"serve",config(n){typeof n.css?.postcss=="object"&&n.css?.postcss.plugins?.unshift(qe());}})),et__default.default.env.WORKSPACE_GIT_REPO&&r.push(tt()),r}exports.componentIdPlugin=zt;exports.default=Fr;exports.editorBridgePlugin=Ge;exports.injectAmasterEnv=Br;exports.injectTaroEnv=Mr;exports.jsxSourceTaggerPlugin=Ue;exports.routesExposePlugin=Ze;exports.rpx2pxPlugin=qe;exports.tailwindConfigSyncPlugin=Xe;exports.taroStyleAdapterPlugin=Ke;//# sourceMappingURL=index.cjs.map
1015
1055
  //# sourceMappingURL=index.cjs.map