@stacksjs/stx 0.2.584 → 0.2.586

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 (93) hide show
  1. package/dist/{chunk-9cpxzze0.js → chunk-03xsf9jm.js} +3 -3
  2. package/dist/{chunk-np6nm4rq.js → chunk-048eyjyj.js} +2 -2
  3. package/dist/{chunk-m3w67x05.js → chunk-076h7nb9.js} +4 -4
  4. package/dist/{chunk-g8mxprxj.js → chunk-33q5zka4.js} +1 -1
  5. package/dist/{chunk-sr1md7vv.js → chunk-3qmx12d3.js} +147 -147
  6. package/dist/chunk-3ybbat49.js +2 -0
  7. package/dist/{chunk-zgv1h2np.js → chunk-45x4myqe.js} +1 -1
  8. package/dist/{chunk-34kxj258.js → chunk-4dpab4j6.js} +1 -1
  9. package/dist/{chunk-t431anrx.js → chunk-4vnwge6p.js} +1 -1
  10. package/dist/chunk-4w37cqg9.js +2 -0
  11. package/dist/{chunk-6ebj7gfr.js → chunk-51pz8cwa.js} +1 -1
  12. package/dist/{chunk-zxt75k06.js → chunk-65agttgm.js} +1 -1
  13. package/dist/{chunk-5zg3xj45.js → chunk-6cg03r93.js} +2 -2
  14. package/dist/{chunk-9r5w6s80.js → chunk-751b5zv9.js} +1 -1
  15. package/dist/{chunk-j87tntna.js → chunk-7ae40484.js} +1 -1
  16. package/dist/{chunk-4efqcpg5.js → chunk-7dtyf7hq.js} +1 -1
  17. package/dist/{chunk-325dn55d.js → chunk-7ebt9n43.js} +2 -2
  18. package/dist/{chunk-mc8j6dwa.js → chunk-80g8kaes.js} +1 -1
  19. package/dist/{chunk-7ra30crf.js → chunk-91pdg853.js} +2 -2
  20. package/dist/chunk-9j6hk72q.js +2 -0
  21. package/dist/{chunk-qebxzf9w.js → chunk-9nt3q23a.js} +2 -2
  22. package/dist/{chunk-s5vxxwg6.js → chunk-9qsnq026.js} +2 -2
  23. package/dist/{chunk-s1ptn02h.js → chunk-a30mtx17.js} +3 -3
  24. package/dist/chunk-a3d5g1ss.js +122 -0
  25. package/dist/{chunk-t7mxbt40.js → chunk-a3k4nfq2.js} +1 -1
  26. package/dist/{chunk-k3rnpjxf.js → chunk-awgvt956.js} +3 -3
  27. package/dist/{chunk-n2gy2arh.js → chunk-b217d16p.js} +5 -5
  28. package/dist/{chunk-4wkghwag.js → chunk-bhg4pvtn.js} +1 -1
  29. package/dist/chunk-c8fdccgp.js +2 -0
  30. package/dist/{chunk-z2mg470f.js → chunk-cqr5cv7h.js} +1 -1
  31. package/dist/chunk-cw76edds.js +2 -0
  32. package/dist/{chunk-4myvw20e.js → chunk-cy07dhqh.js} +1 -1
  33. package/dist/{chunk-55n8mhq4.js → chunk-czrs87r9.js} +1 -1
  34. package/dist/{chunk-jqbk6pfk.js → chunk-d0tmc6v5.js} +1 -1
  35. package/dist/chunk-ddgyj88h.js +2 -0
  36. package/dist/{chunk-f0fxyh3e.js → chunk-dj90w48e.js} +1 -1
  37. package/dist/chunk-dngzks8e.js +2 -0
  38. package/dist/{chunk-71tnfe1n.js → chunk-emxa2djv.js} +1 -1
  39. package/dist/chunk-esj49jvz.js +2 -0
  40. package/dist/{chunk-w7zgftez.js → chunk-eztvhppz.js} +1 -1
  41. package/dist/{chunk-vvqxbhfx.js → chunk-h9gtc6bk.js} +1 -1
  42. package/dist/{chunk-49xtxzr8.js → chunk-haag5n42.js} +1 -1
  43. package/dist/{chunk-e6h7pzym.js → chunk-hj8tr9g0.js} +1 -1
  44. package/dist/{chunk-rdm5mfc5.js → chunk-htcptqtn.js} +3 -3
  45. package/dist/{chunk-53grq69s.js → chunk-hwnvfke9.js} +1 -1
  46. package/dist/chunk-j8v5164e.js +2 -0
  47. package/dist/{chunk-yhqaafsw.js → chunk-jqy5q8m0.js} +1 -1
  48. package/dist/{chunk-ebfpjnf3.js → chunk-jtx74677.js} +1 -1
  49. package/dist/{chunk-zxf8f71v.js → chunk-jy7yzat1.js} +1 -1
  50. package/dist/{chunk-agy4mxn8.js → chunk-kfhghjh6.js} +1 -1
  51. package/dist/{chunk-d2jb1rkp.js → chunk-m7ddgrsm.js} +2 -2
  52. package/dist/{chunk-9e091vkf.js → chunk-mnnxa3r7.js} +6 -6
  53. package/dist/{chunk-bs1bdhvp.js → chunk-n7yk4nc1.js} +1 -1
  54. package/dist/{chunk-hr34x6sx.js → chunk-q03kn4d1.js} +1 -1
  55. package/dist/{chunk-96zgn94z.js → chunk-qx0tcsdm.js} +4 -4
  56. package/dist/{chunk-4k6h00kk.js → chunk-r90v2jz6.js} +1 -1
  57. package/dist/{chunk-08g5j4fq.js → chunk-rtgf9fgc.js} +1 -1
  58. package/dist/{chunk-n0t938d2.js → chunk-s2h601k7.js} +2 -2
  59. package/dist/{chunk-c1c4sh7t.js → chunk-shzesarq.js} +1 -1
  60. package/dist/{chunk-wfp36qf4.js → chunk-sqpme1hg.js} +1 -1
  61. package/dist/{chunk-e26pzdxy.js → chunk-t212h9zm.js} +1 -1
  62. package/dist/chunk-thydj877.js +2 -0
  63. package/dist/chunk-vv1kr9dn.js +2 -0
  64. package/dist/{chunk-d4awfk42.js → chunk-wkrf41se.js} +1 -1
  65. package/dist/{chunk-cjq9k1xb.js → chunk-wm9nzg76.js} +1 -1
  66. package/dist/{chunk-b5van393.js → chunk-ww28zfwt.js} +1 -1
  67. package/dist/chunk-xnbkyj4g.js +2 -0
  68. package/dist/{chunk-wywprjc5.js → chunk-y09g63k0.js} +2 -2
  69. package/dist/{chunk-4szz2esp.js → chunk-y93y2qat.js} +1 -1
  70. package/dist/{chunk-h988fxh3.js → chunk-yhhfxx17.js} +1 -1
  71. package/dist/cli.js +9 -9
  72. package/dist/craft-entry.js +2 -2
  73. package/dist/craft.js +2 -2
  74. package/dist/native/accessibility.d.ts +18 -0
  75. package/dist/native/accessibility.js +89 -0
  76. package/dist/native/compiler/html-to-ir.js +6 -0
  77. package/dist/native/runtime/native-host.js +5 -0
  78. package/dist/pwa.js +1 -1
  79. package/dist/ssg.js +3 -3
  80. package/package.json +5 -5
  81. package/dist/chunk-5s229r1e.js +0 -2
  82. package/dist/chunk-8zn83jfs.js +0 -2
  83. package/dist/chunk-bqtph83n.js +0 -2
  84. package/dist/chunk-fjyhc41r.js +0 -2
  85. package/dist/chunk-fn4wwgnc.js +0 -2
  86. package/dist/chunk-kgtnfvqb.js +0 -2
  87. package/dist/chunk-krwrx9x9.js +0 -2
  88. package/dist/chunk-m5j8hht5.js +0 -2
  89. package/dist/chunk-n2j3pn9s.js +0 -2
  90. package/dist/chunk-q765v7b2.js +0 -2
  91. package/dist/chunk-sckze59r.js +0 -2
  92. package/dist/chunk-y5ryjdpv.js +0 -122
  93. package/dist/chunk-z7trbwn3.js +0 -2
@@ -1,7 +1,7 @@
1
1
  // @bun
2
2
  import S from"fs";import _ from"path";function Nr(e){let{token:t,baseUrl:i="https://api.netlify.com/api/v1"}=e;async function s(n,r,l={}){let p=`${i}${r}`,f={Authorization:`Bearer ${t}`,"User-Agent":"stx-deploy/1.0"},u;if(l.rawBody)f["Content-Type"]=l.contentType||"application/octet-stream",u=l.rawBody;else if(l.body)f["Content-Type"]="application/json",u=JSON.stringify(l.body);let o=await fetch(p,{method:n,headers:f,body:u});if(!o.ok){let g=Error(`Netlify API error: ${o.status} ${o.statusText}`);g.status=o.status;try{let b=await o.json();g.message=b.message||g.message,g.code=b.code,g.details=b}catch{}throw g}let a=await o.text();if(!a)return{};return JSON.parse(a)}return{async getSite(n){return s("GET",`/sites/${n}`)},async listSites(){return s("GET","/sites")},async createSite(n){let r={};if(n)r.name=n;return s("POST","/sites",{body:r})},async createDeploy(n,r){let l={files:r.files,draft:r.draft??!0,async:r.async??!0};if(r.title)l.title=r.title;if(r.branch)l.branch=r.branch;if(r.functions)l.functions=r.functions;return s("POST",`/sites/${n}/deploys`,{body:l})},async uploadFile(n,r,l){let p=r.startsWith("/")?r.slice(1):r;await s("PUT",`/deploys/${n}/files/${p}`,{rawBody:l,contentType:"application/octet-stream"})},async uploadFiles(n,r){let p=[...r],f=async()=>{while(p.length>0){let o=p.shift();if(o)await this.uploadFile(n,o.path,o.content)}},u=Array.from({length:Math.min(5,r.length)},()=>f());await Promise.all(u)},async getDeploy(n){return s("GET",`/deploys/${n}`)},async waitForDeploy(n,r={}){let{timeout:l=300000,pollInterval:p=2000,onProgress:f}=r,u=Date.now();while(!0){let o=await this.getDeploy(n);if(f)f(o);if(o.state==="ready")return o;if(o.state==="error"){let a=Error(`Deploy failed: ${o.error_message||"Unknown error"}`);throw a.status=500,a.details=o,a}if(Date.now()-u>l){let a=Error(`Deploy timed out after ${l}ms`);throw a.status=408,a.details=o,a}await new Promise((a)=>setTimeout(a,p))}},async lockDeploy(n){return s("POST",`/deploys/${n}/lock`)},async unlockDeploy(n){return s("POST",`/deploys/${n}/unlock`)}}}async function yo(e){let t=await crypto.subtle.digest("SHA-1",e);return Array.from(new Uint8Array(t)).map((s)=>s.toString(16).padStart(2,"0")).join("")}async function zn(e,t={}){let{ignore:i=["node_modules",".git",".env*","*.map"]}=t,s=[],n=new Bun.Glob("**/*");for await(let r of n.scan({cwd:e,onlyFiles:!0,dot:!1})){if(i.some((a)=>{if(a.includes("*"))return new RegExp(`^${a.replace(/\*/g,".*")}$`).test(r);return r.includes(a)}))continue;let p=`${e}/${r}`,u=await Bun.file(p).arrayBuffer(),o=await yo(u);s.push({path:r,content:new Uint8Array(u),sha1:o})}return s}function Mr(e){let t={};for(let i of e)t[`/${i.path}`]=i.sha1;return t}function Lr(e,t){let i=new Set(t.map((s)=>s.startsWith("/")?s.slice(1):s));return e.filter((s)=>i.has(s.path))}function zt(e){if(e<1024)return`${e} B`;if(e<1048576)return`${(e/1024).toFixed(1)} KB`;if(e<1073741824)return`${(e/1048576).toFixed(1)} MB`;return`${(e/1073741824).toFixed(1)} GB`}function gt(e){return e.reduce((t,i)=>t+i.content.byteLength,0)}import m from"fs";import y from"path";function bo(e){let t=[];if(t.push("[build]"),t.push(` command = "${d(e.build.command)}"`),t.push(` publish = "${d(e.build.publish)}"`),e.build.functions)t.push(` functions = "${d(e.build.functions)}"`);if(e.build.edge_functions)t.push(` edge_functions = "${d(e.build.edge_functions)}"`);if(e.build.environment&&Object.keys(e.build.environment).length>0){t.push(""),t.push("[build.environment]");for(let[i,s]of Object.entries(e.build.environment))t.push(` ${i} = "${d(s)}"`)}if(e.functions){if(t.push(""),t.push("[functions]"),e.functions.directory)t.push(` directory = "${d(e.functions.directory)}"`);if(e.functions.node_bundler)t.push(` node_bundler = "${e.functions.node_bundler}"`);if(e.functions.external_node_modules&&e.functions.external_node_modules.length>0)t.push(` external_node_modules = [${e.functions.external_node_modules.map((i)=>`"${i}"`).join(", ")}]`)}if(e.edge_functions&&e.edge_functions.length>0){t.push("");for(let i of e.edge_functions)t.push("[[edge_functions]]"),t.push(` function = "${d(i.function)}"`),t.push(` path = "${d(i.path)}"`)}if(e.redirects&&e.redirects.length>0){t.push("");for(let i of e.redirects){if(t.push("[[redirects]]"),t.push(` from = "${d(i.from)}"`),t.push(` to = "${d(i.to)}"`),i.status!==void 0)t.push(` status = ${i.status}`);if(i.force!==void 0)t.push(` force = ${i.force}`);if(i.conditions&&Object.keys(i.conditions).length>0){t.push(" [redirects.conditions]");for(let[s,n]of Object.entries(i.conditions))t.push(` ${s} = "${d(n)}"`)}}}if(e.headers&&e.headers.length>0){t.push("");for(let i of e.headers){t.push("[[headers]]"),t.push(` for = "${d(i.for)}"`),t.push(" [headers.values]");for(let[s,n]of Object.entries(i.values))t.push(` ${s} = "${d(n)}"`)}}if(e.plugins&&e.plugins.length>0){t.push("");for(let i of e.plugins)if(t.push("[[plugins]]"),t.push(` package = "${d(i.package)}"`),i.inputs&&Object.keys(i.inputs).length>0){t.push(" [plugins.inputs]");for(let[s,n]of Object.entries(i.inputs))if(typeof n==="string")t.push(` ${s} = "${d(n)}"`);else if(typeof n==="boolean"||typeof n==="number")t.push(` ${s} = ${n}`)}}if(e.context&&Object.keys(e.context).length>0)for(let[i,s]of Object.entries(e.context)){if(t.push(""),t.push(`[context.${i}]`),s.command)t.push(` command = "${d(s.command)}"`);if(s.publish)t.push(` publish = "${d(s.publish)}"`);if(s.environment&&Object.keys(s.environment).length>0){t.push(` [context.${i}.environment]`);for(let[n,r]of Object.entries(s.environment))t.push(` ${n} = "${d(r)}"`)}}return t.join(`
3
3
  `)+`
4
- `}function d(e){return e.replace(/\\/g,"\\\\").replace(/"/g,"\\\"").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t")}async function Hn(e){let t={framework:"stx",buildCommand:"bun run build",outputDir:"dist"},i=y.join(e,"package.json");if(await Bun.file(i).exists())try{let u=JSON.parse(await Bun.file(i).text());if(u.scripts?.build)t.buildCommand="bun run build";let o={...u.dependencies,...u.devDependencies};if(o["@stacksjs/stx"]||o.stx)t.framework="stx"}catch{}let s=y.join(e,"stx.config.ts"),n=y.join(e,".config","stx.config.ts");if(await Bun.file(s).exists()||await Bun.file(n).exists())t.framework="stx";let r=["dist","build","out","public",".output"];for(let u of r){let o=y.join(e,u);if(m.existsSync(o)&&m.statSync(o).isDirectory()){t.outputDir=u;break}}let l=["functions","netlify/functions","api"];for(let u of l){let o=y.join(e,u);if(m.existsSync(o)&&m.statSync(o).isDirectory()){t.functionsDir=u;break}}let p=y.join(e,"netlify","edge-functions");if(m.existsSync(p))t.edgeFunctionsDir="netlify/edge-functions";let f=y.join(e,t.outputDir||"dist");if(m.existsSync(f)){let u=m.existsSync(y.join(f,"index.html")),o=m.readdirSync(f).filter((a)=>a.endsWith(".html"));t.isSPA=u&&o.length===1}return t}function Un(e={}){let t={build:{command:e.buildCommand||"bun run build",publish:e.outputDir||"dist"}};if(e.functionsDir)t.build.functions=e.functionsDir,t.functions={directory:e.functionsDir,node_bundler:"esbuild"};if(e.edgeFunctionsDir)t.build.edge_functions=e.edgeFunctionsDir;if(t.headers=[{for:"/*",values:{"X-Frame-Options":"DENY","X-Content-Type-Options":"nosniff","X-XSS-Protection":"1; mode=block","Referrer-Policy":"strict-origin-when-cross-origin"}},{for:"/assets/*",values:{"Cache-Control":"public, max-age=31536000, immutable"}}],e.isSPA!==!1)t.redirects=[{from:"/*",to:"/index.html",status:200}];return t.context={production:{environment:{NODE_ENV:"production"}},"deploy-preview":{environment:{NODE_ENV:"development"}}},t}async function jr(e,t){let i=await Hn(e),s=t||Un(i),n=bo(s),r=y.join(e,"netlify.toml");return await Bun.write(r,n),r}function Br(e){return m.existsSync(y.join(e,"netlify.toml"))}async function yl(e={}){let t=Date.now(),i=[],s=e.cwd||process.cwd(),n=(c)=>{i.push(c)},r=(c)=>{if(e.onProgress)e.onProgress(c)},l=_.resolve(s,e.directory||"dist"),p=e.token||process.env.NETLIFY_AUTH_TOKEN,f=e.siteId||process.env.NETLIFY_SITE_ID;if(!p)throw new Ie(`No Netlify auth token found.
4
+ `}function d(e){return e.replace(/\\/g,"\\\\").replace(/"/g,"\\\"").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t")}async function Hn(e){let t={framework:"stx",buildCommand:"bun run build",outputDir:"dist"},i=y.join(e,"package.json");if(await Bun.file(i).exists())try{let u=JSON.parse(await Bun.file(i).text());if(u.scripts?.build)t.buildCommand="bun run build";let o={...u.dependencies,...u.devDependencies};if(o["@stacksjs/stx"]||o.stx)t.framework="stx"}catch{}let s=y.join(e,"stx.config.ts"),n=y.join(e,".config","stx.config.ts");if(await Bun.file(s).exists()||await Bun.file(n).exists())t.framework="stx";let r=["dist","build","out","public",".output"];for(let u of r){let o=y.join(e,u);if(m.existsSync(o)&&m.statSync(o).isDirectory()){t.outputDir=u;break}}let l=["functions","netlify/functions","api"];for(let u of l){let o=y.join(e,u);if(m.existsSync(o)&&m.statSync(o).isDirectory()){t.functionsDir=u;break}}let p=y.join(e,"netlify","edge-functions");if(m.existsSync(p))t.edgeFunctionsDir="netlify/edge-functions";let f=y.join(e,t.outputDir||"dist");if(m.existsSync(f)){let u=m.existsSync(y.join(f,"index.html")),o=m.readdirSync(f).filter((a)=>a.endsWith(".html"));t.isSPA=u&&o.length===1}return t}function Vn(e={}){let t={build:{command:e.buildCommand||"bun run build",publish:e.outputDir||"dist"}};if(e.functionsDir)t.build.functions=e.functionsDir,t.functions={directory:e.functionsDir,node_bundler:"esbuild"};if(e.edgeFunctionsDir)t.build.edge_functions=e.edgeFunctionsDir;if(t.headers=[{for:"/*",values:{"X-Frame-Options":"DENY","X-Content-Type-Options":"nosniff","X-XSS-Protection":"1; mode=block","Referrer-Policy":"strict-origin-when-cross-origin"}},{for:"/assets/*",values:{"Cache-Control":"public, max-age=31536000, immutable"}}],e.isSPA!==!1)t.redirects=[{from:"/*",to:"/index.html",status:200}];return t.context={production:{environment:{NODE_ENV:"production"}},"deploy-preview":{environment:{NODE_ENV:"development"}}},t}async function jr(e,t){let i=await Hn(e),s=t||Vn(i),n=bo(s),r=y.join(e,"netlify.toml");return await Bun.write(r,n),r}function Br(e){return m.existsSync(y.join(e,"netlify.toml"))}async function yl(e={}){let t=Date.now(),i=[],s=e.cwd||process.cwd(),n=(c)=>{i.push(c)},r=(c)=>{if(e.onProgress)e.onProgress(c)},l=_.resolve(s,e.directory||"dist"),p=e.token||process.env.NETLIFY_AUTH_TOKEN,f=e.siteId||process.env.NETLIFY_SITE_ID;if(!p)throw new Ie(`No Netlify auth token found.
5
5
 
6
6
  To deploy to Netlify:
7
7
  1. Create account at https://app.netlify.com
@@ -21,10 +21,10 @@ Run \`stx build\` first or specify a different directory with --directory`,"NO_B
21
21
 
22
22
  Run \`stx build\` to generate files`,"EMPTY_BUILD_DIR");if(e.dryRun){r({stage:"collect",message:"Collecting files..."});let c=await zn(l),w=gt(c);return n(`Would deploy ${c.length} files (${zt(w)})`),n(`From: ${l}`),n(`To: Site ${f}`),n(`Mode: ${e.production?"production":"draft"}`),{success:!0,url:`https://${f}.netlify.app (dry-run)`,deployId:"dry-run",logs:i,duration:Date.now()-t,filesUploaded:c.length,totalSize:w}}let o=Nr({token:p});r({stage:"collect",message:"Verifying site..."});try{let c=await o.getSite(f);n(`Deploying to: ${c.name} (${c.url})`)}catch(c){if(c.status===404)throw new Ie(`Site not found: ${f}
23
23
 
24
- Check your site ID or create a new site at https://app.netlify.com`,"SITE_NOT_FOUND");throw c}r({stage:"collect",message:"Collecting files..."});let a=await zn(l),g=gt(a);if(n(`Found ${a.length} files (${zt(g)})`),a.length===0)throw new Ie(`No files found in ${l}`,"NO_FILES");let b=Mr(a);r({stage:"upload",message:"Creating deploy...",percent:0});let D=await o.createDeploy(f,{title:e.message||"Deploy from stx CLI",draft:!e.production,files:b});n(`Created deploy: ${D.id}`);let h=Lr(a,D.required||[]);if(n(`Uploading ${h.length} files...`),h.length>0){let c=0,w=gt(h);for(let x of h){await o.uploadFile(D.id,x.path,x.content),c++;let C=Math.round(c/h.length*100);r({stage:"upload",message:`Uploading: ${x.path}`,percent:C,details:{uploaded:c,total:h.length}})}n(`Uploaded ${zt(w)}`)}else n("All files already on CDN (no upload needed)");r({stage:"process",message:"Processing deploy..."});let N=await o.waitForDeploy(D.id,{onProgress:(c)=>{r({stage:"process",message:`Status: ${c.state}`,details:c})}}),P=Date.now()-t;if(r({stage:"done",message:"Deploy complete!"}),n(`Deploy complete in ${(P/1000).toFixed(1)}s`),n(`URL: ${N.deploy_ssl_url}`),e.production)n(`Site: ${N.ssl_url}`);if(e.open){let c=e.production?N.ssl_url:N.deploy_ssl_url;I(c)}return{success:!0,url:N.deploy_ssl_url,siteUrl:e.production?N.ssl_url:void 0,deployId:N.id,logs:i,duration:P,filesUploaded:h.length,totalSize:gt(h)}}async function bl(e={}){let t=e.directory||process.cwd(),i;if(Br(t))i=_.join(t,"netlify.toml");else{let s=await Hn(t);i=await jr(t,Un(s))}if(e.siteId){let s=_.join(t,".env.local"),n="";if(await Bun.file(s).exists()){if(n=await Bun.file(s).text(),n=n.split(`
24
+ Check your site ID or create a new site at https://app.netlify.com`,"SITE_NOT_FOUND");throw c}r({stage:"collect",message:"Collecting files..."});let a=await zn(l),g=gt(a);if(n(`Found ${a.length} files (${zt(g)})`),a.length===0)throw new Ie(`No files found in ${l}`,"NO_FILES");let b=Mr(a);r({stage:"upload",message:"Creating deploy...",percent:0});let D=await o.createDeploy(f,{title:e.message||"Deploy from stx CLI",draft:!e.production,files:b});n(`Created deploy: ${D.id}`);let h=Lr(a,D.required||[]);if(n(`Uploading ${h.length} files...`),h.length>0){let c=0,w=gt(h);for(let x of h){await o.uploadFile(D.id,x.path,x.content),c++;let C=Math.round(c/h.length*100);r({stage:"upload",message:`Uploading: ${x.path}`,percent:C,details:{uploaded:c,total:h.length}})}n(`Uploaded ${zt(w)}`)}else n("All files already on CDN (no upload needed)");r({stage:"process",message:"Processing deploy..."});let N=await o.waitForDeploy(D.id,{onProgress:(c)=>{r({stage:"process",message:`Status: ${c.state}`,details:c})}}),P=Date.now()-t;if(r({stage:"done",message:"Deploy complete!"}),n(`Deploy complete in ${(P/1000).toFixed(1)}s`),n(`URL: ${N.deploy_ssl_url}`),e.production)n(`Site: ${N.ssl_url}`);if(e.open){let c=e.production?N.ssl_url:N.deploy_ssl_url;I(c)}return{success:!0,url:N.deploy_ssl_url,siteUrl:e.production?N.ssl_url:void 0,deployId:N.id,logs:i,duration:P,filesUploaded:h.length,totalSize:gt(h)}}async function bl(e={}){let t=e.directory||process.cwd(),i;if(Br(t))i=_.join(t,"netlify.toml");else{let s=await Hn(t);i=await jr(t,Vn(s))}if(e.siteId){let s=_.join(t,".env.local"),n="";if(await Bun.file(s).exists()){if(n=await Bun.file(s).text(),n=n.split(`
25
25
  `).filter((r)=>!r.startsWith("NETLIFY_SITE_ID=")).join(`
26
26
  `),n&&!n.endsWith(`
27
27
  `))n+=`
28
28
  `}n+=`NETLIFY_SITE_ID=${e.siteId}
29
29
  `,await Bun.write(s,n)}return{configPath:i,siteId:e.siteId}}class Ie extends Error{code;constructor(e,t){super(e);this.name="DeployError",this.code=t}}function I(e){let t=process.platform,i=t==="darwin"?"open":t==="win32"?"start":"xdg-open";Bun.spawn([i,e],{stdio:["ignore","ignore","ignore"]})}
30
- export{Nr,yo,zn,Mr,Lr,zt,gt,bo,Hn,Un,jr,Br,yl,bl,Ie};
30
+ export{Nr,yo,zn,Mr,Lr,zt,gt,bo,Hn,Vn,jr,Br,yl,bl,Ie};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{G,b,fn,gn,e,Pt,bn,f,Ue,It,Ve,We,te,L,de,J,u,xe,Ri,Os,n,r,ne,dr,o,P,pe}from"./chunk-sr1md7vv.js";import{Y,An,re,I,Lt}from"./chunk-qhr1tkhj.js";import{rt,Nn,_r,Er,Tr,st,ot,it,at,ct,lt,Ee}from"./chunk-pxw4edw8.js";import{Oe,Co,se,T,_o,Fr,Vn,ye,Eo,oe}from"./chunk-m3w67x05.js";import{Ft}from"./chunk-agy4mxn8.js";import{le}from"./chunk-3y5tzxm6.js";import{a}from"./chunk-sjkdpsca.js";import{N}from"./chunk-ede39b7h.js";async function Gn(t){try{let s=await Bun.file(t).text(),i=Jn(s),d=Yn(s,t),c=Qn(s,i),l=Zn(s,i);return{file:t,metrics:i,issues:d,suggestions:c,performance:l}}catch(s){throw Error(`Failed to analyze template ${t}: ${s instanceof Error?s.message:String(s)}`)}}function Jn(t){let s=t.split(`
2
+ import{G,b,fn,gn,e,Pt,bn,f,Ve,It,Ue,We,te,L,de,J,u,xe,Ri,Os,n,r,ne,dr,o,P,pe}from"./chunk-3qmx12d3.js";import{Y,An,re,I,Lt}from"./chunk-qhr1tkhj.js";import{rt,Nn,_r,Er,Tr,st,ot,it,at,ct,lt,Ee}from"./chunk-pxw4edw8.js";import{Oe,Co,se,T,_o,Fr,Un,ye,Eo,oe}from"./chunk-076h7nb9.js";import{Ft}from"./chunk-kfhghjh6.js";import{le}from"./chunk-3y5tzxm6.js";import{a}from"./chunk-sjkdpsca.js";import{N}from"./chunk-ede39b7h.js";async function Gn(t){try{let s=await Bun.file(t).text(),i=Jn(s),d=Yn(s,t),c=Qn(s,i),l=Zn(s,i);return{file:t,metrics:i,issues:d,suggestions:c,performance:l}}catch(s){throw Error(`Failed to analyze template ${t}: ${s instanceof Error?s.message:String(s)}`)}}function Jn(t){let s=t.split(`
3
3
  `),i=t.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),c=(i?i[1]:"").split(`
4
4
  `).length,l={conditionals:(t.match(/@(if|unless|elseif|else|endif|endunless)\b/g)||[]).length,loops:(t.match(/@(foreach|for|endforeach|endfor|while|endwhile)\b/g)||[]).length,includes:(t.match(/@(include|component|extends|section|yield)\b/g)||[]).length,custom:0,total:0};l.total=l.conditionals+l.loops+l.includes+l.custom;let m=(t.match(/\{\{[\s\S]*?\}\}/g)||[]).length,p=(t.match(/\{!![\s\S]*?!!\}/g)||[]).length,h=(t.match(/@(?:if|unless|elseif|foreach|for|while)\s*\([^)]+\)/g)||[]).length,g=m+p+h,y=(t.match(/<[A-Z][^>]*>/g)||[]).length,w=(t.match(/@(?:layout|extends)\(/g)||[]).length,S=0,R=0;for(let C of s)if(/@(?:if|unless|foreach|for|while|section)\b/.test(C)&&!/@end/.test(C)&&!/@else/.test(C))R++,S=Math.max(S,R);else if(/@end(?:if|unless|foreach|for|while|section)\b/.test(C))R--;let v=S>=4?3:0,x=Math.min(10,Math.ceil(l.total*0.5+g*0.1+y*0.3+(c>10?c*0.05:0)+v));return{lines:s.length,characters:t.length,directives:l,expressions:g,components:y,layouts:w,scriptLines:c,complexity:x}}function Yn(t,s){let i=[],d=Jt(t,"if","endif");if(d>0)i.push({type:"error",category:"syntax",message:`Found ${d} unmatched @if directive(s)`,suggestion:"Ensure every @if has a corresponding @endif"});let c=Jt(t,"foreach","endforeach");if(c>0)i.push({type:"error",category:"syntax",message:`Found ${c} unmatched @foreach directive(s)`,suggestion:"Ensure every @foreach has a corresponding @endforeach"});let l=t.match(/@foreach[\s\S]*?@foreach[\s\S]*?@endforeach[\s\S]*?@endforeach/g);if(l&&l.length>0)i.push({type:"warning",category:"performance",message:"Nested loops detected which may impact performance",suggestion:"Consider preprocessing data or using more efficient data structures"});let m=(t.match(/\{!![\s\S]*?!!\}/g)||[]).length;if(m>0)i.push({type:"warning",category:"security",message:`Found ${m} raw output expression(s) {!! !!}`,suggestion:"Ensure raw outputs are properly sanitized to prevent XSS"});let p=t.match(/<img[^>]*>/g);if(p){let y=p.filter((w)=>!w.includes("alt="));if(y.length>0)i.push({type:"warning",category:"accessibility",message:`Found ${y.length} image(s) without alt attributes`,suggestion:"Add alt attributes to all images for screen reader accessibility"})}let h=t.split(`
5
5
  `).filter((y)=>y.length>120);if(h.length>0)i.push({type:"info",category:"maintainability",message:`Found ${h.length} line(s) longer than 120 characters`,suggestion:"Consider breaking long lines for better readability"});let g=(t.match(/style\s*=\s*["'][^"']*["']/g)||[]).length;if(g>3)i.push({type:"info",category:"maintainability",message:`Found ${g} inline style attributes`,suggestion:"Consider moving styles to CSS classes for better maintainability"});return i}function Qn(t,s){let i=[];if(s.complexity>7)i.push({type:"refactor",message:"Template complexity is high. Consider breaking into smaller components.",impact:"high",effort:"medium"});else if(s.complexity>5&&s.directives.total>8)i.push({type:"optimization",message:"Template has moderate complexity. Consider component extraction for reusability.",impact:"medium",effort:"low"});if(s.lines>100&&s.components===0)i.push({type:"refactor",message:"Large template with no components. Consider extracting reusable parts into components.",impact:"medium",effort:"medium"});if(s.expressions>20)i.push({type:"optimization",message:"Many template expressions detected. Consider preprocessing some data in the script section.",impact:"medium",effort:"low"});let d=t.match(/@foreach[\s\S]*?@foreach[\s\S]*?@endforeach[\s\S]*?@endforeach/g);if(d&&d.length>0)i.push({type:"optimization",message:"Nested loops detected. Consider preprocessing data or optimizing data structures.",impact:"high",effort:"medium"});if(s.directives.total===0&&s.expressions<5)i.push({type:"optimization",message:"Template appears static. Consider enabling aggressive caching.",impact:"high",effort:"low"});if(s.scriptLines>50)i.push({type:"refactor",message:"Large script section. Consider moving complex logic to external modules.",impact:"medium",effort:"medium"});return i}function Zn(t,s){let i=1;if(i+=s.directives.conditionals*0.1,i+=s.directives.loops*0.5,i+=s.directives.includes*2,i+=s.expressions*0.05,i+=s.components*1,s.scriptLines>10)i+=s.scriptLines*0.1;let d;if(s.expressions===0&&s.directives.total===0)d="high";else if(s.expressions<5&&s.directives.total<3)d="medium";else d="low";let c=[];if(i>10)c.push("Consider optimizing template complexity");if(d==="low"&&s.directives.total>5)c.push("Reduce dynamic content for better caching");if(s.components===0&&s.lines>40)c.push("Extract components to improve reusability and performance");return{estimatedRenderTime:Math.round(i*100)/100,complexityScore:s.complexity,cacheability:d,recommendations:c}}function Jt(t,s,i){let d=t.replace(/<!--[\s\S]*?-->/g,""),c=(d.match(new RegExp(`@${s}\\b`,"g"))||[]).length,l=(d.match(new RegExp(`@${i}\\b`,"g"))||[]).length;return Math.abs(c-l)}async function uo(t=["**/*.stx"],s){let i=[],d=[];for(let l of t){let m=await Array.fromAsync(new Bun.Glob(l).scan({cwd:s||process.cwd(),onlyFiles:!0,absolute:!0}));d.push(...m.filter((p)=>p.endsWith(".stx")))}for(let l of d)try{let m=await Gn(l);i.push(m)}catch(m){console.warn(`Failed to analyze ${l}:`,m)}let c=er(i);return{results:i,summary:c}}function er(t){let s=t.length,i=t.reduce((g,y)=>g+y.metrics.lines,0),d=s>0?t.reduce((g,y)=>g+y.metrics.complexity,0)/s:0,c=t.reduce((g,y)=>g+y.issues.length,0),l={};t.forEach((g)=>{g.issues.forEach((y)=>{l[y.category]=(l[y.category]||0)+1})});let m=s>0?t.reduce((g,y)=>g+y.performance.estimatedRenderTime,0)/s:0,p=Math.max(1,Math.min(10,Math.round(10-m/2-d/2))),h=[];if(d>6)h.push("Project has high average complexity. Consider refactoring complex templates.");if(c>s*2)h.push("High number of issues detected. Run detailed analysis on individual files.");if(l.security>0)h.push("Security issues found. Review raw output usage and input sanitization.");return{totalFiles:s,totalLines:i,avgComplexity:Math.round(d*100)/100,totalIssues:c,issuesByCategory:l,performanceScore:p,recommendations:h}}import{mkdir as tr,readFile as nr,readdir as rr,stat as Yt,writeFile as or}from"fs/promises";import Pe from"path";function rn(t){if(t==="connectedCallback")return`method "${t}" is reserved; define "onConnect" instead, which the element calls once it is connected, rendered and bound`;if(t==="disconnectedCallback")return`method "${t}" is reserved; define "onDisconnect" instead, which the element calls as it leaves the DOM, before it releases its own listeners`;return`method "${t}" is reserved`}var on=new Set(["constructor","connectedCallback","disconnectedCallback","attributeChangedCallback","adoptedCallback"]);function sr(t){return t.replace(/\.stx$/i,"").split(/[^a-z0-9]+/i).filter(Boolean).map((s)=>s.charAt(0).toUpperCase()+s.slice(1)).join("")}function Bt(t){return t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/[^a-z0-9]+/gi,"-").replace(/^-+|-+$/g,"").toLowerCase()}function ir(t){return/^[a-z][.0-9_a-z-]*-[.0-9_a-z-]*$/.test(t)&&!t.startsWith("xml")&&!/[A-Z]/.test(t)}function ar(t){if(t===!0)return"open";if(t==="open"||t==="closed")return t;return!1}async function cr(t){let s=[];async function i(d){let c=await rr(d,{withFileTypes:!0});c.sort((l,m)=>l.name.localeCompare(m.name));for(let l of c){let m=Pe.join(d,l.name);if(l.isDirectory()){if(!l.name.startsWith(".")&&l.name!=="node_modules")await i(m)}else if(l.isFile()&&l.name.endsWith(".stx")&&!/\.(?:test|spec)\.stx$/i.test(l.name))s.push(m)}}return await i(t),s}function lr(t,s){let i=t.match(/<script\b(?=[^>]*(?:\bcomponent\b|\bstx:component\b))[^>]*>([\s\S]*?)<\/script>/i);if(!i)return{};let d=i[1].trim();if(!d)return{};try{return JSON.parse(d)}catch(c){throw Error(`${s}: <script component> must contain JSON metadata (${c.message})`)}}function pr(t,s){let i={},d=[...t.matchAll(/<script\b([^>]*)>([\s\S]*?)<\/script>/gi)];for(let c of d){if(!/\bclient\b/i.test(c[1])||/\bcomponent\b|\bstx:component\b/i.test(c[1]))continue;let l;try{l=new Bun.Transpiler({loader:"ts"}).transformSync(c[2])}catch(h){throw Error(`${s}: failed to transpile <script client> (${h.message})`)}let m=/(?:export\s+)?(?:async\s+)?function\s+([A-Za-z_$][\w$]*)\s*\(([^)]*)\)\s*\{/g,p;while(p=m.exec(l)){let h=p[1];if(on.has(h))throw Error(`${s}: client ${rn(h)}`);let g=m.lastIndex,y=1,w="",S=!1,R=g;for(;R<l.length&&y>0;R++){let x=l[R];if(S){S=!1;continue}if(w){if(x==="\\")S=!0;else if(x===w)w="";continue}if(x==='"'||x==="'"||x==="`")w=x;else if(x==="{")y++;else if(x==="}")y--}if(y!==0)throw Error(`${s}: unterminated client function "${h}"`);let v=p[0].includes("async")?"async ":"";i[h]=`${v}${h}(${p[2]}) {${l.slice(g,R-1)}}`,m.lastIndex=R}}return i}function ur(t){let s=t.match(/<template\b(?![^>]*\bshadowrootmode\b)[^>]*>([\s\S]*?)<\/template>/i);return(s?s[1]:t).replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"").trim()}function Qt(t){return[...t.matchAll(/<style\b[^>]*>([\s\S]*?)<\/style>/gi)].map((s)=>s[1].trim()).filter(Boolean).join(`
@@ -876,7 +876,7 @@ else {
876
876
  };
877
877
  })();
