@stacksjs/stx 0.2.875 → 0.2.880

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 (276) hide show
  1. package/dist/{chunk-fdjx4vs3.js → chunk-00tq7ghn.js} +2 -2
  2. package/dist/{chunk-nv4c25zj.js → chunk-02qmvcmv.js} +3 -3
  3. package/dist/chunk-08cb7cyw.js +2 -0
  4. package/dist/chunk-0h1dyd38.js +2 -0
  5. package/dist/{chunk-4m11kcxz.js → chunk-0m4c42qt.js} +10 -10
  6. package/dist/{chunk-6ykfy7eh.js → chunk-19k15mfc.js} +2 -2
  7. package/dist/chunk-1avy0p8v.js +2 -0
  8. package/dist/chunk-1jk46ve0.js +2 -0
  9. package/dist/chunk-1r612xxs.js +2 -0
  10. package/dist/chunk-1z6rrqvm.js +2 -0
  11. package/dist/chunk-2d68p12e.js +2 -0
  12. package/dist/chunk-2haf7t5h.js +2 -0
  13. package/dist/{chunk-1q5w3xav.js → chunk-2r0nrvqe.js} +2 -2
  14. package/dist/chunk-3jp5z1qj.js +2 -0
  15. package/dist/{chunk-644ckv6e.js → chunk-3q0w0bzd.js} +10 -10
  16. package/dist/{chunk-eknm4jrm.js → chunk-3sema2js.js} +2 -2
  17. package/dist/{chunk-vznf808n.js → chunk-3wb82rxw.js} +5 -5
  18. package/dist/chunk-3zds0gmd.js +2 -0
  19. package/dist/{chunk-qnwd5bz4.js → chunk-463weehv.js} +1 -1
  20. package/dist/{chunk-wm029dh0.js → chunk-4fkcn6z5.js} +18 -12
  21. package/dist/{chunk-976kgb3r.js → chunk-4n45qa0b.js} +9 -9
  22. package/dist/chunk-4pjqj54a.js +2 -0
  23. package/dist/{chunk-9anqwafq.js → chunk-4r2rfdmr.js} +5 -5
  24. package/dist/{chunk-ft6em3wm.js → chunk-50cnypys.js} +6 -6
  25. package/dist/chunk-53cc06w7.js +2 -0
  26. package/dist/{chunk-y2e2zm6y.js → chunk-57q4nvs9.js} +3 -3
  27. package/dist/{chunk-3mz9bdf7.js → chunk-59er0fc7.js} +3 -3
  28. package/dist/{chunk-dw0ttj6p.js → chunk-5eftxrvv.js} +2 -2
  29. package/dist/chunk-5p3825qw.js +2 -0
  30. package/dist/chunk-5rd0an89.js +2 -0
  31. package/dist/{chunk-pk714ynv.js → chunk-69ezjc8k.js} +4 -4
  32. package/dist/{chunk-75v0yxeh.js → chunk-6c1vm6bs.js} +2 -2
  33. package/dist/{chunk-d3q0cg47.js → chunk-6df3j3qq.js} +3 -3
  34. package/dist/{chunk-kzc2tqzr.js → chunk-6t04tqvh.js} +2 -2
  35. package/dist/chunk-78zgmqhd.js +2 -0
  36. package/dist/chunk-7bsrnpmh.js +33 -0
  37. package/dist/chunk-7dq6ebvp.js +2 -0
  38. package/dist/chunk-7kqgp3p7.js +2 -0
  39. package/dist/{chunk-wzvdr4ta.js → chunk-7mcs59pr.js} +2 -2
  40. package/dist/chunk-83b9k17j.js +2 -0
  41. package/dist/chunk-86nsbxep.js +61 -0
  42. package/dist/{chunk-0g2mg8cw.js → chunk-8e1cv1hh.js} +3 -3
  43. package/dist/chunk-8h5nje66.js +2 -0
  44. package/dist/{chunk-ae8q4gze.js → chunk-8va3fs07.js} +5 -5
  45. package/dist/{chunk-fnjm3xbf.js → chunk-93jhfbeg.js} +6 -6
  46. package/dist/{chunk-xmws1gaf.js → chunk-94ctmp0j.js} +2 -2
  47. package/dist/chunk-97kgrevs.js +4 -0
  48. package/dist/{chunk-qvrew79n.js → chunk-9cbf0seq.js} +2 -2
  49. package/dist/{chunk-mce3g2wb.js → chunk-9f31gs4m.js} +2 -2
  50. package/dist/chunk-9kza7gxd.js +2 -0
  51. package/dist/{chunk-b4d4tjvx.js → chunk-a0q0kb0s.js} +5 -5
  52. package/dist/chunk-a5gnxdfe.js +2 -0
  53. package/dist/chunk-a60ztvnp.js +3 -0
  54. package/dist/{chunk-s7fhpkvf.js → chunk-a7ryj8z8.js} +6 -6
  55. package/dist/{chunk-gqtb53s8.js → chunk-aaea157p.js} +2 -2
  56. package/dist/{chunk-wp0qpa50.js → chunk-agd2b928.js} +59 -27
  57. package/dist/chunk-aqxh80vh.js +2 -0
  58. package/dist/{chunk-az5rh7fs.js → chunk-awp8a3t4.js} +2 -2
  59. package/dist/chunk-axra1yas.js +2 -0
  60. package/dist/chunk-az8b0726.js +21 -0
  61. package/dist/chunk-b7d3n4aw.js +2 -0
  62. package/dist/{chunk-r2bxjna3.js → chunk-c0g30cjs.js} +2 -2
  63. package/dist/{chunk-jt5tzddc.js → chunk-c73c0wf9.js} +2 -2
  64. package/dist/{chunk-88xayf21.js → chunk-cad7e5q1.js} +9 -9
  65. package/dist/{chunk-bjjfr7qt.js → chunk-care745q.js} +2 -2
  66. package/dist/chunk-ce0zbpr5.js +2 -0
  67. package/dist/chunk-cjv89tnb.js +20 -0
  68. package/dist/chunk-cv1vm1w0.js +2 -0
  69. package/dist/{chunk-mw0rb1sf.js → chunk-czcx3nbx.js} +6 -6
  70. package/dist/chunk-d7b30bg6.js +2 -0
  71. package/dist/{chunk-stn7p7f1.js → chunk-dwyhpbpx.js} +2 -2
  72. package/dist/{chunk-y75bds1g.js → chunk-e362e615.js} +30 -30
  73. package/dist/{chunk-ydppkb8y.js → chunk-e41pgmgk.js} +2 -2
  74. package/dist/{chunk-6az66mrc.js → chunk-ec5q4nnw.js} +66 -66
  75. package/dist/{chunk-0h6r7nvn.js → chunk-egjmb32c.js} +126 -71
  76. package/dist/{chunk-q7zc78az.js → chunk-ew3vs3jq.js} +8 -8
  77. package/dist/{chunk-jqxerj6k.js → chunk-ezna4dhj.js} +2 -2
  78. package/dist/chunk-f3j1h3ch.js +2 -0
  79. package/dist/{chunk-vmssv78v.js → chunk-f7znj9xg.js} +3 -3
  80. package/dist/chunk-fz4c5e9m.js +2 -0
  81. package/dist/{chunk-esjr9qhe.js → chunk-g2xy0z0e.js} +2 -2
  82. package/dist/{chunk-fy6ts0n4.js → chunk-g83ph305.js} +2 -2
  83. package/dist/{chunk-kywe0f1v.js → chunk-gbncp2gp.js} +2 -2
  84. package/dist/chunk-gm67jt8p.js +2 -0
  85. package/dist/chunk-gmp10259.js +2 -0
  86. package/dist/{chunk-0sa9gqmc.js → chunk-h2tq6cbr.js} +11 -11
  87. package/dist/chunk-h3fv0q25.js +2 -0
  88. package/dist/{chunk-r09kz9bf.js → chunk-h63ma36g.js} +2 -2
  89. package/dist/chunk-hkx51atf.js +2 -0
  90. package/dist/{chunk-95hbmv7k.js → chunk-hmntqqyd.js} +7 -7
  91. package/dist/{chunk-3w7gacva.js → chunk-hxhmhw23.js} +3 -3
  92. package/dist/chunk-jghpzx5m.js +2 -0
  93. package/dist/chunk-k206d3pn.js +2 -0
  94. package/dist/chunk-k40e0ete.js +4 -0
  95. package/dist/chunk-k6c5t9we.js +38 -0
  96. package/dist/{chunk-f4vgagjb.js → chunk-kee5a3ce.js} +3 -3
  97. package/dist/chunk-kn9tqjgv.js +25 -0
  98. package/dist/chunk-kna1bdm2.js +54 -0
  99. package/dist/{chunk-a5yb8w7s.js → chunk-mygsektn.js} +3 -3
  100. package/dist/chunk-nb6erf75.js +9 -0
  101. package/dist/chunk-ngzyzcrp.js +2 -0
  102. package/dist/{chunk-3f9wctns.js → chunk-nysbdr4r.js} +2 -2
  103. package/dist/chunk-p55a910x.js +1198 -0
  104. package/dist/chunk-p6hcrg3r.js +3 -0
  105. package/dist/chunk-p746twww.js +2 -0
  106. package/dist/chunk-pa2vt2ej.js +2 -0
  107. package/dist/chunk-pa6kgbmw.js +2 -0
  108. package/dist/{chunk-saqzk45g.js → chunk-pdprhg5k.js} +1 -1
  109. package/dist/chunk-pjjrx9pk.js +2 -0
  110. package/dist/{chunk-g7qpnmbm.js → chunk-pm4rpc4a.js} +23 -23
  111. package/dist/chunk-pt3rp3zg.js +2 -0
  112. package/dist/{chunk-4517hny7.js → chunk-q1mb0fbt.js} +2 -2
  113. package/dist/{chunk-k1ew643q.js → chunk-q74affc4.js} +2 -2
  114. package/dist/chunk-qd9v1v8z.js +2 -0
  115. package/dist/chunk-qfwk93fk.js +2 -0
  116. package/dist/chunk-qg1kw5yf.js +2 -0
  117. package/dist/chunk-qn6y5ttj.js +2 -0
  118. package/dist/chunk-qxcc0aar.js +2 -0
  119. package/dist/{chunk-rzd9hyhv.js → chunk-ram5944w.js} +2 -2
  120. package/dist/{chunk-p5m1z6e1.js → chunk-rcxer2km.js} +4 -4
  121. package/dist/chunk-rdxph1tp.js +2 -0
  122. package/dist/chunk-rnrdngnn.js +2 -0
  123. package/dist/{chunk-x2ftkaz3.js → chunk-rsxxajv6.js} +2 -2
  124. package/dist/chunk-rw5sxr5a.js +2 -0
  125. package/dist/chunk-rzcdwybt.js +26 -0
  126. package/dist/chunk-s29hp1qw.js +14 -0
  127. package/dist/chunk-s7xywsqd.js +3 -0
  128. package/dist/{chunk-d6gqh2wv.js → chunk-satrf398.js} +1 -1
  129. package/dist/{chunk-zn6n075d.js → chunk-shcnt6aa.js} +3 -3
  130. package/dist/{chunk-ysfgabpf.js → chunk-sn4ndpd7.js} +3 -3
  131. package/dist/{chunk-zc8a2erc.js → chunk-ssg6ne5b.js} +4 -4
  132. package/dist/{chunk-afxfkb60.js → chunk-sv7fdqmc.js} +6 -6
  133. package/dist/chunk-swz0xprw.js +2 -0
  134. package/dist/chunk-t8r40wgf.js +2 -0
  135. package/dist/{chunk-dbvsa5ya.js → chunk-t94y8g35.js} +2 -2
  136. package/dist/{chunk-g33ycxe3.js → chunk-t9hxyvvc.js} +5 -5
  137. package/dist/{chunk-cmh0bfkb.js → chunk-tgzs1kbj.js} +5 -5
  138. package/dist/chunk-tka73egx.js +2 -0
  139. package/dist/{chunk-xtaq95em.js → chunk-v1s838fe.js} +1 -1
  140. package/dist/chunk-v3747589.js +12 -0
  141. package/dist/chunk-v9h2bbhf.js +2 -0
  142. package/dist/chunk-v9mxhch2.js +2 -0
  143. package/dist/chunk-vm42j29z.js +2 -0
  144. package/dist/chunk-w2kdhm7k.js +2 -0
  145. package/dist/chunk-w5zzwe2f.js +2 -0
  146. package/dist/chunk-wbmx0rge.js +2 -0
  147. package/dist/chunk-wjafpvjv.js +2 -0
  148. package/dist/chunk-ws2h92mm.js +3 -0
  149. package/dist/chunk-ws9kr80x.js +2 -0
  150. package/dist/{chunk-45rzd16g.js → chunk-xf0xacc9.js} +44 -44
  151. package/dist/chunk-xhr35ctb.js +2 -0
  152. package/dist/chunk-xmmr0916.js +2 -0
  153. package/dist/{chunk-yxdhz4ps.js → chunk-xpbakn6t.js} +2 -2
  154. package/dist/chunk-xz4v9tg1.js +3 -0
  155. package/dist/chunk-y7e61pz3.js +3 -0
  156. package/dist/{chunk-v0tdg16k.js → chunk-ybjgnnyf.js} +5 -5
  157. package/dist/chunk-yh2hnt3m.js +12 -0
  158. package/dist/{chunk-w6pzkcjp.js → chunk-ymqm898x.js} +2 -2
  159. package/dist/{chunk-2zaatnnh.js → chunk-yp4tn4zn.js} +4 -4
  160. package/dist/chunk-z7k1xn6k.js +2 -0
  161. package/dist/{chunk-t4g3ka8c.js → chunk-z9ffr9gy.js} +7 -7
  162. package/dist/{chunk-nnp6rf4c.js → chunk-zch65qrd.js} +1 -1
  163. package/dist/{chunk-pbakxcv8.js → chunk-zek9t5za.js} +2 -2
  164. package/dist/cli.js +23 -23
  165. package/dist/client/signals-dom-ready-runtime.js +6 -0
  166. package/dist/client/signals-mount-runtime.js +1 -1
  167. package/dist/client-module-registry.js +10 -4
  168. package/dist/client-parameter-bindings.d.ts +5 -0
  169. package/dist/client-parameter-bindings.js +47 -6
  170. package/dist/client-script-bundler.js +4 -3
  171. package/dist/component-library.d.ts +1 -0
  172. package/dist/component-library.js +42 -14
  173. package/dist/composable-loader.js +19 -9
  174. package/dist/craft-entry.js +2 -2
  175. package/dist/craft.js +2 -2
  176. package/dist/html-masking.d.ts +2 -0
  177. package/dist/html-masking.js +10 -0
  178. package/dist/inherited-context.d.ts +1 -1
  179. package/dist/inherited-context.js +43 -14
  180. package/dist/module-syntax.d.ts +2 -0
  181. package/dist/module-syntax.js +21 -0
  182. package/dist/native-component-context.js +44 -17
  183. package/dist/page-module-order.d.ts +10 -0
  184. package/dist/page-module-order.js +139 -0
  185. package/dist/process.js +6 -4
  186. package/dist/pwa.js +3 -3
  187. package/dist/script-attributes.d.ts +4 -0
  188. package/dist/script-attributes.js +10 -0
  189. package/dist/ssg.js +39 -39
  190. package/dist/strip-literals.d.ts +2 -0
  191. package/dist/strip-literals.js +12 -6
  192. package/dist/stx-virtual-ts.d.ts +1 -0
  193. package/dist/stx-virtual-ts.js +21 -27
  194. package/dist/typecheck.js +8 -0
  195. package/package.json +5 -5
  196. package/dist/chunk-003ph86a.js +0 -2
  197. package/dist/chunk-027meh1k.js +0 -2
  198. package/dist/chunk-0bc3mwqd.js +0 -2
  199. package/dist/chunk-0gv2mmr0.js +0 -2
  200. package/dist/chunk-0j8zre1m.js +0 -2
  201. package/dist/chunk-0qwbhv3f.js +0 -33
  202. package/dist/chunk-1gfg6qmr.js +0 -2
  203. package/dist/chunk-1tqp2s13.js +0 -2
  204. package/dist/chunk-1y7kfp5d.js +0 -2
  205. package/dist/chunk-1ztp5vkh.js +0 -3
  206. package/dist/chunk-24e4dapm.js +0 -2
  207. package/dist/chunk-2qb9kp21.js +0 -25
  208. package/dist/chunk-32wvc376.js +0 -2
  209. package/dist/chunk-3te2y9qf.js +0 -2
  210. package/dist/chunk-447jc6zc.js +0 -2
  211. package/dist/chunk-51ymssz5.js +0 -2
  212. package/dist/chunk-6dz5za5z.js +0 -2
  213. package/dist/chunk-6ezt9kbe.js +0 -54
  214. package/dist/chunk-6grkdknk.js +0 -2
  215. package/dist/chunk-6q9a5bph.js +0 -2
  216. package/dist/chunk-6rqef7wp.js +0 -2
  217. package/dist/chunk-72p5annm.js +0 -33
  218. package/dist/chunk-74x6j229.js +0 -4
  219. package/dist/chunk-7j11vgm1.js +0 -3
  220. package/dist/chunk-7ngfcdv9.js +0 -2
  221. package/dist/chunk-7njy024g.js +0 -2
  222. package/dist/chunk-9e3ggwk7.js +0 -2
  223. package/dist/chunk-9mz2n39m.js +0 -2
  224. package/dist/chunk-a262spx7.js +0 -2
  225. package/dist/chunk-a8wn0snv.js +0 -2
  226. package/dist/chunk-af6m1s2b.js +0 -3
  227. package/dist/chunk-b1tcym2x.js +0 -2
  228. package/dist/chunk-b61dq7pz.js +0 -12
  229. package/dist/chunk-bdh73gxd.js +0 -4
  230. package/dist/chunk-bs7g6jtt.js +0 -2
  231. package/dist/chunk-bspj1rf1.js +0 -2
  232. package/dist/chunk-bx3hpsxn.js +0 -2
  233. package/dist/chunk-byq488g4.js +0 -2
  234. package/dist/chunk-c8pzj57b.js +0 -2
  235. package/dist/chunk-e2b2f502.js +0 -2
  236. package/dist/chunk-ec6mrad6.js +0 -2
  237. package/dist/chunk-eh2gec79.js +0 -2
  238. package/dist/chunk-em31p5pb.js +0 -2
  239. package/dist/chunk-eqfsw6x4.js +0 -2
  240. package/dist/chunk-ey1vwfpc.js +0 -24
  241. package/dist/chunk-fa57bncd.js +0 -2
  242. package/dist/chunk-fk79jbzn.js +0 -2
  243. package/dist/chunk-g97krv0d.js +0 -2
  244. package/dist/chunk-gn16yq49.js +0 -2
  245. package/dist/chunk-gvs61tqn.js +0 -2
  246. package/dist/chunk-h2928108.js +0 -2
  247. package/dist/chunk-hd5bny2c.js +0 -2
  248. package/dist/chunk-j1ytbd6r.js +0 -1184
  249. package/dist/chunk-jm7qa3v3.js +0 -2
  250. package/dist/chunk-jmjgj3nh.js +0 -2
  251. package/dist/chunk-jqtpzzz4.js +0 -12
  252. package/dist/chunk-kq8mffgf.js +0 -2
  253. package/dist/chunk-kx06jzdw.js +0 -2
  254. package/dist/chunk-n344ss97.js +0 -2
  255. package/dist/chunk-n5pvdrkb.js +0 -2
  256. package/dist/chunk-ne8q191s.js +0 -2
  257. package/dist/chunk-np8wgbsa.js +0 -3
  258. package/dist/chunk-p4e8myzj.js +0 -17
  259. package/dist/chunk-pp99rmjm.js +0 -72
  260. package/dist/chunk-pqmjeea6.js +0 -2
  261. package/dist/chunk-q0k2gmva.js +0 -2
  262. package/dist/chunk-qggwr60r.js +0 -2
  263. package/dist/chunk-qm3v4qb7.js +0 -2
  264. package/dist/chunk-qrn1nza9.js +0 -2
  265. package/dist/chunk-qty0t69x.js +0 -2
  266. package/dist/chunk-rzadf7vx.js +0 -20
  267. package/dist/chunk-snz2cxqv.js +0 -2
  268. package/dist/chunk-ts37jw3s.js +0 -2
  269. package/dist/chunk-vnrbjbrw.js +0 -3
  270. package/dist/chunk-wkb7dhp7.js +0 -2
  271. package/dist/chunk-wxyqp6g9.js +0 -2
  272. package/dist/chunk-x76qvq1n.js +0 -2
  273. package/dist/chunk-y4hn1qh0.js +0 -2
  274. package/dist/chunk-yc8ggeh2.js +0 -2
  275. package/dist/chunk-ydy0tfar.js +0 -2
  276. package/dist/chunk-yfed67yc.js +0 -2
@@ -1,1184 +0,0 @@
1
- // @bun
2
- import{Ke,Rn,to,Li,B}from"./chunk-kzc2tqzr.js";import{$n}from"./chunk-6ykfy7eh.js";import{zr,C,Tl,ft,Wi,$l}from"./chunk-fdjx4vs3.js";import{N}from"./chunk-3w7gacva.js";import{P,E,no,d,m,Ut,p,Y,W,k,io,Pe,Xe,ao}from"./chunk-pp99rmjm.js";import{n,se}from"./chunk-jqtpzzz4.js";import{b}from"./chunk-94mpe1ny.js";import{Z}from"./chunk-1ztp5vkh.js";import{c}from"./chunk-yxdhz4ps.js";import bt from"path";import Qt from"process";import{AsyncLocalStorage as Va}from"async_hooks";var Yr=new Va;function Sn(e){return e.__stx_server_data??={pending:new Map,values:new Map}}function Qr(e,t){return Yr.run(Sn(e),t)}async function ei(e,t){let i=Yr.getStore();if(!i)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 r=i.pending.get(e);if(r)return r;let a=Promise.resolve().then(t).then((l)=>{let u=JSON.stringify(l,(x,v)=>{if(v===void 0||typeof v==="function"||typeof v==="symbol"||typeof v==="bigint"||typeof v==="number"&&!Number.isFinite(v))throw TypeError(`useServerData(${JSON.stringify(e)}) requires JSON-serializable data`);if(v&&typeof v==="object"&&!Array.isArray(v)&&Object.getPrototypeOf(v)!==Object.prototype&&Object.getPrototypeOf(v)!==null)throw TypeError(`useServerData(${JSON.stringify(e)}) requires JSON-serializable data`);return v}),f=JSON.parse(u);return i.values.set(e,f),f}).catch((l)=>{throw i.pending.delete(e),l});return i.pending.set(e,a),a}function Ir(e){let t=e.__stx_server_data;if(!t?.values.size)return"";return`<script data-stx-scoped data-stx-server-data type="application/json">${JSON.stringify(Object.fromEntries(t.values)).replace(/</g,"\\u003c").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}</script>`}function K(e,t=!1){let i=n(e),r=[],a=new Set,l=0,u=0,f=i.length,x=()=>{if(l!==0)return;let v=i.slice(u).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*(?:[!:;,\n]|=(?!=)|$)/);if(v){if(t&&v[1]==="const")return;let z=v[2];if(!a.has(z))r.push(z),a.add(z);return}let A=i.slice(u).match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(A){if(t&&i.slice(u).startsWith("const"))return;A[1].split(",").forEach((z)=>{let D=z.trim();if(!D)return;let U=D.indexOf(":"),V=(U>=0?D.slice(U+1).trim():D).split(/[\s=]/)[0];if(V&&!a.has(V))r.push(V),a.add(V)});return}let M=i.slice(u).match(/^(?:const|let|var)\s+\[([^\]]+)\]\s*=/);if(M){if(t&&i.slice(u).startsWith("const"))return;M[1].split(",").forEach((z)=>{let D=z.trim().replace(/^\.\.\./,"");if(!D)return;let U=D.split(/[\s=]/)[0];if(U&&!a.has(U))r.push(U),a.add(U)});return}if(t)return;let H=i.slice(u).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(H){let z=H[1];if(!a.has(z))r.push(z),a.add(z);return}let O=i.slice(u).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(O){let z=O[1];if(!a.has(z))r.push(z),a.add(z)}};while(u<f){if(i[u]==="{"){l++,u++;continue}if(i[u]==="}"){l--,u++;continue}if(l===0&&/[a-z]/i.test(i[u])&&(u===0||/\s|[;{}()]/.test(i[u-1])))x();u++}return r.join(", ")}function Bs(e){return`{ enumerable: true, configurable: true, get() { return ${e} }, set(__stxValue_${e}) { ${e} = __stxValue_${e} } }`}function Ua(e,t=K(e).split(",").map((i)=>i.trim()).filter(Boolean)){let i=new Set(K(e,!0).split(",").map((r)=>r.trim()));return t.map((r)=>i.has(r)?`get ${r}() { return ${r} }, set ${r}(__stxValue_${r}) { ${r} = __stxValue_${r} }`:r).join(", ")}function Fs(e,t){let i=`{ ${Ua(e,t)} }`;return K(e).split(",").some((r)=>r.trim()==="__stxLiveBindings")?`Object.defineProperties(${i}, Object.getOwnPropertyDescriptors(__stxLiveBindings))`:i}import Kt from"fs";import De from"path";function G(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}var ti=new Map;function Cr(e,t=!0){let i=ti.get(e);if(t&&i)return i;let r=new Map,a=[De.join(e,"src"),De.join(e,"dist"),e];function l(u,f){if(f>6)return;let x;try{x=Kt.readdirSync(u,{withFileTypes:!0})}catch{return}for(let v of x){let A=De.join(u,v.name);if(v.isDirectory()){if(v.name==="node_modules"||v.name.startsWith("."))continue;l(A,f+1)}else if(v.isFile()&&v.name.endsWith(".stx")){let M=v.name.slice(0,-4);if(!r.has(M))r.set(M,A);let H=M.toLowerCase();if(!r.has(H))r.set(H,A);let O=G(M);if(!r.has(O))r.set(O,A)}}}for(let u of a)if(l(u,0),r.size>0)break;if(t)ti.set(e,r);return r}function zs(e,t){if(e.startsWith(".")||e.startsWith("/"))return null;let i=t;while(!0){let r=De.join(i,"node_modules",e);try{if(Kt.statSync(r).isDirectory())return r}catch{}let a=De.dirname(i);if(a===i)return null;i=a}}function Hs(e,t,i={}){return[De.resolve(De.dirname(t),`${e}.stx`),De.resolve(De.dirname(t),e),De.resolve(i.componentsDir||"components",`${e}.stx`),De.resolve(i.componentsDir||"components",e),e.endsWith(".stx")?e:`${e}.stx`]}function ni(e){let t=e.endsWith(".stx")?e.slice(0,-4):e,i=t.split("-").map((a)=>a.charAt(0).toUpperCase()+a.slice(1)).join(""),r=G(t);return[t,i,r]}function yi(e,t){let[i,r,a]=ni(e);for(let l of[i,i.toLowerCase(),r,a]){let u=t?.__importedComponents?.get(l);if(u!==void 0)return u}}function bi(e,t){let i=t?De.resolve(t):void 0,r=De.dirname(De.resolve(e));for(;;){if(Kt.existsSync(De.join(r,"package.json")))return i&&r===i?void 0:r;let a=De.dirname(r);if(a===r)return;r=a}}var Ha=["src/ui","src/components","components","dist"];function Jn(e,t){let i=De.resolve(e);if(!t&&!i.split(De.sep).includes("node_modules"))return[];let r=bi(i,t);if(!r)return[];let a=[];try{let f=JSON.parse(Kt.readFileSync(De.join(r,"package.json"),"utf8")).stx?.components;if(Array.isArray(f))a=f.filter((x)=>typeof x==="string")}catch{}let l=a.length?a:Ha;return[De.dirname(De.resolve(e)),...l.map((u)=>De.resolve(r,u))]}function*wi(e,t,i={},r){let a=ni(e);if(a[0].startsWith("./")||a[0].startsWith("../")){yield De.resolve(De.dirname(t),`${a[0]}.stx`);return}let l=[...new Set(a.map((x)=>`${x}.stx`))],u=i.projectRoot||process.cwd(),f=[...Jn(t,i.projectRoot),...r?.__originalFilePath?[De.join(De.dirname(r.__originalFilePath),"components")]:[],...i.componentsDir?[i.componentsDir]:[],De.join(De.dirname(t),"components"),De.resolve(u,"src/components"),De.resolve(u,"components"),...import.meta.dir?[De.resolve(import.meta.dir,"components")]:[]];for(let x of new Set(f)){for(let v of l)yield De.join(x,v);try{for(let v of Kt.readdirSync(x,{withFileTypes:!0}))if(v.isDirectory())for(let A of l)yield De.join(x,v.name,A)}catch{}}}function si(e,t,i={},r){let a=yi(e,r);if(a!==void 0)return a;for(let l of wi(e,t,i,r))try{if(Kt.statSync(l,{throwIfNoEntry:!1})?.isFile())return l}catch{}return null}function Vs(e,t=[],i={}){let r=new Set([...e].map((v)=>v.replace(/[-_]/g,"").toLowerCase()));if(!r.has("src")&&!r.has("source")||!r.has("alt")&&!r.has("decorative"))return!1;let a=new Map(Object.entries(i).map(([v,A])=>[v.replace(/[-_]/g,"").toLowerCase(),A])),l=a.get("alt"),u=a.get("decorative"),f=typeof l==="string"&&!!l.trim(),x=typeof u==="string"?!["false","0","off","no"].includes(u.trim().toLowerCase()):Boolean(u);if(!f&&!x)return!1;if(["defaultsource","provider","format","densities","quality","preload","modifiers","preset"].some((v)=>r.has(v)))return!1;if([...t].some((v)=>!["load","error"].includes(v.replace(/^@/,"").split(".")[0].toLowerCase())))return!1;if(r.has("resizemode")&&(r.has("fit")||r.has("objectfit")))return!1;if(r.has("src")&&r.has("source"))return!1;return["fit","objectfit","resizemode","position","objectposition","rounded","aspectratio","zoomonhover","sources","webpsrc","webpsrcset"].some((v)=>r.has(v))}import ys from"fs";import de from"path";import Ot from"path";import pn from"fs";var Za=new Set(["touchstart","touchmove","wheel","mousewheel"]);function Ps(e,t){if(t.passive)return!0;if(t.prevent||t.nonpassive)return!1;return Za.has(e.toLowerCase())}var ri=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"]),ii={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"},qa=new Set(["ctrl","alt","shift","meta"]),ci={left:0,middle:1,right:2};function oi(e){let t={prevent:!1,stop:!1,once:!1,capture:!1,self:!1,passive:!1,nonpassive:!1,keys:[],systemKeys:[],mouse:null,debounce:null,throttle:null};for(let i of e){let r=i.toLowerCase();if(r==="prevent")t.prevent=!0;else if(r==="stop")t.stop=!0;else if(r==="once")t.once=!0;else if(r==="capture")t.capture=!0;else if(r==="self")t.self=!0;else if(r==="passive")t.passive=!0;else if(r==="nonpassive")t.nonpassive=!0;else if(qa.has(r))t.systemKeys.push(r);else if(r in ci)t.mouse=r;else if(r in ii||/^[a-z]$/.test(r))t.keys.push(ii[r]||r.toUpperCase());else if(r.startsWith("debounce")){let a=r.match(/debounce(?:\.(\d+))?/);t.debounce=a?.[1]?Number.parseInt(a[1],10):300}else if(r.startsWith("throttle")){let a=r.match(/throttle(?:\.(\d+))?/);t.throttle=a?.[1]?Number.parseInt(a[1],10):300}}return t}function li(e,t=""){let i=[],r=0,a=/<([a-z][a-z0-9-]*)\s+([^>]*@[a-z][^>]*)>/gi,l;while((l=a.exec(e))!==null){let[u,f,x]=l,v=l.index,A=v+u.length,M=`__stx_evt_${t}${r++}`,H=[],O=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,z;while((z=O.exec(x))!==null){let[,U,q]=z,V=U.split("."),F=V[0];if(!ri.has(F))continue;H.push({attribute:`@${U}`,event:F,handler:q,modifiers:oi(V.slice(1)),elementId:M})}let D=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((z=D.exec(x))!==null){let[,U,q]=z,V=U.split("."),F=V[0];if(!ri.has(F))continue;H.push({attribute:`@${U}`,event:F,handler:q,modifiers:oi(V.slice(1)),elementId:M})}if(H.length>0)i.push({originalTag:u,elementId:M,events:H,startIndex:v,endIndex:A})}return i}function Ka(e){let t=[],{modifiers:i}=e;if(i.self)t.push("if ($event.target !== $el) return");for(let r of i.systemKeys)t.push(`if (!$event.${r}Key) return`);if(i.keys.length>0){let r=i.keys.map((a)=>`$event.key === '${a}'`).join(" || ");t.push(`if (!(${r})) return`)}if(i.mouse!==null){let r=ci[i.mouse];t.push(`if ($event.button !== ${r}) return`)}if(i.prevent)t.push("$event.preventDefault()");if(i.stop)t.push("$event.stopPropagation()");return t.join("; ")}function Ja(e,t){let i=e;if(t.debounce!==null)i=`__stx_debounce(() => { ${i} }, ${t.debounce})`;else if(t.throttle!==null)i=`__stx_throttle(() => { ${i} }, ${t.throttle})`;return i}function js(e){let t=e.trim();if(!/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(t))return e;return`if (typeof ${t} === 'function' && !${t}._isSignal) ${t}($event);`}function Xa(e){let{modifiers:t}=e,i=e.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),r=Ka(e),a=Ja(js(e.handler),t),l=[];if(t.once)l.push("once: true");if(t.capture)l.push("capture: true");if(Ps(e.event,t))l.push("passive: true");let u=l.length>0?`, { ${l.join(", ")} }`:"",f=a.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('${i}');
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('${f}', null, $el);
10
- }
11
- else {
12
- __stx_runHandler('${f}', null, $el);
13
- }
14
- })();`;if(e.event==="unmounted")return`
15
- (function() {
16
- var $el = document.getElementById('${i}');
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('${f}', null, $el);
27
- }
28
- else {
29
- __stx_runHandler('${f}', 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('${i}');
42
- if (!$el) return;
43
- // eslint-disable-next-line pickier/no-unused-vars
44
- $el.addEventListener('${e.event}', function($event) {
45
- ${r?r+";":""}
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('${f}', $event, $el);
50
- }
51
- else {
52
- // Fallback for non-reactive context (entity-safe; decoded + run in memory)
53
- __stx_runHandler('${f}', $event, $el);
54
- }
55
- }${u});
56
- })();`}function vi(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(Xa).join(`
112
- `)}
113
- })();
114
- </script>`}function Ga(e,t=""){let i=li(e,t);if(i.length===0)return{template:e,bindings:[]};let r=e,a=[];for(let l=i.length-1;l>=0;l--){let u=i[l],f=u.originalTag;if(!f.includes(" id="))f=f.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${u.elementId}"`);else{let x=f.match(/id=["']([^"']+)["']/);if(x)for(let v of u.events)v.elementId=x[1]}for(let x of u.events){let v=x.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),A=new RegExp(`\\s*${v}\\s*=\\s*"[^"]*"`,"g"),M=new RegExp(`\\s*${v}\\s*=\\s*'[^']*'`,"g");f=f.replace(A,""),f=f.replace(M,"")}r=r.slice(0,u.startIndex)+f+r.slice(u.endIndex),a.push(...u.events)}return{template:r,bindings:a}}function ai(e){let t=e.$uid;return typeof t==="string"&&t?`${t}_`:""}function Wc(e,t,i){if($l(e))return e;if(t.__stx_sfc_mode){if(/x-data\s*=\s*["']/.test(e))return e;let{template:f,bindings:x}=Ga(e,ai(t)),v=t.__stx_event_bindings||[];return t.__stx_event_bindings=[...v,...x],f}let r=li(e,ai(t));if(r.length===0)return e;let a=e;for(let f=r.length-1;f>=0;f--){let x=r[f],v=x.originalTag;if(!v.includes(" id="))v=v.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${x.elementId}"`);else{let A=v.match(/id=["']([^"']+)["']/);if(A)for(let M of x.events)M.elementId=A[1]}for(let A of x.events){let M=A.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),H=new RegExp(`\\s*${M}\\s*=\\s*"[^"]*"`,"g"),O=new RegExp(`\\s*${M}\\s*=\\s*'[^']*'`,"g");v=v.replace(H,""),v=v.replace(O,"")}a=a.slice(0,x.startIndex)+v+a.slice(x.endIndex)}let l=vi(r.flatMap((f)=>f.events)),u=c(a);if(u!==-1)a=a.slice(0,u)+l+`
115
- `+a.slice(u);else a+=l;return a}function ui(e,t){let i=new Set;for(let r of e.split(",")){let a=r.trim().replace(/^\.\.\./,"").trim();if(!a)continue;if(t){let l=a.lastIndexOf(":");if(l!==-1)a=a.slice(l+1).trim()}if(a=a.split("=")[0].trim(),/^[A-Za-z_$][\w$]*$/.test(a))i.add(a)}return i}function Dt(e,t){let i=n(e),{depths:r,balanced:a}=se(i),l=(f)=>!a||r[f]===0,u=new RegExp(`(?:^|[^\\w$.])((?:const|let|var|function|class)\\s+${t}\\b)`,"g");for(let f of i.matchAll(u)){let x=(f.index??0)+f[0].length-f[1].length;if(l(x))return!0}for(let f of i.matchAll(/(?:const|let|var)\s*\{([^}]*)\}/g))if(l(f.index??0)&&ui(f[1],!0).has(t))return!0;for(let f of i.matchAll(/(?:const|let|var)\s*\[([^\]]*)\]/g))if(l(f.index??0)&&ui(f[1],!1).has(t))return!0;return!1}var pi=new P(32,{maxBytes:2097152,sizeOf:(e)=>e.code.length*4}),Rt=/^[A-Za-z_$][\w$]*$/,Ya=new Set(["if","for","while","switch","with"]),fi=["(","[","{"],di=[")","]","}"],Qa=new Set(["const","let","var","return","if","for","while","do","switch","try","throw","export"]);function ec(e){let t=n(e),i=[];for(let r of t.matchAll(/[A-Za-z_$][\w$]*|=>|\.\.\.|[^\s]/g)){let a=r.index??0;i.push({text:r[0],start:a,end:a+r[0].length})}return{code:t,tokens:i}}function Ms(e){let t=pi.get(e);if(t)return t;let{code:i,tokens:r}=ec(e),a=new Map,l=[];for(let U=0;U<r.length;U++){let q=r[U].text;if(["(","[","{"].includes(q))l.push(U);else if([")","]","}"].includes(q)){let V=l.at(-1);if(V!==void 0&&["()","[]","{}"].includes(r[V].text+q))l.pop(),a.set(V,U),a.set(U,V)}}function u(U,q){let V=[],F=U;for(let Q=U;Q<q;Q++){if(["(","[","{"].includes(r[Q].text)&&(a.get(Q)??q)<q){Q=a.get(Q);continue}if(r[Q].text===",")V.push([F,Q]),F=Q+1}return V.push([F,q]),V}let f=[];function x(U,q,V,F=!1){if(r[U]?.text==="...")U++;if(U>=q)return;let Q=r[U].text;if(Rt.test(Q)){if(V.add(Q),V===M)f.push({name:Q,token:U,functionScoped:F});return}if(Q!=="{"&&Q!=="[")return;let ie=a.get(U);if(ie===void 0||ie>=q)return;for(let[oe,me]of u(U+1,ie)){let le=oe;if(Q==="{")for(let be=oe;be<me;be++){if(r[be].text===":"){le=be+1;break}if(r[be].text==="=")break;if(["(","[","{"].includes(r[be].text)&&a.has(be))be=a.get(be)}x(le,me,V,F)}}function v(U,q){let V=new Set;for(let[F,Q]of u(U,q))x(F,Q,V);return V}function A(U){let q=U;for(;q<r.length;q++){let V=r[q].text;if(["(","[","{"].includes(V)&&a.has(q)){q=a.get(q);continue}if([",",";",")","]","}"].includes(V))break}return r[Math.max(U,q-1)]?.end??i.length}let M=new Set,H=[];for(let U=0;U<r.length;U++)if(r[U].text==="=>"){let q=U-1,V=q,F;if(r[q]?.text===")"&&a.has(q))V=a.get(q),F=v(V+1,q);else if(r[q]&&Rt.test(r[q].text))F=new Set([r[q].text]);else continue;let Q=U+1,ie=r[Q]?.text==="{"&&a.has(Q)?r[a.get(Q)].end:A(Q);H.push({start:r[V].start,end:ie,bodyStart:r[Q]?.start??ie,functionBody:!0,names:F})}else if(r[U].text==="("&&a.has(U)){let q=r[U-1]?.text;if(!q||Ya.has(q)||!Rt.test(q)&&q!=="*"&&q!=="]")continue;let V=a.get(U),F=V+1;if(r[F]?.text===":"){F++;while(F<r.length&&!["{","=>",";","="].includes(r[F].text))F++}if(r[F]?.text!=="{"||!a.has(F))continue;H.push({start:r[U].start,end:r[a.get(F)].end,bodyStart:r[F].start,functionBody:q!=="catch",names:v(U+1,V)})}function O(U){let q=U;for(;q<r.length;q++){let V=r[q].text;if(fi.includes(V)&&a.has(q)){q=a.get(q);continue}if(V===";"||di.includes(V))break;let F=r[q-1];if(q>U&&Qa.has(V)&&F.text!==".")break;if(q>U&&/[\n\r]/.test(i.slice(F.end,r[q].start))&&(/^[\w$]+$/.test(F.text)||di.includes(F.text)||['"',"'","`"].includes(F.text))&&Rt.test(V)&&!["in","of","instanceof"].includes(V))break}return q}let z=[];for(let U=0;U<r.length;U++){if(r[U].text!=="for")continue;let q=r[U+1]?.text==="await"?U+2:U+1;if(r[q]?.text!=="("||!a.has(q))continue;let V=a.get(q),F=V+1,Q=r[F]?.text==="{"&&a.has(F)?a.get(F):O(F),ie=r[Q]?.text===";"||r[Q]?.text==="}"?r[Q].end:r[Math.max(F,Q-1)]?.end??i.length;z.push({headStart:q,headEnd:V,start:r[q].start,end:ie})}for(let U=0;U<r.length;U++){let q=r[U].text,V=r[U-1]?.text;if(V==="."||r[U+1]?.text===":")continue;if(V==="as"||V==="<")continue;if(q==="const"||q==="let"||q==="var"){let F=O(U+1),Q=U+1,ie=!1,oe=!1,me=0;for(let le=U+1;le<=F;le++){let be=r[le]?.text;if(le<F&&fi.includes(be)&&a.has(le)&&a.get(le)<F){le=a.get(le);continue}if(le<F&&be===":"&&!oe)ie=!0;else if(le<F&&be==="="&&me===0)ie=!1,oe=!0;else if(le<F&&ie&&be==="<")me++;else if(le<F&&ie&&be===">"&&me>0)me--;else if(le===F||be===","&&me===0)x(Q,le,M,q==="var"),Q=le+1,ie=!1,oe=!1}}else if(q==="function"||q==="class"){let F=U+1;if(r[F]?.text==="*")F++;if(r[F]&&Rt.test(r[F].text)&&r[F].text!=="extends")M.add(r[F].text),f.push({name:r[F].text,token:F})}else if(q==="import"){let F=U+1;if(r[F]?.text==="*"&&r[F+1]?.text==="as")F+=2;let Q=r[F]?.text;if(Q&&Rt.test(Q)&&Q!=="type"&&r[F+1]?.text!=="("&&r[F+1]?.text!==".")M.add(Q),f.push({name:Q,token:F,file:!0});let ie=r[F]?.text==="{"?F:r[F+1]?.text===","&&r[F+2]?.text==="{"?F+2:-1;if(ie!==-1&&a.has(ie)){let oe=a.get(ie);for(let[me,le]of u(ie+1,oe)){let be=le-1;while(be>=me&&!Rt.test(r[be].text))be--;if(be>=me&&r[be].text!=="type")f.push({name:r[be].text,token:be,file:!0})}}}}let D={code:i,scopes:H,loops:z,declarations:M,sites:f,tokens:r,pairs:a};return pi.set(e,D),D}function un(e){let t=Ms(e);return{code:t.code,shadows:(i,r)=>t.scopes.some((a)=>r>=a.start&&r<a.end&&a.names.has(i))}}function Xn(e){return new Set(Ms(e).declarations)}function Be(e,t){let{scopes:i,loops:r,sites:a,tokens:l,pairs:u}=Ms(e),f=Array.from({length:l.length},()=>-1),x=[];for(let O=0;O<l.length;O++){f[O]=x.length?x[x.length-1]:-1;let z=l[O].text;if(z==="{"&&u.has(O))x.push(O);else if(z==="}"&&x.length&&u.get(O)===x[x.length-1])x.pop()}let v=new Set,A=new Map;for(let O of a){if(!t.has(O.name))continue;v.add(O.token);let z=O.file?-1:f[O.token],D=z===-1?[0,Number.POSITIVE_INFINITY]:[l[z].start,l[u.get(z)].end];if(O.functionScoped){let q=l[O.token].start,V=i.filter((F)=>F.functionBody&&q>=F.bodyStart&&q<F.end).sort((F,Q)=>F.end-F.bodyStart-(Q.end-Q.bodyStart))[0];D=V?[V.bodyStart,V.end]:[0,Number.POSITIVE_INFINITY]}else if(!O.file){let q=r.filter((V)=>O.token>V.headStart&&O.token<V.headEnd).sort((V,F)=>V.headEnd-V.headStart-(F.headEnd-F.headStart))[0];if(q)D=[q.start,q.end]}let U=A.get(O.name);if(U)U.push(D);else A.set(O.name,[D])}let M=new Set;for(let O=0;O<l.length;O++){if(l[O].text!=="import"||l[O-1]?.text===".")continue;let z=O+1;if(l[z]?.text==="type")z++;if(l[z]&&Rt.test(l[z].text)&&l[z+1]?.text===",")z+=2;if(l[z]?.text==="{"&&u.has(z))for(let D=z+1;D<u.get(z);D++)M.add(D)}let H=new Set;for(let O=0;O<l.length;O++){let z=l[O].text;if(!t.has(z)||H.has(z)||v.has(O)||M.has(O))continue;let D=l[O-1]?.text;if(D==="#"||D==="."&&l[O-2]?.text!=="..")continue;if(l[O+1]?.text===":"&&(D==="{"||D===","))continue;let U=l[O].start;if(A.get(z)?.some(([q,V])=>U>=q&&U<V))continue;if(i.some((q)=>U>=q.start&&U<q.end&&q.names.has(z)))continue;H.add(z)}return H}var je="0.2.875";var gi=Symbol.for(`stx.lazy-module-promises.${je}`);function nc(){let e=globalThis;return e[gi]??=new Map,e[gi]}function o(e,t){let i=nc(),r=`${import.meta.url}\x00${e}`,a=i.get(r);if(a)return a;let l=t();return i.set(r,l),l.catch(()=>{if(i.get(r)===l)i.delete(r)}),l}var sc=/<\/(script)/gi;function pe(e){if(!e||e.indexOf("</")===-1)return e;return e.replace(sc,"<\\/$1")}import mi from"fs";var hi=[];function S(e){let t=new P(e);return hi.push(t),t}function qc(){for(let e of hi)e.clear()}function _(e,...t){return`${t.map((i)=>String(i??"")).join("\x00")}\x00${e.length}\x00${Bun.hash(e)}`}function Er(e){let t=[];for(let i of new Set(e))try{t.push({path:i,mtimeMs:mi.statSync(i).mtimeMs})}catch{}return t}function Us(e){for(let t of e)try{if(mi.statSync(t.path).mtimeMs!==t.mtimeMs)return!1}catch{return!1}return!0}var $e=["browserQuery","BrowserQueryBuilder","BrowserQueryError","browserAuth","configureBrowser","getBrowserConfig","createBrowserDb","createBrowserModel","isBrowser","debounce","throttle","retry","sleep","wait","delay","waitUntil","waitWhile","lazy","clamp","rand","readableSize","useActiveElement","useIntervalFn","useObjectUrl"];var rc=/^[ \t]*import\s+['"]([^'"]+?\.css)(\?[^'"]*)?['"]\s*;?\s*$/gm;function ic(e){if(e.startsWith(".")||e.startsWith("/"))return null;if(e.startsWith("@")){let i=e.match(/^(@[^/]+\/[^/]+)(\/.*)?$/);if(!i)return null;return{pkg:i[1],subpath:i[2]||""}}let t=e.match(/^([^/]+)(\/.*)?$/);if(!t)return null;return{pkg:t[1],subpath:t[2]||""}}function oc(e,t){let i=t;while(!0){let r=Ot.join(i,"node_modules",e,"package.json");if(pn.existsSync(r))return Ot.dirname(r);let a=Ot.dirname(i);if(a===i)return null;i=a}}function ac(e,t){if(!e||typeof e!=="object")return null;let i=(a)=>{if(typeof a==="string")return a;if(a&&typeof a==="object"){if(typeof a.import==="string")return a.import;if(typeof a.default==="string")return a.default;if(typeof a.import==="object")return i(a.import);if(typeof a.default==="object")return i(a.default)}return null};if(Object.prototype.hasOwnProperty.call(e,t))return i(e[t]);let r=null;for(let a of Object.keys(e)){let l=a.indexOf("*");if(l===-1)continue;let u=a.slice(0,l),f=a.slice(l+1);if(!t.startsWith(u)||!t.endsWith(f))continue;if(t.length<u.length+f.length)continue;if(!r||u.length>r.prefix.length)r={pattern:a,prefix:u,suffix:f}}if(r){let a=t.slice(r.prefix.length,t.length-r.suffix.length),l=i(e[r.pattern]);if(l)return l.replace("*",a)}return null}function cc(e,t){let i=ic(e);if(!i||!i.subpath)return null;let r=oc(i.pkg,t);if(!r)return null;let a;try{a=JSON.parse(pn.readFileSync(Ot.join(r,"package.json"),"utf8"))}catch{return null}let l=`.${i.subpath}`,u=ac(a.exports,l);if(!u)return null;let f=Ot.resolve(r,u);return pn.existsSync(f)?f:null}function Ai(e,t){let i=t.filePath?Ot.dirname(t.filePath):t.projectRoot||process.cwd(),r=t.projectRoot||process.cwd(),a=new Set,l=[],u=[];return{code:e.replace(rc,(x,v)=>{let A;try{if(v.startsWith("./")||v.startsWith("../")||v.startsWith("/")){if(A=v.startsWith("/")?v:Ot.resolve(i,v),!pn.existsSync(A))throw Error(`file not found: ${A}`)}else{let M=null;try{M=Bun.resolveSync(v,r)}catch{M=cc(v,r)}if(!M)throw Error(`could not resolve ${v} (Bun.resolveSync + exports fallback both failed)`);A=M}}catch(M){return console.warn(`[stx:vendor-css] could not resolve ${JSON.stringify(v)} (from ${t.filePath||"<unknown>"}): ${M?.message||M}`),u.push(v),""}if(a.has(A))return"";a.add(A);try{let M=pn.readFileSync(A,"utf8");l.push({source:v,resolvedPath:A,contents:M})}catch(M){console.warn(`[stx:vendor-css] could not read ${A}: ${M?.message||M}`),u.push(v)}return""}),styles:l,unresolved:u}}function lc(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Pi(e){if(e.length===0)return"";return`${e.map((t)=>`<style data-stx-vendor="${lc(t.source)}" data-stx-layer="vendor">
116
- @layer vendor {
117
- ${t.contents}
118
- }
119
- </style>`).join(`
120
- `)}
121
- `}var Cg=C,ji=S(256);function zt(e){let t=_(e),i=ji.get(t);if(!i)i=uc(e),ji.set(t,i);return{code:i.code,imports:[...i.imports],models:[...i.models]}}function uc(e){let t=n(e),i=new Set;for(let f of e.matchAll(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm))for(let x of f[1].split(",")){let v=x.trim().split(/\s+as\s+/).pop()?.replace(/^type\s+/,"").trim();if(v)i.add(v)}let r=Xn(t),a=$e.filter((f)=>{if(i.has(f)||r.has(f))return!1;return Eg(t,f,!0)}),l=Fi(t).filter((f)=>!i.has(f)&&!r.has(f));if(a.length===0&&l.length===0)return{code:e,imports:a,models:l};return{code:`${[a.length>0?`import { ${a.join(", ")} } from '@stacksjs/browser'`:"",l.length>0?"import '@stacksjs/browser'":"",l.length>0?`const { ${l.join(", ")} } = window.StacksBrowser || {}`:""].filter(Boolean).join(`
122
- `)}
123
- ${e}`,imports:a,models:l}}var pc=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 Fi(e,t=un(e)){let i=new Set,r=Xn(e),a=/(?<![\w$.])([A-Z][a-zA-Z0-9]*)\s*\.\s*(all|find|first|get|where|orderBy|orderByDesc|limit|select|pluck|create|update|delete)\s*\(/g;for(let l of t.code.matchAll(a)){let u=l[1];if(pc.has(u)||r.has(u)||u.length<3)continue;if(t.shadows(u,l.index??0))continue;i.add(u)}return Array.from(i)}function fc(e){return Xn(e)}var Mi=S(128);function ul(e){let t=_(e),i=Mi.get(t);if(!i)i=dc(e),Mi.set(t,i);return{code:i.code,stxImports:[...i.stxImports],browserImports:[...i.browserImports]}}function dc(e){let t=new Set,i=new Set,r=e;r=r.replace(/^[ \t]*import\s+type\s+\{[^}]*\}\s+from\s+['"][^'"]+['"][ \t]*;?[ \t]*$/gm,"// [type import stripped]");let a=new Set,l=/^[ \t]*import\s+(?:type\s+)?{\s*([^}]+)\s*}\s+from\s+['"](@stacksjs\/browser|@stacksjs\/stx|stx)['"][ \t]*;?[ \t]*$/gm,u;while((u=l.exec(e))!==null){let O=u[1],z=u[2];if(u[0].includes("import type"))continue;let D=[];for(let q of O.split(",")){let V=q.trim();if(!V||V.startsWith("type "))continue;let F=V.match(/^([A-Za-z_$][\w$]*)(?:\s+as\s+([A-Za-z_$][\w$]*))?$/);if(!F)continue;let Q=F[1],ie=F[2]||Q;if(a.add(Q),a.add(ie),z==="stx"||z==="@stacksjs/stx")t.add(Q);else i.add(Q);if(ie!==Q)D.push(`${ie} = ${Q}`)}let U=D.length>0?`var ${D.join(", ")}; /* [auto-import processed] */`:"// [auto-import processed]";r=r.replace(u[0],U)}let f=fc(r),x=un(r);for(let O of Cg){if(a.has(O)||f.has(O))continue;if(Ds(x,O,!0))t.add(O)}let v=n(r),A=un(v),M=new Set;for(let O of r.matchAll(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm))for(let z of O[1].split(",")){let D=z.trim().replace(/^type\s+/,"").split(/\s+as\s+/);for(let U of D){let q=U.trim();if(q)M.add(q)}}for(let O of $e){if(a.has(O)||f.has(O)||M.has(O))continue;if(Ds(A,O))i.add(O)}let H=Fi(v,A);for(let O of H)if(!a.has(O)&&!f.has(O))i.add(O);return{code:r,stxImports:Array.from(t),browserImports:Array.from(i)}}function Eg(e,t,i=!1){return Ds(un(e),t,i)}function Ds(e,t,i=!1){let r=e.code,a=new RegExp(`\\b${t.replace(/[$]/g,"\\$")}\\b`,"g");for(let l of r.matchAll(a)){let u=l.index??0;if(e.shadows(t,u))continue;let f=u+t.length,x=u-1;while(x>=0&&/\s/.test(r[x]))x--;if(r[x]==="."&&r.slice(Math.max(0,x-2),x+1)!=="...")continue;let v=f;while(v<r.length&&/\s/.test(r[v]))v++;if(r[v]===":"&&r[v+1]!==":"&&(r[x]==="{"||r[x]===","))continue;if(i&&!/^\s*(?:<[^>]*>)?\s*\(/.test(r.slice(f)))continue;if(gc(r,f))continue;return!0}return!1}function gc(e,t){let i=t;while(i<e.length&&(e[i]===" "||e[i]==="\t"))i++;if(e[i]!=="(")return!1;let r=0;for(;i<e.length;i++){let a=e[i];if(a==="(")r++;else if(a===")"){if(r--,r===0)break}}if(r!==0)return!1;i++;while(i<e.length&&(e[i]===" "||e[i]==="\t"))i++;return e[i]==="{"}function dl(e,t){let i=[];if(e.length>0)i.push(` var { ${e.join(", ")} } = window.stx || window;`);if(t.length>0)i.push(` var { ${t.join(", ")} } = window.StacksBrowser || {};`);if(i.length>0)return` // STX: auto-imported from stx and @stacksjs/browser
124
- ${i.join(`
125
- `)}
126
- ${mc(e,t)}`;return""}function hy(e,t=[]){let{browserImports:i}=ul(e),r=new Set(t);return dl([],i.filter((a)=>!r.has(a)))}function mc(e,t){let i=[...e.map((r)=>`['${r}', typeof ${r}, 'stx']`),...t.map((r)=>`['${r}', typeof ${r}, '@stacksjs/browser']`)];if(i.length===0)return"";return` // STX: report auto-imports the client runtime did not provide
127
- [${i.join(", ")}].forEach(function (e) {
128
- if (e[1] !== 'undefined') return;
129
- console.error(
130
- '[stx] "' + e[0] + '" is used in this client script and auto-imported from ' + e[2] + ', '
131
- + 'but the client runtime does not provide it. Either it is not exported to the browser, '
132
- + 'or it should be imported from a relative path so the bundler includes it.'
133
- );
134
- });
135
- `}function He(e){let t=e.__stxClientPayload;if(t&&typeof t==="object"){let r={};for(let a in t){let l=t[a];if(typeof l==="function")continue;r[a]=l}return r.__stxDeclaredPayload=!0,r}let i={};for(let r in e){if(r.startsWith("__")||r.startsWith("$"))continue;let a=e[r];if(typeof a==="function")continue;i[r]=a}return i}var hc=/token|secret|passw|apikey|api_key|privatekey|private_key|credential|webhook|bearer|jwt|signature/i,zi=new Set;function xc(e,t){let i=hc.test(e),r=t.length>32768;if(!i&&!r)return;if(zi.has(e))return;if(zi.add(e),i)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(r)console.warn(`[stx] server\u2192client bridge is publishing ${(t.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 _n(e,t){if(!t)return"";let i=Be(e,new Set(Object.keys(t))),r=t.__stxDeclaredPayload===!0,a=[],l=Object.entries(t).sort(([u],[f])=>u<f?-1:u>f?1:0);for(let[u,f]of l){if(!/^[A-Za-z_$][\w$]*$/.test(u))continue;if(u.startsWith("__")||u.startsWith("$"))continue;if(!r&&!i.has(u))continue;if(Dt(e,u)){if(r)console.warn(`[stx] defineClientPayload declares "${u}", but this client block also declares "${u}" at the top level, so the server value is not published (emitting it would be a duplicate binding). Rename the local, or drop "${u}" from defineClientPayload.`);continue}let x;try{x=JSON.stringify(f)}catch{continue}if(x===void 0)continue;xc(u,x),a.push(` var ${u} = ${x.replace(/</g,"\\u003c")};`)}if(a.length===0)return"";return` // stx: server -> client data bridge (seeded from server scope)
136
- ${a.join(`
137
- `)}
138
- `}var bc={left:0,middle:1,right:2};function yc(e){let t=[];if(e.self)t.push("if ($event.target !== $el) return");for(let i of e.systemKeys)t.push(`if (!$event.${i}Key) return`);if(e.keys.length>0){let i=e.keys.map((r)=>`$event.key === '${r}'`).join(" || ");t.push(`if (!(${i})) return`)}if(e.mouse!==null){let i=bc[e.mouse];t.push(`if ($event.button !== ${i}) return`)}if(e.prevent)t.push("$event.preventDefault()");if(e.stop)t.push("$event.stopPropagation()");return t.join("; ")}function wc(e,t){let{elementId:i,event:r,modifiers:a}=e,l=js(e.handler),u=yc(a),f=[];if(a.once)f.push("once: true");if(a.capture)f.push("capture: true");if(Ps(r,a))f.push("passive: true");let x=f.length>0?`, { ${f.join(", ")} }`:"",v="";if(u)v+=`${u}; `;let A=l.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),M=`var $emit = function(name, detail) {
139
- $el.dispatchEvent(new CustomEvent(name, { detail: detail, bubbles: true, cancelable: true }))
140
- };`;function H(O){if(/\$emit\s*\(/.test(O))return`${M}
141
- ${O}`;return`var scope = $el.closest('[data-stx-scope]');
142
- if (scope && scope.__stx_execute) {
143
- scope.__stx_execute('${A}', $event, $el);
144
- }
145
- else {
146
- ${O}
147
- }`}if(a.debounce!==null)return` ;(function() {
148
- // eslint-disable-next-line pickier/no-unused-vars
149
- var $el = document.getElementById('${i}')
150
- if (!$el) return
151
- var __timer
152
- $el.addEventListener('${r}', function($event) {
153
- ${u?u+"; ":""}clearTimeout(__timer)
154
- __timer = setTimeout(function() { ${H(l)} }, ${a.debounce})
155
- }${x})
156
- })()`;if(a.throttle!==null)return` ;(function() {
157
- // eslint-disable-next-line pickier/no-unused-vars
158
- var $el = document.getElementById('${i}')
159
- if (!$el) return
160
- var __last = 0
161
- $el.addEventListener('${r}', function($event) {
162
- ${u?u+"; ":""}var __now = Date.now()
163
- if (__now - __last >= ${a.throttle}) {
164
- __last = __now
165
- ${H(l)}
166
- }
167
- }${x})
168
- })()`;if(/\$emit\s*\(/.test(l))return` var $el = document.getElementById('${i}')
169
- if ($el) $el.addEventListener('${r}', function($event) {
170
- ${v}${M}
171
- ${l}
172
- }${x})`;return` var $el = document.getElementById('${i}')
173
- if ($el) $el.addEventListener('${r}', function($event) {
174
- ${v}var scope = $el.closest('[data-stx-scope]');
175
- if (scope && scope.__stx_execute) {
176
- scope.__stx_execute('${A}', $event, $el);
177
- }
178
- else {
179
- ${l}
180
- }
181
- }${x})`}function _c(e){if(e.length===0)return"";return`
182
- // STX: auto-generated event bindings
183
- ${e.map((i,r)=>wc(i,r)).join(`
184
- `)}`}function Bi(e){let t=[],i=new Set,r=e.replace(/^\s*import\s+.*$/gm,""),a=0,l=r.length,u=0;while(u<l){let f=r[u];if(f==="'"||f==='"'||f==="`"){let x=f;if(u++,x==="`"){let v=0;while(u<l){if(r[u]==="\\"){u+=2;continue}if(r[u]==="`"&&v===0){u++;break}if(r[u]==="$"&&r[u+1]==="{"){v++,u+=2;continue}if(r[u]==="}"&&v>0){v--,u++;continue}u++}}else while(u<l){if(r[u]==="\\"){u+=2;continue}if(r[u]===x){u++;break}u++}continue}if(f==="/"&&r[u+1]==="/"){while(u<l&&r[u]!==`
185
- `)u++;continue}if(f==="/"&&r[u+1]==="*"){u+=2;while(u<l-1&&!(r[u]==="*"&&r[u+1]==="/"))u++;u+=2;continue}if(f==="{"){a++,u++;continue}if(f==="}"){a--,u++;continue}if(a===0){let x=r.slice(u),v=x.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(v){let H=v[1];if(!H.startsWith("_")&&!i.has(H))t.push(H),i.add(H);u+=v[0].length;continue}let A=x.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(A){A[1].split(",").forEach((H)=>{let O=H.trim(),z=O.indexOf(":"),D=z>=0?O.slice(z+1).trim().split(/[\s=]/)[0]:O.split(/[\s=]/)[0];if(D&&!D.startsWith("_")&&!i.has(D))t.push(D),i.add(D)}),u+=A[0].length;continue}let M=x.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(M){let H=M[1];if(!H.startsWith("_")&&!i.has(H))t.push(H),i.add(H);u+=M[0].length;continue}}u++}return t}var $c=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 vc(e){let t=new Set,i=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function r(H){let O;while((O=i.exec(H))!==null){let z=O[0];if(!$c.has(z))t.add(z)}}let a=/\{\{([\s\S]*?)\}\}/g,l;while((l=a.exec(e))!==null)r(l[1]);let u=/:[a-z][\w.-]*\s*=\s*"([^"]*)"/gi;while((l=u.exec(e))!==null)r(l[1]);let f=/:[a-z][\w.-]*\s*=\s*'([^']*)'/gi;while((l=f.exec(e))!==null)r(l[1]);let x=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((l=x.exec(e))!==null)r(l[1]);let v=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((l=v.exec(e))!==null)r(l[1]);let A=/@model\s*=\s*["']([^"']*)["']/gi;while((l=A.exec(e))!==null)r(l[1]);let M=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((l=M.exec(e))!==null)r(l[1]);return t}async function Ve(e,t={}){let i=e,r="",a=!1,l=[],u=Ai(i,{filePath:t.filePath,projectRoot:t.projectRoot});i=u.code;let f=Pi(u.styles),x=zt(i);i=x.code,l=[...x.imports,...x.models];let{hasUserImports:v,bundleClientScript:A}=await o("stx/client-script-bundler",()=>import("./chunk-em31p5pb.js"));if(v(i))i=await A(i,t.filePath||"",{projectRoot:t.projectRoot,minify:t.production}),a=!0;if(t.autoImports!==!1){let F=ul(i);i=F.code,r=dl(F.stxImports,F.browserImports.filter((Q)=>!l.includes(Q)))}if(r=`${_n(i,t.serverData)}${r}`,i=N(i),!a&&Ue(t.attrs||""))i=We(i);let M=_c(t.eventBindings||[]),H=(t.attrs||"").trim(),O=/\btype\s*=\s*["']module["']/i.test(H),z=t.instanceId?` data-stx-instance="${t.instanceId}"`:"";if(O){let F=H.replace(/\btype\s*=\s*["']module["']/i,"").trim(),Q=`type="module" data-stx-scoped${z}${F?` ${F}`:""}`;return`${f}<script ${Q}>
186
- ${pe(`${r}${i}
187
- ${M}`)}
188
- </script>`}let D=Wi(e),U=/function __stx_setup_/.test(i),q=/\bstx\.mount\s*\(|\bstx\.mountEl\s*\(/.test(e);function V(F){let Q=F.length>0?`
189
- return ${Fs(i,F)};`:"",ie=JSON.stringify(`[stx] client block failed${t.filePath?` (${t.filePath})`:""}; this block will not hydrate`);return`${f}<script data-stx-scoped data-stx-run="always"${z}>
190
- window.stx.mount(function() {
191
- 'use strict';
192
- try {
193
- ${pe(`${r}${i}
194
- ${M}${Q}`)}
195
- } catch (error) {
196
- console.error(${ie}, error);
197
- return {};
198
- }
199
- })</script>`}if(!q&&!U){if(D)return V(Bi(e));if(t.templateContent){let F=Bi(e);if(F.length>0){let Q=vc(t.templateContent);if(F.some((oe)=>Q.has(oe)))return V(F)}}}return`${f}<script data-stx-scoped data-stx-run="always"${z}>
200
- ;(function() {
201
- 'use strict';
202
- try {
203
- ${pe(`${r}${i}
204
- ${M}`)}
205
- } catch (error) {
206
- console.error(${JSON.stringify(`[stx] client block failed${t.filePath?` (${t.filePath})`:""}; this block will not hydrate`)}, error);
207
- }
208
- })()</script>`}import{createHash as Ic}from"crypto";var Ns=/\s*/y,Ls=/\x00STX_HTML_COMMENT_\d+\x00/y;function Mt(e){let t=0;while(t<e.length){if(Ns.lastIndex=t,Ns.exec(e),t=Ns.lastIndex,e.startsWith("<!--",t)){let i=e.indexOf("-->",t+4);if(i===-1)return t;t=i+3;continue}if(Ls.lastIndex=t,Ls.test(e)){t=Ls.lastIndex;continue}return t}return t}var er=/<(\/?)([a-zA-Z][a-zA-Z0-9-]*)\b/y,Sc=new Map(["textarea","title","xmp","iframe","noembed","noframes"].map((e)=>[e,new RegExp(`</${e}\\s*>`,"ig")]));function Lt(e){let t=[],i=0;while(i<e.length){let r=e.indexOf("<",i);if(r===-1)break;if(e.startsWith("<!--",r)){let H=e.indexOf("-->",r+4);if(H===-1)break;i=H+3;continue}er.lastIndex=r;let a=er.exec(e);if(!a){i=r+1;continue}let l=er.lastIndex,u=l,f=null;for(;u<e.length;u++){let H=e[u];if(f){if(H===f)f=null}else if(H==='"'||H==="'")f=H;else if(H===">")break}if(u===e.length)break;let x=a[1]==="/",v=e[u-1]==="/";t.push({start:r,end:u+1,name:a[2],attributes:e.slice(l,v?u-1:u),closing:x,selfClosing:v}),i=u+1;let A=a[2].toLowerCase();if(!x&&A==="plaintext")break;let M=Sc.get(A);if(!x&&(A==="script"||A==="style"||M)){let H=M??(A==="script"?Qn:es);H.lastIndex=i;let O=H.exec(e);if(!O)break;i=O.index}}return t}var Gn=/<script\b[^>]*>/iy,Qn=/<\/script\s*>/ig,Yn=/<style\b[^>]*>/iy,es=/<\/style\s*>/ig;function Vi(e,t,i,r){i.lastIndex=t;let a=i.exec(e);if(!a||a.index!==t)return-1;r.lastIndex=i.lastIndex;let l=r.exec(e);if(!l)return-1;return l.index+l[0].length}function J(e,t){return Vi(e,t,Gn,Qn)}function bn(e,t){return Vi(e,t,Yn,es)}function ze(e,t){if(!e.startsWith("<!--",t))return-1;let i=e.indexOf("-->",t+4);if(i===-1)return-1;return i+3}function Ui(e,t){if(e.startsWith("<!--",t)){let a=ze(e,t);return a===-1?e.length:a}if(Gn.lastIndex=t,Gn.exec(e)?.index===t){Qn.lastIndex=Gn.lastIndex;let a=Qn.exec(e);return a?a.index+a[0].length:e.length}if(Yn.lastIndex=t,Yn.exec(e)?.index===t){es.lastIndex=Yn.lastIndex;let a=es.exec(e);return a?a.index+a[0].length:e.length}return-1}function w(e,t){let i=[],r=0,a=e.length,l=!1,u=null;while(r<a){let f=e[r];if(l){if(u){if(f===u)u=null}else if(f==='"'||f==="'")u=f;else if(f===">")l=!1;r++;continue}if(f!=="<"){let M=e.indexOf("<",r+1);if(M===-1)break;r=M;continue}let x=t(e,r);if(x>r){i.push({start:r,end:x,token:e.slice(r,x)}),r=x;continue}let v=Ui(e,r);if(v>r){r=v;continue}let A=e.charCodeAt(r+1);if(A>=65&&A<=90||A>=97&&A<=122)l=!0;r++}return i}function Hi(e){let t=0,i=0,r=0,a=!1,l=null;while(r<e.length){if(a){let M=e[r];if(l){if(M===l)l=null}else if(M==='"'||M==="'")l=M;else if(M===">")a=!1;r++;continue}let u=e.indexOf("<",r),f=u===-1?e.length:u;while(r<f){let M=e[r++];if(M==="{")t++;else if(M==="}")i++;if(t>=2&&i>=2)return!0}if(u===-1)break;let x=Ui(e,u);if(x>u){r=x;continue}let v=e.charCodeAt(u+1),A=v===47?e.charCodeAt(u+2):v;if(A>=65&&A<=90||A>=97&&A<=122)a=!0;r=u+1}return!1}function Kc(e,t){while(e.size>=t){let i=e.keys().next();if(i.done)return;e.delete(i.value)}}var Ec=1024,kc=16777216,Jt=new Map,tr=0;function Cc(e,t){Jt.set(e,t),tr+=e.length+t.output.length;for(let[i,r]of Jt){if(tr<=kc)break;Jt.delete(i),tr-=i.length+r.output.length}}function we(e,t,i,r){let a=r!==void 0&&e.length>=Ec,l=a?`${r}\x00${e}`:"";if(a){let A=Jt.get(l);if(A)return Jt.delete(l),Jt.set(l,A),{output:A.output,tokens:A.tokens.slice()}}let u=w(e,t);if(u.length===0)return{output:e,tokens:[]};let f=u.map((A)=>A.token),x="",v=0;for(let A=0;A<u.length;A++){let M=u[A];x+=e.slice(v,M.start),x+=i(M.token,A),v=M.end}if(x+=e.slice(v),a)return Cc(l,{output:x,tokens:f}),{output:x,tokens:f.slice()};return{output:x,tokens:f}}var Rc=1024,Ac=16777216,Xt=new Map,nr=0;function Tc(e,t){Xt.set(e,t),nr+=e.length+t.output.length;for(let[i,r]of Xt){if(nr<=Ac)break;Xt.delete(i),nr-=i.length+r.output.length}}function sr(e,t,i){return{output:t,scripts:i,restore:(r)=>r===t?e:Tr(r,i)}}function ee(e){let t=e.length>=Rc;if(t){let a=Xt.get(e);if(a)return Xt.delete(e),Xt.set(e,a),sr(e,a.output,a.scripts.slice())}let{output:i,tokens:r}=we(e,J,(a,l)=>`\x00STX_SCRIPT_${l}\x00`);if(t)return Tc(e,{output:i,scripts:r}),sr(e,i,r.slice());return sr(e,i,r)}function Tr(e,t){if(t.length===0)return e;return e.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(i,r)=>t[+r]??"")}var ts="__stx_component_client_factories";function ns(e){let t=e[ts];return t instanceof Map?t:null}function il(e){e[ts]=new Map}function rr(e,t){let i=ns(e);if(!i)return null;let r=Ic("sha256").update(t).digest("hex").slice(0,16),a=i.get(r);if(a)a.instances++;else i.set(r,{body:t,instances:1});return r}function al(e,t){let i=ns(t);if(!i?.size)return e;let r=new Map;for(let[A,M]of i)if(M.instances===1)r.set(A,M.body);let a=[];if(r.size>0){let A=[...r.keys()].map((O)=>JSON.stringify(O).replace(/[$()*+.?[\\\]^{|}]/g,"\\$&")).join("|"),M=new RegExp(`window\\.__stxComponentFactories\\[(${A})\\]\\(("[^"]+")\\);`,"g"),H=M.exec(e);while(H!==null){let O=r.get(JSON.parse(H[1]));if(O!==void 0)a.push({start:H.index,end:H.index+H[0].length,replacement:pe(`(${O})(${H[2]});`)});H=M.exec(e)}}let l=[...i].filter(([,A])=>A.instances>1);if(l.length===0)return Zi(e,a);let u=l.map(([A,M])=>` try { factories[${JSON.stringify(A)}] = factories[${JSON.stringify(A)}] || ${M.body}; }
209
- catch (e) { console.error('[stx] component factory ' + ${JSON.stringify(A)} + ' failed to register; instances of it will not hydrate.', e); }`).join(`
210
- `),f=`<script data-stx-scoped data-stx-run="always" data-stx-component-factories>
211
- (function() {
212
- const factories = window.__stxComponentFactories = window.__stxComponentFactories || {};
213
- ${pe(u)}
214
- })();
215
- </script>`,x,v=/<(?:template\b|script\b(?=[^>]*\bdata-stx-scoped\b))/iy;return w(e,(A,M)=>{if(x===void 0){if(v.lastIndex=M,v.test(A))x=M}return-1}),a.push({start:x??0,end:x??0,replacement:`${f}
216
- `}),Zi(e,a)}function Zi(e,t){if(t.length===0)return e;t.sort((l,u)=>l.start-u.start||l.end-u.end);let i=Array(t.length*2+1),r=0,a=0;for(let l of t)i[a++]=e.slice(r,l.start),i[a++]=l.replacement,r=l.end;return i[a]=e.slice(r),i.join("")}function qi(e){let t=ns(e),i=new Map;if(t)for(let[r,a]of t)i.set(r,a.instances);return i}function Ki(e,t){let i=ns(e);if(!i)return[];let r=[];for(let[a,l]of i){let u=l.instances-(t.get(a)??0);if(u>0)r.push({body:l.body,count:u})}return r}function Ji(e,t){for(let{body:i,count:r}of t)for(let a=0;a<r;a++)rr(e,i)}function Te(e,t,i=2){let r=0,a=null;for(let l=t+i;l<e.length;l++){let u=e[l];if(a){if(u==="\\"){l++;continue}if(u===a)a=null;continue}if(u==='"'||u==="'"||u==="`"){a=u;continue}if(u==="{"){r++;continue}if(u==="}"){if(r>0){r--;continue}let f=0;while(e[l+f]==="}")f++;if(f>=i)return l}}return-1}import co from"fs";var Xi=0,ir=new Map;function ml(){Xi=0,ir.clear()}function ss(e,t){let i=Xi++,r=`<!--__STX_${e.toUpperCase()}_${i}__-->`;return ir.set(r,{type:e,expression:t}),r}function hl(){let e={};for(let[t,i]of ir)e[t]={type:i.type,expression:i.expression};return e}function yl(e,t){let i=e;for(let[r,a]of t)i=i.split(r).join(a);return i}function Oi(e){return e.includes("<!--__STX_")}var Oc=/@(?=[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 Pc(e){return Array.from({length:e},()=>"&#123;").join("&#8288;")}function Gi(e){return e.replace(/\{{2,}/g,(t)=>Pc(t.length)).replace(/\{(?=!)/g,"&#123;&#8288;").replace(Oc,"&#64;")}function Rr(e,t,i=!1){let{openTag:r,tail:a}=i?jc(e,t):Mc(e).at(t);return Nc(a,r,i)}function jc(e,t){let i="",r=0;for(let u=0;u<t;u++){if(!e.startsWith("{{",u))continue;let f=Te(e,u);if(f<0||f+2>t)break;i+=e.slice(r,u)+"x",u=f+1,r=f+2}i+=e.slice(r,t);let a=-1,l=null;for(let u=0;u<i.length;u++){let f=i[u];if(l){if(f===l)l=null;continue}if(f==='"'||f==="'"){l=f;continue}if(f===">"){a=-1;continue}if(f==="<")a=u}return{openTag:a,tail:a>=0?i.slice(a+1):i}}var rs=null;function Mc(e){if(rs&&rs.source===e)return rs.scanner;let t=Dc(e);return rs={source:e,scanner:t},t}function Dc(e){let t=0,i=-1,r=null,a=-1,l=(f,x)=>{let v=e[f];if(x.quote){if(v===x.quote)x.quote=null;return}if(x.openTag>=0){if(v==='"'||v==="'"){x.quote=v;return}if(v===">"){x.openTag=-1;return}}if(v==="<")x.openTag=f},u=(f,x)=>{if(x.openTag>=0||!e.startsWith("<!--",f))return-1;let v=e.indexOf("-->",f+4);return v<0?e.length:v+3};return{at(f){if(f<t)t=0,i=-1,r=null,a=-1;let x={openTag:i,quote:r},v=!1;while(t<f){if(a<0&&e.startsWith("{{",t)){let D=Te(e,t);if(D<0)a=t;else if(D+2<=f){t=D+2;continue}else break}let z=u(t,x);if(z>=0){if(z>f){v=!0;break}t=z;continue}l(t,x),t++}if(i=x.openTag,r=x.quote,v)return{openTag:-1,tail:""};let A=a>=0?a:t,M={openTag:i,quote:r};for(let z=t;z<f;z++){let D=u(z,M);if(D>=0){if(D>f)return{openTag:-1,tail:""};z=D-1;continue}l(z,M)}if(M.openTag<0)return{openTag:-1,tail:""};let H="",O=M.openTag+1;for(let z=O;z<Math.min(f,A);z++){if(!e.startsWith("{{",z))continue;let D=Te(e,z);H+=e.slice(O,z)+"x",z=D+1,O=D+2}return H+=e.slice(O,f),{openTag:M.openTag,tail:H}}}}function Nc(e,t,i){if(t<0&&!i)return null;if(t>=0&&/^\s*[!/?]/.test(e))return/^\s*\/?\s*$/.test(e)?{kind:"tag-name"}:null;if(t>=0&&/^\s*$/.test(e))return{kind:"tag-name"};let r=0;if(t>=0)while(r<e.length&&!/\s/.test(e[r]))r++;while(r<e.length){while(/\s/.test(e[r]??"")&&r<e.length)r++;let a=r;while(r<e.length&&!/[\s=/>]/.test(e[r]))r++;let l=e.slice(a,r);if(!l)break;while(r<e.length&&/\s/.test(e[r]))r++;if(e[r]!=="=")continue;r++;while(r<e.length&&/\s/.test(e[r]))r++;let u=e[r];if(u==='"'||u==="'"){let f=++r,x=e.indexOf(u,r);if(x===-1)return{kind:"attribute",name:l,quote:u,valuePrefix:e.slice(f)};r=x+1}else{let f=r;while(r<e.length&&!/\s/.test(e[r]))r++;if(r===e.length)return{kind:"attribute",name:l,quote:null,valuePrefix:e.slice(f)}}}return{kind:"tag"}}class fe extends Error{attribute;near;constructor(e,t){super(`Unsafe interpolation in ${e}: ${t}`);this.name="UnsafeInterpolationContextError",this.attribute=e}locate(e,t){if(this.near===void 0)this.near=e.slice(Math.max(0,t-160),t).replace(/\s+/g," ").trim(),this.message+=` (after: ${JSON.stringify(this.near)})`;return this}}var Yi="unsafe:";var Lc=/^(?:javascript|vbscript|livescript|mocha|view-source):/,zc=/^data:(?:text\/html|text\/xml|application\/xhtml\+xml|application\/xml|image\/svg\+xml)/,Bc=/^data:(?:text\/html|application\/xhtml\+xml)/,Fc=new RegExp("[\\u0000-\\u0020\\u00A0\\u1680\\u2000-\\u200F\\u2028\\u2029\\u202F\\u205F\\u3000\\uFEFF]+","g");function Vc(e){return e.replace(Fc,"").toLowerCase()}function or(e){let t=e.toLowerCase();if(new RegExp("^(?:href|xlink:href|action|formaction|ping|cite|manifest|data|to)$").test(t))return"navigable";if(new RegExp("^(?:src|srcset|poster|background)$").test(t))return"fetched";return null}function is(e,t="navigable"){let i=Vc(e);if(Lc.test(i))return!0;return t==="navigable"?zc.test(i):Bc.test(i)}function $r(e,t="navigable"){return is(e,t)?"unsafe:"+e:e}function Uc(e){let t=e.match(/(?:^|[\s"'`/])([A-Za-z][\w:-]*)\s*=\s*(["'])([^"']*)$/);if(!t)return null;if(t[3].trim()!=="")return null;return or(t[1])}function Qi(e,t,i=256){if(t<=i)return e.slice(0,t);let r=e.slice(t-i,t),a=r.search(/[\s"'`/]/);return a===-1?"":r.slice(a)}function so(e,t,i=t){let r=Uc(e);return r&&is(t,r)?"unsafe:"+i:i}function jt(e){let t=e.indexOf(" as ");if(t!==-1){let l=e.slice(0,t).trim(),u=e.slice(t+4).trim();return l&&u?{arrayExpr:l,itemVar:u}:null}let i=/^\s*(.+?)\s+in\s+([\s\S]+)$/.exec(e);if(!i)return null;let r=i[1].trim().replace(/^\(([\s\S]*)\)$/,"$1").trim(),a=i[2].trim();return r&&a?{arrayExpr:a,itemVar:r}:null}function os(e){let t=[],i=0,r="",a=0;for(let l=0;l<e.length;l++){let u=e[l];if(r){if(u==="\\")l++;else if(u===r)r="";continue}if(u==="'"||u==='"'||u==="`")r=u;else if(u==="("||u==="["||u==="{")i++;else if(u===")"||u==="]"||u==="}")i--;else if(u===","&&i===0)t.push(e.slice(a,l)),a=l+1}return t.push(e.slice(a)),t}function ro(e,t){let i=0;for(let r=0;r<e.length;r++){let a=e[r];if(a==="("||a==="["||a==="{")i++;else if(a===")"||a==="]"||a==="}")i--;else if(a===t&&i===0)return r}return-1}function oo(e){let t=0;for(let i=0;i<e.length;i++){let r=e[i];if(r==="("||r==="["||r==="{")t++;else if((r===")"||r==="]"||r==="}")&&--t===0)return i}return-1}function Pt(e,t){let i=e.trim().replace(/^\.\.\./,"").trim(),r=ro(i,"=");if(r!==-1&&i[r+1]!==">")i=i.slice(0,r).trim();if(!i)return;if(i.startsWith("{")&&i.endsWith("}")){for(let a of os(i.slice(1,-1))){let l=a.trim();if(!l)continue;if(l.startsWith("...")){Pt(l,t);continue}let u=ro(l,":");Pt(u===-1?l:l.slice(u+1),t)}return}if(i.startsWith("[")&&i.endsWith("]")){for(let a of os(i.slice(1,-1)))Pt(a,t);return}if(/^[A-Z_$][\w$]*$/i.test(i))t.push(i)}function te(e){let t=e.trim(),i=[],r=0;for(let l=0;l<t.length;l++){let u=t[l];if(u==="("||u==="["||u==="{")r++;else if(u===")"||u==="]"||u==="}")r--;else if(r===0&&/\s/.test(u)){if(!/^\s+(?:in|of)\s/.exec(t.slice(l)))continue;let x=t.slice(0,l).trim();if(x.startsWith("(")&&oo(x)===x.length-1)x=x.slice(1,-1);for(let v of os(x))Pt(v,i);if(i.length>0)return i;break}}let a=/^[\s\S]+?\s+as\s+([\s\S]+)$/.exec(t);if(a){let l=a[1].trim();if(l.startsWith("(")&&oo(l)===l.length-1)l=l.slice(1,-1);let u=/^([\w$]+)\s*=>\s*([\s\S]+)$/.exec(l);if(u)Pt(u[2],i),Pt(u[1],i);else for(let f of os(l))Pt(f,i)}return i}function j(e,t){let i=t instanceof Set?t:new Set(t);if(i.size===0)return!1;let u=e.replace(/'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"/g," ").replace(/`(?:[^`\\$]|\\.|\$(?!\{))*`/g," ").replace(/\??\.\s*[a-zA-Z_$][\w$]*/g," ").replace(/([{,]\s*)[a-zA-Z_$][\w$]*(\s*:(?!:))/g,"$1$2");for(let f of u.match(/[a-zA-Z_$][\w$]*/g)||[])if(i.has(f))return!0;return!1}var as="__stx_client_loop_names";function lt(e){let t=e?.[as];return Array.isArray(t)?t:[]}function cs(e){if(!e.includes("#")&&!e.includes("v-slot:")&&!e.includes("data-stx-slot-binding"))return[];let t=[],i=[],r=/<!--[\s\S]*?-->|<script\b(?:"[^"]*"|'[^']*'|[^'">])*>[\s\S]*?<\/script\s*>|<style\b(?:"[^"]*"|'[^']*'|[^'">])*>[\s\S]*?<\/style\s*>|<\/?[a-z][\w:-]*\b(?:"[^"]*"|'[^']*'|[^'">])*>/gi;for(let a of e.matchAll(r)){let l=a[0];if(/^<\/template\s*>$/i.test(l)){let u=i.pop();if(u)u.end=a.index}else if(/^<template\b/i.test(l)&&!/\/\s*>$/.test(l)){let f=[...l.slice(9).matchAll(/([^\s=/>]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+)))?/g)].find((A)=>/^(?:#[\w-]+|v-slot:[\w-]+|data-stx-slot-binding)$/i.test(A[1])),x=(f?.[2]??f?.[3])?.trim();if(x&&f?.[1]==="data-stx-slot-binding")try{x=decodeURIComponent(x)}catch{x=void 0}let v=x?{start:a.index+l.length,end:e.length,binding:x}:void 0;if(i.push(v),v)t.push(v)}}return t}var dn={},lo=new Map;function Hc(e){let t=lo.get(e);if(!t){let i=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");t=new RegExp(`:${i}(?!\\w)`,"g"),lo.set(e,t)}return t.lastIndex=0,t}var eo={uppercase:(e,t)=>e!==void 0&&e!==null?String(e).toUpperCase():"",lowercase:(e,t)=>e!==void 0&&e!==null?String(e).toLowerCase():"",capitalize:(e,t)=>{if(e===void 0||e===null)return"";let i=String(e);return i.charAt(0).toUpperCase()+i.slice(1)},number:(e,t,i=0)=>{if(e===void 0||e===null)return"";try{let r=Number(e);return Number.isNaN(r)?"":r.toFixed(Number.parseInt(String(i),10))}catch{return""}},fmt:(e,t,i="en-US")=>{if(e===void 0||e===null)return"";try{let r=Number(e);if(Number.isNaN(r))return String(e);return r.toLocaleString(i)}catch{return String(e)}},join:(e,t,i=",")=>{if(!Array.isArray(e))return"";return e.join(String(i))},escape:(e,t)=>{if(e===void 0||e===null)return"";return X(String(e))},translate:(e,t,i={})=>{if(!t||!t.__translations)return e;let r=t.__translations,a=t.__i18nConfig?.fallbackToKey??!0,l=String(e).split("."),u=r;for(let x of l){if(u===void 0||u===null)break;u=u[x]}if(u===void 0||u===null)return a?e:"";let f=String(u);return Object.entries(i).forEach(([x,v])=>{f=f.replace(Hc(x),()=>String(v))}),f},t:(e,t,i={})=>eo.translate(e,t,i),truncate:(e,t,i=50,r="...")=>{if(e===void 0||e===null)return"";let a=String(e);if(a.length<=i)return a;if(i<=r.length)return r.substring(0,i);return a.substring(0,i-r.length)+r},date:(e,t,i="short",r="en-US")=>{if(e===void 0||e===null)return"";try{let a=e instanceof Date?e:new Date(e);if(Number.isNaN(a.getTime()))return String(e);let l={short:{dateStyle:"short"},medium:{dateStyle:"medium"},long:{dateStyle:"long"},full:{dateStyle:"full"},time:{timeStyle:"short"},datetime:{dateStyle:"short",timeStyle:"short"},iso:{}};if(i==="iso")return a.toISOString();return new Intl.DateTimeFormat(r,l[i]||l.short).format(a)}catch{return String(e)}},currency:(e,t,i="USD",r="en-US")=>{if(e===void 0||e===null)return"";try{let a=Number(e);if(Number.isNaN(a))return String(e);return new Intl.NumberFormat(r,{style:"currency",currency:i}).format(a)}catch{return String(e)}},pluralize:(e,t,i,r)=>{let a=Number(e);if(Number.isNaN(a))return i;let l=r||`${i}s`;return a===1?i:l},first:(e,t)=>{if(e===void 0||e===null)return"";if(Array.isArray(e))return e.length===0?"":e[0];return String(e).charAt(0)},last:(e,t)=>{if(e===void 0||e===null)return"";if(Array.isArray(e))return e.length===0?"":e[e.length-1];let i=String(e);return i.charAt(i.length-1)},length:(e,t)=>{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,t,i=!1)=>{if(e===void 0)return"undefined";if(e===null)return"null";try{return i?JSON.stringify(e,null,2):JSON.stringify(e)}catch{return String(e)}},default:(e,t,i="")=>e===void 0||e===null||e===""?i:e,reverse:(e,t)=>{if(e===void 0||e===null)return"";if(Array.isArray(e))return[...e].reverse();return String(e).split("").reverse().join("")},slice:(e,t,i=0,r)=>{if(e===void 0||e===null)return"";if(Array.isArray(e)||typeof e==="string")return e.slice(i,r);return e},replace:(e,t,i,r="")=>{if(e===void 0||e===null)return"";let a=i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return String(e).replace(new RegExp(a,"g"),()=>r)},stripTags:(e,t)=>{if(e===void 0||e===null)return"";return String(e).replace(/<[^>]*>/g,"")},urlencode:(e,t)=>{if(e===void 0||e===null)return"";return encodeURIComponent(String(e))},abs:(e,t)=>{let i=Number(e);return Number.isNaN(i)?0:Math.abs(i)},round:(e,t,i=0)=>{let r=Number(e);if(Number.isNaN(r))return 0;let a=10**i;return Math.round(r*a)/a}};function Dg(e,t){if(e in eo)console.warn(`Filter "${e}" already exists as a built-in filter. Custom filter will take precedence.`);dn[e]=t}function by(e){for(let[t,i]of Object.entries(e))Dg(t,i)}function Mg(){return{...eo,...dn}}function wy(){for(let e of Object.keys(dn))delete dn[e]}function ho(e){let t=e.next();while(!t.done)t=e.next();return t.value}function*xo(e,t,i,r){let a="{".repeat(i);if(!e.includes(a))return e;let l="",u=0,f=0,x=r===Number.POSITIVE_INFINITY?0:performance.now();for(;;){let v=e.indexOf(a,u);if(v===-1)break;let A=Te(e,v,i);if(A===-1)break;if(l+=e.slice(u,v)+t(e.slice(v,A+i),e.slice(v+i,A),v),u=A+i,++f>=64){f=0;let M=performance.now();if(M-x>=r)x=M,yield}}return u===0?e:l+e.slice(u)}function En(e,t,i=2){return ho(xo(e,t,i,Number.POSITIVE_INFINITY))}function xl(e,t,i){let r=i[0];if(r!=="'"&&r!=='"'&&r!=="`")return!1;let a=Rr(e,t);if(!a||a.kind!=="attribute"||a.quote===r)return!1;if(!/^(?::|@|x-|v-)/.test(a.name))return!1;let l=0;for(let u=0;u<a.valuePrefix.length;u++)if(a.valuePrefix[u]==="\\")u++;else if(a.valuePrefix[u]===r)l++;return l%2===1}function g(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function X(e){return Gi(g(e))}function bl(e){return e.replace(/ /g,"&#32;").replace(/\t/g,"&#9;").replace(/\n/g,"&#10;").replace(/\r/g,"&#13;").replace(/\f/g,"&#12;").replace(/=/g,"&#61;").replace(/`/g,"&#96;")}function wl(e){return e.replace(/\/\*[\s\S]*?\*\//g,"").replace(/\\([\dA-Fa-f]{1,6})\s?/g,(t,i)=>String.fromCodePoint(Number.parseInt(i,16))).replace(/\\([^\r\n])/g,"$1").replace(/[\u0000-\u0020]+/g,"").toLowerCase()}function _l(e,t){let i=wl(e);if(/@import|expression\(|behavior:|-moz-binding|(?:image-set|cross-fade)\(/.test(i))throw new fe(t,"network-capable or executable CSS is not allowed in an escaped interpolation");let r=/url\(([^)]*)\)/g,a;while((a=r.exec(i))!==null){let l=a[1].replace(/^["']|["']$/g,""),u=l.startsWith("/")&&!l.startsWith("//")||l.startsWith("./")||l.startsWith("../")||l.startsWith("#"),f=/^data:image\/(?:avif|bmp|gif|jpeg|jpg|png|webp);base64,[a-z\d+/=]+$/i.test(l);if(!u&&!f)throw new fe(t,"CSS URLs must be local paths or base64 raster images")}}function re(e,t,i,r=!1,a=0){try{return vl(e,t,i,r,a)}catch(l){if(l instanceof fe)l.locate(e,t);throw l}}function vl(e,t,i,r,a){let l=Rr(e,t,r),u=X(i);if(!l)return u;if(l.kind==="tag-name"){if(!/^[A-Za-z][A-Za-z0-9:-]*$/.test(i))throw new fe("tag name","dynamic tag names may contain only letters, digits, colons, and hyphens");return i}if(l.kind==="tag"){let v=e.slice(t+a).trimStart(),A=i.trim();if(!v.startsWith("=")&&(A===""||A.split(/\s+/).every((M)=>/^(?!on)[A-Za-z_:][\w:.-]*$/.test(M))))return A;throw new fe("tag structure","only standalone boolean attributes may be interpolated into tag structure")}let f=l.name.toLowerCase();if(/^on[a-z]/.test(f))throw new fe(l.name,"native event-handler attributes execute JavaScript; use an @event binding instead");if(f==="srcdoc")u=X(u);if(f==="style")_l(i,l.name);if(l.quote===null)u=bl(u);let x=or(f);if(x&&l.valuePrefix.trim()===""&&is(i,x))return Yi+u;return so(Qi(e,t),i,u)}function Tn(e,t){let i=` ${e}="`;return re(i,i.length,t,!0)}function bo(e){return e.flatMap((t)=>{let i=t.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i);return!i||/\bserver\b|\bsrc\s*=/.test(i[1])?[]:[i[2]]})}function Re(e,t){let{scripts:i}=ee(e);for(let r of bo(i)){if(/\b(state|derived|effect|ref|reactive|computed|watch|watchEffect|useModel)\s*(?:<[^>]*>)?\s*\(/.test(r)||fl.test(r))return!0;if(zr(r,t))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 Lg(e){let t=[],i=/<([a-zA-Z][\w-]*)\b[^>]*?\s(?::for|x-for|@for)\s*=\s*(["'])([\s\S]*?)\2[^>]*>/g;for(let r=i.exec(e);r;r=i.exec(e)){let a=r[1].toLowerCase(),l=new Set(te(r[3]));if(l.size===0)continue;let u=r.index+r[0].length;if(r[0].endsWith("/>")){t.push({start:r.index,end:u,names:l});continue}let f=new RegExp(`<(/?)${a}\\b[^>]*?(/?)>`,"gi");f.lastIndex=u;let x=1,v=e.length;for(let A=f.exec(e);A;A=f.exec(e)){if(A[2]==="/")continue;if(x+=A[1]==="/"?-1:1,x===0){v=A.index+A[0].length;break}}t.push({start:r.index,end:v,names:l})}return t}function uo(e,t,i){let r=n(i);for(let a of e){if(t<a.start||t>=a.end)continue;for(let l of a.names)if(new RegExp(`(?<![.#\\w$])${l.replace(/\$/g,"\\$")}(?![\\w$])`).test(r))return!0}return!1}function po(e,t){let i=["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"],r=e.replace(/'[^']*'/g,"").replace(/"[^"]*"/g,""),a="",l=!1,u=0;for(let v=0;v<r.length;v++){let A=r[v];if(!l&&A==="`"){l=!0,u=0;continue}if(l){if(A==="`"&&u===0){l=!1;continue}if(A==="$"&&r[v+1]==="{"){u++,v++,a+=" ";continue}if(A==="}"&&u>0){u--;continue}if(u>0){a+=A;continue}continue}a+=A}r=a;let f=/(?<![a-zA-Z0-9_$])([a-zA-Z_$][a-zA-Z0-9_$]*)/g,x;while((x=f.exec(r))!==null){let v=x[1];if(!r.substring(0,x.index).trimEnd().endsWith(".")){if(!i.includes(v)&&!(v in t))return!1}}return!0}function Sl(e,t){let i=n(e);for(let r of i.matchAll(/(?<![.\w$])([A-Z_$][\w$]*)\s*\(/gi))if(typeof t[r[1]]==="function")return!0;return!1}function El(e,t){let i=t.__stx_serverDeclared;if(!i||i.size===0)return!1;let r=n(e);for(let a of i)if(new RegExp(`(?<![.#\\w$])${a}(?![\\w$])`).test(r))return!0;return!1}var fo=new Set;function go(e){return/^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*)*$/.test(e.trim())}function kl(e,t,i){let r=i[0];if(r!=="'"&&r!=='"'&&r!=="`")return!1;let a=0;for(let l=e.lastIndexOf(`
217
- `,t-1)+1;l<t;l++)if(e[l]==="\\")l++;else if(e[l]===r)a++;return a%2===1}function mo(e,t){let i=`${t??"<unknown>"}\x00${e}`;if(process.env.STX_DEBUG||!fo.has(i))fo.add(i),console.warn(`[stx] {{ ${e} }} in a <script> in ${t??"<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 Ni(e,t,i){let r=e;return r=r.replace(/\{!!([\s\S]*?)!!\}/g,(a,l)=>{try{let u=I(l,t);if(u===void 0)return go(l)?mo(l.trim(),i):a;return u===null?"":String(u)}catch{return a}}),r=En(r,(a,l,u)=>{let f=l.trim();if(kl(r,u,l))return a;if(/^__[A-Z_]+__$/.test(f))return a;try{let x=I(l,t);if(x===void 0)return go(f)?mo(f,i):a;return JSON.stringify(x).replace(/</g,"\\u003c").replace(/@/g,"\\u0040").replace(/\{{2,}/g,(v)=>"\\u007b".repeat(v.length)).replace(/\{(?=!)/g,"\\u007b")}catch{return a}}),r}function jg(e,t){if(!e.includes("{"))return e;let i=e;return i=i.replace(/\{!!([\s\S]*?)!!\}/g,(r,a)=>{try{let l=I(a,t);if(l===void 0)return r;return l===null?"":String(l)}catch{return r}}),i=En(i,(r,a,l)=>{let u=a.trim();if(/^__[A-Z_]+__$/.test(u))return r;try{let f=I(a,t);if(f===void 0)return r;if(f===null)return"";let x=String(f);return re(i,l,x,!0,r.length)}catch(f){if(f instanceof fe)throw f;return r}}),i}function vy(e,t,i={}){let{output:r,scripts:a}=ee(e),l=a.map((u)=>{let f=u.match(/^<script\b((?:[^>\"']|\"[^\"]*\"|'[^']*')*)>/i),x=u.search(/<\/script\s*>$/i);if(!f||x===-1)return u;let v=f[1],A=u.slice(f[0].length,x);if(/\bdata-raw\b/.test(v))return u;if(i.skipServer&&/\bserver\b/.test(v))return u;let H=`<script${jg(v,t)}>`;if(/\bsrc\s*=/.test(v)||/\btype\s*=\s*["']application\/json["']/.test(v))return H+A+u.slice(x);return H+Ni(A,t)+u.slice(x)});return Tr(r,l)}function*yo(e,t,i,r){let a=e,l=(D,U)=>{let q=bn(D,U);if(q===-1)return-1;return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(D.slice(U,q))?-1:q},u=(D,U,q,V)=>{let F=q.length,{output:Q,tokens:ie}=we(D,U,(oe,me)=>V(F+me));return q.push(...ie),Q},f=[];a=u(a,l,f,(D)=>`<!--__STX_STYLE_${D}__-->`);let x=[];a=u(a,J,x,(D)=>`<!--__STX_SCRIPT_EXPR_${D}__-->`);let v=t?.__stx_signals_gate===!0||Re(e),A=new Set([...Array.isArray(t?.__stx_client_signal_names)?t.__stx_client_signal_names:[],...Ii(bo(x))]),M=new Set(Array.isArray(t?.__stx_preserved_client_expressions)?t.__stx_preserved_client_expressions:[]);a=En(a,(D,U,q)=>{if(j(U,A))return D;try{let V=I(U,t,!1,(F)=>ar(F,D,i,e));return V!==void 0&&V!==null?String(V):""}catch(V){let F=V instanceof Error?V.message:String(V);return y("Expression",`Error evaluating: {{{ ${U.trim()}}}}: ${F}`,i,e,q,D)}},3),a=a.replace(/\{!!([\s\S]*?)!!\}/g,(D,U,q)=>{if(j(U,A))return D;try{let V=I(U,t,!1,(F)=>ar(F,D,i,e));if(V===void 0&&t.__stx_buildMode==="compile")return ss("raw",U.trim());return V!==void 0&&V!==null?String(V):""}catch(V){if(t.__stx_buildMode==="compile")return ss("raw",U.trim());let F=V instanceof Error?V.message:String(V);return y("Expression",`Error evaluating: {!! ${U.trim()} !!}: ${F}`,i,e,q,D)}}),a=u(a,J,x,(D)=>`<!--__STX_SCRIPT_EXPR_${D}__-->`),a=u(a,l,f,(D)=>`<!--__STX_STYLE_${D}__-->`);let H=v?Lg(a):[],O=cs(a).map((D)=>({...D,names:new Set(te(`${D.binding} in __slot`))})),z=new Set(lt(t));if(a=yield*xo(a,(D,U,q)=>{let V=U.trim();if(xl(a,q,U))return D;if(uo(O,q,V))return D;if(j(V,z))return D;if(H.length>0&&uo(H,q,V))return D;if(M.has(V))return D;let F=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined"],Q=/^([a-zA-Z_$][a-zA-Z0-9_$]*)/,oe=V.match(Q)?.[1],me=oe&&((oe in t)||F.includes(oe)),le=/^([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/,be=V.match(le),Ae=be&&!F.includes(be[1])&&!(be[1]in t);if(/^__[A-Z_]+__$/.test(V))return"";if(j(V,A))return D;if(t.__stx_native_screen===!0&&Sl(V,t))return D;let ke;try{let ye=I(U,t,!1,(Ge)=>{ke=Ge});if(v&&!po(V,t))return D;if(ke)ar(ke,D,i,e);if(t.__stx_buildMode==="compile"&&!v&&(ye===void 0||El(V,t)))return ss("expr",V);if(ye===void 0||ye===null)return"";let Je=String(ye);return re(a,q,Je,!1,D.length)}catch(ye){if(ye instanceof fe)throw ye;if(v&&!po(V,t))return D;if(Ae)return D;let Je=ye instanceof Error?ye.message:String(ye);return y("Expression",`Error evaluating: {{ ${V} }}: ${Je}`,i,e,q,D)}},2,r),x.length>0)a=a.replace(/<!--__STX_SCRIPT_EXPR_(\d+)__-->/g,(D,U)=>x[Number(U)]??D);if(f.length>0)a=a.replace(/<!--__STX_STYLE_(\d+)__-->/g,(D,U)=>f[Number(U)]??D);return a}function R(e,t,i){return ho(yo(e,t,i,Number.POSITIVE_INFINITY))}var Cl=100;async function Di(e,t,i,r=Cl){let a=yo(e,t,i,r),l=a.next();while(!l.done)await E(),l=a.next();return l.value}function Bg(e,t,i){if(!t.trim())return e;let r=e,a=t.trim();while(a.length>0){let l=a.match(/^(\w+)/);if(!l)break;let u=l[1];a=a.substring(u.length).trim();let f=dn[u]||eo[u];if(!f)throw Error(`Filter not found: ${u}. Available filters: ${Object.keys(Mg()).join(", ")}`);let x=[];if(a.startsWith(":")){let v=a.match(/^:([^|\s]+)/);if(v){let A=v[1].trim();try{let M=Number(A);x=[Number.isNaN(M)?A:M]}catch{x=[A]}a=a.substring(v[0].length).trim()}}else if(a.startsWith("(")){let v=1,A=1;while(v>0&&A<a.length){if(a[A]==="(")v++;if(a[A]===")")v--;A++}if(v===0){let M=a.substring(1,A-1).trim();if(M)try{if(M.startsWith("{")&&M.endsWith("}"))x=[I(`(${M})`,i,!0)];else{let H=[],O="",z=null,D=0,U=0,q=0,V=!1;for(let F=0;F<M.length;F++){let Q=M[F];if(V){O+=Q,V=!1;continue}if(Q==="\\"){O+=Q,V=!0;continue}if(z){if(O+=Q,Q===z)z=null;continue}if(Q==='"'||Q==="'"||Q==="`"){z=Q,O+=Q;continue}if(Q==="(")D++;else if(Q===")")D--;else if(Q==="[")U++;else if(Q==="]")U--;else if(Q==="{")q++;else if(Q==="}")q--;if(Q===","&&D===0&&U===0&&q===0){H.push(O),O="";continue}O+=Q}if(O)H.push(O);x=H.map((F)=>{let Q=F.trim();return I(Q,i,!0)})}}catch{x=[M]}a=a.substring(A).trim()}}try{r=f(r,i,...x)}catch(v){let A=v instanceof Error?v.message:String(v);throw Error(`Error applying filter '${u}': ${A}`)}if(a.startsWith("|"))a=a.substring(1).trim();else break}return r}function Rl(e){let t=!1,i="",r=0,a=0,l=0,u=!1;for(let f=0;f<e.length;f++){let x=e[f],v=e[f+1];if(t&&u){u=!1;continue}if(t&&x==="\\"){u=!0;continue}if(u=!1,(x==='"'||x==="'"||x==="`")&&!u){if(!t)t=!0,i=x;else if(x===i)t=!1,i="";continue}if(t&&i==="`"&&x==="$"&&v==="{"){let A=1;f+=2;while(f<e.length&&A>0){if(e[f]==="{")A++;else if(e[f]==="}")A--;if(A>0)f++}continue}if(t)continue;if(x==="(")r++;else if(x===")")r--;else if(x==="[")a++;else if(x==="]")a--;else if(x==="{")l++;else if(x==="}")l--;if(x==="|"&&r===0&&a===0&&l===0){if(v==="|"){f++;continue}if(v==="="){f++;continue}return f}}return-1}var fn=new Set,Al=1000;function xy(){fn.clear()}function ar(e,t,i,r){if(!Z())return;let a=`${i}\x00${e.expression}`;if(fn.has(a))return;if(fn.size>=Al)fn.clear();fn.add(a);let l=i,u=r;try{if(i&&co.existsSync(i))u=co.readFileSync(i,"utf8")}catch{}let f=u.indexOf(t);if(f>=0)l=`${i}:${u.slice(0,f).split(`
218
- `).length}`;console.warn(`${l}: stx warning: ${t} 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 I(e,t,i=!1,r){try{let a=e.trim(),l=Rl(a);if(l>0){let f=a.substring(0,l).trim(),x=a.substring(l+1).trim(),v=I(f,t,!0,r);return Bg(v,x,t)}let u=no(a);if(u!==null){r?.({expression:a,rule:u});return}try{let f=Object.keys(t),x=Object.values(t);return p(a,f)(...x)}catch{return d(a,t)}}catch(a){if(a instanceof ReferenceError){let l=/(\b\w+)\s+is not defined/.exec(a.message);if(l){let u=l[1],f=Il(u,Object.keys(t));if(f&&f!==u)a.message=`${a.message} \u2014 did you mean '${f}'?`}}if(!i)console.error(`Error evaluating expression: ${e}`,a);throw a}}function Il(e,t){let i=null;for(let a of t){if(a===e)continue;let l=Ol(e,a);if(i===null||l<i.dist)i={key:a,dist:l}}if(!i)return null;let r=Math.max(e.length,i.key.length);if(i.dist<=2||i.dist/r<=0.35)return i.key;return null}function Ol(e,t){if(e===t)return 0;if(e.length===0)return t.length;if(t.length===0)return e.length;let[i,r]=e.length<t.length?[e,t]:[t,e],a=Array(i.length+1),l=Array(i.length+1);for(let u=0;u<=i.length;u++)a[u]=u;for(let u=1;u<=r.length;u++){l[0]=u;for(let f=1;f<=i.length;f++){let x=i[f-1]===r[u-1]?0:1;l[f]=Math.min(l[f-1]+1,a[f]+1,a[f-1]+x)}for(let f=0;f<=i.length;f++)a[f]=l[f]}return a[i.length]}function Sy(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 Pl from"process";function T(e="STX_PUBLIC_"){let t={},i={};for(let[r,a]of Object.entries(Pl.env)){if(!r.startsWith(e)||a===void 0)continue;t[`import.meta.env.${r}`]=JSON.stringify(a),i[r]=a}return t["import.meta.env"]=JSON.stringify(i),t}function wo(e,t=""){let i=`${e}${t}`,r=0;for(let a=0;a<i.length;a++){let l=i.charCodeAt(a);r=(r<<5)-r+l,r=r&r}return`stx-${Math.abs(r).toString(36)}`}function _o(e,t,i={}){let{prefix:r="",preserveHost:a=!0,scopeKeyframes:l=!0,scopeCustomProperties:u=!1}=i;if(!e.trim())return"";let f=cr(e),x=[],v=new Map;if(l)for(let A of f){let M=A.selector.match(/@keyframes\s+([a-z_-][a-z0-9_-]*)/i);if(M){let H=M[1],O=`${t}_${H}`;v.set(H,O)}}for(let A of f){let M=$o(A,t,r,a,v,u);x.push(M)}return x.join(`
219
-
220
- `)}function cr(e){let t=[],i=e.replace(/\/\*[\s\S]*?\*\//g,""),r=0,a="",l=!1,u="";for(let f=0;f<i.length;f++){let x=i[f];if(x==="@"&&r===0)l=!0;if(x==="{")r++;else if(x==="}"){if(r--,r===0){if(l){u+=x;let v=u.match(/@([a-z-]+)\s*([^{]*)\{([\s\S]*)\}/i);if(v){let[,A,M,H]=v;if(A==="keyframes")t.push({selector:`@keyframes ${M.trim()}`,declarations:H.trim()});else if(A==="media"||A==="supports"||A==="container"){let O=cr(H);t.push({selector:`@${A} ${M.trim()}`,declarations:O.map((z)=>`${z.selector} { ${z.declarations} }`).join(`
221
- `)})}else t.push({selector:`@${A} ${M.trim()}`,declarations:H.trim()})}u="",l=!1}else if(a.trim()){a+=x;let v=a.match(/([^{]+)\{([^}]*)\}/);if(v)t.push({selector:v[1].trim(),declarations:v[2].trim()});a=""}continue}}if(l)u+=x;else a+=x}return t}function $o(e,t,i,r,a,l){let{selector:u,declarations:f}=e;if(u.startsWith("@")){if(u.startsWith("@keyframes")){let A=u.replace("@keyframes ","").trim();return`@keyframes ${a.get(A)||A} { ${f} }`}if(u.startsWith("@media")||u.startsWith("@supports")||u.startsWith("@container")){let M=cr(`x { ${f} }`.replace(/x \{ /,"").replace(/ \}$/,"")).map((H)=>$o(H,t,i,r,a,l)).join(`
222
- `);return`${u} {
223
- ${M}
224
- }`}return`${u} { ${f} }`}let x=jl(u,t,i,r),v=f;for(let[A,M]of a)v=v.replace(new RegExp(`\\b${A}\\b`,"g"),M);if(l)v=v.replace(/--([a-z-]+)/gi,`--${t}-$1`);return`${x} { ${v} }`}function jl(e,t,i,r){let a=e.split(",").map((u)=>u.trim()),l=[];for(let u of a){if(u.startsWith(":host")){if(r)l.push(u);else{let v=u.replace(/:host(\([^)]*\))?/,`.${t}$1`);l.push(v)}continue}if(u.includes("::slotted")){l.push(u);continue}if(u===":root"){l.push(`:root .${t}`);continue}let f=i?`${i} .${t}`:`.${t}`;l.push(`${f} ${u}`);let x=Ml(u,t);if(x)l.push(i?`${i} ${x}`:x)}return l.join(", ")}function Ml(e,t){let i=0,r=e.length;for(let x=0;x<e.length;x++){let v=e[x];if(v==="["||v==="(")i++;else if(v==="]"||v===")")i--;else if(i===0&&(v===" "||v===">"||v==="+"||v==="~")){r=x;break}}let a=e.slice(0,r),l=e.slice(r);if(!a)return"";let u=a.length,f=0;for(let x=0;x<a.length;x++){let v=a[x];if(v==="["||v==="(")f++;else if(v==="]"||v===")")f--;else if(i===0&&f===0&&v===":"){u=x;break}}return`${a.slice(0,u)}.${t}${a.slice(u)}${l}`}var Eo=String.raw`(?<![\w-])scoped(?![\w-])`,lr=/<style\s+([^>]*)>/gi,vo=/<style\s+([^>]*)>([\s\S]*?)<\/style>/gi,ko=new RegExp(Eo,"i"),Dl=new RegExp(Eo,"gi"),ur=/<style\b[^>]*\bdata-stx-scoped(?:=(?:"[^"]*"|'[^']*'|[^\s>]+))?[^>]*>[\s\S]*?<\/style>\s*/gi;function Nl(e){lr.lastIndex=0;let t=lr.exec(e);while(t!==null){if(ko.test(t[1]))return!0;t=lr.exec(e)}return!1}function Ti(e){let t=new Set,i=[];ur.lastIndex=0;let r=ur.exec(e);while(r!==null){let a=r[0].trim();if(t.has(a))i.push({start:r.index,end:r.index+r[0].length});else t.add(a);r=ur.exec(e)}return i}function vn(e){let t=Ti(e);if(t.length===0)return e;let i=Array(t.length+1),r=0;for(let a=0;a<t.length;a++){let l=t[a];i[a]=e.slice(r,l.start),r=l.end}return i[t.length]=e.slice(r),i.join("")}function Xs(e,t){if(!Nl(e))return{html:e,hasScoped:!1};let i=wo(t),r=`data-v-${i}`,a=e,l=!1;if(vo.lastIndex=0,a=a.replace(vo,(u,f,x)=>{if(!ko.test(f))return u;l=!0;let v=Ll(x,r),A=f.replace(Dl,"").trim(),M=A?` ${A}`:"";return`<style data-stx-scoped="${i}"${M}>${v}</style>`}),!l)return{html:e,hasScoped:!1};return a=Bl(a,r),{html:a,hasScoped:!0}}function Ll(e,t){return _o(e,"__SCOPE_PLACEHOLDER__",{preserveHost:!1}).replace(/\.(__SCOPE_PLACEHOLDER__) /g,`[${t}] `).replace(/\.(__SCOPE_PLACEHOLDER__)/g,`[${t}]`)}var zl=(e)=>`\x00stx-scope-mask-${e}\x00`,So=/\u0000stx-scope-mask-(\d+)\u0000/g;function Bl(e,t){let i=we(e,(a,l)=>{let u=J(a,l);return u>l?u:bn(a,l)},(a,l)=>zl(l)),r=Wl(i.output,t);return So.lastIndex=0,r.replace(So,(a,l)=>i.tokens[Number(l)])}function Wl(e,t){let i=new Set(["script","style","template","html","head","body","meta","link","title","base","!doctype","!DOCTYPE"]);return e.replace(/<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*)?\/?>/g,(r,a,l)=>{if(i.has(a.toLowerCase()))return r;if(r.includes(t))return r;if(a.toLowerCase()==="style"||a.toLowerCase()==="script")return r;if(l)return r.replace(`<${a}${l}`,`<${a} ${t}${l}`);if(r.endsWith("/>"))return`<${a} ${t} />`;return`<${a} ${t}>`})}var gn=/<\/?template\b[^>]*>/gi,Fl=/(?:^|\s)(?:id\s*=|(?:x-|[@:])(?:for|if|else(?:-if)?)(?=\s|=|$)|#[\w-]+(?:\s*=|\s|$)|v-slot(?::[\w-]+)?(?=\s|=|$)|slot\s*=)/i;function Vl(e){let t=e.replace(/^<template\b/i,"").replace(/>$/,"");return Fl.test(t)}function L(e){gn.lastIndex=0;let t;while((t=gn.exec(e))!==null){if(t[0].startsWith("</")||Vl(t[0]))continue;let i=t.index,r=gn.lastIndex,a=1,l;while((l=gn.exec(e))!==null)if(l[0].startsWith("</")){if(a--,a===0){let u=l.index;return{start:i,openEnd:r,closeStart:u,end:gn.lastIndex,content:e.slice(r,u)}}}else a++;return null}return null}var Ul=0,Hl=0;function ls(e,t){let i=/(?:^|\s)([^\s=/>]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+)))?/g;for(let r of e.matchAll(i))if(r[1].toLowerCase()===t.toLowerCase())return r[2]??r[3]??r[4]??null;return null}function Ro(e){let t=[],i=/<([a-z][a-z0-9-]*)\b((?:"[^"]*"|'[^']*'|[^>"'])*)>/iy;return w(e,(r,a)=>{i.lastIndex=a;let l=i.exec(r);if(!l||!ls(l[2],"x-data"))return-1;return t.push({fullMatch:l[0],tagName:l[1],attributes:l[2],startIndex:a,endIndex:i.lastIndex}),i.lastIndex}),t}function Zl(e){let t=[];for(let{fullMatch:i,tagName:r,attributes:a,startIndex:l}of Ro(e)){let u=ls(a,"x-data");if(!u)continue;let f=`__stx_scope_${Ul++}`,x=ls(a,"x-init"),v=ql(e,r,l+i.length),A=e.slice(l,v.endIndex),M=Kl(A);t.push({id:f,selector:`[data-stx-scope="${f}"]`,stateExpr:u,initExpr:x,bindings:[],refs:M})}return t}function ql(e,t,i){let r=1,a=i,l=new RegExp(`<${t}(?:\\s|>)`,"gi"),u=new RegExp(`</${t}>`,"gi"),f=new RegExp(`<${t}[^>]*/\\s*>`,"gi");while(r>0&&a<e.length){l.lastIndex=a,u.lastIndex=a,f.lastIndex=a;let x=l.exec(e),v=u.exec(e),A=f.exec(e);if(A&&A.index<(x?.index??1/0)){a=A.index+A[0].length;continue}if(!v)return{endIndex:e.length};if(x&&x.index<v.index)r++,a=x.index+x[0].length;else{if(r--,r===0)return{endIndex:v.index+v[0].length};a=v.index+v[0].length}}return{endIndex:e.length}}function Kl(e){let t=new Map,i=e.replace(/x-data\s*=\s*"[^"]*"/gi,'x-data="__stripped__"').replace(/x-data\s*=\s*'[^']*'/gi,"x-data='__stripped__'"),r=/<[a-z][a-z0-9-]*\s+([^>]*x-ref\s*=\s*["']([^"']*)["'][^>]*)>/gi,a;while((a=r.exec(i))!==null){let[,l,u]=a,f=Jl(l);t.set(u,f)}return t}function Jl(e){let t=e.match(/\bid\s*=\s*["']([^"']*)["']/);if(t)return t[1];return`__stx_el_${Hl++}`}function Xl(){return`
225
- // STX Reactive Runtime - x-cloak and transition CSS
226
- (function() {
227
- var style = document.createElement('style');
228
- style.textContent = [
229
- '[x-cloak] { display: none !important; }',
230
- // Default transition classes
231
- '.stx-enter { opacity: 0; transform: scale(0.95); }',
232
- '.stx-enter-start { opacity: 0; transform: scale(0.95); }',
233
- '.stx-enter-active { transition: opacity 150ms ease-out, transform 150ms ease-out; }',
234
- '.stx-enter-to { opacity: 1; transform: scale(1); }',
235
- '.stx-leave { opacity: 1; transform: scale(1); }',
236
- '.stx-leave-start { opacity: 1; transform: scale(1); }',
237
- '.stx-leave-active { transition: opacity 100ms ease-in, transform 100ms ease-in; }',
238
- '.stx-leave-to { opacity: 0; transform: scale(0.95); }'
239
- ].join('\\n');
240
- document.head.appendChild(style);
241
- })();
242
-
243
- // STX Reactive Runtime
244
- /* eslint-disable pickier/no-unused-vars, no-console, prefer-const */
245
- window.__stx_reactive = (function() {
246
- 'use strict';
247
-
248
- // Deep reactive proxy that triggers onChange for any mutation
249
- function reactive(obj, onChange) {
250
- if (!obj || typeof obj !== 'object') return obj;
251
- return new Proxy(obj, {
252
- get(target, prop) {
253
- const value = target[prop];
254
- if (value && typeof value === 'object' && !Array.isArray(value) && !(value instanceof Promise)) {
255
- return reactive(value, onChange);
256
- }
257
- return value;
258
- },
259
- set(target, prop, value) {
260
- target[prop] = value;
261
- onChange(prop, value);
262
- return true;
263
- }
264
- });
265
- }
266
-
267
- // Initialize an x-data scope: parse state, run init(), register into window.stx._scopes,
268
- // then let the signals runtime handle all directive processing (x-for, x-text, :bind, etc.)
269
- function initScope(scopeEl, initialState, bindings, refs, initExpr, deferInit) {
270
- // Parse initial state (may contain methods including async init())
271
- var state;
272
- try {
273
- state = new Function('return (' + initialState + ')')();
274
- } catch (e) {
275
- console.error('[stx-reactive] Invalid x-data:', initialState, e);
276
- return;
277
- }
278
-
279
- // Build $refs object
280
- var $refs = {};
281
- for (var name in refs) {
282
- if (Object.prototype.hasOwnProperty.call(refs, name)) {
283
- (function(refName, refId) {
284
- Object.defineProperty($refs, refName, {
285
- get: function() { return document.getElementById(refId); }
286
- });
287
- })(name, refs[name]);
288
- }
289
- }
290
-
291
- // Extract init method from state if present (Alpine.js convention)
292
- var initMethod = state.init;
293
- if (typeof initMethod === 'function') {
294
- delete state.init;
295
- }
296
-
297
- // Make state reactive \u2014 mutations trigger re-render via signals
298
- var scopeId = scopeEl.getAttribute('data-stx-scope');
299
- var stx = window.stx;
300
-
301
- // Create signals for each state property so the signals runtime can track dependencies
302
- var signalState = {};
303
- var rawState = {};
304
- var derivedState = {};
305
- var accessors = {};
306
- // A getter must NOT be read here. Reading one calls it, and the old loop did
307
- // exactly that: the returned value is not a function, so it was wrapped as a
308
- // plain state() -- a snapshot of the answer at construction time, frozen
309
- // forever while plain properties beside it updated (#2053). A getter is a
310
- // derived value, so it is registered as one below, once ctxProxy exists for
311
- // it to read through.
312
- var ownDescriptors = Object.getOwnPropertyDescriptors ? Object.getOwnPropertyDescriptors(state) : {};
313
- for (var key in state) {
314
- if (Object.prototype.hasOwnProperty.call(state, key)) {
315
- var descriptor = ownDescriptors[key];
316
- if (descriptor && typeof descriptor.get === 'function') {
317
- accessors[key] = descriptor;
318
- continue;
319
- }
320
- if (typeof state[key] === 'function') {
321
- // Methods \u2014 bind to a proxy so 'this.prop = val' triggers signal updates
322
- signalState[key] = state[key];
323
- } else {
324
- // Data properties \u2014 wrap in signals for reactivity
325
- signalState[key] = stx.state(state[key]);
326
- rawState[key] = true;
327
- }
328
- }
329
- }
330
-
331
- // Create a proxy context that auto-unwraps signals and writes back through them.
332
- // Methods get 'this' bound to this proxy so this.foo = bar triggers reactivity.
333
- var ctx = {};
334
- var ctxProxy = new Proxy(ctx, {
335
- get: function(target, prop) {
336
- if (prop === '$refs') return $refs;
337
- if (prop === '$el') return scopeEl;
338
- if (prop === '$nextTick') return function(fn) { requestAnimationFrame(fn); };
339
- if (prop === Symbol.unscopables) return undefined;
340
- if (!(prop in signalState)) {
341
- var owner = stx._scopeForBinding(scopeEl, prop);
342
- return owner ? owner[prop] : undefined;
343
- }
344
- var s = signalState[prop];
345
- if (!s) return undefined;
346
- if (rawState[prop] && s && typeof s === 'function' && typeof s.value !== 'undefined') {
347
- return s.value; // unwrap signal
348
- }
349
- if (typeof s === 'function' && !rawState[prop]) {
350
- return s.bind(ctxProxy); // bind methods to proxy
351
- }
352
- return s;
353
- },
354
- set: function(target, prop, value) {
355
- var accessor = derivedState[prop];
356
- if (accessor) {
357
- // A getter/setter pair writes through its setter. A getter alone has
358
- // nowhere to put the value: a derived has no .value setter, so the
359
- // assignment would be a silent no-op, which is the same class of
360
- // failure as the stale read this replaces.
361
- if (typeof accessor.set === 'function') {
362
- accessor.set.call(ctxProxy, value);
363
- return true;
364
- }
365
- 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.');
366
- return true;
367
- }
368
- var s = signalState[prop];
369
- if (rawState[prop] && s && typeof s === 'function') {
370
- s.value = value; // write through signal \u2014 triggers effects
371
- } else {
372
- signalState[prop] = value;
373
- }
374
- return true;
375
- },
376
- has: function(target, prop) {
377
- return prop in signalState || prop === '$refs' || prop === '$el' || prop === '$nextTick' || !!stx._scopeForBinding(scopeEl, prop);
378
- },
379
- ownKeys: function() {
380
- return Object.keys(signalState).concat(['$refs', '$el', '$nextTick']);
381
- },
382
- getOwnPropertyDescriptor: function(target, prop) {
383
- if (prop in signalState || prop === '$refs' || prop === '$el' || prop === '$nextTick') {
384
- return { configurable: true, enumerable: true, writable: true, value: ctxProxy[prop] };
385
- }
386
- return undefined;
387
- }
388
- });
389
-
390
- // Now that ctxProxy exists, a getter becomes a derived that reads through it,
391
- // so it tracks whatever it touches and recomputes when that changes. derived()
392
- // is lazy, so nothing is evaluated until a binding actually reads it.
393
- //
394
- // Marked rawState as well: that is what makes the proxy unwrap it and what
395
- // exposes the signal itself to the runtime below, which is where dependency
396
- // tracking comes from. A getter needs both, exactly like a data property.
397
- for (var accessorKey in accessors) {
398
- if (Object.prototype.hasOwnProperty.call(accessors, accessorKey)) {
399
- (function(name, descriptor) {
400
- signalState[name] = stx.derived(function() {
401
- return descriptor.get.call(ctxProxy);
402
- });
403
- rawState[name] = true;
404
- derivedState[name] = descriptor;
405
- })(accessorKey, accessors[accessorKey]);
406
- }
407
- }
408
-
409
- // Build scope vars for the signals runtime \u2014 it reads these for expression evaluation.
410
- // We need to provide getter/setter descriptors so signals track properly.
411
- var scopeVars = {};
412
- for (var k in signalState) {
413
- if (Object.prototype.hasOwnProperty.call(signalState, k)) {
414
- if (rawState[k]) {
415
- // Data: expose the signal directly so expressions trigger dependency tracking
416
- scopeVars[k] = signalState[k];
417
- } else {
418
- // Method: bind to ctxProxy so 'this' works
419
- scopeVars[k] = (typeof signalState[k] === 'function') ? signalState[k].bind(ctxProxy) : signalState[k];
420
- }
421
- }
422
- }
423
- scopeVars.$refs = $refs;
424
- scopeVars.$el = scopeEl;
425
- scopeVars.$nextTick = function(fn) { requestAnimationFrame(fn); };
426
-
427
- // Register scope \u2014 merge with any existing vars from partial signal scripts
428
- if (!stx._scopes) stx._scopes = {};
429
- var registered = stx._scopes[scopeId] = Object.assign(stx._scopes[scopeId] || {}, scopeVars);
430
- registered.__el = scopeEl;
431
-
432
- // Store on element for findElementScope
433
- scopeEl.__stx_scope = scopeVars;
434
-
435
- // Run init() if present (supports async)
436
- function runInit() {
437
- var maybePromise;
438
- if (initMethod) {
439
- maybePromise = initMethod.call(ctxProxy);
440
- }
441
- if (initExpr) {
442
- try {
443
- var fn = new Function('with(this){' + initExpr + ';}');
444
- var result = fn.call(ctxProxy);
445
- if (result && typeof result.then === 'function') maybePromise = result;
446
- } catch (e) {
447
- console.warn('[stx-reactive] init expression error:', e);
448
- }
449
- }
450
- // If init is async, signal updates will trigger effects automatically
451
- // when init() resolves and sets this.prop = value (writes through signal)
452
- if (maybePromise && typeof maybePromise.then === 'function') {
453
- maybePromise.catch(function(e) {
454
- console.error('[stx-reactive] async init() error:', e);
455
- });
456
- }
457
- }
458
-
459
- // A component's helper setup follows its markup. Its own mount queue
460
- // starts the initializer after all component factories have registered.
461
- // Standalone x-data retains synchronous initialization.
462
- if (deferInit) {
463
- registered.__mountCallbacks = registered.__mountCallbacks || [];
464
- registered.__mountCallbacks.push(runInit);
465
- } else {
466
- runInit();
467
- }
468
- var destroyExpr = scopeEl.getAttribute('data-stx-xdestroy') || scopeEl.getAttribute('x-destroy');
469
- if (destroyExpr) {
470
- registered.__destroyCallbacks = registered.__destroyCallbacks || [];
471
- var teardown = function() { scopeEl.__stx_execute(destroyExpr); };
472
- registered.__destroyCallbacks.push(teardown);
473
- registered.__destroyHooks = registered.__destroyHooks || [];
474
- registered.__destroyHooks.push(teardown);
475
- }
476
-
477
- // Expose for debugging
478
- scopeEl.__stx_state = ctxProxy;
479
- scopeEl.__stx_execute = function(stmt, $event, $el) {
480
- try {
481
- // Run the statement with the reactive proxy as the lexical scope.
482
- // Wrapping in a with-block on the proxy makes bare reads/writes go
483
- // through it (so foo = bar triggers signal.set()) instead of treating
484
- // each state key as a local function parameter \u2014 bare assignments
485
- // would otherwise just rebind the local and never reach the signal.
486
- var fn = new Function('$event', '$el', 'with(this){' + stmt + ';}');
487
- fn.call(ctxProxy, $event, $el);
488
- } catch (e) {
489
- console.warn('[stx-reactive] execute error:', e);
490
- }
491
- };
492
- }
493
-
494
- return { initScope: initScope, reactive: reactive };
495
- })();
496
- `}function Co(e,t){let i=e.replace(/\{!!([\s\S]*?)!!\}/g,(f,x)=>{try{let v=I(x,t,!0);if(v===void 0)return f;return String(v)}catch{return f}}),r="",a=0,l=null;while(a<i.length){let f=i[a];if(l&&f==="\\"){r+=f+(i[a+1]??""),a+=2;continue}if(f==="{"&&i[a+1]==="{"){let x=i.indexOf("}}",a+2);if(x!==-1){let v=i.slice(a,x+2);r+=u(i.slice(a+2,x),v,l),a=x+2;continue}}if(l){if(f===l)l=null}else if(f==="'"||f==='"'||f==="`")l=f;r+=f,a++}return r;function u(f,x,v){let A;try{A=I(f,t,!0)}catch{return x}if(A===void 0)return x;if(v){let M=String(A).replace(/\\/g,"\\\\").replace(new RegExp(v==="`"?"`":v,"g"),`\\${v}`).replace(/\r/g,"\\r").replace(/\n/g,"\\n");return v==="`"?M.replace(/\$\{/g,"\\${"):M}if(typeof A==="string"){let M=A.trim();if(M.startsWith("{")&&M.endsWith("}")||M.startsWith("[")&&M.endsWith("]"))try{return JSON.parse(M),M}catch{}}return JSON.stringify(A)}}function Gl(e,t,i){if(e.length===0)return"";let r=e.map((a)=>{let l=JSON.stringify(Object.fromEntries(a.refs)),u=Co(a.stateExpr,t),f=a.initExpr?Co(a.initExpr,t):null,x=JSON.stringify(u),v=f?JSON.stringify(f):"null";return`
497
- (function() {
498
- var scopeEl = document.querySelector('${a.selector}');
499
- if (!scopeEl) return;
500
- var refs = ${l};
501
- window.__stx_reactive.initScope(scopeEl, ${x}, [], refs, ${v}${i?", true":""});
502
- })();`}).join(`
503
- `);return`
504
- <script data-stx-scoped data-stx-reactive data-stx-run="always">
505
- ${Xl()}
506
- ${r}
507
- </script>`}function nl(e,t,i,r=!1){if(!pr(e))return e;let a=Zl(e);if(a.length===0)return e;let l=Yl(e,a),u=Gl(a,t,r),f=c(l);if(f!==-1)l=l.slice(0,f)+u+`
508
- `+l.slice(f);else l+=u;return l}function Yl(e,t){let i=[],r=0;for(let[l,u]of Ro(e).entries()){let f=t[l];if(!f)break;i.push(e.slice(r,u.startIndex));let x=ls(u.attributes,"data-stx-scope");if(x)f.id=x,f.selector=`[data-stx-scope="${f.id}"]`,i.push(u.fullMatch);else i.push(`<${u.tagName} data-stx-scope="${f.id}"${u.attributes}>`);r=u.endIndex}i.push(e.slice(r));let a=i.join("");return a=a.replace(/\s*x-data\s*=\s*"([^"]*)"/g,' data-stx-xdata="$1"'),a=a.replace(/\s*x-data\s*=\s*'([^']*)'/g," data-stx-xdata='$1'"),a=a.replace(/\s*x-init\s*=\s*"([^"]*)"/g,' data-stx-xinit="$1"'),a=a.replace(/\s*x-init\s*=\s*'([^']*)'/g," data-stx-xinit='$1'"),a=a.replace(/\s*x-destroy\s*=\s*"([^"]*)"/g,' data-stx-xdestroy="$1"'),a=a.replace(/\s*x-destroy\s*=\s*'([^']*)'/g," data-stx-xdestroy='$1'"),a}function pr(e){return/x-data\s*=\s*["']/.test(e)}function Ys(e,t){let i=e,r=/@json\s*\(/g,a;while((a=r.exec(i))!==null){let l=a.index,u=l+a[0].length-1,f=1,x=u+1,v=null,A=!1;while(x<i.length&&f>0){let F=i[x];if(A){A=!1,x++;continue}if(F==="\\"&&v){A=!0,x++;continue}if(v){if(F===v)v=null;x++;continue}if(F==='"'||F==="'"||F==="`"){v=F,x++;continue}if(F==="(")f++;else if(F===")"){if(f--,f===0)break}x++}if(f!==0)break;let M=i.substring(u+1,x).trim(),H=i.substring(l,x+1),O=-1,z=0,D=null,U=!1;for(let F=0;F<M.length;F++){let Q=M[F];if(U){U=!1;continue}if(Q==="\\"&&D){U=!0;continue}if(D){if(Q===D)D=null;continue}if(Q==='"'||Q==="'"||Q==="`"){D=Q;continue}if(Q==="("||Q==="["||Q==="{")z++;else if(Q===")"||Q==="]"||Q==="}")z--;if(Q===","&&z===0){O=F;break}}let q=O>=0?M.substring(0,O).trim():M,V=O>=0?M.substring(O+1).trim():void 0;try{let F=q.trim(),Q;if(m(F))Q=p(F,Object.keys(t))(...Object.values(t));else Q=void 0;let ie;if(V==="true")ie=JSON.stringify(Q,null,2);else ie=JSON.stringify(Q);let oe=ie.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029");i=i.substring(0,l)+oe+i.substring(x+1),r.lastIndex=l+oe.length}catch(F){W.log(F instanceof Error?F:Error(String(F)),{directive:"@json"},"error"),r.lastIndex=l+H.length}}return i}function Zs(e){return e.replace(/@once\s*([\s\S]*?)@endonce/g,"$1")}function rl(e){let t=e,i=/@memo\s*\(/g,r,a=[];while((r=i.exec(t))!==null){let l=r.index,u=l+r[0].length,f=1,x=u;while(x<t.length&&f>0){if(t[x]==="(")f++;else if(t[x]===")")f--;x++}if(f!==0)continue;let v=t.slice(u,x-1).trim(),A=x,M=t.slice(A),H=M.indexOf("@endmemo");if(H===-1)continue;let O=M.slice(0,H),z=A+H+8,D=Mt(O),U=O.slice(D),q=O.match(/(\s*)$/),V=q?q[0].length:0,F=U.slice(0,U.length-V),Q=F.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)?(\/?)>/),ie;if(Q){let[oe,me,le="",be]=Q,Ae=`<${me}${le} data-stx-memo="${v}"${be}>`;ie=O.slice(0,D)+Ae+F.slice(oe.length)+O.slice(D+F.length)}else ie=`${O.slice(0,D)}<div data-stx-memo="${v}">${F}</div>${O.slice(D+F.length)}`;a.push({start:l,end:z,replacement:ie}),i.lastIndex=z}for(let l=a.length-1;l>=0;l--){let u=a[l];t=t.slice(0,u.start)+u.replacement+t.slice(u.end)}return t.replace(/@memo="([^"]*)"/g,'data-stx-memo="$1"')}function $i(e){let t=e.replace(/@ref="([^"]+)"/g,'data-stx-ref="$1"');return t=t.replace(/(<[a-zA-Z][a-zA-Z0-9-]*\b[^>]*?)\sref="([^"]+)"/g,'$1 data-stx-ref="$2"'),t}function Oo(e,t){let i=/<\/?([a-zA-Z][\w-]*)\b(?:"[^"]*"|'[^']*'|[^'">])*>/y,r=w(e,(f,x)=>{i.lastIndex=x;let v=i.exec(f);if(!v||/^(?:script|style)$/i.test(v[1]))return-1;return i.lastIndex}),a=[],l=0,u=[];for(let{start:f,end:x,token:v}of r){let A=/^<\/?([\w-]+)/.exec(v)[1].toLowerCase();if(v.startsWith("</")){while(a.length&&a.pop()!==A);continue}if(!a.length&&!/\sdata-stx-slot-owner\s*=/.test(v))u.push(e.slice(l,f),v.replace(/\s*\/?>$/,(M)=>` data-stx-slot-owner="${t}"${M}`)),l=x;if(!fr.has(A)&&!/\/>$/.test(v))a.push(A)}return u.push(e.slice(l)),u.join("")}function Po(e,t){if(!/\bref\s*=/.test(e))return e;let i=/<\/?([a-zA-Z][\w-]*)\b(?:"[^"]*"|'[^']*'|[^'">])*>/y,r=w(e,(x,v)=>{i.lastIndex=v;let A=i.exec(x);if(!A||/^(?:script|style)$/i.test(A[1]))return-1;return i.lastIndex}),a=[],l=0,u=0,f=[];for(let{start:x,end:v,token:A}of r){let M=/^<\/?([\w-]+)/.exec(A)[1].toLowerCase();if(A.startsWith("</")){let D;while(D=a.pop()){if(D.scoped)l--;if(D.name===M)break}continue}let H=/\sdata-stx-scope\s*=/.test(A),O=/\sdata-stx-ref-caller\s*=\s*(["'])(.*?)\1/.exec(A),z=a.find((D)=>D.scoped)?.scopeId;if(O&&z&&O[2]===z)f.push(e.slice(u,x),A.replace(O[0],` data-stx-ref-caller="${t}"`)),u=v;else if(!l&&!H&&/\s(?:ref|@ref|:ref|x-ref|data-stx-ref)\s*=/.test(A)&&!/\sdata-stx-ref-caller\s*=/.test(A))f.push(e.slice(u,x),A.replace(/\s*\/?>$/,(D)=>` data-stx-ref-caller="${t}"${D}`)),u=v;if(!fr.has(M)&&!/\/>$/.test(A)){let D=/\sdata-stx-scope\s*=\s*(?:"([^"]*)"|'([^']*)')/.exec(A);if(a.push({name:M,scoped:H,scopeId:D?.[1]??D?.[2]}),H)l++}}return f.push(e.slice(u)),f.join("")}var fr=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),jo=/(?:^|\s)x-no-cloak(?:=|\s|\/|>|$)/,Ao=/<\/?\s*([a-z][\w-]*)/iy,Ql=/\s/;function eu(e,t){let i=t-1;while(i>=0&&Ql.test(e[i]))i--;return i>=0&&e[i]==="/"}function tu(e,t){let i=!1,r=!1;for(let a=t;a<e.length;a++){let l=e[a];if(i){if(l==="'")i=!1}else if(r){if(l==='"')r=!1}else if(l==="'")i=!0;else if(l==='"')r=!0;else if(l===">")return a}return-1}function nu(e,t){if(e.indexOf("{",t)===-1||e.indexOf("}",t)===-1)return!1;let i=0,r=t,a=!1,l=!1,u=!1;while(r<e.length){let f=e.indexOf("<",r),x=f===-1?e.length:f;if(x>r){if(i===0)while(r<x){let M=e.indexOf(l?"}":"{",r);if(M===-1||M>=x){if(l)u=!1;else a=!1;break}if(M>r)if(l)u=!1;else a=!1;if(l){if(u)return!0;u=!0}else if(a)l=!0,u=!1;else a=!0;r=M+1}r=x;continue}if(e.startsWith("<!--",r)){let M=e.indexOf("-->",r);r=M===-1?e.length:M+3;continue}let v=tu(e,r);if(v===-1)break;Ao.lastIndex=r;let A=Ao.exec(e)?.[1]?.toLowerCase()??"";if(e[r+1]==="/"){if(i===0)break;i--}else if(!eu(e,v)&&!fr.has(A))i++;r=v+1}return!1}var To=S(256);function sl(e){if(e.length<1024)return Io(e);let t=_(e),i=To.get(t);if(i!==void 0)return i;let r=Io(e);return To.set(t,r),r}function Io(e){if(e.length>=32768&&!Hi(e))return e;let i=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"),r="",a=0,l;while((l=i.exec(e))!==null){let u=l.index,f=u+l[0].length,x=!1,v=!1,A=-1;while(f<e.length){let H=e[f];if(x){if(H==="'")x=!1}else if(v){if(H==='"')v=!1}else if(H==="'")x=!0;else if(H==='"')v=!0;else if(H===">"){A=f;break}f++}if(A===-1)continue;let M=e.slice(u,A+1);if(jo.test(M))continue;if(M.includes("x-cloak"))continue;if(nu(e,A+1))r+=e.slice(a,A)+" x-cloak>",a=A+1}return r+=e.slice(a),r}var su=/(?:^|\s)(?::else-if|:if|:else|:show|x-else-if|x-if|x-else|x-show|@if|@show)(?:=|\s|\/|>|$)/,ru=/<\/script>/gi,iu=/<\/style>/gi;function ol(e){let t=/<[a-z][\w-]*/gi,i="",r=0,a;while((a=t.exec(e))!==null){let l=a.index,u=a[0].slice(1).toLowerCase();if(u==="script"||u==="style"){let z=u==="script"?ru:iu;z.lastIndex=l;let D=z.exec(e);if(D!==null)t.lastIndex=D.index+D[0].length;continue}let f=l+a[0].length,x=!1,v=!1,A=-1;while(f<e.length){let z=e[f];if(x){if(z==="'")x=!1}else if(v){if(z==='"')v=!1}else if(z==="'")x=!0;else if(z==='"')v=!0;else if(z===">"){A=f;break}f++}if(A===-1)continue;let M=e.slice(l+a[0].length,A);if(jo.test(M))continue;if(/(?:^|\s)x-cloak(?:=|\s|\/|>|$)/.test(M))continue;if(!su.test(M))continue;let H=e[A-1]==="/",O=H?A-1:A;i+=`${e.slice(r,O)} x-cloak${H?" ":""}`,r=O}return i+=e.slice(r),i}import sa from"path";import gr from"fs";import mn from"path";function Mo(e,t,i,r){let a=0;for(let l=t;l<e.length;l++)if(e[l]===i)a++;else if(e[l]===r&&!(r===">"&&e[l-1]==="=")){if(--a===0)return l}return-1}function ou(e){let t=n(e),i=0,r=0,a=[];for(let l=0;l<t.length;l++)if("([{".includes(t[l]))i++;else if(")]}".includes(t[l]))i--;else if(t[l]===","&&i===0)a.push(e.slice(r,l).trim()),r=l+1;return a.push(e.slice(r).trim()),a}function dr(e,t){let i=n(e),r=new RegExp(`\\b(?:${t.map((a)=>a.replace(/[$]/g,"\\$&")).join("|")})\\s*(?=[<(])`,"g");for(let a of i.matchAll(r)){let l=a.index+a[0].length,u="";if(i[l]==="<"){let x=Mo(i,l,"<",">");if(x<0)continue;u=e.slice(l+1,x),l=x+1;while(/\s/.test(i[l]||"")&&l<i.length)l++}if(i[l]!=="(")continue;let f=Mo(i,l,"(",")");if(f>=0)return{type:u,args:ou(e.slice(l+1,f))}}return null}var us=`
509
- 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;
510
- type __StxWiden<T> = T extends string ? string : T extends number ? number : T extends boolean ? boolean : T;
511
- 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>;
512
- type __StxRequired<O> = { [K in keyof O]-?: O[K] extends { required: true } ? K : never }[keyof O];
513
- type __StxDefaulted<O> = { [K in keyof O]-?: O[K] extends { default: unknown } ? K : never }[keyof O];
514
- 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]> };
515
- type __StxDefaults<P, K> = Omit<P, Extract<keyof P, K>> & Partial<Pick<P, Extract<keyof P, K>>>;
516
- `;function ps(e,t){let i=[],r={defineProps:["defineProps"],defineEmits:["defineEmits"],withDefaults:["withDefaults"]},a=n(e),l=e.replace(/\bimport\s+(?:type\s+)?(\{[^}]*\}|\*\s+as\s+[\w$]+|[\w$]+)\s+from\s*(['"])([^'"]+)\2\s*;?/g,(H,O,z,D,U)=>{if(a.slice(U,U+6)!=="import")return H;if(D.endsWith(".stx"))return"";let q=`${t}Import${i.length}`;if(i.push(`import * as ${q} from ${JSON.stringify(D)};`),O.startsWith("*"))return`import ${O.replace(/^\*\s+as\s+/,"")} = ${q};`;if(!O.startsWith("{"))return`import ${O} = ${q}.default;`;return O.slice(1,-1).split(",").map((V)=>{let[F,Q=F]=V.trim().replace(/^type\s+/,"").split(/\s+as\s+/);if(!F)return"";if(/^(?:stx|@stacksjs\/stx)(?:\/|$)/.test(D)&&F in r)r[F].push(Q);return`import ${Q} = ${q}.${F};`}).join(`
517
- `)}),u=dr(e,r.defineProps),f=dr(e,r.defineEmits),x=dr(e,r.withDefaults);if(!u&&!f)return{declarations:"",props:null,events:null};let v=[],A=null,M=null;if(u){v.push(`const __options = (${u.args[0]||"{}"}) as const;`),v.push(`const __defaults = (${x?.args[1]||"{}"});`);let H=u.type||"__StxOptions<typeof __options>";v.push(`export type __StxProps = __StxDefaults<${H}, keyof typeof __defaults | __StxDefaulted<typeof __options>>;`),A=`${t}.__StxProps`}if(f)v.push(`const __events = (${f.args[0]||"[]"}) as const;`),v.push(`export type __StxEvents = ${f.type||"Record<(typeof __events)[number], any[]>"};`),M=`${t}.__StxEvents`;return{declarations:`${i.join(`
518
- `)}
519
- namespace ${t} {
520
- ${l}
521
- ${v.join(`
522
- `)}
523
- }`,props:A,events:M}}var Ar=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 Pr(e){if(e.includes("-")||e==="component")return!1;if(/^[A-Z]/.test(e))return!/[a-z]/.test(e)&&[...Ar].some((t)=>t.toLowerCase()===e.toLowerCase());return Ar.has(e)||/[A-Z]/.test(e)}function*au(e){let t=/<([A-Za-z][\w.-]*)(?=[\s/>])/g,i;while(i=t.exec(e)){let r=t.lastIndex,a=[];while(r<e.length){while(/\s/.test(e[r]||""))r++;if(e[r]===">"||e.slice(r,r+2)==="/>"){r+=e[r]===">"?1:2;break}let l=/^[^\s=/>]+/.exec(e.slice(r))?.[0];if(!l){r++;continue}let u=r;r+=l.length;while(/\s/.test(e[r]||""))r++;if(e[r]!=="="){a.push({name:l,value:!0,offset:u,braced:!1});continue}r++;while(/\s/.test(e[r]||""))r++;let f=e[r],x=f==="{",v=f==='"'||f==="'";if(v||x)r++;let A=r;if(x){let M=n(e.slice(r)),H=1,O=0;for(;O<M.length;O++){if(M[O]==="{")H++;if(M[O]==="}"&&--H===0)break}r+=O}else if(v)while(r<e.length&&e[r]!==f)r++;else while(r<e.length&&!/[\s/>]/.test(e[r]))r++;if(a.push({name:l,value:e.slice(A,r),offset:A,braced:x}),v||x)r++}t.lastIndex=r,yield{name:i[1],offset:i.index,attributes:a}}}function Do(e,t,i){let r=[],a=[us,"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 __StxStaticProp<P, K> = __StxProp<P, K> extends infer T ? boolean extends T ? T | "true" | "false" : T : never;','type __StxEvent<E, K> = K extends keyof E ? E[K] extends readonly unknown[] ? number extends E[K]["length"] ? E[K][0] : Exclude<E[K]["length"], 0 | 1> extends never ? E[K][0] : E[K] : E[K] : any;'],l=new Map,u=new Map,f=new Map,x=i.scriptCode(e,i.filePath),v=n(x);for(let z of x.matchAll(/\bimport\s+(\{[^}]+\}|[\w$]+)\s+from\s*['"]([^'"]+)['"]/g)){if(v.slice(z.index,z.index+6)!=="import")continue;let D=z[2],U=mn.isAbsolute(D)||D.startsWith(".")?mn.resolve(mn.dirname(i.filePath),D):zs(D,mn.dirname(i.filePath));if(!U)continue;let q=U.endsWith(".stx")?U:gr.existsSync(`${U}.stx`)?`${U}.stx`:void 0,V=q?null:Cr(U,!1),F=z[1].startsWith("{")?z[1].slice(1,-1).split(","):[z[1]];for(let Q of F){let[ie,oe=ie]=Q.trim().split(/\s+as\s+/),me=q||V?.get(ie)||V?.get(ie.toLowerCase());if(me)f.set(oe,me),f.set(oe.toLowerCase(),me),f.set(oe.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),me)}}for(let z of t.matchAll(/@import\s*\(([^)]+)\)/g))for(let D of z[1].matchAll(/['"]([^'"]+)['"]/g)){let U=Hs(D[1],i.filePath,i).find((q)=>gr.statSync(q,{throwIfNoEntry:!1})?.isFile());if(U)f.set(mn.basename(D[1]).replace(/\.stx$/,""),U)}let A={__importedComponents:f},M=new Map,H=(z,D,U)=>{let q=e.slice(0,z);return{code:D,offset:z,attribute:U,anchor:!0,kind:"directive",line:q.split(`
524
- `).length,column:z-q.lastIndexOf(`
525
- `)}},O=(z,D,U)=>r.push({expression:z,statement:{text:D+z.code+U,prefixLength:D.length}});for(let z of au(t)){if(Pr(z.name)||z.name==="component")continue;let D=si(z.name,i.filePath,i,A);if(!D)continue;let U=M.get(D);if(!U){let V;try{V=i.readComponent?i.readComponent(D):gr.readFileSync(D,"utf8")}catch{continue}if(V===void 0)continue;u.set(D,V),U=ps(i.scriptCode(V,D),`__StxComponent${M.size}`),M.set(D,U),a.push(U.declarations)}let q=[];for(let V of z.attributes){let{name:F,offset:Q}=V,ie=V.value===!0?"true":V.value;if(F.startsWith("@")||F.startsWith("v-on:")){if(U.events&&V.value!==!0)l.set(Q,`__StxEvent<${U.events}, ${JSON.stringify(F.replace(/^@|^v-on:/,"").split(".")[0])}>`);continue}let oe=/^v-model(?::([\w-]+))?(?:\.[\w-]+)*$/.exec(F);if(F.startsWith("v-")&&!F.startsWith("v-bind:")&&!oe)continue;if(/^(?:x-|:)(?:if|for|show|key|else)(?:$|[.:-])/.test(F))continue;let me=(oe?oe[1]||"modelValue":F.replace(/^:|^v-bind:/,"")).replace(/-([a-z])/g,(ke,ye)=>ye.toUpperCase());if(q.push(me),!U.props)continue;let le=F.startsWith(":")||F.startsWith("v-bind:")||!!oe||V.braced,be=le?ie:V.value!==!0?JSON.stringify(ie):"true",Ae=!le&&V.value!==!0&&(ie==="true"||ie==="false");O(H(Q,be,F),";void ((",`) satisfies ${Ae?"__StxStaticProp":"__StxProp"}<${U.props}, ${JSON.stringify(me)}>);`)}if(U.props){let V=[...new Set(q)].map((Q)=>`${JSON.stringify(Q)}: undefined as any`).join(", "),F=H(z.offset,`<${z.name}>`);r.push({expression:F,statement:{text:`;void ({ ${V} } satisfies ${U.props} & Record<string, unknown>);`,prefixLength:0}})}}return{declarations:M.size?a.join(`
526
- `):"",checks:r,events:l,dependencies:u}}import Ho from"fs";import ut from"path";import{mkdir as cu,readFile as lu,readdir as uu,stat as No,writeFile as pu}from"fs/promises";import it from"path";function Vo(e){if(e==="connectedCallback")return`method "${e}" is reserved; define "onConnect" instead, which the element calls once it is connected, rendered and bound`;if(e==="disconnectedCallback")return`method "${e}" is reserved; define "onDisconnect" instead, which the element calls as it leaves the DOM, before it releases its own listeners`;return`method "${e}" is reserved`}var Uo=new Set(["constructor","connectedCallback","disconnectedCallback","attributeChangedCallback","adoptedCallback"]);function fu(e){return e.replace(/\.stx$/i,"").split(/[^a-z0-9]+/i).filter(Boolean).map((t)=>t.charAt(0).toUpperCase()+t.slice(1)).join("")}function hr(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/[^a-z0-9]+/gi,"-").replace(/^-+|-+$/g,"").toLowerCase()}function du(e){return/^[a-z][.0-9_a-z-]*-[.0-9_a-z-]*$/.test(e)&&!e.startsWith("xml")&&!/[A-Z]/.test(e)}function gu(e){if(e===!0)return"open";if(e==="open"||e==="closed")return e;return!1}async function mu(e){let t=[];async function i(r){let a=await uu(r,{withFileTypes:!0});a.sort((l,u)=>l.name.localeCompare(u.name));for(let l of a){let u=it.join(r,l.name);if(l.isDirectory()){if(!l.name.startsWith(".")&&l.name!=="node_modules")await i(u)}else if(l.isFile()&&l.name.endsWith(".stx")&&!/\.(?:test|spec)\.stx$/i.test(l.name))t.push(u)}}return await i(e),t}function fs(e){return e.replace(/<!--[\s\S]*?-->|\{\{--[\s\S]*?--\}\}/g,(t)=>t.replace(/[^\n]/g," "))}function xr(e,t){let i=fs(e).match(/<script\b(?=[^>]*(?:\bcomponent\b|\bstx:component\b))[^>]*>([\s\S]*?)<\/script>/i);if(!i)return{};let r=i.index+i[0].indexOf(">")+1,a=e.slice(r,r+i[1].length).trim();if(!a)return{};try{let l=JSON.parse(a);if(!l||typeof l!=="object"||Array.isArray(l))throw Error("expected a JSON object");return l}catch(l){throw Error(`${t}: <script component> must contain JSON metadata (${l.message})`)}}function ds(e,t){let i=n(e),r=/(?:export\s+)?(?:async\s+)?function\s+([A-Za-z_$][\w$]*)/g,a=[],l=t?void 0:new Bun.Transpiler({loader:"ts"}),u;while(u=r.exec(i)){let f=r.lastIndex;while(/\s/.test(i[f]||""))f++;let x=f;if(i[f]==="<")f=At(i,f,"<",">");if(f<0)continue;let v=e.slice(x,f).trim();while(/\s/.test(i[f]||""))f++;if(i[f]!=="(")continue;let A=f,M=At(i,f,"(",")");if(M<0)continue;for(f=M;f<e.length;f++){let H=i[f];if(H!=="{"&&H!==";")continue;let O=e.slice(u.index,f).trim();if(t){if(!t(O,H,u[1]))continue}else{let D;try{D=l.transformSync(O+(H==="{"?"{}":";"))}catch{continue}if(H==="{"&&!D.includes(`function ${u[1]}(`))continue;if(H===";"&&D.trim())continue}let z=H==="{"?At(i,f,"{","}"):f+1;if(z<0)break;a.push({name:u[1],header:O,generic:v,parameterOffset:A+1,parameters:e.slice(A+1,M-1),returns:e.slice(M,f).trim().replace(/^:\s*/,""),async:/\basync\s+function/.test(u[0]),...H==="{"?{source:e.slice(u.index,z)}:{}}),r.lastIndex=z;break}}return a}function hu(e){let t=hn(e.parameters,",",!0).flatMap((i,r)=>{let a=n(i),l=0,u=-1;for(let D=0;D<a.length;D++){let U=a[D];if("([{<".includes(U))l++;else if(")]}>".includes(U)&&!(U===">"&&a[D-1]==="="))l--;if(U==="="&&l===0&&a[D+1]!==">"){u=D;break}}let f=(u<0?i:i.slice(0,u)).trim(),x=hn(f,":",!0),v=x.shift().trim();if(v==="this")return[];let A=/^[A-Za-z_$]|^\.\.\./.test(v)?v:`argument${r}`,M=u<0?"":i.slice(u+1).trim(),H=M==="true"||M==="false"?"boolean":/^-?\d+(?:\.\d+)?$/.test(M)?"number":/^['"`]/.test(M)?"string":A.startsWith("...")?"unknown[]":"unknown",O=x.join(":").trim()||H,z=u>=0&&!A.endsWith("?")&&!A.startsWith("...")?"?":"";return[`${A}${z}: ${O}`]}).join(", ");return`${e.name}${e.generic}(${t}): ${e.returns||(e.async?"Promise<unknown>":"unknown")}`}function xu(e,t){let i={},r={},a=[],l=[],u=[...fs(e).matchAll(/<script\b([^>]*)>([\s\S]*?)<\/script>/gi)];for(let A of u){let M=A.index+A[0].indexOf(">")+1,H=e.slice(M,M+A[2].length);if(/\bserver\b|\bcomponent\b|\bstx:component\b/i.test(A[1])||/\btype=["']application\//i.test(A[1]))continue;try{new Bun.Transpiler({loader:"ts"}).transformSync(H)}catch(F){throw Error(`${t}: failed to transpile <script client> (${F.message})`)}let O=/\bclient\b/i.test(A[1])?ds(H):[],z=new Set(O.filter((F)=>!F.source).map((F)=>F.name));for(let F of O){if(Uo.has(F.name))throw Error(`${t}: client ${Vo(F.name)}`);if(F.source)i[F.name]=new Bun.Transpiler({loader:"ts"}).transformSync(F.source).trim().replace(/^(?:export\s+)?(async\s+)?function\s+/,"$1");if(!F.source||!z.has(F.name))(r[F.name]??=[]).push(hu(F))}for(let F of H.matchAll(/^\s*import\s+(?:type\s+)?([\s\S]*?)\s+from\s*(['"])([^'"]+)\2\s*;?/gm))l.push({binding:F[1].trim(),module:F[3]});let D=n(H),U=se(D).depths,q=/(?:export\s+)?(interface|type)\s+[A-Za-z_$][\w$]*/g,V;while(V=q.exec(D)){if(U[V.index]!==0)continue;let F=q.lastIndex,Q=0;for(;F<D.length;F++){let ie=D[F];if(ie==="{"){let oe=At(D,F,"{","}");if(oe<0)break;if(F=oe-1,V[1]==="interface"&&Q===0){F++;break}continue}if("([<".includes(ie))Q++;else if(")]>".includes(ie)&&!(ie===">"&&D[F-1]==="="))Q--;if(V[1]==="type"&&Q===0&&(ie===";"||ie===`
527
- `)){if(ie===`
528
- `&&/^[\s]*[|&]/.test(D.slice(F+1)))continue;try{new Bun.Transpiler({loader:"ts"}).transformSync(H.slice(V.index,F));break}catch{}}}a.push(H.slice(V.index,F).replace(/^export\s+/,"").trim()),q.lastIndex=F+1}}let f=Object.values(r).flat().join(`
529
- `)+`
530
- `+a.join(`
531
- `),x=l.filter((A)=>(A.binding.match(/[A-Za-z_$][\w$]*/g)||[]).filter((M)=>!["type","as"].includes(M)).some((M)=>new RegExp(`\\b${M}\\b`).test(f)));for(let A of x)if(A.module.startsWith(".")||it.isAbsolute(A.module))throw Error(`${t}: public method types import ${JSON.stringify(A.module)} outside the generated package; declare these types in the component or import them from a published dependency`);let v=[...new Set(x.map((A)=>`import type ${A.binding.replace(/\btype\s+/g,"")} from ${JSON.stringify(A.module)}`))];return{methods:i,declarations:r,types:[...v,...a].join(`
532
-
533
- `)}}function bu(e){let t=e.match(/<template\b(?![^>]*\bshadowrootmode\b)[^>]*>([\s\S]*?)<\/template>/i);return(t?t[1]:e).replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"").trim()}function Lo(e){return[...e.matchAll(/<style\b[^>]*>([\s\S]*?)<\/style>/gi)].map((t)=>t[1].trim()).filter(Boolean).join(`
534
-
535
- `)}function yu(e){if(!e)return null;let t=e.replace(/\s*\|\s*(?:undefined|null)\b/g,"").trim();if(/^string$/.test(t))return"string";if(/^number$/.test(t))return"number";if(/^boolean$/.test(t))return"boolean";if(/^(?:'[^']*'|"[^"]*")(?:\s*\|\s*(?:'[^']*'|"[^"]*"))*$/.test(t))return"string";return"object"}function wu(e){if(e===void 0)return"object";if(e==="true"||e==="false")return"boolean";if(/^-?\d+(?:\.\d+)?$/.test(e))return"number";if(/^['"`]/.test(e))return"string";return"object"}function _u(e){if(e==="true")return!0;if(e==="false")return!1;if(/^-?\d+(?:\.\d+)?$/.test(e))return Number(e);if(/^['"`]/.test(e))return e.slice(1,-1);try{return JSON.parse(e)}catch{return}}function yn(e,t){if(e[t]!=="(")return null;let i=0,r="";for(let a=t;a<e.length;a++){let l=e[a];if(r!==""){if(l==="\\")a++;else if(l===r)r="";continue}if(l==="'"||l==='"'||l==="`"){r=l;continue}if(l==="(")i++;else if(l===")"){if(i--,i===0)return{expression:e.slice(t+1,a),end:a+1}}}return null}function br(e){let t=/^([\s\S]+?)\s+as\s+(?:([A-Za-z_$][\w$]*)\s*=>\s*)?([A-Za-z_$][\w$]*)$/.exec(e.trim());return t?{iterable:t[1],key:t[2],value:t[3]}:void 0}function $u(e){let t=[],i=0,r=e.replace(/\{\{--[\s\S]*?--\}\}/g,""),a=/@(if|elseif|else|endif|foreach|endforeach)\s*/g,l,u=(f)=>{if(f==="")return;let x=0,v=/\{!!\s*([\s\S]*?)\s*!!\}|\{\{\s*([\s\S]*?)\s*\}\}/g,A;while(A=v.exec(f)){if(A.index>x)t.push(`out += ${JSON.stringify(f.slice(x,A.index))};`);t.push(A[1]!==void 0?`out += __raw(${A[1]});`:`out += __escape(${A[2]});`),x=A.index+A[0].length}if(x<f.length)t.push(`out += ${JSON.stringify(f.slice(x))};`)};while(l=a.exec(r)){u(r.slice(i,l.index)),i=l.index+l[0].length;let x=l[1]==="if"||l[1]==="elseif"||l[1]==="foreach"?yn(r,i):null;if(x)i=x.end,a.lastIndex=x.end;let v=x?.expression;switch(l[1]){case"if":t.push(`if (${v}) {`);break;case"elseif":t.push(`} else if (${v}) {`);break;case"else":t.push("} else {");break;case"endif":case"endforeach":t.push("}");break;case"foreach":{let A=br(v||"");if(!A){t.push(`out += ${JSON.stringify(l[0]+(x?`(${v})`:""))};`);break}let{iterable:M,key:H,value:O}=A;t.push(H?`for (const [${H}, ${O}] of __entries(${M})) {`:`for (const ${O} of __values(${M})) {`);break}}}return u(r.slice(i)),t.join(`
536
- `)}function At(e,t,i,r){if(e[t]!==i)return-1;let a=0,l=null;for(let u=t;u<e.length;u++){let f=e[u];if(l){if(f==="\\"){u++;continue}if(f===l)l=null;continue}if(f==="'"||f==='"'||f==="`"){l=f;continue}if(f===i)a++;else if(f===r){if(r===">"&&e[u-1]==="=")continue;if(a--,a===0)return u+1}}return-1}function hn(e,t,i){let r=i?"([{<":"([{",a=i?")]}>":")]}",l=[],u=0,f=null,x="";for(let v=0;v<e.length;v++){let A=e[v];if(f){if(x+=A,A==="\\"){x+=e[++v]??"";continue}if(A===f)f=null;continue}if(A==="'"||A==='"'||A==="`"){f=A,x+=A;continue}if(r.includes(A))u++;else if(a.includes(A)&&!(i&&A===">"&&e[v-1]==="="))u--;if(u===0&&t.includes(A)){l.push(x),x="";continue}x+=A}return l.push(x),l.map((v)=>v.trim()).filter(Boolean)}function vu(e){let t=0,i=null;for(let r=0;r<e.length;r++){let a=e[r];if(i){if(a==="\\"){r++;continue}if(a===i)i=null;continue}if(a==="'"||a==='"'||a==="`"){i=a;continue}if("([{".includes(a))t++;else if(")]}".includes(a))t--;if(t!==0||a!=="=")continue;let l=e[r-1];if(e[r+1]==="="||l==="="||l==="!"||l==="<"||l===">")continue;return r}return-1}function zo(e){switch(e.trim()){case"String":return"string";case"Number":return"number";case"Boolean":return"boolean";case"Array":return"unknown[]";case"Object":return"Record<string, unknown>";default:return}}function Su(e){let t=/\bdefineProps\b/.exec(e);if(!t)return null;let i=/(?:^|[\s;{}()])(const|let|var)\s+/g,r=-1;for(let V=i.exec(e);V&&V.index<t.index;V=i.exec(e))r=V.index+V[0].indexOf(V[1]);if(r===-1)return null;let a={},l={},u=[],f={},x=r+(/^(?:const|let|var)\s+/.exec(e.slice(r))?.[0].length??0),v=()=>{while(x<e.length&&/\s/.test(e[x]))x++},A;if(e[x]==="{"){let V=At(e,x,"{","}");if(V===-1)return null;A=e.slice(x,V),x=V}else{let V=/^[A-Za-z_$][\w$]*/.exec(e.slice(x));if(!V)return null;A=V[0],x+=V[0].length}if(v(),e[x]!=="=")return null;x++,v();let M=/^withDefaults\s*\(\s*/.exec(e.slice(x)),H=Boolean(M);if(M)x+=M[0].length;let O=/^defineProps\b/.exec(e.slice(x));if(!O)return null;x+=O[0].length;let z="";if(v(),e[x]==="<"){let V=At(e,x,"<",">");if(V===-1)return null;z=e.slice(x+1,V-1).trim(),x=V}if(v(),e[x]!=="(")return null;let D=At(e,x,"(",")");if(D===-1)return null;let U=e.slice(x+1,D-1).trim();if(x=D,H){if(v(),e[x]===",")x++,v();if(e[x]==="{"){let V=At(e,x,"{","}");if(V===-1)return null;for(let[F,Q]of mr(e.slice(x,V)))l[F]=Q;x=V}if(v(),e[x]===",")x++,v();if(e[x]===")")x++}if(e[x]===";")x++;let q=/^[A-Za-z_$][\w$]*$/.test(z)?z:void 0;if(z.startsWith("{"))for(let V of hn(z.replace(/^\{/,"").replace(/\}$/,""),",;",!0)){let F=/^(?:readonly\s+)?([A-Za-z_$][\w$]*)\s*\??\s*:\s*([\s\S]+)$/.exec(V);if(F)a[F[1]]=F[2].trim()}if(U.startsWith("{"))for(let[V,F]of mr(U)){if(u.push(V),!F.startsWith("{")){let Q=zo(F);if(Q)a[V]=Q;continue}for(let[Q,ie]of mr(F))if(Q==="default")l[V]=ie;else if(Q==="type"){let oe=zo(ie);if(oe)a[V]=oe}}else if(U.startsWith("["))for(let V of hn(U.slice(1,-1),",",!1))u.push(V.replace(/^['"`]/,"").replace(/['"`]$/,""));if(A.startsWith("{")){u.length=0;for(let V of hn(A.replace(/^\{/,"").replace(/\}$/,""),",",!1)){let F=vu(V),Q=F===-1?V:V.slice(0,F),ie=Q.split(":")[0].trim().replace(/^\.\.\./,"");if(!ie)continue;if(u.push(ie),f[ie]=Q.trim(),F!==-1)l[ie]=V.slice(F+1).trim()}}else if(u.length===0)u.push(...Object.keys(a));return{text:e.slice(r,x),propNames:u,propBindings:f,defaults:l,declared:a,typeName:q}}function mr(e){let t=e.trim().replace(/^\{/,"").replace(/\}$/,""),i=[],r=0;while(r<t.length){let a=/\s*([A-Za-z_$][\w$]*)\s*:/y;a.lastIndex=r;let l=a.exec(t);if(!l)break;r=a.lastIndex;let u=0,f="",x=r;while(r<t.length){let A=t[r];if(f){if(A==="\\")r++;else if(A===f)f=""}else if(A==="'"||A==='"'||A==="`")f=A;else if(A==="{"||A==="["||A==="(")u++;else if(A==="}"||A==="]"||A===")")u--;else if(A===","&&u===0)break;r++}let v=t.slice(x,r).trim();if(v)i.push([l[1],v]);r++}return i}function Eu(e,t,i){let a=[...e.matchAll(/<script\b([^>]*)>([\s\S]*?)<\/script>/gi)].find((O)=>!/\bcomponent\b|\bstx:component\b|\bclient\b/i.test(O[1]));if(!a)return{imports:[],body:"",propNames:[],propBindings:{},defaults:{},declared:{}};let l=a[2],u=[],f=[],x={},v={},A={};l=l.replace(/^\s*import\s+[\s\S]*?from\s*['"][^'"]+['"];?\s*$/gm,(O)=>{if(/from\s*['"]stx['"]/.test(O))return"";return u.push(O.trim().replace(/(from\s*['"])(\.[^'"]*)(['"])/,(z,D,U,q)=>{let V=it.resolve(it.dirname(t),U),F=it.relative(i,V);return`${D}${F.startsWith(".")?F:`./${F}`}${q}`})),""});let M=Su(l);if(M)f.push(...M.propNames),Object.assign(x,M.propBindings),Object.assign(v,M.defaults),Object.assign(A,M.declared),l=l.replace(M.text,"");let H={};for(let O of l.matchAll(/(?:export\s+)?interface\s+([A-Za-z_$][\w$]*)\s*\{([\s\S]*?)\n\}/g)){let z=[];for(let D of O[2].matchAll(/^\s*(?:\/\*\*[\s\S]*?\*\/\s*)?([A-Za-z_$][\w$]*)\??\s*:\s*([^\n;]+)/gm))A[D[1]]=D[2].trim(),z.push(D[1]);H[O[1]]=z}if(M&&M.propNames.length===0&&M.typeName){for(let O of H[M.typeName]??[])if(!f.includes(O))f.push(O)}return l=l.replace(/(?:export\s+)?interface\s+[A-Za-z_$][\w$]*\s*\{[\s\S]*?\n\}/g,""),{imports:u,body:l.trim(),propNames:f,propBindings:x,defaults:v,declared:A}}function ku(e){let t=new Set;return{template:e.replace(/\s@([a-z][\w:-]*)(\.[\w.-]+)?\s*=\s*(["'])([A-Za-z_$][\w$]*)\3/gi,(r,a,l,u,f)=>{let x=a.toLowerCase();t.add(x);let v=(l||"").split(".").filter(Boolean).join(" ");return` data-stx-on-${x}="${f}"${v?` data-stx-mod-${x}="${v}"`:""}`}),eventTypes:[...t].sort()}}function Cu(e){let t=[];return{template:e.replace(/\s:([a-z][\w:-]*)\s*=\s*(["'])([\w$.]+)\2/gi,(r,a,l,u)=>{let f=t.length;return t.push({id:f,name:a,expression:u}),` data-stx-bind-${f}=""`}),bindings:t}}function Ru(e){let t=new Set;for(let i of e.matchAll(/<slot\b([^>]*)>/gi))t.add(i[1].match(/\bname\s*=\s*["']([^"']+)["']/i)?.[1]||"");return[...t].map((i)=>({name:i}))}function Au(e){return[...new Set([...e.matchAll(/(--[a-z0-9_-]+)\s*:/gi)].map((t)=>t[1]))].sort().map((t)=>({name:t}))}function Bo(e,t){if(!t||!new Set(["string","number","boolean","object","array"]).has(t.type))throw Error(`Property "${e}" must declare one of: string, number, boolean, object, array`);return{...t,reflect:t.reflect??t.attribute!==!1}}async function Tu(e,t,i){let r=it.isAbsolute(t.file)?t.file:it.resolve(e,t.file),a=await lu(r,"utf8"),l=xr(a,r),u=it.basename(r,".stx"),f=t.name||l.name||fu(u),x=`${hr(i.prefix||"stx")}-${hr(u)}`,v=t.tag||l.tag||x;if(!f||!/^[A-Za-z_$][\w$]*$/.test(f))throw Error(`${r}: invalid component class name "${f}"`);if(!du(v))throw Error(`${r}: invalid custom-element tag "${v}"; tags must be lowercase and contain a hyphen`);let A=t.properties||l.properties||l.props||{},M=Object.fromEntries(Object.entries(A).map(([F,Q])=>[F,Bo(F,Q)])),H=ku(bu(a)),O=Cu(H.template),z=Eu(a,r,it.resolve(i.outputDir)),D=$u(O.template);for(let F of z.propNames){if(M[F])continue;let Q=z.defaults[F];M[F]=Bo(F,{type:yu(z.declared[F])??wu(Q),...Q===void 0?{}:{default:_u(Q)}})}let U=l.methods||{},q=t.methods||{},V=xu(a,r);return{file:it.relative(e,r),sourcePath:r,name:f,tag:v,description:t.description||l.description||"",template:O.template,styles:Lo(a),shadowMode:gu(t.shadowDOM??l.shadowDOM??i.shadowDOM),progressive:t.progressive??l.progressive??i.progressive??!0,properties:M,events:t.events||l.events||{},methods:{...U,...q,...V.methods},methodDeclarations:V.declarations,declarationTypes:V.types,eventTypes:H.eventTypes,bindings:O.bindings,slots:Ru(O.template),cssProperties:Au(Lo(a)),scope:z,render:D}}function Iu(){let e=JSON.stringify("\\{!!\\s*([\\w$.]+)\\s*!!\\}"),t=JSON.stringify("\\{\\{\\s*([\\w$.]+)\\s*\\}\\}");return`const HTMLElementBase = globalThis.HTMLElement || class {};
537
-
538
- const escapeHTML = (value) => String(value ?? '')
539
- .replaceAll('&', '&amp;').replaceAll('<', '&lt;').replaceAll('>', '&gt;')
540
- .replaceAll('"', '&quot;').replaceAll("'", '&#039;');
541
-
542
- const valueAt = (host, path) => {
543
- const parts = path.trim().split('.');
544
- const first = parts.shift();
545
- // Render bindings read declared props, including attributes whose names
546
- // also belong to the native DOM API. The public element keeps that API.
547
- let value = host._values && Object.prototype.hasOwnProperty.call(host._values, first)
548
- ? host._values[first]
549
- : host[first];
550
- for (const part of parts) value = value?.[part];
551
- return typeof value === 'function' ? value.call(host) : value;
552
- };
553
-
554
- const deserialize = (value, type, fallback) => {
555
- if (value === null) return type === 'boolean' ? false : fallback;
556
- if (type === 'boolean') return value !== 'false' && value !== '0';
557
- if (type === 'number') return Number(value);
558
- if (type === 'object' || type === 'array') {
559
- try { return JSON.parse(value); }
560
- catch { return fallback; }
561
- }
562
- return value;
563
- };
564
-
565
- const serialize = (value, type) => {
566
- if (value == null || value === false) return null;
567
- if (type === 'boolean') return '';
568
- if (type === 'object' || type === 'array') return JSON.stringify(value);
569
- return String(value);
570
- };
571
-
572
- const cloneDefault = (value, type) => {
573
- if (value == null || (type !== 'object' && type !== 'array')) return value;
574
- if (typeof structuredClone === 'function') return structuredClone(value);
575
- return JSON.parse(JSON.stringify(value));
576
- };
577
-
578
- const defaultFor = property => cloneDefault(
579
- property.default ?? ({ string: '', number: 0, boolean: false, object: {}, array: [] })[property.type],
580
- property.type,
581
- );
582
-
583
- export class StxElement extends HTMLElementBase {
584
- static definition = {};
585
- static get observedAttributes() { return this.definition.observedAttributes || []; }
586
-
587
- constructor() {
588
- super();
589
- this._values = Object.create(null);
590
- this._reflecting = false;
591
- this._connected = false;
592
- this._hasConnected = false;
593
- this._initializing = false;
594
- this._updatePending = false;
595
- this._listeners = new Map();
596
- const definition = this.constructor.definition;
597
- for (const [name, property] of Object.entries(definition.properties || {})) {
598
- this._values[name] = defaultFor(property);
599
- }
600
- if (definition.shadowMode && this.attachShadow && !this.shadowRoot) {
601
- this._closedRoot = this.attachShadow({ mode: definition.shadowMode });
602
- }
603
- }
604
-
605
- get updateComplete() { return this._updateComplete || Promise.resolve(); }
606
- get renderRoot() { return this._closedRoot || this.shadowRoot || this; }
607
-
608
- connectedCallback() {
609
- if (this._connected) return;
610
- this._connected = true;
611
- this._initializing = true;
612
- const definition = this.constructor.definition;
613
- for (const [name, property] of Object.entries(definition.properties || {})) {
614
- const attribute = property.attribute === false ? null : (property.attribute || name.replace(/[A-Z]/g, letter => '-' + letter.toLowerCase()));
615
- if (attribute && this.hasAttribute?.(attribute)) this._values[name] = deserialize(this.getAttribute(attribute), property.type, defaultFor(property));
616
- }
617
- // Properties assigned before customElements.define() become own properties.
618
- // Upgrade them after attributes so imperative state wins, matching the
619
- // platform's property-first custom-element initialization convention.
620
- for (const name of Object.keys(definition.properties || {})) this._upgradeProperty(name);
621
- this._initializing = false;
622
- const root = this.renderRoot;
623
- const hasMarkup = [...(root.childNodes || [])].some(node => node.nodeType !== 3 || node.textContent.trim());
624
- const firstConnection = !this._hasConnected;
625
- if (!(firstConnection && definition.progressive && hasMarkup)) this._render();
626
- else this._upgradeDeclarativeEvents();
627
- this._bindEvents();
628
- if (firstConnection) {
629
- this._hasConnected = true;
630
- this.setAttribute?.('hydrated', '');
631
- this.dispatchEvent?.(new CustomEvent('stx:hydrated', { bubbles: true, composed: true }));
632
- }
633
- // Called last, so a component that acquires something sees its own rendered
634
- // markup and its events already bound. Reported rather than rethrown: a
635
- // component that fails to set up must not take the element down with it.
636
- try { this.onConnect?.(); }
637
- catch (error) { console.error('[stx] onConnect failed', error); }
638
- }
639
-
640
- disconnectedCallback() {
641
- this._connected = false;
642
- // Called before the framework releases anything, so the element is still
643
- // intact for a component that needs to read it on the way out, and inside
644
- // try/finally so a throwing hook cannot leak the framework's own listeners.
645
- try { this.onDisconnect?.(); }
646
- catch (error) { console.error('[stx] onDisconnect failed', error); }
647
- finally {
648
- for (const [event, listener] of this._listeners) this.renderRoot.removeEventListener(event, listener);
649
- this._listeners.clear();
650
- }
651
- }
652
-
653
- attributeChangedCallback(attribute, oldValue, newValue) {
654
- if (oldValue === newValue || this._reflecting) return;
655
- const definition = this.constructor.definition;
656
- const name = definition.attributeToProperty?.[attribute];
657
- if (!name) return;
658
- const property = definition.properties[name];
659
- const value = deserialize(newValue, property.type, defaultFor(property));
660
- if (!Object.is(this._values[name], value)) {
661
- this._values[name] = value;
662
- this.requestUpdate();
663
- }
664
- }
665
-
666
- /**
667
- * The props a compiled render reads.
668
- *
669
- * Its own method rather than _values directly, so a component that sets a
670
- * property before upgrade still sees it, and so the generated code has one
671
- * name to depend on rather than a private field's shape.
672
- */
673
- _props() {
674
- return this._values;
675
- }
676
-
677
- requestUpdate() {
678
- if (!this._connected || this._initializing || this._updatePending) return this.updateComplete;
679
- this._updatePending = true;
680
- this._updateComplete = new Promise((resolve) => {
681
- queueMicrotask(() => {
682
- this._updatePending = false;
683
- if (this._connected) this._render();
684
- resolve();
685
- });
686
- });
687
- return this._updateComplete;
688
- }
689
-
690
- emit(name, detail, options = {}) {
691
- return this.dispatchEvent(new CustomEvent(name, {
692
- detail, bubbles: true, composed: true, ...options,
693
- }));
694
- }
695
-
696
- _upgradeProperty(name) {
697
- if (!Object.prototype.hasOwnProperty.call(this, name)) return;
698
- const value = this[name];
699
- delete this[name];
700
- this[name] = value;
701
- }
702
-
703
- _upgradeDeclarativeEvents() {
704
- for (const element of this.renderRoot.querySelectorAll?.('*') || []) {
705
- const names = element.getAttributeNames?.() || [...(element.attributes || [])].filter(Boolean).map(attribute => attribute.name);
706
- for (const attributeName of names) {
707
- if (!attributeName?.startsWith('@')) continue;
708
- const [event, ...modifiers] = attributeName.slice(1).split('.');
709
- element.setAttribute('data-stx-on-' + event, element.getAttribute(attributeName));
710
- if (modifiers.length) element.setAttribute('data-stx-mod-' + event, modifiers.join(' '));
711
- element.removeAttribute(attributeName);
712
- }
713
- }
714
- }
715
-
716
- _bindEvents() {
717
- for (const event of this.constructor.definition.eventTypes || []) {
718
- if (this._listeners.has(event)) continue;
719
- const listener = ($event) => {
720
- const selector = '[data-stx-on-' + event + ']';
721
- const target = $event.target?.closest?.(selector);
722
- if (!target || !this.renderRoot.contains(target)) return;
723
- const modifiers = (target.getAttribute('data-stx-mod-' + event) || '').split(' ');
724
- if (modifiers.includes('prevent')) $event.preventDefault();
725
- if (modifiers.includes('stop')) $event.stopPropagation();
726
- const method = target.getAttribute('data-stx-on-' + event);
727
- if (typeof this[method] === 'function') this[method]($event);
728
- };
729
- this.renderRoot.addEventListener(event, listener);
730
- this._listeners.set(event, listener);
731
- }
732
- }
733
-
734
- _render() {
735
- const definition = this.constructor.definition;
736
- const root = this.renderRoot;
737
- const active = root.activeElement || (root.contains?.(globalThis.document?.activeElement) ? globalThis.document.activeElement : null);
738
- const focusKey = active && (active.getAttribute?.('data-key') || active.id || active.getAttribute?.('name'));
739
- const selection = active && 'selectionStart' in active ? [active.selectionStart, active.selectionEnd] : null;
740
- // A compiled component renders itself: the control flow and the derived
741
- // values were turned into JavaScript at build time, so there is nothing to
742
- // interpret here and nothing that needs an eval the page's CSP forbids.
743
- // The string template remains for components that carry no logic.
744
- let html = typeof this.render === 'function'
745
- ? this.render(RENDER_HELPERS)
746
- : definition.template
747
- .replace(new RegExp(${e}, 'g'), (_match, expression) => String(valueAt(this, expression) ?? ''))
748
- .replace(new RegExp(${t}, 'g'), (_match, expression) => escapeHTML(valueAt(this, expression)));
749
- if (definition.shadowMode && definition.styles) html = '<style>' + definition.styles + '</style>' + html;
750
- root.innerHTML = html;
751
- this._applyBindings();
752
- this._bindEvents();
753
- if (focusKey) {
754
- const escaped = globalThis.CSS?.escape ? globalThis.CSS.escape(focusKey) : focusKey.replace(/["\\\\]/g, '\\$&');
755
- const next = root.querySelector('[data-key="' + escaped + '"],#' + escaped + ',[name="' + escaped + '"]');
756
- next?.focus?.();
757
- if (selection && next?.setSelectionRange) next.setSelectionRange(selection[0], selection[1]);
758
- }
759
- this.dispatchEvent?.(new CustomEvent('stx:updated', { bubbles: false }));
760
- }
761
-
762
- _applyBindings() {
763
- for (const binding of this.constructor.definition.bindings || []) {
764
- const element = this.renderRoot.querySelector('[data-stx-bind-' + binding.id + ']');
765
- if (!element) continue;
766
- const value = valueAt(this, binding.expression);
767
- if (binding.name === 'class') element.className = value || '';
768
- else if (binding.name === 'style' && typeof value === 'object') {
769
- Object.assign(element.style, value);
770
- }
771
- else if (typeof value === 'boolean') {
772
- element.toggleAttribute(binding.name, value);
773
- if (binding.name in element) element[binding.name] = value;
774
- }
775
- else if (value == null || value === false) element.removeAttribute(binding.name);
776
- else element.setAttribute(binding.name, String(value));
777
- }
778
- }
779
- }
780
-
781
- /**
782
- * What a compiled render is handed.
783
- *
784
- * Passed in rather than closed over so the generated code names no globals, and
785
- * a component module stays readable on its own: __escape is visibly a
786
- * parameter, not something the bundler happened to leave in scope.
787
- */
788
- const RENDER_HELPERS = {
789
- escape: escapeHTML,
790
- // The raw form is the author declaring the value is markup. Null becomes an
791
- // empty string rather than the word "null", which is the only sensible
792
- // reading of a missing fragment.
793
- raw: (value) => String(value ?? ''),
794
- // A loop over something absent runs zero times. Throwing here would fail a
795
- // whole page over one empty list, which is never what the author meant.
796
- values: (value) => value == null ? [] : (value[Symbol.iterator] ? value : Object.values(value)),
797
- entries: (value) => value == null ? [] : (Array.isArray(value) ? value.entries() : Object.entries(value)),
798
- };
799
-
800
- export function defineComponent(Component, definition) {
801
- const properties = definition.properties || {};
802
- const attributeToProperty = {};
803
- const observedAttributes = [];
804
- for (const [name, property] of Object.entries(properties)) {
805
- const attribute = property.attribute === false ? null : (property.attribute || name.replace(/[A-Z]/g, letter => '-' + letter.toLowerCase()));
806
- if (attribute) {
807
- attributeToProperty[attribute] = name;
808
- observedAttributes.push(attribute);
809
- }
810
- // A style prop is an attribute value, not a replacement for the browser's
811
- // CSSStyleDeclaration. Native event handler accessors must survive too.
812
- if (name in HTMLElementBase.prototype) {
813
- if (!attribute) throw new TypeError('STX prop "' + name + '" overlaps the native DOM API and needs an attribute binding');
814
- continue;
815
- }
816
- Object.defineProperty(Component.prototype, name, {
817
- configurable: true,
818
- enumerable: true,
819
- get() { return this._values[name]; },
820
- set(value) {
821
- const oldValue = this._values[name];
822
- if (Object.is(oldValue, value)) return;
823
- this._values[name] = value;
824
- if (property.reflect && attribute && !this._reflecting) {
825
- const serialized = serialize(value, property.type);
826
- this._reflecting = true;
827
- if (serialized === null) this.removeAttribute(attribute);
828
- else this.setAttribute(attribute, serialized);
829
- this._reflecting = false;
830
- }
831
- this.requestUpdate();
832
- this.dispatchEvent?.(new CustomEvent(name + '-changed', {
833
- detail: { value, oldValue }, bubbles: true, composed: true,
834
- }));
835
- },
836
- });
837
- }
838
- Component.definition = { ...definition, attributeToProperty, observedAttributes };
839
- const registry = globalThis.customElements || globalThis.window?.customElements;
840
- if (registry && !registry.get(definition.tag)) {
841
- registry.define(definition.tag, Component);
842
- }
843
- return Component;
844
- }
845
- `}function Ou(e){let t=JSON.stringify({tag:e.tag,template:e.template,styles:e.styles,shadowMode:e.shadowMode,progressive:e.progressive,properties:e.properties,eventTypes:e.eventTypes,bindings:e.bindings},null,2),i=Object.entries(e.methods).map(([f,x])=>{if(Uo.has(f))throw Error(`${e.sourcePath}: ${Vo(f)}`);if(/^(?:async\s+)?[A-Za-z_$][\w$]*\s*\(/.test(x.trim()))return` ${x.trim()}`;return` ${f}($event) {
846
- ${x}
847
- }`}).join(`
848
-
849
- `),r=e.scope,a=[...new Set([...Object.keys(e.properties),...r.propNames])].map((f)=>{let x=r.propBindings[f]||f;return r.defaults[f]===void 0?x:`${x} = ${r.defaults[f]}`}).join(", "),l=(f)=>f.split(`
850
- `).map((x)=>x.trim()===""?x:` ${x}`).join(`
851
- `),u="";if(e.render.trim()!==""||r.body!==""||a!==""){let f=[a?`const { ${a} } = this._props();`:"",r.body,"let out = '';",e.render,"return out;"].filter(Boolean).join(`
852
- `),x;try{let v=new Bun.Transpiler({loader:"ts"}).transformSync(`export function __render(__helpers) {
853
- ${f}
854
- }`),A=v.indexOf("{"),M=v.lastIndexOf("}");x=v.slice(A+1,M).trim()}catch(v){throw Error(`${e.sourcePath}: failed to compile render (${v.message})`)}u=`
855
- render(__helpers) {
856
- const { escape: __escape, raw: __raw, values: __values, entries: __entries } = __helpers;
857
- ${l(x.trim())}
858
- }
859
- `}return`import { StxElement, defineComponent } from './runtime.js';
860
- ${r.imports.length?`${r.imports.join(`
861
- `)}
862
- `:""}
863
- /** ${e.description||`${e.name} web component generated from ${e.file}.`} */
864
- export class ${e.name} extends StxElement {
865
- ${i}${u}
866
- }
867
-
868
- defineComponent(${e.name}, ${t});
869
- export default ${e.name};
870
- `}function Gt(e){if(!e||typeof e!=="object")return"unknown";switch(e.type){case"boolean":return"boolean";case"number":return"number";case"array":return"unknown[]";case"object":return"Record<string, unknown>";default:return"string"}}function Pu(e){let t=Object.entries(e.properties).map(([a,l])=>` ${a}${l.required?"":"?"}: ${Gt(l)}`).join(`
871
- `),i=Object.entries(e.events).map(([a,l])=>` ${JSON.stringify(a)}: CustomEvent<${l.detailType||"unknown"}>`).join(`
872
- `),r=Object.keys(e.methods).flatMap((a)=>e.methodDeclarations[a]||[`${a}($event?: Event): unknown`]).map((a)=>` ${a}`).join(`
873
- `);return`${e.declarationTypes?`${e.declarationTypes}
874
-
875
- `:""}export interface ${e.name}Props {
876
- ${t}
877
- }
878
-
879
- export interface ${e.name}EventMap {
880
- ${i}
881
- }
882
-
883
- export interface ${e.name} extends Required<Pick<${e.name}Props, Exclude<keyof ${e.name}Props, keyof HTMLElement>>> {}
884
-
885
- export declare class ${e.name} extends HTMLElement {
886
- ${r}
887
- readonly updateComplete: Promise<void>
888
- requestUpdate(): Promise<void>
889
- emit<T = unknown>(name: string, detail?: T, options?: CustomEventInit<T>): boolean
890
- }
891
-
892
- declare global {
893
- interface HTMLElementTagNameMap {
894
- ${JSON.stringify(e.tag)}: ${e.name}
895
- }
896
- }
897
-
898
- export default ${e.name}
899
- `}function ju(e){return`declare global {
900
- namespace JSX {
901
- interface IntrinsicElements {
902
- ${e.map((i)=>{let r=Object.entries(i.properties).map(([l,u])=>` ${JSON.stringify(l)}?: ${Gt(u)}`).join(`
903
- `),a=Object.keys(i.events).map((l)=>` ${`on${l.split(/[-:]/).map((f)=>f.charAt(0).toUpperCase()+f.slice(1)).join("")}`}?: (event: CustomEvent<${i.events[l].detailType||"unknown"}>) => void`).join(`
904
- `);return` ${JSON.stringify(i.tag)}: {
905
- ${r}
906
- ${a}
907
- children?: unknown
908
- slot?: string
909
- class?: string
910
- className?: string
911
- }`}).join(`
912
- `)}
913
- }
914
- }
915
- }
916
-
917
- export {}
918
- `}function Mu(e){return{schemaVersion:"1.0.0",modules:e.map((t)=>({kind:"javascript-module",path:`./${t.tag}.js`,declarations:[{kind:"class",name:t.name,description:t.description||void 0,customElement:!0,tagName:t.tag,members:Object.entries(t.properties).map(([i,r])=>({kind:"field",name:i,description:r.description,type:{text:Gt(r)},default:r.default===void 0?void 0:JSON.stringify(r.default),attribute:r.attribute===!1?void 0:r.attribute||hr(i),reflects:r.reflect})),events:Object.entries(t.events).map(([i,r])=>({name:i,description:r.description,type:{text:`CustomEvent<${r.detailType||"unknown"}>`}})),slots:t.slots,cssProperties:t.cssProperties}],exports:[{kind:"js",name:t.name,declaration:{name:t.name,module:`./${t.tag}.js`}}]}))}}function Wo(e){if(!e.styles)return"";let t=e.styles.replace(/:host\b/g,":scope");if(/\@scope\s*\(/.test(t))return t;return`@scope (${e.tag}) {
919
- ${t}
920
- }`}function Fo(e){return e.replace(/\/\*[\s\S]*?\*\//g,"").replace(/\s+/g," ").replace(/\s*([{}:;,])\s*/g,"$1").replace(/;}/g,"}").trim()}function Du(e){let t=JSON.stringify("\\{!!\\s*([\\w$.]+)\\s*!!\\}"),i=JSON.stringify("\\{\\{\\s*([\\w$.]+)\\s*\\}\\}"),r=JSON.stringify('<slot(?:\\s+name=["\\\']([^"\\\']+)["\\\'])?\\s*\\/?>(?:<\\/slot>)?'),a=Object.fromEntries(e.map((u)=>[u.tag,{template:u.template,styles:u.styles,shadowMode:u.shadowMode,properties:u.properties}])),l=e.map((u)=>`export const render${u.name} = (props = {}, slots = {}) => renderComponent('${u.tag}', props, slots);`).join(`
921
- `);return`const definitions = ${JSON.stringify(a,null,2)};
922
- const escapeHTML = (value) => String(value ?? '')
923
- .replaceAll('&', '&amp;').replaceAll('<', '&lt;').replaceAll('>', '&gt;')
924
- .replaceAll('"', '&quot;').replaceAll("'", '&#039;');
925
- const valueAt = (values, path) => path.trim().split('.').reduce((value, part) => value?.[part], values);
926
-
927
- export function renderComponent(tag, props = {}, slots = {}) {
928
- const definition = definitions[tag];
929
- if (!definition) throw new Error('Unknown STX component: ' + tag);
930
- const values = Object.fromEntries(Object.entries(definition.properties).map(([name, property]) => [name, property.default]));
931
- Object.assign(values, props);
932
- let template = definition.template
933
- .replace(new RegExp(${t}, 'g'), (_match, expression) => String(valueAt(values, expression) ?? ''))
934
- .replace(new RegExp(${i}, 'g'), (_match, expression) => escapeHTML(valueAt(values, expression)))
935
- .replace(new RegExp(${r}, 'gi'), (_match, name) => String(slots[name || 'default'] ?? ''));
936
- const attributes = Object.entries(definition.properties).flatMap(([name, property]) => {
937
- if (property.attribute === false || !(name in props)) return [];
938
- const attribute = property.attribute || name.replace(/[A-Z]/g, letter => '-' + letter.toLowerCase());
939
- const value = props[name];
940
- if (value == null || value === false) return [];
941
- if (value === true) return [attribute];
942
- const serialized = typeof value === 'object' ? JSON.stringify(value) : value;
943
- return [attribute + '=\\"' + escapeHTML(serialized) + '\\"'];
944
- }).join(' ');
945
- if (definition.shadowMode) {
946
- template = '<template shadowrootmode="' + definition.shadowMode + '">' +
947
- (definition.styles ? '<style>' + definition.styles + '</style>' : '') + template + '</template>' +
948
- String(slots.default ?? '');
949
- }
950
- return '<' + tag + (attributes ? ' ' + attributes : '') + '>' + template + '</' + tag + '>';
951
- }
952
-
953
- ${l}
954
- `}async function Gc(e){let t=it.resolve(e.inputDir),i=it.resolve(e.outputDir);if(!(await No(t).catch(()=>null))?.isDirectory())throw Error(`Component-library input directory does not exist: ${t}`);let a=e.components?.length?e.components:(await mu(t)).map((D)=>({file:D}));if(!a.length)throw Error(`No .stx components found in ${t}`);let l=await Promise.all(a.map((D)=>Tu(t,D,e)));l.sort((D,U)=>D.tag.localeCompare(U.tag));let u=l.filter((D,U)=>l.findIndex((q)=>q.tag===D.tag)!==U);if(u.length)throw Error(`Duplicate custom-element tag: ${u[0].tag}`);let f=l.filter((D,U)=>l.findIndex((q)=>q.name===D.name)!==U);if(f.length)throw Error(`Duplicate component class name: ${f[0].name}`);await cu(i,{recursive:!0});let x=[],v=async(D,U)=>{let q=it.join(i,D);return await pu(q,U.endsWith(`
955
- `)?U:`${U}
956
- `,"utf8"),x.push(q),q};await v("runtime.js",Iu());for(let D of l){if(await v(`${D.tag}.js`,Ou(D)),e.declarations!==!1)await v(`${D.tag}.d.ts`,Pu(D));if(e.css!==!1&&D.styles){let U=D.shadowMode?D.styles:Wo(D);await v(`${D.tag}.css`,e.minify?Fo(U):U)}}let A=l.map((D)=>`export { ${D.name}, default as ${D.name}Element } from './${D.tag}.js';`).join(`
957
- `);if(await v("index.js",A),await v("ssr.js",Du(l)),e.declarations!==!1)await v("index.d.ts",l.map((D)=>`export * from './${D.tag}.js'`).join(`
958
- `)),await v("custom-elements.d.ts",ju(l)),await v("ssr.d.ts",`${l.map((D)=>`export declare const render${D.name}: (props?: ${D.name}Props, slots?: Record<string, string>) => string`).join(`
959
- `)}
960
- export declare function renderComponent(tag: string, props?: Record<string, unknown>, slots?: Record<string, string>): string
961
- ${l.map((D)=>`import type { ${D.name}Props } from './${D.tag}.js'`).join(`
962
- `)}`);let M;if(e.manifest!==!1)M=await v("custom-elements.json",JSON.stringify(Mu(l),null,2));let H;if(e.css!==!1){let D=l.filter((U)=>!U.shadowMode&&U.styles).map(Wo).join(`
963
-
964
- `);if(D)H=await v("bundle.css",e.minify?Fo(D):D)}let O;if(e.bundle!==!1){O=it.join(i,"bundle.js");let D;try{D=await Bun.build({entrypoints:[it.join(i,"index.js")],outdir:i,naming:"bundle.js",target:"browser",format:"esm",minify:e.minify??!0,sourcemap:e.sourcemap||"none"})}catch(U){let q=U instanceof AggregateError?U.errors:[U],V=q.map((F)=>String(F).trim()).filter(Boolean).join(`
965
- `);throw AggregateError(q,`Failed to bundle component library${V?`
966
- ${V}`:""}`)}if(!D.success){let U=D.logs.map((q)=>String(q).trim()).filter(Boolean).join(`
967
- `);throw AggregateError(D.logs,`Failed to bundle component library${U?`
968
- ${U}`:""}`)}if(x.push(O),e.sourcemap==="external")x.push(`${O}.map`)}let z=await Promise.all(x.map(async(D)=>(await No(D)).size));return{components:l.map((D)=>({name:D.name,tag:D.tag,source:D.sourcePath,module:it.join(i,`${D.tag}.js`)})),files:x,manifest:M,bundle:O,cssBundle:H,totalBytes:z.reduce((D,U)=>D+U,0)}}function Ws(e){let t=An(e),i=t.find((l)=>l.name==="InheritedContext");if(!i)return;let r=i.text.slice(i.text.indexOf("{")+1,i.text.lastIndexOf("}"));return{keys:[...n(r).matchAll(/(?:^|[;\n])\s*(?:readonly\s+)?([A-Za-z_$][\w$]*)\??\s*:/g)].map((l)=>l[1]),types:t.map((l)=>l.text).join(`
969
- `)}}function qs(e){let t=Ws(e);if(!t)return"";let i=new Set(ge(e));return t.keys.filter((r)=>!i.has(r)).map((r)=>`declare const ${r}: InheritedContext[${JSON.stringify(r)}];`).join(`
970
- `)}function Zo(e,t){let i=[us],r=[],a=new Map,l=ut.resolve(t.filePath),u=l.split(ut.sep).lastIndexOf("views"),f=u>=0?l.split(ut.sep).slice(0,u).join(ut.sep):ut.dirname(l),x=ut.resolve(t.partialsDir||ut.join(f,"partials")),v=ut.resolve(t.layoutsDir||ut.join(f,"views/layouts"));if([x,v].some((U)=>l===U||l.startsWith(U+ut.sep)))return{declarations:"",checks:r,dependencies:a};let A=(U)=>t.readTemplate?.(U)??(Ho.existsSync(U)?Ho.readFileSync(U,"utf8"):void 0),M=0,H=!1,O=[];function z(U,q){let V=e.slice(0,U).split(`
971
- `).length,F=U-e.lastIndexOf(`
972
- `,U-1),Q={code:e.slice(U,e.indexOf(`
973
- `,U)<0?e.length:e.indexOf(`
974
- `,U)),line:V,column:F,kind:"directive",offset:U,anchor:!0};r.push({expression:Q,statement:{text:q,prefixLength:0}})}function D(U,q,V,F,Q,ie){let oe=`__StxInherited${M++}`,me=ve(U).filter((Oe)=>Oe.kind==="server").map((Oe)=>Oe.code).join(`
975
- `),le=yr(gs(me,ut.dirname(q)),oe);i.push(...le.imports);let be=Ws(me);if(be&&Q!==void 0){H=!0;let Oe=le.imports.length?le.aliases.join(`
976
- `):"",ot=ps(`${Oe}
977
- ${be.types}
978
- const __contract = defineProps<InheritedContext>();`,`${oe}Contract`);i.push(ot.declarations),i.push(`declare const ${oe}Input: ${V};`),z(Q,`${oe}Input satisfies ${ot.props};`)}let Ae=ge(me),ke=[...new Set([...F,...be?.keys||[]])].filter((Oe)=>!Ae.includes(Oe)),ye=be?`${V} & ${oe}Contract.__StxProps`:V,Je=wn(le.body).replace(/^[ \t]*export[ \t]+(?=(?:const|let|var|function|async|class|interface|type)\b)/gm,""),Ge=[],pt=Yt(U),Qe=/@(include|extends|layout)\s*\(/g,tt;while(tt=Qe.exec(pt)){let Oe=yn(pt,Qe.lastIndex-1);if(!Oe)continue;Qe.lastIndex=Oe.end;let ot=/^\s*(['"])(.*?)\1\s*(?:,\s*([\s\S]*))?$/.exec(Oe.expression);if(!ot){O.push({offset:Q??tt.index,message:`Inherited context cannot be checked across dynamic @${tt[1]}`});continue}let et=ot[2],Me=tt[1];if(Me!=="include"&&ot[3])O.push({offset:Q??tt.index,message:`Inherited context cannot be checked for unsupported @${Me} data arguments`});let yt=Me==="include"?x:v,Ye=ut.resolve(et.startsWith(".")?ut.dirname(q):yt,et.endsWith(".stx")?et:et+".stx");if(A(Ye)===void 0){O.push({offset:Q??tt.index,message:`Inherited context target cannot be resolved: ${et}`});continue}Ge.push({name:`edge${Ge.length}`,target:Ye,kind:Me,args:Me==="include"?ot[3]||"{}":"{}",offset:Q??tt.index})}let dt=`{ ...parent${Ae.length?", "+Ae.join(", "):""} }`;i.push(`namespace ${oe} {
979
- ${le.aliases.join(`
980
- `)}
981
- export async function read(parent: ${Q===void 0?"{}":ye}) {
982
- ${ke.length?`const { ${ke.join(", ")} } = parent;`:""}
983
- ${Je}
984
- return { context: ${dt}${Ge.map((Oe)=>`, ${Oe.name}: { ...${dt}, ...(${Oe.args}) }`).join("")} };
985
- }
986
- }`);for(let Oe of Ge){if(ie.includes(Oe.target)||ie.length>=32){O.push({offset:Oe.offset,message:"Inherited context cannot be checked across a cyclic or overly deep template graph"});continue}let ot=A(Oe.target);a.set(Oe.target,ot),D(ot,Oe.target,`Awaited<ReturnType<typeof ${oe}.read>>[${JSON.stringify(Oe.name)}]`,[...new Set([...F,...Ae])],Oe.offset,[...ie,Oe.target])}return oe}if(D(e,l,"{}",[],void 0,[l]),H||t.contractsKnown)for(let U of O)z(U.offset,`({})[${JSON.stringify(U.message)}];`);return{declarations:H?i.join(`
987
- `):"",checks:r,dependencies:a}}function Ks(e,t){let i=fs(e);if(!/<script\b(?=[^>]*(?:\bcomponent\b|\bstx:component\b))/i.test(i))return;let r;try{r=xr(e,"component")}catch(O){let z=e.search(/<script\b(?=[^>]*\bcomponent\b)/i),D=O instanceof Error?O.message:"Invalid component metadata";return{declarations:"",checks:[{text:`({})[${JSON.stringify(D)}];`,line:e.slice(0,z).split(`
988
- `).length,column:z-e.lastIndexOf(`
989
- `,z-1),origin:"component"}],project:(U)=>({code:U,columns:new Map})}}let a=[...i.matchAll(/<script\b([^>]*)>([\s\S]*?)<\/script>/gi)].filter((O)=>/\bclient\b/.test(O[1])&&!/\bcomponent\b/.test(O[1])),l=a.map((O)=>{let z=O.index+O[0].indexOf(">")+1;return e.slice(z,z+O[2].length)}).join(`
990
- `),u=ds(l,t),f=/\b(?:interface|type)\s+ComponentState\b/.test(n(l)),x=Object.entries(r.properties||r.props||{}).map(([O,z])=>`${JSON.stringify(O)}: ${Gt(z)}`).join("; "),v=[...new Set(u.map((O)=>O.name))],A=[`interface __StxNativeProperties { ${x} }`,f?"declare const __stxStateProperties: Pick<ComponentState, Extract<keyof ComponentState, keyof __StxNativeProperties>>;":"",`type __StxNativeComponent = Omit<HTMLElement, keyof __StxNativeProperties | ${f?"keyof ComponentState | ":""}${v.map((O)=>JSON.stringify(O)).join(" | ")||"never"}> & ${f?"Omit<__StxNativeProperties, keyof ComponentState> & ComponentState":"__StxNativeProperties"} & {`,"readonly updateComplete: Promise<void>; requestUpdate(): Promise<void>; readonly renderRoot: HTMLElement | ShadowRoot;","emit<T = unknown>(name: string, detail?: T, options?: CustomEventInit<T>): boolean;",...v.map((O)=>`${JSON.stringify(O)}: typeof ${O};`),"}"].filter(Boolean).join(`
991
- `),M=-1;for(let O of a){let z=O.index+O[0].indexOf(">")+1,D=/\b(?:interface|type)\s+ComponentState\b/.exec(n(e.slice(z,z+O[2].length)));if(D){M=z+D.index;break}}let H=f&&M>=0?[{origin:"client",text:"__stxStateProperties satisfies Pick<__StxNativeProperties, Extract<keyof ComponentState, keyof __StxNativeProperties>>;",line:e.slice(0,M).split(`
992
- `).length,column:M-e.lastIndexOf(`
993
- `,M-1)}]:[];for(let[O,z]of Object.entries(r.properties||r.props||{})){let D=e.indexOf(JSON.stringify(O),e.indexOf("<script")),U=e.slice(0,D).split(`
994
- `).length,q=D-e.lastIndexOf(`
995
- `,D-1);if(!z||typeof z!=="object"||!["string","number","boolean","object","array"].includes(z.type))H.push({text:`({})[${JSON.stringify(`Property ${O} must declare string, number, boolean, object or array`)}];`,line:U,column:q,origin:"component"});if(z&&z.default!==void 0)H.push({text:`const __stxDefault${H.length}: ${Gt(z)} = ${JSON.stringify(z.default)};`,line:U,column:q,origin:"component"})}return{declarations:A,checks:H,project(O){let z=new Map,D=[],U=0;for(let q of ds(O,t)){if(/^\s*this\s*:/.test(q.parameters))continue;let V=q.parameterOffset,F=`this: __StxNativeComponent${q.parameters.trim()?", ":""}`;D.push(O.slice(U,V),F);let Q=O.slice(0,V).split(`
996
- `).length,ie=V-O.lastIndexOf(`
997
- `,V-1),oe=z.get(Q)||[],me=oe.at(-1),le=ie+(me?me.generatedEnd-me.sourceEnd:0);oe.push({sourceStart:ie,sourceEnd:ie,generatedStart:le,generatedEnd:le+F.length}),z.set(Q,oe),U=V}return D.push(O.slice(U)),{code:D.join(""),columns:z}}}}function qo(e){let t=[],i=[],r=/@foreach\s*\(|@endforeach\b/g,a;while(a=r.exec(e)){if(a[0].startsWith("@endforeach")){let x=i.pop();if(x)x.end=a.index,t.push(x);continue}let l=yn(e,r.lastIndex-1);if(!l)continue;let u=br(l.expression),f=l.end;if(u)i.push({start:f,end:e.length,iterable:u.iterable,binding:u.key?`${u.value}, ${u.key}`:u.value});r.lastIndex=f}return t.sort((l,u)=>l.start-u.start)}var Ko=/<script(\s[^>]*)?>([\s\S]*?)<\/script>/gi;function Nu(e){let t=(i)=>i.replace(/[^\n]/g," ");return e.replace(/<!--[\s\S]*?-->/g,t).replace(/\{\{--[\s\S]*?--\}\}/g,t)}function ve(e){let t=[],i=Nu(e);Ko.lastIndex=0;let r;while((r=Ko.exec(i))!==null){let a=(r[1]||"").trim(),l=(r[0].match(/^<script(?:\s[^>]*)?>/i)?.[0]??"<script>").length,u=(r[0].match(/<\/script\s*>$/i)?.[0]??"</script>").length,f=r.index+l,x=r.index+r[0].length-u,v=e.slice(f,x);if(/\bsrc\s*=/.test(a)||/\b(?:stx:)?component\b/.test(a))continue;let A=a.match(/\btype\s*=\s*["']([^"']+)["']/i);if(A&&!/^(?:module|text\/(?:javascript|typescript))$/i.test(A[1]))continue;let M=/\bserver\b/.test(a)?"server":/\bclient\b/.test(a)?"client":"plain",H=In(e,f);t.push({kind:M,code:v,startLine:H,startColumn:On(e,f),offset:f,attrs:a})}return t}function In(e,t){let i=1;for(let r=0;r<t&&r<e.length;r++)if(e.charCodeAt(r)===10)i++;return i}function On(e,t){let i=e.lastIndexOf(`
998
- `,t-1)+1;return t-i+1}function Yt(e){let t=e.split(""),i=(a,l)=>{for(let u=a;u<l&&u<t.length;u++)if(t[u]!==`
999
- `)t[u]=" "},r=[/<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 a of r){a.lastIndex=0;let l;while((l=a.exec(e))!==null)i(l.index,l.index+l[0].length)}return t.join("")}function ra(e){let t=0,i="";for(let r=0;r<e.length;r++){let a=e[r];if(i){if(a==="\\"){r++;continue}if(a===i)i="";continue}if(a==='"'||a==="'"||a==="`"){i=a;continue}if(a==="("||a==="["||a==="{"){t++;continue}if(a===")"||a==="]"||a==="}"){t--;continue}if(a==="|"&&t===0){if(e[r+1]==="|"){r++;continue}if(e[r-1]==="|")continue;return e.slice(0,r)}}return e}var ia=new Set([":for","x-for","v-for"]),ms=/(?:^|\s)((?::|x-|v-|@)[\w.:-]+)\s*=\s*(["'])([\s\S]*?)\2/g,_r="__stx_interpolated",Jo="__StxElement",oa="__StxTemplateValue",Lu=`type ${oa}<T> = T extends { readonly _isSignal: true } | { readonly _isDerived: true } ? (T extends () => infer V ? T & V : T) : T`;function Xo(e){return e.replace(/\{\{[\s\S]*?\}\}/g,_r).replace(/\{!![\s\S]*?!!\}/g,_r)}function zu(e,t,i){let r=0;for(let a=t;a<e.length;a++){let l=e[a];if(l==="{"){r++;continue}if(l!=="}"&&l!=="!")continue;if(e.startsWith(i,a)&&r===0)return a;if(l==="}"&&r>0)r--}return-1}function xi(e,t,i="0"){let r=`__stxScript${i}`;while((e+t).includes(r))r+="_";let a=new Map,l=[],u=[],f=n(e),x=da(e),v=[],A=0;for(let D=0;D<f.length;D++){let U=f.startsWith("{{",D);if(!U&&!f.startsWith("{!!",D))continue;let q=U?2:3,V=U?"}}":"!!}",F=zu(f,D+q,V);if(F<0)continue;let Q=D,ie=e.slice(Q,F+V.length),oe=ie.slice(q,-V.length);D=F+V.length-1;let me=u.length,le=Sr(x,Q),be=Sr(x,Q+(U?2:3));u.push({code:ra(oe),...be});let Ae=`${r}_${me}`,ke=ie.split(`
1000
- `),ye=ke[0].length;ke[0]=Ae+" ".repeat(Math.max(0,ye-Ae.length));for(let Qe=1;Qe<ke.length;Qe++)ke[Qe]=ke[Qe].replace(/[^\r]/g," ");let Je=a.get(le.line)??[],Ge=Je.at(-1),pt=le.column+(Ge?Ge.generatedEnd-Ge.sourceEnd:0);Je.push({sourceStart:le.column,sourceEnd:le.column+ye,generatedStart:pt,generatedEnd:pt+ke[0].length}),a.set(le.line,Je),v.push(e.slice(A,Q),ke.join(`
1001
- `)),A=Q+ie.length}v.push(e.slice(A));let M=v.join("");if(!u.length)return{code:M,columns:a,declarations:l};let{imports:H,aliases:O,body:z}=yr(t,r);for(let D of H)l.push({text:D});l.push({text:`namespace ${r}Scope {
1002
- ${O.join(`
1003
- `)}
1004
- export async function read() {
1005
- ${wn(z).replace(/^[ \t]*export[ \t]+(?=(?:const|let|var|function|async|class|interface|type)\b)/gm,"")}
1006
- return {`});for(let[D,U]of u.entries())l.push({text:`value${D}: (`}),l.push({text:U.code,origin:{line:U.line,column:U.column}}),l.push({text:"),"});l.push({text:`}
1007
- }
1008
- }`});for(let D=0;D<u.length;D++)l.push({text:`declare var ${r}_${D}: Awaited<ReturnType<typeof ${r}Scope.read>>['value${D}']`});return{code:M,columns:a,declarations:l}}function yr(e,t){let i=[],{imports:r,body:a}=ca(e),l=[],u=0;for(let f of r.split(/\n(?=import\b)/)){if(!f.trim())continue;let x=/^import\s+(?:type\s+)?([\s\S]+?)\s+from\s*(['"][^'"]+['"])/.exec(f);if(!x){i.push(f);continue}let v=`${t}Module${u++}`;i.push(`import * as ${v} from ${x[2]}`);let A=x[1],M=/\{([\s\S]*?)\}/.exec(A);for(let D of M?.[1].split(",")??[]){let[U,q=U]=D.trim().replace(/^type\s+/,"").split(/\s+as\s+/);if(U==="default")l.push(`const ${q} = ${v}.default; type ${q} = import(${x[2]}).default`);else if(U)l.push(`import ${q} = ${v}.${U}`)}let H=A.replace(/\{[\s\S]*?\}/,""),O=/\*\s+as\s+(\w+)/.exec(H);if(O)l.push(`import ${O[1]} = ${v}`);let z=/^\s*([\w$]+)/.exec(H)?.[1];if(z)l.push(`const ${z} = ${v}.default; type ${z} = import(${x[2]}).default`)}return{imports:i,aliases:l,body:a}}function wr(e,t){let i=0;for(let r of e){if(t<r.generatedStart)break;if(t<r.generatedEnd)return r.sourceStart+Math.min(t-r.generatedStart,r.sourceEnd-r.sourceStart);i=r.sourceEnd-r.generatedEnd}return t+i}var Bu=["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"],Wu=new RegExp(String.raw`^[ \t]*@(?:${Bu.join("|")})\b[ \t]*(\([^\n)]*\))?[ \t]*$`,"gm");function wn(e){return e.replace(Wu,(t)=>t.replace(/[^\n]/g," "))}var Go=new Set(["x-cloak","x-ref","x-transition","x-teleport","v-slot","x-hydrate",":key","x-tooltip","x-tooltip-position"]);function yg(e){let t=Yt(e),i=[],r=/(@?)\{\{([\s\S]*?)\}\}|(@?)\{!!([\s\S]*?)!!\}/g,a;while((a=r.exec(t))!==null){if(a[1]||a[3])continue;let f=a[2]??a[4]??"",x=a[2]!==void 0?2:3,v=ra(f);if(!v.trim())continue;let A=a.index+x+(v.length-v.trimStart().length);i.push({code:v.trim(),line:In(t,A),column:On(t,A),offset:A,kind:"interpolation"})}let l=/@(if|elseif|else\s+if|unless)\b\s*\(/g;while((a=l.exec(t))!==null){let u=a.index+a[0].length-1,f=0,x=u;for(;x<t.length;x++){let H=t[x];if(H==="(")f++;else if(H===")"){if(f--,f===0)break}}if(f!==0)continue;let v=t.slice(u+1,x),A=v.trim();if(l.lastIndex=x+1,!A)continue;let M=u+1+(v.length-v.trimStart().length);i.push({code:A,line:In(t,M),column:On(t,M),offset:a.index,kind:"condition"})}ms.lastIndex=0;while((a=ms.exec(t))!==null){let u=a[1],f=a[3]??"",x=u.replace(/\..*$/,"").replace(/^([^:].*?):.*$/,"$1");if(Go.has(x)||Go.has(u))continue;if(!f.trim())continue;let v=a.index+a[0].indexOf(a[2],a[0].indexOf(u)+u.length)+1;if(ia.has(x)){let M=f.match(/\s+(?:in|of)\s+/);if(!M||M.index===void 0)continue;let H=f.slice(M.index+M[0].length),O=M.index+M[0].length+(H.length-H.trimStart().length);i.push({code:Xo(H.trim()),line:In(t,v+O),column:On(t,v+O),offset:v+O,kind:"directive",attribute:x});continue}let A=f.length-f.trimStart().length;i.push({code:Xo(f.trim()),line:In(t,v+A),column:On(t,v+A),offset:v+A,kind:"directive",attribute:x})}return i.sort((u,f)=>u.line-f.line||u.column-f.column),i}var Fu=2000;function Vu(e,t){let i=0,r=Math.min(e.length,t+Fu);for(let a=t;a<r;a++){let l=e[a];if(l==="(")i++;else if(l===")"){if(i--,i===0)return e.slice(t+1,a)}}return null}function Uu(e){let t=new Map,i=(f,x)=>{let v=f.split(/[,[\]{}()\s]+/).filter(Boolean);for(let A of v){let M=A.replace(/^\.\.\./,"").trim();if(!/^\$?[A-Z_$][\w$]*$/i.test(M))continue;let H=v.length===1?x:void 0,O=t.get(M);if(!O)t.set(M,{name:M,iterable:H});else if(O.iterable!==H)O.iterable=void 0}},r=/^\$?[A-Z_$][\w$]*$/i,a=(f)=>{let x=f.trim();return r.test(x)?x:void 0};for(let f of e.matchAll(/@for(?:each|else)\s*\(/g)){let x=Vu(e,f.index+f[0].length-1);if(x===null)continue;let v=jt(x);if(!v)continue;i(v.itemVar.replace(/=>/g," "),a(v.arrayExpr))}for(let f of e.matchAll(/@for\s*\(\s*(?:(?:let|const|var)\s+)?([\w$]+|\[[^\]]*\]|\{[^}]*\})\s+(of|in)\s+([^)]*)/g))i(f[1],f[2]==="of"?a(f[3]):void 0);for(let f of e.matchAll(/@for\s*\(\s*(?:let|const|var)\s+([\w$]+)\s*[=;]/g))i(f[1]);let l=Yt(e);ms.lastIndex=0;let u;while((u=ms.exec(l))!==null){let f=u[1].replace(/\..*$/,"");if(!ia.has(f))continue;let x=u[3].match(/\s+(?:in|of)\s+/);if(!x||x.index===void 0)continue;i(u[3].slice(0,x.index),a(u[3].slice(x.index+x[0].length)))}for(let f of e.matchAll(/@(?:php|js|ts)\b([\s\S]*?)@end(?:php|js|ts)\b/g))for(let x of f[1].matchAll(/\b(?:const|let|var|function|class)\s+([\w$]+)/g))i(x[1]);return[...t.values()].sort((f,x)=>f.name.localeCompare(x.name))}function ge(e){let t=new Set;for(let i of e.matchAll(/^\s*(?:export\s+)?(?:const|let|var)\s+([\w$]+)/gm))t.add(i[1]);for(let i of e.matchAll(/^\s*(?:export\s+)?(?:async\s+)?function\s*\*?\s*([\w$]+)/gm))t.add(i[1]);for(let i of e.matchAll(/^\s*(?:export\s+)?class\s+([\w$]+)/gm))t.add(i[1]);for(let i of e.matchAll(/^\s*(?:export\s+)?(?:const|let|var)\s*[[{]([^\]}]*)[\]}]/gm))for(let r of i[1].split(",")){let a=r.split(":").pop().split("=")[0].replace(/^\.\.\./,"").trim();if(/^[A-Z_$][\w$]*$/i.test(a))t.add(a)}return[...t].sort()}var vr=["params","query","cookies","host","ip","setResponseStatus","setResponseHeader","notFound","request","url","definePageMeta","defineClientPayload","defineStore","props","$props"],Hu={$bool:"declare function $bool(value: unknown, fallback?: boolean): boolean",$num:"declare function $num(value: unknown, fallback?: number): number",$uid:"declare var $uid: string",$native:"declare var $native: boolean"};function Xc(e=new Set){return[...vr.filter((t)=>!e.has(t)).map((t)=>`declare var ${t}: any`),...Object.entries(Hu).filter(([t])=>!e.has(t)).map(([,t])=>t)].join(`
1009
- `)}function Jc(e){return new Set([...e.matchAll(/^declare (?:function|const|let|var)\s+([A-Za-z_$][\w$]*)/gm)].map((t)=>t[1]))}function aa(e){let t=/\bdefineClientPayload\s*\(\s*\{([\s\S]*?)\}\s*\)/g,i,r=!1,a=new Set,l=n(e);while((i=t.exec(l))!==null){r=!0;for(let u of Zu(i[1])){let f=u.split(":")[0].trim();if(/^[A-Za-z_$][\w$]*$/.test(f))a.add(f)}}return r?[...a]:null}function Zu(e){let t=[],i=0,r="";for(let a of e){if(a===","&&i===0){t.push(r),r="";continue}if(a==="("||a==="["||a==="{")i++;else if(a===")"||a==="]"||a==="}")i--;r+=a}return t.push(r),t.filter((a)=>a.trim().length>0)}function ca(e){let t=/^[ \t]*import\b[\s\S]*?(?:from\s*['"][^'"]*['"]|['"][^'"]*['"])[ \t]*;?[ \t]*$/gm,i=[],r=e.replace(t,(a)=>(i.push(a.trim()),a.split(`
1010
- `).map(()=>"").join(`
1011
- `)));return{imports:i.join(`
1012
- `),body:r}}function An(e){let t=n(e),i=Array(t.length),r=0;for(let f=0;f<t.length;f++){let x=t[f];if(x==="}"||x===")"||x==="]")r=Math.max(0,r-1);if(i[f]=r,x==="{"||x==="("||x==="[")r++}let a=[],l=/^[ \t]*(?:export[ \t]+)?(interface|type)[ \t]+([A-Za-z_$][\w$]*)/gm,u;while((u=l.exec(t))!==null){if(i[u.index]!==0)continue;let f=u[1],x=u[2],v;if(f==="interface"){let A=t.indexOf("{",u.index);if(A===-1)continue;let M=0;v=-1;for(let H=A;H<t.length;H++)if(t[H]==="{")M++;else if(t[H]==="}"&&--M===0){v=H+1;break}if(v===-1)continue}else{let A=0;v=t.length;for(let M=t.indexOf("=",u.index)+1;M<t.length;M++){let H=t[M];if(H==="{"||H==="["||H==="("||H==="<")A++;else if(H==="}"||H==="]"||H===")"||H===">")A--;else if(A<=0&&(H===";"||H===`
1013
- `&&!/[=|&,<([{]\s*$/.test(t.slice(Math.max(0,M-40),M)))){v=H===";"?M+1:M;break}}}a.push({name:x,text:e.slice(u.index,v).replace(/^[ \t]*export[ \t]+/,"")}),l.lastIndex=v}return a}function qu(e){let t=n(e),i=[],r=/^[ \t]*(?:export[ \t]+)?(?:const|let|var)[ \t]+/gm,a,l=0,u=0;while((a=r.exec(t))!==null){for(;u<a.index;u++){let v=t[u];if(v==="{"||v==="("||v==="[")l++;else if(v==="}"||v===")"||v==="]")l=Math.max(0,l-1)}if(l!==0)continue;let f=0,x=t.length;for(let v=a.index+a[0].length;v<t.length;v++){let A=t[v];if(A==="{"||A==="("||A==="[")f++;else if(A==="}"||A===")"||A==="]")f--;else if(f<=0&&(A===";"||A===`
1014
- `)){x=A===";"?v+1:v;break}}if(/\bdefineProps\s*(?:<|\()/.test(t.slice(a.index,x)))i.push(e.slice(a.index,x).replace(/^[ \t]*export[ \t]+/,"").trim())}return i}function Si(e){let t=e.filter((a)=>a.kind==="server").map((a)=>a.code).join(`
1015
- `);if(/\bdefineProps\s*(?:<|\()/.test(n(t)))return t;let i=la(t),r=e.filter((a)=>a.kind!=="server").flatMap((a)=>{let l=qu(a.code);if(!l.length)return[];return[...An(a.code).filter((u)=>!i.has(u.name)).map((u)=>u.text),...l]});return[t,...r].filter(Boolean).join(`
1016
- `)}function la(e){return new Set(An(e).map((t)=>t.name))}function Yc(e,t=""){let i=aa(e),r=la(t),a=An(e).filter((v)=>!r.has(v.name)).map((v)=>v.text);if(!i){let v=ge(e).filter((A)=>!Dt(t,A));if(v.length===0&&a.length===0)return"";return["",`// ${Xu}`,...a,...v.map((A)=>`declare var ${A}: any`)].join(`
1017
- `)}if(i.length===0)return a.length>0?["",`// ${Qo}`,...a].join(`
1018
- `):"";let{imports:l,body:u}=ca(e),f=u.replace(/^[ \t]*export[ \t]+(?=(?:const|let|var|function|async|class)\b)/gm,""),x=["",`// ${Qo}`];if(l)x.push(l);return x.push(...a),x.push(`async function ${ea}() {`,f,` return { ${i.join(", ")} }`,"}",`type ${ta} = Awaited<ReturnType<typeof ${ea}>>`,...i.map((v)=>`declare var ${v}: ${ta}[${JSON.stringify(v)}]`)),x.join(`
1019
- `)}function ki(e){let t=n(e),i=t.split(""),r=[],a=0,l=0;for(let f=0;f<i.length;f++){let x=i[f];if(x===`
1020
- `)l=f+1;if(x==="{"||x==="("||x==="["){if(a===0&&x!=="("&&Ku.test(t.slice(l,f))){let v=ua(t,f);if(v!==-1)r.push(...pa(t.slice(f,v+1)))}a++;continue}if(x==="}"||x===")"||x==="]"){a=Math.max(0,a-1);continue}if(a>0&&x!==`
1021
- `)i[f]=" "}let u=ge(i.join(""));return r.length===0?u:[...new Set([...u,...r])].sort()}var Ku=/^\s*(?:export\s+)?(?:const|let|var)\s*$/;function ua(e,t){let i=0;for(let r=t;r<e.length;r++){let a=e[r];if(a==="{"||a==="("||a==="[")i++;else if(a==="}"||a===")"||a==="]")i--;if(i===0)return r}return-1}function Ju(e){let t=[],i=0,r=0;for(let a=0;a<e.length;a++){let l=e[a];if(l==="{"||l==="("||l==="[")i++;else if(l==="}"||l===")"||l==="]")i--;else if(l===","&&i===0)t.push(e.slice(r,a)),r=a+1}return t.push(e.slice(r)),t}function Yo(e){let t=0;for(let i=0;i<e.length;i++){let r=e[i];if(r==="{"||r==="("||r==="[")t++;else if(r==="}"||r===")"||r==="]")t--;else if(t===0&&(r===":"||r==="="))return{index:i,char:r}}return null}function pa(e){let t=[],i=(a)=>{let l=a.trim().replace(/^\.\.\./,"").trim();if(l.startsWith("{")||l.startsWith("[")){let f=ua(l,0);if(f!==-1)t.push(...pa(l.slice(0,f+1)));return}let u=Yo(l);if(u)l=l.slice(0,u.index).trim();if(/^[A-Z_$][\w$]*$/i.test(l))t.push(l)},r=e.slice(1,-1);for(let a of Ju(r)){if(!a.trim())continue;if(e[0]==="["){i(a);continue}let l=Yo(a);i(l?.char===":"?a.slice(l.index+1):a)}return t}function Zc(e,t){if(aa(e)!==null)return[];let i=ki(e),r=Be(t,new Set(i)),a=new Set(C);return i.filter((l)=>{if(a.has(l))return!1;if(Dt(t,l))return!1;return r.has(l)})}var Qo="stx: types for the declared client payload (#1868)",Xu="stx: untyped bridge names \u2014 declare a defineClientPayload to check these (#1868)",ea="__stxServerScope",ta="__StxClientPayload";var na=["$env","$user","$slot","$slots","$attrs","$props","$page","$route","$loop","loop","$errors","$csrf","$native","props","slot"];var Gu=/^\s*[A-Z_$][\w$]*\s*=[^=]/i;function Yu(e){let t=new Map,i=/!|===|!==|==|!=|&&|\|\||<|>|\btypeof\b|\binstanceof\b|\bin\b/;for(let r of e){let a=n(r),{depths:l,balanced:u}=se(a);if(!u)continue;let f=/^([ \t]*(?:export[ \t]+)?const[ \t]+)([A-Za-z_$][\w$]*)[ \t]*(?::[^=\n]+)?=[ \t]*([^\n]+)$/gm;for(let x of a.matchAll(f)){let v=x.index??0;if(l[v+x[1].length]!==0)continue;let A=x[2],M=v+x[0].length-x[3].length,H=r.slice(M,v+x[0].length).trim().replace(/;$/,"").trim(),O=x[3],z=i.test(O)&&!/\bawait\b|=>|\bfunction\b|[{}]/.test(O)&&!/[,+\-*/%&|?:=]$/.test(H)&&se(O).balanced;t.set(A,t.has(A)||!z?null:H)}}return new Map([...t].filter((r)=>r[1]!==null))}function fa(e,t,i=0,r=new Set){if(t.size===0||i>=5)return e;let a=n(e),l="",u=0;for(let f of a.matchAll(/[A-Za-z_$][\w$]*/g)){let x=f.index??0,v=f[0],A=t.get(v);if(!A||r.has(v))continue;let M=a.slice(0,x).trimEnd(),H=a.slice(x+v.length).trimStart();if(M.endsWith(".")||/^:(?!:)/.test(H)&&/[{,]$/.test(M))continue;if(x>0&&/[\w$]/.test(a[x-1]))continue;l+=`${e.slice(u,x)}(${fa(A,t,i+1,new Set([...r,v]))})`,u=x+v.length}return l+e.slice(u)}function Qu(e,t){let i=/@(if|unless|elseif|else|endif|endunless)\b\s*(\()?/g,r=[],a;while((a=i.exec(e))!==null){if(a.index>t)break;let l=a[1];if(a.index===t){if(l==="elseif"){let f=r[r.length-1];if(f?.current)f.seen.push(f.current);if(f)f.current=null}break}if(l==="endif"||l==="endunless"){r.pop();continue}let u="";if(a[2]==="("){let f=0,x=a.index+a[0].length-1,v=x+1;for(;x<e.length;x++){let A=e[x];if(A==="(")f++;else if(A===")"){if(f--,f===0)break}}u=e.slice(v,x).trim(),i.lastIndex=x+1}if(l==="if")r.push({seen:[],current:u});else if(l==="unless")r.push({seen:[],current:`!(${u})`});else if(l==="elseif"||l==="else"){let f=r[r.length-1];if(!f)continue;if(f.current)f.seen.push(f.current);f.current=l==="elseif"?u:null}}return r.flatMap((l)=>[...l.seen.map((u)=>`!(${u})`),...l.current?[l.current]:[]]).filter(Boolean)}function ep(e){let t=e.code.trim();if(!t)return null;if(e.attribute?.startsWith("@")){if(Gu.test(t))return null;let r=";(($event: any): void => { ";return{text:`${r}${t} });`,prefixLength:r.length}}let i=";void ((";return{text:`${i}${t}));`,prefixLength:i.length}}var tp=/(\bfrom\s*|\bimport\s*\(\s*|\bimport\s+)(['"])(\.{1,2}\/[^'"\n]*)\2/g;function gs(e,t){return Gs(e,t).code}function Gs(e,t){let i=new Map;if(!t)return{code:e,columns:i};let r=da(e),a=[],l=0;for(let u of e.matchAll(tp)){let f=u.index,[x,v,A,M]=u,H=sa.resolve(t,M).replace(/\\/g,"/"),O=`${v}${A}${H}${A}`;if(a.push(e.slice(l,f),O),l=f+x.length,x.includes(`
1022
- `))continue;let z=Sr(r,f),D=i.get(z.line)??[],U=D.at(-1),q=z.column+(U?U.generatedEnd-U.sourceEnd:0);D.push({sourceStart:z.column,sourceEnd:z.column+x.length,generatedStart:q,generatedEnd:q+O.length}),i.set(z.line,D)}return a.push(e.slice(l)),{code:a.join(""),columns:i}}function np(e,t,i){let r=wr(e.importColumns?.get(t)??[],i);return wr(e.scriptColumns?.get(t)??[],wr(e.componentColumns?.get(t)??[],r))}function _i(e){return" ".repeat(Math.max(0,(e.startColumn??1)-1))}function sp(e){let t=new Set,i=n(e);for(let r of i.matchAll(/\bimport\s+(?:type\s+)?([\w$*{}\s,]+?)\s+from\b/g)){let a=r[1],l=/\{([^}]*)\}/.exec(a);for(let v of l?.[1].split(",")??[]){let A=v.trim().replace(/^type\s+/,"").split(/\s+as\s+/).pop()?.trim();if(A&&/^[A-Z_$][\w$]*$/i.test(A))t.add(A)}let u=a.replace(/\{[^}]*\}/,""),f=/\*\s*as\s+([A-Z_$][\w$]*)/i.exec(u);if(f)t.add(f[1]);let x=/^\s*([A-Z_$][\w$]*)/i.exec(u);if(x&&x[1]!=="type")t.add(x[1])}return[...t].sort()}function Ci(e,t={}){let i=ve(e),r=t.scriptKinds?i.filter((Q)=>t.scriptKinds.includes(Q.kind)):i,a=Ks(e,t.componentMethodValidator),l=t.filePath&&t.templateExpressions!==!1?Zo(e,{filePath:t.filePath,partialsDir:t.partialsDir,layoutsDir:t.layoutsDir,contractsKnown:t.inheritedContractsKnown,readTemplate:t.readComponent}):void 0,u=new Map,f=e.split(`
1023
- `),x=Array.from({length:f.length},()=>""),v=new Map,A=new Map,M=new Map,H=[],O=Si(i),z=t.filePath&&t.templateExpressions!==!1?Do(e,Yt(e),{filePath:t.filePath,componentsDir:t.componentsDir,projectRoot:t.projectRoot,readComponent:t.readComponent,scriptCode:(Q,ie)=>ve(Q).map((oe)=>gs(oe.code,sa.dirname(ie))).join(`
1024
- `)}):void 0,D=new Set,U=[];for(let[Q,ie]of r.entries()){let oe=xi(_i(ie)+ie.code,O,String(Q));for(let[ke,ye]of oe.columns)A.set(ie.startLine+ke-1,ye);for(let ke of oe.declarations)H.push({text:gs(ke.text,t.originDir??""),origin:ke.origin?{...ke.origin,line:ke.origin.line+ie.startLine-1}:void 0});let me=ie.kind==="client"&&a?a.project(oe.code):void 0;for(let[ke,ye]of me?.columns??[])u.set(ie.startLine+ke-1,ye);let le=wn(me?.code??oe.code),be=Gs(le,t.originDir??"");for(let[ke,ye]of be.columns)M.set(ie.startLine+ke-1,ye);let Ae=be.code.split(`
1025
- `);Ae.forEach((ke,ye)=>{let Je=ie.startLine-1+ye;if(Je<x.length)x[Je]=ke,D.add(Je)}),U.push(ie.startLine-1+Ae.length-1)}for(let Q of U){let ie=x[Q]?.trim()===""?Q:Q+1;if(ie<x.length&&x[ie].trim()===""&&(ie===Q||!D.has(ie)))x[ie]=";"}let q=(Q,ie)=>{for(let[oe,me]of Q.split(`
1026
- `).entries())if(x.push(me),ie)v.set(x.length,oe===0?ie:{...ie,line:ie.line+oe,column:1,prefixLength:0})},V=qs(r.filter((Q)=>Q.kind==="server").map((Q)=>Q.code).join(`
1027
- `));if(V)q(V);if(l?.declarations)q(l.declarations);for(let Q of H)q(Q.text,Q.origin);if(a){if(q(a.declarations),t.nativeChecks!==!1)for(let Q of a.checks)q(Q.text,{line:Q.line,column:Q.column,diagnosticOrigin:Q.origin})}if(t.globals!==!1){q("");let Q=new Set([...r.flatMap((le)=>ge(le.code)),...r.flatMap((le)=>sp(le.code))]),ie=(le)=>{if(!Q.has(le)&&!t.declaredGlobals?.includes(le))q(`declare var ${le}: any`)};if(t.runtimeGlobals!==!1){if(!Q.has("window"))q("declare var window: any");for(let le of C)ie(le)}let oe=[...new Set([...vr,...$e,...na])].filter((le)=>!t.declaredGlobals?.includes(le)&&(t.runtimeGlobals!==!1||!C.includes(le)));if(t.contextScope==="global"){q("declare global {");for(let le of oe)q(` var ${le}: any`);q("}")}else{for(let le of vr)ie(le);for(let le of $e)ie(le);for(let le of na)ie(le)}q(`declare var ${_r}: any`);let me=new Set(r.flatMap((le)=>ge(le.code)));q(`type ${Jo}<T> = T extends readonly (infer E)[] ? E : T extends Iterable<infer E2> ? E2 : any`);for(let le of a?[]:Uu(e)){if(me.has(le.name))continue;let be=le.iterable&&me.has(le.iterable)?`${Jo}<typeof ${le.iterable}>`:"any";q(`declare var ${le.name}: ${be}`)}}if(t.templateExpressions!==!1){if(z?.declarations)for(let ie of z.declarations.split(`
1028
- `))q(ie);let Q=yg(e).map((ie)=>{let oe=z?.events.get(ie.offset??-1);if(oe){ie.anchor=!0;let me=ie.code.trim(),le=/^([\w$]+)\s*=\s*([^=][\s\S]*)$/.exec(me),be=le?`void ((${le[2]}) satisfies __StxAssignedValue<typeof ${le[1]}>)`:/^[\w$]+(?:\.[\w$]+)*$/.test(me)?`${me} satisfies (($event: ${oe}) => unknown)`:me,Ae=`;(($event: ${oe}): void => { `;return{expression:ie,statement:{text:`${Ae}${be} });`,prefixLength:Ae.length}}}return{expression:ie,statement:ep(ie)}}).filter((ie)=>ie.statement!==null);if(Q.push(...z?.checks||[],...l?.checks||[]),Q.length>0){let ie=Yt(e),oe=cs(ie),me=a?qo(ie):[];if(a)q("type __StxNativeValue<T> = T extends readonly (infer E)[] ? E : T extends object ? T[keyof T] : never; declare function __stxEach<T>(items: T, callback: (item: __StxNativeValue<T>, key: string) => void): void;");let le=Yu(r.map((ye)=>ye.code)),Ae=[...new Set(r.flatMap((ye)=>ge(ye.code)))].filter((ye)=>/^[A-Z_$][\w$]*$/i.test(ye)),ke=0;if(a)q("function __stxNativeTemplate(this: __StxNativeComponent) {");if(Ae.length>0){q(Lu);for(let ye of Ae)q(`function __StxRead_${ye}() { return ${ye} }`),q(`type __StxT_${ye} = ${oa}<ReturnType<typeof __StxRead_${ye}>>`);q(`;((${Ae.map((ye)=>`${ye}: __StxT_${ye}`).join(", ")}) => {`),ke=1}for(let{expression:ye,statement:Je}of Q){let Ge=" ".repeat(ke),pt=ye.offset===void 0?[]:oe.filter((Ye)=>ye.offset>=Ye.start&&ye.offset<Ye.end),Qe=ye.offset===void 0?[]:me.filter((Ye)=>ye.offset>=Ye.start&&ye.offset<Ye.end),tt=Qe.map((Ye)=>`;__stxEach(${Ye.iterable}, (${Ye.binding}) => { `).join(""),dt=" });".repeat(Qe.length),Oe=tt+pt.map((Ye)=>`;((${Ye.binding.replace(/[\r\n]/g," ")}: any) => { `).join(""),ot=" });".repeat(pt.length)+dt,et=ye.offset===void 0?[]:Qu(ie,ye.offset),Me=et.length>0?`${et.map((Ye)=>`if (${fa(Ye,le)}) `).join("")}{ `:"",yt=et.length>0?" }":"";q(Ge+Oe+Me+Je.text+yt+ot,{line:ye.line,column:ye.column,expression:ye,prefixLength:Je.prefixLength+Ge.length+Oe.length+Me.length,guardPrefixLength:Ge.length+Oe.length+Me.length})}if(ke>0)q("});");if(a)q("}")}}let F=!1;if(t.reference&&x[0]!==void 0&&x[0].trim()==="")x[0]=`/// <reference path=${JSON.stringify(t.reference.replace(/\\/g,"/"))} />`,F=!0;return q("export {}"),{text:x.join(`
1029
- `),lineMap:v,sourceLineCount:f.length,componentDependencies:new Map([...z?.dependencies??[],...l?.dependencies??[]]),referenced:F,scriptColumns:A,importColumns:M,componentColumns:u}}function da(e){let t=[0];for(let i=0;i<e.length;i++)if(e.charCodeAt(i)===10)t.push(i+1);return t}function Sr(e,t){let i=0,r=e.length-1;while(i<r){let a=Math.ceil((i+r)/2);if(e[a]<=t)i=a;else r=a-1}return{line:i+1,column:t-e[i]+1}}function Qc(e,t){if(!e.expression)return!1;return e.inGuard===!0||t===2774}function Ei(e,t,i){let r=e.lineMap.get(t);if(!r)return t<=e.sourceLineCount?{line:t,column:np(e,t,i)}:null;let a=r.expression?.anchor?0:Math.max(0,i-1-(r.prefixLength??0));return{line:r.line,column:r.column+a,expression:r.expression,diagnosticOrigin:r.diagnosticOrigin,inGuard:i<=(r.guardPrefixLength??0)}}var kr=S(256),rp=[{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"}],ga=/(?:\/\/|\/\*|\{\{--)\s*stx-strict-ignore(-next-line)?([^\n*}]*)/g;function ip(e){let t=Array.from(e,(a)=>a===`
1030
- `?`
1031
- `:" "),i=0,r="";while(i<e.length){let a=e[i],l=e[i+1];if(r){if(a==="\\"){i+=2;continue}if(a===r)r="";i++;continue}if(a==='"'||a==="'"||a==="`"){r=a,i++;continue}if(a==="/"&&l==="/"){while(i<e.length&&e[i]!==`
1032
- `)t[i]=e[i],i++;continue}if(a==="/"&&l==="*"){let u=e.indexOf("*/",i+2),f=u===-1?e.length:u+2;for(;i<f;i++)t[i]=e[i];continue}if(a==="{"&&l==="{"&&e.slice(i,i+4)==="{{--"){let u=e.indexOf("--}}",i+4),f=u===-1?e.length:u+4;for(;i<f;i++)t[i]=e[i];continue}i++}return t.join("")}function op(e){let t=new Map,i=ip(e).split(`
1033
- `),r=e.split(`
1034
- `);return i.forEach((a,l)=>{ga.lastIndex=0;for(let u of a.matchAll(ga)){let f=u[1]==="-next-line",x=(r[l]??"").slice(0,u.index).trim(),v=f||x===""?l+2:l+1,M=(u[2]??"").split("--")[0].split(/[\s,]+/).filter(Boolean),H=M.filter((z)=>/\w/.test(z));if(M.length>0&&H.length===0)continue;let O=t.get(v);if(O&&O.size===0)continue;if(H.length===0){t.set(v,new Set);continue}if(O)H.forEach((z)=>O.add(z));else t.set(v,new Set(H))}}),t}function ap(e,t,i){let r=e.get(t);if(!r)return!1;if(r.size===0)return!0;return[...r].some((a)=>i.includes(a))}function Fe(e,t,i,r){let a=typeof i==="boolean"?{enabled:i,failOnViolation:i}:i??{enabled:!1};if(!a.enabled)return;let l=_(e,t,r,JSON.stringify(a)),u=kr.get(l);if(u!==void 0){if(u&&a.failOnViolation)throw new Y(u,r??t);return}let f=a.allowPatterns??[],x=op(e),v=[],A=n(e.replace(/\{\{--[\s\S]*?--\}\}/g,(z)=>z.replace(/[^\n]/g," ")));for(let{pattern:z,message:D,suggestion:U}of rp){if(f.some((V)=>/\w/.test(V)&&D.includes(V)))continue;z.lastIndex=0;let q=A.match(z);if(q&&q.length>0){let V=A.split(`
1035
- `),F=e.split(`
1036
- `),Q=[];if(V.forEach((le,be)=>{if(z.lastIndex=0,z.test(le)&&!ap(x,be+1,D))Q.push(be+1)}),Q.length===0&&V.some((le)=>(z.lastIndex=0,z.test(le))))continue;let ie=Q.length>0?` (script line${Q.length>1?"s":""} ${Q.join(", ")})`:"",oe=Q.slice(0,3).map((le)=>` ${le} | ${(F[le-1]??"").trim().slice(0,100)}`).join(`
1037
- `),me=oe?`
1038
- ${oe}`:"";v.push(` \u2717 ${D}${ie}
1039
- \u2192 ${U}${me}`)}}if(v.length===0){kr.set(l,"");return}let M=(z)=>{let D=`${process.cwd()}/`;return z.startsWith(D)?z.slice(D.length):z},O=`[STX] DOM API violation in ${r&&r!==t?`${M(r)} (composed into ${M(t)})`:M(t)}:
1040
- ${v.join(`
1041
- `)}
1042
- Tip: prefer useRef(), navigate(), and composables for component code`;if(kr.set(l,O),console.warn(O),a.failOnViolation)throw new Y(O,r??t)}var cp=[{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"}],lp=[{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')"}],up=[{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 Tg(e){let t=[],i=[];return pp(e,t),fp(e,t,i),dp(e,i),gp(e,t),{valid:t.length===0,errors:t,warnings:i}}function pp(e,t){let i=(e.match(/\{\{/g)||[]).length,r=(e.match(/\}\}/g)||[]).length;if(i!==r)t.push({type:"expression",message:`Unclosed expression brackets: found ${i} opening '{{' and ${r} closing '}}'`,suggestion:"Ensure every {{ has a matching }}"})}function fp(e,t,i){for(let r of cp){let a=new RegExp(`${r.open}(?:\\s|\\()`,"g"),l=new RegExp(r.close,"g"),u=(e.match(a)||[]).length,f=(e.match(l)||[]).length;if(r.altClose){let x=new RegExp(r.altClose,"g");f+=(e.match(x)||[]).length}if(u>f)t.push({type:"directive",message:`Unclosed @${r.name} directive: found ${u} opening and ${f} closing`,suggestion:`Add ${u-f} missing ${r.close} tag(s)`});else if(f>u)i.push({type:"directive",message:`Extra ${r.close} found: ${f-u} more closing than opening`,suggestion:`Check for orphaned ${r.close} tags`})}}function dp(e,t){for(let i of lp)if(i.pattern.test(e))t.push({type:"syntax",message:i.message,suggestion:i.suggestion})}function gp(e,t){for(let i of up)if(i.pattern.test(e))t.push({type:"expression",message:`Security warning: ${i.message}`,suggestion:"Remove dangerous code from template expressions"})}function $g(e,t){let i=e.slice(0,t).split(`
1043
- `);return{line:i.length,column:i[i.length-1].length+1}}function Rg(e,t,i){let r=[];switch(e){case"if":case"elseif":case"unless":if(i.length===0)r.push({type:"syntax",message:`@${e} requires a condition`,suggestion:`Use @${e}(condition)`});break;case"foreach":if(i.length===0||!i[0].includes(" as "))r.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(i.length===0)r.push({type:"syntax",message:"@for requires loop parameters",suggestion:"Use @for(let i = 0; i < 10; i++)"});break;case"switch":if(i.length===0)r.push({type:"syntax",message:"@switch requires an expression",suggestion:"Use @switch(expression)"});break;case"case":if(i.length===0)r.push({type:"syntax",message:"@case requires a value",suggestion:"Use @case(value)"});break;case"include":case"extends":case"component":if(i.length===0)r.push({type:"syntax",message:`@${e} requires a path`,suggestion:`Use @${e}('path/to/template')`});break}return r}function Ag(e){return/@[a-z]+/i.test(e)||/\{\{/.test(e)}function Pg(e){let t=e.matchAll(/@([a-z]+)/gi),i=new Set;for(let r of t){let a=r[1].toLowerCase();if(!a.startsWith("end"))i.add(a)}return Array.from(i)}function ma(e,t,i){let r=/^<script\b([^>]*)>/i.exec(e);if(!r||!/(?:^|\s)src\s*=/i.test(r[1]??""))return null;return R(r[0],t,i)+e.slice(r[0].length)}var Pn=new P(500),Dr=new Map;function ha(e){try{let t=ys.statSync(e);return`${t.size}:${t.mtimeMs}`}catch{return""}}var xs=new P(1000),Nr=new Map,Lr=new P(2000),Br=new P(500),Ea=33554432,Wr=Ea;function mp(e){let t=e.componentRenderCacheBytes;if(typeof t!=="number"||t<0||t===Wr)return;Wr=t,bs.setMaxBytes(t)}var bs=new P(2000,{maxBytes:Ea,sizeOf:(e)=>e.output.length});function hp(e){let t=new WeakSet;try{let i=(r)=>{if(r===void 0)return{__stxType:"undefined"};if(typeof r==="bigint")return{__stxType:"bigint",value:r.toString()};if(typeof r==="function"||typeof r==="symbol")throw TypeError("Non-serializable component input");if(r===null||typeof r!=="object")return r;if(t.has(r))throw TypeError("Circular component input");t.add(r);try{if(r instanceof Date)return{__stxType:"date",value:r.toISOString()};if(Array.isArray(r))return r.map(i);let a=Object.getPrototypeOf(r);if(a!==Object.prototype&&a!==null)throw TypeError("Non-plain component input");let l={};for(let u of Object.keys(r).sort())l[u]=i(r[u]);return l}finally{t.delete(r)}};return JSON.stringify(i(e))}catch{return null}}function xp(e){let t={};for(let[i,r]of Object.entries(e))if(!i.startsWith("__")||i==="__stxServeContext")t[i]=r;return t}function jr(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Qs(e){let t=process.cwd(),i=`${t}\x00${e}`,r=xa.get(i);if(r===void 0)r=Bun.hash(ka(e,t).split(de.sep).join("/")).toString(36).slice(0,6),xa.set(i,r);return r}var xa=new Map;function ka(e,t){if(!de.isAbsolute(e))return e;let i=(r)=>{try{return ys.realpathSync(r)}catch{return r}};return de.relative(i(t),i(e))}function Ig(e){return/\bjs\b/.test(e)||/\blang\s*=\s*["']?(js|javascript)["']?/i.test(e)}function Ue(e){return!Ig(e)}var hs=new Map;function ne(e){let t;try{t=JSON.stringify(e)}catch{return new Bun.Transpiler(e)}let i=hs.get(t);if(i)return i;if(hs.size>=16)hs.clear();let r=new Bun.Transpiler(e);return hs.set(t,r),r}var ba=new WeakMap,bp=256;function We(e){try{let t=ne({loader:"ts",target:"browser",define:T()}),i=ba.get(t);if(!i)i=new Map,ba.set(t,i);let r=i.get(e);if(r!==void 0)return r;let a=e.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");a=a.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");let l=[];a=a.replace(/\{!![\s\S]*?!!\}/g,(f)=>{let x=l.length;return l.push(f),`"__STX_EXPR_${x}__"`}),a=a.replace(/\{\{\{[\s\S]*?\}\}\}/g,(f)=>{let x=l.length;return l.push(f),`"__STX_EXPR_${x}__"`}),a=a.replace(/\{\{[\s\S]*?\}\}/g,(f)=>{let x=l.length;return l.push(f),`"__STX_EXPR_${x}__"`});let u=t.transformSync(a);for(let f=0;f<l.length;f++)u=u.replace(`"__STX_EXPR_${f}__"`,l[f]),u=u.replace(`'__STX_EXPR_${f}__'`,l[f]);if(i.size>=bp){let f=i.keys().next();if(!f.done)i.delete(f.value)}return i.set(e,u),u}catch(t){if(process.env.STX_DEBUG_TS)console.warn("[STX] TypeScript transpilation error:",t);return e}}function yp(e){let t=[],i=new Set,r=0,a=0,l=e.length,u=(O)=>{a++;while(a<l){if(e[a]==="\\"){a+=2;continue}if(e[a]===O){a++;return}a++}},f=()=>{a++;while(a<l){if(e[a]==="\\"){a+=2;continue}if(e[a]==="`"){a++;return}if(e[a]==="$"&&e[a+1]==="{"){a+=2;let O=1;while(a<l&&O>0)if(e[a]==="{")O++,a++;else if(e[a]==="}")O--,a++;else if(e[a]==="'"||e[a]==='"')u(e[a]);else if(e[a]==="`")f();else a++;continue}a++}},x=()=>{if(e[a]==="/"&&e[a+1]==="/"){while(a<l&&e[a]!==`
1044
- `)a++;return!0}if(e[a]==="/"&&e[a+1]==="*"){a+=2;while(a<l-1&&!(e[a]==="*"&&e[a+1]==="/"))a++;return a+=2,!0}return!1},v=new Set(["return","typeof","instanceof","in","of","new","delete","void","throw","case","do","else","yield","await"]),A=()=>{let O=a-1;while(O>=0&&/\s/.test(e[O]))O--;if(O<0)return!0;let z=e[O];if("(,=:[!&|?{};+-*%<>~^".includes(z))return!0;if(!/[\w$]/.test(z))return!1;let D=O;while(D>0&&/[\w$]/.test(e[D-1]))D--;return v.has(e.slice(D,O+1))},M=()=>{a++;let O=!1;while(a<l&&e[a]!==`
1045
- `){let z=e[a];if(z==="\\"){a+=2;continue}if(z==="[")O=!0;else if(z==="]")O=!1;else if(z==="/"&&!O){a++;while(a<l&&/[a-z]/i.test(e[a]))a++;return}a++}},H=()=>{if(r!==0)return;let O=e.slice(a).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(O){let q=O[2].split(",").map((V)=>{let F=V.trim().split(":");return F[F.length-1].trim()});for(let V of q)if(V&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(V)&&!i.has(V))t.push(V),i.add(V);return}let z=e.slice(a).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(z){let q=z[2];if(!i.has(q))t.push(q),i.add(q);return}let D=e.slice(a).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(D){let q=D[1];if(!i.has(q))t.push(q),i.add(q);return}let U=e.slice(a).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(U){let q=U[1];if(!i.has(q))t.push(q),i.add(q)}};while(a<l){if(x())continue;if(e[a]==="'"||e[a]==='"'){u(e[a]);continue}if(e[a]==="`"){f();continue}if(e[a]==="/"&&A()){M();continue}if(e[a]==="{"){r++,a++;continue}if(e[a]==="}"){r--,a++;continue}if(r===0&&/[a-z]/i.test(e[a])&&(a===0||/\s|[;{}()]/.test(e[a-1])))H();a++}return t}function wp(e){let t=[],i=0,r=0,a=null;for(let l=0;l<e.length;l++){let u=e[l];if(a){if(u==="\\"){l++;continue}if(u===a)a=null;continue}if(u==='"'||u==="'"||u==="`"){a=u;continue}if(u==="("||u==="["||u==="{")i++;else if(u===")"||u==="]"||u==="}")i--;else if(u===","&&i===0)t.push(e.slice(r,l)),r=l+1}if(r<e.length)t.push(e.slice(r));return t}function _p(e){let t=0,i=null;for(let r=0;r<e.length;r++){let a=e[r];if(i){if(a==="\\"){r++;continue}if(a===i)i=null;continue}if(a==='"'||a==="'"||a==="`"){i=a;continue}if(a==="("||a==="["||a==="{")t++;else if(a===")"||a==="]"||a==="}")t--;else if(a==="="&&t===0){let l=e[r-1],u=e[r+1];if(l==="!"||l==="<"||l===">"||l==="=")continue;if(u==="="||u===">")continue;return r}}return-1}function $p(e,t){try{let i=/=\s*(?:withDefaults\s*\([\s\S]*?defineProps|defineProps)\b/.exec(e);if(!i)return;let r=i.index-1;while(r>=0&&/\s/.test(e[r]))r--;if(e[r]!=="}")return;let a=r,l=0,u=-1;for(;r>=0;r--){let x=e[r];if(x==="}")l++;else if(x==="{"){if(l--,l===0){u=r;break}}}if(u===-1)return;let f=e.slice(u+1,a);for(let x of wp(f)){let v=x.trim();if(!v||v.startsWith("..."))continue;let A=_p(v);if(A===-1)continue;let M=v.slice(0,A).trim();if(!/^[A-Z_$][\w$]*$/i.test(M))continue;if(t[M]!==void 0)continue;let H=v.slice(A+1).trim();if(!H)continue;try{let O=Object.keys(t).filter(Ut),z=Function(...O,`"use strict"; return (${H});`);t[M]=z(...O.map((D)=>t[D]))}catch{}}}catch{}}var vp=new Set(["tr","td","th","thead","tbody","tfoot","caption","colgroup","col","option","optgroup","li","dt","dd","span"]);function Og(e,t){let i=Mt(e),r=e.slice(i).match(/^<([a-zA-Z][a-zA-Z0-9-]*)/);if(!r)return null;let a=r[1].toLowerCase();if(!vp.has(a))return null;let l=new RegExp(`<\\/?${a}(?=[\\s/>])(?:[^>"']|"[^"]*"|'[^']*')*>`,"iy"),u=w(e,(A,M)=>(l.lastIndex=M,l.exec(A)?.index===M?l.lastIndex:-1));if(a==="span"&&/\sdata-stx-scope\s*=/.test(u[0]?.token||""))return null;let f=0,x=!1;for(let A of u){if(f+=A.token.startsWith("</")?-1:1,f<0)return null;if(f===0){if(e.slice(A.end).trim())return null;x=!0;break}}if(!x)return null;let v=i+r[0].length;return e.slice(0,v)+t+e.slice(v)}function Ca(e,t){if(!e)return!1;return[...t.additionalComponentsDirs??[],...t.fallbackComponentsDir?[t.fallbackComponentsDir]:[]].some((r)=>{let a=de.relative(de.resolve(r),de.resolve(e));return!a.startsWith("..")&&!de.isAbsolute(a)})}async function Or(e,t,i,r,a){let l=e.endsWith(".stx")?e.slice(0,-4):e,u=(oe)=>oe.split("-").map((me)=>me.charAt(0).toUpperCase()+me.slice(1)).join(""),f=i.__importedComponents;if(f){for(let oe of[l,l.toLowerCase(),u(l),G(l)])if(f.has(oe))return!0}let x=[...new Set([`${l}.stx`,`${u(l)}.stx`,`${G(l)}.stx`])],v=typeof a.root==="string"?de.resolve(a.root):void 0,A=v??de.dirname(r),M=[],H=(oe)=>{if(oe&&!M.includes(oe))M.push(oe)};for(let oe of Jn(r,v))H(oe);let O=i.__originalFilePath;if(O)H(de.join(de.dirname(O),"components"));if(Ca(t,a))H(a._rootComponentsDir);H(t),H(a._rootComponentsDir),H(de.join(de.dirname(r),"components")),H(a.componentsDir);for(let oe of a.additionalComponentsDirs??[])H(oe);let z=a._targetComponentFallbackNames?.some((oe)=>oe.toLowerCase()===l.toLowerCase());if(!z)for(let oe of a._targetComponentDirs??[])H(oe);if(v)H(de.resolve(v,"resources/views/components")),H(de.resolve(v,"resources/components")),H(de.resolve(v,"src/components")),H(de.resolve(v,"components"));for(let oe of a._layerComponentDirs??[])H(oe);let D=a._pluginComponentDirs;if(Array.isArray(D))for(let oe of D)H(typeof oe==="string"?oe:null);if(H(a.fallbackComponentsDir),z)for(let oe of a._targetComponentDirs??[])H(oe);let U=a._nativePrimitivesFallback;if(U&&!U.except.some((oe)=>oe.toLowerCase()===l.toLowerCase()))H(U.dir);if(l.startsWith("./")||l.startsWith("../"))return s(de.resolve(de.dirname(r),`${l}.stx`));let q=ya(de.resolve(import.meta.dir,"components")),V=M.map((oe)=>de.isAbsolute(oe)?oe:de.resolve(A,oe)),F=`${x.join("\x00")}\x00\x00${V.join("\x00")}`,Q=Lr.get(F);if(Q!==void 0)return Q;let ie=!1;e:for(let oe of V){if(ya(oe)===q)continue;for(let me of x)if(await s(de.join(oe,me))){ie=!0;break e}}return Lr.set(F,ie),ie}function ya(e){let t=Br.get(e);if(t!==void 0)return t;let i=e;try{i=ys.realpathSync(e)}catch{}return Br.set(e,i),i}function Ng(e){return e==="visible"||e==="idle"||e==="interaction"||e.startsWith("media:")}function pl(e){if(!e)return!1;let t=e.replace(/<script[\s\S]*?<\/script>/gi,"").replace(/<style[\s\S]*?<\/style>/gi,"");return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(t)}function Sp(e,t,i){if(!e.includes("{{")&&!e.includes("{!!"))return e;let r=(a,l)=>{let u;try{u=I(a,t)}catch{return l}if(u===void 0||u===null)return"";let f=String(u);if(/<\/style/i.test(f))return console.warn(`[stx] a <style> expression in ${i??"<unknown>"} evaluated to CSS containing a closing style tag, which would end the element early, so it was dropped rather than emitted.`),"";return f};return e.replace(/\{!!([\s\S]*?)!!\}/g,(a,l)=>r(l,a)).replace(/\{\{([\s\S]*?)\}\}/g,(a,l)=>r(l,a))}var wa=new Set;function _a(e,t,i,r){let a=`${e}\x00${t}\x00${r??""}`;if(!process.env.STX_DEBUG&&wa.has(a))return;wa.add(a);let l=t?` used in ${t}`:"",u=r?` Cause: ${r}.`:"",f=i.length>0?`
1046
- searched:
1047
- ${i.map((x)=>` - ${x}`).join(`
1048
- `)}`:"";console.error(`[stx] component <${e}> could not be resolved${l}, so it rendered as nothing.${u}${f}`)}function $a(e){return`<!-- stx: component "${e.replace(/--+/g,"-")}" could not be resolved; see the server log -->`}var Ep=new Set(["for","if","show","key","ref","class","className","style"]),va=new Set,Ra="useMediaQuery|useDark|usePreferredDark|usePreferredLight|usePreferredReducedMotion|usePreferredContrast|useDocumentVisibility|useScrollLock",fl=new RegExp(`\\b(?:${Ra})\\s*(?:<[^>]*>)?\\s*\\(`);function Ii(e){let t=new Set,i=new RegExp(`\\b(?:const|let|var)\\s+([a-zA-Z_$][\\w$]*)\\s*=\\s*(?:state|derived|computed|ref|reactive|signal|useModel|useReactiveProp|useLocalStorage|useSessionStorage|keptState|useCookie|useDebouncedValue|${Ra})\\s*(?:<[^>]*>)?\\s*\\(`,"g");for(let r of e){let a;while((a=i.exec(r))!==null)t.add(a[1]);i.lastIndex=0}return[...t]}async function qe(e,t,i,r,a,l,u,f=new Set,x,v=lt(a),A,M=e){let{extractVariables:H}=await o("stx/variable-extractor",()=>import("./chunk-0gv2mmr0.js")),O=f??new Set;if(O.has(e))return`[Circular component reference: ${e}]`;let z=new Set(O);z.add(e);let D=typeof t.client==="string"?t.client.trim():"";if("client"in t)delete t.client;let U=D&&D!=="load"&&Ng(D)?D:"";try{let q=(ce)=>ce.split("-").map((he)=>he.charAt(0).toUpperCase()+he.slice(1)).join(""),V=M.endsWith(".stx")?M.slice(0,-4):M,F=null,Q=a.__importedComponents;if(Q){let ce=[V,V.toLowerCase(),q(V),G(V)];for(let he of ce)if(Q.has(he)){F=Q.get(he);break}}let ie=[];if(!F){let ce=[`${V}.stx`,`${q(V)}.stx`,`${G(V)}.stx`],he=[...new Set(ce)],Ce=a.__originalFilePath,Se=[];for(let Ee of Jn(l))if(!Se.includes(Ee))Se.push(Ee);let rt=Se.length;for(let Ee of u._layerComponentDirs??[])if(!Se.includes(Ee))Se.push(Ee);if(Ce){let Ee=de.join(de.dirname(Ce),"components");Se.push(Ee)}let Le=u._rootComponentsDir;if(typeof Le==="string"&&Ca(r,u)&&!Se.includes(Le))Se.push(Le);if(r&&!Se.includes(r))Se.push(r);if(typeof Le==="string"&&!Se.includes(Le))Se.push(Le);let St=de.join(de.dirname(l),"components");if(!Se.includes(St))Se.push(St);if(u.componentsDir&&u.componentsDir!==r&&!Se.includes(u.componentsDir))Se.push(u.componentsDir);for(let Ee of u.additionalComponentsDirs??[])if(Ee&&!Se.includes(Ee))Se.push(Ee);let Wt=u._nativeHostAttrs&&/^(?:checkbox|switch)$/i.test(V),Ct=(A?.events??[]).map((Ee)=>Ee.replace(/^@/,"").split(".")[0].toLowerCase().replace(/-/g,"")),zn=Object.hasOwn(t,"checked")||Boolean(A?.reactiveProps?.includes("checked")),ks=Object.hasOwn(t,"value")||Boolean(A?.reactiveProps?.includes("value")),Cs=!Ct.includes("valuechange")&&(zn||Ct.includes("change")&&!ks),Tt=u._nativeHostAttrs&&/^textinput$/i.test(V),Vt=Ct.includes("update:value")&&!Ct.includes("input"),ln=u._nativeHostAttrs&&/^video$/i.test(V),Rs=u._nativeHostAttrs&&/^image$/i.test(V),Bn=Vs([...Object.keys(t),...A?.reactiveProps??[]],A?.events,t),Ht=Object.hasOwn(t,"src")||Boolean(A?.reactiveProps?.includes("src")),Wn=Object.hasOwn(t,"source")||Boolean(A?.reactiveProps?.includes("source")),Fn=ln&&(Ht||Wn)&&(A?.events??[]).every((Ee)=>/^(?:play|pause|ended|timeupdate|loadedmetadata|loadstart|error)$/.test(Ee.replace(/^@/,"").split(".")[0])),Vn=new Set(["","primary","secondary","outline","ghost","danger"]),Un=typeof t.variant==="string"?t.variant.trim().toLowerCase():"",Hn=u._nativeHostAttrs&&/^button$/i.test(V)&&!Vn.has(Un),qr=u._targetComponentFallbackNames?.some((Ee)=>Ee.toLowerCase()===V.toLowerCase())??!1,As=qr&&(!Wt||Cs)&&(!Tt||Vt)&&(!ln||Fn)&&(!Rs||Bn)&&!Hn;for(let Ee of As?[]:u._targetComponentDirs??[])if(Ee&&!Se.includes(Ee))Se.push(Ee);let Zt=typeof u.root==="string"?de.resolve(u.root):void 0,Kr=Zt??de.dirname(l),qt=[];if(Zt)qt.push(de.resolve(Zt,"resources/views/components")),qt.push(de.resolve(Zt,"resources/components")),qt.push(de.resolve(Zt,"src/components")),qt.push(de.resolve(Zt,"components"));qt.push(de.resolve(import.meta.dir,"components"));for(let Ee of qt)if(!Se.includes(Ee))Se.push(Ee);if(qr){let Ee=(u._componentPackageDirs??[]).filter((ct)=>typeof ct==="string"&&ct.length>0),Et=(As?Ee.length?Ee:u._pluginComponentDirs??[]:u._targetComponentDirs??[]).filter((ct)=>typeof ct==="string"&&ct.length>0);if(Et.length){let ct=Se.slice(rt).map((at)=>de.isAbsolute(at)?at:de.resolve(Kr,at)).filter((at)=>!Et.includes(at)),qn=`${V}\x00${ct.join("\x00")}`,xt=Nr.get(qn);if(xt===void 0){xt=!1;for(let at of ct){for(let It of he)if(await s(de.join(at,It))){xt=!0;break}if(xt)break}Nr.set(qn,xt)}if(!xt){for(let at of Et){let It=Se.indexOf(at);if(It>=0)Se.splice(It,1)}Se.splice(rt,0,...Et)}}}let Jr=u._pluginComponentDirs;if(Array.isArray(Jr)){for(let Ee of Jr)if(typeof Ee==="string"&&!Se.includes(Ee))Se.push(Ee)}if(u.fallbackComponentsDir&&!Se.includes(u.fallbackComponentsDir))Se.push(u.fallbackComponentsDir);if(As){for(let Ee of u._targetComponentDirs??[])if(Ee&&!Se.includes(Ee))Se.push(Ee)}let Zn=u._nativePrimitivesFallback;if(Zn&&!Zn.except.some((Ee)=>Ee.toLowerCase()===V.toLowerCase())&&!Se.includes(Zn.dir))Se.push(Zn.dir);let Xr=[...new Set(Se.map((Ee)=>{if(!Ee)return Ee;return de.isAbsolute(Ee)?Ee:de.resolve(Kr,Ee)}))];Se.length=0,Se.push(...Xr);let Ts=`${V}\x00${l}\x00${Xr.join("\x00")}`,Is=xs.get(Ts);if(Is)if(await s(Is))F=Is;else xs.delete(Ts);if(!F&&(V.startsWith("./")||V.startsWith("../")))F=de.resolve(de.dirname(l),`${V}.stx`),ie.push(F);else if(!F)for(let Ee of Se){if(!Ee)continue;for(let Et of he){let ct=de.join(Ee,Et);if(ie.push(ct),await s(ct)){F=ct;break}}if(F)break;if(!F)try{let Et=await import("fs");if(!Et.statSync(Ee,{throwIfNoEntry:!1})?.isDirectory())continue;let qn=8,xt=[{path:Ee,depth:0}];while(xt.length>0&&!F){let at=xt.pop();if(at.depth>=qn)continue;let It;try{It=Et.readdirSync(at.path,{withFileTypes:!0})}catch{continue}for(let Kn of It){if(!Kn.isDirectory())continue;if(Kn.name==="node_modules"||Kn.name.startsWith("."))continue;let Gr=de.join(at.path,Kn.name);for(let Fa of he){let Os=de.join(Gr,Fa);if(ie.push(Os),await s(Os)){F=Os;break}}if(F)break;xt.push({path:Gr,depth:at.depth+1})}}}catch{}if(F)break}if(F)xs.set(Ts,F)}if(!F||!await s(F))return _a(e,l,ie),$a(e);x.add(F);let oe;if(Pn.has(F)&&Dr.get(F)===ha(F))oe=Pn.get(F);else try{let ce=ha(F);oe=await Bun.file(F).text(),Pn.set(F,oe),Dr.set(F,ce)}catch(ce){let he=ce instanceof Error?ce.message:String(ce);return _a(e,l,[F],he),$a(e)}if(A)for(let ce of new Set([...Object.keys(t),...A.reactiveProps??[]])){let he=ce.toLowerCase();if(he.startsWith("aria-")||he.startsWith("data-"))continue;let Ce=ce.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(new RegExp(`\\b${Ce}\\b`).test(oe))A.declaredProps.add(ce);if(new RegExp(`\\$props\\s*(?:\\.\\s*${Ce}\\b|\\[\\s*['"]${Ce}['"]\\s*\\])`).test(oe)||new RegExp(`\\buseReactiveProp\\s*\\(\\s*['"]${Ce}['"]`).test(oe))A.consumedProps?.add(ce)}if(A?.reactiveProps?.length&&/\bdefineProps\s*(?:<[^>]*>)?\s*\(/.test(oe))for(let ce of A.reactiveProps){if(Ep.has(ce)||A.consumedProps?.has(ce))continue;if(new RegExp(`\\buse(?:ReactiveProp|Model)\\s*\\(\\s*['"]${ce.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(oe))continue;let he=`${F}\x00${ce}`;if(va.has(he))continue;va.add(he),console.warn(`[stx] ${de.basename(F)} reads \`${ce}\` with defineProps(), which is not live, but ${de.basename(l)} binds it (:${ce}): the value can arrive empty or stale (on a native screen, and for a :for's rows, it does not arrive at all). Read it with useReactiveProp('${ce}').`)}let me=new Set(["__originalFilePath","__importedComponents",ts,"__stx_client_signal_names","__stx_client_declared_names","__stx_runtime_config","__stxServeContext","__stx_scope_seq"]),le={};for(let[ce,he]of Object.entries(a))if(!ce.startsWith("__")||me.has(ce))le[ce]=he;let be=v.length>0?{[as]:[...v]}:{},Ae=i;if(i.includes("@include")){let{processIncludes:ce}=await o("stx/includes",()=>import("./chunk-51ymssz5.js"));Ae=await ce(i,a,l,u,x)}if(/<[A-Z][\w.-]*[\s/>]/.test(Ae)){let{processComponents:ce}=await o("stx/component-renderer",()=>import("./chunk-n344ss97.js")),he={...a,__processedComponents:O,...be};Ae=await ce(Ae,he,l,u,x);let Ce=he.__stx_preserved_client_expressions;if(Array.isArray(Ce)&&Ce.length>0)a.__stx_preserved_client_expressions=[...new Set([...Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[],...Ce])]}let ke=[];if(pl(Ae)){let{processExpressions:ce}=await o("stx/expressions",()=>import("./chunk-9e3ggwk7.js")),he=a.__stx_signals_gate===void 0?{...a,__stx_signals_gate:!0,...be}:v.length>0?{...a,...be}:a;Ae=ce(Ae,he,l);for(let Ce of Ae.matchAll(/\{\{([\s\S]*?)\}\}/g))ke.push(Ce[1].trim())}let ye=ee(Ae),Je=[],Ge=ye.output.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(ce,he)=>{let Ce=ye.scripts[Number(he)]||"",Se=Ce.match(/^<script\b([^>]*)>/i)?.[1]||"",rt=Se.match(/\btype\s*=\s*["']([^"']+)["']/i)?.[1]?.toLowerCase(),Le=!rt||["module","text/javascript","application/javascript"].includes(rt),St=/\sdata-stx-(?:owner|instance)(?=[\s=/>])/i.test(` ${Se}`);if(!/\bserver\b/i.test(Se)&&Le&&!St)return Je.push(Ce),"";return Ce}),{extractSlotContent:pt}=await o("stx/slots",()=>import("./chunk-bs7g6jtt.js")),Qe=pt(Ge),tt={};if(Qe.defaultSlot?.trim())tt.default=Qe.defaultSlot;for(let[ce,he]of Qe.namedSlots)tt[ce]=he.content;let dt=a.__stx_scope_seq??={n:0,key:Qs(String(a.__filename??l))},Oe=ka(e,process.cwd()),et=`stx_${(Oe.endsWith(".stx")?Oe.slice(0,-4):Oe).replace(/[^a-zA-Z0-9]/g,"_")}_${++dt.n}_${dt.key}`,Me={...le,$uid:et,$native:u._nativeHostAttrs===!0,...t,props:t,slot:Ge,$slots:tt,__processedComponents:z,__sections:{},__stx_signals_gate:Re(oe)||pl(i),__stx_preserved_client_expressions:[...Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[],...ke]};if(/import\s/.test(oe)){Me.__importedComponents=new Map(Me.__importedComponents);let{processESImports:ce}=await o("stx/component-renderer",()=>import("./chunk-n344ss97.js"));oe=await ce(oe,Me,F,u,x)}$p(oe,Me);let yt=oe,Ye=L(yt);if(Ye)yt=Ye.content.trim();let _s=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,en=[...oe.matchAll(_s)];for(let[,ce,he]of en)if(!/\bserver\b|\bsrc\s*=|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/i.test(ce))Fe(he,F,u.strict);let gt=[],tn=null,$s=en.some((ce)=>/\bserver\b/.test(ce[1]||"")&&/\bcache\b/.test(ce[1]||"")),Nt=null,wt=null,nn=null,Mn=0,sn=null;if(mp(u),$s&&Wr>0){let ce=hp({props:t,slot:Ae,slotContext:i.trim()?xp(le):void 0,buildMode:u.buildMode??"",skipEventDirectives:u.skipEventDirectives===!0,native:u._nativeHostAttrs===!0,clientLoopNames:[...v].sort(),layers:u._layerGraph?.layers.map((he)=>he.configFile),uid:et});if(ce!==null){Nt=`${F}\x00${_(oe)}\x00${ce}`;let he=bs.get(Nt);if(he){for(let Ce of he.dependencies)x.add(Ce);if(Ji(a,he.clientFactories),dt.n+=he.uidsConsumed,he.preservedClientExpressions.length>0){let Ce=new Set(Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[]);for(let Se of he.preservedClientExpressions)Ce.add(Se);a.__stx_preserved_client_expressions=[...Ce]}return he.output}wt=new Set(x),nn=qi(a),Mn=dt.n,sn=new Set(Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[])}}let rn=new Set;for(let ce of en){let he=ce[1]||"",Ce=ce[2]||"",Se=he.includes("server");if(Ue(he)&&Ce.trim())Ce=We(Ce);if(Se&&Ce){for(let Le of ge(Ce))rn.add(Le);try{await H(Ce,Me,F,{onFailure:(Le)=>{if(Le.kind!=="unknown")tn=Le.kind}})}catch(Le){}}if(!Se){let Le=Ce.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),St=Le.includes("{{")&&Le.includes("}}"),Wt=Le.includes("{!!")&&Le.includes("!!}");if(St||Wt)Le=Ni(Le,Me,F);let Ct=he.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");gt.push(`<script${Ct}>${Le}</script>`)}}let mt=ee(oe).output.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),on=mt?mt[1]:"",vs=mt?mt[2]:"",_t="",ae=on&&/\bscoped\b/i.test(on);if(mt)_t=`<style${on}>${Sp(vs,Me,F)}</style>`;let ue=yt;if(ue=ue.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),mt)ue=ue.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let ce=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,he=[];if(ue=ue.replace(ce,(Ce,Se)=>{let rt=Se.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(rt)he.push(`<style${rt[1]}>${rt[2]}</style>`);return""}),ue=ue.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),he.length>0)_t=`${_t}${he.join(`
1049
- `)}`}if(i&&ue.includes("{{ text || slot }}"))ue=ue.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>i);let{applySlots:_e}=await o("stx/slots",()=>import("./chunk-bs7g6jtt.js")),{defaultSlot:Ie,namedSlots:Ze}=Qe,nt=a.__stx_signals_gate===!0&&/\s(?:@[\w:.-]+|x-on:[\w:.-]+)\s*=/.test(Ge),ht=gt.length>0&&pr(ue)||u._nativeHostAttrs===!0&&gt.length>0||nt&&gt.length>0||gt.some((ce)=>/\b(?:state|derived|effect|ref|useRef|reactive|computed|watch|watchEffect|useModel|useReactiveProp|onMount|onDestroy|defineProps|withDefaults|defineEmits|defineExpose|defineSlots)\s*(?:<[^<>()]*>)?\s*\(/.test(ce)),Ss=(ce)=>ht?Po(ce,et):ce,Es=new Map([...Ze].map(([ce,he])=>[ce,{...he,content:Ss(he.content)}]));ue=await _e(ue,ht?Oo(Ss(Ie),et):Ie,Es,Me,ht?et:"");let Dn=Ii(gt),an=(Array.isArray(Me.__stx_client_signal_names)?Me.__stx_client_signal_names:[]).filter((ce)=>!rn.has(ce));if(Dn.length>0||an.length>0)Me.__stx_client_signal_names=[...new Set([...an,...Dn])];else delete Me.__stx_client_signal_names;let cn=v.filter((ce)=>!rn.has(ce)&&!(ce in t));if(cn.length>0)Me[as]=cn;let Nn={...u,_rootComponentsDir:u._rootComponentsDir||u.componentsDir,componentsDir:de.dirname(F),skipSignalsRuntime:!0,skipEventDirectives:u._nativeHostAttrs===!0||ht||gt.length===0,defaultLayout:void 0};Me.__stxProcessingDepth=(a.__stxProcessingDepth||0)+1;let{processDirectives:Ln}=await o("stx/process",()=>import("./chunk-hd5bny2c.js")),$t=await Ln(ue,Me,F,Nn,x),kt=new Set(Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[]);for(let ce of $t.matchAll(/\{\{([\s\S]*?)\}\}/g))kt.add(ce[1].trim());if(kt.size>0)a.__stx_preserved_client_expressions=[...kt];let vt=et,st=$t;if(ht){let ce="";if(Object.keys(t).length>0)try{ce=` data-stx-props="${jr(JSON.stringify(t))}"`}catch{}let he=U?` stx-hydrate="${jr(U)}"`:"",Ce=Object.fromEntries(Object.entries(tt).map(([Tt,Vt])=>[Tt,Boolean(Vt)])),Se=Object.keys(Ce).length>0?` data-stx-slots="${jr(JSON.stringify(Ce))}"`:"",rt=` data-stx-scope="${vt}"${ce}${Se}${he}`,Le=$t.slice(Mt($t)),St=/^<span(?=[\s/>])/i.test(Le),Wt=/^<[^>]+\bdata-stx-layout-root(?:\s|=|>)/i.test(Le),Ct=/^<[^>]+\bdata-stx-fill-root(?:\s|=|>)/i.test(Le),zn=St?"span":"div",ks=Wt&&u._nativeHostAttrs?' style="display:flex;flex-direction:column;flex:1;min-height:0;min-width:0"':Ct&&u._nativeHostAttrs?' style="width:100%;height:100%"':St||Wt?' style="display:contents"':"";st=Og($t,rt)??`<${zn}${rt} data-stx-component-wrapper${ks}>${$t}</${zn}>`;let Cs=await Promise.all(gt.map(async(Tt)=>{let Vt=Tt.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!Vt)return Tt;let[,ln,Rs]=Vt,Bn=ma(Tt,Me,F);if(Bn!==null)return Bn;let Ht=await Cp(Rs,F,u.buildMode==="compile"),Wn=_n(Ht.clientCode,He(Me)),{vendorStyleTags:Fn}=Ht,Vn=Wn?`function(__scopeId) {
1050
- ${Wn}
1051
- return (${Ht.factoryBody})(__scopeId);
1052
- }`:Ht.factoryBody,Un=U?null:rr(a,Vn),Hn=Un?`window.__stxComponentFactories[${JSON.stringify(Un)}](${JSON.stringify(vt)});`:`(${Vn})(${JSON.stringify(vt)});`;if(U)return`${Fn}<script type="stx/island" data-stx-island="${vt}" data-stx-scoped data-stx-owner="${vt}"${ln}>${pe(Hn)}</script>`;return`${Fn}<script data-stx-scoped data-stx-run="always" data-stx-owner="${vt}"${ln}>${pe(Hn)}</script>`}));if(st=st+`
1053
- `+Cs.join(`
1054
- `),_t)st+=`
1055
- `+_t}else{if(_t)st+=`
1056
- `+_t;if(gt.length>0){let ce=Me.__stx_event_bindings||[],he=He(Me),Ce=await Promise.all(gt.map(async(Se)=>{let rt=ma(Se,Me,F);if(rt!==null)return rt;let Le=Se.match(/<script\b[^>]*>([\s\S]*?)<\/script>/);if(!Le)return Se;return await Ve(Le[1],{eventBindings:ce,templateContent:st,filePath:F,projectRoot:process.cwd(),serverData:he,instanceId:et})}));st+=`
1057
- `+Ce.join(`
1058
- `),Me.__stx_event_bindings=[]}}if(ae){let ce=Xs(st,F);if(ce.hasScoped)st=ce.html}if(Nt&&wt){let ce=Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[];bs.set(Nt,{output:st,dependencies:[...x].filter((he)=>!wt.has(he)),clientFactories:nn?Ki(a,nn):[],uidsConsumed:dt.n-Mn,preservedClientExpressions:sn?ce.filter((he)=>!sn.has(he)):[]})}if(tn)st=`<!--stx-render-failed:${tn}-->${st}`;return Je.length>0?`${st}
1059
- ${Je.join(`
1060
- `)}`:st}catch(q){if(q instanceof Y)throw q;return`[Error processing component: ${q instanceof Error?q.message:String(q)}]`}finally{O.delete(e)}}async function s(e){return Bun.file(e).exists()}function Fr(e,t){let i=de.resolve(t),r=de.resolve(e),a=i.endsWith(de.sep)?i:i+de.sep;if(r===i||r.startsWith(a))return r;return null}async function Sa(e,t,i,r){let a=t.startsWith("layouts/")?t.slice(8):t,l=de.join(e,a);for(let u of l.endsWith(".stx")?[l]:[l,`${l}.stx`])if(await s(u)){if(r)console.log(`Found layout in ${e}: ${u}`);return i?.add(u),u}return null}async function Cn(e,t,i,r){let a=await kp(e,t,i,r);if(a===null)return null;let l=Fr(a,process.cwd());if(l)return l;let u=[i.root,i.layoutsDir,i.fallbackLayoutsDir,i.componentsDir,i.partialsDir,i.pagesDir,...i._layerLayoutDirs??[]].filter((f)=>typeof f==="string"&&f.length>0);for(let f of u){let x=de.isAbsolute(f)?f:de.resolve(process.cwd(),f);if(Fr(a,x))return de.resolve(a)}return console.warn(`[stx] rejected resolved template path that escapes project root: ${a} (template: ${e}, from: ${t})`),null}async function kp(e,t,i,r){if(i.debug)console.log(`Resolving template path: ${e} from ${t}`);let a=de.dirname(t),l=process.cwd();if(e.startsWith("/")){let O=de.join(l,e),z=Fr(O,l);if(!z)return console.warn(`[stx] rejected template path that escapes project root: ${e} (from ${t})`),null;if(i.debug)console.log(`Checking absolute path: ${z}`);if(await s(z)&&r)r.add(z);return z}let u=async(O)=>{if(!i.layoutsDir||!i.fallbackLayoutsDir)return O;let z=de.relative(de.resolve(l,i.fallbackLayoutsDir),O);if(z.startsWith("..")||de.isAbsolute(z))return O;return await Sa(de.resolve(l,i.layoutsDir),e,r,i.debug)??O},f=de.join(a,e);if(await s(f)){if(i.debug)console.log(`Found direct path: ${f}`);let O=await u(f);if(r)r.add(O);return O}if(!e.endsWith(".stx")&&!e.endsWith(".jsx")&&!e.endsWith(".tsx"))for(let O of[".stx",".tsx",".jsx"]){let z=`${f}${O}`;if(await s(z)){if(i.debug)console.log(`Found direct path with extension: ${z}`);let D=await u(z);if(r)r.add(D);return D}}let x=[];if(x.push(...i._layerLayoutDirs??[]),i.layoutsDir)x.push(de.isAbsolute(i.layoutsDir)?i.layoutsDir:de.resolve(process.cwd(),i.layoutsDir));let v=de.resolve(a),A=process.cwd();for(let O=0;O<10;O++){let z=de.join(v,"layouts"),D=!1;try{D=ys.statSync(z,{throwIfNoEntry:!1})?.isDirectory()??!1}catch{}if(D){x.push(z);break}let U=de.dirname(v);if(U===v||U.length<A.length)break;v=U}for(let O of x){let z=await Sa(O,e,r,i.debug);if(z)return z}if(i.fallbackLayoutsDir){let O=de.isAbsolute(i.fallbackLayoutsDir)?i.fallbackLayoutsDir:de.resolve(process.cwd(),i.fallbackLayoutsDir),z=e.startsWith("layouts/")?e.slice(8):e,D=[de.join(O,z)];if(!e.endsWith(".stx"))D.push(`${D[0]}.stx`);for(let U of D)if(await s(U)){if(i.debug)console.log(`Found in options.fallbackLayoutsDir: ${U}`);if(r)r.add(U);return U}}if(e.startsWith("layouts/")||e.includes("/layouts/")){let O=e.split("layouts/"),z=de.join(i.partialsDir||a,"layouts",O[1]);if(await s(z)){if(i.debug)console.log(`Found in layouts path: ${z}`);if(r)r.add(z);return z}if(!z.endsWith(".stx")){let D=`${z}.stx`;if(await s(D)){if(i.debug)console.log(`Found in layouts path with extension: ${D}`);if(r)r.add(D);return D}}}if(i.partialsDir){let O=de.join(i.partialsDir,"layouts");if(await s(O)){let z=de.join(O,e);if(await s(z)){if(i.debug)console.log(`Found in partials layouts dir: ${z}`);if(r)r.add(z);return z}if(!e.endsWith(".stx")){let D=`${z}.stx`;if(await s(D)){if(i.debug)console.log(`Found in partials layouts dir with extension: ${D}`);if(r)r.add(D);return D}}}}let M=i.partialsDir||de.join(process.cwd(),"views"),H=de.join(M,e);if(await s(H)){if(i.debug)console.log(`Found in views path: ${H}`);if(r)r.add(H);return H}if(!e.endsWith(".stx")){let O=`${H}.stx`;if(await s(O)){if(i.debug)console.log(`Found in views path with extension: ${O}`);if(r)r.add(O);return O}}if(a.includes("temp")){let O=de.join(de.dirname(a),"layouts",e);if(await s(O)){if(i.debug)console.log(`Found in temp layouts dir: ${O}`);if(r)r.add(O);return O}if(!e.endsWith(".stx")){let z=`${O}.stx`;if(await s(z)){if(i.debug)console.log(`Found in temp layouts dir with extension: ${z}`);if(r)r.add(z);return z}}}if(i.debug)console.warn(`Template not found after trying all paths: ${e} (referenced from ${t})`);else console.warn(`Template not found: ${e} (referenced from ${t})`);return null}function gl(e,t,i){let r=0,a="",l="";try{if(typeof t==="number"&&t>=0){let u=e.split(`
1061
- `),f=0;for(let x=0;x<u.length;x++)if(f+=u[x].length+1,f>=t){r=x+1,a=u[x].trim();let v=Math.max(0,x-2),A=Math.min(u.length,x+3);l=u.slice(v,A).map((M,H)=>{let O=v+H+1;return`${O===r?"> ":" "}${O}: ${M}`}).join(`
1062
- `);break}}else if(i){let u=e.indexOf(i);if(u>=0)return gl(e,u)}}catch{}return{lineNumber:r,lineContent:a,context:l}}var Ne={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 y(e,t,i,r,a,l){let{lineNumber:u,context:f}=gl(r,a,l),x=i.split("/").pop(),v=0;if(typeof a==="number"&&a>=0&&r){let M=r.lastIndexOf(`
1063
- `,Math.max(0,a-1));v=a-(M+1)+1}let A="";if(u>0)A+=`
1064
- ${i}:${u}${v>0?`:${v}`:""}: ${e.toLowerCase()} error: ${t}
1065
- `;if(A+=`
1066
- ${Ne.bold}${Ne.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${Ne.reset}
1067
- `,A+=`${Ne.bold}${Ne.red}\u2502${Ne.reset} ${Ne.bold}${Ne.bgRed} ERROR ${Ne.reset} ${Ne.red}${e} Error${Ne.reset}${" ".repeat(Math.max(0,43-e.length))}${Ne.bold}${Ne.red}\u2502${Ne.reset}
1068
- `,A+=`${Ne.bold}${Ne.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${Ne.reset}
1069
- `,A+=`
1070
- ${Ne.cyan}${Ne.bold}File:${Ne.reset} ${Ne.dim}${x}${Ne.reset}`,u>0)A+=` ${Ne.gray}(line ${u}${v>0?`, col ${v}`:""})${Ne.reset}`;if(A+=`
1071
- ${Ne.yellow}${Ne.bold}Message:${Ne.reset} ${t}
1072
- `,f)A+=`
1073
- ${Ne.blue}${Ne.bold}Context:${Ne.reset}
1074
- ${Ne.dim}${f}${Ne.reset}
1075
- `;return A}function xe(){Pn.clear(),Dr.clear(),xs.clear(),Nr.clear(),Lr.clear(),Br.clear(),bs.clear()}function yy(){return{size:Pn.size,maxSize:500}}var Mr=S(128);async function Cp(e,t,i){let r=_(e,t,i),a=Mr.get(r);if(a){if(Us(a.deps))return a;Mr.delete(r)}let l=Ai(e,{filePath:t,projectRoot:process.cwd()}),u=l.code,f=Pi(l.styles);u=zt(u).code;let{hasUserImports:x,bundleClientScript:v}=await o("stx/client-script-bundler",()=>import("./chunk-em31p5pb.js")),A=[],M=!1;if(x(u)){let V=u;u=await v(V,t,{projectRoot:process.cwd(),minify:i,collectInputs:A}),M=u===V}let{stripStxRuntimeImports:H}=await o("stx/signal-processing",()=>import("./chunk-7ngfcdv9.js"));u=H(u);let O=N(u),z=yp(O),D=new Set(K(O,!0).split(",").map((V)=>V.trim())),U=`function(__scopeId) {
1076
- ${ft("const",[...Tl,...z],O)}
1077
- const __scope = window.stx._scopes = window.stx._scopes || {};
1078
- const __scopeVars = __scope[__scopeId] = __scope[__scopeId] || {};
1079
- __scopeVars.$refs = __scopeVars.$refs || {};
1080
- const __previousCurrentElement = window.__STX_CURRENT_ELEMENT__;
1081
- const __previousCurrentProps = window.__STX_CURRENT_PROPS__;
1082
- // A clone the runtime is setting up may not be in the document yet (rows
1083
- // a loop builds inside a closed :if), where a lookup cannot see it, so the
1084
- // runtime hands its root over in __STX_SETUP_ROOT__ (signals.ts).
1085
- const __setupRoot = window.__STX_SETUP_ROOT__;
1086
- const __componentElement = (__setupRoot && __setupRoot.getAttribute('data-stx-scope') === __scopeId && __setupRoot) || document.querySelector('[data-stx-scope="' + __scopeId + '"]');
1087
- __scopeVars.$slots = Object.create(null);
1088
- if (__componentElement) {
1089
- try { Object.assign(__scopeVars.$slots, JSON.parse(__componentElement.getAttribute('data-stx-slots') || '{}')); }
1090
- catch {}
1091
- }
1092
- window.__STX_CURRENT_ELEMENT__ = __componentElement;
1093
- let __componentProps = __componentElement && __componentElement.__stx_props;
1094
- if (!__componentProps && __componentElement) {
1095
- try { __componentProps = JSON.parse(__componentElement.getAttribute('data-stx-props') || '{}'); }
1096
- catch { __componentProps = {}; }
1097
- }
1098
- window.__STX_CURRENT_PROPS__ = __componentProps && typeof __componentProps === 'object' && !Array.isArray(__componentProps) ? __componentProps : {};
1099
- const __scopeProps = window.__STX_CURRENT_PROPS__;
1100
- Object.defineProperty(__scopeVars, '$props', { configurable: true, enumerable: true, get: function() {
1101
- return (__componentElement && __componentElement.__stx_props) || __scopeProps;
1102
- } });
1103
-
1104
- // Scope-specific lifecycle callbacks. The queues drain as they run; the
1105
- // hook lists keep what setup registered, because a component behind an :if
1106
- // unmounts at each hide and mounts again at each show (signals.ts,
1107
- // suspendSubtreeScopes).
1108
- if (__scopeVars.__suspended && !__scopeVars.__mounted) {
1109
- // Set up again after an :if hid it -- a <template :if> clones the
1110
- // component afresh on every show, and the clone's script runs. This run's
1111
- // hooks close over this run's state, so they replace the ones the hide
1112
- // kept for a re-show rather than queueing beside them.
1113
- __scopeVars.__mountCallbacks = [];
1114
- __scopeVars.__destroyCallbacks = [];
1115
- __scopeVars.__mountHooks = [];
1116
- __scopeVars.__destroyHooks = [];
1117
- // So do its effects: the last run's watched a clone that is gone.
1118
- if (typeof __scopeVars.__disposeEffects === 'function') __scopeVars.__disposeEffects();
1119
- __scopeVars.__disposeEffects = null;
1120
- }
1121
- __scopeVars.__mountCallbacks = __scopeVars.__mountCallbacks || [];
1122
- __scopeVars.__destroyCallbacks = __scopeVars.__destroyCallbacks || [];
1123
- __scopeVars.__mountHooks = __scopeVars.__mountHooks || [];
1124
- __scopeVars.__destroyHooks = __scopeVars.__destroyHooks || [];
1125
- let __registeringSetupHooks = true;
1126
- const onMount = (fn) => { __scopeVars.__mountCallbacks.push(fn); __scopeVars.__mountHooks.push(fn); };
1127
- const onDestroy = (fn) => {
1128
- __scopeVars.__destroyCallbacks.push(fn);
1129
- // A teardown registered inside onMount belongs to this mount alone.
1130
- // Replaying it AND registering the next mount's teardown doubles cleanup.
1131
- if (__registeringSetupHooks) __scopeVars.__destroyHooks.push(fn);
1132
- };
1133
- // The effects this setup makes (effect, watch) belong to the scope and are
1134
- // disposed with it (disposeSubtreeScopes in the runtime), as its bindings
1135
- // are. Untracked, one reading a store kept running for a component the
1136
- // router had long swapped out.
1137
- const __endEffects = window.stx._beginEffects ? window.stx._beginEffects() : null;
1138
-
1139
- try {
1140
- ${O}
1141
-
1142
- // Register all defined signals and functions in this scope
1143
- const __localVars = {};
1144
- try {
1145
- ${z.map((V)=>D.has(V)?`Object.defineProperty(__localVars, '${V}', ${Bs(V)});`:`if (typeof ${V} !== 'undefined') __localVars['${V}'] = ${V};`).join(`
1146
- `)}
1147
- }
1148
- catch (e) {}
1149
- Object.defineProperties(__scopeVars, Object.getOwnPropertyDescriptors(__localVars));
1150
- if (typeof __stxLiveBindings !== 'undefined') Object.defineProperties(__scopeVars, Object.getOwnPropertyDescriptors(__stxLiveBindings));
1151
- }
1152
- finally {
1153
- __registeringSetupHooks = false;
1154
- if (__endEffects) {
1155
- const __previousDispose = __scopeVars.__disposeEffects;
1156
- const __disposeSetup = __endEffects();
1157
- __scopeVars.__disposeEffects = typeof __previousDispose === 'function'
1158
- ? function() { __previousDispose(); __disposeSetup(); }
1159
- : __disposeSetup;
1160
- }
1161
- window.__STX_CURRENT_ELEMENT__ = __previousCurrentElement;
1162
- window.__STX_CURRENT_PROPS__ = __previousCurrentProps;
1163
- }
1164
- }`,q={vendorStyleTags:f,factoryBody:U,clientCode:O,deps:Er([...A,...l.styles.map((V)=>V.resolvedPath)])};if(!M&&l.unresolved.length===0)Mr.set(r,q);return q}var kn=["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 Rp=100,Ap=599,Ur="__stxResponseStatus",jn="__stxResponseHeaders";function ws(e){return typeof e==="number"&&Number.isInteger(e)&&e>=Rp&&e<=Ap}function xn(e){for(let t of e.matchAll(/\bdefinePageMeta\s*\(\s*\{([\s\S]*?)\}\s*\)/g)){let i=t[1].match(/(?:^|,)\s*status\s*:\s*(\d{3})(?=\s*(?:,|$))/);if(!i)continue;let r=Number(i[1]);if(ws(r))return r}return}function Vr(e,t){if(!e||typeof e!=="object")return!1;let i=typeof t==="string"&&/^\d+$/.test(t.trim())?Number(t.trim()):t;if(!ws(i))return!1;return e[Ur]=i,!0}function Tp(e,t,i){if(!e||typeof e!=="object")return;let r=String(t??"").trim();if(!r)return;e[jn]={...e[jn],[r]:String(i)}}function Bt(e){let t=e?.[Ur];return ws(t)?t:void 0}function Ft(e){let t=e?.[jn];if(!t||typeof t!=="object")return;let i=Object.entries(t).map(([r,a])=>[r,String(a)]);return i.length>0?Object.fromEntries(i):void 0}function el(e,t){if(!e||!t||e===t||typeof t!=="object")return;let i=Bt(e);if(i!==void 0)t[Ur]=i;let r=Ft(e);if(r)t[jn]={...t[jn],...r}}function Js(e){return{setResponseStatus:(t)=>{Vr(e,t)},notFound:(t=404)=>{let i=ws(t)&&t>=400?t:404;Vr(e,i)},setResponseHeader:(t,i)=>{Tp(e,t,i)}}}function tl(e,t,i={}){if(!e.includes("@status"))return e;let{filePath:r,buildMode:a}=i,l=a==="compile",u="",f=0,x=/@status\s*\(/g,v;while((v=x.exec(e))!==null){let A=Ip(e,v.index+v[0].length-1);if(A<0)break;let M=e.slice(v.index+v[0].length,A).trim(),H=/^\d+$/.test(M)?Number(M):d(M,t),O=r?` in ${r}`:"";if(l)console.warn(`[stx] @status(${M})${O} 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(${M}) from <script server> instead \u2014 that runs per request.`);else if(!Vr(t,H))console.warn(`[stx] @status(${M})${O} is not an HTTP status (100-599) \u2014 ignoring it.`);u+=e.slice(f,v.index),f=A+1+(e.slice(A+1).match(/^[^\S\n]*\n?/)?.[0].length??0),x.lastIndex=f}return f===0?e:u+e.slice(f)}function Ip(e,t){let i=1,r=null,a=!1;for(let l=t+1;l<e.length;l++){let u=e[l];if(a){a=!1;continue}if(r){if(u==="\\")a=!0;else if(u===r)r=null;continue}if(u==='"'||u==="'"||u==="`"){r=u;continue}if(u==="(")i++;else if(u===")"&&--i===0)return l}return-1}var Aa=new Set(kn),Op=new Set(["props","$props","defineProps"]),Pp=new Set(["stx","@stacksjs/stx"]),Ta=S(128),Ia=S(64);function jp(e){let t=[],i=0,r=e.split(`
1165
- `);for(let a of r){let l=i,u=null,f=!1;for(let x=0;x<a.length;x++){let v=a[x];if(f){f=!1;continue}if(v==="\\"){f=!0;continue}if(u){if(v===u)u=null;continue}if(v==="'"||v==='"'||v==="`"){u=v;continue}if(v==="/"&&x+1<a.length&&a[x+1]==="/")break;if(v==="{")i++;else if(v==="}")i--}if(l===0){let x=a.match(/(?:const|let|var)\s+(\w+)\s*=/);if(x)t.push(x[1]);else if(/^\s*(?:const|let|var)\s+\w+\s*;?\s*$/.test(a)){let v=a.match(/(?:const|let|var)\s+(\w+)/);if(v)t.push(v[1])}else{let v=a.match(/(?:const|let|var)\s+(\{[^}]+\}|\[[^\]]+\])\s*=/);if(v){let M=v[1].slice(1,-1).split(",").map((H)=>{let O=H.split(":");return(O.length>1?O[1]:O[0]).trim()}).filter((H)=>/^\w+$/.test(H));t.push(...M)}}}}return[...new Set(t)]}function bg(e){let t=e;t=t.replace(/^\s*import\s+.*?from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),t=t.replace(/^\s*import\s+['"][^'"]+['"]\s*;?\s*$/gm,""),t=t.replace(/^\s*interface\s+\w+\s*\{[\s\S]*?\n\}\s*$/gm,""),t=t.replace(/^\s*type\s+\w+\s*=[\s\S]*?(?=\n(?:const|let|var|function|export|interface|type|$))/gm,""),t=t.replace(/^(\s*(?:export\s+)?(?:const|let|var)\s+)(\w+|\{[^}]+\}|\[[^\]]+\])\s*:\s*[^=]+(\s*=)/gm,"$1$2$3");function i(r){if(!r.includes(":"))return r;let a=[],l="",u=0,f=0,x=null;for(let v=0;v<r.length;v++){let A=r[v];if(x){if(l+=A,A===x)x=null;continue}if(A==='"'||A==="'"||A==="`"){x=A,l+=A;continue}if(A==="<")u++;else if(A===">"&&u>0)u--;else if(A==="(")f++;else if(A===")")f--;if(A===","&&u===0&&f===0){a.push(l),l="";continue}l+=A}if(l)a.push(l);return a.map((v)=>{let A=v.trim(),M=A.startsWith("..."),H=M?A.slice(3):A,O=-1,z=0;for(let ie=0;ie<H.length;ie++)if(H[ie]==="<")z++;else if(H[ie]===">")z--;else if(H[ie]===":"&&z===0){O=ie;break}if(O===-1)return v;let U=H.substring(0,O).trim().replace(/\?$/,""),q=H.substring(O+1),V=-1,F=0;for(let ie=0;ie<q.length;ie++)if(q[ie]==="<")F++;else if(q[ie]===">")F--;else if(q[ie]==="="&&F===0){V=ie;break}let Q=M?"...":"";if(V!==-1)return`${Q}${U} = ${q.substring(V+1).trim()}`;return`${Q}${U}`}).join(", ")}t=t.replace(/\b(function\s+\w*\s*)\(([^)]*)\)/g,(r,a,l)=>{if(!l.includes(":"))return r;return`${a}(${i(l)})`});{let r=/\b(function\s+\w*\s*)\(/g,a,l=[];while((a=r.exec(t))!==null){let u=a.index+a[0].length-1,f=1,x=u+1,v=0,A=null;while(x<t.length&&f>0){let O=t[x];if(A){if(O===A)A=null;x++;continue}if(O==='"'||O==="'"||O==="`"){A=O,x++;continue}if(O==="<")v++;else if(O===">"&&v>0)v--;else if(v===0){if(O==="(")f++;else if(O===")")f--}if(f>0)x++}if(f!==0)continue;let M=t.substring(u+1,x);if(!M.includes(":"))continue;let H=i(M);l.push({start:u+1,end:x,replacement:H})}for(let u=l.length-1;u>=0;u--){let{start:f,end:x,replacement:v}=l[u];t=t.substring(0,f)+v+t.substring(x)}}return t=t.replace(/\(([^)]*)\)\s*(?::\s*[^=]+)?\s*=>/g,(r,a)=>{if(!a.includes(":"))return r;if(a.includes("{")||a.includes("}"))return r;return`(${a.split(",").map((u)=>{let[f,...x]=u.split("="),v=f.split(":")[0].trim();if(x.length>0)return`${v} = ${x.join("=").trim()}`;return v}).join(", ")}) =>`}),t=t.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"),t=t.replace(/(\b(?:function|class|interface|type|extends|implements)\s+\w+)\s*<[^<>()]*>/g,"$1"),t=t.replace(/(\b(?:defineProps|withDefaults|defineEmits|defineSlots|Array|Promise|Map|Set|Record|Partial|Required|Readonly|Pick|Omit|Exclude|Extract))\s*<[^<>()]*>/g,"$1"),t=t.replace(/(\w+)\s*<[A-Z][^<>()]*>\s*(?=\()/g,"$1"),t=t.replace(/\s+as\s+(?:const|[A-Za-z]\w*(?:\[\])?(?:\s*\|\s*\w+(?:\[\])?)*)/g,""),t=t.replace(/\s+satisfies\s+\w+(?:<[^>]*>)?/g,""),t=t.replace(/(\w|\)|\])\s*!(?!=)/g,"$1"),t=t.replace(/^\s*(?:export\s+)?(?:const\s+)?enum\s+\w+\s*\{[^}]*\}\s*$/gm,""),t=t.replace(/(?<=[\s=,(])<[A-Z]\w*(?:\[\])?>/g,""),t=t.replace(/\n\s*\n\s*\n/g,`
1166
-
1167
- `),t}function wg(e){return e.replace(/\s*(?:imported from|from)\s+(?:(['"])([^'"\r\n]+)\1|(\S+))/g,(t,...i)=>{let[,r,a]=i,l=r??a;return/(?:[/\\]packages[/\\]stx[/\\]|@stacksjs[/\\]stx[/\\])/.test(l)?"":t})}function vg(e){return/cannot find module|cannot find package|could not resolve|module not found|failed to resolve/i.test(e)}function xg(e){if(e instanceof SyntaxError)return!0;let t=e instanceof Error?e.message:String(e);return/SyntaxError|Unexpected (token|identifier|string|number|keyword|end of)|Unterminated|Expected .+ but found/i.test(t)}function Sg(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 Oa=new Set;async function h(e,t,i,r={}){if(!e.trim())return;let a=T(),l=_(e,JSON.stringify(a)),u=Ta.get(l);if(u===void 0){try{let ae=ne({loader:"ts",target:"browser",define:a}),ue=e.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");ue=ue.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,""),u=ae.transformSync(ue)}catch{u=bg(e)}Ta.set(l,u)}let f={exports:{}},x=f.exports,v=Qt.cwd(),A={},M=[...u.matchAll(/require\s*\(\s*['"]([^'"]+)['"]\s*\)/g)||[]].map((ae)=>ae[1]).filter((ae)=>!ae.startsWith("node:")&&!["fs","path","os","child_process","crypto","http","https","url","util","stream","events","buffer","net","querystring","zlib","tls"].includes(ae)),H=new Map;for(let ae of M)try{if(ae.startsWith(".")){A[ae]=await import(bt.resolve(bt.dirname(i),ae));continue}let ue=bt.resolve(v,"node_modules",ae),_e=bt.join(ue,"package.json"),Ie=JSON.parse(b("fs").readFileSync(_e,"utf8")),Ze=Ie.main||"index.js";if(Ie.exports){let nt=typeof Ie.exports==="string"?Ie.exports:Ie.exports["."];if(typeof nt==="string")Ze=nt;else if(nt?.bun)Ze=nt.bun;else if(nt?.import)Ze=nt.import;else if(nt?.default)Ze=nt.default}A[ae]=await import(bt.resolve(ue,Ze))}catch(ue){if(ae.startsWith("."))H.set(ae,ue instanceof Error?ue.message:String(ue))}let O=(ae)=>{if(A[ae])return A[ae];let ue=H.get(ae);if(ue!==void 0)throw Error(`Cannot require '${ae}' from ${i}: ${ue}`);return b(ae)},z=t.props||{},D=(ae)=>{if(!ae)return z;let ue={};for(let[_e,Ie]of Object.entries(ae)){let Ze=z[_e];if(Ze!==void 0)ue[_e]=Ze;else if(typeof Ie==="function")ue[_e]=Ie();else ue[_e]=Ie}return ue};for(let[ae,ue]of Object.entries(z))Object.defineProperty(D,ae,{value:ue,enumerable:!0,configurable:!0,writable:!0});let U=(ae,ue=!1)=>{if(ae===void 0||ae===null)return ue;if(typeof ae==="string"){let _e=ae.trim().toLowerCase();if(_e===""||_e==="true"||_e==="1"||_e==="on"||_e==="yes")return!0;if(_e==="false"||_e==="0"||_e==="off"||_e==="no")return!1;return!0}return Boolean(ae)},q=(ae,ue=0)=>{if(ae===void 0||ae===null)return ue;if(typeof ae==="string"){let Ie=ae.trim();if(Ie==="")return ue;let Ze=Number(Ie);return Number.isFinite(Ze)?Ze:ue}let _e=Number(ae);return Number.isFinite(_e)?_e:ue};for(let ae of["name","length","caller","arguments"]){if(Object.prototype.hasOwnProperty.call(z,ae))continue;try{Object.defineProperty(D,ae,{value:void 0,enumerable:!1,configurable:!0,writable:!0})}catch{}}let V=(ae)=>{if(!ae)return z;let ue={...z};for(let[_e,Ie]of Object.entries(ae)){let Ze=Ie&&typeof Ie==="object"&&!Array.isArray(Ie)?Ie:{type:Ie};if(ue[_e]===void 0&&Ze.default!==void 0)ue[_e]=typeof Ze.default==="function"?Ze.default():Ze.default}return ue},F=()=>t.slots||{},Q=(ae,ue)=>{let _e={...ae};for(let[Ie,Ze]of Object.entries(ue))if(_e[Ie]===void 0)if(typeof Ze==="function")_e[Ie]=Ze();else _e[Ie]=Ze;return _e},ie=(ae)=>{let ue=()=>ae;return ue.set=(_e)=>{},ue.update=(_e)=>{},ue},oe=(ae)=>{let ue,_e=!1;return()=>{if(!_e)try{ue=ae(),_e=!0}catch{ue=void 0}return ue}},me=(ae)=>{},le=(ae)=>ae(),be=(ae)=>{},Ae=(ae)=>{},ke=Js(t);function ye(ae){let ue=ae||{};if(ue.title!==void 0||ue.description!==void 0)tt({title:ue.title,description:ue.description})}function Je(ae){if(!ae||typeof ae!=="object")return;let ue=t.__stxClientPayload??{};Object.assign(ue,ae),t.__stxClientPayload=ue}let Ge=()=>{let ae=t.__stxServeContext,ue=t.__stxServeSearch??ae?.search??"",_e=ae?.path??"",Ie=Object.fromEntries(new URLSearchParams(ue)),Ze=t.query,nt=Object.keys(Ie).length>0?Ie:Ze??{},ht=ue||(Object.keys(nt).length>0?`?${new URLSearchParams(nt).toString()}`:"");return{params:t.params??{},query:nt,path:_e,name:"",fullPath:_e+ht,hash:"",matched:[]}},pt=()=>({push:(ae)=>{},replace:(ae)=>{},back:()=>{},forward:()=>{},go:(ae)=>{}}),Qe=(ae)=>{let ue=t.__stx_runtime_head||{};t.__stx_runtime_head=Xe(ue,Pe(ae||{},{known:io,source:"useHead()"}))},tt=(ae)=>{Qe(ao(ae||{}))},dt=(ae)=>({value:ae}),Oe=(ae)=>ae,ot=(ae)=>({value:typeof ae==="function"?ae():ae}),et=(ae,ue)=>{},Me=(ae)=>{},yt=(ae)=>{},Ye=(ae)=>ae?ae():Promise.resolve(),_s=(ae)=>(ue,..._e)=>{},en=(ae)=>{},gt=(ae,ue)=>{},tn=(ae,ue)=>ue,$s=()=>({value:"light"}),Nt=()=>ie(!1),wt=(ae)=>ie(!1),nn=()=>ie(!1),Mn=()=>wt("(prefers-color-scheme: dark)"),sn=()=>wt("(prefers-color-scheme: light)"),rn=()=>wt("(prefers-reduced-motion: reduce)"),Zr=()=>wt("(prefers-contrast: more)"),mt={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:{}},on=new Proxy(mt,{get(ae,ue){if(ue in ae)return ae[ue];return},set(ae,ue,_e){return ae[ue]=_e,!0}}),vs={getElementById:()=>null,querySelector:()=>null,querySelectorAll:()=>[],createElement:()=>({}),createTextNode:()=>({}),body:{},head:{},documentElement:{},addEventListener:()=>{},removeEventListener:()=>{}},_t=console;try{let ae=Ri(u,i),ue=new Set(Object.keys(z)),_e=Object.keys(t).filter((ce)=>!ue.has(ce)&&!Op.has(ce)&&Ut(ce)),Ie=_e.map((ce)=>t[ce]);if(!_e.includes("__stxServeContext"))_e.push("__stxServeContext"),Ie.push(void 0);if(!ue.has("cookies")){let ce=t.cookies??t.__stxServeContext?.cookies??{},he=_e.indexOf("cookies");if(he<0)_e.push("cookies"),Ie.push(ce);else Ie[he]=ce}let Ze=new Set(["async","module","exports","require","params","window","document","console","state","derived","effect"]),nt=[],ht=[];for(let[ce,he]of Object.entries(z)){if(!Ut(ce))continue;if(Ze.has(ce))continue;if(new RegExp(`(?:^|[\\s;{])(?:const|let|var|function)\\s+${ce}\\b`).test(ae))continue;nt.push(ce),ht.push(he)}let Es=jp(ae).map((ce)=>`module.exports.${ce} = typeof ${ce} !== 'undefined' ? ${ce} : module.exports.${ce};`).join(`
1168
- `),Dn=t.params??{},an=[],cn=[];for(let ce=0;ce<_e.length;ce++){if(_e[ce]==="params")continue;an.push(_e[ce]),cn.push(Ie[ce])}let Nn=[...kn,...nt,...an],Ln=`return (async () => {
1169
- ${ae}
1170
- ${Es}
1171
- return module.exports
1172
- })()`,$t=_(Ln,Nn.join("\x00")),kt=Ia.get($t);if(!kt)kt=Function(...Nn,Ln),Ia.set($t,kt);let vt=t.__stx_options?.runtimeConfig;if(vt||/\buse(?:Server)?RuntimeConfig\b/.test(u))await $n(t,i,vt);let st=await Ke(t.__stx_runtime_config??Rn()??B(),()=>Qr(t,()=>kt(f,x,O,z,D,U,q,V,Q,Je,ei,Li,to,ie,oe,me,le,be,Ae,ye,Ge,pt,Qe,tt,ke.setResponseStatus,ke.setResponseHeader,ke.notFound,dt,Oe,ot,et,Me,yt,Ye,_s,en,F,gt,tn,$s,Nt,wt,nn,Mn,sn,rn,Zr,on,vs,_t,mt.confirm,mt.alert,mt.fetch,Dn,...ht,...cn)));if(r.preserveExisting){for(let[ce,he]of Object.entries(st))if(!(ce in t)||t[ce]===void 0)t[ce]=he}else Object.assign(t,st);for(let[ce,he]of Object.entries(z))if(!(ce in t))t[ce]=he}catch(ae){if(t.__stx_strict_hydration)throw ae;let ue=wg(ae instanceof Error?ae.message:String(ae));if(vg(ue))console.warn(`[stx] server <script> in ${i??"<unknown>"} imports a module that does not resolve, so every variable in that script is undefined. Cause: ${ue}`),r.onFailure?.({kind:"module-resolution",message:ue,error:ae});else if(xg(ae))console.warn(`[stx] server <script> in ${i??"<unknown>"} does not parse, so every variable in that script is undefined. Cause: ${ue}`),r.onFailure?.({kind:"syntax",message:ue,error:ae});else if(Sg(ue))console.warn(`[stx] server <script> in ${i??"<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: ${ue}`),r.onFailure?.({kind:"missing-binding",message:ue,error:ae});else{let _e=`${i??"<unknown>"}\x00${ue}`;if(Qt.env.STX_DEBUG||!Oa.has(_e))Oa.add(_e),console.warn(`[stx] server <script> in ${i??"<unknown>"} threw, so every variable in that script is undefined and anything that reads one renders empty. Cause: ${ue}`);r.onFailure?.({kind:"unknown",message:ue,error:ae})}try{await Bp(u,t,i)}catch(_e){if(Qt.env.STX_DEBUG){let Ie=_e instanceof Error?_e.message:String(_e);console.warn(`[stx] fallback extraction also failed in ${i??"<unknown>"}: ${Ie}`)}}}}function kg(e){let t=0,i=null,r=!1,a=!1;for(let l=0;l<e.length;l++){let u=e[l];if(i){if(u===i){if(i=null,r||t===0)a=!0}continue}if(u==="'"||u==='"'||u==="`"){i=u;continue}if(u==="{")t++;else if(u==="}")t--;else if(e.startsWith("from",l)&&t===0)r=!0}return i===null&&t===0&&a}var Mp=/^(?:export\s+)?(?:const|let|var)\s+[A-Za-z_$][\w$]*(?:\s*,\s*[A-Za-z_$][\w$]*)*\s*;?$/;function Ri(e,t){let i=t?bt.dirname(t):Qt.cwd(),r=Qt.cwd(),a=e.split(`
1173
- `),l=[],u=0;while(u<a.length){let f=a[u].trim();if(f.startsWith("interface ")||f.startsWith("export interface ")||f.startsWith("type ")||f.startsWith("export type ")){if(f.includes("{")&&!f.includes("}")){let x=0;for(;u<a.length;u++){for(let v of a[u])if(v==="{")x++;else if(v==="}")x--;if(x<=0)break}}u++;continue}if(f.startsWith("definePageMeta(")){let x=0,v=!1,A=u;for(let O=u;O<a.length&&!v;O++){let z=null,D=!1,U=a[O];for(let q=0;q<U.length;q++){let V=U[q];if(D){D=!1;continue}if(V==="\\"){D=!0;continue}if(z){if(V===z)z=null;continue}if(V==='"'||V==="'"||V==="`"){z=V;continue}if(V==="(")x++;else if(V===")"){if(x--,x===0){u=O+1,v=!0;break}}}}if(!v)u=a.length;let M=a.slice(A,u).join(`
1174
- `),H=[];for(let O of["title","description"]){let z=new RegExp(`\\b${O}\\s*:\\s*(['"\`])((?:\\\\.|(?!\\1)[^\\\\])*)\\1`).exec(M);if(z)H.push(`${O}: ${JSON.stringify(z[2])}`)}if(H.length>0)l.push(`useSeoMeta({ ${H.join(", ")} });`);continue}if(f.startsWith("import ")||f==="import"||f.startsWith("import{")||/^import['"]/.test(f)){let x=f,v=0;while(!kg(x)&&u+v+1<a.length)v++,x=`${x} ${a[u+v].trim()}`;u+=v;let A=x.match(/^import\s+(\w+)\s+from\s+['"](.+?)['"]/),M=x.match(/^import\s+\{([^}]*)\}\s+from\s+['"](.+?)['"]/),H=x.match(/^import\s*['"](.+?)['"]/),O=x,z=(D)=>{if(D.startsWith("."))return bt.resolve(i,D);if(D.startsWith("~/")||D.startsWith("@/"))return bt.resolve(r,D.slice(2));try{return Bun.resolveSync(D,i)}catch{return D}};if(A){let[,D,U]=A,q=z(U);l.push(`const ${D} = (await import('${q}')).default`),l.push(`module.exports.${D} = ${D};`)}else if(M){let[,D,U]=M,q=z(U),V=[],F=[],Q=Pp.has(U);for(let ie of D.split(",")){let oe=ie.trim();if(!oe)continue;let me=oe.split(/\s+as\s+/);if(me.length===2){let[le,be]=[me[0].trim(),me[1].trim()];if(Q&&Aa.has(le)){l.push(`const ${be} = ${le};`);continue}V.push(`${le}: ${be}`),F.push(be)}else{if(Q&&Aa.has(oe))continue;V.push(oe),F.push(oe)}}if(V.length>0)l.push(`const { ${V.join(", ")} } = await import('${q}')`);for(let ie of F)l.push(`module.exports.${ie} = ${ie};`)}else if(H){let D=z(H[1]);l.push(`await import('${D}')`)}else l.push(O);u++;continue}if(Mp.test(f))l.push(a[u]),u++;else if(f.startsWith("export const ")||f.startsWith("export let ")||f.startsWith("export var ")){let x=ja(a,u),{type:v,name:A,value:M}=x;l.push(`${v} ${A} = ${M};`),l.push(`module.exports.${A} = ${A};`),u=x.nextIndex}else if(f.startsWith("export function ")||f.startsWith("export async function ")){let x=Hr(a,u);l.push(x.functionCode),l.push(`module.exports.${x.name} = ${x.name};`),u=x.nextIndex}else if(f.startsWith("const ")||f.startsWith("let ")||f.startsWith("var ")){let x=ja(a,u),{type:v,name:A,value:M}=x;l.push(`${v} ${A} = ${M};`),l.push(`module.exports.${A} = ${A};`),u=x.nextIndex}else if(f.startsWith("function ")||f.startsWith("async function ")){let x=Hr(a,u);l.push(x.functionCode),l.push(`module.exports.${x.name} = ${x.name};`),u=x.nextIndex}else if(f.startsWith("export default function ")||f.startsWith("export default async function ")){let x=a[u].replace(/^(\s*)export\s+default\s+/,"$1"),v=[...a];v[u]=x;let A=Hr(v,u);if(l.push(A.functionCode),A.name)l.push(`module.exports.default = ${A.name};`);u=A.nextIndex}else if(f.startsWith("export default ")){let x=f.replace(/^export\s+default\s+/,"").replace(/;$/,"");l.push(`module.exports.default = ${x};`),u++}else if(f.startsWith("class ")||f.startsWith("export class ")){let x=f.match(/(?:export\s+)?class\s+(\w+)/);if(x){let v=x[1],A=a[u].replace(/^export\s+/,""),M=0,H=u;for(;H<a.length;H++){let O=a[H];for(let z of O)if(z==="{")M++;else if(z==="}")M--;if(H>u)A+=`
1175
- `+O;if(M<=0&&H>=u)break}l.push(A),l.push(`module.exports.${v} = ${v};`),u=H+1}else l.push(f),u++}else if(f.includes("module.exports"))l.push(f),u++;else if(f.trim()&&!f.startsWith("//"))l.push(f),u++;else u++}return Dp(l.join(`
1176
- `),i,r)}function Dp(e,t,i){let r=e.length,a="",l=0,u=null,f=!1,x=!1,v=0;while(l<r){let A=e[l],M=e[l+1];if(f){if(a+=A,A===`
1177
- `)f=!1;l++;continue}if(x){if(a+=A,A==="*"&&M==="/"){a+=M,l+=2,x=!1;continue}l++;continue}if(!u&&A==="/"&&M==="/"){f=!0,a+=A,l++;continue}if(!u&&A==="/"&&M==="*"){x=!0,a+=A,l++;continue}if(u){if(a+=A,A==="\\"){a+=M,l+=2;continue}if(A===u&&u!=="`"){u=null,l++;continue}if(u==="`"){if(A==="$"&&M==="{"){v++,a+=M,l+=2;continue}if(A==="`"){u=null,l++;continue}}l++;continue}if(v>0){if(A==="{")v++;else if(A==="}")v--}if(A==='"'||A==="'"||A==="`"){u=A,a+=A,l++;continue}if(A==="a"&&e.startsWith("await",l)){let H=Np(e,l);if(H){let{quote:O,path:z,end:D}=H;if(z.startsWith(".")||z.startsWith("~/")||z.startsWith("@/")){let U=z.startsWith(".")?bt.resolve(t,z):bt.resolve(i,z.slice(2));a+=`await import(${O}${U}${O})`,l=D;continue}}}a+=A,l++}return a}function Np(e,t){let i=t+5;if(i>=e.length)return null;if(!/\s/.test(e[i]))return null;while(i<e.length&&/\s/.test(e[i]))i++;if(!e.startsWith("import",i))return null;i+=6;while(i<e.length&&/\s/.test(e[i]))i++;if(e[i]!=="(")return null;i++;while(i<e.length&&/\s/.test(e[i]))i++;let r=e[i];if(r!=="'"&&r!=='"')return null;i++;let a=i;while(i<e.length&&e[i]!==r)if(e[i]==="\\")i+=2;else i++;if(i>=e.length)return null;let l=e.slice(a,i);i++;while(i<e.length&&/\s/.test(e[i]))i++;if(e[i]!==")")return null;return{quote:r,path:l,end:i+1}}function La(e,t){let i=e[t];if(i!=="{"&&i!=="[")return null;let a=k(e,i,i==="{"?"}":"]",t);if(a===-1)return null;return{pattern:e.slice(t,a+1),endPos:a+1}}function za(e){let t=[],i=e.slice(1,-1).trim();if(!i)return t;let r=0,a=0,l="";while(r<i.length){let u=i[r];if(u==="{"||u==="["){let f=a===0?La(i,r):null;if(f){t.push(...za(f.pattern)),r=f.endPos,l="";continue}a++}else if(u==="}"||u==="]")a--;if(a>0){r++;continue}if(u===","){if(l.trim())t.push(l.trim());l="",r++;continue}if(u===":"){l="",r++;continue}if(u==="="){if(l.trim())t.push(l.trim());l="",r++;while(r<i.length&&i[r]!==","&&a===0){if(i[r]==="{"||i[r]==="[")a++;else if(i[r]==="}"||i[r]==="]")a--;r++}continue}if(/[\w$]/.test(u))l+=u;r++}if(l.trim())t.push(l.trim());return t}function _g(e){let t=/^(?:export\s+)?(const|let|var)\s+([A-Za-z_$][\w$]*)/.exec(e);if(!t)return null;let i=t[0].length,r=(a)=>a===" "||a==="\t";while(i<e.length&&r(e[i]))i++;if(e[i]===":"){let a=0,l=null;i++;for(;i<e.length;i++){let u=e[i];if(l){if(u==="\\"){i++;continue}if(u===l)l=null;continue}if(u==="'"||u==='"'||u==="`"){l=u;continue}if(u==="("||u==="["||u==="{"||u==="<"){a++;continue}if(u===")"||u==="]"||u==="}"||u===">"){a--;continue}if(u==="="&&a<=0){let f=e[i+1],x=e[i-1];if(f!=="="&&f!==">"&&x!=="="&&x!=="!"&&x!=="<"&&x!==">")break}}if(e[i]!=="=")return null}while(i<e.length&&r(e[i]))i++;if(e[i]!=="=")return null;return{type:t[1],name:t[2],value:e.slice(i+1).trim()}}function Pa(e,t,i,r){let a=null,l=!1;for(let u of e){if(l){l=!1;continue}if(u==="\\"){l=!0;continue}if(a){if(u===a)a=null;continue}if(u==="'"||u==='"'||u==="`"){a=u;continue}if(u===t)r++;else if(u===i)r--}return r}function ja(e,t){let i=e[t].trim(),r=_g(i),a=r?[i,r.type,r.name,r.value]:null;if(!a){let A=i.match(/^(?:export\s+)?(const|let|var)\s+/);if(A){let M=i.slice(A[0].length),H=t;if(M.startsWith("{")||M.startsWith("[")){let z=M[0],D=z==="{"?"}":"]",U=Pa(M,z,D,0),q=M;for(let V=t+1;V<e.length&&U>0;V++)q+=` ${e[V].trim()}`,H=V,U=Pa(e[V],z,D,U);if(U>0)q=M,H=t;M=q}let O=La(M,0);if(O){let z=A[1],D=O.pattern,U=M.slice(O.endPos).trim();if(U.startsWith("=")){let q=U.slice(1).trim(),V=q,F=Math.max(H,t);if(Ma(q)){let me=Da(e,F,q);V=me.value,F=me.nextIndex}else F=F+1;V=V.trim().replace(/;$/,"");let Q=za(D),ie=`__stx_src_${t}`,oe=Q.map((me)=>`module.exports.${me} = ${me};`).join(`
1178
- `);return{type:z,name:ie,value:`${V}; ${z} ${D} = ${ie};
1179
- ${oe}`,nextIndex:F}}}}throw Error(`Failed to parse variable declaration: ${i}`)}let[,l,u,f]=a,x=f,v=t;if(Ma(f)){let A=Da(e,t,f);x=A.value,v=A.nextIndex}else v=t+1;while(v<e.length){let A=e[v].trim();if(A.startsWith(".")||A.startsWith("?."))x+=`
1180
- ${e[v]}`,v++;else break}return x=x.trim().replace(/;$/,""),{type:l,name:u,value:x,nextIndex:v}}function Hr(e,t){let i=e[t].trim(),r=i.match(/^(?:export\s+)?(?:async\s+)?function\s+(\w+)/);if(!r)throw Error(`Failed to parse function declaration: ${i}`);let[,a]=r,l=i.replace(/^export\s+/,""),u=t;if(Lp(i)){let f=zp(e,t,l);l=f.functionCode,u=f.nextIndex}else u=t+1;return{name:a,functionCode:l,nextIndex:u}}function Ma(e){let t=e.trim();if(t.startsWith("{"))return k(t,"{","}",0)===-1;if(t.startsWith("["))return k(t,"[","]",0)===-1;return!Ba(t)}function Ba(e){let t={paren:0,bracket:0,brace:0},i=null,r=0;for(let a=0;a<e.length;a++){let l=e[a];if((a>0?e[a-1]:"")==="\\"&&i)continue;if((l==='"'||l==="'")&&!i){i=l;continue}if(l===i&&i!=="`"){i=null;continue}if(l==="`"&&!i){i="`";continue}if(l==="`"&&i==="`"&&r===0){i=null;continue}if(i==="`"&&l==="$"&&e[a+1]==="{"){r++,a++;continue}if(r>0&&l==="{"){r++;continue}if(r>0&&l==="}"){r--;continue}if(i)continue;if(l==="(")t.paren++;else if(l===")")t.paren--;else if(l==="[")t.bracket++;else if(l==="]")t.bracket--;else if(l==="{")t.brace++;else if(l==="}")t.brace--}return t.paren===0&&t.bracket===0&&t.brace===0&&i===null}function Wa(e){let t=e.indexOf("(");if(t===-1)return e.indexOf("{");let i=k(e,"(",")",t);if(i===-1)return-1;return e.indexOf("{",i)}function Lp(e){let t=Wa(e);if(t===-1)return!0;return k(e,"{","}",t)===-1}function Da(e,t,i){let r=i,a=t+1;while(a<e.length&&!Ba(r)){let l=e[a];r+=`
1181
- ${l}`,a++}while(a<e.length){let l=e[a].trim();if(l.startsWith(".")||l.startsWith("?."))r+=`
1182
- ${e[a]}`,a++;else break}return{value:r,nextIndex:a}}function zp(e,t,i){let r=i,a=t+1;while(a<e.length){let l=Wa(r);if(l!==-1){if(k(r,"{","}",l)!==-1)break}let u=e[a];r+=`
1183
- ${u}`,a++}return{functionCode:r,nextIndex:a}}function Na(e,t){let i=d(e,t)??d(`(${e})`,t);if(i!==void 0)return i;if(!/\bprocess\b/.test(e))return;let r={...t,process:Object.freeze({env:{...Qt.env}})},a=Object.keys(r).filter(Ut),l=a.map((u)=>r[u]);try{return Function(...a,`'use strict'; return (${e});`)(...l)}catch{try{return Function(...a,`'use strict'; return ${e};`)(...l)}catch{return}}}async function Bp(e,t,i){let r=e.matchAll(/export\s+(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:export\s+|$))/g);for(let l of r){let[,,u,f]=l;try{let x=f.trim().replace(/;$/,""),v=Na(x,t);if(v!==void 0)t[u]=v}catch(x){console.warn(`Failed to parse export ${u} in fallback:`,x)}}let a=e.matchAll(/(?:^|\n)\s*(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:(?:const|let|var|function|export)\s+|$))/g);for(let l of a){let[,,u,f]=l;if(!(u in t))try{let x=f.trim().replace(/;$/,""),v=Na(x,t);if(v!==void 0)t[u]=v}catch{}}}function cl(e){let t=e.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),i=t?t[1]:"",r=t?e.replace(/<script\b[^>]*>[\s\S]*?<\/script>/i,""):e;return{scriptContent:i,templateWithoutScript:r}}function ll(e){let t=e.trim();if(!t)return!1;return/(?:const|let|var|function)\s+\w+/.test(t)}
1184
- export{je,Te,K,Bs,Fs,G,Cr,zs,Hs,yi,bi,wi,Vs,vi,Wc,Dt,Be,o,pe,S,qc,_,Er,Us,$e,T,Fe,L,Mt,Lt,J,bn,ze,w,Kc,we,ee,Tr,$r,Rr,fe,jt,te,j,lt,Ar,Pr,Gc,Ws,qs,Ks,ve,xi,wn,yg,ge,Xc,Jc,Si,Yc,ki,Zc,Gs,_i,Ci,Qc,Ei,Ti,vn,Xs,xn,Bt,Ft,el,Js,tl,nl,Sn,Ir,Ys,Zs,rl,$i,sl,ol,il,al,kn,bg,wg,vg,xg,Sg,h,kg,Ri,_g,cl,ll,Ai,Pi,Cg,zt,ul,Eg,dl,hy,He,_n,Ve,Tg,$g,Rg,Ag,Pg,Qs,Ig,Ue,ne,We,Og,Or,Ng,pl,fl,Ii,qe,s,Cn,gl,y,xe,yy,ml,hl,yl,Oi,eo,Dg,by,Mg,wy,En,g,X,re,Tn,Re,Lg,Ni,jg,vy,R,Di,Bg,xy,I,Sy};