@stacksjs/stx 0.2.888 → 0.2.889

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 (241) hide show
  1. package/dist/{chunk-c0g30cjs.js → chunk-05x1rd86.js} +2 -2
  2. package/dist/chunk-0g9cceht.js +2 -0
  3. package/dist/chunk-0k437z3q.js +2 -0
  4. package/dist/{chunk-1xpq83mc.js → chunk-0ncafcs2.js} +4 -4
  5. package/dist/chunk-0rpj5t80.js +2 -0
  6. package/dist/{chunk-btsgt6w3.js → chunk-1gyxxfdf.js} +2 -2
  7. package/dist/{chunk-vazk5qbh.js → chunk-1knk403z.js} +2 -2
  8. package/dist/{chunk-6qq3wy3m.js → chunk-1n33yrar.js} +2 -2
  9. package/dist/chunk-1p4q6t48.js +2 -0
  10. package/dist/chunk-1z6pqvmf.js +2 -0
  11. package/dist/{chunk-s29hp1qw.js → chunk-2a5g80mq.js} +3 -3
  12. package/dist/chunk-2ba4zfa0.js +2 -0
  13. package/dist/chunk-2gn2nc2j.js +2 -0
  14. package/dist/chunk-2nqmw4dv.js +2 -0
  15. package/dist/chunk-2wkpksg1.js +2 -0
  16. package/dist/{chunk-xw291tn7.js → chunk-3dqfjpz4.js} +34 -29
  17. package/dist/{chunk-3ed2erm6.js → chunk-3hsv6ejp.js} +4 -4
  18. package/dist/{chunk-w624s5jf.js → chunk-3qk8vf9m.js} +3 -3
  19. package/dist/chunk-3yjyjq0m.js +2 -0
  20. package/dist/chunk-444haxxa.js +2 -0
  21. package/dist/{chunk-y76znqmh.js → chunk-446tb2th.js} +27 -27
  22. package/dist/{chunk-qjy5yq25.js → chunk-48rwqchc.js} +10 -10
  23. package/dist/chunk-4akw3bym.js +2 -0
  24. package/dist/{chunk-mm1eg2pg.js → chunk-4kmg6g5n.js} +9 -9
  25. package/dist/chunk-4rvfeee5.js +2 -0
  26. package/dist/{chunk-605g9qhp.js → chunk-51720m79.js} +5 -5
  27. package/dist/chunk-53kcqdjj.js +2 -0
  28. package/dist/{chunk-0dq9svfb.js → chunk-55tc5w32.js} +3 -3
  29. package/dist/{chunk-7s3j8pqq.js → chunk-58qzyyyv.js} +3 -3
  30. package/dist/chunk-5aa83bpm.js +2 -0
  31. package/dist/{chunk-ah6nc29h.js → chunk-5kqezrjt.js} +2 -2
  32. package/dist/chunk-5ssv10ep.js +2 -0
  33. package/dist/chunk-67rppc5v.js +2 -0
  34. package/dist/{chunk-care745q.js → chunk-6gtecbe7.js} +2 -2
  35. package/dist/{chunk-p33npqjt.js → chunk-6kyqejnq.js} +22 -22
  36. package/dist/{chunk-vjfp8n6p.js → chunk-6pdy7ajr.js} +3 -3
  37. package/dist/{chunk-9tecekzq.js → chunk-6pz5gq6v.js} +9 -9
  38. package/dist/{chunk-wpa3r3b9.js → chunk-700m927w.js} +2 -2
  39. package/dist/{chunk-2assyczz.js → chunk-7212fwzz.js} +2 -2
  40. package/dist/chunk-732gb689.js +2 -0
  41. package/dist/chunk-77c89d23.js +2 -0
  42. package/dist/chunk-79vbkez0.js +2 -0
  43. package/dist/{chunk-whsdyf4t.js → chunk-7hpca9c7.js} +6 -6
  44. package/dist/chunk-80xzjxah.js +2 -0
  45. package/dist/chunk-8354mzpd.js +2 -0
  46. package/dist/{chunk-r561zt9v.js → chunk-87g5xmmr.js} +12 -12
  47. package/dist/{chunk-ry6w43p6.js → chunk-8hwfdwgn.js} +6 -6
  48. package/dist/chunk-8ygf6jnt.js +2 -0
  49. package/dist/{chunk-5ymf5c8m.js → chunk-95sd8h5g.js} +7 -7
  50. package/dist/{chunk-gdtj5rfa.js → chunk-967ydrq4.js} +6 -6
  51. package/dist/chunk-9afkttvz.js +2 -0
  52. package/dist/{chunk-55kwxxm5.js → chunk-9d91h636.js} +2 -2
  53. package/dist/{chunk-kvxdyg7e.js → chunk-9n5h4sqc.js} +2 -2
  54. package/dist/chunk-9ztn7w4y.js +2 -0
  55. package/dist/chunk-ah8az9vv.js +2 -0
  56. package/dist/chunk-ankap9pc.js +2 -0
  57. package/dist/chunk-asnd03sr.js +2 -0
  58. package/dist/chunk-b0b5yr97.js +2 -0
  59. package/dist/chunk-b0e7dgv8.js +3 -0
  60. package/dist/{chunk-372xh1g1.js → chunk-b15c4g3e.js} +5 -5
  61. package/dist/{chunk-7hm1tpw0.js → chunk-b6bf0t02.js} +6 -6
  62. package/dist/chunk-b7jj45bz.js +2 -0
  63. package/dist/{chunk-r57jz09p.js → chunk-bgfs3mbg.js} +5 -5
  64. package/dist/{chunk-fepezvdq.js → chunk-bqtj62ys.js} +8 -8
  65. package/dist/{chunk-wbxmn5gk.js → chunk-bw2m1e7g.js} +5 -5
  66. package/dist/chunk-bwx6w87c.js +2 -0
  67. package/dist/{chunk-9qrgdekg.js → chunk-cgfjrgfw.js} +14 -14
  68. package/dist/{chunk-98mj0es1.js → chunk-ch9028z3.js} +1 -1
  69. package/dist/{chunk-sbwvvjkc.js → chunk-cmg9x1ka.js} +3 -3
  70. package/dist/{chunk-9f31gs4m.js → chunk-cz1sdes5.js} +2 -2
  71. package/dist/{chunk-dj9ztcth.js → chunk-dvjv4c3a.js} +1 -1
  72. package/dist/{chunk-edysherg.js → chunk-dymck524.js} +5 -5
  73. package/dist/chunk-dzqfv801.js +3 -0
  74. package/dist/{chunk-b8528fra.js → chunk-eceeqy74.js} +4 -4
  75. package/dist/{chunk-52mhrbps.js → chunk-eqffvse2.js} +1 -1
  76. package/dist/chunk-ery4tty7.js +20 -0
  77. package/dist/chunk-evwrxsxd.js +3 -0
  78. package/dist/{chunk-6t04tqvh.js → chunk-eyx92t9n.js} +2 -2
  79. package/dist/{chunk-c1b0fy70.js → chunk-f3cyghnb.js} +5 -5
  80. package/dist/chunk-f60k8j9m.js +2 -0
  81. package/dist/chunk-fdqdz018.js +2 -0
  82. package/dist/chunk-g6ap4085.js +2 -0
  83. package/dist/chunk-gz9pknbw.js +1204 -0
  84. package/dist/{chunk-e1qcfesw.js → chunk-hgf7bc50.js} +6 -6
  85. package/dist/chunk-hjb4c8g2.js +2 -0
  86. package/dist/chunk-hk241gt2.js +2 -0
  87. package/dist/{chunk-wscry63p.js → chunk-hm9d40yf.js} +2 -2
  88. package/dist/{chunk-vgr7gd8k.js → chunk-hpzje67q.js} +2 -2
  89. package/dist/{chunk-c3ca056p.js → chunk-htx5yezj.js} +2 -2
  90. package/dist/{chunk-b0jekg4c.js → chunk-hxws025y.js} +3 -3
  91. package/dist/chunk-jhbj9ja2.js +2 -0
  92. package/dist/chunk-k4x680e3.js +2 -0
  93. package/dist/chunk-k9abxnpa.js +2 -0
  94. package/dist/{chunk-c73c0wf9.js → chunk-kbbbpae2.js} +2 -2
  95. package/dist/chunk-kfdmm240.js +2 -0
  96. package/dist/{chunk-5ysv0499.js → chunk-kj43fbzm.js} +1 -1
  97. package/dist/{chunk-303vzq80.js → chunk-kk2p2tgv.js} +3 -3
  98. package/dist/{chunk-r8xper92.js → chunk-ksmn19qw.js} +2 -2
  99. package/dist/{chunk-v47xc2fr.js → chunk-kx09v9ya.js} +7 -7
  100. package/dist/{chunk-wm287dz2.js → chunk-m95sygv4.js} +3 -3
  101. package/dist/{chunk-j51wss7s.js → chunk-mctzpw0w.js} +1 -1
  102. package/dist/{chunk-2rmqmajd.js → chunk-me4yq8c2.js} +3 -3
  103. package/dist/{chunk-11fxbd71.js → chunk-mgh5rst1.js} +2 -2
  104. package/dist/{chunk-1kc0jyhj.js → chunk-mhxg6j6s.js} +1 -1
  105. package/dist/{chunk-wf8pdjq5.js → chunk-mjp1z9kz.js} +1 -1
  106. package/dist/{chunk-znnvq1jp.js → chunk-mt8edb75.js} +46 -46
  107. package/dist/chunk-mvavjydq.js +2 -0
  108. package/dist/{chunk-s7wp7a2x.js → chunk-mw7hacm3.js} +30 -30
  109. package/dist/{chunk-e2ws79vt.js → chunk-nbdscgvj.js} +6 -6
  110. package/dist/{chunk-mk6thhwf.js → chunk-njpva3zq.js} +2 -2
  111. package/dist/{chunk-q3bkxg2n.js → chunk-nkyff7v6.js} +11 -11
  112. package/dist/{chunk-zje94z0k.js → chunk-p8shtje2.js} +32 -32
  113. package/dist/{chunk-0hj5apb9.js → chunk-pctf14yw.js} +1 -1
  114. package/dist/{chunk-0d7ypcjb.js → chunk-pjj54ddk.js} +3 -3
  115. package/dist/{chunk-qsnpqa8q.js → chunk-pnmafbv5.js} +1 -1
  116. package/dist/{chunk-vgsasnwm.js → chunk-pz554g43.js} +3 -3
  117. package/dist/{chunk-6zq3eh7d.js → chunk-q0y8gv18.js} +2 -2
  118. package/dist/{chunk-w50yggy3.js → chunk-q9tc9rdv.js} +2 -2
  119. package/dist/chunk-qqng9545.js +2 -0
  120. package/dist/{chunk-xavx271y.js → chunk-r5ecgcx2.js} +5 -5
  121. package/dist/{chunk-v8e2c2r1.js → chunk-ranjkpc8.js} +2 -2
  122. package/dist/{chunk-zf29ahhd.js → chunk-rb2zbdqd.js} +4 -4
  123. package/dist/{chunk-4nnmrp7w.js → chunk-rf0smj4c.js} +2 -2
  124. package/dist/chunk-rjm515e2.js +2 -0
  125. package/dist/chunk-rye4b2x3.js +2 -0
  126. package/dist/chunk-ryj8139z.js +2 -0
  127. package/dist/{chunk-e9tjxnhn.js → chunk-s0mf56y1.js} +5 -5
  128. package/dist/{chunk-fce8wj3t.js → chunk-s93yh7ed.js} +2 -2
  129. package/dist/chunk-s9b809n2.js +2 -0
  130. package/dist/chunk-sb67wg5x.js +2 -0
  131. package/dist/{chunk-6fsnnj5v.js → chunk-sjjw6y49.js} +6 -6
  132. package/dist/chunk-snkbn5y8.js +2 -0
  133. package/dist/{chunk-7mcs59pr.js → chunk-snv80b1b.js} +2 -2
  134. package/dist/chunk-sqwx2g02.js +2 -0
  135. package/dist/{chunk-4c9p434g.js → chunk-t0ttxayz.js} +2 -2
  136. package/dist/chunk-tbh7r1wh.js +2 -0
  137. package/dist/chunk-tpyekw0q.js +2 -0
  138. package/dist/chunk-v2627s75.js +2 -0
  139. package/dist/chunk-v3jyb8k6.js +2 -0
  140. package/dist/chunk-v98n53nk.js +2 -0
  141. package/dist/{chunk-pm4kn9h2.js → chunk-vc432a0w.js} +9 -9
  142. package/dist/{chunk-7nhgpjjw.js → chunk-vf4ejngv.js} +6 -6
  143. package/dist/{chunk-hxhmhw23.js → chunk-vk2jy6mn.js} +3 -3
  144. package/dist/chunk-w34vvhm7.js +2 -0
  145. package/dist/chunk-w82nk19t.js +2 -0
  146. package/dist/{chunk-mbm3ma63.js → chunk-x5bn2svk.js} +2 -2
  147. package/dist/chunk-x6565mhk.js +2 -0
  148. package/dist/{chunk-3fbgpv1d.js → chunk-xvncq3m5.js} +2 -2
  149. package/dist/chunk-xwgdcc7w.js +2 -0
  150. package/dist/{chunk-1wkp3pks.js → chunk-xy8smv5e.js} +2 -2
  151. package/dist/{chunk-y8p59h6c.js → chunk-y1d3j2j7.js} +4 -4
  152. package/dist/chunk-yjwa7ktk.js +2 -0
  153. package/dist/{chunk-xy4j8t7w.js → chunk-ytjn0gq2.js} +2 -2
  154. package/dist/chunk-z47p2gx8.js +2 -0
  155. package/dist/chunk-z4tdnfxd.js +2 -0
  156. package/dist/chunk-z6kw6sct.js +4 -0
  157. package/dist/{chunk-w1q86c89.js → chunk-zf68afyh.js} +3 -3
  158. package/dist/chunk-zhywjwdr.js +2 -0
  159. package/dist/{chunk-em6fqvjy.js → chunk-zwwhpxp7.js} +2 -2
  160. package/dist/cli.js +21 -21
  161. package/dist/component-library.d.ts +2 -1
  162. package/dist/component-library.js +17 -296
  163. package/dist/craft-entry.js +2 -2
  164. package/dist/craft.js +2 -2
  165. package/dist/directive-arguments.js +39 -6
  166. package/dist/parser/tokenizer.d.ts +2 -1
  167. package/dist/parser/tokenizer.js +7 -5
  168. package/dist/props-declaration.d.ts +64 -0
  169. package/dist/props-declaration.js +354 -0
  170. package/dist/pwa.js +3 -3
  171. package/dist/ssg.js +5 -5
  172. package/dist/utils.js +20 -109
  173. package/package.json +5 -5
  174. package/dist/chunk-000mwmfq.js +0 -1203
  175. package/dist/chunk-043d0en0.js +0 -2
  176. package/dist/chunk-0w66z6eq.js +0 -2
  177. package/dist/chunk-13wd9gf0.js +0 -3
  178. package/dist/chunk-1znqedae.js +0 -2
  179. package/dist/chunk-2drzzjcm.js +0 -2
  180. package/dist/chunk-3c7nt5qp.js +0 -2
  181. package/dist/chunk-3zyzhcd9.js +0 -2
  182. package/dist/chunk-44rb9fk0.js +0 -2
  183. package/dist/chunk-472j3bhp.js +0 -2
  184. package/dist/chunk-4acce1m8.js +0 -2
  185. package/dist/chunk-4kasmp98.js +0 -2
  186. package/dist/chunk-53kkjn23.js +0 -2
  187. package/dist/chunk-5gwvy612.js +0 -2
  188. package/dist/chunk-61vbqrde.js +0 -2
  189. package/dist/chunk-6fpzwryt.js +0 -2
  190. package/dist/chunk-7195598h.js +0 -2
  191. package/dist/chunk-7zvf79vb.js +0 -2
  192. package/dist/chunk-88a735jw.js +0 -2
  193. package/dist/chunk-8v7yjq3b.js +0 -2
  194. package/dist/chunk-97kgrevs.js +0 -4
  195. package/dist/chunk-a8c9j9cj.js +0 -2
  196. package/dist/chunk-acw851e8.js +0 -2
  197. package/dist/chunk-andfvr3g.js +0 -2
  198. package/dist/chunk-aqxh80vh.js +0 -2
  199. package/dist/chunk-ay5zkfdg.js +0 -2
  200. package/dist/chunk-b4gptdtc.js +0 -2
  201. package/dist/chunk-baaw9w7y.js +0 -2
  202. package/dist/chunk-bw2p9h2g.js +0 -2
  203. package/dist/chunk-ce0vv7kz.js +0 -2
  204. package/dist/chunk-d1yj29g2.js +0 -2
  205. package/dist/chunk-dbhmbef1.js +0 -20
  206. package/dist/chunk-dfsykk1r.js +0 -2
  207. package/dist/chunk-e9p596bp.js +0 -2
  208. package/dist/chunk-ftecsa8e.js +0 -2
  209. package/dist/chunk-ge2h5v46.js +0 -2
  210. package/dist/chunk-gqvnz8a7.js +0 -2
  211. package/dist/chunk-j41gp8p3.js +0 -2
  212. package/dist/chunk-jxvccj30.js +0 -2
  213. package/dist/chunk-k5bbre7d.js +0 -2
  214. package/dist/chunk-kd47vgs8.js +0 -2
  215. package/dist/chunk-keqjafdz.js +0 -2
  216. package/dist/chunk-kz3mejc4.js +0 -2
  217. package/dist/chunk-ngkh0t5b.js +0 -2
  218. package/dist/chunk-nx9895m6.js +0 -2
  219. package/dist/chunk-nxgtt1t1.js +0 -2
  220. package/dist/chunk-nyw2ztar.js +0 -2
  221. package/dist/chunk-p5q27adr.js +0 -2
  222. package/dist/chunk-p6hcrg3r.js +0 -3
  223. package/dist/chunk-pa2vt2ej.js +0 -2
  224. package/dist/chunk-pczb7xav.js +0 -2
  225. package/dist/chunk-ps37r6hj.js +0 -2
  226. package/dist/chunk-pvbhk17r.js +0 -2
  227. package/dist/chunk-q252qvsy.js +0 -2
  228. package/dist/chunk-q5b0vpmm.js +0 -2
  229. package/dist/chunk-qg1kw5yf.js +0 -2
  230. package/dist/chunk-sbr85vda.js +0 -2
  231. package/dist/chunk-tkab24xr.js +0 -2
  232. package/dist/chunk-vn59yrjh.js +0 -2
  233. package/dist/chunk-w5zzwe2f.js +0 -2
  234. package/dist/chunk-wa9q1gyv.js +0 -2
  235. package/dist/chunk-wpgxhrd7.js +0 -2
  236. package/dist/chunk-x3azrbpr.js +0 -2
  237. package/dist/chunk-x50hk1hq.js +0 -2
  238. package/dist/chunk-xbkbvfcg.js +0 -2
  239. package/dist/chunk-z55rpt3s.js +0 -3
  240. package/dist/chunk-zwde52kw.js +0 -2
  241. package/dist/chunk-zxff7kq9.js +0 -2
