@stacksjs/stx 0.2.793 → 0.2.795

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 (239) hide show
  1. package/dist/chunk-027hdpgv.js +2 -0
  2. package/dist/chunk-054h7ktz.js +2 -0
  3. package/dist/chunk-09nyt9c5.js +2 -0
  4. package/dist/chunk-0d3ncyqh.js +2 -0
  5. package/dist/{chunk-2gqhfge6.js → chunk-12jjf2me.js} +2 -2
  6. package/dist/{chunk-jdj1358b.js → chunk-1hq3y7ss.js} +2 -2
  7. package/dist/{chunk-b4r7d6me.js → chunk-1q16p7t2.js} +5 -5
  8. package/dist/chunk-1yew6rw9.js +2 -0
  9. package/dist/chunk-211kxm18.js +2 -0
  10. package/dist/chunk-26y92p8r.js +2 -0
  11. package/dist/{chunk-a4cse2tj.js → chunk-2bvaakcv.js} +3 -3
  12. package/dist/{chunk-1z9hbzpk.js → chunk-2e5tvryz.js} +1 -1
  13. package/dist/{chunk-66r0f799.js → chunk-2xprqx2v.js} +5 -5
  14. package/dist/{chunk-dhqp3z4w.js → chunk-3em44jbm.js} +2 -2
  15. package/dist/chunk-3ep9h16p.js +2 -0
  16. package/dist/{chunk-6jzqzap6.js → chunk-3f8w1x6w.js} +10 -10
  17. package/dist/{chunk-14ft0zc7.js → chunk-3vpgr6nk.js} +6 -6
  18. package/dist/{chunk-8nb8b0nf.js → chunk-427mhgje.js} +1 -1
  19. package/dist/chunk-49tn6yst.js +2 -0
  20. package/dist/chunk-4b7dwwn6.js +2 -0
  21. package/dist/chunk-4ncbq4bx.js +2 -0
  22. package/dist/{chunk-985afhhy.js → chunk-4p5g7v9g.js} +2 -2
  23. package/dist/{chunk-7pk3t82j.js → chunk-4s0ye933.js} +2 -2
  24. package/dist/chunk-4srnxp3b.js +2 -0
  25. package/dist/chunk-538d185r.js +3 -0
  26. package/dist/{chunk-605b93pe.js → chunk-53v4cby3.js} +4 -4
  27. package/dist/{chunk-94gyfwpz.js → chunk-624xpap6.js} +12 -12
  28. package/dist/{chunk-kr8qdg0r.js → chunk-6s9bk98p.js} +2 -2
  29. package/dist/{chunk-q14d714d.js → chunk-6wpwpk3c.js} +4 -4
  30. package/dist/chunk-6z4bza9z.js +2 -0
  31. package/dist/chunk-75y9heas.js +2 -0
  32. package/dist/chunk-7ckdvsmj.js +3 -0
  33. package/dist/{chunk-rrb9m2q2.js → chunk-7k6hd10j.js} +5 -5
  34. package/dist/{chunk-1y9ez7nz.js → chunk-7s1kerhs.js} +2 -2
  35. package/dist/{chunk-k4bdf0dw.js → chunk-7xs45trj.js} +2 -2
  36. package/dist/{chunk-kce6pzmj.js → chunk-7y29q1ng.js} +3 -3
  37. package/dist/{chunk-vj59es75.js → chunk-7y73txmp.js} +1 -1
  38. package/dist/{chunk-gg71gm25.js → chunk-88acqv2r.js} +4 -4
  39. package/dist/{chunk-4de6rhaj.js → chunk-8t8e75xm.js} +4 -4
  40. package/dist/chunk-8w1wxr96.js +2 -0
  41. package/dist/{chunk-7gdwvnwc.js → chunk-8zf87cc5.js} +2 -2
  42. package/dist/{chunk-gv3bfkdm.js → chunk-90zswh9v.js} +5 -5
  43. package/dist/chunk-98kjk52z.js +2 -0
  44. package/dist/{chunk-c2qwbej3.js → chunk-9b9tvhmh.js} +5 -5
  45. package/dist/{chunk-bb2zfgwf.js → chunk-9jcqbgq9.js} +5 -5
  46. package/dist/chunk-9sea317f.js +2 -0
  47. package/dist/chunk-9tpv4cg7.js +2 -0
  48. package/dist/{chunk-qzb0v08n.js → chunk-ak10vygz.js} +1 -1
  49. package/dist/{chunk-m997knnz.js → chunk-aksrh8je.js} +3 -3
  50. package/dist/{chunk-6v4b0xc1.js → chunk-ata5wp2m.js} +4 -4
  51. package/dist/{chunk-a1ynjj47.js → chunk-axjfaere.js} +1226 -449
  52. package/dist/chunk-axq3c7cb.js +2 -0
  53. package/dist/{chunk-2hwwmn7c.js → chunk-ayd635jf.js} +5 -5
  54. package/dist/{chunk-qv85c3qy.js → chunk-azqf0ps0.js} +2 -2
  55. package/dist/{chunk-gb65t4n1.js → chunk-b58n1kfe.js} +2 -2
  56. package/dist/{chunk-c0ejyxfj.js → chunk-baj6w8ja.js} +2 -2
  57. package/dist/{chunk-es006emk.js → chunk-bwf8b4e4.js} +3 -3
  58. package/dist/{chunk-h0jnatd4.js → chunk-bzhzp4f4.js} +2 -2
  59. package/dist/chunk-c5trhqpg.js +2 -0
  60. package/dist/{chunk-bmfk3b29.js → chunk-c5vzr1va.js} +2 -2
  61. package/dist/chunk-c692kj5v.js +2 -0
  62. package/dist/{chunk-55j4jxwe.js → chunk-cepctq7e.js} +108 -108
  63. package/dist/{chunk-0r61tkfe.js → chunk-cfbpvm5e.js} +2 -2
  64. package/dist/chunk-cfr7cd88.js +2 -0
  65. package/dist/{chunk-bwcj9z19.js → chunk-d50vw81s.js} +4 -4
  66. package/dist/chunk-dsh5q9bg.js +2 -0
  67. package/dist/{chunk-e3wmnjz8.js → chunk-dstzvtvk.js} +3 -3
  68. package/dist/{chunk-2p4yad7w.js → chunk-dxe94pwy.js} +4 -4
  69. package/dist/{chunk-0ykteae5.js → chunk-ectx5ar9.js} +3 -3
  70. package/dist/chunk-emnphnz7.js +2 -0
  71. package/dist/chunk-ennzzth4.js +177 -0
  72. package/dist/chunk-epcdgn78.js +2 -0
  73. package/dist/chunk-etegf4zj.js +2 -0
  74. package/dist/chunk-ewzdsksb.js +2 -0
  75. package/dist/chunk-ey8bgg6x.js +2 -0
  76. package/dist/chunk-f03sg8b0.js +2 -0
  77. package/dist/{chunk-w5hhqjwr.js → chunk-f4j7nsj1.js} +1 -1
  78. package/dist/{chunk-fpn4dren.js → chunk-fcqxa38q.js} +1 -1
  79. package/dist/{chunk-j4s5k8sp.js → chunk-g4n0bjfb.js} +52 -52
  80. package/dist/chunk-gf04pgaa.js +2 -0
  81. package/dist/chunk-ghn8vhet.js +2 -0
  82. package/dist/chunk-gywp6kd8.js +2 -0
  83. package/dist/{chunk-tnn0br4w.js → chunk-h656zg6k.js} +3 -3
  84. package/dist/{chunk-syheccfj.js → chunk-hnbx1t3t.js} +2 -2
  85. package/dist/{chunk-g89fx9rq.js → chunk-hp10khyy.js} +41 -41
  86. package/dist/{chunk-d18xd9x5.js → chunk-hwcfgs3e.js} +3 -3
  87. package/dist/{chunk-5a92srn2.js → chunk-jmbh26gv.js} +1 -1
  88. package/dist/chunk-k6sjqb7g.js +2 -0
  89. package/dist/{chunk-vrbcdds3.js → chunk-ka8sk5qa.js} +1 -1
  90. package/dist/{chunk-r2nvxbjc.js → chunk-m081078c.js} +2 -2
  91. package/dist/{chunk-spt5kmb2.js → chunk-mcj5qtpp.js} +1 -1
  92. package/dist/chunk-me71d5w5.js +2 -0
  93. package/dist/{chunk-6h7yhyb8.js → chunk-njk5db1q.js} +4 -4
  94. package/dist/chunk-nvytej81.js +2 -0
  95. package/dist/{chunk-xc0vws7m.js → chunk-nyer6v3y.js} +5 -5
  96. package/dist/chunk-p1txw41y.js +2 -0
  97. package/dist/{chunk-agtvdtx4.js → chunk-p3ej3954.js} +2 -2
  98. package/dist/chunk-p8gekf4b.js +2 -0
  99. package/dist/{chunk-6jx0trea.js → chunk-pm8a4kdf.js} +6 -6
  100. package/dist/{chunk-56yhvhjq.js → chunk-pnddmgjf.js} +7 -7
  101. package/dist/chunk-px0qsd38.js +2 -0
  102. package/dist/{chunk-27rzdq3n.js → chunk-qnxctfdf.js} +2 -2
  103. package/dist/chunk-qr23snrp.js +2 -0
  104. package/dist/{chunk-v8rfeev5.js → chunk-r1vkk7qp.js} +2 -2
  105. package/dist/{chunk-qp3xd98j.js → chunk-r3a15pax.js} +2 -2
  106. package/dist/{chunk-pa9zfbh6.js → chunk-rdymnn2t.js} +2 -2
  107. package/dist/{chunk-g3z2g6hm.js → chunk-reb7rddz.js} +1 -1
  108. package/dist/chunk-s151a2dj.js +2 -0
  109. package/dist/{chunk-v1z6n7wz.js → chunk-sphc7xzx.js} +4 -4
  110. package/dist/chunk-sqettc34.js +2 -0
  111. package/dist/chunk-srgbv05n.js +2 -0
  112. package/dist/chunk-t0d4rsfx.js +2 -0
  113. package/dist/chunk-t0k0yk24.js +2 -0
  114. package/dist/chunk-tdcgskyy.js +2 -0
  115. package/dist/chunk-te3hr6d7.js +2 -0
  116. package/dist/chunk-tes8fdv6.js +2 -0
  117. package/dist/{chunk-9tqa8xvf.js → chunk-thpwk6ya.js} +2 -2
  118. package/dist/{chunk-w9nwb8r3.js → chunk-tmfrq4nq.js} +7 -7
  119. package/dist/{chunk-tnkxww7b.js → chunk-tqvw1673.js} +5 -5
  120. package/dist/chunk-v6j5vkce.js +2 -0
  121. package/dist/chunk-vmp876q6.js +2 -0
  122. package/dist/{chunk-4s5q1aea.js → chunk-vpzdqbw7.js} +4 -4
  123. package/dist/{chunk-tktkj2dc.js → chunk-vwp5fchy.js} +1 -1
  124. package/dist/{chunk-hs9fzxn0.js → chunk-w6e30qkz.js} +13 -13
  125. package/dist/{chunk-3gn1t0pa.js → chunk-w76cve9j.js} +9 -9
  126. package/dist/{chunk-7yb8943c.js → chunk-wa7fzgw7.js} +4 -4
  127. package/dist/chunk-wes5fdpe.js +2 -0
  128. package/dist/chunk-wfnfb4fr.js +2 -0
  129. package/dist/{chunk-cdsv4yrv.js → chunk-wfrqwtar.js} +1 -1
  130. package/dist/chunk-wzwfbehm.js +20 -0
  131. package/dist/{chunk-xadd911n.js → chunk-x8ghjw9b.js} +2 -2
  132. package/dist/{chunk-74rf78w8.js → chunk-x8h81amr.js} +2 -2
  133. package/dist/chunk-xbhb8102.js +2 -0
  134. package/dist/{chunk-5j619xgb.js → chunk-xqjat573.js} +2 -2
  135. package/dist/chunk-xv4paxmt.js +2 -0
  136. package/dist/{chunk-628jcm1d.js → chunk-y2jqx5k4.js} +1 -1
  137. package/dist/{chunk-g7anxh36.js → chunk-y64f5t74.js} +5 -5
  138. package/dist/chunk-yeaqebnd.js +2 -0
  139. package/dist/chunk-yj20tq3s.js +2 -0
  140. package/dist/chunk-yjm7c78z.js +2 -0
  141. package/dist/{chunk-h0c6jtrj.js → chunk-yjnaqahd.js} +4 -4
  142. package/dist/{chunk-4cffjp4f.js → chunk-zmr0pvcd.js} +113 -105
  143. package/dist/{chunk-44ep7dkr.js → chunk-zv3zpmv1.js} +1 -1
  144. package/dist/{chunk-bxxgr5c5.js → chunk-zva4a7xq.js} +2 -2
  145. package/dist/cli.js +19 -19
  146. package/dist/client/signals-authoring-runtime.js +2 -2
  147. package/dist/client/signals-binding-utils-runtime.js +14 -8
  148. package/dist/client/signals-component-props-runtime.js +8 -2
  149. package/dist/client/signals-expression-compiler-runtime.js +1 -1
  150. package/dist/client/signals-for-runtime.js +34 -0
  151. package/dist/client/signals-handler-runtime.js +43 -20
  152. package/dist/client/signals-helpers-runtime.js +39 -0
  153. package/dist/client/signals-native-row-runtime.d.ts +26 -0
  154. package/dist/client/signals-native-row-runtime.js +626 -0
  155. package/dist/client/signals-process-element-runtime.js +305 -287
  156. package/dist/client/signals-proxy-runtime.js +56 -31
  157. package/dist/craft-entry.js +2 -2
  158. package/dist/craft.js +2 -2
  159. package/dist/native/accessibility.js +8 -0
  160. package/dist/native/compiler/bundle.js +1 -1
  161. package/dist/native/compiler/inline-style.js +38 -1
  162. package/dist/native/compiler/style-variables.js +9 -1
  163. package/dist/native/event-names.js +1 -0
  164. package/dist/native/prop-names.js +9 -1
  165. package/dist/native/runtime/binding-tree.d.ts +2 -0
  166. package/dist/native/runtime/binding-tree.js +12 -1
  167. package/dist/native/runtime/craft-bridge.js +66 -0
  168. package/dist/native/runtime/craft.d.ts +78 -2
  169. package/dist/native/runtime/native-host.d.ts +2 -0
  170. package/dist/native/runtime/native-host.js +219 -94
  171. package/dist/pwa.js +3 -3
  172. package/dist/signals.d.ts +13 -10
  173. package/dist/signals.js +5 -3
  174. package/dist/ssg.js +15 -15
  175. package/dist/stx-virtual-ts.d.ts +25 -1
  176. package/dist/stx-virtual-ts.js +109 -6
  177. package/dist/typecheck.d.ts +3 -1
  178. package/dist/typecheck.js +28 -11
  179. package/package.json +5 -5
  180. package/dist/chunk-0a9ceqa8.js +0 -2
  181. package/dist/chunk-0cm94ksp.js +0 -2
  182. package/dist/chunk-0ppx28f6.js +0 -2
  183. package/dist/chunk-1aent61q.js +0 -2
  184. package/dist/chunk-1brkqd5f.js +0 -2
  185. package/dist/chunk-1pbyr47e.js +0 -2
  186. package/dist/chunk-1tvb2stj.js +0 -2
  187. package/dist/chunk-22z2cwhv.js +0 -2
  188. package/dist/chunk-276e3d0g.js +0 -3
  189. package/dist/chunk-27vn4674.js +0 -2
  190. package/dist/chunk-2vxh8b8g.js +0 -2
  191. package/dist/chunk-33na85q2.js +0 -2
  192. package/dist/chunk-3t4t655h.js +0 -2
  193. package/dist/chunk-43ynckvh.js +0 -2
  194. package/dist/chunk-44tq4d62.js +0 -2
  195. package/dist/chunk-499v1ade.js +0 -2
  196. package/dist/chunk-4gx5ze56.js +0 -2
  197. package/dist/chunk-4v22nj67.js +0 -2
  198. package/dist/chunk-55wsqxfk.js +0 -2
  199. package/dist/chunk-5pe7wcvh.js +0 -2
  200. package/dist/chunk-5y5k6x3r.js +0 -2
  201. package/dist/chunk-699t603m.js +0 -2
  202. package/dist/chunk-6f6xqzhb.js +0 -2
  203. package/dist/chunk-7fx8p9w5.js +0 -2
  204. package/dist/chunk-8698v9gf.js +0 -2
  205. package/dist/chunk-8pphy0p1.js +0 -2
  206. package/dist/chunk-98308vtv.js +0 -20
  207. package/dist/chunk-ad2fk303.js +0 -2
  208. package/dist/chunk-ajj56vrw.js +0 -2
  209. package/dist/chunk-brqcepmv.js +0 -2
  210. package/dist/chunk-d5e47gr4.js +0 -2
  211. package/dist/chunk-d910ytt2.js +0 -2
  212. package/dist/chunk-d9p7xaj7.js +0 -2
  213. package/dist/chunk-ddbkw53b.js +0 -2
  214. package/dist/chunk-dtnyrjcj.js +0 -2
  215. package/dist/chunk-dyp0kgmr.js +0 -177
  216. package/dist/chunk-fc384a2h.js +0 -2
  217. package/dist/chunk-fkkdt6sj.js +0 -2
  218. package/dist/chunk-fxy0cq7h.js +0 -2
  219. package/dist/chunk-g6smtcc0.js +0 -2
  220. package/dist/chunk-gnydrw29.js +0 -2
  221. package/dist/chunk-jkm34gec.js +0 -2
  222. package/dist/chunk-js5zve3p.js +0 -2
  223. package/dist/chunk-k3mcb700.js +0 -3
  224. package/dist/chunk-kn38mjpp.js +0 -2
  225. package/dist/chunk-kvmpc0sg.js +0 -2
  226. package/dist/chunk-ncxed9r1.js +0 -2
  227. package/dist/chunk-nf2bzqaw.js +0 -2
  228. package/dist/chunk-nptp3x62.js +0 -2
  229. package/dist/chunk-qd9f47ds.js +0 -2
  230. package/dist/chunk-s1wdzttg.js +0 -2
  231. package/dist/chunk-t8vtf522.js +0 -2
  232. package/dist/chunk-t9744tty.js +0 -2
  233. package/dist/chunk-th5afzmv.js +0 -2
  234. package/dist/chunk-vaqqch06.js +0 -2
  235. package/dist/chunk-vgzfsh1z.js +0 -2
  236. package/dist/chunk-wr3adhd8.js +0 -2
  237. package/dist/chunk-zdwnzq78.js +0 -2
  238. package/dist/chunk-zsjw2jgy.js +0 -2
  239. package/dist/chunk-zyf6737j.js +0 -2
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{ze,xn,Vs,vi,O}from"./chunk-27rzdq3n.js";import{vn}from"./chunk-syheccfj.js";import{Or,k,cl,at,$i,ll}from"./chunk-gb65t4n1.js";import{A}from"./chunk-2yxva96k.js";import{Us,u,f,jt,d,q,B,w,Xs,_e,Ve,Gs}from"./chunk-94gyfwpz.js";import{s,ge}from"./chunk-14ft0zc7.js";import{g}from"./chunk-0dve54ne.js";import{K}from"./chunk-bmfk3b29.js";import Ye from"path";import Ct from"process";import{AsyncLocalStorage as Fo}from"async_hooks";var fr=new Fo;function mn(e){return e.__stx_server_data??={pending:new Map,values:new Map}}function dr(e,n){return fr.run(mn(e),n)}async function pr(e,n){let t=fr.getStore();if(!t)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=t.pending.get(e);if(i)return i;let a=Promise.resolve().then(n).then((l)=>{let c=JSON.stringify(l,(v,E)=>{if(E===void 0||typeof E==="function"||typeof E==="symbol"||typeof E==="bigint"||typeof E==="number"&&!Number.isFinite(E))throw TypeError(`useServerData(${JSON.stringify(e)}) requires JSON-serializable data`);if(E&&typeof E==="object"&&!Array.isArray(E)&&Object.getPrototypeOf(E)!==Object.prototype&&Object.getPrototypeOf(E)!==null)throw TypeError(`useServerData(${JSON.stringify(e)}) requires JSON-serializable data`);return E}),y=JSON.parse(c);return t.values.set(e,y),y}).catch((l)=>{throw t.pending.delete(e),l});return t.pending.set(e,a),a}function _r(e){let n=e.__stx_server_data;if(!n?.values.size)return"";return`<script data-stx-scoped data-stx-server-data type="application/json">${JSON.stringify(Object.fromEntries(n.values)).replace(/</g,"\\u003c").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}</script>`}function z(e,n=!1){let t=s(e),i=[],a=new Set,l=0,c=0,y=t.length,v=()=>{if(l!==0)return;let E=t.slice(c).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*(?:[!:;,\n]|=(?!=)|$)/);if(E){if(n&&E[1]==="const")return;let P=E[2];if(!a.has(P))i.push(P),a.add(P);return}let R=t.slice(c).match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(R){if(n&&t.slice(c).startsWith("const"))return;R[1].split(",").forEach((P)=>{let D=P.trim();if(!D)return;let X=D.indexOf(":"),L=(X>=0?D.slice(X+1).trim():D).split(/[\s=]/)[0];if(L&&!a.has(L))i.push(L),a.add(L)});return}let M=t.slice(c).match(/^(?:const|let|var)\s+\[([^\]]+)\]\s*=/);if(M){if(n&&t.slice(c).startsWith("const"))return;M[1].split(",").forEach((P)=>{let D=P.trim().replace(/^\.\.\./,"");if(!D)return;let X=D.split(/[\s=]/)[0];if(X&&!a.has(X))i.push(X),a.add(X)});return}if(n)return;let N=t.slice(c).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(N){let P=N[1];if(!a.has(P))i.push(P),a.add(P);return}let j=t.slice(c).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(j){let P=j[1];if(!a.has(P))i.push(P),a.add(P)}};while(c<y){if(t[c]==="{"){l++,c++;continue}if(t[c]==="}"){l--,c++;continue}if(l===0&&/[a-z]/i.test(t[c])&&(c===0||/\s|[;{}()]/.test(t[c-1])))v();c++}return i.join(", ")}function As(e){return`{ enumerable: true, configurable: true, get() { return ${e} }, set(__stxValue_${e}) { ${e} = __stxValue_${e} } }`}function Vo(e,n=z(e).split(",").map((t)=>t.trim()).filter(Boolean)){let t=new Set(z(e,!0).split(",").map((i)=>i.trim()));return n.map((i)=>t.has(i)?`get ${i}() { return ${i} }, set ${i}(__stxValue_${i}) { ${i} = __stxValue_${i} }`:i).join(", ")}function Ps(e,n){let t=`{ ${Vo(e,n)} }`;return z(e).split(",").some((i)=>i.trim()==="__stxLiveBindings")?`Object.defineProperties(${t}, Object.getOwnPropertyDescriptors(__stxLiveBindings))`:t}import In from"fs";import We from"path";function H(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}var gr=new Map;function yr(e,n=!0){let t=gr.get(e);if(n&&t)return t;let i=new Map,a=[We.join(e,"src"),We.join(e,"dist"),e];function l(c,y){if(y>6)return;let v;try{v=In.readdirSync(c,{withFileTypes:!0})}catch{return}for(let E of v){let R=We.join(c,E.name);if(E.isDirectory()){if(E.name==="node_modules"||E.name.startsWith("."))continue;l(R,y+1)}else if(E.isFile()&&E.name.endsWith(".stx")){let M=E.name.slice(0,-4);if(!i.has(M))i.set(M,R);let N=M.toLowerCase();if(!i.has(N))i.set(N,R);let j=H(M);if(!i.has(j))i.set(j,R)}}}for(let c of a)if(l(c,0),i.size>0)break;if(n)gr.set(e,i);return i}function Is(e,n){if(e.startsWith(".")||e.startsWith("/"))return null;let t=n;while(!0){let i=We.join(t,"node_modules",e);try{if(In.statSync(i).isDirectory())return i}catch{}let a=We.dirname(t);if(a===t)return null;t=a}}function Os(e,n,t={}){return[We.resolve(We.dirname(n),`${e}.stx`),We.resolve(We.dirname(n),e),We.resolve(t.componentsDir||"components",`${e}.stx`),We.resolve(t.componentsDir||"components",e),e.endsWith(".stx")?e:`${e}.stx`]}function mr(e){let n=e.endsWith(".stx")?e.slice(0,-4):e,t=n.split("-").map((a)=>a.charAt(0).toUpperCase()+a.slice(1)).join(""),i=H(n);return[n,t,i]}function ri(e,n){let[t,i,a]=mr(e);for(let l of[t,t.toLowerCase(),i,a]){let c=n?.__importedComponents?.get(l);if(c!==void 0)return c}}function*si(e,n,t={},i){let a=mr(e);if(a[0].startsWith("./")||a[0].startsWith("../")){yield We.resolve(We.dirname(n),`${a[0]}.stx`);return}let l=[...new Set(a.map((v)=>`${v}.stx`))],c=t.projectRoot||process.cwd(),y=[...i?.__originalFilePath?[We.join(We.dirname(i.__originalFilePath),"components")]:[],...t.componentsDir?[t.componentsDir]:[],We.join(We.dirname(n),"components"),We.resolve(c,"src/components"),We.resolve(c,"components"),...import.meta.dir?[We.resolve(import.meta.dir,"components")]:[]];for(let v of new Set(y)){for(let E of l)yield We.join(v,E);try{for(let E of In.readdirSync(v,{withFileTypes:!0}))if(E.isDirectory())for(let R of l)yield We.join(v,E.name,R)}catch{}}}function hr(e,n,t={},i){let a=ri(e,i);if(a!==void 0)return a;for(let l of si(e,n,t,i))try{if(In.statSync(l,{throwIfNoEntry:!1})?.isFile())return l}catch{}return null}function Ns(e,n=[],t={}){let i=new Set([...e].map((E)=>E.replace(/[-_]/g,"").toLowerCase()));if(!i.has("src")||!i.has("alt")&&!i.has("decorative"))return!1;let a=new Map(Object.entries(t).map(([E,R])=>[E.replace(/[-_]/g,"").toLowerCase(),R])),l=a.get("alt"),c=a.get("decorative"),y=typeof l==="string"&&!!l.trim(),v=typeof c==="string"?!["false","0","off","no"].includes(c.trim().toLowerCase()):Boolean(c);if(!y&&!v)return!1;if(["source","resizemode","defaultsource","provider","format","densities","quality","preload","modifiers","preset"].some((E)=>i.has(E)))return!1;if([...n].some((E)=>!["load","error"].includes(E.replace(/^@/,"").split(".")[0].toLowerCase())))return!1;return["fit","objectfit","position","objectposition","rounded","aspectratio","zoomonhover","sources","webpsrc","webpsrcset"].some((E)=>i.has(E))}import Xn from"fs";import ce from"path";import ht from"path";import Jt from"fs";var Uo=new Set(["touchstart","touchmove","wheel","mousewheel"]);function us(e,n){if(n.passive)return!0;if(n.prevent||n.nonpassive)return!1;return Uo.has(e.toLowerCase())}var $r=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"]),Er={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"},Ho=new Set(["ctrl","alt","shift","meta"]),Ar={left:0,middle:1,right:2};function Rr(e){let n={prevent:!1,stop:!1,once:!1,capture:!1,self:!1,passive:!1,nonpassive:!1,keys:[],systemKeys:[],mouse:null,debounce:null,throttle:null};for(let t of e){let i=t.toLowerCase();if(i==="prevent")n.prevent=!0;else if(i==="stop")n.stop=!0;else if(i==="once")n.once=!0;else if(i==="capture")n.capture=!0;else if(i==="self")n.self=!0;else if(i==="passive")n.passive=!0;else if(i==="nonpassive")n.nonpassive=!0;else if(Ho.has(i))n.systemKeys.push(i);else if(i in Ar)n.mouse=i;else if(i in Er||/^[a-z]$/.test(i))n.keys.push(Er[i]||i.toUpperCase());else if(i.startsWith("debounce")){let a=i.match(/debounce(?:\.(\d+))?/);n.debounce=a?.[1]?Number.parseInt(a[1],10):300}else if(i.startsWith("throttle")){let a=i.match(/throttle(?:\.(\d+))?/);n.throttle=a?.[1]?Number.parseInt(a[1],10):300}}return n}function Ir(e,n=""){let t=[],i=0,a=/<([a-z][a-z0-9-]*)\s+([^>]*@[a-z][^>]*)>/gi,l;while((l=a.exec(e))!==null){let[c,y,v]=l,E=l.index,R=E+c.length,M=`__stx_evt_${n}${i++}`,N=[],j=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,P;while((P=j.exec(v))!==null){let[,X,F]=P,L=X.split("."),Q=L[0];if(!$r.has(Q))continue;N.push({attribute:`@${X}`,event:Q,handler:F,modifiers:Rr(L.slice(1)),elementId:M})}let D=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((P=D.exec(v))!==null){let[,X,F]=P,L=X.split("."),Q=L[0];if(!$r.has(Q))continue;N.push({attribute:`@${X}`,event:Q,handler:F,modifiers:Rr(L.slice(1)),elementId:M})}if(N.length>0)t.push({originalTag:c,elementId:M,events:N,startIndex:E,endIndex:R})}return t}function Ko(e){let n=[],{modifiers:t}=e;if(t.self)n.push("if ($event.target !== $el) return");for(let i of t.systemKeys)n.push(`if (!$event.${i}Key) return`);if(t.keys.length>0){let i=t.keys.map((a)=>`$event.key === '${a}'`).join(" || ");n.push(`if (!(${i})) return`)}if(t.mouse!==null){let i=Ar[t.mouse];n.push(`if ($event.button !== ${i}) return`)}if(t.prevent)n.push("$event.preventDefault()");if(t.stop)n.push("$event.stopPropagation()");return n.join("; ")}function Zo(e,n){let t=e;if(n.debounce!==null)t=`__stx_debounce(() => { ${t} }, ${n.debounce})`;else if(n.throttle!==null)t=`__stx_throttle(() => { ${t} }, ${n.throttle})`;return t}function fs(e){let n=e.trim();if(!/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(n))return e;return`if (typeof ${n} === 'function' && !${n}._isSignal) ${n}($event);`}function qo(e){let{modifiers:n}=e,t=e.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),i=Ko(e),a=Zo(fs(e.handler),n),l=[];if(n.once)l.push("once: true");if(n.capture)l.push("capture: true");if(us(e.event,n))l.push("passive: true");let c=l.length>0?`, { ${l.join(", ")} }`:"",y=a.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t");if(e.event==="mounted")return`
2
+ import{ze,xn,Us,xi,O}from"./chunk-qnxctfdf.js";import{vn}from"./chunk-hnbx1t3t.js";import{Nr,k,ll,at,Ri,ul}from"./chunk-b58n1kfe.js";import{A}from"./chunk-2yxva96k.js";import{Ws,u,f,jt,d,q,B,w,Gs,_e,Ve,Js}from"./chunk-624xpap6.js";import{r,ge}from"./chunk-3vpgr6nk.js";import{g}from"./chunk-0dve54ne.js";import{K}from"./chunk-c5vzr1va.js";import et from"path";import Tt from"process";import{AsyncLocalStorage as Ko}from"async_hooks";var fr=new Ko;function mn(e){return e.__stx_server_data??={pending:new Map,values:new Map}}function dr(e,n){return fr.run(mn(e),n)}async function pr(e,n){let t=fr.getStore();if(!t)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=t.pending.get(e);if(i)return i;let a=Promise.resolve().then(n).then((l)=>{let c=JSON.stringify(l,(v,E)=>{if(E===void 0||typeof E==="function"||typeof E==="symbol"||typeof E==="bigint"||typeof E==="number"&&!Number.isFinite(E))throw TypeError(`useServerData(${JSON.stringify(e)}) requires JSON-serializable data`);if(E&&typeof E==="object"&&!Array.isArray(E)&&Object.getPrototypeOf(E)!==Object.prototype&&Object.getPrototypeOf(E)!==null)throw TypeError(`useServerData(${JSON.stringify(e)}) requires JSON-serializable data`);return E}),y=JSON.parse(c);return t.values.set(e,y),y}).catch((l)=>{throw t.pending.delete(e),l});return t.pending.set(e,a),a}function Cr(e){let n=e.__stx_server_data;if(!n?.values.size)return"";return`<script data-stx-scoped data-stx-server-data type="application/json">${JSON.stringify(Object.fromEntries(n.values)).replace(/</g,"\\u003c").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}</script>`}function z(e,n=!1){let t=r(e),i=[],a=new Set,l=0,c=0,y=t.length,v=()=>{if(l!==0)return;let E=t.slice(c).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*(?:[!:;,\n]|=(?!=)|$)/);if(E){if(n&&E[1]==="const")return;let P=E[2];if(!a.has(P))i.push(P),a.add(P);return}let R=t.slice(c).match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(R){if(n&&t.slice(c).startsWith("const"))return;R[1].split(",").forEach((P)=>{let M=P.trim();if(!M)return;let X=M.indexOf(":"),L=(X>=0?M.slice(X+1).trim():M).split(/[\s=]/)[0];if(L&&!a.has(L))i.push(L),a.add(L)});return}let D=t.slice(c).match(/^(?:const|let|var)\s+\[([^\]]+)\]\s*=/);if(D){if(n&&t.slice(c).startsWith("const"))return;D[1].split(",").forEach((P)=>{let M=P.trim().replace(/^\.\.\./,"");if(!M)return;let X=M.split(/[\s=]/)[0];if(X&&!a.has(X))i.push(X),a.add(X)});return}if(n)return;let N=t.slice(c).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(N){let P=N[1];if(!a.has(P))i.push(P),a.add(P);return}let j=t.slice(c).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(j){let P=j[1];if(!a.has(P))i.push(P),a.add(P)}};while(c<y){if(t[c]==="{"){l++,c++;continue}if(t[c]==="}"){l--,c++;continue}if(l===0&&/[a-z]/i.test(t[c])&&(c===0||/\s|[;{}()]/.test(t[c-1])))v();c++}return i.join(", ")}function Ps(e){return`{ enumerable: true, configurable: true, get() { return ${e} }, set(__stxValue_${e}) { ${e} = __stxValue_${e} } }`}function Zo(e,n=z(e).split(",").map((t)=>t.trim()).filter(Boolean)){let t=new Set(z(e,!0).split(",").map((i)=>i.trim()));return n.map((i)=>t.has(i)?`get ${i}() { return ${i} }, set ${i}(__stxValue_${i}) { ${i} = __stxValue_${i} }`:i).join(", ")}function Is(e,n){let t=`{ ${Zo(e,n)} }`;return z(e).split(",").some((i)=>i.trim()==="__stxLiveBindings")?`Object.defineProperties(${t}, Object.getOwnPropertyDescriptors(__stxLiveBindings))`:t}import In from"fs";import We from"path";function H(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}var gr=new Map;function yr(e,n=!0){let t=gr.get(e);if(n&&t)return t;let i=new Map,a=[We.join(e,"src"),We.join(e,"dist"),e];function l(c,y){if(y>6)return;let v;try{v=In.readdirSync(c,{withFileTypes:!0})}catch{return}for(let E of v){let R=We.join(c,E.name);if(E.isDirectory()){if(E.name==="node_modules"||E.name.startsWith("."))continue;l(R,y+1)}else if(E.isFile()&&E.name.endsWith(".stx")){let D=E.name.slice(0,-4);if(!i.has(D))i.set(D,R);let N=D.toLowerCase();if(!i.has(N))i.set(N,R);let j=H(D);if(!i.has(j))i.set(j,R)}}}for(let c of a)if(l(c,0),i.size>0)break;if(n)gr.set(e,i);return i}function Os(e,n){if(e.startsWith(".")||e.startsWith("/"))return null;let t=n;while(!0){let i=We.join(t,"node_modules",e);try{if(In.statSync(i).isDirectory())return i}catch{}let a=We.dirname(t);if(a===t)return null;t=a}}function Ns(e,n,t={}){return[We.resolve(We.dirname(n),`${e}.stx`),We.resolve(We.dirname(n),e),We.resolve(t.componentsDir||"components",`${e}.stx`),We.resolve(t.componentsDir||"components",e),e.endsWith(".stx")?e:`${e}.stx`]}function mr(e){let n=e.endsWith(".stx")?e.slice(0,-4):e,t=n.split("-").map((a)=>a.charAt(0).toUpperCase()+a.slice(1)).join(""),i=H(n);return[n,t,i]}function si(e,n){let[t,i,a]=mr(e);for(let l of[t,t.toLowerCase(),i,a]){let c=n?.__importedComponents?.get(l);if(c!==void 0)return c}}function*oi(e,n,t={},i){let a=mr(e);if(a[0].startsWith("./")||a[0].startsWith("../")){yield We.resolve(We.dirname(n),`${a[0]}.stx`);return}let l=[...new Set(a.map((v)=>`${v}.stx`))],c=t.projectRoot||process.cwd(),y=[...i?.__originalFilePath?[We.join(We.dirname(i.__originalFilePath),"components")]:[],...t.componentsDir?[t.componentsDir]:[],We.join(We.dirname(n),"components"),We.resolve(c,"src/components"),We.resolve(c,"components"),...import.meta.dir?[We.resolve(import.meta.dir,"components")]:[]];for(let v of new Set(y)){for(let E of l)yield We.join(v,E);try{for(let E of In.readdirSync(v,{withFileTypes:!0}))if(E.isDirectory())for(let R of l)yield We.join(v,E.name,R)}catch{}}}function hr(e,n,t={},i){let a=si(e,i);if(a!==void 0)return a;for(let l of oi(e,n,t,i))try{if(In.statSync(l,{throwIfNoEntry:!1})?.isFile())return l}catch{}return null}function Ms(e,n=[],t={}){let i=new Set([...e].map((E)=>E.replace(/[-_]/g,"").toLowerCase()));if(!i.has("src")||!i.has("alt")&&!i.has("decorative"))return!1;let a=new Map(Object.entries(t).map(([E,R])=>[E.replace(/[-_]/g,"").toLowerCase(),R])),l=a.get("alt"),c=a.get("decorative"),y=typeof l==="string"&&!!l.trim(),v=typeof c==="string"?!["false","0","off","no"].includes(c.trim().toLowerCase()):Boolean(c);if(!y&&!v)return!1;if(["source","resizemode","defaultsource","provider","format","densities","quality","preload","modifiers","preset"].some((E)=>i.has(E)))return!1;if([...n].some((E)=>!["load","error"].includes(E.replace(/^@/,"").split(".")[0].toLowerCase())))return!1;return["fit","objectfit","position","objectposition","rounded","aspectratio","zoomonhover","sources","webpsrc","webpsrcset"].some((E)=>i.has(E))}import Xn from"fs";import ce from"path";import xt from"path";import Jt from"fs";var qo=new Set(["touchstart","touchmove","wheel","mousewheel"]);function us(e,n){if(n.passive)return!0;if(n.prevent||n.nonpassive)return!1;return qo.has(e.toLowerCase())}var $r=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"]),Rr={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"},Xo=new Set(["ctrl","alt","shift","meta"]),Ir={left:0,middle:1,right:2};function Tr(e){let n={prevent:!1,stop:!1,once:!1,capture:!1,self:!1,passive:!1,nonpassive:!1,keys:[],systemKeys:[],mouse:null,debounce:null,throttle:null};for(let t of e){let i=t.toLowerCase();if(i==="prevent")n.prevent=!0;else if(i==="stop")n.stop=!0;else if(i==="once")n.once=!0;else if(i==="capture")n.capture=!0;else if(i==="self")n.self=!0;else if(i==="passive")n.passive=!0;else if(i==="nonpassive")n.nonpassive=!0;else if(Xo.has(i))n.systemKeys.push(i);else if(i in Ir)n.mouse=i;else if(i in Rr||/^[a-z]$/.test(i))n.keys.push(Rr[i]||i.toUpperCase());else if(i.startsWith("debounce")){let a=i.match(/debounce(?:\.(\d+))?/);n.debounce=a?.[1]?Number.parseInt(a[1],10):300}else if(i.startsWith("throttle")){let a=i.match(/throttle(?:\.(\d+))?/);n.throttle=a?.[1]?Number.parseInt(a[1],10):300}}return n}function Pr(e,n=""){let t=[],i=0,a=/<([a-z][a-z0-9-]*)\s+([^>]*@[a-z][^>]*)>/gi,l;while((l=a.exec(e))!==null){let[c,y,v]=l,E=l.index,R=E+c.length,D=`__stx_evt_${n}${i++}`,N=[],j=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,P;while((P=j.exec(v))!==null){let[,X,F]=P,L=X.split("."),Q=L[0];if(!$r.has(Q))continue;N.push({attribute:`@${X}`,event:Q,handler:F,modifiers:Tr(L.slice(1)),elementId:D})}let M=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((P=M.exec(v))!==null){let[,X,F]=P,L=X.split("."),Q=L[0];if(!$r.has(Q))continue;N.push({attribute:`@${X}`,event:Q,handler:F,modifiers:Tr(L.slice(1)),elementId:D})}if(N.length>0)t.push({originalTag:c,elementId:D,events:N,startIndex:E,endIndex:R})}return t}function Jo(e){let n=[],{modifiers:t}=e;if(t.self)n.push("if ($event.target !== $el) return");for(let i of t.systemKeys)n.push(`if (!$event.${i}Key) return`);if(t.keys.length>0){let i=t.keys.map((a)=>`$event.key === '${a}'`).join(" || ");n.push(`if (!(${i})) return`)}if(t.mouse!==null){let i=Ir[t.mouse];n.push(`if ($event.button !== ${i}) return`)}if(t.prevent)n.push("$event.preventDefault()");if(t.stop)n.push("$event.stopPropagation()");return n.join("; ")}function Go(e,n){let t=e;if(n.debounce!==null)t=`__stx_debounce(() => { ${t} }, ${n.debounce})`;else if(n.throttle!==null)t=`__stx_throttle(() => { ${t} }, ${n.throttle})`;return t}function fs(e){let n=e.trim();if(!/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(n))return e;return`if (typeof ${n} === 'function' && !${n}._isSignal) ${n}($event);`}function Yo(e){let{modifiers:n}=e,t=e.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),i=Jo(e),a=Go(fs(e.handler),n),l=[];if(n.once)l.push("once: true");if(n.capture)l.push("capture: true");if(us(e.event,n))l.push("passive: true");let c=l.length>0?`, { ${l.join(", ")} }`:"",y=a.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t");if(e.event==="mounted")return`
3
3
  (function() {
4
4
  var $el = document.getElementById('${t}');
5
5
  if (!$el) return;
@@ -53,7 +53,7 @@ else {
53
53
  __stx_runHandler('${y}', $event, $el);
54
54
  }
55
55
  }${c});
56
- })();`}function oi(e){if(e.length===0)return"";return`
56
+ })();`}function ii(e){if(e.length===0)return"";return`
57
57
  <script data-stx-events>
58
58
  (function() {
59
59
  'use strict';
@@ -108,11 +108,11 @@ else {
108
108
  }
109
109
 
110
110
  // Event listeners
111
- ${e.map(qo).join(`
111
+ ${e.map(Yo).join(`
112
112
  `)}
113
113
  })();
114
- </script>`}function Xo(e,n=""){let t=Ir(e,n);if(t.length===0)return{template:e,bindings:[]};let i=e,a=[];for(let l=t.length-1;l>=0;l--){let c=t[l],y=c.originalTag;if(!y.includes(" id="))y=y.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${c.elementId}"`);else{let v=y.match(/id=["']([^"']+)["']/);if(v)for(let E of c.events)E.elementId=v[1]}for(let v of c.events){let E=v.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),R=new RegExp(`\\s*${E}\\s*=\\s*"[^"]*"`,"g"),M=new RegExp(`\\s*${E}\\s*=\\s*'[^']*'`,"g");y=y.replace(R,""),y=y.replace(M,"")}i=i.slice(0,c.startIndex)+y+i.slice(c.endIndex),a.push(...c.events)}return{template:i,bindings:a}}function Tr(e){let n=e.$uid;return typeof n==="string"&&n?`${n}_`:""}function Ec(e,n,t){if(ll(e))return e;if(n.__stx_sfc_mode){if(/x-data\s*=\s*["']/.test(e))return e;let{template:y,bindings:v}=Xo(e,Tr(n)),E=n.__stx_event_bindings||[];return n.__stx_event_bindings=[...E,...v],y}let i=Ir(e,Tr(n));if(i.length===0)return e;let a=e;for(let y=i.length-1;y>=0;y--){let v=i[y],E=v.originalTag;if(!E.includes(" id="))E=E.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${v.elementId}"`);else{let R=E.match(/id=["']([^"']+)["']/);if(R)for(let M of v.events)M.elementId=R[1]}for(let R of v.events){let M=R.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),N=new RegExp(`\\s*${M}\\s*=\\s*"[^"]*"`,"g"),j=new RegExp(`\\s*${M}\\s*=\\s*'[^']*'`,"g");E=E.replace(N,""),E=E.replace(j,"")}a=a.slice(0,v.startIndex)+E+a.slice(v.endIndex)}let l=oi(i.flatMap((y)=>y.events)),c=a.lastIndexOf("</body>");if(c!==-1)a=a.slice(0,c)+l+`
115
- `+a.slice(c);else a+=l;return a}function Pr(e,n){let t=new Set;for(let i of e.split(",")){let a=i.trim().replace(/^\.\.\./,"").trim();if(!a)continue;if(n){let l=a.lastIndexOf(":");if(l!==-1)a=a.slice(l+1).trim()}if(a=a.split("=")[0].trim(),/^[A-Za-z_$][\w$]*$/.test(a))t.add(a)}return t}function Rt(e,n){let t=s(e),{depths:i,balanced:a}=ge(t),l=(y)=>!a||i[y]===0,c=new RegExp(`(?:^|[^\\w$.])((?:const|let|var|function|class)\\s+${n}\\b)`,"g");for(let y of t.matchAll(c)){let v=(y.index??0)+y[0].length-y[1].length;if(l(v))return!0}for(let y of t.matchAll(/(?:const|let|var)\s*\{([^}]*)\}/g))if(l(y.index??0)&&Pr(y[1],!0).has(n))return!0;for(let y of t.matchAll(/(?:const|let|var)\s*\[([^\]]*)\]/g))if(l(y.index??0)&&Pr(y[1],!1).has(n))return!0;return!1}var Mr="",Pn,lt=/^[A-Za-z_$][\w$]*$/,Jo=new Set(["if","for","while","switch","with"]),Dr=["(","[","{"],jr=[")","]","}"],Go=new Set(["const","let","var","return","if","for","while","do","switch","try","throw","export"]);function Yo(e){let n=s(e),t=[];for(let i of n.matchAll(/[A-Za-z_$][\w$]*|=>|\.\.\.|[^\s]/g)){let a=i.index??0;t.push({text:i[0],start:a,end:a+i[0].length})}return{code:n,tokens:t}}function ds(e){if(Pn&&e===Mr)return Pn;let{code:n,tokens:t}=Yo(e),i=new Map,a=[];for(let P=0;P<t.length;P++){let D=t[P].text;if(["(","[","{"].includes(D))a.push(P);else if([")","]","}"].includes(D)){let X=a.at(-1);if(X!==void 0&&["()","[]","{}"].includes(t[X].text+D))a.pop(),i.set(X,P),i.set(P,X)}}function l(P,D){let X=[],F=P;for(let L=P;L<D;L++){if(["(","[","{"].includes(t[L].text)&&(i.get(L)??D)<D){L=i.get(L);continue}if(t[L].text===",")X.push([F,L]),F=L+1}return X.push([F,D]),X}let c=[];function y(P,D,X,F=!1){if(t[P]?.text==="...")P++;if(P>=D)return;let L=t[P].text;if(lt.test(L)){if(X.add(L),X===R)c.push({name:L,token:P,functionScoped:F});return}if(L!=="{"&&L!=="[")return;let Q=i.get(P);if(Q===void 0||Q>=D)return;for(let[te,ae]of l(P+1,Q)){let se=te;if(L==="{")for(let ue=te;ue<ae;ue++){if(t[ue].text===":"){se=ue+1;break}if(t[ue].text==="=")break;if(["(","[","{"].includes(t[ue].text)&&i.has(ue))ue=i.get(ue)}y(se,ae,X,F)}}function v(P,D){let X=new Set;for(let[F,L]of l(P,D))y(F,L,X);return X}function E(P){let D=P;for(;D<t.length;D++){let X=t[D].text;if(["(","[","{"].includes(X)&&i.has(D)){D=i.get(D);continue}if([",",";",")","]","}"].includes(X))break}return t[Math.max(P,D-1)]?.end??n.length}let R=new Set,M=[];for(let P=0;P<t.length;P++)if(t[P].text==="=>"){let D=P-1,X=D,F;if(t[D]?.text===")"&&i.has(D))X=i.get(D),F=v(X+1,D);else if(t[D]&&lt.test(t[D].text))F=new Set([t[D].text]);else continue;let L=P+1,Q=t[L]?.text==="{"&&i.has(L)?t[i.get(L)].end:E(L);M.push({start:t[X].start,end:Q,bodyStart:t[L]?.start??Q,functionBody:!0,names:F})}else if(t[P].text==="("&&i.has(P)){let D=t[P-1]?.text;if(!D||Jo.has(D)||!lt.test(D)&&D!=="*"&&D!=="]")continue;let X=i.get(P),F=X+1;if(t[F]?.text===":"){F++;while(F<t.length&&!["{","=>",";","="].includes(t[F].text))F++}if(t[F]?.text!=="{"||!i.has(F))continue;M.push({start:t[P].start,end:t[i.get(F)].end,bodyStart:t[F].start,functionBody:D!=="catch",names:v(P+1,X)})}function N(P){let D=P;for(;D<t.length;D++){let X=t[D].text;if(Dr.includes(X)&&i.has(D)){D=i.get(D);continue}if(X===";"||jr.includes(X))break;let F=t[D-1];if(D>P&&Go.has(X)&&F.text!==".")break;if(D>P&&/[\n\r]/.test(n.slice(F.end,t[D].start))&&(/^[\w$]+$/.test(F.text)||jr.includes(F.text)||['"',"'","`"].includes(F.text))&&lt.test(X)&&!["in","of","instanceof"].includes(X))break}return D}let j=[];for(let P=0;P<t.length;P++){if(t[P].text!=="for")continue;let D=t[P+1]?.text==="await"?P+2:P+1;if(t[D]?.text!=="("||!i.has(D))continue;let X=i.get(D),F=X+1,L=t[F]?.text==="{"&&i.has(F)?i.get(F):N(F),Q=t[L]?.text===";"||t[L]?.text==="}"?t[L].end:t[Math.max(F,L-1)]?.end??n.length;j.push({headStart:D,headEnd:X,start:t[D].start,end:Q})}for(let P=0;P<t.length;P++){let D=t[P].text,X=t[P-1]?.text;if(X==="."||t[P+1]?.text===":")continue;if(X==="as"||X==="<")continue;if(D==="const"||D==="let"||D==="var"){let F=N(P+1),L=P+1,Q=!1,te=!1,ae=0;for(let se=P+1;se<=F;se++){let ue=t[se]?.text;if(se<F&&Dr.includes(ue)&&i.has(se)&&i.get(se)<F){se=i.get(se);continue}if(se<F&&ue===":"&&!te)Q=!0;else if(se<F&&ue==="="&&ae===0)Q=!1,te=!0;else if(se<F&&Q&&ue==="<")ae++;else if(se<F&&Q&&ue===">"&&ae>0)ae--;else if(se===F||ue===","&&ae===0)y(L,se,R,D==="var"),L=se+1,Q=!1,te=!1}}else if(D==="function"||D==="class"){let F=P+1;if(t[F]?.text==="*")F++;if(t[F]&&lt.test(t[F].text)&&t[F].text!=="extends")R.add(t[F].text),c.push({name:t[F].text,token:F})}else if(D==="import"){let F=P+1;if(t[F]?.text==="*"&&t[F+1]?.text==="as")F+=2;let L=t[F]?.text;if(L&&lt.test(L)&&L!=="type"&&t[F+1]?.text!=="("&&t[F+1]?.text!==".")R.add(L),c.push({name:L,token:F,file:!0});let Q=t[F]?.text==="{"?F:t[F+1]?.text===","&&t[F+2]?.text==="{"?F+2:-1;if(Q!==-1&&i.has(Q)){let te=i.get(Q);for(let[ae,se]of l(Q+1,te)){let ue=se-1;while(ue>=ae&&!lt.test(t[ue].text))ue--;if(ue>=ae&&t[ue].text!=="type")c.push({name:t[ue].text,token:ue,file:!0})}}}}return Mr=e,Pn={code:n,scopes:M,loops:j,declarations:R,sites:c,tokens:t,pairs:i},Pn}function ps(e){let n=ds(e);return{code:n.code,shadows:(t,i)=>n.scopes.some((a)=>i>=a.start&&i<a.end&&a.names.has(t))}}function On(e){return new Set(ds(e).declarations)}function Ie(e,n){let{scopes:t,loops:i,sites:a,tokens:l,pairs:c}=ds(e),y=Array.from({length:l.length},()=>-1),v=[];for(let j=0;j<l.length;j++){y[j]=v.length?v[v.length-1]:-1;let P=l[j].text;if(P==="{"&&c.has(j))v.push(j);else if(P==="}"&&v.length&&c.get(j)===v[v.length-1])v.pop()}let E=new Set,R=new Map;for(let j of a){if(!n.has(j.name))continue;E.add(j.token);let P=j.file?-1:y[j.token],D=P===-1?[0,Number.POSITIVE_INFINITY]:[l[P].start,l[c.get(P)].end];if(j.functionScoped){let F=l[j.token].start,L=t.filter((Q)=>Q.functionBody&&F>=Q.bodyStart&&F<Q.end).sort((Q,te)=>Q.end-Q.bodyStart-(te.end-te.bodyStart))[0];D=L?[L.bodyStart,L.end]:[0,Number.POSITIVE_INFINITY]}else if(!j.file){let F=i.filter((L)=>j.token>L.headStart&&j.token<L.headEnd).sort((L,Q)=>L.headEnd-L.headStart-(Q.headEnd-Q.headStart))[0];if(F)D=[F.start,F.end]}let X=R.get(j.name);if(X)X.push(D);else R.set(j.name,[D])}let M=new Set;for(let j=0;j<l.length;j++){if(l[j].text!=="import"||l[j-1]?.text===".")continue;let P=j+1;if(l[P]?.text==="type")P++;if(l[P]&&lt.test(l[P].text)&&l[P+1]?.text===",")P+=2;if(l[P]?.text==="{"&&c.has(P))for(let D=P+1;D<c.get(P);D++)M.add(D)}let N=new Set;for(let j=0;j<l.length;j++){let P=l[j].text;if(!n.has(P)||N.has(P)||E.has(j)||M.has(j))continue;let D=l[j-1]?.text;if(D==="#"||D==="."&&l[j-2]?.text!=="..")continue;if(l[j+1]?.text===":"&&(D==="{"||D===","))continue;let X=l[j].start;if(R.get(P)?.some(([F,L])=>X>=F&&X<L))continue;if(t.some((F)=>X>=F.start&&X<F.end&&F.names.has(P)))continue;N.add(P)}return N}var Pe="0.2.793";var Nr=Symbol.for(`stx.lazy-module-promises.${Pe}`);function ea(){let e=globalThis;return e[Nr]??=new Map,e[Nr]}function o(e,n){let t=ea(),i=`${import.meta.url}\x00${e}`,a=t.get(i);if(a)return a;let l=n();return t.set(i,l),l.catch(()=>{if(t.get(i)===l)t.delete(i)}),l}var ta=/<\/(script)/gi;function dn(e){if(!e||e.indexOf("</")===-1)return e;return e.replace(ta,"<\\/$1")}import zr from"fs";class U{cache=new Map;maxSize;options;sizes;bytes=0;constructor(e=100,n){this.maxSize=e,this.options=n??null,this.sizes=n?new Map:null}get byteSize(){return this.bytes}setMaxBytes(e){if(!this.options)return;this.options={...this.options,maxBytes:e};while(this.bytes>e&&this.cache.size>0){let n=this.cache.keys().next().value;if(n===void 0)break;this.delete(n)}}get(e){if(!this.cache.has(e))return;let n=this.cache.get(e);return this.cache.delete(e),this.cache.set(e,n),n}set(e,n){if(this.cache.has(e))this.delete(e);let t=this.options?this.options.sizeOf(n):0;if(this.options&&t>this.options.maxBytes)return;while(this.cache.size>0&&(this.cache.size>=this.maxSize||this.options!==null&&this.bytes+t>this.options.maxBytes)){let i=this.cache.keys().next().value;if(i===void 0)break;this.delete(i)}if(this.cache.set(e,n),this.sizes)this.sizes.set(e,t),this.bytes+=t}has(e){return this.cache.has(e)}delete(e){if(this.sizes){let n=this.sizes.get(e);if(n!==void 0)this.bytes-=n,this.sizes.delete(e)}return this.cache.delete(e)}clear(){this.cache.clear(),this.sizes?.clear(),this.bytes=0}get size(){return this.cache.size}keys(){return this.cache.keys()}values(){return this.cache.values()}}var vt=new Map,na=500;function At(e,n){if(n?.includes("g"))return new RegExp(e,n);let t=`${e}:${n||""}`;if(!vt.has(t)){if(vt.size>=na){let i=vt.keys().next().value;if(i)vt.delete(i)}vt.set(t,new RegExp(e,n))}return vt.get(t)}class Lr{pool=[];maxPoolSize=10;fnCache=new Map;fnCacheMaxSize=200;getEvaluator(e){let n=Array.from(new Set(e)),t=n.sort().join(","),i=this.pool.find((y)=>y.context.join(",")===t);if(i)return i.func;let a=this.fnCache,l=this.fnCacheMaxSize,c=(...y)=>(v)=>{try{let E=`${t}:${v}`,R=a.get(E);if(!R){if(a.size>=l){let M=a.keys().next().value;if(M)a.delete(M)}R=Function(...n,`
114
+ </script>`}function Qo(e,n=""){let t=Pr(e,n);if(t.length===0)return{template:e,bindings:[]};let i=e,a=[];for(let l=t.length-1;l>=0;l--){let c=t[l],y=c.originalTag;if(!y.includes(" id="))y=y.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${c.elementId}"`);else{let v=y.match(/id=["']([^"']+)["']/);if(v)for(let E of c.events)E.elementId=v[1]}for(let v of c.events){let E=v.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),R=new RegExp(`\\s*${E}\\s*=\\s*"[^"]*"`,"g"),D=new RegExp(`\\s*${E}\\s*=\\s*'[^']*'`,"g");y=y.replace(R,""),y=y.replace(D,"")}i=i.slice(0,c.startIndex)+y+i.slice(c.endIndex),a.push(...c.events)}return{template:i,bindings:a}}function Ar(e){let n=e.$uid;return typeof n==="string"&&n?`${n}_`:""}function $c(e,n,t){if(ul(e))return e;if(n.__stx_sfc_mode){if(/x-data\s*=\s*["']/.test(e))return e;let{template:y,bindings:v}=Qo(e,Ar(n)),E=n.__stx_event_bindings||[];return n.__stx_event_bindings=[...E,...v],y}let i=Pr(e,Ar(n));if(i.length===0)return e;let a=e;for(let y=i.length-1;y>=0;y--){let v=i[y],E=v.originalTag;if(!E.includes(" id="))E=E.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${v.elementId}"`);else{let R=E.match(/id=["']([^"']+)["']/);if(R)for(let D of v.events)D.elementId=R[1]}for(let R of v.events){let D=R.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),N=new RegExp(`\\s*${D}\\s*=\\s*"[^"]*"`,"g"),j=new RegExp(`\\s*${D}\\s*=\\s*'[^']*'`,"g");E=E.replace(N,""),E=E.replace(j,"")}a=a.slice(0,v.startIndex)+E+a.slice(v.endIndex)}let l=ii(i.flatMap((y)=>y.events)),c=a.lastIndexOf("</body>");if(c!==-1)a=a.slice(0,c)+l+`
115
+ `+a.slice(c);else a+=l;return a}function Or(e,n){let t=new Set;for(let i of e.split(",")){let a=i.trim().replace(/^\.\.\./,"").trim();if(!a)continue;if(n){let l=a.lastIndexOf(":");if(l!==-1)a=a.slice(l+1).trim()}if(a=a.split("=")[0].trim(),/^[A-Za-z_$][\w$]*$/.test(a))t.add(a)}return t}function Rt(e,n){let t=r(e),{depths:i,balanced:a}=ge(t),l=(y)=>!a||i[y]===0,c=new RegExp(`(?:^|[^\\w$.])((?:const|let|var|function|class)\\s+${n}\\b)`,"g");for(let y of t.matchAll(c)){let v=(y.index??0)+y[0].length-y[1].length;if(l(v))return!0}for(let y of t.matchAll(/(?:const|let|var)\s*\{([^}]*)\}/g))if(l(y.index??0)&&Or(y[1],!0).has(n))return!0;for(let y of t.matchAll(/(?:const|let|var)\s*\[([^\]]*)\]/g))if(l(y.index??0)&&Or(y[1],!1).has(n))return!0;return!1}var Mr="",Pn,ft=/^[A-Za-z_$][\w$]*$/,ea=new Set(["if","for","while","switch","with"]),Dr=["(","[","{"],jr=[")","]","}"],ta=new Set(["const","let","var","return","if","for","while","do","switch","try","throw","export"]);function na(e){let n=r(e),t=[];for(let i of n.matchAll(/[A-Za-z_$][\w$]*|=>|\.\.\.|[^\s]/g)){let a=i.index??0;t.push({text:i[0],start:a,end:a+i[0].length})}return{code:n,tokens:t}}function ds(e){if(Pn&&e===Mr)return Pn;let{code:n,tokens:t}=na(e),i=new Map,a=[];for(let P=0;P<t.length;P++){let M=t[P].text;if(["(","[","{"].includes(M))a.push(P);else if([")","]","}"].includes(M)){let X=a.at(-1);if(X!==void 0&&["()","[]","{}"].includes(t[X].text+M))a.pop(),i.set(X,P),i.set(P,X)}}function l(P,M){let X=[],F=P;for(let L=P;L<M;L++){if(["(","[","{"].includes(t[L].text)&&(i.get(L)??M)<M){L=i.get(L);continue}if(t[L].text===",")X.push([F,L]),F=L+1}return X.push([F,M]),X}let c=[];function y(P,M,X,F=!1){if(t[P]?.text==="...")P++;if(P>=M)return;let L=t[P].text;if(ft.test(L)){if(X.add(L),X===R)c.push({name:L,token:P,functionScoped:F});return}if(L!=="{"&&L!=="[")return;let Q=i.get(P);if(Q===void 0||Q>=M)return;for(let[ee,re]of l(P+1,Q)){let te=ee;if(L==="{")for(let le=ee;le<re;le++){if(t[le].text===":"){te=le+1;break}if(t[le].text==="=")break;if(["(","[","{"].includes(t[le].text)&&i.has(le))le=i.get(le)}y(te,re,X,F)}}function v(P,M){let X=new Set;for(let[F,L]of l(P,M))y(F,L,X);return X}function E(P){let M=P;for(;M<t.length;M++){let X=t[M].text;if(["(","[","{"].includes(X)&&i.has(M)){M=i.get(M);continue}if([",",";",")","]","}"].includes(X))break}return t[Math.max(P,M-1)]?.end??n.length}let R=new Set,D=[];for(let P=0;P<t.length;P++)if(t[P].text==="=>"){let M=P-1,X=M,F;if(t[M]?.text===")"&&i.has(M))X=i.get(M),F=v(X+1,M);else if(t[M]&&ft.test(t[M].text))F=new Set([t[M].text]);else continue;let L=P+1,Q=t[L]?.text==="{"&&i.has(L)?t[i.get(L)].end:E(L);D.push({start:t[X].start,end:Q,bodyStart:t[L]?.start??Q,functionBody:!0,names:F})}else if(t[P].text==="("&&i.has(P)){let M=t[P-1]?.text;if(!M||ea.has(M)||!ft.test(M)&&M!=="*"&&M!=="]")continue;let X=i.get(P),F=X+1;if(t[F]?.text===":"){F++;while(F<t.length&&!["{","=>",";","="].includes(t[F].text))F++}if(t[F]?.text!=="{"||!i.has(F))continue;D.push({start:t[P].start,end:t[i.get(F)].end,bodyStart:t[F].start,functionBody:M!=="catch",names:v(P+1,X)})}function N(P){let M=P;for(;M<t.length;M++){let X=t[M].text;if(Dr.includes(X)&&i.has(M)){M=i.get(M);continue}if(X===";"||jr.includes(X))break;let F=t[M-1];if(M>P&&ta.has(X)&&F.text!==".")break;if(M>P&&/[\n\r]/.test(n.slice(F.end,t[M].start))&&(/^[\w$]+$/.test(F.text)||jr.includes(F.text)||['"',"'","`"].includes(F.text))&&ft.test(X)&&!["in","of","instanceof"].includes(X))break}return M}let j=[];for(let P=0;P<t.length;P++){if(t[P].text!=="for")continue;let M=t[P+1]?.text==="await"?P+2:P+1;if(t[M]?.text!=="("||!i.has(M))continue;let X=i.get(M),F=X+1,L=t[F]?.text==="{"&&i.has(F)?i.get(F):N(F),Q=t[L]?.text===";"||t[L]?.text==="}"?t[L].end:t[Math.max(F,L-1)]?.end??n.length;j.push({headStart:M,headEnd:X,start:t[M].start,end:Q})}for(let P=0;P<t.length;P++){let M=t[P].text,X=t[P-1]?.text;if(X==="."||t[P+1]?.text===":")continue;if(X==="as"||X==="<")continue;if(M==="const"||M==="let"||M==="var"){let F=N(P+1),L=P+1,Q=!1,ee=!1,re=0;for(let te=P+1;te<=F;te++){let le=t[te]?.text;if(te<F&&Dr.includes(le)&&i.has(te)&&i.get(te)<F){te=i.get(te);continue}if(te<F&&le===":"&&!ee)Q=!0;else if(te<F&&le==="="&&re===0)Q=!1,ee=!0;else if(te<F&&Q&&le==="<")re++;else if(te<F&&Q&&le===">"&&re>0)re--;else if(te===F||le===","&&re===0)y(L,te,R,M==="var"),L=te+1,Q=!1,ee=!1}}else if(M==="function"||M==="class"){let F=P+1;if(t[F]?.text==="*")F++;if(t[F]&&ft.test(t[F].text)&&t[F].text!=="extends")R.add(t[F].text),c.push({name:t[F].text,token:F})}else if(M==="import"){let F=P+1;if(t[F]?.text==="*"&&t[F+1]?.text==="as")F+=2;let L=t[F]?.text;if(L&&ft.test(L)&&L!=="type"&&t[F+1]?.text!=="("&&t[F+1]?.text!==".")R.add(L),c.push({name:L,token:F,file:!0});let Q=t[F]?.text==="{"?F:t[F+1]?.text===","&&t[F+2]?.text==="{"?F+2:-1;if(Q!==-1&&i.has(Q)){let ee=i.get(Q);for(let[re,te]of l(Q+1,ee)){let le=te-1;while(le>=re&&!ft.test(t[le].text))le--;if(le>=re&&t[le].text!=="type")c.push({name:t[le].text,token:le,file:!0})}}}}return Mr=e,Pn={code:n,scopes:D,loops:j,declarations:R,sites:c,tokens:t,pairs:i},Pn}function ps(e){let n=ds(e);return{code:n.code,shadows:(t,i)=>n.scopes.some((a)=>i>=a.start&&i<a.end&&a.names.has(t))}}function On(e){return new Set(ds(e).declarations)}function Ie(e,n){let{scopes:t,loops:i,sites:a,tokens:l,pairs:c}=ds(e),y=Array.from({length:l.length},()=>-1),v=[];for(let j=0;j<l.length;j++){y[j]=v.length?v[v.length-1]:-1;let P=l[j].text;if(P==="{"&&c.has(j))v.push(j);else if(P==="}"&&v.length&&c.get(j)===v[v.length-1])v.pop()}let E=new Set,R=new Map;for(let j of a){if(!n.has(j.name))continue;E.add(j.token);let P=j.file?-1:y[j.token],M=P===-1?[0,Number.POSITIVE_INFINITY]:[l[P].start,l[c.get(P)].end];if(j.functionScoped){let F=l[j.token].start,L=t.filter((Q)=>Q.functionBody&&F>=Q.bodyStart&&F<Q.end).sort((Q,ee)=>Q.end-Q.bodyStart-(ee.end-ee.bodyStart))[0];M=L?[L.bodyStart,L.end]:[0,Number.POSITIVE_INFINITY]}else if(!j.file){let F=i.filter((L)=>j.token>L.headStart&&j.token<L.headEnd).sort((L,Q)=>L.headEnd-L.headStart-(Q.headEnd-Q.headStart))[0];if(F)M=[F.start,F.end]}let X=R.get(j.name);if(X)X.push(M);else R.set(j.name,[M])}let D=new Set;for(let j=0;j<l.length;j++){if(l[j].text!=="import"||l[j-1]?.text===".")continue;let P=j+1;if(l[P]?.text==="type")P++;if(l[P]&&ft.test(l[P].text)&&l[P+1]?.text===",")P+=2;if(l[P]?.text==="{"&&c.has(P))for(let M=P+1;M<c.get(P);M++)D.add(M)}let N=new Set;for(let j=0;j<l.length;j++){let P=l[j].text;if(!n.has(P)||N.has(P)||E.has(j)||D.has(j))continue;let M=l[j-1]?.text;if(M==="#"||M==="."&&l[j-2]?.text!=="..")continue;if(l[j+1]?.text===":"&&(M==="{"||M===","))continue;let X=l[j].start;if(R.get(P)?.some(([F,L])=>X>=F&&X<L))continue;if(t.some((F)=>X>=F.start&&X<F.end&&F.names.has(P)))continue;N.add(P)}return N}var Pe="0.2.795";var Lr=Symbol.for(`stx.lazy-module-promises.${Pe}`);function ra(){let e=globalThis;return e[Lr]??=new Map,e[Lr]}function o(e,n){let t=ra(),i=`${import.meta.url}\x00${e}`,a=t.get(i);if(a)return a;let l=n();return t.set(i,l),l.catch(()=>{if(t.get(i)===l)t.delete(i)}),l}var ia=/<\/(script)/gi;function dn(e){if(!e||e.indexOf("</")===-1)return e;return e.replace(ia,"<\\/$1")}import Wr from"fs";class U{cache=new Map;maxSize;options;sizes;bytes=0;constructor(e=100,n){this.maxSize=e,this.options=n??null,this.sizes=n?new Map:null}get byteSize(){return this.bytes}setMaxBytes(e){if(!this.options)return;this.options={...this.options,maxBytes:e};while(this.bytes>e&&this.cache.size>0){let n=this.cache.keys().next().value;if(n===void 0)break;this.delete(n)}}get(e){if(!this.cache.has(e))return;let n=this.cache.get(e);return this.cache.delete(e),this.cache.set(e,n),n}set(e,n){if(this.cache.has(e))this.delete(e);let t=this.options?this.options.sizeOf(n):0;if(this.options&&t>this.options.maxBytes)return;while(this.cache.size>0&&(this.cache.size>=this.maxSize||this.options!==null&&this.bytes+t>this.options.maxBytes)){let i=this.cache.keys().next().value;if(i===void 0)break;this.delete(i)}if(this.cache.set(e,n),this.sizes)this.sizes.set(e,t),this.bytes+=t}has(e){return this.cache.has(e)}delete(e){if(this.sizes){let n=this.sizes.get(e);if(n!==void 0)this.bytes-=n,this.sizes.delete(e)}return this.cache.delete(e)}clear(){this.cache.clear(),this.sizes?.clear(),this.bytes=0}get size(){return this.cache.size}keys(){return this.cache.keys()}values(){return this.cache.values()}}var Et=new Map,oa=500;function At(e,n){if(n?.includes("g"))return new RegExp(e,n);let t=`${e}:${n||""}`;if(!Et.has(t)){if(Et.size>=oa){let i=Et.keys().next().value;if(i)Et.delete(i)}Et.set(t,new RegExp(e,n))}return Et.get(t)}class Br{pool=[];maxPoolSize=10;fnCache=new Map;fnCacheMaxSize=200;getEvaluator(e){let n=Array.from(new Set(e)),t=n.sort().join(","),i=this.pool.find((y)=>y.context.join(",")===t);if(i)return i.func;let a=this.fnCache,l=this.fnCacheMaxSize,c=(...y)=>(v)=>{try{let E=`${t}:${v}`,R=a.get(E);if(!R){if(a.size>=l){let D=a.keys().next().value;if(D)a.delete(D)}R=Function(...n,`
116
116
  'use strict';
117
117
  try {
118
118
  return ${v};
@@ -123,18 +123,18 @@ catch (e) {
123
123
  }
124
124
  throw e;
125
125
  }
126
- `),a.set(E,R)}return R(...y)}catch{return}};if(this.pool.length<this.maxPoolSize)this.pool.push({func:c,context:n.slice()});return c}clear(){this.pool.length=0,this.fnCache.clear()}}var xu=new Lr;class Br{metrics=new Map;budgets=new Map;violations=[];maxViolations=100;violationHandlers=[];enabled=!0;setEnabled(e){this.enabled=e}isEnabled(){return this.enabled}setBudget(e,n){this.budgets.set(e,{warnThreshold:0.8,action:"warn",...n})}setBudgets(e){for(let[n,t]of Object.entries(e))this.setBudget(n,t)}removeBudget(e){this.budgets.delete(e)}getBudgets(){let e={};for(let[n,t]of this.budgets.entries())e[n]=t;return e}onViolation(e){this.violationHandlers.push(e)}offViolation(e){let n=this.violationHandlers.indexOf(e);if(n!==-1)this.violationHandlers.splice(n,1)}time(e,n){if(!this.enabled)return n();let t=performance.now(),i=n(),a=performance.now()-t;return this.recordTime(e,a),this.checkBudget(e,a),i}async timeAsync(e,n){if(!this.enabled)return n();let t=performance.now(),i=await n(),a=performance.now()-t;return this.recordTime(e,a),this.checkBudget(e,a),i}checkBudget(e,n){let t=this.budgets.get(e);if(!t)return;let i=n/t.maxTime*100,a=t.warnThreshold!==void 0?n>=t.maxTime*t.warnThreshold&&n<t.maxTime:!1,l=n>=t.maxTime;if(!a&&!l)return;let c={label:e,actualTime:n,budgetTime:t.maxTime,exceedancePercent:i,timestamp:new Date,isWarning:a};this.violations.push(c);while(this.violations.length>this.maxViolations)this.violations.shift();for(let v of this.violationHandlers)try{v(c)}catch{}let y=a?`[Performance Warning] "${e}" took ${n.toFixed(2)}ms (${i.toFixed(1)}% of ${t.maxTime}ms budget)`:`[Performance Budget Exceeded] "${e}" took ${n.toFixed(2)}ms (exceeded ${t.maxTime}ms budget by ${(i-100).toFixed(1)}%)`;switch(t.action){case"log":console.log(y);break;case"warn":console.warn(y);break;case"error":console.error(y);break;case"throw":if(l)throw Error(y);else console.warn(y);break}}recordTime(e,n){let t=this.metrics.get(e);if(t)t.count++,t.totalTime+=n,t.maxTime=Math.max(t.maxTime,n),t.minTime=Math.min(t.minTime,n);else this.metrics.set(e,{count:1,totalTime:n,maxTime:n,minTime:n})}getStats(e){if(e){let t=this.metrics.get(e);if(!t)return{};let i=this.budgets.get(e);return{count:t.count,avgTime:t.totalTime/t.count,totalTime:t.totalTime,maxTime:t.maxTime,minTime:t.minTime,budget:i?.maxTime,budgetUtilization:i?t.totalTime/t.count/i.maxTime*100:void 0}}let n={};for(let[t,i]of this.metrics.entries()){let a=this.budgets.get(t);n[t]={count:i.count,avgTime:i.totalTime/i.count,totalTime:i.totalTime,maxTime:i.maxTime,minTime:i.minTime,budget:a?.maxTime,budgetUtilization:a?i.totalTime/i.count/a.maxTime*100:void 0}}return n}getViolations(e){if(e)return this.violations.filter((n)=>n.label===e);return[...this.violations]}getViolationStats(){let e={},n=0,t=0;for(let i of this.violations)if(e[i.label]=(e[i.label]||0)+1,i.isWarning)n++;else t++;return{total:this.violations.length,byLabel:e,warnings:n,errors:t}}clear(){this.metrics.clear()}clearViolations(){this.violations.length=0}clearBudgets(){this.budgets.clear()}reset(){this.clear(),this.clearViolations(),this.clearBudgets(),this.violationHandlers.length=0}}var gs=null;function sa(){if(!gs)gs=new Br;return gs}var oe=new Proxy({},{get(e,n){return sa()[n]}});var Wr=[];function b(e){let n=new U(e);return Wr.push(n),n}function Tc(){for(let e of Wr)e.clear()}function x(e,...n){return`${n.map((t)=>String(t??"")).join("\x00")}\x00${e.length}\x00${Bun.hash(e)}`}function br(e){let n=[];for(let t of new Set(e))try{n.push({path:t,mtimeMs:zr.statSync(t).mtimeMs})}catch{}return n}function Ms(e){for(let n of e)try{if(zr.statSync(n.path).mtimeMs!==n.mtimeMs)return!1}catch{return!1}return!0}var xe=["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 ra=/^[ \t]*import\s+['"]([^'"]+?\.css)(\?[^'"]*)?['"]\s*;?\s*$/gm;function ia(e){if(e.startsWith(".")||e.startsWith("/"))return null;if(e.startsWith("@")){let t=e.match(/^(@[^/]+\/[^/]+)(\/.*)?$/);if(!t)return null;return{pkg:t[1],subpath:t[2]||""}}let n=e.match(/^([^/]+)(\/.*)?$/);if(!n)return null;return{pkg:n[1],subpath:n[2]||""}}function oa(e,n){let t=n;while(!0){let i=ht.join(t,"node_modules",e,"package.json");if(Jt.existsSync(i))return ht.dirname(i);let a=ht.dirname(t);if(a===t)return null;t=a}}function aa(e,n){if(!e||typeof e!=="object")return null;let t=(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 t(a.import);if(typeof a.default==="object")return t(a.default)}return null};if(Object.prototype.hasOwnProperty.call(e,n))return t(e[n]);let i=null;for(let a of Object.keys(e)){let l=a.indexOf("*");if(l===-1)continue;let c=a.slice(0,l),y=a.slice(l+1);if(!n.startsWith(c)||!n.endsWith(y))continue;if(n.length<c.length+y.length)continue;if(!i||c.length>i.prefix.length)i={pattern:a,prefix:c,suffix:y}}if(i){let a=n.slice(i.prefix.length,n.length-i.suffix.length),l=t(e[i.pattern]);if(l)return l.replace("*",a)}return null}function ca(e,n){let t=ia(e);if(!t||!t.subpath)return null;let i=oa(t.pkg,n);if(!i)return null;let a;try{a=JSON.parse(Jt.readFileSync(ht.join(i,"package.json"),"utf8"))}catch{return null}let l=`.${t.subpath}`,c=aa(a.exports,l);if(!c)return null;let y=ht.resolve(i,c);return Jt.existsSync(y)?y:null}function fi(e,n){let t=n.filePath?ht.dirname(n.filePath):n.projectRoot||process.cwd(),i=n.projectRoot||process.cwd(),a=new Set,l=[],c=[];return{code:e.replace(ra,(v,E)=>{let R;try{if(E.startsWith("./")||E.startsWith("../")||E.startsWith("/")){if(R=E.startsWith("/")?E:ht.resolve(t,E),!Jt.existsSync(R))throw Error(`file not found: ${R}`)}else{let M=null;try{M=Bun.resolveSync(E,i)}catch{M=ca(E,i)}if(!M)throw Error(`could not resolve ${E} (Bun.resolveSync + exports fallback both failed)`);R=M}}catch(M){return console.warn(`[stx:vendor-css] could not resolve ${JSON.stringify(E)} (from ${n.filePath||"<unknown>"}): ${M?.message||M}`),c.push(E),""}if(a.has(R))return"";a.add(R);try{let M=Jt.readFileSync(R,"utf8");l.push({source:E,resolvedPath:R,contents:M})}catch(M){console.warn(`[stx:vendor-css] could not read ${R}: ${M?.message||M}`),c.push(E)}return""}),styles:l,unresolved:c}}function la(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function gi(e){if(e.length===0)return"";return`${e.map((n)=>`<style data-stx-vendor="${la(n.source)}" data-stx-layer="vendor">
126
+ `),a.set(E,R)}return R(...y)}catch{return}};if(this.pool.length<this.maxPoolSize)this.pool.push({func:c,context:n.slice()});return c}clear(){this.pool.length=0,this.fnCache.clear()}}var _u=new Br;class zr{metrics=new Map;budgets=new Map;violations=[];maxViolations=100;violationHandlers=[];enabled=!0;setEnabled(e){this.enabled=e}isEnabled(){return this.enabled}setBudget(e,n){this.budgets.set(e,{warnThreshold:0.8,action:"warn",...n})}setBudgets(e){for(let[n,t]of Object.entries(e))this.setBudget(n,t)}removeBudget(e){this.budgets.delete(e)}getBudgets(){let e={};for(let[n,t]of this.budgets.entries())e[n]=t;return e}onViolation(e){this.violationHandlers.push(e)}offViolation(e){let n=this.violationHandlers.indexOf(e);if(n!==-1)this.violationHandlers.splice(n,1)}time(e,n){if(!this.enabled)return n();let t=performance.now(),i=n(),a=performance.now()-t;return this.recordTime(e,a),this.checkBudget(e,a),i}async timeAsync(e,n){if(!this.enabled)return n();let t=performance.now(),i=await n(),a=performance.now()-t;return this.recordTime(e,a),this.checkBudget(e,a),i}checkBudget(e,n){let t=this.budgets.get(e);if(!t)return;let i=n/t.maxTime*100,a=t.warnThreshold!==void 0?n>=t.maxTime*t.warnThreshold&&n<t.maxTime:!1,l=n>=t.maxTime;if(!a&&!l)return;let c={label:e,actualTime:n,budgetTime:t.maxTime,exceedancePercent:i,timestamp:new Date,isWarning:a};this.violations.push(c);while(this.violations.length>this.maxViolations)this.violations.shift();for(let v of this.violationHandlers)try{v(c)}catch{}let y=a?`[Performance Warning] "${e}" took ${n.toFixed(2)}ms (${i.toFixed(1)}% of ${t.maxTime}ms budget)`:`[Performance Budget Exceeded] "${e}" took ${n.toFixed(2)}ms (exceeded ${t.maxTime}ms budget by ${(i-100).toFixed(1)}%)`;switch(t.action){case"log":console.log(y);break;case"warn":console.warn(y);break;case"error":console.error(y);break;case"throw":if(l)throw Error(y);else console.warn(y);break}}recordTime(e,n){let t=this.metrics.get(e);if(t)t.count++,t.totalTime+=n,t.maxTime=Math.max(t.maxTime,n),t.minTime=Math.min(t.minTime,n);else this.metrics.set(e,{count:1,totalTime:n,maxTime:n,minTime:n})}getStats(e){if(e){let t=this.metrics.get(e);if(!t)return{};let i=this.budgets.get(e);return{count:t.count,avgTime:t.totalTime/t.count,totalTime:t.totalTime,maxTime:t.maxTime,minTime:t.minTime,budget:i?.maxTime,budgetUtilization:i?t.totalTime/t.count/i.maxTime*100:void 0}}let n={};for(let[t,i]of this.metrics.entries()){let a=this.budgets.get(t);n[t]={count:i.count,avgTime:i.totalTime/i.count,totalTime:i.totalTime,maxTime:i.maxTime,minTime:i.minTime,budget:a?.maxTime,budgetUtilization:a?i.totalTime/i.count/a.maxTime*100:void 0}}return n}getViolations(e){if(e)return this.violations.filter((n)=>n.label===e);return[...this.violations]}getViolationStats(){let e={},n=0,t=0;for(let i of this.violations)if(e[i.label]=(e[i.label]||0)+1,i.isWarning)n++;else t++;return{total:this.violations.length,byLabel:e,warnings:n,errors:t}}clear(){this.metrics.clear()}clearViolations(){this.violations.length=0}clearBudgets(){this.budgets.clear()}reset(){this.clear(),this.clearViolations(),this.clearBudgets(),this.violationHandlers.length=0}}var gs=null;function aa(){if(!gs)gs=new zr;return gs}var oe=new Proxy({},{get(e,n){return aa()[n]}});var Fr=[];function b(e){let n=new U(e);return Fr.push(n),n}function Rc(){for(let e of Fr)e.clear()}function x(e,...n){return`${n.map((t)=>String(t??"")).join("\x00")}\x00${e.length}\x00${Bun.hash(e)}`}function br(e){let n=[];for(let t of new Set(e))try{n.push({path:t,mtimeMs:Wr.statSync(t).mtimeMs})}catch{}return n}function Ds(e){for(let n of e)try{if(Wr.statSync(n.path).mtimeMs!==n.mtimeMs)return!1}catch{return!1}return!0}var xe=["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 ca=/^[ \t]*import\s+['"]([^'"]+?\.css)(\?[^'"]*)?['"]\s*;?\s*$/gm;function la(e){if(e.startsWith(".")||e.startsWith("/"))return null;if(e.startsWith("@")){let t=e.match(/^(@[^/]+\/[^/]+)(\/.*)?$/);if(!t)return null;return{pkg:t[1],subpath:t[2]||""}}let n=e.match(/^([^/]+)(\/.*)?$/);if(!n)return null;return{pkg:n[1],subpath:n[2]||""}}function ua(e,n){let t=n;while(!0){let i=xt.join(t,"node_modules",e,"package.json");if(Jt.existsSync(i))return xt.dirname(i);let a=xt.dirname(t);if(a===t)return null;t=a}}function fa(e,n){if(!e||typeof e!=="object")return null;let t=(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 t(a.import);if(typeof a.default==="object")return t(a.default)}return null};if(Object.prototype.hasOwnProperty.call(e,n))return t(e[n]);let i=null;for(let a of Object.keys(e)){let l=a.indexOf("*");if(l===-1)continue;let c=a.slice(0,l),y=a.slice(l+1);if(!n.startsWith(c)||!n.endsWith(y))continue;if(n.length<c.length+y.length)continue;if(!i||c.length>i.prefix.length)i={pattern:a,prefix:c,suffix:y}}if(i){let a=n.slice(i.prefix.length,n.length-i.suffix.length),l=t(e[i.pattern]);if(l)return l.replace("*",a)}return null}function da(e,n){let t=la(e);if(!t||!t.subpath)return null;let i=ua(t.pkg,n);if(!i)return null;let a;try{a=JSON.parse(Jt.readFileSync(xt.join(i,"package.json"),"utf8"))}catch{return null}let l=`.${t.subpath}`,c=fa(a.exports,l);if(!c)return null;let y=xt.resolve(i,c);return Jt.existsSync(y)?y:null}function gi(e,n){let t=n.filePath?xt.dirname(n.filePath):n.projectRoot||process.cwd(),i=n.projectRoot||process.cwd(),a=new Set,l=[],c=[];return{code:e.replace(ca,(v,E)=>{let R;try{if(E.startsWith("./")||E.startsWith("../")||E.startsWith("/")){if(R=E.startsWith("/")?E:xt.resolve(t,E),!Jt.existsSync(R))throw Error(`file not found: ${R}`)}else{let D=null;try{D=Bun.resolveSync(E,i)}catch{D=da(E,i)}if(!D)throw Error(`could not resolve ${E} (Bun.resolveSync + exports fallback both failed)`);R=D}}catch(D){return console.warn(`[stx:vendor-css] could not resolve ${JSON.stringify(E)} (from ${n.filePath||"<unknown>"}): ${D?.message||D}`),c.push(E),""}if(a.has(R))return"";a.add(R);try{let D=Jt.readFileSync(R,"utf8");l.push({source:E,resolvedPath:R,contents:D})}catch(D){console.warn(`[stx:vendor-css] could not read ${R}: ${D?.message||D}`),c.push(E)}return""}),styles:l,unresolved:c}}function pa(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function mi(e){if(e.length===0)return"";return`${e.map((n)=>`<style data-stx-vendor="${pa(n.source)}" data-stx-layer="vendor">
127
127
  @layer vendor {
128
128
  ${n.contents}
129
129
  }
130
130
  </style>`).join(`
131
131
  `)}
132
- `}var rg=k,Fr=b(256);function Mt(e){let n=x(e),t=Fr.get(n);if(!t)t=ua(e),Fr.set(n,t);return{code:t.code,imports:[...t.imports],models:[...t.models]}}function ua(e){let n=s(e),t=new Set;for(let y of e.matchAll(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm))for(let v of y[1].split(",")){let E=v.trim().split(/\s+as\s+/).pop()?.replace(/^type\s+/,"").trim();if(E)t.add(E)}let i=On(n),a=xe.filter((y)=>{if(t.has(y)||i.has(y))return!1;return mi(n,y,!0)}),l=Kr(n).filter((y)=>!t.has(y)&&!i.has(y));if(a.length===0&&l.length===0)return{code:e,imports:a,models:l};return{code:`${[a.length>0?`import { ${a.join(", ")} } from '@stacksjs/browser'`:"",l.length>0?"import '@stacksjs/browser'":"",l.length>0?`const { ${l.join(", ")} } = window.StacksBrowser || {}`:""].filter(Boolean).join(`
132
+ `}var rg=k,Vr=b(256);function Mt(e){let n=x(e),t=Vr.get(n);if(!t)t=ga(e),Vr.set(n,t);return{code:t.code,imports:[...t.imports],models:[...t.models]}}function ga(e){let n=r(e),t=new Set;for(let y of e.matchAll(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm))for(let v of y[1].split(",")){let E=v.trim().split(/\s+as\s+/).pop()?.replace(/^type\s+/,"").trim();if(E)t.add(E)}let i=On(n),a=xe.filter((y)=>{if(t.has(y)||i.has(y))return!1;return hi(n,y,!0)}),l=Zr(n).filter((y)=>!t.has(y)&&!i.has(y));if(a.length===0&&l.length===0)return{code:e,imports:a,models:l};return{code:`${[a.length>0?`import { ${a.join(", ")} } from '@stacksjs/browser'`:"",l.length>0?"import '@stacksjs/browser'":"",l.length>0?`const { ${l.join(", ")} } = window.StacksBrowser || {}`:""].filter(Boolean).join(`
133
133
  `)}
134
- ${e}`,imports:a,models:l}}var fa=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 Kr(e){let n=new Set,t=ps(e),i=On(e),a=/(?<![\w$.])([A-Z][a-zA-Z0-9]*)\s*\.\s*(all|find|first|get|where|orderBy|orderByDesc|limit|select|pluck|create|update|delete)\s*\(/g;for(let l of t.code.matchAll(a)){let c=l[1];if(fa.has(c)||i.has(c)||c.length<3)continue;if(t.shadows(c,l.index??0))continue;n.add(c)}return Array.from(n)}function da(e){return On(e)}var Vr=b(128);function Wc(e){let n=x(e),t=Vr.get(n);if(!t)t=pa(e),Vr.set(n,t);return{code:t.code,stxImports:[...t.stxImports],browserImports:[...t.browserImports]}}function pa(e){let n=new Set,t=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,l=/^[ \t]*import\s+(?:type\s+)?{\s*([^}]+)\s*}\s+from\s+['"](@stacksjs\/browser|@stacksjs\/stx|stx)['"][ \t]*;?[ \t]*$/gm,c;while((c=l.exec(e))!==null){let M=c[1],N=c[2];if(c[0].includes("import type"))continue;let j=[];for(let D of M.split(",")){let X=D.trim();if(!X||X.startsWith("type "))continue;let F=X.match(/^([A-Za-z_$][\w$]*)(?:\s+as\s+([A-Za-z_$][\w$]*))?$/);if(!F)continue;let L=F[1],Q=F[2]||L;if(a.add(L),a.add(Q),N==="stx"||N==="@stacksjs/stx")n.add(L);else t.add(L);if(Q!==L)j.push(`${Q} = ${L}`)}let P=j.length>0?`var ${j.join(", ")}; /* [auto-import processed] */`:"// [auto-import processed]";i=i.replace(c[0],P)}let y=da(i);for(let M of rg){if(a.has(M)||y.has(M))continue;if(mi(i,M,!0))n.add(M)}let v=s(i),E=new Set;for(let M of i.matchAll(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm))for(let N of M[1].split(",")){let j=N.trim().replace(/^type\s+/,"").split(/\s+as\s+/);for(let P of j){let D=P.trim();if(D)E.add(D)}}for(let M of xe){if(a.has(M)||y.has(M)||E.has(M))continue;if(mi(v,M))t.add(M)}let R=Kr(v);for(let M of R)if(!a.has(M)&&!y.has(M))t.add(M);return{code:i,stxImports:Array.from(n),browserImports:Array.from(t)}}function mi(e,n,t=!1){let i=ps(e);e=i.code;let a=new RegExp(`\\b${n.replace(/[$]/g,"\\$")}\\b`,"g");for(let l of e.matchAll(a)){let c=l.index??0;if(i.shadows(n,c))continue;let y=c+n.length,v=c-1;while(v>=0&&/\s/.test(e[v]))v--;if(e[v]==="."&&e.slice(Math.max(0,v-2),v+1)!=="...")continue;let E=y;while(E<e.length&&/\s/.test(e[E]))E++;if(e[E]===":"&&e[E+1]!==":"&&(e[v]==="{"||e[v]===","))continue;if(t&&!/^\s*(?:<[^>]*>)?\s*\(/.test(e.slice(y)))continue;if(ga(e,y))continue;return!0}return!1}function ga(e,n){let t=n;while(t<e.length&&(e[t]===" "||e[t]==="\t"))t++;if(e[t]!=="(")return!1;let i=0;for(;t<e.length;t++){let a=e[t];if(a==="(")i++;else if(a===")"){if(i--,i===0)break}}if(i!==0)return!1;t++;while(t<e.length&&(e[t]===" "||e[t]==="\t"))t++;return e[t]==="{"}function qc(e,n){let t=[];if(e.length>0)t.push(` var { ${e.join(", ")} } = window.stx || window;`);if(n.length>0)t.push(` var { ${n.join(", ")} } = window.StacksBrowser || {};`);if(t.length>0)return` // STX: auto-imported from stx and @stacksjs/browser
134
+ ${e}`,imports:a,models:l}}var ma=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 Zr(e){let n=new Set,t=ps(e),i=On(e),a=/(?<![\w$.])([A-Z][a-zA-Z0-9]*)\s*\.\s*(all|find|first|get|where|orderBy|orderByDesc|limit|select|pluck|create|update|delete)\s*\(/g;for(let l of t.code.matchAll(a)){let c=l[1];if(ma.has(c)||i.has(c)||c.length<3)continue;if(t.shadows(c,l.index??0))continue;n.add(c)}return Array.from(n)}function ha(e){return On(e)}var Ur=b(128);function qc(e){let n=x(e),t=Ur.get(n);if(!t)t=xa(e),Ur.set(n,t);return{code:t.code,stxImports:[...t.stxImports],browserImports:[...t.browserImports]}}function xa(e){let n=new Set,t=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,l=/^[ \t]*import\s+(?:type\s+)?{\s*([^}]+)\s*}\s+from\s+['"](@stacksjs\/browser|@stacksjs\/stx|stx)['"][ \t]*;?[ \t]*$/gm,c;while((c=l.exec(e))!==null){let D=c[1],N=c[2];if(c[0].includes("import type"))continue;let j=[];for(let M of D.split(",")){let X=M.trim();if(!X||X.startsWith("type "))continue;let F=X.match(/^([A-Za-z_$][\w$]*)(?:\s+as\s+([A-Za-z_$][\w$]*))?$/);if(!F)continue;let L=F[1],Q=F[2]||L;if(a.add(L),a.add(Q),N==="stx"||N==="@stacksjs/stx")n.add(L);else t.add(L);if(Q!==L)j.push(`${Q} = ${L}`)}let P=j.length>0?`var ${j.join(", ")}; /* [auto-import processed] */`:"// [auto-import processed]";i=i.replace(c[0],P)}let y=ha(i);for(let D of rg){if(a.has(D)||y.has(D))continue;if(hi(i,D,!0))n.add(D)}let v=r(i),E=new Set;for(let D of i.matchAll(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm))for(let N of D[1].split(",")){let j=N.trim().replace(/^type\s+/,"").split(/\s+as\s+/);for(let P of j){let M=P.trim();if(M)E.add(M)}}for(let D of xe){if(a.has(D)||y.has(D)||E.has(D))continue;if(hi(v,D))t.add(D)}let R=Zr(v);for(let D of R)if(!a.has(D)&&!y.has(D))t.add(D);return{code:i,stxImports:Array.from(n),browserImports:Array.from(t)}}function hi(e,n,t=!1){let i=ps(e);e=i.code;let a=new RegExp(`\\b${n.replace(/[$]/g,"\\$")}\\b`,"g");for(let l of e.matchAll(a)){let c=l.index??0;if(i.shadows(n,c))continue;let y=c+n.length,v=c-1;while(v>=0&&/\s/.test(e[v]))v--;if(e[v]==="."&&e.slice(Math.max(0,v-2),v+1)!=="...")continue;let E=y;while(E<e.length&&/\s/.test(e[E]))E++;if(e[E]===":"&&e[E+1]!==":"&&(e[v]==="{"||e[v]===","))continue;if(t&&!/^\s*(?:<[^>]*>)?\s*\(/.test(e.slice(y)))continue;if(ba(e,y))continue;return!0}return!1}function ba(e,n){let t=n;while(t<e.length&&(e[t]===" "||e[t]==="\t"))t++;if(e[t]!=="(")return!1;let i=0;for(;t<e.length;t++){let a=e[t];if(a==="(")i++;else if(a===")"){if(i--,i===0)break}}if(i!==0)return!1;t++;while(t<e.length&&(e[t]===" "||e[t]==="\t"))t++;return e[t]==="{"}function Kc(e,n){let t=[];if(e.length>0)t.push(` var { ${e.join(", ")} } = window.stx || window;`);if(n.length>0)t.push(` var { ${n.join(", ")} } = window.StacksBrowser || {};`);if(t.length>0)return` // STX: auto-imported from stx and @stacksjs/browser
135
135
  ${t.join(`
136
136
  `)}
137
- ${ma(e,n)}`;return""}function Wh(e,n=[]){let{browserImports:t}=Wc(e),i=new Set(n);return qc([],t.filter((a)=>!i.has(a)))}function ma(e,n){let t=[...e.map((i)=>`['${i}', typeof ${i}, 'stx']`),...n.map((i)=>`['${i}', typeof ${i}, '@stacksjs/browser']`)];if(t.length===0)return"";return` // STX: report auto-imports the client runtime did not provide
137
+ ${ya(e,n)}`;return""}function qh(e,n=[]){let{browserImports:t}=qc(e),i=new Set(n);return Kc([],t.filter((a)=>!i.has(a)))}function ya(e,n){let t=[...e.map((i)=>`['${i}', typeof ${i}, 'stx']`),...n.map((i)=>`['${i}', typeof ${i}, '@stacksjs/browser']`)];if(t.length===0)return"";return` // STX: report auto-imports the client runtime did not provide
138
138
  [${t.join(", ")}].forEach(function (e) {
139
139
  if (e[1] !== 'undefined') return;
140
140
  console.error(
@@ -143,12 +143,12 @@ ${ma(e,n)}`;return""}function Wh(e,n=[]){let{browserImports:t}=Wc(e),i=new Set(n
143
143
  + 'or it should be imported from a relative path so the bundler includes it.'
144
144
  );
145
145
  });
146
- `}function De(e){let n=e.__stxClientPayload;if(n&&typeof n==="object"){let i={};for(let a in n){let l=n[a];if(typeof l==="function")continue;i[a]=l}return i.__stxDeclaredPayload=!0,i}let t={};for(let i in e){if(i.startsWith("__")||i.startsWith("$"))continue;let a=e[i];if(typeof a==="function")continue;t[i]=a}return t}var ha=/token|secret|passw|apikey|api_key|privatekey|private_key|credential|webhook|bearer|jwt|signature/i,Ur=new Set;function xa(e,n){let t=ha.test(e),i=n.length>32768;if(!t&&!i)return;if(Ur.has(e))return;if(Ur.add(e),t)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 ${(n.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 yn(e,n){if(!n)return"";let t=Ie(e,new Set(Object.keys(n))),i=n.__stxDeclaredPayload===!0,a=[],l=Object.entries(n).sort(([c],[y])=>c<y?-1:c>y?1:0);for(let[c,y]of l){if(!/^[A-Za-z_$][\w$]*$/.test(c))continue;if(c.startsWith("__")||c.startsWith("$"))continue;if(!i&&!t.has(c))continue;if(Rt(e,c)){if(i)console.warn(`[stx] defineClientPayload declares "${c}", but this client block also declares "${c}" at the top level, so the server value is not published (emitting it would be a duplicate binding). Rename the local, or drop "${c}" from defineClientPayload.`);continue}let v;try{v=JSON.stringify(y)}catch{continue}if(v===void 0)continue;xa(c,v),a.push(` var ${c} = ${v.replace(/</g,"\\u003c")};`)}if(a.length===0)return"";return` // stx: server -> client data bridge (seeded from server scope)
146
+ `}function De(e){let n=e.__stxClientPayload;if(n&&typeof n==="object"){let i={};for(let a in n){let l=n[a];if(typeof l==="function")continue;i[a]=l}return i.__stxDeclaredPayload=!0,i}let t={};for(let i in e){if(i.startsWith("__")||i.startsWith("$"))continue;let a=e[i];if(typeof a==="function")continue;t[i]=a}return t}var _a=/token|secret|passw|apikey|api_key|privatekey|private_key|credential|webhook|bearer|jwt|signature/i,Hr=new Set;function wa(e,n){let t=_a.test(e),i=n.length>32768;if(!t&&!i)return;if(Hr.has(e))return;if(Hr.add(e),t)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 ${(n.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 yn(e,n){if(!n)return"";let t=Ie(e,new Set(Object.keys(n))),i=n.__stxDeclaredPayload===!0,a=[],l=Object.entries(n).sort(([c],[y])=>c<y?-1:c>y?1:0);for(let[c,y]of l){if(!/^[A-Za-z_$][\w$]*$/.test(c))continue;if(c.startsWith("__")||c.startsWith("$"))continue;if(!i&&!t.has(c))continue;if(Rt(e,c)){if(i)console.warn(`[stx] defineClientPayload declares "${c}", but this client block also declares "${c}" at the top level, so the server value is not published (emitting it would be a duplicate binding). Rename the local, or drop "${c}" from defineClientPayload.`);continue}let v;try{v=JSON.stringify(y)}catch{continue}if(v===void 0)continue;wa(c,v),a.push(` var ${c} = ${v.replace(/</g,"\\u003c")};`)}if(a.length===0)return"";return` // stx: server -> client data bridge (seeded from server scope)
147
147
  ${a.join(`
148
148
  `)}
149
- `}var ba={left:0,middle:1,right:2};function ya(e){let n=[];if(e.self)n.push("if ($event.target !== $el) return");for(let t of e.systemKeys)n.push(`if (!$event.${t}Key) return`);if(e.keys.length>0){let t=e.keys.map((i)=>`$event.key === '${i}'`).join(" || ");n.push(`if (!(${t})) return`)}if(e.mouse!==null){let t=ba[e.mouse];n.push(`if ($event.button !== ${t}) return`)}if(e.prevent)n.push("$event.preventDefault()");if(e.stop)n.push("$event.stopPropagation()");return n.join("; ")}function _a(e,n){let{elementId:t,event:i,modifiers:a}=e,l=fs(e.handler),c=ya(a),y=[];if(a.once)y.push("once: true");if(a.capture)y.push("capture: true");if(us(i,a))y.push("passive: true");let v=y.length>0?`, { ${y.join(", ")} }`:"",E="";if(c)E+=`${c}; `;let R=l.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),M=`var $emit = function(name, detail) {
149
+ `}var Sa={left:0,middle:1,right:2};function $a(e){let n=[];if(e.self)n.push("if ($event.target !== $el) return");for(let t of e.systemKeys)n.push(`if (!$event.${t}Key) return`);if(e.keys.length>0){let t=e.keys.map((i)=>`$event.key === '${i}'`).join(" || ");n.push(`if (!(${t})) return`)}if(e.mouse!==null){let t=Sa[e.mouse];n.push(`if ($event.button !== ${t}) return`)}if(e.prevent)n.push("$event.preventDefault()");if(e.stop)n.push("$event.stopPropagation()");return n.join("; ")}function va(e,n){let{elementId:t,event:i,modifiers:a}=e,l=fs(e.handler),c=$a(a),y=[];if(a.once)y.push("once: true");if(a.capture)y.push("capture: true");if(us(i,a))y.push("passive: true");let v=y.length>0?`, { ${y.join(", ")} }`:"",E="";if(c)E+=`${c}; `;let R=l.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),D=`var $emit = function(name, detail) {
150
150
  $el.dispatchEvent(new CustomEvent(name, { detail: detail, bubbles: true, cancelable: true }))
151
- };`;function N(j){if(/\$emit\s*\(/.test(j))return`${M}
151
+ };`;function N(j){if(/\$emit\s*\(/.test(j))return`${D}
152
152
  ${j}`;return`var scope = $el.closest('[data-stx-scope]');
153
153
  if (scope && scope.__stx_execute) {
154
154
  scope.__stx_execute('${R}', $event, $el);
@@ -178,7 +178,7 @@ else {
178
178
  }${v})
179
179
  })()`;if(/\$emit\s*\(/.test(l))return` var $el = document.getElementById('${t}')
180
180
  if ($el) $el.addEventListener('${i}', function($event) {
181
- ${E}${M}
181
+ ${E}${D}
182
182
  ${l}
183
183
  }${v})`;return` var $el = document.getElementById('${t}')
184
184
  if ($el) $el.addEventListener('${i}', function($event) {
@@ -189,50 +189,50 @@ else {
189
189
  else {
190
190
  ${l}
191
191
  }
192
- }${v})`}function wa(e){if(e.length===0)return"";return`
192
+ }${v})`}function Ea(e){if(e.length===0)return"";return`
193
193
  // STX: auto-generated event bindings
194
- ${e.map((t,i)=>_a(t,i)).join(`
195
- `)}`}function Hr(e){let n=[],t=new Set,i=e.replace(/^\s*import\s+.*$/gm,""),a=0,l=i.length,c=0;while(c<l){let y=i[c];if(y==="'"||y==='"'||y==="`"){let v=y;if(c++,v==="`"){let E=0;while(c<l){if(i[c]==="\\"){c+=2;continue}if(i[c]==="`"&&E===0){c++;break}if(i[c]==="$"&&i[c+1]==="{"){E++,c+=2;continue}if(i[c]==="}"&&E>0){E--,c++;continue}c++}}else while(c<l){if(i[c]==="\\"){c+=2;continue}if(i[c]===v){c++;break}c++}continue}if(y==="/"&&i[c+1]==="/"){while(c<l&&i[c]!==`
196
- `)c++;continue}if(y==="/"&&i[c+1]==="*"){c+=2;while(c<l-1&&!(i[c]==="*"&&i[c+1]==="/"))c++;c+=2;continue}if(y==="{"){a++,c++;continue}if(y==="}"){a--,c++;continue}if(a===0){let v=i.slice(c),E=v.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(E){let N=E[1];if(!N.startsWith("_")&&!t.has(N))n.push(N),t.add(N);c+=E[0].length;continue}let R=v.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(R){R[1].split(",").forEach((N)=>{let j=N.trim(),P=j.indexOf(":"),D=P>=0?j.slice(P+1).trim().split(/[\s=]/)[0]:j.split(/[\s=]/)[0];if(D&&!D.startsWith("_")&&!t.has(D))n.push(D),t.add(D)}),c+=R[0].length;continue}let M=v.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(M){let N=M[1];if(!N.startsWith("_")&&!t.has(N))n.push(N),t.add(N);c+=M[0].length;continue}}c++}return n}var Sa=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 $a(e){let n=new Set,t=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function i(N){let j;while((j=t.exec(N))!==null){let P=j[0];if(!Sa.has(P))n.add(P)}}let a=/\{\{([\s\S]*?)\}\}/g,l;while((l=a.exec(e))!==null)i(l[1]);let c=/:[a-z][\w.-]*\s*=\s*"([^"]*)"/gi;while((l=c.exec(e))!==null)i(l[1]);let y=/:[a-z][\w.-]*\s*=\s*'([^']*)'/gi;while((l=y.exec(e))!==null)i(l[1]);let v=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((l=v.exec(e))!==null)i(l[1]);let E=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((l=E.exec(e))!==null)i(l[1]);let R=/@model\s*=\s*["']([^"']*)["']/gi;while((l=R.exec(e))!==null)i(l[1]);let M=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((l=M.exec(e))!==null)i(l[1]);return n}async function Le(e,n={}){let t=e,i="",a=!1,l=[],c=fi(t,{filePath:n.filePath,projectRoot:n.projectRoot});t=c.code;let y=gi(c.styles),v=Mt(t);t=v.code,l=[...v.imports,...v.models];let{hasUserImports:E,bundleClientScript:R}=await o("stx/client-script-bundler",()=>import("./chunk-ncxed9r1.js"));if(E(t))t=await R(t,n.filePath||"",{projectRoot:n.projectRoot,minify:n.production}),a=!0;if(n.autoImports!==!1){let Q=Wc(t);t=Q.code,i=qc(Q.stxImports,Q.browserImports.filter((te)=>!l.includes(te)))}if(i=`${yn(t,n.serverData)}${i}`,t=A(t),!a&&je(n.attrs||""))t=Be(t);let M=wa(n.eventBindings||[]),N=(n.attrs||"").trim(),j=/\btype\s*=\s*["']module["']/i.test(N),P=n.instanceId?` data-stx-instance="${n.instanceId}"`:"";if(j){let Q=N.replace(/\btype\s*=\s*["']module["']/i,"").trim(),te=`type="module" data-stx-scoped${P}${Q?` ${Q}`:""}`;return`${y}<script ${te}>
194
+ ${e.map((t,i)=>va(t,i)).join(`
195
+ `)}`}function Kr(e){let n=[],t=new Set,i=e.replace(/^\s*import\s+.*$/gm,""),a=0,l=i.length,c=0;while(c<l){let y=i[c];if(y==="'"||y==='"'||y==="`"){let v=y;if(c++,v==="`"){let E=0;while(c<l){if(i[c]==="\\"){c+=2;continue}if(i[c]==="`"&&E===0){c++;break}if(i[c]==="$"&&i[c+1]==="{"){E++,c+=2;continue}if(i[c]==="}"&&E>0){E--,c++;continue}c++}}else while(c<l){if(i[c]==="\\"){c+=2;continue}if(i[c]===v){c++;break}c++}continue}if(y==="/"&&i[c+1]==="/"){while(c<l&&i[c]!==`
196
+ `)c++;continue}if(y==="/"&&i[c+1]==="*"){c+=2;while(c<l-1&&!(i[c]==="*"&&i[c+1]==="/"))c++;c+=2;continue}if(y==="{"){a++,c++;continue}if(y==="}"){a--,c++;continue}if(a===0){let v=i.slice(c),E=v.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(E){let N=E[1];if(!N.startsWith("_")&&!t.has(N))n.push(N),t.add(N);c+=E[0].length;continue}let R=v.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(R){R[1].split(",").forEach((N)=>{let j=N.trim(),P=j.indexOf(":"),M=P>=0?j.slice(P+1).trim().split(/[\s=]/)[0]:j.split(/[\s=]/)[0];if(M&&!M.startsWith("_")&&!t.has(M))n.push(M),t.add(M)}),c+=R[0].length;continue}let D=v.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(D){let N=D[1];if(!N.startsWith("_")&&!t.has(N))n.push(N),t.add(N);c+=D[0].length;continue}}c++}return n}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 Ra(e){let n=new Set,t=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function i(N){let j;while((j=t.exec(N))!==null){let P=j[0];if(!ka.has(P))n.add(P)}}let a=/\{\{([\s\S]*?)\}\}/g,l;while((l=a.exec(e))!==null)i(l[1]);let c=/:[a-z][\w.-]*\s*=\s*"([^"]*)"/gi;while((l=c.exec(e))!==null)i(l[1]);let y=/:[a-z][\w.-]*\s*=\s*'([^']*)'/gi;while((l=y.exec(e))!==null)i(l[1]);let v=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((l=v.exec(e))!==null)i(l[1]);let E=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((l=E.exec(e))!==null)i(l[1]);let R=/@model\s*=\s*["']([^"']*)["']/gi;while((l=R.exec(e))!==null)i(l[1]);let D=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((l=D.exec(e))!==null)i(l[1]);return n}async function Le(e,n={}){let t=e,i="",a=!1,l=[],c=gi(t,{filePath:n.filePath,projectRoot:n.projectRoot});t=c.code;let y=mi(c.styles),v=Mt(t);t=v.code,l=[...v.imports,...v.models];let{hasUserImports:E,bundleClientScript:R}=await o("stx/client-script-bundler",()=>import("./chunk-054h7ktz.js"));if(E(t))t=await R(t,n.filePath||"",{projectRoot:n.projectRoot,minify:n.production}),a=!0;if(n.autoImports!==!1){let Q=qc(t);t=Q.code,i=Kc(Q.stxImports,Q.browserImports.filter((ee)=>!l.includes(ee)))}if(i=`${yn(t,n.serverData)}${i}`,t=A(t),!a&&je(n.attrs||""))t=Be(t);let D=Ea(n.eventBindings||[]),N=(n.attrs||"").trim(),j=/\btype\s*=\s*["']module["']/i.test(N),P=n.instanceId?` data-stx-instance="${n.instanceId}"`:"";if(j){let Q=N.replace(/\btype\s*=\s*["']module["']/i,"").trim(),ee=`type="module" data-stx-scoped${P}${Q?` ${Q}`:""}`;return`${y}<script ${ee}>
197
197
  ${dn(`${i}${t}
198
- ${M}`)}
199
- </script>`}let D=$i(e),X=/function __stx_setup_/.test(t),F=/\bstx\.mount\s*\(|\bstx\.mountEl\s*\(/.test(e);function L(Q){let te=Q.length>0?`
200
- return ${Ps(t,Q)};`:"",ae=JSON.stringify(`[stx] client block failed${n.filePath?` (${n.filePath})`:""}; this block will not hydrate`);return`${y}<script data-stx-scoped data-stx-run="always"${P}>
198
+ ${D}`)}
199
+ </script>`}let M=Ri(e),X=/function __stx_setup_/.test(t),F=/\bstx\.mount\s*\(|\bstx\.mountEl\s*\(/.test(e);function L(Q){let ee=Q.length>0?`
200
+ return ${Is(t,Q)};`:"",re=JSON.stringify(`[stx] client block failed${n.filePath?` (${n.filePath})`:""}; this block will not hydrate`);return`${y}<script data-stx-scoped data-stx-run="always"${P}>
201
201
  window.stx.mount(function() {
202
202
  'use strict';
203
203
  try {
204
204
  ${dn(`${i}${t}
205
- ${M}${te}`)}
205
+ ${D}${ee}`)}
206
206
  } catch (error) {
207
- console.error(${ae}, error);
207
+ console.error(${re}, error);
208
208
  return {};
209
209
  }
210
- })</script>`}if(!F&&!X){if(D)return L(Hr(e));if(n.templateContent){let Q=Hr(e);if(Q.length>0){let te=$a(n.templateContent);if(Q.some((se)=>te.has(se)))return L(Q)}}}return`${y}<script data-stx-scoped data-stx-run="always"${P}>
210
+ })</script>`}if(!F&&!X){if(M)return L(Kr(e));if(n.templateContent){let Q=Kr(e);if(Q.length>0){let ee=Ra(n.templateContent);if(Q.some((te)=>ee.has(te)))return L(Q)}}}return`${y}<script data-stx-scoped data-stx-run="always"${P}>
211
211
  ;(function() {
212
212
  'use strict';
213
213
  try {
214
214
  ${dn(`${i}${t}
215
- ${M}`)}
215
+ ${D}`)}
216
216
  } catch (error) {
217
217
  console.error(${JSON.stringify(`[stx] client block failed${n.filePath?` (${n.filePath})`:""}; this block will not hydrate`)}, error);
218
218
  }
219
- })()</script>`}import{createHash as Aa}from"crypto";var Mn=/<script\b[^>]*>/iy,bs=/<\/script\s*>/ig,Dn=/<style\b[^>]*>/iy,ys=/<\/style\s*>/ig;function Zr(e,n,t,i){t.lastIndex=n;let a=t.exec(e);if(!a||a.index!==n)return-1;i.lastIndex=t.lastIndex;let l=i.exec(e);if(!l)return-1;return l.index+l[0].length}function W(e,n){return Zr(e,n,Mn,bs)}function pn(e,n){return Zr(e,n,Dn,ys)}function Ne(e,n){if(!e.startsWith("<!--",n))return-1;let t=e.indexOf("-->",n+4);if(t===-1)return-1;return t+3}function qr(e,n){if(e.startsWith("<!--",n)){let a=Ne(e,n);return a===-1?e.length:a}if(Mn.lastIndex=n,Mn.exec(e)?.index===n){bs.lastIndex=Mn.lastIndex;let a=bs.exec(e);return a?a.index+a[0].length:e.length}if(Dn.lastIndex=n,Dn.exec(e)?.index===n){ys.lastIndex=Dn.lastIndex;let a=ys.exec(e);return a?a.index+a[0].length:e.length}return-1}function S(e,n){let t=[],i=0,a=e.length,l=!1,c=null;while(i<a){let y=e[i];if(l){if(c){if(y===c)c=null}else if(y==='"'||y==="'")c=y;else if(y===">")l=!1;i++;continue}if(y!=="<"){let M=e.indexOf("<",i+1);if(M===-1)break;i=M;continue}let v=n(e,i);if(v>i){t.push({start:i,end:v,token:e.slice(i,v)}),i=v;continue}let E=qr(e,i);if(E>i){i=E;continue}let R=e.charCodeAt(i+1);if(R>=65&&R<=90||R>=97&&R<=122)l=!0;i++}return t}function Xr(e){let n=0,t=0,i=0,a=!1,l=null;while(i<e.length){if(a){let M=e[i];if(l){if(M===l)l=null}else if(M==='"'||M==="'")l=M;else if(M===">")a=!1;i++;continue}let c=e.indexOf("<",i),y=c===-1?e.length:c;while(i<y){let M=e[i++];if(M==="{")n++;else if(M==="}")t++;if(n>=2&&t>=2)return!0}if(c===-1)break;let v=qr(e,c);if(v>c){i=v;continue}let E=e.charCodeAt(c+1),R=E===47?e.charCodeAt(c+2):E;if(R>=65&&R<=90||R>=97&&R<=122)a=!0;i=c+1}return!1}function $c(e,n){while(e.size>=n){let t=e.keys().next();if(t.done)return;e.delete(t.value)}}var va=1024,Ea=16777216,Et=new Map,ms=0;function ka(e,n){Et.set(e,n),ms+=e.length+n.output.length;for(let[t,i]of Et){if(ms<=Ea)break;Et.delete(t),ms-=t.length+i.output.length}}function pe(e,n,t,i){let a=i!==void 0&&e.length>=va,l=a?`${i}\x00${e}`:"";if(a){let R=Et.get(l);if(R)return Et.delete(l),Et.set(l,R),{output:R.output,tokens:R.tokens.slice()}}let c=S(e,n);if(c.length===0)return{output:e,tokens:[]};let y=c.map((R)=>R.token),v="",E=0;for(let R=0;R<c.length;R++){let M=c[R];v+=e.slice(E,M.start),v+=t(M.token,R),E=M.end}if(v+=e.slice(E),a)return ka(l,{output:v,tokens:y}),{output:v,tokens:y.slice()};return{output:v,tokens:y}}var Ra=1024,Ca=16777216,kt=new Map,hs=0;function Ta(e,n){kt.set(e,n),hs+=e.length+n.output.length;for(let[t,i]of kt){if(hs<=Ca)break;kt.delete(t),hs-=t.length+i.output.length}}function xs(e,n,t){return{output:n,scripts:t,restore:(i)=>i===n?e:vr(i,t)}}function G(e){let n=e.length>=Ra;if(n){let a=kt.get(e);if(a)return kt.delete(e),kt.set(e,a),xs(e,a.output,a.scripts.slice())}let{output:t,tokens:i}=pe(e,W,(a,l)=>`\x00STX_SCRIPT_${l}\x00`);if(n)return Ta(e,{output:t,scripts:i}),xs(e,t,i.slice());return xs(e,t,i)}function vr(e,n){if(n.length===0)return e;return e.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(t,i)=>n[+i]??"")}var jn="__stx_component_client_factories";function Nn(e){let n=e[jn];return n instanceof Map?n:null}function zc(e){e[jn]=new Map}function _s(e,n){let t=Nn(e);if(!t)return null;let i=Aa("sha256").update(n).digest("hex").slice(0,16),a=t.get(i);if(a)a.instances++;else t.set(i,{body:n,instances:1});return i}function Hc(e,n){let t=Nn(n);if(!t?.size)return e;let i=new Map;for(let[R,M]of t)if(M.instances===1)i.set(R,M.body);let a=[];if(i.size>0){let R=[...i.keys()].map((j)=>JSON.stringify(j).replace(/[$()*+.?[\\\]^{|}]/g,"\\$&")).join("|"),M=new RegExp(`window\\.__stxComponentFactories\\[(${R})\\]\\(("[^"]+")\\);`,"g"),N=M.exec(e);while(N!==null){let j=i.get(JSON.parse(N[1]));if(j!==void 0)a.push({start:N.index,end:N.index+N[0].length,replacement:`(${j})(${N[2]});`});N=M.exec(e)}}let l=[...t].filter(([,R])=>R.instances>1);if(l.length===0)return Jr(e,a);let y=`<script data-stx-scoped data-stx-run="always" data-stx-component-factories>
219
+ })()</script>`}import{createHash as Ma}from"crypto";var Mn=/<script\b[^>]*>/iy,bs=/<\/script\s*>/ig,Dn=/<style\b[^>]*>/iy,ys=/<\/style\s*>/ig;function qr(e,n,t,i){t.lastIndex=n;let a=t.exec(e);if(!a||a.index!==n)return-1;i.lastIndex=t.lastIndex;let l=i.exec(e);if(!l)return-1;return l.index+l[0].length}function W(e,n){return qr(e,n,Mn,bs)}function pn(e,n){return qr(e,n,Dn,ys)}function Ne(e,n){if(!e.startsWith("<!--",n))return-1;let t=e.indexOf("-->",n+4);if(t===-1)return-1;return t+3}function Xr(e,n){if(e.startsWith("<!--",n)){let a=Ne(e,n);return a===-1?e.length:a}if(Mn.lastIndex=n,Mn.exec(e)?.index===n){bs.lastIndex=Mn.lastIndex;let a=bs.exec(e);return a?a.index+a[0].length:e.length}if(Dn.lastIndex=n,Dn.exec(e)?.index===n){ys.lastIndex=Dn.lastIndex;let a=ys.exec(e);return a?a.index+a[0].length:e.length}return-1}function S(e,n){let t=[],i=0,a=e.length,l=!1,c=null;while(i<a){let y=e[i];if(l){if(c){if(y===c)c=null}else if(y==='"'||y==="'")c=y;else if(y===">")l=!1;i++;continue}if(y!=="<"){let D=e.indexOf("<",i+1);if(D===-1)break;i=D;continue}let v=n(e,i);if(v>i){t.push({start:i,end:v,token:e.slice(i,v)}),i=v;continue}let E=Xr(e,i);if(E>i){i=E;continue}let R=e.charCodeAt(i+1);if(R>=65&&R<=90||R>=97&&R<=122)l=!0;i++}return t}function Jr(e){let n=0,t=0,i=0,a=!1,l=null;while(i<e.length){if(a){let D=e[i];if(l){if(D===l)l=null}else if(D==='"'||D==="'")l=D;else if(D===">")a=!1;i++;continue}let c=e.indexOf("<",i),y=c===-1?e.length:c;while(i<y){let D=e[i++];if(D==="{")n++;else if(D==="}")t++;if(n>=2&&t>=2)return!0}if(c===-1)break;let v=Xr(e,c);if(v>c){i=v;continue}let E=e.charCodeAt(c+1),R=E===47?e.charCodeAt(c+2):E;if(R>=65&&R<=90||R>=97&&R<=122)a=!0;i=c+1}return!1}function Ac(e,n){while(e.size>=n){let t=e.keys().next();if(t.done)return;e.delete(t.value)}}var Ca=1024,Ta=16777216,kt=new Map,ms=0;function Aa(e,n){kt.set(e,n),ms+=e.length+n.output.length;for(let[t,i]of kt){if(ms<=Ta)break;kt.delete(t),ms-=t.length+i.output.length}}function pe(e,n,t,i){let a=i!==void 0&&e.length>=Ca,l=a?`${i}\x00${e}`:"";if(a){let R=kt.get(l);if(R)return kt.delete(l),kt.set(l,R),{output:R.output,tokens:R.tokens.slice()}}let c=S(e,n);if(c.length===0)return{output:e,tokens:[]};let y=c.map((R)=>R.token),v="",E=0;for(let R=0;R<c.length;R++){let D=c[R];v+=e.slice(E,D.start),v+=t(D.token,R),E=D.end}if(v+=e.slice(E),a)return Aa(l,{output:v,tokens:y}),{output:v,tokens:y.slice()};return{output:v,tokens:y}}var Ia=1024,Pa=16777216,Ct=new Map,hs=0;function Oa(e,n){Ct.set(e,n),hs+=e.length+n.output.length;for(let[t,i]of Ct){if(hs<=Pa)break;Ct.delete(t),hs-=t.length+i.output.length}}function xs(e,n,t){return{output:n,scripts:t,restore:(i)=>i===n?e:vr(i,t)}}function G(e){let n=e.length>=Ia;if(n){let a=Ct.get(e);if(a)return Ct.delete(e),Ct.set(e,a),xs(e,a.output,a.scripts.slice())}let{output:t,tokens:i}=pe(e,W,(a,l)=>`\x00STX_SCRIPT_${l}\x00`);if(n)return Oa(e,{output:t,scripts:i}),xs(e,t,i.slice());return xs(e,t,i)}function vr(e,n){if(n.length===0)return e;return e.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(t,i)=>n[+i]??"")}var jn="__stx_component_client_factories";function Nn(e){let n=e[jn];return n instanceof Map?n:null}function Hc(e){e[jn]=new Map}function _s(e,n){let t=Nn(e);if(!t)return null;let i=Ma("sha256").update(n).digest("hex").slice(0,16),a=t.get(i);if(a)a.instances++;else t.set(i,{body:n,instances:1});return i}function Vc(e,n){let t=Nn(n);if(!t?.size)return e;let i=new Map;for(let[R,D]of t)if(D.instances===1)i.set(R,D.body);let a=[];if(i.size>0){let R=[...i.keys()].map((j)=>JSON.stringify(j).replace(/[$()*+.?[\\\]^{|}]/g,"\\$&")).join("|"),D=new RegExp(`window\\.__stxComponentFactories\\[(${R})\\]\\(("[^"]+")\\);`,"g"),N=D.exec(e);while(N!==null){let j=i.get(JSON.parse(N[1]));if(j!==void 0)a.push({start:N.index,end:N.index+N[0].length,replacement:`(${j})(${N[2]});`});N=D.exec(e)}}let l=[...t].filter(([,R])=>R.instances>1);if(l.length===0)return Gr(e,a);let y=`<script data-stx-scoped data-stx-run="always" data-stx-component-factories>
220
220
  (function() {
221
221
  const factories = window.__stxComponentFactories = window.__stxComponentFactories || {};
222
- ${l.map(([R,M])=>` try { factories[${JSON.stringify(R)}] = factories[${JSON.stringify(R)}] || ${M.body}; }
222
+ ${l.map(([R,D])=>` try { factories[${JSON.stringify(R)}] = factories[${JSON.stringify(R)}] || ${D.body}; }
223
223
  catch (e) { console.error('[stx] component factory ' + ${JSON.stringify(R)} + ' failed to register; instances of it will not hydrate.', e); }`).join(`
224
224
  `)}
225
225
  })();
226
- </script>`,v,E=/<(?:template\b|script\b(?=[^>]*\bdata-stx-scoped\b))/iy;return S(e,(R,M)=>{if(v===void 0){if(E.lastIndex=M,E.test(R))v=M}return-1}),a.push({start:v??0,end:v??0,replacement:`${y}
227
- `}),Jr(e,a)}function Jr(e,n){if(n.length===0)return e;n.sort((l,c)=>l.start-c.start||l.end-c.end);let t=Array(n.length*2+1),i=0,a=0;for(let l of n)t[a++]=e.slice(i,l.start),t[a++]=l.replacement,i=l.end;return t[a]=e.slice(i),t.join("")}function Gr(e){let n=Nn(e),t=new Map;if(n)for(let[i,a]of n)t.set(i,a.instances);return t}function Yr(e,n){let t=Nn(e);if(!t)return[];let i=[];for(let[a,l]of t){let c=l.instances-(n.get(a)??0);if(c>0)i.push({body:l.body,count:c})}return i}function Qr(e,n){for(let{body:t,count:i}of n)for(let a=0;a<i;a++)_s(e,t)}function ve(e,n,t=2){let i=0,a=null;for(let l=n+t;l<e.length;l++){let c=e[l];if(a){if(c==="\\"){l++;continue}if(c===a)a=null;continue}if(c==='"'||c==="'"||c==="`"){a=c;continue}if(c==="{"){i++;continue}if(c==="}"){if(i>0){i--;continue}let y=0;while(e[l+y]==="}")y++;if(y>=t)return l}}return-1}import Ei from"fs";var ei=0,ws=new Map;function Jc(){ei=0,ws.clear()}function Ln(e,n){let t=ei++,i=`<!--__STX_${e.toUpperCase()}_${t}__-->`;return ws.set(i,{type:e,expression:n}),i}function Yc(){let e={};for(let[n,t]of ws)e[n]={type:t.type,expression:t.expression};return e}function Zc(e,n){let t=e;for(let[i,a]of n)t=t.split(i).join(a);return t}function yi(e){return e.includes("<!--__STX_")}var Ia=/@(?=[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 Pa(e){return Array.from({length:e},()=>"&#123;").join("&#8288;")}function ti(e){return e.replace(/\{{2,}/g,(n)=>Pa(n.length)).replace(/\{(?=!)/g,"&#123;&#8288;").replace(Ia,"&#64;")}function xr(e,n,t=!1){let{openTag:i,tail:a}=t?Oa(e,n):Ma(e).at(n);return ja(a,i,t)}function Oa(e,n){let t="",i=0;for(let c=0;c<n;c++){if(!e.startsWith("{{",c))continue;let y=ve(e,c);if(y<0||y+2>n)break;t+=e.slice(i,c)+"x",c=y+1,i=y+2}t+=e.slice(i,n);let a=-1,l=null;for(let c=0;c<t.length;c++){let y=t[c];if(l){if(y===l)l=null;continue}if(y==='"'||y==="'"){l=y;continue}if(y===">"){a=-1;continue}if(y==="<")a=c}return{openTag:a,tail:a>=0?t.slice(a+1):t}}var Bn=null;function Ma(e){if(Bn&&Bn.source===e)return Bn.scanner;let n=Da(e);return Bn={source:e,scanner:n},n}function Da(e){let n=0,t=-1,i=null,a=-1,l=(y,v)=>{let E=e[y];if(v.quote){if(E===v.quote)v.quote=null;return}if(v.openTag>=0){if(E==='"'||E==="'"){v.quote=E;return}if(E===">"){v.openTag=-1;return}}if(E==="<")v.openTag=y},c=(y,v)=>{if(v.openTag>=0||!e.startsWith("<!--",y))return-1;let E=e.indexOf("-->",y+4);return E<0?e.length:E+3};return{at(y){if(y<n)n=0,t=-1,i=null,a=-1;let v={openTag:t,quote:i},E=!1;while(n<y){if(a<0&&e.startsWith("{{",n)){let D=ve(e,n);if(D<0)a=n;else if(D+2<=y){n=D+2;continue}else break}let P=c(n,v);if(P>=0){if(P>y){E=!0;break}n=P;continue}l(n,v),n++}if(t=v.openTag,i=v.quote,E)return{openTag:-1,tail:""};let R=a>=0?a:n,M={openTag:t,quote:i};for(let P=n;P<y;P++){let D=c(P,M);if(D>=0){if(D>y)return{openTag:-1,tail:""};P=D-1;continue}l(P,M)}if(M.openTag<0)return{openTag:-1,tail:""};let N="",j=M.openTag+1;for(let P=j;P<Math.min(y,R);P++){if(!e.startsWith("{{",P))continue;let D=ve(e,P);N+=e.slice(j,P)+"x",P=D+1,j=D+2}return N+=e.slice(j,y),{openTag:M.openTag,tail:N}}}}function ja(e,n,t){if(n<0&&!t)return null;if(n>=0&&/^\s*[!/?]/.test(e))return/^\s*\/?\s*$/.test(e)?{kind:"tag-name"}:null;if(n>=0&&/^\s*$/.test(e))return{kind:"tag-name"};let i=0;if(n>=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 l=e.slice(a,i);if(!l)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 c=e[i];if(c==='"'||c==="'"){let y=++i,v=e.indexOf(c,i);if(v===-1)return{kind:"attribute",name:l,quote:c,valuePrefix:e.slice(y)};i=v+1}else{let y=i;while(i<e.length&&!/\s/.test(e[i]))i++;if(i===e.length)return{kind:"attribute",name:l,quote:null,valuePrefix:e.slice(y)}}}return{kind:"tag"}}class ie extends Error{attribute;near;constructor(e,n){super(`Unsafe interpolation in ${e}: ${n}`);this.name="UnsafeInterpolationContextError",this.attribute=e}locate(e,n){if(this.near===void 0)this.near=e.slice(Math.max(0,n-160),n).replace(/\s+/g," ").trim(),this.message+=` (after: ${JSON.stringify(this.near)})`;return this}}var ni="unsafe:";var Na=/^(?:javascript|vbscript|livescript|mocha|view-source):/,La=/^data:(?:text\/html|text\/xml|application\/xhtml\+xml|application\/xml|image\/svg\+xml)/,Ba=/^data:(?:text\/html|application\/xhtml\+xml)/,za=new RegExp("[\\u0000-\\u0020\\u00A0\\u1680\\u2000-\\u200F\\u2028\\u2029\\u202F\\u205F\\u3000\\uFEFF]+","g");function Wa(e){return e.replace(za,"").toLowerCase()}function Ss(e){let n=e.toLowerCase();if(new RegExp("^(?:href|xlink:href|action|formaction|ping|cite|manifest|data|to)$").test(n))return"navigable";if(new RegExp("^(?:src|srcset|poster|background)$").test(n))return"fetched";return null}function zn(e,n="navigable"){let t=Wa(e);if(Na.test(t))return!0;return n==="navigable"?La.test(t):Ba.test(t)}function wr(e,n="navigable"){return zn(e,n)?"unsafe:"+e:e}function Fa(e){let n=e.match(/(?:^|[\s"'`/])([A-Za-z][\w:-]*)\s*=\s*(["'])([^"']*)$/);if(!n)return null;if(n[3].trim()!=="")return null;return Ss(n[1])}function xi(e,n,t=256){if(n<=t)return e.slice(0,n);let i=e.slice(n-t,n),a=i.search(/[\s"'`/]/);return a===-1?"":i.slice(a)}function _i(e,n,t=n){let i=Fa(e);return i&&zn(n,i)?"unsafe:"+t:t}function Pt(e){let n=e.indexOf(" as ");if(n!==-1){let l=e.slice(0,n).trim(),c=e.slice(n+4).trim();return l&&c?{arrayExpr:l,itemVar:c}:null}let t=/^\s*(.+?)\s+in\s+([\s\S]+)$/.exec(e);if(!t)return null;let i=t[1].trim().replace(/^\(([\s\S]*)\)$/,"$1").trim(),a=t[2].trim();return i&&a?{arrayExpr:a,itemVar:i}:null}function Wn(e){let n=[],t=0,i="",a=0;for(let l=0;l<e.length;l++){let c=e[l];if(i){if(c==="\\")l++;else if(c===i)i="";continue}if(c==="'"||c==='"'||c==="`")i=c;else if(c==="("||c==="["||c==="{")t++;else if(c===")"||c==="]"||c==="}")t--;else if(c===","&&t===0)n.push(e.slice(a,l)),a=l+1}return n.push(e.slice(a)),n}function wi(e,n){let t=0;for(let i=0;i<e.length;i++){let a=e[i];if(a==="("||a==="["||a==="{")t++;else if(a===")"||a==="]"||a==="}")t--;else if(a===n&&t===0)return i}return-1}function Si(e){let n=0;for(let t=0;t<e.length;t++){let i=e[t];if(i==="("||i==="["||i==="{")n++;else if((i===")"||i==="]"||i==="}")&&--n===0)return t}return-1}function xt(e,n){let t=e.trim().replace(/^\.\.\./,"").trim(),i=wi(t,"=");if(i!==-1&&t[i+1]!==">")t=t.slice(0,i).trim();if(!t)return;if(t.startsWith("{")&&t.endsWith("}")){for(let a of Wn(t.slice(1,-1))){let l=a.trim();if(!l)continue;if(l.startsWith("...")){xt(l,n);continue}let c=wi(l,":");xt(c===-1?l:l.slice(c+1),n)}return}if(t.startsWith("[")&&t.endsWith("]")){for(let a of Wn(t.slice(1,-1)))xt(a,n);return}if(/^[A-Z_$][\w$]*$/i.test(t))n.push(t)}function J(e){let n=e.trim(),t=[],i=0;for(let l=0;l<n.length;l++){let c=n[l];if(c==="("||c==="["||c==="{")i++;else if(c===")"||c==="]"||c==="}")i--;else if(i===0&&/\s/.test(c)){if(!/^\s+(?:in|of)\s/.exec(n.slice(l)))continue;let v=n.slice(0,l).trim();if(v.startsWith("(")&&Si(v)===v.length-1)v=v.slice(1,-1);for(let E of Wn(v))xt(E,t);if(t.length>0)return t;break}}let a=/^[\s\S]+?\s+as\s+([\s\S]+)$/.exec(n);if(a){let l=a[1].trim();if(l.startsWith("(")&&Si(l)===l.length-1)l=l.slice(1,-1);let c=/^([\w$]+)\s*=>\s*([\s\S]+)$/.exec(l);if(c)xt(c[2],t),xt(c[1],t);else for(let y of Wn(l))xt(y,t)}return t}function I(e,n){let t=n instanceof Set?n:new Set(n);if(t.size===0)return!1;let c=e.replace(/'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"/g," ").replace(/`(?:[^`\\$]|\\.|\$(?!\{))*`/g," ").replace(/\??\.\s*[a-zA-Z_$][\w$]*/g," ").replace(/([{,]\s*)[a-zA-Z_$][\w$]*(\s*:(?!:))/g,"$1$2");for(let y of c.match(/[a-zA-Z_$][\w$]*/g)||[])if(t.has(y))return!0;return!1}var Fn="__stx_client_loop_names";function rt(e){let n=e?.[Fn];return Array.isArray(n)?n:[]}function Vn(e){if(!e.includes("#")&&!e.includes("v-slot:")&&!e.includes("data-stx-slot-binding"))return[];let n=[],t=[],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 l=a[0];if(/^<\/template\s*>$/i.test(l)){let c=t.pop();if(c)c.end=a.index}else if(/^<template\b/i.test(l)&&!/\/\s*>$/.test(l)){let y=[...l.slice(9).matchAll(/([^\s=/>]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+)))?/g)].find((R)=>/^(?:#[\w-]+|v-slot:[\w-]+|data-stx-slot-binding)$/i.test(R[1])),v=(y?.[2]??y?.[3])?.trim();if(v&&y?.[1]==="data-stx-slot-binding")try{v=decodeURIComponent(v)}catch{v=void 0}let E=v?{start:a.index+l.length,end:e.length,binding:v}:void 0;if(t.push(E),E)n.push(E)}}return n}var Yt={},ki=new Map;function Va(e){let n=ki.get(e);if(!n){let t=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");n=new RegExp(`:${t}(?!\\w)`,"g"),ki.set(e,n)}return n.lastIndex=0,n}var Hs={uppercase:(e,n)=>e!==void 0&&e!==null?String(e).toUpperCase():"",lowercase:(e,n)=>e!==void 0&&e!==null?String(e).toLowerCase():"",capitalize:(e,n)=>{if(e===void 0||e===null)return"";let t=String(e);return t.charAt(0).toUpperCase()+t.slice(1)},number:(e,n,t=0)=>{if(e===void 0||e===null)return"";try{let i=Number(e);return Number.isNaN(i)?"":i.toFixed(Number.parseInt(String(t),10))}catch{return""}},fmt:(e,n,t="en-US")=>{if(e===void 0||e===null)return"";try{let i=Number(e);if(Number.isNaN(i))return String(e);return i.toLocaleString(t)}catch{return String(e)}},join:(e,n,t=",")=>{if(!Array.isArray(e))return"";return e.join(String(t))},escape:(e,n)=>{if(e===void 0||e===null)return"";return V(String(e))},translate:(e,n,t={})=>{if(!n||!n.__translations)return e;let i=n.__translations,a=n.__i18nConfig?.fallbackToKey??!0,l=String(e).split("."),c=i;for(let v of l){if(c===void 0||c===null)break;c=c[v]}if(c===void 0||c===null)return a?e:"";let y=String(c);return Object.entries(t).forEach(([v,E])=>{y=y.replace(Va(v),()=>String(E))}),y},t:(e,n,t={})=>Hs.translate(e,n,t),truncate:(e,n,t=50,i="...")=>{if(e===void 0||e===null)return"";let a=String(e);if(a.length<=t)return a;if(t<=i.length)return i.substring(0,t);return a.substring(0,t-i.length)+i},date:(e,n,t="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 l={short:{dateStyle:"short"},medium:{dateStyle:"medium"},long:{dateStyle:"long"},full:{dateStyle:"full"},time:{timeStyle:"short"},datetime:{dateStyle:"short",timeStyle:"short"},iso:{}};if(t==="iso")return a.toISOString();return new Intl.DateTimeFormat(i,l[t]||l.short).format(a)}catch{return String(e)}},currency:(e,n,t="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:t}).format(a)}catch{return String(e)}},pluralize:(e,n,t,i)=>{let a=Number(e);if(Number.isNaN(a))return t;let l=i||`${t}s`;return a===1?t:l},first:(e,n)=>{if(e===void 0||e===null)return"";if(Array.isArray(e))return e.length===0?"":e[0];return String(e).charAt(0)},last:(e,n)=>{if(e===void 0||e===null)return"";if(Array.isArray(e))return e.length===0?"":e[e.length-1];let t=String(e);return t.charAt(t.length-1)},length:(e,n)=>{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,n,t=!1)=>{if(e===void 0)return"undefined";if(e===null)return"null";try{return t?JSON.stringify(e,null,2):JSON.stringify(e)}catch{return String(e)}},default:(e,n,t="")=>e===void 0||e===null||e===""?t:e,reverse:(e,n)=>{if(e===void 0||e===null)return"";if(Array.isArray(e))return[...e].reverse();return String(e).split("").reverse().join("")},slice:(e,n,t=0,i)=>{if(e===void 0||e===null)return"";if(Array.isArray(e)||typeof e==="string")return e.slice(t,i);return e},replace:(e,n,t,i="")=>{if(e===void 0||e===null)return"";let a=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return String(e).replace(new RegExp(a,"g"),()=>i)},stripTags:(e,n)=>{if(e===void 0||e===null)return"";return String(e).replace(/<[^>]*>/g,"")},urlencode:(e,n)=>{if(e===void 0||e===null)return"";return encodeURIComponent(String(e))},abs:(e,n)=>{let t=Number(e);return Number.isNaN(t)?0:Math.abs(t)},round:(e,n,t=0)=>{let i=Number(e);if(Number.isNaN(i))return 0;let a=10**t;return Math.round(i*a)/a}};function pg(e,n){if(e in Hs)console.warn(`Filter "${e}" already exists as a built-in filter. Custom filter will take precedence.`);Yt[e]=n}function Kh(e){for(let[n,t]of Object.entries(e))pg(n,t)}function fg(){return{...Hs,...Yt}}function Xh(){for(let e of Object.keys(Yt))delete Yt[e]}function Dt(e,n,t=2){let i="{".repeat(t);if(!e.includes(i))return e;let a="",l=0;for(;;){let c=e.indexOf(i,l);if(c===-1)break;let y=ve(e,c,t);if(y===-1)break;a+=e.slice(l,c)+n(e.slice(c,y+t),e.slice(c+t,y),c),l=y+t}return l===0?e:a+e.slice(l)}function Ua(e,n,t){let i=t[0];if(i!=="'"&&i!=='"'&&i!=="`")return!1;let a=xr(e,n);if(!a||a.kind!=="attribute"||a.quote===i)return!1;if(!/^(?::|@|x-|v-)/.test(a.name))return!1;let l=0;for(let c=0;c<a.valuePrefix.length;c++)if(a.valuePrefix[c]==="\\")c++;else if(a.valuePrefix[c]===i)l++;return l%2===1}function p(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function V(e){return ti(p(e))}function Ha(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 Ka(e){return e.replace(/\/\*[\s\S]*?\*\//g,"").replace(/\\([\dA-Fa-f]{1,6})\s?/g,(n,t)=>String.fromCodePoint(Number.parseInt(t,16))).replace(/\\([^\r\n])/g,"$1").replace(/[\u0000-\u0020]+/g,"").toLowerCase()}function Za(e,n){let t=Ka(e);if(/@import|expression\(|behavior:|-moz-binding|(?:image-set|cross-fade)\(/.test(t))throw new ie(n,"network-capable or executable CSS is not allowed in an escaped interpolation");let i=/url\(([^)]*)\)/g,a;while((a=i.exec(t))!==null){let l=a[1].replace(/^["']|["']$/g,""),c=l.startsWith("/")&&!l.startsWith("//")||l.startsWith("./")||l.startsWith("../")||l.startsWith("#"),y=/^data:image\/(?:avif|bmp|gif|jpeg|jpg|png|webp);base64,[a-z\d+/=]+$/i.test(l);if(!c&&!y)throw new ie(n,"CSS URLs must be local paths or base64 raster images")}}function Z(e,n,t,i=!1,a=0){try{return qa(e,n,t,i,a)}catch(l){if(l instanceof ie)l.locate(e,n);throw l}}function qa(e,n,t,i,a){let l=xr(e,n,i),c=V(t);if(!l)return c;if(l.kind==="tag-name"){if(!/^[A-Za-z][A-Za-z0-9:-]*$/.test(t))throw new ie("tag name","dynamic tag names may contain only letters, digits, colons, and hyphens");return t}if(l.kind==="tag"){let E=e.slice(n+a).trimStart(),R=t.trim();if(!E.startsWith("=")&&(R===""||/^(?!on)[A-Za-z_:][\w:.-]*(?:\s+(?!on)[A-Za-z_:][\w:.-]*)*$/.test(R)))return R;throw new ie("tag structure","only standalone boolean attributes may be interpolated into tag structure")}let y=l.name.toLowerCase();if(/^on[a-z]/.test(y))throw new ie(l.name,"native event-handler attributes execute JavaScript; use an @event binding instead");if(y==="srcdoc")c=V(c);if(y==="style")Za(t,l.name);if(l.quote===null)c=Ha(c);let v=Ss(y);if(v&&l.valuePrefix.trim()===""&&zn(t,v))return ni+c;return _i(xi(e,n),t,c)}function wn(e,n){let t=` ${e}="`;return Z(t,t.length,n,!0)}function Pi(e){return e.flatMap((n)=>{let t=n.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i);return!t||/\bserver\b|\bsrc\s*=/.test(t[1])?[]:[t[2]]})}function Se(e,n){let{scripts:t}=G(e);for(let i of Pi(t)){if(/\b(state|derived|effect|ref|reactive|computed|watch|watchEffect|useModel)\s*(?:<[^>]*>)?\s*\(/.test(i)||Xc.test(i))return!0;if(Or(i,n))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 gg(e){let n=[],t=/<([a-zA-Z][\w-]*)\b[^>]*?\s(?::for|x-for|@for)\s*=\s*(["'])([\s\S]*?)\2[^>]*>/g;for(let i=t.exec(e);i;i=t.exec(e)){let a=i[1].toLowerCase(),l=new Set(J(i[3]));if(l.size===0)continue;let c=i.index+i[0].length;if(i[0].endsWith("/>")){n.push({start:i.index,end:c,names:l});continue}let y=new RegExp(`<(/?)${a}\\b[^>]*?(/?)>`,"gi");y.lastIndex=c;let v=1,E=e.length;for(let R=y.exec(e);R;R=y.exec(e)){if(R[2]==="/")continue;if(v+=R[1]==="/"?-1:1,v===0){E=R.index+R[0].length;break}}n.push({start:i.index,end:E,names:l})}return n}function Ri(e,n,t){let i=s(t);for(let a of e){if(n<a.start||n>=a.end)continue;for(let l of a.names)if(new RegExp(`(?<![.#\\w$])${l.replace(/\$/g,"\\$")}(?![\\w$])`).test(i))return!0}return!1}function Ci(e,n){let t=["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="",l=!1,c=0;for(let E=0;E<i.length;E++){let R=i[E];if(!l&&R==="`"){l=!0,c=0;continue}if(l){if(R==="`"&&c===0){l=!1;continue}if(R==="$"&&i[E+1]==="{"){c++,E++,a+=" ";continue}if(R==="}"&&c>0){c--;continue}if(c>0){a+=R;continue}continue}a+=R}i=a;let y=/(?<![a-zA-Z0-9_$])([a-zA-Z_$][a-zA-Z0-9_$]*)/g,v;while((v=y.exec(i))!==null){let E=v[1];if(!i.substring(0,v.index).trimEnd().endsWith(".")){if(!t.includes(E)&&!(E in n))return!1}}return!0}function Xa(e,n){let t=s(e);for(let i of t.matchAll(/(?<![.\w$])([A-Z_$][\w$]*)\s*\(/gi))if(typeof n[i[1]]==="function")return!0;return!1}function Ja(e,n){let t=n.__stx_serverDeclared;if(!t||t.size===0)return!1;let i=s(e);for(let a of t)if(new RegExp(`(?<![.#\\w$])${a}(?![\\w$])`).test(i))return!0;return!1}var Ti=new Set;function Ai(e){return/^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*)*$/.test(e.trim())}function Ga(e,n,t){let i=t[0];if(i!=="'"&&i!=='"'&&i!=="`")return!1;let a=0;for(let l=e.lastIndexOf(`
228
- `,n-1)+1;l<n;l++)if(e[l]==="\\")l++;else if(e[l]===i)a++;return a%2===1}function Ii(e,n){let t=`${n??"<unknown>"}\x00${e}`;if(process.env.STX_DEBUG||!Ti.has(t))Ti.add(t),console.warn(`[stx] {{ ${e} }} in a <script> in ${n??"<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 bi(e,n,t){let i=e;return i=i.replace(/\{!!([\s\S]*?)!!\}/g,(a,l)=>{try{let c=T(l,n);if(c===void 0)return Ai(l)?Ii(l.trim(),t):a;return c===null?"":String(c)}catch{return a}}),i=Dt(i,(a,l,c)=>{let y=l.trim();if(Ga(i,c,l))return a;if(/^__[A-Z_]+__$/.test(y))return a;try{let v=T(l,n);if(v===void 0)return Ai(y)?Ii(y,t):a;return JSON.stringify(v).replace(/</g,"\\u003c").replace(/@/g,"\\u0040").replace(/\{{2,}/g,(E)=>"\\u007b".repeat(E.length)).replace(/\{(?=!)/g,"\\u007b")}catch{return a}}),i}function mg(e,n){if(!e.includes("{"))return e;let t=e;return t=t.replace(/\{!!([\s\S]*?)!!\}/g,(i,a)=>{try{let l=T(a,n);if(l===void 0)return i;return l===null?"":String(l)}catch{return i}}),t=Dt(t,(i,a,l)=>{let c=a.trim();if(/^__[A-Z_]+__$/.test(c))return i;try{let y=T(a,n);if(y===void 0)return i;if(y===null)return"";let v=String(y);return Z(t,l,v,!0,i.length)}catch(y){if(y instanceof ie)throw y;return i}}),t}function Gh(e,n,t={}){let{output:i,scripts:a}=G(e),l=a.map((c)=>{let y=c.match(/^<script\b((?:[^>\"']|\"[^\"]*\"|'[^']*')*)>/i),v=c.search(/<\/script\s*>$/i);if(!y||v===-1)return c;let E=y[1],R=c.slice(y[0].length,v);if(/\bdata-raw\b/.test(E))return c;if(t.skipServer&&/\bserver\b/.test(E))return c;let N=`<script${mg(E,n)}>`;if(/\bsrc\s*=/.test(E)||/\btype\s*=\s*["']application\/json["']/.test(E))return N+R+c.slice(v);return N+bi(R,n)+c.slice(v)});return vr(i,l)}function _(e,n,t){let i=e,a=(P,D)=>{let X=pn(P,D);if(X===-1)return-1;return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(P.slice(D,X))?-1:X},l=(P,D,X,F)=>{let L=X.length,{output:Q,tokens:te}=pe(P,D,(ae,se)=>F(L+se));return X.push(...te),Q},c=[];i=l(i,a,c,(P)=>`<!--__STX_STYLE_${P}__-->`);let y=[];i=l(i,W,y,(P)=>`<!--__STX_SCRIPT_EXPR_${P}__-->`);let v=n?.__stx_signals_gate===!0||Se(e),E=new Set([...Array.isArray(n?.__stx_client_signal_names)?n.__stx_client_signal_names:[],...hi(Pi(y))]),R=new Set(Array.isArray(n?.__stx_preserved_client_expressions)?n.__stx_preserved_client_expressions:[]);i=Dt(i,(P,D,X)=>{if(I(D,E))return P;try{let F=T(D,n,!1,(L)=>$s(L,P,t,e));return F!==void 0&&F!==null?String(F):""}catch(F){let L=F instanceof Error?F.message:String(F);return h("Expression",`Error evaluating: {{{ ${D.trim()}}}}: ${L}`,t,e,X,P)}},3),i=i.replace(/\{!!([\s\S]*?)!!\}/g,(P,D,X)=>{if(I(D,E))return P;try{let F=T(D,n,!1,(L)=>$s(L,P,t,e));if(F===void 0&&n.__stx_buildMode==="compile")return Ln("raw",D.trim());return F!==void 0&&F!==null?String(F):""}catch(F){if(n.__stx_buildMode==="compile")return Ln("raw",D.trim());let L=F instanceof Error?F.message:String(F);return h("Expression",`Error evaluating: {!! ${D.trim()} !!}: ${L}`,t,e,X,P)}}),i=l(i,W,y,(P)=>`<!--__STX_SCRIPT_EXPR_${P}__-->`),i=l(i,a,c,(P)=>`<!--__STX_STYLE_${P}__-->`);let M=v?gg(i):[],N=Vn(i).map((P)=>({...P,names:new Set(J(`${P.binding} in __slot`))})),j=new Set(rt(n));if(i=Dt(i,(P,D,X)=>{let F=D.trim();if(Ua(i,X,D))return P;if(Ri(N,X,F))return P;if(I(F,j))return P;if(M.length>0&&Ri(M,X,F))return P;if(R.has(F))return P;let L=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined"],Q=/^([a-zA-Z_$][a-zA-Z0-9_$]*)/,ae=F.match(Q)?.[1],se=ae&&((ae in n)||L.includes(ae)),ue=/^([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/,Ee=F.match(ue),Te=Ee&&!L.includes(Ee[1])&&!(Ee[1]in n);if(/^__[A-Z_]+__$/.test(F))return"";if(I(F,E))return P;if(n.__stx_native_screen===!0&&Xa(F,n))return P;let Ae;try{let ke=T(D,n,!1,(ut)=>{Ae=ut});if(v&&!Ci(F,n))return P;if(Ae)$s(Ae,P,t,e);if(n.__stx_buildMode==="compile"&&!v&&(ke===void 0||Ja(F,n)))return Ln("expr",F);if(ke===void 0||ke===null)return"";let Je=String(ke);return Z(i,X,Je,!1,P.length)}catch(ke){if(ke instanceof ie)throw ke;if(v&&!Ci(F,n))return P;if(Te)return P;let Je=ke instanceof Error?ke.message:String(ke);return h("Expression",`Error evaluating: {{ ${F} }}: ${Je}`,t,e,X,P)}}),y.length>0)i=i.replace(/<!--__STX_SCRIPT_EXPR_(\d+)__-->/g,(P,D)=>y[Number(D)]??P);if(c.length>0)i=i.replace(/<!--__STX_STYLE_(\d+)__-->/g,(P,D)=>c[Number(D)]??P);return i}function hg(e,n,t){if(!n.trim())return e;let i=e,a=n.trim();while(a.length>0){let l=a.match(/^(\w+)/);if(!l)break;let c=l[1];a=a.substring(c.length).trim();let y=Yt[c]||Hs[c];if(!y)throw Error(`Filter not found: ${c}. Available filters: ${Object.keys(fg()).join(", ")}`);let v=[];if(a.startsWith(":")){let E=a.match(/^:([^|\s]+)/);if(E){let R=E[1].trim();try{let M=Number(R);v=[Number.isNaN(M)?R:M]}catch{v=[R]}a=a.substring(E[0].length).trim()}}else if(a.startsWith("(")){let E=1,R=1;while(E>0&&R<a.length){if(a[R]==="(")E++;if(a[R]===")")E--;R++}if(E===0){let M=a.substring(1,R-1).trim();if(M)try{if(M.startsWith("{")&&M.endsWith("}"))v=[T(`(${M})`,t,!0)];else{let N=[],j="",P=null,D=0,X=0,F=0,L=!1;for(let Q=0;Q<M.length;Q++){let te=M[Q];if(L){j+=te,L=!1;continue}if(te==="\\"){j+=te,L=!0;continue}if(P){if(j+=te,te===P)P=null;continue}if(te==='"'||te==="'"||te==="`"){P=te,j+=te;continue}if(te==="(")D++;else if(te===")")D--;else if(te==="[")X++;else if(te==="]")X--;else if(te==="{")F++;else if(te==="}")F--;if(te===","&&D===0&&X===0&&F===0){N.push(j),j="";continue}j+=te}if(j)N.push(j);v=N.map((Q)=>{let te=Q.trim();return T(te,t,!0)})}}catch{v=[M]}a=a.substring(R).trim()}}try{i=y(i,t,...v)}catch(E){let R=E instanceof Error?E.message:String(E);throw Error(`Error applying filter '${c}': ${R}`)}if(a.startsWith("|"))a=a.substring(1).trim();else break}return i}function Ya(e){let n=!1,t="",i=0,a=0,l=0,c=!1;for(let y=0;y<e.length;y++){let v=e[y],E=e[y+1];if(n&&c){c=!1;continue}if(n&&v==="\\"){c=!0;continue}if(c=!1,(v==='"'||v==="'"||v==="`")&&!c){if(!n)n=!0,t=v;else if(v===t)n=!1,t="";continue}if(n&&t==="`"&&v==="$"&&E==="{"){let R=1;y+=2;while(y<e.length&&R>0){if(e[y]==="{")R++;else if(e[y]==="}")R--;if(R>0)y++}continue}if(n)continue;if(v==="(")i++;else if(v===")")i--;else if(v==="[")a++;else if(v==="]")a--;else if(v==="{")l++;else if(v==="}")l--;if(v==="|"&&i===0&&a===0&&l===0){if(E==="|"){y++;continue}if(E==="="){y++;continue}return y}}return-1}var Gt=new Set,Qa=1000;function Jh(){Gt.clear()}function $s(e,n,t,i){if(!K())return;let a=`${t}\x00${e.expression}`;if(Gt.has(a))return;if(Gt.size>=Qa)Gt.clear();Gt.add(a);let l=t,c=i;try{if(t&&Ei.existsSync(t))c=Ei.readFileSync(t,"utf8")}catch{}let y=c.indexOf(n);if(y>=0)l=`${t}:${c.slice(0,y).split(`
229
- `).length}`;console.warn(`${l}: stx warning: ${n} 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 T(e,n,t=!1,i){try{let a=e.trim(),l=Ya(a);if(l>0){let y=a.substring(0,l).trim(),v=a.substring(l+1).trim(),E=T(y,n,!0,i);return hg(E,v,n)}let c=Us(a);if(c!==null){i?.({expression:a,rule:c});return}try{let y=Object.keys(n),v=Object.values(n);return d(a,y)(...v)}catch{return u(a,n)}}catch(a){if(a instanceof ReferenceError){let l=/(\b\w+)\s+is not defined/.exec(a.message);if(l){let c=l[1],y=ec(c,Object.keys(n));if(y&&y!==c)a.message=`${a.message} \u2014 did you mean '${y}'?`}}if(!t)console.error(`Error evaluating expression: ${e}`,a);throw a}}function ec(e,n){let t=null;for(let a of n){if(a===e)continue;let l=tc(e,a);if(t===null||l<t.dist)t={key:a,dist:l}}if(!t)return null;let i=Math.max(e.length,t.key.length);if(t.dist<=2||t.dist/i<=0.35)return t.key;return null}function tc(e,n){if(e===n)return 0;if(e.length===0)return n.length;if(n.length===0)return e.length;let[t,i]=e.length<n.length?[e,n]:[n,e],a=Array(t.length+1),l=Array(t.length+1);for(let c=0;c<=t.length;c++)a[c]=c;for(let c=1;c<=i.length;c++){l[0]=c;for(let y=1;y<=t.length;y++){let v=t[y-1]===i[c-1]?0:1;l[y]=Math.min(l[y-1]+1,a[y]+1,a[y-1]+v)}for(let y=0;y<=t.length;y++)a[y]=l[y]}return a[t.length]}function Yh(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 nc from"process";function C(e="STX_PUBLIC_"){let n={},t={};for(let[i,a]of Object.entries(nc.env)){if(!i.startsWith(e)||a===void 0)continue;n[`import.meta.env.${i}`]=JSON.stringify(a),t[i]=a}return n["import.meta.env"]=JSON.stringify(t),n}function Oi(e,n=""){let t=`${e}${n}`,i=0;for(let a=0;a<t.length;a++){let l=t.charCodeAt(a);i=(i<<5)-i+l,i=i&i}return`stx-${Math.abs(i).toString(36)}`}function Mi(e,n,t={}){let{prefix:i="",preserveHost:a=!0,scopeKeyframes:l=!0,scopeCustomProperties:c=!1}=t;if(!e.trim())return"";let y=vs(e),v=[],E=new Map;if(l)for(let R of y){let M=R.selector.match(/@keyframes\s+([a-z_-][a-z0-9_-]*)/i);if(M){let N=M[1],j=`${n}_${N}`;E.set(N,j)}}for(let R of y){let M=Di(R,n,i,a,E,c);v.push(M)}return v.join(`
226
+ </script>`,v,E=/<(?:template\b|script\b(?=[^>]*\bdata-stx-scoped\b))/iy;return S(e,(R,D)=>{if(v===void 0){if(E.lastIndex=D,E.test(R))v=D}return-1}),a.push({start:v??0,end:v??0,replacement:`${y}
227
+ `}),Gr(e,a)}function Gr(e,n){if(n.length===0)return e;n.sort((l,c)=>l.start-c.start||l.end-c.end);let t=Array(n.length*2+1),i=0,a=0;for(let l of n)t[a++]=e.slice(i,l.start),t[a++]=l.replacement,i=l.end;return t[a]=e.slice(i),t.join("")}function Yr(e){let n=Nn(e),t=new Map;if(n)for(let[i,a]of n)t.set(i,a.instances);return t}function Qr(e,n){let t=Nn(e);if(!t)return[];let i=[];for(let[a,l]of t){let c=l.instances-(n.get(a)??0);if(c>0)i.push({body:l.body,count:c})}return i}function ei(e,n){for(let{body:t,count:i}of n)for(let a=0;a<i;a++)_s(e,t)}function ve(e,n,t=2){let i=0,a=null;for(let l=n+t;l<e.length;l++){let c=e[l];if(a){if(c==="\\"){l++;continue}if(c===a)a=null;continue}if(c==='"'||c==="'"||c==="`"){a=c;continue}if(c==="{"){i++;continue}if(c==="}"){if(i>0){i--;continue}let y=0;while(e[l+y]==="}")y++;if(y>=t)return l}}return-1}import Ei from"fs";var ti=0,ws=new Map;function Yc(){ti=0,ws.clear()}function Ln(e,n){let t=ti++,i=`<!--__STX_${e.toUpperCase()}_${t}__-->`;return ws.set(i,{type:e,expression:n}),i}function Zc(){let e={};for(let[n,t]of ws)e[n]={type:t.type,expression:t.expression};return e}function Qc(e,n){let t=e;for(let[i,a]of n)t=t.split(i).join(a);return t}function bi(e){return e.includes("<!--__STX_")}var Da=/@(?=[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 ja(e){return Array.from({length:e},()=>"&#123;").join("&#8288;")}function ni(e){return e.replace(/\{{2,}/g,(n)=>ja(n.length)).replace(/\{(?=!)/g,"&#123;&#8288;").replace(Da,"&#64;")}function xr(e,n,t=!1){let{openTag:i,tail:a}=t?Na(e,n):La(e).at(n);return za(a,i,t)}function Na(e,n){let t="",i=0;for(let c=0;c<n;c++){if(!e.startsWith("{{",c))continue;let y=ve(e,c);if(y<0||y+2>n)break;t+=e.slice(i,c)+"x",c=y+1,i=y+2}t+=e.slice(i,n);let a=-1,l=null;for(let c=0;c<t.length;c++){let y=t[c];if(l){if(y===l)l=null;continue}if(y==='"'||y==="'"){l=y;continue}if(y===">"){a=-1;continue}if(y==="<")a=c}return{openTag:a,tail:a>=0?t.slice(a+1):t}}var Bn=null;function La(e){if(Bn&&Bn.source===e)return Bn.scanner;let n=Ba(e);return Bn={source:e,scanner:n},n}function Ba(e){let n=0,t=-1,i=null,a=-1,l=(y,v)=>{let E=e[y];if(v.quote){if(E===v.quote)v.quote=null;return}if(v.openTag>=0){if(E==='"'||E==="'"){v.quote=E;return}if(E===">"){v.openTag=-1;return}}if(E==="<")v.openTag=y},c=(y,v)=>{if(v.openTag>=0||!e.startsWith("<!--",y))return-1;let E=e.indexOf("-->",y+4);return E<0?e.length:E+3};return{at(y){if(y<n)n=0,t=-1,i=null,a=-1;let v={openTag:t,quote:i},E=!1;while(n<y){if(a<0&&e.startsWith("{{",n)){let M=ve(e,n);if(M<0)a=n;else if(M+2<=y){n=M+2;continue}else break}let P=c(n,v);if(P>=0){if(P>y){E=!0;break}n=P;continue}l(n,v),n++}if(t=v.openTag,i=v.quote,E)return{openTag:-1,tail:""};let R=a>=0?a:n,D={openTag:t,quote:i};for(let P=n;P<y;P++){let M=c(P,D);if(M>=0){if(M>y)return{openTag:-1,tail:""};P=M-1;continue}l(P,D)}if(D.openTag<0)return{openTag:-1,tail:""};let N="",j=D.openTag+1;for(let P=j;P<Math.min(y,R);P++){if(!e.startsWith("{{",P))continue;let M=ve(e,P);N+=e.slice(j,P)+"x",P=M+1,j=M+2}return N+=e.slice(j,y),{openTag:D.openTag,tail:N}}}}function za(e,n,t){if(n<0&&!t)return null;if(n>=0&&/^\s*[!/?]/.test(e))return/^\s*\/?\s*$/.test(e)?{kind:"tag-name"}:null;if(n>=0&&/^\s*$/.test(e))return{kind:"tag-name"};let i=0;if(n>=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 l=e.slice(a,i);if(!l)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 c=e[i];if(c==='"'||c==="'"){let y=++i,v=e.indexOf(c,i);if(v===-1)return{kind:"attribute",name:l,quote:c,valuePrefix:e.slice(y)};i=v+1}else{let y=i;while(i<e.length&&!/\s/.test(e[i]))i++;if(i===e.length)return{kind:"attribute",name:l,quote:null,valuePrefix:e.slice(y)}}}return{kind:"tag"}}class ie extends Error{attribute;near;constructor(e,n){super(`Unsafe interpolation in ${e}: ${n}`);this.name="UnsafeInterpolationContextError",this.attribute=e}locate(e,n){if(this.near===void 0)this.near=e.slice(Math.max(0,n-160),n).replace(/\s+/g," ").trim(),this.message+=` (after: ${JSON.stringify(this.near)})`;return this}}var ri="unsafe:";var Wa=/^(?:javascript|vbscript|livescript|mocha|view-source):/,Fa=/^data:(?:text\/html|text\/xml|application\/xhtml\+xml|application\/xml|image\/svg\+xml)/,Va=/^data:(?:text\/html|application\/xhtml\+xml)/,Ua=new RegExp("[\\u0000-\\u0020\\u00A0\\u1680\\u2000-\\u200F\\u2028\\u2029\\u202F\\u205F\\u3000\\uFEFF]+","g");function Ha(e){return e.replace(Ua,"").toLowerCase()}function Ss(e){let n=e.toLowerCase();if(new RegExp("^(?:href|xlink:href|action|formaction|ping|cite|manifest|data|to)$").test(n))return"navigable";if(new RegExp("^(?:src|srcset|poster|background)$").test(n))return"fetched";return null}function zn(e,n="navigable"){let t=Ha(e);if(Wa.test(t))return!0;return n==="navigable"?Fa.test(t):Va.test(t)}function wr(e,n="navigable"){return zn(e,n)?"unsafe:"+e:e}function Ka(e){let n=e.match(/(?:^|[\s"'`/])([A-Za-z][\w:-]*)\s*=\s*(["'])([^"']*)$/);if(!n)return null;if(n[3].trim()!=="")return null;return Ss(n[1])}function _i(e,n,t=256){if(n<=t)return e.slice(0,n);let i=e.slice(n-t,n),a=i.search(/[\s"'`/]/);return a===-1?"":i.slice(a)}function Si(e,n,t=n){let i=Ka(e);return i&&zn(n,i)?"unsafe:"+t:t}function Pt(e){let n=e.indexOf(" as ");if(n!==-1){let l=e.slice(0,n).trim(),c=e.slice(n+4).trim();return l&&c?{arrayExpr:l,itemVar:c}:null}let t=/^\s*(.+?)\s+in\s+([\s\S]+)$/.exec(e);if(!t)return null;let i=t[1].trim().replace(/^\(([\s\S]*)\)$/,"$1").trim(),a=t[2].trim();return i&&a?{arrayExpr:a,itemVar:i}:null}function Wn(e){let n=[],t=0,i="",a=0;for(let l=0;l<e.length;l++){let c=e[l];if(i){if(c==="\\")l++;else if(c===i)i="";continue}if(c==="'"||c==='"'||c==="`")i=c;else if(c==="("||c==="["||c==="{")t++;else if(c===")"||c==="]"||c==="}")t--;else if(c===","&&t===0)n.push(e.slice(a,l)),a=l+1}return n.push(e.slice(a)),n}function $i(e,n){let t=0;for(let i=0;i<e.length;i++){let a=e[i];if(a==="("||a==="["||a==="{")t++;else if(a===")"||a==="]"||a==="}")t--;else if(a===n&&t===0)return i}return-1}function vi(e){let n=0;for(let t=0;t<e.length;t++){let i=e[t];if(i==="("||i==="["||i==="{")n++;else if((i===")"||i==="]"||i==="}")&&--n===0)return t}return-1}function bt(e,n){let t=e.trim().replace(/^\.\.\./,"").trim(),i=$i(t,"=");if(i!==-1&&t[i+1]!==">")t=t.slice(0,i).trim();if(!t)return;if(t.startsWith("{")&&t.endsWith("}")){for(let a of Wn(t.slice(1,-1))){let l=a.trim();if(!l)continue;if(l.startsWith("...")){bt(l,n);continue}let c=$i(l,":");bt(c===-1?l:l.slice(c+1),n)}return}if(t.startsWith("[")&&t.endsWith("]")){for(let a of Wn(t.slice(1,-1)))bt(a,n);return}if(/^[A-Z_$][\w$]*$/i.test(t))n.push(t)}function J(e){let n=e.trim(),t=[],i=0;for(let l=0;l<n.length;l++){let c=n[l];if(c==="("||c==="["||c==="{")i++;else if(c===")"||c==="]"||c==="}")i--;else if(i===0&&/\s/.test(c)){if(!/^\s+(?:in|of)\s/.exec(n.slice(l)))continue;let v=n.slice(0,l).trim();if(v.startsWith("(")&&vi(v)===v.length-1)v=v.slice(1,-1);for(let E of Wn(v))bt(E,t);if(t.length>0)return t;break}}let a=/^[\s\S]+?\s+as\s+([\s\S]+)$/.exec(n);if(a){let l=a[1].trim();if(l.startsWith("(")&&vi(l)===l.length-1)l=l.slice(1,-1);let c=/^([\w$]+)\s*=>\s*([\s\S]+)$/.exec(l);if(c)bt(c[2],t),bt(c[1],t);else for(let y of Wn(l))bt(y,t)}return t}function I(e,n){let t=n instanceof Set?n:new Set(n);if(t.size===0)return!1;let c=e.replace(/'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"/g," ").replace(/`(?:[^`\\$]|\\.|\$(?!\{))*`/g," ").replace(/\??\.\s*[a-zA-Z_$][\w$]*/g," ").replace(/([{,]\s*)[a-zA-Z_$][\w$]*(\s*:(?!:))/g,"$1$2");for(let y of c.match(/[a-zA-Z_$][\w$]*/g)||[])if(t.has(y))return!0;return!1}var Fn="__stx_client_loop_names";function rt(e){let n=e?.[Fn];return Array.isArray(n)?n:[]}function Vn(e){if(!e.includes("#")&&!e.includes("v-slot:")&&!e.includes("data-stx-slot-binding"))return[];let n=[],t=[],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 l=a[0];if(/^<\/template\s*>$/i.test(l)){let c=t.pop();if(c)c.end=a.index}else if(/^<template\b/i.test(l)&&!/\/\s*>$/.test(l)){let y=[...l.slice(9).matchAll(/([^\s=/>]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+)))?/g)].find((R)=>/^(?:#[\w-]+|v-slot:[\w-]+|data-stx-slot-binding)$/i.test(R[1])),v=(y?.[2]??y?.[3])?.trim();if(v&&y?.[1]==="data-stx-slot-binding")try{v=decodeURIComponent(v)}catch{v=void 0}let E=v?{start:a.index+l.length,end:e.length,binding:v}:void 0;if(t.push(E),E)n.push(E)}}return n}var Yt={},ki=new Map;function Za(e){let n=ki.get(e);if(!n){let t=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");n=new RegExp(`:${t}(?!\\w)`,"g"),ki.set(e,n)}return n.lastIndex=0,n}var Vs={uppercase:(e,n)=>e!==void 0&&e!==null?String(e).toUpperCase():"",lowercase:(e,n)=>e!==void 0&&e!==null?String(e).toLowerCase():"",capitalize:(e,n)=>{if(e===void 0||e===null)return"";let t=String(e);return t.charAt(0).toUpperCase()+t.slice(1)},number:(e,n,t=0)=>{if(e===void 0||e===null)return"";try{let i=Number(e);return Number.isNaN(i)?"":i.toFixed(Number.parseInt(String(t),10))}catch{return""}},fmt:(e,n,t="en-US")=>{if(e===void 0||e===null)return"";try{let i=Number(e);if(Number.isNaN(i))return String(e);return i.toLocaleString(t)}catch{return String(e)}},join:(e,n,t=",")=>{if(!Array.isArray(e))return"";return e.join(String(t))},escape:(e,n)=>{if(e===void 0||e===null)return"";return V(String(e))},translate:(e,n,t={})=>{if(!n||!n.__translations)return e;let i=n.__translations,a=n.__i18nConfig?.fallbackToKey??!0,l=String(e).split("."),c=i;for(let v of l){if(c===void 0||c===null)break;c=c[v]}if(c===void 0||c===null)return a?e:"";let y=String(c);return Object.entries(t).forEach(([v,E])=>{y=y.replace(Za(v),()=>String(E))}),y},t:(e,n,t={})=>Vs.translate(e,n,t),truncate:(e,n,t=50,i="...")=>{if(e===void 0||e===null)return"";let a=String(e);if(a.length<=t)return a;if(t<=i.length)return i.substring(0,t);return a.substring(0,t-i.length)+i},date:(e,n,t="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 l={short:{dateStyle:"short"},medium:{dateStyle:"medium"},long:{dateStyle:"long"},full:{dateStyle:"full"},time:{timeStyle:"short"},datetime:{dateStyle:"short",timeStyle:"short"},iso:{}};if(t==="iso")return a.toISOString();return new Intl.DateTimeFormat(i,l[t]||l.short).format(a)}catch{return String(e)}},currency:(e,n,t="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:t}).format(a)}catch{return String(e)}},pluralize:(e,n,t,i)=>{let a=Number(e);if(Number.isNaN(a))return t;let l=i||`${t}s`;return a===1?t:l},first:(e,n)=>{if(e===void 0||e===null)return"";if(Array.isArray(e))return e.length===0?"":e[0];return String(e).charAt(0)},last:(e,n)=>{if(e===void 0||e===null)return"";if(Array.isArray(e))return e.length===0?"":e[e.length-1];let t=String(e);return t.charAt(t.length-1)},length:(e,n)=>{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,n,t=!1)=>{if(e===void 0)return"undefined";if(e===null)return"null";try{return t?JSON.stringify(e,null,2):JSON.stringify(e)}catch{return String(e)}},default:(e,n,t="")=>e===void 0||e===null||e===""?t:e,reverse:(e,n)=>{if(e===void 0||e===null)return"";if(Array.isArray(e))return[...e].reverse();return String(e).split("").reverse().join("")},slice:(e,n,t=0,i)=>{if(e===void 0||e===null)return"";if(Array.isArray(e)||typeof e==="string")return e.slice(t,i);return e},replace:(e,n,t,i="")=>{if(e===void 0||e===null)return"";let a=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return String(e).replace(new RegExp(a,"g"),()=>i)},stripTags:(e,n)=>{if(e===void 0||e===null)return"";return String(e).replace(/<[^>]*>/g,"")},urlencode:(e,n)=>{if(e===void 0||e===null)return"";return encodeURIComponent(String(e))},abs:(e,n)=>{let t=Number(e);return Number.isNaN(t)?0:Math.abs(t)},round:(e,n,t=0)=>{let i=Number(e);if(Number.isNaN(i))return 0;let a=10**t;return Math.round(i*a)/a}};function pg(e,n){if(e in Vs)console.warn(`Filter "${e}" already exists as a built-in filter. Custom filter will take precedence.`);Yt[e]=n}function Xh(e){for(let[n,t]of Object.entries(e))pg(n,t)}function fg(){return{...Vs,...Yt}}function Gh(){for(let e of Object.keys(Yt))delete Yt[e]}function Dt(e,n,t=2){let i="{".repeat(t);if(!e.includes(i))return e;let a="",l=0;for(;;){let c=e.indexOf(i,l);if(c===-1)break;let y=ve(e,c,t);if(y===-1)break;a+=e.slice(l,c)+n(e.slice(c,y+t),e.slice(c+t,y),c),l=y+t}return l===0?e:a+e.slice(l)}function qa(e,n,t){let i=t[0];if(i!=="'"&&i!=='"'&&i!=="`")return!1;let a=xr(e,n);if(!a||a.kind!=="attribute"||a.quote===i)return!1;if(!/^(?::|@|x-|v-)/.test(a.name))return!1;let l=0;for(let c=0;c<a.valuePrefix.length;c++)if(a.valuePrefix[c]==="\\")c++;else if(a.valuePrefix[c]===i)l++;return l%2===1}function p(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function V(e){return ni(p(e))}function Xa(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 Ja(e){return e.replace(/\/\*[\s\S]*?\*\//g,"").replace(/\\([\dA-Fa-f]{1,6})\s?/g,(n,t)=>String.fromCodePoint(Number.parseInt(t,16))).replace(/\\([^\r\n])/g,"$1").replace(/[\u0000-\u0020]+/g,"").toLowerCase()}function Ga(e,n){let t=Ja(e);if(/@import|expression\(|behavior:|-moz-binding|(?:image-set|cross-fade)\(/.test(t))throw new ie(n,"network-capable or executable CSS is not allowed in an escaped interpolation");let i=/url\(([^)]*)\)/g,a;while((a=i.exec(t))!==null){let l=a[1].replace(/^["']|["']$/g,""),c=l.startsWith("/")&&!l.startsWith("//")||l.startsWith("./")||l.startsWith("../")||l.startsWith("#"),y=/^data:image\/(?:avif|bmp|gif|jpeg|jpg|png|webp);base64,[a-z\d+/=]+$/i.test(l);if(!c&&!y)throw new ie(n,"CSS URLs must be local paths or base64 raster images")}}function Z(e,n,t,i=!1,a=0){try{return Ya(e,n,t,i,a)}catch(l){if(l instanceof ie)l.locate(e,n);throw l}}function Ya(e,n,t,i,a){let l=xr(e,n,i),c=V(t);if(!l)return c;if(l.kind==="tag-name"){if(!/^[A-Za-z][A-Za-z0-9:-]*$/.test(t))throw new ie("tag name","dynamic tag names may contain only letters, digits, colons, and hyphens");return t}if(l.kind==="tag"){let E=e.slice(n+a).trimStart(),R=t.trim();if(!E.startsWith("=")&&(R===""||/^(?!on)[A-Za-z_:][\w:.-]*(?:\s+(?!on)[A-Za-z_:][\w:.-]*)*$/.test(R)))return R;throw new ie("tag structure","only standalone boolean attributes may be interpolated into tag structure")}let y=l.name.toLowerCase();if(/^on[a-z]/.test(y))throw new ie(l.name,"native event-handler attributes execute JavaScript; use an @event binding instead");if(y==="srcdoc")c=V(c);if(y==="style")Ga(t,l.name);if(l.quote===null)c=Xa(c);let v=Ss(y);if(v&&l.valuePrefix.trim()===""&&zn(t,v))return ri+c;return Si(_i(e,n),t,c)}function wn(e,n){let t=` ${e}="`;return Z(t,t.length,n,!0)}function Oi(e){return e.flatMap((n)=>{let t=n.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i);return!t||/\bserver\b|\bsrc\s*=/.test(t[1])?[]:[t[2]]})}function Se(e,n){let{scripts:t}=G(e);for(let i of Oi(t)){if(/\b(state|derived|effect|ref|reactive|computed|watch|watchEffect|useModel)\s*(?:<[^>]*>)?\s*\(/.test(i)||Gc.test(i))return!0;if(Nr(i,n))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 gg(e){let n=[],t=/<([a-zA-Z][\w-]*)\b[^>]*?\s(?::for|x-for|@for)\s*=\s*(["'])([\s\S]*?)\2[^>]*>/g;for(let i=t.exec(e);i;i=t.exec(e)){let a=i[1].toLowerCase(),l=new Set(J(i[3]));if(l.size===0)continue;let c=i.index+i[0].length;if(i[0].endsWith("/>")){n.push({start:i.index,end:c,names:l});continue}let y=new RegExp(`<(/?)${a}\\b[^>]*?(/?)>`,"gi");y.lastIndex=c;let v=1,E=e.length;for(let R=y.exec(e);R;R=y.exec(e)){if(R[2]==="/")continue;if(v+=R[1]==="/"?-1:1,v===0){E=R.index+R[0].length;break}}n.push({start:i.index,end:E,names:l})}return n}function Ci(e,n,t){let i=r(t);for(let a of e){if(n<a.start||n>=a.end)continue;for(let l of a.names)if(new RegExp(`(?<![.#\\w$])${l.replace(/\$/g,"\\$")}(?![\\w$])`).test(i))return!0}return!1}function Ti(e,n){let t=["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="",l=!1,c=0;for(let E=0;E<i.length;E++){let R=i[E];if(!l&&R==="`"){l=!0,c=0;continue}if(l){if(R==="`"&&c===0){l=!1;continue}if(R==="$"&&i[E+1]==="{"){c++,E++,a+=" ";continue}if(R==="}"&&c>0){c--;continue}if(c>0){a+=R;continue}continue}a+=R}i=a;let y=/(?<![a-zA-Z0-9_$])([a-zA-Z_$][a-zA-Z0-9_$]*)/g,v;while((v=y.exec(i))!==null){let E=v[1];if(!i.substring(0,v.index).trimEnd().endsWith(".")){if(!t.includes(E)&&!(E in n))return!1}}return!0}function Qa(e,n){let t=r(e);for(let i of t.matchAll(/(?<![.\w$])([A-Z_$][\w$]*)\s*\(/gi))if(typeof n[i[1]]==="function")return!0;return!1}function ec(e,n){let t=n.__stx_serverDeclared;if(!t||t.size===0)return!1;let i=r(e);for(let a of t)if(new RegExp(`(?<![.#\\w$])${a}(?![\\w$])`).test(i))return!0;return!1}var Ai=new Set;function Ii(e){return/^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*)*$/.test(e.trim())}function tc(e,n,t){let i=t[0];if(i!=="'"&&i!=='"'&&i!=="`")return!1;let a=0;for(let l=e.lastIndexOf(`
228
+ `,n-1)+1;l<n;l++)if(e[l]==="\\")l++;else if(e[l]===i)a++;return a%2===1}function Pi(e,n){let t=`${n??"<unknown>"}\x00${e}`;if(process.env.STX_DEBUG||!Ai.has(t))Ai.add(t),console.warn(`[stx] {{ ${e} }} in a <script> in ${n??"<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 wi(e,n,t){let i=e;return i=i.replace(/\{!!([\s\S]*?)!!\}/g,(a,l)=>{try{let c=T(l,n);if(c===void 0)return Ii(l)?Pi(l.trim(),t):a;return c===null?"":String(c)}catch{return a}}),i=Dt(i,(a,l,c)=>{let y=l.trim();if(tc(i,c,l))return a;if(/^__[A-Z_]+__$/.test(y))return a;try{let v=T(l,n);if(v===void 0)return Ii(y)?Pi(y,t):a;return JSON.stringify(v).replace(/</g,"\\u003c").replace(/@/g,"\\u0040").replace(/\{{2,}/g,(E)=>"\\u007b".repeat(E.length)).replace(/\{(?=!)/g,"\\u007b")}catch{return a}}),i}function mg(e,n){if(!e.includes("{"))return e;let t=e;return t=t.replace(/\{!!([\s\S]*?)!!\}/g,(i,a)=>{try{let l=T(a,n);if(l===void 0)return i;return l===null?"":String(l)}catch{return i}}),t=Dt(t,(i,a,l)=>{let c=a.trim();if(/^__[A-Z_]+__$/.test(c))return i;try{let y=T(a,n);if(y===void 0)return i;if(y===null)return"";let v=String(y);return Z(t,l,v,!0,i.length)}catch(y){if(y instanceof ie)throw y;return i}}),t}function Jh(e,n,t={}){let{output:i,scripts:a}=G(e),l=a.map((c)=>{let y=c.match(/^<script\b((?:[^>\"']|\"[^\"]*\"|'[^']*')*)>/i),v=c.search(/<\/script\s*>$/i);if(!y||v===-1)return c;let E=y[1],R=c.slice(y[0].length,v);if(/\bdata-raw\b/.test(E))return c;if(t.skipServer&&/\bserver\b/.test(E))return c;let N=`<script${mg(E,n)}>`;if(/\bsrc\s*=/.test(E)||/\btype\s*=\s*["']application\/json["']/.test(E))return N+R+c.slice(v);return N+wi(R,n)+c.slice(v)});return vr(i,l)}function _(e,n,t){let i=e,a=(P,M)=>{let X=pn(P,M);if(X===-1)return-1;return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(P.slice(M,X))?-1:X},l=(P,M,X,F)=>{let L=X.length,{output:Q,tokens:ee}=pe(P,M,(re,te)=>F(L+te));return X.push(...ee),Q},c=[];i=l(i,a,c,(P)=>`<!--__STX_STYLE_${P}__-->`);let y=[];i=l(i,W,y,(P)=>`<!--__STX_SCRIPT_EXPR_${P}__-->`);let v=n?.__stx_signals_gate===!0||Se(e),E=new Set([...Array.isArray(n?.__stx_client_signal_names)?n.__stx_client_signal_names:[],...yi(Oi(y))]),R=new Set(Array.isArray(n?.__stx_preserved_client_expressions)?n.__stx_preserved_client_expressions:[]);i=Dt(i,(P,M,X)=>{if(I(M,E))return P;try{let F=T(M,n,!1,(L)=>$s(L,P,t,e));return F!==void 0&&F!==null?String(F):""}catch(F){let L=F instanceof Error?F.message:String(F);return h("Expression",`Error evaluating: {{{ ${M.trim()}}}}: ${L}`,t,e,X,P)}},3),i=i.replace(/\{!!([\s\S]*?)!!\}/g,(P,M,X)=>{if(I(M,E))return P;try{let F=T(M,n,!1,(L)=>$s(L,P,t,e));if(F===void 0&&n.__stx_buildMode==="compile")return Ln("raw",M.trim());return F!==void 0&&F!==null?String(F):""}catch(F){if(n.__stx_buildMode==="compile")return Ln("raw",M.trim());let L=F instanceof Error?F.message:String(F);return h("Expression",`Error evaluating: {!! ${M.trim()} !!}: ${L}`,t,e,X,P)}}),i=l(i,W,y,(P)=>`<!--__STX_SCRIPT_EXPR_${P}__-->`),i=l(i,a,c,(P)=>`<!--__STX_STYLE_${P}__-->`);let D=v?gg(i):[],N=Vn(i).map((P)=>({...P,names:new Set(J(`${P.binding} in __slot`))})),j=new Set(rt(n));if(i=Dt(i,(P,M,X)=>{let F=M.trim();if(qa(i,X,M))return P;if(Ci(N,X,F))return P;if(I(F,j))return P;if(D.length>0&&Ci(D,X,F))return P;if(R.has(F))return P;let L=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined"],Q=/^([a-zA-Z_$][a-zA-Z0-9_$]*)/,re=F.match(Q)?.[1],te=re&&((re in n)||L.includes(re)),le=/^([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/,Ee=F.match(le),we=Ee&&!L.includes(Ee[1])&&!(Ee[1]in n);if(/^__[A-Z_]+__$/.test(F))return"";if(I(F,E))return P;if(n.__stx_native_screen===!0&&Qa(F,n))return P;let Re;try{let Ce=T(M,n,!1,(Je)=>{Re=Je});if(v&&!Ti(F,n))return P;if(Re)$s(Re,P,t,e);if(n.__stx_buildMode==="compile"&&!v&&(Ce===void 0||ec(F,n)))return Ln("expr",F);if(Ce===void 0||Ce===null)return"";let Ke=String(Ce);return Z(i,X,Ke,!1,P.length)}catch(Ce){if(Ce instanceof ie)throw Ce;if(v&&!Ti(F,n))return P;if(we)return P;let Ke=Ce instanceof Error?Ce.message:String(Ce);return h("Expression",`Error evaluating: {{ ${F} }}: ${Ke}`,t,e,X,P)}}),y.length>0)i=i.replace(/<!--__STX_SCRIPT_EXPR_(\d+)__-->/g,(P,M)=>y[Number(M)]??P);if(c.length>0)i=i.replace(/<!--__STX_STYLE_(\d+)__-->/g,(P,M)=>c[Number(M)]??P);return i}function hg(e,n,t){if(!n.trim())return e;let i=e,a=n.trim();while(a.length>0){let l=a.match(/^(\w+)/);if(!l)break;let c=l[1];a=a.substring(c.length).trim();let y=Yt[c]||Vs[c];if(!y)throw Error(`Filter not found: ${c}. Available filters: ${Object.keys(fg()).join(", ")}`);let v=[];if(a.startsWith(":")){let E=a.match(/^:([^|\s]+)/);if(E){let R=E[1].trim();try{let D=Number(R);v=[Number.isNaN(D)?R:D]}catch{v=[R]}a=a.substring(E[0].length).trim()}}else if(a.startsWith("(")){let E=1,R=1;while(E>0&&R<a.length){if(a[R]==="(")E++;if(a[R]===")")E--;R++}if(E===0){let D=a.substring(1,R-1).trim();if(D)try{if(D.startsWith("{")&&D.endsWith("}"))v=[T(`(${D})`,t,!0)];else{let N=[],j="",P=null,M=0,X=0,F=0,L=!1;for(let Q=0;Q<D.length;Q++){let ee=D[Q];if(L){j+=ee,L=!1;continue}if(ee==="\\"){j+=ee,L=!0;continue}if(P){if(j+=ee,ee===P)P=null;continue}if(ee==='"'||ee==="'"||ee==="`"){P=ee,j+=ee;continue}if(ee==="(")M++;else if(ee===")")M--;else if(ee==="[")X++;else if(ee==="]")X--;else if(ee==="{")F++;else if(ee==="}")F--;if(ee===","&&M===0&&X===0&&F===0){N.push(j),j="";continue}j+=ee}if(j)N.push(j);v=N.map((Q)=>{let ee=Q.trim();return T(ee,t,!0)})}}catch{v=[D]}a=a.substring(R).trim()}}try{i=y(i,t,...v)}catch(E){let R=E instanceof Error?E.message:String(E);throw Error(`Error applying filter '${c}': ${R}`)}if(a.startsWith("|"))a=a.substring(1).trim();else break}return i}function nc(e){let n=!1,t="",i=0,a=0,l=0,c=!1;for(let y=0;y<e.length;y++){let v=e[y],E=e[y+1];if(n&&c){c=!1;continue}if(n&&v==="\\"){c=!0;continue}if(c=!1,(v==='"'||v==="'"||v==="`")&&!c){if(!n)n=!0,t=v;else if(v===t)n=!1,t="";continue}if(n&&t==="`"&&v==="$"&&E==="{"){let R=1;y+=2;while(y<e.length&&R>0){if(e[y]==="{")R++;else if(e[y]==="}")R--;if(R>0)y++}continue}if(n)continue;if(v==="(")i++;else if(v===")")i--;else if(v==="[")a++;else if(v==="]")a--;else if(v==="{")l++;else if(v==="}")l--;if(v==="|"&&i===0&&a===0&&l===0){if(E==="|"){y++;continue}if(E==="="){y++;continue}return y}}return-1}var Gt=new Set,sc=1000;function Yh(){Gt.clear()}function $s(e,n,t,i){if(!K())return;let a=`${t}\x00${e.expression}`;if(Gt.has(a))return;if(Gt.size>=sc)Gt.clear();Gt.add(a);let l=t,c=i;try{if(t&&Ei.existsSync(t))c=Ei.readFileSync(t,"utf8")}catch{}let y=c.indexOf(n);if(y>=0)l=`${t}:${c.slice(0,y).split(`
229
+ `).length}`;console.warn(`${l}: stx warning: ${n} 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 T(e,n,t=!1,i){try{let a=e.trim(),l=nc(a);if(l>0){let y=a.substring(0,l).trim(),v=a.substring(l+1).trim(),E=T(y,n,!0,i);return hg(E,v,n)}let c=Ws(a);if(c!==null){i?.({expression:a,rule:c});return}try{let y=Object.keys(n),v=Object.values(n);return d(a,y)(...v)}catch{return u(a,n)}}catch(a){if(a instanceof ReferenceError){let l=/(\b\w+)\s+is not defined/.exec(a.message);if(l){let c=l[1],y=rc(c,Object.keys(n));if(y&&y!==c)a.message=`${a.message} \u2014 did you mean '${y}'?`}}if(!t)console.error(`Error evaluating expression: ${e}`,a);throw a}}function rc(e,n){let t=null;for(let a of n){if(a===e)continue;let l=ic(e,a);if(t===null||l<t.dist)t={key:a,dist:l}}if(!t)return null;let i=Math.max(e.length,t.key.length);if(t.dist<=2||t.dist/i<=0.35)return t.key;return null}function ic(e,n){if(e===n)return 0;if(e.length===0)return n.length;if(n.length===0)return e.length;let[t,i]=e.length<n.length?[e,n]:[n,e],a=Array(t.length+1),l=Array(t.length+1);for(let c=0;c<=t.length;c++)a[c]=c;for(let c=1;c<=i.length;c++){l[0]=c;for(let y=1;y<=t.length;y++){let v=t[y-1]===i[c-1]?0:1;l[y]=Math.min(l[y-1]+1,a[y]+1,a[y-1]+v)}for(let y=0;y<=t.length;y++)a[y]=l[y]}return a[t.length]}function Zh(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 oc from"process";function C(e="STX_PUBLIC_"){let n={},t={};for(let[i,a]of Object.entries(oc.env)){if(!i.startsWith(e)||a===void 0)continue;n[`import.meta.env.${i}`]=JSON.stringify(a),t[i]=a}return n["import.meta.env"]=JSON.stringify(t),n}function Mi(e,n=""){let t=`${e}${n}`,i=0;for(let a=0;a<t.length;a++){let l=t.charCodeAt(a);i=(i<<5)-i+l,i=i&i}return`stx-${Math.abs(i).toString(36)}`}function Di(e,n,t={}){let{prefix:i="",preserveHost:a=!0,scopeKeyframes:l=!0,scopeCustomProperties:c=!1}=t;if(!e.trim())return"";let y=vs(e),v=[],E=new Map;if(l)for(let R of y){let D=R.selector.match(/@keyframes\s+([a-z_-][a-z0-9_-]*)/i);if(D){let N=D[1],j=`${n}_${N}`;E.set(N,j)}}for(let R of y){let D=ji(R,n,i,a,E,c);v.push(D)}return v.join(`
230
230
 
231
- `)}function vs(e){let n=[],t=e.replace(/\/\*[\s\S]*?\*\//g,""),i=0,a="",l=!1,c="";for(let y=0;y<t.length;y++){let v=t[y];if(v==="@"&&i===0)l=!0;if(v==="{")i++;else if(v==="}"){if(i--,i===0){if(l){c+=v;let E=c.match(/@([a-z-]+)\s*([^{]*)\{([\s\S]*)\}/i);if(E){let[,R,M,N]=E;if(R==="keyframes")n.push({selector:`@keyframes ${M.trim()}`,declarations:N.trim()});else if(R==="media"||R==="supports"||R==="container"){let j=vs(N);n.push({selector:`@${R} ${M.trim()}`,declarations:j.map((P)=>`${P.selector} { ${P.declarations} }`).join(`
232
- `)})}else n.push({selector:`@${R} ${M.trim()}`,declarations:N.trim()})}c="",l=!1}else if(a.trim()){a+=v;let E=a.match(/([^{]+)\{([^}]*)\}/);if(E)n.push({selector:E[1].trim(),declarations:E[2].trim()});a=""}continue}}if(l)c+=v;else a+=v}return n}function Di(e,n,t,i,a,l){let{selector:c,declarations:y}=e;if(c.startsWith("@")){if(c.startsWith("@keyframes")){let R=c.replace("@keyframes ","").trim();return`@keyframes ${a.get(R)||R} { ${y} }`}if(c.startsWith("@media")||c.startsWith("@supports")||c.startsWith("@container")){let M=vs(`x { ${y} }`.replace(/x \{ /,"").replace(/ \}$/,"")).map((N)=>Di(N,n,t,i,a,l)).join(`
231
+ `)}function vs(e){let n=[],t=e.replace(/\/\*[\s\S]*?\*\//g,""),i=0,a="",l=!1,c="";for(let y=0;y<t.length;y++){let v=t[y];if(v==="@"&&i===0)l=!0;if(v==="{")i++;else if(v==="}"){if(i--,i===0){if(l){c+=v;let E=c.match(/@([a-z-]+)\s*([^{]*)\{([\s\S]*)\}/i);if(E){let[,R,D,N]=E;if(R==="keyframes")n.push({selector:`@keyframes ${D.trim()}`,declarations:N.trim()});else if(R==="media"||R==="supports"||R==="container"){let j=vs(N);n.push({selector:`@${R} ${D.trim()}`,declarations:j.map((P)=>`${P.selector} { ${P.declarations} }`).join(`
232
+ `)})}else n.push({selector:`@${R} ${D.trim()}`,declarations:N.trim()})}c="",l=!1}else if(a.trim()){a+=v;let E=a.match(/([^{]+)\{([^}]*)\}/);if(E)n.push({selector:E[1].trim(),declarations:E[2].trim()});a=""}continue}}if(l)c+=v;else a+=v}return n}function ji(e,n,t,i,a,l){let{selector:c,declarations:y}=e;if(c.startsWith("@")){if(c.startsWith("@keyframes")){let R=c.replace("@keyframes ","").trim();return`@keyframes ${a.get(R)||R} { ${y} }`}if(c.startsWith("@media")||c.startsWith("@supports")||c.startsWith("@container")){let D=vs(`x { ${y} }`.replace(/x \{ /,"").replace(/ \}$/,"")).map((N)=>ji(N,n,t,i,a,l)).join(`
233
233
  `);return`${c} {
234
- ${M}
235
- }`}return`${c} { ${y} }`}let v=sc(c,n,t,i),E=y;for(let[R,M]of a)E=E.replace(new RegExp(`\\b${R}\\b`,"g"),M);if(l)E=E.replace(/--([a-z-]+)/gi,`--${n}-$1`);return`${v} { ${E} }`}function sc(e,n,t,i){let a=e.split(",").map((c)=>c.trim()),l=[];for(let c of a){if(c.startsWith(":host")){if(i)l.push(c);else{let E=c.replace(/:host(\([^)]*\))?/,`.${n}$1`);l.push(E)}continue}if(c.includes("::slotted")){l.push(c);continue}if(c===":root"){l.push(`:root .${n}`);continue}let y=t?`${t} .${n}`:`.${n}`;l.push(`${y} ${c}`);let v=rc(c,n);if(v)l.push(t?`${t} ${v}`:v)}return l.join(", ")}function rc(e,n){let t=0,i=e.length;for(let v=0;v<e.length;v++){let E=e[v];if(E==="["||E==="(")t++;else if(E==="]"||E===")")t--;else if(t===0&&(E===" "||E===">"||E==="+"||E==="~")){i=v;break}}let a=e.slice(0,i),l=e.slice(i);if(!a)return"";let c=a.length,y=0;for(let v=0;v<a.length;v++){let E=a[v];if(E==="["||E==="(")y++;else if(E==="]"||E===")")y--;else if(t===0&&y===0&&E===":"){c=v;break}}return`${a.slice(0,c)}.${n}${a.slice(c)}${l}`}var Li=String.raw`(?<![\w-])scoped(?![\w-])`,Es=/<style\s+([^>]*)>/gi,ji=/<style\s+([^>]*)>([\s\S]*?)<\/style>/gi,Bi=new RegExp(Li,"i"),ic=new RegExp(Li,"gi"),ks=/<style\b[^>]*\bdata-stx-scoped(?:=(?:"[^"]*"|'[^']*'|[^\s>]+))?[^>]*>[\s\S]*?<\/style>\s*/gi;function oc(e){Es.lastIndex=0;let n=Es.exec(e);while(n!==null){if(Bi.test(n[1]))return!0;n=Es.exec(e)}return!1}function ui(e){let n=new Set,t=[];ks.lastIndex=0;let i=ks.exec(e);while(i!==null){let a=i[0].trim();if(n.has(a))t.push({start:i.index,end:i.index+i[0].length});else n.add(a);i=ks.exec(e)}return t}function fn(e){let n=ui(e);if(n.length===0)return e;let t=Array(n.length+1),i=0;for(let a=0;a<n.length;a++){let l=n[a];t[a]=e.slice(i,l.start),i=l.end}return t[n.length]=e.slice(i),t.join("")}function Ls(e,n){if(!oc(e))return{html:e,hasScoped:!1};let t=Oi(n),i=`data-v-${t}`,a=e,l=!1;if(ji.lastIndex=0,a=a.replace(ji,(c,y,v)=>{if(!Bi.test(y))return c;l=!0;let E=ac(v,i),R=y.replace(ic,"").trim(),M=R?` ${R}`:"";return`<style data-stx-scoped="${t}"${M}>${E}</style>`}),!l)return{html:e,hasScoped:!1};return a=lc(a,i),{html:a,hasScoped:!0}}function ac(e,n){return Mi(e,"__SCOPE_PLACEHOLDER__",{preserveHost:!1}).replace(/\.(__SCOPE_PLACEHOLDER__) /g,`[${n}] `).replace(/\.(__SCOPE_PLACEHOLDER__)/g,`[${n}]`)}var cc=(e)=>`\x00stx-scope-mask-${e}\x00`,Ni=/\u0000stx-scope-mask-(\d+)\u0000/g;function lc(e,n){let t=pe(e,(a,l)=>{let c=W(a,l);return c>l?c:pn(a,l)},(a,l)=>cc(l)),i=uc(t.output,n);return Ni.lastIndex=0,i.replace(Ni,(a,l)=>t.tokens[Number(l)])}function uc(e,n){let t=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,l)=>{if(t.has(a.toLowerCase()))return i;if(i.includes(n))return i;if(a.toLowerCase()==="style"||a.toLowerCase()==="script")return i;if(l)return i.replace(`<${a}${l}`,`<${a} ${n}${l}`);if(i.endsWith("/>"))return`<${a} ${n} />`;return`<${a} ${n}>`})}var Qt=/<\/?template\b[^>]*>/gi,fc=/(?:^|\s)(?:id\s*=|(?:x-|[@:])(?:for|if|else(?:-if)?)(?=\s|=|$)|#[\w-]+(?:\s*=|\s|$)|v-slot(?::[\w-]+)?(?=\s|=|$)|slot\s*=)/i;function dc(e){let n=e.replace(/^<template\b/i,"").replace(/>$/,"");return fc.test(n)}function de(e){Qt.lastIndex=0;let n;while((n=Qt.exec(e))!==null){if(n[0].startsWith("</")||dc(n[0]))continue;let t=n.index,i=Qt.lastIndex,a=1,l;while((l=Qt.exec(e))!==null)if(l[0].startsWith("</")){if(a--,a===0){let c=l.index;return{start:t,openEnd:i,closeStart:c,end:Qt.lastIndex,content:e.slice(i,c)}}}else a++;return null}return null}function Bs(e,n){let t=e,i=/@json\s*\(/g,a;while((a=i.exec(t))!==null){let l=a.index,c=l+a[0].length-1,y=1,v=c+1,E=null,R=!1;while(v<t.length&&y>0){let Q=t[v];if(R){R=!1,v++;continue}if(Q==="\\"&&E){R=!0,v++;continue}if(E){if(Q===E)E=null;v++;continue}if(Q==='"'||Q==="'"||Q==="`"){E=Q,v++;continue}if(Q==="(")y++;else if(Q===")"){if(y--,y===0)break}v++}if(y!==0)break;let M=t.substring(c+1,v).trim(),N=t.substring(l,v+1),j=-1,P=0,D=null,X=!1;for(let Q=0;Q<M.length;Q++){let te=M[Q];if(X){X=!1;continue}if(te==="\\"&&D){X=!0;continue}if(D){if(te===D)D=null;continue}if(te==='"'||te==="'"||te==="`"){D=te;continue}if(te==="("||te==="["||te==="{")P++;else if(te===")"||te==="]"||te==="}")P--;if(te===","&&P===0){j=Q;break}}let F=j>=0?M.substring(0,j).trim():M,L=j>=0?M.substring(j+1).trim():void 0;try{let Q=F.trim(),te;if(f(Q))te=d(Q,Object.keys(n))(...Object.values(n));else te=void 0;let ae;if(L==="true")ae=JSON.stringify(te,null,2);else ae=JSON.stringify(te);let se=ae.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029");t=t.substring(0,l)+se+t.substring(v+1),i.lastIndex=l+se.length}catch(Q){B.log(Q instanceof Error?Q:Error(String(Q)),{directive:"@json"},"error"),i.lastIndex=l+N.length}}return t}function Fs(e){return e.replace(/@once\s*([\s\S]*?)@endonce/g,"$1")}function jc(e){let n=e,t=/@memo\s*\(/g,i,a=[];while((i=t.exec(n))!==null){let l=i.index,c=l+i[0].length,y=1,v=c;while(v<n.length&&y>0){if(n[v]==="(")y++;else if(n[v]===")")y--;v++}if(y!==0)continue;let E=n.slice(c,v-1).trim(),R=v,M=n.slice(R),N=M.indexOf("@endmemo");if(N===-1)continue;let j=M.slice(0,N),P=R+N+8,D=j.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)/),X=D?D[0].length:0,F=j.slice(X),L=j.match(/(\s*)$/),Q=L?L[0].length:0,te=F.slice(0,F.length-Q),ae=te.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)?(\/?)>/),se;if(ae){let[ue,Ee,Te="",Ae]=ae,ke=`<${Ee}${Te} data-stx-memo="${E}"${Ae}>`;se=j.slice(0,X)+ke+te.slice(ue.length)+j.slice(X+te.length)}else se=`${j.slice(0,X)}<div data-stx-memo="${E}">${te}</div>${j.slice(X+te.length)}`;a.push({start:l,end:P,replacement:se}),t.lastIndex=P}for(let l=a.length-1;l>=0;l--){let c=a[l];n=n.slice(0,c.start)+c.replacement+n.slice(c.end)}return n.replace(/@memo="([^"]*)"/g,'data-stx-memo="$1"')}function di(e){let n=e.replace(/@ref="([^"]+)"/g,'data-stx-ref="$1"');return n=n.replace(/(<[a-zA-Z][a-zA-Z0-9-]*\b[^>]*?)\sref="([^"]+)"/g,'$1 data-stx-ref="$2"'),n}function Vi(e,n){if(!/\bref\s*=/.test(e))return e;let t=/<\/?([a-zA-Z][\w-]*)\b(?:"[^"]*"|'[^']*'|[^'">])*>/y,i=S(e,(v,E)=>{t.lastIndex=E;let R=t.exec(v);if(!R||/^(?:script|style)$/i.test(R[1]))return-1;return t.lastIndex}),a=[],l=0,c=0,y=[];for(let{start:v,end:E,token:R}of i){let M=/^<\/?([\w-]+)/.exec(R)[1].toLowerCase();if(R.startsWith("</")){let D;while(D=a.pop()){if(D.scoped)l--;if(D.name===M)break}continue}let N=/\sdata-stx-scope\s*=/.test(R),j=/\sdata-stx-ref-caller\s*=\s*(["'])(.*?)\1/.exec(R),P=a.find((D)=>D.scoped)?.scopeId;if(j&&P&&j[2]===P)y.push(e.slice(c,v),R.replace(j[0],` data-stx-ref-caller="${n}"`)),c=E;else if(!l&&!N&&/\s(?:ref|@ref|:ref|x-ref|data-stx-ref)\s*=/.test(R)&&!/\sdata-stx-ref-caller\s*=/.test(R))y.push(e.slice(c,v),R.replace(/\s*\/?>$/,(D)=>` data-stx-ref-caller="${n}"${D}`)),c=E;if(!Ui.has(M)&&!/\/>$/.test(R)){let D=/\sdata-stx-scope\s*=\s*(?:"([^"]*)"|'([^']*)')/.exec(R);if(a.push({name:M,scoped:N,scopeId:D?.[1]??D?.[2]}),N)l++}}return y.push(e.slice(c)),y.join("")}var Ui=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),Hi=/(?:^|\s)x-no-cloak(?:=|\s|\/|>|$)/,zi=/<\/?\s*([a-z][\w-]*)/iy,pc=/\s/;function gc(e,n){let t=n-1;while(t>=0&&pc.test(e[t]))t--;return t>=0&&e[t]==="/"}function mc(e,n){let t=!1,i=!1;for(let a=n;a<e.length;a++){let l=e[a];if(t){if(l==="'")t=!1}else if(i){if(l==='"')i=!1}else if(l==="'")t=!0;else if(l==='"')i=!0;else if(l===">")return a}return-1}function hc(e,n){if(e.indexOf("{",n)===-1||e.indexOf("}",n)===-1)return!1;let t=0,i=n,a=!1,l=!1,c=!1;while(i<e.length){let y=e.indexOf("<",i),v=y===-1?e.length:y;if(v>i){if(t===0)while(i<v){let M=e.indexOf(l?"}":"{",i);if(M===-1||M>=v){if(l)c=!1;else a=!1;break}if(M>i)if(l)c=!1;else a=!1;if(l){if(c)return!0;c=!0}else if(a)l=!0,c=!1;else a=!0;i=M+1}i=v;continue}if(e.startsWith("<!--",i)){let M=e.indexOf("-->",i);i=M===-1?e.length:M+3;continue}let E=mc(e,i);if(E===-1)break;zi.lastIndex=i;let R=zi.exec(e)?.[1]?.toLowerCase()??"";if(e[i+1]==="/"){if(t===0)break;t--}else if(!gc(e,E)&&!Ui.has(R))t++;i=E+1}return!1}var Wi=b(256);function Bc(e){if(e.length<1024)return Fi(e);let n=x(e),t=Wi.get(n);if(t!==void 0)return t;let i=Fi(e);return Wi.set(n,i),i}function Fi(e){if(e.length>=32768&&!Xr(e))return e;let t=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,l;while((l=t.exec(e))!==null){let c=l.index,y=c+l[0].length,v=!1,E=!1,R=-1;while(y<e.length){let N=e[y];if(v){if(N==="'")v=!1}else if(E){if(N==='"')E=!1}else if(N==="'")v=!0;else if(N==='"')E=!0;else if(N===">"){R=y;break}y++}if(R===-1)continue;let M=e.slice(c,R+1);if(Hi.test(M))continue;if(M.includes("x-cloak"))continue;if(hc(e,R+1))i+=e.slice(a,R)+" x-cloak>",a=R+1}return i+=e.slice(a),i}var xc=/(?:^|\s)(?::else-if|:if|:else|:show|x-else-if|x-if|x-else|x-show|@if|@show)(?:=|\s|\/|>|$)/,bc=/<\/script>/gi,yc=/<\/style>/gi;function Fc(e){let n=/<[a-z][\w-]*/gi,t="",i=0,a;while((a=n.exec(e))!==null){let l=a.index,c=a[0].slice(1).toLowerCase();if(c==="script"||c==="style"){let P=c==="script"?bc:yc;P.lastIndex=l;let D=P.exec(e);if(D!==null)n.lastIndex=D.index+D[0].length;continue}let y=l+a[0].length,v=!1,E=!1,R=-1;while(y<e.length){let P=e[y];if(v){if(P==="'")v=!1}else if(E){if(P==='"')E=!1}else if(P==="'")v=!0;else if(P==='"')E=!0;else if(P===">"){R=y;break}y++}if(R===-1)continue;let M=e.slice(l+a[0].length,R);if(Hi.test(M))continue;if(/(?:^|\s)x-cloak(?:=|\s|\/|>|$)/.test(M))continue;if(!xc.test(M))continue;let N=e[R-1]==="/",j=N?R-1:R;t+=`${e.slice(i,j)} x-cloak${N?" ":""}`,i=j}return t+=e.slice(i),t}import ro from"path";import Cs from"fs";import en from"path";function Ki(e,n,t,i){let a=0;for(let l=n;l<e.length;l++)if(e[l]===t)a++;else if(e[l]===i&&!(i===">"&&e[l-1]==="=")){if(--a===0)return l}return-1}function _c(e){let n=s(e),t=0,i=0,a=[];for(let l=0;l<n.length;l++)if("([{".includes(n[l]))t++;else if(")]}".includes(n[l]))t--;else if(n[l]===","&&t===0)a.push(e.slice(i,l).trim()),i=l+1;return a.push(e.slice(i).trim()),a}function Rs(e,n){let t=s(e),i=new RegExp(`\\b(?:${n.map((a)=>a.replace(/[$]/g,"\\$&")).join("|")})\\s*(?=[<(])`,"g");for(let a of t.matchAll(i)){let l=a.index+a[0].length,c="";if(t[l]==="<"){let v=Ki(t,l,"<",">");if(v<0)continue;c=e.slice(l+1,v),l=v+1;while(/\s/.test(t[l]||"")&&l<t.length)l++}if(t[l]!=="(")continue;let y=Ki(t,l,"(",")");if(y>=0)return{type:c,args:_c(e.slice(l+1,y))}}return null}var Zi=`
234
+ ${D}
235
+ }`}return`${c} { ${y} }`}let v=ac(c,n,t,i),E=y;for(let[R,D]of a)E=E.replace(new RegExp(`\\b${R}\\b`,"g"),D);if(l)E=E.replace(/--([a-z-]+)/gi,`--${n}-$1`);return`${v} { ${E} }`}function ac(e,n,t,i){let a=e.split(",").map((c)=>c.trim()),l=[];for(let c of a){if(c.startsWith(":host")){if(i)l.push(c);else{let E=c.replace(/:host(\([^)]*\))?/,`.${n}$1`);l.push(E)}continue}if(c.includes("::slotted")){l.push(c);continue}if(c===":root"){l.push(`:root .${n}`);continue}let y=t?`${t} .${n}`:`.${n}`;l.push(`${y} ${c}`);let v=cc(c,n);if(v)l.push(t?`${t} ${v}`:v)}return l.join(", ")}function cc(e,n){let t=0,i=e.length;for(let v=0;v<e.length;v++){let E=e[v];if(E==="["||E==="(")t++;else if(E==="]"||E===")")t--;else if(t===0&&(E===" "||E===">"||E==="+"||E==="~")){i=v;break}}let a=e.slice(0,i),l=e.slice(i);if(!a)return"";let c=a.length,y=0;for(let v=0;v<a.length;v++){let E=a[v];if(E==="["||E==="(")y++;else if(E==="]"||E===")")y--;else if(t===0&&y===0&&E===":"){c=v;break}}return`${a.slice(0,c)}.${n}${a.slice(c)}${l}`}var Bi=String.raw`(?<![\w-])scoped(?![\w-])`,Es=/<style\s+([^>]*)>/gi,Ni=/<style\s+([^>]*)>([\s\S]*?)<\/style>/gi,zi=new RegExp(Bi,"i"),lc=new RegExp(Bi,"gi"),ks=/<style\b[^>]*\bdata-stx-scoped(?:=(?:"[^"]*"|'[^']*'|[^\s>]+))?[^>]*>[\s\S]*?<\/style>\s*/gi;function uc(e){Es.lastIndex=0;let n=Es.exec(e);while(n!==null){if(zi.test(n[1]))return!0;n=Es.exec(e)}return!1}function di(e){let n=new Set,t=[];ks.lastIndex=0;let i=ks.exec(e);while(i!==null){let a=i[0].trim();if(n.has(a))t.push({start:i.index,end:i.index+i[0].length});else n.add(a);i=ks.exec(e)}return t}function fn(e){let n=di(e);if(n.length===0)return e;let t=Array(n.length+1),i=0;for(let a=0;a<n.length;a++){let l=n[a];t[a]=e.slice(i,l.start),i=l.end}return t[n.length]=e.slice(i),t.join("")}function js(e,n){if(!uc(e))return{html:e,hasScoped:!1};let t=Mi(n),i=`data-v-${t}`,a=e,l=!1;if(Ni.lastIndex=0,a=a.replace(Ni,(c,y,v)=>{if(!zi.test(y))return c;l=!0;let E=fc(v,i),R=y.replace(lc,"").trim(),D=R?` ${R}`:"";return`<style data-stx-scoped="${t}"${D}>${E}</style>`}),!l)return{html:e,hasScoped:!1};return a=pc(a,i),{html:a,hasScoped:!0}}function fc(e,n){return Di(e,"__SCOPE_PLACEHOLDER__",{preserveHost:!1}).replace(/\.(__SCOPE_PLACEHOLDER__) /g,`[${n}] `).replace(/\.(__SCOPE_PLACEHOLDER__)/g,`[${n}]`)}var dc=(e)=>`\x00stx-scope-mask-${e}\x00`,Li=/\u0000stx-scope-mask-(\d+)\u0000/g;function pc(e,n){let t=pe(e,(a,l)=>{let c=W(a,l);return c>l?c:pn(a,l)},(a,l)=>dc(l)),i=gc(t.output,n);return Li.lastIndex=0,i.replace(Li,(a,l)=>t.tokens[Number(l)])}function gc(e,n){let t=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,l)=>{if(t.has(a.toLowerCase()))return i;if(i.includes(n))return i;if(a.toLowerCase()==="style"||a.toLowerCase()==="script")return i;if(l)return i.replace(`<${a}${l}`,`<${a} ${n}${l}`);if(i.endsWith("/>"))return`<${a} ${n} />`;return`<${a} ${n}>`})}var Qt=/<\/?template\b[^>]*>/gi,mc=/(?:^|\s)(?:id\s*=|(?:x-|[@:])(?:for|if|else(?:-if)?)(?=\s|=|$)|#[\w-]+(?:\s*=|\s|$)|v-slot(?::[\w-]+)?(?=\s|=|$)|slot\s*=)/i;function hc(e){let n=e.replace(/^<template\b/i,"").replace(/>$/,"");return mc.test(n)}function de(e){Qt.lastIndex=0;let n;while((n=Qt.exec(e))!==null){if(n[0].startsWith("</")||hc(n[0]))continue;let t=n.index,i=Qt.lastIndex,a=1,l;while((l=Qt.exec(e))!==null)if(l[0].startsWith("</")){if(a--,a===0){let c=l.index;return{start:t,openEnd:i,closeStart:c,end:Qt.lastIndex,content:e.slice(i,c)}}}else a++;return null}return null}function Fs(e,n){let t=e,i=/@json\s*\(/g,a;while((a=i.exec(t))!==null){let l=a.index,c=l+a[0].length-1,y=1,v=c+1,E=null,R=!1;while(v<t.length&&y>0){let Q=t[v];if(R){R=!1,v++;continue}if(Q==="\\"&&E){R=!0,v++;continue}if(E){if(Q===E)E=null;v++;continue}if(Q==='"'||Q==="'"||Q==="`"){E=Q,v++;continue}if(Q==="(")y++;else if(Q===")"){if(y--,y===0)break}v++}if(y!==0)break;let D=t.substring(c+1,v).trim(),N=t.substring(l,v+1),j=-1,P=0,M=null,X=!1;for(let Q=0;Q<D.length;Q++){let ee=D[Q];if(X){X=!1;continue}if(ee==="\\"&&M){X=!0;continue}if(M){if(ee===M)M=null;continue}if(ee==='"'||ee==="'"||ee==="`"){M=ee;continue}if(ee==="("||ee==="["||ee==="{")P++;else if(ee===")"||ee==="]"||ee==="}")P--;if(ee===","&&P===0){j=Q;break}}let F=j>=0?D.substring(0,j).trim():D,L=j>=0?D.substring(j+1).trim():void 0;try{let Q=F.trim(),ee;if(f(Q))ee=d(Q,Object.keys(n))(...Object.values(n));else ee=void 0;let re;if(L==="true")re=JSON.stringify(ee,null,2);else re=JSON.stringify(ee);let te=re.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029");t=t.substring(0,l)+te+t.substring(v+1),i.lastIndex=l+te.length}catch(Q){B.log(Q instanceof Error?Q:Error(String(Q)),{directive:"@json"},"error"),i.lastIndex=l+N.length}}return t}function zs(e){return e.replace(/@once\s*([\s\S]*?)@endonce/g,"$1")}function Bc(e){let n=e,t=/@memo\s*\(/g,i,a=[];while((i=t.exec(n))!==null){let l=i.index,c=l+i[0].length,y=1,v=c;while(v<n.length&&y>0){if(n[v]==="(")y++;else if(n[v]===")")y--;v++}if(y!==0)continue;let E=n.slice(c,v-1).trim(),R=v,D=n.slice(R),N=D.indexOf("@endmemo");if(N===-1)continue;let j=D.slice(0,N),P=R+N+8,M=j.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)/),X=M?M[0].length:0,F=j.slice(X),L=j.match(/(\s*)$/),Q=L?L[0].length:0,ee=F.slice(0,F.length-Q),re=ee.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)?(\/?)>/),te;if(re){let[le,Ee,we="",Re]=re,Ce=`<${Ee}${we} data-stx-memo="${E}"${Re}>`;te=j.slice(0,X)+Ce+ee.slice(le.length)+j.slice(X+ee.length)}else te=`${j.slice(0,X)}<div data-stx-memo="${E}">${ee}</div>${j.slice(X+ee.length)}`;a.push({start:l,end:P,replacement:te}),t.lastIndex=P}for(let l=a.length-1;l>=0;l--){let c=a[l];n=n.slice(0,c.start)+c.replacement+n.slice(c.end)}return n.replace(/@memo="([^"]*)"/g,'data-stx-memo="$1"')}function pi(e){let n=e.replace(/@ref="([^"]+)"/g,'data-stx-ref="$1"');return n=n.replace(/(<[a-zA-Z][a-zA-Z0-9-]*\b[^>]*?)\sref="([^"]+)"/g,'$1 data-stx-ref="$2"'),n}function Ui(e,n){if(!/\bref\s*=/.test(e))return e;let t=/<\/?([a-zA-Z][\w-]*)\b(?:"[^"]*"|'[^']*'|[^'">])*>/y,i=S(e,(v,E)=>{t.lastIndex=E;let R=t.exec(v);if(!R||/^(?:script|style)$/i.test(R[1]))return-1;return t.lastIndex}),a=[],l=0,c=0,y=[];for(let{start:v,end:E,token:R}of i){let D=/^<\/?([\w-]+)/.exec(R)[1].toLowerCase();if(R.startsWith("</")){let M;while(M=a.pop()){if(M.scoped)l--;if(M.name===D)break}continue}let N=/\sdata-stx-scope\s*=/.test(R),j=/\sdata-stx-ref-caller\s*=\s*(["'])(.*?)\1/.exec(R),P=a.find((M)=>M.scoped)?.scopeId;if(j&&P&&j[2]===P)y.push(e.slice(c,v),R.replace(j[0],` data-stx-ref-caller="${n}"`)),c=E;else if(!l&&!N&&/\s(?:ref|@ref|:ref|x-ref|data-stx-ref)\s*=/.test(R)&&!/\sdata-stx-ref-caller\s*=/.test(R))y.push(e.slice(c,v),R.replace(/\s*\/?>$/,(M)=>` data-stx-ref-caller="${n}"${M}`)),c=E;if(!Hi.has(D)&&!/\/>$/.test(R)){let M=/\sdata-stx-scope\s*=\s*(?:"([^"]*)"|'([^']*)')/.exec(R);if(a.push({name:D,scoped:N,scopeId:M?.[1]??M?.[2]}),N)l++}}return y.push(e.slice(c)),y.join("")}var Hi=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),Ki=/(?:^|\s)x-no-cloak(?:=|\s|\/|>|$)/,Wi=/<\/?\s*([a-z][\w-]*)/iy,xc=/\s/;function bc(e,n){let t=n-1;while(t>=0&&xc.test(e[t]))t--;return t>=0&&e[t]==="/"}function yc(e,n){let t=!1,i=!1;for(let a=n;a<e.length;a++){let l=e[a];if(t){if(l==="'")t=!1}else if(i){if(l==='"')i=!1}else if(l==="'")t=!0;else if(l==='"')i=!0;else if(l===">")return a}return-1}function _c(e,n){if(e.indexOf("{",n)===-1||e.indexOf("}",n)===-1)return!1;let t=0,i=n,a=!1,l=!1,c=!1;while(i<e.length){let y=e.indexOf("<",i),v=y===-1?e.length:y;if(v>i){if(t===0)while(i<v){let D=e.indexOf(l?"}":"{",i);if(D===-1||D>=v){if(l)c=!1;else a=!1;break}if(D>i)if(l)c=!1;else a=!1;if(l){if(c)return!0;c=!0}else if(a)l=!0,c=!1;else a=!0;i=D+1}i=v;continue}if(e.startsWith("<!--",i)){let D=e.indexOf("-->",i);i=D===-1?e.length:D+3;continue}let E=yc(e,i);if(E===-1)break;Wi.lastIndex=i;let R=Wi.exec(e)?.[1]?.toLowerCase()??"";if(e[i+1]==="/"){if(t===0)break;t--}else if(!bc(e,E)&&!Hi.has(R))t++;i=E+1}return!1}var Fi=b(256);function Fc(e){if(e.length<1024)return Vi(e);let n=x(e),t=Fi.get(n);if(t!==void 0)return t;let i=Vi(e);return Fi.set(n,i),i}function Vi(e){if(e.length>=32768&&!Jr(e))return e;let t=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,l;while((l=t.exec(e))!==null){let c=l.index,y=c+l[0].length,v=!1,E=!1,R=-1;while(y<e.length){let N=e[y];if(v){if(N==="'")v=!1}else if(E){if(N==='"')E=!1}else if(N==="'")v=!0;else if(N==='"')E=!0;else if(N===">"){R=y;break}y++}if(R===-1)continue;let D=e.slice(c,R+1);if(Ki.test(D))continue;if(D.includes("x-cloak"))continue;if(_c(e,R+1))i+=e.slice(a,R)+" x-cloak>",a=R+1}return i+=e.slice(a),i}var wc=/(?:^|\s)(?::else-if|:if|:else|:show|x-else-if|x-if|x-else|x-show|@if|@show)(?:=|\s|\/|>|$)/,Sc=/<\/script>/gi,vc=/<\/style>/gi;function zc(e){let n=/<[a-z][\w-]*/gi,t="",i=0,a;while((a=n.exec(e))!==null){let l=a.index,c=a[0].slice(1).toLowerCase();if(c==="script"||c==="style"){let P=c==="script"?Sc:vc;P.lastIndex=l;let M=P.exec(e);if(M!==null)n.lastIndex=M.index+M[0].length;continue}let y=l+a[0].length,v=!1,E=!1,R=-1;while(y<e.length){let P=e[y];if(v){if(P==="'")v=!1}else if(E){if(P==='"')E=!1}else if(P==="'")v=!0;else if(P==='"')E=!0;else if(P===">"){R=y;break}y++}if(R===-1)continue;let D=e.slice(l+a[0].length,R);if(Ki.test(D))continue;if(/(?:^|\s)x-cloak(?:=|\s|\/|>|$)/.test(D))continue;if(!wc.test(D))continue;let N=e[R-1]==="/",j=N?R-1:R;t+=`${e.slice(i,j)} x-cloak${N?" ":""}`,i=j}return t+=e.slice(i),t}import oo from"path";import Cs from"fs";import en from"path";function Zi(e,n,t,i){let a=0;for(let l=n;l<e.length;l++)if(e[l]===t)a++;else if(e[l]===i&&!(i===">"&&e[l-1]==="=")){if(--a===0)return l}return-1}function Ec(e){let n=r(e),t=0,i=0,a=[];for(let l=0;l<n.length;l++)if("([{".includes(n[l]))t++;else if(")]}".includes(n[l]))t--;else if(n[l]===","&&t===0)a.push(e.slice(i,l).trim()),i=l+1;return a.push(e.slice(i).trim()),a}function Rs(e,n){let t=r(e),i=new RegExp(`\\b(?:${n.map((a)=>a.replace(/[$]/g,"\\$&")).join("|")})\\s*(?=[<(])`,"g");for(let a of t.matchAll(i)){let l=a.index+a[0].length,c="";if(t[l]==="<"){let v=Zi(t,l,"<",">");if(v<0)continue;c=e.slice(l+1,v),l=v+1;while(/\s/.test(t[l]||"")&&l<t.length)l++}if(t[l]!=="(")continue;let y=Zi(t,l,"(",")");if(y>=0)return{type:c,args:Ec(e.slice(l+1,y))}}return null}var qi=`
236
236
  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;
237
237
  type __StxWiden<T> = T extends string ? string : T extends number ? number : T extends boolean ? boolean : T;
238
238
  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>;
@@ -240,83 +240,91 @@ type __StxRequired<O> = { [K in keyof O]-?: O[K] extends { required: true } ? K
240
240
  type __StxDefaulted<O> = { [K in keyof O]-?: O[K] extends { default: unknown } ? K : never }[keyof O];
241
241
  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]> };
242
242
  type __StxDefaults<P, K> = Omit<P, Extract<keyof P, K>> & Partial<Pick<P, Extract<keyof P, K>>>;
243
- `;function qi(e,n){let t=[],i={defineProps:["defineProps"],defineEmits:["defineEmits"],withDefaults:["withDefaults"]},a=s(e),l=e.replace(/\bimport\s+(?:type\s+)?(\{[^}]*\}|\*\s+as\s+[\w$]+|[\w$]+)\s+from\s*(['"])([^'"]+)\2\s*;?/g,(N,j,P,D,X)=>{if(a.slice(X,X+6)!=="import")return N;if(D.endsWith(".stx"))return"";let F=`${n}Import${t.length}`;if(t.push(`import * as ${F} from ${JSON.stringify(D)};`),j.startsWith("*"))return`import ${j.replace(/^\*\s+as\s+/,"")} = ${F};`;if(!j.startsWith("{"))return`import ${j} = ${F}.default;`;return j.slice(1,-1).split(",").map((L)=>{let[Q,te=Q]=L.trim().replace(/^type\s+/,"").split(/\s+as\s+/);if(!Q)return"";if(/^(?:stx|@stacksjs\/stx)(?:\/|$)/.test(D)&&Q in i)i[Q].push(te);return`import ${te} = ${F}.${Q};`}).join(`
244
- `)}),c=Rs(e,i.defineProps),y=Rs(e,i.defineEmits),v=Rs(e,i.withDefaults);if(!c&&!y)return{declarations:"",props:null,events:null};let E=[],R=null,M=null;if(c){E.push(`const __options = (${c.args[0]||"{}"}) as const;`),E.push(`const __defaults = (${v?.args[1]||"{}"});`);let N=c.type||"__StxOptions<typeof __options>";E.push(`export type __StxProps = __StxDefaults<${N}, keyof typeof __defaults | __StxDefaulted<typeof __options>>;`),R=`${n}.__StxProps`}if(y)E.push(`const __events = (${y.args[0]||"[]"}) as const;`),E.push(`export type __StxEvents = ${y.type||"Record<(typeof __events)[number], any[]>"};`),M=`${n}.__StxEvents`;return{declarations:`${t.join(`
243
+ `;function Xi(e,n){let t=[],i={defineProps:["defineProps"],defineEmits:["defineEmits"],withDefaults:["withDefaults"]},a=r(e),l=e.replace(/\bimport\s+(?:type\s+)?(\{[^}]*\}|\*\s+as\s+[\w$]+|[\w$]+)\s+from\s*(['"])([^'"]+)\2\s*;?/g,(N,j,P,M,X)=>{if(a.slice(X,X+6)!=="import")return N;if(M.endsWith(".stx"))return"";let F=`${n}Import${t.length}`;if(t.push(`import * as ${F} from ${JSON.stringify(M)};`),j.startsWith("*"))return`import ${j.replace(/^\*\s+as\s+/,"")} = ${F};`;if(!j.startsWith("{"))return`import ${j} = ${F}.default;`;return j.slice(1,-1).split(",").map((L)=>{let[Q,ee=Q]=L.trim().replace(/^type\s+/,"").split(/\s+as\s+/);if(!Q)return"";if(/^(?:stx|@stacksjs\/stx)(?:\/|$)/.test(M)&&Q in i)i[Q].push(ee);return`import ${ee} = ${F}.${Q};`}).join(`
244
+ `)}),c=Rs(e,i.defineProps),y=Rs(e,i.defineEmits),v=Rs(e,i.withDefaults);if(!c&&!y)return{declarations:"",props:null,events:null};let E=[],R=null,D=null;if(c){E.push(`const __options = (${c.args[0]||"{}"}) as const;`),E.push(`const __defaults = (${v?.args[1]||"{}"});`);let N=c.type||"__StxOptions<typeof __options>";E.push(`export type __StxProps = __StxDefaults<${N}, keyof typeof __defaults | __StxDefaulted<typeof __options>>;`),R=`${n}.__StxProps`}if(y)E.push(`const __events = (${y.args[0]||"[]"}) as const;`),E.push(`export type __StxEvents = ${y.type||"Record<(typeof __events)[number], any[]>"};`),D=`${n}.__StxEvents`;return{declarations:`${t.join(`
245
245
  `)}
246
246
  namespace ${n} {
247
247
  ${l}
248
248
  ${E.join(`
249
249
  `)}
250
- }`,props:R,events:M}}var Sr=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 kr(e){if(e.includes("-")||e==="component")return!1;if(/^[A-Z]/.test(e))return!/[a-z]/.test(e)&&[...Sr].some((n)=>n.toLowerCase()===e.toLowerCase());return Sr.has(e)||/[A-Z]/.test(e)}function*wc(e){let n=/<([A-Za-z][\w.-]*)(?=[\s/>])/g,t;while(t=n.exec(e)){let i=n.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 l=/^[^\s=/>]+/.exec(e.slice(i))?.[0];if(!l){i++;continue}let c=i;i+=l.length;while(/\s/.test(e[i]||""))i++;if(e[i]!=="="){a.push({name:l,value:!0,offset:c,braced:!1});continue}i++;while(/\s/.test(e[i]||""))i++;let y=e[i],v=y==="{",E=y==='"'||y==="'";if(E||v)i++;let R=i;if(v){let M=s(e.slice(i)),N=1,j=0;for(;j<M.length;j++){if(M[j]==="{")N++;if(M[j]==="}"&&--N===0)break}i+=j}else if(E)while(i<e.length&&e[i]!==y)i++;else while(i<e.length&&!/[\s/>]/.test(e[i]))i++;if(a.push({name:l,value:e.slice(R,i),offset:R,braced:v}),E||v)i++}n.lastIndex=i,yield{name:t[1],offset:t.index,attributes:a}}}function Xi(e,n,t){let i=[],a=[Zi,"type __StxAssignedValue<T> = T extends { readonly _isSignal: true } | { readonly _isDerived: true } ? T extends () => infer V ? V : T : T;","type __StxProp<P, K> = K extends keyof P ? P[K] : unknown;",'type __StxStaticProp<P, K> = __StxProp<P, K> extends infer T ? boolean extends T ? T | "true" | "false" : T : never;','type __StxEvent<E, K> = K extends keyof E ? E[K] extends readonly unknown[] ? number extends E[K]["length"] ? E[K][0] : Exclude<E[K]["length"], 0 | 1> extends never ? E[K][0] : E[K] : E[K] : any;'],l=new Map,c=new Map,y=new Map,v=t.scriptCode(e,t.filePath),E=s(v);for(let P of v.matchAll(/\bimport\s+(\{[^}]+\}|[\w$]+)\s+from\s*['"]([^'"]+)['"]/g)){if(E.slice(P.index,P.index+6)!=="import")continue;let D=P[2],X=en.isAbsolute(D)||D.startsWith(".")?en.resolve(en.dirname(t.filePath),D):Is(D,en.dirname(t.filePath));if(!X)continue;let F=X.endsWith(".stx")?X:Cs.existsSync(`${X}.stx`)?`${X}.stx`:void 0,L=F?null:yr(X,!1),Q=P[1].startsWith("{")?P[1].slice(1,-1).split(","):[P[1]];for(let te of Q){let[ae,se=ae]=te.trim().split(/\s+as\s+/),ue=F||L?.get(ae)||L?.get(ae.toLowerCase());if(ue)y.set(se,ue),y.set(se.toLowerCase(),ue),y.set(se.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),ue)}}for(let P of n.matchAll(/@import\s*\(([^)]+)\)/g))for(let D of P[1].matchAll(/['"]([^'"]+)['"]/g)){let X=Os(D[1],t.filePath,t).find((F)=>Cs.statSync(F,{throwIfNoEntry:!1})?.isFile());if(X)y.set(en.basename(D[1]).replace(/\.stx$/,""),X)}let R={__importedComponents:y},M=new Map,N=(P,D,X)=>{let F=e.slice(0,P);return{code:D,offset:P,attribute:X,anchor:!0,kind:"directive",line:F.split(`
250
+ }`,props:R,events:D}}var Sr=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 kr(e){if(e.includes("-")||e==="component")return!1;if(/^[A-Z]/.test(e))return!/[a-z]/.test(e)&&[...Sr].some((n)=>n.toLowerCase()===e.toLowerCase());return Sr.has(e)||/[A-Z]/.test(e)}function*kc(e){let n=/<([A-Za-z][\w.-]*)(?=[\s/>])/g,t;while(t=n.exec(e)){let i=n.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 l=/^[^\s=/>]+/.exec(e.slice(i))?.[0];if(!l){i++;continue}let c=i;i+=l.length;while(/\s/.test(e[i]||""))i++;if(e[i]!=="="){a.push({name:l,value:!0,offset:c,braced:!1});continue}i++;while(/\s/.test(e[i]||""))i++;let y=e[i],v=y==="{",E=y==='"'||y==="'";if(E||v)i++;let R=i;if(v){let D=r(e.slice(i)),N=1,j=0;for(;j<D.length;j++){if(D[j]==="{")N++;if(D[j]==="}"&&--N===0)break}i+=j}else if(E)while(i<e.length&&e[i]!==y)i++;else while(i<e.length&&!/[\s/>]/.test(e[i]))i++;if(a.push({name:l,value:e.slice(R,i),offset:R,braced:v}),E||v)i++}n.lastIndex=i,yield{name:t[1],offset:t.index,attributes:a}}}function Ji(e,n,t){let i=[],a=[qi,"type __StxAssignedValue<T> = T extends { readonly _isSignal: true } | { readonly _isDerived: true } ? T extends () => infer V ? V : T : T;","type __StxProp<P, K> = K extends keyof P ? P[K] : unknown;",'type __StxStaticProp<P, K> = __StxProp<P, K> extends infer T ? boolean extends T ? T | "true" | "false" : T : never;','type __StxEvent<E, K> = K extends keyof E ? E[K] extends readonly unknown[] ? number extends E[K]["length"] ? E[K][0] : Exclude<E[K]["length"], 0 | 1> extends never ? E[K][0] : E[K] : E[K] : any;'],l=new Map,c=new Map,y=new Map,v=t.scriptCode(e,t.filePath),E=r(v);for(let P of v.matchAll(/\bimport\s+(\{[^}]+\}|[\w$]+)\s+from\s*['"]([^'"]+)['"]/g)){if(E.slice(P.index,P.index+6)!=="import")continue;let M=P[2],X=en.isAbsolute(M)||M.startsWith(".")?en.resolve(en.dirname(t.filePath),M):Os(M,en.dirname(t.filePath));if(!X)continue;let F=X.endsWith(".stx")?X:Cs.existsSync(`${X}.stx`)?`${X}.stx`:void 0,L=F?null:yr(X,!1),Q=P[1].startsWith("{")?P[1].slice(1,-1).split(","):[P[1]];for(let ee of Q){let[re,te=re]=ee.trim().split(/\s+as\s+/),le=F||L?.get(re)||L?.get(re.toLowerCase());if(le)y.set(te,le),y.set(te.toLowerCase(),le),y.set(te.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),le)}}for(let P of n.matchAll(/@import\s*\(([^)]+)\)/g))for(let M of P[1].matchAll(/['"]([^'"]+)['"]/g)){let X=Ns(M[1],t.filePath,t).find((F)=>Cs.statSync(F,{throwIfNoEntry:!1})?.isFile());if(X)y.set(en.basename(M[1]).replace(/\.stx$/,""),X)}let R={__importedComponents:y},D=new Map,N=(P,M,X)=>{let F=e.slice(0,P);return{code:M,offset:P,attribute:X,anchor:!0,kind:"directive",line:F.split(`
251
251
  `).length,column:P-F.lastIndexOf(`
252
- `)}},j=(P,D,X)=>i.push({expression:P,statement:{text:D+P.code+X,prefixLength:D.length}});for(let P of wc(n)){if(kr(P.name)||P.name==="component")continue;let D=hr(P.name,t.filePath,t,R);if(!D)continue;let X=M.get(D);if(!X){let L;try{L=t.readComponent?t.readComponent(D):Cs.readFileSync(D,"utf8")}catch{continue}if(L===void 0)continue;c.set(D,L),X=qi(t.scriptCode(L,D),`__StxComponent${M.size}`),M.set(D,X),a.push(X.declarations)}let F=[];for(let L of P.attributes){let{name:Q,offset:te}=L,ae=L.value===!0?"true":L.value;if(Q.startsWith("@")||Q.startsWith("v-on:")){if(X.events&&L.value!==!0)l.set(te,`__StxEvent<${X.events}, ${JSON.stringify(Q.replace(/^@|^v-on:/,"").split(".")[0])}>`);continue}let se=/^v-model(?::([\w-]+))?(?:\.[\w-]+)*$/.exec(Q);if(Q.startsWith("v-")&&!Q.startsWith("v-bind:")&&!se)continue;if(/^(?:x-|:)(?:if|for|show|key|else)(?:$|[.:-])/.test(Q))continue;let ue=(se?se[1]||"modelValue":Q.replace(/^:|^v-bind:/,"")).replace(/-([a-z])/g,(ke,Je)=>Je.toUpperCase());if(F.push(ue),!X.props)continue;let Ee=Q.startsWith(":")||Q.startsWith("v-bind:")||!!se||L.braced,Te=Ee?ae:L.value!==!0?JSON.stringify(ae):"true",Ae=!Ee&&L.value!==!0&&(ae==="true"||ae==="false");j(N(te,Te,Q),";void ((",`) satisfies ${Ae?"__StxStaticProp":"__StxProp"}<${X.props}, ${JSON.stringify(ue)}>);`)}if(X.props){let L=[...new Set(F)].map((te)=>`${JSON.stringify(te)}: undefined as any`).join(", "),Q=N(P.offset,`<${P.name}>`);i.push({expression:Q,statement:{text:`;void ({ ${L} } satisfies ${X.props} & Record<string, unknown>);`,prefixLength:0}})}}return{declarations:M.size?a.join(`
253
- `):"",checks:i,events:l,dependencies:c}}var Ji=/<script(\s[^>]*)?>([\s\S]*?)<\/script>/gi;function Sc(e){let n=(t)=>t.replace(/[^\n]/g," ");return e.replace(/<!--[\s\S]*?-->/g,n).replace(/\{\{--[\s\S]*?--\}\}/g,n)}function It(e){let n=[],t=Sc(e);Ji.lastIndex=0;let i;while((i=Ji.exec(t))!==null){let a=(i[1]||"").trim(),l=(i[0].match(/^<script(?:\s[^>]*)?>/i)?.[0]??"<script>").length,c=(i[0].match(/<\/script\s*>$/i)?.[0]??"</script>").length,y=i.index+l,v=i.index+i[0].length-c,E=e.slice(y,v);if(/\bsrc\s*=/.test(a))continue;let R=a.match(/\btype\s*=\s*["']([^"']+)["']/i);if(R&&!/^(?:module|text\/(?:javascript|typescript))$/i.test(R[1]))continue;let M=/\bserver\b/.test(a)?"server":/\bclient\b/.test(a)?"client":"plain",N=tn(e,y);n.push({kind:M,code:E,startLine:N,startColumn:nn(e,y),offset:y,attrs:a})}return n}function tn(e,n){let t=1;for(let i=0;i<n&&i<e.length;i++)if(e.charCodeAt(i)===10)t++;return t}function nn(e,n){let t=e.lastIndexOf(`
252
+ `)}},j=(P,M,X)=>i.push({expression:P,statement:{text:M+P.code+X,prefixLength:M.length}});for(let P of kc(n)){if(kr(P.name)||P.name==="component")continue;let M=hr(P.name,t.filePath,t,R);if(!M)continue;let X=D.get(M);if(!X){let L;try{L=t.readComponent?t.readComponent(M):Cs.readFileSync(M,"utf8")}catch{continue}if(L===void 0)continue;c.set(M,L),X=Xi(t.scriptCode(L,M),`__StxComponent${D.size}`),D.set(M,X),a.push(X.declarations)}let F=[];for(let L of P.attributes){let{name:Q,offset:ee}=L,re=L.value===!0?"true":L.value;if(Q.startsWith("@")||Q.startsWith("v-on:")){if(X.events&&L.value!==!0)l.set(ee,`__StxEvent<${X.events}, ${JSON.stringify(Q.replace(/^@|^v-on:/,"").split(".")[0])}>`);continue}let te=/^v-model(?::([\w-]+))?(?:\.[\w-]+)*$/.exec(Q);if(Q.startsWith("v-")&&!Q.startsWith("v-bind:")&&!te)continue;if(/^(?:x-|:)(?:if|for|show|key|else)(?:$|[.:-])/.test(Q))continue;let le=(te?te[1]||"modelValue":Q.replace(/^:|^v-bind:/,"")).replace(/-([a-z])/g,(Ce,Ke)=>Ke.toUpperCase());if(F.push(le),!X.props)continue;let Ee=Q.startsWith(":")||Q.startsWith("v-bind:")||!!te||L.braced,we=Ee?re:L.value!==!0?JSON.stringify(re):"true",Re=!Ee&&L.value!==!0&&(re==="true"||re==="false");j(N(ee,we,Q),";void ((",`) satisfies ${Re?"__StxStaticProp":"__StxProp"}<${X.props}, ${JSON.stringify(le)}>);`)}if(X.props){let L=[...new Set(F)].map((ee)=>`${JSON.stringify(ee)}: undefined as any`).join(", "),Q=N(P.offset,`<${P.name}>`);i.push({expression:Q,statement:{text:`;void ({ ${L} } satisfies ${X.props} & Record<string, unknown>);`,prefixLength:0}})}}return{declarations:D.size?a.join(`
253
+ `):"",checks:i,events:l,dependencies:c}}var Gi=/<script(\s[^>]*)?>([\s\S]*?)<\/script>/gi;function Cc(e){let n=(t)=>t.replace(/[^\n]/g," ");return e.replace(/<!--[\s\S]*?-->/g,n).replace(/\{\{--[\s\S]*?--\}\}/g,n)}function It(e){let n=[],t=Cc(e);Gi.lastIndex=0;let i;while((i=Gi.exec(t))!==null){let a=(i[1]||"").trim(),l=(i[0].match(/^<script(?:\s[^>]*)?>/i)?.[0]??"<script>").length,c=(i[0].match(/<\/script\s*>$/i)?.[0]??"</script>").length,y=i.index+l,v=i.index+i[0].length-c,E=e.slice(y,v);if(/\bsrc\s*=/.test(a))continue;let R=a.match(/\btype\s*=\s*["']([^"']+)["']/i);if(R&&!/^(?:module|text\/(?:javascript|typescript))$/i.test(R[1]))continue;let D=/\bserver\b/.test(a)?"server":/\bclient\b/.test(a)?"client":"plain",N=tn(e,y);n.push({kind:D,code:E,startLine:N,startColumn:nn(e,y),offset:y,attrs:a})}return n}function tn(e,n){let t=1;for(let i=0;i<n&&i<e.length;i++)if(e.charCodeAt(i)===10)t++;return t}function nn(e,n){let t=e.lastIndexOf(`
254
254
  `,n-1)+1;return n-t+1}function Un(e){let n=e.split(""),t=(a,l)=>{for(let c=a;c<l&&c<n.length;c++)if(n[c]!==`
255
- `)n[c]=" "},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 l;while((l=a.exec(e))!==null)t(l.index,l.index+l[0].length)}return n.join("")}function vc(e){let n=0,t="";for(let i=0;i<e.length;i++){let a=e[i];if(t){if(a==="\\"){i++;continue}if(a===t)t="";continue}if(a==='"'||a==="'"||a==="`"){t=a;continue}if(a==="("||a==="["||a==="{"){n++;continue}if(a===")"||a==="]"||a==="}"){n--;continue}if(a==="|"&&n===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"]),Hn=/(?:^|\s)((?::|x-|v-|@)[\w.:-]+)\s*=\s*(["'])([\s\S]*?)\2/g,Ts="__stx_interpolated",Gi="__StxElement",oo="__StxTemplateValue",kc=`type ${oo}<T> = T extends { readonly _isSignal: true } | { readonly _isDerived: true } ? (T extends () => infer V ? T & V : T) : T`;function Yi(e){return e.replace(/\{\{[\s\S]*?\}\}/g,Ts).replace(/\{!![\s\S]*?!!\}/g,Ts)}function ii(e){return e.replace(/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/g,(n)=>{let t=n.split(`
256
- `).length-1,i=n.length-t;return`0${" ".repeat(Math.max(0,i-1))}${`
257
- `.repeat(t)}`})}var Cc=["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"],Qc=new RegExp(String.raw`^[ \t]*@(?:${Cc.join("|")})\b[ \t]*(\([^\n)]*\))?[ \t]*$`,"gm");function ai(e){return e.replace(Qc,(n)=>n.replace(/[^\n]/g," "))}var Qi=new Set(["x-cloak","x-ref","x-transition","x-teleport","v-slot","x-hydrate",":key","x-tooltip","x-tooltip-position"]);function Gf(e){let n=Un(e),t=[],i=/(@?)\{\{([\s\S]*?)\}\}|(@?)\{!!([\s\S]*?)!!\}/g,a;while((a=i.exec(n))!==null){if(a[1]||a[3])continue;let y=a[2]??a[4]??"",v=a[2]!==void 0?2:3,E=vc(y);if(!E.trim())continue;let R=a.index+v+(E.length-E.trimStart().length);t.push({code:E.trim(),line:tn(n,R),column:nn(n,R),offset:R,kind:"interpolation"})}let l=/@(if|elseif|else\s+if|unless)\b\s*\(/g;while((a=l.exec(n))!==null){let c=a.index+a[0].length-1,y=0,v=c;for(;v<n.length;v++){let N=n[v];if(N==="(")y++;else if(N===")"){if(y--,y===0)break}}if(y!==0)continue;let E=n.slice(c+1,v),R=E.trim();if(l.lastIndex=v+1,!R)continue;let M=c+1+(E.length-E.trimStart().length);t.push({code:R,line:tn(n,M),column:nn(n,M),offset:a.index,kind:"condition"})}Hn.lastIndex=0;while((a=Hn.exec(n))!==null){let c=a[1],y=a[3]??"",v=c.replace(/\..*$/,"").replace(/^([^:].*?):.*$/,"$1");if(Qi.has(v)||Qi.has(c))continue;if(!y.trim())continue;let E=a.index+a[0].indexOf(a[2],a[0].indexOf(c)+c.length)+1;if(io.has(v)){let M=y.match(/\s+(?:in|of)\s+/);if(!M||M.index===void 0)continue;let N=y.slice(M.index+M[0].length),j=M.index+M[0].length+(N.length-N.trimStart().length);t.push({code:Yi(N.trim()),line:tn(n,E+j),column:nn(n,E+j),offset:E+j,kind:"directive",attribute:v});continue}let R=y.length-y.trimStart().length;t.push({code:Yi(y.trim()),line:tn(n,E+R),column:nn(n,E+R),offset:E+R,kind:"directive",attribute:v})}return t.sort((c,y)=>c.line-y.line||c.column-y.column),t}var el=2000;function tl(e,n){let t=0,i=Math.min(e.length,n+el);for(let a=n;a<i;a++){let l=e[a];if(l==="(")t++;else if(l===")"){if(t--,t===0)return e.slice(n+1,a)}}return null}function nl(e){let n=new Map,t=(y,v)=>{let E=y.split(/[,[\]{}()\s]+/).filter(Boolean);for(let R of E){let M=R.replace(/^\.\.\./,"").trim();if(!/^\$?[A-Z_$][\w$]*$/i.test(M))continue;let N=E.length===1?v:void 0,j=n.get(M);if(!j)n.set(M,{name:M,iterable:N});else if(j.iterable!==N)j.iterable=void 0}},i=/^\$?[A-Z_$][\w$]*$/i,a=(y)=>{let v=y.trim();return i.test(v)?v:void 0};for(let y of e.matchAll(/@for(?:each|else)\s*\(/g)){let v=tl(e,y.index+y[0].length-1);if(v===null)continue;let E=Pt(v);if(!E)continue;t(E.itemVar.replace(/=>/g," "),a(E.arrayExpr))}for(let y of e.matchAll(/@for\s*\(\s*(?:(?:let|const|var)\s+)?([\w$]+|\[[^\]]*\]|\{[^}]*\})\s+(of|in)\s+([^)]*)/g))t(y[1],y[2]==="of"?a(y[3]):void 0);for(let y of e.matchAll(/@for\s*\(\s*(?:let|const|var)\s+([\w$]+)\s*[=;]/g))t(y[1]);let l=Un(e);Hn.lastIndex=0;let c;while((c=Hn.exec(l))!==null){let y=c[1].replace(/\..*$/,"");if(!io.has(y))continue;let v=c[3].match(/\s+(?:in|of)\s+/);if(!v||v.index===void 0)continue;t(c[3].slice(0,v.index),a(c[3].slice(v.index+v[0].length)))}for(let y of e.matchAll(/@(?:php|js|ts)\b([\s\S]*?)@end(?:php|js|ts)\b/g))for(let v of y[1].matchAll(/\b(?:const|let|var|function|class)\s+([\w$]+)/g))t(v[1]);return[...n.values()].sort((y,v)=>y.name.localeCompare(v.name))}function Me(e){let n=new Set;for(let t of e.matchAll(/^\s*(?:export\s+)?(?:const|let|var)\s+([\w$]+)/gm))n.add(t[1]);for(let t of e.matchAll(/^\s*(?:export\s+)?(?:async\s+)?function\s*\*?\s*([\w$]+)/gm))n.add(t[1]);for(let t of e.matchAll(/^\s*(?:export\s+)?class\s+([\w$]+)/gm))n.add(t[1]);for(let t of e.matchAll(/^\s*(?:export\s+)?(?:const|let|var)\s*[[{]([^\]}]*)[\]}]/gm))for(let i of t[1].split(",")){let a=i.split(":").pop().split("=")[0].replace(/^\.\.\./,"").trim();if(/^[A-Z_$][\w$]*$/i.test(a))n.add(a)}return[...n].sort()}var Ws=["params","query","cookies","host","ip","setResponseStatus","setResponseHeader","notFound","request","url","definePageMeta","defineClientPayload","defineStore","props","$props"],sl={$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 Rc(e=new Set){return[...Ws.filter((n)=>!e.has(n)).map((n)=>`declare var ${n}: any`),...Object.entries(sl).filter(([n])=>!e.has(n)).map(([,n])=>n)].join(`
258
- `)}function Ac(e){return new Set([...e.matchAll(/^declare (?:function|const|let|var)\s+([A-Za-z_$][\w$]*)/gm)].map((n)=>n[1]))}function ao(e){let n=/\bdefineClientPayload\s*\(\s*\{([\s\S]*?)\}\s*\)/g,t,i=!1,a=new Set,l=s(e);while((t=n.exec(l))!==null){i=!0;for(let c of rl(t[1])){let y=c.split(":")[0].trim();if(/^[A-Za-z_$][\w$]*$/.test(y))a.add(y)}}return i?[...a]:null}function rl(e){let n=[],t=0,i="";for(let a of e){if(a===","&&t===0){n.push(i),i="";continue}if(a==="("||a==="["||a==="{")t++;else if(a===")"||a==="]"||a==="}")t--;i+=a}return n.push(i),n.filter((a)=>a.trim().length>0)}function il(e){let n=/^[ \t]*import\b[\s\S]*?(?:from\s*['"][^'"]*['"]|['"][^'"]*['"])[ \t]*;?[ \t]*$/gm,t=[],i=e.replace(n,(a)=>(t.push(a.trim()),a.split(`
255
+ `)n[c]=" "},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 l;while((l=a.exec(e))!==null)t(l.index,l.index+l[0].length)}return n.join("")}function ao(e){let n=0,t="";for(let i=0;i<e.length;i++){let a=e[i];if(t){if(a==="\\"){i++;continue}if(a===t)t="";continue}if(a==='"'||a==="'"||a==="`"){t=a;continue}if(a==="("||a==="["||a==="{"){n++;continue}if(a===")"||a==="]"||a==="}"){n--;continue}if(a==="|"&&n===0){if(e[i+1]==="|"){i++;continue}if(e[i-1]==="|")continue;return e.slice(0,i)}}return e}var co=new Set([":for","x-for","v-for"]),Hn=/(?:^|\s)((?::|x-|v-|@)[\w.:-]+)\s*=\s*(["'])([\s\S]*?)\2/g,Ts="__stx_interpolated",Yi="__StxElement",lo="__StxTemplateValue",Tc=`type ${lo}<T> = T extends { readonly _isSignal: true } | { readonly _isDerived: true } ? (T extends () => infer V ? T & V : T) : T`;function Qi(e){return e.replace(/\{\{[\s\S]*?\}\}/g,Ts).replace(/\{!![\s\S]*?!!\}/g,Ts)}function ai(e,n,t="0"){let i=`__stxScript${t}`;while((e+n).includes(i))i+="_";let a=new Map,l=[],c=[],y=r(e),v=bl(e),E=[],R=0;for(let X of y.matchAll(/\{\{([\s\S]*?)\}\}|\{!!([\s\S]*?)!!\}/g)){let F=X.index,L=e.slice(F,F+X[0].length),Q=X[1]!==void 0,ee=L.slice(Q?2:3,Q?-2:-3),re=c.length,te=io(v,F),le=io(v,F+(Q?2:3));c.push({code:ao(ee),...le});let Ee=`${i}_${re}`,we=L.split(`
256
+ `),Re=we[0].length;we[0]=Ee+" ".repeat(Math.max(0,Re-Ee.length));for(let Ze=1;Ze<we.length;Ze++)we[Ze]=we[Ze].replace(/[^\r]/g," ");let Ce=a.get(te.line)??[],Ke=Ce.at(-1),Je=te.column+(Ke?Ke.generatedEnd-Ke.sourceEnd:0);Ce.push({sourceStart:te.column,sourceEnd:te.column+Re,generatedStart:Je,generatedEnd:Je+we[0].length}),a.set(te.line,Ce),E.push(e.slice(R,F),we.join(`
257
+ `)),R=F+L.length}E.push(e.slice(R));let D=E.join("");if(!c.length)return{code:D,columns:a,declarations:l};let{imports:N,body:j}=fo(n),P=[],M=0;for(let X of N.split(/\n(?=import\b)/)){if(!X.trim())continue;let F=/^import\s+(?:type\s+)?([\s\S]+?)\s+from\s*(['"][^'"]+['"])/.exec(X);if(!F){l.push({text:X});continue}let L=`${i}Module${M++}`;l.push({text:`import * as ${L} from ${F[2]}`});let Q=F[1],ee=/\{([\s\S]*?)\}/.exec(Q);for(let Ee of ee?.[1].split(",")??[]){let[we,Re=we]=Ee.trim().replace(/^type\s+/,"").split(/\s+as\s+/);if(we==="default")P.push(`const ${Re} = ${L}.default; type ${Re} = import(${F[2]}).default`);else if(we)P.push(`import ${Re} = ${L}.${we}`)}let re=Q.replace(/\{[\s\S]*?\}/,""),te=/\*\s+as\s+(\w+)/.exec(re);if(te)P.push(`import ${te[1]} = ${L}`);let le=/^\s*([\w$]+)/.exec(re)?.[1];if(le)P.push(`const ${le} = ${L}.default; type ${le} = import(${F[2]}).default`)}l.push({text:`namespace ${i}Scope {
258
+ ${P.join(`
259
+ `)}
260
+ export async function read() {
261
+ ${Ls(j).replace(/^[ \t]*export[ \t]+(?=(?:const|let|var|function|async|class|interface|type)\b)/gm,"")}
262
+ return {`});for(let[X,F]of c.entries())l.push({text:`value${X}: (`}),l.push({text:F.code,origin:{line:F.line,column:F.column}}),l.push({text:"),"});l.push({text:`}
263
+ }
264
+ }`});for(let X=0;X<c.length;X++)l.push({text:`declare var ${i}_${X}: Awaited<ReturnType<typeof ${i}Scope.read>>['value${X}']`});return{code:D,columns:a,declarations:l}}function el(e,n){let t=0;for(let i of e){if(n<i.generatedStart)break;if(n<i.generatedEnd)return i.sourceStart+Math.min(n-i.generatedStart,i.sourceEnd-i.sourceStart);t=i.sourceEnd-i.generatedEnd}return n+t}var tl=["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"],nl=new RegExp(String.raw`^[ \t]*@(?:${tl.join("|")})\b[ \t]*(\([^\n)]*\))?[ \t]*$`,"gm");function Ls(e){return e.replace(nl,(n)=>n.replace(/[^\n]/g," "))}var eo=new Set(["x-cloak","x-ref","x-transition","x-teleport","v-slot","x-hydrate",":key","x-tooltip","x-tooltip-position"]);function Gf(e){let n=Un(e),t=[],i=/(@?)\{\{([\s\S]*?)\}\}|(@?)\{!!([\s\S]*?)!!\}/g,a;while((a=i.exec(n))!==null){if(a[1]||a[3])continue;let y=a[2]??a[4]??"",v=a[2]!==void 0?2:3,E=ao(y);if(!E.trim())continue;let R=a.index+v+(E.length-E.trimStart().length);t.push({code:E.trim(),line:tn(n,R),column:nn(n,R),offset:R,kind:"interpolation"})}let l=/@(if|elseif|else\s+if|unless)\b\s*\(/g;while((a=l.exec(n))!==null){let c=a.index+a[0].length-1,y=0,v=c;for(;v<n.length;v++){let N=n[v];if(N==="(")y++;else if(N===")"){if(y--,y===0)break}}if(y!==0)continue;let E=n.slice(c+1,v),R=E.trim();if(l.lastIndex=v+1,!R)continue;let D=c+1+(E.length-E.trimStart().length);t.push({code:R,line:tn(n,D),column:nn(n,D),offset:a.index,kind:"condition"})}Hn.lastIndex=0;while((a=Hn.exec(n))!==null){let c=a[1],y=a[3]??"",v=c.replace(/\..*$/,"").replace(/^([^:].*?):.*$/,"$1");if(eo.has(v)||eo.has(c))continue;if(!y.trim())continue;let E=a.index+a[0].indexOf(a[2],a[0].indexOf(c)+c.length)+1;if(co.has(v)){let D=y.match(/\s+(?:in|of)\s+/);if(!D||D.index===void 0)continue;let N=y.slice(D.index+D[0].length),j=D.index+D[0].length+(N.length-N.trimStart().length);t.push({code:Qi(N.trim()),line:tn(n,E+j),column:nn(n,E+j),offset:E+j,kind:"directive",attribute:v});continue}let R=y.length-y.trimStart().length;t.push({code:Qi(y.trim()),line:tn(n,E+R),column:nn(n,E+R),offset:E+R,kind:"directive",attribute:v})}return t.sort((c,y)=>c.line-y.line||c.column-y.column),t}var sl=2000;function rl(e,n){let t=0,i=Math.min(e.length,n+sl);for(let a=n;a<i;a++){let l=e[a];if(l==="(")t++;else if(l===")"){if(t--,t===0)return e.slice(n+1,a)}}return null}function il(e){let n=new Map,t=(y,v)=>{let E=y.split(/[,[\]{}()\s]+/).filter(Boolean);for(let R of E){let D=R.replace(/^\.\.\./,"").trim();if(!/^\$?[A-Z_$][\w$]*$/i.test(D))continue;let N=E.length===1?v:void 0,j=n.get(D);if(!j)n.set(D,{name:D,iterable:N});else if(j.iterable!==N)j.iterable=void 0}},i=/^\$?[A-Z_$][\w$]*$/i,a=(y)=>{let v=y.trim();return i.test(v)?v:void 0};for(let y of e.matchAll(/@for(?:each|else)\s*\(/g)){let v=rl(e,y.index+y[0].length-1);if(v===null)continue;let E=Pt(v);if(!E)continue;t(E.itemVar.replace(/=>/g," "),a(E.arrayExpr))}for(let y of e.matchAll(/@for\s*\(\s*(?:(?:let|const|var)\s+)?([\w$]+|\[[^\]]*\]|\{[^}]*\})\s+(of|in)\s+([^)]*)/g))t(y[1],y[2]==="of"?a(y[3]):void 0);for(let y of e.matchAll(/@for\s*\(\s*(?:let|const|var)\s+([\w$]+)\s*[=;]/g))t(y[1]);let l=Un(e);Hn.lastIndex=0;let c;while((c=Hn.exec(l))!==null){let y=c[1].replace(/\..*$/,"");if(!co.has(y))continue;let v=c[3].match(/\s+(?:in|of)\s+/);if(!v||v.index===void 0)continue;t(c[3].slice(0,v.index),a(c[3].slice(v.index+v[0].length)))}for(let y of e.matchAll(/@(?:php|js|ts)\b([\s\S]*?)@end(?:php|js|ts)\b/g))for(let v of y[1].matchAll(/\b(?:const|let|var|function|class)\s+([\w$]+)/g))t(v[1]);return[...n.values()].sort((y,v)=>y.name.localeCompare(v.name))}function Me(e){let n=new Set;for(let t of e.matchAll(/^\s*(?:export\s+)?(?:const|let|var)\s+([\w$]+)/gm))n.add(t[1]);for(let t of e.matchAll(/^\s*(?:export\s+)?(?:async\s+)?function\s*\*?\s*([\w$]+)/gm))n.add(t[1]);for(let t of e.matchAll(/^\s*(?:export\s+)?class\s+([\w$]+)/gm))n.add(t[1]);for(let t of e.matchAll(/^\s*(?:export\s+)?(?:const|let|var)\s*[[{]([^\]}]*)[\]}]/gm))for(let i of t[1].split(",")){let a=i.split(":").pop().split("=")[0].replace(/^\.\.\./,"").trim();if(/^[A-Z_$][\w$]*$/i.test(a))n.add(a)}return[...n].sort()}var As=["params","query","cookies","host","ip","setResponseStatus","setResponseHeader","notFound","request","url","definePageMeta","defineClientPayload","defineStore","props","$props"],ol={$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 Pc(e=new Set){return[...As.filter((n)=>!e.has(n)).map((n)=>`declare var ${n}: any`),...Object.entries(ol).filter(([n])=>!e.has(n)).map(([,n])=>n)].join(`
265
+ `)}function Ic(e){return new Set([...e.matchAll(/^declare (?:function|const|let|var)\s+([A-Za-z_$][\w$]*)/gm)].map((n)=>n[1]))}function uo(e){let n=/\bdefineClientPayload\s*\(\s*\{([\s\S]*?)\}\s*\)/g,t,i=!1,a=new Set,l=r(e);while((t=n.exec(l))!==null){i=!0;for(let c of al(t[1])){let y=c.split(":")[0].trim();if(/^[A-Za-z_$][\w$]*$/.test(y))a.add(y)}}return i?[...a]:null}function al(e){let n=[],t=0,i="";for(let a of e){if(a===","&&t===0){n.push(i),i="";continue}if(a==="("||a==="["||a==="{")t++;else if(a===")"||a==="]"||a==="}")t--;i+=a}return n.push(i),n.filter((a)=>a.trim().length>0)}function fo(e){let n=/^[ \t]*import\b[\s\S]*?(?:from\s*['"][^'"]*['"]|['"][^'"]*['"])[ \t]*;?[ \t]*$/gm,t=[],i=e.replace(n,(a)=>(t.push(a.trim()),a.split(`
259
266
  `).map(()=>"").join(`
260
267
  `)));return{imports:t.join(`
261
- `),body:i}}function co(e){let n=s(e),t=Array(n.length),i=0;for(let y=0;y<n.length;y++){let v=n[y];if(v==="}"||v===")"||v==="]")i=Math.max(0,i-1);if(t[y]=i,v==="{"||v==="("||v==="[")i++}let a=[],l=/^[ \t]*(?:export[ \t]+)?(interface|type)[ \t]+([A-Za-z_$][\w$]*)/gm,c;while((c=l.exec(n))!==null){if(t[c.index]!==0)continue;let y=c[1],v=c[2],E;if(y==="interface"){let R=n.indexOf("{",c.index);if(R===-1)continue;let M=0;E=-1;for(let N=R;N<n.length;N++)if(n[N]==="{")M++;else if(n[N]==="}"&&--M===0){E=N+1;break}if(E===-1)continue}else{let R=0;E=n.length;for(let M=n.indexOf("=",c.index)+1;M<n.length;M++){let N=n[M];if(N==="{"||N==="["||N==="("||N==="<")R++;else if(N==="}"||N==="]"||N===")"||N===">")R--;else if(R<=0&&(N===";"||N===`
262
- `&&!/[=|&,<([{]\s*$/.test(n.slice(Math.max(0,M-40),M)))){E=N===";"?M+1:M;break}}}a.push({name:v,text:e.slice(c.index,E).replace(/^[ \t]*export[ \t]+/,"")}),l.lastIndex=E}return a}function ol(e){return new Set(co(e).map((n)=>n.name))}function Pc(e,n=""){let t=ao(e),i=ol(n),a=co(e).filter((E)=>!i.has(E.name)).map((E)=>E.text);if(!t){let E=Me(e).filter((R)=>!Rt(n,R));if(E.length===0&&a.length===0)return"";return["",`// ${al}`,...a,...E.map((R)=>`declare var ${R}: any`)].join(`
263
- `)}if(t.length===0)return a.length>0?["",`// ${eo}`,...a].join(`
264
- `):"";let{imports:l,body:c}=il(e),y=c.replace(/^[ \t]*export[ \t]+(?=(?:const|let|var|function|async|class)\b)/gm,""),v=["",`// ${eo}`];if(l)v.push(l);return v.push(...a),v.push(`async function ${to}() {`,y,` return { ${t.join(", ")} }`,"}",`type ${no} = Awaited<ReturnType<typeof ${to}>>`,...t.map((E)=>`declare var ${E}: ${no}[${JSON.stringify(E)}]`)),v.join(`
265
- `)}function ci(e){let t=s(e).split(""),i=0;for(let a=0;a<t.length;a++){let l=t[a];if(l==="{"||l==="("||l==="["){i++;continue}if(l==="}"||l===")"||l==="]"){i=Math.max(0,i-1);continue}if(i>0&&l!==`
266
- `)t[a]=" "}return Me(t.join(""))}function Ic(e,n){if(ao(e)!==null)return[];let t=ci(e),i=Ie(n,new Set(t)),a=new Set(k);return t.filter((l)=>{if(a.has(l))return!1;if(Rt(n,l))return!1;return i.has(l)})}var eo="stx: types for the declared client payload (#1868)",al="stx: untyped bridge names \u2014 declare a defineClientPayload to check these (#1868)",to="__stxServerScope",no="__StxClientPayload";var so=["$env","$user","$slot","$slots","$attrs","$props","$page","$route","$loop","loop","$errors","$csrf","$native","props","slot"];var ul=/^\s*[A-Z_$][\w$]*\s*=[^=]/i;function fl(e){let n=new Map,t=/!|===|!==|==|!=|&&|\|\||<|>|\btypeof\b|\binstanceof\b|\bin\b/;for(let i of e){let a=s(i),{depths:l,balanced:c}=ge(a);if(!c)continue;let y=/^([ \t]*(?:export[ \t]+)?const[ \t]+)([A-Za-z_$][\w$]*)[ \t]*(?::[^=\n]+)?=[ \t]*([^\n]+)$/gm;for(let v of a.matchAll(y)){let E=v.index??0;if(l[E+v[1].length]!==0)continue;let R=v[2],M=E+v[0].length-v[3].length,N=i.slice(M,E+v[0].length).trim().replace(/;$/,"").trim(),j=v[3],P=t.test(j)&&!/\bawait\b|=>|\bfunction\b|[{}]/.test(j)&&!/[,+\-*/%&|?:=]$/.test(N)&&ge(j).balanced;n.set(R,n.has(R)||!P?null:N)}}return new Map([...n].filter((i)=>i[1]!==null))}function lo(e,n,t=0,i=new Set){if(n.size===0||t>=5)return e;let a=s(e),l="",c=0;for(let y of a.matchAll(/[A-Za-z_$][\w$]*/g)){let v=y.index??0,E=y[0],R=n.get(E);if(!R||i.has(E))continue;let M=a.slice(0,v).trimEnd(),N=a.slice(v+E.length).trimStart();if(M.endsWith(".")||/^:(?!:)/.test(N)&&/[{,]$/.test(M))continue;if(v>0&&/[\w$]/.test(a[v-1]))continue;l+=`${e.slice(c,v)}(${lo(R,n,t+1,new Set([...i,E]))})`,c=v+E.length}return l+e.slice(c)}function dl(e,n){let t=/@(if|unless|elseif|else|endif|endunless)\b\s*(\()?/g,i=[],a;while((a=t.exec(e))!==null){if(a.index>n)break;let l=a[1];if(a.index===n){if(l==="elseif"){let y=i[i.length-1];if(y?.current)y.seen.push(y.current);if(y)y.current=null}break}if(l==="endif"||l==="endunless"){i.pop();continue}let c="";if(a[2]==="("){let y=0,v=a.index+a[0].length-1,E=v+1;for(;v<e.length;v++){let R=e[v];if(R==="(")y++;else if(R===")"){if(y--,y===0)break}}c=e.slice(E,v).trim(),t.lastIndex=v+1}if(l==="if")i.push({seen:[],current:c});else if(l==="unless")i.push({seen:[],current:`!(${c})`});else if(l==="elseif"||l==="else"){let y=i[i.length-1];if(!y)continue;if(y.current)y.seen.push(y.current);y.current=l==="elseif"?c:null}}return i.flatMap((l)=>[...l.seen.map((c)=>`!(${c})`),...l.current?[l.current]:[]]).filter(Boolean)}function pl(e){let n=e.code.trim();if(!n)return null;if(e.attribute?.startsWith("@")){if(ul.test(n))return null;let i=";(($event: any): void => { ";return{text:`${i}${n} });`,prefixLength:i.length}}let t=";void ((";return{text:`${t}${n}));`,prefixLength:t.length}}var gl=/(\bfrom\s*|\bimport\s*\(\s*|\bimport\s+)(['"])(\.{1,2}\/[^'"\n]*)\2/g;function Ds(e,n){if(!n)return e;return e.replace(gl,(t,i,a,l)=>{let c=ro.resolve(n,l).replace(/\\/g,"/");return`${i}${a}${c}${a}`})}function li(e){return" ".repeat(Math.max(0,(e.startColumn??1)-1))}function ml(e){let n=new Set,t=s(e);for(let i of t.matchAll(/\bimport\s+(?:type\s+)?([\w$*{}\s,]+?)\s+from\b/g)){let a=i[1],l=/\{([^}]*)\}/.exec(a);for(let E of l?.[1].split(",")??[]){let R=E.trim().replace(/^type\s+/,"").split(/\s+as\s+/).pop()?.trim();if(R&&/^[A-Z_$][\w$]*$/i.test(R))n.add(R)}let c=a.replace(/\{[^}]*\}/,""),y=/\*\s*as\s+([A-Z_$][\w$]*)/i.exec(c);if(y)n.add(y[1]);let v=/^\s*([A-Z_$][\w$]*)/i.exec(c);if(v&&v[1]!=="type")n.add(v[1])}return[...n].sort()}function Oc(e,n={}){let t=It(e),i=e.split(`
267
- `),a=Array.from({length:i.length},()=>""),l=new Map,c=n.filePath&&n.templateExpressions!==!1?Xi(e,Un(e),{filePath:n.filePath,componentsDir:n.componentsDir,projectRoot:n.projectRoot,readComponent:n.readComponent,scriptCode:(M,N)=>It(M).map((j)=>Ds(j.code,ro.dirname(N))).join(`
268
- `)}):void 0,y=new Set,v=[];for(let M of t){let N=ai(ii(M.code)),j=Ds(N,n.originDir??"").split(`
269
- `);j.forEach((P,D)=>{let X=M.startLine-1+D;if(X<a.length)a[X]=D===0?li(M)+P:P,y.add(X)}),v.push(M.startLine-1+j.length-1)}for(let M of v){let N=a[M]?.trim()===""?M:M+1;if(N<a.length&&a[N].trim()===""&&(N===M||!y.has(N)))a[N]=";"}let E=(M,N)=>{for(let[j,P]of M.split(`
270
- `).entries())if(a.push(P),N)l.set(a.length,j===0?N:{...N,line:N.line+j,column:1,prefixLength:0})};if(n.globals!==!1){E("");let M=new Set([...t.flatMap((D)=>Me(D.code)),...t.flatMap((D)=>ml(D.code))]),N=(D)=>{if(!M.has(D))E(`declare var ${D}: any`)};if(n.runtimeGlobals!==!1){if(!M.has("window"))E("declare var window: any");for(let D of k)N(D)}let j=[...new Set([...Ws,...xe,...so])].filter((D)=>n.runtimeGlobals!==!1||!k.includes(D));if(n.contextScope==="global"){E("declare global {");for(let D of j)E(` var ${D}: any`);E("}")}else{for(let D of Ws)N(D);for(let D of xe)N(D);for(let D of so)N(D)}E(`declare var ${Ts}: any`);let P=new Set(t.flatMap((D)=>Me(D.code)));E(`type ${Gi}<T> = T extends readonly (infer E)[] ? E : T extends Iterable<infer E2> ? E2 : any`);for(let D of nl(e)){if(P.has(D.name))continue;let X=D.iterable&&P.has(D.iterable)?`${Gi}<typeof ${D.iterable}>`:"any";E(`declare var ${D.name}: ${X}`)}}if(n.templateExpressions!==!1){if(c?.declarations)for(let N of c.declarations.split(`
271
- `))E(N);let M=Gf(e).map((N)=>{let j=c?.events.get(N.offset??-1);if(j){N.anchor=!0;let P=N.code.trim(),D=/^([\w$]+)\s*=\s*([^=][\s\S]*)$/.exec(P),X=D?`void ((${D[2]}) satisfies __StxAssignedValue<typeof ${D[1]}>)`:/^[\w$]+(?:\.[\w$]+)*$/.test(P)?`${P} satisfies (($event: ${j}) => unknown)`:P,F=`;(($event: ${j}): void => { `;return{expression:N,statement:{text:`${F}${X} });`,prefixLength:F.length}}}return{expression:N,statement:pl(N)}}).filter((N)=>N.statement!==null);if(M.push(...c?.checks||[]),M.length>0){let N=Un(e),j=Vn(N),P=fl(t.map((L)=>L.code)),X=[...new Set(t.flatMap((L)=>Me(L.code)))].filter((L)=>/^[A-Z_$][\w$]*$/i.test(L)),F=0;if(X.length>0){E(kc);for(let L of X)E(`function __StxRead_${L}() { return ${L} }`),E(`type __StxT_${L} = ${oo}<ReturnType<typeof __StxRead_${L}>>`);E(`;((${X.map((L)=>`${L}: __StxT_${L}`).join(", ")}) => {`),F=1}for(let{expression:L,statement:Q}of M){let te=" ".repeat(F),ae=L.offset===void 0?[]:j.filter((ke)=>L.offset>=ke.start&&L.offset<ke.end),se=ae.map((ke)=>`;((${ke.binding.replace(/[\r\n]/g," ")}: any) => { `).join(""),ue=" });".repeat(ae.length),Ee=L.offset===void 0?[]:dl(N,L.offset),Te=Ee.length>0?`${Ee.map((ke)=>`if (${lo(ke,P)}) `).join("")}{ `:"",Ae=Ee.length>0?" }":"";E(te+se+Te+Q.text+Ae+ue,{line:L.line,column:L.column,expression:L,prefixLength:Q.prefixLength+te.length+se.length+Te.length,guardPrefixLength:te.length+se.length+Te.length})}if(F>0)E("});")}}let R=!1;if(n.reference&&a[0]!==void 0&&a[0].trim()==="")a[0]=`/// <reference path=${JSON.stringify(n.reference.replace(/\\/g,"/"))} />`,R=!0;return E("export {}"),{text:a.join(`
272
- `),lineMap:l,sourceLineCount:i.length,componentDependencies:c?.dependencies,referenced:R}}function Nc(e,n){if(!e.expression)return!1;return e.inGuard===!0||n===2774}function Mc(e,n,t){let i=e.lineMap.get(n);if(!i)return n<=e.sourceLineCount?{line:n,column:t}:null;let a=i.expression?.anchor?0:Math.max(0,t-1-(i.prefixLength??0));return{line:i.line,column:i.column+a,expression:i.expression,inGuard:t<=(i.guardPrefixLength??0)}}var Ks=b(256),hl=[{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"}],uo=/(?:\/\/|\/\*|\{\{--)\s*stx-strict-ignore(-next-line)?([^\n*}]*)/g;function xl(e){let n=Array.from(e,(a)=>a===`
268
+ `),body:i}}function po(e){let n=r(e),t=Array(n.length),i=0;for(let y=0;y<n.length;y++){let v=n[y];if(v==="}"||v===")"||v==="]")i=Math.max(0,i-1);if(t[y]=i,v==="{"||v==="("||v==="[")i++}let a=[],l=/^[ \t]*(?:export[ \t]+)?(interface|type)[ \t]+([A-Za-z_$][\w$]*)/gm,c;while((c=l.exec(n))!==null){if(t[c.index]!==0)continue;let y=c[1],v=c[2],E;if(y==="interface"){let R=n.indexOf("{",c.index);if(R===-1)continue;let D=0;E=-1;for(let N=R;N<n.length;N++)if(n[N]==="{")D++;else if(n[N]==="}"&&--D===0){E=N+1;break}if(E===-1)continue}else{let R=0;E=n.length;for(let D=n.indexOf("=",c.index)+1;D<n.length;D++){let N=n[D];if(N==="{"||N==="["||N==="("||N==="<")R++;else if(N==="}"||N==="]"||N===")"||N===">")R--;else if(R<=0&&(N===";"||N===`
269
+ `&&!/[=|&,<([{]\s*$/.test(n.slice(Math.max(0,D-40),D)))){E=N===";"?D+1:D;break}}}a.push({name:v,text:e.slice(c.index,E).replace(/^[ \t]*export[ \t]+/,"")}),l.lastIndex=E}return a}function cl(e){return new Set(po(e).map((n)=>n.name))}function Oc(e,n=""){let t=uo(e),i=cl(n),a=po(e).filter((E)=>!i.has(E.name)).map((E)=>E.text);if(!t){let E=Me(e).filter((R)=>!Rt(n,R));if(E.length===0&&a.length===0)return"";return["",`// ${fl}`,...a,...E.map((R)=>`declare var ${R}: any`)].join(`
270
+ `)}if(t.length===0)return a.length>0?["",`// ${to}`,...a].join(`
271
+ `):"";let{imports:l,body:c}=fo(e),y=c.replace(/^[ \t]*export[ \t]+(?=(?:const|let|var|function|async|class)\b)/gm,""),v=["",`// ${to}`];if(l)v.push(l);return v.push(...a),v.push(`async function ${no}() {`,y,` return { ${t.join(", ")} }`,"}",`type ${so} = Awaited<ReturnType<typeof ${no}>>`,...t.map((E)=>`declare var ${E}: ${so}[${JSON.stringify(E)}]`)),v.join(`
272
+ `)}function ci(e){let t=r(e).split(""),i=0;for(let a=0;a<t.length;a++){let l=t[a];if(l==="{"||l==="("||l==="["){i++;continue}if(l==="}"||l===")"||l==="]"){i=Math.max(0,i-1);continue}if(i>0&&l!==`
273
+ `)t[a]=" "}return Me(t.join(""))}function Nc(e,n){if(uo(e)!==null)return[];let t=ci(e),i=Ie(n,new Set(t)),a=new Set(k);return t.filter((l)=>{if(a.has(l))return!1;if(Rt(n,l))return!1;return i.has(l)})}var to="stx: types for the declared client payload (#1868)",fl="stx: untyped bridge names \u2014 declare a defineClientPayload to check these (#1868)",no="__stxServerScope",so="__StxClientPayload";var ro=["$env","$user","$slot","$slots","$attrs","$props","$page","$route","$loop","loop","$errors","$csrf","$native","props","slot"];var dl=/^\s*[A-Z_$][\w$]*\s*=[^=]/i;function pl(e){let n=new Map,t=/!|===|!==|==|!=|&&|\|\||<|>|\btypeof\b|\binstanceof\b|\bin\b/;for(let i of e){let a=r(i),{depths:l,balanced:c}=ge(a);if(!c)continue;let y=/^([ \t]*(?:export[ \t]+)?const[ \t]+)([A-Za-z_$][\w$]*)[ \t]*(?::[^=\n]+)?=[ \t]*([^\n]+)$/gm;for(let v of a.matchAll(y)){let E=v.index??0;if(l[E+v[1].length]!==0)continue;let R=v[2],D=E+v[0].length-v[3].length,N=i.slice(D,E+v[0].length).trim().replace(/;$/,"").trim(),j=v[3],P=t.test(j)&&!/\bawait\b|=>|\bfunction\b|[{}]/.test(j)&&!/[,+\-*/%&|?:=]$/.test(N)&&ge(j).balanced;n.set(R,n.has(R)||!P?null:N)}}return new Map([...n].filter((i)=>i[1]!==null))}function go(e,n,t=0,i=new Set){if(n.size===0||t>=5)return e;let a=r(e),l="",c=0;for(let y of a.matchAll(/[A-Za-z_$][\w$]*/g)){let v=y.index??0,E=y[0],R=n.get(E);if(!R||i.has(E))continue;let D=a.slice(0,v).trimEnd(),N=a.slice(v+E.length).trimStart();if(D.endsWith(".")||/^:(?!:)/.test(N)&&/[{,]$/.test(D))continue;if(v>0&&/[\w$]/.test(a[v-1]))continue;l+=`${e.slice(c,v)}(${go(R,n,t+1,new Set([...i,E]))})`,c=v+E.length}return l+e.slice(c)}function gl(e,n){let t=/@(if|unless|elseif|else|endif|endunless)\b\s*(\()?/g,i=[],a;while((a=t.exec(e))!==null){if(a.index>n)break;let l=a[1];if(a.index===n){if(l==="elseif"){let y=i[i.length-1];if(y?.current)y.seen.push(y.current);if(y)y.current=null}break}if(l==="endif"||l==="endunless"){i.pop();continue}let c="";if(a[2]==="("){let y=0,v=a.index+a[0].length-1,E=v+1;for(;v<e.length;v++){let R=e[v];if(R==="(")y++;else if(R===")"){if(y--,y===0)break}}c=e.slice(E,v).trim(),t.lastIndex=v+1}if(l==="if")i.push({seen:[],current:c});else if(l==="unless")i.push({seen:[],current:`!(${c})`});else if(l==="elseif"||l==="else"){let y=i[i.length-1];if(!y)continue;if(y.current)y.seen.push(y.current);y.current=l==="elseif"?c:null}}return i.flatMap((l)=>[...l.seen.map((c)=>`!(${c})`),...l.current?[l.current]:[]]).filter(Boolean)}function ml(e){let n=e.code.trim();if(!n)return null;if(e.attribute?.startsWith("@")){if(dl.test(n))return null;let i=";(($event: any): void => { ";return{text:`${i}${n} });`,prefixLength:i.length}}let t=";void ((";return{text:`${t}${n}));`,prefixLength:t.length}}var hl=/(\bfrom\s*|\bimport\s*\(\s*|\bimport\s+)(['"])(\.{1,2}\/[^'"\n]*)\2/g;function _r(e,n){if(!n)return e;return e.replace(hl,(t,i,a,l)=>{let c=oo.resolve(n,l).replace(/\\/g,"/");return`${i}${a}${c}${a}`})}function li(e){return" ".repeat(Math.max(0,(e.startColumn??1)-1))}function xl(e){let n=new Set,t=r(e);for(let i of t.matchAll(/\bimport\s+(?:type\s+)?([\w$*{}\s,]+?)\s+from\b/g)){let a=i[1],l=/\{([^}]*)\}/.exec(a);for(let E of l?.[1].split(",")??[]){let R=E.trim().replace(/^type\s+/,"").split(/\s+as\s+/).pop()?.trim();if(R&&/^[A-Z_$][\w$]*$/i.test(R))n.add(R)}let c=a.replace(/\{[^}]*\}/,""),y=/\*\s*as\s+([A-Z_$][\w$]*)/i.exec(c);if(y)n.add(y[1]);let v=/^\s*([A-Z_$][\w$]*)/i.exec(c);if(v&&v[1]!=="type")n.add(v[1])}return[...n].sort()}function Mc(e,n={}){let t=It(e),i=e.split(`
274
+ `),a=Array.from({length:i.length},()=>""),l=new Map,c=new Map,y=[],v=t.filter((P)=>P.kind==="server").map((P)=>P.code).join(`
275
+ `),E=n.filePath&&n.templateExpressions!==!1?Ji(e,Un(e),{filePath:n.filePath,componentsDir:n.componentsDir,projectRoot:n.projectRoot,readComponent:n.readComponent,scriptCode:(P,M)=>It(P).map((X)=>_r(X.code,oo.dirname(M))).join(`
276
+ `)}):void 0,R=new Set,D=[];for(let[P,M]of t.entries()){let X=ai(li(M)+M.code,v,String(P));for(let[Q,ee]of X.columns)c.set(M.startLine+Q-1,ee);for(let Q of X.declarations)y.push({text:_r(Q.text,n.originDir??""),origin:Q.origin?{...Q.origin,line:Q.origin.line+M.startLine-1}:void 0});let F=Ls(X.code),L=_r(F,n.originDir??"").split(`
277
+ `);L.forEach((Q,ee)=>{let re=M.startLine-1+ee;if(re<a.length)a[re]=Q,R.add(re)}),D.push(M.startLine-1+L.length-1)}for(let P of D){let M=a[P]?.trim()===""?P:P+1;if(M<a.length&&a[M].trim()===""&&(M===P||!R.has(M)))a[M]=";"}let N=(P,M)=>{for(let[X,F]of P.split(`
278
+ `).entries())if(a.push(F),M)l.set(a.length,X===0?M:{...M,line:M.line+X,column:1,prefixLength:0})};for(let P of y)N(P.text,P.origin);if(n.globals!==!1){N("");let P=new Set([...t.flatMap((L)=>Me(L.code)),...t.flatMap((L)=>xl(L.code))]),M=(L)=>{if(!P.has(L))N(`declare var ${L}: any`)};if(n.runtimeGlobals!==!1){if(!P.has("window"))N("declare var window: any");for(let L of k)M(L)}let X=[...new Set([...As,...xe,...ro])].filter((L)=>n.runtimeGlobals!==!1||!k.includes(L));if(n.contextScope==="global"){N("declare global {");for(let L of X)N(` var ${L}: any`);N("}")}else{for(let L of As)M(L);for(let L of xe)M(L);for(let L of ro)M(L)}N(`declare var ${Ts}: any`);let F=new Set(t.flatMap((L)=>Me(L.code)));N(`type ${Yi}<T> = T extends readonly (infer E)[] ? E : T extends Iterable<infer E2> ? E2 : any`);for(let L of il(e)){if(F.has(L.name))continue;let Q=L.iterable&&F.has(L.iterable)?`${Yi}<typeof ${L.iterable}>`:"any";N(`declare var ${L.name}: ${Q}`)}}if(n.templateExpressions!==!1){if(E?.declarations)for(let M of E.declarations.split(`
279
+ `))N(M);let P=Gf(e).map((M)=>{let X=E?.events.get(M.offset??-1);if(X){M.anchor=!0;let F=M.code.trim(),L=/^([\w$]+)\s*=\s*([^=][\s\S]*)$/.exec(F),Q=L?`void ((${L[2]}) satisfies __StxAssignedValue<typeof ${L[1]}>)`:/^[\w$]+(?:\.[\w$]+)*$/.test(F)?`${F} satisfies (($event: ${X}) => unknown)`:F,ee=`;(($event: ${X}): void => { `;return{expression:M,statement:{text:`${ee}${Q} });`,prefixLength:ee.length}}}return{expression:M,statement:ml(M)}}).filter((M)=>M.statement!==null);if(P.push(...E?.checks||[]),P.length>0){let M=Un(e),X=Vn(M),F=pl(t.map((re)=>re.code)),Q=[...new Set(t.flatMap((re)=>Me(re.code)))].filter((re)=>/^[A-Z_$][\w$]*$/i.test(re)),ee=0;if(Q.length>0){N(Tc);for(let re of Q)N(`function __StxRead_${re}() { return ${re} }`),N(`type __StxT_${re} = ${lo}<ReturnType<typeof __StxRead_${re}>>`);N(`;((${Q.map((re)=>`${re}: __StxT_${re}`).join(", ")}) => {`),ee=1}for(let{expression:re,statement:te}of P){let le=" ".repeat(ee),Ee=re.offset===void 0?[]:X.filter((Ze)=>re.offset>=Ze.start&&re.offset<Ze.end),we=Ee.map((Ze)=>`;((${Ze.binding.replace(/[\r\n]/g," ")}: any) => { `).join(""),Re=" });".repeat(Ee.length),Ce=re.offset===void 0?[]:gl(M,re.offset),Ke=Ce.length>0?`${Ce.map((Ze)=>`if (${go(Ze,F)}) `).join("")}{ `:"",Je=Ce.length>0?" }":"";N(le+we+Ke+te.text+Je+Re,{line:re.line,column:re.column,expression:re,prefixLength:te.prefixLength+le.length+we.length+Ke.length,guardPrefixLength:le.length+we.length+Ke.length})}if(ee>0)N("});")}}let j=!1;if(n.reference&&a[0]!==void 0&&a[0].trim()==="")a[0]=`/// <reference path=${JSON.stringify(n.reference.replace(/\\/g,"/"))} />`,j=!0;return N("export {}"),{text:a.join(`
280
+ `),lineMap:l,sourceLineCount:i.length,componentDependencies:E?.dependencies,referenced:j,scriptColumns:c}}function bl(e){let n=[0];for(let t=0;t<e.length;t++)if(e.charCodeAt(t)===10)n.push(t+1);return n}function io(e,n){let t=0,i=e.length-1;while(t<i){let a=Math.ceil((t+i)/2);if(e[a]<=n)t=a;else i=a-1}return{line:t+1,column:n-e[t]+1}}function Dc(e,n){if(!e.expression)return!1;return e.inGuard===!0||n===2774}function ui(e,n,t){let i=e.lineMap.get(n);if(!i)return n<=e.sourceLineCount?{line:n,column:el(e.scriptColumns?.get(n)??[],t)}:null;let a=i.expression?.anchor?0:Math.max(0,t-1-(i.prefixLength??0));return{line:i.line,column:i.column+a,expression:i.expression,inGuard:t<=(i.guardPrefixLength??0)}}var Ks=b(256),yl=[{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"}],mo=/(?:\/\/|\/\*|\{\{--)\s*stx-strict-ignore(-next-line)?([^\n*}]*)/g;function _l(e){let n=Array.from(e,(a)=>a===`
273
281
  `?`
274
282
  `:" "),t=0,i="";while(t<e.length){let a=e[t],l=e[t+1];if(i){if(a==="\\"){t+=2;continue}if(a===i)i="";t++;continue}if(a==='"'||a==="'"||a==="`"){i=a,t++;continue}if(a==="/"&&l==="/"){while(t<e.length&&e[t]!==`
275
- `)n[t]=e[t],t++;continue}if(a==="/"&&l==="*"){let c=e.indexOf("*/",t+2),y=c===-1?e.length:c+2;for(;t<y;t++)n[t]=e[t];continue}if(a==="{"&&l==="{"&&e.slice(t,t+4)==="{{--"){let c=e.indexOf("--}}",t+4),y=c===-1?e.length:c+4;for(;t<y;t++)n[t]=e[t];continue}t++}return n.join("")}function bl(e){let n=new Map,t=xl(e).split(`
283
+ `)n[t]=e[t],t++;continue}if(a==="/"&&l==="*"){let c=e.indexOf("*/",t+2),y=c===-1?e.length:c+2;for(;t<y;t++)n[t]=e[t];continue}if(a==="{"&&l==="{"&&e.slice(t,t+4)==="{{--"){let c=e.indexOf("--}}",t+4),y=c===-1?e.length:c+4;for(;t<y;t++)n[t]=e[t];continue}t++}return n.join("")}function wl(e){let n=new Map,t=_l(e).split(`
276
284
  `),i=e.split(`
277
- `);return t.forEach((a,l)=>{uo.lastIndex=0;for(let c of a.matchAll(uo)){let y=c[1]==="-next-line",v=(i[l]??"").slice(0,c.index).trim(),E=y||v===""?l+2:l+1,M=(c[2]??"").split("--")[0].split(/[\s,]+/).filter(Boolean),N=M.filter((P)=>/\w/.test(P));if(M.length>0&&N.length===0)continue;let j=n.get(E);if(j&&j.size===0)continue;if(N.length===0){n.set(E,new Set);continue}if(j)N.forEach((P)=>j.add(P));else n.set(E,new Set(N))}}),n}function yl(e,n,t){let i=e.get(n);if(!i)return!1;if(i.size===0)return!0;return[...i].some((a)=>t.includes(a))}function Oe(e,n,t,i){let a=typeof t==="boolean"?{enabled:t,failOnViolation:t}:t??{enabled:!1};if(!a.enabled)return;let l=x(e,n,i,JSON.stringify(a)),c=Ks.get(l);if(c!==void 0){if(c&&a.failOnViolation)throw new q(c,i??n);return}let y=a.allowPatterns??[],v=bl(e),E=[],R=s(e.replace(/\{\{--[\s\S]*?--\}\}/g,(P)=>P.replace(/[^\n]/g," ")));for(let{pattern:P,message:D,suggestion:X}of hl){if(y.some((L)=>/\w/.test(L)&&D.includes(L)))continue;P.lastIndex=0;let F=R.match(P);if(F&&F.length>0){let L=R.split(`
285
+ `);return t.forEach((a,l)=>{mo.lastIndex=0;for(let c of a.matchAll(mo)){let y=c[1]==="-next-line",v=(i[l]??"").slice(0,c.index).trim(),E=y||v===""?l+2:l+1,D=(c[2]??"").split("--")[0].split(/[\s,]+/).filter(Boolean),N=D.filter((P)=>/\w/.test(P));if(D.length>0&&N.length===0)continue;let j=n.get(E);if(j&&j.size===0)continue;if(N.length===0){n.set(E,new Set);continue}if(j)N.forEach((P)=>j.add(P));else n.set(E,new Set(N))}}),n}function Sl(e,n,t){let i=e.get(n);if(!i)return!1;if(i.size===0)return!0;return[...i].some((a)=>t.includes(a))}function Oe(e,n,t,i){let a=typeof t==="boolean"?{enabled:t,failOnViolation:t}:t??{enabled:!1};if(!a.enabled)return;let l=x(e,n,i,JSON.stringify(a)),c=Ks.get(l);if(c!==void 0){if(c&&a.failOnViolation)throw new q(c,i??n);return}let y=a.allowPatterns??[],v=wl(e),E=[],R=r(e.replace(/\{\{--[\s\S]*?--\}\}/g,(P)=>P.replace(/[^\n]/g," ")));for(let{pattern:P,message:M,suggestion:X}of yl){if(y.some((L)=>/\w/.test(L)&&M.includes(L)))continue;P.lastIndex=0;let F=R.match(P);if(F&&F.length>0){let L=R.split(`
278
286
  `),Q=e.split(`
279
- `),te=[];if(L.forEach((Ee,Te)=>{if(P.lastIndex=0,P.test(Ee)&&!yl(v,Te+1,D))te.push(Te+1)}),te.length===0&&L.some((Ee)=>(P.lastIndex=0,P.test(Ee))))continue;let ae=te.length>0?` (script line${te.length>1?"s":""} ${te.join(", ")})`:"",se=te.slice(0,3).map((Ee)=>` ${Ee} | ${(Q[Ee-1]??"").trim().slice(0,100)}`).join(`
280
- `),ue=se?`
281
- ${se}`:"";E.push(` \u2717 ${D}${ae}
282
- \u2192 ${X}${ue}`)}}if(E.length===0){Ks.set(l,"");return}let M=(P)=>{let D=`${process.cwd()}/`;return P.startsWith(D)?P.slice(D.length):P},j=`[STX] DOM API violation in ${i&&i!==n?`${M(i)} (composed into ${M(n)})`:M(n)}:
287
+ `),ee=[];if(L.forEach((Ee,we)=>{if(P.lastIndex=0,P.test(Ee)&&!Sl(v,we+1,M))ee.push(we+1)}),ee.length===0&&L.some((Ee)=>(P.lastIndex=0,P.test(Ee))))continue;let re=ee.length>0?` (script line${ee.length>1?"s":""} ${ee.join(", ")})`:"",te=ee.slice(0,3).map((Ee)=>` ${Ee} | ${(Q[Ee-1]??"").trim().slice(0,100)}`).join(`
288
+ `),le=te?`
289
+ ${te}`:"";E.push(` \u2717 ${M}${re}
290
+ \u2192 ${X}${le}`)}}if(E.length===0){Ks.set(l,"");return}let D=(P)=>{let M=`${process.cwd()}/`;return P.startsWith(M)?P.slice(M.length):P},j=`[STX] DOM API violation in ${i&&i!==n?`${D(i)} (composed into ${D(n)})`:D(n)}:
283
291
  ${E.join(`
284
292
  `)}
285
- Tip: prefer useRef(), navigate(), and composables for component code`;if(Ks.set(l,j),console.warn(j),a.failOnViolation)throw new q(j,i??n)}var _l=[{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"}],wl=[{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')"}],Sl=[{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 sg(e){let n=[],t=[];return $l(e,n),vl(e,n,t),El(e,t),kl(e,n),{valid:n.length===0,errors:n,warnings:t}}function $l(e,n){let t=(e.match(/\{\{/g)||[]).length,i=(e.match(/\}\}/g)||[]).length;if(t!==i)n.push({type:"expression",message:`Unclosed expression brackets: found ${t} opening '{{' and ${i} closing '}}'`,suggestion:"Ensure every {{ has a matching }}"})}function vl(e,n,t){for(let i of _l){let a=new RegExp(`${i.open}(?:\\s|\\()`,"g"),l=new RegExp(i.close,"g"),c=(e.match(a)||[]).length,y=(e.match(l)||[]).length;if(i.altClose){let v=new RegExp(i.altClose,"g");y+=(e.match(v)||[]).length}if(c>y)n.push({type:"directive",message:`Unclosed @${i.name} directive: found ${c} opening and ${y} closing`,suggestion:`Add ${c-y} missing ${i.close} tag(s)`});else if(y>c)t.push({type:"directive",message:`Extra ${i.close} found: ${y-c} more closing than opening`,suggestion:`Check for orphaned ${i.close} tags`})}}function El(e,n){for(let t of wl)if(t.pattern.test(e))n.push({type:"syntax",message:t.message,suggestion:t.suggestion})}function kl(e,n){for(let t of Sl)if(t.pattern.test(e))n.push({type:"expression",message:`Security warning: ${t.message}`,suggestion:"Remove dangerous code from template expressions"})}function og(e,n){let t=e.slice(0,n).split(`
286
- `);return{line:t.length,column:t[t.length-1].length+1}}function ig(e,n,t){let i=[];switch(e){case"if":case"elseif":case"unless":if(t.length===0)i.push({type:"syntax",message:`@${e} requires a condition`,suggestion:`Use @${e}(condition)`});break;case"foreach":if(t.length===0||!t[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(t.length===0)i.push({type:"syntax",message:"@for requires loop parameters",suggestion:"Use @for(let i = 0; i < 10; i++)"});break;case"switch":if(t.length===0)i.push({type:"syntax",message:"@switch requires an expression",suggestion:"Use @switch(expression)"});break;case"case":if(t.length===0)i.push({type:"syntax",message:"@case requires a value",suggestion:"Use @case(value)"});break;case"include":case"extends":case"component":if(t.length===0)i.push({type:"syntax",message:`@${e} requires a path`,suggestion:`Use @${e}('path/to/template')`});break}return i}function ag(e){return/@[a-z]+/i.test(e)||/\{\{/.test(e)}function cg(e){let n=e.matchAll(/@([a-z]+)/gi),t=new Set;for(let i of n){let a=i[1].toLowerCase();if(!a.startsWith("end"))t.add(a)}return Array.from(t)}function fo(e,n,t){let i=/^<script\b([^>]*)>/i.exec(e);if(!i||!/(?:^|\s)src\s*=/i.test(i[1]??""))return null;return _(i[0],n,t)+e.slice(i[0].length)}var sn=new U(500),Js=new Map;function po(e){try{let n=Xn.statSync(e);return`${n.size}:${n.mtimeMs}`}catch{return""}}var Zn=new U(1000),Ys=new U(2000),Qs=new U(500),So=33554432,er=So;function Rl(e){let n=e.componentRenderCacheBytes;if(typeof n!=="number"||n<0||n===er)return;er=n,qn.setMaxBytes(n)}var qn=new U(2000,{maxBytes:So,sizeOf:(e)=>e.output.length});function Cl(e){let n=new WeakSet;try{let t=(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(n.has(i))throw TypeError("Circular component input");n.add(i);try{if(i instanceof Date)return{__stxType:"date",value:i.toISOString()};if(Array.isArray(i))return i.map(t);let a=Object.getPrototypeOf(i);if(a!==Object.prototype&&a!==null)throw TypeError("Non-plain component input");let l={};for(let c of Object.keys(i).sort())l[c]=t(i[c]);return l}finally{n.delete(i)}};return JSON.stringify(t(e))}catch{return null}}function Tl(e){let n={};for(let[t,i]of Object.entries(e))if(!t.startsWith("__")||t==="__stxServeContext")n[t]=i;return n}function Zs(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function zs(e){let n=process.cwd(),t=`${n}\x00${e}`,i=go.get(t);if(i===void 0)i=Bun.hash($o(e,n).split(ce.sep).join("/")).toString(36).slice(0,6),go.set(t,i);return i}var go=new Map;function $o(e,n){if(!ce.isAbsolute(e))return e;let t=(i)=>{try{return Xn.realpathSync(i)}catch{return i}};return ce.relative(t(n),t(e))}function lg(e){return/\bjs\b/.test(e)||/\blang\s*=\s*["']?(js|javascript)["']?/i.test(e)}function je(e){return!lg(e)}var Kn=new Map;function Y(e){let n;try{n=JSON.stringify(e)}catch{return new Bun.Transpiler(e)}let t=Kn.get(n);if(t)return t;if(Kn.size>=16)Kn.clear();let i=new Bun.Transpiler(e);return Kn.set(n,i),i}var mo=new WeakMap,Al=256;function Be(e){try{let n=Y({loader:"ts",target:"browser",define:C()}),t=mo.get(n);if(!t)t=new Map,mo.set(n,t);let i=t.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 l=[];a=a.replace(/\{!![\s\S]*?!!\}/g,(y)=>{let v=l.length;return l.push(y),`"__STX_EXPR_${v}__"`}),a=a.replace(/\{\{\{[\s\S]*?\}\}\}/g,(y)=>{let v=l.length;return l.push(y),`"__STX_EXPR_${v}__"`}),a=a.replace(/\{\{[\s\S]*?\}\}/g,(y)=>{let v=l.length;return l.push(y),`"__STX_EXPR_${v}__"`});let c=n.transformSync(a);for(let y=0;y<l.length;y++)c=c.replace(`"__STX_EXPR_${y}__"`,l[y]),c=c.replace(`'__STX_EXPR_${y}__'`,l[y]);if(t.size>=Al){let y=t.keys().next();if(!y.done)t.delete(y.value)}return t.set(e,c),c}catch(n){if(process.env.STX_DEBUG_TS)console.warn("[STX] TypeScript transpilation error:",n);return e}}function Il(e){let n=[],t=new Set,i=0,a=0,l=e.length,c=(j)=>{a++;while(a<l){if(e[a]==="\\"){a+=2;continue}if(e[a]===j){a++;return}a++}},y=()=>{a++;while(a<l){if(e[a]==="\\"){a+=2;continue}if(e[a]==="`"){a++;return}if(e[a]==="$"&&e[a+1]==="{"){a+=2;let j=1;while(a<l&&j>0)if(e[a]==="{")j++,a++;else if(e[a]==="}")j--,a++;else if(e[a]==="'"||e[a]==='"')c(e[a]);else if(e[a]==="`")y();else a++;continue}a++}},v=()=>{if(e[a]==="/"&&e[a+1]==="/"){while(a<l&&e[a]!==`
287
- `)a++;return!0}if(e[a]==="/"&&e[a+1]==="*"){a+=2;while(a<l-1&&!(e[a]==="*"&&e[a+1]==="/"))a++;return a+=2,!0}return!1},E=new Set(["return","typeof","instanceof","in","of","new","delete","void","throw","case","do","else","yield","await"]),R=()=>{let j=a-1;while(j>=0&&/\s/.test(e[j]))j--;if(j<0)return!0;let P=e[j];if("(,=:[!&|?{};+-*%<>~^".includes(P))return!0;if(!/[\w$]/.test(P))return!1;let D=j;while(D>0&&/[\w$]/.test(e[D-1]))D--;return E.has(e.slice(D,j+1))},M=()=>{a++;let j=!1;while(a<l&&e[a]!==`
288
- `){let P=e[a];if(P==="\\"){a+=2;continue}if(P==="[")j=!0;else if(P==="]")j=!1;else if(P==="/"&&!j){a++;while(a<l&&/[a-z]/i.test(e[a]))a++;return}a++}},N=()=>{if(i!==0)return;let j=e.slice(a).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(j){let F=j[2].split(",").map((L)=>{let Q=L.trim().split(":");return Q[Q.length-1].trim()});for(let L of F)if(L&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(L)&&!t.has(L))n.push(L),t.add(L);return}let P=e.slice(a).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(P){let F=P[2];if(!t.has(F))n.push(F),t.add(F);return}let D=e.slice(a).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(D){let F=D[1];if(!t.has(F))n.push(F),t.add(F);return}let X=e.slice(a).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(X){let F=X[1];if(!t.has(F))n.push(F),t.add(F)}};while(a<l){if(v())continue;if(e[a]==="'"||e[a]==='"'){c(e[a]);continue}if(e[a]==="`"){y();continue}if(e[a]==="/"&&R()){M();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])))N();a++}return n}function Pl(e){let n=[],t=0,i=0,a=null;for(let l=0;l<e.length;l++){let c=e[l];if(a){if(c==="\\"){l++;continue}if(c===a)a=null;continue}if(c==='"'||c==="'"||c==="`"){a=c;continue}if(c==="("||c==="["||c==="{")t++;else if(c===")"||c==="]"||c==="}")t--;else if(c===","&&t===0)n.push(e.slice(i,l)),i=l+1}if(i<e.length)n.push(e.slice(i));return n}function Ol(e){let n=0,t=null;for(let i=0;i<e.length;i++){let a=e[i];if(t){if(a==="\\"){i++;continue}if(a===t)t=null;continue}if(a==='"'||a==="'"||a==="`"){t=a;continue}if(a==="("||a==="["||a==="{")n++;else if(a===")"||a==="]"||a==="}")n--;else if(a==="="&&n===0){let l=e[i-1],c=e[i+1];if(l==="!"||l==="<"||l===">"||l==="=")continue;if(c==="="||c===">")continue;return i}}return-1}function Ml(e,n){try{let t=/=\s*(?:withDefaults\s*\([\s\S]*?defineProps|defineProps)\b/.exec(e);if(!t)return;let i=t.index-1;while(i>=0&&/\s/.test(e[i]))i--;if(e[i]!=="}")return;let a=i,l=0,c=-1;for(;i>=0;i--){let v=e[i];if(v==="}")l++;else if(v==="{"){if(l--,l===0){c=i;break}}}if(c===-1)return;let y=e.slice(c+1,a);for(let v of Pl(y)){let E=v.trim();if(!E||E.startsWith("..."))continue;let R=Ol(E);if(R===-1)continue;let M=E.slice(0,R).trim();if(!/^[A-Z_$][\w$]*$/i.test(M))continue;if(n[M]!==void 0)continue;let N=E.slice(R+1).trim();if(!N)continue;try{let j=Object.keys(n).filter(jt),P=Function(...j,`"use strict"; return (${N});`);n[M]=P(...j.map((D)=>n[D]))}catch{}}}catch{}}var Dl=new Set(["tr","td","th","thead","tbody","tfoot","caption","colgroup","col","option","optgroup","li","dt","dd","span"]);function ug(e,n){let t=e.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)<([a-zA-Z][a-zA-Z0-9-]*)/s);if(!t)return null;let i=t[2].toLowerCase();if(!Dl.has(i))return null;let a=new RegExp(`<\\/?${i}(?=[\\s/>])(?:[^>"']|"[^"]*"|'[^']*')*>`,"iy"),l=S(e,(E,R)=>(a.lastIndex=R,a.exec(E)?.index===R?a.lastIndex:-1));if(i==="span"&&/\sdata-stx-scope\s*=/.test(l[0]?.token||""))return null;let c=0,y=!1;for(let E of l){if(c+=E.token.startsWith("</")?-1:1,c<0)return null;if(c===0){if(e.slice(E.end).trim())return null;y=!0;break}}if(!y)return null;let v=t[0].length;return e.slice(0,v)+n+e.slice(v)}function vo(e,n){if(!e)return!1;return[...n.additionalComponentsDirs??[],...n.fallbackComponentsDir?[n.fallbackComponentsDir]:[]].some((i)=>{let a=ce.relative(ce.resolve(i),ce.resolve(e));return!a.startsWith("..")&&!ce.isAbsolute(a)})}async function Cr(e,n,t,i,a){let l=e.endsWith(".stx")?e.slice(0,-4):e,c=(se)=>se.split("-").map((ue)=>ue.charAt(0).toUpperCase()+ue.slice(1)).join(""),y=t.__importedComponents;if(y){for(let se of[l,l.toLowerCase(),c(l),H(l)])if(y.has(se))return!0}let v=[...new Set([`${l}.stx`,`${c(l)}.stx`,`${H(l)}.stx`])],E=typeof a.root==="string"?ce.resolve(a.root):void 0,R=E??ce.dirname(i),M=[],N=(se)=>{if(se&&!M.includes(se))M.push(se)},j=t.__originalFilePath;if(j)N(ce.join(ce.dirname(j),"components"));if(vo(n,a))N(a._rootComponentsDir);N(n),N(a._rootComponentsDir),N(ce.join(ce.dirname(i),"components")),N(a.componentsDir);for(let se of a.additionalComponentsDirs??[])N(se);let P=a._targetComponentFallbackNames?.some((se)=>se.toLowerCase()===l.toLowerCase());if(!P)for(let se of a._targetComponentDirs??[])N(se);if(E)N(ce.resolve(E,"resources/views/components")),N(ce.resolve(E,"resources/components")),N(ce.resolve(E,"src/components")),N(ce.resolve(E,"components"));for(let se of a._layerComponentDirs??[])N(se);let D=a._pluginComponentDirs;if(Array.isArray(D))for(let se of D)N(typeof se==="string"?se:null);if(N(a.fallbackComponentsDir),P)for(let se of a._targetComponentDirs??[])N(se);let X=a._nativePrimitivesFallback;if(X&&!X.except.some((se)=>se.toLowerCase()===l.toLowerCase()))N(X.dir);if(l.startsWith("./")||l.startsWith("../"))return r(ce.resolve(ce.dirname(i),`${l}.stx`));let F=ho(ce.resolve(import.meta.dir,"components")),L=M.map((se)=>ce.isAbsolute(se)?se:ce.resolve(R,se)),Q=`${v.join("\x00")}\x00\x00${L.join("\x00")}`,te=Ys.get(Q);if(te!==void 0)return te;let ae=!1;e:for(let se of L){if(ho(se)===F)continue;for(let ue of v)if(await r(ce.join(se,ue))){ae=!0;break e}}return Ys.set(Q,ae),ae}function ho(e){let n=Qs.get(e);if(n!==void 0)return n;let t=e;try{t=Xn.realpathSync(e)}catch{}return Qs.set(e,t),t}function dg(e){return e==="visible"||e==="idle"||e==="interaction"||e.startsWith("media:")}function Kc(e){if(!e)return!1;let n=e.replace(/<script[\s\S]*?<\/script>/gi,"").replace(/<style[\s\S]*?<\/style>/gi,"");return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(n)}function jl(e,n,t){if(!e.includes("{{")&&!e.includes("{!!"))return e;let i=(a,l)=>{let c;try{c=T(a,n)}catch{return l}if(c===void 0||c===null)return"";let y=String(c);if(/<\/style/i.test(y))return console.warn(`[stx] a <style> expression in ${t??"<unknown>"} evaluated to CSS containing a closing style tag, which would end the element early, so it was dropped rather than emitted.`),"";return y};return e.replace(/\{!!([\s\S]*?)!!\}/g,(a,l)=>i(l,a)).replace(/\{\{([\s\S]*?)\}\}/g,(a,l)=>i(l,a))}var xo=new Set;function bo(e,n,t,i){let a=`${e}\x00${n}\x00${i??""}`;if(!process.env.STX_DEBUG&&xo.has(a))return;xo.add(a);let l=n?` used in ${n}`:"",c=i?` Cause: ${i}.`:"",y=t.length>0?`
293
+ Tip: prefer useRef(), navigate(), and composables for component code`;if(Ks.set(l,j),console.warn(j),a.failOnViolation)throw new q(j,i??n)}var $l=[{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"}],vl=[{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')"}],El=[{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 sg(e){let n=[],t=[];return kl(e,n),Rl(e,n,t),Cl(e,t),Tl(e,n),{valid:n.length===0,errors:n,warnings:t}}function kl(e,n){let t=(e.match(/\{\{/g)||[]).length,i=(e.match(/\}\}/g)||[]).length;if(t!==i)n.push({type:"expression",message:`Unclosed expression brackets: found ${t} opening '{{' and ${i} closing '}}'`,suggestion:"Ensure every {{ has a matching }}"})}function Rl(e,n,t){for(let i of $l){let a=new RegExp(`${i.open}(?:\\s|\\()`,"g"),l=new RegExp(i.close,"g"),c=(e.match(a)||[]).length,y=(e.match(l)||[]).length;if(i.altClose){let v=new RegExp(i.altClose,"g");y+=(e.match(v)||[]).length}if(c>y)n.push({type:"directive",message:`Unclosed @${i.name} directive: found ${c} opening and ${y} closing`,suggestion:`Add ${c-y} missing ${i.close} tag(s)`});else if(y>c)t.push({type:"directive",message:`Extra ${i.close} found: ${y-c} more closing than opening`,suggestion:`Check for orphaned ${i.close} tags`})}}function Cl(e,n){for(let t of vl)if(t.pattern.test(e))n.push({type:"syntax",message:t.message,suggestion:t.suggestion})}function Tl(e,n){for(let t of El)if(t.pattern.test(e))n.push({type:"expression",message:`Security warning: ${t.message}`,suggestion:"Remove dangerous code from template expressions"})}function og(e,n){let t=e.slice(0,n).split(`
294
+ `);return{line:t.length,column:t[t.length-1].length+1}}function ig(e,n,t){let i=[];switch(e){case"if":case"elseif":case"unless":if(t.length===0)i.push({type:"syntax",message:`@${e} requires a condition`,suggestion:`Use @${e}(condition)`});break;case"foreach":if(t.length===0||!t[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(t.length===0)i.push({type:"syntax",message:"@for requires loop parameters",suggestion:"Use @for(let i = 0; i < 10; i++)"});break;case"switch":if(t.length===0)i.push({type:"syntax",message:"@switch requires an expression",suggestion:"Use @switch(expression)"});break;case"case":if(t.length===0)i.push({type:"syntax",message:"@case requires a value",suggestion:"Use @case(value)"});break;case"include":case"extends":case"component":if(t.length===0)i.push({type:"syntax",message:`@${e} requires a path`,suggestion:`Use @${e}('path/to/template')`});break}return i}function ag(e){return/@[a-z]+/i.test(e)||/\{\{/.test(e)}function cg(e){let n=e.matchAll(/@([a-z]+)/gi),t=new Set;for(let i of n){let a=i[1].toLowerCase();if(!a.startsWith("end"))t.add(a)}return Array.from(t)}function ho(e,n,t){let i=/^<script\b([^>]*)>/i.exec(e);if(!i||!/(?:^|\s)src\s*=/i.test(i[1]??""))return null;return _(i[0],n,t)+e.slice(i[0].length)}var sn=new U(500),Xs=new Map;function xo(e){try{let n=Xn.statSync(e);return`${n.size}:${n.mtimeMs}`}catch{return""}}var Zn=new U(1000),Ys=new U(2000),Qs=new U(500),ko=33554432,er=ko;function Al(e){let n=e.componentRenderCacheBytes;if(typeof n!=="number"||n<0||n===er)return;er=n,qn.setMaxBytes(n)}var qn=new U(2000,{maxBytes:ko,sizeOf:(e)=>e.output.length});function Il(e){let n=new WeakSet;try{let t=(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(n.has(i))throw TypeError("Circular component input");n.add(i);try{if(i instanceof Date)return{__stxType:"date",value:i.toISOString()};if(Array.isArray(i))return i.map(t);let a=Object.getPrototypeOf(i);if(a!==Object.prototype&&a!==null)throw TypeError("Non-plain component input");let l={};for(let c of Object.keys(i).sort())l[c]=t(i[c]);return l}finally{n.delete(i)}};return JSON.stringify(t(e))}catch{return null}}function Pl(e){let n={};for(let[t,i]of Object.entries(e))if(!t.startsWith("__")||t==="__stxServeContext")n[t]=i;return n}function Zs(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Hs(e){let n=process.cwd(),t=`${n}\x00${e}`,i=bo.get(t);if(i===void 0)i=Bun.hash(Ro(e,n).split(ce.sep).join("/")).toString(36).slice(0,6),bo.set(t,i);return i}var bo=new Map;function Ro(e,n){if(!ce.isAbsolute(e))return e;let t=(i)=>{try{return Xn.realpathSync(i)}catch{return i}};return ce.relative(t(n),t(e))}function lg(e){return/\bjs\b/.test(e)||/\blang\s*=\s*["']?(js|javascript)["']?/i.test(e)}function je(e){return!lg(e)}var Kn=new Map;function Y(e){let n;try{n=JSON.stringify(e)}catch{return new Bun.Transpiler(e)}let t=Kn.get(n);if(t)return t;if(Kn.size>=16)Kn.clear();let i=new Bun.Transpiler(e);return Kn.set(n,i),i}var yo=new WeakMap,Ol=256;function Be(e){try{let n=Y({loader:"ts",target:"browser",define:C()}),t=yo.get(n);if(!t)t=new Map,yo.set(n,t);let i=t.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 l=[];a=a.replace(/\{!![\s\S]*?!!\}/g,(y)=>{let v=l.length;return l.push(y),`"__STX_EXPR_${v}__"`}),a=a.replace(/\{\{\{[\s\S]*?\}\}\}/g,(y)=>{let v=l.length;return l.push(y),`"__STX_EXPR_${v}__"`}),a=a.replace(/\{\{[\s\S]*?\}\}/g,(y)=>{let v=l.length;return l.push(y),`"__STX_EXPR_${v}__"`});let c=n.transformSync(a);for(let y=0;y<l.length;y++)c=c.replace(`"__STX_EXPR_${y}__"`,l[y]),c=c.replace(`'__STX_EXPR_${y}__'`,l[y]);if(t.size>=Ol){let y=t.keys().next();if(!y.done)t.delete(y.value)}return t.set(e,c),c}catch(n){if(process.env.STX_DEBUG_TS)console.warn("[STX] TypeScript transpilation error:",n);return e}}function Ml(e){let n=[],t=new Set,i=0,a=0,l=e.length,c=(j)=>{a++;while(a<l){if(e[a]==="\\"){a+=2;continue}if(e[a]===j){a++;return}a++}},y=()=>{a++;while(a<l){if(e[a]==="\\"){a+=2;continue}if(e[a]==="`"){a++;return}if(e[a]==="$"&&e[a+1]==="{"){a+=2;let j=1;while(a<l&&j>0)if(e[a]==="{")j++,a++;else if(e[a]==="}")j--,a++;else if(e[a]==="'"||e[a]==='"')c(e[a]);else if(e[a]==="`")y();else a++;continue}a++}},v=()=>{if(e[a]==="/"&&e[a+1]==="/"){while(a<l&&e[a]!==`
295
+ `)a++;return!0}if(e[a]==="/"&&e[a+1]==="*"){a+=2;while(a<l-1&&!(e[a]==="*"&&e[a+1]==="/"))a++;return a+=2,!0}return!1},E=new Set(["return","typeof","instanceof","in","of","new","delete","void","throw","case","do","else","yield","await"]),R=()=>{let j=a-1;while(j>=0&&/\s/.test(e[j]))j--;if(j<0)return!0;let P=e[j];if("(,=:[!&|?{};+-*%<>~^".includes(P))return!0;if(!/[\w$]/.test(P))return!1;let M=j;while(M>0&&/[\w$]/.test(e[M-1]))M--;return E.has(e.slice(M,j+1))},D=()=>{a++;let j=!1;while(a<l&&e[a]!==`
296
+ `){let P=e[a];if(P==="\\"){a+=2;continue}if(P==="[")j=!0;else if(P==="]")j=!1;else if(P==="/"&&!j){a++;while(a<l&&/[a-z]/i.test(e[a]))a++;return}a++}},N=()=>{if(i!==0)return;let j=e.slice(a).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(j){let F=j[2].split(",").map((L)=>{let Q=L.trim().split(":");return Q[Q.length-1].trim()});for(let L of F)if(L&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(L)&&!t.has(L))n.push(L),t.add(L);return}let P=e.slice(a).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(P){let F=P[2];if(!t.has(F))n.push(F),t.add(F);return}let M=e.slice(a).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(M){let F=M[1];if(!t.has(F))n.push(F),t.add(F);return}let X=e.slice(a).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(X){let F=X[1];if(!t.has(F))n.push(F),t.add(F)}};while(a<l){if(v())continue;if(e[a]==="'"||e[a]==='"'){c(e[a]);continue}if(e[a]==="`"){y();continue}if(e[a]==="/"&&R()){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])))N();a++}return n}function Dl(e){let n=[],t=0,i=0,a=null;for(let l=0;l<e.length;l++){let c=e[l];if(a){if(c==="\\"){l++;continue}if(c===a)a=null;continue}if(c==='"'||c==="'"||c==="`"){a=c;continue}if(c==="("||c==="["||c==="{")t++;else if(c===")"||c==="]"||c==="}")t--;else if(c===","&&t===0)n.push(e.slice(i,l)),i=l+1}if(i<e.length)n.push(e.slice(i));return n}function jl(e){let n=0,t=null;for(let i=0;i<e.length;i++){let a=e[i];if(t){if(a==="\\"){i++;continue}if(a===t)t=null;continue}if(a==='"'||a==="'"||a==="`"){t=a;continue}if(a==="("||a==="["||a==="{")n++;else if(a===")"||a==="]"||a==="}")n--;else if(a==="="&&n===0){let l=e[i-1],c=e[i+1];if(l==="!"||l==="<"||l===">"||l==="=")continue;if(c==="="||c===">")continue;return i}}return-1}function Nl(e,n){try{let t=/=\s*(?:withDefaults\s*\([\s\S]*?defineProps|defineProps)\b/.exec(e);if(!t)return;let i=t.index-1;while(i>=0&&/\s/.test(e[i]))i--;if(e[i]!=="}")return;let a=i,l=0,c=-1;for(;i>=0;i--){let v=e[i];if(v==="}")l++;else if(v==="{"){if(l--,l===0){c=i;break}}}if(c===-1)return;let y=e.slice(c+1,a);for(let v of Dl(y)){let E=v.trim();if(!E||E.startsWith("..."))continue;let R=jl(E);if(R===-1)continue;let D=E.slice(0,R).trim();if(!/^[A-Z_$][\w$]*$/i.test(D))continue;if(n[D]!==void 0)continue;let N=E.slice(R+1).trim();if(!N)continue;try{let j=Object.keys(n).filter(jt),P=Function(...j,`"use strict"; return (${N});`);n[D]=P(...j.map((M)=>n[M]))}catch{}}}catch{}}var Ll=new Set(["tr","td","th","thead","tbody","tfoot","caption","colgroup","col","option","optgroup","li","dt","dd","span"]);function ug(e,n){let t=e.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)<([a-zA-Z][a-zA-Z0-9-]*)/s);if(!t)return null;let i=t[2].toLowerCase();if(!Ll.has(i))return null;let a=new RegExp(`<\\/?${i}(?=[\\s/>])(?:[^>"']|"[^"]*"|'[^']*')*>`,"iy"),l=S(e,(E,R)=>(a.lastIndex=R,a.exec(E)?.index===R?a.lastIndex:-1));if(i==="span"&&/\sdata-stx-scope\s*=/.test(l[0]?.token||""))return null;let c=0,y=!1;for(let E of l){if(c+=E.token.startsWith("</")?-1:1,c<0)return null;if(c===0){if(e.slice(E.end).trim())return null;y=!0;break}}if(!y)return null;let v=t[0].length;return e.slice(0,v)+n+e.slice(v)}function Co(e,n){if(!e)return!1;return[...n.additionalComponentsDirs??[],...n.fallbackComponentsDir?[n.fallbackComponentsDir]:[]].some((i)=>{let a=ce.relative(ce.resolve(i),ce.resolve(e));return!a.startsWith("..")&&!ce.isAbsolute(a)})}async function Er(e,n,t,i,a){let l=e.endsWith(".stx")?e.slice(0,-4):e,c=(te)=>te.split("-").map((le)=>le.charAt(0).toUpperCase()+le.slice(1)).join(""),y=t.__importedComponents;if(y){for(let te of[l,l.toLowerCase(),c(l),H(l)])if(y.has(te))return!0}let v=[...new Set([`${l}.stx`,`${c(l)}.stx`,`${H(l)}.stx`])],E=typeof a.root==="string"?ce.resolve(a.root):void 0,R=E??ce.dirname(i),D=[],N=(te)=>{if(te&&!D.includes(te))D.push(te)},j=t.__originalFilePath;if(j)N(ce.join(ce.dirname(j),"components"));if(Co(n,a))N(a._rootComponentsDir);N(n),N(a._rootComponentsDir),N(ce.join(ce.dirname(i),"components")),N(a.componentsDir);for(let te of a.additionalComponentsDirs??[])N(te);let P=a._targetComponentFallbackNames?.some((te)=>te.toLowerCase()===l.toLowerCase());if(!P)for(let te of a._targetComponentDirs??[])N(te);if(E)N(ce.resolve(E,"resources/views/components")),N(ce.resolve(E,"resources/components")),N(ce.resolve(E,"src/components")),N(ce.resolve(E,"components"));for(let te of a._layerComponentDirs??[])N(te);let M=a._pluginComponentDirs;if(Array.isArray(M))for(let te of M)N(typeof te==="string"?te:null);if(N(a.fallbackComponentsDir),P)for(let te of a._targetComponentDirs??[])N(te);let X=a._nativePrimitivesFallback;if(X&&!X.except.some((te)=>te.toLowerCase()===l.toLowerCase()))N(X.dir);if(l.startsWith("./")||l.startsWith("../"))return s(ce.resolve(ce.dirname(i),`${l}.stx`));let F=_o(ce.resolve(import.meta.dir,"components")),L=D.map((te)=>ce.isAbsolute(te)?te:ce.resolve(R,te)),Q=`${v.join("\x00")}\x00\x00${L.join("\x00")}`,ee=Ys.get(Q);if(ee!==void 0)return ee;let re=!1;e:for(let te of L){if(_o(te)===F)continue;for(let le of v)if(await s(ce.join(te,le))){re=!0;break e}}return Ys.set(Q,re),re}function _o(e){let n=Qs.get(e);if(n!==void 0)return n;let t=e;try{t=Xn.realpathSync(e)}catch{}return Qs.set(e,t),t}function dg(e){return e==="visible"||e==="idle"||e==="interaction"||e.startsWith("media:")}function Xc(e){if(!e)return!1;let n=e.replace(/<script[\s\S]*?<\/script>/gi,"").replace(/<style[\s\S]*?<\/style>/gi,"");return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(n)}function Bl(e,n,t){if(!e.includes("{{")&&!e.includes("{!!"))return e;let i=(a,l)=>{let c;try{c=T(a,n)}catch{return l}if(c===void 0||c===null)return"";let y=String(c);if(/<\/style/i.test(y))return console.warn(`[stx] a <style> expression in ${t??"<unknown>"} evaluated to CSS containing a closing style tag, which would end the element early, so it was dropped rather than emitted.`),"";return y};return e.replace(/\{!!([\s\S]*?)!!\}/g,(a,l)=>i(l,a)).replace(/\{\{([\s\S]*?)\}\}/g,(a,l)=>i(l,a))}var wo=new Set;function So(e,n,t,i){let a=`${e}\x00${n}\x00${i??""}`;if(!process.env.STX_DEBUG&&wo.has(a))return;wo.add(a);let l=n?` used in ${n}`:"",c=i?` Cause: ${i}.`:"",y=t.length>0?`
289
297
  searched:
290
298
  ${t.map((v)=>` - ${v}`).join(`
291
- `)}`:"";console.error(`[stx] component <${e}> could not be resolved${l}, so it rendered as nothing.${c}${y}`)}function yo(e){return`<!-- stx: component "${e.replace(/--+/g,"-")}" could not be resolved; see the server log -->`}var Nl=new Set(["for","if","show","key","ref","class","className","style"]),_o=new Set,Eo="useMediaQuery|useDark|usePreferredDark|usePreferredLight|usePreferredReducedMotion|usePreferredContrast|useDocumentVisibility|useScrollLock",Xc=new RegExp(`\\b(?:${Eo})\\s*(?:<[^>]*>)?\\s*\\(`);function hi(e){let n=new Set,t=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|${Eo})\\s*(?:<[^>]*>)?\\s*\\(`,"g");for(let i of e){let a;while((a=t.exec(i))!==null)n.add(a[1]);t.lastIndex=0}return[...n]}async function Fe(e,n,t,i,a,l,c,y=new Set,v,E=rt(a),R,M=e){let{extractVariables:N}=await o("stx/variable-extractor",()=>import("./chunk-zsjw2jgy.js")),j=y??new Set;if(j.has(e))return`[Circular component reference: ${e}]`;let P=new Set(j);P.add(e);let D=typeof n.client==="string"?n.client.trim():"";if("client"in n)delete n.client;let X=D&&D!=="load"&&dg(D)?D:"";try{let F=(ne)=>ne.split("-").map((le)=>le.charAt(0).toUpperCase()+le.slice(1)).join(""),L=M.endsWith(".stx")?M.slice(0,-4):M,Q=null,te=a.__importedComponents;if(te){let ne=[L,L.toLowerCase(),F(L),H(L)];for(let le of ne)if(te.has(le)){Q=te.get(le);break}}let ae=[];if(!Q){let ne=[`${L}.stx`,`${F(L)}.stx`,`${H(L)}.stx`],le=[...new Set(ne)],ye=a.__originalFilePath,he=[];if(he.push(...c._layerComponentDirs??[]),ye){let be=ce.join(ce.dirname(ye),"components");he.push(be)}let He=c._rootComponentsDir;if(typeof He==="string"&&vo(i,c)&&!he.includes(He))he.push(He);if(i&&!he.includes(i))he.push(i);if(typeof He==="string"&&!he.includes(He))he.push(He);let Ce=ce.join(ce.dirname(l),"components");if(!he.includes(Ce))he.push(Ce);if(c.componentsDir&&c.componentsDir!==i&&!he.includes(c.componentsDir))he.push(c.componentsDir);for(let be of c.additionalComponentsDirs??[])if(be&&!he.includes(be))he.push(be);let ot=c._nativeHostAttrs&&/^(?:checkbox|switch)$/i.test(L),ct=(R?.events??[]).map((be)=>be.replace(/^@/,"").split(".")[0].toLowerCase().replace(/-/g,"")),yt=Object.hasOwn(n,"checked")||Boolean(R?.reactiveProps?.includes("checked")),ss=Object.hasOwn(n,"value")||Boolean(R?.reactiveProps?.includes("value")),rs=!ct.includes("valuechange")&&(yt||ct.includes("change")&&!ss),gt=c._nativeHostAttrs&&/^textinput$/i.test(L),_t=ct.includes("update:value")&&!ct.includes("input"),qt=c._nativeHostAttrs&&/^video$/i.test(L),is=c._nativeHostAttrs&&/^image$/i.test(L),_n=Ns([...Object.keys(n),...R?.reactiveProps??[]],R?.events,n),wt=Object.hasOwn(n,"src")||Boolean(R?.reactiveProps?.includes("src")),Sn=Object.hasOwn(n,"source")||Boolean(R?.reactiveProps?.includes("source")),$n=qt&&wt&&!Sn&&(R?.events??[]).every((be)=>/^(?:play|pause|ended|timeupdate|loadedmetadata|loadstart|error)$/.test(be.replace(/^@/,"").split(".")[0])),mt=(be)=>Object.hasOwn(n,be)||Boolean(R?.reactiveProps?.includes(be)),En=c._nativeHostAttrs&&/^button$/i.test(L)&&(mt("symbol")||mt("iconOnly")||mt("title")&&!mt("label")&&!t.trim()),Xt=c._targetComponentFallbackNames?.some((be)=>be.toLowerCase()===L.toLowerCase())&&(!ot||rs)&&(!gt||_t)&&(!qt||$n)&&(!is||_n)&&!En;for(let be of Xt?[]:c._targetComponentDirs??[])if(be&&!he.includes(be))he.push(be);let St=typeof c.root==="string"?ce.resolve(c.root):void 0,Bo=St??ce.dirname(l),$t=[];if(St)$t.push(ce.resolve(St,"resources/views/components")),$t.push(ce.resolve(St,"resources/components")),$t.push(ce.resolve(St,"src/components")),$t.push(ce.resolve(St,"components"));$t.push(ce.resolve(import.meta.dir,"components"));for(let be of $t)if(!he.includes(be))he.push(be);let ar=c._pluginComponentDirs;if(Array.isArray(ar)){for(let be of ar)if(typeof be==="string"&&!he.includes(be))he.push(be)}if(c.fallbackComponentsDir&&!he.includes(c.fallbackComponentsDir))he.push(c.fallbackComponentsDir);if(Xt){for(let be of c._targetComponentDirs??[])if(be&&!he.includes(be))he.push(be)}let kn=c._nativePrimitivesFallback;if(kn&&!kn.except.some((be)=>be.toLowerCase()===L.toLowerCase())&&!he.includes(kn.dir))he.push(kn.dir);let cr=[...new Set(he.map((be)=>{if(!be)return be;return ce.isAbsolute(be)?be:ce.resolve(Bo,be)}))];he.length=0,he.push(...cr);let os=`${L}\x00${l}\x00${cr.join("\x00")}`,as=Zn.get(os);if(as)if(await r(as))Q=as;else Zn.delete(os);if(!Q&&(L.startsWith("./")||L.startsWith("../")))Q=ce.resolve(ce.dirname(l),`${L}.stx`),ae.push(Q);else if(!Q)for(let be of he){if(!be)continue;for(let Rn of le){let Cn=ce.join(be,Rn);if(ae.push(Cn),await r(Cn)){Q=Cn;break}}if(Q)break;if(!Q)try{let Rn=await import("fs");if(!Rn.statSync(be,{throwIfNoEntry:!1})?.isDirectory())continue;let zo=8,cs=[{path:be,depth:0}];while(cs.length>0&&!Q){let Tn=cs.pop();if(Tn.depth>=zo)continue;let lr;try{lr=Rn.readdirSync(Tn.path,{withFileTypes:!0})}catch{continue}for(let An of lr){if(!An.isDirectory())continue;if(An.name==="node_modules"||An.name.startsWith("."))continue;let ur=ce.join(Tn.path,An.name);for(let Wo of le){let ls=ce.join(ur,Wo);if(ae.push(ls),await r(ls)){Q=ls;break}}if(Q)break;cs.push({path:ur,depth:Tn.depth+1})}}}catch{}if(Q)break}if(Q)Zn.set(os,Q)}if(!Q||!await r(Q))return bo(e,l,ae),yo(e);v.add(Q);let se;if(sn.has(Q)&&Js.get(Q)===po(Q))se=sn.get(Q);else try{let ne=po(Q);se=await Bun.file(Q).text(),sn.set(Q,se),Js.set(Q,ne)}catch(ne){let le=ne instanceof Error?ne.message:String(ne);return bo(e,l,[Q],le),yo(e)}if(R)for(let ne of new Set([...Object.keys(n),...R.reactiveProps??[]])){let le=ne.toLowerCase();if(le.startsWith("aria-")||le.startsWith("data-"))continue;let ye=ne.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(new RegExp(`\\b${ye}\\b`).test(se))R.declaredProps.add(ne);if(new RegExp(`\\$props\\s*(?:\\.\\s*${ye}\\b|\\[\\s*['"]${ye}['"]\\s*\\])`).test(se)||new RegExp(`\\buseReactiveProp\\s*\\(\\s*['"]${ye}['"]`).test(se))R.consumedProps?.add(ne)}if(R?.reactiveProps?.length&&/\bdefineProps\s*(?:<[^>]*>)?\s*\(/.test(se))for(let ne of R.reactiveProps){if(Nl.has(ne)||R.consumedProps?.has(ne))continue;if(new RegExp(`\\buse(?:ReactiveProp|Model)\\s*\\(\\s*['"]${ne.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(se))continue;let le=`${Q}\x00${ne}`;if(_o.has(le))continue;_o.add(le),console.warn(`[stx] ${ce.basename(Q)} reads \`${ne}\` with defineProps(), which is not live, but ${ce.basename(l)} binds it (:${ne}): 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('${ne}').`)}let ue=new Set(["__originalFilePath","__importedComponents",jn,"__stx_client_signal_names","__stx_client_declared_names","__stx_runtime_config","__stxServeContext","__stx_scope_seq"]),Ee={};for(let[ne,le]of Object.entries(a))if(!ne.startsWith("__")||ue.has(ne))Ee[ne]=le;let Te=E.length>0?{[Fn]:[...E]}:{},Ae=t;if(t.includes("@include")){let{processIncludes:ne}=await o("stx/includes",()=>import("./chunk-vaqqch06.js"));Ae=await ne(t,a,l,c,v)}if(/<[A-Z][\w.-]*[\s/>]/.test(Ae)){let{processComponents:ne}=await o("stx/component-renderer",()=>import("./chunk-0ppx28f6.js")),le={...a,__processedComponents:j,...Te};Ae=await ne(Ae,le,l,c,v);let ye=le.__stx_preserved_client_expressions;if(Array.isArray(ye)&&ye.length>0)a.__stx_preserved_client_expressions=[...new Set([...Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[],...ye])]}let ke=[];if(Kc(Ae)){let{processExpressions:ne}=await o("stx/expressions",()=>import("./chunk-1aent61q.js")),le=a.__stx_signals_gate===void 0?{...a,__stx_signals_gate:!0,...Te}:E.length>0?{...a,...Te}:a;Ae=ne(Ae,le,l);for(let ye of Ae.matchAll(/\{\{([\s\S]*?)\}\}/g))ke.push(ye[1].trim())}let Je=G(Ae),ut=[],Tt=Je.output.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(ne,le)=>{let ye=Je.scripts[Number(le)]||"",he=ye.match(/^<script\b([^>]*)>/i)?.[1]||"",He=he.match(/\btype\s*=\s*["']([^"']+)["']/i)?.[1]?.toLowerCase(),Ce=!He||["module","text/javascript","application/javascript"].includes(He),ot=/\sdata-stx-(?:owner|instance)(?=[\s=/>])/i.test(` ${he}`);if(!/\bserver\b/i.test(he)&&Ce&&!ot)return ut.push(ye),"";return ye}),{extractSlotContent:Gn}=await o("stx/slots",()=>import("./chunk-8698v9gf.js")),ft=Gn(Tt),dt={};if(ft.defaultSlot?.trim())dt.default=ft.defaultSlot;for(let[ne,le]of ft.namedSlots)dt[ne]=le.content;let pt=a.__stx_scope_seq??={n:0,key:zs(String(a.__filename??l))},Lt=$o(e,process.cwd()),st=`stx_${(Lt.endsWith(".stx")?Lt.slice(0,-4):Lt).replace(/[^a-zA-Z0-9]/g,"_")}_${++pt.n}_${pt.key}`,Ue={...Ee,$uid:st,$native:c._nativeHostAttrs===!0,...n,props:n,slot:Tt,$slots:dt,__processedComponents:P,__sections:{},__stx_signals_gate:Se(se)||Kc(t),__stx_preserved_client_expressions:[...Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[],...ke]};Ml(se,Ue);let Bt=se,on=de(Bt);if(on)Bt=on.content.trim();let Yn=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,zt=[...se.matchAll(Yn)];for(let[,ne,le]of zt)if(!/\bserver\b|\bsrc\s*=|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/i.test(ne))Oe(le,Q,c.strict);let qe=[],Wt=null,Qn=zt.some((ne)=>/\bserver\b/.test(ne[1]||"")&&/\bcache\b/.test(ne[1]||"")),bt=null,Qe=null,Ft=null,an=0,Vt=null;if(Rl(c),Qn&&er>0){let ne=Cl({props:n,slot:Ae,slotContext:t.trim()?Tl(Ee):void 0,buildMode:c.buildMode??"",skipEventDirectives:c.skipEventDirectives===!0,native:c._nativeHostAttrs===!0,clientLoopNames:[...E].sort(),layers:c._layerGraph?.layers.map((le)=>le.configFile),uid:st});if(ne!==null){bt=`${Q}\x00${x(se)}\x00${ne}`;let le=qn.get(bt);if(le){for(let ye of le.dependencies)v.add(ye);if(Qr(a,le.clientFactories),pt.n+=le.uidsConsumed,le.preservedClientExpressions.length>0){let ye=new Set(Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[]);for(let he of le.preservedClientExpressions)ye.add(he);a.__stx_preserved_client_expressions=[...ye]}return le.output}Qe=new Set(v),Ft=Gr(a),an=pt.n,Vt=new Set(Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[])}}let Ut=new Set;for(let ne of zt){let le=ne[1]||"",ye=ne[2]||"",he=le.includes("server");if(je(le)&&ye.trim())ye=Be(ye);if(he&&ye){for(let Ce of Me(ye))Ut.add(Ce);try{await N(ye,Ue,Q,{onFailure:(Ce)=>{if(Ce.kind!=="unknown")Wt=Ce.kind}})}catch(Ce){}}if(!he){let Ce=ye.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),ot=Ce.includes("{{")&&Ce.includes("}}"),ct=Ce.includes("{!!")&&Ce.includes("!!}");if(ot||ct)Ce=bi(Ce,Ue,Q);let yt=le.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");qe.push(`<script${yt}>${Ce}</script>`)}}let Xe=G(se).output.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),Ht=Xe?Xe[1]:"",es=Xe?Xe[2]:"",et="",ee=Ht&&/\bscoped\b/i.test(Ht);if(Xe)et=`<style${Ht}>${jl(es,Ue,Q)}</style>`;let re=Bt;if(re=re.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),Xe)re=re.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let ne=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,le=[];if(re=re.replace(ne,(ye,he)=>{let He=he.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(He)le.push(`<style${He[1]}>${He[2]}</style>`);return""}),re=re.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),le.length>0)et=`${et}${le.join(`
292
- `)}`}if(t&&re.includes("{{ text || slot }}"))re=re.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>t);let{applySlots:me}=await o("stx/slots",()=>import("./chunk-8698v9gf.js")),{defaultSlot:we,namedSlots:Re}=ft,Ke=a.__stx_signals_gate===!0&&/\s(?:@[\w:.-]+|x-on:[\w:.-]+)\s*=/.test(Tt),tt=c._nativeHostAttrs===!0&&qe.length>0||Ke&&qe.length>0||qe.some((ne)=>/\b(?:state|derived|effect|ref|useRef|reactive|computed|watch|watchEffect|useModel|useReactiveProp|onMount|onDestroy|defineProps|withDefaults|defineEmits|defineExpose|defineSlots)\s*(?:<[^<>()]*>)?\s*\(/.test(ne)),ts=(ne)=>tt?Vi(ne,st):ne,ns=new Map([...Re].map(([ne,le])=>[ne,{...le,content:ts(le.content)}]));re=await me(re,ts(we),ns,Ue,tt?st:"");let cn=hi(qe),Kt=(Array.isArray(Ue.__stx_client_signal_names)?Ue.__stx_client_signal_names:[]).filter((ne)=>!Ut.has(ne));if(cn.length>0||Kt.length>0)Ue.__stx_client_signal_names=[...new Set([...Kt,...cn])];else delete Ue.__stx_client_signal_names;let Zt=E.filter((ne)=>!Ut.has(ne)&&!(ne in n));if(Zt.length>0)Ue[Fn]=Zt;let ln={...c,_rootComponentsDir:c._rootComponentsDir||c.componentsDir,componentsDir:ce.dirname(Q),skipSignalsRuntime:!0,skipEventDirectives:c._nativeHostAttrs===!0||tt||qe.length===0,defaultLayout:void 0};Ue.__stxProcessingDepth=(a.__stxProcessingDepth||0)+1;let{processDirectives:un}=await o("stx/process",()=>import("./chunk-nptp3x62.js")),Ge=await un(re,Ue,Q,ln,v),it=new Set(Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[]);for(let ne of Ge.matchAll(/\{\{([\s\S]*?)\}\}/g))it.add(ne[1].trim());if(it.size>0)a.__stx_preserved_client_expressions=[...it];let nt=st,Ze=Ge;if(tt){let ne="";if(Object.keys(n).length>0)try{ne=` data-stx-props="${Zs(JSON.stringify(n))}"`}catch{}let le=X?` stx-hydrate="${Zs(X)}"`:"",ye=Object.fromEntries(Object.entries(dt).map(([gt,_t])=>[gt,Boolean(_t)])),he=Object.keys(ye).length>0?` data-stx-slots="${Zs(JSON.stringify(ye))}"`:"",He=` data-stx-scope="${nt}"${ne}${he}${le}`,Ce=/^\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*<span(?=[\s/>])/i.test(Ge),ot=/^\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*<[^>]+\bdata-stx-layout-root(?:\s|=|>)/i.test(Ge),ct=/^\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*<[^>]+\bdata-stx-fill-root(?:\s|=|>)/i.test(Ge),yt=Ce?"span":"div",ss=ot&&c._nativeHostAttrs?' style="display:flex;flex-direction:column;flex:1;min-height:0;min-width:0"':ct&&c._nativeHostAttrs?' style="width:100%;height:100%"':Ce||ot?' style="display:contents"':"";Ze=ug(Ge,He)??`<${yt}${He} data-stx-component-wrapper${ss}>${Ge}</${yt}>`;let rs=await Promise.all(qe.map(async(gt)=>{let _t=gt.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!_t)return gt;let[,qt,is]=_t,_n=fo(gt,Ue,Q);if(_n!==null)return _n;let wt=await Bl(is,Q,c.buildMode==="compile"),Sn=yn(wt.clientCode,De(Ue)),{vendorStyleTags:$n}=wt,mt=Sn?`function(__scopeId) {
299
+ `)}`:"";console.error(`[stx] component <${e}> could not be resolved${l}, so it rendered as nothing.${c}${y}`)}function $o(e){return`<!-- stx: component "${e.replace(/--+/g,"-")}" could not be resolved; see the server log -->`}var zl=new Set(["for","if","show","key","ref","class","className","style"]),vo=new Set,To="useMediaQuery|useDark|usePreferredDark|usePreferredLight|usePreferredReducedMotion|usePreferredContrast|useDocumentVisibility|useScrollLock",Gc=new RegExp(`\\b(?:${To})\\s*(?:<[^>]*>)?\\s*\\(`);function yi(e){let n=new Set,t=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|${To})\\s*(?:<[^>]*>)?\\s*\\(`,"g");for(let i of e){let a;while((a=t.exec(i))!==null)n.add(a[1]);t.lastIndex=0}return[...n]}async function Fe(e,n,t,i,a,l,c,y=new Set,v,E=rt(a),R,D=e){let{extractVariables:N}=await o("stx/variable-extractor",()=>import("./chunk-axq3c7cb.js")),j=y??new Set;if(j.has(e))return`[Circular component reference: ${e}]`;let P=new Set(j);P.add(e);let M=typeof n.client==="string"?n.client.trim():"";if("client"in n)delete n.client;let X=M&&M!=="load"&&dg(M)?M:"";try{let F=(se)=>se.split("-").map((ue)=>ue.charAt(0).toUpperCase()+ue.slice(1)).join(""),L=D.endsWith(".stx")?D.slice(0,-4):D,Q=null,ee=a.__importedComponents;if(ee){let se=[L,L.toLowerCase(),F(L),H(L)];for(let ue of se)if(ee.has(ue)){Q=ee.get(ue);break}}let re=[];if(!Q){let se=[`${L}.stx`,`${F(L)}.stx`,`${H(L)}.stx`],ue=[...new Set(se)],ye=a.__originalFilePath,he=[];if(he.push(...c._layerComponentDirs??[]),ye){let be=ce.join(ce.dirname(ye),"components");he.push(be)}let He=c._rootComponentsDir;if(typeof He==="string"&&Co(i,c)&&!he.includes(He))he.push(He);if(i&&!he.includes(i))he.push(i);if(typeof He==="string"&&!he.includes(He))he.push(He);let Ae=ce.join(ce.dirname(l),"components");if(!he.includes(Ae))he.push(Ae);if(c.componentsDir&&c.componentsDir!==i&&!he.includes(c.componentsDir))he.push(c.componentsDir);for(let be of c.additionalComponentsDirs??[])if(be&&!he.includes(be))he.push(be);let lt=c._nativeHostAttrs&&/^(?:checkbox|switch)$/i.test(L),ut=(R?.events??[]).map((be)=>be.replace(/^@/,"").split(".")[0].toLowerCase().replace(/-/g,"")),_t=Object.hasOwn(n,"checked")||Boolean(R?.reactiveProps?.includes("checked")),ss=Object.hasOwn(n,"value")||Boolean(R?.reactiveProps?.includes("value")),rs=!ut.includes("valuechange")&&(_t||ut.includes("change")&&!ss),mt=c._nativeHostAttrs&&/^textinput$/i.test(L),wt=ut.includes("update:value")&&!ut.includes("input"),qt=c._nativeHostAttrs&&/^video$/i.test(L),is=c._nativeHostAttrs&&/^image$/i.test(L),_n=Ms([...Object.keys(n),...R?.reactiveProps??[]],R?.events,n),St=Object.hasOwn(n,"src")||Boolean(R?.reactiveProps?.includes("src")),Sn=Object.hasOwn(n,"source")||Boolean(R?.reactiveProps?.includes("source")),$n=qt&&St&&!Sn&&(R?.events??[]).every((be)=>/^(?:play|pause|ended|timeupdate|loadedmetadata|loadstart|error)$/.test(be.replace(/^@/,"").split(".")[0])),ht=(be)=>Object.hasOwn(n,be)||Boolean(R?.reactiveProps?.includes(be)),En=c._nativeHostAttrs&&/^button$/i.test(L)&&(ht("symbol")||ht("iconOnly")||ht("title")&&!ht("label")&&!t.trim()),Xt=c._targetComponentFallbackNames?.some((be)=>be.toLowerCase()===L.toLowerCase())&&(!lt||rs)&&(!mt||wt)&&(!qt||$n)&&(!is||_n)&&!En;for(let be of Xt?[]:c._targetComponentDirs??[])if(be&&!he.includes(be))he.push(be);let $t=typeof c.root==="string"?ce.resolve(c.root):void 0,Vo=$t??ce.dirname(l),vt=[];if($t)vt.push(ce.resolve($t,"resources/views/components")),vt.push(ce.resolve($t,"resources/components")),vt.push(ce.resolve($t,"src/components")),vt.push(ce.resolve($t,"components"));vt.push(ce.resolve(import.meta.dir,"components"));for(let be of vt)if(!he.includes(be))he.push(be);let ar=c._pluginComponentDirs;if(Array.isArray(ar)){for(let be of ar)if(typeof be==="string"&&!he.includes(be))he.push(be)}if(c.fallbackComponentsDir&&!he.includes(c.fallbackComponentsDir))he.push(c.fallbackComponentsDir);if(Xt){for(let be of c._targetComponentDirs??[])if(be&&!he.includes(be))he.push(be)}let kn=c._nativePrimitivesFallback;if(kn&&!kn.except.some((be)=>be.toLowerCase()===L.toLowerCase())&&!he.includes(kn.dir))he.push(kn.dir);let cr=[...new Set(he.map((be)=>{if(!be)return be;return ce.isAbsolute(be)?be:ce.resolve(Vo,be)}))];he.length=0,he.push(...cr);let os=`${L}\x00${l}\x00${cr.join("\x00")}`,as=Zn.get(os);if(as)if(await s(as))Q=as;else Zn.delete(os);if(!Q&&(L.startsWith("./")||L.startsWith("../")))Q=ce.resolve(ce.dirname(l),`${L}.stx`),re.push(Q);else if(!Q)for(let be of he){if(!be)continue;for(let Rn of ue){let Cn=ce.join(be,Rn);if(re.push(Cn),await s(Cn)){Q=Cn;break}}if(Q)break;if(!Q)try{let Rn=await import("fs");if(!Rn.statSync(be,{throwIfNoEntry:!1})?.isDirectory())continue;let Uo=8,cs=[{path:be,depth:0}];while(cs.length>0&&!Q){let Tn=cs.pop();if(Tn.depth>=Uo)continue;let lr;try{lr=Rn.readdirSync(Tn.path,{withFileTypes:!0})}catch{continue}for(let An of lr){if(!An.isDirectory())continue;if(An.name==="node_modules"||An.name.startsWith("."))continue;let ur=ce.join(Tn.path,An.name);for(let Ho of ue){let ls=ce.join(ur,Ho);if(re.push(ls),await s(ls)){Q=ls;break}}if(Q)break;cs.push({path:ur,depth:Tn.depth+1})}}}catch{}if(Q)break}if(Q)Zn.set(os,Q)}if(!Q||!await s(Q))return So(e,l,re),$o(e);v.add(Q);let te;if(sn.has(Q)&&Xs.get(Q)===xo(Q))te=sn.get(Q);else try{let se=xo(Q);te=await Bun.file(Q).text(),sn.set(Q,te),Xs.set(Q,se)}catch(se){let ue=se instanceof Error?se.message:String(se);return So(e,l,[Q],ue),$o(e)}if(R)for(let se of new Set([...Object.keys(n),...R.reactiveProps??[]])){let ue=se.toLowerCase();if(ue.startsWith("aria-")||ue.startsWith("data-"))continue;let ye=se.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(new RegExp(`\\b${ye}\\b`).test(te))R.declaredProps.add(se);if(new RegExp(`\\$props\\s*(?:\\.\\s*${ye}\\b|\\[\\s*['"]${ye}['"]\\s*\\])`).test(te)||new RegExp(`\\buseReactiveProp\\s*\\(\\s*['"]${ye}['"]`).test(te))R.consumedProps?.add(se)}if(R?.reactiveProps?.length&&/\bdefineProps\s*(?:<[^>]*>)?\s*\(/.test(te))for(let se of R.reactiveProps){if(zl.has(se)||R.consumedProps?.has(se))continue;if(new RegExp(`\\buse(?:ReactiveProp|Model)\\s*\\(\\s*['"]${se.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(te))continue;let ue=`${Q}\x00${se}`;if(vo.has(ue))continue;vo.add(ue),console.warn(`[stx] ${ce.basename(Q)} reads \`${se}\` with defineProps(), which is not live, but ${ce.basename(l)} binds it (:${se}): 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('${se}').`)}let le=new Set(["__originalFilePath","__importedComponents",jn,"__stx_client_signal_names","__stx_client_declared_names","__stx_runtime_config","__stxServeContext","__stx_scope_seq"]),Ee={};for(let[se,ue]of Object.entries(a))if(!se.startsWith("__")||le.has(se))Ee[se]=ue;let we=E.length>0?{[Fn]:[...E]}:{},Re=t;if(t.includes("@include")){let{processIncludes:se}=await o("stx/includes",()=>import("./chunk-k6sjqb7g.js"));Re=await se(t,a,l,c,v)}if(/<[A-Z][\w.-]*[\s/>]/.test(Re)){let{processComponents:se}=await o("stx/component-renderer",()=>import("./chunk-xbhb8102.js")),ue={...a,__processedComponents:j,...we};Re=await se(Re,ue,l,c,v);let ye=ue.__stx_preserved_client_expressions;if(Array.isArray(ye)&&ye.length>0)a.__stx_preserved_client_expressions=[...new Set([...Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[],...ye])]}let Ce=[];if(Xc(Re)){let{processExpressions:se}=await o("stx/expressions",()=>import("./chunk-s151a2dj.js")),ue=a.__stx_signals_gate===void 0?{...a,__stx_signals_gate:!0,...we}:E.length>0?{...a,...we}:a;Re=se(Re,ue,l);for(let ye of Re.matchAll(/\{\{([\s\S]*?)\}\}/g))Ce.push(ye[1].trim())}let Ke=G(Re),Je=[],Ze=Ke.output.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(se,ue)=>{let ye=Ke.scripts[Number(ue)]||"",he=ye.match(/^<script\b([^>]*)>/i)?.[1]||"",He=he.match(/\btype\s*=\s*["']([^"']+)["']/i)?.[1]?.toLowerCase(),Ae=!He||["module","text/javascript","application/javascript"].includes(He),lt=/\sdata-stx-(?:owner|instance)(?=[\s=/>])/i.test(` ${he}`);if(!/\bserver\b/i.test(he)&&Ae&&!lt)return Je.push(ye),"";return ye}),{extractSlotContent:Gn}=await o("stx/slots",()=>import("./chunk-sqettc34.js")),dt=Gn(Ze),pt={};if(dt.defaultSlot?.trim())pt.default=dt.defaultSlot;for(let[se,ue]of dt.namedSlots)pt[se]=ue.content;let gt=a.__stx_scope_seq??={n:0,key:Hs(String(a.__filename??l))},Lt=Ro(e,process.cwd()),ot=`stx_${(Lt.endsWith(".stx")?Lt.slice(0,-4):Lt).replace(/[^a-zA-Z0-9]/g,"_")}_${++gt.n}_${gt.key}`,Ue={...Ee,$uid:ot,$native:c._nativeHostAttrs===!0,...n,props:n,slot:Ze,$slots:pt,__processedComponents:P,__sections:{},__stx_signals_gate:Se(te)||Xc(t),__stx_preserved_client_expressions:[...Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[],...Ce]};Nl(te,Ue);let Bt=te,on=de(Bt);if(on)Bt=on.content.trim();let Yn=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,zt=[...te.matchAll(Yn)];for(let[,se,ue]of zt)if(!/\bserver\b|\bsrc\s*=|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/i.test(se))Oe(ue,Q,c.strict);let Ge=[],Wt=null,Qn=zt.some((se)=>/\bserver\b/.test(se[1]||"")&&/\bcache\b/.test(se[1]||"")),yt=null,tt=null,Ft=null,an=0,Vt=null;if(Al(c),Qn&&er>0){let se=Il({props:n,slot:Re,slotContext:t.trim()?Pl(Ee):void 0,buildMode:c.buildMode??"",skipEventDirectives:c.skipEventDirectives===!0,native:c._nativeHostAttrs===!0,clientLoopNames:[...E].sort(),layers:c._layerGraph?.layers.map((ue)=>ue.configFile),uid:ot});if(se!==null){yt=`${Q}\x00${x(te)}\x00${se}`;let ue=qn.get(yt);if(ue){for(let ye of ue.dependencies)v.add(ye);if(ei(a,ue.clientFactories),gt.n+=ue.uidsConsumed,ue.preservedClientExpressions.length>0){let ye=new Set(Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[]);for(let he of ue.preservedClientExpressions)ye.add(he);a.__stx_preserved_client_expressions=[...ye]}return ue.output}tt=new Set(v),Ft=Yr(a),an=gt.n,Vt=new Set(Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[])}}let Ut=new Set;for(let se of zt){let ue=se[1]||"",ye=se[2]||"",he=ue.includes("server");if(je(ue)&&ye.trim())ye=Be(ye);if(he&&ye){for(let Ae of Me(ye))Ut.add(Ae);try{await N(ye,Ue,Q,{onFailure:(Ae)=>{if(Ae.kind!=="unknown")Wt=Ae.kind}})}catch(Ae){}}if(!he){let Ae=ye.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),lt=Ae.includes("{{")&&Ae.includes("}}"),ut=Ae.includes("{!!")&&Ae.includes("!!}");if(lt||ut)Ae=wi(Ae,Ue,Q);let _t=ue.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");Ge.push(`<script${_t}>${Ae}</script>`)}}let Ye=G(te).output.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),Ht=Ye?Ye[1]:"",es=Ye?Ye[2]:"",nt="",ne=Ht&&/\bscoped\b/i.test(Ht);if(Ye)nt=`<style${Ht}>${Bl(es,Ue,Q)}</style>`;let ae=Bt;if(ae=ae.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),Ye)ae=ae.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let se=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,ue=[];if(ae=ae.replace(se,(ye,he)=>{let He=he.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(He)ue.push(`<style${He[1]}>${He[2]}</style>`);return""}),ae=ae.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),ue.length>0)nt=`${nt}${ue.join(`
300
+ `)}`}if(t&&ae.includes("{{ text || slot }}"))ae=ae.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>t);let{applySlots:me}=await o("stx/slots",()=>import("./chunk-sqettc34.js")),{defaultSlot:$e,namedSlots:Te}=dt,qe=a.__stx_signals_gate===!0&&/\s(?:@[\w:.-]+|x-on:[\w:.-]+)\s*=/.test(Ze),st=c._nativeHostAttrs===!0&&Ge.length>0||qe&&Ge.length>0||Ge.some((se)=>/\b(?:state|derived|effect|ref|useRef|reactive|computed|watch|watchEffect|useModel|useReactiveProp|onMount|onDestroy|defineProps|withDefaults|defineEmits|defineExpose|defineSlots)\s*(?:<[^<>()]*>)?\s*\(/.test(se)),ts=(se)=>st?Ui(se,ot):se,ns=new Map([...Te].map(([se,ue])=>[se,{...ue,content:ts(ue.content)}]));ae=await me(ae,ts($e),ns,Ue,st?ot:"");let cn=yi(Ge),Kt=(Array.isArray(Ue.__stx_client_signal_names)?Ue.__stx_client_signal_names:[]).filter((se)=>!Ut.has(se));if(cn.length>0||Kt.length>0)Ue.__stx_client_signal_names=[...new Set([...Kt,...cn])];else delete Ue.__stx_client_signal_names;let Zt=E.filter((se)=>!Ut.has(se)&&!(se in n));if(Zt.length>0)Ue[Fn]=Zt;let ln={...c,_rootComponentsDir:c._rootComponentsDir||c.componentsDir,componentsDir:ce.dirname(Q),skipSignalsRuntime:!0,skipEventDirectives:c._nativeHostAttrs===!0||st||Ge.length===0,defaultLayout:void 0};Ue.__stxProcessingDepth=(a.__stxProcessingDepth||0)+1;let{processDirectives:un}=await o("stx/process",()=>import("./chunk-etegf4zj.js")),Qe=await un(ae,Ue,Q,ln,v),ct=new Set(Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[]);for(let se of Qe.matchAll(/\{\{([\s\S]*?)\}\}/g))ct.add(se[1].trim());if(ct.size>0)a.__stx_preserved_client_expressions=[...ct];let it=ot,Xe=Qe;if(st){let se="";if(Object.keys(n).length>0)try{se=` data-stx-props="${Zs(JSON.stringify(n))}"`}catch{}let ue=X?` stx-hydrate="${Zs(X)}"`:"",ye=Object.fromEntries(Object.entries(pt).map(([mt,wt])=>[mt,Boolean(wt)])),he=Object.keys(ye).length>0?` data-stx-slots="${Zs(JSON.stringify(ye))}"`:"",He=` data-stx-scope="${it}"${se}${he}${ue}`,Ae=/^\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*<span(?=[\s/>])/i.test(Qe),lt=/^\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*<[^>]+\bdata-stx-layout-root(?:\s|=|>)/i.test(Qe),ut=/^\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*<[^>]+\bdata-stx-fill-root(?:\s|=|>)/i.test(Qe),_t=Ae?"span":"div",ss=lt&&c._nativeHostAttrs?' style="display:flex;flex-direction:column;flex:1;min-height:0;min-width:0"':ut&&c._nativeHostAttrs?' style="width:100%;height:100%"':Ae||lt?' style="display:contents"':"";Xe=ug(Qe,He)??`<${_t}${He} data-stx-component-wrapper${ss}>${Qe}</${_t}>`;let rs=await Promise.all(Ge.map(async(mt)=>{let wt=mt.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!wt)return mt;let[,qt,is]=wt,_n=ho(mt,Ue,Q);if(_n!==null)return _n;let St=await Fl(is,Q,c.buildMode==="compile"),Sn=yn(St.clientCode,De(Ue)),{vendorStyleTags:$n}=St,ht=Sn?`function(__scopeId) {
293
301
  ${Sn}
294
- return (${wt.factoryBody})(__scopeId);
295
- }`:wt.factoryBody,En=X?null:_s(a,mt),Xt=En?`window.__stxComponentFactories[${JSON.stringify(En)}](${JSON.stringify(nt)});`:`(${mt})(${JSON.stringify(nt)});`;if(X)return`${$n}<script type="stx/island" data-stx-island="${nt}" data-stx-scoped data-stx-owner="${nt}"${qt}>${Xt}</script>`;return`${$n}<script data-stx-scoped data-stx-run="always" data-stx-owner="${nt}"${qt}>${Xt}</script>`}));if(Ze=Ze+`
302
+ return (${St.factoryBody})(__scopeId);
303
+ }`:St.factoryBody,En=X?null:_s(a,ht),Xt=En?`window.__stxComponentFactories[${JSON.stringify(En)}](${JSON.stringify(it)});`:`(${ht})(${JSON.stringify(it)});`;if(X)return`${$n}<script type="stx/island" data-stx-island="${it}" data-stx-scoped data-stx-owner="${it}"${qt}>${Xt}</script>`;return`${$n}<script data-stx-scoped data-stx-run="always" data-stx-owner="${it}"${qt}>${Xt}</script>`}));if(Xe=Xe+`
296
304
  `+rs.join(`
297
- `),et)Ze+=`
298
- `+et}else{if(et)Ze+=`
299
- `+et;if(qe.length>0){let ne=Ue.__stx_event_bindings||[],le=De(Ue),ye=await Promise.all(qe.map(async(he)=>{let He=fo(he,Ue,Q);if(He!==null)return He;let Ce=he.match(/<script\b[^>]*>([\s\S]*?)<\/script>/);if(!Ce)return he;return await Le(Ce[1],{eventBindings:ne,templateContent:Ze,filePath:Q,projectRoot:process.cwd(),serverData:le,instanceId:st})}));Ze+=`
305
+ `),nt)Xe+=`
306
+ `+nt}else{if(nt)Xe+=`
307
+ `+nt;if(Ge.length>0){let se=Ue.__stx_event_bindings||[],ue=De(Ue),ye=await Promise.all(Ge.map(async(he)=>{let He=ho(he,Ue,Q);if(He!==null)return He;let Ae=he.match(/<script\b[^>]*>([\s\S]*?)<\/script>/);if(!Ae)return he;return await Le(Ae[1],{eventBindings:se,templateContent:Xe,filePath:Q,projectRoot:process.cwd(),serverData:ue,instanceId:ot})}));Xe+=`
300
308
  `+ye.join(`
301
- `),Ue.__stx_event_bindings=[]}}if(ee){let ne=Ls(Ze,Q);if(ne.hasScoped)Ze=ne.html}if(bt&&Qe){let ne=Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[];qn.set(bt,{output:Ze,dependencies:[...v].filter((le)=>!Qe.has(le)),clientFactories:Ft?Yr(a,Ft):[],uidsConsumed:pt.n-an,preservedClientExpressions:Vt?ne.filter((le)=>!Vt.has(le)):[]})}if(Wt)Ze=`<!--stx-render-failed:${Wt}-->${Ze}`;return ut.length>0?`${Ze}
302
- ${ut.join(`
303
- `)}`:Ze}catch(F){if(F instanceof q)throw F;return`[Error processing component: ${F instanceof Error?F.message:String(F)}]`}finally{j.delete(e)}}async function r(e){return Bun.file(e).exists()}function tr(e,n){let t=ce.resolve(n),i=ce.resolve(e),a=t.endsWith(ce.sep)?t:t+ce.sep;if(i===t||i.startsWith(a))return i;return null}async function wo(e,n,t,i){let a=n.startsWith("layouts/")?n.slice(8):n,l=ce.join(e,a);for(let c of l.endsWith(".stx")?[l]:[l,`${l}.stx`])if(await r(c)){if(i)console.log(`Found layout in ${e}: ${c}`);return t?.add(c),c}return null}async function bn(e,n,t,i){let a=await Ll(e,n,t,i);if(a===null)return null;let l=tr(a,process.cwd());if(l)return l;let c=[t.root,t.layoutsDir,t.fallbackLayoutsDir,t.componentsDir,t.partialsDir,t.pagesDir,...t._layerLayoutDirs??[]].filter((y)=>typeof y==="string"&&y.length>0);for(let y of c){let v=ce.isAbsolute(y)?y:ce.resolve(process.cwd(),y);if(tr(a,v))return ce.resolve(a)}return console.warn(`[stx] rejected resolved template path that escapes project root: ${a} (template: ${e}, from: ${n})`),null}async function Ll(e,n,t,i){if(t.debug)console.log(`Resolving template path: ${e} from ${n}`);let a=ce.dirname(n),l=process.cwd();if(e.startsWith("/")){let j=ce.join(l,e),P=tr(j,l);if(!P)return console.warn(`[stx] rejected template path that escapes project root: ${e} (from ${n})`),null;if(t.debug)console.log(`Checking absolute path: ${P}`);if(await r(P)&&i)i.add(P);return P}let c=async(j)=>{if(!t.layoutsDir||!t.fallbackLayoutsDir)return j;let P=ce.relative(ce.resolve(l,t.fallbackLayoutsDir),j);if(P.startsWith("..")||ce.isAbsolute(P))return j;return await wo(ce.resolve(l,t.layoutsDir),e,i,t.debug)??j},y=ce.join(a,e);if(await r(y)){if(t.debug)console.log(`Found direct path: ${y}`);let j=await c(y);if(i)i.add(j);return j}if(!e.endsWith(".stx")&&!e.endsWith(".jsx")&&!e.endsWith(".tsx"))for(let j of[".stx",".tsx",".jsx"]){let P=`${y}${j}`;if(await r(P)){if(t.debug)console.log(`Found direct path with extension: ${P}`);let D=await c(P);if(i)i.add(D);return D}}let v=[];if(v.push(...t._layerLayoutDirs??[]),t.layoutsDir)v.push(ce.isAbsolute(t.layoutsDir)?t.layoutsDir:ce.resolve(process.cwd(),t.layoutsDir));let E=ce.resolve(a),R=process.cwd();for(let j=0;j<10;j++){let P=ce.join(E,"layouts"),D=!1;try{D=Xn.statSync(P,{throwIfNoEntry:!1})?.isDirectory()??!1}catch{}if(D){v.push(P);break}let X=ce.dirname(E);if(X===E||X.length<R.length)break;E=X}for(let j of v){let P=await wo(j,e,i,t.debug);if(P)return P}if(t.fallbackLayoutsDir){let j=ce.isAbsolute(t.fallbackLayoutsDir)?t.fallbackLayoutsDir:ce.resolve(process.cwd(),t.fallbackLayoutsDir),P=e.startsWith("layouts/")?e.slice(8):e,D=[ce.join(j,P)];if(!e.endsWith(".stx"))D.push(`${D[0]}.stx`);for(let X of D)if(await r(X)){if(t.debug)console.log(`Found in options.fallbackLayoutsDir: ${X}`);if(i)i.add(X);return X}}if(e.startsWith("layouts/")||e.includes("/layouts/")){let j=e.split("layouts/"),P=ce.join(t.partialsDir||a,"layouts",j[1]);if(await r(P)){if(t.debug)console.log(`Found in layouts path: ${P}`);if(i)i.add(P);return P}if(!P.endsWith(".stx")){let D=`${P}.stx`;if(await r(D)){if(t.debug)console.log(`Found in layouts path with extension: ${D}`);if(i)i.add(D);return D}}}if(t.partialsDir){let j=ce.join(t.partialsDir,"layouts");if(await r(j)){let P=ce.join(j,e);if(await r(P)){if(t.debug)console.log(`Found in partials layouts dir: ${P}`);if(i)i.add(P);return P}if(!e.endsWith(".stx")){let D=`${P}.stx`;if(await r(D)){if(t.debug)console.log(`Found in partials layouts dir with extension: ${D}`);if(i)i.add(D);return D}}}}let M=t.partialsDir||ce.join(process.cwd(),"views"),N=ce.join(M,e);if(await r(N)){if(t.debug)console.log(`Found in views path: ${N}`);if(i)i.add(N);return N}if(!e.endsWith(".stx")){let j=`${N}.stx`;if(await r(j)){if(t.debug)console.log(`Found in views path with extension: ${j}`);if(i)i.add(j);return j}}if(a.includes("temp")){let j=ce.join(ce.dirname(a),"layouts",e);if(await r(j)){if(t.debug)console.log(`Found in temp layouts dir: ${j}`);if(i)i.add(j);return j}if(!e.endsWith(".stx")){let P=`${j}.stx`;if(await r(P)){if(t.debug)console.log(`Found in temp layouts dir with extension: ${P}`);if(i)i.add(P);return P}}}if(t.debug)console.warn(`Template not found after trying all paths: ${e} (referenced from ${n})`);else console.warn(`Template not found: ${e} (referenced from ${n})`);return null}function Gc(e,n,t){let i=0,a="",l="";try{if(typeof n==="number"&&n>=0){let c=e.split(`
304
- `),y=0;for(let v=0;v<c.length;v++)if(y+=c[v].length+1,y>=n){i=v+1,a=c[v].trim();let E=Math.max(0,v-2),R=Math.min(c.length,v+3);l=c.slice(E,R).map((M,N)=>{let j=E+N+1;return`${j===i?"> ":" "}${j}: ${M}`}).join(`
305
- `);break}}else if(t){let c=e.indexOf(t);if(c>=0)return Gc(e,c)}}catch{}return{lineNumber:i,lineContent:a,context:l}}var $e={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 h(e,n,t,i,a,l){let{lineNumber:c,context:y}=Gc(i,a,l),v=t.split("/").pop(),E=0;if(typeof a==="number"&&a>=0&&i){let M=i.lastIndexOf(`
306
- `,Math.max(0,a-1));E=a-(M+1)+1}let R="";if(c>0)R+=`
309
+ `),Ue.__stx_event_bindings=[]}}if(ne){let se=js(Xe,Q);if(se.hasScoped)Xe=se.html}if(yt&&tt){let se=Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[];qn.set(yt,{output:Xe,dependencies:[...v].filter((ue)=>!tt.has(ue)),clientFactories:Ft?Qr(a,Ft):[],uidsConsumed:gt.n-an,preservedClientExpressions:Vt?se.filter((ue)=>!Vt.has(ue)):[]})}if(Wt)Xe=`<!--stx-render-failed:${Wt}-->${Xe}`;return Je.length>0?`${Xe}
310
+ ${Je.join(`
311
+ `)}`:Xe}catch(F){if(F instanceof q)throw F;return`[Error processing component: ${F instanceof Error?F.message:String(F)}]`}finally{j.delete(e)}}async function s(e){return Bun.file(e).exists()}function tr(e,n){let t=ce.resolve(n),i=ce.resolve(e),a=t.endsWith(ce.sep)?t:t+ce.sep;if(i===t||i.startsWith(a))return i;return null}async function Eo(e,n,t,i){let a=n.startsWith("layouts/")?n.slice(8):n,l=ce.join(e,a);for(let c of l.endsWith(".stx")?[l]:[l,`${l}.stx`])if(await s(c)){if(i)console.log(`Found layout in ${e}: ${c}`);return t?.add(c),c}return null}async function bn(e,n,t,i){let a=await Wl(e,n,t,i);if(a===null)return null;let l=tr(a,process.cwd());if(l)return l;let c=[t.root,t.layoutsDir,t.fallbackLayoutsDir,t.componentsDir,t.partialsDir,t.pagesDir,...t._layerLayoutDirs??[]].filter((y)=>typeof y==="string"&&y.length>0);for(let y of c){let v=ce.isAbsolute(y)?y:ce.resolve(process.cwd(),y);if(tr(a,v))return ce.resolve(a)}return console.warn(`[stx] rejected resolved template path that escapes project root: ${a} (template: ${e}, from: ${n})`),null}async function Wl(e,n,t,i){if(t.debug)console.log(`Resolving template path: ${e} from ${n}`);let a=ce.dirname(n),l=process.cwd();if(e.startsWith("/")){let j=ce.join(l,e),P=tr(j,l);if(!P)return console.warn(`[stx] rejected template path that escapes project root: ${e} (from ${n})`),null;if(t.debug)console.log(`Checking absolute path: ${P}`);if(await s(P)&&i)i.add(P);return P}let c=async(j)=>{if(!t.layoutsDir||!t.fallbackLayoutsDir)return j;let P=ce.relative(ce.resolve(l,t.fallbackLayoutsDir),j);if(P.startsWith("..")||ce.isAbsolute(P))return j;return await Eo(ce.resolve(l,t.layoutsDir),e,i,t.debug)??j},y=ce.join(a,e);if(await s(y)){if(t.debug)console.log(`Found direct path: ${y}`);let j=await c(y);if(i)i.add(j);return j}if(!e.endsWith(".stx")&&!e.endsWith(".jsx")&&!e.endsWith(".tsx"))for(let j of[".stx",".tsx",".jsx"]){let P=`${y}${j}`;if(await s(P)){if(t.debug)console.log(`Found direct path with extension: ${P}`);let M=await c(P);if(i)i.add(M);return M}}let v=[];if(v.push(...t._layerLayoutDirs??[]),t.layoutsDir)v.push(ce.isAbsolute(t.layoutsDir)?t.layoutsDir:ce.resolve(process.cwd(),t.layoutsDir));let E=ce.resolve(a),R=process.cwd();for(let j=0;j<10;j++){let P=ce.join(E,"layouts"),M=!1;try{M=Xn.statSync(P,{throwIfNoEntry:!1})?.isDirectory()??!1}catch{}if(M){v.push(P);break}let X=ce.dirname(E);if(X===E||X.length<R.length)break;E=X}for(let j of v){let P=await Eo(j,e,i,t.debug);if(P)return P}if(t.fallbackLayoutsDir){let j=ce.isAbsolute(t.fallbackLayoutsDir)?t.fallbackLayoutsDir:ce.resolve(process.cwd(),t.fallbackLayoutsDir),P=e.startsWith("layouts/")?e.slice(8):e,M=[ce.join(j,P)];if(!e.endsWith(".stx"))M.push(`${M[0]}.stx`);for(let X of M)if(await s(X)){if(t.debug)console.log(`Found in options.fallbackLayoutsDir: ${X}`);if(i)i.add(X);return X}}if(e.startsWith("layouts/")||e.includes("/layouts/")){let j=e.split("layouts/"),P=ce.join(t.partialsDir||a,"layouts",j[1]);if(await s(P)){if(t.debug)console.log(`Found in layouts path: ${P}`);if(i)i.add(P);return P}if(!P.endsWith(".stx")){let M=`${P}.stx`;if(await s(M)){if(t.debug)console.log(`Found in layouts path with extension: ${M}`);if(i)i.add(M);return M}}}if(t.partialsDir){let j=ce.join(t.partialsDir,"layouts");if(await s(j)){let P=ce.join(j,e);if(await s(P)){if(t.debug)console.log(`Found in partials layouts dir: ${P}`);if(i)i.add(P);return P}if(!e.endsWith(".stx")){let M=`${P}.stx`;if(await s(M)){if(t.debug)console.log(`Found in partials layouts dir with extension: ${M}`);if(i)i.add(M);return M}}}}let D=t.partialsDir||ce.join(process.cwd(),"views"),N=ce.join(D,e);if(await s(N)){if(t.debug)console.log(`Found in views path: ${N}`);if(i)i.add(N);return N}if(!e.endsWith(".stx")){let j=`${N}.stx`;if(await s(j)){if(t.debug)console.log(`Found in views path with extension: ${j}`);if(i)i.add(j);return j}}if(a.includes("temp")){let j=ce.join(ce.dirname(a),"layouts",e);if(await s(j)){if(t.debug)console.log(`Found in temp layouts dir: ${j}`);if(i)i.add(j);return j}if(!e.endsWith(".stx")){let P=`${j}.stx`;if(await s(P)){if(t.debug)console.log(`Found in temp layouts dir with extension: ${P}`);if(i)i.add(P);return P}}}if(t.debug)console.warn(`Template not found after trying all paths: ${e} (referenced from ${n})`);else console.warn(`Template not found: ${e} (referenced from ${n})`);return null}function Jc(e,n,t){let i=0,a="",l="";try{if(typeof n==="number"&&n>=0){let c=e.split(`
312
+ `),y=0;for(let v=0;v<c.length;v++)if(y+=c[v].length+1,y>=n){i=v+1,a=c[v].trim();let E=Math.max(0,v-2),R=Math.min(c.length,v+3);l=c.slice(E,R).map((D,N)=>{let j=E+N+1;return`${j===i?"> ":" "}${j}: ${D}`}).join(`
313
+ `);break}}else if(t){let c=e.indexOf(t);if(c>=0)return Jc(e,c)}}catch{}return{lineNumber:i,lineContent:a,context:l}}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 h(e,n,t,i,a,l){let{lineNumber:c,context:y}=Jc(i,a,l),v=t.split("/").pop(),E=0;if(typeof a==="number"&&a>=0&&i){let D=i.lastIndexOf(`
314
+ `,Math.max(0,a-1));E=a-(D+1)+1}let R="";if(c>0)R+=`
307
315
  ${t}:${c}${E>0?`:${E}`:""}: ${e.toLowerCase()} error: ${n}
308
316
  `;if(R+=`
309
- ${$e.bold}${$e.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${$e.reset}
310
- `,R+=`${$e.bold}${$e.red}\u2502${$e.reset} ${$e.bold}${$e.bgRed} ERROR ${$e.reset} ${$e.red}${e} Error${$e.reset}${" ".repeat(Math.max(0,43-e.length))}${$e.bold}${$e.red}\u2502${$e.reset}
311
- `,R+=`${$e.bold}${$e.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${$e.reset}
317
+ ${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}
318
+ `,R+=`${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}
319
+ `,R+=`${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}
312
320
  `,R+=`
313
- ${$e.cyan}${$e.bold}File:${$e.reset} ${$e.dim}${v}${$e.reset}`,c>0)R+=` ${$e.gray}(line ${c}${E>0?`, col ${E}`:""})${$e.reset}`;if(R+=`
314
- ${$e.yellow}${$e.bold}Message:${$e.reset} ${n}
321
+ ${ke.cyan}${ke.bold}File:${ke.reset} ${ke.dim}${v}${ke.reset}`,c>0)R+=` ${ke.gray}(line ${c}${E>0?`, col ${E}`:""})${ke.reset}`;if(R+=`
322
+ ${ke.yellow}${ke.bold}Message:${ke.reset} ${n}
315
323
  `,y)R+=`
316
- ${$e.blue}${$e.bold}Context:${$e.reset}
317
- ${$e.dim}${y}${$e.reset}
318
- `;return R}function fe(){sn.clear(),Js.clear(),Zn.clear(),Ys.clear(),Qs.clear(),qn.clear()}function qh(){return{size:sn.size,maxSize:500}}var qs=b(128);async function Bl(e,n,t){let i=x(e,n,t),a=qs.get(i);if(a){if(Ms(a.deps))return a;qs.delete(i)}let l=fi(e,{filePath:n,projectRoot:process.cwd()}),c=l.code,y=gi(l.styles);c=Mt(c).code;let{hasUserImports:v,bundleClientScript:E}=await o("stx/client-script-bundler",()=>import("./chunk-ncxed9r1.js")),R=[],M=!1;if(v(c)){let L=c;c=await E(L,n,{projectRoot:process.cwd(),minify:t,collectInputs:R}),M=c===L}let{stripStxRuntimeImports:N}=await o("stx/signal-processing",()=>import("./chunk-4gx5ze56.js"));c=N(c);let j=A(c),P=Il(j),D=new Set(z(j,!0).split(",").map((L)=>L.trim())),X=`function(__scopeId) {
319
- ${at("const",[...cl,...P],j)}
324
+ ${ke.blue}${ke.bold}Context:${ke.reset}
325
+ ${ke.dim}${y}${ke.reset}
326
+ `;return R}function fe(){sn.clear(),Xs.clear(),Zn.clear(),Ys.clear(),Qs.clear(),qn.clear()}function Kh(){return{size:sn.size,maxSize:500}}var qs=b(128);async function Fl(e,n,t){let i=x(e,n,t),a=qs.get(i);if(a){if(Ds(a.deps))return a;qs.delete(i)}let l=gi(e,{filePath:n,projectRoot:process.cwd()}),c=l.code,y=mi(l.styles);c=Mt(c).code;let{hasUserImports:v,bundleClientScript:E}=await o("stx/client-script-bundler",()=>import("./chunk-054h7ktz.js")),R=[],D=!1;if(v(c)){let L=c;c=await E(L,n,{projectRoot:process.cwd(),minify:t,collectInputs:R}),D=c===L}let{stripStxRuntimeImports:N}=await o("stx/signal-processing",()=>import("./chunk-vmp876q6.js"));c=N(c);let j=A(c),P=Ml(j),M=new Set(z(j,!0).split(",").map((L)=>L.trim())),X=`function(__scopeId) {
327
+ ${at("const",[...ll,...P],j)}
320
328
  const __scope = window.stx._scopes = window.stx._scopes || {};
321
329
  const __scopeVars = __scope[__scopeId] = __scope[__scopeId] || {};
322
330
  __scopeVars.$refs = __scopeVars.$refs || {};
@@ -381,7 +389,7 @@ ${j}
381
389
  // Register all defined signals and functions in this scope
382
390
  const __localVars = {};
383
391
  try {
384
- ${P.map((L)=>D.has(L)?`Object.defineProperty(__localVars, '${L}', ${As(L)});`:`if (typeof ${L} !== 'undefined') __localVars['${L}'] = ${L};`).join(`
392
+ ${P.map((L)=>M.has(L)?`Object.defineProperty(__localVars, '${L}', ${Ps(L)});`:`if (typeof ${L} !== 'undefined') __localVars['${L}'] = ${L};`).join(`
385
393
  `)}
386
394
  }
387
395
  catch (e) {}
@@ -400,24 +408,24 @@ finally {
400
408
  window.__STX_CURRENT_ELEMENT__ = __previousCurrentElement;
401
409
  window.__STX_CURRENT_PROPS__ = __previousCurrentProps;
402
410
  }
403
- }`,F={vendorStyleTags:y,factoryBody:X,clientCode:j,deps:br([...R,...l.styles.map((L)=>L.resolvedPath)])};if(!M&&l.unresolved.length===0)qs.set(i,F);return F}var hn=["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 zl=100,Wl=599,sr="__stxResponseStatus",rn="__stxResponseHeaders";function Jn(e){return typeof e==="number"&&Number.isInteger(e)&&e>=zl&&e<=Wl}function gn(e){for(let n of e.matchAll(/\bdefinePageMeta\s*\(\s*\{([\s\S]*?)\}\s*\)/g)){let t=n[1].match(/(?:^|,)\s*status\s*:\s*(\d{3})(?=\s*(?:,|$))/);if(!t)continue;let i=Number(t[1]);if(Jn(i))return i}return}function nr(e,n){if(!e||typeof e!=="object")return!1;let t=typeof n==="string"&&/^\d+$/.test(n.trim())?Number(n.trim()):n;if(!Jn(t))return!1;return e[sr]=t,!0}function Fl(e,n,t){if(!e||typeof e!=="object")return;let i=String(n??"").trim();if(!i)return;e[rn]={...e[rn],[i]:String(t)}}function Ot(e){let n=e?.[sr];return Jn(n)?n:void 0}function Nt(e){let n=e?.[rn];if(!n||typeof n!=="object")return;let t=Object.entries(n).map(([i,a])=>[i,String(a)]);return t.length>0?Object.fromEntries(t):void 0}function Dc(e,n){if(!e||!n||e===n||typeof n!=="object")return;let t=Ot(e);if(t!==void 0)n[sr]=t;let i=Nt(e);if(i)n[rn]={...n[rn],...i}}function js(e){return{setResponseStatus:(n)=>{nr(e,n)},notFound:(n=404)=>{let t=Jn(n)&&n>=400?n:404;nr(e,t)},setResponseHeader:(n,t)=>{Fl(e,n,t)}}}function Lc(e,n,t={}){if(!e.includes("@status"))return e;let{filePath:i,buildMode:a}=t,l=a==="compile",c="",y=0,v=/@status\s*\(/g,E;while((E=v.exec(e))!==null){let R=Vl(e,E.index+E[0].length-1);if(R<0)break;let M=e.slice(E.index+E[0].length,R).trim(),N=/^\d+$/.test(M)?Number(M):u(M,n),j=i?` in ${i}`:"";if(l)console.warn(`[stx] @status(${M})${j} is skipped when precompiling: the build has no request, so the branch it sits in is not the one a visitor will get. Call notFound() or setResponseStatus(${M}) from <script server> instead \u2014 that runs per request.`);else if(!nr(n,N))console.warn(`[stx] @status(${M})${j} is not an HTTP status (100-599) \u2014 ignoring it.`);c+=e.slice(y,E.index),y=R+1+(e.slice(R+1).match(/^[^\S\n]*\n?/)?.[0].length??0),v.lastIndex=y}return y===0?e:c+e.slice(y)}function Vl(e,n){let t=1,i=null,a=!1;for(let l=n+1;l<e.length;l++){let c=e[l];if(a){a=!1;continue}if(i){if(c==="\\")a=!0;else if(c===i)i=null;continue}if(c==='"'||c==="'"||c==="`"){i=c;continue}if(c==="(")t++;else if(c===")"&&--t===0)return l}return-1}var ko=new Set(hn),Ul=new Set(["props","$props","defineProps"]),Hl=new Set(["stx","@stacksjs/stx"]),Ro=b(128),Co=b(64);function Kl(e){let n=[],t=0,i=e.split(`
404
- `);for(let a of i){let l=t,c=null,y=!1;for(let v=0;v<a.length;v++){let E=a[v];if(y){y=!1;continue}if(E==="\\"){y=!0;continue}if(c){if(E===c)c=null;continue}if(E==="'"||E==='"'||E==="`"){c=E;continue}if(E==="/"&&v+1<a.length&&a[v+1]==="/")break;if(E==="{")t++;else if(E==="}")t--}if(l===0){let v=a.match(/(?:const|let|var)\s+(\w+)\s*=/);if(v)n.push(v[1]);else if(/^\s*(?:const|let|var)\s+\w+\s*;?\s*$/.test(a)){let E=a.match(/(?:const|let|var)\s+(\w+)/);if(E)n.push(E[1])}else{let E=a.match(/(?:const|let|var)\s+(\{[^}]+\}|\[[^\]]+\])\s*=/);if(E){let M=E[1].slice(1,-1).split(",").map((N)=>{let j=N.split(":");return(j.length>1?j[1]:j[0]).trim()}).filter((N)=>/^\w+$/.test(N));n.push(...M)}}}}return[...new Set(n)]}function Jf(e){let n=e;n=n.replace(/^\s*import\s+.*?from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),n=n.replace(/^\s*import\s+['"][^'"]+['"]\s*;?\s*$/gm,""),n=n.replace(/^\s*interface\s+\w+\s*\{[\s\S]*?\n\}\s*$/gm,""),n=n.replace(/^\s*type\s+\w+\s*=[\s\S]*?(?=\n(?:const|let|var|function|export|interface|type|$))/gm,""),n=n.replace(/^(\s*(?:export\s+)?(?:const|let|var)\s+)(\w+|\{[^}]+\}|\[[^\]]+\])\s*:\s*[^=]+(\s*=)/gm,"$1$2$3");function t(i){if(!i.includes(":"))return i;let a=[],l="",c=0,y=0,v=null;for(let E=0;E<i.length;E++){let R=i[E];if(v){if(l+=R,R===v)v=null;continue}if(R==='"'||R==="'"||R==="`"){v=R,l+=R;continue}if(R==="<")c++;else if(R===">"&&c>0)c--;else if(R==="(")y++;else if(R===")")y--;if(R===","&&c===0&&y===0){a.push(l),l="";continue}l+=R}if(l)a.push(l);return a.map((E)=>{let R=E.trim(),M=R.startsWith("..."),N=M?R.slice(3):R,j=-1,P=0;for(let ae=0;ae<N.length;ae++)if(N[ae]==="<")P++;else if(N[ae]===">")P--;else if(N[ae]===":"&&P===0){j=ae;break}if(j===-1)return E;let X=N.substring(0,j).trim().replace(/\?$/,""),F=N.substring(j+1),L=-1,Q=0;for(let ae=0;ae<F.length;ae++)if(F[ae]==="<")Q++;else if(F[ae]===">")Q--;else if(F[ae]==="="&&Q===0){L=ae;break}let te=M?"...":"";if(L!==-1)return`${te}${X} = ${F.substring(L+1).trim()}`;return`${te}${X}`}).join(", ")}n=n.replace(/\b(function\s+\w*\s*)\(([^)]*)\)/g,(i,a,l)=>{if(!l.includes(":"))return i;return`${a}(${t(l)})`});{let i=/\b(function\s+\w*\s*)\(/g,a,l=[];while((a=i.exec(n))!==null){let c=a.index+a[0].length-1,y=1,v=c+1,E=0,R=null;while(v<n.length&&y>0){let j=n[v];if(R){if(j===R)R=null;v++;continue}if(j==='"'||j==="'"||j==="`"){R=j,v++;continue}if(j==="<")E++;else if(j===">"&&E>0)E--;else if(E===0){if(j==="(")y++;else if(j===")")y--}if(y>0)v++}if(y!==0)continue;let M=n.substring(c+1,v);if(!M.includes(":"))continue;let N=t(M);l.push({start:c+1,end:v,replacement:N})}for(let c=l.length-1;c>=0;c--){let{start:y,end:v,replacement:E}=l[c];n=n.substring(0,y)+E+n.substring(v)}}return n=n.replace(/\(([^)]*)\)\s*(?::\s*[^=]+)?\s*=>/g,(i,a)=>{if(!a.includes(":"))return i;if(a.includes("{")||a.includes("}"))return i;return`(${a.split(",").map((c)=>{let[y,...v]=c.split("="),E=y.split(":")[0].trim();if(v.length>0)return`${E} = ${v.join("=").trim()}`;return E}).join(", ")}) =>`}),n=n.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"),n=n.replace(/(\b(?:function|class|interface|type|extends|implements)\s+\w+)\s*<[^<>()]*>/g,"$1"),n=n.replace(/(\b(?:defineProps|withDefaults|defineEmits|defineSlots|Array|Promise|Map|Set|Record|Partial|Required|Readonly|Pick|Omit|Exclude|Extract))\s*<[^<>()]*>/g,"$1"),n=n.replace(/(\w+)\s*<[A-Z][^<>()]*>\s*(?=\()/g,"$1"),n=n.replace(/\s+as\s+(?:const|[A-Za-z]\w*(?:\[\])?(?:\s*\|\s*\w+(?:\[\])?)*)/g,""),n=n.replace(/\s+satisfies\s+\w+(?:<[^>]*>)?/g,""),n=n.replace(/(\w|\)|\])\s*!(?!=)/g,"$1"),n=n.replace(/^\s*(?:export\s+)?(?:const\s+)?enum\s+\w+\s*\{[^}]*\}\s*$/gm,""),n=n.replace(/(?<=[\s=,(])<[A-Z]\w*(?:\[\])?>/g,""),n=n.replace(/\n\s*\n\s*\n/g,`
411
+ }`,F={vendorStyleTags:y,factoryBody:X,clientCode:j,deps:br([...R,...l.styles.map((L)=>L.resolvedPath)])};if(!D&&l.unresolved.length===0)qs.set(i,F);return F}var hn=["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 Vl=100,Ul=599,sr="__stxResponseStatus",rn="__stxResponseHeaders";function Jn(e){return typeof e==="number"&&Number.isInteger(e)&&e>=Vl&&e<=Ul}function gn(e){for(let n of e.matchAll(/\bdefinePageMeta\s*\(\s*\{([\s\S]*?)\}\s*\)/g)){let t=n[1].match(/(?:^|,)\s*status\s*:\s*(\d{3})(?=\s*(?:,|$))/);if(!t)continue;let i=Number(t[1]);if(Jn(i))return i}return}function nr(e,n){if(!e||typeof e!=="object")return!1;let t=typeof n==="string"&&/^\d+$/.test(n.trim())?Number(n.trim()):n;if(!Jn(t))return!1;return e[sr]=t,!0}function Hl(e,n,t){if(!e||typeof e!=="object")return;let i=String(n??"").trim();if(!i)return;e[rn]={...e[rn],[i]:String(t)}}function Ot(e){let n=e?.[sr];return Jn(n)?n:void 0}function Nt(e){let n=e?.[rn];if(!n||typeof n!=="object")return;let t=Object.entries(n).map(([i,a])=>[i,String(a)]);return t.length>0?Object.fromEntries(t):void 0}function Lc(e,n){if(!e||!n||e===n||typeof n!=="object")return;let t=Ot(e);if(t!==void 0)n[sr]=t;let i=Nt(e);if(i)n[rn]={...n[rn],...i}}function Bs(e){return{setResponseStatus:(n)=>{nr(e,n)},notFound:(n=404)=>{let t=Jn(n)&&n>=400?n:404;nr(e,t)},setResponseHeader:(n,t)=>{Hl(e,n,t)}}}function jc(e,n,t={}){if(!e.includes("@status"))return e;let{filePath:i,buildMode:a}=t,l=a==="compile",c="",y=0,v=/@status\s*\(/g,E;while((E=v.exec(e))!==null){let R=Kl(e,E.index+E[0].length-1);if(R<0)break;let D=e.slice(E.index+E[0].length,R).trim(),N=/^\d+$/.test(D)?Number(D):u(D,n),j=i?` in ${i}`:"";if(l)console.warn(`[stx] @status(${D})${j} 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(!nr(n,N))console.warn(`[stx] @status(${D})${j} is not an HTTP status (100-599) \u2014 ignoring it.`);c+=e.slice(y,E.index),y=R+1+(e.slice(R+1).match(/^[^\S\n]*\n?/)?.[0].length??0),v.lastIndex=y}return y===0?e:c+e.slice(y)}function Kl(e,n){let t=1,i=null,a=!1;for(let l=n+1;l<e.length;l++){let c=e[l];if(a){a=!1;continue}if(i){if(c==="\\")a=!0;else if(c===i)i=null;continue}if(c==='"'||c==="'"||c==="`"){i=c;continue}if(c==="(")t++;else if(c===")"&&--t===0)return l}return-1}var Ao=new Set(hn),Zl=new Set(["props","$props","defineProps"]),ql=new Set(["stx","@stacksjs/stx"]),Io=b(128),Po=b(64);function Xl(e){let n=[],t=0,i=e.split(`
412
+ `);for(let a of i){let l=t,c=null,y=!1;for(let v=0;v<a.length;v++){let E=a[v];if(y){y=!1;continue}if(E==="\\"){y=!0;continue}if(c){if(E===c)c=null;continue}if(E==="'"||E==='"'||E==="`"){c=E;continue}if(E==="/"&&v+1<a.length&&a[v+1]==="/")break;if(E==="{")t++;else if(E==="}")t--}if(l===0){let v=a.match(/(?:const|let|var)\s+(\w+)\s*=/);if(v)n.push(v[1]);else if(/^\s*(?:const|let|var)\s+\w+\s*;?\s*$/.test(a)){let E=a.match(/(?:const|let|var)\s+(\w+)/);if(E)n.push(E[1])}else{let E=a.match(/(?:const|let|var)\s+(\{[^}]+\}|\[[^\]]+\])\s*=/);if(E){let D=E[1].slice(1,-1).split(",").map((N)=>{let j=N.split(":");return(j.length>1?j[1]:j[0]).trim()}).filter((N)=>/^\w+$/.test(N));n.push(...D)}}}}return[...new Set(n)]}function Jf(e){let n=e;n=n.replace(/^\s*import\s+.*?from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),n=n.replace(/^\s*import\s+['"][^'"]+['"]\s*;?\s*$/gm,""),n=n.replace(/^\s*interface\s+\w+\s*\{[\s\S]*?\n\}\s*$/gm,""),n=n.replace(/^\s*type\s+\w+\s*=[\s\S]*?(?=\n(?:const|let|var|function|export|interface|type|$))/gm,""),n=n.replace(/^(\s*(?:export\s+)?(?:const|let|var)\s+)(\w+|\{[^}]+\}|\[[^\]]+\])\s*:\s*[^=]+(\s*=)/gm,"$1$2$3");function t(i){if(!i.includes(":"))return i;let a=[],l="",c=0,y=0,v=null;for(let E=0;E<i.length;E++){let R=i[E];if(v){if(l+=R,R===v)v=null;continue}if(R==='"'||R==="'"||R==="`"){v=R,l+=R;continue}if(R==="<")c++;else if(R===">"&&c>0)c--;else if(R==="(")y++;else if(R===")")y--;if(R===","&&c===0&&y===0){a.push(l),l="";continue}l+=R}if(l)a.push(l);return a.map((E)=>{let R=E.trim(),D=R.startsWith("..."),N=D?R.slice(3):R,j=-1,P=0;for(let re=0;re<N.length;re++)if(N[re]==="<")P++;else if(N[re]===">")P--;else if(N[re]===":"&&P===0){j=re;break}if(j===-1)return E;let X=N.substring(0,j).trim().replace(/\?$/,""),F=N.substring(j+1),L=-1,Q=0;for(let re=0;re<F.length;re++)if(F[re]==="<")Q++;else if(F[re]===">")Q--;else if(F[re]==="="&&Q===0){L=re;break}let ee=D?"...":"";if(L!==-1)return`${ee}${X} = ${F.substring(L+1).trim()}`;return`${ee}${X}`}).join(", ")}n=n.replace(/\b(function\s+\w*\s*)\(([^)]*)\)/g,(i,a,l)=>{if(!l.includes(":"))return i;return`${a}(${t(l)})`});{let i=/\b(function\s+\w*\s*)\(/g,a,l=[];while((a=i.exec(n))!==null){let c=a.index+a[0].length-1,y=1,v=c+1,E=0,R=null;while(v<n.length&&y>0){let j=n[v];if(R){if(j===R)R=null;v++;continue}if(j==='"'||j==="'"||j==="`"){R=j,v++;continue}if(j==="<")E++;else if(j===">"&&E>0)E--;else if(E===0){if(j==="(")y++;else if(j===")")y--}if(y>0)v++}if(y!==0)continue;let D=n.substring(c+1,v);if(!D.includes(":"))continue;let N=t(D);l.push({start:c+1,end:v,replacement:N})}for(let c=l.length-1;c>=0;c--){let{start:y,end:v,replacement:E}=l[c];n=n.substring(0,y)+E+n.substring(v)}}return n=n.replace(/\(([^)]*)\)\s*(?::\s*[^=]+)?\s*=>/g,(i,a)=>{if(!a.includes(":"))return i;if(a.includes("{")||a.includes("}"))return i;return`(${a.split(",").map((c)=>{let[y,...v]=c.split("="),E=y.split(":")[0].trim();if(v.length>0)return`${E} = ${v.join("=").trim()}`;return E}).join(", ")}) =>`}),n=n.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"),n=n.replace(/(\b(?:function|class|interface|type|extends|implements)\s+\w+)\s*<[^<>()]*>/g,"$1"),n=n.replace(/(\b(?:defineProps|withDefaults|defineEmits|defineSlots|Array|Promise|Map|Set|Record|Partial|Required|Readonly|Pick|Omit|Exclude|Extract))\s*<[^<>()]*>/g,"$1"),n=n.replace(/(\w+)\s*<[A-Z][^<>()]*>\s*(?=\()/g,"$1"),n=n.replace(/\s+as\s+(?:const|[A-Za-z]\w*(?:\[\])?(?:\s*\|\s*\w+(?:\[\])?)*)/g,""),n=n.replace(/\s+satisfies\s+\w+(?:<[^>]*>)?/g,""),n=n.replace(/(\w|\)|\])\s*!(?!=)/g,"$1"),n=n.replace(/^\s*(?:export\s+)?(?:const\s+)?enum\s+\w+\s*\{[^}]*\}\s*$/gm,""),n=n.replace(/(?<=[\s=,(])<[A-Z]\w*(?:\[\])?>/g,""),n=n.replace(/\n\s*\n\s*\n/g,`
405
413
 
406
- `),n}function Yf(e){return e.replace(/\s*(?:imported from|from)\s+(?:(['"])([^'"\r\n]+)\1|(\S+))/g,(n,...t)=>{let[,i,a]=t,l=i??a;return/(?:[/\\]packages[/\\]stx[/\\]|@stacksjs[/\\]stx[/\\])/.test(l)?"":n})}function Zf(e){return/cannot find module|cannot find package|could not resolve|module not found|failed to resolve/i.test(e)}function Qf(e){if(e instanceof SyntaxError)return!0;let n=e instanceof Error?e.message:String(e);return/SyntaxError|Unexpected (token|identifier|string|number|keyword|end of)|Unterminated|Expected .+ but found/i.test(n)}function eg(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 To=new Set;async function m(e,n,t,i={}){if(!e.trim())return;let a=C(),l=x(e,JSON.stringify(a)),c=Ro.get(l);if(c===void 0){try{let ee=Y({loader:"ts",target:"browser",define:a}),re=e.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");re=re.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,""),c=ee.transformSync(re)}catch{c=Jf(e)}Ro.set(l,c)}let y={exports:{}},v=y.exports,E=Ct.cwd(),R={},M=[...c.matchAll(/require\s*\(\s*['"]([^'"]+)['"]\s*\)/g)||[]].map((ee)=>ee[1]).filter((ee)=>!ee.startsWith("node:")&&!["fs","path","os","child_process","crypto","http","https","url","util","stream","events","buffer","net","querystring","zlib","tls"].includes(ee)),N=new Map;for(let ee of M)try{if(ee.startsWith(".")){R[ee]=await import(Ye.resolve(Ye.dirname(t),ee));continue}let re=Ye.resolve(E,"node_modules",ee),me=Ye.join(re,"package.json"),we=JSON.parse(g("fs").readFileSync(me,"utf8")),Re=we.main||"index.js";if(we.exports){let Ke=typeof we.exports==="string"?we.exports:we.exports["."];if(typeof Ke==="string")Re=Ke;else if(Ke?.bun)Re=Ke.bun;else if(Ke?.import)Re=Ke.import;else if(Ke?.default)Re=Ke.default}R[ee]=await import(Ye.resolve(re,Re))}catch(re){if(ee.startsWith("."))N.set(ee,re instanceof Error?re.message:String(re))}let j=(ee)=>{if(R[ee])return R[ee];let re=N.get(ee);if(re!==void 0)throw Error(`Cannot require '${ee}' from ${t}: ${re}`);return g(ee)},P=n.props||{},D=(ee)=>{if(!ee)return P;let re={};for(let[me,we]of Object.entries(ee)){let Re=P[me];if(Re!==void 0)re[me]=Re;else if(typeof we==="function")re[me]=we();else re[me]=we}return re};for(let[ee,re]of Object.entries(P))Object.defineProperty(D,ee,{value:re,enumerable:!0,configurable:!0,writable:!0});let X=(ee,re=!1)=>{if(ee===void 0||ee===null)return re;if(typeof ee==="string"){let me=ee.trim().toLowerCase();if(me===""||me==="true"||me==="1"||me==="on"||me==="yes")return!0;if(me==="false"||me==="0"||me==="off"||me==="no")return!1;return!0}return Boolean(ee)},F=(ee,re=0)=>{if(ee===void 0||ee===null)return re;if(typeof ee==="string"){let we=ee.trim();if(we==="")return re;let Re=Number(we);return Number.isFinite(Re)?Re:re}let me=Number(ee);return Number.isFinite(me)?me:re};for(let ee of["name","length","caller","arguments"]){if(Object.prototype.hasOwnProperty.call(P,ee))continue;try{Object.defineProperty(D,ee,{value:void 0,enumerable:!1,configurable:!0,writable:!0})}catch{}}let L=(ee)=>{if(!ee)return P;let re={...P};for(let[me,we]of Object.entries(ee)){let Re=we&&typeof we==="object"&&!Array.isArray(we)?we:{type:we};if(re[me]===void 0&&Re.default!==void 0)re[me]=typeof Re.default==="function"?Re.default():Re.default}return re},Q=()=>n.slots||{},te=(ee,re)=>{let me={...ee};for(let[we,Re]of Object.entries(re))if(me[we]===void 0)if(typeof Re==="function")me[we]=Re();else me[we]=Re;return me},ae=(ee)=>{let re=()=>ee;return re.set=(me)=>{},re.update=(me)=>{},re},se=(ee)=>{let re,me=!1;return()=>{if(!me)try{re=ee(),me=!0}catch{re=void 0}return re}},ue=(ee)=>{},Ee=(ee)=>ee(),Te=(ee)=>{},Ae=(ee)=>{},ke=js(n);function Je(ee){let re=ee||{};if(re.title!==void 0||re.description!==void 0)dt({title:re.title,description:re.description})}function ut(ee){if(!ee||typeof ee!=="object")return;let re=n.__stxClientPayload??{};Object.assign(re,ee),n.__stxClientPayload=re}let Tt=()=>{let ee=n.__stxServeContext,re=n.__stxServeSearch??ee?.search??"",me=ee?.path??"",we=Object.fromEntries(new URLSearchParams(re)),Re=n.query,Ke=Object.keys(we).length>0?we:Re??{},tt=re||(Object.keys(Ke).length>0?`?${new URLSearchParams(Ke).toString()}`:"");return{params:n.params??{},query:Ke,path:me,name:"",fullPath:me+tt,hash:"",matched:[]}},Gn=()=>({push:(ee)=>{},replace:(ee)=>{},back:()=>{},forward:()=>{},go:(ee)=>{}}),ft=(ee)=>{let re=n.__stx_runtime_head||{};n.__stx_runtime_head=Ve(re,_e(ee||{},{known:Xs,source:"useHead()"}))},dt=(ee)=>{ft(Gs(ee||{}))},pt=(ee)=>({value:ee}),Lt=(ee)=>ee,ir=(ee)=>({value:typeof ee==="function"?ee():ee}),st=(ee,re)=>{},Ue=(ee)=>{},Bt=(ee)=>{},on=(ee)=>ee?ee():Promise.resolve(),Yn=(ee)=>(re,...me)=>{},zt=(ee)=>{},qe=(ee,re)=>{},Wt=(ee,re)=>re,Qn=()=>({value:"light"}),bt=()=>ae(!1),Qe=(ee)=>ae(!1),Ft=()=>ae(!1),an=()=>Qe("(prefers-color-scheme: dark)"),Vt=()=>Qe("(prefers-color-scheme: light)"),Ut=()=>Qe("(prefers-reduced-motion: reduce)"),or=()=>Qe("(prefers-contrast: more)"),Xe={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:{}},Ht=new Proxy(Xe,{get(ee,re){if(re in ee)return ee[re];return},set(ee,re,me){return ee[re]=me,!0}}),es={getElementById:()=>null,querySelector:()=>null,querySelectorAll:()=>[],createElement:()=>({}),createTextNode:()=>({}),body:{},head:{},documentElement:{},addEventListener:()=>{},removeEventListener:()=>{}},et=console;try{let ee=pi(c,t),re=new Set(Object.keys(P)),me=Object.keys(n).filter((ne)=>!re.has(ne)&&!Ul.has(ne)&&jt(ne)),we=me.map((ne)=>n[ne]);if(!me.includes("__stxServeContext"))me.push("__stxServeContext"),we.push(void 0);if(!re.has("cookies")){let ne=n.cookies??n.__stxServeContext?.cookies??{},le=me.indexOf("cookies");if(le<0)me.push("cookies"),we.push(ne);else we[le]=ne}let Re=new Set(["async","module","exports","require","params","window","document","console","state","derived","effect"]),Ke=[],tt=[];for(let[ne,le]of Object.entries(P)){if(!jt(ne))continue;if(Re.has(ne))continue;if(new RegExp(`(?:^|[\\s;{])(?:const|let|var|function)\\s+${ne}\\b`).test(ee))continue;Ke.push(ne),tt.push(le)}let ns=Kl(ee).map((ne)=>`module.exports.${ne} = typeof ${ne} !== 'undefined' ? ${ne} : module.exports.${ne};`).join(`
407
- `),cn=n.params??{},Kt=[],Zt=[];for(let ne=0;ne<me.length;ne++){if(me[ne]==="params")continue;Kt.push(me[ne]),Zt.push(we[ne])}let ln=[...hn,...Ke,...Kt],un=`return (async () => {
408
- ${ee}
414
+ `),n}function Yf(e){return e.replace(/\s*(?:imported from|from)\s+(?:(['"])([^'"\r\n]+)\1|(\S+))/g,(n,...t)=>{let[,i,a]=t,l=i??a;return/(?:[/\\]packages[/\\]stx[/\\]|@stacksjs[/\\]stx[/\\])/.test(l)?"":n})}function Zf(e){return/cannot find module|cannot find package|could not resolve|module not found|failed to resolve/i.test(e)}function Qf(e){if(e instanceof SyntaxError)return!0;let n=e instanceof Error?e.message:String(e);return/SyntaxError|Unexpected (token|identifier|string|number|keyword|end of)|Unterminated|Expected .+ but found/i.test(n)}function eg(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 Oo=new Set;async function m(e,n,t,i={}){if(!e.trim())return;let a=C(),l=x(e,JSON.stringify(a)),c=Io.get(l);if(c===void 0){try{let ne=Y({loader:"ts",target:"browser",define:a}),ae=e.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");ae=ae.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,""),c=ne.transformSync(ae)}catch{c=Jf(e)}Io.set(l,c)}let y={exports:{}},v=y.exports,E=Tt.cwd(),R={},D=[...c.matchAll(/require\s*\(\s*['"]([^'"]+)['"]\s*\)/g)||[]].map((ne)=>ne[1]).filter((ne)=>!ne.startsWith("node:")&&!["fs","path","os","child_process","crypto","http","https","url","util","stream","events","buffer","net","querystring","zlib","tls"].includes(ne)),N=new Map;for(let ne of D)try{if(ne.startsWith(".")){R[ne]=await import(et.resolve(et.dirname(t),ne));continue}let ae=et.resolve(E,"node_modules",ne),me=et.join(ae,"package.json"),$e=JSON.parse(g("fs").readFileSync(me,"utf8")),Te=$e.main||"index.js";if($e.exports){let qe=typeof $e.exports==="string"?$e.exports:$e.exports["."];if(typeof qe==="string")Te=qe;else if(qe?.bun)Te=qe.bun;else if(qe?.import)Te=qe.import;else if(qe?.default)Te=qe.default}R[ne]=await import(et.resolve(ae,Te))}catch(ae){if(ne.startsWith("."))N.set(ne,ae instanceof Error?ae.message:String(ae))}let j=(ne)=>{if(R[ne])return R[ne];let ae=N.get(ne);if(ae!==void 0)throw Error(`Cannot require '${ne}' from ${t}: ${ae}`);return g(ne)},P=n.props||{},M=(ne)=>{if(!ne)return P;let ae={};for(let[me,$e]of Object.entries(ne)){let Te=P[me];if(Te!==void 0)ae[me]=Te;else if(typeof $e==="function")ae[me]=$e();else ae[me]=$e}return ae};for(let[ne,ae]of Object.entries(P))Object.defineProperty(M,ne,{value:ae,enumerable:!0,configurable:!0,writable:!0});let X=(ne,ae=!1)=>{if(ne===void 0||ne===null)return ae;if(typeof ne==="string"){let me=ne.trim().toLowerCase();if(me===""||me==="true"||me==="1"||me==="on"||me==="yes")return!0;if(me==="false"||me==="0"||me==="off"||me==="no")return!1;return!0}return Boolean(ne)},F=(ne,ae=0)=>{if(ne===void 0||ne===null)return ae;if(typeof ne==="string"){let $e=ne.trim();if($e==="")return ae;let Te=Number($e);return Number.isFinite(Te)?Te:ae}let me=Number(ne);return Number.isFinite(me)?me:ae};for(let ne of["name","length","caller","arguments"]){if(Object.prototype.hasOwnProperty.call(P,ne))continue;try{Object.defineProperty(M,ne,{value:void 0,enumerable:!1,configurable:!0,writable:!0})}catch{}}let L=(ne)=>{if(!ne)return P;let ae={...P};for(let[me,$e]of Object.entries(ne)){let Te=$e&&typeof $e==="object"&&!Array.isArray($e)?$e:{type:$e};if(ae[me]===void 0&&Te.default!==void 0)ae[me]=typeof Te.default==="function"?Te.default():Te.default}return ae},Q=()=>n.slots||{},ee=(ne,ae)=>{let me={...ne};for(let[$e,Te]of Object.entries(ae))if(me[$e]===void 0)if(typeof Te==="function")me[$e]=Te();else me[$e]=Te;return me},re=(ne)=>{let ae=()=>ne;return ae.set=(me)=>{},ae.update=(me)=>{},ae},te=(ne)=>{let ae,me=!1;return()=>{if(!me)try{ae=ne(),me=!0}catch{ae=void 0}return ae}},le=(ne)=>{},Ee=(ne)=>ne(),we=(ne)=>{},Re=(ne)=>{},Ce=Bs(n);function Ke(ne){let ae=ne||{};if(ae.title!==void 0||ae.description!==void 0)pt({title:ae.title,description:ae.description})}function Je(ne){if(!ne||typeof ne!=="object")return;let ae=n.__stxClientPayload??{};Object.assign(ae,ne),n.__stxClientPayload=ae}let Ze=()=>{let ne=n.__stxServeContext,ae=n.__stxServeSearch??ne?.search??"",me=ne?.path??"",$e=Object.fromEntries(new URLSearchParams(ae)),Te=n.query,qe=Object.keys($e).length>0?$e:Te??{},st=ae||(Object.keys(qe).length>0?`?${new URLSearchParams(qe).toString()}`:"");return{params:n.params??{},query:qe,path:me,name:"",fullPath:me+st,hash:"",matched:[]}},Gn=()=>({push:(ne)=>{},replace:(ne)=>{},back:()=>{},forward:()=>{},go:(ne)=>{}}),dt=(ne)=>{let ae=n.__stx_runtime_head||{};n.__stx_runtime_head=Ve(ae,_e(ne||{},{known:Gs,source:"useHead()"}))},pt=(ne)=>{dt(Js(ne||{}))},gt=(ne)=>({value:ne}),Lt=(ne)=>ne,ir=(ne)=>({value:typeof ne==="function"?ne():ne}),ot=(ne,ae)=>{},Ue=(ne)=>{},Bt=(ne)=>{},on=(ne)=>ne?ne():Promise.resolve(),Yn=(ne)=>(ae,...me)=>{},zt=(ne)=>{},Ge=(ne,ae)=>{},Wt=(ne,ae)=>ae,Qn=()=>({value:"light"}),yt=()=>re(!1),tt=(ne)=>re(!1),Ft=()=>re(!1),an=()=>tt("(prefers-color-scheme: dark)"),Vt=()=>tt("(prefers-color-scheme: light)"),Ut=()=>tt("(prefers-reduced-motion: reduce)"),or=()=>tt("(prefers-contrast: more)"),Ye={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:{}},Ht=new Proxy(Ye,{get(ne,ae){if(ae in ne)return ne[ae];return},set(ne,ae,me){return ne[ae]=me,!0}}),es={getElementById:()=>null,querySelector:()=>null,querySelectorAll:()=>[],createElement:()=>({}),createTextNode:()=>({}),body:{},head:{},documentElement:{},addEventListener:()=>{},removeEventListener:()=>{}},nt=console;try{let ne=fi(c,t),ae=new Set(Object.keys(P)),me=Object.keys(n).filter((se)=>!ae.has(se)&&!Zl.has(se)&&jt(se)),$e=me.map((se)=>n[se]);if(!me.includes("__stxServeContext"))me.push("__stxServeContext"),$e.push(void 0);if(!ae.has("cookies")){let se=n.cookies??n.__stxServeContext?.cookies??{},ue=me.indexOf("cookies");if(ue<0)me.push("cookies"),$e.push(se);else $e[ue]=se}let Te=new Set(["async","module","exports","require","params","window","document","console","state","derived","effect"]),qe=[],st=[];for(let[se,ue]of Object.entries(P)){if(!jt(se))continue;if(Te.has(se))continue;if(new RegExp(`(?:^|[\\s;{])(?:const|let|var|function)\\s+${se}\\b`).test(ne))continue;qe.push(se),st.push(ue)}let ns=Xl(ne).map((se)=>`module.exports.${se} = typeof ${se} !== 'undefined' ? ${se} : module.exports.${se};`).join(`
415
+ `),cn=n.params??{},Kt=[],Zt=[];for(let se=0;se<me.length;se++){if(me[se]==="params")continue;Kt.push(me[se]),Zt.push($e[se])}let ln=[...hn,...qe,...Kt],un=`return (async () => {
416
+ ${ne}
409
417
  ${ns}
410
418
  return module.exports
411
- })()`,Ge=x(un,ln.join("\x00")),it=Co.get(Ge);if(!it)it=Function(...ln,un),Co.set(Ge,it);let nt=n.__stx_options?.runtimeConfig;if(nt||/\buse(?:Server)?RuntimeConfig\b/.test(c))await vn(n,t,nt);let Ze=await ze(n.__stx_runtime_config??xn()??O(),()=>dr(n,()=>it(y,v,j,P,D,X,F,L,te,ut,pr,vi,Vs,ae,se,ue,Ee,Te,Ae,Je,Tt,Gn,ft,dt,ke.setResponseStatus,ke.setResponseHeader,ke.notFound,pt,Lt,ir,st,Ue,Bt,on,Yn,zt,Q,qe,Wt,Qn,bt,Qe,Ft,an,Vt,Ut,or,Ht,es,et,Xe.confirm,Xe.alert,Xe.fetch,cn,...tt,...Zt)));if(i.preserveExisting){for(let[ne,le]of Object.entries(Ze))if(!(ne in n)||n[ne]===void 0)n[ne]=le}else Object.assign(n,Ze);for(let[ne,le]of Object.entries(P))if(!(ne in n))n[ne]=le}catch(ee){if(n.__stx_strict_hydration)throw ee;let re=Yf(ee instanceof Error?ee.message:String(ee));if(Zf(re))console.warn(`[stx] server <script> in ${t??"<unknown>"} imports a module that does not resolve, so every variable in that script is undefined. Cause: ${re}`),i.onFailure?.({kind:"module-resolution",message:re,error:ee});else if(Qf(ee))console.warn(`[stx] server <script> in ${t??"<unknown>"} does not parse, so every variable in that script is undefined. Cause: ${re}`),i.onFailure?.({kind:"syntax",message:re,error:ee});else if(eg(re))console.warn(`[stx] server <script> in ${t??"<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: ${re}`),i.onFailure?.({kind:"missing-binding",message:re,error:ee});else{let me=`${t??"<unknown>"}\x00${re}`;if(Ct.env.STX_DEBUG||!To.has(me))To.add(me),console.warn(`[stx] server <script> in ${t??"<unknown>"} threw, so every variable in that script is undefined and anything that reads one renders empty. Cause: ${re}`);i.onFailure?.({kind:"unknown",message:re,error:ee})}try{await Yl(c,n,t)}catch(me){if(Ct.env.STX_DEBUG){let we=me instanceof Error?me.message:String(me);console.warn(`[stx] fallback extraction also failed in ${t??"<unknown>"}: ${we}`)}}}}function tg(e){let n=0,t=null,i=!1,a=!1;for(let l=0;l<e.length;l++){let c=e[l];if(t){if(c===t){if(t=null,i||n===0)a=!0}continue}if(c==="'"||c==='"'||c==="`"){t=c;continue}if(c==="{")n++;else if(c==="}")n--;else if(e.startsWith("from",l)&&n===0)i=!0}return t===null&&n===0&&a}var Zl=/^(?:export\s+)?(?:const|let|var)\s+[A-Za-z_$][\w$]*(?:\s*,\s*[A-Za-z_$][\w$]*)*\s*;?$/;function pi(e,n){let t=n?Ye.dirname(n):Ct.cwd(),i=Ct.cwd(),a=e.split(`
412
- `),l=[],c=0;while(c<a.length){let y=a[c].trim();if(y.startsWith("interface ")||y.startsWith("export interface ")||y.startsWith("type ")||y.startsWith("export type ")){if(y.includes("{")&&!y.includes("}")){let v=0;for(;c<a.length;c++){for(let E of a[c])if(E==="{")v++;else if(E==="}")v--;if(v<=0)break}}c++;continue}if(y.startsWith("definePageMeta(")){let v=0,E=!1,R=c;for(let j=c;j<a.length&&!E;j++){let P=null,D=!1,X=a[j];for(let F=0;F<X.length;F++){let L=X[F];if(D){D=!1;continue}if(L==="\\"){D=!0;continue}if(P){if(L===P)P=null;continue}if(L==='"'||L==="'"||L==="`"){P=L;continue}if(L==="(")v++;else if(L===")"){if(v--,v===0){c=j+1,E=!0;break}}}}if(!E)c=a.length;let M=a.slice(R,c).join(`
413
- `),N=[];for(let j of["title","description"]){let P=new RegExp(`\\b${j}\\s*:\\s*(['"\`])((?:\\\\.|(?!\\1)[^\\\\])*)\\1`).exec(M);if(P)N.push(`${j}: ${JSON.stringify(P[2])}`)}if(N.length>0)l.push(`useSeoMeta({ ${N.join(", ")} });`);continue}if(y.startsWith("import ")||y==="import"||y.startsWith("import{")||/^import['"]/.test(y)){let v=y,E=0;while(!tg(v)&&c+E+1<a.length)E++,v=`${v} ${a[c+E].trim()}`;c+=E;let R=v.match(/^import\s+(\w+)\s+from\s+['"](.+?)['"]/),M=v.match(/^import\s+\{([^}]*)\}\s+from\s+['"](.+?)['"]/),N=v.match(/^import\s*['"](.+?)['"]/),j=v,P=(D)=>{if(D.startsWith("."))return Ye.resolve(t,D);if(D.startsWith("~/")||D.startsWith("@/"))return Ye.resolve(i,D.slice(2));try{return Bun.resolveSync(D,t)}catch{return D}};if(R){let[,D,X]=R,F=P(X);l.push(`const ${D} = (await import('${F}')).default`),l.push(`module.exports.${D} = ${D};`)}else if(M){let[,D,X]=M,F=P(X),L=[],Q=[],te=Hl.has(X);for(let ae of D.split(",")){let se=ae.trim();if(!se)continue;let ue=se.split(/\s+as\s+/);if(ue.length===2){let[Ee,Te]=[ue[0].trim(),ue[1].trim()];if(te&&ko.has(Ee)){l.push(`const ${Te} = ${Ee};`);continue}L.push(`${Ee}: ${Te}`),Q.push(Te)}else{if(te&&ko.has(se))continue;L.push(se),Q.push(se)}}if(L.length>0)l.push(`const { ${L.join(", ")} } = await import('${F}')`);for(let ae of Q)l.push(`module.exports.${ae} = ${ae};`)}else if(N){let D=P(N[1]);l.push(`await import('${D}')`)}else l.push(j);c++;continue}if(Zl.test(y))l.push(a[c]),c++;else if(y.startsWith("export const ")||y.startsWith("export let ")||y.startsWith("export var ")){let v=Io(a,c),{type:E,name:R,value:M}=v;l.push(`${E} ${R} = ${M};`),l.push(`module.exports.${R} = ${R};`),c=v.nextIndex}else if(y.startsWith("export function ")||y.startsWith("export async function ")){let v=rr(a,c);l.push(v.functionCode),l.push(`module.exports.${v.name} = ${v.name};`),c=v.nextIndex}else if(y.startsWith("const ")||y.startsWith("let ")||y.startsWith("var ")){let v=Io(a,c),{type:E,name:R,value:M}=v;l.push(`${E} ${R} = ${M};`),l.push(`module.exports.${R} = ${R};`),c=v.nextIndex}else if(y.startsWith("function ")||y.startsWith("async function ")){let v=rr(a,c);l.push(v.functionCode),l.push(`module.exports.${v.name} = ${v.name};`),c=v.nextIndex}else if(y.startsWith("export default function ")||y.startsWith("export default async function ")){let v=a[c].replace(/^(\s*)export\s+default\s+/,"$1"),E=[...a];E[c]=v;let R=rr(E,c);if(l.push(R.functionCode),R.name)l.push(`module.exports.default = ${R.name};`);c=R.nextIndex}else if(y.startsWith("export default ")){let v=y.replace(/^export\s+default\s+/,"").replace(/;$/,"");l.push(`module.exports.default = ${v};`),c++}else if(y.startsWith("class ")||y.startsWith("export class ")){let v=y.match(/(?:export\s+)?class\s+(\w+)/);if(v){let E=v[1],R=a[c].replace(/^export\s+/,""),M=0,N=c;for(;N<a.length;N++){let j=a[N];for(let P of j)if(P==="{")M++;else if(P==="}")M--;if(N>c)R+=`
414
- `+j;if(M<=0&&N>=c)break}l.push(R),l.push(`module.exports.${E} = ${E};`),c=N+1}else l.push(y),c++}else if(y.includes("module.exports"))l.push(y),c++;else if(y.trim()&&!y.startsWith("//"))l.push(y),c++;else c++}return ql(l.join(`
415
- `),t,i)}function ql(e,n,t){let i=e.length,a="",l=0,c=null,y=!1,v=!1,E=0;while(l<i){let R=e[l],M=e[l+1];if(y){if(a+=R,R===`
416
- `)y=!1;l++;continue}if(v){if(a+=R,R==="*"&&M==="/"){a+=M,l+=2,v=!1;continue}l++;continue}if(!c&&R==="/"&&M==="/"){y=!0,a+=R,l++;continue}if(!c&&R==="/"&&M==="*"){v=!0,a+=R,l++;continue}if(c){if(a+=R,R==="\\"){a+=M,l+=2;continue}if(R===c&&c!=="`"){c=null,l++;continue}if(c==="`"){if(R==="$"&&M==="{"){E++,a+=M,l+=2;continue}if(R==="`"){c=null,l++;continue}}l++;continue}if(E>0){if(R==="{")E++;else if(R==="}")E--}if(R==='"'||R==="'"||R==="`"){c=R,a+=R,l++;continue}if(R==="a"&&e.startsWith("await",l)){let N=Xl(e,l);if(N){let{quote:j,path:P,end:D}=N;if(P.startsWith(".")||P.startsWith("~/")||P.startsWith("@/")){let X=P.startsWith(".")?Ye.resolve(n,P):Ye.resolve(t,P.slice(2));a+=`await import(${j}${X}${j})`,l=D;continue}}}a+=R,l++}return a}function Xl(e,n){let t=n+5;if(t>=e.length)return null;if(!/\s/.test(e[t]))return null;while(t<e.length&&/\s/.test(e[t]))t++;if(!e.startsWith("import",t))return null;t+=6;while(t<e.length&&/\s/.test(e[t]))t++;if(e[t]!=="(")return null;t++;while(t<e.length&&/\s/.test(e[t]))t++;let i=e[t];if(i!=="'"&&i!=='"')return null;t++;let a=t;while(t<e.length&&e[t]!==i)if(e[t]==="\\")t+=2;else t++;if(t>=e.length)return null;let l=e.slice(a,t);t++;while(t<e.length&&/\s/.test(e[t]))t++;if(e[t]!==")")return null;return{quote:i,path:l,end:t+1}}function Do(e,n){let t=e[n];if(t!=="{"&&t!=="[")return null;let a=w(e,t,t==="{"?"}":"]",n);if(a===-1)return null;return{pattern:e.slice(n,a+1),endPos:a+1}}function jo(e){let n=[],t=e.slice(1,-1).trim();if(!t)return n;let i=0,a=0,l="";while(i<t.length){let c=t[i];if(c==="{"||c==="["){let y=a===0?Do(t,i):null;if(y){n.push(...jo(y.pattern)),i=y.endPos,l="";continue}a++}else if(c==="}"||c==="]")a--;if(a>0){i++;continue}if(c===","){if(l.trim())n.push(l.trim());l="",i++;continue}if(c===":"){l="",i++;continue}if(c==="="){if(l.trim())n.push(l.trim());l="",i++;while(i<t.length&&t[i]!==","&&a===0){if(t[i]==="{"||t[i]==="[")a++;else if(t[i]==="}"||t[i]==="]")a--;i++}continue}if(/[\w$]/.test(c))l+=c;i++}if(l.trim())n.push(l.trim());return n}function ng(e){let n=/^(?:export\s+)?(const|let|var)\s+([A-Za-z_$][\w$]*)/.exec(e);if(!n)return null;let t=n[0].length,i=(a)=>a===" "||a==="\t";while(t<e.length&&i(e[t]))t++;if(e[t]===":"){let a=0,l=null;t++;for(;t<e.length;t++){let c=e[t];if(l){if(c==="\\"){t++;continue}if(c===l)l=null;continue}if(c==="'"||c==='"'||c==="`"){l=c;continue}if(c==="("||c==="["||c==="{"||c==="<"){a++;continue}if(c===")"||c==="]"||c==="}"||c===">"){a--;continue}if(c==="="&&a<=0){let y=e[t+1],v=e[t-1];if(y!=="="&&y!==">"&&v!=="="&&v!=="!"&&v!=="<"&&v!==">")break}}if(e[t]!=="=")return null}while(t<e.length&&i(e[t]))t++;if(e[t]!=="=")return null;return{type:n[1],name:n[2],value:e.slice(t+1).trim()}}function Ao(e,n,t,i){let a=null,l=!1;for(let c of e){if(l){l=!1;continue}if(c==="\\"){l=!0;continue}if(a){if(c===a)a=null;continue}if(c==="'"||c==='"'||c==="`"){a=c;continue}if(c===n)i++;else if(c===t)i--}return i}function Io(e,n){let t=e[n].trim(),i=ng(t),a=i?[t,i.type,i.name,i.value]:null;if(!a){let R=t.match(/^(?:export\s+)?(const|let|var)\s+/);if(R){let M=t.slice(R[0].length),N=n;if(M.startsWith("{")||M.startsWith("[")){let P=M[0],D=P==="{"?"}":"]",X=Ao(M,P,D,0),F=M;for(let L=n+1;L<e.length&&X>0;L++)F+=` ${e[L].trim()}`,N=L,X=Ao(e[L],P,D,X);if(X>0)F=M,N=n;M=F}let j=Do(M,0);if(j){let P=R[1],D=j.pattern,X=M.slice(j.endPos).trim();if(X.startsWith("=")){let F=X.slice(1).trim(),L=F,Q=Math.max(N,n);if(Po(F)){let ue=Oo(e,Q,F);L=ue.value,Q=ue.nextIndex}else Q=Q+1;L=L.trim().replace(/;$/,"");let te=jo(D),ae=`__stx_src_${n}`,se=te.map((ue)=>`module.exports.${ue} = ${ue};`).join(`
417
- `);return{type:P,name:ae,value:`${L}; ${P} ${D} = ${ae};
418
- ${se}`,nextIndex:Q}}}}throw Error(`Failed to parse variable declaration: ${t}`)}let[,l,c,y]=a,v=y,E=n;if(Po(y)){let R=Oo(e,n,y);v=R.value,E=R.nextIndex}else E=n+1;while(E<e.length){let R=e[E].trim();if(R.startsWith(".")||R.startsWith("?."))v+=`
419
- ${e[E]}`,E++;else break}return v=v.trim().replace(/;$/,""),{type:l,name:c,value:v,nextIndex:E}}function rr(e,n){let t=e[n].trim(),i=t.match(/^(?:export\s+)?(?:async\s+)?function\s+(\w+)/);if(!i)throw Error(`Failed to parse function declaration: ${t}`);let[,a]=i,l=t.replace(/^export\s+/,""),c=n;if(Jl(t)){let y=Gl(e,n,l);l=y.functionCode,c=y.nextIndex}else c=n+1;return{name:a,functionCode:l,nextIndex:c}}function Po(e){let n=e.trim();if(n.startsWith("{"))return w(n,"{","}",0)===-1;if(n.startsWith("["))return w(n,"[","]",0)===-1;return!No(n)}function No(e){let n={paren:0,bracket:0,brace:0},t=null,i=0;for(let a=0;a<e.length;a++){let l=e[a];if((a>0?e[a-1]:"")==="\\"&&t)continue;if((l==='"'||l==="'")&&!t){t=l;continue}if(l===t&&t!=="`"){t=null;continue}if(l==="`"&&!t){t="`";continue}if(l==="`"&&t==="`"&&i===0){t=null;continue}if(t==="`"&&l==="$"&&e[a+1]==="{"){i++,a++;continue}if(i>0&&l==="{"){i++;continue}if(i>0&&l==="}"){i--;continue}if(t)continue;if(l==="(")n.paren++;else if(l===")")n.paren--;else if(l==="[")n.bracket++;else if(l==="]")n.bracket--;else if(l==="{")n.brace++;else if(l==="}")n.brace--}return n.paren===0&&n.bracket===0&&n.brace===0&&t===null}function Lo(e){let n=e.indexOf("(");if(n===-1)return e.indexOf("{");let t=w(e,"(",")",n);if(t===-1)return-1;return e.indexOf("{",t)}function Jl(e){let n=Lo(e);if(n===-1)return!0;return w(e,"{","}",n)===-1}function Oo(e,n,t){let i=t,a=n+1;while(a<e.length&&!No(i)){let l=e[a];i+=`
419
+ })()`,Qe=x(un,ln.join("\x00")),ct=Po.get(Qe);if(!ct)ct=Function(...ln,un),Po.set(Qe,ct);let it=n.__stx_options?.runtimeConfig;if(it||/\buse(?:Server)?RuntimeConfig\b/.test(c))await vn(n,t,it);let Xe=await ze(n.__stx_runtime_config??xn()??O(),()=>dr(n,()=>ct(y,v,j,P,M,X,F,L,ee,Je,pr,xi,Us,re,te,le,Ee,we,Re,Ke,Ze,Gn,dt,pt,Ce.setResponseStatus,Ce.setResponseHeader,Ce.notFound,gt,Lt,ir,ot,Ue,Bt,on,Yn,zt,Q,Ge,Wt,Qn,yt,tt,Ft,an,Vt,Ut,or,Ht,es,nt,Ye.confirm,Ye.alert,Ye.fetch,cn,...st,...Zt)));if(i.preserveExisting){for(let[se,ue]of Object.entries(Xe))if(!(se in n)||n[se]===void 0)n[se]=ue}else Object.assign(n,Xe);for(let[se,ue]of Object.entries(P))if(!(se in n))n[se]=ue}catch(ne){if(n.__stx_strict_hydration)throw ne;let ae=Yf(ne instanceof Error?ne.message:String(ne));if(Zf(ae))console.warn(`[stx] server <script> in ${t??"<unknown>"} imports a module that does not resolve, so every variable in that script is undefined. Cause: ${ae}`),i.onFailure?.({kind:"module-resolution",message:ae,error:ne});else if(Qf(ne))console.warn(`[stx] server <script> in ${t??"<unknown>"} does not parse, so every variable in that script is undefined. Cause: ${ae}`),i.onFailure?.({kind:"syntax",message:ae,error:ne});else if(eg(ae))console.warn(`[stx] server <script> in ${t??"<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: ${ae}`),i.onFailure?.({kind:"missing-binding",message:ae,error:ne});else{let me=`${t??"<unknown>"}\x00${ae}`;if(Tt.env.STX_DEBUG||!Oo.has(me))Oo.add(me),console.warn(`[stx] server <script> in ${t??"<unknown>"} threw, so every variable in that script is undefined and anything that reads one renders empty. Cause: ${ae}`);i.onFailure?.({kind:"unknown",message:ae,error:ne})}try{await tu(c,n,t)}catch(me){if(Tt.env.STX_DEBUG){let $e=me instanceof Error?me.message:String(me);console.warn(`[stx] fallback extraction also failed in ${t??"<unknown>"}: ${$e}`)}}}}function tg(e){let n=0,t=null,i=!1,a=!1;for(let l=0;l<e.length;l++){let c=e[l];if(t){if(c===t){if(t=null,i||n===0)a=!0}continue}if(c==="'"||c==='"'||c==="`"){t=c;continue}if(c==="{")n++;else if(c==="}")n--;else if(e.startsWith("from",l)&&n===0)i=!0}return t===null&&n===0&&a}var Jl=/^(?:export\s+)?(?:const|let|var)\s+[A-Za-z_$][\w$]*(?:\s*,\s*[A-Za-z_$][\w$]*)*\s*;?$/;function fi(e,n){let t=n?et.dirname(n):Tt.cwd(),i=Tt.cwd(),a=e.split(`
420
+ `),l=[],c=0;while(c<a.length){let y=a[c].trim();if(y.startsWith("interface ")||y.startsWith("export interface ")||y.startsWith("type ")||y.startsWith("export type ")){if(y.includes("{")&&!y.includes("}")){let v=0;for(;c<a.length;c++){for(let E of a[c])if(E==="{")v++;else if(E==="}")v--;if(v<=0)break}}c++;continue}if(y.startsWith("definePageMeta(")){let v=0,E=!1,R=c;for(let j=c;j<a.length&&!E;j++){let P=null,M=!1,X=a[j];for(let F=0;F<X.length;F++){let L=X[F];if(M){M=!1;continue}if(L==="\\"){M=!0;continue}if(P){if(L===P)P=null;continue}if(L==='"'||L==="'"||L==="`"){P=L;continue}if(L==="(")v++;else if(L===")"){if(v--,v===0){c=j+1,E=!0;break}}}}if(!E)c=a.length;let D=a.slice(R,c).join(`
421
+ `),N=[];for(let j of["title","description"]){let P=new RegExp(`\\b${j}\\s*:\\s*(['"\`])((?:\\\\.|(?!\\1)[^\\\\])*)\\1`).exec(D);if(P)N.push(`${j}: ${JSON.stringify(P[2])}`)}if(N.length>0)l.push(`useSeoMeta({ ${N.join(", ")} });`);continue}if(y.startsWith("import ")||y==="import"||y.startsWith("import{")||/^import['"]/.test(y)){let v=y,E=0;while(!tg(v)&&c+E+1<a.length)E++,v=`${v} ${a[c+E].trim()}`;c+=E;let R=v.match(/^import\s+(\w+)\s+from\s+['"](.+?)['"]/),D=v.match(/^import\s+\{([^}]*)\}\s+from\s+['"](.+?)['"]/),N=v.match(/^import\s*['"](.+?)['"]/),j=v,P=(M)=>{if(M.startsWith("."))return et.resolve(t,M);if(M.startsWith("~/")||M.startsWith("@/"))return et.resolve(i,M.slice(2));try{return Bun.resolveSync(M,t)}catch{return M}};if(R){let[,M,X]=R,F=P(X);l.push(`const ${M} = (await import('${F}')).default`),l.push(`module.exports.${M} = ${M};`)}else if(D){let[,M,X]=D,F=P(X),L=[],Q=[],ee=ql.has(X);for(let re of M.split(",")){let te=re.trim();if(!te)continue;let le=te.split(/\s+as\s+/);if(le.length===2){let[Ee,we]=[le[0].trim(),le[1].trim()];if(ee&&Ao.has(Ee)){l.push(`const ${we} = ${Ee};`);continue}L.push(`${Ee}: ${we}`),Q.push(we)}else{if(ee&&Ao.has(te))continue;L.push(te),Q.push(te)}}if(L.length>0)l.push(`const { ${L.join(", ")} } = await import('${F}')`);for(let re of Q)l.push(`module.exports.${re} = ${re};`)}else if(N){let M=P(N[1]);l.push(`await import('${M}')`)}else l.push(j);c++;continue}if(Jl.test(y))l.push(a[c]),c++;else if(y.startsWith("export const ")||y.startsWith("export let ")||y.startsWith("export var ")){let v=Do(a,c),{type:E,name:R,value:D}=v;l.push(`${E} ${R} = ${D};`),l.push(`module.exports.${R} = ${R};`),c=v.nextIndex}else if(y.startsWith("export function ")||y.startsWith("export async function ")){let v=rr(a,c);l.push(v.functionCode),l.push(`module.exports.${v.name} = ${v.name};`),c=v.nextIndex}else if(y.startsWith("const ")||y.startsWith("let ")||y.startsWith("var ")){let v=Do(a,c),{type:E,name:R,value:D}=v;l.push(`${E} ${R} = ${D};`),l.push(`module.exports.${R} = ${R};`),c=v.nextIndex}else if(y.startsWith("function ")||y.startsWith("async function ")){let v=rr(a,c);l.push(v.functionCode),l.push(`module.exports.${v.name} = ${v.name};`),c=v.nextIndex}else if(y.startsWith("export default function ")||y.startsWith("export default async function ")){let v=a[c].replace(/^(\s*)export\s+default\s+/,"$1"),E=[...a];E[c]=v;let R=rr(E,c);if(l.push(R.functionCode),R.name)l.push(`module.exports.default = ${R.name};`);c=R.nextIndex}else if(y.startsWith("export default ")){let v=y.replace(/^export\s+default\s+/,"").replace(/;$/,"");l.push(`module.exports.default = ${v};`),c++}else if(y.startsWith("class ")||y.startsWith("export class ")){let v=y.match(/(?:export\s+)?class\s+(\w+)/);if(v){let E=v[1],R=a[c].replace(/^export\s+/,""),D=0,N=c;for(;N<a.length;N++){let j=a[N];for(let P of j)if(P==="{")D++;else if(P==="}")D--;if(N>c)R+=`
422
+ `+j;if(D<=0&&N>=c)break}l.push(R),l.push(`module.exports.${E} = ${E};`),c=N+1}else l.push(y),c++}else if(y.includes("module.exports"))l.push(y),c++;else if(y.trim()&&!y.startsWith("//"))l.push(y),c++;else c++}return Gl(l.join(`
423
+ `),t,i)}function Gl(e,n,t){let i=e.length,a="",l=0,c=null,y=!1,v=!1,E=0;while(l<i){let R=e[l],D=e[l+1];if(y){if(a+=R,R===`
424
+ `)y=!1;l++;continue}if(v){if(a+=R,R==="*"&&D==="/"){a+=D,l+=2,v=!1;continue}l++;continue}if(!c&&R==="/"&&D==="/"){y=!0,a+=R,l++;continue}if(!c&&R==="/"&&D==="*"){v=!0,a+=R,l++;continue}if(c){if(a+=R,R==="\\"){a+=D,l+=2;continue}if(R===c&&c!=="`"){c=null,l++;continue}if(c==="`"){if(R==="$"&&D==="{"){E++,a+=D,l+=2;continue}if(R==="`"){c=null,l++;continue}}l++;continue}if(E>0){if(R==="{")E++;else if(R==="}")E--}if(R==='"'||R==="'"||R==="`"){c=R,a+=R,l++;continue}if(R==="a"&&e.startsWith("await",l)){let N=Yl(e,l);if(N){let{quote:j,path:P,end:M}=N;if(P.startsWith(".")||P.startsWith("~/")||P.startsWith("@/")){let X=P.startsWith(".")?et.resolve(n,P):et.resolve(t,P.slice(2));a+=`await import(${j}${X}${j})`,l=M;continue}}}a+=R,l++}return a}function Yl(e,n){let t=n+5;if(t>=e.length)return null;if(!/\s/.test(e[t]))return null;while(t<e.length&&/\s/.test(e[t]))t++;if(!e.startsWith("import",t))return null;t+=6;while(t<e.length&&/\s/.test(e[t]))t++;if(e[t]!=="(")return null;t++;while(t<e.length&&/\s/.test(e[t]))t++;let i=e[t];if(i!=="'"&&i!=='"')return null;t++;let a=t;while(t<e.length&&e[t]!==i)if(e[t]==="\\")t+=2;else t++;if(t>=e.length)return null;let l=e.slice(a,t);t++;while(t<e.length&&/\s/.test(e[t]))t++;if(e[t]!==")")return null;return{quote:i,path:l,end:t+1}}function Bo(e,n){let t=e[n];if(t!=="{"&&t!=="[")return null;let a=w(e,t,t==="{"?"}":"]",n);if(a===-1)return null;return{pattern:e.slice(n,a+1),endPos:a+1}}function zo(e){let n=[],t=e.slice(1,-1).trim();if(!t)return n;let i=0,a=0,l="";while(i<t.length){let c=t[i];if(c==="{"||c==="["){let y=a===0?Bo(t,i):null;if(y){n.push(...zo(y.pattern)),i=y.endPos,l="";continue}a++}else if(c==="}"||c==="]")a--;if(a>0){i++;continue}if(c===","){if(l.trim())n.push(l.trim());l="",i++;continue}if(c===":"){l="",i++;continue}if(c==="="){if(l.trim())n.push(l.trim());l="",i++;while(i<t.length&&t[i]!==","&&a===0){if(t[i]==="{"||t[i]==="[")a++;else if(t[i]==="}"||t[i]==="]")a--;i++}continue}if(/[\w$]/.test(c))l+=c;i++}if(l.trim())n.push(l.trim());return n}function ng(e){let n=/^(?:export\s+)?(const|let|var)\s+([A-Za-z_$][\w$]*)/.exec(e);if(!n)return null;let t=n[0].length,i=(a)=>a===" "||a==="\t";while(t<e.length&&i(e[t]))t++;if(e[t]===":"){let a=0,l=null;t++;for(;t<e.length;t++){let c=e[t];if(l){if(c==="\\"){t++;continue}if(c===l)l=null;continue}if(c==="'"||c==='"'||c==="`"){l=c;continue}if(c==="("||c==="["||c==="{"||c==="<"){a++;continue}if(c===")"||c==="]"||c==="}"||c===">"){a--;continue}if(c==="="&&a<=0){let y=e[t+1],v=e[t-1];if(y!=="="&&y!==">"&&v!=="="&&v!=="!"&&v!=="<"&&v!==">")break}}if(e[t]!=="=")return null}while(t<e.length&&i(e[t]))t++;if(e[t]!=="=")return null;return{type:n[1],name:n[2],value:e.slice(t+1).trim()}}function Mo(e,n,t,i){let a=null,l=!1;for(let c of e){if(l){l=!1;continue}if(c==="\\"){l=!0;continue}if(a){if(c===a)a=null;continue}if(c==="'"||c==='"'||c==="`"){a=c;continue}if(c===n)i++;else if(c===t)i--}return i}function Do(e,n){let t=e[n].trim(),i=ng(t),a=i?[t,i.type,i.name,i.value]:null;if(!a){let R=t.match(/^(?:export\s+)?(const|let|var)\s+/);if(R){let D=t.slice(R[0].length),N=n;if(D.startsWith("{")||D.startsWith("[")){let P=D[0],M=P==="{"?"}":"]",X=Mo(D,P,M,0),F=D;for(let L=n+1;L<e.length&&X>0;L++)F+=` ${e[L].trim()}`,N=L,X=Mo(e[L],P,M,X);if(X>0)F=D,N=n;D=F}let j=Bo(D,0);if(j){let P=R[1],M=j.pattern,X=D.slice(j.endPos).trim();if(X.startsWith("=")){let F=X.slice(1).trim(),L=F,Q=Math.max(N,n);if(jo(F)){let le=No(e,Q,F);L=le.value,Q=le.nextIndex}else Q=Q+1;L=L.trim().replace(/;$/,"");let ee=zo(M),re=`__stx_src_${n}`,te=ee.map((le)=>`module.exports.${le} = ${le};`).join(`
425
+ `);return{type:P,name:re,value:`${L}; ${P} ${M} = ${re};
426
+ ${te}`,nextIndex:Q}}}}throw Error(`Failed to parse variable declaration: ${t}`)}let[,l,c,y]=a,v=y,E=n;if(jo(y)){let R=No(e,n,y);v=R.value,E=R.nextIndex}else E=n+1;while(E<e.length){let R=e[E].trim();if(R.startsWith(".")||R.startsWith("?."))v+=`
427
+ ${e[E]}`,E++;else break}return v=v.trim().replace(/;$/,""),{type:l,name:c,value:v,nextIndex:E}}function rr(e,n){let t=e[n].trim(),i=t.match(/^(?:export\s+)?(?:async\s+)?function\s+(\w+)/);if(!i)throw Error(`Failed to parse function declaration: ${t}`);let[,a]=i,l=t.replace(/^export\s+/,""),c=n;if(Ql(t)){let y=eu(e,n,l);l=y.functionCode,c=y.nextIndex}else c=n+1;return{name:a,functionCode:l,nextIndex:c}}function jo(e){let n=e.trim();if(n.startsWith("{"))return w(n,"{","}",0)===-1;if(n.startsWith("["))return w(n,"[","]",0)===-1;return!Wo(n)}function Wo(e){let n={paren:0,bracket:0,brace:0},t=null,i=0;for(let a=0;a<e.length;a++){let l=e[a];if((a>0?e[a-1]:"")==="\\"&&t)continue;if((l==='"'||l==="'")&&!t){t=l;continue}if(l===t&&t!=="`"){t=null;continue}if(l==="`"&&!t){t="`";continue}if(l==="`"&&t==="`"&&i===0){t=null;continue}if(t==="`"&&l==="$"&&e[a+1]==="{"){i++,a++;continue}if(i>0&&l==="{"){i++;continue}if(i>0&&l==="}"){i--;continue}if(t)continue;if(l==="(")n.paren++;else if(l===")")n.paren--;else if(l==="[")n.bracket++;else if(l==="]")n.bracket--;else if(l==="{")n.brace++;else if(l==="}")n.brace--}return n.paren===0&&n.bracket===0&&n.brace===0&&t===null}function Fo(e){let n=e.indexOf("(");if(n===-1)return e.indexOf("{");let t=w(e,"(",")",n);if(t===-1)return-1;return e.indexOf("{",t)}function Ql(e){let n=Fo(e);if(n===-1)return!0;return w(e,"{","}",n)===-1}function No(e,n,t){let i=t,a=n+1;while(a<e.length&&!Wo(i)){let l=e[a];i+=`
420
428
  ${l}`,a++}while(a<e.length){let l=e[a].trim();if(l.startsWith(".")||l.startsWith("?."))i+=`
421
- ${e[a]}`,a++;else break}return{value:i,nextIndex:a}}function Gl(e,n,t){let i=t,a=n+1;while(a<e.length){let l=Lo(i);if(l!==-1){if(w(i,"{","}",l)!==-1)break}let c=e[a];i+=`
422
- ${c}`,a++}return{functionCode:i,nextIndex:a}}function Mo(e,n){let t=u(e,n)??u(`(${e})`,n);if(t!==void 0)return t;if(!/\bprocess\b/.test(e))return;let i={...n,process:Object.freeze({env:{...Ct.env}})},a=Object.keys(i).filter(jt),l=a.map((c)=>i[c]);try{return Function(...a,`'use strict'; return (${e});`)(...l)}catch{try{return Function(...a,`'use strict'; return ${e};`)(...l)}catch{return}}}async function Yl(e,n,t){let i=e.matchAll(/export\s+(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:export\s+|$))/g);for(let l of i){let[,,c,y]=l;try{let v=y.trim().replace(/;$/,""),E=Mo(v,n);if(E!==void 0)n[c]=E}catch(v){console.warn(`Failed to parse export ${c} in fallback:`,v)}}let a=e.matchAll(/(?:^|\n)\s*(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:(?:const|let|var|function|export)\s+|$))/g);for(let l of a){let[,,c,y]=l;if(!(c in n))try{let v=y.trim().replace(/;$/,""),E=Mo(v,n);if(E!==void 0)n[c]=E}catch{}}}function Vc(e){let n=e.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),t=n?n[1]:"",i=n?e.replace(/<script\b[^>]*>[\s\S]*?<\/script>/i,""):e;return{scriptContent:t,templateWithoutScript:i}}function Uc(e){let n=e.trim();if(!n)return!1;return/(?:const|let|var|function)\s+\w+/.test(n)}
423
- export{Pe,ve,z,As,Ps,H,yr,Is,Os,ri,si,Ns,oi,Ec,Rt,Ie,o,dn,U,At,oe,b,Tc,x,br,Ms,xe,C,Oe,de,wr,W,pn,Ne,S,$c,pe,G,vr,xr,ie,Pt,J,I,rt,Sr,kr,It,ii,ai,Gf,Me,Rc,Ac,Pc,ci,Ic,Ds,li,Oc,Nc,Mc,ui,fn,Ls,gn,Ot,Nt,Dc,js,Lc,mn,_r,Bs,Fs,jc,di,Bc,Fc,zc,Hc,hn,Jf,Yf,Zf,Qf,eg,m,tg,pi,ng,Vc,Uc,fi,gi,rg,Mt,Wc,mi,qc,Wh,De,yn,Le,sg,og,ig,ag,cg,zs,lg,je,Y,Be,ug,Cr,dg,Kc,Xc,hi,Fe,r,bn,Gc,h,fe,qh,Jc,Yc,Zc,yi,Hs,pg,Kh,fg,Xh,Dt,p,V,Z,wn,Se,gg,bi,mg,Gh,_,hg,Jh,T,Yh};
429
+ ${e[a]}`,a++;else break}return{value:i,nextIndex:a}}function eu(e,n,t){let i=t,a=n+1;while(a<e.length){let l=Fo(i);if(l!==-1){if(w(i,"{","}",l)!==-1)break}let c=e[a];i+=`
430
+ ${c}`,a++}return{functionCode:i,nextIndex:a}}function Lo(e,n){let t=u(e,n)??u(`(${e})`,n);if(t!==void 0)return t;if(!/\bprocess\b/.test(e))return;let i={...n,process:Object.freeze({env:{...Tt.env}})},a=Object.keys(i).filter(jt),l=a.map((c)=>i[c]);try{return Function(...a,`'use strict'; return (${e});`)(...l)}catch{try{return Function(...a,`'use strict'; return ${e};`)(...l)}catch{return}}}async function tu(e,n,t){let i=e.matchAll(/export\s+(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:export\s+|$))/g);for(let l of i){let[,,c,y]=l;try{let v=y.trim().replace(/;$/,""),E=Lo(v,n);if(E!==void 0)n[c]=E}catch(v){console.warn(`Failed to parse export ${c} in fallback:`,v)}}let a=e.matchAll(/(?:^|\n)\s*(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:(?:const|let|var|function|export)\s+|$))/g);for(let l of a){let[,,c,y]=l;if(!(c in n))try{let v=y.trim().replace(/;$/,""),E=Lo(v,n);if(E!==void 0)n[c]=E}catch{}}}function Uc(e){let n=e.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),t=n?n[1]:"",i=n?e.replace(/<script\b[^>]*>[\s\S]*?<\/script>/i,""):e;return{scriptContent:t,templateWithoutScript:i}}function Wc(e){let n=e.trim();if(!n)return!1;return/(?:const|let|var|function)\s+\w+/.test(n)}
431
+ export{Pe,ve,z,Ps,Is,H,yr,Os,Ns,si,oi,Ms,ii,$c,Rt,Ie,o,dn,U,At,oe,b,Rc,x,br,Ds,xe,C,Oe,de,wr,W,pn,Ne,S,Ac,pe,G,vr,xr,ie,Pt,J,I,rt,Sr,kr,It,ai,Ls,Gf,Me,Pc,Ic,Oc,ci,Nc,_r,li,Mc,Dc,ui,di,fn,js,gn,Ot,Nt,Lc,Bs,jc,mn,Cr,Fs,zs,Bc,pi,Fc,zc,Hc,Vc,hn,Jf,Yf,Zf,Qf,eg,m,tg,fi,ng,Uc,Wc,gi,mi,rg,Mt,qc,hi,Kc,qh,De,yn,Le,sg,og,ig,ag,cg,Hs,lg,je,Y,Be,ug,Er,dg,Xc,Gc,yi,Fe,s,bn,Jc,h,fe,Kh,Yc,Zc,Qc,bi,Vs,pg,Xh,fg,Gh,Dt,p,V,Z,wn,Se,gg,wi,mg,Jh,_,hg,Yh,T,Zh};