878
878
  </script>
879
- `}function Xe(t,s,i={}){let d=Xr(s,i),c=t.lastIndexOf("</body>");if(c!==-1)return t.slice(0,c)+d+t.slice(c);if(t.includes("</html>"))return t.replace("</html>",`${d}</html>`);return t+d}function $t(t){let s=t.toLowerCase();return s.endsWith(".css")||s.endsWith(".scss")||s.endsWith(".sass")||s.endsWith(".less")}function Ct(t){let s=t.toLowerCase();return[".stx",".html",".htm",".md",".js",".ts",".jsx",".tsx",".json"].some((d)=>s.endsWith(d))}function Rt(t){return[/^\./,/node_modules/,/\.stx\/output/,/\.stx\/cache/,/~$/,/\.swp$/,/\.swo$/].some((i)=>i.test(t))}var ut=null;function Et(t){if(!ut)ut=new an(t);return ut}function ht(){if(ut)ut.stop(),ut=null}import Ot from"path";var ft={name:"bun-plugin-stx",async setup(t){let i={...await o(),...t.config?.stx},d=new Set,c=i.webComponents?.enabled?`./${Ot.relative(Ot.dirname(t.config?.outdir||"dist"),i.webComponents.outputDir||"dist/web-components")}`:"/web-components",l=[];if(i.webComponents?.enabled)try{let m=await dr(i,d);if(l.push(...m),i.debug&&m.length>0)console.log(`Successfully built ${m.length} web components`)}catch(m){console.error("Failed to build web components:",m)}t.onLoad({filter:/\.stx$/},async({path:m})=>{try{let p=new Set;if(i.cache&&i.cachePath){let x=await fn(m,i);if(x){if(i.debug)console.log(`Using cached version of ${m}`);return{contents:x,loader:"html"}}}let h=await re(()=>Bun.file(m).text(),"",(x)=>{throw new An(`Failed to read stx file: ${m}`,m,void 0,void 0,`File read error: ${x.message}`)});if(!h)throw new An(`stx file is empty: ${m}`,m);let{scriptContent:g,templateContent:y,allScripts:w}=G.time("script-extraction",()=>{let x=h,C=te(h);if(C)x=C.content.trim();let k=h.match(/<script\b[^>]*>[\s\S]*?<\/script>/gi)||[],H="",D=[];for(let E of k){let M=E.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i)?.[1]||"",B=E.match(/<script\b([^>]*)>/i),q=B?B[1]:"";if(/\bserver\b/i.test(q))H=M;else D.push(E)}let _=x.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"");return{scriptContent:H,templateContent:_,allScripts:D}}),S={__filename:m,__dirname:Ot.dirname(m),__stx:{webComponentsPath:c,builtComponents:l}};await re(()=>u(g,S,m),void 0,(x)=>{let C=new Y(`Script execution failed in ${m}: ${x.message}`,m,void 0,void 0,g.substring(0,100));if(I.log(C,{filePath:m,scriptContent:g}),i.debug)throw C});let v=await G.timeAsync("directive-processing",async()=>await n(y,S,m,i,p));if(w.length>0){let{interpolateScriptsInTemplate:x}=await import("./chunk-wfp36qf4.js"),C=x(w.join(`
879
+ `}function Xe(t,s,i={}){let d=Xr(s,i),c=t.lastIndexOf("</body>");if(c!==-1)return t.slice(0,c)+d+t.slice(c);if(t.includes("</html>"))return t.replace("</html>",`${d}</html>`);return t+d}function $t(t){let s=t.toLowerCase();return s.endsWith(".css")||s.endsWith(".scss")||s.endsWith(".sass")||s.endsWith(".less")}function Ct(t){let s=t.toLowerCase();return[".stx",".html",".htm",".md",".js",".ts",".jsx",".tsx",".json"].some((d)=>s.endsWith(d))}function Rt(t){return[/^\./,/node_modules/,/\.stx\/output/,/\.stx\/cache/,/~$/,/\.swp$/,/\.swo$/].some((i)=>i.test(t))}var ut=null;function Et(t){if(!ut)ut=new an(t);return ut}function ht(){if(ut)ut.stop(),ut=null}import Ot from"path";var ft={name:"bun-plugin-stx",async setup(t){let i={...await o(),...t.config?.stx},d=new Set,c=i.webComponents?.enabled?`./${Ot.relative(Ot.dirname(t.config?.outdir||"dist"),i.webComponents.outputDir||"dist/web-components")}`:"/web-components",l=[];if(i.webComponents?.enabled)try{let m=await dr(i,d);if(l.push(...m),i.debug&&m.length>0)console.log(`Successfully built ${m.length} web components`)}catch(m){console.error("Failed to build web components:",m)}t.onLoad({filter:/\.stx$/},async({path:m})=>{try{let p=new Set;if(i.cache&&i.cachePath){let x=await fn(m,i);if(x){if(i.debug)console.log(`Using cached version of ${m}`);return{contents:x,loader:"html"}}}let h=await re(()=>Bun.file(m).text(),"",(x)=>{throw new An(`Failed to read stx file: ${m}`,m,void 0,void 0,`File read error: ${x.message}`)});if(!h)throw new An(`stx file is empty: ${m}`,m);let{scriptContent:g,templateContent:y,allScripts:w}=G.time("script-extraction",()=>{let x=h,C=te(h);if(C)x=C.content.trim();let k=h.match(/<script\b[^>]*>[\s\S]*?<\/script>/gi)||[],H="",D=[];for(let E of k){let M=E.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i)?.[1]||"",B=E.match(/<script\b([^>]*)>/i),q=B?B[1]:"";if(/\bserver\b/i.test(q))H=M;else D.push(E)}let _=x.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"");return{scriptContent:H,templateContent:_,allScripts:D}}),S={__filename:m,__dirname:Ot.dirname(m),__stx:{webComponentsPath:c,builtComponents:l}};await re(()=>u(g,S,m),void 0,(x)=>{let C=new Y(`Script execution failed in ${m}: ${x.message}`,m,void 0,void 0,g.substring(0,100));if(I.log(C,{filePath:m,scriptContent:g}),i.debug)throw C});let v=await G.timeAsync("directive-processing",async()=>await n(y,S,m,i,p));if(w.length>0){let{interpolateScriptsInTemplate:x}=await import("./chunk-sqpme1hg.js"),C=x(w.join(`
880
880
  `),S),k=v.search(/<\/body>/i);if(k!==-1)v=v.slice(0,k)+C+`
881
881
  `+v.slice(k);else v+=`
882
882
  ${C}`}if(v=await J(v),p.forEach((x)=>d.add(x)),i.cache&&i.cachePath){if(await gn(m,v,p,i),i.debug)console.log(`Cached template ${m} with ${p.size} dependencies`)}return{contents:v,loader:"html"}}catch(p){let h=p instanceof Error?p:new Y(`Plugin processing failed: ${String(p)}`,m);if(I.log(h,{filePath:m,buildConfig:t.config}),Lt.logDetailedError(h,{filePath:m,plugin:"bun-plugin-stx"}),i.debug)console.error("stx Plugin Error:",h);let g=h,y=g.line||null,w=g.context||null;return{contents:i.debug||N()?`<!DOCTYPE html>