@@ -1,7 +1,7 @@
1
1
  // @bun
2
- import x from"fs";import u from"path";import p from"fs";import w from"path";var y=["components","layouts","partials","emails"];function M(e){return e.split(/[\\/]/).filter(Boolean).slice(0,-1).some((a)=>y.includes(a))}function b(e){return M(e.replace(/^\//,""))}function xi(e,t){let a=e.filter((i)=>!b(i.pattern)),r=["// Auto-generated by STX - do not edit"];if(a.length===0)r.push("// No page routes found \u2014 route paths stay typed as string.","export {}","");else{r.push("declare module '@stacksjs/stx' {"," interface KnownRoutes {");for(let i of a){let c=[];for(let l of i.params){let d=i.pattern.includes(`:${l}?`)?"?":"";c.push(`${l}${d}: string`)}let s=c.join("; ");r.push(` '${i.pattern}': { ${s} }`)}r.push(" }","}","","export {}","")}let n=r.join(`
3
- `),o=w.join(t,"route-types.d.ts");try{if(p.existsSync(o)&&p.readFileSync(o,"utf8")===n)return;p.mkdirSync(t,{recursive:!0}),p.writeFileSync(o,n)}catch{}}function Si(e,t,a){let r=process.cwd(),n=w.relative(r,a),o=e.filter((c)=>!b(c.pattern)),i=["// Auto-generated by stx \u2014 do not edit",`// Source: ${n||"pages"}/`,"","export const routes = ["];for(let c of o){let s=w.relative(r,c.filePath).replace(/\\/g,"/"),l=JSON.stringify(c.params),d=c.layout?`, layout: '${w.relative(r,c.layout).replace(/\\/g,"/")}'`:"";i.push(` { pattern: '${c.pattern}', filePath: '${s}', isDynamic: ${c.isDynamic}, params: ${l}${d} },`)}i.push("] as const",""),i.push("export type RouteName = typeof routes[number]['pattern']",""),p.mkdirSync(t,{recursive:!0}),p.writeFileSync(w.join(t,"routes.ts"),i.join(`
4
- `))}import I from"path";var N=Object.freeze(["ico","png","jpg","jpeg","gif","webp","avif","svg","bmp","tif","tiff","heic","css","js","mjs","cjs","map","wasm","webmanifest","json","xml","txt","rss","atom","woff","woff2","ttf","otf","eot","mp3","mp4","m4a","m4v","mov","webm","ogg","ogv","oga","wav","flac","avi","mkv","pdf","csv","doc","docx","xls","xlsx","ppt","pptx","rtf","odt","zip","gz","tgz","tar","rar","7z","bz2","xz","php","phtml","asp","aspx","jsp","cgi","env","ini","yml","yaml","toml","sql","bak","old","swp","log","conf","cfg","exe","dmg","pkg","apk","ipa","msi","iso","bin","dll"]),D=N.flatMap((e)=>e===e.toUpperCase()?[e]:[e,e.toUpperCase()]).join("|"),G=new RegExp(`\\.(?:${D})$`),E=`(?![^/]*\\.(?:${D})$)`;function Nt(e){let t=e,a=t.search(/[?#]/);if(a!==-1)t=t.slice(0,a);let r=t.slice(t.lastIndexOf("/")+1);return r.length>0&&G.test(r)}function R(e,t){let r=I.relative(t,e).replace(/\.(stx|md)$/,"");if(r=r.split(I.sep).join("/"),r==="index")return"/";if(r.endsWith("/index"))r=r.slice(0,-6);return r=r.replace(/\[\[([^\]]+)\]\]/g,":$1?"),r=r.replace(/\[([^\]]+)\]/g,":$1"),r=r.replace(/:\.\.\.([^/]+)/g,":$1*"),`/${r}`}function ve(e,t={}){let a=t.page?E:"",r=[],n="",o=0;while(o<e.length){let i=e.slice(o),c=/^\/:([^/?*]+)\?/.exec(i);if(c){r.push(c[1]);let d=o+c[0].length===e.length;n+=`(?:/${d?a:""}([^/]+))?`,o+=c[0].length;continue}let s=/^:([^/?*]+)\*/.exec(i);if(s){r.push(s[1]),n+="(.+)",o+=s[0].length;continue}let l=/^:([^/?*]+)/.exec(i);if(l){r.push(l[1]);let d=o+l[0].length===e.length;n+=`${d?a:""}([^/]+)`,o+=l[0].length;continue}n+=e[o].replace(/[.+^${}()|[\]\\*?]/g,"\\$&"),o+=1}return{regex:new RegExp(`^${n}$`),params:r}}function Cr(e,t){let a=e===""?"/":e;for(let r of t){let n=a.match(r.regex);if(n){let o={};return r.params.forEach((i,c)=>{o[i]=n[c+1]}),{route:r,params:o}}}return null}function zs(e,t={}){let a=e.replace(/\[\[([^\]]+)\]\]/g,":$1?").replace(/\[([^\]]+)\]/g,":$1").replace(/:\.\.\.([^/]+)/g,":$1*");return ve(a,t)}import X from"fs";import L from"path";function _(e,t){let a=[],r=L.dirname(e);while(r.startsWith(t)||r===t){let n=L.join(r,"_layout.stx");if(X.existsSync(n))a.unshift(n);if(r===t)break;r=L.dirname(r)}return a}function B(e,t){let a=[];if(!x.existsSync(e))return a;let r=x.readdirSync(e,{withFileTypes:!0});for(let n of r){let o=u.join(e,n.name);if(n.isDirectory()){if(n.name.startsWith("."))continue;if(y.includes(n.name))continue;a.push(...B(o,t))}else if(n.isFile()){let i=u.extname(n.name);if(t.includes(i)){if(n.name.startsWith("_")&&n.name!=="_layout.stx")continue;if(n.name==="_layout.stx")continue;a.push(o)}}}return a}class Er{routes;pagesDir;pagesDirs;config;constructor(e,t={}){this.config=t;let a=t.pagesDirs&&t.pagesDirs.length>0?t.pagesDirs:[t.pagesDir||"pages"];this.pagesDirs=a.map((s)=>u.resolve(e,s)),this.pagesDir=this.pagesDirs[0];let r=t.extensions||[".stx"],n=(s)=>{let l=u.resolve(e,s);try{return x.realpathSync(l)}catch{return l}},o=(t.exclude??[]).filter((s)=>typeof s==="string"&&s.trim()!=="").map(n),i=(s)=>{if(o.length===0)return!1;let l=n(s);return o.some((d)=>l===d||l.startsWith(`${d}${u.sep}`))},c=new Set;this.routes=[];for(let s of this.pagesDirs){let l=B(s,r).filter((h)=>!i(h)),d=new Map;for(let h of l){let g=R(h,s),m=t.pagesDirs?g.replace(/:[\w]+/g,":param"):g;if(t.pagesDirs&&d.has(m))throw Error(`Conflicting layer pages for ${g}: ${d.get(m)} and ${h}`);if(d.set(m,h),c.has(m))continue;c.add(m);let{regex:j,params:O}=ve(g,{page:!0}),T=t.layouts!==!1?_(h,s):[];this.routes.push({pattern:g,regex:j,params:O,filePath:h,isDynamic:O.length>0,layout:T.length>0?T[T.length-1]:void 0})}}if(this.routes.sort((s,l)=>{if(!s.isDynamic&&l.isDynamic)return-1;if(s.isDynamic&&!l.isDynamic)return 1;let d=s.pattern.split("/").length,h=l.pattern.split("/").length;if(d!==h)return h-d;return s.pattern.localeCompare(l.pattern)}),t.emit!==!1){let s=u.resolve(e,t.stateDir||process.env.STX_DIR?.trim()||".stx");xi(this.routes,s),Si(this.routes,s,this.pagesDir)}}match(e){let t=e===""?"/":e;for(let a of this.routes){let r=t.match(a.regex);if(r){let n={};return a.params.forEach((o,i)=>{n[o]=r[i+1]}),{route:a,params:n}}}return null}resolve(e,t){let a=this.routes.find((n)=>n.pattern===e||n.filePath.includes(e));if(!a)return"#not-found";let r=a.pattern;if(t)for(let[n,o]of Object.entries(t))r=r.replace(`:${n}`,encodeURIComponent(o));return r}addRoute(e){this.routes.push(e),this.routes.sort((t,a)=>{if(!t.isDynamic&&a.isDynamic)return-1;if(t.isDynamic&&!a.isDynamic)return 1;return t.pattern.localeCompare(a.pattern)})}getLayout(e){return e.layout??null}}function Hs(e,t){let a=[`${t}.stx`,"error.stx"];for(let r of a){let n=u.join(e,r);if(x.existsSync(n))return n}return null}function Vs(e,t){return e.map((a)=>{let r=u.relative(t,a.filePath),n=a.isDynamic?" (dynamic)":"";return`${a.pattern} \u2192 ${r}${n}`})}var f={},k="";function wg(e){k=e.replace(/\/$/,"")}function vg(e,t,a={}){f[e]={path:t,name:e,params:a}}function xg(e){for(let[t,a]of Object.entries(e))if(typeof a==="string")f[t]={path:a,name:t};else f[t]={...a,name:t}}function Tr(e,t={},a=!1){let r=f[e];if(!r)return console.warn(`Route [${e}] not defined.`),"#undefined-route";let n={...r.params,...t},o=r.path;o=o.replace(/:(\w+)/g,(c,s)=>{let l=n[s];if(l===void 0)return console.warn(`Missing parameter [${s}] for route [${e}].`),`:${s}`;return delete n[s],encodeURIComponent(String(l))});let i=Object.entries(n);if(i.length>0){let c=i.map(([s,l])=>`${encodeURIComponent(s)}=${encodeURIComponent(String(l))}`).join("&");o+=(o.includes("?")?"&":"?")+c}return a&&k?`${k}${o}`:o}function Sg(){for(let e of Object.keys(f))delete f[e];k=""}import F from"fs";import q from"path";function kg(e,t={}){return{type:"redirect",path:e,options:{replace:t.replace??!1,external:t.external??!1,redirectCode:t.redirectCode??302}}}function _g(e){return{type:"abort",error:typeof e==="string"?{statusCode:500,message:e}:e}}function Cg(e,t={}){return{handler:e,mode:t.mode??"universal"}}function P(e){let t={};if(!e)return t;let a=e.split(";");for(let r of a){let[n,...o]=r.split("=");if(n){let i=n.trim(),c=o.join("=").trim();if(i)t[i]=decodeURIComponent(c)}}return t}function S(e,t,a={}){let r=`${encodeURIComponent(e)}=${encodeURIComponent(t)}`;if(a.expires){let n=typeof a.expires==="number"?new Date(Date.now()+a.expires*1000):a.expires;r+=`; Expires=${n.toUTCString()}`}if(a.path)r+=`; Path=${a.path}`;if(a.domain)r+=`; Domain=${a.domain}`;if(a.secure)r+="; Secure";if(a.httpOnly)r+="; HttpOnly";if(a.sameSite)r+=`; SameSite=${a.sameSite}`;return r}function Xc(e,t){let a=e.headers.get("cookie")||"",r=P(a);return{get(n){return r[n]},set(n,o,i={}){r[n]=o,t.append("Set-Cookie",S(n,o,i))},delete(n){delete r[n],t.append("Set-Cookie",S(n,"",{expires:new Date(0),path:"/"}))},getAll(){return{...r}}}}function Jc(){return{get(e){if(typeof document>"u")return;return P(document.cookie)[e]},set(e,t,a={}){if(typeof document>"u")return;document.cookie=S(e,t,a)},delete(e){if(typeof document>"u")return;document.cookie=S(e,"",{expires:new Date(0),path:"/"})},getAll(){if(typeof document>"u")return{};return P(document.cookie)}}}function Yc(){let e=typeof window<"u"&&typeof window.localStorage<"u";return{get(t){if(!e)return null;try{return window.localStorage.getItem(t)}catch{return null}},set(t,a){if(!e)return;try{window.localStorage.setItem(t,a)}catch{}},remove(t){if(!e)return;try{window.localStorage.removeItem(t)}catch{}},isAvailable(){return e}}}var v=new Map;function ki(e,t){v.set(e,t)}function Zc(e){return v.get(e)}function Eg(e){return v.has(e)}function Mt(){v.clear()}function Dt(){return Array.from(v.keys())}async function Lt(e,t="middleware"){let a=q.resolve(e,t);if(!F.existsSync(a))return;let r=F.readdirSync(a);for(let n of r){if(!n.endsWith(".ts")&&!n.endsWith(".js"))continue;if(n.includes(".test.")||n.includes(".spec."))continue;let o=n.replace(/\.(ts|js)$/,""),i=q.join(a,n);try{let s=(await import(i)).default;if(s&&typeof s.handler==="function")ki(o,s);else if(typeof s==="function")ki(o,{handler:s,mode:"universal"})}catch(c){console.warn(`Failed to load middleware '${o}' from ${i}:`,c)}}}function K(e){let t={};if(!e)return t;let a=new URLSearchParams(e);for(let[r,n]of a)t[r]=n;return t}function jt(e,t,a,r=""){return{path:e,params:t,query:K(r),fullPath:r?`${e}?${r}`:e,meta:a}}function Bt(e,t,a,r){let n=r?.isServer??typeof window>"u",o=!n,i=new Headers;return{to:e,from:t,isClient:o,isServer:n,cookies:n&&a?Xc(a,i):Jc(),storage:Yc(),state:{},request:a,responseHeaders:i}}async function Ft(e,t){let a=Array.isArray(e)?e:[e],r=t.isServer;for(let n of a){let o=Zc(n);if(!o)return console.error(`Route middleware '${n}' is not registered \u2014 failing the guard closed.`),{passed:!1,abort:{type:"abort",error:{statusCode:500,message:`Route middleware '${n}' is not registered`}},state:t.state,responseHeaders:t.responseHeaders};if(o.mode==="server"&&!r)continue;try{let i=await o.handler(t);if(i){if(i.type==="redirect")return{passed:!1,redirect:i,state:t.state,responseHeaders:t.responseHeaders};if(i.type==="abort")return{passed:!1,abort:i,state:t.state,responseHeaders:t.responseHeaders}}}catch(i){return console.error(`Error in middleware '${n}':`,i),{passed:!1,abort:{type:"abort",error:{statusCode:500,message:i instanceof Error?i.message:"Middleware error"}},state:t.state,responseHeaders:t.responseHeaders}}}return{passed:!0,state:t.state,responseHeaders:t.responseHeaders}}function Us(e){let a=e.replace(/\\/g,"/").split("/").filter(Boolean),r=a.lastIndexOf("layouts"),n=r>=0?a[r+1]:a.at(-1);if(!n)return"app";return n.replace(/\.stx$/i,"")||"app"}function dt(e){let t=e.match(/<meta\b[^>]*name=["']stx-layout["'][^>]*content=["']([^"']+)["'][^>]*>/i),a=e.match(/<meta\b[^>]*name=["']stx-layout-group["'][^>]*content=["']([^"']+)["'][^>]*>/i),r=e.match(/<!--\s*stx-layout:\s*([^ ]+)\s*-->/i),n=t?.[1]||r?.[1]||"";return{layout:n,group:a?.[1]||Us(n)}}var A,C;function W(e){let t=[],a="log(",r=0;while(r<e.length){let n=e.indexOf("log(",r);if(n===-1){t.push(e.slice(r));break}let o=n>0?e[n-1]:" ",i=/\bfunction\s+$/.test(e.slice(Math.max(0,n-16),n));if(/[\w$.]/.test(o)||i){t.push(e.slice(r,n+4)),r=n+4;continue}t.push(e.slice(r,n));let c=1,s=n+4;while(s<e.length&&c>0){let l=e[s];if(l==='"'||l==="'"||l==="`"){let d=l;s++;while(s<e.length&&e[s]!==d){if(e[s]==="\\")s++;s++}s++;continue}if(l==="(")c++;else if(l===")")c--;s++}t.push("0"),r=s}return t.join("")}function U(e,t=!1){try{return new Bun.Transpiler(t?{loader:"js",minify:{whitespace:!0,identifiers:!0,syntax:!0}}:{loader:"js",minifyWhitespace:!0}).transformSync(e).replace(/\}(var |let |const |function )/g,"};$1").replace(/<\/script/gi,"<\\/script").trim()}catch{return e}}function H(){return`
2
+ import x from"fs";import u from"path";import p from"fs";import w from"path";var y=["components","layouts","partials","emails"];function M(e){return e.split(/[\\/]/).filter(Boolean).slice(0,-1).some((a)=>y.includes(a))}function b(e){return M(e.replace(/^\//,""))}function _i(e,t){let a=e.filter((i)=>!b(i.pattern)),r=["// Auto-generated by STX - do not edit"];if(a.length===0)r.push("// No page routes found \u2014 route paths stay typed as string.","export {}","");else{r.push("declare module '@stacksjs/stx' {"," interface KnownRoutes {");for(let i of a){let c=[];for(let l of i.params){let d=i.pattern.includes(`:${l}?`)?"?":"";c.push(`${l}${d}: string`)}let s=c.join("; ");r.push(` '${i.pattern}': { ${s} }`)}r.push(" }","}","","export {}","")}let n=r.join(`
3
+ `),o=w.join(t,"route-types.d.ts");try{if(p.existsSync(o)&&p.readFileSync(o,"utf8")===n)return;p.mkdirSync(t,{recursive:!0}),p.writeFileSync(o,n)}catch{}}function Ci(e,t,a){let r=process.cwd(),n=w.relative(r,a),o=e.filter((c)=>!b(c.pattern)),i=["// Auto-generated by stx \u2014 do not edit",`// Source: ${n||"pages"}/`,"","export const routes = ["];for(let c of o){let s=w.relative(r,c.filePath).replace(/\\/g,"/"),l=JSON.stringify(c.params),d=c.layout?`, layout: '${w.relative(r,c.layout).replace(/\\/g,"/")}'`:"";i.push(` { pattern: '${c.pattern}', filePath: '${s}', isDynamic: ${c.isDynamic}, params: ${l}${d} },`)}i.push("] as const",""),i.push("export type RouteName = typeof routes[number]['pattern']",""),p.mkdirSync(t,{recursive:!0}),p.writeFileSync(w.join(t,"routes.ts"),i.join(`
4
+ `))}import I from"path";var N=Object.freeze(["ico","png","jpg","jpeg","gif","webp","avif","svg","bmp","tif","tiff","heic","css","js","mjs","cjs","map","wasm","webmanifest","json","xml","txt","rss","atom","woff","woff2","ttf","otf","eot","mp3","mp4","m4a","m4v","mov","webm","ogg","ogv","oga","wav","flac","avi","mkv","pdf","csv","doc","docx","xls","xlsx","ppt","pptx","rtf","odt","zip","gz","tgz","tar","rar","7z","bz2","xz","php","phtml","asp","aspx","jsp","cgi","env","ini","yml","yaml","toml","sql","bak","old","swp","log","conf","cfg","exe","dmg","pkg","apk","ipa","msi","iso","bin","dll"]),D=N.flatMap((e)=>e===e.toUpperCase()?[e]:[e,e.toUpperCase()]).join("|"),G=new RegExp(`\\.(?:${D})$`),E=`(?![^/]*\\.(?:${D})$)`;function Nt(e){let t=e,a=t.search(/[?#]/);if(a!==-1)t=t.slice(0,a);let r=t.slice(t.lastIndexOf("/")+1);return r.length>0&&G.test(r)}function R(e,t){let r=I.relative(t,e).replace(/\.(stx|md)$/,"");if(r=r.split(I.sep).join("/"),r==="index")return"/";if(r.endsWith("/index"))r=r.slice(0,-6);return r=r.replace(/\[\[([^\]]+)\]\]/g,":$1?"),r=r.replace(/\[([^\]]+)\]/g,":$1"),r=r.replace(/:\.\.\.([^/]+)/g,":$1*"),`/${r}`}function xe(e,t={}){let a=t.page?E:"",r=[],n="",o=0;while(o<e.length){let i=e.slice(o),c=/^\/:([^/?*]+)\?/.exec(i);if(c){r.push(c[1]);let d=o+c[0].length===e.length;n+=`(?:/${d?a:""}([^/]+))?`,o+=c[0].length;continue}let s=/^:([^/?*]+)\*/.exec(i);if(s){r.push(s[1]),n+="(.+)",o+=s[0].length;continue}let l=/^:([^/?*]+)/.exec(i);if(l){r.push(l[1]);let d=o+l[0].length===e.length;n+=`${d?a:""}([^/]+)`,o+=l[0].length;continue}n+=e[o].replace(/[.+^${}()|[\]\\*?]/g,"\\$&"),o+=1}return{regex:new RegExp(`^${n}$`),params:r}}function Er(e,t){let a=e===""?"/":e;for(let r of t){let n=a.match(r.regex);if(n){let o={};return r.params.forEach((i,c)=>{o[i]=n[c+1]}),{route:r,params:o}}}return null}function Us(e,t={}){let a=e.replace(/\[\[([^\]]+)\]\]/g,":$1?").replace(/\[([^\]]+)\]/g,":$1").replace(/:\.\.\.([^/]+)/g,":$1*");return xe(a,t)}import X from"fs";import L from"path";function _(e,t){let a=[],r=L.dirname(e);while(r.startsWith(t)||r===t){let n=L.join(r,"_layout.stx");if(X.existsSync(n))a.unshift(n);if(r===t)break;r=L.dirname(r)}return a}function B(e,t){let a=[];if(!x.existsSync(e))return a;let r=x.readdirSync(e,{withFileTypes:!0});for(let n of r){let o=u.join(e,n.name);if(n.isDirectory()){if(n.name.startsWith("."))continue;if(y.includes(n.name))continue;a.push(...B(o,t))}else if(n.isFile()){let i=u.extname(n.name);if(t.includes(i)){if(n.name.startsWith("_")&&n.name!=="_layout.stx")continue;if(n.name==="_layout.stx")continue;a.push(o)}}}return a}class Tr{routes;pagesDir;pagesDirs;config;constructor(e,t={}){this.config=t;let a=t.pagesDirs&&t.pagesDirs.length>0?t.pagesDirs:[t.pagesDir||"pages"];this.pagesDirs=a.map((s)=>u.resolve(e,s)),this.pagesDir=this.pagesDirs[0];let r=t.extensions||[".stx"],n=(s)=>{let l=u.resolve(e,s);try{return x.realpathSync(l)}catch{return l}},o=(t.exclude??[]).filter((s)=>typeof s==="string"&&s.trim()!=="").map(n),i=(s)=>{if(o.length===0)return!1;let l=n(s);return o.some((d)=>l===d||l.startsWith(`${d}${u.sep}`))},c=new Set;this.routes=[];for(let s of this.pagesDirs){let l=B(s,r).filter((h)=>!i(h)),d=new Map;for(let h of l){let g=R(h,s),m=t.pagesDirs?g.replace(/:[\w]+/g,":param"):g;if(t.pagesDirs&&d.has(m))throw Error(`Conflicting layer pages for ${g}: ${d.get(m)} and ${h}`);if(d.set(m,h),c.has(m))continue;c.add(m);let{regex:j,params:O}=xe(g,{page:!0}),T=t.layouts!==!1?_(h,s):[];this.routes.push({pattern:g,regex:j,params:O,filePath:h,isDynamic:O.length>0,layout:T.length>0?T[T.length-1]:void 0})}}if(this.routes.sort((s,l)=>{if(!s.isDynamic&&l.isDynamic)return-1;if(s.isDynamic&&!l.isDynamic)return 1;let d=s.pattern.split("/").length,h=l.pattern.split("/").length;if(d!==h)return h-d;return s.pattern.localeCompare(l.pattern)}),t.emit!==!1){let s=u.resolve(e,t.stateDir||process.env.STX_DIR?.trim()||".stx");_i(this.routes,s),Ci(this.routes,s,this.pagesDir)}}match(e){let t=e===""?"/":e;for(let a of this.routes){let r=t.match(a.regex);if(r){let n={};return a.params.forEach((o,i)=>{n[o]=r[i+1]}),{route:a,params:n}}}return null}resolve(e,t){let a=this.routes.find((n)=>n.pattern===e||n.filePath.includes(e));if(!a)return"#not-found";let r=a.pattern;if(t)for(let[n,o]of Object.entries(t))r=r.replace(`:${n}`,encodeURIComponent(o));return r}addRoute(e){this.routes.push(e),this.routes.sort((t,a)=>{if(!t.isDynamic&&a.isDynamic)return-1;if(t.isDynamic&&!a.isDynamic)return 1;return t.pattern.localeCompare(a.pattern)})}getLayout(e){return e.layout??null}}function Ws(e,t){let a=[`${t}.stx`,"error.stx"];for(let r of a){let n=u.join(e,r);if(x.existsSync(n))return n}return null}function qs(e,t){return e.map((a)=>{let r=u.relative(t,a.filePath),n=a.isDynamic?" (dynamic)":"";return`${a.pattern} \u2192 ${r}${n}`})}var f={},k="";function vg(e){k=e.replace(/\/$/,"")}function xg(e,t,a={}){f[e]={path:t,name:e,params:a}}function Sg(e){for(let[t,a]of Object.entries(e))if(typeof a==="string")f[t]={path:a,name:t};else f[t]={...a,name:t}}function $r(e,t={},a=!1){let r=f[e];if(!r)return console.warn(`Route [${e}] not defined.`),"#undefined-route";let n={...r.params,...t},o=r.path;o=o.replace(/:(\w+)/g,(c,s)=>{let l=n[s];if(l===void 0)return console.warn(`Missing parameter [${s}] for route [${e}].`),`:${s}`;return delete n[s],encodeURIComponent(String(l))});let i=Object.entries(n);if(i.length>0){let c=i.map(([s,l])=>`${encodeURIComponent(s)}=${encodeURIComponent(String(l))}`).join("&");o+=(o.includes("?")?"&":"?")+c}return a&&k?`${k}${o}`:o}function kg(){for(let e of Object.keys(f))delete f[e];k=""}import F from"fs";import q from"path";function _g(e,t={}){return{type:"redirect",path:e,options:{replace:t.replace??!1,external:t.external??!1,redirectCode:t.redirectCode??302}}}function Cg(e){return{type:"abort",error:typeof e==="string"?{statusCode:500,message:e}:e}}function Eg(e,t={}){return{handler:e,mode:t.mode??"universal"}}function P(e){let t={};if(!e)return t;let a=e.split(";");for(let r of a){let[n,...o]=r.split("=");if(n){let i=n.trim(),c=o.join("=").trim();if(i)t[i]=decodeURIComponent(c)}}return t}function S(e,t,a={}){let r=`${encodeURIComponent(e)}=${encodeURIComponent(t)}`;if(a.expires){let n=typeof a.expires==="number"?new Date(Date.now()+a.expires*1000):a.expires;r+=`; Expires=${n.toUTCString()}`}if(a.path)r+=`; Path=${a.path}`;if(a.domain)r+=`; Domain=${a.domain}`;if(a.secure)r+="; Secure";if(a.httpOnly)r+="; HttpOnly";if(a.sameSite)r+=`; SameSite=${a.sameSite}`;return r}function Jc(e,t){let a=e.headers.get("cookie")||"",r=P(a);return{get(n){return r[n]},set(n,o,i={}){r[n]=o,t.append("Set-Cookie",S(n,o,i))},delete(n){delete r[n],t.append("Set-Cookie",S(n,"",{expires:new Date(0),path:"/"}))},getAll(){return{...r}}}}function Yc(){return{get(e){if(typeof document>"u")return;return P(document.cookie)[e]},set(e,t,a={}){if(typeof document>"u")return;document.cookie=S(e,t,a)},delete(e){if(typeof document>"u")return;document.cookie=S(e,"",{expires:new Date(0),path:"/"})},getAll(){if(typeof document>"u")return{};return P(document.cookie)}}}function Zc(){let e=typeof window<"u"&&typeof window.localStorage<"u";return{get(t){if(!e)return null;try{return window.localStorage.getItem(t)}catch{return null}},set(t,a){if(!e)return;try{window.localStorage.setItem(t,a)}catch{}},remove(t){if(!e)return;try{window.localStorage.removeItem(t)}catch{}},isAvailable(){return e}}}var v=new Map;function Ei(e,t){v.set(e,t)}function Qc(e){return v.get(e)}function Tg(e){return v.has(e)}function Mt(){v.clear()}function Dt(){return Array.from(v.keys())}async function Lt(e,t="middleware"){let a=q.resolve(e,t);if(!F.existsSync(a))return;let r=F.readdirSync(a);for(let n of r){if(!n.endsWith(".ts")&&!n.endsWith(".js"))continue;if(n.includes(".test.")||n.includes(".spec."))continue;let o=n.replace(/\.(ts|js)$/,""),i=q.join(a,n);try{let s=(await import(i)).default;if(s&&typeof s.handler==="function")Ei(o,s);else if(typeof s==="function")Ei(o,{handler:s,mode:"universal"})}catch(c){console.warn(`Failed to load middleware '${o}' from ${i}:`,c)}}}function K(e){let t={};if(!e)return t;let a=new URLSearchParams(e);for(let[r,n]of a)t[r]=n;return t}function jt(e,t,a,r=""){return{path:e,params:t,query:K(r),fullPath:r?`${e}?${r}`:e,meta:a}}function Bt(e,t,a,r){let n=r?.isServer??typeof window>"u",o=!n,i=new Headers;return{to:e,from:t,isClient:o,isServer:n,cookies:n&&a?Jc(a,i):Yc(),storage:Zc(),state:{},request:a,responseHeaders:i}}async function Ft(e,t){let a=Array.isArray(e)?e:[e],r=t.isServer;for(let n of a){let o=Qc(n);if(!o)return console.error(`Route middleware '${n}' is not registered \u2014 failing the guard closed.`),{passed:!1,abort:{type:"abort",error:{statusCode:500,message:`Route middleware '${n}' is not registered`}},state:t.state,responseHeaders:t.responseHeaders};if(o.mode==="server"&&!r)continue;try{let i=await o.handler(t);if(i){if(i.type==="redirect")return{passed:!1,redirect:i,state:t.state,responseHeaders:t.responseHeaders};if(i.type==="abort")return{passed:!1,abort:i,state:t.state,responseHeaders:t.responseHeaders}}}catch(i){return console.error(`Error in middleware '${n}':`,i),{passed:!1,abort:{type:"abort",error:{statusCode:500,message:i instanceof Error?i.message:"Middleware error"}},state:t.state,responseHeaders:t.responseHeaders}}}return{passed:!0,state:t.state,responseHeaders:t.responseHeaders}}function Ks(e){let a=e.replace(/\\/g,"/").split("/").filter(Boolean),r=a.lastIndexOf("layouts"),n=r>=0?a[r+1]:a.at(-1);if(!n)return"app";return n.replace(/\.stx$/i,"")||"app"}function dt(e){let t=e.match(/<meta\b[^>]*name=["']stx-layout["'][^>]*content=["']([^"']+)["'][^>]*>/i),a=e.match(/<meta\b[^>]*name=["']stx-layout-group["'][^>]*content=["']([^"']+)["'][^>]*>/i),r=e.match(/<!--\s*stx-layout:\s*([^ ]+)\s*-->/i),n=t?.[1]||r?.[1]||"";return{layout:n,group:a?.[1]||Ks(n)}}var A,C;function W(e){let t=[],a="log(",r=0;while(r<e.length){let n=e.indexOf("log(",r);if(n===-1){t.push(e.slice(r));break}let o=n>0?e[n-1]:" ",i=/\bfunction\s+$/.test(e.slice(Math.max(0,n-16),n));if(/[\w$.]/.test(o)||i){t.push(e.slice(r,n+4)),r=n+4;continue}t.push(e.slice(r,n));let c=1,s=n+4;while(s<e.length&&c>0){let l=e[s];if(l==='"'||l==="'"||l==="`"){let d=l;s++;while(s<e.length&&e[s]!==d){if(e[s]==="\\")s++;s++}s++;continue}if(l==="(")c++;else if(l===")")c--;s++}t.push("0"),r=s}return t.join("")}function U(e,t=!1){try{return new Bun.Transpiler(t?{loader:"js",minify:{whitespace:!0,identifiers:!0,syntax:!0}}:{loader:"js",minifyWhitespace:!0}).transformSync(e).replace(/\}(var |let |const |function )/g,"};$1").replace(/<\/script/gi,"<\\/script").trim()}catch{return e}}function H(){return`
5
5
  ;(function(){
6
6
  'use strict';
7
7
  var ROUTER_REV=8;
@@ -4216,4 +4216,4 @@ else {
4216
4216
 
4217
4217
  if(document.readyState==='loading')document.addEventListener('DOMContentLoaded',init);else init();
4218
4218
  })();
4219
- `}function pt(){if(A)return A;return A=U(W(H()),!0),A}function Tg(){if(C)return C;return C=U(H()),C}export{xi,Si,Nt,ve,Cr,zs,Er,Hs,Vs,wg,vg,xg,Tr,Sg,kg,_g,Cg,Xc,Jc,Yc,ki,Zc,Eg,Mt,Dt,Lt,jt,Bt,Ft,Us,dt,pt,Tg};
4219
+ `}function pt(){if(A)return A;return A=U(W(H()),!0),A}function $g(){if(C)return C;return C=U(H()),C}export{_i,Ci,Nt,xe,Er,Us,Tr,Ws,qs,vg,xg,Sg,$r,kg,_g,Cg,Eg,Jc,Yc,Zc,Ei,Qc,Tg,Mt,Dt,Lt,jt,Bt,Ft,Ks,dt,pt,$g};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{Dl}from"./chunk-kvxdyg7e.js";function Z(n){let r=new Bun.Transpiler({loader:"js"});if(Dl(n))return r.transformSync(`(async function(){
2
+ import{Ll}from"./chunk-9n5h4sqc.js";function Z(n){let r=new Bun.Transpiler({loader:"js"});if(Ll(n))return r.transformSync(`(async function(){
3
3
  ${n}
4
4
  })()`),!0;try{return r.transformSync(`(function(){
5
5
  ${n}
@@ -0,0 +1,20 @@
1
+ // @bun
2
+ import{gr,Fe}from"./chunk-cz1sdes5.js";import{X,S,Ir,Qs,A}from"./chunk-gz9pknbw.js";import{a,j}from"./chunk-p8shtje2.js";import{ei}from"./chunk-s0mf56y1.js";import{Z}from"./chunk-eqffvse2.js";import{ft}from"./chunk-6c1vm6bs.js";import{l}from"./chunk-dzqfv801.js";import{t,E}from"./chunk-3hsv6ejp.js";import d from"path";import _ from"fs";import{AsyncLocalStorage as lt}from"async_hooks";import{randomUUID as St}from"crypto";var vt=12;function G(e,n,s){return/^(?:(?:stx|ui)\.config\.[cm]?[jt]s|runtime-config-(?:server|loader)\.[cm]?[jt]s)$/.test(d.basename(e))||ei(e,n,s)}var ct=2;function Xf(e){let n=process.env.STX_BUNDLE_CACHE_DIR?.trim();return n?d.resolve(n):l(e,"bundle-cache")}function rt(e,n){let s=e;for(let i of Bt(n))if(i!==d.sep)s=s.split(i).join("\x00root");return s}var it=new Map;function Bt(e){let n=d.resolve(e),s=it.get(n);if(!s){let i=n;try{i=_.realpathSync(n)}catch{}s=[...new Set([n,i])].sort((c,p)=>p.length-c.length),it.set(n,s)}return s}function jt(e,n){try{let s=_.statSync(e),i=d.resolve(n),c=e.startsWith(`${i}${d.sep}`);return{path:c?d.relative(i,e):e,...c?{inRoot:!0}:{},mtimeMs:s.mtimeMs,size:s.size,hash:Bun.hash(_.readFileSync(e)).toString(36)}}catch{return null}}function ut(e,n){return e.inRoot?d.join(d.resolve(n),e.path):e.path}function Et(e,n){for(let s of e){let i=ut(s,n);try{let c=_.statSync(i);if(c.size!==s.size)return!1;if(c.mtimeMs!==s.mtimeMs&&Bun.hash(_.readFileSync(i)).toString(36)!==s.hash)return!1}catch{return!1}}return!0}var dt=new Map,_t=100;function Jf(e=process.env){let n=Number(e.STX_BUNDLE_CACHE_LIMIT);return Number.isFinite(n)&&n>=1?Math.floor(n):2000}var q=new Map;async function Mt(e){let n=q.get(e)??0;if(n>0&&n<_t){q.set(e,n+1);return}q.set(e,1);try{let s=(await _.promises.readdir(e)).filter((o)=>o.endsWith(".js")),i=Jf();if(s.length<=i)return;let p=(await Promise.all(s.map(async(o)=>{try{return{name:o,at:(await _.promises.stat(d.join(e,o))).mtimeMs}}catch{return null}}))).filter((o)=>o!==null);p.sort((o,b)=>b.at-o.at);for(let o of p.slice(i)){let b=o.name.slice(0,-3);await _.promises.rm(d.join(e,`${b}.js`),{force:!0}),await _.promises.rm(d.join(e,`${b}.deps.json`),{force:!0})}T("pruned bundle cache to",i,"entries")}catch{}}function Ee(e){return dt.get(e)??[]}function Y(e,n){if(e)dt.set(e,n)}function Yf(e=process.env){return e.STX_DEBUG==="true"||e.STX_DEBUG==="1"}function T(...e){if(Yf())console.log("[stx:bundler]",...e)}var et=[];function Cc(e,n,s){et.push({filePath:e||"<inline>",message:n,details:s})}function fn(){return et.slice()}function gn(){et.length=0}var K;function ey(e){K=e}function Ec(){if(K)return K;try{let e=j.strict;return typeof e==="object"&&e!==null?e.bundlerFallback??"warn":"warn"}catch{return"warn"}}var tt=[/^stx$/,/^@stacksjs\/stx$/,/^@stores$/,/^stx\/stores$/,/^@composables$/];function mn(e){let n=/^[ \t]*import[ \t]+(?!type(?:[ \t]|{))[\s\S]*?\s+from\s+['"]([^'"]+)['"][ \t]*;?/gm,s;while((s=n.exec(e))!==null){let c=s[1];if(!tt.some((o)=>o.test(c)))return T("detected user import:",c),!0}let i=/^[ \t]*import[ \t]*['"]([^'"]+)['"]/gm;while((s=i.exec(e))!==null){let c=s[1];if(/\.css(?:\?.*)?$/.test(c))continue;if(!tt.some((o)=>o.test(c)))return T("detected side-effect import:",c),!0}return!1}var fr="stx-module:",Rt=/\.(?:[cm]?[jt]sx?|json)$/i;function Zf(e,n){return d.relative(e,n).split(d.sep).join("/")}function Qf(e,n){if(n.size===0)return e;return e.replace(/^([ \t]*import(?:(?:\s+|(?=[{*]))[^;"']*?\s*from\s*|\s*))(["'])([^"']+)\2/gm,(s,i,c,p)=>{let o=n.get(p);return o&&!p.startsWith(fr)?`${i}${c}${o}${c}`:s})}function eg(e,n){let s=0,i=(p)=>{let o=`__stxMod${s++}`,b=JSON.stringify(p);return n.push(`var ${o} = globalThis.__stxModules && globalThis.__stxModules[${b}];`,`if (${o} === undefined) throw new Error("[stx] module " + ${JSON.stringify(b)} + " is not registered on this page (#1957)");`),o},c=(p,o)=>{for(let b of p.split(",")){let D=b.trim();if(!D)continue;let F=D.match(/^("(?:[^"\\]|\\.)*"|[\w$]+)(?:\s+as\s+([\w$]+))?$/);if(!F)continue;let w=F[1].startsWith('"')?JSON.parse(F[1]):F[1],f=F[2]??w;n.push(`var ${f} = ${o}[${JSON.stringify(w)}];`)}};return e=e.replace(/^[ \t]*import(?:\s+|(?=[{*]))([^;"']+?)\s*from\s*["'](stx-module:[^"']+)["'];?[ \t]*$/gm,(p,o,b)=>{let D=b.slice(fr.length),F=i(D),w=o.trim(),f=w.match(/^([\w$]+)\s*(?:,\s*|$)/);if(f&&!w.startsWith("{")&&!w.startsWith("*"))n.push(`var ${f[1]} = ${F}.default;`),w=w.slice(f[0].length).trim();let v=w.match(/^\*\s*as\s+([\w$]+)$/);if(v)n.push(`var ${v[1]} = ${F};`);else if(w.startsWith("{"))c(w.replace(/^\{|\}$/g,""),F);return""}),e=e.replace(/^[ \t]*import\s*["'](stx-module:[^"']+)["'];?[ \t]*$/gm,(p,o)=>(i(o.slice(fr.length)),"")),e}function ot(e){let n=[e,`${e}.ts`,`${e}.tsx`,`${e}.js`,`${e}.mjs`,`${e}.jsx`,d.join(e,"index.ts"),d.join(e,"index.tsx"),d.join(e,"index.js"),d.join(e,"index.mjs")];for(let s of n)try{if(_.existsSync(s)&&_.statSync(s,{throwIfNoEntry:!1})?.isFile())return s}catch{}return}var H=new lt;function Ss(e,n){let s=new Bun.CryptoHasher("md5");for(let[i,c]of[...e].sort(([p],[o])=>p<o?-1:p>o?1:0))s.update(`${i}\x00${c}\x00`);return H.run({modules:e,key:s.digest("hex").slice(0,12)},n)}var pt=new lt;function tg(e){return pt.run(!0,e)}function ng(){return pt.getStore()===!0}function Tc(e){if(!ng())return;throw Error(`The client script of ${e} needs bundling, and it is being rendered inside a Bun.build loader, where Bun never finishes a second build. Make the page an entrypoint of the build (bun-plugin-stx renders entrypoints before the bundler starts), or render it once outside the build so its bundle is cached.`)}function hn(){return H.getStore()?.key??""}function mt(e,n,s,i,c,p,o=new Map,b,D,F){let w=new Map([[s,i],...F??[]]),f=(B)=>B!==void 0&&w.has(B),v=(B,r,u)=>{if(G(r,e,b))return null;if(!p||!f(B)||!Rt.test(r))return null;try{if(!_.statSync(r,{throwIfNoEntry:!1})?.isFile())return null}catch{return null}c.add(r);let M=`${fr}${Zf(process.cwd(),r)}`;return o.set(u,M),{path:M,external:!0}},y=(B,r)=>{let u=f(B)?n:d.dirname(B),M=d.resolve(u,r);return ot(M)??M};return{name:"stx-client-bundle",setup(B){if(B.onResolve({filter:/^(stx|@stacksjs\/stx)$/},(r)=>({path:r.path,external:!0})),B.onResolve({filter:/^(@stores|@composables|stx\/stores)$/},(r)=>({path:r.path,external:!0})),B.onResolve({filter:/^\//},(r)=>{if(f(r.path))return{path:r.path};let u=ot(r.path);if(u){let M=v(r.importer,u,r.path);if(M)return M;if(!f(u))c.add(u);return{path:u}}return{path:r.path,external:!0}}),B.onResolve({filter:/^\.\.?\//},(r)=>{let u=y(r.importer,r.path),M=v(r.importer,u,r.path);if(M)return M;return c.add(u),{path:u}}),B.onResolve({filter:/^[@~]\//},(r)=>{let u=d.resolve(e,r.path.slice(2)),M=[u,`${u}.ts`,`${u}.tsx`,`${u}.js`,`${u}.mjs`,`${u}.jsx`,d.join(u,"index.ts"),d.join(u,"index.tsx"),d.join(u,"index.js"),d.join(u,"index.mjs")];for(let h of M)if(_.existsSync(h)&&_.statSync(h,{throwIfNoEntry:!1})?.isFile()){let O=v(r.importer,h,r.path);if(O)return O;return T(`resolved ${r.path[0]}/ import:`,r.path,"\u2192",h),c.add(h),{path:h}}return console.warn(`[stx:bundler] could not resolve ${r.path[0]}/ import:`,r.path),{path:u}}),p)B.onResolve({filter:/^(?!node:|bun:)(?:@[\w.-]+\/)?[\w.-]/},(r)=>{if(!f(r.importer))return;let u=`${fr}npm:${r.path}`;return o.set(r.path,u),{path:u,external:!0}});B.onLoad({filter:/\.(?:[cm]?[jt]sx?|json)$/},(r)=>{if(w.has(r.path))return{contents:w.get(r.path),loader:"ts"};if(G(r.path,e,b))throw Error(`Server-only API source cannot be imported by a client script: ${r.path}`);let u=d.extname(r.path).toLowerCase(),M=u===".json"?"json":u===".tsx"?"tsx":u===".jsx"?"jsx":u===".ts"||u===".mts"||u===".cts"?"ts":"js";if(!f(r.path))c.add(r.path);let h=D?.get(r.path);if(h!==void 0)return{contents:h,loader:"js"};return{contents:_.readFileSync(r.path,"utf8"),loader:M}})}}}var Q=new Map,V=S(64),at=Symbol.for("stx.client-bundle-build-queue");function rg(e){let n=globalThis,i=(n[at]??Promise.resolve()).then(e,e);return n[at]=i.then(()=>{return},()=>{return}),i}async function yn(e,n,s={}){let i=s.projectRoot||process.cwd(),c=(await a(i)).serverApi,p=s.minify??!1,o=s.externalizeUserModules??!0,b=s.expose?.length?[...new Set(s.expose)].sort():void 0,D=s.cacheDir||Xf(i),F=H.getStore(),w=new Bun.CryptoHasher("md5");w.update(`${vt}\x00${ft()}\x00${JSON.stringify(c??!1)}\x00${o?"registry":"inline"}\x00${b?b.join(","):"*"}\x00${p?"minified":"readable"}\x00${F?.key??""}\x00${rt(e,i)}\x00${rt(n,i)}`);let f=w.digest("hex").slice(0,12),v=d.join(D,`${f}.js`),y=V.get(v);if(y){if(Qs(y.files)&&y.files.every((h)=>!G(h.path,i,c))){T("memo hit:",f);let h=y.files.map((O)=>O.path);return Y(n,h),s.collectInputs?.push(...h),y.code}V.delete(v),T("memo invalidated by dep change:",f)}let B=d.join(D,`${f}.deps.json`),r=Bun.file(v);if(await r.exists()){let h=Bun.file(B),O=!1,N=null;if(await h.exists())try{let k=JSON.parse(await h.text());if(k.metadataVersion===ct&&Array.isArray(k.files)&&Et(k.files,i))N=Ir(k.files.map((g)=>ut(g,i))),O=N.length===k.files.length&&!N.some((g)=>G(g.path,i,c))}catch{O=!1}if(O){if(T("cache hit:",f),N)Y(n,N.map((L)=>L.path)),s.collectInputs?.push(...N.map((L)=>L.path));let k=await r.text(),g=new Date;if(_.promises.utimes(v,g,g).catch(()=>{}),N)V.set(v,{code:k,files:N});return k}T("cache invalidated by dep change:",f)}let u=Q.get(f);if(u){let h=await u;if(s.collectInputs)s.collectInputs.push(...(V.get(v)?.files??[]).map((O)=>O.path));return h}Tc(n);let M=rg(()=>Ft(e,n,{projectRoot:i,minify:p,cacheDir:D,hash:f,cachePath:v,depsPath:B,collectInputs:s.collectInputs,externalizeUserModules:o,serverApi:c,expose:b,throwOnFailure:s.throwOnFailure,substitutes:F?.modules}));Q.set(f,M);try{return await M}finally{Q.delete(f)}}function $c(e){return`${e}-${process.pid}-${St()}`}async function ty(e,n){let{projectRoot:s}=n,i=$c(new Bun.CryptoHasher("md5").update([...e.keys()].join("\x00")).digest("hex").slice(0,12)),c=d.join(l(s,"bundle-tmp"),"out",i);_.mkdirSync(c,{recursive:!0});let p=new Map,o=new Map,b=0;for(let[f,v]of e){let y=d.join(s,`.stx-split-${i}-${b++}.ts`);p.set(y,v),o.set(d.basename(y).replace(/\.ts$/,""),f)}let[D,F]=[...p][0],w=new Set;Tc(n.filePath);try{let f=await Bun.build({entrypoints:[...p.keys()],outdir:c,target:"browser",format:"esm",splitting:!0,minify:!1,naming:{entry:"[name].js",chunk:"chunk-[hash].js"},plugins:[mt(s,d.dirname(n.filePath),D,F,w,!1,new Map,void 0,H.getStore()?.modules,p)],define:{"process.env.NODE_ENV":'"development"',...A()},root:s});if(!f.success)throw Error(f.logs.filter((y)=>y.level==="error").map((y)=>y.message).join(", ")||"Unable to bundle the entries");let v={entries:new Map,chunks:new Map};for(let y of f.outputs){let B=d.basename(y.path);if(y.kind==="entry-point"){let r=o.get(B.replace(/\.js$/,""));if(r!==void 0)v.entries.set(r,await y.text())}else if(y.kind==="chunk")v.chunks.set(B.replace(/\.js$/,""),await y.text())}return n.collectInputs?.push(...w),v}finally{try{_.rmSync(c,{recursive:!0,force:!0})}catch{}}}async function Ft(e,n,s){let{projectRoot:i,minify:c,cacheDir:p,hash:o,cachePath:b,depsPath:D,externalizeUserModules:F}=s,w=l(i,"bundle-tmp"),f=$c(o),v=d.join(i,`.stx-client-${f}.ts`),y=d.join(w,"out",f);_.mkdirSync(y,{recursive:!0});let B=d.dirname(n),r=new Set,u=/^[ \t]*(export\s+)?(?:const|let|var)\s+(?:\{([^}]+)\}|(\w+))/gm,M=/^[ \t]*(export\s+)?(?:async\s+)?function\s+(\w+)/gm,h=t(e),{depths:O,balanced:N}=E(h),k=(I)=>!N||O[I]===0,g;while((g=u.exec(h))!==null){if(g[1])continue;if(!k(g.index))continue;if(g[2])g[2].split(",").forEach((I)=>{let m=It(I);if(m)r.add(m)});else if(g[3])r.add(g[3])}while((g=M.exec(h))!==null){if(g[1])continue;if(!k(g.index))continue;r.add(g[2])}let L=/^[ \t]*import[ \t]+(?!type\b)(?:(\w+)\s*(?:,\s*)?)?(?:\*\s+as\s+(\w+)|\{([^}]+)\})?\s+from\b/gm;while((g=L.exec(h))!==null){if(!k(g.index))continue;let I=/^\s*['"]([^'"]+)['"]/.exec(e.slice(g.index+g[0].length))?.[1];if(I&&tt.some((m)=>m.test(I)))continue;if(g[1])r.add(g[1]);if(g[2])r.add(g[2]);for(let m of(g[3]??"").split(",")){let R=m.trim();if(!R||/^type\s/.test(R))continue;let P=/\bas\s+(\w+)\s*$/.exec(R)?.[1]??/^\w+$/.exec(R)?.[0];if(P)r.add(P)}}for(let I of h.matchAll(/\bexport\s*\{([^}]+)\}/g))for(let m of I[1].split(",")){let R=/\bas\s+(\w+)\s*$/.exec(m)?.[1]??/^\s*(\w+)\s*$/.exec(m)?.[1];if(R)r.delete(R)}let gt=r.size>0?`
3
+ export { ${[...r].join(", ")} }`:"";T("bundling:",o,"from:",d.basename(n));let nt=new Set,st=new Map;try{let I=await Bun.build({entrypoints:[v],outdir:y,target:"browser",format:"esm",minify:c?{whitespace:!1,identifiers:!0,syntax:!0}:!1,plugins:[mt(i,B,v,e+gt,nt,F,st,s.serverApi,s.substitutes)],define:{"process.env.NODE_ENV":c?'"production"':'"development"',...A()},root:i});if(!I.success){let C=I.logs.filter((U)=>U.level==="error").map((U)=>U.message).join(", ")||`Unable to bundle ${d.basename(n)}`,z=gr(I.logs,n||void 0);if(console.warn("[stx:bundler] build failed:",C),Cc(n||"",C,z),s.throwOnFailure||Ec()==="error")throw Error(C);return e}let m="";for(let x of I.outputs){m=await x.text();break}let R=[];for(let x of m.matchAll(/^\s*export\s*\{([^}]*)\}\s*;?\s*$/gm))for(let C of x[1].split(",")){let z=C.trim().match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(z){R.push([z[2],z[1]]);continue}let U=C.trim();if(/^[A-Za-z_$][\w$]*$/.test(U))R.push([U,U])}if(s.expose){let x=new Set(s.expose);for(let C=R.length-1;C>=0;C--)if(!x.has(R[C][0]))R.splice(C,1)}let P=[];m=eg(Qf(m,st),P);let ht=m.match(/^\s*import(?:\s+|(?=["'{*]))[^;]+;?\s*$/gm)||[];if(m=m.replace(/^\s*import(?:\s+|(?=["'{*]))[^;]+;?\s*$/gm,"").replace(/^\s*export\s*\{[^}]*\}\s*;?\s*$/gm,"").replace(/^\s*export\s+default\s+.*$/gm,"").trim(),c&&m)try{m=new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync(m)}catch{}let xt=Z(m),W=`__stxBundle_${o}`,yt=new Set(X(e,!0).split(",").map((x)=>x.trim())),$t=R.map(([x,C])=>`get ${JSON.stringify(x)}() { return ${C} }${yt.has(x)?`, set ${JSON.stringify(x)}(__stxValue_${C}) { ${C} = __stxValue_${C} }`:""}`).join(", "),bt=R.map(([x])=>`var ${x} = undefined;`).join(`
4
+ `),wt=R.map(([x])=>`${x} = ${W}[${JSON.stringify(x)}];`).join(`
5
+ `);if(m=`${ht.join(`
6
+ `)}
7
+ ${bt}
8
+ var ${W} = ${xt?"await (async function":"(function"}() {
9
+ ${P.join(`
10
+ `)}
11
+ ${m}
12
+ return { ${$t} };
13
+ })();
14
+ ${wt}
15
+ var __stxLiveBindings = typeof __stxLiveBindings === 'undefined' ? {} : __stxLiveBindings;
16
+ Object.keys(${W}).forEach(function(name) {
17
+ if (!Object.prototype.hasOwnProperty.call(__stxLiveBindings, name))
18
+ Object.defineProperty(__stxLiveBindings, name, Object.getOwnPropertyDescriptor(${W}, name));
19
+ });`.trim(),T("bundled:",o,"output:",m.length,"bytes"),r.size>0&&R.length===0)return console.warn(`[stx:bundler] dropped every binding for ${d.basename(n)} (${o}); serving the unbundled source and not caching this result`),e;_.mkdirSync(p,{recursive:!0}),await Bun.write(b,m);let J=Ir(nt);return await Bun.write(D,JSON.stringify({metadataVersion:ct,files:J.map((x)=>jt(x.path,i)).filter((x)=>x!==null)})),Y(n,J.map((x)=>x.path)),s.collectInputs?.push(...J.map((x)=>x.path)),V.set(b,{code:m,files:J}),await Mt(p),m}catch(I){let m=gr(I,n||void 0),R=Fe(I,n||void 0);if(console.warn(`[stx:bundler] error: ${R}`),Cc(n||"",R,m),s.throwOnFailure||Ec()==="error")throw I;return e}finally{try{_.rmSync(y,{recursive:!0,force:!0})}catch{}}}function It(e){let n=e.trim();if(!n)return null;let s=n.indexOf("=");if(s!==-1)n=n.slice(0,s).trim();let i=n.indexOf(":");if(i!==-1)n=n.slice(i+1).trim();if(n.startsWith("..."))n=n.slice(3).trim();return/^[A-Za-z_$][\w$]*$/.test(n)?n:null}
20
+ export{Xf,Jf,Ee,Yf,Cc,fn,gn,ey,Ec,mn,fr,Zf,Qf,eg,Ss,tg,ng,Tc,hn,rg,yn,$c,ty};
@@ -0,0 +1,3 @@
1
+ // @bun
2
+ import t from"fs";import r from"path";var dn="resources/assets",dr="assets";function pr(o=process.cwd()){let s=r.resolve(o,dn);return t.existsSync(s)&&t.statSync(s).isDirectory()?s:null}
3
+ export{dn,dr,pr};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{AsyncLocalStorage as R}from"async_hooks";var b=Symbol.for("stx.runtime-config.scope"),y=globalThis,m=y[b]??=new R;function Ye(n,f){return m.run(n,f)}function Nn(){return m.getStore()}function ao(){let n=m.getStore();if(!n)throw Error("useServerRuntimeConfig requires a server request or template render");return Object.freeze(Object.defineProperty({public:n.public},"private",{value:n.private}))}function Ui(){return ao().public}function F(n={},f=process.env){let s=new Set;function o(e,i){if(i===null)return e===null;if(Array.isArray(i))return Array.isArray(e)&&(!i.length||e.every((r)=>i.some((u)=>o(r,u))));if(typeof i==="object")return e!==null&&typeof e==="object"&&!Array.isArray(e)&&Object.entries(i).every(([r,u])=>Object.hasOwn(e,r)&&o(e[r],u));return typeof e===typeof i}function g(e,i){if(e&&typeof e==="object"&&!Array.isArray(e)){if(Object.getPrototypeOf(e)!==Object.prototype&&Object.getPrototypeOf(e)!==null)throw TypeError(`Runtime config ${i.join(".")} must contain JSON values`);let t=Object.create(null);for(let[c,l]of Object.entries(e)){if(!/^[a-zA-Z][a-zA-Z0-9_]*$/.test(c)||["constructor","prototype","__proto__"].includes(c))throw TypeError(`Invalid runtime config key: ${c}`);t[c]=g(l,[...i,c])}return Object.freeze(t)}let r=`STX_RUNTIME_${i.map((t)=>t.replace(/([a-z0-9])([A-Z])/g,"$1_$2").toUpperCase()).join("__")}`;if(s.has(r))throw TypeError(`Ambiguous runtime config environment key: ${r}`);s.add(r);let u=f[r],a=e;if(u!==void 0){try{a=typeof e==="string"?u:JSON.parse(u)}catch{throw TypeError(`Invalid runtime config override: ${r}`)}if(!o(a,e))throw TypeError(`Wrong runtime config override type: ${r}`)}function p(t){if(t===null||typeof t==="string"||typeof t==="boolean")return t;if(typeof t==="number"&&Number.isFinite(t))return t;if(Array.isArray(t))return Object.freeze(t.map(p));if(t&&typeof t==="object"&&(Object.getPrototypeOf(t)===Object.prototype||Object.getPrototypeOf(t)===null))return Object.freeze(Object.fromEntries(Object.entries(t).map(([c,l])=>[c,p(l)])));throw TypeError(`Runtime config ${i.join(".")} must contain JSON values`)}return p(a)}return Object.freeze({public:g(n.public??{},["public"]),private:g(n.private??{},["private"])})}function C(n){return`<script data-stx-scoped data-stx-runtime-config type="application/json">${JSON.stringify(n.public).replace(/</g,"\\u003c").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}</script>`}function Gt(n,f){let s=n.replace(/<script\b[^>]*\bdata-stx-runtime-config\b[^>]*>[\s\S]*?<\/script>/gi,""),o=/<head\b[^>]*>/i.exec(s),g=o?o.index+o[0].length:0;return s.slice(0,g)+C(f)+s.slice(g)}
3
- export{Ye,Nn,ao,Ui,F,Gt};
2
+ import{AsyncLocalStorage as R}from"async_hooks";var b=Symbol.for("stx.runtime-config.scope"),y=globalThis,m=y[b]??=new R;function Ye(n,f){return m.run(n,f)}function On(){return m.getStore()}function uo(){let n=m.getStore();if(!n)throw Error("useServerRuntimeConfig requires a server request or template render");return Object.freeze(Object.defineProperty({public:n.public},"private",{value:n.private}))}function Ki(){return uo().public}function z(n={},f=process.env){let s=new Set;function o(e,i){if(i===null)return e===null;if(Array.isArray(i))return Array.isArray(e)&&(!i.length||e.every((r)=>i.some((u)=>o(r,u))));if(typeof i==="object")return e!==null&&typeof e==="object"&&!Array.isArray(e)&&Object.entries(i).every(([r,u])=>Object.hasOwn(e,r)&&o(e[r],u));return typeof e===typeof i}function g(e,i){if(e&&typeof e==="object"&&!Array.isArray(e)){if(Object.getPrototypeOf(e)!==Object.prototype&&Object.getPrototypeOf(e)!==null)throw TypeError(`Runtime config ${i.join(".")} must contain JSON values`);let t=Object.create(null);for(let[c,l]of Object.entries(e)){if(!/^[a-zA-Z][a-zA-Z0-9_]*$/.test(c)||["constructor","prototype","__proto__"].includes(c))throw TypeError(`Invalid runtime config key: ${c}`);t[c]=g(l,[...i,c])}return Object.freeze(t)}let r=`STX_RUNTIME_${i.map((t)=>t.replace(/([a-z0-9])([A-Z])/g,"$1_$2").toUpperCase()).join("__")}`;if(s.has(r))throw TypeError(`Ambiguous runtime config environment key: ${r}`);s.add(r);let u=f[r],a=e;if(u!==void 0){try{a=typeof e==="string"?u:JSON.parse(u)}catch{throw TypeError(`Invalid runtime config override: ${r}`)}if(!o(a,e))throw TypeError(`Wrong runtime config override type: ${r}`)}function p(t){if(t===null||typeof t==="string"||typeof t==="boolean")return t;if(typeof t==="number"&&Number.isFinite(t))return t;if(Array.isArray(t))return Object.freeze(t.map(p));if(t&&typeof t==="object"&&(Object.getPrototypeOf(t)===Object.prototype||Object.getPrototypeOf(t)===null))return Object.freeze(Object.fromEntries(Object.entries(t).map(([c,l])=>[c,p(l)])));throw TypeError(`Runtime config ${i.join(".")} must contain JSON values`)}return p(a)}return Object.freeze({public:g(n.public??{},["public"]),private:g(n.private??{},["private"])})}function C(n){return`<script data-stx-scoped data-stx-runtime-config type="application/json">${JSON.stringify(n.public).replace(/</g,"\\u003c").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}</script>`}function Gt(n,f){let s=n.replace(/<script\b[^>]*\bdata-stx-runtime-config\b[^>]*>[\s\S]*?<\/script>/gi,""),o=/<head\b[^>]*>/i.exec(s),g=o?o.index+o[0].length:0;return s.slice(0,g)+C(f)+s.slice(g)}
3
+ export{Ye,On,uo,Ki,z,Gt};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{j,ll,no,$n,h,qe,Ke}from"./chunk-000mwmfq.js";import{_r,ut,W}from"./chunk-zje94z0k.js";import{gr,i}from"./chunk-znnvq1jp.js";import{Re}from"./chunk-fepezvdq.js";import{sa}from"./chunk-b0jekg4c.js";function y(s){return s.endsWith(".md")||s.endsWith(".markdown")}function C(s){let e=[];m(/<pre\b[^>]*>[\s\S]*?<\/pre>/gi);let r=[...e];m(/<code\b[^>]*>[\s\S]*?<\/code>/gi,r);function m(n,p){let g;while((g=n.exec(s))!==null){let t=g.index,o=t+g[0].length;if(p?.some((l)=>t>=l.start&&o<=l.end))continue;e.push({start:t,end:o})}}if(e.length===0)return s;e.sort((n,p)=>n.start-p.start);let c="",a=0;for(let n of e){if(n.start<a)continue;c+=s.slice(a,n.start),c+=`@raw${s.slice(n.start,n.end)}@endraw`,a=n.end}return c+=s.slice(a),c}async function b(s,e={}){let{data:r,content:m}=_r(s),a=await(e.renderer??((n)=>ut(n)))(m);return{html:C(a),frontmatter:r??{}}}import{dirname as k,resolve as R}from"path";function v(s){let e=s,r=j(s);if(r)e=r.content.trim();let m=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,c=[],a=[],n=[],p=(o)=>/\b(?:state|derived|effect|batch)\s*(?:<[^<>()]*>)?\s*\(/.test(o),g;while((g=m.exec(s))!==null){let o=g[1],l=g[2],d=g[0],u=o.includes("server");if(p(l))n.push(d);else if(u)a.push(l);else c.push(d)}let t=e;{let o=/<script\b(?![^>]*\b(?:client|type\s*=\s*["']module["']|src\s*=))[^>]*>/gi,l,d=[];while((l=o.exec(t))!==null){let u=l.index+l[0].length,f=t.indexOf("</script>",u);if(f===-1)continue;d.push({start:l.index,end:f+9}),o.lastIndex=f+9}for(let u=d.length-1;u>=0;u--)t=t.substring(0,d[u].start)+t.substring(d[u].end)}for(let o of c)t=t.replace(o,"");return{templateContent:t,serverScripts:a,clientScripts:c,signalsScripts:n}}function M(s,e){return`<!DOCTYPE html>
2
+ import{B,ul,oo,Tn,h,qe,Ke}from"./chunk-gz9pknbw.js";import{Cr,ut,q}from"./chunk-p8shtje2.js";import{mr,i}from"./chunk-mt8edb75.js";import{Re}from"./chunk-bqtj62ys.js";import{oa}from"./chunk-hxws025y.js";function y(s){return s.endsWith(".md")||s.endsWith(".markdown")}function C(s){let e=[];m(/<pre\b[^>]*>[\s\S]*?<\/pre>/gi);let r=[...e];m(/<code\b[^>]*>[\s\S]*?<\/code>/gi,r);function m(n,p){let g;while((g=n.exec(s))!==null){let t=g.index,o=t+g[0].length;if(p?.some((l)=>t>=l.start&&o<=l.end))continue;e.push({start:t,end:o})}}if(e.length===0)return s;e.sort((n,p)=>n.start-p.start);let c="",a=0;for(let n of e){if(n.start<a)continue;c+=s.slice(a,n.start),c+=`@raw${s.slice(n.start,n.end)}@endraw`,a=n.end}return c+=s.slice(a),c}async function b(s,e={}){let{data:r,content:m}=Cr(s),a=await(e.renderer??((n)=>ut(n)))(m);return{html:C(a),frontmatter:r??{}}}import{dirname as k,resolve as R}from"path";function v(s){let e=s,r=B(s);if(r)e=r.content.trim();let m=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,c=[],a=[],n=[],p=(o)=>/\b(?:state|derived|effect|batch)\s*(?:<[^<>()]*>)?\s*\(/.test(o),g;while((g=m.exec(s))!==null){let o=g[1],l=g[2],d=g[0],u=o.includes("server");if(p(l))n.push(d);else if(u)a.push(l);else c.push(d)}let t=e;{let o=/<script\b(?![^>]*\b(?:client|type\s*=\s*["']module["']|src\s*=))[^>]*>/gi,l,d=[];while((l=o.exec(t))!==null){let u=l.index+l[0].length,f=t.indexOf("</script>",u);if(f===-1)continue;d.push({start:l.index,end:f+9}),o.lastIndex=f+9}for(let u=d.length-1;u>=0;u--)t=t.substring(0,d[u].start)+t.substring(d[u].end)}for(let o of c)t=t.replace(o,"");return{templateContent:t,serverScripts:a,clientScripts:c,signalsScripts:n}}function M(s,e){return`<!DOCTYPE html>
3
3
  <html lang="en">
4
4
  <head>
5
5
  <meta charset="UTF-8">
@@ -9,8 +9,8 @@ import{j,ll,no,$n,h,qe,Ke}from"./chunk-000mwmfq.js";import{_r,ut,W}from"./chunk-
9
9
  <body>
10
10
  ${s}
11
11
  </body>
12
- </html>`}async function wc(s,e={}){let r=R(s),m=Bun.file(r);if(!await m.exists())throw Error(`Template file not found: ${r}`);let c=await m.text(),a=null;if(y(r)){let n=await b(c,{renderer:e.markdownRenderer});c=n.html,a=n.frontmatter}if(a)e={...e,context:{...a,...e.context||{}}};if(e.layout){let n=R(e.layout),p=Bun.file(n);if(!await p.exists())throw Error(`Layout template not found: ${n}`);let{layout:g,injectCSS:t,...o}=e,l={...e.context||{}};$n(l);let d=await w(c,r,{...o,context:{...l,__stx_defer_server_data:!0},injectCSS:!1}),u=await p.text(),f={...l,content:d},x={...o,context:f,injectCSS:t};return w(u,n,x)}return w(c,r,e)}async function w(s,e,r={}){let{templateContent:m,serverScripts:c,clientScripts:a}=v(s),n={...W,...r.options},p={__filename:e,__dirname:k(e),__stx:{},__stx_options:n,__stx_sfc_mode:!0,__stx_inject_css:r.injectCSS===!0,__stxServeContext:void 0,...no(r.context??{}),definePageMeta:()=>{},...r.context||{}};for(let o of c)await h(o,p,e);let g=new Set,t=m;if(t=await i(t,p,e,n,g),ll(p,r.context),r.templateOnly){if(t=t.replace(/<script data-stx-scoped>[\s\S]*?<\/script>\s*/gi,""),t=t.replace(/<!-- stx SEO Tags -->[\s\S]*?(?=<)/i,""),a.length>0)t+=`
12
+ </html>`}async function vc(s,e={}){let r=R(s),m=Bun.file(r);if(!await m.exists())throw Error(`Template file not found: ${r}`);let c=await m.text(),a=null;if(y(r)){let n=await b(c,{renderer:e.markdownRenderer});c=n.html,a=n.frontmatter}if(a)e={...e,context:{...a,...e.context||{}}};if(e.layout){let n=R(e.layout),p=Bun.file(n);if(!await p.exists())throw Error(`Layout template not found: ${n}`);let{layout:g,injectCSS:t,...o}=e,l={...e.context||{}};Tn(l);let d=await w(c,r,{...o,context:{...l,__stx_defer_server_data:!0},injectCSS:!1}),u=await p.text(),f={...l,content:d},x={...o,context:f,injectCSS:t};return w(u,n,x)}return w(c,r,e)}async function w(s,e,r={}){let{templateContent:m,serverScripts:c,clientScripts:a}=v(s),n={...q,...r.options},p={__filename:e,__dirname:k(e),__stx:{},__stx_options:n,__stx_sfc_mode:!0,__stx_inject_css:r.injectCSS===!0,__stxServeContext:void 0,...oo(r.context??{}),definePageMeta:()=>{},...r.context||{}};for(let o of c)await h(o,p,e);let g=new Set,t=m;if(t=await i(t,p,e,n,g),ul(p,r.context),r.templateOnly){if(t=t.replace(/<script data-stx-scoped>[\s\S]*?<\/script>\s*/gi,""),t=t.replace(/<!-- stx SEO Tags -->[\s\S]*?(?=<)/i,""),a.length>0)t+=`
13
13
  ${a.join(`
14
- `)}`}else{if(r.processClientScripts!==!1&&a.length>0){let o=p.__stx_event_bindings||[],l=qe(p),d=await Promise.all(a.map(async(x)=>{let _=x.match(/<script\b([^>]*)>/i)?.[1]||"";if(/\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/i.test(_))return x;let S=x.match(/<script\b[^>]*>([\s\S]*?)<\/script>/);if(!S)return x;return await Ke(S[1],{eventBindings:o,templateContent:t,serverData:l,filePath:e})})),f=[await gr(d,{...n,buildMode:"compile"}),...d].filter(Boolean).join(`
15
- `);t=sa(t,f)}t=await Re(t)}if(r.wrapInDocument){if(!t.trim().toLowerCase().startsWith("<!doctype")&&!t.trim().toLowerCase().startsWith("<html"))t=M(t,r.title)}if(r.injectCSS)try{let{injectCss:o}=await import("./chunk-gqvnz8a7.js");t=await o(t)}catch{}return t}
16
- export{wc};
14
+ `)}`}else{if(r.processClientScripts!==!1&&a.length>0){let o=p.__stx_event_bindings||[],l=qe(p),d=await Promise.all(a.map(async(x)=>{let _=x.match(/<script\b([^>]*)>/i)?.[1]||"";if(/\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/i.test(_))return x;let S=x.match(/<script\b[^>]*>([\s\S]*?)<\/script>/);if(!S)return x;return await Ke(S[1],{eventBindings:o,templateContent:t,serverData:l,filePath:e})})),f=[await mr(d,{...n,buildMode:"compile"}),...d].filter(Boolean).join(`
15
+ `);t=oa(t,f)}t=await Re(t)}if(r.wrapInDocument){if(!t.trim().toLowerCase().startsWith("<!doctype")&&!t.trim().toLowerCase().startsWith("<html"))t=M(t,r.title)}if(r.injectCSS)try{let{injectCss:o}=await import("./chunk-asnd03sr.js");t=await o(t)}catch{}return t}
16
+ export{vc};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{eh,th,nh,rh,sh,oh,ih}from"./chunk-r5ecgcx2.js";export{th as createKeepAliveCache,rh as generateKeepAliveCSS,sh as generateKeepAliveRuntime,oh as onActivated,ih as onDeactivated,eh as processKeepAliveDirectives,nh as shouldCacheComponent};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{xo,Qt,Yl,rm}from"./chunk-0ncafcs2.js";export{xo as generateServiceWorker,rm as generateServiceWorkerAuto,Qt as getServiceWorkerFileName,Yl as isWorkboxEnabled};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Qi,Ny,My,Ml,Qe,Yg,yo,Dy,Ly,jy,By,Fy,zy,Hy,Vy,Uy}from"./chunk-3dqfjpz4.js";import"./chunk-2a5g80mq.js";export{zy as applyHead,Dy as definePageMeta,Qi as getHead,Ny as getPageMeta,Qe as mergeHeadConfigs,Hy as processHeadDirective,Uy as processMetaDirective,Vy as processTitleDirective,Fy as renderBodyAttrs,jy as renderHead,By as renderHtmlAttrs,My as resetHead,yo as seoMetaToHeadConfig,Ml as useHead,Ly as usePageTitle,Yg as useSeoMeta,Ly as useTitle};