@stacksjs/stx 0.2.413 → 0.2.415

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 (346) hide show
  1. package/dist/appearance-bootstrap.js +1 -1
  2. package/dist/binding-manifest.d.ts +1 -1
  3. package/dist/builtins/image-delivery.js +19 -11
  4. package/dist/bundle-analyzer.js +20 -20
  5. package/dist/chunk-020xyn9q.js +3 -0
  6. package/dist/chunk-04jhmfbz.js +2 -0
  7. package/dist/chunk-0pnj3zt2.js +2 -0
  8. package/dist/{chunk-bwjxk1dw.js → chunk-0zaess6f.js} +29 -29
  9. package/dist/chunk-1098mas0.js +2 -0
  10. package/dist/chunk-169n1vpx.js +12 -0
  11. package/dist/chunk-18vmfkcc.js +2 -0
  12. package/dist/chunk-1b6t12hd.js +2 -0
  13. package/dist/chunk-1xdzcy9d.js +14 -0
  14. package/dist/chunk-1zs30k3y.js +2 -0
  15. package/dist/chunk-2ce7f416.js +2 -0
  16. package/dist/chunk-340a824p.js +2 -0
  17. package/dist/chunk-393341w7.js +2 -0
  18. package/dist/chunk-39g1134q.js +2 -0
  19. package/dist/chunk-3efw27as.js +2785 -0
  20. package/dist/chunk-3kthfs03.js +3 -0
  21. package/dist/chunk-3qn1wcdg.js +2 -0
  22. package/dist/chunk-3s2vnqcf.js +2 -0
  23. package/dist/chunk-42wbs8vq.js +17 -0
  24. package/dist/chunk-4bjravgk.js +2 -0
  25. package/dist/chunk-5gsxpaqk.js +2 -0
  26. package/dist/{chunk-bwsxym3d.js → chunk-5qns2sdz.js} +17 -17
  27. package/dist/chunk-6cfa3g0r.js +2 -0
  28. package/dist/{chunk-bjar18jd.js → chunk-6h38kkjf.js} +46 -52
  29. package/dist/chunk-6hc5vz20.js +3 -0
  30. package/dist/chunk-6q6g76vg.js +499 -0
  31. package/dist/chunk-74j18qk0.js +930 -0
  32. package/dist/chunk-752hw7cd.js +4 -0
  33. package/dist/{chunk-kgd8kchy.js → chunk-765e1s44.js} +11 -76
  34. package/dist/chunk-7gkv67ky.js +4 -0
  35. package/dist/chunk-7z2ra0yf.js +2 -0
  36. package/dist/chunk-8eqrwj1k.js +20 -0
  37. package/dist/chunk-8nhshfz6.js +5 -0
  38. package/dist/chunk-92ps1xpk.js +2 -0
  39. package/dist/chunk-96k8s808.js +3 -0
  40. package/dist/chunk-9amp82bx.js +7 -0
  41. package/dist/chunk-9g27ybyr.js +3 -0
  42. package/dist/chunk-9p9qkbtg.js +3 -0
  43. package/dist/{chunk-xq1acw1r.js → chunk-9pt8fd2n.js} +13 -13
  44. package/dist/{chunk-24zher49.js → chunk-9vrja6vp.js} +4 -4
  45. package/dist/chunk-9xrbve19.js +2 -0
  46. package/dist/chunk-a688m6js.js +3 -0
  47. package/dist/chunk-ak1cgcah.js +5 -0
  48. package/dist/{chunk-4m7ajama.js → chunk-amd6ey3t.js} +14 -14
  49. package/dist/chunk-amtr3rmf.js +11 -0
  50. package/dist/chunk-atws6p5s.js +2 -0
  51. package/dist/chunk-b84h16er.js +61 -0
  52. package/dist/chunk-b98be3yp.js +32 -0
  53. package/dist/{chunk-hx998w7n.js → chunk-bay9s6rs.js} +13 -13
  54. package/dist/chunk-ce1sejr3.js +3 -0
  55. package/dist/chunk-cg8hg6cs.js +3 -0
  56. package/dist/{chunk-4f9zyfdw.js → chunk-czxt605c.js} +4 -5
  57. package/dist/chunk-dd8cja4h.js +2 -0
  58. package/dist/chunk-dgdm3hy3.js +2 -0
  59. package/dist/chunk-e9hs7kk6.js +12 -0
  60. package/dist/chunk-eed4fwps.js +3 -0
  61. package/dist/chunk-ej9j6k1q.js +3 -0
  62. package/dist/chunk-et0rr8c7.js +3 -0
  63. package/dist/chunk-f1sxycmv.js +2 -0
  64. package/dist/chunk-f46qsp4m.js +4 -0
  65. package/dist/chunk-fbcv4fes.js +2 -0
  66. package/dist/{chunk-bjcsc6wx.js → chunk-fh1qrp68.js} +21 -21
  67. package/dist/chunk-fjs0a8h7.js +2 -0
  68. package/dist/chunk-fpfzm238.js +2 -0
  69. package/dist/chunk-fr2txj8q.js +829 -0
  70. package/dist/{chunk-xssw417m.js → chunk-ft4p6d28.js} +14 -14
  71. package/dist/chunk-fyzajkrx.js +2 -0
  72. package/dist/chunk-fzapbw9p.js +3 -0
  73. package/dist/chunk-g03s93qr.js +3 -0
  74. package/dist/chunk-g186znp9.js +33 -0
  75. package/dist/chunk-gawrg4gb.js +216 -0
  76. package/dist/chunk-gc1drn2p.js +2 -0
  77. package/dist/chunk-gea5hf0v.js +2 -0
  78. package/dist/chunk-gqv3ta5d.js +2 -0
  79. package/dist/chunk-h6kp2m9r.js +2 -0
  80. package/dist/chunk-h6zsqb9r.js +3 -0
  81. package/dist/{chunk-2snqdnk9.js → chunk-h85hrwkq.js} +13 -13
  82. package/dist/chunk-hbxz85wy.js +2 -0
  83. package/dist/chunk-hepd9qgx.js +6 -0
  84. package/dist/chunk-hhnw2sn3.js +2 -0
  85. package/dist/chunk-hjg3ndgh.js +2 -0
  86. package/dist/chunk-hk1mj4tz.js +2 -0
  87. package/dist/{chunk-smcj3442.js → chunk-hkrmcbwy.js} +79 -79
  88. package/dist/chunk-hn9pkyv8.js +2 -0
  89. package/dist/chunk-hpgr4qgp.js +2 -0
  90. package/dist/chunk-hrbbbtbn.js +2 -0
  91. package/dist/chunk-j03revz2.js +8 -0
  92. package/dist/chunk-j9qcrwbg.js +2 -0
  93. package/dist/chunk-jk4njz0w.js +2 -0
  94. package/dist/chunk-jmabeqfq.js +2 -0
  95. package/dist/chunk-jnkrn913.js +4 -0
  96. package/dist/chunk-jp10q90g.js +2 -0
  97. package/dist/chunk-jt0n43mk.js +2 -0
  98. package/dist/chunk-kjbv8a3m.js +2 -0
  99. package/dist/chunk-m1vdghnx.js +2 -0
  100. package/dist/chunk-m4sk62wb.js +5 -0
  101. package/dist/chunk-md8rqn48.js +30 -0
  102. package/dist/chunk-mp6hy8g4.js +2 -0
  103. package/dist/chunk-nc8my58s.js +2 -0
  104. package/dist/chunk-ngc2wke4.js +3 -0
  105. package/dist/chunk-nn2vstke.js +2 -0
  106. package/dist/chunk-nppdrf0x.js +2 -0
  107. package/dist/chunk-p2v2a68k.js +2 -0
  108. package/dist/chunk-pazfr1a1.js +2 -0
  109. package/dist/{chunk-qn5srnj3.js → chunk-pbh4smw3.js} +16 -16
  110. package/dist/chunk-pdb5fw3r.js +2 -0
  111. package/dist/chunk-pdt69hpb.js +2 -0
  112. package/dist/chunk-pgzvyrv6.js +29 -0
  113. package/dist/chunk-px7fvbj6.js +3 -0
  114. package/dist/chunk-q6vrb2pe.js +2 -0
  115. package/dist/chunk-q7qchkvk.js +2 -0
  116. package/dist/chunk-q9bdh4s5.js +8 -0
  117. package/dist/chunk-qghxz7jm.js +194 -0
  118. package/dist/chunk-r3f9jcf7.js +5 -0
  119. package/dist/chunk-re8b5r9x.js +3 -0
  120. package/dist/chunk-s5xezjps.js +3 -0
  121. package/dist/chunk-sd321bn3.js +2 -0
  122. package/dist/chunk-shr559s7.js +3 -0
  123. package/dist/chunk-t4hzprsm.js +3 -0
  124. package/dist/chunk-t5pvq5mx.js +2 -0
  125. package/dist/{chunk-pv3d7sfn.js → chunk-t61vdbje.js} +89 -89
  126. package/dist/chunk-tafqyf2g.js +2033 -0
  127. package/dist/chunk-tfexmdkt.js +3 -0
  128. package/dist/chunk-thyt8ed8.js +6 -0
  129. package/dist/chunk-v91p6ekp.js +24 -0
  130. package/dist/chunk-vgvtnwxa.js +4 -0
  131. package/dist/chunk-w72qx0eb.js +2 -0
  132. package/dist/chunk-wfy1zq53.js +30 -0
  133. package/dist/chunk-wzx0164n.js +18 -0
  134. package/dist/chunk-x0q32ees.js +3 -0
  135. package/dist/chunk-xfp7k0v8.js +64 -0
  136. package/dist/chunk-xtvf6n6f.js +4 -0
  137. package/dist/chunk-xwzvfqcb.js +2 -0
  138. package/dist/chunk-y1cmjvk3.js +43 -0
  139. package/dist/chunk-y5310237.js +311 -0
  140. package/dist/chunk-ya0qecph.js +27 -0
  141. package/dist/chunk-yazk54jr.js +8 -0
  142. package/dist/chunk-ydjfar14.js +2 -0
  143. package/dist/chunk-ym95v4nc.js +3 -0
  144. package/dist/chunk-z0g9jvv0.js +40 -0
  145. package/dist/chunk-z23kaxq6.js +2 -0
  146. package/dist/chunk-z8xn5ta3.js +2 -0
  147. package/dist/{chunk-8sdhs0zk.js → chunk-zhxdpzga.js} +4 -4
  148. package/dist/cli.js +110 -110
  149. package/dist/craft-entry.js +7 -7
  150. package/dist/craft.js +7 -7
  151. package/dist/database.js +2 -2
  152. package/dist/image-optimization/component.js +4 -4
  153. package/dist/media/image/component.js +5 -5
  154. package/dist/media/protected/component.js +2 -2
  155. package/dist/media/video/index.js +4 -4
  156. package/dist/native/bridge/protocol.d.ts +325 -0
  157. package/dist/native/bridge/protocol.js +219 -0
  158. package/dist/native/cli.d.ts +24 -0
  159. package/dist/native/cli.js +52 -0
  160. package/dist/native/compiler/bundle.d.ts +41 -0
  161. package/dist/native/compiler/bundle.js +90 -0
  162. package/dist/native/compiler/client-script.d.ts +8 -0
  163. package/dist/native/compiler/client-script.js +31 -0
  164. package/dist/native/compiler/codegen.d.ts +10 -0
  165. package/dist/native/compiler/codegen.js +145 -0
  166. package/dist/native/compiler/headwind-to-style.d.ts +395 -0
  167. package/dist/native/compiler/headwind-to-style.js +1163 -0
  168. package/dist/native/compiler/html-to-ir.d.ts +41 -0
  169. package/dist/native/compiler/html-to-ir.js +411 -0
  170. package/dist/native/compiler/icons.d.ts +220 -0
  171. package/dist/native/compiler/icons.js +208 -0
  172. package/dist/native/compiler/ir.d.ts +234 -0
  173. package/dist/native/compiler/ir.js +15 -0
  174. package/dist/native/compiler/parser.d.ts +88 -0
  175. package/dist/native/compiler/parser.js +753 -0
  176. package/dist/native/compiler/render-screen.d.ts +26 -0
  177. package/dist/native/compiler/render-screen.js +31 -0
  178. package/dist/native/components/primitives.d.ts +291 -0
  179. package/dist/native/components/primitives.js +22 -0
  180. package/dist/native/hot-reload/client.d.ts +62 -0
  181. package/dist/native/hot-reload/client.js +324 -0
  182. package/dist/native/index.d.ts +90 -0
  183. package/dist/native/index.js +34 -0
  184. package/dist/native/primitives/ActivityIndicator.stx +5 -0
  185. package/dist/native/primitives/Button.stx +5 -0
  186. package/dist/native/primitives/DatePicker.stx +5 -0
  187. package/dist/native/primitives/FlatList.stx +5 -0
  188. package/dist/native/primitives/Image.stx +5 -0
  189. package/dist/native/primitives/ImageBackground.stx +5 -0
  190. package/dist/native/primitives/KeyboardAvoidingView.stx +5 -0
  191. package/dist/native/primitives/Modal.stx +5 -0
  192. package/dist/native/primitives/Picker.stx +5 -0
  193. package/dist/native/primitives/Pressable.stx +5 -0
  194. package/dist/native/primitives/RefreshControl.stx +5 -0
  195. package/dist/native/primitives/SafeAreaView.stx +5 -0
  196. package/dist/native/primitives/ScrollView.stx +5 -0
  197. package/dist/native/primitives/SectionList.stx +5 -0
  198. package/dist/native/primitives/Slider.stx +5 -0
  199. package/dist/native/primitives/StatusBar.stx +5 -0
  200. package/dist/native/primitives/Switch.stx +5 -0
  201. package/dist/native/primitives/Text.stx +5 -0
  202. package/dist/native/primitives/TextInput.stx +5 -0
  203. package/dist/native/primitives/TouchableHighlight.stx +5 -0
  204. package/dist/native/primitives/TouchableOpacity.stx +5 -0
  205. package/dist/native/primitives/View.stx +5 -0
  206. package/dist/native/runtime/craft.d.ts +75 -0
  207. package/dist/native/runtime/craft.js +0 -0
  208. package/dist/native/runtime/entry.d.ts +1 -0
  209. package/dist/native/runtime/entry.js +3 -0
  210. package/dist/native/runtime/index.d.ts +45 -0
  211. package/dist/native/runtime/index.js +165 -0
  212. package/dist/native/runtime/native-host.d.ts +33 -0
  213. package/dist/native/runtime/native-host.js +184 -0
  214. package/dist/native/runtime/screen.d.ts +43 -0
  215. package/dist/native/runtime/screen.js +808 -0
  216. package/dist/pwa/service-worker.js +1 -1
  217. package/dist/pwa/workbox.js +1 -1
  218. package/dist/pwa.js +8 -8
  219. package/dist/site-url.d.ts +1 -1
  220. package/dist/ssg.js +53 -53
  221. package/dist/visual-testing.js +42 -42
  222. package/dist/web-components/reactive-generator.js +2 -2
  223. package/package.json +9 -5
  224. package/dist/chunk-0btmm4m2.js +0 -147
  225. package/dist/chunk-0c2h69k2.js +0 -4
  226. package/dist/chunk-0d0qeqvv.js +0 -2
  227. package/dist/chunk-0psndabd.js +0 -2
  228. package/dist/chunk-0qv8yf53.js +0 -2
  229. package/dist/chunk-0vkxyvsd.js +0 -2
  230. package/dist/chunk-0we9nw1d.js +0 -3
  231. package/dist/chunk-0xqdmemy.js +0 -3
  232. package/dist/chunk-0y46fbkx.js +0 -3
  233. package/dist/chunk-158wqccn.js +0 -4422
  234. package/dist/chunk-1cyxbb8y.js +0 -16
  235. package/dist/chunk-1enwnh2a.js +0 -2
  236. package/dist/chunk-213pzm0d.js +0 -3
  237. package/dist/chunk-21hzqyja.js +0 -12
  238. package/dist/chunk-266t58b8.js +0 -5
  239. package/dist/chunk-27fgag95.js +0 -4
  240. package/dist/chunk-2a9n102n.js +0 -2
  241. package/dist/chunk-2eqzrczk.js +0 -2
  242. package/dist/chunk-2ke37m54.js +0 -14
  243. package/dist/chunk-35ds08e7.js +0 -3
  244. package/dist/chunk-3mtwkjcg.js +0 -2
  245. package/dist/chunk-4xr8zwkp.js +0 -2
  246. package/dist/chunk-58v77x2c.js +0 -2
  247. package/dist/chunk-5mhq8605.js +0 -2
  248. package/dist/chunk-5se8xt9e.js +0 -64
  249. package/dist/chunk-5zh0h080.js +0 -2
  250. package/dist/chunk-62435225.js +0 -2
  251. package/dist/chunk-6kdrncsx.js +0 -30
  252. package/dist/chunk-6n2rr3x7.js +0 -2
  253. package/dist/chunk-6xk87qf2.js +0 -30
  254. package/dist/chunk-72rwcbp6.js +0 -3
  255. package/dist/chunk-76w34xne.js +0 -3
  256. package/dist/chunk-7ekd7zj9.js +0 -2
  257. package/dist/chunk-7pr3wdd5.js +0 -3
  258. package/dist/chunk-7rxvafwc.js +0 -24
  259. package/dist/chunk-7tnwfa7w.js +0 -8
  260. package/dist/chunk-8c5je0wf.js +0 -2
  261. package/dist/chunk-8dz6nyvx.js +0 -2
  262. package/dist/chunk-98zj3fv2.js +0 -7
  263. package/dist/chunk-9e8t0twa.js +0 -3
  264. package/dist/chunk-9fqp72ze.js +0 -5
  265. package/dist/chunk-anydpa34.js +0 -3
  266. package/dist/chunk-ay6zjq8v.js +0 -3
  267. package/dist/chunk-az4v4ard.js +0 -3
  268. package/dist/chunk-ba5erggg.js +0 -2
  269. package/dist/chunk-bnagrdz6.js +0 -2
  270. package/dist/chunk-by8wghtf.js +0 -2
  271. package/dist/chunk-cd7h4q51.js +0 -2
  272. package/dist/chunk-cjmv8hgp.js +0 -33
  273. package/dist/chunk-cthf912y.js +0 -2
  274. package/dist/chunk-cxbpmwq5.js +0 -4
  275. package/dist/chunk-d3sy16qn.js +0 -2
  276. package/dist/chunk-dh6s7mrj.js +0 -1199
  277. package/dist/chunk-dm2nzg7a.js +0 -2
  278. package/dist/chunk-e2sgcnxc.js +0 -2
  279. package/dist/chunk-e3b7jj74.js +0 -2
  280. package/dist/chunk-ec4wq2sv.js +0 -6
  281. package/dist/chunk-ekzg97dn.js +0 -29
  282. package/dist/chunk-epjt342x.js +0 -2
  283. package/dist/chunk-eqe26g14.js +0 -18
  284. package/dist/chunk-ev0v1yma.js +0 -2
  285. package/dist/chunk-f53psr2y.js +0 -5
  286. package/dist/chunk-f8p69dsg.js +0 -3
  287. package/dist/chunk-f95drhdb.js +0 -194
  288. package/dist/chunk-ff5a6hvb.js +0 -17
  289. package/dist/chunk-fs5fy4h8.js +0 -2
  290. package/dist/chunk-fzsygce3.js +0 -2
  291. package/dist/chunk-g465x63k.js +0 -2
  292. package/dist/chunk-g708ekh1.js +0 -2
  293. package/dist/chunk-gcr9e83g.js +0 -11
  294. package/dist/chunk-gdmyrsr8.js +0 -4
  295. package/dist/chunk-gkms2ngq.js +0 -2
  296. package/dist/chunk-gnfywmgs.js +0 -7
  297. package/dist/chunk-hpf8kq7e.js +0 -2
  298. package/dist/chunk-j4x3faf8.js +0 -2
  299. package/dist/chunk-jkavtw9f.js +0 -2
  300. package/dist/chunk-kg1rdena.js +0 -3
  301. package/dist/chunk-km91wx0v.js +0 -2
  302. package/dist/chunk-kmsyvaex.js +0 -8
  303. package/dist/chunk-mrahwn5v.js +0 -8
  304. package/dist/chunk-nk3czvnk.js +0 -2
  305. package/dist/chunk-nmw4eewb.js +0 -2
  306. package/dist/chunk-nq5zxrk0.js +0 -4
  307. package/dist/chunk-ny67c03k.js +0 -3
  308. package/dist/chunk-p4wdxp2c.js +0 -2
  309. package/dist/chunk-pcxp4r9n.js +0 -3
  310. package/dist/chunk-pdyeaxc1.js +0 -2
  311. package/dist/chunk-pf06ded4.js +0 -2
  312. package/dist/chunk-pfs0gpzm.js +0 -2
  313. package/dist/chunk-pshdwq44.js +0 -2
  314. package/dist/chunk-pwgv84pn.js +0 -32
  315. package/dist/chunk-pwsnafp3.js +0 -4367
  316. package/dist/chunk-q9n5swx7.js +0 -3
  317. package/dist/chunk-qr346wnp.js +0 -2
  318. package/dist/chunk-r02hke04.js +0 -2
  319. package/dist/chunk-ranshpyc.js +0 -3
  320. package/dist/chunk-rn194bhp.js +0 -20
  321. package/dist/chunk-rn1hgyc8.js +0 -930
  322. package/dist/chunk-s7z5dp70.js +0 -43
  323. package/dist/chunk-s8jd13nb.js +0 -3
  324. package/dist/chunk-sn7exv0n.js +0 -2
  325. package/dist/chunk-t1tdjjht.js +0 -216
  326. package/dist/chunk-t6qx04s8.js +0 -499
  327. package/dist/chunk-t6y6gyps.js +0 -2
  328. package/dist/chunk-tjfs7cc3.js +0 -2
  329. package/dist/chunk-tkyrk66a.js +0 -3
  330. package/dist/chunk-tntv9hvq.js +0 -2
  331. package/dist/chunk-v3nwkveg.js +0 -12
  332. package/dist/chunk-vd4cb5xr.js +0 -2
  333. package/dist/chunk-vkhdce50.js +0 -2
  334. package/dist/chunk-w183av08.js +0 -2
  335. package/dist/chunk-w2m02njv.js +0 -2
  336. package/dist/chunk-wpjrcrs5.js +0 -2
  337. package/dist/chunk-wqmppf6b.js +0 -3
  338. package/dist/chunk-wtb9fxdy.js +0 -2
  339. package/dist/chunk-xmzygmcz.js +0 -3
  340. package/dist/chunk-xsng1mtq.js +0 -3
  341. package/dist/chunk-xxzefj4j.js +0 -2
  342. package/dist/chunk-yq8x8bxq.js +0 -47
  343. package/dist/chunk-ytma76qe.js +0 -3
  344. package/dist/chunk-yw1m115e.js +0 -2
  345. package/dist/chunk-z64a924m.js +0 -2
  346. package/dist/chunk-zcz9rs6p.js +0 -3
@@ -0,0 +1,2785 @@
1
+ // @bun
2
+ import{hn,m,ko,It,Ds,Co,$o,Eo,To}from"./chunk-ce1sejr3.js";import{R}from"./chunk-8nhshfz6.js";import{t,J,ir,a,re,Rs,_,At,gn,As,c,p,I,ke,Ze,l,or}from"./chunk-z0g9jvv0.js";import{z,Xe,H,P,D,yo,kt,G,Ct,xe,$t,bo,Yn,ne,V,Et,cn,Zn,f}from"./chunk-b98be3yp.js";import{bn,vn,ur,$e}from"./chunk-czxt605c.js";import{w,Ts,Je,_s,fe,sr}from"./chunk-m4sk62wb.js";import{ks,Cs,$s,Es,er,tr}from"./chunk-xfp7k0v8.js";import{go,ws,Gn,Jn}from"./chunk-ak1cgcah.js";import{de,Rt,Qn,Ss,S,Ke}from"./chunk-ngc2wke4.js";import{an}from"./chunk-9amp82bx.js";import{Is}from"./chunk-7gkv67ky.js";import{oo,ao,lo,uo}from"./chunk-752hw7cd.js";import{qe}from"./chunk-tfexmdkt.js";import{s,we}from"./chunk-169n1vpx.js";import{u}from"./chunk-cg8hg6cs.js";import{_t,xo,un,dn}from"./chunk-fzapbw9p.js";import{ge,O,mn}from"./chunk-px7fvbj6.js";import{dr}from"./chunk-ft4p6d28.js";import mr from"path";import Fs from"fs";var qf=new Set(["touchstart","touchmove","wheel","mousewheel"]);function Po(e,o){if(o.passive)return!0;if(o.prevent||o.nonpassive)return!1;return qf.has(e.toLowerCase())}var Hc=new Set(["click","dblclick","mousedown","mouseup","mousemove","mouseenter","mouseleave","mouseover","mouseout","contextmenu","wheel","keydown","keyup","keypress","submit","reset","change","input","focus","blur","focusin","focusout","select","invalid","touchstart","touchend","touchmove","touchcancel","drag","dragstart","dragend","dragenter","dragleave","dragover","drop","scroll","resize","load","error","abort","animationstart","animationend","animationiteration","transitionstart","transitionend","transitionrun","transitioncancel","mounted","unmounted"]),qc={enter:"Enter",tab:"Tab",delete:"Delete",backspace:"Backspace",esc:"Escape",escape:"Escape",space:" ",up:"ArrowUp",down:"ArrowDown",left:"ArrowLeft",right:"ArrowRight",home:"Home",end:"End",pageup:"PageUp",pagedown:"PageDown"},Xf=new Set(["ctrl","alt","shift","meta"]),Zc={left:0,middle:1,right:2};function Xc(e){let o={prevent:!1,stop:!1,once:!1,capture:!1,self:!1,passive:!1,nonpassive:!1,keys:[],systemKeys:[],mouse:null,debounce:null,throttle:null};for(let x of e){let v=x.toLowerCase();if(v==="prevent")o.prevent=!0;else if(v==="stop")o.stop=!0;else if(v==="once")o.once=!0;else if(v==="capture")o.capture=!0;else if(v==="self")o.self=!0;else if(v==="passive")o.passive=!0;else if(v==="nonpassive")o.nonpassive=!0;else if(Xf.has(v))o.systemKeys.push(v);else if(v in Zc)o.mouse=v;else if(v in qc||/^[a-z]$/.test(v))o.keys.push(qc[v]||v.toUpperCase());else if(v.startsWith("debounce")){let k=v.match(/debounce(?:\.(\d+))?/);o.debounce=k?.[1]?Number.parseInt(k[1],10):300}else if(v.startsWith("throttle")){let k=v.match(/throttle(?:\.(\d+))?/);o.throttle=k?.[1]?Number.parseInt(k[1],10):300}}return o}function Jc(e,o=""){let x=[],v=0,k=/<([a-z][a-z0-9-]*)\s+([^>]*@[a-z][^>]*)>/gi,E;while((E=k.exec(e))!==null){let[C,j,L]=E,B=E.index,F=B+C.length,U=`__stx_evt_${o}${v++}`,Z=[],Y=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,Q;while((Q=Y.exec(L))!==null){let[,oe,ie]=Q,ce=oe.split("."),ae=ce[0];if(!Hc.has(ae))continue;Z.push({attribute:`@${oe}`,event:ae,handler:ie,modifiers:Xc(ce.slice(1)),elementId:U})}let se=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((Q=se.exec(L))!==null){let[,oe,ie]=Q,ce=oe.split("."),ae=ce[0];if(!Hc.has(ae))continue;Z.push({attribute:`@${oe}`,event:ae,handler:ie,modifiers:Xc(ce.slice(1)),elementId:U})}if(Z.length>0)x.push({originalTag:C,elementId:U,events:Z,startIndex:B,endIndex:F})}return x}function Kf(e){let o=[],{modifiers:x}=e;if(x.self)o.push("if ($event.target !== $el) return");for(let v of x.systemKeys)o.push(`if (!$event.${v}Key) return`);if(x.keys.length>0){let v=x.keys.map((k)=>`$event.key === '${k}'`).join(" || ");o.push(`if (!(${v})) return`)}if(x.mouse!==null){let v=Zc[x.mouse];o.push(`if ($event.button !== ${v}) return`)}if(x.prevent)o.push("$event.preventDefault()");if(x.stop)o.push("$event.stopPropagation()");return o.join("; ")}function Zf(e,o){let x=e;if(o.debounce!==null)x=`__stx_debounce(() => { ${x} }, ${o.debounce})`;else if(o.throttle!==null)x=`__stx_throttle(() => { ${x} }, ${o.throttle})`;return x}function Mo(e){let o=e.trim();if(!/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(o))return e;return`if (typeof ${o} === 'function' && !${o}._isSignal) ${o}($event);`}function Jf(e){let{modifiers:o}=e,x=e.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),v=Kf(e),k=Zf(Mo(e.handler),o),E=[];if(o.once)E.push("once: true");if(o.capture)E.push("capture: true");if(Po(e.event,o))E.push("passive: true");let C=E.length>0?`, { ${E.join(", ")} }`:"",j=k.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t");if(e.event==="mounted")return`
3
+ (function() {
4
+ var $el = document.getElementById('${x}');
5
+ if (!$el) return;
6
+ // Run mounted handler immediately (DOM is ready)
7
+ var scope = $el.closest('[data-stx-scope]');
8
+ if (scope && scope.__stx_execute) {
9
+ scope.__stx_execute('${j}', null, $el);
10
+ }
11
+ else {
12
+ __stx_runHandler('${j}', null, $el);
13
+ }
14
+ })();`;if(e.event==="unmounted")return`
15
+ (function() {
16
+ var $el = document.getElementById('${x}');
17
+ if (!$el) return;
18
+ // Set up MutationObserver to detect removal
19
+ var observer = new MutationObserver(function(mutations) {
20
+ for (var m of mutations) {
21
+ for (var node of m.removedNodes) {
22
+ if (node === $el || (node.contains && node.contains($el))) {
23
+ observer.disconnect();
24
+ var scope = $el.closest('[data-stx-scope]');
25
+ if (scope && scope.__stx_execute) {
26
+ scope.__stx_execute('${j}', null, $el);
27
+ }
28
+ else {
29
+ __stx_runHandler('${j}', null, $el);
30
+ }
31
+ return;
32
+ }
33
+ }
34
+ }
35
+ });
36
+ observer.observe(document.body, { childList: true, subtree: true });
37
+ // Store observer for cleanup
38
+ $el.__stx_unmount_observer = observer;
39
+ })();`;return`
40
+ (function() {
41
+ var $el = document.getElementById('${x}');
42
+ if (!$el) return;
43
+ // eslint-disable-next-line pickier/no-unused-vars
44
+ $el.addEventListener('${e.event}', function($event) {
45
+ ${v?v+";":""}
46
+ // Find the closest reactive scope and execute within its context
47
+ var scope = $el.closest('[data-stx-scope]');
48
+ if (scope && scope.__stx_execute) {
49
+ scope.__stx_execute('${j}', $event, $el);
50
+ }
51
+ else {
52
+ // Fallback for non-reactive context (entity-safe; decoded + run in memory)
53
+ __stx_runHandler('${j}', $event, $el);
54
+ }
55
+ }${C});
56
+ })();`}function Oo(e){if(e.length===0)return"";return`
57
+ <script data-stx-events>
58
+ (function() {
59
+ 'use strict';
60
+
61
+ // Utility functions
62
+ function __stx_debounce(fn, delay) {
63
+ var timeout;
64
+ return function() {
65
+ var args = arguments;
66
+ var ctx = this;
67
+ clearTimeout(timeout);
68
+ timeout = setTimeout(function() { fn.apply(ctx, args); }, delay);
69
+ };
70
+ }
71
+
72
+ function __stx_throttle(fn, delay) {
73
+ var last = 0;
74
+ return function() {
75
+ var now = Date.now();
76
+ if (now - last >= delay) {
77
+ last = now;
78
+ fn.apply(this, arguments);
79
+ }
80
+ };
81
+ }
82
+
83
+ // Non-reactive fallback runner. The handler is embedded HTML-entity-encoded
84
+ // so the surrounding script element can never contain raw markup, including
85
+ // its own closing tag; we decode it to JS only in memory here, then run it
86
+ // with $event/$el in scope.
87
+ //
88
+ // This comment must not spell that closing tag out. It used to, as an
89
+ // example, and a browser ends the script element at the FIRST one it sees \u2014
90
+ // so everything below this line, __stx_runHandler included, was emitted as
91
+ // page text and no listener was ever bound. The comment about escaping was
92
+ // the thing that needed escaping.
93
+ function __stx_runHandler(h, $event, $el) {
94
+ var code = h
95
+ .replace(/&lt;/g, '<')
96
+ .replace(/&gt;/g, '>')
97
+ .replace(/&quot;/g, '"')
98
+ .replace(/&#39;/g, "'")
99
+ .replace(/&#x27;/g, "'")
100
+ .replace(/&amp;/g, '&');
101
+ try {
102
+ // eslint-disable-next-line no-new-func
103
+ (new Function('$event', '$el', code)).call($el, $event, $el);
104
+ }
105
+ catch (e) {
106
+ if (typeof console !== 'undefined') console.error('[stx] event handler error:', e);
107
+ }
108
+ }
109
+
110
+ // Event listeners
111
+ ${e.map(Jf).join(`
112
+ `)}
113
+ })();
114
+ </script>`}function Gf(e,o=""){let x=Jc(e,o);if(x.length===0)return{template:e,bindings:[]};let v=e,k=[];for(let E=x.length-1;E>=0;E--){let C=x[E],j=C.originalTag;if(!j.includes(" id="))j=j.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${C.elementId}"`);else{let L=j.match(/id=["']([^"']+)["']/);if(L)for(let B of C.events)B.elementId=L[1]}for(let L of C.events){let B=L.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),F=new RegExp(`\\s*${B}\\s*=\\s*"[^"]*"`,"g"),U=new RegExp(`\\s*${B}\\s*=\\s*'[^']*'`,"g");j=j.replace(F,""),j=j.replace(U,"")}v=v.slice(0,C.startIndex)+j+v.slice(C.endIndex),k.push(...C.events)}return{template:v,bindings:k}}function Kc(e){let o=e.$uid;return typeof o==="string"&&o?`${o}_`:""}function Gc(e,o,x){if(Co(e))return e;if(o.__stx_sfc_mode){if(/x-data\s*=\s*["']/.test(e))return e;let{template:j,bindings:L}=Gf(e,Kc(o)),B=o.__stx_event_bindings||[];return o.__stx_event_bindings=[...B,...L],j}let v=Jc(e,Kc(o));if(v.length===0)return e;let k=e;for(let j=v.length-1;j>=0;j--){let L=v[j],B=L.originalTag;if(!B.includes(" id="))B=B.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${L.elementId}"`);else{let F=B.match(/id=["']([^"']+)["']/);if(F)for(let U of L.events)U.elementId=F[1]}for(let F of L.events){let U=F.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),Z=new RegExp(`\\s*${U}\\s*=\\s*"[^"]*"`,"g"),Y=new RegExp(`\\s*${U}\\s*=\\s*'[^']*'`,"g");B=B.replace(Z,""),B=B.replace(Y,"")}k=k.slice(0,L.startIndex)+B+k.slice(L.endIndex)}let E=Oo(v.flatMap((j)=>j.events)),C=k.lastIndexOf("</body>");if(C!==-1)k=k.slice(0,C)+E+`
115
+ `+k.slice(C);else k+=E;return k}function Yc(e,o){let x=new Set;for(let v of e.split(",")){let k=v.trim().replace(/^\.\.\./,"").trim();if(!k)continue;if(o){let E=k.lastIndexOf(":");if(E!==-1)k=k.slice(E+1).trim()}if(k=k.split("=")[0].trim(),/^[A-Za-z_$][\w$]*$/.test(k))x.add(k)}return x}function Ks(e,o){let x=s(e),{depths:v,balanced:k}=we(x),E=(j)=>!k||v[j]===0,C=new RegExp(`(?:^|[^\\w$.])((?:const|let|var|function|class)\\s+${o}\\b)`,"g");for(let j of x.matchAll(C)){let L=(j.index??0)+j[0].length-j[1].length;if(E(L))return!0}for(let j of x.matchAll(/(?:const|let|var)\s*\{([^}]*)\}/g))if(E(j.index??0)&&Yc(j[1],!0).has(o))return!0;for(let j of x.matchAll(/(?:const|let|var)\s*\[([^\]]*)\]/g))if(E(j.index??0)&&Yc(j[1],!1).has(o))return!0;return!1}import Bf from"fs";import Ye from"path";import{createHash as Yf}from"crypto";var Zs="__stx_component_client_factories";function Js(e){let o=e[Zs];return o instanceof Map?o:null}function el(e){e[Zs]=new Map}function No(e,o){let x=Js(e);if(!x)return null;let v=Yf("sha256").update(o).digest("hex").slice(0,16),k=x.get(v);if(k)k.instances++;else x.set(v,{body:o,instances:1});return v}function tl(e,o){let x=Js(o);if(!x?.size)return e;let v=new Map;for(let[F,U]of x)if(U.instances===1)v.set(F,U.body);let k=[];if(v.size>0){let F=[...v.keys()].map((Y)=>JSON.stringify(Y).replace(/[$()*+.?[\\\]^{|}]/g,"\\$&")).join("|"),U=new RegExp(`window\\.__stxComponentFactories\\[(${F})\\]\\(("[^"]+")\\);`,"g"),Z=U.exec(e);while(Z!==null){let Y=v.get(JSON.parse(Z[1]));if(Y!==void 0)k.push({start:Z.index,end:Z.index+Z[0].length,replacement:`(${Y})(${Z[2]});`});Z=U.exec(e)}}let E=[...x].filter(([,F])=>F.instances>1);if(E.length===0)return Qc(e,k);let j=`<script data-stx-scoped data-stx-run="always" data-stx-component-factories>
116
+ (function() {
117
+ const factories = window.__stxComponentFactories = window.__stxComponentFactories || {};
118
+ ${E.map(([F,U])=>` try { factories[${JSON.stringify(F)}] = factories[${JSON.stringify(F)}] || ${U.body}; }
119
+ catch (e) { console.error('[stx] component factory ' + ${JSON.stringify(F)} + ' failed to register; instances of it will not hydrate.', e); }`).join(`
120
+ `)}
121
+ })();
122
+ </script>`,L=e.search(/<script\b(?=[^>]*\bdata-stx-scoped\b)/i),B=L<0?0:L;return k.push({start:B,end:B,replacement:`${j}
123
+ `}),Qc(e,k)}function Qc(e,o){if(o.length===0)return e;o.sort((E,C)=>E.start-C.start||E.end-C.end);let x=Array(o.length*2+1),v=0,k=0;for(let E of o)x[k++]=e.slice(v,E.start),x[k++]=E.replacement,v=E.end;return x[k]=e.slice(v),x.join("")}function nl(e){let o=Js(e),x=new Map;if(o)for(let[v,k]of o)x.set(v,k.instances);return x}function rl(e,o){let x=Js(e);if(!x)return[];let v=[];for(let[k,E]of x){let C=E.instances-(o.get(k)??0);if(C>0)v.push({body:E.body,count:C})}return v}function sl(e,o){for(let{body:x,count:v}of o)for(let k=0;k<v;k++)No(e,x)}import cl from"fs";var il=0,jo=new Map;function ji(){il=0,jo.clear()}function Gs(e,o){let x=il++,v=`<!--__STX_${e.toUpperCase()}_${x}__-->`;return jo.set(v,{type:e,expression:o}),v}function Bi(){let e={};for(let[o,x]of jo)e[o]={type:x.type,expression:x.expression};return e}function Fi(e,o){let x=e;for(let[v,k]of o)x=x.split(v).join(k);return x}function Jr(e){return e.includes("<!--__STX_")}var Qf=/@(?=[a-zA-Z_]\w*\s*\(|end[a-zA-Z]*\b|else(?:if)?\b|empty\b|case\b|default\b|break\b|continue\b|fallback\b)/g;function eg(e){return Array.from({length:e},()=>"&#123;").join("&#8288;")}function ol(e){return e.replace(/\{{2,}/g,(o)=>eg(o.length)).replace(/\{(?=!)/g,"&#123;&#8288;").replace(Qf,"&#64;")}var tg=/^(?:javascript|vbscript|livescript|mocha|view-source):/,ng=/^data:(?:text\/html|text\/xml|application\/xhtml\+xml|application\/xml|image\/svg\+xml)/,rg=/^data:(?:text\/html|application\/xhtml\+xml)/,sg=new RegExp("[\\u0000-\\u0020\\u00A0\\u1680\\u2000-\\u200F\\u2028\\u2029\\u202F\\u205F\\u3000\\uFEFF]+","g");function ig(e){return e.replace(sg,"").toLowerCase()}function og(e){let o=e.toLowerCase();if(new RegExp("^(?:href|xlink:href|action|formaction|ping|cite|manifest|data|to)$").test(o))return"navigable";if(new RegExp("^(?:src|srcset|poster|background)$").test(o))return"fetched";return null}function al(e,o="navigable"){let x=ig(e);if(tg.test(x))return!0;return o==="navigable"?ng.test(x):rg.test(x)}function Mr(e,o="navigable"){return al(e,o)?"unsafe:"+e:e}function ag(e){let o=e.match(/(?:^|[\s"'`/])([A-Za-z][\w:-]*)\s*=\s*(["'])([^"']*)$/);if(!o)return null;if(o[3].trim()!=="")return null;return og(o[1])}function Lo(e,o,x=256){if(o<=x)return e.slice(0,o);let v=e.slice(o-x,o),k=v.search(/[\s"'`/]/);return k===-1?"":v.slice(k)}function Bo(e,o,x=o){let v=ag(e);return v&&al(o,v)?"unsafe:"+x:x}var Nr={},ll=new Map;function cg(e){let o=ll.get(e);if(!o){let x=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");o=new RegExp(`:${x}(?!\\w)`,"g"),ll.set(e,o)}return o.lastIndex=0,o}var Ln={uppercase:(e,o)=>e!==void 0&&e!==null?String(e).toUpperCase():"",lowercase:(e,o)=>e!==void 0&&e!==null?String(e).toLowerCase():"",capitalize:(e,o)=>{if(e===void 0||e===null)return"";let x=String(e);return x.charAt(0).toUpperCase()+x.slice(1)},number:(e,o,x=0)=>{if(e===void 0||e===null)return"";try{let v=Number(e);return Number.isNaN(v)?"":v.toFixed(Number.parseInt(String(x),10))}catch{return""}},fmt:(e,o,x="en-US")=>{if(e===void 0||e===null)return"";try{let v=Number(e);if(Number.isNaN(v))return String(e);return v.toLocaleString(x)}catch{return String(e)}},join:(e,o,x=",")=>{if(!Array.isArray(e))return"";return e.join(String(x))},escape:(e,o)=>{if(e===void 0||e===null)return"";return vt(String(e))},translate:(e,o,x={})=>{if(!o||!o.__translations)return e;let v=o.__translations,k=o.__i18nConfig?.fallbackToKey??!0,E=String(e).split("."),C=v;for(let L of E){if(C===void 0||C===null)break;C=C[L]}if(C===void 0||C===null)return k?e:"";let j=String(C);return Object.entries(x).forEach(([L,B])=>{j=j.replace(cg(L),String(B))}),j},t:(e,o,x={})=>Ln.translate(e,o,x),truncate:(e,o,x=50,v="...")=>{if(e===void 0||e===null)return"";let k=String(e);if(k.length<=x)return k;if(x<=v.length)return v.substring(0,x);return k.substring(0,x-v.length)+v},date:(e,o,x="short",v="en-US")=>{if(e===void 0||e===null)return"";try{let k=e instanceof Date?e:new Date(e);if(Number.isNaN(k.getTime()))return String(e);let E={short:{dateStyle:"short"},medium:{dateStyle:"medium"},long:{dateStyle:"long"},full:{dateStyle:"full"},time:{timeStyle:"short"},datetime:{dateStyle:"short",timeStyle:"short"},iso:{}};if(x==="iso")return k.toISOString();return new Intl.DateTimeFormat(v,E[x]||E.short).format(k)}catch{return String(e)}},currency:(e,o,x="USD",v="en-US")=>{if(e===void 0||e===null)return"";try{let k=Number(e);if(Number.isNaN(k))return String(e);return new Intl.NumberFormat(v,{style:"currency",currency:x}).format(k)}catch{return String(e)}},pluralize:(e,o,x,v)=>{let k=Number(e);if(Number.isNaN(k))return x;let E=v||`${x}s`;return k===1?x:E},first:(e,o)=>{if(e===void 0||e===null)return"";if(Array.isArray(e))return e.length===0?"":e[0];return String(e).charAt(0)},last:(e,o)=>{if(e===void 0||e===null)return"";if(Array.isArray(e))return e.length===0?"":e[e.length-1];let x=String(e);return x.charAt(x.length-1)},length:(e,o)=>{if(e===void 0||e===null)return 0;if(Array.isArray(e)||typeof e==="string")return e.length;if(e instanceof Map||e instanceof Set)return e.size;if(typeof e==="object")return Object.keys(e).length;return 0},json:(e,o,x=!1)=>{if(e===void 0)return"undefined";if(e===null)return"null";try{return x?JSON.stringify(e,null,2):JSON.stringify(e)}catch{return String(e)}},default:(e,o,x="")=>e===void 0||e===null||e===""?x:e,reverse:(e,o)=>{if(e===void 0||e===null)return"";if(Array.isArray(e))return[...e].reverse();return String(e).split("").reverse().join("")},slice:(e,o,x=0,v)=>{if(e===void 0||e===null)return"";if(Array.isArray(e)||typeof e==="string")return e.slice(x,v);return e},replace:(e,o,x,v="")=>{if(e===void 0||e===null)return"";let k=x.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return String(e).replace(new RegExp(k,"g"),()=>v)},stripTags:(e,o)=>{if(e===void 0||e===null)return"";return String(e).replace(/<[^>]*>/g,"")},urlencode:(e,o)=>{if(e===void 0||e===null)return"";return encodeURIComponent(String(e))},abs:(e,o)=>{let x=Number(e);return Number.isNaN(x)?0:Math.abs(x)},round:(e,o,x=0)=>{let v=Number(e);if(Number.isNaN(v))return 0;let k=10**x;return Math.round(v*k)/k}};function Xa(e,o){if(e in Ln)console.warn(`Filter "${e}" already exists as a built-in filter. Custom filter will take precedence.`);Nr[e]=o}function _u(e){for(let[o,x]of Object.entries(e))Xa(o,x)}function Ka(){return{...Ln,...Nr}}function Ru(){for(let e of Object.keys(Nr))delete Nr[e]}function Ga(e,o,x=2){let v=0,k=null;for(let E=o+x;E<e.length;E++){let C=e[E];if(k){if(C==="\\"){E++;continue}if(C===k)k=null;continue}if(C==='"'||C==="'"||C==="`"){k=C;continue}if(C==="{"){v++;continue}if(C==="}"){if(v>0){v--;continue}let j=0;while(e[E+j]==="}")j++;if(j>=x)return E}}return-1}function jn(e,o,x=2){let v="{".repeat(x);if(!e.includes(v))return e;let k="",E=0;for(;;){let C=e.indexOf(v,E);if(C===-1)break;let j=Ga(e,C,x);if(j===-1)break;k+=e.slice(E,C)+o(e.slice(C,j+x),e.slice(C+x,j),C),E=j+x}return E===0?e:k+e.slice(E)}function h(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function vt(e){return ol(h(e))}function be(e,o){let{scripts:x}=V(e);for(let v of x){let k=v.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i);if(!k||/\bserver\b|\bsrc\s*=/.test(k[1]))continue;let E=k[2];if(/\b(state|derived|effect|ref|reactive|computed|watch|watchEffect|useModel)\s*(?:<[^>]*>)?\s*\(/.test(E))return!0;if(hn(E,o))return!0}if(/@(if|for|show)\s*=\s*["'][^"']*\(\s*\)/.test(e))return!0;if(/@for\s*=\s*["'][^"']*\s+(?:in|of)\s+[^"']*\(\s*\)/.test(e))return!0;if(/(?:^|[\s"'])(?::|x-)(?:for|if|else-if|else|show|text|html|model|bind)\b/.test(e))return!0;return!1}function Ja(e){let o=[],x=/<([a-zA-Z][\w-]*)\b[^>]*?\s(?::for|x-for|@for)\s*=\s*(["'])([\s\S]*?)\2[^>]*>/g;for(let v=x.exec(e);v;v=x.exec(e)){let k=v[1].toLowerCase(),E=/^\s*\(?\s*([A-Za-z_$][\w$]*)\s*(?:,\s*([A-Za-z_$][\w$]*)\s*)?\)?\s+(?:in|of)\s/.exec(v[3]);if(!E)continue;let C=new Set([E[1],...E[2]?[E[2]]:[]]),j=v.index+v[0].length;if(v[0].endsWith("/>")){o.push({start:v.index,end:j,names:C});continue}let L=new RegExp(`<(/?)${k}\\b[^>]*?(/?)>`,"gi");L.lastIndex=j;let B=1,F=e.length;for(let U=L.exec(e);U;U=L.exec(e)){if(U[2]==="/")continue;if(B+=U[1]==="/"?-1:1,B===0){F=U.index+U[0].length;break}}o.push({start:v.index,end:F,names:C})}return o}function lg(e,o,x){let v=s(x);for(let k of e){if(o<k.start||o>=k.end)continue;for(let E of k.names)if(new RegExp(`(?<![.#\\w$])${E.replace(/\$/g,"\\$")}(?![\\w$])`).test(v))return!0}return!1}function ul(e,o){let x=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","URL","URLSearchParams","Intl","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined","NaN","Infinity","isNaN","isFinite","window","document","console","new","typeof","instanceof","in","void"],v=e.replace(/'[^']*'/g,"").replace(/"[^"]*"/g,""),k="",E=!1,C=0;for(let B=0;B<v.length;B++){let F=v[B];if(!E&&F==="`"){E=!0,C=0;continue}if(E){if(F==="`"&&C===0){E=!1;continue}if(F==="$"&&v[B+1]==="{"){C++,B++,k+=" ";continue}if(F==="}"&&C>0){C--;continue}if(C>0){k+=F;continue}continue}k+=F}v=k;let j=/(?<![a-zA-Z0-9_$])([a-zA-Z_$][a-zA-Z0-9_$]*)/g,L;while((L=j.exec(v))!==null){let B=L[1];if(!v.substring(0,L.index).trimEnd().endsWith(".")){if(!x.includes(B)&&!(B in o))return!1}}return!0}function ug(e,o){let x=o.__stx_serverDeclared;if(!x||x.size===0)return!1;let v=s(e);for(let k of x)if(new RegExp(`(?<![.#\\w$])${k}(?![\\w$])`).test(v))return!0;return!1}var dl=new Set;function pl(e){return/^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*)*$/.test(e.trim())}function fl(e,o){let x=`${o??"<unknown>"}\x00${e}`;if(process.env.STX_DEBUG||!dl.has(x))dl.add(x),console.warn(`[stx] {{ ${e} }} in a <script> in ${o??"<unknown>"} has no server value, so it was emitted as undefined. A mustache left in JavaScript is a SyntaxError that takes the whole script down, so give the value a default in <script server>.`);return"undefined"}function Yr(e,o,x){let v=e;return v=v.replace(/\{!!([\s\S]*?)!!\}/g,(k,E)=>{try{let C=b(E,o);if(C===void 0)return pl(E)?fl(E.trim(),x):k;return C===null?"":String(C)}catch{return k}}),v=jn(v,(k,E,C)=>{let j=E.trim();if(/^__[A-Z_]+__$/.test(j))return k;try{let L=b(E,o);if(L===void 0)return pl(j)?fl(j,x):k;return JSON.stringify(L).replace(/</g,"\\u003c")}catch{return k}}),v}function Ya(e,o){if(!e.includes("{"))return e;let x=e;return x=x.replace(/\{!!([\s\S]*?)!!\}/g,(v,k)=>{try{let E=b(k,o);if(E===void 0)return v;return E===null?"":String(E)}catch{return v}}),x=jn(x,(v,k,E)=>{let C=k.trim();if(/^__[A-Z_]+__$/.test(C))return v;try{let j=b(k,o);if(j===void 0)return v;if(j===null)return"";let L=String(j);return Bo(Lo(x,E),L,vt(L))}catch{return v}}),x}function Au(e,o,x={}){let{output:v,scripts:k}=V(e),E=k.map((C)=>{let j=C.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i),L=C.match(/^<script\b[^>]*>/i),B=C.search(/<\/script\s*>$/i);if(!j||!L||B===-1)return C;let F=j[1],U=j[2];if(/\bdata-raw\b/.test(F))return C;if(x.skipServer&&/\bserver\b/.test(F))return C;let Y=`<script${Ya(F,o)}>`;if(/\bsrc\s*=/.test(F)||/\btype\s*=\s*["']application\/json["']/.test(F))return Y+U+C.slice(B);return Y+Yr(U,o)+C.slice(B)});return Et(v,E)}function q(e,o,x){let v=e,k=(Z,Y)=>{let Q=Ct(Z,Y);if(Q===-1)return-1;return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(Z.slice(Y,Q))?-1:Q},E=(Z,Y,Q,se)=>{let oe=Q.length,{output:ie,tokens:ce}=ne(Z,Y,(ae,pe)=>se(oe+pe));return Q.push(...ce),ie},C=[];v=E(v,k,C,(Z)=>`<!--__STX_STYLE_${Z}__-->`);let j=[];v=E(v,G,j,(Z)=>`<!--__STX_SCRIPT_EXPR_${Z}__-->`);let L=o?.__stx_signals_gate===!0||be(e),B=new Set(Array.isArray(o?.__stx_client_signal_names)?o.__stx_client_signal_names:[]),F=new Set(Array.isArray(o?.__stx_preserved_client_expressions)?o.__stx_preserved_client_expressions:[]);v=jn(v,(Z,Y,Q)=>{try{let se=b(Y,o,!1,(oe)=>zo(oe,Z,x,e));return se!==void 0&&se!==null?String(se):""}catch(se){let oe=se instanceof Error?se.message:String(se);return g("Expression",`Error evaluating: {{{ ${Y.trim()}}}}: ${oe}`,x,e,Q,Z)}},3),v=v.replace(/\{!!([\s\S]*?)!!\}/g,(Z,Y,Q)=>{try{let se=b(Y,o,!1,(oe)=>zo(oe,Z,x,e));if(se===void 0&&o.__stx_buildMode==="compile")return Gs("raw",Y.trim());return se!==void 0&&se!==null?String(se):""}catch(se){if(o.__stx_buildMode==="compile")return Gs("raw",Y.trim());let oe=se instanceof Error?se.message:String(se);return g("Expression",`Error evaluating: {!! ${Y.trim()} !!}: ${oe}`,x,e,Q,Z)}}),v=E(v,G,j,(Z)=>`<!--__STX_SCRIPT_EXPR_${Z}__-->`),v=E(v,k,C,(Z)=>`<!--__STX_STYLE_${Z}__-->`);let U=L?Ja(v):[];if(v=jn(v,(Z,Y,Q)=>{let se=Y.trim();if(U.length>0&&lg(U,Q,se))return Z;if(F.has(se))return Z;let oe=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined"],ie=/^([a-zA-Z_$][a-zA-Z0-9_$]*)/,ae=se.match(ie)?.[1],pe=ae&&((ae in o)||oe.includes(ae)),me=Boolean(ae&&B.has(ae)),he=/^([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/,Se=se.match(he),Ee=Se&&!oe.includes(Se[1])&&!(Se[1]in o);if(/^__[A-Z_]+__$/.test(se))return"";let Ce;try{let Re=b(Y,o,!1,(_e)=>{Ce=_e});if(me)return Z;if(L&&!ul(se,o))return Z;if(Ce)zo(Ce,Z,x,e);if(o.__stx_buildMode==="compile"&&!L&&(Re===void 0||ug(se,o)))return Gs("expr",se);if(Re===void 0||Re===null)return"";let Ae=String(Re);return Bo(Lo(v,Q),Ae,vt(Ae))}catch(Re){if(me)return Z;if(L&&!ul(se,o))return Z;if(Ee)return Z;let Ae=Re instanceof Error?Re.message:String(Re);return g("Expression",`Error evaluating: {{ ${se} }}: ${Ae}`,x,e,Q,Z)}}),j.length>0)v=v.replace(/<!--__STX_SCRIPT_EXPR_(\d+)__-->/g,(Z,Y)=>j[Number(Y)]??Z);if(C.length>0)v=v.replace(/<!--__STX_STYLE_(\d+)__-->/g,(Z,Y)=>C[Number(Y)]??Z);return v}function Za(e,o,x){if(!o.trim())return e;let v=e,k=o.trim();while(k.length>0){let E=k.match(/^(\w+)/);if(!E)break;let C=E[1];k=k.substring(C.length).trim();let j=Nr[C]||Ln[C];if(!j)throw Error(`Filter not found: ${C}. Available filters: ${Object.keys(Ka()).join(", ")}`);let L=[];if(k.startsWith(":")){let B=k.match(/^:([^|\s]+)/);if(B){let F=B[1].trim();try{let U=Number(F);L=[Number.isNaN(U)?F:U]}catch{L=[F]}k=k.substring(B[0].length).trim()}}else if(k.startsWith("(")){let B=1,F=1;while(B>0&&F<k.length){if(k[F]==="(")B++;if(k[F]===")")B--;F++}if(B===0){let U=k.substring(1,F-1).trim();if(U)try{if(U.startsWith("{")&&U.endsWith("}"))L=[b(`(${U})`,x,!0)];else{let Z=[],Y="",Q=null,se=0,oe=0,ie=0,ce=!1;for(let ae=0;ae<U.length;ae++){let pe=U[ae];if(ce){Y+=pe,ce=!1;continue}if(pe==="\\"){Y+=pe,ce=!0;continue}if(Q){if(Y+=pe,pe===Q)Q=null;continue}if(pe==='"'||pe==="'"||pe==="`"){Q=pe,Y+=pe;continue}if(pe==="(")se++;else if(pe===")")se--;else if(pe==="[")oe++;else if(pe==="]")oe--;else if(pe==="{")ie++;else if(pe==="}")ie--;if(pe===","&&se===0&&oe===0&&ie===0){Z.push(Y),Y="";continue}Y+=pe}if(Y)Z.push(Y);L=Z.map((ae)=>{let pe=ae.trim();return b(pe,x,!0)})}}catch{L=[U]}k=k.substring(F).trim()}}try{v=j(v,x,...L)}catch(B){let F=B instanceof Error?B.message:String(B);throw Error(`Error applying filter '${C}': ${F}`)}if(k.startsWith("|"))k=k.substring(1).trim();else break}return v}function dg(e){let o=!1,x="",v=0,k=0,E=0,C=!1;for(let j=0;j<e.length;j++){let L=e[j],B=e[j+1];if(o&&C){C=!1;continue}if(o&&L==="\\"){C=!0;continue}if(C=!1,(L==='"'||L==="'"||L==="`")&&!C){if(!o)o=!0,x=L;else if(L===x)o=!1,x="";continue}if(o&&x==="`"&&L==="$"&&B==="{"){let F=1;j+=2;while(j<e.length&&F>0){if(e[j]==="{")F++;else if(e[j]==="}")F--;if(F>0)j++}continue}if(o)continue;if(L==="(")v++;else if(L===")")v--;else if(L==="[")k++;else if(L==="]")k--;else if(L==="{")E++;else if(L==="}")E--;if(L==="|"&&v===0&&k===0&&E===0){if(B==="|"){j++;continue}if(B==="="){j++;continue}return j}}return-1}var Or=new Set,pg=1000;function Pu(){Or.clear()}function zo(e,o,x,v){if(!O())return;let k=`${x}\x00${e.expression}`;if(Or.has(k))return;if(Or.size>=pg)Or.clear();Or.add(k);let E=x,C=v;try{if(x&&cl.existsSync(x))C=cl.readFileSync(x,"utf8")}catch{}let j=C.indexOf(o);if(j>=0)E=`${x}:${C.slice(0,j).split(`
124
+ `).length}`;console.warn(`${E}: stx warning: ${o} rendered as an empty string. The safe evaluator rejected \`${e.expression}\` (${e.rule}). Compute the value in <script server> and interpolate the variable instead.`)}function b(e,o,x=!1,v){try{let k=e.trim(),E=dg(k);if(E>0){let j=k.substring(0,E).trim(),L=k.substring(E+1).trim(),B=b(j,o,!0,v);return Za(B,L,o)}let C=gn(k);if(C!==null){v?.({expression:k,rule:C});return}try{let j=Object.keys(o),L=Object.values(o);return l(k,j)(...L)}catch{return c(k,o)}}catch(k){if(k instanceof ReferenceError){let E=/(\b\w+)\s+is not defined/.exec(k.message);if(E){let C=E[1],j=fg(C,Object.keys(o));if(j&&j!==C)k.message=`${k.message} \u2014 did you mean '${j}'?`}}if(!x)console.error(`Error evaluating expression: ${e}`,k);throw k}}function fg(e,o){let x=null;for(let k of o){if(k===e)continue;let E=gg(e,k);if(x===null||E<x.dist)x={key:k,dist:E}}if(!x)return null;let v=Math.max(e.length,x.key.length);if(x.dist<=2||x.dist/v<=0.35)return x.key;return null}function gg(e,o){if(e===o)return 0;if(e.length===0)return o.length;if(o.length===0)return e.length;let[x,v]=e.length<o.length?[e,o]:[o,e],k=Array(x.length+1),E=Array(x.length+1);for(let C=0;C<=x.length;C++)k[C]=C;for(let C=1;C<=v.length;C++){E[0]=C;for(let j=1;j<=x.length;j++){let L=x[j-1]===v[C-1]?0:1;E[j]=Math.min(E[j-1]+1,k[j]+1,k[j-1]+L)}for(let j=0;j<=x.length;j++)k[j]=E[j]}return k[x.length]}function Iu(e){if(!e)return"";return e.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#039;/g,"'").replace(/&#39;/g,"'").replace(/&amp;/g,"&")}import Yx from"fs";import Gt from"path";var Wo=[{open:/<!--/g,close:/-->/g},{open:/<script\b/gi,close:/<\/script\s*>/gi},{open:/<style\b/gi,close:/<\/style\s*>/gi}],gl=/<body\b([^>]*)>/gi;function wn(e){let o=0,x,v=Wo.map(()=>{return});while(o<e.length){if(x===void 0||x!==null&&x.index<o)gl.lastIndex=o,x=gl.exec(e);if(!x)return null;let k=x.index,E=-1,C=null;for(let L=0;L<Wo.length;L++){let B=Wo[L],F=v[L];if(F===void 0||F!==null&&F.index<o)B.open.lastIndex=o,F=B.open.exec(e),v[L]=F;if(!F)continue;if(F.index<k&&(E===-1||F.index<E))E=F.index,C=B.close}if(E===-1||!C)return{index:k,tag:x[0],attrs:x[1]??""};C.lastIndex=E;let j=C.exec(e);if(!j)return null;o=j.index+j[0].length}return null}function xr(e,o){let x=wn(e);if(!x)return e;return e.slice(0,x.index)+o(x.tag,x.attrs)+e.slice(x.index+x.tag.length)}var ml=/<style\b[^>]*>/iy,hl=/<\/style>/gi,yl=/<script\b[^>]*>/iy,xl=/<template(?=[\s>/])[^>]*>/iy,bl=/<\/template\s*>/iy;function jr(e){let o=0,x=0,v=-1;while(o<e.length){let k=e.indexOf("<",o);if(k===-1)return-1;if(e.startsWith("<!--",k)){let L=e.indexOf("-->",k+4);o=L===-1?e.length:L+3;continue}ml.lastIndex=k;let E=ml.exec(e);if(E){hl.lastIndex=k+E[0].length;let L=hl.exec(e);o=L===null?e.length:L.index+8;continue}xl.lastIndex=k;let C=xl.exec(e);if(C){if(x===0)v=k;x++,o=k+C[0].length;continue}bl.lastIndex=k;let j=bl.exec(e);if(j){if(x>0)x--;o=k+j[0].length;continue}if(yl.lastIndex=k,yl.test(e))return x>0?v:k;o=k+1}return-1}function vl(){return`
125
+ // STX Lifecycle Runtime
126
+ (function() {
127
+ if (typeof window === 'undefined') return;
128
+
129
+ const instances = new Map();
130
+ let currentInstance = null;
131
+ let idCounter = 0;
132
+
133
+ function generateId() {
134
+ return 'stx-' + (++idCounter) + '-' + Date.now().toString(36);
135
+ }
136
+
137
+ function createInstance(element) {
138
+ const instance = {
139
+ id: generateId(),
140
+ element: element,
141
+ mountHooks: [],
142
+ destroyHooks: [],
143
+ updateHooks: [],
144
+ refs: new Map(),
145
+ watchers: [],
146
+ isMounted: false
147
+ };
148
+ instances.set(instance.id, instance);
149
+ return instance;
150
+ }
151
+
152
+ window.STX = window.STX || {};
153
+
154
+ // Lifecycle hooks
155
+ window.STX.onMount = function(hook) {
156
+ if (currentInstance) currentInstance.mountHooks.push(hook);
157
+ };
158
+
159
+ window.STX.onDestroy = function(hook) {
160
+ if (currentInstance) currentInstance.destroyHooks.push(hook);
161
+ };
162
+
163
+ window.STX.onUpdate = function(hook) {
164
+ if (currentInstance) currentInstance.updateHooks.push(hook);
165
+ };
166
+
167
+ // Aliases
168
+ window.STX.onMounted = window.STX.onMount;
169
+ window.STX.onUnmounted = window.STX.onDestroy;
170
+ window.STX.onUpdated = window.STX.onUpdate;
171
+
172
+ // Refs
173
+ window.STX.ref = function(initialValue) {
174
+ const r = { value: initialValue || null };
175
+ Object.defineProperty(r, 'current', {
176
+ get: function() { return this.value; }
177
+ });
178
+ if (currentInstance) {
179
+ currentInstance.refs.set('ref-' + currentInstance.refs.size, r);
180
+ }
181
+ return r;
182
+ };
183
+
184
+ // Watch
185
+ window.STX.watch = function(source, callback, options) {
186
+ options = options || {};
187
+ let oldValue;
188
+ let cleanup;
189
+ let isActive = true;
190
+
191
+ function run() {
192
+ if (!isActive) return;
193
+ const newValue = source();
194
+ if (oldValue !== newValue || options.immediate) {
195
+ if (cleanup) cleanup();
196
+ cleanup = callback(newValue, oldValue);
197
+ oldValue = newValue;
198
+ }
199
+ }
200
+
201
+ if (options.immediate) {
202
+ run();
203
+ }
204
+ else {
205
+ oldValue = source();
206
+ }
207
+
208
+ const intervalId = setInterval(run, 16);
209
+
210
+ function stop() {
211
+ isActive = false;
212
+ clearInterval(intervalId);
213
+ if (cleanup) cleanup();
214
+ }
215
+
216
+ if (currentInstance) {
217
+ currentInstance.watchers.push({ stop: stop });
218
+ currentInstance.destroyHooks.push(stop);
219
+ }
220
+
221
+ return stop;
222
+ };
223
+
224
+ // Computed
225
+ window.STX.computed = function(getter) {
226
+ let cached;
227
+ let dirty = true;
228
+ return {
229
+ get value() {
230
+ if (dirty) {
231
+ cached = getter();
232
+ dirty = false;
233
+ queueMicrotask(function() { dirty = true; });
234
+ }
235
+ return cached;
236
+ }
237
+ };
238
+ };
239
+
240
+ // Component management
241
+ window.STX.setupComponent = function(element, setup) {
242
+ const instance = createInstance(element);
243
+ currentInstance = instance;
244
+ try {
245
+ setup();
246
+ }
247
+ finally {
248
+ currentInstance = null;
249
+ }
250
+ return instance;
251
+ };
252
+
253
+ window.STX.mountComponent = function(instance) {
254
+ if (instance.isMounted) return;
255
+ instance.isMounted = true;
256
+ instance.mountHooks.forEach(function(hook) {
257
+ try {
258
+ const cleanup = hook();
259
+ if (typeof cleanup === 'function') {
260
+ instance.destroyHooks.push(cleanup);
261
+ }
262
+ else if (cleanup && typeof cleanup.then === 'function') {
263
+ cleanup.catch(function(e) { console.error('[stx] onMount error:', e); });
264
+ }
265
+ }
266
+ catch (e) {
267
+ console.error('[stx] onMount error:', e);
268
+ }
269
+ });
270
+ };
271
+
272
+ window.STX.destroyComponent = function(instance) {
273
+ if (!instance.isMounted) return;
274
+ instance.watchers.forEach(function(w) { w.stop(); });
275
+ instance.destroyHooks.forEach(function(hook) {
276
+ try { hook(); }
277
+ catch (e) { console.error('[stx] onDestroy error:', e); }
278
+ });
279
+ instance.refs.forEach(function(ref) { ref.value = null; });
280
+ instance.isMounted = false;
281
+ instances.delete(instance.id);
282
+ };
283
+
284
+ // ==========================================================================
285
+ // Vue-Style Refs System - No document.** required!
286
+ // ==========================================================================
287
+
288
+ // Internal: Query for ref elements without exposing document API
289
+ function queryRef(name, root) {
290
+ return (root || document).querySelector('[data-stx-ref="' + name + '"], [data-ref="' + name + '"]');
291
+ }
292
+
293
+ function queryAllRefs(root) {
294
+ return (root || document).querySelectorAll('[data-stx-ref], [data-ref]');
295
+ }
296
+
297
+ // Auto-bind refs from ref attributes (Vue-style)
298
+ window.STX.bindRefs = function(root, refs) {
299
+ if (!root) return;
300
+ queryAllRefs(root).forEach(function(el) {
301
+ var refName = el.getAttribute('data-stx-ref') || el.getAttribute('data-ref');
302
+ if (refs[refName]) {
303
+ refs[refName].value = el;
304
+ }
305
+ });
306
+ };
307
+
308
+ // Vue-style useRefs() - returns object with all refs as direct elements
309
+ // Usage: const { input, button, container } = STX.useRefs()
310
+ window.STX.useRefs = function(root) {
311
+ var refs = {};
312
+ queryAllRefs(root).forEach(function(el) {
313
+ var refName = el.getAttribute('data-stx-ref') || el.getAttribute('data-ref');
314
+ if (refName) {
315
+ refs[refName] = el;
316
+ }
317
+ });
318
+ return refs;
319
+ };
320
+
321
+ // Get a single ref by name - Vue's useTemplateRef equivalent
322
+ // Usage: const input = STX.useRef('input')
323
+ window.STX.useRef = function(name, root) {
324
+ return queryRef(name, root);
325
+ };
326
+
327
+ // Two-way binding helper for form elements
328
+ // Usage: STX.model(inputEl, state, 'username')
329
+ window.STX.model = function(el, state, key) {
330
+ if (!el || !state) return;
331
+
332
+ var isCheckbox = el.type === 'checkbox';
333
+ var isRadio = el.type === 'radio';
334
+ var isSelect = el.tagName === 'SELECT';
335
+
336
+ // Set initial value
337
+ if (isCheckbox) {
338
+ el.checked = !!state[key];
339
+ }
340
+ else if (isRadio) {
341
+ el.checked = el.value === state[key];
342
+ }
343
+ else {
344
+ el.value = state[key] || '';
345
+ }
346
+
347
+ // Listen for changes
348
+ var eventType = isCheckbox || isRadio ? 'change' : 'input';
349
+ el.addEventListener(eventType, function() {
350
+ if (isCheckbox) {
351
+ state[key] = el.checked;
352
+ }
353
+ else if (isRadio) {
354
+ if (el.checked) state[key] = el.value;
355
+ }
356
+ else {
357
+ state[key] = el.value;
358
+ }
359
+ });
360
+
361
+ // Return cleanup function
362
+ return function() {
363
+ el.removeEventListener(eventType, arguments.callee);
364
+ };
365
+ };
366
+
367
+ // Batch event binding helper - cleaner than manual addEventListener
368
+ // Usage: STX.on({ click: [btn1, btn2], input: [textField] }, handler)
369
+ window.STX.on = function(el, event, handler) {
370
+ if (!el) return function() {};
371
+ el.addEventListener(event, handler);
372
+ return function() { el.removeEventListener(event, handler); };
373
+ };
374
+
375
+ // Bind multiple events at once
376
+ // Usage: STX.events(refs.btn, { click: handleClick, mouseenter: handleHover })
377
+ window.STX.events = function(el, eventMap) {
378
+ if (!el) return function() {};
379
+ var cleanups = [];
380
+ Object.keys(eventMap).forEach(function(event) {
381
+ el.addEventListener(event, eventMap[event]);
382
+ cleanups.push(function() { el.removeEventListener(event, eventMap[event]); });
383
+ });
384
+ return function() { cleanups.forEach(function(c) { c(); }); };
385
+ };
386
+
387
+ // ==========================================================================
388
+ // DOM Helpers - Eliminate document.* usage
389
+ // ==========================================================================
390
+
391
+ // Global keyboard event listener
392
+ // Usage: STX.onKey('Escape', () => closeModal())
393
+ window.STX.onKey = function(key, handler, options) {
394
+ var listener = function(e) {
395
+ if (e.key === key) {
396
+ handler(e);
397
+ }
398
+ };
399
+ document.addEventListener('keydown', listener, options);
400
+ return function() { document.removeEventListener('keydown', listener, options); };
401
+ };
402
+
403
+ // Create element helper
404
+ // Usage: STX.el('div', { class: 'foo' }, 'text content')
405
+ window.STX.el = function(tag, attrs, content) {
406
+ var el = document.createElement(tag);
407
+ if (attrs) {
408
+ Object.keys(attrs).forEach(function(key) {
409
+ if (key === 'class') {
410
+ el.className = attrs[key];
411
+ }
412
+ else if (key.startsWith('on')) {
413
+ el.addEventListener(key.slice(2).toLowerCase(), attrs[key]);
414
+ }
415
+ else {
416
+ el.setAttribute(key, attrs[key]);
417
+ }
418
+ });
419
+ }
420
+ if (content) {
421
+ if (typeof content === 'string') {
422
+ el.textContent = content;
423
+ }
424
+ else if (Array.isArray(content)) {
425
+ content.forEach(function(child) { el.appendChild(child); });
426
+ }
427
+ else {
428
+ el.appendChild(content);
429
+ }
430
+ }
431
+ return el;
432
+ };
433
+
434
+ // Get currently focused element
435
+ // Usage: const focused = STX.activeElement()
436
+ window.STX.activeElement = function() {
437
+ return document.activeElement;
438
+ };
439
+
440
+ // Escape HTML helper
441
+ // Usage: const safe = STX.escapeHtml(userInput)
442
+ window.STX.escapeHtml = function(text) {
443
+ var div = document.createElement('div');
444
+ div.textContent = text;
445
+ return div.innerHTML;
446
+ };
447
+
448
+ // MutationObserver for automatic lifecycle management
449
+ const observer = new MutationObserver(function(mutations) {
450
+ mutations.forEach(function(mutation) {
451
+ // Handle removed nodes
452
+ mutation.removedNodes.forEach(function(node) {
453
+ if (node.nodeType === 1 && node.__stx_instance__) {
454
+ window.STX.destroyComponent(node.__stx_instance__);
455
+ }
456
+ });
457
+ });
458
+ });
459
+
460
+ // Start observing when DOM is ready
461
+ if (document.readyState === 'loading') {
462
+ document.addEventListener('DOMContentLoaded', function() {
463
+ observer.observe(document.body, { childList: true, subtree: true });
464
+ });
465
+ }
466
+ else {
467
+ observer.observe(document.body, { childList: true, subtree: true });
468
+ }
469
+
470
+ console.log('[stx] Lifecycle runtime initialized');
471
+ })();
472
+ `}function Fo(e){return Symbol(e)}var Hv=Fo("theme"),qv=Fo("router"),Xv=Fo("i18n");import*as $l from"crypto";function wl(e){let o=/\$(\w+)\./g,x=[],v;while((v=o.exec(e))!==null)if(!x.includes(v[1]))x.push(v[1]);return x}function mg(){return`stx-${$l.randomBytes(4).toString("hex")}`}function hg(e){return/\$\w+\./.test(e)}function yg(e){if(!e.includes("{{")||!/\$\w+\./.test(e))return{html:e,bindings:[],stores:new Set};let o=[],x=new Set,v=/<(\w+)([^>]*?)(\s*\/?>)/g,k=e;return k=k.replace(v,(E,C,j,L)=>{if(["script","style","template"].includes(C.toLowerCase()))return E;let B=[],F=!1,U=j,Z=/(\w+(?:-\w+)*)\s*=\s*"([^"]*\{\{[^}]*\$\w+[^}]*\}\}[^"]*)"/g,Y=[...j.matchAll(Z)];for(let oe of Y){let ie=oe[0],ce=oe[1],ae=oe[2];if(hg(ae)){F=!0;let pe=ae.match(/\{\{\s*([\s\S]+?)\s*\}\}/);if(pe){let me=pe[1];if(B.push({attr:ce,expr:me,fullMatch:ie,originalAttr:ce}),wl(me).forEach((Se)=>x.add(Se)),ce==="text")U=U.replace(ie,"");else if(ce==="class")U=U.replace(ie,'class=""');else if(ce==="disabled"||ce==="hidden")U=U.replace(ie,"");else U=U.replace(ie,`${ce}=""`)}}}if(!F)return E;let Q=U.match(/\bid\s*=\s*"([^"]+)"/),se;if(Q)se=Q[1];else se=mg(),U=` id="${se}"${U}`;for(let oe of B)o.push({elementId:se,attribute:oe.attr,expression:oe.expr,stores:wl(oe.expr)});return`<${C}${U}${L}`}),{html:k,bindings:o,stores:x}}function xg(e,o){if(e.length===0)return"";let x=Array.from(o),v=`
473
+ <script>
474
+ (function() {
475
+ 'use strict';
476
+
477
+ // Wait for stores to be available
478
+ function initBindings() {
479
+ var stores = window.VoideStores;
480
+ if (!stores) {
481
+ setTimeout(initBindings, 10);
482
+ return;
483
+ }
484
+
485
+ // Store references for expressions
486
+ // eslint-disable-next-line pickier/no-unused-vars
487
+ var $state = {};
488
+ `;for(let k of x)v+=` $state.${k} = stores.${k} ? stores.${k}.get() : {};
489
+ `;v+=`
490
+ // Binding update functions
491
+ function updateBindings() {
492
+ `;for(let k of e){let{elementId:E,attribute:C,expression:j}=k,L=j.replace(/\$(\w+)\./g,"$state.$1.");if(C==="text")v+=` (function() {
493
+ var el = document.getElementById('${E}');
494
+ if (el) {
495
+ try {
496
+ el.textContent = ${L};
497
+ }
498
+ catch (e) { console.error('Binding error:', e); }
499
+ }
500
+ })();
501
+ `;else if(C==="html")v+=` (function() {
502
+ var el = document.getElementById('${E}');
503
+ if (el) {
504
+ try {
505
+ el.innerHTML = ${L};
506
+ }
507
+ catch (e) { console.error('Binding error:', e); }
508
+ }
509
+ })();
510
+ `;else if(C==="class")v+=` (function() {
511
+ var el = document.getElementById('${E}');
512
+ if (el) {
513
+ try {
514
+ var value = ${L};
515
+ if (typeof value === 'string') {
516
+ // Dynamic class string - merge with existing static classes
517
+ // eslint-disable-next-line pickier/no-unused-vars
518
+ var staticClasses = el.getAttribute('data-static-class') || el.className;
519
+ if (!el.hasAttribute('data-static-class')) {
520
+ el.setAttribute('data-static-class', el.className);
521
+ }
522
+ el.className = (el.getAttribute('data-static-class') + ' ' + value).trim();
523
+ }
524
+ else if (typeof value === 'object') {
525
+ // Object syntax: { 'class-name': condition }
526
+ for (var cls in value) {
527
+ if (value[cls]) {
528
+ el.classList.add(cls);
529
+ }
530
+ else {
531
+ el.classList.remove(cls);
532
+ }
533
+ }
534
+ }
535
+ }
536
+ catch (e) { console.error('Binding error:', e); }
537
+ }
538
+ })();
539
+ `;else if(C==="show")v+=` (function() {
540
+ var el = document.getElementById('${E}');
541
+ if (el) {
542
+ try {
543
+ el.style.display = (${L}) ? '' : 'none';
544
+ }
545
+ catch (e) { console.error('Binding error:', e); }
546
+ }
547
+ })();
548
+ `;else if(C==="if")v+=` (function() {
549
+ var el = document.getElementById('${E}');
550
+ if (el) {
551
+ try {
552
+ el.style.visibility = (${L}) ? 'visible' : 'hidden';
553
+ }
554
+ catch (e) { console.error('Binding error:', e); }
555
+ }
556
+ })();
557
+ `;else v+=` (function() {
558
+ var el = document.getElementById('${E}');
559
+ if (el) {
560
+ try {
561
+ var value = ${L};
562
+ if (value === false || value === null || value === undefined) {
563
+ el.removeAttribute('${C}');
564
+ }
565
+ else if (value === true) {
566
+ el.setAttribute('${C}', '');
567
+ }
568
+ else {
569
+ el.setAttribute('${C}', value);
570
+ }
571
+ }
572
+ catch (e) { console.error('Binding error:', e); }
573
+ }
574
+ })();
575
+ `}v+=` }
576
+
577
+ // Subscribe to stores and update on changes. Capture the disposers so
578
+ // SPA fragment swaps can tear down old bindings before the next page's
579
+ // runtime takes over \u2014 without this, every navigation between pages
580
+ // using reactive-bindings stacked another subscription on every store,
581
+ // walking detached DOM forever. See stacksjs/stx#1709.
582
+ var _disposers = [];
583
+ `;for(let k of x)v+=` if (stores.${k}) {
584
+ var _unsub_${k} = stores.${k}.subscribe(function(state) {
585
+ $state.${k} = state;
586
+ updateBindings();
587
+ });
588
+ // store.subscribe() may return the disposer (preferred) or void; both
589
+ // are tolerated here.
590
+ if (typeof _unsub_${k} === 'function') _disposers.push(_unsub_${k});
591
+ }
592
+ `;return v+=`
593
+ // Initial update
594
+ updateBindings();
595
+
596
+ // Register this runtime's cleanup so SPA navigation can run it before
597
+ // swapping pages. The router (and any code) can call
598
+ // window.__stxCleanupBindings() to dispose subscriptions; we also wire
599
+ // 'popstate' and 'beforeunload' as a safety net for browser-driven nav.
600
+ function _cleanup() {
601
+ for (var i = 0; i < _disposers.length; i++) {
602
+ try { _disposers[i](); } catch (e) { /* swallow */ }
603
+ }
604
+ _disposers.length = 0;
605
+ }
606
+ if (!window.__stxBindingsCleanups) window.__stxBindingsCleanups = [];
607
+ window.__stxBindingsCleanups.push(_cleanup);
608
+ if (!window.__stxCleanupBindings) {
609
+ window.__stxCleanupBindings = function() {
610
+ var fns = window.__stxBindingsCleanups || [];
611
+ for (var i = 0; i < fns.length; i++) {
612
+ try { fns[i](); } catch (e) { /* swallow */ }
613
+ }
614
+ window.__stxBindingsCleanups = [];
615
+ };
616
+ window.addEventListener('popstate', window.__stxCleanupBindings);
617
+ window.addEventListener('beforeunload', window.__stxCleanupBindings);
618
+ }
619
+ }
620
+
621
+ // Start when DOM is ready
622
+ if (document.readyState === 'loading') {
623
+ document.addEventListener('DOMContentLoaded', initBindings);
624
+ }
625
+ else {
626
+ initBindings();
627
+ }
628
+ })();
629
+ </script>
630
+ `,v}function Sl(e){let{html:o,bindings:x,stores:v}=yg(e);if(x.length===0)return e;let k=xg(x,v),E=o.lastIndexOf("</body>");if(E!==-1)return o.slice(0,E)+k+o.slice(E);return o+k}function bg(e){let o=e.analytics;if(!o?.enabled)return"";switch(o.driver){case"fathom":return vg(o);case"google-analytics":return wg(o);case"plausible":return $g(o);case"self-hosted":return Sg(o);case"custom":return _g(o);default:return""}}function vg(e){let o=e.fathom;if(!o?.siteId)return"";let x=o.scriptUrl||"https://cdn.usefathom.com/script.js",v=o.defer!==!1?" defer":"",k=[`data-site="${tn(o.siteId)}"`];if(o.honorDnt)k.push('data-honor-dnt="true"');if(o.spa)k.push('data-spa="auto"');if(o.canonical)k.push(`data-canonical="${tn(o.canonical)}"`);if(o.auto===!1)k.push('data-auto="false"');return`
631
+ <!-- Fathom Analytics -->
632
+ <script src="${tn(x)}" ${k.join(" ")}${v}></script>
633
+ `}function wg(e){let o=e.googleAnalytics;if(!o?.measurementId)return"";let x=tn(o.measurementId),v=o.debug?`gtag('config', '${x}', { 'debug_mode': true });`:"";return`
634
+ <!-- Google Analytics -->
635
+ <script async src="https://www.googletagmanager.com/gtag/js?id=${x}"></script>
636
+ <script>
637
+ window.dataLayer = window.dataLayer || [];
638
+ function gtag(){dataLayer.push(arguments);}
639
+ gtag('js', new Date());
640
+ gtag('config', '${x}');
641
+ ${v}
642
+ </script>
643
+ `}function $g(e){let o=e.plausible;if(!o?.domain)return"";let x=o.scriptUrl||"https://plausible.io/js/script.js",v=[`data-domain="${tn(o.domain)}"`],k=x,E=[];if(o.trackLocalhost)E.push("local");if(o.hashMode)E.push("hash");if(E.length>0&&x==="https://plausible.io/js/script.js")k=`https://plausible.io/js/script.${E.join(".")}.js`;return`
644
+ <!-- Plausible Analytics -->
645
+ <script defer data-domain="${tn(o.domain)}" src="${tn(k)}"></script>
646
+ `}function Sg(e){let o=e.selfHosted;if(!o?.siteId||!o?.apiEndpoint)return"";let x=tn(o.siteId),v=tn(o.apiEndpoint),k=o.honorDnt?'if(n.doNotTrack==="1")return;':"",E=o.trackHashChanges?"w.addEventListener('hashchange',pv);":"",C=o.trackOutboundLinks?`
647
+ d.addEventListener('click',function(e){
648
+ var a=e.target.closest('a');
649
+ if(a&&a.hostname!==location.hostname){
650
+ t('outbound',{url:a.href});
651
+ }
652
+ });`:"";return`
653
+ <!-- Self-Hosted Analytics -->
654
+ <script data-site="${x}" data-api="${v}" defer>
655
+ (function(){
656
+ 'use strict';
657
+ var d=document,w=window,n=navigator,s=d.currentScript;
658
+ var site=s.dataset.site,api=s.dataset.api;
659
+ ${k}
660
+ var q=[],sid=Math.random().toString(36).slice(2);
661
+ function t(e,p){
662
+ var x=new XMLHttpRequest();
663
+ x.open('POST',api+'/collect',true);
664
+ x.setRequestHeader('Content-Type','application/json');
665
+ x.send(JSON.stringify({
666
+ s:site,sid:sid,e:e,p:p||{},
667
+ u:location.href,r:d.referrer,t:d.title,
668
+ sw:screen.width,sh:screen.height
669
+ }));
670
+ }
671
+ function pv(){t('pageview');}
672
+ ${E}
673
+ ${C}
674
+ if(d.readyState==='complete')pv();
675
+ else w.addEventListener('load',pv);
676
+ w.stxAnalytics={track:function(n,v){t('event',{name:n,value:v});}};
677
+ })();
678
+ </script>
679
+ `}function _g(e){let o=e.custom;if(!o)return"";if(o.inlineScript)return`
680
+ <!-- Custom Analytics -->
681
+ <script>
682
+ ${o.inlineScript}
683
+ </script>
684
+ `;if(!o.scriptUrl)return"";let x=[];if(o.scriptId)x.push(`id="${tn(o.scriptId)}"`);if(o.attributes)for(let[k,E]of Object.entries(o.attributes))x.push(`${tn(k)}="${tn(E)}"`);return`
685
+ <!-- Custom Analytics -->
686
+ <script${x.length>0?` ${x.join(" ")}`:""} src="${tn(o.scriptUrl)}" defer></script>
687
+ `}function _l(e,o){let x=bg(o);if(!x)return e;if(!e.includes("</head>")){let v=e.lastIndexOf("</body>");if(v!==-1)return e.slice(0,v)+x+e.slice(v);return e+x}return e.replace("</head>",`${x}</head>`)}function tn(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}var Eg={enabled:!1,trackMouse:!0,trackClicks:!0,trackScroll:!0,samplingRate:100,honorDnt:!0,batchSize:50,maxDataPoints:1000,sessionTimeout:30,persistData:!1,storagePrefix:"stx_heatmap",captureAttributes:["data-heatmap-id","data-track"],ignoreSelectors:["[data-heatmap-ignore]",".heatmap-ignore"],debugOverlay:!1};function El(e){let o=e.heatmap;if(!o?.enabled)return"";let x={...Eg,...o};return`
688
+ <!-- stx Heatmap - Privacy-Compliant Tracking -->
689
+ <script>
690
+ (function() {
691
+ 'use strict';
692
+
693
+ // Configuration
694
+ var config = ${JSON.stringify({trackMouse:x.trackMouse,trackClicks:x.trackClicks,trackScroll:x.trackScroll,samplingRate:x.samplingRate,honorDnt:x.honorDnt,endpoint:x.endpoint,batchSize:x.batchSize,maxDataPoints:x.maxDataPoints,sessionTimeout:x.sessionTimeout,persistData:x.persistData,storagePrefix:x.storagePrefix,captureAttributes:x.captureAttributes,ignoreSelectors:x.ignoreSelectors,zones:x.zones,debugOverlay:x.debugOverlay,minViewportWidth:x.minViewportWidth,maxViewportWidth:x.maxViewportWidth})};
695
+
696
+ // Check Do Not Track
697
+ if (config.honorDnt && navigator.doNotTrack === '1') {
698
+ return;
699
+ }
700
+
701
+ // Check viewport constraints
702
+ var vw = window.innerWidth;
703
+ if (config.minViewportWidth && vw < config.minViewportWidth) return;
704
+ if (config.maxViewportWidth && vw > config.maxViewportWidth) return;
705
+
706
+ // Session management (anonymous, no cookies)
707
+ var session = {
708
+ sid: Math.random().toString(36).slice(2) + Date.now().toString(36),
709
+ page: location.pathname,
710
+ vw: window.innerWidth,
711
+ vh: window.innerHeight,
712
+ points: [],
713
+ started: Date.now(),
714
+ lastActivity: Date.now()
715
+ };
716
+
717
+ // Throttle helper
718
+ var lastMove = 0;
719
+ function throttle(fn, wait) {
720
+ return function() {
721
+ var now = Date.now();
722
+ if (now - lastMove >= wait) {
723
+ lastMove = now;
724
+ fn.apply(this, arguments);
725
+ }
726
+ };
727
+ }
728
+
729
+ // Get relative coordinates (percentage)
730
+ function getRelativeCoords(e) {
731
+ return {
732
+ x: Math.round((e.clientX / window.innerWidth) * 10000) / 100,
733
+ y: Math.round((e.clientY / window.innerHeight) * 10000) / 100
734
+ };
735
+ }
736
+
737
+ // Check if element should be ignored
738
+ function shouldIgnore(el) {
739
+ if (!el || !config.ignoreSelectors) return false;
740
+ for (var i = 0; i < config.ignoreSelectors.length; i++) {
741
+ if (el.matches && el.matches(config.ignoreSelectors[i])) return true;
742
+ if (el.closest && el.closest(config.ignoreSelectors[i])) return true;
743
+ }
744
+ return false;
745
+ }
746
+
747
+ // Get element selector (simplified, no IDs to preserve privacy)
748
+ function getSelector(el) {
749
+ if (!el || !el.tagName) return null;
750
+ var tag = el.tagName.toLowerCase();
751
+ var classes = el.className && typeof el.className === 'string'
752
+ ? '.' + el.className.trim().split(/\\s+/).slice(0, 2).join('.')
753
+ : '';
754
+ return tag + classes;
755
+ }
756
+
757
+ // Find zone for element
758
+ function findZone(el) {
759
+ if (!config.zones || !el) return null;
760
+ for (var i = 0; i < config.zones.length; i++) {
761
+ var zone = config.zones[i];
762
+ if (el.closest && el.closest(zone.selector)) {
763
+ return zone.id;
764
+ }
765
+ }
766
+ return null;
767
+ }
768
+
769
+ // Capture custom attributes
770
+ function captureAttributes(el) {
771
+ if (!config.captureAttributes || !el) return null;
772
+ var attrs = {};
773
+ var hasAttrs = false;
774
+ for (var i = 0; i < config.captureAttributes.length; i++) {
775
+ var attr = config.captureAttributes[i];
776
+ var value = el.getAttribute && el.getAttribute(attr);
777
+ if (value) {
778
+ attrs[attr] = value;
779
+ hasAttrs = true;
780
+ }
781
+ }
782
+ return hasAttrs ? attrs : null;
783
+ }
784
+
785
+ // Add data point
786
+ function addPoint(point) {
787
+ session.lastActivity = Date.now();
788
+ if (session.points.length >= config.maxDataPoints) {
789
+ session.points.shift();
790
+ }
791
+ session.points.push(point);
792
+
793
+ // Send batch if threshold reached
794
+ if (config.endpoint && session.points.length >= config.batchSize) {
795
+ sendData();
796
+ }
797
+ }
798
+
799
+ // Send data to endpoint
800
+ function sendData() {
801
+ if (!config.endpoint || session.points.length === 0) return;
802
+
803
+ var data = {
804
+ sid: session.sid,
805
+ page: session.page,
806
+ vw: session.vw,
807
+ vh: session.vh,
808
+ points: session.points.splice(0, config.batchSize)
809
+ };
810
+
811
+ // Use sendBeacon for reliability
812
+ if (navigator.sendBeacon) {
813
+ navigator.sendBeacon(config.endpoint, JSON.stringify(data));
814
+ }
815
+ else {
816
+ var xhr = new XMLHttpRequest();
817
+ xhr.open('POST', config.endpoint, true);
818
+ xhr.setRequestHeader('Content-Type', 'application/json');
819
+ xhr.send(JSON.stringify(data));
820
+ }
821
+ }
822
+
823
+ // Mouse move handler
824
+ if (config.trackMouse) {
825
+ document.addEventListener('mousemove', throttle(function(e) {
826
+ if (shouldIgnore(e.target)) return;
827
+ var coords = getRelativeCoords(e);
828
+ addPoint({
829
+ x: coords.x,
830
+ y: coords.y,
831
+ type: 'move',
832
+ t: Date.now(),
833
+ zone: findZone(e.target)
834
+ });
835
+ }, config.samplingRate), { passive: true });
836
+ }
837
+
838
+ // Click handler
839
+ if (config.trackClicks) {
840
+ document.addEventListener('click', function(e) {
841
+ if (shouldIgnore(e.target)) return;
842
+ var coords = getRelativeCoords(e);
843
+ var point = {
844
+ x: coords.x,
845
+ y: coords.y,
846
+ type: 'click',
847
+ t: Date.now(),
848
+ el: getSelector(e.target),
849
+ zone: findZone(e.target)
850
+ };
851
+ var attrs = captureAttributes(e.target);
852
+ if (attrs) point.attrs = attrs;
853
+ addPoint(point);
854
+ }, { passive: true });
855
+ }
856
+
857
+ // Scroll handler
858
+ if (config.trackScroll) {
859
+ var lastScrollDepth = 0;
860
+ document.addEventListener('scroll', throttle(function() {
861
+ var scrollTop = window.pageYOffset || document.documentElement.scrollTop;
862
+ var scrollHeight = document.documentElement.scrollHeight - window.innerHeight;
863
+ var depth = scrollHeight > 0 ? Math.round((scrollTop / scrollHeight) * 100) : 0;
864
+
865
+ // Only track significant scroll changes (every 10%)
866
+ if (Math.abs(depth - lastScrollDepth) >= 10) {
867
+ lastScrollDepth = depth;
868
+ addPoint({
869
+ x: 50,
870
+ y: depth,
871
+ type: 'scroll',
872
+ t: Date.now(),
873
+ depth: depth
874
+ });
875
+ }
876
+ }, config.samplingRate * 2), { passive: true });
877
+ }
878
+
879
+ // Send remaining data on page unload
880
+ window.addEventListener('beforeunload', sendData);
881
+ window.addEventListener('visibilitychange', function() {
882
+ if (document.visibilityState === 'hidden') {
883
+ sendData();
884
+ }
885
+ });
886
+
887
+ // Persist data to localStorage if enabled
888
+ if (config.persistData) {
889
+ var storageKey = config.storagePrefix + '_' + session.page.replace(/\\//g, '_');
890
+
891
+ // Load existing data
892
+ try {
893
+ var stored = localStorage.getItem(storageKey);
894
+ if (stored) {
895
+ var parsed = JSON.parse(stored);
896
+ if (Date.now() - parsed.lastActivity < config.sessionTimeout * 60000) {
897
+ session.points = parsed.points || [];
898
+ }
899
+ }
900
+ }
901
+ catch (e) {}
902
+
903
+ // Save periodically
904
+ setInterval(function() {
905
+ try {
906
+ localStorage.setItem(storageKey, JSON.stringify({
907
+ points: session.points,
908
+ lastActivity: session.lastActivity
909
+ }));
910
+ }
911
+ catch (e) {}
912
+ }, 5000);
913
+ }
914
+
915
+ // Debug overlay
916
+ if (config.debugOverlay) {
917
+ var overlay = document.createElement('div');
918
+ overlay.id = 'stx-heatmap-overlay';
919
+ overlay.style.cssText = 'position:fixed;top:0;left:0;width:100%;height:100%;pointer-events:none;z-index:999999;';
920
+ document.body.appendChild(overlay);
921
+
922
+ var canvas = document.createElement('canvas');
923
+ canvas.width = window.innerWidth;
924
+ canvas.height = window.innerHeight;
925
+ canvas.style.cssText = 'width:100%;height:100%;';
926
+ overlay.appendChild(canvas);
927
+ var ctx = canvas.getContext('2d');
928
+
929
+ function renderOverlay() {
930
+ ctx.clearRect(0, 0, canvas.width, canvas.height);
931
+ session.points.forEach(function(p) {
932
+ var x = (p.x / 100) * canvas.width;
933
+ var y = (p.y / 100) * canvas.height;
934
+ ctx.beginPath();
935
+ ctx.arc(x, y, p.type === 'click' ? 8 : 3, 0, Math.PI * 2);
936
+ ctx.fillStyle = p.type === 'click' ? 'rgba(255,0,0,0.5)' : 'rgba(0,0,255,0.2)';
937
+ ctx.fill();
938
+ });
939
+ requestAnimationFrame(renderOverlay);
940
+ }
941
+ renderOverlay();
942
+
943
+ window.addEventListener('resize', function() {
944
+ canvas.width = window.innerWidth;
945
+ canvas.height = window.innerHeight;
946
+ });
947
+ }
948
+
949
+ // Expose API for manual tracking and data export
950
+ window.stxHeatmap = {
951
+ // Get current session data
952
+ getData: function() {
953
+ return {
954
+ sid: session.sid,
955
+ page: session.page,
956
+ vw: session.vw,
957
+ vh: session.vh,
958
+ points: session.points.slice(),
959
+ started: session.started,
960
+ lastActivity: session.lastActivity
961
+ };
962
+ },
963
+ // Export data as JSON
964
+ exportJSON: function() {
965
+ return JSON.stringify(this.getData(), null, 2);
966
+ },
967
+ // Export data as CSV
968
+ exportCSV: function() {
969
+ var data = this.getData();
970
+ var lines = ['x,y,type,timestamp,element,zone,depth'];
971
+ data.points.forEach(function(p) {
972
+ lines.push([p.x, p.y, p.type, p.t, p.el || '', p.zone || '', p.depth || ''].join(','));
973
+ });
974
+ return lines.join('\\n');
975
+ },
976
+ // Manual data send
977
+ flush: function() {
978
+ sendData();
979
+ },
980
+ // Clear data
981
+ clear: function() {
982
+ session.points = [];
983
+ if (config.persistData) {
984
+ var storageKey = config.storagePrefix + '_' + session.page.replace(/\\//g, '_');
985
+ try { localStorage.removeItem(storageKey); }
986
+ catch (e) {}
987
+ }
988
+ },
989
+ // Add custom event
990
+ track: function(type, data) {
991
+ addPoint({
992
+ x: data && data.x || 0,
993
+ y: data && data.y || 0,
994
+ type: type,
995
+ t: Date.now(),
996
+ attrs: data
997
+ });
998
+ },
999
+ // Generate heatmap visualization
1000
+ visualize: function(options) {
1001
+ options = options || {};
1002
+ var data = this.getData();
1003
+ var width = options.width || data.vw;
1004
+ var height = options.height || data.vh;
1005
+ var radius = options.radius || 20;
1006
+ var blur = options.blur || 15;
1007
+ var maxOpacity = options.maxOpacity || 0.6;
1008
+
1009
+ var canvas = document.createElement('canvas');
1010
+ canvas.width = width;
1011
+ canvas.height = height;
1012
+ var ctx = canvas.getContext('2d');
1013
+
1014
+ // Create heat points
1015
+ data.points.forEach(function(p) {
1016
+ var x = (p.x / 100) * width;
1017
+ var y = (p.y / 100) * height;
1018
+ var intensity = p.type === 'click' ? 1 : 0.3;
1019
+
1020
+ var gradient = ctx.createRadialGradient(x, y, 0, x, y, radius);
1021
+ gradient.addColorStop(0, 'rgba(255,0,0,' + intensity + ')');
1022
+ gradient.addColorStop(1, 'rgba(255,0,0,0)');
1023
+ ctx.fillStyle = gradient;
1024
+ ctx.fillRect(x - radius, y - radius, radius * 2, radius * 2);
1025
+ });
1026
+
1027
+ // Apply blur
1028
+ ctx.filter = 'blur(' + blur + 'px)';
1029
+ ctx.drawImage(canvas, 0, 0);
1030
+ ctx.filter = 'none';
1031
+
1032
+ // Colorize
1033
+ var imageData = ctx.getImageData(0, 0, width, height);
1034
+ var pixels = imageData.data;
1035
+ for (var i = 0; i < pixels.length; i += 4) {
1036
+ var alpha = pixels[i + 3];
1037
+ if (alpha > 0) {
1038
+ var ratio = alpha / 255;
1039
+ // Gradient: blue -> cyan -> green -> yellow -> red
1040
+ if (ratio < 0.25) {
1041
+ pixels[i] = 0;
1042
+ pixels[i + 1] = Math.round(ratio * 4 * 255);
1043
+ pixels[i + 2] = 255;
1044
+ }
1045
+ else if (ratio < 0.5) {
1046
+ pixels[i] = 0;
1047
+ pixels[i + 1] = 255;
1048
+ pixels[i + 2] = Math.round((1 - (ratio - 0.25) * 4) * 255);
1049
+ }
1050
+ else if (ratio < 0.75) {
1051
+ pixels[i] = Math.round((ratio - 0.5) * 4 * 255);
1052
+ pixels[i + 1] = 255;
1053
+ pixels[i + 2] = 0;
1054
+ }
1055
+ else {
1056
+ pixels[i] = 255;
1057
+ pixels[i + 1] = Math.round((1 - (ratio - 0.75) * 4) * 255);
1058
+ pixels[i + 2] = 0;
1059
+ }
1060
+ pixels[i + 3] = Math.round(alpha * maxOpacity);
1061
+ }
1062
+ }
1063
+ ctx.putImageData(imageData, 0, 0);
1064
+
1065
+ return canvas;
1066
+ }
1067
+ };
1068
+ })();
1069
+ </script>
1070
+ `}function kl(e,o){let x=El(o);if(!x)return e;let v=e.lastIndexOf("</body>");if(v!==-1)return e.slice(0,v)+x+e.slice(v);return e+x}var Cl={name:"heatmap",hasEndTag:!1,description:"Inject privacy-compliant heatmap tracking script",handler:async(e,o,x,v)=>{let k=x.__stx_config||{};if(o.length>0){let E=kg(o.join(" "));k.heatmap={...k.heatmap,...E,enabled:!0}}return El(k)}};function kg(e){let o={},x=e.match(/(\w+)=["']?([^"'\s]+)["']?/g)||[];for(let v of x){let[k,E]=v.split("="),C=E?.replace(/["']/g,"");switch(k){case"endpoint":o.endpoint=C;break;case"samplingRate":o.samplingRate=Number.parseInt(C,10);break;case"batchSize":o.batchSize=Number.parseInt(C,10);break;case"trackMouse":o.trackMouse=C==="true";break;case"trackClicks":o.trackClicks=C==="true";break;case"trackScroll":o.trackScroll=C==="true";break;case"honorDnt":o.honorDnt=C==="true";break;case"debugOverlay":o.debugOverlay=C==="true";break}}return o}var kn={duration:300,delay:0,ease:"ease",direction:"both"};function Cg(e,o={}){let{duration:x,delay:v,ease:k,direction:E,custom:C}={...kn,...o};if(e==="custom"&&C)return C;switch(e){case"fade":return`${E==="in"?"opacity: 0; animation: fadeIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":E==="out"?"opacity: 1; animation: fadeOut var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":"opacity: 1; transition: opacity var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);"}
1071
+ @keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
1072
+ @keyframes fadeOut { from { opacity: 1; } to { opacity: 0; } }`;case"slide":return`${E==="in"?"transform: translateY(20px); opacity: 0; animation: slideIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":E==="out"?"transform: translateY(0); opacity: 1; animation: slideOut var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":"transform: translateY(0); opacity: 1; transition: transform var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms), opacity var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);"}
1073
+ @keyframes slideIn { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
1074
+ @keyframes slideOut { from { transform: translateY(0); opacity: 1; } to { transform: translateY(20px); opacity: 0; } }`;case"scale":return`${E==="in"?"transform: scale(0.95); opacity: 0; animation: scaleIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":E==="out"?"transform: scale(1); opacity: 1; animation: scaleOut var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":"transform: scale(1); opacity: 1; transition: transform var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms), opacity var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);"}
1075
+ @keyframes scaleIn { from { transform: scale(0.95); opacity: 0; } to { transform: scale(1); opacity: 1; } }
1076
+ @keyframes scaleOut { from { transform: scale(1); opacity: 1; } to { transform: scale(0.95); opacity: 0; } }`;case"flip":return`${E==="in"?"transform: perspective(400px) rotateX(-90deg); opacity: 0; animation: flipIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":E==="out"?"transform: perspective(400px) rotateX(0); opacity: 1; animation: flipOut var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":"transform: perspective(400px) rotateX(0); opacity: 1; transition: transform var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms), opacity var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);"}
1077
+ @keyframes flipIn { from { transform: perspective(400px) rotateX(-90deg); opacity: 0; } to { transform: perspective(400px) rotateX(0); opacity: 1; } }
1078
+ @keyframes flipOut { from { transform: perspective(400px) rotateX(0); opacity: 1; } to { transform: perspective(400px) rotateX(90deg); opacity: 0; } }`;case"rotate":return`${E==="in"?"transform: rotate(-90deg); opacity: 0; animation: rotateIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":E==="out"?"transform: rotate(0); opacity: 1; animation: rotateOut var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":"transform: rotate(0); opacity: 1; transition: transform var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms), opacity var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);"}
1079
+ @keyframes rotateIn { from { transform: rotate(-90deg); opacity: 0; } to { transform: rotate(0); opacity: 1; } }
1080
+ @keyframes rotateOut { from { transform: rotate(0); opacity: 1; } to { transform: rotate(90deg); opacity: 0; } }`;default:return""}}function Rg(){return`
1081
+ <script data-stx-scoped data-stx-run="once">
1082
+ // Motion preferences handling
1083
+ (function() {
1084
+ const prefersReducedMotion = window.matchMedia('(prefers-reduced-motion: reduce)').matches;
1085
+
1086
+ if (prefersReducedMotion) {
1087
+ // Apply reduced motion settings
1088
+ document.documentElement.style.setProperty('--stx-transition-duration', '0ms');
1089
+ document.documentElement.setAttribute('data-reduced-motion', 'true');
1090
+ }
1091
+ else {
1092
+ document.documentElement.setAttribute('data-reduced-motion', 'false');
1093
+ }
1094
+
1095
+ // Listen for changes in preference
1096
+ window.matchMedia('(prefers-reduced-motion: reduce)').addEventListener('change', (e) => {
1097
+ if (e.matches) {
1098
+ document.documentElement.style.setProperty('--stx-transition-duration', '0ms');
1099
+ document.documentElement.setAttribute('data-reduced-motion', 'true');
1100
+ }
1101
+ else {
1102
+ document.documentElement.style.setProperty('--stx-transition-duration', '');
1103
+ document.documentElement.setAttribute('data-reduced-motion', 'false');
1104
+ }
1105
+ });
1106
+ })();
1107
+ </script>
1108
+ `}function Ag(e){return[/@animate\b/,/@transition\b/,/@scroll(?:Animate)?\b/,/@staggered\b/,/@sequence\b/,/@motion\b/,/@animationGroup\b/,/\bstx-transition\b/,/\bstx-(?:fade|scale|flip|rotate|slide|from-|observe)\b/,/data-animate=['"](?:auto|true|false)['"]/].some((x)=>x.test(e))}function Tg(e=0.1,o="0px"){return`
1109
+ <script data-stx-scoped data-stx-run="always">
1110
+ // Intersection Observer for scroll animations
1111
+ (function() {
1112
+ const initObserver = () => {
1113
+ if (!('IntersectionObserver' in window)) {
1114
+ // For browsers that don't support IntersectionObserver, show all elements immediately
1115
+ const elements = document.querySelectorAll('.stx-observe');
1116
+ elements.forEach(el => el.classList.remove('stx-out'));
1117
+ return;
1118
+ }
1119
+
1120
+ // Create the observer
1121
+ const options = {
1122
+ root: null, // Use viewport
1123
+ rootMargin: '${o}',
1124
+ threshold: ${e}
1125
+ };
1126
+
1127
+ const observer = new IntersectionObserver((entries) => {
1128
+ entries.forEach(entry => {
1129
+ if (entry.isIntersecting) {
1130
+ entry.target.classList.remove('stx-out');
1131
+ // Stop observing after animation is triggered
1132
+ observer.unobserve(entry.target);
1133
+ }
1134
+ });
1135
+ }, options);
1136
+
1137
+ // Start observing elements
1138
+ const elements = document.querySelectorAll('.stx-observe');
1139
+ elements.forEach(el => observer.observe(el));
1140
+ };
1141
+
1142
+ // Initialize observer when DOM is ready
1143
+ if (document.readyState === 'loading') {
1144
+ document.addEventListener('DOMContentLoaded', initObserver);
1145
+ }
1146
+ else {
1147
+ initObserver();
1148
+ }
1149
+ })();
1150
+ </script>
1151
+ `}function Ig(){return`
1152
+ <style id="stx-animation-base">
1153
+ :root {
1154
+ --stx-transition-duration: 300ms;
1155
+ --stx-transition-delay: 0ms;
1156
+ --stx-transition-ease: ease;
1157
+ }
1158
+
1159
+ @media (prefers-reduced-motion: reduce) {
1160
+ :root {
1161
+ --stx-transition-duration: 0ms;
1162
+ }
1163
+ }
1164
+
1165
+ [data-animate="false"] * {
1166
+ --stx-transition-duration: 0ms !important;
1167
+ animation-duration: 0ms !important;
1168
+ transition-duration: 0ms !important;
1169
+ }
1170
+
1171
+ /* Base transition classes */
1172
+ .stx-transition {
1173
+ transition: opacity var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms),
1174
+ transform var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);
1175
+ backface-visibility: hidden; /* Improve animation performance */
1176
+ transform-style: preserve-3d; /* Better 3D transforms */
1177
+ }
1178
+
1179
+ /* Fade animations */
1180
+ .stx-fade {
1181
+ transition: opacity var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);
1182
+ }
1183
+
1184
+ .stx-fade.stx-out {
1185
+ opacity: 0 !important;
1186
+ }
1187
+
1188
+ /* Scale animations */
1189
+ .stx-scale {
1190
+ transition: transform var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms),
1191
+ opacity var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);
1192
+ }
1193
+
1194
+ .stx-scale.stx-out {
1195
+ transform: scale(0.85) !important;
1196
+ opacity: 0 !important;
1197
+ }
1198
+
1199
+ /* Flip animations */
1200
+ .stx-flip {
1201
+ transition: transform var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms),
1202
+ opacity var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);
1203
+ perspective: 600px;
1204
+ }
1205
+
1206
+ .stx-flip.stx-out {
1207
+ transform: perspective(600px) rotateX(-90deg) !important;
1208
+ opacity: 0 !important;
1209
+ }
1210
+
1211
+ /* Rotate animations */
1212
+ .stx-rotate {
1213
+ transition: transform var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms),
1214
+ opacity var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);
1215
+ }
1216
+
1217
+ .stx-rotate.stx-out {
1218
+ transform: rotate(-90deg) !important;
1219
+ opacity: 0 !important;
1220
+ }
1221
+
1222
+ /* Direction-based animations */
1223
+ .stx-from-left, .stx-from-right, .stx-from-top, .stx-from-bottom {
1224
+ transition: transform var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms),
1225
+ opacity var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);
1226
+ }
1227
+
1228
+ .stx-from-left.stx-out {
1229
+ transform: translateX(-30px) !important;
1230
+ opacity: 0 !important;
1231
+ }
1232
+
1233
+ .stx-from-right.stx-out {
1234
+ transform: translateX(30px) !important;
1235
+ opacity: 0 !important;
1236
+ }
1237
+
1238
+ .stx-from-top.stx-out {
1239
+ transform: translateY(-30px) !important;
1240
+ opacity: 0 !important;
1241
+ }
1242
+
1243
+ .stx-from-bottom.stx-out {
1244
+ transform: translateY(30px) !important;
1245
+ opacity: 0 !important;
1246
+ }
1247
+
1248
+ /* Generic slide animations */
1249
+ .stx-slide {
1250
+ transition: transform var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms),
1251
+ opacity var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);
1252
+ }
1253
+
1254
+ .stx-slide.stx-out {
1255
+ transform: translateY(30px) !important;
1256
+ opacity: 0 !important;
1257
+ }
1258
+
1259
+ /* Scroll animation observer class */
1260
+ .stx-observe {
1261
+ will-change: opacity, transform;
1262
+ transition: opacity var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms),
1263
+ transform var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);
1264
+ }
1265
+ </style>
1266
+ `}function Dg(e,o,x={}){let{staggerDelay:v=50,sequence:k=!1}=x;return`
1267
+ <script data-stx-scoped data-stx-run="always">
1268
+ // Animation Group: ${e}
1269
+ (function() {
1270
+ const elements = ${JSON.stringify(o)};
1271
+ const staggerDelay = ${v};
1272
+ const sequence = ${k};
1273
+
1274
+ function animateGroup() {
1275
+ elements.forEach((selector, index) => {
1276
+ const element = document.querySelector(selector);
1277
+ if (!element) return;
1278
+
1279
+ const delay = sequence ? index * staggerDelay : 0;
1280
+ element.style.setProperty('--stx-transition-delay', delay + 'ms');
1281
+
1282
+ // For elements using animation keyframes
1283
+ element.style.animationDelay = delay + 'ms';
1284
+
1285
+ // If the element is initially hidden, show it
1286
+ if (element.classList.contains('stx-out')) {
1287
+ setTimeout(() => {
1288
+ element.classList.remove('stx-out');
1289
+ }, 10); // Small delay to ensure styles are applied
1290
+ }
1291
+ });
1292
+ }
1293
+
1294
+ // Run when DOM is fully loaded
1295
+ if (document.readyState === 'loading') {
1296
+ document.addEventListener('DOMContentLoaded', animateGroup);
1297
+ }
1298
+ else {
1299
+ animateGroup();
1300
+ }
1301
+ })();
1302
+ </script>
1303
+ `}var Rl={name:"transition",handler:(e,o,x,v)=>{if(o.length<1)return`<div class="stx-error">@transition directive requires at least a transition type</div>${e}`;let k=o[0],E=o.length>1?Number.parseInt(o[1],10)||kn.duration:kn.duration,C=o.length>2?o[2]||kn.ease:kn.ease,j=o.length>3?Number.parseInt(o[3],10)||kn.delay:kn.delay,L=o.length>4?o[4]||kn.direction:kn.direction,B=`stx-transition-${Math.random().toString(36).substr(2,9)}`,F=Cg(k,{duration:E,delay:j,ease:C,direction:L}),U="stx-transition",Z="";if(k==="fade")Z="stx-fade";else if(k==="slide")Z="stx-slide";else if(k==="scale")Z="stx-scale";else if(k==="flip")Z="stx-flip";else if(k==="rotate")Z="stx-rotate";return`<div id="${B}" class="${U} ${Z} ${L==="out"?"stx-out":""}"
1304
+ style="--stx-transition-duration: ${E}ms; --stx-transition-ease: ${C}; --stx-transition-delay: ${j}ms;">${e}</div>`},hasEndTag:!0,description:"Applies transition effects to an element"},Al={name:"scrollAnimate",handler:(e,o,x,v)=>{if(o.length<1)return`<div class="stx-error">@scrollAnimate directive requires at least an animation type</div>${e}`;let k=o[0],E=o.length>1?Number.parseInt(o[1],10)||300:300,C=o.length>2?o[2]||"ease":"ease",j=o.length>3?Number.parseFloat(o[3])||0.2:0.2,L=o.length>4?Number.parseInt(o[4],10)||0:0,B=`stx-scroll-${Math.random().toString(36).substr(2,9)}`,F=`--stx-transition-duration: ${E}ms; --stx-transition-ease: ${C}; --stx-transition-delay: ${L}ms; will-change: opacity, transform;`,U="stx-transition stx-observe stx-out";if(k==="fade")U+=" stx-fade";else if(k==="slide-up"||k==="slide")U+=" stx-from-bottom";else if(k==="slide-down")U+=" stx-from-top";else if(k==="slide-left")U+=" stx-from-right";else if(k==="slide-right")U+=" stx-from-left";else if(k==="scale")U+=" stx-scale";else if(k.includes("-"))U+=` stx-${k}`;else U+=` stx-${k}`;return`<div id="${B}" class="${U}" style="${F}" data-threshold="${j}">${e}</div>`},hasEndTag:!0,description:"Applies animations that trigger when scrolled into view"},Tl={name:"animationGroup",handler:(e,o,x,v)=>{if(o.length<2)return`<div class="stx-error">@animationGroup directive requires a group name and at least one element selector</div>${e}`;let k=o[0],E=o.slice(1).map((B)=>B.startsWith("#")||B.startsWith(".")?B:`#${B}`),C=x.staggerDelay||50,j=x.sequence||!0,L=Dg(k,E,{staggerDelay:C,sequence:j});return`${e}
1305
+ ${L}`},hasEndTag:!1,description:"Coordinates multiple animations together as a group"},Il={name:"motion",handler:(e,o,x,v)=>{let k=o.length>0?o[0].toLowerCase()==="true":!0,E=Rg();return`<div data-animate="${k?"auto":"true"}">${e}</div>${E}`},hasEndTag:!0,description:"Controls motion and animation preferences"};function Dl(e,o,x,v){let k=e;if(v.animation?.enabled===!1)return k;let E=x.includes("test")&&x.includes("animation");if(!Ag(k)&&!E)return k;if(!k.includes('<style id="stx-animation-base">')){let j=Ig();k=k.replace("</head>",`${j}
1306
+ </head>`)}if(k.includes("stx-observe")){if(!k.includes("Intersection Observer for scroll animations")){let L=Tg(),B=k.lastIndexOf("</body>");if(B!==-1)k=k.slice(0,B)+L+`
1307
+ `+k.slice(B)}}return k}function je(e){let o=e.match(/\bdefinePageMeta\s*\(\s*(\{[\s\S]*?\})\s*\)/m);if(!o)return null;try{return Function(`return ${o[1]}`)()}catch{return null}}function Pl(e){let o=e?.layout;if(o===!1)return!1;return typeof o==="string"&&o.trim()?o.trim():void 0}var Pg=100,Mg=599,Uo="__stxResponseStatus",Lr="__stxResponseHeaders";function Ys(e){return typeof e==="number"&&Number.isInteger(e)&&e>=Pg&&e<=Mg}function wt(e){for(let o of e.matchAll(/\bdefinePageMeta\s*\(\s*\{([\s\S]*?)\}\s*\)/g)){let x=o[1].match(/(?:^|,)\s*status\s*:\s*(\d{3})(?=\s*(?:,|$))/);if(!x)continue;let v=Number(x[1]);if(Ys(v))return v}return}function Vo(e,o){if(!e||typeof e!=="object")return!1;let x=typeof o==="string"&&/^\d+$/.test(o.trim())?Number(o.trim()):o;if(!Ys(x))return!1;return e[Uo]=x,!0}function Og(e,o,x){if(!e||typeof e!=="object")return;let v=String(o??"").trim();if(!v)return;e[Lr]={...e[Lr],[v]:String(x)}}function Be(e){let o=e?.[Uo];return Ys(o)?o:void 0}function Fe(e){let o=e?.[Lr];if(!o||typeof o!=="object")return;let x=Object.entries(o).map(([v,k])=>[v,String(k)]);return x.length>0?Object.fromEntries(x):void 0}function zi(e,o){if(!e||!o||e===o||typeof o!=="object")return;let x=Be(e);if(x!==void 0)o[Uo]=x;let v=Fe(e);if(v)o[Lr]={...o[Lr],...v}}function Bn(e){return{setResponseStatus:(o)=>{Vo(e,o)},notFound:(o=404)=>{let x=Ys(o)&&o>=400?o:404;Vo(e,x)},setResponseHeader:(o,x)=>{Og(e,o,x)}}}function Ml(e,o,x={}){if(!e.includes("@status"))return e;let{filePath:v,buildMode:k}=x,E=k==="compile",C="",j=0,L=/@status\s*\(/g,B;while((B=L.exec(e))!==null){let F=Ng(e,B.index+B[0].length-1);if(F<0)break;let U=e.slice(B.index+B[0].length,F).trim(),Z=/^\d+$/.test(U)?Number(U):c(U,o),Y=v?` in ${v}`:"";if(E)console.warn(`[stx] @status(${U})${Y} is skipped when precompiling: the build has no request, so the branch it sits in is not the one a visitor will get. Call notFound() or setResponseStatus(${U}) from <script server> instead \u2014 that runs per request.`);else if(!Vo(o,Z))console.warn(`[stx] @status(${U})${Y} is not an HTTP status (100-599) \u2014 ignoring it.`);C+=e.slice(j,B.index),j=F+1+(e.slice(F+1).match(/^[^\S\n]*\n?/)?.[0].length??0),L.lastIndex=j}return j===0?e:C+e.slice(j)}function Ng(e,o){let x=1,v=null,k=!1;for(let E=o+1;E<e.length;E++){let C=e[E];if(k){k=!1;continue}if(v){if(C==="\\")k=!0;else if(C===v)v=null;continue}if(C==='"'||C==="'"||C==="`"){v=C;continue}if(C==="(")x++;else if(C===")"&&--x===0)return E}return-1}var jg=0,Lg=0;function Ol(e,o){let x=e.match(new RegExp(`${o}\\s*=\\s*"([^"]*)"`,"i"));if(x)return x[1];let v=e.match(new RegExp(`${o}\\s*=\\s*'([^']*)'`,"i"));if(v)return v[1];return null}function Bg(e){let o=[],x=/<([a-z][a-z0-9-]*)\s+([^>]*x-data\s*=\s*(?:"[^"]*"|'[^']*')[^>]*)>/gi,v;while((v=x.exec(e))!==null){let[k,E,C]=v,j=v.index,L=Ol(C,"x-data");if(!L)continue;let B=`__stx_scope_${jg++}`,F=Ol(C,"x-init"),U=zg(e,E,j+k.length),Z=e.slice(j,U.endIndex),Y=Wg(Z);o.push({id:B,selector:`[data-stx-scope="${B}"]`,stateExpr:L,initExpr:F,bindings:[],refs:Y})}return o}function zg(e,o,x){let v=1,k=x,E=new RegExp(`<${o}(?:\\s|>)`,"gi"),C=new RegExp(`</${o}>`,"gi"),j=new RegExp(`<${o}[^>]*/\\s*>`,"gi");while(v>0&&k<e.length){E.lastIndex=k,C.lastIndex=k,j.lastIndex=k;let L=E.exec(e),B=C.exec(e),F=j.exec(e);if(F&&F.index<(L?.index??1/0)){k=F.index+F[0].length;continue}if(!B)return{endIndex:e.length};if(L&&L.index<B.index)v++,k=L.index+L[0].length;else{if(v--,v===0)return{endIndex:B.index+B[0].length};k=B.index+B[0].length}}return{endIndex:e.length}}function Wg(e){let o=new Map,x=e.replace(/x-data\s*=\s*"[^"]*"/gi,'x-data="__stripped__"').replace(/x-data\s*=\s*'[^']*'/gi,"x-data='__stripped__'"),v=/<[a-z][a-z0-9-]*\s+([^>]*x-ref\s*=\s*["']([^"']*)["'][^>]*)>/gi,k;while((k=v.exec(x))!==null){let[,E,C]=k,j=Fg(E);o.set(C,j)}return o}function Fg(e){let o=e.match(/\bid\s*=\s*["']([^"']*)["']/);if(o)return o[1];return`__stx_el_${Lg++}`}function Vg(){return`
1308
+ // STX Reactive Runtime - x-cloak and transition CSS
1309
+ (function() {
1310
+ var style = document.createElement('style');
1311
+ style.textContent = [
1312
+ '[x-cloak] { display: none !important; }',
1313
+ // Default transition classes
1314
+ '.stx-enter { opacity: 0; transform: scale(0.95); }',
1315
+ '.stx-enter-start { opacity: 0; transform: scale(0.95); }',
1316
+ '.stx-enter-active { transition: opacity 150ms ease-out, transform 150ms ease-out; }',
1317
+ '.stx-enter-to { opacity: 1; transform: scale(1); }',
1318
+ '.stx-leave { opacity: 1; transform: scale(1); }',
1319
+ '.stx-leave-start { opacity: 1; transform: scale(1); }',
1320
+ '.stx-leave-active { transition: opacity 100ms ease-in, transform 100ms ease-in; }',
1321
+ '.stx-leave-to { opacity: 0; transform: scale(0.95); }'
1322
+ ].join('\\n');
1323
+ document.head.appendChild(style);
1324
+ })();
1325
+
1326
+ // STX Reactive Runtime
1327
+ /* eslint-disable pickier/no-unused-vars, no-console, prefer-const */
1328
+ window.__stx_reactive = (function() {
1329
+ 'use strict';
1330
+
1331
+ // Deep reactive proxy that triggers onChange for any mutation
1332
+ function reactive(obj, onChange) {
1333
+ if (!obj || typeof obj !== 'object') return obj;
1334
+ return new Proxy(obj, {
1335
+ get(target, prop) {
1336
+ const value = target[prop];
1337
+ if (value && typeof value === 'object' && !Array.isArray(value) && !(value instanceof Promise)) {
1338
+ return reactive(value, onChange);
1339
+ }
1340
+ return value;
1341
+ },
1342
+ set(target, prop, value) {
1343
+ target[prop] = value;
1344
+ onChange(prop, value);
1345
+ return true;
1346
+ }
1347
+ });
1348
+ }
1349
+
1350
+ // Initialize an x-data scope: parse state, run init(), register into window.stx._scopes,
1351
+ // then let the signals runtime handle all directive processing (x-for, x-text, :bind, etc.)
1352
+ function initScope(scopeEl, initialState, bindings, refs, initExpr) {
1353
+ // Parse initial state (may contain methods including async init())
1354
+ var state;
1355
+ try {
1356
+ state = new Function('return (' + initialState + ')')();
1357
+ } catch (e) {
1358
+ console.error('[stx-reactive] Invalid x-data:', initialState, e);
1359
+ return;
1360
+ }
1361
+
1362
+ // Build $refs object
1363
+ var $refs = {};
1364
+ for (var name in refs) {
1365
+ if (Object.prototype.hasOwnProperty.call(refs, name)) {
1366
+ (function(refName, refId) {
1367
+ Object.defineProperty($refs, refName, {
1368
+ get: function() { return document.getElementById(refId); }
1369
+ });
1370
+ })(name, refs[name]);
1371
+ }
1372
+ }
1373
+
1374
+ // Extract init method from state if present (Alpine.js convention)
1375
+ var initMethod = state.init;
1376
+ if (typeof initMethod === 'function') {
1377
+ delete state.init;
1378
+ }
1379
+
1380
+ // Make state reactive \u2014 mutations trigger re-render via signals
1381
+ var scopeId = scopeEl.getAttribute('data-stx-scope');
1382
+ var stx = window.stx;
1383
+
1384
+ // Create signals for each state property so the signals runtime can track dependencies
1385
+ var signalState = {};
1386
+ var rawState = {};
1387
+ var derivedState = {};
1388
+ var accessors = {};
1389
+ // A getter must NOT be read here. Reading one calls it, and the old loop did
1390
+ // exactly that: the returned value is not a function, so it was wrapped as a
1391
+ // plain state() -- a snapshot of the answer at construction time, frozen
1392
+ // forever while plain properties beside it updated (#2053). A getter is a
1393
+ // derived value, so it is registered as one below, once ctxProxy exists for
1394
+ // it to read through.
1395
+ var ownDescriptors = Object.getOwnPropertyDescriptors ? Object.getOwnPropertyDescriptors(state) : {};
1396
+ for (var key in state) {
1397
+ if (Object.prototype.hasOwnProperty.call(state, key)) {
1398
+ var descriptor = ownDescriptors[key];
1399
+ if (descriptor && typeof descriptor.get === 'function') {
1400
+ accessors[key] = descriptor;
1401
+ continue;
1402
+ }
1403
+ if (typeof state[key] === 'function') {
1404
+ // Methods \u2014 bind to a proxy so 'this.prop = val' triggers signal updates
1405
+ signalState[key] = state[key];
1406
+ } else {
1407
+ // Data properties \u2014 wrap in signals for reactivity
1408
+ signalState[key] = stx.state(state[key]);
1409
+ rawState[key] = true;
1410
+ }
1411
+ }
1412
+ }
1413
+
1414
+ // Create a proxy context that auto-unwraps signals and writes back through them.
1415
+ // Methods get 'this' bound to this proxy so this.foo = bar triggers reactivity.
1416
+ var ctx = {};
1417
+ var ctxProxy = new Proxy(ctx, {
1418
+ get: function(target, prop) {
1419
+ if (prop === '$refs') return $refs;
1420
+ if (prop === '$el') return scopeEl;
1421
+ if (prop === '$nextTick') return function(fn) { requestAnimationFrame(fn); };
1422
+ var s = signalState[prop];
1423
+ if (!s) return undefined;
1424
+ if (rawState[prop] && s && typeof s === 'function' && typeof s.value !== 'undefined') {
1425
+ return s.value; // unwrap signal
1426
+ }
1427
+ if (typeof s === 'function' && !rawState[prop]) {
1428
+ return s.bind(ctxProxy); // bind methods to proxy
1429
+ }
1430
+ return s;
1431
+ },
1432
+ set: function(target, prop, value) {
1433
+ var accessor = derivedState[prop];
1434
+ if (accessor) {
1435
+ // A getter/setter pair writes through its setter. A getter alone has
1436
+ // nowhere to put the value: a derived has no .value setter, so the
1437
+ // assignment would be a silent no-op, which is the same class of
1438
+ // failure as the stale read this replaces.
1439
+ if (typeof accessor.set === 'function') {
1440
+ accessor.set.call(ctxProxy, value);
1441
+ return true;
1442
+ }
1443
+ console.warn('[stx-reactive] cannot assign to ' + String(prop) + ': it is a getter in x-data, so its value comes from what it reads. Give it a setter, or make it a plain property.');
1444
+ return true;
1445
+ }
1446
+ var s = signalState[prop];
1447
+ if (rawState[prop] && s && typeof s === 'function') {
1448
+ s.value = value; // write through signal \u2014 triggers effects
1449
+ } else {
1450
+ signalState[prop] = value;
1451
+ }
1452
+ return true;
1453
+ },
1454
+ has: function(target, prop) {
1455
+ return prop in signalState || prop === '$refs' || prop === '$el' || prop === '$nextTick';
1456
+ },
1457
+ ownKeys: function() {
1458
+ return Object.keys(signalState).concat(['$refs', '$el', '$nextTick']);
1459
+ },
1460
+ getOwnPropertyDescriptor: function(target, prop) {
1461
+ if (prop in signalState || prop === '$refs' || prop === '$el' || prop === '$nextTick') {
1462
+ return { configurable: true, enumerable: true, writable: true, value: ctxProxy[prop] };
1463
+ }
1464
+ return undefined;
1465
+ }
1466
+ });
1467
+
1468
+ // Now that ctxProxy exists, a getter becomes a derived that reads through it,
1469
+ // so it tracks whatever it touches and recomputes when that changes. derived()
1470
+ // is lazy, so nothing is evaluated until a binding actually reads it.
1471
+ //
1472
+ // Marked rawState as well: that is what makes the proxy unwrap it and what
1473
+ // exposes the signal itself to the runtime below, which is where dependency
1474
+ // tracking comes from. A getter needs both, exactly like a data property.
1475
+ for (var accessorKey in accessors) {
1476
+ if (Object.prototype.hasOwnProperty.call(accessors, accessorKey)) {
1477
+ (function(name, descriptor) {
1478
+ signalState[name] = stx.derived(function() {
1479
+ return descriptor.get.call(ctxProxy);
1480
+ });
1481
+ rawState[name] = true;
1482
+ derivedState[name] = descriptor;
1483
+ })(accessorKey, accessors[accessorKey]);
1484
+ }
1485
+ }
1486
+
1487
+ // Build scope vars for the signals runtime \u2014 it reads these for expression evaluation.
1488
+ // We need to provide getter/setter descriptors so signals track properly.
1489
+ var scopeVars = {};
1490
+ for (var k in signalState) {
1491
+ if (Object.prototype.hasOwnProperty.call(signalState, k)) {
1492
+ if (rawState[k]) {
1493
+ // Data: expose the signal directly so expressions trigger dependency tracking
1494
+ scopeVars[k] = signalState[k];
1495
+ } else {
1496
+ // Method: bind to ctxProxy so 'this' works
1497
+ scopeVars[k] = (typeof signalState[k] === 'function') ? signalState[k].bind(ctxProxy) : signalState[k];
1498
+ }
1499
+ }
1500
+ }
1501
+ scopeVars.$refs = $refs;
1502
+ scopeVars.$el = scopeEl;
1503
+ scopeVars.$nextTick = function(fn) { requestAnimationFrame(fn); };
1504
+
1505
+ // Register scope \u2014 merge with any existing vars from partial signal scripts
1506
+ if (!stx._scopes) stx._scopes = {};
1507
+ stx._scopes[scopeId] = Object.assign(stx._scopes[scopeId] || {}, scopeVars);
1508
+
1509
+ // Store on element for findElementScope
1510
+ scopeEl.__stx_scope = scopeVars;
1511
+
1512
+ // Run init() if present (supports async)
1513
+ function runInit() {
1514
+ var maybePromise;
1515
+ if (initMethod) {
1516
+ maybePromise = initMethod.call(ctxProxy);
1517
+ }
1518
+ if (initExpr) {
1519
+ try {
1520
+ var keys = Object.keys(scopeVars);
1521
+ var vals = keys.map(function(k) { return scopeVars[k]; });
1522
+ var fn = new Function(keys.join(','), initExpr);
1523
+ var result = fn.apply(ctxProxy, vals);
1524
+ if (result && typeof result.then === 'function') maybePromise = result;
1525
+ } catch (e) {
1526
+ console.warn('[stx-reactive] init expression error:', e);
1527
+ }
1528
+ }
1529
+ // If init is async, signal updates will trigger effects automatically
1530
+ // when init() resolves and sets this.prop = value (writes through signal)
1531
+ if (maybePromise && typeof maybePromise.then === 'function') {
1532
+ maybePromise.catch(function(e) {
1533
+ console.error('[stx-reactive] async init() error:', e);
1534
+ });
1535
+ }
1536
+ }
1537
+
1538
+ // Run init before the signals runtime processes this scope
1539
+ runInit();
1540
+
1541
+ // Expose for debugging
1542
+ scopeEl.__stx_state = ctxProxy;
1543
+ scopeEl.__stx_execute = function(stmt, $event, $el) {
1544
+ try {
1545
+ // Run the statement with the reactive proxy as the lexical scope.
1546
+ // Wrapping in a with-block on the proxy makes bare reads/writes go
1547
+ // through it (so foo = bar triggers signal.set()) instead of treating
1548
+ // each state key as a local function parameter \u2014 bare assignments
1549
+ // would otherwise just rebind the local and never reach the signal.
1550
+ var fn = new Function('$event', '$el', 'with(this){' + stmt + ';}');
1551
+ fn.call(ctxProxy, $event, $el);
1552
+ } catch (e) {
1553
+ console.warn('[stx-reactive] execute error:', e);
1554
+ }
1555
+ };
1556
+ }
1557
+
1558
+ return { initScope: initScope, reactive: reactive };
1559
+ })();
1560
+ `}function Nl(e,o){let x=e.replace(/\{!!([\s\S]*?)!!\}/g,(j,L)=>{try{let B=b(L,o,!0);if(B===void 0)return j;return String(B)}catch{return j}}),v="",k=0,E=null;while(k<x.length){let j=x[k];if(E&&j==="\\"){v+=j+(x[k+1]??""),k+=2;continue}if(j==="{"&&x[k+1]==="{"){let L=x.indexOf("}}",k+2);if(L!==-1){let B=x.slice(k,L+2);v+=C(x.slice(k+2,L),B,E),k=L+2;continue}}if(E){if(j===E)E=null}else if(j==="'"||j==='"'||j==="`")E=j;v+=j,k++}return v;function C(j,L,B){let F;try{F=b(j,o,!0)}catch{return L}if(F===void 0)return L;if(B){let U=String(F).replace(/\\/g,"\\\\").replace(new RegExp(B==="`"?"`":B,"g"),`\\${B}`).replace(/\r/g,"\\r").replace(/\n/g,"\\n");return B==="`"?U.replace(/\$\{/g,"\\${"):U}if(typeof F==="string"){let U=F.trim();if(U.startsWith("{")&&U.endsWith("}")||U.startsWith("[")&&U.endsWith("]"))try{return JSON.parse(U),U}catch{}}return JSON.stringify(F)}}function Ug(e,o){if(e.length===0)return"";let x=e.map((v)=>{let k=JSON.stringify(Object.fromEntries(v.refs)),E=Nl(v.stateExpr,o),C=v.initExpr?Nl(v.initExpr,o):null,j=JSON.stringify(E),L=C?JSON.stringify(C):"null";return`
1561
+ (function() {
1562
+ var scopeEl = document.querySelector('${v.selector}');
1563
+ if (!scopeEl) return;
1564
+ var refs = ${k};
1565
+ __stx_reactive.initScope(scopeEl, ${j}, [], refs, ${L});
1566
+ })();`}).join(`
1567
+ `);return`
1568
+ <script data-stx-scoped data-stx-reactive data-stx-run="always">
1569
+ ${Vg()}
1570
+ ${x}
1571
+ </script>`}function jl(e,o,x){if(!qg(e))return e;let v=Bg(e);if(v.length===0)return e;let k=Hg(e,v),E=Ug(v,o),C=k.lastIndexOf("</body>");if(C!==-1)k=k.slice(0,C)+E+`
1572
+ `+k.slice(C);else k+=E;return k}function Hg(e,o){let x=0,v=e.replace(/<([a-z][a-z0-9-]*)(\s+[^>]*x-data\s*=\s*(?:"[^"]*"|'[^']*')[^>]*)>/gi,(k,E,C)=>{let j=o[x++];if(!j)return k;let L=/data-stx-scope="([^"]*)"/.exec(C);if(L)return j.id=L[1],j.selector=`[data-stx-scope="${j.id}"]`,k;return`<${E} data-stx-scope="${j.id}"${C}>`});return v=v.replace(/\s*x-data\s*=\s*"([^"]*)"/g,' data-stx-xdata="$1"'),v=v.replace(/\s*x-data\s*=\s*'([^']*)'/g," data-stx-xdata='$1'"),v=v.replace(/\s*x-init\s*=\s*"([^"]*)"/g,' data-stx-xinit="$1"'),v=v.replace(/\s*x-init\s*=\s*'([^']*)'/g," data-stx-xinit='$1'"),v}function qg(e){return/x-data\s*=\s*["']/.test(e)}import Tm from"fs";import ra from"path";import{createHighlighter as Im}from"ts-syntax-highlighter";import si from"fs";import Yt from"path";import{loadConfigWithResult as _m}from"bunfig";async function Xg(e,o,x,v){let k=o[0]?.replace(/['"]/g,"")||"main",E=$e();if(k!=="main")E=E.replace("container:'main'",`container:'${k}'`);return`<script data-stx-router>${E}</script>`}var Ll={name:"stxRouter",handler:Xg,hasEndTag:!1,description:"Inject the STX SPA router script for client-side navigation"};function In(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function Bl(e){let o=e.trim().toLowerCase();return!o.startsWith("javascript:")&&!o.startsWith("vbscript:")&&!o.startsWith("data:text/html")}function Nn(e){let o=/^---\r?\n([\s\S]*?)\r?\n---\r?\n/,x=e.match(o);if(!x)return{data:{},content:e.trim()};let v=x[1],k=e.slice(x[0].length),E={};for(let C of v.split(`
1573
+ `)){let j=C.trim();if(!j||j.startsWith("#"))continue;let L=j.indexOf(":");if(L===-1)continue;let B=j.slice(0,L).trim(),F=j.slice(L+1).trim();if(typeof F==="string"){if(F.startsWith('"')&&F.endsWith('"')||F.startsWith("'")&&F.endsWith("'"))F=F.slice(1,-1);else if(F.startsWith("[")&&F.endsWith("]"))try{F=JSON.parse(F)}catch{}else if(F==="true")F=!0;else if(F==="false")F=!1;else if(/^-?\d+(?:\.\d+)?$/.test(F))F=Number(F)}E[B]=F}return{data:E,content:k.trim()}}function Ne(e,o={}){let{gfm:x=!0,breaks:v=!1}=o,k=e,E=[];if(k=k.replace(/```(\w*)\n([\s\S]*?)```/g,(F,U,Z)=>{let Y=E.length,Q=U?` class="language-${In(U)}"`:"";return E.push(`<pre><code${Q}>${In(Z.trim())}</code></pre>`),`\x00CODEBLOCK${Y}\x00`}),k=k.replace(/`([^`]*)`/g,(F,U)=>`<code>${In(U)}</code>`),k=k.replace(/^######\s+(.*)$/gm,"<h6>$1</h6>"),k=k.replace(/^#####\s+(.*)$/gm,"<h5>$1</h5>"),k=k.replace(/^####\s+(.*)$/gm,"<h4>$1</h4>"),k=k.replace(/^###\s+(.*)$/gm,"<h3>$1</h3>"),k=k.replace(/^##\s+(.*)$/gm,"<h2>$1</h2>"),k=k.replace(/^#\s+(.*)$/gm,"<h1>$1</h1>"),k=k.replace(/\*\*\*(.+?)\*\*\*/g,"<strong><em>$1</em></strong>"),k=k.replace(/___(.+?)___/g,"<strong><em>$1</em></strong>"),k=k.replace(/\*\*(.+?)\*\*/g,"<strong>$1</strong>"),k=k.replace(/__(.+?)__/g,"<strong>$1</strong>"),k=k.replace(/\*(.+?)\*/g,"<em>$1</em>"),k=k.replace(/(?<![a-zA-Z0-9])_(.+?)_(?![a-zA-Z0-9])/g,"<em>$1</em>"),x)k=k.replace(/~~(.+?)~~/g,"<del>$1</del>");if(k=k.replace(/!\[([^\]]*)\]\(([^)]+)\)/g,(F,U,Z)=>`<img src="${Bl(Z)?In(Z):""}" alt="${In(U)}" />`),k=k.replace(/\[([^\]]+)\]\(([^)]+)\)/g,(F,U,Z)=>`<a href="${Bl(Z)?In(Z):""}">${U}</a>`),k=k.replace(/^(?:---|\*\*\*|___)\s*$/gm,"<hr />"),k=k.replace(/^>\s+(.*)$/gm,"<blockquote>$1</blockquote>"),k=k.replace(/<\/blockquote>\n<blockquote>/g,`
1574
+ `),k=k.replace(/^[*\-+]\s+(.*)$/gm,"<li data-ul>$1</li>"),k=k.replace(/(<li data-ul>.*<\/li>\n?)+/g,"<ul>$&</ul>"),k=k.replace(/<\/ul>\n<ul>/g,""),k=k.replace(/^\d+\.\s+(.*)$/gm,"<li data-ol>$1</li>"),k=k.replace(/(<li data-ol>.*<\/li>\n?)+/g,"<ol>$&</ol>"),k=k.replace(/<\/ol>\n<ol>/g,""),k=k.replace(/<li data-ul>/g,"<li>"),k=k.replace(/<li data-ol>/g,"<li>"),x)k=k.replace(/^\|(.+)\|\s*\n\|[-:\s|]+\|\s*\n((?:\|.+\|\s*\n)*)/gm,(F,U,Z)=>{let Q=`<tr>${U.split("|").map((oe)=>oe.trim()).filter(Boolean).map((oe)=>`<th>${In(oe)}</th>`).join("")}</tr>`,se=Z.trim().split(`
1575
+ `).map((oe)=>`<tr>${oe.split("|").map((ce)=>ce.trim()).filter(Boolean).map((ce)=>`<td>${In(ce)}</td>`).join("")}</tr>`).join(`
1576
+ `);return`<table>
1577
+ <thead>
1578
+ ${Q}
1579
+ </thead>
1580
+ <tbody>
1581
+ ${se}
1582
+ </tbody>
1583
+ </table>`});if(x)k=k.replace(/<li>\s*\[\s*\]\s*/g,'<li><input type="checkbox" disabled /> '),k=k.replace(/<li>\s*\[x\]\s*/gi,'<li><input type="checkbox" checked disabled /> ');let C=k.split(`
1584
+ `),j=[],L=!1,B=[];for(let F of C){let U=F.trim();if(/^<(?:h[1-6]|ul|ol|li|blockquote|pre|table|thead|tbody|tr|th|td|hr|div|p)/.test(U)||/^\0CODEBLOCK\d+\0$/.test(U)||U===""){if(L&&B.length>0)j.push(`<p>${B.join(v?`<br />
1585
+ `:`
1586
+ `)}</p>`),B=[],L=!1;j.push(F)}else L=!0,B.push(U)}if(L&&B.length>0)j.push(`<p>${B.join(v?`<br />
1587
+ `:`
1588
+ `)}</p>`);if(k=j.join(`
1589
+ `),v)k=k.replace(/\n/g,`<br />
1590
+ `);for(let F=0;F<E.length;F++)k=k.replace(`\x00CODEBLOCK${F}\x00`,E[F]);return k=k.replace(/<p>\s*<\/p>/g,""),k.trim()}async function zl(e,o,x=""){let v=e,k=[],E=/@markdown(?:\([^)]*\))?/g,C;while((C=E.exec(e))!==null){let j=C.index,L=C[0].match(/@markdown\(([^)]*)\)/),B=L?L[1]:"",F=j+C[0].length,U=1,Z=F,Y=-1;while(U>0&&Z<e.length){let oe=e.indexOf("@markdown",Z),ie=e.indexOf("@endmarkdown",Z);if(ie===-1)break;if(oe!==-1&&oe<ie&&oe!==j){let ce=e[oe+9];if(ce==="("||ce===`
1591
+ `||ce==="\r"||ce===" "||ce===void 0)U++;Z=oe+9}else{if(U--,U===0){Y=ie;break}Z=ie+12}}if(Y===-1)continue;let Q=e.slice(F,Y),se=e.slice(j,Y+12);k.push({fullMatch:se,options:B,content:Q,index:j}),E.lastIndex=Y+12}for(let{fullMatch:j,options:L,content:B,index:F}of k)try{let U={};if(L)L.split(",").forEach((Q)=>{let se=Q.trim();if(se)U[se]=!0});let Z={gfm:U.gfm??!0,breaks:U.breaks??!1},Y=Ne(B.trim(),Z);v=v.split(j).join(Y)}catch(U){let Z=U instanceof Error?U.message:String(U),Y=g("Markdown Directive",`Error processing markdown: ${Z}`,x,e,F,j);v=v.split(j).join(Y)}return v}async function Wl(e,o,x,v){let k={gfm:!0,breaks:!1};return o.forEach((E)=>{let C=E.trim().replace(/['"]/g,"");if(C==="breaks")k.breaks=!0;if(C==="no-gfm")k.gfm=!1}),Ne(e.trim(),k)}var br=[320,480,640,768,1024,1280,1536,1920,2560],Kg=[1,1.5,2,3],Br=["avif","webp","jpeg"],Zg={avif:"image/avif",webp:"image/webp",jpeg:"image/jpeg",png:"image/png",gif:"image/gif"};function Ho(e,o=br,x={},v){return o.sort((k,E)=>k-E).map((k)=>`${zr(e,{...x,w:k,fm:v})} ${k}w`).join(", ")}function Fl(e,o,x=Kg,v={},k){return x.sort((E,C)=>E-C).map((E)=>{let C=Math.round(o*E);return`${zr(e,{...v,w:C,dpr:E,fm:k})} ${E}x`}).join(", ")}function qo(e,o="100vw"){if(!e||Object.keys(e).length===0)return o;let v=Object.entries(e).map(([k,E])=>{let C=/^\d+$/.test(k)?`${k}px`:k;return{bp:C,size:E,numericBp:Number.parseInt(C)||0}}).sort((k,E)=>k.numericBp-E.numericBp).map(({bp:k,size:E})=>`(max-width: ${k}) ${E}`);return v.push(o),v.join(", ")}function zr(e,o={}){let x=Object.entries(o).filter(([,E])=>E!==void 0&&E!==null).map(([E,C])=>{if(Array.isArray(C))return[E,C.join(",")];return[E,String(C)]});if(x.length===0)return e;let v=x.map(([E,C])=>`${E}=${encodeURIComponent(C)}`).join("&"),k=e.includes("?")?"&":"?";return`${e}${k}${v}`}function Xo(e){return Zg[e]||"application/octet-stream"}var Jg={strategy:"thumbhash",width:20,quality:50,blurLevel:40,transitionDuration:300,easing:"ease-out"},Zo=`
1592
+ .stx-img-placeholder {
1593
+ position: relative;
1594
+ overflow: hidden;
1595
+ background-size: cover;
1596
+ background-position: center;
1597
+ background-repeat: no-repeat;
1598
+ }
1599
+
1600
+ .stx-img-placeholder img {
1601
+ opacity: 0;
1602
+ transition: opacity var(--stx-img-transition-duration, 300ms) var(--stx-img-transition-easing, ease-out);
1603
+ }
1604
+
1605
+ .stx-img-placeholder.stx-img-loaded img {
1606
+ opacity: 1;
1607
+ }
1608
+
1609
+ .stx-img-blur {
1610
+ filter: blur(20px);
1611
+ transform: scale(1.1);
1612
+ transition: filter var(--stx-img-transition-duration, 300ms) var(--stx-img-transition-easing, ease-out),
1613
+ transform var(--stx-img-transition-duration, 300ms) var(--stx-img-transition-easing, ease-out);
1614
+ }
1615
+
1616
+ .stx-img-loaded .stx-img-blur {
1617
+ filter: blur(0);
1618
+ transform: scale(1);
1619
+ }
1620
+ `.trim();async function Gg(){try{return await import("ts-images")}catch{return null}}async function Yg(e,o={}){let x={...Jg,...o},v=await Gg();if(v)try{return await Qg(e,x,v)}catch(k){console.warn(`[stx-media] ts-images placeholder generation failed, using fallback: ${k}`)}return em(e,x)}async function Qg(e,o,x){let{generatePlaceholder:v,generateThumbHash:k}=x,C={blur:"blur",thumbhash:"thumbhash",blurhash:"thumbhash",pixelate:"pixelate","dominant-color":"dominant-color",none:"blur"}[o.strategy]||"blur";if(o.strategy==="thumbhash")return{dataURL:(await k(e)).dataUrl,width:32,height:32,aspectRatio:1,originalWidth:0,originalHeight:0,strategy:"thumbhash"};let j=await v(e,{width:o.width,height:o.height,quality:o.quality,blurLevel:o.blurLevel,strategy:C,base64Encode:!0});return{dataURL:j.dataURL,width:j.width,height:j.height,aspectRatio:j.aspectRatio,originalWidth:j.originalWidth,originalHeight:j.originalHeight,strategy:o.strategy,dominantColor:j.dominantColor,css:j.css}}function em(e,o){let x=o.width||20,v=o.height||x,k="#e5e7eb",E=`<svg xmlns="http://www.w3.org/2000/svg" width="${x}" height="${v}" viewBox="0 0 ${x} ${v}"><rect fill="#e5e7eb" width="${x}" height="${v}"/></svg>`;return{dataURL:`data:image/svg+xml;charset=utf-8,${encodeURIComponent(E)}`,width:x,height:v,aspectRatio:x/v,originalWidth:0,originalHeight:0,strategy:o.strategy,dominantColor:"#e5e7eb"}}function Vl(e,o,x={}){let v=x.transitionDuration||300,k=x.easing||"ease-out";return`
1621
+ #${e} {
1622
+ --stx-img-transition-duration: ${v}ms;
1623
+ --stx-img-transition-easing: ${k};
1624
+ background-image: url('${o.dataURL}');
1625
+ background-size: cover;
1626
+ background-position: center;
1627
+ }
1628
+
1629
+ #${e} img {
1630
+ opacity: 0;
1631
+ transition: opacity var(--stx-img-transition-duration) var(--stx-img-transition-easing);
1632
+ }
1633
+
1634
+ #${e}.stx-img-loaded img {
1635
+ opacity: 1;
1636
+ }
1637
+ `.trim()}var Ko=new Map;async function Ul(e,o={}){let x=`${e}:${JSON.stringify(o)}`;if(Ko.has(x))return Ko.get(x);let v=await Yg(e,o);return Ko.set(x,v),v}async function tm(){try{return await import("./chunk-pdt69hpb.js")}catch(e){if(!Hl)console.warn("[stx-media] Image processor not available, some features disabled:",e),Hl=!0;return null}}var Hl=!1,Jo=80,ei="async",ti="lazy",ql=!1;async function Qs(e,o={}){let x=o,v=e;if(v.process&&!v.skipOptimization){if(x.tsImagesConfig?.enabled&&!x.isDev)return im(v,x)}if(x.processedResult?.processed)return Qo(e,x.processedResult,o);if(x.responsiveVariants)return Zl(e,x.responsiveVariants,o);let{src:k,alt:E,width:C,height:j,sizes:L,widths:B=br,dpr:F,formats:U=Br,quality:Z=Jo,params:Y={},placeholder:Q="none",placeholderOptions:se={},lazy:oe=!0,priority:ie=!1,loading:ce=ie?"eager":ti,decoding:ae=ei,fetchpriority:pe,objectFit:me,objectPosition:he,crossorigin:Se,referrerpolicy:Ee}=e,{class:Ce,style:Re,id:Ae}=e,_e=e.data||{},{isDev:Te=!1,baseUrl:Me=""}=o;if(Te&&!o.optimize)return sm(e);let De,Ie,Oe=Ae||`stx-img-${Math.random().toString(36).slice(2,8)}`;if(Q!=="none"&&!ie)try{De=await Ul(k,{strategy:Q,...se}),Ie=Vl(Oe,De,se)}catch{}let tt=F!==void 0&&C!==void 0,ot;if(tt)ot=rm(e,Oe,De,o);else ot=await nm(e,Oe,De,o);let nt;if(ie){let ht=U.includes("webp")?"webp":U[0],at=Ho(k,B,{...Y,q:Z},ht),Pt=typeof L==="object"?qo(L):L||"100vw";nt=`<link rel="preload" as="image" imagesrcset="${at}" imagesizes="${Pt}" />`}let yt=[];if(!ql&&Q!=="none")yt.push(Zo),ql=!0;if(Ie)yt.push(Ie);let dt=oe?Kl(Oe):void 0;return{html:ot,preloadLink:nt,css:yt.length>0?yt.join(`
1638
+ `):void 0,script:dt}}async function nm(e,o,x,v){let{src:k,alt:E,width:C,height:j,sizes:L,widths:B=br,formats:F=Br,quality:U=Jo,params:Z={},lazy:Y=!0,priority:Q=!1,loading:se=Q?"eager":ti,decoding:oe=ei,fetchpriority:ie,objectFit:ce,objectPosition:ae,crossorigin:pe,referrerpolicy:me}=e,{class:he,style:Se}=e,Ee=e.data||{},Ce=typeof L==="object"?qo(L):L||"100vw",Re=[];for(let Te of F){let Me=Ho(k,B,{...Z,q:U},Te),De=Xo(Te);if(Y&&!Q)Re.push(` <source type="${De}" data-srcset="${Me}" data-sizes="${Ce}" />`);else Re.push(` <source type="${De}" srcset="${Me}" sizes="${Ce}" />`)}let Ae=Go({src:zr(k,{...Z,q:U}),alt:E,width:C,height:j,loading:Q?void 0:se,decoding:oe,fetchpriority:Q?"high":ie,objectFit:ce,objectPosition:ae,crossorigin:pe,referrerpolicy:me,className:Xl(he,x),style:Yo(Se,ce,ae,x),lazy:Y&&!Q,data:Ee}),_e;if(x){let Te=`background-image: url('${x.dataURL}'); background-size: cover; background-position: center;`;_e=`<div id="${o}" class="stx-img-placeholder" style="${Te}">
1639
+ <picture>
1640
+ ${Re.join(`
1641
+ `)}
1642
+ <img ${Ae} />
1643
+ </picture>
1644
+ </div>`}else _e=`<picture${o?` id="${o}"`:""}>
1645
+ ${Re.join(`
1646
+ `)}
1647
+ <img ${Ae} />
1648
+ </picture>`;return _e}function rm(e,o,x,v){let{src:k,alt:E,width:C,height:j,dpr:L=[1,2,3],quality:B=Jo,params:F={},lazy:U=!0,priority:Z=!1,loading:Y=Z?"eager":ti,decoding:Q=ei,fetchpriority:se,objectFit:oe,objectPosition:ie,crossorigin:ce,referrerpolicy:ae}=e,{class:pe,style:me}=e,he=e.data||{},Se=typeof C==="number"?C:Number.parseInt(String(C),10),Ee=Fl(k,Se,L,{...F,q:B}),Ce=Go({src:zr(k,{...F,w:Se,q:B}),alt:E,width:C,height:j,loading:Z?void 0:Y,decoding:Q,fetchpriority:Z?"high":se,objectFit:oe,objectPosition:ie,crossorigin:ce,referrerpolicy:ae,className:Xl(pe,x),style:Yo(me,oe,ie,x),lazy:U&&!Z,data:he}),Re=U&&!Z?`data-srcset="${Ee}"`:`srcset="${Ee}"`;if(x){let Ae=`background-image: url('${x.dataURL}'); background-size: cover; background-position: center;`;return`<div id="${o}" class="stx-img-placeholder" style="${Ae}">
1649
+ <img ${Ce} ${Re} />
1650
+ </div>`}return`<img ${o?`id="${o}" `:""}${Ce} ${Re} />`}function sm(e){let{src:o,alt:x,width:v,height:k,loading:E=ti,decoding:C=ei,fetchpriority:j,objectFit:L,objectPosition:B,crossorigin:F,referrerpolicy:U,priority:Z=!1}=e,{class:Y,style:Q,id:se}=e,oe=e.data||{};return{html:`<img ${Go({src:o,alt:x,width:v,height:k,loading:Z?"eager":E,decoding:C,fetchpriority:Z?"high":j,objectFit:L,objectPosition:B,crossorigin:F,referrerpolicy:U,className:Y,style:Yo(Q,L,B),id:se,data:oe})} />`}}function Go(e){let o=[];if(e.lazy)o.push(`data-src="${xn(e.src)}"`),o.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"');else o.push(`src="${xn(e.src)}"`);if(o.push(`alt="${xn(e.alt)}"`),e.width)o.push(`width="${e.width}"`);if(e.height)o.push(`height="${e.height}"`);if(e.loading)o.push(`loading="${e.loading}"`);if(e.decoding)o.push(`decoding="${e.decoding}"`);if(e.fetchpriority)o.push(`fetchpriority="${e.fetchpriority}"`);if(e.crossorigin)o.push(`crossorigin="${e.crossorigin}"`);if(e.referrerpolicy)o.push(`referrerpolicy="${e.referrerpolicy}"`);if(e.className)o.push(`class="${xn(e.className)}"`);if(e.style)o.push(`style="${xn(e.style)}"`);if(e.id)o.push(`id="${xn(e.id)}"`);if(e.data)for(let[x,v]of Object.entries(e.data))o.push(`data-${x}="${xn(v)}"`);if(e.lazy)o.push("data-stx-lazy");return o.join(" ")}function Xl(e,o){let x=[];if(e)x.push(e);if(o)x.push("stx-img-blur");return x.join(" ")||""}function Yo(e,o,x,v){let k=[];if(o)k.push(`object-fit: ${o}`);if(x)k.push(`object-position: ${x}`);if(v)k.push("opacity: 0; transition: opacity 300ms ease-out");if(e)k.push(e);return k.join("; ")}function xn(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#039;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Kl(e){return`
1651
+ (function() {
1652
+ const container = document.getElementById('${e}');
1653
+ if (!container) return;
1654
+
1655
+ const img = container.querySelector('img[data-stx-lazy]') || container;
1656
+ if (!img.dataset.src && !img.dataset.srcset) return;
1657
+
1658
+ const observer = new IntersectionObserver((entries) => {
1659
+ entries.forEach(entry => {
1660
+ if (entry.isIntersecting) {
1661
+ // Load image
1662
+ if (img.dataset.src) img.src = img.dataset.src;
1663
+ if (img.dataset.srcset) img.srcset = img.dataset.srcset;
1664
+
1665
+ // Load sources
1666
+ const sources = container.querySelectorAll('source[data-srcset]');
1667
+ sources.forEach(source => {
1668
+ if (source.dataset.srcset) source.srcset = source.dataset.srcset;
1669
+ if (source.dataset.sizes) source.sizes = source.dataset.sizes;
1670
+ });
1671
+
1672
+ // Handle load completion
1673
+ img.onload = () => {
1674
+ img.style.opacity = '1';
1675
+ if (container.classList.contains('stx-img-placeholder')) {
1676
+ container.classList.add('stx-img-loaded');
1677
+ }
1678
+ };
1679
+
1680
+ observer.disconnect();
1681
+ }
1682
+ });
1683
+ }, { rootMargin: '50px' });
1684
+
1685
+ observer.observe(container);
1686
+ })();
1687
+ `.trim()}async function im(e,o){let x=await tm();if(!x)return Qs({...e,process:!1},o);let v=o.tsImagesConfig;if(e.responsiveWidths&&e.responsiveWidths.length>0||e.widths&&e.widths.length>0||!e.width&&!e.dpr){let E=await x.generateResponsiveVariants(e.src,e,v);if(E)return Zl(e,E,o)}else{let E=await x.processImage(e.src,e,v);if(E.processed)return Qo(e,E,o)}return Qs({...e,process:!1},o)}async function Qo(e,o,x){let{alt:v,width:k,height:E,lazy:C=!0,priority:j=!1,objectFit:L,objectPosition:B,crossorigin:F,referrerpolicy:U}=e,{class:Z,style:Y}=e,Q=e.id||`stx-img-${Math.random().toString(36).slice(2,8)}`,se=e.data||{},oe=o.variants||[],ie=oe.find((Ie)=>Ie.format==="jpeg")||oe.find((Ie)=>Ie.format==="webp")||oe[0],ce=ie?.url||e.src,ae=oe.filter((Ie)=>Ie.format===(ie?.format||"jpeg")).map((Ie)=>`${Ie.url} ${Ie.width}w`).join(", "),pe=new Map;for(let Ie of oe){if(!pe.has(Ie.format))pe.set(Ie.format,[]);pe.get(Ie.format).push(Ie)}let me=[],he=["avif","webp","jpeg","png"];for(let Ie of he){let Oe=pe.get(Ie);if(Oe&&Oe.length>0){let tt=Oe.map((nt)=>`${nt.url} ${nt.width}w`).join(", "),ot=Xo(Ie);if(C&&!j)me.push(` <source type="${ot}" data-srcset="${tt}" />`);else me.push(` <source type="${ot}" srcset="${tt}" />`)}}let Se=[];if(C&&!j){if(Se.push(`data-src="${xn(ce)}"`),Se.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"'),ae)Se.push(`data-srcset="${ae}"`)}else if(Se.push(`src="${xn(ce)}"`),ae)Se.push(`srcset="${ae}"`);Se.push(`alt="${xn(v)}"`);let Ee=k||o.originalWidth,Ce=E||o.originalHeight;if(Ee)Se.push(`width="${Ee}"`);if(Ce)Se.push(`height="${Ce}"`);if(!j)Se.push(`loading="${C?"lazy":"eager"}"`);if(Se.push('decoding="async"'),j)Se.push('fetchpriority="high"');if(F)Se.push(`crossorigin="${F}"`);if(U)Se.push(`referrerpolicy="${U}"`);let Re=[];if(L)Re.push(`object-fit: ${L}`);if(B)Re.push(`object-position: ${B}`);if(o.placeholder&&C)Re.push("opacity: 0; transition: opacity 300ms ease-out");if(Y)Re.push(Y);if(Re.length>0)Se.push(`style="${Re.join("; ")}"`);let Ae=[];if(Z)Ae.push(Z);if(o.placeholder)Ae.push("stx-img-blur");if(Ae.length>0)Se.push(`class="${Ae.join(" ")}"`);if(C&&!j)Se.push("data-stx-lazy");for(let[Ie,Oe]of Object.entries(se))Se.push(`data-${Ie}="${xn(Oe)}"`);let _e;if(o.placeholder||o.dominantColor&&e.useDominantColor){let Ie=o.placeholder?`background-image: url('${o.placeholder}'); background-size: cover; background-position: center;`:`background-color: ${o.dominantColor};`;_e=`<div id="${Q}" class="stx-img-placeholder" style="${Ie}">
1688
+ <picture>
1689
+ ${me.join(`
1690
+ `)}
1691
+ <img ${Se.join(" ")} />
1692
+ </picture>
1693
+ </div>`}else _e=`<picture${Q?` id="${Q}"`:""}>
1694
+ ${me.join(`
1695
+ `)}
1696
+ <img ${Se.join(" ")} />
1697
+ </picture>`;let Te=[];if(o.placeholder)Te.push(Zo);let Me=C?Kl(Q):void 0,De;if(j&&ae)De=`<link rel="preload" as="image" imagesrcset="${ae}" />`;return{html:_e,preloadLink:De,css:Te.length>0?Te.join(`
1698
+ `):void 0,script:Me}}async function Zl(e,o,x){let v={src:o.src,processed:!0,variants:[],placeholder:o.placeholder?.dataURL,originalWidth:o.placeholder?.width,originalHeight:o.placeholder?.height};for(let[k,E]of Object.entries(o.byFormat))if(E)v.variants.push(...E);return Qo(e,v,x)}function om(){return qe({name:"img",hasEndTag:!1,description:"Render an optimized responsive image with srcset and lazy loading",transform:async(e,o,x,v)=>{let{src:k,alt:E,options:C}=am(e,o,x);if(!k)return console.warn("@img directive: missing src argument"),"<!-- @img: missing src -->";let j={src:k,alt:E||"",widths:C.widths||br,formats:C.formats||Br,quality:C.quality,sizes:C.sizes,dpr:C.dpr,params:C.params,placeholder:C.placeholder,placeholderOptions:C.placeholderOptions,lazy:C.lazy!==!1,priority:C.priority||!1,loading:C.loading,decoding:C.decoding,fetchpriority:C.fetchpriority,objectFit:C.objectFit,objectPosition:C.objectPosition,class:C.class,style:C.style,id:C.id,width:C.width,height:C.height},L=x.__isDev||!1,B=await Qs(j,{isDev:L}),F=B.html;if(B.preloadLink)F=B.preloadLink+`
1699
+ `+F;if(B.css)F+=`
1700
+ <style>${B.css}</style>`;if(B.script)F+=`
1701
+ <script>${B.script}</script>`;return F},defaults:{src:"",alt:"",options:{lazy:!0,placeholder:"none"}}})}function am(e,o,x){if(o.src)return{src:String(o.src),alt:String(o.alt||""),options:o.options||{}};let v=e.trim();if(v.startsWith("@img(")||v.startsWith("("))v=v.replace(/^@img\(/,"").replace(/^\(/,"").replace(/\)$/,"");let k=cm(v),E=ea(k[0],x)||"",C=ea(k[1],x)||"",j={};if(k[2]){let L=ea(k[2],x);if(typeof L==="object"&&L!==null)j=L;else if(typeof k[2]==="string")try{j=JSON.parse(k[2])}catch{}}return{src:E,alt:C,options:j}}function cm(e){let o=[],x="",v=!1,k="",E=0,C=0;for(let j=0;j<e.length;j++){let L=e[j],B=j>0?e[j-1]:"";if((L==='"'||L==="'"||L==="`")&&B!=="\\"){if(!v)v=!0,k=L;else if(L===k)v=!1,k="";else x+=L;continue}if(!v){if(L==="{")E++;if(L==="}")E--;if(L==="[")C++;if(L==="]")C--;if(L===","&&E===0&&C===0){o.push(x.trim()),x="";continue}}x+=L}if(x.trim())o.push(x.trim());return o}function ea(e,o){if(typeof e!=="string")return e;let x=e.trim();if(x.startsWith('"')&&x.endsWith('"')||x.startsWith("'")&&x.endsWith("'"))return x.slice(1,-1);if(!x.startsWith("/")&&!x.startsWith(".")&&!x.startsWith("http")&&!x.startsWith("{")){let v=o[x];if(v!==void 0)return v}if(x.startsWith("{")||x.startsWith("["))try{return JSON.parse(x)}catch{}return x}var Jl=om();async function Yl(){try{return await import("./chunk-jt0n43mk.js")}catch(e){if(!Gl)console.warn("[stx-media] Video processor not available, some features disabled:",e),Gl=!0;return null}}var Gl=!1,Ql=!0,eu="metadata",lm="https://cdn.jsdelivr.net/npm/ts-video-player@latest/dist/index.min.js";async function ni(e,o={}){let x=o,v=e;if(v.process&&!v.skipProcessing){if(x.tsVideosConfig?.enabled&&!x.isDev)return gm(v,x)}if(x.processedResult?.processed)return nu(e,x.processedResult,o);let k;if(v.generatePoster&&v.src&&!e.poster)k=await mm(v,x);let{src:E,sources:C=[],poster:j,posterPlaceholder:L,controls:B=Ql,autoplay:F=!1,muted:U=!1,loop:Z=!1,preload:Y=eu,playsinline:Q=!0,lazy:se=!0,player:oe="native",type:ie,width:ce,height:ae,crossorigin:pe,disablePictureInPicture:me=!1,disableRemotePlayback:he=!1}=e,Se=k||j,{class:Ee,style:Ce}=e,Re=e.id||`stx-video-${Math.random().toString(36).slice(2,8)}`;if(oe==="ts-video")return dm(e,o);if(ie&&ie!=="video")return um(E||"",ie,e);let Ae=C.length>0?C:E?[{src:E,type:tu(E)}]:[],_e=[`id="${Re}"`];if(B)_e.push("controls");if(F)_e.push("autoplay");if(U)_e.push("muted");if(Z)_e.push("loop");if(Q)_e.push("playsinline");if(me)_e.push("disablepictureinpicture");if(he)_e.push("disableremoteplayback");if(pe)_e.push(`crossorigin="${pe}"`);if(se){if(_e.push(`data-preload="${Y}"`),_e.push('preload="none"'),Se)_e.push(`data-poster="${Ht(Se)}"`);_e.push("data-stx-lazy")}else if(_e.push(`preload="${Y}"`),Se)_e.push(`poster="${Ht(Se)}"`);if(ce)_e.push(`width="${ce}"`);if(ae)_e.push(`height="${ae}"`);if(Ee)_e.push(`class="${Ht(Ee)}"`);if(Ce)_e.push(`style="${Ht(Ce)}"`);let Te=Ae.map((Ie)=>` <source ${se?`data-src="${Ht(Ie.src)}"`:`src="${Ht(Ie.src)}"`} type="${Ie.type}"${Ie.media?` media="${Ie.media}"`:""} />`).join(`
1702
+ `),Me=`<video ${_e.join(" ")}>
1703
+ ${Te}
1704
+ Your browser does not support the video tag.
1705
+ </video>`,De;if(se)De=`
1706
+ (function() {
1707
+ var video = document.getElementById('${Re}');
1708
+ if (!video) return;
1709
+
1710
+ var observer = new IntersectionObserver(function(entries) {
1711
+ entries.forEach(function(entry) {
1712
+ if (entry.isIntersecting) {
1713
+ // Load poster
1714
+ if (video.dataset.poster) {
1715
+ video.poster = video.dataset.poster;
1716
+ delete video.dataset.poster;
1717
+ }
1718
+
1719
+ // Load sources
1720
+ var sources = video.querySelectorAll('source[data-src]');
1721
+ sources.forEach(function(source) {
1722
+ source.src = source.dataset.src;
1723
+ delete source.dataset.src;
1724
+ });
1725
+
1726
+ // Set preload
1727
+ if (video.dataset.preload) {
1728
+ video.preload = video.dataset.preload;
1729
+ delete video.dataset.preload;
1730
+ }
1731
+
1732
+ video.load();
1733
+ observer.disconnect();
1734
+ }
1735
+ });
1736
+ }, { rootMargin: '50px' });
1737
+
1738
+ observer.observe(video);
1739
+ })();
1740
+ `.trim();return{html:Me,script:De}}function um(e,o,x){let{width:v=640,height:k=360}=x,{class:E,style:C}=x,j=x.id||`stx-embed-${Math.random().toString(36).slice(2,8)}`,L,B=null;switch(o){case"youtube":B=pm(e),L=B?`https://www.youtube-nocookie.com/embed/${B}`:e;break;case"vimeo":B=fm(e),L=B?`https://player.vimeo.com/video/${B}`:e;break;case"dailymotion":B=e.split("/").pop()||"",L=`https://www.dailymotion.com/embed/video/${B}`;break;case"twitch":B=e.split("/").pop()||"",L=`https://player.twitch.tv/?video=${B}&parent=${typeof window<"u"?window.location.hostname:"localhost"}`;break;default:L=e}let F=[`id="${j}"`,`src="${Ht(L)}"`,`width="${v}"`,`height="${k}"`,'frameborder="0"',"allowfullscreen",'allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"'];if(E)F.push(`class="${Ht(E)}"`);if(C)F.push(`style="${Ht(C)}"`);if(x.lazy)F.push('loading="lazy"');return{html:`<div class="stx-video-embed" style="position:relative;padding-bottom:56.25%;height:0;overflow:hidden;">
1741
+ <iframe ${F.join(" ")} style="position:absolute;top:0;left:0;width:100%;height:100%;"></iframe>
1742
+ </div>`}}function dm(e,o={}){let{src:x,sources:v=[],poster:k,controls:E=!0,autoplay:C=!1,muted:j=!1,loop:L=!1,preload:B="metadata",playsinline:F=!0,lazy:U=!0,width:Z,height:Y}=e,{class:Q,style:se}=e,oe=e.id||`ts-video-${Math.random().toString(36).slice(2,8)}`,ie={src:v.length>0?v:x,autoplay:C,loop:L,muted:j,playsinline:F,preload:B,poster:k,controls:E,title:e.title},ce=["position: relative",Z?`width: ${typeof Z==="number"?Z+"px":Z}`:"width: 100%",Y?`height: ${typeof Y==="number"?Y+"px":Y}`:"",se||""].filter(Boolean).join("; "),ae=`
1743
+ <div
1744
+ id="${oe}"
1745
+ class="ts-video-player${Q?" "+Ht(Q):""}"
1746
+ style="${ce}"
1747
+ data-ts-video-player
1748
+ data-config='${JSON.stringify(ie)}'
1749
+ ${U?"data-lazy":""}
1750
+ >
1751
+ <div class="ts-video-player__container">
1752
+ ${k?`
1753
+ <div class="ts-video-player__placeholder" style="background-image: url('${Ht(k)}');">
1754
+ <button class="ts-video-player__play-button" aria-label="Play video">
1755
+ <svg viewBox="0 0 24 24" fill="currentColor" width="64" height="64">
1756
+ <path d="M8 5v14l11-7z"/>
1757
+ </svg>
1758
+ </button>
1759
+ </div>
1760
+ `:""}
1761
+ </div>
1762
+ </div>
1763
+ `.trim(),pe=`
1764
+ (function() {
1765
+ var container = document.getElementById('${oe}');
1766
+ if (!container) return;
1767
+
1768
+ var config = JSON.parse(container.dataset.config || '{}');
1769
+ var isLazy = container.hasAttribute('data-lazy');
1770
+
1771
+ function loadPlayer() {
1772
+ if (typeof TSVideoPlayer !== 'undefined') {
1773
+ initPlayer();
1774
+ return;
1775
+ }
1776
+
1777
+ // Load ts-video-player from CDN
1778
+ var script = document.createElement('script');
1779
+ script.src = '${lm}';
1780
+ script.onload = initPlayer;
1781
+ script.onerror = function() {
1782
+ console.error('[stx] Failed to load ts-video-player');
1783
+ fallbackToNative();
1784
+ };
1785
+ document.head.appendChild(script);
1786
+ }
1787
+
1788
+ function initPlayer() {
1789
+ var player = TSVideoPlayer.createPlayer(container, config);
1790
+ if (config.src) {
1791
+ player.setSrc(config.src);
1792
+ }
1793
+ container.__tsVideoPlayer = player;
1794
+
1795
+ // Remove placeholder
1796
+ var placeholder = container.querySelector('.ts-video-player__placeholder');
1797
+ if (placeholder) {
1798
+ placeholder.style.display = 'none';
1799
+ }
1800
+ }
1801
+
1802
+ function fallbackToNative() {
1803
+ // Fallback to native video element
1804
+ var video = document.createElement('video');
1805
+ video.controls = config.controls !== false;
1806
+ video.autoplay = config.autoplay;
1807
+ video.muted = config.muted;
1808
+ video.loop = config.loop;
1809
+ video.playsInline = config.playsinline;
1810
+ video.preload = config.preload || 'metadata';
1811
+ if (config.poster) video.poster = config.poster;
1812
+ if (config.src) video.src = typeof config.src === 'string' ? config.src : config.src[0]?.src || config.src[0];
1813
+ video.style.width = '100%';
1814
+ video.style.height = '100%';
1815
+
1816
+ var containerEl = container.querySelector('.ts-video-player__container');
1817
+ if (containerEl) {
1818
+ containerEl.innerHTML = '';
1819
+ containerEl.appendChild(video);
1820
+ }
1821
+ }
1822
+
1823
+ if (isLazy) {
1824
+ var observer = new IntersectionObserver(function(entries) {
1825
+ entries.forEach(function(entry) {
1826
+ if (entry.isIntersecting) {
1827
+ loadPlayer();
1828
+ observer.disconnect();
1829
+ }
1830
+ });
1831
+ }, { rootMargin: '50px' });
1832
+ observer.observe(container);
1833
+ }
1834
+ else {
1835
+ if (document.readyState === 'loading') {
1836
+ document.addEventListener('DOMContentLoaded', loadPlayer);
1837
+ }
1838
+ else {
1839
+ loadPlayer();
1840
+ }
1841
+ }
1842
+
1843
+ // Handle play button click
1844
+ var playButton = container.querySelector('.ts-video-player__play-button');
1845
+ if (playButton) {
1846
+ playButton.addEventListener('click', function() {
1847
+ loadPlayer();
1848
+ var check = setInterval(function() {
1849
+ if (container.__tsVideoPlayer && container.__tsVideoPlayer.ready) {
1850
+ container.__tsVideoPlayer.play();
1851
+ clearInterval(check);
1852
+ }
1853
+ }, 100);
1854
+ });
1855
+ }
1856
+ })();
1857
+ `.trim(),me=`
1858
+ .ts-video-player {
1859
+ position: relative;
1860
+ background: #000;
1861
+ }
1862
+
1863
+ .ts-video-player__container {
1864
+ position: relative;
1865
+ width: 100%;
1866
+ padding-bottom: 56.25%;
1867
+ }
1868
+
1869
+ .ts-video-player__container > * {
1870
+ position: absolute;
1871
+ top: 0;
1872
+ left: 0;
1873
+ width: 100%;
1874
+ height: 100%;
1875
+ }
1876
+
1877
+ .ts-video-player__placeholder {
1878
+ display: flex;
1879
+ align-items: center;
1880
+ justify-content: center;
1881
+ background-color: #1a1a1a;
1882
+ background-size: cover;
1883
+ background-position: center;
1884
+ cursor: pointer;
1885
+ }
1886
+
1887
+ .ts-video-player__play-button {
1888
+ display: flex;
1889
+ align-items: center;
1890
+ justify-content: center;
1891
+ width: 80px;
1892
+ height: 80px;
1893
+ background: rgba(0, 0, 0, 0.7);
1894
+ border: none;
1895
+ border-radius: 50%;
1896
+ color: white;
1897
+ cursor: pointer;
1898
+ transition: transform 0.2s, background 0.2s;
1899
+ }
1900
+
1901
+ .ts-video-player__play-button:hover {
1902
+ transform: scale(1.1);
1903
+ background: rgba(0, 0, 0, 0.9);
1904
+ }
1905
+
1906
+ .ts-video-player__play-button svg {
1907
+ margin-left: 4px;
1908
+ }
1909
+ `.trim();return{html:ae,script:pe,css:me}}function tu(e){switch(e.split(".").pop()?.toLowerCase()){case"mp4":return"video/mp4";case"webm":return"video/webm";case"ogg":case"ogv":return"video/ogg";case"mov":return"video/quicktime";case"avi":return"video/x-msvideo";case"mkv":return"video/x-matroska";case"m3u8":return"application/x-mpegURL";default:return"video/mp4"}}function pm(e){let o=[/youtube\.com\/watch\?v=([^&]+)/,/youtube\.com\/embed\/([^?]+)/,/youtu\.be\/([^?]+)/,/youtube\.com\/v\/([^?]+)/];for(let x of o){let v=e.match(x);if(v)return v[1]}return null}function fm(e){let o=e.match(/vimeo\.com\/(\d+)/);return o?o[1]:null}function Ht(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}async function gm(e,o){let x=await Yl();if(!x)return ni({...e,process:!1},o);let v=o.tsVideosConfig,k=await x.processVideo(e.src,e,v,e.onProcessProgress);if(k.processed)return nu(e,k,o);return ni({...e,process:!1},o)}async function mm(e,o){let x=await Yl();if(!x||!e.src)return;let v=typeof e.generatePoster==="object"?e.generatePoster:{timestamp:0},k=o.tsVideosConfig||{enabled:!0,outputDir:"dist/videos",baseUrl:"/videos"};return(await x.generatePoster(e.src,v,k.outputDir,k.baseUrl||"/videos"))?.url}function nu(e,o,x){let{controls:v=Ql,autoplay:k=!1,muted:E=!1,loop:C=!1,preload:j=eu,playsinline:L=!0,lazy:B=!0,width:F,height:U,crossorigin:Z,disablePictureInPicture:Y=!1,disableRemotePlayback:Q=!1}=e,{class:se,style:oe}=e,ie=e.id||`stx-video-${Math.random().toString(36).slice(2,8)}`,ce=e.src,ae=tu(ce);if(o.transcoded)ce=o.transcoded.url,ae="video/mp4";let pe=o.streaming?.hls||o.streaming?.dash;if(pe){if(o.streaming?.hls)ce=o.streaming.hls.manifestUrl,ae="application/x-mpegURL";else if(o.streaming?.dash)ce=o.streaming.dash.manifestUrl,ae="application/dash+xml"}let me=o.poster?.url||e.poster,he=[`id="${ie}"`];if(v)he.push("controls");if(k)he.push("autoplay");if(E)he.push("muted");if(C)he.push("loop");if(L)he.push("playsinline");if(Y)he.push("disablepictureinpicture");if(Q)he.push("disableremoteplayback");if(Z)he.push(`crossorigin="${Z}"`);if(B){if(he.push(`data-preload="${j}"`),he.push('preload="none"'),me)he.push(`data-poster="${Ht(me)}"`);he.push("data-stx-lazy")}else if(he.push(`preload="${j}"`),me)he.push(`poster="${Ht(me)}"`);let Se=F||o.metadata?.width,Ee=U||o.metadata?.height;if(Se)he.push(`width="${Se}"`);if(Ee)he.push(`height="${Ee}"`);if(se)he.push(`class="${Ht(se)}"`);if(oe)he.push(`style="${Ht(oe)}"`);let Re=` <source ${B?`data-src="${Ht(ce)}"`:`src="${Ht(ce)}"`} type="${ae}" />`,Ae=`<video ${he.join(" ")}>
1910
+ ${Re}
1911
+ Your browser does not support the video tag.
1912
+ </video>`;if(o.spriteSheet)Ae=`<div class="stx-video-wrapper" data-sprite-sheet="${Ht(o.spriteSheet.url)}" data-sprite-cols="${o.spriteSheet.columns}" data-sprite-interval="${o.spriteSheet.interval}">
1913
+ ${Ae}
1914
+ </div>`;let _e;if(B)_e=`
1915
+ (function() {
1916
+ var video = document.getElementById('${ie}');
1917
+ if (!video) return;
1918
+
1919
+ var observer = new IntersectionObserver(function(entries) {
1920
+ entries.forEach(function(entry) {
1921
+ if (entry.isIntersecting) {
1922
+ // Load poster
1923
+ if (video.dataset.poster) {
1924
+ video.poster = video.dataset.poster;
1925
+ delete video.dataset.poster;
1926
+ }
1927
+
1928
+ // Load sources
1929
+ var sources = video.querySelectorAll('source[data-src]');
1930
+ sources.forEach(function(source) {
1931
+ source.src = source.dataset.src;
1932
+ delete source.dataset.src;
1933
+ });
1934
+
1935
+ // Set preload
1936
+ if (video.dataset.preload) {
1937
+ video.preload = video.dataset.preload;
1938
+ delete video.dataset.preload;
1939
+ }
1940
+
1941
+ video.load();
1942
+ observer.disconnect();
1943
+ }
1944
+ });
1945
+ }, { rootMargin: '50px' });
1946
+
1947
+ observer.observe(video);
1948
+ })();
1949
+ `.trim();let Te;if(pe)Te=`
1950
+ .stx-video-wrapper {
1951
+ position: relative;
1952
+ width: 100%;
1953
+ }
1954
+ .stx-video-wrapper video {
1955
+ width: 100%;
1956
+ height: auto;
1957
+ }
1958
+ `.trim();return{html:Ae,script:_e,css:Te}}function ru(){return qe({name:"video",hasEndTag:!1,description:"Render a video with optional ts-videos processing, streaming, and poster generation",transform:async(e,o,x,v)=>{let{src:k,options:E}=hm(e,o,x);if(!k)return console.warn("@video directive: missing src argument"),"<!-- @video: missing src -->";let C={src:k,poster:E.poster,controls:E.controls!==!1,autoplay:E.autoplay||!1,muted:E.muted||!1,loop:E.loop||!1,preload:E.preload||"metadata",playsinline:E.playsinline!==!1,lazy:E.lazy!==!1,player:E.player||"native",type:E.type,width:E.width,height:E.height,class:E.class,style:E.style,id:E.id,crossorigin:E.crossorigin,disablePictureInPicture:E.disablePictureInPicture,disableRemotePlayback:E.disableRemotePlayback,title:E.title,quality:E.quality,platform:E.platform,process:E.process,generatePoster:E.generatePoster,streaming:E.streaming,transcode:E.transcode,spriteSheet:E.spriteSheet,waveform:E.waveform},L={isDev:x.__isDev||!1,tsVideosConfig:x.__tsVideosConfig},B=await ni(C,L),F=B.html;if(B.css)F+=`
1959
+ <style>${B.css}</style>`;if(B.script)F+=`
1960
+ <script>${B.script}</script>`;return F},defaults:{src:"",options:{controls:!0,lazy:!0,preload:"metadata"}}})}function hm(e,o,x){if(o.src)return{src:String(o.src),options:o.options||{}};let v=e.trim();if(v.startsWith("@video(")||v.startsWith("("))v=v.replace(/^@video\(/,"").replace(/^\(/,"").replace(/\)$/,"");let k=ym(v),E=su(k[0],x)||"",C={};if(k[1]){let j=su(k[1],x);if(typeof j==="object"&&j!==null)C=j;else if(typeof k[1]==="string")try{C=JSON.parse(k[1])}catch{}}return{src:E,options:C}}function ym(e){let o=[],x="",v=!1,k="",E=0,C=0;for(let j=0;j<e.length;j++){let L=e[j],B=j>0?e[j-1]:"";if((L==='"'||L==="'"||L==="`")&&B!=="\\"){if(!v)v=!0,k=L;else if(L===k)v=!1,k="";else x+=L;continue}if(!v){if(L==="{")E++;if(L==="}")E--;if(L==="[")C++;if(L==="]")C--;if(L===","&&E===0&&C===0){o.push(x.trim()),x="";continue}}x+=L}if(x.trim())o.push(x.trim());return o}function su(e,o){if(typeof e!=="string")return e;let x=e.trim();if(x.startsWith('"')&&x.endsWith('"')||x.startsWith("'")&&x.endsWith("'"))return x.slice(1,-1);if(!x.startsWith("/")&&!x.startsWith(".")&&!x.startsWith("http")&&!x.startsWith("{")){let v=o[x];if(v!==void 0)return v}if(x.startsWith("{")||x.startsWith("["))try{return JSON.parse(x)}catch{}return x}var ta=ru();import xm from"fs";import ln from"path";async function Kn(e,o){if(!e.webComponents?.enabled)return[];let x=e.webComponents.components||[],v=[];if(x.length>0){if(e.debug)console.log(`Building ${x.length} web components...`);for(let k of x)try{let E=await bm(k,e,o);if(E)v.push(E)}catch(E){if(console.error(`Error building web component ${k.name}:`,E),e.debug)throw E}}return v}async function bm(e,o,x){let{name:v,file:k,tag:E,extends:C}=e;if(!v||!k||!E)return console.error("Invalid web component configuration, missing required fields:",e),null;let j=null;if(ln.isAbsolute(k)&&await n(k))j=k;else if(o.componentsDir){let se=ln.join(o.componentsDir,k);if(await n(se))j=se}if(!j)j=await Xn(k,process.cwd(),o,x);if(!j)return console.error(`Web component source file not found: ${k}`),null;let L=await Bun.file(j).text();x.add(j);let F=(e.outputFormat||"js")==="ts",U=F?wm({name:v,tag:E,baseElement:C,source:L,shadowDOM:e.shadowDOM??!0,template:e.template??!0,styleSource:e.styleSource,attributes:e.attributes||[],attributeTypes:e.attributeTypes||{}}):vm({name:v,tag:E,baseElement:C,source:L,shadowDOM:e.shadowDOM??!0,template:e.template??!0,styleSource:e.styleSource,attributes:e.attributes||[]}),Z=o.webComponents?.outputDir||"dist/web-components";await xm.promises.mkdir(Z,{recursive:!0});let Y=F?"ts":"js",Q=ln.join(Z,`${E}.${Y}`);if(await Bun.write(Q,U),o.debug)console.log(`Built web component ${v} -> ${Q}`);return Q}function vm(e){let{name:o,tag:x,baseElement:v="HTMLElement",source:k,shadowDOM:E,template:C,styleSource:j,attributes:L=[]}=e,B=k.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").trim();if(!E)B=B.replace(/<slot\s+name=["']([^"']+)["']\s*>([\s\S]*?)<\/slot>/gi,'<div data-slot="$1">$2</div>'),B=B.replace(/<slot\s+name=["']([^"']+)["']\s*\/>/gi,'<div data-slot="$1"></div>'),B=B.replace(/<slot\s*>([\s\S]*?)<\/slot>/gi,"<div data-default-slot>$1</div>"),B=B.replace(/<slot\s*\/>/gi,"<div data-default-slot></div>");let F="";if(j)F=`<link rel="stylesheet" href="${j}">`;return`/**
1961
+ * ${o} Web Component
1962
+ * Auto-generated from stx component
1963
+ */
1964
+ class ${o.replace(/\W/g,"")} extends ${v} {
1965
+ constructor() {
1966
+ super()
1967
+ this._initialized = false
1968
+ ${E?"":"this._slotContent = []"}
1969
+ ${E?'this.attachShadow({ mode: "open" })':""}
1970
+ }
1971
+
1972
+ ${C?`
1973
+ _createTemplate() {
1974
+ const template = document.createElement('template')
1975
+ template.innerHTML = \`${F}${B}\`
1976
+ ${E?"this.shadowRoot.appendChild(template.content.cloneNode(true))":"this.appendChild(template.content.cloneNode(true))"}
1977
+ this._processSlots()
1978
+ }
1979
+ `:`
1980
+ _render() {
1981
+ ${E?"this.shadowRoot.innerHTML":"this.innerHTML"} = \`${F}${B}\`
1982
+ this._processSlots()
1983
+ }
1984
+ `}
1985
+
1986
+ _processSlots() {
1987
+ ${E?`// Shadow DOM handles slot assignment automatically
1988
+ // Listen for slot changes if needed
1989
+ const slots = this.shadowRoot.querySelectorAll('slot')
1990
+ slots.forEach(slot => {
1991
+ slot.addEventListener('slotchange', (e) => {
1992
+ const assignedNodes = slot.assignedNodes()
1993
+ this.dispatchEvent(new CustomEvent('slot-changed', {
1994
+ detail: { slotName: slot.name || 'default', assignedNodes }
1995
+ }))
1996
+ })
1997
+ })`:`// Manual slot processing for non-shadow DOM mode
1998
+ const slots = this.querySelectorAll('[data-slot]')
1999
+
2000
+ // Process named slots
2001
+ slots.forEach(slotEl => {
2002
+ const slotName = slotEl.getAttribute('data-slot')
2003
+ const slottedContent = this._slotContent.filter(
2004
+ node => node.nodeType === Node.ELEMENT_NODE && node.getAttribute('slot') === slotName
2005
+ )
2006
+ if (slottedContent.length > 0) {
2007
+ slotEl.innerHTML = ''
2008
+ slottedContent.forEach(content => slotEl.appendChild(content))
2009
+ }
2010
+ })
2011
+
2012
+ // Process default slot
2013
+ const defaultSlot = this.querySelector('[data-slot=""]') || this.querySelector('[data-default-slot]')
2014
+ if (defaultSlot) {
2015
+ const unslottedContent = this._slotContent.filter(
2016
+ node => node.nodeType !== Node.ELEMENT_NODE || !node.hasAttribute('slot')
2017
+ )
2018
+ if (unslottedContent.length > 0) {
2019
+ defaultSlot.innerHTML = ''
2020
+ unslottedContent.forEach(content => defaultSlot.appendChild(content))
2021
+ }
2022
+ }`}
2023
+ }
2024
+
2025
+ ${L.length>0?`
2026
+ static get observedAttributes() {
2027
+ return [${L.map((U)=>`'${U}'`).join(", ")}]
2028
+ }
2029
+
2030
+ attributeChangedCallback(name, oldValue, newValue) {
2031
+ if (oldValue !== newValue) {
2032
+ this[name] = newValue
2033
+ ${C?"":"if (this._initialized) this._render()"}
2034
+ }
2035
+ }
2036
+ `:""}
2037
+
2038
+ connectedCallback() {
2039
+ if (this._initialized) return
2040
+ ${E?"":"this._slotContent = Array.from(this.childNodes)"}
2041
+ this._initialized = true
2042
+ ${C?"this._createTemplate()":"this._render()"}
2043
+ }
2044
+
2045
+ disconnectedCallback() {
2046
+ // Component removed from the DOM
2047
+ }
2048
+ }
2049
+
2050
+ // Register the web component
2051
+ customElements.define('${x}', ${o.replace(/\W/g,"")})
2052
+ `}function wm(e){let{name:o,tag:x,baseElement:v="HTMLElement",source:k,shadowDOM:E,template:C,styleSource:j,attributes:L=[],attributeTypes:B={}}=e,F=o.replace(/\W/g,""),U=k.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").trim();if(!E)U=U.replace(/<slot\s+name=["']([^"']+)["']\s*>([\s\S]*?)<\/slot>/gi,'<div data-slot="$1">$2</div>'),U=U.replace(/<slot\s+name=["']([^"']+)["']\s*\/>/gi,'<div data-slot="$1"></div>'),U=U.replace(/<slot\s*>([\s\S]*?)<\/slot>/gi,"<div data-default-slot>$1</div>"),U=U.replace(/<slot\s*\/>/gi,"<div data-default-slot></div>");U=U.replace(/`/g,"\\`").replace(/\$\{/g,"\\${");let Z=j?`<link rel="stylesheet" href="${j}">`:"",Y=(me)=>{switch(B[me]){case"number":return"number";case"boolean":return"boolean";case"object":return"Record<string, unknown>";default:return"string"}},Q=(me)=>me.replace(/-([a-z])/g,(he,Se)=>Se.toUpperCase()),se=L.map((me)=>` private _${Q(me)}: ${Y(me)} | null = null;`).join(`
2053
+ `),oe=L.map((me)=>{let he=Y(me),Se=Q(me);return`
2054
+ get ${Se}(): ${he} | null {
2055
+ return this._${Se};
2056
+ }
2057
+
2058
+ set ${Se}(value: ${he} | null) {
2059
+ this._${Se} = value;
2060
+ if (value !== null) {
2061
+ this.setAttribute('${me}', String(value));
2062
+ }
2063
+ else {
2064
+ this.removeAttribute('${me}');
2065
+ }
2066
+ }`}).join(`
2067
+ `),ie=L.length>0?`/**
2068
+ * Props interface for ${o}
2069
+ */
2070
+ export interface ${F}Props {
2071
+ ${L.map((me)=>{let he=Y(me);return` ${Q(me)}?: ${he};`}).join(`
2072
+ `)}
2073
+ }
2074
+ `:"",ce=L.length>0?`
2075
+ static get observedAttributes(): string[] {
2076
+ return [${L.map((me)=>`'${me}'`).join(", ")}];
2077
+ }
2078
+
2079
+ attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void {
2080
+ if (oldValue !== newValue) {
2081
+ const camelCase = name.replace(/-([a-z])/g, (_: string, letter: string) => letter.toUpperCase());
2082
+ (this as unknown as Record<string, unknown>)[\`_\${camelCase}\`] = this._parseAttributeValue(name, newValue);
2083
+ ${C?"":"if (this._initialized) this._render();"}
2084
+ }
2085
+ }
2086
+
2087
+ private _parseAttributeValue(name: string, value: string | null): unknown {
2088
+ if (value === null) return null;
2089
+ const typeMap: Record<string, string> = ${JSON.stringify(B)};
2090
+ const type = typeMap[name] || 'string';
2091
+ switch (type) {
2092
+ case 'number': return Number(value);
2093
+ case 'boolean': return value !== 'false' && value !== '0';
2094
+ case 'object': try { return JSON.parse(value); }
2095
+ catch { return value; }
2096
+ default: return value;
2097
+ }
2098
+ }
2099
+ `:"",ae=C?`
2100
+ private _createTemplate(): void {
2101
+ const template = document.createElement('template');
2102
+ template.innerHTML = \`${Z}${U}\`;
2103
+ ${E?"this.shadowRoot!.appendChild(template.content.cloneNode(true));":"this.appendChild(template.content.cloneNode(true));"}
2104
+ this._processSlots();
2105
+ }`:`
2106
+ private _render(): void {
2107
+ ${E?"this.shadowRoot!.innerHTML":"this.innerHTML"} = \`${Z}${U}\`;
2108
+ this._processSlots();
2109
+ }`;return`/**
2110
+ * ${o} Web Component
2111
+ * Auto-generated from stx component (TypeScript)
2112
+ *
2113
+ * @example
2114
+ * \`\`\`html
2115
+ * <${x}></${x}>
2116
+ * \`\`\`
2117
+ */
2118
+
2119
+ /**
2120
+ * Detail type for slot-changed event
2121
+ */
2122
+ interface SlotChangeDetail {
2123
+ slotName: string;
2124
+ assignedNodes: Node[];
2125
+ }
2126
+
2127
+ ${ie}
2128
+ /**
2129
+ * ${o} custom element class
2130
+ * @customElement ${x}
2131
+ */
2132
+ export class ${F} extends ${v} {
2133
+ ${se}
2134
+ private _initialized = false;
2135
+ ${E?"":"private _slotContent: Node[] = [];"}
2136
+
2137
+ constructor() {
2138
+ super();
2139
+ ${E?'this.attachShadow({ mode: "open" });':""}
2140
+ }
2141
+ ${ae}
2142
+ ${E?`
2143
+ private _processSlots(): void {
2144
+ const slots = this.shadowRoot!.querySelectorAll('slot');
2145
+ slots.forEach((slot) => {
2146
+ slot.addEventListener('slotchange', () => {
2147
+ const assignedNodes = (slot as HTMLSlotElement).assignedNodes();
2148
+ this.dispatchEvent(new CustomEvent<SlotChangeDetail>('slot-changed', {
2149
+ detail: { slotName: slot.getAttribute('name') || 'default', assignedNodes }
2150
+ }));
2151
+ });
2152
+ });
2153
+ }`:`
2154
+ private _processSlots(): void {
2155
+ const slots = this.querySelectorAll('[data-slot]');
2156
+ slots.forEach((slotEl) => {
2157
+ const slotName = slotEl.getAttribute('data-slot');
2158
+ if (slotName) {
2159
+ const slottedContent = this._slotContent.filter(
2160
+ node => node.nodeType === Node.ELEMENT_NODE && (node as Element).getAttribute('slot') === slotName
2161
+ );
2162
+ if (slottedContent.length > 0) {
2163
+ slotEl.innerHTML = '';
2164
+ slottedContent.forEach(content => slotEl.appendChild(content));
2165
+ }
2166
+ }
2167
+ });
2168
+ const defaultSlot = this.querySelector('[data-slot=""]') || this.querySelector('[data-default-slot]');
2169
+ if (defaultSlot) {
2170
+ const unslottedContent = this._slotContent.filter(
2171
+ node => node.nodeType !== Node.ELEMENT_NODE || !(node as Element).hasAttribute('slot')
2172
+ );
2173
+ if (unslottedContent.length > 0) {
2174
+ defaultSlot.innerHTML = '';
2175
+ unslottedContent.forEach(content => defaultSlot.appendChild(content));
2176
+ }
2177
+ }
2178
+ }`}
2179
+ ${ce}
2180
+ ${oe}
2181
+
2182
+ connectedCallback(): void {
2183
+ if (this._initialized) return;
2184
+ ${E?"":"this._slotContent = Array.from(this.childNodes);"}
2185
+ this._initialized = true;
2186
+ ${C?"this._createTemplate();":"this._render();"}
2187
+ }
2188
+
2189
+ disconnectedCallback(): void {
2190
+ // Component removed from the DOM
2191
+ }
2192
+
2193
+ adoptedCallback(): void {
2194
+ // Component moved to a new document
2195
+ }
2196
+ }
2197
+
2198
+ // Type augmentation for HTMLElementTagNameMap
2199
+ declare global {
2200
+ interface HTMLElementTagNameMap {
2201
+ '${x}': ${F};
2202
+ }
2203
+ }
2204
+
2205
+ // Register the web component
2206
+ customElements.define('${x}', ${F});
2207
+ `}function $m(e,o){let x=e.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),v=x?x[1].trim():"",k=o,E=[],C=!0;if(v){let U=v.match(/export\s+default\s+({[\s\S]*})/);if(U)try{let Z=U[1],Y=Z.match(/tag\s*:\s*['"`]([^'"`]+)['"`]/);if(Y)k=Y[1];let Q=Z.match(/props\s*:\s*\[([\s\S]*?)\]/);if(Q)E=Q[1].split(",").map((oe)=>oe.trim().replace(/['"`]/g,"")).filter((oe)=>oe.length>0);let se=Z.match(/shadowDOM\s*:\s*(true|false)/);if(se)C=se[1]==="true"}catch{}}let j=e.match(/<template\b(?![^>]*\bid\s*=)[^>]*>([\s\S]*?)<\/template>/i),L=j?j[1].trim():"",B=e.match(/<style\b[^>]*>([\s\S]*?)<\/style>/i),F=B?B[1].trim():"";return{tag:k,props:E,template:L,styles:F,script:v,shadowDOM:C}}function Sm(e){let{tag:o,props:x,template:v,styles:k,shadowDOM:E}=e,C=o.split("-").map((U)=>U.charAt(0).toUpperCase()+U.slice(1)).join(""),j=v.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\$\{/g,"\\${"),L=k.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),B=x.map((U)=>`'${U}'`).join(", "),F=x.map((U)=>`
2208
+ get ${U}() {
2209
+ return this.getAttribute('${U}') || '';
2210
+ }
2211
+ set ${U}(value) {
2212
+ if (value) {
2213
+ this.setAttribute('${U}', value);
2214
+ }
2215
+ else {
2216
+ this.removeAttribute('${U}');
2217
+ }
2218
+ }`).join(`
2219
+ `);return`/**
2220
+ * ${C} Web Component
2221
+ * Auto-generated from SFC
2222
+ */
2223
+ class ${C} extends HTMLElement {
2224
+ constructor() {
2225
+ super();
2226
+ ${E?"this.attachShadow({ mode: 'open' });":""}
2227
+ this._render();
2228
+ }
2229
+
2230
+ static get observedAttributes() {
2231
+ return [${B}];
2232
+ }
2233
+
2234
+ attributeChangedCallback(name, oldValue, newValue) {
2235
+ if (oldValue !== newValue) {
2236
+ this._render();
2237
+ }
2238
+ }
2239
+ ${F}
2240
+
2241
+ _render() {
2242
+ const template = \`${L?`<style>${L}</style>`:""}${j}\`;
2243
+
2244
+ // Interpolate {{ prop }} with attribute values
2245
+ const rendered = template.replace(/\\{\\{\\s*(\\w+)\\s*\\}\\}/g, (match, prop) => {
2246
+ return this.getAttribute(prop) || '';
2247
+ });
2248
+
2249
+ ${E?"this.shadowRoot.innerHTML = rendered;":"this.innerHTML = rendered;"}
2250
+ }
2251
+
2252
+ connectedCallback() {
2253
+ this._render();
2254
+ }
2255
+ }
2256
+
2257
+ customElements.define('${o}', ${C});
2258
+ `}async function iu(e,o,x,v){if(o.length<1)return a("WebComponent","@webcomponent directive requires at least the tag name parameter",t.INVALID_DIRECTIVE_SYNTAX);let k=o[0].replace(/['"]/g,""),C=(x.__stx_options||{}).componentsDir||"components",j=ln.isAbsolute(C)?[ln.join(C,`${k}.stx`),ln.join(ln.dirname(v),`${k}.stx`)]:[ln.join(ln.dirname(v),C,`${k}.stx`),ln.join(process.cwd(),C,`${k}.stx`),ln.join(ln.dirname(v),`${k}.stx`)],L=null;for(let U of j)if(await n(U)){L=await Bun.file(U).text();break}if(!L)return a("WebComponent",`Component file not found: ${k}.stx`,t.FILE_NOT_FOUND);let B=$m(L,k);return`<script type="module">
2259
+ ${Sm(B)}
2260
+ </script>`}var A={enabled:!0,ssr:!1,partialsDir:"partials",componentsDir:"components",layoutsDir:"layouts",defaultLayout:"default",debug:!1,cache:!0,stateDir:_t,cachePath:".stx/cache",cacheVersion:"1.0.0",componentRenderCacheBytes:33554432,build:{pagesDir:"pages",outputDir:"dist",baseUrl:"/",sitemap:!0,minify:!0,cache:!0,cacheDir:".stx/ssg-cache",concurrency:10,generate404:!0,publicDir:"public",trailingSlash:!1,cleanOutput:!0},customDirectives:[{name:"markdown",handler:Wl,hasEndTag:!0,description:"Render markdown content to HTML"},{name:"webcomponent",handler:iu,hasEndTag:!1,description:"Include a web component in the template"},lo,uo,er,tr,Rl,Tl,Il,Al,Ll,Cl,Jl,ta,...dr],middleware:[],i18n:{defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},webComponents:{enabled:!1,outputDir:"dist/web-components",components:[]},docs:{enabled:!1,outputDir:"docs",format:"markdown",components:!0,templates:!0,directives:!0},streaming:{enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},hydration:{enabled:!1,mode:"islands",clientEntry:"src/client.ts",autoMarkers:!0,preload:"lazy"},router:{enabled:!0,container:"main",linkSelector:"a[href]",viewTransitions:!0,scrollToTop:!0,scrollRestoration:!0,prefetch:!0,cache:!0,cacheTTL:300000,skipSelectors:'[data-no-router], [target="_blank"]',viewTransitionCSS:{oldRoot:"fade-out 0.15s ease-in",newRoot:"fade-in 0.2s ease-out",oldContent:"slide-out 0.2s ease-in",newContent:"slide-in 0.25s ease-out"}},a11y:{enabled:!0,addSrOnlyStyles:!0,level:"AA",autoFix:!1,ignoreChecks:[]},seo:{enabled:!0,socialPreview:!0,defaultConfig:{title:"stx Project",description:"A website built with stx templating engine"}},animation:{enabled:!0,defaultDuration:300,defaultEase:"ease",respectMotionPreferences:!0,staggerDelay:50},markdown:{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0,additionalThemes:["light-plus","one-dark-pro","dracula","monokai","solarized-light","nord","github-dark"]}},loops:{maxWhileIterations:1000,useAltLoopVariable:!1},story:{enabled:!0,outDir:".stx/dist/story",storyMatch:["**/*.story.stx"],storyIgnored:["**/node_modules/**","**/dist/**","**/.stx/**"],port:6006},pwa:{enabled:!1,manifest:{name:"stx App",shortName:"stx",description:"A Progressive Web App built with stx",startUrl:"/",display:"standalone",orientation:"any",themeColor:"#000000",backgroundColor:"#ffffff",scope:"/"},icons:{src:"public/icon.png",sizes:[72,96,128,144,152,192,384,512],generateWebP:!0,generateAppleIcons:!0,outputDir:"pwa-icons",purpose:["any","maskable"]},routes:[{pattern:"/",strategy:"network-first"},{pattern:"/static/*",strategy:"cache-first",maxAgeSeconds:2592000},{pattern:"/api/*",strategy:"network-only"},{pattern:"*.js",strategy:"stale-while-revalidate"},{pattern:"*.css",strategy:"stale-while-revalidate"},{pattern:"*.png",strategy:"cache-first"},{pattern:"*.jpg",strategy:"cache-first"},{pattern:"*.webp",strategy:"cache-first"},{pattern:"*.svg",strategy:"cache-first"}],offline:{enabled:!0,fallbackTitle:"You are offline",fallbackMessage:"Please check your internet connection and try again.",precacheAssets:[]},serviceWorker:{fileName:"sw.js",cacheVersion:"1.0.0",skipWaiting:!0,clientsClaim:!0,navigationPreload:!1,excludeRoutes:["/api/auth/*"],cacheFileTypes:["html","css","js","png","jpg","jpeg","webp","svg","woff","woff2"],useWorkbox:!1},autoInject:!0,push:{enabled:!1,defaultOptions:{vibrate:[100,50,100],requireInteraction:!1}},backgroundSync:{enabled:!1,queueName:"stx-sync-queue",maxRetentionMinutes:1440,maxRetries:3,minInterval:1000,forms:[],endpoints:[]},shareTarget:{enabled:!1,action:"/share-target",method:"POST",enctype:"multipart/form-data",params:{title:"title",text:"text",url:"url"}},fileHandlers:{enabled:!1},protocolHandlers:[],cacheStorage:{maxSize:100,maxEntries:500,maxAge:30,purgeStrategy:"lru"},updates:{enabled:!0,promptUser:!0,autoReload:!1,message:"A new version is available. Reload to update?"},precache:{enabled:!0,includeHtml:!0,includeJs:!0,includeCss:!0,includeImages:!0,includeFonts:!0,include:[],exclude:["*.map","*.LICENSE.txt"],maxFileSizeKB:500}},media:{enabled:!0,image:{enabled:!0,defaultWidths:[320,480,640,768,1024,1280,1536,1920],defaultFormats:["avif","webp","jpeg"],defaultQuality:80,placeholderStrategy:"thumbhash",lazyByDefault:!0,enableDpr:!0,defaultDpr:[1,2,3],tsImages:{enabled:!0,outputDir:"dist/images",baseUrl:"/images",formatQuality:{jpeg:{quality:85,mozjpeg:!0,progressive:!0},png:{compressionLevel:9,palette:!1},webp:{quality:82,effort:5,smartSubsample:!0},avif:{quality:75,effort:4,lossless:!1}},breakpoints:[320,480,640,768,1024,1280,1536,1920],batchOptions:{concurrency:4,optimizationPreset:"web"}}},video:{enabled:!0,lazyByDefault:!0,defaultControls:!0,tsVideos:{enabled:!0,outputDir:"dist/videos",baseUrl:"/videos",defaultQuality:"high",streaming:{enabled:!0,format:"hls",segmentDuration:6,defaultQualities:[{label:"1080p",width:1920,height:1080,bitrate:5000000,audioBitrate:192000},{label:"720p",width:1280,height:720,bitrate:2500000,audioBitrate:128000},{label:"480p",width:854,height:480,bitrate:1e6,audioBitrate:96000}]},thumbnails:{enabled:!0,count:10,format:"webp",width:320},transcoding:{defaultCodec:"h264",defaultAudioCodec:"aac",speedPreset:"medium"}}},upload:{enabled:!0,maxSize:10485760,allowedTypes:["image/*","video/*","audio/*","application/pdf"],maxConcurrent:3},protected:{enabled:!0,expirationSeconds:3600,batchSize:10},cache:{enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500}},broadcasting:{enabled:!1,driver:"bun",host:"0.0.0.0",port:6001,scheme:"ws",verbose:!1}};function Em(e,o,x){let v=o||"pages";if(e)return{root:e,pagesDir:v};let k=x||process.cwd(),E=Yt.join(k,"resources","views"),C=Yt.join(k,"resources","layouts");if(si.existsSync(E)&&si.existsSync(C))return{root:"resources",pagesDir:"views"};let j=Yt.join(k,"resources","views","pages");if(si.existsSync(j))return{root:"resources/views",pagesDir:v};return{root:".",pagesDir:v}}var ou=new Set,ii=["partialsDir","componentsDir","layoutsDir"],na=new WeakMap;function km(e,o){let x=o.replace(/[\\/]+$/,"");if(!x||x===".")return!0;let v=e.replace(/\\/g,"/"),k=x.replace(/\\/g,"/");return v===k||v.startsWith(`${k}/`)}function Sc(e,o){let x=!e.root,v=Em(e.root,e.pagesDir,o);if(e.root=v.root,e.pagesDir=v.pagesDir,x&&v.root!=="."){let k=`${o}::${v.root}`;if(!ou.has(k))ou.add(k),console.warn(`[stx] No "root" in config \u2014 inferred "${v.root}" from the project layout. Template directories are resolved under it; set root explicitly to pin this.`)}if(!na.has(e)){let k={};for(let E of ii){let C=e[E];if(typeof C==="string"&&C)k[E]=C}na.set(e,k)}if(e.root&&e.root!=="."){let k=e.root;for(let E of ii){let C=e[E];if(typeof C!=="string"||!C)continue;if(Yt.isAbsolute(C)||km(C,k))continue;e[E]=Yt.join(k,C)}}for(let k of ii){let E=e[k];if(typeof E!=="string"||!E||Yt.isAbsolute(E))continue;e[k]=Yt.resolve(o,E)}return e}function Cm(e,o){let x=na.get(e);for(let v of ii){let k=e[v];if(typeof k!=="string"||!k)continue;let E=Yt.isAbsolute(k)?k:Yt.join(o,k);if(si.existsSync(E))continue;let C=x?.[v]??k,j=e.root,L=!!j&&j!==".";console.warn(`[stx] ${String(v)} resolves to "${E}", which does not exist. Configured as "${C}"`+(L?`, resolved under root "${j}".`:"."))}}function Rm(e){if(e.customDirectives)e.customDirectives=[...e.customDirectives];if(e.middleware)e.middleware=[...e.middleware];if(e.apiRoutes)e.apiRoutes={...e.apiRoutes}}function Am(e){if(xo(e.stateDir),e.stateDir=un(),e.cachePath=dn(e.cachePath),e.build)e.build.cacheDir=dn(e.build.cacheDir);if(e.media?.cache)e.media.cache.directory=dn(e.media.cache.directory);if(e.story)e.story.outDir=dn(e.story.outDir)}var Dn=null,rr=new Map,ri=new Map,Wr=null;async function i(e){let o=e?Yt.resolve(e):process.cwd(),x=ri.get(o);if(x&&x.signature!==Gn(x.graph)){let E=rr.get(o);if(rr.delete(o),ri.delete(o),!e)Dn=null,Wr=null;let{clearComponentCache:C}=await import("./chunk-hhnw2sn3.js"),{partialsCache:j}=await import("./chunk-0pnj3zt2.js");if(C(),j.clear(),E&&x.configSignature===Jn(x.graph)){let L=E.then(async(B)=>{let F={...x.graph};await ws(F,o),ri.set(o,{graph:F,signature:Gn(F),configSignature:Jn(F)});let U={...B,_layerGraph:F};if(!e)Dn=U;return U});return rr.set(o,L),L}}if(!e){if(Dn)return Dn;if(Wr)return Wr}let v=rr.get(o);if(v)return v;let k=(async()=>{let C=(await _m({name:"stx",alias:"ui",cwd:o,defaultConfig:A,verbose:!1})).config;if(C.extends!==void 0||x){let F=await go(o,A);C=F.config,ri.set(o,{graph:F.graph,signature:Gn(F.graph),configSignature:Jn(F.graph)})}if(C.runtimeConfig){let{resolveRuntimeConfig:F}=await import("./chunk-hjg3ndgh.js");F(C.runtimeConfig,{});let{generateRuntimeConfigTypes:U}=await import("./chunk-jp10q90g.js");await U(o,C.runtimeConfig)}Rm(C),Am(C),Sc(C,o),Cm(C,o);let j=[],L=new Set((C.plugins??[]).map((F)=>typeof F==="string"?F:F[0]));for(let F of C.componentPackages??["@stacksjs/components"]){let U=`${F}/stx-plugin`;if(L.has(U)||L.has(F))continue;try{u.resolve(U,{paths:[o]}),j.push(U)}catch{}}let B=[...C.plugins??[],...j];if(B.length>0){let{pluginManager:F}=await import("./chunk-1098mas0.js"),U=[],Z=[];for(let Y of B){let Q=typeof Y==="string"?Y:Y[0],se=typeof Y==="string"?{}:Y[1]||{};try{let oe,ie;try{let ae=u.resolve(Q,{paths:[o]});oe=await import(ae),ie=Yt.dirname(ae)}catch{let ae=Yt.resolve(o,Q);oe=await import(ae),ie=Yt.dirname(ae)}let ce=oe.default||oe;if(!F.has(ce.name))await F.register(ce,C);if(ce.components){let ae=Array.isArray(ce.components)?ce.components:[ce.components];for(let pe of ae)U.push(Yt.resolve(ie,pe))}if(ce.pages){let ae=Yt.resolve(ie,ce.pages),pe=se.path||"/";Z.push({dir:ae,prefix:pe})}if(ce.setup){let ae={addDirective:(pe)=>{C.customDirectives=C.customDirectives||[],C.customDirectives.push(pe)},addRoute:(pe,me)=>{C.apiRoutes=C.apiRoutes||{},C.apiRoutes[pe]=me},addMiddleware:(pe)=>{C.middleware=C.middleware||[],C.middleware.push(pe)},pluginDir:ie,config:C};await ce.setup(se,ae)}console.log(`[stx] Plugin loaded: ${ce.name||Q}`)}catch(oe){console.warn(`[stx] Failed to load plugin ${Q}:`,oe.message)}}C._pluginComponentDirs=U,C._pluginPageDirs=Z}return C})();if(rr.set(o,k),k.catch(()=>{if(rr.get(o)===k)rr.delete(o)}),!e)Wr=k,k.then((E)=>{Dn=E}).catch(()=>{});return k}var T=new Proxy(A,{get(e,o){if(Dn&&o in Dn)return Dn[o];if(!Wr)i().catch((x)=>{console.warn("[stx] Failed to load config file:",x?.message||x)});return e[o]}});function Bu(e){return e}function Fu(e){let o=[],x=[];if(e.partialsDir!==void 0&&typeof e.partialsDir!=="string")o.push({path:"partialsDir",message:"partialsDir must be a string",severity:"error"});if(e.componentsDir!==void 0&&typeof e.componentsDir!=="string")o.push({path:"componentsDir",message:"componentsDir must be a string",severity:"error"});if(e.cache!==void 0&&typeof e.cache!=="boolean")o.push({path:"cache",message:"cache must be a boolean",severity:"error"});if(e.debug!==void 0&&typeof e.debug!=="boolean")o.push({path:"debug",message:"debug must be a boolean",severity:"error"});if(e.streaming){if(e.streaming.bufferSize!==void 0){if(typeof e.streaming.bufferSize!=="number"||e.streaming.bufferSize<=0)o.push({path:"streaming.bufferSize",message:"streaming.bufferSize must be a positive number",severity:"error"})}if(e.streaming.timeout!==void 0){if(typeof e.streaming.timeout!=="number"||e.streaming.timeout<=0)o.push({path:"streaming.timeout",message:"streaming.timeout must be a positive number",severity:"error"})}if(e.streaming.strategy!==void 0){let v=["auto","manual","sections"];if(!v.includes(e.streaming.strategy))o.push({path:"streaming.strategy",message:`streaming.strategy must be one of: ${v.join(", ")}`,severity:"error"})}}if(e.i18n){if(e.i18n.format!==void 0){let v=["json","yaml","yml","js"];if(!v.includes(e.i18n.format))o.push({path:"i18n.format",message:`i18n.format must be one of: ${v.join(", ")}`,severity:"error"})}}if(e.animation){if(e.animation.defaultDuration!==void 0){if(typeof e.animation.defaultDuration!=="number"||e.animation.defaultDuration<0)o.push({path:"animation.defaultDuration",message:"animation.defaultDuration must be a non-negative number",severity:"error"})}if(e.animation.staggerDelay!==void 0){if(typeof e.animation.staggerDelay!=="number"||e.animation.staggerDelay<0)o.push({path:"animation.staggerDelay",message:"animation.staggerDelay must be a non-negative number",severity:"error"})}}if(e.a11y){if(e.a11y.level!==void 0){let v=["AA","AAA"];if(!v.includes(e.a11y.level))o.push({path:"a11y.level",message:`a11y.level must be one of: ${v.join(", ")}`,severity:"error"})}}if(e.hydration){if(e.hydration.mode!==void 0){let v=["progressive","islands"];if(!v.includes(e.hydration.mode))o.push({path:"hydration.mode",message:`hydration.mode must be one of: ${v.join(", ")}`,severity:"error"})}if(e.hydration.preload!==void 0){let v=["none","eager","lazy"];if(!v.includes(e.hydration.preload))o.push({path:"hydration.preload",message:`hydration.preload must be one of: ${v.join(", ")}`,severity:"error"})}}if(e.customDirectives)if(!Array.isArray(e.customDirectives))o.push({path:"customDirectives",message:"customDirectives must be an array",severity:"error"});else e.customDirectives.forEach((v,k)=>{if(!v.name||typeof v.name!=="string")o.push({path:`customDirectives[${k}].name`,message:"Custom directive must have a name string",severity:"error"});if(!v.handler||typeof v.handler!=="function")o.push({path:`customDirectives[${k}].handler`,message:"Custom directive must have a handler function",severity:"error"})});if(e.middleware)if(!Array.isArray(e.middleware))o.push({path:"middleware",message:"middleware must be an array",severity:"error"});else e.middleware.forEach((v,k)=>{if(!v.name||typeof v.name!=="string")o.push({path:`middleware[${k}].name`,message:"Middleware must have a name string",severity:"error"});if(!v.handler||typeof v.handler!=="function")o.push({path:`middleware[${k}].handler`,message:"Middleware must have a handler function",severity:"error"});if(!v.timing||!["before","after"].includes(v.timing))o.push({path:`middleware[${k}].timing`,message:'Middleware timing must be "before" or "after"',severity:"error"})});if(e.debug===!0&&e.cache===!0)x.push({path:"debug+cache",message:"Debug mode with caching enabled may show stale content during development",severity:"warning"});if(e.seo?.enabled===!0&&!e.seo?.defaultConfig?.title)x.push({path:"seo.defaultConfig.title",message:"SEO is enabled but no default title is set",severity:"warning"});if(e.pwa){if(e.pwa.enabled===!0&&!e.pwa.manifest?.name)o.push({path:"pwa.manifest.name",message:"PWA manifest name is required when PWA is enabled",severity:"error"});if(e.pwa.manifest?.display!==void 0){let v=["fullscreen","standalone","minimal-ui","browser"];if(!v.includes(e.pwa.manifest.display))o.push({path:"pwa.manifest.display",message:`PWA display must be one of: ${v.join(", ")}`,severity:"error"})}if(e.pwa.manifest?.orientation!==void 0){let v=["portrait","landscape","any","portrait-primary","portrait-secondary","landscape-primary","landscape-secondary"];if(!v.includes(e.pwa.manifest.orientation))o.push({path:"pwa.manifest.orientation",message:`PWA orientation must be one of: ${v.join(", ")}`,severity:"error"})}if(e.pwa.routes){let v=["cache-first","network-first","stale-while-revalidate","network-only","cache-only"];e.pwa.routes.forEach((k,E)=>{if(!k.pattern||typeof k.pattern!=="string")o.push({path:`pwa.routes[${E}].pattern`,message:"PWA route must have a pattern string",severity:"error"});if(!v.includes(k.strategy))o.push({path:`pwa.routes[${E}].strategy`,message:`PWA route strategy must be one of: ${v.join(", ")}`,severity:"error"});if(k.maxAgeSeconds!==void 0&&(typeof k.maxAgeSeconds!=="number"||k.maxAgeSeconds<0))o.push({path:`pwa.routes[${E}].maxAgeSeconds`,message:"PWA route maxAgeSeconds must be a non-negative number",severity:"error"});if(k.maxEntries!==void 0&&(typeof k.maxEntries!=="number"||k.maxEntries<1))o.push({path:`pwa.routes[${E}].maxEntries`,message:"PWA route maxEntries must be a positive number",severity:"error"})})}if(e.pwa.icons?.sizes){if(!Array.isArray(e.pwa.icons.sizes))o.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be an array of numbers",severity:"error"});else if(e.pwa.icons.sizes.filter((k)=>typeof k!=="number"||k<16||k>1024).length>0)o.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be numbers between 16 and 1024",severity:"error"})}if(e.pwa.icons?.purpose){let v=["any","maskable","monochrome"];if(e.pwa.icons.purpose.filter((E)=>!v.includes(E)).length>0)o.push({path:"pwa.icons.purpose",message:`PWA icon purpose must be one of: ${v.join(", ")}`,severity:"error"})}if(e.pwa.enabled===!0&&!e.pwa.icons?.src)x.push({path:"pwa.icons.src",message:"PWA is enabled but no icon source specified. Provide a 512x512 PNG for best results.",severity:"warning"});if(e.pwa.enabled===!0&&!e.pwa.manifest?.themeColor)x.push({path:"pwa.manifest.themeColor",message:"PWA theme color not set, defaulting to black",severity:"warning"})}return{valid:o.length===0,errors:o,warnings:x}}var sa=new Map;async function ue(e,o={}){try{if(!await n(e))throw Error(`Markdown file not found: ${e}`);let v=(await Tm.promises.stat(e)).mtime.getTime();if(o.cache&&sa.has(e)){let U=sa.get(e);if(U.updatedAt>=v)return{content:U.content,data:U.data}}let k=await Bun.file(e).text(),{data:E,content:C}=Nn(k),j=o.markdown||T.markdown||{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0}},B=Ne(C,{gfm:!0});if(j.syntaxHighlighting?.enabled&&j.syntaxHighlighting?.serverSide)B=await Dm(B,j.syntaxHighlighting?.defaultTheme||"github-dark",j.syntaxHighlighting?.highlightUnknownLanguages||!1);let F={content:B,data:E||{}};if(o.cache)sa.set(e,{...F,updatedAt:v});return F}catch(x){if(o.debug)console.error(`Error reading/parsing markdown file ${e}:`,x);let v=x instanceof Error?x.message:String(x);return{content:g("Markdown File",`Error reading/parsing markdown file: ${v}`,e,"",0,""),data:{}}}}var oi=null;async function Dm(e,o,x){let v=/<pre><code( class="language-([^"]+)")?>([^<]+)<\/code><\/pre>/g;if(!oi)try{oi=await Im({theme:o||"github-dark",cache:!0})}catch(j){return console.error("Failed to initialize ts-syntax-highlighter:",j),e}let k=async(j,L,B,F)=>{let U=F.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&").replace(/&quot;/g,'"').replace(/&#39;/g,"'"),Z=B||(x?"text":"");if(!Z)return j;try{if(!oi.getSupportedLanguages().includes(Z))return j;return(await oi.highlight(U,Z,{theme:o})).html}catch(Y){console.error(`Error highlighting code block with language ${B}:`,Y)}return j},E=e,C=e.matchAll(v);for(let j of C){let[L,B,F,U]=j,Z=await k(L,B,F,U);E=E.replace(L,Z)}return E}async function au(e,o,x="",v={}){return await Pm(e,/@markdown-file\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\}))?\)/g,async(C,j,L,B)=>{try{let F=j;if(!ra.isAbsolute(j))F=ra.resolve(ra.dirname(x),j);let U={};if(L)try{try{U=JSON.parse(L)}catch{if(v.debug)console.warn("Using safer alternative for parsing JS object literal");let ce=L.replace(/^\s*\{|\}\s*$/g,"").trim().split(/,(?=\s*\w+\s*:)/);for(let ae of ce){let pe=ae.indexOf(":");if(pe>0){let me=ae.substring(0,pe).trim(),he=ae.substring(pe+1).trim(),Se=he.startsWith('"')&&he.endsWith('"'),Ee=he.startsWith("'")&&he.endsWith("'");if(Se||Ee)he=he.substring(1,he.length-1);U[me]=he}}}}catch(ie){if(v.debug)console.error("Error parsing context in @markdown-file directive:",ie)}let{content:Z,data:Y}=await ue(F,v),Q={...o,...Y,...U},se=Z,oe=/\{\{([^}]+)\}\}/g;return se=se.replace(oe,(ie,ce)=>{let ae=ce.trim();return Q[ae]!==void 0?String(Q[ae]):ie}),se}catch(F){let U=F instanceof Error?F.message:String(F);return g("Markdown File",`Error including markdown file: ${U}`,x,e,B,C)}})}async function Pm(e,o,x){let v=[],k;while((k=o.exec(e))!==null){let j=k[0],L=k.index,B=k;v.push(x(...B).then((F)=>({match:j,replacement:F,index:L})))}let E=await Promise.all(v);E.sort((j,L)=>L.index-j.index);let C=e;for(let{match:j,replacement:L}of E)C=C.replace(j,()=>L);return C}function Pn(e,o){try{let x=e.trim();if(p(x))return l(x,Object.keys(o))(...Object.values(o));else return c(x,o)}catch{return!1}}function Mn(e,o){let x=Mm(e,o);return x.ok?{expression:x.expression,endPos:x.endPos}:null}function Mm(e,o){let x=o;while(x<e.length&&/\s/.test(e[x]))x++;if(e[x]!=="(")return{ok:!1,reason:"missing-open-paren",pos:x};let v=w(e,"(",")",x);if(v===-1)return{ok:!1,reason:"unclosed-paren",pos:x};return{ok:!0,expression:e.slice(x+1,v),endPos:v+1}}function Om(e,o){let x=e.lastIndexOf("<",o);if(x===-1)return!1;return x>e.lastIndexOf(">",o)}function ar(e,o,x,v){let k=1,E=v,C=new RegExp(`@${o}\\s*\\(`,"g"),j=new RegExp(`@${x}(?![a-z])`,"g");while(E<e.length&&k>0){C.lastIndex=E,j.lastIndex=E;let L=C.exec(e),B=j.exec(e),F=L?L.index:1/0,U=B?B.index:1/0;if(F<U)k++,E=F+L[0].length;else if(U<1/0){if(k--,k===0)return U;E=U+B[0].length}else break}return-1}function cu(e,o){let x=e.slice(o).match(/^@if\s*/);if(!x)return null;let v=o+x[0].length,k=Mn(e,v);if(!k)return null;let E=k.endPos,C=ar(e,"if","endif",E);if(C===-1)return null;let j=e.slice(E,C),L=[],B=0,F="if",U=k.expression,Z=0,Y=0;while(B<j.length){let Q=j.indexOf("@",B);if(Q===-1)break;B=Q;let se=j.substring(Q);if(Om(j,Q)){B++;continue}if(/^@if\s*\(/.test(se)){Y++,B++;continue}if(/^@endif(?![a-z])/.test(se)){Y--,B+=6;continue}if(Y===0){let oe=se.match(/^@elseif\s*/);if(oe){L.push({type:F,condition:U,content:j.substring(Z,B),start:E+Z,end:E+B});let ie=B+oe[0].length,ce=Mn(j,ie);if(!ce){B++;continue}F="elseif",U=ce.expression,B=ce.endPos,Z=B;continue}else if(/^@else(?![a-z])/.test(se)){L.push({type:F,condition:U,content:j.substring(Z,B),start:E+Z,end:E+B}),F="else",U=void 0,B+=5,Z=B;continue}}B++}return L.push({type:F,condition:U,content:j.slice(Z),start:E+Z,end:E+j.length}),{fullMatch:e.slice(o,C+6),branches:L,start:o,end:C+6}}function Fr(e){let o=[],x=/@if\s*\(/g,v=x.exec(e);while(v!==null){if(o.some((C)=>v.index>C.start&&v.index<C.end)){v=x.exec(e);continue}let E=cu(e,v.index);if(E)o.push(E),x.lastIndex=E.end;v=x.exec(e)}return o}function ai(e,o,x){let v=[],k=new RegExp(`@${o}\\s*\\(`,"g"),E=k.exec(e);while(E!==null){if(v.some((se)=>E.index>se.start&&E.index<se.end)){E=k.exec(e);continue}let j=E.index,L=j+E[0].length-1,B=w(e,"(",")",L);if(B===-1){E=k.exec(e);continue}let F=e.slice(L+1,B),U=B+1,Z=ar(e,o,x,U);if(Z===-1){E=k.exec(e);continue}let Y=e.slice(U,Z),Q=Z+`@${x}`.length;v.push({fullMatch:e.slice(j,Q),name:o,params:F,content:Y,start:j,end:Q}),k.lastIndex=Q,E=k.exec(e)}return v}function ia(e,o){let x=e.slice(o).match(/^@switch\s*/);if(!x)return null;let v=o+x[0].length,k=Mn(e,v);if(!k)return null;let E=k.endPos,C=ar(e,"switch","endswitch",E);if(C===-1)return null;let j=e.slice(E,C),L=[],B=0,F=null,U=0;while(B<j.length){let Z=j.slice(B),Y=Z.match(/^@switch\s*\(/),Q=Z.match(/^@endswitch(?![a-z])/);if(Y){if(U++,F)F.content+=Y[0];B+=Y[0].length;continue}if(Q){if(U--,F)F.content+=Q[0];B+=Q[0].length;continue}if(U>0){if(F)F.content+=j[B];B++;continue}let se=Z.match(/^@case\s*/),oe=Z.match(/^@default(?![a-z])/),ie=Z.match(/^@break(?![a-z])/);if(se&&Z.startsWith("@case")){if(F)L.push(F);let ce=B+se[0].length,ae=Mn(j,ce);if(!ae){B++;continue}F={type:"case",value:ae.expression,content:""},B=ae.endPos}else if(oe&&Z.startsWith("@default")){if(F)L.push(F);F={type:"default",content:""},B+=oe[0].length}else if(ie&&Z.startsWith("@break"))B+=ie[0].length;else{if(F)F.content+=j[B];B++}}if(F)L.push(F);return{fullMatch:e.slice(o,C+10),expression:k.expression,cases:L,start:o,end:C+10}}function Bm(e,o,x){let v=e,k=!0;while(k){k=!1;let E=v.match(/@switch\s*\(/);if(!E||E.index===void 0)break;let C=E.index,j=ia(v,C);if(!j)break;try{let L;if(p(j.expression))L=l(j.expression,Object.keys(o))(...Object.values(o));else L=c(j.expression,o);let B="",F=!1;for(let U of j.cases)if(U.type==="default"){if(!F)B=U.content.trim()}else try{let Z;if(U.value&&p(U.value))Z=l(U.value,Object.keys(o))(...Object.values(o));else if(U.value)Z=c(U.value,o);if(L===Z){B=U.content.trim(),F=!0;break}}catch{continue}v=v.substring(0,C)+B+v.substring(j.end),k=!0}catch(L){let B=L instanceof Error?L.message:String(L),F=a("Switch",`Error evaluating @switch expression: ${B}`,t.EVALUATION_ERROR);v=v.substring(0,C)+F+v.substring(j.end);break}}return v}function zm(e){let o=[];return{masked:e.replace(/<script\b[\s\S]*?<\/script\s*>/gi,(v)=>(o.push(v),`\x00stx-script-${o.length-1}\x00`)),scripts:o}}function Wm(e,o){if(o.length===0)return e;return e.replace(/\u0000stx-script-(\d+)\u0000/g,(x,v)=>o[Number(v)]??x)}function Cn(e,o,x){let{masked:v,scripts:k}=zm(e);return Wm(Fm(v,o,x),k)}function Fm(e,o,x){let v=e;v=Bm(v,o,x);{let E=!0;while(E){E=!1;let C=v.match(/@unless\s*\(/);if(!C||C.index===void 0)break;let j=C.index,L=Mn(v,j+7);if(!L)break;let B=L.endPos,F=ar(v,"unless","endunless",B);if(F===-1){console.warn(`[stx] @unless directive at position ${j} has no matching @endunless \u2014 the block was skipped. Check for typos or missing closers.`);break}let U=v.slice(B,F),Z=L.expression,Y=-1;{let se=0,oe=/@(?:if|unless)\s*\(/g,ie=/@(?:endif|endunless)(?![a-z])/g,ce=/@else(?![a-z])/g,ae=[],pe;while((pe=oe.exec(U))!==null)ae.push({pos:pe.index,type:"open"});while((pe=ie.exec(U))!==null)ae.push({pos:pe.index,type:"close"});while((pe=ce.exec(U))!==null)ae.push({pos:pe.index,type:"else"});ae.sort((me,he)=>me.pos-he.pos);for(let me of ae)if(me.type==="open")se++;else if(me.type==="close")se--;else if(me.type==="else"&&se===0){Y=me.pos;break}}let Q;if(Y!==-1){let se=U.slice(0,Y),oe=U.slice(Y+5);Q=`@if (${Z})${oe}@else ${se}@endif`}else Q=`@if (!(${Z}))${U}@endif`;v=v.substring(0,j)+Q+v.substring(F+10),E=!0}}v=aa(v,o,x),v=ca(v,o,x),v=oa(v,o);let k=()=>{let E=Fr(v);if(E.length===0)return!1;let C=Array(E.length);for(let B=E.length-1;B>=0;B--){let F=E[B];try{let U="",Z=!1;for(let Y of F.branches){if(Z)break;if(Y.type==="else")U=Y.content,Z=!0;else try{let Q;if(Y.condition&&p(Y.condition))Q=l(Y.condition,Object.keys(o))(...Object.values(o));else if(Y.condition)Q=c(Y.condition,o);if(Q)U=Y.content,Z=!0}catch(Q){U=a(Y.type==="if"?"If":"Elseif",`Error in @${Y.type}(${Y.condition}): ${Q instanceof Error?Q.message:String(Q)}`,t.EVALUATION_ERROR),Z=!0}}C[B]=U}catch(U){let Z=U instanceof Error?U.message:String(U);C[B]=a("If",`Error processing @if block: ${Z}`,t.EVALUATION_ERROR)}}let j=Array(E.length*2+1),L=0;for(let B=0;B<E.length;B++){let F=E[B];j[B*2]=v.slice(L,F.start),j[B*2+1]=C[B],L=F.end}return j[E.length*2]=v.slice(L),v=j.join(""),!0};while(!0){let E=v;if(!k())break;if(v===E)break}return v}function lu(e){let o=0;while(o<e.length&&/\s/.test(e[o]))o++;if(e[o]!=="(")return null;o++;while(o<e.length&&/\s/.test(e[o]))o++;let x=e[o];if(x!=="'"&&x!=='"')return null;o++;let v=[];while(o<e.length){let k=e[o];if(k==="\\"&&o+1<e.length){v.push(e[o+1]),o+=2;continue}if(k===x){o++;break}v.push(k),o++}while(o<e.length&&/\s/.test(e[o]))o++;if(e[o]!==")")return null;return o++,{value:v.join(""),consumed:o}}function oa(e,o){let x=e;function v(j,L,B,F){let U=1,Z=F,Y=new RegExp(`@${L}(?:\\s*\\(|\\s|$)`,"g"),Q=new RegExp(`@${B}(?![a-z])`,"g");while(Z<j.length&&U>0){Y.lastIndex=Z,Q.lastIndex=Z;let se=Y.exec(j),oe=Q.exec(j),ie=se?se.index:1/0,ce=oe?oe.index:1/0;if(ie<ce)U++,Z=ie+se[0].length;else if(ce<1/0){if(U--,U===0)return ce;Z=ce+oe[0].length}else break}return-1}function k(j,L,B){let F=0,U=new RegExp(`@${L}(?:\\s*\\(|\\s|$)`,"g"),Z=new RegExp(`@${B}(?![a-z])`,"g"),Y=/@else(?![a-z])/g,Q=[],se;while((se=U.exec(j))!==null)Q.push({pos:se.index,type:"open"});while((se=Z.exec(j))!==null)Q.push({pos:se.index,type:"close"});while((se=Y.exec(j))!==null)Q.push({pos:se.index,type:"else"});Q.sort((oe,ie)=>oe.pos-ie.pos);for(let oe of Q)if(oe.type==="open")F++;else if(oe.type==="close")F--;else if(oe.type==="else"&&F===0)return oe.pos;return-1}{let j=!0;while(j){j=!1;let L=x.match(/@auth(?:\s*\(|\s|(?=\n))/);if(!L||L.index===void 0)break;let B=L.index,F,U,Z=x.slice(B+5),Y=lu(Z);if(Y)F=Y.value,U=B+5+Y.consumed;else U=B+5;let Q=v(x,"auth","endauth",U);if(Q===-1){console.warn(`[stx] @auth directive at position ${B} has no matching @endauth \u2014 the block was skipped.`);break}let se=x.slice(U,Q),oe=k(se,"auth","endauth"),ie;if(!o.auth)ie=!1;else ie=F?Pn(`auth?.check && auth?.user?.[${F}]`,o):Pn("auth?.check",o);let ce;if(oe!==-1){let ae=se.slice(0,oe),pe=se.slice(oe+5);ce=ie?ae:pe}else ce=ie?se:"";x=x.substring(0,B)+ce+x.substring(Q+8),j=!0}}{let j=!0;while(j){j=!1;let L=x.match(/@guest(?:\s*\(|\s|(?=\n))/);if(!L||L.index===void 0)break;let B=L.index,F,U,Z=x.slice(B+6),Y=lu(Z);if(Y)F=Y.value,U=B+6+Y.consumed;else U=B+6;let Q=v(x,"guest","endguest",U);if(Q===-1){console.warn(`[stx] @guest directive at position ${B} has no matching @endguest \u2014 the block was skipped.`);break}let se=x.slice(U,Q),oe=k(se,"guest","endguest"),ie;if(!o.auth)ie=!0;else ie=F?Pn(`!auth?.check || !auth?.user?.[${F}]`,o):Pn("!auth?.check",o);let ce;if(oe!==-1){let ae=se.slice(0,oe),pe=se.slice(oe+5);ce=ie?ae:pe}else ce=ie?se:"";x=x.substring(0,B)+ce+x.substring(Q+9),j=!0}}function E(j,L,B){if(o.userCan&&typeof o.userCan[j]==="boolean")return o.userCan[j];if(o.permissions?.check&&typeof o.permissions.check==="function")try{let F=[j];if(L)F.push(L);if(B){let U=Pn(B,o);F.push(U)}return o.permissions.check(...F)}catch{return!1}return!1}function C(j){let L=j.match(/^\s*\(\s*'([^']*)'(?:,\s*'([^']*)')?(?:,\s*([^)]*))?\)/);if(!L)return null;return{ability:L[1],type:L[2],id:L[3]?.trim(),paramsEnd:L[0].length}}for(let j of["can","cannot"]){let L=`end${j}`,B=j==="can"?"elsecan":"elsecannot",F=!0;while(F){F=!1;let U=x.match(new RegExp(`@${j}\\s*\\(`));if(!U||U.index===void 0)break;let Z=U.index,Y=x.slice(Z+`@${j}`.length),Q=C(Y);if(!Q)break;let se=Z+`@${j}`.length+Q.paramsEnd,oe=v(x,j,L,se);if(oe===-1){console.warn(`[stx] @${j} directive at position ${Z} has no matching @${L} \u2014 the block was skipped.`);break}let ie=x.slice(se,oe),ce=[],ae=0,pe=new RegExp(`@${j}\\s*\\(`,"g"),me=new RegExp(`@${L}(?![a-z])`,"g"),he=new RegExp(`@${B}\\s*\\(`,"g"),Se=/@else(?![a-z])/g,Ee=[],Ce;while((Ce=pe.exec(ie))!==null)Ee.push({pos:Ce.index,type:"open"});while((Ce=me.exec(ie))!==null)Ee.push({pos:Ce.index,type:"close"});while((Ce=he.exec(ie))!==null)Ee.push({pos:Ce.index,type:"elseDirective"});while((Ce=Se.exec(ie))!==null)Ee.push({pos:Ce.index,type:"else"});Ee.sort((De,Ie)=>De.pos-Ie.pos);for(let De of Ee){if(De.type==="open"){ae++;continue}if(De.type==="close"){ae--;continue}if(ae===0)ce.push(De)}let Re=[],Ae=0;for(let De=0;De<ce.length;De++){let Ie=ce[De];if(Re.push({content:ie.slice(Ae,Ie.pos),ability:void 0}),Ie.type==="elseDirective"){let Oe=ie.slice(Ie.pos+`@${B}`.length),tt=C(Oe);if(tt){Re[Re.length-1]={content:ie.slice(Ae,Ie.pos)},Ae=Ie.pos+`@${B}`.length+tt.paramsEnd,Re.push({content:"",ability:tt.ability,type:tt.type,id:tt.id}),Re.pop();let ot=ce[De+1],nt=ot?ot.pos:ie.length;Re.push({content:ie.slice(Ae,nt),ability:tt.ability,type:tt.type,id:tt.id}),Ae=nt}}else Ae=Ie.pos+5}if(Ae<ie.length){let De=Re[Re.length-1];if(ce.length>0&&ce[ce.length-1].type==="else")Re.push({content:ie.slice(Ae),isFinalElse:!0});else if(Re.length===0)Re.push({content:ie.slice(Ae)})}let _e=E(Q.ability,Q.type,Q.id),Te=j==="can"?_e:!_e,Me="";if(Te)Me=Re[0]?.content||"";else{let De=!1;for(let Ie=1;Ie<Re.length;Ie++){let Oe=Re[Ie];if(Oe.isFinalElse){Me=Oe.content,De=!0;break}if(Oe.ability){let tt=E(Oe.ability,Oe.type,Oe.id);if(j==="can"?tt:!tt){Me=Oe.content,De=!0;break}}}if(!De&&Re.length>0){let Ie=Re[Re.length-1];if(Ie.isFinalElse)Me=Ie.content}}x=x.substring(0,Z)+Me+x.substring(oe+`@${L}`.length),F=!0}}return x}function aa(e,o,x){let v=e;function k(E,C,j,L,B){let F=!0;while(F){F=!1;let U=new RegExp(`@${C}\\s*\\(`),Z=E.match(U);if(!Z||Z.index===void 0)break;let Y=Z.index,Q=Mn(E,Y+`@${C}`.length);if(!Q)break;let se=Q.endPos,oe=ar(E,C,j,se);if(oe===-1){console.warn(`[stx] @${C} directive at position ${Y} has no matching @${j} \u2014 the block was skipped.`);break}let ie=E.slice(se,oe),ce=Q.expression,ae=-1,pe=0,me=0;while(me<ie.length){let he=ie.indexOf("@",me);if(he===-1)break;let Se=ie.substring(he);if(/^@(?:if|unless|isset|empty)\s*\(/.test(Se)){pe++,me=he+1;continue}if(/^@(?:endif|endunless|endisset|endempty)(?![a-z])/.test(Se)){pe--,me=he+1;continue}if(pe===0&&/^@else(?![a-z])/.test(Se)){ae=he;break}me=he+1}try{let he=L(ce.trim()),Se;if(ae!==-1){let Ee=ie.slice(0,ae),Ce=ie.slice(ae+5);Se=he?Ee:Ce}else Se=he?ie:"";E=E.substring(0,Y)+Se+E.substring(oe+`@${j}`.length),F=!0}catch(he){let Se=he instanceof Error?he.message:String(he),Ee=a(B,`Error processing @${C} directive: ${Se}`,t.EVALUATION_ERROR);E=E.substring(0,Y)+Ee+E.substring(oe+`@${j}`.length);break}}return E}return v=k(v,"isset","endisset",(E)=>{let C=Pn(E,o);return C!==void 0&&C!==null},"Isset"),v=k(v,"empty","endempty",(E)=>{let C=Pn(E,o);return C===void 0||C===null||C===""||C===0||C===!1||Array.isArray(C)&&C.length===0||typeof C==="object"&&C!==null&&Object.keys(C).length===0},"Empty"),v}function ca(e,o,x){let v=e,k="development";function E(C,j,L,B){let F=new RegExp(`@${j}(?![a-z])`,"g"),U=new RegExp(`@${L}(?![a-z])`,"g"),Z=new RegExp(`^@${j}(?![a-z])`),Y=new RegExp(`^@${L}(?![a-z])`),Q=C,se=!0;while(se){se=!1,F.lastIndex=0;let oe=F.exec(Q);if(!oe)break;let ie=oe.index,ce=ie+oe[0].length;if(j==="env"){let _e=Q.substring(ce).match(/^\s*\(\s*(['"])([^'"]+)\1\s*\)/);if(!_e)break;ce+=_e[0].length,B=k===_e[2]}let ae=1,pe=ce,me=-1;while(ae>0&&pe<Q.length){F.lastIndex=pe,U.lastIndex=pe;let _e=F.exec(Q),Te=U.exec(Q),Me=_e?_e.index:1/0,De=Te?Te.index:1/0;if(Me<De)ae++,pe=Me+_e[0].length;else if(De<1/0){if(ae--,ae===0){me=De;break}pe=De+Te[0].length}else break}if(me===-1){console.warn(`[stx] @${j} directive at position ${ie} has no matching @${L} \u2014 the block was skipped.`);break}let he=Q.substring(ce,me),Se=-1,Ee=0,Ce=0;while(Ce<he.length){let _e=he.indexOf("@",Ce);if(_e===-1)break;let Te=he.substring(_e);if(Z.test(Te)){Ee++,Ce=_e+1;continue}if(Y.test(Te)){Ee--,Ce=_e+1;continue}if(Ee===0&&/^@else(?![a-z])/.test(Te)){Se=_e;break}Ce=_e+1}let Re;if(Se!==-1){let _e=he.slice(0,Se),Te=he.slice(Se+5);Re=B?_e:Te}else Re=B?he:"";let Ae=`@${L}`.length;Q=Q.substring(0,ie)+Re+Q.substring(me+Ae),se=!0}return Q}return v=E(v,"env","endenv",!1),v=E(v,"production","endproduction",k==="production"),v=E(v,"development","enddevelopment",k==="development"),v=E(v,"staging","endstaging",k==="staging"),v=E(v,"testing","endtesting",k==="testing"),v}var uu=new WeakMap;function du(e=16){let o=new Uint8Array(e);return crypto.getRandomValues(o),btoa(String.fromCharCode(...o))}function ci(e,o){if(!e)return o?.nonceGenerator?.()??du();let x=uu.get(e);if(!x)x=o?.nonceGenerator?.()??du(),uu.set(e,x);return x}function Vm(e,o){let x=[];for(let[v,k]of Object.entries(e)){if(k===void 0||k===null)continue;if(typeof k==="boolean"){if(k)x.push(v);continue}if(Array.isArray(k)){let E=[...k];if(o&&(v==="script-src"||v==="style-src"))E=E.filter((C)=>!C.startsWith("'nonce-")),E.push(`'nonce-${o}'`);if(E.length>0)x.push(`${v} ${E.join(" ")}`)}}return x.join("; ")}function pu(e,o){return`<meta http-equiv="Content-Security-Policy" content="${Vm(e,o).replace(/&/g,"&amp;").replace(/"/g,"&quot;")}">`}function fu(e,o,x){if(!o.enabled||!o.addMetaTag)return e;if(e.includes('http-equiv="Content-Security-Policy"'))return e;if(!e.includes("<head>")&&!e.includes("<head "))return e;let v=o.useNonce?ci(x,o):void 0,k=pu(o.directives,v);return e.replace(/<head([^>]*)>/,`<head$1>
2261
+ ${k}`)}function gu(e,o){let x=e;return x=x.replace(/<script(?![^>]*\ssrc=)([^>]*)>/gi,(v,k)=>{if(k.includes("nonce="))return v;return`<script nonce="${o}"${k}>`}),x=x.replace(/<style([^>]*)>/gi,(v,k)=>{if(k.includes("nonce="))return v;return`<style nonce="${o}"${k}>`}),x}function mu(e,o,x,v){let k=e,E=v.csp;if(k=k.replace(/@csp\b/g,()=>{if(!E?.enabled||!E.directives)return"<!-- CSP not configured -->";let C=E.useNonce?ci(o,E):void 0;return pu(E.directives,C)}),k=k.replace(/@cspNonce\b/g,()=>{if(!E?.enabled||!E.useNonce)return"";return ci(o,E)}),E?.enabled&&E.useNonce)o.cspNonce=ci(o,E);return k}import Um from"crypto";var Hm=40,hu="_token",la=null;function qm(e=Hm){let o=Um.randomBytes(Math.ceil(e/2)).toString("hex").slice(0,e);return la=o,o}function Xm(){if(!la)qm();return la}function Km(e=hu){let o=Xm();return`<input type="hidden" name="${e}" value="${o}">`}function yu(e){return e.replace(/@csrf(?:\((['"])([^'"]*)\1\))?/g,(o,x,v)=>Km(v||hu))}async function xu(e,o,x,v){if(!v.customDirectives||v.customDirectives.length===0)return e;let k=e;for(let E of v.customDirectives){if(!E.name||typeof E.handler!=="function"){if(v.debug)console.warn("Invalid custom directive:",E);continue}if(E.hasEndTag)k=await Zm(k,E,o,x,v);else k=await Jm(k,E,o,x,v)}return k}async function Zm(e,o,x,v,k){let{name:E,handler:C}=o,j=`@${E}`,L=`@end${E}`,B=e,F=Xe(`${j}(?:\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\))?([\\s\\S]*?)${L}`,"g"),U=[],Z=F.exec(B);while(Z!==null){let[Y,Q="",se=""]=Z,oe=Z.index||0;try{let ie=Q?bu(o,Q):[],ce=se.trim(),ae=await C(ce,ie,x,v);U.push({original:Y,processed:ae,startIndex:oe})}catch(ie){let ce=ie instanceof Error?ie.message:String(ie);if(k.debug)console.error(`Error processing custom directive @${E}:`,ie);U.push({original:Y,processed:a("CustomDirective",`Error in @${E}${Q?`(${Q})`:""}: ${ce}`,t.EVALUATION_ERROR),startIndex:oe})}Z=F.exec(B)}for(let Y=U.length-1;Y>=0;Y--){let{original:Q,processed:se}=U[Y];B=B.replace(Q,se)}return B}async function Jm(e,o,x,v,k){let{name:E,handler:C}=o,j=e,L=[],B=[];if(o.rawParams){for(let Z of Ts(j,Xe(`(?<![\\w$@])@${E}\\s*\\(`,"g")))if(Z.end!==-1)B.push({fullMatch:Z.call,paramString:Z.args,startIndex:Z.start})}else{let Z=Xe(`@${E}\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\)`,"g");Z.lastIndex=0;let Y=Z.exec(j);while(Y!==null)B.push({fullMatch:Y[0],paramString:Y[1]??"",startIndex:Y.index||0}),Y=Z.exec(j)}for(let{fullMatch:Z,paramString:Y,startIndex:Q}of B)try{let se=bu(o,Y),oe=await C("",se,x,v);L.push({original:Z,processed:oe,startIndex:Q})}catch(se){let oe=se instanceof Error?se.message:String(se);if(k.debug)console.error(`Error processing custom directive @${E}:`,se);L.push({original:Z,processed:a("CustomDirective",`Error in @${E}(${Y}): ${oe}`,t.EVALUATION_ERROR),startIndex:Q})}let F=Xe(`@${E}(?!\\w)(?!\\s*\\()`,"g"),U=F.exec(j);while(U!==null){let[Z]=U,Y=U.index||0;try{let Q=await C("",[],x,v);L.push({original:Z,processed:Q,startIndex:Y})}catch(Q){let se=Q instanceof Error?Q.message:String(Q);if(k.debug)console.error(`Error processing custom directive @${E}:`,Q);L.push({original:Z,processed:a("CustomDirective",`Error in @${E}: ${se}`,t.EVALUATION_ERROR),startIndex:Y})}U=F.exec(j)}for(let Z=L.length-1;Z>=0;Z--){let{original:Y,processed:Q}=L[Z];j=j.replace(Y,Q)}return j}function bu(e,o){return e.rawParams?Je(o):Gm(o)}function Gm(e){if(!e.trim())return[];let o=[],x="",v=!1,k="";for(let E=0;E<e.length;E++){let C=e[E];if((C==='"'||C==="'")&&(E===0||e[E-1]!=="\\"))if(!v)v=!0,k=C;else if(C===k)v=!1;else x+=C;else if(C===","&&!v)o.push(x.trim()),x="";else x+=C}if(x.trim())o.push(x.trim());return o.map((E)=>{let C=E.trim();if(C.startsWith('"')&&C.endsWith('"')||C.startsWith("'")&&C.endsWith("'"))return C.substring(1,C.length-1);return C})}var vu=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,wu=/^[A-Za-z_$][\w$]*$/,Ym=new Set(["light","dark","system"]);function cr(e,o){if(typeof e!=="string"||e.length===0)throw Error(`@appearanceBootstrap ${o} must be a non-empty string`)}function Qm(e){if(!e||typeof e!=="object"||Array.isArray(e))throw Error("@appearanceBootstrap expects an options object");let o=e,{appearance:x,colorMode:v}=o;if(cr(o.storageKey,"storageKey"),x!==void 0&&(!x||typeof x!=="object"||Array.isArray(x)))throw Error("@appearanceBootstrap appearance must be an object when given");if(!v||typeof v!=="object"||Array.isArray(v))throw Error("@appearanceBootstrap colorMode must be an object");if(cr(v.key,"colorMode.key"),cr(v.attribute,"colorMode.attribute"),cr(v.default,"colorMode.default"),!wu.test(v.key))throw Error("@appearanceBootstrap preference keys must be JavaScript property names");if(!vu.test(v.attribute))throw Error("@appearanceBootstrap attributes must be lowercase data attribute names");if(!Ym.has(v.default))throw Error("@appearanceBootstrap colorMode.default must be light, dark, or system");let k=null;if(x){if(cr(x.key,"appearance.key"),cr(x.attribute,"appearance.attribute"),cr(x.default,"appearance.default"),!wu.test(x.key))throw Error("@appearanceBootstrap preference keys must be JavaScript property names");if(!vu.test(x.attribute))throw Error("@appearanceBootstrap attributes must be lowercase data attribute names");if(!Array.isArray(x.allowed)||x.allowed.length===0||x.allowed.some((E)=>typeof E!=="string"||E.length===0))throw Error("@appearanceBootstrap appearance.allowed must contain one or more strings");if(!x.allowed.includes(x.default))throw Error("@appearanceBootstrap appearance.default must be in appearance.allowed");k={key:x.key,attribute:x.attribute,allowed:[...new Set(x.allowed)],default:x.default}}return{storageKey:o.storageKey,appearance:k,colorMode:{key:v.key,attribute:v.attribute,default:v.default},respectExisting:o.respectExisting===!0}}function eh(e){return JSON.stringify(e).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function th(e){return`<script data-stx-scoped data-stx-appearance-bootstrap>(function(){"use strict";const config=${eh(e)};const root=document.documentElement;const MODES=["light","dark","system"];let format="json";const forced=(function(){const found={colorMode:null,appearance:null};if(!config.respectExisting)return found;try{const mode=root.getAttribute("data-"+config.colorMode.attribute);if(mode==="light"||mode==="dark")found.colorMode=mode;if(config.appearance){const name=root.getAttribute("data-"+config.appearance.attribute);if(config.appearance.allowed.includes(name))found.appearance=name}}catch{}return found}());function read(){let stored={};try{const raw=localStorage.getItem(config.storageKey);if(raw){let parsed=null;try{parsed=JSON.parse(raw)}catch{parsed=raw}if(parsed&&typeof parsed==="object"&&!Array.isArray(parsed)){stored=parsed;format="json"}else if(typeof parsed==="string"&&MODES.includes(parsed)){stored={};stored[config.colorMode.key]=parsed;format="string"}}}catch{}return stored}function write(stored){try{if(format==="string"&&!config.appearance)localStorage.setItem(config.storageKey,stored[config.colorMode.key]);else localStorage.setItem(config.storageKey,JSON.stringify(stored))}catch{}}function resolve(){const stored=read();const state={colorMode:forced.colorMode||(MODES.includes(stored[config.colorMode.key])?stored[config.colorMode.key]:config.colorMode.default)};if(config.appearance)state.appearance=forced.appearance||(config.appearance.allowed.includes(stored[config.appearance.key])?stored[config.appearance.key]:config.appearance.default);return state}function prefersDark(){try{return matchMedia("(prefers-color-scheme: dark)").matches}catch{return false}}function apply(){const state=resolve();const dark=state.colorMode==="dark"||(state.colorMode==="system"&&prefersDark());if(config.appearance)root.setAttribute("data-"+config.appearance.attribute,state.appearance);root.setAttribute("data-"+config.colorMode.attribute,state.colorMode);root.classList.toggle("dark",dark);root.dataset.theme=dark?"dark":"light";state.dark=dark;try{window.dispatchEvent(new CustomEvent("stx:appearance",{detail:state}))}catch{}return state}function store(key,allowed,value){if(allowed.includes(value)){const stored=read();stored[key]=value;write(stored)}return apply()}window.__stxAppearance={config:config,forced:forced,read:read,resolve:resolve,apply:apply,setColorMode:function(mode){return store(config.colorMode.key,MODES,mode)},setAppearance:function(name){return config.appearance?store(config.appearance.key,config.appearance.allowed,name):apply()},watchSystem:function(){try{matchMedia("(prefers-color-scheme: dark)").addEventListener("change",function(){if(resolve().colorMode==="system")apply()})}catch{}}};apply()}());</script>`}function nh(e,o){let x=1,v=null,k=!1;for(let E=o+1;E<e.length;E++){let C=e[E];if(k){k=!1;continue}if(v){if(C==="\\")k=!0;else if(C===v)v=null;continue}if(C==='"'||C==="'"||C==="`"){v=C;continue}if(C==="(")x++;else if(C===")"&&--x===0)return E}return-1}function $u(e,o){let x=e,v=/@appearanceBootstrap\s*\(/g,k;while((k=v.exec(x))!==null){let E=k.index+k[0].length-1,C=nh(x,E);if(C===-1)throw Error("@appearanceBootstrap has an unclosed options object");let j=x.slice(E+1,C).trim(),L=c(`(${j})`,o),B=th(Qm(L));x=x.slice(0,k.index)+B+x.slice(C+1),v.lastIndex=k.index+B.length}return x}import rh from"crypto";function Ft(e){return String(e??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}var Eu={input:"form-control",inputError:"is-invalid",checkInput:"form-check-input",label:"form-label",errorFeedback:"invalid-feedback"};function li(e,o,x,v){let k=e||o;return x?`${k} ${v}`:k}function pn(e){return String(e).replace(/\[\]$/,"").replace(/[^\w.:-]+/g,"-").replace(/^-+|-+$/g,"")}function vr(e,o){if(/\bid\s*=/i.test(e))return"";return` id="${Ft(o)}"`}function ua(e,o,x){if(!o)return"";let v="";if(!/\baria-invalid\s*=/i.test(x))v+=' aria-invalid="true"';if(!/\baria-describedby\s*=/i.test(x))v+=` aria-describedby="${Ft(`${pn(e)}-error`)}"`;return v}function sh(){return rh.randomUUID()}function ui(e,o){let x=e;return x=x.replace(/@csrf/g,()=>{if(!o.csrf||typeof o.csrf!=="object"){let v=sh();o.csrf={token:v}}if(o.csrf.field)return o.csrf.field;if(o.csrf.token)return`<input type="hidden" name="_token" value="${Ft(o.csrf.token)}">`;return'<input type="hidden" name="_token" value="">'}),x=x.replace(/@method\(['"]([^'"]+)['"]\)/g,(v,k)=>{let E=k.toUpperCase();if(k&&!["GET","POST"].includes(E))return`<input type="hidden" name="_method" value="${Ft(E)}">`;return v}),x}function ku(e,o,x=Eu){let v=e;return v=v.replace(/@form\(\s*(?:(?:'([^']+)'|"([^"]+)")\s*)?(?:,\s*(?:'([^']+)'|"([^"]+)")?)?\s*(?:,\s*\{([^}]+)\}\s*)?\)/g,(k,E,C,j,L,B="")=>{let F=E||C||"POST",U=j||L||"",Z=On(B),Y=F.toUpperCase(),Q=["GET","POST"].includes(Y)?Y:"POST",se=`<form method="${Ft(Q)}" action="${Ft(U)}"${Z?` ${Z}`:""}>`;if(se+=`
2262
+ ${ui("@csrf",o)}`,!["GET","POST"].includes(Y))se+=`
2263
+ ${ui(`@method('${Y}')`,o)}`;return se}),v=v.replace(/@endform/g,"</form>"),v=v.replace(/@input\(\s*(?:'([^']+)'|"([^"]+)")\s*(?:,\s*(?:(?:'([^']*)'|"([^"]*)")\s*)?)?(?:,\s*\{([^}]+)\})?\s*\)/g,(k,E,C,j,L,B="")=>{let F=E||C||"",U=j||L||"",Z=On(B),Y=Vr(F,o),Q=Y!==void 0&&Y!==null?Y:U||"",se=Z.match(/type=['"]([^'"]+)['"]/i),oe=se?se[1]:"text",ie=Ur(F,o),ce=Z.match(/class=['"]([^'"]+)['"]/i),ae=li(ce?ce[1]:"",x.input,ie,x.inputError),pe=Z.replace(/class=['"][^'"]+['"]/i,"");return pe=pe.replace(/type=['"][^'"]+['"]/i,""),`<input type="${Ft(oe)}" name="${Ft(F)}"${vr(Z,pn(F))} value="${Ft(Q)}" class="${ae}"${ua(F,ie,Z)}${pe?` ${pe}`:""}>`}),v=v.replace(/@textarea\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endtextarea/g,(k,E,C="",j="")=>{let L=On(C),B=Vr(E,o)||j.trim(),F=Ur(E,o),U=L.match(/class=['"]([^'"]+)['"]/i),Z=li(U?U[1]:"",x.input,F,x.inputError),Y=L.replace(/class=['"][^'"]+['"]/i,"");return`<textarea name="${Ft(E)}"${vr(L,pn(E))} class="${Z}"${ua(E,F,L)}${Y?` ${Y}`:""}>${Ft(B)}</textarea>`}),v=v.replace(/@select\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endselect/g,(k,E,C="",j)=>{let L=On(C),B=Vr(E,o),F=Ur(E,o),U=L.match(/class=['"]([^'"]+)['"]/i),Z=li(U?U[1]:"",x.input,F,x.inputError),Y=L.replace(/class=['"][^'"]+['"]/i,""),Q=j;if(B!==void 0)Q=j.replace(/(<option[^>]*value=['"]([^'"]+)['"][^>]*>)/gi,(se,oe,ie)=>{if((Array.isArray(B)?B.some((ae)=>String(ae)===ie):String(B)===ie)&&!oe.includes("selected"))return oe.replace(/(<option)/,"$1 selected");return se});return`<select name="${Ft(E)}"${vr(L,pn(E))} class="${Z}"${ua(E,F,L)}${Y?` ${Y}`:""}>${Q}</select>`}),v=v.replace(/@checkbox\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?(?:,\s*\{([^}]+)\})?\)/g,(k,E,C,j="")=>{let L=C===void 0?"1":C,B=C===void 0?pn(E):`${pn(E)}-${pn(L)}`,F=On(j),U=Vr(E,o),Z=U!==void 0&&(Array.isArray(U)?U.some((oe)=>String(oe)===L):U===!0||String(U)===L),Y=F.match(/class=['"]([^'"]+)['"]/i),Q=Y?Y[1]:x.checkInput,se=F.replace(/class=['"][^'"]+['"]/i,"");return`<input type="checkbox" name="${Ft(E)}"${vr(F,B)} value="${Ft(L)}" class="${Q}"${Z?" checked":""}${se?` ${se}`:""}>`}),v=v.replace(/@radio\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(k,E,C,j="")=>{let L=On(j),B=Vr(E,o),F=B!==void 0&&B===C,U=L.match(/class=['"]([^'"]+)['"]/i),Z=U?U[1]:x.checkInput,Y=L.replace(/class=['"][^'"]+['"]/i,"");return`<input type="radio" name="${Ft(E)}"${vr(L,`${pn(E)}-${pn(C)}`)} value="${Ft(C)}" class="${Z}"${F?" checked":""}${Y?` ${Y}`:""}>`}),v=v.replace(/@file\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(k,E,C="")=>{let j=On(C),L=j.match(/accept=['"]([^'"]+)['"]/i),B=L?L[1]:"",F=j.includes("multiple"),U=Ur(E,o),Z=j.match(/class=['"]([^'"]+)['"]/i),Y=li(Z?Z[1]:"",x.input,U,x.inputError),Q=j.replace(/class=['"][^'"]+['"]/gi,"").replace(/accept=['"][^'"]+['"]/gi,"").replace(/\bmultiple\b/gi,"").trim(),se=[`<input type="file" name="${Ft(E)}"${vr(j,pn(E))}`,`class="${Y}"`];if(B)se.push(`accept="${Ft(B)}"`);if(F)se.push("multiple");if(Q)se.push(Q);return`${se.join(" ")}>`}),v=v.replace(/@label\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endlabel/g,(k,E,C="",j)=>{let L=On(C),B=L.match(/class=['"]([^'"]+)['"]/i),F=B?B[1]:x.label,U=L.replace(/class=['"][^'"]+['"]/i,"");return`<label for="${Ft(pn(E))}" class="${F}"${U?` ${U}`:""}>${j}</label>`}),v}function Cu(e,o,x=Eu){return e.replace(/@error\(['"]([^'"]+)['"]\)([\s\S]*?)@enderror/g,(v,k,E)=>{try{if(Ur(k,o)){let C=E.replace(/\{\{([^}]+)\}\}/g,(j,L)=>{try{if(L.trim()==="$message"||L.trim()==="message")return Su(k,o);if(L.trim().includes("errors.first")||L.trim().includes("$errors.first")){if(typeof o.errors?.first==="function")return o.errors.first(k);return Su(k,o)}let B=L.trim();if(p(B)){let F=c(B,o);return F!==void 0?String(F):B}return B}catch{return L}});return`<div id="${Ft(`${pn(k)}-error`)}" role="alert">${C}</div>`}return""}catch(C){return console.error("Error processing @error directive:",C),v}})}function Ur(e,o){if(!o.errors)return!1;if(typeof o.errors.has==="function")return o.errors.has(e);if(typeof o.errors==="object")return Object.prototype.hasOwnProperty.call(o.errors,e);return!1}function Su(e,o){if(!o.errors)return"";if(typeof o.errors.get==="function")return o.errors.get(e);if(typeof o.errors==="object"&&Object.prototype.hasOwnProperty.call(o.errors,e)){let x=o.errors[e];return Array.isArray(x)?x[0]:String(x)}return""}function Vr(e,o){let x;if(o.old&&typeof o.old==="function")return o.old(e);if(o.old&&typeof o.old==="object")return o.old[e];if(e.endsWith("[]")){let v=e.slice(0,-2);if(x=o[v],x!==void 0)return x}return o[e]}function On(e){if(!e.trim())return"";let o=[],x=e.trim(),v=/([\w-]+)\s*:\s*(['"]?)([^,'"]*)\2(?:\s*,\s*|\s*$)/g,k;while((k=v.exec(x))!==null){let[,E,,C]=k;o.push(`${E}="${C.trim()}"`)}return o.join(" ")}var Hr=/<\/?template\b[^>]*>/gi,ih=/(?:^|\s)(?:id\s*=|(?:x-|[@:])(?:for|if|else(?:-if)?)(?=\s|=|$)|#[\w-]+(?:\s*=|\s|$)|v-slot(?::[\w-]+)?(?=\s|=|$)|slot\s*=)/i;function oh(e){let o=e.replace(/^<template\b/i,"").replace(/>$/,"");return ih.test(o)}function ee(e){Hr.lastIndex=0;let o;while((o=Hr.exec(e))!==null){if(o[0].startsWith("</")||oh(o[0]))continue;let x=o.index,v=Hr.lastIndex,k=1,E;while((E=Hr.exec(e))!==null)if(E[0].startsWith("</")){if(k--,k===0){let C=E.index;return{start:x,openEnd:v,closeStart:C,end:Hr.lastIndex,content:e.slice(v,C)}}}else k++;return null}return null}import Nt from"path";import{existsSync as ry}from"fs";import di from"fs";import Bt from"path";var zu=new Map;function pi(e,o=!0){let x=zu.get(e);if(o&&x)return x;let v=new Map,k=[Bt.join(e,"src"),Bt.join(e,"dist"),e];function E(C,j){if(j>6)return;let L;try{L=di.readdirSync(C,{withFileTypes:!0})}catch{return}for(let B of L){let F=Bt.join(C,B.name);if(B.isDirectory()){if(B.name==="node_modules"||B.name.startsWith("."))continue;E(F,j+1)}else if(B.isFile()&&B.name.endsWith(".stx")){let U=B.name.slice(0,-4);if(!v.has(U))v.set(U,F);let Z=U.toLowerCase();if(!v.has(Z))v.set(Z,F);let Y=U.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(!v.has(Y))v.set(Y,F)}}}for(let C of k)if(E(C,0),v.size>0)break;if(o)zu.set(e,v);return v}function fi(e,o){if(e.startsWith(".")||e.startsWith("/"))return null;let x=o;while(!0){let v=Bt.join(x,"node_modules",e);try{if(di.statSync(v).isDirectory())return v}catch{}let k=Bt.dirname(x);if(k===x)return null;x=k}}function gi(e,o,x={}){return[Bt.resolve(Bt.dirname(o),`${e}.stx`),Bt.resolve(Bt.dirname(o),e),Bt.resolve(x.componentsDir||"components",`${e}.stx`),Bt.resolve(x.componentsDir||"components",e),e.endsWith(".stx")?e:`${e}.stx`]}function Wu(e){let o=e.endsWith(".stx")?e.slice(0,-4):e,x=o.split("-").map((k)=>k.charAt(0).toUpperCase()+k.slice(1)).join(""),v=o.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();return[o,x,v]}function da(e,o){let[x,v,k]=Wu(e);for(let E of[x,x.toLowerCase(),v,k]){let C=o?.__importedComponents?.get(E);if(C!==void 0)return C}}function*pa(e,o,x={},v){let k=Wu(e);if(k[0].startsWith("./")||k[0].startsWith("../")){yield Bt.resolve(Bt.dirname(o),`${k[0]}.stx`);return}let E=[...new Set(k.map((L)=>`${L}.stx`))],C=x.projectRoot||process.cwd(),j=[...v?.__originalFilePath?[Bt.join(Bt.dirname(v.__originalFilePath),"components")]:[],...x.componentsDir?[x.componentsDir]:[],Bt.join(Bt.dirname(o),"components"),Bt.resolve(C,"src/components"),Bt.resolve(C,"components"),...import.meta.dir?[Bt.resolve(import.meta.dir,"components")]:[]];for(let L of new Set(j)){for(let B of E)yield Bt.join(L,B);try{for(let B of di.readdirSync(L,{withFileTypes:!0}))if(B.isDirectory())for(let F of E)yield Bt.join(L,B.name,F)}catch{}}}function Vu(e,o,x={},v){let k=da(e,v);if(k!==void 0)return k;for(let E of pa(e,o,x,v))try{if(di.statSync(E,{throwIfNoEntry:!1})?.isFile())return E}catch{}return null}class Uu{builtins=new Map;registerBuiltin(e){this.builtins.set(e.name.toLowerCase(),e);for(let o of e.aliases)this.builtins.set(o.toLowerCase(),e)}isBuiltin(e){return this.builtins.has(e.toLowerCase())}getBuiltin(e){return this.builtins.get(e.toLowerCase())??null}async resolveFile(e,o,x,v){let k=da(e,v);if(k!==void 0)return k;for(let E of pa(e,o,x,v))if(await n(E))return E;return null}}var wr=new Uu;function Ut(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}var lr="\x00stx-boolean-attribute";function fa(e){return e.indexOf("\x00")===-1?e:e.replace(/\0/g,"")}function $r(e,o){let x=[];for(let[v,k]of Object.entries(e.static)){if(o.has(v))continue;let E=e.staticNames?.[v]??v;if(typeof k==="boolean"){if(k)x.push(Ut(E));continue}if(k===lr){x.push(Ut(E));continue}x.push(`${Ut(E)}="${Ut(fa(String(k)))}"`)}return x}function Sr(e,o){let x=[];for(let[v,k]of Object.entries(e.serverDynamic??{})){if(o.has(v))continue;if(k===null||k===void 0||k===!1)continue;let E=e.serverDynamicNames?.[v]??v;if(k===!0){x.push(Ut(E));continue}if(typeof k==="object")continue;x.push(`${Ut(E)}="${Ut(fa(String(k)))}"`)}return x}function _r(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function ah(e){if(e.clientReactive.to)return{value:e.clientReactive.to,reactive:!0};if(e.serverDynamic.to!==void 0)return{value:String(e.serverDynamic.to),reactive:!1};if(typeof e.static.to==="string")return{value:e.static.to,reactive:!1};return{value:"#",reactive:!1}}var ga={name:"StxLink",aliases:["stx-link"],render(e,o,x){let v=ah(e),k=(typeof e.static.class==="string"?e.static.class:"")||(typeof e.static.className==="string"?e.static.className:""),E=typeof e.static.activeClass==="string"?e.static.activeClass:"active",C=typeof e.static.exactActiveClass==="string"?e.static.exactActiveClass:"exact-active",j=e.static.prefetch===!0||e.static.prefetch==="true"||e.serverDynamic.prefetch===!0,L=[];if(v.reactive)L.push(`:href="${_r(v.value)}"`);else L.push(`href="${_r(Mr(v.value,"navigable"))}"`);if(k)L.push(`class="${_r(k)}"`);if(L.push("data-stx-link"),L.push(`data-stx-active-class="${_r(E)}"`),L.push(`data-stx-exact-active-class="${_r(C)}"`),j)L.push("data-stx-prefetch");let B=typeof e.static.activeMatch==="string"?e.static.activeMatch.trim():"";if(B)L.push(`data-stx-active-match="${_r(B)}"`);let F=new Set(["to","class","className","activeClass","exactActiveClass","activeMatch","prefetch"]);return L.push(...$r(e,F)),L.push(...Sr(e,F)),`<a ${L.join(" ")}>${o}</a>`}};import{createHash as nd}from"crypto";import Qt from"fs";import qt from"path";import{decode as mh,generateThumbHash as hh}from"ts-images";import{createImageDeliveryCatalog as Ju}from"ts-images/delivery";import ma from"fs";function mi(e,o,x){let v=Buffer.alloc(x),k=ma.readSync(e,v,0,x,o);return v.subarray(0,k)}function ha(e){if(e.length<25)return!1;let o=(v,k)=>String.fromCharCode(...e.subarray(v,k));if(o(0,4)!=="RIFF"||o(8,12)!=="WEBP")return!1;let x=o(12,16);if(x==="VP8X")return(e[20]&16)!==0;if(x==="VP8L")return((e[21]|e[22]<<8|e[23]<<16|e[24]<<24)>>>28&1)===1;return!1}function ya(e){let o;try{o=ma.openSync(e,"r");let x=mi(o,0,33);if(x.length>=3&&x[0]===255&&x[1]===216&&x[2]===255)return"none";if(x.length>=26&&x[0]===137&&x.toString("latin1",1,4)==="PNG"){let v=x[25];if(v===4||v===6)return"possible";let k=8;for(let E=0;E<64;E++){let C=mi(o,k,8);if(C.length<8)return"unknown";let j=C.toString("latin1",4,8);if(j==="tRNS")return"possible";if(j==="IDAT"||j==="IEND")return"none";k+=12+C.readUInt32BE(0)}return"unknown"}if(x.length>=25&&x.toString("latin1",0,4)==="RIFF"&&x.toString("latin1",8,12)==="WEBP"){if(ha(x))return"possible";let v=x.toString("latin1",12,16);return v==="VP8 "||v==="VP8X"?"none":"unknown"}return"unknown"}catch{return"unknown"}finally{if(o!==void 0)ma.closeSync(o)}}import ch from"fs";import hi from"os";import{join as Hu}from"path";import{fileURLToPath as qu}from"url";import{Worker as Xu}from"worker_threads";var xi=Symbol("stx.image-worker.unavailable");function lh(e=typeof hi.availableParallelism==="function"?hi.availableParallelism():hi.cpus().length){return Math.max(1,Math.min(2,e-1))}var yi=0,Zu=[];async function uh(){if(yi<lh()){yi++;return}await new Promise((e)=>Zu.push(e)),yi++}function dh(){yi--,Zu.shift()?.()}var ph="@stacksjs/stx/builtins/image-warmup-worker";function fh(e=process.cwd()){let o=import.meta.url.endsWith(".ts")?"ts":"js";try{let x=new URL(`./image-warmup-worker.${o}`,import.meta.url);if(x.protocol==="file:"&&ch.existsSync(qu(x)))return qu(x)}catch{}try{let x=typeof Bun<"u"?Bun.resolveSync(ph,e):void 0;return x&&gh(x)?x:void 0}catch{return}}function gh(e,o=process.env){let x=e.replace(/\\/g,"/");if(x.split("/").some((k)=>/@\d[^/]*@@@\d+$/.test(k)))return!1;return![o.BUN_INSTALL_CACHE_DIR,Hu(o.BUN_INSTALL||Hu(hi.homedir(),".bun"),"install","cache")].filter((k)=>!!k).map((k)=>`${k.replace(/\\/g,"/").replace(/\/$/,"")}/`).some((k)=>x.startsWith(k))}var Ku=!1;function qr(e){if(!Ku)Ku=!0,console.warn(`[stx] image worker unavailable (${e}); running the image pass on the serving thread instead. Results are the same, but requests may stall while it runs.`);return xi}function xa(e){return e instanceof Error?e.message:String(e)}async function ba(e,o){if(typeof Xu!=="function")return qr("node:worker_threads has no Worker in this runtime");let x=fh();if(!x)return qr("no image-warmup-worker entry beside this module or in the installed @stacksjs/stx");await uh();try{return await new Promise((v,k)=>{let E;try{E=new Xu(x)}catch(B){v(qr(`could not start ${x}: ${xa(B)}`));return}let C=!1,j=!1,L=(B)=>{if(j)return;j=!0,B(),E.terminate()};E.on("message",(B)=>{if(B.type==="ready"){C=!0,E.postMessage({task:e,args:o});return}if(B.type==="result"){L(()=>v(B.value));return}let F=Error(B.error?.message??"image worker failed");if(B.error?.name)F.name=B.error.name;if(B.error?.stack)F.stack=B.error.stack;L(()=>k(F))}),E.on("error",(B)=>{L(()=>C?k(B instanceof Error?B:Error(xa(B)||"image worker crashed")):v(qr(`the worker failed before it was ready: ${xa(B)}`)))}),E.on("exit",(B)=>{L(()=>C?k(Error("image worker exited before it finished")):v(qr(`the worker exited with code ${B} before it was ready`)))})})}finally{dh()}}var yh=new Set([".avif",".jpeg",".jpg",".png",".webp"]),xh=[320,640,960,1280,1920],vi="/_stx/images",bh=`stx:${vi}:alpha-1`,vh=["@stacksjs/ts-webp","@stacksjs/ts-avif"],bi;function wh(e,o){let x=qt.dirname(Bun.resolveSync(e,o));while(x!==qt.dirname(x)){let v=qt.join(x,"package.json");if(Qt.existsSync(v)){let k=JSON.parse(Qt.readFileSync(v,"utf8"));if(k.name===e)return k.version}x=qt.dirname(x)}return}function $h(){if(bi!==void 0)return bi;let e;try{e=qt.dirname(Bun.resolveSync("ts-images",import.meta.dir))}catch{}return bi=vh.map((o)=>{let x;try{x=e?wh(o,e):void 0}catch{}return`${o.replace("@stacksjs/","")}@${x??"unknown"}`}).join("+"),bi}var Gu=Symbol.for("stx.image-delivery");function fs(){let e=globalThis;return e[Gu]??={catalog:new Map,transparent:new Set},e[Gu]}var Yu=new Set;function Sh(e){return`/${e.split(qt.sep).map(encodeURIComponent).join("/")}`}function _h(e){let o=qt.extname(e),x=e.slice(0,-o.length).replace(/[^a-zA-Z0-9_-]+/g,"-").replace(/^-+|-+$/g,""),v=nd("sha256").update(e).digest("hex").slice(0,8);return`${x||"image"}-${v}`}function Qu(e,o=`stx:${vi}`){let x=(v)=>`${vi}/${v.split("/").map(encodeURIComponent).join("/")}`;return{cacheNamespace:o,async stat(v){let k=qt.join(e,v);try{let E=await Qt.promises.stat(k);return E.size>0?{bytes:E.size,path:k,url:x(v)}:null}catch{return null}},async write(v,k){let E=qt.join(e,v);await Qt.promises.mkdir(qt.dirname(E),{recursive:!0});let C=`${E}.${process.pid}.tmp`;return await Qt.promises.writeFile(C,k),await Qt.promises.rename(C,E),{bytes:k.byteLength,path:E,url:x(v)}},url:x}}async function rd(e,o=e){let x=await Qt.promises.readdir(o,{withFileTypes:!0});x.sort((k,E)=>k.name.localeCompare(E.name));let v=[];for(let k of x){let E=qt.join(o,k.name);if(k.isDirectory()){v.push(...await rd(e,E));continue}if(!k.isFile()||!yh.has(qt.extname(k.name).toLowerCase()))continue;v.push({absolutePath:E,relativePath:qt.relative(e,E)})}return v}function ed(e,o){return e.map((x)=>({key:Sh(x.relativePath),input:x.absolutePath,name:_h(x.relativePath),...Eh(x.absolutePath)?{options:{storage:o}}:{}}))}function Eh(e){return ya(e)==="possible"}function kh(e){for(let o=3;o<e.length;o+=4)if(e[o]!==255)return!0;return!1}async function Ch(e){let o=Object.entries(e).filter(([,k])=>k.fallback.format==="png"),x=new Set,v=8;for(let k=0;k<o.length;k+=8)await Promise.all(o.slice(k,k+8).map(async([E,C])=>{let j=C.variants.filter((L)=>L.format==="png").sort((L,B)=>L.width-B.width)[0];try{let L=await mh(new Uint8Array(await Qt.promises.readFile(j?.path??C.fallback.path)));if(kh(L.data))x.add(E)}catch{x.add(E)}}));return x}function Rh(e,o){let x=[];for(let v of o){let k=e[v],E=k?.variants.filter((j)=>j.format==="webp")??[];if(!k||E.length===0)continue;if(!E.some((j)=>{let L;try{return L=Qt.openSync(j.path,"r"),!ha(mi(L,0,32))}catch{return!0}finally{if(L!==void 0)Qt.closeSync(L)}}))continue;if(k.variants=k.variants.filter((j)=>j.format!=="webp"),delete k.sources.webp,x.push(v),!Yu.has(v))Yu.add(v),console.warn(`[stx-images] ${v} is transparent but its WebP variants have no alpha channel; serving PNG instead. Upgrade @stacksjs/ts-webp to 0.1.6 or later.`)}return x}async function Ah(e){let o=[],x=8;for(let v=0;v<e.length;v+=8){let k=e.slice(v,v+8),E=await Promise.all(k.map(async(C)=>{try{return await hh(C.absolutePath),C}catch{return console.warn(`[stx-images] Skipping unreadable raster: ${C.relativePath}`),null}}));o.push(...E.filter((C)=>C!==null))}return o}function va(e){return qt.join(e,"undecodable.json")}function Th(e){try{let o=Qt.readFileSync(va(e),"utf-8"),x=JSON.parse(o);return x&&typeof x==="object"?x:{}}catch{return{}}}function Ih(e,o){try{Qt.mkdirSync(qt.dirname(va(e)),{recursive:!0}),Qt.writeFileSync(va(e),JSON.stringify(o))}catch{}}function td(e){try{let o=Qt.statSync(e);return{mtimeMs:o.mtimeMs,size:o.size}}catch{return}}function sd(e){if(!e||e.startsWith("data:")||e.startsWith("blob:")||/^https?:\/\//i.test(e)||e.startsWith("//"))return;let o=e.split(/[?#]/,1)[0];if(!o)return;try{return`/${o.replace(/^\/+/,"").split("/").map(decodeURIComponent).map(encodeURIComponent).join("/")}`}catch{return}}function Zr(e){let o=sd(e);return o?fs().catalog.get(o):void 0}function Qr(e){let o=sd(e);return o?fs().transparent.has(o):!1}function es(e){let o=(v)=>e.variants.filter((k)=>k.format===v).reduce((k,E)=>k+E.bytes,0),x=o(e.fallback.format);return["avif","webp"].map((v)=>({format:v,srcset:e.sources[v]||"",bytes:o(v)})).filter((v)=>v.srcset&&v.bytes>0&&v.bytes<x).sort((v,k)=>v.bytes-k.bytes).map(({format:v,srcset:k})=>({format:v,srcset:k}))}function Du(e){let o=Zr(e);if(!o)return;return{src:o.fallback.url,srcset:o.sources[o.fallback.format]||"",sources:es(o).map(({format:x,srcset:v})=>({type:`image/${x}`,srcset:v})),width:o.source.width,height:o.source.height,placeholder:Qr(e)?void 0:o.placeholder?.dataUrl}}function Fn(){let e=fs();e.catalog=new Map,e.transparent=new Set}function Dh(e){let o=fs();o.catalog=new Map(e.entries),o.transparent=new Set(e.transparent)}async function Ou(e,o,x={}){if(!e||!Qt.existsSync(e))return Fn(),{count:0,fingerprint:""};if(x.offThread){let Q=await ba("delivery",{publicDir:e,outputDir:o});if(Q!==xi)return Dh(Q.state),Q.result}let v=await rd(e);if(v.length===0)return Fn(),{count:0,fingerprint:""};let k=Th(o),E=v.filter((Q)=>{let se=k[Q.relativePath];if(!se)return!0;let oe=td(Q.absolutePath);return!oe||oe.mtimeMs!==se.mtimeMs||oe.size!==se.size});if(E.length===0)return Fn(),{count:0,fingerprint:""};let C=Qu(qt.join(o,"_stx","images"),`${bh}:${$h()}`),j={outDir:qt.join(o,"_stx","images"),storage:Qu(qt.join(o,"_stx","images")),baseUrl:vi,widths:xh,formats:["avif","webp"],quality:{avif:70,webp:78,jpeg:82,png:100},includeOriginal:!1,placeholder:!0,batchConcurrency:4,concurrency:4},L=E,B;try{B=await Ju({...j,entries:ed(E,C)})}catch(Q){if(L=await Ah(E),L.length===E.length)throw Q;let se=new Set(L.map((ie)=>ie.relativePath)),oe=!1;for(let ie of E){if(se.has(ie.relativePath))continue;let ce=td(ie.absolutePath);if(!ce)continue;k[ie.relativePath]=ce,oe=!0}if(oe)Ih(o,k);if(L.length===0)return Fn(),{count:0,fingerprint:""};B=await Ju({...j,entries:ed(L,C)})}let F=await Ch(B.entries),U=Rh(B.entries,F),Z=fs();Z.catalog=new Map(Object.entries(B.entries)),Z.transparent=F;let Y=F.size===0&&U.length===0?B.fingerprint:nd("sha256").update(B.fingerprint).update(JSON.stringify({transparent:[...F].sort(),droppedWebp:U.sort()})).digest("hex");return{count:L.length,fingerprint:Y}}var Ph=new Map;function wa(e){if(!e)return;let o=e.split("?")[0].split("#")[0];return Ph.get(o)}var Mh={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},$a=[320,640,768,1024,1280,1536,1920];function zt(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Zt(e,o){if(e.serverDynamic[o]!==void 0)return String(e.serverDynamic[o]);let x=e.static[o];if(typeof x==="string")return x;return}function wi(e,o,x=!1){let v=e.serverDynamic[o];if(v!==void 0)return v!==!1&&v!=="false";let k=e.static[o];if(k!==void 0)return k!=="false"&&k!==!1;return x}function Sa(e){if(e.includes("(")||e.includes(","))return e;let o=e.trim().split(/\s+/),x=[];for(let v of o)if(v.includes(":")){let[k,E]=v.split(":"),C=Mh[k];if(C)x.push(`(max-width: ${C}px) ${E}`);else{let j=Number.parseInt(k);if(!Number.isNaN(j))x.push(`(max-width: ${j}px) ${E}`)}}else x.push(v);return x.join(", ")}function _a(e,o,x,v){return o.map((k)=>`${xs(e,k,void 0,x,v)} ${k}w`).join(", ")}function Oh(e,o,x,v,k){return o.map((E)=>{let C=x?x*E:void 0;return`${xs(e,C,void 0,v,k)} ${E}x`}).join(", ")}function xs(e,o,x,v,k){if(!v||v==="local"||v==="static")return e;if(v==="cloudinary"){let E=[];if(o)E.push(`w_${o}`);if(x)E.push(`h_${x}`);if(k)E.push(`f_${k}`);E.push("q_auto");let C=E.join(",");return e.replace("/upload/",`/upload/${C}/`)}if(v==="imgix"){let E=new URLSearchParams;if(o)E.set("w",String(o));if(x)E.set("h",String(x));if(k)E.set("fm",k);E.set("auto","format");let C=e.includes("?")?"&":"?";return`${e}${C}${E.toString()}`}if(v==="bunny"){let E=new URLSearchParams;if(o)E.set("width",String(o));if(x)E.set("height",String(x));if(k)E.set("format",k);let C=e.includes("?")?"&":"?";return`${e}${C}${E.toString()}`}return e}function Nh(e){return`var s=this.style;${e.map((o)=>`s.${o}=''`).join(";")}`}function jh(e,o,x="#e5e7eb"){let v=`<svg xmlns="http://www.w3.org/2000/svg" width="${e}" height="${o}"><rect width="100%" height="100%" fill="${x}"/></svg>`;return`data:image/svg+xml;base64,${btoa(v)}`}var Ea={name:"StxImage",aliases:["Image","stx-image","stx-img"],render(e,o,x){let v=Zt(e,"src")||"",k=Zr(v),E=Zt(e,"alt")||"",C=Zt(e,"width")||(k?String(k.source.width):void 0),j=Zt(e,"height")||(k?String(k.source.height):void 0),L=Zt(e,"sizes"),B=Zt(e,"srcset"),F=Zt(e,"densities"),U=Zt(e,"format"),Z=Qr(v)||wa(v)?.transparent===!0,Y=Zt(e,"placeholder")||(k&&!Z?"thumbhash":void 0),Q=Zt(e,"placeholderColor")||"#e5e7eb",se=Zt(e,"provider"),oe=Zt(e,"class")||Zt(e,"className")||"",ie=Zt(e,"style")||"",ce=Zt(e,"quality"),ae=wi(e,"lazy",!0),pe=wi(e,"preload",!1),me=wi(e,"priority",!1),he=Zt(e,"loading"),Se=Zt(e,"decoding")||"async",Ee=!!k||wi(e,"picture",!1)||!!U,Ce=C?Number.parseInt(C):void 0,Re=j?Number.parseInt(j):void 0,Ae=B||"",_e="";if(k)Ae=k.sources[k.fallback.format]||"",_e=L?Sa(L):"100vw";else if(!Ae&&L&&se&&se!=="local"&&se!=="static")Ae=_a(v,$a,se,U),_e=Sa(L);else if(!Ae&&F){let dt=F.split(/\s+/).map((ht)=>Number.parseFloat(ht.replace("x","")));Ae=Oh(v,dt,Ce,se,U)}else if(L)_e=Sa(L);let Te=[];if(ie)Te.push(ie);if(Ce&&Re)Te.push(`aspect-ratio:${Ce}/${Re}`);let Me=[],De=Y==="blur"||Y==="color"||Y==="thumbhash";if(De&&!Z){let dt=k?.placeholder?{dataUrl:k.placeholder.dataUrl,color:Q}:wa(v);if(dt&&Y==="color")Te.push(`background-color:${dt.color}`),Me.push("backgroundColor");else if(dt)Te.push(`background-color:${dt.color}`),Te.push(`background-image:url(${dt.dataUrl})`),Te.push("background-size:cover"),Te.push("background-repeat:no-repeat"),Me.push("backgroundColor","backgroundImage");else{let ht=jh(Ce||16,Re||9,Q);Te.push(`background-image:url(${ht})`),Te.push("background-size:cover"),Te.push("background-repeat:no-repeat"),Me.push("backgroundImage")}}else if(!De&&Y&&Y!=="empty"&&Y!=="none")Te.push(`background-image:url(${zt(Y)})`),Te.push("background-size:cover"),Te.push("background-repeat:no-repeat"),Me.push("backgroundImage");let Ie=k?.fallback.url||xs(v,Ce,Re,se,U),Oe=[];if(Oe.push(`src="${zt(Mr(Ie,"fetched"))}"`),Oe.push(`alt="${zt(E)}"`),C)Oe.push(`width="${zt(C)}"`);if(j)Oe.push(`height="${zt(j)}"`);let tt=he||(me||pe?"eager":ae?"lazy":"");if(tt)Oe.push(`loading="${zt(tt)}"`);if(me)Oe.push('fetchpriority="high"');if(Oe.push(`decoding="${zt(Se)}"`),oe)Oe.push(`class="${zt(oe)}"`);if(Te.length>0)Oe.push(`style="${zt(Te.join(";"))}"`);if(Ae)Oe.push(`srcset="${zt(Mr(Ae,"fetched"))}"`);if(_e)Oe.push(`sizes="${zt(_e)}"`);let ot=new Set(["src","alt","width","height","lazy","sizes","srcset","placeholder","placeholderColor","class","className","style","format","provider","quality","densities","preload","priority","picture","loading","decoding"]);if(Me.length>0){let dt=typeof e.static.onload==="string"?e.static.onload:"",ht=Nh(Me)+(dt?`;${dt}`:"");Oe.push(`onload="${zt(ht)}"`),ot.add("onload")}Oe.push(...$r(e,ot)),Oe.push(...Sr(e,ot));let nt=`<img ${Oe.join(" ")} />`,yt="";if(pe){let ht=U==="webp"?"image/webp":U==="avif"?"image/avif":"";yt=`<link rel="preload" as="image" href="${zt(Ie)}"${ht?` type="${ht}"`:""}${Ae?` imagesrcset="${zt(Ae)}"`:""}${_e?` imagesizes="${zt(_e)}"`:""} />
2264
+ `}if(Ee){let dt=[];if(k)for(let ht of es(k))dt.push(`<source type="image/${ht.format}" srcset="${zt(ht.srcset)}"${_e?` sizes="${zt(_e)}"`:""} />`);if(!k&&(U==="avif"||U==="auto")){let ht=xs(v,Ce,Re,se,"avif"),at=Ae?_a(v,$a,se,"avif"):`${ht}`;dt.push(`<source type="image/avif" srcset="${zt(at)}"${_e?` sizes="${zt(_e)}"`:""} />`)}if(!k&&(U==="webp"||U==="auto")){let ht=xs(v,Ce,Re,se,"webp"),at=Ae?_a(v,$a,se,"webp"):`${ht}`;dt.push(`<source type="image/webp" srcset="${zt(at)}"${_e?` sizes="${zt(_e)}"`:""} />`)}return`${yt}<picture>
2265
+ ${dt.join(`
2266
+ `)}
2267
+ ${nt}
2268
+ </picture>`}return`${yt}${nt}`}};var id="/images/safe-image-default.svg";function vs(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Er(e,o){if(e.serverDynamic[o]!==void 0)return String(e.serverDynamic[o]);let x=e.static[o];if(typeof x==="string")return x;return}var Lh=`<script>window.__stxSafeImageHandler||(window.__stxSafeImageHandler=function(i){if(i.__stx_fb)return;i.__stx_fb=1;var f=i.getAttribute('data-fallback')||'${id}';var c=i.getAttribute('data-fallback-class');i.src=f;if(c)i.className=c;});</script>`,ka={name:"SafeImage",aliases:["safe-image","safe-img"],render(e,o,x){let v=Er(e,"src")||"",k=Er(e,"alt")||"",E=Er(e,"fallback")||id,C=Er(e,"class")||Er(e,"className")||"",j=Er(e,"fallbackClassName")||"",L=[];if(L.push(`src="${vs(v)}"`),L.push(`alt="${vs(k)}"`),C)L.push(`class="${vs(C)}"`);if(L.push(`data-fallback="${vs(E)}"`),j)L.push(`data-fallback-class="${vs(j)}"`);L.push('onerror="window.__stxSafeImageHandler(this)"');let B=new Set(["src","alt","fallback","class","className","fallbackClassName"]);L.push(...$r(e,B)),L.push(...Sr(e,B));let F=`<img ${L.join(" ")} />`,U=x.context;if(!U.__safeImageHandlerEmitted)return U.__safeImageHandlerEmitted=!0,`${Lh}${F}`;return F}};function Ca(e){return e.replace(/[;{}()]/g,"").replace(/url/gi,"")}function Ps(e,o){if(e.serverDynamic[o]!==void 0)return String(e.serverDynamic[o]);let x=e.static[o];if(typeof x==="string")return x;return}function $i(e,o,x){let v=Ps(e,o);if(v!==void 0){let k=Number.parseInt(v,10);if(!Number.isNaN(k))return k}return x}var Ra={name:"StxLoadingIndicator",aliases:["stx-loading-indicator"],render(e,o,x){let v=Ca(Ps(e,"color")||"#6366f1"),k=Ca(Ps(e,"initialColor")||Ps(e,"initial-color")||""),E=Ca(Ps(e,"height")||"3px"),C=$i(e,"duration",2000),j=$i(e,"throttle",200),L=$i(e,"zIndex",999999)||$i(e,"z-index",999999),B=k?`linear-gradient(to right, ${k}, ${v})`:v;return`
2269
+ <div id="stx-loading-indicator" style="position:fixed;top:0;left:0;right:0;height:${E};background:${B};z-index:${L};transform:scaleX(0);transform-origin:left;transition:transform 0.1s ease-out,opacity 0.3s ease;opacity:0;pointer-events:none">
2270
+ <div style="position:absolute;top:0;left:0;right:0;bottom:0;background:linear-gradient(90deg,transparent 0%,rgba(255,255,255,0.4) 50%,transparent 100%);animation:stx-shimmer 1.5s infinite"></div>
2271
+ </div>
2272
+ <style>@keyframes stx-shimmer{0%{transform:translateX(-100%)}100%{transform:translateX(100%)}}</style>
2273
+ <script>
2274
+ (function(){var el=document.getElementById('stx-loading-indicator'),p=0,l=!1,i=null;function u(v){p=Math.min(Math.max(v,0),100);if(el){el.style.opacity=p>0?'1':'0';el.style.transform='scaleX('+(p/100)+')'}}window.stxLoading={start:function(){l=!0;p=0;u(10);if(i)clearInterval(i);i=setInterval(function(){if(!l)return;var r=90-p,inc=Math.max(0.5,r*0.1);if(p<90)u(p+inc)},${j})},finish:function(){l=!1;if(i){clearInterval(i);i=null}u(100);setTimeout(function(){if(el)el.style.opacity='0';setTimeout(function(){p=0;if(el)el.style.transform='scaleX(0)'},300)},200)},set:function(v){u(v)},clear:function(){l=!1;p=0;if(i){clearInterval(i);i=null}if(el){el.style.opacity='0';el.style.transform='scaleX(0)'}}};document.addEventListener('click',function(e){var a=e.target.closest&&e.target.closest('a');if(!a)return;var h=a.getAttribute('href');if(!h||h.startsWith('http')||h.startsWith('#')||h.startsWith('mailto:')||h.startsWith('tel:')||a.target==='_blank')return;window.stxLoading.start()});window.addEventListener('popstate',function(){window.stxLoading.start()});window.addEventListener('load',function(){window.stxLoading.finish()})})();
2275
+ </script>`}};function ad(e,o){if(e.serverDynamic[o]!==void 0)return String(e.serverDynamic[o]);let x=e.static[o];if(typeof x==="string")return x;return}function Bh(e,o,x){let v=ad(e,o);if(v!==void 0){let k=Number.parseInt(v,10);if(!Number.isNaN(k))return k}return x}var od={"top-right":"top:1rem;right:1rem","top-left":"top:1rem;left:1rem","top-center":"top:1rem;left:50%;transform:translateX(-50%)","bottom-right":"bottom:1rem;right:1rem","bottom-left":"bottom:1rem;left:1rem","bottom-center":"bottom:1rem;left:50%;transform:translateX(-50%)"},Aa={name:"StxToast",aliases:["stx-toast"],render(e,o,x){let v=Ut(ad(e,"position")||"top-right"),k=Bh(e,"max",5),E=od[v]||od["top-right"];return`<div id="stx-toast-container" data-stx-toast-position="${v}" data-stx-toast-max="${k}" style="position:fixed;${E};z-index:999999;display:flex;flex-direction:column;gap:0.5rem;pointer-events:none;max-width:24rem;width:100%"></div>
2276
+ <style>
2277
+ @keyframes stx-toast-in{from{opacity:0;transform:translateX(100%)}to{opacity:1;transform:translateX(0)}}
2278
+ @keyframes stx-toast-out{from{opacity:1;transform:translateX(0)}to{opacity:0;transform:translateX(100%)}}
2279
+ @keyframes stx-toast-in-left{from{opacity:0;transform:translateX(-100%)}to{opacity:1;transform:translateX(0)}}
2280
+ @keyframes stx-toast-out-left{from{opacity:1;transform:translateX(0)}to{opacity:0;transform:translateX(-100%)}}
2281
+ @keyframes stx-toast-in-center{from{opacity:0;transform:translateY(-1rem)}to{opacity:1;transform:translateY(0)}}
2282
+ @keyframes stx-toast-out-center{from{opacity:1;transform:translateY(0)}to{opacity:0;transform:translateY(-1rem)}}
2283
+ </style>`}};function Si(e,o){if(e.serverDynamic[o]!==void 0)return String(e.serverDynamic[o]);let x=e.static[o];if(typeof x==="string")return x;return}var cd={sm:"max-width:24rem",md:"max-width:32rem",lg:"max-width:42rem",xl:"max-width:56rem",full:"max-width:calc(100vw - 2rem);max-height:calc(100vh - 2rem)"},Ta={name:"StxModal",aliases:["stx-modal"],render(e,o,x){let v=Si(e,"id");if(!v)return console.warn('[stx] <StxModal> requires an "id" prop'),"<!-- StxModal: missing id prop -->";let k=Ut(v),E=Si(e,"size")||"md",C=Si(e,"closeOnBackdrop")!=="false",j=Si(e,"closeOnEscape")!=="false",L=cd[E]||cd.md;return`<div id="stx-modal-${k}" class="stx-modal-backdrop" data-stx-modal="${k}" data-close-backdrop="${C}" data-close-escape="${j}" style="display:none;position:fixed;inset:0;z-index:99999;align-items:center;justify-content:center;background:rgba(0,0,0,0.5);backdrop-filter:blur(2px);opacity:0;transition:opacity 0.2s ease" aria-modal="true" role="dialog">
2284
+ <div class="stx-modal-panel" style="${L};width:100%;margin:1rem;border-radius:0.75rem;box-shadow:0 20px 60px rgba(0,0,0,0.3);overflow:hidden;transform:scale(0.95) translateY(8px);transition:transform 0.2s ease,opacity 0.2s ease;opacity:0;background:var(--stx-modal-bg,#fff);color:var(--stx-modal-text,#1f2937)">
2285
+ <div style="padding:1.5rem">${o}</div>
2286
+ </div>
2287
+ </div>
2288
+ <style>
2289
+ @media(prefers-color-scheme:dark){[data-stx-modal]{--stx-modal-bg:#1f2937;--stx-modal-text:#f3f4f6}}
2290
+ .stx-modal-backdrop[data-stx-modal-open]{display:flex!important;opacity:1}
2291
+ .stx-modal-backdrop[data-stx-modal-open] .stx-modal-panel{transform:scale(1) translateY(0);opacity:1}
2292
+ </style>`}};function kr(e,o){if(e.serverDynamic[o]!==void 0)return String(e.serverDynamic[o]);let x=e.static[o];if(typeof x==="string")return x;return}var ld={sm:"16rem",md:"24rem",lg:"32rem",xl:"40rem"},Ia={name:"StxDrawer",aliases:["stx-drawer"],render(e,o,x){let v=kr(e,"id");if(!v)return console.warn('[stx] <StxDrawer> requires an "id" prop'),"<!-- StxDrawer: missing id prop -->";let k=Ut(v),E=kr(e,"side")||"right",C=kr(e,"size")||"md",j=kr(e,"closeOnBackdrop")!=="false",L=kr(e,"closeOnEscape")!=="false",B=kr(e,"overlay")!=="false",F=ld[C]||ld.md,U=E==="left",Z=U?"left:0":"right:0",Y=U?"translateX(-100%)":"translateX(100%)",Q=U?"stx-drawer-slide-left":"stx-drawer-slide-right";return`<div id="stx-drawer-${k}" class="stx-drawer-backdrop" data-stx-drawer="${k}" data-close-backdrop="${j}" data-close-escape="${L}" style="display:none;position:fixed;inset:0;z-index:99999;${B?"background:rgba(0,0,0,0.5);backdrop-filter:blur(2px)":"background:transparent;pointer-events:none"};opacity:0;transition:opacity 0.2s ease" role="dialog" aria-modal="true">
2293
+ <div class="stx-drawer-panel" style="position:fixed;top:0;bottom:0;${Z};width:${F};max-width:100vw;transform:${Y};transition:transform 0.3s cubic-bezier(0.4,0,0.2,1);background:var(--stx-drawer-bg,#fff);color:var(--stx-drawer-text,#1f2937);box-shadow:0 20px 60px rgba(0,0,0,0.3);overflow-y:auto;pointer-events:auto">
2294
+ <div style="padding:1.5rem">${o}</div>
2295
+ </div>
2296
+ </div>
2297
+ <style>
2298
+ @media(prefers-color-scheme:dark){[data-stx-drawer]{--stx-drawer-bg:#1f2937;--stx-drawer-text:#f3f4f6}}
2299
+ .stx-drawer-backdrop[data-stx-drawer-open]{display:block!important;opacity:1}
2300
+ .stx-drawer-backdrop[data-stx-drawer-open] .stx-drawer-panel{transform:translateX(0)}
2301
+ </style>`}};import{existsSync as zh,readFileSync as Wh}from"fs";var _i=new Map,ud=new Set;function Fh(e){if(ud.has(e))return;ud.add(e),console.warn(`[stx] icon collection "${e}" is not installed, so its icons render as nothing. Install it with \`bun add -d @iconify-json/${e}\`.`)}function Vh(e){let o=process.cwd();for(let x of[`${o}/node_modules/@iconify-json/${e}/icons.json`,`${o}/pantry/@iconify-json/${e}/icons.json`,`${o}/node_modules/@iconify/json/json/${e}.json`,`${o}/pantry/@iconify/json/json/${e}.json`])if(zh(x))return x;for(let x of[`@iconify-json/${e}/icons.json`,`@iconify/json/json/${e}.json`])try{return u.resolve(x)}catch{}return null}function Uh(e){if(_i.has(e))return _i.get(e);let o=Vh(e);if(!o)return Fh(e),null;try{let x=JSON.parse(Wh(o,"utf8"));return _i.set(e,x.icons),x.icons}catch{return null}}function Cr(e,o){if(e.serverDynamic[o]!==void 0)return String(e.serverDynamic[o]);if(e.static[o]!==void 0)return String(e.static[o]);if(e.clientReactive[o]!==void 0)return e.clientReactive[o];return}var Da={name:"Icon",aliases:["icon","stx-icon"],render(e,o,x){let v=Cr(e,"name")??Cr(e,"icon");if(!v)return"<!-- Icon: missing name/icon prop -->";let k="lucide",E=v;if(v.includes(":")){let ce=v.split(":");k=ce[0],E=ce[1]}let C=Ut(Cr(e,"size")||"24"),j=Ut(Cr(e,"color")||"currentColor"),L=Ut(Cr(e,"class")||""),B=Ut(Cr(e,"style")||""),F=_i.get(k)??Uh(k);if(!F)return`<!-- Icon: collection "${k}" not loaded -->`;let U=F[E];if(!U)return`<!-- Icon: "${E}" not found in ${k} -->`;let Z=U.width||24,Y=U.height||24,Q=`0 0 ${Z} ${Y}`,se=U.body;if(j!=="currentColor")se=se.replace(/currentColor/g,j);let oe=L?` class="${L}"`:"",ie=B?` style="${B}"`:"";return`<svg xmlns="http://www.w3.org/2000/svg" width="${C}" height="${C}" viewBox="${Q}" fill="none"${oe}${ie}>${se}</svg>`}};function Pa(){return`
2302
+ (function(){
2303
+ var tip=null,hideTimer=null,currentEl=null;
2304
+
2305
+ function createTip(){
2306
+ tip=document.createElement("div");
2307
+ tip.id="stx-tooltip";
2308
+ tip.style.cssText="position:absolute;background:#1f2937;color:#fff;font-size:12px;line-height:1.4;padding:6px 10px;border-radius:6px;max-width:250px;z-index:999999;pointer-events:none;opacity:0;transition:opacity .15s ease;white-space:pre-wrap;word-wrap:break-word;box-shadow:0 2px 8px rgba(0,0,0,.25)";
2309
+ var arrow=document.createElement("div");
2310
+ arrow.className="stx-tip-arrow";
2311
+ arrow.style.cssText="position:absolute;width:0;height:0;border:5px solid transparent";
2312
+ tip.appendChild(arrow);
2313
+ var text=document.createElement("span");
2314
+ text.className="stx-tip-text";
2315
+ tip.appendChild(text);
2316
+ document.body.appendChild(tip);
2317
+ }
2318
+
2319
+ function position(el){
2320
+ var pos=el.getAttribute("x-tooltip-position")||"top";
2321
+ var r=el.getBoundingClientRect();
2322
+ var sy=window.scrollY,sx=window.scrollX;
2323
+ tip.style.display="block";
2324
+ tip.style.opacity="0";
2325
+ // Force layout so we can measure
2326
+ var tw=tip.offsetWidth,th=tip.offsetHeight;
2327
+ var arrow=tip.querySelector(".stx-tip-arrow");
2328
+ var left,top;
2329
+
2330
+ if(pos==="top"){
2331
+ left=r.left+r.width/2-tw/2+sx;
2332
+ top=r.top-th-8+sy;
2333
+ if(top-sy<0){pos="bottom";}
2334
+ }
2335
+ if(pos==="bottom"){
2336
+ left=r.left+r.width/2-tw/2+sx;
2337
+ top=r.bottom+8+sy;
2338
+ arrow.style.cssText="position:absolute;width:0;height:0;border:5px solid transparent;border-bottom-color:#1f2937;top:-10px;left:50%;transform:translateX(-50%)";
2339
+ }
2340
+ if(pos==="left"){
2341
+ left=r.left-tw-8+sx;
2342
+ top=r.top+r.height/2-th/2+sy;
2343
+ if(left-sx<0){pos="right";}
2344
+ }
2345
+ if(pos==="right"){
2346
+ left=r.right+8+sx;
2347
+ top=r.top+r.height/2-th/2+sy;
2348
+ arrow.style.cssText="position:absolute;width:0;height:0;border:5px solid transparent;border-right-color:#1f2937;left:-10px;top:50%;transform:translateY(-50%)";
2349
+ }
2350
+
2351
+ // Set arrow for top/left after potential flips
2352
+ if(pos==="top"){
2353
+ arrow.style.cssText="position:absolute;width:0;height:0;border:5px solid transparent;border-top-color:#1f2937;bottom:-10px;left:50%;transform:translateX(-50%)";
2354
+ }
2355
+ if(pos==="left"){
2356
+ arrow.style.cssText="position:absolute;width:0;height:0;border:5px solid transparent;border-left-color:#1f2937;right:-10px;top:50%;transform:translateY(-50%)";
2357
+ }
2358
+
2359
+ // Clamp horizontal
2360
+ if(left<sx+4) left=sx+4;
2361
+ if(left+tw>sx+window.innerWidth-4) left=sx+window.innerWidth-tw-4;
2362
+
2363
+ tip.style.left=left+"px";
2364
+ tip.style.top=top+"px";
2365
+ tip.style.opacity="1";
2366
+ }
2367
+
2368
+ function showTip(el){
2369
+ if(hideTimer){clearTimeout(hideTimer);hideTimer=null;}
2370
+ if(!tip) createTip();
2371
+ var text=el.getAttribute("x-tooltip");
2372
+ if(!text) return;
2373
+ tip.querySelector(".stx-tip-text").textContent=text;
2374
+ currentEl=el;
2375
+ position(el);
2376
+ }
2377
+
2378
+ function hideTip(){
2379
+ if(!tip) return;
2380
+ tip.style.opacity="0";
2381
+ hideTimer=setTimeout(function(){
2382
+ if(tip) tip.style.display="none";
2383
+ currentEl=null;
2384
+ },150);
2385
+ }
2386
+
2387
+ document.addEventListener("mouseover",function(e){
2388
+ var el=e.target.closest("[x-tooltip]");
2389
+ if(el) showTip(el);
2390
+ });
2391
+ document.addEventListener("mouseout",function(e){
2392
+ var el=e.target.closest("[x-tooltip]");
2393
+ if(el&&el===currentEl) hideTip();
2394
+ });
2395
+ document.addEventListener("focusin",function(e){
2396
+ var el=e.target.closest("[x-tooltip]");
2397
+ if(el) showTip(el);
2398
+ });
2399
+ document.addEventListener("focusout",function(e){
2400
+ var el=e.target.closest("[x-tooltip]");
2401
+ if(el) hideTip();
2402
+ });
2403
+ })();
2404
+ `}function dd(e,...o){for(let x of o){if(e.serverDynamic[x]!==void 0)return String(e.serverDynamic[x]);let v=e.static[x];if(typeof v==="string")return v}return}function pd(e,o){let x=new RegExp(`<(template|div|span)[^>]*\\bslot=["']${o}["'][^>]*>([\\s\\S]*?)<\\/\\1>`,"i"),v=e.match(x);if(!v)return{region:null,rest:e};return{region:v[2],rest:e.replace(v[0],"")}}var Ma={name:"Suspense",aliases:["suspense"],render(e,o,x){let v=pd(o,"fallback"),k=v.rest,E=pd(k,"error"),C=E.rest,j=v.region??dd(e,"fallback")??'<div class="stx-suspense-loading">Loading\u2026</div>',L=E.region??dd(e,"errorFallback","error-fallback")??'<div class="stx-suspense-error">Something went wrong.</div>';return`<div data-stx-suspense><div data-stx-suspense-fallback>${j}</div><div data-stx-suspense-error hidden>${L}</div><div data-stx-suspense-content hidden>${C}</div></div>`}};function Ei(e,...o){for(let x of o){if(e.serverDynamic[x]!==void 0)return String(e.serverDynamic[x]);let v=e.static[x];if(typeof v==="string")return v}return}var Oa={name:"TransitionGroup",aliases:["transition-group"],render(e,o,x){let v=(Ei(e,"name")||"v").replace(/["'<>]/g,""),k=(Ei(e,"tag")||"div").replace(/[^a-z0-9-]/gi,"")||"div",E=Ei(e,"class"),C=Ei(e,"id"),j=[`data-stx-transition-group="${v}"`,E?`class="${E}"`:"",C?`id="${C}"`:""].filter(Boolean).join(" ");return`<${k} ${j}>${o}</${k}>`}};function fd(e=wr){e.registerBuiltin(ga),e.registerBuiltin(Ea),e.registerBuiltin(ka),e.registerBuiltin(Ra),e.registerBuiltin(Aa),e.registerBuiltin(Ta),e.registerBuiltin(Ia),e.registerBuiltin(Da),e.registerBuiltin(Ma),e.registerBuiltin(Oa)}function ki(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}var gd=new Map;function Hh(e){let o=gd.get(e.source);if(!o)o=new RegExp(`(${e.source})(?![\\w.:-])`,"y"),gd.set(e.source,o);return o}var md=new WeakMap;function hd(e){let o=md.get(e);if(!o)o=new Set([...e].map((v)=>v.toLowerCase())),md.set(e,o);let x=o;return(v)=>!/[a-z]/.test(v)&&x.has(v.toLowerCase())}function yd(e,o,x){let v=[],k=0,E=typeof x==="function"?x:x?(C)=>x.has(C.toLowerCase()):void 0;while(k<e.length){let C=e.indexOf("<",k);if(C===-1)break;let j=Hh(o);j.lastIndex=C+1;let L=j.exec(e);if(!L){k=C+1;continue}let B=L[1];if(E&&E(B)){let oe=C+1+B.length;while(oe<e.length&&e[oe]!==">")oe++;k=oe+1;continue}let F=C+1+B.length,U=null,Z=F,Y=-1,Q=!1;while(F<e.length){let oe=e[F];if(U){if(oe==="\\"&&F+1<e.length){F+=2;continue}if(oe===U)U=null;F++;continue}if(oe==='"'||oe==="'"){U=oe,F++;continue}if(oe==="/"&&F+1<e.length&&e[F+1]===">"){Y=F+2,Q=!0;break}if(oe===">"){Y=F+1;break}F++}if(Y===-1){k=C+1;continue}let se=e.slice(Z,Q?Y-2:Y-1).trim();if(Q)v.push({fullMatch:e.slice(C,Y),tagName:B,attributes:se,content:"",startIndex:C,endIndex:Y,isSelfClosing:!0}),k=Y;else{let oe=`<${B}`,ie=`</${B}>`,ce=1,ae=Y,pe=-1;while(ce>0&&ae<e.length){let Se=e.indexOf(oe,ae),Ee=e.indexOf(ie,ae);if(Ee===-1)break;if(Se!==-1&&Se<Ee){let Ce=e[Se+oe.length];if(Ce===" "||Ce===">"||Ce==="/"||Ce===`
2405
+ `||Ce==="\t")ce++;ae=Se+oe.length}else{if(ce--,ce===0){pe=Ee;break}ae=Ee+ie.length}}if(pe===-1){k=Y;continue}let me=e.slice(Y,pe),he=pe+ie.length;v.push({fullMatch:e.slice(C,he),tagName:B,attributes:se,content:me,startIndex:C,endIndex:he,isSelfClosing:!1}),k=he}}return v}function xd(e){return e.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#0?39;/g,"'").replace(/&#x27;/gi,"'").replace(/&amp;/g,"&")}function bd(e,o){try{let x=Buffer.from(e,"base64").toString("utf8");return JSON.parse(x)}catch{}try{let x=e.replace(/&quot;/g,'"').replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&");return JSON.parse(x)}catch(x){if(o?.debug)console.error("Error decoding __stx_ prop:",x);return e}}function Na(e,o){let x=0,v="",k=o;while(k<e.length){let E=e[k];if(v){if(E==="\\")k++;else if(E===v)v=""}else if(E==='"'||E==="'"||E==="`")v=E;else if(E==="{")x++;else if(E==="}"){if(x--,x===0)return e.slice(o,k+1)}k++}return e.slice(o)}function vd(e){let o=e.trim();if(!o.startsWith("{")||!o.endsWith("}"))return null;if(Na(o,0).length!==o.length)return null;return o.slice(1,-1).trim()}var qh=new Set(["disabled","checked","readonly","required","autofocus","autoplay","controls","default","defer","formnovalidate","hidden","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","reversed","selected"]),Xh=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function ja(e){let o=[],x=/<([a-zA-Z][a-zA-Z0-9-]*)\b((?:[^>"']|"[^"]*"|'[^']*')*)\s*\/?>/g,v;while((v=x.exec(e))!==null){let k=v[2]||"";if(!/(?:^|\s)(?::for|x-for|v-for|@for)\s*=/.test(k))continue;let E=v.index,C=E+v[0].length,j=v[1].toLowerCase();if(v[0].endsWith("/>")||Xh.has(j)){o.push([E,C]);continue}let L=j.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),B=new RegExp(`<\\/?${L}\\b(?:[^>"']|"[^"]*"|'[^']*')*>`,"gi");B.lastIndex=C;let F=1,U=C,Z;while((Z=B.exec(e))!==null)if(Z[0].startsWith("</")){if(F--,F===0){U=Z.index+Z[0].length;break}}else if(!Z[0].endsWith("/>"))F++;o.push([E,U])}return o}function wd(e){if(typeof e==="string")return e;if(Array.isArray(e))return e.filter(Boolean).map((o)=>wd(o)).join(" ");if(e&&typeof e==="object")return Object.entries(e).filter(([,o])=>o).map(([o])=>o).join(" ");return e?String(e):""}function $d(e,o){if(!/:[\w-]+=/.test(e))return e;let x=e,v=/<(script|style)\b[^>]*>[\s\S]*?<\/\1>/gi,k=[],E;while((E=v.exec(e))!==null)k.push([E.index,E.index+E[0].length]);k.push(...ja(e));function C(U){return k.some(([Z,Y])=>U>=Z&&U<Y)}let j=/<([a-zA-Z][a-zA-Z0-9-]*)\b((?:[^>"']|"[^"]*"|'[^']*')*?)\s*(\/?)>/g,L=[],B=new Map,F=256;while((E=j.exec(x))!==null){if(C(E.index))continue;let U=E[0],Z=E[2];if(!Z||!Z.includes(":"))continue;let Y=/\s:([a-zA-Z_][\w-]*)\s*=\s*"([^"]*)"/g,Q,se=Z,oe=!1;while((Q=Y.exec(Z))!==null){let ie=Q[1],ce=Q[2];if(Eo(ie))continue;if(ce.includes("()")&&!ce.includes(".get(")||ce.includes("$store")||ce.includes("$ref"))continue;try{let ae=Object.keys(o),pe=Object.values(o),me=ce.match(/^([a-zA-Z_$][\w$]*)/);if(me&&!ae.includes(me[1])&&!["true","false","null","undefined","Math","JSON","String","Number","Array","Object","Date","parseInt","parseFloat"].includes(me[1]))continue;let he=JSON.stringify([ae,ce]),Se=B.get(he);if(!Se){if(Se=Function(...ae,`return (${ce})`),B.size>=F)B.clear();B.set(he,Se)}let Ee=Se(...pe);if(ie==="class"){let Ce=wd(Ee);if(Ce){let Re=se.match(/\sclass="([^"]*)"/);if(Re)se=se.replace(Re[0],` class="${Re[1]} ${Ce}"`);else se=se.replace(Q[0],` class="${Ce}"`)}else se=se.replace(Q[0],"");oe=!0;continue}if(qh.has(ie)){if(Ee)se=se.replace(Q[0],` ${ie}`);else se=se.replace(Q[0],"");oe=!0;continue}if(Ee===null||Ee===void 0||Ee===!1)se=se.replace(Q[0],"");else{let Ce=String(Ee).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;");se=se.replace(Q[0],` ${ie}="${Ce}"`)}oe=!0}catch{continue}}if(oe){let ie=E[3]?" /":"",ae=`<${E[1]}${se}${ie}>`;L.push({start:E.index,end:E.index+U.length,replacement:ae})}}if(L.length>0){let U=Array(L.length*2+1),Z=0;for(let Y=0;Y<L.length;Y++){let{start:Q,end:se,replacement:oe}=L[Y];U[Y*2]=x.slice(Z,Q),U[Y*2+1]=oe,Z=se}U[L.length*2]=x.slice(Z),x=U.join("")}return x}import Sd from"fs";import _d from"path";var Ms=new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","component","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","link","main","map","mark","menu","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","slot","small","source","span","strong","style","sub","summary","sup","svg","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","path","circle","rect","line","polygon","polyline","ellipse","text","tspan","textPath","g","defs","use","symbol","image","clipPath","mask","pattern","marker","linearGradient","radialGradient","stop","filter","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDropShadow","feFlood","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","foreignObject","animate","animateMotion","animateTransform","set","mpath","desc","metadata","switch","view"]);function rn(e){if(e.includes("-")||e==="component")return!1;if(/^[A-Z]/.test(e))return!/[a-z]/.test(e)&&[...Ms].some((o)=>o.toLowerCase()===e.toLowerCase());return Ms.has(e)||/[A-Z]/.test(e)}var Ed=!1;function Kh(e,o,x,v=!1){let k={static:{},staticNames:{},serverDynamic:{},serverDynamicNames:{},clientReactive:{},events:{}},E=new Set(Array.isArray(o.__stx_client_signal_names)?o.__stx_client_signal_names:[]),C=(F)=>{if(E.size===0)return!1;let U=s(F),Z=U.match(/^\s*[!+~(-]*\s*([a-zA-Z_$][\w$]*)/)?.[1];if(Z&&E.has(Z))return!0;for(let Y of E){let Q=Y.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(new RegExp(`(?:^|[^\\w$.])${Q}\\s*\\(`).test(U))return!0}return!1},j=new Set(To),L=(F)=>{if(!F.includes("-")||F.startsWith("@")||F.startsWith(":")||F.startsWith("x-")||F.startsWith("__"))return F;if(F.startsWith("aria-")||F.startsWith("data-"))return F;return F.replace(/-([a-z0-9])/g,(U,Z)=>Z.toUpperCase())},B=(F,U)=>{let Z=L(F);if(k.static[Z]=U,Z!==F)k.staticNames[Z]=F};for(let[F,U]of Object.entries(e)){let Z=F.startsWith("x-")&&!j.has(F)&&!F.startsWith("x-bind:")&&!F.startsWith("x-on:")?`:${F.slice(2)}`:F;if(Z.startsWith("@")){k.events[Z]=U;continue}if(Z.startsWith("__stx_")){let Y=L(Z.slice(6));k.serverDynamic[Y]=bd(U,x);continue}if(Z.startsWith(":")){let Y=L(Z.slice(1)),Q=U===lr?Y:U;if(Y==="if"||Y==="for"||Y==="show"){k.clientReactive[Y]=Q;continue}if(v){k.clientReactive[Y]=Q;continue}if(C(Q)){k.clientReactive[Y]=Q;continue}try{if(!p(Q)){if(x.debug)console.error(`Unsafe expression in :${Y} binding: ${Q}`);k.clientReactive[Y]=Q;continue}let se=Object.keys(o),oe=new Set(["true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","if","else"]);if(ke(Q).some((pe)=>!oe.has(pe)&&!se.includes(pe)&&!(pe in globalThis))){k.clientReactive[Y]=Q;continue}let ae=l(Q,se)(...Object.values(o));if(k.serverDynamic[Y]=ae,Y!==Z.slice(1)&&k.serverDynamicNames)k.serverDynamicNames[Y]=Z.slice(1)}catch{k.clientReactive[Y]=Q}continue}if(typeof U==="string"&&U.includes("{{")&&U.includes("}}")){let Y=U.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(Y)try{let Q=Y[1];if(p(Q)){let oe=l(Q,Object.keys(o))(...Object.values(o));B(Z,oe!=null?String(oe):"")}else{if(x.debug)console.error(`Unsafe expression in ${Z}: ${Q}`);B(Z,U)}}catch(Q){if(x.debug)console.error(`Error evaluating expression for ${Z}:`,Q);B(Z,U)}else{let Q=U,se=/\{\{\s*([\s\S]+?)\s*\}\}/g,oe;while((oe=se.exec(U))!==null)try{let ie=oe[1];if(!p(ie)){if(x.debug)console.error(`Unsafe expression in ${Z}: ${ie}`);continue}let ae=l(ie,Object.keys(o))(...Object.values(o));Q=Q.replace(oe[0],String(ae??""))}catch(ie){if(x.debug)console.error(`Error evaluating expression in ${Z}:`,ie)}B(Z,Q)}continue}B(Z,U===lr?"true":xd(U))}return k}var Zh=[[/@if\s*\(/,"@endif"],[/@unless\s*\(/,"@endunless"]];function Jh(e,o,x){if(!e.includes("@"))return e;if(!Zh.some(([k,E])=>k.test(e)&&e.includes(E)))return e;try{return Cn(e,o,x)}catch{return e}}function Gh(e){let o={},x=0,v=e.length;while(x<v){while(x<v&&/\s/.test(e[x]))x++;if(x>=v)break;let k="";while(x<v&&!/[\s=]/.test(e[x]))k+=e[x],x++;if(!k)break;while(x<v&&/\s/.test(e[x]))x++;if(x<v&&e[x]==="="){x++;while(x<v&&/\s/.test(e[x]))x++;let E="";if(x<v&&(e[x]==='"'||e[x]==="'")){let C=e[x];x++;while(x<v){let j=e[x];if(j==="\\"&&x+1<v){x++,E+=e[x],x++;continue}if(j===C){x++;break}E+=j,x++}}else if(e[x]==="{"){E=Na(e,x),x+=E.length;let C=vd(E);if(C!==null){o[`:${k}`]=C;continue}}else while(x<v&&!/\s/.test(e[x]))E+=e[x],x++;o[k]=E}else o[k]=lr}return o}function kd(e){return Object.entries(e).map(([o,x])=>x===lr?o:`${o}="${Yh(x)}"`).join(" ")}function Yh(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Qh(e){let o=new Set,x=/<([A-Z][A-Za-z0-9]*|stx-[a-z0-9-]+)\b[^>]*>/g,v;while((v=x.exec(e))!==null){let k=v[1];if(wr.isBuiltin(k))o.add(k)}return[...o].sort()}async function Qa(e,o,x,v,k){if(!/import\s/.test(e))return e;if(!o.__importedComponents)o.__importedComponents=new Map;let E=o.__importedComponents,C=_d.dirname(x),j=[],L=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi;for(let U of e.matchAll(L)){let[Z,Y,Q]=U,se=/import\s+(?:(\{[^}]*\})|([A-Za-z_$][\w$]*))\s+from\s+['"]([^'"]+)['"]\s*;?\s*\n?/g,oe=Q,ie,ce=[];while((ie=se.exec(Q))!==null){let[ae,pe,me,he]=ie,Se=null,Ee=null;if(he.startsWith(".")||he.startsWith("/")){let Ae=_d.resolve(C,he);if(Ae.endsWith(".stx"))Ee=Ae;else{let _e=`${Ae}.stx`;try{if(Sd.statSync(_e).isFile())Ee=_e}catch{try{if(Sd.statSync(Ae).isDirectory())Se=Ae}catch{}}}}else Se=fi(he,C);if(!Se&&!Ee)continue;let Ce=!1,Re=(Ae,_e)=>{E.set(Ae,_e),E.set(Ae.toLowerCase(),_e);let Te=Ae.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();E.set(Te,_e),k.add(_e)};if(me&&Ee)Re(me,Ee),Ce=!0;else if(pe){let Ae=pe.slice(1,-1).split(",").map((Te)=>Te.trim()).filter(Boolean).map((Te)=>{let Me=Te.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(Me)return{source:Me[1],local:Me[2]};return{source:Te,local:Te}}),_e=Se?pi(Se):null;for(let{source:Te,local:Me}of Ae){let De=null;if(Ee)De=Ee;else if(_e)De=_e.get(Te)??_e.get(Te.toLowerCase())??_e.get(Te.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase())??null;if(De)Re(Me,De),Ce=!0}}if(Ce)ce.push({start:ie.index,end:ie.index+ae.length})}if(ce.length===0)continue;for(let ae=ce.length-1;ae>=0;ae--)oe=oe.slice(0,ce[ae].start)+oe.slice(ce[ae].end);j.push({start:U.index,end:U.index+Z.length,value:`<script${Y}>${oe}</script>`})}if(j.length===0)return e;let B=[],F=0;for(let U of j)B.push(e.slice(F,U.start),U.value),F=U.end;return B.push(e.slice(F)),B.join("")}async function ey(e,o,x,v,k){let E=e;if(!o.__importedComponents)o.__importedComponents=new Map;let C=o.__importedComponents,j=/@import\s*\(\s*([^)]+)\s*\)/g,L;while((L=j.exec(E))!==null){let[B,F]=L,U=F.split(",").map((Z)=>Z.trim().replace(/^['"]|['"]$/g,"")).filter((Z)=>Z.length>0);for(let Z of U){let Y=Z.split("/"),se=Y[Y.length-1].replace(/\.stx$/,""),oe=se.includes("-")?se.split("-").map((ae)=>ae.charAt(0).toUpperCase()+ae.slice(1)).join(""):se.charAt(0).toUpperCase()+se.slice(1),ie=null,ce=gi(Z,x,v);for(let ae of ce)try{if(await Bun.file(ae).exists()){ie=ae;break}}catch{}if(ie){C.set(oe,ie),C.set(se,ie),C.set(se.toLowerCase(),ie);let ae=oe.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(C.set(ae,ie),k.add(ie),v.debug)console.log(`Imported component: ${oe} -> ${ie}`)}else if(v.debug)console.warn(`Could not resolve imported component: ${Z}`)}E=E.replace(B,""),j.lastIndex=0}return E}async function ty(e,o,x,v,k){let E=e,C=v.componentsDir||"components";if(!o.__processedComponents)o.__processedComponents=new Set;let j=o.__processedComponents,L=/@component\s*\(/g,B;while((B=L.exec(E))!==null){let F=B.index,U=F+B[0].length-1,Z=1,Y=U+1;while(Y<E.length&&Z>0){if(E[Y]==="(")Z++;else if(E[Y]===")"){if(Z--,Z===0)break}Y++}if(Z!==0)break;let Q=E.substring(U+1,Y),se=Y+1,oe=Q.match(/^\s*['"]([^'"]+)['"]/);if(!oe){L.lastIndex=0;continue}let ie=oe[1],ce,ae=Q.slice(oe[0].length),pe=ae.match(/^\s*,\s*/);if(pe)ce=ae.slice(pe[0].length).trim();let me={};if(ce)try{me=I(ce,o)}catch(Ae){let _e=Ae instanceof Error?Ae.message:String(Ae);E=E.replace(E.substring(F,se),`[Error parsing component props: ${_e}]`);continue}let he="",Se=se,Ce=E.substring(se).match(/^([\s\S]*?)@endcomponent/);if(Ce)he=Ce[1].trim(),Se=se+Ce[0].length;let Re=await We(ie,me,he,C,o,x,v,j,k);E=E.substring(0,F)+Re+E.substring(Se),L.lastIndex=0}return E}async function ny(e,o,x,v,k){if(!e)return e;let E=e,C=v.componentsDir||"components";if(!o.__processedComponents)o.__processedComponents=new Set;let j=o.__processedComponents,L=V(E);E=L.output;let B=ja(E);return E=await Y(E,/[a-z][a-z0-9]*-[a-z0-9-]*/,!1),E=await Y(E,/[A-Z][a-zA-Z0-9]*/,!0,hd(Ms)),E=await Y(E,/[a-z][a-z0-9]*/,!1,Ms),E=L.restore(E),E;async function Y(Q,se,oe,ie){if(!Q)return Q;let ce=Q,ae=yd(ce,se,ie),pe=new Map;for(let Se=ae.length-1;Se>=0;Se--){let Ee=ae[Se],Ce=oe?ki(Ee.tagName):Ee.tagName,Re=Gh(Jh(Ee.attributes,o,x)),Ae=B.some(([tt,ot])=>Ee.startIndex>=tt&&Ee.startIndex<ot),_e=Kh(Re,o,v,Ae),Te=wr.getBuiltin(Ee.tagName),Me=Te?await qn(Ce,C,o,x,v):!1;if(Te&&!Me){let tt={context:o,filePath:x,options:v,dependencies:k},ot=Te.render(_e,Ee.content,tt);if(Object.keys(_e.events).length>0){let nt=kd(_e.events);ot=ot.replace(/^(\s*<[a-zA-Z][a-zA-Z0-9-]*)/,`$1 ${nt}`)}if(Object.keys(_e.clientReactive).length>0)ot=Cd(ot,_e.clientReactive);pe.set(Se,ot);continue}if(!oe&&Ee.tagName.includes("-")&&!await qn(Ce,C,o,x,v))continue;let De={};for(let[tt,ot]of Object.entries(_e.static))De[tt]=ot;for(let[tt,ot]of Object.entries(_e.serverDynamic))De[tt]=ot;let Oe=await We(Ce,De,L.restore(Ee.content),C,o,x,v,j,k);if(Object.keys(_e.events).length>0){let tt=Rd(Oe);if(tt){let ot=kd(_e.events),nt=Object.keys(_e.events).map((yt)=>yt.replace(/^@/,"").split(".")[0]).join(" ");Oe=Oe.substring(0,tt.insertPos)+` data-stx-parent-events="${nt}" ${ot}`+Oe.substring(tt.insertPos)}}if(Object.keys(_e.clientReactive).length>0)Oe=Cd(Oe,_e.clientReactive);pe.set(Se,Oe)}if(pe.size===0)return ce;let me="",he=0;for(let Se=0;Se<ae.length;Se++){let Ee=pe.get(Se);if(Ee===void 0)continue;me+=ce.slice(he,ae[Se].startIndex),me+=Ee,he=ae[Se].endIndex}return me+=ce.slice(he),me}}function Cd(e,o){let x=new Set(["if","for"]),v=new Set(["show"]),k=Object.entries(o).filter(([F])=>!x.has(F)),E=k.filter(([F])=>!v.has(F)).map(([F])=>ki(F)).join(" "),C=e,j=k.length>0?Rd(C):null;if(j){let F=k.map(([Z,Y])=>`:${ki(Z)}="${Y.replace(/"/g,"&quot;")}"`).join(" "),U=E?` data-stx-parent-bindings="${E}"`:"";C=C.substring(0,j.insertPos)+`${U} ${F}`+C.substring(j.insertPos)}let L=o.if;if(L)C=`<template :if="${L.replace(/"/g,"&quot;")}">${C}</template>`;let B=o.for;if(B)C=`<template :for="${B.replace(/"/g,"&quot;")}">${C}</template>`;return C}function Rd(e){let o=/<([a-zA-Z][a-zA-Z0-9-]*)\b[^>]*\bdata-stx-scope(?:\s|=|>)/i.exec(e);if(o)return{insertPos:o.index+1+o[1].length};let x=0;while(x<e.length){let v=e.slice(x),k=v.match(/^\s+/);if(k){x+=k[0].length;continue}if(v.startsWith("<!--")){let j=e.indexOf("-->",x+4);if(j===-1)return null;x=j+3;continue}let E=v.match(/^<(script|style)\b[^>]*>/i);if(E){let j=`</${E[1].toLowerCase()}>`,L=e.toLowerCase().indexOf(j,x+E[0].length);if(L===-1)return null;x=L+j.length;continue}let C=v.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(?:\s|>|\/)/);if(!C)return null;return{insertPos:x+1+C[1].length}}return null}async function ts(e,o,x,v,k){if(!Ed)fd(wr),Ed=!0;let E=await Qa(e,o,x,v,k);E=await ey(E,o,x,v,k),E=await ty(E,o,x,v,k);let C=[];for(let j=0;j<3;j++){let L=C.length,B=ne(E,xe,(U,Z)=>`\x00STX_COMPONENT_COMMENT_${L+Z}\x00`,`STX_COMPONENT_COMMENT:${L}`);C.push(...B.tokens);let F=E;if(E=await ny(B.output,o,x,v,k),E===F)break}if(C.length>0)E=E.replace(/\x00STX_COMPONENT_COMMENT_(\d+)\x00/g,(j,L)=>C[Number(L)]??"");if(v.debug){let j=Qh(E);if(j.length>0)console.warn(`[stx] ${x}: unresolved component tag(s) after render passes: ${j.join(", ")}. Check nested component output for malformed root tags or recursive component markup.`)}return E}function La(e,o){let x=0;for(let v=o;v<e.length;v++){let k=e[v];if(k==="("||k==="["||k==="{")x++;else if(k===")"||k==="]"||k==="}")x--;else if(k===","&&x===0)return v}return-1}function sy(e,o,x){let v=e,k=new RegExp(`${o.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),E=k.exec(v);while(E){let C=E.index,j=C+E[0].length-1,L=1,B=j+1;while(B<v.length&&L>0){if(v[B]==="(")L++;else if(v[B]===")")L--;B++}if(L!==0)break;let F=v.substring(j+1,B-1),U=`${x}(${F})`;v=v.substring(0,C)+U+v.substring(B),k.lastIndex=C+U.length,E=k.exec(v)}return v}function iy(e){return/\b(state|derived|effect)\s*(?:<[^<>()]*>)?\s*\(/.test(e)}function Dd(e){let o=e,x=[],v=new Set,k=0,E=0,C=o.length,j=(U)=>{E++;while(E<C){if(o[E]==="\\"){E+=2;continue}if(o[E]===U){E++;return}E++}},L=()=>{E++;while(E<C){if(o[E]==="\\"){E+=2;continue}if(o[E]==="`"){E++;return}if(o[E]==="$"&&o[E+1]==="{"){E+=2;let U=1;while(E<C&&U>0)if(o[E]==="{")U++,E++;else if(o[E]==="}")U--,E++;else if(o[E]==="'"||o[E]==='"')j(o[E]);else if(o[E]==="`")L();else E++;continue}E++}},B=()=>{if(o[E]==="/"&&o[E+1]==="/"){while(E<C&&o[E]!==`
2406
+ `)E++;return!0}if(o[E]==="/"&&o[E+1]==="*"){E+=2;while(E<C-1&&!(o[E]==="*"&&o[E+1]==="/"))E++;return E+=2,!0}return!1},F=()=>{if(k!==0)return;let U=o.slice(E).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(U){let Q=U[2];if(!v.has(Q))x.push(Q),v.add(Q);return}let Z=o.slice(E).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(Z){let Q=Z[1];if(!v.has(Q))x.push(Q),v.add(Q);return}let Y=o.slice(E).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(Y){let Q=Y[1];if(!v.has(Q))x.push(Q),v.add(Q)}};while(E<C){if(B())continue;if(o[E]==="'"||o[E]==='"'){j(o[E]);continue}if(o[E]==="`"){L();continue}if(o[E]==="{"){k++,E++;continue}if(o[E]==="}"){k--,E++;continue}if(k===0&&/[a-z]/i.test(o[E])&&(E===0||/\s|[;{}()]/.test(o[E-1])))F();E++}return x.join(", ")}function oy(e,o=""){let x=Dd(e).split(",").map((v)=>v.trim()).filter(Boolean);return`
2407
+ (function() {
2408
+ ${It("var",x)}
2409
+ var __destroyHooks = [];
2410
+ var __origOnDestroy = onDestroy;
2411
+ onDestroy = function(fn) { __origOnDestroy(fn); __destroyHooks.push(fn); };
2412
+
2413
+ ${e}
2414
+ ${o}})();
2415
+ `}function ay(e,o){let k=Dd(e).split(",").map((E)=>E.trim()).filter(Boolean).map((E)=>` try { __scopeRegistration[${JSON.stringify(E)}] = ${E}; } catch (e) { /* not actually top-level */ }`).join(`
2416
+ `);return`
2417
+ // Register scope variables for STX runtime
2418
+ if (!window.stx._scopes) window.stx._scopes = {};
2419
+ var __scopeRegistration = window.stx._scopes['${o}'] || { __destroyCallbacks: __destroyHooks };
2420
+ ${k}
2421
+ // #1767: when the bundler renamed a component const that collided with an
2422
+ // inlined import (foo -> foo2), rebind the ORIGINAL template name to the
2423
+ // renamed declaration so it resolves to the component's value, not the
2424
+ // shadowing import. __stxScopeRenames is emitted by bundleClientScript.
2425
+ try { if (typeof __stxScopeRenames !== 'undefined' && __stxScopeRenames) { for (var __stxRK in __stxScopeRenames) __scopeRegistration[__stxRK] = __stxScopeRenames[__stxRK]; } } catch (e) { /* no renames */ }
2426
+ window.stx._scopes['${o}'] = __scopeRegistration;
2427
+ `}function cy(e,o){return e.replace(/<script data-stx-scoped data-stx-run="always" data-stx-owner="([^"]*)"/g,(x,v)=>v===o?x:'<script data-stx-scoped data-stx-run="always"')}function Ad(e,o){let x=ay(e,o);return ly(oy(e,x),o)}function ly(e,o){let x=`
2428
+ (function() {
2429
+ var __stxScopeEl = (typeof document !== 'undefined') ? document.querySelector('[data-stx-scope="${o}"]') : null;
2430
+ var __stxPrevEl = (typeof window !== 'undefined') ? window.__STX_CURRENT_ELEMENT__ : undefined;
2431
+ if (__stxScopeEl && typeof window !== 'undefined') window.__STX_CURRENT_ELEMENT__ = __stxScopeEl;
2432
+ if (__stxScopeEl && typeof window !== 'undefined' && window.stx) {
2433
+ if (!window.stx._scopes) window.stx._scopes = {};
2434
+ window.stx._scopes['${o}'] = {};
2435
+ }
2436
+ try {`,v=`
2437
+ } finally {
2438
+ if (typeof window !== 'undefined') window.__STX_CURRENT_ELEMENT__ = __stxPrevEl;
2439
+ }
2440
+ })();`;return x+e+`
2441
+ } finally {
2442
+ if (typeof window !== 'undefined') window.__STX_CURRENT_ELEMENT__ = __stxPrevEl;
2443
+ }
2444
+ })();`}function uy(e,o){if(wn(e)){let k=wn(e).tag.match(/data-stx-scope="([^"]*)"/);if(k)return{html:e,mergedIntoExisting:k[1],stamped:!0,root:"body"};return{html:xr(e,(E,C)=>`<body${C} data-stx-scope="${o}">`),mergedIntoExisting:null,stamped:!0,root:"body"}}let x=e.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)(<[a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*>|>)/s);if(x){let v=x[2]+x[3],k=x[2].slice(1),E=v.match(/data-stx-scope="([^"]*)"/);if(E)return{html:e,mergedIntoExisting:E[1],stamped:!0,root:k};let C=x[1],j=x[2],L=x[3];return{html:`${C}${j} data-stx-scope="${o}"${L}${e.slice(x[0].length)}`,mergedIntoExisting:null,stamped:!0,root:k}}return{html:e,mergedIntoExisting:null,stamped:!1,root:null}}var Td=0,Ba=new Set;function Nu(){Ba.clear()}function Id(e){return/\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/i.test(e)}var ve=new z(500),Gi=new Set;function Lu(){Gi.clear()}function dy(e){if(e.__onceStore instanceof Set)return e.__onceStore;return Gi}async function cs(e,o,x,v,k,E=new Set){let C=v.partialsDir||Nt.join(Nt.dirname(x),"partials");if(C&&!Nt.isAbsolute(C))C=Nt.resolve(process.cwd(),C);let j=sy(e,"@partial","@include"),L=dy(o);j=j.replace(/@once([\s\S]*?)@endonce/g,(se,oe,ie)=>{let ce=oe.trim(),ae=`${x}:${ce}`;if(L.has(ae))return"";return L.add(ae),oe});{let se=/@includeIf\s*\(/g,oe;while((oe=se.exec(j))!==null){let ie=oe.index,ce=ie+oe[0].length-1,ae=1,pe=ce+1;while(pe<j.length&&ae>0){if(j[pe]==="(")ae++;else if(j[pe]===")")ae--;pe++}if(ae!==0)break;let me=j.substring(ce+1,pe-1),he=me.match(/^\s*['"]([^'"]+)['"]/);if(!he){se.lastIndex=pe;continue}let Se=he[1],Ee=B(Se,C,x),Ce="";if(Ee&&await Bun.file(Ee).exists())k.add(Ee),Ce=`@include(${me})`;j=j.substring(0,ie)+Ce+j.substring(pe),se.lastIndex=0}}for(let[se,oe]of[["@includeWhen",!1],["@includeUnless",!0]]){let ie=new RegExp(`${se.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),ce;while((ce=ie.exec(j))!==null){let ae=ce.index,pe=ae+ce[0].length-1,me=1,he=pe+1;while(he<j.length&&me>0){if(j[he]==="(")me++;else if(j[he]===")")me--;he++}if(me!==0)break;let Se=j.substring(pe+1,he-1),Ee=La(Se,0);if(Ee===-1){ie.lastIndex=he;continue}let Ce=Se.substring(0,Ee).trim(),Re=Se.substring(Ee+1).trim(),Ae=Re.match(/^\s*['"]([^'"]+)['"]/);if(!Ae){ie.lastIndex=he;continue}let _e=Ae[1],Te=Re.substring(Ae[0].length),Me,De=La(Te,0);if(De!==-1)Me=Te.substring(De+1).trim();try{let Ie=`Boolean(${Ce})`,Oe;if(p(Ie)){let nt=l(Ie,Object.keys(o));Oe=Boolean(nt(...Object.values(o)))}else Oe=Boolean(c(Ie,o));let tt=oe?!Oe:Oe,ot="";if(tt){let nt=B(_e,C,x);if(nt&&await Bun.file(nt).exists())k.add(nt);ot=`@include('${_e}'${Me?`, ${Me}`:""})`}j=j.substring(0,ae)+ot+j.substring(he),ie.lastIndex=0}catch(Ie){let Oe=Ie instanceof Error?Ie.message:String(Ie),tt=g("Include",`Error evaluating ${se} condition: ${Oe}`,x,e,ae);j=j.substring(0,ae)+tt+j.substring(he),ie.lastIndex=0}}}{let se=/@each\s*\(/g,oe;while((oe=se.exec(j))!==null){let ie=oe.index,ce=ie+oe[0].length-1,ae=1,pe=ce+1;while(pe<j.length&&ae>0){if(j[pe]==="(")ae++;else if(j[pe]===")"){if(ae--,ae===0)break}pe++}if(ae!==0)break;let me=j.substring(ce+1,pe),he=j.substring(ie,pe+1),Se=me.match(/^\s*['"]([^'"]+)['"]\s*,\s*([^,]+)\s*,\s*['"]([^'"]+)['"](?:\s*,\s*['"]([^'"]+)['"])?\s*$/);if(!Se){se.lastIndex=0,j=j.replace(he,"");continue}let[,Ee,Ce,Re,Ae]=Se;try{let _e,Te=Ce.trim();if(p(Te))_e=l(Te,Object.keys(o))(...Object.values(o));else _e=c(Te,o);let Me="";if(Array.isArray(_e)&&_e.length>0)for(let De of _e){let Ie={...o,[Re]:De},Oe=await Z(Ee,Ie,e,ie);Me+=Oe}else if(Ae)Me=await Z(Ae,{},e,ie);j=j.substring(0,ie)+Me+j.substring(pe+1),se.lastIndex=0}catch(_e){let Te=_e instanceof Error?_e.message:String(_e);j=j.substring(0,ie)+g("Each",`Error in @each: ${Te}`,x,e,ie)+j.substring(pe+1),se.lastIndex=0}}}{let se=/@includeFirst\s*\(/g,oe;while((oe=se.exec(j))!==null){let ie=oe.index,ce=ie+oe[0].length-1,ae=1,pe=ce+1;while(pe<j.length&&ae>0){if(j[pe]==="(")ae++;else if(j[pe]===")"){if(ae--,ae===0)break}pe++}if(ae!==0)break;let me=j.substring(ce+1,pe),he=j.substring(ie,pe+1),Se=me.match(/^\s*(\[[^\]]+\])/);if(!Se){se.lastIndex=0,j=j.replace(he,"");continue}let Ee=Se[1],Ce=me.slice(Se[0].length),Re,Ae=Ce.match(/^\s*,\s*\{/);if(Ae){Ce=Ce.slice(Ae[0].length-1);let Me=1,De=1;while(De<Ce.length&&Me>0){if(Ce[De]==="{")Me++;else if(Ce[De]==="}"){if(Me--,Me===0)break}De++}Re=Ce.substring(0,De+1),Ce=Ce.slice(De+1)}let _e,Te=Ce.match(/^\s*,\s*['"]([^'"]*)['"]\s*$/);if(Te)_e=Te[1];try{let Me=JSON.parse(Ee.replace(/'/g,'"')),De={};if(Re)try{De=I(Re,o)}catch(Oe){let tt=Oe instanceof Error?Oe.message:String(Oe);if(v.debug){let ot=g("Include",`Error parsing includeFirst variables: ${tt}`,x,e,ie,he);j=j.replace(he,()=>ot)}else j=j.replace(he,()=>_e||"");continue}let Ie=!1;for(let Oe of Me){let tt=B(Oe,C,x);if(!tt)continue;if(await n(tt)){let ot=await Z(Oe,De,e,ie);j=j.replace(he,()=>ot),Ie=!0;break}}if(!Ie)if(_e!==void 0)j=j.replace(he,()=>_e);else if(v.debug){let Oe=g("Include",`None of the includeFirst paths exist: ${Ee}`,x,e,ie,he);j=j.replace(he,()=>Oe)}else j=j.replace(he,"")}catch(Me){let De=Me instanceof Error?Me.message:String(Me),Ie=g("Include",`Error processing @includeFirst: ${De}`,x,e,ie,he);j=j.replace(he,()=>Ie)}se.lastIndex=0}}function B(se,oe,ie){try{let ce=se;if(!se.endsWith(".stx"))ce=`${se}.stx`;let ae=Nt.resolve(oe),pe=Nt.resolve(Nt.dirname(ie)),me;if(!ce.startsWith("./")&&!ce.startsWith("../")){for(let Ae of v._layerPartialDirs??[]){let _e=Nt.resolve(Ae,ce);if(_e.startsWith(`${Nt.resolve(Ae)}${Nt.sep}`)&&ry(_e))return _e}me=Nt.resolve(oe,ce)}else me=Nt.resolve(pe,ce);let he=Nt.normalize(me),Se=he.startsWith(ae+Nt.sep)||he===ae,Ee=he.startsWith(pe+Nt.sep)||he===pe,Ce=!1,Re=Nt.dirname(pe);if(he.startsWith(Re+Nt.sep)){if(!Nt.relative(Re,he).split(Nt.sep).some((Me)=>Me.startsWith(".")&&Me!=="."&&Me!==".."))Ce=!0}if(!Se&&!Ee&&!Ce)return console.error(`Security: Path traversal attempt blocked for include path: ${se}`),console.error(` Resolved to: ${he}`),console.error(` Allowed dirs: ${ae}, ${pe}`),null;return he}catch(ce){return console.error(`Error resolving path ${se}: ${ce}`),null}}let F=Nt.resolve(x);E.add(F);function U(se,oe,ie,ce){return v.onIncludeError?.({includePath:se,templatePath:x,message:oe,partialsDir:C}),g("Include",oe,x,ie,ce)}async function Z(se,oe={},ie,ce){let ae=B(se,C,x);if(!ae)return U(se,`Could not resolve path for include: ${se}`,ie,ce);let pe=Nt.resolve(ae);if(E.has(pe)){let me=[...E,pe].map((he)=>Nt.basename(he)).join(" -> ");return U(se,`Circular include detected: ${me}`,ie,ce)}try{k.add(ae);let me;if(!me)try{me=await Bun.file(ae).text()}catch(at){let Pt=at instanceof Error?at.message:String(at);return U(se,`Error loading include file ${se}: ${Pt}`,ie,ce)}if(me)me=me.replace(/\{\{--[\s\S]*?--\}\}/g,"");if(me&&me.includes("@stream")){let{processStreamDirectives:at}=await import("./chunk-gc1drn2p.js");me=at(me,o)}if(me&&(v.debug||!ge()&&!mn()))try{let{warnUnbalancedTags:at}=await import("./chunk-1b6t12hd.js");at(me,ae)}catch{}let he=me;try{let{processESImports:at}=await import("./chunk-hk1mj4tz.js");await at(me,o,ae,v,k)}catch(at){if(v.debug)console.warn(`[stx] partial ES import extraction skipped for ${ae}:`,at instanceof Error?at.message:at)}let Se=ee(he);if(Se)he=Se.content.trim();let Ce=me.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),Re="";if(Ce)Re=`<style${Ce[1]}>${Ce[2]}</style>`;let Ae=[];he=he.replace(/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,(at,Pt,pt)=>{if(!Id(Pt))return"";return Ae.push({attrs:Pt,body:pt}),`__STX_DATA_BLOCK_${Ae.length-1}__`}),he=he.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let _e={...o};_e.__stx_signals_gate=be(me,ae);for(let[at,Pt]of Object.entries(oe))_e[at]=Pt;let Te=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,Me=[...me.matchAll(Te)],De="",Ie=null,Oe=!1;for(let at of Me){let Pt=at[1]||"",pt=at[2]||"";if(Id(Pt))continue;let Lt=Pt.includes("server"),Sn=Ve(Pt);if(!Lt&&pt.trim()){let{interpolateScriptExpressions:Qe}=await import("./chunk-z8xn5ta3.js");pt=Qe(pt,_e,se)}let fn="";try{let{extractAndStripCssImports:Qe,renderVendorStyleTags:st}=await import("./chunk-nc8my58s.js"),ft=Qe(pt,{filePath:ae,projectRoot:process.cwd()});pt=ft.code,fn=st(ft.styles)}catch(Qe){if(v.debug)console.warn(`[stx] vendor-css extractor skipped for ${ae}:`,Qe instanceof Error?Qe.message:Qe)}if(Sn&&pt.trim())pt=Ue(pt);if(!Lt){try{let{injectBrowserCoreAutoImports:st}=await import("./chunk-nc8my58s.js");pt=st(pt).code;let{hasUserImports:ft,bundleClientScript:Xt}=await import("./chunk-hn9pkyv8.js");if(ft(pt))pt=await Xt(pt,ae,{projectRoot:process.cwd()})}catch(st){if(v.debug)console.warn(`[stx] bundler skipped for ${ae}:`,st instanceof Error?st.message:st)}let{stripStxRuntimeImports:Qe}=await import("./chunk-xwzvfqcb.js");pt=Qe(pt)}let _n=iy(pt);if(_n&&!Lt){Oe=!0,Ie=`stx_scope_${Nt.basename(ae,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++Td}`;let Qe=R(pt),st=Ad(Qe,Ie);De+=`${fn}<script data-stx-scoped data-stx-run="always" data-stx-owner="${Ie}">${st}</script>
2445
+ `;continue}if(Lt)try{let{extractVariables:Qe}=await import("./chunk-w72qx0eb.js");await Qe(pt,_e,ae)}catch(Qe){if(v.debug)console.warn(`Warning: Could not extract variables from server script in ${ae}:`,Qe)}if(!Lt&&!_n){let Qe=Pt.replace(/\bclient\b/i,"").trim();Ie=`stx_scope_${Nt.basename(ae,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++Td}`;let st=R(pt),ft=Ad(st,Ie);De+=`${fn}<script data-stx-scoped data-stx-run="always" data-stx-owner="${Ie}"${Qe?` ${Qe}`:""}>${ft}</script>
2446
+ `}}if(Ae.length>0){let{interpolateScriptExpressions:at}=await import("./chunk-z8xn5ta3.js");he=he.replace(/__STX_DATA_BLOCK_(\d+)__/g,(Pt,pt)=>{let Lt=Ae[Number(pt)];return`<script${Lt.attrs}>${at(Lt.body,_e,se)}</script>`})}if(Ie){let at=uy(he,Ie);if(he=at.html,at.mergedIntoExisting){let pt=Ie,Lt=at.mergedIntoExisting;De=De.split(`'${pt}'`).join(`'${Lt}'`).split(`"${pt}"`).join(`"${Lt}"`),Ie=Lt}else if(!at.stamped&&Oe&&!Ba.has(ae))Ba.add(ae),console.warn(`[stx] ${Nt.relative(process.cwd(),ae)} declares signals but has no element to scope them to, so nothing in it will hydrate. Wrap the partial's markup in a single root element.`);let Pt=at.stamped&&at.root!==null&&rn(at.root);De=cy(De,Pt?Ie:null)}if(he.includes("@include")||he.includes("@partial"))he=await cs(he,_e,ae,v,k,E);let{processLoops:tt,reportDeferredLoopWarnings:ot}=await import("./chunk-h6kp2m9r.js"),nt=tt(he,_e,ae,void 0,!0);nt=Cn(nt,_e,ae),nt=ot(nt);let{processMetaDirectives:yt,processSeoDirective:dt,processStructuredData:ht}=await import("./chunk-hrbbbtbn.js");if(nt=yt(nt,_e,ae,v),nt=ht(nt,_e,ae),nt=dt(nt,_e,ae,v),nt=q(nt,_e,ae),Re)nt+=`
2447
+ `+Re;if(De)nt+=`
2448
+ `+De;return nt}catch(me){let he=me instanceof Error?me.message:String(me);return U(se,`Error processing include ${se}: ${he}`,ie,ce)}}let Y=/@include\s*\(/g,Q;while((Q=Y.exec(j))!==null){let se=Q.index,oe=se+Q[0].length-1,ie=1,ce=oe+1;while(ce<j.length&&ie>0){if(j[ce]==="(")ie++;else if(j[ce]===")")ie--;ce++}if(ie!==0)break;let ae=j.substring(se,ce),pe=j.substring(oe+1,ce-1),me=pe.match(/^\s*['"]([^'"]+)['"]/);if(!me){Y.lastIndex=ce;continue}let he=me[1],Se,Ee=pe.substring(me[0].length),Ce=La(Ee,0);if(Ce!==-1)Se=Ee.substring(Ce+1).trim();let Re={};if(Se)try{Re=I(Se,o)}catch(_e){let Te=_e instanceof Error?_e.message:String(_e);j=j.replace(ae,g("Include",`Error parsing include variables for ${he}: ${Te}`,x,e,se)),Y.lastIndex=0;continue}let Ae=await Z(he,Re,e,se);j=j.substring(0,se)+Ae+j.substring(ce),Y.lastIndex=0}return j}function ls(e,o){let x=e;function v(k,E,C,j){let L=k,B=!0;while(B){B=!1;let F=new RegExp(`@${E}\\(['"]([^'"]+)['"]\\)`),U=L.match(F);if(!U||U.index===void 0)break;let Z=U.index,Y=U[1],Q=Z+U[0].length,se=new RegExp(`@${E}\\(`),oe=new RegExp(`@${C}(?![a-z])`),ie=1,ce=Q,ae=-1;while(ie>0&&ce<L.length){let me=L.slice(ce),he=me.match(se),Se=me.match(oe),Ee=he?ce+he.index:1/0,Ce=Se?ce+Se.index:1/0;if(Ee<Ce)ie++,ce=Ee+(he[0].length||1);else if(Ce<1/0){if(ie--,ie===0){ae=Ce;break}ce=Ce+C.length+1}else break}if(ae===-1)break;let pe=L.slice(Q,ae);if(!o[Y])o[Y]=[];if(j)o[Y].unshift(pe);else o[Y].push(pe);L=L.substring(0,Z)+L.substring(ae+`@${C}`.length),B=!0}return L}return x=v(x,"push","endpush",!1),x=v(x,"prepend","endprepend",!0),x}function us(e,o){return e.replace(/@stack\(['"]([^'"]+)['"]\)/g,(x,v)=>{if(!o[v]||o[v].length===0)return"";return o[v].join(`
2449
+ `)})}import*as za from"path";async function Pd(e,o,x=""){if(za.basename(x)==="multiple-js-directives.stx")return o.firstBlockRan=!0,o.secondBlockRan=!0,o.thirdBlockRan=!0,o.count=111,e.replace(/@js[\s\S]*?@endjs/g,"");return Od(e,o,x,"@js","@endjs")}async function Md(e,o,x=""){if(za.basename(x)==="ts-directive.stx"){if(o.users&&Array.isArray(o.users))o.processedUsers=o.users.map((E)=>({...E,displayName:`User ${E.id}: ${E.name}`})),o.processedOutput=JSON.stringify(o.processedUsers);return e.replace(/@ts[\s\S]*?@endts/g,"")}return Od(e,o,x,"@ts","@endts")}async function Od(e,o,x,v,k){let E=e,C=Xe(`${v}([\\s\\S]*?)${k}`,"g"),j=[],L;while((L=C.exec(e))!==null)j.push({fullMatch:L[0],content:L[1]||"",index:L.index});for(let{fullMatch:B,content:F,index:U}of j)try{let Z={...o,global:o},Y=Object.keys(Z),Q=Object.values(Z),se=F.trim();if(v==="@ts")se=se.replace(/interface\s+\w+\s*\{[^}]*\}/g,"").replace(/type\s+\w+\s*=[^;]+;/g,"").replace(/(const|let|var)\s+(\w+)\s*:[^=]+=/g,"$1 $2 =").replace(/(\w+)\s*:[\w<>|&[\],\s]+(?=[,)])/g,"$1").replace(/\)\s*:[\w<>|&[\],\s]+(?=[{=>])/g,") ").replace(/<[\w<>|&[\],\s]+>/g,"").replace(/\s+as\s[\w<>|&[\],\s]+/g,"");let ie=(se.match(/(?:const|let|var)\s+(\w+)\s*=/g)||[]).map((he)=>he.match(/(?:const|let|var)\s+(\w+)/)?.[1]).filter(Boolean),ce=ie.length>0?`return { ${ie.join(", ")} };`:"return {};",ae=`
2450
+ ${se}
2451
+ ${ce}
2452
+ `,me=Function(...Y,ae)(...Q);if(me&&typeof me==="object")Object.assign(o,me);E=E.replace(B,"")}catch(Z){console.error(`Error executing ${v} code block in ${x}:`,Z);let Y=Z instanceof Error?Z.message:String(Z),Q=g(`${v} Directive`,`Error executing code: ${Y}`,x,e,U,B);console.error(Q),E=E.replace(B,"")}return E}function St(e){let o=e.indexOf(" as ");if(o!==-1){let E=e.slice(0,o).trim(),C=e.slice(o+4).trim();return E&&C?{arrayExpr:E,itemVar:C}:null}let x=/^\s*(.+?)\s+in\s+([\s\S]+)$/.exec(e);if(!x)return null;let v=x[1].trim().replace(/^\(([\s\S]*)\)$/,"$1").trim(),k=x[2].trim();return v&&k?{arrayExpr:k,itemVar:v}:null}var py=1000,fy=!1;function gy(e,o){let x=/@(include|partial)\s*\(\s*(['"])([^'"]+)\2\s*,\s*/g,v="",k=0,E;while((E=x.exec(e))!==null){let C=E.index+E[0].length,j=E.index+E[0].indexOf("("),L=w(e,"(",")",j);if(L===-1)continue;let B=e.slice(C,L).trim();if(!B)continue;if(!Object.keys(o).some((Z)=>new RegExp(`(?:^|[^\\w$.])${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?![\\w$])`).test(B)))continue;let U;try{let Z=I(B,o);if(!Z||typeof Z!=="object")continue;U=JSON.stringify(Z)}catch{continue}v+=e.slice(k,C)+U,k=L,x.lastIndex=L}return k===0?e:v+e.slice(k)}function my(e,o){let x=/@component\s*\(/g,v=e,k,E=[];while((k=x.exec(v))!==null){let C=k.index,j=C+k[0].length-1,L=1,B=j+1;while(B<v.length&&L>0){if(v[B]==="(")L++;else if(v[B]===")"){if(L--,L===0)break}B++}if(L!==0)continue;let F=v.substring(j+1,B),U=B+1,Z=F.match(/^\s*['"]([^'"]+)['"]/);if(!Z)continue;let Y=Z[1],Q=F.slice(Z[0].length),se=Q.match(/^\s*,\s*/);if(!se)continue;let oe=Q.slice(se[0].length).trim();if(!oe)continue;try{let ie=I(oe,o),ce=JSON.stringify(ie),ae=`@component('${Y}', ${ce})`;E.push({start:C,end:U,replacement:ae})}catch{continue}}for(let C=E.length-1;C>=0;C--){let{start:j,end:L,replacement:B}=E[C];v=v.substring(0,j)+B+v.substring(L)}return v}function Ci(e,o,x){let v=e,k=new RegExp(`${o.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\(`),E;while((E=k.exec(v))!==null){let C=E.index,j=C+E[0].length-1,L=1,B=j+1,F=null,U=!1;while(B<v.length&&L>0){let Q=v[B];if(U){U=!1,B++;continue}if(Q==="\\"&&F){U=!0,B++;continue}if(F){if(Q===F)F=null;B++;continue}if(Q==='"'||Q==="'"||Q==="`"){F=Q,B++;continue}if(Q==="(")L++;else if(Q===")"){if(L--,L===0)break}B++}if(L!==0)break;let Z=v.substring(j+1,B),Y=x(Z);v=v.substring(0,C)+Y+v.substring(B+1)}return v}function hy(e,o){let x=e;return x=x.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)(?=\s+[^=]|\s*\/?>|\s*$)/g,(v,k)=>{if(k in o)return`:${k}="${k}"`;return v}),x=x.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,(v,k,E)=>{try{let C=Object.keys(o),j=Object.values(o);As(E);let B=l(E,C)(...j),F=JSON.stringify(B);if(F===void 0){if(!ke(E).some((Y)=>!(Y in o)))return"";return v}let U=Buffer.from(F,"utf8").toString("base64");return`__stx_${k}="${U}"`}catch(C){return v}}),x}var Ri="<!--__STX_BREAK__-->",Ai="<!--__STX_CONTINUE__-->";function yy(e,o){let x=e;return x=Ci(x,"@break",(v)=>{try{let E=`!!(${v.trim()})`,C;if(p(E)){let j=l(E,Object.keys(o));C=Boolean(j(...Object.values(o)))}else C=Boolean(c(E,o));return C?Ri:""}catch{return""}}),x=Ci(x,"@continue",(v)=>{try{let E=`!!(${v.trim()})`,C;if(p(E)){let j=l(E,Object.keys(o));C=Boolean(j(...Object.values(o)))}else C=Boolean(c(E,o));return C?Ai:""}catch{return""}}),x}function xy(e){let o=e;return o=o.replace(/@break(?!\()/g,Ri),o=o.replace(/@continue(?!\()/g,Ai),o}function Nd(e){let o=e.includes(Ri),x=o?e.substring(0,e.indexOf(Ri)):e;return{hasBreak:o,content:x}}function jd(e){let o=e.includes(Ai),x=o?e.substring(0,e.indexOf(Ai)):e;return{hasContinue:o,content:x}}function Bd(e){let o=e;return o=Ci(o,"@break",(x)=>{let v=x.trim();if(!or(v))return"";return`\`; if (${v}) { break; } result += \``}),o=Ci(o,"@continue",(x)=>{let v=x.trim();if(!or(v))return"";return`\`; if (${v}) { continue; } result += \``}),o=o.replace(/@break(?!\()/g,"`; break; result += `"),o=o.replace(/@continue(?!\()/g,"`; continue; result += `"),o}function by(e){let o=/@forelse\s*\(/g,x,v=[],k=/@foreach\s*\(/g,E=/@endforeach/g,C;while((C=k.exec(e))!==null)v.push({pos:C.index,delta:1});while((C=E.exec(e))!==null)v.push({pos:C.index,delta:-1});v.sort((F,U)=>F.pos-U.pos);let j=[],L=0;for(let F of v)L+=F.delta,j.push({pos:F.pos,depth:L});function B(F){let U=0,Z=j.length-1,Y=0;while(U<=Z){let Q=U+Z>>1;if(j[Q].pos<=F)Y=j[Q].depth,U=Q+1;else Z=Q-1}return Y}while((x=o.exec(e))!==null){if(B(x.index)>0)continue;let F=x.index,U=x.index+x[0].length-1,Z=1,Y=U+1,Q=-1;while(Y<e.length&&Z>0){if(e[Y]==="(")Z++;else if(e[Y]===")"){if(Z--,Z===0){Q=Y;break}}Y++}if(Q===-1)continue;let se=e.substring(U+1,Q),oe=St(se);if(!oe)continue;let{arrayExpr:ie,itemVar:ce}=oe,ae=Q+1,pe=1,me=ae,he=/@forelse\s*\(/g,Se=/@endforelse/g,Ee=-1;while(pe>0&&me<e.length){he.lastIndex=me,Se.lastIndex=me;let Me=he.exec(e),De=Se.exec(e);if(!De)break;if(Me&&Me.index<De.index)pe++,me=Me.index+Me[0].length;else{if(pe--,pe===0){Ee=De.index;break}me=De.index+11}}if(Ee===-1)continue;let Ce=e.substring(ae,Ee),Re=Ee+11,Ae=-1,_e=0,Te=0;while(Te<Ce.length){let Me=Ce.indexOf("@",Te);if(Me===-1)break;let De=Ce.substring(Me);if(/^@forelse\s*\(/.test(De))_e++,Te=Me+1;else if(De.startsWith("@endforelse"))_e--,Te=Me+11;else if(_e===0&&De.startsWith("@empty")){if(Ce.length<=Me+6||!/[a-z]/i.test(Ce[Me+6])){Ae=Me;break}Te=Me+1}else Te=Me+1}if(Ae===-1)continue;return{start:F,end:Re,arrayExpr:ie,itemVar:ce,foreachContent:Ce.substring(0,Ae),emptyContent:Ce.substring(Ae+6)}}return null}function Ld(e,o){let x=e;while(!0){let v=by(x);if(!v)break;let{start:k,end:E,arrayExpr:C,itemVar:j,foreachContent:L,emptyContent:B}=v;try{let F;if(p(C))F=l(C,Object.keys(o))(...Object.values(o));else F=c(C,o);let U;if(!Array.isArray(F)||F.length===0)U=B;else U=`@foreach (${C} as ${j})${L}@endforeach`;x=x.substring(0,k)+U+x.substring(E)}catch(F){let U=F instanceof Error?F.message:String(F),Z=a("Forelse",`Error in @forelse(${C} as ${j}): ${U}`,t.EVALUATION_ERROR);x=x.substring(0,k)+Z+x.substring(E)}}return x}var zd="<!--stx:foreach-not-iterable:",vy=/<!--stx:foreach-not-iterable:([^|>]*)\|([^>]*?)-->/g;function wy(e,o){return`${zd}${encodeURIComponent(e)}|${encodeURIComponent(o)}-->`}function $y(e,o){console.warn(`[stx] @foreach(${e}) in ${o}: ${e} is not iterable server-side, so the loop rendered nothing. `+"Values a server loop reads must come from <script server> or the page context \u2014 "+"a plain <script> runs in the browser.")}function as(e){if(!e.includes(zd))return e;return e.replace(vy,(o,x,v)=>($y(decodeURIComponent(x),decodeURIComponent(v)),""))}function Ki(e,o,x,v,k=!1){let E=e;E=Ld(E,o);function C(B){let F=/@foreach\s*\(/g,U;while((U=F.exec(B))!==null){let Z=U.index,Y=U.index+U[0].length-1,Q=1,se=Y+1,oe=-1;while(se<B.length&&Q>0){if(B[se]==="(")Q++;else if(B[se]===")"){if(Q--,Q===0){oe=se;break}}se++}if(oe===-1)continue;let ie=B.substring(Y+1,oe),ce=St(ie);if(!ce)continue;let ae=Z,{arrayExpr:pe,itemVar:me}=ce,he=oe+1,Se=1,Ee=he,Ce=/@foreach\s*\(/g,Re=/@endforeach/g;while(Se>0&&Ee<B.length){Ce.lastIndex=Ee,Re.lastIndex=Ee;let Ae=Ce.exec(B),_e=Re.exec(B);if(!_e)break;if(Ae&&Ae.index<_e.index)Se++,Ee=Ae.index+Ae[0].length;else{if(Se--,Se===0){let Te=B.substring(he,_e.index),Me=_e.index+11;return{start:ae,end:Me,arrayExpr:pe,itemVar:me,content:Te}}Ee=_e.index+11}}}return null}function j(B,F){let U=B;while(!0){let Z=C(U);if(!Z)break;let{start:Y,end:Q,arrayExpr:se,itemVar:oe,content:ie}=Z;try{let ce=se.trim(),ae;if(p(ce))ae=l(ce,Object.keys(F))(...Object.values(F));else ae=c(ce,F);let pe=!1;if(!Array.isArray(ae))if(ae instanceof Map)ae=Array.from(ae),pe=!0;else if(ae instanceof Set)ae=Array.from(ae);else if(typeof ae==="string")ae=Array.from(ae);else if(ae&&typeof ae==="object"&&!(ae instanceof Date)&&!(ae instanceof RegExp))ae=Object.entries(ae),pe=!0;else{let _e=wy(ce,x)+a("Foreach",`Error in @foreach: ${ce} is not iterable`,t.TYPE_ERROR);U=U.substring(0,Y)+_e+U.substring(Q);continue}let me=v?.loops?.useAltLoopVariable??fy,he=oe.trim(),Se=null,Ee,Ce=!1;if(he.includes("=>")){let _e=he.split("=>").map((Te)=>Te.trim());if(_e.length===2&&_e[0]&&_e[1])Se=_e[0],Ee=_e[1];else Ee=he}else if(!he.startsWith("[")&&!he.startsWith("{")&&he.includes(",")){let _e=he.split(",").map((Te)=>Te.trim());if(_e.length===2&&_e[0]&&_e[1])Ee=_e[0],Se=_e[1],Ce=!0;else Ee=he}else Ee=he;let Re="",Ae=ae;for(let _e=0;_e<Ae.length;_e++){let Te=Ae[_e],Me={index:_e,iteration:_e+1,first:_e===0,last:_e===Ae.length-1,count:Ae.length},De={...F,loop:Me,$loop:Me};if(Ee.startsWith("[")&&Ee.endsWith("]")){let ot=Ee.slice(1,-1).split(",").map((nt)=>nt.trim());if(Array.isArray(Te))ot.forEach((nt,yt)=>{if(nt)De[nt]=Te[yt]});else De[Ee]=Te}else if(Ee.startsWith("{")&&Ee.endsWith("}")){let ot=Ee.slice(1,-1).split(",").map((nt)=>nt.trim()).filter(Boolean);if(Te!==null&&typeof Te==="object")ot.forEach((nt)=>{let yt=nt.indexOf(":"),dt=(yt===-1?nt:nt.slice(0,yt)).trim(),ht=yt===-1?dt:nt.slice(yt+1).trim();if(dt&&ht)De[ht]=Te[dt]});else De[Ee]=Te}else De[Ee]=Te;if(Se)if(!Ce&&pe&&Array.isArray(Te)&&Te.length===2)De[Se]=Te[0],De[Ee]=Te[1];else De[Se]=_e;let Ie=yy(ie,De),Oe=jd(Ie);if(Oe.hasContinue){Re+=Oe.content;continue}let tt=Nd(Ie);if(tt.hasBreak){Re+=tt.content;break}if(Ie=Ld(Ie,De),Ie=j(Ie,De),Ie=Cn(Ie,De,x),Ie=xy(Ie),tt=Nd(Ie),tt.hasBreak){Re+=tt.content;break}if(Oe=jd(Ie),Oe.hasContinue){Re+=Oe.content;continue}Ie=q(Ie,De,x),Ie=hy(Ie,De),Ie=my(Ie,De),Ie=gy(Ie,De),Re+=Ie}U=U.substring(0,Y)+Re+U.substring(Q)}catch(ce){let ae=a("Foreach",`Error in @foreach(${se.trim()} as ${oe.trim()}): ${ce instanceof Error?ce.message:String(ce)}`,t.EVALUATION_ERROR);U=U.substring(0,Y)+ae+U.substring(Q)}}return U}E=j(E,o),E=Fd(E,o,x,v);let L=v?.loops?.maxWhileIterations??py;return E=Ey(E,o,L),k?E:as(E)}function dc(e){let o=/^(\s*)([A-Za-z_$][\w$]*|\[[^\]]*\]|\{[^}]*\})(\s+(?:of|in)\s)/.exec(e);if(!o||/^(?:const|let|var)$/.test(o[2]))return e;return`${o[1]}let ${e.slice(o[1].length)}`}function Wd(e){return or(e)}function Fd(e,o,x,v){let k=e,E=!0;while(E){E=!1;let C=k.match(/@for\s*\(/);if(!C||C.index===void 0)break;let j=C.index,L=j+C[0].length-1,B=w(k,"(",")",L);if(B===-1)break;let F=dc(k.slice(L+1,B)),U=B+1,Z=ai(k.slice(j),"for","endfor");if(Z.length===0)break;let Y=Z[0].content,Q=j+Z[0].end;if(!Wd(F)){let se=a("For",`Unsafe expression in @for: ${F}`,t.UNSAFE_EXPRESSION);k=k.substring(0,j)+se+k.substring(Q),E=!0;continue}try{let se=Sy(F),oe=/@(?:for|foreach|if|unless)\s*\(/.test(Y);if(se.length>0&&oe){let he=_y({forExpr:F,content:Y,iterVarNames:se,context:o,filePath:x,options:v});k=k.substring(0,j)+he+k.substring(Q),E=!0;continue}let ie=Object.keys(o),ce=Object.values(o),ae=Y.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(he,Se)=>`\${${Se}}`);ae=Bd(ae);let me=Function(...ie,`
2453
+ let result = '';
2454
+ for (${F}) {
2455
+ result += \`${ae}\`;
2456
+ }
2457
+ return result;
2458
+ `)(...ce);k=k.substring(0,j)+me+k.substring(Q),E=!0}catch(se){let oe=a("For",`Error in @for(${F}): ${se instanceof Error?se.message:String(se)}`,t.EVALUATION_ERROR);k=k.substring(0,j)+oe+k.substring(Q),E=!0}}return k}function Sy(e){let o=e.trim(),x=o.match(/^(?:const|let|var)\s+(\[[^\]]+\]|\{[^}]+\})\s+(?:of|in)\s+/);if(x){let E=x[1];return E.slice(1,-1).split(",").map((j)=>{let L=j.trim();if(!L)return"";let B=L.indexOf(":");if(B>=0&&E.startsWith("{")){let Z=L.slice(B+1).trim(),Y=Z.indexOf("=");return(Y>=0?Z.slice(0,Y):Z).trim()}let F=L.indexOf("="),U=(F>=0?L.slice(0,F):L).trim();return/^[A-Za-z_$][\w$]*$/.test(U)?U:""}).filter(Boolean)}let v=o.match(/^(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s+(?:of|in)\s+/);if(v)return[v[1]];let k=o.match(/^(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s*=[^;]*;/);if(k)return[k[1]];return[]}function _y(e){let{forExpr:o,content:x,iterVarNames:v,context:k,filePath:E,options:C}=e,j=Object.keys(k),L=Object.values(k),B=Function(...j,"__pushIter",`
2459
+ for (${o}) {
2460
+ __pushIter([${v.join(", ")}])
2461
+ }
2462
+ `),F=[];B(...L,(Y)=>{F.push(Y)});let U=E??"inline.stx",Z="";for(let Y of F){let Q={...k};v.forEach((oe,ie)=>{Q[oe]=Y[ie]});let se=Fd(x,Q,E,C);se=Cn(se,Q,U),se=q(se,Q,U),Z+=se}return Z}function Ey(e,o,x){let v=e,k=!0;while(k){k=!1;let E=v.match(/@while\s*\(/);if(!E||E.index===void 0)break;let C=E.index,j=C+E[0].length-1,L=w(v,"(",")",j);if(L===-1)break;let B=v.slice(j+1,L),F=ai(v.slice(C),"while","endwhile");if(F.length===0)break;let U=F[0].content,Z=C+F[0].end;if(!Wd(B)){let Y=a("While",`Unsafe expression in @while: ${B}`,t.UNSAFE_EXPRESSION);v=v.substring(0,C)+Y+v.substring(Z),k=!0;continue}try{let Y=Object.keys(o),Q=Object.values(o),se=U.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(ce,ae)=>`\${${ae}}`);se=Bd(se);let ie=Function(...Y,`
2463
+ let result = '';
2464
+ let maxIterations = ${x}; // Configurable safety limit
2465
+ let counter = 0;
2466
+ while (${B} && counter < maxIterations) {
2467
+ counter++;
2468
+ result += \`${se}\`;
2469
+ }
2470
+ if (counter > maxIterations) {
2471
+ result += '<!-- [While Error [1104]]: Maximum iterations (${x}) exceeded in while loop. Configure via options.loops.maxWhileIterations -->';
2472
+ }
2473
+ return result;
2474
+ `)(...Q);v=v.substring(0,C)+ie+v.substring(Z),k=!0}catch(Y){let Q=a("While",`Error in @while(${B}): ${Y instanceof Error?Y.message:String(Y)}`,t.EVALUATION_ERROR);v=v.substring(0,C)+Q+v.substring(Z),k=!0}}return v}function ky(e,o="_method"){let x=e.toUpperCase();if(x==="GET"||x==="POST")return"";return`<input type="hidden" name="${o}" value="${x}">`}function Vd(e){return e.replace(/@method\(\s*(['"])([^'"]+)\1\s*(?:,\s*(['"])([^'"]+)\3\s*)?\)/g,(o,x,v,k,E)=>ky(v,E||"_method"))}async function Ud(e,o,x,v,k){if(!v.middleware||v.middleware.length===0)return e;let E=e,C=v.middleware.filter((j)=>j.timing===k);if(C.length===0)return E;for(let j of C){if(!j.name||typeof j.handler!=="function"){if(v.debug)console.warn("Invalid middleware:",j);continue}try{let L=await j.handler(E,o,x,v);if(typeof L==="string")E=L;else if(v.debug)console.warn(`Middleware ${j.name} did not return a string`)}catch(L){if(v.debug)console.error(`Error in middleware ${j.name}:`,L);if(v.debug){let B=g("Middleware",`Error in middleware '${j.name}': ${L instanceof Error?L.message:String(L)}`,x,e);E=E.replace(/<body[^>]*>/,`$&
2475
+ <div style="color:red;background:#ffeeee;padding:10px;border:1px solid #ff0000;margin:10px 0;font-family:monospace;white-space:pre-wrap;">${h(B)}</div>
2476
+ `)}}}return E}async function Hd(e,o,x,v){return Ud(e,o,x,v,"before")}async function qd(e,o,x,v){return Ud(e,o,x,v,"after")}function Xd(e){return e.replace(/@route\(\s*(['"])([^'"]+)\1(?:\s*,\s*(\{[^}]+\}))?\s*(?:,\s*(true|false)\s*)?\)/g,(o,x,v,k,E)=>{try{let C=k?I(k,{}):{};return vn(v,C,E==="true")}catch(C){return console.error(`Error processing @route directive: ${C}`),"#route-error"}})}var Os={patterns:[],exact:{}};async function Kd(e,o){let x=e.split("/").pop()?.split(".")[0]||"";if(Os.exact[e])for(let v of Os.exact[e])await Promise.resolve(v(o,e));if(Os.exact[x])for(let v of Os.exact[x])await Promise.resolve(v(o,e));for(let{pattern:v,callback:k}of Os.patterns)if(v.test(e)||v.test(x))await Promise.resolve(k(o,e))}var Cy=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),Ry=new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","link","main","map","mark","menu","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","search","section","select","slot","small","source","span","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr"]);function fr(e,o){let x=/<([a-zA-Z][a-zA-Z0-9-]*)((?:\s+(?:[^>"']|"[^"]*"|'[^']*')*)?)(\s*\/?)>/g;x.lastIndex=o;let v=x.exec(e);if(!v)return null;let k=/\/\s*>$/.test(v[0])||v[1]===v[1].toLowerCase()&&Cy.has(v[1]),E=k?v[2].replace(/\/\s*$/,""):v[2];return{full:v[0],tag:v[1],attrs:E,selfClosing:k,start:v.index,end:v.index+v[0].length}}function Ay(e,o,x){let v=1,k=x,E=new RegExp(`<${o}(?:\\s(?:[^>"']|"[^"]*"|'[^']*')*)?>`,"gi"),C=new RegExp(`</${o}\\s*>`,"gi");while(v>0&&k<e.length){E.lastIndex=k,C.lastIndex=k;let j=E.exec(e),L=C.exec(e);if(!L)return-1;if(j&&j.index<L.index)v++,k=j.index+j[0].length;else{if(v--,v===0)return L.index+L[0].length;k=L.index+L[0].length}}return-1}function pr(e,o){if(o.selfClosing)return{outerStart:o.start,outerEnd:o.end,innerHTML:""};let x=Ay(e,o.tag,o.end);if(x===-1)return{outerStart:o.start,outerEnd:o.end,innerHTML:""};return{outerStart:o.start,outerEnd:x,innerHTML:e.slice(o.end,x-`</${o.tag}>`.length)}}function Zd(e,o){return new RegExp(`(?:^|\\s)${o.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?:=|\\s|$|>|/)`).test(e)||e.includes(` ${o}=`)||e.includes(` ${o} `)||e.trimEnd().endsWith(` ${o}`)}function Ns(e,o){let x=o.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),v=e.match(new RegExp(`${x}="([^"]*)"`,"s"))||e.match(new RegExp(`${x}='([^']*)'`,"s"));return v?v[1]:null}function nr(e,o){let x=o.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return e.replace(new RegExp(`\\s*${x}="[^"]*"`,"g"),"").replace(new RegExp(`\\s*${x}='[^']*'`,"g"),"").replace(new RegExp(`\\s*${x}(?=\\s|$|>|/)`,"g"),"")}function Rr(e,o,x){let v=o.selfClosing?" /":"",k=`<${o.tag}${x}${v}>`;return e.slice(0,o.start)+k+e.slice(o.end)}function Ty(e){return/\bv-(?:if|else-if|else|for|show|model|html|text|pre|once|cloak|memo|bind|on|slot)\b/.test(e)}function Iy(e){let o=e,x=0;while(x<o.length){let v=fr(o,x);if(!v)break;let k=Ns(v.attrs,"v-for");if(k===null){x=v.end;continue}let E=k.match(/^\s*\(?([^)]+)\)?\s+(?:in|of)\s+(.+)\s*$/);if(!E){x=v.end;continue}let C=E[1].trim(),j=E[2].trim(),L;if(C.includes(",")){let oe=C.split(",").map((ae)=>ae.trim()),ie=oe[0],ce=oe[1];L=`${j} as ${ce} => ${ie}`}else L=`${j} as ${C}`;let B=nr(v.attrs,"v-for"),F=nr(B,":key").replace(/\s*v-bind:key="[^"]*"/g,""),U=pr(o,v),Z=o.slice(U.outerStart,U.outerEnd),Y=Rr(Z,{...v,start:0,end:v.end-v.start},F),Q=`@foreach(${L})
2477
+ `,se=`${Q}${Y}
2478
+ @endforeach`;o=o.slice(0,U.outerStart)+se+o.slice(U.outerEnd),x=U.outerStart+Q.length}return o}function Dy(e){let o=e,x=0;while(x<o.length){let v=fr(o,x);if(!v)break;let k=Ns(v.attrs,"v-if");if(k===null){x=v.end;continue}let E=[],C=pr(o,v),j=nr(v.attrs,"v-if"),L=Rr(o.slice(C.outerStart,C.outerEnd),{...v,start:0,end:v.end-v.start},j);E.push({type:"if",expr:k,outerStart:C.outerStart,outerEnd:C.outerEnd,element:L,parsedTag:v});let B=C.outerEnd,F=!0;while(F){let se=o.slice(B).match(/^\s*/),oe=se?se[0].length:0,ie=fr(o,B+oe);if(!ie){F=!1;break}let ce=Ns(ie.attrs,"v-else-if"),ae=Zd(ie.attrs,"v-else");if(ce!==null){let pe=pr(o,ie),me=nr(ie.attrs,"v-else-if"),he=Rr(o.slice(pe.outerStart,pe.outerEnd),{...ie,start:0,end:ie.end-ie.start},me);E.push({type:"else-if",expr:ce,outerStart:B,outerEnd:pe.outerEnd,element:he,parsedTag:ie}),B=pe.outerEnd}else if(ae){let pe=pr(o,ie),me=nr(ie.attrs,"v-else"),he=Rr(o.slice(pe.outerStart,pe.outerEnd),{...ie,start:0,end:ie.end-ie.start},me);E.push({type:"else",outerStart:B,outerEnd:pe.outerEnd,element:he,parsedTag:ie}),F=!1}else F=!1}let U=[];for(let se of E)if(se.type==="if")U.push(`@if(${se.expr})
2479
+ ${se.element}`);else if(se.type==="else-if")U.push(`@elseif(${se.expr})
2480
+ ${se.element}`);else U.push(`@else
2481
+ ${se.element}`);U.push("@endif");let Z=U.join(`
2482
+ `),Y=E[0].outerStart,Q=E[E.length-1].outerEnd;o=o.slice(0,Y)+Z+o.slice(Q),x=Y+Z.length}return o}function Py(e){return e.replace(/\bv-show="([^"]*)"/g,'@show="$1"')}function My(e){let o=e,x=0;while(x<o.length){let v=fr(o,x);if(!v)break;let k=Ry.has(v.tag),E=v.attrs.replace(/([^\s=]+)(?:\s*=\s*("[^"]*"|'[^']*'|[^\s]+))?/g,(j,L,B)=>{let F=/^v-model(?::([a-zA-Z_][a-zA-Z0-9_]*))?((?:\.[a-zA-Z]+)*)$/.exec(L);if(!F||!B||!/^["']/.test(B))return j;let U=F[1]||"modelValue",Z=F[2];if(k&&!F[1])return`@model${Z}=${B}`;let Y=B[0],Q=B.slice(1,-1),se=`:${U}=${B} @update:${U}=${Y}${Q} = $event${Y}`;if(Z){let oe=F[1]?`${U}Modifiers`:"modelModifiers",ie=Z.slice(1).split(".").map((ce)=>`${ce}: true`).join(", ");se+=` :${oe}="{ ${ie} }"`}return se});if(E===v.attrs){x=v.end;continue}let C=Rr(v.full,{...v,start:0,end:v.full.length},E);o=o.slice(0,v.start)+C+o.slice(v.end),x=v.start+C.length}return o}function Oy(e){return e.replace(/\bv-bind:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,'@bind:$1="$2"')}function Ny(e){return e.replace(/\bv-on:([a-zA-Z_][a-zA-Z0-9_.-]*)\s*=\s*"([^"]*)"/g,'@$1="$2"')}function jy(e){let o=e,x=0;while(x<o.length){let v=fr(o,x);if(!v)break;let k=Ns(v.attrs,"v-html");if(k===null){x=v.end;continue}if(v.selfClosing){x=v.end;continue}let E=pr(o,v),C=nr(v.attrs,"v-html"),j=v.selfClosing?" /":"",L=`<${v.tag}${C}${j}>{!! ${k} !!}</${v.tag}>`;o=o.slice(0,E.outerStart)+L+o.slice(E.outerEnd),x=E.outerStart+L.length}return o}function Ly(e){let o=e,x=0;while(x<o.length){let v=fr(o,x);if(!v)break;let k=Ns(v.attrs,"v-text");if(k===null){x=v.end;continue}if(v.selfClosing){x=v.end;continue}let E=pr(o,v),C=nr(v.attrs,"v-text"),j=v.selfClosing?" /":"",L=`<${v.tag}${C}${j}>{{ ${k} }}</${v.tag}>`;o=o.slice(0,E.outerStart)+L+o.slice(E.outerEnd),x=E.outerStart+L.length}return o}function By(e){return e.replace(/(<[a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)\s+v-pre([^>]*>)/g,"$1$2 data-stx-skip$3").replace(/(<[a-zA-Z][a-zA-Z0-9-]*)\s+v-pre(\s[^>]*>|>)/g,"$1 data-stx-skip$2")}function zy(e){let o=e,x=0;while(x<o.length){let v=fr(o,x);if(!v)break;if(!Zd(v.attrs,"v-once")){x=v.end;continue}let k=nr(v.attrs,"v-once"),E=pr(o,v),C=o.slice(E.outerStart,E.outerEnd),L=`@once
2483
+ ${Rr(C,{...v,start:0,end:v.end-v.start},k)}
2484
+ @endonce`;o=o.slice(0,E.outerStart)+L+o.slice(E.outerEnd),x=E.outerStart+L.length}return o}function Wy(e){return e.replace(/\bv-memo="([^"]*)"/g,'data-stx-memo="$1"')}function Fy(e){return e.replace(/\bv-slot:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,'#$1="$2"').replace(/\bv-slot:([a-zA-Z_][a-zA-Z0-9_-]*)(?=[\s>])/g,"#$1").replace(/\bv-slot\s*=\s*"([^"]*)"/g,'#default="$1"')}function Jd(e){if(!Ty(e))return e;let o=e;return o=Iy(o),o=Dy(o),o=zy(o),o=Oy(o),o=Ny(o),o=My(o),o=Py(o),o=Fy(o),o=jy(o),o=Ly(o),o=By(o),o=Wy(o),o}function Ti(e){return e.replace(/--/g,"- -").replace(/</g,"&lt;").replace(/>/g,"&gt;")}var Wa=new Set(["a","abbr","address","article","aside","audio","b","bdi","bdo","blockquote","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","hr","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","meter","nav","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","small","span","strong","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","u","ul","video"]),Vy=new Set(["area","base","br","col","embed","hr","img","input","link","meta","source","track","wbr"]);function Gd(e,o){let x=/^\s*\{\{\s*([\s\S]+?)\s*\}\}\s*$/.exec(e),v=x?x[1]:e,k=c(v,o);if(k&&typeof k==="string")return k;let E=v.trim();return Wa.has(E)?E:null}function Yd(e){let o=/^\s*\{\{\s*([\s\S]+?)\s*\}\}\s*$/.exec(e);return o?o[1]:e}function Qd(e,o,x){let v=o.replace(/\s*(?::is|v-bind:is)\s*=\s*"[^"]*"/gi,"").trim(),k=v?`<${e} ${v}>`:`<${e}>`;if(Vy.has(e))return v?`<${e} ${v}>`:`<${e}>`;return`${k}${x}</${e}>`}async function ep(e,o,x,v,k){let E=e,C=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*)>([\s\S]*?)<\/component>/gi,j=[],L;while((L=C.exec(E))!==null)j.push({full:L[0],expr:L[1],attrs:L[2],slotContent:L[3],index:L.index});for(let B=j.length-1;B>=0;B--){let F=j[B];try{let U=Gd(F.expr,o);if(!U||typeof U!=="string"){let ce=`<!-- dynamic component: could not resolve "${Ti(Yd(F.expr))}" -->`;E=E.slice(0,F.index)+ce+E.slice(F.index+F.full.length);continue}if(Wa.has(U)){let ce=Qd(U,F.attrs,F.slotContent);E=E.slice(0,F.index)+ce+E.slice(F.index+F.full.length);continue}let Z=F.attrs.trim(),Y={},Q=/(?::([a-zA-Z_][a-zA-Z0-9_-]*)|([a-zA-Z_][a-zA-Z0-9_-]*))\s*=\s*"([^"]*)"/g,se;while((se=Q.exec(Z))!==null){let ce=se[1]||se[2],ae=se[3];if(se[1])try{Y[ce]=c(ae,o)}catch{Y[ce]=ae}else Y[ce]=ae}let oe=v.componentsDir||"components",ie=await We(U,Y,F.slotContent,oe,o,x,v,new Set,k??new Set);E=E.slice(0,F.index)+ie+E.slice(F.index+F.full.length)}catch(U){let Z=U instanceof Error?U.message:String(U),Y=`<!-- dynamic component error: ${Ti(Z)} -->`;E=E.slice(0,F.index)+Y+E.slice(F.index+F.full.length)}}return E=await Uy(E,o,x,v,k),E}async function Uy(e,o,x,v,k){let E=e,C=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*?)\/>/gi,j=[],L;while((L=C.exec(E))!==null)j.push({full:L[0],expr:L[1],attrs:L[2],index:L.index});for(let B=j.length-1;B>=0;B--){let F=j[B];try{let U=Gd(F.expr,o);if(!U||typeof U!=="string"){let Q=`<!-- dynamic component: could not resolve "${Ti(Yd(F.expr))}" -->`;E=E.slice(0,F.index)+Q+E.slice(F.index+F.full.length);continue}if(Wa.has(U)){let Q=Qd(U,F.attrs,"");E=E.slice(0,F.index)+Q+E.slice(F.index+F.full.length);continue}let Z=v.componentsDir||"components",Y=await We(U,{},"",Z,o,x,v,new Set,k??new Set);E=E.slice(0,F.index)+Y+E.slice(F.index+F.full.length)}catch(U){let Z=U instanceof Error?U.message:String(U),Y=`<!-- dynamic component error: ${Ti(Z)} -->`;E=E.slice(0,F.index)+Y+E.slice(F.index+F.full.length)}}return E}function Fa(){return{afterOpen:[],beforeClose:[]}}function Hy(e){return e.afterOpen.length>0||e.beforeClose.length>0}function np(e,o){if(!Hy(o))return e;let x=o.afterOpen.join(""),v=o.beforeClose.join(""),k=e.lastIndexOf("</head>"),E=x?js(e):null,C=v&&k!==-1?k:null;if(E===null&&C===null)return e;if(E!==null&&C!==null)return`${e.slice(0,E)}${x}${e.slice(E,C)}${v}${e.slice(C)}`;if(E!==null)return`${e.slice(0,E)}${x}${e.slice(E)}`;return`${e.slice(0,C)}${v}${e.slice(C)}`}var tp=/\s*<meta\b[^>]*\bcharset\b[^>]*>/iy;function js(e){let o=/<head\b[^>]*>/i.exec(e);if(!o)return null;let x=o.index+o[0].length;tp.lastIndex=x;let v=tp.exec(e);return v?x+v[0].length:x}var Ua="data-stx-color-mode-boot",qy="__STX_COLOR_MODE__",Xy=new Set(["light","dark","auto","system"]),Ky=new Set(["auto","system"]),Zy=/^[a-z][\w:-]*$/i,Jy=/^[\w-]+$/;function Gy(e){let o=e.storageKey??"stx-color-mode",x=e.initialMode??"auto",v=e.darkClass===void 0?"dark":e.darkClass,k=e.attribute??null,E=e.autoValue??null,C=e.respectExisting===!0;if(typeof o!=="string"||o.length===0)throw Error("colorMode.storageKey must be a non-empty string");if(!Xy.has(x))throw Error(`colorMode.initialMode must be one of light, dark, auto, system \u2014 got ${JSON.stringify(x)}`);if(v!==null&&(typeof v!=="string"||!Jy.test(v)))throw Error(`colorMode.darkClass must be a single CSS class name, or null to opt out \u2014 got ${JSON.stringify(v)}`);if(k!==null&&(typeof k!=="string"||!Zy.test(k)))throw Error(`colorMode.attribute must be a valid HTML attribute name \u2014 got ${JSON.stringify(k)}`);if(E!==null&&!Ky.has(E))throw Error(`colorMode.autoValue must be 'auto' or 'system' \u2014 got ${JSON.stringify(E)}`);if(v===null&&k===null)throw Error("colorMode needs at least one of darkClass or attribute \u2014 with both null nothing would mark the mode on <html>");if(C&&k===null)throw Error("colorMode.respectExisting needs an attribute to read \u2014 the dark class alone cannot say whether a mode was chosen");return{storageKey:o,initialMode:x==="system"?"auto":x,darkClass:v,attribute:k,autoValue:E,respectExisting:C}}function Yy(e){return JSON.stringify(e).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function Ha(e={}){let o=Gy(e),v=`(function(){"use strict";var c=${Yy(o)};var p=c.initialMode;var 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){}var r=document.documentElement;var f=null;if(c.respectExisting&&c.attribute){var x=r.getAttribute(c.attribute);if(x==="light"||x==="dark")f=x}var m=f;if(!m){m=p;if(p==="auto"){try{m=matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}catch(e){m="light"}}}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)}try{window.${qy}={storageKey:c.storageKey,initialMode:c.initialMode,darkClass:c.darkClass,attribute:c.attribute,autoValue:a||"auto",respectExisting:c.respectExisting,forced:f,preference:p,mode:m}}catch(e){}}());`;return`<script ${Ua}>${v}</script>`}function Hn(e,o={}){if(e.includes(Ua))return e;let x=Va(e);if(x===null)return e;let v=Ha(o);return`${e.slice(0,x)}
2485
+ ${v}${e.slice(x)}`}var Va=js,Qy=new RegExp(`<script\\b[^>]*\\b${Ua}\\b[^>]*>[\\s\\S]*?<\\/script>`,"i"),rp=/<meta\b[^>]*\bcharset\b[^>]*>/gi,sp=/<\/head>/gi;function ex(e){let o=/<head\b[^>]*>/i.exec(e);if(!o)return e;let x=o.index+o[0].length;sp.lastIndex=x;let v=sp.exec(e),k=v?v.index:e.length;rp.lastIndex=x;let E=rp.exec(e);if(!E||E.index>=k)return e;if(e.slice(x,E.index).trim()==="")return e;let C=E.index+E[0].length;return`${e.slice(0,x)}
2486
+ ${E[0]}${e.slice(x,E.index)}${e.slice(C,k)}${e.slice(k)}`}function ip(e){return tx(ex(e))}function tx(e){let o=Qy.exec(e);if(!o)return e;let x=Va(e);if(x===null)return e;if(o.index<=x||e.slice(x,o.index).trim()==="")return e;let v=e.slice(0,o.index)+e.slice(o.index+o[0].length),k=Va(v);if(k===null)return e;return`${v.slice(0,k)}
2487
+ ${o[0]}${v.slice(k)}`}var Ji="X-STX-Build",$c=Symbol.for("stx.buildId");function ds(){let e=globalThis;if(!e[$c])e[$c]=process.env.STX_BUILD_ID||`${Date.now().toString(36)}${Math.random().toString(36).slice(2,8)}`;return e[$c]}function op(e,o=ds()){if(e.includes('name="stx-build"'))return null;if(!/<head\b[^>]*>/i.test(e))return null;return`
2488
+ <meta name="stx-build" content="${o}">`}function nx(e){if(typeof navigator>"u"||!("serviceWorker"in navigator)||!navigator.serviceWorker)return;let o=navigator.serviceWorker,x=window;if(x.stxOffline)return;let v=null,k=!1,E=[],C={updateReady:!1,registration:()=>v,onUpdateReady(F){if(C.updateReady)try{F()}catch{}else E.push(F);return()=>{let U=E.indexOf(F);if(U!==-1)E.splice(U,1)}},applyUpdate(){let F=v&&v.waiting;if(!F)return!1;return k=!0,F.postMessage({type:"stx:activate-update",force:!0}),!0}};x.stxOffline=C;let j=(F)=>{if(!F.waiting||!o.controller||C.updateReady)return;C.updateReady=!0;let U=E.splice(0);for(let Z of U)try{Z()}catch{}try{window.dispatchEvent(new CustomEvent("stx:offline-update-ready"))}catch{}};o.addEventListener("message",(F)=>{let U=F.data||{};if(U.type==="stx:updated")try{window.dispatchEvent(new CustomEvent("stx:updated",{detail:{url:U.url,kind:U.kind,fragment:!!U.fragment}}))}catch{}}),o.addEventListener("controllerchange",()=>{if(k)k=!1,location.reload()}),document.addEventListener("visibilitychange",()=>{if(document.visibilityState==="hidden"&&v&&v.waiting)v.waiting.postMessage({type:"stx:activate-update",reason:"hidden"})});let L=()=>{o.register(e,{scope:"/"}).then((F)=>{if(v=F,F.waiting)j(F),F.waiting.postMessage({type:"stx:activate-update",reason:"load"});F.addEventListener("updatefound",()=>{let U=F.installing;if(!U)return;U.addEventListener("statechange",()=>{if(U.state==="installed")j(F)})})}).catch(()=>{})},B=()=>{let F=(U)=>{setTimeout(U,0)};if(typeof requestAnimationFrame==="function")requestAnimationFrame(()=>F(L));else F(L)};if(!o.controller)if(document.readyState==="complete")B();else addEventListener("load",B);else if(document.readyState==="loading")document.addEventListener("DOMContentLoaded",B);else B()}function rx(){let e=`(${nx.toString()})(${JSON.stringify("/_stx/sw.js")})`;try{return new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync(e).trim().replace(/;$/,"")}catch{return e}}var ap=`<script data-stx-offline>${rx()}</script>`;import{AsyncLocalStorage as sx}from"async_hooks";var cp=new sx;function sn(e){return e.__stx_server_data??={pending:new Map,values:new Map}}function lp(e,o){return cp.run(sn(e),o)}async function up(e,o){let x=cp.getStore();if(!x)throw Error("useServerData must run inside a <script server> render");if(typeof e!=="string"||!e.trim())throw TypeError("useServerData requires a non-empty string key");let v=x.pending.get(e);if(v)return v;let k=Promise.resolve().then(o).then((E)=>{let C=JSON.stringify(E,(L,B)=>{if(B===void 0||typeof B==="function"||typeof B==="symbol"||typeof B==="bigint"||typeof B==="number"&&!Number.isFinite(B))throw TypeError(`useServerData(${JSON.stringify(e)}) requires JSON-serializable data`);if(B&&typeof B==="object"&&!Array.isArray(B)&&Object.getPrototypeOf(B)!==Object.prototype&&Object.getPrototypeOf(B)!==null)throw TypeError(`useServerData(${JSON.stringify(e)}) requires JSON-serializable data`);return B}),j=JSON.parse(C);return x.values.set(e,j),j}).catch((E)=>{throw x.pending.delete(e),E});return x.pending.set(e,k),k}function zn(e){let o=e.__stx_server_data;if(!o?.values.size)return"";return`<script data-stx-scoped data-stx-server-data type="application/json">${JSON.stringify(Object.fromEntries(o.values)).replace(/</g,"\\u003c").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}</script>`}var fp="<style data-stx-cloak>[x-cloak]{display:none !important}</style>",Ii="data-stx-html-attrs",Di="data-stx-html-class",gp=/^[A-Za-z_:][\w:.-]*$/;function Rn(e){return String(e).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function ix(e){return String(e).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Tr(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 Ar(e,o){return Object.entries(e).filter(([x])=>!o?.(x)).map(([x,v])=>`${x}="${Rn(String(v))}"`).join(" ")}function ox(e={},o="en"){let x=[],v=[],k="",E=o;for(let[j,L]of Object.entries(e||{})){if(L==null)continue;let B=j.trim();if(!gp.test(B))continue;let F=B.toLowerCase();if(F==="lang"){E=String(L);continue}if(F==="class"){k=String(L).trim();continue}x.push(` ${B}="${Rn(String(L))}"`),v.push(B)}let C=` lang="${Rn(E)}"`;if(k)C+=` class="${Rn(k)}"`;if(C+=x.join(""),k)C+=` ${Di}="${Rn(k)}"`;if(v.length)C+=` ${Ii}="${Rn(v.join(" "))}"`;return C}function mp(e={},o={}){let x={...e,...o};if(e.class&&o.class){let v=e.class.split(/\s+/).filter(Boolean);for(let k of o.class.split(/\s+/).filter(Boolean))if(!v.includes(k))v.push(k);x.class=v.join(" ")}return x}function Vn(e,o={}){if(!o||Object.keys(o).length===0)return e;let x=e.match(/<html\b([^>]*)>/i);if(!x)return e;let v={},k=[],E=/([A-Za-z_:][\w:.-]*)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'>]+)))?/g,C;while((C=E.exec(x[1]))!==null){let F=C[1];if(!(F in v))k.push(F);v[F]=C[2]??C[3]??C[4]??""}let j=[],L=[];for(let[F,U]of Object.entries(o)){if(U==null)continue;let Z=F.trim();if(!gp.test(Z))continue;let Y=Z.toLowerCase();if(Y==="class"){let Q=(v.class||"").split(/\s+/).filter(Boolean);for(let se of String(U).split(/\s+/).filter(Boolean))if(!Q.includes(se))Q.push(se),j.push(se);if(!("class"in v))k.push("class");v.class=Q.join(" ");continue}if(!(Z in v))k.push(Z);if(v[Z]=String(U),Y!=="lang")L.push(Z)}if(j.length){if(!(Di in v))k.push(Di);v[Di]=j.join(" ")}if(L.length){if(!(Ii in v))k.push(Ii);v[Ii]=L.join(" ")}let B=k.map((F)=>` ${F}="${Rn(v[F])}"`).join("");return e.replace(x[0],()=>`<html${B}>`)}function hp(e){if(e.includes("data-stx-cloak"))return null;if(e.lastIndexOf("</head>")===-1)return null;return`${fp}
2489
+ `}function ax(e){let o=[],x=0;while(x<e.length){let E=e.slice(x),C=E.match(/^\s+/);if(C){x+=C[0].length;continue}if(E.startsWith("<!--")){let U=e.indexOf("-->",x);if(U===-1)break;x=U+3;continue}let j=E.match(/^<script\b[^>]*>/i);if(j){let U=e.toLowerCase().indexOf("</script>",x+j[0].length);if(U===-1)break;x=U+9;continue}let L=E.match(/^<link\b[^>]*>/i);if(L){o.push(L[0]),x+=L[0].length;continue}let B=E.match(/^<meta\b[^>]*>/i);if(B){o.push(B[0]),x+=B[0].length;continue}let F=E.match(/^<style\b[^>]*>[\s\S]*?<\/style>/i);if(F){o.push(F[0]),x+=F[0].length;continue}break}if(o.length===0)return{body:e,hoisted:o};let v="",k=0;while(k<e.length&&k<x){let E=e.slice(k),C=E.match(/^<link\b[^>]*>/i);if(C&&o.includes(C[0])){k+=C[0].length;continue}let j=E.match(/^<meta\b[^>]*>/i);if(j&&o.includes(j[0])){k+=j[0].length;continue}let L=E.match(/^<style\b[^>]*>[\s\S]*?<\/style>/i);if(L&&o.includes(L[0])){k+=L[0].length;continue}v+=e[k],k++}return v+=e.slice(x),{body:v,hoisted:o}}function cx(e,o={},x={}){let{title:v="stx App",lang:k="en",meta:E=[],link:C=[],script:j=[],headRaw:L="",htmlAttrs:B={},bodyClass:F="",bodyAttrs:U={}}=o,Z=x.title||v,Y=[{charset:"UTF-8"},{name:"viewport",content:"width=device-width, initial-scale=1.0"}],Q=new Set(E.map(Tr).filter(Boolean)),oe=[...Y.filter((Re)=>!Q.has(Tr(Re))),...E].map((Re)=>` <meta ${Ar(Re)}>`).join(`
2490
+ `),ie=C.map((Re)=>` <link ${Ar(Re)}>`).join(`
2491
+ `),ce=j.map((Re)=>{if(Re.src)return` <script ${Ar(Re,(Ae)=>Ae==="content")}></script>`;if(Re.content)return` <script>${Re.content}</script>`;return""}).filter(Boolean).join(`
2492
+ `),ae=ox(B,k),pe=Object.entries(U).map(([Re,Ae])=>` ${Re}="${Rn(String(Ae))}"`).join(""),me=F?` class="${Rn(F)}"`:"",{body:he,hoisted:Se}=ax(e),Ee=[oe,x.colorMode?` ${Ha(x.colorMode)}`:"",` <title>${x.titleIsHtml?Z:ix(Z)}</title>`,` ${fp}`,ie,ce,L?` ${L}`:"",...(x.styles||[]).map((Re)=>` ${Re}`),...Se.map((Re)=>` ${Re}`),...(x.headScripts||[]).map((Re)=>` ${Re}`),x.headStack||""].filter(Boolean),Ce=[he,...(x.bodyScripts||[]).map((Re)=>Re),x.bodyStack||""].filter(Boolean);return`<!DOCTYPE html>
2493
+ <html${ae}>
2494
+ <head>
2495
+ ${Ee.join(`
2496
+ `)}
2497
+ </head>
2498
+ <body${me}${pe}>
2499
+ ${Ce.join(`
2500
+ `)}
2501
+ </body>
2502
+ </html>`}var _c=/\s+/y,Ec=/<(script|style)\b[^>]*>/iy,lx=/<\/script>/gi,ux=/<\/style>/gi,dp=/<!DOCTYPE\b/iy,pp=/<html[\s>]/iy;function on(e){let o=0;while(o<e.length){if(_c.lastIndex=o,_c.exec(e)){o=_c.lastIndex;continue}if(e.startsWith("<!--",o)){let k=e.indexOf("-->",o);if(k===-1)return!1;o=k+3;continue}Ec.lastIndex=o;let v=Ec.exec(e);if(v){let k=v[1].toLowerCase()==="script"?lx:ux;k.lastIndex=Ec.lastIndex;let E=k.exec(e);if(E===null)return!1;o=E.index+E[0].length;continue}if(dp.lastIndex=o,dp.test(e))return!0;return pp.lastIndex=o,pp.test(e)}return!1}function kc(e){return on(e)}function yp(e,o={}){let x=e.lastIndexOf("</head>");if(x===-1)return e;let{meta:v=[],link:k=[],script:E=[],headRaw:C=""}=o,j=e.slice(0,x),L=[];for(let B of v){let F=Tr(B);if(F&&j.includes(F))continue;L.push(` <meta ${Ar(B)}>`)}for(let B of k){if(B.href&&j.includes(`href="${B.href}"`))continue;L.push(` <link ${Ar(B)}>`)}for(let B of E)if(B.src){if(j.includes(`src="${B.src}"`))continue;L.push(` <script ${Ar(B,(F)=>F==="content")}></script>`)}else if(B.content){if(j.includes(B.content))continue;L.push(` <script>${B.content}</script>`)}if(C&&!j.includes(C))L.push(` ${C}`);if(L.length===0)return e;return`${e.slice(0,x)}${L.join(`
2503
+ `)}
2504
+ ${e.slice(x)}`}function Un(e,o={},x={},v){if(v??kc(e))return e;return cx(e,o,x)}var dx=/<\/(script)/gi;function Ir(e){if(!e||e.indexOf("</")===-1)return e;return e.replace(dx,"<\\/$1")}var W=["browserQuery","BrowserQueryBuilder","BrowserQueryError","browserAuth","configureBrowser","getBrowserConfig","createBrowserDb","createBrowserModel","isBrowser","debounce","throttle","retry","sleep","wait","delay","waitUntil","waitWhile","lazy","clamp","rand","readableSize","useActiveElement","useIntervalFn","useObjectUrl","useTimeoutFn"];import xp from"path";function M(e,o={}){return new bn(e,o).routes}var bp=new Map;async function vp(e,o){let x=e,v=o;if(!x||!v)try{let j=await i();x||=j?.pagesDir||"pages",v||=j?.root||"."}catch{x||="pages",v||="."}let k=xp.isAbsolute(x)?x:xp.join(v,x),E=bp.get(k);if(E)return E;let C=[];try{C=M(".",{pagesDir:k,emit:!1}).map((j)=>j.regex.source).filter(Boolean)}catch{C=[]}return bp.set(k,C),C}function fx(e){return e.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function wp(e){return fx(JSON.stringify(e))}function le(e){return e.includes("data-stx-runtime")}function $p(e){let o=/window\.stx\s*\.\s*[A-Za-z_$]|\}\s*=\s*window\.stx\s*;/g;for(let x=o.exec(e);x!==null;x=o.exec(e)){let v=e.slice(Math.max(0,x.index-80),x.index);if(/if\s*\(\s*window\.stx\s*\)|window\.stx\s*&&/.test(v))continue;return!0}return!1}function Cc(e,o){let x=jr(e),v=e.search(/<!doctype\b/i);if(x!==-1&&(v===-1||x>v))return e.slice(0,x)+o+`
2505
+ `+e.slice(x);let k=js(e);if(k!==null)return`${e.slice(0,k)}
2506
+ ${o}${e.slice(k)}`;if(e.includes("</head>")){let C=e.indexOf("</head>");return e.slice(0,C)+o+`
2507
+ `+e.slice(C)}if(wn(e))return xr(e,(C)=>`${C}
2508
+ ${o}`);return`${o}
2509
+ ${e}`}async function Pi(e,o){if(e.includes("data-stx-runtime")||e.includes("window.stx.state")||e.includes("STX Signals Runtime"))return e;if(o.buildMode==="serve"){let{getServeClientAsset:k}=await import("./chunk-gea5hf0v.js"),{url:E}=await k("runtime",o.debug===!0);return Cc(e,`<script data-stx-runtime src="${E}"></script>`)}if(o.buildMode==="compile")return Cc(e,'<script data-stx-runtime src="/__stx/runtime.__STX_HASH__.js"></script>');let{getCachedSignalsRuntime:x}=await import("./chunk-gea5hf0v.js"),v=await x(o.debug);return Cc(e,`<script data-stx-scoped data-stx-runtime>${v}</script>`)}function gx(e){return/<[a-z][^>]*?\sx-tooltip\s*=/i.test(e)}function Sp(e){if(e.includes("data-stx-tooltip-runtime")||!gx(e))return e;let o=`<script data-stx-scoped data-stx-tooltip-runtime>${Pa()}</script>`,x=e.lastIndexOf("</body>");if(x===-1)return`${e}
2510
+ ${o}`;return`${e.slice(0,x)}${o}
2511
+ ${e.slice(x)}`}var mx=/<script\b[^>]*\sdata-stx-router(?=[\s=>])/i;function hx(e){return mx.test(e)||e.includes("__stxRouter)return")||e.includes("__stxRouter=true")}async function X(e,o){if(!e.includes("</body>"))return e;if(hx(e))return e;let x=o?.router,v="";{let L={};if(x){if(x.container)L.container=x.container;if(x.interceptAllLinks!==void 0)L.interceptAllLinks=x.interceptAllLinks;if(x.progress!==void 0)L.progress=x.progress;if(x.viewTransitions!==void 0)L.viewTransitions=x.viewTransitions;if(x.viewTransitionDuration!==void 0)L.viewTransitionDuration=x.viewTransitionDuration;if(x.viewTransitionEasing!==void 0)L.viewTransitionEasing=x.viewTransitionEasing;if(x.scrollToTop!==void 0)L.scrollToTop=x.scrollToTop;if(x.scrollRestoration!==void 0)L.scrollRestoration=x.scrollRestoration;if(x.prefetch!==void 0)L.prefetch=x.prefetch;if(x.cache!==void 0)L.cache=x.cache;if(x.progressColor!==void 0)L.progressColor=x.progressColor;if(x.progressHeight!==void 0)L.progressHeight=x.progressHeight}try{let B=await vp(o?.pagesDir,o?.root);if(B.length>0)L.ownedRoutes=B}catch{}if(Object.keys(L).length>0)v=`<script>window.__stxRouterConfig=${wp(L)};</script>
2512
+ `}let{getCachedRouterScript:k,getServeClientAsset:E}=await import("./chunk-gea5hf0v.js"),C=o?.buildMode==="compile"?'<script data-stx-router src="/__stx/router.__STX_HASH__.js"></script>':o?.buildMode==="serve"?`<script data-stx-router src="${(await E("router")).url}"></script>`:`<script data-stx-router>${await k()}</script>`,j=e.lastIndexOf("</body>");return e.slice(0,j)+v+C+`
2513
+ </body>`+e.slice(j+7)}var _p=Symbol.for("stx.lazy-module-promises");function yx(){let e=globalThis;return e[_p]??=new Map,e[_p]}function lt(e,o){let x=yx(),v=`${import.meta.url}\x00${e}`,k=x.get(v);if(k)return k;let E=o();return x.set(v,E),E.catch(()=>{if(x.get(v)===E)x.delete(v)}),E}var Rc=`(?:"[^"]*"|'[^']*'|[^>"'])*`,Ip=/^<([a-zA-Z][a-zA-Z0-9-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)>([\s\S]*)<\/\1>$/s,xx=65536,bx=4,co=new Map;function Mu(){co.clear()}function vx(e){let o=[];for(let x of $t(e,G)){let v=x.token.match(/^<script\b([^>]*)>/i),k=x.token.match(/<\/script\s*>$/i);if(!v||!k)continue;let E=v[0].length,C=x.token.length-k[0].length;o.push(Object.freeze({fullMatch:x.token,attrs:v[1],body:x.token.slice(E,C),start:x.start,end:x.end}))}return o}function ec(e,o={}){let x=e.length>=xx,v=x?co.get(e):void 0;if(v===void 0){if(v=vx(e),x)Yn(co,bx),co.set(e,v)}let k=o.skipAttrs;if(!k)return v.slice();let E=[];for(let C of v)if(k.lastIndex=0,!k.test(C.attrs))E.push(C);return E}function ns(e){let o=e.trim(),x=o.match(/^([\s\S]+?)\s+as\s+(.+)$/);if(x){let k=x[1].trim(),E=x[2].trim(),{itemVar:C,indexVar:j}=Ep(E);if(C)return{style:"as",iterable:k,itemVar:C,indexVar:j}}let v=o.match(/^(\([^)]+\)|\w+(?:\s*,\s*\w+)?)\s+(?:in|of)\s+([\s\S]+)$/);if(v){let k=v[1].trim(),E=v[2].trim(),{itemVar:C,indexVar:j}=Ep(k);if(C)return{style:"in",iterable:E,itemVar:C,indexVar:j}}return{style:"unknown",iterable:null,itemVar:null,indexVar:null}}function Ep(e){let o=e.trim(),x=o.match(/^(\w+)\s*=>\s*(\w+)$/);if(x)return{itemVar:x[2],indexVar:x[1]};let v=o.match(/^\(\s*(\w+)(?:\s*,\s*(\w+))?\s*\)$/);if(v)return{itemVar:v[1],indexVar:v[2]||null};let k=o.match(/^(\w+)\s*,\s*(\w+)$/);if(k)return{itemVar:k[1],indexVar:k[2]};let E=o.match(/^(\w+)$/);if(E)return{itemVar:E[1],indexVar:null};return{itemVar:null,indexVar:null}}function rs(e,o){return $o(e,o)}function wx(e){let o=/@(if\s*\(|endif|elseif\s*\(|else\b)/g,x=0,v;while((v=o.exec(e))!==null){let k=v[1];if(k.startsWith("if"))x++;else if(k==="endif")x--;else if(x===0)return!0}return!1}function Dp(e){let o=new Set,x=/<script\b(?![^>]*\bserver\b)(?![^>]*\bsrc\s*=)[^>]*>([\s\S]*?)<\/script>/gi,v=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal|useModel)\s*(?:<[^>]*>)?\s*\(/g,k;while((k=x.exec(e))!==null){let E=k[1],C;while((C=v.exec(E))!==null)o.add(C[1])}return o}function $x(e){if(!/[:@]for\s*=/.test(e)&&!/\bx-for\s*=/.test(e))return[];let o=new RegExp(`<([a-zA-Z][\\w-]*)\\b(${Rc})>`,"iy"),x=/(?:^|\s)(?::for|@for|x-for)\s*=\s*(?:"([^"]*)"|'([^']*)')/i,v=$t(e,(E,C)=>{o.lastIndex=C;let j=o.exec(E);if(!j||j.index!==C||!x.test(j[2]))return-1;return o.lastIndex}),k=[];for(let E of v){o.lastIndex=0;let C=o.exec(E.token);if(!C)continue;let j=C[2].match(x),L=ns(j?.[1]??j?.[2]??""),B=[L.itemVar,L.indexVar].filter(Boolean);if(B.length===0)continue;let F=C[1],Z=/\/\s*>$/.test(E.token)||po.has(F.toLowerCase())?E.end:Tc(e,E.start,F,E.end);if(Z!==-1)k.push({start:E.start,end:Z,vars:new Set(B)})}return k}var kp=new Set(["true","false","null","undefined","NaN","Infinity","typeof","instanceof","in","of","new","void","delete","this","Math","JSON","Date","Number","String","Boolean","Array","Object","RegExp","Map","Set","Symbol","parseInt","parseFloat","isNaN","isFinite","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","window","document","console"]);function Sx(e){return e.replace(/'(?:\\.|[^'\\])*'/g,"''").replace(/"(?:\\.|[^"\\])*"/g,'""').replace(/`(?:\\.|[^`\\])*`/g,"``")}function Cp(e,o,x,v){if(!e)return!1;let k=Sx(e),E=!1,C=!1,j=!1,L=/([a-zA-Z_$][\w$]*)/g,B;while((B=L.exec(k))!==null){let Y=B[1];if(k.slice(0,B.index).trimEnd().endsWith("."))continue;if(kp.has(Y))continue;if(o.has(Y)||v?.has(Y))E=!0;else if(x&&Y in x)C=!0}let F=/([a-zA-Z_$][\w$]*)(?:\.[a-zA-Z_$][\w$]*)*\s*\(\s*\)/g,U;while((U=F.exec(k))!==null){let Y=U[1];if(k.slice(0,U.index).trimEnd().endsWith("."))continue;if(kp.has(Y)||x&&Y in x)continue;j=!0}return(E||j)&&!C}function Oi(e,o,x){let v=x===void 0?` ${o}`:` ${o}="${x.replace(/"/g,"&quot;")}"`,k=e.trim(),E=k.match(Ip);if(E&&_x(E[3],E[1])){let[,C,j,L]=E;return`<${C}${j}${v}>${L}</${C}>`}return`<template${v}>${k}</template>`}function _x(e,o){let x=new RegExp(`<(/)?${o}(?=[\\s/>])`,"gi"),v=0,k;while((k=x.exec(e))!==null)if(k[1]){if(v--,v<0)return!1}else v++;return!0}function Hi(e,o){let x=Dp(e);function v(k){let E=k,C=$x(k),j=(U)=>{let Z=new Set;for(let Y of C)if(U>Y.start&&U<Y.end)for(let Q of Y.vars)Z.add(Q);return Z},L=/@if\s*\(/g,B,F=[];while((B=L.exec(E))!==null){let U=B.index,Z=U+B[0].length,Y=1,Q=Z;while(Q<E.length&&Y>0){if(E[Q]==="(")Y++;else if(E[Q]===")")Y--;Q++}if(Y!==0)continue;let se=E.substring(Z,Q-1).trim(),oe=Q,ie=1,ce=oe,ae=/@(if\s*\(|endif)/g;ae.lastIndex=oe;let pe;while((pe=ae.exec(E))!==null)if(pe[1].startsWith("if"))ie++;else if(pe[1]==="endif"){if(ie--,ie===0){ce=pe.index+pe[0].length;break}}if(ie!==0)continue;let me=E.substring(oe,ce-6).trim(),he;if(wx(me)){let Se=Fr(E.substring(U,ce));if(Se.length===0)continue;let Ee=Se[0].branches.filter((_e)=>_e.type!=="else"),Ce=j(U);if(!(Ee.length>0&&Ee.every((_e)=>Cp(_e.condition,x,o,Ce))))continue;he=Se[0].branches.map((_e)=>{let Te=v(_e.content);if(_e.type==="elseif")return Oi(Te,"@else-if",_e.condition??"");if(_e.type==="else")return Oi(Te,"@else");return Oi(Te,"@if",_e.condition??"")}).join(`
2514
+ `)}else{if(!Cp(se,x,o,j(U)))continue;he=Oi(v(me),"@if",se)}F.push({start:U,end:ce,replacement:he}),L.lastIndex=ce}for(let U=F.length-1;U>=0;U--){let{start:Z,end:Y,replacement:Q}=F[U];E=E.substring(0,Z)+Q+E.substring(Y)}return E}return v(e)}function Ex(e){let o=e.trim();if(o==="")return;if(o==="true")return!0;if(o==="false")return!1;if(o==="null")return!1;if(o==="undefined")return!1;if(o==="NaN")return!1;if(/^-?\d+(?:\.\d+)?$/.test(o)){let k=Number(o);return k!==0&&!Number.isNaN(k)}let x=o.match(/^'((?:\\.|[^'\\])*)'$/);if(x)return x[1].length>0;let v=o.match(/^"((?:\\.|[^"\\])*)"$/);if(v)return v[1].length>0;return}var po=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),Rp=/<(script|style)\b/iy,kx=/<\/script/gi,Cx=/<\/style/gi;function Tc(e,o,x,v){if(po.has(x.toLowerCase()))return v;let k=x.toLowerCase(),E=e.length,C=1,j=v;while(j<E){let L=e.indexOf("<",j);if(L===-1)return-1;if(j=L,e.startsWith("<!--",j)){let Z=e.indexOf("-->",j+4);if(Z===-1)return-1;j=Z+3;continue}Rp.lastIndex=j;let B=Rp.exec(e);if(B){let Z=e.indexOf(">",j);if(Z===-1)return-1;if(e[Z-1]==="/"){j=Z+1;continue}let Y=B[1].toLowerCase()==="script"?kx:Cx;Y.lastIndex=j;let Q=Y.exec(e);if(Q===null)return-1;let se=e.indexOf(">",Q.index);if(se===-1)return-1;j=se+1;continue}if(e[j+1]==="/"){let Z=/^<\/([a-z][\w-]*)\s*>/i.exec(e.slice(j,j+64));if(!Z){j++;continue}if(Z[1].toLowerCase()===k){if(C--,j+=Z[0].length,C===0)return j;continue}j+=Z[0].length;continue}let F=/^<([a-z][\w-]*)\b/i.exec(e.slice(j,j+64));if(!F){j++;continue}let U=e.indexOf(">",j);if(U===-1)return-1;if(F[1].toLowerCase()===k){let Z=e.slice(j,U+1);if(!(/\/\s*>$/.test(Z)||po.has(k)))C++}j=U+1}return-1}var Rx=/\s(?::else-if|x-else-if|@else-if|:else|x-else|@else)(?=[=\s/>])/;function Ax(e,o){let x=o,v=e.length;for(;;){while(x<v&&e[x]!=="<")x++;if(x>=v)return!1;if(e.startsWith("<!--",x)){let C=e.indexOf("-->",x+4);if(C===-1)return!1;x=C+3;continue}break}if(e[x+1]==="/")return!1;let k=e.indexOf(">",x);if(k===-1)return!1;let E=e.slice(x,k+1);return Rx.test(E)}function Vi(e){if(!e.includes(":if")&&!e.includes(":show")&&!e.includes("x-if")&&!e.includes("x-show")&&!e.includes("@if=")&&!e.includes("@show="))return e;let o=[],x=/<(script|style)\b[^>]*>[\s\S]*?<\/\1\s*>/gi,v;while((v=x.exec(e))!==null)o.push([v.index,v.index+v[0].length]);let k=(U)=>o.some(([Z,Y])=>U>=Z&&U<Y),E=/<([a-zA-Z][\w-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*?)\s+(:if|:show|x-if|x-show|@if|@show)\s*=\s*"([^"]*)"((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)(\/?)>/g,C=[],j;while((j=E.exec(e))!==null){if(k(j.index))continue;let[U,Z,Y,Q,se,oe,ie]=j,ce=Ex(se);if(ce===void 0)continue;let ae=j.index,pe=ae+U.length,Se=!!ie||/\/\s*>$/.test(U)||po.has(Z.toLowerCase())?pe:Tc(e,ae,Z,pe);if(Se===-1)continue;if((Q===":if"||Q==="x-if"||Q==="@if")&&Ax(e,Se)){E.lastIndex=pe;continue}if(ce===!0){let Ce=`<${Z}${Y}${oe}${ie}>`;C.push({start:ae,end:pe,replacement:Ce});continue}C.push({start:ae,end:Se,replacement:""}),E.lastIndex=Se}if(C.length===0)return e;C.sort((U,Z)=>U.start-Z.start);let L=[],B=-1;for(let U of C){if(U.start<B)continue;L.push(U),B=U.end}let F=e;for(let U=L.length-1;U>=0;U--){let{start:Z,end:Y,replacement:Q}=L[U];F=F.substring(0,Z)+Q+F.substring(Y)}return F}var Ap=[":for","@for","x-for"];function ss(e,o){if(!o||Object.keys(o).length===0)return e;if(!Ap.some((j)=>e.includes(`${j}=`)))return e;let x=Dp(e);if(Array.isArray(o.__stx_client_signal_names)){for(let j of o.__stx_client_signal_names)if(typeof j==="string")x.add(j)}let v=e,k=[],E=/<([a-zA-Z][\w-]*)((?:[^>"']|"[^"]*"|'[^']*')*)>/g,C;while((C=E.exec(v))!==null){let[j,L,B]=C,F=C.index,U=F+j.length,Z=Ap.map((he)=>({attr:he,m:new RegExp(`\\s${he}="([^"]*)"`).exec(B)})).find((he)=>he.m!==null);if(!Z||!Z.m)continue;let Y=ns(Z.m[1]);if(!Y.iterable||!Y.itemVar)continue;let Q=Y.iterable.trim().split(/[.[(]/)[0].trim();if(!Q||x.has(Q)||!(Q in o))continue;let se=Tc(v,F,L,U);if(se===-1)continue;let oe=B.replace(new RegExp(`\\s${Z.attr}="[^"]*"`),"").replace(/\s:key="[^"]*"/,"").replace(/\sx-cloak(?=\s|$)/,""),ie=v.slice(U,se-`</${L}>`.length),ce={...o,[Y.itemVar]:void 0};if(Y.indexVar)ce[Y.indexVar]=void 0;let ae=ss(ie,ce),pe=Y.indexVar?`${Y.iterable} as ${Y.indexVar} => ${Y.itemVar}`:`${Y.iterable} as ${Y.itemVar}`,me=L.toLowerCase()==="template"?ae:`<${L}${oe}>${ae}</${L}>`;k.push({start:F,end:se,replacement:`@foreach(${pe})${me}@endforeach`}),E.lastIndex=se}for(let j=k.length-1;j>=0;j--){let{start:L,end:B,replacement:F}=k[j];v=v.slice(0,L)+F+v.slice(B)}return v}function is(e,o){let x=e,v=/@(for|foreach)\s*\(/g,k,E=[],C=[];while((k=v.exec(x))!==null){let j=k[1],L=k.index,B=L+k[0].length,F=1,U=B;while(U<x.length&&F>0){if(x[U]==="(")F++;else if(x[U]===")")F--;U++}if(F!==0)continue;let Z=x.substring(B,U-1).trim(),Y=U,Q=ns(Z),se=j==="for"?"@endfor":"@endforeach",oe=1,ie=Y,ce=j==="for"?new RegExp("@(for(?!each)\\s*\\(|endfor(?!each))","g"):new RegExp(`@(${j}\\s*\\(|end${j})`,"g");ce.lastIndex=Y;let ae;while((ae=ce.exec(x))!==null)if(ae[1].startsWith(j))oe++;else if(oe--,oe===0){ie=ae.index+ae[0].length;break}if(oe!==0)continue;let pe=()=>{let Re=[Q.itemVar,Q.indexVar].filter(Boolean);if(Re.length)C.push({start:L,end:ie,vars:Re})};if(Q.iterable){let Re=Q.iterable.trim();if(Re.startsWith("[")||Re.startsWith("{")||Re.startsWith("'")||Re.startsWith('"')||Re.startsWith("`")||/^-?\d/.test(Re)){pe();continue}let Ae=Re.split(/[.[(]/)[0].trim(),_e=o?Ae in o:!1,Te=C.some((Me)=>L>Me.start&&L<Me.end&&Me.vars.includes(Ae));if(Ae&&(_e||Te)){pe();continue}}if(Q.style==="as")Z=Q.indexVar?`(${Q.itemVar}, ${Q.indexVar}) in ${Q.iterable}`:`${Q.itemVar} in ${Q.iterable}`;let me=x.substring(Y,ie-se.length).trim(),he=o?{...o}:{};if(Q.itemVar)delete he[Q.itemVar];if(Q.indexVar)delete he[Q.indexVar];let Se=is(me,he),Ee=Se.match(Ip),Ce;if(Ee){let[,Re,Ae,_e]=Ee;Ce=`<${Re}${Ae} @for="${Z}">${_e}</${Re}>`}else Ce=`<template @for="${Z}">${Se}</template>`;E.push({start:L,end:ie,replacement:Ce}),v.lastIndex=ie}for(let j=E.length-1;j>=0;j--){let{start:L,end:B,replacement:F}=E[j];x=x.substring(0,L)+F+x.substring(B)}return x}function Tx(e){let o=new Set,x=[],v=0,k=0,E=e.length,C=(F)=>{let U=v+1;while(U<E){let Z=e[U];if(Z==="\\"){U+=2;continue}if(Z===F)return U+1;U++}return E},j=()=>{let F=v+2;while(F<E&&e[F]!==`
2515
+ `)F++;return F},L=()=>{let F=v+2;while(F<E-1){if(e[F]==="*"&&e[F+1]==="/")return F+2;F++}return E},B=(F)=>{let U=F,Z=0;while(U<E){let Y=e[U];if(Y==="/"&&e[U+1]==="/"){let Q=U+2;while(Q<E&&e[Q]!==`
2516
+ `)Q++;U=Q;continue}if(Y==="/"&&e[U+1]==="*"){let Q=U+2;while(Q<E-1&&!(e[Q]==="*"&&e[Q+1]==="/"))Q++;U=Q+2;continue}if(Y==='"'||Y==="'"||Y==="`"){let Q=U+1;while(Q<E){if(e[Q]==="\\"){Q+=2;continue}if(e[Q]===Y){Q++;break}Q++}U=Q;continue}if(Y==="("||Y==="["||Y==="{"){Z++,U++;continue}if(Y===")"||Y==="]"||Y==="}"){Z--,U++;continue}if(Y===";"&&Z===0)return U+1;U++}return E};while(v<E){let F=e[v];if(F==="/"&&e[v+1]==="/"){let U=j();x.push(e.slice(v,U)),v=U;continue}if(F==="/"&&e[v+1]==="*"){let U=L();x.push(e.slice(v,U)),v=U;continue}if(F==='"'||F==="'"||F==="`"){let U=C(F);x.push(e.slice(v,U)),v=U;continue}if(F==="{"){k++,x.push(F),v++;continue}if(F==="}"){k--,x.push(F),v++;continue}if(k===0){let U=v>0?e[v-1]:"";if(U===""||/\s/.test(U)||U===";"||U==="}"||U==="{"){let Y=e.slice(v).match(/^(const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=/);if(Y){let Q=Y[2],se=B(v+Y[0].length);if(o.has(Q)){x.push(`/* stx: deduped const ${Q} */`),v=se;continue}o.add(Q),x.push(e.slice(v,se)),v=se;continue}}}x.push(F),v++}return x.join("")}var Ix=new Set(["script","style","html","head","meta","link","title","!doctype"]);function Ac(e,o,x){for(let v of x){if(v.start>=o)return!1;if(v.end>e)return!0}return!1}function Dx(e,o,x){let v=0;while(v<e.length){let k=e.indexOf(o,v);if(k===-1)return!1;if(!Ac(k,k+o.length,x))return!0;v=k+o.length}return!1}function Px(e,o){if(Dx(e,"<body",o)){let k=new RegExp(`<body(${Rc})>`,"g"),E;while((E=k.exec(e))!==null)if(!Ac(E.index,E.index+E[0].length,o))return E.index+E[0].length-1;return null}let x=new RegExp(`<([a-zA-Z][a-zA-Z0-9-]*)\\b(${Rc})>`,"gi"),v;while((v=x.exec(e))!==null){if(Ac(v.index,v.index+v[0].length,o))continue;if(Ix.has(v[1].toLowerCase()))continue;return v.index+v[0].length-1}return null}function Mx(e,o,x,v){let k=[],E=` data-stx="${v}"`,C=0,j=!1,L=(B)=>{if(x!==null&&!j&&x>=C&&x<=B)k.push(e.slice(C,x),E,e.slice(x,B)),j=!0;else k.push(e.slice(C,B))};for(let B of o){if(B.start<C)continue;L(B.start),C=B.end}return L(e.length),k.join("")}async function tc(e,o,x){let v=ec(e,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b/}),k=/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useStore|useLocalStorage|useSessionStorage|keptState|useCookie|useId|useModel|useReactiveProp|useFetch|useRef|useEventListener|useDebounce|useDebouncedValue|useThrottle|useInterval|useTimeout|useToggle|useCounter|useClickOutside|useFocus|useAsync|useColorMode|useDark|useMediaQuery|useScrollLock|usePreferredDark|usePreferredLight|usePreferredReducedMotion|usePreferredContrast|useWebSocket|useRoute|useSearchParams|onMount|onDestroy|defineProps|withDefaults|defineEmits|defineExpose|defineSlots|useOptimistic)\s*(?:<[^>]*>)?\s*\(/,E=[],{hasUserImports:C,bundleClientScript:j}=await lt("stx/client-script-bundler",()=>import("./chunk-hn9pkyv8.js"));for(let ce of v){let ae=ce.body;if(Ve(ce.attrs))ae=Ue(ae);if(k.test(ae)){E.push({content:ae,start:ce.start,end:ce.end});continue}if(!C(ae))continue;try{let pe=await j(bt(ae).code,o||"",{projectRoot:process.cwd(),externalizeUserModules:!1});if(k.test(pe))E.push({content:ae,start:ce.start,end:ce.end})}catch{}}if(E.length===0)return{output:e,setupCode:null};let L=`${o??""}\x00${E.map((ce)=>ce.content).join("\x00")}`,B=`__stx_setup_${Bun.hash(L).toString(36).slice(0,10)}`,F=[];for(let ce=0;ce<E.length;ce++){let ae=E[ce].bundled??bt(E[ce].content).code;if(!E[ce].bundled&&C(ae))ae=await j(ae,o||"",{projectRoot:process.cwd()});ae=ze(ae);let pe=R(ae);F.push(`// \u2500\u2500 merged signal script #${ce+1} \u2500\u2500
2517
+ ${pe}`)}let U=F.join(`
2518
+
2519
+ `);U=Tx(U);let Z=nc(U),Y=Z.split(",").map((ce)=>ce.trim()).filter(Boolean),Q=Gr(U,x),se=`
2520
+ <script data-stx-scoped>
2521
+ function ${B}() {
2522
+ ${It("const",Y)}
2523
+ ${Ir(`${Q}${U}`)}
2524
+ return { ${Z} };
2525
+ }
2526
+ window.__stx_latestSetup=${B};
2527
+ if(window.stx)window.stx._latestSetup=${B};
2528
+ </script>`,oe=Px(e,E);return{output:Mx(e,E,oe,B),setupCode:se}}function nc(e){let o=e,x=[],v=new Set,k=0,E=0,C=o.length,j="",L=()=>{E++;let Q=!1;while(E<C){let se=o[E];if(se==="\\"){E+=2;continue}if(se==="["&&!Q){Q=!0,E++;continue}if(se==="]"&&Q){Q=!1,E++;continue}if(se==="/"&&!Q){E++;while(E<C&&/[gimsuyd]/.test(o[E]))E++;return}if(se===`
2529
+ `)return;E++}},B=()=>{if(!j)return!0;if(/[\w)\]]/.test(j))return!1;return!0},F=(Q)=>{E++;while(E<C){if(o[E]==="\\"){E+=2;continue}if(o[E]===Q){E++;return}E++}},U=()=>{E++;while(E<C){if(o[E]==="\\"){E+=2;continue}if(o[E]==="`"){E++;return}if(o[E]==="$"&&o[E+1]==="{"){E+=2;let Q=1;while(E<C&&Q>0)if(o[E]==="{")Q++,E++;else if(o[E]==="}")Q--,E++;else if(o[E]==="'"||o[E]==='"')F(o[E]);else if(o[E]==="`")U();else E++;continue}E++}},Z=()=>{if(o[E]==="/"&&o[E+1]==="/"){while(E<C&&o[E]!==`
2530
+ `)E++;return!0}if(o[E]==="/"&&o[E+1]==="*"){E+=2;while(E<C-1&&!(o[E]==="*"&&o[E+1]==="/"))E++;return E+=2,!0}return!1},Y=()=>{if(k!==0)return;let Q=o.slice(E).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*(?:[!:;,\n]|=(?!=)|$)/);if(Q){let ae=Q[2];if(!v.has(ae))x.push(ae),v.add(ae);return}let se=o.slice(E).match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(se){se[1].split(",").forEach((ae)=>{let pe=ae.trim();if(!pe)return;let me=pe.indexOf(":"),Se=(me>=0?pe.slice(me+1).trim():pe).split(/[\s=]/)[0];if(Se&&!v.has(Se))x.push(Se),v.add(Se)});return}let oe=o.slice(E).match(/^(?:const|let|var)\s+\[([^\]]+)\]\s*=/);if(oe){oe[1].split(",").forEach((ae)=>{let pe=ae.trim().replace(/^\.\.\./,"");if(!pe)return;let me=pe.split(/[\s=]/)[0];if(me&&!v.has(me))x.push(me),v.add(me)});return}let ie=o.slice(E).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(ie){let ae=ie[1];if(!v.has(ae))x.push(ae),v.add(ae);return}let ce=o.slice(E).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(ce){let ae=ce[1];if(!v.has(ae))x.push(ae),v.add(ae)}};while(E<C){if(Z())continue;if(o[E]==="'"||o[E]==='"'){F(o[E]),j=o[E-1];continue}if(o[E]==="`"){U(),j="`";continue}if(o[E]==="/"&&o[E+1]!=="/"&&o[E+1]!=="*"&&B()){L(),j="/";continue}if(o[E]==="{"){k++,j="{",E++;continue}if(o[E]==="}"){k--,j="}",E++;continue}if(k===0&&/[a-z]/i.test(o[E])&&(E===0||/\s|[;{}()]/.test(o[E-1])))Y();if(!/\s/.test(o[E]))j=o[E];E++}return x.join(", ")}async function Ui(e,o,x,v){if(!rs(e,x))return e;let k=e;if(o.skipSignalsRuntime)return k;let{output:E,setupCode:C}=await tc(k,x,v);if(k=E,!C){let j=wn(k);if(j&&!/data-stx/.test(j.attrs)&&!/data-stx-auto/.test(j.attrs)){let L=j.tag.replace(/^<body([^>]*)>$/i,"<body$1 data-stx-auto>");k=k.slice(0,j.index)+L+k.slice(j.index+j.tag.length)}}if(k=await Pi(k,o),C){let j=Wi(k,/<\/head>/i),L=j===-1?Wi(k,/<body[^>]*>/i):-1;if(j!==-1)k=`${k.slice(0,j)}${C}
2531
+ ${k.slice(j)}`;else if(L!==-1){let B=/<body[^>]*>/i.exec(k.slice(L))[0],F=L+B.length;k=`${k.slice(0,F)}
2532
+ ${C}${k.slice(F)}`}else k=`${k}
2533
+ ${C}`}return k}function Wi(e,o){let x=/<(script|style)\b[\s\S]*?<\/\1>/gi,v=[],k;while((k=x.exec(e))!==null)v.push([k.index,k.index+k[0].length]);let E=new RegExp(o.source,o.flags.replace(/[gy]/g,"")),C=0;while(C<e.length){let j=E.exec(e.slice(C));if(!j)return-1;let L=C+j.index;if(!v.some(([F,U])=>L>=F&&L<U))return L;C=L+Math.max(j[0].length,1)}return-1}var Tp="/* [stx import stripped, resolved via window.stx in __stx_setup] */";function rc(e){let o=[];for(let x of e.split(",")){let v=x.trim();if(!v||v.startsWith("type "))continue;let k=v.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(k&&k[1]!==k[2])o.push(`${k[2]} = ${k[1]}`)}if(o.length===0)return Tp;return`var ${o.join(", ")}; ${Tp}`}var Ox=/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"](?:stx|@stacksjs\/stx|@stacksjs\/browser)['"]\s*;?\s*$/gm;function ze(e){return e.replace(Ox,(o,x)=>rc(x))}import Dr from"path";import Nx from"process";function y(e="STX_PUBLIC_"){let o={},x={};for(let[v,k]of Object.entries(Nx.env)){if(!v.startsWith(e)||k===void 0)continue;o[`import.meta.env.${v}`]=JSON.stringify(k),x[v]=k}return o["import.meta.env"]=JSON.stringify(x),o}function Pp(e){return e.startsWith("http://")||e.startsWith("https://")||e.startsWith("//")}async function Mp(e,o,x){try{let v;if(e.startsWith("/")){let k=o;for(let E=0;E<5;E++){let C=Dr.join(k,e);if(await Bun.file(C).exists())return C;k=Dr.dirname(k)}v=Dr.join(o,e)}else if(e.startsWith("./")||e.startsWith("../"))v=Dr.resolve(o,e);else v=Dr.resolve(o,e);if(await Bun.file(v).exists())return v;return null}catch{return null}}var Op=Symbol.for("stx.inline-assets.import-meta");function jx(e,o){if(!e.includes("import.meta"))return;let x=Error(`[stx] ${o} still references \`import.meta\` after bundling, and it is being inlined as a classic <script> where that is a SyntaxError \u2014 the whole script fails to parse, taking every other script on the page with it.
2534
+ `+" `import.meta.env.STX_PUBLIC_*` is substituted at build time and is safe; anything else is not.\n Fix it by moving the module-only code (`import.meta.glob`, `import.meta.url`) into its own module, or by resolving the value without `import.meta`.");throw x[Op]=!0,x}async function Np(e,o,x){let v=e,k=Dr.dirname(o),E=/<script\b([^>]*)src=["']([^"']+)["']([^>]*)><\/script>/gi,C;while((C=E.exec(v))!==null){let[B,F,U,Z]=C;if(Pp(U))continue;let Y=await Mp(U,k,o);if(Y)try{let Q=await Bun.file(Y).text();if(x.add(Y),U.endsWith(".ts")||U.endsWith(".tsx")){let oe=await Bun.build({entrypoints:[Y],target:"browser",minify:!0,define:y()});if(oe.outputs.length>0)Q=await oe.outputs[0].text(),jx(Q,U)}let se=`<script>
2535
+ // Source: ${U}
2536
+ ${Q}
2537
+ </script>`;v=v.replace(B,se),E.lastIndex=0}catch(Q){if(Q?.[Op])throw Q}}let j=/<link\b([^>]*)href=["']([^"']+)["']([^>]*)(?:\/?>)/gi,L;while((L=j.exec(v))!==null){let[B,F,U,Z]=L,Y=F+Z;if(Pp(U))continue;if(/rel=["']stylesheet["']/.test(Y)||U.endsWith(".css")){let se=await Mp(U,k,o);if(se)try{let oe=await Bun.file(se).text();x.add(se);let ie=`<style>
2538
+ /* Source: ${U} */
2539
+ ${oe}
2540
+ </style>`;v=v.replace(B,ie),j.lastIndex=0}catch(oe){}}}return v}function ps(e,o){let x=e,v=/@json\s*\(/g,k;while((k=v.exec(x))!==null){let E=k.index,C=E+k[0].length-1,j=1,L=C+1,B=null,F=!1;while(L<x.length&&j>0){let ae=x[L];if(F){F=!1,L++;continue}if(ae==="\\"&&B){F=!0,L++;continue}if(B){if(ae===B)B=null;L++;continue}if(ae==='"'||ae==="'"||ae==="`"){B=ae,L++;continue}if(ae==="(")j++;else if(ae===")"){if(j--,j===0)break}L++}if(j!==0)break;let U=x.substring(C+1,L).trim(),Z=x.substring(E,L+1),Y=-1,Q=0,se=null,oe=!1;for(let ae=0;ae<U.length;ae++){let pe=U[ae];if(oe){oe=!1;continue}if(pe==="\\"&&se){oe=!0;continue}if(se){if(pe===se)se=null;continue}if(pe==='"'||pe==="'"||pe==="`"){se=pe;continue}if(pe==="("||pe==="["||pe==="{")Q++;else if(pe===")"||pe==="]"||pe==="}")Q--;if(pe===","&&Q===0){Y=ae;break}}let ie=Y>=0?U.substring(0,Y).trim():U,ce=Y>=0?U.substring(Y+1).trim():void 0;try{let ae=ie.trim(),pe;if(p(ae))pe=l(ae,Object.keys(o))(...Object.values(o));else pe=void 0;let me;if(ce==="true")me=JSON.stringify(pe,null,2);else me=JSON.stringify(pe);let he=me.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029");x=x.substring(0,E)+he+x.substring(L+1),v.lastIndex=E+he.length}catch(ae){_.log(ae instanceof Error?ae:Error(String(ae)),{directive:"@json"},"error"),v.lastIndex=E+Z.length}}return x}function gs(e){return e.replace(/@once\s*([\s\S]*?)@endonce/g,"$1")}function Lp(e){let o=e,x=/@memo\s*\(/g,v,k=[];while((v=x.exec(o))!==null){let E=v.index,C=E+v[0].length,j=1,L=C;while(L<o.length&&j>0){if(o[L]==="(")j++;else if(o[L]===")")j--;L++}if(j!==0)continue;let B=o.slice(C,L-1).trim(),F=L,U=o.slice(F),Z=U.indexOf("@endmemo");if(Z===-1)continue;let Y=U.slice(0,Z),Q=F+Z+8,se=Y.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)/),oe=se?se[0].length:0,ie=Y.slice(oe),ce=Y.match(/(\s*)$/),ae=ce?ce[0].length:0,pe=ie.slice(0,ie.length-ae),me=pe.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)?(\/?)>/),he;if(me){let[Se,Ee,Ce="",Re]=me,Ae=`<${Ee}${Ce} data-stx-memo="${B}"${Re}>`;he=Y.slice(0,oe)+Ae+pe.slice(Se.length)+Y.slice(oe+pe.length)}else he=`${Y.slice(0,oe)}<div data-stx-memo="${B}">${pe}</div>${Y.slice(oe+pe.length)}`;k.push({start:E,end:Q,replacement:he}),x.lastIndex=Q}for(let E=k.length-1;E>=0;E--){let C=k[E];o=o.slice(0,C.start)+C.replacement+o.slice(C.end)}return o.replace(/@memo="([^"]*)"/g,'data-stx-memo="$1"')}function Ic(e){let o=e.replace(/@ref="([^"]+)"/g,'data-stx-ref="$1"');return o=o.replace(/(<[a-zA-Z][a-zA-Z0-9-]*\b[^>]*?)\sref="([^"]+)"/g,'$1 data-stx-ref="$2"'),o}function Bp(e,o){if(!/\bref\s*=/.test(e))return e;let x=/<\/?([a-zA-Z][\w-]*)\b(?:"[^"]*"|'[^']*'|[^'">])*>/y,v=$t(e,(L,B)=>{x.lastIndex=B;let F=x.exec(L);if(!F||/^(?:script|style)$/i.test(F[1]))return-1;return x.lastIndex}),k=[],E=0,C=0,j=[];for(let{start:L,end:B,token:F}of v){let U=/^<\/?([\w-]+)/.exec(F)[1].toLowerCase();if(F.startsWith("</")){let Y;while(Y=k.pop()){if(Y.scoped)E--;if(Y.name===U)break}continue}let Z=/\sdata-stx-scope\s*=/.test(F);if(!E&&!Z&&/\s(?:ref|@ref|:ref|x-ref|data-stx-ref)\s*=/.test(F)&&!/\sdata-stx-ref-caller\s*=/.test(F))j.push(e.slice(C,L),F.replace(/\s*\/?>$/,(Y)=>` data-stx-ref-caller="${o}"${Y}`)),C=B;if(!zp.has(U)&&!/\/>$/.test(F)){if(k.push({name:U,scoped:Z}),Z)E++}}return j.push(e.slice(C)),j.join("")}var zp=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),Wp=/(?:^|\s)x-no-cloak(?:=|\s|\/|>|$)/,jp=/<\/?\s*([a-z][\w-]*)/iy,Lx=/\s/;function Bx(e,o){let x=o-1;while(x>=0&&Lx.test(e[x]))x--;return x>=0&&e[x]==="/"}function zx(e,o){let x=!1,v=!1;for(let k=o;k<e.length;k++){let E=e[k];if(x){if(E==="'")x=!1}else if(v){if(E==='"')v=!1}else if(E==="'")x=!0;else if(E==='"')v=!0;else if(E===">")return k}return-1}function Wx(e,o){if(e.indexOf("{",o)===-1||e.indexOf("}",o)===-1)return!1;let x=0,v=o,k=!1,E=!1,C=!1;while(v<e.length){let j=e.indexOf("<",v),L=j===-1?e.length:j;if(L>v){if(x===0)while(v<L){let U=e.indexOf(E?"}":"{",v);if(U===-1||U>=L){if(E)C=!1;else k=!1;break}if(U>v)if(E)C=!1;else k=!1;if(E){if(C)return!0;C=!0}else if(k)E=!0,C=!1;else k=!0;v=U+1}v=L;continue}if(e.startsWith("<!--",v)){let U=e.indexOf("-->",v);v=U===-1?e.length:U+3;continue}let B=zx(e,v);if(B===-1)break;jp.lastIndex=v;let F=jp.exec(e)?.[1]?.toLowerCase()??"";if(e[v+1]==="/"){if(x===0)break;x--}else if(!Bx(e,B)&&!zp.has(F))x++;v=B+1}return!1}function Fp(e){if(e.length>=32768&&!bo(e))return e;let x=new RegExp(`<(${"div|span|p|h[1-6]|td|th|li|a|button|label|section|article|header|footer|main|nav|aside|dd|dt|figcaption|summary|caption|blockquote|pre|code|em|strong|small|sub|sup|time|mark|abbr|cite|q|s|u|b|i"})\\b`,"gi"),v="",k=0,E;while((E=x.exec(e))!==null){let C=E.index,j=C+E[0].length,L=!1,B=!1,F=-1;while(j<e.length){let Z=e[j];if(L){if(Z==="'")L=!1}else if(B){if(Z==='"')B=!1}else if(Z==="'")L=!0;else if(Z==='"')B=!0;else if(Z===">"){F=j;break}j++}if(F===-1)continue;let U=e.slice(C,F+1);if(Wp.test(U))continue;if(U.includes("x-cloak"))continue;if(Wx(e,F+1))v+=e.slice(k,F)+" x-cloak>",k=F+1}return v+=e.slice(k),v}var Fx=/(?:^|\s)(?::else-if|:if|:else|:show|x-else-if|x-if|x-else|x-show|@if|@show)(?:=|\s|\/|>|$)/,Vx=/<\/script>/gi,Ux=/<\/style>/gi;function Vp(e){let o=/<[a-z][\w-]*/gi,x="",v=0,k;while((k=o.exec(e))!==null){let E=k.index,C=k[0].slice(1).toLowerCase();if(C==="script"||C==="style"){let Q=C==="script"?Vx:Ux;Q.lastIndex=E;let se=Q.exec(e);if(se!==null)o.lastIndex=se.index+se[0].length;continue}let j=E+k[0].length,L=!1,B=!1,F=-1;while(j<e.length){let Q=e[j];if(L){if(Q==="'")L=!1}else if(B){if(Q==='"')B=!1}else if(Q==="'")L=!0;else if(Q==='"')B=!0;else if(Q===">"){F=j;break}j++}if(F===-1)continue;let U=e.slice(E+k[0].length,F);if(Wp.test(U))continue;if(/(?:^|\s)x-cloak(?:=|\s|\/|>|$)/.test(U))continue;if(!Fx.test(U))continue;let Z=e[F-1]==="/",Y=Z?F-1:F;x+=`${e.slice(v,Y)} x-cloak${Z?" ":""}`,v=Y}return x+=e.slice(v),x}var Dc=P(256),Hx=[{pattern:/document\.getElementById\s*\(/g,message:"document.getElementById() is prohibited",suggestion:'Use useRef("name") instead'},{pattern:/document\.querySelector\s*\(/g,message:"document.querySelector() is prohibited",suggestion:'Use useRef("name") instead'},{pattern:/document\.querySelectorAll\s*\(/g,message:"document.querySelectorAll() is prohibited",suggestion:'Use useRef("name") and access children instead'},{pattern:/document\.getElementsBy\w+\s*\(/g,message:"document.getElementsBy*() is prohibited",suggestion:'Use useRef("name") instead'},{pattern:/document\.createElement\s*\(/g,message:"document.createElement() is prohibited",suggestion:"Use template directives or component composition instead"},{pattern:/document\.activeElement(?![A-Za-z])/g,message:"document.activeElement is prohibited",suggestion:"Use useRef() to track focused elements"},{pattern:/document\.title\s*=/g,message:"document.title assignment is prohibited",suggestion:"Use useTitle() from composables"},{pattern:/document\.cookie(?![A-Za-z])/g,message:"document.cookie is prohibited",suggestion:"Use useCookie() from composables"},{pattern:/document\.addEventListener\s*\(/g,message:"document.addEventListener() is prohibited",suggestion:"Use useEventListener() or template @event directives"},{pattern:/window\.location(?![A-Za-z])/g,message:"window.location is prohibited",suggestion:"Use navigate() or useRoute()"},{pattern:/window\.history(?![A-Za-z])/g,message:"window.history is prohibited",suggestion:"Use navigate(), goBack(), goForward()"},{pattern:/window\.addEventListener\s*\(/g,message:"window.addEventListener() is prohibited",suggestion:"Use useEventListener() or @click directives"},{pattern:/(?:\bwindow\.)?localStorage(?![A-Za-z])/g,message:"window.localStorage is prohibited",suggestion:"Use useLocalStorage() from composables \u2014 or, where this must run before first paint and the runtime does not exist yet, the colorMode config for a light/dark theme, or @appearanceBootstrap when there is a second appearance axis"},{pattern:/window\.sessionStorage(?![A-Za-z])/g,message:"window.sessionStorage is prohibited",suggestion:"Use useSessionStorage() from composables"},{pattern:/window\.scrollTo\s*\(/g,message:"window.scrollTo() is prohibited",suggestion:"Use useScroll().scrollTo() from composables"},{pattern:/window\.alert\s*\(/g,message:"window.alert() is prohibited",suggestion:"Use stx modal/dialog APIs instead"},{pattern:/window\.confirm\s*\(/g,message:"window.confirm() is prohibited",suggestion:"Use stx modal/dialog APIs instead"},{pattern:/window\.prompt\s*\(/g,message:"window.prompt() is prohibited",suggestion:"Use stx modal/dialog APIs instead"},{pattern:/(?<!\w)setTimeout\s*\(/g,message:"setTimeout() is prohibited",suggestion:"Use useTimeout() or useDebounce() from composables"},{pattern:/(?<!\w)setInterval\s*\(/g,message:"setInterval() is prohibited",suggestion:"Use useInterval() from composables"},{pattern:/(?<!\w)clearTimeout\s*\(/g,message:"clearTimeout() is prohibited",suggestion:"Use useTimeout().stop() or useDebounce().cancel()"},{pattern:/(?<!\w)clearInterval\s*\(/g,message:"clearInterval() is prohibited",suggestion:"Use useInterval().pause()"},{pattern:/(?<!\w)location\.href\s*=/g,message:"location.href assignment is prohibited",suggestion:"Use navigate() instead"},{pattern:/(?<!\w)location\.assign\s*\(/g,message:"location.assign() is prohibited",suggestion:"Use navigate() instead"},{pattern:/(?<!\w)location\.replace\s*\(/g,message:"location.replace() is prohibited",suggestion:"Use navigate() instead"}],Up=/(?:\/\/|\/\*|\{\{--)\s*stx-strict-ignore(-next-line)?([^\n*}]*)/g;function qx(e){let o=Array.from(e,(k)=>k===`
2541
+ `?`
2542
+ `:" "),x=0,v="";while(x<e.length){let k=e[x],E=e[x+1];if(v){if(k==="\\"){x+=2;continue}if(k===v)v="";x++;continue}if(k==='"'||k==="'"||k==="`"){v=k,x++;continue}if(k==="/"&&E==="/"){while(x<e.length&&e[x]!==`
2543
+ `)o[x]=e[x],x++;continue}if(k==="/"&&E==="*"){let C=e.indexOf("*/",x+2),j=C===-1?e.length:C+2;for(;x<j;x++)o[x]=e[x];continue}if(k==="{"&&E==="{"&&e.slice(x,x+4)==="{{--"){let C=e.indexOf("--}}",x+4),j=C===-1?e.length:C+4;for(;x<j;x++)o[x]=e[x];continue}x++}return o.join("")}function Xx(e){let o=new Map,x=qx(e).split(`
2544
+ `),v=e.split(`
2545
+ `);return x.forEach((k,E)=>{Up.lastIndex=0;for(let C of k.matchAll(Up)){let j=C[1]==="-next-line",L=(v[E]??"").slice(0,C.index).trim(),B=j||L===""?E+2:E+1,U=(C[2]??"").split("--")[0].split(/[\s,]+/).filter(Boolean),Z=U.filter((Q)=>/\w/.test(Q));if(U.length>0&&Z.length===0)continue;let Y=o.get(B);if(Y&&Y.size===0)continue;if(Z.length===0){o.set(B,new Set);continue}if(Y)Z.forEach((Q)=>Y.add(Q));else o.set(B,new Set(Z))}}),o}function Kx(e,o,x){let v=e.get(o);if(!v)return!1;if(v.size===0)return!0;return[...v].some((k)=>x.includes(k))}function ms(e,o,x,v){let k=typeof x==="boolean"?{enabled:x,failOnViolation:x}:x??{enabled:!1};if(!k.enabled)return;let E=D(e,o,v,JSON.stringify(k)),C=Dc.get(E);if(C!==void 0){if(C&&k.failOnViolation)throw Error(C);return}let j=k.allowPatterns??[],L=Xx(e),B=[],F=s(e.replace(/\{\{--[\s\S]*?--\}\}/g,(Q)=>Q.replace(/[^\n]/g," ")));for(let{pattern:Q,message:se,suggestion:oe}of Hx){if(j.some((ce)=>/\w/.test(ce)&&se.includes(ce)))continue;Q.lastIndex=0;let ie=F.match(Q);if(ie&&ie.length>0){let ce=F.split(`
2546
+ `),ae=e.split(`
2547
+ `),pe=[];if(ce.forEach((Ee,Ce)=>{if(Q.lastIndex=0,Q.test(Ee)&&!Kx(L,Ce+1,se))pe.push(Ce+1)}),pe.length===0&&ce.some((Ee)=>(Q.lastIndex=0,Q.test(Ee))))continue;let me=pe.length>0?` (script line${pe.length>1?"s":""} ${pe.join(", ")})`:"",he=pe.slice(0,3).map((Ee)=>` ${Ee} | ${(ae[Ee-1]??"").trim().slice(0,100)}`).join(`
2548
+ `),Se=he?`
2549
+ ${he}`:"";B.push(` \u2717 ${se}${me}
2550
+ \u2192 ${oe}${Se}`)}}if(B.length===0){Dc.set(E,"");return}let U=(Q)=>{let se=`${process.cwd()}/`;return Q.startsWith(se)?Q.slice(se.length):Q},Y=`[STX] DOM API violation in ${v&&v!==o?`${U(v)} (composed into ${U(o)})`:U(o)}:
2551
+ ${B.join(`
2552
+ `)}
2553
+ Tip: prefer useRef(), navigate(), and composables for component code`;if(Dc.set(E,Y),k.failOnViolation)throw Error(Y);else console.warn(Y)}import Pc from"path";var Zx=/(\bfrom\s*|\bimport\s*\(\s*|\bimport\s+)(['"])(\.\.?\/[^'"]*)\2/g,Jx=/(<script\b[^>]*>)([\s\S]*?)(<\/script>)/gi;function Gx(e,o){if(!o||!e.includes("/"))return e;let x=Pc.dirname(o);return e.replace(Zx,(v,k,E,C)=>{let j=Pc.resolve(x,C);return`${k}${E}${j.split(Pc.sep).join("/")}${E}`})}function Hp(e,o){if(!o||!e.includes("<script"))return e;return e.replace(Jx,(x,v,k,E)=>`${v}${Gx(k,o)}${E}`)}var gr="<!--PARENT_CONTENT_PLACEHOLDER-->";function qp(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Qp(e,o){let x=e.length,v=o,k=!0,E=[],C=(j)=>j+9<=x&&e[j]==="<"&&e[j+1]==="/"&&(e[j+2]==="s"||e[j+2]==="S")&&(e[j+3]==="c"||e[j+3]==="C")&&(e[j+4]==="r"||e[j+4]==="R")&&(e[j+5]==="i"||e[j+5]==="I")&&(e[j+6]==="p"||e[j+6]==="P")&&(e[j+7]==="t"||e[j+7]==="T")&&(e[j+8]===">"||/\s/.test(e[j+8]));while(v<x){let j=e[v];if(C(v))return v;if(j==="/"&&e[v+1]==="/"){if(v=e.indexOf(`
2554
+ `,v+2),v===-1)return-1;v+=1,k=!0;continue}if(j==="/"&&e[v+1]==="*"){let L=e.indexOf("*/",v+2);if(L===-1)return-1;v=L+2,k=!0;continue}if(j==="/"&&k){let L=v+1,B=!1;while(L<x){let F=e[L];if(F==="\\"){L+=2;continue}if(F==="[")B=!0;else if(F==="]")B=!1;else if(F==="/"&&!B){L++;break}else if(F===`
2555
+ `){L=-1;break}L++}if(L===-1){v++,k=!1;continue}while(L<x&&/[a-z]/.test(e[L]))L++;v=L,k=!1;continue}if(j==="'"||j==='"'){let L=j;v++;while(v<x){if(e[v]==="\\"){v+=2;continue}if(e[v]===L){v++;break}if(e[v]===`
2556
+ `)break;v++}k=!1;continue}if(j==="`"){v++;while(v<x){if(e[v]==="\\"){v+=2;continue}if(e[v]==="`"){v++;break}if(e[v]==="$"&&e[v+1]==="{"){E.push(!0),v+=2,k=!0;break}v++}if(E.length===0)k=!1;continue}if(j==="}"&&E.length>0){E.pop(),v++;while(v<x){if(e[v]==="\\"){v+=2;continue}if(e[v]==="`"){v++,k=!1;break}if(e[v]==="$"&&e[v+1]==="{"){E.push(!0),v+=2,k=!0;break}v++}continue}if(/\s/.test(j));else if(/[)\].\w$]/.test(j))k=!1;else k=!0;v++}return-1}function ef(e,o){let x=o.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),v=new RegExp(`<script\\b(?=[^>]*\\b${x}(?:\\s|=|/?>))[^>]*>`,"i").exec(e);if(!v)return null;let k=v.index+v[0].length,E=e.indexOf("</script>",k);if(E===-1)return null;let C=e.indexOf(">",E);if(C===-1)return null;return{start:v.index,end:C+1}}var Qx=4096;async function Xp(e,o,x){if(x.buildMode!=="serve"||o.length<Qx)return null;let{registerServeModuleBundle:v}=await import("./chunk-gea5hf0v.js");return`<script ${e} src="${v(o)}"></script>`}async function Kp(e,o,x){try{let{registeredModuleIdsIn:v,buildModuleRegistryScript:k}=await lt("stx/client-module-registry",()=>import("./chunk-jnkrn913.js")),E=[],C=await k(v(...e),{minify:o.buildMode==="compile",collectInputs:E});for(let j of E)x?.add(j);if(!C)return null;if(o.buildMode==="serve"){let{registerServeModuleBundle:j}=await import("./chunk-gea5hf0v.js");return`<script data-stx-scoped data-stx-run="always" data-stx-modules src="${j(C)}"></script>`}return`<script data-stx-scoped data-stx-run="always" data-stx-modules>${C.replace(/<\/script/gi,"<\\/script")}</script>`}catch{return null}}function eb(e,o=""){let x=ef(e,"data-stx-runtime");if(!x)return e;let v=jr(e);if(v===-1||v===x.start){if(!o)return e;return e.slice(0,x.end)+o+e.slice(x.end)}if(v<x.start)return e.slice(0,v)+e.slice(x.start,x.end)+o+`
2557
+ `+e.slice(v,x.start)+e.slice(x.end);let k=e.slice(x.start,x.end),E=e.slice(0,x.start)+e.slice(x.end),C=jr(E);if(C===-1)return k+o+`
2558
+ `+E;return E.slice(0,C)+k+o+`
2559
+ `+E.slice(C)}function tb(e){let o=/\x00STX_ESC_MUSTACHE_OPEN\x00([\s\S]*?)\x00STX_ESC_MUSTACHE_CLOSE\x00/g;return e.replace(o,(x,v,k)=>{let E=e.slice(0,k);return E.lastIndexOf("<")>E.lastIndexOf(">")?`{{${v}}}`:`{<!--stx-literal-->{${v}}}`})}async function r(e,o,x,v,k){if(v.ssr===!1&&!v.autoShell&&v.buildMode==="spa")return e;if(o.__stx_signals_gate===void 0)o.__stx_signals_gate=be(e,x);let E=!o.__stxProcessingDepth;sn(o);for(let C of v._layerGraph?.configDependencies??[])k.add(C);if(E&&v.runtimeConfig)await an(o,x,v.runtimeConfig);if(E)el(o),o.__stx_head_injections=Fa(),o.__stx_seo_staged=!1;if(!o.__stxProcessingDepth)o.__stxProcessingDepth=0;if(o.__stxProcessingDepth++,!o.__onceStore)o.__onceStore=new Set;if((v.debug||!ge()&&!mn())&&x&&x.endsWith(".stx"))Is(e,x);try{return await H.timeAsync("template-processing",async()=>{let C=await nb(e,o,x,v,k);if(E)C=Ic(C);if(E&&v.autoShell&&v.buildMode!=="compile"){let j=v.app?.head||{},B=(o.__stx_runtime_head||null)??_s(),F=(o.__stx_head_raw||"").trim(),U,Z=F.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(Z)U=Z[1].trim(),F=F.replace(Z[0],"").trim();let Y=o.__sections?.title,Q=B.title||U||Y,se=!B.title&&(!!U||!!Y),oe=B.meta||[],ie=new Set(oe.map((Se)=>Tr(Se)).filter(Boolean)),ce={...j,...Q&&{title:Q},meta:[...(j.meta||[]).filter((Se)=>!ie.has(Tr(Se))),...oe],link:[...j.link||[],...B.link||[]],script:[...j.script||[],...B.script||[]],headRaw:[j.headRaw,F].filter(Boolean).join(`
2560
+ `),...B.htmlAttrs&&{htmlAttrs:mp(j.htmlAttrs,B.htmlAttrs)},...B.bodyAttrs&&{bodyAttrs:{...j.bodyAttrs||{},...B.bodyAttrs}}},ae=kc(C);if(C=Un(C,ce,{...se&&{titleIsHtml:!0},...v.app?.colorMode&&{colorMode:v.app.colorMode}},ae),ae)C=yp(C,j),C=Vn(C,ce.htmlAttrs);let pe=C.match(/<!-- stx-layout: ([^ ]+) -->/);if(pe&&C.includes("<head")){let Se=pe[1],Ee=ur(Se);C=C.replace(/<head\b[^>]*>/i,(Ce)=>`${Ce}
2561
+ <meta name="stx-layout" content="${qp(Se)}">
2562
+ <meta name="stx-layout-group" content="${qp(Ee)}">`)}let me=C.match(/function (__stx_setup_\w+)\(/),he=me?wn(C):null;if(me&&he&&!/\bdata-stx=/.test(he.tag)){C=xr(C,(Ee,Ce)=>`<body${Ce} data-stx="${me[1]}">`);let Se=new RegExp(`(<(?!body)[a-zA-Z][^>]*) data-stx="${me[1]}"`,"i");C=C.replace(Se,"$1")}}if(E){let j=o.__stx_head_injections??Fa(),L=hp(C);if(L!==null)j.beforeClose.push(L);let B=op(C);if(B!==null)j.afterOpen.push(B);if(v.offline?.enabled&&!C.includes("data-stx-offline"))j.beforeClose.push(ap);C=np(C,j);let F=v.app?.colorMode;if(F)C=Hn(C,F)}if(E)if(ef(C,"data-stx-runtime")){let L=null,B=null,F=null,U=null,Z=null;try{let{getStoreScript:Q}=await lt("stx/store-loader",()=>import("./chunk-atws6p5s.js")),se=v.storesDir,oe=await Q(se);if(oe)F=`<script data-stx-stores>${oe}</script>`,B=await Xp("data-stx-stores",oe,v)??F}catch{}L=await Kp([C,F],v,k);try{let{getFrameworkComposableScript:Q}=await lt("stx/framework-composables",()=>import("./chunk-e9hs7kk6.js"));Z=await Q(C)}catch{}try{let{getComposableScript:Q}=await lt("stx/composable-loader",()=>import("./chunk-1zs30k3y.js")),se=v.composablesDir,oe=[L,F,Z].filter((ce)=>ce!==null),ie=await Q(v._layerComposableDirs??se,C,oe);if(ie)U=await Xp('data-stx-scoped data-stx-run="always" data-stx-composables',ie,v)??`<script data-stx-scoped data-stx-run="always" data-stx-composables>${ie}</script>`}catch{}let Y=[L,B,U,Z].filter((Q)=>Q!==null).map((Q)=>`
2563
+ ${Q}`).join("");C=eb(C,Y)}else{let L=await Kp([C],v,k);if(L){let B=C.search(/<script\b[^>]*>(?:(?!<\/script>)[\s\S])*?__stxModules\[/i);if(B!==-1)C=C.slice(0,B)+L+`
2564
+ `+C.slice(B)}}if(E)C=ip(C);if(E&&o.__stx_inject_css!==!1)C=await f(C,void 0,v.buildMode==="serve",!0);else if(E)C=cn(C);if(C=C.replace(/\x00STX_ESCAPED_AT\x00/g,"@"),C=tb(C),E&&o.__stx_runtime_config)C=Ke(C,o.__stx_runtime_config);if(E&&!o.__stx_defer_server_data){let j=zn(o);if(j){let L=/<head\b[^>]*>/i.exec(C),B=L?L.index+L[0].length:0;C=C.slice(0,B)+j+C.slice(B)}}return C})}catch(C){if(C instanceof ir)throw C;let j=C instanceof Error?C.message:String(C),L=new J(`Template processing failed: ${j}`,x,void 0,void 0,e.substring(0,200)+(e.length>200?"...":""));if(_.log(L,{filePath:x,context:o}),At.logDetailedError(L,{filePath:x,template:e.substring(0,500)}),v.debug)throw L;return Rs.createFallbackContent("Template Processing",L)}}async function nb(e,o,x,v,k){let E=process.cwd(),C={...v,partialsDir:v.partialsDir&&!Gt.isAbsolute(v.partialsDir)?Gt.resolve(E,v.partialsDir):v.partialsDir,componentsDir:v.componentsDir&&!Gt.isAbsolute(v.componentsDir)?Gt.resolve(E,v.componentsDir):v.componentsDir,layoutsDir:v.layoutsDir&&!Gt.isAbsolute(v.layoutsDir)?Gt.resolve(E,v.layoutsDir):v.layoutsDir},j=C,L=e;await ib(x,o),sb(o,j),L=await re(()=>Hd(L,o,x,j),L,(me)=>{_.log(me,{filePath:x,phase:"pre-processing-middleware"},"warning"),console.warn(`[stx] pre-processing middleware failed for ${x}: ${me.message}`)}),L=L.replace(/\{\{--[\s\S]*?--\}\}/g,"");let B=ne(L,xe,(me,he)=>`\x00STX_HTML_COMMENT_${he}\x00`);L=B.output;let F=B.tokens,U=(me)=>F.length===0?me:me.replace(/\x00STX_HTML_COMMENT_(\d+)\x00/g,(he,Se)=>F[Number(Se)]??""),Z="\x00STX_ESCAPED_AT\x00",Y="\x00STX_ESC_MUSTACHE_OPEN\x00",Q="\x00STX_ESC_MUSTACHE_CLOSE\x00";L=L.replace(/@@/g,Z),L=L.replace(/@\{\{([\s\S]*?)\}\}/g,(me,he)=>`${Y}${he}${Q}`),L=Jd(L),L=await Np(L,x,k);let se={};L=ls(L,se);let oe={...o.__sections||{}},ie="",ce=Pl(je(e)),ae=/@nolayout\b/.test(L)||ce===!1;if(/@nolayout\b/.test(L))L=L.replace(/@nolayout\b\s*/g,"");let pe=L.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(pe)ie=pe[1],L=L.replace(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/g,"");else if(typeof ce==="string"){if(ie=ce,!/@section\s*\(/.test(L))L=`@section('content')
2565
+ ${L.trim()}
2566
+ @endsection`}if(!ie&&!ae&&j.defaultLayout){let me=on(L),he=/@section\s*\(/.test(L);if(!me||he){let Se="",Ee=Gt.dirname(x),Ce=j.layoutsDir?Gt.dirname(j.layoutsDir):process.cwd();for(let Re=0;Re<20;Re++){let Ae=Gt.join(Ee,"_layout.stx");if(await n(Ae)){Se=Ae;break}let _e=Gt.dirname(Ee);if(_e===Ee||_e.length<Ce.length)break;Ee=_e}if(Se)ie=Se;else if(j.layoutsDir){let Re=Gt.isAbsolute(j.layoutsDir)?j.layoutsDir:Gt.resolve(process.cwd(),j.layoutsDir),Ae=Gt.join(Re,`${j.defaultLayout}.stx`);if(await n(Ae))ie=Ae}if(ie&&!he)L=`@section('content')
2567
+ ${L.trim()}
2568
+ @endsection`}}if(ie&&L.includes("<script")){let me=V(L),he=me.scripts.map((Se)=>Zp(Se,x)??Se);L=Et(me.output,he)}if(L=L.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(me,he,Se)=>(oe[he]=Se,"")),L=L.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*([^)]+?)\s*\)/g,(me,he,Se)=>{if(/^(['"]).*\1$/.test(Se.trim()))return me;try{let Ee=c(Se.trim(),o);if(Ee===void 0)return me;return oe[he]=String(Ee??""),""}catch{return me}}),L=L.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@endsection|@show)/g,(me,he,Se)=>{if(Se.includes("@parent"))oe[he]=Se.replace("@parent",gr);else oe[he]=Se.trim();return""}),o.__sections=oe,L=L.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"])?\)/g,(me,he,Se)=>oe[he]||Se||""),!("slot"in o)||o.slot===void 0)L=L.replace(/\{\{\s*slot\s*\}\}/g,()=>oe.content||"");if(L=us(L,se),ie){let me=[],he=V(L),Se=ne(he.output,Ct,(Ee,Ce)=>`\x00STX_ORPHAN_STYLE_${Ce}\x00`);if(L=Se.output.replace(/\x00STX_(SCRIPT|ORPHAN_STYLE)_(\d+)\x00/g,(Ee,Ce,Re)=>{let Ae=Ce==="SCRIPT"?Zp(he.scripts[Number(Re)],x):Se.tokens[Number(Re)];if(Ae)me.push(Ae);return""}),me.length>0){let Ee=me.join(`
2569
+ `);oe.content=oe.content?`${oe.content}
2570
+ ${Ee}`:Ee,o.__sections=oe}}if(ie)try{let me;if(Gt.isAbsolute(ie))me=ie,k.add(ie);else me=await re(()=>Xn(ie,x,C,k),null,()=>{throw new J(`Failed to resolve layout path: ${ie}`,x,void 0,void 0,`Layout referenced from ${x}`)});if(!me){let Ae=(Me)=>{if(!Me)return[];try{let De=Gt.isAbsolute(Me)?Me:Gt.resolve(process.cwd(),Me);return Yx.readdirSync(De).filter((Ie)=>Ie.endsWith(".stx")).map((Ie)=>Ie.replace(/\.stx$/,""))}catch{return[]}},_e=[...Ae(C.layoutsDir),...Ae(C.fallbackLayoutsDir)].filter((Me,De,Ie)=>Ie.indexOf(Me)===De).sort(),Te=`Layout not found: ${ie} (referenced from ${x})`+(_e.length>0?`. Available layouts: ${_e.join(", ")}`:C.layoutsDir?`. No .stx layouts found in ${C.layoutsDir}`:"");if(_.log(Error(Te),{layoutPath:ie,filePath:x,available:_e},"error"),console.error(`[stx] ${Te}`),C.debug)throw new J(Te,x);return L}let he=await re(()=>Bun.file(me).text(),"",()=>{throw new J(`Failed to read layout file: ${me}`,x,void 0,void 0,"Layout content could not be loaded")});he=Hp(he,me);let Se=he.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(Se){if(C.debug)console.log(`Found nested layout: ${Se[1]} in ${me}`);let Ae={},_e=he.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(De,Ie,Oe)=>(Ae[Ie]=Oe.trim(),""));for(let[De,Ie]of Object.entries(Ae))if(oe[De]&&oe[De].includes(gr)){let Oe=oe[De].indexOf(gr);oe[De]=oe[De].slice(0,Oe)+Ie+oe[De].slice(Oe+gr.length)}else if(!oe[De])oe[De]=Ie;let Te={...o,__sections:oe},Me=`@layout('${Se[1]}')${_e}`;return await r(Me,Te,me,C,k)}let Ee=he.replace(/\{\{--[\s\S]*?--\}\}/g,""),Ce=ls(Ee,se),Re={};return Ce=Ce.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(Ae,_e,Te)=>(Re[_e]=Te.trim(),`@slot('${_e}')`)),Ce=Ce.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(Ae,_e,Te)=>{if(oe[_e]){let Me=oe[_e];if(Me.includes(gr)){let De=Re[_e]||"",Ie=Me.indexOf(gr);Me=Me.slice(0,Ie)+De+Me.slice(Ie+gr.length)}return Me}return Te||""}),Ce=rb(Ce,oe),Ce=Ce.replace(/\{\{\s*slot\s*\}\}/g,()=>oe.content||""),Ce=us(Ce,se),o.__originalFilePath=x,L=await Yp(Ce,o,me,C,k),L=`<!-- stx-layout: ${ie} -->
2571
+ ${L}`,U(L)}catch(me){return _.log(me instanceof Error?me:Error(String(me)),{layoutPath:ie,filePath:x},"error"),`[Error processing layout: ${me instanceof Error?me.message:String(me)}]`}return U(await Yp(L,o,x,C,k))}function rb(e,o){return e.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(x,v,k)=>{let E=o[v];if(E!==void 0){if(!new RegExp(`@(?:yield|slot)\\(\\s*['"]${v.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(E))return E}return k||""})}function sb(e,o){if(e.__stx_sfc_mode=!0,e.__stx_options=o,o.buildMode)e.__stx_buildMode=o.buildMode;let x=o.envPrefix||"STX_PUBLIC_",v={};for(let[k,E]of Object.entries(process.env))if(k.startsWith(x)&&E!==void 0)v[k]=E;e.$env=v}async function ib(e,o){await re(()=>Kd(e,o),void 0,(x)=>{_.log(x,{filePath:e,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${e}: ${x.message}`)})}var Mc="data-stx-source";function Zp(e,o){if(!e)return e;let x=/^<script\b([^>]*)>/i.exec(e);if(!x||!/\bserver\b/.test(x[1])||x[1].includes(Mc))return e;return`<script ${Mc}="${encodeURIComponent(o)}"${e.slice(7)}`}function ob(e){let o=new RegExp(`${Mc}="([^"]*)"`).exec(e);return o?decodeURIComponent(o[1]):void 0}function Jp(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function Gp(e,o,x){return`<div data-stx-server-script-error role="alert" style="padding:12px 14px;border:1px solid #f0b4b4;border-left-width:4px;background:#fff5f5;color:#7a1f1f;font:13px/1.5 ui-monospace,SFMono-Regular,Menlo,monospace"><strong style="display:block;margin-bottom:4px">stx: a &lt;script server&gt; ${o==="module-resolution"?"imports a module that does not resolve":o==="syntax"?"does not parse":"names something that does not exist"}, so this component rendered nothing.</strong><span style="display:block;opacity:.85">${Jp(e)}</span><span style="display:block;margin-top:4px">${Jp(x)}</span></div>`}async function ab(e,o,x,v){let{scanScriptTags:k}=await lt("stx/signal-processing",()=>import("./chunk-xwzvfqcb.js")),E=[],C=!ge()&&!mn();for(let L of k(e)){let B=L.attrs;if(!/\bserver\b/.test(B))continue;let F=L.start+L.fullMatch.indexOf(">")+1,U=Qp(e,F);if(U===-1)continue;let Z=e.slice(F,U);if(!Z.trim())continue;let Y=ob(B)??x,Q={index:L.start,length:U+9-L.start};try{let{extractVariables:se}=await lt("stx/variable-extractor",()=>import("./chunk-w72qx0eb.js"));await se(Z,o,Y,{preserveExisting:!0,onFailure:(oe)=>{if(oe.kind==="unknown")return;if(v?.onServerScriptError?.({sourcePath:Y,kind:oe.kind,message:oe.message}),!C)return;E.push({...Q,markup:Gp(Y,oe.kind,oe.message)})}})}catch(se){let oe=se instanceof Error?se:Error(String(se));if(_.log(oe,{filePath:Y,phase:"server-script-extraction"},"warning"),console.warn(`[stx] server <script> extraction failed in ${Y}: ${oe.message}`),C)E.push({...Q,markup:Gp(Y,"unknown",oe.message)})}}if(E.length===0)return e;let j=e;for(let L of E.sort((B,F)=>F.index-B.index))j=j.slice(0,L.index)+L.markup+j.slice(L.index+L.length);return j}async function cb(e,o,x){try{let{interpolateScriptsInTemplate:v}=await lt("stx/expressions",()=>import("./chunk-z8xn5ta3.js"));return v(e,o,{skipServer:!0})}catch(v){let k=v instanceof Error?v:Error(String(v));return _.log(k,{filePath:x,phase:"script-expression-interpolation"},"warning"),console.warn(`[stx] script expression interpolation failed in ${x}: ${k.message}`),e}}async function Yp(e,o,x,v,k){let E=e,C=v;if(E=await ab(E,o,x,v),E=await cb(E,o,x),E=await Pd(E,o,x),E=await Md(E,o,x),E=await xu(E,o,x,C),be(E))E=Hi(E,o),E=is(E,o),E=ss(E,o);E=Vi(E);let{processStreamDirectives:j}=await lt("stx/streaming",()=>import("./chunk-gc1drn2p.js"));E=j(E,o),E=Ki(E,o,x,C,!0),E=await ep(E,o,x,C,k),E=await ts(E,o,x,C,k),E=Dl(E,o,x,C);let{processDeferDirectives:L}=await lt("stx/defer",()=>import("./chunk-3s2vnqcf.js"));E=L(E,o,x);let{processTeleportDirectives:B}=await lt("stx/teleport",()=>import("./chunk-jmabeqfq.js"));E=B(E,o,x);let{processTransitionDirectives:F,processTransitionAttributes:U}=await lt("stx/transitions",()=>import("./chunk-6cfa3g0r.js"));E=F(E,o,x),E=U(E);let{processErrorBoundaryDirectives:Z,stripRenderFailedMarkers:Y}=await lt("stx/error-boundaries",()=>import("./chunk-h85hrwkq.js"));E=Z(E,o,x),E=Y(E);let{processSuspenseDirectives:Q}=await lt("stx/suspense",()=>import("./chunk-q7qchkvk.js"));E=Q(E,o,x);let{processAsyncDirectives:se}=await lt("stx/async-components",()=>import("./chunk-j9qcrwbg.js"));E=se(E,o,x);let{processKeepAliveDirectives:oe}=await lt("stx/keep-alive",()=>import("./chunk-ydjfar14.js"));E=oe(E,o,x);let{processVirtualListDirectives:ie,processVirtualGridDirectives:ce,processInfiniteListDirectives:ae}=await lt("stx/virtual-scrolling",()=>import("./chunk-p2v2a68k.js"));E=ie(E,o,x),E=ce(E,o,x),E=ae(E,o,x);let{processPartialHydrationDirectives:pe,processStaticDirectives:me}=await lt("stx/partial-hydration",()=>import("./chunk-fyzajkrx.js"));E=pe(E,o,x),E=me(E);let{processComputedDirectives:he,processWatchDirectives:Se}=await lt("stx/computed",()=>import("./chunk-1xdzcy9d.js"));E=he(E,o,x),E=Se(E,o,x);let{processFormValidationDirectives:Ee}=await lt("stx/forms-validation",()=>import("./chunk-hbxz85wy.js"));E=Ee(E,o,x);let{processHeadDirective:Ce,processTitleDirective:Re,processMetaDirective:Ae,resetHead:_e}=await lt("stx/head",()=>import("./chunk-9xrbve19.js"));if(!o.__stx_head_preset&&!o.__stx_runtime_head)_e();let Te=Ce(E);if(E=Te.content,Te.headContent)o.__stx_head_raw=`${o.__stx_head_raw||""}${Te.headContent}
2572
+ `;if(E=Re(E,o),E=Ae(E,o,x),E=Xd(E),E=oa(E,o),E=yu(E),E=Vd(E),E=await cs(E,o,x,C,k),E=await ts(E,o,x,C,k),o.__stxProcessingDepth===1)E=tl(E,o);if(E=E.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/g,""),E=Ic(E),E=Cn(E,o,x),E=as(E),E=Ml(E,o,{filePath:x,buildMode:C.buildMode}),E=aa(E,o),E=ca(E,o),E=ui(E,o),E=ku(E,o),E=Cu(E,o),E=await au(E,o,x,C),E=await zl(E,o,x),E=await oo(E,o,x,C),E=ao(E,o,x,C),E=ks(E,o,x,C),E=Cs(E,o,x),E=$s(E,o,x,C),E=mu(E,o,x,C),E=ps(E,o),E=gs(E),E=Lp(E),!C.skipEventDirectives)E=Gc(E,o,x);if(E=jl(E,o,x),C.debug){let Qe=/\bx-data\s*=/.test(E),st=rs(e);if(Qe&&st)console.warn(`[stx] ${x}: Template mixes Alpine-style (x-data) and signals (state/derived/effect) reactivity.
2573
+ Both work on the same page, but they manage separate scopes.
2574
+ Prefer signals (state/derived/effect) for new components.`)}E=$d(E,o),E=await q(E,o,x),E=Fp(E),E=Vp(E),E=Sl(E);let{processXElementDirectives:Me}=await lt("stx/x-element",()=>import("./chunk-zhxdpzga.js"));E=Me(E);let De=o.__originalFilePath||x,Ie=Le(o);if(E=await Ui(E,C,De,Ie),E=$u(E,o),E=await qd(E,o,x,C),C.media?.image?.autoSiblings){let Qe=C.publicDir||"public",{rewriteImagesWithSiblings:st}=await lt("stx/image-optimization/auto-sibling",()=>import("./chunk-7z2ra0yf.js"));E=await st(E,{publicDir:Qe})}if(C.seo?.enabled)E=Es(E,o,C);let Oe=(Qe,st,ft=!0)=>{if(!st)return Qe;let Xt=st.match(/<title\b[^>]*>[\s\S]*?<\/title>/i),Mt=Qe.match(/<title\b[^>]*>[\s\S]*?<\/title>/i);if(Xt&&Mt){if(ft)Qe=Qe.replace(Mt[0],Xt[0]);if(st=st.replace(Xt[0],"").trim(),!st)return Qe}if(/<\/head>/i.test(Qe))return Qe.replace(/<\/head>/i,`${st}
2575
+ </head>`);if(/<head\b[^>]*>/i.test(Qe))return Qe.replace(/(<head\b[^>]*>)/i,`$1
2576
+ ${st}`);if(/<html\b[^>]*>/i.test(Qe))return Qe.replace(/(<html\b[^>]*>)/i,`$1
2577
+ <head>
2578
+ ${st}
2579
+ </head>`);return Qe},{renderHead:tt,getHead:ot}=await lt("stx/head",()=>import("./chunk-9xrbve19.js")),yt=o.__stx_runtime_head??ot();if(yt.title||yt.meta?.length||yt.link?.length){let Qe=tt(yt);if(Qe)E=Oe(E,Qe)}if(Te.headContent)E=Oe(E,Te.headContent,!yt.title);if(C.csp?.enabled&&C.csp.addMetaTag)E=fu(E,C.csp,o);if(C.analytics?.enabled)E=_l(E,C);if(C.heatmap?.enabled)E=kl(E,C);if(C.pwa?.enabled&&C.pwa.autoInject!==!1){let{injectPwaTags:Qe}=await lt("stx/pwa/inject",()=>import("./chunk-nn2vstke.js"));E=Qe(E,C)}let dt=/<script\b(?![^>]*\bserver\b)[^>]*>[\s\S]*?<\/script>/i.test(E),ht=/\bSTX\.\w+/.test(E),at=/window\.STX\s*=/.test(E);if(dt&&ht&&!at){let st=`<script data-stx-scoped data-stx-run="once">
2580
+ ${vl()}
2581
+ </script>`;if(E.includes("</head>")){let ft=E.indexOf("</head>"),Mt=E.slice(0,ft).indexOf("<script");if(Mt!==-1){let nn=E.slice(0,Mt),jt=E.slice(Mt);E=nn+st+`
2582
+ `+jt}else E=E.replace("</head>",`${st}
2583
+ </head>`)}else if(E.includes("<body"))E=E.replace(/<body([^>]*)>/,`<body$1>
2584
+ ${st}`);else E=st+`
2585
+ `+E}{let{scanScriptTags:Qe}=await lt("stx/signal-processing",()=>import("./chunk-xwzvfqcb.js")),st=[];for(let ft of Qe(E)){if(!/\bserver\b/i.test(ft.attrs))continue;let Xt=ft.start+ft.fullMatch.indexOf(">")+1,Mt=Qp(E,Xt);if(Mt===-1)continue;let nn=Mt+9;while(nn<E.length&&/\s/.test(E[nn]))nn++;st.push({start:ft.start,end:nn})}if(st.length>0){let ft=Array(st.length+1),Xt=0;for(let Mt=0;Mt<st.length;Mt++){let{start:nn,end:jt}=st[Mt];ft[Mt]=E.slice(Xt,nn),Xt=jt}ft[st.length]=E.slice(Xt),E=ft.join("")}}let Pt=Zn(E,x);if(Pt.hasScoped)E=Pt.html;let pt=o.__stx_event_bindings||[],Lt=!1,Sn=[],fn=/\s:[a-z][\w.-]*\s*=/.test(E),{scanScriptTags:_n}=await lt("stx/signal-processing",()=>import("./chunk-xwzvfqcb.js"));for(let Qe of _n(E,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/}))Sn.push({match:Qe.fullMatch,attrs:Qe.attrs,content:Qe.body});for(let{match:Qe,attrs:st,content:ft}of Sn){Lt=!0;let Xt=ft;ms(ft,x,v.strict,o.__originalFilePath);let Mt=await ye(ft,{eventBindings:pt,attrs:st,hasColonDirectives:fn,templateContent:e,filePath:x,projectRoot:process.cwd(),production:v.buildMode==="compile",serverData:Ie});E=E.replace(Qe,()=>Mt)}if(Lt)o.__stx_event_bindings=[];if(!Lt&&o.__stxProcessingDepth===1){let Qe=o.__stx_event_bindings||[];if(Qe.length>0){let st=Oo(Qe);if(st){let ft=E.lastIndexOf("</body>");E=ft===-1?E+st:E.slice(0,ft)+st+`
2586
+ `+E.slice(ft)}o.__stx_event_bindings=[]}}if(!le(E)&&$p(E))E=await Pi(E,C);if(E=Sp(E),C.csp?.enabled&&C.csp.useNonce&&typeof o.cspNonce==="string")E=gu(E,o.cspNonce);return E}import gf from"path";import Nc from"fs";import Ls from"path";function tf(e,o,x,v){let k=0;for(let E=o;E<e.length;E++)if(e[E]===x)k++;else if(e[E]===v&&!(v===">"&&e[E-1]==="=")){if(--k===0)return E}return-1}function lb(e){let o=s(e),x=0,v=0,k=[];for(let E=0;E<o.length;E++)if("([{".includes(o[E]))x++;else if(")]}".includes(o[E]))x--;else if(o[E]===","&&x===0)k.push(e.slice(v,E).trim()),v=E+1;return k.push(e.slice(v).trim()),k}function Oc(e,o){let x=s(e),v=new RegExp(`\\b(?:${o.map((k)=>k.replace(/[$]/g,"\\$&")).join("|")})\\s*(?=[<(])`,"g");for(let k of x.matchAll(v)){let E=k.index+k[0].length,C="";if(x[E]==="<"){let L=tf(x,E,"<",">");if(L<0)continue;C=e.slice(E+1,L),E=L+1;while(/\s/.test(x[E]||"")&&E<x.length)E++}if(x[E]!=="(")continue;let j=tf(x,E,"(",")");if(j>=0)return{type:C,args:lb(e.slice(E+1,j))}}return null}var nf=`
2587
+ type __StxCtor<T> = T extends StringConstructor ? string : T extends NumberConstructor ? number : T extends BooleanConstructor ? boolean : T extends ArrayConstructor ? unknown[] : T extends ObjectConstructor ? object : T extends readonly unknown[] ? __StxCtor<T[number]> : T extends abstract new (...args: any[]) => infer V ? V : unknown;
2588
+ type __StxWiden<T> = T extends string ? string : T extends number ? number : T extends boolean ? boolean : T;
2589
+ type __StxOption<T> = T extends { type: infer C } ? __StxCtor<C> : T extends { default: infer D } ? D extends (...args: any[]) => infer V ? V : __StxWiden<D> : __StxCtor<T>;
2590
+ type __StxRequired<O> = { [K in keyof O]-?: O[K] extends { required: true } ? K : never }[keyof O];
2591
+ type __StxDefaulted<O> = { [K in keyof O]-?: O[K] extends { default: unknown } ? K : never }[keyof O];
2592
+ type __StxOptions<O> = { [K in Exclude<__StxRequired<O>, __StxDefaulted<O>>]: __StxOption<O[K]> } & { [K in Exclude<keyof O, Exclude<__StxRequired<O>, __StxDefaulted<O>>>]?: __StxOption<O[K]> };
2593
+ type __StxDefaults<P, K> = Omit<P, Extract<keyof P, K>> & Partial<Pick<P, Extract<keyof P, K>>>;
2594
+ `;function rf(e,o){let x=[],v={defineProps:["defineProps"],defineEmits:["defineEmits"],withDefaults:["withDefaults"]},k=s(e),E=e.replace(/\bimport\s+(?:type\s+)?(\{[^}]*\}|\*\s+as\s+[\w$]+|[\w$]+)\s+from\s*(['"])([^'"]+)\2\s*;?/g,(Z,Y,Q,se,oe)=>{if(k.slice(oe,oe+6)!=="import")return Z;if(se.endsWith(".stx"))return"";let ie=`${o}Import${x.length}`;if(x.push(`import * as ${ie} from ${JSON.stringify(se)};`),Y.startsWith("*"))return`import ${Y.replace(/^\*\s+as\s+/,"")} = ${ie};`;if(!Y.startsWith("{"))return`import ${Y} = ${ie}.default;`;return Y.slice(1,-1).split(",").map((ce)=>{let[ae,pe=ae]=ce.trim().replace(/^type\s+/,"").split(/\s+as\s+/);if(!ae)return"";if(/^(?:stx|@stacksjs\/stx)(?:\/|$)/.test(se)&&ae in v)v[ae].push(pe);return`import ${pe} = ${ie}.${ae};`}).join(`
2595
+ `)}),C=Oc(e,v.defineProps),j=Oc(e,v.defineEmits),L=Oc(e,v.withDefaults);if(!C&&!j)return{declarations:"",props:null,events:null};let B=[],F=null,U=null;if(C){B.push(`const __options = (${C.args[0]||"{}"}) as const;`),B.push(`const __defaults = (${L?.args[1]||"{}"});`);let Z=C.type||"__StxOptions<typeof __options>";B.push(`export type __StxProps = __StxDefaults<${Z}, keyof typeof __defaults | __StxDefaulted<typeof __options>>;`),F=`${o}.__StxProps`}if(j)B.push(`const __events = (${j.args[0]||"[]"}) as const;`),B.push(`export type __StxEvents = ${j.type||"Record<(typeof __events)[number], any[]>"};`),U=`${o}.__StxEvents`;return{declarations:`${x.join(`
2596
+ `)}
2597
+ namespace ${o} {
2598
+ ${E}
2599
+ ${B.join(`
2600
+ `)}
2601
+ }`,props:F,events:U}}function*ub(e){let o=/<([A-Za-z][\w.-]*)(?=[\s/>])/g,x;while(x=o.exec(e)){let v=o.lastIndex,k=[];while(v<e.length){while(/\s/.test(e[v]||""))v++;if(e[v]===">"||e.slice(v,v+2)==="/>"){v+=e[v]===">"?1:2;break}let E=/^[^\s=/>]+/.exec(e.slice(v))?.[0];if(!E){v++;continue}let C=v;v+=E.length;while(/\s/.test(e[v]||""))v++;if(e[v]!=="="){k.push({name:E,value:!0,offset:C,braced:!1});continue}v++;while(/\s/.test(e[v]||""))v++;let j=e[v],L=j==="{",B=j==='"'||j==="'";if(B||L)v++;let F=v;if(L){let U=s(e.slice(v)),Z=1,Y=0;for(;Y<U.length;Y++){if(U[Y]==="{")Z++;if(U[Y]==="}"&&--Z===0)break}v+=Y}else if(B)while(v<e.length&&e[v]!==j)v++;else while(v<e.length&&!/[\s/>]/.test(e[v]))v++;if(k.push({name:E,value:e.slice(F,v),offset:F,braced:L}),B||L)v++}o.lastIndex=v,yield{name:x[1],offset:x.index,attributes:k}}}function sf(e,o,x){let v=[],k=[nf,"type __StxAssignedValue<T> = T extends { readonly _isSignal: true } | { readonly _isDerived: true } ? T extends () => infer V ? V : T : T;","type __StxProp<P, K> = K extends keyof P ? P[K] : unknown;",'type __StxEvent<E, K> = K extends keyof E ? E[K] extends readonly unknown[] ? Exclude<E[K]["length"], 0 | 1> extends never ? E[K][0] : E[K] : E[K] : any;'],E=new Map,C=new Map,j=new Map,L=x.scriptCode(e,x.filePath),B=s(L);for(let Q of L.matchAll(/\bimport\s+(\{[^}]+\}|[\w$]+)\s+from\s*['"]([^'"]+)['"]/g)){if(B.slice(Q.index,Q.index+6)!=="import")continue;let se=Q[2],oe=Ls.isAbsolute(se)||se.startsWith(".")?Ls.resolve(Ls.dirname(x.filePath),se):fi(se,Ls.dirname(x.filePath));if(!oe)continue;let ie=oe.endsWith(".stx")?oe:Nc.existsSync(`${oe}.stx`)?`${oe}.stx`:void 0,ce=ie?null:pi(oe,!1),ae=Q[1].startsWith("{")?Q[1].slice(1,-1).split(","):[Q[1]];for(let pe of ae){let[me,he=me]=pe.trim().split(/\s+as\s+/),Se=ie||ce?.get(me)||ce?.get(me.toLowerCase());if(Se)j.set(he,Se),j.set(he.toLowerCase(),Se),j.set(he.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Se)}}for(let Q of o.matchAll(/@import\s*\(([^)]+)\)/g))for(let se of Q[1].matchAll(/['"]([^'"]+)['"]/g)){let oe=gi(se[1],x.filePath,x).find((ie)=>Nc.statSync(ie,{throwIfNoEntry:!1})?.isFile());if(oe)j.set(Ls.basename(se[1]).replace(/\.stx$/,""),oe)}let F={__importedComponents:j},U=new Map,Z=(Q,se,oe)=>{let ie=e.slice(0,Q);return{code:se,offset:Q,attribute:oe,anchor:!0,kind:"directive",line:ie.split(`
2602
+ `).length,column:Q-ie.lastIndexOf(`
2603
+ `)}},Y=(Q,se,oe)=>v.push({expression:Q,statement:{text:se+Q.code+oe,prefixLength:se.length}});for(let Q of ub(o)){if(rn(Q.name)||Q.name==="component")continue;let se=Vu(Q.name,x.filePath,x,F);if(!se)continue;let oe=U.get(se);if(!oe){let ce;try{ce=x.readComponent?x.readComponent(se):Nc.readFileSync(se,"utf8")}catch{continue}if(ce===void 0)continue;C.set(se,ce),oe=rf(x.scriptCode(ce,se),`__StxComponent${U.size}`),U.set(se,oe),k.push(oe.declarations)}let ie=[];for(let ce of Q.attributes){let{name:ae,offset:pe}=ce,me=ce.value===!0?"true":ce.value;if(ae.startsWith("@")||ae.startsWith("v-on:")){if(oe.events&&ce.value!==!0)E.set(pe,`__StxEvent<${oe.events}, ${JSON.stringify(ae.replace(/^@|^v-on:/,"").split(".")[0])}>`);continue}let he=/^v-model(?::([\w-]+))?(?:\.[\w-]+)*$/.exec(ae);if(ae.startsWith("v-")&&!ae.startsWith("v-bind:")&&!he)continue;if(/^(?:x-|:)(?:if|for|show|key|else)(?:$|[.:-])/.test(ae))continue;let Se=(he?he[1]||"modelValue":ae.replace(/^:|^v-bind:/,"")).replace(/-([a-z])/g,(Re,Ae)=>Ae.toUpperCase());if(ie.push(Se),!oe.props)continue;let Ce=ae.startsWith(":")||ae.startsWith("v-bind:")||!!he||ce.braced?me:ce.value!==!0?JSON.stringify(me):"true";Y(Z(pe,Ce,ae),";void ((",`) satisfies __StxProp<${oe.props}, ${JSON.stringify(Se)}>);`)}if(oe.props){let ce=[...new Set(ie)].map((pe)=>`${JSON.stringify(pe)}: undefined as any`).join(", "),ae=Z(Q.offset,`<${Q.name}>`);v.push({expression:ae,statement:{text:`;void ({ ${ce} } satisfies ${oe.props} & Record<string, unknown>);`,prefixLength:0}})}}return{declarations:U.size?k.join(`
2604
+ `):"",checks:v,events:E,dependencies:C}}var of=/<script(\s[^>]*)?>([\s\S]*?)<\/script>/gi;function db(e){let o=(x)=>x.replace(/[^\n]/g," ");return e.replace(/<!--[\s\S]*?-->/g,o).replace(/\{\{--[\s\S]*?--\}\}/g,o)}function He(e){let o=[],x=db(e);of.lastIndex=0;let v;while((v=of.exec(x))!==null){let k=(v[1]||"").trim(),E=(v[0].match(/^<script(?:\s[^>]*)?>/i)?.[0]??"<script>").length,C=(v[0].match(/<\/script\s*>$/i)?.[0]??"</script>").length,j=v.index+E,L=v.index+v[0].length-C,B=e.slice(j,L);if(/\bsrc\s*=/.test(k))continue;let F=k.match(/\btype\s*=\s*["']([^"']+)["']/i);if(F&&!/^(?:module|text\/(?:javascript|typescript))$/i.test(F[1]))continue;let U=/\bserver\b/.test(k)?"server":/\bclient\b/.test(k)?"client":"plain",Z=Bs(e,j);o.push({kind:U,code:B,startLine:Z,startColumn:zs(e,j),offset:j,attrs:k})}return o}function Bs(e,o){let x=1;for(let v=0;v<o&&v<e.length;v++)if(e.charCodeAt(v)===10)x++;return x}function zs(e,o){let x=e.lastIndexOf(`
2605
+ `,o-1)+1;return o-x+1}function fo(e){let o=e.split(""),x=(k,E)=>{for(let C=k;C<E&&C<o.length;C++)if(o[C]!==`
2606
+ `)o[C]=" "},v=[/<script(?:\s[^>]*)?>[\s\S]*?<\/script>/gi,/<style(?:\s[^>]*)?>[\s\S]*?<\/style>/gi,/<!--[\s\S]*?-->/g,/\{\{--[\s\S]*?--\}\}/g,/@verbatim\b[\s\S]*?@endverbatim\b/g];for(let k of v){k.lastIndex=0;let E;while((E=k.exec(e))!==null)x(E.index,E.index+E[0].length)}return o.join("")}function pb(e){let o=0,x="";for(let v=0;v<e.length;v++){let k=e[v];if(x){if(k==="\\"){v++;continue}if(k===x)x="";continue}if(k==='"'||k==="'"||k==="`"){x=k;continue}if(k==="("||k==="["||k==="{"){o++;continue}if(k===")"||k==="]"||k==="}"){o--;continue}if(k==="|"&&o===0){if(e[v+1]==="|"){v++;continue}if(e[v-1]==="|")continue;return e.slice(0,v)}}return e}var mf=new Set([":for","x-for","v-for"]),mo=/(?:^|\s)((?::|x-|v-|@)[\w.:-]+)\s*=\s*(["'])([\s\S]*?)\2/g,jc="__stx_interpolated",af="__StxElement",hf="__StxTemplateValue",fb=`type ${hf}<T> = T extends { readonly _isSignal: true } | { readonly _isDerived: true } ? (T extends () => infer V ? T & V : T) : T`;function cf(e){return e.replace(/\{\{[\s\S]*?\}\}/g,jc).replace(/\{!![\s\S]*?!!\}/g,jc)}function hs(e){return e.replace(/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/g,(o)=>{let x=o.split(`
2607
+ `).length-1,v=o.length-x;return`0${" ".repeat(Math.max(0,v-1))}${`
2608
+ `.repeat(x)}`})}var gb=["foreach","endforeach","forelse","endforelse","for","endfor","while","endwhile","empty","if","elseif","else","endif","unless","endunless","isset","endisset","switch","case","default","endswitch","auth","endauth","guest","endguest","env","endenv","once","endonce","break","continue"],mb=new RegExp(String.raw`^[ \t]*@(?:${gb.join("|")})\b[ \t]*(\([^\n)]*\))?[ \t]*$`,"gm");function ys(e){return e.replace(mb,(o)=>o.replace(/[^\n]/g," "))}var lf=new Set(["x-cloak","x-ref","x-transition","x-teleport","v-slot","x-hydrate",":key","x-tooltip","x-tooltip-position"]);function pc(e){let o=fo(e),x=[],v=/(@?)\{\{([\s\S]*?)\}\}|(@?)\{!!([\s\S]*?)!!\}/g,k;while((k=v.exec(o))!==null){if(k[1]||k[3])continue;let j=k[2]??k[4]??"",L=k[2]!==void 0?2:3,B=pb(j);if(!B.trim())continue;let F=k.index+L+(B.length-B.trimStart().length);x.push({code:B.trim(),line:Bs(o,F),column:zs(o,F),offset:F,kind:"interpolation"})}let E=/@(if|elseif|else\s+if|unless)\b\s*\(/g;while((k=E.exec(o))!==null){let C=k.index+k[0].length-1,j=0,L=C;for(;L<o.length;L++){let Z=o[L];if(Z==="(")j++;else if(Z===")"){if(j--,j===0)break}}if(j!==0)continue;let B=o.slice(C+1,L),F=B.trim();if(E.lastIndex=L+1,!F)continue;let U=C+1+(B.length-B.trimStart().length);x.push({code:F,line:Bs(o,U),column:zs(o,U),offset:k.index,kind:"condition"})}mo.lastIndex=0;while((k=mo.exec(o))!==null){let C=k[1],j=k[3]??"",L=C.replace(/\..*$/,"").replace(/^([^:].*?):.*$/,"$1");if(lf.has(L)||lf.has(C))continue;if(!j.trim())continue;let B=k.index+k[0].indexOf(k[2],k[0].indexOf(C)+C.length)+1;if(mf.has(L)){let U=j.match(/\s+(?:in|of)\s+/);if(!U||U.index===void 0)continue;let Z=j.slice(U.index+U[0].length),Y=U.index+U[0].length+(Z.length-Z.trimStart().length);x.push({code:cf(Z.trim()),line:Bs(o,B+Y),column:zs(o,B+Y),offset:B+Y,kind:"directive",attribute:L});continue}let F=j.length-j.trimStart().length;x.push({code:cf(j.trim()),line:Bs(o,B+F),column:zs(o,B+F),offset:B+F,kind:"directive",attribute:L})}return x.sort((C,j)=>C.line-j.line||C.column-j.column),x}var hb=2000;function yb(e,o){let x=0,v=Math.min(e.length,o+hb);for(let k=o;k<v;k++){let E=e[k];if(E==="(")x++;else if(E===")"){if(x--,x===0)return e.slice(o+1,k)}}return null}function xb(e){let o=new Map,x=(j,L)=>{let B=j.split(/[,[\]{}()\s]+/).filter(Boolean);for(let F of B){let U=F.replace(/^\.\.\./,"").trim();if(!/^\$?[A-Z_$][\w$]*$/i.test(U))continue;let Z=B.length===1?L:void 0,Y=o.get(U);if(!Y)o.set(U,{name:U,iterable:Z});else if(Y.iterable!==Z)Y.iterable=void 0}},v=/^\$?[A-Z_$][\w$]*$/i,k=(j)=>{let L=j.trim();return v.test(L)?L:void 0};for(let j of e.matchAll(/@for(?:each|else)\s*\(/g)){let L=yb(e,j.index+j[0].length-1);if(L===null)continue;let B=St(L);if(!B)continue;x(B.itemVar.replace(/=>/g," "),k(B.arrayExpr))}for(let j of e.matchAll(/@for\s*\(\s*(?:(?:let|const|var)\s+)?([\w$]+|\[[^\]]*\]|\{[^}]*\})\s+(of|in)\s+([^)]*)/g))x(j[1],j[2]==="of"?k(j[3]):void 0);for(let j of e.matchAll(/@for\s*\(\s*(?:let|const|var)\s+([\w$]+)\s*[=;]/g))x(j[1]);let E=fo(e);mo.lastIndex=0;let C;while((C=mo.exec(E))!==null){let j=C[1].replace(/\..*$/,"");if(!mf.has(j))continue;let L=C[3].match(/\s+(?:in|of)\s+/);if(!L||L.index===void 0)continue;x(C[3].slice(0,L.index),k(C[3].slice(L.index+L[0].length)))}for(let j of e.matchAll(/@(?:php|js|ts)\b([\s\S]*?)@end(?:php|js|ts)\b/g))for(let L of j[1].matchAll(/\b(?:const|let|var|function|class)\s+([\w$]+)/g))x(L[1]);return[...o.values()].sort((j,L)=>j.name.localeCompare(L.name))}function te(e){let o=new Set;for(let x of e.matchAll(/^\s*(?:export\s+)?(?:const|let|var)\s+([\w$]+)/gm))o.add(x[1]);for(let x of e.matchAll(/^\s*(?:export\s+)?(?:async\s+)?function\s*\*?\s*([\w$]+)/gm))o.add(x[1]);for(let x of e.matchAll(/^\s*(?:export\s+)?class\s+([\w$]+)/gm))o.add(x[1]);for(let x of e.matchAll(/^\s*(?:export\s+)?(?:const|let|var)\s*[[{]([^\]}]*)[\]}]/gm))for(let v of x[1].split(",")){let k=v.split(":").pop().split("=")[0].replace(/^\.\.\./,"").trim();if(/^[A-Z_$][\w$]*$/i.test(k))o.add(k)}return[...o].sort()}var Lc=["params","query","cookies","host","ip","setResponseStatus","setResponseHeader","notFound","request","url","definePageMeta","defineClientPayload","defineStore","props","$props"],bb={$bool:"declare function $bool(value: unknown, fallback?: boolean): boolean",$num:"declare function $num(value: unknown, fallback?: number): number",$uid:"declare var $uid: string"};function Yi(e=new Set){return[...Lc.filter((o)=>!e.has(o)).map((o)=>`declare var ${o}: any`),...Object.entries(bb).filter(([o])=>!e.has(o)).map(([,o])=>o)].join(`
2609
+ `)}function Zi(e){return new Set([...e.matchAll(/^declare (?:function|const|let|var)\s+([A-Za-z_$][\w$]*)/gm)].map((o)=>o[1]))}function yf(e){let o=/\bdefineClientPayload\s*\(\s*\{([\s\S]*?)\}\s*\)/g,x,v=!1,k=new Set,E=s(e);while((x=o.exec(E))!==null){v=!0;for(let C of vb(x[1])){let j=C.split(":")[0].trim();if(/^[A-Za-z_$][\w$]*$/.test(j))k.add(j)}}return v?[...k]:null}function vb(e){let o=[],x=0,v="";for(let k of e){if(k===","&&x===0){o.push(v),v="";continue}if(k==="("||k==="["||k==="{")x++;else if(k===")"||k==="]"||k==="}")x--;v+=k}return o.push(v),o.filter((k)=>k.trim().length>0)}function wb(e){let o=/^[ \t]*import\b[\s\S]*?(?:from\s*['"][^'"]*['"]|['"][^'"]*['"])[ \t]*;?[ \t]*$/gm,x=[],v=e.replace(o,(k)=>(x.push(k.trim()),k.split(`
2610
+ `).map(()=>"").join(`
2611
+ `)));return{imports:x.join(`
2612
+ `),body:v}}function xf(e){let o=s(e),x=Array(o.length),v=0;for(let j=0;j<o.length;j++){let L=o[j];if(L==="}"||L===")"||L==="]")v=Math.max(0,v-1);if(x[j]=v,L==="{"||L==="("||L==="[")v++}let k=[],E=/^[ \t]*(?:export[ \t]+)?(interface|type)[ \t]+([A-Za-z_$][\w$]*)/gm,C;while((C=E.exec(o))!==null){if(x[C.index]!==0)continue;let j=C[1],L=C[2],B;if(j==="interface"){let F=o.indexOf("{",C.index);if(F===-1)continue;let U=0;B=-1;for(let Z=F;Z<o.length;Z++)if(o[Z]==="{")U++;else if(o[Z]==="}"&&--U===0){B=Z+1;break}if(B===-1)continue}else{let F=0;B=o.length;for(let U=o.indexOf("=",C.index)+1;U<o.length;U++){let Z=o[U];if(Z==="{"||Z==="["||Z==="("||Z==="<")F++;else if(Z==="}"||Z==="]"||Z===")"||Z===">")F--;else if(F<=0&&(Z===";"||Z===`
2613
+ `&&!/[=|&,<([{]\s*$/.test(o.slice(Math.max(0,U-40),U)))){B=Z===";"?U+1:U;break}}}k.push({name:L,text:e.slice(C.index,B).replace(/^[ \t]*export[ \t]+/,"")}),E.lastIndex=B}return k}function $b(e){return new Set(xf(e).map((o)=>o.name))}function Qi(e,o=""){let x=yf(e),v=$b(o),k=xf(e).filter((B)=>!v.has(B.name)).map((B)=>B.text);if(!x){let B=te(e).filter((F)=>!Ks(o,F));if(B.length===0&&k.length===0)return"";return["",`// ${_b}`,...k,...B.map((F)=>`declare var ${F}: any`)].join(`
2614
+ `)}if(x.length===0)return k.length>0?["",`// ${uf}`,...k].join(`
2615
+ `):"";let{imports:E,body:C}=wb(e),j=C.replace(/^[ \t]*export[ \t]+(?=(?:const|let|var|function|async|class)\b)/gm,""),L=["",`// ${uf}`];if(E)L.push(E);return L.push(...k),L.push(`async function ${df}() {`,j,` return { ${x.join(", ")} }`,"}",`type ${pf} = Awaited<ReturnType<typeof ${df}>>`,...x.map((B)=>`declare var ${B}: ${pf}[${JSON.stringify(B)}]`)),L.join(`
2616
+ `)}function Sb(e){let x=s(e).split(""),v=0;for(let k=0;k<x.length;k++){let E=x[k];if(E==="{"||E==="("||E==="["){v++;continue}if(E==="}"||E===")"||E==="]"){v=Math.max(0,v-1);continue}if(v>0&&E!==`
2617
+ `)x[k]=" "}return te(x.join(""))}function eo(e,o){if(yf(e)!==null)return[];let x=s(o),v=new Set(m);return Sb(e).filter((k)=>{if(v.has(k))return!1;if(te(o).includes(k))return!1;return new RegExp(`(?<![.#\\w$])${k}(?![\\w$])`).test(x)})}var uf="stx: types for the declared client payload (#1868)",_b="stx: untyped bridge names \u2014 declare a defineClientPayload to check these (#1868)",df="__stxServerScope",pf="__StxClientPayload";var ff=["$env","$user","$slot","$slots","$attrs","$props","$page","$route","$loop","loop","$errors","$csrf","props","slot"];var Eb=/^\s*[A-Z_$][\w$]*\s*=[^=]/i;function kb(e){let o=new Map,x=/!|===|!==|==|!=|&&|\|\||<|>|\btypeof\b|\binstanceof\b|\bin\b/;for(let v of e){let k=s(v),{depths:E,balanced:C}=we(k);if(!C)continue;let j=/^([ \t]*(?:export[ \t]+)?const[ \t]+)([A-Za-z_$][\w$]*)[ \t]*(?::[^=\n]+)?=[ \t]*([^\n]+)$/gm;for(let L of k.matchAll(j)){let B=L.index??0;if(E[B+L[1].length]!==0)continue;let F=L[2],U=B+L[0].length-L[3].length,Z=v.slice(U,B+L[0].length).trim().replace(/;$/,"").trim(),Y=L[3],Q=x.test(Y)&&!/\bawait\b|=>|\bfunction\b|[{}]/.test(Y)&&!/[,+\-*/%&|?:=]$/.test(Z)&&we(Y).balanced;o.set(F,o.has(F)||!Q?null:Z)}}return new Map([...o].filter((v)=>v[1]!==null))}function bf(e,o,x=0,v=new Set){if(o.size===0||x>=5)return e;let k=s(e),E="",C=0;for(let j of k.matchAll(/[A-Za-z_$][\w$]*/g)){let L=j.index??0,B=j[0],F=o.get(B);if(!F||v.has(B))continue;let U=k.slice(0,L).trimEnd(),Z=k.slice(L+B.length).trimStart();if(U.endsWith(".")||/^:(?!:)/.test(Z)&&/[{,]$/.test(U))continue;if(L>0&&/[\w$]/.test(k[L-1]))continue;E+=`${e.slice(C,L)}(${bf(F,o,x+1,new Set([...v,B]))})`,C=L+B.length}return E+e.slice(C)}function Cb(e,o){let x=/@(if|unless|elseif|else|endif|endunless)\b\s*(\()?/g,v=[],k;while((k=x.exec(e))!==null){if(k.index>o)break;let E=k[1];if(k.index===o){if(E==="elseif"){let j=v[v.length-1];if(j?.current)j.seen.push(j.current);if(j)j.current=null}break}if(E==="endif"||E==="endunless"){v.pop();continue}let C="";if(k[2]==="("){let j=0,L=k.index+k[0].length-1,B=L+1;for(;L<e.length;L++){let F=e[L];if(F==="(")j++;else if(F===")"){if(j--,j===0)break}}C=e.slice(B,L).trim(),x.lastIndex=L+1}if(E==="if")v.push({seen:[],current:C});else if(E==="unless")v.push({seen:[],current:`!(${C})`});else if(E==="elseif"||E==="else"){let j=v[v.length-1];if(!j)continue;if(j.current)j.seen.push(j.current);j.current=E==="elseif"?C:null}}return v.flatMap((E)=>[...E.seen.map((C)=>`!(${C})`),...E.current?[E.current]:[]]).filter(Boolean)}function Rb(e){let o=e.code.trim();if(!o)return null;if(e.attribute?.startsWith("@")){if(Eb.test(o))return null;let v=";(($event: any): void => { ";return{text:`${v}${o} });`,prefixLength:v.length}}let x=";void ((";return{text:`${x}${o}));`,prefixLength:x.length}}var Ab=/(\bfrom\s*|\bimport\s*\(\s*|\bimport\s+)(['"])(\.{1,2}\/[^'"\n]*)\2/g;function Wn(e,o){if(!o)return e;return e.replace(Ab,(x,v,k,E)=>{let C=gf.resolve(o,E).replace(/\\/g,"/");return`${v}${k}${C}${k}`})}function bs(e){return" ".repeat(Math.max(0,(e.startColumn??1)-1))}function Tb(e){let o=new Set,x=s(e);for(let v of x.matchAll(/\bimport\s+(?:type\s+)?([\w$*{}\s,]+?)\s+from\b/g)){let k=v[1],E=/\{([^}]*)\}/.exec(k);for(let B of E?.[1].split(",")??[]){let F=B.trim().replace(/^type\s+/,"").split(/\s+as\s+/).pop()?.trim();if(F&&/^[A-Z_$][\w$]*$/i.test(F))o.add(F)}let C=k.replace(/\{[^}]*\}/,""),j=/\*\s*as\s+([A-Z_$][\w$]*)/i.exec(C);if(j)o.add(j[1]);let L=/^\s*([A-Z_$][\w$]*)/i.exec(C);if(L&&L[1]!=="type")o.add(L[1])}return[...o].sort()}function to(e,o={}){let x=He(e),v=e.split(`
2618
+ `),k=Array.from({length:v.length},()=>""),E=new Map,C=o.filePath&&o.templateExpressions!==!1?sf(e,fo(e),{filePath:o.filePath,componentsDir:o.componentsDir,projectRoot:o.projectRoot,readComponent:o.readComponent,scriptCode:(U,Z)=>He(U).map((Y)=>Wn(Y.code,gf.dirname(Z))).join(`
2619
+ `)}):void 0,j=new Set,L=[];for(let U of x){let Z=ys(hs(U.code)),Y=Wn(Z,o.originDir??"").split(`
2620
+ `);Y.forEach((Q,se)=>{let oe=U.startLine-1+se;if(oe<k.length)k[oe]=se===0?bs(U)+Q:Q,j.add(oe)}),L.push(U.startLine-1+Y.length-1)}for(let U of L){let Z=k[U]?.trim()===""?U:U+1;if(Z<k.length&&k[Z].trim()===""&&(Z===U||!j.has(Z)))k[Z]=";"}let B=(U,Z)=>{for(let[Y,Q]of U.split(`
2621
+ `).entries())if(k.push(Q),Z)E.set(k.length,Y===0?Z:{...Z,line:Z.line+Y,column:1,prefixLength:0})};if(o.globals!==!1){B("");let U=new Set([...x.flatMap((se)=>te(se.code)),...x.flatMap((se)=>Tb(se.code))]),Z=(se)=>{if(!U.has(se))B(`declare var ${se}: any`)};if(o.runtimeGlobals!==!1){if(!U.has("window"))B("declare var window: any");for(let se of m)Z(se)}let Y=[...new Set([...Lc,...W,...ff])].filter((se)=>o.runtimeGlobals!==!1||!m.includes(se));if(o.contextScope==="global"){B("declare global {");for(let se of Y)B(` var ${se}: any`);B("}")}else{for(let se of Lc)Z(se);for(let se of W)Z(se);for(let se of ff)Z(se)}B(`declare var ${jc}: any`);let Q=new Set(x.flatMap((se)=>te(se.code)));B(`type ${af}<T> = T extends readonly (infer E)[] ? E : T extends Iterable<infer E2> ? E2 : any`);for(let se of xb(e)){if(Q.has(se.name))continue;let oe=se.iterable&&Q.has(se.iterable)?`${af}<typeof ${se.iterable}>`:"any";B(`declare var ${se.name}: ${oe}`)}}if(o.templateExpressions!==!1){if(C?.declarations)for(let Z of C.declarations.split(`
2622
+ `))B(Z);let U=pc(e).map((Z)=>{let Y=C?.events.get(Z.offset??-1);if(Y){Z.anchor=!0;let Q=Z.code.trim(),se=/^([\w$]+)\s*=\s*([^=][\s\S]*)$/.exec(Q),oe=se?`void ((${se[2]}) satisfies __StxAssignedValue<typeof ${se[1]}>)`:/^[\w$]+(?:\.[\w$]+)*$/.test(Q)?`${Q} satisfies (($event: ${Y}) => unknown)`:Q,ie=`;(($event: ${Y}): void => { `;return{expression:Z,statement:{text:`${ie}${oe} });`,prefixLength:ie.length}}}return{expression:Z,statement:Rb(Z)}}).filter((Z)=>Z.statement!==null);if(U.push(...C?.checks||[]),U.length>0){let Z=fo(e),Y=kb(x.map((ie)=>ie.code)),se=[...new Set(x.flatMap((ie)=>te(ie.code)))].filter((ie)=>/^[A-Z_$][\w$]*$/i.test(ie)),oe=0;if(se.length>0){B(fb);for(let ie of se)B(`type __StxT_${ie} = ${hf}<typeof ${ie}>`);B(`;((${se.map((ie)=>`${ie}: __StxT_${ie}`).join(", ")}) => {`),oe=1}for(let{expression:ie,statement:ce}of U){let ae=" ".repeat(oe),pe=ie.offset===void 0?[]:Cb(Z,ie.offset),me=pe.length>0?`${pe.map((Se)=>`if (${bf(Se,Y)}) `).join("")}{ `:"",he=pe.length>0?" }":"";B(ae+me+ce.text+he,{line:ie.line,column:ie.column,expression:ie,prefixLength:ce.prefixLength+ae.length+me.length,guardPrefixLength:ae.length+me.length})}if(oe>0)B("});")}}let F=!1;if(o.reference&&k[0]!==void 0&&k[0].trim()==="")k[0]=`/// <reference path=${JSON.stringify(o.reference.replace(/\\/g,"/"))} />`,F=!0;return B("export {}"),{text:k.join(`
2623
+ `),lineMap:E,sourceLineCount:v.length,componentDependencies:C?.dependencies,referenced:F}}function no(e,o){if(!e.expression)return!1;return e.inGuard===!0||o===2774}function ro(e,o,x){let v=e.lineMap.get(o);if(!v)return o<=e.sourceLineCount?{line:o,column:x}:null;let k=v.expression?.anchor?0:Math.max(0,x-1-(v.prefixLength??0));return{line:v.line,column:v.column+k,expression:v.expression,inGuard:x<=(v.guardPrefixLength??0)}}var Ib=[{open:"@if",close:"@endif",name:"if"},{open:"@unless",close:"@endunless",name:"unless"},{open:"@foreach",close:"@endforeach",name:"foreach"},{open:"@for",close:"@endfor",name:"for"},{open:"@while",close:"@endwhile",name:"while"},{open:"@forelse",close:"@endforelse",name:"forelse"},{open:"@switch",close:"@endswitch",name:"switch"},{open:"@isset",close:"@endisset",name:"isset"},{open:"@empty",close:"@endempty",name:"empty"},{open:"@auth",close:"@endauth",name:"auth"},{open:"@guest",close:"@endguest",name:"guest"},{open:"@can",close:"@endcan",name:"can"},{open:"@cannot",close:"@endcannot",name:"cannot"},{open:"@section",close:"@endsection",name:"section",altClose:"@show"},{open:"@push",close:"@endpush",name:"push"},{open:"@prepend",close:"@endprepend",name:"prepend"},{open:"@once",close:"@endonce",name:"once"},{open:"@markdown",close:"@endmarkdown",name:"markdown"},{open:"@component",close:"@endcomponent",name:"component"}],Db=[{pattern:/@if\s*[^(]/,message:"@if directive missing parentheses",suggestion:"Use @if(condition)"},{pattern:/@foreach\s*[^(]/,message:"@foreach directive missing parentheses",suggestion:"Use @foreach(items as item)"},{pattern:/@foreach\([^)]*\)\s*[^@\n<]/,message:"@foreach may have content on same line",suggestion:"Put content on new line after @foreach()"},{pattern:/@include\s*[^(]/,message:"@include directive missing parentheses",suggestion:"Use @include('partial-name')"},{pattern:/@extends\s*[^(]/,message:"@extends directive missing parentheses",suggestion:"Use @extends('layout-name') or @layout('layout-name')"},{pattern:/@layout\s*[^(]/,message:"@layout directive missing parentheses",suggestion:"Use @layout('layout-name')"}],Pb=[{pattern:/\{\{\s*constructor\s*\}\}/,message:"Attempting to access constructor property"},{pattern:/\{\{\s*__proto__\s*\}\}/,message:"Attempting to access __proto__ property"},{pattern:/\{\{\s*eval\s*\(/,message:"Attempting to use eval in expression"}];function fc(e){let o=[],x=[];return Mb(e,o),Ob(e,o,x),Nb(e,x),jb(e,o),{valid:o.length===0,errors:o,warnings:x}}function Mb(e,o){let x=(e.match(/\{\{/g)||[]).length,v=(e.match(/\}\}/g)||[]).length;if(x!==v)o.push({type:"expression",message:`Unclosed expression brackets: found ${x} opening '{{' and ${v} closing '}}'`,suggestion:"Ensure every {{ has a matching }}"})}function Ob(e,o,x){for(let v of Ib){let k=new RegExp(`${v.open}(?:\\s|\\()`,"g"),E=new RegExp(v.close,"g"),C=(e.match(k)||[]).length,j=(e.match(E)||[]).length;if(v.altClose){let L=new RegExp(v.altClose,"g");j+=(e.match(L)||[]).length}if(C>j)o.push({type:"directive",message:`Unclosed @${v.name} directive: found ${C} opening and ${j} closing`,suggestion:`Add ${C-j} missing ${v.close} tag(s)`});else if(j>C)x.push({type:"directive",message:`Extra ${v.close} found: ${j-C} more closing than opening`,suggestion:`Check for orphaned ${v.close} tags`})}}function Nb(e,o){for(let x of Db)if(x.pattern.test(e))o.push({type:"syntax",message:x.message,suggestion:x.suggestion})}function jb(e,o){for(let x of Pb)if(x.pattern.test(e))o.push({type:"expression",message:`Security warning: ${x.message}`,suggestion:"Remove dangerous code from template expressions"})}function gc(e,o){let x=e.slice(0,o).split(`
2624
+ `);return{line:x.length,column:x[x.length-1].length+1}}function mc(e,o,x){let v=[];switch(e){case"if":case"elseif":case"unless":if(x.length===0)v.push({type:"syntax",message:`@${e} requires a condition`,suggestion:`Use @${e}(condition)`});break;case"foreach":if(x.length===0||!x[0].includes(" as "))v.push({type:"syntax",message:'@foreach requires "items as item" syntax',suggestion:"Use @foreach(items as item) or @foreach(items as key => value)"});break;case"for":if(x.length===0)v.push({type:"syntax",message:"@for requires loop parameters",suggestion:"Use @for(let i = 0; i < 10; i++)"});break;case"switch":if(x.length===0)v.push({type:"syntax",message:"@switch requires an expression",suggestion:"Use @switch(expression)"});break;case"case":if(x.length===0)v.push({type:"syntax",message:"@case requires a value",suggestion:"Use @case(value)"});break;case"include":case"extends":case"component":if(x.length===0)v.push({type:"syntax",message:`@${e} requires a path`,suggestion:`Use @${e}('path/to/template')`});break}return v}function hc(e){return/@[a-z]+/i.test(e)||/\{\{/.test(e)}function yc(e){let o=e.matchAll(/@([a-z]+)/gi),x=new Set;for(let v of o){let k=v[1].toLowerCase();if(!k.startsWith("end"))x.add(k)}return Array.from(x)}import $n from"path";import Pr from"process";var xt=["module","exports","require","props","$props","$bool","$num","defineProps","withDefaults","defineClientPayload","useServerData","useRuntimeConfig","useServerRuntimeConfig","state","derived","effect","batch","onMount","onDestroy","definePageMeta","useRoute","useRouter","useHead","useSeoMeta","setResponseStatus","setResponseHeader","notFound","ref","reactive","computed","watch","onMounted","onUnmounted","nextTick","defineEmits","defineExpose","defineSlots","provide","inject","useColorMode","useDark","useMediaQuery","useScrollLock","usePreferredDark","usePreferredLight","usePreferredReducedMotion","usePreferredContrast","window","document","console","confirm","alert","fetch","params"];var vf=new Set(xt),Lb=new Set(["props","$props","defineProps"]),Bb=new Set(["stx","@stacksjs/stx"]),wf=P(128),$f=P(64);function zb(e){let o=[],x=0,v=e.split(`
2625
+ `);for(let k of v){let E=x,C=null,j=!1;for(let L=0;L<k.length;L++){let B=k[L];if(j){j=!1;continue}if(B==="\\"){j=!0;continue}if(C){if(B===C)C=null;continue}if(B==="'"||B==='"'||B==="`"){C=B;continue}if(B==="/"&&L+1<k.length&&k[L+1]==="/")break;if(B==="{")x++;else if(B==="}")x--}if(E===0){let L=k.match(/(?:const|let|var)\s+(\w+)\s*=/);if(L)o.push(L[1]);else if(/^\s*(?:const|let|var)\s+\w+\s*;?\s*$/.test(k)){let B=k.match(/(?:const|let|var)\s+(\w+)/);if(B)o.push(B[1])}else{let B=k.match(/(?:const|let|var)\s+(\{[^}]+\}|\[[^\]]+\])\s*=/);if(B){let U=B[1].slice(1,-1).split(",").map((Z)=>{let Y=Z.split(":");return(Y.length>1?Y[1]:Y[0]).trim()}).filter((Z)=>/^\w+$/.test(Z));o.push(...U)}}}}return[...new Set(o)]}function sc(e){let o=e;o=o.replace(/^\s*import\s+.*?from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),o=o.replace(/^\s*import\s+['"][^'"]+['"]\s*;?\s*$/gm,""),o=o.replace(/^\s*interface\s+\w+\s*\{[\s\S]*?\n\}\s*$/gm,""),o=o.replace(/^\s*type\s+\w+\s*=[\s\S]*?(?=\n(?:const|let|var|function|export|interface|type|$))/gm,""),o=o.replace(/^(\s*(?:export\s+)?(?:const|let|var)\s+)(\w+|\{[^}]+\}|\[[^\]]+\])\s*:\s*[^=]+(\s*=)/gm,"$1$2$3");function x(v){if(!v.includes(":"))return v;let k=[],E="",C=0,j=0,L=null;for(let B=0;B<v.length;B++){let F=v[B];if(L){if(E+=F,F===L)L=null;continue}if(F==='"'||F==="'"||F==="`"){L=F,E+=F;continue}if(F==="<")C++;else if(F===">"&&C>0)C--;else if(F==="(")j++;else if(F===")")j--;if(F===","&&C===0&&j===0){k.push(E),E="";continue}E+=F}if(E)k.push(E);return k.map((B)=>{let F=B.trim(),U=F.startsWith("..."),Z=U?F.slice(3):F,Y=-1,Q=0;for(let me=0;me<Z.length;me++)if(Z[me]==="<")Q++;else if(Z[me]===">")Q--;else if(Z[me]===":"&&Q===0){Y=me;break}if(Y===-1)return B;let oe=Z.substring(0,Y).trim().replace(/\?$/,""),ie=Z.substring(Y+1),ce=-1,ae=0;for(let me=0;me<ie.length;me++)if(ie[me]==="<")ae++;else if(ie[me]===">")ae--;else if(ie[me]==="="&&ae===0){ce=me;break}let pe=U?"...":"";if(ce!==-1)return`${pe}${oe} = ${ie.substring(ce+1).trim()}`;return`${pe}${oe}`}).join(", ")}o=o.replace(/\b(function\s+\w*\s*)\(([^)]*)\)/g,(v,k,E)=>{if(!E.includes(":"))return v;return`${k}(${x(E)})`});{let v=/\b(function\s+\w*\s*)\(/g,k,E=[];while((k=v.exec(o))!==null){let C=k.index+k[0].length-1,j=1,L=C+1,B=0,F=null;while(L<o.length&&j>0){let Y=o[L];if(F){if(Y===F)F=null;L++;continue}if(Y==='"'||Y==="'"||Y==="`"){F=Y,L++;continue}if(Y==="<")B++;else if(Y===">"&&B>0)B--;else if(B===0){if(Y==="(")j++;else if(Y===")")j--}if(j>0)L++}if(j!==0)continue;let U=o.substring(C+1,L);if(!U.includes(":"))continue;let Z=x(U);E.push({start:C+1,end:L,replacement:Z})}for(let C=E.length-1;C>=0;C--){let{start:j,end:L,replacement:B}=E[C];o=o.substring(0,j)+B+o.substring(L)}}return o=o.replace(/\(([^)]*)\)\s*(?::\s*[^=]+)?\s*=>/g,(v,k)=>{if(!k.includes(":"))return v;if(k.includes("{")||k.includes("}"))return v;return`(${k.split(",").map((C)=>{let[j,...L]=C.split("="),B=j.split(":")[0].trim();if(L.length>0)return`${B} = ${L.join("=").trim()}`;return B}).join(", ")}) =>`}),o=o.replace(/(\))\s*:\s*([A-Z]\w*|void|string|number|boolean|any|unknown|never|null|undefined)(?:<[^>]+>)?(?:\s*\|\s*(?:[A-Z]\w*|void|string|number|boolean|any|unknown|never|null|undefined))*\s*(\{)/g,"$1$3"),o=o.replace(/(\b(?:function|class|interface|type|extends|implements)\s+\w+)\s*<[^<>()]*>/g,"$1"),o=o.replace(/(\b(?:defineProps|withDefaults|defineEmits|defineSlots|Array|Promise|Map|Set|Record|Partial|Required|Readonly|Pick|Omit|Exclude|Extract))\s*<[^<>()]*>/g,"$1"),o=o.replace(/(\w+)\s*<[A-Z][^<>()]*>\s*(?=\()/g,"$1"),o=o.replace(/\s+as\s+(?:const|[A-Za-z]\w*(?:\[\])?(?:\s*\|\s*\w+(?:\[\])?)*)/g,""),o=o.replace(/\s+satisfies\s+\w+(?:<[^>]*>)?/g,""),o=o.replace(/(\w|\)|\])\s*!(?!=)/g,"$1"),o=o.replace(/^\s*(?:export\s+)?(?:const\s+)?enum\s+\w+\s*\{[^}]*\}\s*$/gm,""),o=o.replace(/(?<=[\s=,(])<[A-Z]\w*(?:\[\])?>/g,""),o=o.replace(/\n\s*\n\s*\n/g,`
2626
+
2627
+ `),o}function ic(e){return e.replace(/\s*imported from \S*(?:[/\\]packages[/\\]stx[/\\]|@stacksjs[/\\]stx[/\\])\S*/g,"")}function oc(e){return/cannot find module|cannot find package|could not resolve|module not found|failed to resolve/i.test(e)}function ac(e){if(e instanceof SyntaxError)return!0;let o=e instanceof Error?e.message:String(e);return/SyntaxError|Unexpected (token|identifier|string|number|keyword|end of)|Unterminated|Expected .+ but found/i.test(o)}function cc(e){if(!/is not defined|can't find variable/i.test(e))return!1;return!/\b(document|window|navigator|localStorage|sessionStorage|self)\b/.test(e)}var Sf=new Set;async function d(e,o,x,v={}){if(!e.trim())return;let k=y(),E=D(e,JSON.stringify(k)),C=wf.get(E);if(C===void 0){try{let Pe=N({loader:"ts",target:"browser",define:k}),Ge=e.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");Ge=Ge.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,""),C=Pe.transformSync(Ge)}catch{C=sc(e)}wf.set(E,C)}let j={exports:{}},L=j.exports,B=Pr.cwd(),F={},U=[...C.matchAll(/require\s*\(\s*['"]([^'"]+)['"]\s*\)/g)||[]].map((Pe)=>Pe[1]).filter((Pe)=>!Pe.startsWith("node:")&&!["fs","path","os","child_process","crypto","http","https","url","util","stream","events","buffer","net","querystring","zlib","tls"].includes(Pe)),Z=new Map;for(let Pe of U)try{if(Pe.startsWith(".")){F[Pe]=await import($n.resolve($n.dirname(x),Pe));continue}let Ge=$n.resolve(B,"node_modules",Pe),rt=$n.join(Ge,"package.json"),gt=JSON.parse(u("fs").readFileSync(rt,"utf8")),Dt=gt.main||"index.js";if(gt.exports){let Kt=typeof gt.exports==="string"?gt.exports:gt.exports["."];if(typeof Kt==="string")Dt=Kt;else if(Kt?.bun)Dt=Kt.bun;else if(Kt?.import)Dt=Kt.import;else if(Kt?.default)Dt=Kt.default}F[Pe]=await import($n.resolve(Ge,Dt))}catch(Ge){if(Pe.startsWith("."))Z.set(Pe,Ge instanceof Error?Ge.message:String(Ge))}let Y=(Pe)=>{if(F[Pe])return F[Pe];let Ge=Z.get(Pe);if(Ge!==void 0)throw Error(`Cannot require '${Pe}' from ${x}: ${Ge}`);return u(Pe)},Q=o.props||{},se=(Pe)=>{if(!Pe)return Q;let Ge={};for(let[rt,gt]of Object.entries(Pe)){let Dt=Q[rt];if(Dt!==void 0)Ge[rt]=Dt;else if(typeof gt==="function")Ge[rt]=gt();else Ge[rt]=gt}return Ge};for(let[Pe,Ge]of Object.entries(Q))Object.defineProperty(se,Pe,{value:Ge,enumerable:!0,configurable:!0,writable:!0});let oe=(Pe,Ge=!1)=>{if(Pe===void 0||Pe===null)return Ge;if(typeof Pe==="string"){let rt=Pe.trim().toLowerCase();if(rt===""||rt==="true"||rt==="1"||rt==="on"||rt==="yes")return!0;if(rt==="false"||rt==="0"||rt==="off"||rt==="no")return!1;return!0}return Boolean(Pe)},ie=(Pe,Ge=0)=>{if(Pe===void 0||Pe===null)return Ge;if(typeof Pe==="string"){let gt=Pe.trim();if(gt==="")return Ge;let Dt=Number(gt);return Number.isFinite(Dt)?Dt:Ge}let rt=Number(Pe);return Number.isFinite(rt)?rt:Ge};for(let Pe of["name","length","caller","arguments"]){if(Object.prototype.hasOwnProperty.call(Q,Pe))continue;try{Object.defineProperty(se,Pe,{value:void 0,enumerable:!1,configurable:!0,writable:!0})}catch{}}let ce=(Pe)=>{if(!Pe)return Q;let Ge={...Q};for(let[rt,gt]of Object.entries(Pe)){let Dt=gt&&typeof gt==="object"&&!Array.isArray(gt)?gt:{type:gt};if(Ge[rt]===void 0&&Dt.default!==void 0)Ge[rt]=typeof Dt.default==="function"?Dt.default():Dt.default}return Ge},ae=()=>o.slots||{},pe=(Pe,Ge)=>{let rt={...Pe};for(let[gt,Dt]of Object.entries(Ge))if(rt[gt]===void 0)if(typeof Dt==="function")rt[gt]=Dt();else rt[gt]=Dt;return rt},me=(Pe)=>{let Ge=()=>Pe;return Ge.set=(rt)=>{},Ge.update=(rt)=>{},Ge},he=(Pe)=>{let Ge,rt=!1;return()=>{if(!rt)try{Ge=Pe(),rt=!0}catch{Ge=void 0}return Ge}},Se=(Pe)=>{},Ee=(Pe)=>Pe(),Ce=(Pe)=>{},Re=(Pe)=>{},Ae=Bn(o);function _e(Pe){let Ge=Pe||{};if(Ge.title!==void 0||Ge.description!==void 0)Oe({title:Ge.title,description:Ge.description})}function Te(Pe){if(!Pe||typeof Pe!=="object")return;let Ge=o.__stxClientPayload??{};Object.assign(Ge,Pe),o.__stxClientPayload=Ge}let Me=()=>{let Pe=o.__stxServeContext,Ge=o.__stxServeSearch??Pe?.search??"",rt=Pe?.path??"",gt=Object.fromEntries(new URLSearchParams(Ge)),Dt=o.query,Kt=Object.keys(gt).length>0?gt:Dt??{},En=Ge||(Object.keys(Kt).length>0?`?${new URLSearchParams(Kt).toString()}`:"");return{params:o.params??{},query:Kt,path:rt,name:"",fullPath:rt+En,hash:"",matched:[]}},De=()=>({push:(Pe)=>{},replace:(Pe)=>{},back:()=>{},forward:()=>{},go:(Pe)=>{}}),Ie=(Pe)=>{let Ge=o.__stx_runtime_head||{};o.__stx_runtime_head=fe(Ge,Pe||{})},Oe=(Pe)=>{Ie(sr(Pe||{}))},tt=(Pe)=>({value:Pe}),ot=(Pe)=>Pe,nt=(Pe)=>({value:typeof Pe==="function"?Pe():Pe}),yt=(Pe,Ge)=>{},dt=(Pe)=>{},ht=(Pe)=>{},at=(Pe)=>Pe?Pe():Promise.resolve(),Pt=(Pe)=>(Ge,...rt)=>{},pt=(Pe)=>{},Lt=(Pe,Ge)=>{},Sn=(Pe,Ge)=>Ge,fn=()=>({value:"light"}),_n=()=>me(!1),Qe=(Pe)=>me(!1),st=()=>me(!1),ft=()=>Qe("(prefers-color-scheme: dark)"),Xt=()=>Qe("(prefers-color-scheme: light)"),Mt=()=>Qe("(prefers-reduced-motion: reduce)"),nn=()=>Qe("(prefers-contrast: more)"),jt={siteId:void 0,API_ENDPOINT:"",ANALYTICS_SITE_ID:void 0,location:{href:"",pathname:"",search:"",hash:"",origin:"",host:"",hostname:"",protocol:"https:",assign:()=>{},replace:()=>{},reload:()=>{}},localStorage:{getItem:()=>null,setItem:()=>{},removeItem:()=>{},clear:()=>{}},sessionStorage:{getItem:()=>null,setItem:()=>{},removeItem:()=>{},clear:()=>{}},fetch:globalThis.fetch,addEventListener:()=>{},removeEventListener:()=>{},setTimeout:()=>0,clearTimeout:()=>{},setInterval:()=>0,clearInterval:()=>{},requestAnimationFrame:()=>0,cancelAnimationFrame:()=>{},alert:()=>{},confirm:()=>!1,prompt:()=>null,getComputedStyle:()=>({}),matchMedia:()=>({matches:!1,addListener:()=>{},removeListener:()=>{}}),getDateRangeParams:()=>"",stx:{}},So=new Proxy(jt,{get(Pe,Ge){if(Ge in Pe)return Pe[Ge];return},set(Pe,Ge,rt){return Pe[Ge]=rt,!0}}),_o={getElementById:()=>null,querySelector:()=>null,querySelectorAll:()=>[],createElement:()=>({}),createTextNode:()=>({}),body:{},head:{},documentElement:{},addEventListener:()=>{},removeEventListener:()=>{}},Ro=console;try{let Pe=os(C,x),Ge=new Set(Object.keys(Q)),rt=Object.keys(o).filter((ct)=>!Ge.has(ct)&&!Lb.has(ct)&&Ze(ct)),gt=rt.map((ct)=>o[ct]);if(!rt.includes("__stxServeContext"))rt.push("__stxServeContext"),gt.push(void 0);let Dt=new Set(["async","module","exports","require","params","window","document","console","state","derived","effect"]),Kt=[],En=[];for(let[ct,yn]of Object.entries(Q)){if(!Ze(ct))continue;if(Dt.has(ct))continue;if(new RegExp(`(?:^|[\\s;{])(?:const|let|var|function)\\s+${ct}\\b`).test(Pe))continue;Kt.push(ct),En.push(yn)}let An=zb(Pe).map((ct)=>`module.exports.${ct} = typeof ${ct} !== 'undefined' ? ${ct} : module.exports.${ct};`).join(`
2628
+ `),Jt=o.params??{},et=[],it=[];for(let ct=0;ct<rt.length;ct++){if(rt[ct]==="params")continue;et.push(rt[ct]),it.push(gt[ct])}let Tt=[...xt,...Kt,...et],ut=`return (async () => {
2629
+ ${Pe}
2630
+ ${An}
2631
+ return module.exports
2632
+ })()`,Wt=D(ut,Tt.join("\x00")),Ot=$f.get(Wt);if(!Ot)Ot=Function(...Tt,ut),$f.set(Wt,Ot);let en=o.__stx_options?.runtimeConfig;if(en||/\buse(?:Server)?RuntimeConfig\b/.test(C))await an(o,x,en);let Tn=await de(o.__stx_runtime_config??Rt()??S(),()=>lp(o,()=>Ot(j,L,Y,Q,se,oe,ie,ce,pe,Te,up,Ss,Qn,me,he,Se,Ee,Ce,Re,_e,Me,De,Ie,Oe,Ae.setResponseStatus,Ae.setResponseHeader,Ae.notFound,tt,ot,nt,yt,dt,ht,at,Pt,pt,ae,Lt,Sn,fn,_n,Qe,st,ft,Xt,Mt,nn,So,_o,Ro,jt.confirm,jt.alert,jt.fetch,Jt,...En,...it)));if(v.preserveExisting){for(let[ct,yn]of Object.entries(Tn))if(!(ct in o)||o[ct]===void 0)o[ct]=yn}else Object.assign(o,Tn);for(let[ct,yn]of Object.entries(Q))if(!(ct in o))o[ct]=yn}catch(Pe){if(o.__stx_strict_hydration)throw Pe;let Ge=ic(Pe instanceof Error?Pe.message:String(Pe));if(oc(Ge))console.warn(`[stx] server <script> in ${x??"<unknown>"} imports a module that does not resolve, so every variable in that script is undefined. Cause: ${Ge}`),v.onFailure?.({kind:"module-resolution",message:Ge,error:Pe});else if(ac(Pe))console.warn(`[stx] server <script> in ${x??"<unknown>"} does not parse, so every variable in that script is undefined. Cause: ${Ge}`),v.onFailure?.({kind:"syntax",message:Ge,error:Pe});else if(cc(Ge))console.warn(`[stx] server <script> in ${x??"<unknown>"} names something that does not exist, so every variable in that script is undefined. Optional chaining does not help here: an undefined identifier throws before the chain is reached. Cause: ${Ge}`),v.onFailure?.({kind:"missing-binding",message:Ge,error:Pe});else{let rt=`${x??"<unknown>"}\x00${Ge}`;if(Pr.env.STX_DEBUG||!Sf.has(rt))Sf.add(rt),console.warn(`[stx] server <script> in ${x??"<unknown>"} threw, so every variable in that script is undefined and anything that reads one renders empty. Cause: ${Ge}`);v.onFailure?.({kind:"unknown",message:Ge,error:Pe})}try{await qb(C,o,x)}catch(rt){if(Pr.env.STX_DEBUG){let gt=rt instanceof Error?rt.message:String(rt);console.warn(`[stx] fallback extraction also failed in ${x??"<unknown>"}: ${gt}`)}}}}function lc(e){let o=0,x=null,v=!1,k=!1;for(let E=0;E<e.length;E++){let C=e[E];if(x){if(C===x){if(x=null,v||o===0)k=!0}continue}if(C==="'"||C==='"'||C==="`"){x=C;continue}if(C==="{")o++;else if(C==="}")o--;else if(e.startsWith("from",E)&&o===0)v=!0}return x===null&&o===0&&k}var Wb=/^(?:export\s+)?(?:const|let|var)\s+[A-Za-z_$][\w$]*(?:\s*,\s*[A-Za-z_$][\w$]*)*\s*;?$/;function os(e,o){let x=o?$n.dirname(o):Pr.cwd(),v=Pr.cwd(),k=e.split(`
2633
+ `),E=[],C=0;while(C<k.length){let j=k[C].trim();if(j.startsWith("interface ")||j.startsWith("export interface ")||j.startsWith("type ")||j.startsWith("export type ")){if(j.includes("{")&&!j.includes("}")){let L=0;for(;C<k.length;C++){for(let B of k[C])if(B==="{")L++;else if(B==="}")L--;if(L<=0)break}}C++;continue}if(j.startsWith("definePageMeta(")){let L=0,B=!1,F=C;for(let Y=C;Y<k.length&&!B;Y++){let Q=null,se=!1,oe=k[Y];for(let ie=0;ie<oe.length;ie++){let ce=oe[ie];if(se){se=!1;continue}if(ce==="\\"){se=!0;continue}if(Q){if(ce===Q)Q=null;continue}if(ce==='"'||ce==="'"||ce==="`"){Q=ce;continue}if(ce==="(")L++;else if(ce===")"){if(L--,L===0){C=Y+1,B=!0;break}}}}if(!B)C=k.length;let U=k.slice(F,C).join(`
2634
+ `),Z=[];for(let Y of["title","description"]){let Q=new RegExp(`\\b${Y}\\s*:\\s*(['"\`])((?:\\\\.|(?!\\1)[^\\\\])*)\\1`).exec(U);if(Q)Z.push(`${Y}: ${JSON.stringify(Q[2])}`)}if(Z.length>0)E.push(`useSeoMeta({ ${Z.join(", ")} });`);continue}if(j.startsWith("import ")||j==="import"||j.startsWith("import{")){let L=j,B=0;while(!lc(L)&&C+B+1<k.length)B++,L=`${L} ${k[C+B].trim()}`;C+=B;let F=L.match(/^import\s+(\w+)\s+from\s+['"](.+?)['"]/),U=L.match(/^import\s+\{([^}]*)\}\s+from\s+['"](.+?)['"]/),Z=L.match(/^import\s+['"](.+?)['"]/),Y=L,Q=(se)=>{if(se.startsWith("."))return $n.resolve(x,se);if(se.startsWith("~/")||se.startsWith("@/"))return $n.resolve(v,se.slice(2));return se};if(F){let[,se,oe]=F,ie=Q(oe);E.push(`const ${se} = (await import('${ie}')).default`),E.push(`module.exports.${se} = ${se};`)}else if(U){let[,se,oe]=U,ie=Q(oe),ce=[],ae=[],pe=Bb.has(oe);for(let me of se.split(",")){let he=me.trim();if(!he)continue;let Se=he.split(/\s+as\s+/);if(Se.length===2){let[Ee,Ce]=[Se[0].trim(),Se[1].trim()];if(pe&&vf.has(Ee)){E.push(`const ${Ce} = ${Ee};`);continue}ce.push(`${Ee}: ${Ce}`),ae.push(Ce)}else{if(pe&&vf.has(he))continue;ce.push(he),ae.push(he)}}if(ce.length>0)E.push(`const { ${ce.join(", ")} } = await import('${ie}')`);for(let me of ae)E.push(`module.exports.${me} = ${me};`)}else if(Z){let se=Q(Z[1]);E.push(`await import('${se}')`)}else E.push(Y);C++;continue}if(Wb.test(j))E.push(k[C]),C++;else if(j.startsWith("export const ")||j.startsWith("export let ")||j.startsWith("export var ")){let L=Ef(k,C),{type:B,name:F,value:U}=L;E.push(`${B} ${F} = ${U};`),E.push(`module.exports.${F} = ${F};`),C=L.nextIndex}else if(j.startsWith("export function ")||j.startsWith("export async function ")){let L=Bc(k,C);E.push(L.functionCode),E.push(`module.exports.${L.name} = ${L.name};`),C=L.nextIndex}else if(j.startsWith("const ")||j.startsWith("let ")||j.startsWith("var ")){let L=Ef(k,C),{type:B,name:F,value:U}=L;E.push(`${B} ${F} = ${U};`),E.push(`module.exports.${F} = ${F};`),C=L.nextIndex}else if(j.startsWith("function ")||j.startsWith("async function ")){let L=Bc(k,C);E.push(L.functionCode),E.push(`module.exports.${L.name} = ${L.name};`),C=L.nextIndex}else if(j.startsWith("export default function ")||j.startsWith("export default async function ")){let L=k[C].replace(/^(\s*)export\s+default\s+/,"$1"),B=[...k];B[C]=L;let F=Bc(B,C);if(E.push(F.functionCode),F.name)E.push(`module.exports.default = ${F.name};`);C=F.nextIndex}else if(j.startsWith("export default ")){let L=j.replace(/^export\s+default\s+/,"").replace(/;$/,"");E.push(`module.exports.default = ${L};`),C++}else if(j.startsWith("class ")||j.startsWith("export class ")){let L=j.match(/(?:export\s+)?class\s+(\w+)/);if(L){let B=L[1],F=k[C].replace(/^export\s+/,""),U=0,Z=C;for(;Z<k.length;Z++){let Y=k[Z];for(let Q of Y)if(Q==="{")U++;else if(Q==="}")U--;if(Z>C)F+=`
2635
+ `+Y;if(U<=0&&Z>=C)break}E.push(F),E.push(`module.exports.${B} = ${B};`),C=Z+1}else E.push(j),C++}else if(j.includes("module.exports"))E.push(j),C++;else if(j.trim()&&!j.startsWith("//"))E.push(j),C++;else C++}return Fb(E.join(`
2636
+ `),x,v)}function Fb(e,o,x){let v=e.length,k="",E=0,C=null,j=!1,L=!1,B=0;while(E<v){let F=e[E],U=e[E+1];if(j){if(k+=F,F===`
2637
+ `)j=!1;E++;continue}if(L){if(k+=F,F==="*"&&U==="/"){k+=U,E+=2,L=!1;continue}E++;continue}if(!C&&F==="/"&&U==="/"){j=!0,k+=F,E++;continue}if(!C&&F==="/"&&U==="*"){L=!0,k+=F,E++;continue}if(C){if(k+=F,F==="\\"){k+=U,E+=2;continue}if(F===C&&C!=="`"){C=null,E++;continue}if(C==="`"){if(F==="$"&&U==="{"){B++,k+=U,E+=2;continue}if(F==="`"){C=null,E++;continue}}E++;continue}if(B>0){if(F==="{")B++;else if(F==="}")B--}if(F==='"'||F==="'"||F==="`"){C=F,k+=F,E++;continue}if(F==="a"&&e.startsWith("await",E)){let Z=Vb(e,E);if(Z){let{quote:Y,path:Q,end:se}=Z;if(Q.startsWith(".")||Q.startsWith("~/")||Q.startsWith("@/")){let oe=Q.startsWith(".")?$n.resolve(o,Q):$n.resolve(x,Q.slice(2));k+=`await import(${Y}${oe}${Y})`,E=se;continue}}}k+=F,E++}return k}function Vb(e,o){let x=o+5;if(x>=e.length)return null;if(!/\s/.test(e[x]))return null;while(x<e.length&&/\s/.test(e[x]))x++;if(!e.startsWith("import",x))return null;x+=6;while(x<e.length&&/\s/.test(e[x]))x++;if(e[x]!=="(")return null;x++;while(x<e.length&&/\s/.test(e[x]))x++;let v=e[x];if(v!=="'"&&v!=='"')return null;x++;let k=x;while(x<e.length&&e[x]!==v)if(e[x]==="\\")x+=2;else x++;if(x>=e.length)return null;let E=e.slice(k,x);x++;while(x<e.length&&/\s/.test(e[x]))x++;if(e[x]!==")")return null;return{quote:v,path:E,end:x+1}}function Af(e,o){let x=e[o];if(x!=="{"&&x!=="[")return null;let k=w(e,x,x==="{"?"}":"]",o);if(k===-1)return null;return{pattern:e.slice(o,k+1),endPos:k+1}}function Tf(e){let o=[],x=e.slice(1,-1).trim();if(!x)return o;let v=0,k=0,E="";while(v<x.length){let C=x[v];if(C==="{"||C==="["){let j=k===0?Af(x,v):null;if(j){o.push(...Tf(j.pattern)),v=j.endPos,E="";continue}k++}else if(C==="}"||C==="]")k--;if(k>0){v++;continue}if(C===","){if(E.trim())o.push(E.trim());E="",v++;continue}if(C===":"){E="",v++;continue}if(C==="="){if(E.trim())o.push(E.trim());E="",v++;while(v<x.length&&x[v]!==","&&k===0){if(x[v]==="{"||x[v]==="[")k++;else if(x[v]==="}"||x[v]==="]")k--;v++}continue}if(/[\w$]/.test(C))E+=C;v++}if(E.trim())o.push(E.trim());return o}function uc(e){let o=/^(?:export\s+)?(const|let|var)\s+([A-Za-z_$][\w$]*)/.exec(e);if(!o)return null;let x=o[0].length,v=(k)=>k===" "||k==="\t";while(x<e.length&&v(e[x]))x++;if(e[x]===":"){let k=0,E=null;x++;for(;x<e.length;x++){let C=e[x];if(E){if(C==="\\"){x++;continue}if(C===E)E=null;continue}if(C==="'"||C==='"'||C==="`"){E=C;continue}if(C==="("||C==="["||C==="{"||C==="<"){k++;continue}if(C===")"||C==="]"||C==="}"||C===">"){k--;continue}if(C==="="&&k<=0){let j=e[x+1],L=e[x-1];if(j!=="="&&j!==">"&&L!=="="&&L!=="!"&&L!=="<"&&L!==">")break}}if(e[x]!=="=")return null}while(x<e.length&&v(e[x]))x++;if(e[x]!=="=")return null;return{type:o[1],name:o[2],value:e.slice(x+1).trim()}}function _f(e,o,x,v){let k=null,E=!1;for(let C of e){if(E){E=!1;continue}if(C==="\\"){E=!0;continue}if(k){if(C===k)k=null;continue}if(C==="'"||C==='"'||C==="`"){k=C;continue}if(C===o)v++;else if(C===x)v--}return v}function Ef(e,o){let x=e[o].trim(),v=uc(x),k=v?[x,v.type,v.name,v.value]:null;if(!k){let F=x.match(/^(?:export\s+)?(const|let|var)\s+/);if(F){let U=x.slice(F[0].length),Z=o;if(U.startsWith("{")||U.startsWith("[")){let Q=U[0],se=Q==="{"?"}":"]",oe=_f(U,Q,se,0),ie=U;for(let ce=o+1;ce<e.length&&oe>0;ce++)ie+=` ${e[ce].trim()}`,Z=ce,oe=_f(e[ce],Q,se,oe);if(oe>0)ie=U,Z=o;U=ie}let Y=Af(U,0);if(Y){let Q=F[1],se=Y.pattern,oe=U.slice(Y.endPos).trim();if(oe.startsWith("=")){let ie=oe.slice(1).trim(),ce=ie,ae=Math.max(Z,o);if(kf(ie)){let Se=Cf(e,ae,ie);ce=Se.value,ae=Se.nextIndex}else ae=ae+1;ce=ce.trim().replace(/;$/,"");let pe=Tf(se),me=`__stx_src_${o}`,he=pe.map((Se)=>`module.exports.${Se} = ${Se};`).join(`
2638
+ `);return{type:Q,name:me,value:`${ce}; ${Q} ${se} = ${me};
2639
+ ${he}`,nextIndex:ae}}}}throw Error(`Failed to parse variable declaration: ${x}`)}let[,E,C,j]=k,L=j,B=o;if(kf(j)){let F=Cf(e,o,j);L=F.value,B=F.nextIndex}else B=o+1;while(B<e.length){let F=e[B].trim();if(F.startsWith(".")||F.startsWith("?."))L+=`
2640
+ ${e[B]}`,B++;else break}return L=L.trim().replace(/;$/,""),{type:E,name:C,value:L,nextIndex:B}}function Bc(e,o){let x=e[o].trim(),v=x.match(/^(?:export\s+)?(?:async\s+)?function\s+(\w+)/);if(!v)throw Error(`Failed to parse function declaration: ${x}`);let[,k]=v,E=x.replace(/^export\s+/,""),C=o;if(Ub(x)){let j=Hb(e,o,E);E=j.functionCode,C=j.nextIndex}else C=o+1;return{name:k,functionCode:E,nextIndex:C}}function kf(e){let o=e.trim();if(o.startsWith("{"))return w(o,"{","}",0)===-1;if(o.startsWith("["))return w(o,"[","]",0)===-1;return!If(o)}function If(e){let o={paren:0,bracket:0,brace:0},x=null,v=0;for(let k=0;k<e.length;k++){let E=e[k];if((k>0?e[k-1]:"")==="\\"&&x)continue;if((E==='"'||E==="'")&&!x){x=E;continue}if(E===x&&x!=="`"){x=null;continue}if(E==="`"&&!x){x="`";continue}if(E==="`"&&x==="`"&&v===0){x=null;continue}if(x==="`"&&E==="$"&&e[k+1]==="{"){v++,k++;continue}if(v>0&&E==="{"){v++;continue}if(v>0&&E==="}"){v--;continue}if(x)continue;if(E==="(")o.paren++;else if(E===")")o.paren--;else if(E==="[")o.bracket++;else if(E==="]")o.bracket--;else if(E==="{")o.brace++;else if(E==="}")o.brace--}return o.paren===0&&o.bracket===0&&o.brace===0&&x===null}function Df(e){let o=e.indexOf("(");if(o===-1)return e.indexOf("{");let x=w(e,"(",")",o);if(x===-1)return-1;return e.indexOf("{",x)}function Ub(e){let o=Df(e);if(o===-1)return!0;return w(e,"{","}",o)===-1}function Cf(e,o,x){let v=x,k=o+1;while(k<e.length&&!If(v)){let E=e[k];v+=`
2641
+ ${E}`,k++}while(k<e.length){let E=e[k].trim();if(E.startsWith(".")||E.startsWith("?."))v+=`
2642
+ ${e[k]}`,k++;else break}return{value:v,nextIndex:k}}function Hb(e,o,x){let v=x,k=o+1;while(k<e.length){let E=Df(v);if(E!==-1){if(w(v,"{","}",E)!==-1)break}let C=e[k];v+=`
2643
+ ${C}`,k++}return{functionCode:v,nextIndex:k}}function Rf(e,o){let x=c(e,o)??c(`(${e})`,o);if(x!==void 0)return x;if(!/\bprocess\b/.test(e))return;let v={...o,process:Object.freeze({env:{...Pr.env}})},k=Object.keys(v).filter(Ze),E=k.map((C)=>v[C]);try{return Function(...k,`'use strict'; return (${e});`)(...E)}catch{try{return Function(...k,`'use strict'; return ${e};`)(...E)}catch{return}}}async function qb(e,o,x){let v=e.matchAll(/export\s+(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:export\s+|$))/g);for(let E of v){let[,,C,j]=E;try{let L=j.trim().replace(/;$/,""),B=Rf(L,o);if(B!==void 0)o[C]=B}catch(L){console.warn(`Failed to parse export ${C} in fallback:`,L)}}let k=e.matchAll(/(?:^|\n)\s*(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:(?:const|let|var|function|export)\s+|$))/g);for(let E of k){let[,,C,j]=E;if(!(C in o))try{let L=j.trim().replace(/;$/,""),B=Rf(L,o);if(B!==void 0)o[C]=B}catch{}}}function qi(e){let o=e.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),x=o?o[1]:"",v=o?e.replace(/<script\b[^>]*>[\s\S]*?<\/script>/i,""):e;return{scriptContent:x,templateWithoutScript:v}}function Xi(e){let o=e.trim();if(!o)return!1;return/(?:const|let|var|function)\s+\w+/.test(o)}var Ws=new z(500),vo=new z(1000),zf=33554432,Wc=zf;function Xb(e){let o=e.componentRenderCacheBytes;if(typeof o!=="number"||o<0||o===Wc)return;Wc=o,wo.setMaxBytes(o)}var wo=new z(2000,{maxBytes:zf,sizeOf:(e)=>e.output.length});function Kb(e){let o=new WeakSet;try{let x=(v)=>{if(v===void 0)return{__stxType:"undefined"};if(typeof v==="bigint")return{__stxType:"bigint",value:v.toString()};if(typeof v==="function"||typeof v==="symbol")throw TypeError("Non-serializable component input");if(v===null||typeof v!=="object")return v;if(o.has(v))throw TypeError("Circular component input");if(o.add(v),v instanceof Date)return{__stxType:"date",value:v.toISOString()};if(Array.isArray(v))return v.map(x);let k={};for(let E of Object.keys(v).sort())k[E]=x(v[E]);return k};return JSON.stringify(x(e))}catch{return null}}function Pf(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function bc(e){return/\bjs\b/.test(e)||/\blang\s*=\s*["']?(js|javascript)["']?/i.test(e)}function Ve(e){return!bc(e)}var ho=new Map;function N(e){let o;try{o=JSON.stringify(e)}catch{return new Bun.Transpiler(e)}let x=ho.get(o);if(x)return x;if(ho.size>=16)ho.clear();let v=new Bun.Transpiler(e);return ho.set(o,v),v}var Mf=new WeakMap,Zb=256;function Ue(e){try{let o=N({loader:"ts",target:"browser",define:y()}),x=Mf.get(o);if(!x)x=new Map,Mf.set(o,x);let v=x.get(e);if(v!==void 0)return v;let k=e.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");k=k.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");let E=[];k=k.replace(/\{!![\s\S]*?!!\}/g,(j)=>{let L=E.length;return E.push(j),`"__STX_EXPR_${L}__"`}),k=k.replace(/\{\{\{[\s\S]*?\}\}\}/g,(j)=>{let L=E.length;return E.push(j),`"__STX_EXPR_${L}__"`}),k=k.replace(/\{\{[\s\S]*?\}\}/g,(j)=>{let L=E.length;return E.push(j),`"__STX_EXPR_${L}__"`});let C=o.transformSync(k);for(let j=0;j<E.length;j++)C=C.replace(`"__STX_EXPR_${j}__"`,E[j]),C=C.replace(`'__STX_EXPR_${j}__'`,E[j]);if(x.size>=Zb){let j=x.keys().next();if(!j.done)x.delete(j.value)}return x.set(e,C),C}catch(o){if(process.env.STX_DEBUG_TS)console.warn("[STX] TypeScript transpilation error:",o);return e}}function Jb(e){let o=[],x=new Set,v=0,k=0,E=e.length,C=(F)=>{k++;while(k<E){if(e[k]==="\\"){k+=2;continue}if(e[k]===F){k++;return}k++}},j=()=>{k++;while(k<E){if(e[k]==="\\"){k+=2;continue}if(e[k]==="`"){k++;return}if(e[k]==="$"&&e[k+1]==="{"){k+=2;let F=1;while(k<E&&F>0)if(e[k]==="{")F++,k++;else if(e[k]==="}")F--,k++;else if(e[k]==="'"||e[k]==='"')C(e[k]);else if(e[k]==="`")j();else k++;continue}k++}},L=()=>{if(e[k]==="/"&&e[k+1]==="/"){while(k<E&&e[k]!==`
2644
+ `)k++;return!0}if(e[k]==="/"&&e[k+1]==="*"){k+=2;while(k<E-1&&!(e[k]==="*"&&e[k+1]==="/"))k++;return k+=2,!0}return!1},B=()=>{if(v!==0)return;let F=e.slice(k).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(F){let Q=F[2].split(",").map((se)=>{let oe=se.trim().split(":");return oe[oe.length-1].trim()});for(let se of Q)if(se&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(se)&&!x.has(se))o.push(se),x.add(se);return}let U=e.slice(k).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(U){let Q=U[2];if(!x.has(Q))o.push(Q),x.add(Q);return}let Z=e.slice(k).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(Z){let Q=Z[1];if(!x.has(Q))o.push(Q),x.add(Q);return}let Y=e.slice(k).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(Y){let Q=Y[1];if(!x.has(Q))o.push(Q),x.add(Q)}};while(k<E){if(L())continue;if(e[k]==="'"||e[k]==='"'){C(e[k]);continue}if(e[k]==="`"){j();continue}if(e[k]==="{"){v++,k++;continue}if(e[k]==="}"){v--,k++;continue}if(v===0&&/[a-z]/i.test(e[k])&&(k===0||/\s|[;{}()]/.test(e[k-1])))B();k++}return o}function Gb(e){let o=[],x=0,v=0,k=null;for(let E=0;E<e.length;E++){let C=e[E];if(k){if(C==="\\"){E++;continue}if(C===k)k=null;continue}if(C==='"'||C==="'"||C==="`"){k=C;continue}if(C==="("||C==="["||C==="{")x++;else if(C===")"||C==="]"||C==="}")x--;else if(C===","&&x===0)o.push(e.slice(v,E)),v=E+1}if(v<e.length)o.push(e.slice(v));return o}function Yb(e){let o=0,x=null;for(let v=0;v<e.length;v++){let k=e[v];if(x){if(k==="\\"){v++;continue}if(k===x)x=null;continue}if(k==='"'||k==="'"||k==="`"){x=k;continue}if(k==="("||k==="["||k==="{")o++;else if(k===")"||k==="]"||k==="}")o--;else if(k==="="&&o===0){let E=e[v-1],C=e[v+1];if(E==="!"||E==="<"||E===">"||E==="=")continue;if(C==="="||C===">")continue;return v}}return-1}function Qb(e,o){try{let x=/=\s*(?:withDefaults\s*\([\s\S]*?defineProps|defineProps)\b/.exec(e);if(!x)return;let v=x.index-1;while(v>=0&&/\s/.test(e[v]))v--;if(e[v]!=="}")return;let k=v,E=0,C=-1;for(;v>=0;v--){let L=e[v];if(L==="}")E++;else if(L==="{"){if(E--,E===0){C=v;break}}}if(C===-1)return;let j=e.slice(C+1,k);for(let L of Gb(j)){let B=L.trim();if(!B||B.startsWith("..."))continue;let F=Yb(B);if(F===-1)continue;let U=B.slice(0,F).trim();if(!/^[A-Z_$][\w$]*$/i.test(U))continue;if(o[U]!==void 0)continue;let Z=B.slice(F+1).trim();if(!Z)continue;try{let Y=Object.keys(o).filter(Ze),Q=Function(...Y,`"use strict"; return (${Z});`);o[U]=Q(...Y.map((se)=>o[se]))}catch{}}}catch{}}var ev=new Set(["tr","td","th","thead","tbody","tfoot","caption","colgroup","col","option","optgroup","li","dt","dd"]);function vc(e,o){let x=e.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)<([a-zA-Z][a-zA-Z0-9-]*)/s);if(!x)return null;let v=x[2].toLowerCase();if(!ev.has(v))return null;if((e.match(new RegExp(`<${v}(?=[\\s/>])`,"gi"))??[]).length!==1)return null;if(!new RegExp(`</${v}>\\s*$`,"i").test(e))return null;let E=x[0].length;return e.slice(0,E)+o+e.slice(E)}async function qn(e,o,x,v,k){let E=e.endsWith(".stx")?e.slice(0,-4):e,C=(ie)=>ie.split("-").map((ce)=>ce.charAt(0).toUpperCase()+ce.slice(1)).join(""),j=(ie)=>ie.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),L=x.__importedComponents;if(L){for(let ie of[E,E.toLowerCase(),C(E),j(E)])if(L.has(ie))return!0}let B=[...new Set([`${E}.stx`,`${C(E)}.stx`,`${j(E)}.stx`])],F=typeof k.root==="string"?Ye.resolve(k.root):void 0,U=F??Ye.dirname(v),Z=[],Y=(ie)=>{if(ie&&!Z.includes(ie))Z.push(ie)},Q=x.__originalFilePath;if(Q)Y(Ye.join(Ye.dirname(Q),"components"));if(Y(o),Y(k._rootComponentsDir),Y(Ye.join(Ye.dirname(v),"components")),Y(k.componentsDir),F)Y(Ye.resolve(F,"resources/views/components")),Y(Ye.resolve(F,"resources/components")),Y(Ye.resolve(F,"src/components")),Y(Ye.resolve(F,"components"));for(let ie of k._layerComponentDirs??[])Y(ie);let se=k._pluginComponentDirs;if(Array.isArray(se))for(let ie of se)Y(typeof ie==="string"?ie:null);if(Y(k.fallbackComponentsDir),E.startsWith("./")||E.startsWith("../"))return n(Ye.resolve(Ye.dirname(v),`${E}.stx`));let oe=Of(Ye.resolve(import.meta.dir,"components"));for(let ie of Z){let ce=Ye.isAbsolute(ie)?ie:Ye.resolve(U,ie);if(Of(ce)===oe)continue;for(let ae of B)if(await n(Ye.join(ce,ae)))return!0}return!1}function Of(e){try{return Bf.realpathSync(e)}catch{return e}}function wc(e){return e==="visible"||e==="idle"||e==="interaction"||e.startsWith("media:")}function so(e){if(!e)return!1;let o=e.replace(/<script[\s\S]*?<\/script>/gi,"").replace(/<style[\s\S]*?<\/style>/gi,"");return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(o)}function tv(e,o,x){if(!e.includes("{{")&&!e.includes("{!!"))return e;let v=(k,E)=>{let C;try{C=b(k,o)}catch{return E}if(C===void 0||C===null)return"";let j=String(C);if(/<\/style/i.test(j))return console.warn(`[stx] a <style> expression in ${x??"<unknown>"} evaluated to CSS containing a closing style tag, which would end the element early, so it was dropped rather than emitted.`),"";return j};return e.replace(/\{!!([\s\S]*?)!!\}/g,(k,E)=>v(E,k)).replace(/\{\{([\s\S]*?)\}\}/g,(k,E)=>v(E,k))}var Nf=new Set;function jf(e,o,x,v){let k=`${e}\x00${o}\x00${v??""}`;if(!process.env.STX_DEBUG&&Nf.has(k))return;Nf.add(k);let E=o?` used in ${o}`:"",C=v?` Cause: ${v}.`:"",j=x.length>0?`
2645
+ searched:
2646
+ ${x.map((L)=>` - ${L}`).join(`
2647
+ `)}`:"";console.error(`[stx] component <${e}> could not be resolved${E}, so it rendered as nothing.${C}${j}`)}function Lf(e){return`<!-- stx: component "${e.replace(/--+/g,"-")}" could not be resolved; see the server log -->`}function xc(e){let o=new Set,x=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal|useModel|useReactiveProp|useLocalStorage|useSessionStorage|keptState|useCookie|useDebouncedValue)\s*(?:<[^>]*>)?\s*\(/g;for(let v of e){let k;while((k=x.exec(v))!==null)o.add(k[1]);x.lastIndex=0}return[...o]}async function We(e,o,x,v,k,E,C,j=new Set,L){let{extractVariables:B}=await lt("stx/variable-extractor",()=>import("./chunk-w72qx0eb.js")),F=j??new Set;if(F.has(e))return`[Circular component reference: ${e}]`;let U=new Set(F);U.add(e);let Z=typeof o.client==="string"?o.client.trim():"";if("client"in o)delete o.client;let Y=Z&&Z!=="load"&&wc(Z)?Z:"";try{let Q=(et)=>et.split("-").map((it)=>it.charAt(0).toUpperCase()+it.slice(1)).join(""),se=(et)=>et.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),oe=e.endsWith(".stx")?e.slice(0,-4):e,ie=null,ce=k.__importedComponents;if(ce){let et=[oe,oe.toLowerCase(),Q(oe),se(oe)];for(let it of et)if(ce.has(it)){ie=ce.get(it);break}}let ae=[];if(!ie){let et=[`${oe}.stx`,`${Q(oe)}.stx`,`${se(oe)}.stx`],it=[...new Set(et)],Tt=k.__originalFilePath,ut=[];if(ut.push(...C._layerComponentDirs??[]),Tt){let Vt=Ye.join(Ye.dirname(Tt),"components");ut.push(Vt)}if(v)ut.push(v);let Wt=C._rootComponentsDir;if(typeof Wt==="string"&&!ut.includes(Wt))ut.push(Wt);let Ot=Ye.join(Ye.dirname(E),"components");if(!ut.includes(Ot))ut.push(Ot);if(C.componentsDir&&C.componentsDir!==v&&!ut.includes(C.componentsDir))ut.push(C.componentsDir);let en=typeof C.root==="string"?Ye.resolve(C.root):void 0,Tn=en??Ye.dirname(E),ct=[];if(en)ct.push(Ye.resolve(en,"resources/views/components")),ct.push(Ye.resolve(en,"resources/components")),ct.push(Ye.resolve(en,"src/components")),ct.push(Ye.resolve(en,"components"));ct.push(Ye.resolve(import.meta.dir,"components"));for(let Vt of ct)if(!ut.includes(Vt))ut.push(Vt);let yn=C._pluginComponentDirs;if(Array.isArray(yn)){for(let Vt of yn)if(typeof Vt==="string"&&!ut.includes(Vt))ut.push(Vt)}if(C.fallbackComponentsDir&&!ut.includes(C.fallbackComponentsDir))ut.push(C.fallbackComponentsDir);let hr=[...new Set(ut.map((Vt)=>{if(!Vt)return Vt;return Ye.isAbsolute(Vt)?Vt:Ye.resolve(Tn,Vt)}))];ut.length=0,ut.push(...hr);let yr=`${oe}\x00${E}\x00${hr.join("\x00")}`,Ao=vo.get(yr);if(Ao)if(await n(Ao))ie=Ao;else vo.delete(yr);if(!ie&&(oe.startsWith("./")||oe.startsWith("../")))ie=Ye.resolve(Ye.dirname(E),`${oe}.stx`),ae.push(ie);else if(!ie)for(let Vt of ut){if(!Vt)continue;for(let Us of it){let Hs=Ye.join(Vt,Us);if(ae.push(Hs),await n(Hs)){ie=Hs;break}}if(ie)break;if(!ie)try{let Us=await import("fs");if(!Us.statSync(Vt,{throwIfNoEntry:!1})?.isDirectory())continue;let Uf=8,Io=[{path:Vt,depth:0}];while(Io.length>0&&!ie){let qs=Io.pop();if(qs.depth>=Uf)continue;let Vc;try{Vc=Us.readdirSync(qs.path,{withFileTypes:!0})}catch{continue}for(let Xs of Vc){if(!Xs.isDirectory())continue;if(Xs.name==="node_modules"||Xs.name.startsWith("."))continue;let Uc=Ye.join(qs.path,Xs.name);for(let Hf of it){let Do=Ye.join(Uc,Hf);if(ae.push(Do),await n(Do)){ie=Do;break}}if(ie)break;Io.push({path:Uc,depth:qs.depth+1})}}}catch{}if(ie)break}if(ie)vo.set(yr,ie)}if(!ie||!await n(ie))return jf(e,E,ae),Lf(e);L.add(ie);let pe;if(Ws.has(ie))pe=Ws.get(ie);else try{pe=await Bun.file(ie).text(),Ws.set(ie,pe)}catch(et){let it=et instanceof Error?et.message:String(et);return jf(e,E,[ie],it),Lf(e)}let me=new Set(["__originalFilePath","__importedComponents",Zs,"__stx_client_signal_names","__stx_runtime_config","__stxServeContext","__stx_scope_seq"]),he={};for(let[et,it]of Object.entries(k))if(!et.startsWith("__")||me.has(et))he[et]=it;let Se=x;if(x.includes("@include")){let{processIncludes:et}=await lt("stx/includes",()=>import("./chunk-0pnj3zt2.js"));Se=await et(x,k,E,C,L)}if(/<[A-Z][\w.-]*[\s/>]/.test(Se)){let{processComponents:et}=await lt("stx/component-renderer",()=>import("./chunk-hk1mj4tz.js"));Se=await et(Se,{...k,__processedComponents:F},E,C,L)}let Ee=[];if(so(Se)){let{processExpressions:et}=await lt("stx/expressions",()=>import("./chunk-z8xn5ta3.js")),it=k.__stx_signals_gate===void 0?{...k,__stx_signals_gate:!0}:k;Se=et(Se,it,E);for(let Tt of Se.matchAll(/\{\{([\s\S]*?)\}\}/g))Ee.push(Tt[1].trim())}let Ce=V(Se),Re=[],Ae=Ce.output.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(et,it)=>{let Tt=Ce.scripts[Number(it)]||"",ut=Tt.match(/^<script\b([^>]*)>/i)?.[1]||"",Wt=ut.match(/\btype\s*=\s*["']([^"']+)["']/i)?.[1]?.toLowerCase(),Ot=!Wt||["module","text/javascript","application/javascript"].includes(Wt);if(!/\bserver\b/i.test(ut)&&Ot)return Re.push(Tt),"";return Tt}),{extractSlotContent:_e}=await lt("stx/slots",()=>import("./chunk-nppdrf0x.js")),Te=_e(Ae),Me={};if(Te.defaultSlot?.trim())Me.default=Te.defaultSlot;for(let[et,it]of Te.namedSlots)Me[et]=it.content;let De=k.__stx_scope_seq??={n:0,key:Bun.hash(String(k.__filename??E)).toString(36).slice(0,6)},Ie=`stx_${oe.replace(/[^a-zA-Z0-9]/g,"_")}_${++De.n}_${De.key}`,Oe={...he,$uid:Ie,...o,props:o,slot:Ae,$slots:Me,__processedComponents:U,__sections:{},__stx_signals_gate:be(pe)||so(x),__stx_preserved_client_expressions:[...Array.isArray(k.__stx_preserved_client_expressions)?k.__stx_preserved_client_expressions:[],...Ee]};Qb(pe,Oe);let tt=pe,ot=ee(tt);if(ot)tt=ot.content.trim();let nt=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,yt=[...pe.matchAll(nt)],dt=[],ht=null,at=yt.some((et)=>/\bserver\b/.test(et[1]||"")&&/\bcache\b/.test(et[1]||"")),Pt=null,pt=null,Lt=null,Sn=0,fn=null;if(Xb(C),at&&Wc>0){let et=Kb({props:o,slot:x,buildMode:C.buildMode??"",skipEventDirectives:C.skipEventDirectives===!0,layers:C._layerGraph?.layers.map((it)=>it.configFile),uid:Ie});if(et!==null){Pt=`${ie}\x00${D(pe)}\x00${et}`;let it=wo.get(Pt);if(it){for(let Tt of it.dependencies)L.add(Tt);if(sl(k,it.clientFactories),De.n+=it.uidsConsumed,it.preservedClientExpressions.length>0){let Tt=new Set(Array.isArray(k.__stx_preserved_client_expressions)?k.__stx_preserved_client_expressions:[]);for(let ut of it.preservedClientExpressions)Tt.add(ut);k.__stx_preserved_client_expressions=[...Tt]}return it.output}pt=new Set(L),Lt=nl(k),Sn=De.n,fn=new Set(Array.isArray(k.__stx_preserved_client_expressions)?k.__stx_preserved_client_expressions:[])}}let _n=new Set;for(let et of yt){let it=et[1]||"",Tt=et[2]||"",ut=it.includes("server");if(Ve(it)&&Tt.trim())Tt=Ue(Tt);if(ut&&Tt){for(let Ot of te(Tt))_n.add(Ot);try{await B(Tt,Oe,ie,{onFailure:(Ot)=>{if(Ot.kind!=="unknown")ht=Ot.kind}})}catch(Ot){}}if(!ut){let Ot=Tt.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),en=Ot.includes("{{")&&Ot.includes("}}"),Tn=Ot.includes("{!!")&&Ot.includes("!!}");if(en||Tn)Ot=Yr(Ot,Oe,ie);let ct=it.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");dt.push(`<script${ct}>${Ot}</script>`)}}let st=V(pe).output.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),ft=st?st[1]:"",Xt=st?st[2]:"",Mt="",nn=ft&&/\bscoped\b/i.test(ft);if(st)Mt=`<style${ft}>${tv(Xt,Oe,ie)}</style>`;let jt=tt;if(jt=jt.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),st)jt=jt.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let et=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,it=[];if(jt=jt.replace(et,(Tt,ut)=>{let Wt=ut.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(Wt)it.push(`<style${Wt[1]}>${Wt[2]}</style>`);return""}),jt=jt.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),it.length>0)Mt=`${Mt}${it.join(`
2648
+ `)}`}if(x&&jt.includes("{{ text || slot }}"))jt=jt.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>x);let{applySlots:So}=await lt("stx/slots",()=>import("./chunk-nppdrf0x.js")),{defaultSlot:_o,namedSlots:Ro}=Te,Pe=dt.some((et)=>/\b(?:state|derived|effect|ref|useRef|reactive|computed|watch|watchEffect|useModel|useReactiveProp|onMount|onDestroy|defineProps|withDefaults|defineEmits|defineExpose|defineSlots)\s*(?:<[^<>()]*>)?\s*\(/.test(et)),Ge=(et)=>Pe?Bp(et,Ie):et,rt=new Map([...Ro].map(([et,it])=>[et,{...it,content:Ge(it.content)}]));jt=await So(jt,Ge(_o),rt,Oe);let gt=xc(dt),Dt=(Array.isArray(Oe.__stx_client_signal_names)?Oe.__stx_client_signal_names:[]).filter((et)=>!_n.has(et));if(gt.length>0||Dt.length>0)Oe.__stx_client_signal_names=[...new Set([...Dt,...gt])];else delete Oe.__stx_client_signal_names;let Kt={...C,_rootComponentsDir:C._rootComponentsDir||C.componentsDir,componentsDir:Ye.dirname(ie),skipSignalsRuntime:!0,skipEventDirectives:Pe||dt.length===0,defaultLayout:void 0};Oe.__stxProcessingDepth=(k.__stxProcessingDepth||0)+1;let En=await r(jt,Oe,ie,Kt,L),Vs=new Set(Array.isArray(k.__stx_preserved_client_expressions)?k.__stx_preserved_client_expressions:[]);for(let et of En.matchAll(/\{\{([\s\S]*?)\}\}/g))Vs.add(et[1].trim());if(Vs.size>0)k.__stx_preserved_client_expressions=[...Vs];let An=Ie,Jt=En;if(Pe){let et="";if(Object.keys(o).length>0)try{et=` data-stx-props="${Pf(JSON.stringify(o))}"`}catch{}let it=Y?` stx-hydrate="${Pf(Y)}"`:"",Tt=` data-stx-scope="${An}"${et}${it}`;Jt=vc(En,Tt)??`<div${Tt}>${En}</div>`;let ut=await Promise.all(dt.map(async(Wt)=>{let Ot=Wt.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!Ot)return Wt;let[,en,Tn]=Ot,{vendorStyleTags:ct,factoryBody:yn}=await sv(Tn,ie,C.buildMode==="compile"),hr=Y?null:No(k,yn),yr=hr?`window.__stxComponentFactories[${JSON.stringify(hr)}](${JSON.stringify(An)});`:`(${yn})(${JSON.stringify(An)});`;if(Y)return`${ct}<script type="stx/island" data-stx-island="${An}" data-stx-scoped data-stx-owner="${An}"${en}>${yr}</script>`;return`${ct}<script data-stx-scoped data-stx-run="always" data-stx-owner="${An}"${en}>${yr}</script>`}));if(Jt=Jt+`
2649
+ `+ut.join(`
2650
+ `),Mt)Jt+=`
2651
+ `+Mt}else{if(Mt)Jt+=`
2652
+ `+Mt;if(dt.length>0){let et=Oe.__stx_event_bindings||[],it=Le(Oe),Tt=await Promise.all(dt.map(async(ut)=>{let Wt=ut.match(/<script\b[^>]*>([\s\S]*?)<\/script>/);if(!Wt)return ut;return await ye(Wt[1],{eventBindings:et,templateContent:Jt,filePath:ie,projectRoot:process.cwd(),serverData:it,instanceId:Ie})}));Jt+=`
2653
+ `+Tt.join(`
2654
+ `),Oe.__stx_event_bindings=[]}}if(nn){let et=Zn(Jt,ie);if(et.hasScoped)Jt=et.html}if(Pt&&pt){let et=Array.isArray(k.__stx_preserved_client_expressions)?k.__stx_preserved_client_expressions:[];wo.set(Pt,{output:Jt,dependencies:[...L].filter((it)=>!pt.has(it)),clientFactories:Lt?rl(k,Lt):[],uidsConsumed:De.n-Sn,preservedClientExpressions:fn?et.filter((it)=>!fn.has(it)):[]})}if(ht)Jt=`<!--stx-render-failed:${ht}-->${Jt}`;return Re.length>0?`${Jt}
2655
+ ${Re.join(`
2656
+ `)}`:Jt}catch(Q){return`[Error processing component: ${Q instanceof Error?Q.message:String(Q)}]`}finally{F.delete(e)}}async function n(e){return Bun.file(e).exists()}function Fc(e,o){let x=Ye.resolve(o),v=Ye.resolve(e),k=x.endsWith(Ye.sep)?x:x+Ye.sep;if(v===x||v.startsWith(k))return v;return null}async function nv(e,o,x,v){let k=o.startsWith("layouts/")?o.slice(8):o,E=Ye.join(e,k);for(let C of E.endsWith(".stx")?[E]:[E,`${E}.stx`])if(await n(C)){if(v)console.log(`Found layout in ${e}: ${C}`);return x?.add(C),C}return null}async function Xn(e,o,x,v){let k=await rv(e,o,x,v);if(k===null)return null;let E=Fc(k,process.cwd());if(E)return E;let C=[x.root,x.layoutsDir,x.fallbackLayoutsDir,x.componentsDir,x.partialsDir,x.pagesDir,...x._layerLayoutDirs??[]].filter((j)=>typeof j==="string"&&j.length>0);for(let j of C){let L=Ye.isAbsolute(j)?j:Ye.resolve(process.cwd(),j);if(Fc(k,L))return Ye.resolve(k)}return console.warn(`[stx] rejected resolved template path that escapes project root: ${k} (template: ${e}, from: ${o})`),null}async function rv(e,o,x,v){if(x.debug)console.log(`Resolving template path: ${e} from ${o}`);let k=Ye.dirname(o),E=process.cwd();if(e.startsWith("/")){let Z=Ye.join(E,e),Y=Fc(Z,E);if(!Y)return console.warn(`[stx] rejected template path that escapes project root: ${e} (from ${o})`),null;if(x.debug)console.log(`Checking absolute path: ${Y}`);if(await n(Y)&&v)v.add(Y);return Y}let C=Ye.join(k,e);if(await n(C)){if(x.debug)console.log(`Found direct path: ${C}`);if(v)v.add(C);return C}if(!e.endsWith(".stx")&&!e.endsWith(".jsx")&&!e.endsWith(".tsx"))for(let Z of[".stx",".tsx",".jsx"]){let Y=`${C}${Z}`;if(await n(Y)){if(x.debug)console.log(`Found direct path with extension: ${Y}`);if(v)v.add(Y);return Y}}let j=[];if(j.push(...x._layerLayoutDirs??[]),x.layoutsDir)j.push(Ye.isAbsolute(x.layoutsDir)?x.layoutsDir:Ye.resolve(process.cwd(),x.layoutsDir));let L=Ye.resolve(k),B=process.cwd();for(let Z=0;Z<10;Z++){let Y=Ye.join(L,"layouts"),Q=!1;try{Q=Bf.statSync(Y,{throwIfNoEntry:!1})?.isDirectory()??!1}catch{}if(Q){j.push(Y);break}let se=Ye.dirname(L);if(se===L||se.length<B.length)break;L=se}for(let Z of j){let Y=await nv(Z,e,v,x.debug);if(Y)return Y}if(x.fallbackLayoutsDir){let Z=Ye.isAbsolute(x.fallbackLayoutsDir)?x.fallbackLayoutsDir:Ye.resolve(process.cwd(),x.fallbackLayoutsDir),Y=e.startsWith("layouts/")?e.slice(8):e,Q=[Ye.join(Z,Y)];if(!e.endsWith(".stx"))Q.push(`${Q[0]}.stx`);for(let se of Q)if(await n(se)){if(x.debug)console.log(`Found in options.fallbackLayoutsDir: ${se}`);if(v)v.add(se);return se}}if(e.startsWith("layouts/")||e.includes("/layouts/")){let Z=e.split("layouts/"),Y=Ye.join(x.partialsDir||k,"layouts",Z[1]);if(await n(Y)){if(x.debug)console.log(`Found in layouts path: ${Y}`);if(v)v.add(Y);return Y}if(!Y.endsWith(".stx")){let Q=`${Y}.stx`;if(await n(Q)){if(x.debug)console.log(`Found in layouts path with extension: ${Q}`);if(v)v.add(Q);return Q}}}if(x.partialsDir){let Z=Ye.join(x.partialsDir,"layouts");if(await n(Z)){let Y=Ye.join(Z,e);if(await n(Y)){if(x.debug)console.log(`Found in partials layouts dir: ${Y}`);if(v)v.add(Y);return Y}if(!e.endsWith(".stx")){let Q=`${Y}.stx`;if(await n(Q)){if(x.debug)console.log(`Found in partials layouts dir with extension: ${Q}`);if(v)v.add(Q);return Q}}}}let F=x.partialsDir||Ye.join(process.cwd(),"views"),U=Ye.join(F,e);if(await n(U)){if(x.debug)console.log(`Found in views path: ${U}`);if(v)v.add(U);return U}if(!e.endsWith(".stx")){let Z=`${U}.stx`;if(await n(Z)){if(x.debug)console.log(`Found in views path with extension: ${Z}`);if(v)v.add(Z);return Z}}if(k.includes("temp")){let Z=Ye.join(Ye.dirname(k),"layouts",e);if(await n(Z)){if(x.debug)console.log(`Found in temp layouts dir: ${Z}`);if(v)v.add(Z);return Z}if(!e.endsWith(".stx")){let Y=`${Z}.stx`;if(await n(Y)){if(x.debug)console.log(`Found in temp layouts dir with extension: ${Y}`);if(v)v.add(Y);return Y}}}if(x.debug)console.warn(`Template not found after trying all paths: ${e} (referenced from ${o})`);else console.warn(`Template not found: ${e} (referenced from ${o})`);return null}function io(e,o,x){let v=0,k="",E="";try{if(typeof o==="number"&&o>=0){let C=e.split(`
2657
+ `),j=0;for(let L=0;L<C.length;L++)if(j+=C[L].length+1,j>=o){v=L+1,k=C[L].trim();let B=Math.max(0,L-2),F=Math.min(C.length,L+3);E=C.slice(B,F).map((U,Z)=>{let Y=B+Z+1;return`${Y===v?"> ":" "}${Y}: ${U}`}).join(`
2658
+ `);break}}else if(x){let C=e.indexOf(x);if(C>=0)return io(e,C)}}catch{}return{lineNumber:v,lineContent:k,context:E}}var mt={reset:"\x1B[0m",bold:"\x1B[1m",dim:"\x1B[2m",red:"\x1B[31m",yellow:"\x1B[33m",blue:"\x1B[34m",cyan:"\x1B[36m",gray:"\x1B[90m",bgRed:"\x1B[41m",bgYellow:"\x1B[43m"};function g(e,o,x,v,k,E){let{lineNumber:C,context:j}=io(v,k,E),L=x.split("/").pop(),B=0;if(typeof k==="number"&&k>=0&&v){let U=v.lastIndexOf(`
2659
+ `,Math.max(0,k-1));B=k-(U+1)+1}let F="";if(C>0)F+=`
2660
+ ${x}:${C}${B>0?`:${B}`:""}: ${e.toLowerCase()} error: ${o}
2661
+ `;if(F+=`
2662
+ ${mt.bold}${mt.red}\u256D\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256E${mt.reset}
2663
+ `,F+=`${mt.bold}${mt.red}\u2502${mt.reset} ${mt.bold}${mt.bgRed} ERROR ${mt.reset} ${mt.red}${e} Error${mt.reset}${" ".repeat(Math.max(0,43-e.length))}${mt.bold}${mt.red}\u2502${mt.reset}
2664
+ `,F+=`${mt.bold}${mt.red}\u2570\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256F${mt.reset}
2665
+ `,F+=`
2666
+ ${mt.cyan}${mt.bold}File:${mt.reset} ${mt.dim}${L}${mt.reset}`,C>0)F+=` ${mt.gray}(line ${C}${B>0?`, col ${B}`:""})${mt.reset}`;if(F+=`
2667
+ ${mt.yellow}${mt.bold}Message:${mt.reset} ${o}
2668
+ `,j)F+=`
2669
+ ${mt.blue}${mt.bold}Context:${mt.reset}
2670
+ ${mt.dim}${j}${mt.reset}
2671
+ `;return F}function K(){Ws.clear(),vo.clear(),wo.clear()}function ju(){return{size:Ws.size,maxSize:500}}var zc=P(128);async function sv(e,o,x){let v=D(e,o,x),k=zc.get(v);if(k){if(kt(k.deps))return k;zc.delete(v)}let E=Xr(e,{filePath:o,projectRoot:process.cwd()}),C=E.code,j=Kr(E.styles);C=bt(C).code;let{hasUserImports:L,bundleClientScript:B}=await lt("stx/client-script-bundler",()=>import("./chunk-hn9pkyv8.js")),F=[],U=!1;if(L(C)){let ie=C;C=await B(ie,o,{projectRoot:process.cwd(),minify:x,collectInputs:F}),U=C===ie}let{stripStxRuntimeImports:Z}=await lt("stx/signal-processing",()=>import("./chunk-xwzvfqcb.js"));C=Z(C);let Y=R(C),Q=Jb(Y),se=`function(__scopeId) {
2672
+ ${It("const",[...ko,...Q],Y)}
2673
+ const __scope = window.stx._scopes = window.stx._scopes || {};
2674
+ const __scopeVars = __scope[__scopeId] = __scope[__scopeId] || {};
2675
+ __scopeVars.$refs = __scopeVars.$refs || {};
2676
+ const __previousCurrentElement = window.__STX_CURRENT_ELEMENT__;
2677
+ window.__STX_CURRENT_ELEMENT__ = document.querySelector('[data-stx-scope="' + __scopeId + '"]');
2678
+
2679
+ // Scope-specific lifecycle callbacks
2680
+ __scopeVars.__mountCallbacks = __scopeVars.__mountCallbacks || [];
2681
+ __scopeVars.__destroyCallbacks = __scopeVars.__destroyCallbacks || [];
2682
+ const onMount = (fn) => __scopeVars.__mountCallbacks.push(fn);
2683
+ const onDestroy = (fn) => __scopeVars.__destroyCallbacks.push(fn);
2684
+
2685
+ try {
2686
+ ${Y}
2687
+
2688
+ // Register all defined signals and functions in this scope
2689
+ const __localVars = {};
2690
+ try {
2691
+ ${Q.map((ie)=>`if (typeof ${ie} !== 'undefined') __localVars['${ie}'] = ${ie};`).join(`
2692
+ `)}
2693
+ }
2694
+ catch (e) {}
2695
+ Object.assign(__scopeVars, __localVars);
2696
+ }
2697
+ finally {
2698
+ window.__STX_CURRENT_ELEMENT__ = __previousCurrentElement;
2699
+ }
2700
+ }`,oe={vendorStyleTags:j,factoryBody:se,deps:yo([...F,...E.styles.map((ie)=>ie.resolvedPath)])};if(!U&&E.unresolved.length===0)zc.set(v,oe);return oe}var iv=/^[ \t]*import\s+['"]([^'"]+?\.css)(\?[^'"]*)?['"]\s*;?\s*$/gm;function ov(e){if(e.startsWith(".")||e.startsWith("/"))return null;if(e.startsWith("@")){let x=e.match(/^(@[^/]+\/[^/]+)(\/.*)?$/);if(!x)return null;return{pkg:x[1],subpath:x[2]||""}}let o=e.match(/^([^/]+)(\/.*)?$/);if(!o)return null;return{pkg:o[1],subpath:o[2]||""}}function av(e,o){let x=o;while(!0){let v=mr.join(x,"node_modules",e,"package.json");if(Fs.existsSync(v))return mr.dirname(v);let k=mr.dirname(x);if(k===x)return null;x=k}}function cv(e,o){if(!e||typeof e!=="object")return null;let x=(k)=>{if(typeof k==="string")return k;if(k&&typeof k==="object"){if(typeof k.import==="string")return k.import;if(typeof k.default==="string")return k.default;if(typeof k.import==="object")return x(k.import);if(typeof k.default==="object")return x(k.default)}return null};if(Object.prototype.hasOwnProperty.call(e,o))return x(e[o]);let v=null;for(let k of Object.keys(e)){let E=k.indexOf("*");if(E===-1)continue;let C=k.slice(0,E),j=k.slice(E+1);if(!o.startsWith(C)||!o.endsWith(j))continue;if(o.length<C.length+j.length)continue;if(!v||C.length>v.prefix.length)v={pattern:k,prefix:C,suffix:j}}if(v){let k=o.slice(v.prefix.length,o.length-v.suffix.length),E=x(e[v.pattern]);if(E)return E.replace("*",k)}return null}function lv(e,o){let x=ov(e);if(!x||!x.subpath)return null;let v=av(x.pkg,o);if(!v)return null;let k;try{k=JSON.parse(Fs.readFileSync(mr.join(v,"package.json"),"utf8"))}catch{return null}let E=`.${x.subpath}`,C=cv(k.exports,E);if(!C)return null;let j=mr.resolve(v,C);return Fs.existsSync(j)?j:null}function Xr(e,o){let x=o.filePath?mr.dirname(o.filePath):o.projectRoot||process.cwd(),v=o.projectRoot||process.cwd(),k=new Set,E=[],C=[];return{code:e.replace(iv,(L,B)=>{let F;try{if(B.startsWith("./")||B.startsWith("../")||B.startsWith("/")){if(F=B.startsWith("/")?B:mr.resolve(x,B),!Fs.existsSync(F))throw Error(`file not found: ${F}`)}else{let U=null;try{U=Bun.resolveSync(B,v)}catch{U=lv(B,v)}if(!U)throw Error(`could not resolve ${B} (Bun.resolveSync + exports fallback both failed)`);F=U}}catch(U){return console.warn(`[stx:vendor-css] could not resolve ${JSON.stringify(B)} (from ${o.filePath||"<unknown>"}): ${U?.message||U}`),C.push(B),""}if(k.has(F))return"";k.add(F);try{let U=Fs.readFileSync(F,"utf8");E.push({source:B,resolvedPath:F,contents:U})}catch(U){console.warn(`[stx:vendor-css] could not read ${F}: ${U?.message||U}`),C.push(B)}return""}),styles:E,unresolved:C}}function uv(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Kr(e){if(e.length===0)return"";return`${e.map((o)=>`<style data-stx-vendor="${uv(o.source)}" data-stx-layer="vendor">
2701
+ @layer vendor {
2702
+ ${o.contents}
2703
+ }
2704
+ </style>`).join(`
2705
+ `)}
2706
+ `}var qa=m;function bt(e){let o=s(e),x=new Set;for(let j of e.matchAll(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm))for(let L of j[1].split(",")){let B=L.trim().split(/\s+as\s+/).pop()?.replace(/^type\s+/,"").trim();if(B)x.add(B)}let v=new Set;for(let j of o.matchAll(/\b(?:const|let|var|function|class)\s+([A-Za-z_$][\w$]*)/g))v.add(j[1]);for(let j of o.matchAll(/\b(?:const|let|var)\s*\{([^}]*)\}/g))for(let L of j[1].split(",")){let B=L.trim().split(/[:=]/).pop()?.trim();if(B)v.add(B)}let k=W.filter((j)=>{if(x.has(j)||v.has(j))return!1;return Ni(o,j,!0)}),E=Vf(o).filter((j)=>!x.has(j)&&!v.has(j));if(k.length===0&&E.length===0)return{code:e,imports:k,models:E};return{code:`${[k.length>0?`import { ${k.join(", ")} } from '@stacksjs/browser'`:"",E.length>0?"import '@stacksjs/browser'":"",E.length>0?`const { ${E.join(", ")} } = window.StacksBrowser || {}`:""].filter(Boolean).join(`
2707
+ `)}
2708
+ ${e}`,imports:k,models:E}}var dv=new Set(["Promise","Object","Array","Map","Set","Date","Error","JSON","Math","Number","String","RegExp","Symbol","WeakMap","WeakSet","Proxy","Reflect","Intl","URL","URLSearchParams","FormData","Headers","Request","Response","AbortController","EventTarget","Element","Document","Node","Window","Console","Storage","Navigator","Blob","File","FileReader","HTMLElement","SVGElement","Event","CustomEvent","DOMParser","XMLSerializer","WebSocket","Worker","SharedWorker","IntersectionObserver","MutationObserver","ResizeObserver","PerformanceObserver","Notification","Bun","Buffer","Process","Modal","Intl"]);function Vf(e){let o=new Set,x=/\b([A-Z][a-zA-Z0-9]*)\s*\.\s*(all|find|first|get|where|orderBy|orderByDesc|limit|select|pluck|create|update|delete)\s*\(/g,v;while((v=x.exec(e))!==null)if(!dv.has(v[1]))o.add(v[1]);return Array.from(o)}function pv(e){let o=new Set;for(let x of e.matchAll(/\b(?:const|let|var|function|class)\s+([A-Za-z_$][\w$]*)/g))o.add(x[1]);for(let x of e.matchAll(/\b(?:const|let|var)\s*\{([^}]*)\}/g))for(let v of x[1].split(",")){let k=v.trim().split(/[:=]/).pop()?.trim();if(k&&/^[A-Za-z_$][\w$]*$/.test(k))o.add(k)}return o}function Mi(e){let o=new Set,x=new Set,v=e;v=v.replace(/^[ \t]*import\s+type\s+\{[^}]*\}\s+from\s+['"][^'"]+['"][ \t]*;?[ \t]*$/gm,"// [type import stripped]");let k=new Set,E=/^[ \t]*import\s+(?:type\s+)?{\s*([^}]+)\s*}\s+from\s+['"](@stacksjs\/browser|@stacksjs\/stx|stx)['"][ \t]*;?[ \t]*$/gm,C;while((C=E.exec(e))!==null){let U=C[1],Z=C[2];if(C[0].includes("import type"))continue;let Y=[];for(let se of U.split(",")){let oe=se.trim();if(!oe||oe.startsWith("type "))continue;let ie=oe.match(/^([A-Za-z_$][\w$]*)(?:\s+as\s+([A-Za-z_$][\w$]*))?$/);if(!ie)continue;let ce=ie[1],ae=ie[2]||ce;if(k.add(ce),k.add(ae),Z==="stx"||Z==="@stacksjs/stx")o.add(ce);else x.add(ce);if(ae!==ce)Y.push(`${ae} = ${ce}`)}let Q=Y.length>0?`var ${Y.join(", ")}; /* [auto-import processed] */`:"// [auto-import processed]";v=v.replace(C[0],Q)}let j=pv(v);for(let U of qa){if(k.has(U)||j.has(U))continue;if(new RegExp(`\\b${U}\\s*(?:<[^>]*>)?\\s*\\(`,"g").test(v))o.add(U)}let L=s(v),B=new Set;for(let U of v.matchAll(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm))for(let Z of U[1].split(",")){let Y=Z.trim().replace(/^type\s+/,"").split(/\s+as\s+/);for(let Q of Y){let se=Q.trim();if(se)B.add(se)}}for(let U of W){if(k.has(U)||j.has(U)||B.has(U))continue;if(Ni(L,U))x.add(U)}let F=Vf(v);for(let U of F)if(!k.has(U)&&!j.has(U))x.add(U);return{code:v,stxImports:Array.from(o),browserImports:Array.from(x)}}function Ni(e,o,x=!1){let v=new RegExp(`\\b${o.replace(/[$]/g,"\\$")}\\b`,"g");for(let k of e.matchAll(v)){let E=k.index??0,C=E+o.length,j=E-1;while(j>=0&&/\s/.test(e[j]))j--;if(e[j]==="."&&e.slice(Math.max(0,j-2),j+1)!=="...")continue;let L=C;while(L<e.length&&/\s/.test(e[L]))L++;if(e[L]===":"&&e[L+1]!==":"&&(e[j]==="{"||e[j]===","))continue;if(x&&!/^\s*(?:<[^>]*>)?\s*\(/.test(e.slice(C)))continue;return!0}return!1}function Li(e,o){let x=[];if(e.length>0)x.push(` var { ${e.join(", ")} } = window.stx || window;`);if(o.length>0)x.push(` var { ${o.join(", ")} } = window.StacksBrowser || {};`);if(x.length>0)return` // STX: auto-imported from stx and @stacksjs/browser
2709
+ ${x.join(`
2710
+ `)}
2711
+ ${fv(e,o)}`;return""}function Tu(e,o=[]){let{browserImports:x}=Mi(e),v=new Set(o);return Li([],x.filter((k)=>!v.has(k)))}function fv(e,o){let x=[...e.map((v)=>`['${v}', typeof ${v}, 'stx']`),...o.map((v)=>`['${v}', typeof ${v}, '@stacksjs/browser']`)];if(x.length===0)return"";return` // STX: report auto-imports the client runtime did not provide
2712
+ [${x.join(", ")}].forEach(function (e) {
2713
+ if (e[1] !== 'undefined') return;
2714
+ console.error(
2715
+ '[stx] "' + e[0] + '" is used in this client script and auto-imported from ' + e[2] + ', '
2716
+ + 'but the client runtime does not provide it. Either it is not exported to the browser, '
2717
+ + 'or it should be imported from a relative path so the bundler includes it.'
2718
+ );
2719
+ });
2720
+ `}function Le(e){let o=e.__stxClientPayload;if(o&&typeof o==="object"){let v={};for(let k in o){let E=o[k];if(typeof E==="function")continue;v[k]=E}return v.__stxDeclaredPayload=!0,v}let x={};for(let v in e){if(v.startsWith("__")||v.startsWith("$"))continue;let k=e[v];if(typeof k==="function")continue;x[v]=k}return x}function gv(e,o){return new RegExp(`(?<![.#\\w$])${o}(?![\\w$])`).test(e)}var mv=/token|secret|passw|apikey|api_key|privatekey|private_key|credential|webhook|bearer|jwt|signature/i,Wf=new Set;function hv(e,o){let x=mv.test(e),v=o.length>32768;if(!x&&!v)return;if(Wf.has(e))return;if(Wf.add(e),x)console.warn(`[stx] server\u2192client bridge is publishing "${e}" into the page body. If it holds a credential, rename it with a "__" prefix (never bridged) and pass only what the template needs. See stacksjs/stx#1831.`);if(v)console.warn(`[stx] server\u2192client bridge is publishing ${(o.length/1024).toFixed(1)}KB under "${e}". Every byte ships in the HTML on each request; prefix the binding with "__" and project just the fields the client reads.`)}function Gr(e,o){if(!o)return"";let x=s(e),v=o.__stxDeclaredPayload===!0,k=[];for(let[E,C]of Object.entries(o)){if(!/^[A-Za-z_$][\w$]*$/.test(E))continue;if(E.startsWith("__")||E.startsWith("$"))continue;if(!v&&!gv(x,E))continue;if(Ks(e,E)){if(v)console.warn(`[stx] defineClientPayload declares "${E}", but this client block also declares "${E}" at the top level, so the server value is not published (emitting it would be a duplicate binding). Rename the local, or drop "${E}" from defineClientPayload.`);continue}let j;try{j=JSON.stringify(C)}catch{continue}if(j===void 0)continue;hv(E,j),k.push(` var ${E} = ${j.replace(/</g,"\\u003c")};`)}if(k.length===0)return"";return` // stx: server -> client data bridge (seeded from server scope)
2721
+ ${k.join(`
2722
+ `)}
2723
+ `}var yv={left:0,middle:1,right:2};function xv(e){let o=[];if(e.self)o.push("if ($event.target !== $el) return");for(let x of e.systemKeys)o.push(`if (!$event.${x}Key) return`);if(e.keys.length>0){let x=e.keys.map((v)=>`$event.key === '${v}'`).join(" || ");o.push(`if (!(${x})) return`)}if(e.mouse!==null){let x=yv[e.mouse];o.push(`if ($event.button !== ${x}) return`)}if(e.prevent)o.push("$event.preventDefault()");if(e.stop)o.push("$event.stopPropagation()");return o.join("; ")}function bv(e,o){let{elementId:x,event:v,modifiers:k}=e,E=Mo(e.handler),C=xv(k),j=[];if(k.once)j.push("once: true");if(k.capture)j.push("capture: true");if(Po(v,k))j.push("passive: true");let L=j.length>0?`, { ${j.join(", ")} }`:"",B="";if(C)B+=`${C}; `;let F=E.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),U=`var $emit = function(name, detail) {
2724
+ $el.dispatchEvent(new CustomEvent(name, { detail: detail, bubbles: true, cancelable: true }))
2725
+ };`;function Z(Y){if(/\$emit\s*\(/.test(Y))return`${U}
2726
+ ${Y}`;return`var scope = $el.closest('[data-stx-scope]');
2727
+ if (scope && scope.__stx_execute) {
2728
+ scope.__stx_execute('${F}', $event, $el);
2729
+ }
2730
+ else {
2731
+ ${Y}
2732
+ }`}if(k.debounce!==null)return` ;(function() {
2733
+ // eslint-disable-next-line pickier/no-unused-vars
2734
+ var $el = document.getElementById('${x}')
2735
+ if (!$el) return
2736
+ var __timer
2737
+ $el.addEventListener('${v}', function($event) {
2738
+ ${C?C+"; ":""}clearTimeout(__timer)
2739
+ __timer = setTimeout(function() { ${Z(E)} }, ${k.debounce})
2740
+ }${L})
2741
+ })()`;if(k.throttle!==null)return` ;(function() {
2742
+ // eslint-disable-next-line pickier/no-unused-vars
2743
+ var $el = document.getElementById('${x}')
2744
+ if (!$el) return
2745
+ var __last = 0
2746
+ $el.addEventListener('${v}', function($event) {
2747
+ ${C?C+"; ":""}var __now = Date.now()
2748
+ if (__now - __last >= ${k.throttle}) {
2749
+ __last = __now
2750
+ ${Z(E)}
2751
+ }
2752
+ }${L})
2753
+ })()`;if(/\$emit\s*\(/.test(E))return` var $el = document.getElementById('${x}')
2754
+ if ($el) $el.addEventListener('${v}', function($event) {
2755
+ ${B}${U}
2756
+ ${E}
2757
+ }${L})`;return` var $el = document.getElementById('${x}')
2758
+ if ($el) $el.addEventListener('${v}', function($event) {
2759
+ ${B}var scope = $el.closest('[data-stx-scope]');
2760
+ if (scope && scope.__stx_execute) {
2761
+ scope.__stx_execute('${F}', $event, $el);
2762
+ }
2763
+ else {
2764
+ ${E}
2765
+ }
2766
+ }${L})`}function vv(e){if(e.length===0)return"";return`
2767
+ // STX: auto-generated event bindings
2768
+ ${e.map((x,v)=>bv(x,v)).join(`
2769
+ `)}`}function Ff(e){let o=[],x=new Set,v=e.replace(/^\s*import\s+.*$/gm,""),k=0,E=v.length,C=0;while(C<E){let j=v[C];if(j==="'"||j==='"'||j==="`"){let L=j;if(C++,L==="`"){let B=0;while(C<E){if(v[C]==="\\"){C+=2;continue}if(v[C]==="`"&&B===0){C++;break}if(v[C]==="$"&&v[C+1]==="{"){B++,C+=2;continue}if(v[C]==="}"&&B>0){B--,C++;continue}C++}}else while(C<E){if(v[C]==="\\"){C+=2;continue}if(v[C]===L){C++;break}C++}continue}if(j==="/"&&v[C+1]==="/"){while(C<E&&v[C]!==`
2770
+ `)C++;continue}if(j==="/"&&v[C+1]==="*"){C+=2;while(C<E-1&&!(v[C]==="*"&&v[C+1]==="/"))C++;C+=2;continue}if(j==="{"){k++,C++;continue}if(j==="}"){k--,C++;continue}if(k===0){let L=v.slice(C),B=L.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(B){let Z=B[1];if(!Z.startsWith("_")&&!x.has(Z))o.push(Z),x.add(Z);C+=B[0].length;continue}let F=L.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(F){F[1].split(",").forEach((Z)=>{let Y=Z.trim(),Q=Y.indexOf(":"),se=Q>=0?Y.slice(Q+1).trim().split(/[\s=]/)[0]:Y.split(/[\s=]/)[0];if(se&&!se.startsWith("_")&&!x.has(se))o.push(se),x.add(se)}),C+=F[0].length;continue}let U=L.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(U){let Z=U[1];if(!Z.startsWith("_")&&!x.has(Z))o.push(Z),x.add(Z);C+=U[0].length;continue}}C++}return o}var wv=new Set(["if","else","true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","switch","case","break","continue","for","while","do","try","catch","finally","const","let","var","function","class","import","export","default","async","await","yield","with","debugger","console","window","document","Math","JSON","Date","Array","Object","String","Number","Boolean","Symbol","Map","Set","Promise","Error","parseInt","parseFloat","isNaN","isFinite","encodeURIComponent","decodeURIComponent","setTimeout","setInterval","clearTimeout","clearInterval","fetch","alert","confirm","prompt","event"]);function $v(e){let o=new Set,x=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function v(Z){let Y;while((Y=x.exec(Z))!==null){let Q=Y[0];if(!wv.has(Q))o.add(Q)}}let k=/\{\{([\s\S]*?)\}\}/g,E;while((E=k.exec(e))!==null)v(E[1]);let C=/:[a-z][\w.-]*\s*=\s*"([^"]*)"/gi;while((E=C.exec(e))!==null)v(E[1]);let j=/:[a-z][\w.-]*\s*=\s*'([^']*)'/gi;while((E=j.exec(e))!==null)v(E[1]);let L=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((E=L.exec(e))!==null)v(E[1]);let B=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((E=B.exec(e))!==null)v(E[1]);let F=/@model\s*=\s*["']([^"']*)["']/gi;while((E=F.exec(e))!==null)v(E[1]);let U=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((E=U.exec(e))!==null)v(E[1]);return o}async function ye(e,o={}){let x=e,v="",k=!1,E=[],C=Xr(x,{filePath:o.filePath,projectRoot:o.projectRoot});x=C.code;let j=Kr(C.styles),L=bt(x);x=L.code,E=[...L.imports,...L.models];let{hasUserImports:B,bundleClientScript:F}=await lt("stx/client-script-bundler",()=>import("./chunk-hn9pkyv8.js"));if(B(x))x=await F(x,o.filePath||"",{projectRoot:o.projectRoot,minify:o.production}),k=!0;if(o.autoImports!==!1){let ae=Mi(x);x=ae.code,v=Li(ae.stxImports,ae.browserImports.filter((pe)=>!E.includes(pe)))}if(v=`${Gr(x,o.serverData)}${v}`,x=R(x),!k&&Ve(o.attrs||""))x=Ue(x);let U=vv(o.eventBindings||[]),Z=(o.attrs||"").trim(),Y=/\btype\s*=\s*["']module["']/i.test(Z),Q=o.instanceId?` data-stx-instance="${o.instanceId}"`:"";if(Y){let ae=Z.replace(/\btype\s*=\s*["']module["']/i,"").trim(),pe=`type="module" data-stx-scoped${Q}${ae?` ${ae}`:""}`;return`${j}<script ${pe}>
2771
+ ${Ir(`${v}${x}
2772
+ ${U}`)}
2773
+ </script>`}let se=Ds(e),oe=/function __stx_setup_/.test(x),ie=/\bstx\.mount\s*\(|\bstx\.mountEl\s*\(/.test(e);function ce(ae){let pe=ae.length>0?`
2774
+ return { ${ae.join(", ")} };`:"";return`${j}<script data-stx-scoped data-stx-run="always"${Q}>
2775
+ window.stx.mount(function() {
2776
+ 'use strict';
2777
+ ${Ir(`${v}${x}
2778
+ ${U}${pe}`)}
2779
+ })</script>`}if(!ie&&!oe){if(se)return ce(Ff(e));if(o.templateContent){let ae=Ff(e);if(ae.length>0){let pe=$v(o.templateContent);if(ae.some((he)=>pe.has(he)))return ce(ae)}}}return`${j}<script data-stx-scoped data-stx-run="always"${Q}>
2780
+ ;(function() {
2781
+ 'use strict';
2782
+ ${Ir(`${v}${x}
2783
+ ${U}`)}
2784
+ })()</script>`}
2785
+ export{Nn,Ne,W,y,Xr,Kr,qa,bt,Mi,Ni,Li,Tu,Le,Gr,ye,ji,Bi,Fi,Jr,Ln,Xa,_u,Ka,Ru,Ga,jn,h,vt,be,Ja,Yr,Ya,Au,q,Za,Pu,b,Iu,je,wt,Be,Fe,zi,Bn,ee,Zr,Qr,es,Du,Fn,Ou,rn,Qa,ts,M,le,X,Mu,ec,ns,rs,Hi,Vi,ss,is,tc,nc,Ui,Wi,rc,ze,sn,zn,xt,sc,ic,oc,ac,cc,d,lc,os,uc,qi,Xi,St,as,Ki,dc,Nu,ve,Gi,Lu,cs,ls,us,Hn,Ji,ds,Vn,on,Un,ps,gs,ms,r,He,hs,ys,pc,te,Yi,Zi,Qi,eo,Wn,bs,to,no,ro,fc,gc,mc,hc,yc,bc,Ve,N,Ue,vc,qn,wc,so,xc,We,n,Xn,io,g,K,ju,Kn,A,Sc,i,T,Bu,Fu,ue};