@stacksjs/stx 0.2.678 → 0.2.679

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.
Files changed (82) hide show
  1. package/dist/{chunk-3gdr3nyq.js → chunk-0fjwqs9h.js} +1 -1
  2. package/dist/{chunk-xrrzwta9.js → chunk-0v35wpm7.js} +1 -1
  3. package/dist/{chunk-mj39dydr.js → chunk-1dkcakve.js} +1 -1
  4. package/dist/chunk-1gg5vxe8.js +2 -0
  5. package/dist/{chunk-0wwwd7mt.js → chunk-1j0sarne.js} +2 -2
  6. package/dist/{chunk-mae8arvd.js → chunk-26ps9djm.js} +2 -2
  7. package/dist/{chunk-6tz95v2x.js → chunk-2933mvwr.js} +2 -2
  8. package/dist/{chunk-2xbdd0r8.js → chunk-2hmyj5wh.js} +1 -1
  9. package/dist/{chunk-xaxswtkb.js → chunk-2pvcp0y6.js} +4 -4
  10. package/dist/chunk-2yzwrvq1.js +2 -0
  11. package/dist/{chunk-aze0xdtt.js → chunk-3xyv2fec.js} +1 -1
  12. package/dist/{chunk-91gfv93w.js → chunk-48ma0qcr.js} +1 -1
  13. package/dist/chunk-52x079ax.js +2 -0
  14. package/dist/{chunk-ta030rdc.js → chunk-53e9ta3g.js} +1 -1
  15. package/dist/{chunk-9e3w8am7.js → chunk-5fmxn52y.js} +1 -1
  16. package/dist/{chunk-y5yrbhdq.js → chunk-61ww9d2z.js} +1 -1
  17. package/dist/chunk-75zc8w68.js +2 -0
  18. package/dist/chunk-7b3phzx4.js +2 -0
  19. package/dist/{chunk-syxcw8xt.js → chunk-7z7zp8xq.js} +1 -1
  20. package/dist/{chunk-sr4ptszn.js → chunk-87em5xdg.js} +6 -6
  21. package/dist/{chunk-cvz3qhme.js → chunk-8xr8y9sq.js} +1 -1
  22. package/dist/{chunk-p8h6r83g.js → chunk-9rs12v0r.js} +1 -1
  23. package/dist/{chunk-cyarez4b.js → chunk-ac75vk0w.js} +1 -1
  24. package/dist/{chunk-9bx4b0r1.js → chunk-aw3jfdca.js} +1 -1
  25. package/dist/{chunk-nrekjc5a.js → chunk-b0th3d8q.js} +5 -5
  26. package/dist/{chunk-yqsxwpkn.js → chunk-ccmc5rqj.js} +1 -1
  27. package/dist/{chunk-53papj9w.js → chunk-chy90834.js} +1 -1
  28. package/dist/{chunk-gm2kbxpe.js → chunk-cwmazy7y.js} +1 -1
  29. package/dist/{chunk-jb0w5518.js → chunk-d40zjm6k.js} +1 -1
  30. package/dist/{chunk-sm4stc69.js → chunk-dnjbzwwn.js} +1 -1
  31. package/dist/{chunk-3kq5y6m2.js → chunk-drmgwjnb.js} +5 -5
  32. package/dist/{chunk-cra0fqzw.js → chunk-ft1ht0b3.js} +1 -1
  33. package/dist/{chunk-wje0xr3z.js → chunk-j388n7v2.js} +1 -1
  34. package/dist/{chunk-1zrepav2.js → chunk-k093pr2w.js} +1 -1
  35. package/dist/{chunk-j9p2mtqv.js → chunk-k4x8v39k.js} +1 -1
  36. package/dist/{chunk-jsvvf8x5.js → chunk-kcp392wy.js} +1 -1
  37. package/dist/{chunk-2qnm4abn.js → chunk-kejrhccx.js} +1 -1
  38. package/dist/{chunk-xgsyhefw.js → chunk-kmj127rm.js} +1 -1
  39. package/dist/chunk-m0f3strn.js +2 -0
  40. package/dist/{chunk-tevmv0ex.js → chunk-n8f0zw1y.js} +2 -2
  41. package/dist/chunk-nadgej53.js +2 -0
  42. package/dist/{chunk-5hznhyx0.js → chunk-nb3kkvet.js} +1 -1
  43. package/dist/{chunk-aywaxzf4.js → chunk-nh3kd03f.js} +1 -1
  44. package/dist/chunk-nw2zh40z.js +2 -0
  45. package/dist/{chunk-cmy9n7as.js → chunk-p01b07se.js} +4 -4
  46. package/dist/chunk-p99an8rj.js +2 -0
  47. package/dist/chunk-pgvwysxq.js +2 -0
  48. package/dist/{chunk-hgpt35ht.js → chunk-pz3mg7hr.js} +1 -1
  49. package/dist/{chunk-ng5vcdsy.js → chunk-qvefcnyb.js} +1 -1
  50. package/dist/{chunk-gbxjpqv2.js → chunk-qyf3jcy1.js} +1 -1
  51. package/dist/{chunk-hbsnj1db.js → chunk-t3gmm1ja.js} +1 -1
  52. package/dist/{chunk-vvfwhawg.js → chunk-tbb4en1q.js} +1 -1
  53. package/dist/{chunk-vjh43kr3.js → chunk-tsrf4zzy.js} +1 -1
  54. package/dist/{chunk-3m7rj46m.js → chunk-tx4wfk5v.js} +1 -1
  55. package/dist/chunk-vct8a1qf.js +20 -0
  56. package/dist/{chunk-cpp0p1eq.js → chunk-wc5tt6da.js} +1 -1
  57. package/dist/{chunk-1at6tyv1.js → chunk-wejabf6y.js} +3 -3
  58. package/dist/{chunk-7ev6gq40.js → chunk-wt7rp7wc.js} +2 -2
  59. package/dist/{chunk-pqeqkn06.js → chunk-xyk2zxkk.js} +1 -1
  60. package/dist/{chunk-nq6kw7ze.js → chunk-y4ncmvf2.js} +1 -1
  61. package/dist/{chunk-d9mt7q55.js → chunk-yxw8gbnh.js} +2 -2
  62. package/dist/chunk-zcbp27x1.js +2 -0
  63. package/dist/cli.js +7 -7
  64. package/dist/client-script-bundler.d.ts +1 -1
  65. package/dist/client-script-bundler.js +7 -6
  66. package/dist/craft-entry.js +1 -1
  67. package/dist/craft.js +1 -1
  68. package/dist/pwa.js +1 -1
  69. package/dist/ssg.js +2 -2
  70. package/package.json +5 -5
  71. package/dist/chunk-0dbsfvs9.js +0 -2
  72. package/dist/chunk-47b1qj75.js +0 -2
  73. package/dist/chunk-7ndbf386.js +0 -2
  74. package/dist/chunk-a9kjbpp1.js +0 -2
  75. package/dist/chunk-brwm3qgd.js +0 -2
  76. package/dist/chunk-mem1tzzk.js +0 -2
  77. package/dist/chunk-pk55ne76.js +0 -2
  78. package/dist/chunk-pt789fn7.js +0 -2
  79. package/dist/chunk-r5y241js.js +0 -2
  80. package/dist/chunk-vq86p4dy.js +0 -20
  81. package/dist/chunk-x3gsf7at.js +0 -2
  82. package/dist/chunk-xgxkw2n1.js +0 -2
@@ -1,6 +1,6 @@
1
1
  // @bun
