// @bun
var{defineProperty:Z,getOwnPropertyNames:U,getOwnPropertyDescriptor:R}=Object,y=Object.prototype.hasOwnProperty;function M(q){return this[q]}var b=(q)=>{var z=(G??=new WeakMap).get(q),H;if(z)return z;if(z=Z({},"__esModule",{value:!0}),q&&typeof q==="object"||typeof q==="function"){for(var B of U(q))if(!y.call(z,B))Z(z,B,{get:M.bind(q,B),enumerable:!(H=R(q,B))||H.enumerable})}return G.set(q,z),z},G;var k=(q)=>q;function g(q,z){this[q]=k.bind(null,z)}var m=(q,z)=>{for(var H in z)Z(q,H,{get:z[H],enumerable:!0,configurable:!0,set:g.bind(z,H)})};var w=(q,z)=>()=>(q&&(z=q(q=0)),z);var D=import.meta.require;import I from"process";function O(q="STX_PUBLIC_"){let z={},H={};for(let[B,J]of Object.entries(I.env)){if(!B.startsWith(q)||J===void 0)continue;z[`import.meta.env.${B}`]=JSON.stringify(J),H[B]=J}return z["import.meta.env"]=JSON.stringify(H),z}function v(q="STX_PUBLIC_"){let z={};for(let[H,B]of Object.entries(I.env))if(H.startsWith(q)&&B!==void 0)z[H]=B;return z}var S=()=>{};import N from"path";function j(q){return q.startsWith("http://")||q.startsWith("https://")||q.startsWith("//")}async function C(q,z,H){try{let B;if(q.startsWith("/")){let J=z;for(let Q=0;Q<5;Q++){let T=N.join(J,q);if(await Bun.file(T).exists())return T;J=N.dirname(J)}B=N.join(z,q)}else if(q.startsWith("./")||q.startsWith("../"))B=N.resolve(z,q);else B=N.resolve(z,q);if(await Bun.file(B).exists())return B;return null}catch{return null}}async function p(q,z,H){let B=q,J=N.dirname(z),Q=/<script\b([^>]*)src=["']([^"']+)["']([^>]*)><\/script>/gi,T;while((T=Q.exec(B))!==null){let[Y,A,K,F]=T;if(j(K))continue;let L=await C(K,J,z);if(L)try{let X=await Bun.file(L).text();if(H.add(L),K.endsWith(".ts")||K.endsWith(".tsx")){let W=await Bun.build({entrypoints:[L],target:"browser",minify:!1,define:O()});if(W.outputs.length>0)X=await W.outputs[0].text()}let V=`<script>
// Source: ${K}
${X}
</script>`;B=B.replace(Y,V),Q.lastIndex=0}catch(X){}}let _=/<link\b([^>]*)href=["']([^"']+)["']([^>]*)(?:\/?>)/gi,$;while(($=_.exec(B))!==null){let[Y,A,K,F]=$,L=A+F;if(j(K))continue;if(/rel=["']stylesheet["']/.test(L)||K.endsWith(".css")){let V=await C(K,J,z);if(V)try{let W=await Bun.file(V).text();H.add(V);let E=`<style>
/* Source: ${K} */
${W}
</style>`;B=B.replace(Y,E),_.lastIndex=0}catch(W){}}}return B}var x=w(()=>{S()});x();export{C as resolveInlinePath,p as processInlineAssets,j as isExternalUrl};
