@stacksjs/stx 0.2.887 → 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 (242) 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-69ezjc8k.js → chunk-0ncafcs2.js} +4 -4
  5. package/dist/chunk-0rpj5t80.js +2 -0
  6. package/dist/{chunk-sc1gmts0.js → chunk-1gyxxfdf.js} +2 -2
  7. package/dist/{chunk-aaea157p.js → chunk-1knk403z.js} +2 -2
  8. package/dist/{chunk-q74affc4.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-3dqfjpz4.js +68 -0
  17. package/dist/{chunk-zpj6ggee.js → chunk-3hsv6ejp.js} +4 -4
  18. package/dist/{chunk-8e1cv1hh.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-azf6tdq6.js → chunk-446tb2th.js} +28 -28
  22. package/dist/{chunk-4251fy7d.js → chunk-48rwqchc.js} +11 -11
  23. package/dist/chunk-4akw3bym.js +2 -0
  24. package/dist/{chunk-twmkz0xs.js → chunk-4kmg6g5n.js} +9 -9
  25. package/dist/chunk-4rvfeee5.js +2 -0
  26. package/dist/{chunk-4n45qa0b.js → chunk-51720m79.js} +5 -5
  27. package/dist/chunk-53kcqdjj.js +2 -0
  28. package/dist/{chunk-02qmvcmv.js → chunk-55tc5w32.js} +3 -3
  29. package/dist/{chunk-0mx7rg07.js → chunk-58qzyyyv.js} +3 -3
  30. package/dist/chunk-5aa83bpm.js +2 -0
  31. package/dist/{chunk-d2pexm3z.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-km14pdrt.js → chunk-6kyqejnq.js} +22 -22
  36. package/dist/{chunk-32twt3wx.js → chunk-6pdy7ajr.js} +3 -3
  37. package/dist/{chunk-fg67643b.js → chunk-6pz5gq6v.js} +9 -9
  38. package/dist/{chunk-rsxxajv6.js → chunk-700m927w.js} +2 -2
  39. package/dist/{chunk-gvd8nb8z.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-88tshy2f.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-2v7v6jcs.js → chunk-87g5xmmr.js} +12 -12
  47. package/dist/{chunk-sv7fdqmc.js → chunk-8hwfdwgn.js} +6 -6
  48. package/dist/chunk-8ygf6jnt.js +2 -0
  49. package/dist/{chunk-0rdh8bw3.js → chunk-95sd8h5g.js} +7 -7
  50. package/dist/{chunk-50cnypys.js → chunk-967ydrq4.js} +6 -6
  51. package/dist/chunk-9afkttvz.js +2 -0
  52. package/dist/{chunk-7wqz32ay.js → chunk-9d91h636.js} +2 -2
  53. package/dist/{chunk-kwf3kfr0.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-zj5eq4b6.js → chunk-b15c4g3e.js} +5 -5
  61. package/dist/{chunk-czcx3nbx.js → chunk-b6bf0t02.js} +6 -6
  62. package/dist/chunk-b7jj45bz.js +2 -0
  63. package/dist/{chunk-ybjgnnyf.js → chunk-bgfs3mbg.js} +5 -5
  64. package/dist/{chunk-f2twg7ze.js → chunk-bqtj62ys.js} +8 -8
  65. package/dist/{chunk-a0q0kb0s.js → chunk-bw2m1e7g.js} +5 -5
  66. package/dist/chunk-bwx6w87c.js +2 -0
  67. package/dist/{chunk-ef9m5fjb.js → chunk-cgfjrgfw.js} +14 -14
  68. package/dist/{chunk-463weehv.js → chunk-ch9028z3.js} +1 -1
  69. package/dist/{chunk-57q4nvs9.js → chunk-cmg9x1ka.js} +3 -3
  70. package/dist/{chunk-9f31gs4m.js → chunk-cz1sdes5.js} +2 -2
  71. package/dist/{chunk-satrf398.js → chunk-dvjv4c3a.js} +1 -1
  72. package/dist/{chunk-dz7amds0.js → chunk-dymck524.js} +5 -5
  73. package/dist/chunk-dzqfv801.js +3 -0
  74. package/dist/{chunk-agd2b928.js → chunk-eceeqy74.js} +4 -4
  75. package/dist/{chunk-c47stwqj.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-6mfpns00.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-pgrm1vet.js → chunk-hgf7bc50.js} +7 -7
  85. package/dist/chunk-hjb4c8g2.js +2 -0
  86. package/dist/chunk-hk241gt2.js +2 -0
  87. package/dist/{chunk-yasdj4ve.js → chunk-hm9d40yf.js} +2 -2
  88. package/dist/{chunk-6df3j3qq.js → chunk-hpzje67q.js} +2 -2
  89. package/dist/{chunk-qt39mb2a.js → chunk-htx5yezj.js} +2 -2
  90. package/dist/{chunk-xpbakn6t.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-xcsgpf83.js → chunk-kj43fbzm.js} +1 -1
  97. package/dist/{chunk-59er0fc7.js → chunk-kk2p2tgv.js} +3 -3
  98. package/dist/{chunk-dwyhpbpx.js → chunk-ksmn19qw.js} +2 -2
  99. package/dist/{chunk-16aqrwmk.js → chunk-kx09v9ya.js} +7 -7
  100. package/dist/{chunk-3bfheqe3.js → chunk-m95sygv4.js} +3 -3
  101. package/dist/{chunk-nzpzyz22.js → chunk-mctzpw0w.js} +1 -1
  102. package/dist/{chunk-y6eaqs8v.js → chunk-me4yq8c2.js} +3 -3
  103. package/dist/{chunk-n22xtagg.js → chunk-mgh5rst1.js} +2 -2
  104. package/dist/{chunk-zch65qrd.js → chunk-mhxg6j6s.js} +1 -1
  105. package/dist/{chunk-pc8dt8xs.js → chunk-mjp1z9kz.js} +1 -1
  106. package/dist/{chunk-gtv9jd68.js → chunk-mt8edb75.js} +49 -49
  107. package/dist/chunk-mvavjydq.js +2 -0
  108. package/dist/{chunk-e362e615.js → chunk-mw7hacm3.js} +30 -30
  109. package/dist/{chunk-cv4bfhn1.js → chunk-nbdscgvj.js} +6 -6
  110. package/dist/{chunk-qx1nbryq.js → chunk-njpva3zq.js} +2 -2
  111. package/dist/{chunk-6qpe4f8e.js → chunk-nkyff7v6.js} +11 -11
  112. package/dist/{chunk-mxvgft6p.js → chunk-p8shtje2.js} +32 -32
  113. package/dist/{chunk-cb0c6959.js → chunk-pctf14yw.js} +1 -1
  114. package/dist/{chunk-3cq4a4x7.js → chunk-pjj54ddk.js} +3 -3
  115. package/dist/{chunk-pdprhg5k.js → chunk-pnmafbv5.js} +1 -1
  116. package/dist/{chunk-kee5a3ce.js → chunk-pz554g43.js} +3 -3
  117. package/dist/{chunk-h63ma36g.js → chunk-q0y8gv18.js} +2 -2
  118. package/dist/{chunk-ws2h92mm.js → chunk-q9tc9rdv.js} +2 -2
  119. package/dist/chunk-qqng9545.js +2 -0
  120. package/dist/{chunk-8va3fs07.js → chunk-r5ecgcx2.js} +5 -5
  121. package/dist/{chunk-q1mb0fbt.js → chunk-ranjkpc8.js} +2 -2
  122. package/dist/{chunk-ssg6ne5b.js → chunk-rb2zbdqd.js} +4 -4
  123. package/dist/{chunk-e41pgmgk.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-q3epnfp4.js → chunk-s0mf56y1.js} +5 -5
  128. package/dist/{chunk-kaem8q20.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-rv0a3stz.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-2r0nrvqe.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-sfyyn0mg.js → chunk-vc432a0w.js} +9 -9
  142. package/dist/{chunk-a7ryj8z8.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-ezna4dhj.js → chunk-x5bn2svk.js} +2 -2
  147. package/dist/chunk-x6565mhk.js +2 -0
  148. package/dist/{chunk-gbncp2gp.js → chunk-xvncq3m5.js} +2 -2
  149. package/dist/chunk-xwgdcc7w.js +2 -0
  150. package/dist/{chunk-ram5944w.js → chunk-xy8smv5e.js} +2 -2
  151. package/dist/{chunk-yp4tn4zn.js → chunk-y1d3j2j7.js} +4 -4
  152. package/dist/chunk-yjwa7ktk.js +2 -0
  153. package/dist/{chunk-94ctmp0j.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-shcnt6aa.js → chunk-zf68afyh.js} +3 -3
  158. package/dist/chunk-zhywjwdr.js +2 -0
  159. package/dist/{chunk-g2xy0z0e.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 +126 -308
  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 +7 -7
  172. package/dist/utils.js +20 -109
  173. package/package.json +5 -5
  174. package/dist/chunk-08cb7cyw.js +0 -2
  175. package/dist/chunk-0gkxqcpj.js +0 -2
  176. package/dist/chunk-0h1dyd38.js +0 -2
  177. package/dist/chunk-0sew66hf.js +0 -2
  178. package/dist/chunk-13dgqekj.js +0 -2
  179. package/dist/chunk-15n20xwe.js +0 -2
  180. package/dist/chunk-1ta1pj1t.js +0 -2
  181. package/dist/chunk-1z3r2jjp.js +0 -2
  182. package/dist/chunk-1z6rrqvm.js +0 -2
  183. package/dist/chunk-295bykzd.js +0 -61
  184. package/dist/chunk-41353gyc.js +0 -2
  185. package/dist/chunk-4j50hrgq.js +0 -20
  186. package/dist/chunk-4pjqj54a.js +0 -2
  187. package/dist/chunk-53cc06w7.js +0 -2
  188. package/dist/chunk-5m02cbxg.js +0 -2
  189. package/dist/chunk-5rd0an89.js +0 -2
  190. package/dist/chunk-5s0w910j.js +0 -2
  191. package/dist/chunk-6fy11vfb.js +0 -2
  192. package/dist/chunk-6mjk28s3.js +0 -2
  193. package/dist/chunk-8h5nje66.js +0 -2
  194. package/dist/chunk-97kgrevs.js +0 -4
  195. package/dist/chunk-9h3qq2d2.js +0 -2
  196. package/dist/chunk-9kza7gxd.js +0 -2
  197. package/dist/chunk-a02gt4tz.js +0 -1199
  198. package/dist/chunk-a30zpnqp.js +0 -2
  199. package/dist/chunk-aq0fz4mr.js +0 -2
  200. package/dist/chunk-aqxh80vh.js +0 -2
  201. package/dist/chunk-axra1yas.js +0 -2
  202. package/dist/chunk-b2vhsyf9.js +0 -2
  203. package/dist/chunk-c42b1y7z.js +0 -2
  204. package/dist/chunk-c89wryyz.js +0 -2
  205. package/dist/chunk-cev5z6gj.js +0 -2
  206. package/dist/chunk-ch57kgb6.js +0 -2
  207. package/dist/chunk-cv1vm1w0.js +0 -2
  208. package/dist/chunk-d7b30bg6.js +0 -2
  209. package/dist/chunk-f3j1h3ch.js +0 -2
  210. package/dist/chunk-fz4c5e9m.js +0 -2
  211. package/dist/chunk-gd04nvj3.js +0 -2
  212. package/dist/chunk-gmp10259.js +0 -2
  213. package/dist/chunk-gr956aar.js +0 -2
  214. package/dist/chunk-h3fv0q25.js +0 -2
  215. package/dist/chunk-jghpzx5m.js +0 -2
  216. package/dist/chunk-kcqfrw10.js +0 -2
  217. package/dist/chunk-kfzvtzsz.js +0 -2
  218. package/dist/chunk-kqgspa3s.js +0 -2
  219. package/dist/chunk-mast9wb2.js +0 -2
  220. package/dist/chunk-mqy1wz09.js +0 -3
  221. package/dist/chunk-mv21mc9p.js +0 -2
  222. package/dist/chunk-n9bw9bsn.js +0 -2
  223. package/dist/chunk-ngzyzcrp.js +0 -2
  224. package/dist/chunk-nnqyn7db.js +0 -2
  225. package/dist/chunk-p5qac909.js +0 -2
  226. package/dist/chunk-p6hcrg3r.js +0 -3
  227. package/dist/chunk-pa2vt2ej.js +0 -2
  228. package/dist/chunk-pa6kgbmw.js +0 -2
  229. package/dist/chunk-pd089tq0.js +0 -2
  230. package/dist/chunk-pjjrx9pk.js +0 -2
  231. package/dist/chunk-pt3rp3zg.js +0 -2
  232. package/dist/chunk-qg1kw5yf.js +0 -2
  233. package/dist/chunk-s7xywsqd.js +0 -3
  234. package/dist/chunk-t8r40wgf.js +0 -2
  235. package/dist/chunk-w5zzwe2f.js +0 -2
  236. package/dist/chunk-wjafpvjv.js +0 -2
  237. package/dist/chunk-x44f0eq1.js +0 -2
  238. package/dist/chunk-xhr35ctb.js +0 -2
  239. package/dist/chunk-xk15vzb6.js +0 -2
  240. package/dist/chunk-xmmr0916.js +0 -2
  241. package/dist/chunk-ywnqjqns.js +0 -2
  242. package/dist/chunk-z7k1xn6k.js +0 -2
@@ -1,7 +1,7 @@
1
1
  // @bun
2
- import{Dn}from"./chunk-295bykzd.js";import{j,Q,w,Wt,qt,Lr,h,Cl,Fi,Y,O}from"./chunk-a02gt4tz.js";import{fn}from"./chunk-gvd8nb8z.js";import{r}from"./chunk-mqy1wz09.js";import{te}from"./chunk-ws2h92mm.js";import{D,c}from"./chunk-xpbakn6t.js";var X=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function J(t){let s=[],e=/<!--[\s\S]*?(?:-->|$)|<(script|style|textarea|title|template)\b[^>]*>[\s\S]*?<\/\1\s*>/gi,n;while((n=e.exec(t))!==null)s.push({start:n.index,end:n.index+n[0].length});return s}function F(t,s){return s.some((e)=>t>=e.start&&t<e.end)}function K(t){let s=(t||"").trim();if(!s)return null;if(/[\s>+~,:]/.test(s))return null;let e={},n=s,i=n.match(/^[a-z][\w-]*/i);if(i)e.tag=i[0].toLowerCase(),n=n.slice(i[0].length);while(n.length>0){let o=n.match(/^\[([\w-]+)(?:=(["']?)([^\]"']*)\2)?\]/);if(o){if(e.attr=o[1],o[3]!==void 0&&o[3]!=="")e.attrValue=o[3];n=n.slice(o[0].length);continue}let l=n.match(/^#([\w-]+)/);if(l){e.id=l[1],n=n.slice(l[0].length);continue}let a=n.match(/^\.([\w-]+)/);if(a){e.className=a[1],n=n.slice(a[0].length);continue}return null}if(!e.tag&&!e.attr&&!e.id&&!e.className)return null;return e}function Z(t,s){if(s.attr){if(!(s.attrValue===void 0?new RegExp(`\\b${s.attr}(?=[\\s=>/]|$)`,"i"):new RegExp(`\\b${s.attr}\\s*=\\s*(["'])\\s*${s.attrValue}\\s*\\1`,"i")).test(t))return!1}if(s.id){if(!new RegExp(`\\bid\\s*=\\s*(["'])\\s*${s.id}\\s*\\1`,"i").test(t))return!1}if(s.className){let e=t.match(/\bclass\s*=\s*(["'])([\s\S]*?)\1/i);if(!e)return!1;if(!e[2].split(/\s+/).includes(s.className))return!1}return!0}function P(t,s="main"){let e=K(s);if(!e)return null;let n=/<([a-z][\w-]*)\b([^>]*)>/gi,i=J(t),o;while((o=n.exec(t))!==null){if(F(o.index,i))continue;let l=o[1].toLowerCase(),a=o[2]||"";if(a.trimEnd().endsWith("/")||X.has(l))continue;if(e.tag&&e.tag!==l)continue;if(!Z(a,e))continue;let u=o[0],g=o.index+u.length,f=new RegExp(`<(/?)${l}\\b([^>]*)>`,"gi");f.lastIndex=g;let d=1,x;while((x=f.exec(t))!==null){if(F(x.index,i))continue;let y=x[1]==="/";if(!y&&(x[2]||"").trimEnd().endsWith("/"))continue;if(d+=y?-1:1,d===0)return{openTag:u,openIndex:o.index,start:g,end:x.index,tagName:l}}return null}return null}var Ct="private, no-store";function an(t){return t.replace(/&#(\d+);/g,(s,e)=>L(Number(e),s)).replace(/&#x([0-9a-f]+);/gi,(s,e)=>L(Number.parseInt(e,16),s)).replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&apos;/g,"'").replace(/&amp;/g,"&")}function L(t,s){if(!Number.isInteger(t)||t<0||t>1114111)return s;try{return String.fromCodePoint(t)}catch{return s}}function Le(t){return t.headers.get("X-STX-Router")==="true"}function tt(t,s){if(!t)return s;return t.split(",").some((n)=>n.trim().toLowerCase()===s.toLowerCase())?t:`${t}, ${s}`}function V(t){return{Vary:tt(t,"X-STX-Router")}}function E(t){return t.replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function H(t){let s=/<head\b[^>]*>([\s\S]*?)<\/head\s*>/i.exec(t)?.[1]??"",e=/<(meta|link)\b(?:[^>"']|"[^"]*"|'[^']*')*>|<title\b[^>]*>[\s\S]*?<\/title\s*>/giy;return w(s,(n,i)=>(e.lastIndex=i,e.exec(n)?e.lastIndex:-1)).map(({token:n})=>n)}function B(t){let s=Object.create(null),e=t.replace(/^<\w+\b|>$/g,"");for(let n of e.matchAll(/([^\s=/>]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'=<>`]+)))?/g)){let i=n[1].toLowerCase();if(!(i in s))s[i]=n[2]??n[3]??n[4]??""}return s}function Vn(t){let s=[];for(let e of H(t)){if(/^<title\b/i.test(e)){s.push(`<title>${E(e.replace(/^<title\b[^>]*>|<\/title\s*>$/gi,""))}</title>`);continue}let n=B(e);if(/^<meta\b/i.test(e)){let i=n.property?"property":"name",o=an(n[i]??"").toLowerCase();if(o==="description"||/^(?:og|twitter):[\w:]+$/.test(o))s.push(`<meta ${i}="${r(o)}" content="${E(n.content??"")}">`)}else{let i=an(n.rel??"").toLowerCase();if(i==="canonical"||i==="alternate"&&n.hreflang)s.push(`<link rel="${i}" href="${E(n.href??"")}"${i==="alternate"?` hreflang="${E(n.hreflang)}"`:""}>`)}}return`<template data-stx-page-head="1">${s.join("")}</template>
3
- `}var et=["media","crossorigin","integrity"];function Un(t){let s=[];for(let e of H(t)){if(!/^<link\b/i.test(e))continue;let n=B(e);if(an(n.rel??"").trim().toLowerCase()!=="stylesheet")continue;if(!n.href||"data-css"in n||"disabled"in n)continue;let i=et.filter((o)=>(o in n)).map((o)=>` ${o}="${E(n[o])}"`).join("");s.push(`<link rel="stylesheet" href="${E(n.href)}"${i}>`)}return s.length?`<template data-stx-page-css="1">${s.join("")}</template>
4
- `:""}import T from"path";var st="stx-page-head:",it=/<!--stx-page-head:([A-Za-z0-9+/=]+)-->\n?/,_={dev:null,prod:null};function ot(){let t=te()?"dev":"prod",s=_[t];if(s!==null)return s;try{let e=import.meta.require("./chunk-1z6rrqvm.js"),n=t==="dev"&&typeof e.getRouterScriptDev==="function"?e.getRouterScriptDev:e.getRouterScript;_[t]=`<script>${n()}</script>`}catch{_[t]=""}return _[t]}async function Aa(t,s){if(s===!1)return null;if(s&&typeof s==="string"){let n=T.resolve(t,s);if(await Bun.file(n).exists())return n;return null}let e=T.join(t,"app.stx");if(await Bun.file(e).exists())return e;return null}async function Oo(t,s){try{let e=await Bun.file(t).text(),n=e,i=j(e);if(i)n=i.content.trim();let o=fn(e),l=[...o.client.map((p)=>p.fullTag),...o.signals.map((p)=>p.fullTag)],a=[],u=/<style\b[^>]*>([\s\S]*?)<\/style>/gi,g;while((g=u.exec(e))!==null)a.push(g[0]);let f=n;for(let p of o.server)f=f.replace(p.fullTag,"");for(let p of o.client)f=f.replace(p.fullTag,"");f=f.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let d="<!--__STX_PAGE_SLOT__-->";if(f=f.replace(/<slot\s*\/>/gi,d).replace(/<slot\s*>\s*<\/slot>/gi,d),!f.includes(d))return console.warn(`[stx] Shell ${t} has no <slot /> \u2014 pages won't be injected`),null;let{processDirectives:x,extractVariables:y,defaultConfig:R,loadStxConfig:b}=await import("./chunk-5m02cbxg.js"),k=await b(),m={__filename:t,__dirname:T.dirname(t)};for(let p of l){let A=p.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i);if(A&&!p.includes("client")&&!p.includes('type="module"'))await y(A[1],m,t)}let S=await x(f,m,t,{...R,...k,...s},new Set),C=S.indexOf(d);if(C===-1)return console.warn("[stx] Shell slot placeholder lost during processing"),null;return{beforeSlot:S.substring(0,C),afterSlot:S.substring(C+d.length),filePath:t,shellScripts:l,shellStyles:a}}catch(e){return console.error(`[stx] Error processing shell ${t}:`,e),null}}function is(t,s,e){let n,i="",o=s.match(it);if(o){s=s.replace(o[0],"");try{let f=Buffer.from(o[1],"base64").toString("utf8"),d=f.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(d)n=d[1].trim();i=f.replace(/<title[^>]*>[\s\S]*?<\/title>/i,"").trim()}catch{}}let l=e||n||"stx App",a=ot(),u="<script>window.__stxRouterConfig={container:'[data-stx-content]'};</script>";return`<!DOCTYPE html>
2
+ import{Ln}from"./chunk-3dqfjpz4.js";import{B,Q,w,Wt,qt,jr,h,Tl,Vi,Y,N}from"./chunk-gz9pknbw.js";import{pn}from"./chunk-7212fwzz.js";import{r}from"./chunk-b0e7dgv8.js";import{te}from"./chunk-q9tc9rdv.js";import{L,c}from"./chunk-hxws025y.js";var X=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function J(t){let s=[],e=/<!--[\s\S]*?(?:-->|$)|<(script|style|textarea|title|template)\b[^>]*>[\s\S]*?<\/\1\s*>/gi,n;while((n=e.exec(t))!==null)s.push({start:n.index,end:n.index+n[0].length});return s}function I(t,s){return s.some((e)=>t>=e.start&&t<e.end)}function K(t){let s=(t||"").trim();if(!s)return null;if(/[\s>+~,:]/.test(s))return null;let e={},n=s,i=n.match(/^[a-z][\w-]*/i);if(i)e.tag=i[0].toLowerCase(),n=n.slice(i[0].length);while(n.length>0){let o=n.match(/^\[([\w-]+)(?:=(["']?)([^\]"']*)\2)?\]/);if(o){if(e.attr=o[1],o[3]!==void 0&&o[3]!=="")e.attrValue=o[3];n=n.slice(o[0].length);continue}let l=n.match(/^#([\w-]+)/);if(l){e.id=l[1],n=n.slice(l[0].length);continue}let a=n.match(/^\.([\w-]+)/);if(a){e.className=a[1],n=n.slice(a[0].length);continue}return null}if(!e.tag&&!e.attr&&!e.id&&!e.className)return null;return e}function Z(t,s){if(s.attr){if(!(s.attrValue===void 0?new RegExp(`\\b${s.attr}(?=[\\s=>/]|$)`,"i"):new RegExp(`\\b${s.attr}\\s*=\\s*(["'])\\s*${s.attrValue}\\s*\\1`,"i")).test(t))return!1}if(s.id){if(!new RegExp(`\\bid\\s*=\\s*(["'])\\s*${s.id}\\s*\\1`,"i").test(t))return!1}if(s.className){let e=t.match(/\bclass\s*=\s*(["'])([\s\S]*?)\1/i);if(!e)return!1;if(!e[2].split(/\s+/).includes(s.className))return!1}return!0}function P(t,s="main"){let e=K(s);if(!e)return null;let n=/<([a-z][\w-]*)\b([^>]*)>/gi,i=J(t),o;while((o=n.exec(t))!==null){if(I(o.index,i))continue;let l=o[1].toLowerCase(),a=o[2]||"";if(a.trimEnd().endsWith("/")||X.has(l))continue;if(e.tag&&e.tag!==l)continue;if(!Z(a,e))continue;let u=o[0],g=o.index+u.length,f=new RegExp(`<(/?)${l}\\b([^>]*)>`,"gi");f.lastIndex=g;let d=1,x;while((x=f.exec(t))!==null){if(I(x.index,i))continue;let y=x[1]==="/";if(!y&&(x[2]||"").trimEnd().endsWith("/"))continue;if(d+=y?-1:1,d===0)return{openTag:u,openIndex:o.index,start:g,end:x.index,tagName:l}}return null}return null}var Ct="private, no-store";function on(t){return t.replace(/&#(\d+);/g,(s,e)=>F(Number(e),s)).replace(/&#x([0-9a-f]+);/gi,(s,e)=>F(Number.parseInt(e,16),s)).replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&apos;/g,"'").replace(/&amp;/g,"&")}function F(t,s){if(!Number.isInteger(t)||t<0||t>1114111)return s;try{return String.fromCodePoint(t)}catch{return s}}function Le(t){return t.headers.get("X-STX-Router")==="true"}function tt(t,s){if(!t)return s;return t.split(",").some((n)=>n.trim().toLowerCase()===s.toLowerCase())?t:`${t}, ${s}`}function U(t){return{Vary:tt(t,"X-STX-Router")}}function E(t){return t.replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function D(t){let s=/<head\b[^>]*>([\s\S]*?)<\/head\s*>/i.exec(t)?.[1]??"",e=/<(meta|link)\b(?:[^>"']|"[^"]*"|'[^']*')*>|<title\b[^>]*>[\s\S]*?<\/title\s*>/giy;return w(s,(n,i)=>(e.lastIndex=i,e.exec(n)?e.lastIndex:-1)).map(({token:n})=>n)}function H(t){let s=Object.create(null),e=t.replace(/^<\w+\b|>$/g,"");for(let n of e.matchAll(/([^\s=/>]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'=<>`]+)))?/g)){let i=n[1].toLowerCase();if(!(i in s))s[i]=n[2]??n[3]??n[4]??""}return s}function Un(t){let s=[];for(let e of D(t)){if(/^<title\b/i.test(e)){s.push(`<title>${E(e.replace(/^<title\b[^>]*>|<\/title\s*>$/gi,""))}</title>`);continue}let n=H(e);if(/^<meta\b/i.test(e)){let i=n.property?"property":"name",o=on(n[i]??"").toLowerCase();if(o==="description"||/^(?:og|twitter):[\w:]+$/.test(o))s.push(`<meta ${i}="${r(o)}" content="${E(n.content??"")}">`)}else{let i=on(n.rel??"").toLowerCase();if(i==="canonical"||i==="alternate"&&n.hreflang)s.push(`<link rel="${i}" href="${E(n.href??"")}"${i==="alternate"?` hreflang="${E(n.hreflang)}"`:""}>`)}}return`<template data-stx-page-head="1">${s.join("")}</template>
3
+ `}var et=["media","crossorigin","integrity"];function Wn(t){let s=[];for(let e of D(t)){if(!/^<link\b/i.test(e))continue;let n=H(e);if(on(n.rel??"").trim().toLowerCase()!=="stylesheet")continue;if(!n.href||"data-css"in n||"disabled"in n)continue;let i=et.filter((o)=>(o in n)).map((o)=>` ${o}="${E(n[o])}"`).join("");s.push(`<link rel="stylesheet" href="${E(n.href)}"${i}>`)}return s.length?`<template data-stx-page-css="1">${s.join("")}</template>
4
+ `:""}import T from"path";var st="stx-page-head:",it=/<!--stx-page-head:([A-Za-z0-9+/=]+)-->\n?/,_={dev:null,prod:null};function ot(){let t=te()?"dev":"prod",s=_[t];if(s!==null)return s;try{let e=import.meta.require("./chunk-3yjyjq0m.js"),n=t==="dev"&&typeof e.getRouterScriptDev==="function"?e.getRouterScriptDev:e.getRouterScript;_[t]=`<script>${n()}</script>`}catch{_[t]=""}return _[t]}async function Ia(t,s){if(s===!1)return null;if(s&&typeof s==="string"){let n=T.resolve(t,s);if(await Bun.file(n).exists())return n;return null}let e=T.join(t,"app.stx");if(await Bun.file(e).exists())return e;return null}async function Do(t,s){try{let e=await Bun.file(t).text(),n=e,i=B(e);if(i)n=i.content.trim();let o=pn(e),l=[...o.client.map((p)=>p.fullTag),...o.signals.map((p)=>p.fullTag)],a=[],u=/<style\b[^>]*>([\s\S]*?)<\/style>/gi,g;while((g=u.exec(e))!==null)a.push(g[0]);let f=n;for(let p of o.server)f=f.replace(p.fullTag,"");for(let p of o.client)f=f.replace(p.fullTag,"");f=f.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let d="<!--__STX_PAGE_SLOT__-->";if(f=f.replace(/<slot\s*\/>/gi,d).replace(/<slot\s*>\s*<\/slot>/gi,d),!f.includes(d))return console.warn(`[stx] Shell ${t} has no <slot /> \u2014 pages won't be injected`),null;let{processDirectives:x,extractVariables:y,defaultConfig:R,loadStxConfig:b}=await import("./chunk-s9b809n2.js"),k=await b(),m={__filename:t,__dirname:T.dirname(t)};for(let p of l){let A=p.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i);if(A&&!p.includes("client")&&!p.includes('type="module"'))await y(A[1],m,t)}let S=await x(f,m,t,{...R,...k,...s},new Set),C=S.indexOf(d);if(C===-1)return console.warn("[stx] Shell slot placeholder lost during processing"),null;return{beforeSlot:S.substring(0,C),afterSlot:S.substring(C+d.length),filePath:t,shellScripts:l,shellStyles:a}}catch(e){return console.error(`[stx] Error processing shell ${t}:`,e),null}}function ls(t,s,e){let n,i="",o=s.match(it);if(o){s=s.replace(o[0],"");try{let f=Buffer.from(o[1],"base64").toString("utf8"),d=f.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(d)n=d[1].trim();i=f.replace(/<title[^>]*>[\s\S]*?<\/title>/i,"").trim()}catch{}}let l=e||n||"stx App",a=ot(),u="<script>window.__stxRouterConfig={container:'[data-stx-content]'};</script>";return`<!DOCTYPE html>
5
5
  <html lang="en">
6
6
  <head>
7
7
  <meta charset="UTF-8">
@@ -20,14 +20,14 @@ ${t.shellScripts.filter((f)=>!f.includes("server")).join(`
20
20
  ${u}
21
21
  ${a}
22
22
  </body>
23
- </html>`}function nt(t,s={}){let e=t.trim();if(!Dn(e))return t;let n=[],i=e.match(/<head\b[^>]*>([\s\S]*?)<\/head>/i);if(i){let u=i[1],g=/<style\b[^>]*>[\s\S]*?<\/style>/gi,f;while((f=g.exec(u))!==null)n.push(f[0]);let d=u.match(/<script\b[^>]*data-stx-server-data[^>]*>[\s\S]*?<\/script>/i);if(d)n.push(d[0]);let x=u.match(/<script\b[^>]*data-stx-runtime-config[^>]*>[\s\S]*?<\/script>/i);if(x)n.push(x[0])}if(s.preserveHead&&i){let u=[],g=/<title\b[^>]*>[\s\S]*?<\/title>|<meta\b[^>]*>|<link\b[^>]*>/gi,f;while((f=g.exec(i[1]))!==null){if(/<meta\b[^>]*(?:\bcharset|name="viewport")/i.test(f[0]))continue;u.push(f[0])}if(u.length>0)n.unshift(`<!--${st}${Buffer.from(u.join(`
23
+ </html>`}function nt(t,s={}){let e=t.trim();if(!Ln(e))return t;let n=[],i=e.match(/<head\b[^>]*>([\s\S]*?)<\/head>/i);if(i){let u=i[1],g=/<style\b[^>]*>[\s\S]*?<\/style>/gi,f;while((f=g.exec(u))!==null)n.push(f[0]);let d=u.match(/<script\b[^>]*data-stx-server-data[^>]*>[\s\S]*?<\/script>/i);if(d)n.push(d[0]);let x=u.match(/<script\b[^>]*data-stx-runtime-config[^>]*>[\s\S]*?<\/script>/i);if(x)n.push(x[0])}if(s.preserveHead&&i){let u=[],g=/<title\b[^>]*>[\s\S]*?<\/title>|<meta\b[^>]*>|<link\b[^>]*>/gi,f;while((f=g.exec(i[1]))!==null){if(/<meta\b[^>]*(?:\bcharset|name="viewport")/i.test(f[0]))continue;u.push(f[0])}if(u.length>0)n.unshift(`<!--${st}${Buffer.from(u.join(`
24
24
  `),"utf8").toString("base64")}-->`)}let o=e.match(/<body\b[^>]*>/i),l=c(e);if(o&&l!==-1){let u=o.index+o[0].length,g=e.slice(u,l).trim();if(n.length>0)return n.join(`
25
25
  `)+`
26
26
  `+g;return g}let a=e;if(a=a.replace(/<!DOCTYPE\b[^>]*>/i,""),a=a.replace(/<html\b[^>]*>/i,""),a=a.replace(/<\/html\s*>/i,""),i)a=a.replace(/<head\b[^>]*>[\s\S]*?<\/head>/i,n.join(`
27
- `));return a=a.replace(/<body\b[^>]*>/i,""),a=a.replace(/<\/body\s*>/i,""),a.trim()}var q=/^<script\b[^>]*\sdata-stx-(?:owner|instance)(?=[\s=/>])/i;function U(t,s,e,n){if(!q.test(s))return!1;let i=s.slice(0,s.indexOf(">")+1),o=/\sdata-stx-owner="([^"]+)"/i.exec(i)?.[1];if(!o)return!0;let l=`data-stx-scope="${o}"`;for(let a=t.indexOf(l);a!==-1;a=t.indexOf(l,a+l.length))if(a>=e&&a<n)return!1;return!0}function Pa(t){return Le(t)}function at(t,s){let e=[],n=new Set;for(let i of w(t,Q)){if(i.start>=s.start&&i.start<s.end)continue;let o=i.token.match(/^<script\b((?:"[^"]*"|'[^']*'|[^'">])*)>/i)?.[1]??"",l=new Map;for(let g of o.matchAll(/([^\s=/>]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+)))?/g))l.set(g[1].toLowerCase(),g[2]??g[3]??g[4]??"");let a=l.get("src")?.trim(),u=l.get("type")?.trim().toLowerCase();if(!a||l.has("server")||u&&!["module","text/javascript","application/javascript"].includes(u))continue;if(l.has("data-stx-runtime")||l.has("data-stx-router")||/^\/_stx\/(?:runtime|router)(?:\.[a-f0-9]{16})?\.js(?:[?#]|$)/i.test(a))continue;if(U(t,i.token,s.start,s.end)||n.has(i.token))continue;n.add(i.token),e.push(i.token)}return e}function rt(t,s="main"){return!!P(t.trim(),s)}function je(t,s="main",e=!1){let n=t.trim(),i=[],o=[],l=n.match(/<head\b[^>]*>([\s\S]*?)<\/head>/i);if(l){let S=l[1],C=/<style\b[^>]*>[\s\S]*?<\/style>/gi,p;while((p=C.exec(S))!==null)i.push(p[0]);let A=/<script\b[^>]*data-stx-(?:route-params|server-data|scoped|component-factories)[^>]*>[\s\S]*?<\/script>/gi;while((p=A.exec(S))!==null){if(q.test(p[0])||p[0].includes("__stx_early_mounts")||/^<script\b[^>]*\bdata-stx-runtime(?=[\s=>])/i.test(p[0]))continue;o.push(p[0])}}let a=P(n,s);if(!a)return(e?Vn(t)+Un(t):"")+nt(t);let u=at(n,a),g=new Set(u),{tagName:f,start:d,end:x}=a,y=n.slice(d,x).trim(),R=[],b=n.match(/<body\b[^>]*>/i),k=c(n);if(b&&b.index!==void 0&&k!==-1){let C=[[b.index+b[0].length,a.openIndex],[x+`</${f}>`.length,k]],p=/<script\b[^>]*>[\s\S]*?<\/script>/gi;for(let[A,N]of C){if(A>=N)continue;let W=n.slice(A,N),v;p.lastIndex=0;while((v=p.exec(W))!==null){if(U(n,v[0],d,x))continue;R.push(v[0])}}}let m=[];if(e)m.push(Vn(t)+Un(t));if(i.length>0)m.push(i.join(`
27
+ `));return a=a.replace(/<body\b[^>]*>/i,""),a=a.replace(/<\/body\s*>/i,""),a.trim()}var V=/^<script\b[^>]*\sdata-stx-(?:owner|instance)(?=[\s=/>])/i;function q(t,s,e,n){if(!V.test(s))return!1;let i=s.slice(0,s.indexOf(">")+1),o=/\sdata-stx-owner="([^"]+)"/i.exec(i)?.[1];if(!o)return!0;let l=`data-stx-scope="${o}"`;for(let a=t.indexOf(l);a!==-1;a=t.indexOf(l,a+l.length))if(a>=e&&a<n)return!1;return!0}function Oa(t){return Le(t)}function at(t,s){let e=[],n=new Set;for(let i of w(t,Q)){if(i.start>=s.start&&i.start<s.end)continue;let o=i.token.match(/^<script\b((?:"[^"]*"|'[^']*'|[^'">])*)>/i)?.[1]??"",l=new Map;for(let g of o.matchAll(/([^\s=/>]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+)))?/g))l.set(g[1].toLowerCase(),g[2]??g[3]??g[4]??"");let a=l.get("src")?.trim(),u=l.get("type")?.trim().toLowerCase();if(!a||l.has("server")||u&&!["module","text/javascript","application/javascript"].includes(u))continue;if(l.has("data-stx-runtime")||l.has("data-stx-router")||/^\/_stx\/(?:runtime|router)(?:\.[a-f0-9]{16})?\.js(?:[?#]|$)/i.test(a))continue;if(q(t,i.token,s.start,s.end)||n.has(i.token))continue;n.add(i.token),e.push(i.token)}return e}function rt(t,s="main"){return!!P(t.trim(),s)}function je(t,s="main",e=!1){let n=t.trim(),i=[],o=[],l=n.match(/<head\b[^>]*>([\s\S]*?)<\/head>/i);if(l){let S=l[1],C=/<style\b[^>]*>[\s\S]*?<\/style>/gi,p;while((p=C.exec(S))!==null)i.push(p[0]);let A=/<script\b[^>]*data-stx-(?:route-params|server-data|scoped|component-factories)[^>]*>[\s\S]*?<\/script>/gi;while((p=A.exec(S))!==null){if(V.test(p[0])||p[0].includes("__stx_early_mounts")||/^<script\b[^>]*\bdata-stx-runtime(?=[\s=>])/i.test(p[0]))continue;o.push(p[0])}}let a=P(n,s);if(!a)return(e?Un(t)+Wn(t):"")+nt(t);let u=at(n,a),g=new Set(u),{tagName:f,start:d,end:x}=a,y=n.slice(d,x).trim(),R=[],b=n.match(/<body\b[^>]*>/i),k=c(n);if(b&&b.index!==void 0&&k!==-1){let C=[[b.index+b[0].length,a.openIndex],[x+`</${f}>`.length,k]],p=/<script\b[^>]*>[\s\S]*?<\/script>/gi;for(let[A,j]of C){if(A>=j)continue;let W=n.slice(A,j),v;p.lastIndex=0;while((v=p.exec(W))!==null){if(q(n,v[0],d,x))continue;R.push(v[0])}}}let m=[];if(e)m.push(Un(t)+Wn(t));if(i.length>0)m.push(i.join(`
28
28
  `));if(u.length>0)m.push(u.join(`
29
29
  `));if(o.length>0)m.push(o.filter((S)=>!g.has(S)).join(`
30
30
  `));if(R.length>0)m.push(R.filter((S)=>!g.has(S)).join(`
31
31
  `));return m.push(y),m.join(`
32
- `)}import M from"fs";import z from"path";function Ia(t,s,e){return{version:1,buildTime:new Date().toISOString(),routes:t,assets:s,outputDir:e}}function Oa(t,s){let e=z.join(s,"manifest.json");M.writeFileSync(e,JSON.stringify(t,null,2))}function Na(t){let s=z.join(t,"manifest.json");if(!M.existsSync(s))return null;try{let e=M.readFileSync(s,"utf-8"),n=JSON.parse(e);if(n.version!==1)return console.warn(`[stx] Manifest version mismatch: expected 1, got ${n.version}`),null;return n}catch(e){return console.warn("[stx] Failed to load manifest:",e),null}}function I(t,s,e={}){let n=`${encodeURIComponent(t)}=${encodeURIComponent(s)}`;if(e.maxAge!==void 0)n+=`; Max-Age=${e.maxAge}`;if(e.expires)n+=`; Expires=${e.expires.toUTCString()}`;if(e.path)n+=`; Path=${e.path}`;if(e.domain)n+=`; Domain=${e.domain}`;if(e.secure)n+="; Secure";if(e.httpOnly)n+="; HttpOnly";if(e.sameSite)n+=`; SameSite=${e.sameSite}`;return n}async function ct(t){let s=t.headers.get("content-type")||"",e={},n=(i,o)=>{let l=e[i];if(l===void 0)e[i]=o;else if(Array.isArray(l))l.push(o);else e[i]=[l,o]};if(s.includes("multipart/form-data")){let i=await t.formData();for(let[o,l]of i.entries())if(typeof l==="string")n(o,l);return e}if(s.includes("application/x-www-form-urlencoded")){for(let[i,o]of new URLSearchParams(await t.text()).entries())n(i,o);return e}return e}function No(t){if(!t)return!1;let s=t.toUpperCase();return s!=="GET"&&s!=="HEAD"}async function G(t,s={}){let e=s.request,n=s.method??e?.method;if(!e||!No(n))return{ran:!1};if(typeof t.action!=="function")return{ran:!1};let i={};try{i=await ct(e)}catch{}let o=await t.action({request:e,form:i,params:s.params??{},query:t.query??{},cookies:s.cookies??{}});if(o&&typeof o==="object"){let l=o,a=lt(l.cookies),u=l.redirect;if(typeof u==="string"&&u)return{redirect:u,ran:!0,...a.length>0?{cookies:a}:{}};let{cookies:g,redirect:f,...d}=l;if(Object.assign(t,d),a.length>0)return{ran:!0,cookies:a}}return{ran:!0}}function lt(t){if(!t||typeof t!=="object"||Array.isArray(t))return[];let s=[];for(let[e,n]of Object.entries(t)){if(!e)continue;if(typeof n==="string"){s.push(I(e,n));continue}if(n&&typeof n==="object"){let i=n;if(typeof i.value!=="string")continue;s.push(I(e,i.value,i))}}return s}function Ma(t,s=[],e){let n=new Headers({Location:t,"Cache-Control":"no-store"});for(let i of s)n.append("Set-Cookie",i);for(let[i,o]of Object.entries(e??{}))if(i.toLowerCase()!=="location")n.set(i,o);return new Response(null,{status:303,headers:n})}async function Wn(t,s={}){let{html:e,context:n,redirect:i,cookies:o}=await ut(t,s),l=Wt(n),a=qt(n);if(i)return{html:e,redirect:i,cookies:o,status:l,headers:a};let{extractStreamBoundaries:u}=await import("./chunk-kcqfrw10.js"),g=u(n),f=t.streamTemplates;if(f&&Object.keys(f).length>0){let{processDirectives:d}=await import("./chunk-xk15vzb6.js"),{defaultConfig:x}=await import("./chunk-nnqyn7db.js"),y=n.streamBoundaries||{},R={...x,autoShell:!1},b=Object.keys(f).map((m)=>({id:m,render:async()=>{let S=typeof y[m]==="function"?await y[m]():void 0;return d(f[m],{...n,$boundary:S},t.sourceFile,R,new Set)}})),k=new Set(b.map((m)=>m.id));g=[...(g||[]).filter((m)=>!k.has(m.id)),...b]}return{html:e,boundaries:g&&g.length>0?g:void 0,cookies:o,status:l,headers:a}}async function ut(t,s){let e={__filename:t.sourceFile,__dirname:t.sourceFile.replace(/[/\\][^/\\]+$/,""),...s};if(!t.hasServerScripts&&!Fi(t.html))return{html:t.html,context:e};for(let l of t.serverScriptContent)try{await h(l,e,t.sourceFile)}catch(a){if(s.__stx_strict_hydration)throw a;console.warn(`[stx] Server script error in ${t.sourceFile}:`,a)}let n=await G(e,{request:s.request,method:s.method,params:s.params??{},cookies:s.cookies??{}}),i=(l)=>{let a=l.replace(/<script\b[^>]*\bdata-stx-server-data\b[^>]*>[\s\S]*?<\/script>/gi,""),u=Lr(e);if(!u)return a;let g=D(a);return g<0?u+a:a.slice(0,g)+u+a.slice(g)};if(n.redirect)return{html:t.html,context:e,redirect:n.redirect,cookies:n.cookies};if(!Fi(t.html))return{html:i(t.html),context:e,cookies:n.cookies};let o=new Map;for(let[l,a]of Object.entries(t.placeholders))if(a.expression)try{let u=O(a.expression,e);if(a.type==="raw")o.set(l,u!==void 0&&u!==null?String(u):"");else o.set(l,u!==void 0&&u!==null?Y(String(u)):"")}catch(u){if(s.__stx_strict_hydration)throw u;o.set(l,"")}return{html:i(Cl(t.html,o)),context:e,cookies:n.cookies}}
33
- export{Ct,an,Le,V,Vn,Un,Aa,Oo,is,nt,Pa,rt,je,Ia,Oa,Na,No,Ma,Wn};
32
+ `)}import O from"fs";import z from"path";function Na(t,s,e){return{version:1,buildTime:new Date().toISOString(),routes:t,assets:s,outputDir:e}}function Ma(t,s){let e=z.join(s,"manifest.json");O.writeFileSync(e,JSON.stringify(t,null,2))}function Da(t){let s=z.join(t,"manifest.json");if(!O.existsSync(s))return null;try{let e=O.readFileSync(s,"utf-8"),n=JSON.parse(e);if(n.version!==1)return console.warn(`[stx] Manifest version mismatch: expected 1, got ${n.version}`),null;return n}catch(e){return console.warn("[stx] Failed to load manifest:",e),null}}function M(t,s,e={}){let n=`${encodeURIComponent(t)}=${encodeURIComponent(s)}`;if(e.maxAge!==void 0)n+=`; Max-Age=${e.maxAge}`;if(e.expires)n+=`; Expires=${e.expires.toUTCString()}`;if(e.path)n+=`; Path=${e.path}`;if(e.domain)n+=`; Domain=${e.domain}`;if(e.secure)n+="; Secure";if(e.httpOnly)n+="; HttpOnly";if(e.sameSite)n+=`; SameSite=${e.sameSite}`;return n}async function ct(t){let s=t.headers.get("content-type")||"",e={},n=(i,o)=>{let l=e[i];if(l===void 0)e[i]=o;else if(Array.isArray(l))l.push(o);else e[i]=[l,o]};if(s.includes("multipart/form-data")){let i=await t.formData();for(let[o,l]of i.entries())if(typeof l==="string")n(o,l);return e}if(s.includes("application/x-www-form-urlencoded")){for(let[i,o]of new URLSearchParams(await t.text()).entries())n(i,o);return e}return e}function Lo(t){if(!t)return!1;let s=t.toUpperCase();return s!=="GET"&&s!=="HEAD"}async function G(t,s={}){let e=s.request,n=s.method??e?.method;if(!e||!Lo(n))return{ran:!1};if(typeof t.action!=="function")return{ran:!1};let i={};try{i=await ct(e)}catch{}let o=await t.action({request:e,form:i,params:s.params??{},query:t.query??{},cookies:s.cookies??{}});if(o&&typeof o==="object"){let l=o,a=lt(l.cookies),u=l.redirect;if(typeof u==="string"&&u)return{redirect:u,ran:!0,...a.length>0?{cookies:a}:{}};let{cookies:g,redirect:f,...d}=l;if(Object.assign(t,d),a.length>0)return{ran:!0,cookies:a}}return{ran:!0}}function lt(t){if(!t||typeof t!=="object"||Array.isArray(t))return[];let s=[];for(let[e,n]of Object.entries(t)){if(!e)continue;if(typeof n==="string"){s.push(M(e,n));continue}if(n&&typeof n==="object"){let i=n;if(typeof i.value!=="string")continue;s.push(M(e,i.value,i))}}return s}function La(t,s=[],e){let n=new Headers({Location:t,"Cache-Control":"no-store"});for(let i of s)n.append("Set-Cookie",i);for(let[i,o]of Object.entries(e??{}))if(i.toLowerCase()!=="location")n.set(i,o);return new Response(null,{status:303,headers:n})}async function qn(t,s={}){let{html:e,context:n,redirect:i,cookies:o}=await ut(t,s),l=Wt(n),a=qt(n);if(i)return{html:e,redirect:i,cookies:o,status:l,headers:a};let{extractStreamBoundaries:u}=await import("./chunk-0g9cceht.js"),g=u(n),f=t.streamTemplates;if(f&&Object.keys(f).length>0){let{processDirectives:d}=await import("./chunk-8354mzpd.js"),{defaultConfig:x}=await import("./chunk-5aa83bpm.js"),y=n.streamBoundaries||{},R={...x,autoShell:!1},b=Object.keys(f).map((m)=>({id:m,render:async()=>{let S=typeof y[m]==="function"?await y[m]():void 0;return d(f[m],{...n,$boundary:S},t.sourceFile,R,new Set)}})),k=new Set(b.map((m)=>m.id));g=[...(g||[]).filter((m)=>!k.has(m.id)),...b]}return{html:e,boundaries:g&&g.length>0?g:void 0,cookies:o,status:l,headers:a}}async function ut(t,s){let e={__filename:t.sourceFile,__dirname:t.sourceFile.replace(/[/\\][^/\\]+$/,""),...s};if(!t.hasServerScripts&&!Vi(t.html))return{html:t.html,context:e};for(let l of t.serverScriptContent)try{await h(l,e,t.sourceFile)}catch(a){if(s.__stx_strict_hydration)throw a;console.warn(`[stx] Server script error in ${t.sourceFile}:`,a)}let n=await G(e,{request:s.request,method:s.method,params:s.params??{},cookies:s.cookies??{}}),i=(l)=>{let a=l.replace(/<script\b[^>]*\bdata-stx-server-data\b[^>]*>[\s\S]*?<\/script>/gi,""),u=jr(e);if(!u)return a;let g=L(a);return g<0?u+a:a.slice(0,g)+u+a.slice(g)};if(n.redirect)return{html:t.html,context:e,redirect:n.redirect,cookies:n.cookies};if(!Vi(t.html))return{html:i(t.html),context:e,cookies:n.cookies};let o=new Map;for(let[l,a]of Object.entries(t.placeholders))if(a.expression)try{let u=N(a.expression,e);if(a.type==="raw")o.set(l,u!==void 0&&u!==null?String(u):"");else o.set(l,u!==void 0&&u!==null?Y(String(u)):"")}catch(u){if(s.__stx_strict_hydration)throw u;o.set(l,"")}return{html:i(Tl(t.html,o)),context:e,cookies:n.cookies}}
33
+ export{Ct,on,Le,U,Un,Wn,Ia,Do,ls,nt,Oa,rt,je,Na,Ma,Da,Lo,La,qn};
@@ -1,4 +1,4 @@
1
1
  // @bun
2
- import{pt}from"./chunk-agd2b928.js";import{$t,tr}from"./chunk-fg67643b.js";import{he,Tn,kl,_l}from"./chunk-a02gt4tz.js";import{zr,Hr,Vr,Wr,Me}from"./chunk-295bykzd.js";import{F}from"./chunk-6t04tqvh.js";import{Vi}from"./chunk-kaem8q20.js";import{x}from"./chunk-sfyyn0mg.js";import{i}from"./chunk-gtv9jd68.js";import{W,a}from"./chunk-mxvgft6p.js";import{Kc}from"./chunk-ssg6ne5b.js";import{Vn,Un,nt,je,Ia,Oa,Wn}from"./chunk-16aqrwmk.js";import{wn,Xo}from"./chunk-q3epnfp4.js";import{qn}from"./chunk-c73c0wf9.js";import{pn,ur,dr}from"./chunk-p6hcrg3r.js";import{ne}from"./chunk-f2twg7ze.js";import m from"fs";import c from"path";import{createHash as Y}from"crypto";function I(n){return Y("sha256").update(n).digest("hex").slice(0,8)}function J(n=!1){let l=n?tr():$t(),o=I(l);return{content:l,filename:`runtime.${o}.js`,hash:o}}function U(){let n=pt(),l=I(n);return{content:n,filename:`router.${l}.js`,hash:l}}import V from"path";import{createHash as Q}from"crypto";function ee(n={}){let l=new Set;return{context:new Proxy(n,{get(r,e){if(e in r)return r[e];if(typeof e==="string"&&!e.startsWith("__"))l.add(e);return},has(r,e){if(e in r)return!0;if(typeof e==="string"&&!e.startsWith("__"))l.add(e);return!1}}),accessedKeys:l}}async function q(n,l,o={}){let r=V.resolve(n),e=await Bun.file(r).text(),S=Q("sha256").update(e).digest("hex").slice(0,16);kl();let _={};try{_=await a(o.configDir)}catch{}let y=[],d=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,g;while((g=d.exec(e))!==null){let R=g[1];if(/\bserver\b/.test(R))y.push(g[2])}let u=new Set(y.flatMap((R)=>he(R))),{context:D}=ee({__filename:r,__dirname:V.dirname(r),__stx_serverDeclared:u}),A=new Set,T={...W,..._,...o,buildMode:"compile",strict:!1},f=await i(e,D,r,T,A),w=Vn(f)+Un(f)+nt(f),j=_l();return{route:l,sourceFile:n,html:f,fragment:w,placeholders:j,hasServerScripts:y.length>0,serverScriptContent:y,dependencies:Array.from(A),contentHash:S,status:Tn(e),streamTemplates:D.__streamTemplates}}var te=new Set([".DS_Store","Thumbs.db","desktop.ini",".gitkeep",".gitignore"]);function X(n,l){let o=0,r=0;if(!m.existsSync(n))return{copied:o,bytes:r};m.mkdirSync(l,{recursive:!0});function e(S,_){let y=m.readdirSync(S,{withFileTypes:!0});for(let d of y){if(te.has(d.name))continue;let g=c.join(S,d.name),u=c.join(_,d.name);if(d.isDirectory())m.mkdirSync(u,{recursive:!0}),e(g,u);else if(d.isFile()){if(m.existsSync(u))continue;m.copyFileSync(g,u),o++,r+=m.statSync(u).size}}}return e(n,l),{copied:o,bytes:r}}async function Pm(n={}){let l=Date.now(),o=c.resolve(n.root||process.cwd()),r=c.resolve(o,n.outputDir||".output");console.log("[stx build] Starting production build...");let e=await a(o),S=c.resolve(o,n.componentsDir??e.componentsDir??"components"),_=c.resolve(o,n.partialsDir??e.partialsDir??"partials"),y=c.resolve(o,n.layoutsDir??e.layoutsDir??"layouts"),d=n.publicDir??e.publicDir??"public",g=Me(e.app?.head,{known:Wr,source:"app.head"}),u=e.app?.colorMode,D=e.router?.container||"main",A=n.routeRules??e.routeRules??{},T=qn(A),f=n.serverApi??e.serverApi,w=typeof f==="object"?f:{};if(f)wn(o,w);if(e.runtimeConfig)F(e.runtimeConfig,{});if(m.existsSync(r))m.rmSync(r,{recursive:!0});let j=[c.join(r,"public","__stx"),c.join(r,"public","assets"),c.join(r,"server","pages"),c.join(r,"server","fragments")];for(let s of j)m.mkdirSync(s,{recursive:!0});console.log("[stx build] Discovering routes...");let R=ne(o,{pagesDirs:e._layerPageDirs}),Z=["components","layouts","partials"],P=R.filter((s)=>!Z.some((h)=>s.pattern.startsWith(`/${h}/`)||s.pattern===`/${h}`));console.log(`[stx build] Found ${P.length} page routes (${R.length-P.length} non-page files excluded)`),console.log("[stx build] Generating shared assets...");let v=J(n.debug),b=U();await Bun.write(c.join(r,"public","__stx",v.filename),v.content),await Bun.write(c.join(r,"public","__stx",b.filename),b.content),console.log(`[stx build] Runtime: ${v.filename} (${(v.content.length/1024).toFixed(1)}KB)`),console.log(`[stx build] Router: ${b.filename} (${(b.content.length/1024).toFixed(1)}KB)`),console.log("[stx build] Compiling templates...");let B=[],O=[];for(let s of P){let h=T(s.pattern),M=h.rendering==="prerender";if(M&&(s.pattern.includes(":")||s.pattern.includes("[")))throw Error(`Cannot prerender parameter route ${s.pattern}; use dynamic rendering (explicit path enumeration is not supported here)`);try{let t=await q(s.filePath,s.pattern,{configDir:o,componentsDir:S,partialsDir:_,layoutsDir:y,debug:n.debug});if(B.push(t),t.html=t.html.replace(/runtime\.__STX_HASH__\.js/g,v.filename).replace(/router\.__STX_HASH__\.js/g,b.filename),t.html=Vr(t.html,g,{bodyScripts:[`<script src="/__stx/${b.filename}"></script>`],...u&&{colorMode:u}}),u)t.html=zr(t.html,u);if(g.htmlAttrs)t.html=Hr(t.html,g.htmlAttrs);if(!/<body[^>]*\bdata-stx=/.test(t.html)){let p=t.html.match(/<(?!body\b)[a-zA-Z][a-zA-Z0-9-]*\b[^>]*?\s(data-stx="[^"]+")[^>]*>/);if(p&&p[1]){let G=p[1];t.html=t.html.replace(" "+G,""),t.html=t.html.replace(/<body([^>]*)>/,`<body$1 ${G}>`)}}if(t.html=t.html.replace(/<style data-css="generated">[\s\S]*?<\/style>\s*/g,""),t.html=await x(t.html),M){let p=await Wn(t,{params:{},request:new Request(`http://stx.build${s.pattern}`),method:"GET",__stx_strict_hydration:!0});if(p.redirect||p.cookies?.length||p.boundaries?.length||p.headers&&Object.keys(p.headers).length)throw Error(`Prerendered route ${s.pattern} cannot set response headers/cookies, redirect or stream`);t.html=p.html,t.status=p.status??t.status,t.hasServerScripts=!1,t.serverScriptContent=[],t.placeholders={}}t.fragment=je(t.html,D,!0);let K=s.pattern==="/"?"index":s.pattern.slice(1).replace(/\//g,"-").replace(/[[\]]/g,"_"),L=c.join("server","pages",`${K}.compiled.json`),z=c.join("server","fragments",`${K}.html`);await Bun.write(c.join(r,L),JSON.stringify(t,null,2)),await Bun.write(c.join(r,z),t.fragment),O.push({pattern:s.pattern,compiledPath:L,fragmentPath:z,isDynamic:t.hasServerScripts,hasParams:s.pattern.includes(":")||s.pattern.includes("["),prerendered:M}),console.log(`[stx build] \u2713 ${s.pattern}`)}catch(t){if(Object.keys(h).length)throw t;console.error(`[stx build] \u2717 ${s.pattern}:`,t instanceof Error?t.message:t)}}let H=c.resolve(o,d);if(m.existsSync(H)){let{copied:s,bytes:h}=X(H,c.join(r,"public"));if(s>0)console.log(`[stx build] Copied ${s} public asset${s===1?"":"s"} (${(h/1024).toFixed(1)}KB) from ${d}/`)}let k=dr(o);if(k){let{copied:s,bytes:h}=X(k,c.join(r,"public",ur));if(s>0)console.log(`[stx build] Copied ${s} asset${s===1?"":"s"} (${(h/1024).toFixed(1)}KB) from ${pn}/`)}let E={runtime:v.filename,router:b.filename},C=Ia(O,E,r);if(C.routeRules=A,C.routerContainer=D,f)C.apiRoutes=await Xo(o,r,w);if(e.runtimeConfig)await Bun.write(c.join(r,"server/runtime-config.json"),JSON.stringify(e.runtimeConfig)),await Vi(o,e.runtimeConfig);if(e._layerGraph)await Bun.write(c.join(r,"server/layers.json"),JSON.stringify(Kc(e._layerGraph),null,2));Oa(C,r);let N=Date.now()-l;return console.log(`
3
- [stx build] Done in ${N}ms \u2014 ${B.length} pages compiled`),{pageCount:B.length,assets:E,outputDir:r,duration:N}}
4
- export{Pm};
2
+ import{pt}from"./chunk-eceeqy74.js";import{$t,nr}from"./chunk-6pz5gq6v.js";import{ye,En,Cl,El}from"./chunk-gz9pknbw.js";import{Vr,Ur,Wr,Kr,Me}from"./chunk-3dqfjpz4.js";import{z}from"./chunk-eyx92t9n.js";import{qi}from"./chunk-s93yh7ed.js";import{x}from"./chunk-vc432a0w.js";import{i}from"./chunk-mt8edb75.js";import{q,a}from"./chunk-p8shtje2.js";import{Xc}from"./chunk-rb2zbdqd.js";import{Un,Wn,nt,je,Na,Ma,qn}from"./chunk-kx09v9ya.js";import{bn,Zo}from"./chunk-s0mf56y1.js";import{Kn}from"./chunk-kbbbpae2.js";import{dn,dr,pr}from"./chunk-evwrxsxd.js";import{ne}from"./chunk-bqtj62ys.js";import m from"fs";import c from"path";import{createHash as Y}from"crypto";function I(n){return Y("sha256").update(n).digest("hex").slice(0,8)}function W(n=!1){let l=n?nr():$t(),o=I(l);return{content:l,filename:`runtime.${o}.js`,hash:o}}function J(){let n=pt(),l=I(n);return{content:n,filename:`router.${l}.js`,hash:l}}import U from"path";import{createHash as Q}from"crypto";function ee(n={}){let l=new Set;return{context:new Proxy(n,{get(r,e){if(e in r)return r[e];if(typeof e==="string"&&!e.startsWith("__"))l.add(e);return},has(r,e){if(e in r)return!0;if(typeof e==="string"&&!e.startsWith("__"))l.add(e);return!1}}),accessedKeys:l}}async function V(n,l,o={}){let r=U.resolve(n),e=await Bun.file(r).text(),S=Q("sha256").update(e).digest("hex").slice(0,16);Cl();let _={};try{_=await a(o.configDir)}catch{}let y=[],d=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,g;while((g=d.exec(e))!==null){let R=g[1];if(/\bserver\b/.test(R))y.push(g[2])}let u=new Set(y.flatMap((R)=>ye(R))),{context:D}=ee({__filename:r,__dirname:U.dirname(r),__stx_serverDeclared:u}),A=new Set,T={...q,..._,...o,buildMode:"compile",strict:!1},f=await i(e,D,r,T,A),w=Un(f)+Wn(f)+nt(f),j=El();return{route:l,sourceFile:n,html:f,fragment:w,placeholders:j,hasServerScripts:y.length>0,serverScriptContent:y,dependencies:Array.from(A),contentHash:S,status:En(e),streamTemplates:D.__streamTemplates}}var te=new Set([".DS_Store","Thumbs.db","desktop.ini",".gitkeep",".gitignore"]);function X(n,l){let o=0,r=0;if(!m.existsSync(n))return{copied:o,bytes:r};m.mkdirSync(l,{recursive:!0});function e(S,_){let y=m.readdirSync(S,{withFileTypes:!0});for(let d of y){if(te.has(d.name))continue;let g=c.join(S,d.name),u=c.join(_,d.name);if(d.isDirectory())m.mkdirSync(u,{recursive:!0}),e(g,u);else if(d.isFile()){if(m.existsSync(u))continue;m.copyFileSync(g,u),o++,r+=m.statSync(u).size}}}return e(n,l),{copied:o,bytes:r}}async function Om(n={}){let l=Date.now(),o=c.resolve(n.root||process.cwd()),r=c.resolve(o,n.outputDir||".output");console.log("[stx build] Starting production build...");let e=await a(o),S=c.resolve(o,n.componentsDir??e.componentsDir??"components"),_=c.resolve(o,n.partialsDir??e.partialsDir??"partials"),y=c.resolve(o,n.layoutsDir??e.layoutsDir??"layouts"),d=n.publicDir??e.publicDir??"public",g=Me(e.app?.head,{known:Kr,source:"app.head"}),u=e.app?.colorMode,D=e.router?.container||"main",A=n.routeRules??e.routeRules??{},T=Kn(A),f=n.serverApi??e.serverApi,w=typeof f==="object"?f:{};if(f)bn(o,w);if(e.runtimeConfig)z(e.runtimeConfig,{});if(m.existsSync(r))m.rmSync(r,{recursive:!0});let j=[c.join(r,"public","__stx"),c.join(r,"public","assets"),c.join(r,"server","pages"),c.join(r,"server","fragments")];for(let s of j)m.mkdirSync(s,{recursive:!0});console.log("[stx build] Discovering routes...");let R=ne(o,{pagesDirs:e._layerPageDirs}),Z=["components","layouts","partials"],P=R.filter((s)=>!Z.some((h)=>s.pattern.startsWith(`/${h}/`)||s.pattern===`/${h}`));console.log(`[stx build] Found ${P.length} page routes (${R.length-P.length} non-page files excluded)`),console.log("[stx build] Generating shared assets...");let v=W(n.debug),b=J();await Bun.write(c.join(r,"public","__stx",v.filename),v.content),await Bun.write(c.join(r,"public","__stx",b.filename),b.content),console.log(`[stx build] Runtime: ${v.filename} (${(v.content.length/1024).toFixed(1)}KB)`),console.log(`[stx build] Router: ${b.filename} (${(b.content.length/1024).toFixed(1)}KB)`),console.log("[stx build] Compiling templates...");let B=[],O=[];for(let s of P){let h=T(s.pattern),M=h.rendering==="prerender";if(M&&(s.pattern.includes(":")||s.pattern.includes("[")))throw Error(`Cannot prerender parameter route ${s.pattern}; use dynamic rendering (explicit path enumeration is not supported here)`);try{let t=await V(s.filePath,s.pattern,{configDir:o,componentsDir:S,partialsDir:_,layoutsDir:y,debug:n.debug});if(B.push(t),t.html=t.html.replace(/runtime\.__STX_HASH__\.js/g,v.filename).replace(/router\.__STX_HASH__\.js/g,b.filename),t.html=Wr(t.html,g,{bodyScripts:[`<script src="/__stx/${b.filename}"></script>`],...u&&{colorMode:u}}),u)t.html=Vr(t.html,u);if(g.htmlAttrs)t.html=Ur(t.html,g.htmlAttrs);if(!/<body[^>]*\bdata-stx=/.test(t.html)){let p=t.html.match(/<(?!body\b)[a-zA-Z][a-zA-Z0-9-]*\b[^>]*?\s(data-stx="[^"]+")[^>]*>/);if(p&&p[1]){let G=p[1];t.html=t.html.replace(" "+G,""),t.html=t.html.replace(/<body([^>]*)>/,`<body$1 ${G}>`)}}if(t.html=t.html.replace(/<style data-css="generated">[\s\S]*?<\/style>\s*/g,""),t.html=await x(t.html),M){let p=await qn(t,{params:{},request:new Request(`http://stx.build${s.pattern}`),method:"GET",__stx_strict_hydration:!0});if(p.redirect||p.cookies?.length||p.boundaries?.length||p.headers&&Object.keys(p.headers).length)throw Error(`Prerendered route ${s.pattern} cannot set response headers/cookies, redirect or stream`);t.html=p.html,t.status=p.status??t.status,t.hasServerScripts=!1,t.serverScriptContent=[],t.placeholders={}}t.fragment=je(t.html,D,!0);let N=s.pattern==="/"?"index":s.pattern.slice(1).replace(/\//g,"-").replace(/[[\]]/g,"_"),K=c.join("server","pages",`${N}.compiled.json`),L=c.join("server","fragments",`${N}.html`);await Bun.write(c.join(r,K),JSON.stringify(t,null,2)),await Bun.write(c.join(r,L),t.fragment),O.push({pattern:s.pattern,compiledPath:K,fragmentPath:L,isDynamic:t.hasServerScripts,hasParams:s.pattern.includes(":")||s.pattern.includes("["),prerendered:M}),console.log(`[stx build] \u2713 ${s.pattern}`)}catch(t){if(Object.keys(h).length)throw t;console.error(`[stx build] \u2717 ${s.pattern}:`,t instanceof Error?t.message:t)}}let H=c.resolve(o,d);if(m.existsSync(H)){let{copied:s,bytes:h}=X(H,c.join(r,"public"));if(s>0)console.log(`[stx build] Copied ${s} public asset${s===1?"":"s"} (${(h/1024).toFixed(1)}KB) from ${d}/`)}let k=pr(o);if(k){let{copied:s,bytes:h}=X(k,c.join(r,"public",dr));if(s>0)console.log(`[stx build] Copied ${s} asset${s===1?"":"s"} (${(h/1024).toFixed(1)}KB) from ${dn}/`)}let E={runtime:v.filename,router:b.filename},C=Na(O,E,r);if(C.routeRules=A,C.routerContainer=D,f)C.apiRoutes=await Zo(o,r,w);if(e.runtimeConfig)await Bun.write(c.join(r,"server/runtime-config.json"),JSON.stringify(e.runtimeConfig)),await qi(o,e.runtimeConfig);if(e._layerGraph)await Bun.write(c.join(r,"server/layers.json"),JSON.stringify(Xc(e._layerGraph),null,2));Ma(C,r);let F=Date.now()-l;return console.log(`
3
+ [stx build] Done in ${F}ms \u2014 ${B.length} pages compiled`),{pageCount:B.length,assets:E,outputDir:r,duration:F}}
4
+ export{Om};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import"./chunk-n22xtagg.js";import"./chunk-hxhmhw23.js";import"./chunk-s29hp1qw.js";import"./chunk-kwf3kfr0.js";import{S,C,A,oe}from"./chunk-a02gt4tz.js";import"./chunk-295bykzd.js";import"./chunk-6t04tqvh.js";import"./chunk-kaem8q20.js";import{br}from"./chunk-7mcs59pr.js";import{existsSync as E}from"fs";import l from"path";var b=["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","useAnimationFrame","useAsyncData","useAttributeObserver","useAutoLogout","useAutoWakeLock","useBattery","useBreakpoint","useBreathPacer","useBroadcastChannel","useChannel","useChildListObserver","useClipboard","useColorHistory","useCompletion","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","useVirtualList","useVisibility","useWakeLock","useWindowSize"],_=new Set(b);var u=new Map,h=S(64),w=new Set,v=0,R=new Set(b);function z(){u.clear(),h.clear()}function P(s){let o=new Map;for(let t of s){let i=l.basename(t);if(i.endsWith(".d.ts"))continue;let r=i.replace(/\.[jt]s$/,"");if(r==="index")continue;if(r===i)continue;let a=o.get(r);if(a&&!a.endsWith(".js"))continue;o.set(r,t)}return[...o.values()].sort()}function I(s,o){let t=o.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");return new RegExp(`(?:^|[^\\w$.])(?:const|let|var|function|class)\\s+${t}\\b`).test(s)}function M(s){if(!s)return[];let o=C(s,v),t=h.get(o);if(t)return t.slice();let i=s.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,""),r=[];for(let a of R){if(w.has(a))continue;let p=a.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");if(new RegExp(`(^|[^\\w$.])${p}\\s*\\(`).test(i))r.push(a)}return r.sort(),h.set(o,r),r.slice()}function L(){let s=l.join(import.meta.dir,"composables"),o=import.meta.url.endsWith(".ts")?"ts":"js";if(E(l.join(s,`index.${o}`)))return s;let t=br("@stacksjs/stx/composables");return t?l.dirname(t):void 0}async function V(s,o){let t=M(s);if(t.length===0)return null;let i=o??L();if(!i)return null;let r=`${i}\x00${t.join(",")}`,a=u.get(r);if(a!==void 0)return a||null;let p=oe({loader:"ts",target:"browser",define:A()}),k=new Set(t),m=[],d=new Set,f=[];try{let n=new Bun.Glob("*.{ts,js}");for await(let e of n.scan({cwd:i,absolute:!0}))f.push(e)}catch{return u.set(r,""),null}f=P(f);for(let n of f){let e;try{e=await Bun.file(n).text()}catch{continue}let g=[];try{g=p.scan(e).exports.filter((c)=>c!=="default")}catch{continue}if(!g.some((c)=>k.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,""),m.push(`// ${l.basename(n).replace(/\.[jt]s$/,"")}
2
+ import"./chunk-mgh5rst1.js";import"./chunk-vk2jy6mn.js";import"./chunk-2a5g80mq.js";import"./chunk-9n5h4sqc.js";import{S,C,A,ie}from"./chunk-gz9pknbw.js";import"./chunk-3dqfjpz4.js";import"./chunk-eyx92t9n.js";import"./chunk-s93yh7ed.js";import{wr}from"./chunk-snv80b1b.js";import{existsSync as E}from"fs";import l from"path";var b=["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","useAnimationFrame","useAsyncData","useAttributeObserver","useAutoLogout","useAutoWakeLock","useBattery","useBreakpoint","useBreathPacer","useBroadcastChannel","useChannel","useChildListObserver","useClipboard","useColorHistory","useCompletion","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","useVirtualList","useVisibility","useWakeLock","useWindowSize"],_=new Set(b);var u=new Map,h=S(64),w=new Set,v=0,R=new Set(b);function z(){u.clear(),h.clear()}function P(s){let o=new Map;for(let t of s){let i=l.basename(t);if(i.endsWith(".d.ts"))continue;let r=i.replace(/\.[jt]s$/,"");if(r==="index")continue;if(r===i)continue;let a=o.get(r);if(a&&!a.endsWith(".js"))continue;o.set(r,t)}return[...o.values()].sort()}function I(s,o){let t=o.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");return new RegExp(`(?:^|[^\\w$.])(?:const|let|var|function|class)\\s+${t}\\b`).test(s)}function M(s){if(!s)return[];let o=C(s,v),t=h.get(o);if(t)return t.slice();let i=s.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,""),r=[];for(let a of R){if(w.has(a))continue;let p=a.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");if(new RegExp(`(^|[^\\w$.])${p}\\s*\\(`).test(i))r.push(a)}return r.sort(),h.set(o,r),r.slice()}function L(){let s=l.join(import.meta.dir,"composables"),o=import.meta.url.endsWith(".ts")?"ts":"js";if(E(l.join(s,`index.${o}`)))return s;let t=wr("@stacksjs/stx/composables");return t?l.dirname(t):void 0}async function V(s,o){let t=M(s);if(t.length===0)return null;let i=o??L();if(!i)return null;let r=`${i}\x00${t.join(",")}`,a=u.get(r);if(a!==void 0)return a||null;let p=ie({loader:"ts",target:"browser",define:A()}),k=new Set(t),m=[],d=new Set,f=[];try{let n=new Bun.Glob("*.{ts,js}");for await(let e of n.scan({cwd:i,absolute:!0}))f.push(e)}catch{return u.set(r,""),null}f=P(f);for(let n of f){let e;try{e=await Bun.file(n).text()}catch{continue}let g=[];try{g=p.scan(e).exports.filter((c)=>c!=="default")}catch{continue}if(!g.some((c)=>k.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,""),m.push(`// ${l.basename(n).replace(/\.[jt]s$/,"")}
3
3
  ${p.transformSync(e).trim()}`);for(let c of g)d.add(c)}catch(c){console.warn(`[stx] framework composable ${l.basename(n)} could not be bundled:`,c)}}let x=t.filter((n)=>!d.has(n)&&!I(s,n));if(x.length>0)console.warn(`[stx] could not bundle ${x.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(m.length===0)return u.set(r,""),null;let O=[...d].map((n)=>` try { if (!(${JSON.stringify(n)} in __s)) { __s[${JSON.stringify(n)}] = ${n}; if (!(${JSON.stringify(n)} in window)) window[${JSON.stringify(n)}] = ${n}; } } catch (e) {}`).join(`
4
4
  `),y=`<script data-stx-scoped data-stx-run="always" data-stx-framework-composables>
5
5
  ;(function(){
@@ -1,4 +1,4 @@
1
1
  // @bun
2
- import{P}from"./chunk-a02gt4tz.js";import{we}from"./chunk-rsxxajv6.js";function g(e,t){let r={};for(let n of e)r[n]=we(t(n));return new Proxy({},{get:(n,a)=>r[a]?.(),set:(n,a,o)=>{if(r[a])r[a].set(o);else r[a]=we(o);return!0},has:(n,a)=>(a in r),deleteProperty:(n,a)=>(delete r[a],!0),ownKeys:()=>Reflect.ownKeys(r),getOwnPropertyDescriptor:(n,a)=>(a in r)?{enumerable:!0,configurable:!0,writable:!0,value:r[a]()}:void 0})}function v(e,t){let r={};for(let n of t)r[n]=e[n];return r}function Fa(e,t){let r=Object.keys(e),n=g(r,(i)=>t?.[i]??e[i].getDefaultValue()),a=g(r,()=>[]),o=g(r,()=>!1),c=g(r,()=>!1),f=g(r,()=>!1),s=we(!1);async function u(i){f[i]=!0;let d=await e[i].validate(n[i],n);return a[i]=d,f[i]=!1,d.length===0}async function l(){s.set(!0);let i=await Promise.all(r.map(u));return s.set(!1),i.every(Boolean)}function m(){for(let i of r)n[i]=t?.[i]??e[i].getDefaultValue(),a[i]=[],o[i]=!1,c[i]=!1}function h(i){for(let d of r)if(d in i)n[d]=i[d],c[d]=!0}function b(i,d){n[i]=d,c[i]=!0}function y(i,d=!0){if(o[i]=d,d)u(i)}function p(i){return{value:n[i],errors:a[i],touched:o[i],dirty:c[i],valid:a[i].length===0,validating:f[i]}}function V(i){return async(d)=>{d?.preventDefault?.();for(let w of r)o[w]=!0;if(await l())await i(v(n,r))}}return{values:n,errors:a,touched:o,dirty:c,get isValid(){return r.every((i)=>a[i].length===0)},get isValidating(){return s()||r.some((i)=>f[i])},get isDirty(){return r.some((i)=>c[i])},validate:l,validateField:u,reset:m,setValues:h,setFieldValue:b,setFieldTouched:y,getFieldState:p,handleSubmit:V}}var Ou=Fa;class Qn{rules=[];defaultValue="";addRule(e){let t=new Qn;return t.rules=[...this.rules,e],t.defaultValue=this.defaultValue,t}required(e="This field is required"){return this.addRule({name:"required",message:e,validate:(t)=>{if(t===null||t===void 0)return e;if(typeof t==="string"&&t.trim()==="")return e;if(Array.isArray(t)&&t.length===0)return e;return!0}})}email(e="Please enter a valid email"){return this.addRule({name:"email",message:e,validate:(t)=>{if(!t)return!0;return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(String(t))||e}})}url(e="Please enter a valid URL"){return this.addRule({name:"url",message:e,validate:(t)=>{if(!t)return!0;try{return new URL(String(t)),!0}catch{return e}}})}min(e,t){let r=t||`Must be at least ${e} characters`;return this.addRule({name:"min",message:r,validate:(n)=>{if(!n)return!0;return String(n).length>=e||r}})}max(e,t){let r=t||`Must be no more than ${e} characters`;return this.addRule({name:"max",message:r,validate:(n)=>{if(!n)return!0;return String(n).length<=e||r}})}length(e,t,r){let n=r||`Must be between ${e} and ${t} characters`;return this.addRule({name:"length",message:n,validate:(a)=>{if(!a)return!0;let o=String(a).length;return o>=e&&o<=t||n}})}pattern(e,t="Invalid format"){return this.addRule({name:"pattern",message:t,validate:(r)=>{if(!r)return!0;return e.test(String(r))||t}})}hasUppercase(e="Must contain an uppercase letter"){return this.pattern(/[A-Z]/,e)}hasLowercase(e="Must contain a lowercase letter"){return this.pattern(/[a-z]/,e)}hasNumber(e="Must contain a number"){return this.pattern(/\d/,e)}hasSpecial(e="Must contain a special character"){return this.pattern(/[!@#$%^&*(),.?":{}|<>]/,e)}alphanumeric(e="Only letters and numbers allowed"){return this.pattern(/^[a-zA-Z0-9]+$/,e)}startsWithLetter(e="Must start with a letter"){return this.pattern(/^[a-zA-Z]/,e)}noSpaces(e="Spaces are not allowed"){return this.addRule({name:"noSpaces",message:e,validate:(t)=>{if(!t)return!0;return!String(t).includes(" ")||e}})}number(e="Must be a number"){let t=this.addRule({name:"number",message:e,validate:(r)=>{if(!r&&r!==0)return!0;return!Number.isNaN(Number(r))||e}});return t.defaultValue=0,t}integer(e="Must be a whole number"){return this.addRule({name:"integer",message:e,validate:(t)=>{if(!t&&t!==0)return!0;return Number.isInteger(Number(t))||e}})}positive(e="Must be a positive number"){return this.addRule({name:"positive",message:e,validate:(t)=>{if(!t&&t!==0)return!0;return Number(t)>0||e}})}negative(e="Must be a negative number"){return this.addRule({name:"negative",message:e,validate:(t)=>{if(!t&&t!==0)return!0;return Number(t)<0||e}})}minValue(e,t){let r=t||`Must be at least ${e}`;return this.addRule({name:"minValue",message:r,validate:(n)=>{if(!n&&n!==0)return!0;return Number(n)>=e||r}})}maxValue(e,t){let r=t||`Must be no more than ${e}`;return this.addRule({name:"maxValue",message:r,validate:(n)=>{if(!n&&n!==0)return!0;return Number(n)<=e||r}})}between(e,t,r){let n=r||`Must be between ${e} and ${t}`;return this.addRule({name:"between",message:n,validate:(a)=>{if(!a&&a!==0)return!0;let o=Number(a);return o>=e&&o<=t||n}})}matches(e,t){let r=t||`Must match ${e}`;return this.addRule({name:"matches",message:r,validate:(n,a)=>{if(!a)return!0;return n===a[e]||r}})}oneOf(e,t){let r=t||`Must be one of: ${e.join(", ")}`;return this.addRule({name:"oneOf",message:r,validate:(n)=>{if(!n)return!0;return e.includes(n)||r}})}notOneOf(e,t){let r=t||`Cannot be one of: ${e.join(", ")}`;return this.addRule({name:"notOneOf",message:r,validate:(n)=>{if(!n)return!0;return!e.includes(n)||r}})}date(e="Must be a valid date"){return this.addRule({name:"date",message:e,validate:(t)=>{if(!t)return!0;let r=new Date(String(t));return!Number.isNaN(r.getTime())||e}})}before(e,t){let r=new Date(e),n=t||`Must be before ${r.toLocaleDateString()}`;return this.addRule({name:"before",message:n,validate:(a)=>{if(!a)return!0;return new Date(String(a))<r||n}})}after(e,t){let r=new Date(e),n=t||`Must be after ${r.toLocaleDateString()}`;return this.addRule({name:"after",message:n,validate:(a)=>{if(!a)return!0;return new Date(String(a))>r||n}})}custom(e,t="Invalid value"){return this.addRule({name:"custom",message:t,validate:e})}async(e,t="Invalid value"){return this.addRule({name:"async",message:t,async:!0,validate:e})}when(e,t){let r=new Qn;r.rules=[...this.rules],r.defaultValue=this.defaultValue;for(let n of t.getRules())r.rules.push({...n,validate:(a,o)=>{if(!e(a,o||{}))return!0;return n.validate(a,o)}});return r}getRules(){return this.rules}getDefaultValue(){return this.defaultValue}default(e){let t=new Qn;return t.rules=[...this.rules],t.defaultValue=e,t}async validate(e,t){let r=[];for(let n of this.rules){let a=await n.validate(e,t);if(a!==!0)r.push(a)}return r}validateSync(e,t){let r=[];for(let n of this.rules){if(n.async)continue;let a=n.validate(e,t);if(a!==!0)r.push(a)}return r}}var ah=new Qn;function Nu(e,t,r){let n=/@error\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderror/g;return e.replace(n,(a,o,c)=>{try{let f=o.trim().split("."),s=t;for(let l of f)if(s&&typeof s==="object"&&l in s)s=s[l];else return"";let u=s;if(!u||!Array.isArray(u)||u.length===0)return"";return u.map((l)=>P(c,{...t,message:l},r)).join(`
3
- `)}catch{return""}})}function Mu(e,t,r){let n=/@errors\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderrors/g;return e.replace(n,(a,o,c)=>{try{let f=o.trim().split("."),s=t;for(let l of f)if(s&&typeof s==="object"&&l in s)s=s[l];else return"";let u=s;if(!u||!Array.isArray(u)||u.length===0)return"";return u.map((l)=>P(c,{...t,message:l},r)).join(`
4
- `)}catch{return""}})}function Du(e,t,r){let n=/@hasErrors\s*\(\s*([^)]+)\s*\)([\s\S]*?)@endhasErrors/g;return e.replace(n,(a,o,c)=>{try{let f=o.trim().split("."),s=t;for(let l of f)if(s&&typeof s==="object"&&l in s)s=s[l];else return"";let u=s;if(!u||!Array.isArray(u)||u.length===0)return"";return c}catch{return""}})}function ch(e,t,r){let n=e;return n=Nu(n,t,r),n=Mu(n,t,r),n=Du(n,t,r),n}export{Fa,Ou,Qn,ah,Nu,Mu,Du,ch};
2
+ import{P}from"./chunk-gz9pknbw.js";import{ve}from"./chunk-700m927w.js";function g(e,t){let r={};for(let n of e)r[n]=ve(t(n));return new Proxy({},{get:(n,a)=>r[a]?.(),set:(n,a,o)=>{if(r[a])r[a].set(o);else r[a]=ve(o);return!0},has:(n,a)=>(a in r),deleteProperty:(n,a)=>(delete r[a],!0),ownKeys:()=>Reflect.ownKeys(r),getOwnPropertyDescriptor:(n,a)=>(a in r)?{enumerable:!0,configurable:!0,writable:!0,value:r[a]()}:void 0})}function v(e,t){let r={};for(let n of t)r[n]=e[n];return r}function Ha(e,t){let r=Object.keys(e),n=g(r,(i)=>t?.[i]??e[i].getDefaultValue()),a=g(r,()=>[]),o=g(r,()=>!1),c=g(r,()=>!1),f=g(r,()=>!1),s=ve(!1);async function u(i){f[i]=!0;let d=await e[i].validate(n[i],n);return a[i]=d,f[i]=!1,d.length===0}async function l(){s.set(!0);let i=await Promise.all(r.map(u));return s.set(!1),i.every(Boolean)}function m(){for(let i of r)n[i]=t?.[i]??e[i].getDefaultValue(),a[i]=[],o[i]=!1,c[i]=!1}function h(i){for(let d of r)if(d in i)n[d]=i[d],c[d]=!0}function b(i,d){n[i]=d,c[i]=!0}function y(i,d=!0){if(o[i]=d,d)u(i)}function p(i){return{value:n[i],errors:a[i],touched:o[i],dirty:c[i],valid:a[i].length===0,validating:f[i]}}function V(i){return async(d)=>{d?.preventDefault?.();for(let w of r)o[w]=!0;if(await l())await i(v(n,r))}}return{values:n,errors:a,touched:o,dirty:c,get isValid(){return r.every((i)=>a[i].length===0)},get isValidating(){return s()||r.some((i)=>f[i])},get isDirty(){return r.some((i)=>c[i])},validate:l,validateField:u,reset:m,setValues:h,setFieldValue:b,setFieldTouched:y,getFieldState:p,handleSubmit:V}}var Mu=Ha;class er{rules=[];defaultValue="";addRule(e){let t=new er;return t.rules=[...this.rules,e],t.defaultValue=this.defaultValue,t}required(e="This field is required"){return this.addRule({name:"required",message:e,validate:(t)=>{if(t===null||t===void 0)return e;if(typeof t==="string"&&t.trim()==="")return e;if(Array.isArray(t)&&t.length===0)return e;return!0}})}email(e="Please enter a valid email"){return this.addRule({name:"email",message:e,validate:(t)=>{if(!t)return!0;return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(String(t))||e}})}url(e="Please enter a valid URL"){return this.addRule({name:"url",message:e,validate:(t)=>{if(!t)return!0;try{return new URL(String(t)),!0}catch{return e}}})}min(e,t){let r=t||`Must be at least ${e} characters`;return this.addRule({name:"min",message:r,validate:(n)=>{if(!n)return!0;return String(n).length>=e||r}})}max(e,t){let r=t||`Must be no more than ${e} characters`;return this.addRule({name:"max",message:r,validate:(n)=>{if(!n)return!0;return String(n).length<=e||r}})}length(e,t,r){let n=r||`Must be between ${e} and ${t} characters`;return this.addRule({name:"length",message:n,validate:(a)=>{if(!a)return!0;let o=String(a).length;return o>=e&&o<=t||n}})}pattern(e,t="Invalid format"){return this.addRule({name:"pattern",message:t,validate:(r)=>{if(!r)return!0;return e.test(String(r))||t}})}hasUppercase(e="Must contain an uppercase letter"){return this.pattern(/[A-Z]/,e)}hasLowercase(e="Must contain a lowercase letter"){return this.pattern(/[a-z]/,e)}hasNumber(e="Must contain a number"){return this.pattern(/\d/,e)}hasSpecial(e="Must contain a special character"){return this.pattern(/[!@#$%^&*(),.?":{}|<>]/,e)}alphanumeric(e="Only letters and numbers allowed"){return this.pattern(/^[a-zA-Z0-9]+$/,e)}startsWithLetter(e="Must start with a letter"){return this.pattern(/^[a-zA-Z]/,e)}noSpaces(e="Spaces are not allowed"){return this.addRule({name:"noSpaces",message:e,validate:(t)=>{if(!t)return!0;return!String(t).includes(" ")||e}})}number(e="Must be a number"){let t=this.addRule({name:"number",message:e,validate:(r)=>{if(!r&&r!==0)return!0;return!Number.isNaN(Number(r))||e}});return t.defaultValue=0,t}integer(e="Must be a whole number"){return this.addRule({name:"integer",message:e,validate:(t)=>{if(!t&&t!==0)return!0;return Number.isInteger(Number(t))||e}})}positive(e="Must be a positive number"){return this.addRule({name:"positive",message:e,validate:(t)=>{if(!t&&t!==0)return!0;return Number(t)>0||e}})}negative(e="Must be a negative number"){return this.addRule({name:"negative",message:e,validate:(t)=>{if(!t&&t!==0)return!0;return Number(t)<0||e}})}minValue(e,t){let r=t||`Must be at least ${e}`;return this.addRule({name:"minValue",message:r,validate:(n)=>{if(!n&&n!==0)return!0;return Number(n)>=e||r}})}maxValue(e,t){let r=t||`Must be no more than ${e}`;return this.addRule({name:"maxValue",message:r,validate:(n)=>{if(!n&&n!==0)return!0;return Number(n)<=e||r}})}between(e,t,r){let n=r||`Must be between ${e} and ${t}`;return this.addRule({name:"between",message:n,validate:(a)=>{if(!a&&a!==0)return!0;let o=Number(a);return o>=e&&o<=t||n}})}matches(e,t){let r=t||`Must match ${e}`;return this.addRule({name:"matches",message:r,validate:(n,a)=>{if(!a)return!0;return n===a[e]||r}})}oneOf(e,t){let r=t||`Must be one of: ${e.join(", ")}`;return this.addRule({name:"oneOf",message:r,validate:(n)=>{if(!n)return!0;return e.includes(n)||r}})}notOneOf(e,t){let r=t||`Cannot be one of: ${e.join(", ")}`;return this.addRule({name:"notOneOf",message:r,validate:(n)=>{if(!n)return!0;return!e.includes(n)||r}})}date(e="Must be a valid date"){return this.addRule({name:"date",message:e,validate:(t)=>{if(!t)return!0;let r=new Date(String(t));return!Number.isNaN(r.getTime())||e}})}before(e,t){let r=new Date(e),n=t||`Must be before ${r.toLocaleDateString()}`;return this.addRule({name:"before",message:n,validate:(a)=>{if(!a)return!0;return new Date(String(a))<r||n}})}after(e,t){let r=new Date(e),n=t||`Must be after ${r.toLocaleDateString()}`;return this.addRule({name:"after",message:n,validate:(a)=>{if(!a)return!0;return new Date(String(a))>r||n}})}custom(e,t="Invalid value"){return this.addRule({name:"custom",message:t,validate:e})}async(e,t="Invalid value"){return this.addRule({name:"async",message:t,async:!0,validate:e})}when(e,t){let r=new er;r.rules=[...this.rules],r.defaultValue=this.defaultValue;for(let n of t.getRules())r.rules.push({...n,validate:(a,o)=>{if(!e(a,o||{}))return!0;return n.validate(a,o)}});return r}getRules(){return this.rules}getDefaultValue(){return this.defaultValue}default(e){let t=new er;return t.rules=[...this.rules],t.defaultValue=e,t}async validate(e,t){let r=[];for(let n of this.rules){let a=await n.validate(e,t);if(a!==!0)r.push(a)}return r}validateSync(e,t){let r=[];for(let n of this.rules){if(n.async)continue;let a=n.validate(e,t);if(a!==!0)r.push(a)}return r}}var lh=new er;function Du(e,t,r){let n=/@error\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderror/g;return e.replace(n,(a,o,c)=>{try{let f=o.trim().split("."),s=t;for(let l of f)if(s&&typeof s==="object"&&l in s)s=s[l];else return"";let u=s;if(!u||!Array.isArray(u)||u.length===0)return"";return u.map((l)=>P(c,{...t,message:l},r)).join(`
3
+ `)}catch{return""}})}function Lu(e,t,r){let n=/@errors\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderrors/g;return e.replace(n,(a,o,c)=>{try{let f=o.trim().split("."),s=t;for(let l of f)if(s&&typeof s==="object"&&l in s)s=s[l];else return"";let u=s;if(!u||!Array.isArray(u)||u.length===0)return"";return u.map((l)=>P(c,{...t,message:l},r)).join(`
4
+ `)}catch{return""}})}function ju(e,t,r){let n=/@hasErrors\s*\(\s*([^)]+)\s*\)([\s\S]*?)@endhasErrors/g;return e.replace(n,(a,o,c)=>{try{let f=o.trim().split("."),s=t;for(let l of f)if(s&&typeof s==="object"&&l in s)s=s[l];else return"";let u=s;if(!u||!Array.isArray(u)||u.length===0)return"";return c}catch{return""}})}function uh(e,t,r){let n=e;return n=Du(n,t,r),n=Lu(n,t,r),n=ju(n,t,r),n}export{Ha,Mu,er,lh,Du,Lu,ju,uh};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import l from"fs";import u from"path";var m=/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useModel)\s*(?:<[^<>()]*>)?\s*\(/,g=/(?:^|\n)\s*(?:import|export)\s+(?:[^'"]*?\sfrom\s+)?['"](\.[^'"]*)['"]/g,b=["",".ts",".tsx",".js",".jsx",".mts",".mjs","/index.ts","/index.js"],x=3;function h(e,t){let r=u.resolve(u.dirname(t),e);for(let o of b){let s=r+o;try{if(l.statSync(s).isFile())return s}catch{}}return null}function Kr(e,t,r=0,o=new Set){if(!t||r>=x)return!1;for(let s of e.matchAll(g)){let n=h(s[1],t);if(!n||o.has(n))continue;o.add(n);let i;try{i=l.readFileSync(n,"utf8")}catch{continue}if(m.test(i))return!0;if(Kr(i,n,r+1,o))return!0}return!1}var _=["batch","cachedQuery","clearServerData","computed","configureFetch","defineEmits","defineExpose","definePageMeta","defineProps","defineSlots","defineStore","derived","effect","flushKeptState","forgetKeptState","goBack","goForward","inject","invalidateRoute","isDerived","isSignal","keptState","memo","navigate","nextTick","onBeforeMount","onBeforeUnmount","onDestroy","onMount","onMounted","onUnmounted","peek","provide","reactive","ref","refDebounced","refresh","registerStoresClient","setKeptScope","setRouteParams","sharedRequest","state","untrack","useAsync","useBroadcastStream","useClickOutside","useColorMode","useCookie","useCounter","useDark","useDebounce","useDebounceFn","useDebouncedValue","useDocumentVisibility","useEventListener","useFetch","useFocus","useHead","useId","useInterval","useLocalStorage","useMediaQuery","useModel","useMutation","useNativeDesktop","useOptimistic","usePreferredContrast","usePreferredDark","usePreferredLight","usePreferredReducedMotion","useQuery","useReactiveProp","useRef","useRoute","useRouteParam","useRouteParams","useScrollLock","useSearchParams","useSeoMeta","useSessionStorage","useSlots","useStore","useThrottle","useThrottleFn","useTimeout","useTimeoutFn","useToggle","useWebSocket","watch","watchEffect","watchMultiple","withDefaults"],Ll=["onMount","onDestroy"];function wt(e="const",t=[],r){let o=t.length?_.filter((s)=>!t.includes(s)):_;if(r!==void 0)o=o.filter((s)=>{let n=s.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");return new RegExp(`(^|[^\\w$])${n}(?![\\w$])`).test(r)});return`${e} { ${o.join(", ")} } = window.stx;`}var y=["defineEmits","defineExpose","definePageMeta","defineProps","defineSlots","withDefaults"];var S=_.filter((e)=>!y.includes(e));function Qi(e){if(!e)return!1;return S.some((t)=>new RegExp(`\\b${t}\\s*(?:<[^>]*>)?\\s*\\(`).test(e))}var v=[/@if\s*=/,/@for\s*=/,/@show\s*=/,/@model\s*=/,/@bind:/,/@class\s*=/,/@style\s*=/,/\bx-data\s*=/,/\bstate\s*(?:<[^>]*>)?\s*\(/,/\bderived\s*(?:<[^>]*>)?\s*\(/,/\beffect\s*(?:<[^>]*>)?\s*\(/,/\bref\s*(?:<[^>]*>)?\s*\(/,/\bcomputed\s*(?:<[^>]*>)?\s*\(/,/\breactive\s*(?:<[^>]*>)?\s*\(/,/\bwatch\s*(?:<[^>]*>)?\s*\(/,/\bwatchEffect\s*(?:<[^>]*>)?\s*\(/,/\s:[a-z][\w-]*\s*=\s*["']/i,/\s:(?:if|else-if|else|for|show|text|html|model)\s*=/,/data-stx(?:-auto)?(?![-\w])/,/data-stx-scoped/],E=/\s@[a-z][\w.:-]*\s*=/i;function jl(e,t){if(!e)return!1;let r=f(e);return d(r,t)}function d(e,t){if(v.some((r)=>r.test(e)))return!0;if(Qi(e))return!0;return T(e,t)}function T(e,t){if(!t)return!1;for(let r of e.matchAll(/<script\b(?![^>]*\bserver\b)(?![^>]*\bsrc\s*=)[^>]*>([\s\S]*?)<\/script\s*>/gi))if(Kr(r[1],t))return!0;return!1}function Bl(e,t){if(!e)return!1;let r=f(e);return E.test(r)||d(r,t)}var R=["if","else-if","elseif","else","for","show","key","text","html","model","ref"];function Fl(e){return R.includes(e.toLowerCase())}var ho=["x-text","x-html","x-model","x-show","x-if","x-for","x-cloak","x-ref","x-data","x-bind","x-class","x-style","x-tooltip","x-tooltip-position"],w=["x-init","x-transition","x-effect","x-on"],zl=[...ho,...w];function Hl(){return`{${ho.map((e)=>`'${e}':1`).join(",")}}`}var ea=["class","style","text","html","show","model","if","ref"];function Vl(){return`{${ea.map((e)=>e==="if"?"'if':1":`${e}:1`).join(",")}}`}var p=["click","dblclick","mousedown","mouseup","mousemove","mouseenter","mouseleave","keydown","keyup","keypress","input","change","submit","focus","blur","scroll","resize","touchstart","touchend","touchmove","contextmenu","wheel","pointerdown","pointerup","pointermove"];function Ul(){return`/^(${p.join("|")})(?:\\.|$)/`}function Wl(e){return p.some((t)=>e===t||e.startsWith(`${t}.`))}var A=65536,N=4,c=new Map;function f(e){if(!e)return e;if(!e.includes("<!--")&&!/<(?:pre|code)\b/i.test(e))return e;let t=e.length>=A;if(t){let s=c.get(e);if(s!==void 0)return s}let r=(s)=>s.replace(/(<[^>]*>)|([^<]+)/g,(n,i,a)=>i??" ".repeat(a.length)),o=e.replace(/(<pre\b[^>]*>)([\s\S]*?)(<\/pre>)/gi,(s,n,i,a)=>n+r(i)+a).replace(/(<code\b[^>]*>)([\s\S]*?)(<\/code>)/gi,(s,n,i,a)=>n+r(i)+a).replace(/<!--[\s\S]*?-->/g,(s)=>" ".repeat(s.length));if(t){while(c.size>=N){let s=c.keys().next();if(s.done)break;c.delete(s.value)}c.set(e,o)}return o}
3
- export{Kr,_,Ll,wt,Qi,jl,Bl,Fl,ho,zl,Hl,ea,Vl,Ul,Wl};
2
+ import l from"fs";import u from"path";var m=/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useModel)\s*(?:<[^<>()]*>)?\s*\(/,g=/(?:^|\n)\s*(?:import|export)\s+(?:[^'"]*?\sfrom\s+)?['"](\.[^'"]*)['"]/g,b=["",".ts",".tsx",".js",".jsx",".mts",".mjs","/index.ts","/index.js"],x=3;function h(e,t){let r=u.resolve(u.dirname(t),e);for(let o of b){let s=r+o;try{if(l.statSync(s).isFile())return s}catch{}}return null}function Jr(e,t,r=0,o=new Set){if(!t||r>=x)return!1;for(let s of e.matchAll(g)){let n=h(s[1],t);if(!n||o.has(n))continue;o.add(n);let i;try{i=l.readFileSync(n,"utf8")}catch{continue}if(m.test(i))return!0;if(Jr(i,n,r+1,o))return!0}return!1}var _=["batch","cachedQuery","clearServerData","computed","configureFetch","defineEmits","defineExpose","definePageMeta","defineProps","defineSlots","defineStore","derived","effect","flushKeptState","forgetKeptState","goBack","goForward","inject","invalidateRoute","isDerived","isSignal","keptState","memo","navigate","nextTick","onBeforeMount","onBeforeUnmount","onDestroy","onMount","onMounted","onUnmounted","peek","provide","reactive","ref","refDebounced","refresh","registerStoresClient","setKeptScope","setRouteParams","sharedRequest","state","untrack","useAsync","useBroadcastStream","useClickOutside","useColorMode","useCookie","useCounter","useDark","useDebounce","useDebounceFn","useDebouncedValue","useDocumentVisibility","useEventListener","useFetch","useFocus","useHead","useId","useInterval","useLocalStorage","useMediaQuery","useModel","useMutation","useNativeDesktop","useOptimistic","usePreferredContrast","usePreferredDark","usePreferredLight","usePreferredReducedMotion","useQuery","useReactiveProp","useRef","useRoute","useRouteParam","useRouteParams","useScrollLock","useSearchParams","useSeoMeta","useSessionStorage","useSlots","useStore","useThrottle","useThrottleFn","useTimeout","useTimeoutFn","useToggle","useWebSocket","watch","watchEffect","watchMultiple","withDefaults"],Bl=["onMount","onDestroy"];function wt(e="const",t=[],r){let o=t.length?_.filter((s)=>!t.includes(s)):_;if(r!==void 0)o=o.filter((s)=>{let n=s.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");return new RegExp(`(^|[^\\w$])${n}(?![\\w$])`).test(r)});return`${e} { ${o.join(", ")} } = window.stx;`}var y=["defineEmits","defineExpose","definePageMeta","defineProps","defineSlots","withDefaults"];var S=_.filter((e)=>!y.includes(e));function ta(e){if(!e)return!1;return S.some((t)=>new RegExp(`\\b${t}\\s*(?:<[^>]*>)?\\s*\\(`).test(e))}var v=[/@if\s*=/,/@for\s*=/,/@show\s*=/,/@model\s*=/,/@bind:/,/@class\s*=/,/@style\s*=/,/\bx-data\s*=/,/\bstate\s*(?:<[^>]*>)?\s*\(/,/\bderived\s*(?:<[^>]*>)?\s*\(/,/\beffect\s*(?:<[^>]*>)?\s*\(/,/\bref\s*(?:<[^>]*>)?\s*\(/,/\bcomputed\s*(?:<[^>]*>)?\s*\(/,/\breactive\s*(?:<[^>]*>)?\s*\(/,/\bwatch\s*(?:<[^>]*>)?\s*\(/,/\bwatchEffect\s*(?:<[^>]*>)?\s*\(/,/\s:[a-z][\w-]*\s*=\s*["']/i,/\s:(?:if|else-if|else|for|show|text|html|model)\s*=/,/data-stx(?:-auto)?(?![-\w])/,/data-stx-scoped/],E=/\s@[a-z][\w.:-]*\s*=/i;function Fl(e,t){if(!e)return!1;let r=f(e);return d(r,t)}function d(e,t){if(v.some((r)=>r.test(e)))return!0;if(ta(e))return!0;return T(e,t)}function T(e,t){if(!t)return!1;for(let r of e.matchAll(/<script\b(?![^>]*\bserver\b)(?![^>]*\bsrc\s*=)[^>]*>([\s\S]*?)<\/script\s*>/gi))if(Jr(r[1],t))return!0;return!1}function zl(e,t){if(!e)return!1;let r=f(e);return E.test(r)||d(r,t)}var R=["if","else-if","elseif","else","for","show","key","text","html","model","ref"];function Hl(e){return R.includes(e.toLowerCase())}var wo=["x-text","x-html","x-model","x-show","x-if","x-for","x-cloak","x-ref","x-data","x-bind","x-class","x-style","x-tooltip","x-tooltip-position"],w=["x-init","x-transition","x-effect","x-on"],Vl=[...wo,...w];function Ul(){return`{${wo.map((e)=>`'${e}':1`).join(",")}}`}var na=["class","style","text","html","show","model","if","ref"];function Wl(){return`{${na.map((e)=>e==="if"?"'if':1":`${e}:1`).join(",")}}`}var p=["click","dblclick","mousedown","mouseup","mousemove","mouseenter","mouseleave","keydown","keyup","keypress","input","change","submit","focus","blur","scroll","resize","touchstart","touchend","touchmove","contextmenu","wheel","pointerdown","pointerup","pointermove"];function ql(){return`/^(${p.join("|")})(?:\\.|$)/`}function Kl(e){return p.some((t)=>e===t||e.startsWith(`${t}.`))}var A=65536,N=4,c=new Map;function f(e){if(!e)return e;if(!e.includes("<!--")&&!/<(?:pre|code)\b/i.test(e))return e;let t=e.length>=A;if(t){let s=c.get(e);if(s!==void 0)return s}let r=(s)=>s.replace(/(<[^>]*>)|([^<]+)/g,(n,i,a)=>i??" ".repeat(a.length)),o=e.replace(/(<pre\b[^>]*>)([\s\S]*?)(<\/pre>)/gi,(s,n,i,a)=>n+r(i)+a).replace(/(<code\b[^>]*>)([\s\S]*?)(<\/code>)/gi,(s,n,i,a)=>n+r(i)+a).replace(/<!--[\s\S]*?-->/g,(s)=>" ".repeat(s.length));if(t){while(c.size>=N){let s=c.keys().next();if(s.done)break;c.delete(s.value)}c.set(e,o)}return o}
3
+ export{Jr,_,Bl,wt,ta,Fl,zl,Hl,wo,Vl,Ul,na,Wl,ql,Kl};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{xt,St,kt}from"./chunk-zek9t5za.js";import{tn,nn,vt,ha,rn,sn}from"./chunk-g2xy0z0e.js";import o from"fs";import i from"path";var c=[];function m(a){c=[];for(let e of a.storyFiles)if(c.push({text:e.fileName.toLowerCase(),original:e.fileName,type:"story",storyId:e.id}),c.push({text:e.relativePath.toLowerCase(),original:e.relativePath,type:"story",storyId:e.id}),e.story)for(let t of e.story.variants)c.push({text:t.title.toLowerCase(),original:t.title,type:"story",storyId:e.id,variantId:t.id})}function f(){return JSON.stringify(c)}async function F(a={}){let e=Date.now();tn();let t=await xt({mode:"build"});if(!t.config.enabled){vt("Story feature is disabled in config.");return}let n=await rn(t);St(t,n);let l=sn(t.config,n);kt(t,l),nn(n.length);let d=a.outDir??t.config.outDir,s=i.resolve(t.root,d);await o.promises.mkdir(s,{recursive:!0}),console.log(` Building to ${d}...`);let g=v(t);await o.promises.writeFile(i.join(s,"index.html"),g);let y={files:n.map((r)=>({id:r.id,fileName:r.fileName,relativePath:r.relativePath,treePath:r.treePath})),tree:l};await o.promises.writeFile(i.join(s,"stories.json"),JSON.stringify(y,null,2));let u={theme:t.config.theme,responsivePresets:t.config.responsivePresets,backgroundPresets:t.config.backgroundPresets};await o.promises.writeFile(i.join(s,"config.json"),JSON.stringify(u,null,2));let p=i.join(s,"stories");await o.promises.mkdir(p,{recursive:!0});for(let r of n){let b=await o.promises.readFile(r.path,"utf-8");await o.promises.writeFile(i.join(p,`${r.id}.stx`),b)}m(t);let h=f();await o.promises.writeFile(i.join(s,"search-index.json"),h);let x=Date.now()-e;ha(n.length,d,x)}function v(a){let{theme:e}=a.config,t=e.title||"STX Story";return`<!DOCTYPE html>
2
+ import{xt,St,kt}from"./chunk-zek9t5za.js";import{en,tn,vt,ba,nn,rn}from"./chunk-zwwhpxp7.js";import o from"fs";import i from"path";var c=[];function m(a){c=[];for(let e of a.storyFiles)if(c.push({text:e.fileName.toLowerCase(),original:e.fileName,type:"story",storyId:e.id}),c.push({text:e.relativePath.toLowerCase(),original:e.relativePath,type:"story",storyId:e.id}),e.story)for(let t of e.story.variants)c.push({text:t.title.toLowerCase(),original:t.title,type:"story",storyId:e.id,variantId:t.id})}function f(){return JSON.stringify(c)}async function F(a={}){let e=Date.now();en();let t=await xt({mode:"build"});if(!t.config.enabled){vt("Story feature is disabled in config.");return}let n=await nn(t);St(t,n);let l=rn(t.config,n);kt(t,l),tn(n.length);let d=a.outDir??t.config.outDir,s=i.resolve(t.root,d);await o.promises.mkdir(s,{recursive:!0}),console.log(` Building to ${d}...`);let g=v(t);await o.promises.writeFile(i.join(s,"index.html"),g);let y={files:n.map((r)=>({id:r.id,fileName:r.fileName,relativePath:r.relativePath,treePath:r.treePath})),tree:l};await o.promises.writeFile(i.join(s,"stories.json"),JSON.stringify(y,null,2));let u={theme:t.config.theme,responsivePresets:t.config.responsivePresets,backgroundPresets:t.config.backgroundPresets};await o.promises.writeFile(i.join(s,"config.json"),JSON.stringify(u,null,2));let p=i.join(s,"stories");await o.promises.mkdir(p,{recursive:!0});for(let r of n){let b=await o.promises.readFile(r.path,"utf-8");await o.promises.writeFile(i.join(p,`${r.id}.stx`),b)}m(t);let h=f();await o.promises.writeFile(i.join(s,"search-index.json"),h);let x=Date.now()-e;ba(n.length,d,x)}function v(a){let{theme:e}=a.config,t=e.title||"STX Story";return`<!DOCTYPE html>
3
3
  <html lang="en">
4
4
  <head>
5
5
  <meta charset="UTF-8">
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{t}from"./chunk-zpj6ggee.js";function y(e,i,s=240){return e.slice(i,i+s)}var v=[{rule:"route-params",pattern:/\blocation\s*\.\s*pathname\s*\.\s*(?:match|split)\s*\(/g,primitive:"useRoute() / useRouteParams() / useRouteParam(name)",why:"parsing the URL by hand re-implements the router and does not update on SPA navigation"},{rule:"alert",pattern:/(?<![.#\w$])(?:(?:window|globalThis)\s*\.\s*)?alert\s*\(/g,primitive:"stxAlert(message)",why:"themed, focus-trapped and non-blocking \u2014 but `await` it if the code after it "+"depended on the native dialog blocking until dismissal",reject:(e)=>/\b(?:async\s+)?function\s+alert\s*\(/.test(e)||/\b(?:const|let|var)\s+alert\s*=/.test(e)},{rule:"search-params",pattern:/new\s+URLSearchParams\s*\(/g,primitive:"useSearchParams()",why:"reactive, and writes back through the router instead of history.replaceState",reject:(e,i)=>{let s=e.indexOf("(",i);if(s===-1)return!0;let o=e.slice(s+1,e.indexOf(")",s)+1);return!/\b(?:location|search|href|url)\b/i.test(o)}},{rule:"navigate",pattern:/\blocation\s*\.\s*(?:assign|replace)\s*\(|\blocation\s*\.\s*href\s*=/g,primitive:"navigate(path) / goBack()",why:"a full document load throws away every store and the scroll position; navigate() is an SPA transition",reject:(e,i)=>/^[^\n]*?(?:['"`]\s*)?(?:mailto:|tel:|sms:|https?:\/\/|\/\/)/.test(y(e,i,160))},{rule:"fetch",pattern:/new\s+AbortController\s*\(/g,primitive:"useFetch(url) / useAsyncData(key, fn)",why:"cancellation, loading and error state are already wired; hand-rolling them is where the races live"},{rule:"polling",pattern:/setInterval\s*\(/g,primitive:"useEventSource() / useSSE() / useWebSocket() / useChannel()",why:"polling burns requests and lags; the push primitives are delivered",reject:(e,i)=>!/\bfetch\s*\(|\$fetch\b|useFetch\b|\.get\s*\(|axios\b/.test(y(e,i))},{rule:"debounce",pattern:/\bclearTimeout\s*\(/g,primitive:"useDebounce(fn, ms) / useThrottle(fn, ms)",why:"a hand-held timer handle per call site is the usual source of stale-result bugs",requires:(e)=>/setTimeout\s*\(/.test(e)},{rule:"click-outside",pattern:/document\s*\.\s*addEventListener\s*\(\s*['"](?:click|mousedown|pointerdown)['"]/g,primitive:"useClickOutside(ref, fn)",why:"the document-level listener plus the blur race is exactly what this composable exists to remove"},{rule:"focus",pattern:/\.\s*(?:getElementById|querySelector)\s*\([^)]*\)\s*(?:\?\.)?\s*\.?focus\s*\(/g,primitive:"useFocus(ref) with x-ref",why:"a query by id breaks under nested scopes and SPA navigation; a ref does not"},{rule:"clipboard",pattern:/navigator\s*\.\s*(?:clipboard|share)\b/g,primitive:"useClipboard() / useShare()",why:"permission state, the copied flag and the unsupported-browser fallback are already handled"},{rule:"watch",pattern:/\beffect\s*\(\s*\(\s*\)\s*=>\s*\{[^}]*\bvoid\s+\w+\s*\(\s*\)/g,primitive:"watch(source, cb) / watchMultiple([...], cb)",why:"the `void a(); void b()` dance is a manual dependency list; watch takes one directly"}],C=["confirm","tooltip",...v.map((e)=>e.rule)];function g(e,i){let s=1;for(let o=0;o<i;o++)if(e[o]===`
2
+ import{t}from"./chunk-3hsv6ejp.js";function y(e,i,s=240){return e.slice(i,i+s)}var v=[{rule:"route-params",pattern:/\blocation\s*\.\s*pathname\s*\.\s*(?:match|split)\s*\(/g,primitive:"useRoute() / useRouteParams() / useRouteParam(name)",why:"parsing the URL by hand re-implements the router and does not update on SPA navigation"},{rule:"alert",pattern:/(?<![.#\w$])(?:(?:window|globalThis)\s*\.\s*)?alert\s*\(/g,primitive:"stxAlert(message)",why:"themed, focus-trapped and non-blocking \u2014 but `await` it if the code after it "+"depended on the native dialog blocking until dismissal",reject:(e)=>/\b(?:async\s+)?function\s+alert\s*\(/.test(e)||/\b(?:const|let|var)\s+alert\s*=/.test(e)},{rule:"search-params",pattern:/new\s+URLSearchParams\s*\(/g,primitive:"useSearchParams()",why:"reactive, and writes back through the router instead of history.replaceState",reject:(e,i)=>{let s=e.indexOf("(",i);if(s===-1)return!0;let o=e.slice(s+1,e.indexOf(")",s)+1);return!/\b(?:location|search|href|url)\b/i.test(o)}},{rule:"navigate",pattern:/\blocation\s*\.\s*(?:assign|replace)\s*\(|\blocation\s*\.\s*href\s*=/g,primitive:"navigate(path) / goBack()",why:"a full document load throws away every store and the scroll position; navigate() is an SPA transition",reject:(e,i)=>/^[^\n]*?(?:['"`]\s*)?(?:mailto:|tel:|sms:|https?:\/\/|\/\/)/.test(y(e,i,160))},{rule:"fetch",pattern:/new\s+AbortController\s*\(/g,primitive:"useFetch(url) / useAsyncData(key, fn)",why:"cancellation, loading and error state are already wired; hand-rolling them is where the races live"},{rule:"polling",pattern:/setInterval\s*\(/g,primitive:"useEventSource() / useSSE() / useWebSocket() / useChannel()",why:"polling burns requests and lags; the push primitives are delivered",reject:(e,i)=>!/\bfetch\s*\(|\$fetch\b|useFetch\b|\.get\s*\(|axios\b/.test(y(e,i))},{rule:"debounce",pattern:/\bclearTimeout\s*\(/g,primitive:"useDebounce(fn, ms) / useThrottle(fn, ms)",why:"a hand-held timer handle per call site is the usual source of stale-result bugs",requires:(e)=>/setTimeout\s*\(/.test(e)},{rule:"click-outside",pattern:/document\s*\.\s*addEventListener\s*\(\s*['"](?:click|mousedown|pointerdown)['"]/g,primitive:"useClickOutside(ref, fn)",why:"the document-level listener plus the blur race is exactly what this composable exists to remove"},{rule:"focus",pattern:/\.\s*(?:getElementById|querySelector)\s*\([^)]*\)\s*(?:\?\.)?\s*\.?focus\s*\(/g,primitive:"useFocus(ref) with x-ref",why:"a query by id breaks under nested scopes and SPA navigation; a ref does not"},{rule:"clipboard",pattern:/navigator\s*\.\s*(?:clipboard|share)\b/g,primitive:"useClipboard() / useShare()",why:"permission state, the copied flag and the unsupported-browser fallback are already handled"},{rule:"watch",pattern:/\beffect\s*\(\s*\(\s*\)\s*=>\s*\{[^}]*\bvoid\s+\w+\s*\(\s*\)/g,primitive:"watch(source, cb) / watchMultiple([...], cb)",why:"the `void a(); void b()` dance is a manual dependency list; watch takes one directly"}],C=["confirm","tooltip",...v.map((e)=>e.rule)];function g(e,i){let s=1;for(let o=0;o<i;o++)if(e[o]===`
3
3
  `)s++;return s}function b(e,i){let s=e.lastIndexOf(`
4
4
  `,i)+1,o=e.indexOf(`
5
5
  `,i);return e.slice(s,o===-1?e.length:o).trim().slice(0,120)}function S(e,i){let s=e.slice(0,i),o=s.lastIndexOf("function"),l=s.lastIndexOf("=>"),r=Math.max(o,l);if(r===-1)return!1;let n=e.slice(Math.max(0,r-120),r);return/\basync\b[^;{}]*$/.test(n)}function k(e){return/\b(?:async\s+)?function\s+confirm\s*\(/.test(e)||/\b(?:const|let|var)\s+confirm\s*=/.test(e)||/\bimport\s*\{[^}]*\bconfirm\b[^}]*\}/.test(e)}function A(e,i,s){if(k(e))return e;let o=/(^|[^\w$.])(?:(?:window|globalThis)\s*\.\s*)?confirm\s*\(/g,l=m(e),r="",n=0,a;while((a=o.exec(l))!==null){let c=a.index+a[1].length,u=g(e,c),d=b(e,c);if(/stxConfirm\s*\($/.test(e.slice(0,c+8)))continue;let p=S(e,c);if(s.push({file:i,line:u,rule:"confirm",applied:p,snippet:d,reason:p?void 0:"stxConfirm() returns a Promise and native confirm() is synchronous, so this needs `await` inside an async function. Rewriting it here would make the condition always true."}),p)r+=e.slice(n,c)+"await stxConfirm(",n=c+(a[0].length-a[1].length)}return r+e.slice(n)}function E(e,i,s){let o=/(<[a-z][\w-]*\b[^>]*?)\stitle=(["'])(.*?)\2/gis,l=R(e),r="",n=0,a;while((a=o.exec(l))!==null){let[c,u,d,p]=a,h=g(e,a.index),f=b(e,a.index),w=u.match(/^<([A-Za-z][\w-]*)/)?.[1]??"";if(/^[A-Z]/.test(w)){s.push({file:i,line:h,rule:"tooltip",applied:!1,snippet:f,reason:`\`title\` on <${w}> is a component prop, not an HTML attribute \u2014 `+"adding x-tooltip here would put a tooltip on a component and may duplicate text it already renders."});continue}if(/\bx-tooltip[=\s]/.test(u)||p.trim()===""){s.push({file:i,line:h,rule:"tooltip",applied:!1,snippet:f,reason:/\bx-tooltip[=\s]/.test(u)?"already has x-tooltip":"empty title"});continue}s.push({file:i,line:h,rule:"tooltip",applied:!0,snippet:f}),r+=e.slice(n,a.index)+`${u} x-tooltip=${d}${p}${d} title=${d}${p}${d}`,n=a.index+c.length}return r+e.slice(n)}function R(e){return e.replace(/<!--[\s\S]*?-->/g,(i)=>i.replace(/[^\n]/g," ")).replace(/\{\{--[\s\S]*?--\}\}/g,(i)=>i.replace(/[^\n]/g," "))}function F(e){let i=(s)=>s.replace(/[^\n]/g," ");return e.replace(/\/\*[\s\S]*?\*\//g,i).replace(/\/\/[^\n]*/g,i)}function m(e,i=!1){let s=R(e);return(i?F(s):t(s)).replace(/<script\b([^>]*)>([\s\S]*?)<\/script\s*>/gi,(l,r)=>/\bclient\b/i.test(r)?l:l.replace(/[^\n]/g," "))}function O(e,i,s,o){let l=m(e),r=m(e,!0);for(let n of v){if(!s.includes(n.rule))continue;if(n.requires&&!n.requires(e))continue;n.pattern.lastIndex=0;let a,c=/['"]/.test(n.pattern.source)?r:l;n.pattern.lastIndex=0;while((a=n.pattern.exec(c))!==null){if(n.reject?.(e,a.index))continue;o.push({file:i,line:g(e,a.index),rule:n.rule,applied:!1,snippet:b(e,a.index),reason:`${n.primitive} \u2014 ${n.why}`})}}}function q(e,i={}){let s=i.rules??C,o=i.file??"<source>",l=[];O(e,o,s,l);let r=e;if(s.includes("confirm"))r=A(r,o,l);if(s.includes("tooltip"))r=E(r,o,l);l.sort((c,u)=>c.line-u.line);let n=new Set,a=l.filter((c)=>{let u=`${c.rule}:${c.line}`;if(n.has(u))return!1;return n.add(u),!0});return{code:r,findings:a}}var x=new Set(["confirm","tooltip"]);function I(e,i){if(e.length===0)return"No hand-rolled equivalents found.";let s=e.filter((n)=>n.applied),o=e.filter((n)=>!n.applied&&x.has(n.rule)),l=e.filter((n)=>!n.applied&&!x.has(n.rule)),r=[];if(s.length>0){r.push(i?`Rewrote ${s.length} site(s):`:`Would rewrite ${s.length} site(s) (pass --fix):`);for(let n of s)r.push(` ${n.file}:${n.line} [${n.rule}] ${n.snippet}`)}if(o.length>0){r.push("",`Needs a human \u2014 ${o.length} site(s):`);for(let n of o)r.push(` ${n.file}:${n.line} [${n.rule}] ${n.snippet}