@stacksjs/stx 0.2.888 → 0.2.890

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 (260) hide show
  1. package/dist/{chunk-c0g30cjs.js → chunk-05x1rd86.js} +2 -2
  2. package/dist/{chunk-6qq3wy3m.js → chunk-062qfv99.js} +2 -2
  3. package/dist/{chunk-s29hp1qw.js → chunk-0jdz31q1.js} +3 -3
  4. package/dist/{chunk-1kc0jyhj.js → chunk-0jkj8thz.js} +1 -1
  5. package/dist/chunk-0k437z3q.js +2 -0
  6. package/dist/chunk-0q0nbq50.js +2 -0
  7. package/dist/{chunk-5ysv0499.js → chunk-0wp23n1d.js} +1 -1
  8. package/dist/{chunk-9f31gs4m.js → chunk-115bb91s.js} +2 -2
  9. package/dist/chunk-12cjs6vs.js +2 -0
  10. package/dist/chunk-1a7a8cjs.js +2 -0
  11. package/dist/{chunk-wpa3r3b9.js → chunk-1bft48gk.js} +2 -2
  12. package/dist/{chunk-9tecekzq.js → chunk-1jtsr42q.js} +18 -18
  13. package/dist/{chunk-vazk5qbh.js → chunk-1knk403z.js} +2 -2
  14. package/dist/chunk-1p4q6t48.js +2 -0
  15. package/dist/chunk-1ph2yhfn.js +3 -0
  16. package/dist/{chunk-c1b0fy70.js → chunk-1t15z230.js} +5 -5
  17. package/dist/{chunk-2assyczz.js → chunk-1w0bqqh5.js} +2 -2
  18. package/dist/chunk-1z6pqvmf.js +2 -0
  19. package/dist/chunk-2nqmw4dv.js +2 -0
  20. package/dist/{chunk-e9tjxnhn.js → chunk-2xnbdqy4.js} +5 -5
  21. package/dist/chunk-35j7gaj5.js +2 -0
  22. package/dist/chunk-3b3mkgpj.js +3 -0
  23. package/dist/{chunk-7mcs59pr.js → chunk-3bsz7zj3.js} +2 -2
  24. package/dist/{chunk-w624s5jf.js → chunk-3qk8vf9m.js} +3 -3
  25. package/dist/chunk-3yvmaphj.js +2 -0
  26. package/dist/{chunk-mk6thhwf.js → chunk-40k0r6z9.js} +2 -2
  27. package/dist/{chunk-6t04tqvh.js → chunk-41z7f41b.js} +2 -2
  28. package/dist/chunk-44teqn0b.js +2 -0
  29. package/dist/{chunk-372xh1g1.js → chunk-49xwf7dk.js} +6 -6
  30. package/dist/chunk-4akw3bym.js +2 -0
  31. package/dist/chunk-4d85str1.js +2 -0
  32. package/dist/{chunk-whsdyf4t.js → chunk-4eescf3s.js} +7 -7
  33. package/dist/chunk-4xbtxeak.js +2 -0
  34. package/dist/chunk-53kcqdjj.js +2 -0
  35. package/dist/{chunk-1xpq83mc.js → chunk-67j2m620.js} +4 -4
  36. package/dist/chunk-690518hw.js +2 -0
  37. package/dist/chunk-6s3jwysv.js +2 -0
  38. package/dist/{chunk-znnvq1jp.js → chunk-6svc4kb8.js} +65 -65
  39. package/dist/chunk-732gb689.js +2 -0
  40. package/dist/{chunk-ah6nc29h.js → chunk-80ky40mm.js} +2 -2
  41. package/dist/chunk-80xzjxah.js +2 -0
  42. package/dist/chunk-850tye3c.js +2 -0
  43. package/dist/{chunk-b8528fra.js → chunk-8ccgty8s.js} +4 -4
  44. package/dist/{chunk-btsgt6w3.js → chunk-8f8qgjjr.js} +2 -2
  45. package/dist/{chunk-ry6w43p6.js → chunk-8hwfdwgn.js} +6 -6
  46. package/dist/chunk-9344rq4r.js +38 -0
  47. package/dist/chunk-94j4p584.js +2 -0
  48. package/dist/{chunk-y76znqmh.js → chunk-97snfzsy.js} +54 -54
  49. package/dist/chunk-9a9cec4x.js +2 -0
  50. package/dist/chunk-9afkttvz.js +2 -0
  51. package/dist/{chunk-0hj5apb9.js → chunk-9rjgq8k4.js} +1 -1
  52. package/dist/chunk-a0aqs5a8.js +3 -0
  53. package/dist/{chunk-9qrgdekg.js → chunk-a3zrwky3.js} +16 -16
  54. package/dist/{chunk-care745q.js → chunk-a7bqrjm5.js} +2 -2
  55. package/dist/{chunk-pm4kn9h2.js → chunk-adsqckg4.js} +10 -10
  56. package/dist/chunk-ah8az9vv.js +2 -0
  57. package/dist/{chunk-605g9qhp.js → chunk-aj5tsksz.js} +9 -9
  58. package/dist/chunk-amb7e0fp.js +2 -0
  59. package/dist/chunk-arr79m90.js +2 -0
  60. package/dist/{chunk-55kwxxm5.js → chunk-b0hj8eg2.js} +2 -2
  61. package/dist/{chunk-r57jz09p.js → chunk-bgfs3mbg.js} +5 -5
  62. package/dist/chunk-bm0mzk3b.js +2 -0
  63. package/dist/{chunk-ymqm898x.js → chunk-bvqgq18r.js} +2 -2
  64. package/dist/{chunk-wbxmn5gk.js → chunk-bw2m1e7g.js} +5 -5
  65. package/dist/{chunk-wm287dz2.js → chunk-c25q87ys.js} +3 -3
  66. package/dist/{chunk-98mj0es1.js → chunk-ch9028z3.js} +1 -1
  67. package/dist/{chunk-sbwvvjkc.js → chunk-cmg9x1ka.js} +3 -3
  68. package/dist/{chunk-11fxbd71.js → chunk-cphc60zw.js} +2 -2
  69. package/dist/{chunk-dj9ztcth.js → chunk-dvjv4c3a.js} +1 -1
  70. package/dist/{chunk-v8e2c2r1.js → chunk-e16ef18k.js} +2 -2
  71. package/dist/chunk-e28czxw3.js +2 -0
  72. package/dist/chunk-e8szp5wa.js +2 -0
  73. package/dist/chunk-eq86wzhr.js +1314 -0
  74. package/dist/chunk-essd43ad.js +2 -0
  75. package/dist/chunk-f60k8j9m.js +2 -0
  76. package/dist/chunk-fsk3rk2x.js +2 -0
  77. package/dist/{chunk-fce8wj3t.js → chunk-g3vce7ka.js} +2 -2
  78. package/dist/{chunk-em6fqvjy.js → chunk-g5nfqzfh.js} +2 -2
  79. package/dist/chunk-gfea8a9y.js +2 -0
  80. package/dist/chunk-hda7t8g6.js +2 -0
  81. package/dist/chunk-hk241gt2.js +2 -0
  82. package/dist/{chunk-c3ca056p.js → chunk-htx5yezj.js} +2 -2
  83. package/dist/{chunk-b0jekg4c.js → chunk-hxws025y.js} +3 -3
  84. package/dist/chunk-hyyh7qxw.js +25 -0
  85. package/dist/chunk-j6fs31va.js +2 -0
  86. package/dist/chunk-j9kejcrx.js +2 -0
  87. package/dist/chunk-j9vfv53x.js +20 -0
  88. package/dist/chunk-jhbz5w30.js +2 -0
  89. package/dist/chunk-jvnsz2x9.js +2 -0
  90. package/dist/chunk-k4x680e3.js +2 -0
  91. package/dist/chunk-k8bk685s.js +2 -0
  92. package/dist/chunk-kexqmwx8.js +2 -0
  93. package/dist/chunk-kfdmm240.js +2 -0
  94. package/dist/{chunk-fepezvdq.js → chunk-kg7vby72.js} +8 -8
  95. package/dist/{chunk-wf8pdjq5.js → chunk-khm56bfm.js} +1 -1
  96. package/dist/{chunk-303vzq80.js → chunk-kk2p2tgv.js} +3 -3
  97. package/dist/chunk-kpjq135z.js +2 -0
  98. package/dist/chunk-kqsm7gf1.js +2 -0
  99. package/dist/{chunk-j51wss7s.js → chunk-kr2400c3.js} +4 -4
  100. package/dist/{chunk-r8xper92.js → chunk-ksmn19qw.js} +2 -2
  101. package/dist/{chunk-7hm1tpw0.js → chunk-mhrnjaka.js} +6 -6
  102. package/dist/chunk-mtfymhy1.js +2 -0
  103. package/dist/{chunk-52mhrbps.js → chunk-n6q1d66k.js} +1 -1
  104. package/dist/chunk-neg6ckjg.js +12 -0
  105. package/dist/{chunk-wscry63p.js → chunk-nhv81gp2.js} +2 -2
  106. package/dist/{chunk-c73c0wf9.js → chunk-nq60tjkz.js} +2 -2
  107. package/dist/{chunk-v47xc2fr.js → chunk-nzpb263k.js} +9 -9
  108. package/dist/{chunk-p33npqjt.js → chunk-p0bjbtdx.js} +33 -33
  109. package/dist/{chunk-gdtj5rfa.js → chunk-p3hbsrk9.js} +6 -6
  110. package/dist/chunk-p82fzxdg.js +2 -0
  111. package/dist/{chunk-0d7ypcjb.js → chunk-pjj54ddk.js} +3 -3
  112. package/dist/{chunk-qsnpqa8q.js → chunk-pnmafbv5.js} +1 -1
  113. package/dist/{chunk-vgsasnwm.js → chunk-pvm48tse.js} +3 -3
  114. package/dist/{chunk-zek9t5za.js → chunk-pwpge9bj.js} +2 -2
  115. package/dist/{chunk-6zq3eh7d.js → chunk-q0y8gv18.js} +2 -2
  116. package/dist/{chunk-7s3j8pqq.js → chunk-qnf7w4xw.js} +3 -3
  117. package/dist/chunk-qsv84cwm.js +2 -0
  118. package/dist/{chunk-xavx271y.js → chunk-r5ecgcx2.js} +5 -5
  119. package/dist/chunk-r7m60q1m.js +2 -0
  120. package/dist/chunk-r98pye4h.js +2 -0
  121. package/dist/{chunk-zf29ahhd.js → chunk-rb2zbdqd.js} +4 -4
  122. package/dist/{chunk-vjfp8n6p.js → chunk-rd663v1m.js} +3 -3
  123. package/dist/{chunk-4nnmrp7w.js → chunk-rf0smj4c.js} +2 -2
  124. package/dist/{chunk-0dq9svfb.js → chunk-sh7a0g09.js} +3 -3
  125. package/dist/chunk-snkbn5y8.js +2 -0
  126. package/dist/chunk-sztr4d5g.js +2 -0
  127. package/dist/{chunk-4c9p434g.js → chunk-t0ttxayz.js} +2 -2
  128. package/dist/{chunk-5ymf5c8m.js → chunk-t3zmfh8w.js} +7 -7
  129. package/dist/chunk-t4gcsbna.js +2 -0
  130. package/dist/chunk-tbh7r1wh.js +2 -0
  131. package/dist/chunk-tspqdt8e.js +2 -0
  132. package/dist/{chunk-6fsnnj5v.js → chunk-v1mwwben.js} +6 -6
  133. package/dist/chunk-v3jyb8k6.js +2 -0
  134. package/dist/chunk-v6gkjg5f.js +3 -0
  135. package/dist/chunk-v90nz5xm.js +54 -0
  136. package/dist/{chunk-7nhgpjjw.js → chunk-vf4ejngv.js} +6 -6
  137. package/dist/chunk-vfcbz0an.js +3 -0
  138. package/dist/{chunk-hxhmhw23.js → chunk-vk2jy6mn.js} +3 -3
  139. package/dist/{chunk-e1qcfesw.js → chunk-vkfw9k1n.js} +8 -8
  140. package/dist/{chunk-mm1eg2pg.js → chunk-vxbvrbqs.js} +10 -10
  141. package/dist/chunk-wedwczed.js +2 -0
  142. package/dist/chunk-wg6fmren.js +4 -0
  143. package/dist/{chunk-s7wp7a2x.js → chunk-whcrca58.js} +31 -31
  144. package/dist/chunk-wmvvrsn0.js +2 -0
  145. package/dist/chunk-wnrh62by.js +2 -0
  146. package/dist/{chunk-q3bkxg2n.js → chunk-wy6vjz1e.js} +21 -21
  147. package/dist/{chunk-mbm3ma63.js → chunk-x5bn2svk.js} +2 -2
  148. package/dist/chunk-x6565mhk.js +2 -0
  149. package/dist/{chunk-brzjass3.js → chunk-xc5esqcb.js} +2 -2
  150. package/dist/{chunk-e2ws79vt.js → chunk-xeyq6d0t.js} +8 -8
  151. package/dist/{chunk-xw291tn7.js → chunk-xmg6bmh6.js} +27 -22
  152. package/dist/{chunk-3fbgpv1d.js → chunk-xvncq3m5.js} +2 -2
  153. package/dist/chunk-xwgdcc7w.js +2 -0
  154. package/dist/chunk-xwrjre34.js +2 -0
  155. package/dist/{chunk-1wkp3pks.js → chunk-xy8smv5e.js} +2 -2
  156. package/dist/{chunk-y8p59h6c.js → chunk-y1d3j2j7.js} +4 -4
  157. package/dist/{chunk-zje94z0k.js → chunk-yesh4dfe.js} +61 -61
  158. package/dist/chunk-ymc1wgb3.js +2 -0
  159. package/dist/{chunk-xy4j8t7w.js → chunk-ytjn0gq2.js} +2 -2
  160. package/dist/chunk-z4tdnfxd.js +2 -0
  161. package/dist/{chunk-w1q86c89.js → chunk-zf68afyh.js} +3 -3
  162. package/dist/{chunk-6c1vm6bs.js → chunk-zkwkhesc.js} +2 -2
  163. package/dist/{chunk-2rmqmajd.js → chunk-zpqjsnz9.js} +3 -3
  164. package/dist/{chunk-vgr7gd8k.js → chunk-zwqkbk2m.js} +2 -2
  165. package/dist/chunk-zxjdfgdx.js +3 -0
  166. package/dist/cli.js +29 -29
  167. package/dist/component-contract.d.ts +1 -0
  168. package/dist/component-contract.js +6 -4
  169. package/dist/component-library.d.ts +2 -1
  170. package/dist/component-library.js +218 -348
  171. package/dist/composition-api.d.ts +7 -1
  172. package/dist/craft-entry.js +2 -2
  173. package/dist/craft.js +2 -2
  174. package/dist/directive-arguments.js +39 -6
  175. package/dist/emits-declaration.d.ts +9 -0
  176. package/dist/emits-declaration.js +64 -0
  177. package/dist/parser/tokenizer.d.ts +2 -1
  178. package/dist/parser/tokenizer.js +7 -5
  179. package/dist/props-declaration.d.ts +66 -0
  180. package/dist/props-declaration.js +379 -0
  181. package/dist/pwa.js +3 -3
  182. package/dist/ssg.js +28 -28
  183. package/dist/utils.js +20 -109
  184. package/package.json +5 -5
  185. package/dist/chunk-000mwmfq.js +0 -1203
  186. package/dist/chunk-043d0en0.js +0 -2
  187. package/dist/chunk-0w66z6eq.js +0 -2
  188. package/dist/chunk-13wd9gf0.js +0 -3
  189. package/dist/chunk-1znqedae.js +0 -2
  190. package/dist/chunk-2drzzjcm.js +0 -2
  191. package/dist/chunk-3c7nt5qp.js +0 -2
  192. package/dist/chunk-3ed2erm6.js +0 -12
  193. package/dist/chunk-3zyzhcd9.js +0 -2
  194. package/dist/chunk-44rb9fk0.js +0 -2
  195. package/dist/chunk-472j3bhp.js +0 -2
  196. package/dist/chunk-4acce1m8.js +0 -2
  197. package/dist/chunk-4kasmp98.js +0 -2
  198. package/dist/chunk-53kkjn23.js +0 -2
  199. package/dist/chunk-5gwvy612.js +0 -2
  200. package/dist/chunk-61vbqrde.js +0 -2
  201. package/dist/chunk-6fpzwryt.js +0 -2
  202. package/dist/chunk-7195598h.js +0 -2
  203. package/dist/chunk-7zvf79vb.js +0 -2
  204. package/dist/chunk-88a735jw.js +0 -2
  205. package/dist/chunk-8v7yjq3b.js +0 -2
  206. package/dist/chunk-94mpe1ny.js +0 -3
  207. package/dist/chunk-97kgrevs.js +0 -4
  208. package/dist/chunk-a8c9j9cj.js +0 -2
  209. package/dist/chunk-acw851e8.js +0 -2
  210. package/dist/chunk-andfvr3g.js +0 -2
  211. package/dist/chunk-aqxh80vh.js +0 -2
  212. package/dist/chunk-ay5zkfdg.js +0 -2
  213. package/dist/chunk-b4gptdtc.js +0 -2
  214. package/dist/chunk-baaw9w7y.js +0 -2
  215. package/dist/chunk-bw2p9h2g.js +0 -2
  216. package/dist/chunk-ce0vv7kz.js +0 -2
  217. package/dist/chunk-d1yj29g2.js +0 -2
  218. package/dist/chunk-dbhmbef1.js +0 -20
  219. package/dist/chunk-dfsykk1r.js +0 -2
  220. package/dist/chunk-e9p596bp.js +0 -2
  221. package/dist/chunk-edysherg.js +0 -25
  222. package/dist/chunk-ftecsa8e.js +0 -2
  223. package/dist/chunk-ge2h5v46.js +0 -2
  224. package/dist/chunk-gqvnz8a7.js +0 -2
  225. package/dist/chunk-j41gp8p3.js +0 -2
  226. package/dist/chunk-jxvccj30.js +0 -2
  227. package/dist/chunk-k5bbre7d.js +0 -2
  228. package/dist/chunk-kd47vgs8.js +0 -2
  229. package/dist/chunk-keqjafdz.js +0 -2
  230. package/dist/chunk-kvxdyg7e.js +0 -3
  231. package/dist/chunk-kz3mejc4.js +0 -2
  232. package/dist/chunk-ngkh0t5b.js +0 -2
  233. package/dist/chunk-nx9895m6.js +0 -2
  234. package/dist/chunk-nxgtt1t1.js +0 -2
  235. package/dist/chunk-nyw2ztar.js +0 -2
  236. package/dist/chunk-p5q27adr.js +0 -2
  237. package/dist/chunk-p6hcrg3r.js +0 -3
  238. package/dist/chunk-pa2vt2ej.js +0 -2
  239. package/dist/chunk-pczb7xav.js +0 -2
  240. package/dist/chunk-ps37r6hj.js +0 -2
  241. package/dist/chunk-pvbhk17r.js +0 -2
  242. package/dist/chunk-q252qvsy.js +0 -2
  243. package/dist/chunk-q5b0vpmm.js +0 -2
  244. package/dist/chunk-qg1kw5yf.js +0 -2
  245. package/dist/chunk-qjy5yq25.js +0 -54
  246. package/dist/chunk-r561zt9v.js +0 -38
  247. package/dist/chunk-sbr85vda.js +0 -2
  248. package/dist/chunk-tkab24xr.js +0 -2
  249. package/dist/chunk-vn59yrjh.js +0 -2
  250. package/dist/chunk-w50yggy3.js +0 -3
  251. package/dist/chunk-w5zzwe2f.js +0 -2
  252. package/dist/chunk-wa9q1gyv.js +0 -2
  253. package/dist/chunk-wbmx0rge.js +0 -2
  254. package/dist/chunk-wpgxhrd7.js +0 -2
  255. package/dist/chunk-x3azrbpr.js +0 -2
  256. package/dist/chunk-x50hk1hq.js +0 -2
  257. package/dist/chunk-xbkbvfcg.js +0 -2
  258. package/dist/chunk-z55rpt3s.js +0 -3
  259. package/dist/chunk-zwde52kw.js +0 -2
  260. package/dist/chunk-zxff7kq9.js +0 -2
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- function Dc(){return`
2
+ function Lc(){return`
3
3
  (function(){
4
4
  var tip=null,hideTimer=null,currentEl=null;
5
5
 
@@ -103,4 +103,4 @@ document.addEventListener("focusout",function(e){
103
103
  });
104
104
  })();
105
105
  `}
106
- export{Dc};
106
+ export{Lc};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{_h,Ch,Eh,Th,$h,Rh}from"./chunk-bgfs3mbg.js";export{Th as generateTransitionCSS,$h as generateTransitionRuntime,_h as performEnter,Ch as performLeave,Rh as processTransitionAttributes,Eh as processTransitionDirectives};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{b}from"./chunk-94mpe1ny.js";import{mkdir as I,writeFile as m}from"fs/promises";import{join as l}from"path";var g="https://api.iconify.design";async function D(){let e=await fetch(`${g}/collections`);if(!e.ok)throw Error(`Failed to fetch collections: ${e.statusText}`);return await e.json()}async function P(e,t){try{let c=b.resolve("@iconify/json"),r=`${`${c.substring(0,c.lastIndexOf("/node_modules/@iconify/json/"))}/node_modules/@iconify/json`}/json/${e}.json`,s=Bun.file(r);if(await s.exists()){let a=await s.json();if(t&&t.length>0){let d={};for(let u of t)if(a.icons[u])d[u]=a.icons[u];return{...a,icons:d}}return a}}catch{}let n=t&&t.length>0?`${g}/${e}.json?icons=${t.join(",")}`:`${g}/${e}.json`,i=await fetch(n);if(!i.ok)throw Error(`Failed to fetch icons for ${e}: ${i.statusText}`);return await i.json()}function F(e,t=24,n=24){return{body:e.body,width:e.width||t,height:e.height||n,viewBox:`0 0 ${e.width||t} ${e.height||n}`}}function T(e,t){let n=h(e);return`import type { IconData } from '@stacksjs/iconify-core'
2
+ import{w}from"./chunk-v6gkjg5f.js";import{mkdir as I,writeFile as m}from"fs/promises";import{join as l}from"path";var g="https://api.iconify.design";async function D(){let e=await fetch(`${g}/collections`);if(!e.ok)throw Error(`Failed to fetch collections: ${e.statusText}`);return await e.json()}async function P(e,t){try{let c=w.resolve("@iconify/json"),r=`${`${c.substring(0,c.lastIndexOf("/node_modules/@iconify/json/"))}/node_modules/@iconify/json`}/json/${e}.json`,s=Bun.file(r);if(await s.exists()){let a=await s.json();if(t&&t.length>0){let d={};for(let u of t)if(a.icons[u])d[u]=a.icons[u];return{...a,icons:d}}return a}}catch{}let n=t&&t.length>0?`${g}/${e}.json?icons=${t.join(",")}`:`${g}/${e}.json`,i=await fetch(n);if(!i.ok)throw Error(`Failed to fetch icons for ${e}: ${i.statusText}`);return await i.json()}function F(e,t=24,n=24){return{body:e.body,width:e.width||t,height:e.height||n,viewBox:`0 0 ${e.width||t} ${e.height||n}`}}function T(e,t){let n=h(e);return`import type { IconData } from '@stacksjs/iconify-core'
3
3
 
4
4
  export const ${n}: IconData = ${JSON.stringify(t,null,2)}
5
5
 
@@ -502,4 +502,4 @@ ${t.license?.url?`See [license details](${t.license.url}) for more information.`
502
502
  - [Iconify documentation](https://iconify.design/docs/)
503
503
  - [stx iconify integration guide](../../docs/iconify.md)
504
504
  `}async function G(e,t,n,i){console.log(`
505
- \uD83D\uDCE6 Generating package for ${e}...`);let o=(await D())[e];if(!o)throw Error(`Collection ${e} not found`);console.log(` Collection: ${o.name}`),console.log(` Total icons: ${o.total}`);let r=await P(e,n),s=Object.keys(r.icons);console.log(` Generating ${s.length} icons...`);let a=l(t,`iconify-${e}`),d=l(a,"src");await I(d,{recursive:!0});let u=r.width||24,w=r.height||24;for(let p of s){let y=r.icons[p],f=F(y,u,w),z=T(p,f);await m(l(d,`${p}.ts`),z);let k=A(p,f);await m(l(d,`${p}-icon.stx`),k)}let v=_(s);await m(l(d,"index.ts"),v);let C=E(e);await m(l(d,"types.ts"),C);let S=N(e,o,s.length);await m(l(a,"package.json"),S);let x=U(e);await m(l(a,"build.ts"),x);let j=R(e,o,s.length);if(await m(l(a,"README.md"),j),i){let p=l(i,`iconify-${e}.md`),y=M(e,o,s);await I(i,{recursive:!0}),await m(p,y),console.log(` \u2713 Generated documentation in ${p}`)}console.log(` \u2713 Generated ${s.length} icons in ${a}`)}var B=new Set(["break","case","catch","class","const","continue","debugger","default","delete","do","else","enum","export","extends","false","finally","for","function","if","import","in","instanceof","new","null","return","super","switch","this","throw","true","try","typeof","var","void","while","with","let","static","yield","implements","interface","package","private","protected","public","await","eval","arguments"]);function h(e){let t=e.replace(/-([a-z0-9])/g,(n)=>n[1].toUpperCase());if(t=t.replace(/[^a-zA-Z0-9_$]/g,"_"),/^[0-9]/.test(t))t=`_${t}`;if(B.has(t))t=`${t}_`;return t}function W(e){let t=h(e);return t.charAt(0).toUpperCase()+t.slice(1)}export{D as fetchCollections,G as generatePackage};
505
+ \uD83D\uDCE6 Generating package for ${e}...`);let o=(await D())[e];if(!o)throw Error(`Collection ${e} not found`);console.log(` Collection: ${o.name}`),console.log(` Total icons: ${o.total}`);let r=await P(e,n),s=Object.keys(r.icons);console.log(` Generating ${s.length} icons...`);let a=l(t,`iconify-${e}`),d=l(a,"src");await I(d,{recursive:!0});let u=r.width||24,b=r.height||24;for(let p of s){let y=r.icons[p],f=F(y,u,b),z=T(p,f);await m(l(d,`${p}.ts`),z);let k=A(p,f);await m(l(d,`${p}-icon.stx`),k)}let v=_(s);await m(l(d,"index.ts"),v);let C=E(e);await m(l(d,"types.ts"),C);let S=N(e,o,s.length);await m(l(a,"package.json"),S);let x=U(e);await m(l(a,"build.ts"),x);let j=R(e,o,s.length);if(await m(l(a,"README.md"),j),i){let p=l(i,`iconify-${e}.md`),y=M(e,o,s);await I(i,{recursive:!0}),await m(p,y),console.log(` \u2713 Generated documentation in ${p}`)}console.log(` \u2713 Generated ${s.length} icons in ${a}`)}var B=new Set(["break","case","catch","class","const","continue","debugger","default","delete","do","else","enum","export","extends","false","finally","for","function","if","import","in","instanceof","new","null","return","super","switch","this","throw","true","try","typeof","var","void","while","with","let","static","yield","implements","interface","package","private","protected","public","await","eval","arguments"]);function h(e){let t=e.replace(/-([a-z0-9])/g,(n)=>n[1].toUpperCase());if(t=t.replace(/[^a-zA-Z0-9_$]/g,"_"),/^[0-9]/.test(t))t=`_${t}`;if(B.has(t))t=`${t}_`;return t}function W(e){let t=h(e);return t.charAt(0).toUpperCase()+t.slice(1)}export{D as fetchCollections,G as generatePackage};
@@ -1,18 +1,18 @@
1
1
  // @bun
2
- import{De}from"./chunk-kvxdyg7e.js";import{_}from"./chunk-11fxbd71.js";import{M,jn}from"./chunk-hxhmhw23.js";import{A,oe}from"./chunk-000mwmfq.js";import{a}from"./chunk-zje94z0k.js";import{Ee,hn,yn,bn}from"./chunk-dbhmbef1.js";import{Pt}from"./chunk-mm1eg2pg.js";import{Tt,er,ln,be}from"./chunk-97kgrevs.js";import{I,et}from"./chunk-w50yggy3.js";import v from"fs";import b from"path";import x from"process";function B(s,o){for(let e of s.matchAll(/\b(?:const|let|var|function|class)\s+([A-Z_a-z$][\w$]*)/g))if(e[1])o.add(e[1]);for(let e of s.matchAll(/\b(?:const|let|var)\s*\{([^{}]*)\}\s*=/g))for(let t of(e[1]??"").split(",")){let r=((t.includes(":")?t.split(":").pop():t)??"").replace(/=.*$/s,"").replace(/^\s*\.\.\./,"").trim();if(/^[A-Z_a-z$][\w$]*$/.test(r))o.add(r)}for(let e of s.matchAll(/\b(?:const|let|var)\s*\[([^\]]*)\]\s*=/g))for(let t of(e[1]??"").split(",")){let n=t.replace(/=.*$/s,"").replace(/^\s*\.\.\./,"").trim();if(/^[A-Z_a-z$][\w$]*$/.test(n))o.add(n)}}var h=new Map;async function R(s,o=I()){let e;if(s)e=b.resolve(s);else{let l=await a();e=b.resolve(l.root||x.cwd(),l.storesDir||"stores")}let t=`${e}\x00${yn()}\x00${o?"shared":"inline"}`,n=new Bun.Glob("*.ts"),r=[];try{for await(let l of n.scan({cwd:e,absolute:!0})){let c=b.basename(l,".ts");if(["index","types"].includes(c))continue;if(l.includes(".d.ts"))continue;r.push(l)}}catch{return be(h,t,"",{chunks:[]}),null}let i=()=>[...new Set([...r,...r.flatMap((l)=>Ee(l))])],f=Tt(i()),u=ln(h,t,f);if(u!==void 0)return u.chunks.length>0?u:null;if(r.length===0)return be(h,t,f,{chunks:[]}),null;let m=[];for(let l of r){let c=await Bun.file(l).text();m.push({file:l,hasUseStore:/useStore\s*\(/.test(c)})}m.sort((l,c)=>{if(l.hasUseStore===c.hasUseStore)return 0;return l.hasUseStore?1:-1});let p=m.map((l)=>l.file),g=[],d=oe({loader:"ts",target:"browser",define:A()});for(let l of p)try{let c=await Bun.file(l).text(),k=b.basename(l,".ts"),y=new Set;B(c,y);let C=[...c.matchAll(/\bdefineStore\s*(?:<[^>()]*>)?\(\s*(['"`])([^'"`$\\]+)\1/g)].map((U)=>U[2]),N=c.match(/\bdefineStore\s*(?:<[^>()]*>)?\(/g)?.length??0;if(hn(c))c=await bn(c,l,{projectRoot:x.cwd(),externalizeUserModules:o});c=Pt(c),c=M(c),c=jn(c),c=c.replace(/^export\s+(default\s+)?/gm,""),c=d.transformSync(c),g.push({name:k,ids:C.length===N?C:[],declared:y,code:`// Store: ${k}
3
- ${c.trim()}`})}catch(c){console.warn(`[stx] Failed to load store ${l}:`,c)}if(g.length===0)return be(h,t,f,{chunks:[]}),null;f=Tt(i());let S={chunks:g};return be(h,t,f,S),S}function j(s){let o=new Set;for(let r of s)for(let i of r.declared)o.add(i);let e=s.map((r)=>r.code).join(`
2
+ import{Le}from"./chunk-3b3mkgpj.js";import{C}from"./chunk-cphc60zw.js";import{D,Bn}from"./chunk-vk2jy6mn.js";import{A,ie}from"./chunk-eq86wzhr.js";import{a}from"./chunk-yesh4dfe.js";import{Te,yn,bn,wn}from"./chunk-j9vfv53x.js";import{Ot}from"./chunk-vxbvrbqs.js";import{Rt,nr,un,ve}from"./chunk-wg6fmren.js";import{I,tt}from"./chunk-a0aqs5a8.js";import v from"fs";import b from"path";import x from"process";function U(s,o){for(let e of s.matchAll(/\b(?:const|let|var|function|class)\s+([A-Z_a-z$][\w$]*)/g))if(e[1])o.add(e[1]);for(let e of s.matchAll(/\b(?:const|let|var)\s*\{([^{}]*)\}\s*=/g))for(let t of(e[1]??"").split(",")){let r=((t.includes(":")?t.split(":").pop():t)??"").replace(/=.*$/s,"").replace(/^\s*\.\.\./,"").trim();if(/^[A-Z_a-z$][\w$]*$/.test(r))o.add(r)}for(let e of s.matchAll(/\b(?:const|let|var)\s*\[([^\]]*)\]\s*=/g))for(let t of(e[1]??"").split(",")){let n=t.replace(/=.*$/s,"").replace(/^\s*\.\.\./,"").trim();if(/^[A-Z_a-z$][\w$]*$/.test(n))o.add(n)}}var h=new Map;async function O(s,o=I()){let e;if(s)e=b.resolve(s);else{let l=await a();e=b.resolve(l.root||x.cwd(),l.storesDir||"stores")}let t=`${e}\x00${bn()}\x00${o?"shared":"inline"}`,n=new Bun.Glob("*.ts"),r=[];try{for await(let l of n.scan({cwd:e,absolute:!0})){let c=b.basename(l,".ts");if(["index","types"].includes(c))continue;if(l.includes(".d.ts"))continue;r.push(l)}}catch{return ve(h,t,"",{chunks:[]}),null}let i=()=>[...new Set([...r,...r.flatMap((l)=>Te(l))])],f=Rt(i()),u=un(h,t,f);if(u!==void 0)return u.chunks.length>0?u:null;if(r.length===0)return ve(h,t,f,{chunks:[]}),null;let m=[];for(let l of r){let c=await Bun.file(l).text();m.push({file:l,hasUseStore:/useStore\s*\(/.test(c)})}m.sort((l,c)=>{if(l.hasUseStore===c.hasUseStore)return 0;return l.hasUseStore?1:-1});let p=m.map((l)=>l.file),g=[],d=ie({loader:"ts",target:"browser",define:A()});for(let l of p)try{let c=await Bun.file(l).text(),k=b.basename(l,".ts"),_=new Set;U(c,_);let y=[...c.matchAll(/\bdefineStore\s*(?:<[^>()]*>)?\(\s*(['"`])([^'"`$\\]+)\1/g)].map((N)=>N[2]),E=c.match(/\bdefineStore\s*(?:<[^>()]*>)?\(/g)?.length??0;if(yn(c))c=await wn(c,l,{projectRoot:x.cwd(),externalizeUserModules:o});c=Ot(c),c=D(c),c=Bn(c),c=c.replace(/^export\s+(default\s+)?/gm,""),c=d.transformSync(c),g.push({name:k,ids:y.length===E?y:[],declared:_,code:`// Store: ${k}
3
+ ${c.trim()}`})}catch(c){console.warn(`[stx] Failed to load store ${l}:`,c)}if(g.length===0)return ve(h,t,f,{chunks:[]}),null;f=Rt(i());let S={chunks:g};return ve(h,t,f,S),S}function R(s){let o=new Set;for(let r of s)for(let i of r.declared)o.add(i);let e=s.map((r)=>r.code).join(`
4
4
 
5
5
  `),n=`;(function(){
6
6
  var __stx = window.stx || {};
7
- ${_.filter((r)=>!o.has(r)&&new RegExp(`\\b${r}\\b`).test(e)).map((r)=>`var ${r} = __stx[${JSON.stringify(r)}];`).join(`
7
+ ${C.filter((r)=>!o.has(r)&&new RegExp(`\\b${r}\\b`).test(e)).map((r)=>`var ${r} = __stx[${JSON.stringify(r)}];`).join(`
8
8
  `)}
9
9
  ${e}
10
- })();`;return I()?et(n):n}function T(s){let o=new Set;for(let e of s.matchAll(/^(?:export\s+)?(?:async\s+)?(?:const|let|var|function\*?|class)\s+([A-Z_a-z$][\w$]*)/gm))o.add(e[1]);for(let e of s.matchAll(/^(?:const|let|var)\s*[{[]([^=]*)[}\]]\s*=/gm))for(let t of(e[1]??"").split(",")){let n=(t.includes(":")?t.split(":").pop():t).replace(/=.*$/s,"").replace(/^\s*\.\.\./,"").trim();if(/^[A-Z_a-z$][\w$]*$/.test(n))o.add(n)}return o}function E(s){let o=s.map((e)=>T(e.code));for(let[e,t]of s.entries()){let n=new Set;for(let[i,f]of o.entries()){if(i===e)continue;for(let u of f)if(!o[e].has(u)&&!t.declared.has(u))n.add(u)}if(n.size===0)continue;let r;try{r=De(t.code,n)}catch{r=new Set([...n].filter((i)=>new RegExp(`(?<![\\w$.])${i.replace(/\$/g,"\\$")}(?![\\w$])`).test(t.code)))}if(r.size>0)return null}return s.map((e,t)=>{let n=new Set([...e.declared,...o[t]]);return`function() {
10
+ })();`;return I()?tt(n):n}function B(s){let o=new Set;for(let e of s.matchAll(/^(?:export\s+)?(?:async\s+)?(?:const|let|var|function\*?|class)\s+([A-Z_a-z$][\w$]*)/gm))o.add(e[1]);for(let e of s.matchAll(/^(?:const|let|var)\s*[{[]([^=]*)[}\]]\s*=/gm))for(let t of(e[1]??"").split(",")){let n=(t.includes(":")?t.split(":").pop():t).replace(/=.*$/s,"").replace(/^\s*\.\.\./,"").trim();if(/^[A-Z_a-z$][\w$]*$/.test(n))o.add(n)}return o}function j(s){let o=s.map((e)=>B(e.code));for(let[e,t]of s.entries()){let n=new Set;for(let[i,f]of o.entries()){if(i===e)continue;for(let u of f)if(!o[e].has(u)&&!t.declared.has(u))n.add(u)}if(n.size===0)continue;let r;try{r=Le(t.code,n)}catch{r=new Set([...n].filter((i)=>new RegExp(`(?<![\\w$.])${i.replace(/\$/g,"\\$")}(?![\\w$])`).test(t.code)))}if(r.size>0)return null}return s.map((e,t)=>{let n=new Set([...e.declared,...o[t]]);return`function() {
11
11
  var __stx = window.stx || {};
12
- ${_.filter((i)=>!n.has(i)&&new RegExp(`\\b${i}\\b`).test(e.code)).map((i)=>`var ${i} = __stx[${JSON.stringify(i)}];`).join(`
12
+ ${C.filter((i)=>!n.has(i)&&new RegExp(`\\b${i}\\b`).test(e.code)).map((i)=>`var ${i} = __stx[${JSON.stringify(i)}];`).join(`
13
13
  `)}
14
14
  ${e.code}
15
- }`})}var z=new WeakMap;async function Nh(s){let o=await R(s);if(!o)return null;let e=z.get(o);if(e===void 0)e=j(o.chunks),z.set(o,e);return e}function W(s){if(!/\buseStore\b/.test(s))return!1;if(/\buseStore\s+as\s+[A-Za-z_$]/.test(s))return!0;if(/\{[^{}]*\buseStore\s*:\s*[A-Za-z_$[{][^{}]*\}\s*=(?!=)/.test(s))return!0;if(/\[\s*(['"`])useStore\1\s*\]/.test(s.replace(/\b(?:var|let|const)\s+useStore\s*=\s*[\w$.]*\[\s*(['"`])useStore\1\s*\]/g," ")))return!0;let o=s.replace(/\/\*[\s\S]*?\*\//g," ").replace(/(^|[^:\\'"`])\/\/[^\n]*/g,"$1 ").replace(/\b(?:var|let|const)\s+useStore\s*=\s*[\w$.]*\[\s*(['"`])useStore\1\s*\]/g," ").replace(/\b(?:const|let|var)\s*\{[^{}]*\}\s*=/g," ").replace(/\bimport\s*(?:type\s+)?\{[^{}]*\}\s*from\b/g," ").replace(/\bexport\s*(?:type\s+)?\{[^{}]*\}/g," ").replace(/\btypeof\s+useStore\b/g," ").replace(/(['"`])useStore\1/g," ");for(let e of o.matchAll(/\buseStore\b/g)){let t=o.slice(Math.max(0,e.index-9),e.index);if(/\bfunction\s*$/.test(t))continue;let n=o.slice(e.index+8).trimStart();if(n.startsWith("(")||n.startsWith("<")||n.startsWith("?.("))continue;if(/^=(?![=>])/.test(n))continue;return!0}return!1}function Do(...s){let o=new Set,e=!1;for(let t of s){if(!t)continue;if(/__STX_STORES__|\b_stores\b/.test(t))e=!0;if(W(t))e=!0;let n=t.match(/\buseStore\s*(?:<[^>()]*>)?\s*(?:\?\.\s*)?\(/g)?.length??0;if(n===0)continue;let r=0;for(let i of t.matchAll(/\buseStore\s*(?:<[^>()]*>)?\s*(?:\?\.\s*)?\(\s*(['"`])([^'"`$\\]+)\1\s*[,)]/g))o.add(i[2]),r++;if(r!==n)e=!0}return{names:o,all:e}}var F=new Map;function Mh(s){let o=new Set,e=!1;for(let t of s){if(/\.(?:css|json|svg|wasm|png|jpe?g|gif|webp|avif|woff2?|ttf|txt|md)$/i.test(t))continue;let n;try{let r=v.statSync(t),i=F.get(t);if(i&&i.mtimeMs===r.mtimeMs&&i.size===r.size)n=i.read;else n=Do(v.readFileSync(t,"utf8")),F.set(t,{mtimeMs:r.mtimeMs,size:r.size,read:n})}catch{n={names:new Set,all:!0}}if(n.all)e=!0;for(let r of n.names)o.add(r)}return{names:o,all:e}}function Dh(s=x.env){return s.STX_PAGE_STORES==="all"}async function Lh(s,o,e={}){let t=await R(s,e.sharedModules);if(!t)return null;let{chunks:n}=t,r=Do(...o);if(e.reads){if(e.reads.all)r.all=!0;for(let u of e.reads.names)r.names.add(u)}let i=e.runOnce?Z(t):void 0,f;if(e.all||r.all||n.some((u)=>u.ids.length===0)||i===null)f=n;else{let u=new Map;for(let d of n)for(let S of d.ids)u.set(S,d);let m=new Set,p=[...r.names],g=!1;while(p.length>0&&!g){let d=u.get(p.pop());if(!d||m.has(d))continue;m.add(d);let S=Do(d.code);if(S.all)g=!0;else p.push(...S.names)}f=g?n:n.filter((d)=>m.has(d))}if(f.length===0)return null;if(i){let u=f.map((d)=>i.get(d)),m=f.map((d)=>d.name),p=O.get(t);if(!p)O.set(t,p=new Map);let g=p.get(m.join("\x00"));if(g===void 0)p.set(m.join("\x00"),g=P(m,u));return{code:g,stores:m,functions:u}}return{code:j(f),stores:f.map((u)=>u.name),functions:E(f)}}var O=new WeakMap,w=new WeakMap;function Z(s){if(w.has(s))return w.get(s);let o=E(s.chunks),e=o?new Map(s.chunks.map((t,n)=>[t,o[n]])):null;return w.set(s,e),e}function P(s,o){let t=`;(function(){
15
+ }`})}var M=new WeakMap;async function Mh(s){let o=await O(s);if(!o)return null;let e=M.get(o);if(e===void 0)e=R(o.chunks),M.set(o,e);return e}function T(s){if(!/\buseStore\b/.test(s))return!1;if(/\buseStore\s+as\s+[A-Za-z_$]/.test(s))return!0;if(/\{[^{}]*\buseStore\s*:\s*[A-Za-z_$[{][^{}]*\}\s*=(?!=)/.test(s))return!0;if(/\[\s*(['"`])useStore\1\s*\]/.test(s.replace(/\b(?:var|let|const)\s+useStore\s*=\s*[\w$.]*\[\s*(['"`])useStore\1\s*\]/g," ")))return!0;let o=s.replace(/\/\*[\s\S]*?\*\//g," ").replace(/(^|[^:\\'"`])\/\/[^\n]*/g,"$1 ").replace(/\b(?:var|let|const)\s+useStore\s*=\s*[\w$.]*\[\s*(['"`])useStore\1\s*\]/g," ").replace(/\b(?:const|let|var)\s*\{[^{}]*\}\s*=/g," ").replace(/\bimport\s*(?:type\s+)?\{[^{}]*\}\s*from\b/g," ").replace(/\bexport\s*(?:type\s+)?\{[^{}]*\}/g," ").replace(/\btypeof\s+useStore\b/g," ").replace(/(['"`])useStore\1/g," ");for(let e of o.matchAll(/\buseStore\b/g)){let t=o.slice(Math.max(0,e.index-9),e.index);if(/\bfunction\s*$/.test(t))continue;let n=o.slice(e.index+8).trimStart();if(n.startsWith("(")||n.startsWith("<")||n.startsWith("?.("))continue;if(/^=(?![=>])/.test(n))continue;return!0}return!1}function Bo(...s){let o=new Set,e=!1;for(let t of s){if(!t)continue;if(/__STX_STORES__|\b_stores\b/.test(t))e=!0;if(T(t))e=!0;let n=t.match(/\buseStore\s*(?:<[^>()]*>)?\s*(?:\?\.\s*)?\(/g)?.length??0;if(n===0)continue;let r=0;for(let i of t.matchAll(/\buseStore\s*(?:<[^>()]*>)?\s*(?:\?\.\s*)?\(\s*(['"`])([^'"`$\\]+)\1\s*[,)]/g))o.add(i[2]),r++;if(r!==n)e=!0}return{names:o,all:e}}var z=new Map;function Dh(s){let o=new Set,e=!1;for(let t of s){if(/\.(?:css|json|svg|wasm|png|jpe?g|gif|webp|avif|woff2?|ttf|txt|md)$/i.test(t))continue;let n;try{let r=v.statSync(t),i=z.get(t);if(i&&i.mtimeMs===r.mtimeMs&&i.size===r.size)n=i.read;else n=Bo(v.readFileSync(t,"utf8")),z.set(t,{mtimeMs:r.mtimeMs,size:r.size,read:n})}catch{n={names:new Set,all:!0}}if(n.all)e=!0;for(let r of n.names)o.add(r)}return{names:o,all:e}}function Lh(s=x.env){return s.STX_PAGE_STORES==="all"}async function jh(s,o,e={}){let t=await O(s,e.sharedModules);if(!t)return null;let{chunks:n}=t,r=Bo(...o);if(e.reads){if(e.reads.all)r.all=!0;for(let u of e.reads.names)r.names.add(u)}let i=e.runOnce?W(t):void 0,f;if(e.all||r.all||n.some((u)=>u.ids.length===0)||i===null)f=n;else{let u=new Map;for(let d of n)for(let S of d.ids)u.set(S,d);let m=new Set,p=[...r.names],g=!1;while(p.length>0&&!g){let d=u.get(p.pop());if(!d||m.has(d))continue;m.add(d);let S=Bo(d.code);if(S.all)g=!0;else p.push(...S.names)}f=g?n:n.filter((d)=>m.has(d))}if(f.length===0)return null;if(i){let u=f.map((d)=>i.get(d)),m=f.map((d)=>d.name),p=F.get(t);if(!p)F.set(t,p=new Map);let g=p.get(m.join("\x00"));if(g===void 0)p.set(m.join("\x00"),g=Z(m,u));return{code:g,stores:m,functions:u}}return{code:R(f),stores:f.map((u)=>u.name),functions:j(f)}}var F=new WeakMap,w=new WeakMap;function W(s){if(w.has(s))return w.get(s);let o=j(s.chunks),e=o?new Map(s.chunks.map((t,n)=>[t,o[n]])):null;return w.set(s,e),e}function Z(s,o){let t=`;(function(){
16
16
  var ran = window.__stxStoreFiles || (window.__stxStoreFiles = {});
17
17
  function run(name, define) {
18
18
  if (ran[name]) return;
@@ -22,5 +22,5 @@ function run(name, define) {
22
22
  }
23
23
  ${s.map((n,r)=>`run(${JSON.stringify(n)}, ${o[r]})`).join(`;
24
24
  `)};
25
- })();`;return I()?et(t):t}function jh(){h.clear(),er()}
26
- export{Nh,Do,Mh,Dh,Lh,jh};
25
+ })();`;return I()?tt(t):t}function Bh(){h.clear(),nr()}
26
+ export{Mh,Bo,Dh,Lh,jh,Bh};
@@ -1,9 +1,9 @@
1
1
  // @bun
2
- import{T}from"./chunk-s29hp1qw.js";import{te}from"./chunk-w50yggy3.js";import{D}from"./chunk-b0jekg4c.js";import De from"path";var n={UNCLOSED_DIRECTIVE:1001,UNCLOSED_EXPRESSION:1002,INVALID_DIRECTIVE_SYNTAX:1003,MALFORMED_EXPRESSION:1004,UNEXPECTED_TOKEN:1005,UNDEFINED_VARIABLE:1101,TYPE_ERROR:1102,EVALUATION_ERROR:1103,INFINITE_LOOP:1104,CIRCULAR_REFERENCE:1105,UNSAFE_EXPRESSION:1201,PATH_TRAVERSAL:1202,XSS_ATTEMPT:1203,CODE_INJECTION:1204,DOM_API_VIOLATION:1205,FILE_NOT_FOUND:1301,FILE_READ_ERROR:1302,INVALID_FILE_PATH:1303,PERMISSION_DENIED:1304,INVALID_CONFIG:1401,MISSING_REQUIRED_CONFIG:1402,DEPRECATED_CONFIG:1403,COMPONENT_NOT_FOUND:1501,INVALID_PROPS:1502,COMPONENT_RENDER_ERROR:1503,FILTER_NOT_FOUND:1601,INVALID_FILTER_ARGS:1602,EXPRESSION_TIMEOUT:1603};function J(e){for(let[t,r]of Object.entries(n))if(r===e)return t;return}import lt from"path";var ut={showRelativePaths:!1,enableAutoRecovery:te(),logRecoveryWarnings:!0},Z={...ut};function P(){return{...Z}}function M(e){if(!Z.showRelativePaths||!e)return e;let t=Z.baseDir||process.cwd();try{let r=lt.relative(t,e);return r.startsWith("..")?e:r}catch{return e}}class L extends Error{code;filePath;line;column;context;numericCode;constructor(e,t,r,i,s,o,a){super(e);this.code=t;this.filePath=r;this.line=i;this.column=s;this.context=o;if(this.name="StxError",this.numericCode=a||n.EVALUATION_ERROR,this.filePath)this.filePath=M(this.filePath)}}class ae extends L{constructor(e,t,r,i,s,o){super(e,"stx_RUNTIME_ERROR",t,r,i,s,o||n.EVALUATION_ERROR);this.name="StxRuntimeError"}}class Br extends L{constructor(e,t,r,i,s,o){super(e,"stx_FILE_ERROR",t,r,i,s,o||n.FILE_NOT_FOUND);this.name="StxFileError"}}class ee extends L{isFatal=!0;constructor(e,t,r,i,s,o){super(e,"stx_VALIDATION_ERROR",t,r,i,s,o||n.DOM_API_VIOLATION);this.name="StxValidationError"}}function be(e){let{type:t,message:r,code:i,filePath:s,line:o,column:a,template:c,offset:g,snippet:l,suggestion:h,format:f="text"}=e,y=o,b=a;if(!y&&c&&g!==void 0){let Y=Et(c,g);y=Y.line,b=Y.column}let w=s?M(s):void 0,x=i?J(i):void 0,R={type:t,code:i,codeName:x,message:r,filePath:w,line:y,column:b,snippet:l,suggestion:h,timestamp:new Date().toISOString()},A;switch(f){case"html":A=pt(R);break;case"json":A=JSON.stringify(R,null,2);break;case"console":A=ft(R,c,g);break;case"text":default:A=gt(R,c,g);break}return{formatted:A,data:R}}function gt(e,t,r){let i=[],s=e.code?` [${e.codeName||e.code}]`:"";if(i.push(`[${e.type} Error${s}]`),e.filePath){let o=e.filePath;if(e.line){if(o+=`:${e.line}`,e.column)o+=`:${e.column}`}i.push(`at ${o}`)}if(i.push(`
2
+ import{T}from"./chunk-0jdz31q1.js";import{ne}from"./chunk-a0aqs5a8.js";import{L}from"./chunk-hxws025y.js";import Fe from"path";var n={UNCLOSED_DIRECTIVE:1001,UNCLOSED_EXPRESSION:1002,INVALID_DIRECTIVE_SYNTAX:1003,MALFORMED_EXPRESSION:1004,UNEXPECTED_TOKEN:1005,UNDEFINED_VARIABLE:1101,TYPE_ERROR:1102,EVALUATION_ERROR:1103,INFINITE_LOOP:1104,CIRCULAR_REFERENCE:1105,UNSAFE_EXPRESSION:1201,PATH_TRAVERSAL:1202,XSS_ATTEMPT:1203,CODE_INJECTION:1204,DOM_API_VIOLATION:1205,FILE_NOT_FOUND:1301,FILE_READ_ERROR:1302,INVALID_FILE_PATH:1303,PERMISSION_DENIED:1304,INVALID_CONFIG:1401,MISSING_REQUIRED_CONFIG:1402,DEPRECATED_CONFIG:1403,COMPONENT_NOT_FOUND:1501,INVALID_PROPS:1502,COMPONENT_RENDER_ERROR:1503,FILTER_NOT_FOUND:1601,INVALID_FILTER_ARGS:1602,EXPRESSION_TIMEOUT:1603};function J(e){for(let[t,r]of Object.entries(n))if(r===e)return t;return}import lt from"path";var ut={showRelativePaths:!1,enableAutoRecovery:ne(),logRecoveryWarnings:!0},Z={...ut};function P(){return{...Z}}function F(e){if(!Z.showRelativePaths||!e)return e;let t=Z.baseDir||process.cwd();try{let r=lt.relative(t,e);return r.startsWith("..")?e:r}catch{return e}}class N extends Error{code;filePath;line;column;context;numericCode;constructor(e,t,r,i,s,o,a){super(e);this.code=t;this.filePath=r;this.line=i;this.column=s;this.context=o;if(this.name="StxError",this.numericCode=a||n.EVALUATION_ERROR,this.filePath)this.filePath=F(this.filePath)}}class ce extends N{constructor(e,t,r,i,s,o){super(e,"stx_RUNTIME_ERROR",t,r,i,s,o||n.EVALUATION_ERROR);this.name="StxRuntimeError"}}class Hr extends N{constructor(e,t,r,i,s,o){super(e,"stx_FILE_ERROR",t,r,i,s,o||n.FILE_NOT_FOUND);this.name="StxFileError"}}class te extends N{isFatal=!0;constructor(e,t,r,i,s,o){super(e,"stx_VALIDATION_ERROR",t,r,i,s,o||n.DOM_API_VIOLATION);this.name="StxValidationError"}}function Ee(e){let{type:t,message:r,code:i,filePath:s,line:o,column:a,template:c,offset:g,snippet:l,suggestion:h,format:f="text"}=e,y=o,b=a;if(!y&&c&&g!==void 0){let Y=ht(c,g);y=Y.line,b=Y.column}let w=s?F(s):void 0,x=i?J(i):void 0,v={type:t,code:i,codeName:x,message:r,filePath:w,line:y,column:b,snippet:l,suggestion:h,timestamp:new Date().toISOString()},C;switch(f){case"html":C=pt(v);break;case"json":C=JSON.stringify(v,null,2);break;case"console":C=ft(v,c,g);break;case"text":default:C=gt(v,c,g);break}return{formatted:C,data:v}}function gt(e,t,r){let i=[],s=e.code?` [${e.codeName||e.code}]`:"";if(i.push(`[${e.type} Error${s}]`),e.filePath){let o=e.filePath;if(e.line){if(o+=`:${e.line}`,e.column)o+=`:${e.column}`}i.push(`at ${o}`)}if(i.push(`
3
3
  ${e.message}`),t&&e.line){let o=dt(t,e.line,2);if(o)i.push(`
4
4
  ${o}`)}if(e.snippet)i.push(`
5
5
  Snippet: ${e.snippet}`);if(e.suggestion)i.push(`
6
- Suggestion: ${e.suggestion}`);return i.join(" ")}function pt(e){let t=e.code?` [${e.code}]`:"",r=e.filePath?` in ${e.filePath}${e.line?`:${e.line}`:""}`:"",i=`<!-- [${e.type} Error${t}]${r}: ${Ee(e.message)}`;if(e.suggestion)i+=` | Suggestion: ${Ee(e.suggestion)}`;return i+=" -->",i}function ft(e,t,r){let l=[],h=e.code?` [${e.codeName||e.code}]`:"";if(l.push(`\x1B[1m${"\x1B[31m"}\u2501\u2501\u2501 ${e.type} Error${h} \u2501\u2501\u2501${"\x1B[0m"}`),e.filePath){let f=`\x1B[36m${e.filePath}\x1B[0m`;if(e.line){if(f+=`\x1B[90m:${e.line}\x1B[0m`,e.column)f+=`\x1B[90m:${e.column}\x1B[0m`}l.push(`
6
+ Suggestion: ${e.suggestion}`);return i.join(" ")}function pt(e){let t=e.code?` [${e.code}]`:"",r=e.filePath?` in ${e.filePath}${e.line?`:${e.line}`:""}`:"",i=`<!-- [${e.type} Error${t}]${r}: ${ye(e.message)}`;if(e.suggestion)i+=` | Suggestion: ${ye(e.suggestion)}`;return i+=" -->",i}function ft(e,t,r){let l=[],h=e.code?` [${e.codeName||e.code}]`:"";if(l.push(`\x1B[1m${"\x1B[31m"}\u2501\u2501\u2501 ${e.type} Error${h} \u2501\u2501\u2501${"\x1B[0m"}`),e.filePath){let f=`\x1B[36m${e.filePath}\x1B[0m`;if(e.line){if(f+=`\x1B[90m:${e.line}\x1B[0m`,e.column)f+=`\x1B[90m:${e.column}\x1B[0m`}l.push(`
7
7
  \x1B[90mat\x1B[0m ${f}`)}if(l.push(`
8
8
 
9
9
  ${e.message}`),t&&e.line){let f=mt(t,e.line,2);if(f)l.push(`
@@ -16,18 +16,18 @@ ${"\x1B[31m"}\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\
16
16
  `),s=Math.max(0,t-r-1),o=Math.min(i.length-1,t+r-1),a=[];for(let c=s;c<=o;c++){let g=(c+1).toString().padStart(4),l=c===t-1?">":" ";a.push(`${l}${g} | ${i[c]}`)}return a.join(`
17
17
  `)}function mt(e,t,r){let i=e.split(`
18
18
  `),s=Math.max(0,t-r-1),o=Math.min(i.length-1,t+r-1),a="\x1B[90m",c="\x1B[31m",g="\x1B[0m",l=[];for(let h=s;h<=o;h++){let f=(h+1).toString().padStart(4),y=h===t-1,b=y?"\x1B[31m>\x1B[0m":" ",w=y?`\x1B[31m${i[h]}\x1B[0m`:`\x1B[90m${i[h]}\x1B[0m`;l.push(`${b}\x1B[90m${f}\x1B[0m | ${w}`)}return l.join(`
19
- `)}function Ee(e){return e.replace(/--/g,"- -").replace(/>/g,"&gt;")}function Et(e,t){let i=e.substring(0,t).split(`
20
- `);return{line:i.length,column:i[i.length-1].length}}function u(e,t,r){return be({type:e,message:t,code:r,format:"html"}).formatted}async function Ne(e,t,r){try{return await e()}catch(i){if(r&&i instanceof Error)r(i);return t}}var qi={isEnabled(){return P().enableAutoRecovery},fixCommonSyntaxErrors(e){let t=P();if(!t.enableAutoRecovery)return{fixed:e,fixes:[]};let r=e,i=[],s=(r.match(/\{\{/g)||[]).length,o=(r.match(/\}\}/g)||[]).length;if(s>o){let c=s-o;r+="}}".repeat(c),i.push(`Added ${c} missing closing braces '}}'`)}let a=["if","foreach","for","switch","section"];for(let c of a){let g=(r.match(new RegExp(`@${c}\\b`,"g"))||[]).length,l=(r.match(new RegExp(`@end${c}\\b`,"g"))||[]).length;if(g>l){let h=g-l;for(let f=0;f<h;f++)r+=`
21
- @end${c}`;i.push(`Added ${h} missing @end${c}`)}}if(i.length>0&&t.logRecoveryWarnings)console.warn("[stx] Auto-recovery applied fixes:"),i.forEach((c)=>console.warn(` - ${c}`)),console.warn(" Consider fixing these issues in your template.");return{fixed:r,fixes:i}},createFallbackContent(e,t){if(te())return`<!-- ${e} failed: ${t.message} -->`;return"<!-- stx rendering error -->"}};class Q{errors=[];maxErrors;enableFileLogging;logFilePath;logFormat;maxFileSize;maxLogFiles;minLevel;writeQueue=Promise.resolve();constructor(e={}){this.maxErrors=e.maxErrors??1000,this.enableFileLogging=e.enableFileLogging??!1,this.logFilePath=e.logFilePath??".stx/errors.log",this.logFormat=e.logFormat??"json",this.maxFileSize=e.maxFileSize??10485760,this.maxLogFiles=e.maxLogFiles??5,this.minLevel=e.minLevel??"all"}configure(e){if(e.maxErrors!==void 0)this.maxErrors=e.maxErrors;if(e.enableFileLogging!==void 0)this.enableFileLogging=e.enableFileLogging;if(e.logFilePath!==void 0)this.logFilePath=e.logFilePath;if(e.logFormat!==void 0)this.logFormat=e.logFormat;if(e.maxFileSize!==void 0)this.maxFileSize=e.maxFileSize;if(e.maxLogFiles!==void 0)this.maxLogFiles=e.maxLogFiles;if(e.minLevel!==void 0)this.minLevel=e.minLevel}log(e,t,r="error"){let i={timestamp:new Date,error:e,context:t,level:r};if(this.errors.push(i),this.errors.length>this.maxErrors)this.errors=this.errors.slice(-this.maxErrors);if(this.enableFileLogging&&this.shouldLog(r))this.writeToFile(i)}shouldLog(e){if(this.minLevel==="all")return!0;if(this.minLevel==="warning")return e==="error"||e==="warning";if(this.minLevel==="error")return e==="error";return!0}formatEntry(e){if(this.logFormat==="json")return JSON.stringify({timestamp:e.timestamp.toISOString(),level:e.level||"error",type:e.error.constructor.name,message:e.error.message,stack:e.error.stack,context:e.context});let t=[`[${e.timestamp.toISOString()}] [${(e.level||"error").toUpperCase()}] ${e.error.constructor.name}: ${e.error.message}`];if(e.error.stack)t.push(` Stack: ${e.error.stack.split(`
19
+ `)}function ye(e){return e.replace(/--/g,"- -").replace(/>/g,"&gt;")}function ht(e,t){let i=e.substring(0,t).split(`
20
+ `);return{line:i.length,column:i[i.length-1].length}}function u(e,t,r){return Ee({type:e,message:t,code:r,format:"html"}).formatted}async function Me(e,t,r){try{return await e()}catch(i){if(r&&i instanceof Error)r(i);return t}}var Xi={isEnabled(){return P().enableAutoRecovery},fixCommonSyntaxErrors(e){let t=P();if(!t.enableAutoRecovery)return{fixed:e,fixes:[]};let r=e,i=[],s=(r.match(/\{\{/g)||[]).length,o=(r.match(/\}\}/g)||[]).length;if(s>o){let c=s-o;r+="}}".repeat(c),i.push(`Added ${c} missing closing braces '}}'`)}let a=["if","foreach","for","switch","section"];for(let c of a){let g=(r.match(new RegExp(`@${c}\\b`,"g"))||[]).length,l=(r.match(new RegExp(`@end${c}\\b`,"g"))||[]).length;if(g>l){let h=g-l;for(let f=0;f<h;f++)r+=`
21
+ @end${c}`;i.push(`Added ${h} missing @end${c}`)}}if(i.length>0&&t.logRecoveryWarnings)console.warn("[stx] Auto-recovery applied fixes:"),i.forEach((c)=>console.warn(` - ${c}`)),console.warn(" Consider fixing these issues in your template.");return{fixed:r,fixes:i}},createFallbackContent(e,t){if(ne())return`<!-- ${e} failed: ${t.message} -->`;return"<!-- stx rendering error -->"}};class Q{errors=[];maxErrors;enableFileLogging;logFilePath;logFormat;maxFileSize;maxLogFiles;minLevel;writeQueue=Promise.resolve();constructor(e={}){this.maxErrors=e.maxErrors??1000,this.enableFileLogging=e.enableFileLogging??!1,this.logFilePath=e.logFilePath??".stx/errors.log",this.logFormat=e.logFormat??"json",this.maxFileSize=e.maxFileSize??10485760,this.maxLogFiles=e.maxLogFiles??5,this.minLevel=e.minLevel??"all"}configure(e){if(e.maxErrors!==void 0)this.maxErrors=e.maxErrors;if(e.enableFileLogging!==void 0)this.enableFileLogging=e.enableFileLogging;if(e.logFilePath!==void 0)this.logFilePath=e.logFilePath;if(e.logFormat!==void 0)this.logFormat=e.logFormat;if(e.maxFileSize!==void 0)this.maxFileSize=e.maxFileSize;if(e.maxLogFiles!==void 0)this.maxLogFiles=e.maxLogFiles;if(e.minLevel!==void 0)this.minLevel=e.minLevel}log(e,t,r="error"){let i={timestamp:new Date,error:e,context:t,level:r};if(this.errors.push(i),this.errors.length>this.maxErrors)this.errors=this.errors.slice(-this.maxErrors);if(this.enableFileLogging&&this.shouldLog(r))this.writeToFile(i)}shouldLog(e){if(this.minLevel==="all")return!0;if(this.minLevel==="warning")return e==="error"||e==="warning";if(this.minLevel==="error")return e==="error";return!0}formatEntry(e){if(this.logFormat==="json")return JSON.stringify({timestamp:e.timestamp.toISOString(),level:e.level||"error",type:e.error.constructor.name,message:e.error.message,stack:e.error.stack,context:e.context});let t=[`[${e.timestamp.toISOString()}] [${(e.level||"error").toUpperCase()}] ${e.error.constructor.name}: ${e.error.message}`];if(e.error.stack)t.push(` Stack: ${e.error.stack.split(`
22
22
  `).slice(1).join(`
23
23
  `)}`);if(e.context)t.push(` Context: ${JSON.stringify(e.context)}`);return t.join(`
24
24
  `)}writeToFile(e){this.writeQueue=this.writeQueue.then(async()=>{try{let t=await import("fs"),r=await import("path"),i=r.dirname(this.logFilePath);if(!t.existsSync(i))t.mkdirSync(i,{recursive:!0});await this.rotateIfNeeded(t);let s=`${this.formatEntry(e)}
25
25
  `;t.appendFileSync(this.logFilePath,s,"utf-8")}catch(t){if(process.env.STX_DEBUG==="true")console.error("Failed to write to error log:",t)}})}async rotateIfNeeded(e){try{if(!e.existsSync(this.logFilePath))return;if(e.statSync(this.logFilePath).size<this.maxFileSize)return;for(let r=this.maxLogFiles-1;r>=1;r--){let i=`${this.logFilePath}.${r}`,s=`${this.logFilePath}.${r+1}`;if(e.existsSync(i))if(r>=this.maxLogFiles-1)e.unlinkSync(i);else e.renameSync(i,s)}if(this.maxLogFiles<=1)e.writeFileSync(this.logFilePath,"");else e.renameSync(this.logFilePath,`${this.logFilePath}.1`)}catch(t){if(process.env.STX_DEBUG==="true")console.error("Failed to rotate error logs:",t)}}getRecentErrors(e=10){return this.errors.slice(-e)}getErrorsByType(e){return this.errors.filter((t)=>t.error.constructor.name===e)}getErrorsByLevel(e){return this.errors.filter((t)=>t.level===e)}clear(){this.errors.length=0}async clearLogFile(){try{let e=await import("fs");if(e.existsSync(this.logFilePath))e.writeFileSync(this.logFilePath,"","utf-8")}catch(e){if(process.env.STX_DEBUG==="true")console.error("Failed to clear error log:",e)}}getStats(){let e={},t={error:0,warning:0,info:0};for(let r of this.errors){let i=r.error.constructor.name;e[i]=(e[i]||0)+1;let s=r.level||"error";t[s]=(t[s]||0)+1}return{total:this.errors.length,byType:e,byLevel:t}}async exportToFile(e,t="json"){let r=await import("fs"),i=await import("path"),s=i.dirname(e);if(!r.existsSync(s))r.mkdirSync(s,{recursive:!0});if(t==="json"){let o=this.errors.map((a)=>({timestamp:a.timestamp.toISOString(),level:a.level||"error",type:a.error.constructor.name,message:a.error.message,stack:a.error.stack,context:a.context}));r.writeFileSync(e,JSON.stringify(o,null,2),"utf-8")}else{let o=this.errors.map((a)=>this.formatEntry(a));r.writeFileSync(e,o.join(`
26
26
 
27
- `),"utf-8")}}async flush(){await this.writeQueue}}var K=new Q,Mn={isDevelopment(){return te()},logDetailedError(e,t){if(!this.isDevelopment())return;if(console.error("=== stx Detailed Error ==="),console.error("Error:",e.message),console.error("Stack:",e.stack),t)console.error("Context:",t);console.error("========================")},createErrorReport(e,t){let r=["=== stx Error Report ===",`Time: ${new Date().toISOString()}`,`Error: ${e.message}`,`Type: ${e.constructor.name}`,`Stack: ${e.stack}`];if(t)r.push(`Context: ${JSON.stringify(t,null,2)}`);return r.push("========================"),r.join(`
28
- `)}};class Ki{source;pos=0;line=1;column=0;tokens=[];constructor(e){this.source=e}tokenize(){this.tokens=[],this.pos=0,this.line=1,this.column=0;while(this.pos<this.source.length){let e=this.nextToken();if(e)this.tokens.push(e)}return this.tokens.push({type:"EOF",value:"",start:this.pos,end:this.pos,line:this.line,column:this.column}),this.tokens}nextToken(){if(this.pos>=this.source.length)return null;let e=this.pos,t=this.line,r=this.column,i=this.source[this.pos];if(/\s/.test(i))return this.readWhitespace(e,t,r);if(i==="/"&&this.peek(1)==="/")return this.readLineComment(e,t,r);if(i==="/"&&this.peek(1)==="*")return this.readBlockComment(e,t,r);if(i==='"'||i==="'")return this.readString(i,e,t,r);if(i==="`")return this.readTemplateString(e,t,r);if(/\d/.test(i)||i==="."&&/\d/.test(this.peek(1)||""))return this.readNumber(e,t,r);if(/[a-z_$]/i.test(i))return this.readIdentifier(e,t,r);if(i==="{"){if(this.peek(1)==="{"&&this.peek(2)==="{")return this.advance(3),{type:"RAW_START",value:"{{{",start:e,end:this.pos,line:t,column:r};if(this.peek(1)==="{")return this.advance(2),{type:"EXPRESSION_START",value:"{{",start:e,end:this.pos,line:t,column:r};if(this.peek(1)==="!"&&this.peek(2)==="!")return this.advance(3),{type:"RAW_START",value:"{!!",start:e,end:this.pos,line:t,column:r}}if(i==="}"){if(this.peek(1)==="}"&&this.peek(2)==="}")return this.advance(3),{type:"RAW_END",value:"}}}",start:e,end:this.pos,line:t,column:r};if(this.peek(1)==="}")return this.advance(2),{type:"EXPRESSION_END",value:"}}",start:e,end:this.pos,line:t,column:r}}if(i==="!"&&this.peek(1)==="!"&&this.peek(2)==="}")return this.advance(3),{type:"RAW_END",value:"!!}",start:e,end:this.pos,line:t,column:r};if(i==="@"&&/[a-z]/i.test(this.peek(1)||""))return this.readDirective(e,t,r);let s=["===","!==","==","!=","<=",">=","&&","||","??","++","--","+=","-=","*=","/=","%=","**","=>","?.","...","<<",">>",">>>","&=","|=","^="];for(let o of s)if(this.source.slice(this.pos,this.pos+o.length)===o)return this.advance(o.length),{type:"OPERATOR",value:o,start:e,end:this.pos,line:t,column:r};if(/[+\-*/%<>=!&|^~?:]/.test(i))return this.advance(),{type:"OPERATOR",value:i,start:e,end:this.pos,line:t,column:r};if(/[()[\]{},;.]/.test(i))return this.advance(),{type:"PUNCTUATION",value:i,start:e,end:this.pos,line:t,column:r};return this.advance(),{type:"PUNCTUATION",value:i,start:e,end:this.pos,line:t,column:r}}readWhitespace(e,t,r){while(this.pos<this.source.length&&/\s/.test(this.source[this.pos]))this.advance();return{type:"WHITESPACE",value:this.source.slice(e,this.pos),start:e,end:this.pos,line:t,column:r}}readLineComment(e,t,r){this.advance(2);while(this.pos<this.source.length&&this.source[this.pos]!==`
29
- `)this.advance();return{type:"COMMENT",value:this.source.slice(e,this.pos),start:e,end:this.pos,line:t,column:r}}readBlockComment(e,t,r){this.advance(2);while(this.pos<this.source.length-1){if(this.source[this.pos]==="*"&&this.source[this.pos+1]==="/"){this.advance(2);break}this.advance()}return{type:"COMMENT",value:this.source.slice(e,this.pos),start:e,end:this.pos,line:t,column:r}}readString(e,t,r,i){this.advance();while(this.pos<this.source.length){let s=this.source[this.pos];if(s==="\\"){this.advance(2);continue}if(s===e){this.advance();break}this.advance()}return{type:"STRING",value:this.source.slice(t,this.pos),start:t,end:this.pos,line:r,column:i}}readTemplateString(e,t,r){this.advance();let i=0,s=256;while(this.pos<this.source.length){let o=this.source[this.pos];if(o==="\\"){this.advance(2);continue}if(o==="$"&&this.peek(1)==="{"){if(i>=s){this.pos=this.source.length;break}this.advance(2),i++;continue}if(o==="{"&&i>0){i++,this.advance();continue}if(o==="}"&&i>0){i--,this.advance();continue}if(o==="`"&&i===0){this.advance();break}this.advance()}return{type:"TEMPLATE_STRING",value:this.source.slice(e,this.pos),start:e,end:this.pos,line:t,column:r}}readNumber(e,t,r){if(this.source[this.pos]==="0"){let i=this.peek(1)?.toLowerCase();if(i==="x"||i==="o"||i==="b"){this.advance(2);while(this.pos<this.source.length&&/[\da-f_]/i.test(this.source[this.pos]))this.advance();return{type:"NUMBER",value:this.source.slice(e,this.pos),start:e,end:this.pos,line:t,column:r}}}while(this.pos<this.source.length&&/[\d_]/.test(this.source[this.pos]))this.advance();if(this.source[this.pos]==="."&&/\d/.test(this.peek(1)||"")){this.advance();while(this.pos<this.source.length&&/[\d_]/.test(this.source[this.pos]))this.advance()}if(/e/i.test(this.source[this.pos]||"")){if(this.advance(),/[+-]/.test(this.source[this.pos]||""))this.advance();while(this.pos<this.source.length&&/[\d_]/.test(this.source[this.pos]))this.advance()}if(this.source[this.pos]==="n")this.advance();return{type:"NUMBER",value:this.source.slice(e,this.pos),start:e,end:this.pos,line:t,column:r}}readIdentifier(e,t,r){while(this.pos<this.source.length&&/[\w$]/.test(this.source[this.pos]))this.advance();return{type:"IDENTIFIER",value:this.source.slice(e,this.pos),start:e,end:this.pos,line:t,column:r}}readDirective(e,t,r){this.advance();while(this.pos<this.source.length&&/[a-z]/i.test(this.source[this.pos]))this.advance();return{type:"DIRECTIVE",value:this.source.slice(e,this.pos),start:e,end:this.pos,line:t,column:r}}advance(e=1){for(let t=0;t<e&&this.pos<this.source.length;t++){if(this.source[this.pos]===`
30
- `)this.line++,this.column=0;else this.column++;this.pos++}}peek(e){return this.source[this.pos+e]}saveState(){return{pos:this.pos,line:this.line,column:this.column}}restoreState(e){this.pos=e.pos,this.line=e.line,this.column=e.column}}function k(e,t,r,i=0){let s=0,o=i,a=null,c=0,g=!1;while(o<e.length){let l=e[o];if(a&&g){g=!1,o++;continue}if(a&&l==="\\"){g=!0,o++;continue}if(g=!1,(l==='"'||l==="'"||l==="`")&&!a){a=l,o++;continue}if(l===a&&a!=="`"){a=null,o++;continue}if(a==="`"&&l==="$"&&e[o+1]==="{"){c++,o+=2;continue}if(c>0&&l==="}"){c--,o++;continue}if(l==="`"&&a==="`"&&c===0){a=null,o++;continue}if(a){o++;continue}if(l===t)s++;else if(l===r){if(s--,s===0)return o}o++}return-1}function $l(e,t){let r=t,i={paren:0,bracket:0,brace:0},s=null,o=0;while(r<e.length){let a=e[r];if((r>0?e[r-1]:"")==="\\"&&s){r++;continue}if((a==='"'||a==="'")&&!s){s=a,r++;continue}if(a===s&&s!=="`"){s=null,r++;continue}if(a==="`"&&!s){s="`",r++;continue}if(a==="`"&&s==="`"&&o===0){s=null,r++;continue}if(s==="`"&&a==="$"&&e[r+1]==="{"){o++,r+=2;continue}if(o>0){if(a==="{")o++;else if(a==="}")o--;r++;continue}if(s){r++;continue}if(i.paren===0&&i.bracket===0&&i.brace===0){if(e.slice(r,r+2)==="}}"||e.slice(r,r+3)==="!!}")break;if(a===","||a===";")break}if(a==="(")i.paren++;else if(a===")"){if(i.paren--,i.paren<0)break}else if(a==="[")i.bracket++;else if(a==="]"){if(i.bracket--,i.bracket<0)break}else if(a==="{")i.brace++;else if(a==="}"){if(i.brace--,i.brace<0)break}r++}return{expression:e.slice(t,r),endPos:r}}var xt={maxSanitizeDepth:10,allowBracketNotation:!1},Ce={...xt};var H=/\bnew\s+/,U="__stx_safe_ctors",Te=["Bun","Deno","Buffer","fetch","atob","btoa","console","Response","Request","Headers","WebAssembly","structuredClone","queueMicrotask","crypto","performance","navigator","Worker","WebSocket","BroadcastChannel","EventSource","XMLHttpRequest","localStorage","sessionStorage"],ne=[...Te,"Function","setTimeout","setInterval","setImmediate","process","require","exports","module","window","document","global","globalThis","Reflect","Proxy","Symbol","WeakMap","WeakSet","WeakRef","FinalizationRegistry"],xe=ne.map(()=>{return}),re=Object.freeze(Object.assign(Object.create(null),{keys:Object.keys,values:Object.values,entries:Object.entries,fromEntries:Object.fromEntries,assign:Object.assign,hasOwn:Object.hasOwn,is:Object.is})),se=[/\b(eval|Function|setTimeout|setInterval|setImmediate)\b/,/\b(process|require|import|exports|module)\b/,/\b(window|document|global|globalThis)\b/,/\b(constructor|prototype|__proto__)\b/,/\b(Reflect|Proxy)\b/,/\bSymbol\b/,/\b(WeakMap|WeakSet|WeakRef|FinalizationRegistry)\b/,/\b(Generator|AsyncGenerator)\b/,/__\w+__/,/\.(bind|call|apply)\s*\(/,H,/\bdelete\s+/,/\bthis\b/,/\\u(?:\{[\dA-Fa-f]+\}|[\dA-Fa-f]{4})/],oe=new Set([...Te,"eval","Function","setTimeout","setInterval","setImmediate","process","require","import","exports","module","window","document","global","globalThis","constructor","prototype","Reflect","Proxy","Symbol","WeakMap","WeakSet","WeakRef","FinalizationRegistry","Generator","AsyncGenerator","delete","this",U]),ce=new Set(["__proto__","constructor","prototype"]);function Ae(e){let t="",r=[],i=null,s=!1;for(let o=0;o<e.length;o++){let a=e[o];if(s){s=!1;continue}if(a==="\\"&&i){s=!0;continue}if(i){if(i==="`"&&a==="$"&&o+1<e.length&&e[o+1]==="{"){let c=1;o+=2;while(o<e.length&&c>0){if(e[o]==="{")c++;else if(e[o]==="}")c--;if(c>0)t+=e[o],r.push(o),o++}continue}if(a===i)i=null;continue}if(a==='"'||a==="'"||a==="`"){i=a;continue}t+=a,r.push(o)}return{text:t,map:r}}function _e(e){return Ae(e).text}var Ie=["Collator","DateTimeFormat","DisplayNames","ListFormat","Locale","NumberFormat","PluralRules","RelativeTimeFormat","Segmenter"],Oe=(()=>{let e={Date,URL,URLSearchParams},t=Intl;for(let r of Ie)if(typeof t[r]==="function")e[`Intl_${r}`]=t[r];return Object.freeze(Object.assign(Object.create(null),e))})(),wt=/^new(\s+)(Date|URLSearchParams|URL|Intl\s*\.\s*([A-Z_a-z]\w*))\s*\(/,we=/(?<![\w$])new(?![\w$])/g,Se=`only new Date(), new URL(), new URLSearchParams() and new Intl.{${Ie.join(",")}}() are allowed`;function St(e){let{text:t,map:r}=Ae(e),i=[];we.lastIndex=0;let s;while((s=we.exec(t))!==null){let a=s.index;if(/(?<!\.)\.\s*$/.test(t.slice(0,a)))continue;let c=wt.exec(t.slice(a)),g=c?.[3],l=!c?null:g?`Intl_${g}`:c[2];if(!c||!l||!(l in Oe))throw new S(`matched /${H.source}/; ${Se}`,e);let h=a+c[0].length,f=r[a],y=r[h-1]+1;if(e.slice(f,y)!==t.slice(a,h))throw new S(`matched /${H.source}/; ${Se}`,e);let b=f+3+c[1].length;i.push({start:b,end:b+c[2].length,key:l})}let o=e;for(let a=i.length-1;a>=0;a--){let c=i[a];o=`${o.slice(0,c.start)}${U}.${c.key}${o.slice(c.end)}`}return{source:o,usesSafeConstructors:i.length>0}}class S extends Error{rule;expression;constructor(e,t,r){super(r??`Potentially unsafe expression (${e}): ${t}`);this.name="UnsafeExpressionError",this.rule=e,this.expression=t}}function co(e){try{return le(e),null}catch(t){return t instanceof S?t.rule:t instanceof Error?t.message:String(t)}}function Le(e,t){let r=/[$A-Z_a-z][$\w]*/g,i;while((i=r.exec(e))!==null){let s=i[0],o=e[i.index-1];if(oe.has(s))throw new S(`matched /\\b${s}\\b/; identifier ${s}`,t);if(o==="."&&ce.has(s))throw new S(`matched /.${s}/; property ${s}`,t)}}function Pe(e,t=!0){let r=/(?:[$\w)\].]|\?\.)\s*\[([^\]]*)\]/g,i=new Set,s;while((s=r.exec(e))!==null){let o=s.index+s[0].indexOf("["),a=e.slice(0,o);if(/(?:^|[^$\w])(?:let|const|var)\s*$/.test(a))continue;let c=s[1].trim(),g=/^'(?:[^'\\]|\\.)*'$/.test(c),l=/^"(?:[^"\\]|\\.)*"$/.test(c);if(/^\d+$/.test(c))continue;if(g||l){let f=c.slice(1,-1);if(ce.has(f))throw new S(`bracket key ${f}`,e);if(!Ce.allowBracketNotation)throw new S("bracket notation with a string key; enable with configureSafeEvaluator({ allowBracketNotation: true })",e,`Bracket notation with strings not allowed: ${e}. Enable with configureSafeEvaluator({ allowBracketNotation: true })`);continue}if(t&&/^[$A-Z_a-z][$\w]*$/.test(c)){i.add(c);continue}throw new S("dynamic bracket notation is not allowed",e)}return[...i]}function le(e){let t=e.trim(),r=_e(t);Le(r,t);let i=Pe(t);for(let s of se){if(s===H)continue;if(s.test(r))throw new S(`matched /${s.source}/`,t)}return{...St(t),dynamicKeys:i}}function Wi(e){return le(e),e.trim()}var lo=Symbol("stx.sanitizeCache"),kt=4000,F=new Map;function vt(e){let t=F.get(e);if(t===void 0){if(t=se.some((r)=>r.test(e)),F.size>=kt)F.clear();F.set(e,t)}return t}function V(e){let t={},r=e[lo];t.Math=Math,t.JSON=JSON,t.Date=Date,t.String=String,t.Number=Number,t.Boolean=Boolean,t.Array=Array,t.Object=re,t.parseInt=Number.parseInt,t.parseFloat=Number.parseFloat,t.isNaN=Number.isNaN,t.isFinite=Number.isFinite,t.encodeURIComponent=encodeURIComponent,t.decodeURIComponent=decodeURIComponent;for(let[i,s]of Object.entries(e)){if(i.startsWith("__")||vt(i))continue;if(s&&typeof s==="object"&&!Array.isArray(s)){let o=r?.get(s);if(o===void 0)o=ie(s),r?.set(s,o);t[i]=o}else t[i]=s}return t}function ie(e,t=0){if(t>=Ce.maxSanitizeDepth)return"[Object too deep]";if(e===null||typeof e!=="object")return e;if(Array.isArray(e))return e.map((i)=>ie(i,t+1));if(e instanceof Date||e instanceof RegExp||e instanceof Map||e instanceof Set||e instanceof Error)return e;let r={};for(let[i,s]of Object.entries(e)){if(i.startsWith("__")||i==="constructor"||i==="prototype")continue;if(s&&typeof s==="object")r[i]=ie(s,t+1);else r[i]=s}return r}function d(e,t){try{let r=V(t),i=Object.keys(r),s=Object.values(r);return p(e,i)(...s)}catch{return}}function m(e){try{return Wi(e),!0}catch{return!1}}var j=new Set;function $t(e,t,r){if(!t.startsWith("__")||!(t in r))return;let i=`${t}\x00${e}`;if(j.has(i))return;if(j.add(i),j.size>500)j.clear();console.warn(`[stx] a condition reads \`${t}\`, which conditions cannot see, so \`${e.trim()}\` is false and nothing it guards is rendered. Names starting with \`__\` are withheld from @if, @elseif and @unless. Derive a plain value in the server script (for example \`const hasRows = ${t}.length > 0\`) and test that instead.`)}function Tl(e,t){try{let r=V(t),i=Object.keys(r),s=Object.values(r),o=!1,c=p(e,i,(g)=>{o=!0,$t(e,g,t)})(...s);return!o&&Boolean(c)}catch{return!1}}function N(e,t){try{let r=d(e,t);if(r&&typeof r==="object"&&!Array.isArray(r))return r;return{}}catch{return{}}}var Fe=new Set(["break","case","catch","class","const","continue","debugger","default","delete","do","else","enum","export","extends","false","finally","for","function","if","import","in","instanceof","new","null","return","super","switch","this","throw","true","try","typeof","var","void","while","with","yield","let","static","implements","interface","package","private","protected","public","arguments","eval","await"]),ke=`stx-compile-probe:${globalThis.crypto.randomUUID()}`,Rt=0,Ct=0;function Tt(e,t){let r="__stx_compile_probe";while(e.includes(r))r+="_";let i=Array.from({length:e.length+1});i[e.length]=ke;for(let s=0;s<16;s++){let o=`c${++Rt}`,a=`'use strict';if(${r}===${JSON.stringify(ke)})return ${JSON.stringify(o)};`,c=Function(...e,r,a+t);if(c(...i)===o)return c;Ct++}throw Error("[stx] the JavaScript runtime repeatedly returned code compiled from a different source; refusing to evaluate with it.")}var At=2000,B=new Map;function ve(e,t){let r=`${e.join(",")}\x00${t}`,i=B.get(r);if(i)return i;let s=Tt(e,t);if(B.size>=At)B.clear();return B.set(r,s),s}function ht(e){return e.replace(/'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`(?:[^`\\]|\\.)*`/g," ").replace(/\??\.\s*[a-zA-Z_$][\w$]*/g," ").replace(/([{,]\s*)[a-zA-Z_$][\w$]*(\s*:)/g,"$1$2").match(/\b[a-zA-Z_$][\w$]*\b/g)||[]}var _t=/^[A-Za-z_$][\w$]*$/;function Xt(e){return _t.test(e)&&!Fe.has(e)}var $e=new T(2000,{maxBytes:2097152,sizeOf:(e)=>e.sourceBytes});function p(e,t,r){let i=JSON.stringify([e,t]),s=$e.get(i);if(!s)s=It(e,[...t]),s.sourceBytes+=i.length*2,$e.set(i,s);return Ot(Nt(s.buildFunc,s.filteredKeys,s.contextKeys,s.validEntries,s.validIndices,r),s.contextKeys,s.dynamicKeys)}function It(e,t){let{source:r,usesSafeConstructors:i,dynamicKeys:s}=le(e),o=[];for(let f=0;f<t.length;f++){if(!Xt(t[f]))continue;if(t[f]===U||t[f]==="Object"||oe.has(t[f]))continue;o.push({key:t[f],index:f})}o.sort((f,y)=>f.key<y.key?-1:1);let a=o.map((f)=>f.key),c=o.map((f)=>f.index),g=`
27
+ `),"utf-8")}}async flush(){await this.writeQueue}}var K=new Q,Dn={isDevelopment(){return ne()},logDetailedError(e,t){if(!this.isDevelopment())return;if(console.error("=== stx Detailed Error ==="),console.error("Error:",e.message),console.error("Stack:",e.stack),t)console.error("Context:",t);console.error("========================")},createErrorReport(e,t){let r=["=== stx Error Report ===",`Time: ${new Date().toISOString()}`,`Error: ${e.message}`,`Type: ${e.constructor.name}`,`Stack: ${e.stack}`];if(t)r.push(`Context: ${JSON.stringify(t,null,2)}`);return r.push("========================"),r.join(`
28
+ `)}};class be{context;source;pos=0;line=1;column=0;tokens=[];constructor(e,t="template"){this.context=t;this.source=e}tokenize(){this.tokens=[],this.pos=0,this.line=1,this.column=0;while(this.pos<this.source.length){let e=this.nextToken();if(e)this.tokens.push(e)}return this.tokens.push({type:"EOF",value:"",start:this.pos,end:this.pos,line:this.line,column:this.column}),this.tokens}nextToken(){if(this.pos>=this.source.length)return null;let e=this.pos,t=this.line,r=this.column,i=this.source[this.pos];if(/\s/.test(i))return this.readWhitespace(e,t,r);if(i==="/"&&this.peek(1)==="/")return this.readLineComment(e,t,r);if(i==="/"&&this.peek(1)==="*")return this.readBlockComment(e,t,r);if(i==='"'||i==="'")return this.readString(i,e,t,r);if(i==="`")return this.readTemplateString(e,t,r);if(/\d/.test(i)||i==="."&&/\d/.test(this.peek(1)||""))return this.readNumber(e,t,r);if(/[a-z_$]/i.test(i))return this.readIdentifier(e,t,r);if(this.context==="template"&&i==="{"){if(this.peek(1)==="{"&&this.peek(2)==="{")return this.advance(3),{type:"RAW_START",value:"{{{",start:e,end:this.pos,line:t,column:r};if(this.peek(1)==="{")return this.advance(2),{type:"EXPRESSION_START",value:"{{",start:e,end:this.pos,line:t,column:r};if(this.peek(1)==="!"&&this.peek(2)==="!")return this.advance(3),{type:"RAW_START",value:"{!!",start:e,end:this.pos,line:t,column:r}}if(this.context==="template"&&i==="}"){if(this.peek(1)==="}"&&this.peek(2)==="}")return this.advance(3),{type:"RAW_END",value:"}}}",start:e,end:this.pos,line:t,column:r};if(this.peek(1)==="}")return this.advance(2),{type:"EXPRESSION_END",value:"}}",start:e,end:this.pos,line:t,column:r}}if(this.context==="template"&&i==="!"&&this.peek(1)==="!"&&this.peek(2)==="}")return this.advance(3),{type:"RAW_END",value:"!!}",start:e,end:this.pos,line:t,column:r};if(i==="@"&&/[a-z]/i.test(this.peek(1)||""))return this.readDirective(e,t,r);let s=["===","!==","==","!=","<=",">=","&&","||","??","++","--","+=","-=","*=","/=","%=","**","=>","?.","...","<<",">>",">>>","&=","|=","^="];for(let o of s)if(this.source.slice(this.pos,this.pos+o.length)===o)return this.advance(o.length),{type:"OPERATOR",value:o,start:e,end:this.pos,line:t,column:r};if(/[+\-*/%<>=!&|^~?:]/.test(i))return this.advance(),{type:"OPERATOR",value:i,start:e,end:this.pos,line:t,column:r};if(/[()[\]{},;.]/.test(i))return this.advance(),{type:"PUNCTUATION",value:i,start:e,end:this.pos,line:t,column:r};return this.advance(),{type:"PUNCTUATION",value:i,start:e,end:this.pos,line:t,column:r}}readWhitespace(e,t,r){while(this.pos<this.source.length&&/\s/.test(this.source[this.pos]))this.advance();return{type:"WHITESPACE",value:this.source.slice(e,this.pos),start:e,end:this.pos,line:t,column:r}}readLineComment(e,t,r){this.advance(2);while(this.pos<this.source.length&&this.source[this.pos]!==`
29
+ `)this.advance();return{type:"COMMENT",value:this.source.slice(e,this.pos),start:e,end:this.pos,line:t,column:r}}readBlockComment(e,t,r){this.advance(2);while(this.pos<this.source.length-1){if(this.source[this.pos]==="*"&&this.source[this.pos+1]==="/"){this.advance(2);break}this.advance()}return{type:"COMMENT",value:this.source.slice(e,this.pos),start:e,end:this.pos,line:t,column:r}}readString(e,t,r,i){this.advance();while(this.pos<this.source.length){let s=this.source[this.pos];if(s==="\\"){this.advance(2);continue}if(s===e){this.advance();break}this.advance()}return{type:"STRING",value:this.source.slice(t,this.pos),start:t,end:this.pos,line:r,column:i}}readTemplateString(e,t,r){this.advance();let i=0,s=256;while(this.pos<this.source.length){let o=this.source[this.pos];if(o==="\\"){this.advance(2);continue}if(o==="$"&&this.peek(1)==="{"){if(i>=s){this.pos=this.source.length;break}this.advance(2),i++;continue}if(o==="{"&&i>0){i++,this.advance();continue}if(o==="}"&&i>0){i--,this.advance();continue}if(o==="`"&&i===0){this.advance();break}this.advance()}return{type:"TEMPLATE_STRING",value:this.source.slice(e,this.pos),start:e,end:this.pos,line:t,column:r}}readNumber(e,t,r){if(this.source[this.pos]==="0"){let i=this.peek(1)?.toLowerCase();if(i==="x"||i==="o"||i==="b"){this.advance(2);while(this.pos<this.source.length&&/[\da-f_]/i.test(this.source[this.pos]))this.advance();return{type:"NUMBER",value:this.source.slice(e,this.pos),start:e,end:this.pos,line:t,column:r}}}while(this.pos<this.source.length&&/[\d_]/.test(this.source[this.pos]))this.advance();if(this.source[this.pos]==="."&&(this.context==="javascript"||/\d/.test(this.peek(1)||""))){this.advance();while(this.pos<this.source.length&&/[\d_]/.test(this.source[this.pos]))this.advance()}if(/e/i.test(this.source[this.pos]||"")){if(this.advance(),/[+-]/.test(this.source[this.pos]||""))this.advance();while(this.pos<this.source.length&&/[\d_]/.test(this.source[this.pos]))this.advance()}if(this.source[this.pos]==="n")this.advance();return{type:"NUMBER",value:this.source.slice(e,this.pos),start:e,end:this.pos,line:t,column:r}}readIdentifier(e,t,r){while(this.pos<this.source.length&&/[\w$]/.test(this.source[this.pos]))this.advance();return{type:"IDENTIFIER",value:this.source.slice(e,this.pos),start:e,end:this.pos,line:t,column:r}}readDirective(e,t,r){this.advance();while(this.pos<this.source.length&&/[a-z]/i.test(this.source[this.pos]))this.advance();return{type:"DIRECTIVE",value:this.source.slice(e,this.pos),start:e,end:this.pos,line:t,column:r}}advance(e=1){for(let t=0;t<e&&this.pos<this.source.length;t++){if(this.source[this.pos]===`
30
+ `)this.line++,this.column=0;else this.column++;this.pos++}}peek(e){return this.source[this.pos+e]}saveState(){return{pos:this.pos,line:this.line,column:this.column}}restoreState(e){this.pos=e.pos,this.line=e.line,this.column=e.column}}function _(e,t,r,i=0){let s=0,o=i,a=null,c=0,g=!1;while(o<e.length){let l=e[o];if(a&&g){g=!1,o++;continue}if(a&&l==="\\"){g=!0,o++;continue}if(g=!1,(l==='"'||l==="'"||l==="`")&&!a){a=l,o++;continue}if(l===a&&a!=="`"){a=null,o++;continue}if(a==="`"&&l==="$"&&e[o+1]==="{"){c++,o+=2;continue}if(c>0&&l==="}"){c--,o++;continue}if(l==="`"&&a==="`"&&c===0){a=null,o++;continue}if(a){o++;continue}if(l===t)s++;else if(l===r){if(s--,s===0)return o}o++}return-1}function Rl(e,t){let r=t,i={paren:0,bracket:0,brace:0},s=null,o=0;while(r<e.length){let a=e[r];if((r>0?e[r-1]:"")==="\\"&&s){r++;continue}if((a==='"'||a==="'")&&!s){s=a,r++;continue}if(a===s&&s!=="`"){s=null,r++;continue}if(a==="`"&&!s){s="`",r++;continue}if(a==="`"&&s==="`"&&o===0){s=null,r++;continue}if(s==="`"&&a==="$"&&e[r+1]==="{"){o++,r+=2;continue}if(o>0){if(a==="{")o++;else if(a==="}")o--;r++;continue}if(s){r++;continue}if(i.paren===0&&i.bracket===0&&i.brace===0){if(e.slice(r,r+2)==="}}"||e.slice(r,r+3)==="!!}")break;if(a===","||a===";")break}if(a==="(")i.paren++;else if(a===")"){if(i.paren--,i.paren<0)break}else if(a==="[")i.bracket++;else if(a==="]"){if(i.bracket--,i.bracket<0)break}else if(a==="{")i.brace++;else if(a==="}"){if(i.brace--,i.brace<0)break}r++}return{expression:e.slice(t,r),endPos:r}}var Et={maxSanitizeDepth:10,allowBracketNotation:!1},Ce={...Et};var z=/\bnew\s+/,U="__stx_safe_ctors",Te=["Bun","Deno","Buffer","fetch","atob","btoa","console","Response","Request","Headers","WebAssembly","structuredClone","queueMicrotask","crypto","performance","navigator","Worker","WebSocket","BroadcastChannel","EventSource","XMLHttpRequest","localStorage","sessionStorage"],ee=[...Te,"Function","setTimeout","setInterval","setImmediate","process","require","exports","module","window","document","global","globalThis","Reflect","Proxy","Symbol","WeakMap","WeakSet","WeakRef","FinalizationRegistry"],xe=ee.map(()=>{return}),re=Object.freeze(Object.assign(Object.create(null),{keys:Object.keys,values:Object.values,entries:Object.entries,fromEntries:Object.fromEntries,assign:Object.assign,hasOwn:Object.hasOwn,is:Object.is})),se=[/\b(eval|Function|setTimeout|setInterval|setImmediate)\b/,/\b(process|require|import|exports|module)\b/,/\b(window|document|global|globalThis)\b/,/\b(constructor|prototype|__proto__)\b/,/\b(Reflect|Proxy)\b/,/\bSymbol\b/,/\b(WeakMap|WeakSet|WeakRef|FinalizationRegistry)\b/,/\b(Generator|AsyncGenerator)\b/,/__\w+__/,/\.(bind|call|apply)\s*\(/,z,/\bdelete\s+/,/\bthis\b/,/\\u(?:\{[\dA-Fa-f]+\}|[\dA-Fa-f]{4})/],oe=new Set([...Te,"eval","Function","setTimeout","setInterval","setImmediate","process","require","import","exports","module","window","document","global","globalThis","constructor","prototype","Reflect","Proxy","Symbol","WeakMap","WeakSet","WeakRef","FinalizationRegistry","Generator","AsyncGenerator","delete","this",U]),ae=new Set(["__proto__","constructor","prototype"]);function Ae(e){let t="",r=[],i=null,s=!1;for(let o=0;o<e.length;o++){let a=e[o];if(s){s=!1;continue}if(a==="\\"&&i){s=!0;continue}if(i){if(i==="`"&&a==="$"&&o+1<e.length&&e[o+1]==="{"){let c=1;o+=2;while(o<e.length&&c>0){if(e[o]==="{")c++;else if(e[o]==="}")c--;if(c>0)t+=e[o],r.push(o),o++}continue}if(a===i)i=null;continue}if(a==='"'||a==="'"||a==="`"){i=a;continue}t+=a,r.push(o)}return{text:t,map:r}}function _e(e){return Ae(e).text}var Ie=["Collator","DateTimeFormat","DisplayNames","ListFormat","Locale","NumberFormat","PluralRules","RelativeTimeFormat","Segmenter"],Oe=(()=>{let e={Date,URL,URLSearchParams},t=Intl;for(let r of Ie)if(typeof t[r]==="function")e[`Intl_${r}`]=t[r];return Object.freeze(Object.assign(Object.create(null),e))})(),xt=/^new(\s+)(Date|URLSearchParams|URL|Intl\s*\.\s*([A-Z_a-z]\w*))\s*\(/,we=/(?<![\w$])new(?![\w$])/g,Se=`only new Date(), new URL(), new URLSearchParams() and new Intl.{${Ie.join(",")}}() are allowed`;function St(e){let{text:t,map:r}=Ae(e),i=[];we.lastIndex=0;let s;while((s=we.exec(t))!==null){let a=s.index;if(/(?<!\.)\.\s*$/.test(t.slice(0,a)))continue;let c=xt.exec(t.slice(a)),g=c?.[3],l=!c?null:g?`Intl_${g}`:c[2];if(!c||!l||!(l in Oe))throw new S(`matched /${z.source}/; ${Se}`,e);let h=a+c[0].length,f=r[a],y=r[h-1]+1;if(e.slice(f,y)!==t.slice(a,h))throw new S(`matched /${z.source}/; ${Se}`,e);let b=f+3+c[1].length;i.push({start:b,end:b+c[2].length,key:l})}let o=e;for(let a=i.length-1;a>=0;a--){let c=i[a];o=`${o.slice(0,c.start)}${U}.${c.key}${o.slice(c.end)}`}return{source:o,usesSafeConstructors:i.length>0}}class S extends Error{rule;expression;constructor(e,t,r){super(r??`Potentially unsafe expression (${e}): ${t}`);this.name="UnsafeExpressionError",this.rule=e,this.expression=t}}function po(e){try{return le(e),null}catch(t){return t instanceof S?t.rule:t instanceof Error?t.message:String(t)}}function Ne(e,t){let r=/[$A-Z_a-z][$\w]*/g,i;while((i=r.exec(e))!==null){let s=i[0],o=e[i.index-1];if(oe.has(s))throw new S(`matched /\\b${s}\\b/; identifier ${s}`,t);if(o==="."&&ae.has(s))throw new S(`matched /.${s}/; property ${s}`,t)}}function Le(e,t=!0){let r=/(?:[$\w)\].]|\?\.)\s*\[([^\]]*)\]/g,i=new Set,s;while((s=r.exec(e))!==null){let o=s.index+s[0].indexOf("["),a=e.slice(0,o);if(/(?:^|[^$\w])(?:let|const|var)\s*$/.test(a))continue;let c=s[1].trim(),g=/^'(?:[^'\\]|\\.)*'$/.test(c),l=/^"(?:[^"\\]|\\.)*"$/.test(c);if(/^\d+$/.test(c))continue;if(g||l){let f=c.slice(1,-1);if(ae.has(f))throw new S(`bracket key ${f}`,e);if(!Ce.allowBracketNotation)throw new S("bracket notation with a string key; enable with configureSafeEvaluator({ allowBracketNotation: true })",e,`Bracket notation with strings not allowed: ${e}. Enable with configureSafeEvaluator({ allowBracketNotation: true })`);continue}if(t&&/^[$A-Z_a-z][$\w]*$/.test(c)){i.add(c);continue}throw new S("dynamic bracket notation is not allowed",e)}return[...i]}function le(e){let t=e.trim(),r=_e(t);Ne(r,t);let i=Le(t);for(let s of se){if(s===z)continue;if(s.test(r))throw new S(`matched /${s.source}/`,t)}return{...St(t),dynamicKeys:i}}function Gi(e){return le(e),e.trim()}var fo=Symbol("stx.sanitizeCache"),kt=4000,D=new Map;function $t(e){let t=D.get(e);if(t===void 0){if(t=se.some((r)=>r.test(e)),D.size>=kt)D.clear();D.set(e,t)}return t}function V(e){let t={},r=e[fo];t.Math=Math,t.JSON=JSON,t.Date=Date,t.String=String,t.Number=Number,t.Boolean=Boolean,t.Array=Array,t.Object=re,t.parseInt=Number.parseInt,t.parseFloat=Number.parseFloat,t.isNaN=Number.isNaN,t.isFinite=Number.isFinite,t.encodeURIComponent=encodeURIComponent,t.decodeURIComponent=decodeURIComponent;for(let[i,s]of Object.entries(e)){if(i.startsWith("__")||$t(i))continue;if(s&&typeof s==="object"&&!Array.isArray(s)){let o=r?.get(s);if(o===void 0)o=ie(s),r?.set(s,o);t[i]=o}else t[i]=s}return t}function ie(e,t=0){if(t>=Ce.maxSanitizeDepth)return"[Object too deep]";if(e===null||typeof e!=="object")return e;if(Array.isArray(e))return e.map((i)=>ie(i,t+1));if(e instanceof Date||e instanceof RegExp||e instanceof Map||e instanceof Set||e instanceof Error)return e;let r={};for(let[i,s]of Object.entries(e)){if(i.startsWith("__")||i==="constructor"||i==="prototype")continue;if(s&&typeof s==="object")r[i]=ie(s,t+1);else r[i]=s}return r}function d(e,t){try{let r=V(t),i=Object.keys(r),s=Object.values(r);return p(e,i)(...s)}catch{return}}function m(e){try{return Gi(e),!0}catch{return!1}}var j=new Set;function Rt(e,t,r){if(!t.startsWith("__")||!(t in r))return;let i=`${t}\x00${e}`;if(j.has(i))return;if(j.add(i),j.size>500)j.clear();console.warn(`[stx] a condition reads \`${t}\`, which conditions cannot see, so \`${e.trim()}\` is false and nothing it guards is rendered. Names starting with \`__\` are withheld from @if, @elseif and @unless. Derive a plain value in the server script (for example \`const hasRows = ${t}.length > 0\`) and test that instead.`)}function $l(e,t){try{let r=V(t),i=Object.keys(r),s=Object.values(r),o=!1,c=p(e,i,(g)=>{o=!0,Rt(e,g,t)})(...s);return!o&&Boolean(c)}catch{return!1}}function M(e,t){try{let r=d(e,t);if(r&&typeof r==="object"&&!Array.isArray(r))return r;return{}}catch{return{}}}var Pe=new Set(["break","case","catch","class","const","continue","debugger","default","delete","do","else","enum","export","extends","false","finally","for","function","if","import","in","instanceof","new","null","return","super","switch","this","throw","true","try","typeof","var","void","while","with","yield","let","static","implements","interface","package","private","protected","public","arguments","eval","await"]),ke=`stx-compile-probe:${globalThis.crypto.randomUUID()}`,Ct=0,Tt=0;function At(e,t){let r="__stx_compile_probe";while(e.includes(r))r+="_";let i=Array.from({length:e.length+1});i[e.length]=ke;for(let s=0;s<16;s++){let o=`c${++Ct}`,a=`'use strict';if(${r}===${JSON.stringify(ke)})return ${JSON.stringify(o)};`,c=Function(...e,r,a+t);if(c(...i)===o)return c;Tt++}throw Error("[stx] the JavaScript runtime repeatedly returned code compiled from a different source; refusing to evaluate with it.")}var _t=2000,B=new Map;function ve(e,t){let r=`${e.join(",")}\x00${t}`,i=B.get(r);if(i)return i;let s=At(e,t);if(B.size>=_t)B.clear();return B.set(r,s),s}function yt(e){return e.replace(/'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`(?:[^`\\]|\\.)*`/g," ").replace(/\??\.\s*[a-zA-Z_$][\w$]*/g," ").replace(/([{,]\s*)[a-zA-Z_$][\w$]*(\s*:)/g,"$1$2").match(/\b[a-zA-Z_$][\w$]*\b/g)||[]}var It=/^[A-Za-z_$][\w$]*$/;function zr(e){return It.test(e)&&!Pe.has(e)}var $e=new T(2000,{maxBytes:2097152,sizeOf:(e)=>e.sourceBytes});function p(e,t,r){let i=JSON.stringify([e,t]),s=$e.get(i);if(!s)s=Ot(e,[...t]),s.sourceBytes+=i.length*2,$e.set(i,s);return Nt(Lt(s.buildFunc,s.filteredKeys,s.contextKeys,s.validEntries,s.validIndices,r),s.contextKeys,s.dynamicKeys)}function Ot(e,t){let{source:r,usesSafeConstructors:i,dynamicKeys:s}=le(e),o=[];for(let f=0;f<t.length;f++){if(!zr(t[f]))continue;if(t[f]===U||t[f]==="Object"||oe.has(t[f]))continue;o.push({key:t[f],index:f})}o.sort((f,y)=>f.key<y.key?-1:1);let a=o.map((f)=>f.key),c=o.map((f)=>f.index),g=`
31
31
  'use strict';
32
32
  try {
33
33
  return ${r};
@@ -38,15 +38,20 @@ catch (e) {
38
38
  }
39
39
  throw e;
40
40
  }
41
- `,l=i?(f)=>{let y=ve([U,"Object",...ne,...a,...f],g);return(...b)=>y(Oe,re,...xe,...b)}:(f)=>{let y=ve(["Object",...ne,...a,...f],g);return(...b)=>y(re,...xe,...b)},h=l([]);return{sourceBytes:e.length*2+t.reduce((f,y)=>f+y.length*2,0),contextKeys:t,filteredKeys:a,validEntries:o,validIndices:c,dynamicKeys:s,buildFunc:(f)=>f.length===0?h:l(f)}}function Ot(e,t,r){if(r.length===0)return e;let i=r.map((s)=>t.indexOf(s));return(...s)=>{for(let o of i){if(o<0)continue;let a=s[o];if(typeof a==="string"&&ce.has(a))return}return e(...s)}}function Nt(e,t,r,i,s,o){let a=e([]),c=i.every((l,h)=>l.index===h);if(t.length===r.length&&c)return Re(a,t,e,void 0,o);return Re((...l)=>{let h=Array(s.length);for(let f=0;f<s.length;f++)h[f]=l[s[f]];return a(...h)},t,e,(l)=>{a=e(l)},o)}function Re(e,t,r,i,s){let a=/^(\w+) is not defined$/,c=e,g=[],l=new Set(t);return(...h)=>{for(let f=0;f<=8;f++)try{return c(...h)}catch(y){let b=y instanceof Error?y.message:"",w=a.exec(b);if(!(y instanceof ReferenceError)||!w)return;let x=w[1];if(l.has(x)||Fe.has(x)||oe.has(x))return;if(s?.(x),l.add(x),g.push(x),i)i(g);else c=r(g)}return}}function uo(e){let t=e.trim();try{let r=_e(t);if(/\b(?:eval|function|import|require|process|globalthis|window|document|fetch|bun|deno|buffer|console|reflect|proxy|prototype|constructor|this)\b/i.test(r))return!1;Le(r,t),Pe(t);for(let i of se)if(i.test(r))return!1}catch{return!1}return!0}function Gi(e,t){let r=[];t.lastIndex=0;let i;while((i=t.exec(e))!==null){let s=i.index,o=s+i[0].length-1,a=k(e,"(",")",o);if(a===-1){r.push({start:s,end:-1,args:"",call:e.slice(s,Math.min(e.length,s+80))}),t.lastIndex=o+1;continue}r.push({start:s,end:a+1,args:e.slice(o+1,a),call:e.slice(s,a+1)}),t.lastIndex=a+1}return r}function Jt(e,t,r,i){let s="",o=0;for(let a of Gi(e,t)){if(s+=e.slice(o,a.start),a.end===-1){s+=i(a.call),o=a.start;continue}s+=r(a.args,a.call),o=a.end}return s+e.slice(o)}function Yt(e){let t=[],r=0,i=null,s="";for(let o=0;o<e.length;o++){let a=e[o];if(i){if(s+=a,a==="\\"&&o+1<e.length){s+=e[++o];continue}if(a===i)i=null;continue}if(a==="'"||a==='"'||a==="`")i=a;else if(a==="("||a==="["||a==="{")r++;else if(a===")"||a==="]"||a==="}")r--;else if(a===","&&r===0){t.push(s.trim()),s="";continue}s+=a}if(s.trim())t.push(s.trim());return t}function ge(e){let t=e.trim(),r=t[0];if(r!=="'"&&r!=='"'&&r!=="`"||t.length<2||t.at(-1)!==r)return null;let i="";for(let s=1;s<t.length-1;s++){let o=t[s];if(o==="\\"&&s+1<t.length-1){let a=t[++s];i+=a==="n"?`
42
- `:a==="t"?"\t":a;continue}if(o===r)return null;if(r==="`"&&o==="$"&&t[s+1]==="{")return null;i+=o}return i}var Lt=new Set(["true","false","null","undefined","typeof","void","new","in","of","instanceof","this","delete","await","async","function","return","NaN","Infinity"]);function Zt(e,t){let r=e.trim();if(!r)return{ok:!1,message:"the argument is empty",code:n.INVALID_DIRECTIVE_SYNTAX};let i=co(r);if(i)return{ok:!1,message:`the expression is not allowed (${i})`,code:n.UNSAFE_EXPRESSION};let s=V(t),o;try{o=p(r,Object.keys(s))(...Object.values(s))}catch(c){return{ok:!1,message:`the expression could not be evaluated: ${c instanceof Error?c.message:String(c)}`,code:n.EVALUATION_ERROR}}if(o!==void 0&&o!==null)return{ok:!0,value:o};let a=[...new Set(ht(r))].filter((c)=>!Lt.has(c)&&!(c in s)&&!(c in globalThis));if(a.length>0)return{ok:!1,message:`${a.map((g)=>`"${g}"`).join(", ")} ${a.length===1?"is":"are"} not defined here. Values a directive reads must come from <script server> or the render context; a plain <script> runs in the browser. To pass literal text, quote it.`,code:n.UNDEFINED_VARIABLE};if(o===void 0&&(r.startsWith("{")||r.startsWith("[")))return{ok:!1,message:"the expression threw while it was evaluated",code:n.EVALUATION_ERROR};return{ok:!0,value:o}}function Ze(e){if(e===null)return"null";if(Array.isArray(e))return"an array";if(typeof e==="object")return"an object";if(typeof e==="string")return`a string ("${e.length>40?`${e.slice(0,40)}...`:e}")`;return`${/^[aeiou]/.test(typeof e)?"an":"a"} ${typeof e}`}function yt(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function je(e){if(!e)return"";return De.isAbsolute(e)?De.relative(process.cwd(),e)||e:e}function ue(e){let t=e.replace(/\s+/g," ").trim();return t.length>80?`${t.slice(0,77)}...`:t}function z(e,t,r,i,s=n.EVALUATION_ERROR){let o=i?` in ${je(i)}`:"";return console.warn(`[stx] ${ue(t)}${o}: ${r}`),u(e,`${ue(t)}: ${r}`,s)}function po(e,t,r){let i=r?` in ${je(r)}`:"";console.warn(`[stx] ${ue(e)}${i}: ${t}`)}function Xi(){return{afterOpen:[],beforeClose:[]}}function Pt(e){return e.afterOpen.length>0||e.beforeClose.length>0}function Rl(e,t){if(!Pt(t))return e;let r=t.afterOpen.join(""),i=t.beforeClose.join(""),s=D(e),o=r?Fr(e):null,a=i&&s!==-1?s:null;if(o===null&&a===null)return e;if(o!==null&&a!==null)return`${e.slice(0,o)}${r}${e.slice(o,a)}${i}${e.slice(a)}`;if(o!==null)return`${e.slice(0,o)}${r}${e.slice(o)}`;return`${e.slice(0,a)}${i}${e.slice(a)}`}var Be=/\s*<meta\b[^>]*\bcharset\b[^>]*>/iy;function Fr(e){let t=/<head\b[^>]*>/i.exec(e);if(!t)return null;let r=t.index+t[0].length;Be.lastIndex=r;let i=Be.exec(e);return i?r+i[0].length:r}var fe="data-stx-color-mode-boot",ze="__STX_COLOR_MODE__",Mt=new Set(["light","dark","auto","system"]),Ft=new Set(["auto","system"]),Dt=/^[a-z][\w:-]*$/i,jt=/^[\w-]+$/;function Bt(e){let t=e.storageKey??"stx-color-mode",r=e.initialMode??"auto",i=e.darkClass===void 0?"dark":e.darkClass,s=e.attribute??null,o=e.autoValue??null,a=e.respectExisting===!0;if(typeof t!=="string"||t.length===0)throw Error("colorMode.storageKey must be a non-empty string");if(!Mt.has(r))throw Error(`colorMode.initialMode must be one of light, dark, auto, system \u2014 got ${JSON.stringify(r)}`);if(i!==null&&(typeof i!=="string"||!jt.test(i)))throw Error(`colorMode.darkClass must be a single CSS class name, or null to opt out \u2014 got ${JSON.stringify(i)}`);if(s!==null&&(typeof s!=="string"||!Dt.test(s)))throw Error(`colorMode.attribute must be a valid HTML attribute name \u2014 got ${JSON.stringify(s)}`);if(o!==null&&!Ft.has(o))throw Error(`colorMode.autoValue must be 'auto' or 'system' \u2014 got ${JSON.stringify(o)}`);if(i===null&&s===null)throw Error("colorMode needs at least one of darkClass or attribute \u2014 with both null nothing would mark the mode on <html>");if(a&&s===null)throw Error("colorMode.respectExisting needs an attribute to read \u2014 the dark class alone cannot say whether a mode was chosen");return{storageKey:t,initialMode:r==="system"?"auto":r,darkClass:i,attribute:s,autoValue:o,respectExisting:a}}function zt(e){return JSON.stringify(e).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function de(e={}){let t=Bt(e),r=zt(t),i=`(function(){"use strict";var o=window.${ze};if(o&&typeof o.sync==="function"){o.sync();return}var c=${r};var r=document.documentElement;function read(){var p=c.initialMode,a=c.autoValue;try{var v=localStorage.getItem(c.storageKey);if(v==="light"||v==="dark"){p=v}else if(v==="auto"||v==="system"){p="auto";if(!a)a=v}}catch(e){}return{p:p,a:a}}function sys(){try{return matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}catch(e){return"light"}}function stamp(m){if(c.attribute)r.setAttribute(c.attribute,m);if(c.darkClass){if(m==="dark")r.classList.add(c.darkClass);else r.classList.remove(c.darkClass)}}var s=read();var f=null;if(c.respectExisting&&c.attribute){var x=r.getAttribute(c.attribute);if(x==="light"||x==="dark")f=x}var m=f||(s.p==="auto"?sys():s.p);var p=s.p;stamp(m);var g=null;function sync(){var t=read(),n=f||(t.p==="auto"?sys():t.p);var moved=n!==m,chose=t.p!==p;if(moved){r.style.setProperty("transition","none","important");stamp(n);void r.offsetHeight;r.style.removeProperty("transition")}else stamp(n);m=n;p=t.p;if(g){g.mode=n;g.preference=t.p;if(t.a)g.autoValue=t.a}if(moved||chose){try{window.dispatchEvent(new CustomEvent("stx:color-mode",{detail:{mode:n,preference:t.p}}))}catch(e){}}}try{g=window.${ze}={storageKey:c.storageKey,initialMode:c.initialMode,darkClass:c.darkClass,attribute:c.attribute,autoValue:s.a||"auto",respectExisting:c.respectExisting,forced:f,preference:p,mode:m,watching:true,sync:sync}}catch(e){}try{var q=matchMedia("(prefers-color-scheme: dark)");if(q.addEventListener)q.addEventListener("change",sync);else if(q.addListener)q.addListener(sync)}catch(e){}try{addEventListener("pageshow",sync);addEventListener("storage",function(e){if(e.key===null||e.key===c.storageKey)sync()});document.addEventListener("visibilitychange",function(){if(document.visibilityState==="visible")sync()})}catch(e){}}());`;return`<script ${fe}>${i}</script>`}function zr(e,t={}){if(e.includes(fe))return e;let r=pe(e);if(r===null)return e;let i=de(t);return`${e.slice(0,r)}
43
- ${i}${e.slice(r)}`}var pe=Fr,Ht=new RegExp(`<script\\b[^>]*\\b${fe}\\b[^>]*>[\\s\\S]*?<\\/script>`,"i"),He=/<meta\b[^>]*\bcharset\b[^>]*>/gi,Ue=/<\/head>/gi;function Ut(e){let t=/<head\b[^>]*>/i.exec(e);if(!t)return e;let r=t.index+t[0].length;Ue.lastIndex=r;let i=Ue.exec(e),s=i?i.index:e.length;He.lastIndex=r;let o=He.exec(e);if(!o||o.index>=s)return e;if(e.slice(r,o.index).trim()==="")return e;let a=o.index+o[0].length;return`${e.slice(0,r)}
44
- ${o[0]}${e.slice(r,o.index)}${e.slice(a,s)}${e.slice(s)}`}function Al(e){return Vt(Ut(e))}function Vt(e){let t=Ht.exec(e);if(!t)return e;let r=pe(e);if(r===null)return e;if(t.index<=r||e.slice(r,t.index).trim()==="")return e;let i=e.slice(0,t.index)+e.slice(t.index+t[0].length),s=pe(i);if(s===null)return e;return`${i.slice(0,s)}
45
- ${t[0]}${i.slice(s)}`}var Wt="[data-stx-component-wrapper]:not([stx-hydrate]){display:contents}",Ke=`<style data-stx-cloak>[x-cloak]{display:none !important}${Wt}</style>`,W="data-stx-html-attrs",X="data-stx-html-class",Xe=/^[A-Za-z_:][\w:.-]*$/;function v(e){return String(e).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Kt(e){return String(e).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function bt(e){if(e.name)return`name="${e.name}"`;if(e.property)return`property="${e.property}"`;if(e.charset!=null)return"charset=";if(e["http-equiv"])return`http-equiv="${e["http-equiv"]}"`;return""}function qt(e){let t=/^\s*<meta\b([^>]*)>/i.exec(e);if(!t)return null;let r={};for(let i of t[1].matchAll(/([\w:-]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'>]+)))?/g))r[i[1].toLowerCase()]=i[2]??i[3]??i[4]??"";return r}function _(e,t){return Object.entries(e).filter(([r])=>!t?.(r)).map(([r,i])=>`${r}="${v(String(i))}"`).join(" ")}function q(e){let t=String(e.content),r=typeof e.type==="string"?e.type.trim().toLowerCase():"";return/json$|^importmap$/.test(r)?t.replace(/<\//g,"<\\/"):t}function qe(e){let t=_(e,(r)=>r==="content");return`<script${t?` ${t}`:""}>${q(e)}</script>`}function Gt(e={},t="en"){let r=[],i=[],s="",o=t;for(let[c,g]of Object.entries(e||{})){if(g==null)continue;let l=c.trim();if(!Xe.test(l))continue;let h=l.toLowerCase();if(h==="lang"){o=String(g);continue}if(h==="class"){s=String(g).trim();continue}r.push(` ${l}="${v(String(g))}"`),i.push(l)}let a=` lang="${v(o)}"`;if(s)a+=` class="${v(s)}"`;if(a+=r.join(""),s)a+=` ${X}="${v(s)}"`;if(i.length)a+=` ${W}="${v(i.join(" "))}"`;return a}function Pl(e={},t={}){let r={...e,...t};if(e.class&&t.class){let i=e.class.split(/\s+/).filter(Boolean);for(let s of t.class.split(/\s+/).filter(Boolean))if(!i.includes(s))i.push(s);r.class=i.join(" ")}return r}function Hr(e,t={}){if(!t||Object.keys(t).length===0)return e;let r=e.match(/<html\b([^>]*)>/i);if(!r)return e;let i={},s=[],o=/([A-Za-z_:][\w:.-]*)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'>]+)))?/g,a;while((a=o.exec(r[1]))!==null){let h=a[1];if(!(h in i))s.push(h);i[h]=a[2]??a[3]??a[4]??""}let c=[],g=[];for(let[h,f]of Object.entries(t)){if(f==null)continue;let y=h.trim();if(!Xe.test(y))continue;let b=y.toLowerCase();if(b==="class"){let w=(i.class||"").split(/\s+/).filter(Boolean);for(let x of String(f).split(/\s+/).filter(Boolean))if(!w.includes(x))w.push(x),c.push(x);if(!("class"in i))s.push("class");i.class=w.join(" ");continue}if(!(y in i))s.push(y);if(i[y]=String(f),b!=="lang")g.push(y)}if(c.length){if(!(X in i))s.push(X);i[X]=c.join(" ")}if(g.length){if(!(W in i))s.push(W);i[W]=g.join(" ")}let l=s.map((h)=>` ${h}="${v(i[h])}"`).join("");return e.replace(r[0],()=>`<html${l}>`)}function Il(e){if(e.includes("data-stx-cloak"))return null;if(D(e)===-1)return null;return`${Ke}
46
- `}function Qt(e){let t=[],r=0;while(r<e.length){let o=e.slice(r),a=o.match(/^\s+/);if(a){r+=a[0].length;continue}if(o.startsWith("<!--")){let f=e.indexOf("-->",r);if(f===-1)break;r=f+3;continue}let c=o.match(/^<script\b[^>]*>/i);if(c){let f=e.toLowerCase().indexOf("</script>",r+c[0].length);if(f===-1)break;r=f+9;continue}let g=o.match(/^<link\b[^>]*>/i);if(g){t.push(g[0]),r+=g[0].length;continue}let l=o.match(/^<meta\b[^>]*>/i);if(l){t.push(l[0]),r+=l[0].length;continue}let h=o.match(/^<style\b[^>]*>[\s\S]*?<\/style>/i);if(h){t.push(h[0]),r+=h[0].length;continue}break}if(t.length===0)return{body:e,hoisted:t};let i="",s=0;while(s<e.length&&s<r){let o=e.slice(s),a=o.match(/^<link\b[^>]*>/i);if(a&&t.includes(a[0])){s+=a[0].length;continue}let c=o.match(/^<meta\b[^>]*>/i);if(c&&t.includes(c[0])){s+=c[0].length;continue}let g=o.match(/^<style\b[^>]*>[\s\S]*?<\/style>/i);if(g&&t.includes(g[0])){s+=g[0].length;continue}i+=e[s],s++}return i+=e.slice(r),{body:i,hoisted:t}}function en(e,t={},r={}){let{title:i="stx App",lang:s="en",meta:o=[],link:a=[],script:c=[],headRaw:g="",htmlAttrs:l={},bodyClass:h="",bodyAttrs:f={}}=t,y=r.title||i,b=[{charset:"UTF-8"},{name:"viewport",content:"width=device-width, initial-scale=1.0"}],w=new Set(o.map(bt).filter(Boolean)),{body:x,hoisted:R}=Qt(e),A=new Set(R.flatMap((E)=>{let O=qt(E);return O?[bt(O)].filter(Boolean):[]})),tt=[...b.filter((E)=>!w.has(bt(E))),...o].filter((E)=>!A.has(bt(E))).map((E)=>` <meta ${_(E)}>`).join(`
47
- `),nt=a.map((E)=>` <link ${_(E)}>`).join(`
48
- `),rt=c.map((E)=>{if(E.src)return` <script ${_(E,(O)=>O==="content")}></script>`;if(E.content)return` ${qe(E)}`;return""}).filter(Boolean).join(`
49
- `),it=Gt(l,s),st=Object.entries(f).map(([E,O])=>` ${E}="${v(String(O))}"`).join(""),ot=h?` class="${v(h)}"`:"",at=[tt,r.colorMode?` ${de(r.colorMode)}`:"",` <title>${r.titleIsHtml?y:Kt(y)}</title>`,` ${Ke}`,nt,rt,g?` ${g}`:"",...(r.styles||[]).map((E)=>` ${E}`),...R.map((E)=>` ${E}`),...(r.headScripts||[]).map((E)=>` ${E}`),r.headStack||""].filter(Boolean),ct=[x,...(r.bodyScripts||[]).map((E)=>E),r.bodyStack||""].filter(Boolean);return`<!DOCTYPE html>
41
+ `,l=i?(f)=>{let y=ve([U,"Object",...ee,...a,...f],g);return(...b)=>y(Oe,re,...xe,...b)}:(f)=>{let y=ve(["Object",...ee,...a,...f],g);return(...b)=>y(re,...xe,...b)},h=l([]);return{sourceBytes:e.length*2+t.reduce((f,y)=>f+y.length*2,0),contextKeys:t,filteredKeys:a,validEntries:o,validIndices:c,dynamicKeys:s,buildFunc:(f)=>f.length===0?h:l(f)}}function Nt(e,t,r){if(r.length===0)return e;let i=r.map((s)=>t.indexOf(s));return(...s)=>{for(let o of i){if(o<0)continue;let a=s[o];if(typeof a==="string"&&ae.has(a))return}return e(...s)}}function Lt(e,t,r,i,s,o){let a=e([]),c=i.every((l,h)=>l.index===h);if(t.length===r.length&&c)return Re(a,t,e,void 0,o);return Re((...l)=>{let h=Array(s.length);for(let f=0;f<s.length;f++)h[f]=l[s[f]];return a(...h)},t,e,(l)=>{a=e(l)},o)}function Re(e,t,r,i,s){let a=/^(\w+) is not defined$/,c=e,g=[],l=new Set(t);return(...h)=>{for(let f=0;f<=8;f++)try{return c(...h)}catch(y){let b=y instanceof Error?y.message:"",w=a.exec(b);if(!(y instanceof ReferenceError)||!w)return;let x=w[1];if(l.has(x)||Pe.has(x)||oe.has(x))return;if(s?.(x),l.add(x),g.push(x),i)i(g);else c=r(g)}return}}function go(e){let t=e.trim();try{let r=_e(t);if(/\b(?:eval|function|import|require|process|globalthis|window|document|fetch|bun|deno|buffer|console|reflect|proxy|prototype|constructor|this)\b/i.test(r))return!1;Ne(r,t),Le(t);for(let i of se)if(i.test(r))return!1}catch{return!1}return!0}function Ji(e,t){let r=[];t.lastIndex=0;let i;while((i=t.exec(e))!==null){let s=i.index,o=s+i[0].length-1,a=_(e,"(",")",o);if(a===-1){r.push({start:s,end:-1,args:"",call:e.slice(s,Math.min(e.length,s+80))}),t.lastIndex=o+1;continue}r.push({start:s,end:a+1,args:e.slice(o+1,a),call:e.slice(s,a+1)}),t.lastIndex=a+1}return r}function Yt(e,t,r,i){let s="",o=0;for(let a of Ji(e,t)){if(s+=e.slice(o,a.start),a.end===-1){s+=i(a.call),o=a.start;continue}s+=r(a.args,a.call),o=a.end}return s+e.slice(o)}function Zt(e){let t=[],r=0,i=null,s="";for(let o=0;o<e.length;o++){let a=e[o];if(i){if(s+=a,a==="\\"&&o+1<e.length){s+=e[++o];continue}if(a===i)i=null;continue}if(a==="'"||a==='"'||a==="`")i=a;else if(a==="("||a==="["||a==="{")r++;else if(a===")"||a==="]"||a==="}")r--;else if(a===","&&r===0){t.push(s.trim()),s="";continue}s+=a}if(s.trim())t.push(s.trim());return t}function bt(e){let t=e.trim(),r=t[0];if(r!=="'"&&r!=='"'&&r!=="`"||t.length<2||t.at(-1)!==r)return null;let i="",s={b:"\b",f:"\f",n:`
42
+ `,r:"\r",t:"\t",v:"\v",0:"\x00"};for(let o=1;o<t.length-1;o++){let a=t[o];if(a==="\\"){if(++o>=t.length-1)return null;let c=t[o];if(/[1-9]/.test(c)||c==="0"&&/\d/.test(t[o+1]??""))return null;if(c===`
43
+ `||c==="\u2028"||c==="\u2029")continue;if(c==="\r"){if(t[o+1]===`
44
+ `)o++;continue}if(c==="x"||c==="u"){let g=c==="u"&&t[o+1]==="{",l=g?t.indexOf("}",o+2):o+(c==="x"?2:4)+1,h=t.slice(o+(g?2:1),l);if(l<0||l>=t.length||!/^[\da-f]+$/i.test(h)||!g&&h.length!==(c==="x"?2:4))return null;let f=Number.parseInt(h,16);if(f>1114111)return null;i+=String.fromCodePoint(f),o=g?l:l-1;continue}i+=Object.hasOwn(s,c)?s[c]:c;continue}if(a===r||r!=="`"&&(a===`
45
+ `||a==="\r"))return null;if(r==="`"&&a==="$"&&t[o+1]==="{")return null;if(r==="`"&&a==="\r"){if(t[o+1]===`
46
+ `)o++;i+=`
47
+ `}else i+=a}return i}var Pt=new Set(["true","false","null","undefined","typeof","void","new","in","of","instanceof","this","delete","await","async","function","return","NaN","Infinity"]);function Qt(e,t){let r=e.trim();if(!r)return{ok:!1,message:"the argument is empty",code:n.INVALID_DIRECTIVE_SYNTAX};let i=po(r);if(i)return{ok:!1,message:`the expression is not allowed (${i})`,code:n.UNSAFE_EXPRESSION};let s=V(t),o;try{o=p(r,Object.keys(s))(...Object.values(s))}catch(c){return{ok:!1,message:`the expression could not be evaluated: ${c instanceof Error?c.message:String(c)}`,code:n.EVALUATION_ERROR}}if(o!==void 0&&o!==null)return{ok:!0,value:o};let a=[...new Set(yt(r))].filter((c)=>!Pt.has(c)&&!(c in s)&&!(c in globalThis));if(a.length>0)return{ok:!1,message:`${a.map((g)=>`"${g}"`).join(", ")} ${a.length===1?"is":"are"} not defined here. Values a directive reads must come from <script server> or the render context; a plain <script> runs in the browser. To pass literal text, quote it.`,code:n.UNDEFINED_VARIABLE};if(o===void 0&&(r.startsWith("{")||r.startsWith("[")))return{ok:!1,message:"the expression threw while it was evaluated",code:n.EVALUATION_ERROR};return{ok:!0,value:o}}function Qe(e){if(e===null)return"null";if(Array.isArray(e))return"an array";if(typeof e==="object")return"an object";if(typeof e==="string")return`a string ("${e.length>40?`${e.slice(0,40)}...`:e}")`;return`${/^[aeiou]/.test(typeof e)?"an":"a"} ${typeof e}`}function wt(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function je(e){if(!e)return"";return Fe.isAbsolute(e)?Fe.relative(process.cwd(),e)||e:e}function ue(e){let t=e.replace(/\s+/g," ").trim();return t.length>80?`${t.slice(0,77)}...`:t}function H(e,t,r,i,s=n.EVALUATION_ERROR){let o=i?` in ${je(i)}`:"";return console.warn(`[stx] ${ue(t)}${o}: ${r}`),u(e,`${ue(t)}: ${r}`,s)}function mo(e,t,r){let i=r?` in ${je(r)}`:"";console.warn(`[stx] ${ue(e)}${i}: ${t}`)}function Yi(){return{afterOpen:[],beforeClose:[]}}function Mt(e){return e.afterOpen.length>0||e.beforeClose.length>0}function Al(e,t){if(!Mt(t))return e;let r=t.afterOpen.join(""),i=t.beforeClose.join(""),s=L(e),o=r?Vr(e):null,a=i&&s!==-1?s:null;if(o===null&&a===null)return e;if(o!==null&&a!==null)return`${e.slice(0,o)}${r}${e.slice(o,a)}${i}${e.slice(a)}`;if(o!==null)return`${e.slice(0,o)}${r}${e.slice(o)}`;return`${e.slice(0,a)}${i}${e.slice(a)}`}var Be=/\s*<meta\b[^>]*\bcharset\b[^>]*>/iy;function Vr(e){let t=/<head\b[^>]*>/i.exec(e);if(!t)return null;let r=t.index+t[0].length;Be.lastIndex=r;let i=Be.exec(e);return i?r+i[0].length:r}var pe="data-stx-color-mode-boot",ze="__STX_COLOR_MODE__",Ft=new Set(["light","dark","auto","system"]),Dt=new Set(["auto","system"]),jt=/^[a-z][\w:-]*$/i,Bt=/^[\w-]+$/;function zt(e){let t=e.storageKey??"stx-color-mode",r=e.initialMode??"auto",i=e.darkClass===void 0?"dark":e.darkClass,s=e.attribute??null,o=e.autoValue??null,a=e.respectExisting===!0;if(typeof t!=="string"||t.length===0)throw Error("colorMode.storageKey must be a non-empty string");if(!Ft.has(r))throw Error(`colorMode.initialMode must be one of light, dark, auto, system \u2014 got ${JSON.stringify(r)}`);if(i!==null&&(typeof i!=="string"||!Bt.test(i)))throw Error(`colorMode.darkClass must be a single CSS class name, or null to opt out \u2014 got ${JSON.stringify(i)}`);if(s!==null&&(typeof s!=="string"||!jt.test(s)))throw Error(`colorMode.attribute must be a valid HTML attribute name \u2014 got ${JSON.stringify(s)}`);if(o!==null&&!Dt.has(o))throw Error(`colorMode.autoValue must be 'auto' or 'system' \u2014 got ${JSON.stringify(o)}`);if(i===null&&s===null)throw Error("colorMode needs at least one of darkClass or attribute \u2014 with both null nothing would mark the mode on <html>");if(a&&s===null)throw Error("colorMode.respectExisting needs an attribute to read \u2014 the dark class alone cannot say whether a mode was chosen");return{storageKey:t,initialMode:r==="system"?"auto":r,darkClass:i,attribute:s,autoValue:o,respectExisting:a}}function Ht(e){return JSON.stringify(e).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function fe(e={}){let t=zt(e),r=Ht(t),i=`(function(){"use strict";var o=window.${ze};if(o&&typeof o.sync==="function"){o.sync();return}var c=${r};var r=document.documentElement;function read(){var p=c.initialMode,a=c.autoValue;try{var v=localStorage.getItem(c.storageKey);if(v==="light"||v==="dark"){p=v}else if(v==="auto"||v==="system"){p="auto";if(!a)a=v}}catch(e){}return{p:p,a:a}}function sys(){try{return matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}catch(e){return"light"}}function stamp(m){if(c.attribute)r.setAttribute(c.attribute,m);if(c.darkClass){if(m==="dark")r.classList.add(c.darkClass);else r.classList.remove(c.darkClass)}}var s=read();var f=null;if(c.respectExisting&&c.attribute){var x=r.getAttribute(c.attribute);if(x==="light"||x==="dark")f=x}var m=f||(s.p==="auto"?sys():s.p);var p=s.p;stamp(m);var g=null;function sync(){var t=read(),n=f||(t.p==="auto"?sys():t.p);var moved=n!==m,chose=t.p!==p;if(moved){r.style.setProperty("transition","none","important");stamp(n);void r.offsetHeight;r.style.removeProperty("transition")}else stamp(n);m=n;p=t.p;if(g){g.mode=n;g.preference=t.p;if(t.a)g.autoValue=t.a}if(moved||chose){try{window.dispatchEvent(new CustomEvent("stx:color-mode",{detail:{mode:n,preference:t.p}}))}catch(e){}}}try{g=window.${ze}={storageKey:c.storageKey,initialMode:c.initialMode,darkClass:c.darkClass,attribute:c.attribute,autoValue:s.a||"auto",respectExisting:c.respectExisting,forced:f,preference:p,mode:m,watching:true,sync:sync}}catch(e){}try{var q=matchMedia("(prefers-color-scheme: dark)");if(q.addEventListener)q.addEventListener("change",sync);else if(q.addListener)q.addListener(sync)}catch(e){}try{addEventListener("pageshow",sync);addEventListener("storage",function(e){if(e.key===null||e.key===c.storageKey)sync()});document.addEventListener("visibilitychange",function(){if(document.visibilityState==="visible")sync()})}catch(e){}}());`;return`<script ${pe}>${i}</script>`}function Ur(e,t={}){if(e.includes(pe))return e;let r=ge(e);if(r===null)return e;let i=fe(t);return`${e.slice(0,r)}
48
+ ${i}${e.slice(r)}`}var ge=Vr,Ut=new RegExp(`<script\\b[^>]*\\b${pe}\\b[^>]*>[\\s\\S]*?<\\/script>`,"i"),He=/<meta\b[^>]*\bcharset\b[^>]*>/gi,Ue=/<\/head>/gi;function Vt(e){let t=/<head\b[^>]*>/i.exec(e);if(!t)return e;let r=t.index+t[0].length;Ue.lastIndex=r;let i=Ue.exec(e),s=i?i.index:e.length;He.lastIndex=r;let o=He.exec(e);if(!o||o.index>=s)return e;if(e.slice(r,o.index).trim()==="")return e;let a=o.index+o[0].length;return`${e.slice(0,r)}
49
+ ${o[0]}${e.slice(r,o.index)}${e.slice(a,s)}${e.slice(s)}`}function Pl(e){return Wt(Vt(e))}function Wt(e){let t=Ut.exec(e);if(!t)return e;let r=ge(e);if(r===null)return e;if(t.index<=r||e.slice(r,t.index).trim()==="")return e;let i=e.slice(0,t.index)+e.slice(t.index+t[0].length),s=ge(i);if(s===null)return e;return`${i.slice(0,s)}
50
+ ${t[0]}${i.slice(s)}`}var Kt="[data-stx-component-wrapper]:not([stx-hydrate]){display:contents}",Ke=`<style data-stx-cloak>[x-cloak]{display:none !important}${Kt}</style>`,W="data-stx-html-attrs",X="data-stx-html-class",Xe=/^[A-Za-z_:][\w:.-]*$/;function k(e){return String(e).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Xt(e){return String(e).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function vt(e){if(e.name)return`name="${e.name}"`;if(e.property)return`property="${e.property}"`;if(e.charset!=null)return"charset=";if(e["http-equiv"])return`http-equiv="${e["http-equiv"]}"`;return""}function qt(e){let t=/^\s*<meta\b([^>]*)>/i.exec(e);if(!t)return null;let r={};for(let i of t[1].matchAll(/([\w:-]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'>]+)))?/g))r[i[1].toLowerCase()]=i[2]??i[3]??i[4]??"";return r}function A(e,t){return Object.entries(e).filter(([r])=>!t?.(r)).map(([r,i])=>`${r}="${k(String(i))}"`).join(" ")}function q(e){let t=String(e.content),r=typeof e.type==="string"?e.type.trim().toLowerCase():"";return/json$|^importmap$/.test(r)?t.replace(/<\//g,"<\\/"):t}function qe(e){let t=A(e,(r)=>r==="content");return`<script${t?` ${t}`:""}>${q(e)}</script>`}function Gt(e={},t="en"){let r=[],i=[],s="",o=t;for(let[c,g]of Object.entries(e||{})){if(g==null)continue;let l=c.trim();if(!Xe.test(l))continue;let h=l.toLowerCase();if(h==="lang"){o=String(g);continue}if(h==="class"){s=String(g).trim();continue}r.push(` ${l}="${k(String(g))}"`),i.push(l)}let a=` lang="${k(o)}"`;if(s)a+=` class="${k(s)}"`;if(a+=r.join(""),s)a+=` ${X}="${k(s)}"`;if(i.length)a+=` ${W}="${k(i.join(" "))}"`;return a}function Il(e={},t={}){let r={...e,...t};if(e.class&&t.class){let i=e.class.split(/\s+/).filter(Boolean);for(let s of t.class.split(/\s+/).filter(Boolean))if(!i.includes(s))i.push(s);r.class=i.join(" ")}return r}function Wr(e,t={}){if(!t||Object.keys(t).length===0)return e;let r=e.match(/<html\b([^>]*)>/i);if(!r)return e;let i={},s=[],o=/([A-Za-z_:][\w:.-]*)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'>]+)))?/g,a;while((a=o.exec(r[1]))!==null){let h=a[1];if(!(h in i))s.push(h);i[h]=a[2]??a[3]??a[4]??""}let c=[],g=[];for(let[h,f]of Object.entries(t)){if(f==null)continue;let y=h.trim();if(!Xe.test(y))continue;let b=y.toLowerCase();if(b==="class"){let w=(i.class||"").split(/\s+/).filter(Boolean);for(let x of String(f).split(/\s+/).filter(Boolean))if(!w.includes(x))w.push(x),c.push(x);if(!("class"in i))s.push("class");i.class=w.join(" ");continue}if(!(y in i))s.push(y);if(i[y]=String(f),b!=="lang")g.push(y)}if(c.length){if(!(X in i))s.push(X);i[X]=c.join(" ")}if(g.length){if(!(W in i))s.push(W);i[W]=g.join(" ")}let l=s.map((h)=>` ${h}="${k(i[h])}"`).join("");return e.replace(r[0],()=>`<html${l}>`)}function Ol(e){if(e.includes("data-stx-cloak"))return null;if(L(e)===-1)return null;return`${Ke}
51
+ `}function Jt(e){let t=[],r=0;while(r<e.length){let o=e.slice(r),a=o.match(/^\s+/);if(a){r+=a[0].length;continue}if(o.startsWith("<!--")){let f=e.indexOf("-->",r);if(f===-1)break;r=f+3;continue}let c=o.match(/^<script\b[^>]*>/i);if(c){let f=e.toLowerCase().indexOf("</script>",r+c[0].length);if(f===-1)break;r=f+9;continue}let g=o.match(/^<link\b[^>]*>/i);if(g){t.push(g[0]),r+=g[0].length;continue}let l=o.match(/^<meta\b[^>]*>/i);if(l){t.push(l[0]),r+=l[0].length;continue}let h=o.match(/^<style\b[^>]*>[\s\S]*?<\/style>/i);if(h){t.push(h[0]),r+=h[0].length;continue}break}if(t.length===0)return{body:e,hoisted:t};let i="",s=0;while(s<e.length&&s<r){let o=e.slice(s),a=o.match(/^<link\b[^>]*>/i);if(a&&t.includes(a[0])){s+=a[0].length;continue}let c=o.match(/^<meta\b[^>]*>/i);if(c&&t.includes(c[0])){s+=c[0].length;continue}let g=o.match(/^<style\b[^>]*>[\s\S]*?<\/style>/i);if(g&&t.includes(g[0])){s+=g[0].length;continue}i+=e[s],s++}return i+=e.slice(r),{body:i,hoisted:t}}function en(e,t={},r={}){let{title:i="stx App",lang:s="en",meta:o=[],link:a=[],script:c=[],headRaw:g="",htmlAttrs:l={},bodyClass:h="",bodyAttrs:f={}}=t,y=r.title||i,b=[{charset:"UTF-8"},{name:"viewport",content:"width=device-width, initial-scale=1.0"}],w=new Set(o.map(vt).filter(Boolean)),{body:x,hoisted:v}=Jt(e),C=new Set(v.flatMap((E)=>{let O=qt(E);return O?[vt(O)].filter(Boolean):[]})),tt=[...b.filter((E)=>!w.has(vt(E))),...o].filter((E)=>!C.has(vt(E))).map((E)=>` <meta ${A(E)}>`).join(`
52
+ `),nt=a.map((E)=>` <link ${A(E)}>`).join(`
53
+ `),rt=c.map((E)=>{if(E.src)return` <script ${A(E,(O)=>O==="content")}></script>`;if(E.content)return` ${qe(E)}`;return""}).filter(Boolean).join(`
54
+ `),it=Gt(l,s),st=Object.entries(f).map(([E,O])=>` ${E}="${k(String(O))}"`).join(""),ot=h?` class="${k(h)}"`:"",at=[tt,r.colorMode?` ${fe(r.colorMode)}`:"",` <title>${r.titleIsHtml?y:Xt(y)}</title>`,` ${Ke}`,nt,rt,g?` ${g}`:"",...(r.styles||[]).map((E)=>` ${E}`),...v.map((E)=>` ${E}`),...(r.headScripts||[]).map((E)=>` ${E}`),r.headStack||""].filter(Boolean),ct=[x,...(r.bodyScripts||[]).map((E)=>E),r.bodyStack||""].filter(Boolean);return`<!DOCTYPE html>
50
55
  <html${it}>
51
56
  <head>
52
57
  ${at.join(`
@@ -56,8 +61,8 @@ ${at.join(`
56
61
  ${ct.join(`
57
62
  `)}
58
63
  </body>
59
- </html>`}var me=/\s+/y,he=/<(script|style)\b[^>]*>/iy,tn=/<\/script>/gi,nn=/<\/style>/gi,Ve=/<!DOCTYPE\b/iy,We=/<html[\s>]/iy;function Dn(e){let t=0;while(t<e.length){if(me.lastIndex=t,me.exec(e)){t=me.lastIndex;continue}if(e.startsWith("<!--",t)){let s=e.indexOf("-->",t);if(s===-1)return!1;t=s+3;continue}he.lastIndex=t;let i=he.exec(e);if(i){let s=i[1].toLowerCase()==="script"?tn:nn;s.lastIndex=he.lastIndex;let o=s.exec(e);if(o===null)return!1;t=o.index+o[0].length;continue}if(Ve.lastIndex=t,Ve.test(e))return!0;return We.lastIndex=t,We.test(e)}return!1}function Ji(e){return Dn(e)}function Ol(e,t={}){let r=D(e);if(r===-1)return e;let{meta:i=[],link:s=[],script:o=[],headRaw:a=""}=t,c=e.slice(0,r),g=[];for(let l of i){let h=bt(l);if(h&&c.includes(h))continue;g.push(` <meta ${_(l)}>`)}for(let l of s){if(l.href&&c.includes(`href="${l.href}"`))continue;g.push(` <link ${_(l)}>`)}for(let l of o)if(l.src){if(c.includes(`src="${l.src}"`))continue;g.push(` <script ${_(l,(h)=>h==="content")}></script>`)}else if(l.content){if(c.includes(q(l)))continue;g.push(` ${qe(l)}`)}if(a&&!c.includes(a))g.push(` ${a}`);if(g.length===0)return e;return`${e.slice(0,r)}${g.join(`
64
+ </html>`}var de=/\s+/y,me=/<(script|style)\b[^>]*>/iy,tn=/<\/script>/gi,nn=/<\/style>/gi,Ve=/<!DOCTYPE\b/iy,We=/<html[\s>]/iy;function Ln(e){let t=0;while(t<e.length){if(de.lastIndex=t,de.exec(e)){t=de.lastIndex;continue}if(e.startsWith("<!--",t)){let s=e.indexOf("-->",t);if(s===-1)return!1;t=s+3;continue}me.lastIndex=t;let i=me.exec(e);if(i){let s=i[1].toLowerCase()==="script"?tn:nn;s.lastIndex=me.lastIndex;let o=s.exec(e);if(o===null)return!1;t=o.index+o[0].length;continue}if(Ve.lastIndex=t,Ve.test(e))return!0;return We.lastIndex=t,We.test(e)}return!1}function Zi(e){return Ln(e)}function Nl(e,t={}){let r=L(e);if(r===-1)return e;let{meta:i=[],link:s=[],script:o=[],headRaw:a=""}=t,c=e.slice(0,r),g=[];for(let l of i){let h=vt(l);if(h&&c.includes(h))continue;g.push(` <meta ${A(l)}>`)}for(let l of s){if(l.href&&c.includes(`href="${l.href}"`))continue;g.push(` <link ${A(l)}>`)}for(let l of o)if(l.src){if(c.includes(`src="${l.src}"`))continue;g.push(` <script ${A(l,(h)=>h==="content")}></script>`)}else if(l.content){if(c.includes(q(l)))continue;g.push(` ${qe(l)}`)}if(a&&!c.includes(a))g.push(` ${a}`);if(g.length===0)return e;return`${e.slice(0,r)}${g.join(`
60
65
  `)}
61
- ${e.slice(r)}`}function Vr(e,t={},r={},i){if(i??Ji(e))return e;return en(e,t,r)}var rn=["og:","article:","book:","profile:","fb:","music:","video:"],sn=/^[a-z][\w-]*(?::[\w:-]+)?$/i;function Ur(e,t){if(e.length<1)return{kind:"error",message:"meta directive requires at least the meta name",code:n.INVALID_DIRECTIVE_SYNTAX};if(e.length>2)return{kind:"error",message:`@meta takes a name and a value, got ${e.length} arguments`,code:n.INVALID_DIRECTIVE_SYNTAX};let r=on(e[0],t);if(typeof r!=="string")return r;let i;if(e.length===2){let o=an(e[1],t);if(typeof o!=="string")return o;i=o}else{let o=r.includes(":")?r.slice(r.indexOf(":")+1):r,a=t.openGraph,c=t[o]??(yt(a)?a[o]:void 0);i=c===void 0||c===null||typeof c==="object"?"":String(c)}if(!i)return{kind:"empty"};return{kind:"tag",tag:rn.some((o)=>r.startsWith(o))?{property:r,content:i}:{name:r,content:i}}}function on(e,t){let r=ge(e);if(r!==null)return r.trim()?r:{kind:"error",message:"the meta name is empty",code:n.INVALID_DIRECTIVE_SYNTAX};if(sn.test(e.trim()))return e.trim();let i=Zt(e,t);if(!i.ok)return{kind:"error",message:`meta name: ${i.message}`,code:i.code};if(typeof i.value!=="string"||!i.value.trim())return{kind:"error",message:`the meta name must be a non-empty string, got ${Ze(i.value)}`,code:n.TYPE_ERROR};return i.value}function an(e,t){let r=ge(e);if(r!==null)return r;let i=Zt(e,t);if(!i.ok)return{kind:"error",message:i.message,code:i.code};let s=i.value;if(s===void 0||s===null||s===!1)return"";if(Array.isArray(s))return s.filter((o)=>o!==void 0&&o!==null&&o!=="").map(String).join(", ");if(typeof s==="object"&&!(s instanceof Date))return{kind:"error",message:`the content must be text, got ${Ze(s)}`,code:n.TYPE_ERROR};return String(s)}var Wr=["title","lang","meta","link","script","headRaw","htmlAttrs","bodyClass","bodyAttrs"],fo=["title","titleTemplate","base","meta","link","script","style","htmlAttrs","bodyAttrs"],Je={links:"link",metas:"meta",scripts:"script",styles:"style"},Ge=new Set,Ye=new WeakMap;function ye(e){if(Ge.has(e))return;Ge.add(e),console.warn(e)}function cn(e,t){let r=Array.from({length:t.length+1},(i,s)=>s);for(let i=1;i<=e.length;i++){let s=r[0];r[0]=i;for(let o=1;o<=t.length;o++){let a=r[o];r[o]=Math.min(r[o]+1,r[o-1]+1,s+(e[i-1]===t[o-1]?0:1)),s=a}}return r[t.length]}function ln(e,t){let r=e.toLowerCase(),i=t.find((g)=>g.toLowerCase()===r);if(i)return i;let s=Je[r];if(s&&t.includes(s))return s;let o,a=1/0;for(let g of t){let l=cn(r,g.toLowerCase());if(l<a)o=g,a=l}let c=Math.min(e.length,o?.length??0)<=4?1:2;return a<=c?o:void 0}function Me(e,t){if(!e||typeof e!=="object"||Array.isArray(e))return e||{};let r=Ye.get(e);if(r)return r;let{known:i,source:s}=t,o=e;for(let a of Object.keys(e)){if(i.includes(a))continue;let c=Je[a];if(c&&i.includes(c)&&Array.isArray(e[a])){if(o===e)o={...e};let l=Array.isArray(o[c])?o[c]:[];o[c]=[...l,...e[a]],delete o[a],ye(`[stx] ${s}.${a} is not a head key; reading it as ${s}.${c}. Rename it to \`${c}\`.`);continue}if(/^styles?$/.test(a)&&!i.includes("style")){ye(`[stx] ${s}.${a} is not a head key and is ignored. Use \`link\` with rel: 'stylesheet', or \`headRaw\` for an inline <style>.`);continue}let g=ln(a,i);ye(g?`[stx] ${s}.${a} is not a head key and is ignored. Did you mean \`${g}\`?`:`[stx] ${s}.${a} is not a head key and is ignored. Known keys: ${i.join(", ")}.`)}return Ye.set(e,o),o}var C={},un=[],G={};function Yi(){return C}function Oy(){return G}function Ny(){C={},un.length=0,G={}}function Nl(e){C=Qe(C,Me(e,{known:fo,source:"useHead()"}))}function et(e,t,r){let i=[...e||[]];for(let s of t||[]){let o=r(s),a=o?i.findIndex((c)=>r(c)===o):-1;if(a<0)i.push(s);else i[a]=s}return i}function Qe(e,t){return{title:t.title??e.title,titleTemplate:t.titleTemplate??e.titleTemplate,base:t.base??e.base,meta:et(e.meta,t.meta,(r)=>r.name||r.property||(r.httpEquiv?`http:${r.httpEquiv}`:void 0)),link:et(e.link,t.link,(r)=>["icon","apple-touch-icon","canonical"].includes(r.rel||"")?[r.rel,r.type,r.media,r.sizes].join(":"):void 0),script:[...e.script||[],...t.script||[]],style:[...e.style||[],...t.style||[]],htmlAttrs:{...e.htmlAttrs,...t.htmlAttrs},bodyAttrs:{...e.bodyAttrs,...t.bodyAttrs}}}function Jg(e){Nl(go(e))}function go(e){let t=[];if(e.description)t.push({name:"description",content:e.description});if(e.keywords){let g=Array.isArray(e.keywords)?e.keywords.join(", "):e.keywords;t.push({name:"keywords",content:g})}if(e.author)t.push({name:"author",content:e.author});if(e.robots)t.push({name:"robots",content:e.robots});let r=e.ogTitle??e.title,i=e.ogDescription??e.description;if(r)t.push({property:"og:title",content:r});if(i)t.push({property:"og:description",content:i});if(e.ogImage){if(t.push({property:"og:image",content:e.ogImage}),e.ogImageType)t.push({property:"og:image:type",content:e.ogImageType});if(e.ogImageWidth)t.push({property:"og:image:width",content:String(e.ogImageWidth)});if(e.ogImageHeight)t.push({property:"og:image:height",content:String(e.ogImageHeight)});if(e.ogImageAlt)t.push({property:"og:image:alt",content:e.ogImageAlt})}if(e.ogUrl)t.push({property:"og:url",content:e.ogUrl});if(e.ogType)t.push({property:"og:type",content:e.ogType});if(e.ogSiteName)t.push({property:"og:site_name",content:e.ogSiteName});if(e.ogLocale)t.push({property:"og:locale",content:e.ogLocale});if(e.profileFirstName)t.push({property:"profile:first_name",content:e.profileFirstName});if(e.profileLastName)t.push({property:"profile:last_name",content:e.profileLastName});if(e.profileUsername)t.push({property:"profile:username",content:e.profileUsername});let s=e.twitterTitle??e.title,o=e.twitterDescription??e.description,a=e.twitterImage??e.ogImage;if(e.twitterCard)t.push({name:"twitter:card",content:e.twitterCard});if(s)t.push({name:"twitter:title",content:s});if(o)t.push({name:"twitter:description",content:o});if(a){t.push({name:"twitter:image",content:a});let g=e.twitterImageAlt??(e.twitterImage?void 0:e.ogImageAlt);if(g)t.push({name:"twitter:image:alt",content:g})}if(e.twitterSite)t.push({name:"twitter:site",content:e.twitterSite});if(e.twitterCreator)t.push({name:"twitter:creator",content:e.twitterCreator});if(e.articleAuthor)t.push({property:"article:author",content:e.articleAuthor});if(e.articlePublishedTime)t.push({property:"article:published_time",content:e.articlePublishedTime});if(e.articleModifiedTime)t.push({property:"article:modified_time",content:e.articleModifiedTime});if(e.articleSection)t.push({property:"article:section",content:e.articleSection});if(e.articleTags)for(let g of e.articleTags)t.push({property:"article:tag",content:g});let c=[];if(e.canonical)c.push({rel:"canonical",href:e.canonical});return{title:e.title,titleTemplate:e.titleTemplate,meta:t,link:c}}function My(e){if(G={...G,...e},e.title||e.description)Jg({title:e.title,description:e.description})}function Dy(e){let t=typeof e==="function"?e():e;Nl({title:t})}function Ly(e=C){let t=[];if(e.title){let r=e.title;if(e.titleTemplate)r=typeof e.titleTemplate==="function"?e.titleTemplate(r):e.titleTemplate.replace("%s",r);t.push(`<title>${I(r)}</title>`)}if(e.base){let r=Object.entries(e.base).map(([i,s])=>`${i}="${I(s)}"`).join(" ");t.push(`<base ${r}>`)}for(let r of e.meta||[]){let i=Object.entries(r).filter(([s,o])=>o!==void 0).map(([s,o])=>`${s==="httpEquiv"?"http-equiv":s}="${I(String(o))}"`).join(" ");t.push(`<meta ${i}>`)}for(let r of e.link||[]){let i=Object.entries(r).filter(([s,o])=>o!==void 0).map(([s,o])=>`${s}="${I(String(o))}"`).join(" ");t.push(`<link ${i}>`)}for(let r of e.script||[]){let{content:i,...s}=r,o=Object.entries(s).filter(([a,c])=>c!==void 0).map(([a,c])=>{if(typeof c==="boolean")return c?a:"";return`${a}="${I(String(c))}"`}).filter(Boolean).join(" ");if(i)t.push(`<script ${o}>${q(r)}</script>`);else t.push(`<script ${o}></script>`)}for(let r of e.style||[]){let i=r.type?` type="${r.type}"`:"";t.push(`<style${i}>${r.content}</style>`)}return t.join(`
62
- `)}function jy(e=C){if(!e.htmlAttrs)return"";return Object.entries(e.htmlAttrs).map(([t,r])=>`${t}="${I(r)}"`).join(" ")}function By(e=C){if(!e.bodyAttrs)return"";return Object.entries(e.bodyAttrs).map(([t,r])=>`${t}="${I(r)}"`).join(" ")}function I(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function Fy(e=C){if(typeof document>"u")return;if(e.title){let t=e.title;if(e.titleTemplate)t=typeof e.titleTemplate==="function"?e.titleTemplate(t):e.titleTemplate.replace("%s",t);document.title=t}for(let t of e.meta||[]){let r=t.name?`meta[name="${t.name}"]`:t.property?`meta[property="${t.property}"]`:null;if(r){let i=document.querySelector(r);if(!i){if(i=document.createElement("meta"),t.name)i.setAttribute("name",t.name);if(t.property)i.setAttribute("property",t.property);document.head.appendChild(i)}i.setAttribute("content",t.content)}}for(let t of e.link||[]){let r=`link[rel="${t.rel}"]${t.href?`[href="${t.href}"]`:""}`,i=document.querySelector(r);if(!i)i=document.createElement("link"),document.head.appendChild(i);for(let[s,o]of Object.entries(t))if(o!==void 0)i.setAttribute(s,String(o))}if(e.htmlAttrs)for(let[t,r]of Object.entries(e.htmlAttrs))if(t==="class")for(let i of String(r).split(/\s+/).filter(Boolean))document.documentElement.classList.add(i);else document.documentElement.setAttribute(t,r);if(e.bodyAttrs)for(let[t,r]of Object.entries(e.bodyAttrs))document.body.setAttribute(t,r)}function zy(e){let t="";return{content:e.replace(/@head\s*([\s\S]*?)@endhead/g,(i,s)=>(t+=s.trim()+`
63
- `,"")),headContent:t.trim()}}function Hy(e,t){return e.replace(/@title\s*\(\s*(?:(['"`])(.+?)\1|([^)]+))\s*\)/g,(r,i,s,o)=>{let a=i?s:t[(o||"").trim()]??o,c=t.__stx_runtime_head??{};return t.__stx_runtime_head=Qe(c,{title:a}),""})}function Vy(e,t,r=""){if(!e.includes("@meta"))return e;return Jt(e,/(?<![\w$@])@meta\s*\(/g,(i,s)=>{let o=Ur(Yt(i),t);if(o.kind==="error")return z("Meta",s,o.message,r,o.code);if(o.kind==="tag"){let a=t.__stx_runtime_head??{};t.__stx_runtime_head=Qe(a,{meta:[o.tag]})}return""},(i)=>z("Meta",i,"the call has no closing parenthesis",r,n.INVALID_DIRECTIVE_SYNTAX))}export{co,Wi,lo,d,m,Tl,N,ht,Xt,p,uo,n,ae,Br,ee,u,Ne,qi,K,Mn,Ki,k,$l,Gi,Jt,Yt,Zt,Ze,yt,z,po,Xi,Rl,Fr,zr,Al,bt,Pl,Hr,Il,Dn,Ji,Ol,Vr,Ur,Wr,fo,Me,Yi,Oy,Ny,Nl,Qe,Jg,go,My,Dy,Ly,jy,By,Fy,zy,Hy,Vy};
66
+ ${e.slice(r)}`}function qr(e,t={},r={},i){if(i??Zi(e))return e;return en(e,t,r)}var rn=["og:","article:","book:","profile:","fb:","music:","video:"],sn=/^[a-z][\w-]*(?::[\w:-]+)?$/i;function Kr(e,t){if(e.length<1)return{kind:"error",message:"meta directive requires at least the meta name",code:n.INVALID_DIRECTIVE_SYNTAX};if(e.length>2)return{kind:"error",message:`@meta takes a name and a value, got ${e.length} arguments`,code:n.INVALID_DIRECTIVE_SYNTAX};let r=on(e[0],t);if(typeof r!=="string")return r;let i;if(e.length===2){let o=an(e[1],t);if(typeof o!=="string")return o;i=o}else{let o=r.includes(":")?r.slice(r.indexOf(":")+1):r,a=t.openGraph,c=t[o]??(wt(a)?a[o]:void 0);i=c===void 0||c===null||typeof c==="object"?"":String(c)}if(!i)return{kind:"empty"};return{kind:"tag",tag:rn.some((o)=>r.startsWith(o))?{property:r,content:i}:{name:r,content:i}}}function on(e,t){let r=bt(e);if(r!==null)return r.trim()?r:{kind:"error",message:"the meta name is empty",code:n.INVALID_DIRECTIVE_SYNTAX};if(sn.test(e.trim()))return e.trim();let i=Qt(e,t);if(!i.ok)return{kind:"error",message:`meta name: ${i.message}`,code:i.code};if(typeof i.value!=="string"||!i.value.trim())return{kind:"error",message:`the meta name must be a non-empty string, got ${Qe(i.value)}`,code:n.TYPE_ERROR};return i.value}function an(e,t){let r=bt(e);if(r!==null)return r;let i=Qt(e,t);if(!i.ok)return{kind:"error",message:i.message,code:i.code};let s=i.value;if(s===void 0||s===null||s===!1)return"";if(Array.isArray(s))return s.filter((o)=>o!==void 0&&o!==null&&o!=="").map(String).join(", ");if(typeof s==="object"&&!(s instanceof Date))return{kind:"error",message:`the content must be text, got ${Qe(s)}`,code:n.TYPE_ERROR};return String(s)}var Gr=["title","lang","meta","link","script","headRaw","htmlAttrs","bodyClass","bodyAttrs"],ho=["title","titleTemplate","base","meta","link","script","style","htmlAttrs","bodyAttrs"],Je={links:"link",metas:"meta",scripts:"script",styles:"style"},Ge=new Set,Ye=new WeakMap;function he(e){if(Ge.has(e))return;Ge.add(e),console.warn(e)}function cn(e,t){let r=Array.from({length:t.length+1},(i,s)=>s);for(let i=1;i<=e.length;i++){let s=r[0];r[0]=i;for(let o=1;o<=t.length;o++){let a=r[o];r[o]=Math.min(r[o]+1,r[o-1]+1,s+(e[i-1]===t[o-1]?0:1)),s=a}}return r[t.length]}function ln(e,t){let r=e.toLowerCase(),i=t.find((g)=>g.toLowerCase()===r);if(i)return i;let s=Je[r];if(s&&t.includes(s))return s;let o,a=1/0;for(let g of t){let l=cn(r,g.toLowerCase());if(l<a)o=g,a=l}let c=Math.min(e.length,o?.length??0)<=4?1:2;return a<=c?o:void 0}function De(e,t){if(!e||typeof e!=="object"||Array.isArray(e))return e||{};let r=Ye.get(e);if(r)return r;let{known:i,source:s}=t,o=e;for(let a of Object.keys(e)){if(i.includes(a))continue;let c=Je[a];if(c&&i.includes(c)&&Array.isArray(e[a])){if(o===e)o={...e};let l=Array.isArray(o[c])?o[c]:[];o[c]=[...l,...e[a]],delete o[a],he(`[stx] ${s}.${a} is not a head key; reading it as ${s}.${c}. Rename it to \`${c}\`.`);continue}if(/^styles?$/.test(a)&&!i.includes("style")){he(`[stx] ${s}.${a} is not a head key and is ignored. Use \`link\` with rel: 'stylesheet', or \`headRaw\` for an inline <style>.`);continue}let g=ln(a,i);he(g?`[stx] ${s}.${a} is not a head key and is ignored. Did you mean \`${g}\`?`:`[stx] ${s}.${a} is not a head key and is ignored. Known keys: ${i.join(", ")}.`)}return Ye.set(e,o),o}var R={},un=[],G={};function Qi(){return R}function Ny(){return G}function My(){R={},un.length=0,G={}}function Ml(e){R=et(R,De(e,{known:ho,source:"useHead()"}))}function Ze(e,t,r){let i=[...e||[]];for(let s of t||[]){let o=r(s),a=o?i.findIndex((c)=>r(c)===o):-1;if(a<0)i.push(s);else i[a]=s}return i}function et(e,t){return{title:t.title??e.title,titleTemplate:t.titleTemplate??e.titleTemplate,base:t.base??e.base,meta:Ze(e.meta,t.meta,(r)=>r.name||r.property||(r.httpEquiv?`http:${r.httpEquiv}`:void 0)),link:Ze(e.link,t.link,(r)=>["icon","apple-touch-icon","canonical"].includes(r.rel||"")?[r.rel,r.type,r.media,r.sizes].join(":"):void 0),script:[...e.script||[],...t.script||[]],style:[...e.style||[],...t.style||[]],htmlAttrs:{...e.htmlAttrs,...t.htmlAttrs},bodyAttrs:{...e.bodyAttrs,...t.bodyAttrs}}}function Yg(e){Ml(yo(e))}function yo(e){let t=[];if(e.description)t.push({name:"description",content:e.description});if(e.keywords){let g=Array.isArray(e.keywords)?e.keywords.join(", "):e.keywords;t.push({name:"keywords",content:g})}if(e.author)t.push({name:"author",content:e.author});if(e.robots)t.push({name:"robots",content:e.robots});let r=e.ogTitle??e.title,i=e.ogDescription??e.description;if(r)t.push({property:"og:title",content:r});if(i)t.push({property:"og:description",content:i});if(e.ogImage){if(t.push({property:"og:image",content:e.ogImage}),e.ogImageType)t.push({property:"og:image:type",content:e.ogImageType});if(e.ogImageWidth)t.push({property:"og:image:width",content:String(e.ogImageWidth)});if(e.ogImageHeight)t.push({property:"og:image:height",content:String(e.ogImageHeight)});if(e.ogImageAlt)t.push({property:"og:image:alt",content:e.ogImageAlt})}if(e.ogUrl)t.push({property:"og:url",content:e.ogUrl});if(e.ogType)t.push({property:"og:type",content:e.ogType});if(e.ogSiteName)t.push({property:"og:site_name",content:e.ogSiteName});if(e.ogLocale)t.push({property:"og:locale",content:e.ogLocale});if(e.profileFirstName)t.push({property:"profile:first_name",content:e.profileFirstName});if(e.profileLastName)t.push({property:"profile:last_name",content:e.profileLastName});if(e.profileUsername)t.push({property:"profile:username",content:e.profileUsername});let s=e.twitterTitle??e.title,o=e.twitterDescription??e.description,a=e.twitterImage??e.ogImage;if(e.twitterCard)t.push({name:"twitter:card",content:e.twitterCard});if(s)t.push({name:"twitter:title",content:s});if(o)t.push({name:"twitter:description",content:o});if(a){t.push({name:"twitter:image",content:a});let g=e.twitterImageAlt??(e.twitterImage?void 0:e.ogImageAlt);if(g)t.push({name:"twitter:image:alt",content:g})}if(e.twitterSite)t.push({name:"twitter:site",content:e.twitterSite});if(e.twitterCreator)t.push({name:"twitter:creator",content:e.twitterCreator});if(e.articleAuthor)t.push({property:"article:author",content:e.articleAuthor});if(e.articlePublishedTime)t.push({property:"article:published_time",content:e.articlePublishedTime});if(e.articleModifiedTime)t.push({property:"article:modified_time",content:e.articleModifiedTime});if(e.articleSection)t.push({property:"article:section",content:e.articleSection});if(e.articleTags)for(let g of e.articleTags)t.push({property:"article:tag",content:g});let c=[];if(e.canonical)c.push({rel:"canonical",href:e.canonical});return{title:e.title,titleTemplate:e.titleTemplate,meta:t,link:c}}function Dy(e){if(G={...G,...e},e.title||e.description)Yg({title:e.title,description:e.description})}function Ly(e){let t=typeof e==="function"?e():e;Ml({title:t})}function jy(e=R){let t=[];if(e.title){let r=e.title;if(e.titleTemplate)r=typeof e.titleTemplate==="function"?e.titleTemplate(r):e.titleTemplate.replace("%s",r);t.push(`<title>${I(r)}</title>`)}if(e.base){let r=Object.entries(e.base).map(([i,s])=>`${i}="${I(s)}"`).join(" ");t.push(`<base ${r}>`)}for(let r of e.meta||[]){let i=Object.entries(r).filter(([s,o])=>o!==void 0).map(([s,o])=>`${s==="httpEquiv"?"http-equiv":s}="${I(String(o))}"`).join(" ");t.push(`<meta ${i}>`)}for(let r of e.link||[]){let i=Object.entries(r).filter(([s,o])=>o!==void 0).map(([s,o])=>`${s}="${I(String(o))}"`).join(" ");t.push(`<link ${i}>`)}for(let r of e.script||[]){let{content:i,...s}=r,o=Object.entries(s).filter(([a,c])=>c!==void 0).map(([a,c])=>{if(typeof c==="boolean")return c?a:"";return`${a}="${I(String(c))}"`}).filter(Boolean).join(" ");if(i)t.push(`<script ${o}>${q(r)}</script>`);else t.push(`<script ${o}></script>`)}for(let r of e.style||[]){let i=r.type?` type="${r.type}"`:"";t.push(`<style${i}>${r.content}</style>`)}return t.join(`
67
+ `)}function By(e=R){if(!e.htmlAttrs)return"";return Object.entries(e.htmlAttrs).map(([t,r])=>`${t}="${I(r)}"`).join(" ")}function Fy(e=R){if(!e.bodyAttrs)return"";return Object.entries(e.bodyAttrs).map(([t,r])=>`${t}="${I(r)}"`).join(" ")}function I(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function zy(e=R){if(typeof document>"u")return;if(e.title){let t=e.title;if(e.titleTemplate)t=typeof e.titleTemplate==="function"?e.titleTemplate(t):e.titleTemplate.replace("%s",t);document.title=t}for(let t of e.meta||[]){let r=t.name?`meta[name="${t.name}"]`:t.property?`meta[property="${t.property}"]`:null;if(r){let i=document.querySelector(r);if(!i){if(i=document.createElement("meta"),t.name)i.setAttribute("name",t.name);if(t.property)i.setAttribute("property",t.property);document.head.appendChild(i)}i.setAttribute("content",t.content)}}for(let t of e.link||[]){let r=`link[rel="${t.rel}"]${t.href?`[href="${t.href}"]`:""}`,i=document.querySelector(r);if(!i)i=document.createElement("link"),document.head.appendChild(i);for(let[s,o]of Object.entries(t))if(o!==void 0)i.setAttribute(s,String(o))}if(e.htmlAttrs)for(let[t,r]of Object.entries(e.htmlAttrs))if(t==="class")for(let i of String(r).split(/\s+/).filter(Boolean))document.documentElement.classList.add(i);else document.documentElement.setAttribute(t,r);if(e.bodyAttrs)for(let[t,r]of Object.entries(e.bodyAttrs))document.body.setAttribute(t,r)}function Hy(e){let t="";return{content:e.replace(/@head\s*([\s\S]*?)@endhead/g,(i,s)=>(t+=s.trim()+`
68
+ `,"")),headContent:t.trim()}}function Vy(e,t){return e.replace(/@title\s*\(\s*(?:(['"`])(.+?)\1|([^)]+))\s*\)/g,(r,i,s,o)=>{let a=i?s:t[(o||"").trim()]??o,c=t.__stx_runtime_head??{};return t.__stx_runtime_head=et(c,{title:a}),""})}function Uy(e,t,r=""){if(!e.includes("@meta"))return e;return Yt(e,/(?<![\w$@])@meta\s*\(/g,(i,s)=>{let o=Kr(Zt(i),t);if(o.kind==="error")return H("Meta",s,o.message,r,o.code);if(o.kind==="tag"){let a=t.__stx_runtime_head??{};t.__stx_runtime_head=et(a,{meta:[o.tag]})}return""},(i)=>H("Meta",i,"the call has no closing parenthesis",r,n.INVALID_DIRECTIVE_SYNTAX))}export{po,Gi,fo,d,m,$l,M,yt,zr,p,go,n,ce,Hr,te,u,Me,Xi,K,Dn,be,_,Rl,Ji,Yt,Zt,bt,Qt,Qe,wt,H,mo,Yi,Al,Vr,Ur,Pl,vt,Il,Wr,Ol,Ln,Zi,Nl,qr,Kr,Gr,ho,De,Qi,Ny,My,Ml,et,Yg,yo,Dy,Ly,jy,By,Fy,zy,Hy,Vy,Uy};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import s from"path";var h=new Set([".jpg",".jpeg",".png",".gif"]),d=[{ext:".avif",mime:"image/avif"},{ext:".webp",mime:"image/webp"}];async function wu(e,r){let a=r.formats??d;if(!r.publicDir)return e;let i=y(e),o=[],m=/<img\b[^>]*?>/gi,c=[],u;while((u=m.exec(e))!==null){let t=u[0],n=t.match(/\bsrc=["']([^"']+)["']/i);if(!n)continue;if(A(u.index,i))continue;c.push({idx:u.index,length:t.length,src:n[1],raw:t})}if(c.length===0)return e;let f=await Promise.all(c.map(async(t)=>{let n=await S(t.src,r.publicDir,a);return{match:t,sources:n}}));for(let{match:t,sources:n}of f){if(n.length===0)continue;let x=`<picture>${n.map((p)=>`<source type="${p.mime}" srcset="${P(p.url)}">`).join("")}${t.raw}</picture>`;o.push({start:t.idx,end:t.idx+t.length,replacement:x})}if(o.length===0)return e;let l="",g=0;for(let t of o)l+=e.slice(g,t.start),l+=t.replacement,g=t.end;return l+=e.slice(g),l}async function S(e,r,a){if(!w(e))return[];let i=s.extname(e).toLowerCase();if(!h.has(i))return[];if(!e.startsWith("/"))return[];let o=s.join(r,e.slice(1)),m=s.dirname(o),c=s.basename(o,i),u=s.resolve(m),f=s.resolve(r);if(!u.startsWith(f))return[];let l=s.posix.dirname(e),g=a.map(async(n)=>{let b=s.join(m,`${c}${n.ext}`);if(!await Bun.file(b).exists())return null;return{url:s.posix.join(l,`${c}${n.ext}`),mime:n.mime}});return(await Promise.all(g)).filter((n)=>n!==null)}function w(e){if(!e)return!1;if(e.startsWith("http://")||e.startsWith("https://"))return!1;if(e.startsWith("//"))return!1;if(e.startsWith("data:"))return!1;return!0}function y(e){let r=[],a=/<picture\b[^>]*>[\s\S]*?<\/picture>/gi,i;while((i=a.exec(e))!==null)r.push([i.index,i.index+i[0].length]);return r}function A(e,r){for(let[a,i]of r)if(e>=a&&e<i)return!0;return!1}function P(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;")}
3
- export{wu};
2
+ import s from"path";var h=new Set([".jpg",".jpeg",".png",".gif"]),d=[{ext:".avif",mime:"image/avif"},{ext:".webp",mime:"image/webp"}];async function vu(e,r){let a=r.formats??d;if(!r.publicDir)return e;let i=y(e),o=[],m=/<img\b[^>]*?>/gi,c=[],u;while((u=m.exec(e))!==null){let t=u[0],n=t.match(/\bsrc=["']([^"']+)["']/i);if(!n)continue;if(A(u.index,i))continue;c.push({idx:u.index,length:t.length,src:n[1],raw:t})}if(c.length===0)return e;let f=await Promise.all(c.map(async(t)=>{let n=await S(t.src,r.publicDir,a);return{match:t,sources:n}}));for(let{match:t,sources:n}of f){if(n.length===0)continue;let x=`<picture>${n.map((p)=>`<source type="${p.mime}" srcset="${P(p.url)}">`).join("")}${t.raw}</picture>`;o.push({start:t.idx,end:t.idx+t.length,replacement:x})}if(o.length===0)return e;let l="",g=0;for(let t of o)l+=e.slice(g,t.start),l+=t.replacement,g=t.end;return l+=e.slice(g),l}async function S(e,r,a){if(!w(e))return[];let i=s.extname(e).toLowerCase();if(!h.has(i))return[];if(!e.startsWith("/"))return[];let o=s.join(r,e.slice(1)),m=s.dirname(o),c=s.basename(o,i),u=s.resolve(m),f=s.resolve(r);if(!u.startsWith(f))return[];let l=s.posix.dirname(e),g=a.map(async(n)=>{let b=s.join(m,`${c}${n.ext}`);if(!await Bun.file(b).exists())return null;return{url:s.posix.join(l,`${c}${n.ext}`),mime:n.mime}});return(await Promise.all(g)).filter((n)=>n!==null)}function w(e){if(!e)return!1;if(e.startsWith("http://")||e.startsWith("https://"))return!1;if(e.startsWith("//"))return!1;if(e.startsWith("data:"))return!1;return!0}function y(e){let r=[],a=/<picture\b[^>]*>[\s\S]*?<\/picture>/gi,i;while((i=a.exec(e))!==null)r.push([i.index,i.index+i[0].length]);return r}function A(e,r){for(let[a,i]of r)if(e>=a&&e<i)return!0;return!1}function P(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;")}
3
+ export{vu};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{vu}from"./chunk-xvncq3m5.js";export{vu as rewriteImagesWithSiblings};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{_i,Ci,Dt,Se,Tr,Us,$r,Ws,qs,vg,xg,Sg,Rr,kg,_g,Cg,Eg,Jc,Yc,Zc,Ei,Qc,Tg,Lt,jt,Bt,Ft,zt,Ht,ft,$g}from"./chunk-8ccgty8s.js";export{$r as Router,Cg as abortNavigation,Us as bracketPathToRegex,Lt as clearMiddleware,Yc as createClientCookieManager,zt as createMiddlewareContext,Ft as createRouteLocation,Jc as createServerCookieManager,Zc as createStorageManager,Eg as defineMiddleware,xg as defineRoute,Sg as defineRoutes,Ws as findErrorPage,qs as formatRoutes,Ci as generateRouteManifest,_i as generateRouteTypes,Qc as getMiddleware,jt as getMiddlewareNames,ft as getRouterScript,$g as getRouterScriptDev,Tg as hasMiddleware,Dt as isFileRequestPath,Bt as loadMiddlewareFromDirectory,Tr as matchRoute,_g as navigateTo,Se as patternToRegex,Ei as registerMiddleware,kg as resetRoutes,Rr as route,Ht as runMiddleware,vg as setAppUrl};
@@ -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 G(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 H(e){try{return await y(e),!0}catch{return!1}}import{mkdir as v,readFile as A,writeFile as P,readdir as z,rm as k,stat as B}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 Gr(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 H(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 G(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 Jr(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{G,H,Gr,Xr,Jr};
2
+ import{createHash as g}from"crypto";import{readFile as b,stat as y}from"fs/promises";async function G(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 V(e){try{return await y(e),!0}catch{return!1}}import{mkdir as v,readFile as A,writeFile as P,readdir as z,rm as k,stat as B}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 Yr(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 V(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 Zr(e,t,r,a,n=d){if(!n.enabled)return;let i=m(e,t),o=await G(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 Qr(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{G,V,Yr,Zr,Qr};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- var g=0;function p(){return`async-${++g}-${Date.now().toString(36)}`}function Gm(e,t={},c){let o=/@async\s*\(([^)]*)\)\s*([\s\S]*?)@error\s*([\s\S]*?)@endasync/gi,i=/@async\s*\(([^)]*)\)\s*([\s\S]*?)@endasync/gi,n=e;return n=n.replace(o,(r,s,a,d)=>{let l=p(),y=u(s);return m(l,y,a.trim(),d.trim())}),n=n.replace(i,(r,s,a)=>{let d=p(),l=u(s);return m(d,l,a.trim(),'<div class="stx-async-error">Failed to load component</div>')}),n}function u(e){let t={component:"",timeout:30000,delay:200,suspensible:!0,retries:0},c=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,o;while((o=c.exec(e))!==null){let i=o[1],n=o[2]||o[3],r=o[4],s=o[5];switch(i){case"component":t.component=n||s||"";break;case"timeout":t.timeout=r?parseInt(r,10):30000;break;case"delay":t.delay=r?parseInt(r,10):200;break;case"suspensible":t.suspensible=s==="true";break;case"retries":t.retries=r?parseInt(r,10):0;break;case"loadingComponent":t.loadingComponent=n||s;break;case"errorComponent":t.errorComponent=n||s;break}}return t}function m(e,t,c,o){let{component:i,timeout:n,delay:r,suspensible:s,retries:a}=t;return`
2
+ var g=0;function p(){return`async-${++g}-${Date.now().toString(36)}`}function Xm(e,t={},c){let o=/@async\s*\(([^)]*)\)\s*([\s\S]*?)@error\s*([\s\S]*?)@endasync/gi,i=/@async\s*\(([^)]*)\)\s*([\s\S]*?)@endasync/gi,n=e;return n=n.replace(o,(r,s,a,d)=>{let l=p(),y=u(s);return m(l,y,a.trim(),d.trim())}),n=n.replace(i,(r,s,a)=>{let d=p(),l=u(s);return m(d,l,a.trim(),'<div class="stx-async-error">Failed to load component</div>')}),n}function u(e){let t={component:"",timeout:30000,delay:200,suspensible:!0,retries:0},c=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,o;while((o=c.exec(e))!==null){let i=o[1],n=o[2]||o[3],r=o[4],s=o[5];switch(i){case"component":t.component=n||s||"";break;case"timeout":t.timeout=r?parseInt(r,10):30000;break;case"delay":t.delay=r?parseInt(r,10):200;break;case"suspensible":t.suspensible=s==="true";break;case"retries":t.retries=r?parseInt(r,10):0;break;case"loadingComponent":t.loadingComponent=n||s;break;case"errorComponent":t.errorComponent=n||s;break}}return t}function m(e,t,c,o){let{component:i,timeout:n,delay:r,suspensible:s,retries:a}=t;return`
3
3
  <div class="stx-async-component" data-async-id="${e}" data-component="${i}" data-status="pending">
4
4
  <div class="stx-async-loading" data-async-loading="${e}">
5
5
  ${c}
@@ -226,7 +226,7 @@ catch (error) {
226
226
  loadComponent();
227
227
  })();
228
228
  </script>
229
- `}function Xm(e){return{__asyncComponent:!0,...typeof e==="function"?{loader:e}:e}}function Jm(e){return typeof e==="object"&&e!==null&&"__asyncComponent"in e&&e.__asyncComponent===!0}function Ym(){return`
229
+ `}function Jm(e){return{__asyncComponent:!0,...typeof e==="function"?{loader:e}:e}}function Ym(e){return typeof e==="object"&&e!==null&&"__asyncComponent"in e&&e.__asyncComponent===!0}function Zm(){return`
230
230
  /* STX Async Component Styles */
231
231
  .stx-async-component {
232
232
  position: relative;
@@ -300,7 +300,7 @@ catch (error) {
300
300
  background-size: 200% 100%;
301
301
  }
302
302
  }
303
- `}function Zm(){return`
303
+ `}function Qm(){return`
304
304
  // STX Async Component Runtime
305
305
  (function() {
306
306
  if (typeof window === 'undefined') return;
@@ -355,4 +355,4 @@ catch (error) {
355
355
  console.log('[stx] Async component runtime initialized');
356
356
  })();
357
357
  `}
358
- export{Gm,Xm,Jm,Ym,Zm};
358
+ export{Xm,Jm,Ym,Zm,Qm};