@stacksjs/stx 0.2.874 → 0.2.875

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 (244) hide show
  1. package/dist/chunk-003ph86a.js +2 -0
  2. package/dist/chunk-027meh1k.js +2 -0
  3. package/dist/chunk-0bc3mwqd.js +2 -0
  4. package/dist/{chunk-gbtbfg7e.js → chunk-0g2mg8cw.js} +3 -3
  5. package/dist/chunk-0gv2mmr0.js +2 -0
  6. package/dist/{chunk-c8jhskx8.js → chunk-0h6r7nvn.js} +38 -38
  7. package/dist/chunk-0j8zre1m.js +2 -0
  8. package/dist/{chunk-vxtx0khv.js → chunk-0qwbhv3f.js} +9 -9
  9. package/dist/{chunk-6mkn81pd.js → chunk-0sa9gqmc.js} +7 -7
  10. package/dist/chunk-1gfg6qmr.js +2 -0
  11. package/dist/{chunk-6ftee542.js → chunk-1q5w3xav.js} +2 -2
  12. package/dist/chunk-1tqp2s13.js +2 -0
  13. package/dist/chunk-1y7kfp5d.js +2 -0
  14. package/dist/chunk-1ztp5vkh.js +3 -0
  15. package/dist/chunk-24e4dapm.js +2 -0
  16. package/dist/{chunk-c3kanj1m.js → chunk-2qb9kp21.js} +3 -3
  17. package/dist/{chunk-01mwbg1r.js → chunk-2zaatnnh.js} +4 -4
  18. package/dist/chunk-32wvc376.js +2 -0
  19. package/dist/{chunk-gxan9w4e.js → chunk-3f9wctns.js} +2 -2
  20. package/dist/{chunk-v4xes880.js → chunk-3mz9bdf7.js} +3 -3
  21. package/dist/chunk-3te2y9qf.js +2 -0
  22. package/dist/{chunk-farh4p7f.js → chunk-3w7gacva.js} +2 -2
  23. package/dist/chunk-447jc6zc.js +2 -0
  24. package/dist/{chunk-s584xnzx.js → chunk-4517hny7.js} +2 -2
  25. package/dist/chunk-45rzd16g.js +1609 -0
  26. package/dist/{chunk-p1a1kbhz.js → chunk-4m11kcxz.js} +8 -8
  27. package/dist/chunk-51ymssz5.js +2 -0
  28. package/dist/{chunk-a0dsp485.js → chunk-644ckv6e.js} +10 -10
  29. package/dist/{chunk-2xc457bf.js → chunk-6az66mrc.js} +14 -14
  30. package/dist/chunk-6dz5za5z.js +2 -0
  31. package/dist/{chunk-fr72bsqd.js → chunk-6ezt9kbe.js} +11 -11
  32. package/dist/chunk-6grkdknk.js +2 -0
  33. package/dist/chunk-6q9a5bph.js +2 -0
  34. package/dist/chunk-6rqef7wp.js +2 -0
  35. package/dist/{chunk-atpscb2m.js → chunk-6ykfy7eh.js} +2 -2
  36. package/dist/{chunk-wa3z5c8j.js → chunk-72p5annm.js} +4 -4
  37. package/dist/chunk-74x6j229.js +4 -0
  38. package/dist/{chunk-n3jw3xpj.js → chunk-75v0yxeh.js} +2 -2
  39. package/dist/chunk-7j11vgm1.js +3 -0
  40. package/dist/chunk-7ngfcdv9.js +2 -0
  41. package/dist/chunk-7njy024g.js +2 -0
  42. package/dist/{chunk-b8z3vepm.js → chunk-88xayf21.js} +9 -9
  43. package/dist/{chunk-w5nw8e2p.js → chunk-95hbmv7k.js} +7 -7
  44. package/dist/{chunk-nack2xs5.js → chunk-976kgb3r.js} +5 -5
  45. package/dist/{chunk-ykapdv6d.js → chunk-9anqwafq.js} +3 -3
  46. package/dist/chunk-9e3ggwk7.js +2 -0
  47. package/dist/chunk-9mz2n39m.js +2 -0
  48. package/dist/chunk-a262spx7.js +2 -0
  49. package/dist/{chunk-xakypz4t.js → chunk-a5yb8w7s.js} +3 -3
  50. package/dist/chunk-a8wn0snv.js +2 -0
  51. package/dist/{chunk-55zq2ha8.js → chunk-ae8q4gze.js} +5 -5
  52. package/dist/{chunk-n56x7jg8.js → chunk-af6m1s2b.js} +1 -1
  53. package/dist/{chunk-hev4t4d5.js → chunk-afxfkb60.js} +6 -6
  54. package/dist/{chunk-kdmwy40c.js → chunk-az5rh7fs.js} +2 -2
  55. package/dist/chunk-b1tcym2x.js +2 -0
  56. package/dist/{chunk-j1efsjsb.js → chunk-b4d4tjvx.js} +5 -5
  57. package/dist/{chunk-pqgc8k6k.js → chunk-b61dq7pz.js} +1 -1
  58. package/dist/{chunk-j89p53vx.js → chunk-bdh73gxd.js} +2 -2
  59. package/dist/{chunk-4068rmzv.js → chunk-bjjfr7qt.js} +2 -2
  60. package/dist/chunk-bs7g6jtt.js +2 -0
  61. package/dist/chunk-bspj1rf1.js +2 -0
  62. package/dist/chunk-bx3hpsxn.js +2 -0
  63. package/dist/chunk-byq488g4.js +2 -0
  64. package/dist/chunk-c8pzj57b.js +2 -0
  65. package/dist/{chunk-79mmzprp.js → chunk-cmh0bfkb.js} +5 -5
  66. package/dist/{chunk-7j0qkye5.js → chunk-d3q0cg47.js} +2 -2
  67. package/dist/{chunk-b666d8m6.js → chunk-d6gqh2wv.js} +1 -1
  68. package/dist/{chunk-vvxcebpn.js → chunk-dbvsa5ya.js} +2 -2
  69. package/dist/{chunk-zt9j94ak.js → chunk-dw0ttj6p.js} +2 -2
  70. package/dist/chunk-e2b2f502.js +2 -0
  71. package/dist/chunk-ec6mrad6.js +2 -0
  72. package/dist/chunk-eh2gec79.js +2 -0
  73. package/dist/{chunk-8hhhmscy.js → chunk-eknm4jrm.js} +2 -2
  74. package/dist/chunk-em31p5pb.js +2 -0
  75. package/dist/chunk-eqfsw6x4.js +2 -0
  76. package/dist/{chunk-4nb7egk0.js → chunk-esjr9qhe.js} +2 -2
  77. package/dist/chunk-ey1vwfpc.js +24 -0
  78. package/dist/{chunk-wk2rge05.js → chunk-f4vgagjb.js} +3 -3
  79. package/dist/chunk-fa57bncd.js +2 -0
  80. package/dist/{chunk-qjey0jk6.js → chunk-fdjx4vs3.js} +2 -2
  81. package/dist/chunk-fk79jbzn.js +2 -0
  82. package/dist/{chunk-pqy58ps0.js → chunk-fnjm3xbf.js} +6 -6
  83. package/dist/{chunk-zfrzdje6.js → chunk-ft6em3wm.js} +6 -6
  84. package/dist/{chunk-bv9dbf4m.js → chunk-fy6ts0n4.js} +2 -2
  85. package/dist/{chunk-hr147ys5.js → chunk-g33ycxe3.js} +5 -5
  86. package/dist/{chunk-p219rr27.js → chunk-g7qpnmbm.js} +14 -14
  87. package/dist/chunk-g97krv0d.js +2 -0
  88. package/dist/chunk-gn16yq49.js +2 -0
  89. package/dist/{chunk-qcxrcypb.js → chunk-gqtb53s8.js} +2 -2
  90. package/dist/chunk-gvs61tqn.js +2 -0
  91. package/dist/chunk-h2928108.js +2 -0
  92. package/dist/chunk-hd5bny2c.js +2 -0
  93. package/dist/chunk-j1ytbd6r.js +1184 -0
  94. package/dist/chunk-jm7qa3v3.js +2 -0
  95. package/dist/chunk-jmjgj3nh.js +2 -0
  96. package/dist/chunk-jqtpzzz4.js +12 -0
  97. package/dist/{chunk-hmdkf6c6.js → chunk-jqxerj6k.js} +2 -2
  98. package/dist/{chunk-3z1mmar2.js → chunk-jt5tzddc.js} +2 -2
  99. package/dist/{chunk-q50x1gfd.js → chunk-k1ew643q.js} +2 -2
  100. package/dist/chunk-kq8mffgf.js +2 -0
  101. package/dist/chunk-kx06jzdw.js +2 -0
  102. package/dist/{chunk-ysfeg3cn.js → chunk-kywe0f1v.js} +2 -2
  103. package/dist/{chunk-60yppcbb.js → chunk-kzc2tqzr.js} +2 -2
  104. package/dist/{chunk-9zrvh3pz.js → chunk-mce3g2wb.js} +2 -2
  105. package/dist/{chunk-bbq79tap.js → chunk-mw0rb1sf.js} +4 -4
  106. package/dist/chunk-n344ss97.js +2 -0
  107. package/dist/chunk-n5pvdrkb.js +2 -0
  108. package/dist/chunk-ne8q191s.js +2 -0
  109. package/dist/{chunk-e7s109j6.js → chunk-nnp6rf4c.js} +1 -1
  110. package/dist/chunk-np8wgbsa.js +3 -0
  111. package/dist/{chunk-tyvm49be.js → chunk-nv4c25zj.js} +3 -3
  112. package/dist/{chunk-xdfmrv49.js → chunk-p4e8myzj.js} +6 -6
  113. package/dist/{chunk-dhbpbjt3.js → chunk-p5m1z6e1.js} +6 -6
  114. package/dist/{chunk-18a3vdnq.js → chunk-pk714ynv.js} +4 -4
  115. package/dist/{chunk-csymxc5a.js → chunk-pp99rmjm.js} +15 -15
  116. package/dist/chunk-pqmjeea6.js +2 -0
  117. package/dist/chunk-q0k2gmva.js +2 -0
  118. package/dist/{chunk-3z4p70t5.js → chunk-q7zc78az.js} +6 -6
  119. package/dist/chunk-qggwr60r.js +2 -0
  120. package/dist/chunk-qm3v4qb7.js +2 -0
  121. package/dist/{chunk-40h07m5w.js → chunk-qnwd5bz4.js} +1 -1
  122. package/dist/chunk-qrn1nza9.js +2 -0
  123. package/dist/chunk-qty0t69x.js +2 -0
  124. package/dist/{chunk-tabkp672.js → chunk-qvrew79n.js} +1 -1
  125. package/dist/{chunk-tnp2ta5q.js → chunk-r09kz9bf.js} +2 -2
  126. package/dist/{chunk-q1wxgw5s.js → chunk-r2bxjna3.js} +2 -2
  127. package/dist/chunk-rzadf7vx.js +20 -0
  128. package/dist/{chunk-6vgr5g6d.js → chunk-rzd9hyhv.js} +2 -2
  129. package/dist/{chunk-8tk8yf91.js → chunk-s7fhpkvf.js} +6 -6
  130. package/dist/{chunk-ew5cey88.js → chunk-saqzk45g.js} +1 -1
  131. package/dist/{chunk-srgnevws.js → chunk-stn7p7f1.js} +2 -2
  132. package/dist/{chunk-bast33qy.js → chunk-t4g3ka8c.js} +6 -6
  133. package/dist/chunk-ts37jw3s.js +2 -0
  134. package/dist/{chunk-cqhwzd9y.js → chunk-v0tdg16k.js} +5 -5
  135. package/dist/{chunk-0k11nsv1.js → chunk-vmssv78v.js} +3 -3
  136. package/dist/{chunk-ymdw4fhd.js → chunk-vnrbjbrw.js} +2 -2
  137. package/dist/{chunk-ttm0gvrc.js → chunk-vznf808n.js} +5 -5
  138. package/dist/chunk-wkb7dhp7.js +2 -0
  139. package/dist/{chunk-m131znxe.js → chunk-wm029dh0.js} +13 -13
  140. package/dist/{chunk-hhbt8grm.js → chunk-wp0qpa50.js} +4 -4
  141. package/dist/chunk-wxyqp6g9.js +2 -0
  142. package/dist/{chunk-01c16zw4.js → chunk-wzvdr4ta.js} +2 -2
  143. package/dist/{chunk-e2t7mk29.js → chunk-x2ftkaz3.js} +2 -2
  144. package/dist/chunk-x76qvq1n.js +2 -0
  145. package/dist/{chunk-v37zmez0.js → chunk-xmws1gaf.js} +2 -2
  146. package/dist/{chunk-a8164hnf.js → chunk-xtaq95em.js} +1 -1
  147. package/dist/{chunk-5a0d3048.js → chunk-y2e2zm6y.js} +3 -3
  148. package/dist/chunk-y4hn1qh0.js +2 -0
  149. package/dist/{chunk-pywz8q4k.js → chunk-y75bds1g.js} +31 -31
  150. package/dist/chunk-yc8ggeh2.js +2 -0
  151. package/dist/{chunk-r0v2chpn.js → chunk-ydppkb8y.js} +2 -2
  152. package/dist/chunk-ydy0tfar.js +2 -0
  153. package/dist/chunk-yfed67yc.js +2 -0
  154. package/dist/{chunk-7ayvybdy.js → chunk-ysfgabpf.js} +3 -3
  155. package/dist/{chunk-fd1bpv35.js → chunk-yxdhz4ps.js} +2 -2
  156. package/dist/{chunk-rw5492e2.js → chunk-zc8a2erc.js} +4 -4
  157. package/dist/{chunk-7cvbz4eq.js → chunk-zn6n075d.js} +3 -3
  158. package/dist/cli.js +22 -22
  159. package/dist/component-library.d.ts +31 -1
  160. package/dist/component-library.js +74 -54
  161. package/dist/craft-entry.js +2 -2
  162. package/dist/craft.js +2 -2
  163. package/dist/inherited-context.d.ts +14 -0
  164. package/dist/inherited-context.js +102 -0
  165. package/dist/native-component-context.d.ts +10 -0
  166. package/dist/native-component-context.js +94 -0
  167. package/dist/pwa.js +3 -3
  168. package/dist/ssg.js +12 -12
  169. package/dist/stx-virtual-ts.d.ts +14 -2
  170. package/dist/stx-virtual-ts.js +64 -34
  171. package/dist/typecheck.d.ts +5 -2
  172. package/dist/typecheck.js +29 -19
  173. package/package.json +5 -5
  174. package/dist/chunk-09jz09k9.js +0 -20
  175. package/dist/chunk-10h8v5d4.js +0 -2
  176. package/dist/chunk-19dsn6tp.js +0 -2
  177. package/dist/chunk-26vxgd2w.js +0 -2
  178. package/dist/chunk-277dpq3b.js +0 -2
  179. package/dist/chunk-2asyyky3.js +0 -2
  180. package/dist/chunk-2r9s38f6.js +0 -2
  181. package/dist/chunk-2xhwadvn.js +0 -2
  182. package/dist/chunk-46pxmpeb.js +0 -3
  183. package/dist/chunk-4es07dwb.js +0 -2
  184. package/dist/chunk-4pr29yrx.js +0 -2
  185. package/dist/chunk-4v70bs2q.js +0 -2
  186. package/dist/chunk-4ygesqbx.js +0 -2
  187. package/dist/chunk-54jx5hqh.js +0 -2
  188. package/dist/chunk-5nj2k8zf.js +0 -2
  189. package/dist/chunk-6pczzq5f.js +0 -2
  190. package/dist/chunk-73k579v7.js +0 -2
  191. package/dist/chunk-7c9pzpsw.js +0 -2
  192. package/dist/chunk-7etvn4dx.js +0 -2
  193. package/dist/chunk-7wqevtks.js +0 -2
  194. package/dist/chunk-93538x9s.js +0 -2
  195. package/dist/chunk-9fyw1xkh.js +0 -3
  196. package/dist/chunk-9waxasf6.js +0 -712
  197. package/dist/chunk-a5qxcz86.js +0 -4
  198. package/dist/chunk-asrzmw7w.js +0 -2
  199. package/dist/chunk-awmfyb3t.js +0 -2
  200. package/dist/chunk-ba91r7q9.js +0 -2
  201. package/dist/chunk-cvgbtmxp.js +0 -2
  202. package/dist/chunk-d0h18m2r.js +0 -2
  203. package/dist/chunk-d5zh2663.js +0 -2
  204. package/dist/chunk-djdganvr.js +0 -2
  205. package/dist/chunk-dmcmxf3a.js +0 -2
  206. package/dist/chunk-eczy00w6.js +0 -2
  207. package/dist/chunk-esb34a1r.js +0 -20
  208. package/dist/chunk-f4wezqh4.js +0 -2
  209. package/dist/chunk-f52b9hjv.js +0 -2
  210. package/dist/chunk-f8pp58kw.js +0 -2
  211. package/dist/chunk-g3tfct27.js +0 -2
  212. package/dist/chunk-g9m84nqk.js +0 -2
  213. package/dist/chunk-gc4bgven.js +0 -2
  214. package/dist/chunk-gvh45ddc.js +0 -2
  215. package/dist/chunk-gvz0kqkz.js +0 -2
  216. package/dist/chunk-h2qgqjkn.js +0 -2
  217. package/dist/chunk-hcaedzck.js +0 -2
  218. package/dist/chunk-j4zrq17p.js +0 -2
  219. package/dist/chunk-kz0txvqb.js +0 -2
  220. package/dist/chunk-m9cperj4.js +0 -2
  221. package/dist/chunk-me7cxs0e.js +0 -2
  222. package/dist/chunk-meqsd5bt.js +0 -2
  223. package/dist/chunk-p2kqsb5k.js +0 -2
  224. package/dist/chunk-pvrgv5cx.js +0 -2051
  225. package/dist/chunk-rqa92xm4.js +0 -2
  226. package/dist/chunk-s54e61xt.js +0 -2
  227. package/dist/chunk-s92j8k4z.js +0 -2
  228. package/dist/chunk-sw8ms82g.js +0 -2
  229. package/dist/chunk-swfvh1cz.js +0 -3
  230. package/dist/chunk-tp2ftck2.js +0 -2
  231. package/dist/chunk-vd679g2w.js +0 -2
  232. package/dist/chunk-vk98r75z.js +0 -2
  233. package/dist/chunk-vmq773pb.js +0 -2
  234. package/dist/chunk-vv65gsys.js +0 -2
  235. package/dist/chunk-w6ry02z8.js +0 -2
  236. package/dist/chunk-w8qr5414.js +0 -2
  237. package/dist/chunk-xjxcwrqs.js +0 -2
  238. package/dist/chunk-xye2mkbh.js +0 -2
  239. package/dist/chunk-ytzzth34.js +0 -2
  240. package/dist/chunk-yxpjj003.js +0 -2
  241. package/dist/chunk-z6c4c951.js +0 -2
  242. package/dist/chunk-z9xe3xkg.js +0 -12
  243. package/dist/chunk-zmfqx1b1.js +0 -2
  244. package/dist/chunk-zze8tw0h.js +0 -2
