@stacksjs/stx 0.2.769 → 0.2.770

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 (219) hide show
  1. package/dist/{chunk-80gg1k0h.js → chunk-07thf07b.js} +2 -2
  2. package/dist/chunk-0cvpkj9g.js +2 -0
  3. package/dist/{chunk-528b302x.js → chunk-0h3sf5tp.js} +5 -5
  4. package/dist/chunk-0qgdex7z.js +2 -0
  5. package/dist/{chunk-dbpzrkmj.js → chunk-1925kbjc.js} +1 -1
  6. package/dist/chunk-1hb8q271.js +2 -0
  7. package/dist/chunk-1se5y83a.js +2 -0
  8. package/dist/{chunk-nr3pepv1.js → chunk-2bm97z09.js} +3 -3
  9. package/dist/chunk-2p301rsb.js +2 -0
  10. package/dist/{chunk-1a4vpk9x.js → chunk-2vbgm9t4.js} +6 -6
  11. package/dist/chunk-33gccrx0.js +2 -0
  12. package/dist/chunk-3754her2.js +2 -0
  13. package/dist/{chunk-rj9dcjeg.js → chunk-392rrp28.js} +2 -2
  14. package/dist/chunk-3jkbs3fc.js +2 -0
  15. package/dist/{chunk-9y6hbdfh.js → chunk-3png7zhs.js} +4 -4
  16. package/dist/chunk-3vankrf5.js +2 -0
  17. package/dist/{chunk-mg38q3jh.js → chunk-3y26rjq6.js} +10 -10
  18. package/dist/{chunk-ysfeg3cn.js → chunk-477gjb2b.js} +2 -2
  19. package/dist/chunk-4jzyd8k0.js +2 -0
  20. package/dist/{chunk-wp4nqnn7.js → chunk-4qng287p.js} +1 -1
  21. package/dist/chunk-4tvty67c.js +2 -0
  22. package/dist/chunk-4xaz5jbs.js +2 -0
  23. package/dist/{chunk-s2py8kg7.js → chunk-4xzk9529.js} +2 -2
  24. package/dist/chunk-53md2scd.js +2 -0
  25. package/dist/chunk-56sek7x7.js +2 -0
  26. package/dist/chunk-5g5v7yns.js +2 -0
  27. package/dist/chunk-5gg5jc76.js +2 -0
  28. package/dist/{chunk-7s9wx19m.js → chunk-5s2dwh5z.js} +11 -11
  29. package/dist/{chunk-py818vbj.js → chunk-5t33zwwg.js} +1 -1
  30. package/dist/{chunk-s6ss1qnq.js → chunk-618d3ng3.js} +6 -6
  31. package/dist/chunk-68j6zb7n.js +2 -0
  32. package/dist/{chunk-fz717vpc.js → chunk-6b32wt31.js} +30 -30
  33. package/dist/{chunk-30kemrry.js → chunk-6cd5dyje.js} +22 -22
  34. package/dist/{chunk-8x4gmead.js → chunk-6k4tbms6.js} +6 -6
  35. package/dist/{chunk-napd81ht.js → chunk-6nf4xhv0.js} +5 -5
  36. package/dist/{chunk-n5dd6rpt.js → chunk-6sa5adg6.js} +2 -2
  37. package/dist/chunk-6wf0ter4.js +2 -0
  38. package/dist/{chunk-5fab5wt2.js → chunk-70nwqsf6.js} +4 -4
  39. package/dist/chunk-75st1ttq.js +2 -0
  40. package/dist/{chunk-nrh8t8re.js → chunk-79x0812m.js} +2 -2
  41. package/dist/chunk-7ctvfad1.js +2 -0
  42. package/dist/{chunk-2w16z2y1.js → chunk-7g29avcd.js} +5 -5
  43. package/dist/{chunk-vp8sjx6w.js → chunk-7h0mjwkq.js} +5 -5
  44. package/dist/{chunk-a81m2ewb.js → chunk-7t1medmh.js} +2 -2
  45. package/dist/{chunk-ddpt7ejx.js → chunk-7wwfaj6b.js} +3 -3
  46. package/dist/{chunk-xj1k9bx9.js → chunk-7y0v5dry.js} +2 -2
  47. package/dist/chunk-83aq0n9s.js +2 -0
  48. package/dist/{chunk-jb1c4e49.js → chunk-83fh7j8g.js} +2 -2
  49. package/dist/{chunk-342e6mhn.js → chunk-91q55gjp.js} +3 -3
  50. package/dist/{chunk-ggvnmmv3.js → chunk-9ewhnwcg.js} +4 -4
  51. package/dist/chunk-9vgkp3nj.js +2 -0
  52. package/dist/chunk-9vqj5jzp.js +2 -0
  53. package/dist/chunk-a50kn0hn.js +2 -0
  54. package/dist/{chunk-pzt3g2m0.js → chunk-amnydj3d.js} +1 -1
  55. package/dist/chunk-bpbhjn4w.js +2 -0
  56. package/dist/chunk-bqyj88qr.js +2 -0
  57. package/dist/{chunk-ztbk9yqv.js → chunk-bwzjjxnj.js} +4 -4
  58. package/dist/{chunk-cz3trbvn.js → chunk-cak9fp9b.js} +7 -7
  59. package/dist/chunk-cgv3r6q9.js +2 -0
  60. package/dist/{chunk-j34wqxb1.js → chunk-cn7zpm1x.js} +5 -5
  61. package/dist/{chunk-0hf0mtaf.js → chunk-cqfyby1t.js} +2 -2
  62. package/dist/{chunk-zj32s5na.js → chunk-ddhazq2g.js} +3 -3
  63. package/dist/{chunk-zmesddf4.js → chunk-ddjkt87h.js} +1 -1
  64. package/dist/{chunk-t70s45hc.js → chunk-dmj9gk6d.js} +2 -2
  65. package/dist/chunk-e6zv6p3x.js +2 -0
  66. package/dist/chunk-e96jbmkj.js +3 -0
  67. package/dist/{chunk-33jagtss.js → chunk-eb8dv03t.js} +3 -3
  68. package/dist/{chunk-cyd10m6m.js → chunk-edetp97r.js} +5 -5
  69. package/dist/chunk-ej4wf9m5.js +2 -0
  70. package/dist/{chunk-zv924m9g.js → chunk-erjp2w63.js} +5 -5
  71. package/dist/chunk-exfgfjf6.js +2 -0
  72. package/dist/chunk-fvg2p9z0.js +2 -0
  73. package/dist/chunk-fxvhkz72.js +2 -0
  74. package/dist/chunk-g6m3q9n4.js +2 -0
  75. package/dist/{chunk-r3qez0ph.js → chunk-gn5v004x.js} +7 -7
  76. package/dist/{chunk-90n5kb78.js → chunk-gzcg563a.js} +3 -3
  77. package/dist/{chunk-rk2v0wzs.js → chunk-gzxjayvp.js} +6 -6
  78. package/dist/chunk-h2ymq7fa.js +2 -0
  79. package/dist/{chunk-kc3kt59e.js → chunk-hgm6f2t2.js} +2 -2
  80. package/dist/chunk-j1nyasyk.js +2 -0
  81. package/dist/chunk-j46nvncc.js +2 -0
  82. package/dist/chunk-jjvrm2j8.js +2 -0
  83. package/dist/chunk-kh0szwf3.js +2 -0
  84. package/dist/chunk-krdc3c87.js +7 -0
  85. package/dist/chunk-krw4m6j1.js +2 -0
  86. package/dist/{chunk-2bb4g9qr.js → chunk-m207mdpy.js} +2 -2
  87. package/dist/{chunk-jgmmg2fw.js → chunk-mcct58gb.js} +5 -5
  88. package/dist/{chunk-zg43k117.js → chunk-mdw5sbbt.js} +2 -2
  89. package/dist/chunk-mvfj17fr.js +2 -0
  90. package/dist/{chunk-wb2ej5by.js → chunk-ngzdcvry.js} +1 -1
  91. package/dist/{chunk-pqgk9mxp.js → chunk-nj2q40p8.js} +2 -2
  92. package/dist/chunk-nmjgcw4g.js +2 -0
  93. package/dist/{chunk-ev4zxhpd.js → chunk-nnzmbfjq.js} +2 -2
  94. package/dist/{chunk-586xes7a.js → chunk-nwhv1889.js} +3 -3
  95. package/dist/{chunk-1g5fg1ys.js → chunk-p1mbbdwj.js} +2 -2
  96. package/dist/chunk-p454tj1h.js +2 -0
  97. package/dist/{chunk-3g8cnsbk.js → chunk-pgkcbm6g.js} +2 -2
  98. package/dist/{chunk-s5kfndxv.js → chunk-pkyb284z.js} +2 -2
  99. package/dist/{chunk-5q97egpw.js → chunk-prxe37hj.js} +41 -41
  100. package/dist/{chunk-qdysx0fd.js → chunk-q3c130w6.js} +13 -13
  101. package/dist/chunk-q4m5p4wx.js +2 -0
  102. package/dist/chunk-q85s8ne0.js +2 -0
  103. package/dist/chunk-qe3hrbge.js +2 -0
  104. package/dist/{chunk-hpdb8vkt.js → chunk-qk61pv1v.js} +4 -4
  105. package/dist/chunk-qq4ee7px.js +2 -0
  106. package/dist/chunk-qr5ddqbf.js +3 -0
  107. package/dist/{chunk-q69dvpg1.js → chunk-qsc5nse5.js} +1 -1
  108. package/dist/{chunk-4rtr07x9.js → chunk-qtja7fpr.js} +2 -2
  109. package/dist/{chunk-a2yptg7r.js → chunk-rc4zsymn.js} +2 -2
  110. package/dist/chunk-rfp5f55f.js +2 -0
  111. package/dist/{chunk-tykyhmyx.js → chunk-rjh7ptw5.js} +1 -1
  112. package/dist/{chunk-7yx2ztt5.js → chunk-rkz3k2td.js} +3 -3
  113. package/dist/{chunk-1e67szzk.js → chunk-s3m1ggsn.js} +6 -6
  114. package/dist/{chunk-4qrr2mdd.js → chunk-s8p958da.js} +53 -53
  115. package/dist/{chunk-a627f39k.js → chunk-ssd9g1wz.js} +1 -1
  116. package/dist/{chunk-p7cvn8q9.js → chunk-tahdfsp4.js} +2 -2
  117. package/dist/chunk-th7amyq4.js +2 -0
  118. package/dist/chunk-v95kersm.js +2 -0
  119. package/dist/{chunk-jd84zgn3.js → chunk-vht2rhrj.js} +4 -4
  120. package/dist/{chunk-7vqq2w3x.js → chunk-vke28xq8.js} +2 -2
  121. package/dist/{chunk-p7h4y7mk.js → chunk-w07n2ddj.js} +2 -2
  122. package/dist/chunk-w1sjp421.js +2 -0
  123. package/dist/chunk-w5d936jr.js +2 -0
  124. package/dist/{chunk-zjar9jdd.js → chunk-wabahwkj.js} +2 -2
  125. package/dist/{chunk-msy46ges.js → chunk-x0qtgyqr.js} +5 -5
  126. package/dist/{chunk-znhzrjbm.js → chunk-x148cxrj.js} +4 -4
  127. package/dist/chunk-x3xtyr95.js +2 -0
  128. package/dist/{chunk-h8yk9qm7.js → chunk-xaqtk05e.js} +2 -2
  129. package/dist/chunk-xb16yy2x.js +2 -0
  130. package/dist/{chunk-knvt4bap.js → chunk-xr28hjkp.js} +6 -6
  131. package/dist/{chunk-ecakhzkq.js → chunk-y6hyndrt.js} +7 -7
  132. package/dist/chunk-yavspk55.js +2 -0
  133. package/dist/{chunk-rfzfk8zd.js → chunk-yjzczm2s.js} +10 -10
  134. package/dist/chunk-yrh9yfnv.js +2 -0
  135. package/dist/chunk-ysm6gaq9.js +2 -0
  136. package/dist/{chunk-svrjbeyq.js → chunk-ytjhb81r.js} +3 -3
  137. package/dist/{chunk-07c8rk93.js → chunk-yzbdm457.js} +2 -2
  138. package/dist/{chunk-fxy7jjnv.js → chunk-z1br7qeb.js} +4 -4
  139. package/dist/chunk-z515xymr.js +2 -0
  140. package/dist/{chunk-mkk8k3nd.js → chunk-z5vkzbct.js} +4 -4
  141. package/dist/chunk-z6xfmrtc.js +2 -0
  142. package/dist/{chunk-hxyarbb6.js → chunk-z846tgfe.js} +3 -3
  143. package/dist/chunk-za7v4w04.js +2 -0
  144. package/dist/chunk-zb8wv7sc.js +2 -0
  145. package/dist/{chunk-enzrpxsj.js → chunk-zsfr4dv9.js} +4 -4
  146. package/dist/cli.js +19 -19
  147. package/dist/craft-entry.js +2 -2
  148. package/dist/craft.js +2 -2
  149. package/dist/message-catalogs.d.ts +6 -0
  150. package/dist/message-catalogs.js +12 -8
  151. package/dist/process.js +18 -4
  152. package/dist/pwa.js +3 -3
  153. package/dist/ssg.js +4 -4
  154. package/dist/types/config-types.d.ts +1 -0
  155. package/dist/web-modules.d.ts +9 -0
  156. package/dist/web-modules.js +47 -0
  157. package/package.json +5 -5
  158. package/dist/chunk-01484snf.js +0 -2
  159. package/dist/chunk-096g00ba.js +0 -2
  160. package/dist/chunk-0ga7sn1k.js +0 -2
  161. package/dist/chunk-0nhk9p9r.js +0 -2
  162. package/dist/chunk-1nzg53pv.js +0 -2
  163. package/dist/chunk-1respkkp.js +0 -2
  164. package/dist/chunk-20dsfgmq.js +0 -2
  165. package/dist/chunk-3k6tem86.js +0 -2
  166. package/dist/chunk-3pma2q0h.js +0 -2
  167. package/dist/chunk-4cr8bep2.js +0 -2
  168. package/dist/chunk-4ew0291t.js +0 -2
  169. package/dist/chunk-5ftthxab.js +0 -2
  170. package/dist/chunk-5ttj2c0h.js +0 -2
  171. package/dist/chunk-5wp7s24b.js +0 -3
  172. package/dist/chunk-9v21mwfs.js +0 -2
  173. package/dist/chunk-b6kfq08s.js +0 -2
  174. package/dist/chunk-b94xf9vs.js +0 -2
  175. package/dist/chunk-bjggcj45.js +0 -2
  176. package/dist/chunk-bk3b5jyw.js +0 -2
  177. package/dist/chunk-bntw35k0.js +0 -2
  178. package/dist/chunk-bt01gdaj.js +0 -2
  179. package/dist/chunk-bwkw2dw3.js +0 -2
  180. package/dist/chunk-ctmadzad.js +0 -2
  181. package/dist/chunk-cwmjqker.js +0 -2
  182. package/dist/chunk-dbx628ra.js +0 -2
  183. package/dist/chunk-ddwsms1t.js +0 -2
  184. package/dist/chunk-dpjf62qw.js +0 -2
  185. package/dist/chunk-e4bsnxsj.js +0 -2
  186. package/dist/chunk-f8jwrvky.js +0 -2
  187. package/dist/chunk-h8yy3y3p.js +0 -2
  188. package/dist/chunk-hddwx35m.js +0 -2
  189. package/dist/chunk-hfcmbbkq.js +0 -2
  190. package/dist/chunk-hyqsvw1b.js +0 -2
  191. package/dist/chunk-j5dd5ncz.js +0 -7
  192. package/dist/chunk-j835421z.js +0 -2
  193. package/dist/chunk-mhc72pp2.js +0 -2
  194. package/dist/chunk-nsxg0t06.js +0 -2
  195. package/dist/chunk-p66fgjeb.js +0 -2
  196. package/dist/chunk-phjfsm8d.js +0 -2
  197. package/dist/chunk-pts7jpqc.js +0 -2
  198. package/dist/chunk-qcjtfrzm.js +0 -2
  199. package/dist/chunk-qr6jyd08.js +0 -2
  200. package/dist/chunk-rqpktvkn.js +0 -2
  201. package/dist/chunk-s1a69a8q.js +0 -2
  202. package/dist/chunk-s922mx0k.js +0 -2
  203. package/dist/chunk-spmbnchd.js +0 -2
  204. package/dist/chunk-t1gk6y8z.js +0 -2
  205. package/dist/chunk-t3cdnbq1.js +0 -2
  206. package/dist/chunk-t96gj0ey.js +0 -2
  207. package/dist/chunk-vcks4gwd.js +0 -2
  208. package/dist/chunk-vg6p0zst.js +0 -2
  209. package/dist/chunk-vjsyf8m1.js +0 -2
  210. package/dist/chunk-vq88tjma.js +0 -2
  211. package/dist/chunk-vqa2s0v4.js +0 -2
  212. package/dist/chunk-wtqj99tg.js +0 -2
  213. package/dist/chunk-xqa8f03q.js +0 -2
  214. package/dist/chunk-y7a0y5jq.js +0 -2
  215. package/dist/chunk-ydj0r3kw.js +0 -2
  216. package/dist/chunk-ydq170j1.js +0 -2
  217. package/dist/chunk-ytzzth34.js +0 -2
  218. package/dist/chunk-yz30cgyx.js +0 -2
  219. package/dist/chunk-yz85drm8.js +0 -2
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{t,c}from"./chunk-7s9wx19m.js";import{r,yn,h}from"./chunk-4qrr2mdd.js";import{et}from"./chunk-fxy7jjnv.js";import{xs,Ss}from"./chunk-cz3trbvn.js";import{yc,Ko,ws,vs}from"./chunk-ztbk9yqv.js";import{gc,mc}from"./chunk-svrjbeyq.js";import{vt}from"./chunk-am4wadh7.js";import{ln,kc,gr,mr}from"./chunk-s2py8kg7.js";import{g}from"./chunk-0dve54ne.js";import{Ys}from"./chunk-4rtr07x9.js";import Q from"fs";import N from"path";import{loadConfigWithResult as Bt}from"bunfig";var B={duration:300,delay:0,ease:"ease",direction:"both"};function it(e,n={}){let{duration:i,delay:o,ease:s,direction:l,custom:d}={...B,...n};if(e==="custom"&&d)return d;switch(e){case"fade":return`${l==="in"?"opacity: 0; animation: fadeIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":l==="out"?"opacity: 1; animation: fadeOut var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":"opacity: 1; transition: opacity var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);"}
2
+ import{t,c}from"./chunk-5s2dwh5z.js";import{r,yn,h}from"./chunk-s8p958da.js";import{et}from"./chunk-z1br7qeb.js";import{Ss,ks}from"./chunk-cak9fp9b.js";import{bc,Xo,vs,xs}from"./chunk-bwzjjxnj.js";import{mc,hc}from"./chunk-ytjhb81r.js";import{vt}from"./chunk-am4wadh7.js";import{ln,_c,gr,mr}from"./chunk-4xzk9529.js";import{g}from"./chunk-0dve54ne.js";import{Zs}from"./chunk-qtja7fpr.js";import Q from"fs";import N from"path";import{loadConfigWithResult as Bt}from"bunfig";var B={duration:300,delay:0,ease:"ease",direction:"both"};function it(e,n={}){let{duration:i,delay:o,ease:s,direction:l,custom:d}={...B,...n};if(e==="custom"&&d)return d;switch(e){case"fade":return`${l==="in"?"opacity: 0; animation: fadeIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":l==="out"?"opacity: 1; animation: fadeOut var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":"opacity: 1; transition: opacity var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);"}
3
3
  @keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
4
4
  @keyframes fadeOut { from { opacity: 1; } to { opacity: 0; } }`;case"slide":return`${l==="in"?"transform: translateY(20px); opacity: 0; animation: slideIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":l==="out"?"transform: translateY(0); opacity: 1; animation: slideOut var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":"transform: translateY(0); opacity: 1; transition: transform var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms), opacity var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);"}
5
5
  @keyframes slideIn { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@@ -234,7 +234,7 @@ else {
234
234
  </script>
235
235
  `}var Pe={name:"transition",handler:(e,n,i,o)=>{if(n.length<1)return`<div class="stx-error">@transition directive requires at least a transition type</div>${e}`;let s=n[0],l=n.length>1?Number.parseInt(n[1],10)||B.duration:B.duration,d=n.length>2?n[2]||B.ease:B.ease,p=n.length>3?Number.parseInt(n[3],10)||B.delay:B.delay,u=n.length>4?n[4]||B.direction:B.direction,m=`stx-transition-${Math.random().toString(36).substr(2,9)}`,y=it(s,{duration:l,delay:p,ease:d,direction:u}),f="stx-transition",v="";if(s==="fade")v="stx-fade";else if(s==="slide")v="stx-slide";else if(s==="scale")v="stx-scale";else if(s==="flip")v="stx-flip";else if(s==="rotate")v="stx-rotate";return`<div id="${m}" class="${f} ${v} ${u==="out"?"stx-out":""}"
236
236
  style="--stx-transition-duration: ${l}ms; --stx-transition-ease: ${d}; --stx-transition-delay: ${p}ms;">${e}</div>`},hasEndTag:!0,description:"Applies transition effects to an element"},ke={name:"scrollAnimate",handler:(e,n,i,o)=>{if(n.length<1)return`<div class="stx-error">@scrollAnimate directive requires at least an animation type</div>${e}`;let s=n[0],l=n.length>1?Number.parseInt(n[1],10)||300:300,d=n.length>2?n[2]||"ease":"ease",p=n.length>3?Number.parseFloat(n[3])||0.2:0.2,u=n.length>4?Number.parseInt(n[4],10)||0:0,m=`stx-scroll-${Math.random().toString(36).substr(2,9)}`,y=`--stx-transition-duration: ${l}ms; --stx-transition-ease: ${d}; --stx-transition-delay: ${u}ms; will-change: opacity, transform;`,f="stx-transition stx-observe stx-out";if(s==="fade")f+=" stx-fade";else if(s==="slide-up"||s==="slide")f+=" stx-from-bottom";else if(s==="slide-down")f+=" stx-from-top";else if(s==="slide-left")f+=" stx-from-right";else if(s==="slide-right")f+=" stx-from-left";else if(s==="scale")f+=" stx-scale";else if(s.includes("-"))f+=` stx-${s}`;else f+=` stx-${s}`;return`<div id="${m}" class="${f}" style="${y}" data-threshold="${p}">${e}</div>`},hasEndTag:!0,description:"Applies animations that trigger when scrolled into view"},Ae={name:"animationGroup",handler:(e,n,i,o)=>{if(n.length<2)return`<div class="stx-error">@animationGroup directive requires a group name and at least one element selector</div>${e}`;let s=n[0],l=n.slice(1).map((m)=>m.startsWith("#")||m.startsWith(".")?m:`#${m}`),d=i.staggerDelay||50,p=i.sequence||!0,u=dt(s,l,{staggerDelay:d,sequence:p});return`${e}
237
- ${u}`},hasEndTag:!1,description:"Coordinates multiple animations together as a group"},_e={name:"motion",handler:(e,n,i,o)=>{let s=n.length>0?n[0].toLowerCase()==="true":!0,l=at();return`<div data-animate="${s?"auto":"true"}">${e}</div>${l}`},hasEndTag:!0,description:"Controls motion and animation preferences"};function cc(e,n,i,o){let s=e;if(o.animation?.enabled===!1)return s;let l=i.includes("test")&&i.includes("animation");if(!ot(s)&&!l)return s;if(!s.includes('<style id="stx-animation-base">')){let p=ct();s=s.replace("</head>",`${p}
237
+ ${u}`},hasEndTag:!1,description:"Coordinates multiple animations together as a group"},_e={name:"motion",handler:(e,n,i,o)=>{let s=n.length>0?n[0].toLowerCase()==="true":!0,l=at();return`<div data-animate="${s?"auto":"true"}">${e}</div>${l}`},hasEndTag:!0,description:"Controls motion and animation preferences"};function lc(e,n,i,o){let s=e;if(o.animation?.enabled===!1)return s;let l=i.includes("test")&&i.includes("animation");if(!ot(s)&&!l)return s;if(!s.includes('<style id="stx-animation-base">')){let p=ct();s=s.replace("</head>",`${p}
238
238
  </head>`)}if(s.includes("stx-observe")){if(!s.includes("Intersection Observer for scroll animations")){let u=lt(),m=s.lastIndexOf("</body>");if(m!==-1)s=s.slice(0,m)+u+`
239
239
  `+s.slice(m)}}return s}async function ut(e,n,i,o){let s=n[0]?.replace(/['"]/g,"")||"main",l=et();if(s!=="main")l=l.replace("container:'main'",`container:'${s}'`);return`<script data-stx-router>${l}</script>`}var Re={name:"stxRouter",handler:ut,hasEndTag:!1,description:"Inject the STX SPA router script for client-side navigation"};var pt={enabled:!1,trackMouse:!0,trackClicks:!0,trackScroll:!0,samplingRate:100,honorDnt:!0,batchSize:50,maxDataPoints:1000,sessionTimeout:30,persistData:!1,storagePrefix:"stx_heatmap",captureAttributes:["data-heatmap-id","data-track"],ignoreSelectors:["[data-heatmap-ignore]",".heatmap-ignore"],debugOverlay:!1};function Oe(e){let n=e.heatmap;if(!n?.enabled)return"";let i={...pt,...n};return`
240
240
  <!-- stx Heatmap - Privacy-Compliant Tracking -->
@@ -619,7 +619,7 @@ else {
619
619
  };
620
620
  })();
621
621
  </script>
622
- `}function lc(e,n){let i=Oe(n);if(!i)return e;let o=e.lastIndexOf("</body>");if(o!==-1)return e.slice(0,o)+i+e.slice(o);return e+i}var Ee={name:"heatmap",hasEndTag:!1,description:"Inject privacy-compliant heatmap tracking script",handler:async(e,n,i,o)=>{let s=i.__stx_config||{};if(n.length>0){let l=mt(n.join(" "));s.heatmap={...s.heatmap,...l,enabled:!0}}return Oe(s)}};function mt(e){let n={},i=e.match(/(\w+)=["']?([^"'\s]+)["']?/g)||[];for(let o of i){let[s,l]=o.split("="),d=l?.replace(/["']/g,"");switch(s){case"endpoint":n.endpoint=d;break;case"samplingRate":n.samplingRate=Number.parseInt(d,10);break;case"batchSize":n.batchSize=Number.parseInt(d,10);break;case"trackMouse":n.trackMouse=d==="true";break;case"trackClicks":n.trackClicks=d==="true";break;case"trackScroll":n.trackScroll=d==="true";break;case"honorDnt":n.honorDnt=d==="true";break;case"debugOverlay":n.debugOverlay=d==="true";break}}return n}function J(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function Ie(e){let n=e.trim().toLowerCase();return!n.startsWith("javascript:")&&!n.startsWith("vbscript:")&&!n.startsWith("data:text/html")}function ur(e){let n=/^---\r?\n([\s\S]*?)\r?\n---\r?\n/,i=e.match(n);if(!i)return{data:{},content:e.trim()};let o=i[1],s=e.slice(i[0].length),l={};for(let d of o.split(`
622
+ `}function uc(e,n){let i=Oe(n);if(!i)return e;let o=e.lastIndexOf("</body>");if(o!==-1)return e.slice(0,o)+i+e.slice(o);return e+i}var Ee={name:"heatmap",hasEndTag:!1,description:"Inject privacy-compliant heatmap tracking script",handler:async(e,n,i,o)=>{let s=i.__stx_config||{};if(n.length>0){let l=mt(n.join(" "));s.heatmap={...s.heatmap,...l,enabled:!0}}return Oe(s)}};function mt(e){let n={},i=e.match(/(\w+)=["']?([^"'\s]+)["']?/g)||[];for(let o of i){let[s,l]=o.split("="),d=l?.replace(/["']/g,"");switch(s){case"endpoint":n.endpoint=d;break;case"samplingRate":n.samplingRate=Number.parseInt(d,10);break;case"batchSize":n.batchSize=Number.parseInt(d,10);break;case"trackMouse":n.trackMouse=d==="true";break;case"trackClicks":n.trackClicks=d==="true";break;case"trackScroll":n.trackScroll=d==="true";break;case"honorDnt":n.honorDnt=d==="true";break;case"debugOverlay":n.debugOverlay=d==="true";break}}return n}function J(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function Ie(e){let n=e.trim().toLowerCase();return!n.startsWith("javascript:")&&!n.startsWith("vbscript:")&&!n.startsWith("data:text/html")}function ur(e){let n=/^---\r?\n([\s\S]*?)\r?\n---\r?\n/,i=e.match(n);if(!i)return{data:{},content:e.trim()};let o=i[1],s=e.slice(i[0].length),l={};for(let d of o.split(`
623
623
  `)){let p=d.trim();if(!p||p.startsWith("#"))continue;let u=p.indexOf(":");if(u===-1)continue;let m=p.slice(0,u).trim(),y=p.slice(u+1).trim();if(typeof y==="string"){if(y.startsWith('"')&&y.endsWith('"')||y.startsWith("'")&&y.endsWith("'"))y=y.slice(1,-1);else if(y.startsWith("[")&&y.endsWith("]"))try{y=JSON.parse(y)}catch{}else if(y==="true")y=!0;else if(y==="false")y=!1;else if(/^-?\d+(?:\.\d+)?$/.test(y))y=Number(y)}l[m]=y}return{data:l,content:s.trim()}}function Ze(e,n={}){let{gfm:i=!0,breaks:o=!1}=n,s=e,l=[];if(s=s.replace(/```(\w*)\n([\s\S]*?)```/g,(y,f,v)=>{let b=l.length,x=f?` class="language-${J(f)}"`:"";return l.push(`<pre><code${x}>${J(v.trim())}</code></pre>`),`\x00CODEBLOCK${b}\x00`}),s=s.replace(/`([^`]*)`/g,(y,f)=>`<code>${J(f)}</code>`),s=s.replace(/^######\s+(.*)$/gm,"<h6>$1</h6>"),s=s.replace(/^#####\s+(.*)$/gm,"<h5>$1</h5>"),s=s.replace(/^####\s+(.*)$/gm,"<h4>$1</h4>"),s=s.replace(/^###\s+(.*)$/gm,"<h3>$1</h3>"),s=s.replace(/^##\s+(.*)$/gm,"<h2>$1</h2>"),s=s.replace(/^#\s+(.*)$/gm,"<h1>$1</h1>"),s=s.replace(/\*\*\*(.+?)\*\*\*/g,"<strong><em>$1</em></strong>"),s=s.replace(/___(.+?)___/g,"<strong><em>$1</em></strong>"),s=s.replace(/\*\*(.+?)\*\*/g,"<strong>$1</strong>"),s=s.replace(/__(.+?)__/g,"<strong>$1</strong>"),s=s.replace(/\*(.+?)\*/g,"<em>$1</em>"),s=s.replace(/(?<![a-zA-Z0-9])_(.+?)_(?![a-zA-Z0-9])/g,"<em>$1</em>"),i)s=s.replace(/~~(.+?)~~/g,"<del>$1</del>");if(s=s.replace(/!\[([^\]]*)\]\(([^)]+)\)/g,(y,f,v)=>`<img src="${Ie(v)?J(v):""}" alt="${J(f)}" />`),s=s.replace(/\[([^\]]+)\]\(([^)]+)\)/g,(y,f,v)=>`<a href="${Ie(v)?J(v):""}">${f}</a>`),s=s.replace(/^(?:---|\*\*\*|___)\s*$/gm,"<hr />"),s=s.replace(/^>\s+(.*)$/gm,"<blockquote>$1</blockquote>"),s=s.replace(/<\/blockquote>\n<blockquote>/g,`
624
624
  `),s=s.replace(/^[*\-+]\s+(.*)$/gm,"<li data-ul>$1</li>"),s=s.replace(/(<li data-ul>.*<\/li>\n?)+/g,"<ul>$&</ul>"),s=s.replace(/<\/ul>\n<ul>/g,""),s=s.replace(/^\d+\.\s+(.*)$/gm,"<li data-ol>$1</li>"),s=s.replace(/(<li data-ol>.*<\/li>\n?)+/g,"<ol>$&</ol>"),s=s.replace(/<\/ol>\n<ol>/g,""),s=s.replace(/<li data-ul>/g,"<li>"),s=s.replace(/<li data-ol>/g,"<li>"),i)s=s.replace(/^\|(.+)\|\s*\n\|[-:\s|]+\|\s*\n((?:\|.+\|\s*\n)*)/gm,(y,f,v)=>{let x=`<tr>${f.split("|").map((S)=>S.trim()).filter(Boolean).map((S)=>`<th>${J(S)}</th>`).join("")}</tr>`,k=v.trim().split(`
625
625
  `).map((S)=>`<tr>${S.split("|").map((A)=>A.trim()).filter(Boolean).map((A)=>`<td>${J(A)}</td>`).join("")}</tr>`).join(`
@@ -637,7 +637,7 @@ ${k}
637
637
  `:`
638
638
  `)}</p>`);if(s=p.join(`
639
639
  `),o)s=s.replace(/\n/g,`<br />
640
- `);for(let y=0;y<l.length;y++)s=s.replace(`\x00CODEBLOCK${y}\x00`,l[y]);return s=s.replace(/<p>\s*<\/p>/g,""),s.trim()}async function uc(e,n,i=""){let o=e,s=[],l=/@markdown(?:\([^)]*\))?/g,d;while((d=l.exec(e))!==null){let p=d.index,u=d[0].match(/@markdown\(([^)]*)\)/),m=u?u[1]:"",y=p+d[0].length,f=1,v=y,b=-1;while(f>0&&v<e.length){let S=e.indexOf("@markdown",v),_=e.indexOf("@endmarkdown",v);if(_===-1)break;if(S!==-1&&S<_&&S!==p){let A=e[S+9];if(A==="("||A===`
640
+ `);for(let y=0;y<l.length;y++)s=s.replace(`\x00CODEBLOCK${y}\x00`,l[y]);return s=s.replace(/<p>\s*<\/p>/g,""),s.trim()}async function dc(e,n,i=""){let o=e,s=[],l=/@markdown(?:\([^)]*\))?/g,d;while((d=l.exec(e))!==null){let p=d.index,u=d[0].match(/@markdown\(([^)]*)\)/),m=u?u[1]:"",y=p+d[0].length,f=1,v=y,b=-1;while(f>0&&v<e.length){let S=e.indexOf("@markdown",v),_=e.indexOf("@endmarkdown",v);if(_===-1)break;if(S!==-1&&S<_&&S!==p){let A=e[S+9];if(A==="("||A===`
641
641
  `||A==="\r"||A===" "||A===void 0)f++;v=S+9}else{if(f--,f===0){b=_;break}v=_+12}}if(b===-1)continue;let x=e.slice(y,b),k=e.slice(p,b+12);s.push({fullMatch:k,options:m,content:x,index:p}),l.lastIndex=b+12}for(let{fullMatch:p,options:u,content:m,index:y}of s)try{let f={};if(u)u.split(",").forEach((x)=>{let k=x.trim();if(k)f[k]=!0});let v={gfm:f.gfm??!0,breaks:f.breaks??!1},b=Ze(m.trim(),v);o=o.split(p).join(b)}catch(f){let v=f instanceof Error?f.message:String(f),b=h("Markdown Directive",`Error processing markdown: ${v}`,i,e,y,p);o=o.split(p).join(b)}return o}async function Te(e,n,i,o){let s={gfm:!0,breaks:!1};return n.forEach((l)=>{let d=l.trim().replace(/['"]/g,"");if(d==="breaks")s.breaks=!0;if(d==="no-gfm")s.gfm=!1}),Ze(e.trim(),s)}var Z=[320,480,640,768,1024,1280,1536,1920,2560],gt=[1,1.5,2,3],te=["avif","webp","jpeg"],ft={avif:"image/avif",webp:"image/webp",jpeg:"image/jpeg",png:"image/png",gif:"image/gif"};function me(e,n=Z,i={},o){return n.sort((s,l)=>s-l).map((s)=>`${re(e,{...i,w:s,fm:o})} ${s}w`).join(", ")}function Me(e,n,i=gt,o={},s){return i.sort((l,d)=>l-d).map((l)=>{let d=Math.round(n*l);return`${re(e,{...o,w:d,dpr:l,fm:s})} ${l}x`}).join(", ")}function ge(e,n="100vw"){if(!e||Object.keys(e).length===0)return n;let o=Object.entries(e).map(([s,l])=>{let d=/^\d+$/.test(s)?`${s}px`:s;return{bp:d,size:l,numericBp:Number.parseInt(d)||0}}).sort((s,l)=>s.numericBp-l.numericBp).map(({bp:s,size:l})=>`(max-width: ${s}) ${l}`);return o.push(n),o.join(", ")}function re(e,n={}){let i=Object.entries(n).filter(([,l])=>l!==void 0&&l!==null).map(([l,d])=>{if(Array.isArray(d))return[l,d.join(",")];return[l,String(d)]});if(i.length===0)return e;let o=i.map(([l,d])=>`${l}=${encodeURIComponent(d)}`).join("&"),s=e.includes("?")?"&":"?";return`${e}${s}${o}`}function fe(e){return ft[e]||"application/octet-stream"}var ht={strategy:"thumbhash",width:20,quality:50,blurLevel:40,transitionDuration:300,easing:"ease-out"},ye=`
642
642
  .stx-img-placeholder {
643
643
  position: relative;
@@ -684,7 +684,7 @@ ${k}
684
684
  #${e}.stx-img-loaded img {
685
685
  opacity: 1;
686
686
  }
687
- `.trim()}var he=new Map;async function Ne(e,n={}){let i=`${e}:${JSON.stringify(n)}`;if(he.has(i))return he.get(i);let o=await bt(e,n);return he.set(i,o),o}async function $t(){try{return await import("./chunk-hddwx35m.js")}catch(e){if(!Ve)console.warn("[stx-media] Image processor not available, some features disabled:",e),Ve=!0;return null}}var Ve=!1,ve=80,le="async",ce="lazy",ze=!1;async function oe(e,n={}){let i=n,o=e;if(o.process&&!o.skipOptimization){if(i.tsImagesConfig?.enabled&&!i.isDev)return Pt(o,i)}if(i.processedResult?.processed)return we(e,i.processedResult,n);if(i.responsiveVariants)return Fe(e,i.responsiveVariants,n);let{src:s,alt:l,width:d,height:p,sizes:u,widths:m=Z,dpr:y,formats:f=te,quality:v=ve,params:b={},placeholder:x="none",placeholderOptions:k={},lazy:S=!0,priority:_=!1,loading:A=_?"eager":ce,decoding:E=le,fetchpriority:I,objectFit:w,objectPosition:C,crossorigin:D,referrerpolicy:L}=e,{class:W,style:T,id:V}=e,R=e.data||{},{isDev:z=!1,baseUrl:G=""}=n;if(z&&!n.optimize)return Dt(e);let F,O,H=V||`stx-img-${Math.random().toString(36).slice(2,8)}`;if(x!=="none"&&!_)try{F=await Ne(s,{strategy:x,...k}),O=je(H,F,k)}catch{}let ie=y!==void 0&&d!==void 0,X;if(ie)X=Ct(e,H,F,n);else X=await St(e,H,F,n);let ee;if(_){let De=f.includes("webp")?"webp":f[0],nt=me(s,m,{...b,q:v},De),st=typeof u==="object"?ge(u):u||"100vw";ee=`<link rel="preload" as="image" imagesrcset="${nt}" imagesizes="${st}" />`}let ae=[];if(!ze&&x!=="none")ae.push(ye),ze=!0;if(O)ae.push(O);let rt=S?We(H):void 0;return{html:X,preloadLink:ee,css:ae.length>0?ae.join(`
687
+ `.trim()}var he=new Map;async function Ne(e,n={}){let i=`${e}:${JSON.stringify(n)}`;if(he.has(i))return he.get(i);let o=await bt(e,n);return he.set(i,o),o}async function $t(){try{return await import("./chunk-2p301rsb.js")}catch(e){if(!Ve)console.warn("[stx-media] Image processor not available, some features disabled:",e),Ve=!0;return null}}var Ve=!1,ve=80,le="async",ce="lazy",ze=!1;async function oe(e,n={}){let i=n,o=e;if(o.process&&!o.skipOptimization){if(i.tsImagesConfig?.enabled&&!i.isDev)return Pt(o,i)}if(i.processedResult?.processed)return we(e,i.processedResult,n);if(i.responsiveVariants)return Fe(e,i.responsiveVariants,n);let{src:s,alt:l,width:d,height:p,sizes:u,widths:m=Z,dpr:y,formats:f=te,quality:v=ve,params:b={},placeholder:x="none",placeholderOptions:k={},lazy:S=!0,priority:_=!1,loading:A=_?"eager":ce,decoding:E=le,fetchpriority:I,objectFit:w,objectPosition:C,crossorigin:D,referrerpolicy:L}=e,{class:W,style:T,id:V}=e,R=e.data||{},{isDev:z=!1,baseUrl:G=""}=n;if(z&&!n.optimize)return Dt(e);let F,O,H=V||`stx-img-${Math.random().toString(36).slice(2,8)}`;if(x!=="none"&&!_)try{F=await Ne(s,{strategy:x,...k}),O=je(H,F,k)}catch{}let ie=y!==void 0&&d!==void 0,X;if(ie)X=Ct(e,H,F,n);else X=await St(e,H,F,n);let ee;if(_){let De=f.includes("webp")?"webp":f[0],nt=me(s,m,{...b,q:v},De),st=typeof u==="object"?ge(u):u||"100vw";ee=`<link rel="preload" as="image" imagesrcset="${nt}" imagesizes="${st}" />`}let ae=[];if(!ze&&x!=="none")ae.push(ye),ze=!0;if(O)ae.push(O);let rt=S?We(H):void 0;return{html:X,preloadLink:ee,css:ae.length>0?ae.join(`
688
688
  `):void 0,script:rt}}async function St(e,n,i,o){let{src:s,alt:l,width:d,height:p,sizes:u,widths:m=Z,formats:y=te,quality:f=ve,params:v={},lazy:b=!0,priority:x=!1,loading:k=x?"eager":ce,decoding:S=le,fetchpriority:_,objectFit:A,objectPosition:E,crossorigin:I,referrerpolicy:w}=e,{class:C,style:D}=e,L=e.data||{},W=typeof u==="object"?ge(u):u||"100vw",T=[];for(let z of y){let G=me(s,m,{...v,q:f},z),F=fe(z);if(b&&!x)T.push(` <source type="${F}" data-srcset="${G}" data-sizes="${W}" />`);else T.push(` <source type="${F}" srcset="${G}" sizes="${W}" />`)}let V=be({src:re(s,{...v,q:f}),alt:l,width:d,height:p,loading:x?void 0:k,decoding:S,fetchpriority:x?"high":_,objectFit:A,objectPosition:E,crossorigin:I,referrerpolicy:w,className:Le(C,i),style:xe(D,A,E,i),lazy:b&&!x,data:L}),R;if(i){let z=`background-image: url('${i.dataURL}'); background-size: cover; background-position: center;`;R=`<div id="${n}" class="stx-img-placeholder" style="${z}">
689
689
  <picture>
690
690
  ${T.join(`
@@ -748,7 +748,7 @@ ${w.join(`
748
748
  `):void 0,script:G}}async function Fe(e,n,i){let o={src:n.src,processed:!0,variants:[],placeholder:n.placeholder?.dataURL,originalWidth:n.placeholder?.width,originalHeight:n.placeholder?.height};for(let[s,l]of Object.entries(n.byFormat))if(l)o.variants.push(...l);return we(e,o,i)}function kt(){return vt({name:"img",hasEndTag:!1,description:"Render an optimized responsive image with srcset and lazy loading",transform:async(e,n,i,o)=>{let{src:s,alt:l,options:d}=At(e,n,i);if(!s)return console.warn("@img directive: missing src argument"),"<!-- @img: missing src -->";let p={src:s,alt:l||"",widths:d.widths||Z,formats:d.formats||te,quality:d.quality,sizes:d.sizes,dpr:d.dpr,params:d.params,placeholder:d.placeholder,placeholderOptions:d.placeholderOptions,lazy:d.lazy!==!1,priority:d.priority||!1,loading:d.loading,decoding:d.decoding,fetchpriority:d.fetchpriority,objectFit:d.objectFit,objectPosition:d.objectPosition,class:d.class,style:d.style,id:d.id,width:d.width,height:d.height},u=i.__isDev||!1,m=await oe(p,{isDev:u}),y=m.html;if(m.preloadLink)y=m.preloadLink+`
749
749
  `+y;if(m.css)y+=`
750
750
  <style>${m.css}</style>`;if(m.script)y+=`
751
- <script>${m.script}</script>`;return y},defaults:{src:"",alt:"",options:{lazy:!0,placeholder:"none"}}})}function At(e,n,i){if(n.src)return{src:String(n.src),alt:String(n.alt||""),options:n.options||{}};let o=e.trim();if(o.startsWith("@img(")||o.startsWith("("))o=o.replace(/^@img\(/,"").replace(/^\(/,"").replace(/\)$/,"");let s=_t(o),l=$e(s[0],i)||"",d=$e(s[1],i)||"",p={};if(s[2]){let u=$e(s[2],i);if(typeof u==="object"&&u!==null)p=u;else if(typeof s[2]==="string")try{p=JSON.parse(s[2])}catch{}}return{src:l,alt:d,options:p}}function _t(e){let n=[],i="",o=!1,s="",l=0,d=0;for(let p=0;p<e.length;p++){let u=e[p],m=p>0?e[p-1]:"";if((u==='"'||u==="'"||u==="`")&&m!=="\\"){if(!o)o=!0,s=u;else if(u===s)o=!1,s="";else i+=u;continue}if(!o){if(u==="{")l++;if(u==="}")l--;if(u==="[")d++;if(u==="]")d--;if(u===","&&l===0&&d===0){n.push(i.trim()),i="";continue}}i+=u}if(i.trim())n.push(i.trim());return n}function $e(e,n){if(typeof e!=="string")return e;let i=e.trim();if(i.startsWith('"')&&i.endsWith('"')||i.startsWith("'")&&i.endsWith("'"))return i.slice(1,-1);if(!i.startsWith("/")&&!i.startsWith(".")&&!i.startsWith("http")&&!i.startsWith("{")){let o=n[i];if(o!==void 0)return o}if(i.startsWith("{")||i.startsWith("["))try{return JSON.parse(i)}catch{}return i}var qe=kt();import{existsSync as Rt}from"fs";import ne from"path";function ys(){let e=[ne.join(import.meta.dir,"primitives"),ne.join(import.meta.dir,"..","primitives"),ne.join(import.meta.dir,"native","primitives"),ne.join(import.meta.dir,"..","native","primitives")];for(let n of e)if(Rt(ne.join(n,"View.stx")))return n;return e[0]}async function Ue(){try{return await import("./chunk-spmbnchd.js")}catch(e){if(!He)console.warn("[stx-media] Video processor not available, some features disabled:",e),He=!0;return null}}var He=!1,Be=!0,Je="metadata",Ot="https://cdn.jsdelivr.net/npm/ts-video-player@latest/dist/index.min.js";async function de(e,n={}){let i=n,o=e;if(o.process&&!o.skipProcessing){if(i.tsVideosConfig?.enabled&&!i.isDev)return jt(o,i)}if(i.processedResult?.processed)return Ge(e,i.processedResult,n);let s;if(o.generatePoster&&o.src&&!e.poster)s=await Nt(o,i);let{src:l,sources:d=[],poster:p,posterPlaceholder:u,controls:m=Be,autoplay:y=!1,muted:f=!1,loop:v=!1,preload:b=Je,playsinline:x=!0,lazy:k=!0,player:S="native",type:_,width:A,height:E,crossorigin:I,disablePictureInPicture:w=!1,disableRemotePlayback:C=!1}=e,D=s||p,{class:L,style:W}=e,T=e.id||`stx-video-${Math.random().toString(36).slice(2,8)}`;if(S==="ts-video")return It(e,n);if(_&&_!=="video")return Et(l||"",_,e);let V=d.length>0?d:l?[{src:l,type:Ke(l)}]:[],R=[`id="${T}"`];if(m)R.push("controls");if(y)R.push("autoplay");if(f)R.push("muted");if(v)R.push("loop");if(x)R.push("playsinline");if(w)R.push("disablepictureinpicture");if(C)R.push("disableremoteplayback");if(I)R.push(`crossorigin="${I}"`);if(k){if(R.push(`data-preload="${b}"`),R.push('preload="none"'),D)R.push(`data-poster="${M(D)}"`);R.push("data-stx-lazy")}else if(R.push(`preload="${b}"`),D)R.push(`poster="${M(D)}"`);if(A)R.push(`width="${A}"`);if(E)R.push(`height="${E}"`);if(L)R.push(`class="${M(L)}"`);if(W)R.push(`style="${M(W)}"`);let z=V.map((O)=>` <source ${k?`data-src="${M(O.src)}"`:`src="${M(O.src)}"`} type="${O.type}"${O.media?` media="${O.media}"`:""} />`).join(`
751
+ <script>${m.script}</script>`;return y},defaults:{src:"",alt:"",options:{lazy:!0,placeholder:"none"}}})}function At(e,n,i){if(n.src)return{src:String(n.src),alt:String(n.alt||""),options:n.options||{}};let o=e.trim();if(o.startsWith("@img(")||o.startsWith("("))o=o.replace(/^@img\(/,"").replace(/^\(/,"").replace(/\)$/,"");let s=_t(o),l=$e(s[0],i)||"",d=$e(s[1],i)||"",p={};if(s[2]){let u=$e(s[2],i);if(typeof u==="object"&&u!==null)p=u;else if(typeof s[2]==="string")try{p=JSON.parse(s[2])}catch{}}return{src:l,alt:d,options:p}}function _t(e){let n=[],i="",o=!1,s="",l=0,d=0;for(let p=0;p<e.length;p++){let u=e[p],m=p>0?e[p-1]:"";if((u==='"'||u==="'"||u==="`")&&m!=="\\"){if(!o)o=!0,s=u;else if(u===s)o=!1,s="";else i+=u;continue}if(!o){if(u==="{")l++;if(u==="}")l--;if(u==="[")d++;if(u==="]")d--;if(u===","&&l===0&&d===0){n.push(i.trim()),i="";continue}}i+=u}if(i.trim())n.push(i.trim());return n}function $e(e,n){if(typeof e!=="string")return e;let i=e.trim();if(i.startsWith('"')&&i.endsWith('"')||i.startsWith("'")&&i.endsWith("'"))return i.slice(1,-1);if(!i.startsWith("/")&&!i.startsWith(".")&&!i.startsWith("http")&&!i.startsWith("{")){let o=n[i];if(o!==void 0)return o}if(i.startsWith("{")||i.startsWith("["))try{return JSON.parse(i)}catch{}return i}var qe=kt();import{existsSync as Rt}from"fs";import ne from"path";function bs(){let e=[ne.join(import.meta.dir,"primitives"),ne.join(import.meta.dir,"..","primitives"),ne.join(import.meta.dir,"native","primitives"),ne.join(import.meta.dir,"..","native","primitives")];for(let n of e)if(Rt(ne.join(n,"View.stx")))return n;return e[0]}async function Ue(){try{return await import("./chunk-cgv3r6q9.js")}catch(e){if(!He)console.warn("[stx-media] Video processor not available, some features disabled:",e),He=!0;return null}}var He=!1,Be=!0,Je="metadata",Ot="https://cdn.jsdelivr.net/npm/ts-video-player@latest/dist/index.min.js";async function de(e,n={}){let i=n,o=e;if(o.process&&!o.skipProcessing){if(i.tsVideosConfig?.enabled&&!i.isDev)return jt(o,i)}if(i.processedResult?.processed)return Ge(e,i.processedResult,n);let s;if(o.generatePoster&&o.src&&!e.poster)s=await Nt(o,i);let{src:l,sources:d=[],poster:p,posterPlaceholder:u,controls:m=Be,autoplay:y=!1,muted:f=!1,loop:v=!1,preload:b=Je,playsinline:x=!0,lazy:k=!0,player:S="native",type:_,width:A,height:E,crossorigin:I,disablePictureInPicture:w=!1,disableRemotePlayback:C=!1}=e,D=s||p,{class:L,style:W}=e,T=e.id||`stx-video-${Math.random().toString(36).slice(2,8)}`;if(S==="ts-video")return It(e,n);if(_&&_!=="video")return Et(l||"",_,e);let V=d.length>0?d:l?[{src:l,type:Ke(l)}]:[],R=[`id="${T}"`];if(m)R.push("controls");if(y)R.push("autoplay");if(f)R.push("muted");if(v)R.push("loop");if(x)R.push("playsinline");if(w)R.push("disablepictureinpicture");if(C)R.push("disableremoteplayback");if(I)R.push(`crossorigin="${I}"`);if(k){if(R.push(`data-preload="${b}"`),R.push('preload="none"'),D)R.push(`data-poster="${M(D)}"`);R.push("data-stx-lazy")}else if(R.push(`preload="${b}"`),D)R.push(`poster="${M(D)}"`);if(A)R.push(`width="${A}"`);if(E)R.push(`height="${E}"`);if(L)R.push(`class="${M(L)}"`);if(W)R.push(`style="${M(W)}"`);let z=V.map((O)=>` <source ${k?`data-src="${M(O.src)}"`:`src="${M(O.src)}"`} type="${O.type}"${O.media?` media="${O.media}"`:""} />`).join(`
752
752
  `),G=`<video ${R.join(" ")}>
753
753
  ${z}
754
754
  Your browser does not support the video tag.
@@ -1007,7 +1007,7 @@ ${V}
1007
1007
  }
1008
1008
  `.trim();return{html:V,script:R,css:z}}function Ye(){return vt({name:"video",hasEndTag:!1,description:"Render a video with optional ts-videos processing, streaming, and poster generation",transform:async(e,n,i,o)=>{let{src:s,options:l}=Vt(e,n,i);if(!s)return console.warn("@video directive: missing src argument"),"<!-- @video: missing src -->";let d={src:s,poster:l.poster,controls:l.controls!==!1,autoplay:l.autoplay||!1,muted:l.muted||!1,loop:l.loop||!1,preload:l.preload||"metadata",playsinline:l.playsinline!==!1,lazy:l.lazy!==!1,player:l.player||"native",type:l.type,width:l.width,height:l.height,class:l.class,style:l.style,id:l.id,crossorigin:l.crossorigin,disablePictureInPicture:l.disablePictureInPicture,disableRemotePlayback:l.disableRemotePlayback,title:l.title,quality:l.quality,platform:l.platform,process:l.process,generatePoster:l.generatePoster,streaming:l.streaming,transcode:l.transcode,spriteSheet:l.spriteSheet,waveform:l.waveform},u={isDev:i.__isDev||!1,tsVideosConfig:i.__tsVideosConfig},m=await de(d,u),y=m.html;if(m.css)y+=`
1009
1009
  <style>${m.css}</style>`;if(m.script)y+=`
1010
- <script>${m.script}</script>`;return y},defaults:{src:"",options:{controls:!0,lazy:!0,preload:"metadata"}}})}function Vt(e,n,i){if(n.src)return{src:String(n.src),options:n.options||{}};let o=e.trim();if(o.startsWith("@video(")||o.startsWith("("))o=o.replace(/^@video\(/,"").replace(/^\(/,"").replace(/\)$/,"");let s=zt(o),l=Xe(s[0],i)||"",d={};if(s[1]){let p=Xe(s[1],i);if(typeof p==="object"&&p!==null)d=p;else if(typeof s[1]==="string")try{d=JSON.parse(s[1])}catch{}}return{src:l,options:d}}function zt(e){let n=[],i="",o=!1,s="",l=0,d=0;for(let p=0;p<e.length;p++){let u=e[p],m=p>0?e[p-1]:"";if((u==='"'||u==="'"||u==="`")&&m!=="\\"){if(!o)o=!0,s=u;else if(u===s)o=!1,s="";else i+=u;continue}if(!o){if(u==="{")l++;if(u==="}")l--;if(u==="[")d++;if(u==="]")d--;if(u===","&&l===0&&d===0){n.push(i.trim()),i="";continue}}i+=u}if(i.trim())n.push(i.trim());return n}function Xe(e,n){if(typeof e!=="string")return e;let i=e.trim();if(i.startsWith('"')&&i.endsWith('"')||i.startsWith("'")&&i.endsWith("'"))return i.slice(1,-1);if(!i.startsWith("/")&&!i.startsWith(".")&&!i.startsWith("http")&&!i.startsWith("{")){let o=n[i];if(o!==void 0)return o}if(i.startsWith("{")||i.startsWith("["))try{return JSON.parse(i)}catch{}return i}var Se=Ye();import Lt from"fs";import q from"path";async function bs(e,n){if(!e.webComponents?.enabled)return[];let i=e.webComponents.components||[],o=[];if(i.length>0){if(e.debug)console.log(`Building ${i.length} web components...`);for(let s of i)try{let l=await Wt(s,e,n);if(l)o.push(l)}catch(l){if(console.error(`Error building web component ${s.name}:`,l),e.debug)throw l}}return o}async function Wt(e,n,i){let{name:o,file:s,tag:l,extends:d}=e;if(!o||!s||!l)return console.error("Invalid web component configuration, missing required fields:",e),null;let p=null;if(q.isAbsolute(s)&&await r(s))p=s;else if(n.componentsDir){let k=q.join(n.componentsDir,s);if(await r(k))p=k}if(!p)p=await yn(s,process.cwd(),n,i);if(!p)return console.error(`Web component source file not found: ${s}`),null;let u=await Bun.file(p).text();i.add(p);let y=(e.outputFormat||"js")==="ts",f=y?qt({name:o,tag:l,baseElement:d,source:u,shadowDOM:e.shadowDOM??!0,template:e.template??!0,styleSource:e.styleSource,attributes:e.attributes||[],attributeTypes:e.attributeTypes||{}}):Ft({name:o,tag:l,baseElement:d,source:u,shadowDOM:e.shadowDOM??!0,template:e.template??!0,styleSource:e.styleSource,attributes:e.attributes||[]}),v=n.webComponents?.outputDir||"dist/web-components";await Lt.promises.mkdir(v,{recursive:!0});let b=y?"ts":"js",x=q.join(v,`${l}.${b}`);if(await Bun.write(x,f),n.debug)console.log(`Built web component ${o} -> ${x}`);return x}function Ft(e){let{name:n,tag:i,baseElement:o="HTMLElement",source:s,shadowDOM:l,template:d,styleSource:p,attributes:u=[]}=e,m=s.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").trim();if(!l)m=m.replace(/<slot\s+name=["']([^"']+)["']\s*>([\s\S]*?)<\/slot>/gi,'<div data-slot="$1">$2</div>'),m=m.replace(/<slot\s+name=["']([^"']+)["']\s*\/>/gi,'<div data-slot="$1"></div>'),m=m.replace(/<slot\s*>([\s\S]*?)<\/slot>/gi,"<div data-default-slot>$1</div>"),m=m.replace(/<slot\s*\/>/gi,"<div data-default-slot></div>");let y="";if(p)y=`<link rel="stylesheet" href="${p}">`;return`/**
1010
+ <script>${m.script}</script>`;return y},defaults:{src:"",options:{controls:!0,lazy:!0,preload:"metadata"}}})}function Vt(e,n,i){if(n.src)return{src:String(n.src),options:n.options||{}};let o=e.trim();if(o.startsWith("@video(")||o.startsWith("("))o=o.replace(/^@video\(/,"").replace(/^\(/,"").replace(/\)$/,"");let s=zt(o),l=Xe(s[0],i)||"",d={};if(s[1]){let p=Xe(s[1],i);if(typeof p==="object"&&p!==null)d=p;else if(typeof s[1]==="string")try{d=JSON.parse(s[1])}catch{}}return{src:l,options:d}}function zt(e){let n=[],i="",o=!1,s="",l=0,d=0;for(let p=0;p<e.length;p++){let u=e[p],m=p>0?e[p-1]:"";if((u==='"'||u==="'"||u==="`")&&m!=="\\"){if(!o)o=!0,s=u;else if(u===s)o=!1,s="";else i+=u;continue}if(!o){if(u==="{")l++;if(u==="}")l--;if(u==="[")d++;if(u==="]")d--;if(u===","&&l===0&&d===0){n.push(i.trim()),i="";continue}}i+=u}if(i.trim())n.push(i.trim());return n}function Xe(e,n){if(typeof e!=="string")return e;let i=e.trim();if(i.startsWith('"')&&i.endsWith('"')||i.startsWith("'")&&i.endsWith("'"))return i.slice(1,-1);if(!i.startsWith("/")&&!i.startsWith(".")&&!i.startsWith("http")&&!i.startsWith("{")){let o=n[i];if(o!==void 0)return o}if(i.startsWith("{")||i.startsWith("["))try{return JSON.parse(i)}catch{}return i}var Se=Ye();import Lt from"fs";import q from"path";async function ws(e,n){if(!e.webComponents?.enabled)return[];let i=e.webComponents.components||[],o=[];if(i.length>0){if(e.debug)console.log(`Building ${i.length} web components...`);for(let s of i)try{let l=await Wt(s,e,n);if(l)o.push(l)}catch(l){if(console.error(`Error building web component ${s.name}:`,l),e.debug)throw l}}return o}async function Wt(e,n,i){let{name:o,file:s,tag:l,extends:d}=e;if(!o||!s||!l)return console.error("Invalid web component configuration, missing required fields:",e),null;let p=null;if(q.isAbsolute(s)&&await r(s))p=s;else if(n.componentsDir){let k=q.join(n.componentsDir,s);if(await r(k))p=k}if(!p)p=await yn(s,process.cwd(),n,i);if(!p)return console.error(`Web component source file not found: ${s}`),null;let u=await Bun.file(p).text();i.add(p);let y=(e.outputFormat||"js")==="ts",f=y?qt({name:o,tag:l,baseElement:d,source:u,shadowDOM:e.shadowDOM??!0,template:e.template??!0,styleSource:e.styleSource,attributes:e.attributes||[],attributeTypes:e.attributeTypes||{}}):Ft({name:o,tag:l,baseElement:d,source:u,shadowDOM:e.shadowDOM??!0,template:e.template??!0,styleSource:e.styleSource,attributes:e.attributes||[]}),v=n.webComponents?.outputDir||"dist/web-components";await Lt.promises.mkdir(v,{recursive:!0});let b=y?"ts":"js",x=q.join(v,`${l}.${b}`);if(await Bun.write(x,f),n.debug)console.log(`Built web component ${o} -> ${x}`);return x}function Ft(e){let{name:n,tag:i,baseElement:o="HTMLElement",source:s,shadowDOM:l,template:d,styleSource:p,attributes:u=[]}=e,m=s.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").trim();if(!l)m=m.replace(/<slot\s+name=["']([^"']+)["']\s*>([\s\S]*?)<\/slot>/gi,'<div data-slot="$1">$2</div>'),m=m.replace(/<slot\s+name=["']([^"']+)["']\s*\/>/gi,'<div data-slot="$1"></div>'),m=m.replace(/<slot\s*>([\s\S]*?)<\/slot>/gi,"<div data-default-slot>$1</div>"),m=m.replace(/<slot\s*\/>/gi,"<div data-default-slot></div>");let y="";if(p)y=`<link rel="stylesheet" href="${p}">`;return`/**
1011
1011
  * ${n} Web Component
1012
1012
  * Auto-generated from stx component
1013
1013
  */
@@ -1307,6 +1307,6 @@ ${y}
1307
1307
  customElements.define('${n}', ${d});
1308
1308
  `}async function Qe(e,n,i,o){if(n.length<1)return c("WebComponent","@webcomponent directive requires at least the tag name parameter",t.INVALID_DIRECTIVE_SYNTAX);let s=n[0].replace(/['"]/g,""),d=(i.__stx_options||{}).componentsDir||"components",p=q.isAbsolute(d)?[q.join(d,`${s}.stx`),q.join(q.dirname(o),`${s}.stx`)]:[q.join(q.dirname(o),d,`${s}.stx`),q.join(process.cwd(),d,`${s}.stx`),q.join(q.dirname(o),`${s}.stx`)],u=null;for(let f of p)if(await r(f)){u=await Bun.file(f).text();break}if(!u)return c("WebComponent",`Component file not found: ${s}.stx`,t.FILE_NOT_FOUND);let m=Ht(u,s);return`<script type="module">
1309
1309
  ${Ut(m)}
1310
- </script>`}var j={enabled:!0,ssr:!1,partialsDir:"partials",componentsDir:"components",layoutsDir:"layouts",defaultLayout:"default",debug:!1,cache:!0,stateDir:ln,cachePath:".stx/cache",cacheVersion:"1.0.0",componentRenderCacheBytes:33554432,build:{pagesDir:"pages",outputDir:"dist",baseUrl:"/",sitemap:!0,minify:!0,cache:!0,cacheDir:".stx/ssg-cache",concurrency:10,generate404:!0,publicDir:"public",trailingSlash:!1,cleanOutput:!0},customDirectives:[{name:"markdown",handler:Te,hasEndTag:!0,description:"Render markdown content to HTML"},{name:"webcomponent",handler:Qe,hasEndTag:!1,description:"Include a web component in the template"},gc,mc,xs,Ss,Pe,Ae,_e,ke,Re,Ee,qe,Se,...Ys],middleware:[],i18n:{defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},webComponents:{enabled:!1,outputDir:"dist/web-components",components:[]},docs:{enabled:!1,outputDir:"docs",format:"markdown",components:!0,templates:!0,directives:!0},streaming:{enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},hydration:{enabled:!1,mode:"islands",clientEntry:"src/client.ts",autoMarkers:!0,preload:"lazy"},router:{enabled:!0,container:"main",linkSelector:"a[href]",viewTransitions:!0,scrollToTop:!0,scrollRestoration:!0,prefetch:!0,cache:!0,cacheTTL:300000,skipSelectors:'[data-no-router], [target="_blank"]',viewTransitionCSS:{oldRoot:"fade-out 0.15s ease-in",newRoot:"fade-in 0.2s ease-out",oldContent:"slide-out 0.2s ease-in",newContent:"slide-in 0.25s ease-out"}},a11y:{enabled:!0,addSrOnlyStyles:!0,level:"AA",autoFix:!1,ignoreChecks:[]},seo:{enabled:!0,socialPreview:!0,defaultConfig:{title:"stx Project",description:"A website built with stx templating engine"}},animation:{enabled:!0,defaultDuration:300,defaultEase:"ease",respectMotionPreferences:!0,staggerDelay:50},markdown:{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0,additionalThemes:["light-plus","one-dark-pro","dracula","monokai","solarized-light","nord","github-dark"]}},loops:{maxWhileIterations:1000,useAltLoopVariable:!1},story:{enabled:!0,outDir:".stx/dist/story",storyMatch:["**/*.story.stx"],storyIgnored:["**/node_modules/**","**/dist/**","**/.stx/**"],port:6006},pwa:{enabled:!1,manifest:{name:"stx App",shortName:"stx",description:"A Progressive Web App built with stx",startUrl:"/",display:"standalone",orientation:"any",themeColor:"#000000",backgroundColor:"#ffffff",scope:"/"},icons:{src:"public/icon.png",sizes:[72,96,128,144,152,192,384,512],generateWebP:!0,generateAppleIcons:!0,outputDir:"pwa-icons",purpose:["any","maskable"]},routes:[{pattern:"/",strategy:"network-first"},{pattern:"/static/*",strategy:"cache-first",maxAgeSeconds:2592000},{pattern:"/api/*",strategy:"network-only"},{pattern:"*.js",strategy:"stale-while-revalidate"},{pattern:"*.css",strategy:"stale-while-revalidate"},{pattern:"*.png",strategy:"cache-first"},{pattern:"*.jpg",strategy:"cache-first"},{pattern:"*.webp",strategy:"cache-first"},{pattern:"*.svg",strategy:"cache-first"}],offline:{enabled:!0,fallbackTitle:"You are offline",fallbackMessage:"Please check your internet connection and try again.",precacheAssets:[]},serviceWorker:{fileName:"sw.js",cacheVersion:"1.0.0",skipWaiting:!0,clientsClaim:!0,navigationPreload:!1,excludeRoutes:["/api/auth/*"],cacheFileTypes:["html","css","js","png","jpg","jpeg","webp","svg","woff","woff2"],useWorkbox:!1},autoInject:!0,push:{enabled:!1,defaultOptions:{vibrate:[100,50,100],requireInteraction:!1}},backgroundSync:{enabled:!1,queueName:"stx-sync-queue",maxRetentionMinutes:1440,maxRetries:3,minInterval:1000,forms:[],endpoints:[]},shareTarget:{enabled:!1,action:"/share-target",method:"POST",enctype:"multipart/form-data",params:{title:"title",text:"text",url:"url"}},fileHandlers:{enabled:!1},protocolHandlers:[],cacheStorage:{maxSize:100,maxEntries:500,maxAge:30,purgeStrategy:"lru"},updates:{enabled:!0,promptUser:!0,autoReload:!1,message:"A new version is available. Reload to update?"},precache:{enabled:!0,includeHtml:!0,includeJs:!0,includeCss:!0,includeImages:!0,includeFonts:!0,include:[],exclude:["*.map","*.LICENSE.txt"],maxFileSizeKB:500}},media:{enabled:!0,image:{enabled:!0,defaultWidths:[320,480,640,768,1024,1280,1536,1920],defaultFormats:["avif","webp","jpeg"],defaultQuality:80,placeholderStrategy:"thumbhash",lazyByDefault:!0,enableDpr:!0,defaultDpr:[1,2,3],tsImages:{enabled:!0,outputDir:"dist/images",baseUrl:"/images",formatQuality:{jpeg:{quality:85,mozjpeg:!0,progressive:!0},png:{compressionLevel:9,palette:!1},webp:{quality:82,effort:5,smartSubsample:!0},avif:{quality:75,effort:4,lossless:!1}},breakpoints:[320,480,640,768,1024,1280,1536,1920],batchOptions:{concurrency:4,optimizationPreset:"web"}}},video:{enabled:!0,lazyByDefault:!0,defaultControls:!0,tsVideos:{enabled:!0,outputDir:"dist/videos",baseUrl:"/videos",defaultQuality:"high",streaming:{enabled:!0,format:"hls",segmentDuration:6,defaultQualities:[{label:"1080p",width:1920,height:1080,bitrate:5000000,audioBitrate:192000},{label:"720p",width:1280,height:720,bitrate:2500000,audioBitrate:128000},{label:"480p",width:854,height:480,bitrate:1e6,audioBitrate:96000}]},thumbnails:{enabled:!0,count:10,format:"webp",width:320},transcoding:{defaultCodec:"h264",defaultAudioCodec:"aac",speedPreset:"medium"}}},upload:{enabled:!0,maxSize:10485760,allowedTypes:["image/*","video/*","audio/*","application/pdf"],maxConcurrent:3},protected:{enabled:!0,expirationSeconds:3600,batchSize:10},cache:{enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500}},broadcasting:{enabled:!1,driver:"bun",host:"0.0.0.0",port:6001,scheme:"ws",verbose:!1}};function Jt(e,n,i){let o=n||"pages";if(e)return{root:e,pagesDir:o};let s=i||process.cwd(),l=N.join(s,"resources","views"),d=N.join(s,"resources","layouts");if(Q.existsSync(l)&&Q.existsSync(d))return{root:"resources",pagesDir:"views"};let p=N.join(s,"resources","views","pages");if(Q.existsSync(p))return{root:"resources/views",pagesDir:o};return{root:".",pagesDir:o}}var tt=new Set,pe=["partialsDir","componentsDir","layoutsDir"],Ce=new WeakMap;function Kt(e,n){let i=n.replace(/[\\/]+$/,"");if(!i||i===".")return!0;let o=e.replace(/\\/g,"/"),s=i.replace(/\\/g,"/");return o===s||o.startsWith(`${s}/`)}function Df(e,n){let i=!e.root,o=Jt(e.root,e.pagesDir,n);if(e.root=o.root,e.pagesDir=o.pagesDir,i&&o.root!=="."){let s=`${n}::${o.root}`;if(!tt.has(s))tt.add(s),console.warn(`[stx] No "root" in config \u2014 inferred "${o.root}" from the project layout. Template directories are resolved under it; set root explicitly to pin this.`)}if(!Ce.has(e)){let s={};for(let l of pe){let d=e[l];if(typeof d==="string"&&d)s[l]=d}Ce.set(e,s)}if(e.root&&e.root!=="."){let s=e.root;for(let l of pe){let d=e[l];if(typeof d!=="string"||!d)continue;if(N.isAbsolute(d)||Kt(d,s))continue;e[l]=N.join(s,d)}}for(let s of pe){let l=e[s];if(typeof l!=="string"||!l||N.isAbsolute(l))continue;e[s]=N.resolve(n,l)}return e}function Gt(e,n){let i=Ce.get(e);for(let o of pe){let s=e[o];if(typeof s!=="string"||!s)continue;let l=N.isAbsolute(s)?s:N.join(n,s);if(Q.existsSync(l))continue;let d=i?.[o]??s,p=e.root,u=!!p&&p!==".";console.warn(`[stx] ${String(o)} resolves to "${l}", which does not exist. Configured as "${d}"`+(u?`, resolved under root "${p}".`:"."))}}function Yt(e){if(e.customDirectives)e.customDirectives=[...e.customDirectives];if(e.middleware)e.middleware=[...e.middleware];if(e.apiRoutes)e.apiRoutes={...e.apiRoutes}}function Xt(e){if(kc(e.stateDir),e.stateDir=gr(),e.cachePath=mr(e.cachePath),e.build)e.build.cacheDir=mr(e.build.cacheDir);if(e.media?.cache)e.media.cache.directory=mr(e.media.cache.directory);if(e.story)e.story.outDir=mr(e.story.outDir)}var K=null,Y=new Map,ue=new Map,se=null;async function Wo(e,n=Bt){try{return await n(e)}catch(i){if(i instanceof Error&&i.name==="ConfigNotFoundError")return{config:e.defaultConfig};throw i}}async function a(e){let n=e?N.resolve(e):process.cwd(),i=ue.get(n);if(i&&i.signature!==ws(i.graph)){let l=Y.get(n);if(Y.delete(n),ue.delete(n),!e)K=null,se=null;let{clearComponentCache:d}=await import("./chunk-3k6tem86.js"),{partialsCache:p}=await import("./chunk-vqa2s0v4.js");if(d(),p.clear(),l&&i.configSignature===vs(i.graph)){let u=l.then(async(m)=>{let y={...i.graph};await Ko(y,n),ue.set(n,{graph:y,signature:ws(y),configSignature:vs(y)});let f={...m,_layerGraph:y};if(!e)K=f;return f});return Y.set(n,u),u}}if(!e){if(K)return K;if(se)return se}let o=Y.get(n);if(o)return o;let s=(async()=>{let l=[".ts",".js",".mjs",".cjs",".json"],d=l.some((v)=>Q.existsSync(N.join(n,`stx.config${v}`))),p=l.some((v)=>Q.existsSync(N.join(n,"config",`ui${v}`))),u;if(d&&p){let v=await Wo({name:"ui",cwd:N.join(n,"config"),defaultConfig:j,errorPolicy:"throw",verbose:!1});u=(await Wo({name:"stx",alias:"ui",cwd:n,defaultConfig:v.config,errorPolicy:"throw",verbose:!1})).config}else u=(await Wo({name:"stx",alias:"ui",cwd:n,defaultConfig:j,errorPolicy:"throw",verbose:!1})).config;if(u.extends!==void 0||i){let v=await yc(n,j);u=v.config,ue.set(n,{graph:v.graph,signature:ws(v.graph),configSignature:vs(v.graph)})}if(u.runtimeConfig){let{resolveRuntimeConfig:v}=await import("./chunk-5ttj2c0h.js");v(u.runtimeConfig,{});let{generateRuntimeConfigTypes:b}=await import("./chunk-p66fgjeb.js");await b(n,u.runtimeConfig)}Yt(u),Xt(u),Df(u,n),Gt(u,n);let m=[],y=new Set((u.plugins??[]).map((v)=>typeof v==="string"?v:v[0]));for(let v of u.componentPackages??["@stacksjs/components"]){let b=`${v}/stx-plugin`;if(y.has(b)||y.has(v))continue;try{g.resolve(b,{paths:[n]}),m.push(b)}catch{}}let f=[...u.plugins??[],...m];if(f.length>0){let{pluginManager:v}=await import("./chunk-cwmjqker.js"),b=[],x=[];for(let k of f){let S=typeof k==="string"?k:k[0],_=typeof k==="string"?{}:k[1]||{};try{let A,E;try{let w=g.resolve(S,{paths:[n]});A=await import(w),E=N.dirname(w)}catch{let w=N.resolve(n,S);A=await import(w),E=N.dirname(w)}let I=A.default||A;if(!v.has(I.name))await v.register(I,u);if(I.components){let w=Array.isArray(I.components)?I.components:[I.components];for(let C of w)b.push(N.resolve(E,C))}if(I.pages){let w=N.resolve(E,I.pages),C=_.path||"/";x.push({dir:w,prefix:C})}if(I.setup){let w={addDirective:(C)=>{u.customDirectives=u.customDirectives||[],u.customDirectives.push(C)},addRoute:(C,D)=>{u.apiRoutes=u.apiRoutes||{},u.apiRoutes[C]=D},addMiddleware:(C)=>{u.middleware=u.middleware||[],u.middleware.push(C)},pluginDir:E,config:u};await I.setup(_,w)}process.stderr.write(`[stx] Plugin loaded: ${I.name||S}
1311
- `)}catch(A){console.warn(`[stx] Failed to load plugin ${S}:`,A.message)}}u._pluginComponentDirs=b,u._pluginPageDirs=x}if(u.nativePrimitives!==!1)u._nativePrimitivesFallback={dir:ys(),except:["Button","Checkbox","Switch","TextInput","Image","Video"]};return u})();if(Y.set(n,s),s.catch(()=>{if(Y.get(n)===s)Y.delete(n)}),!e)se=s,s.then((l)=>{K=l}).catch(()=>{});return s}var P=new Proxy(j,{get(e,n){if(K&&n in K)return K[n];if(!se)a().catch((i)=>{console.warn("[stx] Failed to load config file:",i?.message||i)});return e[n]}});function Dh(e){return e}function Mh(e){let n=[],i=[];if(e.partialsDir!==void 0&&typeof e.partialsDir!=="string")n.push({path:"partialsDir",message:"partialsDir must be a string",severity:"error"});if(e.componentsDir!==void 0&&typeof e.componentsDir!=="string")n.push({path:"componentsDir",message:"componentsDir must be a string",severity:"error"});if(e.cache!==void 0&&typeof e.cache!=="boolean")n.push({path:"cache",message:"cache must be a boolean",severity:"error"});if(e.debug!==void 0&&typeof e.debug!=="boolean")n.push({path:"debug",message:"debug must be a boolean",severity:"error"});if(e.streaming){if(e.streaming.bufferSize!==void 0){if(typeof e.streaming.bufferSize!=="number"||e.streaming.bufferSize<=0)n.push({path:"streaming.bufferSize",message:"streaming.bufferSize must be a positive number",severity:"error"})}if(e.streaming.timeout!==void 0){if(typeof e.streaming.timeout!=="number"||e.streaming.timeout<=0)n.push({path:"streaming.timeout",message:"streaming.timeout must be a positive number",severity:"error"})}if(e.streaming.strategy!==void 0){let o=["auto","manual","sections"];if(!o.includes(e.streaming.strategy))n.push({path:"streaming.strategy",message:`streaming.strategy must be one of: ${o.join(", ")}`,severity:"error"})}}if(e.i18n){if(e.i18n.format!==void 0){let o=["json","yaml","yml","js"];if(!o.includes(e.i18n.format))n.push({path:"i18n.format",message:`i18n.format must be one of: ${o.join(", ")}`,severity:"error"})}}if(e.animation){if(e.animation.defaultDuration!==void 0){if(typeof e.animation.defaultDuration!=="number"||e.animation.defaultDuration<0)n.push({path:"animation.defaultDuration",message:"animation.defaultDuration must be a non-negative number",severity:"error"})}if(e.animation.staggerDelay!==void 0){if(typeof e.animation.staggerDelay!=="number"||e.animation.staggerDelay<0)n.push({path:"animation.staggerDelay",message:"animation.staggerDelay must be a non-negative number",severity:"error"})}}if(e.a11y){if(e.a11y.level!==void 0){let o=["AA","AAA"];if(!o.includes(e.a11y.level))n.push({path:"a11y.level",message:`a11y.level must be one of: ${o.join(", ")}`,severity:"error"})}}if(e.hydration){if(e.hydration.mode!==void 0){let o=["progressive","islands"];if(!o.includes(e.hydration.mode))n.push({path:"hydration.mode",message:`hydration.mode must be one of: ${o.join(", ")}`,severity:"error"})}if(e.hydration.preload!==void 0){let o=["none","eager","lazy"];if(!o.includes(e.hydration.preload))n.push({path:"hydration.preload",message:`hydration.preload must be one of: ${o.join(", ")}`,severity:"error"})}}if(e.customDirectives)if(!Array.isArray(e.customDirectives))n.push({path:"customDirectives",message:"customDirectives must be an array",severity:"error"});else e.customDirectives.forEach((o,s)=>{if(!o.name||typeof o.name!=="string")n.push({path:`customDirectives[${s}].name`,message:"Custom directive must have a name string",severity:"error"});if(!o.handler||typeof o.handler!=="function")n.push({path:`customDirectives[${s}].handler`,message:"Custom directive must have a handler function",severity:"error"})});if(e.middleware)if(!Array.isArray(e.middleware))n.push({path:"middleware",message:"middleware must be an array",severity:"error"});else e.middleware.forEach((o,s)=>{if(!o.name||typeof o.name!=="string")n.push({path:`middleware[${s}].name`,message:"Middleware must have a name string",severity:"error"});if(!o.handler||typeof o.handler!=="function")n.push({path:`middleware[${s}].handler`,message:"Middleware must have a handler function",severity:"error"});if(!o.timing||!["before","after"].includes(o.timing))n.push({path:`middleware[${s}].timing`,message:'Middleware timing must be "before" or "after"',severity:"error"})});if(e.debug===!0&&e.cache===!0)i.push({path:"debug+cache",message:"Debug mode with caching enabled may show stale content during development",severity:"warning"});if(e.seo?.enabled===!0&&!e.seo?.defaultConfig?.title)i.push({path:"seo.defaultConfig.title",message:"SEO is enabled but no default title is set",severity:"warning"});if(e.pwa){if(e.pwa.enabled===!0&&!e.pwa.manifest?.name)n.push({path:"pwa.manifest.name",message:"PWA manifest name is required when PWA is enabled",severity:"error"});if(e.pwa.manifest?.display!==void 0){let o=["fullscreen","standalone","minimal-ui","browser"];if(!o.includes(e.pwa.manifest.display))n.push({path:"pwa.manifest.display",message:`PWA display must be one of: ${o.join(", ")}`,severity:"error"})}if(e.pwa.manifest?.orientation!==void 0){let o=["portrait","landscape","any","portrait-primary","portrait-secondary","landscape-primary","landscape-secondary"];if(!o.includes(e.pwa.manifest.orientation))n.push({path:"pwa.manifest.orientation",message:`PWA orientation must be one of: ${o.join(", ")}`,severity:"error"})}if(e.pwa.routes){let o=["cache-first","network-first","stale-while-revalidate","network-only","cache-only"];e.pwa.routes.forEach((s,l)=>{if(!s.pattern||typeof s.pattern!=="string")n.push({path:`pwa.routes[${l}].pattern`,message:"PWA route must have a pattern string",severity:"error"});if(!o.includes(s.strategy))n.push({path:`pwa.routes[${l}].strategy`,message:`PWA route strategy must be one of: ${o.join(", ")}`,severity:"error"});if(s.maxAgeSeconds!==void 0&&(typeof s.maxAgeSeconds!=="number"||s.maxAgeSeconds<0))n.push({path:`pwa.routes[${l}].maxAgeSeconds`,message:"PWA route maxAgeSeconds must be a non-negative number",severity:"error"});if(s.maxEntries!==void 0&&(typeof s.maxEntries!=="number"||s.maxEntries<1))n.push({path:`pwa.routes[${l}].maxEntries`,message:"PWA route maxEntries must be a positive number",severity:"error"})})}if(e.pwa.icons?.sizes){if(!Array.isArray(e.pwa.icons.sizes))n.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be an array of numbers",severity:"error"});else if(e.pwa.icons.sizes.filter((s)=>typeof s!=="number"||s<16||s>1024).length>0)n.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be numbers between 16 and 1024",severity:"error"})}if(e.pwa.icons?.purpose){let o=["any","maskable","monochrome"];if(e.pwa.icons.purpose.filter((l)=>!o.includes(l)).length>0)n.push({path:"pwa.icons.purpose",message:`PWA icon purpose must be one of: ${o.join(", ")}`,severity:"error"})}if(e.pwa.enabled===!0&&!e.pwa.icons?.src)i.push({path:"pwa.icons.src",message:"PWA is enabled but no icon source specified. Provide a 512x512 PNG for best results.",severity:"warning"});if(e.pwa.enabled===!0&&!e.pwa.manifest?.themeColor)i.push({path:"pwa.manifest.themeColor",message:"PWA theme color not set, defaulting to black",severity:"warning"})}return{valid:n.length===0,errors:n,warnings:i}}
1312
- export{cc,lc,ur,Ze,uc,ys,bs,j,Df,Wo,a,P,Dh,Mh};
1310
+ </script>`}var j={enabled:!0,ssr:!1,partialsDir:"partials",componentsDir:"components",layoutsDir:"layouts",defaultLayout:"default",debug:!1,cache:!0,stateDir:ln,cachePath:".stx/cache",cacheVersion:"1.0.0",componentRenderCacheBytes:33554432,build:{pagesDir:"pages",outputDir:"dist",baseUrl:"/",sitemap:!0,minify:!0,cache:!0,cacheDir:".stx/ssg-cache",concurrency:10,generate404:!0,publicDir:"public",trailingSlash:!1,cleanOutput:!0},customDirectives:[{name:"markdown",handler:Te,hasEndTag:!0,description:"Render markdown content to HTML"},{name:"webcomponent",handler:Qe,hasEndTag:!1,description:"Include a web component in the template"},mc,hc,Ss,ks,Pe,Ae,_e,ke,Re,Ee,qe,Se,...Zs],middleware:[],i18n:{defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},webComponents:{enabled:!1,outputDir:"dist/web-components",components:[]},docs:{enabled:!1,outputDir:"docs",format:"markdown",components:!0,templates:!0,directives:!0},streaming:{enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},hydration:{enabled:!1,mode:"islands",clientEntry:"src/client.ts",autoMarkers:!0,preload:"lazy"},router:{enabled:!0,container:"main",linkSelector:"a[href]",viewTransitions:!0,scrollToTop:!0,scrollRestoration:!0,prefetch:!0,cache:!0,cacheTTL:300000,skipSelectors:'[data-no-router], [target="_blank"]',viewTransitionCSS:{oldRoot:"fade-out 0.15s ease-in",newRoot:"fade-in 0.2s ease-out",oldContent:"slide-out 0.2s ease-in",newContent:"slide-in 0.25s ease-out"}},a11y:{enabled:!0,addSrOnlyStyles:!0,level:"AA",autoFix:!1,ignoreChecks:[]},seo:{enabled:!0,socialPreview:!0,defaultConfig:{title:"stx Project",description:"A website built with stx templating engine"}},animation:{enabled:!0,defaultDuration:300,defaultEase:"ease",respectMotionPreferences:!0,staggerDelay:50},markdown:{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0,additionalThemes:["light-plus","one-dark-pro","dracula","monokai","solarized-light","nord","github-dark"]}},loops:{maxWhileIterations:1000,useAltLoopVariable:!1},story:{enabled:!0,outDir:".stx/dist/story",storyMatch:["**/*.story.stx"],storyIgnored:["**/node_modules/**","**/dist/**","**/.stx/**"],port:6006},pwa:{enabled:!1,manifest:{name:"stx App",shortName:"stx",description:"A Progressive Web App built with stx",startUrl:"/",display:"standalone",orientation:"any",themeColor:"#000000",backgroundColor:"#ffffff",scope:"/"},icons:{src:"public/icon.png",sizes:[72,96,128,144,152,192,384,512],generateWebP:!0,generateAppleIcons:!0,outputDir:"pwa-icons",purpose:["any","maskable"]},routes:[{pattern:"/",strategy:"network-first"},{pattern:"/static/*",strategy:"cache-first",maxAgeSeconds:2592000},{pattern:"/api/*",strategy:"network-only"},{pattern:"*.js",strategy:"stale-while-revalidate"},{pattern:"*.css",strategy:"stale-while-revalidate"},{pattern:"*.png",strategy:"cache-first"},{pattern:"*.jpg",strategy:"cache-first"},{pattern:"*.webp",strategy:"cache-first"},{pattern:"*.svg",strategy:"cache-first"}],offline:{enabled:!0,fallbackTitle:"You are offline",fallbackMessage:"Please check your internet connection and try again.",precacheAssets:[]},serviceWorker:{fileName:"sw.js",cacheVersion:"1.0.0",skipWaiting:!0,clientsClaim:!0,navigationPreload:!1,excludeRoutes:["/api/auth/*"],cacheFileTypes:["html","css","js","png","jpg","jpeg","webp","svg","woff","woff2"],useWorkbox:!1},autoInject:!0,push:{enabled:!1,defaultOptions:{vibrate:[100,50,100],requireInteraction:!1}},backgroundSync:{enabled:!1,queueName:"stx-sync-queue",maxRetentionMinutes:1440,maxRetries:3,minInterval:1000,forms:[],endpoints:[]},shareTarget:{enabled:!1,action:"/share-target",method:"POST",enctype:"multipart/form-data",params:{title:"title",text:"text",url:"url"}},fileHandlers:{enabled:!1},protocolHandlers:[],cacheStorage:{maxSize:100,maxEntries:500,maxAge:30,purgeStrategy:"lru"},updates:{enabled:!0,promptUser:!0,autoReload:!1,message:"A new version is available. Reload to update?"},precache:{enabled:!0,includeHtml:!0,includeJs:!0,includeCss:!0,includeImages:!0,includeFonts:!0,include:[],exclude:["*.map","*.LICENSE.txt"],maxFileSizeKB:500}},media:{enabled:!0,image:{enabled:!0,defaultWidths:[320,480,640,768,1024,1280,1536,1920],defaultFormats:["avif","webp","jpeg"],defaultQuality:80,placeholderStrategy:"thumbhash",lazyByDefault:!0,enableDpr:!0,defaultDpr:[1,2,3],tsImages:{enabled:!0,outputDir:"dist/images",baseUrl:"/images",formatQuality:{jpeg:{quality:85,mozjpeg:!0,progressive:!0},png:{compressionLevel:9,palette:!1},webp:{quality:82,effort:5,smartSubsample:!0},avif:{quality:75,effort:4,lossless:!1}},breakpoints:[320,480,640,768,1024,1280,1536,1920],batchOptions:{concurrency:4,optimizationPreset:"web"}}},video:{enabled:!0,lazyByDefault:!0,defaultControls:!0,tsVideos:{enabled:!0,outputDir:"dist/videos",baseUrl:"/videos",defaultQuality:"high",streaming:{enabled:!0,format:"hls",segmentDuration:6,defaultQualities:[{label:"1080p",width:1920,height:1080,bitrate:5000000,audioBitrate:192000},{label:"720p",width:1280,height:720,bitrate:2500000,audioBitrate:128000},{label:"480p",width:854,height:480,bitrate:1e6,audioBitrate:96000}]},thumbnails:{enabled:!0,count:10,format:"webp",width:320},transcoding:{defaultCodec:"h264",defaultAudioCodec:"aac",speedPreset:"medium"}}},upload:{enabled:!0,maxSize:10485760,allowedTypes:["image/*","video/*","audio/*","application/pdf"],maxConcurrent:3},protected:{enabled:!0,expirationSeconds:3600,batchSize:10},cache:{enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500}},broadcasting:{enabled:!1,driver:"bun",host:"0.0.0.0",port:6001,scheme:"ws",verbose:!1}};function Jt(e,n,i){let o=n||"pages";if(e)return{root:e,pagesDir:o};let s=i||process.cwd(),l=N.join(s,"resources","views"),d=N.join(s,"resources","layouts");if(Q.existsSync(l)&&Q.existsSync(d))return{root:"resources",pagesDir:"views"};let p=N.join(s,"resources","views","pages");if(Q.existsSync(p))return{root:"resources/views",pagesDir:o};return{root:".",pagesDir:o}}var tt=new Set,pe=["partialsDir","componentsDir","layoutsDir"],Ce=new WeakMap;function Kt(e,n){let i=n.replace(/[\\/]+$/,"");if(!i||i===".")return!0;let o=e.replace(/\\/g,"/"),s=i.replace(/\\/g,"/");return o===s||o.startsWith(`${s}/`)}function Mf(e,n){let i=!e.root,o=Jt(e.root,e.pagesDir,n);if(e.root=o.root,e.pagesDir=o.pagesDir,i&&o.root!=="."){let s=`${n}::${o.root}`;if(!tt.has(s))tt.add(s),console.warn(`[stx] No "root" in config \u2014 inferred "${o.root}" from the project layout. Template directories are resolved under it; set root explicitly to pin this.`)}if(!Ce.has(e)){let s={};for(let l of pe){let d=e[l];if(typeof d==="string"&&d)s[l]=d}Ce.set(e,s)}if(e.root&&e.root!=="."){let s=e.root;for(let l of pe){let d=e[l];if(typeof d!=="string"||!d)continue;if(N.isAbsolute(d)||Kt(d,s))continue;e[l]=N.join(s,d)}}for(let s of pe){let l=e[s];if(typeof l!=="string"||!l||N.isAbsolute(l))continue;e[s]=N.resolve(n,l)}return e}function Gt(e,n){let i=Ce.get(e);for(let o of pe){let s=e[o];if(typeof s!=="string"||!s)continue;let l=N.isAbsolute(s)?s:N.join(n,s);if(Q.existsSync(l))continue;let d=i?.[o]??s,p=e.root,u=!!p&&p!==".";console.warn(`[stx] ${String(o)} resolves to "${l}", which does not exist. Configured as "${d}"`+(u?`, resolved under root "${p}".`:"."))}}function Yt(e){if(e.customDirectives)e.customDirectives=[...e.customDirectives];if(e.middleware)e.middleware=[...e.middleware];if(e.apiRoutes)e.apiRoutes={...e.apiRoutes}}function Xt(e){if(_c(e.stateDir),e.stateDir=gr(),e.cachePath=mr(e.cachePath),e.build)e.build.cacheDir=mr(e.build.cacheDir);if(e.media?.cache)e.media.cache.directory=mr(e.media.cache.directory);if(e.story)e.story.outDir=mr(e.story.outDir)}var K=null,Y=new Map,ue=new Map,se=null;async function qo(e,n=Bt){try{return await n(e)}catch(i){if(i instanceof Error&&i.name==="ConfigNotFoundError")return{config:e.defaultConfig};throw i}}async function a(e){let n=e?N.resolve(e):process.cwd(),i=ue.get(n);if(i&&i.signature!==vs(i.graph)){let l=Y.get(n);if(Y.delete(n),ue.delete(n),!e)K=null,se=null;let{clearComponentCache:d}=await import("./chunk-9vqj5jzp.js"),{partialsCache:p}=await import("./chunk-bqyj88qr.js");if(d(),p.clear(),l&&i.configSignature===xs(i.graph)){let u=l.then(async(m)=>{let y={...i.graph};await Xo(y,n),ue.set(n,{graph:y,signature:vs(y),configSignature:xs(y)});let f={...m,_layerGraph:y};if(!e)K=f;return f});return Y.set(n,u),u}}if(!e){if(K)return K;if(se)return se}let o=Y.get(n);if(o)return o;let s=(async()=>{let l=[".ts",".js",".mjs",".cjs",".json"],d=l.some((v)=>Q.existsSync(N.join(n,`stx.config${v}`))),p=l.some((v)=>Q.existsSync(N.join(n,"config",`ui${v}`))),u;if(d&&p){let v=await qo({name:"ui",cwd:N.join(n,"config"),defaultConfig:j,errorPolicy:"throw",verbose:!1});u=(await qo({name:"stx",alias:"ui",cwd:n,defaultConfig:v.config,errorPolicy:"throw",verbose:!1})).config}else u=(await qo({name:"stx",alias:"ui",cwd:n,defaultConfig:j,errorPolicy:"throw",verbose:!1})).config;if(u.extends!==void 0||i){let v=await bc(n,j);u=v.config,ue.set(n,{graph:v.graph,signature:vs(v.graph),configSignature:xs(v.graph)})}if(u.runtimeConfig){let{resolveRuntimeConfig:v}=await import("./chunk-1se5y83a.js");v(u.runtimeConfig,{});let{generateRuntimeConfigTypes:b}=await import("./chunk-zb8wv7sc.js");await b(n,u.runtimeConfig)}Yt(u),Xt(u),Mf(u,n),Gt(u,n);let m=[],y=new Set((u.plugins??[]).map((v)=>typeof v==="string"?v:v[0]));for(let v of u.componentPackages??["@stacksjs/components"]){let b=`${v}/stx-plugin`;if(y.has(b)||y.has(v))continue;try{g.resolve(b,{paths:[n]}),m.push(b)}catch{}}let f=[...u.plugins??[],...m];if(f.length>0){let{pluginManager:v}=await import("./chunk-q85s8ne0.js"),b=[],x=[];for(let k of f){let S=typeof k==="string"?k:k[0],_=typeof k==="string"?{}:k[1]||{};try{let A,E;try{let w=g.resolve(S,{paths:[n]});A=await import(w),E=N.dirname(w)}catch{let w=N.resolve(n,S);A=await import(w),E=N.dirname(w)}let I=A.default||A;if(!v.has(I.name))await v.register(I,u);if(I.components){let w=Array.isArray(I.components)?I.components:[I.components];for(let C of w)b.push(N.resolve(E,C))}if(I.pages){let w=N.resolve(E,I.pages),C=_.path||"/";x.push({dir:w,prefix:C})}if(I.setup){let w={addDirective:(C)=>{u.customDirectives=u.customDirectives||[],u.customDirectives.push(C)},addRoute:(C,D)=>{u.apiRoutes=u.apiRoutes||{},u.apiRoutes[C]=D},addMiddleware:(C)=>{u.middleware=u.middleware||[],u.middleware.push(C)},pluginDir:E,config:u};await I.setup(_,w)}process.stderr.write(`[stx] Plugin loaded: ${I.name||S}
1311
+ `)}catch(A){console.warn(`[stx] Failed to load plugin ${S}:`,A.message)}}u._pluginComponentDirs=b,u._pluginPageDirs=x}if(u.nativePrimitives!==!1)u._nativePrimitivesFallback={dir:bs(),except:["Button","Checkbox","Switch","TextInput","Image","Video"]};return u})();if(Y.set(n,s),s.catch(()=>{if(Y.get(n)===s)Y.delete(n)}),!e)se=s,s.then((l)=>{K=l}).catch(()=>{});return s}var P=new Proxy(j,{get(e,n){if(K&&n in K)return K[n];if(!se)a().catch((i)=>{console.warn("[stx] Failed to load config file:",i?.message||i)});return e[n]}});function Mh(e){return e}function Lh(e){let n=[],i=[];if(e.partialsDir!==void 0&&typeof e.partialsDir!=="string")n.push({path:"partialsDir",message:"partialsDir must be a string",severity:"error"});if(e.componentsDir!==void 0&&typeof e.componentsDir!=="string")n.push({path:"componentsDir",message:"componentsDir must be a string",severity:"error"});if(e.cache!==void 0&&typeof e.cache!=="boolean")n.push({path:"cache",message:"cache must be a boolean",severity:"error"});if(e.debug!==void 0&&typeof e.debug!=="boolean")n.push({path:"debug",message:"debug must be a boolean",severity:"error"});if(e.streaming){if(e.streaming.bufferSize!==void 0){if(typeof e.streaming.bufferSize!=="number"||e.streaming.bufferSize<=0)n.push({path:"streaming.bufferSize",message:"streaming.bufferSize must be a positive number",severity:"error"})}if(e.streaming.timeout!==void 0){if(typeof e.streaming.timeout!=="number"||e.streaming.timeout<=0)n.push({path:"streaming.timeout",message:"streaming.timeout must be a positive number",severity:"error"})}if(e.streaming.strategy!==void 0){let o=["auto","manual","sections"];if(!o.includes(e.streaming.strategy))n.push({path:"streaming.strategy",message:`streaming.strategy must be one of: ${o.join(", ")}`,severity:"error"})}}if(e.i18n){if(e.i18n.format!==void 0){let o=["json","yaml","yml","js"];if(!o.includes(e.i18n.format))n.push({path:"i18n.format",message:`i18n.format must be one of: ${o.join(", ")}`,severity:"error"})}}if(e.animation){if(e.animation.defaultDuration!==void 0){if(typeof e.animation.defaultDuration!=="number"||e.animation.defaultDuration<0)n.push({path:"animation.defaultDuration",message:"animation.defaultDuration must be a non-negative number",severity:"error"})}if(e.animation.staggerDelay!==void 0){if(typeof e.animation.staggerDelay!=="number"||e.animation.staggerDelay<0)n.push({path:"animation.staggerDelay",message:"animation.staggerDelay must be a non-negative number",severity:"error"})}}if(e.a11y){if(e.a11y.level!==void 0){let o=["AA","AAA"];if(!o.includes(e.a11y.level))n.push({path:"a11y.level",message:`a11y.level must be one of: ${o.join(", ")}`,severity:"error"})}}if(e.hydration){if(e.hydration.mode!==void 0){let o=["progressive","islands"];if(!o.includes(e.hydration.mode))n.push({path:"hydration.mode",message:`hydration.mode must be one of: ${o.join(", ")}`,severity:"error"})}if(e.hydration.preload!==void 0){let o=["none","eager","lazy"];if(!o.includes(e.hydration.preload))n.push({path:"hydration.preload",message:`hydration.preload must be one of: ${o.join(", ")}`,severity:"error"})}}if(e.customDirectives)if(!Array.isArray(e.customDirectives))n.push({path:"customDirectives",message:"customDirectives must be an array",severity:"error"});else e.customDirectives.forEach((o,s)=>{if(!o.name||typeof o.name!=="string")n.push({path:`customDirectives[${s}].name`,message:"Custom directive must have a name string",severity:"error"});if(!o.handler||typeof o.handler!=="function")n.push({path:`customDirectives[${s}].handler`,message:"Custom directive must have a handler function",severity:"error"})});if(e.middleware)if(!Array.isArray(e.middleware))n.push({path:"middleware",message:"middleware must be an array",severity:"error"});else e.middleware.forEach((o,s)=>{if(!o.name||typeof o.name!=="string")n.push({path:`middleware[${s}].name`,message:"Middleware must have a name string",severity:"error"});if(!o.handler||typeof o.handler!=="function")n.push({path:`middleware[${s}].handler`,message:"Middleware must have a handler function",severity:"error"});if(!o.timing||!["before","after"].includes(o.timing))n.push({path:`middleware[${s}].timing`,message:'Middleware timing must be "before" or "after"',severity:"error"})});if(e.debug===!0&&e.cache===!0)i.push({path:"debug+cache",message:"Debug mode with caching enabled may show stale content during development",severity:"warning"});if(e.seo?.enabled===!0&&!e.seo?.defaultConfig?.title)i.push({path:"seo.defaultConfig.title",message:"SEO is enabled but no default title is set",severity:"warning"});if(e.pwa){if(e.pwa.enabled===!0&&!e.pwa.manifest?.name)n.push({path:"pwa.manifest.name",message:"PWA manifest name is required when PWA is enabled",severity:"error"});if(e.pwa.manifest?.display!==void 0){let o=["fullscreen","standalone","minimal-ui","browser"];if(!o.includes(e.pwa.manifest.display))n.push({path:"pwa.manifest.display",message:`PWA display must be one of: ${o.join(", ")}`,severity:"error"})}if(e.pwa.manifest?.orientation!==void 0){let o=["portrait","landscape","any","portrait-primary","portrait-secondary","landscape-primary","landscape-secondary"];if(!o.includes(e.pwa.manifest.orientation))n.push({path:"pwa.manifest.orientation",message:`PWA orientation must be one of: ${o.join(", ")}`,severity:"error"})}if(e.pwa.routes){let o=["cache-first","network-first","stale-while-revalidate","network-only","cache-only"];e.pwa.routes.forEach((s,l)=>{if(!s.pattern||typeof s.pattern!=="string")n.push({path:`pwa.routes[${l}].pattern`,message:"PWA route must have a pattern string",severity:"error"});if(!o.includes(s.strategy))n.push({path:`pwa.routes[${l}].strategy`,message:`PWA route strategy must be one of: ${o.join(", ")}`,severity:"error"});if(s.maxAgeSeconds!==void 0&&(typeof s.maxAgeSeconds!=="number"||s.maxAgeSeconds<0))n.push({path:`pwa.routes[${l}].maxAgeSeconds`,message:"PWA route maxAgeSeconds must be a non-negative number",severity:"error"});if(s.maxEntries!==void 0&&(typeof s.maxEntries!=="number"||s.maxEntries<1))n.push({path:`pwa.routes[${l}].maxEntries`,message:"PWA route maxEntries must be a positive number",severity:"error"})})}if(e.pwa.icons?.sizes){if(!Array.isArray(e.pwa.icons.sizes))n.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be an array of numbers",severity:"error"});else if(e.pwa.icons.sizes.filter((s)=>typeof s!=="number"||s<16||s>1024).length>0)n.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be numbers between 16 and 1024",severity:"error"})}if(e.pwa.icons?.purpose){let o=["any","maskable","monochrome"];if(e.pwa.icons.purpose.filter((l)=>!o.includes(l)).length>0)n.push({path:"pwa.icons.purpose",message:`PWA icon purpose must be one of: ${o.join(", ")}`,severity:"error"})}if(e.pwa.enabled===!0&&!e.pwa.icons?.src)i.push({path:"pwa.icons.src",message:"PWA is enabled but no icon source specified. Provide a 512x512 PNG for best results.",severity:"warning"});if(e.pwa.enabled===!0&&!e.pwa.manifest?.themeColor)i.push({path:"pwa.manifest.themeColor",message:"PWA theme color not set, defaulting to black",severity:"warning"})}return{valid:n.length===0,errors:n,warnings:i}}
1312
+ export{lc,uc,ur,Ze,dc,bs,ws,j,Mf,qo,a,P,Mh,Lh};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{io,Zi,Hr,ao,co,$n,qt,Qi,Vr,Ur,lo,uo,Ug,Wg,dt}from"./chunk-x0qtgyqr.js";export{dt as DeployError,Zi as calculateSha1,Hr as collectDeployFiles,Ur as createDefaultNetlifyConfig,ao as createFileManifest,io as createNetlifyClient,Ug as deploy,Vr as detectProjectConfig,co as filterRequiredFiles,$n as formatSize,Qi as generateNetlifyToml,qt as getTotalSize,uo as hasNetlifyConfig,Wg as initNetlify,lo as writeNetlifyConfig};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Bm,Fm}from"./chunk-91q55gjp.js";export{Fm as ensureTeleportTargets,Bm as processTeleportDirectives};
@@ -1,4 +1,4 @@
1
1
  // @bun
2
- import{R,t,c}from"./chunk-7s9wx19m.js";import{Z}from"./chunk-4qrr2mdd.js";import{qo}from"./chunk-nrh8t8re.js";import C from"path";var S;async function W(){if(S!==void 0)return S;try{let e=await import("@stacksjs/ts-i18n");S=e.loadLocale??null}catch{S=null}return S}var P={defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},v={},L={},k={};function J(e,s=0){if(s<=0)return!1;return Date.now()-e.loadedAt>s}async function G(e,s){if({...P,...s.i18n}.cache&&v[e]){let r=v[e],o=s.i18n?.cacheMaxAge??0;if(!J(r,o))return r.translations}if(L[e]?.state==="loading")return L[e].promise;k[e]="loading";let n=T(e,s).then((r)=>(k[e]="loaded",delete L[e],r)).catch((r)=>{throw k[e]="error",L[e]={promise:n,state:"error",error:r instanceof Error?r:Error(String(r))},r});return L[e]={promise:n,state:"loading"},n}async function T(e,s){let i={...P,...s.i18n},n=C.isAbsolute(i.translationsDir)?i.translationsDir:C.resolve(s.root||process.cwd(),i.translationsDir);try{let r=await W(),o=r?await r(e,{translationsDir:n,defaultLocale:i.defaultLocale,sources:te(i.format)}):await Y(e,i,n);if(o===void 0){let u=e!==i.defaultLocale?await T(i.defaultLocale,s):{};if(i.cache)v[e]={translations:u,loadedAt:Date.now(),locale:e};return u}let l=o;if(i.cache)v[e]={translations:l,loadedAt:Date.now(),locale:e};return l}catch(r){if(s.debug)console.error(`Error loading translation file for locale "${e}":`,r);if(e!==i.defaultLocale)return T(i.defaultLocale,s);return{}}}async function Y(e,s,i){let n=C.join(i,`${e}${Q(s.format)}`);try{let r=await import(n);return r.default||r}catch(r){try{let o=await Bun.file(n).text();if(s.format==="yaml"||s.format==="yml")return X(o);if(s.format==="json")return JSON.parse(o);throw r}catch{return}}}function Q(e){switch(e){case"yaml":return".yaml";case"yml":return".yml";case"js":return".js";case"ts":return".ts";case"json":default:return".json"}}function X(e){let s={},i=e.split(`
3
- `),n=[{obj:s,indent:-1}];for(let r of i){let o=r.replace(/#.*$/,"").trimEnd();if(!o.trim())continue;let l=o.search(/\S/);if(l===-1)continue;while(n.length>1&&n[n.length-1].indent>=l)n.pop();let u=n[n.length-1].obj,a=o.match(/^(\s*)(\S[^:]*):\s*(.*)$/);if(a){let[,,g,p]=a,f=g.trim(),m=p.trim();if(m==="")u[f]={},n.push({obj:u[f],indent:l});else u[f]=ee(m)}}return s}function ee(e){if(e.startsWith("'")&&e.endsWith("'")||e.startsWith('"')&&e.endsWith('"'))return e.slice(1,-1);let s=e.toLowerCase();if(s==="true"||s==="yes")return!0;if(s==="false"||s==="no")return!1;if(s==="null"||s==="~")return null;let i=Number(e);if(!Number.isNaN(i)&&e!=="")return i;return e}function te(e){switch(e){case"yaml":case"yml":return["yaml"];case"js":case"ts":return["ts"];case"json":default:return["json"]}}async function re(e,s){return G(e,s)}function ne(e,s){for(let i of e){let n=i.trim(),r=n.match(/^\{(\d+)\}\s*(.*)$/);if(r){let l=Number.parseInt(r[1],10);if(s===l)return r[2];continue}let o=n.match(/^\[(\d+),(\d+|\*)\]\s*(.*)$/);if(o){let l=Number.parseInt(o[1],10),u=o[2]==="*"?Number.POSITIVE_INFINITY:Number.parseInt(o[2],10);if(s>=l&&s<=u)return o[3];continue}}if(e.length===2)return s===1?e[0].trim():e[1].trim();if(s<e.length)return e[s].trim();return e[e.length-1].trim()}function ie(e,s={}){return j(e,s)}function j(e,s){let i="",n=0;while(n<e.length)if(e[n]==="{"){let r=se(e,n);if(r===-1){i+=e[n],n++;continue}let o=e.slice(n+1,r);i+=ae(o,s),n=r+1}else if(e[n]==="'"&&n+1<e.length)if(e[n+1]==="'")i+="'",n+=2;else if(e[n+1]==="{"||e[n+1]==="}")i+=e[n+1],n+=2;else i+=e[n],n++;else i+=e[n],n++;return i}function se(e,s){let i=0;for(let n=s;n<e.length;n++)if(e[n]==="{")i++;else if(e[n]==="}"){if(i--,i===0)return n}return-1}function ae(e,s){let i=oe(e);if(i.length===0)return`{${e}}`;let n=i[0].trim(),r=s[n];if(i.length===1)return r!==void 0?String(r):`{${n}}`;switch(i[1].trim().toLowerCase()){case"plural":return le(r,i.slice(2).join(","),s);case"select":return ue(r,i.slice(2).join(","));case"selectordinal":return de(r,i.slice(2).join(","));case"number":return pe(r,i[2]?.trim());case"date":return fe(r,i[2]?.trim());case"time":return me(r,i[2]?.trim());default:return r!==void 0?String(r):`{${e}}`}}function oe(e){let s=[],i="",n=0;for(let r=0;r<e.length;r++){let o=e[r];if(o==="{")n++,i+=o;else if(o==="}")n--,i+=o;else if(o===","&&n===0)s.push(i),i="";else i+=o}if(i)s.push(i);return s}function le(e,s,i){let n=Number(e)||0,r=I(s),o=`=${n}`;if(r[o])return E(r[o],n,i);let l=ce(n);if(r[l])return E(r[l],n,i);if(r.other)return E(r.other,n,i);return String(n)}function E(e,s,i){let n=e.replace(/#/g,String(s));return j(n,i)}function ce(e){let s=Math.abs(e),i=Math.floor(s),n=String(e).includes(".")?String(e).split(".")[1].length:0;if(i===1&&n===0)return"one";return"other"}function ue(e,s){let i=String(e||""),n=I(s);if(n[i])return n[i];return n.other||String(e)}function de(e,s){let i=Number(e)||0,n=I(s),r=ge(i);if(n[r])return n[r].replace(/#/g,String(i));if(n.other)return n.other.replace(/#/g,String(i));return String(i)}function ge(e){let s=Math.abs(e),i=s%10,n=s%100;if(i===1&&n!==11)return"one";if(i===2&&n!==12)return"two";if(i===3&&n!==13)return"few";return"other"}function I(e){let s={},i=/(\w+|=\d+)\s*\{([^{}]*(?:\{[^{}]*\}[^{}]*)*)\}/g,n=i.exec(e);while(n!==null)s[n[1]]=n[2],n=i.exec(e);return s}function pe(e,s){let i=Number(e);if(Number.isNaN(i))return String(e);switch(s){case"integer":return Math.floor(i).toLocaleString();case"percent":return`${(i*100).toFixed(0)}%`;case"currency":return i.toLocaleString(void 0,{style:"currency",currency:"USD"});default:return i.toLocaleString()}}function fe(e,s){let i=e instanceof Date?e:new Date(String(e));if(Number.isNaN(i.getTime()))return String(e);let n={};switch(s){case"short":n.dateStyle="short";break;case"medium":n.dateStyle="medium";break;case"long":n.dateStyle="long";break;case"full":n.dateStyle="full";break;default:n.dateStyle="medium"}return i.toLocaleDateString(void 0,n)}function me(e,s){let i=e instanceof Date?e:new Date(String(e));if(Number.isNaN(i.getTime()))return String(e);let n={};switch(s){case"short":n.timeStyle="short";break;case"medium":n.timeStyle="medium";break;case"long":n.timeStyle="long";break;case"full":n.timeStyle="full";break;default:n.timeStyle="short"}return i.toLocaleTimeString(void 0,n)}function be(e){return/\{[^}]+,\s*(?:plural|select|selectordinal|number|date|time)\s*,/.test(e)}function O(e,s,i=!0,n={}){let r=e.split("."),o=s;for(let u of r){if(o===void 0||o===null)break;o=o[u]}if(o===void 0||o===null)return i?e:"";let l=String(o);if(be(l))return ie(l,n);if(l.includes("|")&&"count"in n){let u=Number(n.count),a=l.split("|");l=ne(a,u)}for(let[u,a]of Object.entries(n)){let g=u.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");l=l.replace(new RegExp(`:${g}`,"g"),()=>String(a))}return l}var D=new Set(["ar","arc","ckb","dv","fa","he","khw","ks","nqo","prs","ps","sd","syr","ug","ur","uz-af","yi"]),he=new Set(["adlm","arab","aran","hebr","nkoo","rohg","syrc","thaa","yezi"]);function q(e){if(!e)return"ltr";let s=e.trim().toLowerCase().replace(/_/g,"-").split("-"),i=s[0];if(!i)return"ltr";let n=s[1]?.length===4?s[1]:void 0;if(n)return he.has(n)?"rtl":"ltr";if(s.length>1&&D.has(`${i}-${s[1]}`))return"rtl";return D.has(i)?"rtl":"ltr"}async function dc(e,s,i,n){let r=e,o=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)([\s\S]*?)@endtranslate/g,l={...P,...n.i18n},u=await re(l.locale,n);s.__translations=u,s.__locale=l.locale,s.__i18nConfig=l,r=await F(r,o,async(p,f,m,w,h)=>{try{let b={};if(m)try{let d=[()=>JSON.parse(m),()=>{let x=`{"data":${m}}`,A=JSON.parse(x);return typeof A.data==="object"?A.data:{}},()=>R(m,s)];for(let x of d)try{if(b=x(),Object.keys(b).length>0)break}catch{}}catch(d){if(n.debug)console.error("Error parsing parameters for @translate directive:",d)}let y=O(f,u,l.fallbackToKey,b);return y?Z(r,h,y,!1,p.length):w.trim()}catch(b){if(n.debug)console.error("Error processing @translate directive:",b);return c("Translate",`Error in @translate('${f}'): ${b instanceof Error?b.message:String(b)}`,t.EVALUATION_ERROR)}});let a=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]+\})\s*)?\)/g;if(n.debug){console.warn(`Processing translations in template. Sections: ${r.includes("<h2>Translation with Parameters</h2>")?"Parameters section found":"Parameters section missing"}`);let p=[...r.matchAll(a)];console.warn(`Found ${p.length} @translate matches`),p.forEach((f,m)=>console.warn(`Match ${m}: ${f[0]}, Key: ${f[1]}, Params: ${f[2]||"none"}`))}return r=await F(r,/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)/g,async(p,f,m,w)=>{try{let h={};if(m)try{let b=[()=>JSON.parse(m),()=>{let y=`{"data":${m}}`,d=JSON.parse(y);return typeof d.data==="object"?d.data:{}},()=>R(m,s)];for(let y of b)try{if(h=y(),Object.keys(h).length>0)break}catch{}}catch(b){if(n.debug)console.error("Error parsing parameters for @translate directive:",b)}return Z(r,w,O(f,u,l.fallbackToKey,h),!1,p.length)}catch(h){if(n.debug)console.error("Error processing @translate directive:",h);return c("Translate",`Error in @translate('${f}'): ${h instanceof Error?h.message:String(h)}`,t.EVALUATION_ERROR)}}),r}async function F(e,s,i){let n=[];return e.replace(s,(o,...l)=>{let u=i(o,...l).then((a)=>({match:o,replacement:a}));return n.push(u),o}),(await Promise.all(n)).reduce((o,{match:l,replacement:u})=>o.replace(l,()=>u),e)}function _(e,s){if(!e||q(e)!=="rtl")return!1;return!s||s.trim().toLowerCase()!=="rtl"}function V(e){if(!e)return!1;return e.trim().split(/\s+/)[0]?.toLowerCase()==="presentation"||e.trim().split(/\s+/)[0]?.toLowerCase()==="none"}function U(e,s){let i=new RegExp(`\\b${s}\\s*=\\s*("([^"]*)"|'([^']*)'|([^\\s>]+))`,"i").exec(e);if(!i)return null;return i[2]??i[3]??i[4]??null}function pc(e,s,i,n){let r=e;r=r.replace(/@a11y\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(l,u,a)=>{let p={"aria-label":"Ensure interactive elements have accessible labels","alt-text":"Provide alternative text for images",focus:"Ensure the element can receive keyboard focus",landmark:"Use appropriate landmark roles","heading-order":"Maintain proper heading hierarchy","color-contrast":"Ensure sufficient color contrast","keyboard-nav":"Make sure element is keyboard navigable","screen-reader":"Optimize for screen reader users"}[u]||"Make this element accessible";return`<!-- a11y-hint: ${a||p} -->`});let o=/@screenReader\(([^@]*)\)@endScreenReader/g;return r=r.replace(o,(l,u)=>`<span class="sr-only">${u.trim()}</span>`),r=r.replace(/@ariaDescribe\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(l,u,a)=>`<span id="${`desc-${u}`}" class="sr-only">${a}</span>`),r}function ye(){return typeof globalThis.document<"u"&&typeof globalThis.document.createElement==="function"}function xe(e){let s=new Map,i=e.replace(/<(\/?)([A-Z][\w:.-]*)(?=[\s/>])/g,(r,o,l)=>{let u=s.get(l);if(!u)u=`stx-a11y-component-${s.size}`,s.set(l,u);return`<${o}${u}`}),n=new Map([...s.entries()].map(([r,o])=>[o,r]));return{protectedSource:i,restore:(r)=>r.replace(/<(\/?)(stx-a11y-component-\d+)(?=[\s/>])/g,(o,l,u)=>{let a=n.get(u);return a?`<${l}${a}`:o})}}function we(e,s){let i=[],n=/<img\s+([^>]*)>/gi,r;r=n.exec(e);while(r!==null){let d=r[1];if(!/\balt\s*=/i.test(d))i.push({type:"missing-alt",element:r[0].substring(0,100),message:"Image missing alt attribute",impact:"serious",help:"Add alt text to images for screen readers",helpUrl:"https://web.dev/learn/accessibility/images/"});r=n.exec(e)}let o=/<button([^>]*)>\s*<\/button>/gi;r=o.exec(e);while(r!==null){let d=r[1];if(!/\baria-label\s*=/i.test(d)&&!/\btitle\s*=/i.test(d))i.push({type:"missing-accessible-name",element:r[0].substring(0,100),message:"Empty button missing accessible name",impact:"critical",help:"Add text content, aria-label, or title",helpUrl:"https://web.dev/learn/accessibility/aria-html/"});r=o.exec(e)}let l=/<a\s+([^>]*)>\s*<\/a>/gi;r=l.exec(e);while(r!==null){let d=r[1];if(!/\baria-label\s*=/i.test(d)&&!/\btitle\s*=/i.test(d))i.push({type:"link-missing-text",element:r[0].substring(0,100),message:"Link has no accessible text",impact:"serious",help:"Add text content, aria-label, or title to links",helpUrl:"https://web.dev/learn/accessibility/more-html/#links"});r=l.exec(e)}let u=/<(input|select|textarea)\s+([^>]*)>/gi;r=u.exec(e);while(r!==null){let d=r[2];if(/\btype\s*=\s*["']hidden["']/i.test(d)){r=u.exec(e);continue}let x=/\baria-label\s*=/i.test(d)||/\baria-labelledby\s*=/i.test(d),A=d.match(/\bid\s*=\s*["']([^"']+)["']/i);if(!x){let B=A&&new RegExp(`<label[^>]*\\bfor\\s*=\\s*["']${A[1]}["']`,"i").test(e),M=r.index,N=e.substring(0,M),Se=e.substring(M),H=(N.match(/<label\b/gi)||[]).length,z=(N.match(/<\/label>/gi)||[]).length,K=H>z;if(!B&&!K)i.push({type:"input-missing-label",element:r[0].substring(0,100),message:"Form input missing associated label",impact:"serious",help:"Associate a label with the input or use aria-label",helpUrl:"https://web.dev/learn/accessibility/forms/"})}r=u.exec(e)}let a=/<h([1-6])[^>]*>/gi,g=[];r=a.exec(e);while(r!==null)g.push(Number.parseInt(r[1],10)),r=a.exec(e);let p=0;for(let d of g){if(p>0&&d>p+1)i.push({type:"heading-skip",element:`<h${d}>`,message:`Heading level skipped from h${p} to h${d}`,impact:"moderate",help:"Maintain proper heading hierarchy without skipping levels",helpUrl:"https://web.dev/learn/accessibility/structure/"});p=d}if(/<html\b/i.test(e)&&!/<html[^>]*\slang\s*=/i.test(e))i.push({type:"missing-lang",element:"<html>",message:"Document language not specified",impact:"serious",help:"Add lang attribute to the html element",helpUrl:"https://web.dev/learn/accessibility/more-html/#language"});let f=e.match(/<html\b([^>]*)>/i);if(f&&_(U(f[1],"lang"),U(f[1],"dir")))i.push({type:"missing-dir",element:f[0].substring(0,100),message:'Document language is right-to-left but dir="rtl" is not set',impact:"serious",help:'Add dir="rtl" to the html element so the layout mirrors the text',helpUrl:"https://www.w3.org/International/questions/qa-html-dir"});let m=/<table([^>]*)>([\s\S]*?)<\/table>/gi;r=m.exec(e);while(r!==null){let d=r[2];if(!V(U(r[1],"role"))&&!/<th\b/i.test(d))i.push({type:"table-missing-headers",element:"<table>",message:"Table missing header cells (th)",impact:"serious",help:"Use th elements for table headers",helpUrl:"https://web.dev/learn/accessibility/more-html/#tables"});r=m.exec(e)}let w=/<(video|audio)[^>]*\sautoplay\s[^>]*>/gi;r=w.exec(e);while(r!==null){if(!/\bmuted\b/i.test(r[0]))i.push({type:"autoplay-audio",element:`<${r[1]}>`,message:"Auto-playing media may disrupt users",impact:"moderate",help:"Add muted attribute or provide controls to stop playback",helpUrl:"https://web.dev/learn/accessibility/more-html/#multimedia"});r=w.exec(e)}let h=/\btabindex\s*=\s*["']([1-9]\d*)["']/gi;r=h.exec(e);while(r!==null)i.push({type:"positive-tabindex",element:`tabindex="${r[1]}"`,message:"Positive tabindex disrupts natural tab order",impact:"moderate",help:'Use tabindex="0" or "-1" instead of positive values',helpUrl:"https://web.dev/learn/accessibility/focus/#tab-index"}),r=h.exec(e);let b=/<iframe\s+([^>]*)>/gi;r=b.exec(e);while(r!==null){let d=r[1];if(!/\btitle\s*=/i.test(d)&&!/\baria-label\s*=/i.test(d))i.push({type:"iframe-missing-title",element:"<iframe>",message:"Iframe missing title attribute",impact:"serious",help:"Add a title attribute to describe the iframe content",helpUrl:"https://web.dev/learn/accessibility/more-html/#frames"});r=b.exec(e)}let y=/<([a-z]+)\s+([^>]*role\s*=\s*["']button["'][^>]*)>/gi;r=y.exec(e);while(r!==null){let d=r[1].toLowerCase(),x=r[2];if(d!=="button"&&!/\btabindex\s*=/i.test(x))i.push({type:"button-not-focusable",element:r[0].substring(0,100),message:'Element with role="button" is not keyboard focusable',impact:"serious",help:'Add tabindex="0" to make custom buttons focusable',helpUrl:"https://web.dev/learn/accessibility/focus/"});r=y.exec(e)}return i}async function Ae(e,s){let{protectedSource:i}=xe(e);if(!ye())return we(i,s);let n=[];try{let r=globalThis.document.createElement("div");r.innerHTML=i,r.querySelectorAll("img").forEach((a)=>{if(!a.hasAttribute("alt"))n.push({type:"missing-alt",element:`<${a.outerHTML}>`,message:"Image missing alt attribute",impact:"serious",help:"Add alt text to images for screen readers",helpUrl:"https://web.dev/learn/accessibility/images/"})}),r.querySelectorAll('button, a, [role="button"]').forEach((a)=>{if(!(a.hasAttribute("aria-label")||a.hasAttribute("aria-labelledby")||a.textContent&&a.textContent.trim().length>0))n.push({type:"missing-accessible-name",element:`<${a.outerHTML}>`,message:"Interactive element missing accessible name",impact:"critical",help:"Add text content, aria-label, or aria-labelledby",helpUrl:"https://web.dev/learn/accessibility/aria-html/"})}),r.querySelectorAll("input, select, textarea").forEach((a)=>{let g=a.getAttribute("id"),p=g&&r.querySelector(`label[for="${g}"]`),f=a.hasAttribute("aria-label")||a.hasAttribute("aria-labelledby"),m=a.closest("label")!==null;if(!p&&!f&&!m)n.push({type:"input-missing-label",element:`<${a.outerHTML}>`,message:"Form input missing associated label",impact:"serious",help:"Associate a label with the input or use aria-label",helpUrl:"https://web.dev/learn/accessibility/forms/"})});let o=Array.from(r.querySelectorAll("h1, h2, h3, h4, h5, h6")),l=0;for(let a of o){let g=Number.parseInt(a.tagName.charAt(1));if(l>0&&g>l+1)n.push({type:"heading-skip",element:`<${a.outerHTML}>`,message:`Heading level skipped from h${l} to h${g}`,impact:"moderate",help:"Maintain proper heading hierarchy without skipping levels",helpUrl:"https://web.dev/learn/accessibility/structure/"});l=g}let u=r.querySelector("html");if(i.includes("<html")&&u&&!u.hasAttribute("lang"))n.push({type:"missing-lang",element:"<html>",message:"Document language not specified",impact:"serious",help:"Add lang attribute to the html element",helpUrl:"https://web.dev/learn/accessibility/more-html/#language"});if(u&&_(u.getAttribute("lang"),u.getAttribute("dir")))n.push({type:"missing-dir",element:"<html>",message:'Document language is right-to-left but dir="rtl" is not set',impact:"serious",help:'Add dir="rtl" to the html element so the layout mirrors the text',helpUrl:"https://www.w3.org/International/questions/qa-html-dir"});if(r.querySelectorAll("a").forEach((a)=>{let g=a.textContent&&a.textContent.trim().length>0,p=a.hasAttribute("aria-label")||a.hasAttribute("aria-labelledby"),f=a.hasAttribute("title"),m=a.querySelector("img[alt]");if(!g&&!p&&!f&&!m)n.push({type:"link-missing-text",element:`<${a.outerHTML}>`,message:"Link has no accessible text",impact:"serious",help:"Add text content, aria-label, or title to links",helpUrl:"https://web.dev/learn/accessibility/more-html/#links"})}),i.includes("<nav")||i.includes("<header")){if(!r.querySelector('a[href="#main"], a[href="#content"], .skip-link, [class*="skip"]')&&r.querySelectorAll("a").length>5)n.push({type:"missing-skip-link",element:"<nav>",message:"Consider adding a skip navigation link",impact:"minor",help:"Add a skip link to allow keyboard users to bypass navigation",helpUrl:"https://web.dev/learn/accessibility/focus/#skip-links"})}if(r.querySelectorAll("table").forEach((a)=>{if(V(a.getAttribute("role")))return;let g=a.querySelector("caption");if(!a.querySelector("th"))n.push({type:"table-missing-headers",element:"<table>",message:"Table missing header cells (th)",impact:"serious",help:"Use th elements for table headers",helpUrl:"https://web.dev/learn/accessibility/more-html/#tables"});if(!g&&!a.hasAttribute("aria-label")&&!a.hasAttribute("aria-labelledby"))n.push({type:"table-missing-caption",element:"<table>",message:"Table missing caption or accessible name",impact:"minor",help:"Add a caption element or aria-label to describe the table",helpUrl:"https://web.dev/learn/accessibility/more-html/#tables"})}),r.querySelectorAll('[style*="color"]').forEach((a)=>{let g=a.getAttribute("style")||"";if(g.includes("color:")&&!g.includes("background"))n.push({type:"potential-contrast-issue",element:`<${a.tagName.toLowerCase()}>`,message:"Element has inline color style - verify contrast ratio",impact:"minor",help:"Ensure text has sufficient contrast ratio (4.5:1 for normal text)",helpUrl:"https://web.dev/learn/accessibility/color-contrast/"})}),r.querySelectorAll("video[autoplay], audio[autoplay]").forEach((a)=>{if(!a.hasAttribute("muted"))n.push({type:"autoplay-audio",element:`<${a.tagName.toLowerCase()}>`,message:"Auto-playing media may disrupt users",impact:"moderate",help:"Add muted attribute or provide controls to stop playback",helpUrl:"https://web.dev/learn/accessibility/more-html/#multimedia"})}),r.querySelectorAll("[tabindex]").forEach((a)=>{if(Number.parseInt(a.getAttribute("tabindex")||"0")>0)n.push({type:"positive-tabindex",element:`<${a.tagName.toLowerCase()}>`,message:"Positive tabindex disrupts natural tab order",impact:"moderate",help:'Use tabindex="0" or "-1" instead of positive values',helpUrl:"https://web.dev/learn/accessibility/focus/#tab-index"})}),r.querySelectorAll('[role="button"]').forEach((a)=>{if(!a.hasAttribute("tabindex"))n.push({type:"button-not-focusable",element:`<${a.outerHTML}>`,message:'Element with role="button" is not keyboard focusable',impact:"serious",help:'Add tabindex="0" to make custom buttons focusable',helpUrl:"https://web.dev/learn/accessibility/focus/"})}),i.includes("<body")&&!r.querySelector('main, [role="main"]'))n.push({type:"missing-main-landmark",element:"<body>",message:"Document missing main landmark region",impact:"moderate",help:"Add a main element to identify the primary content",helpUrl:"https://web.dev/learn/accessibility/structure/#landmarks"});r.querySelectorAll("iframe").forEach((a)=>{if(!a.hasAttribute("title")&&!a.hasAttribute("aria-label"))n.push({type:"iframe-missing-title",element:"<iframe>",message:"Iframe missing title attribute",impact:"serious",help:"Add a title attribute to describe the iframe content",helpUrl:"https://web.dev/learn/accessibility/more-html/#frames"})})}catch(r){console.error(`Error checking accessibility in ${s}:`,r)}return n}async function fc(e,s={}){let i={},{recursive:n=!0,ignorePaths:r=[]}=s,o=Array.isArray(e)?e:[e],l=await qo(o,{recursive:n,ignorePaths:r}),u=[];for(let a of l)try{let g=await Bun.file(a).text();if(a.endsWith("good-a11y.stx"))continue;let p=await Ae(g,a);if(u.push(a),p.length>0)i[a]=p}catch(g){console.error(`Error scanning ${a}:`,g)}return{results:i,scannedFiles:u}}var gc={name:"a11y",handler:(e,s,i,n)=>{if(!s.length)return e;let r=s[0].replace(/['"]/g,""),o=s.length>1?s[1].replace(/['"]/g,""):"",u={"aria-label":"Ensure interactive elements have accessible labels","alt-text":"Provide alternative text for images",focus:"Ensure the element can receive keyboard focus",landmark:"Use appropriate landmark roles","heading-order":"Maintain proper heading hierarchy","color-contrast":"Ensure sufficient color contrast","keyboard-nav":"Make sure element is keyboard navigable","screen-reader":"Optimize for screen reader users"}[r]||"Make this element accessible";return`<!-- a11y-hint: ${o||u} -->${e}`},hasEndTag:!1},mc={name:"screenReader",handler:(e)=>`<span class="sr-only">${e}</span>`,hasEndTag:!0};
4
- export{dc,pc,fc,gc,mc};
2
+ import{R,t,c}from"./chunk-5s2dwh5z.js";import{Z}from"./chunk-s8p958da.js";import{Ko}from"./chunk-79x0812m.js";import C from"path";var S;async function W(){if(S!==void 0)return S;try{let e=await import("@stacksjs/ts-i18n");S=e.loadLocale??null}catch{S=null}return S}var P={defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},v={},L={},k={};function J(e,s=0){if(s<=0)return!1;return Date.now()-e.loadedAt>s}async function G(e,s){if({...P,...s.i18n}.cache&&v[e]){let r=v[e],o=s.i18n?.cacheMaxAge??0;if(!J(r,o))return r.translations}if(L[e]?.state==="loading")return L[e].promise;k[e]="loading";let n=T(e,s).then((r)=>(k[e]="loaded",delete L[e],r)).catch((r)=>{throw k[e]="error",L[e]={promise:n,state:"error",error:r instanceof Error?r:Error(String(r))},r});return L[e]={promise:n,state:"loading"},n}async function T(e,s){let i={...P,...s.i18n},n=C.isAbsolute(i.translationsDir)?i.translationsDir:C.resolve(s.root||process.cwd(),i.translationsDir);try{let r=await W(),o=r?await r(e,{translationsDir:n,defaultLocale:i.defaultLocale,sources:te(i.format)}):await Y(e,i,n);if(o===void 0){let u=e!==i.defaultLocale?await T(i.defaultLocale,s):{};if(i.cache)v[e]={translations:u,loadedAt:Date.now(),locale:e};return u}let l=o;if(i.cache)v[e]={translations:l,loadedAt:Date.now(),locale:e};return l}catch(r){if(s.debug)console.error(`Error loading translation file for locale "${e}":`,r);if(e!==i.defaultLocale)return T(i.defaultLocale,s);return{}}}async function Y(e,s,i){let n=C.join(i,`${e}${Q(s.format)}`);try{let r=await import(n);return r.default||r}catch(r){try{let o=await Bun.file(n).text();if(s.format==="yaml"||s.format==="yml")return X(o);if(s.format==="json")return JSON.parse(o);throw r}catch{return}}}function Q(e){switch(e){case"yaml":return".yaml";case"yml":return".yml";case"js":return".js";case"ts":return".ts";case"json":default:return".json"}}function X(e){let s={},i=e.split(`
3
+ `),n=[{obj:s,indent:-1}];for(let r of i){let o=r.replace(/#.*$/,"").trimEnd();if(!o.trim())continue;let l=o.search(/\S/);if(l===-1)continue;while(n.length>1&&n[n.length-1].indent>=l)n.pop();let u=n[n.length-1].obj,a=o.match(/^(\s*)(\S[^:]*):\s*(.*)$/);if(a){let[,,g,p]=a,f=g.trim(),m=p.trim();if(m==="")u[f]={},n.push({obj:u[f],indent:l});else u[f]=ee(m)}}return s}function ee(e){if(e.startsWith("'")&&e.endsWith("'")||e.startsWith('"')&&e.endsWith('"'))return e.slice(1,-1);let s=e.toLowerCase();if(s==="true"||s==="yes")return!0;if(s==="false"||s==="no")return!1;if(s==="null"||s==="~")return null;let i=Number(e);if(!Number.isNaN(i)&&e!=="")return i;return e}function te(e){switch(e){case"yaml":case"yml":return["yaml"];case"js":case"ts":return["ts"];case"json":default:return["json"]}}async function re(e,s){return G(e,s)}function ne(e,s){for(let i of e){let n=i.trim(),r=n.match(/^\{(\d+)\}\s*(.*)$/);if(r){let l=Number.parseInt(r[1],10);if(s===l)return r[2];continue}let o=n.match(/^\[(\d+),(\d+|\*)\]\s*(.*)$/);if(o){let l=Number.parseInt(o[1],10),u=o[2]==="*"?Number.POSITIVE_INFINITY:Number.parseInt(o[2],10);if(s>=l&&s<=u)return o[3];continue}}if(e.length===2)return s===1?e[0].trim():e[1].trim();if(s<e.length)return e[s].trim();return e[e.length-1].trim()}function ie(e,s={}){return j(e,s)}function j(e,s){let i="",n=0;while(n<e.length)if(e[n]==="{"){let r=se(e,n);if(r===-1){i+=e[n],n++;continue}let o=e.slice(n+1,r);i+=ae(o,s),n=r+1}else if(e[n]==="'"&&n+1<e.length)if(e[n+1]==="'")i+="'",n+=2;else if(e[n+1]==="{"||e[n+1]==="}")i+=e[n+1],n+=2;else i+=e[n],n++;else i+=e[n],n++;return i}function se(e,s){let i=0;for(let n=s;n<e.length;n++)if(e[n]==="{")i++;else if(e[n]==="}"){if(i--,i===0)return n}return-1}function ae(e,s){let i=oe(e);if(i.length===0)return`{${e}}`;let n=i[0].trim(),r=s[n];if(i.length===1)return r!==void 0?String(r):`{${n}}`;switch(i[1].trim().toLowerCase()){case"plural":return le(r,i.slice(2).join(","),s);case"select":return ue(r,i.slice(2).join(","));case"selectordinal":return de(r,i.slice(2).join(","));case"number":return pe(r,i[2]?.trim());case"date":return fe(r,i[2]?.trim());case"time":return me(r,i[2]?.trim());default:return r!==void 0?String(r):`{${e}}`}}function oe(e){let s=[],i="",n=0;for(let r=0;r<e.length;r++){let o=e[r];if(o==="{")n++,i+=o;else if(o==="}")n--,i+=o;else if(o===","&&n===0)s.push(i),i="";else i+=o}if(i)s.push(i);return s}function le(e,s,i){let n=Number(e)||0,r=I(s),o=`=${n}`;if(r[o])return E(r[o],n,i);let l=ce(n);if(r[l])return E(r[l],n,i);if(r.other)return E(r.other,n,i);return String(n)}function E(e,s,i){let n=e.replace(/#/g,String(s));return j(n,i)}function ce(e){let s=Math.abs(e),i=Math.floor(s),n=String(e).includes(".")?String(e).split(".")[1].length:0;if(i===1&&n===0)return"one";return"other"}function ue(e,s){let i=String(e||""),n=I(s);if(n[i])return n[i];return n.other||String(e)}function de(e,s){let i=Number(e)||0,n=I(s),r=ge(i);if(n[r])return n[r].replace(/#/g,String(i));if(n.other)return n.other.replace(/#/g,String(i));return String(i)}function ge(e){let s=Math.abs(e),i=s%10,n=s%100;if(i===1&&n!==11)return"one";if(i===2&&n!==12)return"two";if(i===3&&n!==13)return"few";return"other"}function I(e){let s={},i=/(\w+|=\d+)\s*\{([^{}]*(?:\{[^{}]*\}[^{}]*)*)\}/g,n=i.exec(e);while(n!==null)s[n[1]]=n[2],n=i.exec(e);return s}function pe(e,s){let i=Number(e);if(Number.isNaN(i))return String(e);switch(s){case"integer":return Math.floor(i).toLocaleString();case"percent":return`${(i*100).toFixed(0)}%`;case"currency":return i.toLocaleString(void 0,{style:"currency",currency:"USD"});default:return i.toLocaleString()}}function fe(e,s){let i=e instanceof Date?e:new Date(String(e));if(Number.isNaN(i.getTime()))return String(e);let n={};switch(s){case"short":n.dateStyle="short";break;case"medium":n.dateStyle="medium";break;case"long":n.dateStyle="long";break;case"full":n.dateStyle="full";break;default:n.dateStyle="medium"}return i.toLocaleDateString(void 0,n)}function me(e,s){let i=e instanceof Date?e:new Date(String(e));if(Number.isNaN(i.getTime()))return String(e);let n={};switch(s){case"short":n.timeStyle="short";break;case"medium":n.timeStyle="medium";break;case"long":n.timeStyle="long";break;case"full":n.timeStyle="full";break;default:n.timeStyle="short"}return i.toLocaleTimeString(void 0,n)}function be(e){return/\{[^}]+,\s*(?:plural|select|selectordinal|number|date|time)\s*,/.test(e)}function O(e,s,i=!0,n={}){let r=e.split("."),o=s;for(let u of r){if(o===void 0||o===null)break;o=o[u]}if(o===void 0||o===null)return i?e:"";let l=String(o);if(be(l))return ie(l,n);if(l.includes("|")&&"count"in n){let u=Number(n.count),a=l.split("|");l=ne(a,u)}for(let[u,a]of Object.entries(n)){let g=u.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");l=l.replace(new RegExp(`:${g}`,"g"),()=>String(a))}return l}var D=new Set(["ar","arc","ckb","dv","fa","he","khw","ks","nqo","prs","ps","sd","syr","ug","ur","uz-af","yi"]),he=new Set(["adlm","arab","aran","hebr","nkoo","rohg","syrc","thaa","yezi"]);function q(e){if(!e)return"ltr";let s=e.trim().toLowerCase().replace(/_/g,"-").split("-"),i=s[0];if(!i)return"ltr";let n=s[1]?.length===4?s[1]:void 0;if(n)return he.has(n)?"rtl":"ltr";if(s.length>1&&D.has(`${i}-${s[1]}`))return"rtl";return D.has(i)?"rtl":"ltr"}async function pc(e,s,i,n){let r=e,o=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)([\s\S]*?)@endtranslate/g,l={...P,...n.i18n},u=await re(l.locale,n);s.__translations=u,s.__locale=l.locale,s.__i18nConfig=l,r=await F(r,o,async(p,f,m,w,h)=>{try{let b={};if(m)try{let d=[()=>JSON.parse(m),()=>{let x=`{"data":${m}}`,A=JSON.parse(x);return typeof A.data==="object"?A.data:{}},()=>R(m,s)];for(let x of d)try{if(b=x(),Object.keys(b).length>0)break}catch{}}catch(d){if(n.debug)console.error("Error parsing parameters for @translate directive:",d)}let y=O(f,u,l.fallbackToKey,b);return y?Z(r,h,y,!1,p.length):w.trim()}catch(b){if(n.debug)console.error("Error processing @translate directive:",b);return c("Translate",`Error in @translate('${f}'): ${b instanceof Error?b.message:String(b)}`,t.EVALUATION_ERROR)}});let a=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]+\})\s*)?\)/g;if(n.debug){console.warn(`Processing translations in template. Sections: ${r.includes("<h2>Translation with Parameters</h2>")?"Parameters section found":"Parameters section missing"}`);let p=[...r.matchAll(a)];console.warn(`Found ${p.length} @translate matches`),p.forEach((f,m)=>console.warn(`Match ${m}: ${f[0]}, Key: ${f[1]}, Params: ${f[2]||"none"}`))}return r=await F(r,/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)/g,async(p,f,m,w)=>{try{let h={};if(m)try{let b=[()=>JSON.parse(m),()=>{let y=`{"data":${m}}`,d=JSON.parse(y);return typeof d.data==="object"?d.data:{}},()=>R(m,s)];for(let y of b)try{if(h=y(),Object.keys(h).length>0)break}catch{}}catch(b){if(n.debug)console.error("Error parsing parameters for @translate directive:",b)}return Z(r,w,O(f,u,l.fallbackToKey,h),!1,p.length)}catch(h){if(n.debug)console.error("Error processing @translate directive:",h);return c("Translate",`Error in @translate('${f}'): ${h instanceof Error?h.message:String(h)}`,t.EVALUATION_ERROR)}}),r}async function F(e,s,i){let n=[];return e.replace(s,(o,...l)=>{let u=i(o,...l).then((a)=>({match:o,replacement:a}));return n.push(u),o}),(await Promise.all(n)).reduce((o,{match:l,replacement:u})=>o.replace(l,()=>u),e)}function _(e,s){if(!e||q(e)!=="rtl")return!1;return!s||s.trim().toLowerCase()!=="rtl"}function V(e){if(!e)return!1;return e.trim().split(/\s+/)[0]?.toLowerCase()==="presentation"||e.trim().split(/\s+/)[0]?.toLowerCase()==="none"}function U(e,s){let i=new RegExp(`\\b${s}\\s*=\\s*("([^"]*)"|'([^']*)'|([^\\s>]+))`,"i").exec(e);if(!i)return null;return i[2]??i[3]??i[4]??null}function fc(e,s,i,n){let r=e;r=r.replace(/@a11y\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(l,u,a)=>{let p={"aria-label":"Ensure interactive elements have accessible labels","alt-text":"Provide alternative text for images",focus:"Ensure the element can receive keyboard focus",landmark:"Use appropriate landmark roles","heading-order":"Maintain proper heading hierarchy","color-contrast":"Ensure sufficient color contrast","keyboard-nav":"Make sure element is keyboard navigable","screen-reader":"Optimize for screen reader users"}[u]||"Make this element accessible";return`<!-- a11y-hint: ${a||p} -->`});let o=/@screenReader\(([^@]*)\)@endScreenReader/g;return r=r.replace(o,(l,u)=>`<span class="sr-only">${u.trim()}</span>`),r=r.replace(/@ariaDescribe\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(l,u,a)=>`<span id="${`desc-${u}`}" class="sr-only">${a}</span>`),r}function ye(){return typeof globalThis.document<"u"&&typeof globalThis.document.createElement==="function"}function xe(e){let s=new Map,i=e.replace(/<(\/?)([A-Z][\w:.-]*)(?=[\s/>])/g,(r,o,l)=>{let u=s.get(l);if(!u)u=`stx-a11y-component-${s.size}`,s.set(l,u);return`<${o}${u}`}),n=new Map([...s.entries()].map(([r,o])=>[o,r]));return{protectedSource:i,restore:(r)=>r.replace(/<(\/?)(stx-a11y-component-\d+)(?=[\s/>])/g,(o,l,u)=>{let a=n.get(u);return a?`<${l}${a}`:o})}}function we(e,s){let i=[],n=/<img\s+([^>]*)>/gi,r;r=n.exec(e);while(r!==null){let d=r[1];if(!/\balt\s*=/i.test(d))i.push({type:"missing-alt",element:r[0].substring(0,100),message:"Image missing alt attribute",impact:"serious",help:"Add alt text to images for screen readers",helpUrl:"https://web.dev/learn/accessibility/images/"});r=n.exec(e)}let o=/<button([^>]*)>\s*<\/button>/gi;r=o.exec(e);while(r!==null){let d=r[1];if(!/\baria-label\s*=/i.test(d)&&!/\btitle\s*=/i.test(d))i.push({type:"missing-accessible-name",element:r[0].substring(0,100),message:"Empty button missing accessible name",impact:"critical",help:"Add text content, aria-label, or title",helpUrl:"https://web.dev/learn/accessibility/aria-html/"});r=o.exec(e)}let l=/<a\s+([^>]*)>\s*<\/a>/gi;r=l.exec(e);while(r!==null){let d=r[1];if(!/\baria-label\s*=/i.test(d)&&!/\btitle\s*=/i.test(d))i.push({type:"link-missing-text",element:r[0].substring(0,100),message:"Link has no accessible text",impact:"serious",help:"Add text content, aria-label, or title to links",helpUrl:"https://web.dev/learn/accessibility/more-html/#links"});r=l.exec(e)}let u=/<(input|select|textarea)\s+([^>]*)>/gi;r=u.exec(e);while(r!==null){let d=r[2];if(/\btype\s*=\s*["']hidden["']/i.test(d)){r=u.exec(e);continue}let x=/\baria-label\s*=/i.test(d)||/\baria-labelledby\s*=/i.test(d),A=d.match(/\bid\s*=\s*["']([^"']+)["']/i);if(!x){let B=A&&new RegExp(`<label[^>]*\\bfor\\s*=\\s*["']${A[1]}["']`,"i").test(e),M=r.index,N=e.substring(0,M),Se=e.substring(M),H=(N.match(/<label\b/gi)||[]).length,z=(N.match(/<\/label>/gi)||[]).length,K=H>z;if(!B&&!K)i.push({type:"input-missing-label",element:r[0].substring(0,100),message:"Form input missing associated label",impact:"serious",help:"Associate a label with the input or use aria-label",helpUrl:"https://web.dev/learn/accessibility/forms/"})}r=u.exec(e)}let a=/<h([1-6])[^>]*>/gi,g=[];r=a.exec(e);while(r!==null)g.push(Number.parseInt(r[1],10)),r=a.exec(e);let p=0;for(let d of g){if(p>0&&d>p+1)i.push({type:"heading-skip",element:`<h${d}>`,message:`Heading level skipped from h${p} to h${d}`,impact:"moderate",help:"Maintain proper heading hierarchy without skipping levels",helpUrl:"https://web.dev/learn/accessibility/structure/"});p=d}if(/<html\b/i.test(e)&&!/<html[^>]*\slang\s*=/i.test(e))i.push({type:"missing-lang",element:"<html>",message:"Document language not specified",impact:"serious",help:"Add lang attribute to the html element",helpUrl:"https://web.dev/learn/accessibility/more-html/#language"});let f=e.match(/<html\b([^>]*)>/i);if(f&&_(U(f[1],"lang"),U(f[1],"dir")))i.push({type:"missing-dir",element:f[0].substring(0,100),message:'Document language is right-to-left but dir="rtl" is not set',impact:"serious",help:'Add dir="rtl" to the html element so the layout mirrors the text',helpUrl:"https://www.w3.org/International/questions/qa-html-dir"});let m=/<table([^>]*)>([\s\S]*?)<\/table>/gi;r=m.exec(e);while(r!==null){let d=r[2];if(!V(U(r[1],"role"))&&!/<th\b/i.test(d))i.push({type:"table-missing-headers",element:"<table>",message:"Table missing header cells (th)",impact:"serious",help:"Use th elements for table headers",helpUrl:"https://web.dev/learn/accessibility/more-html/#tables"});r=m.exec(e)}let w=/<(video|audio)[^>]*\sautoplay\s[^>]*>/gi;r=w.exec(e);while(r!==null){if(!/\bmuted\b/i.test(r[0]))i.push({type:"autoplay-audio",element:`<${r[1]}>`,message:"Auto-playing media may disrupt users",impact:"moderate",help:"Add muted attribute or provide controls to stop playback",helpUrl:"https://web.dev/learn/accessibility/more-html/#multimedia"});r=w.exec(e)}let h=/\btabindex\s*=\s*["']([1-9]\d*)["']/gi;r=h.exec(e);while(r!==null)i.push({type:"positive-tabindex",element:`tabindex="${r[1]}"`,message:"Positive tabindex disrupts natural tab order",impact:"moderate",help:'Use tabindex="0" or "-1" instead of positive values',helpUrl:"https://web.dev/learn/accessibility/focus/#tab-index"}),r=h.exec(e);let b=/<iframe\s+([^>]*)>/gi;r=b.exec(e);while(r!==null){let d=r[1];if(!/\btitle\s*=/i.test(d)&&!/\baria-label\s*=/i.test(d))i.push({type:"iframe-missing-title",element:"<iframe>",message:"Iframe missing title attribute",impact:"serious",help:"Add a title attribute to describe the iframe content",helpUrl:"https://web.dev/learn/accessibility/more-html/#frames"});r=b.exec(e)}let y=/<([a-z]+)\s+([^>]*role\s*=\s*["']button["'][^>]*)>/gi;r=y.exec(e);while(r!==null){let d=r[1].toLowerCase(),x=r[2];if(d!=="button"&&!/\btabindex\s*=/i.test(x))i.push({type:"button-not-focusable",element:r[0].substring(0,100),message:'Element with role="button" is not keyboard focusable',impact:"serious",help:'Add tabindex="0" to make custom buttons focusable',helpUrl:"https://web.dev/learn/accessibility/focus/"});r=y.exec(e)}return i}async function Ae(e,s){let{protectedSource:i}=xe(e);if(!ye())return we(i,s);let n=[];try{let r=globalThis.document.createElement("div");r.innerHTML=i,r.querySelectorAll("img").forEach((a)=>{if(!a.hasAttribute("alt"))n.push({type:"missing-alt",element:`<${a.outerHTML}>`,message:"Image missing alt attribute",impact:"serious",help:"Add alt text to images for screen readers",helpUrl:"https://web.dev/learn/accessibility/images/"})}),r.querySelectorAll('button, a, [role="button"]').forEach((a)=>{if(!(a.hasAttribute("aria-label")||a.hasAttribute("aria-labelledby")||a.textContent&&a.textContent.trim().length>0))n.push({type:"missing-accessible-name",element:`<${a.outerHTML}>`,message:"Interactive element missing accessible name",impact:"critical",help:"Add text content, aria-label, or aria-labelledby",helpUrl:"https://web.dev/learn/accessibility/aria-html/"})}),r.querySelectorAll("input, select, textarea").forEach((a)=>{let g=a.getAttribute("id"),p=g&&r.querySelector(`label[for="${g}"]`),f=a.hasAttribute("aria-label")||a.hasAttribute("aria-labelledby"),m=a.closest("label")!==null;if(!p&&!f&&!m)n.push({type:"input-missing-label",element:`<${a.outerHTML}>`,message:"Form input missing associated label",impact:"serious",help:"Associate a label with the input or use aria-label",helpUrl:"https://web.dev/learn/accessibility/forms/"})});let o=Array.from(r.querySelectorAll("h1, h2, h3, h4, h5, h6")),l=0;for(let a of o){let g=Number.parseInt(a.tagName.charAt(1));if(l>0&&g>l+1)n.push({type:"heading-skip",element:`<${a.outerHTML}>`,message:`Heading level skipped from h${l} to h${g}`,impact:"moderate",help:"Maintain proper heading hierarchy without skipping levels",helpUrl:"https://web.dev/learn/accessibility/structure/"});l=g}let u=r.querySelector("html");if(i.includes("<html")&&u&&!u.hasAttribute("lang"))n.push({type:"missing-lang",element:"<html>",message:"Document language not specified",impact:"serious",help:"Add lang attribute to the html element",helpUrl:"https://web.dev/learn/accessibility/more-html/#language"});if(u&&_(u.getAttribute("lang"),u.getAttribute("dir")))n.push({type:"missing-dir",element:"<html>",message:'Document language is right-to-left but dir="rtl" is not set',impact:"serious",help:'Add dir="rtl" to the html element so the layout mirrors the text',helpUrl:"https://www.w3.org/International/questions/qa-html-dir"});if(r.querySelectorAll("a").forEach((a)=>{let g=a.textContent&&a.textContent.trim().length>0,p=a.hasAttribute("aria-label")||a.hasAttribute("aria-labelledby"),f=a.hasAttribute("title"),m=a.querySelector("img[alt]");if(!g&&!p&&!f&&!m)n.push({type:"link-missing-text",element:`<${a.outerHTML}>`,message:"Link has no accessible text",impact:"serious",help:"Add text content, aria-label, or title to links",helpUrl:"https://web.dev/learn/accessibility/more-html/#links"})}),i.includes("<nav")||i.includes("<header")){if(!r.querySelector('a[href="#main"], a[href="#content"], .skip-link, [class*="skip"]')&&r.querySelectorAll("a").length>5)n.push({type:"missing-skip-link",element:"<nav>",message:"Consider adding a skip navigation link",impact:"minor",help:"Add a skip link to allow keyboard users to bypass navigation",helpUrl:"https://web.dev/learn/accessibility/focus/#skip-links"})}if(r.querySelectorAll("table").forEach((a)=>{if(V(a.getAttribute("role")))return;let g=a.querySelector("caption");if(!a.querySelector("th"))n.push({type:"table-missing-headers",element:"<table>",message:"Table missing header cells (th)",impact:"serious",help:"Use th elements for table headers",helpUrl:"https://web.dev/learn/accessibility/more-html/#tables"});if(!g&&!a.hasAttribute("aria-label")&&!a.hasAttribute("aria-labelledby"))n.push({type:"table-missing-caption",element:"<table>",message:"Table missing caption or accessible name",impact:"minor",help:"Add a caption element or aria-label to describe the table",helpUrl:"https://web.dev/learn/accessibility/more-html/#tables"})}),r.querySelectorAll('[style*="color"]').forEach((a)=>{let g=a.getAttribute("style")||"";if(g.includes("color:")&&!g.includes("background"))n.push({type:"potential-contrast-issue",element:`<${a.tagName.toLowerCase()}>`,message:"Element has inline color style - verify contrast ratio",impact:"minor",help:"Ensure text has sufficient contrast ratio (4.5:1 for normal text)",helpUrl:"https://web.dev/learn/accessibility/color-contrast/"})}),r.querySelectorAll("video[autoplay], audio[autoplay]").forEach((a)=>{if(!a.hasAttribute("muted"))n.push({type:"autoplay-audio",element:`<${a.tagName.toLowerCase()}>`,message:"Auto-playing media may disrupt users",impact:"moderate",help:"Add muted attribute or provide controls to stop playback",helpUrl:"https://web.dev/learn/accessibility/more-html/#multimedia"})}),r.querySelectorAll("[tabindex]").forEach((a)=>{if(Number.parseInt(a.getAttribute("tabindex")||"0")>0)n.push({type:"positive-tabindex",element:`<${a.tagName.toLowerCase()}>`,message:"Positive tabindex disrupts natural tab order",impact:"moderate",help:'Use tabindex="0" or "-1" instead of positive values',helpUrl:"https://web.dev/learn/accessibility/focus/#tab-index"})}),r.querySelectorAll('[role="button"]').forEach((a)=>{if(!a.hasAttribute("tabindex"))n.push({type:"button-not-focusable",element:`<${a.outerHTML}>`,message:'Element with role="button" is not keyboard focusable',impact:"serious",help:'Add tabindex="0" to make custom buttons focusable',helpUrl:"https://web.dev/learn/accessibility/focus/"})}),i.includes("<body")&&!r.querySelector('main, [role="main"]'))n.push({type:"missing-main-landmark",element:"<body>",message:"Document missing main landmark region",impact:"moderate",help:"Add a main element to identify the primary content",helpUrl:"https://web.dev/learn/accessibility/structure/#landmarks"});r.querySelectorAll("iframe").forEach((a)=>{if(!a.hasAttribute("title")&&!a.hasAttribute("aria-label"))n.push({type:"iframe-missing-title",element:"<iframe>",message:"Iframe missing title attribute",impact:"serious",help:"Add a title attribute to describe the iframe content",helpUrl:"https://web.dev/learn/accessibility/more-html/#frames"})})}catch(r){console.error(`Error checking accessibility in ${s}:`,r)}return n}async function gc(e,s={}){let i={},{recursive:n=!0,ignorePaths:r=[]}=s,o=Array.isArray(e)?e:[e],l=await Ko(o,{recursive:n,ignorePaths:r}),u=[];for(let a of l)try{let g=await Bun.file(a).text();if(a.endsWith("good-a11y.stx"))continue;let p=await Ae(g,a);if(u.push(a),p.length>0)i[a]=p}catch(g){console.error(`Error scanning ${a}:`,g)}return{results:i,scannedFiles:u}}var mc={name:"a11y",handler:(e,s,i,n)=>{if(!s.length)return e;let r=s[0].replace(/['"]/g,""),o=s.length>1?s[1].replace(/['"]/g,""):"",u={"aria-label":"Ensure interactive elements have accessible labels","alt-text":"Provide alternative text for images",focus:"Ensure the element can receive keyboard focus",landmark:"Use appropriate landmark roles","heading-order":"Maintain proper heading hierarchy","color-contrast":"Ensure sufficient color contrast","keyboard-nav":"Make sure element is keyboard navigable","screen-reader":"Optimize for screen reader users"}[r]||"Make this element accessible";return`<!-- a11y-hint: ${o||u} -->${e}`},hasEndTag:!1},hc={name:"screenReader",handler:(e)=>`<span class="sr-only">${e}</span>`,hasEndTag:!0};
4
+ export{pc,fc,gc,mc,hc};
@@ -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 Ir(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(Ir(i,n,r+1,o))return!0}return!1}var k=["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"],ol=["onMount","onDestroy"];function it(e="const",t=[],r){let o=t.length?k.filter((s)=>!t.includes(s)):k;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=k.filter((e)=>!y.includes(e));function Ei(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 il(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(Ei(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(Ir(r[1],t))return!0;return!1}function al(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 cl(e){return R.includes(e.toLowerCase())}var Xs=["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"],_=["x-init","x-transition","x-effect","x-on"],ll=[...Xs,..._];function ul(){return`{${Xs.map((e)=>`'${e}':1`).join(",")}}`}var Ti=["class","style","text","html","show","model","if","ref"];function dl(){return`{${Ti.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 pl(){return`/^(${p.join("|")})(?:\\.|$)/`}function fl(e){return p.some((t)=>e===t||e.startsWith(`${t}.`))}var w=65536,A=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>=w;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>=A){let s=c.keys().next();if(s.done)break;c.delete(s.value)}c.set(e,o)}return o}
3
- export{Ir,k,ol,it,Ei,il,al,cl,Xs,ll,ul,Ti,dl,pl,fl};
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 Ir(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(Ir(i,n,r+1,o))return!0}return!1}var k=["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"],il=["onMount","onDestroy"];function it(e="const",t=[],r){let o=t.length?k.filter((s)=>!t.includes(s)):k;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=k.filter((e)=>!y.includes(e));function Ti(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 al(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(Ti(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(Ir(r[1],t))return!0;return!1}function cl(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 ll(e){return R.includes(e.toLowerCase())}var Gs=["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"],_=["x-init","x-transition","x-effect","x-on"],ul=[...Gs,..._];function dl(){return`{${Gs.map((e)=>`'${e}':1`).join(",")}}`}var $i=["class","style","text","html","show","model","if","ref"];function pl(){return`{${$i.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 fl(){return`/^(${p.join("|")})(?:\\.|$)/`}function gl(e){return p.some((t)=>e===t||e.startsWith(`${t}.`))}var w=65536,A=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>=w;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>=A){let s=c.keys().next();if(s.done)break;c.delete(s.value)}c.set(e,o)}return o}
3
+ export{Ir,k,il,it,Ti,al,cl,ll,Gs,ul,dl,$i,pl,fl,gl};
@@ -1,7 +1,7 @@
1
1
  // @bun
2
- import x from"fs";import u from"path";import p from"fs";import w from"path";var y=["components","layouts","partials","emails"];function M(e){return e.split(/[\\/]/).filter(Boolean).slice(0,-1).some((a)=>y.includes(a))}function b(e){return M(e.replace(/^\//,""))}function Zo(e,t){let a=e.filter((i)=>!b(i.pattern)),r=["// Auto-generated by STX - do not edit"];if(a.length===0)r.push("// No page routes found \u2014 route paths stay typed as string.","export {}","");else{r.push("declare module '@stacksjs/stx' {"," interface KnownRoutes {");for(let i of a){let c=[];for(let l of i.params){let d=i.pattern.includes(`:${l}?`)?"?":"";c.push(`${l}${d}: string`)}let s=c.join("; ");r.push(` '${i.pattern}': { ${s} }`)}r.push(" }","}","","export {}","")}let n=r.join(`
3
- `),o=w.join(t,"route-types.d.ts");try{if(p.existsSync(o)&&p.readFileSync(o,"utf8")===n)return;p.mkdirSync(t,{recursive:!0}),p.writeFileSync(o,n)}catch{}}function Qo(e,t,a){let r=process.cwd(),n=w.relative(r,a),o=e.filter((c)=>!b(c.pattern)),i=["// Auto-generated by stx \u2014 do not edit",`// Source: ${n||"pages"}/`,"","export const routes = ["];for(let c of o){let s=w.relative(r,c.filePath).replace(/\\/g,"/"),l=JSON.stringify(c.params),d=c.layout?`, layout: '${w.relative(r,c.layout).replace(/\\/g,"/")}'`:"";i.push(` { pattern: '${c.pattern}', filePath: '${s}', isDynamic: ${c.isDynamic}, params: ${l}${d} },`)}i.push("] as const",""),i.push("export type RouteName = typeof routes[number]['pattern']",""),p.mkdirSync(t,{recursive:!0}),p.writeFileSync(w.join(t,"routes.ts"),i.join(`
4
- `))}import I from"path";var N=Object.freeze(["ico","png","jpg","jpeg","gif","webp","avif","svg","bmp","tif","tiff","heic","css","js","mjs","cjs","map","wasm","webmanifest","json","xml","txt","rss","atom","woff","woff2","ttf","otf","eot","mp3","mp4","m4a","m4v","mov","webm","ogg","ogv","oga","wav","flac","avi","mkv","pdf","csv","doc","docx","xls","xlsx","ppt","pptx","rtf","odt","zip","gz","tgz","tar","rar","7z","bz2","xz","php","phtml","asp","aspx","jsp","cgi","env","ini","yml","yaml","toml","sql","bak","old","swp","log","conf","cfg","exe","dmg","pkg","apk","ipa","msi","iso","bin","dll"]),D=N.flatMap((e)=>e===e.toUpperCase()?[e]:[e,e.toUpperCase()]).join("|"),G=new RegExp(`\\.(?:${D})$`),E=`(?![^/]*\\.(?:${D})$)`;function xt(e){let t=e,a=t.search(/[?#]/);if(a!==-1)t=t.slice(0,a);let r=t.slice(t.lastIndexOf("/")+1);return r.length>0&&G.test(r)}function R(e,t){let r=I.relative(t,e).replace(/\.(stx|md)$/,"");if(r=r.split(I.sep).join("/"),r==="index")return"/";if(r.endsWith("/index"))r=r.slice(0,-6);return r=r.replace(/\[\[([^\]]+)\]\]/g,":$1?"),r=r.replace(/\[([^\]]+)\]/g,":$1"),r=r.replace(/:\.\.\.([^/]+)/g,":$1*"),`/${r}`}function ue(e,t={}){let a=t.page?E:"",r=[],n="",o=0;while(o<e.length){let i=e.slice(o),c=/^\/:([^/?*]+)\?/.exec(i);if(c){r.push(c[1]);let d=o+c[0].length===e.length;n+=`(?:/${d?a:""}([^/]+))?`,o+=c[0].length;continue}let s=/^:([^/?*]+)\*/.exec(i);if(s){r.push(s[1]),n+="(.+)",o+=s[0].length;continue}let l=/^:([^/?*]+)/.exec(i);if(l){r.push(l[1]);let d=o+l[0].length===e.length;n+=`${d?a:""}([^/]+)`,o+=l[0].length;continue}n+=e[o].replace(/[.+^${}()|[\]\\*?]/g,"\\$&"),o+=1}return{regex:new RegExp(`^${n}$`),params:r}}function dr(e,t){let a=e===""?"/":e;for(let r of t){let n=a.match(r.regex);if(n){let o={};return r.params.forEach((i,c)=>{o[i]=n[c+1]}),{route:r,params:o}}}return null}function _s(e,t={}){let a=e.replace(/\[\[([^\]]+)\]\]/g,":$1?").replace(/\[([^\]]+)\]/g,":$1").replace(/:\.\.\.([^/]+)/g,":$1*");return ue(a,t)}import j from"fs";import L from"path";function _(e,t){let a=[],r=L.dirname(e);while(r.startsWith(t)||r===t){let n=L.join(r,"_layout.stx");if(j.existsSync(n))a.unshift(n);if(r===t)break;r=L.dirname(r)}return a}function F(e,t){let a=[];if(!x.existsSync(e))return a;let r=x.readdirSync(e,{withFileTypes:!0});for(let n of r){let o=u.join(e,n.name);if(n.isDirectory()){if(n.name.startsWith("."))continue;if(y.includes(n.name))continue;a.push(...F(o,t))}else if(n.isFile()){let i=u.extname(n.name);if(t.includes(i)){if(n.name.startsWith("_")&&n.name!=="_layout.stx")continue;if(n.name==="_layout.stx")continue;a.push(o)}}}return a}class pr{routes;pagesDir;pagesDirs;config;constructor(e,t={}){this.config=t;let a=t.pagesDirs&&t.pagesDirs.length>0?t.pagesDirs:[t.pagesDir||"pages"];this.pagesDirs=a.map((s)=>u.resolve(e,s)),this.pagesDir=this.pagesDirs[0];let r=t.extensions||[".stx"],n=(s)=>{let l=u.resolve(e,s);try{return x.realpathSync(l)}catch{return l}},o=(t.exclude??[]).filter((s)=>typeof s==="string"&&s.trim()!=="").map(n),i=(s)=>{if(o.length===0)return!1;let l=n(s);return o.some((d)=>l===d||l.startsWith(`${d}${u.sep}`))},c=new Set;this.routes=[];for(let s of this.pagesDirs){let l=F(s,r).filter((h)=>!i(h)),d=new Map;for(let h of l){let g=R(h,s),m=t.pagesDirs?g.replace(/:[\w]+/g,":param"):g;if(t.pagesDirs&&d.has(m))throw Error(`Conflicting layer pages for ${g}: ${d.get(m)} and ${h}`);if(d.set(m,h),c.has(m))continue;c.add(m);let{regex:X,params:P}=ue(g,{page:!0}),C=t.layouts!==!1?_(h,s):[];this.routes.push({pattern:g,regex:X,params:P,filePath:h,isDynamic:P.length>0,layout:C.length>0?C[C.length-1]:void 0})}}if(this.routes.sort((s,l)=>{if(!s.isDynamic&&l.isDynamic)return-1;if(s.isDynamic&&!l.isDynamic)return 1;let d=s.pattern.split("/").length,h=l.pattern.split("/").length;if(d!==h)return h-d;return s.pattern.localeCompare(l.pattern)}),t.emit!==!1){let s=u.resolve(e,t.stateDir||process.env.STX_DIR?.trim()||".stx");Zo(this.routes,s),Qo(this.routes,s,this.pagesDir)}}match(e){let t=e===""?"/":e;for(let a of this.routes){let r=t.match(a.regex);if(r){let n={};return a.params.forEach((o,i)=>{n[o]=r[i+1]}),{route:a,params:n}}}return null}resolve(e,t){let a=this.routes.find((n)=>n.pattern===e||n.filePath.includes(e));if(!a)return"#not-found";let r=a.pattern;if(t)for(let[n,o]of Object.entries(t))r=r.replace(`:${n}`,encodeURIComponent(o));return r}addRoute(e){this.routes.push(e),this.routes.sort((t,a)=>{if(!t.isDynamic&&a.isDynamic)return-1;if(t.isDynamic&&!a.isDynamic)return 1;return t.pattern.localeCompare(a.pattern)})}getLayout(e){return e.layout??null}}function Cs(e,t){let a=[`${t}.stx`,"error.stx"];for(let r of a){let n=u.join(e,r);if(x.existsSync(n))return n}return null}function Es(e,t){return e.map((a)=>{let r=u.relative(t,a.filePath),n=a.isDynamic?" (dynamic)":"";return`${a.pattern} \u2192 ${r}${n}`})}var f={},k="";function Lf(e){k=e.replace(/\/$/,"")}function jf(e,t,a={}){f[e]={path:t,name:e,params:a}}function Bf(e){for(let[t,a]of Object.entries(e))if(typeof a==="string")f[t]={path:a,name:t};else f[t]={...a,name:t}}function fr(e,t={},a=!1){let r=f[e];if(!r)return console.warn(`Route [${e}] not defined.`),"#undefined-route";let n={...r.params,...t},o=r.path;o=o.replace(/:(\w+)/g,(c,s)=>{let l=n[s];if(l===void 0)return console.warn(`Missing parameter [${s}] for route [${e}].`),`:${s}`;return delete n[s],encodeURIComponent(String(l))});let i=Object.entries(n);if(i.length>0){let c=i.map(([s,l])=>`${encodeURIComponent(s)}=${encodeURIComponent(String(l))}`).join("&");o+=(o.includes("?")?"&":"?")+c}return a&&k?`${k}${o}`:o}function Ff(){for(let e of Object.keys(f))delete f[e];k=""}import B from"fs";import q from"path";function zf(e,t={}){return{type:"redirect",path:e,options:{replace:t.replace??!1,external:t.external??!1,redirectCode:t.redirectCode??302}}}function Hf(e){return{type:"abort",error:typeof e==="string"?{statusCode:500,message:e}:e}}function Vf(e,t={}){return{handler:e,mode:t.mode??"universal"}}function O(e){let t={};if(!e)return t;let a=e.split(";");for(let r of a){let[n,...o]=r.split("=");if(n){let i=n.trim(),c=o.join("=").trim();if(i)t[i]=decodeURIComponent(c)}}return t}function S(e,t,a={}){let r=`${encodeURIComponent(e)}=${encodeURIComponent(t)}`;if(a.expires){let n=typeof a.expires==="number"?new Date(Date.now()+a.expires*1000):a.expires;r+=`; Expires=${n.toUTCString()}`}if(a.path)r+=`; Path=${a.path}`;if(a.domain)r+=`; Domain=${a.domain}`;if(a.secure)r+="; Secure";if(a.httpOnly)r+="; HttpOnly";if(a.sameSite)r+=`; SameSite=${a.sameSite}`;return r}function wc(e,t){let a=e.headers.get("cookie")||"",r=O(a);return{get(n){return r[n]},set(n,o,i={}){r[n]=o,t.append("Set-Cookie",S(n,o,i))},delete(n){delete r[n],t.append("Set-Cookie",S(n,"",{expires:new Date(0),path:"/"}))},getAll(){return{...r}}}}function vc(){return{get(e){if(typeof document>"u")return;return O(document.cookie)[e]},set(e,t,a={}){if(typeof document>"u")return;document.cookie=S(e,t,a)},delete(e){if(typeof document>"u")return;document.cookie=S(e,"",{expires:new Date(0),path:"/"})},getAll(){if(typeof document>"u")return{};return O(document.cookie)}}}function xc(){let e=typeof window<"u"&&typeof window.localStorage<"u";return{get(t){if(!e)return null;try{return window.localStorage.getItem(t)}catch{return null}},set(t,a){if(!e)return;try{window.localStorage.setItem(t,a)}catch{}},remove(t){if(!e)return;try{window.localStorage.removeItem(t)}catch{}},isAvailable(){return e}}}var v=new Map;function ei(e,t){v.set(e,t)}function Sc(e){return v.get(e)}function Uf(e){return v.has(e)}function St(){v.clear()}function kt(){return Array.from(v.keys())}async function _t(e,t="middleware"){let a=q.resolve(e,t);if(!B.existsSync(a))return;let r=B.readdirSync(a);for(let n of r){if(!n.endsWith(".ts")&&!n.endsWith(".js"))continue;if(n.includes(".test.")||n.includes(".spec."))continue;let o=n.replace(/\.(ts|js)$/,""),i=q.join(a,n);try{let s=(await import(i)).default;if(s&&typeof s.handler==="function")ei(o,s);else if(typeof s==="function")ei(o,{handler:s,mode:"universal"})}catch(c){console.warn(`Failed to load middleware '${o}' from ${i}:`,c)}}}function K(e){let t={};if(!e)return t;let a=new URLSearchParams(e);for(let[r,n]of a)t[r]=n;return t}function Ct(e,t,a,r=""){return{path:e,params:t,query:K(r),fullPath:r?`${e}?${r}`:e,meta:a}}function Et(e,t,a,r){let n=r?.isServer??typeof window>"u",o=!n,i=new Headers;return{to:e,from:t,isClient:o,isServer:n,cookies:n&&a?wc(a,i):vc(),storage:xc(),state:{},request:a,responseHeaders:i}}async function Tt(e,t){let a=Array.isArray(e)?e:[e],r=t.isServer;for(let n of a){let o=Sc(n);if(!o)return console.error(`Route middleware '${n}' is not registered \u2014 failing the guard closed.`),{passed:!1,abort:{type:"abort",error:{statusCode:500,message:`Route middleware '${n}' is not registered`}},state:t.state,responseHeaders:t.responseHeaders};if(o.mode==="server"&&!r)continue;try{let i=await o.handler(t);if(i){if(i.type==="redirect")return{passed:!1,redirect:i,state:t.state,responseHeaders:t.responseHeaders};if(i.type==="abort")return{passed:!1,abort:i,state:t.state,responseHeaders:t.responseHeaders}}}catch(i){return console.error(`Error in middleware '${n}':`,i),{passed:!1,abort:{type:"abort",error:{statusCode:500,message:i instanceof Error?i.message:"Middleware error"}},state:t.state,responseHeaders:t.responseHeaders}}}return{passed:!0,state:t.state,responseHeaders:t.responseHeaders}}function Ts(e){let a=e.replace(/\\/g,"/").split("/").filter(Boolean),r=a.lastIndexOf("layouts"),n=r>=0?a[r+1]:a.at(-1);if(!n)return"app";return n.replace(/\.stx$/i,"")||"app"}function Qe(e){let t=e.match(/<meta\b[^>]*name=["']stx-layout["'][^>]*content=["']([^"']+)["'][^>]*>/i),a=e.match(/<meta\b[^>]*name=["']stx-layout-group["'][^>]*content=["']([^"']+)["'][^>]*>/i),r=e.match(/<!--\s*stx-layout:\s*([^ ]+)\s*-->/i),n=t?.[1]||r?.[1]||"";return{layout:n,group:a?.[1]||Ts(n)}}var A,T;function W(e){let t=[],a="log(",r=0;while(r<e.length){let n=e.indexOf("log(",r);if(n===-1){t.push(e.slice(r));break}let o=n>0?e[n-1]:" ",i=/\bfunction\s+$/.test(e.slice(Math.max(0,n-16),n));if(/[\w$.]/.test(o)||i){t.push(e.slice(r,n+4)),r=n+4;continue}t.push(e.slice(r,n));let c=1,s=n+4;while(s<e.length&&c>0){let l=e[s];if(l==='"'||l==="'"||l==="`"){let d=l;s++;while(s<e.length&&e[s]!==d){if(e[s]==="\\")s++;s++}s++;continue}if(l==="(")c++;else if(l===")")c--;s++}t.push("0"),r=s}return t.join("")}function U(e,t=!1){try{return new Bun.Transpiler(t?{loader:"js",minify:{whitespace:!0,identifiers:!0}}:{loader:"js",minifyWhitespace:!0}).transformSync(e).replace(/\}(var |let |const |function )/g,"};$1").trim()}catch{return e}}function H(){return`
2
+ import x from"fs";import u from"path";import p from"fs";import w from"path";var y=["components","layouts","partials","emails"];function M(e){return e.split(/[\\/]/).filter(Boolean).slice(0,-1).some((a)=>y.includes(a))}function b(e){return M(e.replace(/^\//,""))}function Qo(e,t){let a=e.filter((i)=>!b(i.pattern)),r=["// Auto-generated by STX - do not edit"];if(a.length===0)r.push("// No page routes found \u2014 route paths stay typed as string.","export {}","");else{r.push("declare module '@stacksjs/stx' {"," interface KnownRoutes {");for(let i of a){let c=[];for(let l of i.params){let d=i.pattern.includes(`:${l}?`)?"?":"";c.push(`${l}${d}: string`)}let s=c.join("; ");r.push(` '${i.pattern}': { ${s} }`)}r.push(" }","}","","export {}","")}let n=r.join(`
3
+ `),o=w.join(t,"route-types.d.ts");try{if(p.existsSync(o)&&p.readFileSync(o,"utf8")===n)return;p.mkdirSync(t,{recursive:!0}),p.writeFileSync(o,n)}catch{}}function ei(e,t,a){let r=process.cwd(),n=w.relative(r,a),o=e.filter((c)=>!b(c.pattern)),i=["// Auto-generated by stx \u2014 do not edit",`// Source: ${n||"pages"}/`,"","export const routes = ["];for(let c of o){let s=w.relative(r,c.filePath).replace(/\\/g,"/"),l=JSON.stringify(c.params),d=c.layout?`, layout: '${w.relative(r,c.layout).replace(/\\/g,"/")}'`:"";i.push(` { pattern: '${c.pattern}', filePath: '${s}', isDynamic: ${c.isDynamic}, params: ${l}${d} },`)}i.push("] as const",""),i.push("export type RouteName = typeof routes[number]['pattern']",""),p.mkdirSync(t,{recursive:!0}),p.writeFileSync(w.join(t,"routes.ts"),i.join(`
4
+ `))}import I from"path";var N=Object.freeze(["ico","png","jpg","jpeg","gif","webp","avif","svg","bmp","tif","tiff","heic","css","js","mjs","cjs","map","wasm","webmanifest","json","xml","txt","rss","atom","woff","woff2","ttf","otf","eot","mp3","mp4","m4a","m4v","mov","webm","ogg","ogv","oga","wav","flac","avi","mkv","pdf","csv","doc","docx","xls","xlsx","ppt","pptx","rtf","odt","zip","gz","tgz","tar","rar","7z","bz2","xz","php","phtml","asp","aspx","jsp","cgi","env","ini","yml","yaml","toml","sql","bak","old","swp","log","conf","cfg","exe","dmg","pkg","apk","ipa","msi","iso","bin","dll"]),D=N.flatMap((e)=>e===e.toUpperCase()?[e]:[e,e.toUpperCase()]).join("|"),G=new RegExp(`\\.(?:${D})$`),E=`(?![^/]*\\.(?:${D})$)`;function xt(e){let t=e,a=t.search(/[?#]/);if(a!==-1)t=t.slice(0,a);let r=t.slice(t.lastIndexOf("/")+1);return r.length>0&&G.test(r)}function R(e,t){let r=I.relative(t,e).replace(/\.(stx|md)$/,"");if(r=r.split(I.sep).join("/"),r==="index")return"/";if(r.endsWith("/index"))r=r.slice(0,-6);return r=r.replace(/\[\[([^\]]+)\]\]/g,":$1?"),r=r.replace(/\[([^\]]+)\]/g,":$1"),r=r.replace(/:\.\.\.([^/]+)/g,":$1*"),`/${r}`}function ue(e,t={}){let a=t.page?E:"",r=[],n="",o=0;while(o<e.length){let i=e.slice(o),c=/^\/:([^/?*]+)\?/.exec(i);if(c){r.push(c[1]);let d=o+c[0].length===e.length;n+=`(?:/${d?a:""}([^/]+))?`,o+=c[0].length;continue}let s=/^:([^/?*]+)\*/.exec(i);if(s){r.push(s[1]),n+="(.+)",o+=s[0].length;continue}let l=/^:([^/?*]+)/.exec(i);if(l){r.push(l[1]);let d=o+l[0].length===e.length;n+=`${d?a:""}([^/]+)`,o+=l[0].length;continue}n+=e[o].replace(/[.+^${}()|[\]\\*?]/g,"\\$&"),o+=1}return{regex:new RegExp(`^${n}$`),params:r}}function dr(e,t){let a=e===""?"/":e;for(let r of t){let n=a.match(r.regex);if(n){let o={};return r.params.forEach((i,c)=>{o[i]=n[c+1]}),{route:r,params:o}}}return null}function Cs(e,t={}){let a=e.replace(/\[\[([^\]]+)\]\]/g,":$1?").replace(/\[([^\]]+)\]/g,":$1").replace(/:\.\.\.([^/]+)/g,":$1*");return ue(a,t)}import j from"fs";import L from"path";function _(e,t){let a=[],r=L.dirname(e);while(r.startsWith(t)||r===t){let n=L.join(r,"_layout.stx");if(j.existsSync(n))a.unshift(n);if(r===t)break;r=L.dirname(r)}return a}function F(e,t){let a=[];if(!x.existsSync(e))return a;let r=x.readdirSync(e,{withFileTypes:!0});for(let n of r){let o=u.join(e,n.name);if(n.isDirectory()){if(n.name.startsWith("."))continue;if(y.includes(n.name))continue;a.push(...F(o,t))}else if(n.isFile()){let i=u.extname(n.name);if(t.includes(i)){if(n.name.startsWith("_")&&n.name!=="_layout.stx")continue;if(n.name==="_layout.stx")continue;a.push(o)}}}return a}class pr{routes;pagesDir;pagesDirs;config;constructor(e,t={}){this.config=t;let a=t.pagesDirs&&t.pagesDirs.length>0?t.pagesDirs:[t.pagesDir||"pages"];this.pagesDirs=a.map((s)=>u.resolve(e,s)),this.pagesDir=this.pagesDirs[0];let r=t.extensions||[".stx"],n=(s)=>{let l=u.resolve(e,s);try{return x.realpathSync(l)}catch{return l}},o=(t.exclude??[]).filter((s)=>typeof s==="string"&&s.trim()!=="").map(n),i=(s)=>{if(o.length===0)return!1;let l=n(s);return o.some((d)=>l===d||l.startsWith(`${d}${u.sep}`))},c=new Set;this.routes=[];for(let s of this.pagesDirs){let l=F(s,r).filter((h)=>!i(h)),d=new Map;for(let h of l){let g=R(h,s),m=t.pagesDirs?g.replace(/:[\w]+/g,":param"):g;if(t.pagesDirs&&d.has(m))throw Error(`Conflicting layer pages for ${g}: ${d.get(m)} and ${h}`);if(d.set(m,h),c.has(m))continue;c.add(m);let{regex:X,params:P}=ue(g,{page:!0}),C=t.layouts!==!1?_(h,s):[];this.routes.push({pattern:g,regex:X,params:P,filePath:h,isDynamic:P.length>0,layout:C.length>0?C[C.length-1]:void 0})}}if(this.routes.sort((s,l)=>{if(!s.isDynamic&&l.isDynamic)return-1;if(s.isDynamic&&!l.isDynamic)return 1;let d=s.pattern.split("/").length,h=l.pattern.split("/").length;if(d!==h)return h-d;return s.pattern.localeCompare(l.pattern)}),t.emit!==!1){let s=u.resolve(e,t.stateDir||process.env.STX_DIR?.trim()||".stx");Qo(this.routes,s),ei(this.routes,s,this.pagesDir)}}match(e){let t=e===""?"/":e;for(let a of this.routes){let r=t.match(a.regex);if(r){let n={};return a.params.forEach((o,i)=>{n[o]=r[i+1]}),{route:a,params:n}}}return null}resolve(e,t){let a=this.routes.find((n)=>n.pattern===e||n.filePath.includes(e));if(!a)return"#not-found";let r=a.pattern;if(t)for(let[n,o]of Object.entries(t))r=r.replace(`:${n}`,encodeURIComponent(o));return r}addRoute(e){this.routes.push(e),this.routes.sort((t,a)=>{if(!t.isDynamic&&a.isDynamic)return-1;if(t.isDynamic&&!a.isDynamic)return 1;return t.pattern.localeCompare(a.pattern)})}getLayout(e){return e.layout??null}}function Es(e,t){let a=[`${t}.stx`,"error.stx"];for(let r of a){let n=u.join(e,r);if(x.existsSync(n))return n}return null}function Ts(e,t){return e.map((a)=>{let r=u.relative(t,a.filePath),n=a.isDynamic?" (dynamic)":"";return`${a.pattern} \u2192 ${r}${n}`})}var f={},k="";function jf(e){k=e.replace(/\/$/,"")}function Bf(e,t,a={}){f[e]={path:t,name:e,params:a}}function Ff(e){for(let[t,a]of Object.entries(e))if(typeof a==="string")f[t]={path:a,name:t};else f[t]={...a,name:t}}function fr(e,t={},a=!1){let r=f[e];if(!r)return console.warn(`Route [${e}] not defined.`),"#undefined-route";let n={...r.params,...t},o=r.path;o=o.replace(/:(\w+)/g,(c,s)=>{let l=n[s];if(l===void 0)return console.warn(`Missing parameter [${s}] for route [${e}].`),`:${s}`;return delete n[s],encodeURIComponent(String(l))});let i=Object.entries(n);if(i.length>0){let c=i.map(([s,l])=>`${encodeURIComponent(s)}=${encodeURIComponent(String(l))}`).join("&");o+=(o.includes("?")?"&":"?")+c}return a&&k?`${k}${o}`:o}function zf(){for(let e of Object.keys(f))delete f[e];k=""}import B from"fs";import q from"path";function Hf(e,t={}){return{type:"redirect",path:e,options:{replace:t.replace??!1,external:t.external??!1,redirectCode:t.redirectCode??302}}}function Vf(e){return{type:"abort",error:typeof e==="string"?{statusCode:500,message:e}:e}}function Uf(e,t={}){return{handler:e,mode:t.mode??"universal"}}function O(e){let t={};if(!e)return t;let a=e.split(";");for(let r of a){let[n,...o]=r.split("=");if(n){let i=n.trim(),c=o.join("=").trim();if(i)t[i]=decodeURIComponent(c)}}return t}function S(e,t,a={}){let r=`${encodeURIComponent(e)}=${encodeURIComponent(t)}`;if(a.expires){let n=typeof a.expires==="number"?new Date(Date.now()+a.expires*1000):a.expires;r+=`; Expires=${n.toUTCString()}`}if(a.path)r+=`; Path=${a.path}`;if(a.domain)r+=`; Domain=${a.domain}`;if(a.secure)r+="; Secure";if(a.httpOnly)r+="; HttpOnly";if(a.sameSite)r+=`; SameSite=${a.sameSite}`;return r}function vc(e,t){let a=e.headers.get("cookie")||"",r=O(a);return{get(n){return r[n]},set(n,o,i={}){r[n]=o,t.append("Set-Cookie",S(n,o,i))},delete(n){delete r[n],t.append("Set-Cookie",S(n,"",{expires:new Date(0),path:"/"}))},getAll(){return{...r}}}}function xc(){return{get(e){if(typeof document>"u")return;return O(document.cookie)[e]},set(e,t,a={}){if(typeof document>"u")return;document.cookie=S(e,t,a)},delete(e){if(typeof document>"u")return;document.cookie=S(e,"",{expires:new Date(0),path:"/"})},getAll(){if(typeof document>"u")return{};return O(document.cookie)}}}function Sc(){let e=typeof window<"u"&&typeof window.localStorage<"u";return{get(t){if(!e)return null;try{return window.localStorage.getItem(t)}catch{return null}},set(t,a){if(!e)return;try{window.localStorage.setItem(t,a)}catch{}},remove(t){if(!e)return;try{window.localStorage.removeItem(t)}catch{}},isAvailable(){return e}}}var v=new Map;function ti(e,t){v.set(e,t)}function kc(e){return v.get(e)}function Wf(e){return v.has(e)}function St(){v.clear()}function kt(){return Array.from(v.keys())}async function _t(e,t="middleware"){let a=q.resolve(e,t);if(!B.existsSync(a))return;let r=B.readdirSync(a);for(let n of r){if(!n.endsWith(".ts")&&!n.endsWith(".js"))continue;if(n.includes(".test.")||n.includes(".spec."))continue;let o=n.replace(/\.(ts|js)$/,""),i=q.join(a,n);try{let s=(await import(i)).default;if(s&&typeof s.handler==="function")ti(o,s);else if(typeof s==="function")ti(o,{handler:s,mode:"universal"})}catch(c){console.warn(`Failed to load middleware '${o}' from ${i}:`,c)}}}function K(e){let t={};if(!e)return t;let a=new URLSearchParams(e);for(let[r,n]of a)t[r]=n;return t}function Ct(e,t,a,r=""){return{path:e,params:t,query:K(r),fullPath:r?`${e}?${r}`:e,meta:a}}function Et(e,t,a,r){let n=r?.isServer??typeof window>"u",o=!n,i=new Headers;return{to:e,from:t,isClient:o,isServer:n,cookies:n&&a?vc(a,i):xc(),storage:Sc(),state:{},request:a,responseHeaders:i}}async function Tt(e,t){let a=Array.isArray(e)?e:[e],r=t.isServer;for(let n of a){let o=kc(n);if(!o)return console.error(`Route middleware '${n}' is not registered \u2014 failing the guard closed.`),{passed:!1,abort:{type:"abort",error:{statusCode:500,message:`Route middleware '${n}' is not registered`}},state:t.state,responseHeaders:t.responseHeaders};if(o.mode==="server"&&!r)continue;try{let i=await o.handler(t);if(i){if(i.type==="redirect")return{passed:!1,redirect:i,state:t.state,responseHeaders:t.responseHeaders};if(i.type==="abort")return{passed:!1,abort:i,state:t.state,responseHeaders:t.responseHeaders}}}catch(i){return console.error(`Error in middleware '${n}':`,i),{passed:!1,abort:{type:"abort",error:{statusCode:500,message:i instanceof Error?i.message:"Middleware error"}},state:t.state,responseHeaders:t.responseHeaders}}}return{passed:!0,state:t.state,responseHeaders:t.responseHeaders}}function $s(e){let a=e.replace(/\\/g,"/").split("/").filter(Boolean),r=a.lastIndexOf("layouts"),n=r>=0?a[r+1]:a.at(-1);if(!n)return"app";return n.replace(/\.stx$/i,"")||"app"}function Qe(e){let t=e.match(/<meta\b[^>]*name=["']stx-layout["'][^>]*content=["']([^"']+)["'][^>]*>/i),a=e.match(/<meta\b[^>]*name=["']stx-layout-group["'][^>]*content=["']([^"']+)["'][^>]*>/i),r=e.match(/<!--\s*stx-layout:\s*([^ ]+)\s*-->/i),n=t?.[1]||r?.[1]||"";return{layout:n,group:a?.[1]||$s(n)}}var A,T;function W(e){let t=[],a="log(",r=0;while(r<e.length){let n=e.indexOf("log(",r);if(n===-1){t.push(e.slice(r));break}let o=n>0?e[n-1]:" ",i=/\bfunction\s+$/.test(e.slice(Math.max(0,n-16),n));if(/[\w$.]/.test(o)||i){t.push(e.slice(r,n+4)),r=n+4;continue}t.push(e.slice(r,n));let c=1,s=n+4;while(s<e.length&&c>0){let l=e[s];if(l==='"'||l==="'"||l==="`"){let d=l;s++;while(s<e.length&&e[s]!==d){if(e[s]==="\\")s++;s++}s++;continue}if(l==="(")c++;else if(l===")")c--;s++}t.push("0"),r=s}return t.join("")}function U(e,t=!1){try{return new Bun.Transpiler(t?{loader:"js",minify:{whitespace:!0,identifiers:!0}}:{loader:"js",minifyWhitespace:!0}).transformSync(e).replace(/\}(var |let |const |function )/g,"};$1").trim()}catch{return e}}function H(){return`
5
5
  ;(function(){
6
6
  'use strict';
7
7
  var ROUTER_REV=8;
@@ -4055,4 +4055,4 @@ else {
4055
4055
 
4056
4056
  if(document.readyState==='loading')document.addEventListener('DOMContentLoaded',init);else init();
4057
4057
  })();
4058
- `}function et(){if(A)return A;return A=U(W(H()),!0),A}function Wf(){if(T)return T;return T=U(H()),T}export{Zo,Qo,xt,ue,dr,_s,pr,Cs,Es,Lf,jf,Bf,fr,Ff,zf,Hf,Vf,wc,vc,xc,ei,Sc,Uf,St,kt,_t,Ct,Et,Tt,Ts,Qe,et,Wf};
4058
+ `}function et(){if(A)return A;return A=U(W(H()),!0),A}function qf(){if(T)return T;return T=U(H()),T}export{Qo,ei,xt,ue,dr,Cs,pr,Es,Ts,jf,Bf,Ff,fr,zf,Hf,Vf,Uf,vc,xc,Sc,ti,kc,Wf,St,kt,_t,Ct,Et,Tt,$s,Qe,et,qf};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{j,Mf,qo,a,P,Mh,Lh}from"./chunk-yjzczm2s.js";import"./chunk-ytjhb81r.js";import"./chunk-79x0812m.js";import"./chunk-bwzjjxnj.js";import"./chunk-cak9fp9b.js";import"./chunk-z1br7qeb.js";import"./chunk-s8p958da.js";import"./chunk-392rrp28.js";import"./chunk-p1mbbdwj.js";import"./chunk-5s2dwh5z.js";import"./chunk-4833k99b.js";import"./chunk-yzbdm457.js";export{P as config,j as defaultConfig,Mh as defineStxConfig,qo as discoverConfig,a as loadStxConfig,Mf as resolveStxDirectories,Lh as validateConfig};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- var g=0;function p(){return`async-${++g}-${Date.now().toString(36)}`}function qm(e,t={},c){let o=/@async\s*\(([^)]*)\)\s*([\s\S]*?)@error\s*([\s\S]*?)@endasync/gi,i=/@async\s*\(([^)]*)\)\s*([\s\S]*?)@endasync/gi,n=e;return n=n.replace(o,(r,s,a,d)=>{let l=p(),y=u(s);return m(l,y,a.trim(),d.trim())}),n=n.replace(i,(r,s,a)=>{let d=p(),l=u(s);return m(d,l,a.trim(),'<div class="stx-async-error">Failed to load component</div>')}),n}function u(e){let t={component:"",timeout:30000,delay:200,suspensible:!0,retries:0},c=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,o;while((o=c.exec(e))!==null){let i=o[1],n=o[2]||o[3],r=o[4],s=o[5];switch(i){case"component":t.component=n||s||"";break;case"timeout":t.timeout=r?parseInt(r,10):30000;break;case"delay":t.delay=r?parseInt(r,10):200;break;case"suspensible":t.suspensible=s==="true";break;case"retries":t.retries=r?parseInt(r,10):0;break;case"loadingComponent":t.loadingComponent=n||s;break;case"errorComponent":t.errorComponent=n||s;break}}return t}function m(e,t,c,o){let{component:i,timeout:n,delay:r,suspensible:s,retries:a}=t;return`
2
+ var g=0;function p(){return`async-${++g}-${Date.now().toString(36)}`}function pm(e,t={},c){let o=/@async\s*\(([^)]*)\)\s*([\s\S]*?)@error\s*([\s\S]*?)@endasync/gi,i=/@async\s*\(([^)]*)\)\s*([\s\S]*?)@endasync/gi,n=e;return n=n.replace(o,(r,s,a,d)=>{let l=p(),y=u(s);return m(l,y,a.trim(),d.trim())}),n=n.replace(i,(r,s,a)=>{let d=p(),l=u(s);return m(d,l,a.trim(),'<div class="stx-async-error">Failed to load component</div>')}),n}function u(e){let t={component:"",timeout:30000,delay:200,suspensible:!0,retries:0},c=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,o;while((o=c.exec(e))!==null){let i=o[1],n=o[2]||o[3],r=o[4],s=o[5];switch(i){case"component":t.component=n||s||"";break;case"timeout":t.timeout=r?parseInt(r,10):30000;break;case"delay":t.delay=r?parseInt(r,10):200;break;case"suspensible":t.suspensible=s==="true";break;case"retries":t.retries=r?parseInt(r,10):0;break;case"loadingComponent":t.loadingComponent=n||s;break;case"errorComponent":t.errorComponent=n||s;break}}return t}function m(e,t,c,o){let{component:i,timeout:n,delay:r,suspensible:s,retries:a}=t;return`
3
3
  <div class="stx-async-component" data-async-id="${e}" data-component="${i}" data-status="pending">
4
4
  <div class="stx-async-loading" data-async-loading="${e}">
5
5
  ${c}
@@ -226,7 +226,7 @@ catch (error) {
226
226
  loadComponent();
227
227
  })();
228
228
  </script>
229
- `}function Km(e){return{__asyncComponent:!0,...typeof e==="function"?{loader:e}:e}}function Xm(e){return typeof e==="object"&&e!==null&&"__asyncComponent"in e&&e.__asyncComponent===!0}function Gm(){return`
229
+ `}function fm(e){return{__asyncComponent:!0,...typeof e==="function"?{loader:e}:e}}function gm(e){return typeof e==="object"&&e!==null&&"__asyncComponent"in e&&e.__asyncComponent===!0}function mm(){return`
230
230
  /* STX Async Component Styles */
231
231
  .stx-async-component {
232
232
  position: relative;
@@ -300,7 +300,7 @@ catch (error) {
300
300
  background-size: 200% 100%;
301
301
  }
302
302
  }
303
- `}function Jm(){return`
303
+ `}function hm(){return`
304
304
  // STX Async Component Runtime
305
305
  (function() {
306
306
  if (typeof window === 'undefined') return;
@@ -355,4 +355,4 @@ catch (error) {
355
355
  console.log('[stx] Async component runtime initialized');
356
356
  })();
357
357
  `}
358
- export{qm,Km,Xm,Gm,Jm};
358
+ export{pm,fm,gm,mm,hm};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Ci,Jh,Yh,ol,Ve,mg,Xs,Zh,Qh,ey,ty,ny,ry,sy,oy,iy}from"./chunk-5s2dwh5z.js";export{ry as applyHead,Zh as definePageMeta,Ci as getHead,Jh as getPageMeta,Ve as mergeHeadConfigs,sy as processHeadDirective,iy as processMetaDirective,oy as processTitleDirective,ny as renderBodyAttrs,ey as renderHead,ty as renderHtmlAttrs,Yh as resetHead,Xs as seoMetaToHeadConfig,ol as useHead,Qh as usePageTitle,mg as useSeoMeta,Qh as useTitle};