@stacksjs/stx 0.2.673 → 0.2.674

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 (212) hide show
  1. package/dist/chunk-0jwdcqj8.js +2 -0
  2. package/dist/chunk-0mwdq478.js +2 -0
  3. package/dist/{chunk-npa7gze7.js → chunk-0nfqgv4n.js} +2 -2
  4. package/dist/chunk-1y6egkty.js +2 -0
  5. package/dist/{chunk-1sr6c0nk.js → chunk-25zmy8q6.js} +2 -2
  6. package/dist/chunk-2881tcqt.js +2 -0
  7. package/dist/chunk-2a775q7x.js +2 -0
  8. package/dist/chunk-2asdbd5e.js +2 -0
  9. package/dist/chunk-34yj93hh.js +2 -0
  10. package/dist/{chunk-30nes8ne.js → chunk-35ezh7de.js} +2 -2
  11. package/dist/{chunk-9tdnfztv.js → chunk-40tswfe7.js} +8 -8
  12. package/dist/chunk-41de209e.js +2 -0
  13. package/dist/{chunk-jst1fbdm.js → chunk-4b9s7wgy.js} +2 -2
  14. package/dist/{chunk-vhs13kbf.js → chunk-4bgjrrvz.js} +1 -1
  15. package/dist/{chunk-365vg0eg.js → chunk-4s8zacxg.js} +4 -4
  16. package/dist/chunk-4w6baw62.js +3 -0
  17. package/dist/{chunk-fbtv2k1p.js → chunk-506mv7hb.js} +2 -2
  18. package/dist/{chunk-fzqj1mjz.js → chunk-5qtthtg3.js} +7 -7
  19. package/dist/chunk-5s1ay9mv.js +2 -0
  20. package/dist/{chunk-wns8g6k9.js → chunk-5vt48yce.js} +6 -6
  21. package/dist/{chunk-qv6axke4.js → chunk-5zhp87wv.js} +2 -2
  22. package/dist/{chunk-hvf2e7pr.js → chunk-6s7tvmqp.js} +1 -1
  23. package/dist/{chunk-ecqrkyg8.js → chunk-6sjtyd0k.js} +4 -4
  24. package/dist/{chunk-a3d0g4mr.js → chunk-7adznted.js} +2 -2
  25. package/dist/chunk-7j1zgrnf.js +42 -0
  26. package/dist/chunk-7kznee1g.js +2 -0
  27. package/dist/{chunk-qjtpxsyx.js → chunk-7mvz972c.js} +3 -3
  28. package/dist/chunk-80zgyaqe.js +2 -0
  29. package/dist/chunk-84tqb1rn.js +2 -0
  30. package/dist/chunk-8azm7nha.js +2 -0
  31. package/dist/chunk-902qnyg0.js +2 -0
  32. package/dist/{chunk-3y41efsf.js → chunk-9dtbvjpp.js} +8 -8
  33. package/dist/chunk-9n6jwcpb.js +2 -0
  34. package/dist/{chunk-yfvm7q6t.js → chunk-a4p18ybc.js} +3 -3
  35. package/dist/chunk-a6y8td0d.js +2 -0
  36. package/dist/chunk-a7kt1ts4.js +2 -0
  37. package/dist/chunk-a81y8g40.js +2 -0
  38. package/dist/{chunk-jg5zt20a.js → chunk-aet1pgw7.js} +36 -36
  39. package/dist/chunk-aft1zc84.js +2 -0
  40. package/dist/{chunk-04kg16qs.js → chunk-am2w363p.js} +4 -4
  41. package/dist/{chunk-ym41ybz2.js → chunk-asezs2n3.js} +6 -6
  42. package/dist/{chunk-jefe0rgt.js → chunk-bawq4fqy.js} +4 -4
  43. package/dist/chunk-bdp2r0v4.js +2 -0
  44. package/dist/{chunk-m6q3f5rf.js → chunk-bkkpq8dx.js} +9 -9
  45. package/dist/chunk-brtvm8mb.js +2 -0
  46. package/dist/{chunk-2dp7hyv7.js → chunk-bsajk82t.js} +14 -14
  47. package/dist/chunk-bvzr9zqt.js +2 -0
  48. package/dist/{chunk-hzv2qj0t.js → chunk-cbjabv1w.js} +4 -4
  49. package/dist/chunk-cbvgtf3m.js +2 -0
  50. package/dist/chunk-cfydbaeq.js +2 -0
  51. package/dist/{chunk-t2pzy3x1.js → chunk-ck2e3e47.js} +3 -3
  52. package/dist/{chunk-wpmrz872.js → chunk-d09q93yf.js} +2 -2
  53. package/dist/{chunk-rcsgt4wy.js → chunk-d1a86qx8.js} +1 -1
  54. package/dist/{chunk-xqp4hstk.js → chunk-dgc1a3yt.js} +6 -6
  55. package/dist/chunk-dq8c3h4n.js +2 -0
  56. package/dist/chunk-e36pne7n.js +2 -0
  57. package/dist/chunk-e62qfexp.js +2 -0
  58. package/dist/chunk-eq5jzaj5.js +2 -0
  59. package/dist/{chunk-t0zh1dn9.js → chunk-f9zyf9n6.js} +65 -65
  60. package/dist/{chunk-dgb4z4kw.js → chunk-faakv1p6.js} +2 -2
  61. package/dist/{chunk-ynz7bzc6.js → chunk-fb7t1nn9.js} +3 -3
  62. package/dist/{chunk-ptcj11b4.js → chunk-fbmth6xv.js} +10 -10
  63. package/dist/{chunk-7met6yva.js → chunk-fd49fahd.js} +5 -5
  64. package/dist/chunk-fr39emcz.js +2 -0
  65. package/dist/chunk-fsq13amm.js +2 -0
  66. package/dist/chunk-fw413k9q.js +3 -0
  67. package/dist/chunk-fxh12vqd.js +2 -0
  68. package/dist/chunk-gcc9fa33.js +2 -0
  69. package/dist/chunk-h6t2ney6.js +2 -0
  70. package/dist/{chunk-kgfgb971.js → chunk-ham5x7ts.js} +4 -4
  71. package/dist/{chunk-n38yb274.js → chunk-hb3edeq9.js} +6 -6
  72. package/dist/{chunk-fvtwec1r.js → chunk-hegfgw27.js} +1 -1
  73. package/dist/{chunk-p472crv1.js → chunk-hgry3mjd.js} +1 -1
  74. package/dist/{chunk-sfc2v7rt.js → chunk-hsmcbh0p.js} +7 -7
  75. package/dist/{chunk-mxbc2ahy.js → chunk-hz4x7h0n.js} +5 -5
  76. package/dist/{chunk-jxda11cg.js → chunk-j6m8xqh3.js} +2 -2
  77. package/dist/chunk-j8g5cvvm.js +2 -0
  78. package/dist/chunk-jzjpyyw2.js +2 -0
  79. package/dist/chunk-k1b8x73j.js +2 -0
  80. package/dist/{chunk-h4dkvnhd.js → chunk-kdebh22m.js} +7 -7
  81. package/dist/{chunk-xwhmh0w0.js → chunk-mwnhdsbp.js} +2 -2
  82. package/dist/{chunk-0f4csefs.js → chunk-nj343mw2.js} +5 -5
  83. package/dist/chunk-nw9bdk2n.js +2 -0
  84. package/dist/chunk-p4jkswz8.js +2 -0
  85. package/dist/chunk-p4r90vqf.js +2 -0
  86. package/dist/{chunk-bnn7pd62.js → chunk-p6qd7ad0.js} +2 -2
  87. package/dist/chunk-p8bgy5tt.js +2 -0
  88. package/dist/{chunk-aprhqxky.js → chunk-pb6erpj3.js} +5 -5
  89. package/dist/{chunk-r3e6x87d.js → chunk-pg2v1pb5.js} +3 -3
  90. package/dist/{chunk-zvygkwyf.js → chunk-pqqe2b6m.js} +4 -4
  91. package/dist/chunk-q6nwcav4.js +2 -0
  92. package/dist/chunk-qmqavdz2.js +2 -0
  93. package/dist/chunk-qpw72bty.js +2 -0
  94. package/dist/chunk-qwnh1kj6.js +2 -0
  95. package/dist/chunk-qy9m6qdn.js +2 -0
  96. package/dist/chunk-qychcdsm.js +2 -0
  97. package/dist/{chunk-7d4z944r.js → chunk-qz5b8ed4.js} +7 -7
  98. package/dist/{chunk-6ajahb2x.js → chunk-r7fdw2v5.js} +3 -3
  99. package/dist/{chunk-mmwedr93.js → chunk-rdr09efy.js} +5 -5
  100. package/dist/chunk-rj3w1ama.js +2 -0
  101. package/dist/{chunk-prf164ct.js → chunk-rr527jt6.js} +2 -2
  102. package/dist/{chunk-1fd7x7b8.js → chunk-rv39s5az.js} +4 -4
  103. package/dist/{chunk-yg267y85.js → chunk-rym0309c.js} +3 -3
  104. package/dist/{chunk-chzgfna2.js → chunk-s0vtjyyj.js} +1 -1
  105. package/dist/{chunk-vqc4h16r.js → chunk-s2wptfm1.js} +2 -2
  106. package/dist/chunk-sf0r963g.js +2 -0
  107. package/dist/{chunk-qmfycza5.js → chunk-sqn3y9qt.js} +2 -2
  108. package/dist/{chunk-hmyb701s.js → chunk-srq9fqq8.js} +10 -10
  109. package/dist/chunk-ss820yys.js +2 -0
  110. package/dist/{chunk-pn1ehs6a.js → chunk-szevd7d5.js} +2 -2
  111. package/dist/{chunk-wbzmr6a4.js → chunk-t0k16vqv.js} +2 -2
  112. package/dist/chunk-t4j9g2vh.js +2 -0
  113. package/dist/chunk-t79jfpv6.js +3 -0
  114. package/dist/{chunk-rcadtv3x.js → chunk-t9kxhe46.js} +1 -1
  115. package/dist/{chunk-zqtbtqbq.js → chunk-tddnb5bv.js} +2 -2
  116. package/dist/{chunk-hvzzhkhr.js → chunk-thceyzj6.js} +2 -2
  117. package/dist/{chunk-8yqfpkp4.js → chunk-trh7s6k3.js} +5 -5
  118. package/dist/{chunk-dq56166k.js → chunk-trz8z4j4.js} +18 -18
  119. package/dist/chunk-ttemwrbx.js +2 -0
  120. package/dist/{chunk-agqcqf3q.js → chunk-twqzn21x.js} +7 -7
  121. package/dist/chunk-v14rq8b4.js +3 -0
  122. package/dist/{chunk-b4pcw34n.js → chunk-v21bhhjb.js} +1 -1
  123. package/dist/{chunk-ka8befem.js → chunk-v6peecfp.js} +2 -2
  124. package/dist/{chunk-g8r0km7g.js → chunk-vayhx642.js} +2 -2
  125. package/dist/{chunk-1ptwdkvn.js → chunk-vdxg7e1y.js} +2 -2
  126. package/dist/chunk-vq513cxx.js +2 -0
  127. package/dist/chunk-vvq8xe3n.js +2 -0
  128. package/dist/{chunk-tre98h62.js → chunk-w3d98907.js} +2 -2
  129. package/dist/{chunk-0qqvmfrw.js → chunk-w7t2cfgy.js} +42 -42
  130. package/dist/chunk-w8t31bn9.js +2 -0
  131. package/dist/chunk-x1kz4d7j.js +2 -0
  132. package/dist/chunk-xcsyqwxf.js +25 -0
  133. package/dist/{chunk-9p6efb17.js → chunk-xghcsg3f.js} +1 -1
  134. package/dist/chunk-xn9jrjzh.js +2 -0
  135. package/dist/{chunk-nrvwejdw.js → chunk-y1pcdeg9.js} +5 -5
  136. package/dist/{chunk-7b3kr56x.js → chunk-yx3dpdwc.js} +3 -3
  137. package/dist/{chunk-5xvan09w.js → chunk-z22zy22p.js} +2 -2
  138. package/dist/chunk-z97bwx8m.js +2 -0
  139. package/dist/{chunk-120ze5ms.js → chunk-zmg1peyg.js} +3 -3
  140. package/dist/{chunk-pxdww4rb.js → chunk-zp79zkkd.js} +2 -2
  141. package/dist/cli.js +20 -20
  142. package/dist/craft-entry.js +2 -2
  143. package/dist/craft.js +2 -2
  144. package/dist/loops.js +12 -2
  145. package/dist/pwa.js +3 -3
  146. package/dist/signal-processing.d.ts +12 -0
  147. package/dist/signal-processing.js +1 -1
  148. package/dist/ssg.js +6 -6
  149. package/package.json +5 -5
  150. package/dist/chunk-028ee6q5.js +0 -2
  151. package/dist/chunk-02ymqwmj.js +0 -2
  152. package/dist/chunk-1pnp91wx.js +0 -2
  153. package/dist/chunk-1v60t3sb.js +0 -2
  154. package/dist/chunk-2f17h17f.js +0 -2
  155. package/dist/chunk-4c183zem.js +0 -2
  156. package/dist/chunk-4yt8tg4j.js +0 -2
  157. package/dist/chunk-52gp2xxk.js +0 -2
  158. package/dist/chunk-5zgrvj4b.js +0 -2
  159. package/dist/chunk-67kj14at.js +0 -2
  160. package/dist/chunk-6rzshbey.js +0 -2
  161. package/dist/chunk-6vzktvyw.js +0 -2
  162. package/dist/chunk-81q3sc0w.js +0 -2
  163. package/dist/chunk-864qtx7y.js +0 -2
  164. package/dist/chunk-89jbdtgw.js +0 -3
  165. package/dist/chunk-8d33aqs5.js +0 -2
  166. package/dist/chunk-8tdz8svp.js +0 -2
  167. package/dist/chunk-99bhc1h1.js +0 -42
  168. package/dist/chunk-9rrnyd5m.js +0 -2
  169. package/dist/chunk-9szxxgv5.js +0 -2
  170. package/dist/chunk-amkwmxs8.js +0 -2
  171. package/dist/chunk-b1hxtn08.js +0 -2
  172. package/dist/chunk-b4fd2dtk.js +0 -2
  173. package/dist/chunk-b4vk2m82.js +0 -2
  174. package/dist/chunk-b58tv8jc.js +0 -25
  175. package/dist/chunk-b6nzy1rg.js +0 -2
  176. package/dist/chunk-b823zxq6.js +0 -3
  177. package/dist/chunk-bdg0fydw.js +0 -2
  178. package/dist/chunk-dpvxe52r.js +0 -2
  179. package/dist/chunk-e1fetwbr.js +0 -2
  180. package/dist/chunk-e4vpr36s.js +0 -2
  181. package/dist/chunk-e6p0k6br.js +0 -2
  182. package/dist/chunk-f8agvh5v.js +0 -2
  183. package/dist/chunk-fcn71bq1.js +0 -2
  184. package/dist/chunk-g2jmwh7p.js +0 -2
  185. package/dist/chunk-g64z2e92.js +0 -2
  186. package/dist/chunk-gw7h5k3b.js +0 -2
  187. package/dist/chunk-j0v970k3.js +0 -2
  188. package/dist/chunk-jk41jwsc.js +0 -2
  189. package/dist/chunk-jr9wfthg.js +0 -2
  190. package/dist/chunk-k2pa44rf.js +0 -2
  191. package/dist/chunk-kq9y6gfy.js +0 -2
  192. package/dist/chunk-md2qhahg.js +0 -2
  193. package/dist/chunk-p38m3947.js +0 -2
  194. package/dist/chunk-qcjh3pp8.js +0 -2
  195. package/dist/chunk-qw441qys.js +0 -2
  196. package/dist/chunk-qxmyaajq.js +0 -2
  197. package/dist/chunk-qyjsne99.js +0 -2
  198. package/dist/chunk-rermy54w.js +0 -2
  199. package/dist/chunk-rwjf25ht.js +0 -2
  200. package/dist/chunk-rx0ep3v1.js +0 -2
  201. package/dist/chunk-sf0wsq74.js +0 -2
  202. package/dist/chunk-shpc1ttk.js +0 -2
  203. package/dist/chunk-sy0z64yz.js +0 -2
  204. package/dist/chunk-ta7bmfvg.js +0 -3
  205. package/dist/chunk-weqc0ssb.js +0 -2
  206. package/dist/chunk-wq712sw1.js +0 -2
  207. package/dist/chunk-xr69d4tk.js +0 -2
  208. package/dist/chunk-xz6dw6yw.js +0 -2
  209. package/dist/chunk-y8kdy3d2.js +0 -2
  210. package/dist/chunk-yscr04dv.js +0 -2
  211. package/dist/chunk-z8p6tk5z.js +0 -2
  212. package/dist/chunk-zhf01af3.js +0 -3
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{t,a}from"./chunk-2dp7hyv7.js";import{n,pn,m}from"./chunk-t0zh1dn9.js";import{Ye}from"./chunk-365vg0eg.js";import{Xr,Jr}from"./chunk-fzqj1mjz.js";import{va,go,Gr,Kr}from"./chunk-04kg16qs.js";import{ha,ya}from"./chunk-yg267y85.js";import{bt}from"./chunk-3hxd5td3.js";import{nn,Ca,tr,nr}from"./chunk-zhf01af3.js";import{f}from"./chunk-b7e07ybq.js";import{Ts}from"./chunk-qv6axke4.js";import Q from"fs";import j from"path";import{loadConfigWithResult as Ht}from"bunfig";var B={duration:300,delay:0,ease:"ease",direction:"both"};function nt(e,r={}){let{duration:i,delay:l,ease:s,direction:c,custom:d}={...B,...r};if(e==="custom"&&d)return d;switch(e){case"fade":return`${c==="in"?"opacity: 0; animation: fadeIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":c==="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,a}from"./chunk-bsajk82t.js";import{n,pn,m}from"./chunk-f9zyf9n6.js";import{Ye}from"./chunk-4s8zacxg.js";import{Jr,Yr}from"./chunk-5qtthtg3.js";import{wa,mo,Kr,Xr}from"./chunk-am2w363p.js";import{ya,ba}from"./chunk-rym0309c.js";import{bt}from"./chunk-3hxd5td3.js";import{nn,Ea,nr,rr}from"./chunk-v14rq8b4.js";import{f}from"./chunk-b7e07ybq.js";import{$s}from"./chunk-5zhp87wv.js";import Q from"fs";import j from"path";import{loadConfigWithResult as Ht}from"bunfig";var B={duration:300,delay:0,ease:"ease",direction:"both"};function nt(e,r={}){let{duration:i,delay:l,ease:s,direction:c,custom:d}={...B,...r};if(e==="custom"&&d)return d;switch(e){case"fade":return`${c==="in"?"opacity: 0; animation: fadeIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":c==="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`${c==="in"?"transform: translateY(20px); opacity: 0; animation: slideIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":c==="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 De={name:"transition",handler:(e,r,i,l)=>{if(r.length<1)return`<div class="stx-error">@transition directive requires at least a transition type</div>${e}`;let s=r[0],c=r.length>1?Number.parseInt(r[1],10)||B.duration:B.duration,d=r.length>2?r[2]||B.ease:B.ease,p=r.length>3?Number.parseInt(r[3],10)||B.delay:B.delay,u=r.length>4?r[4]||B.direction:B.direction,g=`stx-transition-${Math.random().toString(36).substr(2,9)}`,y=nt(s,{duration:c,delay:p,ease:d,direction:u}),h="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="${g}" class="${h} ${v} ${u==="out"?"stx-out":""}"
236
236
  style="--stx-transition-duration: ${c}ms; --stx-transition-ease: ${d}; --stx-transition-delay: ${p}ms;">${e}</div>`},hasEndTag:!0,description:"Applies transition effects to an element"},Pe={name:"scrollAnimate",handler:(e,r,i,l)=>{if(r.length<1)return`<div class="stx-error">@scrollAnimate directive requires at least an animation type</div>${e}`;let s=r[0],c=r.length>1?Number.parseInt(r[1],10)||300:300,d=r.length>2?r[2]||"ease":"ease",p=r.length>3?Number.parseFloat(r[3])||0.2:0.2,u=r.length>4?Number.parseInt(r[4],10)||0:0,g=`stx-scroll-${Math.random().toString(36).substr(2,9)}`,y=`--stx-transition-duration: ${c}ms; --stx-transition-ease: ${d}; --stx-transition-delay: ${u}ms; will-change: opacity, transform;`,h="stx-transition stx-observe stx-out";if(s==="fade")h+=" stx-fade";else if(s==="slide-up"||s==="slide")h+=" stx-from-bottom";else if(s==="slide-down")h+=" stx-from-top";else if(s==="slide-left")h+=" stx-from-right";else if(s==="slide-right")h+=" stx-from-left";else if(s==="scale")h+=" stx-scale";else if(s.includes("-"))h+=` stx-${s}`;else h+=` stx-${s}`;return`<div id="${g}" class="${h}" style="${y}" data-threshold="${p}">${e}</div>`},hasEndTag:!0,description:"Applies animations that trigger when scrolled into view"},ke={name:"animationGroup",handler:(e,r,i,l)=>{if(r.length<2)return`<div class="stx-error">@animationGroup directive requires a group name and at least one element selector</div>${e}`;let s=r[0],c=r.slice(1).map((g)=>g.startsWith("#")||g.startsWith(".")?g:`#${g}`),d=i.staggerDelay||50,p=i.sequence||!0,u=ct(s,c,{staggerDelay:d,sequence:p});return`${e}
237
- ${u}`},hasEndTag:!1,description:"Coordinates multiple animations together as a group"},Ae={name:"motion",handler:(e,r,i,l)=>{let s=r.length>0?r[0].toLowerCase()==="true":!0,c=it();return`<div data-animate="${s?"auto":"true"}">${e}</div>${c}`},hasEndTag:!0,description:"Controls motion and animation preferences"};function ua(e,r,i,l){let s=e;if(l.animation?.enabled===!1)return s;let c=i.includes("test")&&i.includes("animation");if(!at(s)&&!c)return s;if(!s.includes('<style id="stx-animation-base">')){let p=lt();s=s.replace("</head>",`${p}
237
+ ${u}`},hasEndTag:!1,description:"Coordinates multiple animations together as a group"},Ae={name:"motion",handler:(e,r,i,l)=>{let s=r.length>0?r[0].toLowerCase()==="true":!0,c=it();return`<div data-animate="${s?"auto":"true"}">${e}</div>${c}`},hasEndTag:!0,description:"Controls motion and animation preferences"};function da(e,r,i,l){let s=e;if(l.animation?.enabled===!1)return s;let c=i.includes("test")&&i.includes("animation");if(!at(s)&&!c)return s;if(!s.includes('<style id="stx-animation-base">')){let p=lt();s=s.replace("</head>",`${p}
238
238
  </head>`)}if(s.includes("stx-observe")){if(!s.includes("Intersection Observer for scroll animations")){let u=ot(),g=s.lastIndexOf("</body>");if(g!==-1)s=s.slice(0,g)+u+`
239
239
  `+s.slice(g)}}return s}async function dt(e,r,i,l){let s=r[0]?.replace(/['"]/g,"")||"main",c=Ye();if(s!=="main")c=c.replace("container:'main'",`container:'${s}'`);return`<script data-stx-router>${c}</script>`}var _e={name:"stxRouter",handler:dt,hasEndTag:!1,description:"Inject the STX SPA router script for client-side navigation"};var ut={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 Re(e){let r=e.heatmap;if(!r?.enabled)return"";let i={...ut,...r};return`
240
240
  <!-- stx Heatmap - Privacy-Compliant Tracking -->
@@ -619,7 +619,7 @@ else {
619
619
  };
620
620
  })();
621
621
  </script>
622
- `}function da(e,r){let i=Re(r);if(!i)return e;let l=e.lastIndexOf("</body>");if(l!==-1)return e.slice(0,l)+i+e.slice(l);return e+i}var Oe={name:"heatmap",hasEndTag:!1,description:"Inject privacy-compliant heatmap tracking script",handler:async(e,r,i,l)=>{let s=i.__stx_config||{};if(r.length>0){let c=pt(r.join(" "));s.heatmap={...s.heatmap,...c,enabled:!0}}return Re(s)}};function pt(e){let r={},i=e.match(/(\w+)=["']?([^"'\s]+)["']?/g)||[];for(let l of i){let[s,c]=l.split("="),d=c?.replace(/["']/g,"");switch(s){case"endpoint":r.endpoint=d;break;case"samplingRate":r.samplingRate=Number.parseInt(d,10);break;case"batchSize":r.batchSize=Number.parseInt(d,10);break;case"trackMouse":r.trackMouse=d==="true";break;case"trackClicks":r.trackClicks=d==="true";break;case"trackScroll":r.trackScroll=d==="true";break;case"honorDnt":r.honorDnt=d==="true";break;case"debugOverlay":r.debugOverlay=d==="true";break}}return r}function J(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function Ee(e){let r=e.trim().toLowerCase();return!r.startsWith("javascript:")&&!r.startsWith("vbscript:")&&!r.startsWith("data:text/html")}function Yn(e){let r=/^---\r?\n([\s\S]*?)\r?\n---\r?\n/,i=e.match(r);if(!i)return{data:{},content:e.trim()};let l=i[1],s=e.slice(i[0].length),c={};for(let d of l.split(`
622
+ `}function pa(e,r){let i=Re(r);if(!i)return e;let l=e.lastIndexOf("</body>");if(l!==-1)return e.slice(0,l)+i+e.slice(l);return e+i}var Oe={name:"heatmap",hasEndTag:!1,description:"Inject privacy-compliant heatmap tracking script",handler:async(e,r,i,l)=>{let s=i.__stx_config||{};if(r.length>0){let c=pt(r.join(" "));s.heatmap={...s.heatmap,...c,enabled:!0}}return Re(s)}};function pt(e){let r={},i=e.match(/(\w+)=["']?([^"'\s]+)["']?/g)||[];for(let l of i){let[s,c]=l.split("="),d=c?.replace(/["']/g,"");switch(s){case"endpoint":r.endpoint=d;break;case"samplingRate":r.samplingRate=Number.parseInt(d,10);break;case"batchSize":r.batchSize=Number.parseInt(d,10);break;case"trackMouse":r.trackMouse=d==="true";break;case"trackClicks":r.trackClicks=d==="true";break;case"trackScroll":r.trackScroll=d==="true";break;case"honorDnt":r.honorDnt=d==="true";break;case"debugOverlay":r.debugOverlay=d==="true";break}}return r}function J(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function Ee(e){let r=e.trim().toLowerCase();return!r.startsWith("javascript:")&&!r.startsWith("vbscript:")&&!r.startsWith("data:text/html")}function Zn(e){let r=/^---\r?\n([\s\S]*?)\r?\n---\r?\n/,i=e.match(r);if(!i)return{data:{},content:e.trim()};let l=i[1],s=e.slice(i[0].length),c={};for(let d of l.split(`
623
623
  `)){let p=d.trim();if(!p||p.startsWith("#"))continue;let u=p.indexOf(":");if(u===-1)continue;let g=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)}c[g]=y}return{data:c,content:s.trim()}}function Xe(e,r={}){let{gfm:i=!0,breaks:l=!1}=r,s=e,c=[];if(s=s.replace(/```(\w*)\n([\s\S]*?)```/g,(y,h,v)=>{let b=c.length,x=h?` class="language-${J(h)}"`:"";return c.push(`<pre><code${x}>${J(v.trim())}</code></pre>`),`\x00CODEBLOCK${b}\x00`}),s=s.replace(/`([^`]*)`/g,(y,h)=>`<code>${J(h)}</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,h,v)=>`<img src="${Ee(v)?J(v):""}" alt="${J(h)}" />`),s=s.replace(/\[([^\]]+)\]\(([^)]+)\)/g,(y,h,v)=>`<a href="${Ee(v)?J(v):""}">${h}</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,h,v)=>{let x=`<tr>${h.split("|").map((S)=>S.trim()).filter(Boolean).map((S)=>`<th>${J(S)}</th>`).join("")}</tr>`,P=v.trim().split(`
625
625
  `).map((S)=>`<tr>${S.split("|").map((k)=>k.trim()).filter(Boolean).map((k)=>`<td>${J(k)}</td>`).join("")}</tr>`).join(`
@@ -637,7 +637,7 @@ ${P}
637
637
  `:`
638
638
  `)}</p>`);if(s=p.join(`
639
639
  `),l)s=s.replace(/\n/g,`<br />
640
- `);for(let y=0;y<c.length;y++)s=s.replace(`\x00CODEBLOCK${y}\x00`,c[y]);return s=s.replace(/<p>\s*<\/p>/g,""),s.trim()}async function pa(e,r,i=""){let l=e,s=[],c=/@markdown(?:\([^)]*\))?/g,d;while((d=c.exec(e))!==null){let p=d.index,u=d[0].match(/@markdown\(([^)]*)\)/),g=u?u[1]:"",y=p+d[0].length,h=1,v=y,b=-1;while(h>0&&v<e.length){let S=e.indexOf("@markdown",v),A=e.indexOf("@endmarkdown",v);if(A===-1)break;if(S!==-1&&S<A&&S!==p){let k=e[S+9];if(k==="("||k===`
640
+ `);for(let y=0;y<c.length;y++)s=s.replace(`\x00CODEBLOCK${y}\x00`,c[y]);return s=s.replace(/<p>\s*<\/p>/g,""),s.trim()}async function fa(e,r,i=""){let l=e,s=[],c=/@markdown(?:\([^)]*\))?/g,d;while((d=c.exec(e))!==null){let p=d.index,u=d[0].match(/@markdown\(([^)]*)\)/),g=u?u[1]:"",y=p+d[0].length,h=1,v=y,b=-1;while(h>0&&v<e.length){let S=e.indexOf("@markdown",v),A=e.indexOf("@endmarkdown",v);if(A===-1)break;if(S!==-1&&S<A&&S!==p){let k=e[S+9];if(k==="("||k===`
641
641
  `||k==="\r"||k===" "||k===void 0)h++;v=S+9}else{if(h--,h===0){b=A;break}v=A+12}}if(b===-1)continue;let x=e.slice(y,b),P=e.slice(p,b+12);s.push({fullMatch:P,options:g,content:x,index:p}),c.lastIndex=b+12}for(let{fullMatch:p,options:u,content:g,index:y}of s)try{let h={};if(u)u.split(",").forEach((x)=>{let P=x.trim();if(P)h[P]=!0});let v={gfm:h.gfm??!0,breaks:h.breaks??!1},b=Xe(g.trim(),v);l=l.split(p).join(b)}catch(h){let v=h instanceof Error?h.message:String(h),b=m("Markdown Directive",`Error processing markdown: ${v}`,i,e,y,p);l=l.split(p).join(b)}return l}async function Ie(e,r,i,l){let s={gfm:!0,breaks:!1};return r.forEach((c)=>{let d=c.trim().replace(/['"]/g,"");if(d==="breaks")s.breaks=!0;if(d==="no-gfm")s.gfm=!1}),Xe(e.trim(),s)}var Z=[320,480,640,768,1024,1280,1536,1920,2560],mt=[1,1.5,2,3],te=["avif","webp","jpeg"],gt={avif:"image/avif",webp:"image/webp",jpeg:"image/jpeg",png:"image/png",gif:"image/gif"};function pe(e,r=Z,i={},l){return r.sort((s,c)=>s-c).map((s)=>`${re(e,{...i,w:s,fm:l})} ${s}w`).join(", ")}function Te(e,r,i=mt,l={},s){return i.sort((c,d)=>c-d).map((c)=>{let d=Math.round(r*c);return`${re(e,{...l,w:d,dpr:c,fm:s})} ${c}x`}).join(", ")}function me(e,r="100vw"){if(!e||Object.keys(e).length===0)return r;let l=Object.entries(e).map(([s,c])=>{let d=/^\d+$/.test(s)?`${s}px`:s;return{bp:d,size:c,numericBp:Number.parseInt(d)||0}}).sort((s,c)=>s.numericBp-c.numericBp).map(({bp:s,size:c})=>`(max-width: ${s}) ${c}`);return l.push(r),l.join(", ")}function re(e,r={}){let i=Object.entries(r).filter(([,c])=>c!==void 0&&c!==null).map(([c,d])=>{if(Array.isArray(d))return[c,d.join(",")];return[c,String(d)]});if(i.length===0)return e;let l=i.map(([c,d])=>`${c}=${encodeURIComponent(d)}`).join("&"),s=e.includes("?")?"&":"?";return`${e}${s}${l}`}function ge(e){return gt[e]||"application/octet-stream"}var ft={strategy:"thumbhash",width:20,quality:50,blurLevel:40,transitionDuration:300,easing:"ease-out"},he=`
642
642
  .stx-img-placeholder {
643
643
  position: relative;
@@ -684,7 +684,7 @@ ${P}
684
684
  #${e}.stx-img-loaded img {
685
685
  opacity: 1;
686
686
  }
687
- `.trim()}var fe=new Map;async function Ne(e,r={}){let i=`${e}:${JSON.stringify(r)}`;if(fe.has(i))return fe.get(i);let l=await yt(e,r);return fe.set(i,l),l}async function wt(){try{return await import("./chunk-4yt8tg4j.js")}catch(e){if(!je)console.warn("[stx-media] Image processor not available, some features disabled:",e),je=!0;return null}}var je=!1,ye=80,oe="async",le="lazy",Ve=!1;async function ae(e,r={}){let i=r,l=e;if(l.process&&!l.skipOptimization){if(i.tsImagesConfig?.enabled&&!i.isDev)return Dt(l,i)}if(i.processedResult?.processed)return xe(e,i.processedResult,r);if(i.responsiveVariants)return We(e,i.responsiveVariants,r);let{src:s,alt:c,width:d,height:p,sizes:u,widths:g=Z,dpr:y,formats:h=te,quality:v=ye,params:b={},placeholder:x="none",placeholderOptions:P={},lazy:S=!0,priority:A=!1,loading:k=A?"eager":le,decoding:E=oe,fetchpriority:I,objectFit:w,objectPosition:C,crossorigin:D,referrerpolicy:L}=e,{class:W,style:T,id:V}=e,_=e.data||{},{isDev:z=!1,baseUrl:G=""}=r;if(z&&!r.optimize)return Ct(e);let F,O,H=V||`stx-img-${Math.random().toString(36).slice(2,8)}`;if(x!=="none"&&!A)try{F=await Ne(s,{strategy:x,...P}),O=Me(H,F,P)}catch{}let ne=y!==void 0&&d!==void 0,X;if(ne)X=St(e,H,F,r);else X=await $t(e,H,F,r);let ee;if(A){let Ce=h.includes("webp")?"webp":h[0],rt=pe(s,g,{...b,q:v},Ce),st=typeof u==="object"?me(u):u||"100vw";ee=`<link rel="preload" as="image" imagesrcset="${rt}" imagesizes="${st}" />`}let ie=[];if(!Ve&&x!=="none")ie.push(he),Ve=!0;if(O)ie.push(O);let tt=S?Le(H):void 0;return{html:X,preloadLink:ee,css:ie.length>0?ie.join(`
687
+ `.trim()}var fe=new Map;async function Ne(e,r={}){let i=`${e}:${JSON.stringify(r)}`;if(fe.has(i))return fe.get(i);let l=await yt(e,r);return fe.set(i,l),l}async function wt(){try{return await import("./chunk-p8bgy5tt.js")}catch(e){if(!je)console.warn("[stx-media] Image processor not available, some features disabled:",e),je=!0;return null}}var je=!1,ye=80,oe="async",le="lazy",Ve=!1;async function ae(e,r={}){let i=r,l=e;if(l.process&&!l.skipOptimization){if(i.tsImagesConfig?.enabled&&!i.isDev)return Dt(l,i)}if(i.processedResult?.processed)return xe(e,i.processedResult,r);if(i.responsiveVariants)return We(e,i.responsiveVariants,r);let{src:s,alt:c,width:d,height:p,sizes:u,widths:g=Z,dpr:y,formats:h=te,quality:v=ye,params:b={},placeholder:x="none",placeholderOptions:P={},lazy:S=!0,priority:A=!1,loading:k=A?"eager":le,decoding:E=oe,fetchpriority:I,objectFit:w,objectPosition:C,crossorigin:D,referrerpolicy:L}=e,{class:W,style:T,id:V}=e,_=e.data||{},{isDev:z=!1,baseUrl:G=""}=r;if(z&&!r.optimize)return Ct(e);let F,O,H=V||`stx-img-${Math.random().toString(36).slice(2,8)}`;if(x!=="none"&&!A)try{F=await Ne(s,{strategy:x,...P}),O=Me(H,F,P)}catch{}let ne=y!==void 0&&d!==void 0,X;if(ne)X=St(e,H,F,r);else X=await $t(e,H,F,r);let ee;if(A){let Ce=h.includes("webp")?"webp":h[0],rt=pe(s,g,{...b,q:v},Ce),st=typeof u==="object"?me(u):u||"100vw";ee=`<link rel="preload" as="image" imagesrcset="${rt}" imagesizes="${st}" />`}let ie=[];if(!Ve&&x!=="none")ie.push(he),Ve=!0;if(O)ie.push(O);let tt=S?Le(H):void 0;return{html:X,preloadLink:ee,css:ie.length>0?ie.join(`
688
688
  `):void 0,script:tt}}async function $t(e,r,i,l){let{src:s,alt:c,width:d,height:p,sizes:u,widths:g=Z,formats:y=te,quality:h=ye,params:v={},lazy:b=!0,priority:x=!1,loading:P=x?"eager":le,decoding:S=oe,fetchpriority:A,objectFit:k,objectPosition:E,crossorigin:I,referrerpolicy:w}=e,{class:C,style:D}=e,L=e.data||{},W=typeof u==="object"?me(u):u||"100vw",T=[];for(let z of y){let G=pe(s,g,{...v,q:h},z),F=ge(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=ve({src:re(s,{...v,q:h}),alt:c,width:d,height:p,loading:x?void 0:P,decoding:S,fetchpriority:x?"high":A,objectFit:k,objectPosition:E,crossorigin:I,referrerpolicy:w,className:ze(C,i),style:be(D,k,E,i),lazy:b&&!x,data:L}),_;if(i){let z=`background-image: url('${i.dataURL}'); background-size: cover; background-position: center;`;_=`<div id="${r}" 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 We(e,r,i){let l={src:r.src,processed:!0,variants:[],placeholder:r.placeholder?.dataURL,originalWidth:r.placeholder?.width,originalHeight:r.placeholder?.height};for(let[s,c]of Object.entries(r.byFormat))if(c)l.variants.push(...c);return xe(e,l,i)}function Pt(){return bt({name:"img",hasEndTag:!1,description:"Render an optimized responsive image with srcset and lazy loading",transform:async(e,r,i,l)=>{let{src:s,alt:c,options:d}=kt(e,r,i);if(!s)return console.warn("@img directive: missing src argument"),"<!-- @img: missing src -->";let p={src:s,alt:c||"",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,g=await ae(p,{isDev:u}),y=g.html;if(g.preloadLink)y=g.preloadLink+`
749
749
  `+y;if(g.css)y+=`
750
750
  <style>${g.css}</style>`;if(g.script)y+=`
751
- <script>${g.script}</script>`;return y},defaults:{src:"",alt:"",options:{lazy:!0,placeholder:"none"}}})}function kt(e,r,i){if(r.src)return{src:String(r.src),alt:String(r.alt||""),options:r.options||{}};let l=e.trim();if(l.startsWith("@img(")||l.startsWith("("))l=l.replace(/^@img\(/,"").replace(/^\(/,"").replace(/\)$/,"");let s=At(l),c=we(s[0],i)||"",d=we(s[1],i)||"",p={};if(s[2]){let u=we(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:c,alt:d,options:p}}function At(e){let r=[],i="",l=!1,s="",c=0,d=0;for(let p=0;p<e.length;p++){let u=e[p],g=p>0?e[p-1]:"";if((u==='"'||u==="'"||u==="`")&&g!=="\\"){if(!l)l=!0,s=u;else if(u===s)l=!1,s="";else i+=u;continue}if(!l){if(u==="{")c++;if(u==="}")c--;if(u==="[")d++;if(u==="]")d--;if(u===","&&c===0&&d===0){r.push(i.trim()),i="";continue}}i+=u}if(i.trim())r.push(i.trim());return r}function we(e,r){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 l=r[i];if(l!==void 0)return l}if(i.startsWith("{")||i.startsWith("["))try{return JSON.parse(i)}catch{}return i}var Fe=Pt();async function He(){try{return await import("./chunk-b4fd2dtk.js")}catch(e){if(!qe)console.warn("[stx-media] Video processor not available, some features disabled:",e),qe=!0;return null}}var qe=!1,Ue=!0,Be="metadata",_t="https://cdn.jsdelivr.net/npm/ts-video-player@latest/dist/index.min.js";async function ce(e,r={}){let i=r,l=e;if(l.process&&!l.skipProcessing){if(i.tsVideosConfig?.enabled&&!i.isDev)return Tt(l,i)}if(i.processedResult?.processed)return Ke(e,i.processedResult,r);let s;if(l.generatePoster&&l.src&&!e.poster)s=await Mt(l,i);let{src:c,sources:d=[],poster:p,posterPlaceholder:u,controls:g=Ue,autoplay:y=!1,muted:h=!1,loop:v=!1,preload:b=Be,playsinline:x=!0,lazy:P=!0,player:S="native",type:A,width:k,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 Ot(e,r);if(A&&A!=="video")return Rt(c||"",A,e);let V=d.length>0?d:c?[{src:c,type:Je(c)}]:[],_=[`id="${T}"`];if(g)_.push("controls");if(y)_.push("autoplay");if(h)_.push("muted");if(v)_.push("loop");if(x)_.push("playsinline");if(w)_.push("disablepictureinpicture");if(C)_.push("disableremoteplayback");if(I)_.push(`crossorigin="${I}"`);if(P){if(_.push(`data-preload="${b}"`),_.push('preload="none"'),D)_.push(`data-poster="${M(D)}"`);_.push("data-stx-lazy")}else if(_.push(`preload="${b}"`),D)_.push(`poster="${M(D)}"`);if(k)_.push(`width="${k}"`);if(E)_.push(`height="${E}"`);if(L)_.push(`class="${M(L)}"`);if(W)_.push(`style="${M(W)}"`);let z=V.map((O)=>` <source ${P?`data-src="${M(O.src)}"`:`src="${M(O.src)}"`} type="${O.type}"${O.media?` media="${O.media}"`:""} />`).join(`
751
+ <script>${g.script}</script>`;return y},defaults:{src:"",alt:"",options:{lazy:!0,placeholder:"none"}}})}function kt(e,r,i){if(r.src)return{src:String(r.src),alt:String(r.alt||""),options:r.options||{}};let l=e.trim();if(l.startsWith("@img(")||l.startsWith("("))l=l.replace(/^@img\(/,"").replace(/^\(/,"").replace(/\)$/,"");let s=At(l),c=we(s[0],i)||"",d=we(s[1],i)||"",p={};if(s[2]){let u=we(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:c,alt:d,options:p}}function At(e){let r=[],i="",l=!1,s="",c=0,d=0;for(let p=0;p<e.length;p++){let u=e[p],g=p>0?e[p-1]:"";if((u==='"'||u==="'"||u==="`")&&g!=="\\"){if(!l)l=!0,s=u;else if(u===s)l=!1,s="";else i+=u;continue}if(!l){if(u==="{")c++;if(u==="}")c--;if(u==="[")d++;if(u==="]")d--;if(u===","&&c===0&&d===0){r.push(i.trim()),i="";continue}}i+=u}if(i.trim())r.push(i.trim());return r}function we(e,r){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 l=r[i];if(l!==void 0)return l}if(i.startsWith("{")||i.startsWith("["))try{return JSON.parse(i)}catch{}return i}var Fe=Pt();async function He(){try{return await import("./chunk-a6y8td0d.js")}catch(e){if(!qe)console.warn("[stx-media] Video processor not available, some features disabled:",e),qe=!0;return null}}var qe=!1,Ue=!0,Be="metadata",_t="https://cdn.jsdelivr.net/npm/ts-video-player@latest/dist/index.min.js";async function ce(e,r={}){let i=r,l=e;if(l.process&&!l.skipProcessing){if(i.tsVideosConfig?.enabled&&!i.isDev)return Tt(l,i)}if(i.processedResult?.processed)return Ke(e,i.processedResult,r);let s;if(l.generatePoster&&l.src&&!e.poster)s=await Mt(l,i);let{src:c,sources:d=[],poster:p,posterPlaceholder:u,controls:g=Ue,autoplay:y=!1,muted:h=!1,loop:v=!1,preload:b=Be,playsinline:x=!0,lazy:P=!0,player:S="native",type:A,width:k,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 Ot(e,r);if(A&&A!=="video")return Rt(c||"",A,e);let V=d.length>0?d:c?[{src:c,type:Je(c)}]:[],_=[`id="${T}"`];if(g)_.push("controls");if(y)_.push("autoplay");if(h)_.push("muted");if(v)_.push("loop");if(x)_.push("playsinline");if(w)_.push("disablepictureinpicture");if(C)_.push("disableremoteplayback");if(I)_.push(`crossorigin="${I}"`);if(P){if(_.push(`data-preload="${b}"`),_.push('preload="none"'),D)_.push(`data-poster="${M(D)}"`);_.push("data-stx-lazy")}else if(_.push(`preload="${b}"`),D)_.push(`poster="${M(D)}"`);if(k)_.push(`width="${k}"`);if(E)_.push(`height="${E}"`);if(L)_.push(`class="${M(L)}"`);if(W)_.push(`style="${M(W)}"`);let z=V.map((O)=>` <source ${P?`data-src="${M(O.src)}"`:`src="${M(O.src)}"`} type="${O.type}"${O.media?` media="${O.media}"`:""} />`).join(`
752
752
  `),G=`<video ${_.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:_,css:z}}function Ge(){return bt({name:"video",hasEndTag:!1,description:"Render a video with optional ts-videos processing, streaming, and poster generation",transform:async(e,r,i,l)=>{let{src:s,options:c}=Nt(e,r,i);if(!s)return console.warn("@video directive: missing src argument"),"<!-- @video: missing src -->";let d={src:s,poster:c.poster,controls:c.controls!==!1,autoplay:c.autoplay||!1,muted:c.muted||!1,loop:c.loop||!1,preload:c.preload||"metadata",playsinline:c.playsinline!==!1,lazy:c.lazy!==!1,player:c.player||"native",type:c.type,width:c.width,height:c.height,class:c.class,style:c.style,id:c.id,crossorigin:c.crossorigin,disablePictureInPicture:c.disablePictureInPicture,disableRemotePlayback:c.disableRemotePlayback,title:c.title,quality:c.quality,platform:c.platform,process:c.process,generatePoster:c.generatePoster,streaming:c.streaming,transcode:c.transcode,spriteSheet:c.spriteSheet,waveform:c.waveform},u={isDev:i.__isDev||!1,tsVideosConfig:i.__tsVideosConfig},g=await ce(d,u),y=g.html;if(g.css)y+=`
1009
1009
  <style>${g.css}</style>`;if(g.script)y+=`
1010
- <script>${g.script}</script>`;return y},defaults:{src:"",options:{controls:!0,lazy:!0,preload:"metadata"}}})}function Nt(e,r,i){if(r.src)return{src:String(r.src),options:r.options||{}};let l=e.trim();if(l.startsWith("@video(")||l.startsWith("("))l=l.replace(/^@video\(/,"").replace(/^\(/,"").replace(/\)$/,"");let s=jt(l),c=Ze(s[0],i)||"",d={};if(s[1]){let p=Ze(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:c,options:d}}function jt(e){let r=[],i="",l=!1,s="",c=0,d=0;for(let p=0;p<e.length;p++){let u=e[p],g=p>0?e[p-1]:"";if((u==='"'||u==="'"||u==="`")&&g!=="\\"){if(!l)l=!0,s=u;else if(u===s)l=!1,s="";else i+=u;continue}if(!l){if(u==="{")c++;if(u==="}")c--;if(u==="[")d++;if(u==="]")d--;if(u===","&&c===0&&d===0){r.push(i.trim()),i="";continue}}i+=u}if(i.trim())r.push(i.trim());return r}function Ze(e,r){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 l=r[i];if(l!==void 0)return l}if(i.startsWith("{")||i.startsWith("["))try{return JSON.parse(i)}catch{}return i}var $e=Ge();import Vt from"fs";import q from"path";async function qr(e,r){if(!e.webComponents?.enabled)return[];let i=e.webComponents.components||[],l=[];if(i.length>0){if(e.debug)console.log(`Building ${i.length} web components...`);for(let s of i)try{let c=await zt(s,e,r);if(c)l.push(c)}catch(c){if(console.error(`Error building web component ${s.name}:`,c),e.debug)throw c}}return l}async function zt(e,r,i){let{name:l,file:s,tag:c,extends:d}=e;if(!l||!s||!c)return console.error("Invalid web component configuration, missing required fields:",e),null;let p=null;if(q.isAbsolute(s)&&await n(s))p=s;else if(r.componentsDir){let P=q.join(r.componentsDir,s);if(await n(P))p=P}if(!p)p=await pn(s,process.cwd(),r,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",h=y?Wt({name:l,tag:c,baseElement:d,source:u,shadowDOM:e.shadowDOM??!0,template:e.template??!0,styleSource:e.styleSource,attributes:e.attributes||[],attributeTypes:e.attributeTypes||{}}):Lt({name:l,tag:c,baseElement:d,source:u,shadowDOM:e.shadowDOM??!0,template:e.template??!0,styleSource:e.styleSource,attributes:e.attributes||[]}),v=r.webComponents?.outputDir||"dist/web-components";await Vt.promises.mkdir(v,{recursive:!0});let b=y?"ts":"js",x=q.join(v,`${c}.${b}`);if(await Bun.write(x,h),r.debug)console.log(`Built web component ${l} -> ${x}`);return x}function Lt(e){let{name:r,tag:i,baseElement:l="HTMLElement",source:s,shadowDOM:c,template:d,styleSource:p,attributes:u=[]}=e,g=s.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").trim();if(!c)g=g.replace(/<slot\s+name=["']([^"']+)["']\s*>([\s\S]*?)<\/slot>/gi,'<div data-slot="$1">$2</div>'),g=g.replace(/<slot\s+name=["']([^"']+)["']\s*\/>/gi,'<div data-slot="$1"></div>'),g=g.replace(/<slot\s*>([\s\S]*?)<\/slot>/gi,"<div data-default-slot>$1</div>"),g=g.replace(/<slot\s*\/>/gi,"<div data-default-slot></div>");let y="";if(p)y=`<link rel="stylesheet" href="${p}">`;return`/**
1010
+ <script>${g.script}</script>`;return y},defaults:{src:"",options:{controls:!0,lazy:!0,preload:"metadata"}}})}function Nt(e,r,i){if(r.src)return{src:String(r.src),options:r.options||{}};let l=e.trim();if(l.startsWith("@video(")||l.startsWith("("))l=l.replace(/^@video\(/,"").replace(/^\(/,"").replace(/\)$/,"");let s=jt(l),c=Ze(s[0],i)||"",d={};if(s[1]){let p=Ze(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:c,options:d}}function jt(e){let r=[],i="",l=!1,s="",c=0,d=0;for(let p=0;p<e.length;p++){let u=e[p],g=p>0?e[p-1]:"";if((u==='"'||u==="'"||u==="`")&&g!=="\\"){if(!l)l=!0,s=u;else if(u===s)l=!1,s="";else i+=u;continue}if(!l){if(u==="{")c++;if(u==="}")c--;if(u==="[")d++;if(u==="]")d--;if(u===","&&c===0&&d===0){r.push(i.trim()),i="";continue}}i+=u}if(i.trim())r.push(i.trim());return r}function Ze(e,r){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 l=r[i];if(l!==void 0)return l}if(i.startsWith("{")||i.startsWith("["))try{return JSON.parse(i)}catch{}return i}var $e=Ge();import Vt from"fs";import q from"path";async function Gr(e,r){if(!e.webComponents?.enabled)return[];let i=e.webComponents.components||[],l=[];if(i.length>0){if(e.debug)console.log(`Building ${i.length} web components...`);for(let s of i)try{let c=await zt(s,e,r);if(c)l.push(c)}catch(c){if(console.error(`Error building web component ${s.name}:`,c),e.debug)throw c}}return l}async function zt(e,r,i){let{name:l,file:s,tag:c,extends:d}=e;if(!l||!s||!c)return console.error("Invalid web component configuration, missing required fields:",e),null;let p=null;if(q.isAbsolute(s)&&await n(s))p=s;else if(r.componentsDir){let P=q.join(r.componentsDir,s);if(await n(P))p=P}if(!p)p=await pn(s,process.cwd(),r,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",h=y?Wt({name:l,tag:c,baseElement:d,source:u,shadowDOM:e.shadowDOM??!0,template:e.template??!0,styleSource:e.styleSource,attributes:e.attributes||[],attributeTypes:e.attributeTypes||{}}):Lt({name:l,tag:c,baseElement:d,source:u,shadowDOM:e.shadowDOM??!0,template:e.template??!0,styleSource:e.styleSource,attributes:e.attributes||[]}),v=r.webComponents?.outputDir||"dist/web-components";await Vt.promises.mkdir(v,{recursive:!0});let b=y?"ts":"js",x=q.join(v,`${c}.${b}`);if(await Bun.write(x,h),r.debug)console.log(`Built web component ${l} -> ${x}`);return x}function Lt(e){let{name:r,tag:i,baseElement:l="HTMLElement",source:s,shadowDOM:c,template:d,styleSource:p,attributes:u=[]}=e,g=s.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").trim();if(!c)g=g.replace(/<slot\s+name=["']([^"']+)["']\s*>([\s\S]*?)<\/slot>/gi,'<div data-slot="$1">$2</div>'),g=g.replace(/<slot\s+name=["']([^"']+)["']\s*\/>/gi,'<div data-slot="$1"></div>'),g=g.replace(/<slot\s*>([\s\S]*?)<\/slot>/gi,"<div data-default-slot>$1</div>"),g=g.replace(/<slot\s*\/>/gi,"<div data-default-slot></div>");let y="";if(p)y=`<link rel="stylesheet" href="${p}">`;return`/**
1011
1011
  * ${r} Web Component
1012
1012
  * Auto-generated from stx component
1013
1013
  */
@@ -1307,6 +1307,6 @@ ${y}
1307
1307
  customElements.define('${r}', ${d});
1308
1308
  `}async function Qe(e,r,i,l){if(r.length<1)return a("WebComponent","@webcomponent directive requires at least the tag name parameter",t.INVALID_DIRECTIVE_SYNTAX);let s=r[0].replace(/['"]/g,""),d=(i.__stx_options||{}).componentsDir||"components",p=q.isAbsolute(d)?[q.join(d,`${s}.stx`),q.join(q.dirname(l),`${s}.stx`)]:[q.join(q.dirname(l),d,`${s}.stx`),q.join(process.cwd(),d,`${s}.stx`),q.join(q.dirname(l),`${s}.stx`)],u=null;for(let h of p)if(await n(h)){u=await Bun.file(h).text();break}if(!u)return a("WebComponent",`Component file not found: ${s}.stx`,t.FILE_NOT_FOUND);let g=Ft(u,s);return`<script type="module">
1309
1309
  ${qt(g)}
1310
- </script>`}var N={enabled:!0,ssr:!1,partialsDir:"partials",componentsDir:"components",layoutsDir:"layouts",defaultLayout:"default",debug:!1,cache:!0,stateDir:nn,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:Ie,hasEndTag:!0,description:"Render markdown content to HTML"},{name:"webcomponent",handler:Qe,hasEndTag:!1,description:"Include a web component in the template"},ha,ya,Xr,Jr,De,ke,Ae,Pe,_e,Oe,Fe,$e,...Ts],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 Ut(e,r,i){let l=r||"pages";if(e)return{root:e,pagesDir:l};let s=i||process.cwd(),c=j.join(s,"resources","views"),d=j.join(s,"resources","layouts");if(Q.existsSync(c)&&Q.existsSync(d))return{root:"resources",pagesDir:"views"};let p=j.join(s,"resources","views","pages");if(Q.existsSync(p))return{root:"resources/views",pagesDir:l};return{root:".",pagesDir:l}}var et=new Set,ue=["partialsDir","componentsDir","layoutsDir"],Se=new WeakMap;function Bt(e,r){let i=r.replace(/[\\/]+$/,"");if(!i||i===".")return!0;let l=e.replace(/\\/g,"/"),s=i.replace(/\\/g,"/");return l===s||l.startsWith(`${s}/`)}function Rl(e,r){let i=!e.root,l=Ut(e.root,e.pagesDir,r);if(e.root=l.root,e.pagesDir=l.pagesDir,i&&l.root!=="."){let s=`${r}::${l.root}`;if(!et.has(s))et.add(s),console.warn(`[stx] No "root" in config \u2014 inferred "${l.root}" from the project layout. Template directories are resolved under it; set root explicitly to pin this.`)}if(!Se.has(e)){let s={};for(let c of ue){let d=e[c];if(typeof d==="string"&&d)s[c]=d}Se.set(e,s)}if(e.root&&e.root!=="."){let s=e.root;for(let c of ue){let d=e[c];if(typeof d!=="string"||!d)continue;if(j.isAbsolute(d)||Bt(d,s))continue;e[c]=j.join(s,d)}}for(let s of ue){let c=e[s];if(typeof c!=="string"||!c||j.isAbsolute(c))continue;e[s]=j.resolve(r,c)}return e}function Jt(e,r){let i=Se.get(e);for(let l of ue){let s=e[l];if(typeof s!=="string"||!s)continue;let c=j.isAbsolute(s)?s:j.join(r,s);if(Q.existsSync(c))continue;let d=i?.[l]??s,p=e.root,u=!!p&&p!==".";console.warn(`[stx] ${String(l)} resolves to "${c}", which does not exist. Configured as "${d}"`+(u?`, resolved under root "${p}".`:"."))}}function Kt(e){if(e.customDirectives)e.customDirectives=[...e.customDirectives];if(e.middleware)e.middleware=[...e.middleware];if(e.apiRoutes)e.apiRoutes={...e.apiRoutes}}function Gt(e){if(Ca(e.stateDir),e.stateDir=tr(),e.cachePath=nr(e.cachePath),e.build)e.build.cacheDir=nr(e.build.cacheDir);if(e.media?.cache)e.media.cache.directory=nr(e.media.cache.directory);if(e.story)e.story.outDir=nr(e.story.outDir)}var K=null,Y=new Map,de=new Map,se=null;async function po(e,r=Ht){try{return await r(e)}catch(i){if(i instanceof Error&&i.name==="ConfigNotFoundError")return{config:e.defaultConfig};throw i}}async function o(e){let r=e?j.resolve(e):process.cwd(),i=de.get(r);if(i&&i.signature!==Gr(i.graph)){let c=Y.get(r);if(Y.delete(r),de.delete(r),!e)K=null,se=null;let{clearComponentCache:d}=await import("./chunk-xr69d4tk.js"),{partialsCache:p}=await import("./chunk-p38m3947.js");if(d(),p.clear(),c&&i.configSignature===Kr(i.graph)){let u=c.then(async(g)=>{let y={...i.graph};await go(y,r),de.set(r,{graph:y,signature:Gr(y),configSignature:Kr(y)});let h={...g,_layerGraph:y};if(!e)K=h;return h});return Y.set(r,u),u}}if(!e){if(K)return K;if(se)return se}let l=Y.get(r);if(l)return l;let s=(async()=>{let c=[".ts",".js",".mjs",".cjs",".json"],d=c.some((v)=>Q.existsSync(j.join(r,`stx.config${v}`))),p=c.some((v)=>Q.existsSync(j.join(r,"config",`ui${v}`))),u;if(d&&p){let v=await po({name:"ui",cwd:j.join(r,"config"),defaultConfig:N,errorPolicy:"throw",verbose:!1});u=(await po({name:"stx",alias:"ui",cwd:r,defaultConfig:v.config,errorPolicy:"throw",verbose:!1})).config}else u=(await po({name:"stx",alias:"ui",cwd:r,defaultConfig:N,errorPolicy:"throw",verbose:!1})).config;if(u.extends!==void 0||i){let v=await va(r,N);u=v.config,de.set(r,{graph:v.graph,signature:Gr(v.graph),configSignature:Kr(v.graph)})}if(u.runtimeConfig){let{resolveRuntimeConfig:v}=await import("./chunk-02ymqwmj.js");v(u.runtimeConfig,{});let{generateRuntimeConfigTypes:b}=await import("./chunk-qw441qys.js");await b(r,u.runtimeConfig)}Kt(u),Gt(u),Rl(u,r),Jt(u,r);let g=[],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{f.resolve(b,{paths:[r]}),g.push(b)}catch{}}let h=[...u.plugins??[],...g];if(h.length>0){let{pluginManager:v}=await import("./chunk-fcn71bq1.js"),b=[],x=[];for(let P of h){let S=typeof P==="string"?P:P[0],A=typeof P==="string"?{}:P[1]||{};try{let k,E;try{let w=f.resolve(S,{paths:[r]});k=await import(w),E=j.dirname(w)}catch{let w=j.resolve(r,S);k=await import(w),E=j.dirname(w)}let I=k.default||k;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(j.resolve(E,C))}if(I.pages){let w=j.resolve(E,I.pages),C=A.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(A,w)}process.stderr.write(`[stx] Plugin loaded: ${I.name||S}
1311
- `)}catch(k){console.warn(`[stx] Failed to load plugin ${S}:`,k.message)}}u._pluginComponentDirs=b,u._pluginPageDirs=x}return u})();if(Y.set(r,s),s.catch(()=>{if(Y.get(r)===s)Y.delete(r)}),!e)se=s,s.then((c)=>{K=c}).catch(()=>{});return s}var R=new Proxy(N,{get(e,r){if(K&&r in K)return K[r];if(!se)o().catch((i)=>{console.warn("[stx] Failed to load config file:",i?.message||i)});return e[r]}});function xp(e){return e}function Sp(e){let r=[],i=[];if(e.partialsDir!==void 0&&typeof e.partialsDir!=="string")r.push({path:"partialsDir",message:"partialsDir must be a string",severity:"error"});if(e.componentsDir!==void 0&&typeof e.componentsDir!=="string")r.push({path:"componentsDir",message:"componentsDir must be a string",severity:"error"});if(e.cache!==void 0&&typeof e.cache!=="boolean")r.push({path:"cache",message:"cache must be a boolean",severity:"error"});if(e.debug!==void 0&&typeof e.debug!=="boolean")r.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)r.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)r.push({path:"streaming.timeout",message:"streaming.timeout must be a positive number",severity:"error"})}if(e.streaming.strategy!==void 0){let l=["auto","manual","sections"];if(!l.includes(e.streaming.strategy))r.push({path:"streaming.strategy",message:`streaming.strategy must be one of: ${l.join(", ")}`,severity:"error"})}}if(e.i18n){if(e.i18n.format!==void 0){let l=["json","yaml","yml","js"];if(!l.includes(e.i18n.format))r.push({path:"i18n.format",message:`i18n.format must be one of: ${l.join(", ")}`,severity:"error"})}}if(e.animation){if(e.animation.defaultDuration!==void 0){if(typeof e.animation.defaultDuration!=="number"||e.animation.defaultDuration<0)r.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)r.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 l=["AA","AAA"];if(!l.includes(e.a11y.level))r.push({path:"a11y.level",message:`a11y.level must be one of: ${l.join(", ")}`,severity:"error"})}}if(e.hydration){if(e.hydration.mode!==void 0){let l=["progressive","islands"];if(!l.includes(e.hydration.mode))r.push({path:"hydration.mode",message:`hydration.mode must be one of: ${l.join(", ")}`,severity:"error"})}if(e.hydration.preload!==void 0){let l=["none","eager","lazy"];if(!l.includes(e.hydration.preload))r.push({path:"hydration.preload",message:`hydration.preload must be one of: ${l.join(", ")}`,severity:"error"})}}if(e.customDirectives)if(!Array.isArray(e.customDirectives))r.push({path:"customDirectives",message:"customDirectives must be an array",severity:"error"});else e.customDirectives.forEach((l,s)=>{if(!l.name||typeof l.name!=="string")r.push({path:`customDirectives[${s}].name`,message:"Custom directive must have a name string",severity:"error"});if(!l.handler||typeof l.handler!=="function")r.push({path:`customDirectives[${s}].handler`,message:"Custom directive must have a handler function",severity:"error"})});if(e.middleware)if(!Array.isArray(e.middleware))r.push({path:"middleware",message:"middleware must be an array",severity:"error"});else e.middleware.forEach((l,s)=>{if(!l.name||typeof l.name!=="string")r.push({path:`middleware[${s}].name`,message:"Middleware must have a name string",severity:"error"});if(!l.handler||typeof l.handler!=="function")r.push({path:`middleware[${s}].handler`,message:"Middleware must have a handler function",severity:"error"});if(!l.timing||!["before","after"].includes(l.timing))r.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)r.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 l=["fullscreen","standalone","minimal-ui","browser"];if(!l.includes(e.pwa.manifest.display))r.push({path:"pwa.manifest.display",message:`PWA display must be one of: ${l.join(", ")}`,severity:"error"})}if(e.pwa.manifest?.orientation!==void 0){let l=["portrait","landscape","any","portrait-primary","portrait-secondary","landscape-primary","landscape-secondary"];if(!l.includes(e.pwa.manifest.orientation))r.push({path:"pwa.manifest.orientation",message:`PWA orientation must be one of: ${l.join(", ")}`,severity:"error"})}if(e.pwa.routes){let l=["cache-first","network-first","stale-while-revalidate","network-only","cache-only"];e.pwa.routes.forEach((s,c)=>{if(!s.pattern||typeof s.pattern!=="string")r.push({path:`pwa.routes[${c}].pattern`,message:"PWA route must have a pattern string",severity:"error"});if(!l.includes(s.strategy))r.push({path:`pwa.routes[${c}].strategy`,message:`PWA route strategy must be one of: ${l.join(", ")}`,severity:"error"});if(s.maxAgeSeconds!==void 0&&(typeof s.maxAgeSeconds!=="number"||s.maxAgeSeconds<0))r.push({path:`pwa.routes[${c}].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))r.push({path:`pwa.routes[${c}].maxEntries`,message:"PWA route maxEntries must be a positive number",severity:"error"})})}if(e.pwa.icons?.sizes){if(!Array.isArray(e.pwa.icons.sizes))r.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)r.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be numbers between 16 and 1024",severity:"error"})}if(e.pwa.icons?.purpose){let l=["any","maskable","monochrome"];if(e.pwa.icons.purpose.filter((c)=>!l.includes(c)).length>0)r.push({path:"pwa.icons.purpose",message:`PWA icon purpose must be one of: ${l.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:r.length===0,errors:r,warnings:i}}
1312
- export{ua,da,Yn,Xe,pa,qr,N,Rl,po,o,R,xp,Sp};
1310
+ </script>`}var N={enabled:!0,ssr:!1,partialsDir:"partials",componentsDir:"components",layoutsDir:"layouts",defaultLayout:"default",debug:!1,cache:!0,stateDir:nn,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:Ie,hasEndTag:!0,description:"Render markdown content to HTML"},{name:"webcomponent",handler:Qe,hasEndTag:!1,description:"Include a web component in the template"},ya,ba,Jr,Yr,De,ke,Ae,Pe,_e,Oe,Fe,$e,...$s],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 Ut(e,r,i){let l=r||"pages";if(e)return{root:e,pagesDir:l};let s=i||process.cwd(),c=j.join(s,"resources","views"),d=j.join(s,"resources","layouts");if(Q.existsSync(c)&&Q.existsSync(d))return{root:"resources",pagesDir:"views"};let p=j.join(s,"resources","views","pages");if(Q.existsSync(p))return{root:"resources/views",pagesDir:l};return{root:".",pagesDir:l}}var et=new Set,ue=["partialsDir","componentsDir","layoutsDir"],Se=new WeakMap;function Bt(e,r){let i=r.replace(/[\\/]+$/,"");if(!i||i===".")return!0;let l=e.replace(/\\/g,"/"),s=i.replace(/\\/g,"/");return l===s||l.startsWith(`${s}/`)}function Al(e,r){let i=!e.root,l=Ut(e.root,e.pagesDir,r);if(e.root=l.root,e.pagesDir=l.pagesDir,i&&l.root!=="."){let s=`${r}::${l.root}`;if(!et.has(s))et.add(s),console.warn(`[stx] No "root" in config \u2014 inferred "${l.root}" from the project layout. Template directories are resolved under it; set root explicitly to pin this.`)}if(!Se.has(e)){let s={};for(let c of ue){let d=e[c];if(typeof d==="string"&&d)s[c]=d}Se.set(e,s)}if(e.root&&e.root!=="."){let s=e.root;for(let c of ue){let d=e[c];if(typeof d!=="string"||!d)continue;if(j.isAbsolute(d)||Bt(d,s))continue;e[c]=j.join(s,d)}}for(let s of ue){let c=e[s];if(typeof c!=="string"||!c||j.isAbsolute(c))continue;e[s]=j.resolve(r,c)}return e}function Jt(e,r){let i=Se.get(e);for(let l of ue){let s=e[l];if(typeof s!=="string"||!s)continue;let c=j.isAbsolute(s)?s:j.join(r,s);if(Q.existsSync(c))continue;let d=i?.[l]??s,p=e.root,u=!!p&&p!==".";console.warn(`[stx] ${String(l)} resolves to "${c}", which does not exist. Configured as "${d}"`+(u?`, resolved under root "${p}".`:"."))}}function Kt(e){if(e.customDirectives)e.customDirectives=[...e.customDirectives];if(e.middleware)e.middleware=[...e.middleware];if(e.apiRoutes)e.apiRoutes={...e.apiRoutes}}function Gt(e){if(Ea(e.stateDir),e.stateDir=nr(),e.cachePath=rr(e.cachePath),e.build)e.build.cacheDir=rr(e.build.cacheDir);if(e.media?.cache)e.media.cache.directory=rr(e.media.cache.directory);if(e.story)e.story.outDir=rr(e.story.outDir)}var K=null,Y=new Map,de=new Map,se=null;async function fo(e,r=Ht){try{return await r(e)}catch(i){if(i instanceof Error&&i.name==="ConfigNotFoundError")return{config:e.defaultConfig};throw i}}async function o(e){let r=e?j.resolve(e):process.cwd(),i=de.get(r);if(i&&i.signature!==Kr(i.graph)){let c=Y.get(r);if(Y.delete(r),de.delete(r),!e)K=null,se=null;let{clearComponentCache:d}=await import("./chunk-qmqavdz2.js"),{partialsCache:p}=await import("./chunk-0mwdq478.js");if(d(),p.clear(),c&&i.configSignature===Xr(i.graph)){let u=c.then(async(g)=>{let y={...i.graph};await mo(y,r),de.set(r,{graph:y,signature:Kr(y),configSignature:Xr(y)});let h={...g,_layerGraph:y};if(!e)K=h;return h});return Y.set(r,u),u}}if(!e){if(K)return K;if(se)return se}let l=Y.get(r);if(l)return l;let s=(async()=>{let c=[".ts",".js",".mjs",".cjs",".json"],d=c.some((v)=>Q.existsSync(j.join(r,`stx.config${v}`))),p=c.some((v)=>Q.existsSync(j.join(r,"config",`ui${v}`))),u;if(d&&p){let v=await fo({name:"ui",cwd:j.join(r,"config"),defaultConfig:N,errorPolicy:"throw",verbose:!1});u=(await fo({name:"stx",alias:"ui",cwd:r,defaultConfig:v.config,errorPolicy:"throw",verbose:!1})).config}else u=(await fo({name:"stx",alias:"ui",cwd:r,defaultConfig:N,errorPolicy:"throw",verbose:!1})).config;if(u.extends!==void 0||i){let v=await wa(r,N);u=v.config,de.set(r,{graph:v.graph,signature:Kr(v.graph),configSignature:Xr(v.graph)})}if(u.runtimeConfig){let{resolveRuntimeConfig:v}=await import("./chunk-ttemwrbx.js");v(u.runtimeConfig,{});let{generateRuntimeConfigTypes:b}=await import("./chunk-qy9m6qdn.js");await b(r,u.runtimeConfig)}Kt(u),Gt(u),Al(u,r),Jt(u,r);let g=[],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{f.resolve(b,{paths:[r]}),g.push(b)}catch{}}let h=[...u.plugins??[],...g];if(h.length>0){let{pluginManager:v}=await import("./chunk-j8g5cvvm.js"),b=[],x=[];for(let P of h){let S=typeof P==="string"?P:P[0],A=typeof P==="string"?{}:P[1]||{};try{let k,E;try{let w=f.resolve(S,{paths:[r]});k=await import(w),E=j.dirname(w)}catch{let w=j.resolve(r,S);k=await import(w),E=j.dirname(w)}let I=k.default||k;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(j.resolve(E,C))}if(I.pages){let w=j.resolve(E,I.pages),C=A.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(A,w)}process.stderr.write(`[stx] Plugin loaded: ${I.name||S}
1311
+ `)}catch(k){console.warn(`[stx] Failed to load plugin ${S}:`,k.message)}}u._pluginComponentDirs=b,u._pluginPageDirs=x}return u})();if(Y.set(r,s),s.catch(()=>{if(Y.get(r)===s)Y.delete(r)}),!e)se=s,s.then((c)=>{K=c}).catch(()=>{});return s}var R=new Proxy(N,{get(e,r){if(K&&r in K)return K[r];if(!se)o().catch((i)=>{console.warn("[stx] Failed to load config file:",i?.message||i)});return e[r]}});function Sp(e){return e}function kp(e){let r=[],i=[];if(e.partialsDir!==void 0&&typeof e.partialsDir!=="string")r.push({path:"partialsDir",message:"partialsDir must be a string",severity:"error"});if(e.componentsDir!==void 0&&typeof e.componentsDir!=="string")r.push({path:"componentsDir",message:"componentsDir must be a string",severity:"error"});if(e.cache!==void 0&&typeof e.cache!=="boolean")r.push({path:"cache",message:"cache must be a boolean",severity:"error"});if(e.debug!==void 0&&typeof e.debug!=="boolean")r.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)r.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)r.push({path:"streaming.timeout",message:"streaming.timeout must be a positive number",severity:"error"})}if(e.streaming.strategy!==void 0){let l=["auto","manual","sections"];if(!l.includes(e.streaming.strategy))r.push({path:"streaming.strategy",message:`streaming.strategy must be one of: ${l.join(", ")}`,severity:"error"})}}if(e.i18n){if(e.i18n.format!==void 0){let l=["json","yaml","yml","js"];if(!l.includes(e.i18n.format))r.push({path:"i18n.format",message:`i18n.format must be one of: ${l.join(", ")}`,severity:"error"})}}if(e.animation){if(e.animation.defaultDuration!==void 0){if(typeof e.animation.defaultDuration!=="number"||e.animation.defaultDuration<0)r.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)r.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 l=["AA","AAA"];if(!l.includes(e.a11y.level))r.push({path:"a11y.level",message:`a11y.level must be one of: ${l.join(", ")}`,severity:"error"})}}if(e.hydration){if(e.hydration.mode!==void 0){let l=["progressive","islands"];if(!l.includes(e.hydration.mode))r.push({path:"hydration.mode",message:`hydration.mode must be one of: ${l.join(", ")}`,severity:"error"})}if(e.hydration.preload!==void 0){let l=["none","eager","lazy"];if(!l.includes(e.hydration.preload))r.push({path:"hydration.preload",message:`hydration.preload must be one of: ${l.join(", ")}`,severity:"error"})}}if(e.customDirectives)if(!Array.isArray(e.customDirectives))r.push({path:"customDirectives",message:"customDirectives must be an array",severity:"error"});else e.customDirectives.forEach((l,s)=>{if(!l.name||typeof l.name!=="string")r.push({path:`customDirectives[${s}].name`,message:"Custom directive must have a name string",severity:"error"});if(!l.handler||typeof l.handler!=="function")r.push({path:`customDirectives[${s}].handler`,message:"Custom directive must have a handler function",severity:"error"})});if(e.middleware)if(!Array.isArray(e.middleware))r.push({path:"middleware",message:"middleware must be an array",severity:"error"});else e.middleware.forEach((l,s)=>{if(!l.name||typeof l.name!=="string")r.push({path:`middleware[${s}].name`,message:"Middleware must have a name string",severity:"error"});if(!l.handler||typeof l.handler!=="function")r.push({path:`middleware[${s}].handler`,message:"Middleware must have a handler function",severity:"error"});if(!l.timing||!["before","after"].includes(l.timing))r.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)r.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 l=["fullscreen","standalone","minimal-ui","browser"];if(!l.includes(e.pwa.manifest.display))r.push({path:"pwa.manifest.display",message:`PWA display must be one of: ${l.join(", ")}`,severity:"error"})}if(e.pwa.manifest?.orientation!==void 0){let l=["portrait","landscape","any","portrait-primary","portrait-secondary","landscape-primary","landscape-secondary"];if(!l.includes(e.pwa.manifest.orientation))r.push({path:"pwa.manifest.orientation",message:`PWA orientation must be one of: ${l.join(", ")}`,severity:"error"})}if(e.pwa.routes){let l=["cache-first","network-first","stale-while-revalidate","network-only","cache-only"];e.pwa.routes.forEach((s,c)=>{if(!s.pattern||typeof s.pattern!=="string")r.push({path:`pwa.routes[${c}].pattern`,message:"PWA route must have a pattern string",severity:"error"});if(!l.includes(s.strategy))r.push({path:`pwa.routes[${c}].strategy`,message:`PWA route strategy must be one of: ${l.join(", ")}`,severity:"error"});if(s.maxAgeSeconds!==void 0&&(typeof s.maxAgeSeconds!=="number"||s.maxAgeSeconds<0))r.push({path:`pwa.routes[${c}].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))r.push({path:`pwa.routes[${c}].maxEntries`,message:"PWA route maxEntries must be a positive number",severity:"error"})})}if(e.pwa.icons?.sizes){if(!Array.isArray(e.pwa.icons.sizes))r.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)r.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be numbers between 16 and 1024",severity:"error"})}if(e.pwa.icons?.purpose){let l=["any","maskable","monochrome"];if(e.pwa.icons.purpose.filter((c)=>!l.includes(c)).length>0)r.push({path:"pwa.icons.purpose",message:`PWA icon purpose must be one of: ${l.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:r.length===0,errors:r,warnings:i}}
1312
+ export{da,pa,Zn,Xe,fa,Gr,N,Al,fo,o,R,Sp,kp};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Ru}from"./chunk-sqn3y9qt.js";import"./chunk-bawq4fqy.js";import"./chunk-hz4x7h0n.js";import"./chunk-twqzn21x.js";import"./chunk-srq9fqq8.js";import"./chunk-rym0309c.js";import"./chunk-7adznted.js";import"./chunk-am2w363p.js";import"./chunk-5qtthtg3.js";import"./chunk-4s8zacxg.js";import"./chunk-f9zyf9n6.js";import"./chunk-mwnhdsbp.js";import"./chunk-25zmy8q6.js";import"./chunk-bsajk82t.js";import"./chunk-ce6zddpf.js";import"./chunk-zp79zkkd.js";export{Ru as startProductionServer};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- var w={black:"\x1B[30m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m",white:"\x1B[37m",gray:"\x1B[90m",brightRed:"\x1B[91m",brightGreen:"\x1B[92m",brightYellow:"\x1B[93m",brightBlue:"\x1B[94m",brightMagenta:"\x1B[95m",brightCyan:"\x1B[96m",brightWhite:"\x1B[97m"},R={bold:"\x1B[1m",dim:"\x1B[2m",italic:"\x1B[3m",underline:"\x1B[4m",inverse:"\x1B[7m",strikethrough:"\x1B[9m"};function p(e,t){return`${w[t]}${e}\x1B[0m`}function C(e,t){return`${R[t]}${e}\x1B[0m`}var b=(e)=>p(e,"red"),S=(e)=>p(e,"green"),y=(e)=>p(e,"yellow"),O=(e)=>p(e,"blue");var c=(e)=>p(e,"cyan");var a=(e)=>C(e,"bold"),m=(e)=>C(e,"dim");function Bt(){console.log(""),console.log(c(" \u2554\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2557")),console.log(c(" \u2551")+a(" \uD83D\uDCD6 STX Story ")+c("\u2551")),console.log(c(" \u2551")+m(" Component Showcase & Testing ")+c("\u2551")),console.log(c(" \u255A\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255D")),console.log("")}function $s(e,t){if(console.log(a(" Server running at:")),console.log(""),console.log(` ${m("\u279C")} ${a("Local:")} ${c(e)}`),t)console.log(` ${m("\u279C")} ${a("Network:")} ${c(t)}`);console.log("")}function Ft(e){let t=e>0?"\u2713":"\u25CB",r=e>0?S:y;console.log(` ${r(t)} Found ${a(String(e))} story ${e===1?"file":"files"}`)}function ai(e,t){if(console.log(""),console.log(` ${b("\u2717")} ${a(b("Error:"))} ${e}`),t)console.log(` ${m(t)}`);console.log("")}function ot(e){console.log(` ${y("\u26A0")} ${y("Warning:")} ${e}`)}function ci(e){console.log(` ${O("\u2139")} ${e}`)}function li(e,t,r){console.log(""),console.log(c(" \u2554\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2557")),console.log(c(" \u2551")+a(" Build Complete ")+c("\u2551")),console.log(c(" \u255A\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255D")),console.log(""),console.log(` ${S("\u2713")} Stories: ${a(String(e))}`),console.log(` ${S("\u2713")} Output: ${a(t)}`),console.log(` ${S("\u2713")} Time: ${a(`${r}ms`)}`),console.log("")}function Rs(){console.log(""),console.log(a(" Keyboard Shortcuts:")),console.log(""),console.log(` ${c("h")} Show this help`),console.log(` ${c("o")} Open in browser`),console.log(` ${c("r")} Restart server`),console.log(` ${c("c")} Clear console`),console.log(` ${c("q")} Quit`),console.log("")}import h from"fs";import d from"path";async function zt(e){let{root:t,config:r}=e,o=[],i=await P(t,r.storyMatch,r.storyIgnored);for(let s of i){let n=d.resolve(t,s),l=v(s,n);o.push(l)}return o}async function P(e,t,r){let o=[];async function i(s,n){let l=await h.promises.readdir(s,{withFileTypes:!0});for(let g of l){let f=d.join(s,g.name),u=d.relative(n,f);if(T(u,r))continue;if(g.isDirectory())await i(f,n);else if(g.isFile()){if(F(u,t))o.push(u)}}}return await i(e,e),o}function T(e,t){for(let r of t)if(E(e,r))return!0;return!1}function F(e,t){for(let r of t)if(E(e,r))return!0;return!1}function E(e,t){let r=e.replace(/\\/g,"/"),i=t.replace(/\\/g,"/").replace(/[.+^${}()|[\]\\]/g,"\\$&").replace(/\*\*/g,"{{GLOBSTAR}}").replace(/\*/g,"[^/]*").replace(/\?/g,".").replace(/\{\{GLOBSTAR\}\}/g,".*");return i=`^${i}$`,new RegExp(i).test(r)}function v(e,t){let r=d.basename(e,".story.stx");return{id:e.toLowerCase().replace(/\.story\.stx$/,"").replace(/[/\\]/g,"-").replace(/[^a-z0-9-]/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,""),path:t,relativePath:e,fileName:r,treeFile:{title:r,path:e}}}function ui(e,t){let{root:r,config:o}=e,i=[],s=h.watch(r,{recursive:!0},async(n,l)=>{if(!l)return;let g=l.replace(/\\/g,"/");if(!F(g,o.storyMatch))return;if(T(g,o.storyIgnored))return;let f=d.resolve(r,g);try{await h.promises.access(f);let u=v(g,f);t(n==="rename"?"add":"change",u)}catch{let u=v(g,f);t("unlink",u)}});return i.push(s),()=>{for(let n of i)n.close()}}function N(e,t){let r=t.treeFile||{title:t.fileName,path:t.relativePath};if(e.tree.file==="title")return r.title.split("/");if(e.tree.file==="path")return[...t.relativePath.split("/").slice(0,-1),r.title];if(typeof e.tree.file==="function")return e.tree.file(r);return[r.title]}function Ht(e,t){for(let n of t)n.treePath=N(e,n);let r=(e.tree.groups||[]).map((n)=>({groupConfig:{id:n.id||n.title,title:n.title,include:n.include},treeObject:{}})),o={treeObject:{}};r.push(o);for(let n=0;n<t.length;n++){let l=t[n],g=j(l,r,o);k(l.treePath,n,g.treeObject)}let i=e.tree.order==="asc"?(n,l)=>n.localeCompare(l):e.tree.order,s=[];for(let n of r)if(n===o)s.push(...x(n.treeObject,i));else if(n.groupConfig&&Object.keys(n.treeObject).length>0)s.push({group:!0,id:n.groupConfig.id,title:n.groupConfig.title,children:x(n.treeObject,i)});return s}function j(e,t,r){let o=e.treeFile||{title:e.fileName,path:e.relativePath};for(let i of t)if(i.groupConfig?.include&&i.groupConfig.include(o))return i;return r}function k(e,t,r){let o=r;for(let i=0;i<e.length;i++){let s=e[i];if(i===e.length-1)if(o[s]!==void 0){let l=1;while(o[`${s}-${l}`]!==void 0)l++;o[`${s}-${l}`]=t}else o[s]=t;else{if(o[s]===void 0)o[s]={};else if(typeof o[s]==="number"){let l=o[s];o[s]={"":l}}o=o[s]}}}function x(e,t){let r=[];for(let[o,i]of Object.entries(e))if(typeof i==="number")r.push({title:o,index:i});else r.push({title:o,children:x(i,t)});return r.sort((o,i)=>t(o.title,i.title)),r}
3
- export{Bt,$s,Ft,ai,ot,ci,li,Rs,zt,ui,Ht};
2
+ var w={black:"\x1B[30m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m",white:"\x1B[37m",gray:"\x1B[90m",brightRed:"\x1B[91m",brightGreen:"\x1B[92m",brightYellow:"\x1B[93m",brightBlue:"\x1B[94m",brightMagenta:"\x1B[95m",brightCyan:"\x1B[96m",brightWhite:"\x1B[97m"},R={bold:"\x1B[1m",dim:"\x1B[2m",italic:"\x1B[3m",underline:"\x1B[4m",inverse:"\x1B[7m",strikethrough:"\x1B[9m"};function p(e,t){return`${w[t]}${e}\x1B[0m`}function C(e,t){return`${R[t]}${e}\x1B[0m`}var b=(e)=>p(e,"red"),S=(e)=>p(e,"green"),y=(e)=>p(e,"yellow"),O=(e)=>p(e,"blue");var c=(e)=>p(e,"cyan");var a=(e)=>C(e,"bold"),m=(e)=>C(e,"dim");function Bt(){console.log(""),console.log(c(" \u2554\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2557")),console.log(c(" \u2551")+a(" \uD83D\uDCD6 STX Story ")+c("\u2551")),console.log(c(" \u2551")+m(" Component Showcase & Testing ")+c("\u2551")),console.log(c(" \u255A\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255D")),console.log("")}function Rs(e,t){if(console.log(a(" Server running at:")),console.log(""),console.log(` ${m("\u279C")} ${a("Local:")} ${c(e)}`),t)console.log(` ${m("\u279C")} ${a("Network:")} ${c(t)}`);console.log("")}function Ft(e){let t=e>0?"\u2713":"\u25CB",r=e>0?S:y;console.log(` ${r(t)} Found ${a(String(e))} story ${e===1?"file":"files"}`)}function ci(e,t){if(console.log(""),console.log(` ${b("\u2717")} ${a(b("Error:"))} ${e}`),t)console.log(` ${m(t)}`);console.log("")}function ot(e){console.log(` ${y("\u26A0")} ${y("Warning:")} ${e}`)}function li(e){console.log(` ${O("\u2139")} ${e}`)}function ui(e,t,r){console.log(""),console.log(c(" \u2554\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2557")),console.log(c(" \u2551")+a(" Build Complete ")+c("\u2551")),console.log(c(" \u255A\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255D")),console.log(""),console.log(` ${S("\u2713")} Stories: ${a(String(e))}`),console.log(` ${S("\u2713")} Output: ${a(t)}`),console.log(` ${S("\u2713")} Time: ${a(`${r}ms`)}`),console.log("")}function As(){console.log(""),console.log(a(" Keyboard Shortcuts:")),console.log(""),console.log(` ${c("h")} Show this help`),console.log(` ${c("o")} Open in browser`),console.log(` ${c("r")} Restart server`),console.log(` ${c("c")} Clear console`),console.log(` ${c("q")} Quit`),console.log("")}import h from"fs";import d from"path";async function zt(e){let{root:t,config:r}=e,o=[],i=await P(t,r.storyMatch,r.storyIgnored);for(let s of i){let n=d.resolve(t,s),l=v(s,n);o.push(l)}return o}async function P(e,t,r){let o=[];async function i(s,n){let l=await h.promises.readdir(s,{withFileTypes:!0});for(let g of l){let f=d.join(s,g.name),u=d.relative(n,f);if(T(u,r))continue;if(g.isDirectory())await i(f,n);else if(g.isFile()){if(F(u,t))o.push(u)}}}return await i(e,e),o}function T(e,t){for(let r of t)if(E(e,r))return!0;return!1}function F(e,t){for(let r of t)if(E(e,r))return!0;return!1}function E(e,t){let r=e.replace(/\\/g,"/"),i=t.replace(/\\/g,"/").replace(/[.+^${}()|[\]\\]/g,"\\$&").replace(/\*\*/g,"{{GLOBSTAR}}").replace(/\*/g,"[^/]*").replace(/\?/g,".").replace(/\{\{GLOBSTAR\}\}/g,".*");return i=`^${i}$`,new RegExp(i).test(r)}function v(e,t){let r=d.basename(e,".story.stx");return{id:e.toLowerCase().replace(/\.story\.stx$/,"").replace(/[/\\]/g,"-").replace(/[^a-z0-9-]/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,""),path:t,relativePath:e,fileName:r,treeFile:{title:r,path:e}}}function di(e,t){let{root:r,config:o}=e,i=[],s=h.watch(r,{recursive:!0},async(n,l)=>{if(!l)return;let g=l.replace(/\\/g,"/");if(!F(g,o.storyMatch))return;if(T(g,o.storyIgnored))return;let f=d.resolve(r,g);try{await h.promises.access(f);let u=v(g,f);t(n==="rename"?"add":"change",u)}catch{let u=v(g,f);t("unlink",u)}});return i.push(s),()=>{for(let n of i)n.close()}}function N(e,t){let r=t.treeFile||{title:t.fileName,path:t.relativePath};if(e.tree.file==="title")return r.title.split("/");if(e.tree.file==="path")return[...t.relativePath.split("/").slice(0,-1),r.title];if(typeof e.tree.file==="function")return e.tree.file(r);return[r.title]}function Ht(e,t){for(let n of t)n.treePath=N(e,n);let r=(e.tree.groups||[]).map((n)=>({groupConfig:{id:n.id||n.title,title:n.title,include:n.include},treeObject:{}})),o={treeObject:{}};r.push(o);for(let n=0;n<t.length;n++){let l=t[n],g=j(l,r,o);k(l.treePath,n,g.treeObject)}let i=e.tree.order==="asc"?(n,l)=>n.localeCompare(l):e.tree.order,s=[];for(let n of r)if(n===o)s.push(...x(n.treeObject,i));else if(n.groupConfig&&Object.keys(n.treeObject).length>0)s.push({group:!0,id:n.groupConfig.id,title:n.groupConfig.title,children:x(n.treeObject,i)});return s}function j(e,t,r){let o=e.treeFile||{title:e.fileName,path:e.relativePath};for(let i of t)if(i.groupConfig?.include&&i.groupConfig.include(o))return i;return r}function k(e,t,r){let o=r;for(let i=0;i<e.length;i++){let s=e[i];if(i===e.length-1)if(o[s]!==void 0){let l=1;while(o[`${s}-${l}`]!==void 0)l++;o[`${s}-${l}`]=t}else o[s]=t;else{if(o[s]===void 0)o[s]={};else if(typeof o[s]==="number"){let l=o[s];o[s]={"":l}}o=o[s]}}}function x(e,t){let r=[];for(let[o,i]of Object.entries(e))if(typeof i==="number")r.push({title:o,index:i});else r.push({title:o,children:x(i,t)});return r.sort((o,i)=>t(o.title,i.title)),r}
3
+ export{Bt,Rs,Ft,ci,ot,li,ui,As,zt,di,Ht};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- var f=null,D=[],v=0,g=new Set;function x(){return f}function S(e){let n=f;return D.push(e),f=e,n}function h(e){D.pop(),f=e}var A=new WeakMap;function w(e,n){A.set(e,n)}function p(e,n){for(let r of e){let i=A.get(r);if(i)i(n);else n.add(r)}}function b(e){if(v>0){p(e,g);return}let n=new Set;p(e,n);for(let r of n)r()}function C(e){v++;try{e()}finally{if(v--,v===0){let n=[...g];g.clear();for(let r of n)r()}}}function m(e){let n=f;f=null;try{return e()}finally{f=n}}var k=[],T=[];function oe(e){let n=e,r=new Set,i=new Set,o=()=>{let t=x();if(t)i.add(t);return n};return o.set=(t)=>{if(!Object.is(t,n)){let c=n;n=t,r.forEach((u)=>{try{u(n,c)}catch(l){console.error("[stx] subscriber error:",l)}}),b(i)}},o.update=(t)=>{o.set(t(n))},o.subscribe=(t)=>(r.add(t),()=>r.delete(t)),Object.defineProperty(o,"_isSignal",{value:!0,writable:!1}),Object.defineProperty(o,"value",{get:()=>o(),set:(t)=>o.set(t),configurable:!0}),o}function Nn(e,n={}){let r,i=!0,o=!1,t=new Set,c=typeof n.equals==="function"?n.equals:null,u=()=>{let s=S(d);try{r=e(),o=!0}finally{h(s)}i=!1},l=()=>{let s=r,y=o;try{u()}catch{return i=!0,!0}return!y||!c(s,r)},d=()=>{if(i)return;if(c&&t.size){if(l())b(t);return}i=!0,b(t)};w(d,(s)=>{if(i)return;if(c&&t.size){if(l())p(t,s);return}i=!0,p(t,s)});let a=()=>{let s=x();if(s)t.add(s);if(i)u();return r};return Object.defineProperty(a,"_isDerived",{value:!0,writable:!1}),Object.defineProperty(a,"value",{get:()=>a(),configurable:!0}),a}function Ud(e,n=Object.is){return Nn(e,{equals:n})}function Dn(e,n={}){let r,i=!1,o=()=>{if(i)return;if(r){let c=r;r=void 0;try{c()}catch(u){console.error("[stx] effect cleanup error:",u)}}let t=S(o);try{let c=e();r=typeof c==="function"?c:void 0}catch(c){i=!0,console.error("[stx] effect error (the effect is disposed):",c)}finally{h(t)}};if(n.immediate!==!1)o();return()=>{if(i=!0,r){let t=r;r=void 0,t()}}}function Hs(e){C(e)}function Pr(e){k.push(e)}function Ir(e){T.push(e)}function Wd(){O(k,"onMount",T)}function qd(){O(T,"onDestroy")}function O(e,n,r){let i=e.splice(0,e.length);for(let o of i)try{let t=o();if(r&&typeof t==="function")r.push(t)}catch(t){console.error(`[stx] ${n} callback threw:`,t)}}function Gd(){return{mount:k.length,destroy:T.length}}function Mn(e){return typeof e==="function"&&e._isSignal===!0}function Ln(e){return typeof e==="function"&&e._isDerived===!0}function Vs(e){if(Mn(e)||Ln(e))return m(()=>e());return e}function Or(e){return m(e)}function Kd(e,n){let r=typeof e==="function"?e:()=>e,i=oe([]),o=Nn(()=>i().reduce((u,l)=>n(u,l.action),r())),t=!1;return Dn(()=>{if(r(),!t){t=!0;return}if(Or(()=>i().length))i.set([])}),[o,(u,l)=>{let d={action:u};i.set([...i(),d]);let a=()=>{let s=i().filter((y)=>y!==d);if(s.length!==i().length)i.set(s)};if(l&&typeof l.then==="function")Promise.resolve(l).then(a,a);return a}]}
3
- export{oe,Nn,Ud,Dn,Hs,Pr,Ir,Wd,qd,Gd,Mn,Ln,Vs,Or,Kd};
2
+ var f=null,D=[],v=0,g=new Set;function x(){return f}function S(e){let n=f;return D.push(e),f=e,n}function h(e){D.pop(),f=e}var A=new WeakMap;function w(e,n){A.set(e,n)}function p(e,n){for(let r of e){let i=A.get(r);if(i)i(n);else n.add(r)}}function b(e){if(v>0){p(e,g);return}let n=new Set;p(e,n);for(let r of n)r()}function C(e){v++;try{e()}finally{if(v--,v===0){let n=[...g];g.clear();for(let r of n)r()}}}function m(e){let n=f;f=null;try{return e()}finally{f=n}}var k=[],T=[];function ae(e){let n=e,r=new Set,i=new Set,o=()=>{let t=x();if(t)i.add(t);return n};return o.set=(t)=>{if(!Object.is(t,n)){let c=n;n=t,r.forEach((u)=>{try{u(n,c)}catch(l){console.error("[stx] subscriber error:",l)}}),b(i)}},o.update=(t)=>{o.set(t(n))},o.subscribe=(t)=>(r.add(t),()=>r.delete(t)),Object.defineProperty(o,"_isSignal",{value:!0,writable:!1}),Object.defineProperty(o,"value",{get:()=>o(),set:(t)=>o.set(t),configurable:!0}),o}function Nn(e,n={}){let r,i=!0,o=!1,t=new Set,c=typeof n.equals==="function"?n.equals:null,u=()=>{let s=S(d);try{r=e(),o=!0}finally{h(s)}i=!1},l=()=>{let s=r,y=o;try{u()}catch{return i=!0,!0}return!y||!c(s,r)},d=()=>{if(i)return;if(c&&t.size){if(l())b(t);return}i=!0,b(t)};w(d,(s)=>{if(i)return;if(c&&t.size){if(l())p(t,s);return}i=!0,p(t,s)});let a=()=>{let s=x();if(s)t.add(s);if(i)u();return r};return Object.defineProperty(a,"_isDerived",{value:!0,writable:!1}),Object.defineProperty(a,"value",{get:()=>a(),configurable:!0}),a}function Wd(e,n=Object.is){return Nn(e,{equals:n})}function Dn(e,n={}){let r,i=!1,o=()=>{if(i)return;if(r){let c=r;r=void 0;try{c()}catch(u){console.error("[stx] effect cleanup error:",u)}}let t=S(o);try{let c=e();r=typeof c==="function"?c:void 0}catch(c){i=!0,console.error("[stx] effect error (the effect is disposed):",c)}finally{h(t)}};if(n.immediate!==!1)o();return()=>{if(i=!0,r){let t=r;r=void 0,t()}}}function Vs(e){C(e)}function Ir(e){k.push(e)}function Or(e){T.push(e)}function qd(){O(k,"onMount",T)}function Gd(){O(T,"onDestroy")}function O(e,n,r){let i=e.splice(0,e.length);for(let o of i)try{let t=o();if(r&&typeof t==="function")r.push(t)}catch(t){console.error(`[stx] ${n} callback threw:`,t)}}function Kd(){return{mount:k.length,destroy:T.length}}function Mn(e){return typeof e==="function"&&e._isSignal===!0}function Ln(e){return typeof e==="function"&&e._isDerived===!0}function Us(e){if(Mn(e)||Ln(e))return m(()=>e());return e}function Nr(e){return m(e)}function Xd(e,n){let r=typeof e==="function"?e:()=>e,i=ae([]),o=Nn(()=>i().reduce((u,l)=>n(u,l.action),r())),t=!1;return Dn(()=>{if(r(),!t){t=!0;return}if(Nr(()=>i().length))i.set([])}),[o,(u,l)=>{let d={action:u};i.set([...i(),d]);let a=()=>{let s=i().filter((y)=>y!==d);if(s.length!==i().length)i.set(s)};if(l&&typeof l.then==="function")Promise.resolve(l).then(a,a);return a}]}
3
+ export{ae,Nn,Wd,Dn,Vs,Ir,Or,qd,Gd,Kd,Mn,Ln,Us,Nr,Xd};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Lu}from"./chunk-vdxg7e1y.js";import"./chunk-bawq4fqy.js";import"./chunk-9dtbvjpp.js";import"./chunk-hz4x7h0n.js";import"./chunk-aet1pgw7.js";import"./chunk-kdebh22m.js";import"./chunk-rr527jt6.js";import"./chunk-xcsyqwxf.js";import"./chunk-bkkpq8dx.js";import"./chunk-7j1zgrnf.js";import"./chunk-v6peecfp.js";import"./chunk-40tswfe7.js";import"./chunk-twqzn21x.js";import"./chunk-hgry3mjd.js";import"./chunk-4b9s7wgy.js";import"./chunk-srq9fqq8.js";import"./chunk-rym0309c.js";import"./chunk-7adznted.js";import"./chunk-am2w363p.js";import"./chunk-5qtthtg3.js";import"./chunk-4s8zacxg.js";import"./chunk-f9zyf9n6.js";import"./chunk-mwnhdsbp.js";import"./chunk-25zmy8q6.js";import"./chunk-bsajk82t.js";import"./chunk-ce6zddpf.js";import"./chunk-zp79zkkd.js";export{Lu as buildForProduction};
@@ -0,0 +1,3 @@
1
+ // @bun
2
+ import{Ve,te,Ji}from"./chunk-a4p18ybc.js";import v from"fs";import g from"path";import V from"crypto";import{generatePlaceholder as T,processImage as L}from"ts-images";var Y=[320,640,768,1024,1280,1536,1920],Z=["webp","jpeg"],Q=80,D=[".jpg",".jpeg",".png",".webp",".avif",".gif",".svg"],U={webp:"image/webp",avif:"image/avif",jpeg:"image/jpeg",png:"image/png"},I=null,M=!1;async function d(){if(M)return I;M=!0;try{let t=await import("sharp");return I=t.default||t,I}catch{return null}}async function Cn(){return await d()!==null}async function fe(){return!0}async function _e(t,e={}){let{widths:a=Y,formats:r=Z,quality:n=Q,fit:c="cover",placeholder:i="none",outputDir:m=".stx/images",baseUrl:s="/images"}=e,h,l;if(typeof t==="string"){if(l=t,!await Bun.file(t).exists())throw new Pr(`Image not found: ${t}`,"NOT_FOUND");h=await Bun.file(t).arrayBuffer().then((o)=>Buffer.from(o))}else l="buffer-input",h=t;let b=V.createHash("sha256").update(h).digest("hex").slice(0,12),j=await Ar(h),{width:u,height:x}=j,F=u/x;await v.promises.mkdir(m,{recursive:!0});let B=[],A=g.basename(l,g.extname(l)),f=a.filter((o)=>o<=u);if(!f.includes(u)&&u<=Math.max(...a))f.push(u);f.sort((o,p)=>o-p);for(let o of f){let p=Math.round(o/F);for(let w of r){let S=`${A}-${o}w-${b}.${w}`,P=g.join(m,S),q=`${s}/${S}`,E=await zc(h,{width:o,height:p,format:w,quality:n,fit:c});await Bun.write(P,E),B.push({path:P,url:q,width:o,height:p,format:w,size:E.length})}}let y;if(i!=="none")y=await k(h,i);return{src:l,variants:B,placeholder:y,width:u,height:x,aspectRatio:F,hash:b}}async function Ar(t){let e=typeof t==="string"?Buffer.from(await Bun.file(t).arrayBuffer()):t,a=await d();if(a){let n=await a(e).metadata();return{width:n.width||0,height:n.height||0,format:n.format||"unknown",hasAlpha:n.hasAlpha}}return R(e)}function R(t){if(t[0]===137&&t[1]===80&&t[2]===78&&t[3]===71){let e=t.readUInt32BE(16),a=t.readUInt32BE(20);return{width:e,height:a,format:"png",hasAlpha:!0}}if(t[0]===255&&t[1]===216){let e=2;while(e<t.length){if(t[e]!==255)break;let a=t[e+1];if(a>=192&&a<=207&&a!==196&&a!==200&&a!==204){let n=t.readUInt16BE(e+5);return{width:t.readUInt16BE(e+7),height:n,format:"jpeg",hasAlpha:!1}}let r=t.readUInt16BE(e+2);e+=2+r}}if(t.toString("utf8",0,4)==="RIFF"&&t.toString("utf8",8,12)==="WEBP"){let e=t.toString("utf8",12,16);if(e==="VP8 "){let a=t.readUInt16LE(26)&16383,r=t.readUInt16LE(28)&16383;return{width:a,height:r,format:"webp",hasAlpha:!1}}if(e==="VP8L"){let a=t.readUInt32LE(21),r=(a&16383)+1,n=(a>>14&16383)+1;return{width:r,height:n,format:"webp",hasAlpha:!0}}}if(t.toString("utf8",0,3)==="GIF"){let e=t.readUInt16LE(6),a=t.readUInt16LE(8);return{width:e,height:a,format:"gif",hasAlpha:!0}}throw new Pr("Unable to parse image dimensions","PARSE_ERROR")}async function zc(t,e){let a=await d();if(a){let r=a(t).resize(e.width,e.height,{fit:e.fit});switch(e.format){case"webp":r=r.webp({quality:e.quality});break;case"avif":r=r.avif({quality:e.quality});break;case"jpeg":r=r.jpeg({quality:e.quality});break;case"png":r=r.png({quality:e.quality});break}return r.toBuffer()}return await Ji("img",async(r)=>{let n=g.join(r,`out.${e.format}`);return await L({input:t,output:n,format:e.format,quality:e.quality,resize:{width:e.width,height:e.height,fit:e.fit}}),Buffer.from(await Bun.file(n).arrayBuffer())})}async function k(t,e){let a=await d();if(e==="blur"&&a){let m=(await a(t).resize(20).blur(10).toBuffer()).toString("base64"),s=await Ar(t);return`data:${U[s.format]||"image/jpeg"};base64,${m}`}if(e==="dominant-color"&&a){let{dominant:i}=await a(t).resize(1,1).toBuffer().then(async(m)=>{let s=await a(m).metadata();return{dominant:{r:128,g:128,b:128}}}).catch(()=>({dominant:{r:128,g:128,b:128}}));return`rgb(${i.r}, ${i.g}, ${i.b})`}let r=await Ar(t),n=Ve("ph"),c=g.join(n,`in.${r.format==="unknown"?"bin":r.format}`);try{await Bun.write(c,t);let i=e==="blur"?"blur":e==="thumbhash"?"thumbhash":"dominant-color",s=await T(c,{strategy:i,width:i==="thumbhash"?void 0:32});if(e==="dominant-color"&&s.dominantColor)return s.dominantColor;if(s.dataURL)return s.dataURL;return"rgb(128, 128, 128)"}catch{return"rgb(128, 128, 128)"}finally{te(n)}}function dt(t,e){return(e?t.filter((r)=>r.format===e):t).sort((r,n)=>r.width-n.width).map((r)=>`${r.url} ${r.width}w`).join(", ")}function Ut(t){if(!t||Object.keys(t).length===0)return"100vw";return Object.entries(t).sort((a,r)=>{let n=Number.parseInt(a[0].replace(/\D/g,""))||0;return(Number.parseInt(r[0].replace(/\D/g,""))||0)-n}).map(([a,r])=>`(max-width: ${a}) ${r}`).join(", ")+", 100vw"}function En(t){let e=t.filter((r)=>r.format==="jpeg");if(e.length===0)return t[Math.floor(t.length/2)];let a=e.sort((r,n)=>r.width-n.width);return a[Math.floor(a.length/2)]}function Tn(t){let e=new Map;for(let a of t){let r=e.get(a.format)||[];r.push(a),e.set(a.format,r)}return e}function $n(t){let e=g.extname(t).toLowerCase();return D.includes(e)}function ee(t){return U[t]||"application/octet-stream"}function Rn(t){return t.reduce((e,a)=>e+a.size,0)}function An(t){if(t<1024)return`${t} B`;if(t<1048576)return`${(t/1024).toFixed(1)} KB`;return`${(t/1048576).toFixed(2)} MB`}class Pr extends Error{code;constructor(t,e){super(t);this.name="ImageProcessingError",this.code=e}}
3
+ export{Y,Z,Q,Cn,fe,_e,Ar,zc,dt,Ut,En,Tn,$n,ee,Rn,An,Pr};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- function Oi(e){return e}class a{plugins=new Map;sortedPlugins=[];initialized=!1;async register(e,t){if(this.plugins.has(e.name))throw Error(`Plugin "${e.name}" is already registered`);if(e.dependencies){for(let r of e.dependencies)if(!this.plugins.has(r))throw Error(`Plugin "${e.name}" depends on "${r}" which is not registered`)}if(this.plugins.set(e.name,e),e.onRegister)await e.onRegister(t);this.sortPlugins()}async unregister(e){let t=this.plugins.get(e);if(!t)return!1;for(let[r,i]of this.plugins)if(i.dependencies?.includes(e))throw Error(`Cannot unregister "${e}" because "${r}" depends on it`);if(t.onUnregister)await t.onUnregister();return this.plugins.delete(e),this.sortPlugins(),!0}get(e){return this.plugins.get(e)}has(e){return this.plugins.has(e)}getAll(){return[...this.sortedPlugins]}getAllDirectives(){let e=[];for(let t of this.sortedPlugins)if(t.registerDirectives)e.push(...t.registerDirectives());return e}getAllFilters(){let e={};for(let t of this.sortedPlugins)if(t.registerFilters)Object.assign(e,t.registerFilters());return e}async runBeforeProcess(e){return this.runHooks("beforeProcess",e)}async runAfterParse(e){return this.runHooks("afterParse",e)}async runBeforeDirective(e,t){return this.runDirectiveHooks("beforeDirective",e,t)}async runAfterDirective(e,t){return this.runDirectiveHooks("afterDirective",e,t)}async runBeforeRender(e){return this.runHooks("beforeRender",e)}async runAfterRender(e){return this.runHooks("afterRender",e)}async runOnError(e){for(let t of this.sortedPlugins)if(t.onError)try{let r=await t.onError(e);if(r){if(r.template!==void 0)e.template=r.template;if(r.context)e.context={...e.context,...r.context};if(r.metadata)e.metadata={...e.metadata,...r.metadata};if(r.skip)return e}}catch(r){console.error(`Error in plugin "${t.name}" onError hook:`,r)}return null}sortPlugins(){this.sortedPlugins=Array.from(this.plugins.values()).sort((e,t)=>(e.priority??100)-(t.priority??100))}async runHooks(e,t){let r={...t};for(let i of this.sortedPlugins){let s=i[e];if(s)try{let n=await s(r);if(n){if(n.template!==void 0)r.template=n.template;if(n.context)r.context={...r.context,...n.context};if(n.metadata)r.metadata={...r.metadata,...n.metadata};if(n.skip)break}}catch(n){console.error(`Error in plugin "${i.name}" ${e} hook:`,n)}}return r}async runDirectiveHooks(e,t,r){let i={...r};for(let s of this.sortedPlugins){let n=s[e];if(n)try{let o=await n(t,i);if(o){if(o.template!==void 0)i.template=o.template;if(o.context)i.context={...i.context,...o.context};if(o.metadata)i.metadata={...i.metadata,...o.metadata};if(o.skip)break}}catch(o){console.error(`Error in plugin "${s.name}" ${e} hook:`,o)}}return i}}var Xu=new a;var u=Oi({name:"stx-debug",version:"1.0.0",description:"Logs all plugin lifecycle events for debugging",priority:0,beforeProcess(e){console.log("[stx-debug] beforeProcess:",e.filePath)},afterParse(e){console.log("[stx-debug] afterParse:",e.template.length,"chars")},beforeDirective(e,t){console.log("[stx-debug] beforeDirective:",e)},afterDirective(e,t){console.log("[stx-debug] afterDirective:",e)},beforeRender(e){console.log("[stx-debug] beforeRender")},afterRender(e){console.log("[stx-debug] afterRender:",e.template.length,"chars")},onError(e){console.error("[stx-debug] onError:",e.error.message,"in phase:",e.phase)}}),l=Oi({name:"stx-timing",version:"1.0.0",description:"Measures template processing time",priority:1,beforeProcess(e){e.metadata.startTime=performance.now()},afterRender(e){let t=e.metadata.startTime;if(t){let r=performance.now()-t;console.log(`[stx-timing] Processing took ${r.toFixed(2)}ms`)}}});export{Oi,Xu};
2
+ function Ni(e){return e}class a{plugins=new Map;sortedPlugins=[];initialized=!1;async register(e,t){if(this.plugins.has(e.name))throw Error(`Plugin "${e.name}" is already registered`);if(e.dependencies){for(let r of e.dependencies)if(!this.plugins.has(r))throw Error(`Plugin "${e.name}" depends on "${r}" which is not registered`)}if(this.plugins.set(e.name,e),e.onRegister)await e.onRegister(t);this.sortPlugins()}async unregister(e){let t=this.plugins.get(e);if(!t)return!1;for(let[r,i]of this.plugins)if(i.dependencies?.includes(e))throw Error(`Cannot unregister "${e}" because "${r}" depends on it`);if(t.onUnregister)await t.onUnregister();return this.plugins.delete(e),this.sortPlugins(),!0}get(e){return this.plugins.get(e)}has(e){return this.plugins.has(e)}getAll(){return[...this.sortedPlugins]}getAllDirectives(){let e=[];for(let t of this.sortedPlugins)if(t.registerDirectives)e.push(...t.registerDirectives());return e}getAllFilters(){let e={};for(let t of this.sortedPlugins)if(t.registerFilters)Object.assign(e,t.registerFilters());return e}async runBeforeProcess(e){return this.runHooks("beforeProcess",e)}async runAfterParse(e){return this.runHooks("afterParse",e)}async runBeforeDirective(e,t){return this.runDirectiveHooks("beforeDirective",e,t)}async runAfterDirective(e,t){return this.runDirectiveHooks("afterDirective",e,t)}async runBeforeRender(e){return this.runHooks("beforeRender",e)}async runAfterRender(e){return this.runHooks("afterRender",e)}async runOnError(e){for(let t of this.sortedPlugins)if(t.onError)try{let r=await t.onError(e);if(r){if(r.template!==void 0)e.template=r.template;if(r.context)e.context={...e.context,...r.context};if(r.metadata)e.metadata={...e.metadata,...r.metadata};if(r.skip)return e}}catch(r){console.error(`Error in plugin "${t.name}" onError hook:`,r)}return null}sortPlugins(){this.sortedPlugins=Array.from(this.plugins.values()).sort((e,t)=>(e.priority??100)-(t.priority??100))}async runHooks(e,t){let r={...t};for(let i of this.sortedPlugins){let s=i[e];if(s)try{let n=await s(r);if(n){if(n.template!==void 0)r.template=n.template;if(n.context)r.context={...r.context,...n.context};if(n.metadata)r.metadata={...r.metadata,...n.metadata};if(n.skip)break}}catch(n){console.error(`Error in plugin "${i.name}" ${e} hook:`,n)}}return r}async runDirectiveHooks(e,t,r){let i={...r};for(let s of this.sortedPlugins){let n=s[e];if(n)try{let o=await n(t,i);if(o){if(o.template!==void 0)i.template=o.template;if(o.context)i.context={...i.context,...o.context};if(o.metadata)i.metadata={...i.metadata,...o.metadata};if(o.skip)break}}catch(o){console.error(`Error in plugin "${s.name}" ${e} hook:`,o)}}return i}}var Ju=new a;var u=Ni({name:"stx-debug",version:"1.0.0",description:"Logs all plugin lifecycle events for debugging",priority:0,beforeProcess(e){console.log("[stx-debug] beforeProcess:",e.filePath)},afterParse(e){console.log("[stx-debug] afterParse:",e.template.length,"chars")},beforeDirective(e,t){console.log("[stx-debug] beforeDirective:",e)},afterDirective(e,t){console.log("[stx-debug] afterDirective:",e)},beforeRender(e){console.log("[stx-debug] beforeRender")},afterRender(e){console.log("[stx-debug] afterRender:",e.template.length,"chars")},onError(e){console.error("[stx-debug] onError:",e.error.message,"in phase:",e.phase)}}),l=Ni({name:"stx-timing",version:"1.0.0",description:"Measures template processing time",priority:1,beforeProcess(e){e.metadata.startTime=performance.now()},afterRender(e){let t=e.metadata.startTime;if(t){let r=performance.now()-t;console.log(`[stx-timing] Processing took ${r.toFixed(2)}ms`)}}});export{Ni,Ju};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- var{WebView:p}=globalThis.Bun;import{existsSync as y,mkdirSync as b,readdirSync as v,statSync as S}from"fs";import l from"path";var h=16384;function M(e){if(/^https?:\/\//.test(e)||e.startsWith("file://"))return e;return`file://${l.resolve(e)}`}function g(e,n,t,o){return new Promise((s)=>{let i=!1,r,m,c=()=>{if(!i){if(i=!0,clearTimeout(m),r)clearTimeout(r);e.onNavigated=void 0,s()}};m=setTimeout(c,o),e.onNavigated=()=>{if(!i)r=setTimeout(c,t)};try{let u=e.navigate(n);if(u&&typeof u.catch==="function")u.catch(c)}catch{c()}})}async function w(e,n,t){let o=`!!document.querySelector(${JSON.stringify(n)})`,s=Date.now()+t;while(Date.now()<s){try{if(await e.evaluate(o))return}catch{}await new Promise((i)=>setTimeout(i,100))}}async function T(e){try{let n=await e.evaluate("Math.ceil(Math.max(document.documentElement.scrollHeight, document.documentElement.offsetHeight, document.body ? document.body.scrollHeight : 0, document.body ? document.body.offsetHeight : 0))");return typeof n==="number"&&Number.isFinite(n)&&n>0?Math.min(n,h):0}catch{return 0}}async function Nc(e,n,t={}){let o=Math.min(t.width??1440,h),s=Math.min(t.height??2200,h),i=t.waitMs??800,r=t.timeoutMs??15000,m=t.format??"png",c=M(e),u=(f)=>new p({width:o,height:f,headless:!0,...t.backend?{backend:t.backend}:{}}),a=u(s);try{if(await g(a,c,i,r),t.waitSelector)await w(a,t.waitSelector,r);if(t.fullPage){let d=await T(a);if(d>s){if(a.close(),a=u(d),await g(a,c,i,r),t.waitSelector)await w(a,t.waitSelector,r)}}let f=await a.screenshot({encoding:"buffer",format:m});b(l.dirname(l.resolve(n)),{recursive:!0}),await Bun.write(n,f)}finally{a.close()}if(!y(n))throw Error(`Screenshot was not produced for ${e}`);return{input:e,output:n,bytes:S(n).size}}async function Du(e,n,t={}){b(n,{recursive:!0});let o;if(!/^https?:\/\//.test(e)&&y(e)&&S(e).isDirectory())o=v(e).filter((r)=>r.endsWith(".html")).map((r)=>l.join(e,r));else o=[e];let s=t.format??"png",i=[];for(let r of o){let m=/^https?:\/\//.test(r)?new URL(r).pathname.replace(/\W+/g,"-").replace(/^-|-$/g,"")||"index":l.basename(r).replace(/\.html?$/,"");i.push(await Nc(r,l.join(n,`${m}.${s}`),t))}return i}
3
- export{Nc,Du};
2
+ var{WebView:p}=globalThis.Bun;import{existsSync as y,mkdirSync as b,readdirSync as v,statSync as S}from"fs";import l from"path";var h=16384;function M(e){if(/^https?:\/\//.test(e)||e.startsWith("file://"))return e;return`file://${l.resolve(e)}`}function g(e,n,t,o){return new Promise((s)=>{let i=!1,r,m,c=()=>{if(!i){if(i=!0,clearTimeout(m),r)clearTimeout(r);e.onNavigated=void 0,s()}};m=setTimeout(c,o),e.onNavigated=()=>{if(!i)r=setTimeout(c,t)};try{let u=e.navigate(n);if(u&&typeof u.catch==="function")u.catch(c)}catch{c()}})}async function w(e,n,t){let o=`!!document.querySelector(${JSON.stringify(n)})`,s=Date.now()+t;while(Date.now()<s){try{if(await e.evaluate(o))return}catch{}await new Promise((i)=>setTimeout(i,100))}}async function T(e){try{let n=await e.evaluate("Math.ceil(Math.max(document.documentElement.scrollHeight, document.documentElement.offsetHeight, document.body ? document.body.scrollHeight : 0, document.body ? document.body.offsetHeight : 0))");return typeof n==="number"&&Number.isFinite(n)&&n>0?Math.min(n,h):0}catch{return 0}}async function Dc(e,n,t={}){let o=Math.min(t.width??1440,h),s=Math.min(t.height??2200,h),i=t.waitMs??800,r=t.timeoutMs??15000,m=t.format??"png",c=M(e),u=(f)=>new p({width:o,height:f,headless:!0,...t.backend?{backend:t.backend}:{}}),a=u(s);try{if(await g(a,c,i,r),t.waitSelector)await w(a,t.waitSelector,r);if(t.fullPage){let d=await T(a);if(d>s){if(a.close(),a=u(d),await g(a,c,i,r),t.waitSelector)await w(a,t.waitSelector,r)}}let f=await a.screenshot({encoding:"buffer",format:m});b(l.dirname(l.resolve(n)),{recursive:!0}),await Bun.write(n,f)}finally{a.close()}if(!y(n))throw Error(`Screenshot was not produced for ${e}`);return{input:e,output:n,bytes:S(n).size}}async function Mu(e,n,t={}){b(n,{recursive:!0});let o;if(!/^https?:\/\//.test(e)&&y(e)&&S(e).isDirectory())o=v(e).filter((r)=>r.endsWith(".html")).map((r)=>l.join(e,r));else o=[e];let s=t.format??"png",i=[];for(let r of o){let m=/^https?:\/\//.test(r)?new URL(r).pathname.replace(/\W+/g,"-").replace(/^-|-$/g,"")||"index":l.basename(r).replace(/\.html?$/,"");i.push(await Dc(r,l.join(n,`${m}.${s}`),t))}return i}
3
+ export{Dc,Mu};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{createHash as g}from"crypto";import{readFile as b,stat as y}from"fs/promises";async function M(e){try{let t=await b(e);return g("sha256").update(t).digest("hex").slice(0,16)}catch{return""}}function l(e){return g("sha256").update(e).digest("hex").slice(0,16)}function m(e,t){let r=JSON.stringify(t,Object.keys(t).sort());return`${l(e)}-${l(r)}`}async function h(e){try{return(await y(e)).mtimeMs}catch{return 0}}async function I(e){try{return await y(e),!0}catch{return!1}}import{mkdir as v,readFile as A,writeFile as P,readdir as B,rm as k,stat as H}from"fs/promises";import{join as w,dirname as D}from"path";var c=new Map,d={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500};async function E(e){try{await v(e,{recursive:!0})}catch{}}function p(e,t,r){return w(e,r,`${t}.json`)}async function C(e,t,r){if((Date.now()-e.createdAt)/86400000>r)return!1;if(await h(t)!==e.srcMtime)return!1;return!0}async function vr(e,t,r,a=d){if(!a.enabled)return null;let n=m(e,t),i=c.get(n);if(i){if(await C(i,e,a.maxAge))return i.lastAccessedAt=Date.now(),i.data;c.delete(n)}let o=p(a.directory,n,r);if(await I(o))try{let u=await A(o,"utf-8"),s=JSON.parse(u);if(await C(s,e,a.maxAge))return s.lastAccessedAt=Date.now(),c.set(n,s),s.data}catch{}return null}async function wr(e,t,r,a,n=d){if(!n.enabled)return;let i=m(e,t),o=await M(e),u=await h(e),s={key:i,src:e,srcHash:o,srcMtime:u,optionsHash:m("",t),data:r,createdAt:Date.now(),lastAccessedAt:Date.now()};c.set(i,s);let f=p(n.directory,i,a);try{await E(D(f)),await P(f,JSON.stringify(s,null,2))}catch(x){console.warn(`[stx-media] Failed to write cache: ${x}`)}}async function xr(e,t=d){if(e==="all")c.clear();else c.clear();let r=e==="all"?["image","video"]:[e];for(let a of r){let n=w(t.directory,a);try{await k(n,{recursive:!0,force:!0})}catch{}}}
3
- export{M,I,vr,wr,xr};
2
+ import{createHash as g}from"crypto";import{readFile as b,stat as y}from"fs/promises";async function M(e){try{let t=await b(e);return g("sha256").update(t).digest("hex").slice(0,16)}catch{return""}}function l(e){return g("sha256").update(e).digest("hex").slice(0,16)}function m(e,t){let r=JSON.stringify(t,Object.keys(t).sort());return`${l(e)}-${l(r)}`}async function h(e){try{return(await y(e)).mtimeMs}catch{return 0}}async function I(e){try{return await y(e),!0}catch{return!1}}import{mkdir as v,readFile as A,writeFile as P,readdir as B,rm as k,stat as H}from"fs/promises";import{join as w,dirname as D}from"path";var c=new Map,d={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500};async function E(e){try{await v(e,{recursive:!0})}catch{}}function p(e,t,r){return w(e,r,`${t}.json`)}async function C(e,t,r){if((Date.now()-e.createdAt)/86400000>r)return!1;if(await h(t)!==e.srcMtime)return!1;return!0}async function wr(e,t,r,a=d){if(!a.enabled)return null;let n=m(e,t),i=c.get(n);if(i){if(await C(i,e,a.maxAge))return i.lastAccessedAt=Date.now(),i.data;c.delete(n)}let o=p(a.directory,n,r);if(await I(o))try{let u=await A(o,"utf-8"),s=JSON.parse(u);if(await C(s,e,a.maxAge))return s.lastAccessedAt=Date.now(),c.set(n,s),s.data}catch{}return null}async function xr(e,t,r,a,n=d){if(!n.enabled)return;let i=m(e,t),o=await M(e),u=await h(e),s={key:i,src:e,srcHash:o,srcMtime:u,optionsHash:m("",t),data:r,createdAt:Date.now(),lastAccessedAt:Date.now()};c.set(i,s);let f=p(n.directory,i,a);try{await E(D(f)),await P(f,JSON.stringify(s,null,2))}catch(x){console.warn(`[stx-media] Failed to write cache: ${x}`)}}async function Sr(e,t=d){if(e==="all")c.clear();else c.clear();let r=e==="all"?["image","video"]:[e];for(let a of r){let n=w(t.directory,a);try{await k(n,{recursive:!0,force:!0})}catch{}}}
3
+ export{M,I,wr,xr,Sr};