@@ -1,712 +0,0 @@
1
- // @bun
2
- import{qe,$n,Zs,Ii,B}from"./chunk-60yppcbb.js";import{Tn}from"./chunk-atpscb2m.js";import{Fr,C,_l,ft,Fi,Cl}from"./chunk-qjey0jk6.js";import{N}from"./chunk-farh4p7f.js";import{P,E,Qs,d,m,Ut,p,Z,W,k,ro,Re,Xe,so}from"./chunk-csymxc5a.js";import{r,Y}from"./chunk-z9xe3xkg.js";import{b}from"./chunk-94mpe1ny.js";import{Q}from"./chunk-9fyw1xkh.js";import{c}from"./chunk-fd1bpv35.js";import ut from"path";import Vt from"process";import{AsyncLocalStorage as ma}from"async_hooks";var Dr=new ma;function xn(e){return e.__stx_server_data??={pending:new Map,values:new Map}}function Mr(e,t){return Dr.run(xn(e),t)}async function jr(e,t){let n=Dr.getStore();if(!n)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 i=n.pending.get(e);if(i)return i;let a=Promise.resolve().then(t).then((u)=>{let l=JSON.stringify(u,(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(l);return n.values.set(e,f),f}).catch((u)=>{throw n.pending.delete(e),u});return n.pending.set(e,a),a}function Pr(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 n=r(e),i=[],a=new Set,u=0,l=0,f=n.length,x=()=>{if(u!==0)return;let v=n.slice(l).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))i.push(z),a.add(z);return}let A=n.slice(l).match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(A){if(t&&n.slice(l).startsWith("const"))return;A[1].split(",").forEach((z)=>{let V=z.trim();if(!V)return;let F=V.indexOf(":"),H=(F>=0?V.slice(F+1).trim():V).split(/[\s=]/)[0];if(H&&!a.has(H))i.push(H),a.add(H)});return}let D=n.slice(l).match(/^(?:const|let|var)\s+\[([^\]]+)\]\s*=/);if(D){if(t&&n.slice(l).startsWith("const"))return;D[1].split(",").forEach((z)=>{let V=z.trim().replace(/^\.\.\./,"");if(!V)return;let F=V.split(/[\s=]/)[0];if(F&&!a.has(F))i.push(F),a.add(F)});return}if(t)return;let U=n.slice(l).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(U){let z=U[1];if(!a.has(z))i.push(z),a.add(z);return}let O=n.slice(l).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(O){let z=O[1];if(!a.has(z))i.push(z),a.add(z)}};while(l<f){if(n[l]==="{"){u++,l++;continue}if(n[l]==="}"){u--,l++;continue}if(u===0&&/[a-z]/i.test(n[l])&&(l===0||/\s|[;{}()]/.test(n[l-1])))x();l++}return i.join(", ")}function js(e){return`{ enumerable: true, configurable: true, get() { return ${e} }, set(__stxValue_${e}) { ${e} = __stxValue_${e} } }`}function ha(e,t=K(e).split(",").map((n)=>n.trim()).filter(Boolean)){let n=new Set(K(e,!0).split(",").map((i)=>i.trim()));return t.map((i)=>n.has(i)?`get ${i}() { return ${i} }, set ${i}(__stxValue_${i}) { ${i} = __stxValue_${i} }`:i).join(", ")}function Bs(e,t){let n=`{ ${ha(e,t)} }`;return K(e).split(",").some((i)=>i.trim()==="__stxLiveBindings")?`Object.defineProperties(${n}, Object.getOwnPropertyDescriptors(__stxLiveBindings))`:n}import Ot from"fs";import ve from"path";function X(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}var Nr=new Map;function _r(e,t=!0){let n=Nr.get(e);if(t&&n)return n;let i=new Map,a=[ve.join(e,"src"),ve.join(e,"dist"),e];function u(l,f){if(f>6)return;let x;try{x=Ot.readdirSync(l,{withFileTypes:!0})}catch{return}for(let v of x){let A=ve.join(l,v.name);if(v.isDirectory()){if(v.name==="node_modules"||v.name.startsWith("."))continue;u(A,f+1)}else if(v.isFile()&&v.name.endsWith(".stx")){let D=v.name.slice(0,-4);if(!i.has(D))i.set(D,A);let U=D.toLowerCase();if(!i.has(U))i.set(U,A);let O=X(D);if(!i.has(O))i.set(O,A)}}}for(let l of a)if(u(l,0),i.size>0)break;if(t)Nr.set(e,i);return i}function Fs(e,t){if(e.startsWith(".")||e.startsWith("/"))return null;let n=t;while(!0){let i=ve.join(n,"node_modules",e);try{if(Ot.statSync(i).isDirectory())return i}catch{}let a=ve.dirname(n);if(a===n)return null;n=a}}function zs(e,t,n={}){return[ve.resolve(ve.dirname(t),`${e}.stx`),ve.resolve(ve.dirname(t),e),ve.resolve(n.componentsDir||"components",`${e}.stx`),ve.resolve(n.componentsDir||"components",e),e.endsWith(".stx")?e:`${e}.stx`]}function Lr(e){let t=e.endsWith(".stx")?e.slice(0,-4):e,n=t.split("-").map((a)=>a.charAt(0).toUpperCase()+a.slice(1)).join(""),i=X(t);return[t,n,i]}function fi(e,t){let[n,i,a]=Lr(e);for(let u of[n,n.toLowerCase(),i,a]){let l=t?.__importedComponents?.get(u);if(l!==void 0)return l}}function gi(e,t){let n=t?ve.resolve(t):void 0,i=ve.dirname(ve.resolve(e));for(;;){if(Ot.existsSync(ve.join(i,"package.json")))return n&&i===n?void 0:i;let a=ve.dirname(i);if(a===i)return;i=a}}var xa=["src/ui","src/components","components","dist"];function zn(e,t){let n=ve.resolve(e);if(!t&&!n.split(ve.sep).includes("node_modules"))return[];let i=gi(n,t);if(!i)return[];let a=[];try{let f=JSON.parse(Ot.readFileSync(ve.join(i,"package.json"),"utf8")).stx?.components;if(Array.isArray(f))a=f.filter((x)=>typeof x==="string")}catch{}let u=a.length?a:xa;return[ve.dirname(ve.resolve(e)),...u.map((l)=>ve.resolve(i,l))]}function*mi(e,t,n={},i){let a=Lr(e);if(a[0].startsWith("./")||a[0].startsWith("../")){yield ve.resolve(ve.dirname(t),`${a[0]}.stx`);return}let u=[...new Set(a.map((x)=>`${x}.stx`))],l=n.projectRoot||process.cwd(),f=[...zn(t,n.projectRoot),...i?.__originalFilePath?[ve.join(ve.dirname(i.__originalFilePath),"components")]:[],...n.componentsDir?[n.componentsDir]:[],ve.join(ve.dirname(t),"components"),ve.resolve(l,"src/components"),ve.resolve(l,"components"),...import.meta.dir?[ve.resolve(import.meta.dir,"components")]:[]];for(let x of new Set(f)){for(let v of u)yield ve.join(x,v);try{for(let v of Ot.readdirSync(x,{withFileTypes:!0}))if(v.isDirectory())for(let A of u)yield ve.join(x,v.name,A)}catch{}}}function zr(e,t,n={},i){let a=fi(e,i);if(a!==void 0)return a;for(let u of mi(e,t,n,i))try{if(Ot.statSync(u,{throwIfNoEntry:!1})?.isFile())return u}catch{}return null}function Hs(e,t=[],n={}){let i=new Set([...e].map((v)=>v.replace(/[-_]/g,"").toLowerCase()));if(!i.has("src")&&!i.has("source")||!i.has("alt")&&!i.has("decorative"))return!1;let a=new Map(Object.entries(n).map(([v,A])=>[v.replace(/[-_]/g,"").toLowerCase(),A])),u=a.get("alt"),l=a.get("decorative"),f=typeof u==="string"&&!!u.trim(),x=typeof l==="string"?!["false","0","off","no"].includes(l.trim().toLowerCase()):Boolean(l);if(!f&&!x)return!1;if(["defaultsource","provider","format","densities","quality","preload","modifiers","preset"].some((v)=>i.has(v)))return!1;if([...t].some((v)=>!["load","error"].includes(v.replace(/^@/,"").split(".")[0].toLowerCase())))return!1;if(i.has("resizemode")&&(i.has("fit")||i.has("objectfit")))return!1;if(i.has("src")&&i.has("source"))return!1;return["fit","objectfit","resizemode","position","objectposition","rounded","aspectratio","zoomonhover","sources","webpsrc","webpsrcset"].some((v)=>i.has(v))}import is from"fs";import ue from"path";import Et from"path";import sn from"fs";var ba=new Set(["touchstart","touchmove","wheel","mousewheel"]);function ys(e,t){if(t.passive)return!0;if(t.prevent||t.nonpassive)return!1;return ba.has(e.toLowerCase())}var Br=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"]),Wr={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"},ya=new Set(["ctrl","alt","shift","meta"]),Hr={left:0,middle:1,right:2};function Vr(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 n of e){let i=n.toLowerCase();if(i==="prevent")t.prevent=!0;else if(i==="stop")t.stop=!0;else if(i==="once")t.once=!0;else if(i==="capture")t.capture=!0;else if(i==="self")t.self=!0;else if(i==="passive")t.passive=!0;else if(i==="nonpassive")t.nonpassive=!0;else if(ya.has(i))t.systemKeys.push(i);else if(i in Hr)t.mouse=i;else if(i in Wr||/^[a-z]$/.test(i))t.keys.push(Wr[i]||i.toUpperCase());else if(i.startsWith("debounce")){let a=i.match(/debounce(?:\.(\d+))?/);t.debounce=a?.[1]?Number.parseInt(a[1],10):300}else if(i.startsWith("throttle")){let a=i.match(/throttle(?:\.(\d+))?/);t.throttle=a?.[1]?Number.parseInt(a[1],10):300}}return t}function qr(e,t=""){let n=[],i=0,a=/<([a-z][a-z0-9-]*)\s+([^>]*@[a-z][^>]*)>/gi,u;while((u=a.exec(e))!==null){let[l,f,x]=u,v=u.index,A=v+l.length,D=`__stx_evt_${t}${i++}`,U=[],O=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,z;while((z=O.exec(x))!==null){let[,F,q]=z,H=F.split("."),M=H[0];if(!Br.has(M))continue;U.push({attribute:`@${F}`,event:M,handler:q,modifiers:Vr(H.slice(1)),elementId:D})}let V=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((z=V.exec(x))!==null){let[,F,q]=z,H=F.split("."),M=H[0];if(!Br.has(M))continue;U.push({attribute:`@${F}`,event:M,handler:q,modifiers:Vr(H.slice(1)),elementId:D})}if(U.length>0)n.push({originalTag:l,elementId:D,events:U,startIndex:v,endIndex:A})}return n}function _a(e){let t=[],{modifiers:n}=e;if(n.self)t.push("if ($event.target !== $el) return");for(let i of n.systemKeys)t.push(`if (!$event.${i}Key) return`);if(n.keys.length>0){let i=n.keys.map((a)=>`$event.key === '${a}'`).join(" || ");t.push(`if (!(${i})) return`)}if(n.mouse!==null){let i=Hr[n.mouse];t.push(`if ($event.button !== ${i}) return`)}if(n.prevent)t.push("$event.preventDefault()");if(n.stop)t.push("$event.stopPropagation()");return t.join("; ")}function wa(e,t){let n=e;if(t.debounce!==null)n=`__stx_debounce(() => { ${n} }, ${t.debounce})`;else if(t.throttle!==null)n=`__stx_throttle(() => { ${n} }, ${t.throttle})`;return n}function _s(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 Sa(e){let{modifiers:t}=e,n=e.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),i=_a(e),a=wa(_s(e.handler),t),u=[];if(t.once)u.push("once: true");if(t.capture)u.push("capture: true");if(ys(e.event,t))u.push("passive: true");let l=u.length>0?`, { ${u.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('${n}');
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('${n}');
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('${n}');
42
- if (!$el) return;
43
- // eslint-disable-next-line pickier/no-unused-vars
44
- $el.addEventListener('${e.event}', function($event) {
45
- ${i?i+";":""}
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
- }${l});
56
- })();`}function hi(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(Sa).join(`
112
- `)}
113
- })();
114
- </script>`}function $a(e,t=""){let n=qr(e,t);if(n.length===0)return{template:e,bindings:[]};let i=e,a=[];for(let u=n.length-1;u>=0;u--){let l=n[u],f=l.originalTag;if(!f.includes(" id="))f=f.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${l.elementId}"`);else{let x=f.match(/id=["']([^"']+)["']/);if(x)for(let v of l.events)v.elementId=x[1]}for(let x of l.events){let v=x.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),A=new RegExp(`\\s*${v}\\s*=\\s*"[^"]*"`,"g"),D=new RegExp(`\\s*${v}\\s*=\\s*'[^']*'`,"g");f=f.replace(A,""),f=f.replace(D,"")}i=i.slice(0,l.startIndex)+f+i.slice(l.endIndex),a.push(...l.events)}return{template:i,bindings:a}}function Ur(e){let t=e.$uid;return typeof t==="string"&&t?`${t}_`:""}function Hc(e,t,n){if(Cl(e))return e;if(t.__stx_sfc_mode){if(/x-data\s*=\s*["']/.test(e))return e;let{template:f,bindings:x}=$a(e,Ur(t)),v=t.__stx_event_bindings||[];return t.__stx_event_bindings=[...v,...x],f}let i=qr(e,Ur(t));if(i.length===0)return e;let a=e;for(let f=i.length-1;f>=0;f--){let x=i[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 D of x.events)D.elementId=A[1]}for(let A of x.events){let D=A.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),U=new RegExp(`\\s*${D}\\s*=\\s*"[^"]*"`,"g"),O=new RegExp(`\\s*${D}\\s*=\\s*'[^']*'`,"g");v=v.replace(U,""),v=v.replace(O,"")}a=a.slice(0,x.startIndex)+v+a.slice(x.endIndex)}let u=hi(i.flatMap((f)=>f.events)),l=c(a);if(l!==-1)a=a.slice(0,l)+u+`
115
- `+a.slice(l);else a+=u;return a}function Zr(e,t){let n=new Set;for(let i of e.split(",")){let a=i.trim().replace(/^\.\.\./,"").trim();if(!a)continue;if(t){let u=a.lastIndexOf(":");if(u!==-1)a=a.slice(u+1).trim()}if(a=a.split("=")[0].trim(),/^[A-Za-z_$][\w$]*$/.test(a))n.add(a)}return n}function Dt(e,t){let n=r(e),{depths:i,balanced:a}=Y(n),u=(f)=>!a||i[f]===0,l=new RegExp(`(?:^|[^\\w$.])((?:const|let|var|function|class)\\s+${t}\\b)`,"g");for(let f of n.matchAll(l)){let x=(f.index??0)+f[0].length-f[1].length;if(u(x))return!0}for(let f of n.matchAll(/(?:const|let|var)\s*\{([^}]*)\}/g))if(u(f.index??0)&&Zr(f[1],!0).has(t))return!0;for(let f of n.matchAll(/(?:const|let|var)\s*\[([^\]]*)\]/g))if(u(f.index??0)&&Zr(f[1],!1).has(t))return!0;return!1}var Kr=new P(32,{maxBytes:2097152,sizeOf:(e)=>e.code.length*4}),wt=/^[A-Za-z_$][\w$]*$/,va=new Set(["if","for","while","switch","with"]),Xr=["(","[","{"],Jr=[")","]","}"],Ea=new Set(["const","let","var","return","if","for","while","do","switch","try","throw","export"]);function ka(e){let t=r(e),n=[];for(let i of t.matchAll(/[A-Za-z_$][\w$]*|=>|\.\.\.|[^\s]/g)){let a=i.index??0;n.push({text:i[0],start:a,end:a+i[0].length})}return{code:t,tokens:n}}function ws(e){let t=Kr.get(e);if(t)return t;let{code:n,tokens:i}=ka(e),a=new Map,u=[];for(let F=0;F<i.length;F++){let q=i[F].text;if(["(","[","{"].includes(q))u.push(F);else if([")","]","}"].includes(q)){let H=u.at(-1);if(H!==void 0&&["()","[]","{}"].includes(i[H].text+q))u.pop(),a.set(H,F),a.set(F,H)}}function l(F,q){let H=[],M=F;for(let ee=F;ee<q;ee++){if(["(","[","{"].includes(i[ee].text)&&(a.get(ee)??q)<q){ee=a.get(ee);continue}if(i[ee].text===",")H.push([M,ee]),M=ee+1}return H.push([M,q]),H}let f=[];function x(F,q,H,M=!1){if(i[F]?.text==="...")F++;if(F>=q)return;let ee=i[F].text;if(wt.test(ee)){if(H.add(ee),H===D)f.push({name:ee,token:F,functionScoped:M});return}if(ee!=="{"&&ee!=="[")return;let oe=a.get(F);if(oe===void 0||oe>=q)return;for(let[ie,ge]of l(F+1,oe)){let ye=ie;if(ee==="{")for(let me=ie;me<ge;me++){if(i[me].text===":"){ye=me+1;break}if(i[me].text==="=")break;if(["(","[","{"].includes(i[me].text)&&a.has(me))me=a.get(me)}x(ye,ge,H,M)}}function v(F,q){let H=new Set;for(let[M,ee]of l(F,q))x(M,ee,H);return H}function A(F){let q=F;for(;q<i.length;q++){let H=i[q].text;if(["(","[","{"].includes(H)&&a.has(q)){q=a.get(q);continue}if([",",";",")","]","}"].includes(H))break}return i[Math.max(F,q-1)]?.end??n.length}let D=new Set,U=[];for(let F=0;F<i.length;F++)if(i[F].text==="=>"){let q=F-1,H=q,M;if(i[q]?.text===")"&&a.has(q))H=a.get(q),M=v(H+1,q);else if(i[q]&&wt.test(i[q].text))M=new Set([i[q].text]);else continue;let ee=F+1,oe=i[ee]?.text==="{"&&a.has(ee)?i[a.get(ee)].end:A(ee);U.push({start:i[H].start,end:oe,bodyStart:i[ee]?.start??oe,functionBody:!0,names:M})}else if(i[F].text==="("&&a.has(F)){let q=i[F-1]?.text;if(!q||va.has(q)||!wt.test(q)&&q!=="*"&&q!=="]")continue;let H=a.get(F),M=H+1;if(i[M]?.text===":"){M++;while(M<i.length&&!["{","=>",";","="].includes(i[M].text))M++}if(i[M]?.text!=="{"||!a.has(M))continue;U.push({start:i[F].start,end:i[a.get(M)].end,bodyStart:i[M].start,functionBody:q!=="catch",names:v(F+1,H)})}function O(F){let q=F;for(;q<i.length;q++){let H=i[q].text;if(Xr.includes(H)&&a.has(q)){q=a.get(q);continue}if(H===";"||Jr.includes(H))break;let M=i[q-1];if(q>F&&Ea.has(H)&&M.text!==".")break;if(q>F&&/[\n\r]/.test(n.slice(M.end,i[q].start))&&(/^[\w$]+$/.test(M.text)||Jr.includes(M.text)||['"',"'","`"].includes(M.text))&&wt.test(H)&&!["in","of","instanceof"].includes(H))break}return q}let z=[];for(let F=0;F<i.length;F++){if(i[F].text!=="for")continue;let q=i[F+1]?.text==="await"?F+2:F+1;if(i[q]?.text!=="("||!a.has(q))continue;let H=a.get(q),M=H+1,ee=i[M]?.text==="{"&&a.has(M)?a.get(M):O(M),oe=i[ee]?.text===";"||i[ee]?.text==="}"?i[ee].end:i[Math.max(M,ee-1)]?.end??n.length;z.push({headStart:q,headEnd:H,start:i[q].start,end:oe})}for(let F=0;F<i.length;F++){let q=i[F].text,H=i[F-1]?.text;if(H==="."||i[F+1]?.text===":")continue;if(H==="as"||H==="<")continue;if(q==="const"||q==="let"||q==="var"){let M=O(F+1),ee=F+1,oe=!1,ie=!1,ge=0;for(let ye=F+1;ye<=M;ye++){let me=i[ye]?.text;if(ye<M&&Xr.includes(me)&&a.has(ye)&&a.get(ye)<M){ye=a.get(ye);continue}if(ye<M&&me===":"&&!ie)oe=!0;else if(ye<M&&me==="="&&ge===0)oe=!1,ie=!0;else if(ye<M&&oe&&me==="<")ge++;else if(ye<M&&oe&&me===">"&&ge>0)ge--;else if(ye===M||me===","&&ge===0)x(ee,ye,D,q==="var"),ee=ye+1,oe=!1,ie=!1}}else if(q==="function"||q==="class"){let M=F+1;if(i[M]?.text==="*")M++;if(i[M]&&wt.test(i[M].text)&&i[M].text!=="extends")D.add(i[M].text),f.push({name:i[M].text,token:M})}else if(q==="import"){let M=F+1;if(i[M]?.text==="*"&&i[M+1]?.text==="as")M+=2;let ee=i[M]?.text;if(ee&&wt.test(ee)&&ee!=="type"&&i[M+1]?.text!=="("&&i[M+1]?.text!==".")D.add(ee),f.push({name:ee,token:M,file:!0});let oe=i[M]?.text==="{"?M:i[M+1]?.text===","&&i[M+2]?.text==="{"?M+2:-1;if(oe!==-1&&a.has(oe)){let ie=a.get(oe);for(let[ge,ye]of l(oe+1,ie)){let me=ye-1;while(me>=ge&&!wt.test(i[me].text))me--;if(me>=ge&&i[me].text!=="type")f.push({name:i[me].text,token:me,file:!0})}}}}let V={code:n,scopes:U,loops:z,declarations:D,sites:f,tokens:i,pairs:a};return Kr.set(e,V),V}function nn(e){let t=ws(e);return{code:t.code,shadows:(n,i)=>t.scopes.some((a)=>i>=a.start&&i<a.end&&a.names.has(n))}}function Bn(e){return new Set(ws(e).declarations)}function Le(e,t){let{scopes:n,loops:i,sites:a,tokens:u,pairs:l}=ws(e),f=Array.from({length:u.length},()=>-1),x=[];for(let O=0;O<u.length;O++){f[O]=x.length?x[x.length-1]:-1;let z=u[O].text;if(z==="{"&&l.has(O))x.push(O);else if(z==="}"&&x.length&&l.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],V=z===-1?[0,Number.POSITIVE_INFINITY]:[u[z].start,u[l.get(z)].end];if(O.functionScoped){let q=u[O.token].start,H=n.filter((M)=>M.functionBody&&q>=M.bodyStart&&q<M.end).sort((M,ee)=>M.end-M.bodyStart-(ee.end-ee.bodyStart))[0];V=H?[H.bodyStart,H.end]:[0,Number.POSITIVE_INFINITY]}else if(!O.file){let q=i.filter((H)=>O.token>H.headStart&&O.token<H.headEnd).sort((H,M)=>H.headEnd-H.headStart-(M.headEnd-M.headStart))[0];if(q)V=[q.start,q.end]}let F=A.get(O.name);if(F)F.push(V);else A.set(O.name,[V])}let D=new Set;for(let O=0;O<u.length;O++){if(u[O].text!=="import"||u[O-1]?.text===".")continue;let z=O+1;if(u[z]?.text==="type")z++;if(u[z]&&wt.test(u[z].text)&&u[z+1]?.text===",")z+=2;if(u[z]?.text==="{"&&l.has(z))for(let V=z+1;V<l.get(z);V++)D.add(V)}let U=new Set;for(let O=0;O<u.length;O++){let z=u[O].text;if(!t.has(z)||U.has(z)||v.has(O)||D.has(O))continue;let V=u[O-1]?.text;if(V==="#"||V==="."&&u[O-2]?.text!=="..")continue;if(u[O+1]?.text===":"&&(V==="{"||V===","))continue;let F=u[O].start;if(A.get(z)?.some(([q,H])=>F>=q&&F<H))continue;if(n.some((q)=>F>=q.start&&F<q.end&&q.names.has(z)))continue;U.add(z)}return U}var Me="0.2.874";var Gr=Symbol.for(`stx.lazy-module-promises.${Me}`);function Ra(){let e=globalThis;return e[Gr]??=new Map,e[Gr]}function o(e,t){let n=Ra(),i=`${import.meta.url}\x00${e}`,a=n.get(i);if(a)return a;let u=t();return n.set(i,u),u.catch(()=>{if(n.get(i)===u)n.delete(i)}),u}var Ta=/<\/(script)/gi;function pe(e){if(!e||e.indexOf("</")===-1)return e;return e.replace(Ta,"<\\/$1")}import Yr from"fs";var Qr=[];function S(e){let t=new P(e);return Qr.push(t),t}function Vc(){for(let e of Qr)e.clear()}function _(e,...t){return`${t.map((n)=>String(n??"")).join("\x00")}\x00${e.length}\x00${Bun.hash(e)}`}function Cr(e){let t=[];for(let n of new Set(e))try{t.push({path:n,mtimeMs:Yr.statSync(n).mtimeMs})}catch{}return t}function Vs(e){for(let t of e)try{if(Yr.statSync(t.path).mtimeMs!==t.mtimeMs)return!1}catch{return!1}return!0}var Ee=["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 Aa=/^[ \t]*import\s+['"]([^'"]+?\.css)(\?[^'"]*)?['"]\s*;?\s*$/gm;function Ia(e){if(e.startsWith(".")||e.startsWith("/"))return null;if(e.startsWith("@")){let n=e.match(/^(@[^/]+\/[^/]+)(\/.*)?$/);if(!n)return null;return{pkg:n[1],subpath:n[2]||""}}let t=e.match(/^([^/]+)(\/.*)?$/);if(!t)return null;return{pkg:t[1],subpath:t[2]||""}}function Pa(e,t){let n=t;while(!0){let i=Et.join(n,"node_modules",e,"package.json");if(sn.existsSync(i))return Et.dirname(i);let a=Et.dirname(n);if(a===n)return null;n=a}}function Oa(e,t){if(!e||typeof e!=="object")return null;let n=(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 n(a.import);if(typeof a.default==="object")return n(a.default)}return null};if(Object.prototype.hasOwnProperty.call(e,t))return n(e[t]);let i=null;for(let a of Object.keys(e)){let u=a.indexOf("*");if(u===-1)continue;let l=a.slice(0,u),f=a.slice(u+1);if(!t.startsWith(l)||!t.endsWith(f))continue;if(t.length<l.length+f.length)continue;if(!i||l.length>i.prefix.length)i={pattern:a,prefix:l,suffix:f}}if(i){let a=t.slice(i.prefix.length,t.length-i.suffix.length),u=n(e[i.pattern]);if(u)return u.replace("*",a)}return null}function Da(e,t){let n=Ia(e);if(!n||!n.subpath)return null;let i=Pa(n.pkg,t);if(!i)return null;let a;try{a=JSON.parse(sn.readFileSync(Et.join(i,"package.json"),"utf8"))}catch{return null}let u=`.${n.subpath}`,l=Oa(a.exports,u);if(!l)return null;let f=Et.resolve(i,l);return sn.existsSync(f)?f:null}function Ci(e,t){let n=t.filePath?Et.dirname(t.filePath):t.projectRoot||process.cwd(),i=t.projectRoot||process.cwd(),a=new Set,u=[],l=[];return{code:e.replace(Aa,(x,v)=>{let A;try{if(v.startsWith("./")||v.startsWith("../")||v.startsWith("/")){if(A=v.startsWith("/")?v:Et.resolve(n,v),!sn.existsSync(A))throw Error(`file not found: ${A}`)}else{let D=null;try{D=Bun.resolveSync(v,i)}catch{D=Da(v,i)}if(!D)throw Error(`could not resolve ${v} (Bun.resolveSync + exports fallback both failed)`);A=D}}catch(D){return console.warn(`[stx:vendor-css] could not resolve ${JSON.stringify(v)} (from ${t.filePath||"<unknown>"}): ${D?.message||D}`),l.push(v),""}if(a.has(A))return"";a.add(A);try{let D=sn.readFileSync(A,"utf8");u.push({source:v,resolvedPath:A,contents:D})}catch(D){console.warn(`[stx:vendor-css] could not read ${A}: ${D?.message||D}`),l.push(v)}return""}),styles:u,unresolved:l}}function Ma(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Ei(e){if(e.length===0)return"";return`${e.map((t)=>`<style data-stx-vendor="${Ma(t.source)}" data-stx-layer="vendor">
116
- @layer vendor {
117
- ${t.contents}
118
- }
119
- </style>`).join(`
120
- `)}
121
- `}var Sg=C,ei=S(256);function zt(e){let t=_(e),n=ei.get(t);if(!n)n=ja(e),ei.set(t,n);return{code:n.code,imports:[...n.imports],models:[...n.models]}}function ja(e){let t=r(e),n=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)n.add(v)}let i=Bn(t),a=Ee.filter((f)=>{if(n.has(f)||i.has(f))return!1;return kg(t,f,!0)}),u=ri(t).filter((f)=>!n.has(f)&&!i.has(f));if(a.length===0&&u.length===0)return{code:e,imports:a,models:u};return{code:`${[a.length>0?`import { ${a.join(", ")} } from '@stacksjs/browser'`:"",u.length>0?"import '@stacksjs/browser'":"",u.length>0?`const { ${u.join(", ")} } = window.StacksBrowser || {}`:""].filter(Boolean).join(`
122
- `)}
123
- ${e}`,imports:a,models:u}}var Na=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 ri(e,t=nn(e)){let n=new Set,i=Bn(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 u of t.code.matchAll(a)){let l=u[1];if(Na.has(l)||i.has(l)||l.length<3)continue;if(t.shadows(l,u.index??0))continue;n.add(l)}return Array.from(n)}function La(e){return Bn(e)}var ti=S(128);function al(e){let t=_(e),n=ti.get(t);if(!n)n=za(e),ti.set(t,n);return{code:n.code,stxImports:[...n.stxImports],browserImports:[...n.browserImports]}}function za(e){let t=new Set,n=new Set,i=e;i=i.replace(/^[ \t]*import\s+type\s+\{[^}]*\}\s+from\s+['"][^'"]+['"][ \t]*;?[ \t]*$/gm,"// [type import stripped]");let a=new Set,u=/^[ \t]*import\s+(?:type\s+)?{\s*([^}]+)\s*}\s+from\s+['"](@stacksjs\/browser|@stacksjs\/stx|stx)['"][ \t]*;?[ \t]*$/gm,l;while((l=u.exec(e))!==null){let O=l[1],z=l[2];if(l[0].includes("import type"))continue;let V=[];for(let q of O.split(",")){let H=q.trim();if(!H||H.startsWith("type "))continue;let M=H.match(/^([A-Za-z_$][\w$]*)(?:\s+as\s+([A-Za-z_$][\w$]*))?$/);if(!M)continue;let ee=M[1],oe=M[2]||ee;if(a.add(ee),a.add(oe),z==="stx"||z==="@stacksjs/stx")t.add(ee);else n.add(ee);if(oe!==ee)V.push(`${oe} = ${ee}`)}let F=V.length>0?`var ${V.join(", ")}; /* [auto-import processed] */`:"// [auto-import processed]";i=i.replace(l[0],F)}let f=La(i),x=nn(i);for(let O of Sg){if(a.has(O)||f.has(O))continue;if(Ss(x,O,!0))t.add(O)}let v=r(i),A=nn(v),D=new Set;for(let O of i.matchAll(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm))for(let z of O[1].split(",")){let V=z.trim().replace(/^type\s+/,"").split(/\s+as\s+/);for(let F of V){let q=F.trim();if(q)D.add(q)}}for(let O of Ee){if(a.has(O)||f.has(O)||D.has(O))continue;if(Ss(A,O))n.add(O)}let U=ri(v,A);for(let O of U)if(!a.has(O)&&!f.has(O))n.add(O);return{code:i,stxImports:Array.from(t),browserImports:Array.from(n)}}function kg(e,t,n=!1){return Ss(nn(e),t,n)}function Ss(e,t,n=!1){let i=e.code,a=new RegExp(`\\b${t.replace(/[$]/g,"\\$")}\\b`,"g");for(let u of i.matchAll(a)){let l=u.index??0;if(e.shadows(t,l))continue;let f=l+t.length,x=l-1;while(x>=0&&/\s/.test(i[x]))x--;if(i[x]==="."&&i.slice(Math.max(0,x-2),x+1)!=="...")continue;let v=f;while(v<i.length&&/\s/.test(i[v]))v++;if(i[v]===":"&&i[v+1]!==":"&&(i[x]==="{"||i[x]===","))continue;if(n&&!/^\s*(?:<[^>]*>)?\s*\(/.test(i.slice(f)))continue;if(Ba(i,f))continue;return!0}return!1}function Ba(e,t){let n=t;while(n<e.length&&(e[n]===" "||e[n]==="\t"))n++;if(e[n]!=="(")return!1;let i=0;for(;n<e.length;n++){let a=e[n];if(a==="(")i++;else if(a===")"){if(i--,i===0)break}}if(i!==0)return!1;n++;while(n<e.length&&(e[n]===" "||e[n]==="\t"))n++;return e[n]==="{"}function cl(e,t){let n=[];if(e.length>0)n.push(` var { ${e.join(", ")} } = window.stx || window;`);if(t.length>0)n.push(` var { ${t.join(", ")} } = window.StacksBrowser || {};`);if(n.length>0)return` // STX: auto-imported from stx and @stacksjs/browser
124
- ${n.join(`
125
- `)}
126
- ${Wa(e,t)}`;return""}function fy(e,t=[]){let{browserImports:n}=al(e),i=new Set(t);return cl([],n.filter((a)=>!i.has(a)))}function Wa(e,t){let n=[...e.map((i)=>`['${i}', typeof ${i}, 'stx']`),...t.map((i)=>`['${i}', typeof ${i}, '@stacksjs/browser']`)];if(n.length===0)return"";return` // STX: report auto-imports the client runtime did not provide
127
- [${n.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 ze(e){let t=e.__stxClientPayload;if(t&&typeof t==="object"){let i={};for(let a in t){let u=t[a];if(typeof u==="function")continue;i[a]=u}return i.__stxDeclaredPayload=!0,i}let n={};for(let i in e){if(i.startsWith("__")||i.startsWith("$"))continue;let a=e[i];if(typeof a==="function")continue;n[i]=a}return n}var Fa=/token|secret|passw|apikey|api_key|privatekey|private_key|credential|webhook|bearer|jwt|signature/i,ni=new Set;function Va(e,t){let n=Fa.test(e),i=t.length>32768;if(!n&&!i)return;if(ni.has(e))return;if(ni.add(e),n)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(i)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 kn(e,t){if(!t)return"";let n=Le(e,new Set(Object.keys(t))),i=t.__stxDeclaredPayload===!0,a=[],u=Object.entries(t).sort(([l],[f])=>l<f?-1:l>f?1:0);for(let[l,f]of u){if(!/^[A-Za-z_$][\w$]*$/.test(l))continue;if(l.startsWith("__")||l.startsWith("$"))continue;if(!i&&!n.has(l))continue;if(Dt(e,l)){if(i)console.warn(`[stx] defineClientPayload declares "${l}", but this client block also declares "${l}" at the top level, so the server value is not published (emitting it would be a duplicate binding). Rename the local, or drop "${l}" from defineClientPayload.`);continue}let x;try{x=JSON.stringify(f)}catch{continue}if(x===void 0)continue;Va(l,x),a.push(` var ${l} = ${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 Ua={left:0,middle:1,right:2};function Ha(e){let t=[];if(e.self)t.push("if ($event.target !== $el) return");for(let n of e.systemKeys)t.push(`if (!$event.${n}Key) return`);if(e.keys.length>0){let n=e.keys.map((i)=>`$event.key === '${i}'`).join(" || ");t.push(`if (!(${n})) return`)}if(e.mouse!==null){let n=Ua[e.mouse];t.push(`if ($event.button !== ${n}) return`)}if(e.prevent)t.push("$event.preventDefault()");if(e.stop)t.push("$event.stopPropagation()");return t.join("; ")}function qa(e,t){let{elementId:n,event:i,modifiers:a}=e,u=_s(e.handler),l=Ha(a),f=[];if(a.once)f.push("once: true");if(a.capture)f.push("capture: true");if(ys(i,a))f.push("passive: true");let x=f.length>0?`, { ${f.join(", ")} }`:"",v="";if(l)v+=`${l}; `;let A=u.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),D=`var $emit = function(name, detail) {
139
- $el.dispatchEvent(new CustomEvent(name, { detail: detail, bubbles: true, cancelable: true }))
140
- };`;function U(O){if(/\$emit\s*\(/.test(O))return`${D}
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('${n}')
150
- if (!$el) return
151
- var __timer
152
- $el.addEventListener('${i}', function($event) {
153
- ${l?l+"; ":""}clearTimeout(__timer)
154
- __timer = setTimeout(function() { ${U(u)} }, ${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('${n}')
159
- if (!$el) return
160
- var __last = 0
161
- $el.addEventListener('${i}', function($event) {
162
- ${l?l+"; ":""}var __now = Date.now()
163
- if (__now - __last >= ${a.throttle}) {
164
- __last = __now
165
- ${U(u)}
166
- }
167
- }${x})
168
- })()`;if(/\$emit\s*\(/.test(u))return` var $el = document.getElementById('${n}')
169
- if ($el) $el.addEventListener('${i}', function($event) {
170
- ${v}${D}
171
- ${u}
172
- }${x})`;return` var $el = document.getElementById('${n}')
173
- if ($el) $el.addEventListener('${i}', 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
- ${u}
180
- }
181
- }${x})`}function Za(e){if(e.length===0)return"";return`
182
- // STX: auto-generated event bindings
183
- ${e.map((n,i)=>qa(n,i)).join(`
184
- `)}`}function si(e){let t=[],n=new Set,i=e.replace(/^\s*import\s+.*$/gm,""),a=0,u=i.length,l=0;while(l<u){let f=i[l];if(f==="'"||f==='"'||f==="`"){let x=f;if(l++,x==="`"){let v=0;while(l<u){if(i[l]==="\\"){l+=2;continue}if(i[l]==="`"&&v===0){l++;break}if(i[l]==="$"&&i[l+1]==="{"){v++,l+=2;continue}if(i[l]==="}"&&v>0){v--,l++;continue}l++}}else while(l<u){if(i[l]==="\\"){l+=2;continue}if(i[l]===x){l++;break}l++}continue}if(f==="/"&&i[l+1]==="/"){while(l<u&&i[l]!==`
185
- `)l++;continue}if(f==="/"&&i[l+1]==="*"){l+=2;while(l<u-1&&!(i[l]==="*"&&i[l+1]==="/"))l++;l+=2;continue}if(f==="{"){a++,l++;continue}if(f==="}"){a--,l++;continue}if(a===0){let x=i.slice(l),v=x.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(v){let U=v[1];if(!U.startsWith("_")&&!n.has(U))t.push(U),n.add(U);l+=v[0].length;continue}let A=x.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(A){A[1].split(",").forEach((U)=>{let O=U.trim(),z=O.indexOf(":"),V=z>=0?O.slice(z+1).trim().split(/[\s=]/)[0]:O.split(/[\s=]/)[0];if(V&&!V.startsWith("_")&&!n.has(V))t.push(V),n.add(V)}),l+=A[0].length;continue}let D=x.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(D){let U=D[1];if(!U.startsWith("_")&&!n.has(U))t.push(U),n.add(U);l+=D[0].length;continue}}l++}return t}var Ka=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 Xa(e){let t=new Set,n=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function i(U){let O;while((O=n.exec(U))!==null){let z=O[0];if(!Ka.has(z))t.add(z)}}let a=/\{\{([\s\S]*?)\}\}/g,u;while((u=a.exec(e))!==null)i(u[1]);let l=/:[a-z][\w.-]*\s*=\s*"([^"]*)"/gi;while((u=l.exec(e))!==null)i(u[1]);let f=/:[a-z][\w.-]*\s*=\s*'([^']*)'/gi;while((u=f.exec(e))!==null)i(u[1]);let x=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((u=x.exec(e))!==null)i(u[1]);let v=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((u=v.exec(e))!==null)i(u[1]);let A=/@model\s*=\s*["']([^"']*)["']/gi;while((u=A.exec(e))!==null)i(u[1]);let D=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((u=D.exec(e))!==null)i(u[1]);return t}async function He(e,t={}){let n=e,i="",a=!1,u=[],l=Ci(n,{filePath:t.filePath,projectRoot:t.projectRoot});n=l.code;let f=Ei(l.styles),x=zt(n);n=x.code,u=[...x.imports,...x.models];let{hasUserImports:v,bundleClientScript:A}=await o("stx/client-script-bundler",()=>import("./chunk-awmfyb3t.js"));if(v(n))n=await A(n,t.filePath||"",{projectRoot:t.projectRoot,minify:t.production}),a=!0;if(t.autoImports!==!1){let M=al(n);n=M.code,i=cl(M.stxImports,M.browserImports.filter((ee)=>!u.includes(ee)))}if(i=`${kn(n,t.serverData)}${i}`,n=N(n),!a&&Ve(t.attrs||""))n=Ue(n);let D=Za(t.eventBindings||[]),U=(t.attrs||"").trim(),O=/\btype\s*=\s*["']module["']/i.test(U),z=t.instanceId?` data-stx-instance="${t.instanceId}"`:"";if(O){let M=U.replace(/\btype\s*=\s*["']module["']/i,"").trim(),ee=`type="module" data-stx-scoped${z}${M?` ${M}`:""}`;return`${f}<script ${ee}>
186
- ${pe(`${i}${n}
187
- ${D}`)}
188
- </script>`}let V=Fi(e),F=/function __stx_setup_/.test(n),q=/\bstx\.mount\s*\(|\bstx\.mountEl\s*\(/.test(e);function H(M){let ee=M.length>0?`
189
- return ${Bs(n,M)};`:"",oe=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(`${i}${n}
194
- ${D}${ee}`)}
195
- } catch (error) {
196
- console.error(${oe}, error);
197
- return {};
198
- }
199
- })</script>`}if(!q&&!F){if(V)return H(si(e));if(t.templateContent){let M=si(e);if(M.length>0){let ee=Xa(t.templateContent);if(M.some((ie)=>ee.has(ie)))return H(M)}}}return`${f}<script data-stx-scoped data-stx-run="always"${z}>
200
- ;(function() {
201
- 'use strict';
202
- try {
203
- ${pe(`${i}${n}
204
- ${D}`)}
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 sc}from"crypto";var $s=/\s*/y,vs=/\x00STX_HTML_COMMENT_\d+\x00/y;function Mt(e){let t=0;while(t<e.length){if($s.lastIndex=t,$s.exec(e),t=$s.lastIndex,e.startsWith("<!--",t)){let n=e.indexOf("-->",t+4);if(n===-1)return t;t=n+3;continue}if(vs.lastIndex=t,vs.test(e)){t=vs.lastIndex;continue}return t}return t}var Es=/<(\/?)([a-zA-Z][a-zA-Z0-9-]*)\b/y,Ja=new Map(["textarea","title","xmp","iframe","noembed","noframes"].map((e)=>[e,new RegExp(`</${e}\\s*>`,"ig")]));function Lt(e){let t=[],n=0;while(n<e.length){let i=e.indexOf("<",n);if(i===-1)break;if(e.startsWith("<!--",i)){let U=e.indexOf("-->",i+4);if(U===-1)break;n=U+3;continue}Es.lastIndex=i;let a=Es.exec(e);if(!a){n=i+1;continue}let u=Es.lastIndex,l=u,f=null;for(;l<e.length;l++){let U=e[l];if(f){if(U===f)f=null}else if(U==='"'||U==="'")f=U;else if(U===">")break}if(l===e.length)break;let x=a[1]==="/",v=e[l-1]==="/";t.push({start:i,end:l+1,name:a[2],attributes:e.slice(u,v?l-1:l),closing:x,selfClosing:v}),n=l+1;let A=a[2].toLowerCase();if(!x&&A==="plaintext")break;let D=Ja.get(A);if(!x&&(A==="script"||A==="style"||D)){let U=D??(A==="script"?Vn:Un);U.lastIndex=n;let O=U.exec(e);if(!O)break;n=O.index}}return t}var Wn=/<script\b[^>]*>/iy,Vn=/<\/script\s*>/ig,Fn=/<style\b[^>]*>/iy,Un=/<\/style\s*>/ig;function ii(e,t,n,i){n.lastIndex=t;let a=n.exec(e);if(!a||a.index!==t)return-1;i.lastIndex=n.lastIndex;let u=i.exec(e);if(!u)return-1;return u.index+u[0].length}function J(e,t){return ii(e,t,Wn,Vn)}function bn(e,t){return ii(e,t,Fn,Un)}function Be(e,t){if(!e.startsWith("<!--",t))return-1;let n=e.indexOf("-->",t+4);if(n===-1)return-1;return n+3}function oi(e,t){if(e.startsWith("<!--",t)){let a=Be(e,t);return a===-1?e.length:a}if(Wn.lastIndex=t,Wn.exec(e)?.index===t){Vn.lastIndex=Wn.lastIndex;let a=Vn.exec(e);return a?a.index+a[0].length:e.length}if(Fn.lastIndex=t,Fn.exec(e)?.index===t){Un.lastIndex=Fn.lastIndex;let a=Un.exec(e);return a?a.index+a[0].length:e.length}return-1}function w(e,t){let n=[],i=0,a=e.length,u=!1,l=null;while(i<a){let f=e[i];if(u){if(l){if(f===l)l=null}else if(f==='"'||f==="'")l=f;else if(f===">")u=!1;i++;continue}if(f!=="<"){let D=e.indexOf("<",i+1);if(D===-1)break;i=D;continue}let x=t(e,i);if(x>i){n.push({start:i,end:x,token:e.slice(i,x)}),i=x;continue}let v=oi(e,i);if(v>i){i=v;continue}let A=e.charCodeAt(i+1);if(A>=65&&A<=90||A>=97&&A<=122)u=!0;i++}return n}function ai(e){let t=0,n=0,i=0,a=!1,u=null;while(i<e.length){if(a){let D=e[i];if(u){if(D===u)u=null}else if(D==='"'||D==="'")u=D;else if(D===">")a=!1;i++;continue}let l=e.indexOf("<",i),f=l===-1?e.length:l;while(i<f){let D=e[i++];if(D==="{")t++;else if(D==="}")n++;if(t>=2&&n>=2)return!0}if(l===-1)break;let x=oi(e,l);if(x>l){i=x;continue}let v=e.charCodeAt(l+1),A=v===47?e.charCodeAt(l+2):v;if(A>=65&&A<=90||A>=97&&A<=122)a=!0;i=l+1}return!1}function Uc(e,t){while(e.size>=t){let n=e.keys().next();if(n.done)return;e.delete(n.value)}}var Ga=1024,Ya=16777216,Nt=new Map,ks=0;function Qa(e,t){Nt.set(e,t),ks+=e.length+t.output.length;for(let[n,i]of Nt){if(ks<=Ya)break;Nt.delete(n),ks-=n.length+i.output.length}}function be(e,t,n,i){let a=i!==void 0&&e.length>=Ga,u=a?`${i}\x00${e}`:"";if(a){let A=Nt.get(u);if(A)return Nt.delete(u),Nt.set(u,A),{output:A.output,tokens:A.tokens.slice()}}let l=w(e,t);if(l.length===0)return{output:e,tokens:[]};let f=l.map((A)=>A.token),x="",v=0;for(let A=0;A<l.length;A++){let D=l[A];x+=e.slice(v,D.start),x+=n(D.token,A),v=D.end}if(x+=e.slice(v),a)return Qa(u,{output:x,tokens:f}),{output:x,tokens:f.slice()};return{output:x,tokens:f}}var ec=1024,tc=16777216,Wt=new Map,Cs=0;function nc(e,t){Wt.set(e,t),Cs+=e.length+t.output.length;for(let[n,i]of Wt){if(Cs<=tc)break;Wt.delete(n),Cs-=n.length+i.output.length}}function Rs(e,t,n){return{output:t,scripts:n,restore:(i)=>i===t?e:Er(i,n)}}function te(e){let t=e.length>=ec;if(t){let a=Wt.get(e);if(a)return Wt.delete(e),Wt.set(e,a),Rs(e,a.output,a.scripts.slice())}let{output:n,tokens:i}=be(e,J,(a,u)=>`\x00STX_SCRIPT_${u}\x00`);if(t)return nc(e,{output:n,scripts:i}),Rs(e,n,i.slice());return Rs(e,n,i)}function Er(e,t){if(t.length===0)return e;return e.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(n,i)=>t[+i]??"")}var Hn="__stx_component_client_factories";function qn(e){let t=e[Hn];return t instanceof Map?t:null}function rl(e){e[Hn]=new Map}function Ts(e,t){let n=qn(e);if(!n)return null;let i=sc("sha256").update(t).digest("hex").slice(0,16),a=n.get(i);if(a)a.instances++;else n.set(i,{body:t,instances:1});return i}function sl(e,t){let n=qn(t);if(!n?.size)return e;let i=new Map;for(let[A,D]of n)if(D.instances===1)i.set(A,D.body);let a=[];if(i.size>0){let A=[...i.keys()].map((O)=>JSON.stringify(O).replace(/[$()*+.?[\\\]^{|}]/g,"\\$&")).join("|"),D=new RegExp(`window\\.__stxComponentFactories\\[(${A})\\]\\(("[^"]+")\\);`,"g"),U=D.exec(e);while(U!==null){let O=i.get(JSON.parse(U[1]));if(O!==void 0)a.push({start:U.index,end:U.index+U[0].length,replacement:pe(`(${O})(${U[2]});`)});U=D.exec(e)}}let u=[...n].filter(([,A])=>A.instances>1);if(u.length===0)return ci(e,a);let l=u.map(([A,D])=>` try { factories[${JSON.stringify(A)}] = factories[${JSON.stringify(A)}] || ${D.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(l)}
214
- })();
215
- </script>`,x,v=/<(?:template\b|script\b(?=[^>]*\bdata-stx-scoped\b))/iy;return w(e,(A,D)=>{if(x===void 0){if(v.lastIndex=D,v.test(A))x=D}return-1}),a.push({start:x??0,end:x??0,replacement:`${f}
216
- `}),ci(e,a)}function ci(e,t){if(t.length===0)return e;t.sort((u,l)=>u.start-l.start||u.end-l.end);let n=Array(t.length*2+1),i=0,a=0;for(let u of t)n[a++]=e.slice(i,u.start),n[a++]=u.replacement,i=u.end;return n[a]=e.slice(i),n.join("")}function li(e){let t=qn(e),n=new Map;if(t)for(let[i,a]of t)n.set(i,a.instances);return n}function ui(e,t){let n=qn(e);if(!n)return[];let i=[];for(let[a,u]of n){let l=u.instances-(t.get(a)??0);if(l>0)i.push({body:u.body,count:l})}return i}function pi(e,t){for(let{body:n,count:i}of t)for(let a=0;a<i;a++)Ts(e,n)}function Ce(e,t,n=2){let i=0,a=null;for(let u=t+n;u<e.length;u++){let l=e[u];if(a){if(l==="\\"){u++;continue}if(l===a)a=null;continue}if(l==='"'||l==="'"||l==="`"){a=l;continue}if(l==="{"){i++;continue}if(l==="}"){if(i>0){i--;continue}let f=0;while(e[u+f]==="}")f++;if(f>=n)return u}}return-1}import Li from"fs";var di=0,As=new Map;function pl(){di=0,As.clear()}function Zn(e,t){let n=di++,i=`<!--__STX_${e.toUpperCase()}_${n}__-->`;return As.set(i,{type:e,expression:t}),i}function fl(){let e={};for(let[t,n]of As)e[t]={type:n.type,expression:n.expression};return e}function gl(e,t){let n=e;for(let[i,a]of t)n=n.split(i).join(a);return n}function $i(e){return e.includes("<!--__STX_")}var rc=/@(?=[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 ic(e){return Array.from({length:e},()=>"&#123;").join("&#8288;")}function Pi(e){return e.replace(/\{{2,}/g,(t)=>ic(t.length)).replace(/\{(?=!)/g,"&#123;&#8288;").replace(rc,"&#64;")}function $r(e,t,n=!1){let{openTag:i,tail:a}=n?oc(e,t):ac(e).at(t);return lc(a,i,n)}function oc(e,t){let n="",i=0;for(let l=0;l<t;l++){if(!e.startsWith("{{",l))continue;let f=Ce(e,l);if(f<0||f+2>t)break;n+=e.slice(i,l)+"x",l=f+1,i=f+2}n+=e.slice(i,t);let a=-1,u=null;for(let l=0;l<n.length;l++){let f=n[l];if(u){if(f===u)u=null;continue}if(f==='"'||f==="'"){u=f;continue}if(f===">"){a=-1;continue}if(f==="<")a=l}return{openTag:a,tail:a>=0?n.slice(a+1):n}}var Kn=null;function ac(e){if(Kn&&Kn.source===e)return Kn.scanner;let t=cc(e);return Kn={source:e,scanner:t},t}function cc(e){let t=0,n=-1,i=null,a=-1,u=(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},l=(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,n=-1,i=null,a=-1;let x={openTag:n,quote:i},v=!1;while(t<f){if(a<0&&e.startsWith("{{",t)){let V=Ce(e,t);if(V<0)a=t;else if(V+2<=f){t=V+2;continue}else break}let z=l(t,x);if(z>=0){if(z>f){v=!0;break}t=z;continue}u(t,x),t++}if(n=x.openTag,i=x.quote,v)return{openTag:-1,tail:""};let A=a>=0?a:t,D={openTag:n,quote:i};for(let z=t;z<f;z++){let V=l(z,D);if(V>=0){if(V>f)return{openTag:-1,tail:""};z=V-1;continue}u(z,D)}if(D.openTag<0)return{openTag:-1,tail:""};let U="",O=D.openTag+1;for(let z=O;z<Math.min(f,A);z++){if(!e.startsWith("{{",z))continue;let V=Ce(e,z);U+=e.slice(O,z)+"x",z=V+1,O=V+2}return U+=e.slice(O,f),{openTag:D.openTag,tail:U}}}}function lc(e,t,n){if(t<0&&!n)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 i=0;if(t>=0)while(i<e.length&&!/\s/.test(e[i]))i++;while(i<e.length){while(/\s/.test(e[i]??"")&&i<e.length)i++;let a=i;while(i<e.length&&!/[\s=/>]/.test(e[i]))i++;let u=e.slice(a,i);if(!u)break;while(i<e.length&&/\s/.test(e[i]))i++;if(e[i]!=="=")continue;i++;while(i<e.length&&/\s/.test(e[i]))i++;let l=e[i];if(l==='"'||l==="'"){let f=++i,x=e.indexOf(l,i);if(x===-1)return{kind:"attribute",name:u,quote:l,valuePrefix:e.slice(f)};i=x+1}else{let f=i;while(i<e.length&&!/\s/.test(e[i]))i++;if(i===e.length)return{kind:"attribute",name:u,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 Oi="unsafe:";var uc=/^(?:javascript|vbscript|livescript|mocha|view-source):/,fc=/^data:(?:text\/html|text\/xml|application\/xhtml\+xml|application\/xml|image\/svg\+xml)/,pc=/^data:(?:text\/html|application\/xhtml\+xml)/,dc=new RegExp("[\\u0000-\\u0020\\u00A0\\u1680\\u2000-\\u200F\\u2028\\u2029\\u202F\\u205F\\u3000\\uFEFF]+","g");function gc(e){return e.replace(dc,"").toLowerCase()}function Is(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 Xn(e,t="navigable"){let n=gc(e);if(uc.test(n))return!0;return t==="navigable"?fc.test(n):pc.test(n)}function Tr(e,t="navigable"){return Xn(e,t)?"unsafe:"+e:e}function mc(e){let t=e.match(/(?:^|[\s"'`/])([A-Za-z][\w:-]*)\s*=\s*(["'])([^"']*)$/);if(!t)return null;if(t[3].trim()!=="")return null;return Is(t[1])}function Di(e,t,n=256){if(t<=n)return e.slice(0,t);let i=e.slice(t-n,t),a=i.search(/[\s"'`/]/);return a===-1?"":i.slice(a)}function Mi(e,t,n=t){let i=mc(e);return i&&Xn(t,i)?"unsafe:"+n:n}function jt(e){let t=e.indexOf(" as ");if(t!==-1){let u=e.slice(0,t).trim(),l=e.slice(t+4).trim();return u&&l?{arrayExpr:u,itemVar:l}:null}let n=/^\s*(.+?)\s+in\s+([\s\S]+)$/.exec(e);if(!n)return null;let i=n[1].trim().replace(/^\(([\s\S]*)\)$/,"$1").trim(),a=n[2].trim();return i&&a?{arrayExpr:a,itemVar:i}:null}function Jn(e){let t=[],n=0,i="",a=0;for(let u=0;u<e.length;u++){let l=e[u];if(i){if(l==="\\")u++;else if(l===i)i="";continue}if(l==="'"||l==='"'||l==="`")i=l;else if(l==="("||l==="["||l==="{")n++;else if(l===")"||l==="]"||l==="}")n--;else if(l===","&&n===0)t.push(e.slice(a,u)),a=u+1}return t.push(e.slice(a)),t}function ji(e,t){let n=0;for(let i=0;i<e.length;i++){let a=e[i];if(a==="("||a==="["||a==="{")n++;else if(a===")"||a==="]"||a==="}")n--;else if(a===t&&n===0)return i}return-1}function Ni(e){let t=0;for(let n=0;n<e.length;n++){let i=e[n];if(i==="("||i==="["||i==="{")t++;else if((i===")"||i==="]"||i==="}")&&--t===0)return n}return-1}function kt(e,t){let n=e.trim().replace(/^\.\.\./,"").trim(),i=ji(n,"=");if(i!==-1&&n[i+1]!==">")n=n.slice(0,i).trim();if(!n)return;if(n.startsWith("{")&&n.endsWith("}")){for(let a of Jn(n.slice(1,-1))){let u=a.trim();if(!u)continue;if(u.startsWith("...")){kt(u,t);continue}let l=ji(u,":");kt(l===-1?u:u.slice(l+1),t)}return}if(n.startsWith("[")&&n.endsWith("]")){for(let a of Jn(n.slice(1,-1)))kt(a,t);return}if(/^[A-Z_$][\w$]*$/i.test(n))t.push(n)}function ne(e){let t=e.trim(),n=[],i=0;for(let u=0;u<t.length;u++){let l=t[u];if(l==="("||l==="["||l==="{")i++;else if(l===")"||l==="]"||l==="}")i--;else if(i===0&&/\s/.test(l)){if(!/^\s+(?:in|of)\s/.exec(t.slice(u)))continue;let x=t.slice(0,u).trim();if(x.startsWith("(")&&Ni(x)===x.length-1)x=x.slice(1,-1);for(let v of Jn(x))kt(v,n);if(n.length>0)return n;break}}let a=/^[\s\S]+?\s+as\s+([\s\S]+)$/.exec(t);if(a){let u=a[1].trim();if(u.startsWith("(")&&Ni(u)===u.length-1)u=u.slice(1,-1);let l=/^([\w$]+)\s*=>\s*([\s\S]+)$/.exec(u);if(l)kt(l[2],n),kt(l[1],n);else for(let f of Jn(u))kt(f,n)}return n}function j(e,t){let n=t instanceof Set?t:new Set(t);if(n.size===0)return!1;let l=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 l.match(/[a-zA-Z_$][\w$]*/g)||[])if(n.has(f))return!0;return!1}var Gn="__stx_client_loop_names";function ct(e){let t=e?.[Gn];return Array.isArray(t)?t:[]}function Yn(e){if(!e.includes("#")&&!e.includes("v-slot:")&&!e.includes("data-stx-slot-binding"))return[];let t=[],n=[],i=/<!--[\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(i)){let u=a[0];if(/^<\/template\s*>$/i.test(u)){let l=n.pop();if(l)l.end=a.index}else if(/^<template\b/i.test(u)&&!/\/\s*>$/.test(u)){let f=[...u.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+u.length,end:e.length,binding:x}:void 0;if(n.push(v),v)t.push(v)}}return t}var on={},zi=new Map;function hc(e){let t=zi.get(e);if(!t){let n=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");t=new RegExp(`:${n}(?!\\w)`,"g"),zi.set(e,t)}return t.lastIndex=0,t}var Ys={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 n=String(e);return n.charAt(0).toUpperCase()+n.slice(1)},number:(e,t,n=0)=>{if(e===void 0||e===null)return"";try{let i=Number(e);return Number.isNaN(i)?"":i.toFixed(Number.parseInt(String(n),10))}catch{return""}},fmt:(e,t,n="en-US")=>{if(e===void 0||e===null)return"";try{let i=Number(e);if(Number.isNaN(i))return String(e);return i.toLocaleString(n)}catch{return String(e)}},join:(e,t,n=",")=>{if(!Array.isArray(e))return"";return e.join(String(n))},escape:(e,t)=>{if(e===void 0||e===null)return"";return G(String(e))},translate:(e,t,n={})=>{if(!t||!t.__translations)return e;let i=t.__translations,a=t.__i18nConfig?.fallbackToKey??!0,u=String(e).split("."),l=i;for(let x of u){if(l===void 0||l===null)break;l=l[x]}if(l===void 0||l===null)return a?e:"";let f=String(l);return Object.entries(n).forEach(([x,v])=>{f=f.replace(hc(x),()=>String(v))}),f},t:(e,t,n={})=>Ys.translate(e,t,n),truncate:(e,t,n=50,i="...")=>{if(e===void 0||e===null)return"";let a=String(e);if(a.length<=n)return a;if(n<=i.length)return i.substring(0,n);return a.substring(0,n-i.length)+i},date:(e,t,n="short",i="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 u={short:{dateStyle:"short"},medium:{dateStyle:"medium"},long:{dateStyle:"long"},full:{dateStyle:"full"},time:{timeStyle:"short"},datetime:{dateStyle:"short",timeStyle:"short"},iso:{}};if(n==="iso")return a.toISOString();return new Intl.DateTimeFormat(i,u[n]||u.short).format(a)}catch{return String(e)}},currency:(e,t,n="USD",i="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(i,{style:"currency",currency:n}).format(a)}catch{return String(e)}},pluralize:(e,t,n,i)=>{let a=Number(e);if(Number.isNaN(a))return n;let u=i||`${n}s`;return a===1?n:u},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 n=String(e);return n.charAt(n.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,n=!1)=>{if(e===void 0)return"undefined";if(e===null)return"null";try{return n?JSON.stringify(e,null,2):JSON.stringify(e)}catch{return String(e)}},default:(e,t,n="")=>e===void 0||e===null||e===""?n: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,n=0,i)=>{if(e===void 0||e===null)return"";if(Array.isArray(e)||typeof e==="string")return e.slice(n,i);return e},replace:(e,t,n,i="")=>{if(e===void 0||e===null)return"";let a=n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return String(e).replace(new RegExp(a,"g"),()=>i)},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 n=Number(e);return Number.isNaN(n)?0:Math.abs(n)},round:(e,t,n=0)=>{let i=Number(e);if(Number.isNaN(i))return 0;let a=10**n;return Math.round(i*a)/a}};function Ig(e,t){if(e in Ys)console.warn(`Filter "${e}" already exists as a built-in filter. Custom filter will take precedence.`);on[e]=t}function my(e){for(let[t,n]of Object.entries(e))Ig(t,n)}function Og(){return{...Ys,...on}}function hy(){for(let e of Object.keys(on))delete on[e]}function qi(e){let t=e.next();while(!t.done)t=e.next();return t.value}function*Zi(e,t,n,i){let a="{".repeat(n);if(!e.includes(a))return e;let u="",l=0,f=0,x=i===Number.POSITIVE_INFINITY?0:performance.now();for(;;){let v=e.indexOf(a,l);if(v===-1)break;let A=Ce(e,v,n);if(A===-1)break;if(u+=e.slice(l,v)+t(e.slice(v,A+n),e.slice(v+n,A),v),l=A+n,++f>=64){f=0;let D=performance.now();if(D-x>=i)x=D,yield}}return l===0?e:u+e.slice(l)}function Cn(e,t,n=2){return qi(Zi(e,t,n,Number.POSITIVE_INFINITY))}function xc(e,t,n){let i=n[0];if(i!=="'"&&i!=='"'&&i!=="`")return!1;let a=$r(e,t);if(!a||a.kind!=="attribute"||a.quote===i)return!1;if(!/^(?::|@|x-|v-)/.test(a.name))return!1;let u=0;for(let l=0;l<a.valuePrefix.length;l++)if(a.valuePrefix[l]==="\\")l++;else if(a.valuePrefix[l]===i)u++;return u%2===1}function g(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function G(e){return Pi(g(e))}function bc(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 yc(e){return e.replace(/\/\*[\s\S]*?\*\//g,"").replace(/\\([\dA-Fa-f]{1,6})\s?/g,(t,n)=>String.fromCodePoint(Number.parseInt(n,16))).replace(/\\([^\r\n])/g,"$1").replace(/[\u0000-\u0020]+/g,"").toLowerCase()}function _c(e,t){let n=yc(e);if(/@import|expression\(|behavior:|-moz-binding|(?:image-set|cross-fade)\(/.test(n))throw new fe(t,"network-capable or executable CSS is not allowed in an escaped interpolation");let i=/url\(([^)]*)\)/g,a;while((a=i.exec(n))!==null){let u=a[1].replace(/^["']|["']$/g,""),l=u.startsWith("/")&&!u.startsWith("//")||u.startsWith("./")||u.startsWith("../")||u.startsWith("#"),f=/^data:image\/(?:avif|bmp|gif|jpeg|jpg|png|webp);base64,[a-z\d+/=]+$/i.test(u);if(!l&&!f)throw new fe(t,"CSS URLs must be local paths or base64 raster images")}}function se(e,t,n,i=!1,a=0){try{return wc(e,t,n,i,a)}catch(u){if(u instanceof fe)u.locate(e,t);throw u}}function wc(e,t,n,i,a){let u=$r(e,t,i),l=G(n);if(!u)return l;if(u.kind==="tag-name"){if(!/^[A-Za-z][A-Za-z0-9:-]*$/.test(n))throw new fe("tag name","dynamic tag names may contain only letters, digits, colons, and hyphens");return n}if(u.kind==="tag"){let v=e.slice(t+a).trimStart(),A=n.trim();if(!v.startsWith("=")&&(A===""||A.split(/\s+/).every((D)=>/^(?!on)[A-Za-z_:][\w:.-]*$/.test(D))))return A;throw new fe("tag structure","only standalone boolean attributes may be interpolated into tag structure")}let f=u.name.toLowerCase();if(/^on[a-z]/.test(f))throw new fe(u.name,"native event-handler attributes execute JavaScript; use an @event binding instead");if(f==="srcdoc")l=G(l);if(f==="style")_c(n,u.name);if(u.quote===null)l=bc(l);let x=Is(f);if(x&&u.valuePrefix.trim()===""&&Xn(n,x))return Oi+l;return Mi(Di(e,t),n,l)}function En(e,t){let n=` ${e}="`;return se(n,n.length,t,!0)}function Ki(e){return e.flatMap((t)=>{let n=t.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i);return!n||/\bserver\b|\bsrc\s*=/.test(n[1])?[]:[n[2]]})}function Te(e,t){let{scripts:n}=te(e);for(let i of Ki(n)){if(/\b(state|derived|effect|ref|reactive|computed|watch|watchEffect|useModel)\s*(?:<[^>]*>)?\s*\(/.test(i)||ul.test(i))return!0;if(Fr(i,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 Ng(e){let t=[],n=/<([a-zA-Z][\w-]*)\b[^>]*?\s(?::for|x-for|@for)\s*=\s*(["'])([\s\S]*?)\2[^>]*>/g;for(let i=n.exec(e);i;i=n.exec(e)){let a=i[1].toLowerCase(),u=new Set(ne(i[3]));if(u.size===0)continue;let l=i.index+i[0].length;if(i[0].endsWith("/>")){t.push({start:i.index,end:l,names:u});continue}let f=new RegExp(`<(/?)${a}\\b[^>]*?(/?)>`,"gi");f.lastIndex=l;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:i.index,end:v,names:u})}return t}function Bi(e,t,n){let i=r(n);for(let a of e){if(t<a.start||t>=a.end)continue;for(let u of a.names)if(new RegExp(`(?<![.#\\w$])${u.replace(/\$/g,"\\$")}(?![\\w$])`).test(i))return!0}return!1}function Wi(e,t){let n=["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"],i=e.replace(/'[^']*'/g,"").replace(/"[^"]*"/g,""),a="",u=!1,l=0;for(let v=0;v<i.length;v++){let A=i[v];if(!u&&A==="`"){u=!0,l=0;continue}if(u){if(A==="`"&&l===0){u=!1;continue}if(A==="$"&&i[v+1]==="{"){l++,v++,a+=" ";continue}if(A==="}"&&l>0){l--;continue}if(l>0){a+=A;continue}continue}a+=A}i=a;let f=/(?<![a-zA-Z0-9_$])([a-zA-Z_$][a-zA-Z0-9_$]*)/g,x;while((x=f.exec(i))!==null){let v=x[1];if(!i.substring(0,x.index).trimEnd().endsWith(".")){if(!n.includes(v)&&!(v in t))return!1}}return!0}function Sc(e,t){let n=r(e);for(let i of n.matchAll(/(?<![.\w$])([A-Z_$][\w$]*)\s*\(/gi))if(typeof t[i[1]]==="function")return!0;return!1}function $c(e,t){let n=t.__stx_serverDeclared;if(!n||n.size===0)return!1;let i=r(e);for(let a of n)if(new RegExp(`(?<![.#\\w$])${a}(?![\\w$])`).test(i))return!0;return!1}var Vi=new Set;function Ui(e){return/^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*)*$/.test(e.trim())}function vc(e,t,n){let i=n[0];if(i!=="'"&&i!=='"'&&i!=="`")return!1;let a=0;for(let u=e.lastIndexOf(`
217
- `,t-1)+1;u<t;u++)if(e[u]==="\\")u++;else if(e[u]===i)a++;return a%2===1}function Hi(e,t){let n=`${t??"<unknown>"}\x00${e}`;if(process.env.STX_DEBUG||!Vi.has(n))Vi.add(n),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 Ri(e,t,n){let i=e;return i=i.replace(/\{!!([\s\S]*?)!!\}/g,(a,u)=>{try{let l=I(u,t);if(l===void 0)return Ui(u)?Hi(u.trim(),n):a;return l===null?"":String(l)}catch{return a}}),i=Cn(i,(a,u,l)=>{let f=u.trim();if(vc(i,l,u))return a;if(/^__[A-Z_]+__$/.test(f))return a;try{let x=I(u,t);if(x===void 0)return Ui(f)?Hi(f,n):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}}),i}function Dg(e,t){if(!e.includes("{"))return e;let n=e;return n=n.replace(/\{!!([\s\S]*?)!!\}/g,(i,a)=>{try{let u=I(a,t);if(u===void 0)return i;return u===null?"":String(u)}catch{return i}}),n=Cn(n,(i,a,u)=>{let l=a.trim();if(/^__[A-Z_]+__$/.test(l))return i;try{let f=I(a,t);if(f===void 0)return i;if(f===null)return"";let x=String(f);return se(n,u,x,!0,i.length)}catch(f){if(f instanceof fe)throw f;return i}}),n}function yy(e,t,n={}){let{output:i,scripts:a}=te(e),u=a.map((l)=>{let f=l.match(/^<script\b((?:[^>\"']|\"[^\"]*\"|'[^']*')*)>/i),x=l.search(/<\/script\s*>$/i);if(!f||x===-1)return l;let v=f[1],A=l.slice(f[0].length,x);if(/\bdata-raw\b/.test(v))return l;if(n.skipServer&&/\bserver\b/.test(v))return l;let U=`<script${Dg(v,t)}>`;if(/\bsrc\s*=/.test(v)||/\btype\s*=\s*["']application\/json["']/.test(v))return U+A+l.slice(x);return U+Ri(A,t)+l.slice(x)});return Er(i,u)}function*Xi(e,t,n,i){let a=e,u=(V,F)=>{let q=bn(V,F);if(q===-1)return-1;return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(V.slice(F,q))?-1:q},l=(V,F,q,H)=>{let M=q.length,{output:ee,tokens:oe}=be(V,F,(ie,ge)=>H(M+ge));return q.push(...oe),ee},f=[];a=l(a,u,f,(V)=>`<!--__STX_STYLE_${V}__-->`);let x=[];a=l(a,J,x,(V)=>`<!--__STX_SCRIPT_EXPR_${V}__-->`);let v=t?.__stx_signals_gate===!0||Te(e),A=new Set([...Array.isArray(t?.__stx_client_signal_names)?t.__stx_client_signal_names:[],...Ti(Ki(x))]),D=new Set(Array.isArray(t?.__stx_preserved_client_expressions)?t.__stx_preserved_client_expressions:[]);a=Cn(a,(V,F,q)=>{if(j(F,A))return V;try{let H=I(F,t,!1,(M)=>Ps(M,V,n,e));return H!==void 0&&H!==null?String(H):""}catch(H){let M=H instanceof Error?H.message:String(H);return y("Expression",`Error evaluating: {{{ ${F.trim()}}}}: ${M}`,n,e,q,V)}},3),a=a.replace(/\{!!([\s\S]*?)!!\}/g,(V,F,q)=>{if(j(F,A))return V;try{let H=I(F,t,!1,(M)=>Ps(M,V,n,e));if(H===void 0&&t.__stx_buildMode==="compile")return Zn("raw",F.trim());return H!==void 0&&H!==null?String(H):""}catch(H){if(t.__stx_buildMode==="compile")return Zn("raw",F.trim());let M=H instanceof Error?H.message:String(H);return y("Expression",`Error evaluating: {!! ${F.trim()} !!}: ${M}`,n,e,q,V)}}),a=l(a,J,x,(V)=>`<!--__STX_SCRIPT_EXPR_${V}__-->`),a=l(a,u,f,(V)=>`<!--__STX_STYLE_${V}__-->`);let U=v?Ng(a):[],O=Yn(a).map((V)=>({...V,names:new Set(ne(`${V.binding} in __slot`))})),z=new Set(ct(t));if(a=yield*Zi(a,(V,F,q)=>{let H=F.trim();if(xc(a,q,F))return V;if(Bi(O,q,H))return V;if(j(H,z))return V;if(U.length>0&&Bi(U,q,H))return V;if(D.has(H))return V;let M=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined"],ee=/^([a-zA-Z_$][a-zA-Z0-9_$]*)/,ie=H.match(ee)?.[1],ge=ie&&((ie in t)||M.includes(ie)),ye=/^([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/,me=H.match(ye),Pe=me&&!M.includes(me[1])&&!(me[1]in t);if(/^__[A-Z_]+__$/.test(H))return"";if(j(H,A))return V;if(t.__stx_native_screen===!0&&Sc(H,t))return V;let Ke;try{let Ae=I(F,t,!1,(et)=>{Ke=et});if(v&&!Wi(H,t))return V;if(Ke)Ps(Ke,V,n,e);if(t.__stx_buildMode==="compile"&&!v&&(Ae===void 0||$c(H,t)))return Zn("expr",H);if(Ae===void 0||Ae===null)return"";let Je=String(Ae);return se(a,q,Je,!1,V.length)}catch(Ae){if(Ae instanceof fe)throw Ae;if(v&&!Wi(H,t))return V;if(Pe)return V;let Je=Ae instanceof Error?Ae.message:String(Ae);return y("Expression",`Error evaluating: {{ ${H} }}: ${Je}`,n,e,q,V)}},2,i),x.length>0)a=a.replace(/<!--__STX_SCRIPT_EXPR_(\d+)__-->/g,(V,F)=>x[Number(F)]??V);if(f.length>0)a=a.replace(/<!--__STX_STYLE_(\d+)__-->/g,(V,F)=>f[Number(F)]??V);return a}function R(e,t,n){return qi(Xi(e,t,n,Number.POSITIVE_INFINITY))}var Ec=100;async function Ai(e,t,n,i=Ec){let a=Xi(e,t,n,i),u=a.next();while(!u.done)await E(),u=a.next();return u.value}function Mg(e,t,n){if(!t.trim())return e;let i=e,a=t.trim();while(a.length>0){let u=a.match(/^(\w+)/);if(!u)break;let l=u[1];a=a.substring(l.length).trim();let f=on[l]||Ys[l];if(!f)throw Error(`Filter not found: ${l}. Available filters: ${Object.keys(Og()).join(", ")}`);let x=[];if(a.startsWith(":")){let v=a.match(/^:([^|\s]+)/);if(v){let A=v[1].trim();try{let D=Number(A);x=[Number.isNaN(D)?A:D]}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 D=a.substring(1,A-1).trim();if(D)try{if(D.startsWith("{")&&D.endsWith("}"))x=[I(`(${D})`,n,!0)];else{let U=[],O="",z=null,V=0,F=0,q=0,H=!1;for(let M=0;M<D.length;M++){let ee=D[M];if(H){O+=ee,H=!1;continue}if(ee==="\\"){O+=ee,H=!0;continue}if(z){if(O+=ee,ee===z)z=null;continue}if(ee==='"'||ee==="'"||ee==="`"){z=ee,O+=ee;continue}if(ee==="(")V++;else if(ee===")")V--;else if(ee==="[")F++;else if(ee==="]")F--;else if(ee==="{")q++;else if(ee==="}")q--;if(ee===","&&V===0&&F===0&&q===0){U.push(O),O="";continue}O+=ee}if(O)U.push(O);x=U.map((M)=>{let ee=M.trim();return I(ee,n,!0)})}}catch{x=[D]}a=a.substring(A).trim()}}try{i=f(i,n,...x)}catch(v){let A=v instanceof Error?v.message:String(v);throw Error(`Error applying filter '${l}': ${A}`)}if(a.startsWith("|"))a=a.substring(1).trim();else break}return i}function kc(e){let t=!1,n="",i=0,a=0,u=0,l=!1;for(let f=0;f<e.length;f++){let x=e[f],v=e[f+1];if(t&&l){l=!1;continue}if(t&&x==="\\"){l=!0;continue}if(l=!1,(x==='"'||x==="'"||x==="`")&&!l){if(!t)t=!0,n=x;else if(x===n)t=!1,n="";continue}if(t&&n==="`"&&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==="(")i++;else if(x===")")i--;else if(x==="[")a++;else if(x==="]")a--;else if(x==="{")u++;else if(x==="}")u--;if(x==="|"&&i===0&&a===0&&u===0){if(v==="|"){f++;continue}if(v==="="){f++;continue}return f}}return-1}var rn=new Set,Cc=1000;function by(){rn.clear()}function Ps(e,t,n,i){if(!Q())return;let a=`${n}\x00${e.expression}`;if(rn.has(a))return;if(rn.size>=Cc)rn.clear();rn.add(a);let u=n,l=i;try{if(n&&Li.existsSync(n))l=Li.readFileSync(n,"utf8")}catch{}let f=l.indexOf(t);if(f>=0)u=`${n}:${l.slice(0,f).split(`
218
- `).length}`;console.warn(`${u}: 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,n=!1,i){try{let a=e.trim(),u=kc(a);if(u>0){let f=a.substring(0,u).trim(),x=a.substring(u+1).trim(),v=I(f,t,!0,i);return Mg(v,x,t)}let l=Qs(a);if(l!==null){i?.({expression:a,rule:l});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 u=/(\b\w+)\s+is not defined/.exec(a.message);if(u){let l=u[1],f=Rc(l,Object.keys(t));if(f&&f!==l)a.message=`${a.message} \u2014 did you mean '${f}'?`}}if(!n)console.error(`Error evaluating expression: ${e}`,a);throw a}}function Rc(e,t){let n=null;for(let a of t){if(a===e)continue;let u=Tc(e,a);if(n===null||u<n.dist)n={key:a,dist:u}}if(!n)return null;let i=Math.max(e.length,n.key.length);if(n.dist<=2||n.dist/i<=0.35)return n.key;return null}function Tc(e,t){if(e===t)return 0;if(e.length===0)return t.length;if(t.length===0)return e.length;let[n,i]=e.length<t.length?[e,t]:[t,e],a=Array(n.length+1),u=Array(n.length+1);for(let l=0;l<=n.length;l++)a[l]=l;for(let l=1;l<=i.length;l++){u[0]=l;for(let f=1;f<=n.length;f++){let x=n[f-1]===i[l-1]?0:1;u[f]=Math.min(u[f-1]+1,a[f]+1,a[f-1]+x)}for(let f=0;f<=n.length;f++)a[f]=u[f]}return a[n.length]}function wy(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 Ac from"process";function T(e="STX_PUBLIC_"){let t={},n={};for(let[i,a]of Object.entries(Ac.env)){if(!i.startsWith(e)||a===void 0)continue;t[`import.meta.env.${i}`]=JSON.stringify(a),n[i]=a}return t["import.meta.env"]=JSON.stringify(n),t}function Ji(e,t=""){let n=`${e}${t}`,i=0;for(let a=0;a<n.length;a++){let u=n.charCodeAt(a);i=(i<<5)-i+u,i=i&i}return`stx-${Math.abs(i).toString(36)}`}function Gi(e,t,n={}){let{prefix:i="",preserveHost:a=!0,scopeKeyframes:u=!0,scopeCustomProperties:l=!1}=n;if(!e.trim())return"";let f=Os(e),x=[],v=new Map;if(u)for(let A of f){let D=A.selector.match(/@keyframes\s+([a-z_-][a-z0-9_-]*)/i);if(D){let U=D[1],O=`${t}_${U}`;v.set(U,O)}}for(let A of f){let D=Yi(A,t,i,a,v,l);x.push(D)}return x.join(`
219
-
220
- `)}function Os(e){let t=[],n=e.replace(/\/\*[\s\S]*?\*\//g,""),i=0,a="",u=!1,l="";for(let f=0;f<n.length;f++){let x=n[f];if(x==="@"&&i===0)u=!0;if(x==="{")i++;else if(x==="}"){if(i--,i===0){if(u){l+=x;let v=l.match(/@([a-z-]+)\s*([^{]*)\{([\s\S]*)\}/i);if(v){let[,A,D,U]=v;if(A==="keyframes")t.push({selector:`@keyframes ${D.trim()}`,declarations:U.trim()});else if(A==="media"||A==="supports"||A==="container"){let O=Os(U);t.push({selector:`@${A} ${D.trim()}`,declarations:O.map((z)=>`${z.selector} { ${z.declarations} }`).join(`
221
- `)})}else t.push({selector:`@${A} ${D.trim()}`,declarations:U.trim()})}l="",u=!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(u)l+=x;else a+=x}return t}function Yi(e,t,n,i,a,u){let{selector:l,declarations:f}=e;if(l.startsWith("@")){if(l.startsWith("@keyframes")){let A=l.replace("@keyframes ","").trim();return`@keyframes ${a.get(A)||A} { ${f} }`}if(l.startsWith("@media")||l.startsWith("@supports")||l.startsWith("@container")){let D=Os(`x { ${f} }`.replace(/x \{ /,"").replace(/ \}$/,"")).map((U)=>Yi(U,t,n,i,a,u)).join(`
222
- `);return`${l} {
223
- ${D}
224
- }`}return`${l} { ${f} }`}let x=Ic(l,t,n,i),v=f;for(let[A,D]of a)v=v.replace(new RegExp(`\\b${A}\\b`,"g"),D);if(u)v=v.replace(/--([a-z-]+)/gi,`--${t}-$1`);return`${x} { ${v} }`}function Ic(e,t,n,i){let a=e.split(",").map((l)=>l.trim()),u=[];for(let l of a){if(l.startsWith(":host")){if(i)u.push(l);else{let v=l.replace(/:host(\([^)]*\))?/,`.${t}$1`);u.push(v)}continue}if(l.includes("::slotted")){u.push(l);continue}if(l===":root"){u.push(`:root .${t}`);continue}let f=n?`${n} .${t}`:`.${t}`;u.push(`${f} ${l}`);let x=Pc(l,t);if(x)u.push(n?`${n} ${x}`:x)}return u.join(", ")}function Pc(e,t){let n=0,i=e.length;for(let x=0;x<e.length;x++){let v=e[x];if(v==="["||v==="(")n++;else if(v==="]"||v===")")n--;else if(n===0&&(v===" "||v===">"||v==="+"||v==="~")){i=x;break}}let a=e.slice(0,i),u=e.slice(i);if(!a)return"";let l=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(n===0&&f===0&&v===":"){l=x;break}}return`${a.slice(0,l)}.${t}${a.slice(l)}${u}`}var to=String.raw`(?<![\w-])scoped(?![\w-])`,Ds=/<style\s+([^>]*)>/gi,Qi=/<style\s+([^>]*)>([\s\S]*?)<\/style>/gi,no=new RegExp(to,"i"),Oc=new RegExp(to,"gi"),Ms=/<style\b[^>]*\bdata-stx-scoped(?:=(?:"[^"]*"|'[^']*'|[^\s>]+))?[^>]*>[\s\S]*?<\/style>\s*/gi;function Dc(e){Ds.lastIndex=0;let t=Ds.exec(e);while(t!==null){if(no.test(t[1]))return!0;t=Ds.exec(e)}return!1}function Si(e){let t=new Set,n=[];Ms.lastIndex=0;let i=Ms.exec(e);while(i!==null){let a=i[0].trim();if(t.has(a))n.push({start:i.index,end:i.index+i[0].length});else t.add(a);i=Ms.exec(e)}return n}function wn(e){let t=Si(e);if(t.length===0)return e;let n=Array(t.length+1),i=0;for(let a=0;a<t.length;a++){let u=t[a];n[a]=e.slice(i,u.start),i=u.end}return n[t.length]=e.slice(i),n.join("")}function qs(e,t){if(!Dc(e))return{html:e,hasScoped:!1};let n=Ji(t),i=`data-v-${n}`,a=e,u=!1;if(Qi.lastIndex=0,a=a.replace(Qi,(l,f,x)=>{if(!no.test(f))return l;u=!0;let v=Mc(x,i),A=f.replace(Oc,"").trim(),D=A?` ${A}`:"";return`<style data-stx-scoped="${n}"${D}>${v}</style>`}),!u)return{html:e,hasScoped:!1};return a=Nc(a,i),{html:a,hasScoped:!0}}function Mc(e,t){return Gi(e,"__SCOPE_PLACEHOLDER__",{preserveHost:!1}).replace(/\.(__SCOPE_PLACEHOLDER__) /g,`[${t}] `).replace(/\.(__SCOPE_PLACEHOLDER__)/g,`[${t}]`)}var jc=(e)=>`\x00stx-scope-mask-${e}\x00`,eo=/\u0000stx-scope-mask-(\d+)\u0000/g;function Nc(e,t){let n=be(e,(a,u)=>{let l=J(a,u);return l>u?l:bn(a,u)},(a,u)=>jc(u)),i=Lc(n.output,t);return eo.lastIndex=0,i.replace(eo,(a,u)=>n.tokens[Number(u)])}function Lc(e,t){let n=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,(i,a,u)=>{if(n.has(a.toLowerCase()))return i;if(i.includes(t))return i;if(a.toLowerCase()==="style"||a.toLowerCase()==="script")return i;if(u)return i.replace(`<${a}${u}`,`<${a} ${t}${u}`);if(i.endsWith("/>"))return`<${a} ${t} />`;return`<${a} ${t}>`})}var an=/<\/?template\b[^>]*>/gi,zc=/(?:^|\s)(?:id\s*=|(?:x-|[@:])(?:for|if|else(?:-if)?)(?=\s|=|$)|#[\w-]+(?:\s*=|\s|$)|v-slot(?::[\w-]+)?(?=\s|=|$)|slot\s*=)/i;function Bc(e){let t=e.replace(/^<template\b/i,"").replace(/>$/,"");return zc.test(t)}function L(e){an.lastIndex=0;let t;while((t=an.exec(e))!==null){if(t[0].startsWith("</")||Bc(t[0]))continue;let n=t.index,i=an.lastIndex,a=1,u;while((u=an.exec(e))!==null)if(u[0].startsWith("</")){if(a--,a===0){let l=u.index;return{start:n,openEnd:i,closeStart:l,end:an.lastIndex,content:e.slice(i,l)}}}else a++;return null}return null}var Fc=0,ml=0;function Qn(e,t){let n=/(?:^|\s)([^\s=/>]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+)))?/g;for(let i of e.matchAll(n))if(i[1].toLowerCase()===t.toLowerCase())return i[2]??i[3]??i[4]??null;return null}function oo(e){let t=[],n=/<([a-z][a-z0-9-]*)\b((?:"[^"]*"|'[^']*'|[^>"'])*)>/iy;return w(e,(i,a)=>{n.lastIndex=a;let u=n.exec(i);if(!u||!Qn(u[2],"x-data"))return-1;return t.push({fullMatch:u[0],tagName:u[1],attributes:u[2],startIndex:a,endIndex:n.lastIndex}),n.lastIndex}),t}function hl(e){let t=[];for(let{fullMatch:n,tagName:i,attributes:a,startIndex:u}of oo(e)){let l=Qn(a,"x-data");if(!l)continue;let f=`__stx_scope_${Fc++}`,x=Qn(a,"x-init"),v=xl(e,i,u+n.length),A=e.slice(u,v.endIndex),D=bl(A);t.push({id:f,selector:`[data-stx-scope="${f}"]`,stateExpr:l,initExpr:x,bindings:[],refs:D})}return t}function xl(e,t,n){let i=1,a=n,u=new RegExp(`<${t}(?:\\s|>)`,"gi"),l=new RegExp(`</${t}>`,"gi"),f=new RegExp(`<${t}[^>]*/\\s*>`,"gi");while(i>0&&a<e.length){u.lastIndex=a,l.lastIndex=a,f.lastIndex=a;let x=u.exec(e),v=l.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)i++,a=x.index+x[0].length;else{if(i--,i===0)return{endIndex:v.index+v[0].length};a=v.index+v[0].length}}return{endIndex:e.length}}function bl(e){let t=new Map,n=e.replace(/x-data\s*=\s*"[^"]*"/gi,'x-data="__stripped__"').replace(/x-data\s*=\s*'[^']*'/gi,"x-data='__stripped__'"),i=/<[a-z][a-z0-9-]*\s+([^>]*x-ref\s*=\s*["']([^"']*)["'][^>]*)>/gi,a;while((a=i.exec(n))!==null){let[,u,l]=a,f=yl(u);t.set(l,f)}return t}function yl(e){let t=e.match(/\bid\s*=\s*["']([^"']*)["']/);if(t)return t[1];return`__stx_el_${ml++}`}function wl(){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 io(e,t){let n=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}}),i="",a=0,u=null;while(a<n.length){let f=n[a];if(u&&f==="\\"){i+=f+(n[a+1]??""),a+=2;continue}if(f==="{"&&n[a+1]==="{"){let x=n.indexOf("}}",a+2);if(x!==-1){let v=n.slice(a,x+2);i+=l(n.slice(a+2,x),v,u),a=x+2;continue}}if(u){if(f===u)u=null}else if(f==="'"||f==='"'||f==="`")u=f;i+=f,a++}return i;function l(f,x,v){let A;try{A=I(f,t,!0)}catch{return x}if(A===void 0)return x;if(v){let D=String(A).replace(/\\/g,"\\\\").replace(new RegExp(v==="`"?"`":v,"g"),`\\${v}`).replace(/\r/g,"\\r").replace(/\n/g,"\\n");return v==="`"?D.replace(/\$\{/g,"\\${"):D}if(typeof A==="string"){let D=A.trim();if(D.startsWith("{")&&D.endsWith("}")||D.startsWith("[")&&D.endsWith("]"))try{return JSON.parse(D),D}catch{}}return JSON.stringify(A)}}function Sl(e,t,n){if(e.length===0)return"";let i=e.map((a)=>{let u=JSON.stringify(Object.fromEntries(a.refs)),l=io(a.stateExpr,t),f=a.initExpr?io(a.initExpr,t):null,x=JSON.stringify(l),v=f?JSON.stringify(f):"null";return`
497
- (function() {
498
- var scopeEl = document.querySelector('${a.selector}');
499
- if (!scopeEl) return;
500
- var refs = ${u};
501
- window.__stx_reactive.initScope(scopeEl, ${x}, [], refs, ${v}${n?", true":""});
502
- })();`}).join(`
503
- `);return`
504
- <script data-stx-scoped data-stx-reactive data-stx-run="always">
505
- ${wl()}
506
- ${i}
507
- </script>`}function Qc(e,t,n,i=!1){if(!Ns(e))return e;let a=hl(e);if(a.length===0)return e;let u=$l(e,a),l=Sl(a,t,i),f=c(u);if(f!==-1)u=u.slice(0,f)+l+`
508
- `+u.slice(f);else u+=l;return u}function $l(e,t){let n=[],i=0;for(let[u,l]of oo(e).entries()){let f=t[u];if(!f)break;n.push(e.slice(i,l.startIndex));let x=Qn(l.attributes,"data-stx-scope");if(x)f.id=x,f.selector=`[data-stx-scope="${f.id}"]`,n.push(l.fullMatch);else n.push(`<${l.tagName} data-stx-scope="${f.id}"${l.attributes}>`);i=l.endIndex}n.push(e.slice(i));let a=n.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 Ns(e){return/x-data\s*=\s*["']/.test(e)}function Xs(e,t){let n=e,i=/@json\s*\(/g,a;while((a=i.exec(n))!==null){let u=a.index,l=u+a[0].length-1,f=1,x=l+1,v=null,A=!1;while(x<n.length&&f>0){let M=n[x];if(A){A=!1,x++;continue}if(M==="\\"&&v){A=!0,x++;continue}if(v){if(M===v)v=null;x++;continue}if(M==='"'||M==="'"||M==="`"){v=M,x++;continue}if(M==="(")f++;else if(M===")"){if(f--,f===0)break}x++}if(f!==0)break;let D=n.substring(l+1,x).trim(),U=n.substring(u,x+1),O=-1,z=0,V=null,F=!1;for(let M=0;M<D.length;M++){let ee=D[M];if(F){F=!1;continue}if(ee==="\\"&&V){F=!0;continue}if(V){if(ee===V)V=null;continue}if(ee==='"'||ee==="'"||ee==="`"){V=ee;continue}if(ee==="("||ee==="["||ee==="{")z++;else if(ee===")"||ee==="]"||ee==="}")z--;if(ee===","&&z===0){O=M;break}}let q=O>=0?D.substring(0,O).trim():D,H=O>=0?D.substring(O+1).trim():void 0;try{let M=q.trim(),ee;if(m(M))ee=p(M,Object.keys(t))(...Object.values(t));else ee=void 0;let oe;if(H==="true")oe=JSON.stringify(ee,null,2);else oe=JSON.stringify(ee);let ie=oe.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029");n=n.substring(0,u)+ie+n.substring(x+1),i.lastIndex=u+ie.length}catch(M){W.log(M instanceof Error?M:Error(String(M)),{directive:"@json"},"error"),i.lastIndex=u+U.length}}return n}function Gs(e){return e.replace(/@once\s*([\s\S]*?)@endonce/g,"$1")}function el(e){let t=e,n=/@memo\s*\(/g,i,a=[];while((i=n.exec(t))!==null){let u=i.index,l=u+i[0].length,f=1,x=l;while(x<t.length&&f>0){if(t[x]==="(")f++;else if(t[x]===")")f--;x++}if(f!==0)continue;let v=t.slice(l,x-1).trim(),A=x,D=t.slice(A),U=D.indexOf("@endmemo");if(U===-1)continue;let O=D.slice(0,U),z=A+U+8,V=Mt(O),F=O.slice(V),q=O.match(/(\s*)$/),H=q?q[0].length:0,M=F.slice(0,F.length-H),ee=M.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)?(\/?)>/),oe;if(ee){let[ie,ge,ye="",me]=ee,Pe=`<${ge}${ye} data-stx-memo="${v}"${me}>`;oe=O.slice(0,V)+Pe+M.slice(ie.length)+O.slice(V+M.length)}else oe=`${O.slice(0,V)}<div data-stx-memo="${v}">${M}</div>${O.slice(V+M.length)}`;a.push({start:u,end:z,replacement:oe}),n.lastIndex=z}for(let u=a.length-1;u>=0;u--){let l=a[u];t=t.slice(0,l.start)+l.replacement+t.slice(l.end)}return t.replace(/@memo="([^"]*)"/g,'data-stx-memo="$1"')}function ki(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 uo(e,t){let n=/<\/?([a-zA-Z][\w-]*)\b(?:"[^"]*"|'[^']*'|[^'">])*>/y,i=w(e,(f,x)=>{n.lastIndex=x;let v=n.exec(f);if(!v||/^(?:script|style)$/i.test(v[1]))return-1;return n.lastIndex}),a=[],u=0,l=[];for(let{start:f,end:x,token:v}of i){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))l.push(e.slice(u,f),v.replace(/\s*\/?>$/,(D)=>` data-stx-slot-owner="${t}"${D}`)),u=x;if(!Ls.has(A)&&!/\/>$/.test(v))a.push(A)}return l.push(e.slice(u)),l.join("")}function fo(e,t){if(!/\bref\s*=/.test(e))return e;let n=/<\/?([a-zA-Z][\w-]*)\b(?:"[^"]*"|'[^']*'|[^'">])*>/y,i=w(e,(x,v)=>{n.lastIndex=v;let A=n.exec(x);if(!A||/^(?:script|style)$/i.test(A[1]))return-1;return n.lastIndex}),a=[],u=0,l=0,f=[];for(let{start:x,end:v,token:A}of i){let D=/^<\/?([\w-]+)/.exec(A)[1].toLowerCase();if(A.startsWith("</")){let V;while(V=a.pop()){if(V.scoped)u--;if(V.name===D)break}continue}let U=/\sdata-stx-scope\s*=/.test(A),O=/\sdata-stx-ref-caller\s*=\s*(["'])(.*?)\1/.exec(A),z=a.find((V)=>V.scoped)?.scopeId;if(O&&z&&O[2]===z)f.push(e.slice(l,x),A.replace(O[0],` data-stx-ref-caller="${t}"`)),l=v;else if(!u&&!U&&/\s(?:ref|@ref|:ref|x-ref|data-stx-ref)\s*=/.test(A)&&!/\sdata-stx-ref-caller\s*=/.test(A))f.push(e.slice(l,x),A.replace(/\s*\/?>$/,(V)=>` data-stx-ref-caller="${t}"${V}`)),l=v;if(!Ls.has(D)&&!/\/>$/.test(A)){let V=/\sdata-stx-scope\s*=\s*(?:"([^"]*)"|'([^']*)')/.exec(A);if(a.push({name:D,scoped:U,scopeId:V?.[1]??V?.[2]}),U)u++}}return f.push(e.slice(l)),f.join("")}var Ls=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),po=/(?:^|\s)x-no-cloak(?:=|\s|\/|>|$)/,ao=/<\/?\s*([a-z][\w-]*)/iy,vl=/\s/;function El(e,t){let n=t-1;while(n>=0&&vl.test(e[n]))n--;return n>=0&&e[n]==="/"}function kl(e,t){let n=!1,i=!1;for(let a=t;a<e.length;a++){let u=e[a];if(n){if(u==="'")n=!1}else if(i){if(u==='"')i=!1}else if(u==="'")n=!0;else if(u==='"')i=!0;else if(u===">")return a}return-1}function Rl(e,t){if(e.indexOf("{",t)===-1||e.indexOf("}",t)===-1)return!1;let n=0,i=t,a=!1,u=!1,l=!1;while(i<e.length){let f=e.indexOf("<",i),x=f===-1?e.length:f;if(x>i){if(n===0)while(i<x){let D=e.indexOf(u?"}":"{",i);if(D===-1||D>=x){if(u)l=!1;else a=!1;break}if(D>i)if(u)l=!1;else a=!1;if(u){if(l)return!0;l=!0}else if(a)u=!0,l=!1;else a=!0;i=D+1}i=x;continue}if(e.startsWith("<!--",i)){let D=e.indexOf("-->",i);i=D===-1?e.length:D+3;continue}let v=kl(e,i);if(v===-1)break;ao.lastIndex=i;let A=ao.exec(e)?.[1]?.toLowerCase()??"";if(e[i+1]==="/"){if(n===0)break;n--}else if(!El(e,v)&&!Ls.has(A))n++;i=v+1}return!1}var co=S(256);function tl(e){if(e.length<1024)return lo(e);let t=_(e),n=co.get(t);if(n!==void 0)return n;let i=lo(e);return co.set(t,i),i}function lo(e){if(e.length>=32768&&!ai(e))return e;let n=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"),i="",a=0,u;while((u=n.exec(e))!==null){let l=u.index,f=l+u[0].length,x=!1,v=!1,A=-1;while(f<e.length){let U=e[f];if(x){if(U==="'")x=!1}else if(v){if(U==='"')v=!1}else if(U==="'")x=!0;else if(U==='"')v=!0;else if(U===">"){A=f;break}f++}if(A===-1)continue;let D=e.slice(l,A+1);if(po.test(D))continue;if(D.includes("x-cloak"))continue;if(Rl(e,A+1))i+=e.slice(a,A)+" x-cloak>",a=A+1}return i+=e.slice(a),i}var Tl=/(?:^|\s)(?::else-if|:if|:else|:show|x-else-if|x-if|x-else|x-show|@if|@show)(?:=|\s|\/|>|$)/,Al=/<\/script>/gi,Il=/<\/style>/gi;function nl(e){let t=/<[a-z][\w-]*/gi,n="",i=0,a;while((a=t.exec(e))!==null){let u=a.index,l=a[0].slice(1).toLowerCase();if(l==="script"||l==="style"){let z=l==="script"?Al:Il;z.lastIndex=u;let V=z.exec(e);if(V!==null)t.lastIndex=V.index+V[0].length;continue}let f=u+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 D=e.slice(u+a[0].length,A);if(po.test(D))continue;if(/(?:^|\s)x-cloak(?:=|\s|\/|>|$)/.test(D))continue;if(!Tl.test(D))continue;let U=e[A-1]==="/",O=U?A-1:A;n+=`${e.slice(i,O)} x-cloak${U?" ":""}`,i=O}return n+=e.slice(i),n}import To from"path";import tr from"fs";import cn from"path";function go(e,t,n,i){let a=0;for(let u=t;u<e.length;u++)if(e[u]===n)a++;else if(e[u]===i&&!(i===">"&&e[u-1]==="=")){if(--a===0)return u}return-1}function Pl(e){let t=r(e),n=0,i=0,a=[];for(let u=0;u<t.length;u++)if("([{".includes(t[u]))n++;else if(")]}".includes(t[u]))n--;else if(t[u]===","&&n===0)a.push(e.slice(i,u).trim()),i=u+1;return a.push(e.slice(i).trim()),a}function er(e,t){let n=r(e),i=new RegExp(`\\b(?:${t.map((a)=>a.replace(/[$]/g,"\\$&")).join("|")})\\s*(?=[<(])`,"g");for(let a of n.matchAll(i)){let u=a.index+a[0].length,l="";if(n[u]==="<"){let x=go(n,u,"<",">");if(x<0)continue;l=e.slice(u+1,x),u=x+1;while(/\s/.test(n[u]||"")&&u<n.length)u++}if(n[u]!=="(")continue;let f=go(n,u,"(",")");if(f>=0)return{type:l,args:Pl(e.slice(u+1,f))}}return null}var mo=`
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 ho(e,t){let n=[],i={defineProps:["defineProps"],defineEmits:["defineEmits"],withDefaults:["withDefaults"]},a=r(e),u=e.replace(/\bimport\s+(?:type\s+)?(\{[^}]*\}|\*\s+as\s+[\w$]+|[\w$]+)\s+from\s*(['"])([^'"]+)\2\s*;?/g,(U,O,z,V,F)=>{if(a.slice(F,F+6)!=="import")return U;if(V.endsWith(".stx"))return"";let q=`${t}Import${n.length}`;if(n.push(`import * as ${q} from ${JSON.stringify(V)};`),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((H)=>{let[M,ee=M]=H.trim().replace(/^type\s+/,"").split(/\s+as\s+/);if(!M)return"";if(/^(?:stx|@stacksjs\/stx)(?:\/|$)/.test(V)&&M in i)i[M].push(ee);return`import ${ee} = ${q}.${M};`}).join(`
517
- `)}),l=er(e,i.defineProps),f=er(e,i.defineEmits),x=er(e,i.withDefaults);if(!l&&!f)return{declarations:"",props:null,events:null};let v=[],A=null,D=null;if(l){v.push(`const __options = (${l.args[0]||"{}"}) as const;`),v.push(`const __defaults = (${x?.args[1]||"{}"});`);let U=l.type||"__StxOptions<typeof __options>";v.push(`export type __StxProps = __StxDefaults<${U}, 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[]>"};`),D=`${t}.__StxEvents`;return{declarations:`${n.join(`
518
- `)}
519
- namespace ${t} {
520
- ${u}
521
- ${v.join(`
522
- `)}
523
- }`,props:A,events:D}}var Rr=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 Ar(e){if(e.includes("-")||e==="component")return!1;if(/^[A-Z]/.test(e))return!/[a-z]/.test(e)&&[...Rr].some((t)=>t.toLowerCase()===e.toLowerCase());return Rr.has(e)||/[A-Z]/.test(e)}function*Ol(e){let t=/<([A-Za-z][\w.-]*)(?=[\s/>])/g,n;while(n=t.exec(e)){let i=t.lastIndex,a=[];while(i<e.length){while(/\s/.test(e[i]||""))i++;if(e[i]===">"||e.slice(i,i+2)==="/>"){i+=e[i]===">"?1:2;break}let u=/^[^\s=/>]+/.exec(e.slice(i))?.[0];if(!u){i++;continue}let l=i;i+=u.length;while(/\s/.test(e[i]||""))i++;if(e[i]!=="="){a.push({name:u,value:!0,offset:l,braced:!1});continue}i++;while(/\s/.test(e[i]||""))i++;let f=e[i],x=f==="{",v=f==='"'||f==="'";if(v||x)i++;let A=i;if(x){let D=r(e.slice(i)),U=1,O=0;for(;O<D.length;O++){if(D[O]==="{")U++;if(D[O]==="}"&&--U===0)break}i+=O}else if(v)while(i<e.length&&e[i]!==f)i++;else while(i<e.length&&!/[\s/>]/.test(e[i]))i++;if(a.push({name:u,value:e.slice(A,i),offset:A,braced:x}),v||x)i++}t.lastIndex=i,yield{name:n[1],offset:n.index,attributes:a}}}function xo(e,t,n){let i=[],a=[mo,"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;'],u=new Map,l=new Map,f=new Map,x=n.scriptCode(e,n.filePath),v=r(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 V=z[2],F=cn.isAbsolute(V)||V.startsWith(".")?cn.resolve(cn.dirname(n.filePath),V):Fs(V,cn.dirname(n.filePath));if(!F)continue;let q=F.endsWith(".stx")?F:tr.existsSync(`${F}.stx`)?`${F}.stx`:void 0,H=q?null:_r(F,!1),M=z[1].startsWith("{")?z[1].slice(1,-1).split(","):[z[1]];for(let ee of M){let[oe,ie=oe]=ee.trim().split(/\s+as\s+/),ge=q||H?.get(oe)||H?.get(oe.toLowerCase());if(ge)f.set(ie,ge),f.set(ie.toLowerCase(),ge),f.set(ie.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),ge)}}for(let z of t.matchAll(/@import\s*\(([^)]+)\)/g))for(let V of z[1].matchAll(/['"]([^'"]+)['"]/g)){let F=zs(V[1],n.filePath,n).find((q)=>tr.statSync(q,{throwIfNoEntry:!1})?.isFile());if(F)f.set(cn.basename(V[1]).replace(/\.stx$/,""),F)}let A={__importedComponents:f},D=new Map,U=(z,V,F)=>{let q=e.slice(0,z);return{code:V,offset:z,attribute:F,anchor:!0,kind:"directive",line:q.split(`
524
- `).length,column:z-q.lastIndexOf(`
525
- `)}},O=(z,V,F)=>i.push({expression:z,statement:{text:V+z.code+F,prefixLength:V.length}});for(let z of Ol(t)){if(Ar(z.name)||z.name==="component")continue;let V=zr(z.name,n.filePath,n,A);if(!V)continue;let F=D.get(V);if(!F){let H;try{H=n.readComponent?n.readComponent(V):tr.readFileSync(V,"utf8")}catch{continue}if(H===void 0)continue;l.set(V,H),F=ho(n.scriptCode(H,V),`__StxComponent${D.size}`),D.set(V,F),a.push(F.declarations)}let q=[];for(let H of z.attributes){let{name:M,offset:ee}=H,oe=H.value===!0?"true":H.value;if(M.startsWith("@")||M.startsWith("v-on:")){if(F.events&&H.value!==!0)u.set(ee,`__StxEvent<${F.events}, ${JSON.stringify(M.replace(/^@|^v-on:/,"").split(".")[0])}>`);continue}let ie=/^v-model(?::([\w-]+))?(?:\.[\w-]+)*$/.exec(M);if(M.startsWith("v-")&&!M.startsWith("v-bind:")&&!ie)continue;if(/^(?:x-|:)(?:if|for|show|key|else)(?:$|[.:-])/.test(M))continue;let ge=(ie?ie[1]||"modelValue":M.replace(/^:|^v-bind:/,"")).replace(/-([a-z])/g,(Ke,Ae)=>Ae.toUpperCase());if(q.push(ge),!F.props)continue;let ye=M.startsWith(":")||M.startsWith("v-bind:")||!!ie||H.braced,me=ye?oe:H.value!==!0?JSON.stringify(oe):"true",Pe=!ye&&H.value!==!0&&(oe==="true"||oe==="false");O(U(ee,me,M),";void ((",`) satisfies ${Pe?"__StxStaticProp":"__StxProp"}<${F.props}, ${JSON.stringify(ge)}>);`)}if(F.props){let H=[...new Set(q)].map((ee)=>`${JSON.stringify(ee)}: undefined as any`).join(", "),M=U(z.offset,`<${z.name}>`);i.push({expression:M,statement:{text:`;void ({ ${H} } satisfies ${F.props} & Record<string, unknown>);`,prefixLength:0}})}}return{declarations:D.size?a.join(`
526
- `):"",checks:i,events:u,dependencies:l}}var bo=/<script(\s[^>]*)?>([\s\S]*?)<\/script>/gi;function Dl(e){let t=(n)=>n.replace(/[^\n]/g," ");return e.replace(/<!--[\s\S]*?-->/g,t).replace(/\{\{--[\s\S]*?--\}\}/g,t)}function lt(e){let t=[],n=Dl(e);bo.lastIndex=0;let i;while((i=bo.exec(n))!==null){let a=(i[1]||"").trim(),u=(i[0].match(/^<script(?:\s[^>]*)?>/i)?.[0]??"<script>").length,l=(i[0].match(/<\/script\s*>$/i)?.[0]??"</script>").length,f=i.index+u,x=i.index+i[0].length-l,v=e.slice(f,x);if(/\bsrc\s*=/.test(a))continue;let A=a.match(/\btype\s*=\s*["']([^"']+)["']/i);if(A&&!/^(?:module|text\/(?:javascript|typescript))$/i.test(A[1]))continue;let D=/\bserver\b/.test(a)?"server":/\bclient\b/.test(a)?"client":"plain",U=ln(e,f);t.push({kind:D,code:v,startLine:U,startColumn:un(e,f),offset:f,attrs:a})}return t}function ln(e,t){let n=1;for(let i=0;i<t&&i<e.length;i++)if(e.charCodeAt(i)===10)n++;return n}function un(e,t){let n=e.lastIndexOf(`
527
- `,t-1)+1;return t-n+1}function es(e){let t=e.split(""),n=(a,u)=>{for(let l=a;l<u&&l<t.length;l++)if(t[l]!==`
528
- `)t[l]=" "},i=[/<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 i){a.lastIndex=0;let u;while((u=a.exec(e))!==null)n(u.index,u.index+u[0].length)}return t.join("")}function Ao(e){let t=0,n="";for(let i=0;i<e.length;i++){let a=e[i];if(n){if(a==="\\"){i++;continue}if(a===n)n="";continue}if(a==='"'||a==="'"||a==="`"){n=a;continue}if(a==="("||a==="["||a==="{"){t++;continue}if(a===")"||a==="]"||a==="}"){t--;continue}if(a==="|"&&t===0){if(e[i+1]==="|"){i++;continue}if(e[i-1]==="|")continue;return e.slice(0,i)}}return e}var Io=new Set([":for","x-for","v-for"]),ts=/(?:^|\s)((?::|x-|v-|@)[\w.:-]+)\s*=\s*(["'])([\s\S]*?)\2/g,nr="__stx_interpolated",yo="__StxElement",Po="__StxTemplateValue",Ml=`type ${Po}<T> = T extends { readonly _isSignal: true } | { readonly _isDerived: true } ? (T extends () => infer V ? T & V : T) : T`;function _o(e){return e.replace(/\{\{[\s\S]*?\}\}/g,nr).replace(/\{!![\s\S]*?!!\}/g,nr)}function jl(e,t,n){let i=0;for(let a=t;a<e.length;a++){let u=e[a];if(u==="{"){i++;continue}if(u!=="}"&&u!=="!")continue;if(e.startsWith(n,a)&&i===0)return a;if(u==="}"&&i>0)i--}return-1}function yi(e,t,n="0"){let i=`__stxScript${n}`;while((e+t).includes(i))i+="_";let a=new Map,u=[],l=[],f=r(e),x=zo(e),v=[],A=0;for(let F=0;F<f.length;F++){let q=f.startsWith("{{",F);if(!q&&!f.startsWith("{!!",F))continue;let H=q?2:3,M=q?"}}":"!!}",ee=jl(f,F+H,M);if(ee<0)continue;let oe=F,ie=e.slice(oe,ee+M.length),ge=ie.slice(H,-M.length);F=ee+M.length-1;let ye=l.length,me=rr(x,oe),Pe=rr(x,oe+(q?2:3));l.push({code:Ao(ge),...Pe});let Ke=`${i}_${ye}`,Ae=ie.split(`
529
- `),Je=Ae[0].length;Ae[0]=Ke+" ".repeat(Math.max(0,Je-Ke.length));for(let nt=1;nt<Ae.length;nt++)Ae[nt]=Ae[nt].replace(/[^\r]/g," ");let et=a.get(me.line)??[],Ye=et.at(-1),it=me.column+(Ye?Ye.generatedEnd-Ye.sourceEnd:0);et.push({sourceStart:me.column,sourceEnd:me.column+Je,generatedStart:it,generatedEnd:it+Ae[0].length}),a.set(me.line,et),v.push(e.slice(A,oe),Ae.join(`
530
- `)),A=oe+ie.length}v.push(e.slice(A));let D=v.join("");if(!l.length)return{code:D,columns:a,declarations:u};let{imports:U,body:O}=Do(t),z=[],V=0;for(let F of U.split(/\n(?=import\b)/)){if(!F.trim())continue;let q=/^import\s+(?:type\s+)?([\s\S]+?)\s+from\s*(['"][^'"]+['"])/.exec(F);if(!q){u.push({text:F});continue}let H=`${i}Module${V++}`;u.push({text:`import * as ${H} from ${q[2]}`});let M=q[1],ee=/\{([\s\S]*?)\}/.exec(M);for(let ye of ee?.[1].split(",")??[]){let[me,Pe=me]=ye.trim().replace(/^type\s+/,"").split(/\s+as\s+/);if(me==="default")z.push(`const ${Pe} = ${H}.default; type ${Pe} = import(${q[2]}).default`);else if(me)z.push(`import ${Pe} = ${H}.${me}`)}let oe=M.replace(/\{[\s\S]*?\}/,""),ie=/\*\s+as\s+(\w+)/.exec(oe);if(ie)z.push(`import ${ie[1]} = ${H}`);let ge=/^\s*([\w$]+)/.exec(oe)?.[1];if(ge)z.push(`const ${ge} = ${H}.default; type ${ge} = import(${q[2]}).default`)}u.push({text:`namespace ${i}Scope {
531
- ${z.join(`
532
- `)}
533
- export async function read() {
534
- ${Us(O).replace(/^[ \t]*export[ \t]+(?=(?:const|let|var|function|async|class|interface|type)\b)/gm,"")}
535
- return {`});for(let[F,q]of l.entries())u.push({text:`value${F}: (`}),u.push({text:q.code,origin:{line:q.line,column:q.column}}),u.push({text:"),"});u.push({text:`}
536
- }
537
- }`});for(let F=0;F<l.length;F++)u.push({text:`declare var ${i}_${F}: Awaited<ReturnType<typeof ${i}Scope.read>>['value${F}']`});return{code:D,columns:a,declarations:u}}function wo(e,t){let n=0;for(let i of e){if(t<i.generatedStart)break;if(t<i.generatedEnd)return i.sourceStart+Math.min(t-i.generatedStart,i.sourceEnd-i.sourceStart);n=i.sourceEnd-i.generatedEnd}return t+n}var Nl=["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"],Ll=new RegExp(String.raw`^[ \t]*@(?:${Nl.join("|")})\b[ \t]*(\([^\n)]*\))?[ \t]*$`,"gm");function Us(e){return e.replace(Ll,(t)=>t.replace(/[^\n]/g," "))}var So=new Set(["x-cloak","x-ref","x-transition","x-teleport","v-slot","x-hydrate",":key","x-tooltip","x-tooltip-position"]);function gg(e){let t=es(e),n=[],i=/(@?)\{\{([\s\S]*?)\}\}|(@?)\{!!([\s\S]*?)!!\}/g,a;while((a=i.exec(t))!==null){if(a[1]||a[3])continue;let f=a[2]??a[4]??"",x=a[2]!==void 0?2:3,v=Ao(f);if(!v.trim())continue;let A=a.index+x+(v.length-v.trimStart().length);n.push({code:v.trim(),line:ln(t,A),column:un(t,A),offset:A,kind:"interpolation"})}let u=/@(if|elseif|else\s+if|unless)\b\s*\(/g;while((a=u.exec(t))!==null){let l=a.index+a[0].length-1,f=0,x=l;for(;x<t.length;x++){let U=t[x];if(U==="(")f++;else if(U===")"){if(f--,f===0)break}}if(f!==0)continue;let v=t.slice(l+1,x),A=v.trim();if(u.lastIndex=x+1,!A)continue;let D=l+1+(v.length-v.trimStart().length);n.push({code:A,line:ln(t,D),column:un(t,D),offset:a.index,kind:"condition"})}ts.lastIndex=0;while((a=ts.exec(t))!==null){let l=a[1],f=a[3]??"",x=l.replace(/\..*$/,"").replace(/^([^:].*?):.*$/,"$1");if(So.has(x)||So.has(l))continue;if(!f.trim())continue;let v=a.index+a[0].indexOf(a[2],a[0].indexOf(l)+l.length)+1;if(Io.has(x)){let D=f.match(/\s+(?:in|of)\s+/);if(!D||D.index===void 0)continue;let U=f.slice(D.index+D[0].length),O=D.index+D[0].length+(U.length-U.trimStart().length);n.push({code:_o(U.trim()),line:ln(t,v+O),column:un(t,v+O),offset:v+O,kind:"directive",attribute:x});continue}let A=f.length-f.trimStart().length;n.push({code:_o(f.trim()),line:ln(t,v+A),column:un(t,v+A),offset:v+A,kind:"directive",attribute:x})}return n.sort((l,f)=>l.line-f.line||l.column-f.column),n}var zl=2000;function Bl(e,t){let n=0,i=Math.min(e.length,t+zl);for(let a=t;a<i;a++){let u=e[a];if(u==="(")n++;else if(u===")"){if(n--,n===0)return e.slice(t+1,a)}}return null}function Wl(e){let t=new Map,n=(f,x)=>{let v=f.split(/[,[\]{}()\s]+/).filter(Boolean);for(let A of v){let D=A.replace(/^\.\.\./,"").trim();if(!/^\$?[A-Z_$][\w$]*$/i.test(D))continue;let U=v.length===1?x:void 0,O=t.get(D);if(!O)t.set(D,{name:D,iterable:U});else if(O.iterable!==U)O.iterable=void 0}},i=/^\$?[A-Z_$][\w$]*$/i,a=(f)=>{let x=f.trim();return i.test(x)?x:void 0};for(let f of e.matchAll(/@for(?:each|else)\s*\(/g)){let x=Bl(e,f.index+f[0].length-1);if(x===null)continue;let v=jt(x);if(!v)continue;n(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))n(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))n(f[1]);let u=es(e);ts.lastIndex=0;let l;while((l=ts.exec(u))!==null){let f=l[1].replace(/\..*$/,"");if(!Io.has(f))continue;let x=l[3].match(/\s+(?:in|of)\s+/);if(!x||x.index===void 0)continue;n(l[3].slice(0,x.index),a(l[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))n(x[1]);return[...t.values()].sort((f,x)=>f.name.localeCompare(x.name))}function Fe(e){let t=new Set;for(let n of e.matchAll(/^\s*(?:export\s+)?(?:const|let|var)\s+([\w$]+)/gm))t.add(n[1]);for(let n of e.matchAll(/^\s*(?:export\s+)?(?:async\s+)?function\s*\*?\s*([\w$]+)/gm))t.add(n[1]);for(let n of e.matchAll(/^\s*(?:export\s+)?class\s+([\w$]+)/gm))t.add(n[1]);for(let n of e.matchAll(/^\s*(?:export\s+)?(?:const|let|var)\s*[[{]([^\]}]*)[\]}]/gm))for(let i of n[1].split(",")){let a=i.split(":").pop().split("=")[0].replace(/^\.\.\./,"").trim();if(/^[A-Z_$][\w$]*$/i.test(a))t.add(a)}return[...t].sort()}var sr=["params","query","cookies","host","ip","setResponseStatus","setResponseHeader","notFound","request","url","definePageMeta","defineClientPayload","defineStore","props","$props"],Fl={$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 Wc(e=new Set){return[...sr.filter((t)=>!e.has(t)).map((t)=>`declare var ${t}: any`),...Object.entries(Fl).filter(([t])=>!e.has(t)).map(([,t])=>t)].join(`
538
- `)}function qc(e){return new Set([...e.matchAll(/^declare (?:function|const|let|var)\s+([A-Za-z_$][\w$]*)/gm)].map((t)=>t[1]))}function Oo(e){let t=/\bdefineClientPayload\s*\(\s*\{([\s\S]*?)\}\s*\)/g,n,i=!1,a=new Set,u=r(e);while((n=t.exec(u))!==null){i=!0;for(let l of Vl(n[1])){let f=l.split(":")[0].trim();if(/^[A-Za-z_$][\w$]*$/.test(f))a.add(f)}}return i?[...a]:null}function Vl(e){let t=[],n=0,i="";for(let a of e){if(a===","&&n===0){t.push(i),i="";continue}if(a==="("||a==="["||a==="{")n++;else if(a===")"||a==="]"||a==="}")n--;i+=a}return t.push(i),t.filter((a)=>a.trim().length>0)}function Do(e){let t=/^[ \t]*import\b[\s\S]*?(?:from\s*['"][^'"]*['"]|['"][^'"]*['"])[ \t]*;?[ \t]*$/gm,n=[],i=e.replace(t,(a)=>(n.push(a.trim()),a.split(`
539
- `).map(()=>"").join(`
540
- `)));return{imports:n.join(`
541
- `),body:i}}function ir(e){let t=r(e),n=Array(t.length),i=0;for(let f=0;f<t.length;f++){let x=t[f];if(x==="}"||x===")"||x==="]")i=Math.max(0,i-1);if(n[f]=i,x==="{"||x==="("||x==="[")i++}let a=[],u=/^[ \t]*(?:export[ \t]+)?(interface|type)[ \t]+([A-Za-z_$][\w$]*)/gm,l;while((l=u.exec(t))!==null){if(n[l.index]!==0)continue;let f=l[1],x=l[2],v;if(f==="interface"){let A=t.indexOf("{",l.index);if(A===-1)continue;let D=0;v=-1;for(let U=A;U<t.length;U++)if(t[U]==="{")D++;else if(t[U]==="}"&&--D===0){v=U+1;break}if(v===-1)continue}else{let A=0;v=t.length;for(let D=t.indexOf("=",l.index)+1;D<t.length;D++){let U=t[D];if(U==="{"||U==="["||U==="("||U==="<")A++;else if(U==="}"||U==="]"||U===")"||U===">")A--;else if(A<=0&&(U===";"||U===`
542
- `&&!/[=|&,<([{]\s*$/.test(t.slice(Math.max(0,D-40),D)))){v=U===";"?D+1:D;break}}}a.push({name:x,text:e.slice(l.index,v).replace(/^[ \t]*export[ \t]+/,"")}),u.lastIndex=v}return a}function Ul(e){let t=r(e),n=[],i=/^[ \t]*(?:export[ \t]+)?(?:const|let|var)[ \t]+/gm,a,u=0,l=0;while((a=i.exec(t))!==null){for(;l<a.index;l++){let v=t[l];if(v==="{"||v==="("||v==="[")u++;else if(v==="}"||v===")"||v==="]")u=Math.max(0,u-1)}if(u!==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===`
543
- `)){x=A===";"?v+1:v;break}}if(/\bdefineProps\s*(?:<|\()/.test(t.slice(a.index,x)))n.push(e.slice(a.index,x).replace(/^[ \t]*export[ \t]+/,"").trim())}return n}function bi(e){let t=e.filter((a)=>a.kind==="server").map((a)=>a.code).join(`
544
- `);if(/\bdefineProps\s*(?:<|\()/.test(r(t)))return t;let n=Mo(t),i=e.filter((a)=>a.kind!=="server").flatMap((a)=>{let u=Ul(a.code);if(!u.length)return[];return[...ir(a.code).filter((l)=>!n.has(l.name)).map((l)=>l.text),...u]});return[t,...i].filter(Boolean).join(`
545
- `)}function Mo(e){return new Set(ir(e).map((t)=>t.name))}function Kc(e,t=""){let n=Oo(e),i=Mo(t),a=ir(e).filter((v)=>!i.has(v.name)).map((v)=>v.text);if(!n){let v=Fe(e).filter((A)=>!Dt(t,A));if(v.length===0&&a.length===0)return"";return["",`// ${Zl}`,...a,...v.map((A)=>`declare var ${A}: any`)].join(`
546
- `)}if(n.length===0)return a.length>0?["",`// ${vo}`,...a].join(`
547
- `):"";let{imports:u,body:l}=Do(e),f=l.replace(/^[ \t]*export[ \t]+(?=(?:const|let|var|function|async|class)\b)/gm,""),x=["",`// ${vo}`];if(u)x.push(u);return x.push(...a),x.push(`async function ${Eo}() {`,f,` return { ${n.join(", ")} }`,"}",`type ${ko} = Awaited<ReturnType<typeof ${Eo}>>`,...n.map((v)=>`declare var ${v}: ${ko}[${JSON.stringify(v)}]`)),x.join(`
548
- `)}function wi(e){let t=r(e),n=t.split(""),i=[],a=0,u=0;for(let f=0;f<n.length;f++){let x=n[f];if(x===`
549
- `)u=f+1;if(x==="{"||x==="("||x==="["){if(a===0&&x!=="("&&Hl.test(t.slice(u,f))){let v=jo(t,f);if(v!==-1)i.push(...No(t.slice(f,v+1)))}a++;continue}if(x==="}"||x===")"||x==="]"){a=Math.max(0,a-1);continue}if(a>0&&x!==`
550
- `)n[f]=" "}let l=Fe(n.join(""));return i.length===0?l:[...new Set([...l,...i])].sort()}var Hl=/^\s*(?:export\s+)?(?:const|let|var)\s*$/;function jo(e,t){let n=0;for(let i=t;i<e.length;i++){let a=e[i];if(a==="{"||a==="("||a==="[")n++;else if(a==="}"||a===")"||a==="]")n--;if(n===0)return i}return-1}function ql(e){let t=[],n=0,i=0;for(let a=0;a<e.length;a++){let u=e[a];if(u==="{"||u==="("||u==="[")n++;else if(u==="}"||u===")"||u==="]")n--;else if(u===","&&n===0)t.push(e.slice(i,a)),i=a+1}return t.push(e.slice(i)),t}function $o(e){let t=0;for(let n=0;n<e.length;n++){let i=e[n];if(i==="{"||i==="("||i==="[")t++;else if(i==="}"||i===")"||i==="]")t--;else if(t===0&&(i===":"||i==="="))return{index:n,char:i}}return null}function No(e){let t=[],n=(a)=>{let u=a.trim().replace(/^\.\.\./,"").trim();if(u.startsWith("{")||u.startsWith("[")){let f=jo(u,0);if(f!==-1)t.push(...No(u.slice(0,f+1)));return}let l=$o(u);if(l)u=u.slice(0,l.index).trim();if(/^[A-Z_$][\w$]*$/i.test(u))t.push(u)},i=e.slice(1,-1);for(let a of ql(i)){if(!a.trim())continue;if(e[0]==="["){n(a);continue}let u=$o(a);n(u?.char===":"?a.slice(u.index+1):a)}return t}function Xc(e,t){if(Oo(e)!==null)return[];let n=wi(e),i=Le(t,new Set(n)),a=new Set(C);return n.filter((u)=>{if(a.has(u))return!1;if(Dt(t,u))return!1;return i.has(u)})}var vo="stx: types for the declared client payload (#1868)",Zl="stx: untyped bridge names \u2014 declare a defineClientPayload to check these (#1868)",Eo="__stxServerScope",ko="__StxClientPayload";var Co=["$env","$user","$slot","$slots","$attrs","$props","$page","$route","$loop","loop","$errors","$csrf","$native","props","slot"];var Kl=/^\s*[A-Z_$][\w$]*\s*=[^=]/i;function Xl(e){let t=new Map,n=/!|===|!==|==|!=|&&|\|\||<|>|\btypeof\b|\binstanceof\b|\bin\b/;for(let i of e){let a=r(i),{depths:u,balanced:l}=Y(a);if(!l)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(u[v+x[1].length]!==0)continue;let A=x[2],D=v+x[0].length-x[3].length,U=i.slice(D,v+x[0].length).trim().replace(/;$/,"").trim(),O=x[3],z=n.test(O)&&!/\bawait\b|=>|\bfunction\b|[{}]/.test(O)&&!/[,+\-*/%&|?:=]$/.test(U)&&Y(O).balanced;t.set(A,t.has(A)||!z?null:U)}}return new Map([...t].filter((i)=>i[1]!==null))}function Lo(e,t,n=0,i=new Set){if(t.size===0||n>=5)return e;let a=r(e),u="",l=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||i.has(v))continue;let D=a.slice(0,x).trimEnd(),U=a.slice(x+v.length).trimStart();if(D.endsWith(".")||/^:(?!:)/.test(U)&&/[{,]$/.test(D))continue;if(x>0&&/[\w$]/.test(a[x-1]))continue;u+=`${e.slice(l,x)}(${Lo(A,t,n+1,new Set([...i,v]))})`,l=x+v.length}return u+e.slice(l)}function Jl(e,t){let n=/@(if|unless|elseif|else|endif|endunless)\b\s*(\()?/g,i=[],a;while((a=n.exec(e))!==null){if(a.index>t)break;let u=a[1];if(a.index===t){if(u==="elseif"){let f=i[i.length-1];if(f?.current)f.seen.push(f.current);if(f)f.current=null}break}if(u==="endif"||u==="endunless"){i.pop();continue}let l="";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}}l=e.slice(v,x).trim(),n.lastIndex=x+1}if(u==="if")i.push({seen:[],current:l});else if(u==="unless")i.push({seen:[],current:`!(${l})`});else if(u==="elseif"||u==="else"){let f=i[i.length-1];if(!f)continue;if(f.current)f.seen.push(f.current);f.current=u==="elseif"?l:null}}return i.flatMap((u)=>[...u.seen.map((l)=>`!(${l})`),...u.current?[u.current]:[]]).filter(Boolean)}function Gl(e){let t=e.code.trim();if(!t)return null;if(e.attribute?.startsWith("@")){if(Kl.test(t))return null;let i=";(($event: any): void => { ";return{text:`${i}${t} });`,prefixLength:i.length}}let n=";void ((";return{text:`${n}${t}));`,prefixLength:n.length}}var Yl=/(\bfrom\s*|\bimport\s*\(\s*|\bimport\s+)(['"])(\.{1,2}\/[^'"\n]*)\2/g;function Ro(e,t){return Ws(e,t).code}function Ws(e,t){let n=new Map;if(!t)return{code:e,columns:n};let i=zo(e),a=[],u=0;for(let l of e.matchAll(Yl)){let f=l.index,[x,v,A,D]=l,U=To.resolve(t,D).replace(/\\/g,"/"),O=`${v}${A}${U}${A}`;if(a.push(e.slice(u,f),O),u=f+x.length,x.includes(`
551
- `))continue;let z=rr(i,f),V=n.get(z.line)??[],F=V.at(-1),q=z.column+(F?F.generatedEnd-F.sourceEnd:0);V.push({sourceStart:z.column,sourceEnd:z.column+x.length,generatedStart:q,generatedEnd:q+O.length}),n.set(z.line,V)}return a.push(e.slice(u)),{code:a.join(""),columns:n}}function Ql(e,t,n){let i=wo(e.importColumns?.get(t)??[],n);return wo(e.scriptColumns?.get(t)??[],i)}function vi(e){return" ".repeat(Math.max(0,(e.startColumn??1)-1))}function eu(e){let t=new Set,n=r(e);for(let i of n.matchAll(/\bimport\s+(?:type\s+)?([\w$*{}\s,]+?)\s+from\b/g)){let a=i[1],u=/\{([^}]*)\}/.exec(a);for(let v of u?.[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 l=a.replace(/\{[^}]*\}/,""),f=/\*\s*as\s+([A-Z_$][\w$]*)/i.exec(l);if(f)t.add(f[1]);let x=/^\s*([A-Z_$][\w$]*)/i.exec(l);if(x&&x[1]!=="type")t.add(x[1])}return[...t].sort()}function Gc(e,t={}){let n=lt(e),i=e.split(`
552
- `),a=Array.from({length:i.length},()=>""),u=new Map,l=new Map,f=new Map,x=[],v=bi(n),A=t.filePath&&t.templateExpressions!==!1?xo(e,es(e),{filePath:t.filePath,componentsDir:t.componentsDir,projectRoot:t.projectRoot,readComponent:t.readComponent,scriptCode:(V,F)=>lt(V).map((q)=>Ro(q.code,To.dirname(F))).join(`
553
- `)}):void 0,D=new Set,U=[];for(let[V,F]of n.entries()){let q=yi(vi(F)+F.code,v,String(V));for(let[oe,ie]of q.columns)l.set(F.startLine+oe-1,ie);for(let oe of q.declarations)x.push({text:Ro(oe.text,t.originDir??""),origin:oe.origin?{...oe.origin,line:oe.origin.line+F.startLine-1}:void 0});let H=Us(q.code),M=Ws(H,t.originDir??"");for(let[oe,ie]of M.columns)f.set(F.startLine+oe-1,ie);let ee=M.code.split(`
554
- `);ee.forEach((oe,ie)=>{let ge=F.startLine-1+ie;if(ge<a.length)a[ge]=oe,D.add(ge)}),U.push(F.startLine-1+ee.length-1)}for(let V of U){let F=a[V]?.trim()===""?V:V+1;if(F<a.length&&a[F].trim()===""&&(F===V||!D.has(F)))a[F]=";"}let O=(V,F)=>{for(let[q,H]of V.split(`
555
- `).entries())if(a.push(H),F)u.set(a.length,q===0?F:{...F,line:F.line+q,column:1,prefixLength:0})};for(let V of x)O(V.text,V.origin);if(t.globals!==!1){O("");let V=new Set([...n.flatMap((M)=>Fe(M.code)),...n.flatMap((M)=>eu(M.code))]),F=(M)=>{if(!V.has(M))O(`declare var ${M}: any`)};if(t.runtimeGlobals!==!1){if(!V.has("window"))O("declare var window: any");for(let M of C)F(M)}let q=[...new Set([...sr,...Ee,...Co])].filter((M)=>t.runtimeGlobals!==!1||!C.includes(M));if(t.contextScope==="global"){O("declare global {");for(let M of q)O(` var ${M}: any`);O("}")}else{for(let M of sr)F(M);for(let M of Ee)F(M);for(let M of Co)F(M)}O(`declare var ${nr}: any`);let H=new Set(n.flatMap((M)=>Fe(M.code)));O(`type ${yo}<T> = T extends readonly (infer E)[] ? E : T extends Iterable<infer E2> ? E2 : any`);for(let M of Wl(e)){if(H.has(M.name))continue;let ee=M.iterable&&H.has(M.iterable)?`${yo}<typeof ${M.iterable}>`:"any";O(`declare var ${M.name}: ${ee}`)}}if(t.templateExpressions!==!1){if(A?.declarations)for(let F of A.declarations.split(`
556
- `))O(F);let V=gg(e).map((F)=>{let q=A?.events.get(F.offset??-1);if(q){F.anchor=!0;let H=F.code.trim(),M=/^([\w$]+)\s*=\s*([^=][\s\S]*)$/.exec(H),ee=M?`void ((${M[2]}) satisfies __StxAssignedValue<typeof ${M[1]}>)`:/^[\w$]+(?:\.[\w$]+)*$/.test(H)?`${H} satisfies (($event: ${q}) => unknown)`:H,oe=`;(($event: ${q}): void => { `;return{expression:F,statement:{text:`${oe}${ee} });`,prefixLength:oe.length}}}return{expression:F,statement:Gl(F)}}).filter((F)=>F.statement!==null);if(V.push(...A?.checks||[]),V.length>0){let F=es(e),q=Yn(F),H=Xl(n.map((ie)=>ie.code)),ee=[...new Set(n.flatMap((ie)=>Fe(ie.code)))].filter((ie)=>/^[A-Z_$][\w$]*$/i.test(ie)),oe=0;if(ee.length>0){O(Ml);for(let ie of ee)O(`function __StxRead_${ie}() { return ${ie} }`),O(`type __StxT_${ie} = ${Po}<ReturnType<typeof __StxRead_${ie}>>`);O(`;((${ee.map((ie)=>`${ie}: __StxT_${ie}`).join(", ")}) => {`),oe=1}for(let{expression:ie,statement:ge}of V){let ye=" ".repeat(oe),me=ie.offset===void 0?[]:q.filter((Ye)=>ie.offset>=Ye.start&&ie.offset<Ye.end),Pe=me.map((Ye)=>`;((${Ye.binding.replace(/[\r\n]/g," ")}: any) => { `).join(""),Ke=" });".repeat(me.length),Ae=ie.offset===void 0?[]:Jl(F,ie.offset),Je=Ae.length>0?`${Ae.map((Ye)=>`if (${Lo(Ye,H)}) `).join("")}{ `:"",et=Ae.length>0?" }":"";O(ye+Pe+Je+ge.text+et+Ke,{line:ie.line,column:ie.column,expression:ie,prefixLength:ge.prefixLength+ye.length+Pe.length+Je.length,guardPrefixLength:ye.length+Pe.length+Je.length})}if(oe>0)O("});")}}let z=!1;if(t.reference&&a[0]!==void 0&&a[0].trim()==="")a[0]=`/// <reference path=${JSON.stringify(t.reference.replace(/\\/g,"/"))} />`,z=!0;return O("export {}"),{text:a.join(`
557
- `),lineMap:u,sourceLineCount:i.length,componentDependencies:A?.dependencies,referenced:z,scriptColumns:l,importColumns:f}}function zo(e){let t=[0];for(let n=0;n<e.length;n++)if(e.charCodeAt(n)===10)t.push(n+1);return t}function rr(e,t){let n=0,i=e.length-1;while(n<i){let a=Math.ceil((n+i)/2);if(e[a]<=t)n=a;else i=a-1}return{line:n+1,column:t-e[n]+1}}function Jc(e,t){if(!e.expression)return!1;return e.inGuard===!0||t===2774}function xi(e,t,n){let i=e.lineMap.get(t);if(!i)return t<=e.sourceLineCount?{line:t,column:Ql(e,t,n)}:null;let a=i.expression?.anchor?0:Math.max(0,n-1-(i.prefixLength??0));return{line:i.line,column:i.column+a,expression:i.expression,inGuard:n<=(i.guardPrefixLength??0)}}var or=S(256),tu=[{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"}],Bo=/(?:\/\/|\/\*|\{\{--)\s*stx-strict-ignore(-next-line)?([^\n*}]*)/g;function nu(e){let t=Array.from(e,(a)=>a===`
558
- `?`
559
- `:" "),n=0,i="";while(n<e.length){let a=e[n],u=e[n+1];if(i){if(a==="\\"){n+=2;continue}if(a===i)i="";n++;continue}if(a==='"'||a==="'"||a==="`"){i=a,n++;continue}if(a==="/"&&u==="/"){while(n<e.length&&e[n]!==`
560
- `)t[n]=e[n],n++;continue}if(a==="/"&&u==="*"){let l=e.indexOf("*/",n+2),f=l===-1?e.length:l+2;for(;n<f;n++)t[n]=e[n];continue}if(a==="{"&&u==="{"&&e.slice(n,n+4)==="{{--"){let l=e.indexOf("--}}",n+4),f=l===-1?e.length:l+4;for(;n<f;n++)t[n]=e[n];continue}n++}return t.join("")}function su(e){let t=new Map,n=nu(e).split(`
561
- `),i=e.split(`
562
- `);return n.forEach((a,u)=>{Bo.lastIndex=0;for(let l of a.matchAll(Bo)){let f=l[1]==="-next-line",x=(i[u]??"").slice(0,l.index).trim(),v=f||x===""?u+2:u+1,D=(l[2]??"").split("--")[0].split(/[\s,]+/).filter(Boolean),U=D.filter((z)=>/\w/.test(z));if(D.length>0&&U.length===0)continue;let O=t.get(v);if(O&&O.size===0)continue;if(U.length===0){t.set(v,new Set);continue}if(O)U.forEach((z)=>O.add(z));else t.set(v,new Set(U))}}),t}function ru(e,t,n){let i=e.get(t);if(!i)return!1;if(i.size===0)return!0;return[...i].some((a)=>n.includes(a))}function je(e,t,n,i){let a=typeof n==="boolean"?{enabled:n,failOnViolation:n}:n??{enabled:!1};if(!a.enabled)return;let u=_(e,t,i,JSON.stringify(a)),l=or.get(u);if(l!==void 0){if(l&&a.failOnViolation)throw new Z(l,i??t);return}let f=a.allowPatterns??[],x=su(e),v=[],A=r(e.replace(/\{\{--[\s\S]*?--\}\}/g,(z)=>z.replace(/[^\n]/g," ")));for(let{pattern:z,message:V,suggestion:F}of tu){if(f.some((H)=>/\w/.test(H)&&V.includes(H)))continue;z.lastIndex=0;let q=A.match(z);if(q&&q.length>0){let H=A.split(`
563
- `),M=e.split(`
564
- `),ee=[];if(H.forEach((ye,me)=>{if(z.lastIndex=0,z.test(ye)&&!ru(x,me+1,V))ee.push(me+1)}),ee.length===0&&H.some((ye)=>(z.lastIndex=0,z.test(ye))))continue;let oe=ee.length>0?` (script line${ee.length>1?"s":""} ${ee.join(", ")})`:"",ie=ee.slice(0,3).map((ye)=>` ${ye} | ${(M[ye-1]??"").trim().slice(0,100)}`).join(`
565
- `),ge=ie?`
566
- ${ie}`:"";v.push(` \u2717 ${V}${oe}
567
- \u2192 ${F}${ge}`)}}if(v.length===0){or.set(u,"");return}let D=(z)=>{let V=`${process.cwd()}/`;return z.startsWith(V)?z.slice(V.length):z},O=`[STX] DOM API violation in ${i&&i!==t?`${D(i)} (composed into ${D(t)})`:D(t)}:
568
- ${v.join(`
569
- `)}
570
- Tip: prefer useRef(), navigate(), and composables for component code`;if(or.set(u,O),console.warn(O),a.failOnViolation)throw new Z(O,i??t)}var iu=[{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"}],ou=[{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')"}],au=[{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 _g(e){let t=[],n=[];return cu(e,t),lu(e,t,n),uu(e,n),fu(e,t),{valid:t.length===0,errors:t,warnings:n}}function cu(e,t){let n=(e.match(/\{\{/g)||[]).length,i=(e.match(/\}\}/g)||[]).length;if(n!==i)t.push({type:"expression",message:`Unclosed expression brackets: found ${n} opening '{{' and ${i} closing '}}'`,suggestion:"Ensure every {{ has a matching }}"})}function lu(e,t,n){for(let i of iu){let a=new RegExp(`${i.open}(?:\\s|\\()`,"g"),u=new RegExp(i.close,"g"),l=(e.match(a)||[]).length,f=(e.match(u)||[]).length;if(i.altClose){let x=new RegExp(i.altClose,"g");f+=(e.match(x)||[]).length}if(l>f)t.push({type:"directive",message:`Unclosed @${i.name} directive: found ${l} opening and ${f} closing`,suggestion:`Add ${l-f} missing ${i.close} tag(s)`});else if(f>l)n.push({type:"directive",message:`Extra ${i.close} found: ${f-l} more closing than opening`,suggestion:`Check for orphaned ${i.close} tags`})}}function uu(e,t){for(let n of ou)if(n.pattern.test(e))t.push({type:"syntax",message:n.message,suggestion:n.suggestion})}function fu(e,t){for(let n of au)if(n.pattern.test(e))t.push({type:"expression",message:`Security warning: ${n.message}`,suggestion:"Remove dangerous code from template expressions"})}function Cg(e,t){let n=e.slice(0,t).split(`
571
- `);return{line:n.length,column:n[n.length-1].length+1}}function Eg(e,t,n){let i=[];switch(e){case"if":case"elseif":case"unless":if(n.length===0)i.push({type:"syntax",message:`@${e} requires a condition`,suggestion:`Use @${e}(condition)`});break;case"foreach":if(n.length===0||!n[0].includes(" as "))i.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(n.length===0)i.push({type:"syntax",message:"@for requires loop parameters",suggestion:"Use @for(let i = 0; i < 10; i++)"});break;case"switch":if(n.length===0)i.push({type:"syntax",message:"@switch requires an expression",suggestion:"Use @switch(expression)"});break;case"case":if(n.length===0)i.push({type:"syntax",message:"@case requires a value",suggestion:"Use @case(value)"});break;case"include":case"extends":case"component":if(n.length===0)i.push({type:"syntax",message:`@${e} requires a path`,suggestion:`Use @${e}('path/to/template')`});break}return i}function Tg(e){return/@[a-z]+/i.test(e)||/\{\{/.test(e)}function $g(e){let t=e.matchAll(/@([a-z]+)/gi),n=new Set;for(let i of t){let a=i[1].toLowerCase();if(!a.startsWith("end"))n.add(a)}return Array.from(n)}function Wo(e,t,n){let i=/^<script\b([^>]*)>/i.exec(e);if(!i||!/(?:^|\s)src\s*=/i.test(i[1]??""))return null;return R(i[0],t,n)+e.slice(i[0].length)}var fn=new P(500),lr=new Map;function Fo(e){try{let t=is.statSync(e);return`${t.size}:${t.mtimeMs}`}catch{return""}}var ss=new P(1000),ur=new Map,fr=new P(2000),pr=new P(500),Go=33554432,dr=Go;function pu(e){let t=e.componentRenderCacheBytes;if(typeof t!=="number"||t<0||t===dr)return;dr=t,rs.setMaxBytes(t)}var rs=new P(2000,{maxBytes:Go,sizeOf:(e)=>e.output.length});function du(e){let t=new WeakSet;try{let n=(i)=>{if(i===void 0)return{__stxType:"undefined"};if(typeof i==="bigint")return{__stxType:"bigint",value:i.toString()};if(typeof i==="function"||typeof i==="symbol")throw TypeError("Non-serializable component input");if(i===null||typeof i!=="object")return i;if(t.has(i))throw TypeError("Circular component input");t.add(i);try{if(i instanceof Date)return{__stxType:"date",value:i.toISOString()};if(Array.isArray(i))return i.map(n);let a=Object.getPrototypeOf(i);if(a!==Object.prototype&&a!==null)throw TypeError("Non-plain component input");let u={};for(let l of Object.keys(i).sort())u[l]=n(i[l]);return u}finally{t.delete(i)}};return JSON.stringify(n(e))}catch{return null}}function gu(e){let t={};for(let[n,i]of Object.entries(e))if(!n.startsWith("__")||n==="__stxServeContext")t[n]=i;return t}function ar(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Js(e){let t=process.cwd(),n=`${t}\x00${e}`,i=Vo.get(n);if(i===void 0)i=Bun.hash(Yo(e,t).split(ue.sep).join("/")).toString(36).slice(0,6),Vo.set(n,i);return i}var Vo=new Map;function Yo(e,t){if(!ue.isAbsolute(e))return e;let n=(i)=>{try{return is.realpathSync(i)}catch{return i}};return ue.relative(n(t),n(e))}function Rg(e){return/\bjs\b/.test(e)||/\blang\s*=\s*["']?(js|javascript)["']?/i.test(e)}function Ve(e){return!Rg(e)}var ns=new Map;function re(e){let t;try{t=JSON.stringify(e)}catch{return new Bun.Transpiler(e)}let n=ns.get(t);if(n)return n;if(ns.size>=16)ns.clear();let i=new Bun.Transpiler(e);return ns.set(t,i),i}var Uo=new WeakMap,mu=256;function Ue(e){try{let t=re({loader:"ts",target:"browser",define:T()}),n=Uo.get(t);if(!n)n=new Map,Uo.set(t,n);let i=n.get(e);if(i!==void 0)return i;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 u=[];a=a.replace(/\{!![\s\S]*?!!\}/g,(f)=>{let x=u.length;return u.push(f),`"__STX_EXPR_${x}__"`}),a=a.replace(/\{\{\{[\s\S]*?\}\}\}/g,(f)=>{let x=u.length;return u.push(f),`"__STX_EXPR_${x}__"`}),a=a.replace(/\{\{[\s\S]*?\}\}/g,(f)=>{let x=u.length;return u.push(f),`"__STX_EXPR_${x}__"`});let l=t.transformSync(a);for(let f=0;f<u.length;f++)l=l.replace(`"__STX_EXPR_${f}__"`,u[f]),l=l.replace(`'__STX_EXPR_${f}__'`,u[f]);if(n.size>=mu){let f=n.keys().next();if(!f.done)n.delete(f.value)}return n.set(e,l),l}catch(t){if(process.env.STX_DEBUG_TS)console.warn("[STX] TypeScript transpilation error:",t);return e}}function hu(e){let t=[],n=new Set,i=0,a=0,u=e.length,l=(O)=>{a++;while(a<u){if(e[a]==="\\"){a+=2;continue}if(e[a]===O){a++;return}a++}},f=()=>{a++;while(a<u){if(e[a]==="\\"){a+=2;continue}if(e[a]==="`"){a++;return}if(e[a]==="$"&&e[a+1]==="{"){a+=2;let O=1;while(a<u&&O>0)if(e[a]==="{")O++,a++;else if(e[a]==="}")O--,a++;else if(e[a]==="'"||e[a]==='"')l(e[a]);else if(e[a]==="`")f();else a++;continue}a++}},x=()=>{if(e[a]==="/"&&e[a+1]==="/"){while(a<u&&e[a]!==`
572
- `)a++;return!0}if(e[a]==="/"&&e[a+1]==="*"){a+=2;while(a<u-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 V=O;while(V>0&&/[\w$]/.test(e[V-1]))V--;return v.has(e.slice(V,O+1))},D=()=>{a++;let O=!1;while(a<u&&e[a]!==`
573
- `){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<u&&/[a-z]/i.test(e[a]))a++;return}a++}},U=()=>{if(i!==0)return;let O=e.slice(a).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(O){let q=O[2].split(",").map((H)=>{let M=H.trim().split(":");return M[M.length-1].trim()});for(let H of q)if(H&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(H)&&!n.has(H))t.push(H),n.add(H);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(!n.has(q))t.push(q),n.add(q);return}let V=e.slice(a).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(V){let q=V[1];if(!n.has(q))t.push(q),n.add(q);return}let F=e.slice(a).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(F){let q=F[1];if(!n.has(q))t.push(q),n.add(q)}};while(a<u){if(x())continue;if(e[a]==="'"||e[a]==='"'){l(e[a]);continue}if(e[a]==="`"){f();continue}if(e[a]==="/"&&A()){D();continue}if(e[a]==="{"){i++,a++;continue}if(e[a]==="}"){i--,a++;continue}if(i===0&&/[a-z]/i.test(e[a])&&(a===0||/\s|[;{}()]/.test(e[a-1])))U();a++}return t}function xu(e){let t=[],n=0,i=0,a=null;for(let u=0;u<e.length;u++){let l=e[u];if(a){if(l==="\\"){u++;continue}if(l===a)a=null;continue}if(l==='"'||l==="'"||l==="`"){a=l;continue}if(l==="("||l==="["||l==="{")n++;else if(l===")"||l==="]"||l==="}")n--;else if(l===","&&n===0)t.push(e.slice(i,u)),i=u+1}if(i<e.length)t.push(e.slice(i));return t}function bu(e){let t=0,n=null;for(let i=0;i<e.length;i++){let a=e[i];if(n){if(a==="\\"){i++;continue}if(a===n)n=null;continue}if(a==='"'||a==="'"||a==="`"){n=a;continue}if(a==="("||a==="["||a==="{")t++;else if(a===")"||a==="]"||a==="}")t--;else if(a==="="&&t===0){let u=e[i-1],l=e[i+1];if(u==="!"||u==="<"||u===">"||u==="=")continue;if(l==="="||l===">")continue;return i}}return-1}function yu(e,t){try{let n=/=\s*(?:withDefaults\s*\([\s\S]*?defineProps|defineProps)\b/.exec(e);if(!n)return;let i=n.index-1;while(i>=0&&/\s/.test(e[i]))i--;if(e[i]!=="}")return;let a=i,u=0,l=-1;for(;i>=0;i--){let x=e[i];if(x==="}")u++;else if(x==="{"){if(u--,u===0){l=i;break}}}if(l===-1)return;let f=e.slice(l+1,a);for(let x of xu(f)){let v=x.trim();if(!v||v.startsWith("..."))continue;let A=bu(v);if(A===-1)continue;let D=v.slice(0,A).trim();if(!/^[A-Z_$][\w$]*$/i.test(D))continue;if(t[D]!==void 0)continue;let U=v.slice(A+1).trim();if(!U)continue;try{let O=Object.keys(t).filter(Ut),z=Function(...O,`"use strict"; return (${U});`);t[D]=z(...O.map((V)=>t[V]))}catch{}}}catch{}}var _u=new Set(["tr","td","th","thead","tbody","tfoot","caption","colgroup","col","option","optgroup","li","dt","dd","span"]);function Ag(e,t){let n=Mt(e),i=e.slice(n).match(/^<([a-zA-Z][a-zA-Z0-9-]*)/);if(!i)return null;let a=i[1].toLowerCase();if(!_u.has(a))return null;let u=new RegExp(`<\\/?${a}(?=[\\s/>])(?:[^>"']|"[^"]*"|'[^']*')*>`,"iy"),l=w(e,(A,D)=>(u.lastIndex=D,u.exec(A)?.index===D?u.lastIndex:-1));if(a==="span"&&/\sdata-stx-scope\s*=/.test(l[0]?.token||""))return null;let f=0,x=!1;for(let A of l){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=n+i[0].length;return e.slice(0,v)+t+e.slice(v)}function Qo(e,t){if(!e)return!1;return[...t.additionalComponentsDirs??[],...t.fallbackComponentsDir?[t.fallbackComponentsDir]:[]].some((i)=>{let a=ue.relative(ue.resolve(i),ue.resolve(e));return!a.startsWith("..")&&!ue.isAbsolute(a)})}async function Ir(e,t,n,i,a){let u=e.endsWith(".stx")?e.slice(0,-4):e,l=(ie)=>ie.split("-").map((ge)=>ge.charAt(0).toUpperCase()+ge.slice(1)).join(""),f=n.__importedComponents;if(f){for(let ie of[u,u.toLowerCase(),l(u),X(u)])if(f.has(ie))return!0}let x=[...new Set([`${u}.stx`,`${l(u)}.stx`,`${X(u)}.stx`])],v=typeof a.root==="string"?ue.resolve(a.root):void 0,A=v??ue.dirname(i),D=[],U=(ie)=>{if(ie&&!D.includes(ie))D.push(ie)};for(let ie of zn(i,v))U(ie);let O=n.__originalFilePath;if(O)U(ue.join(ue.dirname(O),"components"));if(Qo(t,a))U(a._rootComponentsDir);U(t),U(a._rootComponentsDir),U(ue.join(ue.dirname(i),"components")),U(a.componentsDir);for(let ie of a.additionalComponentsDirs??[])U(ie);let z=a._targetComponentFallbackNames?.some((ie)=>ie.toLowerCase()===u.toLowerCase());if(!z)for(let ie of a._targetComponentDirs??[])U(ie);if(v)U(ue.resolve(v,"resources/views/components")),U(ue.resolve(v,"resources/components")),U(ue.resolve(v,"src/components")),U(ue.resolve(v,"components"));for(let ie of a._layerComponentDirs??[])U(ie);let V=a._pluginComponentDirs;if(Array.isArray(V))for(let ie of V)U(typeof ie==="string"?ie:null);if(U(a.fallbackComponentsDir),z)for(let ie of a._targetComponentDirs??[])U(ie);let F=a._nativePrimitivesFallback;if(F&&!F.except.some((ie)=>ie.toLowerCase()===u.toLowerCase()))U(F.dir);if(u.startsWith("./")||u.startsWith("../"))return s(ue.resolve(ue.dirname(i),`${u}.stx`));let q=Ho(ue.resolve(import.meta.dir,"components")),H=D.map((ie)=>ue.isAbsolute(ie)?ie:ue.resolve(A,ie)),M=`${x.join("\x00")}\x00\x00${H.join("\x00")}`,ee=fr.get(M);if(ee!==void 0)return ee;let oe=!1;e:for(let ie of H){if(Ho(ie)===q)continue;for(let ge of x)if(await s(ue.join(ie,ge))){oe=!0;break e}}return fr.set(M,oe),oe}function Ho(e){let t=pr.get(e);if(t!==void 0)return t;let n=e;try{n=is.realpathSync(e)}catch{}return pr.set(e,n),n}function Pg(e){return e==="visible"||e==="idle"||e==="interaction"||e.startsWith("media:")}function ll(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 wu(e,t,n){if(!e.includes("{{")&&!e.includes("{!!"))return e;let i=(a,u)=>{let l;try{l=I(a,t)}catch{return u}if(l===void 0||l===null)return"";let f=String(l);if(/<\/style/i.test(f))return console.warn(`[stx] a <style> expression in ${n??"<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,u)=>i(u,a)).replace(/\{\{([\s\S]*?)\}\}/g,(a,u)=>i(u,a))}var qo=new Set;function Zo(e,t,n,i){let a=`${e}\x00${t}\x00${i??""}`;if(!process.env.STX_DEBUG&&qo.has(a))return;qo.add(a);let u=t?` used in ${t}`:"",l=i?` Cause: ${i}.`:"",f=n.length>0?`
574
- searched:
575
- ${n.map((x)=>` - ${x}`).join(`
576
- `)}`:"";console.error(`[stx] component <${e}> could not be resolved${u}, so it rendered as nothing.${l}${f}`)}function Ko(e){return`<!-- stx: component "${e.replace(/--+/g,"-")}" could not be resolved; see the server log -->`}var Su=new Set(["for","if","show","key","ref","class","className","style"]),Xo=new Set,ea="useMediaQuery|useDark|usePreferredDark|usePreferredLight|usePreferredReducedMotion|usePreferredContrast|useDocumentVisibility|useScrollLock",ul=new RegExp(`\\b(?:${ea})\\s*(?:<[^>]*>)?\\s*\\(`);function Ti(e){let t=new Set,n=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|${ea})\\s*(?:<[^>]*>)?\\s*\\(`,"g");for(let i of e){let a;while((a=n.exec(i))!==null)t.add(a[1]);n.lastIndex=0}return[...t]}async function We(e,t,n,i,a,u,l,f=new Set,x,v=ct(a),A,D=e){let{extractVariables:U}=await o("stx/variable-extractor",()=>import("./chunk-kz0txvqb.js")),O=f??new Set;if(O.has(e))return`[Circular component reference: ${e}]`;let z=new Set(O);z.add(e);let V=typeof t.client==="string"?t.client.trim():"";if("client"in t)delete t.client;let F=V&&V!=="load"&&Pg(V)?V:"";try{let q=(ce)=>ce.split("-").map((de)=>de.charAt(0).toUpperCase()+de.slice(1)).join(""),H=D.endsWith(".stx")?D.slice(0,-4):D,M=null,ee=a.__importedComponents;if(ee){let ce=[H,H.toLowerCase(),q(H),X(H)];for(let de of ce)if(ee.has(de)){M=ee.get(de);break}}let oe=[];if(!M){let ce=[`${H}.stx`,`${q(H)}.stx`,`${X(H)}.stx`],de=[...new Set(ce)],Se=a.__originalFilePath,xe=[];for(let _e of zn(u))if(!xe.includes(_e))xe.push(_e);let Ge=xe.length;for(let _e of l._layerComponentDirs??[])if(!xe.includes(_e))xe.push(_e);if(Se){let _e=ue.join(ue.dirname(Se),"components");xe.push(_e)}let Ie=l._rootComponentsDir;if(typeof Ie==="string"&&Qo(i,l)&&!xe.includes(Ie))xe.push(Ie);if(i&&!xe.includes(i))xe.push(i);if(typeof Ie==="string"&&!xe.includes(Ie))xe.push(Ie);let xt=ue.join(ue.dirname(u),"components");if(!xe.includes(xt))xe.push(xt);if(l.componentsDir&&l.componentsDir!==i&&!xe.includes(l.componentsDir))xe.push(l.componentsDir);for(let _e of l.additionalComponentsDirs??[])if(_e&&!xe.includes(_e))xe.push(_e);let Rt=l._nativeHostAttrs&&/^(?:checkbox|switch)$/i.test(H),_t=(A?.events??[]).map((_e)=>_e.replace(/^@/,"").split(".")[0].toLowerCase().replace(/-/g,"")),Rn=Object.hasOwn(t,"checked")||Boolean(A?.reactiveProps?.includes("checked")),ps=Object.hasOwn(t,"value")||Boolean(A?.reactiveProps?.includes("value")),ds=!_t.includes("valuechange")&&(Rn||_t.includes("change")&&!ps),$t=l._nativeHostAttrs&&/^textinput$/i.test(H),Tt=_t.includes("update:value")&&!_t.includes("input"),tn=l._nativeHostAttrs&&/^video$/i.test(H),gs=l._nativeHostAttrs&&/^image$/i.test(H),An=Hs([...Object.keys(t),...A?.reactiveProps??[]],A?.events,t),At=Object.hasOwn(t,"src")||Boolean(A?.reactiveProps?.includes("src")),In=Object.hasOwn(t,"source")||Boolean(A?.reactiveProps?.includes("source")),Pn=tn&&(At||In)&&(A?.events??[]).every((_e)=>/^(?:play|pause|ended|timeupdate|loadedmetadata|loadstart|error)$/.test(_e.replace(/^@/,"").split(".")[0])),On=new Set(["","primary","secondary","outline","ghost","danger"]),Dn=typeof t.variant==="string"?t.variant.trim().toLowerCase():"",Mn=l._nativeHostAttrs&&/^button$/i.test(H)&&!On.has(Dn),wr=l._targetComponentFallbackNames?.some((_e)=>_e.toLowerCase()===H.toLowerCase())??!1,ms=wr&&(!Rt||ds)&&(!$t||Tt)&&(!tn||Pn)&&(!gs||An)&&!Mn;for(let _e of ms?[]:l._targetComponentDirs??[])if(_e&&!xe.includes(_e))xe.push(_e);let It=typeof l.root==="string"?ue.resolve(l.root):void 0,Sr=It??ue.dirname(u),Pt=[];if(It)Pt.push(ue.resolve(It,"resources/views/components")),Pt.push(ue.resolve(It,"resources/components")),Pt.push(ue.resolve(It,"src/components")),Pt.push(ue.resolve(It,"components"));Pt.push(ue.resolve(import.meta.dir,"components"));for(let _e of Pt)if(!xe.includes(_e))xe.push(_e);if(wr){let _e=(l._componentPackageDirs??[]).filter((tt)=>typeof tt==="string"&&tt.length>0),bt=(ms?_e.length?_e:l._pluginComponentDirs??[]:l._targetComponentDirs??[]).filter((tt)=>typeof tt==="string"&&tt.length>0);if(bt.length){let tt=xe.slice(Ge).map((Qe)=>ue.isAbsolute(Qe)?Qe:ue.resolve(Sr,Qe)).filter((Qe)=>!bt.includes(Qe)),Nn=`${H}\x00${tt.join("\x00")}`,at=ur.get(Nn);if(at===void 0){at=!1;for(let Qe of tt){for(let vt of de)if(await s(ue.join(Qe,vt))){at=!0;break}if(at)break}ur.set(Nn,at)}if(!at){for(let Qe of bt){let vt=xe.indexOf(Qe);if(vt>=0)xe.splice(vt,1)}xe.splice(Ge,0,...bt)}}}let vr=l._pluginComponentDirs;if(Array.isArray(vr)){for(let _e of vr)if(typeof _e==="string"&&!xe.includes(_e))xe.push(_e)}if(l.fallbackComponentsDir&&!xe.includes(l.fallbackComponentsDir))xe.push(l.fallbackComponentsDir);if(ms){for(let _e of l._targetComponentDirs??[])if(_e&&!xe.includes(_e))xe.push(_e)}let jn=l._nativePrimitivesFallback;if(jn&&!jn.except.some((_e)=>_e.toLowerCase()===H.toLowerCase())&&!xe.includes(jn.dir))xe.push(jn.dir);let kr=[...new Set(xe.map((_e)=>{if(!_e)return _e;return ue.isAbsolute(_e)?_e:ue.resolve(Sr,_e)}))];xe.length=0,xe.push(...kr);let hs=`${H}\x00${u}\x00${kr.join("\x00")}`,xs=ss.get(hs);if(xs)if(await s(xs))M=xs;else ss.delete(hs);if(!M&&(H.startsWith("./")||H.startsWith("../")))M=ue.resolve(ue.dirname(u),`${H}.stx`),oe.push(M);else if(!M)for(let _e of xe){if(!_e)continue;for(let bt of de){let tt=ue.join(_e,bt);if(oe.push(tt),await s(tt)){M=tt;break}}if(M)break;if(!M)try{let bt=await import("fs");if(!bt.statSync(_e,{throwIfNoEntry:!1})?.isDirectory())continue;let Nn=8,at=[{path:_e,depth:0}];while(at.length>0&&!M){let Qe=at.pop();if(Qe.depth>=Nn)continue;let vt;try{vt=bt.readdirSync(Qe.path,{withFileTypes:!0})}catch{continue}for(let Ln of vt){if(!Ln.isDirectory())continue;if(Ln.name==="node_modules"||Ln.name.startsWith("."))continue;let Or=ue.join(Qe.path,Ln.name);for(let ga of de){let bs=ue.join(Or,ga);if(oe.push(bs),await s(bs)){M=bs;break}}if(M)break;at.push({path:Or,depth:Qe.depth+1})}}}catch{}if(M)break}if(M)ss.set(hs,M)}if(!M||!await s(M))return Zo(e,u,oe),Ko(e);x.add(M);let ie;if(fn.has(M)&&lr.get(M)===Fo(M))ie=fn.get(M);else try{let ce=Fo(M);ie=await Bun.file(M).text(),fn.set(M,ie),lr.set(M,ce)}catch(ce){let de=ce instanceof Error?ce.message:String(ce);return Zo(e,u,[M],de),Ko(e)}if(A)for(let ce of new Set([...Object.keys(t),...A.reactiveProps??[]])){let de=ce.toLowerCase();if(de.startsWith("aria-")||de.startsWith("data-"))continue;let Se=ce.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(new RegExp(`\\b${Se}\\b`).test(ie))A.declaredProps.add(ce);if(new RegExp(`\\$props\\s*(?:\\.\\s*${Se}\\b|\\[\\s*['"]${Se}['"]\\s*\\])`).test(ie)||new RegExp(`\\buseReactiveProp\\s*\\(\\s*['"]${Se}['"]`).test(ie))A.consumedProps?.add(ce)}if(A?.reactiveProps?.length&&/\bdefineProps\s*(?:<[^>]*>)?\s*\(/.test(ie))for(let ce of A.reactiveProps){if(Su.has(ce)||A.consumedProps?.has(ce))continue;if(new RegExp(`\\buse(?:ReactiveProp|Model)\\s*\\(\\s*['"]${ce.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(ie))continue;let de=`${M}\x00${ce}`;if(Xo.has(de))continue;Xo.add(de),console.warn(`[stx] ${ue.basename(M)} reads \`${ce}\` with defineProps(), which is not live, but ${ue.basename(u)} 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 ge=new Set(["__originalFilePath","__importedComponents",Hn,"__stx_client_signal_names","__stx_client_declared_names","__stx_runtime_config","__stxServeContext","__stx_scope_seq"]),ye={};for(let[ce,de]of Object.entries(a))if(!ce.startsWith("__")||ge.has(ce))ye[ce]=de;let me=v.length>0?{[Gn]:[...v]}:{},Pe=n;if(n.includes("@include")){let{processIncludes:ce}=await o("stx/includes",()=>import("./chunk-zmfqx1b1.js"));Pe=await ce(n,a,u,l,x)}if(/<[A-Z][\w.-]*[\s/>]/.test(Pe)){let{processComponents:ce}=await o("stx/component-renderer",()=>import("./chunk-54jx5hqh.js")),de={...a,__processedComponents:O,...me};Pe=await ce(Pe,de,u,l,x);let Se=de.__stx_preserved_client_expressions;if(Array.isArray(Se)&&Se.length>0)a.__stx_preserved_client_expressions=[...new Set([...Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[],...Se])]}let Ke=[];if(ll(Pe)){let{processExpressions:ce}=await o("stx/expressions",()=>import("./chunk-f4wezqh4.js")),de=a.__stx_signals_gate===void 0?{...a,__stx_signals_gate:!0,...me}:v.length>0?{...a,...me}:a;Pe=ce(Pe,de,u);for(let Se of Pe.matchAll(/\{\{([\s\S]*?)\}\}/g))Ke.push(Se[1].trim())}let Ae=te(Pe),Je=[],et=Ae.output.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(ce,de)=>{let Se=Ae.scripts[Number(de)]||"",xe=Se.match(/^<script\b([^>]*)>/i)?.[1]||"",Ge=xe.match(/\btype\s*=\s*["']([^"']+)["']/i)?.[1]?.toLowerCase(),Ie=!Ge||["module","text/javascript","application/javascript"].includes(Ge),xt=/\sdata-stx-(?:owner|instance)(?=[\s=/>])/i.test(` ${xe}`);if(!/\bserver\b/i.test(xe)&&Ie&&!xt)return Je.push(Se),"";return Se}),{extractSlotContent:Ye}=await o("stx/slots",()=>import("./chunk-10h8v5d4.js")),it=Ye(et),nt={};if(it.defaultSlot?.trim())nt.default=it.defaultSlot;for(let[ce,de]of it.namedSlots)nt[ce]=de.content;let St=a.__stx_scope_seq??={n:0,key:Js(String(a.__filename??u))},Ht=Yo(e,process.cwd()),pt=`stx_${(Ht.endsWith(".stx")?Ht.slice(0,-4):Ht).replace(/[^a-zA-Z0-9]/g,"_")}_${++St.n}_${St.key}`,De={...ye,$uid:pt,$native:l._nativeHostAttrs===!0,...t,props:t,slot:et,$slots:nt,__processedComponents:z,__sections:{},__stx_signals_gate:Te(ie)||ll(n),__stx_preserved_client_expressions:[...Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[],...Ke]};if(/import\s/.test(ie)){De.__importedComponents=new Map(De.__importedComponents);let{processESImports:ce}=await o("stx/component-renderer",()=>import("./chunk-54jx5hqh.js"));ie=await ce(ie,De,M,l,x)}yu(ie,De);let qt=ie,dn=L(qt);if(dn)qt=dn.content.trim();let as=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,Zt=[...ie.matchAll(as)];for(let[,ce,de]of Zt)if(!/\bserver\b|\bsrc\s*=|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/i.test(ce))je(de,M,l.strict);let st=[],Kt=null,cs=Zt.some((ce)=>/\bserver\b/.test(ce[1]||"")&&/\bcache\b/.test(ce[1]||"")),Ct=null,dt=null,Xt=null,gn=0,Jt=null;if(pu(l),cs&&dr>0){let ce=du({props:t,slot:Pe,slotContext:n.trim()?gu(ye):void 0,buildMode:l.buildMode??"",skipEventDirectives:l.skipEventDirectives===!0,native:l._nativeHostAttrs===!0,clientLoopNames:[...v].sort(),layers:l._layerGraph?.layers.map((de)=>de.configFile),uid:pt});if(ce!==null){Ct=`${M}\x00${_(ie)}\x00${ce}`;let de=rs.get(Ct);if(de){for(let Se of de.dependencies)x.add(Se);if(pi(a,de.clientFactories),St.n+=de.uidsConsumed,de.preservedClientExpressions.length>0){let Se=new Set(Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[]);for(let xe of de.preservedClientExpressions)Se.add(xe);a.__stx_preserved_client_expressions=[...Se]}return de.output}dt=new Set(x),Xt=li(a),gn=St.n,Jt=new Set(Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[])}}let Gt=new Set;for(let ce of Zt){let de=ce[1]||"",Se=ce[2]||"",xe=de.includes("server");if(Ve(de)&&Se.trim())Se=Ue(Se);if(xe&&Se){for(let Ie of Fe(Se))Gt.add(Ie);try{await U(Se,De,M,{onFailure:(Ie)=>{if(Ie.kind!=="unknown")Kt=Ie.kind}})}catch(Ie){}}if(!xe){let Ie=Se.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),xt=Ie.includes("{{")&&Ie.includes("}}"),Rt=Ie.includes("{!!")&&Ie.includes("!!}");if(xt||Rt)Ie=Ri(Ie,De,M);let _t=de.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");st.push(`<script${_t}>${Ie}</script>`)}}let rt=te(ie).output.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),Yt=rt?rt[1]:"",ls=rt?rt[2]:"",gt="",ae=Yt&&/\bscoped\b/i.test(Yt);if(rt)gt=`<style${Yt}>${wu(ls,De,M)}</style>`;let le=qt;if(le=le.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),rt)le=le.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let ce=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,de=[];if(le=le.replace(ce,(Se,xe)=>{let Ge=xe.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(Ge)de.push(`<style${Ge[1]}>${Ge[2]}</style>`);return""}),le=le.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),de.length>0)gt=`${gt}${de.join(`
577
- `)}`}if(n&&le.includes("{{ text || slot }}"))le=le.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>n);let{applySlots:he}=await o("stx/slots",()=>import("./chunk-10h8v5d4.js")),{defaultSlot:$e,namedSlots:Oe}=it,Ne=a.__stx_signals_gate===!0&&/\s(?:@[\w:.-]+|x-on:[\w:.-]+)\s*=/.test(et),ot=st.length>0&&Ns(le)||l._nativeHostAttrs===!0&&st.length>0||Ne&&st.length>0||st.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)),us=(ce)=>ot?fo(ce,pt):ce,fs=new Map([...Oe].map(([ce,de])=>[ce,{...de,content:us(de.content)}]));le=await he(le,ot?uo(us($e),pt):$e,fs,De,ot?pt:"");let mn=Ti(st),Qt=(Array.isArray(De.__stx_client_signal_names)?De.__stx_client_signal_names:[]).filter((ce)=>!Gt.has(ce));if(mn.length>0||Qt.length>0)De.__stx_client_signal_names=[...new Set([...Qt,...mn])];else delete De.__stx_client_signal_names;let en=v.filter((ce)=>!Gt.has(ce)&&!(ce in t));if(en.length>0)De[Gn]=en;let hn={...l,_rootComponentsDir:l._rootComponentsDir||l.componentsDir,componentsDir:ue.dirname(M),skipSignalsRuntime:!0,skipEventDirectives:l._nativeHostAttrs===!0||ot||st.length===0,defaultLayout:void 0};De.__stxProcessingDepth=(a.__stxProcessingDepth||0)+1;let{processDirectives:yn}=await o("stx/process",()=>import("./chunk-g3tfct27.js")),mt=await yn(le,De,M,hn,x),yt=new Set(Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[]);for(let ce of mt.matchAll(/\{\{([\s\S]*?)\}\}/g))yt.add(ce[1].trim());if(yt.size>0)a.__stx_preserved_client_expressions=[...yt];let ht=pt,Ze=mt;if(ot){let ce="";if(Object.keys(t).length>0)try{ce=` data-stx-props="${ar(JSON.stringify(t))}"`}catch{}let de=F?` stx-hydrate="${ar(F)}"`:"",Se=Object.fromEntries(Object.entries(nt).map(([$t,Tt])=>[$t,Boolean(Tt)])),xe=Object.keys(Se).length>0?` data-stx-slots="${ar(JSON.stringify(Se))}"`:"",Ge=` data-stx-scope="${ht}"${ce}${xe}${de}`,Ie=mt.slice(Mt(mt)),xt=/^<span(?=[\s/>])/i.test(Ie),Rt=/^<[^>]+\bdata-stx-layout-root(?:\s|=|>)/i.test(Ie),_t=/^<[^>]+\bdata-stx-fill-root(?:\s|=|>)/i.test(Ie),Rn=xt?"span":"div",ps=Rt&&l._nativeHostAttrs?' style="display:flex;flex-direction:column;flex:1;min-height:0;min-width:0"':_t&&l._nativeHostAttrs?' style="width:100%;height:100%"':xt||Rt?' style="display:contents"':"";Ze=Ag(mt,Ge)??`<${Rn}${Ge} data-stx-component-wrapper${ps}>${mt}</${Rn}>`;let ds=await Promise.all(st.map(async($t)=>{let Tt=$t.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!Tt)return $t;let[,tn,gs]=Tt,An=Wo($t,De,M);if(An!==null)return An;let At=await vu(gs,M,l.buildMode==="compile"),In=kn(At.clientCode,ze(De)),{vendorStyleTags:Pn}=At,On=In?`function(__scopeId) {
578
- ${In}
579
- return (${At.factoryBody})(__scopeId);
580
- }`:At.factoryBody,Dn=F?null:Ts(a,On),Mn=Dn?`window.__stxComponentFactories[${JSON.stringify(Dn)}](${JSON.stringify(ht)});`:`(${On})(${JSON.stringify(ht)});`;if(F)return`${Pn}<script type="stx/island" data-stx-island="${ht}" data-stx-scoped data-stx-owner="${ht}"${tn}>${pe(Mn)}</script>`;return`${Pn}<script data-stx-scoped data-stx-run="always" data-stx-owner="${ht}"${tn}>${pe(Mn)}</script>`}));if(Ze=Ze+`
581
- `+ds.join(`
582
- `),gt)Ze+=`
583
- `+gt}else{if(gt)Ze+=`
584
- `+gt;if(st.length>0){let ce=De.__stx_event_bindings||[],de=ze(De),Se=await Promise.all(st.map(async(xe)=>{let Ge=Wo(xe,De,M);if(Ge!==null)return Ge;let Ie=xe.match(/<script\b[^>]*>([\s\S]*?)<\/script>/);if(!Ie)return xe;return await He(Ie[1],{eventBindings:ce,templateContent:Ze,filePath:M,projectRoot:process.cwd(),serverData:de,instanceId:pt})}));Ze+=`
585
- `+Se.join(`
586
- `),De.__stx_event_bindings=[]}}if(ae){let ce=qs(Ze,M);if(ce.hasScoped)Ze=ce.html}if(Ct&&dt){let ce=Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[];rs.set(Ct,{output:Ze,dependencies:[...x].filter((de)=>!dt.has(de)),clientFactories:Xt?ui(a,Xt):[],uidsConsumed:St.n-gn,preservedClientExpressions:Jt?ce.filter((de)=>!Jt.has(de)):[]})}if(Kt)Ze=`<!--stx-render-failed:${Kt}-->${Ze}`;return Je.length>0?`${Ze}
587
- ${Je.join(`
588
- `)}`:Ze}catch(q){if(q instanceof Z)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 gr(e,t){let n=ue.resolve(t),i=ue.resolve(e),a=n.endsWith(ue.sep)?n:n+ue.sep;if(i===n||i.startsWith(a))return i;return null}async function Jo(e,t,n,i){let a=t.startsWith("layouts/")?t.slice(8):t,u=ue.join(e,a);for(let l of u.endsWith(".stx")?[u]:[u,`${u}.stx`])if(await s(l)){if(i)console.log(`Found layout in ${e}: ${l}`);return n?.add(l),l}return null}async function _n(e,t,n,i){let a=await $u(e,t,n,i);if(a===null)return null;let u=gr(a,process.cwd());if(u)return u;let l=[n.root,n.layoutsDir,n.fallbackLayoutsDir,n.componentsDir,n.partialsDir,n.pagesDir,...n._layerLayoutDirs??[]].filter((f)=>typeof f==="string"&&f.length>0);for(let f of l){let x=ue.isAbsolute(f)?f:ue.resolve(process.cwd(),f);if(gr(a,x))return ue.resolve(a)}return console.warn(`[stx] rejected resolved template path that escapes project root: ${a} (template: ${e}, from: ${t})`),null}async function $u(e,t,n,i){if(n.debug)console.log(`Resolving template path: ${e} from ${t}`);let a=ue.dirname(t),u=process.cwd();if(e.startsWith("/")){let O=ue.join(u,e),z=gr(O,u);if(!z)return console.warn(`[stx] rejected template path that escapes project root: ${e} (from ${t})`),null;if(n.debug)console.log(`Checking absolute path: ${z}`);if(await s(z)&&i)i.add(z);return z}let l=async(O)=>{if(!n.layoutsDir||!n.fallbackLayoutsDir)return O;let z=ue.relative(ue.resolve(u,n.fallbackLayoutsDir),O);if(z.startsWith("..")||ue.isAbsolute(z))return O;return await Jo(ue.resolve(u,n.layoutsDir),e,i,n.debug)??O},f=ue.join(a,e);if(await s(f)){if(n.debug)console.log(`Found direct path: ${f}`);let O=await l(f);if(i)i.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(n.debug)console.log(`Found direct path with extension: ${z}`);let V=await l(z);if(i)i.add(V);return V}}let x=[];if(x.push(...n._layerLayoutDirs??[]),n.layoutsDir)x.push(ue.isAbsolute(n.layoutsDir)?n.layoutsDir:ue.resolve(process.cwd(),n.layoutsDir));let v=ue.resolve(a),A=process.cwd();for(let O=0;O<10;O++){let z=ue.join(v,"layouts"),V=!1;try{V=is.statSync(z,{throwIfNoEntry:!1})?.isDirectory()??!1}catch{}if(V){x.push(z);break}let F=ue.dirname(v);if(F===v||F.length<A.length)break;v=F}for(let O of x){let z=await Jo(O,e,i,n.debug);if(z)return z}if(n.fallbackLayoutsDir){let O=ue.isAbsolute(n.fallbackLayoutsDir)?n.fallbackLayoutsDir:ue.resolve(process.cwd(),n.fallbackLayoutsDir),z=e.startsWith("layouts/")?e.slice(8):e,V=[ue.join(O,z)];if(!e.endsWith(".stx"))V.push(`${V[0]}.stx`);for(let F of V)if(await s(F)){if(n.debug)console.log(`Found in options.fallbackLayoutsDir: ${F}`);if(i)i.add(F);return F}}if(e.startsWith("layouts/")||e.includes("/layouts/")){let O=e.split("layouts/"),z=ue.join(n.partialsDir||a,"layouts",O[1]);if(await s(z)){if(n.debug)console.log(`Found in layouts path: ${z}`);if(i)i.add(z);return z}if(!z.endsWith(".stx")){let V=`${z}.stx`;if(await s(V)){if(n.debug)console.log(`Found in layouts path with extension: ${V}`);if(i)i.add(V);return V}}}if(n.partialsDir){let O=ue.join(n.partialsDir,"layouts");if(await s(O)){let z=ue.join(O,e);if(await s(z)){if(n.debug)console.log(`Found in partials layouts dir: ${z}`);if(i)i.add(z);return z}if(!e.endsWith(".stx")){let V=`${z}.stx`;if(await s(V)){if(n.debug)console.log(`Found in partials layouts dir with extension: ${V}`);if(i)i.add(V);return V}}}}let D=n.partialsDir||ue.join(process.cwd(),"views"),U=ue.join(D,e);if(await s(U)){if(n.debug)console.log(`Found in views path: ${U}`);if(i)i.add(U);return U}if(!e.endsWith(".stx")){let O=`${U}.stx`;if(await s(O)){if(n.debug)console.log(`Found in views path with extension: ${O}`);if(i)i.add(O);return O}}if(a.includes("temp")){let O=ue.join(ue.dirname(a),"layouts",e);if(await s(O)){if(n.debug)console.log(`Found in temp layouts dir: ${O}`);if(i)i.add(O);return O}if(!e.endsWith(".stx")){let z=`${O}.stx`;if(await s(z)){if(n.debug)console.log(`Found in temp layouts dir with extension: ${z}`);if(i)i.add(z);return z}}}if(n.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 dl(e,t,n){let i=0,a="",u="";try{if(typeof t==="number"&&t>=0){let l=e.split(`
589
- `),f=0;for(let x=0;x<l.length;x++)if(f+=l[x].length+1,f>=t){i=x+1,a=l[x].trim();let v=Math.max(0,x-2),A=Math.min(l.length,x+3);u=l.slice(v,A).map((D,U)=>{let O=v+U+1;return`${O===i?"> ":" "}${O}: ${D}`}).join(`
590
- `);break}}else if(n){let l=e.indexOf(n);if(l>=0)return dl(e,l)}}catch{}return{lineNumber:i,lineContent:a,context:u}}var ke={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,n,i,a,u){let{lineNumber:l,context:f}=dl(i,a,u),x=n.split("/").pop(),v=0;if(typeof a==="number"&&a>=0&&i){let D=i.lastIndexOf(`
591
- `,Math.max(0,a-1));v=a-(D+1)+1}let A="";if(l>0)A+=`
592
- ${n}:${l}${v>0?`:${v}`:""}: ${e.toLowerCase()} error: ${t}
593
- `;if(A+=`
594
- ${ke.bold}${ke.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${ke.reset}
595
- `,A+=`${ke.bold}${ke.red}\u2502${ke.reset} ${ke.bold}${ke.bgRed} ERROR ${ke.reset} ${ke.red}${e} Error${ke.reset}${" ".repeat(Math.max(0,43-e.length))}${ke.bold}${ke.red}\u2502${ke.reset}
596
- `,A+=`${ke.bold}${ke.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${ke.reset}
597
- `,A+=`
598
- ${ke.cyan}${ke.bold}File:${ke.reset} ${ke.dim}${x}${ke.reset}`,l>0)A+=` ${ke.gray}(line ${l}${v>0?`, col ${v}`:""})${ke.reset}`;if(A+=`
599
- ${ke.yellow}${ke.bold}Message:${ke.reset} ${t}
600
- `,f)A+=`
601
- ${ke.blue}${ke.bold}Context:${ke.reset}
602
- ${ke.dim}${f}${ke.reset}
603
- `;return A}function we(){fn.clear(),lr.clear(),ss.clear(),ur.clear(),fr.clear(),pr.clear(),rs.clear()}function gy(){return{size:fn.size,maxSize:500}}var cr=S(128);async function vu(e,t,n){let i=_(e,t,n),a=cr.get(i);if(a){if(Vs(a.deps))return a;cr.delete(i)}let u=Ci(e,{filePath:t,projectRoot:process.cwd()}),l=u.code,f=Ei(u.styles);l=zt(l).code;let{hasUserImports:x,bundleClientScript:v}=await o("stx/client-script-bundler",()=>import("./chunk-awmfyb3t.js")),A=[],D=!1;if(x(l)){let H=l;l=await v(H,t,{projectRoot:process.cwd(),minify:n,collectInputs:A}),D=l===H}let{stripStxRuntimeImports:U}=await o("stx/signal-processing",()=>import("./chunk-7c9pzpsw.js"));l=U(l);let O=N(l),z=hu(O),V=new Set(K(O,!0).split(",").map((H)=>H.trim())),F=`function(__scopeId) {
604
- ${ft("const",[..._l,...z],O)}
605
- const __scope = window.stx._scopes = window.stx._scopes || {};
606
- const __scopeVars = __scope[__scopeId] = __scope[__scopeId] || {};
607
- __scopeVars.$refs = __scopeVars.$refs || {};
608
- const __previousCurrentElement = window.__STX_CURRENT_ELEMENT__;
609
- const __previousCurrentProps = window.__STX_CURRENT_PROPS__;
610
- // A clone the runtime is setting up may not be in the document yet (rows
611
- // a loop builds inside a closed :if), where a lookup cannot see it, so the
612
- // runtime hands its root over in __STX_SETUP_ROOT__ (signals.ts).
613
- const __setupRoot = window.__STX_SETUP_ROOT__;
614
- const __componentElement = (__setupRoot && __setupRoot.getAttribute('data-stx-scope') === __scopeId && __setupRoot) || document.querySelector('[data-stx-scope="' + __scopeId + '"]');
615
- __scopeVars.$slots = Object.create(null);
616
- if (__componentElement) {
617
- try { Object.assign(__scopeVars.$slots, JSON.parse(__componentElement.getAttribute('data-stx-slots') || '{}')); }
618
- catch {}
619
- }
620
- window.__STX_CURRENT_ELEMENT__ = __componentElement;
621
- let __componentProps = __componentElement && __componentElement.__stx_props;
622
- if (!__componentProps && __componentElement) {
623
- try { __componentProps = JSON.parse(__componentElement.getAttribute('data-stx-props') || '{}'); }
624
- catch { __componentProps = {}; }
625
- }
626
- window.__STX_CURRENT_PROPS__ = __componentProps && typeof __componentProps === 'object' && !Array.isArray(__componentProps) ? __componentProps : {};
627
- const __scopeProps = window.__STX_CURRENT_PROPS__;
628
- Object.defineProperty(__scopeVars, '$props', { configurable: true, enumerable: true, get: function() {
629
- return (__componentElement && __componentElement.__stx_props) || __scopeProps;
630
- } });
631
-
632
- // Scope-specific lifecycle callbacks. The queues drain as they run; the
633
- // hook lists keep what setup registered, because a component behind an :if
634
- // unmounts at each hide and mounts again at each show (signals.ts,
635
- // suspendSubtreeScopes).
636
- if (__scopeVars.__suspended && !__scopeVars.__mounted) {
637
- // Set up again after an :if hid it -- a <template :if> clones the
638
- // component afresh on every show, and the clone's script runs. This run's
639
- // hooks close over this run's state, so they replace the ones the hide
640
- // kept for a re-show rather than queueing beside them.
641
- __scopeVars.__mountCallbacks = [];
642
- __scopeVars.__destroyCallbacks = [];
643
- __scopeVars.__mountHooks = [];
644
- __scopeVars.__destroyHooks = [];
645
- // So do its effects: the last run's watched a clone that is gone.
646
- if (typeof __scopeVars.__disposeEffects === 'function') __scopeVars.__disposeEffects();
647
- __scopeVars.__disposeEffects = null;
648
- }
649
- __scopeVars.__mountCallbacks = __scopeVars.__mountCallbacks || [];
650
- __scopeVars.__destroyCallbacks = __scopeVars.__destroyCallbacks || [];
651
- __scopeVars.__mountHooks = __scopeVars.__mountHooks || [];
652
- __scopeVars.__destroyHooks = __scopeVars.__destroyHooks || [];
653
- let __registeringSetupHooks = true;
654
- const onMount = (fn) => { __scopeVars.__mountCallbacks.push(fn); __scopeVars.__mountHooks.push(fn); };
655
- const onDestroy = (fn) => {
656
- __scopeVars.__destroyCallbacks.push(fn);
657
- // A teardown registered inside onMount belongs to this mount alone.
658
- // Replaying it AND registering the next mount's teardown doubles cleanup.
659
- if (__registeringSetupHooks) __scopeVars.__destroyHooks.push(fn);
660
- };
661
- // The effects this setup makes (effect, watch) belong to the scope and are
662
- // disposed with it (disposeSubtreeScopes in the runtime), as its bindings
663
- // are. Untracked, one reading a store kept running for a component the
664
- // router had long swapped out.
665
- const __endEffects = window.stx._beginEffects ? window.stx._beginEffects() : null;
666
-
667
- try {
668
- ${O}
669
-
670
- // Register all defined signals and functions in this scope
671
- const __localVars = {};
672
- try {
673
- ${z.map((H)=>V.has(H)?`Object.defineProperty(__localVars, '${H}', ${js(H)});`:`if (typeof ${H} !== 'undefined') __localVars['${H}'] = ${H};`).join(`
674
- `)}
675
- }
676
- catch (e) {}
677
- Object.defineProperties(__scopeVars, Object.getOwnPropertyDescriptors(__localVars));
678
- if (typeof __stxLiveBindings !== 'undefined') Object.defineProperties(__scopeVars, Object.getOwnPropertyDescriptors(__stxLiveBindings));
679
- }
680
- finally {
681
- __registeringSetupHooks = false;
682
- if (__endEffects) {
683
- const __previousDispose = __scopeVars.__disposeEffects;
684
- const __disposeSetup = __endEffects();
685
- __scopeVars.__disposeEffects = typeof __previousDispose === 'function'
686
- ? function() { __previousDispose(); __disposeSetup(); }
687
- : __disposeSetup;
688
- }
689
- window.__STX_CURRENT_ELEMENT__ = __previousCurrentElement;
690
- window.__STX_CURRENT_PROPS__ = __previousCurrentProps;
691
- }
692
- }`,q={vendorStyleTags:f,factoryBody:F,clientCode:O,deps:Cr([...A,...u.styles.map((H)=>H.resolvedPath)])};if(!D&&u.unresolved.length===0)cr.set(i,q);return q}var Sn=["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 Eu=100,ku=599,hr="__stxResponseStatus",pn="__stxResponseHeaders";function os(e){return typeof e==="number"&&Number.isInteger(e)&&e>=Eu&&e<=ku}function vn(e){for(let t of e.matchAll(/\bdefinePageMeta\s*\(\s*\{([\s\S]*?)\}\s*\)/g)){let n=t[1].match(/(?:^|,)\s*status\s*:\s*(\d{3})(?=\s*(?:,|$))/);if(!n)continue;let i=Number(n[1]);if(os(i))return i}return}function mr(e,t){if(!e||typeof e!=="object")return!1;let n=typeof t==="string"&&/^\d+$/.test(t.trim())?Number(t.trim()):t;if(!os(n))return!1;return e[hr]=n,!0}function Cu(e,t,n){if(!e||typeof e!=="object")return;let i=String(t??"").trim();if(!i)return;e[pn]={...e[pn],[i]:String(n)}}function Bt(e){let t=e?.[hr];return os(t)?t:void 0}function Ft(e){let t=e?.[pn];if(!t||typeof t!=="object")return;let n=Object.entries(t).map(([i,a])=>[i,String(a)]);return n.length>0?Object.fromEntries(n):void 0}function Yc(e,t){if(!e||!t||e===t||typeof t!=="object")return;let n=Bt(e);if(n!==void 0)t[hr]=n;let i=Ft(e);if(i)t[pn]={...t[pn],...i}}function Ks(e){return{setResponseStatus:(t)=>{mr(e,t)},notFound:(t=404)=>{let n=os(t)&&t>=400?t:404;mr(e,n)},setResponseHeader:(t,n)=>{Cu(e,t,n)}}}function Zc(e,t,n={}){if(!e.includes("@status"))return e;let{filePath:i,buildMode:a}=n,u=a==="compile",l="",f=0,x=/@status\s*\(/g,v;while((v=x.exec(e))!==null){let A=Ru(e,v.index+v[0].length-1);if(A<0)break;let D=e.slice(v.index+v[0].length,A).trim(),U=/^\d+$/.test(D)?Number(D):d(D,t),O=i?` in ${i}`:"";if(u)console.warn(`[stx] @status(${D})${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(${D}) from <script server> instead \u2014 that runs per request.`);else if(!mr(t,U))console.warn(`[stx] @status(${D})${O} is not an HTTP status (100-599) \u2014 ignoring it.`);l+=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:l+e.slice(f)}function Ru(e,t){let n=1,i=null,a=!1;for(let u=t+1;u<e.length;u++){let l=e[u];if(a){a=!1;continue}if(i){if(l==="\\")a=!0;else if(l===i)i=null;continue}if(l==='"'||l==="'"||l==="`"){i=l;continue}if(l==="(")n++;else if(l===")"&&--n===0)return u}return-1}var ta=new Set(Sn),Tu=new Set(["props","$props","defineProps"]),Au=new Set(["stx","@stacksjs/stx"]),na=S(128),sa=S(64);function Iu(e){let t=[],n=0,i=e.split(`
693
- `);for(let a of i){let u=n,l=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(l){if(v===l)l=null;continue}if(v==="'"||v==='"'||v==="`"){l=v;continue}if(v==="/"&&x+1<a.length&&a[x+1]==="/")break;if(v==="{")n++;else if(v==="}")n--}if(u===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 D=v[1].slice(1,-1).split(",").map((U)=>{let O=U.split(":");return(O.length>1?O[1]:O[0]).trim()}).filter((U)=>/^\w+$/.test(U));t.push(...D)}}}}return[...new Set(t)]}function mg(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 n(i){if(!i.includes(":"))return i;let a=[],u="",l=0,f=0,x=null;for(let v=0;v<i.length;v++){let A=i[v];if(x){if(u+=A,A===x)x=null;continue}if(A==='"'||A==="'"||A==="`"){x=A,u+=A;continue}if(A==="<")l++;else if(A===">"&&l>0)l--;else if(A==="(")f++;else if(A===")")f--;if(A===","&&l===0&&f===0){a.push(u),u="";continue}u+=A}if(u)a.push(u);return a.map((v)=>{let A=v.trim(),D=A.startsWith("..."),U=D?A.slice(3):A,O=-1,z=0;for(let oe=0;oe<U.length;oe++)if(U[oe]==="<")z++;else if(U[oe]===">")z--;else if(U[oe]===":"&&z===0){O=oe;break}if(O===-1)return v;let F=U.substring(0,O).trim().replace(/\?$/,""),q=U.substring(O+1),H=-1,M=0;for(let oe=0;oe<q.length;oe++)if(q[oe]==="<")M++;else if(q[oe]===">")M--;else if(q[oe]==="="&&M===0){H=oe;break}let ee=D?"...":"";if(H!==-1)return`${ee}${F} = ${q.substring(H+1).trim()}`;return`${ee}${F}`}).join(", ")}t=t.replace(/\b(function\s+\w*\s*)\(([^)]*)\)/g,(i,a,u)=>{if(!u.includes(":"))return i;return`${a}(${n(u)})`});{let i=/\b(function\s+\w*\s*)\(/g,a,u=[];while((a=i.exec(t))!==null){let l=a.index+a[0].length-1,f=1,x=l+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 D=t.substring(l+1,x);if(!D.includes(":"))continue;let U=n(D);u.push({start:l+1,end:x,replacement:U})}for(let l=u.length-1;l>=0;l--){let{start:f,end:x,replacement:v}=u[l];t=t.substring(0,f)+v+t.substring(x)}}return t=t.replace(/\(([^)]*)\)\s*(?::\s*[^=]+)?\s*=>/g,(i,a)=>{if(!a.includes(":"))return i;if(a.includes("{")||a.includes("}"))return i;return`(${a.split(",").map((l)=>{let[f,...x]=l.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,`
694
-
695
- `),t}function hg(e){return e.replace(/\s*(?:imported from|from)\s+(?:(['"])([^'"\r\n]+)\1|(\S+))/g,(t,...n)=>{let[,i,a]=n,u=i??a;return/(?:[/\\]packages[/\\]stx[/\\]|@stacksjs[/\\]stx[/\\])/.test(u)?"":t})}function yg(e){return/cannot find module|cannot find package|could not resolve|module not found|failed to resolve/i.test(e)}function bg(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 wg(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 ra=new Set;async function h(e,t,n,i={}){if(!e.trim())return;let a=T(),u=_(e,JSON.stringify(a)),l=na.get(u);if(l===void 0){try{let ae=re({loader:"ts",target:"browser",define:a}),le=e.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");le=le.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,""),l=ae.transformSync(le)}catch{l=mg(e)}na.set(u,l)}let f={exports:{}},x=f.exports,v=Vt.cwd(),A={},D=[...l.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)),U=new Map;for(let ae of D)try{if(ae.startsWith(".")){A[ae]=await import(ut.resolve(ut.dirname(n),ae));continue}let le=ut.resolve(v,"node_modules",ae),he=ut.join(le,"package.json"),$e=JSON.parse(b("fs").readFileSync(he,"utf8")),Oe=$e.main||"index.js";if($e.exports){let Ne=typeof $e.exports==="string"?$e.exports:$e.exports["."];if(typeof Ne==="string")Oe=Ne;else if(Ne?.bun)Oe=Ne.bun;else if(Ne?.import)Oe=Ne.import;else if(Ne?.default)Oe=Ne.default}A[ae]=await import(ut.resolve(le,Oe))}catch(le){if(ae.startsWith("."))U.set(ae,le instanceof Error?le.message:String(le))}let O=(ae)=>{if(A[ae])return A[ae];let le=U.get(ae);if(le!==void 0)throw Error(`Cannot require '${ae}' from ${n}: ${le}`);return b(ae)},z=t.props||{},V=(ae)=>{if(!ae)return z;let le={};for(let[he,$e]of Object.entries(ae)){let Oe=z[he];if(Oe!==void 0)le[he]=Oe;else if(typeof $e==="function")le[he]=$e();else le[he]=$e}return le};for(let[ae,le]of Object.entries(z))Object.defineProperty(V,ae,{value:le,enumerable:!0,configurable:!0,writable:!0});let F=(ae,le=!1)=>{if(ae===void 0||ae===null)return le;if(typeof ae==="string"){let he=ae.trim().toLowerCase();if(he===""||he==="true"||he==="1"||he==="on"||he==="yes")return!0;if(he==="false"||he==="0"||he==="off"||he==="no")return!1;return!0}return Boolean(ae)},q=(ae,le=0)=>{if(ae===void 0||ae===null)return le;if(typeof ae==="string"){let $e=ae.trim();if($e==="")return le;let Oe=Number($e);return Number.isFinite(Oe)?Oe:le}let he=Number(ae);return Number.isFinite(he)?he:le};for(let ae of["name","length","caller","arguments"]){if(Object.prototype.hasOwnProperty.call(z,ae))continue;try{Object.defineProperty(V,ae,{value:void 0,enumerable:!1,configurable:!0,writable:!0})}catch{}}let H=(ae)=>{if(!ae)return z;let le={...z};for(let[he,$e]of Object.entries(ae)){let Oe=$e&&typeof $e==="object"&&!Array.isArray($e)?$e:{type:$e};if(le[he]===void 0&&Oe.default!==void 0)le[he]=typeof Oe.default==="function"?Oe.default():Oe.default}return le},M=()=>t.slots||{},ee=(ae,le)=>{let he={...ae};for(let[$e,Oe]of Object.entries(le))if(he[$e]===void 0)if(typeof Oe==="function")he[$e]=Oe();else he[$e]=Oe;return he},oe=(ae)=>{let le=()=>ae;return le.set=(he)=>{},le.update=(he)=>{},le},ie=(ae)=>{let le,he=!1;return()=>{if(!he)try{le=ae(),he=!0}catch{le=void 0}return le}},ge=(ae)=>{},ye=(ae)=>ae(),me=(ae)=>{},Pe=(ae)=>{},Ke=Ks(t);function Ae(ae){let le=ae||{};if(le.title!==void 0||le.description!==void 0)nt({title:le.title,description:le.description})}function Je(ae){if(!ae||typeof ae!=="object")return;let le=t.__stxClientPayload??{};Object.assign(le,ae),t.__stxClientPayload=le}let et=()=>{let ae=t.__stxServeContext,le=t.__stxServeSearch??ae?.search??"",he=ae?.path??"",$e=Object.fromEntries(new URLSearchParams(le)),Oe=t.query,Ne=Object.keys($e).length>0?$e:Oe??{},ot=le||(Object.keys(Ne).length>0?`?${new URLSearchParams(Ne).toString()}`:"");return{params:t.params??{},query:Ne,path:he,name:"",fullPath:he+ot,hash:"",matched:[]}},Ye=()=>({push:(ae)=>{},replace:(ae)=>{},back:()=>{},forward:()=>{},go:(ae)=>{}}),it=(ae)=>{let le=t.__stx_runtime_head||{};t.__stx_runtime_head=Xe(le,Re(ae||{},{known:ro,source:"useHead()"}))},nt=(ae)=>{it(so(ae||{}))},St=(ae)=>({value:ae}),Ht=(ae)=>ae,br=(ae)=>({value:typeof ae==="function"?ae():ae}),pt=(ae,le)=>{},De=(ae)=>{},qt=(ae)=>{},dn=(ae)=>ae?ae():Promise.resolve(),as=(ae)=>(le,...he)=>{},Zt=(ae)=>{},st=(ae,le)=>{},Kt=(ae,le)=>le,cs=()=>({value:"light"}),Ct=()=>oe(!1),dt=(ae)=>oe(!1),Xt=()=>oe(!1),gn=()=>dt("(prefers-color-scheme: dark)"),Jt=()=>dt("(prefers-color-scheme: light)"),Gt=()=>dt("(prefers-reduced-motion: reduce)"),yr=()=>dt("(prefers-contrast: more)"),rt={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:{}},Yt=new Proxy(rt,{get(ae,le){if(le in ae)return ae[le];return},set(ae,le,he){return ae[le]=he,!0}}),ls={getElementById:()=>null,querySelector:()=>null,querySelectorAll:()=>[],createElement:()=>({}),createTextNode:()=>({}),body:{},head:{},documentElement:{},addEventListener:()=>{},removeEventListener:()=>{}},gt=console;try{let ae=_i(l,n),le=new Set(Object.keys(z)),he=Object.keys(t).filter((ce)=>!le.has(ce)&&!Tu.has(ce)&&Ut(ce)),$e=he.map((ce)=>t[ce]);if(!he.includes("__stxServeContext"))he.push("__stxServeContext"),$e.push(void 0);if(!le.has("cookies")){let ce=t.cookies??t.__stxServeContext?.cookies??{},de=he.indexOf("cookies");if(de<0)he.push("cookies"),$e.push(ce);else $e[de]=ce}let Oe=new Set(["async","module","exports","require","params","window","document","console","state","derived","effect"]),Ne=[],ot=[];for(let[ce,de]of Object.entries(z)){if(!Ut(ce))continue;if(Oe.has(ce))continue;if(new RegExp(`(?:^|[\\s;{])(?:const|let|var|function)\\s+${ce}\\b`).test(ae))continue;Ne.push(ce),ot.push(de)}let fs=Iu(ae).map((ce)=>`module.exports.${ce} = typeof ${ce} !== 'undefined' ? ${ce} : module.exports.${ce};`).join(`
696
- `),mn=t.params??{},Qt=[],en=[];for(let ce=0;ce<he.length;ce++){if(he[ce]==="params")continue;Qt.push(he[ce]),en.push($e[ce])}let hn=[...Sn,...Ne,...Qt],yn=`return (async () => {
697
- ${ae}
698
- ${fs}
699
- return module.exports
700
- })()`,mt=_(yn,hn.join("\x00")),yt=sa.get(mt);if(!yt)yt=Function(...hn,yn),sa.set(mt,yt);let ht=t.__stx_options?.runtimeConfig;if(ht||/\buse(?:Server)?RuntimeConfig\b/.test(l))await Tn(t,n,ht);let Ze=await qe(t.__stx_runtime_config??$n()??B(),()=>Mr(t,()=>yt(f,x,O,z,V,F,q,H,ee,Je,jr,Ii,Zs,oe,ie,ge,ye,me,Pe,Ae,et,Ye,it,nt,Ke.setResponseStatus,Ke.setResponseHeader,Ke.notFound,St,Ht,br,pt,De,qt,dn,as,Zt,M,st,Kt,cs,Ct,dt,Xt,gn,Jt,Gt,yr,Yt,ls,gt,rt.confirm,rt.alert,rt.fetch,mn,...ot,...en)));if(i.preserveExisting){for(let[ce,de]of Object.entries(Ze))if(!(ce in t)||t[ce]===void 0)t[ce]=de}else Object.assign(t,Ze);for(let[ce,de]of Object.entries(z))if(!(ce in t))t[ce]=de}catch(ae){if(t.__stx_strict_hydration)throw ae;let le=hg(ae instanceof Error?ae.message:String(ae));if(yg(le))console.warn(`[stx] server <script> in ${n??"<unknown>"} imports a module that does not resolve, so every variable in that script is undefined. Cause: ${le}`),i.onFailure?.({kind:"module-resolution",message:le,error:ae});else if(bg(ae))console.warn(`[stx] server <script> in ${n??"<unknown>"} does not parse, so every variable in that script is undefined. Cause: ${le}`),i.onFailure?.({kind:"syntax",message:le,error:ae});else if(wg(le))console.warn(`[stx] server <script> in ${n??"<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: ${le}`),i.onFailure?.({kind:"missing-binding",message:le,error:ae});else{let he=`${n??"<unknown>"}\x00${le}`;if(Vt.env.STX_DEBUG||!ra.has(he))ra.add(he),console.warn(`[stx] server <script> in ${n??"<unknown>"} threw, so every variable in that script is undefined and anything that reads one renders empty. Cause: ${le}`);i.onFailure?.({kind:"unknown",message:le,error:ae})}try{await Nu(l,t,n)}catch(he){if(Vt.env.STX_DEBUG){let $e=he instanceof Error?he.message:String(he);console.warn(`[stx] fallback extraction also failed in ${n??"<unknown>"}: ${$e}`)}}}}function vg(e){let t=0,n=null,i=!1,a=!1;for(let u=0;u<e.length;u++){let l=e[u];if(n){if(l===n){if(n=null,i||t===0)a=!0}continue}if(l==="'"||l==='"'||l==="`"){n=l;continue}if(l==="{")t++;else if(l==="}")t--;else if(e.startsWith("from",u)&&t===0)i=!0}return n===null&&t===0&&a}var Pu=/^(?:export\s+)?(?:const|let|var)\s+[A-Za-z_$][\w$]*(?:\s*,\s*[A-Za-z_$][\w$]*)*\s*;?$/;function _i(e,t){let n=t?ut.dirname(t):Vt.cwd(),i=Vt.cwd(),a=e.split(`
701
- `),u=[],l=0;while(l<a.length){let f=a[l].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(;l<a.length;l++){for(let v of a[l])if(v==="{")x++;else if(v==="}")x--;if(x<=0)break}}l++;continue}if(f.startsWith("definePageMeta(")){let x=0,v=!1,A=l;for(let O=l;O<a.length&&!v;O++){let z=null,V=!1,F=a[O];for(let q=0;q<F.length;q++){let H=F[q];if(V){V=!1;continue}if(H==="\\"){V=!0;continue}if(z){if(H===z)z=null;continue}if(H==='"'||H==="'"||H==="`"){z=H;continue}if(H==="(")x++;else if(H===")"){if(x--,x===0){l=O+1,v=!0;break}}}}if(!v)l=a.length;let D=a.slice(A,l).join(`
702
- `),U=[];for(let O of["title","description"]){let z=new RegExp(`\\b${O}\\s*:\\s*(['"\`])((?:\\\\.|(?!\\1)[^\\\\])*)\\1`).exec(D);if(z)U.push(`${O}: ${JSON.stringify(z[2])}`)}if(U.length>0)u.push(`useSeoMeta({ ${U.join(", ")} });`);continue}if(f.startsWith("import ")||f==="import"||f.startsWith("import{")||/^import['"]/.test(f)){let x=f,v=0;while(!vg(x)&&l+v+1<a.length)v++,x=`${x} ${a[l+v].trim()}`;l+=v;let A=x.match(/^import\s+(\w+)\s+from\s+['"](.+?)['"]/),D=x.match(/^import\s+\{([^}]*)\}\s+from\s+['"](.+?)['"]/),U=x.match(/^import\s*['"](.+?)['"]/),O=x,z=(V)=>{if(V.startsWith("."))return ut.resolve(n,V);if(V.startsWith("~/")||V.startsWith("@/"))return ut.resolve(i,V.slice(2));try{return Bun.resolveSync(V,n)}catch{return V}};if(A){let[,V,F]=A,q=z(F);u.push(`const ${V} = (await import('${q}')).default`),u.push(`module.exports.${V} = ${V};`)}else if(D){let[,V,F]=D,q=z(F),H=[],M=[],ee=Au.has(F);for(let oe of V.split(",")){let ie=oe.trim();if(!ie)continue;let ge=ie.split(/\s+as\s+/);if(ge.length===2){let[ye,me]=[ge[0].trim(),ge[1].trim()];if(ee&&ta.has(ye)){u.push(`const ${me} = ${ye};`);continue}H.push(`${ye}: ${me}`),M.push(me)}else{if(ee&&ta.has(ie))continue;H.push(ie),M.push(ie)}}if(H.length>0)u.push(`const { ${H.join(", ")} } = await import('${q}')`);for(let oe of M)u.push(`module.exports.${oe} = ${oe};`)}else if(U){let V=z(U[1]);u.push(`await import('${V}')`)}else u.push(O);l++;continue}if(Pu.test(f))u.push(a[l]),l++;else if(f.startsWith("export const ")||f.startsWith("export let ")||f.startsWith("export var ")){let x=oa(a,l),{type:v,name:A,value:D}=x;u.push(`${v} ${A} = ${D};`),u.push(`module.exports.${A} = ${A};`),l=x.nextIndex}else if(f.startsWith("export function ")||f.startsWith("export async function ")){let x=xr(a,l);u.push(x.functionCode),u.push(`module.exports.${x.name} = ${x.name};`),l=x.nextIndex}else if(f.startsWith("const ")||f.startsWith("let ")||f.startsWith("var ")){let x=oa(a,l),{type:v,name:A,value:D}=x;u.push(`${v} ${A} = ${D};`),u.push(`module.exports.${A} = ${A};`),l=x.nextIndex}else if(f.startsWith("function ")||f.startsWith("async function ")){let x=xr(a,l);u.push(x.functionCode),u.push(`module.exports.${x.name} = ${x.name};`),l=x.nextIndex}else if(f.startsWith("export default function ")||f.startsWith("export default async function ")){let x=a[l].replace(/^(\s*)export\s+default\s+/,"$1"),v=[...a];v[l]=x;let A=xr(v,l);if(u.push(A.functionCode),A.name)u.push(`module.exports.default = ${A.name};`);l=A.nextIndex}else if(f.startsWith("export default ")){let x=f.replace(/^export\s+default\s+/,"").replace(/;$/,"");u.push(`module.exports.default = ${x};`),l++}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[l].replace(/^export\s+/,""),D=0,U=l;for(;U<a.length;U++){let O=a[U];for(let z of O)if(z==="{")D++;else if(z==="}")D--;if(U>l)A+=`
703
- `+O;if(D<=0&&U>=l)break}u.push(A),u.push(`module.exports.${v} = ${v};`),l=U+1}else u.push(f),l++}else if(f.includes("module.exports"))u.push(f),l++;else if(f.trim()&&!f.startsWith("//"))u.push(f),l++;else l++}return Ou(u.join(`
704
- `),n,i)}function Ou(e,t,n){let i=e.length,a="",u=0,l=null,f=!1,x=!1,v=0;while(u<i){let A=e[u],D=e[u+1];if(f){if(a+=A,A===`
705
- `)f=!1;u++;continue}if(x){if(a+=A,A==="*"&&D==="/"){a+=D,u+=2,x=!1;continue}u++;continue}if(!l&&A==="/"&&D==="/"){f=!0,a+=A,u++;continue}if(!l&&A==="/"&&D==="*"){x=!0,a+=A,u++;continue}if(l){if(a+=A,A==="\\"){a+=D,u+=2;continue}if(A===l&&l!=="`"){l=null,u++;continue}if(l==="`"){if(A==="$"&&D==="{"){v++,a+=D,u+=2;continue}if(A==="`"){l=null,u++;continue}}u++;continue}if(v>0){if(A==="{")v++;else if(A==="}")v--}if(A==='"'||A==="'"||A==="`"){l=A,a+=A,u++;continue}if(A==="a"&&e.startsWith("await",u)){let U=Du(e,u);if(U){let{quote:O,path:z,end:V}=U;if(z.startsWith(".")||z.startsWith("~/")||z.startsWith("@/")){let F=z.startsWith(".")?ut.resolve(t,z):ut.resolve(n,z.slice(2));a+=`await import(${O}${F}${O})`,u=V;continue}}}a+=A,u++}return a}function Du(e,t){let n=t+5;if(n>=e.length)return null;if(!/\s/.test(e[n]))return null;while(n<e.length&&/\s/.test(e[n]))n++;if(!e.startsWith("import",n))return null;n+=6;while(n<e.length&&/\s/.test(e[n]))n++;if(e[n]!=="(")return null;n++;while(n<e.length&&/\s/.test(e[n]))n++;let i=e[n];if(i!=="'"&&i!=='"')return null;n++;let a=n;while(n<e.length&&e[n]!==i)if(e[n]==="\\")n+=2;else n++;if(n>=e.length)return null;let u=e.slice(a,n);n++;while(n<e.length&&/\s/.test(e[n]))n++;if(e[n]!==")")return null;return{quote:i,path:u,end:n+1}}function ua(e,t){let n=e[t];if(n!=="{"&&n!=="[")return null;let a=k(e,n,n==="{"?"}":"]",t);if(a===-1)return null;return{pattern:e.slice(t,a+1),endPos:a+1}}function fa(e){let t=[],n=e.slice(1,-1).trim();if(!n)return t;let i=0,a=0,u="";while(i<n.length){let l=n[i];if(l==="{"||l==="["){let f=a===0?ua(n,i):null;if(f){t.push(...fa(f.pattern)),i=f.endPos,u="";continue}a++}else if(l==="}"||l==="]")a--;if(a>0){i++;continue}if(l===","){if(u.trim())t.push(u.trim());u="",i++;continue}if(l===":"){u="",i++;continue}if(l==="="){if(u.trim())t.push(u.trim());u="",i++;while(i<n.length&&n[i]!==","&&a===0){if(n[i]==="{"||n[i]==="[")a++;else if(n[i]==="}"||n[i]==="]")a--;i++}continue}if(/[\w$]/.test(l))u+=l;i++}if(u.trim())t.push(u.trim());return t}function xg(e){let t=/^(?:export\s+)?(const|let|var)\s+([A-Za-z_$][\w$]*)/.exec(e);if(!t)return null;let n=t[0].length,i=(a)=>a===" "||a==="\t";while(n<e.length&&i(e[n]))n++;if(e[n]===":"){let a=0,u=null;n++;for(;n<e.length;n++){let l=e[n];if(u){if(l==="\\"){n++;continue}if(l===u)u=null;continue}if(l==="'"||l==='"'||l==="`"){u=l;continue}if(l==="("||l==="["||l==="{"||l==="<"){a++;continue}if(l===")"||l==="]"||l==="}"||l===">"){a--;continue}if(l==="="&&a<=0){let f=e[n+1],x=e[n-1];if(f!=="="&&f!==">"&&x!=="="&&x!=="!"&&x!=="<"&&x!==">")break}}if(e[n]!=="=")return null}while(n<e.length&&i(e[n]))n++;if(e[n]!=="=")return null;return{type:t[1],name:t[2],value:e.slice(n+1).trim()}}function ia(e,t,n,i){let a=null,u=!1;for(let l of e){if(u){u=!1;continue}if(l==="\\"){u=!0;continue}if(a){if(l===a)a=null;continue}if(l==="'"||l==='"'||l==="`"){a=l;continue}if(l===t)i++;else if(l===n)i--}return i}function oa(e,t){let n=e[t].trim(),i=xg(n),a=i?[n,i.type,i.name,i.value]:null;if(!a){let A=n.match(/^(?:export\s+)?(const|let|var)\s+/);if(A){let D=n.slice(A[0].length),U=t;if(D.startsWith("{")||D.startsWith("[")){let z=D[0],V=z==="{"?"}":"]",F=ia(D,z,V,0),q=D;for(let H=t+1;H<e.length&&F>0;H++)q+=` ${e[H].trim()}`,U=H,F=ia(e[H],z,V,F);if(F>0)q=D,U=t;D=q}let O=ua(D,0);if(O){let z=A[1],V=O.pattern,F=D.slice(O.endPos).trim();if(F.startsWith("=")){let q=F.slice(1).trim(),H=q,M=Math.max(U,t);if(aa(q)){let ge=ca(e,M,q);H=ge.value,M=ge.nextIndex}else M=M+1;H=H.trim().replace(/;$/,"");let ee=fa(V),oe=`__stx_src_${t}`,ie=ee.map((ge)=>`module.exports.${ge} = ${ge};`).join(`
706
- `);return{type:z,name:oe,value:`${H}; ${z} ${V} = ${oe};
707
- ${ie}`,nextIndex:M}}}}throw Error(`Failed to parse variable declaration: ${n}`)}let[,u,l,f]=a,x=f,v=t;if(aa(f)){let A=ca(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+=`
708
- ${e[v]}`,v++;else break}return x=x.trim().replace(/;$/,""),{type:u,name:l,value:x,nextIndex:v}}function xr(e,t){let n=e[t].trim(),i=n.match(/^(?:export\s+)?(?:async\s+)?function\s+(\w+)/);if(!i)throw Error(`Failed to parse function declaration: ${n}`);let[,a]=i,u=n.replace(/^export\s+/,""),l=t;if(Mu(n)){let f=ju(e,t,u);u=f.functionCode,l=f.nextIndex}else l=t+1;return{name:a,functionCode:u,nextIndex:l}}function aa(e){let t=e.trim();if(t.startsWith("{"))return k(t,"{","}",0)===-1;if(t.startsWith("["))return k(t,"[","]",0)===-1;return!pa(t)}function pa(e){let t={paren:0,bracket:0,brace:0},n=null,i=0;for(let a=0;a<e.length;a++){let u=e[a];if((a>0?e[a-1]:"")==="\\"&&n)continue;if((u==='"'||u==="'")&&!n){n=u;continue}if(u===n&&n!=="`"){n=null;continue}if(u==="`"&&!n){n="`";continue}if(u==="`"&&n==="`"&&i===0){n=null;continue}if(n==="`"&&u==="$"&&e[a+1]==="{"){i++,a++;continue}if(i>0&&u==="{"){i++;continue}if(i>0&&u==="}"){i--;continue}if(n)continue;if(u==="(")t.paren++;else if(u===")")t.paren--;else if(u==="[")t.bracket++;else if(u==="]")t.bracket--;else if(u==="{")t.brace++;else if(u==="}")t.brace--}return t.paren===0&&t.bracket===0&&t.brace===0&&n===null}function da(e){let t=e.indexOf("(");if(t===-1)return e.indexOf("{");let n=k(e,"(",")",t);if(n===-1)return-1;return e.indexOf("{",n)}function Mu(e){let t=da(e);if(t===-1)return!0;return k(e,"{","}",t)===-1}function ca(e,t,n){let i=n,a=t+1;while(a<e.length&&!pa(i)){let u=e[a];i+=`
709
- ${u}`,a++}while(a<e.length){let u=e[a].trim();if(u.startsWith(".")||u.startsWith("?."))i+=`
710
- ${e[a]}`,a++;else break}return{value:i,nextIndex:a}}function ju(e,t,n){let i=n,a=t+1;while(a<e.length){let u=da(i);if(u!==-1){if(k(i,"{","}",u)!==-1)break}let l=e[a];i+=`
711
- ${l}`,a++}return{functionCode:i,nextIndex:a}}function la(e,t){let n=d(e,t)??d(`(${e})`,t);if(n!==void 0)return n;if(!/\bprocess\b/.test(e))return;let i={...t,process:Object.freeze({env:{...Vt.env}})},a=Object.keys(i).filter(Ut),u=a.map((l)=>i[l]);try{return Function(...a,`'use strict'; return (${e});`)(...u)}catch{try{return Function(...a,`'use strict'; return ${e};`)(...u)}catch{return}}}async function Nu(e,t,n){let i=e.matchAll(/export\s+(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:export\s+|$))/g);for(let u of i){let[,,l,f]=u;try{let x=f.trim().replace(/;$/,""),v=la(x,t);if(v!==void 0)t[l]=v}catch(x){console.warn(`Failed to parse export ${l} 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 u of a){let[,,l,f]=u;if(!(l in t))try{let x=f.trim().replace(/;$/,""),v=la(x,t);if(v!==void 0)t[l]=v}catch{}}}function ol(e){let t=e.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),n=t?t[1]:"",i=t?e.replace(/<script\b[^>]*>[\s\S]*?<\/script>/i,""):e;return{scriptContent:n,templateWithoutScript:i}}function il(e){let t=e.trim();if(!t)return!1;return/(?:const|let|var|function)\s+\w+/.test(t)}
712
- export{Me,Ce,K,js,Bs,X,_r,Fs,zs,fi,gi,mi,Hs,hi,Hc,Dt,Le,o,pe,S,Vc,_,Cr,Vs,Ee,T,je,L,Mt,Lt,J,bn,Be,w,Uc,be,te,Er,Tr,$r,fe,jt,ne,j,ct,Rr,Ar,lt,yi,Us,gg,Fe,Wc,qc,bi,Kc,wi,Xc,Ws,vi,Gc,Jc,xi,Si,wn,qs,vn,Bt,Ft,Yc,Ks,Zc,Qc,xn,Pr,Xs,Gs,el,ki,tl,nl,rl,sl,Sn,mg,hg,yg,bg,wg,h,vg,_i,xg,ol,il,Ci,Ei,Sg,zt,al,kg,cl,fy,ze,kn,He,_g,Cg,Eg,Tg,$g,Js,Rg,Ve,re,Ue,Ag,Ir,Pg,ll,ul,Ti,We,s,_n,dl,y,we,gy,pl,fl,gl,$i,Ys,Ig,my,Og,hy,Cn,g,G,se,En,Te,Ng,Ri,Dg,yy,R,Ai,Mg,by,I,wy};