2
2
  import{le}from"./chunk-f26n6y9p.js";import{Be,A}from"./chunk-9wdd7eq6.js";import{wa}from"./chunk-q3gactm1.js";import{c}from"./chunk-mf19qxgv.js";import S from"fs";import m from"path";import{pathToFileURL as O}from"url";var E=["GET","POST","PUT","PATCH","DELETE","HEAD","OPTIONS"],P=new Set;function en(s,l={}){let o=m.resolve(s,l.dir??"server/api"),i=[],f=new Map;if(!S.existsSync(o))return i;let t=Array.from(new Bun.Glob("**/*.{ts,js,mts,mjs}").scanSync({cwd:o})).sort();for(let e of t){if(e.endsWith(".d.ts"))continue;let p=e.replace(/\.(?:ts|js|mts|mjs)$/,"").split("/"),n=p.pop(),u=n.lastIndexOf("."),d=u>=0?n.slice(u+1):"get",g=d.toUpperCase();if(!E.includes(g)||d!==d.toLowerCase())throw Error(`Unsupported API method suffix in ${e}; use ${E.map((y)=>y.toLowerCase()).join(", ")}`);if(u>=0)n=n.slice(0,u);if(n!=="index")p.push(n);let r=new Set,h=p.map((y,I)=>{let v=/^\[(\.\.\.)?([A-Za-z_]\w*)\]$/.exec(y);if(v){if(r.has(v[2])||v[1]&&I!==p.length-1)throw Error(`Invalid API parameter in ${e}`);return r.add(v[2]),`:${v[2]}${v[1]?"*":""}`}if(!/^[\w-]+$/.test(y))throw Error(`Unsupported API path segment ${y} in ${e}`);return y}),w=`/api${h.length?`/${h.join("/")}`:""}`,x=`${g} ${w.replace(/:\w+/g,":param")}`;if(f.has(x))throw Error(`Ambiguous API route ${g} ${w}: ${f.get(x)} and ${e}`);f.set(x,e);let R=m.join(o,e);P.add(m.resolve(R)),P.add(S.realpathSync(R)),i.push({pattern:w,method:g,filePath:R})}return i.sort((e,a)=>{let p=e.pattern.split("/"),n=a.pattern.split("/"),u=(d)=>d?.endsWith("*")?0:d?.startsWith(":")?1:2;for(let d=0;d<Math.max(p.length,n.length);d++){let g=u(n[d])-u(p[d]);if(g)return g}return e.pattern.localeCompare(a.pattern)||e.method.localeCompare(a.method)})}async function Js(s,l){let o=c(s,"api-types.d.ts"),i=["// Generated by stx. Include this file in tsconfig.json.","declare module '@stacksjs/stx/api-client' {"," interface KnownApiRoutes {"];for(let t of l){let e=`./${m.relative(m.dirname(o),t.filePath).replace(/\\/g,"/")}`,{params:a}=le(t.pattern);i.push(` ${JSON.stringify(`${t.method} ${t.pattern}`)}: { params: { ${a.map((p)=>`${JSON.stringify(p)}: string`).join("; ")} }; response: Awaited<ReturnType<typeof import(${JSON.stringify(e)}).default>> }`)}i.push(" }","}","export {}","");let f=i.join(`
3
3
  `);if(!await Bun.file(o).exists()||await Bun.file(o).text()!==f)await Bun.write(o,f);return o}async function Ys(s,l,o={}){let i=en(s,o);await Js(s,i);let f=[];for(let t of i){let e=await Bun.build({entrypoints:[t.filePath],target:"bun",format:"esm",minify:!1,splitting:!1});if(!e.success)throw Error(`API build failed for ${t.filePath}: ${e.logs.join(`
4
- `)}`);let a=e.outputs.find((u)=>u.kind==="entry-point");if(!a)throw Error(`No API bundle for ${t.filePath}`);if(e.outputs.length!==1)throw Error(`API endpoint ${t.filePath} emits assets; package those explicitly instead`);let n=`server/api/endpoint-${new Bun.CryptoHasher("sha256").update(await a.arrayBuffer()).digest("hex").slice(0,20)}.mjs`;await Bun.write(m.join(l,n),a),f.push({...t,filePath:n})}return f}function j(s,l){let o=s.map((i)=>({route:i,...le(i.pattern)}));return async(i)=>{let f=new URL(i.url).pathname,t=o.filter((r)=>r.regex.test(f));if(!t.length)return null;let e=t[0].route.pattern,a=(r)=>r.replace(/:\w+/g,":param"),p=t.filter((r)=>a(r.route.pattern)===a(e)),n=i.method,u=p.find((r)=>r.route.method===n)??(n==="HEAD"?p.find((r)=>r.route.method==="GET"):void 0);if(!u){let r=new Set(p.map((h)=>h.route.method));if(r.has("GET"))r.add("HEAD");return r.add("OPTIONS"),new Response(null,{status:n==="OPTIONS"?204:405,headers:{Allow:Array.from(r).sort().join(", ")}})}let d=u.regex.exec(f),g=Object.create(null);try{u.params.forEach((r,h)=>{g[r]=decodeURIComponent(d[h+1])})}catch{return new Response("Invalid URL parameter encoding",{status:400})}try{let r=await l(u.route);if(typeof r!=="function")throw Error(`API endpoint ${u.route.filePath} must default-export a handler`);let h=await r(i,{params:g}),w=h instanceof Response?h:h===void 0?new Response(null,{status:204}):Response.json(h);if(n==="HEAD")return new Response(null,{status:w.status,headers:w.headers});return w}catch(r){return console.error(`[stx] API error for ${n} ${e}:`,r),Response.json({error:"Internal Server Error"},{status:500})}}}function Zs(s,l){return j(l,async(o)=>(await import(O(m.resolve(s,o.filePath)).href)).default)}async function ap(s,l){if(!l)return async()=>null;let o=l===!0?{}:l,i=en(s,o);return await Js(s,i),async(f)=>{if(!new URL(f.url).pathname.match(/^\/api(?:\/|$)/))return null;try{let t=en(s,o);await Js(s,t);let{loadStxConfig:e}=await import("./chunk-cra0fqzw.js"),a=A((await e(s)).runtimeConfig);return await Be(a,()=>j(t,async(p)=>{let n=await Bun.build({entrypoints:[p.filePath],target:"bun",format:"esm",splitting:!1});if(!n.success)throw Error(n.logs.join(`
4
+ `)}`);let a=e.outputs.find((u)=>u.kind==="entry-point");if(!a)throw Error(`No API bundle for ${t.filePath}`);if(e.outputs.length!==1)throw Error(`API endpoint ${t.filePath} emits assets; package those explicitly instead`);let n=`server/api/endpoint-${new Bun.CryptoHasher("sha256").update(await a.arrayBuffer()).digest("hex").slice(0,20)}.mjs`;await Bun.write(m.join(l,n),a),f.push({...t,filePath:n})}return f}function j(s,l){let o=s.map((i)=>({route:i,...le(i.pattern)}));return async(i)=>{let f=new URL(i.url).pathname,t=o.filter((r)=>r.regex.test(f));if(!t.length)return null;let e=t[0].route.pattern,a=(r)=>r.replace(/:\w+/g,":param"),p=t.filter((r)=>a(r.route.pattern)===a(e)),n=i.method,u=p.find((r)=>r.route.method===n)??(n==="HEAD"?p.find((r)=>r.route.method==="GET"):void 0);if(!u){let r=new Set(p.map((h)=>h.route.method));if(r.has("GET"))r.add("HEAD");return r.add("OPTIONS"),new Response(null,{status:n==="OPTIONS"?204:405,headers:{Allow:Array.from(r).sort().join(", ")}})}let d=u.regex.exec(f),g=Object.create(null);try{u.params.forEach((r,h)=>{g[r]=decodeURIComponent(d[h+1])})}catch{return new Response("Invalid URL parameter encoding",{status:400})}try{let r=await l(u.route);if(typeof r!=="function")throw Error(`API endpoint ${u.route.filePath} must default-export a handler`);let h=await r(i,{params:g}),w=h instanceof Response?h:h===void 0?new Response(null,{status:204}):Response.json(h);if(n==="HEAD")return new Response(null,{status:w.status,headers:w.headers});return w}catch(r){return console.error(`[stx] API error for ${n} ${e}:`,r),Response.json({error:"Internal Server Error"},{status:500})}}}function Zs(s,l){return j(l,async(o)=>(await import(O(m.resolve(s,o.filePath)).href)).default)}async function ap(s,l){if(!l)return async()=>null;let o=l===!0?{}:l,i=en(s,o);return await Js(s,i),async(f)=>{if(!new URL(f.url).pathname.match(/^\/api(?:\/|$)/))return null;try{let t=en(s,o);await Js(s,t);let{loadStxConfig:e}=await import("./chunk-ft1ht0b3.js"),a=A((await e(s)).runtimeConfig);return await Be(a,()=>j(t,async(p)=>{let n=await Bun.build({entrypoints:[p.filePath],target:"bun",format:"esm",splitting:!1});if(!n.success)throw Error(n.logs.join(`
5
5
  `));let u=n.outputs.find((d)=>d.kind==="entry-point");if(!u||n.outputs.length!==1)throw Error(`Unsupported API bundle output: ${p.filePath}`);return(await import(`data:text/javascript;base64,${Buffer.from(await u.text()).toString("base64")}`)).default})(f))}catch(t){return console.error("[stx] API discovery failed:",t),Response.json({error:"API discovery failed; check the server log"},{status:500})}}}function Qs(s,l,o){if(wa(s))return!0;let i=/^(?:(?:stx|ui)\.config\.[cm]?[jt]s|runtime-config-(?:server|loader)\.[cm]?[jt]s)$/;if(i.test(m.basename(s)))return!0;try{if(i.test(m.basename(S.realpathSync(s))))return!0}catch{}if(P.has(m.resolve(s)))return!0;if(!o)return!1;let f=m.resolve(l,typeof o==="object"?o.dir??"server/api":"server/api"),t=(a)=>{try{return S.realpathSync(a)}catch{return m.resolve(a)}},e=t(s);return[f,m.resolve(l,"server"),m.resolve(l,".output/server")].some((a)=>{let p=t(a);return e===p||e.startsWith(`${p}${m.sep}`)})}
6
6
  export{en,Js,Ys,Zs,ap,Qs};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{Be,yn,ws,Ho,A}from"./chunk-9wdd7eq6.js";import{hn}from"./chunk-cpp0p1eq.js";import{xr,x,lc,st,Jo,uc}from"./chunk-78yjmbbs.js";import{T}from"./chunk-6beg47t4.js";import{xs,l,p,Dt,u,V,D,y,Cs,Se,ze,Es}from"./chunk-qwdcts9w.js";import{r,fe}from"./chunk-tst8p27s.js";import{f}from"./chunk-b7e07ybq.js";import{U}from"./chunk-hh58k0nh.js";import Ge from"path";import Ct from"process";import{AsyncLocalStorage as lo}from"async_hooks";var or=new lo;function dn(e){return e.__stx_server_data??={pending:new Map,values:new Map}}function fr(e,i){return or.run(dn(e),i)}async function gr(e,i){let t=or.getStore();if(!t)throw Error("useServerData must run inside a <script server> render");if(typeof e!=="string"||!e.trim())throw TypeError("useServerData requires a non-empty string key");let o=t.pending.get(e);if(o)return o;let a=Promise.resolve().then(i).then((h)=>{let c=JSON.stringify(h,(E,R)=>{if(R===void 0||typeof R==="function"||typeof R==="symbol"||typeof R==="bigint"||typeof R==="number"&&!Number.isFinite(R))throw TypeError(`useServerData(${JSON.stringify(e)}) requires JSON-serializable data`);if(R&&typeof R==="object"&&!Array.isArray(R)&&Object.getPrototypeOf(R)!==Object.prototype&&Object.getPrototypeOf(R)!==null)throw TypeError(`useServerData(${JSON.stringify(e)}) requires JSON-serializable data`);return R}),v=JSON.parse(c);return t.values.set(e,v),v}).catch((h)=>{throw t.pending.delete(e),h});return t.pending.set(e,a),a}function dr(e){let i=e.__stx_server_data;if(!i?.values.size)return"";return`<script data-stx-scoped data-stx-server-data type="application/json">${JSON.stringify(Object.fromEntries(i.values)).replace(/</g,"\\u003c").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}</script>`}function L(e,i=!1){let t=r(e),o=[],a=new Set,h=0,c=0,v=t.length,E=()=>{if(h!==0)return;let R=t.slice(c).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*(?:[!:;,\n]|=(?!=)|$)/);if(R){if(i&&R[1]==="const")return;let I=R[2];if(!a.has(I))o.push(I),a.add(I);return}let C=t.slice(c).match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(C){if(i&&t.slice(c).startsWith("const"))return;C[1].split(",").forEach((I)=>{let P=I.trim();if(!P)return;let q=P.indexOf(":"),W=(q>=0?P.slice(q+1).trim():P).split(/[\s=]/)[0];if(W&&!a.has(W))o.push(W),a.add(W)});return}let O=t.slice(c).match(/^(?:const|let|var)\s+\[([^\]]+)\]\s*=/);if(O){if(i&&t.slice(c).startsWith("const"))return;O[1].split(",").forEach((I)=>{let P=I.trim().replace(/^\.\.\./,"");if(!P)return;let q=P.split(/[\s=]/)[0];if(q&&!a.has(q))o.push(q),a.add(q)});return}if(i)return;let M=t.slice(c).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(M){let I=M[1];if(!a.has(I))o.push(I),a.add(I);return}let N=t.slice(c).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(N){let I=N[1];if(!a.has(I))o.push(I),a.add(I)}};while(c<v){if(t[c]==="{"){h++,c++;continue}if(t[c]==="}"){h--,c++;continue}if(h===0&&/[a-z]/i.test(t[c])&&(c===0||/\s|[;{}()]/.test(t[c-1])))E();c++}return o.join(", ")}function os(e){return`{ enumerable: true, configurable: true, get() { return ${e} }, set(__stxValue_${e}) { ${e} = __stxValue_${e} } }`}function uo(e,i=L(e).split(",").map((t)=>t.trim()).filter(Boolean)){let t=new Set(L(e,!0).split(",").map((o)=>o.trim()));return i.map((o)=>t.has(o)?`get ${o}() { return ${o} }, set ${o}(__stxValue_${o}) { ${o} = __stxValue_${o} }`:o).join(", ")}function is(e,i){let t=`{ ${uo(e,i)} }`;return L(e).split(",").some((o)=>o.trim()==="__stxLiveBindings")?`Object.defineProperties(${t}, Object.getOwnPropertyDescriptors(__stxLiveBindings))`:t}import Cn from"fs";import Ce from"path";function j(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}var mr=new Map;function as(e,i=!0){let t=mr.get(e);if(i&&t)return t;let o=new Map,a=[Ce.join(e,"src"),Ce.join(e,"dist"),e];function h(c,v){if(v>6)return;let E;try{E=Cn.readdirSync(c,{withFileTypes:!0})}catch{return}for(let R of E){let C=Ce.join(c,R.name);if(R.isDirectory()){if(R.name==="node_modules"||R.name.startsWith("."))continue;h(C,v+1)}else if(R.isFile()&&R.name.endsWith(".stx")){let O=R.name.slice(0,-4);if(!o.has(O))o.set(O,C);let M=O.toLowerCase();if(!o.has(M))o.set(M,C);let N=j(O);if(!o.has(N))o.set(N,C)}}}for(let c of a)if(h(c,0),o.size>0)break;if(i)mr.set(e,o);return o}function cs(e,i){if(e.startsWith(".")||e.startsWith("/"))return null;let t=i;while(!0){let o=Ce.join(t,"node_modules",e);try{if(Cn.statSync(o).isDirectory())return o}catch{}let a=Ce.dirname(t);if(a===t)return null;t=a}}function ls(e,i,t={}){return[Ce.resolve(Ce.dirname(i),`${e}.stx`),Ce.resolve(Ce.dirname(i),e),Ce.resolve(t.componentsDir||"components",`${e}.stx`),Ce.resolve(t.componentsDir||"components",e),e.endsWith(".stx")?e:`${e}.stx`]}function hr(e){let i=e.endsWith(".stx")?e.slice(0,-4):e,t=i.split("-").map((a)=>a.charAt(0).toUpperCase()+a.slice(1)).join(""),o=j(i);return[i,t,o]}function Co(e,i){let[t,o,a]=hr(e);for(let h of[t,t.toLowerCase(),o,a]){let c=i?.__importedComponents?.get(h);if(c!==void 0)return c}}function*Eo(e,i,t={},o){let a=hr(e);if(a[0].startsWith("./")||a[0].startsWith("../")){yield Ce.resolve(Ce.dirname(i),`${a[0]}.stx`);return}let h=[...new Set(a.map((E)=>`${E}.stx`))],c=t.projectRoot||process.cwd(),v=[...o?.__originalFilePath?[Ce.join(Ce.dirname(o.__originalFilePath),"components")]:[],...t.componentsDir?[t.componentsDir]:[],Ce.join(Ce.dirname(i),"components"),Ce.resolve(c,"src/components"),Ce.resolve(c,"components"),...import.meta.dir?[Ce.resolve(import.meta.dir,"components")]:[]];for(let E of new Set(v)){for(let R of h)yield Ce.join(E,R);try{for(let R of Cn.readdirSync(E,{withFileTypes:!0}))if(R.isDirectory())for(let C of h)yield Ce.join(E,R.name,C)}catch{}}}function br(e,i,t={},o){let a=Co(e,o);if(a!==void 0)return a;for(let h of Eo(e,i,t,o))try{if(Cn.statSync(h,{throwIfNoEntry:!1})?.isFile())return h}catch{}return null}import qs from"fs";import le from"path";import dt from"path";import Kt from"fs";var fo=new Set(["touchstart","touchmove","wheel","mousewheel"]);function ns(e,i){if(i.passive)return!0;if(i.prevent||i.nonpassive)return!1;return fo.has(e.toLowerCase())}var yr=new Set(["click","dblclick","mousedown","mouseup","mousemove","mouseenter","mouseleave","mouseover","mouseout","contextmenu","wheel","keydown","keyup","keypress","submit","reset","change","input","focus","blur","focusin","focusout","select","invalid","touchstart","touchend","touchmove","touchcancel","drag","dragstart","dragend","dragenter","dragleave","dragover","drop","scroll","resize","load","error","abort","animationstart","animationend","animationiteration","transitionstart","transitionend","transitionrun","transitioncancel","mounted","unmounted"]),_r={enter:"Enter",tab:"Tab",delete:"Delete",backspace:"Backspace",esc:"Escape",escape:"Escape",space:" ",up:"ArrowUp",down:"ArrowDown",left:"ArrowLeft",right:"ArrowRight",home:"Home",end:"End",pageup:"PageUp",pagedown:"PageDown"},po=new Set(["ctrl","alt","shift","meta"]),$r={left:0,middle:1,right:2};function wr(e){let i={prevent:!1,stop:!1,once:!1,capture:!1,self:!1,passive:!1,nonpassive:!1,keys:[],systemKeys:[],mouse:null,debounce:null,throttle:null};for(let t of e){let o=t.toLowerCase();if(o==="prevent")i.prevent=!0;else if(o==="stop")i.stop=!0;else if(o==="once")i.once=!0;else if(o==="capture")i.capture=!0;else if(o==="self")i.self=!0;else if(o==="passive")i.passive=!0;else if(o==="nonpassive")i.nonpassive=!0;else if(po.has(o))i.systemKeys.push(o);else if(o in $r)i.mouse=o;else if(o in _r||/^[a-z]$/.test(o))i.keys.push(_r[o]||o.toUpperCase());else if(o.startsWith("debounce")){let a=o.match(/debounce(?:\.(\d+))?/);i.debounce=a?.[1]?Number.parseInt(a[1],10):300}else if(o.startsWith("throttle")){let a=o.match(/throttle(?:\.(\d+))?/);i.throttle=a?.[1]?Number.parseInt(a[1],10):300}}return i}function vr(e,i=""){let t=[],o=0,a=/<([a-z][a-z0-9-]*)\s+([^>]*@[a-z][^>]*)>/gi,h;while((h=a.exec(e))!==null){let[c,v,E]=h,R=h.index,C=R+c.length,O=`__stx_evt_${i}${o++}`,M=[],N=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,I;while((I=N.exec(E))!==null){let[,q,Z]=I,W=q.split("."),Y=W[0];if(!yr.has(Y))continue;M.push({attribute:`@${q}`,event:Y,handler:Z,modifiers:wr(W.slice(1)),elementId:O})}let P=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((I=P.exec(E))!==null){let[,q,Z]=I,W=q.split("."),Y=W[0];if(!yr.has(Y))continue;M.push({attribute:`@${q}`,event:Y,handler:Z,modifiers:wr(W.slice(1)),elementId:O})}if(M.length>0)t.push({originalTag:c,elementId:O,events:M,startIndex:R,endIndex:C})}return t}function go(e){let i=[],{modifiers:t}=e;if(t.self)i.push("if ($event.target !== $el) return");for(let o of t.systemKeys)i.push(`if (!$event.${o}Key) return`);if(t.keys.length>0){let o=t.keys.map((a)=>`$event.key === '${a}'`).join(" || ");i.push(`if (!(${o})) return`)}if(t.mouse!==null){let o=$r[t.mouse];i.push(`if ($event.button !== ${o}) return`)}if(t.prevent)i.push("$event.preventDefault()");if(t.stop)i.push("$event.stopPropagation()");return i.join("; ")}function mo(e,i){let t=e;if(i.debounce!==null)t=`__stx_debounce(() => { ${t} }, ${i.debounce})`;else if(i.throttle!==null)t=`__stx_throttle(() => { ${t} }, ${i.throttle})`;return t}function ss(e){let i=e.trim();if(!/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(i))return e;return`if (typeof ${i} === 'function' && !${i}._isSignal) ${i}($event);`}function ho(e){let{modifiers:i}=e,t=e.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),o=go(e),a=mo(ss(e.handler),i),h=[];if(i.once)h.push("once: true");if(i.capture)h.push("capture: true");if(ns(e.event,i))h.push("passive: true");let c=h.length>0?`, { ${h.join(", ")} }`:"",v=a.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t");if(e.event==="mounted")return`
2
+ import{Be,yn,ws,Ho,A}from"./chunk-9wdd7eq6.js";import{hn}from"./chunk-wc5tt6da.js";import{xr,x,lc,st,Jo,uc}from"./chunk-78yjmbbs.js";import{T}from"./chunk-6beg47t4.js";import{xs,l,p,Dt,u,V,D,y,Cs,Se,ze,Es}from"./chunk-qwdcts9w.js";import{r,fe}from"./chunk-tst8p27s.js";import{f}from"./chunk-b7e07ybq.js";import{U}from"./chunk-hh58k0nh.js";import Ge from"path";import Ct from"process";import{AsyncLocalStorage as lo}from"async_hooks";var or=new lo;function dn(e){return e.__stx_server_data??={pending:new Map,values:new Map}}function fr(e,i){return or.run(dn(e),i)}async function gr(e,i){let t=or.getStore();if(!t)throw Error("useServerData must run inside a <script server> render");if(typeof e!=="string"||!e.trim())throw TypeError("useServerData requires a non-empty string key");let o=t.pending.get(e);if(o)return o;let a=Promise.resolve().then(i).then((h)=>{let c=JSON.stringify(h,(E,R)=>{if(R===void 0||typeof R==="function"||typeof R==="symbol"||typeof R==="bigint"||typeof R==="number"&&!Number.isFinite(R))throw TypeError(`useServerData(${JSON.stringify(e)}) requires JSON-serializable data`);if(R&&typeof R==="object"&&!Array.isArray(R)&&Object.getPrototypeOf(R)!==Object.prototype&&Object.getPrototypeOf(R)!==null)throw TypeError(`useServerData(${JSON.stringify(e)}) requires JSON-serializable data`);return R}),v=JSON.parse(c);return t.values.set(e,v),v}).catch((h)=>{throw t.pending.delete(e),h});return t.pending.set(e,a),a}function dr(e){let i=e.__stx_server_data;if(!i?.values.size)return"";return`<script data-stx-scoped data-stx-server-data type="application/json">${JSON.stringify(Object.fromEntries(i.values)).replace(/</g,"\\u003c").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}</script>`}function L(e,i=!1){let t=r(e),o=[],a=new Set,h=0,c=0,v=t.length,E=()=>{if(h!==0)return;let R=t.slice(c).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*(?:[!:;,\n]|=(?!=)|$)/);if(R){if(i&&R[1]==="const")return;let I=R[2];if(!a.has(I))o.push(I),a.add(I);return}let C=t.slice(c).match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(C){if(i&&t.slice(c).startsWith("const"))return;C[1].split(",").forEach((I)=>{let P=I.trim();if(!P)return;let q=P.indexOf(":"),W=(q>=0?P.slice(q+1).trim():P).split(/[\s=]/)[0];if(W&&!a.has(W))o.push(W),a.add(W)});return}let O=t.slice(c).match(/^(?:const|let|var)\s+\[([^\]]+)\]\s*=/);if(O){if(i&&t.slice(c).startsWith("const"))return;O[1].split(",").forEach((I)=>{let P=I.trim().replace(/^\.\.\./,"");if(!P)return;let q=P.split(/[\s=]/)[0];if(q&&!a.has(q))o.push(q),a.add(q)});return}if(i)return;let M=t.slice(c).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(M){let I=M[1];if(!a.has(I))o.push(I),a.add(I);return}let N=t.slice(c).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(N){let I=N[1];if(!a.has(I))o.push(I),a.add(I)}};while(c<v){if(t[c]==="{"){h++,c++;continue}if(t[c]==="}"){h--,c++;continue}if(h===0&&/[a-z]/i.test(t[c])&&(c===0||/\s|[;{}()]/.test(t[c-1])))E();c++}return o.join(", ")}function os(e){return`{ enumerable: true, configurable: true, get() { return ${e} }, set(__stxValue_${e}) { ${e} = __stxValue_${e} } }`}function uo(e,i=L(e).split(",").map((t)=>t.trim()).filter(Boolean)){let t=new Set(L(e,!0).split(",").map((o)=>o.trim()));return i.map((o)=>t.has(o)?`get ${o}() { return ${o} }, set ${o}(__stxValue_${o}) { ${o} = __stxValue_${o} }`:o).join(", ")}function is(e,i){let t=`{ ${uo(e,i)} }`;return L(e).split(",").some((o)=>o.trim()==="__stxLiveBindings")?`Object.defineProperties(${t}, Object.getOwnPropertyDescriptors(__stxLiveBindings))`:t}import Cn from"fs";import Ce from"path";function j(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}var mr=new Map;function as(e,i=!0){let t=mr.get(e);if(i&&t)return t;let o=new Map,a=[Ce.join(e,"src"),Ce.join(e,"dist"),e];function h(c,v){if(v>6)return;let E;try{E=Cn.readdirSync(c,{withFileTypes:!0})}catch{return}for(let R of E){let C=Ce.join(c,R.name);if(R.isDirectory()){if(R.name==="node_modules"||R.name.startsWith("."))continue;h(C,v+1)}else if(R.isFile()&&R.name.endsWith(".stx")){let O=R.name.slice(0,-4);if(!o.has(O))o.set(O,C);let M=O.toLowerCase();if(!o.has(M))o.set(M,C);let N=j(O);if(!o.has(N))o.set(N,C)}}}for(let c of a)if(h(c,0),o.size>0)break;if(i)mr.set(e,o);return o}function cs(e,i){if(e.startsWith(".")||e.startsWith("/"))return null;let t=i;while(!0){let o=Ce.join(t,"node_modules",e);try{if(Cn.statSync(o).isDirectory())return o}catch{}let a=Ce.dirname(t);if(a===t)return null;t=a}}function ls(e,i,t={}){return[Ce.resolve(Ce.dirname(i),`${e}.stx`),Ce.resolve(Ce.dirname(i),e),Ce.resolve(t.componentsDir||"components",`${e}.stx`),Ce.resolve(t.componentsDir||"components",e),e.endsWith(".stx")?e:`${e}.stx`]}function hr(e){let i=e.endsWith(".stx")?e.slice(0,-4):e,t=i.split("-").map((a)=>a.charAt(0).toUpperCase()+a.slice(1)).join(""),o=j(i);return[i,t,o]}function Co(e,i){let[t,o,a]=hr(e);for(let h of[t,t.toLowerCase(),o,a]){let c=i?.__importedComponents?.get(h);if(c!==void 0)return c}}function*Eo(e,i,t={},o){let a=hr(e);if(a[0].startsWith("./")||a[0].startsWith("../")){yield Ce.resolve(Ce.dirname(i),`${a[0]}.stx`);return}let h=[...new Set(a.map((E)=>`${E}.stx`))],c=t.projectRoot||process.cwd(),v=[...o?.__originalFilePath?[Ce.join(Ce.dirname(o.__originalFilePath),"components")]:[],...t.componentsDir?[t.componentsDir]:[],Ce.join(Ce.dirname(i),"components"),Ce.resolve(c,"src/components"),Ce.resolve(c,"components"),...import.meta.dir?[Ce.resolve(import.meta.dir,"components")]:[]];for(let E of new Set(v)){for(let R of h)yield Ce.join(E,R);try{for(let R of Cn.readdirSync(E,{withFileTypes:!0}))if(R.isDirectory())for(let C of h)yield Ce.join(E,R.name,C)}catch{}}}function br(e,i,t={},o){let a=Co(e,o);if(a!==void 0)return a;for(let h of Eo(e,i,t,o))try{if(Cn.statSync(h,{throwIfNoEntry:!1})?.isFile())return h}catch{}return null}import qs from"fs";import le from"path";import dt from"path";import Kt from"fs";var fo=new Set(["touchstart","touchmove","wheel","mousewheel"]);function ns(e,i){if(i.passive)return!0;if(i.prevent||i.nonpassive)return!1;return fo.has(e.toLowerCase())}var yr=new Set(["click","dblclick","mousedown","mouseup","mousemove","mouseenter","mouseleave","mouseover","mouseout","contextmenu","wheel","keydown","keyup","keypress","submit","reset","change","input","focus","blur","focusin","focusout","select","invalid","touchstart","touchend","touchmove","touchcancel","drag","dragstart","dragend","dragenter","dragleave","dragover","drop","scroll","resize","load","error","abort","animationstart","animationend","animationiteration","transitionstart","transitionend","transitionrun","transitioncancel","mounted","unmounted"]),_r={enter:"Enter",tab:"Tab",delete:"Delete",backspace:"Backspace",esc:"Escape",escape:"Escape",space:" ",up:"ArrowUp",down:"ArrowDown",left:"ArrowLeft",right:"ArrowRight",home:"Home",end:"End",pageup:"PageUp",pagedown:"PageDown"},po=new Set(["ctrl","alt","shift","meta"]),$r={left:0,middle:1,right:2};function wr(e){let i={prevent:!1,stop:!1,once:!1,capture:!1,self:!1,passive:!1,nonpassive:!1,keys:[],systemKeys:[],mouse:null,debounce:null,throttle:null};for(let t of e){let o=t.toLowerCase();if(o==="prevent")i.prevent=!0;else if(o==="stop")i.stop=!0;else if(o==="once")i.once=!0;else if(o==="capture")i.capture=!0;else if(o==="self")i.self=!0;else if(o==="passive")i.passive=!0;else if(o==="nonpassive")i.nonpassive=!0;else if(po.has(o))i.systemKeys.push(o);else if(o in $r)i.mouse=o;else if(o in _r||/^[a-z]$/.test(o))i.keys.push(_r[o]||o.toUpperCase());else if(o.startsWith("debounce")){let a=o.match(/debounce(?:\.(\d+))?/);i.debounce=a?.[1]?Number.parseInt(a[1],10):300}else if(o.startsWith("throttle")){let a=o.match(/throttle(?:\.(\d+))?/);i.throttle=a?.[1]?Number.parseInt(a[1],10):300}}return i}function vr(e,i=""){let t=[],o=0,a=/<([a-z][a-z0-9-]*)\s+([^>]*@[a-z][^>]*)>/gi,h;while((h=a.exec(e))!==null){let[c,v,E]=h,R=h.index,C=R+c.length,O=`__stx_evt_${i}${o++}`,M=[],N=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,I;while((I=N.exec(E))!==null){let[,q,Z]=I,W=q.split("."),Y=W[0];if(!yr.has(Y))continue;M.push({attribute:`@${q}`,event:Y,handler:Z,modifiers:wr(W.slice(1)),elementId:O})}let P=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((I=P.exec(E))!==null){let[,q,Z]=I,W=q.split("."),Y=W[0];if(!yr.has(Y))continue;M.push({attribute:`@${q}`,event:Y,handler:Z,modifiers:wr(W.slice(1)),elementId:O})}if(M.length>0)t.push({originalTag:c,elementId:O,events:M,startIndex:R,endIndex:C})}return t}function go(e){let i=[],{modifiers:t}=e;if(t.self)i.push("if ($event.target !== $el) return");for(let o of t.systemKeys)i.push(`if (!$event.${o}Key) return`);if(t.keys.length>0){let o=t.keys.map((a)=>`$event.key === '${a}'`).join(" || ");i.push(`if (!(${o})) return`)}if(t.mouse!==null){let o=$r[t.mouse];i.push(`if ($event.button !== ${o}) return`)}if(t.prevent)i.push("$event.preventDefault()");if(t.stop)i.push("$event.stopPropagation()");return i.join("; ")}function mo(e,i){let t=e;if(i.debounce!==null)t=`__stx_debounce(() => { ${t} }, ${i.debounce})`;else if(i.throttle!==null)t=`__stx_throttle(() => { ${t} }, ${i.throttle})`;return t}function ss(e){let i=e.trim();if(!/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(i))return e;return`if (typeof ${i} === 'function' && !${i}._isSignal) ${i}($event);`}function ho(e){let{modifiers:i}=e,t=e.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),o=go(e),a=mo(ss(e.handler),i),h=[];if(i.once)h.push("once: true");if(i.capture)h.push("capture: true");if(ns(e.event,i))h.push("passive: true");let c=h.length>0?`, { ${h.join(", ")} }`:"",v=a.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t");if(e.event==="mounted")return`
3
3
  (function() {
4
4
  var $el = document.getElementById('${t}');
5
5
  if (!$el) return;
@@ -112,7 +112,7 @@ else {
112
112
  `)}
113
113
  })();
114
114
  </script>`}function xo(e,i=""){let t=vr(e,i);if(t.length===0)return{template:e,bindings:[]};let o=e,a=[];for(let h=t.length-1;h>=0;h--){let c=t[h],v=c.originalTag;if(!v.includes(" id="))v=v.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${c.elementId}"`);else{let E=v.match(/id=["']([^"']+)["']/);if(E)for(let R of c.events)R.elementId=E[1]}for(let E of c.events){let R=E.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),C=new RegExp(`\\s*${R}\\s*=\\s*"[^"]*"`,"g"),O=new RegExp(`\\s*${R}\\s*=\\s*'[^']*'`,"g");v=v.replace(C,""),v=v.replace(O,"")}o=o.slice(0,c.startIndex)+v+o.slice(c.endIndex),a.push(...c.events)}return{template:o,bindings:a}}function Sr(e){let i=e.$uid;return typeof i==="string"&&i?`${i}_`:""}function $a(e,i,t){if(uc(e))return e;if(i.__stx_sfc_mode){if(/x-data\s*=\s*["']/.test(e))return e;let{template:v,bindings:E}=xo(e,Sr(i)),R=i.__stx_event_bindings||[];return i.__stx_event_bindings=[...R,...E],v}let o=vr(e,Sr(i));if(o.length===0)return e;let a=e;for(let v=o.length-1;v>=0;v--){let E=o[v],R=E.originalTag;if(!R.includes(" id="))R=R.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${E.elementId}"`);else{let C=R.match(/id=["']([^"']+)["']/);if(C)for(let O of E.events)O.elementId=C[1]}for(let C of E.events){let O=C.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),M=new RegExp(`\\s*${O}\\s*=\\s*"[^"]*"`,"g"),N=new RegExp(`\\s*${O}\\s*=\\s*'[^']*'`,"g");R=R.replace(M,""),R=R.replace(N,"")}a=a.slice(0,E.startIndex)+R+a.slice(E.endIndex)}let h=To(o.flatMap((v)=>v.events)),c=a.lastIndexOf("</body>");if(c!==-1)a=a.slice(0,c)+h+`
115
- `+a.slice(c);else a+=h;return a}function Er(e,i){let t=new Set;for(let o of e.split(",")){let a=o.trim().replace(/^\.\.\./,"").trim();if(!a)continue;if(i){let h=a.lastIndexOf(":");if(h!==-1)a=a.slice(h+1).trim()}if(a=a.split("=")[0].trim(),/^[A-Za-z_$][\w$]*$/.test(a))t.add(a)}return t}function Et(e,i){let t=r(e),{depths:o,balanced:a}=fe(t),h=(v)=>!a||o[v]===0,c=new RegExp(`(?:^|[^\\w$.])((?:const|let|var|function|class)\\s+${i}\\b)`,"g");for(let v of t.matchAll(c)){let E=(v.index??0)+v[0].length-v[1].length;if(h(E))return!0}for(let v of t.matchAll(/(?:const|let|var)\s*\{([^}]*)\}/g))if(h(v.index??0)&&Er(v[1],!0).has(i))return!0;for(let v of t.matchAll(/(?:const|let|var)\s*\[([^\]]*)\]/g))if(h(v.index??0)&&Er(v[1],!1).has(i))return!0;return!1}var kr="",Tn,ct=/^[A-Za-z_$][\w$]*$/,bo=new Set(["if","for","while","switch","with"]),Rr=["(","[","{"],Cr=[")","]","}"],yo=new Set(["const","let","var","return","if","for","while","do","switch","try","throw","export"]);function _o(e){let i=r(e),t=[];for(let o of i.matchAll(/[A-Za-z_$][\w$]*|=>|\.\.\.|[^\s]/g)){let a=o.index??0;t.push({text:o[0],start:a,end:a+o[0].length})}return{code:i,tokens:t}}function rs(e){if(Tn&&e===kr)return Tn;let{code:i,tokens:t}=_o(e),o=new Map,a=[];for(let I=0;I<t.length;I++){let P=t[I].text;if(["(","[","{"].includes(P))a.push(I);else if([")","]","}"].includes(P)){let q=a.at(-1);if(q!==void 0&&["()","[]","{}"].includes(t[q].text+P))a.pop(),o.set(q,I),o.set(I,q)}}function h(I,P){let q=[],Z=I;for(let W=I;W<P;W++){if(["(","[","{"].includes(t[W].text)&&(o.get(W)??P)<P){W=o.get(W);continue}if(t[W].text===",")q.push([Z,W]),Z=W+1}return q.push([Z,P]),q}let c=[];function v(I,P,q,Z=!1){if(t[I]?.text==="...")I++;if(I>=P)return;let W=t[I].text;if(ct.test(W)){if(q.add(W),q===C)c.push({name:W,token:I,functionScoped:Z});return}if(W!=="{"&&W!=="[")return;let Y=o.get(I);if(Y===void 0||Y>=P)return;for(let[ee,te]of h(I+1,Y)){let ae=ee;if(W==="{")for(let me=ee;me<te;me++){if(t[me].text===":"){ae=me+1;break}if(t[me].text==="=")break;if(["(","[","{"].includes(t[me].text)&&o.has(me))me=o.get(me)}v(ae,te,q,Z)}}function E(I,P){let q=new Set;for(let[Z,W]of h(I,P))v(Z,W,q);return q}function R(I){let P=I;for(;P<t.length;P++){let q=t[P].text;if(["(","[","{"].includes(q)&&o.has(P)){P=o.get(P);continue}if([",",";",")","]","}"].includes(q))break}return t[Math.max(I,P-1)]?.end??i.length}let C=new Set,O=[];for(let I=0;I<t.length;I++)if(t[I].text==="=>"){let P=I-1,q=P,Z;if(t[P]?.text===")"&&o.has(P))q=o.get(P),Z=E(q+1,P);else if(t[P]&&ct.test(t[P].text))Z=new Set([t[P].text]);else continue;let W=I+1,Y=t[W]?.text==="{"&&o.has(W)?t[o.get(W)].end:R(W);O.push({start:t[q].start,end:Y,bodyStart:t[W]?.start??Y,functionBody:!0,names:Z})}else if(t[I].text==="("&&o.has(I)){let P=t[I-1]?.text;if(!P||bo.has(P)||!ct.test(P)&&P!=="*"&&P!=="]")continue;let q=o.get(I),Z=q+1;if(t[Z]?.text===":"){Z++;while(Z<t.length&&!["{","=>",";","="].includes(t[Z].text))Z++}if(t[Z]?.text!=="{"||!o.has(Z))continue;O.push({start:t[I].start,end:t[o.get(Z)].end,bodyStart:t[Z].start,functionBody:P!=="catch",names:E(I+1,q)})}function M(I){let P=I;for(;P<t.length;P++){let q=t[P].text;if(Rr.includes(q)&&o.has(P)){P=o.get(P);continue}if(q===";"||Cr.includes(q))break;let Z=t[P-1];if(P>I&&yo.has(q)&&Z.text!==".")break;if(P>I&&/[\n\r]/.test(i.slice(Z.end,t[P].start))&&(/^[\w$]+$/.test(Z.text)||Cr.includes(Z.text)||['"',"'","`"].includes(Z.text))&&ct.test(q)&&!["in","of","instanceof"].includes(q))break}return P}let N=[];for(let I=0;I<t.length;I++){if(t[I].text!=="for")continue;let P=t[I+1]?.text==="await"?I+2:I+1;if(t[P]?.text!=="("||!o.has(P))continue;let q=o.get(P),Z=q+1,W=t[Z]?.text==="{"&&o.has(Z)?o.get(Z):M(Z),Y=t[W]?.text===";"||t[W]?.text==="}"?t[W].end:t[Math.max(Z,W-1)]?.end??i.length;N.push({headStart:P,headEnd:q,start:t[P].start,end:Y})}for(let I=0;I<t.length;I++){let P=t[I].text,q=t[I-1]?.text;if(q==="."||t[I+1]?.text===":")continue;if(q==="as"||q==="<")continue;if(P==="const"||P==="let"||P==="var"){let Z=M(I+1),W=I+1,Y=!1,ee=!1,te=0;for(let ae=I+1;ae<=Z;ae++){let me=t[ae]?.text;if(ae<Z&&Rr.includes(me)&&o.has(ae)&&o.get(ae)<Z){ae=o.get(ae);continue}if(ae<Z&&me===":"&&!ee)Y=!0;else if(ae<Z&&me==="="&&te===0)Y=!1,ee=!0;else if(ae<Z&&Y&&me==="<")te++;else if(ae<Z&&Y&&me===">"&&te>0)te--;else if(ae===Z||me===","&&te===0)v(W,ae,C,P==="var"),W=ae+1,Y=!1,ee=!1}}else if(P==="function"||P==="class"){let Z=I+1;if(t[Z]?.text==="*")Z++;if(t[Z]&&ct.test(t[Z].text)&&t[Z].text!=="extends")C.add(t[Z].text),c.push({name:t[Z].text,token:Z})}else if(P==="import"){let Z=I+1;if(t[Z]?.text==="*"&&t[Z+1]?.text==="as")Z+=2;let W=t[Z]?.text;if(W&&ct.test(W)&&W!=="type"&&t[Z+1]?.text!=="("&&t[Z+1]?.text!==".")C.add(W),c.push({name:W,token:Z,file:!0});let Y=t[Z]?.text==="{"?Z:t[Z+1]?.text===","&&t[Z+2]?.text==="{"?Z+2:-1;if(Y!==-1&&o.has(Y)){let ee=o.get(Y);for(let[te,ae]of h(Y+1,ee)){let me=ae-1;while(me>=te&&!ct.test(t[me].text))me--;if(me>=te&&t[me].text!=="type")c.push({name:t[me].text,token:me,file:!0})}}}}return kr=e,Tn={code:i,scopes:O,loops:N,declarations:C,sites:c,tokens:t,pairs:o},Tn}function fs(e){let i=rs(e);return{code:i.code,shadows:(t,o)=>i.scopes.some((a)=>o>=a.start&&o<a.end&&a.names.has(t))}}function An(e){return new Set(rs(e).declarations)}function on(e,i){let{scopes:t,loops:o,sites:a,tokens:h,pairs:c}=rs(e),v=Array.from({length:h.length},()=>-1),E=[];for(let N=0;N<h.length;N++){v[N]=E.length?E[E.length-1]:-1;let I=h[N].text;if(I==="{"&&c.has(N))E.push(N);else if(I==="}"&&E.length&&c.get(N)===E[E.length-1])E.pop()}let R=new Set,C=new Map;for(let N of a){if(!i.has(N.name))continue;R.add(N.token);let I=N.file?-1:v[N.token],P=I===-1?[0,Number.POSITIVE_INFINITY]:[h[I].start,h[c.get(I)].end];if(N.functionScoped){let Z=h[N.token].start,W=t.filter((Y)=>Y.functionBody&&Z>=Y.bodyStart&&Z<Y.end).sort((Y,ee)=>Y.end-Y.bodyStart-(ee.end-ee.bodyStart))[0];P=W?[W.bodyStart,W.end]:[0,Number.POSITIVE_INFINITY]}else if(!N.file){let Z=o.filter((W)=>N.token>W.headStart&&N.token<W.headEnd).sort((W,Y)=>W.headEnd-W.headStart-(Y.headEnd-Y.headStart))[0];if(Z)P=[Z.start,Z.end]}let q=C.get(N.name);if(q)q.push(P);else C.set(N.name,[P])}let O=new Set;for(let N=0;N<h.length;N++){if(h[N].text!=="import"||h[N-1]?.text===".")continue;let I=N+1;if(h[I]?.text==="type")I++;if(h[I]&&ct.test(h[I].text)&&h[I+1]?.text===",")I+=2;if(h[I]?.text==="{"&&c.has(I))for(let P=I+1;P<c.get(I);P++)O.add(P)}let M=new Set;for(let N=0;N<h.length;N++){let I=h[N].text;if(!i.has(I)||M.has(I)||R.has(N)||O.has(N))continue;let P=h[N-1]?.text;if(P==="#"||P==="."&&h[N-2]?.text!=="..")continue;if(h[N+1]?.text===":"&&(P==="{"||P===","))continue;let q=h[N].start;if(C.get(I)?.some(([Z,W])=>q>=Z&&q<W))continue;if(t.some((Z)=>q>=Z.start&&q<Z.end&&Z.names.has(I)))continue;M.add(I)}return M}var Ae="0.2.678";var Tr=Symbol.for(`stx.lazy-module-promises.${Ae}`);function So(){let e=globalThis;return e[Tr]??=new Map,e[Tr]}function s(e,i){let t=So(),o=`${import.meta.url}\x00${e}`,a=t.get(o);if(a)return a;let h=i();return t.set(o,h),h.catch(()=>{if(t.get(o)===h)t.delete(o)}),h}var vo=/<\/(script)/gi;function an(e){if(!e||e.indexOf("</")===-1)return e;return e.replace(vo,"<\\/$1")}import Or from"fs";class B{cache=new Map;maxSize;options;sizes;bytes=0;constructor(e=100,i){this.maxSize=e,this.options=i??null,this.sizes=i?new Map:null}get byteSize(){return this.bytes}setMaxBytes(e){if(!this.options)return;this.options={...this.options,maxBytes:e};while(this.bytes>e&&this.cache.size>0){let i=this.cache.keys().next().value;if(i===void 0)break;this.delete(i)}}get(e){if(!this.cache.has(e))return;let i=this.cache.get(e);return this.cache.delete(e),this.cache.set(e,i),i}set(e,i){if(this.cache.has(e))this.delete(e);let t=this.options?this.options.sizeOf(i):0;if(this.options&&t>this.options.maxBytes)return;while(this.cache.size>0&&(this.cache.size>=this.maxSize||this.options!==null&&this.bytes+t>this.options.maxBytes)){let o=this.cache.keys().next().value;if(o===void 0)break;this.delete(o)}if(this.cache.set(e,i),this.sizes)this.sizes.set(e,t),this.bytes+=t}has(e){return this.cache.has(e)}delete(e){if(this.sizes){let i=this.sizes.get(e);if(i!==void 0)this.bytes-=i,this.sizes.delete(e)}return this.cache.delete(e)}clear(){this.cache.clear(),this.sizes?.clear(),this.bytes=0}get size(){return this.cache.size}keys(){return this.cache.keys()}values(){return this.cache.values()}}var St=new Map,ko=500;function Tt(e,i){if(i?.includes("g"))return new RegExp(e,i);let t=`${e}:${i||""}`;if(!St.has(t)){if(St.size>=ko){let o=St.keys().next().value;if(o)St.delete(o)}St.set(t,new RegExp(e,i))}return St.get(t)}class Ar{pool=[];maxPoolSize=10;fnCache=new Map;fnCacheMaxSize=200;getEvaluator(e){let i=Array.from(new Set(e)),t=i.sort().join(","),o=this.pool.find((v)=>v.context.join(",")===t);if(o)return o.func;let a=this.fnCache,h=this.fnCacheMaxSize,c=(...v)=>(E)=>{try{let R=`${t}:${E}`,C=a.get(R);if(!C){if(a.size>=h){let O=a.keys().next().value;if(O)a.delete(O)}C=Function(...i,`
115
+ `+a.slice(c);else a+=h;return a}function Er(e,i){let t=new Set;for(let o of e.split(",")){let a=o.trim().replace(/^\.\.\./,"").trim();if(!a)continue;if(i){let h=a.lastIndexOf(":");if(h!==-1)a=a.slice(h+1).trim()}if(a=a.split("=")[0].trim(),/^[A-Za-z_$][\w$]*$/.test(a))t.add(a)}return t}function Et(e,i){let t=r(e),{depths:o,balanced:a}=fe(t),h=(v)=>!a||o[v]===0,c=new RegExp(`(?:^|[^\\w$.])((?:const|let|var|function|class)\\s+${i}\\b)`,"g");for(let v of t.matchAll(c)){let E=(v.index??0)+v[0].length-v[1].length;if(h(E))return!0}for(let v of t.matchAll(/(?:const|let|var)\s*\{([^}]*)\}/g))if(h(v.index??0)&&Er(v[1],!0).has(i))return!0;for(let v of t.matchAll(/(?:const|let|var)\s*\[([^\]]*)\]/g))if(h(v.index??0)&&Er(v[1],!1).has(i))return!0;return!1}var kr="",Tn,ct=/^[A-Za-z_$][\w$]*$/,bo=new Set(["if","for","while","switch","with"]),Rr=["(","[","{"],Cr=[")","]","}"],yo=new Set(["const","let","var","return","if","for","while","do","switch","try","throw","export"]);function _o(e){let i=r(e),t=[];for(let o of i.matchAll(/[A-Za-z_$][\w$]*|=>|\.\.\.|[^\s]/g)){let a=o.index??0;t.push({text:o[0],start:a,end:a+o[0].length})}return{code:i,tokens:t}}function rs(e){if(Tn&&e===kr)return Tn;let{code:i,tokens:t}=_o(e),o=new Map,a=[];for(let I=0;I<t.length;I++){let P=t[I].text;if(["(","[","{"].includes(P))a.push(I);else if([")","]","}"].includes(P)){let q=a.at(-1);if(q!==void 0&&["()","[]","{}"].includes(t[q].text+P))a.pop(),o.set(q,I),o.set(I,q)}}function h(I,P){let q=[],Z=I;for(let W=I;W<P;W++){if(["(","[","{"].includes(t[W].text)&&(o.get(W)??P)<P){W=o.get(W);continue}if(t[W].text===",")q.push([Z,W]),Z=W+1}return q.push([Z,P]),q}let c=[];function v(I,P,q,Z=!1){if(t[I]?.text==="...")I++;if(I>=P)return;let W=t[I].text;if(ct.test(W)){if(q.add(W),q===C)c.push({name:W,token:I,functionScoped:Z});return}if(W!=="{"&&W!=="[")return;let Y=o.get(I);if(Y===void 0||Y>=P)return;for(let[ee,te]of h(I+1,Y)){let ae=ee;if(W==="{")for(let me=ee;me<te;me++){if(t[me].text===":"){ae=me+1;break}if(t[me].text==="=")break;if(["(","[","{"].includes(t[me].text)&&o.has(me))me=o.get(me)}v(ae,te,q,Z)}}function E(I,P){let q=new Set;for(let[Z,W]of h(I,P))v(Z,W,q);return q}function R(I){let P=I;for(;P<t.length;P++){let q=t[P].text;if(["(","[","{"].includes(q)&&o.has(P)){P=o.get(P);continue}if([",",";",")","]","}"].includes(q))break}return t[Math.max(I,P-1)]?.end??i.length}let C=new Set,O=[];for(let I=0;I<t.length;I++)if(t[I].text==="=>"){let P=I-1,q=P,Z;if(t[P]?.text===")"&&o.has(P))q=o.get(P),Z=E(q+1,P);else if(t[P]&&ct.test(t[P].text))Z=new Set([t[P].text]);else continue;let W=I+1,Y=t[W]?.text==="{"&&o.has(W)?t[o.get(W)].end:R(W);O.push({start:t[q].start,end:Y,bodyStart:t[W]?.start??Y,functionBody:!0,names:Z})}else if(t[I].text==="("&&o.has(I)){let P=t[I-1]?.text;if(!P||bo.has(P)||!ct.test(P)&&P!=="*"&&P!=="]")continue;let q=o.get(I),Z=q+1;if(t[Z]?.text===":"){Z++;while(Z<t.length&&!["{","=>",";","="].includes(t[Z].text))Z++}if(t[Z]?.text!=="{"||!o.has(Z))continue;O.push({start:t[I].start,end:t[o.get(Z)].end,bodyStart:t[Z].start,functionBody:P!=="catch",names:E(I+1,q)})}function M(I){let P=I;for(;P<t.length;P++){let q=t[P].text;if(Rr.includes(q)&&o.has(P)){P=o.get(P);continue}if(q===";"||Cr.includes(q))break;let Z=t[P-1];if(P>I&&yo.has(q)&&Z.text!==".")break;if(P>I&&/[\n\r]/.test(i.slice(Z.end,t[P].start))&&(/^[\w$]+$/.test(Z.text)||Cr.includes(Z.text)||['"',"'","`"].includes(Z.text))&&ct.test(q)&&!["in","of","instanceof"].includes(q))break}return P}let N=[];for(let I=0;I<t.length;I++){if(t[I].text!=="for")continue;let P=t[I+1]?.text==="await"?I+2:I+1;if(t[P]?.text!=="("||!o.has(P))continue;let q=o.get(P),Z=q+1,W=t[Z]?.text==="{"&&o.has(Z)?o.get(Z):M(Z),Y=t[W]?.text===";"||t[W]?.text==="}"?t[W].end:t[Math.max(Z,W-1)]?.end??i.length;N.push({headStart:P,headEnd:q,start:t[P].start,end:Y})}for(let I=0;I<t.length;I++){let P=t[I].text,q=t[I-1]?.text;if(q==="."||t[I+1]?.text===":")continue;if(q==="as"||q==="<")continue;if(P==="const"||P==="let"||P==="var"){let Z=M(I+1),W=I+1,Y=!1,ee=!1,te=0;for(let ae=I+1;ae<=Z;ae++){let me=t[ae]?.text;if(ae<Z&&Rr.includes(me)&&o.has(ae)&&o.get(ae)<Z){ae=o.get(ae);continue}if(ae<Z&&me===":"&&!ee)Y=!0;else if(ae<Z&&me==="="&&te===0)Y=!1,ee=!0;else if(ae<Z&&Y&&me==="<")te++;else if(ae<Z&&Y&&me===">"&&te>0)te--;else if(ae===Z||me===","&&te===0)v(W,ae,C,P==="var"),W=ae+1,Y=!1,ee=!1}}else if(P==="function"||P==="class"){let Z=I+1;if(t[Z]?.text==="*")Z++;if(t[Z]&&ct.test(t[Z].text)&&t[Z].text!=="extends")C.add(t[Z].text),c.push({name:t[Z].text,token:Z})}else if(P==="import"){let Z=I+1;if(t[Z]?.text==="*"&&t[Z+1]?.text==="as")Z+=2;let W=t[Z]?.text;if(W&&ct.test(W)&&W!=="type"&&t[Z+1]?.text!=="("&&t[Z+1]?.text!==".")C.add(W),c.push({name:W,token:Z,file:!0});let Y=t[Z]?.text==="{"?Z:t[Z+1]?.text===","&&t[Z+2]?.text==="{"?Z+2:-1;if(Y!==-1&&o.has(Y)){let ee=o.get(Y);for(let[te,ae]of h(Y+1,ee)){let me=ae-1;while(me>=te&&!ct.test(t[me].text))me--;if(me>=te&&t[me].text!=="type")c.push({name:t[me].text,token:me,file:!0})}}}}return kr=e,Tn={code:i,scopes:O,loops:N,declarations:C,sites:c,tokens:t,pairs:o},Tn}function fs(e){let i=rs(e);return{code:i.code,shadows:(t,o)=>i.scopes.some((a)=>o>=a.start&&o<a.end&&a.names.has(t))}}function An(e){return new Set(rs(e).declarations)}function on(e,i){let{scopes:t,loops:o,sites:a,tokens:h,pairs:c}=rs(e),v=Array.from({length:h.length},()=>-1),E=[];for(let N=0;N<h.length;N++){v[N]=E.length?E[E.length-1]:-1;let I=h[N].text;if(I==="{"&&c.has(N))E.push(N);else if(I==="}"&&E.length&&c.get(N)===E[E.length-1])E.pop()}let R=new Set,C=new Map;for(let N of a){if(!i.has(N.name))continue;R.add(N.token);let I=N.file?-1:v[N.token],P=I===-1?[0,Number.POSITIVE_INFINITY]:[h[I].start,h[c.get(I)].end];if(N.functionScoped){let Z=h[N.token].start,W=t.filter((Y)=>Y.functionBody&&Z>=Y.bodyStart&&Z<Y.end).sort((Y,ee)=>Y.end-Y.bodyStart-(ee.end-ee.bodyStart))[0];P=W?[W.bodyStart,W.end]:[0,Number.POSITIVE_INFINITY]}else if(!N.file){let Z=o.filter((W)=>N.token>W.headStart&&N.token<W.headEnd).sort((W,Y)=>W.headEnd-W.headStart-(Y.headEnd-Y.headStart))[0];if(Z)P=[Z.start,Z.end]}let q=C.get(N.name);if(q)q.push(P);else C.set(N.name,[P])}let O=new Set;for(let N=0;N<h.length;N++){if(h[N].text!=="import"||h[N-1]?.text===".")continue;let I=N+1;if(h[I]?.text==="type")I++;if(h[I]&&ct.test(h[I].text)&&h[I+1]?.text===",")I+=2;if(h[I]?.text==="{"&&c.has(I))for(let P=I+1;P<c.get(I);P++)O.add(P)}let M=new Set;for(let N=0;N<h.length;N++){let I=h[N].text;if(!i.has(I)||M.has(I)||R.has(N)||O.has(N))continue;let P=h[N-1]?.text;if(P==="#"||P==="."&&h[N-2]?.text!=="..")continue;if(h[N+1]?.text===":"&&(P==="{"||P===","))continue;let q=h[N].start;if(C.get(I)?.some(([Z,W])=>q>=Z&&q<W))continue;if(t.some((Z)=>q>=Z.start&&q<Z.end&&Z.names.has(I)))continue;M.add(I)}return M}var Ae="0.2.679";var Tr=Symbol.for(`stx.lazy-module-promises.${Ae}`);function So(){let e=globalThis;return e[Tr]??=new Map,e[Tr]}function s(e,i){let t=So(),o=`${import.meta.url}\x00${e}`,a=t.get(o);if(a)return a;let h=i();return t.set(o,h),h.catch(()=>{if(t.get(o)===h)t.delete(o)}),h}var vo=/<\/(script)/gi;function an(e){if(!e||e.indexOf("</")===-1)return e;return e.replace(vo,"<\\/$1")}import Or from"fs";class B{cache=new Map;maxSize;options;sizes;bytes=0;constructor(e=100,i){this.maxSize=e,this.options=i??null,this.sizes=i?new Map:null}get byteSize(){return this.bytes}setMaxBytes(e){if(!this.options)return;this.options={...this.options,maxBytes:e};while(this.bytes>e&&this.cache.size>0){let i=this.cache.keys().next().value;if(i===void 0)break;this.delete(i)}}get(e){if(!this.cache.has(e))return;let i=this.cache.get(e);return this.cache.delete(e),this.cache.set(e,i),i}set(e,i){if(this.cache.has(e))this.delete(e);let t=this.options?this.options.sizeOf(i):0;if(this.options&&t>this.options.maxBytes)return;while(this.cache.size>0&&(this.cache.size>=this.maxSize||this.options!==null&&this.bytes+t>this.options.maxBytes)){let o=this.cache.keys().next().value;if(o===void 0)break;this.delete(o)}if(this.cache.set(e,i),this.sizes)this.sizes.set(e,t),this.bytes+=t}has(e){return this.cache.has(e)}delete(e){if(this.sizes){let i=this.sizes.get(e);if(i!==void 0)this.bytes-=i,this.sizes.delete(e)}return this.cache.delete(e)}clear(){this.cache.clear(),this.sizes?.clear(),this.bytes=0}get size(){return this.cache.size}keys(){return this.cache.keys()}values(){return this.cache.values()}}var St=new Map,ko=500;function Tt(e,i){if(i?.includes("g"))return new RegExp(e,i);let t=`${e}:${i||""}`;if(!St.has(t)){if(St.size>=ko){let o=St.keys().next().value;if(o)St.delete(o)}St.set(t,new RegExp(e,i))}return St.get(t)}class Ar{pool=[];maxPoolSize=10;fnCache=new Map;fnCacheMaxSize=200;getEvaluator(e){let i=Array.from(new Set(e)),t=i.sort().join(","),o=this.pool.find((v)=>v.context.join(",")===t);if(o)return o.func;let a=this.fnCache,h=this.fnCacheMaxSize,c=(...v)=>(E)=>{try{let R=`${t}:${E}`,C=a.get(R);if(!C){if(a.size>=h){let O=a.keys().next().value;if(O)a.delete(O)}C=Function(...i,`
116
116
  'use strict';
117
117
  try {
118
118
  return ${E};
@@ -193,7 +193,7 @@ else {
193
193
  // STX: auto-generated event bindings
194
194
  ${e.map((t,o)=>oa(t,o)).join(`
195
195
  `)}`}function Nr(e){let i=[],t=new Set,o=e.replace(/^\s*import\s+.*$/gm,""),a=0,h=o.length,c=0;while(c<h){let v=o[c];if(v==="'"||v==='"'||v==="`"){let E=v;if(c++,E==="`"){let R=0;while(c<h){if(o[c]==="\\"){c+=2;continue}if(o[c]==="`"&&R===0){c++;break}if(o[c]==="$"&&o[c+1]==="{"){R++,c+=2;continue}if(o[c]==="}"&&R>0){R--,c++;continue}c++}}else while(c<h){if(o[c]==="\\"){c+=2;continue}if(o[c]===E){c++;break}c++}continue}if(v==="/"&&o[c+1]==="/"){while(c<h&&o[c]!==`
196
- `)c++;continue}if(v==="/"&&o[c+1]==="*"){c+=2;while(c<h-1&&!(o[c]==="*"&&o[c+1]==="/"))c++;c+=2;continue}if(v==="{"){a++,c++;continue}if(v==="}"){a--,c++;continue}if(a===0){let E=o.slice(c),R=E.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(R){let M=R[1];if(!M.startsWith("_")&&!t.has(M))i.push(M),t.add(M);c+=R[0].length;continue}let C=E.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(C){C[1].split(",").forEach((M)=>{let N=M.trim(),I=N.indexOf(":"),P=I>=0?N.slice(I+1).trim().split(/[\s=]/)[0]:N.split(/[\s=]/)[0];if(P&&!P.startsWith("_")&&!t.has(P))i.push(P),t.add(P)}),c+=C[0].length;continue}let O=E.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(O){let M=O[1];if(!M.startsWith("_")&&!t.has(M))i.push(M),t.add(M);c+=O[0].length;continue}}c++}return i}var ca=new Set(["if","else","true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","switch","case","break","continue","for","while","do","try","catch","finally","const","let","var","function","class","import","export","default","async","await","yield","with","debugger","console","window","document","Math","JSON","Date","Array","Object","String","Number","Boolean","Symbol","Map","Set","Promise","Error","parseInt","parseFloat","isNaN","isFinite","encodeURIComponent","decodeURIComponent","setTimeout","setInterval","clearTimeout","clearInterval","fetch","alert","confirm","prompt","event"]);function la(e){let i=new Set,t=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function o(M){let N;while((N=t.exec(M))!==null){let I=N[0];if(!ca.has(I))i.add(I)}}let a=/\{\{([\s\S]*?)\}\}/g,h;while((h=a.exec(e))!==null)o(h[1]);let c=/:[a-z][\w.-]*\s*=\s*"([^"]*)"/gi;while((h=c.exec(e))!==null)o(h[1]);let v=/:[a-z][\w.-]*\s*=\s*'([^']*)'/gi;while((h=v.exec(e))!==null)o(h[1]);let E=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((h=E.exec(e))!==null)o(h[1]);let R=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((h=R.exec(e))!==null)o(h[1]);let C=/@model\s*=\s*["']([^"']*)["']/gi;while((h=C.exec(e))!==null)o(h[1]);let O=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((h=O.exec(e))!==null)o(h[1]);return i}async function De(e,i={}){let t=e,o="",a=!1,h=[],c=Do(t,{filePath:i.filePath,projectRoot:i.projectRoot});t=c.code;let v=Mo(c.styles),E=It(t);t=E.code,h=[...E.imports,...E.models];let{hasUserImports:R,bundleClientScript:C}=await s("stx/client-script-bundler",()=>import("./chunk-hbsnj1db.js"));if(R(t))t=await C(t,i.filePath||"",{projectRoot:i.projectRoot,minify:i.production}),a=!0;if(i.autoImports!==!1){let Y=Ka(t);t=Y.code,o=Ga(Y.stxImports,Y.browserImports.filter((ee)=>!h.includes(ee)))}if(o=`${fn(t,i.serverData)}${o}`,t=T(t),!a&&Me(i.attrs||""))t=Le(t);let O=aa(i.eventBindings||[]),M=(i.attrs||"").trim(),N=/\btype\s*=\s*["']module["']/i.test(M),I=i.instanceId?` data-stx-instance="${i.instanceId}"`:"";if(N){let Y=M.replace(/\btype\s*=\s*["']module["']/i,"").trim(),ee=`type="module" data-stx-scoped${I}${Y?` ${Y}`:""}`;return`${v}<script ${ee}>
196
+ `)c++;continue}if(v==="/"&&o[c+1]==="*"){c+=2;while(c<h-1&&!(o[c]==="*"&&o[c+1]==="/"))c++;c+=2;continue}if(v==="{"){a++,c++;continue}if(v==="}"){a--,c++;continue}if(a===0){let E=o.slice(c),R=E.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(R){let M=R[1];if(!M.startsWith("_")&&!t.has(M))i.push(M),t.add(M);c+=R[0].length;continue}let C=E.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(C){C[1].split(",").forEach((M)=>{let N=M.trim(),I=N.indexOf(":"),P=I>=0?N.slice(I+1).trim().split(/[\s=]/)[0]:N.split(/[\s=]/)[0];if(P&&!P.startsWith("_")&&!t.has(P))i.push(P),t.add(P)}),c+=C[0].length;continue}let O=E.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(O){let M=O[1];if(!M.startsWith("_")&&!t.has(M))i.push(M),t.add(M);c+=O[0].length;continue}}c++}return i}var ca=new Set(["if","else","true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","switch","case","break","continue","for","while","do","try","catch","finally","const","let","var","function","class","import","export","default","async","await","yield","with","debugger","console","window","document","Math","JSON","Date","Array","Object","String","Number","Boolean","Symbol","Map","Set","Promise","Error","parseInt","parseFloat","isNaN","isFinite","encodeURIComponent","decodeURIComponent","setTimeout","setInterval","clearTimeout","clearInterval","fetch","alert","confirm","prompt","event"]);function la(e){let i=new Set,t=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function o(M){let N;while((N=t.exec(M))!==null){let I=N[0];if(!ca.has(I))i.add(I)}}let a=/\{\{([\s\S]*?)\}\}/g,h;while((h=a.exec(e))!==null)o(h[1]);let c=/:[a-z][\w.-]*\s*=\s*"([^"]*)"/gi;while((h=c.exec(e))!==null)o(h[1]);let v=/:[a-z][\w.-]*\s*=\s*'([^']*)'/gi;while((h=v.exec(e))!==null)o(h[1]);let E=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((h=E.exec(e))!==null)o(h[1]);let R=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((h=R.exec(e))!==null)o(h[1]);let C=/@model\s*=\s*["']([^"']*)["']/gi;while((h=C.exec(e))!==null)o(h[1]);let O=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((h=O.exec(e))!==null)o(h[1]);return i}async function De(e,i={}){let t=e,o="",a=!1,h=[],c=Do(t,{filePath:i.filePath,projectRoot:i.projectRoot});t=c.code;let v=Mo(c.styles),E=It(t);t=E.code,h=[...E.imports,...E.models];let{hasUserImports:R,bundleClientScript:C}=await s("stx/client-script-bundler",()=>import("./chunk-t3gmm1ja.js"));if(R(t))t=await C(t,i.filePath||"",{projectRoot:i.projectRoot,minify:i.production}),a=!0;if(i.autoImports!==!1){let Y=Ka(t);t=Y.code,o=Ga(Y.stxImports,Y.browserImports.filter((ee)=>!h.includes(ee)))}if(o=`${fn(t,i.serverData)}${o}`,t=T(t),!a&&Me(i.attrs||""))t=Le(t);let O=aa(i.eventBindings||[]),M=(i.attrs||"").trim(),N=/\btype\s*=\s*["']module["']/i.test(M),I=i.instanceId?` data-stx-instance="${i.instanceId}"`:"";if(N){let Y=M.replace(/\btype\s*=\s*["']module["']/i,"").trim(),ee=`type="module" data-stx-scoped${I}${Y?` ${Y}`:""}`;return`${v}<script ${ee}>
197
197
  ${an(`${o}${t}
198
198
  ${O}`)}
199
199
  </script>`}let P=Jo(e),q=/function __stx_setup_/.test(t),Z=/\bstx\.mount\s*\(|\bstx\.mountEl\s*\(/.test(e);function W(Y){let ee=Y.length>0?`
@@ -286,8 +286,8 @@ ${R.join(`
286
286
  `)a++;return!0}if(e[a]==="/"&&e[a+1]==="*"){a+=2;while(a<h-1&&!(e[a]==="*"&&e[a+1]==="/"))a++;return a+=2,!0}return!1},R=()=>{if(o!==0)return;let C=e.slice(a).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(C){let I=C[2].split(",").map((P)=>{let q=P.trim().split(":");return q[q.length-1].trim()});for(let P of I)if(P&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(P)&&!t.has(P))i.push(P),t.add(P);return}let O=e.slice(a).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(O){let I=O[2];if(!t.has(I))i.push(I),t.add(I);return}let M=e.slice(a).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(M){let I=M[1];if(!t.has(I))i.push(I),t.add(I);return}let N=e.slice(a).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(N){let I=N[1];if(!t.has(I))i.push(I),t.add(I)}};while(a<h){if(E())continue;if(e[a]==="'"||e[a]==='"'){c(e[a]);continue}if(e[a]==="`"){v();continue}if(e[a]==="{"){o++,a++;continue}if(e[a]==="}"){o--,a++;continue}if(o===0&&/[a-z]/i.test(e[a])&&(a===0||/\s|[;{}()]/.test(e[a-1])))R();a++}return i}function ml(e){let i=[],t=0,o=0,a=null;for(let h=0;h<e.length;h++){let c=e[h];if(a){if(c==="\\"){h++;continue}if(c===a)a=null;continue}if(c==='"'||c==="'"||c==="`"){a=c;continue}if(c==="("||c==="["||c==="{")t++;else if(c===")"||c==="]"||c==="}")t--;else if(c===","&&t===0)i.push(e.slice(o,h)),o=h+1}if(o<e.length)i.push(e.slice(o));return i}function hl(e){let i=0,t=null;for(let o=0;o<e.length;o++){let a=e[o];if(t){if(a==="\\"){o++;continue}if(a===t)t=null;continue}if(a==='"'||a==="'"||a==="`"){t=a;continue}if(a==="("||a==="["||a==="{")i++;else if(a===")"||a==="]"||a==="}")i--;else if(a==="="&&i===0){let h=e[o-1],c=e[o+1];if(h==="!"||h==="<"||h===">"||h==="=")continue;if(c==="="||c===">")continue;return o}}return-1}function xl(e,i){try{let t=/=\s*(?:withDefaults\s*\([\s\S]*?defineProps|defineProps)\b/.exec(e);if(!t)return;let o=t.index-1;while(o>=0&&/\s/.test(e[o]))o--;if(e[o]!=="}")return;let a=o,h=0,c=-1;for(;o>=0;o--){let E=e[o];if(E==="}")h++;else if(E==="{"){if(h--,h===0){c=o;break}}}if(c===-1)return;let v=e.slice(c+1,a);for(let E of ml(v)){let R=E.trim();if(!R||R.startsWith("..."))continue;let C=hl(R);if(C===-1)continue;let O=R.slice(0,C).trim();if(!/^[A-Z_$][\w$]*$/i.test(O))continue;if(i[O]!==void 0)continue;let M=R.slice(C+1).trim();if(!M)continue;try{let N=Object.keys(i).filter(Dt),I=Function(...N,`"use strict"; return (${M});`);i[O]=I(...N.map((P)=>i[P]))}catch{}}}catch{}}var bl=new Set(["tr","td","th","thead","tbody","tfoot","caption","colgroup","col","option","optgroup","li","dt","dd","span"]);function su(e,i){let t=e.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)<([a-zA-Z][a-zA-Z0-9-]*)/s);if(!t)return null;let o=t[2].toLowerCase();if(!bl.has(o))return null;let a=new RegExp(`<\\/?${o}(?=[\\s/>])(?:[^>"']|"[^"]*"|'[^']*')*>`,"iy"),h=se(e,(R,C)=>(a.lastIndex=C,a.exec(R)?.index===C?a.lastIndex:-1));if(o==="span"&&/\sdata-stx-scope\s*=/.test(h[0]?.token||""))return null;let c=0,v=!1;for(let R of h){if(c+=R.token.startsWith("</")?-1:1,c<0)return null;if(c===0){if(e.slice(R.end).trim())return null;v=!0;break}}if(!v)return null;let E=t[0].length;return e.slice(0,E)+i+e.slice(E)}async function pr(e,i,t,o,a){let h=e.endsWith(".stx")?e.slice(0,-4):e,c=(te)=>te.split("-").map((ae)=>ae.charAt(0).toUpperCase()+ae.slice(1)).join(""),v=t.__importedComponents;if(v){for(let te of[h,h.toLowerCase(),c(h),j(h)])if(v.has(te))return!0}let E=[...new Set([`${h}.stx`,`${c(h)}.stx`,`${j(h)}.stx`])],R=typeof a.root==="string"?le.resolve(a.root):void 0,C=R??le.dirname(o),O=[],M=(te)=>{if(te&&!O.includes(te))O.push(te)},N=t.__originalFilePath;if(N)M(le.join(le.dirname(N),"components"));M(i),M(a._rootComponentsDir),M(le.join(le.dirname(o),"components")),M(a.componentsDir);let I=a._targetComponentFallbackNames?.some((te)=>te.toLowerCase()===h.toLowerCase());if(!I)for(let te of a._targetComponentDirs??[])M(te);if(R)M(le.resolve(R,"resources/views/components")),M(le.resolve(R,"resources/components")),M(le.resolve(R,"src/components")),M(le.resolve(R,"components"));for(let te of a._layerComponentDirs??[])M(te);let P=a._pluginComponentDirs;if(Array.isArray(P))for(let te of P)M(typeof te==="string"?te:null);if(M(a.fallbackComponentsDir),I)for(let te of a._targetComponentDirs??[])M(te);if(h.startsWith("./")||h.startsWith("../"))return n(le.resolve(le.dirname(o),`${h}.stx`));let q=Wi(le.resolve(import.meta.dir,"components")),Z=O.map((te)=>le.isAbsolute(te)?te:le.resolve(C,te)),W=`${E.join("\x00")}\x00\x00${Z.join("\x00")}`,Y=Us.get(W);if(Y!==void 0)return Y;let ee=!1;e:for(let te of Z){if(Wi(te)===q)continue;for(let ae of E)if(await n(le.join(te,ae))){ee=!0;break e}}return Us.set(W,ee),ee}function Wi(e){let i=Hs.get(e);if(i!==void 0)return i;let t=e;try{t=qs.realpathSync(e)}catch{}return Hs.set(e,t),t}function ou(e){return e==="visible"||e==="idle"||e==="interaction"||e.startsWith("media:")}function Xa(e){if(!e)return!1;let i=e.replace(/<script[\s\S]*?<\/script>/gi,"").replace(/<style[\s\S]*?<\/style>/gi,"");return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(i)}function yl(e,i,t){if(!e.includes("{{")&&!e.includes("{!!"))return e;let o=(a,h)=>{let c;try{c=_(a,i)}catch{return h}if(c===void 0||c===null)return"";let v=String(c);if(/<\/style/i.test(v))return console.warn(`[stx] a <style> expression in ${t??"<unknown>"} evaluated to CSS containing a closing style tag, which would end the element early, so it was dropped rather than emitted.`),"";return v};return e.replace(/\{!!([\s\S]*?)!!\}/g,(a,h)=>o(h,a)).replace(/\{\{([\s\S]*?)\}\}/g,(a,h)=>o(h,a))}var Fi=new Set;function Vi(e,i,t,o){let a=`${e}\x00${i}\x00${o??""}`;if(!process.env.STX_DEBUG&&Fi.has(a))return;Fi.add(a);let h=i?` used in ${i}`:"",c=o?` Cause: ${o}.`:"",v=t.length>0?`
287
287
  searched:
288
288
  ${t.map((E)=>` - ${E}`).join(`
289
- `)}`:"";console.error(`[stx] component <${e}> could not be resolved${h}, so it rendered as nothing.${c}${v}`)}function Ui(e){return`<!-- stx: component "${e.replace(/--+/g,"-")}" could not be resolved; see the server log -->`}function jo(e){let i=new Set,t=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal|useModel|useReactiveProp|useLocalStorage|useSessionStorage|keptState|useCookie|useDebouncedValue)\s*(?:<[^>]*>)?\s*\(/g;for(let o of e){let a;while((a=t.exec(o))!==null)i.add(a[1]);t.lastIndex=0}return[...i]}async function je(e,i,t,o,a,h,c,v=new Set,E,R=et(a),C,O=e){let{extractVariables:M}=await s("stx/variable-extractor",()=>import("./chunk-9e3w8am7.js")),N=v??new Set;if(N.has(e))return`[Circular component reference: ${e}]`;let I=new Set(N);I.add(e);let P=typeof i.client==="string"?i.client.trim():"";if("client"in i)delete i.client;let q=P&&P!=="load"&&ou(P)?P:"";try{let Z=(ce)=>ce.split("-").map((ie)=>ie.charAt(0).toUpperCase()+ie.slice(1)).join(""),W=O.endsWith(".stx")?O.slice(0,-4):O,Y=null,ee=a.__importedComponents;if(ee){let ce=[W,W.toLowerCase(),Z(W),j(W)];for(let ie of ce)if(ee.has(ie)){Y=ee.get(ie);break}}let te=[];if(!Y){let ce=[`${W}.stx`,`${Z(W)}.stx`,`${j(W)}.stx`],ie=[...new Set(ce)],he=a.__originalFilePath,xe=[];if(xe.push(...c._layerComponentDirs??[]),he){let _e=le.join(le.dirname(he),"components");xe.push(_e)}if(o)xe.push(o);let Ke=c._rootComponentsDir;if(typeof Ke==="string"&&!xe.includes(Ke))xe.push(Ke);let We=le.join(le.dirname(h),"components");if(!xe.includes(We))xe.push(We);if(c.componentsDir&&c.componentsDir!==o&&!xe.includes(c.componentsDir))xe.push(c.componentsDir);let it=c._nativeHostAttrs&&/^(?:checkbox|switch)$/i.test(W),ot=(C?.events??[]).map((_e)=>_e.replace(/^@/,"").split(".")[0].toLowerCase().replace(/-/g,"")),at=Object.hasOwn(i,"checked")||Boolean(C?.reactiveProps?.includes("checked")),bt=Object.hasOwn(i,"value")||Boolean(C?.reactiveProps?.includes("value")),_n=!ot.includes("valuechange")&&(at||ot.includes("change")&&!bt),Gn=c._nativeHostAttrs&&/^textinput$/i.test(W),yt=ot.includes("update:value")&&!ot.includes("input"),Ut=c._nativeHostAttrs&&/^video$/i.test(W),wn=Object.hasOwn(i,"src")||Boolean(C?.reactiveProps?.includes("src")),Sn=Object.hasOwn(i,"source")||Boolean(C?.reactiveProps?.includes("source")),$n=Ut&&wn&&!Sn&&(C?.events??[]).every((_e)=>/^(?:play|pause|ended|timeupdate|loadedmetadata|loadstart|error)$/.test(_e.replace(/^@/,"").split(".")[0])),Ht=c._targetComponentFallbackNames?.some((_e)=>_e.toLowerCase()===W.toLowerCase())&&(!it||_n)&&(!Gn||yt)&&(!Ut||$n);for(let _e of Ht?[]:c._targetComponentDirs??[])if(_e&&!xe.includes(_e))xe.push(_e);let _t=typeof c.root==="string"?le.resolve(c.root):void 0,oo=_t??le.dirname(h),wt=[];if(_t)wt.push(le.resolve(_t,"resources/views/components")),wt.push(le.resolve(_t,"resources/components")),wt.push(le.resolve(_t,"src/components")),wt.push(le.resolve(_t,"components"));wt.push(le.resolve(import.meta.dir,"components"));for(let _e of wt)if(!xe.includes(_e))xe.push(_e);let tr=c._pluginComponentDirs;if(Array.isArray(tr)){for(let _e of tr)if(typeof _e==="string"&&!xe.includes(_e))xe.push(_e)}if(c.fallbackComponentsDir&&!xe.includes(c.fallbackComponentsDir))xe.push(c.fallbackComponentsDir);if(Ht){for(let _e of c._targetComponentDirs??[])if(_e&&!xe.includes(_e))xe.push(_e)}let nr=[...new Set(xe.map((_e)=>{if(!_e)return _e;return le.isAbsolute(_e)?_e:le.resolve(oo,_e)}))];xe.length=0,xe.push(...nr);let Yn=`${W}\x00${h}\x00${nr.join("\x00")}`,Qn=Un.get(Yn);if(Qn)if(await n(Qn))Y=Qn;else Un.delete(Yn);if(!Y&&(W.startsWith("./")||W.startsWith("../")))Y=le.resolve(le.dirname(h),`${W}.stx`),te.push(Y);else if(!Y)for(let _e of xe){if(!_e)continue;for(let vn of ie){let En=le.join(_e,vn);if(te.push(En),await n(En)){Y=En;break}}if(Y)break;if(!Y)try{let vn=await import("fs");if(!vn.statSync(_e,{throwIfNoEntry:!1})?.isDirectory())continue;let ao=8,es=[{path:_e,depth:0}];while(es.length>0&&!Y){let kn=es.pop();if(kn.depth>=ao)continue;let sr;try{sr=vn.readdirSync(kn.path,{withFileTypes:!0})}catch{continue}for(let Rn of sr){if(!Rn.isDirectory())continue;if(Rn.name==="node_modules"||Rn.name.startsWith("."))continue;let rr=le.join(kn.path,Rn.name);for(let co of ie){let ts=le.join(rr,co);if(te.push(ts),await n(ts)){Y=ts;break}}if(Y)break;es.push({path:rr,depth:kn.depth+1})}}}catch{}if(Y)break}if(Y)Un.set(Yn,Y)}if(!Y||!await n(Y))return Vi(e,h,te),Ui(e);E.add(Y);let ae;if(Qt.has(Y))ae=Qt.get(Y);else try{ae=await Bun.file(Y).text(),Qt.set(Y,ae)}catch(ce){let ie=ce instanceof Error?ce.message:String(ce);return Vi(e,h,[Y],ie),Ui(e)}if(C)for(let ce of new Set([...Object.keys(i),...C.reactiveProps??[]])){let ie=ce.toLowerCase();if(ie.startsWith("aria-")||ie.startsWith("data-"))continue;let he=ce.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(new RegExp(`\\b${he}\\b`).test(ae))C.declaredProps.add(ce);if(new RegExp(`\\$props\\s*(?:\\.\\s*${he}\\b|\\[\\s*['"]${he}['"]\\s*\\])`).test(ae)||new RegExp(`\\buseReactiveProp\\s*\\(\\s*['"]${he}['"]`).test(ae))C.consumedProps?.add(ce)}let me=new Set(["__originalFilePath","__importedComponents",In,"__stx_client_signal_names","__stx_client_declared_names","__stx_runtime_config","__stxServeContext","__stx_scope_seq"]),ke={};for(let[ce,ie]of Object.entries(a))if(!ce.startsWith("__")||me.has(ce))ke[ce]=ie;let Re=R.length>0?{[Bn]:[...R]}:{},Ve=t;if(t.includes("@include")){let{processIncludes:ce}=await s("stx/includes",()=>import("./chunk-2qnm4abn.js"));Ve=await ce(t,a,h,c,E)}if(/<[A-Z][\w.-]*[\s/>]/.test(Ve)){let{processComponents:ce}=await s("stx/component-renderer",()=>import("./chunk-hgpt35ht.js"));Ve=await ce(Ve,{...a,__processedComponents:N,...Re},h,c,E)}let Te=[];if(Xa(Ve)){let{processExpressions:ce}=await s("stx/expressions",()=>import("./chunk-xrrzwta9.js")),ie=a.__stx_signals_gate===void 0?{...a,__stx_signals_gate:!0,...Re}:R.length>0?{...a,...Re}:a;Ve=ce(Ve,ie,h);for(let he of Ve.matchAll(/\{\{([\s\S]*?)\}\}/g))Te.push(he[1].trim())}let Ze=K(Ve),Ye=[],mt=Ze.output.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(ce,ie)=>{let he=Ze.scripts[Number(ie)]||"",xe=he.match(/^<script\b([^>]*)>/i)?.[1]||"",Ke=xe.match(/\btype\s*=\s*["']([^"']+)["']/i)?.[1]?.toLowerCase(),We=!Ke||["module","text/javascript","application/javascript"].includes(Ke),it=/\sdata-stx-(?:owner|instance)(?=[\s=/>])/i.test(` ${xe}`);if(!/\bserver\b/i.test(xe)&&We&&!it)return Ye.push(he),"";return he}),{extractSlotContent:Zn}=await s("stx/slots",()=>import("./chunk-gm2kbxpe.js")),lt=Zn(mt),ut={};if(lt.defaultSlot?.trim())ut.default=lt.defaultSlot;for(let[ce,ie]of lt.namedSlots)ut[ce]=ie.content;let ft=a.__stx_scope_seq??={n:0,key:bs(String(a.__filename??h))},Mt=Ki(e,process.cwd()),nt=`stx_${(Mt.endsWith(".stx")?Mt.slice(0,-4):Mt).replace(/[^a-zA-Z0-9]/g,"_")}_${++ft.n}_${ft.key}`,Ue={...ke,$uid:nt,$native:c._nativeHostAttrs===!0,...i,props:i,slot:mt,$slots:ut,__processedComponents:I,__sections:{},__stx_signals_gate:we(ae)||Xa(t),__stx_preserved_client_expressions:[...Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[],...Te]};xl(ae,Ue);let jt=ae,tn=ue(jt);if(tn)jt=tn.content.trim();let qn=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,Nt=[...ae.matchAll(qn)];for(let[,ce,ie]of Nt)if(!/\bserver\b|\bsrc\s*=|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/i.test(ce))Pe(ie,Y,c.strict);let Je=[],Lt=null,Xn=Nt.some((ce)=>/\bserver\b/.test(ce[1]||"")&&/\bcache\b/.test(ce[1]||"")),ht=null,Qe=null,Bt=null,nn=0,zt=null;if(ul(c),Xn&&Ks>0){let ce=fl({props:i,slot:Ve,slotContext:t.trim()?pl(ke):void 0,buildMode:c.buildMode??"",skipEventDirectives:c.skipEventDirectives===!0,native:c._nativeHostAttrs===!0,clientLoopNames:[...R].sort(),layers:c._layerGraph?.layers.map((ie)=>ie.configFile),uid:nt});if(ce!==null){ht=`${Y}\x00${w(ae)}\x00${ce}`;let ie=Hn.get(ht);if(ie){for(let he of ie.dependencies)E.add(he);if(Fr(a,ie.clientFactories),ft.n+=ie.uidsConsumed,ie.preservedClientExpressions.length>0){let he=new Set(Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[]);for(let xe of ie.preservedClientExpressions)he.add(xe);a.__stx_preserved_client_expressions=[...he]}return ie.output}Qe=new Set(E),Bt=zr(a),nn=ft.n,zt=new Set(Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[])}}let Wt=new Set;for(let ce of Nt){let ie=ce[1]||"",he=ce[2]||"",xe=ie.includes("server");if(Me(ie)&&he.trim())he=Le(he);if(xe&&he){for(let We of Oe(he))Wt.add(We);try{await M(he,Ue,Y,{onFailure:(We)=>{if(We.kind!=="unknown")Lt=We.kind}})}catch(We){}}if(!xe){let We=he.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),it=We.includes("{{")&&We.includes("}}"),ot=We.includes("{!!")&&We.includes("!!}");if(it||ot)We=Fo(We,Ue,Y);let at=ie.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");Je.push(`<script${at}>${We}</script>`)}}let qe=K(ae).output.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),Ft=qe?qe[1]:"",Jn=qe?qe[2]:"",tt="",Q=Ft&&/\bscoped\b/i.test(Ft);if(qe)tt=`<style${Ft}>${yl(Jn,Ue,Y)}</style>`;let ne=jt;if(ne=ne.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),qe)ne=ne.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let ce=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,ie=[];if(ne=ne.replace(ce,(he,xe)=>{let Ke=xe.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(Ke)ie.push(`<style${Ke[1]}>${Ke[2]}</style>`);return""}),ne=ne.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),ie.length>0)tt=`${tt}${ie.join(`
290
- `)}`}if(t&&ne.includes("{{ text || slot }}"))ne=ne.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>t);let{applySlots:ge}=await s("stx/slots",()=>import("./chunk-gm2kbxpe.js")),{defaultSlot:ye,namedSlots:Ee}=lt,Fe=c._nativeHostAttrs===!0&&Je.length>0||Je.some((ce)=>/\b(?:state|derived|effect|ref|useRef|reactive|computed|watch|watchEffect|useModel|useReactiveProp|onMount|onDestroy|defineProps|withDefaults|defineEmits|defineExpose|defineSlots)\s*(?:<[^<>()]*>)?\s*\(/.test(ce)),pt=(ce)=>Fe?xi(ce,nt):ce,er=new Map([...Ee].map(([ce,ie])=>[ce,{...ie,content:pt(ie.content)}]));ne=await ge(ne,pt(ye),er,Ue,Fe?nt:"");let sn=jo(Je),rn=(Array.isArray(Ue.__stx_client_signal_names)?Ue.__stx_client_signal_names:[]).filter((ce)=>!Wt.has(ce));if(sn.length>0||rn.length>0)Ue.__stx_client_signal_names=[...new Set([...rn,...sn])];else delete Ue.__stx_client_signal_names;let Vt=R.filter((ce)=>!Wt.has(ce)&&!(ce in i));if(Vt.length>0)Ue[Bn]=Vt;let xn={...c,_rootComponentsDir:c._rootComponentsDir||c.componentsDir,componentsDir:le.dirname(Y),skipSignalsRuntime:!0,skipEventDirectives:c._nativeHostAttrs===!0||Fe||Je.length===0,defaultLayout:void 0};Ue.__stxProcessingDepth=(a.__stxProcessingDepth||0)+1;let{processDirectives:bn}=await s("stx/process",()=>import("./chunk-mem1tzzk.js")),rt=await bn(ne,Ue,Y,xn,E),xt=new Set(Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[]);for(let ce of rt.matchAll(/\{\{([\s\S]*?)\}\}/g))xt.add(ce[1].trim());if(xt.size>0)a.__stx_preserved_client_expressions=[...xt];let Xe=nt,He=rt;if(Fe){let ce="";if(Object.keys(i).length>0)try{ce=` data-stx-props="${Fs(JSON.stringify(i))}"`}catch{}let ie=q?` stx-hydrate="${Fs(q)}"`:"",he=Object.fromEntries(Object.entries(ut).map(([at,bt])=>[at,Boolean(bt)])),xe=Object.keys(he).length>0?` data-stx-slots="${Fs(JSON.stringify(he))}"`:"",Ke=` data-stx-scope="${Xe}"${ce}${xe}${ie}`,We=/^\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*<span(?=[\s/>])/i.test(rt),it=We?"span":"div";He=su(rt,Ke)??`<${it}${Ke} data-stx-component-wrapper${We?' style="display:contents"':""}>${rt}</${it}>`;let ot=await Promise.all(Je.map(async(at)=>{let bt=at.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!bt)return at;let[,_n,Gn]=bt,yt=await Sl(Gn,Y,c.buildMode==="compile"),Ut=fn(yt.clientCode,Ne(Ue)),{vendorStyleTags:wn}=yt,Sn=Ut?`function(__scopeId) {
289
+ `)}`:"";console.error(`[stx] component <${e}> could not be resolved${h}, so it rendered as nothing.${c}${v}`)}function Ui(e){return`<!-- stx: component "${e.replace(/--+/g,"-")}" could not be resolved; see the server log -->`}function jo(e){let i=new Set,t=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal|useModel|useReactiveProp|useLocalStorage|useSessionStorage|keptState|useCookie|useDebouncedValue)\s*(?:<[^>]*>)?\s*\(/g;for(let o of e){let a;while((a=t.exec(o))!==null)i.add(a[1]);t.lastIndex=0}return[...i]}async function je(e,i,t,o,a,h,c,v=new Set,E,R=et(a),C,O=e){let{extractVariables:M}=await s("stx/variable-extractor",()=>import("./chunk-5fmxn52y.js")),N=v??new Set;if(N.has(e))return`[Circular component reference: ${e}]`;let I=new Set(N);I.add(e);let P=typeof i.client==="string"?i.client.trim():"";if("client"in i)delete i.client;let q=P&&P!=="load"&&ou(P)?P:"";try{let Z=(ce)=>ce.split("-").map((ie)=>ie.charAt(0).toUpperCase()+ie.slice(1)).join(""),W=O.endsWith(".stx")?O.slice(0,-4):O,Y=null,ee=a.__importedComponents;if(ee){let ce=[W,W.toLowerCase(),Z(W),j(W)];for(let ie of ce)if(ee.has(ie)){Y=ee.get(ie);break}}let te=[];if(!Y){let ce=[`${W}.stx`,`${Z(W)}.stx`,`${j(W)}.stx`],ie=[...new Set(ce)],he=a.__originalFilePath,xe=[];if(xe.push(...c._layerComponentDirs??[]),he){let _e=le.join(le.dirname(he),"components");xe.push(_e)}if(o)xe.push(o);let Ke=c._rootComponentsDir;if(typeof Ke==="string"&&!xe.includes(Ke))xe.push(Ke);let We=le.join(le.dirname(h),"components");if(!xe.includes(We))xe.push(We);if(c.componentsDir&&c.componentsDir!==o&&!xe.includes(c.componentsDir))xe.push(c.componentsDir);let it=c._nativeHostAttrs&&/^(?:checkbox|switch)$/i.test(W),ot=(C?.events??[]).map((_e)=>_e.replace(/^@/,"").split(".")[0].toLowerCase().replace(/-/g,"")),at=Object.hasOwn(i,"checked")||Boolean(C?.reactiveProps?.includes("checked")),bt=Object.hasOwn(i,"value")||Boolean(C?.reactiveProps?.includes("value")),_n=!ot.includes("valuechange")&&(at||ot.includes("change")&&!bt),Gn=c._nativeHostAttrs&&/^textinput$/i.test(W),yt=ot.includes("update:value")&&!ot.includes("input"),Ut=c._nativeHostAttrs&&/^video$/i.test(W),wn=Object.hasOwn(i,"src")||Boolean(C?.reactiveProps?.includes("src")),Sn=Object.hasOwn(i,"source")||Boolean(C?.reactiveProps?.includes("source")),$n=Ut&&wn&&!Sn&&(C?.events??[]).every((_e)=>/^(?:play|pause|ended|timeupdate|loadedmetadata|loadstart|error)$/.test(_e.replace(/^@/,"").split(".")[0])),Ht=c._targetComponentFallbackNames?.some((_e)=>_e.toLowerCase()===W.toLowerCase())&&(!it||_n)&&(!Gn||yt)&&(!Ut||$n);for(let _e of Ht?[]:c._targetComponentDirs??[])if(_e&&!xe.includes(_e))xe.push(_e);let _t=typeof c.root==="string"?le.resolve(c.root):void 0,oo=_t??le.dirname(h),wt=[];if(_t)wt.push(le.resolve(_t,"resources/views/components")),wt.push(le.resolve(_t,"resources/components")),wt.push(le.resolve(_t,"src/components")),wt.push(le.resolve(_t,"components"));wt.push(le.resolve(import.meta.dir,"components"));for(let _e of wt)if(!xe.includes(_e))xe.push(_e);let tr=c._pluginComponentDirs;if(Array.isArray(tr)){for(let _e of tr)if(typeof _e==="string"&&!xe.includes(_e))xe.push(_e)}if(c.fallbackComponentsDir&&!xe.includes(c.fallbackComponentsDir))xe.push(c.fallbackComponentsDir);if(Ht){for(let _e of c._targetComponentDirs??[])if(_e&&!xe.includes(_e))xe.push(_e)}let nr=[...new Set(xe.map((_e)=>{if(!_e)return _e;return le.isAbsolute(_e)?_e:le.resolve(oo,_e)}))];xe.length=0,xe.push(...nr);let Yn=`${W}\x00${h}\x00${nr.join("\x00")}`,Qn=Un.get(Yn);if(Qn)if(await n(Qn))Y=Qn;else Un.delete(Yn);if(!Y&&(W.startsWith("./")||W.startsWith("../")))Y=le.resolve(le.dirname(h),`${W}.stx`),te.push(Y);else if(!Y)for(let _e of xe){if(!_e)continue;for(let vn of ie){let En=le.join(_e,vn);if(te.push(En),await n(En)){Y=En;break}}if(Y)break;if(!Y)try{let vn=await import("fs");if(!vn.statSync(_e,{throwIfNoEntry:!1})?.isDirectory())continue;let ao=8,es=[{path:_e,depth:0}];while(es.length>0&&!Y){let kn=es.pop();if(kn.depth>=ao)continue;let sr;try{sr=vn.readdirSync(kn.path,{withFileTypes:!0})}catch{continue}for(let Rn of sr){if(!Rn.isDirectory())continue;if(Rn.name==="node_modules"||Rn.name.startsWith("."))continue;let rr=le.join(kn.path,Rn.name);for(let co of ie){let ts=le.join(rr,co);if(te.push(ts),await n(ts)){Y=ts;break}}if(Y)break;es.push({path:rr,depth:kn.depth+1})}}}catch{}if(Y)break}if(Y)Un.set(Yn,Y)}if(!Y||!await n(Y))return Vi(e,h,te),Ui(e);E.add(Y);let ae;if(Qt.has(Y))ae=Qt.get(Y);else try{ae=await Bun.file(Y).text(),Qt.set(Y,ae)}catch(ce){let ie=ce instanceof Error?ce.message:String(ce);return Vi(e,h,[Y],ie),Ui(e)}if(C)for(let ce of new Set([...Object.keys(i),...C.reactiveProps??[]])){let ie=ce.toLowerCase();if(ie.startsWith("aria-")||ie.startsWith("data-"))continue;let he=ce.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(new RegExp(`\\b${he}\\b`).test(ae))C.declaredProps.add(ce);if(new RegExp(`\\$props\\s*(?:\\.\\s*${he}\\b|\\[\\s*['"]${he}['"]\\s*\\])`).test(ae)||new RegExp(`\\buseReactiveProp\\s*\\(\\s*['"]${he}['"]`).test(ae))C.consumedProps?.add(ce)}let me=new Set(["__originalFilePath","__importedComponents",In,"__stx_client_signal_names","__stx_client_declared_names","__stx_runtime_config","__stxServeContext","__stx_scope_seq"]),ke={};for(let[ce,ie]of Object.entries(a))if(!ce.startsWith("__")||me.has(ce))ke[ce]=ie;let Re=R.length>0?{[Bn]:[...R]}:{},Ve=t;if(t.includes("@include")){let{processIncludes:ce}=await s("stx/includes",()=>import("./chunk-kejrhccx.js"));Ve=await ce(t,a,h,c,E)}if(/<[A-Z][\w.-]*[\s/>]/.test(Ve)){let{processComponents:ce}=await s("stx/component-renderer",()=>import("./chunk-pz3mg7hr.js"));Ve=await ce(Ve,{...a,__processedComponents:N,...Re},h,c,E)}let Te=[];if(Xa(Ve)){let{processExpressions:ce}=await s("stx/expressions",()=>import("./chunk-0v35wpm7.js")),ie=a.__stx_signals_gate===void 0?{...a,__stx_signals_gate:!0,...Re}:R.length>0?{...a,...Re}:a;Ve=ce(Ve,ie,h);for(let he of Ve.matchAll(/\{\{([\s\S]*?)\}\}/g))Te.push(he[1].trim())}let Ze=K(Ve),Ye=[],mt=Ze.output.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(ce,ie)=>{let he=Ze.scripts[Number(ie)]||"",xe=he.match(/^<script\b([^>]*)>/i)?.[1]||"",Ke=xe.match(/\btype\s*=\s*["']([^"']+)["']/i)?.[1]?.toLowerCase(),We=!Ke||["module","text/javascript","application/javascript"].includes(Ke),it=/\sdata-stx-(?:owner|instance)(?=[\s=/>])/i.test(` ${xe}`);if(!/\bserver\b/i.test(xe)&&We&&!it)return Ye.push(he),"";return he}),{extractSlotContent:Zn}=await s("stx/slots",()=>import("./chunk-cwmazy7y.js")),lt=Zn(mt),ut={};if(lt.defaultSlot?.trim())ut.default=lt.defaultSlot;for(let[ce,ie]of lt.namedSlots)ut[ce]=ie.content;let ft=a.__stx_scope_seq??={n:0,key:bs(String(a.__filename??h))},Mt=Ki(e,process.cwd()),nt=`stx_${(Mt.endsWith(".stx")?Mt.slice(0,-4):Mt).replace(/[^a-zA-Z0-9]/g,"_")}_${++ft.n}_${ft.key}`,Ue={...ke,$uid:nt,$native:c._nativeHostAttrs===!0,...i,props:i,slot:mt,$slots:ut,__processedComponents:I,__sections:{},__stx_signals_gate:we(ae)||Xa(t),__stx_preserved_client_expressions:[...Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[],...Te]};xl(ae,Ue);let jt=ae,tn=ue(jt);if(tn)jt=tn.content.trim();let qn=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,Nt=[...ae.matchAll(qn)];for(let[,ce,ie]of Nt)if(!/\bserver\b|\bsrc\s*=|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/i.test(ce))Pe(ie,Y,c.strict);let Je=[],Lt=null,Xn=Nt.some((ce)=>/\bserver\b/.test(ce[1]||"")&&/\bcache\b/.test(ce[1]||"")),ht=null,Qe=null,Bt=null,nn=0,zt=null;if(ul(c),Xn&&Ks>0){let ce=fl({props:i,slot:Ve,slotContext:t.trim()?pl(ke):void 0,buildMode:c.buildMode??"",skipEventDirectives:c.skipEventDirectives===!0,native:c._nativeHostAttrs===!0,clientLoopNames:[...R].sort(),layers:c._layerGraph?.layers.map((ie)=>ie.configFile),uid:nt});if(ce!==null){ht=`${Y}\x00${w(ae)}\x00${ce}`;let ie=Hn.get(ht);if(ie){for(let he of ie.dependencies)E.add(he);if(Fr(a,ie.clientFactories),ft.n+=ie.uidsConsumed,ie.preservedClientExpressions.length>0){let he=new Set(Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[]);for(let xe of ie.preservedClientExpressions)he.add(xe);a.__stx_preserved_client_expressions=[...he]}return ie.output}Qe=new Set(E),Bt=zr(a),nn=ft.n,zt=new Set(Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[])}}let Wt=new Set;for(let ce of Nt){let ie=ce[1]||"",he=ce[2]||"",xe=ie.includes("server");if(Me(ie)&&he.trim())he=Le(he);if(xe&&he){for(let We of Oe(he))Wt.add(We);try{await M(he,Ue,Y,{onFailure:(We)=>{if(We.kind!=="unknown")Lt=We.kind}})}catch(We){}}if(!xe){let We=he.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),it=We.includes("{{")&&We.includes("}}"),ot=We.includes("{!!")&&We.includes("!!}");if(it||ot)We=Fo(We,Ue,Y);let at=ie.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");Je.push(`<script${at}>${We}</script>`)}}let qe=K(ae).output.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),Ft=qe?qe[1]:"",Jn=qe?qe[2]:"",tt="",Q=Ft&&/\bscoped\b/i.test(Ft);if(qe)tt=`<style${Ft}>${yl(Jn,Ue,Y)}</style>`;let ne=jt;if(ne=ne.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),qe)ne=ne.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let ce=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,ie=[];if(ne=ne.replace(ce,(he,xe)=>{let Ke=xe.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(Ke)ie.push(`<style${Ke[1]}>${Ke[2]}</style>`);return""}),ne=ne.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),ie.length>0)tt=`${tt}${ie.join(`
290
+ `)}`}if(t&&ne.includes("{{ text || slot }}"))ne=ne.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>t);let{applySlots:ge}=await s("stx/slots",()=>import("./chunk-cwmazy7y.js")),{defaultSlot:ye,namedSlots:Ee}=lt,Fe=c._nativeHostAttrs===!0&&Je.length>0||Je.some((ce)=>/\b(?:state|derived|effect|ref|useRef|reactive|computed|watch|watchEffect|useModel|useReactiveProp|onMount|onDestroy|defineProps|withDefaults|defineEmits|defineExpose|defineSlots)\s*(?:<[^<>()]*>)?\s*\(/.test(ce)),pt=(ce)=>Fe?xi(ce,nt):ce,er=new Map([...Ee].map(([ce,ie])=>[ce,{...ie,content:pt(ie.content)}]));ne=await ge(ne,pt(ye),er,Ue,Fe?nt:"");let sn=jo(Je),rn=(Array.isArray(Ue.__stx_client_signal_names)?Ue.__stx_client_signal_names:[]).filter((ce)=>!Wt.has(ce));if(sn.length>0||rn.length>0)Ue.__stx_client_signal_names=[...new Set([...rn,...sn])];else delete Ue.__stx_client_signal_names;let Vt=R.filter((ce)=>!Wt.has(ce)&&!(ce in i));if(Vt.length>0)Ue[Bn]=Vt;let xn={...c,_rootComponentsDir:c._rootComponentsDir||c.componentsDir,componentsDir:le.dirname(Y),skipSignalsRuntime:!0,skipEventDirectives:c._nativeHostAttrs===!0||Fe||Je.length===0,defaultLayout:void 0};Ue.__stxProcessingDepth=(a.__stxProcessingDepth||0)+1;let{processDirectives:bn}=await s("stx/process",()=>import("./chunk-52x079ax.js")),rt=await bn(ne,Ue,Y,xn,E),xt=new Set(Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[]);for(let ce of rt.matchAll(/\{\{([\s\S]*?)\}\}/g))xt.add(ce[1].trim());if(xt.size>0)a.__stx_preserved_client_expressions=[...xt];let Xe=nt,He=rt;if(Fe){let ce="";if(Object.keys(i).length>0)try{ce=` data-stx-props="${Fs(JSON.stringify(i))}"`}catch{}let ie=q?` stx-hydrate="${Fs(q)}"`:"",he=Object.fromEntries(Object.entries(ut).map(([at,bt])=>[at,Boolean(bt)])),xe=Object.keys(he).length>0?` data-stx-slots="${Fs(JSON.stringify(he))}"`:"",Ke=` data-stx-scope="${Xe}"${ce}${xe}${ie}`,We=/^\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*<span(?=[\s/>])/i.test(rt),it=We?"span":"div";He=su(rt,Ke)??`<${it}${Ke} data-stx-component-wrapper${We?' style="display:contents"':""}>${rt}</${it}>`;let ot=await Promise.all(Je.map(async(at)=>{let bt=at.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!bt)return at;let[,_n,Gn]=bt,yt=await Sl(Gn,Y,c.buildMode==="compile"),Ut=fn(yt.clientCode,Ne(Ue)),{vendorStyleTags:wn}=yt,Sn=Ut?`function(__scopeId) {
291
291
  ${Ut}
292
292
  return (${yt.factoryBody})(__scopeId);
293
293
  }`:yt.factoryBody,$n=q?null:Ss(a,Sn),Ht=$n?`window.__stxComponentFactories[${JSON.stringify($n)}](${JSON.stringify(Xe)});`:`(${Sn})(${JSON.stringify(Xe)});`;if(q)return`${wn}<script type="stx/island" data-stx-island="${Xe}" data-stx-scoped data-stx-owner="${Xe}"${_n}>${Ht}</script>`;return`${wn}<script data-stx-scoped data-stx-run="always" data-stx-owner="${Xe}"${_n}>${Ht}</script>`}));if(He=He+`
@@ -313,7 +313,7 @@ ${$e.yellow}${$e.bold}Message:${$e.reset} ${i}
313
313
  `,v)C+=`
314
314
  ${$e.blue}${$e.bold}Context:${$e.reset}
315
315
  ${$e.dim}${v}${$e.reset}
316
- `;return C}function pe(){Qt.clear(),Un.clear(),Us.clear(),Hs.clear(),Hn.clear()}function Ip(){return{size:Qt.size,maxSize:500}}var Vs=b(128);async function Sl(e,i,t){let o=w(e,i,t),a=Vs.get(o);if(a){if(us(a.deps))return a;Vs.delete(o)}let h=Do(e,{filePath:i,projectRoot:process.cwd()}),c=h.code,v=Mo(h.styles);c=It(c).code;let{hasUserImports:E,bundleClientScript:R}=await s("stx/client-script-bundler",()=>import("./chunk-hbsnj1db.js")),C=[],O=!1;if(E(c)){let W=c;c=await R(W,i,{projectRoot:process.cwd(),minify:t,collectInputs:C}),O=c===W}let{stripStxRuntimeImports:M}=await s("stx/signal-processing",()=>import("./chunk-vjh43kr3.js"));c=M(c);let N=T(c),I=gl(N),P=new Set(L(N,!0).split(",").map((W)=>W.trim())),q=`function(__scopeId) {
316
+ `;return C}function pe(){Qt.clear(),Un.clear(),Us.clear(),Hs.clear(),Hn.clear()}function Ip(){return{size:Qt.size,maxSize:500}}var Vs=b(128);async function Sl(e,i,t){let o=w(e,i,t),a=Vs.get(o);if(a){if(us(a.deps))return a;Vs.delete(o)}let h=Do(e,{filePath:i,projectRoot:process.cwd()}),c=h.code,v=Mo(h.styles);c=It(c).code;let{hasUserImports:E,bundleClientScript:R}=await s("stx/client-script-bundler",()=>import("./chunk-t3gmm1ja.js")),C=[],O=!1;if(E(c)){let W=c;c=await R(W,i,{projectRoot:process.cwd(),minify:t,collectInputs:C}),O=c===W}let{stripStxRuntimeImports:M}=await s("stx/signal-processing",()=>import("./chunk-tsrf4zzy.js"));c=M(c);let N=T(c),I=gl(N),P=new Set(L(N,!0).split(",").map((W)=>W.trim())),q=`function(__scopeId) {
317
317
  ${st("const",[...lc,...I],N)}
318
318
  const __scope = window.stx._scopes = window.stx._scopes || {};
319
319
  const __scopeVars = __scope[__scopeId] = __scope[__scopeId] || {};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{hn,zo}from"./chunk-cpp0p1eq.js";import"./chunk-9wdd7eq6.js";export{zo as generateRuntimeConfigTypes,hn as prepareRuntimeConfig};
2
+ import{hn,zo}from"./chunk-wc5tt6da.js";import"./chunk-9wdd7eq6.js";export{zo as generateRuntimeConfigTypes,hn as prepareRuntimeConfig};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{x}from"./chunk-78yjmbbs.js";import{T,xn}from"./chunk-6beg47t4.js";import{on,b,w,S,X}from"./chunk-sr4ptszn.js";import{i}from"./chunk-6tz95v2x.js";import{Ee,Yt,Zt,Qt}from"./chunk-vq86p4dy.js";import{ht}from"./chunk-0wwwd7mt.js";import{pt,Nn,qt,ae}from"./chunk-2pga7zzb.js";import{C,wr}from"./chunk-hh58k0nh.js";import h from"path";var v=new Map,k=new Map,A=b(64),E=new Map,Z=["composables","functions"];function z(t){let n=h.basename(t,".ts");return n==="index"||n==="types"||t.endsWith(".d.ts")}async function q(t){if(t)return h.resolve(t);let n=`<default>:${process.cwd()}`,a=E.get(n);if(a!==void 0)return a;let e=await Q();if(e!==null)E.set(n,e);return e}async function Q(){let t=await i(),n=t.root||process.cwd(),a=t.composablesDir;if(a)return h.resolve(n,a);for(let e of Z){let s=h.resolve(n,e);try{let d=new Bun.Glob("**/*.ts");for await(let c of d.scan({cwd:s,absolute:!0}))if(!z(c))return s}catch{}}return null}async function G(t){let n=Array.isArray(t)?t:t?[h.resolve(t)]:(await i())._layerComposableDirs??[await q()].filter((e)=>!!e),a=new Map;for(let e of n){let s=new Bun.Glob("**/*.ts");try{for await(let d of s.scan({cwd:e,absolute:!0})){let c=h.relative(e,d);if(!z(d)&&!a.has(c))a.set(c,d)}}catch{}}return{key:n.join("\x00"),files:[...a.values()].sort()}}async function Us(t){let{files:n}=await G(t),a=X({loader:"ts",target:"browser",define:S()}),e=[];for(let s of n)try{let d=await Bun.file(s).text(),c=a.scan(d).exports.filter((m)=>m!=="default");if(c.length>0)e.push({file:s,names:c})}catch{}return e}function V(t,n){return new RegExp(`\\b${n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\b`).test(t)}function J(t,n){let a=new Set(t.match(/\w+/g)),e=new Set;for(let s of n)if(/^\w+$/.test(s)?a.has(s):V(t,s))e.add(s);return e}var U=b(64);function Y(t,n){let a=w(t,n.size),e=U.get(a);if(e)return e;let s;try{s=on(t,n)}catch{s=J(t,n)}let d=[...t.matchAll(/(?:const|let|var)\s*\{([^}]*)\}\s*=\s*window\.__composables\u0008/g),...t.matchAll(/import\s*\{([^}]*)\}\s*from\s*['"]@composables['"]/g)];for(let c of d)for(let m of c[1].split(",")){let p=m.trim().split(/\s*(?::|\u0008as\u0008)\s*/)[0];if(p&&n.has(p))s.add(p)}return U.set(a,s),s}function ee(t,n,a){let e=new Map;for(let{file:u,names:l}of t)for(let f of l)if(!e.has(f))e.set(f,u);let s=(u)=>{let l=[];for(let f of J(u,e.keys()))l.push(e.get(f));return l},d=new Set(e.keys()),c=(u)=>{let l=[];for(let f of Y(u,d))l.push(e.get(f));return l},m=new Set,p=a.flatMap((u,l)=>l===0?s(u):c(u));while(p.length>0){let u=[];for(let l of p){if(m.has(l))continue;m.add(l);for(let f of c(n.get(l)??""))if(!m.has(f))u.push(f)}p=u}return m}async function Ud(t,n,a){let{key:e,files:s}=await G(t);if(!e)return null;let d=()=>[...new Set([...s,...s.flatMap((o)=>Ee(o))])],c=pt(d());if(s.length===0)return ae(v,e,c,""),null;s.sort();let m=X({loader:"ts",target:"browser",define:S()}),p=qt(k,e,c);if(!p){let o=new Map,r=[];for(let g of s)try{let y=await Bun.file(g).text();o.set(g,y);let _=m.scan(y).exports.filter((W)=>W!=="default");if(_.length>0)r.push({file:g,names:_})}catch{o.set(g,"")}p=ae(k,e,c,{codeByFile:o,modules:r})}let{codeByFile:u,modules:l}=p,f;if(n===void 0)f=new Set(s);else{let o=a?[n,...a]:[n],r=w(o.join("\x00"),e,o.length,c),g=A.get(r);if(f=g??ee(l,u,o),!g)A.set(r,f)}if(f.size===0)return null;let I=s.filter((o)=>f.has(o)),M=`${e}\x00${I.join("\x00")}\x00${Zt()}`,F=qt(v,M,c);if(F!==void 0)return F||null;let N=[],B=new Set,R=new Set;for(let o of I)try{let r=u.get(o)??await Bun.file(o).text(),g=h.basename(o,".ts");for(let _ of r.matchAll(/\b(?:const|let|var|function|class)\s+([A-Z_a-z$][\w$]*)/g))if(_[1])R.add(_[1]);let y=[];try{for(let _ of m.scan(r).exports)if(_!=="default")B.add(_),y.push(_)}catch{}if(r=T(r),Yt(r))r=await Qt(r,o,{projectRoot:process.cwd(),externalizeUserModules:!1,expose:y}),r=ht(r);r=xn(r),r=r.replace(/^export\s+(default\s+)?/gm,""),r=m.transformSync(r),N.push(`// Composable: ${g}
2
+ import{x}from"./chunk-78yjmbbs.js";import{T,xn}from"./chunk-6beg47t4.js";import{on,b,w,S,X}from"./chunk-87em5xdg.js";import{i}from"./chunk-2933mvwr.js";import{Ee,Yt,Zt,Qt}from"./chunk-vct8a1qf.js";import{ht}from"./chunk-1j0sarne.js";import{pt,Nn,qt,ae}from"./chunk-2pga7zzb.js";import{C,wr}from"./chunk-hh58k0nh.js";import h from"path";var v=new Map,k=new Map,A=b(64),E=new Map,Z=["composables","functions"];function z(t){let n=h.basename(t,".ts");return n==="index"||n==="types"||t.endsWith(".d.ts")}async function q(t){if(t)return h.resolve(t);let n=`<default>:${process.cwd()}`,a=E.get(n);if(a!==void 0)return a;let e=await Q();if(e!==null)E.set(n,e);return e}async function Q(){let t=await i(),n=t.root||process.cwd(),a=t.composablesDir;if(a)return h.resolve(n,a);for(let e of Z){let s=h.resolve(n,e);try{let d=new Bun.Glob("**/*.ts");for await(let c of d.scan({cwd:s,absolute:!0}))if(!z(c))return s}catch{}}return null}async function G(t){let n=Array.isArray(t)?t:t?[h.resolve(t)]:(await i())._layerComposableDirs??[await q()].filter((e)=>!!e),a=new Map;for(let e of n){let s=new Bun.Glob("**/*.ts");try{for await(let d of s.scan({cwd:e,absolute:!0})){let c=h.relative(e,d);if(!z(d)&&!a.has(c))a.set(c,d)}}catch{}}return{key:n.join("\x00"),files:[...a.values()].sort()}}async function Us(t){let{files:n}=await G(t),a=X({loader:"ts",target:"browser",define:S()}),e=[];for(let s of n)try{let d=await Bun.file(s).text(),c=a.scan(d).exports.filter((m)=>m!=="default");if(c.length>0)e.push({file:s,names:c})}catch{}return e}function V(t,n){return new RegExp(`\\b${n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\b`).test(t)}function J(t,n){let a=new Set(t.match(/\w+/g)),e=new Set;for(let s of n)if(/^\w+$/.test(s)?a.has(s):V(t,s))e.add(s);return e}var U=b(64);function Y(t,n){let a=w(t,n.size),e=U.get(a);if(e)return e;let s;try{s=on(t,n)}catch{s=J(t,n)}let d=[...t.matchAll(/(?:const|let|var)\s*\{([^}]*)\}\s*=\s*window\.__composables\u0008/g),...t.matchAll(/import\s*\{([^}]*)\}\s*from\s*['"]@composables['"]/g)];for(let c of d)for(let m of c[1].split(",")){let p=m.trim().split(/\s*(?::|\u0008as\u0008)\s*/)[0];if(p&&n.has(p))s.add(p)}return U.set(a,s),s}function ee(t,n,a){let e=new Map;for(let{file:u,names:l}of t)for(let f of l)if(!e.has(f))e.set(f,u);let s=(u)=>{let l=[];for(let f of J(u,e.keys()))l.push(e.get(f));return l},d=new Set(e.keys()),c=(u)=>{let l=[];for(let f of Y(u,d))l.push(e.get(f));return l},m=new Set,p=a.flatMap((u,l)=>l===0?s(u):c(u));while(p.length>0){let u=[];for(let l of p){if(m.has(l))continue;m.add(l);for(let f of c(n.get(l)??""))if(!m.has(f))u.push(f)}p=u}return m}async function Ud(t,n,a){let{key:e,files:s}=await G(t);if(!e)return null;let d=()=>[...new Set([...s,...s.flatMap((o)=>Ee(o))])],c=pt(d());if(s.length===0)return ae(v,e,c,""),null;s.sort();let m=X({loader:"ts",target:"browser",define:S()}),p=qt(k,e,c);if(!p){let o=new Map,r=[];for(let g of s)try{let y=await Bun.file(g).text();o.set(g,y);let _=m.scan(y).exports.filter((W)=>W!=="default");if(_.length>0)r.push({file:g,names:_})}catch{o.set(g,"")}p=ae(k,e,c,{codeByFile:o,modules:r})}let{codeByFile:u,modules:l}=p,f;if(n===void 0)f=new Set(s);else{let o=a?[n,...a]:[n],r=w(o.join("\x00"),e,o.length,c),g=A.get(r);if(f=g??ee(l,u,o),!g)A.set(r,f)}if(f.size===0)return null;let I=s.filter((o)=>f.has(o)),M=`${e}\x00${I.join("\x00")}\x00${Zt()}`,F=qt(v,M,c);if(F!==void 0)return F||null;let N=[],B=new Set,R=new Set;for(let o of I)try{let r=u.get(o)??await Bun.file(o).text(),g=h.basename(o,".ts");for(let _ of r.matchAll(/\b(?:const|let|var|function|class)\s+([A-Z_a-z$][\w$]*)/g))if(_[1])R.add(_[1]);let y=[];try{for(let _ of m.scan(r).exports)if(_!=="default")B.add(_),y.push(_)}catch{}if(r=T(r),Yt(r))r=await Qt(r,o,{projectRoot:process.cwd(),externalizeUserModules:!1,expose:y}),r=ht(r);r=xn(r),r=r.replace(/^export\s+(default\s+)?/gm,""),r=m.transformSync(r),N.push(`// Composable: ${g}
3
3
  ${r.trim()}`)}catch(r){console.warn(`[stx] Failed to load composable ${o}:`,r)}if(N.length===0||B.size===0)return ae(v,M,c,""),null;let L=[...B].map((o)=>` try { if (!(${JSON.stringify(o)} in __c)) __c[${JSON.stringify(o)}] = ${o}; } catch (e) {}`).join(`
4
4
  `),j=JSON.stringify([...B]),D=N.join(`
5
5
 
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{Rl,yp,bp,vp,wp,Al,Pl,xp,Sp,go,kp,Zn,Qn,Gr}from"./chunk-2xbdd0r8.js";import{Qe}from"./chunk-yn9kvsk1.js";import"./chunk-sr4ptszn.js";import"./chunk-cpp0p1eq.js";import"./chunk-9wdd7eq6.js";import"./chunk-qwdcts9w.js";import"./chunk-6beg47t4.js";import"./chunk-78yjmbbs.js";export{wp as __setSignalsGeneratorsForTest,Qe as cacheEngineFingerprint,Qn as cacheTemplate,Zn as checkCache,kp as clearDevCaches,Pl as getCachedRouterScript,Al as getCachedSignalsRuntime,xp as getServeClientAsset,go as getServeModuleBundle,Gr as hashFilePath,bp as invalidateFileCache,vp as invalidateFileCacheByDir,yp as readFileCached,Sp as registerServeModuleBundle,Rl as templateCache};
2
+ import{Rl,yp,bp,vp,wp,Al,Pl,xp,Sp,go,kp,Zn,Qn,Gr}from"./chunk-2hmyj5wh.js";import{Qe}from"./chunk-yn9kvsk1.js";import"./chunk-87em5xdg.js";import"./chunk-wc5tt6da.js";import"./chunk-9wdd7eq6.js";import"./chunk-qwdcts9w.js";import"./chunk-6beg47t4.js";import"./chunk-78yjmbbs.js";export{wp as __setSignalsGeneratorsForTest,Qe as cacheEngineFingerprint,Qn as cacheTemplate,Zn as checkCache,kp as clearDevCaches,Pl as getCachedRouterScript,Al as getCachedSignalsRuntime,xp as getServeClientAsset,go as getServeModuleBundle,Gr as hashFilePath,bp as invalidateFileCache,vp as invalidateFileCacheByDir,yp as readFileCached,Sp as registerServeModuleBundle,Rl as templateCache};
@@ -1,4 +1,4 @@
1
1
  // @bun
2
2
  import m from"path";var y=/__stxModules\["((?:[^"\\]|\\.)*)"\]/g;function I(...o){let r=new Set;for(let s of o){if(!s||!s.includes("__stxModules["))continue;for(let e of s.matchAll(y))try{r.add(JSON.parse(`"${e[1]}"`))}catch{}}return[...r].sort()}async function w(o,r={}){if(o.length===0)return null;let s=process.cwd(),e=[],a=[];o.forEach((t,c)=>{let i=t.startsWith("npm:")?t.slice(4):m.resolve(s,t),l=`__stxRegistered${c}`,p=JSON.stringify(t);e.push(`import * as ${l} from ${JSON.stringify(i)};`),a.push(`if (!globalThis.__stxModules[${p}]) globalThis.__stxModules[${p}] = ${l};`)});let d=[...e,"globalThis.__stxModules = globalThis.__stxModules || {};",...a].join(`
3
- `),n;try{let{bundleClientScript:t}=await import("./chunk-hbsnj1db.js");n=await t(d,m.join(s,".stx-module-registry.ts"),{projectRoot:s,minify:r.minify,externalizeUserModules:!1,collectInputs:r.collectInputs,throwOnFailure:!0})}catch(t){let{formatBuildFailure:c}=await import("./chunk-6kam8r5y.js"),i=c(t);console.warn(`[stx] could not build the page module registry (#1957): ${i}`);let l=`[stx] the page module registry did not build, so ${o.join(", ")} cannot load (#1957): ${i}`;return`;console.error(${JSON.stringify(l)});`}let{transformAutoImports:f,generateAutoImportDestructuring:_}=await import("./chunk-1zrepav2.js"),u=f(n),h=_(u.stxImports,u.browserImports),{transformStoreImports:x}=await import("./chunk-9859r1d5.js");n=x(u.code);let g=JSON.stringify(new Bun.CryptoHasher("md5").update(d).digest("hex").slice(0,12));return[";(function() {"," var __stxBundles = globalThis.__stxModuleBundles || (globalThis.__stxModuleBundles = {});",` if (__stxBundles[${g}]) return;`,` __stxBundles[${g}] = true;`,h,n,"})();"].join(`
3
+ `),n;try{let{bundleClientScript:t}=await import("./chunk-t3gmm1ja.js");n=await t(d,m.join(s,".stx-module-registry.ts"),{projectRoot:s,minify:r.minify,externalizeUserModules:!1,collectInputs:r.collectInputs,throwOnFailure:!0})}catch(t){let{formatBuildFailure:c}=await import("./chunk-6kam8r5y.js"),i=c(t);console.warn(`[stx] could not build the page module registry (#1957): ${i}`);let l=`[stx] the page module registry did not build, so ${o.join(", ")} cannot load (#1957): ${i}`;return`;console.error(${JSON.stringify(l)});`}let{transformAutoImports:f,generateAutoImportDestructuring:_}=await import("./chunk-k093pr2w.js"),u=f(n),h=_(u.stxImports,u.browserImports),{transformStoreImports:x}=await import("./chunk-9859r1d5.js");n=x(u.code);let g=JSON.stringify(new Bun.CryptoHasher("md5").update(d).digest("hex").slice(0,12));return[";(function() {"," var __stxBundles = globalThis.__stxModuleBundles || (globalThis.__stxModuleBundles = {});",` if (__stxBundles[${g}]) return;`,` __stxBundles[${g}] = true;`,h,n,"})();"].join(`
4
4
  `)}export{w as buildModuleRegistryScript,I as registeredModuleIdsIn};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{To,$a,s,Tt,re,S,Pe,cn,Ie,de,K,cr,ln,gs,Ba,dn,dr,hs,ys,Fa,Oo,za,Ha,Va,Ua,Ne,De,bs,je,n,gn,m,d,H,J,we,k,_}from"./chunk-sr4ptszn.js";import{l,p,E,t,ie,V,a,xe,Uo,D,bn,Wo,Lt,qo,rc,mr,sc,rt,oc,hr,ic,vn,Ko,ac,yr,vr,Se,Go}from"./chunk-qwdcts9w.js";import{Nt}from"./chunk-9wdd7eq6.js";import{hn}from"./chunk-cpp0p1eq.js";import{h}from"./chunk-7ev6gq40.js";import{rr,ss}from"./chunk-f26n6y9p.js";import{pa,fa,er,Je,ga,R}from"./chunk-6tz95v2x.js";import{bo,vo,wo,xo}from"./chunk-y34tyrpb.js";import{aa,Hr}from"./chunk-53papj9w.js";import{jr,Br,Fr}from"./chunk-cmy9n7as.js";import{Vr,lo,uo,Ur,Wr,po}from"./chunk-0wwwd7mt.js";import{Lr,Gn}from"./chunk-mj39dydr.js";import{to}from"./chunk-078qg8r5.js";import{ne,oo,io,ao}from"./chunk-xnx06qqt.js";import{Jn,he,la,Yn,ua}from"./chunk-xaxswtkb.js";import{q,Ge}from"./chunk-a2zb5fgg.js";import{ma,ha}from"./chunk-aze0xdtt.js";import{C,wn,Xo}from"./chunk-hh58k0nh.js";import ds from"fs";import ce from"path";function lt(){return`
2
+ import{To,$a,s,Tt,re,S,Pe,cn,Ie,de,K,cr,ln,gs,Ba,dn,dr,hs,ys,Fa,Oo,za,Ha,Va,Ua,Ne,De,bs,je,n,gn,m,d,H,J,we,k,_}from"./chunk-87em5xdg.js";import{l,p,E,t,ie,V,a,xe,Uo,D,bn,Wo,Lt,qo,rc,mr,sc,rt,oc,hr,ic,vn,Ko,ac,yr,vr,Se,Go}from"./chunk-qwdcts9w.js";import{Nt}from"./chunk-9wdd7eq6.js";import{hn}from"./chunk-wc5tt6da.js";import{h}from"./chunk-wt7rp7wc.js";import{rr,ss}from"./chunk-f26n6y9p.js";import{pa,fa,er,Je,ga,R}from"./chunk-2933mvwr.js";import{bo,vo,wo,xo}from"./chunk-y34tyrpb.js";import{aa,Hr}from"./chunk-chy90834.js";import{jr,Br,Fr}from"./chunk-p01b07se.js";import{Vr,lo,uo,Ur,Wr,po}from"./chunk-1j0sarne.js";import{Lr,Gn}from"./chunk-1dkcakve.js";import{to}from"./chunk-078qg8r5.js";import{ne,oo,io,ao}from"./chunk-xnx06qqt.js";import{Jn,he,la,Yn,ua}from"./chunk-2pvcp0y6.js";import{q,Ge}from"./chunk-a2zb5fgg.js";import{ma,ha}from"./chunk-3xyv2fec.js";import{C,wn,Xo}from"./chunk-hh58k0nh.js";import ds from"fs";import ce from"path";function lt(){return`
3
3
  // STX Lifecycle Runtime
4
4
  (function() {
5
5
  if (typeof window === 'undefined') return;
@@ -854,13 +854,13 @@ ${I}
854
854
  </style>`;i=i.replace(x,P),v.lastIndex=0}catch(I){}}}return i}import it from"path";var cs=/(\bfrom\s*|\bimport\s*\(\s*|\bimport\s+)(['"])(\.\.?\/[^'"]*)\2/g,ls=/(<script\b[^>]*>)([\s\S]*?)(<\/script>)/gi;function us(c,e){if(!e||!c.includes("/"))return c;let u=it.dirname(e);return c.replace(cs,(i,g,r,f)=>{let v=it.resolve(u,f);return`${g}${r}${v.split(it.sep).join("/")}${r}`})}function un(c,e){if(!e||!c.includes("<script"))return c;return c.replace(ls,(u,i,g,r)=>`${i}${us(g,e)}${r}`)}var Te="<!--PARENT_CONTENT_PLACEHOLDER-->";function pn(c){return c.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Sn(c,e){let u=c.length,i=e,g=!0,r=[],f=(v)=>v+9<=u&&c[v]==="<"&&c[v+1]==="/"&&(c[v+2]==="s"||c[v+2]==="S")&&(c[v+3]==="c"||c[v+3]==="C")&&(c[v+4]==="r"||c[v+4]==="R")&&(c[v+5]==="i"||c[v+5]==="I")&&(c[v+6]==="p"||c[v+6]==="P")&&(c[v+7]==="t"||c[v+7]==="T")&&(c[v+8]===">"||/\s/.test(c[v+8]));while(i<u){let v=c[i];if(f(i))return i;if(v==="/"&&c[i+1]==="/"){if(i=c.indexOf(`
855
855
  `,i+2),i===-1)return-1;i+=1,g=!0;continue}if(v==="/"&&c[i+1]==="*"){let y=c.indexOf("*/",i+2);if(y===-1)return-1;i=y+2,g=!0;continue}if(v==="/"&&g){let y=i+1,x=!1;while(y<u){let b=c[y];if(b==="\\"){y+=2;continue}if(b==="[")x=!0;else if(b==="]")x=!1;else if(b==="/"&&!x){y++;break}else if(b===`
856
856
  `){y=-1;break}y++}if(y===-1){i++,g=!1;continue}while(y<u&&/[a-z]/.test(c[y]))y++;i=y,g=!1;continue}if(v==="'"||v==='"'){let y=v;i++;while(i<u){if(c[i]==="\\"){i+=2;continue}if(c[i]===y){i++;break}if(c[i]===`
857
- `)break;i++}g=!1;continue}if(v==="`"){i++;while(i<u){if(c[i]==="\\"){i+=2;continue}if(c[i]==="`"){i++;break}if(c[i]==="$"&&c[i+1]==="{"){r.push(!0),i+=2,g=!0;break}i++}if(r.length===0)g=!1;continue}if(v==="}"&&r.length>0){r.pop(),i++;while(i<u){if(c[i]==="\\"){i+=2;continue}if(c[i]==="`"){i++,g=!1;break}if(c[i]==="$"&&c[i+1]==="{"){r.push(!0),i+=2,g=!0;break}i++}continue}if(/\s/.test(v));else if(/[)\].\w$]/.test(v))g=!1;else g=!0;i++}return-1}function $n(c,e){let u=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),i=new RegExp(`<script\\b(?=[^>]*\\b${u}(?:\\s|=|/?>))[^>]*>`,"i").exec(c);if(!i)return null;let g=i.index+i[0].length,r=c.indexOf("</script>",g);if(r===-1)return null;let f=c.indexOf(">",r);if(f===-1)return null;return{start:i.index,end:f+1}}var ps=4096;async function fn(c,e,u){if(u.buildMode!=="serve"||e.length<ps)return null;let{registerServeModuleBundle:i}=await import("./chunk-cyarez4b.js");return`<script ${c} src="${i(e)}"></script>`}async function Un(c,e,u){try{let{registeredModuleIdsIn:i,buildModuleRegistryScript:g}=await s("stx/client-module-registry",()=>import("./chunk-9bx4b0r1.js")),r=[],f=await g(i(...c),{minify:Xo(e.buildMode),collectInputs:r});for(let v of r)u?.add(v);if(!f)return null;if(e.buildMode==="serve"){let{registerServeModuleBundle:v}=await import("./chunk-cyarez4b.js");return`<script data-stx-scoped data-stx-run="always" data-stx-modules src="${v(f)}"></script>`}return`<script data-stx-scoped data-stx-run="always" data-stx-modules>${f.replace(/<\/script/gi,"<\\/script")}</script>`}catch{return null}}function fs(c,e=""){let u=$n(c,"data-stx-runtime");if(!u)return c;let i=Jn(c);if(i===-1||i===u.start){if(!e)return c;return c.slice(0,u.end)+e+c.slice(u.end)}if(i<u.start)return c.slice(0,i)+c.slice(u.start,u.end)+e+`
857
+ `)break;i++}g=!1;continue}if(v==="`"){i++;while(i<u){if(c[i]==="\\"){i+=2;continue}if(c[i]==="`"){i++;break}if(c[i]==="$"&&c[i+1]==="{"){r.push(!0),i+=2,g=!0;break}i++}if(r.length===0)g=!1;continue}if(v==="}"&&r.length>0){r.pop(),i++;while(i<u){if(c[i]==="\\"){i+=2;continue}if(c[i]==="`"){i++,g=!1;break}if(c[i]==="$"&&c[i+1]==="{"){r.push(!0),i+=2,g=!0;break}i++}continue}if(/\s/.test(v));else if(/[)\].\w$]/.test(v))g=!1;else g=!0;i++}return-1}function $n(c,e){let u=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),i=new RegExp(`<script\\b(?=[^>]*\\b${u}(?:\\s|=|/?>))[^>]*>`,"i").exec(c);if(!i)return null;let g=i.index+i[0].length,r=c.indexOf("</script>",g);if(r===-1)return null;let f=c.indexOf(">",r);if(f===-1)return null;return{start:i.index,end:f+1}}var ps=4096;async function fn(c,e,u){if(u.buildMode!=="serve"||e.length<ps)return null;let{registerServeModuleBundle:i}=await import("./chunk-ac75vk0w.js");return`<script ${c} src="${i(e)}"></script>`}async function Un(c,e,u){try{let{registeredModuleIdsIn:i,buildModuleRegistryScript:g}=await s("stx/client-module-registry",()=>import("./chunk-aw3jfdca.js")),r=[],f=await g(i(...c),{minify:Xo(e.buildMode),collectInputs:r});for(let v of r)u?.add(v);if(!f)return null;if(e.buildMode==="serve"){let{registerServeModuleBundle:v}=await import("./chunk-ac75vk0w.js");return`<script data-stx-scoped data-stx-run="always" data-stx-modules src="${v(f)}"></script>`}return`<script data-stx-scoped data-stx-run="always" data-stx-modules>${f.replace(/<\/script/gi,"<\\/script")}</script>`}catch{return null}}function fs(c,e=""){let u=$n(c,"data-stx-runtime");if(!u)return c;let i=Jn(c);if(i===-1||i===u.start){if(!e)return c;return c.slice(0,u.end)+e+c.slice(u.end)}if(i<u.start)return c.slice(0,i)+c.slice(u.start,u.end)+e+`
858
858
  `+c.slice(i,u.start)+c.slice(u.end);let g=c.slice(u.start,u.end),r=c.slice(0,u.start)+c.slice(u.end),f=Jn(r);if(f===-1)return g+e+`
859
859
  `+r;return r.slice(0,f)+g+e+`
860
860
  `+r.slice(f)}function ms(c){let e=/\x00STX_ESC_MUSTACHE_OPEN\x00([\s\S]*?)\x00STX_ESC_MUSTACHE_CLOSE\x00/g;return c.replace(e,(u,i,g)=>{let r=c.slice(0,g);return r.lastIndexOf("<")>r.lastIndexOf(">")?`{{${i}}}`:`{<!--stx-literal-->{${i}}}`})}async function o(c,e,u,i,g){if(i.ssr===!1&&!i.autoShell&&i.buildMode==="spa")return c;if(e.__stx_signals_gate===void 0)e.__stx_signals_gate=we(c,u);let r=!e.__stxProcessingDepth;dn(e);for(let f of i._layerGraph?.configDependencies??[])g.add(f);if(r&&i.runtimeConfig)await hn(e,u,i.runtimeConfig);if(r)Va(e),e.__stx_scope_seq??={n:0,key:bs(String(e.__filename??u))},e.__stx_head_injections=qo(),e.__stx_seo_staged=!1;if(!e.__stxProcessingDepth)e.__stxProcessingDepth=0;if(e.__stxProcessingDepth++,!e.__onceStore)e.__onceStore=new Set;if((i.debug||!C()&&!wn())&&u&&u.endsWith(".stx"))to(c,u);try{return await re.timeAsync("template-processing",async()=>{let f=await vs(c,e,u,i,g);if(r)f=Oo(f);if(r&&i.autoShell&&i.buildMode!=="compile"){let v=Se(i.app?.head,{known:vr,source:"app.head"}),x=(e.__stx_runtime_head||null)??Go(),b=(e.__stx_head_raw||"").trim(),w,T=b.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(T)w=T[1].trim(),b=b.replace(T[0],"").trim();let A=e.__sections?.title,O=A?k(A,e,u):void 0,M=x.title||w||O,I=!x.title&&(!!w||!!O),P=x.meta||[],N=new Set(P.map((X)=>rt(X)).filter(Boolean)),U={...v,...M&&{title:M},meta:[...(v.meta||[]).filter((X)=>!N.has(rt(X))),...P],link:[...v.link||[],...x.link||[]],script:[...v.script||[],...x.script||[]],headRaw:[v.headRaw,b].filter(Boolean).join(`
861
861
  `),...x.htmlAttrs&&{htmlAttrs:oc(v.htmlAttrs,x.htmlAttrs)},...x.bodyAttrs&&{bodyAttrs:{...v.bodyAttrs||{},...x.bodyAttrs}}},W=Ko(f);if(f=yr(f,U,{...I&&{titleIsHtml:!0},...i.app?.colorMode&&{colorMode:i.app.colorMode}},W),W)f=ac(f,v),f=hr(f,U.htmlAttrs);let L=f.match(/<!-- stx-layout: ([^ ]+) -->/);if(L&&f.includes("<head")){let X=L[1],G=ss(X);f=f.replace(/<head\b[^>]*>/i,(Y)=>`${Y}
862
862
  <meta name="stx-layout" content="${pn(X)}">
863
- <meta name="stx-layout-group" content="${pn(G)}">`)}let j=f.match(/function (__stx_setup_\w+)\(/),B=j?q(f):null;if(j&&B&&!/\bdata-stx=/.test(B.tag)){f=Ge(f,(G,Y)=>`<body${Y} data-stx="${j[1]}">`);let X=new RegExp(`(<(?!body)[a-zA-Z][^>]*) data-stx="${j[1]}"`,"i");f=f.replace(X,"$1")}}if(r){let v=e.__stx_head_injections??qo(),y=ic(f);if(y!==null)v.beforeClose.push(y);let x=tn(f);if(x!==null)v.afterOpen.push(x);if(i.offline?.enabled&&!f.includes("data-stx-offline"))v.beforeClose.push(nn);f=rc(f,v);let b=i.app?.colorMode;if(b)f=mr(f,b)}if(r)if($n(f,"data-stx-runtime")){let y=null,x=null,b=null,w=null,T=null;try{let{getStoreScript:O}=await s("stx/store-loader",()=>import("./chunk-r5y241js.js")),M=i.storesDir,I=await O(M);if(I)b=`<script data-stx-stores>${I}</script>`,x=await fn("data-stx-stores",I,i)??b}catch{}y=await Un([f,b],i,g);try{let{getFrameworkComposableScript:O}=await s("stx/framework-composables",()=>import("./chunk-ta030rdc.js"));T=await O(f)}catch{}try{let{getComposableScript:O}=await s("stx/composable-loader",()=>import("./chunk-7ndbf386.js")),M=i.composablesDir,I=[y,b,T].filter((N)=>N!==null),P=await O(i._layerComposableDirs??M,f,I);if(P)w=await fn('data-stx-scoped data-stx-run="always" data-stx-composables',P,i)??`<script data-stx-scoped data-stx-run="always" data-stx-composables>${P}</script>`}catch{}let A=[y,x,w,T].filter((O)=>O!==null).map((O)=>`
863
+ <meta name="stx-layout-group" content="${pn(G)}">`)}let j=f.match(/function (__stx_setup_\w+)\(/),B=j?q(f):null;if(j&&B&&!/\bdata-stx=/.test(B.tag)){f=Ge(f,(G,Y)=>`<body${Y} data-stx="${j[1]}">`);let X=new RegExp(`(<(?!body)[a-zA-Z][^>]*) data-stx="${j[1]}"`,"i");f=f.replace(X,"$1")}}if(r){let v=e.__stx_head_injections??qo(),y=ic(f);if(y!==null)v.beforeClose.push(y);let x=tn(f);if(x!==null)v.afterOpen.push(x);if(i.offline?.enabled&&!f.includes("data-stx-offline"))v.beforeClose.push(nn);f=rc(f,v);let b=i.app?.colorMode;if(b)f=mr(f,b)}if(r)if($n(f,"data-stx-runtime")){let y=null,x=null,b=null,w=null,T=null;try{let{getStoreScript:O}=await s("stx/store-loader",()=>import("./chunk-1gg5vxe8.js")),M=i.storesDir,I=await O(M);if(I)b=`<script data-stx-stores>${I}</script>`,x=await fn("data-stx-stores",I,i)??b}catch{}y=await Un([f,b],i,g);try{let{getFrameworkComposableScript:O}=await s("stx/framework-composables",()=>import("./chunk-53e9ta3g.js"));T=await O(f)}catch{}try{let{getComposableScript:O}=await s("stx/composable-loader",()=>import("./chunk-nadgej53.js")),M=i.composablesDir,I=[y,b,T].filter((N)=>N!==null),P=await O(i._layerComposableDirs??M,f,I);if(P)w=await fn('data-stx-scoped data-stx-run="always" data-stx-composables',P,i)??`<script data-stx-scoped data-stx-run="always" data-stx-composables>${P}</script>`}catch{}let A=[y,x,w,T].filter((O)=>O!==null).map((O)=>`
864
864
  ${O}`).join("");f=fs(f,A)}else{let y=await Un([f],i,g);if(y){let x=f.search(/<script\b[^>]*>(?:(?!<\/script>)[\s\S])*?__stxModules\[/i);if(x!==-1)f=f.slice(0,x)+y+`
865
865
  `+f.slice(x)}}if(r)f=sc(f);if(r&&e.__stx_inject_css!==!1)f=await h(f,void 0,i.buildMode==="serve",!0);else if(r)f=ln(f);if(f=f.replace(/\x00STX_ESCAPED_AT\x00/g,"@"),f=ms(f),r&&e.__stx_runtime_config)f=Nt(f,e.__stx_runtime_config);if(r&&!e.__stx_defer_server_data){let v=dr(e);if(v){let y=/<head\b[^>]*>/i.exec(f),x=y?y.index+y[0].length:0;f=f.slice(0,x)+v+f.slice(x)}}return f})}catch(f){if(f instanceof V)throw f;let v=f instanceof Error?f.message:String(f),y=new ie(`Template processing failed: ${v}`,u,void 0,void 0,c.substring(0,200)+(c.length>200?"...":""));if(D.log(y,{filePath:u,context:e}),bn.logDetailedError(y,{filePath:u,template:c.substring(0,500)}),C()&&!i.debug)console.error(`[stx] ${ce.relative(process.cwd(),u)||u}: ${y.message}`);if(i.debug)throw y;return Uo.createFallbackContent("Template Processing",y)}}async function vs(c,e,u,i,g){let r=process.cwd(),f={...i,partialsDir:i.partialsDir&&!ce.isAbsolute(i.partialsDir)?ce.resolve(r,i.partialsDir):i.partialsDir,componentsDir:i.componentsDir&&!ce.isAbsolute(i.componentsDir)?ce.resolve(r,i.componentsDir):i.componentsDir,layoutsDir:i.layoutsDir&&!ce.isAbsolute(i.layoutsDir)?ce.resolve(r,i.layoutsDir):i.layoutsDir},v=f,y=c;await ks(u,e),xs(e,v),y=await xe(()=>zt(y,e,u,v),y,(L)=>{D.log(L,{filePath:u,phase:"pre-processing-middleware"},"warning"),console.warn(`[stx] pre-processing middleware failed for ${u}: ${L.message}`)}),y=y.replace(/\{\{--[\s\S]*?--\}\}/g,"");let x=de(y,Ie,(L,j)=>`\x00STX_HTML_COMMENT_${j}\x00`);y=x.output;let b=x.tokens,w=(L)=>b.length===0?L:L.replace(/\x00STX_HTML_COMMENT_(\d+)\x00/g,(j,B)=>b[Number(B)]??""),T="\x00STX_ESCAPED_AT\x00",A="\x00STX_ESC_MUSTACHE_OPEN\x00",O="\x00STX_ESC_MUSTACHE_CLOSE\x00";y=y.replace(/@@/g,T),y=y.replace(/@\{\{([\s\S]*?)\}\}/g,(L,j)=>`${A}${j}${O}`),y=Jt(y),y=await an(y,u,g);let M={};y=Br(y,M);let I={...e.__sections||{}},P="",N=mt(gt(c)),U=/@nolayout\b/.test(y)||N===!1;if(/@nolayout\b/.test(y))y=y.replace(/@nolayout\b\s*/g,"");let W=y.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(W)P=W[1],y=y.replace(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/g,"");else if(typeof N==="string"){if(P=N,!/@section\s*\(/.test(y))y=`@section('content')
866
866
  ${y.trim()}
@@ -869,7 +869,7 @@ ${y.trim()}
869
869
  @endsection`}}if(P&&y.includes("<script")){let L=K(y),j=L.scripts.map((B)=>mn(B,u)??B);y=cr(L.output,j)}if(y=y.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(L,j,B)=>(I[j]=B,"")),y=y.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*([^)]+?)\s*\)/g,(L,j,B)=>{if(/^(['"]).*\1$/.test(B.trim()))return L;try{let X=l(B.trim(),e);if(X===void 0)return L;let Y=(e.__stx_inline_section_values??=[]).push(X)-1;return I[j]=`{{ __stx_inline_section_values[${Y}] }}`,""}catch{return L}}),y=y.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@endsection|@show)/g,(L,j,B)=>{if(B.includes("@parent"))I[j]=B.replace("@parent",Te);else I[j]=B.trim();return""}),e.__sections=I,y=y.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"])?\)/g,(L,j,B)=>I[j]||B||""),!("slot"in e)||e.slot===void 0)y=y.replace(/\{\{\s*slot\s*\}\}/g,()=>I.content||"");if(y=Fr(y,M),P){let L=[],j=K(y),B=de(j.output,cn,(X,G)=>`\x00STX_ORPHAN_STYLE_${G}\x00`);if(y=B.output.replace(/\x00STX_(SCRIPT|ORPHAN_STYLE)_(\d+)\x00/g,(X,G,Y)=>{let ee=G==="SCRIPT"?mn(j.scripts[Number(Y)],u):B.tokens[Number(Y)];if(ee)L.push(ee);return""}),L.length>0){let X=L.join(`
870
870
  `);I.content=I.content?`${I.content}
871
871
  ${X}`:X,e.__sections=I}}if(P)try{let L;if(ce.isAbsolute(P))L=P,g.add(P);else L=await xe(()=>gn(P,u,f,g),null,()=>{throw new ie(`Failed to resolve layout path: ${P}`,u,void 0,void 0,`Layout referenced from ${u}`)});if(!L){let ee=(oe)=>{if(!oe)return[];try{let ae=ce.isAbsolute(oe)?oe:ce.resolve(process.cwd(),oe);return ds.readdirSync(ae).filter((le)=>le.endsWith(".stx")).map((le)=>le.replace(/\.stx$/,""))}catch{return[]}},te=[...ee(f.layoutsDir),...ee(f.fallbackLayoutsDir)].filter((oe,ae,le)=>le.indexOf(oe)===ae).sort(),ue=`Layout not found: ${P} (referenced from ${u})`+(te.length>0?`. Available layouts: ${te.join(", ")}`:f.layoutsDir?`. No .stx layouts found in ${f.layoutsDir}`:"");if(D.log(Error(ue),{layoutPath:P,filePath:u,available:te},"error"),console.error(`[stx] ${ue}`),f.debug)throw new ie(ue,u);return y}let j=await xe(()=>Bun.file(L).text(),"",()=>{throw new ie(`Failed to read layout file: ${L}`,u,void 0,void 0,"Layout content could not be loaded")});j=un(j,L);let B=j.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(B){if(f.debug)console.log(`Found nested layout: ${B[1]} in ${L}`);let ee={},te=j.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(ae,le,be)=>(ee[le]=be.trim(),""));for(let[ae,le]of Object.entries(ee))if(I[ae]&&I[ae].includes(Te)){let be=I[ae].indexOf(Te);I[ae]=I[ae].slice(0,be)+le+I[ae].slice(be+Te.length)}else if(!I[ae])I[ae]=le;let ue={...e,__sections:I},oe=`@layout('${B[1]}')${te}`;return await o(oe,ue,L,f,g)}let X=j.replace(/\{\{--[\s\S]*?--\}\}/g,""),G=Br(X,M),Y={};return G=G.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(ee,te,ue)=>(Y[te]=ue.trim(),`@slot('${te}')`)),G=G.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(ee,te,ue)=>{if(I[te]){let oe=I[te];if(oe.includes(Te)){let ae=Y[te]||"",le=oe.indexOf(Te);oe=oe.slice(0,le)+ae+oe.slice(le+Te.length)}return oe}return ue||""}),G=ws(G,I),G=G.replace(/\{\{\s*slot\s*\}\}/g,()=>I.content||""),G=Fr(G,M),e.__originalFilePath=u,y=await kn(G,e,L,f,g),y=`<!-- stx-layout: ${P} -->
872
- ${y}`,w(y)}catch(L){if(L instanceof V)throw L;throw new ie(`Error processing layout ${P}: ${L instanceof Error?L.message:String(L)}`,u)}return w(await kn(y,e,u,f,g))}function ws(c,e){return c.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(u,i,g)=>{let r=e[i];if(r!==void 0){if(!new RegExp(`@(?:yield|slot)\\(\\s*['"]${i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(r))return r}return g||""})}function xs(c,e){if(c.__stx_sfc_mode=!0,c.__stx_options=e,e.buildMode)c.__stx_buildMode=e.buildMode;let u=e.envPrefix||"STX_PUBLIC_",i={};for(let[g,r]of Object.entries(process.env))if(g.startsWith(u)&&r!==void 0)i[g]=r;c.$env=i}async function ks(c,e){await xe(()=>Kt(c,e),void 0,(u)=>{D.log(u,{filePath:c,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${c}: ${u.message}`)})}var ot="data-stx-source";function mn(c,e){if(!c)return c;let u=/^<script\b([^>]*)>/i.exec(c);if(!u||!/\bserver\b/.test(u[1])||u[1].includes(ot))return c;return`<script ${ot}="${encodeURIComponent(e)}"${c.slice(7)}`}function Ss(c){let e=new RegExp(`${ot}="([^"]*)"`).exec(c);return e?decodeURIComponent(e[1]):void 0}function yn(c){return c.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function xn(c,e,u){return`<div data-stx-server-script-error role="alert" style="padding:12px 14px;border:1px solid #f0b4b4;border-left-width:4px;background:#fff5f5;color:#7a1f1f;font:13px/1.5 ui-monospace,SFMono-Regular,Menlo,monospace"><strong style="display:block;margin-bottom:4px">stx: a &lt;script server&gt; ${e==="module-resolution"?"imports a module that does not resolve":e==="syntax"?"does not parse":"names something that does not exist"}, so this component rendered nothing.</strong><span style="display:block;opacity:.85">${yn(c)}</span><span style="display:block;margin-top:4px">${yn(u)}</span></div>`}async function $s(c,e,u,i){let{scanScriptTags:g}=await s("stx/signal-processing",()=>import("./chunk-vjh43kr3.js")),r=[],f=!C()&&!wn();for(let y of g(c)){let x=y.attrs;if(!/\bserver\b/.test(x))continue;let b=y.start+y.fullMatch.indexOf(">")+1,w=Sn(c,b);if(w===-1)continue;let T=c.slice(b,w);if(!T.trim())continue;let A=Ss(x)??u,O={index:y.start,length:w+9-y.start};try{let{extractVariables:M}=await s("stx/variable-extractor",()=>import("./chunk-9e3w8am7.js"));await M(T,e,A,{preserveExisting:!0,onFailure:(I)=>{if(I.kind==="unknown")return;if(i?.onServerScriptError?.({sourcePath:A,kind:I.kind,message:I.message}),!f)return;r.push({...O,markup:xn(A,I.kind,I.message)})}})}catch(M){let I=M instanceof Error?M:Error(String(M));if(D.log(I,{filePath:A,phase:"server-script-extraction"},"warning"),console.warn(`[stx] server <script> extraction failed in ${A}: ${I.message}`),f)r.push({...O,markup:xn(A,"unknown",I.message)})}}if(r.length===0)return c;let v=c;for(let y of r.sort((x,b)=>b.index-x.index))v=v.slice(0,y.index)+y.markup+v.slice(y.index+y.length);return v}async function Es(c,e,u){try{let{interpolateScriptsInTemplate:i}=await s("stx/expressions",()=>import("./chunk-xrrzwta9.js"));return i(c,e,{skipServer:!0})}catch(i){let g=i instanceof Error?i:Error(String(i));return D.log(g,{filePath:u,phase:"script-expression-interpolation"},"warning"),console.warn(`[stx] script expression interpolation failed in ${u}: ${g.message}`),c}}async function kn(c,e,u,i,g){let r=c,f=i;if(r=await $s(r,e,u,i),r=await Bt(r,e,u),r=await Ft(r,e,u),r=await Es(r,e,u),r=await At(r,e,u,f),we(r))r=lo(r,e),r=Wr(r,e),r=Ur(r,e);r=uo(r);let{processStreamDirectives:v}=await s("stx/streaming",()=>import("./chunk-brwm3qgd.js"));r=v(r,e),r=Gn(r,e,u,f,!0),r=await en(r,e,u,f,g),r=await Hr(r,e,u,f,g),r=pa(r,e,u,f);let{processDeferDirectives:y}=await s("stx/defer",()=>import("./chunk-3xx9d934.js"));r=y(r,e,u);let{processTeleportDirectives:x}=await s("stx/teleport",()=>import("./chunk-tz09earb.js"));r=x(r,e,u);let{processTransitionDirectives:b,processTransitionAttributes:w}=await s("stx/transitions",()=>import("./chunk-ggwvnpwj.js"));r=b(r,e,u),r=w(r);let{processErrorBoundaryDirectives:T,stripRenderFailedMarkers:A}=await s("stx/error-boundaries",()=>import("./chunk-h85hrwkq.js"));r=T(r,e,u),r=A(r);let{processSuspenseDirectives:O}=await s("stx/suspense",()=>import("./chunk-3wsm9g9c.js"));r=O(r,e,u);let{processAsyncDirectives:M}=await s("stx/async-components",()=>import("./chunk-swxznm5v.js"));r=M(r,e,u);let{processKeepAliveDirectives:I}=await s("stx/keep-alive",()=>import("./chunk-s8qe247r.js"));r=I(r,e,u);let{processVirtualListDirectives:P,processVirtualGridDirectives:N,processInfiniteListDirectives:U}=await s("stx/virtual-scrolling",()=>import("./chunk-ft3f9nj0.js"));r=P(r,e,u),r=N(r,e,u),r=U(r,e,u);let{processPartialHydrationDirectives:W,processStaticDirectives:L}=await s("stx/partial-hydration",()=>import("./chunk-3bfegbpw.js"));r=W(r,e,u),r=L(r);let{processComputedDirectives:j,processWatchDirectives:B}=await s("stx/computed",()=>import("./chunk-1xdzcy9d.js"));r=j(r,e,u),r=B(r,e,u);let{processFormValidationDirectives:X}=await s("stx/forms-validation",()=>import("./chunk-y5yrbhdq.js"));r=X(r,e,u);let{processHeadDirective:G,processTitleDirective:Y,processMetaDirective:ee,resetHead:te}=await s("stx/head",()=>import("./chunk-909ymsjz.js"));if(!e.__stx_head_preset&&!e.__stx_runtime_head)te();let ue=G(r);if(r=ue.content,ue.headContent)e.__stx_head_raw=`${e.__stx_head_raw||""}${ue.headContent}
872
+ ${y}`,w(y)}catch(L){if(L instanceof V)throw L;throw new ie(`Error processing layout ${P}: ${L instanceof Error?L.message:String(L)}`,u)}return w(await kn(y,e,u,f,g))}function ws(c,e){return c.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(u,i,g)=>{let r=e[i];if(r!==void 0){if(!new RegExp(`@(?:yield|slot)\\(\\s*['"]${i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(r))return r}return g||""})}function xs(c,e){if(c.__stx_sfc_mode=!0,c.__stx_options=e,e.buildMode)c.__stx_buildMode=e.buildMode;let u=e.envPrefix||"STX_PUBLIC_",i={};for(let[g,r]of Object.entries(process.env))if(g.startsWith(u)&&r!==void 0)i[g]=r;c.$env=i}async function ks(c,e){await xe(()=>Kt(c,e),void 0,(u)=>{D.log(u,{filePath:c,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${c}: ${u.message}`)})}var ot="data-stx-source";function mn(c,e){if(!c)return c;let u=/^<script\b([^>]*)>/i.exec(c);if(!u||!/\bserver\b/.test(u[1])||u[1].includes(ot))return c;return`<script ${ot}="${encodeURIComponent(e)}"${c.slice(7)}`}function Ss(c){let e=new RegExp(`${ot}="([^"]*)"`).exec(c);return e?decodeURIComponent(e[1]):void 0}function yn(c){return c.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function xn(c,e,u){return`<div data-stx-server-script-error role="alert" style="padding:12px 14px;border:1px solid #f0b4b4;border-left-width:4px;background:#fff5f5;color:#7a1f1f;font:13px/1.5 ui-monospace,SFMono-Regular,Menlo,monospace"><strong style="display:block;margin-bottom:4px">stx: a &lt;script server&gt; ${e==="module-resolution"?"imports a module that does not resolve":e==="syntax"?"does not parse":"names something that does not exist"}, so this component rendered nothing.</strong><span style="display:block;opacity:.85">${yn(c)}</span><span style="display:block;margin-top:4px">${yn(u)}</span></div>`}async function $s(c,e,u,i){let{scanScriptTags:g}=await s("stx/signal-processing",()=>import("./chunk-tsrf4zzy.js")),r=[],f=!C()&&!wn();for(let y of g(c)){let x=y.attrs;if(!/\bserver\b/.test(x))continue;let b=y.start+y.fullMatch.indexOf(">")+1,w=Sn(c,b);if(w===-1)continue;let T=c.slice(b,w);if(!T.trim())continue;let A=Ss(x)??u,O={index:y.start,length:w+9-y.start};try{let{extractVariables:M}=await s("stx/variable-extractor",()=>import("./chunk-5fmxn52y.js"));await M(T,e,A,{preserveExisting:!0,onFailure:(I)=>{if(I.kind==="unknown")return;if(i?.onServerScriptError?.({sourcePath:A,kind:I.kind,message:I.message}),!f)return;r.push({...O,markup:xn(A,I.kind,I.message)})}})}catch(M){let I=M instanceof Error?M:Error(String(M));if(D.log(I,{filePath:A,phase:"server-script-extraction"},"warning"),console.warn(`[stx] server <script> extraction failed in ${A}: ${I.message}`),f)r.push({...O,markup:xn(A,"unknown",I.message)})}}if(r.length===0)return c;let v=c;for(let y of r.sort((x,b)=>b.index-x.index))v=v.slice(0,y.index)+y.markup+v.slice(y.index+y.length);return v}async function Es(c,e,u){try{let{interpolateScriptsInTemplate:i}=await s("stx/expressions",()=>import("./chunk-0v35wpm7.js"));return i(c,e,{skipServer:!0})}catch(i){let g=i instanceof Error?i:Error(String(i));return D.log(g,{filePath:u,phase:"script-expression-interpolation"},"warning"),console.warn(`[stx] script expression interpolation failed in ${u}: ${g.message}`),c}}async function kn(c,e,u,i,g){let r=c,f=i;if(r=await $s(r,e,u,i),r=await Bt(r,e,u),r=await Ft(r,e,u),r=await Es(r,e,u),r=await At(r,e,u,f),we(r))r=lo(r,e),r=Wr(r,e),r=Ur(r,e);r=uo(r);let{processStreamDirectives:v}=await s("stx/streaming",()=>import("./chunk-m0f3strn.js"));r=v(r,e),r=Gn(r,e,u,f,!0),r=await en(r,e,u,f,g),r=await Hr(r,e,u,f,g),r=pa(r,e,u,f);let{processDeferDirectives:y}=await s("stx/defer",()=>import("./chunk-3xx9d934.js"));r=y(r,e,u);let{processTeleportDirectives:x}=await s("stx/teleport",()=>import("./chunk-tz09earb.js"));r=x(r,e,u);let{processTransitionDirectives:b,processTransitionAttributes:w}=await s("stx/transitions",()=>import("./chunk-ggwvnpwj.js"));r=b(r,e,u),r=w(r);let{processErrorBoundaryDirectives:T,stripRenderFailedMarkers:A}=await s("stx/error-boundaries",()=>import("./chunk-h85hrwkq.js"));r=T(r,e,u),r=A(r);let{processSuspenseDirectives:O}=await s("stx/suspense",()=>import("./chunk-3wsm9g9c.js"));r=O(r,e,u);let{processAsyncDirectives:M}=await s("stx/async-components",()=>import("./chunk-swxznm5v.js"));r=M(r,e,u);let{processKeepAliveDirectives:I}=await s("stx/keep-alive",()=>import("./chunk-s8qe247r.js"));r=I(r,e,u);let{processVirtualListDirectives:P,processVirtualGridDirectives:N,processInfiniteListDirectives:U}=await s("stx/virtual-scrolling",()=>import("./chunk-ft3f9nj0.js"));r=P(r,e,u),r=N(r,e,u),r=U(r,e,u);let{processPartialHydrationDirectives:W,processStaticDirectives:L}=await s("stx/partial-hydration",()=>import("./chunk-3bfegbpw.js"));r=W(r,e,u),r=L(r);let{processComputedDirectives:j,processWatchDirectives:B}=await s("stx/computed",()=>import("./chunk-1xdzcy9d.js"));r=j(r,e,u),r=B(r,e,u);let{processFormValidationDirectives:X}=await s("stx/forms-validation",()=>import("./chunk-61ww9d2z.js"));r=X(r,e,u);let{processHeadDirective:G,processTitleDirective:Y,processMetaDirective:ee,resetHead:te}=await s("stx/head",()=>import("./chunk-909ymsjz.js"));if(!e.__stx_head_preset&&!e.__stx_runtime_head)te();let ue=G(r);if(r=ue.content,ue.headContent)e.__stx_head_raw=`${e.__stx_head_raw||""}${ue.headContent}
873
873
  `;if(r=Y(r,e),r=ee(r,e,u),r=Xt(r),r=oo(r,e),r=Ct(r),r=Ut(r),r=await jr(r,e,u,f,g),r=await Hr(r,e,u,f,g),e.__stxProcessingDepth===1)r=Ua(r,e);if(r=r.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/g,""),r=Oo(r),r=ne(r,e,u),r=Lr(r),r=Ba(r,e,{filePath:u,buildMode:f.buildMode}),r=io(r,e),r=ao(r,e),r=ze(r,e),r=jt(r,e),r=Ht(r,e),r=await bt(r,e,u,f),r=await ga(r,e,u),r=await ma(r,e,u,f),r=ha(r,e,u,f),r=bo(r,e,u,f),r=vo(r,e,u),r=wo(r,e,u,f),r=Et(r,e,u,f),r=hs(r,e),r=ys(r),r=Fa(r),!f.skipEventDirectives)r=$a(r,e,u);if(r=vt(r,e,u),f.debug){let F=/\bx-data\s*=/.test(r),z=Vr(c);if(F&&z)console.warn(`[stx] ${u}: Template mixes Alpine-style (x-data) and signals (state/derived/effect) reactivity.
874
874
  Both work on the same page, but they manage separate scopes.
875
875
  Prefer signals (state/derived/effect) for new components.`)}r=aa(r,e),r=await k(r,e,u),r=za(r),r=Ha(r),r=pt(r);let{processXElementDirectives:oe}=await s("stx/x-element",()=>import("./chunk-zhxdpzga.js"));r=oe(r);let ae=e.__originalFilePath||u,le=Ne(e);if(r=await po(r,f,ae,le),r=It(r,e),r=await Wt(r,e,u,f),f.media?.image?.autoSiblings){let F=f.publicDir||"public",{rewriteImagesWithSiblings:z}=await s("stx/image-optimization/auto-sibling",()=>import("./chunk-gx6wxmbv.js"));r=await z(r,{publicDir:F})}if(f.seo?.enabled)r=xo(r,e,f);let be=(F,z,Z=!0)=>{if(!z)return F;let me=z.match(/<title\b[^>]*>[\s\S]*?<\/title>/i),se=/<head\b[^>]*>[\s\S]*?(?:<\/head\s*>|<body\b|$)/i.exec(F),fe=se?/<title\b[^>]*>[\s\S]*?<\/title>/i.exec(se[0]):null;if(me&&se&&fe){if(Z){let Ce=se.index+fe.index;F=F.slice(0,Ce)+me[0]+F.slice(Ce+fe[0].length)}if(z=z.replace(me[0],"").trim(),!z)return F}if(/<\/head>/i.test(F))return F.replace(/<\/head>/i,`${z}
@@ -883,6 +883,6 @@ ${lt()}
883
883
  `+Ce}else r=r.replace("</head>",`${z}
884
884
  </head>`)}else if(r.includes("<body"))r=r.replace(/<body([^>]*)>/,`<body$1>
885
885
  ${z}`);else r=z+`
886
- `+r}{let{scanScriptTags:F}=await s("stx/signal-processing",()=>import("./chunk-vjh43kr3.js")),z=[];for(let Z of F(r)){if(!/\bserver\b/i.test(Z.attrs))continue;let me=Z.start+Z.fullMatch.indexOf(">")+1,se=Sn(r,me);if(se===-1)continue;let fe=se+9;while(fe<r.length&&/\s/.test(r[fe]))fe++;z.push({start:Z.start,end:fe})}if(z.length>0){let Z=Array(z.length+1),me=0;for(let se=0;se<z.length;se++){let{start:fe,end:Ce}=z[se];Z[se]=r.slice(me,fe),me=Ce}Z[z.length]=r.slice(me),r=Z.join("")}}let at=gs(r,u);if(at.hasScoped)r=at.html;let Rn=e.__stx_event_bindings||[],Xe=!1,ct=[],Mn=/\s:[a-z][\w.-]*\s*=/.test(r),{scanScriptTags:Dn}=await s("stx/signal-processing",()=>import("./chunk-vjh43kr3.js"));for(let F of Dn(r,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/}))ct.push({match:F.fullMatch,attrs:F.attrs,content:F.body});for(let{match:F,attrs:z,content:Z}of ct){Xe=!0;let me=Z;Pe(Z,u,i.strict,e.__originalFilePath);let se=await De(Z,{eventBindings:Rn,attrs:z,hasColonDirectives:Mn,templateContent:c,filePath:u,projectRoot:process.cwd(),production:Xo(i.buildMode),serverData:le});r=r.replace(F,()=>se)}if(Xe)e.__stx_event_bindings=[];if(!Xe&&e.__stxProcessingDepth===1){let F=e.__stx_event_bindings||[];if(F.length>0){let z=To(F);if(z){let Z=r.lastIndexOf("</body>");r=Z===-1?r+z:r.slice(0,Z)+z+`
886
+ `+r}{let{scanScriptTags:F}=await s("stx/signal-processing",()=>import("./chunk-tsrf4zzy.js")),z=[];for(let Z of F(r)){if(!/\bserver\b/i.test(Z.attrs))continue;let me=Z.start+Z.fullMatch.indexOf(">")+1,se=Sn(r,me);if(se===-1)continue;let fe=se+9;while(fe<r.length&&/\s/.test(r[fe]))fe++;z.push({start:Z.start,end:fe})}if(z.length>0){let Z=Array(z.length+1),me=0;for(let se=0;se<z.length;se++){let{start:fe,end:Ce}=z[se];Z[se]=r.slice(me,fe),me=Ce}Z[z.length]=r.slice(me),r=Z.join("")}}let at=gs(r,u);if(at.hasScoped)r=at.html;let Rn=e.__stx_event_bindings||[],Xe=!1,ct=[],Mn=/\s:[a-z][\w.-]*\s*=/.test(r),{scanScriptTags:Dn}=await s("stx/signal-processing",()=>import("./chunk-tsrf4zzy.js"));for(let F of Dn(r,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/}))ct.push({match:F.fullMatch,attrs:F.attrs,content:F.body});for(let{match:F,attrs:z,content:Z}of ct){Xe=!0;let me=Z;Pe(Z,u,i.strict,e.__originalFilePath);let se=await De(Z,{eventBindings:Rn,attrs:z,hasColonDirectives:Mn,templateContent:c,filePath:u,projectRoot:process.cwd(),production:Xo(i.buildMode),serverData:le});r=r.replace(F,()=>se)}if(Xe)e.__stx_event_bindings=[];if(!Xe&&e.__stxProcessingDepth===1){let F=e.__stx_event_bindings||[];if(F.length>0){let z=To(F);if(z){let Z=r.lastIndexOf("</body>");r=Z===-1?r+z:r.slice(0,Z)+z+`
887
887
  `+r.slice(Z)}e.__stx_event_bindings=[]}}if(!he(r)&&la(r))r=await Yn(r,f);if(r=ua(r),f.csp?.enabled&&f.csp.useNonce&&typeof e.cspNonce==="string")r=$t(r,e.cspNonce);return r}
888
888
  export{gt,$e,ra,eo,Un,o};
@@ -1,4 +1,4 @@
1
1
  // @bun
2
- import{Ze}from"./chunk-f26n6y9p.js";import{ft,Dn}from"./chunk-tmqrbs98.js";import{Oe,un,Ya,Za}from"./chunk-sr4ptszn.js";import{mr,hr,yr,vr,Se}from"./chunk-qwdcts9w.js";import{A}from"./chunk-9wdd7eq6.js";import{zo}from"./chunk-cpp0p1eq.js";import{h}from"./chunk-7ev6gq40.js";import{o}from"./chunk-nrekjc5a.js";import{N,i}from"./chunk-6tz95v2x.js";import{Sa}from"./chunk-q3gactm1.js";import{Ve,_e,Ai,Pi,Cn}from"./chunk-tevmv0ex.js";import{en,Ys}from"./chunk-syxcw8xt.js";import{En}from"./chunk-wav0xbnb.js";import{Kt,Fn,zn}from"./chunk-hqj28381.js";import{W}from"./chunk-xaxswtkb.js";import m from"fs";import c from"path";import{createHash as Q}from"crypto";function J(n){return Q("sha256").update(n).digest("hex").slice(0,8)}function U(n=!1){let l=n?Dn():ft(),a=J(l);return{content:l,filename:`runtime.${a}.js`,hash:a}}function V(){let n=Ze(),l=J(n);return{content:n,filename:`router.${l}.js`,hash:l}}import q from"path";import{createHash as ee}from"crypto";function te(n={}){let l=new Set;return{context:new Proxy(n,{get(r,e){if(e in r)return r[e];if(typeof e==="string"&&!e.startsWith("__"))l.add(e);return},has(r,e){if(e in r)return!0;if(typeof e==="string"&&!e.startsWith("__"))l.add(e);return!1}}),accessedKeys:l}}async function X(n,l,a={}){let r=q.resolve(n),e=await Bun.file(r).text(),S=ee("sha256").update(e).digest("hex").slice(0,16);Ya();let _={};try{_=await i(a.configDir)}catch{}let y=[],d=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,f;while((f=d.exec(e))!==null){let R=f[1];if(/\bserver\b/.test(R))y.push(f[2])}let u=new Set(y.flatMap((R)=>Oe(R))),{context:D}=te({__filename:r,__dirname:q.dirname(r),__stx_serverDeclared:u}),w=new Set,j={...N,..._,...a,buildMode:"compile",strict:!1},b=await o(e,D,r,j,w),C=Ve(b),P=Za();return{route:l,sourceFile:n,html:b,fragment:C,placeholders:P,hasServerScripts:y.length>0,serverScriptContent:y,dependencies:Array.from(w),contentHash:S,status:un(e),streamTemplates:D.__streamTemplates}}var re=new Set([".DS_Store","Thumbs.db","desktop.ini",".gitkeep",".gitignore"]);function Z(n,l){let a=0,r=0;if(!m.existsSync(n))return{copied:a,bytes:r};m.mkdirSync(l,{recursive:!0});function e(S,_){let y=m.readdirSync(S,{withFileTypes:!0});for(let d of y){if(re.has(d.name))continue;let f=c.join(S,d.name),u=c.join(_,d.name);if(d.isDirectory())m.mkdirSync(u,{recursive:!0}),e(f,u);else if(d.isFile()){if(m.existsSync(u))continue;m.copyFileSync(f,u),a++,r+=m.statSync(u).size}}}return e(n,l),{copied:a,bytes:r}}async function Bu(n={}){let l=Date.now(),a=c.resolve(n.root||process.cwd()),r=c.resolve(a,n.outputDir||".output");console.log("[stx build] Starting production build...");let e=await i(a),S=c.resolve(a,n.componentsDir??e.componentsDir??"components"),_=c.resolve(a,n.partialsDir??e.partialsDir??"partials"),y=c.resolve(a,n.layoutsDir??e.layoutsDir??"layouts"),d=n.publicDir??e.publicDir??"public",f=Se(e.app?.head,{known:vr,source:"app.head"}),u=e.app?.colorMode,D=e.router?.container||"main",w=n.routeRules??e.routeRules??{},j=En(w),b=n.serverApi??e.serverApi,C=typeof b==="object"?b:{};if(b)en(a,C);if(e.runtimeConfig)A(e.runtimeConfig,{});if(m.existsSync(r))m.rmSync(r,{recursive:!0});let P=[c.join(r,"public","__stx"),c.join(r,"public","assets"),c.join(r,"server","pages"),c.join(r,"server","fragments")];for(let s of P)m.mkdirSync(s,{recursive:!0});console.log("[stx build] Discovering routes...");let R=W(a,{pagesDirs:e._layerPageDirs}),Y=["components","layouts","partials"],B=R.filter((s)=>!Y.some((g)=>s.pattern.startsWith(`/${g}/`)||s.pattern===`/${g}`));console.log(`[stx build] Found ${B.length} page routes (${R.length-B.length} non-page files excluded)`),console.log("[stx build] Generating shared assets...");let v=U(n.debug),x=V();await Bun.write(c.join(r,"public","__stx",v.filename),v.content),await Bun.write(c.join(r,"public","__stx",x.filename),x.content),console.log(`[stx build] Runtime: ${v.filename} (${(v.content.length/1024).toFixed(1)}KB)`),console.log(`[stx build] Router: ${x.filename} (${(x.content.length/1024).toFixed(1)}KB)`),console.log("[stx build] Compiling templates...");let M=[],k=[];for(let s of B){let g=j(s.pattern),O=g.rendering==="prerender";if(O&&(s.pattern.includes(":")||s.pattern.includes("[")))throw Error(`Cannot prerender parameter route ${s.pattern}; use dynamic rendering (explicit path enumeration is not supported here)`);try{let t=await X(s.filePath,s.pattern,{configDir:a,componentsDir:S,partialsDir:_,layoutsDir:y,debug:n.debug});if(M.push(t),t.html=t.html.replace(/runtime\.__STX_HASH__\.js/g,v.filename).replace(/router\.__STX_HASH__\.js/g,x.filename),t.html=yr(t.html,f,{bodyScripts:[`<script src="/__stx/${x.filename}"></script>`],...u&&{colorMode:u}}),u)t.html=mr(t.html,u);if(f.htmlAttrs)t.html=hr(t.html,f.htmlAttrs);if(!/<body[^>]*\bdata-stx=/.test(t.html)){let p=t.html.match(/<(?!body\b)[a-zA-Z][a-zA-Z0-9-]*\b[^>]*?\s(data-stx="[^"]+")[^>]*>/);if(p&&p[1]){let I=p[1];t.html=t.html.replace(" "+I,""),t.html=t.html.replace(/<body([^>]*)>/,`<body$1 ${I}>`)}}if(t.html=t.html.replace(/<style data-css="generated">[\s\S]*?<\/style>\s*/g,""),t.html=await h(t.html),O){let p=await Cn(t,{params:{},request:new Request(`http://stx.build${s.pattern}`),method:"GET",__stx_strict_hydration:!0});if(p.redirect||p.cookies?.length||p.boundaries?.length||p.headers&&Object.keys(p.headers).length)throw Error(`Prerendered route ${s.pattern} cannot set response headers/cookies, redirect or stream`);t.html=p.html,t.status=p.status??t.status,t.hasServerScripts=!1,t.serverScriptContent=[],t.placeholders={}}t.fragment=_e(t.html,D);let L=s.pattern==="/"?"index":s.pattern.slice(1).replace(/\//g,"-").replace(/[[\]]/g,"_"),z=c.join("server","pages",`${L}.compiled.json`),G=c.join("server","fragments",`${L}.html`);await Bun.write(c.join(r,z),JSON.stringify(t,null,2)),await Bun.write(c.join(r,G),t.fragment),k.push({pattern:s.pattern,compiledPath:z,fragmentPath:G,isDynamic:t.hasServerScripts,hasParams:s.pattern.includes(":")||s.pattern.includes("["),prerendered:O}),console.log(`[stx build] \u2713 ${s.pattern}`)}catch(t){if(Object.keys(g).length)throw t;console.error(`[stx build] \u2717 ${s.pattern}:`,t instanceof Error?t.message:t)}}let E=c.resolve(a,d);if(m.existsSync(E)){let{copied:s,bytes:g}=Z(E,c.join(r,"public"));if(s>0)console.log(`[stx build] Copied ${s} public asset${s===1?"":"s"} (${(g/1024).toFixed(1)}KB) from ${d}/`)}let H=zn(a);if(H){let{copied:s,bytes:g}=Z(H,c.join(r,"public",Fn));if(s>0)console.log(`[stx build] Copied ${s} asset${s===1?"":"s"} (${(g/1024).toFixed(1)}KB) from ${Kt}/`)}let F={runtime:v.filename,router:x.filename},T=Ai(k,F,r);if(T.routeRules=w,T.routerContainer=D,b)T.apiRoutes=await Ys(a,r,C);if(e.runtimeConfig)await Bun.write(c.join(r,"server/runtime-config.json"),JSON.stringify(e.runtimeConfig)),await zo(a,e.runtimeConfig);if(e._layerGraph)await Bun.write(c.join(r,"server/layers.json"),JSON.stringify(Sa(e._layerGraph),null,2));Pi(T,r);let K=Date.now()-l;return console.log(`
2
+ import{Ze}from"./chunk-f26n6y9p.js";import{ft,Dn}from"./chunk-tmqrbs98.js";import{Oe,un,Ya,Za}from"./chunk-87em5xdg.js";import{mr,hr,yr,vr,Se}from"./chunk-qwdcts9w.js";import{A}from"./chunk-9wdd7eq6.js";import{zo}from"./chunk-wc5tt6da.js";import{h}from"./chunk-wt7rp7wc.js";import{o}from"./chunk-b0th3d8q.js";import{N,i}from"./chunk-2933mvwr.js";import{Sa}from"./chunk-q3gactm1.js";import{Ve,_e,Ai,Pi,Cn}from"./chunk-n8f0zw1y.js";import{en,Ys}from"./chunk-7z7zp8xq.js";import{En}from"./chunk-wav0xbnb.js";import{Kt,Fn,zn}from"./chunk-hqj28381.js";import{W}from"./chunk-2pvcp0y6.js";import m from"fs";import c from"path";import{createHash as Q}from"crypto";function J(n){return Q("sha256").update(n).digest("hex").slice(0,8)}function U(n=!1){let l=n?Dn():ft(),a=J(l);return{content:l,filename:`runtime.${a}.js`,hash:a}}function V(){let n=Ze(),l=J(n);return{content:n,filename:`router.${l}.js`,hash:l}}import q from"path";import{createHash as ee}from"crypto";function te(n={}){let l=new Set;return{context:new Proxy(n,{get(r,e){if(e in r)return r[e];if(typeof e==="string"&&!e.startsWith("__"))l.add(e);return},has(r,e){if(e in r)return!0;if(typeof e==="string"&&!e.startsWith("__"))l.add(e);return!1}}),accessedKeys:l}}async function X(n,l,a={}){let r=q.resolve(n),e=await Bun.file(r).text(),S=ee("sha256").update(e).digest("hex").slice(0,16);Ya();let _={};try{_=await i(a.configDir)}catch{}let y=[],d=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,f;while((f=d.exec(e))!==null){let R=f[1];if(/\bserver\b/.test(R))y.push(f[2])}let u=new Set(y.flatMap((R)=>Oe(R))),{context:D}=te({__filename:r,__dirname:q.dirname(r),__stx_serverDeclared:u}),w=new Set,j={...N,..._,...a,buildMode:"compile",strict:!1},b=await o(e,D,r,j,w),C=Ve(b),P=Za();return{route:l,sourceFile:n,html:b,fragment:C,placeholders:P,hasServerScripts:y.length>0,serverScriptContent:y,dependencies:Array.from(w),contentHash:S,status:un(e),streamTemplates:D.__streamTemplates}}var re=new Set([".DS_Store","Thumbs.db","desktop.ini",".gitkeep",".gitignore"]);function Z(n,l){let a=0,r=0;if(!m.existsSync(n))return{copied:a,bytes:r};m.mkdirSync(l,{recursive:!0});function e(S,_){let y=m.readdirSync(S,{withFileTypes:!0});for(let d of y){if(re.has(d.name))continue;let f=c.join(S,d.name),u=c.join(_,d.name);if(d.isDirectory())m.mkdirSync(u,{recursive:!0}),e(f,u);else if(d.isFile()){if(m.existsSync(u))continue;m.copyFileSync(f,u),a++,r+=m.statSync(u).size}}}return e(n,l),{copied:a,bytes:r}}async function Bu(n={}){let l=Date.now(),a=c.resolve(n.root||process.cwd()),r=c.resolve(a,n.outputDir||".output");console.log("[stx build] Starting production build...");let e=await i(a),S=c.resolve(a,n.componentsDir??e.componentsDir??"components"),_=c.resolve(a,n.partialsDir??e.partialsDir??"partials"),y=c.resolve(a,n.layoutsDir??e.layoutsDir??"layouts"),d=n.publicDir??e.publicDir??"public",f=Se(e.app?.head,{known:vr,source:"app.head"}),u=e.app?.colorMode,D=e.router?.container||"main",w=n.routeRules??e.routeRules??{},j=En(w),b=n.serverApi??e.serverApi,C=typeof b==="object"?b:{};if(b)en(a,C);if(e.runtimeConfig)A(e.runtimeConfig,{});if(m.existsSync(r))m.rmSync(r,{recursive:!0});let P=[c.join(r,"public","__stx"),c.join(r,"public","assets"),c.join(r,"server","pages"),c.join(r,"server","fragments")];for(let s of P)m.mkdirSync(s,{recursive:!0});console.log("[stx build] Discovering routes...");let R=W(a,{pagesDirs:e._layerPageDirs}),Y=["components","layouts","partials"],B=R.filter((s)=>!Y.some((g)=>s.pattern.startsWith(`/${g}/`)||s.pattern===`/${g}`));console.log(`[stx build] Found ${B.length} page routes (${R.length-B.length} non-page files excluded)`),console.log("[stx build] Generating shared assets...");let v=U(n.debug),x=V();await Bun.write(c.join(r,"public","__stx",v.filename),v.content),await Bun.write(c.join(r,"public","__stx",x.filename),x.content),console.log(`[stx build] Runtime: ${v.filename} (${(v.content.length/1024).toFixed(1)}KB)`),console.log(`[stx build] Router: ${x.filename} (${(x.content.length/1024).toFixed(1)}KB)`),console.log("[stx build] Compiling templates...");let M=[],k=[];for(let s of B){let g=j(s.pattern),O=g.rendering==="prerender";if(O&&(s.pattern.includes(":")||s.pattern.includes("[")))throw Error(`Cannot prerender parameter route ${s.pattern}; use dynamic rendering (explicit path enumeration is not supported here)`);try{let t=await X(s.filePath,s.pattern,{configDir:a,componentsDir:S,partialsDir:_,layoutsDir:y,debug:n.debug});if(M.push(t),t.html=t.html.replace(/runtime\.__STX_HASH__\.js/g,v.filename).replace(/router\.__STX_HASH__\.js/g,x.filename),t.html=yr(t.html,f,{bodyScripts:[`<script src="/__stx/${x.filename}"></script>`],...u&&{colorMode:u}}),u)t.html=mr(t.html,u);if(f.htmlAttrs)t.html=hr(t.html,f.htmlAttrs);if(!/<body[^>]*\bdata-stx=/.test(t.html)){let p=t.html.match(/<(?!body\b)[a-zA-Z][a-zA-Z0-9-]*\b[^>]*?\s(data-stx="[^"]+")[^>]*>/);if(p&&p[1]){let I=p[1];t.html=t.html.replace(" "+I,""),t.html=t.html.replace(/<body([^>]*)>/,`<body$1 ${I}>`)}}if(t.html=t.html.replace(/<style data-css="generated">[\s\S]*?<\/style>\s*/g,""),t.html=await h(t.html),O){let p=await Cn(t,{params:{},request:new Request(`http://stx.build${s.pattern}`),method:"GET",__stx_strict_hydration:!0});if(p.redirect||p.cookies?.length||p.boundaries?.length||p.headers&&Object.keys(p.headers).length)throw Error(`Prerendered route ${s.pattern} cannot set response headers/cookies, redirect or stream`);t.html=p.html,t.status=p.status??t.status,t.hasServerScripts=!1,t.serverScriptContent=[],t.placeholders={}}t.fragment=_e(t.html,D);let L=s.pattern==="/"?"index":s.pattern.slice(1).replace(/\//g,"-").replace(/[[\]]/g,"_"),z=c.join("server","pages",`${L}.compiled.json`),G=c.join("server","fragments",`${L}.html`);await Bun.write(c.join(r,z),JSON.stringify(t,null,2)),await Bun.write(c.join(r,G),t.fragment),k.push({pattern:s.pattern,compiledPath:z,fragmentPath:G,isDynamic:t.hasServerScripts,hasParams:s.pattern.includes(":")||s.pattern.includes("["),prerendered:O}),console.log(`[stx build] \u2713 ${s.pattern}`)}catch(t){if(Object.keys(g).length)throw t;console.error(`[stx build] \u2717 ${s.pattern}:`,t instanceof Error?t.message:t)}}let E=c.resolve(a,d);if(m.existsSync(E)){let{copied:s,bytes:g}=Z(E,c.join(r,"public"));if(s>0)console.log(`[stx build] Copied ${s} public asset${s===1?"":"s"} (${(g/1024).toFixed(1)}KB) from ${d}/`)}let H=zn(a);if(H){let{copied:s,bytes:g}=Z(H,c.join(r,"public",Fn));if(s>0)console.log(`[stx build] Copied ${s} asset${s===1?"":"s"} (${(g/1024).toFixed(1)}KB) from ${Kt}/`)}let F={runtime:v.filename,router:x.filename},T=Ai(k,F,r);if(T.routeRules=w,T.routerContainer=D,b)T.apiRoutes=await Ys(a,r,C);if(e.runtimeConfig)await Bun.write(c.join(r,"server/runtime-config.json"),JSON.stringify(e.runtimeConfig)),await zo(a,e.runtimeConfig);if(e._layerGraph)await Bun.write(c.join(r,"server/layers.json"),JSON.stringify(Sa(e._layerGraph),null,2));Pi(T,r);let K=Date.now()-l;return console.log(`
3
3
  [stx build] Done in ${K}ms \u2014 ${M.length} pages compiled`),{pageCount:M.length,assets:F,outputDir:r,duration:K}}
4
4
  export{Bu};