@@ -939,7 +939,7 @@ ${C}`}if(v=await J(v),p.forEach((x)=>d.add(x)),i.cache&&i.cachePath){if(await gn
939
939
  <h1>Something went wrong</h1>
940
940
  <p>An internal error occurred. Please try again later.</p>
941
941
  </body>
942
- </html>`,loader:"html"}}})}};async function jn(t,s={}){let i=s.port||3000,d=s.watch!==!1,c=s.hotReload!==!1&&d,l=null,m=s.hmrPort||i+1,p=Se.resolve(t);if(!Be.existsSync(p))return console.error(`${e.red}Error: File not found: ${e.bright}${p}${e.reset}`),!1;if(p.endsWith(".md"))return Ut(p,s);else if(!p.endsWith(".stx"))return console.error(`${e.red}Error: Unsupported file type: ${e.bright}${p}${e.reset}. Only .stx and .md files are supported.`),!1;let h=a(process.cwd(),"output");Be.mkdirSync(h,{recursive:!0}),console.log(`${e.blue}Building ${e.bright}${t}${e.reset}...`);let g=null,y=async()=>{try{let M={name:"public-assets",setup($e){$e.onResolve({filter:/^\/(images|fonts|assets|public)\//},(he)=>({path:he.path,external:!0}))}},B=await Bun.build({entrypoints:[p],outdir:h,plugins:[M,ft],publicPath:"/",define:{"process.env.NODE_ENV":'"development"'},...s.stxOptions});if(!B.success)return console.error(`${e.red}Build failed:${e.reset}`,B.logs),!1;let q=B.outputs.find(($e)=>$e.path.endsWith(".html"));if(!q)return console.error(`${e.red}No HTML output found${e.reset}`),!1;return g=await Bun.file(q.path).text(),!0}catch(M){return console.error(`${e.red}Error building stx file:${e.reset}`,M),!1}};if(!await y())return!1;let S=Se.dirname(p);await Pt(S);let R=i;try{if(R=await Ye(i),R!==i)console.log(`${e.yellow}Port ${i} is busy, using port ${R} instead${e.reset}`)}catch{return console.error(`${e.red}Could not find an available port${e.reset}`),!1}if(c){let M=s.hmrPort||R+1;l=Et({wsPort:M,verbose:!1}),m=l.start(M)}let v={},x=null,C;try{let{loadStxConfig:M}=await import("./chunk-krwrx9x9.js"),B=await M();if(C=s.stxOptions?.serverApi??B.serverApi,B?.apiRouter)x=B?.apiRouter,console.log(`${e.blue}Using custom router for API handling${e.reset}`);if(B?.apiRoutes){v=B.apiRoutes;let q=Object.keys(v).length;if(q>0)console.log(`${e.blue}Loaded ${e.bright}${q} API route${q>1?"s":""}${e.reset}`)}if(B?.broadcasting?.enabled)try{let{startBroadcasting:q,loadChannels:Z}=await import("./chunk-wn2gzwmv.js"),$e=B.broadcasting;await q($e);let he=$e.port??6001;console.log(`${e.magenta}Broadcasting on ${e.cyan}ws://localhost:${he}/ws${e.reset}`);let De=Se.join(process.cwd(),"channels.ts");if(Be.existsSync(De))try{let ae=await Z(De);console.log(`${e.blue}Loaded ${e.bright}${ae} broadcast channel${ae!==1?"s":""}${e.blue} from channels.ts${e.reset}`)}catch(ae){console.warn(`${e.yellow}Failed to load channels.ts: ${ae.message}${e.reset}`)}}catch(q){console.warn(`${e.yellow}Broadcasting failed to start: ${q.message}${e.reset}`)}}catch{}let{createServerApi:k,isServerApiSource:H}=await import("./chunk-4k6h00kk.js"),D=await k(process.cwd(),C);if(console.log(`${e.blue}Starting server on ${e.cyan}http://localhost:${R}/${e.reset}...`),c)console.log(`${e.magenta}Hot reload enabled on ws://localhost:${m}${e.reset}`);let _=Gr({port:R,async fetch(M){return Ft(M,await(async()=>{let B=new URL(M.url);if([h,Se.dirname(p),Se.join(process.cwd(),"public")].some((ae)=>H(Se.join(ae,B.pathname),process.cwd(),C)))return new Response("Not Found",{status:404});if(x)try{let ae=await x.handleRequest(M);if(ae.status!==404)return ae}catch{}if(v[B.pathname])try{return await v[B.pathname](M)}catch(ae){return new Response(JSON.stringify({error:ae.message}),{status:500,headers:{"Content-Type":"application/json"}})}let q=await D(M);if(q)return q;if(B.pathname==="/")return(async()=>{let U=await f(g||"");if(c)U=Xe(U,m);if(s.native)if(U.includes("<head>"))U=U.replace("<head>","<head><style>[data-stx-sidebar],.stx-sidebar{display:none!important}</style><script>window.__craftNativeSidebar=true;document.documentElement.classList.add('has-native-sidebar')</script>");else if(U.includes("<html"))U=U.replace(/(<html[^>]*>)/,"$1<head><style>[data-stx-sidebar],.stx-sidebar{display:none!important}</style><script>window.__craftNativeSidebar=true;document.documentElement.classList.add('has-native-sidebar')</script></head>");else U="<head><style>[data-stx-sidebar],.stx-sidebar{display:none!important}</style><script>window.__craftNativeSidebar=true;document.documentElement.classList.add('has-native-sidebar')</script></head>"+U;if(s.titlebarHidden)if(U.includes("<head>"))U=U.replace("<head>","<head><style>html.stx-titlebar-hidden .stx-traffic-lights-dot{visibility:hidden}</style><script>document.documentElement.classList.add('stx-titlebar-hidden')</script>");else if(U.includes("<html"))U=U.replace(/(<html[^>]*>)/,"$1<head><style>html.stx-titlebar-hidden .stx-traffic-lights-dot{visibility:hidden}</style><script>document.documentElement.classList.add('stx-titlebar-hidden')</script></head>");else U=`<head><style>html.stx-titlebar-hidden .stx-traffic-lights-dot{visibility:hidden}</style><script>document.documentElement.classList.add('stx-titlebar-hidden')</script></head>${U}`;return U})().then((U)=>new Response(U,{headers:{"Content-Type":"text/html","Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}}));let Z=Se.join(h,B.pathname);if(Be.existsSync(Z)&&Be.statSync(Z).isFile()){let ae=Bun.file(Z),U=Se.extname(Z).toLowerCase(),j="text/plain";if(U===".ts"||U===".tsx"){let Fe=new Bun.Transpiler({loader:U===".tsx"?"tsx":"ts"}),qe=await ae.text(),tt=Fe.transformSync(qe);return new Response(tt,{headers:{"Content-Type":"application/javascript","Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}})}switch(U){case".html":j="text/html";break;case".css":j="text/css";break;case".js":j="text/javascript";break;case".json":j="application/json";break;case".png":j="image/png";break;case".jpg":case".jpeg":j="image/jpeg";break;case".gif":j="image/gif";break;case".woff":j="font/woff";break;case".woff2":j="font/woff2";break;case".ttf":j="font/ttf";break;case".otf":j="font/otf";break;case".eot":j="application/vnd.ms-fontobject";break}return new Response(ae,{headers:{"Content-Type":j}})}let $e=Se.dirname(p),he=Se.join($e,B.pathname);if(Be.existsSync(he)&&Be.statSync(he).isFile()){let ae=Bun.file(he),U=Se.extname(he).toLowerCase(),j="text/plain";if(U===".ts"||U===".tsx"){let Fe=new Bun.Transpiler({loader:U===".tsx"?"tsx":"ts"}),qe=await ae.text(),tt=Fe.transformSync(qe);return new Response(tt,{headers:{"Content-Type":"application/javascript","Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}})}switch(U){case".html":j="text/html";break;case".css":j="text/css";break;case".js":j="text/javascript";break;case".json":j="application/json";break;case".png":j="image/png";break;case".jpg":case".jpeg":j="image/jpeg";break;case".gif":j="image/gif";break;case".svg":j="image/svg+xml";break;case".ico":j="image/x-icon";break;case".woff":j="font/woff";break;case".woff2":j="font/woff2";break;case".ttf":j="font/ttf";break;case".otf":j="font/otf";break;case".eot":j="application/vnd.ms-fontobject";break}return new Response(ae,{headers:{"Content-Type":j}})}let De=Se.join(process.cwd(),"public",B.pathname);if(Be.existsSync(De)&&Be.statSync(De).isFile()){let ae=Bun.file(De),U=Se.extname(De).toLowerCase(),j="application/octet-stream";if(U===".ts"||U===".tsx"){let Fe=new Bun.Transpiler({loader:U===".tsx"?"tsx":"ts"}),qe=await ae.text(),tt=Fe.transformSync(qe);return new Response(tt,{headers:{"Content-Type":"application/javascript","Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}})}switch(U){case".html":j="text/html";break;case".css":j="text/css";break;case".js":j="text/javascript";break;case".json":j="application/json";break;case".png":j="image/png";break;case".jpg":case".jpeg":j="image/jpeg";break;case".gif":j="image/gif";break;case".svg":j="image/svg+xml";break;case".ico":j="image/x-icon";break;case".woff":j="font/woff";break;case".woff2":j="font/woff2";break;case".ttf":j="font/ttf";break;case".otf":j="font/otf";break;case".eot":j="application/vnd.ms-fontobject";break}return new Response(ae,{headers:{"Content-Type":j}})}return new Response("Not Found",{status:404})})())},error(M){return new Response(`<pre>${M}
942
+ </html>`,loader:"html"}}})}};async function jn(t,s={}){let i=s.port||3000,d=s.watch!==!1,c=s.hotReload!==!1&&d,l=null,m=s.hmrPort||i+1,p=Se.resolve(t);if(!Be.existsSync(p))return console.error(`${e.red}Error: File not found: ${e.bright}${p}${e.reset}`),!1;if(p.endsWith(".md"))return Ut(p,s);else if(!p.endsWith(".stx"))return console.error(`${e.red}Error: Unsupported file type: ${e.bright}${p}${e.reset}. Only .stx and .md files are supported.`),!1;let h=a(process.cwd(),"output");Be.mkdirSync(h,{recursive:!0}),console.log(`${e.blue}Building ${e.bright}${t}${e.reset}...`);let g=null,y=async()=>{try{let M={name:"public-assets",setup($e){$e.onResolve({filter:/^\/(images|fonts|assets|public)\//},(he)=>({path:he.path,external:!0}))}},B=await Bun.build({entrypoints:[p],outdir:h,plugins:[M,ft],publicPath:"/",define:{"process.env.NODE_ENV":'"development"'},...s.stxOptions});if(!B.success)return console.error(`${e.red}Build failed:${e.reset}`,B.logs),!1;let q=B.outputs.find(($e)=>$e.path.endsWith(".html"));if(!q)return console.error(`${e.red}No HTML output found${e.reset}`),!1;return g=await Bun.file(q.path).text(),!0}catch(M){return console.error(`${e.red}Error building stx file:${e.reset}`,M),!1}};if(!await y())return!1;let S=Se.dirname(p);await Pt(S);let R=i;try{if(R=await Ye(i),R!==i)console.log(`${e.yellow}Port ${i} is busy, using port ${R} instead${e.reset}`)}catch{return console.error(`${e.red}Could not find an available port${e.reset}`),!1}if(c){let M=s.hmrPort||R+1;l=Et({wsPort:M,verbose:!1}),m=l.start(M)}let v={},x=null,C;try{let{loadStxConfig:M}=await import("./chunk-cw76edds.js"),B=await M();if(C=s.stxOptions?.serverApi??B.serverApi,B?.apiRouter)x=B?.apiRouter,console.log(`${e.blue}Using custom router for API handling${e.reset}`);if(B?.apiRoutes){v=B.apiRoutes;let q=Object.keys(v).length;if(q>0)console.log(`${e.blue}Loaded ${e.bright}${q} API route${q>1?"s":""}${e.reset}`)}if(B?.broadcasting?.enabled)try{let{startBroadcasting:q,loadChannels:Z}=await import("./chunk-wn2gzwmv.js"),$e=B.broadcasting;await q($e);let he=$e.port??6001;console.log(`${e.magenta}Broadcasting on ${e.cyan}ws://localhost:${he}/ws${e.reset}`);let De=Se.join(process.cwd(),"channels.ts");if(Be.existsSync(De))try{let ae=await Z(De);console.log(`${e.blue}Loaded ${e.bright}${ae} broadcast channel${ae!==1?"s":""}${e.blue} from channels.ts${e.reset}`)}catch(ae){console.warn(`${e.yellow}Failed to load channels.ts: ${ae.message}${e.reset}`)}}catch(q){console.warn(`${e.yellow}Broadcasting failed to start: ${q.message}${e.reset}`)}}catch{}let{createServerApi:k,isServerApiSource:H}=await import("./chunk-r90v2jz6.js"),D=await k(process.cwd(),C);if(console.log(`${e.blue}Starting server on ${e.cyan}http://localhost:${R}/${e.reset}...`),c)console.log(`${e.magenta}Hot reload enabled on ws://localhost:${m}${e.reset}`);let _=Gr({port:R,async fetch(M){return Ft(M,await(async()=>{let B=new URL(M.url);if([h,Se.dirname(p),Se.join(process.cwd(),"public")].some((ae)=>H(Se.join(ae,B.pathname),process.cwd(),C)))return new Response("Not Found",{status:404});if(x)try{let ae=await x.handleRequest(M);if(ae.status!==404)return ae}catch{}if(v[B.pathname])try{return await v[B.pathname](M)}catch(ae){return new Response(JSON.stringify({error:ae.message}),{status:500,headers:{"Content-Type":"application/json"}})}let q=await D(M);if(q)return q;if(B.pathname==="/")return(async()=>{let U=await f(g||"");if(c)U=Xe(U,m);if(s.native)if(U.includes("<head>"))U=U.replace("<head>","<head><style>[data-stx-sidebar],.stx-sidebar{display:none!important}</style><script>window.__craftNativeSidebar=true;document.documentElement.classList.add('has-native-sidebar')</script>");else if(U.includes("<html"))U=U.replace(/(<html[^>]*>)/,"$1<head><style>[data-stx-sidebar],.stx-sidebar{display:none!important}</style><script>window.__craftNativeSidebar=true;document.documentElement.classList.add('has-native-sidebar')</script></head>");else U="<head><style>[data-stx-sidebar],.stx-sidebar{display:none!important}</style><script>window.__craftNativeSidebar=true;document.documentElement.classList.add('has-native-sidebar')</script></head>"+U;if(s.titlebarHidden)if(U.includes("<head>"))U=U.replace("<head>","<head><style>html.stx-titlebar-hidden .stx-traffic-lights-dot{visibility:hidden}</style><script>document.documentElement.classList.add('stx-titlebar-hidden')</script>");else if(U.includes("<html"))U=U.replace(/(<html[^>]*>)/,"$1<head><style>html.stx-titlebar-hidden .stx-traffic-lights-dot{visibility:hidden}</style><script>document.documentElement.classList.add('stx-titlebar-hidden')</script></head>");else U=`<head><style>html.stx-titlebar-hidden .stx-traffic-lights-dot{visibility:hidden}</style><script>document.documentElement.classList.add('stx-titlebar-hidden')</script></head>${U}`;return U})().then((U)=>new Response(U,{headers:{"Content-Type":"text/html","Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}}));let Z=Se.join(h,B.pathname);if(Be.existsSync(Z)&&Be.statSync(Z).isFile()){let ae=Bun.file(Z),U=Se.extname(Z).toLowerCase(),j="text/plain";if(U===".ts"||U===".tsx"){let Fe=new Bun.Transpiler({loader:U===".tsx"?"tsx":"ts"}),qe=await ae.text(),tt=Fe.transformSync(qe);return new Response(tt,{headers:{"Content-Type":"application/javascript","Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}})}switch(U){case".html":j="text/html";break;case".css":j="text/css";break;case".js":j="text/javascript";break;case".json":j="application/json";break;case".png":j="image/png";break;case".jpg":case".jpeg":j="image/jpeg";break;case".gif":j="image/gif";break;case".woff":j="font/woff";break;case".woff2":j="font/woff2";break;case".ttf":j="font/ttf";break;case".otf":j="font/otf";break;case".eot":j="application/vnd.ms-fontobject";break}return new Response(ae,{headers:{"Content-Type":j}})}let $e=Se.dirname(p),he=Se.join($e,B.pathname);if(Be.existsSync(he)&&Be.statSync(he).isFile()){let ae=Bun.file(he),U=Se.extname(he).toLowerCase(),j="text/plain";if(U===".ts"||U===".tsx"){let Fe=new Bun.Transpiler({loader:U===".tsx"?"tsx":"ts"}),qe=await ae.text(),tt=Fe.transformSync(qe);return new Response(tt,{headers:{"Content-Type":"application/javascript","Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}})}switch(U){case".html":j="text/html";break;case".css":j="text/css";break;case".js":j="text/javascript";break;case".json":j="application/json";break;case".png":j="image/png";break;case".jpg":case".jpeg":j="image/jpeg";break;case".gif":j="image/gif";break;case".svg":j="image/svg+xml";break;case".ico":j="image/x-icon";break;case".woff":j="font/woff";break;case".woff2":j="font/woff2";break;case".ttf":j="font/ttf";break;case".otf":j="font/otf";break;case".eot":j="application/vnd.ms-fontobject";break}return new Response(ae,{headers:{"Content-Type":j}})}let De=Se.join(process.cwd(),"public",B.pathname);if(Be.existsSync(De)&&Be.statSync(De).isFile()){let ae=Bun.file(De),U=Se.extname(De).toLowerCase(),j="application/octet-stream";if(U===".ts"||U===".tsx"){let Fe=new Bun.Transpiler({loader:U===".tsx"?"tsx":"ts"}),qe=await ae.text(),tt=Fe.transformSync(qe);return new Response(tt,{headers:{"Content-Type":"application/javascript","Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}})}switch(U){case".html":j="text/html";break;case".css":j="text/css";break;case".js":j="text/javascript";break;case".json":j="application/json";break;case".png":j="image/png";break;case".jpg":case".jpeg":j="image/jpeg";break;case".gif":j="image/gif";break;case".svg":j="image/svg+xml";break;case".ico":j="image/x-icon";break;case".woff":j="font/woff";break;case".woff2":j="font/woff2";break;case".ttf":j="font/ttf";break;case".otf":j="font/otf";break;case".eot":j="application/vnd.ms-fontobject";break}return new Response(ae,{headers:{"Content-Type":j}})}return new Response("Not Found",{status:404})})())},error(M){return new Response(`<pre>${M}
943
943
  ${M.stack}</pre>`,{headers:{"Content-Type":"text/html"}})}});console.clear(),console.log(`
944
944
  ${e.blue}stx${e.reset} ${e.green}${process.env.stx_VERSION||"v0.0.10"}${e.reset} ${e.dim}ready in ${Math.random()*10+5|0}.${Math.random()*90+10|0} ms${e.reset}`),console.log(`
945
945
  ${e.bright}\u2192 ${e.cyan}http://localhost:${R}/${e.reset}`),console.log(`
@@ -1426,12 +1426,12 @@ ${v.stack}</pre>`,{headers:{"Content-Type":"text/html"}})}});console.clear(),con
1426
1426
  ${e.blue}stx${e.reset} ${e.green}${process.env.stx_VERSION||"v0.0.10"}${e.reset} ${e.dim}ready in ${Math.random()*10+5|0}.${Math.random()*90+10|0} ms${e.reset}`),console.log(`
1427
1427
  ${e.bright}\u2192 ${e.cyan}http://localhost:${y}/${e.reset}`),console.log(`
1428
1428
  ${e.yellow}Routes:${e.reset}`);let S=new Set(p.map((v)=>v.routeTemplate)),R=Object.entries(m).filter(([v])=>!S.has(v)).sort(([v],[x])=>v.localeCompare(x)).map(([v,x])=>({route:v==="/"?"/":v,filePath:Ae.relative(process.cwd(),x.filePath),fileType:x.fileType}));for(let v of p){let x=v.routeTemplate.replace(/\[([^\]]+)\]/g,":$1");R.push({route:x,filePath:Ae.relative(process.cwd(),v.filePath),fileType:"stx"})}if(R.sort((v,x)=>v.route.localeCompare(x.route)),R.forEach((v,x)=>{let k=x===R.length-1?"\u2514\u2500 ":"\u251C\u2500 ",H=v.fileType==="md"?`${e.magenta}(markdown)${e.reset}`:"";console.log(` ${e.green}${k}${v.route}${e.reset} \u2192 ${e.bright}${v.filePath}${e.reset} ${H}`)}),console.log(`
1429
- Press ${e.cyan}h${e.reset} + ${e.cyan}Enter${e.reset} to show shortcuts`),Qe(w.url.toString(),()=>{if(d)Ze.watch(l,{recursive:!0}).close();w.stop()}),d){console.log(`${e.blue}Watching for changes...${e.reset}`);let v=Ze.watch(l,{recursive:!0},async(x,C)=>{if(!C)return;if(C.endsWith(".stx")||C.endsWith(".js")||C.endsWith(".ts")||C.endsWith(".md"))console.log(`${e.yellow}File ${e.bright}${C}${e.yellow} changed, rebuilding...${e.reset}`),xe.clear(),ne(),await h()});process.on("SIGINT",()=>{v.close(),w.stop(),process.exit(0)})}return!0}function ln(t){return String(t??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}var{serve:Yr}=globalThis.Bun;import ve from"fs";import ie from"path";async function pn(t){try{return It(await Bun.file(t).text())}catch{return}}function Wt(t){let s=Bun.file(t),i=ie.extname(t).toLowerCase(),d={".html":"text/html",".css":"text/css",".js":"text/javascript",".json":"application/json",".png":"image/png",".jpg":"image/jpeg",".jpeg":"image/jpeg",".gif":"image/gif",".svg":"image/svg+xml",".ico":"image/x-icon",".woff":"font/woff",".woff2":"font/woff2",".ttf":"font/ttf",".otf":"font/otf",".eot":"application/vnd.ms-fontobject"},l=[".js",".css",".json"].includes(i)?{"Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}:{};return new Response(s,{headers:{"Content-Type":d[i]||"application/octet-stream",...l}})}async function Fn(t=".",s={}){let i=s.port||3000,d=s.watch!==!1,c=s.hotReload!==!1&&d,l=null,m=s.hmrPort||i+1,p=ie.resolve(t),{loadStxConfig:h}=await import("./chunk-krwrx9x9.js"),g=await h(p),{createServerApi:y,isServerApiSource:w}=await import("./chunk-4k6h00kk.js"),S=s.stxOptions?.serverApi??g.serverApi,R=await y(p,S),v=g.root&&g.root!=="."?ie.join(p,g.root):p,x=s.pagesDir||g.pagesDir||"pages",C=ie.join(v,x);if(!ve.existsSync(C)&&!g._layerPageDirs?.some((O)=>ve.existsSync(O)))return console.error(`${e.red}Error: No '${x}' directory found${e.reset}`),console.log(`${e.dim}Looked in: ${e.bright}${C}${e.reset}`),console.log(`${e.dim}Run stx dev from the app directory, pass it as an argument (stx dev <dir>),${e.reset}`),console.log(`${e.dim}point at another directory with --pages <dir>, or set pagesDir in stx.config.ts.${e.reset}`),console.log(`${e.dim}Starting fresh? Create ${x}/index.stx for the homepage.${e.reset}`),!1;let k=L(v,{pagesDir:x,pagesDirs:g._layerPageDirs?[C,...g._layerPageDirs.slice(1)]:void 0});if(k.length===0)return console.error(`${e.red}Error: No page files found in ${e.bright}${C}${e.reset}`),!1;console.log(`${e.blue}Found ${e.bright}${k.length}${e.blue} routes${e.reset}`);let H=g?._pluginPageDirs||[],D=[];for(let{dir:O,prefix:F}of H)if(ve.existsSync(O)){let z=L(ie.dirname(O),{pagesDir:ie.basename(O)});for(let W of z){let we=F==="/"?W.pattern:`${F}${W.pattern==="/"?"":W.pattern}`;D.push({route:{...W,pattern:we},prefix:F})}if(z.length>0)console.log(`${e.blue}Plugin pages: ${e.bright}${z.length}${e.blue} routes at ${e.cyan}${F}${e.reset}`)}let _=new Map,E=null,M=null;if(s.stxOptions?.shell!==!1){if(M=await _o(p,s.stxOptions?.shell),M){if(E=await Fr(M,s.stxOptions||{}),E)console.log(`${e.blue}Using app shell: ${e.bright}${ie.relative(p,M)}${e.reset} ${e.dim}(deprecated: use layouts/default.stx instead)${e.reset}`)}}st(),await it(p);let B=ot();if(B.length>0)console.log(`${e.blue}Loaded ${e.bright}${B.length}${e.blue} middleware: ${e.dim}${B.join(", ")}${e.reset}`);let q={},Z=null;try{let{loadStxConfig:O}=await import("./chunk-krwrx9x9.js"),F=await O(p);if(F?.apiRouter)Z=F?.apiRouter,console.log(`${e.blue}Using custom router for API handling${e.reset}`);if(F?.apiRoutes){q=F.apiRoutes;let z=Object.keys(q).length;if(z>0)console.log(`${e.blue}Loaded ${e.bright}${z} API route${z>1?"s":""}${e.reset}`)}if(F?.broadcasting?.enabled)try{let{startBroadcasting:z,loadChannels:W}=await import("./chunk-wn2gzwmv.js"),we=F.broadcasting;await z(we);let ze=we.port??6001;console.log(`${e.magenta}Broadcasting on ${e.cyan}ws://localhost:${ze}/ws${e.reset}`);let Ge=ie.join(process.cwd(),"channels.ts");if(ve.existsSync(Ge))try{let ee=await W(Ge);console.log(`${e.blue}Loaded ${e.bright}${ee} broadcast channel${ee!==1?"s":""}${e.blue} from channels.ts${e.reset}`)}catch(ee){console.warn(`${e.yellow}Failed to load channels.ts: ${ee.message}${e.reset}`)}}catch(z){console.warn(`${e.yellow}Broadcasting failed to start: ${z.message}${e.reset}`)}}catch{}let $e=a(p,"output");ve.mkdirSync($e,{recursive:!0});let he=new Map,De=new Set,ae=async(O)=>{let F=Er(C,O);if(!F)return null;try{let z=await Bun.build({entrypoints:[F],outdir:$e,plugins:[ft],publicPath:"/",define:{"process.env.NODE_ENV":'"development"'},...s.stxOptions});if(!z.success)return null;let W=z.outputs.find((we)=>we.path.endsWith(".html"));if(!W)return null;return await Bun.file(W.path).text()}catch{return null}},U=new Map,j=async(O,F)=>{try{let{processDirectives:z,extractVariables:W,defaultConfig:we,loadStxConfig:ze,injectRouterScript:Ge}=await import("./chunk-krwrx9x9.js"),{checkCache:ee,cacheTemplate:Q,readFileCached:V,templateCache:K}=await import("./chunk-t431anrx.js"),ke=await ze(p),Je=(ce)=>{if(!ce)return ce;if(ie.isAbsolute(ce))return ce;return ie.resolve(p,ce)},A={...we,...ke,...s.stxOptions,autoShell:!0};if(s.debugDirectives)A.debug=!0;A.partialsDir=Je(A.partialsDir),A.componentsDir=Je(A.componentsDir),A.layoutsDir=Je(A.layoutsDir),A.storesDir=Je(A.storesDir||"stores"),A.cachePath=Je(A.cachePath)??a(p,"cache");let be=!F&&!s.profile,ue=A.cache!==!1;if(ue&&be){let ce=K.get(O.filePath);if(ce)try{if((await ve.promises.stat(O.filePath)).mtime.getTime()<=ce.mtime){let He=!0;for(let Re of ce.dependencies){if(!ve.existsSync(Re)){He=!1;break}if((await ve.promises.stat(Re)).mtime.getTime()>ce.mtime){He=!1;break}}if(He){let Re=ce.output;if(E)Re=ye(Re,{preserveHead:!0});let gt=U.get(O.filePath);return{route:O,content:Re,status:gt?.status??await pn(O.filePath),headers:gt?.headers}}}}catch{}let Ie=await ee(O.filePath,A);if(Ie){let je=Ie;if(E)je=ye(je,{preserveHead:!0});let He=U.get(O.filePath);return{route:O,content:je,status:He?.status??await pn(O.filePath),headers:He?.headers}}}let ge=ue?await V(O.filePath):await Bun.file(O.filePath).text(),Ce=It(ge),{classifyAllScripts:X}=await import("./chunk-krwrx9x9.js"),Le=X(ge),Ne=Le.server.map((ce)=>ce.content),fe=ge;for(let ce of Le.server)fe=fe.replace(ce.fullTag,"");let me={__filename:O.filePath,__dirname:ie.dirname(O.filePath),__stx_options:A,params:F??{},__stx_runtime_head:{}};for(let ce of Ne)try{await W(ce,me,O.filePath)}catch(Ie){if(s.stxOptions?.debug)console.error("[stx] variable extraction error",O.filePath,Ie?.message||Ie)}let Ke=new Set,Me;if(s.profile){let ce=performance.now();Me=await z(fe,me,O.filePath,A,Ke);let Ie=performance.now()-ce,je=ie.relative(p,O.filePath)||O.filePath;console.log(`[stx:profile] ${je} \u2192 ${Ie.toFixed(2)}ms`)}else Me=await z(fe,me,O.filePath,A,Ke);if(!E)Me=await Ge(Me,{router:A.router});{let{interpolateScriptExpressions:ce}=await import("./chunk-wfp36qf4.js");Me=Me.replace(/<script\b([^>]*)>([\s\S]*?)<\/script>/g,(Ie,je,He)=>{if(!/function\s+__stx_setup_/.test(He))return Ie;return`<script${je}>${ce(He,me)}</script>`})}if(E)Me=ye(Me,{preserveHead:!0});if(ue&&be)await Q(O.filePath,Me,Ke,A);let{extractStreamBoundaries:Kn}=await import("./chunk-4wkghwag.js"),nt=Kn(me),mt=me.__streamTemplates;if(mt&&typeof mt==="object"&&Object.keys(mt).length>0){let ce=me.streamBoundaries||{},Ie={...A,autoShell:!1},je=Object.keys(mt).map((Re)=>({id:Re,render:async()=>{let gt=typeof ce[Re]==="function"?await ce[Re]():void 0;return z(mt[Re],{...me,$boundary:gt},O.filePath,Ie,new Set)}})),He=new Set(je.map((Re)=>Re.id));nt=[...(nt||[]).filter((Re)=>!He.has(Re.id)),...je]}if(nt&&nt.length>0)De.add(O.pattern);else nt=void 0;let Kt=Ve(me),Xt=We(me);if(be)U.set(O.filePath,{status:Kt,headers:Xt});return{route:O,content:Me,status:Kt??Ce,headers:Xt,boundaries:nt}}catch(z){return console.error(`${e.red}Error building ${e.bright}${O.pattern}${e.reset}:`,z),null}},Fe=8,qe=async()=>{he.clear(),_.clear();for(let O=0;O<k.length;O+=Fe){let F=k.slice(O,O+Fe),z=await Promise.all(F.map((W)=>j(W)));for(let W of z)if(W)he.set(W.route.pattern,W)}for(let O=0;O<D.length;O+=Fe){let F=D.slice(O,O+Fe),z=await Promise.all(F.map(({route:W})=>j(W)));for(let W of z)if(W)_.set(W.route.pattern,W)}return he.size>0};if(console.log(`${e.blue}Building pages...${e.reset}`),!await qe())return console.error(`${e.red}No pages were successfully built${e.reset}`),!1;await Pt(p);let et=i;try{if(et=await Ye(i),et!==i)console.log(`${e.yellow}Port ${i} is busy, using port ${et} instead${e.reset}`)}catch{return console.error(`${e.red}Could not find an available port${e.reset}`),!1}if(c){let O=s.hmrPort||et+1;l=Et({wsPort:O,verbose:!1}),m=l.start(O)}let Dt=(O,F)=>{let W=`<script data-stx-route-params>(function(){var p=${JSON.stringify(F).replace(/</g,"\\u003C").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")};window.__stx_rp=p;if(window.stx){window.stx._rp=p;if(window.stx.setRouteParams)window.stx.setRouteParams(p)}})()</script>`;if(O.includes("</head>"))return O.replace("</head>",`${W}</head>`);if(O.includes("<body"))return O.replace(/<body([^>]*)>/,`<body$1>${W}`);return W+O};console.log(`${e.blue}Starting server...${e.reset}`);let Mt=Yr({port:et,async fetch(O){let F=new URL(O.url),z=g?.publicDir||"public",W=ie.join(p,z,F.pathname),we=ie.join(p,F.pathname),ze=ie.join($e,F.pathname);if([W,we,ze].some((A)=>w(A,p,S)))return new Response("Not Found",{status:404});let[Ge,ee,Q]=await Promise.all([ve.promises.stat(W).catch(()=>null),ve.promises.stat(we).catch(()=>null),ve.promises.stat(ze).catch(()=>null)]);if(Ge?.isFile()&&!w(W,p,S))return Wt(W);if(ee?.isFile()&&!w(we,p,S))return Wt(we);if(Q?.isFile()&&!w(ze,p,S))return Wt(ze);if(F.pathname.startsWith("/_stx/component/")){let A=decodeURIComponent(F.pathname.slice(16));if(A)try{let be=`<${A} />`,ue={...buildConfig,autoShell:!1},ge=await processDirectives(be,{},ie.join(p,"components",`${A}.stx`),ue,new Set);return new Response(ge,{headers:{"Content-Type":"text/html"}})}catch(be){return new Response(`<div class="stx-async-error">${be.message}</div>`,{status:500,headers:{"Content-Type":"text/html"}})}}if(F.pathname==="/_stx/img"){let{handleImageRequest:A}=await import("./chunk-j87tntna.js"),be=await A(O,{publicDir:ie.join(p,z),cacheDir:a(p,"cache","img")});if(be)return be}if(Z)try{let A=await Z.handleRequest(O);if(A.status!==404)return A}catch{}if(q[F.pathname])try{return await q[F.pathname](O)}catch(A){return new Response(JSON.stringify({error:A.message}),{status:500,headers:{"Content-Type":"application/json"}})}let V=await R(O);if(V)return V;let K=Nn(F.pathname,k);if(K){let A=he.get(K.route.pattern),be=De.has(K.route.pattern);if(K.route.isDynamic&&Object.keys(K.params).length>0||be){let ue=await j(K.route,K.params);if(ue)A=ue}if(A){let ue=A.status??200,ge=A.headers??{},Ce=(K.route.filePath?Ue(await Bun.file(K.route.filePath).text().catch(()=>"")):null)??{};if(Ce.validate){if(!await Ce.validate({params:K.params})){let Ne=await ae(404);if(Ne){let fe=Ne;if(fe=await f(fe,p),c)fe=Xe(fe,m);return new Response(fe,{status:404,headers:{"Content-Type":"text/html"}})}return new Response("Not Found",{status:404})}}if(Ce.middleware){let Le=at(F.pathname,K.params,Ce,F.search),Ne=ct(Le,null,O,{isServer:!0}),fe=await lt(Ce.middleware,Ne);if(fe.redirect){let me=fe.redirect.path,Ke=fe.redirect.options.redirectCode||302,Me=new Headers(fe.responseHeaders);return Me.set("Location",me),new Response(null,{status:Ke,headers:Me})}if(fe.abort){let{statusCode:me,message:Ke}=fe.abort.error;return new Response(`<!DOCTYPE html><html><head><title>Error ${me}</title></head><body><h1>Error ${me}</h1><p>${Ke}</p></body></html>`,{status:me,headers:{"Content-Type":"text/html"}})}if(Object.keys(fe.state).length>0){let me=`<script>(function(){var s=typeof stx!=='undefined'?stx:{};s._ms=${JSON.stringify(fe.state)};if(s.setMiddlewareState)s.setMiddlewareState(s._ms);})()</script>`;A.content=A.content.replace("</head>",`${me}</head>`)}}let X=A.content;if(E&&Eo(O)){let Le=Ee(X),Ne=de(X),fe=X.match(/<title[^>]*>([\s\S]*?)<\/title>/i),me=fe?Co(fe[1].trim()):"";if(Object.keys(K.params).length>0)X=Dt(X,K.params);X=await f(X,p);let Ke=g?.router?.container||"main";return X=oe(X,Ke),new Response(X,{status:ue,headers:{"Content-Type":"text/html","X-STX-Fragment":"true","X-STX-Layout":Le.layout,"X-STX-Layout-Group":Le.group,"X-STX-Runtime":Ne?"true":"false",...me&&{"X-STX-Title":encodeURIComponent(me)},[Ri]:Os(),...T(),"Cache-Control":Oe}})}if(E)X=Vn(E,X);if(Object.keys(K.params).length>0)X=Dt(X,K.params);if(X=await f(X,p),c)X=Xe(X,m);if(s.native)if(X.includes("<head>"))X=X.replace("<head>","<head><style>[data-stx-sidebar],.stx-sidebar{display:none!important}</style><script>window.__craftNativeSidebar=true;document.documentElement.classList.add('has-native-sidebar')</script>");else X="<head><style>[data-stx-sidebar],.stx-sidebar{display:none!important}</style><script>window.__craftNativeSidebar=true;document.documentElement.classList.add('has-native-sidebar')</script></head>"+X;if(s.titlebarHidden)if(X.includes("<head>"))X=X.replace("<head>","<head><style>html.stx-titlebar-hidden .stx-traffic-lights-dot{visibility:hidden}</style><script>document.documentElement.classList.add('stx-titlebar-hidden')</script>");else X=`<head><style>html.stx-titlebar-hidden .stx-traffic-lights-dot{visibility:hidden}</style><script>document.documentElement.classList.add('stx-titlebar-hidden')</script></head>${X}`;if(A.boundaries&&A.boundaries.length>0){let{renderStreamingPage:Le,streamToResponse:Ne}=await import("./chunk-4wkghwag.js");return Ne(Le(X,A.boundaries,{timeoutMs:30000}),{status:ue,headers:{"Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}})}return new Response(X,{status:ue,headers:{"Content-Type":"text/html",...T(),"Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0",...ge}})}}if(D.length>0){let A=D.map((ue)=>ue.route),be=Nn(F.pathname,A);if(be){let ue=_.get(be.route.pattern);if(ue){let ge=ue.content;if(E)ge=Vn(E,ge);if(Object.keys(be.params).length>0)ge=Dt(ge,be.params);if(ge=await f(ge,p),c)ge=Xe(ge,m);return new Response(ge,{status:ue.status??200,headers:{"Content-Type":"text/html","Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}})}}for(let{prefix:ue}of H)if(ue!=="/"&&F.pathname.startsWith(ue)){let ge=_.get(ue)||_.get(ue+"/");if(ge){let Ce=ge.content;if(E)Ce=Vn(E,Ce);if(Ce=await f(Ce,p),c)Ce=Xe(Ce,m);return new Response(Ce,{headers:{"Content-Type":"text/html","Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}})}}}if(rt(F.pathname))return new Response("Not Found",{status:404,headers:{"Content-Type":"text/plain; charset=utf-8"}});let ke=he.get("/");if(ke){let A=ke.content;if(A=await f(A,p),c)A=Xe(A,m);if(s.native)if(A.includes("<head>"))A=A.replace("<head>","<head><style>[data-stx-sidebar],.stx-sidebar{display:none!important}</style><script>window.__craftNativeSidebar=true;document.documentElement.classList.add('has-native-sidebar')</script>");else A="<head><style>[data-stx-sidebar],.stx-sidebar{display:none!important}</style><script>window.__craftNativeSidebar=true;document.documentElement.classList.add('has-native-sidebar')</script></head>"+A;return new Response(A,{headers:{"Content-Type":"text/html","Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}})}let Je=await ae(404);if(Je){let A=Je;if(A=await f(A,p),c)A=Xe(A,m);return new Response(A,{status:404,headers:{"Content-Type":"text/html"}})}return new Response("Not Found",{status:404})},async error(O){let F=await ae(500);if(F)return new Response(F,{status:500,headers:{"Content-Type":"text/html"}});return new Response(`<pre>${O}
1429
+ Press ${e.cyan}h${e.reset} + ${e.cyan}Enter${e.reset} to show shortcuts`),Qe(w.url.toString(),()=>{if(d)Ze.watch(l,{recursive:!0}).close();w.stop()}),d){console.log(`${e.blue}Watching for changes...${e.reset}`);let v=Ze.watch(l,{recursive:!0},async(x,C)=>{if(!C)return;if(C.endsWith(".stx")||C.endsWith(".js")||C.endsWith(".ts")||C.endsWith(".md"))console.log(`${e.yellow}File ${e.bright}${C}${e.yellow} changed, rebuilding...${e.reset}`),xe.clear(),ne(),await h()});process.on("SIGINT",()=>{v.close(),w.stop(),process.exit(0)})}return!0}function ln(t){return String(t??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}var{serve:Yr}=globalThis.Bun;import ve from"fs";import ie from"path";async function pn(t){try{return It(await Bun.file(t).text())}catch{return}}function Wt(t){let s=Bun.file(t),i=ie.extname(t).toLowerCase(),d={".html":"text/html",".css":"text/css",".js":"text/javascript",".json":"application/json",".png":"image/png",".jpg":"image/jpeg",".jpeg":"image/jpeg",".gif":"image/gif",".svg":"image/svg+xml",".ico":"image/x-icon",".woff":"font/woff",".woff2":"font/woff2",".ttf":"font/ttf",".otf":"font/otf",".eot":"application/vnd.ms-fontobject"},l=[".js",".css",".json"].includes(i)?{"Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}:{};return new Response(s,{headers:{"Content-Type":d[i]||"application/octet-stream",...l}})}async function Fn(t=".",s={}){let i=s.port||3000,d=s.watch!==!1,c=s.hotReload!==!1&&d,l=null,m=s.hmrPort||i+1,p=ie.resolve(t),{loadStxConfig:h}=await import("./chunk-cw76edds.js"),g=await h(p),{createServerApi:y,isServerApiSource:w}=await import("./chunk-r90v2jz6.js"),S=s.stxOptions?.serverApi??g.serverApi,R=await y(p,S),v=g.root&&g.root!=="."?ie.join(p,g.root):p,x=s.pagesDir||g.pagesDir||"pages",C=ie.join(v,x);if(!ve.existsSync(C)&&!g._layerPageDirs?.some((O)=>ve.existsSync(O)))return console.error(`${e.red}Error: No '${x}' directory found${e.reset}`),console.log(`${e.dim}Looked in: ${e.bright}${C}${e.reset}`),console.log(`${e.dim}Run stx dev from the app directory, pass it as an argument (stx dev <dir>),${e.reset}`),console.log(`${e.dim}point at another directory with --pages <dir>, or set pagesDir in stx.config.ts.${e.reset}`),console.log(`${e.dim}Starting fresh? Create ${x}/index.stx for the homepage.${e.reset}`),!1;let k=L(v,{pagesDir:x,pagesDirs:g._layerPageDirs?[C,...g._layerPageDirs.slice(1)]:void 0});if(k.length===0)return console.error(`${e.red}Error: No page files found in ${e.bright}${C}${e.reset}`),!1;console.log(`${e.blue}Found ${e.bright}${k.length}${e.blue} routes${e.reset}`);let H=g?._pluginPageDirs||[],D=[];for(let{dir:O,prefix:F}of H)if(ve.existsSync(O)){let z=L(ie.dirname(O),{pagesDir:ie.basename(O)});for(let W of z){let we=F==="/"?W.pattern:`${F}${W.pattern==="/"?"":W.pattern}`;D.push({route:{...W,pattern:we},prefix:F})}if(z.length>0)console.log(`${e.blue}Plugin pages: ${e.bright}${z.length}${e.blue} routes at ${e.cyan}${F}${e.reset}`)}let _=new Map,E=null,M=null;if(s.stxOptions?.shell!==!1){if(M=await _o(p,s.stxOptions?.shell),M){if(E=await Fr(M,s.stxOptions||{}),E)console.log(`${e.blue}Using app shell: ${e.bright}${ie.relative(p,M)}${e.reset} ${e.dim}(deprecated: use layouts/default.stx instead)${e.reset}`)}}st(),await it(p);let B=ot();if(B.length>0)console.log(`${e.blue}Loaded ${e.bright}${B.length}${e.blue} middleware: ${e.dim}${B.join(", ")}${e.reset}`);let q={},Z=null;try{let{loadStxConfig:O}=await import("./chunk-cw76edds.js"),F=await O(p);if(F?.apiRouter)Z=F?.apiRouter,console.log(`${e.blue}Using custom router for API handling${e.reset}`);if(F?.apiRoutes){q=F.apiRoutes;let z=Object.keys(q).length;if(z>0)console.log(`${e.blue}Loaded ${e.bright}${z} API route${z>1?"s":""}${e.reset}`)}if(F?.broadcasting?.enabled)try{let{startBroadcasting:z,loadChannels:W}=await import("./chunk-wn2gzwmv.js"),we=F.broadcasting;await z(we);let ze=we.port??6001;console.log(`${e.magenta}Broadcasting on ${e.cyan}ws://localhost:${ze}/ws${e.reset}`);let Ge=ie.join(process.cwd(),"channels.ts");if(ve.existsSync(Ge))try{let ee=await W(Ge);console.log(`${e.blue}Loaded ${e.bright}${ee} broadcast channel${ee!==1?"s":""}${e.blue} from channels.ts${e.reset}`)}catch(ee){console.warn(`${e.yellow}Failed to load channels.ts: ${ee.message}${e.reset}`)}}catch(z){console.warn(`${e.yellow}Broadcasting failed to start: ${z.message}${e.reset}`)}}catch{}let $e=a(p,"output");ve.mkdirSync($e,{recursive:!0});let he=new Map,De=new Set,ae=async(O)=>{let F=Er(C,O);if(!F)return null;try{let z=await Bun.build({entrypoints:[F],outdir:$e,plugins:[ft],publicPath:"/",define:{"process.env.NODE_ENV":'"development"'},...s.stxOptions});if(!z.success)return null;let W=z.outputs.find((we)=>we.path.endsWith(".html"));if(!W)return null;return await Bun.file(W.path).text()}catch{return null}},U=new Map,j=async(O,F)=>{try{let{processDirectives:z,extractVariables:W,defaultConfig:we,loadStxConfig:ze,injectRouterScript:Ge}=await import("./chunk-cw76edds.js"),{checkCache:ee,cacheTemplate:Q,readFileCached:V,templateCache:K}=await import("./chunk-4vnwge6p.js"),ke=await ze(p),Je=(ce)=>{if(!ce)return ce;if(ie.isAbsolute(ce))return ce;return ie.resolve(p,ce)},A={...we,...ke,...s.stxOptions,autoShell:!0};if(s.debugDirectives)A.debug=!0;A.partialsDir=Je(A.partialsDir),A.componentsDir=Je(A.componentsDir),A.layoutsDir=Je(A.layoutsDir),A.storesDir=Je(A.storesDir||"stores"),A.cachePath=Je(A.cachePath)??a(p,"cache");let be=!F&&!s.profile,ue=A.cache!==!1;if(ue&&be){let ce=K.get(O.filePath);if(ce)try{if((await ve.promises.stat(O.filePath)).mtime.getTime()<=ce.mtime){let He=!0;for(let Re of ce.dependencies){if(!ve.existsSync(Re)){He=!1;break}if((await ve.promises.stat(Re)).mtime.getTime()>ce.mtime){He=!1;break}}if(He){let Re=ce.output;if(E)Re=ye(Re,{preserveHead:!0});let gt=U.get(O.filePath);return{route:O,content:Re,status:gt?.status??await pn(O.filePath),headers:gt?.headers}}}}catch{}let Ie=await ee(O.filePath,A);if(Ie){let je=Ie;if(E)je=ye(je,{preserveHead:!0});let He=U.get(O.filePath);return{route:O,content:je,status:He?.status??await pn(O.filePath),headers:He?.headers}}}let ge=ue?await V(O.filePath):await Bun.file(O.filePath).text(),Ce=It(ge),{classifyAllScripts:X}=await import("./chunk-cw76edds.js"),Le=X(ge),Ne=Le.server.map((ce)=>ce.content),fe=ge;for(let ce of Le.server)fe=fe.replace(ce.fullTag,"");let me={__filename:O.filePath,__dirname:ie.dirname(O.filePath),__stx_options:A,params:F??{},__stx_runtime_head:{}};for(let ce of Ne)try{await W(ce,me,O.filePath)}catch(Ie){if(s.stxOptions?.debug)console.error("[stx] variable extraction error",O.filePath,Ie?.message||Ie)}let Ke=new Set,Me;if(s.profile){let ce=performance.now();Me=await z(fe,me,O.filePath,A,Ke);let Ie=performance.now()-ce,je=ie.relative(p,O.filePath)||O.filePath;console.log(`[stx:profile] ${je} \u2192 ${Ie.toFixed(2)}ms`)}else Me=await z(fe,me,O.filePath,A,Ke);if(!E)Me=await Ge(Me,{router:A.router});{let{interpolateScriptExpressions:ce}=await import("./chunk-sqpme1hg.js");Me=Me.replace(/<script\b([^>]*)>([\s\S]*?)<\/script>/g,(Ie,je,He)=>{if(!/function\s+__stx_setup_/.test(He))return Ie;return`<script${je}>${ce(He,me)}</script>`})}if(E)Me=ye(Me,{preserveHead:!0});if(ue&&be)await Q(O.filePath,Me,Ke,A);let{extractStreamBoundaries:Kn}=await import("./chunk-bhg4pvtn.js"),nt=Kn(me),mt=me.__streamTemplates;if(mt&&typeof mt==="object"&&Object.keys(mt).length>0){let ce=me.streamBoundaries||{},Ie={...A,autoShell:!1},je=Object.keys(mt).map((Re)=>({id:Re,render:async()=>{let gt=typeof ce[Re]==="function"?await ce[Re]():void 0;return z(mt[Re],{...me,$boundary:gt},O.filePath,Ie,new Set)}})),He=new Set(je.map((Re)=>Re.id));nt=[...(nt||[]).filter((Re)=>!He.has(Re.id)),...je]}if(nt&&nt.length>0)De.add(O.pattern);else nt=void 0;let Kt=Ue(me),Xt=We(me);if(be)U.set(O.filePath,{status:Kt,headers:Xt});return{route:O,content:Me,status:Kt??Ce,headers:Xt,boundaries:nt}}catch(z){return console.error(`${e.red}Error building ${e.bright}${O.pattern}${e.reset}:`,z),null}},Fe=8,qe=async()=>{he.clear(),_.clear();for(let O=0;O<k.length;O+=Fe){let F=k.slice(O,O+Fe),z=await Promise.all(F.map((W)=>j(W)));for(let W of z)if(W)he.set(W.route.pattern,W)}for(let O=0;O<D.length;O+=Fe){let F=D.slice(O,O+Fe),z=await Promise.all(F.map(({route:W})=>j(W)));for(let W of z)if(W)_.set(W.route.pattern,W)}return he.size>0};if(console.log(`${e.blue}Building pages...${e.reset}`),!await qe())return console.error(`${e.red}No pages were successfully built${e.reset}`),!1;await Pt(p);let et=i;try{if(et=await Ye(i),et!==i)console.log(`${e.yellow}Port ${i} is busy, using port ${et} instead${e.reset}`)}catch{return console.error(`${e.red}Could not find an available port${e.reset}`),!1}if(c){let O=s.hmrPort||et+1;l=Et({wsPort:O,verbose:!1}),m=l.start(O)}let Dt=(O,F)=>{let W=`<script data-stx-route-params>(function(){var p=${JSON.stringify(F).replace(/</g,"\\u003C").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")};window.__stx_rp=p;if(window.stx){window.stx._rp=p;if(window.stx.setRouteParams)window.stx.setRouteParams(p)}})()</script>`;if(O.includes("</head>"))return O.replace("</head>",`${W}</head>`);if(O.includes("<body"))return O.replace(/<body([^>]*)>/,`<body$1>${W}`);return W+O};console.log(`${e.blue}Starting server...${e.reset}`);let Mt=Yr({port:et,async fetch(O){let F=new URL(O.url),z=g?.publicDir||"public",W=ie.join(p,z,F.pathname),we=ie.join(p,F.pathname),ze=ie.join($e,F.pathname);if([W,we,ze].some((A)=>w(A,p,S)))return new Response("Not Found",{status:404});let[Ge,ee,Q]=await Promise.all([ve.promises.stat(W).catch(()=>null),ve.promises.stat(we).catch(()=>null),ve.promises.stat(ze).catch(()=>null)]);if(Ge?.isFile()&&!w(W,p,S))return Wt(W);if(ee?.isFile()&&!w(we,p,S))return Wt(we);if(Q?.isFile()&&!w(ze,p,S))return Wt(ze);if(F.pathname.startsWith("/_stx/component/")){let A=decodeURIComponent(F.pathname.slice(16));if(A)try{let be=`<${A} />`,ue={...buildConfig,autoShell:!1},ge=await processDirectives(be,{},ie.join(p,"components",`${A}.stx`),ue,new Set);return new Response(ge,{headers:{"Content-Type":"text/html"}})}catch(be){return new Response(`<div class="stx-async-error">${be.message}</div>`,{status:500,headers:{"Content-Type":"text/html"}})}}if(F.pathname==="/_stx/img"){let{handleImageRequest:A}=await import("./chunk-7ae40484.js"),be=await A(O,{publicDir:ie.join(p,z),cacheDir:a(p,"cache","img")});if(be)return be}if(Z)try{let A=await Z.handleRequest(O);if(A.status!==404)return A}catch{}if(q[F.pathname])try{return await q[F.pathname](O)}catch(A){return new Response(JSON.stringify({error:A.message}),{status:500,headers:{"Content-Type":"application/json"}})}let V=await R(O);if(V)return V;let K=Nn(F.pathname,k);if(K){let A=he.get(K.route.pattern),be=De.has(K.route.pattern);if(K.route.isDynamic&&Object.keys(K.params).length>0||be){let ue=await j(K.route,K.params);if(ue)A=ue}if(A){let ue=A.status??200,ge=A.headers??{},Ce=(K.route.filePath?Ve(await Bun.file(K.route.filePath).text().catch(()=>"")):null)??{};if(Ce.validate){if(!await Ce.validate({params:K.params})){let Ne=await ae(404);if(Ne){let fe=Ne;if(fe=await f(fe,p),c)fe=Xe(fe,m);return new Response(fe,{status:404,headers:{"Content-Type":"text/html"}})}return new Response("Not Found",{status:404})}}if(Ce.middleware){let Le=at(F.pathname,K.params,Ce,F.search),Ne=ct(Le,null,O,{isServer:!0}),fe=await lt(Ce.middleware,Ne);if(fe.redirect){let me=fe.redirect.path,Ke=fe.redirect.options.redirectCode||302,Me=new Headers(fe.responseHeaders);return Me.set("Location",me),new Response(null,{status:Ke,headers:Me})}if(fe.abort){let{statusCode:me,message:Ke}=fe.abort.error;return new Response(`<!DOCTYPE html><html><head><title>Error ${me}</title></head><body><h1>Error ${me}</h1><p>${Ke}</p></body></html>`,{status:me,headers:{"Content-Type":"text/html"}})}if(Object.keys(fe.state).length>0){let me=`<script>(function(){var s=typeof stx!=='undefined'?stx:{};s._ms=${JSON.stringify(fe.state)};if(s.setMiddlewareState)s.setMiddlewareState(s._ms);})()</script>`;A.content=A.content.replace("</head>",`${me}</head>`)}}let X=A.content;if(E&&Eo(O)){let Le=Ee(X),Ne=de(X),fe=X.match(/<title[^>]*>([\s\S]*?)<\/title>/i),me=fe?Co(fe[1].trim()):"";if(Object.keys(K.params).length>0)X=Dt(X,K.params);X=await f(X,p);let Ke=g?.router?.container||"main";return X=oe(X,Ke),new Response(X,{status:ue,headers:{"Content-Type":"text/html","X-STX-Fragment":"true","X-STX-Layout":Le.layout,"X-STX-Layout-Group":Le.group,"X-STX-Runtime":Ne?"true":"false",...me&&{"X-STX-Title":encodeURIComponent(me)},[Ri]:Os(),...T(),"Cache-Control":Oe}})}if(E)X=Un(E,X);if(Object.keys(K.params).length>0)X=Dt(X,K.params);if(X=await f(X,p),c)X=Xe(X,m);if(s.native)if(X.includes("<head>"))X=X.replace("<head>","<head><style>[data-stx-sidebar],.stx-sidebar{display:none!important}</style><script>window.__craftNativeSidebar=true;document.documentElement.classList.add('has-native-sidebar')</script>");else X="<head><style>[data-stx-sidebar],.stx-sidebar{display:none!important}</style><script>window.__craftNativeSidebar=true;document.documentElement.classList.add('has-native-sidebar')</script></head>"+X;if(s.titlebarHidden)if(X.includes("<head>"))X=X.replace("<head>","<head><style>html.stx-titlebar-hidden .stx-traffic-lights-dot{visibility:hidden}</style><script>document.documentElement.classList.add('stx-titlebar-hidden')</script>");else X=`<head><style>html.stx-titlebar-hidden .stx-traffic-lights-dot{visibility:hidden}</style><script>document.documentElement.classList.add('stx-titlebar-hidden')</script></head>${X}`;if(A.boundaries&&A.boundaries.length>0){let{renderStreamingPage:Le,streamToResponse:Ne}=await import("./chunk-bhg4pvtn.js");return Ne(Le(X,A.boundaries,{timeoutMs:30000}),{status:ue,headers:{"Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}})}return new Response(X,{status:ue,headers:{"Content-Type":"text/html",...T(),"Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0",...ge}})}}if(D.length>0){let A=D.map((ue)=>ue.route),be=Nn(F.pathname,A);if(be){let ue=_.get(be.route.pattern);if(ue){let ge=ue.content;if(E)ge=Un(E,ge);if(Object.keys(be.params).length>0)ge=Dt(ge,be.params);if(ge=await f(ge,p),c)ge=Xe(ge,m);return new Response(ge,{status:ue.status??200,headers:{"Content-Type":"text/html","Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}})}}for(let{prefix:ue}of H)if(ue!=="/"&&F.pathname.startsWith(ue)){let ge=_.get(ue)||_.get(ue+"/");if(ge){let Ce=ge.content;if(E)Ce=Un(E,Ce);if(Ce=await f(Ce,p),c)Ce=Xe(Ce,m);return new Response(Ce,{headers:{"Content-Type":"text/html","Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}})}}}if(rt(F.pathname))return new Response("Not Found",{status:404,headers:{"Content-Type":"text/plain; charset=utf-8"}});let ke=he.get("/");if(ke){let A=ke.content;if(A=await f(A,p),c)A=Xe(A,m);if(s.native)if(A.includes("<head>"))A=A.replace("<head>","<head><style>[data-stx-sidebar],.stx-sidebar{display:none!important}</style><script>window.__craftNativeSidebar=true;document.documentElement.classList.add('has-native-sidebar')</script>");else A="<head><style>[data-stx-sidebar],.stx-sidebar{display:none!important}</style><script>window.__craftNativeSidebar=true;document.documentElement.classList.add('has-native-sidebar')</script></head>"+A;return new Response(A,{headers:{"Content-Type":"text/html","Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}})}let Je=await ae(404);if(Je){let A=Je;if(A=await f(A,p),c)A=Xe(A,m);return new Response(A,{status:404,headers:{"Content-Type":"text/html"}})}return new Response("Not Found",{status:404})},async error(O){let F=await ae(500);if(F)return new Response(F,{status:500,headers:{"Content-Type":"text/html"}});return new Response(`<pre>${O}
1430
1430
  ${O.stack}</pre>`,{headers:{"Content-Type":"text/html"}})}});if(console.clear(),console.log(`
1431
1431
  ${e.blue}stx${e.reset} ${e.green}${process.env.stx_VERSION||"v0.0.10"}${e.reset} ${e.dim}ready in ${Math.random()*10+5|0}.${Math.random()*90+10|0} ms${e.reset}`),console.log(`
1432
1432
  ${e.bright}\u2192 ${e.cyan}http://localhost:${et}/${e.reset}`),c)console.log(`${e.dim} HMR: ws://localhost:${m}${e.reset}`);console.log(`
1433
1433
  ${e.yellow}Routes:${e.reset}`);let _t=[...Tr(k,p)];for(let{route:O}of D)_t.push(`${O.pattern}`);if(_t.forEach((O,F)=>{let W=F===_t.length-1?"\u2514\u2500 ":"\u251C\u2500 ";console.log(` ${e.green}${W}${e.reset}${O}`)}),console.log(`
1434
- Press ${e.cyan}h${e.reset} + ${e.cyan}Enter${e.reset} to show shortcuts`),Qe(Mt.url.toString(),()=>{if(l)ht();Mt.stop()}),s.native){let O,F=ie.join(C,"index.stx");if(ve.existsSync(F)){let W=await Bun.file(F).text();O=Tt(W)}let z=g?.app?.window??{};await dt(et,{title:g?.app?.head?.title||ie.basename(p)||"stx App",width:z.width,height:z.height,darkMode:z.darkMode,hotReload:z.hotReload,titlebarHidden:z.titlebarHidden??s.titlebarHidden===!0,nativeSidebar:!!O,sidebarConfig:O})}if(d){console.log(`${e.blue}Watching for changes...${e.reset}`);let O=(ee)=>ee.startsWith("public/")||ee.startsWith("public\\"),F=(ee)=>{let Q=ee.toLowerCase();return Q.endsWith(".stx")||Q.endsWith(".html")||Q.endsWith(".md")},z=new Map,W=()=>{let ee=new Set([p,...g._layerGraph?.layers.map((Q)=>Q.root)??[],...g._layerGraph?.configDependencies.map((Q)=>ie.dirname(Q))??[]].filter((Q)=>ve.existsSync(Q)).map((Q)=>ve.realpathSync(Q)));for(let Q of g._layerGraph?.layers??[])for(let V of Object.values(Q.resources)){if(!ve.existsSync(V))continue;let K=ve.realpathSync(V);if(![...ee].some((ke)=>K===ke||K.startsWith(`${ke}${ie.sep}`)))ee.add(K)}for(let[Q,V]of z)if(!ee.has(Q))V.close(),z.delete(Q);for(let Q of ee)if(!z.has(Q)&&ve.existsSync(Q))z.set(Q,ve.watch(Q,{recursive:!0},(V,K)=>{ze(Q,V,K).catch((ke)=>console.error("[stx] Layer rebuild failed:",ke))}))},we=Promise.resolve(),ze=(ee,Q,V)=>(we=we.catch(()=>{}).then(()=>Ge(ee,Q,V)),we),Ge=async(ee,Q,V)=>{if(!V||Rt(V))return;if(Ct(V)){if(g._layerGraph){let K=await h(p);Object.assign(g,K),k.splice(0,k.length,...L(v,{pagesDir:x,pagesDirs:K._layerPageDirs?[C,...K._layerPageDirs.slice(1)]:void 0})),W()}if(O(V)){if(console.log(`${e.cyan}${V} changed${e.reset}`),c&&l)l.reload(V)}else if(F(V)){console.log(`${e.yellow}${V} changed, rebuilding...${e.reset}`),xe.clear(),ne();try{let{invalidateFileCache:K,templateCache:ke}=await import("./chunk-t431anrx.js");K(ie.resolve(ee,V)),ke.delete(ie.resolve(ee,V))}catch{}if(M&&V){if(ie.resolve(ee,V)===M||ie.basename(M)===V){let ke=await Fr(M,s.stxOptions||{});if(ke)E=ke}}if(await qe(),await bn(p),c&&l)l.reload(V)}else{console.log(`${e.yellow}${V} changed, rebuilding...${e.reset}`),xe.clear(),ne();try{let{invalidateFileCache:K,templateCache:ke}=await import("./chunk-t431anrx.js");K(ie.resolve(ee,V)),ke.delete(ie.resolve(ee,V))}catch{}if(await qe(),c&&l)l.reload(V)}}else if($t(V)){if(console.log(`${e.cyan}CSS ${V} changed${e.reset}`),c&&l)l.updateCss(V)}};W(),process.on("SIGINT",()=>{for(let ee of z.values())ee.close();if(l)ht();Mt.stop(),process.exit(0)})}return!0}import Vt from"fs";import yt from"path";async function Qr(t){try{let i=(await Bun.file(t).text()).match(/<script\b[^>]*>([\s\S]*?)<\/script>/i);if(!i)return[];let d=i[1],c=[],l=/\/\*\*\s*([\s\S]*?)\s*\*\/\s*(?:(?:const|let|var)\s*)?(?:([\w$]+)\s*=|module\.exports\.([\w$]+)\s*=|\s*([\w$]+)\s*:)/g,m;while((m=l.exec(d))!==null){let p=m[1],h=m[2]||m[3]||m[4];if(!h)continue;let g={name:h},y=p.match(/@type\s+\{([^}]+)\}/i);if(y)g.type=y[1].trim();if(p.match(/@required/i))g.required=!0;let S=p.match(/@default\s+(.+?)(?:\s+|$)/i);if(S)g.default=S[1].trim();let R=p.split(`
1434
+ Press ${e.cyan}h${e.reset} + ${e.cyan}Enter${e.reset} to show shortcuts`),Qe(Mt.url.toString(),()=>{if(l)ht();Mt.stop()}),s.native){let O,F=ie.join(C,"index.stx");if(ve.existsSync(F)){let W=await Bun.file(F).text();O=Tt(W)}let z=g?.app?.window??{};await dt(et,{title:g?.app?.head?.title||ie.basename(p)||"stx App",width:z.width,height:z.height,darkMode:z.darkMode,hotReload:z.hotReload,titlebarHidden:z.titlebarHidden??s.titlebarHidden===!0,nativeSidebar:!!O,sidebarConfig:O})}if(d){console.log(`${e.blue}Watching for changes...${e.reset}`);let O=(ee)=>ee.startsWith("public/")||ee.startsWith("public\\"),F=(ee)=>{let Q=ee.toLowerCase();return Q.endsWith(".stx")||Q.endsWith(".html")||Q.endsWith(".md")},z=new Map,W=()=>{let ee=new Set([p,...g._layerGraph?.layers.map((Q)=>Q.root)??[],...g._layerGraph?.configDependencies.map((Q)=>ie.dirname(Q))??[]].filter((Q)=>ve.existsSync(Q)).map((Q)=>ve.realpathSync(Q)));for(let Q of g._layerGraph?.layers??[])for(let V of Object.values(Q.resources)){if(!ve.existsSync(V))continue;let K=ve.realpathSync(V);if(![...ee].some((ke)=>K===ke||K.startsWith(`${ke}${ie.sep}`)))ee.add(K)}for(let[Q,V]of z)if(!ee.has(Q))V.close(),z.delete(Q);for(let Q of ee)if(!z.has(Q)&&ve.existsSync(Q))z.set(Q,ve.watch(Q,{recursive:!0},(V,K)=>{ze(Q,V,K).catch((ke)=>console.error("[stx] Layer rebuild failed:",ke))}))},we=Promise.resolve(),ze=(ee,Q,V)=>(we=we.catch(()=>{}).then(()=>Ge(ee,Q,V)),we),Ge=async(ee,Q,V)=>{if(!V||Rt(V))return;if(Ct(V)){if(g._layerGraph){let K=await h(p);Object.assign(g,K),k.splice(0,k.length,...L(v,{pagesDir:x,pagesDirs:K._layerPageDirs?[C,...K._layerPageDirs.slice(1)]:void 0})),W()}if(O(V)){if(console.log(`${e.cyan}${V} changed${e.reset}`),c&&l)l.reload(V)}else if(F(V)){console.log(`${e.yellow}${V} changed, rebuilding...${e.reset}`),xe.clear(),ne();try{let{invalidateFileCache:K,templateCache:ke}=await import("./chunk-4vnwge6p.js");K(ie.resolve(ee,V)),ke.delete(ie.resolve(ee,V))}catch{}if(M&&V){if(ie.resolve(ee,V)===M||ie.basename(M)===V){let ke=await Fr(M,s.stxOptions||{});if(ke)E=ke}}if(await qe(),await bn(p),c&&l)l.reload(V)}else{console.log(`${e.yellow}${V} changed, rebuilding...${e.reset}`),xe.clear(),ne();try{let{invalidateFileCache:K,templateCache:ke}=await import("./chunk-4vnwge6p.js");K(ie.resolve(ee,V)),ke.delete(ie.resolve(ee,V))}catch{}if(await qe(),c&&l)l.reload(V)}}else if($t(V)){if(console.log(`${e.cyan}CSS ${V} changed${e.reset}`),c&&l)l.updateCss(V)}};W(),process.on("SIGINT",()=>{for(let ee of z.values())ee.close();if(l)ht();Mt.stop(),process.exit(0)})}return!0}import Vt from"fs";import yt from"path";async function Qr(t){try{let i=(await Bun.file(t).text()).match(/<script\b[^>]*>([\s\S]*?)<\/script>/i);if(!i)return[];let d=i[1],c=[],l=/\/\*\*\s*([\s\S]*?)\s*\*\/\s*(?:(?:const|let|var)\s*)?(?:([\w$]+)\s*=|module\.exports\.([\w$]+)\s*=|\s*([\w$]+)\s*:)/g,m;while((m=l.exec(d))!==null){let p=m[1],h=m[2]||m[3]||m[4];if(!h)continue;let g={name:h},y=p.match(/@type\s+\{([^}]+)\}/i);if(y)g.type=y[1].trim();if(p.match(/@required/i))g.required=!0;let S=p.match(/@default\s+(.+?)(?:\s+|$)/i);if(S)g.default=S[1].trim();let R=p.split(`
1435
1435
  `).map((v)=>v.trim().replace(/^\*\s*/,"")).filter((v)=>!v.startsWith("@")&&v.length>0);g.description=R.join(" ").trim(),c.push(g)}if(c.length===0){let p=d.match(/module\.exports\s*=\s*\{([^}]+)\}/i);if(p){let g=p[1].split(",").map((y)=>y.trim()).filter(Boolean);for(let y of g){let[w]=y.split(":").map((S)=>S.trim());if(w)c.push({name:w})}}}return c}catch(s){return console.error(`Error extracting props from ${t}:`,s),[]}}async function Zr(t){try{let s=await Bun.file(t).text(),i=s.match(/^\s*<!--\s*([\s\S]*?)\s*-->/)||s.match(/^\s*\/\*\*\s*([\s\S]*?)\s*\*\//);if(i)return i[1].split(`
1436
1436
  `).map((d)=>d.trim().replace(/^\*\s*/,"")).join(" ").trim();return""}catch{return""}}async function eo(t,s=!1,i){let d=yt.basename(t,".stx"),c=await Qr(t),l=await Zr(t),m="";if(s&&i)m=`<${i}></${i}>`;else{let p=c.map((h)=>{if(h.type==="boolean")return`:${h.name}="true"`;return`${h.name}="value"`}).join(`
1437
1437
  `);m=`<${d}
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{Tu,jo,tc,$u,Ru,Au,Pu,Iu,nc,rc,Ou,Du,Nu,Mu}from"./chunk-d4awfk42.js";import"./chunk-sr1md7vv.js";import"./chunk-w24qmxc3.js";import"./chunk-v8ze2q95.js";import"./chunk-k71e38fk.js";import"./chunk-zgv1h2np.js";import"./chunk-k1szsenr.js";import"./chunk-7ra30crf.js";import"./chunk-9cpxzze0.js";import"./chunk-qhr1tkhj.js";import"./chunk-mmbspaqh.js";import"./chunk-c6egfhy6.js";import"./chunk-pxw4edw8.js";import"./chunk-82bttwqm.js";export{tc as SUSPENSE_RESOLVER_RUNTIME,jo as buildSuspenseResolveScript,Iu as createStreamRenderer,Au as extractStreamBoundaries,Mu as generateHydrationRuntime,rc as islandDirective,Du as processSectionDirectives,Ru as processStreamDirectives,Ou as registerStreamingDirectives,$u as renderStreamingPage,Tu as streamTemplate,Pu as streamTemplateSimple,Nu as streamToResponse,nc as streamingSuspenseDirective};
2
+ import{Tu,jo,tc,$u,Ru,Au,Pu,Iu,nc,rc,Ou,Du,Nu,Mu}from"./chunk-wkrf41se.js";import"./chunk-3qmx12d3.js";import"./chunk-w24qmxc3.js";import"./chunk-v8ze2q95.js";import"./chunk-k71e38fk.js";import"./chunk-45x4myqe.js";import"./chunk-k1szsenr.js";import"./chunk-91pdg853.js";import"./chunk-03xsf9jm.js";import"./chunk-qhr1tkhj.js";import"./chunk-mmbspaqh.js";import"./chunk-c6egfhy6.js";import"./chunk-pxw4edw8.js";import"./chunk-82bttwqm.js";export{tc as SUSPENSE_RESOLVER_RUNTIME,jo as buildSuspenseResolveScript,Iu as createStreamRenderer,Au as extractStreamBoundaries,Mu as generateHydrationRuntime,rc as islandDirective,Du as processSectionDirectives,Ru as processStreamDirectives,Ou as registerStreamingDirectives,$u as renderStreamingPage,Tu as streamTemplate,Pu as streamTemplateSimple,Nu as streamToResponse,nc as streamingSuspenseDirective};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Qr,Zl,Ql}from"./chunk-mnnxa3r7.js";import"./chunk-cqr5cv7h.js";import"./chunk-yhhfxx17.js";import"./chunk-3y5tzxm6.js";import"./chunk-3qmx12d3.js";import"./chunk-w24qmxc3.js";import"./chunk-v8ze2q95.js";import"./chunk-k71e38fk.js";import"./chunk-45x4myqe.js";import"./chunk-k1szsenr.js";import"./chunk-91pdg853.js";import"./chunk-03xsf9jm.js";import"./chunk-qhr1tkhj.js";import"./chunk-mmbspaqh.js";import"./chunk-c6egfhy6.js";import"./chunk-pxw4edw8.js";import"./chunk-82bttwqm.js";export{Ql as clearComposableCache,Zl as getComposableScript,Qr as listComposableModules};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{un,le}from"./chunk-3y5tzxm6.js";import{m,dn,w,Fe,o,P}from"./chunk-sr1md7vv.js";import{us}from"./chunk-h988fxh3.js";import{s,Se}from"./chunk-y5x8xnnf.js";import{a}from"./chunk-sjkdpsca.js";import h from"path";import v from"fs";import{AsyncLocalStorage as fe}from"async_hooks";var me=10;function J(e,n,r){return/^(?:(?:stx|ui)\.config\.[cm]?[jt]s|runtime-config-(?:server|loader)\.[cm]?[jt]s)$/.test(h.basename(e))||us(e,n,r)}var re=1,se=new Map,V=600,ge=100,W=new Map;async function he(e){let n=W.get(e)??0;if(n>0&&n<ge){W.set(e,n+1);return}W.set(e,1);try{let r=(await v.promises.readdir(e)).filter((c)=>c.endsWith(".js"));if(r.length<=V)return;let p=(await Promise.all(r.map(async(c)=>{try{return{name:c,at:(await v.promises.stat(h.join(e,c))).mtimeMs}}catch{return null}}))).filter((c)=>c!==null);p.sort((c,l)=>l.at-c.at);for(let c of p.slice(V)){let l=c.name.slice(0,-3);await v.promises.rm(h.join(e,`${l}.js`),{force:!0}),await v.promises.rm(h.join(e,`${l}.deps.json`),{force:!0})}D("pruned bundle cache to",V,"entries")}catch{}}function ce(e){return se.get(e)??[]}function X(e,n){if(e)se.set(e,n)}function uc(e=process.env){return e.STX_DEBUG==="true"||e.STX_DEBUG==="1"}function D(...e){if(uc())console.log("[stx:bundler]",...e)}var Z=[];function ri(e,n,r){Z.push({filePath:e||"<inline>",message:n,details:r})}function vt(){return Z.slice()}function wt(){Z.length=0}var H;function Wu(e){H=e}function si(){if(H)return H;try{let e=P.strict;return typeof e==="object"&&e!==null?e.bundlerFallback??"warn":"warn"}catch{return"warn"}}var q=[/^stx$/,/^@stacksjs\/stx$/,/^@stores$/,/^stx\/stores$/,/^@composables$/];function xt(e){let n=/^[ \t]*import[ \t]+(?!type(?:[ \t]|{))[\s\S]*?\s+from\s+['"]([^'"]+)['"][ \t]*;?/gm,r;while((r=n.exec(e))!==null){let p=r[1];if(!q.some((l)=>l.test(p)))return D("detected user import:",p),!0}let u=/^[ \t]*import[ \t]*['"]([^'"]+)['"]/gm;while((r=u.exec(e))!==null){let p=r[1];if(/\.css(?:\?.*)?$/.test(p))continue;if(!q.some((l)=>l.test(p)))return D("detected side-effect import:",p),!0}return!1}var ln="stx-module:",xe=/\.(?:[cm]?[jt]sx?|json)$/i;function dc(e,n){return h.relative(e,n).split(h.sep).join("/")}function pc(e,n){if(n.size===0)return e;return e.replace(/^([ \t]*import(?:(?:\s+|(?=[{*]))[^;"']*?\s*from\s*|\s*))(["'])([^"']+)\2/gm,(r,u,p,c)=>{let l=n.get(c);return l&&!c.startsWith(ln)?`${u}${p}${l}${p}`:r})}function fc(e,n){let r=0,u=(c)=>{let l=`__stxMod${r++}`,E=JSON.stringify(c);return n.push(`var ${l} = globalThis.__stxModules && globalThis.__stxModules[${E}];`,`if (${l} === undefined) throw new Error("[stx] module " + ${JSON.stringify(E)} + " is not registered on this page (#1957)");`),l},p=(c,l)=>{for(let E of c.split(",")){let _=E.trim();if(!_)continue;let j=_.match(/^("(?:[^"\\]|\\.)*"|[\w$]+)(?:\s+as\s+([\w$]+))?$/);if(!j)continue;let d=j[1].startsWith('"')?JSON.parse(j[1]):j[1],t=j[2]??d;n.push(`var ${t} = ${l}[${JSON.stringify(d)}];`)}};return e=e.replace(/^[ \t]*import(?:\s+|(?=[{*]))([^;"']+?)\s*from\s*["'](stx-module:[^"']+)["'];?[ \t]*$/gm,(c,l,E)=>{let _=E.slice(ln.length),j=u(_),d=l.trim(),t=d.match(/^([\w$]+)\s*(?:,\s*|$)/);if(t&&!d.startsWith("{")&&!d.startsWith("*"))n.push(`var ${t[1]} = ${j}.default;`),d=d.slice(t[0].length).trim();let i=d.match(/^\*\s*as\s+([\w$]+)$/);if(i)n.push(`var ${i[1]} = ${j};`);else if(d.startsWith("{"))p(d.replace(/^\{|\}$/g,""),j);return""}),e=e.replace(/^[ \t]*import\s*["'](stx-module:[^"']+)["'];?[ \t]*$/gm,(c,l)=>(u(l.slice(ln.length)),"")),e}function te(e){let n=[e,`${e}.ts`,`${e}.tsx`,`${e}.js`,`${e}.mjs`,`${e}.jsx`,h.join(e,"index.ts"),h.join(e,"index.tsx"),h.join(e,"index.js"),h.join(e,"index.mjs")];for(let r of n)try{if(v.existsSync(r)&&v.statSync(r,{throwIfNoEntry:!1})?.isFile())return r}catch{}return}var Y=new fe;function is(e,n){let r=new Bun.CryptoHasher("md5");for(let[u,p]of[...e].sort(([c],[l])=>c<l?-1:c>l?1:0))r.update(`${u}\x00${p}\x00`);return Y.run({modules:e,key:r.digest("hex").slice(0,12)},n)}function St(){return Y.getStore()?.key??""}function $e(e,n,r,u,p,c=new Map,l,E){let _=(d,t,i)=>{if(J(t,e,l))return null;if(!p||d!==r||!xe.test(t))return null;try{if(!v.statSync(t,{throwIfNoEntry:!1})?.isFile())return null}catch{return null}u.add(t);let x=`${ln}${dc(process.cwd(),t)}`;return c.set(i,x),{path:x,external:!0}},j=(d,t)=>{let i=d===r?n:h.dirname(d),x=h.resolve(i,t);return te(x)??x};return{name:"stx-client-bundle",setup(d){if(d.onResolve({filter:/^(stx|@stacksjs\/stx)$/},(t)=>({path:t.path,external:!0})),d.onResolve({filter:/^(@stores|@composables|stx\/stores)$/},(t)=>({path:t.path,external:!0})),d.onResolve({filter:/^\//},(t)=>{let i=te(t.path);if(i){let x=_(t.importer,i,t.path);if(x)return x;if(i!==r)u.add(i);return{path:i}}return{path:t.path,external:!0}}),d.onResolve({filter:/^\.\.?\//},(t)=>{let i=j(t.importer,t.path),x=_(t.importer,i,t.path);if(x)return x;return u.add(i),{path:i}}),d.onResolve({filter:/^[@~]\//},(t)=>{let i=h.resolve(e,t.path.slice(2)),x=[i,`${i}.ts`,`${i}.tsx`,`${i}.js`,`${i}.mjs`,`${i}.jsx`,h.join(i,"index.ts"),h.join(i,"index.tsx"),h.join(i,"index.js"),h.join(i,"index.mjs")];for(let F of x)if(v.existsSync(F)&&v.statSync(F,{throwIfNoEntry:!1})?.isFile()){let B=_(t.importer,F,t.path);if(B)return B;return D(`resolved ${t.path[0]}/ import:`,t.path,"\u2192",F),u.add(F),{path:F}}return console.warn(`[stx:bundler] could not resolve ${t.path[0]}/ import:`,t.path),{path:i}}),p)d.onResolve({filter:/^(?!node:|bun:)(?:@[\w.-]+\/)?[\w.-]/},(t)=>{if(t.importer!==r)return;let i=`${ln}npm:${t.path}`;return c.set(t.path,i),{path:i,external:!0}});d.onLoad({filter:/\.(?:[cm]?[jt]sx?|json)$/},(t)=>{if(J(t.path,e,l))throw Error(`Server-only API source cannot be imported by a client script: ${t.path}`);let i=h.extname(t.path).toLowerCase(),x=i===".json"?"json":i===".tsx"?"tsx":i===".jsx"?"jsx":i===".ts"||i===".mts"||i===".cts"?"ts":"js";if(t.path!==r)u.add(t.path);let F=E?.get(t.path);if(F!==void 0)return{contents:F,loader:"js"};return{contents:v.readFileSync(t.path,"utf8"),loader:x}})}}}var G=new Map,k=m(64),ne=Symbol.for("stx.client-bundle-build-queue");function gc(e){let n=globalThis,u=(n[ne]??Promise.resolve()).then(e,e);return n[ne]=u.then(()=>{return},()=>{return}),u}async function kt(e,n,r={}){let u=r.projectRoot||process.cwd(),p=(await o(u)).serverApi,c=r.minify??!1,l=r.externalizeUserModules??!0,E=r.expose?.length?[...new Set(r.expose)].sort():void 0,_=r.cacheDir||a(u,"bundle-cache"),j=Y.getStore(),d=new Bun.CryptoHasher("md5");d.update(`${me}\x00${Fe()}\x00${JSON.stringify(p??!1)}\x00${l?"registry":"inline"}\x00${E?E.join(","):"*"}\x00${c?"minified":"readable"}\x00${j?.key??""}\x00${e}\x00${n}`);let t=d.digest("hex").slice(0,12),i=h.join(_,`${t}.js`),x=k.get(i);if(x){if(dn(x.files)&&x.files.every((M)=>!J(M.path,u,p))){D("memo hit:",t);let M=x.files.map((A)=>A.path);return X(n,M),r.collectInputs?.push(...M),x.code}k.delete(i),D("memo invalidated by dep change:",t)}let F=h.join(_,`${t}.deps.json`),B=Bun.file(i);if(await B.exists()){let M=Bun.file(F),A=!1,N=null;if(await M.exists())try{let I=JSON.parse(await M.text());if(I.metadataVersion!==re||!Array.isArray(I.files))A=!1;else N=I.files,A=!0;if(N&&(!dn(N)||N.some((g)=>J(g.path,u,p))))A=!1}catch{A=!1}if(A){if(D("cache hit:",t),N)X(n,N.map((g)=>g.path)),r.collectInputs?.push(...N.map((g)=>g.path));let I=await B.text();if(N)k.set(i,{code:I,files:N});return I}D("cache invalidated by dep change:",t)}let U=G.get(t);if(U){let M=await U;if(r.collectInputs)r.collectInputs.push(...(k.get(i)?.files??[]).map((A)=>A.path));return M}let L=gc(()=>be(e,n,{projectRoot:u,minify:c,cacheDir:_,hash:t,cachePath:i,depsPath:F,collectInputs:r.collectInputs,externalizeUserModules:l,serverApi:p,expose:E,throwOnFailure:r.throwOnFailure,substitutes:j?.modules}));G.set(t,L);try{return await L}finally{G.delete(t)}}var ye=0;function mc(e){return`${e}-${process.pid}-${++ye}`}async function be(e,n,r){let{projectRoot:u,minify:p,cacheDir:c,hash:l,cachePath:E,depsPath:_,externalizeUserModules:j}=r,d=a(u,"bundle-tmp"),t=mc(l),i=h.join(d,`${t}.ts`),x=h.join(d,"out",t);v.mkdirSync(d,{recursive:!0}),v.mkdirSync(x,{recursive:!0});let F=h.dirname(n),B=new Set,U=/^[ \t]*(export\s+)?(?:const|let|var)\s+(?:\{([^}]+)\}|(\w+))/gm,L=/^[ \t]*(export\s+)?(?:async\s+)?function\s+(\w+)/gm,M=s(e),{depths:A,balanced:N}=Se(M),I=(S)=>!N||A[S]===0,g;while((g=U.exec(M))!==null){if(g[1])continue;if(!I(g.index))continue;if(g[2])g[2].split(",").forEach((S)=>{let f=we(S);if(f)B.add(f)});else if(g[3])B.add(g[3])}while((g=L.exec(M))!==null){if(g[1])continue;if(!I(g.index))continue;B.add(g[2])}let ie=/^[ \t]*import[ \t]+(?!type\b)(?:(\w+)\s*(?:,\s*)?)?(?:\*\s+as\s+(\w+)|\{([^}]+)\})?\s+from\b/gm;while((g=ie.exec(M))!==null){if(!I(g.index))continue;let S=/^\s*['"]([^'"]+)['"]/.exec(e.slice(g.index+g[0].length))?.[1];if(S&&q.some((f)=>f.test(S)))continue;if(g[1])B.add(g[1]);if(g[2])B.add(g[2]);for(let f of(g[3]??"").split(",")){let b=f.trim();if(!b||/^type\s/.test(b))continue;let T=/\bas\s+(\w+)\s*$/.exec(b)?.[1]??/^\w+$/.exec(b)?.[0];if(T)B.add(T)}}for(let S of M.matchAll(/\bexport\s*\{([^}]+)\}/g))for(let f of S[1].split(",")){let b=/\bas\s+(\w+)\s*$/.exec(f)?.[1]??/^\s*(\w+)\s*$/.exec(f)?.[1];if(b)B.delete(b)}let oe=B.size>0?`
2
+ import{un,le}from"./chunk-3y5tzxm6.js";import{m,dn,w,Fe,o,P}from"./chunk-3qmx12d3.js";import{us}from"./chunk-yhhfxx17.js";import{s,Se}from"./chunk-y5x8xnnf.js";import{a}from"./chunk-sjkdpsca.js";import h from"path";import v from"fs";import{AsyncLocalStorage as fe}from"async_hooks";var me=10;function J(e,n,r){return/^(?:(?:stx|ui)\.config\.[cm]?[jt]s|runtime-config-(?:server|loader)\.[cm]?[jt]s)$/.test(h.basename(e))||us(e,n,r)}var re=1,se=new Map,V=600,ge=100,W=new Map;async function he(e){let n=W.get(e)??0;if(n>0&&n<ge){W.set(e,n+1);return}W.set(e,1);try{let r=(await v.promises.readdir(e)).filter((c)=>c.endsWith(".js"));if(r.length<=V)return;let p=(await Promise.all(r.map(async(c)=>{try{return{name:c,at:(await v.promises.stat(h.join(e,c))).mtimeMs}}catch{return null}}))).filter((c)=>c!==null);p.sort((c,l)=>l.at-c.at);for(let c of p.slice(V)){let l=c.name.slice(0,-3);await v.promises.rm(h.join(e,`${l}.js`),{force:!0}),await v.promises.rm(h.join(e,`${l}.deps.json`),{force:!0})}D("pruned bundle cache to",V,"entries")}catch{}}function ce(e){return se.get(e)??[]}function X(e,n){if(e)se.set(e,n)}function uc(e=process.env){return e.STX_DEBUG==="true"||e.STX_DEBUG==="1"}function D(...e){if(uc())console.log("[stx:bundler]",...e)}var Z=[];function ri(e,n,r){Z.push({filePath:e||"<inline>",message:n,details:r})}function vt(){return Z.slice()}function wt(){Z.length=0}var H;function Wu(e){H=e}function si(){if(H)return H;try{let e=P.strict;return typeof e==="object"&&e!==null?e.bundlerFallback??"warn":"warn"}catch{return"warn"}}var q=[/^stx$/,/^@stacksjs\/stx$/,/^@stores$/,/^stx\/stores$/,/^@composables$/];function xt(e){let n=/^[ \t]*import[ \t]+(?!type(?:[ \t]|{))[\s\S]*?\s+from\s+['"]([^'"]+)['"][ \t]*;?/gm,r;while((r=n.exec(e))!==null){let p=r[1];if(!q.some((l)=>l.test(p)))return D("detected user import:",p),!0}let u=/^[ \t]*import[ \t]*['"]([^'"]+)['"]/gm;while((r=u.exec(e))!==null){let p=r[1];if(/\.css(?:\?.*)?$/.test(p))continue;if(!q.some((l)=>l.test(p)))return D("detected side-effect import:",p),!0}return!1}var ln="stx-module:",xe=/\.(?:[cm]?[jt]sx?|json)$/i;function dc(e,n){return h.relative(e,n).split(h.sep).join("/")}function pc(e,n){if(n.size===0)return e;return e.replace(/^([ \t]*import(?:(?:\s+|(?=[{*]))[^;"']*?\s*from\s*|\s*))(["'])([^"']+)\2/gm,(r,u,p,c)=>{let l=n.get(c);return l&&!c.startsWith(ln)?`${u}${p}${l}${p}`:r})}function fc(e,n){let r=0,u=(c)=>{let l=`__stxMod${r++}`,E=JSON.stringify(c);return n.push(`var ${l} = globalThis.__stxModules && globalThis.__stxModules[${E}];`,`if (${l} === undefined) throw new Error("[stx] module " + ${JSON.stringify(E)} + " is not registered on this page (#1957)");`),l},p=(c,l)=>{for(let E of c.split(",")){let _=E.trim();if(!_)continue;let j=_.match(/^("(?:[^"\\]|\\.)*"|[\w$]+)(?:\s+as\s+([\w$]+))?$/);if(!j)continue;let d=j[1].startsWith('"')?JSON.parse(j[1]):j[1],t=j[2]??d;n.push(`var ${t} = ${l}[${JSON.stringify(d)}];`)}};return e=e.replace(/^[ \t]*import(?:\s+|(?=[{*]))([^;"']+?)\s*from\s*["'](stx-module:[^"']+)["'];?[ \t]*$/gm,(c,l,E)=>{let _=E.slice(ln.length),j=u(_),d=l.trim(),t=d.match(/^([\w$]+)\s*(?:,\s*|$)/);if(t&&!d.startsWith("{")&&!d.startsWith("*"))n.push(`var ${t[1]} = ${j}.default;`),d=d.slice(t[0].length).trim();let i=d.match(/^\*\s*as\s+([\w$]+)$/);if(i)n.push(`var ${i[1]} = ${j};`);else if(d.startsWith("{"))p(d.replace(/^\{|\}$/g,""),j);return""}),e=e.replace(/^[ \t]*import\s*["'](stx-module:[^"']+)["'];?[ \t]*$/gm,(c,l)=>(u(l.slice(ln.length)),"")),e}function te(e){let n=[e,`${e}.ts`,`${e}.tsx`,`${e}.js`,`${e}.mjs`,`${e}.jsx`,h.join(e,"index.ts"),h.join(e,"index.tsx"),h.join(e,"index.js"),h.join(e,"index.mjs")];for(let r of n)try{if(v.existsSync(r)&&v.statSync(r,{throwIfNoEntry:!1})?.isFile())return r}catch{}return}var Y=new fe;function is(e,n){let r=new Bun.CryptoHasher("md5");for(let[u,p]of[...e].sort(([c],[l])=>c<l?-1:c>l?1:0))r.update(`${u}\x00${p}\x00`);return Y.run({modules:e,key:r.digest("hex").slice(0,12)},n)}function St(){return Y.getStore()?.key??""}function $e(e,n,r,u,p,c=new Map,l,E){let _=(d,t,i)=>{if(J(t,e,l))return null;if(!p||d!==r||!xe.test(t))return null;try{if(!v.statSync(t,{throwIfNoEntry:!1})?.isFile())return null}catch{return null}u.add(t);let x=`${ln}${dc(process.cwd(),t)}`;return c.set(i,x),{path:x,external:!0}},j=(d,t)=>{let i=d===r?n:h.dirname(d),x=h.resolve(i,t);return te(x)??x};return{name:"stx-client-bundle",setup(d){if(d.onResolve({filter:/^(stx|@stacksjs\/stx)$/},(t)=>({path:t.path,external:!0})),d.onResolve({filter:/^(@stores|@composables|stx\/stores)$/},(t)=>({path:t.path,external:!0})),d.onResolve({filter:/^\//},(t)=>{let i=te(t.path);if(i){let x=_(t.importer,i,t.path);if(x)return x;if(i!==r)u.add(i);return{path:i}}return{path:t.path,external:!0}}),d.onResolve({filter:/^\.\.?\//},(t)=>{let i=j(t.importer,t.path),x=_(t.importer,i,t.path);if(x)return x;return u.add(i),{path:i}}),d.onResolve({filter:/^[@~]\//},(t)=>{let i=h.resolve(e,t.path.slice(2)),x=[i,`${i}.ts`,`${i}.tsx`,`${i}.js`,`${i}.mjs`,`${i}.jsx`,h.join(i,"index.ts"),h.join(i,"index.tsx"),h.join(i,"index.js"),h.join(i,"index.mjs")];for(let F of x)if(v.existsSync(F)&&v.statSync(F,{throwIfNoEntry:!1})?.isFile()){let B=_(t.importer,F,t.path);if(B)return B;return D(`resolved ${t.path[0]}/ import:`,t.path,"\u2192",F),u.add(F),{path:F}}return console.warn(`[stx:bundler] could not resolve ${t.path[0]}/ import:`,t.path),{path:i}}),p)d.onResolve({filter:/^(?!node:|bun:)(?:@[\w.-]+\/)?[\w.-]/},(t)=>{if(t.importer!==r)return;let i=`${ln}npm:${t.path}`;return c.set(t.path,i),{path:i,external:!0}});d.onLoad({filter:/\.(?:[cm]?[jt]sx?|json)$/},(t)=>{if(J(t.path,e,l))throw Error(`Server-only API source cannot be imported by a client script: ${t.path}`);let i=h.extname(t.path).toLowerCase(),x=i===".json"?"json":i===".tsx"?"tsx":i===".jsx"?"jsx":i===".ts"||i===".mts"||i===".cts"?"ts":"js";if(t.path!==r)u.add(t.path);let F=E?.get(t.path);if(F!==void 0)return{contents:F,loader:"js"};return{contents:v.readFileSync(t.path,"utf8"),loader:x}})}}}var G=new Map,k=m(64),ne=Symbol.for("stx.client-bundle-build-queue");function gc(e){let n=globalThis,u=(n[ne]??Promise.resolve()).then(e,e);return n[ne]=u.then(()=>{return},()=>{return}),u}async function kt(e,n,r={}){let u=r.projectRoot||process.cwd(),p=(await o(u)).serverApi,c=r.minify??!1,l=r.externalizeUserModules??!0,E=r.expose?.length?[...new Set(r.expose)].sort():void 0,_=r.cacheDir||a(u,"bundle-cache"),j=Y.getStore(),d=new Bun.CryptoHasher("md5");d.update(`${me}\x00${Fe()}\x00${JSON.stringify(p??!1)}\x00${l?"registry":"inline"}\x00${E?E.join(","):"*"}\x00${c?"minified":"readable"}\x00${j?.key??""}\x00${e}\x00${n}`);let t=d.digest("hex").slice(0,12),i=h.join(_,`${t}.js`),x=k.get(i);if(x){if(dn(x.files)&&x.files.every((M)=>!J(M.path,u,p))){D("memo hit:",t);let M=x.files.map((A)=>A.path);return X(n,M),r.collectInputs?.push(...M),x.code}k.delete(i),D("memo invalidated by dep change:",t)}let F=h.join(_,`${t}.deps.json`),B=Bun.file(i);if(await B.exists()){let M=Bun.file(F),A=!1,N=null;if(await M.exists())try{let I=JSON.parse(await M.text());if(I.metadataVersion!==re||!Array.isArray(I.files))A=!1;else N=I.files,A=!0;if(N&&(!dn(N)||N.some((g)=>J(g.path,u,p))))A=!1}catch{A=!1}if(A){if(D("cache hit:",t),N)X(n,N.map((g)=>g.path)),r.collectInputs?.push(...N.map((g)=>g.path));let I=await B.text();if(N)k.set(i,{code:I,files:N});return I}D("cache invalidated by dep change:",t)}let U=G.get(t);if(U){let M=await U;if(r.collectInputs)r.collectInputs.push(...(k.get(i)?.files??[]).map((A)=>A.path));return M}let L=gc(()=>be(e,n,{projectRoot:u,minify:c,cacheDir:_,hash:t,cachePath:i,depsPath:F,collectInputs:r.collectInputs,externalizeUserModules:l,serverApi:p,expose:E,throwOnFailure:r.throwOnFailure,substitutes:j?.modules}));G.set(t,L);try{return await L}finally{G.delete(t)}}var ye=0;function mc(e){return`${e}-${process.pid}-${++ye}`}async function be(e,n,r){let{projectRoot:u,minify:p,cacheDir:c,hash:l,cachePath:E,depsPath:_,externalizeUserModules:j}=r,d=a(u,"bundle-tmp"),t=mc(l),i=h.join(d,`${t}.ts`),x=h.join(d,"out",t);v.mkdirSync(d,{recursive:!0}),v.mkdirSync(x,{recursive:!0});let F=h.dirname(n),B=new Set,U=/^[ \t]*(export\s+)?(?:const|let|var)\s+(?:\{([^}]+)\}|(\w+))/gm,L=/^[ \t]*(export\s+)?(?:async\s+)?function\s+(\w+)/gm,M=s(e),{depths:A,balanced:N}=Se(M),I=(S)=>!N||A[S]===0,g;while((g=U.exec(M))!==null){if(g[1])continue;if(!I(g.index))continue;if(g[2])g[2].split(",").forEach((S)=>{let f=we(S);if(f)B.add(f)});else if(g[3])B.add(g[3])}while((g=L.exec(M))!==null){if(g[1])continue;if(!I(g.index))continue;B.add(g[2])}let ie=/^[ \t]*import[ \t]+(?!type\b)(?:(\w+)\s*(?:,\s*)?)?(?:\*\s+as\s+(\w+)|\{([^}]+)\})?\s+from\b/gm;while((g=ie.exec(M))!==null){if(!I(g.index))continue;let S=/^\s*['"]([^'"]+)['"]/.exec(e.slice(g.index+g[0].length))?.[1];if(S&&q.some((f)=>f.test(S)))continue;if(g[1])B.add(g[1]);if(g[2])B.add(g[2]);for(let f of(g[3]??"").split(",")){let b=f.trim();if(!b||/^type\s/.test(b))continue;let T=/\bas\s+(\w+)\s*$/.exec(b)?.[1]??/^\w+$/.exec(b)?.[0];if(T)B.add(T)}}for(let S of M.matchAll(/\bexport\s*\{([^}]+)\}/g))for(let f of S[1].split(",")){let b=/\bas\s+(\w+)\s*$/.exec(f)?.[1]??/^\s*(\w+)\s*$/.exec(f)?.[1];if(b)B.delete(b)}let oe=B.size>0?`
3
3
  export { ${[...B].join(", ")} }`:"";await Bun.write(i,e+oe),D("bundling:",l,"from:",h.basename(n));let Q=new Set,K=new Map;try{let S=await Bun.build({entrypoints:[i],outdir:x,target:"browser",format:"esm",minify:p?{whitespace:!1,identifiers:!0,syntax:!0}:!1,plugins:[$e(u,F,i,Q,j,K,r.serverApi,r.substitutes)],define:{"process.env.NODE_ENV":p?'"production"':'"development"',...w()},root:u});if(!S.success){let R=S.logs.filter((O)=>O.level==="error").map((O)=>O.message).join(", ")||`Unable to bundle ${h.basename(n)}`,C=un(S.logs,n||void 0);if(console.warn("[stx:bundler] build failed:",R),ri(n||"",R,C),r.throwOnFailure||si()==="error")throw Error(R);return e}let f="";for(let y of S.outputs){f=await y.text();break}let b=[];for(let y of f.matchAll(/^\s*export\s*\{([^}]*)\}\s*;?\s*$/gm))for(let R of y[1].split(",")){let C=R.trim().match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(C){b.push([C[2],C[1]]);continue}let O=R.trim();if(/^[A-Za-z_$][\w$]*$/.test(O))b.push([O,O])}if(r.expose){let y=new Set(r.expose);for(let R=b.length-1;R>=0;R--)if(!y.has(b[R][0]))b.splice(R,1)}let T=[];f=fc(pc(f,K),T);let ae=f.match(/^\s*import(?:\s+|(?=["'{*]))[^;]+;?\s*$/gm)||[];if(f=f.replace(/^\s*import(?:\s+|(?=["'{*]))[^;]+;?\s*$/gm,"").replace(/^\s*export\s*\{[^}]*\}\s*;?\s*$/gm,"").replace(/^\s*export\s+default\s+.*$/gm,"").trim(),p&&f)try{f=new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync(f)}catch{}let ee=`__stxBundle_${l}`,ue=b.map(([y,R])=>`${JSON.stringify(y)}: ${R}`).join(", "),de=b.map(([y])=>`var ${y} = undefined;`).join(`
4
4
  `),pe=b.map(([y])=>`${y} = ${ee}[${JSON.stringify(y)}];`).join(`
5
5
  `);if(f=`${ae.join(`
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{ca,la}from"./chunk-b217d16p.js";import"./chunk-751b5zv9.js";import"./chunk-kfhghjh6.js";import"./chunk-awgvt956.js";import"./chunk-m7ddgrsm.js";import"./chunk-cy07dhqh.js";import"./chunk-4h58as2c.js";import"./chunk-ww28zfwt.js";import{ko}from"./chunk-076h7nb9.js";import"./chunk-hsy9rhct.js";import"./chunk-haag5n42.js";import"./chunk-d0tmc6v5.js";import"./chunk-tnafnb23.js";import"./chunk-048eyjyj.js";import"./chunk-jtx74677.js";import"./chunk-33q5zka4.js";import"./chunk-6hgngmn0.js";import"./chunk-y09g63k0.js";import"./chunk-bsy10tz6.js";import"./chunk-htcptqtn.js";import"./chunk-e556dvy4.js";import"./chunk-bfbmdjh4.js";import"./chunk-mnnxa3r7.js";import"./chunk-hz11wmx9.js";import"./chunk-q1cvef6b.js";import"./chunk-axz1x4r9.js";import"./chunk-h7atbtds.js";import"./chunk-8s7zbhdd.js";import"./chunk-a30mtx17.js";import"./chunk-j7kcjgxy.js";import"./chunk-wkrf41se.js";import"./chunk-6cg03r93.js";import"./chunk-7xw1e8t6.js";import"./chunk-zrw1zf54.js";import"./chunk-cqr5cv7h.js";import"./chunk-yhhfxx17.js";import"./chunk-3y5tzxm6.js";import{ve,fn,gn,J,u,n,dr,A,o,pe}from"./chunk-3qmx12d3.js";import"./chunk-w24qmxc3.js";import"./chunk-v8ze2q95.js";import"./chunk-k71e38fk.js";import"./chunk-45x4myqe.js";import"./chunk-k1szsenr.js";import"./chunk-91pdg853.js";import"./chunk-03xsf9jm.js";import"./chunk-qhr1tkhj.js";import"./chunk-mmbspaqh.js";import"./chunk-c6egfhy6.js";import"./chunk-pxw4edw8.js";import"./chunk-82bttwqm.js";export{dr as buildWebComponents,gn as cacheTemplate,fn as checkCache,ko as classifyAllScripts,ca as createMiddleware,la as createRoute,A as defaultConfig,u as extractVariables,J as injectRouterScript,o as loadStxConfig,ve as processClientScript,n as processDirectives,pe as readMarkdownFile};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{y}from"./chunk-c6egfhy6.js";import{K,qe,ws,xs,gi,mi,hi,yi,ir,Ss,bi,vi,wi,Ot,o}from"./chunk-sr1md7vv.js";import{Qr}from"./chunk-9e091vkf.js";import{a}from"./chunk-sjkdpsca.js";import{existsSync as M,readFileSync as G}from"fs";import h from"path";var me=new Set(["module","exports","require","$bool","$num","window","document","console","confirm","alert","fetch"]),te=Ot.filter((e)=>!me.has(e)).sort(),ne=[...y].sort(),he=[...new Set([...te,...ne])].sort(),be=new Set(te),ye=new Set(ne),xe=new Set(he),ee=/\bimport\s+(?!type[\s{])\{([^}]*)\}\s*from\s*(['"])stx\2/g;function Se(e,t){if(t==="server")return`'${e}' is not provided by 'stx' in a <script server> block. The engine binds only its own names there (defineProps, state, useHead, ...); any other name becomes \`await import('stx')\`, which does not resolve, so the whole script fails when the page renders. Import it from '@stacksjs/stx' instead.`;return`'${e}' is not provided by 'stx' in a client <script> block. The import is replaced by the window.stx runtime, which has no '${e}', so it is undefined in the browser.`}function ie(e,t){let s=[];for(let u of t){if(u.offset===void 0)continue;let i=u.kind==="server"?be:ye;ee.lastIndex=0;for(let l of u.code.matchAll(ee)){let g=l.index+l[0].indexOf("{")+1;for(let m of l[1].matchAll(/[^,]+/g)){let S=m[0];if(/^\s*type\s/.test(S))continue;let x=/^\s*([A-Za-z_$][\w$]*)/.exec(S);if(!x)continue;let r=x[1];if(!xe.has(r)||i.has(r))continue;let f=u.offset+g+m.index+x[0].length-r.length,p=e.slice(0,f),w=p.split(`
2
+ import{y}from"./chunk-c6egfhy6.js";import{K,qe,ws,xs,gi,mi,hi,yi,ir,Ss,bi,vi,wi,Ot,o}from"./chunk-3qmx12d3.js";import{Qr}from"./chunk-mnnxa3r7.js";import{a}from"./chunk-sjkdpsca.js";import{existsSync as M,readFileSync as G}from"fs";import h from"path";var me=new Set(["module","exports","require","$bool","$num","window","document","console","confirm","alert","fetch"]),te=Ot.filter((e)=>!me.has(e)).sort(),ne=[...y].sort(),he=[...new Set([...te,...ne])].sort(),be=new Set(te),ye=new Set(ne),xe=new Set(he),ee=/\bimport\s+(?!type[\s{])\{([^}]*)\}\s*from\s*(['"])stx\2/g;function Se(e,t){if(t==="server")return`'${e}' is not provided by 'stx' in a <script server> block. The engine binds only its own names there (defineProps, state, useHead, ...); any other name becomes \`await import('stx')\`, which does not resolve, so the whole script fails when the page renders. Import it from '@stacksjs/stx' instead.`;return`'${e}' is not provided by 'stx' in a client <script> block. The import is replaced by the window.stx runtime, which has no '${e}', so it is undefined in the browser.`}function ie(e,t){let s=[];for(let u of t){if(u.offset===void 0)continue;let i=u.kind==="server"?be:ye;ee.lastIndex=0;for(let l of u.code.matchAll(ee)){let g=l.index+l[0].indexOf("{")+1;for(let m of l[1].matchAll(/[^,]+/g)){let S=m[0];if(/^\s*type\s/.test(S))continue;let x=/^\s*([A-Za-z_$][\w$]*)/.exec(S);if(!x)continue;let r=x[1];if(!xe.has(r)||i.has(r))continue;let f=u.offset+g+m.index+x[0].length-r.length,p=e.slice(0,f),w=p.split(`
3
3
  `).length;s.push({line:w,column:f-(p.lastIndexOf(`
4
4
  `)+1)+1,offset:f,length:r.length,name:r,kind:u.kind,message:Se(r,u.kind)})}}}return s}import T from"path";var ke="@stacksjs/stx-typescript-plugin";function we(e,t){let s=T.resolve(e);for(;;){let u=T.join(s,"tsconfig.json");if(t(u))return u;let i=T.dirname(s);if(i===s)return;s=i}}function se(e,t,s){let u=we(e,s);if(!u)return;let i=new Set,l=(g)=>{if(i.has(g))return;i.add(g);let m=t(g);if(!m)return;let S=m.compilerOptions?.plugins;if(Array.isArray(S)){let r=S.find((p)=>p?.name===ke),f=Array.isArray(r?.libs)?r.libs.filter((p)=>typeof p==="string"):[];return r?{configPath:g,libs:f.map((p)=>T.resolve(T.dirname(g),p))}:null}let x=typeof m.extends==="string"?[m.extends]:Array.isArray(m.extends)?m.extends:[];for(let r of[...x].reverse()){if(typeof r!=="string"||!r.startsWith("."))continue;let f=T.resolve(T.dirname(g),r.endsWith(".json")?r:`${r}.json`),p=l(f);if(p!==void 0)return p}return};return l(u)??void 0}function ba(e,t="",s=""){let u=e.startLine>1?`
5
5
  `.repeat(e.startLine-1):"",i=Ss(e)+xs(ws(e.code)),l=e.kind==="client"||e.kind==="plain"?hi(t,e.code):"";return ir(`${u+i}
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{J,Ds,Ns,Ms,n}from"./chunk-sr1md7vv.js";import"./chunk-w24qmxc3.js";import"./chunk-v8ze2q95.js";import"./chunk-k71e38fk.js";import"./chunk-zgv1h2np.js";import"./chunk-k1szsenr.js";import"./chunk-7ra30crf.js";import"./chunk-9cpxzze0.js";import"./chunk-qhr1tkhj.js";import"./chunk-mmbspaqh.js";import"./chunk-c6egfhy6.js";import"./chunk-pxw4edw8.js";import"./chunk-82bttwqm.js";export{J as injectRouterScript,n as processDirectives,Ds as processJsonDirective,Ns as processOnceDirective,Ms as validateClientScript};
2
+ import{J,Ds,Ns,Ms,n}from"./chunk-3qmx12d3.js";import"./chunk-w24qmxc3.js";import"./chunk-v8ze2q95.js";import"./chunk-k71e38fk.js";import"./chunk-45x4myqe.js";import"./chunk-k1szsenr.js";import"./chunk-91pdg853.js";import"./chunk-03xsf9jm.js";import"./chunk-qhr1tkhj.js";import"./chunk-mmbspaqh.js";import"./chunk-c6egfhy6.js";import"./chunk-pxw4edw8.js";import"./chunk-82bttwqm.js";export{J as injectRouterScript,n as processDirectives,Ds as processJsonDirective,Ns as processOnceDirective,Ms as validateClientScript};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{o}from"./chunk-sr1md7vv.js";import{Hr}from"./chunk-s5vxxwg6.js";import p from"path";async function Ml(t={}){let d=performance.now(),s=t.root||process.cwd(),e=await o(s),u=t.ssr?.routeRules??e.routeRules??{};if(Hr(u),!e.ssr&&Object.keys(u).length)throw Error("routeRules require ssr: true and the production server; flat SSG output cannot apply request/cache policies");if(!e.ssr&&(t.ssr?.serverApi??e.serverApi))throw Error("serverApi requires ssr: true; flat SSG output cannot execute API endpoints");let r=e.ssr?"ssr":"ssg";console.log(`[stx build] Mode: ${r.toUpperCase()}${e.ssr?" (ssr: true in stx.config.ts)":" (default \u2014 ssr is false)"}`);let n,l;if(r==="ssg"){let{generateStaticSite:i}=await import("./ssg.js");n=await i({pagesDir:p.join(e.root||".",e.pagesDir||e.build?.pagesDir||"pages"),publicDir:e.publicDir||e.build?.publicDir||"public",outputDir:e.build?.outputDir||"dist",generate404:e.build?.generate404??!0,minify:e.build?.minify??!0,cleanOutput:e.build?.cleanOutput??!0,router:e.router,...t.ssg})}else{let{buildForProduction:i}=await import("./chunk-kgtnfvqb.js");l=await i({root:s,outputDir:".output",debug:t.debug,...t.ssr})}let a=Math.round(performance.now()-d);return{mode:r,ssg:n,ssr:l,duration:a}}
2
+ import{o}from"./chunk-3qmx12d3.js";import{Hr}from"./chunk-9qsnq026.js";import p from"path";async function Ml(t={}){let d=performance.now(),s=t.root||process.cwd(),e=await o(s),u=t.ssr?.routeRules??e.routeRules??{};if(Hr(u),!e.ssr&&Object.keys(u).length)throw Error("routeRules require ssr: true and the production server; flat SSG output cannot apply request/cache policies");if(!e.ssr&&(t.ssr?.serverApi??e.serverApi))throw Error("serverApi requires ssr: true; flat SSG output cannot execute API endpoints");let r=e.ssr?"ssr":"ssg";console.log(`[stx build] Mode: ${r.toUpperCase()}${e.ssr?" (ssr: true in stx.config.ts)":" (default \u2014 ssr is false)"}`);let n,l;if(r==="ssg"){let{generateStaticSite:i}=await import("./ssg.js");n=await i({pagesDir:p.join(e.root||".",e.pagesDir||e.build?.pagesDir||"pages"),publicDir:e.publicDir||e.build?.publicDir||"public",outputDir:e.build?.outputDir||"dist",generate404:e.build?.generate404??!0,minify:e.build?.minify??!0,cleanOutput:e.build?.cleanOutput??!0,router:e.router,...t.ssg})}else{let{buildForProduction:i}=await import("./chunk-4w37cqg9.js");l=await i({root:s,outputDir:".output",debug:t.debug,...t.ssr})}let a=Math.round(performance.now()-d);return{mode:r,ssg:n,ssr:l,duration:a}}
3
3
  export{Ml};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{vu,wu}from"./chunk-a30mtx17.js";import"./chunk-cqr5cv7h.js";import"./chunk-yhhfxx17.js";import"./chunk-3y5tzxm6.js";import"./chunk-3qmx12d3.js";import"./chunk-w24qmxc3.js";import"./chunk-v8ze2q95.js";import"./chunk-k71e38fk.js";import"./chunk-45x4myqe.js";import"./chunk-k1szsenr.js";import"./chunk-91pdg853.js";import"./chunk-03xsf9jm.js";import"./chunk-qhr1tkhj.js";import"./chunk-mmbspaqh.js";import"./chunk-c6egfhy6.js";import"./chunk-pxw4edw8.js";import"./chunk-82bttwqm.js";export{wu as clearStoreCache,vu as getStoreScript};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{id,di,ad,pi,Ec,Tc,Pt,bn,cd,$c,Rc,ld,f}from"./chunk-sr1md7vv.js";import"./chunk-w24qmxc3.js";import"./chunk-v8ze2q95.js";import"./chunk-k71e38fk.js";import"./chunk-zgv1h2np.js";import"./chunk-k1szsenr.js";import"./chunk-7ra30crf.js";import"./chunk-9cpxzze0.js";import"./chunk-qhr1tkhj.js";import"./chunk-mmbspaqh.js";import"./chunk-c6egfhy6.js";import"./chunk-pxw4edw8.js";import"./chunk-82bttwqm.js";export{Pt as buildCss,$c as extractClassNames,Tc as fingerprintConfig,Rc as generateCss,cd as getCachedCSS,id as getCssServeAsset,f as injectCss,di as loadCssEngine,pi as loadCssEngineConfig,bn as rebuildCss,ad as resetCssCache,Ec as resolveUserCssConfig,ld as withLinkedModuleBundles};
2
+ import{id,di,ad,pi,Ec,Tc,Pt,bn,cd,$c,Rc,ld,f}from"./chunk-3qmx12d3.js";import"./chunk-w24qmxc3.js";import"./chunk-v8ze2q95.js";import"./chunk-k71e38fk.js";import"./chunk-45x4myqe.js";import"./chunk-k1szsenr.js";import"./chunk-91pdg853.js";import"./chunk-03xsf9jm.js";import"./chunk-qhr1tkhj.js";import"./chunk-mmbspaqh.js";import"./chunk-c6egfhy6.js";import"./chunk-pxw4edw8.js";import"./chunk-82bttwqm.js";export{Pt as buildCss,$c as extractClassNames,Tc as fingerprintConfig,Rc as generateCss,cd as getCachedCSS,id as getCssServeAsset,f as injectCss,di as loadCssEngine,pi as loadCssEngineConfig,bn as rebuildCss,ad as resetCssCache,Ec as resolveUserCssConfig,ld as withLinkedModuleBundles};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Vo,Uo,Wo,Vu}from"./chunk-qx0tcsdm.js";import"./chunk-6cg03r93.js";import"./chunk-7xw1e8t6.js";import"./chunk-3qmx12d3.js";import"./chunk-w24qmxc3.js";import"./chunk-v8ze2q95.js";import"./chunk-k71e38fk.js";import"./chunk-45x4myqe.js";import"./chunk-k1szsenr.js";import"./chunk-91pdg853.js";import"./chunk-03xsf9jm.js";import"./chunk-qhr1tkhj.js";import"./chunk-mmbspaqh.js";import"./chunk-c6egfhy6.js";import"./chunk-pxw4edw8.js";import"./chunk-82bttwqm.js";export{Vo as buildNative,Vu as default,Wo as getAvailableFormats,Uo as getAvailableTargets};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{Xs,kd,Cd,Gi,he,tl,wr,_d,Ed,Td,$d,Rd,Ad,Pd,Id,Od}from"./chunk-9cpxzze0.js";import"./chunk-qhr1tkhj.js";export{Ad as applyHead,_d as definePageMeta,Xs as getHead,kd as getPageMeta,he as mergeHeadConfigs,Pd as processHeadDirective,Od as processMetaDirective,Id as processTitleDirective,Rd as renderBodyAttrs,Td as renderHead,$d as renderHtmlAttrs,Cd as resetHead,wr as seoMetaToHeadConfig,Gi as useHead,Ed as usePageTitle,tl as useSeoMeta,Ed as useTitle};
2
+ import{Xs,kd,Cd,Gi,he,tl,wr,_d,Ed,Td,$d,Rd,Ad,Pd,Id,Od}from"./chunk-03xsf9jm.js";import"./chunk-qhr1tkhj.js";export{Ad as applyHead,_d as definePageMeta,Xs as getHead,kd as getPageMeta,he as mergeHeadConfigs,Pd as processHeadDirective,Od as processMetaDirective,Id as processTitleDirective,Rd as renderBodyAttrs,Td as renderHead,$d as renderHtmlAttrs,Cd as resetHead,wr as seoMetaToHeadConfig,Gi as useHead,Ed as usePageTitle,tl as useSeoMeta,Ed as useTitle};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{zl,Hl,Vl,Ul,Wl,ql,Gl}from"./chunk-y09g63k0.js";export{Hl as createKeepAliveCache,Ul as generateKeepAliveCSS,Wl as generateKeepAliveRuntime,ql as onActivated,Gl as onDeactivated,zl as processKeepAliveDirectives,Vl as shouldCacheComponent};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{Tt,Rs,Ti,Hc}from"./chunk-sr1md7vv.js";import"./chunk-w24qmxc3.js";import"./chunk-v8ze2q95.js";import"./chunk-k71e38fk.js";import"./chunk-zgv1h2np.js";import"./chunk-k1szsenr.js";import"./chunk-7ra30crf.js";import"./chunk-9cpxzze0.js";import"./chunk-qhr1tkhj.js";import"./chunk-mmbspaqh.js";import"./chunk-c6egfhy6.js";import"./chunk-pxw4edw8.js";import"./chunk-82bttwqm.js";export{Hc as declareBareLoopHead,Tt as parseLoopBinding,Ti as processLoops,Rs as reportDeferredLoopWarnings};
2
+ import{Tt,Rs,Ti,Hc}from"./chunk-3qmx12d3.js";import"./chunk-w24qmxc3.js";import"./chunk-v8ze2q95.js";import"./chunk-k71e38fk.js";import"./chunk-45x4myqe.js";import"./chunk-k1szsenr.js";import"./chunk-91pdg853.js";import"./chunk-03xsf9jm.js";import"./chunk-qhr1tkhj.js";import"./chunk-mmbspaqh.js";import"./chunk-c6egfhy6.js";import"./chunk-pxw4edw8.js";import"./chunk-82bttwqm.js";export{Hc as declareBareLoopHead,Tt as parseLoopBinding,Ti as processLoops,Rs as reportDeferredLoopWarnings};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{Ot,Nc,Mc,Lc,jc,Bc,u,Fc,$s,zc,_i,Ei}from"./chunk-sr1md7vv.js";import"./chunk-w24qmxc3.js";import"./chunk-v8ze2q95.js";import"./chunk-k71e38fk.js";import"./chunk-zgv1h2np.js";import"./chunk-k1szsenr.js";import"./chunk-7ra30crf.js";import"./chunk-9cpxzze0.js";import"./chunk-qhr1tkhj.js";import"./chunk-mmbspaqh.js";import"./chunk-c6egfhy6.js";import"./chunk-pxw4edw8.js";import"./chunk-82bttwqm.js";export{Ot as STX_ENGINE_BINDING_NAMES,$s as convertToCommonJS,_i as extractScriptFromTemplate,u as extractVariables,Ei as hasVariables,Fc as isCompleteImport,Bc as isMissingBindingFailure,Lc as isModuleResolutionFailure,jc as isSyntaxFailure,zc as splitDeclaration,Nc as stripTypeScript,Mc as withoutStxReferrer};
2
+ import{Ot,Nc,Mc,Lc,jc,Bc,u,Fc,$s,zc,_i,Ei}from"./chunk-3qmx12d3.js";import"./chunk-w24qmxc3.js";import"./chunk-v8ze2q95.js";import"./chunk-k71e38fk.js";import"./chunk-45x4myqe.js";import"./chunk-k1szsenr.js";import"./chunk-91pdg853.js";import"./chunk-03xsf9jm.js";import"./chunk-qhr1tkhj.js";import"./chunk-mmbspaqh.js";import"./chunk-c6egfhy6.js";import"./chunk-pxw4edw8.js";import"./chunk-82bttwqm.js";export{Ot as STX_ENGINE_BINDING_NAMES,$s as convertToCommonJS,_i as extractScriptFromTemplate,u as extractVariables,Ei as hasVariables,Fc as isCompleteImport,Bc as isMissingBindingFailure,Lc as isModuleResolutionFailure,jc as isSyntaxFailure,zc as splitDeclaration,Nc as stripTypeScript,Mc as withoutStxReferrer};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{H}from"./chunk-np6nm4rq.js";import R from"fs";import g from"path";import C from"crypto";var S=new Set(["webp","avif","jpeg","png"]),T=new Set(["cover","contain","fill","inside","outside"]),q=new Set([".jpg",".jpeg",".png",".webp",".avif",".gif"]),k=4096,D=80,U="cover";async function Po(e,t){let r=t.routePath??"/_stx/img",h=new URL(e.url);if(h.pathname!==r)return null;let a=A(h,t);if(!a.ok)return new Response(a.error,{status:a.status,headers:{"Content-Type":"text/plain"}});let{srcFsPath:n,srcUrl:d,width:l,height:i,format:s,quality:u,fit:c}=a,m;try{m=R.statSync(n)}catch{return new Response(`Source image not found: ${d}`,{status:404,headers:{"Content-Type":"text/plain"}})}if(!m.isFile())return new Response("Not a file",{status:404,headers:{"Content-Type":"text/plain"}});let w=t.cacheDir??".stx/cache/img";await R.promises.mkdir(w,{recursive:!0});let b=`${n}:${m.mtimeMs}:${m.size}`,I=`${l}x${i}:${s}:${u}:${c}`,f=C.createHash("sha256").update(`${b}|${I}`).digest("hex").slice(0,16),o=g.join(w,`${f}.${s}`),p={"Content-Type":H(s),"Cache-Control":"public, max-age=31536000, immutable",ETag:`"${f}"`,"X-Stx-Image-Cache":"HIT"};if(e.headers.get("if-none-match")===`"${f}"`)return new Response(null,{status:304,headers:p});let v=Bun.file(o);if(await v.exists())return new Response(v,{headers:p});try{let x=Buffer.from(await Bun.file(n).arrayBuffer()),{resizeAndConvert:P}=await L(),F=await P(x,{width:l,height:i,format:s,quality:u,fit:c});return await Bun.write(o,F),p["X-Stx-Image-Cache"]="MISS",new Response(new Uint8Array(F),{headers:p})}catch(x){let P=x.message;return new Response(`Image processing failed: ${P}`,{status:500,headers:{"Content-Type":"text/plain"}})}}function ka(e){return async(t)=>await Po(t,e)??new Response("Not Found",{status:404,headers:{"Content-Type":"text/plain"}})}function A(e,t){let r=e.searchParams.get("src");if(!r)return{ok:!1,error:"Missing required param: src",status:400};if(!r.startsWith("/"))return{ok:!1,error:"src must be an absolute URL path (start with /)",status:400};if(r.startsWith("//"))return{ok:!1,error:"src must be a local path",status:400};let h=g.extname(r).toLowerCase();if(!q.has(h))return{ok:!1,error:`Unsupported source extension: ${h}`,status:400};let a=g.resolve(t.publicDir),n=g.resolve(a,r.slice(1));if(!n.startsWith(`${a}${g.sep}`)&&n!==a)return{ok:!1,error:"src is outside publicDir",status:400};let d=t.maxWidth??k,l=t.maxHeight??k,i=e.searchParams.get("w"),s=e.searchParams.get("h"),u=i?Number.parseInt(i,10):0,c=s?Number.parseInt(s,10):0;if(i&&(!Number.isFinite(u)||u<=0))return{ok:!1,error:"Invalid w (must be positive integer)",status:400};if(s&&(!Number.isFinite(c)||c<=0))return{ok:!1,error:"Invalid h (must be positive integer)",status:400};if(!i&&!s)return{ok:!1,error:"At least one of w or h is required",status:400};let m=Math.min(u||d,d),w=Math.min(c||l,l),b=e.searchParams.get("f")||"webp";if(!S.has(b))return{ok:!1,error:`Invalid f (must be one of: ${[...S].join(", ")})`,status:400};let I=b,f=e.searchParams.get("q"),o=f?Number.parseInt(f,10):t.defaultQuality??D;if(!Number.isFinite(o)||o<1||o>100)return{ok:!1,error:"Invalid q (must be 1-100)",status:400};let y=e.searchParams.get("fit")||t.defaultFit||U;if(!T.has(y))return{ok:!1,error:`Invalid fit (must be one of: ${[...T].join(", ")})`,status:400};return{ok:!0,srcFsPath:n,srcUrl:r,width:m,height:w,format:I,quality:o,fit:y}}async function L(){return await import("./chunk-zxf8f71v.js")}
2
+ import{H}from"./chunk-048eyjyj.js";import R from"fs";import g from"path";import C from"crypto";var S=new Set(["webp","avif","jpeg","png"]),T=new Set(["cover","contain","fill","inside","outside"]),q=new Set([".jpg",".jpeg",".png",".webp",".avif",".gif"]),k=4096,D=80,U="cover";async function Po(e,t){let r=t.routePath??"/_stx/img",h=new URL(e.url);if(h.pathname!==r)return null;let a=A(h,t);if(!a.ok)return new Response(a.error,{status:a.status,headers:{"Content-Type":"text/plain"}});let{srcFsPath:n,srcUrl:d,width:l,height:i,format:s,quality:u,fit:c}=a,m;try{m=R.statSync(n)}catch{return new Response(`Source image not found: ${d}`,{status:404,headers:{"Content-Type":"text/plain"}})}if(!m.isFile())return new Response("Not a file",{status:404,headers:{"Content-Type":"text/plain"}});let w=t.cacheDir??".stx/cache/img";await R.promises.mkdir(w,{recursive:!0});let b=`${n}:${m.mtimeMs}:${m.size}`,I=`${l}x${i}:${s}:${u}:${c}`,f=C.createHash("sha256").update(`${b}|${I}`).digest("hex").slice(0,16),o=g.join(w,`${f}.${s}`),p={"Content-Type":H(s),"Cache-Control":"public, max-age=31536000, immutable",ETag:`"${f}"`,"X-Stx-Image-Cache":"HIT"};if(e.headers.get("if-none-match")===`"${f}"`)return new Response(null,{status:304,headers:p});let v=Bun.file(o);if(await v.exists())return new Response(v,{headers:p});try{let x=Buffer.from(await Bun.file(n).arrayBuffer()),{resizeAndConvert:P}=await L(),F=await P(x,{width:l,height:i,format:s,quality:u,fit:c});return await Bun.write(o,F),p["X-Stx-Image-Cache"]="MISS",new Response(new Uint8Array(F),{headers:p})}catch(x){let P=x.message;return new Response(`Image processing failed: ${P}`,{status:500,headers:{"Content-Type":"text/plain"}})}}function ka(e){return async(t)=>await Po(t,e)??new Response("Not Found",{status:404,headers:{"Content-Type":"text/plain"}})}function A(e,t){let r=e.searchParams.get("src");if(!r)return{ok:!1,error:"Missing required param: src",status:400};if(!r.startsWith("/"))return{ok:!1,error:"src must be an absolute URL path (start with /)",status:400};if(r.startsWith("//"))return{ok:!1,error:"src must be a local path",status:400};let h=g.extname(r).toLowerCase();if(!q.has(h))return{ok:!1,error:`Unsupported source extension: ${h}`,status:400};let a=g.resolve(t.publicDir),n=g.resolve(a,r.slice(1));if(!n.startsWith(`${a}${g.sep}`)&&n!==a)return{ok:!1,error:"src is outside publicDir",status:400};let d=t.maxWidth??k,l=t.maxHeight??k,i=e.searchParams.get("w"),s=e.searchParams.get("h"),u=i?Number.parseInt(i,10):0,c=s?Number.parseInt(s,10):0;if(i&&(!Number.isFinite(u)||u<=0))return{ok:!1,error:"Invalid w (must be positive integer)",status:400};if(s&&(!Number.isFinite(c)||c<=0))return{ok:!1,error:"Invalid h (must be positive integer)",status:400};if(!i&&!s)return{ok:!1,error:"At least one of w or h is required",status:400};let m=Math.min(u||d,d),w=Math.min(c||l,l),b=e.searchParams.get("f")||"webp";if(!S.has(b))return{ok:!1,error:`Invalid f (must be one of: ${[...S].join(", ")})`,status:400};let I=b,f=e.searchParams.get("q"),o=f?Number.parseInt(f,10):t.defaultQuality??D;if(!Number.isFinite(o)||o<1||o>100)return{ok:!1,error:"Invalid q (must be 1-100)",status:400};let y=e.searchParams.get("fit")||t.defaultFit||U;if(!T.has(y))return{ok:!1,error:`Invalid fit (must be one of: ${[...T].join(", ")})`,status:400};return{ok:!0,srcFsPath:n,srcUrl:r,width:m,height:w,format:I,quality:o,fit:y}}async function L(){return await import("./chunk-jy7yzat1.js")}
3
3
  export{Po,ka};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import"./chunk-c6egfhy6.js";import"./chunk-mmbspaqh.js";import{m,h,w,j}from"./chunk-sr1md7vv.js";import"./chunk-qhr1tkhj.js";import"./chunk-v8ze2q95.js";import"./chunk-pxw4edw8.js";import"./chunk-9cpxzze0.js";import"./chunk-7ra30crf.js";import"./chunk-k71e38fk.js";import"./chunk-k1szsenr.js";import"./chunk-zgv1h2np.js";import"./chunk-82bttwqm.js";import"./chunk-w24qmxc3.js";import f from"path";var S=["applyOfflineUpdate","broadcast","cacheMedia","calculateDistance","canNotify","clearCookies","clearFetchCache","clearOfflineData","clearStorage","copyToClipboard","createShareableFile","defineForm","getBatteryLevel","getCookie","getCurrentPosition","getStorageKeys","getStorageSize","getVoices","hasBattery","hasCameraPermission","hasGeolocationPermission","hasMicrophonePermission","hasNotificationPermission","hasResizeObserver","hexToHsl","hexToRgb","isBroadcastChannelSupported","isCharging","isDeviceMotionSupported","isDeviceOrientationSupported","isEventSourceSupported","isEyeDropperSupported","isInFullscreen","isMutationObserverSupported","isPermissionGranted","isSpeechRecognitionSupported","isSpeechSynthesisSupported","isWakeLockSupported","isWebSocketSupported","notify","onOfflineUpdateReady","parseCookies","pickColor","prefetch","removeCookie","requestMediaPermissions","requestMotionPermission","requestNotificationPermission","requestOrientationPermission","setCookie","share","shareCurrentPage","shareFiles","shareText","shareURL","shareWithFallback","speak","stopSpeaking","toggleFullscreen","useAmbientSound","useAsyncData","useAttributeObserver","useAutoLogout","useAutoWakeLock","useBattery","useBreakpoint","useBreathPacer","useBroadcastChannel","useBroadcastStream","useChannel","useChildListObserver","useClipboard","useColorHistory","useConditionalWakeLock","useCookies","useCopySelection","useDeviceMotion","useDeviceOrientation","useElementSize","useElementTextSelection","useElementVisibility","useEventSource","useEyeDropper","useFavicon","useForm","useFullscreen","useGeolocation","useGeolocationWatch","useHotkey","useIdle","useIdleState","useInfiniteScroll","useIntersectionObserver","useIntersectionObserverMultiple","useIsDesktop","useIsMobile","useIsTablet","useKeyPressed","useKeySequence","useKeyboard","useLastActive","useLazyLoad","useMeta","useMouse","useMouseInElement","useMutationObserver","useNetwork","useNotification","useOnline","useOutbox","useParallax","usePermission","usePermissions","usePointer","usePost","useResizeObserver","useResizeObserverMultiple","useSSE","useScroll","useSelectionPopup","useShare","useSpeechRecognition","useSpeechSynthesis","useStorage","useTextObserver","useTextSelection","useTitle","useVisibility","useWakeLock","useWindowSize"],L=new Set(S);var l=new Map,x=m(64),y=new Set,O=0,R=new Set(S);function W(){l.clear(),x.clear()}function P(o){let n=new Map;for(let r of o){let a=f.basename(r);if(a.endsWith(".d.ts"))continue;let t=a.replace(/\.[jt]s$/,"");if(t==="index")continue;if(t===a)continue;let i=n.get(t);if(i&&!i.endsWith(".js"))continue;n.set(t,r)}return[...n.values()].sort()}function I(o,n){let r=n.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");return new RegExp(`(?:^|[^\\w$.])(?:const|let|var|function|class)\\s+${r}\\b`).test(o)}function M(o){if(!o)return[];let n=h(o,O),r=x.get(n);if(r)return r.slice();let a=o.replace(/<script\b[^>]*\bdata-stx-runtime\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\bdata-stx-framework-composables\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\bdata-stx-stores\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\bdata-stx-composables\b[^>]*>[\s\S]*?<\/script>/gi,""),t=[];for(let i of R){if(y.has(i))continue;let u=i.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");if(new RegExp(`(^|[^\\w$.])${u}\\s*\\(`).test(a))t.push(i)}return t.sort(),x.set(n,t),t.slice()}async function A(o,n){let r=M(o);if(r.length===0)return null;let a=n??f.join(import.meta.dir,"composables"),t=`${a}\x00${r.join(",")}`,i=l.get(t);if(i!==void 0)return i||null;let u=j({loader:"ts",target:"browser",define:w()}),C=new Set(r),d=[],g=new Set,p=[];try{let s=new Bun.Glob("*.{ts,js}");for await(let e of s.scan({cwd:a,absolute:!0}))p.push(e)}catch{return l.set(t,""),null}p=P(p);for(let s of p){let e;try{e=await Bun.file(s).text()}catch{continue}let b=[];try{b=u.scan(e).exports.filter((c)=>c!=="default")}catch{continue}if(!b.some((c)=>C.has(c)))continue;try{e=e.replace(/^import\s+.*from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),e=e.replace(/^import\s+type\s+.*$/gm,""),e=e.replace(/^export\s+\*\s+(?:as\s+\w+\s+)?from\s*['"][^'"]+['"]\s*;?\s*$/gm,""),e=e.replace(/^export\s+(?:type\s+)?\{[\s\S]*?\}\s*(?:from\s*['"][^'"]+['"]\s*)?;?\s*$/gm,""),e=e.replace(/^export\s+default\s+/gm,""),e=e.replace(/^export\s+(?=(?:declare\s+)?(?:abstract\s+)?(?:async\s+)?(?:function|class|const|let|var|type|interface|enum)\b)/gm,""),d.push(`// ${f.basename(s).replace(/\.[jt]s$/,"")}
2
+ import"./chunk-c6egfhy6.js";import"./chunk-mmbspaqh.js";import{m,h,w,j}from"./chunk-3qmx12d3.js";import"./chunk-qhr1tkhj.js";import"./chunk-v8ze2q95.js";import"./chunk-pxw4edw8.js";import"./chunk-03xsf9jm.js";import"./chunk-91pdg853.js";import"./chunk-k71e38fk.js";import"./chunk-k1szsenr.js";import"./chunk-45x4myqe.js";import"./chunk-82bttwqm.js";import"./chunk-w24qmxc3.js";import f from"path";var S=["applyOfflineUpdate","broadcast","cacheMedia","calculateDistance","canNotify","clearCookies","clearFetchCache","clearOfflineData","clearStorage","copyToClipboard","createShareableFile","defineForm","getBatteryLevel","getCookie","getCurrentPosition","getStorageKeys","getStorageSize","getVoices","hasBattery","hasCameraPermission","hasGeolocationPermission","hasMicrophonePermission","hasNotificationPermission","hasResizeObserver","hexToHsl","hexToRgb","isBroadcastChannelSupported","isCharging","isDeviceMotionSupported","isDeviceOrientationSupported","isEventSourceSupported","isEyeDropperSupported","isInFullscreen","isMutationObserverSupported","isPermissionGranted","isSpeechRecognitionSupported","isSpeechSynthesisSupported","isWakeLockSupported","isWebSocketSupported","notify","onOfflineUpdateReady","parseCookies","pickColor","prefetch","removeCookie","requestMediaPermissions","requestMotionPermission","requestNotificationPermission","requestOrientationPermission","setCookie","share","shareCurrentPage","shareFiles","shareText","shareURL","shareWithFallback","speak","stopSpeaking","toggleFullscreen","useAmbientSound","useAsyncData","useAttributeObserver","useAutoLogout","useAutoWakeLock","useBattery","useBreakpoint","useBreathPacer","useBroadcastChannel","useBroadcastStream","useChannel","useChildListObserver","useClipboard","useColorHistory","useConditionalWakeLock","useCookies","useCopySelection","useDeviceMotion","useDeviceOrientation","useElementSize","useElementTextSelection","useElementVisibility","useEventSource","useEyeDropper","useFavicon","useForm","useFullscreen","useGeolocation","useGeolocationWatch","useHotkey","useIdle","useIdleState","useInfiniteScroll","useIntersectionObserver","useIntersectionObserverMultiple","useIsDesktop","useIsMobile","useIsTablet","useKeyPressed","useKeySequence","useKeyboard","useLastActive","useLazyLoad","useMeta","useMouse","useMouseInElement","useMutationObserver","useNetwork","useNotification","useOnline","useOutbox","useParallax","usePermission","usePermissions","usePointer","usePost","useResizeObserver","useResizeObserverMultiple","useSSE","useScroll","useSelectionPopup","useShare","useSpeechRecognition","useSpeechSynthesis","useStorage","useTextObserver","useTextSelection","useTitle","useVisibility","useWakeLock","useWindowSize"],L=new Set(S);var l=new Map,x=m(64),y=new Set,O=0,R=new Set(S);function W(){l.clear(),x.clear()}function P(o){let n=new Map;for(let r of o){let a=f.basename(r);if(a.endsWith(".d.ts"))continue;let t=a.replace(/\.[jt]s$/,"");if(t==="index")continue;if(t===a)continue;let i=n.get(t);if(i&&!i.endsWith(".js"))continue;n.set(t,r)}return[...n.values()].sort()}function I(o,n){let r=n.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");return new RegExp(`(?:^|[^\\w$.])(?:const|let|var|function|class)\\s+${r}\\b`).test(o)}function M(o){if(!o)return[];let n=h(o,O),r=x.get(n);if(r)return r.slice();let a=o.replace(/<script\b[^>]*\bdata-stx-runtime\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\bdata-stx-framework-composables\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\bdata-stx-stores\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\bdata-stx-composables\b[^>]*>[\s\S]*?<\/script>/gi,""),t=[];for(let i of R){if(y.has(i))continue;let u=i.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");if(new RegExp(`(^|[^\\w$.])${u}\\s*\\(`).test(a))t.push(i)}return t.sort(),x.set(n,t),t.slice()}async function A(o,n){let r=M(o);if(r.length===0)return null;let a=n??f.join(import.meta.dir,"composables"),t=`${a}\x00${r.join(",")}`,i=l.get(t);if(i!==void 0)return i||null;let u=j({loader:"ts",target:"browser",define:w()}),C=new Set(r),d=[],g=new Set,p=[];try{let s=new Bun.Glob("*.{ts,js}");for await(let e of s.scan({cwd:a,absolute:!0}))p.push(e)}catch{return l.set(t,""),null}p=P(p);for(let s of p){let e;try{e=await Bun.file(s).text()}catch{continue}let b=[];try{b=u.scan(e).exports.filter((c)=>c!=="default")}catch{continue}if(!b.some((c)=>C.has(c)))continue;try{e=e.replace(/^import\s+.*from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),e=e.replace(/^import\s+type\s+.*$/gm,""),e=e.replace(/^export\s+\*\s+(?:as\s+\w+\s+)?from\s*['"][^'"]+['"]\s*;?\s*$/gm,""),e=e.replace(/^export\s+(?:type\s+)?\{[\s\S]*?\}\s*(?:from\s*['"][^'"]+['"]\s*)?;?\s*$/gm,""),e=e.replace(/^export\s+default\s+/gm,""),e=e.replace(/^export\s+(?=(?:declare\s+)?(?:abstract\s+)?(?:async\s+)?(?:function|class|const|let|var|type|interface|enum)\b)/gm,""),d.push(`// ${f.basename(s).replace(/\.[jt]s$/,"")}
3
3
  ${u.transformSync(e).trim()}`);for(let c of b)g.add(c)}catch(c){console.warn(`[stx] framework composable ${f.basename(s)} could not be bundled:`,c)}}let v=r.filter((s)=>!g.has(s)&&!I(o,s));if(v.length>0)console.warn(`[stx] could not bundle ${v.join(", ")} from @stacksjs/stx/composables \u2014 `+"calls to them will throw ReferenceError in the browser. Import them explicitly so the bundler inlines them, or use a runtime equivalent from window.stx.");if(d.length===0)return l.set(t,""),null;let E=[...g].map((s)=>` try { if (!(${JSON.stringify(s)} in __s)) { __s[${JSON.stringify(s)}] = ${s}; if (!(${JSON.stringify(s)} in window)) window[${JSON.stringify(s)}] = ${s}; } } catch (e) {}`).join(`
4
4
  `),k=`<script data-stx-scoped data-stx-run="always" data-stx-framework-composables>
5
5
  ;(function(){
@@ -383,9 +383,9 @@ else {
383
383
  .stx-island.hydrated {
384
384
  opacity: 1;
385
385
  }
386
- `}function Ua(e){if(typeof window>"u")return;let t=document.querySelector(`[data-island="${e}"]`);if(!t||t.classList.contains("hydrated"))return;t.classList.add("hydrated"),t.dispatchEvent(new CustomEvent("stx:hydrated",{bubbles:!0}))}function Va(e){if(typeof window>"u")return;document.querySelectorAll(`[data-strategy="${e}"]:not(.hydrated)`).forEach((n)=>{n.classList.add("hydrated"),n.dispatchEvent(new CustomEvent("stx:hydrated",{bubbles:!0}))})}function Wa(){if(typeof window>"u")return;document.querySelectorAll(".stx-island:not(.hydrated)").forEach((t)=>{t.classList.add("hydrated"),t.dispatchEvent(new CustomEvent("stx:hydrated",{bubbles:!0}))})}function qa(e){if(typeof window>"u")return!1;return document.querySelector(`[data-island="${e}"]`)?.classList.contains("hydrated")??!1}function Ga(e){return new Promise((t)=>{if(typeof window>"u"){t();return}let n=document.querySelector(`[data-island="${e}"]`);if(!n){t();return}if(n.classList.contains("hydrated")){t();return}n.addEventListener("stx:hydrated",()=>t(),{once:!0})})}function Ka(e){return e.replace(/@static\s*([\s\S]*?)@endstatic/gi,(t,n)=>`<div class="stx-static">${n.trim()}</div>`)}function Xa(e){let t=e.map((n)=>({id:n.id,component:n.component,strategy:n.options.strategy,props:n.props}));return`
386
+ `}function Va(e){if(typeof window>"u")return;let t=document.querySelector(`[data-island="${e}"]`);if(!t||t.classList.contains("hydrated"))return;t.classList.add("hydrated"),t.dispatchEvent(new CustomEvent("stx:hydrated",{bubbles:!0}))}function Ua(e){if(typeof window>"u")return;document.querySelectorAll(`[data-strategy="${e}"]:not(.hydrated)`).forEach((n)=>{n.classList.add("hydrated"),n.dispatchEvent(new CustomEvent("stx:hydrated",{bubbles:!0}))})}function Wa(){if(typeof window>"u")return;document.querySelectorAll(".stx-island:not(.hydrated)").forEach((t)=>{t.classList.add("hydrated"),t.dispatchEvent(new CustomEvent("stx:hydrated",{bubbles:!0}))})}function qa(e){if(typeof window>"u")return!1;return document.querySelector(`[data-island="${e}"]`)?.classList.contains("hydrated")??!1}function Ga(e){return new Promise((t)=>{if(typeof window>"u"){t();return}let n=document.querySelector(`[data-island="${e}"]`);if(!n){t();return}if(n.classList.contains("hydrated")){t();return}n.addEventListener("stx:hydrated",()=>t(),{once:!0})})}function Ka(e){return e.replace(/@static\s*([\s\S]*?)@endstatic/gi,(t,n)=>`<div class="stx-static">${n.trim()}</div>`)}function Xa(e){let t=e.map((n)=>({id:n.id,component:n.component,strategy:n.options.strategy,props:n.props}));return`
387
387
  <script type="application/json" id="stx-island-manifest">
388
388
  ${JSON.stringify(t)}
389
389
  </script>
390
- `}var Xl={processPartialHydrationDirectives:za,processStaticDirectives:Ka,generatePartialHydrationCSS:Ha,generateIslandManifest:Xa,createIslandRegistry:Fa,hydrateIsland:Ua,hydrateByStrategy:Va,hydrateAll:Wa,isHydrated:qa,onHydrated:Ga};
391
- export{Fa,za,Ha,Ua,Va,Wa,qa,Ga,Ka,Xa,Xl};
390
+ `}var Xl={processPartialHydrationDirectives:za,processStaticDirectives:Ka,generatePartialHydrationCSS:Ha,generateIslandManifest:Xa,createIslandRegistry:Fa,hydrateIsland:Va,hydrateByStrategy:Ua,hydrateAll:Wa,isHydrated:qa,onHydrated:Ga};
391
+ export{Fa,za,Ha,Va,Ua,Wa,qa,Ga,Ka,Xa,Xl};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{ce,uc,ri,vt,wt,Wu,si,xt,ln,dc,pc,fc,is,St,gc,kt,mc}from"./chunk-z2mg470f.js";import"./chunk-h988fxh3.js";import"./chunk-3y5tzxm6.js";import"./chunk-sr1md7vv.js";import"./chunk-w24qmxc3.js";import"./chunk-v8ze2q95.js";import"./chunk-k71e38fk.js";import"./chunk-zgv1h2np.js";import"./chunk-k1szsenr.js";import"./chunk-7ra30crf.js";import"./chunk-9cpxzze0.js";import"./chunk-qhr1tkhj.js";import"./chunk-mmbspaqh.js";import"./chunk-c6egfhy6.js";import"./chunk-pxw4edw8.js";import"./chunk-82bttwqm.js";export{ln as MODULE_SPECIFIER_PREFIX,kt as bundleClientScript,wt as clearBundleFailures,ce as clientBundleDependencies,vt as getBundleFailures,xt as hasUserImports,St as moduleSubstitutionKey,pc as normalizeRegistrySpecifiers,gc as queueClientBundleBuild,ri as recordBundleFailure,dc as registryIdForPath,si as resolveBundlerFallback,fc as rewriteRegistryImports,Wu as setBundlerFallbackMode,uc as shouldLogBundlerDiagnostics,mc as tempBuildName,is as withModuleSubstitutes};
2
+ import{ce,uc,ri,vt,wt,Wu,si,xt,ln,dc,pc,fc,is,St,gc,kt,mc}from"./chunk-cqr5cv7h.js";import"./chunk-yhhfxx17.js";import"./chunk-3y5tzxm6.js";import"./chunk-3qmx12d3.js";import"./chunk-w24qmxc3.js";import"./chunk-v8ze2q95.js";import"./chunk-k71e38fk.js";import"./chunk-45x4myqe.js";import"./chunk-k1szsenr.js";import"./chunk-91pdg853.js";import"./chunk-03xsf9jm.js";import"./chunk-qhr1tkhj.js";import"./chunk-mmbspaqh.js";import"./chunk-c6egfhy6.js";import"./chunk-pxw4edw8.js";import"./chunk-82bttwqm.js";export{ln as MODULE_SPECIFIER_PREFIX,kt as bundleClientScript,wt as clearBundleFailures,ce as clientBundleDependencies,vt as getBundleFailures,xt as hasUserImports,St as moduleSubstitutionKey,pc as normalizeRegistrySpecifiers,gc as queueClientBundleBuild,ri as recordBundleFailure,dc as registryIdForPath,si as resolveBundlerFallback,fc as rewriteRegistryImports,Wu as setBundlerFallbackMode,uc as shouldLogBundlerDiagnostics,mc as tempBuildName,is as withModuleSubstitutes};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Hs,Vs,Us,Ws,mr,hr,bd,vd,wd,xd,yr,Sd}from"./chunk-91pdg853.js";import"./chunk-03xsf9jm.js";import"./chunk-qhr1tkhj.js";export{Sd as generateDefaultRobotsTxt,yr as generateRobotsTxt,vd as generateSitemap,wd as generateSitemapIndex,Ws as injectSeoTags,mr as metaDirective,Hs as processMetaDirectives,Us as processSeoDirective,Vs as processStructuredData,bd as registerSeoDirectives,xd as scanForSitemapEntries,hr as structuredDataDirective};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{u,$s,_i,Ei,Vc,Wc,qc,Gc,Kc,Xc,Ke,j,Xe,Jc,lr,Yc,Ai,Zc,Je,r,ur,Pi,g,ne,md}from"./chunk-sr1md7vv.js";import"./chunk-w24qmxc3.js";import"./chunk-v8ze2q95.js";import"./chunk-k71e38fk.js";import"./chunk-zgv1h2np.js";import"./chunk-k1szsenr.js";import"./chunk-7ra30crf.js";import"./chunk-9cpxzze0.js";import"./chunk-qhr1tkhj.js";import"./chunk-mmbspaqh.js";import"./chunk-c6egfhy6.js";import"./chunk-pxw4edw8.js";import"./chunk-82bttwqm.js";export{ne as clearComponentCache,Zc as componentClientSignalNames,$s as convertToCommonJS,g as createDetailedErrorMessage,Kc as extractDirectiveNames,_i as extractScriptFromTemplate,u as extractVariables,r as fileExists,md as getComponentCacheStats,Wc as getPositionInfo,j as getSharedTranspiler,Pi as getSourceLineInfo,Gc as hasDirectives,Ei as hasVariables,Yc as isHydrateTrigger,Xc as isJavaScriptScript,Je as renderComponentWithSlot,ur as resolveTemplatePath,Jc as scopeOnRootElement,Ke as shouldTranspileTypeScript,Ai as slotContentHasExpressions,Xe as transpileTypeScript,lr as userComponentFileExists,qc as validateDirective,Vc as validateTemplate};
2
+ import{u,$s,_i,Ei,Uc,Wc,qc,Gc,Kc,Xc,Ke,j,Xe,Jc,lr,Yc,Ai,Zc,Je,r,ur,Pi,g,ne,md}from"./chunk-3qmx12d3.js";import"./chunk-w24qmxc3.js";import"./chunk-v8ze2q95.js";import"./chunk-k71e38fk.js";import"./chunk-45x4myqe.js";import"./chunk-k1szsenr.js";import"./chunk-91pdg853.js";import"./chunk-03xsf9jm.js";import"./chunk-qhr1tkhj.js";import"./chunk-mmbspaqh.js";import"./chunk-c6egfhy6.js";import"./chunk-pxw4edw8.js";import"./chunk-82bttwqm.js";export{ne as clearComponentCache,Zc as componentClientSignalNames,$s as convertToCommonJS,g as createDetailedErrorMessage,Kc as extractDirectiveNames,_i as extractScriptFromTemplate,u as extractVariables,r as fileExists,md as getComponentCacheStats,Wc as getPositionInfo,j as getSharedTranspiler,Pi as getSourceLineInfo,Gc as hasDirectives,Ei as hasVariables,Yc as isHydrateTrigger,Xc as isJavaScriptScript,Je as renderComponentWithSlot,ur as resolveTemplatePath,Jc as scopeOnRootElement,Ke as shouldTranspileTypeScript,Ai as slotContentHasExpressions,Xe as transpileTypeScript,lr as userComponentFileExists,qc as validateDirective,Uc as validateTemplate};