@stacksjs/stx 0.2.845 → 0.2.846

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 (221) hide show
  1. package/dist/builtins/image-worker.d.ts +1 -17
  2. package/dist/builtins/image-worker.js +3 -16
  3. package/dist/{chunk-vf0xbptq.js → chunk-098mrr5f.js} +2 -2
  4. package/dist/{chunk-ndsygfeb.js → chunk-0e4y6h1h.js} +14 -14
  5. package/dist/chunk-13sp1247.js +2 -0
  6. package/dist/chunk-1kdtapc1.js +2 -0
  7. package/dist/{chunk-6x6w0v1k.js → chunk-1qp5808r.js} +3 -3
  8. package/dist/{chunk-hc1f1yq8.js → chunk-1w5hte9z.js} +2 -2
  9. package/dist/chunk-263gby2p.js +2 -0
  10. package/dist/{chunk-4dxq7ft1.js → chunk-2a792g5e.js} +2 -2
  11. package/dist/{chunk-kbv5nwwd.js → chunk-30g5kqy0.js} +1 -1
  12. package/dist/chunk-33ggd5at.js +2 -0
  13. package/dist/chunk-3q19w77r.js +2 -0
  14. package/dist/{chunk-5a7etvxz.js → chunk-4041q9sd.js} +4 -4
  15. package/dist/chunk-40x0vwza.js +2 -0
  16. package/dist/{chunk-c62wxswd.js → chunk-444sbdm8.js} +27 -27
  17. package/dist/chunk-4cmda04d.js +2 -0
  18. package/dist/{chunk-5y3m5vzg.js → chunk-4jmkvzns.js} +2 -2
  19. package/dist/{chunk-0gg7k9cj.js → chunk-4v6mbvqv.js} +4 -4
  20. package/dist/{chunk-rncmfgpk.js → chunk-50tnhq5f.js} +25 -25
  21. package/dist/{chunk-pb9347sn.js → chunk-5903tzcw.js} +3 -3
  22. package/dist/chunk-5xt4tjpm.js +2 -0
  23. package/dist/chunk-6289h3tr.js +2 -0
  24. package/dist/{chunk-nqj1mkkz.js → chunk-66e0d2t7.js} +1 -1
  25. package/dist/{chunk-1c6kczkt.js → chunk-6g7wrn48.js} +1 -1
  26. package/dist/{chunk-3rjgm7qk.js → chunk-6pgq75h9.js} +5 -5
  27. package/dist/chunk-6q7ke5p0.js +2 -0
  28. package/dist/{chunk-y06rw18j.js → chunk-6x6xthsv.js} +2 -2
  29. package/dist/chunk-6ya0860g.js +2 -0
  30. package/dist/{chunk-jabw4ck5.js → chunk-7qwfbafg.js} +2 -2
  31. package/dist/{chunk-r4jwhy37.js → chunk-7rcc2tzz.js} +3 -3
  32. package/dist/{chunk-tpyk6b4c.js → chunk-81nmqdht.js} +2 -2
  33. package/dist/{chunk-py5x8fkq.js → chunk-82vf29ty.js} +2 -2
  34. package/dist/{chunk-48vnw9t9.js → chunk-84myqca7.js} +2 -2
  35. package/dist/{chunk-fs5mshcs.js → chunk-8az9e5b9.js} +5 -5
  36. package/dist/chunk-8k7rfy77.js +3 -0
  37. package/dist/{chunk-28zze2wm.js → chunk-9d9sartn.js} +1 -1
  38. package/dist/chunk-9enwmg0z.js +2 -0
  39. package/dist/{chunk-c6yc6qsv.js → chunk-9hfk5wf1.js} +5 -5
  40. package/dist/chunk-a7z6j9ga.js +2 -0
  41. package/dist/chunk-ab6dw6f4.js +2 -0
  42. package/dist/chunk-adnntqk3.js +2 -0
  43. package/dist/{chunk-47n5s7wk.js → chunk-an6vb4ng.js} +2 -2
  44. package/dist/chunk-bhzbcmm7.js +2 -0
  45. package/dist/{chunk-k1tbgnhf.js → chunk-bsr6kf34.js} +1 -1
  46. package/dist/{chunk-md84j62m.js → chunk-c78dsx3f.js} +10 -10
  47. package/dist/{chunk-ntg8ttm4.js → chunk-caw0wzns.js} +3 -3
  48. package/dist/chunk-cfez1qbm.js +2 -0
  49. package/dist/chunk-cgyddqxw.js +2 -0
  50. package/dist/chunk-cng4fhpt.js +2 -0
  51. package/dist/{chunk-6trgwvt0.js → chunk-cpdfxy8g.js} +12 -12
  52. package/dist/chunk-ctq1qy1g.js +2 -0
  53. package/dist/chunk-cyghcps7.js +2 -0
  54. package/dist/{chunk-2cafvex6.js → chunk-d1pat213.js} +2 -2
  55. package/dist/{chunk-f34ce0pn.js → chunk-d4jhyxp6.js} +6 -6
  56. package/dist/{chunk-xr8hg79c.js → chunk-ds1vj0dw.js} +4 -4
  57. package/dist/{chunk-kxj5sp5w.js → chunk-dspmqeg0.js} +4 -4
  58. package/dist/chunk-e26aqarz.js +2 -0
  59. package/dist/chunk-e7816ep3.js +2 -0
  60. package/dist/{chunk-mnt7jbek.js → chunk-ea5w92vs.js} +3 -3
  61. package/dist/chunk-en8hnq2q.js +2 -0
  62. package/dist/chunk-enz6fsdx.js +2 -0
  63. package/dist/{chunk-tjnf4a8g.js → chunk-evww725k.js} +59 -59
  64. package/dist/chunk-eydqn4gz.js +2 -0
  65. package/dist/chunk-fk7gs41v.js +2 -0
  66. package/dist/chunk-fnfq6fkk.js +12 -0
  67. package/dist/chunk-fx04tq90.js +2 -0
  68. package/dist/chunk-fzba0b0n.js +2 -0
  69. package/dist/chunk-g7tj2tnz.js +2 -0
  70. package/dist/chunk-ga0293gz.js +2 -0
  71. package/dist/chunk-gab3h25h.js +2 -0
  72. package/dist/{chunk-1h6pb8d1.js → chunk-gs33xdk7.js} +4 -4
  73. package/dist/{chunk-ka5ea34g.js → chunk-h76wsqr4.js} +2 -2
  74. package/dist/chunk-hczqyk7c.js +2 -0
  75. package/dist/{chunk-3sskqw4b.js → chunk-hff8z61n.js} +1 -1
  76. package/dist/{chunk-k7am94hr.js → chunk-hp8ny2zb.js} +5 -5
  77. package/dist/chunk-hs6fg0k9.js +2 -0
  78. package/dist/chunk-hsg4ggt0.js +2 -0
  79. package/dist/chunk-j1n2xb48.js +3 -0
  80. package/dist/{chunk-zwxncs2e.js → chunk-j3zy3mrn.js} +6 -6
  81. package/dist/{chunk-02qbawwq.js → chunk-jx14j83s.js} +3 -3
  82. package/dist/chunk-k3pfadjb.js +2 -0
  83. package/dist/chunk-kmnre1tq.js +2 -0
  84. package/dist/{chunk-6tyjvxgb.js → chunk-krdfnsz6.js} +8 -8
  85. package/dist/{chunk-x0dx1pyf.js → chunk-m8cpabd2.js} +3 -3
  86. package/dist/chunk-mgtp037k.js +3 -0
  87. package/dist/chunk-mp42d9v5.js +2 -0
  88. package/dist/chunk-mtmgrccj.js +2 -0
  89. package/dist/{chunk-r3jf8v5a.js → chunk-mzyx6y1a.js} +30 -30
  90. package/dist/chunk-n20tsy6a.js +2 -0
  91. package/dist/{chunk-fm8gfj2g.js → chunk-n475s55q.js} +2 -2
  92. package/dist/{chunk-b6qf7w2b.js → chunk-neh3kewg.js} +4 -4
  93. package/dist/{chunk-y7aqf8r7.js → chunk-ng8nkbp2.js} +2 -2
  94. package/dist/{chunk-eaz30495.js → chunk-nhn69eva.js} +2 -2
  95. package/dist/{chunk-7r4p7zjn.js → chunk-nsc93haq.js} +6 -6
  96. package/dist/{chunk-rk2ex6qx.js → chunk-p8ry1q7c.js} +2 -2
  97. package/dist/chunk-pdt1phnh.js +2 -0
  98. package/dist/{chunk-s68p10zh.js → chunk-ph57nv7v.js} +2 -2
  99. package/dist/{chunk-7s411sa9.js → chunk-prrf0j54.js} +5 -5
  100. package/dist/chunk-q87wwwra.js +2 -0
  101. package/dist/{chunk-87ksn02m.js → chunk-qttjrja7.js} +2 -2
  102. package/dist/{chunk-hgk1v60t.js → chunk-r1984y6y.js} +10 -10
  103. package/dist/chunk-r1mvd96m.js +2 -0
  104. package/dist/{chunk-78q3apyy.js → chunk-r3v1zaj0.js} +2 -2
  105. package/dist/{chunk-vhxrrqrg.js → chunk-rg2gfyy0.js} +2 -2
  106. package/dist/{chunk-rpapxkdm.js → chunk-rgy9c7d8.js} +3 -3
  107. package/dist/{chunk-97bvpszy.js → chunk-rn7710jg.js} +3 -3
  108. package/dist/{chunk-8g5dsjr0.js → chunk-s2a51j0k.js} +6 -6
  109. package/dist/chunk-s321pb85.js +2 -0
  110. package/dist/{chunk-11kp389s.js → chunk-s6qzmwp3.js} +1 -1
  111. package/dist/{chunk-bqsrtvad.js → chunk-serwcna2.js} +2 -2
  112. package/dist/chunk-stss2b88.js +2 -0
  113. package/dist/chunk-svxkcdhh.js +2 -0
  114. package/dist/{chunk-ncrrxp60.js → chunk-sxsjxme0.js} +4 -4
  115. package/dist/{chunk-r8xwd8r1.js → chunk-t3e95q80.js} +13 -13
  116. package/dist/chunk-t6gm8z7x.js +2 -0
  117. package/dist/chunk-tkssavxx.js +2 -0
  118. package/dist/chunk-tw6y23ew.js +2 -0
  119. package/dist/{chunk-302gek13.js → chunk-tzqnf28n.js} +3 -3
  120. package/dist/{chunk-tzdwg9rw.js → chunk-v8y01jbr.js} +4 -4
  121. package/dist/{chunk-9mtyxvhk.js → chunk-vh8wn94m.js} +2 -2
  122. package/dist/chunk-vm34qp5k.js +2 -0
  123. package/dist/chunk-vtg2tqzt.js +2 -0
  124. package/dist/{chunk-6hb75r07.js → chunk-vxayh4az.js} +6 -6
  125. package/dist/{chunk-5p96rafz.js → chunk-vyggv4k0.js} +2 -2
  126. package/dist/{chunk-fg80w4zk.js → chunk-wbx27kdd.js} +2 -2
  127. package/dist/{chunk-315q48qy.js → chunk-wd632rge.js} +7 -7
  128. package/dist/chunk-wddaxpep.js +2 -0
  129. package/dist/{chunk-mveqaxkr.js → chunk-wvsnp294.js} +7 -7
  130. package/dist/{chunk-rb6vr5v9.js → chunk-wzpd3htt.js} +7 -7
  131. package/dist/{chunk-8qjf16yr.js → chunk-x1n01gc1.js} +4 -4
  132. package/dist/{chunk-4rfedg2f.js → chunk-x3pxxx7j.js} +3 -3
  133. package/dist/chunk-x6bt567m.js +2 -0
  134. package/dist/{chunk-8hy5g1hq.js → chunk-xdzs2mxv.js} +5 -5
  135. package/dist/chunk-xf4d9gam.js +2 -0
  136. package/dist/chunk-xf5db38j.js +2 -0
  137. package/dist/{chunk-2ytaezad.js → chunk-xhytkzg7.js} +2 -2
  138. package/dist/{chunk-3ba0nqwm.js → chunk-xj5j18nf.js} +2 -2
  139. package/dist/{chunk-79wb76ya.js → chunk-xq9w5g23.js} +1 -1
  140. package/dist/{chunk-010yhk6m.js → chunk-xskygt2v.js} +5 -5
  141. package/dist/chunk-y5t7ec69.js +2 -0
  142. package/dist/chunk-yk90sqqv.js +2 -0
  143. package/dist/chunk-z231es22.js +2 -0
  144. package/dist/{chunk-n91sm385.js → chunk-z26fg4p0.js} +2 -2
  145. package/dist/{chunk-dhgjq9jx.js → chunk-zkn55966.js} +5 -5
  146. package/dist/chunk-zphekzv8.js +2 -0
  147. package/dist/chunk-zsft5466.js +2 -0
  148. package/dist/{chunk-9vg3jtzw.js → chunk-zx2xwrp3.js} +6 -6
  149. package/dist/{chunk-69b8mr68.js → chunk-zyt8k9n0.js} +2 -2
  150. package/dist/cli.js +19 -19
  151. package/dist/craft-entry.js +2 -2
  152. package/dist/craft.js +2 -2
  153. package/dist/framework-composables.js +13 -1
  154. package/dist/installed-entry.d.ts +8 -0
  155. package/dist/installed-entry.js +19 -0
  156. package/dist/pwa.js +3 -3
  157. package/dist/ssg.js +4 -4
  158. package/package.json +5 -5
  159. package/dist/chunk-01gwdj2y.js +0 -2
  160. package/dist/chunk-12tkqtrv.js +0 -2
  161. package/dist/chunk-168fwztf.js +0 -2
  162. package/dist/chunk-1cdxe8yt.js +0 -2
  163. package/dist/chunk-1k751fgt.js +0 -2
  164. package/dist/chunk-3qa40hgd.js +0 -2
  165. package/dist/chunk-3qstewq3.js +0 -2
  166. package/dist/chunk-40r740w1.js +0 -2
  167. package/dist/chunk-469nzheq.js +0 -2
  168. package/dist/chunk-5hhyqze9.js +0 -2
  169. package/dist/chunk-60jtrz9f.js +0 -2
  170. package/dist/chunk-64evx0my.js +0 -2
  171. package/dist/chunk-6vcpmt0y.js +0 -2
  172. package/dist/chunk-7tdwa595.js +0 -2
  173. package/dist/chunk-7xp2ec0v.js +0 -2
  174. package/dist/chunk-8nq2snvy.js +0 -2
  175. package/dist/chunk-8s27mteq.js +0 -2
  176. package/dist/chunk-8weaawqm.js +0 -2
  177. package/dist/chunk-afyvnpr9.js +0 -2
  178. package/dist/chunk-as6x6be8.js +0 -2
  179. package/dist/chunk-aw45yjrw.js +0 -2
  180. package/dist/chunk-b30fzxwd.js +0 -2
  181. package/dist/chunk-b3wcs8bk.js +0 -2
  182. package/dist/chunk-bygxt820.js +0 -3
  183. package/dist/chunk-c3y7cxe7.js +0 -2
  184. package/dist/chunk-d5bjpjbv.js +0 -2
  185. package/dist/chunk-dmmt4psb.js +0 -12
  186. package/dist/chunk-e1vf62ck.js +0 -2
  187. package/dist/chunk-emzz6seq.js +0 -2
  188. package/dist/chunk-exr9599h.js +0 -2
  189. package/dist/chunk-f1wv2q2z.js +0 -2
  190. package/dist/chunk-fpc1n3je.js +0 -2
  191. package/dist/chunk-fyesbfvr.js +0 -2
  192. package/dist/chunk-fz433ybr.js +0 -2
  193. package/dist/chunk-hbkh87n2.js +0 -2
  194. package/dist/chunk-hpw6hq7p.js +0 -2
  195. package/dist/chunk-j274w1ac.js +0 -2
  196. package/dist/chunk-jf37tpj2.js +0 -2
  197. package/dist/chunk-jv2z9qb7.js +0 -2
  198. package/dist/chunk-k609nyan.js +0 -2
  199. package/dist/chunk-msd0ezxm.js +0 -2
  200. package/dist/chunk-n4c8srx8.js +0 -2
  201. package/dist/chunk-nfxd6y75.js +0 -2
  202. package/dist/chunk-pj1xj34h.js +0 -2
  203. package/dist/chunk-pv2mrc9g.js +0 -2
  204. package/dist/chunk-pwdnqe30.js +0 -2
  205. package/dist/chunk-qeej9h56.js +0 -2
  206. package/dist/chunk-rapk2r7b.js +0 -2
  207. package/dist/chunk-sss23kn5.js +0 -2
  208. package/dist/chunk-sv52qc36.js +0 -3
  209. package/dist/chunk-t4n23dh5.js +0 -2
  210. package/dist/chunk-vkrxrt0a.js +0 -2
  211. package/dist/chunk-vzpbxgg7.js +0 -2
  212. package/dist/chunk-wvwca1e9.js +0 -2
  213. package/dist/chunk-xjbc3bhs.js +0 -2
  214. package/dist/chunk-xtbmntht.js +0 -2
  215. package/dist/chunk-xvd3vdrw.js +0 -2
  216. package/dist/chunk-xvtp7nyj.js +0 -2
  217. package/dist/chunk-xy45tx27.js +0 -2
  218. package/dist/chunk-yg5a54pj.js +0 -2
  219. package/dist/chunk-yhzakgpp.js +0 -2
  220. package/dist/chunk-z3qgv971.js +0 -2
  221. package/dist/chunk-zztfp9qh.js +0 -2
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{He,_n,Ks,Ci,D}from"./chunk-47n5s7wk.js";import{kn}from"./chunk-vhxrrqrg.js";import{Dr,k,gl,ct,Oi,ml}from"./chunk-n91sm385.js";import{I}from"./chunk-zjqvbcwa.js";import{R,_,Xs,u,f,Bt,d,K,z,x,Zs,Ce,Ue,Qs}from"./chunk-r8xwd8r1.js";import{s,me}from"./chunk-x0dx1pyf.js";import{g}from"./chunk-0dve54ne.js";import{X}from"./chunk-jabw4ck5.js";import at from"path";import Wt from"process";import{AsyncLocalStorage as ca}from"async_hooks";var Mr=new ca;function yn(e){return e.__stx_server_data??={pending:new Map,values:new Map}}function jr(e,t){return Mr.run(yn(e),t)}async function Nr(e,t){let n=Mr.getStore();if(!n)throw Error("useServerData must run inside a <script server> render");if(typeof e!=="string"||!e.trim())throw TypeError("useServerData requires a non-empty string key");let i=n.pending.get(e);if(i)return i;let a=Promise.resolve().then(t).then((l)=>{let c=JSON.stringify(l,(v,T)=>{if(T===void 0||typeof T==="function"||typeof T==="symbol"||typeof T==="bigint"||typeof T==="number"&&!Number.isFinite(T))throw TypeError(`useServerData(${JSON.stringify(e)}) requires JSON-serializable data`);if(T&&typeof T==="object"&&!Array.isArray(T)&&Object.getPrototypeOf(T)!==Object.prototype&&Object.getPrototypeOf(T)!==null)throw TypeError(`useServerData(${JSON.stringify(e)}) requires JSON-serializable data`);return T}),b=JSON.parse(c);return n.values.set(e,b),b}).catch((l)=>{throw n.pending.delete(e),l});return n.pending.set(e,a),a}function Er(e){let t=e.__stx_server_data;if(!t?.values.size)return"";return`<script data-stx-scoped data-stx-server-data type="application/json">${JSON.stringify(Object.fromEntries(t.values)).replace(/</g,"\\u003c").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}</script>`}function V(e,t=!1){let n=s(e),i=[],a=new Set,l=0,c=0,b=n.length,v=()=>{if(l!==0)return;let T=n.slice(c).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*(?:[!:;,\n]|=(?!=)|$)/);if(T){if(t&&T[1]==="const")return;let L=T[2];if(!a.has(L))i.push(L),a.add(L);return}let P=n.slice(c).match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(P){if(t&&n.slice(c).startsWith("const"))return;P[1].split(",").forEach((L)=>{let B=L.trim();if(!B)return;let F=B.indexOf(":"),G=(F>=0?B.slice(F+1).trim():B).split(/[\s=]/)[0];if(G&&!a.has(G))i.push(G),a.add(G)});return}let M=n.slice(c).match(/^(?:const|let|var)\s+\[([^\]]+)\]\s*=/);if(M){if(t&&n.slice(c).startsWith("const"))return;M[1].split(",").forEach((L)=>{let B=L.trim().replace(/^\.\.\./,"");if(!B)return;let F=B.split(/[\s=]/)[0];if(F&&!a.has(F))i.push(F),a.add(F)});return}if(t)return;let H=n.slice(c).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(H){let L=H[1];if(!a.has(L))i.push(L),a.add(L);return}let O=n.slice(c).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(O){let L=O[1];if(!a.has(L))i.push(L),a.add(L)}};while(c<b){if(n[c]==="{"){l++,c++;continue}if(n[c]==="}"){l--,c++;continue}if(l===0&&/[a-z]/i.test(n[c])&&(c===0||/\s|[;{}()]/.test(n[c-1])))v();c++}return i.join(", ")}function Os(e){return`{ enumerable: true, configurable: true, get() { return ${e} }, set(__stxValue_${e}) { ${e} = __stxValue_${e} } }`}function la(e,t=V(e).split(",").map((n)=>n.trim()).filter(Boolean)){let n=new Set(V(e,!0).split(",").map((i)=>i.trim()));return t.map((i)=>n.has(i)?`get ${i}() { return ${i} }, set ${i}(__stxValue_${i}) { ${i} = __stxValue_${i} }`:i).join(", ")}function Ns(e,t){let n=`{ ${la(e,t)} }`;return V(e).split(",").some((i)=>i.trim()==="__stxLiveBindings")?`Object.defineProperties(${n}, Object.getOwnPropertyDescriptors(__stxLiveBindings))`:n}import jt from"fs";import ve from"path";function U(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}var Lr=new Map;function wr(e,t=!0){let n=Lr.get(e);if(t&&n)return n;let i=new Map,a=[ve.join(e,"src"),ve.join(e,"dist"),e];function l(c,b){if(b>6)return;let v;try{v=jt.readdirSync(c,{withFileTypes:!0})}catch{return}for(let T of v){let P=ve.join(c,T.name);if(T.isDirectory()){if(T.name==="node_modules"||T.name.startsWith("."))continue;l(P,b+1)}else if(T.isFile()&&T.name.endsWith(".stx")){let M=T.name.slice(0,-4);if(!i.has(M))i.set(M,P);let H=M.toLowerCase();if(!i.has(H))i.set(H,P);let O=U(M);if(!i.has(O))i.set(O,P)}}}for(let c of a)if(l(c,0),i.size>0)break;if(t)Lr.set(e,i);return i}function Ds(e,t){if(e.startsWith(".")||e.startsWith("/"))return null;let n=t;while(!0){let i=ve.join(n,"node_modules",e);try{if(jt.statSync(i).isDirectory())return i}catch{}let a=ve.dirname(n);if(a===n)return null;n=a}}function Ms(e,t,n={}){return[ve.resolve(ve.dirname(t),`${e}.stx`),ve.resolve(ve.dirname(t),e),ve.resolve(n.componentsDir||"components",`${e}.stx`),ve.resolve(n.componentsDir||"components",e),e.endsWith(".stx")?e:`${e}.stx`]}function zr(e){let t=e.endsWith(".stx")?e.slice(0,-4):e,n=t.split("-").map((a)=>a.charAt(0).toUpperCase()+a.slice(1)).join(""),i=U(t);return[t,n,i]}function ci(e,t){let[n,i,a]=zr(e);for(let l of[n,n.toLowerCase(),i,a]){let c=t?.__importedComponents?.get(l);if(c!==void 0)return c}}function ua(e,t){let n=t?ve.resolve(t):void 0,i=ve.dirname(ve.resolve(e));for(;;){if(jt.existsSync(ve.join(i,"package.json")))return n&&i===n?void 0:i;let a=ve.dirname(i);if(a===i)return;i=a}}var fa=["src/ui","src/components","components","dist"];function Ln(e,t){let n=ve.resolve(e);if(!t&&!n.split(ve.sep).includes("node_modules"))return[];let i=ua(n,t);if(!i)return[];let a=[];try{let b=JSON.parse(jt.readFileSync(ve.join(i,"package.json"),"utf8")).stx?.components;if(Array.isArray(b))a=b.filter((v)=>typeof v==="string")}catch{}let l=a.length?a:fa;return[ve.dirname(ve.resolve(e)),...l.map((c)=>ve.resolve(i,c))]}function*li(e,t,n={},i){let a=zr(e);if(a[0].startsWith("./")||a[0].startsWith("../")){yield ve.resolve(ve.dirname(t),`${a[0]}.stx`);return}let l=[...new Set(a.map((v)=>`${v}.stx`))],c=n.projectRoot||process.cwd(),b=[...Ln(t,n.projectRoot),...i?.__originalFilePath?[ve.join(ve.dirname(i.__originalFilePath),"components")]:[],...n.componentsDir?[n.componentsDir]:[],ve.join(ve.dirname(t),"components"),ve.resolve(c,"src/components"),ve.resolve(c,"components"),...import.meta.dir?[ve.resolve(import.meta.dir,"components")]:[]];for(let v of new Set(b)){for(let T of l)yield ve.join(v,T);try{for(let T of jt.readdirSync(v,{withFileTypes:!0}))if(T.isDirectory())for(let P of l)yield ve.join(v,T.name,P)}catch{}}}function Br(e,t,n={},i){let a=ci(e,i);if(a!==void 0)return a;for(let l of li(e,t,n,i))try{if(jt.statSync(l,{throwIfNoEntry:!1})?.isFile())return l}catch{}return null}function Ls(e,t=[],n={}){let i=new Set([...e].map((T)=>T.replace(/[-_]/g,"").toLowerCase()));if(!i.has("src")&&!i.has("source")||!i.has("alt")&&!i.has("decorative"))return!1;let a=new Map(Object.entries(n).map(([T,P])=>[T.replace(/[-_]/g,"").toLowerCase(),P])),l=a.get("alt"),c=a.get("decorative"),b=typeof l==="string"&&!!l.trim(),v=typeof c==="string"?!["false","0","off","no"].includes(c.trim().toLowerCase()):Boolean(c);if(!b&&!v)return!1;if(["defaultsource","provider","format","densities","quality","preload","modifiers","preset"].some((T)=>i.has(T)))return!1;if([...t].some((T)=>!["load","error"].includes(T.replace(/^@/,"").split(".")[0].toLowerCase())))return!1;if(i.has("resizemode")&&(i.has("fit")||i.has("objectfit")))return!1;if(i.has("src")&&i.has("source"))return!1;return["fit","objectfit","resizemode","position","objectposition","rounded","aspectratio","zoomonhover","sources","webpsrc","webpsrcset"].some((T)=>i.has(T))}import rs from"fs";import ce from"path";import St from"path";import en from"fs";var pa=new Set(["touchstart","touchmove","wheel","mousewheel"]);function bs(e,t){if(t.passive)return!0;if(t.prevent||t.nonpassive)return!1;return pa.has(e.toLowerCase())}var Wr=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"]),Fr={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"},da=new Set(["ctrl","alt","shift","meta"]),Hr={left:0,middle:1,right:2};function Vr(e){let t={prevent:!1,stop:!1,once:!1,capture:!1,self:!1,passive:!1,nonpassive:!1,keys:[],systemKeys:[],mouse:null,debounce:null,throttle:null};for(let n of e){let i=n.toLowerCase();if(i==="prevent")t.prevent=!0;else if(i==="stop")t.stop=!0;else if(i==="once")t.once=!0;else if(i==="capture")t.capture=!0;else if(i==="self")t.self=!0;else if(i==="passive")t.passive=!0;else if(i==="nonpassive")t.nonpassive=!0;else if(da.has(i))t.systemKeys.push(i);else if(i in Hr)t.mouse=i;else if(i in Fr||/^[a-z]$/.test(i))t.keys.push(Fr[i]||i.toUpperCase());else if(i.startsWith("debounce")){let a=i.match(/debounce(?:\.(\d+))?/);t.debounce=a?.[1]?Number.parseInt(a[1],10):300}else if(i.startsWith("throttle")){let a=i.match(/throttle(?:\.(\d+))?/);t.throttle=a?.[1]?Number.parseInt(a[1],10):300}}return t}function qr(e,t=""){let n=[],i=0,a=/<([a-z][a-z0-9-]*)\s+([^>]*@[a-z][^>]*)>/gi,l;while((l=a.exec(e))!==null){let[c,b,v]=l,T=l.index,P=T+c.length,M=`__stx_evt_${t}${i++}`,H=[],O=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,L;while((L=O.exec(v))!==null){let[,F,ee]=L,G=F.split("."),j=G[0];if(!Wr.has(j))continue;H.push({attribute:`@${F}`,event:j,handler:ee,modifiers:Vr(G.slice(1)),elementId:M})}let B=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((L=B.exec(v))!==null){let[,F,ee]=L,G=F.split("."),j=G[0];if(!Wr.has(j))continue;H.push({attribute:`@${F}`,event:j,handler:ee,modifiers:Vr(G.slice(1)),elementId:M})}if(H.length>0)n.push({originalTag:c,elementId:M,events:H,startIndex:T,endIndex:P})}return n}function ga(e){let t=[],{modifiers:n}=e;if(n.self)t.push("if ($event.target !== $el) return");for(let i of n.systemKeys)t.push(`if (!$event.${i}Key) return`);if(n.keys.length>0){let i=n.keys.map((a)=>`$event.key === '${a}'`).join(" || ");t.push(`if (!(${i})) return`)}if(n.mouse!==null){let i=Hr[n.mouse];t.push(`if ($event.button !== ${i}) return`)}if(n.prevent)t.push("$event.preventDefault()");if(n.stop)t.push("$event.stopPropagation()");return t.join("; ")}function ma(e,t){let n=e;if(t.debounce!==null)n=`__stx_debounce(() => { ${n} }, ${t.debounce})`;else if(t.throttle!==null)n=`__stx_throttle(() => { ${n} }, ${t.throttle})`;return n}function ys(e){let t=e.trim();if(!/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(t))return e;return`if (typeof ${t} === 'function' && !${t}._isSignal) ${t}($event);`}function ha(e){let{modifiers:t}=e,n=e.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),i=ga(e),a=ma(ys(e.handler),t),l=[];if(t.once)l.push("once: true");if(t.capture)l.push("capture: true");if(bs(e.event,t))l.push("passive: true");let c=l.length>0?`, { ${l.join(", ")} }`:"",b=a.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t");if(e.event==="mounted")return`
2
+ import{He,_n,Xs,Ei,D}from"./chunk-an6vb4ng.js";import{kn}from"./chunk-rg2gfyy0.js";import{Mr,k,ml,ct,Ni,hl}from"./chunk-z26fg4p0.js";import{I}from"./chunk-zjqvbcwa.js";import{R,_,Gs,u,f,Bt,d,K,z,x,Qs,Ce,Ue,eo}from"./chunk-t3e95q80.js";import{s,me}from"./chunk-m8cpabd2.js";import{g}from"./chunk-0dve54ne.js";import{X}from"./chunk-7qwfbafg.js";import at from"path";import Wt from"process";import{AsyncLocalStorage as ca}from"async_hooks";var Or=new ca;function yn(e){return e.__stx_server_data??={pending:new Map,values:new Map}}function Dr(e,t){return Or.run(yn(e),t)}async function jr(e,t){let n=Or.getStore();if(!n)throw Error("useServerData must run inside a <script server> render");if(typeof e!=="string"||!e.trim())throw TypeError("useServerData requires a non-empty string key");let i=n.pending.get(e);if(i)return i;let a=Promise.resolve().then(t).then((l)=>{let c=JSON.stringify(l,(v,T)=>{if(T===void 0||typeof T==="function"||typeof T==="symbol"||typeof T==="bigint"||typeof T==="number"&&!Number.isFinite(T))throw TypeError(`useServerData(${JSON.stringify(e)}) requires JSON-serializable data`);if(T&&typeof T==="object"&&!Array.isArray(T)&&Object.getPrototypeOf(T)!==Object.prototype&&Object.getPrototypeOf(T)!==null)throw TypeError(`useServerData(${JSON.stringify(e)}) requires JSON-serializable data`);return T}),b=JSON.parse(c);return n.values.set(e,b),b}).catch((l)=>{throw n.pending.delete(e),l});return n.pending.set(e,a),a}function Tr(e){let t=e.__stx_server_data;if(!t?.values.size)return"";return`<script data-stx-scoped data-stx-server-data type="application/json">${JSON.stringify(Object.fromEntries(t.values)).replace(/</g,"\\u003c").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}</script>`}function V(e,t=!1){let n=s(e),i=[],a=new Set,l=0,c=0,b=n.length,v=()=>{if(l!==0)return;let T=n.slice(c).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*(?:[!:;,\n]|=(?!=)|$)/);if(T){if(t&&T[1]==="const")return;let L=T[2];if(!a.has(L))i.push(L),a.add(L);return}let P=n.slice(c).match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(P){if(t&&n.slice(c).startsWith("const"))return;P[1].split(",").forEach((L)=>{let B=L.trim();if(!B)return;let F=B.indexOf(":"),G=(F>=0?B.slice(F+1).trim():B).split(/[\s=]/)[0];if(G&&!a.has(G))i.push(G),a.add(G)});return}let M=n.slice(c).match(/^(?:const|let|var)\s+\[([^\]]+)\]\s*=/);if(M){if(t&&n.slice(c).startsWith("const"))return;M[1].split(",").forEach((L)=>{let B=L.trim().replace(/^\.\.\./,"");if(!B)return;let F=B.split(/[\s=]/)[0];if(F&&!a.has(F))i.push(F),a.add(F)});return}if(t)return;let H=n.slice(c).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(H){let L=H[1];if(!a.has(L))i.push(L),a.add(L);return}let O=n.slice(c).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(O){let L=O[1];if(!a.has(L))i.push(L),a.add(L)}};while(c<b){if(n[c]==="{"){l++,c++;continue}if(n[c]==="}"){l--,c++;continue}if(l===0&&/[a-z]/i.test(n[c])&&(c===0||/\s|[;{}()]/.test(n[c-1])))v();c++}return i.join(", ")}function Ns(e){return`{ enumerable: true, configurable: true, get() { return ${e} }, set(__stxValue_${e}) { ${e} = __stxValue_${e} } }`}function la(e,t=V(e).split(",").map((n)=>n.trim()).filter(Boolean)){let n=new Set(V(e,!0).split(",").map((i)=>i.trim()));return t.map((i)=>n.has(i)?`get ${i}() { return ${i} }, set ${i}(__stxValue_${i}) { ${i} = __stxValue_${i} }`:i).join(", ")}function Ds(e,t){let n=`{ ${la(e,t)} }`;return V(e).split(",").some((i)=>i.trim()==="__stxLiveBindings")?`Object.defineProperties(${n}, Object.getOwnPropertyDescriptors(__stxLiveBindings))`:n}import jt from"fs";import ve from"path";function U(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}var Nr=new Map;function vr(e,t=!0){let n=Nr.get(e);if(t&&n)return n;let i=new Map,a=[ve.join(e,"src"),ve.join(e,"dist"),e];function l(c,b){if(b>6)return;let v;try{v=jt.readdirSync(c,{withFileTypes:!0})}catch{return}for(let T of v){let P=ve.join(c,T.name);if(T.isDirectory()){if(T.name==="node_modules"||T.name.startsWith("."))continue;l(P,b+1)}else if(T.isFile()&&T.name.endsWith(".stx")){let M=T.name.slice(0,-4);if(!i.has(M))i.set(M,P);let H=M.toLowerCase();if(!i.has(H))i.set(H,P);let O=U(M);if(!i.has(O))i.set(O,P)}}}for(let c of a)if(l(c,0),i.size>0)break;if(t)Nr.set(e,i);return i}function Ms(e,t){if(e.startsWith(".")||e.startsWith("/"))return null;let n=t;while(!0){let i=ve.join(n,"node_modules",e);try{if(jt.statSync(i).isDirectory())return i}catch{}let a=ve.dirname(n);if(a===n)return null;n=a}}function Ls(e,t,n={}){return[ve.resolve(ve.dirname(t),`${e}.stx`),ve.resolve(ve.dirname(t),e),ve.resolve(n.componentsDir||"components",`${e}.stx`),ve.resolve(n.componentsDir||"components",e),e.endsWith(".stx")?e:`${e}.stx`]}function Lr(e){let t=e.endsWith(".stx")?e.slice(0,-4):e,n=t.split("-").map((a)=>a.charAt(0).toUpperCase()+a.slice(1)).join(""),i=U(t);return[t,n,i]}function li(e,t){let[n,i,a]=Lr(e);for(let l of[n,n.toLowerCase(),i,a]){let c=t?.__importedComponents?.get(l);if(c!==void 0)return c}}function ua(e,t){let n=t?ve.resolve(t):void 0,i=ve.dirname(ve.resolve(e));for(;;){if(jt.existsSync(ve.join(i,"package.json")))return n&&i===n?void 0:i;let a=ve.dirname(i);if(a===i)return;i=a}}var fa=["src/ui","src/components","components","dist"];function Ln(e,t){let n=ve.resolve(e);if(!t&&!n.split(ve.sep).includes("node_modules"))return[];let i=ua(n,t);if(!i)return[];let a=[];try{let b=JSON.parse(jt.readFileSync(ve.join(i,"package.json"),"utf8")).stx?.components;if(Array.isArray(b))a=b.filter((v)=>typeof v==="string")}catch{}let l=a.length?a:fa;return[ve.dirname(ve.resolve(e)),...l.map((c)=>ve.resolve(i,c))]}function*ui(e,t,n={},i){let a=Lr(e);if(a[0].startsWith("./")||a[0].startsWith("../")){yield ve.resolve(ve.dirname(t),`${a[0]}.stx`);return}let l=[...new Set(a.map((v)=>`${v}.stx`))],c=n.projectRoot||process.cwd(),b=[...Ln(t,n.projectRoot),...i?.__originalFilePath?[ve.join(ve.dirname(i.__originalFilePath),"components")]:[],...n.componentsDir?[n.componentsDir]:[],ve.join(ve.dirname(t),"components"),ve.resolve(c,"src/components"),ve.resolve(c,"components"),...import.meta.dir?[ve.resolve(import.meta.dir,"components")]:[]];for(let v of new Set(b)){for(let T of l)yield ve.join(v,T);try{for(let T of jt.readdirSync(v,{withFileTypes:!0}))if(T.isDirectory())for(let P of l)yield ve.join(v,T.name,P)}catch{}}}function zr(e,t,n={},i){let a=li(e,i);if(a!==void 0)return a;for(let l of ui(e,t,n,i))try{if(jt.statSync(l,{throwIfNoEntry:!1})?.isFile())return l}catch{}return null}function js(e,t=[],n={}){let i=new Set([...e].map((T)=>T.replace(/[-_]/g,"").toLowerCase()));if(!i.has("src")&&!i.has("source")||!i.has("alt")&&!i.has("decorative"))return!1;let a=new Map(Object.entries(n).map(([T,P])=>[T.replace(/[-_]/g,"").toLowerCase(),P])),l=a.get("alt"),c=a.get("decorative"),b=typeof l==="string"&&!!l.trim(),v=typeof c==="string"?!["false","0","off","no"].includes(c.trim().toLowerCase()):Boolean(c);if(!b&&!v)return!1;if(["defaultsource","provider","format","densities","quality","preload","modifiers","preset"].some((T)=>i.has(T)))return!1;if([...t].some((T)=>!["load","error"].includes(T.replace(/^@/,"").split(".")[0].toLowerCase())))return!1;if(i.has("resizemode")&&(i.has("fit")||i.has("objectfit")))return!1;if(i.has("src")&&i.has("source"))return!1;return["fit","objectfit","resizemode","position","objectposition","rounded","aspectratio","zoomonhover","sources","webpsrc","webpsrcset"].some((T)=>i.has(T))}import rs from"fs";import ce from"path";import St from"path";import en from"fs";var pa=new Set(["touchstart","touchmove","wheel","mousewheel"]);function bs(e,t){if(t.passive)return!0;if(t.prevent||t.nonpassive)return!1;return pa.has(e.toLowerCase())}var Br=new Set(["click","dblclick","mousedown","mouseup","mousemove","mouseenter","mouseleave","mouseover","mouseout","contextmenu","wheel","keydown","keyup","keypress","submit","reset","change","input","focus","blur","focusin","focusout","select","invalid","touchstart","touchend","touchmove","touchcancel","drag","dragstart","dragend","dragenter","dragleave","dragover","drop","scroll","resize","load","error","abort","animationstart","animationend","animationiteration","transitionstart","transitionend","transitionrun","transitioncancel","mounted","unmounted"]),Wr={enter:"Enter",tab:"Tab",delete:"Delete",backspace:"Backspace",esc:"Escape",escape:"Escape",space:" ",up:"ArrowUp",down:"ArrowDown",left:"ArrowLeft",right:"ArrowRight",home:"Home",end:"End",pageup:"PageUp",pagedown:"PageDown"},da=new Set(["ctrl","alt","shift","meta"]),Ur={left:0,middle:1,right:2};function Fr(e){let t={prevent:!1,stop:!1,once:!1,capture:!1,self:!1,passive:!1,nonpassive:!1,keys:[],systemKeys:[],mouse:null,debounce:null,throttle:null};for(let n of e){let i=n.toLowerCase();if(i==="prevent")t.prevent=!0;else if(i==="stop")t.stop=!0;else if(i==="once")t.once=!0;else if(i==="capture")t.capture=!0;else if(i==="self")t.self=!0;else if(i==="passive")t.passive=!0;else if(i==="nonpassive")t.nonpassive=!0;else if(da.has(i))t.systemKeys.push(i);else if(i in Ur)t.mouse=i;else if(i in Wr||/^[a-z]$/.test(i))t.keys.push(Wr[i]||i.toUpperCase());else if(i.startsWith("debounce")){let a=i.match(/debounce(?:\.(\d+))?/);t.debounce=a?.[1]?Number.parseInt(a[1],10):300}else if(i.startsWith("throttle")){let a=i.match(/throttle(?:\.(\d+))?/);t.throttle=a?.[1]?Number.parseInt(a[1],10):300}}return t}function Hr(e,t=""){let n=[],i=0,a=/<([a-z][a-z0-9-]*)\s+([^>]*@[a-z][^>]*)>/gi,l;while((l=a.exec(e))!==null){let[c,b,v]=l,T=l.index,P=T+c.length,M=`__stx_evt_${t}${i++}`,H=[],O=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,L;while((L=O.exec(v))!==null){let[,F,ee]=L,G=F.split("."),j=G[0];if(!Br.has(j))continue;H.push({attribute:`@${F}`,event:j,handler:ee,modifiers:Fr(G.slice(1)),elementId:M})}let B=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((L=B.exec(v))!==null){let[,F,ee]=L,G=F.split("."),j=G[0];if(!Br.has(j))continue;H.push({attribute:`@${F}`,event:j,handler:ee,modifiers:Fr(G.slice(1)),elementId:M})}if(H.length>0)n.push({originalTag:c,elementId:M,events:H,startIndex:T,endIndex:P})}return n}function ga(e){let t=[],{modifiers:n}=e;if(n.self)t.push("if ($event.target !== $el) return");for(let i of n.systemKeys)t.push(`if (!$event.${i}Key) return`);if(n.keys.length>0){let i=n.keys.map((a)=>`$event.key === '${a}'`).join(" || ");t.push(`if (!(${i})) return`)}if(n.mouse!==null){let i=Ur[n.mouse];t.push(`if ($event.button !== ${i}) return`)}if(n.prevent)t.push("$event.preventDefault()");if(n.stop)t.push("$event.stopPropagation()");return t.join("; ")}function ma(e,t){let n=e;if(t.debounce!==null)n=`__stx_debounce(() => { ${n} }, ${t.debounce})`;else if(t.throttle!==null)n=`__stx_throttle(() => { ${n} }, ${t.throttle})`;return n}function ys(e){let t=e.trim();if(!/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(t))return e;return`if (typeof ${t} === 'function' && !${t}._isSignal) ${t}($event);`}function ha(e){let{modifiers:t}=e,n=e.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),i=ga(e),a=ma(ys(e.handler),t),l=[];if(t.once)l.push("once: true");if(t.capture)l.push("capture: true");if(bs(e.event,t))l.push("passive: true");let c=l.length>0?`, { ${l.join(", ")} }`:"",b=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('${n}');
5
5
  if (!$el) return;
@@ -53,7 +53,7 @@ else {
53
53
  __stx_runHandler('${b}', $event, $el);
54
54
  }
55
55
  }${c});
56
- })();`}function ui(e){if(e.length===0)return"";return`
56
+ })();`}function di(e){if(e.length===0)return"";return`
57
57
  <script data-stx-events>
58
58
  (function() {
59
59
  'use strict';
@@ -111,19 +111,19 @@ else {
111
111
  ${e.map(ha).join(`
112
112
  `)}
113
113
  })();
114
- </script>`}function xa(e,t=""){let n=qr(e,t);if(n.length===0)return{template:e,bindings:[]};let i=e,a=[];for(let l=n.length-1;l>=0;l--){let c=n[l],b=c.originalTag;if(!b.includes(" id="))b=b.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${c.elementId}"`);else{let v=b.match(/id=["']([^"']+)["']/);if(v)for(let T of c.events)T.elementId=v[1]}for(let v of c.events){let T=v.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),P=new RegExp(`\\s*${T}\\s*=\\s*"[^"]*"`,"g"),M=new RegExp(`\\s*${T}\\s*=\\s*'[^']*'`,"g");b=b.replace(P,""),b=b.replace(M,"")}i=i.slice(0,c.startIndex)+b+i.slice(c.endIndex),a.push(...c.events)}return{template:i,bindings:a}}function Ur(e){let t=e.$uid;return typeof t==="string"&&t?`${t}_`:""}function Ic(e,t,n){if(ml(e))return e;if(t.__stx_sfc_mode){if(/x-data\s*=\s*["']/.test(e))return e;let{template:b,bindings:v}=xa(e,Ur(t)),T=t.__stx_event_bindings||[];return t.__stx_event_bindings=[...T,...v],b}let i=qr(e,Ur(t));if(i.length===0)return e;let a=e;for(let b=i.length-1;b>=0;b--){let v=i[b],T=v.originalTag;if(!T.includes(" id="))T=T.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${v.elementId}"`);else{let P=T.match(/id=["']([^"']+)["']/);if(P)for(let M of v.events)M.elementId=P[1]}for(let P of v.events){let M=P.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),H=new RegExp(`\\s*${M}\\s*=\\s*"[^"]*"`,"g"),O=new RegExp(`\\s*${M}\\s*=\\s*'[^']*'`,"g");T=T.replace(H,""),T=T.replace(O,"")}a=a.slice(0,v.startIndex)+T+a.slice(v.endIndex)}let l=ui(i.flatMap((b)=>b.events)),c=a.lastIndexOf("</body>");if(c!==-1)a=a.slice(0,c)+l+`
115
- `+a.slice(c);else a+=l;return a}function Zr(e,t){let n=new Set;for(let i of e.split(",")){let a=i.trim().replace(/^\.\.\./,"").trim();if(!a)continue;if(t){let l=a.lastIndexOf(":");if(l!==-1)a=a.slice(l+1).trim()}if(a=a.split("=")[0].trim(),/^[A-Za-z_$][\w$]*$/.test(a))n.add(a)}return n}function At(e,t){let n=s(e),{depths:i,balanced:a}=me(n),l=(b)=>!a||i[b]===0,c=new RegExp(`(?:^|[^\\w$.])((?:const|let|var|function|class)\\s+${t}\\b)`,"g");for(let b of n.matchAll(c)){let v=(b.index??0)+b[0].length-b[1].length;if(l(v))return!0}for(let b of n.matchAll(/(?:const|let|var)\s*\{([^}]*)\}/g))if(l(b.index??0)&&Zr(b[1],!0).has(t))return!0;for(let b of n.matchAll(/(?:const|let|var)\s*\[([^\]]*)\]/g))if(l(b.index??0)&&Zr(b[1],!1).has(t))return!0;return!1}var Kr=new R(32,{maxBytes:2097152,sizeOf:(e)=>e.code.length*4}),bt=/^[A-Za-z_$][\w$]*$/,ba=new Set(["if","for","while","switch","with"]),Xr=["(","[","{"],Jr=[")","]","}"],ya=new Set(["const","let","var","return","if","for","while","do","switch","try","throw","export"]);function _a(e){let t=s(e),n=[];for(let i of t.matchAll(/[A-Za-z_$][\w$]*|=>|\.\.\.|[^\s]/g)){let a=i.index??0;n.push({text:i[0],start:a,end:a+i[0].length})}return{code:t,tokens:n}}function _s(e){let t=Kr.get(e);if(t)return t;let{code:n,tokens:i}=_a(e),a=new Map,l=[];for(let F=0;F<i.length;F++){let ee=i[F].text;if(["(","[","{"].includes(ee))l.push(F);else if([")","]","}"].includes(ee)){let G=l.at(-1);if(G!==void 0&&["()","[]","{}"].includes(i[G].text+ee))l.pop(),a.set(G,F),a.set(F,G)}}function c(F,ee){let G=[],j=F;for(let te=F;te<ee;te++){if(["(","[","{"].includes(i[te].text)&&(a.get(te)??ee)<ee){te=a.get(te);continue}if(i[te].text===",")G.push([j,te]),j=te+1}return G.push([j,ee]),G}let b=[];function v(F,ee,G,j=!1){if(i[F]?.text==="...")F++;if(F>=ee)return;let te=i[F].text;if(bt.test(te)){if(G.add(te),G===M)b.push({name:te,token:F,functionScoped:j});return}if(te!=="{"&&te!=="[")return;let se=a.get(F);if(se===void 0||se>=ee)return;for(let[ne,ue]of c(F+1,se)){let ye=ne;if(te==="{")for(let de=ne;de<ue;de++){if(i[de].text===":"){ye=de+1;break}if(i[de].text==="=")break;if(["(","[","{"].includes(i[de].text)&&a.has(de))de=a.get(de)}v(ye,ue,G,j)}}function T(F,ee){let G=new Set;for(let[j,te]of c(F,ee))v(j,te,G);return G}function P(F){let ee=F;for(;ee<i.length;ee++){let G=i[ee].text;if(["(","[","{"].includes(G)&&a.has(ee)){ee=a.get(ee);continue}if([",",";",")","]","}"].includes(G))break}return i[Math.max(F,ee-1)]?.end??n.length}let M=new Set,H=[];for(let F=0;F<i.length;F++)if(i[F].text==="=>"){let ee=F-1,G=ee,j;if(i[ee]?.text===")"&&a.has(ee))G=a.get(ee),j=T(G+1,ee);else if(i[ee]&&bt.test(i[ee].text))j=new Set([i[ee].text]);else continue;let te=F+1,se=i[te]?.text==="{"&&a.has(te)?i[a.get(te)].end:P(te);H.push({start:i[G].start,end:se,bodyStart:i[te]?.start??se,functionBody:!0,names:j})}else if(i[F].text==="("&&a.has(F)){let ee=i[F-1]?.text;if(!ee||ba.has(ee)||!bt.test(ee)&&ee!=="*"&&ee!=="]")continue;let G=a.get(F),j=G+1;if(i[j]?.text===":"){j++;while(j<i.length&&!["{","=>",";","="].includes(i[j].text))j++}if(i[j]?.text!=="{"||!a.has(j))continue;H.push({start:i[F].start,end:i[a.get(j)].end,bodyStart:i[j].start,functionBody:ee!=="catch",names:T(F+1,G)})}function O(F){let ee=F;for(;ee<i.length;ee++){let G=i[ee].text;if(Xr.includes(G)&&a.has(ee)){ee=a.get(ee);continue}if(G===";"||Jr.includes(G))break;let j=i[ee-1];if(ee>F&&ya.has(G)&&j.text!==".")break;if(ee>F&&/[\n\r]/.test(n.slice(j.end,i[ee].start))&&(/^[\w$]+$/.test(j.text)||Jr.includes(j.text)||['"',"'","`"].includes(j.text))&&bt.test(G)&&!["in","of","instanceof"].includes(G))break}return ee}let L=[];for(let F=0;F<i.length;F++){if(i[F].text!=="for")continue;let ee=i[F+1]?.text==="await"?F+2:F+1;if(i[ee]?.text!=="("||!a.has(ee))continue;let G=a.get(ee),j=G+1,te=i[j]?.text==="{"&&a.has(j)?a.get(j):O(j),se=i[te]?.text===";"||i[te]?.text==="}"?i[te].end:i[Math.max(j,te-1)]?.end??n.length;L.push({headStart:ee,headEnd:G,start:i[ee].start,end:se})}for(let F=0;F<i.length;F++){let ee=i[F].text,G=i[F-1]?.text;if(G==="."||i[F+1]?.text===":")continue;if(G==="as"||G==="<")continue;if(ee==="const"||ee==="let"||ee==="var"){let j=O(F+1),te=F+1,se=!1,ne=!1,ue=0;for(let ye=F+1;ye<=j;ye++){let de=i[ye]?.text;if(ye<j&&Xr.includes(de)&&a.has(ye)&&a.get(ye)<j){ye=a.get(ye);continue}if(ye<j&&de===":"&&!ne)se=!0;else if(ye<j&&de==="="&&ue===0)se=!1,ne=!0;else if(ye<j&&se&&de==="<")ue++;else if(ye<j&&se&&de===">"&&ue>0)ue--;else if(ye===j||de===","&&ue===0)v(te,ye,M,ee==="var"),te=ye+1,se=!1,ne=!1}}else if(ee==="function"||ee==="class"){let j=F+1;if(i[j]?.text==="*")j++;if(i[j]&&bt.test(i[j].text)&&i[j].text!=="extends")M.add(i[j].text),b.push({name:i[j].text,token:j})}else if(ee==="import"){let j=F+1;if(i[j]?.text==="*"&&i[j+1]?.text==="as")j+=2;let te=i[j]?.text;if(te&&bt.test(te)&&te!=="type"&&i[j+1]?.text!=="("&&i[j+1]?.text!==".")M.add(te),b.push({name:te,token:j,file:!0});let se=i[j]?.text==="{"?j:i[j+1]?.text===","&&i[j+2]?.text==="{"?j+2:-1;if(se!==-1&&a.has(se)){let ne=a.get(se);for(let[ue,ye]of c(se+1,ne)){let de=ye-1;while(de>=ue&&!bt.test(i[de].text))de--;if(de>=ue&&i[de].text!=="type")b.push({name:i[de].text,token:de,file:!0})}}}}let B={code:n,scopes:H,loops:L,declarations:M,sites:b,tokens:i,pairs:a};return Kr.set(e,B),B}function Qt(e){let t=_s(e);return{code:t.code,shadows:(n,i)=>t.scopes.some((a)=>i>=a.start&&i<a.end&&a.names.has(n))}}function zn(e){return new Set(_s(e).declarations)}function Oe(e,t){let{scopes:n,loops:i,sites:a,tokens:l,pairs:c}=_s(e),b=Array.from({length:l.length},()=>-1),v=[];for(let O=0;O<l.length;O++){b[O]=v.length?v[v.length-1]:-1;let L=l[O].text;if(L==="{"&&c.has(O))v.push(O);else if(L==="}"&&v.length&&c.get(O)===v[v.length-1])v.pop()}let T=new Set,P=new Map;for(let O of a){if(!t.has(O.name))continue;T.add(O.token);let L=O.file?-1:b[O.token],B=L===-1?[0,Number.POSITIVE_INFINITY]:[l[L].start,l[c.get(L)].end];if(O.functionScoped){let ee=l[O.token].start,G=n.filter((j)=>j.functionBody&&ee>=j.bodyStart&&ee<j.end).sort((j,te)=>j.end-j.bodyStart-(te.end-te.bodyStart))[0];B=G?[G.bodyStart,G.end]:[0,Number.POSITIVE_INFINITY]}else if(!O.file){let ee=i.filter((G)=>O.token>G.headStart&&O.token<G.headEnd).sort((G,j)=>G.headEnd-G.headStart-(j.headEnd-j.headStart))[0];if(ee)B=[ee.start,ee.end]}let F=P.get(O.name);if(F)F.push(B);else P.set(O.name,[B])}let M=new Set;for(let O=0;O<l.length;O++){if(l[O].text!=="import"||l[O-1]?.text===".")continue;let L=O+1;if(l[L]?.text==="type")L++;if(l[L]&&bt.test(l[L].text)&&l[L+1]?.text===",")L+=2;if(l[L]?.text==="{"&&c.has(L))for(let B=L+1;B<c.get(L);B++)M.add(B)}let H=new Set;for(let O=0;O<l.length;O++){let L=l[O].text;if(!t.has(L)||H.has(L)||T.has(O)||M.has(O))continue;let B=l[O-1]?.text;if(B==="#"||B==="."&&l[O-2]?.text!=="..")continue;if(l[O+1]?.text===":"&&(B==="{"||B===","))continue;let F=l[O].start;if(P.get(L)?.some(([ee,G])=>F>=ee&&F<G))continue;if(n.some((ee)=>F>=ee.start&&F<ee.end&&ee.names.has(L)))continue;H.add(L)}return H}var Ie="0.2.845";var Gr=Symbol.for(`stx.lazy-module-promises.${Ie}`);function Sa(){let e=globalThis;return e[Gr]??=new Map,e[Gr]}function o(e,t){let n=Sa(),i=`${import.meta.url}\x00${e}`,a=n.get(i);if(a)return a;let l=t();return n.set(i,l),l.catch(()=>{if(n.get(i)===l)n.delete(i)}),l}var $a=/<\/(script)/gi;function pn(e){if(!e||e.indexOf("</")===-1)return e;return e.replace($a,"<\\/$1")}import Yr from"fs";var Qr=[];function w(e){let t=new R(e);return Qr.push(t),t}function Oc(){for(let e of Qr)e.clear()}function S(e,...t){return`${t.map((n)=>String(n??"")).join("\x00")}\x00${e.length}\x00${Bun.hash(e)}`}function vr(e){let t=[];for(let n of new Set(e))try{t.push({path:n,mtimeMs:Yr.statSync(n).mtimeMs})}catch{}return t}function js(e){for(let t of e)try{if(Yr.statSync(t.path).mtimeMs!==t.mtimeMs)return!1}catch{return!1}return!0}var Se=["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 va=/^[ \t]*import\s+['"]([^'"]+?\.css)(\?[^'"]*)?['"]\s*;?\s*$/gm;function Ea(e){if(e.startsWith(".")||e.startsWith("/"))return null;if(e.startsWith("@")){let n=e.match(/^(@[^/]+\/[^/]+)(\/.*)?$/);if(!n)return null;return{pkg:n[1],subpath:n[2]||""}}let t=e.match(/^([^/]+)(\/.*)?$/);if(!t)return null;return{pkg:t[1],subpath:t[2]||""}}function ka(e,t){let n=t;while(!0){let i=St.join(n,"node_modules",e,"package.json");if(en.existsSync(i))return St.dirname(i);let a=St.dirname(n);if(a===n)return null;n=a}}function Ca(e,t){if(!e||typeof e!=="object")return null;let n=(a)=>{if(typeof a==="string")return a;if(a&&typeof a==="object"){if(typeof a.import==="string")return a.import;if(typeof a.default==="string")return a.default;if(typeof a.import==="object")return n(a.import);if(typeof a.default==="object")return n(a.default)}return null};if(Object.prototype.hasOwnProperty.call(e,t))return n(e[t]);let i=null;for(let a of Object.keys(e)){let l=a.indexOf("*");if(l===-1)continue;let c=a.slice(0,l),b=a.slice(l+1);if(!t.startsWith(c)||!t.endsWith(b))continue;if(t.length<c.length+b.length)continue;if(!i||c.length>i.prefix.length)i={pattern:a,prefix:c,suffix:b}}if(i){let a=t.slice(i.prefix.length,t.length-i.suffix.length),l=n(e[i.pattern]);if(l)return l.replace("*",a)}return null}function Ra(e,t){let n=Ea(e);if(!n||!n.subpath)return null;let i=ka(n.pkg,t);if(!i)return null;let a;try{a=JSON.parse(en.readFileSync(St.join(i,"package.json"),"utf8"))}catch{return null}let l=`.${n.subpath}`,c=Ca(a.exports,l);if(!c)return null;let b=St.resolve(i,c);return en.existsSync(b)?b:null}function bi(e,t){let n=t.filePath?St.dirname(t.filePath):t.projectRoot||process.cwd(),i=t.projectRoot||process.cwd(),a=new Set,l=[],c=[];return{code:e.replace(va,(v,T)=>{let P;try{if(T.startsWith("./")||T.startsWith("../")||T.startsWith("/")){if(P=T.startsWith("/")?T:St.resolve(n,T),!en.existsSync(P))throw Error(`file not found: ${P}`)}else{let M=null;try{M=Bun.resolveSync(T,i)}catch{M=Ra(T,i)}if(!M)throw Error(`could not resolve ${T} (Bun.resolveSync + exports fallback both failed)`);P=M}}catch(M){return console.warn(`[stx:vendor-css] could not resolve ${JSON.stringify(T)} (from ${t.filePath||"<unknown>"}): ${M?.message||M}`),c.push(T),""}if(a.has(P))return"";a.add(P);try{let M=en.readFileSync(P,"utf8");l.push({source:T,resolvedPath:P,contents:M})}catch(M){console.warn(`[stx:vendor-css] could not read ${P}: ${M?.message||M}`),c.push(T)}return""}),styles:l,unresolved:c}}function Ta(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function wi(e){if(e.length===0)return"";return`${e.map((t)=>`<style data-stx-vendor="${Ta(t.source)}" data-stx-layer="vendor">
114
+ </script>`}function xa(e,t=""){let n=Hr(e,t);if(n.length===0)return{template:e,bindings:[]};let i=e,a=[];for(let l=n.length-1;l>=0;l--){let c=n[l],b=c.originalTag;if(!b.includes(" id="))b=b.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${c.elementId}"`);else{let v=b.match(/id=["']([^"']+)["']/);if(v)for(let T of c.events)T.elementId=v[1]}for(let v of c.events){let T=v.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),P=new RegExp(`\\s*${T}\\s*=\\s*"[^"]*"`,"g"),M=new RegExp(`\\s*${T}\\s*=\\s*'[^']*'`,"g");b=b.replace(P,""),b=b.replace(M,"")}i=i.slice(0,c.startIndex)+b+i.slice(c.endIndex),a.push(...c.events)}return{template:i,bindings:a}}function Vr(e){let t=e.$uid;return typeof t==="string"&&t?`${t}_`:""}function Oc(e,t,n){if(hl(e))return e;if(t.__stx_sfc_mode){if(/x-data\s*=\s*["']/.test(e))return e;let{template:b,bindings:v}=xa(e,Vr(t)),T=t.__stx_event_bindings||[];return t.__stx_event_bindings=[...T,...v],b}let i=Hr(e,Vr(t));if(i.length===0)return e;let a=e;for(let b=i.length-1;b>=0;b--){let v=i[b],T=v.originalTag;if(!T.includes(" id="))T=T.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${v.elementId}"`);else{let P=T.match(/id=["']([^"']+)["']/);if(P)for(let M of v.events)M.elementId=P[1]}for(let P of v.events){let M=P.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),H=new RegExp(`\\s*${M}\\s*=\\s*"[^"]*"`,"g"),O=new RegExp(`\\s*${M}\\s*=\\s*'[^']*'`,"g");T=T.replace(H,""),T=T.replace(O,"")}a=a.slice(0,v.startIndex)+T+a.slice(v.endIndex)}let l=di(i.flatMap((b)=>b.events)),c=a.lastIndexOf("</body>");if(c!==-1)a=a.slice(0,c)+l+`
115
+ `+a.slice(c);else a+=l;return a}function qr(e,t){let n=new Set;for(let i of e.split(",")){let a=i.trim().replace(/^\.\.\./,"").trim();if(!a)continue;if(t){let l=a.lastIndexOf(":");if(l!==-1)a=a.slice(l+1).trim()}if(a=a.split("=")[0].trim(),/^[A-Za-z_$][\w$]*$/.test(a))n.add(a)}return n}function At(e,t){let n=s(e),{depths:i,balanced:a}=me(n),l=(b)=>!a||i[b]===0,c=new RegExp(`(?:^|[^\\w$.])((?:const|let|var|function|class)\\s+${t}\\b)`,"g");for(let b of n.matchAll(c)){let v=(b.index??0)+b[0].length-b[1].length;if(l(v))return!0}for(let b of n.matchAll(/(?:const|let|var)\s*\{([^}]*)\}/g))if(l(b.index??0)&&qr(b[1],!0).has(t))return!0;for(let b of n.matchAll(/(?:const|let|var)\s*\[([^\]]*)\]/g))if(l(b.index??0)&&qr(b[1],!1).has(t))return!0;return!1}var Zr=new R(32,{maxBytes:2097152,sizeOf:(e)=>e.code.length*4}),bt=/^[A-Za-z_$][\w$]*$/,ba=new Set(["if","for","while","switch","with"]),Kr=["(","[","{"],Xr=[")","]","}"],ya=new Set(["const","let","var","return","if","for","while","do","switch","try","throw","export"]);function _a(e){let t=s(e),n=[];for(let i of t.matchAll(/[A-Za-z_$][\w$]*|=>|\.\.\.|[^\s]/g)){let a=i.index??0;n.push({text:i[0],start:a,end:a+i[0].length})}return{code:t,tokens:n}}function _s(e){let t=Zr.get(e);if(t)return t;let{code:n,tokens:i}=_a(e),a=new Map,l=[];for(let F=0;F<i.length;F++){let ee=i[F].text;if(["(","[","{"].includes(ee))l.push(F);else if([")","]","}"].includes(ee)){let G=l.at(-1);if(G!==void 0&&["()","[]","{}"].includes(i[G].text+ee))l.pop(),a.set(G,F),a.set(F,G)}}function c(F,ee){let G=[],j=F;for(let te=F;te<ee;te++){if(["(","[","{"].includes(i[te].text)&&(a.get(te)??ee)<ee){te=a.get(te);continue}if(i[te].text===",")G.push([j,te]),j=te+1}return G.push([j,ee]),G}let b=[];function v(F,ee,G,j=!1){if(i[F]?.text==="...")F++;if(F>=ee)return;let te=i[F].text;if(bt.test(te)){if(G.add(te),G===M)b.push({name:te,token:F,functionScoped:j});return}if(te!=="{"&&te!=="[")return;let se=a.get(F);if(se===void 0||se>=ee)return;for(let[ne,ue]of c(F+1,se)){let ye=ne;if(te==="{")for(let de=ne;de<ue;de++){if(i[de].text===":"){ye=de+1;break}if(i[de].text==="=")break;if(["(","[","{"].includes(i[de].text)&&a.has(de))de=a.get(de)}v(ye,ue,G,j)}}function T(F,ee){let G=new Set;for(let[j,te]of c(F,ee))v(j,te,G);return G}function P(F){let ee=F;for(;ee<i.length;ee++){let G=i[ee].text;if(["(","[","{"].includes(G)&&a.has(ee)){ee=a.get(ee);continue}if([",",";",")","]","}"].includes(G))break}return i[Math.max(F,ee-1)]?.end??n.length}let M=new Set,H=[];for(let F=0;F<i.length;F++)if(i[F].text==="=>"){let ee=F-1,G=ee,j;if(i[ee]?.text===")"&&a.has(ee))G=a.get(ee),j=T(G+1,ee);else if(i[ee]&&bt.test(i[ee].text))j=new Set([i[ee].text]);else continue;let te=F+1,se=i[te]?.text==="{"&&a.has(te)?i[a.get(te)].end:P(te);H.push({start:i[G].start,end:se,bodyStart:i[te]?.start??se,functionBody:!0,names:j})}else if(i[F].text==="("&&a.has(F)){let ee=i[F-1]?.text;if(!ee||ba.has(ee)||!bt.test(ee)&&ee!=="*"&&ee!=="]")continue;let G=a.get(F),j=G+1;if(i[j]?.text===":"){j++;while(j<i.length&&!["{","=>",";","="].includes(i[j].text))j++}if(i[j]?.text!=="{"||!a.has(j))continue;H.push({start:i[F].start,end:i[a.get(j)].end,bodyStart:i[j].start,functionBody:ee!=="catch",names:T(F+1,G)})}function O(F){let ee=F;for(;ee<i.length;ee++){let G=i[ee].text;if(Kr.includes(G)&&a.has(ee)){ee=a.get(ee);continue}if(G===";"||Xr.includes(G))break;let j=i[ee-1];if(ee>F&&ya.has(G)&&j.text!==".")break;if(ee>F&&/[\n\r]/.test(n.slice(j.end,i[ee].start))&&(/^[\w$]+$/.test(j.text)||Xr.includes(j.text)||['"',"'","`"].includes(j.text))&&bt.test(G)&&!["in","of","instanceof"].includes(G))break}return ee}let L=[];for(let F=0;F<i.length;F++){if(i[F].text!=="for")continue;let ee=i[F+1]?.text==="await"?F+2:F+1;if(i[ee]?.text!=="("||!a.has(ee))continue;let G=a.get(ee),j=G+1,te=i[j]?.text==="{"&&a.has(j)?a.get(j):O(j),se=i[te]?.text===";"||i[te]?.text==="}"?i[te].end:i[Math.max(j,te-1)]?.end??n.length;L.push({headStart:ee,headEnd:G,start:i[ee].start,end:se})}for(let F=0;F<i.length;F++){let ee=i[F].text,G=i[F-1]?.text;if(G==="."||i[F+1]?.text===":")continue;if(G==="as"||G==="<")continue;if(ee==="const"||ee==="let"||ee==="var"){let j=O(F+1),te=F+1,se=!1,ne=!1,ue=0;for(let ye=F+1;ye<=j;ye++){let de=i[ye]?.text;if(ye<j&&Kr.includes(de)&&a.has(ye)&&a.get(ye)<j){ye=a.get(ye);continue}if(ye<j&&de===":"&&!ne)se=!0;else if(ye<j&&de==="="&&ue===0)se=!1,ne=!0;else if(ye<j&&se&&de==="<")ue++;else if(ye<j&&se&&de===">"&&ue>0)ue--;else if(ye===j||de===","&&ue===0)v(te,ye,M,ee==="var"),te=ye+1,se=!1,ne=!1}}else if(ee==="function"||ee==="class"){let j=F+1;if(i[j]?.text==="*")j++;if(i[j]&&bt.test(i[j].text)&&i[j].text!=="extends")M.add(i[j].text),b.push({name:i[j].text,token:j})}else if(ee==="import"){let j=F+1;if(i[j]?.text==="*"&&i[j+1]?.text==="as")j+=2;let te=i[j]?.text;if(te&&bt.test(te)&&te!=="type"&&i[j+1]?.text!=="("&&i[j+1]?.text!==".")M.add(te),b.push({name:te,token:j,file:!0});let se=i[j]?.text==="{"?j:i[j+1]?.text===","&&i[j+2]?.text==="{"?j+2:-1;if(se!==-1&&a.has(se)){let ne=a.get(se);for(let[ue,ye]of c(se+1,ne)){let de=ye-1;while(de>=ue&&!bt.test(i[de].text))de--;if(de>=ue&&i[de].text!=="type")b.push({name:i[de].text,token:de,file:!0})}}}}let B={code:n,scopes:H,loops:L,declarations:M,sites:b,tokens:i,pairs:a};return Zr.set(e,B),B}function Qt(e){let t=_s(e);return{code:t.code,shadows:(n,i)=>t.scopes.some((a)=>i>=a.start&&i<a.end&&a.names.has(n))}}function zn(e){return new Set(_s(e).declarations)}function Oe(e,t){let{scopes:n,loops:i,sites:a,tokens:l,pairs:c}=_s(e),b=Array.from({length:l.length},()=>-1),v=[];for(let O=0;O<l.length;O++){b[O]=v.length?v[v.length-1]:-1;let L=l[O].text;if(L==="{"&&c.has(O))v.push(O);else if(L==="}"&&v.length&&c.get(O)===v[v.length-1])v.pop()}let T=new Set,P=new Map;for(let O of a){if(!t.has(O.name))continue;T.add(O.token);let L=O.file?-1:b[O.token],B=L===-1?[0,Number.POSITIVE_INFINITY]:[l[L].start,l[c.get(L)].end];if(O.functionScoped){let ee=l[O.token].start,G=n.filter((j)=>j.functionBody&&ee>=j.bodyStart&&ee<j.end).sort((j,te)=>j.end-j.bodyStart-(te.end-te.bodyStart))[0];B=G?[G.bodyStart,G.end]:[0,Number.POSITIVE_INFINITY]}else if(!O.file){let ee=i.filter((G)=>O.token>G.headStart&&O.token<G.headEnd).sort((G,j)=>G.headEnd-G.headStart-(j.headEnd-j.headStart))[0];if(ee)B=[ee.start,ee.end]}let F=P.get(O.name);if(F)F.push(B);else P.set(O.name,[B])}let M=new Set;for(let O=0;O<l.length;O++){if(l[O].text!=="import"||l[O-1]?.text===".")continue;let L=O+1;if(l[L]?.text==="type")L++;if(l[L]&&bt.test(l[L].text)&&l[L+1]?.text===",")L+=2;if(l[L]?.text==="{"&&c.has(L))for(let B=L+1;B<c.get(L);B++)M.add(B)}let H=new Set;for(let O=0;O<l.length;O++){let L=l[O].text;if(!t.has(L)||H.has(L)||T.has(O)||M.has(O))continue;let B=l[O-1]?.text;if(B==="#"||B==="."&&l[O-2]?.text!=="..")continue;if(l[O+1]?.text===":"&&(B==="{"||B===","))continue;let F=l[O].start;if(P.get(L)?.some(([ee,G])=>F>=ee&&F<G))continue;if(n.some((ee)=>F>=ee.start&&F<ee.end&&ee.names.has(L)))continue;H.add(L)}return H}var Ie="0.2.846";var Jr=Symbol.for(`stx.lazy-module-promises.${Ie}`);function Sa(){let e=globalThis;return e[Jr]??=new Map,e[Jr]}function o(e,t){let n=Sa(),i=`${import.meta.url}\x00${e}`,a=n.get(i);if(a)return a;let l=t();return n.set(i,l),l.catch(()=>{if(n.get(i)===l)n.delete(i)}),l}var $a=/<\/(script)/gi;function pn(e){if(!e||e.indexOf("</")===-1)return e;return e.replace($a,"<\\/$1")}import Gr from"fs";var Yr=[];function w(e){let t=new R(e);return Yr.push(t),t}function Nc(){for(let e of Yr)e.clear()}function S(e,...t){return`${t.map((n)=>String(n??"")).join("\x00")}\x00${e.length}\x00${Bun.hash(e)}`}function xr(e){let t=[];for(let n of new Set(e))try{t.push({path:n,mtimeMs:Gr.statSync(n).mtimeMs})}catch{}return t}function Bs(e){for(let t of e)try{if(Gr.statSync(t.path).mtimeMs!==t.mtimeMs)return!1}catch{return!1}return!0}var Se=["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 va=/^[ \t]*import\s+['"]([^'"]+?\.css)(\?[^'"]*)?['"]\s*;?\s*$/gm;function Ea(e){if(e.startsWith(".")||e.startsWith("/"))return null;if(e.startsWith("@")){let n=e.match(/^(@[^/]+\/[^/]+)(\/.*)?$/);if(!n)return null;return{pkg:n[1],subpath:n[2]||""}}let t=e.match(/^([^/]+)(\/.*)?$/);if(!t)return null;return{pkg:t[1],subpath:t[2]||""}}function ka(e,t){let n=t;while(!0){let i=St.join(n,"node_modules",e,"package.json");if(en.existsSync(i))return St.dirname(i);let a=St.dirname(n);if(a===n)return null;n=a}}function Ca(e,t){if(!e||typeof e!=="object")return null;let n=(a)=>{if(typeof a==="string")return a;if(a&&typeof a==="object"){if(typeof a.import==="string")return a.import;if(typeof a.default==="string")return a.default;if(typeof a.import==="object")return n(a.import);if(typeof a.default==="object")return n(a.default)}return null};if(Object.prototype.hasOwnProperty.call(e,t))return n(e[t]);let i=null;for(let a of Object.keys(e)){let l=a.indexOf("*");if(l===-1)continue;let c=a.slice(0,l),b=a.slice(l+1);if(!t.startsWith(c)||!t.endsWith(b))continue;if(t.length<c.length+b.length)continue;if(!i||c.length>i.prefix.length)i={pattern:a,prefix:c,suffix:b}}if(i){let a=t.slice(i.prefix.length,t.length-i.suffix.length),l=n(e[i.pattern]);if(l)return l.replace("*",a)}return null}function Ra(e,t){let n=Ea(e);if(!n||!n.subpath)return null;let i=ka(n.pkg,t);if(!i)return null;let a;try{a=JSON.parse(en.readFileSync(St.join(i,"package.json"),"utf8"))}catch{return null}let l=`.${n.subpath}`,c=Ca(a.exports,l);if(!c)return null;let b=St.resolve(i,c);return en.existsSync(b)?b:null}function wi(e,t){let n=t.filePath?St.dirname(t.filePath):t.projectRoot||process.cwd(),i=t.projectRoot||process.cwd(),a=new Set,l=[],c=[];return{code:e.replace(va,(v,T)=>{let P;try{if(T.startsWith("./")||T.startsWith("../")||T.startsWith("/")){if(P=T.startsWith("/")?T:St.resolve(n,T),!en.existsSync(P))throw Error(`file not found: ${P}`)}else{let M=null;try{M=Bun.resolveSync(T,i)}catch{M=Ra(T,i)}if(!M)throw Error(`could not resolve ${T} (Bun.resolveSync + exports fallback both failed)`);P=M}}catch(M){return console.warn(`[stx:vendor-css] could not resolve ${JSON.stringify(T)} (from ${t.filePath||"<unknown>"}): ${M?.message||M}`),c.push(T),""}if(a.has(P))return"";a.add(P);try{let M=en.readFileSync(P,"utf8");l.push({source:T,resolvedPath:P,contents:M})}catch(M){console.warn(`[stx:vendor-css] could not read ${P}: ${M?.message||M}`),c.push(T)}return""}),styles:l,unresolved:c}}function Ta(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function vi(e){if(e.length===0)return"";return`${e.map((t)=>`<style data-stx-vendor="${Ta(t.source)}" data-stx-layer="vendor">
116
116
  @layer vendor {
117
117
  ${t.contents}
118
118
  }
119
119
  </style>`).join(`
120
120
  `)}
121
- `}var ug=k,ei=w(256);function Mt(e){let t=S(e),n=ei.get(t);if(!n)n=Aa(e),ei.set(t,n);return{code:n.code,imports:[...n.imports],models:[...n.models]}}function Aa(e){let t=s(e),n=new Set;for(let b of e.matchAll(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm))for(let v of b[1].split(",")){let T=v.trim().split(/\s+as\s+/).pop()?.replace(/^type\s+/,"").trim();if(T)n.add(T)}let i=zn(t),a=Se.filter((b)=>{if(n.has(b)||i.has(b))return!1;return dg(t,b,!0)}),l=ri(t).filter((b)=>!n.has(b)&&!i.has(b));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(`
121
+ `}var dg=k,Qr=w(256);function Mt(e){let t=S(e),n=Qr.get(t);if(!n)n=Aa(e),Qr.set(t,n);return{code:n.code,imports:[...n.imports],models:[...n.models]}}function Aa(e){let t=s(e),n=new Set;for(let b of e.matchAll(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm))for(let v of b[1].split(",")){let T=v.trim().split(/\s+as\s+/).pop()?.replace(/^type\s+/,"").trim();if(T)n.add(T)}let i=zn(t),a=Se.filter((b)=>{if(n.has(b)||i.has(b))return!1;return pg(t,b,!0)}),l=si(t).filter((b)=>!n.has(b)&&!i.has(b));if(a.length===0&&l.length===0)return{code:e,imports:a,models:l};return{code:`${[a.length>0?`import { ${a.join(", ")} } from '@stacksjs/browser'`:"",l.length>0?"import '@stacksjs/browser'":"",l.length>0?`const { ${l.join(", ")} } = window.StacksBrowser || {}`:""].filter(Boolean).join(`
122
122
  `)}
123
- ${e}`,imports:a,models:l}}var Ia=new Set(["Promise","Object","Array","Map","Set","Date","Error","JSON","Math","Number","String","RegExp","Symbol","WeakMap","WeakSet","Proxy","Reflect","Intl","URL","URLSearchParams","FormData","Headers","Request","Response","AbortController","EventTarget","Element","Document","Node","Window","Console","Storage","Navigator","Blob","File","FileReader","HTMLElement","SVGElement","Event","CustomEvent","DOMParser","XMLSerializer","WebSocket","Worker","SharedWorker","IntersectionObserver","MutationObserver","ResizeObserver","PerformanceObserver","Notification","Bun","Buffer","Process","Modal","Intl"]);function ri(e,t=Qt(e)){let n=new Set,i=zn(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(Ia.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 Pa(e){return zn(e)}var ti=w(128);function Yc(e){let t=S(e),n=ti.get(t);if(!n)n=Oa(e),ti.set(t,n);return{code:n.code,stxImports:[...n.stxImports],browserImports:[...n.browserImports]}}function Oa(e){let t=new Set,n=new Set,i=e;i=i.replace(/^[ \t]*import\s+type\s+\{[^}]*\}\s+from\s+['"][^'"]+['"][ \t]*;?[ \t]*$/gm,"// [type import stripped]");let a=new Set,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 O=c[1],L=c[2];if(c[0].includes("import type"))continue;let B=[];for(let ee of O.split(",")){let G=ee.trim();if(!G||G.startsWith("type "))continue;let j=G.match(/^([A-Za-z_$][\w$]*)(?:\s+as\s+([A-Za-z_$][\w$]*))?$/);if(!j)continue;let te=j[1],se=j[2]||te;if(a.add(te),a.add(se),L==="stx"||L==="@stacksjs/stx")t.add(te);else n.add(te);if(se!==te)B.push(`${se} = ${te}`)}let F=B.length>0?`var ${B.join(", ")}; /* [auto-import processed] */`:"// [auto-import processed]";i=i.replace(c[0],F)}let b=Pa(i),v=Qt(i);for(let O of ug){if(a.has(O)||b.has(O))continue;if(ws(v,O,!0))t.add(O)}let T=s(i),P=Qt(T),M=new Set;for(let O of i.matchAll(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm))for(let L of O[1].split(",")){let B=L.trim().replace(/^type\s+/,"").split(/\s+as\s+/);for(let F of B){let ee=F.trim();if(ee)M.add(ee)}}for(let O of Se){if(a.has(O)||b.has(O)||M.has(O))continue;if(ws(P,O))n.add(O)}let H=ri(T,P);for(let O of H)if(!a.has(O)&&!b.has(O))n.add(O);return{code:i,stxImports:Array.from(t),browserImports:Array.from(n)}}function dg(e,t,n=!1){return ws(Qt(e),t,n)}function ws(e,t,n=!1){let i=e.code,a=new RegExp(`\\b${t.replace(/[$]/g,"\\$")}\\b`,"g");for(let l of i.matchAll(a)){let c=l.index??0;if(e.shadows(t,c))continue;let b=c+t.length,v=c-1;while(v>=0&&/\s/.test(i[v]))v--;if(i[v]==="."&&i.slice(Math.max(0,v-2),v+1)!=="...")continue;let T=b;while(T<i.length&&/\s/.test(i[T]))T++;if(i[T]===":"&&i[T+1]!==":"&&(i[v]==="{"||i[v]===","))continue;if(n&&!/^\s*(?:<[^>]*>)?\s*\(/.test(i.slice(b)))continue;if(Da(i,b))continue;return!0}return!1}function Da(e,t){let n=t;while(n<e.length&&(e[n]===" "||e[n]==="\t"))n++;if(e[n]!=="(")return!1;let i=0;for(;n<e.length;n++){let a=e[n];if(a==="(")i++;else if(a===")"){if(i--,i===0)break}}if(i!==0)return!1;n++;while(n<e.length&&(e[n]===" "||e[n]==="\t"))n++;return e[n]==="{"}function Zc(e,t){let n=[];if(e.length>0)n.push(` var { ${e.join(", ")} } = window.stx || window;`);if(t.length>0)n.push(` var { ${t.join(", ")} } = window.StacksBrowser || {};`);if(n.length>0)return` // STX: auto-imported from stx and @stacksjs/browser
123
+ ${e}`,imports:a,models:l}}var Ia=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 si(e,t=Qt(e)){let n=new Set,i=zn(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(Ia.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 Pa(e){return zn(e)}var ei=w(128);function Zc(e){let t=S(e),n=ei.get(t);if(!n)n=Oa(e),ei.set(t,n);return{code:n.code,stxImports:[...n.stxImports],browserImports:[...n.browserImports]}}function Oa(e){let t=new Set,n=new Set,i=e;i=i.replace(/^[ \t]*import\s+type\s+\{[^}]*\}\s+from\s+['"][^'"]+['"][ \t]*;?[ \t]*$/gm,"// [type import stripped]");let a=new Set,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 O=c[1],L=c[2];if(c[0].includes("import type"))continue;let B=[];for(let ee of O.split(",")){let G=ee.trim();if(!G||G.startsWith("type "))continue;let j=G.match(/^([A-Za-z_$][\w$]*)(?:\s+as\s+([A-Za-z_$][\w$]*))?$/);if(!j)continue;let te=j[1],se=j[2]||te;if(a.add(te),a.add(se),L==="stx"||L==="@stacksjs/stx")t.add(te);else n.add(te);if(se!==te)B.push(`${se} = ${te}`)}let F=B.length>0?`var ${B.join(", ")}; /* [auto-import processed] */`:"// [auto-import processed]";i=i.replace(c[0],F)}let b=Pa(i),v=Qt(i);for(let O of dg){if(a.has(O)||b.has(O))continue;if(ws(v,O,!0))t.add(O)}let T=s(i),P=Qt(T),M=new Set;for(let O of i.matchAll(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm))for(let L of O[1].split(",")){let B=L.trim().replace(/^type\s+/,"").split(/\s+as\s+/);for(let F of B){let ee=F.trim();if(ee)M.add(ee)}}for(let O of Se){if(a.has(O)||b.has(O)||M.has(O))continue;if(ws(P,O))n.add(O)}let H=si(T,P);for(let O of H)if(!a.has(O)&&!b.has(O))n.add(O);return{code:i,stxImports:Array.from(t),browserImports:Array.from(n)}}function pg(e,t,n=!1){return ws(Qt(e),t,n)}function ws(e,t,n=!1){let i=e.code,a=new RegExp(`\\b${t.replace(/[$]/g,"\\$")}\\b`,"g");for(let l of i.matchAll(a)){let c=l.index??0;if(e.shadows(t,c))continue;let b=c+t.length,v=c-1;while(v>=0&&/\s/.test(i[v]))v--;if(i[v]==="."&&i.slice(Math.max(0,v-2),v+1)!=="...")continue;let T=b;while(T<i.length&&/\s/.test(i[T]))T++;if(i[T]===":"&&i[T+1]!==":"&&(i[v]==="{"||i[v]===","))continue;if(n&&!/^\s*(?:<[^>]*>)?\s*\(/.test(i.slice(b)))continue;if(Da(i,b))continue;return!0}return!1}function Da(e,t){let n=t;while(n<e.length&&(e[n]===" "||e[n]==="\t"))n++;if(e[n]!=="(")return!1;let i=0;for(;n<e.length;n++){let a=e[n];if(a==="(")i++;else if(a===")"){if(i--,i===0)break}}if(i!==0)return!1;n++;while(n<e.length&&(e[n]===" "||e[n]==="\t"))n++;return e[n]==="{"}function Qc(e,t){let n=[];if(e.length>0)n.push(` var { ${e.join(", ")} } = window.stx || window;`);if(t.length>0)n.push(` var { ${t.join(", ")} } = window.StacksBrowser || {};`);if(n.length>0)return` // STX: auto-imported from stx and @stacksjs/browser
124
124
  ${n.join(`
125
125
  `)}
126
- ${Ma(e,t)}`;return""}function ey(e,t=[]){let{browserImports:n}=Yc(e),i=new Set(t);return Zc([],n.filter((a)=>!i.has(a)))}function Ma(e,t){let n=[...e.map((i)=>`['${i}', typeof ${i}, 'stx']`),...t.map((i)=>`['${i}', typeof ${i}, '@stacksjs/browser']`)];if(n.length===0)return"";return` // STX: report auto-imports the client runtime did not provide
126
+ ${Ma(e,t)}`;return""}function ty(e,t=[]){let{browserImports:n}=Zc(e),i=new Set(t);return Qc([],n.filter((a)=>!i.has(a)))}function Ma(e,t){let n=[...e.map((i)=>`['${i}', typeof ${i}, 'stx']`),...t.map((i)=>`['${i}', typeof ${i}, '@stacksjs/browser']`)];if(n.length===0)return"";return` // STX: report auto-imports the client runtime did not provide
127
127
  [${n.join(", ")}].forEach(function (e) {
128
128
  if (e[1] !== 'undefined') return;
129
129
  console.error(
@@ -132,7 +132,7 @@ ${Ma(e,t)}`;return""}function ey(e,t=[]){let{browserImports:n}=Yc(e),i=new Set(t
132
132
  + 'or it should be imported from a relative path so the bundler includes it.'
133
133
  );
134
134
  });
135
- `}function Le(e){let t=e.__stxClientPayload;if(t&&typeof t==="object"){let i={};for(let a in t){let l=t[a];if(typeof l==="function")continue;i[a]=l}return i.__stxDeclaredPayload=!0,i}let n={};for(let i in e){if(i.startsWith("__")||i.startsWith("$"))continue;let a=e[i];if(typeof a==="function")continue;n[i]=a}return n}var ja=/token|secret|passw|apikey|api_key|privatekey|private_key|credential|webhook|bearer|jwt|signature/i,ni=new Set;function Na(e,t){let n=ja.test(e),i=t.length>32768;if(!n&&!i)return;if(ni.has(e))return;if(ni.add(e),n)console.warn(`[stx] server\u2192client bridge is publishing "${e}" into the page body. If it holds a credential, rename it with a "__" prefix (never bridged) and pass only what the template needs. See stacksjs/stx#1831.`);if(i)console.warn(`[stx] server\u2192client bridge is publishing ${(t.length/1024).toFixed(1)}KB under "${e}". Every byte ships in the HTML on each request; prefix the binding with "__" and project just the fields the client reads.`)}function wn(e,t){if(!t)return"";let n=Oe(e,new Set(Object.keys(t))),i=t.__stxDeclaredPayload===!0,a=[],l=Object.entries(t).sort(([c],[b])=>c<b?-1:c>b?1:0);for(let[c,b]of l){if(!/^[A-Za-z_$][\w$]*$/.test(c))continue;if(c.startsWith("__")||c.startsWith("$"))continue;if(!i&&!n.has(c))continue;if(At(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(b)}catch{continue}if(v===void 0)continue;Na(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)
135
+ `}function Le(e){let t=e.__stxClientPayload;if(t&&typeof t==="object"){let i={};for(let a in t){let l=t[a];if(typeof l==="function")continue;i[a]=l}return i.__stxDeclaredPayload=!0,i}let n={};for(let i in e){if(i.startsWith("__")||i.startsWith("$"))continue;let a=e[i];if(typeof a==="function")continue;n[i]=a}return n}var ja=/token|secret|passw|apikey|api_key|privatekey|private_key|credential|webhook|bearer|jwt|signature/i,ti=new Set;function Na(e,t){let n=ja.test(e),i=t.length>32768;if(!n&&!i)return;if(ti.has(e))return;if(ti.add(e),n)console.warn(`[stx] server\u2192client bridge is publishing "${e}" into the page body. If it holds a credential, rename it with a "__" prefix (never bridged) and pass only what the template needs. See stacksjs/stx#1831.`);if(i)console.warn(`[stx] server\u2192client bridge is publishing ${(t.length/1024).toFixed(1)}KB under "${e}". Every byte ships in the HTML on each request; prefix the binding with "__" and project just the fields the client reads.`)}function wn(e,t){if(!t)return"";let n=Oe(e,new Set(Object.keys(t))),i=t.__stxDeclaredPayload===!0,a=[],l=Object.entries(t).sort(([c],[b])=>c<b?-1:c>b?1:0);for(let[c,b]of l){if(!/^[A-Za-z_$][\w$]*$/.test(c))continue;if(c.startsWith("__")||c.startsWith("$"))continue;if(!i&&!n.has(c))continue;if(At(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(b)}catch{continue}if(v===void 0)continue;Na(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)
136
136
  ${a.join(`
137
137
  `)}
138
138
  `}var La={left:0,middle:1,right:2};function za(e){let t=[];if(e.self)t.push("if ($event.target !== $el) return");for(let n of e.systemKeys)t.push(`if (!$event.${n}Key) return`);if(e.keys.length>0){let n=e.keys.map((i)=>`$event.key === '${i}'`).join(" || ");t.push(`if (!(${n})) return`)}if(e.mouse!==null){let n=La[e.mouse];t.push(`if ($event.button !== ${n}) return`)}if(e.prevent)t.push("$event.preventDefault()");if(e.stop)t.push("$event.stopPropagation()");return t.join("; ")}function Ba(e,t){let{elementId:n,event:i,modifiers:a}=e,l=ys(e.handler),c=za(a),b=[];if(a.once)b.push("once: true");if(a.capture)b.push("capture: true");if(bs(i,a))b.push("passive: true");let v=b.length>0?`, { ${b.join(", ")} }`:"",T="";if(c)T+=`${c}; `;let P=l.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),M=`var $emit = function(name, detail) {
@@ -181,12 +181,12 @@ else {
181
181
  }${v})`}function Wa(e){if(e.length===0)return"";return`
182
182
  // STX: auto-generated event bindings
183
183
  ${e.map((n,i)=>Ba(n,i)).join(`
184
- `)}`}function si(e){let t=[],n=new Set,i=e.replace(/^\s*import\s+.*$/gm,""),a=0,l=i.length,c=0;while(c<l){let b=i[c];if(b==="'"||b==='"'||b==="`"){let v=b;if(c++,v==="`"){let T=0;while(c<l){if(i[c]==="\\"){c+=2;continue}if(i[c]==="`"&&T===0){c++;break}if(i[c]==="$"&&i[c+1]==="{"){T++,c+=2;continue}if(i[c]==="}"&&T>0){T--,c++;continue}c++}}else while(c<l){if(i[c]==="\\"){c+=2;continue}if(i[c]===v){c++;break}c++}continue}if(b==="/"&&i[c+1]==="/"){while(c<l&&i[c]!==`
185
- `)c++;continue}if(b==="/"&&i[c+1]==="*"){c+=2;while(c<l-1&&!(i[c]==="*"&&i[c+1]==="/"))c++;c+=2;continue}if(b==="{"){a++,c++;continue}if(b==="}"){a--,c++;continue}if(a===0){let v=i.slice(c),T=v.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(T){let H=T[1];if(!H.startsWith("_")&&!n.has(H))t.push(H),n.add(H);c+=T[0].length;continue}let P=v.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(P){P[1].split(",").forEach((H)=>{let O=H.trim(),L=O.indexOf(":"),B=L>=0?O.slice(L+1).trim().split(/[\s=]/)[0]:O.split(/[\s=]/)[0];if(B&&!B.startsWith("_")&&!n.has(B))t.push(B),n.add(B)}),c+=P[0].length;continue}let M=v.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(M){let H=M[1];if(!H.startsWith("_")&&!n.has(H))t.push(H),n.add(H);c+=M[0].length;continue}}c++}return t}var Fa=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 Va(e){let t=new Set,n=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function i(H){let O;while((O=n.exec(H))!==null){let L=O[0];if(!Fa.has(L))t.add(L)}}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 b=/:[a-z][\w.-]*\s*=\s*'([^']*)'/gi;while((l=b.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 T=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((l=T.exec(e))!==null)i(l[1]);let P=/@model\s*=\s*["']([^"']*)["']/gi;while((l=P.exec(e))!==null)i(l[1]);let M=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((l=M.exec(e))!==null)i(l[1]);return t}async function je(e,t={}){let n=e,i="",a=!1,l=[],c=bi(n,{filePath:t.filePath,projectRoot:t.projectRoot});n=c.code;let b=wi(c.styles),v=Mt(n);n=v.code,l=[...v.imports,...v.models];let{hasUserImports:T,bundleClientScript:P}=await o("stx/client-script-bundler",()=>import("./chunk-fz433ybr.js"));if(T(n))n=await P(n,t.filePath||"",{projectRoot:t.projectRoot,minify:t.production}),a=!0;if(t.autoImports!==!1){let j=Yc(n);n=j.code,i=Zc(j.stxImports,j.browserImports.filter((te)=>!l.includes(te)))}if(i=`${wn(n,t.serverData)}${i}`,n=I(n),!a&&Be(t.attrs||""))n=Fe(n);let M=Wa(t.eventBindings||[]),H=(t.attrs||"").trim(),O=/\btype\s*=\s*["']module["']/i.test(H),L=t.instanceId?` data-stx-instance="${t.instanceId}"`:"";if(O){let j=H.replace(/\btype\s*=\s*["']module["']/i,"").trim(),te=`type="module" data-stx-scoped${L}${j?` ${j}`:""}`;return`${b}<script ${te}>
184
+ `)}`}function ni(e){let t=[],n=new Set,i=e.replace(/^\s*import\s+.*$/gm,""),a=0,l=i.length,c=0;while(c<l){let b=i[c];if(b==="'"||b==='"'||b==="`"){let v=b;if(c++,v==="`"){let T=0;while(c<l){if(i[c]==="\\"){c+=2;continue}if(i[c]==="`"&&T===0){c++;break}if(i[c]==="$"&&i[c+1]==="{"){T++,c+=2;continue}if(i[c]==="}"&&T>0){T--,c++;continue}c++}}else while(c<l){if(i[c]==="\\"){c+=2;continue}if(i[c]===v){c++;break}c++}continue}if(b==="/"&&i[c+1]==="/"){while(c<l&&i[c]!==`
185
+ `)c++;continue}if(b==="/"&&i[c+1]==="*"){c+=2;while(c<l-1&&!(i[c]==="*"&&i[c+1]==="/"))c++;c+=2;continue}if(b==="{"){a++,c++;continue}if(b==="}"){a--,c++;continue}if(a===0){let v=i.slice(c),T=v.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(T){let H=T[1];if(!H.startsWith("_")&&!n.has(H))t.push(H),n.add(H);c+=T[0].length;continue}let P=v.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(P){P[1].split(",").forEach((H)=>{let O=H.trim(),L=O.indexOf(":"),B=L>=0?O.slice(L+1).trim().split(/[\s=]/)[0]:O.split(/[\s=]/)[0];if(B&&!B.startsWith("_")&&!n.has(B))t.push(B),n.add(B)}),c+=P[0].length;continue}let M=v.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(M){let H=M[1];if(!H.startsWith("_")&&!n.has(H))t.push(H),n.add(H);c+=M[0].length;continue}}c++}return t}var Fa=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 Va(e){let t=new Set,n=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function i(H){let O;while((O=n.exec(H))!==null){let L=O[0];if(!Fa.has(L))t.add(L)}}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 b=/:[a-z][\w.-]*\s*=\s*'([^']*)'/gi;while((l=b.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 T=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((l=T.exec(e))!==null)i(l[1]);let P=/@model\s*=\s*["']([^"']*)["']/gi;while((l=P.exec(e))!==null)i(l[1]);let M=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((l=M.exec(e))!==null)i(l[1]);return t}async function je(e,t={}){let n=e,i="",a=!1,l=[],c=wi(n,{filePath:t.filePath,projectRoot:t.projectRoot});n=c.code;let b=vi(c.styles),v=Mt(n);n=v.code,l=[...v.imports,...v.models];let{hasUserImports:T,bundleClientScript:P}=await o("stx/client-script-bundler",()=>import("./chunk-hs6fg0k9.js"));if(T(n))n=await P(n,t.filePath||"",{projectRoot:t.projectRoot,minify:t.production}),a=!0;if(t.autoImports!==!1){let j=Zc(n);n=j.code,i=Qc(j.stxImports,j.browserImports.filter((te)=>!l.includes(te)))}if(i=`${wn(n,t.serverData)}${i}`,n=I(n),!a&&Be(t.attrs||""))n=Fe(n);let M=Wa(t.eventBindings||[]),H=(t.attrs||"").trim(),O=/\btype\s*=\s*["']module["']/i.test(H),L=t.instanceId?` data-stx-instance="${t.instanceId}"`:"";if(O){let j=H.replace(/\btype\s*=\s*["']module["']/i,"").trim(),te=`type="module" data-stx-scoped${L}${j?` ${j}`:""}`;return`${b}<script ${te}>
186
186
  ${pn(`${i}${n}
187
187
  ${M}`)}
188
- </script>`}let B=Oi(e),F=/function __stx_setup_/.test(n),ee=/\bstx\.mount\s*\(|\bstx\.mountEl\s*\(/.test(e);function G(j){let te=j.length>0?`
189
- return ${Ns(n,j)};`:"",se=JSON.stringify(`[stx] client block failed${t.filePath?` (${t.filePath})`:""}; this block will not hydrate`);return`${b}<script data-stx-scoped data-stx-run="always"${L}>
188
+ </script>`}let B=Ni(e),F=/function __stx_setup_/.test(n),ee=/\bstx\.mount\s*\(|\bstx\.mountEl\s*\(/.test(e);function G(j){let te=j.length>0?`
189
+ return ${Ds(n,j)};`:"",se=JSON.stringify(`[stx] client block failed${t.filePath?` (${t.filePath})`:""}; this block will not hydrate`);return`${b}<script data-stx-scoped data-stx-run="always"${L}>
190
190
  window.stx.mount(function() {
191
191
  'use strict';
192
192
  try {
@@ -196,7 +196,7 @@ ${M}${te}`)}
196
196
  console.error(${se}, error);
197
197
  return {};
198
198
  }
199
- })</script>`}if(!ee&&!F){if(B)return G(si(e));if(t.templateContent){let j=si(e);if(j.length>0){let te=Va(t.templateContent);if(j.some((ne)=>te.has(ne)))return G(j)}}}return`${b}<script data-stx-scoped data-stx-run="always"${L}>
199
+ })</script>`}if(!ee&&!F){if(B)return G(ni(e));if(t.templateContent){let j=ni(e);if(j.length>0){let te=Va(t.templateContent);if(j.some((ne)=>te.has(ne)))return G(j)}}}return`${b}<script data-stx-scoped data-stx-run="always"${L}>
200
200
  ;(function() {
201
201
  'use strict';
202
202
  try {
@@ -205,7 +205,7 @@ ${M}`)}
205
205
  } catch (error) {
206
206
  console.error(${JSON.stringify(`[stx] client block failed${t.filePath?` (${t.filePath})`:""}; this block will not hydrate`)}, error);
207
207
  }
208
- })()</script>`}import{createHash as Ga}from"crypto";var Ss=/\s*/y,$s=/\x00STX_HTML_COMMENT_\d+\x00/y;function Pt(e){let t=0;while(t<e.length){if(Ss.lastIndex=t,Ss.exec(e),t=Ss.lastIndex,e.startsWith("<!--",t)){let n=e.indexOf("-->",t+4);if(n===-1)return t;t=n+3;continue}if($s.lastIndex=t,$s.test(e)){t=$s.lastIndex;continue}return t}return t}var vs=/<(\/?)([a-zA-Z][a-zA-Z0-9-]*)\b/y,Ua=new Map(["textarea","title","xmp","iframe","noembed","noframes"].map((e)=>[e,new RegExp(`</${e}\\s*>`,"ig")]));function fn(e){let t=[],n=0;while(n<e.length){let i=e.indexOf("<",n);if(i===-1)break;if(e.startsWith("<!--",i)){let H=e.indexOf("-->",i+4);if(H===-1)break;n=H+3;continue}vs.lastIndex=i;let a=vs.exec(e);if(!a){n=i+1;continue}let l=vs.lastIndex,c=l,b=null;for(;c<e.length;c++){let H=e[c];if(b){if(H===b)b=null}else if(H==='"'||H==="'")b=H;else if(H===">")break}if(c===e.length)break;let v=a[1]==="/",T=e[c-1]==="/";t.push({start:i,end:c+1,name:a[2],attributes:e.slice(l,T?c-1:c),closing:v,selfClosing:T}),n=c+1;let P=a[2].toLowerCase();if(!v&&P==="plaintext")break;let M=Ua.get(P);if(!v&&(P==="script"||P==="style"||M)){let H=M??(P==="script"?Fn:Vn);H.lastIndex=n;let O=H.exec(e);if(!O)break;n=O.index}}return t}var Bn=/<script\b[^>]*>/iy,Fn=/<\/script\s*>/ig,Wn=/<style\b[^>]*>/iy,Vn=/<\/style\s*>/ig;function ii(e,t,n,i){n.lastIndex=t;let a=n.exec(e);if(!a||a.index!==t)return-1;i.lastIndex=n.lastIndex;let l=i.exec(e);if(!l)return-1;return l.index+l[0].length}function q(e,t){return ii(e,t,Bn,Fn)}function gn(e,t){return ii(e,t,Wn,Vn)}function De(e,t){if(!e.startsWith("<!--",t))return-1;let n=e.indexOf("-->",t+4);if(n===-1)return-1;return n+3}function oi(e,t){if(e.startsWith("<!--",t)){let a=De(e,t);return a===-1?e.length:a}if(Bn.lastIndex=t,Bn.exec(e)?.index===t){Fn.lastIndex=Bn.lastIndex;let a=Fn.exec(e);return a?a.index+a[0].length:e.length}if(Wn.lastIndex=t,Wn.exec(e)?.index===t){Vn.lastIndex=Wn.lastIndex;let a=Vn.exec(e);return a?a.index+a[0].length:e.length}return-1}function y(e,t){let n=[],i=0,a=e.length,l=!1,c=null;while(i<a){let b=e[i];if(l){if(c){if(b===c)c=null}else if(b==='"'||b==="'")c=b;else if(b===">")l=!1;i++;continue}if(b!=="<"){let M=e.indexOf("<",i+1);if(M===-1)break;i=M;continue}let v=t(e,i);if(v>i){n.push({start:i,end:v,token:e.slice(i,v)}),i=v;continue}let T=oi(e,i);if(T>i){i=T;continue}let P=e.charCodeAt(i+1);if(P>=65&&P<=90||P>=97&&P<=122)l=!0;i++}return n}function ai(e){let t=0,n=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),b=c===-1?e.length:c;while(i<b){let M=e[i++];if(M==="{")t++;else if(M==="}")n++;if(t>=2&&n>=2)return!0}if(c===-1)break;let v=oi(e,c);if(v>c){i=v;continue}let T=e.charCodeAt(c+1),P=T===47?e.charCodeAt(c+2):T;if(P>=65&&P<=90||P>=97&&P<=122)a=!0;i=c+1}return!1}function Nc(e,t){while(e.size>=t){let n=e.keys().next();if(n.done)return;e.delete(n.value)}}var Ha=1024,qa=16777216,Lt=new Map,Es=0;function Za(e,t){Lt.set(e,t),Es+=e.length+t.output.length;for(let[n,i]of Lt){if(Es<=qa)break;Lt.delete(n),Es-=n.length+i.output.length}}function fe(e,t,n,i){let a=i!==void 0&&e.length>=Ha,l=a?`${i}\x00${e}`:"";if(a){let P=Lt.get(l);if(P)return Lt.delete(l),Lt.set(l,P),{output:P.output,tokens:P.tokens.slice()}}let c=y(e,t);if(c.length===0)return{output:e,tokens:[]};let b=c.map((P)=>P.token),v="",T=0;for(let P=0;P<c.length;P++){let M=c[P];v+=e.slice(T,M.start),v+=n(M.token,P),T=M.end}if(v+=e.slice(T),a)return Za(l,{output:v,tokens:b}),{output:v,tokens:b.slice()};return{output:v,tokens:b}}var Ka=1024,Xa=16777216,zt=new Map,ks=0;function Ja(e,t){zt.set(e,t),ks+=e.length+t.output.length;for(let[n,i]of zt){if(ks<=Xa)break;zt.delete(n),ks-=n.length+i.output.length}}function Cs(e,t,n){return{output:t,scripts:n,restore:(i)=>i===t?e:xr(i,n)}}function J(e){let t=e.length>=Ka;if(t){let a=zt.get(e);if(a)return zt.delete(e),zt.set(e,a),Cs(e,a.output,a.scripts.slice())}let{output:n,tokens:i}=fe(e,q,(a,l)=>`\x00STX_SCRIPT_${l}\x00`);if(t)return Ja(e,{output:n,scripts:i}),Cs(e,n,i.slice());return Cs(e,n,i)}function xr(e,t){if(t.length===0)return e;return e.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(n,i)=>t[+i]??"")}var Un="__stx_component_client_factories";function Hn(e){let t=e[Un];return t instanceof Map?t:null}function Kc(e){e[Un]=new Map}function Rs(e,t){let n=Hn(e);if(!n)return null;let i=Ga("sha256").update(t).digest("hex").slice(0,16),a=n.get(i);if(a)a.instances++;else n.set(i,{body:t,instances:1});return i}function Xc(e,t){let n=Hn(t);if(!n?.size)return e;let i=new Map;for(let[P,M]of n)if(M.instances===1)i.set(P,M.body);let a=[];if(i.size>0){let P=[...i.keys()].map((O)=>JSON.stringify(O).replace(/[$()*+.?[\\\]^{|}]/g,"\\$&")).join("|"),M=new RegExp(`window\\.__stxComponentFactories\\[(${P})\\]\\(("[^"]+")\\);`,"g"),H=M.exec(e);while(H!==null){let O=i.get(JSON.parse(H[1]));if(O!==void 0)a.push({start:H.index,end:H.index+H[0].length,replacement:`(${O})(${H[2]});`});H=M.exec(e)}}let l=[...n].filter(([,P])=>P.instances>1);if(l.length===0)return _i(e,a);let b=`<script data-stx-scoped data-stx-run="always" data-stx-component-factories>
208
+ })()</script>`}import{createHash as Ga}from"crypto";var Ss=/\s*/y,$s=/\x00STX_HTML_COMMENT_\d+\x00/y;function Pt(e){let t=0;while(t<e.length){if(Ss.lastIndex=t,Ss.exec(e),t=Ss.lastIndex,e.startsWith("<!--",t)){let n=e.indexOf("-->",t+4);if(n===-1)return t;t=n+3;continue}if($s.lastIndex=t,$s.test(e)){t=$s.lastIndex;continue}return t}return t}var vs=/<(\/?)([a-zA-Z][a-zA-Z0-9-]*)\b/y,Ua=new Map(["textarea","title","xmp","iframe","noembed","noframes"].map((e)=>[e,new RegExp(`</${e}\\s*>`,"ig")]));function fn(e){let t=[],n=0;while(n<e.length){let i=e.indexOf("<",n);if(i===-1)break;if(e.startsWith("<!--",i)){let H=e.indexOf("-->",i+4);if(H===-1)break;n=H+3;continue}vs.lastIndex=i;let a=vs.exec(e);if(!a){n=i+1;continue}let l=vs.lastIndex,c=l,b=null;for(;c<e.length;c++){let H=e[c];if(b){if(H===b)b=null}else if(H==='"'||H==="'")b=H;else if(H===">")break}if(c===e.length)break;let v=a[1]==="/",T=e[c-1]==="/";t.push({start:i,end:c+1,name:a[2],attributes:e.slice(l,T?c-1:c),closing:v,selfClosing:T}),n=c+1;let P=a[2].toLowerCase();if(!v&&P==="plaintext")break;let M=Ua.get(P);if(!v&&(P==="script"||P==="style"||M)){let H=M??(P==="script"?Fn:Vn);H.lastIndex=n;let O=H.exec(e);if(!O)break;n=O.index}}return t}var Bn=/<script\b[^>]*>/iy,Fn=/<\/script\s*>/ig,Wn=/<style\b[^>]*>/iy,Vn=/<\/style\s*>/ig;function ri(e,t,n,i){n.lastIndex=t;let a=n.exec(e);if(!a||a.index!==t)return-1;i.lastIndex=n.lastIndex;let l=i.exec(e);if(!l)return-1;return l.index+l[0].length}function q(e,t){return ri(e,t,Bn,Fn)}function gn(e,t){return ri(e,t,Wn,Vn)}function De(e,t){if(!e.startsWith("<!--",t))return-1;let n=e.indexOf("-->",t+4);if(n===-1)return-1;return n+3}function ii(e,t){if(e.startsWith("<!--",t)){let a=De(e,t);return a===-1?e.length:a}if(Bn.lastIndex=t,Bn.exec(e)?.index===t){Fn.lastIndex=Bn.lastIndex;let a=Fn.exec(e);return a?a.index+a[0].length:e.length}if(Wn.lastIndex=t,Wn.exec(e)?.index===t){Vn.lastIndex=Wn.lastIndex;let a=Vn.exec(e);return a?a.index+a[0].length:e.length}return-1}function y(e,t){let n=[],i=0,a=e.length,l=!1,c=null;while(i<a){let b=e[i];if(l){if(c){if(b===c)c=null}else if(b==='"'||b==="'")c=b;else if(b===">")l=!1;i++;continue}if(b!=="<"){let M=e.indexOf("<",i+1);if(M===-1)break;i=M;continue}let v=t(e,i);if(v>i){n.push({start:i,end:v,token:e.slice(i,v)}),i=v;continue}let T=ii(e,i);if(T>i){i=T;continue}let P=e.charCodeAt(i+1);if(P>=65&&P<=90||P>=97&&P<=122)l=!0;i++}return n}function oi(e){let t=0,n=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),b=c===-1?e.length:c;while(i<b){let M=e[i++];if(M==="{")t++;else if(M==="}")n++;if(t>=2&&n>=2)return!0}if(c===-1)break;let v=ii(e,c);if(v>c){i=v;continue}let T=e.charCodeAt(c+1),P=T===47?e.charCodeAt(c+2):T;if(P>=65&&P<=90||P>=97&&P<=122)a=!0;i=c+1}return!1}function Dc(e,t){while(e.size>=t){let n=e.keys().next();if(n.done)return;e.delete(n.value)}}var Ha=1024,qa=16777216,Lt=new Map,Es=0;function Za(e,t){Lt.set(e,t),Es+=e.length+t.output.length;for(let[n,i]of Lt){if(Es<=qa)break;Lt.delete(n),Es-=n.length+i.output.length}}function fe(e,t,n,i){let a=i!==void 0&&e.length>=Ha,l=a?`${i}\x00${e}`:"";if(a){let P=Lt.get(l);if(P)return Lt.delete(l),Lt.set(l,P),{output:P.output,tokens:P.tokens.slice()}}let c=y(e,t);if(c.length===0)return{output:e,tokens:[]};let b=c.map((P)=>P.token),v="",T=0;for(let P=0;P<c.length;P++){let M=c[P];v+=e.slice(T,M.start),v+=n(M.token,P),T=M.end}if(v+=e.slice(T),a)return Za(l,{output:v,tokens:b}),{output:v,tokens:b.slice()};return{output:v,tokens:b}}var Ka=1024,Xa=16777216,zt=new Map,ks=0;function Ja(e,t){zt.set(e,t),ks+=e.length+t.output.length;for(let[n,i]of zt){if(ks<=Xa)break;zt.delete(n),ks-=n.length+i.output.length}}function Cs(e,t,n){return{output:t,scripts:n,restore:(i)=>i===t?e:Sr(i,n)}}function J(e){let t=e.length>=Ka;if(t){let a=zt.get(e);if(a)return zt.delete(e),zt.set(e,a),Cs(e,a.output,a.scripts.slice())}let{output:n,tokens:i}=fe(e,q,(a,l)=>`\x00STX_SCRIPT_${l}\x00`);if(t)return Ja(e,{output:n,scripts:i}),Cs(e,n,i.slice());return Cs(e,n,i)}function Sr(e,t){if(t.length===0)return e;return e.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(n,i)=>t[+i]??"")}var Un="__stx_component_client_factories";function Hn(e){let t=e[Un];return t instanceof Map?t:null}function Xc(e){e[Un]=new Map}function Rs(e,t){let n=Hn(e);if(!n)return null;let i=Ga("sha256").update(t).digest("hex").slice(0,16),a=n.get(i);if(a)a.instances++;else n.set(i,{body:t,instances:1});return i}function Gc(e,t){let n=Hn(t);if(!n?.size)return e;let i=new Map;for(let[P,M]of n)if(M.instances===1)i.set(P,M.body);let a=[];if(i.size>0){let P=[...i.keys()].map((O)=>JSON.stringify(O).replace(/[$()*+.?[\\\]^{|}]/g,"\\$&")).join("|"),M=new RegExp(`window\\.__stxComponentFactories\\[(${P})\\]\\(("[^"]+")\\);`,"g"),H=M.exec(e);while(H!==null){let O=i.get(JSON.parse(H[1]));if(O!==void 0)a.push({start:H.index,end:H.index+H[0].length,replacement:`(${O})(${H[2]});`});H=M.exec(e)}}let l=[...n].filter(([,P])=>P.instances>1);if(l.length===0)return ai(e,a);let b=`<script data-stx-scoped data-stx-run="always" data-stx-component-factories>
209
209
  (function() {
210
210
  const factories = window.__stxComponentFactories = window.__stxComponentFactories || {};
211
211
  ${l.map(([P,M])=>` try { factories[${JSON.stringify(P)}] = factories[${JSON.stringify(P)}] || ${M.body}; }
@@ -213,15 +213,15 @@ ${l.map(([P,M])=>` try { factories[${JSON.stringify(P)}] = factories[${JSON.str
213
213
  `)}
214
214
  })();
215
215
  </script>`,v,T=/<(?:template\b|script\b(?=[^>]*\bdata-stx-scoped\b))/iy;return y(e,(P,M)=>{if(v===void 0){if(T.lastIndex=M,T.test(P))v=M}return-1}),a.push({start:v??0,end:v??0,replacement:`${b}
216
- `}),_i(e,a)}function _i(e,t){if(t.length===0)return e;t.sort((l,c)=>l.start-c.start||l.end-c.end);let n=Array(t.length*2+1),i=0,a=0;for(let l of t)n[a++]=e.slice(i,l.start),n[a++]=l.replacement,i=l.end;return n[a]=e.slice(i),n.join("")}function $i(e){let t=Hn(e),n=new Map;if(t)for(let[i,a]of t)n.set(i,a.instances);return n}function Ei(e,t){let n=Hn(e);if(!n)return[];let i=[];for(let[a,l]of n){let c=l.instances-(t.get(a)??0);if(c>0)i.push({body:l.body,count:c})}return i}function Ri(e,t){for(let{body:n,count:i}of t)for(let a=0;a<i;a++)Rs(e,n)}function xe(e,t,n=2){let i=0,a=null;for(let l=t+n;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 b=0;while(e[l+b]==="}")b++;if(b>=n)return l}}return-1}import Ni from"fs";var Ti=0,Ts=new Map;function nl(){Ti=0,Ts.clear()}function qn(e,t){let n=Ti++,i=`<!--__STX_${e.toUpperCase()}_${n}__-->`;return Ts.set(i,{type:e,expression:t}),i}function rl(){let e={};for(let[t,n]of Ts)e[t]={type:n.type,expression:n.expression};return e}function sl(e,t){let n=e;for(let[i,a]of t)n=n.split(i).join(a);return n}function xi(e){return e.includes("<!--__STX_")}var Ya=/@(?=[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 Qa(e){return Array.from({length:e},()=>"&#123;").join("&#8288;")}function Ai(e){return e.replace(/\{{2,}/g,(t)=>Qa(t.length)).replace(/\{(?=!)/g,"&#123;&#8288;").replace(Ya,"&#64;")}function kr(e,t,n=!1){let{openTag:i,tail:a}=n?ec(e,t):tc(e).at(t);return sc(a,i,n)}function ec(e,t){let n="",i=0;for(let c=0;c<t;c++){if(!e.startsWith("{{",c))continue;let b=xe(e,c);if(b<0||b+2>t)break;n+=e.slice(i,c)+"x",c=b+1,i=b+2}n+=e.slice(i,t);let a=-1,l=null;for(let c=0;c<n.length;c++){let b=n[c];if(l){if(b===l)l=null;continue}if(b==='"'||b==="'"){l=b;continue}if(b===">"){a=-1;continue}if(b==="<")a=c}return{openTag:a,tail:a>=0?n.slice(a+1):n}}var Zn=null;function tc(e){if(Zn&&Zn.source===e)return Zn.scanner;let t=nc(e);return Zn={source:e,scanner:t},t}function nc(e){let t=0,n=-1,i=null,a=-1,l=(b,v)=>{let T=e[b];if(v.quote){if(T===v.quote)v.quote=null;return}if(v.openTag>=0){if(T==='"'||T==="'"){v.quote=T;return}if(T===">"){v.openTag=-1;return}}if(T==="<")v.openTag=b},c=(b,v)=>{if(v.openTag>=0||!e.startsWith("<!--",b))return-1;let T=e.indexOf("-->",b+4);return T<0?e.length:T+3};return{at(b){if(b<t)t=0,n=-1,i=null,a=-1;let v={openTag:n,quote:i},T=!1;while(t<b){if(a<0&&e.startsWith("{{",t)){let B=xe(e,t);if(B<0)a=t;else if(B+2<=b){t=B+2;continue}else break}let L=c(t,v);if(L>=0){if(L>b){T=!0;break}t=L;continue}l(t,v),t++}if(n=v.openTag,i=v.quote,T)return{openTag:-1,tail:""};let P=a>=0?a:t,M={openTag:n,quote:i};for(let L=t;L<b;L++){let B=c(L,M);if(B>=0){if(B>b)return{openTag:-1,tail:""};L=B-1;continue}l(L,M)}if(M.openTag<0)return{openTag:-1,tail:""};let H="",O=M.openTag+1;for(let L=O;L<Math.min(b,P);L++){if(!e.startsWith("{{",L))continue;let B=xe(e,L);H+=e.slice(O,L)+"x",L=B+1,O=B+2}return H+=e.slice(O,b),{openTag:M.openTag,tail:H}}}}function sc(e,t,n){if(t<0&&!n)return null;if(t>=0&&/^\s*[!/?]/.test(e))return/^\s*\/?\s*$/.test(e)?{kind:"tag-name"}:null;if(t>=0&&/^\s*$/.test(e))return{kind:"tag-name"};let i=0;if(t>=0)while(i<e.length&&!/\s/.test(e[i]))i++;while(i<e.length){while(/\s/.test(e[i]??"")&&i<e.length)i++;let a=i;while(i<e.length&&!/[\s=/>]/.test(e[i]))i++;let 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 b=++i,v=e.indexOf(c,i);if(v===-1)return{kind:"attribute",name:l,quote:c,valuePrefix:e.slice(b)};i=v+1}else{let b=i;while(i<e.length&&!/\s/.test(e[i]))i++;if(i===e.length)return{kind:"attribute",name:l,quote:null,valuePrefix:e.slice(b)}}}return{kind:"tag"}}class ie extends Error{attribute;near;constructor(e,t){super(`Unsafe interpolation in ${e}: ${t}`);this.name="UnsafeInterpolationContextError",this.attribute=e}locate(e,t){if(this.near===void 0)this.near=e.slice(Math.max(0,t-160),t).replace(/\s+/g," ").trim(),this.message+=` (after: ${JSON.stringify(this.near)})`;return this}}var Ii="unsafe:";var rc=/^(?:javascript|vbscript|livescript|mocha|view-source):/,ic=/^data:(?:text\/html|text\/xml|application\/xhtml\+xml|application\/xml|image\/svg\+xml)/,oc=/^data:(?:text\/html|application\/xhtml\+xml)/,ac=new RegExp("[\\u0000-\\u0020\\u00A0\\u1680\\u2000-\\u200F\\u2028\\u2029\\u202F\\u205F\\u3000\\uFEFF]+","g");function cc(e){return e.replace(ac,"").toLowerCase()}function As(e){let t=e.toLowerCase();if(new RegExp("^(?:href|xlink:href|action|formaction|ping|cite|manifest|data|to)$").test(t))return"navigable";if(new RegExp("^(?:src|srcset|poster|background)$").test(t))return"fetched";return null}function Kn(e,t="navigable"){let n=cc(e);if(rc.test(n))return!0;return t==="navigable"?ic.test(n):oc.test(n)}function Sr(e,t="navigable"){return Kn(e,t)?"unsafe:"+e:e}function lc(e){let t=e.match(/(?:^|[\s"'`/])([A-Za-z][\w:-]*)\s*=\s*(["'])([^"']*)$/);if(!t)return null;if(t[3].trim()!=="")return null;return As(t[1])}function Pi(e,t,n=256){if(t<=n)return e.slice(0,t);let i=e.slice(t-n,t),a=i.search(/[\s"'`/]/);return a===-1?"":i.slice(a)}function Di(e,t,n=t){let i=lc(e);return i&&Kn(t,i)?"unsafe:"+n:n}function It(e){let t=e.indexOf(" as ");if(t!==-1){let l=e.slice(0,t).trim(),c=e.slice(t+4).trim();return l&&c?{arrayExpr:l,itemVar:c}:null}let n=/^\s*(.+?)\s+in\s+([\s\S]+)$/.exec(e);if(!n)return null;let i=n[1].trim().replace(/^\(([\s\S]*)\)$/,"$1").trim(),a=n[2].trim();return i&&a?{arrayExpr:a,itemVar:i}:null}function Xn(e){let t=[],n=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==="{")n++;else if(c===")"||c==="]"||c==="}")n--;else if(c===","&&n===0)t.push(e.slice(a,l)),a=l+1}return t.push(e.slice(a)),t}function Mi(e,t){let n=0;for(let i=0;i<e.length;i++){let a=e[i];if(a==="("||a==="["||a==="{")n++;else if(a===")"||a==="]"||a==="}")n--;else if(a===t&&n===0)return i}return-1}function ji(e){let t=0;for(let n=0;n<e.length;n++){let i=e[n];if(i==="("||i==="["||i==="{")t++;else if((i===")"||i==="]"||i==="}")&&--t===0)return n}return-1}function $t(e,t){let n=e.trim().replace(/^\.\.\./,"").trim(),i=Mi(n,"=");if(i!==-1&&n[i+1]!==">")n=n.slice(0,i).trim();if(!n)return;if(n.startsWith("{")&&n.endsWith("}")){for(let a of Xn(n.slice(1,-1))){let l=a.trim();if(!l)continue;if(l.startsWith("...")){$t(l,t);continue}let c=Mi(l,":");$t(c===-1?l:l.slice(c+1),t)}return}if(n.startsWith("[")&&n.endsWith("]")){for(let a of Xn(n.slice(1,-1)))$t(a,t);return}if(/^[A-Z_$][\w$]*$/i.test(n))t.push(n)}function Y(e){let t=e.trim(),n=[],i=0;for(let l=0;l<t.length;l++){let c=t[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(t.slice(l)))continue;let v=t.slice(0,l).trim();if(v.startsWith("(")&&ji(v)===v.length-1)v=v.slice(1,-1);for(let T of Xn(v))$t(T,n);if(n.length>0)return n;break}}let a=/^[\s\S]+?\s+as\s+([\s\S]+)$/.exec(t);if(a){let l=a[1].trim();if(l.startsWith("(")&&ji(l)===l.length-1)l=l.slice(1,-1);let c=/^([\w$]+)\s*=>\s*([\s\S]+)$/.exec(l);if(c)$t(c[2],n),$t(c[1],n);else for(let b of Xn(l))$t(b,n)}return n}function N(e,t){let n=t instanceof Set?t:new Set(t);if(n.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 b of c.match(/[a-zA-Z_$][\w$]*/g)||[])if(n.has(b))return!0;return!1}var Jn="__stx_client_loop_names";function st(e){let t=e?.[Jn];return Array.isArray(t)?t:[]}function Gn(e){if(!e.includes("#")&&!e.includes("v-slot:")&&!e.includes("data-stx-slot-binding"))return[];let t=[],n=[],i=/<!--[\s\S]*?-->|<script\b(?:"[^"]*"|'[^']*'|[^'">])*>[\s\S]*?<\/script\s*>|<style\b(?:"[^"]*"|'[^']*'|[^'">])*>[\s\S]*?<\/style\s*>|<\/?[a-z][\w:-]*\b(?:"[^"]*"|'[^']*'|[^'">])*>/gi;for(let a of e.matchAll(i)){let l=a[0];if(/^<\/template\s*>$/i.test(l)){let c=n.pop();if(c)c.end=a.index}else if(/^<template\b/i.test(l)&&!/\/\s*>$/.test(l)){let b=[...l.slice(9).matchAll(/([^\s=/>]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+)))?/g)].find((P)=>/^(?:#[\w-]+|v-slot:[\w-]+|data-stx-slot-binding)$/i.test(P[1])),v=(b?.[2]??b?.[3])?.trim();if(v&&b?.[1]==="data-stx-slot-binding")try{v=decodeURIComponent(v)}catch{v=void 0}let T=v?{start:a.index+l.length,end:e.length,binding:v}:void 0;if(n.push(T),T)t.push(T)}}return t}var nn={},Li=new Map;function uc(e){let t=Li.get(e);if(!t){let n=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");t=new RegExp(`:${n}(?!\\w)`,"g"),Li.set(e,t)}return t.lastIndex=0,t}var qs={uppercase:(e,t)=>e!==void 0&&e!==null?String(e).toUpperCase():"",lowercase:(e,t)=>e!==void 0&&e!==null?String(e).toLowerCase():"",capitalize:(e,t)=>{if(e===void 0||e===null)return"";let n=String(e);return n.charAt(0).toUpperCase()+n.slice(1)},number:(e,t,n=0)=>{if(e===void 0||e===null)return"";try{let i=Number(e);return Number.isNaN(i)?"":i.toFixed(Number.parseInt(String(n),10))}catch{return""}},fmt:(e,t,n="en-US")=>{if(e===void 0||e===null)return"";try{let i=Number(e);if(Number.isNaN(i))return String(e);return i.toLocaleString(n)}catch{return String(e)}},join:(e,t,n=",")=>{if(!Array.isArray(e))return"";return e.join(String(n))},escape:(e,t)=>{if(e===void 0||e===null)return"";return W(String(e))},translate:(e,t,n={})=>{if(!t||!t.__translations)return e;let i=t.__translations,a=t.__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 b=String(c);return Object.entries(n).forEach(([v,T])=>{b=b.replace(uc(v),()=>String(T))}),b},t:(e,t,n={})=>qs.translate(e,t,n),truncate:(e,t,n=50,i="...")=>{if(e===void 0||e===null)return"";let a=String(e);if(a.length<=n)return a;if(n<=i.length)return i.substring(0,n);return a.substring(0,n-i.length)+i},date:(e,t,n="short",i="en-US")=>{if(e===void 0||e===null)return"";try{let a=e instanceof Date?e:new Date(e);if(Number.isNaN(a.getTime()))return String(e);let l={short:{dateStyle:"short"},medium:{dateStyle:"medium"},long:{dateStyle:"long"},full:{dateStyle:"full"},time:{timeStyle:"short"},datetime:{dateStyle:"short",timeStyle:"short"},iso:{}};if(n==="iso")return a.toISOString();return new Intl.DateTimeFormat(i,l[n]||l.short).format(a)}catch{return String(e)}},currency:(e,t,n="USD",i="en-US")=>{if(e===void 0||e===null)return"";try{let a=Number(e);if(Number.isNaN(a))return String(e);return new Intl.NumberFormat(i,{style:"currency",currency:n}).format(a)}catch{return String(e)}},pluralize:(e,t,n,i)=>{let a=Number(e);if(Number.isNaN(a))return n;let l=i||`${n}s`;return a===1?n:l},first:(e,t)=>{if(e===void 0||e===null)return"";if(Array.isArray(e))return e.length===0?"":e[0];return String(e).charAt(0)},last:(e,t)=>{if(e===void 0||e===null)return"";if(Array.isArray(e))return e.length===0?"":e[e.length-1];let n=String(e);return n.charAt(n.length-1)},length:(e,t)=>{if(e===void 0||e===null)return 0;if(Array.isArray(e)||typeof e==="string")return e.length;if(e instanceof Map||e instanceof Set)return e.size;if(typeof e==="object")return Object.keys(e).length;return 0},json:(e,t,n=!1)=>{if(e===void 0)return"undefined";if(e===null)return"null";try{return n?JSON.stringify(e,null,2):JSON.stringify(e)}catch{return String(e)}},default:(e,t,n="")=>e===void 0||e===null||e===""?n:e,reverse:(e,t)=>{if(e===void 0||e===null)return"";if(Array.isArray(e))return[...e].reverse();return String(e).split("").reverse().join("")},slice:(e,t,n=0,i)=>{if(e===void 0||e===null)return"";if(Array.isArray(e)||typeof e==="string")return e.slice(n,i);return e},replace:(e,t,n,i="")=>{if(e===void 0||e===null)return"";let a=n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return String(e).replace(new RegExp(a,"g"),()=>i)},stripTags:(e,t)=>{if(e===void 0||e===null)return"";return String(e).replace(/<[^>]*>/g,"")},urlencode:(e,t)=>{if(e===void 0||e===null)return"";return encodeURIComponent(String(e))},abs:(e,t)=>{let n=Number(e);return Number.isNaN(n)?0:Math.abs(n)},round:(e,t,n=0)=>{let i=Number(e);if(Number.isNaN(i))return 0;let a=10**n;return Math.round(i*a)/a}};function vg(e,t){if(e in qs)console.warn(`Filter "${e}" already exists as a built-in filter. Custom filter will take precedence.`);nn[e]=t}function ny(e){for(let[t,n]of Object.entries(e))vg(t,n)}function xg(){return{...qs,...nn}}function ry(){for(let e of Object.keys(nn))delete nn[e]}function Ui(e){let t=e.next();while(!t.done)t=e.next();return t.value}function*Hi(e,t,n,i){let a="{".repeat(n);if(!e.includes(a))return e;let l="",c=0,b=0,v=i===Number.POSITIVE_INFINITY?0:performance.now();for(;;){let T=e.indexOf(a,c);if(T===-1)break;let P=xe(e,T,n);if(P===-1)break;if(l+=e.slice(c,T)+t(e.slice(T,P+n),e.slice(T+n,P),T),c=P+n,++b>=64){b=0;let M=performance.now();if(M-v>=i)v=M,yield}}return c===0?e:l+e.slice(c)}function xn(e,t,n=2){return Ui(Hi(e,t,n,Number.POSITIVE_INFINITY))}function fc(e,t,n){let i=n[0];if(i!=="'"&&i!=='"'&&i!=="`")return!1;let a=kr(e,t);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 W(e){return Ai(p(e))}function pc(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 dc(e){return e.replace(/\/\*[\s\S]*?\*\//g,"").replace(/\\([\dA-Fa-f]{1,6})\s?/g,(t,n)=>String.fromCodePoint(Number.parseInt(n,16))).replace(/\\([^\r\n])/g,"$1").replace(/[\u0000-\u0020]+/g,"").toLowerCase()}function gc(e,t){let n=dc(e);if(/@import|expression\(|behavior:|-moz-binding|(?:image-set|cross-fade)\(/.test(n))throw new ie(t,"network-capable or executable CSS is not allowed in an escaped interpolation");let i=/url\(([^)]*)\)/g,a;while((a=i.exec(n))!==null){let l=a[1].replace(/^["']|["']$/g,""),c=l.startsWith("/")&&!l.startsWith("//")||l.startsWith("./")||l.startsWith("../")||l.startsWith("#"),b=/^data:image\/(?:avif|bmp|gif|jpeg|jpg|png|webp);base64,[a-z\d+/=]+$/i.test(l);if(!c&&!b)throw new ie(t,"CSS URLs must be local paths or base64 raster images")}}function Q(e,t,n,i=!1,a=0){try{return mc(e,t,n,i,a)}catch(l){if(l instanceof ie)l.locate(e,t);throw l}}function mc(e,t,n,i,a){let l=kr(e,t,i),c=W(n);if(!l)return c;if(l.kind==="tag-name"){if(!/^[A-Za-z][A-Za-z0-9:-]*$/.test(n))throw new ie("tag name","dynamic tag names may contain only letters, digits, colons, and hyphens");return n}if(l.kind==="tag"){let T=e.slice(t+a).trimStart(),P=n.trim();if(!T.startsWith("=")&&(P===""||P.split(/\s+/).every((M)=>/^(?!on)[A-Za-z_:][\w:.-]*$/.test(M))))return P;throw new ie("tag structure","only standalone boolean attributes may be interpolated into tag structure")}let b=l.name.toLowerCase();if(/^on[a-z]/.test(b))throw new ie(l.name,"native event-handler attributes execute JavaScript; use an @event binding instead");if(b==="srcdoc")c=W(c);if(b==="style")gc(n,l.name);if(l.quote===null)c=pc(c);let v=As(b);if(v&&l.valuePrefix.trim()===""&&Kn(n,v))return Ii+c;return Di(Pi(e,t),n,c)}function Sn(e,t){let n=` ${e}="`;return Q(n,n.length,t,!0)}function qi(e){return e.flatMap((t)=>{let n=t.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i);return!n||/\bserver\b|\bsrc\s*=/.test(n[1])?[]:[n[2]]})}function ke(e,t){let{scripts:n}=J(e);for(let i of qi(n)){if(/\b(state|derived|effect|ref|reactive|computed|watch|watchEffect|useModel)\s*(?:<[^>]*>)?\s*\(/.test(i)||el.test(i))return!0;if(Dr(i,t))return!0}if(/@(if|for|show)\s*=\s*["'][^"']*\(\s*\)/.test(e))return!0;if(/@for\s*=\s*["'][^"']*\s+(?:in|of)\s+[^"']*\(\s*\)/.test(e))return!0;if(/(?:^|[\s"'])(?::|x-)(?:for|if|else-if|else|show|text|html|model|bind)\b/.test(e))return!0;return!1}function Sg(e){let t=[],n=/<([a-zA-Z][\w-]*)\b[^>]*?\s(?::for|x-for|@for)\s*=\s*(["'])([\s\S]*?)\2[^>]*>/g;for(let i=n.exec(e);i;i=n.exec(e)){let a=i[1].toLowerCase(),l=new Set(Y(i[3]));if(l.size===0)continue;let c=i.index+i[0].length;if(i[0].endsWith("/>")){t.push({start:i.index,end:c,names:l});continue}let b=new RegExp(`<(/?)${a}\\b[^>]*?(/?)>`,"gi");b.lastIndex=c;let v=1,T=e.length;for(let P=b.exec(e);P;P=b.exec(e)){if(P[2]==="/")continue;if(v+=P[1]==="/"?-1:1,v===0){T=P.index+P[0].length;break}}t.push({start:i.index,end:T,names:l})}return t}function zi(e,t,n){let i=s(n);for(let a of e){if(t<a.start||t>=a.end)continue;for(let l of a.names)if(new RegExp(`(?<![.#\\w$])${l.replace(/\$/g,"\\$")}(?![\\w$])`).test(i))return!0}return!1}function Bi(e,t){let n=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","URL","URLSearchParams","Intl","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined","NaN","Infinity","isNaN","isFinite","window","document","console","new","typeof","instanceof","in","void"],i=e.replace(/'[^']*'/g,"").replace(/"[^"]*"/g,""),a="",l=!1,c=0;for(let T=0;T<i.length;T++){let P=i[T];if(!l&&P==="`"){l=!0,c=0;continue}if(l){if(P==="`"&&c===0){l=!1;continue}if(P==="$"&&i[T+1]==="{"){c++,T++,a+=" ";continue}if(P==="}"&&c>0){c--;continue}if(c>0){a+=P;continue}continue}a+=P}i=a;let b=/(?<![a-zA-Z0-9_$])([a-zA-Z_$][a-zA-Z0-9_$]*)/g,v;while((v=b.exec(i))!==null){let T=v[1];if(!i.substring(0,v.index).trimEnd().endsWith(".")){if(!n.includes(T)&&!(T in t))return!1}}return!0}function hc(e,t){let n=s(e);for(let i of n.matchAll(/(?<![.\w$])([A-Z_$][\w$]*)\s*\(/gi))if(typeof t[i[1]]==="function")return!0;return!1}function xc(e,t){let n=t.__stx_serverDeclared;if(!n||n.size===0)return!1;let i=s(e);for(let a of n)if(new RegExp(`(?<![.#\\w$])${a}(?![\\w$])`).test(i))return!0;return!1}var Wi=new Set;function Fi(e){return/^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*)*$/.test(e.trim())}function bc(e,t,n){let i=n[0];if(i!=="'"&&i!=='"'&&i!=="`")return!1;let a=0;for(let l=e.lastIndexOf(`
217
- `,t-1)+1;l<t;l++)if(e[l]==="\\")l++;else if(e[l]===i)a++;return a%2===1}function Vi(e,t){let n=`${t??"<unknown>"}\x00${e}`;if(process.env.STX_DEBUG||!Wi.has(n))Wi.add(n),console.warn(`[stx] {{ ${e} }} in a <script> in ${t??"<unknown>"} has no server value, so it was emitted as undefined. A mustache left in JavaScript is a SyntaxError that takes the whole script down, so give the value a default in <script server>.`);return"undefined"}function Si(e,t,n){let i=e;return i=i.replace(/\{!!([\s\S]*?)!!\}/g,(a,l)=>{try{let c=A(l,t);if(c===void 0)return Fi(l)?Vi(l.trim(),n):a;return c===null?"":String(c)}catch{return a}}),i=xn(i,(a,l,c)=>{let b=l.trim();if(bc(i,c,l))return a;if(/^__[A-Z_]+__$/.test(b))return a;try{let v=A(l,t);if(v===void 0)return Fi(b)?Vi(b,n):a;return JSON.stringify(v).replace(/</g,"\\u003c").replace(/@/g,"\\u0040").replace(/\{{2,}/g,(T)=>"\\u007b".repeat(T.length)).replace(/\{(?=!)/g,"\\u007b")}catch{return a}}),i}function kg(e,t){if(!e.includes("{"))return e;let n=e;return n=n.replace(/\{!!([\s\S]*?)!!\}/g,(i,a)=>{try{let l=A(a,t);if(l===void 0)return i;return l===null?"":String(l)}catch{return i}}),n=xn(n,(i,a,l)=>{let c=a.trim();if(/^__[A-Z_]+__$/.test(c))return i;try{let b=A(a,t);if(b===void 0)return i;if(b===null)return"";let v=String(b);return Q(n,l,v,!0,i.length)}catch(b){if(b instanceof ie)throw b;return i}}),n}function sy(e,t,n={}){let{output:i,scripts:a}=J(e),l=a.map((c)=>{let b=c.match(/^<script\b((?:[^>\"']|\"[^\"]*\"|'[^']*')*)>/i),v=c.search(/<\/script\s*>$/i);if(!b||v===-1)return c;let T=b[1],P=c.slice(b[0].length,v);if(/\bdata-raw\b/.test(T))return c;if(n.skipServer&&/\bserver\b/.test(T))return c;let H=`<script${kg(T,t)}>`;if(/\bsrc\s*=/.test(T)||/\btype\s*=\s*["']application\/json["']/.test(T))return H+P+c.slice(v);return H+Si(P,t)+c.slice(v)});return xr(i,l)}function*Zi(e,t,n,i){let a=e,l=(B,F)=>{let ee=gn(B,F);if(ee===-1)return-1;return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(B.slice(F,ee))?-1:ee},c=(B,F,ee,G)=>{let j=ee.length,{output:te,tokens:se}=fe(B,F,(ne,ue)=>G(j+ue));return ee.push(...se),te},b=[];a=c(a,l,b,(B)=>`<!--__STX_STYLE_${B}__-->`);let v=[];a=c(a,q,v,(B)=>`<!--__STX_SCRIPT_EXPR_${B}__-->`);let T=t?.__stx_signals_gate===!0||ke(e),P=new Set([...Array.isArray(t?.__stx_client_signal_names)?t.__stx_client_signal_names:[],...vi(qi(v))]),M=new Set(Array.isArray(t?.__stx_preserved_client_expressions)?t.__stx_preserved_client_expressions:[]);a=xn(a,(B,F,ee)=>{if(N(F,P))return B;try{let G=A(F,t,!1,(j)=>Is(j,B,n,e));return G!==void 0&&G!==null?String(G):""}catch(G){let j=G instanceof Error?G.message:String(G);return h("Expression",`Error evaluating: {{{ ${F.trim()}}}}: ${j}`,n,e,ee,B)}},3),a=a.replace(/\{!!([\s\S]*?)!!\}/g,(B,F,ee)=>{if(N(F,P))return B;try{let G=A(F,t,!1,(j)=>Is(j,B,n,e));if(G===void 0&&t.__stx_buildMode==="compile")return qn("raw",F.trim());return G!==void 0&&G!==null?String(G):""}catch(G){if(t.__stx_buildMode==="compile")return qn("raw",F.trim());let j=G instanceof Error?G.message:String(G);return h("Expression",`Error evaluating: {!! ${F.trim()} !!}: ${j}`,n,e,ee,B)}}),a=c(a,q,v,(B)=>`<!--__STX_SCRIPT_EXPR_${B}__-->`),a=c(a,l,b,(B)=>`<!--__STX_STYLE_${B}__-->`);let H=T?Sg(a):[],O=Gn(a).map((B)=>({...B,names:new Set(Y(`${B.binding} in __slot`))})),L=new Set(st(t));if(a=yield*Hi(a,(B,F,ee)=>{let G=F.trim();if(fc(a,ee,F))return B;if(zi(O,ee,G))return B;if(N(G,L))return B;if(H.length>0&&zi(H,ee,G))return B;if(M.has(G))return B;let j=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined"],te=/^([a-zA-Z_$][a-zA-Z0-9_$]*)/,ne=G.match(te)?.[1],ue=ne&&((ne in t)||j.includes(ne)),ye=/^([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/,de=G.match(ye),Ae=de&&!j.includes(de[1])&&!(de[1]in t);if(/^__[A-Z_]+__$/.test(G))return"";if(N(G,P))return B;if(t.__stx_native_screen===!0&&hc(G,t))return B;let Ze;try{let Re=A(F,t,!1,(Ye)=>{Ze=Ye});if(T&&!Bi(G,t))return B;if(Ze)Is(Ze,B,n,e);if(t.__stx_buildMode==="compile"&&!T&&(Re===void 0||xc(G,t)))return qn("expr",G);if(Re===void 0||Re===null)return"";let Ke=String(Re);return Q(a,ee,Ke,!1,B.length)}catch(Re){if(Re instanceof ie)throw Re;if(T&&!Bi(G,t))return B;if(Ae)return B;let Ke=Re instanceof Error?Re.message:String(Re);return h("Expression",`Error evaluating: {{ ${G} }}: ${Ke}`,n,e,ee,B)}},2,i),v.length>0)a=a.replace(/<!--__STX_SCRIPT_EXPR_(\d+)__-->/g,(B,F)=>v[Number(F)]??B);if(b.length>0)a=a.replace(/<!--__STX_STYLE_(\d+)__-->/g,(B,F)=>b[Number(F)]??B);return a}function E(e,t,n){return Ui(Zi(e,t,n,Number.POSITIVE_INFINITY))}var yc=100;async function ki(e,t,n,i=yc){let a=Zi(e,t,n,i),l=a.next();while(!l.done)await _(),l=a.next();return l.value}function _g(e,t,n){if(!t.trim())return e;let i=e,a=t.trim();while(a.length>0){let l=a.match(/^(\w+)/);if(!l)break;let c=l[1];a=a.substring(c.length).trim();let b=nn[c]||qs[c];if(!b)throw Error(`Filter not found: ${c}. Available filters: ${Object.keys(xg()).join(", ")}`);let v=[];if(a.startsWith(":")){let T=a.match(/^:([^|\s]+)/);if(T){let P=T[1].trim();try{let M=Number(P);v=[Number.isNaN(M)?P:M]}catch{v=[P]}a=a.substring(T[0].length).trim()}}else if(a.startsWith("(")){let T=1,P=1;while(T>0&&P<a.length){if(a[P]==="(")T++;if(a[P]===")")T--;P++}if(T===0){let M=a.substring(1,P-1).trim();if(M)try{if(M.startsWith("{")&&M.endsWith("}"))v=[A(`(${M})`,n,!0)];else{let H=[],O="",L=null,B=0,F=0,ee=0,G=!1;for(let j=0;j<M.length;j++){let te=M[j];if(G){O+=te,G=!1;continue}if(te==="\\"){O+=te,G=!0;continue}if(L){if(O+=te,te===L)L=null;continue}if(te==='"'||te==="'"||te==="`"){L=te,O+=te;continue}if(te==="(")B++;else if(te===")")B--;else if(te==="[")F++;else if(te==="]")F--;else if(te==="{")ee++;else if(te==="}")ee--;if(te===","&&B===0&&F===0&&ee===0){H.push(O),O="";continue}O+=te}if(O)H.push(O);v=H.map((j)=>{let te=j.trim();return A(te,n,!0)})}}catch{v=[M]}a=a.substring(P).trim()}}try{i=b(i,n,...v)}catch(T){let P=T instanceof Error?T.message:String(T);throw Error(`Error applying filter '${c}': ${P}`)}if(a.startsWith("|"))a=a.substring(1).trim();else break}return i}function _c(e){let t=!1,n="",i=0,a=0,l=0,c=!1;for(let b=0;b<e.length;b++){let v=e[b],T=e[b+1];if(t&&c){c=!1;continue}if(t&&v==="\\"){c=!0;continue}if(c=!1,(v==='"'||v==="'"||v==="`")&&!c){if(!t)t=!0,n=v;else if(v===n)t=!1,n="";continue}if(t&&n==="`"&&v==="$"&&T==="{"){let P=1;b+=2;while(b<e.length&&P>0){if(e[b]==="{")P++;else if(e[b]==="}")P--;if(P>0)b++}continue}if(t)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(T==="|"){b++;continue}if(T==="="){b++;continue}return b}}return-1}var tn=new Set,wc=1000;function oy(){tn.clear()}function Is(e,t,n,i){if(!X())return;let a=`${n}\x00${e.expression}`;if(tn.has(a))return;if(tn.size>=wc)tn.clear();tn.add(a);let l=n,c=i;try{if(n&&Ni.existsSync(n))c=Ni.readFileSync(n,"utf8")}catch{}let b=c.indexOf(t);if(b>=0)l=`${n}:${c.slice(0,b).split(`
218
- `).length}`;console.warn(`${l}: stx warning: ${t} rendered as an empty string. The safe evaluator rejected \`${e.expression}\` (${e.rule}). Compute the value in <script server> and interpolate the variable instead.`)}function A(e,t,n=!1,i){try{let a=e.trim(),l=_c(a);if(l>0){let b=a.substring(0,l).trim(),v=a.substring(l+1).trim(),T=A(b,t,!0,i);return _g(T,v,t)}let c=Xs(a);if(c!==null){i?.({expression:a,rule:c});return}try{let b=Object.keys(t),v=Object.values(t);return d(a,b)(...v)}catch{return u(a,t)}}catch(a){if(a instanceof ReferenceError){let l=/(\b\w+)\s+is not defined/.exec(a.message);if(l){let c=l[1],b=Sc(c,Object.keys(t));if(b&&b!==c)a.message=`${a.message} \u2014 did you mean '${b}'?`}}if(!n)console.error(`Error evaluating expression: ${e}`,a);throw a}}function Sc(e,t){let n=null;for(let a of t){if(a===e)continue;let l=$c(e,a);if(n===null||l<n.dist)n={key:a,dist:l}}if(!n)return null;let i=Math.max(e.length,n.key.length);if(n.dist<=2||n.dist/i<=0.35)return n.key;return null}function $c(e,t){if(e===t)return 0;if(e.length===0)return t.length;if(t.length===0)return e.length;let[n,i]=e.length<t.length?[e,t]:[t,e],a=Array(n.length+1),l=Array(n.length+1);for(let c=0;c<=n.length;c++)a[c]=c;for(let c=1;c<=i.length;c++){l[0]=c;for(let b=1;b<=n.length;b++){let v=n[b-1]===i[c-1]?0:1;l[b]=Math.min(l[b-1]+1,a[b]+1,a[b-1]+v)}for(let b=0;b<=n.length;b++)a[b]=l[b]}return a[n.length]}function iy(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 vc from"process";function C(e="STX_PUBLIC_"){let t={},n={};for(let[i,a]of Object.entries(vc.env)){if(!i.startsWith(e)||a===void 0)continue;t[`import.meta.env.${i}`]=JSON.stringify(a),n[i]=a}return t["import.meta.env"]=JSON.stringify(n),t}function Ki(e,t=""){let n=`${e}${t}`,i=0;for(let a=0;a<n.length;a++){let l=n.charCodeAt(a);i=(i<<5)-i+l,i=i&i}return`stx-${Math.abs(i).toString(36)}`}function Xi(e,t,n={}){let{prefix:i="",preserveHost:a=!0,scopeKeyframes:l=!0,scopeCustomProperties:c=!1}=n;if(!e.trim())return"";let b=Ps(e),v=[],T=new Map;if(l)for(let P of b){let M=P.selector.match(/@keyframes\s+([a-z_-][a-z0-9_-]*)/i);if(M){let H=M[1],O=`${t}_${H}`;T.set(H,O)}}for(let P of b){let M=Ji(P,t,i,a,T,c);v.push(M)}return v.join(`
216
+ `}),ai(e,a)}function ai(e,t){if(t.length===0)return e;t.sort((l,c)=>l.start-c.start||l.end-c.end);let n=Array(t.length*2+1),i=0,a=0;for(let l of t)n[a++]=e.slice(i,l.start),n[a++]=l.replacement,i=l.end;return n[a]=e.slice(i),n.join("")}function ci(e){let t=Hn(e),n=new Map;if(t)for(let[i,a]of t)n.set(i,a.instances);return n}function $i(e,t){let n=Hn(e);if(!n)return[];let i=[];for(let[a,l]of n){let c=l.instances-(t.get(a)??0);if(c>0)i.push({body:l.body,count:c})}return i}function Ci(e,t){for(let{body:n,count:i}of t)for(let a=0;a<i;a++)Rs(e,n)}function xe(e,t,n=2){let i=0,a=null;for(let l=t+n;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 b=0;while(e[l+b]==="}")b++;if(b>=n)return l}}return-1}import Mi from"fs";var Ri=0,Ts=new Map;function rl(){Ri=0,Ts.clear()}function qn(e,t){let n=Ri++,i=`<!--__STX_${e.toUpperCase()}_${n}__-->`;return Ts.set(i,{type:e,expression:t}),i}function sl(){let e={};for(let[t,n]of Ts)e[t]={type:n.type,expression:n.expression};return e}function ol(e,t){let n=e;for(let[i,a]of t)n=n.split(i).join(a);return n}function Si(e){return e.includes("<!--__STX_")}var Ya=/@(?=[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 Qa(e){return Array.from({length:e},()=>"&#123;").join("&#8288;")}function Ti(e){return e.replace(/\{{2,}/g,(t)=>Qa(t.length)).replace(/\{(?=!)/g,"&#123;&#8288;").replace(Ya,"&#64;")}function _r(e,t,n=!1){let{openTag:i,tail:a}=n?ec(e,t):tc(e).at(t);return sc(a,i,n)}function ec(e,t){let n="",i=0;for(let c=0;c<t;c++){if(!e.startsWith("{{",c))continue;let b=xe(e,c);if(b<0||b+2>t)break;n+=e.slice(i,c)+"x",c=b+1,i=b+2}n+=e.slice(i,t);let a=-1,l=null;for(let c=0;c<n.length;c++){let b=n[c];if(l){if(b===l)l=null;continue}if(b==='"'||b==="'"){l=b;continue}if(b===">"){a=-1;continue}if(b==="<")a=c}return{openTag:a,tail:a>=0?n.slice(a+1):n}}var Zn=null;function tc(e){if(Zn&&Zn.source===e)return Zn.scanner;let t=nc(e);return Zn={source:e,scanner:t},t}function nc(e){let t=0,n=-1,i=null,a=-1,l=(b,v)=>{let T=e[b];if(v.quote){if(T===v.quote)v.quote=null;return}if(v.openTag>=0){if(T==='"'||T==="'"){v.quote=T;return}if(T===">"){v.openTag=-1;return}}if(T==="<")v.openTag=b},c=(b,v)=>{if(v.openTag>=0||!e.startsWith("<!--",b))return-1;let T=e.indexOf("-->",b+4);return T<0?e.length:T+3};return{at(b){if(b<t)t=0,n=-1,i=null,a=-1;let v={openTag:n,quote:i},T=!1;while(t<b){if(a<0&&e.startsWith("{{",t)){let B=xe(e,t);if(B<0)a=t;else if(B+2<=b){t=B+2;continue}else break}let L=c(t,v);if(L>=0){if(L>b){T=!0;break}t=L;continue}l(t,v),t++}if(n=v.openTag,i=v.quote,T)return{openTag:-1,tail:""};let P=a>=0?a:t,M={openTag:n,quote:i};for(let L=t;L<b;L++){let B=c(L,M);if(B>=0){if(B>b)return{openTag:-1,tail:""};L=B-1;continue}l(L,M)}if(M.openTag<0)return{openTag:-1,tail:""};let H="",O=M.openTag+1;for(let L=O;L<Math.min(b,P);L++){if(!e.startsWith("{{",L))continue;let B=xe(e,L);H+=e.slice(O,L)+"x",L=B+1,O=B+2}return H+=e.slice(O,b),{openTag:M.openTag,tail:H}}}}function sc(e,t,n){if(t<0&&!n)return null;if(t>=0&&/^\s*[!/?]/.test(e))return/^\s*\/?\s*$/.test(e)?{kind:"tag-name"}:null;if(t>=0&&/^\s*$/.test(e))return{kind:"tag-name"};let i=0;if(t>=0)while(i<e.length&&!/\s/.test(e[i]))i++;while(i<e.length){while(/\s/.test(e[i]??"")&&i<e.length)i++;let a=i;while(i<e.length&&!/[\s=/>]/.test(e[i]))i++;let 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 b=++i,v=e.indexOf(c,i);if(v===-1)return{kind:"attribute",name:l,quote:c,valuePrefix:e.slice(b)};i=v+1}else{let b=i;while(i<e.length&&!/\s/.test(e[i]))i++;if(i===e.length)return{kind:"attribute",name:l,quote:null,valuePrefix:e.slice(b)}}}return{kind:"tag"}}class ie extends Error{attribute;near;constructor(e,t){super(`Unsafe interpolation in ${e}: ${t}`);this.name="UnsafeInterpolationContextError",this.attribute=e}locate(e,t){if(this.near===void 0)this.near=e.slice(Math.max(0,t-160),t).replace(/\s+/g," ").trim(),this.message+=` (after: ${JSON.stringify(this.near)})`;return this}}var Ai="unsafe:";var rc=/^(?:javascript|vbscript|livescript|mocha|view-source):/,ic=/^data:(?:text\/html|text\/xml|application\/xhtml\+xml|application\/xml|image\/svg\+xml)/,oc=/^data:(?:text\/html|application\/xhtml\+xml)/,ac=new RegExp("[\\u0000-\\u0020\\u00A0\\u1680\\u2000-\\u200F\\u2028\\u2029\\u202F\\u205F\\u3000\\uFEFF]+","g");function cc(e){return e.replace(ac,"").toLowerCase()}function As(e){let t=e.toLowerCase();if(new RegExp("^(?:href|xlink:href|action|formaction|ping|cite|manifest|data|to)$").test(t))return"navigable";if(new RegExp("^(?:src|srcset|poster|background)$").test(t))return"fetched";return null}function Kn(e,t="navigable"){let n=cc(e);if(rc.test(n))return!0;return t==="navigable"?ic.test(n):oc.test(n)}function kr(e,t="navigable"){return Kn(e,t)?"unsafe:"+e:e}function lc(e){let t=e.match(/(?:^|[\s"'`/])([A-Za-z][\w:-]*)\s*=\s*(["'])([^"']*)$/);if(!t)return null;if(t[3].trim()!=="")return null;return As(t[1])}function Ii(e,t,n=256){if(t<=n)return e.slice(0,t);let i=e.slice(t-n,t),a=i.search(/[\s"'`/]/);return a===-1?"":i.slice(a)}function Pi(e,t,n=t){let i=lc(e);return i&&Kn(t,i)?"unsafe:"+n:n}function It(e){let t=e.indexOf(" as ");if(t!==-1){let l=e.slice(0,t).trim(),c=e.slice(t+4).trim();return l&&c?{arrayExpr:l,itemVar:c}:null}let n=/^\s*(.+?)\s+in\s+([\s\S]+)$/.exec(e);if(!n)return null;let i=n[1].trim().replace(/^\(([\s\S]*)\)$/,"$1").trim(),a=n[2].trim();return i&&a?{arrayExpr:a,itemVar:i}:null}function Xn(e){let t=[],n=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==="{")n++;else if(c===")"||c==="]"||c==="}")n--;else if(c===","&&n===0)t.push(e.slice(a,l)),a=l+1}return t.push(e.slice(a)),t}function Oi(e,t){let n=0;for(let i=0;i<e.length;i++){let a=e[i];if(a==="("||a==="["||a==="{")n++;else if(a===")"||a==="]"||a==="}")n--;else if(a===t&&n===0)return i}return-1}function Di(e){let t=0;for(let n=0;n<e.length;n++){let i=e[n];if(i==="("||i==="["||i==="{")t++;else if((i===")"||i==="]"||i==="}")&&--t===0)return n}return-1}function $t(e,t){let n=e.trim().replace(/^\.\.\./,"").trim(),i=Oi(n,"=");if(i!==-1&&n[i+1]!==">")n=n.slice(0,i).trim();if(!n)return;if(n.startsWith("{")&&n.endsWith("}")){for(let a of Xn(n.slice(1,-1))){let l=a.trim();if(!l)continue;if(l.startsWith("...")){$t(l,t);continue}let c=Oi(l,":");$t(c===-1?l:l.slice(c+1),t)}return}if(n.startsWith("[")&&n.endsWith("]")){for(let a of Xn(n.slice(1,-1)))$t(a,t);return}if(/^[A-Z_$][\w$]*$/i.test(n))t.push(n)}function Y(e){let t=e.trim(),n=[],i=0;for(let l=0;l<t.length;l++){let c=t[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(t.slice(l)))continue;let v=t.slice(0,l).trim();if(v.startsWith("(")&&Di(v)===v.length-1)v=v.slice(1,-1);for(let T of Xn(v))$t(T,n);if(n.length>0)return n;break}}let a=/^[\s\S]+?\s+as\s+([\s\S]+)$/.exec(t);if(a){let l=a[1].trim();if(l.startsWith("(")&&Di(l)===l.length-1)l=l.slice(1,-1);let c=/^([\w$]+)\s*=>\s*([\s\S]+)$/.exec(l);if(c)$t(c[2],n),$t(c[1],n);else for(let b of Xn(l))$t(b,n)}return n}function N(e,t){let n=t instanceof Set?t:new Set(t);if(n.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 b of c.match(/[a-zA-Z_$][\w$]*/g)||[])if(n.has(b))return!0;return!1}var Jn="__stx_client_loop_names";function st(e){let t=e?.[Jn];return Array.isArray(t)?t:[]}function Gn(e){if(!e.includes("#")&&!e.includes("v-slot:")&&!e.includes("data-stx-slot-binding"))return[];let t=[],n=[],i=/<!--[\s\S]*?-->|<script\b(?:"[^"]*"|'[^']*'|[^'">])*>[\s\S]*?<\/script\s*>|<style\b(?:"[^"]*"|'[^']*'|[^'">])*>[\s\S]*?<\/style\s*>|<\/?[a-z][\w:-]*\b(?:"[^"]*"|'[^']*'|[^'">])*>/gi;for(let a of e.matchAll(i)){let l=a[0];if(/^<\/template\s*>$/i.test(l)){let c=n.pop();if(c)c.end=a.index}else if(/^<template\b/i.test(l)&&!/\/\s*>$/.test(l)){let b=[...l.slice(9).matchAll(/([^\s=/>]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+)))?/g)].find((P)=>/^(?:#[\w-]+|v-slot:[\w-]+|data-stx-slot-binding)$/i.test(P[1])),v=(b?.[2]??b?.[3])?.trim();if(v&&b?.[1]==="data-stx-slot-binding")try{v=decodeURIComponent(v)}catch{v=void 0}let T=v?{start:a.index+l.length,end:e.length,binding:v}:void 0;if(n.push(T),T)t.push(T)}}return t}var nn={},ji=new Map;function uc(e){let t=ji.get(e);if(!t){let n=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");t=new RegExp(`:${n}(?!\\w)`,"g"),ji.set(e,t)}return t.lastIndex=0,t}var Ks={uppercase:(e,t)=>e!==void 0&&e!==null?String(e).toUpperCase():"",lowercase:(e,t)=>e!==void 0&&e!==null?String(e).toLowerCase():"",capitalize:(e,t)=>{if(e===void 0||e===null)return"";let n=String(e);return n.charAt(0).toUpperCase()+n.slice(1)},number:(e,t,n=0)=>{if(e===void 0||e===null)return"";try{let i=Number(e);return Number.isNaN(i)?"":i.toFixed(Number.parseInt(String(n),10))}catch{return""}},fmt:(e,t,n="en-US")=>{if(e===void 0||e===null)return"";try{let i=Number(e);if(Number.isNaN(i))return String(e);return i.toLocaleString(n)}catch{return String(e)}},join:(e,t,n=",")=>{if(!Array.isArray(e))return"";return e.join(String(n))},escape:(e,t)=>{if(e===void 0||e===null)return"";return W(String(e))},translate:(e,t,n={})=>{if(!t||!t.__translations)return e;let i=t.__translations,a=t.__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 b=String(c);return Object.entries(n).forEach(([v,T])=>{b=b.replace(uc(v),()=>String(T))}),b},t:(e,t,n={})=>Ks.translate(e,t,n),truncate:(e,t,n=50,i="...")=>{if(e===void 0||e===null)return"";let a=String(e);if(a.length<=n)return a;if(n<=i.length)return i.substring(0,n);return a.substring(0,n-i.length)+i},date:(e,t,n="short",i="en-US")=>{if(e===void 0||e===null)return"";try{let a=e instanceof Date?e:new Date(e);if(Number.isNaN(a.getTime()))return String(e);let l={short:{dateStyle:"short"},medium:{dateStyle:"medium"},long:{dateStyle:"long"},full:{dateStyle:"full"},time:{timeStyle:"short"},datetime:{dateStyle:"short",timeStyle:"short"},iso:{}};if(n==="iso")return a.toISOString();return new Intl.DateTimeFormat(i,l[n]||l.short).format(a)}catch{return String(e)}},currency:(e,t,n="USD",i="en-US")=>{if(e===void 0||e===null)return"";try{let a=Number(e);if(Number.isNaN(a))return String(e);return new Intl.NumberFormat(i,{style:"currency",currency:n}).format(a)}catch{return String(e)}},pluralize:(e,t,n,i)=>{let a=Number(e);if(Number.isNaN(a))return n;let l=i||`${n}s`;return a===1?n:l},first:(e,t)=>{if(e===void 0||e===null)return"";if(Array.isArray(e))return e.length===0?"":e[0];return String(e).charAt(0)},last:(e,t)=>{if(e===void 0||e===null)return"";if(Array.isArray(e))return e.length===0?"":e[e.length-1];let n=String(e);return n.charAt(n.length-1)},length:(e,t)=>{if(e===void 0||e===null)return 0;if(Array.isArray(e)||typeof e==="string")return e.length;if(e instanceof Map||e instanceof Set)return e.size;if(typeof e==="object")return Object.keys(e).length;return 0},json:(e,t,n=!1)=>{if(e===void 0)return"undefined";if(e===null)return"null";try{return n?JSON.stringify(e,null,2):JSON.stringify(e)}catch{return String(e)}},default:(e,t,n="")=>e===void 0||e===null||e===""?n:e,reverse:(e,t)=>{if(e===void 0||e===null)return"";if(Array.isArray(e))return[...e].reverse();return String(e).split("").reverse().join("")},slice:(e,t,n=0,i)=>{if(e===void 0||e===null)return"";if(Array.isArray(e)||typeof e==="string")return e.slice(n,i);return e},replace:(e,t,n,i="")=>{if(e===void 0||e===null)return"";let a=n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return String(e).replace(new RegExp(a,"g"),()=>i)},stripTags:(e,t)=>{if(e===void 0||e===null)return"";return String(e).replace(/<[^>]*>/g,"")},urlencode:(e,t)=>{if(e===void 0||e===null)return"";return encodeURIComponent(String(e))},abs:(e,t)=>{let n=Number(e);return Number.isNaN(n)?0:Math.abs(n)},round:(e,t,n=0)=>{let i=Number(e);if(Number.isNaN(i))return 0;let a=10**n;return Math.round(i*a)/a}};function xg(e,t){if(e in Ks)console.warn(`Filter "${e}" already exists as a built-in filter. Custom filter will take precedence.`);nn[e]=t}function ry(e){for(let[t,n]of Object.entries(e))xg(t,n)}function Sg(){return{...Ks,...nn}}function sy(){for(let e of Object.keys(nn))delete nn[e]}function Vi(e){let t=e.next();while(!t.done)t=e.next();return t.value}function*Ui(e,t,n,i){let a="{".repeat(n);if(!e.includes(a))return e;let l="",c=0,b=0,v=i===Number.POSITIVE_INFINITY?0:performance.now();for(;;){let T=e.indexOf(a,c);if(T===-1)break;let P=xe(e,T,n);if(P===-1)break;if(l+=e.slice(c,T)+t(e.slice(T,P+n),e.slice(T+n,P),T),c=P+n,++b>=64){b=0;let M=performance.now();if(M-v>=i)v=M,yield}}return c===0?e:l+e.slice(c)}function xn(e,t,n=2){return Vi(Ui(e,t,n,Number.POSITIVE_INFINITY))}function fc(e,t,n){let i=n[0];if(i!=="'"&&i!=='"'&&i!=="`")return!1;let a=_r(e,t);if(!a||a.kind!=="attribute"||a.quote===i)return!1;if(!/^(?::|@|x-|v-)/.test(a.name))return!1;let 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 W(e){return Ti(p(e))}function pc(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 dc(e){return e.replace(/\/\*[\s\S]*?\*\//g,"").replace(/\\([\dA-Fa-f]{1,6})\s?/g,(t,n)=>String.fromCodePoint(Number.parseInt(n,16))).replace(/\\([^\r\n])/g,"$1").replace(/[\u0000-\u0020]+/g,"").toLowerCase()}function gc(e,t){let n=dc(e);if(/@import|expression\(|behavior:|-moz-binding|(?:image-set|cross-fade)\(/.test(n))throw new ie(t,"network-capable or executable CSS is not allowed in an escaped interpolation");let i=/url\(([^)]*)\)/g,a;while((a=i.exec(n))!==null){let l=a[1].replace(/^["']|["']$/g,""),c=l.startsWith("/")&&!l.startsWith("//")||l.startsWith("./")||l.startsWith("../")||l.startsWith("#"),b=/^data:image\/(?:avif|bmp|gif|jpeg|jpg|png|webp);base64,[a-z\d+/=]+$/i.test(l);if(!c&&!b)throw new ie(t,"CSS URLs must be local paths or base64 raster images")}}function Q(e,t,n,i=!1,a=0){try{return mc(e,t,n,i,a)}catch(l){if(l instanceof ie)l.locate(e,t);throw l}}function mc(e,t,n,i,a){let l=_r(e,t,i),c=W(n);if(!l)return c;if(l.kind==="tag-name"){if(!/^[A-Za-z][A-Za-z0-9:-]*$/.test(n))throw new ie("tag name","dynamic tag names may contain only letters, digits, colons, and hyphens");return n}if(l.kind==="tag"){let T=e.slice(t+a).trimStart(),P=n.trim();if(!T.startsWith("=")&&(P===""||P.split(/\s+/).every((M)=>/^(?!on)[A-Za-z_:][\w:.-]*$/.test(M))))return P;throw new ie("tag structure","only standalone boolean attributes may be interpolated into tag structure")}let b=l.name.toLowerCase();if(/^on[a-z]/.test(b))throw new ie(l.name,"native event-handler attributes execute JavaScript; use an @event binding instead");if(b==="srcdoc")c=W(c);if(b==="style")gc(n,l.name);if(l.quote===null)c=pc(c);let v=As(b);if(v&&l.valuePrefix.trim()===""&&Kn(n,v))return Ai+c;return Pi(Ii(e,t),n,c)}function Sn(e,t){let n=` ${e}="`;return Q(n,n.length,t,!0)}function Hi(e){return e.flatMap((t)=>{let n=t.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i);return!n||/\bserver\b|\bsrc\s*=/.test(n[1])?[]:[n[2]]})}function ke(e,t){let{scripts:n}=J(e);for(let i of Hi(n)){if(/\b(state|derived|effect|ref|reactive|computed|watch|watchEffect|useModel)\s*(?:<[^>]*>)?\s*\(/.test(i)||tl.test(i))return!0;if(Mr(i,t))return!0}if(/@(if|for|show)\s*=\s*["'][^"']*\(\s*\)/.test(e))return!0;if(/@for\s*=\s*["'][^"']*\s+(?:in|of)\s+[^"']*\(\s*\)/.test(e))return!0;if(/(?:^|[\s"'])(?::|x-)(?:for|if|else-if|else|show|text|html|model|bind)\b/.test(e))return!0;return!1}function kg(e){let t=[],n=/<([a-zA-Z][\w-]*)\b[^>]*?\s(?::for|x-for|@for)\s*=\s*(["'])([\s\S]*?)\2[^>]*>/g;for(let i=n.exec(e);i;i=n.exec(e)){let a=i[1].toLowerCase(),l=new Set(Y(i[3]));if(l.size===0)continue;let c=i.index+i[0].length;if(i[0].endsWith("/>")){t.push({start:i.index,end:c,names:l});continue}let b=new RegExp(`<(/?)${a}\\b[^>]*?(/?)>`,"gi");b.lastIndex=c;let v=1,T=e.length;for(let P=b.exec(e);P;P=b.exec(e)){if(P[2]==="/")continue;if(v+=P[1]==="/"?-1:1,v===0){T=P.index+P[0].length;break}}t.push({start:i.index,end:T,names:l})}return t}function Li(e,t,n){let i=s(n);for(let a of e){if(t<a.start||t>=a.end)continue;for(let l of a.names)if(new RegExp(`(?<![.#\\w$])${l.replace(/\$/g,"\\$")}(?![\\w$])`).test(i))return!0}return!1}function zi(e,t){let n=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","URL","URLSearchParams","Intl","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined","NaN","Infinity","isNaN","isFinite","window","document","console","new","typeof","instanceof","in","void"],i=e.replace(/'[^']*'/g,"").replace(/"[^"]*"/g,""),a="",l=!1,c=0;for(let T=0;T<i.length;T++){let P=i[T];if(!l&&P==="`"){l=!0,c=0;continue}if(l){if(P==="`"&&c===0){l=!1;continue}if(P==="$"&&i[T+1]==="{"){c++,T++,a+=" ";continue}if(P==="}"&&c>0){c--;continue}if(c>0){a+=P;continue}continue}a+=P}i=a;let b=/(?<![a-zA-Z0-9_$])([a-zA-Z_$][a-zA-Z0-9_$]*)/g,v;while((v=b.exec(i))!==null){let T=v[1];if(!i.substring(0,v.index).trimEnd().endsWith(".")){if(!n.includes(T)&&!(T in t))return!1}}return!0}function hc(e,t){let n=s(e);for(let i of n.matchAll(/(?<![.\w$])([A-Z_$][\w$]*)\s*\(/gi))if(typeof t[i[1]]==="function")return!0;return!1}function xc(e,t){let n=t.__stx_serverDeclared;if(!n||n.size===0)return!1;let i=s(e);for(let a of n)if(new RegExp(`(?<![.#\\w$])${a}(?![\\w$])`).test(i))return!0;return!1}var Bi=new Set;function Wi(e){return/^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*)*$/.test(e.trim())}function bc(e,t,n){let i=n[0];if(i!=="'"&&i!=='"'&&i!=="`")return!1;let a=0;for(let l=e.lastIndexOf(`
217
+ `,t-1)+1;l<t;l++)if(e[l]==="\\")l++;else if(e[l]===i)a++;return a%2===1}function Fi(e,t){let n=`${t??"<unknown>"}\x00${e}`;if(process.env.STX_DEBUG||!Bi.has(n))Bi.add(n),console.warn(`[stx] {{ ${e} }} in a <script> in ${t??"<unknown>"} has no server value, so it was emitted as undefined. A mustache left in JavaScript is a SyntaxError that takes the whole script down, so give the value a default in <script server>.`);return"undefined"}function ki(e,t,n){let i=e;return i=i.replace(/\{!!([\s\S]*?)!!\}/g,(a,l)=>{try{let c=A(l,t);if(c===void 0)return Wi(l)?Fi(l.trim(),n):a;return c===null?"":String(c)}catch{return a}}),i=xn(i,(a,l,c)=>{let b=l.trim();if(bc(i,c,l))return a;if(/^__[A-Z_]+__$/.test(b))return a;try{let v=A(l,t);if(v===void 0)return Wi(b)?Fi(b,n):a;return JSON.stringify(v).replace(/</g,"\\u003c").replace(/@/g,"\\u0040").replace(/\{{2,}/g,(T)=>"\\u007b".repeat(T.length)).replace(/\{(?=!)/g,"\\u007b")}catch{return a}}),i}function _g(e,t){if(!e.includes("{"))return e;let n=e;return n=n.replace(/\{!!([\s\S]*?)!!\}/g,(i,a)=>{try{let l=A(a,t);if(l===void 0)return i;return l===null?"":String(l)}catch{return i}}),n=xn(n,(i,a,l)=>{let c=a.trim();if(/^__[A-Z_]+__$/.test(c))return i;try{let b=A(a,t);if(b===void 0)return i;if(b===null)return"";let v=String(b);return Q(n,l,v,!0,i.length)}catch(b){if(b instanceof ie)throw b;return i}}),n}function oy(e,t,n={}){let{output:i,scripts:a}=J(e),l=a.map((c)=>{let b=c.match(/^<script\b((?:[^>\"']|\"[^\"]*\"|'[^']*')*)>/i),v=c.search(/<\/script\s*>$/i);if(!b||v===-1)return c;let T=b[1],P=c.slice(b[0].length,v);if(/\bdata-raw\b/.test(T))return c;if(n.skipServer&&/\bserver\b/.test(T))return c;let H=`<script${_g(T,t)}>`;if(/\bsrc\s*=/.test(T)||/\btype\s*=\s*["']application\/json["']/.test(T))return H+P+c.slice(v);return H+ki(P,t)+c.slice(v)});return Sr(i,l)}function*qi(e,t,n,i){let a=e,l=(B,F)=>{let ee=gn(B,F);if(ee===-1)return-1;return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(B.slice(F,ee))?-1:ee},c=(B,F,ee,G)=>{let j=ee.length,{output:te,tokens:se}=fe(B,F,(ne,ue)=>G(j+ue));return ee.push(...se),te},b=[];a=c(a,l,b,(B)=>`<!--__STX_STYLE_${B}__-->`);let v=[];a=c(a,q,v,(B)=>`<!--__STX_SCRIPT_EXPR_${B}__-->`);let T=t?.__stx_signals_gate===!0||ke(e),P=new Set([...Array.isArray(t?.__stx_client_signal_names)?t.__stx_client_signal_names:[],...xi(Hi(v))]),M=new Set(Array.isArray(t?.__stx_preserved_client_expressions)?t.__stx_preserved_client_expressions:[]);a=xn(a,(B,F,ee)=>{if(N(F,P))return B;try{let G=A(F,t,!1,(j)=>Is(j,B,n,e));return G!==void 0&&G!==null?String(G):""}catch(G){let j=G instanceof Error?G.message:String(G);return h("Expression",`Error evaluating: {{{ ${F.trim()}}}}: ${j}`,n,e,ee,B)}},3),a=a.replace(/\{!!([\s\S]*?)!!\}/g,(B,F,ee)=>{if(N(F,P))return B;try{let G=A(F,t,!1,(j)=>Is(j,B,n,e));if(G===void 0&&t.__stx_buildMode==="compile")return qn("raw",F.trim());return G!==void 0&&G!==null?String(G):""}catch(G){if(t.__stx_buildMode==="compile")return qn("raw",F.trim());let j=G instanceof Error?G.message:String(G);return h("Expression",`Error evaluating: {!! ${F.trim()} !!}: ${j}`,n,e,ee,B)}}),a=c(a,q,v,(B)=>`<!--__STX_SCRIPT_EXPR_${B}__-->`),a=c(a,l,b,(B)=>`<!--__STX_STYLE_${B}__-->`);let H=T?kg(a):[],O=Gn(a).map((B)=>({...B,names:new Set(Y(`${B.binding} in __slot`))})),L=new Set(st(t));if(a=yield*Ui(a,(B,F,ee)=>{let G=F.trim();if(fc(a,ee,F))return B;if(Li(O,ee,G))return B;if(N(G,L))return B;if(H.length>0&&Li(H,ee,G))return B;if(M.has(G))return B;let j=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined"],te=/^([a-zA-Z_$][a-zA-Z0-9_$]*)/,ne=G.match(te)?.[1],ue=ne&&((ne in t)||j.includes(ne)),ye=/^([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/,de=G.match(ye),Ae=de&&!j.includes(de[1])&&!(de[1]in t);if(/^__[A-Z_]+__$/.test(G))return"";if(N(G,P))return B;if(t.__stx_native_screen===!0&&hc(G,t))return B;let Ze;try{let Re=A(F,t,!1,(Ye)=>{Ze=Ye});if(T&&!zi(G,t))return B;if(Ze)Is(Ze,B,n,e);if(t.__stx_buildMode==="compile"&&!T&&(Re===void 0||xc(G,t)))return qn("expr",G);if(Re===void 0||Re===null)return"";let Ke=String(Re);return Q(a,ee,Ke,!1,B.length)}catch(Re){if(Re instanceof ie)throw Re;if(T&&!zi(G,t))return B;if(Ae)return B;let Ke=Re instanceof Error?Re.message:String(Re);return h("Expression",`Error evaluating: {{ ${G} }}: ${Ke}`,n,e,ee,B)}},2,i),v.length>0)a=a.replace(/<!--__STX_SCRIPT_EXPR_(\d+)__-->/g,(B,F)=>v[Number(F)]??B);if(b.length>0)a=a.replace(/<!--__STX_STYLE_(\d+)__-->/g,(B,F)=>b[Number(F)]??B);return a}function E(e,t,n){return Vi(qi(e,t,n,Number.POSITIVE_INFINITY))}var yc=100;async function _i(e,t,n,i=yc){let a=qi(e,t,n,i),l=a.next();while(!l.done)await _(),l=a.next();return l.value}function Cg(e,t,n){if(!t.trim())return e;let i=e,a=t.trim();while(a.length>0){let l=a.match(/^(\w+)/);if(!l)break;let c=l[1];a=a.substring(c.length).trim();let b=nn[c]||Ks[c];if(!b)throw Error(`Filter not found: ${c}. Available filters: ${Object.keys(Sg()).join(", ")}`);let v=[];if(a.startsWith(":")){let T=a.match(/^:([^|\s]+)/);if(T){let P=T[1].trim();try{let M=Number(P);v=[Number.isNaN(M)?P:M]}catch{v=[P]}a=a.substring(T[0].length).trim()}}else if(a.startsWith("(")){let T=1,P=1;while(T>0&&P<a.length){if(a[P]==="(")T++;if(a[P]===")")T--;P++}if(T===0){let M=a.substring(1,P-1).trim();if(M)try{if(M.startsWith("{")&&M.endsWith("}"))v=[A(`(${M})`,n,!0)];else{let H=[],O="",L=null,B=0,F=0,ee=0,G=!1;for(let j=0;j<M.length;j++){let te=M[j];if(G){O+=te,G=!1;continue}if(te==="\\"){O+=te,G=!0;continue}if(L){if(O+=te,te===L)L=null;continue}if(te==='"'||te==="'"||te==="`"){L=te,O+=te;continue}if(te==="(")B++;else if(te===")")B--;else if(te==="[")F++;else if(te==="]")F--;else if(te==="{")ee++;else if(te==="}")ee--;if(te===","&&B===0&&F===0&&ee===0){H.push(O),O="";continue}O+=te}if(O)H.push(O);v=H.map((j)=>{let te=j.trim();return A(te,n,!0)})}}catch{v=[M]}a=a.substring(P).trim()}}try{i=b(i,n,...v)}catch(T){let P=T instanceof Error?T.message:String(T);throw Error(`Error applying filter '${c}': ${P}`)}if(a.startsWith("|"))a=a.substring(1).trim();else break}return i}function _c(e){let t=!1,n="",i=0,a=0,l=0,c=!1;for(let b=0;b<e.length;b++){let v=e[b],T=e[b+1];if(t&&c){c=!1;continue}if(t&&v==="\\"){c=!0;continue}if(c=!1,(v==='"'||v==="'"||v==="`")&&!c){if(!t)t=!0,n=v;else if(v===n)t=!1,n="";continue}if(t&&n==="`"&&v==="$"&&T==="{"){let P=1;b+=2;while(b<e.length&&P>0){if(e[b]==="{")P++;else if(e[b]==="}")P--;if(P>0)b++}continue}if(t)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(T==="|"){b++;continue}if(T==="="){b++;continue}return b}}return-1}var tn=new Set,wc=1000;function iy(){tn.clear()}function Is(e,t,n,i){if(!X())return;let a=`${n}\x00${e.expression}`;if(tn.has(a))return;if(tn.size>=wc)tn.clear();tn.add(a);let l=n,c=i;try{if(n&&Mi.existsSync(n))c=Mi.readFileSync(n,"utf8")}catch{}let b=c.indexOf(t);if(b>=0)l=`${n}:${c.slice(0,b).split(`
218
+ `).length}`;console.warn(`${l}: stx warning: ${t} rendered as an empty string. The safe evaluator rejected \`${e.expression}\` (${e.rule}). Compute the value in <script server> and interpolate the variable instead.`)}function A(e,t,n=!1,i){try{let a=e.trim(),l=_c(a);if(l>0){let b=a.substring(0,l).trim(),v=a.substring(l+1).trim(),T=A(b,t,!0,i);return Cg(T,v,t)}let c=Gs(a);if(c!==null){i?.({expression:a,rule:c});return}try{let b=Object.keys(t),v=Object.values(t);return d(a,b)(...v)}catch{return u(a,t)}}catch(a){if(a instanceof ReferenceError){let l=/(\b\w+)\s+is not defined/.exec(a.message);if(l){let c=l[1],b=Sc(c,Object.keys(t));if(b&&b!==c)a.message=`${a.message} \u2014 did you mean '${b}'?`}}if(!n)console.error(`Error evaluating expression: ${e}`,a);throw a}}function Sc(e,t){let n=null;for(let a of t){if(a===e)continue;let l=$c(e,a);if(n===null||l<n.dist)n={key:a,dist:l}}if(!n)return null;let i=Math.max(e.length,n.key.length);if(n.dist<=2||n.dist/i<=0.35)return n.key;return null}function $c(e,t){if(e===t)return 0;if(e.length===0)return t.length;if(t.length===0)return e.length;let[n,i]=e.length<t.length?[e,t]:[t,e],a=Array(n.length+1),l=Array(n.length+1);for(let c=0;c<=n.length;c++)a[c]=c;for(let c=1;c<=i.length;c++){l[0]=c;for(let b=1;b<=n.length;b++){let v=n[b-1]===i[c-1]?0:1;l[b]=Math.min(l[b-1]+1,a[b]+1,a[b-1]+v)}for(let b=0;b<=n.length;b++)a[b]=l[b]}return a[n.length]}function ay(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 vc from"process";function C(e="STX_PUBLIC_"){let t={},n={};for(let[i,a]of Object.entries(vc.env)){if(!i.startsWith(e)||a===void 0)continue;t[`import.meta.env.${i}`]=JSON.stringify(a),n[i]=a}return t["import.meta.env"]=JSON.stringify(n),t}function Zi(e,t=""){let n=`${e}${t}`,i=0;for(let a=0;a<n.length;a++){let l=n.charCodeAt(a);i=(i<<5)-i+l,i=i&i}return`stx-${Math.abs(i).toString(36)}`}function Ki(e,t,n={}){let{prefix:i="",preserveHost:a=!0,scopeKeyframes:l=!0,scopeCustomProperties:c=!1}=n;if(!e.trim())return"";let b=Ps(e),v=[],T=new Map;if(l)for(let P of b){let M=P.selector.match(/@keyframes\s+([a-z_-][a-z0-9_-]*)/i);if(M){let H=M[1],O=`${t}_${H}`;T.set(H,O)}}for(let P of b){let M=Xi(P,t,i,a,T,c);v.push(M)}return v.join(`
219
219
 
220
220
  `)}function Ps(e){let t=[],n=e.replace(/\/\*[\s\S]*?\*\//g,""),i=0,a="",l=!1,c="";for(let b=0;b<n.length;b++){let v=n[b];if(v==="@"&&i===0)l=!0;if(v==="{")i++;else if(v==="}"){if(i--,i===0){if(l){c+=v;let T=c.match(/@([a-z-]+)\s*([^{]*)\{([\s\S]*)\}/i);if(T){let[,P,M,H]=T;if(P==="keyframes")t.push({selector:`@keyframes ${M.trim()}`,declarations:H.trim()});else if(P==="media"||P==="supports"||P==="container"){let O=Ps(H);t.push({selector:`@${P} ${M.trim()}`,declarations:O.map((L)=>`${L.selector} { ${L.declarations} }`).join(`
221
- `)})}else t.push({selector:`@${P} ${M.trim()}`,declarations:H.trim()})}c="",l=!1}else if(a.trim()){a+=v;let T=a.match(/([^{]+)\{([^}]*)\}/);if(T)t.push({selector:T[1].trim(),declarations:T[2].trim()});a=""}continue}}if(l)c+=v;else a+=v}return t}function Ji(e,t,n,i,a,l){let{selector:c,declarations:b}=e;if(c.startsWith("@")){if(c.startsWith("@keyframes")){let P=c.replace("@keyframes ","").trim();return`@keyframes ${a.get(P)||P} { ${b} }`}if(c.startsWith("@media")||c.startsWith("@supports")||c.startsWith("@container")){let M=Ps(`x { ${b} }`.replace(/x \{ /,"").replace(/ \}$/,"")).map((H)=>Ji(H,t,n,i,a,l)).join(`
221
+ `)})}else t.push({selector:`@${P} ${M.trim()}`,declarations:H.trim()})}c="",l=!1}else if(a.trim()){a+=v;let T=a.match(/([^{]+)\{([^}]*)\}/);if(T)t.push({selector:T[1].trim(),declarations:T[2].trim()});a=""}continue}}if(l)c+=v;else a+=v}return t}function Xi(e,t,n,i,a,l){let{selector:c,declarations:b}=e;if(c.startsWith("@")){if(c.startsWith("@keyframes")){let P=c.replace("@keyframes ","").trim();return`@keyframes ${a.get(P)||P} { ${b} }`}if(c.startsWith("@media")||c.startsWith("@supports")||c.startsWith("@container")){let M=Ps(`x { ${b} }`.replace(/x \{ /,"").replace(/ \}$/,"")).map((H)=>Xi(H,t,n,i,a,l)).join(`
222
222
  `);return`${c} {
223
223
  ${M}
224
- }`}return`${c} { ${b} }`}let v=Ec(c,t,n,i),T=b;for(let[P,M]of a)T=T.replace(new RegExp(`\\b${P}\\b`,"g"),M);if(l)T=T.replace(/--([a-z-]+)/gi,`--${t}-$1`);return`${v} { ${T} }`}function Ec(e,t,n,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 T=c.replace(/:host(\([^)]*\))?/,`.${t}$1`);l.push(T)}continue}if(c.includes("::slotted")){l.push(c);continue}if(c===":root"){l.push(`:root .${t}`);continue}let b=n?`${n} .${t}`:`.${t}`;l.push(`${b} ${c}`);let v=kc(c,t);if(v)l.push(n?`${n} ${v}`:v)}return l.join(", ")}function kc(e,t){let n=0,i=e.length;for(let v=0;v<e.length;v++){let T=e[v];if(T==="["||T==="(")n++;else if(T==="]"||T===")")n--;else if(n===0&&(T===" "||T===">"||T==="+"||T==="~")){i=v;break}}let a=e.slice(0,i),l=e.slice(i);if(!a)return"";let c=a.length,b=0;for(let v=0;v<a.length;v++){let T=a[v];if(T==="["||T==="(")b++;else if(T==="]"||T===")")b--;else if(n===0&&b===0&&T===":"){c=v;break}}return`${a.slice(0,c)}.${t}${a.slice(c)}${l}`}var Qi=String.raw`(?<![\w-])scoped(?![\w-])`,Js=/<style\s+([^>]*)>/gi,Gi=/<style\s+([^>]*)>([\s\S]*?)<\/style>/gi,eo=new RegExp(Qi,"i"),Cc=new RegExp(Qi,"gi"),Gs=/<style\b[^>]*\bdata-stx-scoped(?:=(?:"[^"]*"|'[^']*'|[^\s>]+))?[^>]*>[\s\S]*?<\/style>\s*/gi;function Rc(e){Js.lastIndex=0;let t=Js.exec(e);while(t!==null){if(eo.test(t[1]))return!0;t=Js.exec(e)}return!1}function mi(e){let t=new Set,n=[];Gs.lastIndex=0;let i=Gs.exec(e);while(i!==null){let a=i[0].trim();if(t.has(a))n.push({start:i.index,end:i.index+i[0].length});else t.add(a);i=Gs.exec(e)}return n}function mn(e){let t=mi(e);if(t.length===0)return e;let n=Array(t.length+1),i=0;for(let a=0;a<t.length;a++){let l=t[a];n[a]=e.slice(i,l.start),i=l.end}return n[t.length]=e.slice(i),n.join("")}function zs(e,t){if(!Rc(e))return{html:e,hasScoped:!1};let n=Ki(t),i=`data-v-${n}`,a=e,l=!1;if(Gi.lastIndex=0,a=a.replace(Gi,(c,b,v)=>{if(!eo.test(b))return c;l=!0;let T=Tc(v,i),P=b.replace(Cc,"").trim(),M=P?` ${P}`:"";return`<style data-stx-scoped="${n}"${M}>${T}</style>`}),!l)return{html:e,hasScoped:!1};return a=Pc(a,i),{html:a,hasScoped:!0}}function Tc(e,t){return Xi(e,"__SCOPE_PLACEHOLDER__",{preserveHost:!1}).replace(/\.(__SCOPE_PLACEHOLDER__) /g,`[${t}] `).replace(/\.(__SCOPE_PLACEHOLDER__)/g,`[${t}]`)}var Ac=(e)=>`\x00stx-scope-mask-${e}\x00`,Yi=/\u0000stx-scope-mask-(\d+)\u0000/g;function Pc(e,t){let n=fe(e,(a,l)=>{let c=q(a,l);return c>l?c:gn(a,l)},(a,l)=>Ac(l)),i=il(n.output,t);return Yi.lastIndex=0,i.replace(Yi,(a,l)=>n.tokens[Number(l)])}function il(e,t){let n=new Set(["script","style","template","html","head","body","meta","link","title","base","!doctype","!DOCTYPE"]);return e.replace(/<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*)?\/?>/g,(i,a,l)=>{if(n.has(a.toLowerCase()))return i;if(i.includes(t))return i;if(a.toLowerCase()==="style"||a.toLowerCase()==="script")return i;if(l)return i.replace(`<${a}${l}`,`<${a} ${t}${l}`);if(i.endsWith("/>"))return`<${a} ${t} />`;return`<${a} ${t}>`})}var sn=/<\/?template\b[^>]*>/gi,ol=/(?:^|\s)(?:id\s*=|(?:x-|[@:])(?:for|if|else(?:-if)?)(?=\s|=|$)|#[\w-]+(?:\s*=|\s|$)|v-slot(?::[\w-]+)?(?=\s|=|$)|slot\s*=)/i;function al(e){let t=e.replace(/^<template\b/i,"").replace(/>$/,"");return ol.test(t)}function pe(e){sn.lastIndex=0;let t;while((t=sn.exec(e))!==null){if(t[0].startsWith("</")||al(t[0]))continue;let n=t.index,i=sn.lastIndex,a=1,l;while((l=sn.exec(e))!==null)if(l[0].startsWith("</")){if(a--,a===0){let c=l.index;return{start:n,openEnd:i,closeStart:c,end:sn.lastIndex,content:e.slice(i,c)}}}else a++;return null}return null}var cl=0,ll=0;function Yn(e,t){let n=/(?:^|\s)([^\s=/>]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+)))?/g;for(let i of e.matchAll(n))if(i[1].toLowerCase()===t.toLowerCase())return i[2]??i[3]??i[4]??null;return null}function no(e){let t=[],n=/<([a-z][a-z0-9-]*)\b((?:"[^"]*"|'[^']*'|[^>"'])*)>/iy;return y(e,(i,a)=>{n.lastIndex=a;let l=n.exec(i);if(!l||!Yn(l[2],"x-data"))return-1;return t.push({fullMatch:l[0],tagName:l[1],attributes:l[2],startIndex:a,endIndex:n.lastIndex}),n.lastIndex}),t}function ul(e){let t=[];for(let{fullMatch:n,tagName:i,attributes:a,startIndex:l}of no(e)){let c=Yn(a,"x-data");if(!c)continue;let b=`__stx_scope_${cl++}`,v=Yn(a,"x-init"),T=fl(e,i,l+n.length),P=e.slice(l,T.endIndex),M=pl(P);t.push({id:b,selector:`[data-stx-scope="${b}"]`,stateExpr:c,initExpr:v,bindings:[],refs:M})}return t}function fl(e,t,n){let i=1,a=n,l=new RegExp(`<${t}(?:\\s|>)`,"gi"),c=new RegExp(`</${t}>`,"gi"),b=new RegExp(`<${t}[^>]*/\\s*>`,"gi");while(i>0&&a<e.length){l.lastIndex=a,c.lastIndex=a,b.lastIndex=a;let v=l.exec(e),T=c.exec(e),P=b.exec(e);if(P&&P.index<(v?.index??1/0)){a=P.index+P[0].length;continue}if(!T)return{endIndex:e.length};if(v&&v.index<T.index)i++,a=v.index+v[0].length;else{if(i--,i===0)return{endIndex:T.index+T[0].length};a=T.index+T[0].length}}return{endIndex:e.length}}function pl(e){let t=new Map,n=e.replace(/x-data\s*=\s*"[^"]*"/gi,'x-data="__stripped__"').replace(/x-data\s*=\s*'[^']*'/gi,"x-data='__stripped__'"),i=/<[a-z][a-z0-9-]*\s+([^>]*x-ref\s*=\s*["']([^"']*)["'][^>]*)>/gi,a;while((a=i.exec(n))!==null){let[,l,c]=a,b=dl(l);t.set(c,b)}return t}function dl(e){let t=e.match(/\bid\s*=\s*["']([^"']*)["']/);if(t)return t[1];return`__stx_el_${ll++}`}function hl(){return`
224
+ }`}return`${c} { ${b} }`}let v=Ec(c,t,n,i),T=b;for(let[P,M]of a)T=T.replace(new RegExp(`\\b${P}\\b`,"g"),M);if(l)T=T.replace(/--([a-z-]+)/gi,`--${t}-$1`);return`${v} { ${T} }`}function Ec(e,t,n,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 T=c.replace(/:host(\([^)]*\))?/,`.${t}$1`);l.push(T)}continue}if(c.includes("::slotted")){l.push(c);continue}if(c===":root"){l.push(`:root .${t}`);continue}let b=n?`${n} .${t}`:`.${t}`;l.push(`${b} ${c}`);let v=kc(c,t);if(v)l.push(n?`${n} ${v}`:v)}return l.join(", ")}function kc(e,t){let n=0,i=e.length;for(let v=0;v<e.length;v++){let T=e[v];if(T==="["||T==="(")n++;else if(T==="]"||T===")")n--;else if(n===0&&(T===" "||T===">"||T==="+"||T==="~")){i=v;break}}let a=e.slice(0,i),l=e.slice(i);if(!a)return"";let c=a.length,b=0;for(let v=0;v<a.length;v++){let T=a[v];if(T==="["||T==="(")b++;else if(T==="]"||T===")")b--;else if(n===0&&b===0&&T===":"){c=v;break}}return`${a.slice(0,c)}.${t}${a.slice(c)}${l}`}var Yi=String.raw`(?<![\w-])scoped(?![\w-])`,Os=/<style\s+([^>]*)>/gi,Ji=/<style\s+([^>]*)>([\s\S]*?)<\/style>/gi,Qi=new RegExp(Yi,"i"),Cc=new RegExp(Yi,"gi"),Zs=/<style\b[^>]*\bdata-stx-scoped(?:=(?:"[^"]*"|'[^']*'|[^\s>]+))?[^>]*>[\s\S]*?<\/style>\s*/gi;function Rc(e){Os.lastIndex=0;let t=Os.exec(e);while(t!==null){if(Qi.test(t[1]))return!0;t=Os.exec(e)}return!1}function hi(e){let t=new Set,n=[];Zs.lastIndex=0;let i=Zs.exec(e);while(i!==null){let a=i[0].trim();if(t.has(a))n.push({start:i.index,end:i.index+i[0].length});else t.add(a);i=Zs.exec(e)}return n}function mn(e){let t=hi(e);if(t.length===0)return e;let n=Array(t.length+1),i=0;for(let a=0;a<t.length;a++){let l=t[a];n[a]=e.slice(i,l.start),i=l.end}return n[t.length]=e.slice(i),n.join("")}function Hs(e,t){if(!Rc(e))return{html:e,hasScoped:!1};let n=Zi(t),i=`data-v-${n}`,a=e,l=!1;if(Ji.lastIndex=0,a=a.replace(Ji,(c,b,v)=>{if(!Qi.test(b))return c;l=!0;let T=Tc(v,i),P=b.replace(Cc,"").trim(),M=P?` ${P}`:"";return`<style data-stx-scoped="${n}"${M}>${T}</style>`}),!l)return{html:e,hasScoped:!1};return a=Ic(a,i),{html:a,hasScoped:!0}}function Tc(e,t){return Ki(e,"__SCOPE_PLACEHOLDER__",{preserveHost:!1}).replace(/\.(__SCOPE_PLACEHOLDER__) /g,`[${t}] `).replace(/\.(__SCOPE_PLACEHOLDER__)/g,`[${t}]`)}var Ac=(e)=>`\x00stx-scope-mask-${e}\x00`,Gi=/\u0000stx-scope-mask-(\d+)\u0000/g;function Ic(e,t){let n=fe(e,(a,l)=>{let c=q(a,l);return c>l?c:gn(a,l)},(a,l)=>Ac(l)),i=Pc(n.output,t);return Gi.lastIndex=0,i.replace(Gi,(a,l)=>n.tokens[Number(l)])}function Pc(e,t){let n=new Set(["script","style","template","html","head","body","meta","link","title","base","!doctype","!DOCTYPE"]);return e.replace(/<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*)?\/?>/g,(i,a,l)=>{if(n.has(a.toLowerCase()))return i;if(i.includes(t))return i;if(a.toLowerCase()==="style"||a.toLowerCase()==="script")return i;if(l)return i.replace(`<${a}${l}`,`<${a} ${t}${l}`);if(i.endsWith("/>"))return`<${a} ${t} />`;return`<${a} ${t}>`})}var sn=/<\/?template\b[^>]*>/gi,il=/(?:^|\s)(?:id\s*=|(?:x-|[@:])(?:for|if|else(?:-if)?)(?=\s|=|$)|#[\w-]+(?:\s*=|\s|$)|v-slot(?::[\w-]+)?(?=\s|=|$)|slot\s*=)/i;function al(e){let t=e.replace(/^<template\b/i,"").replace(/>$/,"");return il.test(t)}function pe(e){sn.lastIndex=0;let t;while((t=sn.exec(e))!==null){if(t[0].startsWith("</")||al(t[0]))continue;let n=t.index,i=sn.lastIndex,a=1,l;while((l=sn.exec(e))!==null)if(l[0].startsWith("</")){if(a--,a===0){let c=l.index;return{start:n,openEnd:i,closeStart:c,end:sn.lastIndex,content:e.slice(i,c)}}}else a++;return null}return null}var cl=0,ll=0;function Yn(e,t){let n=/(?:^|\s)([^\s=/>]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+)))?/g;for(let i of e.matchAll(n))if(i[1].toLowerCase()===t.toLowerCase())return i[2]??i[3]??i[4]??null;return null}function no(e){let t=[],n=/<([a-z][a-z0-9-]*)\b((?:"[^"]*"|'[^']*'|[^>"'])*)>/iy;return y(e,(i,a)=>{n.lastIndex=a;let l=n.exec(i);if(!l||!Yn(l[2],"x-data"))return-1;return t.push({fullMatch:l[0],tagName:l[1],attributes:l[2],startIndex:a,endIndex:n.lastIndex}),n.lastIndex}),t}function ul(e){let t=[];for(let{fullMatch:n,tagName:i,attributes:a,startIndex:l}of no(e)){let c=Yn(a,"x-data");if(!c)continue;let b=`__stx_scope_${cl++}`,v=Yn(a,"x-init"),T=fl(e,i,l+n.length),P=e.slice(l,T.endIndex),M=pl(P);t.push({id:b,selector:`[data-stx-scope="${b}"]`,stateExpr:c,initExpr:v,bindings:[],refs:M})}return t}function fl(e,t,n){let i=1,a=n,l=new RegExp(`<${t}(?:\\s|>)`,"gi"),c=new RegExp(`</${t}>`,"gi"),b=new RegExp(`<${t}[^>]*/\\s*>`,"gi");while(i>0&&a<e.length){l.lastIndex=a,c.lastIndex=a,b.lastIndex=a;let v=l.exec(e),T=c.exec(e),P=b.exec(e);if(P&&P.index<(v?.index??1/0)){a=P.index+P[0].length;continue}if(!T)return{endIndex:e.length};if(v&&v.index<T.index)i++,a=v.index+v[0].length;else{if(i--,i===0)return{endIndex:T.index+T[0].length};a=T.index+T[0].length}}return{endIndex:e.length}}function pl(e){let t=new Map,n=e.replace(/x-data\s*=\s*"[^"]*"/gi,'x-data="__stripped__"').replace(/x-data\s*=\s*'[^']*'/gi,"x-data='__stripped__'"),i=/<[a-z][a-z0-9-]*\s+([^>]*x-ref\s*=\s*["']([^"']*)["'][^>]*)>/gi,a;while((a=i.exec(n))!==null){let[,l,c]=a,b=dl(l);t.set(c,b)}return t}function dl(e){let t=e.match(/\bid\s*=\s*["']([^"']*)["']/);if(t)return t[1];return`__stx_el_${ll++}`}function gl(){return`
225
225
  // STX Reactive Runtime - x-cloak and transition CSS
226
226
  (function() {
227
227
  var style = document.createElement('style');
@@ -502,10 +502,10 @@ window.__stx_reactive = (function() {
502
502
  })();`}).join(`
503
503
  `);return`
504
504
  <script data-stx-scoped data-stx-reactive data-stx-run="always">
505
- ${hl()}
505
+ ${gl()}
506
506
  ${i}
507
- </script>`}function Vc(e,t,n,i=!1){if(!Ys(e))return e;let a=ul(e);if(a.length===0)return e;let l=bl(e,a),c=xl(a,t,i),b=l.lastIndexOf("</body>");if(b!==-1)l=l.slice(0,b)+c+`
508
- `+l.slice(b);else l+=c;return l}function bl(e,t){let n=[],i=0;for(let[l,c]of no(e).entries()){let b=t[l];if(!b)break;n.push(e.slice(i,c.startIndex));let v=Yn(c.attributes,"data-stx-scope");if(v)b.id=v,b.selector=`[data-stx-scope="${b.id}"]`,n.push(c.fullMatch);else n.push(`<${c.tagName} data-stx-scope="${b.id}"${c.attributes}>`);i=c.endIndex}n.push(e.slice(i));let a=n.join("");return a=a.replace(/\s*x-data\s*=\s*"([^"]*)"/g,' data-stx-xdata="$1"'),a=a.replace(/\s*x-data\s*=\s*'([^']*)'/g," data-stx-xdata='$1'"),a=a.replace(/\s*x-init\s*=\s*"([^"]*)"/g,' data-stx-xinit="$1"'),a=a.replace(/\s*x-init\s*=\s*'([^']*)'/g," data-stx-xinit='$1'"),a=a.replace(/\s*x-destroy\s*=\s*"([^"]*)"/g,' data-stx-xdestroy="$1"'),a=a.replace(/\s*x-destroy\s*=\s*'([^']*)'/g," data-stx-xdestroy='$1'"),a}function Ys(e){return/x-data\s*=\s*["']/.test(e)}function Vs(e,t){let n=e,i=/@json\s*\(/g,a;while((a=i.exec(n))!==null){let l=a.index,c=l+a[0].length-1,b=1,v=c+1,T=null,P=!1;while(v<n.length&&b>0){let j=n[v];if(P){P=!1,v++;continue}if(j==="\\"&&T){P=!0,v++;continue}if(T){if(j===T)T=null;v++;continue}if(j==='"'||j==="'"||j==="`"){T=j,v++;continue}if(j==="(")b++;else if(j===")"){if(b--,b===0)break}v++}if(b!==0)break;let M=n.substring(c+1,v).trim(),H=n.substring(l,v+1),O=-1,L=0,B=null,F=!1;for(let j=0;j<M.length;j++){let te=M[j];if(F){F=!1;continue}if(te==="\\"&&B){F=!0;continue}if(B){if(te===B)B=null;continue}if(te==='"'||te==="'"||te==="`"){B=te;continue}if(te==="("||te==="["||te==="{")L++;else if(te===")"||te==="]"||te==="}")L--;if(te===","&&L===0){O=j;break}}let ee=O>=0?M.substring(0,O).trim():M,G=O>=0?M.substring(O+1).trim():void 0;try{let j=ee.trim(),te;if(f(j))te=d(j,Object.keys(t))(...Object.values(t));else te=void 0;let se;if(G==="true")se=JSON.stringify(te,null,2);else se=JSON.stringify(te);let ne=se.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029");n=n.substring(0,l)+ne+n.substring(v+1),i.lastIndex=l+ne.length}catch(j){z.log(j instanceof Error?j:Error(String(j)),{directive:"@json"},"error"),i.lastIndex=l+H.length}}return n}function Us(e){return e.replace(/@once\s*([\s\S]*?)@endonce/g,"$1")}function Uc(e){let t=e,n=/@memo\s*\(/g,i,a=[];while((i=n.exec(t))!==null){let l=i.index,c=l+i[0].length,b=1,v=c;while(v<t.length&&b>0){if(t[v]==="(")b++;else if(t[v]===")")b--;v++}if(b!==0)continue;let T=t.slice(c,v-1).trim(),P=v,M=t.slice(P),H=M.indexOf("@endmemo");if(H===-1)continue;let O=M.slice(0,H),L=P+H+8,B=Pt(O),F=O.slice(B),ee=O.match(/(\s*)$/),G=ee?ee[0].length:0,j=F.slice(0,F.length-G),te=j.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)?(\/?)>/),se;if(te){let[ne,ue,ye="",de]=te,Ae=`<${ue}${ye} data-stx-memo="${T}"${de}>`;se=O.slice(0,B)+Ae+j.slice(ne.length)+O.slice(B+j.length)}else se=`${O.slice(0,B)}<div data-stx-memo="${T}">${j}</div>${O.slice(B+j.length)}`;a.push({start:l,end:L,replacement:se}),n.lastIndex=L}for(let l=a.length-1;l>=0;l--){let c=a[l];t=t.slice(0,c.start)+c.replacement+t.slice(c.end)}return t.replace(/@memo="([^"]*)"/g,'data-stx-memo="$1"')}function hi(e){let t=e.replace(/@ref="([^"]+)"/g,'data-stx-ref="$1"');return t=t.replace(/(<[a-zA-Z][a-zA-Z0-9-]*\b[^>]*?)\sref="([^"]+)"/g,'$1 data-stx-ref="$2"'),t}function oo(e,t){let n=/<\/?([a-zA-Z][\w-]*)\b(?:"[^"]*"|'[^']*'|[^'">])*>/y,i=y(e,(b,v)=>{n.lastIndex=v;let T=n.exec(b);if(!T||/^(?:script|style)$/i.test(T[1]))return-1;return n.lastIndex}),a=[],l=0,c=[];for(let{start:b,end:v,token:T}of i){let P=/^<\/?([\w-]+)/.exec(T)[1].toLowerCase();if(T.startsWith("</")){while(a.length&&a.pop()!==P);continue}if(!a.length&&!/\sdata-stx-slot-owner\s*=/.test(T))c.push(e.slice(l,b),T.replace(/\s*\/?>$/,(M)=>` data-stx-slot-owner="${t}"${M}`)),l=v;if(!er.has(P)&&!/\/>$/.test(T))a.push(P)}return c.push(e.slice(l)),c.join("")}function ao(e,t){if(!/\bref\s*=/.test(e))return e;let n=/<\/?([a-zA-Z][\w-]*)\b(?:"[^"]*"|'[^']*'|[^'">])*>/y,i=y(e,(v,T)=>{n.lastIndex=T;let P=n.exec(v);if(!P||/^(?:script|style)$/i.test(P[1]))return-1;return n.lastIndex}),a=[],l=0,c=0,b=[];for(let{start:v,end:T,token:P}of i){let M=/^<\/?([\w-]+)/.exec(P)[1].toLowerCase();if(P.startsWith("</")){let B;while(B=a.pop()){if(B.scoped)l--;if(B.name===M)break}continue}let H=/\sdata-stx-scope\s*=/.test(P),O=/\sdata-stx-ref-caller\s*=\s*(["'])(.*?)\1/.exec(P),L=a.find((B)=>B.scoped)?.scopeId;if(O&&L&&O[2]===L)b.push(e.slice(c,v),P.replace(O[0],` data-stx-ref-caller="${t}"`)),c=T;else if(!l&&!H&&/\s(?:ref|@ref|:ref|x-ref|data-stx-ref)\s*=/.test(P)&&!/\sdata-stx-ref-caller\s*=/.test(P))b.push(e.slice(c,v),P.replace(/\s*\/?>$/,(B)=>` data-stx-ref-caller="${t}"${B}`)),c=T;if(!er.has(M)&&!/\/>$/.test(P)){let B=/\sdata-stx-scope\s*=\s*(?:"([^"]*)"|'([^']*)')/.exec(P);if(a.push({name:M,scoped:H,scopeId:B?.[1]??B?.[2]}),H)l++}}return b.push(e.slice(c)),b.join("")}var er=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),co=/(?:^|\s)x-no-cloak(?:=|\s|\/|>|$)/,so=/<\/?\s*([a-z][\w-]*)/iy,yl=/\s/;function _l(e,t){let n=t-1;while(n>=0&&yl.test(e[n]))n--;return n>=0&&e[n]==="/"}function wl(e,t){let n=!1,i=!1;for(let a=t;a<e.length;a++){let l=e[a];if(n){if(l==="'")n=!1}else if(i){if(l==='"')i=!1}else if(l==="'")n=!0;else if(l==='"')i=!0;else if(l===">")return a}return-1}function Sl(e,t){if(e.indexOf("{",t)===-1||e.indexOf("}",t)===-1)return!1;let n=0,i=t,a=!1,l=!1,c=!1;while(i<e.length){let b=e.indexOf("<",i),v=b===-1?e.length:b;if(v>i){if(n===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 T=wl(e,i);if(T===-1)break;so.lastIndex=i;let P=so.exec(e)?.[1]?.toLowerCase()??"";if(e[i+1]==="/"){if(n===0)break;n--}else if(!_l(e,T)&&!er.has(P))n++;i=T+1}return!1}var ro=w(256);function Wc(e){if(e.length<1024)return io(e);let t=S(e),n=ro.get(t);if(n!==void 0)return n;let i=io(e);return ro.set(t,i),i}function io(e){if(e.length>=32768&&!ai(e))return e;let n=new RegExp(`<(${"div|span|p|h[1-6]|td|th|li|a|button|label|section|article|header|footer|main|nav|aside|dd|dt|figcaption|summary|caption|blockquote|pre|code|em|strong|small|sub|sup|time|mark|abbr|cite|q|s|u|b|i"})\\b`,"gi"),i="",a=0,l;while((l=n.exec(e))!==null){let c=l.index,b=c+l[0].length,v=!1,T=!1,P=-1;while(b<e.length){let H=e[b];if(v){if(H==="'")v=!1}else if(T){if(H==='"')T=!1}else if(H==="'")v=!0;else if(H==='"')T=!0;else if(H===">"){P=b;break}b++}if(P===-1)continue;let M=e.slice(c,P+1);if(co.test(M))continue;if(M.includes("x-cloak"))continue;if(Sl(e,P+1))i+=e.slice(a,P)+" x-cloak>",a=P+1}return i+=e.slice(a),i}var $l=/(?:^|\s)(?::else-if|:if|:else|:show|x-else-if|x-if|x-else|x-show|@if|@show)(?:=|\s|\/|>|$)/,vl=/<\/script>/gi,El=/<\/style>/gi;function qc(e){let t=/<[a-z][\w-]*/gi,n="",i=0,a;while((a=t.exec(e))!==null){let l=a.index,c=a[0].slice(1).toLowerCase();if(c==="script"||c==="style"){let L=c==="script"?vl:El;L.lastIndex=l;let B=L.exec(e);if(B!==null)t.lastIndex=B.index+B[0].length;continue}let b=l+a[0].length,v=!1,T=!1,P=-1;while(b<e.length){let L=e[b];if(v){if(L==="'")v=!1}else if(T){if(L==='"')T=!1}else if(L==="'")v=!0;else if(L==='"')T=!0;else if(L===">"){P=b;break}b++}if(P===-1)continue;let M=e.slice(l+a[0].length,P);if(co.test(M))continue;if(/(?:^|\s)x-cloak(?:=|\s|\/|>|$)/.test(M))continue;if(!$l.test(M))continue;let H=e[P-1]==="/",O=H?P-1:P;n+=`${e.slice(i,O)} x-cloak${H?" ":""}`,i=O}return n+=e.slice(i),n}import vo from"path";import nr from"fs";import rn from"path";function lo(e,t,n,i){let a=0;for(let l=t;l<e.length;l++)if(e[l]===n)a++;else if(e[l]===i&&!(i===">"&&e[l-1]==="=")){if(--a===0)return l}return-1}function kl(e){let t=s(e),n=0,i=0,a=[];for(let l=0;l<t.length;l++)if("([{".includes(t[l]))n++;else if(")]}".includes(t[l]))n--;else if(t[l]===","&&n===0)a.push(e.slice(i,l).trim()),i=l+1;return a.push(e.slice(i).trim()),a}function tr(e,t){let n=s(e),i=new RegExp(`\\b(?:${t.map((a)=>a.replace(/[$]/g,"\\$&")).join("|")})\\s*(?=[<(])`,"g");for(let a of n.matchAll(i)){let l=a.index+a[0].length,c="";if(n[l]==="<"){let v=lo(n,l,"<",">");if(v<0)continue;c=e.slice(l+1,v),l=v+1;while(/\s/.test(n[l]||"")&&l<n.length)l++}if(n[l]!=="(")continue;let b=lo(n,l,"(",")");if(b>=0)return{type:c,args:kl(e.slice(l+1,b))}}return null}var uo=`
507
+ </script>`}function Uc(e,t,n,i=!1){if(!Js(e))return e;let a=ul(e);if(a.length===0)return e;let l=bl(e,a),c=xl(a,t,i),b=l.lastIndexOf("</body>");if(b!==-1)l=l.slice(0,b)+c+`
508
+ `+l.slice(b);else l+=c;return l}function bl(e,t){let n=[],i=0;for(let[l,c]of no(e).entries()){let b=t[l];if(!b)break;n.push(e.slice(i,c.startIndex));let v=Yn(c.attributes,"data-stx-scope");if(v)b.id=v,b.selector=`[data-stx-scope="${b.id}"]`,n.push(c.fullMatch);else n.push(`<${c.tagName} data-stx-scope="${b.id}"${c.attributes}>`);i=c.endIndex}n.push(e.slice(i));let a=n.join("");return a=a.replace(/\s*x-data\s*=\s*"([^"]*)"/g,' data-stx-xdata="$1"'),a=a.replace(/\s*x-data\s*=\s*'([^']*)'/g," data-stx-xdata='$1'"),a=a.replace(/\s*x-init\s*=\s*"([^"]*)"/g,' data-stx-xinit="$1"'),a=a.replace(/\s*x-init\s*=\s*'([^']*)'/g," data-stx-xinit='$1'"),a=a.replace(/\s*x-destroy\s*=\s*"([^"]*)"/g,' data-stx-xdestroy="$1"'),a=a.replace(/\s*x-destroy\s*=\s*'([^']*)'/g," data-stx-xdestroy='$1'"),a}function Js(e){return/x-data\s*=\s*["']/.test(e)}function Us(e,t){let n=e,i=/@json\s*\(/g,a;while((a=i.exec(n))!==null){let l=a.index,c=l+a[0].length-1,b=1,v=c+1,T=null,P=!1;while(v<n.length&&b>0){let j=n[v];if(P){P=!1,v++;continue}if(j==="\\"&&T){P=!0,v++;continue}if(T){if(j===T)T=null;v++;continue}if(j==='"'||j==="'"||j==="`"){T=j,v++;continue}if(j==="(")b++;else if(j===")"){if(b--,b===0)break}v++}if(b!==0)break;let M=n.substring(c+1,v).trim(),H=n.substring(l,v+1),O=-1,L=0,B=null,F=!1;for(let j=0;j<M.length;j++){let te=M[j];if(F){F=!1;continue}if(te==="\\"&&B){F=!0;continue}if(B){if(te===B)B=null;continue}if(te==='"'||te==="'"||te==="`"){B=te;continue}if(te==="("||te==="["||te==="{")L++;else if(te===")"||te==="]"||te==="}")L--;if(te===","&&L===0){O=j;break}}let ee=O>=0?M.substring(0,O).trim():M,G=O>=0?M.substring(O+1).trim():void 0;try{let j=ee.trim(),te;if(f(j))te=d(j,Object.keys(t))(...Object.values(t));else te=void 0;let se;if(G==="true")se=JSON.stringify(te,null,2);else se=JSON.stringify(te);let ne=se.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029");n=n.substring(0,l)+ne+n.substring(v+1),i.lastIndex=l+ne.length}catch(j){z.log(j instanceof Error?j:Error(String(j)),{directive:"@json"},"error"),i.lastIndex=l+H.length}}return n}function Ws(e){return e.replace(/@once\s*([\s\S]*?)@endonce/g,"$1")}function Wc(e){let t=e,n=/@memo\s*\(/g,i,a=[];while((i=n.exec(t))!==null){let l=i.index,c=l+i[0].length,b=1,v=c;while(v<t.length&&b>0){if(t[v]==="(")b++;else if(t[v]===")")b--;v++}if(b!==0)continue;let T=t.slice(c,v-1).trim(),P=v,M=t.slice(P),H=M.indexOf("@endmemo");if(H===-1)continue;let O=M.slice(0,H),L=P+H+8,B=Pt(O),F=O.slice(B),ee=O.match(/(\s*)$/),G=ee?ee[0].length:0,j=F.slice(0,F.length-G),te=j.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)?(\/?)>/),se;if(te){let[ne,ue,ye="",de]=te,Ae=`<${ue}${ye} data-stx-memo="${T}"${de}>`;se=O.slice(0,B)+Ae+j.slice(ne.length)+O.slice(B+j.length)}else se=`${O.slice(0,B)}<div data-stx-memo="${T}">${j}</div>${O.slice(B+j.length)}`;a.push({start:l,end:L,replacement:se}),n.lastIndex=L}for(let l=a.length-1;l>=0;l--){let c=a[l];t=t.slice(0,c.start)+c.replacement+t.slice(c.end)}return t.replace(/@memo="([^"]*)"/g,'data-stx-memo="$1"')}function yi(e){let t=e.replace(/@ref="([^"]+)"/g,'data-stx-ref="$1"');return t=t.replace(/(<[a-zA-Z][a-zA-Z0-9-]*\b[^>]*?)\sref="([^"]+)"/g,'$1 data-stx-ref="$2"'),t}function oo(e,t){let n=/<\/?([a-zA-Z][\w-]*)\b(?:"[^"]*"|'[^']*'|[^'">])*>/y,i=y(e,(b,v)=>{n.lastIndex=v;let T=n.exec(b);if(!T||/^(?:script|style)$/i.test(T[1]))return-1;return n.lastIndex}),a=[],l=0,c=[];for(let{start:b,end:v,token:T}of i){let P=/^<\/?([\w-]+)/.exec(T)[1].toLowerCase();if(T.startsWith("</")){while(a.length&&a.pop()!==P);continue}if(!a.length&&!/\sdata-stx-slot-owner\s*=/.test(T))c.push(e.slice(l,b),T.replace(/\s*\/?>$/,(M)=>` data-stx-slot-owner="${t}"${M}`)),l=v;if(!Ys.has(P)&&!/\/>$/.test(T))a.push(P)}return c.push(e.slice(l)),c.join("")}function ao(e,t){if(!/\bref\s*=/.test(e))return e;let n=/<\/?([a-zA-Z][\w-]*)\b(?:"[^"]*"|'[^']*'|[^'">])*>/y,i=y(e,(v,T)=>{n.lastIndex=T;let P=n.exec(v);if(!P||/^(?:script|style)$/i.test(P[1]))return-1;return n.lastIndex}),a=[],l=0,c=0,b=[];for(let{start:v,end:T,token:P}of i){let M=/^<\/?([\w-]+)/.exec(P)[1].toLowerCase();if(P.startsWith("</")){let B;while(B=a.pop()){if(B.scoped)l--;if(B.name===M)break}continue}let H=/\sdata-stx-scope\s*=/.test(P),O=/\sdata-stx-ref-caller\s*=\s*(["'])(.*?)\1/.exec(P),L=a.find((B)=>B.scoped)?.scopeId;if(O&&L&&O[2]===L)b.push(e.slice(c,v),P.replace(O[0],` data-stx-ref-caller="${t}"`)),c=T;else if(!l&&!H&&/\s(?:ref|@ref|:ref|x-ref|data-stx-ref)\s*=/.test(P)&&!/\sdata-stx-ref-caller\s*=/.test(P))b.push(e.slice(c,v),P.replace(/\s*\/?>$/,(B)=>` data-stx-ref-caller="${t}"${B}`)),c=T;if(!Ys.has(M)&&!/\/>$/.test(P)){let B=/\sdata-stx-scope\s*=\s*(?:"([^"]*)"|'([^']*)')/.exec(P);if(a.push({name:M,scoped:H,scopeId:B?.[1]??B?.[2]}),H)l++}}return b.push(e.slice(c)),b.join("")}var Ys=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),co=/(?:^|\s)x-no-cloak(?:=|\s|\/|>|$)/,so=/<\/?\s*([a-z][\w-]*)/iy,yl=/\s/;function _l(e,t){let n=t-1;while(n>=0&&yl.test(e[n]))n--;return n>=0&&e[n]==="/"}function wl(e,t){let n=!1,i=!1;for(let a=t;a<e.length;a++){let l=e[a];if(n){if(l==="'")n=!1}else if(i){if(l==='"')i=!1}else if(l==="'")n=!0;else if(l==='"')i=!0;else if(l===">")return a}return-1}function Sl(e,t){if(e.indexOf("{",t)===-1||e.indexOf("}",t)===-1)return!1;let n=0,i=t,a=!1,l=!1,c=!1;while(i<e.length){let b=e.indexOf("<",i),v=b===-1?e.length:b;if(v>i){if(n===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 T=wl(e,i);if(T===-1)break;so.lastIndex=i;let P=so.exec(e)?.[1]?.toLowerCase()??"";if(e[i+1]==="/"){if(n===0)break;n--}else if(!_l(e,T)&&!Ys.has(P))n++;i=T+1}return!1}var ro=w(256);function qc(e){if(e.length<1024)return io(e);let t=S(e),n=ro.get(t);if(n!==void 0)return n;let i=io(e);return ro.set(t,i),i}function io(e){if(e.length>=32768&&!oi(e))return e;let n=new RegExp(`<(${"div|span|p|h[1-6]|td|th|li|a|button|label|section|article|header|footer|main|nav|aside|dd|dt|figcaption|summary|caption|blockquote|pre|code|em|strong|small|sub|sup|time|mark|abbr|cite|q|s|u|b|i"})\\b`,"gi"),i="",a=0,l;while((l=n.exec(e))!==null){let c=l.index,b=c+l[0].length,v=!1,T=!1,P=-1;while(b<e.length){let H=e[b];if(v){if(H==="'")v=!1}else if(T){if(H==='"')T=!1}else if(H==="'")v=!0;else if(H==='"')T=!0;else if(H===">"){P=b;break}b++}if(P===-1)continue;let M=e.slice(c,P+1);if(co.test(M))continue;if(M.includes("x-cloak"))continue;if(Sl(e,P+1))i+=e.slice(a,P)+" x-cloak>",a=P+1}return i+=e.slice(a),i}var $l=/(?:^|\s)(?::else-if|:if|:else|:show|x-else-if|x-if|x-else|x-show|@if|@show)(?:=|\s|\/|>|$)/,vl=/<\/script>/gi,El=/<\/style>/gi;function Kc(e){let t=/<[a-z][\w-]*/gi,n="",i=0,a;while((a=t.exec(e))!==null){let l=a.index,c=a[0].slice(1).toLowerCase();if(c==="script"||c==="style"){let L=c==="script"?vl:El;L.lastIndex=l;let B=L.exec(e);if(B!==null)t.lastIndex=B.index+B[0].length;continue}let b=l+a[0].length,v=!1,T=!1,P=-1;while(b<e.length){let L=e[b];if(v){if(L==="'")v=!1}else if(T){if(L==='"')T=!1}else if(L==="'")v=!0;else if(L==='"')T=!0;else if(L===">"){P=b;break}b++}if(P===-1)continue;let M=e.slice(l+a[0].length,P);if(co.test(M))continue;if(/(?:^|\s)x-cloak(?:=|\s|\/|>|$)/.test(M))continue;if(!$l.test(M))continue;let H=e[P-1]==="/",O=H?P-1:P;n+=`${e.slice(i,O)} x-cloak${H?" ":""}`,i=O}return n+=e.slice(i),n}import vo from"path";import tr from"fs";import rn from"path";function lo(e,t,n,i){let a=0;for(let l=t;l<e.length;l++)if(e[l]===n)a++;else if(e[l]===i&&!(i===">"&&e[l-1]==="=")){if(--a===0)return l}return-1}function kl(e){let t=s(e),n=0,i=0,a=[];for(let l=0;l<t.length;l++)if("([{".includes(t[l]))n++;else if(")]}".includes(t[l]))n--;else if(t[l]===","&&n===0)a.push(e.slice(i,l).trim()),i=l+1;return a.push(e.slice(i).trim()),a}function er(e,t){let n=s(e),i=new RegExp(`\\b(?:${t.map((a)=>a.replace(/[$]/g,"\\$&")).join("|")})\\s*(?=[<(])`,"g");for(let a of n.matchAll(i)){let l=a.index+a[0].length,c="";if(n[l]==="<"){let v=lo(n,l,"<",">");if(v<0)continue;c=e.slice(l+1,v),l=v+1;while(/\s/.test(n[l]||"")&&l<n.length)l++}if(n[l]!=="(")continue;let b=lo(n,l,"(",")");if(b>=0)return{type:c,args:kl(e.slice(l+1,b))}}return null}var uo=`
509
509
  type __StxCtor<T> = T extends StringConstructor ? string : T extends NumberConstructor ? number : T extends BooleanConstructor ? boolean : T extends ArrayConstructor ? unknown[] : T extends ObjectConstructor ? object : T extends readonly unknown[] ? __StxCtor<T[number]> : T extends abstract new (...args: any[]) => infer V ? V : unknown;
510
510
  type __StxWiden<T> = T extends string ? string : T extends number ? number : T extends boolean ? boolean : T;
511
511
  type __StxOption<T> = T extends { type: infer C } ? __StxCtor<C> : T extends { default: infer D } ? D extends (...args: any[]) => infer V ? V : __StxWiden<D> : __StxCtor<T>;
@@ -514,64 +514,64 @@ type __StxDefaulted<O> = { [K in keyof O]-?: O[K] extends { default: unknown } ?
514
514
  type __StxOptions<O> = { [K in Exclude<__StxRequired<O>, __StxDefaulted<O>>]: __StxOption<O[K]> } & { [K in Exclude<keyof O, Exclude<__StxRequired<O>, __StxDefaulted<O>>>]?: __StxOption<O[K]> };
515
515
  type __StxDefaults<P, K> = Omit<P, Extract<keyof P, K>> & Partial<Pick<P, Extract<keyof P, K>>>;
516
516
  `;function fo(e,t){let n=[],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,(H,O,L,B,F)=>{if(a.slice(F,F+6)!=="import")return H;if(B.endsWith(".stx"))return"";let ee=`${t}Import${n.length}`;if(n.push(`import * as ${ee} from ${JSON.stringify(B)};`),O.startsWith("*"))return`import ${O.replace(/^\*\s+as\s+/,"")} = ${ee};`;if(!O.startsWith("{"))return`import ${O} = ${ee}.default;`;return O.slice(1,-1).split(",").map((G)=>{let[j,te=j]=G.trim().replace(/^type\s+/,"").split(/\s+as\s+/);if(!j)return"";if(/^(?:stx|@stacksjs\/stx)(?:\/|$)/.test(B)&&j in i)i[j].push(te);return`import ${te} = ${ee}.${j};`}).join(`
517
- `)}),c=tr(e,i.defineProps),b=tr(e,i.defineEmits),v=tr(e,i.withDefaults);if(!c&&!b)return{declarations:"",props:null,events:null};let T=[],P=null,M=null;if(c){T.push(`const __options = (${c.args[0]||"{}"}) as const;`),T.push(`const __defaults = (${v?.args[1]||"{}"});`);let H=c.type||"__StxOptions<typeof __options>";T.push(`export type __StxProps = __StxDefaults<${H}, keyof typeof __defaults | __StxDefaulted<typeof __options>>;`),P=`${t}.__StxProps`}if(b)T.push(`const __events = (${b.args[0]||"[]"}) as const;`),T.push(`export type __StxEvents = ${b.type||"Record<(typeof __events)[number], any[]>"};`),M=`${t}.__StxEvents`;return{declarations:`${n.join(`
517
+ `)}),c=er(e,i.defineProps),b=er(e,i.defineEmits),v=er(e,i.withDefaults);if(!c&&!b)return{declarations:"",props:null,events:null};let T=[],P=null,M=null;if(c){T.push(`const __options = (${c.args[0]||"{}"}) as const;`),T.push(`const __defaults = (${v?.args[1]||"{}"});`);let H=c.type||"__StxOptions<typeof __options>";T.push(`export type __StxProps = __StxDefaults<${H}, keyof typeof __defaults | __StxDefaulted<typeof __options>>;`),P=`${t}.__StxProps`}if(b)T.push(`const __events = (${b.args[0]||"[]"}) as const;`),T.push(`export type __StxEvents = ${b.type||"Record<(typeof __events)[number], any[]>"};`),M=`${t}.__StxEvents`;return{declarations:`${n.join(`
518
518
  `)}
519
519
  namespace ${t} {
520
520
  ${l}
521
521
  ${T.join(`
522
522
  `)}
523
- }`,props:P,events:M}}var _r=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 Cr(e){if(e.includes("-")||e==="component")return!1;if(/^[A-Z]/.test(e))return!/[a-z]/.test(e)&&[..._r].some((t)=>t.toLowerCase()===e.toLowerCase());return _r.has(e)||/[A-Z]/.test(e)}function*Cl(e){let t=/<([A-Za-z][\w.-]*)(?=[\s/>])/g,n;while(n=t.exec(e)){let i=t.lastIndex,a=[];while(i<e.length){while(/\s/.test(e[i]||""))i++;if(e[i]===">"||e.slice(i,i+2)==="/>"){i+=e[i]===">"?1:2;break}let 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 b=e[i],v=b==="{",T=b==='"'||b==="'";if(T||v)i++;let P=i;if(v){let M=s(e.slice(i)),H=1,O=0;for(;O<M.length;O++){if(M[O]==="{")H++;if(M[O]==="}"&&--H===0)break}i+=O}else if(T)while(i<e.length&&e[i]!==b)i++;else while(i<e.length&&!/[\s/>]/.test(e[i]))i++;if(a.push({name:l,value:e.slice(P,i),offset:P,braced:v}),T||v)i++}t.lastIndex=i,yield{name:n[1],offset:n.index,attributes:a}}}function po(e,t,n){let i=[],a=[uo,"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,b=new Map,v=n.scriptCode(e,n.filePath),T=s(v);for(let L of v.matchAll(/\bimport\s+(\{[^}]+\}|[\w$]+)\s+from\s*['"]([^'"]+)['"]/g)){if(T.slice(L.index,L.index+6)!=="import")continue;let B=L[2],F=rn.isAbsolute(B)||B.startsWith(".")?rn.resolve(rn.dirname(n.filePath),B):Ds(B,rn.dirname(n.filePath));if(!F)continue;let ee=F.endsWith(".stx")?F:nr.existsSync(`${F}.stx`)?`${F}.stx`:void 0,G=ee?null:wr(F,!1),j=L[1].startsWith("{")?L[1].slice(1,-1).split(","):[L[1]];for(let te of j){let[se,ne=se]=te.trim().split(/\s+as\s+/),ue=ee||G?.get(se)||G?.get(se.toLowerCase());if(ue)b.set(ne,ue),b.set(ne.toLowerCase(),ue),b.set(ne.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),ue)}}for(let L of t.matchAll(/@import\s*\(([^)]+)\)/g))for(let B of L[1].matchAll(/['"]([^'"]+)['"]/g)){let F=Ms(B[1],n.filePath,n).find((ee)=>nr.statSync(ee,{throwIfNoEntry:!1})?.isFile());if(F)b.set(rn.basename(B[1]).replace(/\.stx$/,""),F)}let P={__importedComponents:b},M=new Map,H=(L,B,F)=>{let ee=e.slice(0,L);return{code:B,offset:L,attribute:F,anchor:!0,kind:"directive",line:ee.split(`
523
+ }`,props:P,events:M}}var Cr=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 Er(e){if(e.includes("-")||e==="component")return!1;if(/^[A-Z]/.test(e))return!/[a-z]/.test(e)&&[...Cr].some((t)=>t.toLowerCase()===e.toLowerCase());return Cr.has(e)||/[A-Z]/.test(e)}function*Cl(e){let t=/<([A-Za-z][\w.-]*)(?=[\s/>])/g,n;while(n=t.exec(e)){let i=t.lastIndex,a=[];while(i<e.length){while(/\s/.test(e[i]||""))i++;if(e[i]===">"||e.slice(i,i+2)==="/>"){i+=e[i]===">"?1:2;break}let 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 b=e[i],v=b==="{",T=b==='"'||b==="'";if(T||v)i++;let P=i;if(v){let M=s(e.slice(i)),H=1,O=0;for(;O<M.length;O++){if(M[O]==="{")H++;if(M[O]==="}"&&--H===0)break}i+=O}else if(T)while(i<e.length&&e[i]!==b)i++;else while(i<e.length&&!/[\s/>]/.test(e[i]))i++;if(a.push({name:l,value:e.slice(P,i),offset:P,braced:v}),T||v)i++}t.lastIndex=i,yield{name:n[1],offset:n.index,attributes:a}}}function po(e,t,n){let i=[],a=[uo,"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,b=new Map,v=n.scriptCode(e,n.filePath),T=s(v);for(let L of v.matchAll(/\bimport\s+(\{[^}]+\}|[\w$]+)\s+from\s*['"]([^'"]+)['"]/g)){if(T.slice(L.index,L.index+6)!=="import")continue;let B=L[2],F=rn.isAbsolute(B)||B.startsWith(".")?rn.resolve(rn.dirname(n.filePath),B):Ms(B,rn.dirname(n.filePath));if(!F)continue;let ee=F.endsWith(".stx")?F:tr.existsSync(`${F}.stx`)?`${F}.stx`:void 0,G=ee?null:vr(F,!1),j=L[1].startsWith("{")?L[1].slice(1,-1).split(","):[L[1]];for(let te of j){let[se,ne=se]=te.trim().split(/\s+as\s+/),ue=ee||G?.get(se)||G?.get(se.toLowerCase());if(ue)b.set(ne,ue),b.set(ne.toLowerCase(),ue),b.set(ne.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),ue)}}for(let L of t.matchAll(/@import\s*\(([^)]+)\)/g))for(let B of L[1].matchAll(/['"]([^'"]+)['"]/g)){let F=Ls(B[1],n.filePath,n).find((ee)=>tr.statSync(ee,{throwIfNoEntry:!1})?.isFile());if(F)b.set(rn.basename(B[1]).replace(/\.stx$/,""),F)}let P={__importedComponents:b},M=new Map,H=(L,B,F)=>{let ee=e.slice(0,L);return{code:B,offset:L,attribute:F,anchor:!0,kind:"directive",line:ee.split(`
524
524
  `).length,column:L-ee.lastIndexOf(`
525
- `)}},O=(L,B,F)=>i.push({expression:L,statement:{text:B+L.code+F,prefixLength:B.length}});for(let L of Cl(t)){if(Cr(L.name)||L.name==="component")continue;let B=Br(L.name,n.filePath,n,P);if(!B)continue;let F=M.get(B);if(!F){let G;try{G=n.readComponent?n.readComponent(B):nr.readFileSync(B,"utf8")}catch{continue}if(G===void 0)continue;c.set(B,G),F=fo(n.scriptCode(G,B),`__StxComponent${M.size}`),M.set(B,F),a.push(F.declarations)}let ee=[];for(let G of L.attributes){let{name:j,offset:te}=G,se=G.value===!0?"true":G.value;if(j.startsWith("@")||j.startsWith("v-on:")){if(F.events&&G.value!==!0)l.set(te,`__StxEvent<${F.events}, ${JSON.stringify(j.replace(/^@|^v-on:/,"").split(".")[0])}>`);continue}let ne=/^v-model(?::([\w-]+))?(?:\.[\w-]+)*$/.exec(j);if(j.startsWith("v-")&&!j.startsWith("v-bind:")&&!ne)continue;if(/^(?:x-|:)(?:if|for|show|key|else)(?:$|[.:-])/.test(j))continue;let ue=(ne?ne[1]||"modelValue":j.replace(/^:|^v-bind:/,"")).replace(/-([a-z])/g,(Ze,Re)=>Re.toUpperCase());if(ee.push(ue),!F.props)continue;let ye=j.startsWith(":")||j.startsWith("v-bind:")||!!ne||G.braced,de=ye?se:G.value!==!0?JSON.stringify(se):"true",Ae=!ye&&G.value!==!0&&(se==="true"||se==="false");O(H(te,de,j),";void ((",`) satisfies ${Ae?"__StxStaticProp":"__StxProp"}<${F.props}, ${JSON.stringify(ue)}>);`)}if(F.props){let G=[...new Set(ee)].map((te)=>`${JSON.stringify(te)}: undefined as any`).join(", "),j=H(L.offset,`<${L.name}>`);i.push({expression:j,statement:{text:`;void ({ ${G} } satisfies ${F.props} & Record<string, unknown>);`,prefixLength:0}})}}return{declarations:M.size?a.join(`
525
+ `)}},O=(L,B,F)=>i.push({expression:L,statement:{text:B+L.code+F,prefixLength:B.length}});for(let L of Cl(t)){if(Er(L.name)||L.name==="component")continue;let B=zr(L.name,n.filePath,n,P);if(!B)continue;let F=M.get(B);if(!F){let G;try{G=n.readComponent?n.readComponent(B):tr.readFileSync(B,"utf8")}catch{continue}if(G===void 0)continue;c.set(B,G),F=fo(n.scriptCode(G,B),`__StxComponent${M.size}`),M.set(B,F),a.push(F.declarations)}let ee=[];for(let G of L.attributes){let{name:j,offset:te}=G,se=G.value===!0?"true":G.value;if(j.startsWith("@")||j.startsWith("v-on:")){if(F.events&&G.value!==!0)l.set(te,`__StxEvent<${F.events}, ${JSON.stringify(j.replace(/^@|^v-on:/,"").split(".")[0])}>`);continue}let ne=/^v-model(?::([\w-]+))?(?:\.[\w-]+)*$/.exec(j);if(j.startsWith("v-")&&!j.startsWith("v-bind:")&&!ne)continue;if(/^(?:x-|:)(?:if|for|show|key|else)(?:$|[.:-])/.test(j))continue;let ue=(ne?ne[1]||"modelValue":j.replace(/^:|^v-bind:/,"")).replace(/-([a-z])/g,(Ze,Re)=>Re.toUpperCase());if(ee.push(ue),!F.props)continue;let ye=j.startsWith(":")||j.startsWith("v-bind:")||!!ne||G.braced,de=ye?se:G.value!==!0?JSON.stringify(se):"true",Ae=!ye&&G.value!==!0&&(se==="true"||se==="false");O(H(te,de,j),";void ((",`) satisfies ${Ae?"__StxStaticProp":"__StxProp"}<${F.props}, ${JSON.stringify(ue)}>);`)}if(F.props){let G=[...new Set(ee)].map((te)=>`${JSON.stringify(te)}: undefined as any`).join(", "),j=H(L.offset,`<${L.name}>`);i.push({expression:j,statement:{text:`;void ({ ${G} } satisfies ${F.props} & Record<string, unknown>);`,prefixLength:0}})}}return{declarations:M.size?a.join(`
526
526
  `):"",checks:i,events:l,dependencies:c}}var go=/<script(\s[^>]*)?>([\s\S]*?)<\/script>/gi;function Rl(e){let t=(n)=>n.replace(/[^\n]/g," ");return e.replace(/<!--[\s\S]*?-->/g,t).replace(/\{\{--[\s\S]*?--\}\}/g,t)}function Ot(e){let t=[],n=Rl(e);go.lastIndex=0;let i;while((i=go.exec(n))!==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,b=i.index+l,v=i.index+i[0].length-c,T=e.slice(b,v);if(/\bsrc\s*=/.test(a))continue;let P=a.match(/\btype\s*=\s*["']([^"']+)["']/i);if(P&&!/^(?:module|text\/(?:javascript|typescript))$/i.test(P[1]))continue;let M=/\bserver\b/.test(a)?"server":/\bclient\b/.test(a)?"client":"plain",H=on(e,b);t.push({kind:M,code:T,startLine:H,startColumn:an(e,b),offset:b,attrs:a})}return t}function on(e,t){let n=1;for(let i=0;i<t&&i<e.length;i++)if(e.charCodeAt(i)===10)n++;return n}function an(e,t){let n=e.lastIndexOf(`
527
527
  `,t-1)+1;return t-n+1}function Qn(e){let t=e.split(""),n=(a,l)=>{for(let c=a;c<l&&c<t.length;c++)if(t[c]!==`
528
- `)t[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)n(l.index,l.index+l[0].length)}return t.join("")}function Eo(e){let t=0,n="";for(let i=0;i<e.length;i++){let a=e[i];if(n){if(a==="\\"){i++;continue}if(a===n)n="";continue}if(a==='"'||a==="'"||a==="`"){n=a;continue}if(a==="("||a==="["||a==="{"){t++;continue}if(a===")"||a==="]"||a==="}"){t--;continue}if(a==="|"&&t===0){if(e[i+1]==="|"){i++;continue}if(e[i-1]==="|")continue;return e.slice(0,i)}}return e}var ko=new Set([":for","x-for","v-for"]),es=/(?:^|\s)((?::|x-|v-|@)[\w.:-]+)\s*=\s*(["'])([\s\S]*?)\2/g,sr="__stx_interpolated",mo="__StxElement",Co="__StxTemplateValue",Tl=`type ${Co}<T> = T extends { readonly _isSignal: true } | { readonly _isDerived: true } ? (T extends () => infer V ? T & V : T) : T`;function ho(e){return e.replace(/\{\{[\s\S]*?\}\}/g,sr).replace(/\{!![\s\S]*?!!\}/g,sr)}function Al(e,t,n){let i=0;for(let a=t;a<e.length;a++){let l=e[a];if(l==="{"){i++;continue}if(l!=="}"&&l!=="!")continue;if(e.startsWith(n,a)&&i===0)return a;if(l==="}"&&i>0)i--}return-1}function di(e,t,n="0"){let i=`__stxScript${n}`;while((e+t).includes(i))i+="_";let a=new Map,l=[],c=[],b=s(e),v=Po(e),T=[],P=0;for(let F=0;F<b.length;F++){let ee=b.startsWith("{{",F);if(!ee&&!b.startsWith("{!!",F))continue;let G=ee?2:3,j=ee?"}}":"!!}",te=Al(b,F+G,j);if(te<0)continue;let se=F,ne=e.slice(se,te+j.length),ue=ne.slice(G,-j.length);F=te+j.length-1;let ye=c.length,de=ir(v,se),Ae=ir(v,se+(ee?2:3));c.push({code:Eo(ue),...Ae});let Ze=`${i}_${ye}`,Re=ne.split(`
528
+ `)t[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)n(l.index,l.index+l[0].length)}return t.join("")}function Eo(e){let t=0,n="";for(let i=0;i<e.length;i++){let a=e[i];if(n){if(a==="\\"){i++;continue}if(a===n)n="";continue}if(a==='"'||a==="'"||a==="`"){n=a;continue}if(a==="("||a==="["||a==="{"){t++;continue}if(a===")"||a==="]"||a==="}"){t--;continue}if(a==="|"&&t===0){if(e[i+1]==="|"){i++;continue}if(e[i-1]==="|")continue;return e.slice(0,i)}}return e}var ko=new Set([":for","x-for","v-for"]),es=/(?:^|\s)((?::|x-|v-|@)[\w.:-]+)\s*=\s*(["'])([\s\S]*?)\2/g,nr="__stx_interpolated",mo="__StxElement",Co="__StxTemplateValue",Tl=`type ${Co}<T> = T extends { readonly _isSignal: true } | { readonly _isDerived: true } ? (T extends () => infer V ? T & V : T) : T`;function ho(e){return e.replace(/\{\{[\s\S]*?\}\}/g,nr).replace(/\{!![\s\S]*?!!\}/g,nr)}function Al(e,t,n){let i=0;for(let a=t;a<e.length;a++){let l=e[a];if(l==="{"){i++;continue}if(l!=="}"&&l!=="!")continue;if(e.startsWith(n,a)&&i===0)return a;if(l==="}"&&i>0)i--}return-1}function pi(e,t,n="0"){let i=`__stxScript${n}`;while((e+t).includes(i))i+="_";let a=new Map,l=[],c=[],b=s(e),v=Po(e),T=[],P=0;for(let F=0;F<b.length;F++){let ee=b.startsWith("{{",F);if(!ee&&!b.startsWith("{!!",F))continue;let G=ee?2:3,j=ee?"}}":"!!}",te=Al(b,F+G,j);if(te<0)continue;let se=F,ne=e.slice(se,te+j.length),ue=ne.slice(G,-j.length);F=te+j.length-1;let ye=c.length,de=rr(v,se),Ae=rr(v,se+(ee?2:3));c.push({code:Eo(ue),...Ae});let Ze=`${i}_${ye}`,Re=ne.split(`
529
529
  `),Ke=Re[0].length;Re[0]=Ze+" ".repeat(Math.max(0,Ke-Ze.length));for(let et=1;et<Re.length;et++)Re[et]=Re[et].replace(/[^\r]/g," ");let Ye=a.get(de.line)??[],Je=Ye.at(-1),rt=de.column+(Je?Je.generatedEnd-Je.sourceEnd:0);Ye.push({sourceStart:de.column,sourceEnd:de.column+Ke,generatedStart:rt,generatedEnd:rt+Re[0].length}),a.set(de.line,Ye),T.push(e.slice(P,se),Re.join(`
530
530
  `)),P=se+ne.length}T.push(e.slice(P));let M=T.join("");if(!c.length)return{code:M,columns:a,declarations:l};let{imports:H,body:O}=To(t),L=[],B=0;for(let F of H.split(/\n(?=import\b)/)){if(!F.trim())continue;let ee=/^import\s+(?:type\s+)?([\s\S]+?)\s+from\s*(['"][^'"]+['"])/.exec(F);if(!ee){l.push({text:F});continue}let G=`${i}Module${B++}`;l.push({text:`import * as ${G} from ${ee[2]}`});let j=ee[1],te=/\{([\s\S]*?)\}/.exec(j);for(let ye of te?.[1].split(",")??[]){let[de,Ae=de]=ye.trim().replace(/^type\s+/,"").split(/\s+as\s+/);if(de==="default")L.push(`const ${Ae} = ${G}.default; type ${Ae} = import(${ee[2]}).default`);else if(de)L.push(`import ${Ae} = ${G}.${de}`)}let se=j.replace(/\{[\s\S]*?\}/,""),ne=/\*\s+as\s+(\w+)/.exec(se);if(ne)L.push(`import ${ne[1]} = ${G}`);let ue=/^\s*([\w$]+)/.exec(se)?.[1];if(ue)L.push(`const ${ue} = ${G}.default; type ${ue} = import(${ee[2]}).default`)}l.push({text:`namespace ${i}Scope {
531
531
  ${L.join(`
532
532
  `)}
533
533
  export async function read() {
534
- ${Bs(O).replace(/^[ \t]*export[ \t]+(?=(?:const|let|var|function|async|class|interface|type)\b)/gm,"")}
534
+ ${Fs(O).replace(/^[ \t]*export[ \t]+(?=(?:const|let|var|function|async|class|interface|type)\b)/gm,"")}
535
535
  return {`});for(let[F,ee]of c.entries())l.push({text:`value${F}: (`}),l.push({text:ee.code,origin:{line:ee.line,column:ee.column}}),l.push({text:"),"});l.push({text:`}
536
536
  }
537
- }`});for(let F=0;F<c.length;F++)l.push({text:`declare var ${i}_${F}: Awaited<ReturnType<typeof ${i}Scope.read>>['value${F}']`});return{code:M,columns:a,declarations:l}}function xo(e,t){let n=0;for(let i of e){if(t<i.generatedStart)break;if(t<i.generatedEnd)return i.sourceStart+Math.min(t-i.generatedStart,i.sourceEnd-i.sourceStart);n=i.sourceEnd-i.generatedEnd}return t+n}var Il=["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"],Pl=new RegExp(String.raw`^[ \t]*@(?:${Il.join("|")})\b[ \t]*(\([^\n)]*\))?[ \t]*$`,"gm");function Bs(e){return e.replace(Pl,(t)=>t.replace(/[^\n]/g," "))}var bo=new Set(["x-cloak","x-ref","x-transition","x-teleport","v-slot","x-hydrate",":key","x-tooltip","x-tooltip-position"]);function ng(e){let t=Qn(e),n=[],i=/(@?)\{\{([\s\S]*?)\}\}|(@?)\{!!([\s\S]*?)!!\}/g,a;while((a=i.exec(t))!==null){if(a[1]||a[3])continue;let b=a[2]??a[4]??"",v=a[2]!==void 0?2:3,T=Eo(b);if(!T.trim())continue;let P=a.index+v+(T.length-T.trimStart().length);n.push({code:T.trim(),line:on(t,P),column:an(t,P),offset:P,kind:"interpolation"})}let l=/@(if|elseif|else\s+if|unless)\b\s*\(/g;while((a=l.exec(t))!==null){let c=a.index+a[0].length-1,b=0,v=c;for(;v<t.length;v++){let H=t[v];if(H==="(")b++;else if(H===")"){if(b--,b===0)break}}if(b!==0)continue;let T=t.slice(c+1,v),P=T.trim();if(l.lastIndex=v+1,!P)continue;let M=c+1+(T.length-T.trimStart().length);n.push({code:P,line:on(t,M),column:an(t,M),offset:a.index,kind:"condition"})}es.lastIndex=0;while((a=es.exec(t))!==null){let c=a[1],b=a[3]??"",v=c.replace(/\..*$/,"").replace(/^([^:].*?):.*$/,"$1");if(bo.has(v)||bo.has(c))continue;if(!b.trim())continue;let T=a.index+a[0].indexOf(a[2],a[0].indexOf(c)+c.length)+1;if(ko.has(v)){let M=b.match(/\s+(?:in|of)\s+/);if(!M||M.index===void 0)continue;let H=b.slice(M.index+M[0].length),O=M.index+M[0].length+(H.length-H.trimStart().length);n.push({code:ho(H.trim()),line:on(t,T+O),column:an(t,T+O),offset:T+O,kind:"directive",attribute:v});continue}let P=b.length-b.trimStart().length;n.push({code:ho(b.trim()),line:on(t,T+P),column:an(t,T+P),offset:T+P,kind:"directive",attribute:v})}return n.sort((c,b)=>c.line-b.line||c.column-b.column),n}var Ol=2000;function Dl(e,t){let n=0,i=Math.min(e.length,t+Ol);for(let a=t;a<i;a++){let l=e[a];if(l==="(")n++;else if(l===")"){if(n--,n===0)return e.slice(t+1,a)}}return null}function Ml(e){let t=new Map,n=(b,v)=>{let T=b.split(/[,[\]{}()\s]+/).filter(Boolean);for(let P of T){let M=P.replace(/^\.\.\./,"").trim();if(!/^\$?[A-Z_$][\w$]*$/i.test(M))continue;let H=T.length===1?v:void 0,O=t.get(M);if(!O)t.set(M,{name:M,iterable:H});else if(O.iterable!==H)O.iterable=void 0}},i=/^\$?[A-Z_$][\w$]*$/i,a=(b)=>{let v=b.trim();return i.test(v)?v:void 0};for(let b of e.matchAll(/@for(?:each|else)\s*\(/g)){let v=Dl(e,b.index+b[0].length-1);if(v===null)continue;let T=It(v);if(!T)continue;n(T.itemVar.replace(/=>/g," "),a(T.arrayExpr))}for(let b of e.matchAll(/@for\s*\(\s*(?:(?:let|const|var)\s+)?([\w$]+|\[[^\]]*\]|\{[^}]*\})\s+(of|in)\s+([^)]*)/g))n(b[1],b[2]==="of"?a(b[3]):void 0);for(let b of e.matchAll(/@for\s*\(\s*(?:let|const|var)\s+([\w$]+)\s*[=;]/g))n(b[1]);let l=Qn(e);es.lastIndex=0;let c;while((c=es.exec(l))!==null){let b=c[1].replace(/\..*$/,"");if(!ko.has(b))continue;let v=c[3].match(/\s+(?:in|of)\s+/);if(!v||v.index===void 0)continue;n(c[3].slice(0,v.index),a(c[3].slice(v.index+v[0].length)))}for(let b of e.matchAll(/@(?:php|js|ts)\b([\s\S]*?)@end(?:php|js|ts)\b/g))for(let v of b[1].matchAll(/\b(?:const|let|var|function|class)\s+([\w$]+)/g))n(v[1]);return[...t.values()].sort((b,v)=>b.name.localeCompare(v.name))}function Me(e){let t=new Set;for(let n of e.matchAll(/^\s*(?:export\s+)?(?:const|let|var)\s+([\w$]+)/gm))t.add(n[1]);for(let n of e.matchAll(/^\s*(?:export\s+)?(?:async\s+)?function\s*\*?\s*([\w$]+)/gm))t.add(n[1]);for(let n of e.matchAll(/^\s*(?:export\s+)?class\s+([\w$]+)/gm))t.add(n[1]);for(let n of e.matchAll(/^\s*(?:export\s+)?(?:const|let|var)\s*[[{]([^\]}]*)[\]}]/gm))for(let i of n[1].split(",")){let a=i.split(":").pop().split("=")[0].replace(/^\.\.\./,"").trim();if(/^[A-Z_$][\w$]*$/i.test(a))t.add(a)}return[...t].sort()}var rr=["params","query","cookies","host","ip","setResponseStatus","setResponseHeader","notFound","request","url","definePageMeta","defineClientPayload","defineStore","props","$props"],jl={$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 Dc(e=new Set){return[...rr.filter((t)=>!e.has(t)).map((t)=>`declare var ${t}: any`),...Object.entries(jl).filter(([t])=>!e.has(t)).map(([,t])=>t)].join(`
538
- `)}function Mc(e){return new Set([...e.matchAll(/^declare (?:function|const|let|var)\s+([A-Za-z_$][\w$]*)/gm)].map((t)=>t[1]))}function Ro(e){let t=/\bdefineClientPayload\s*\(\s*\{([\s\S]*?)\}\s*\)/g,n,i=!1,a=new Set,l=s(e);while((n=t.exec(l))!==null){i=!0;for(let c of Nl(n[1])){let b=c.split(":")[0].trim();if(/^[A-Za-z_$][\w$]*$/.test(b))a.add(b)}}return i?[...a]:null}function Nl(e){let t=[],n=0,i="";for(let a of e){if(a===","&&n===0){t.push(i),i="";continue}if(a==="("||a==="["||a==="{")n++;else if(a===")"||a==="]"||a==="}")n--;i+=a}return t.push(i),t.filter((a)=>a.trim().length>0)}function To(e){let t=/^[ \t]*import\b[\s\S]*?(?:from\s*['"][^'"]*['"]|['"][^'"]*['"])[ \t]*;?[ \t]*$/gm,n=[],i=e.replace(t,(a)=>(n.push(a.trim()),a.split(`
537
+ }`});for(let F=0;F<c.length;F++)l.push({text:`declare var ${i}_${F}: Awaited<ReturnType<typeof ${i}Scope.read>>['value${F}']`});return{code:M,columns:a,declarations:l}}function xo(e,t){let n=0;for(let i of e){if(t<i.generatedStart)break;if(t<i.generatedEnd)return i.sourceStart+Math.min(t-i.generatedStart,i.sourceEnd-i.sourceStart);n=i.sourceEnd-i.generatedEnd}return t+n}var Il=["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"],Pl=new RegExp(String.raw`^[ \t]*@(?:${Il.join("|")})\b[ \t]*(\([^\n)]*\))?[ \t]*$`,"gm");function Fs(e){return e.replace(Pl,(t)=>t.replace(/[^\n]/g," "))}var bo=new Set(["x-cloak","x-ref","x-transition","x-teleport","v-slot","x-hydrate",":key","x-tooltip","x-tooltip-position"]);function rg(e){let t=Qn(e),n=[],i=/(@?)\{\{([\s\S]*?)\}\}|(@?)\{!!([\s\S]*?)!!\}/g,a;while((a=i.exec(t))!==null){if(a[1]||a[3])continue;let b=a[2]??a[4]??"",v=a[2]!==void 0?2:3,T=Eo(b);if(!T.trim())continue;let P=a.index+v+(T.length-T.trimStart().length);n.push({code:T.trim(),line:on(t,P),column:an(t,P),offset:P,kind:"interpolation"})}let l=/@(if|elseif|else\s+if|unless)\b\s*\(/g;while((a=l.exec(t))!==null){let c=a.index+a[0].length-1,b=0,v=c;for(;v<t.length;v++){let H=t[v];if(H==="(")b++;else if(H===")"){if(b--,b===0)break}}if(b!==0)continue;let T=t.slice(c+1,v),P=T.trim();if(l.lastIndex=v+1,!P)continue;let M=c+1+(T.length-T.trimStart().length);n.push({code:P,line:on(t,M),column:an(t,M),offset:a.index,kind:"condition"})}es.lastIndex=0;while((a=es.exec(t))!==null){let c=a[1],b=a[3]??"",v=c.replace(/\..*$/,"").replace(/^([^:].*?):.*$/,"$1");if(bo.has(v)||bo.has(c))continue;if(!b.trim())continue;let T=a.index+a[0].indexOf(a[2],a[0].indexOf(c)+c.length)+1;if(ko.has(v)){let M=b.match(/\s+(?:in|of)\s+/);if(!M||M.index===void 0)continue;let H=b.slice(M.index+M[0].length),O=M.index+M[0].length+(H.length-H.trimStart().length);n.push({code:ho(H.trim()),line:on(t,T+O),column:an(t,T+O),offset:T+O,kind:"directive",attribute:v});continue}let P=b.length-b.trimStart().length;n.push({code:ho(b.trim()),line:on(t,T+P),column:an(t,T+P),offset:T+P,kind:"directive",attribute:v})}return n.sort((c,b)=>c.line-b.line||c.column-b.column),n}var Ol=2000;function Dl(e,t){let n=0,i=Math.min(e.length,t+Ol);for(let a=t;a<i;a++){let l=e[a];if(l==="(")n++;else if(l===")"){if(n--,n===0)return e.slice(t+1,a)}}return null}function Ml(e){let t=new Map,n=(b,v)=>{let T=b.split(/[,[\]{}()\s]+/).filter(Boolean);for(let P of T){let M=P.replace(/^\.\.\./,"").trim();if(!/^\$?[A-Z_$][\w$]*$/i.test(M))continue;let H=T.length===1?v:void 0,O=t.get(M);if(!O)t.set(M,{name:M,iterable:H});else if(O.iterable!==H)O.iterable=void 0}},i=/^\$?[A-Z_$][\w$]*$/i,a=(b)=>{let v=b.trim();return i.test(v)?v:void 0};for(let b of e.matchAll(/@for(?:each|else)\s*\(/g)){let v=Dl(e,b.index+b[0].length-1);if(v===null)continue;let T=It(v);if(!T)continue;n(T.itemVar.replace(/=>/g," "),a(T.arrayExpr))}for(let b of e.matchAll(/@for\s*\(\s*(?:(?:let|const|var)\s+)?([\w$]+|\[[^\]]*\]|\{[^}]*\})\s+(of|in)\s+([^)]*)/g))n(b[1],b[2]==="of"?a(b[3]):void 0);for(let b of e.matchAll(/@for\s*\(\s*(?:let|const|var)\s+([\w$]+)\s*[=;]/g))n(b[1]);let l=Qn(e);es.lastIndex=0;let c;while((c=es.exec(l))!==null){let b=c[1].replace(/\..*$/,"");if(!ko.has(b))continue;let v=c[3].match(/\s+(?:in|of)\s+/);if(!v||v.index===void 0)continue;n(c[3].slice(0,v.index),a(c[3].slice(v.index+v[0].length)))}for(let b of e.matchAll(/@(?:php|js|ts)\b([\s\S]*?)@end(?:php|js|ts)\b/g))for(let v of b[1].matchAll(/\b(?:const|let|var|function|class)\s+([\w$]+)/g))n(v[1]);return[...t.values()].sort((b,v)=>b.name.localeCompare(v.name))}function Me(e){let t=new Set;for(let n of e.matchAll(/^\s*(?:export\s+)?(?:const|let|var)\s+([\w$]+)/gm))t.add(n[1]);for(let n of e.matchAll(/^\s*(?:export\s+)?(?:async\s+)?function\s*\*?\s*([\w$]+)/gm))t.add(n[1]);for(let n of e.matchAll(/^\s*(?:export\s+)?class\s+([\w$]+)/gm))t.add(n[1]);for(let n of e.matchAll(/^\s*(?:export\s+)?(?:const|let|var)\s*[[{]([^\]}]*)[\]}]/gm))for(let i of n[1].split(",")){let a=i.split(":").pop().split("=")[0].replace(/^\.\.\./,"").trim();if(/^[A-Z_$][\w$]*$/i.test(a))t.add(a)}return[...t].sort()}var sr=["params","query","cookies","host","ip","setResponseStatus","setResponseHeader","notFound","request","url","definePageMeta","defineClientPayload","defineStore","props","$props"],jl={$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 Mc(e=new Set){return[...sr.filter((t)=>!e.has(t)).map((t)=>`declare var ${t}: any`),...Object.entries(jl).filter(([t])=>!e.has(t)).map(([,t])=>t)].join(`
538
+ `)}function Lc(e){return new Set([...e.matchAll(/^declare (?:function|const|let|var)\s+([A-Za-z_$][\w$]*)/gm)].map((t)=>t[1]))}function Ro(e){let t=/\bdefineClientPayload\s*\(\s*\{([\s\S]*?)\}\s*\)/g,n,i=!1,a=new Set,l=s(e);while((n=t.exec(l))!==null){i=!0;for(let c of Nl(n[1])){let b=c.split(":")[0].trim();if(/^[A-Za-z_$][\w$]*$/.test(b))a.add(b)}}return i?[...a]:null}function Nl(e){let t=[],n=0,i="";for(let a of e){if(a===","&&n===0){t.push(i),i="";continue}if(a==="("||a==="["||a==="{")n++;else if(a===")"||a==="]"||a==="}")n--;i+=a}return t.push(i),t.filter((a)=>a.trim().length>0)}function To(e){let t=/^[ \t]*import\b[\s\S]*?(?:from\s*['"][^'"]*['"]|['"][^'"]*['"])[ \t]*;?[ \t]*$/gm,n=[],i=e.replace(t,(a)=>(n.push(a.trim()),a.split(`
539
539
  `).map(()=>"").join(`
540
540
  `)));return{imports:n.join(`
541
541
  `),body:i}}function Ao(e){let t=s(e),n=Array(t.length),i=0;for(let b=0;b<t.length;b++){let v=t[b];if(v==="}"||v===")"||v==="]")i=Math.max(0,i-1);if(n[b]=i,v==="{"||v==="("||v==="[")i++}let a=[],l=/^[ \t]*(?:export[ \t]+)?(interface|type)[ \t]+([A-Za-z_$][\w$]*)/gm,c;while((c=l.exec(t))!==null){if(n[c.index]!==0)continue;let b=c[1],v=c[2],T;if(b==="interface"){let P=t.indexOf("{",c.index);if(P===-1)continue;let M=0;T=-1;for(let H=P;H<t.length;H++)if(t[H]==="{")M++;else if(t[H]==="}"&&--M===0){T=H+1;break}if(T===-1)continue}else{let P=0;T=t.length;for(let M=t.indexOf("=",c.index)+1;M<t.length;M++){let H=t[M];if(H==="{"||H==="["||H==="("||H==="<")P++;else if(H==="}"||H==="]"||H===")"||H===">")P--;else if(P<=0&&(H===";"||H===`
542
- `&&!/[=|&,<([{]\s*$/.test(t.slice(Math.max(0,M-40),M)))){T=H===";"?M+1:M;break}}}a.push({name:v,text:e.slice(c.index,T).replace(/^[ \t]*export[ \t]+/,"")}),l.lastIndex=T}return a}function Ll(e){return new Set(Ao(e).map((t)=>t.name))}function Lc(e,t=""){let n=Ro(e),i=Ll(t),a=Ao(e).filter((T)=>!i.has(T.name)).map((T)=>T.text);if(!n){let T=Me(e).filter((P)=>!At(t,P));if(T.length===0&&a.length===0)return"";return["",`// ${zl}`,...a,...T.map((P)=>`declare var ${P}: any`)].join(`
542
+ `&&!/[=|&,<([{]\s*$/.test(t.slice(Math.max(0,M-40),M)))){T=H===";"?M+1:M;break}}}a.push({name:v,text:e.slice(c.index,T).replace(/^[ \t]*export[ \t]+/,"")}),l.lastIndex=T}return a}function Ll(e){return new Set(Ao(e).map((t)=>t.name))}function jc(e,t=""){let n=Ro(e),i=Ll(t),a=Ao(e).filter((T)=>!i.has(T.name)).map((T)=>T.text);if(!n){let T=Me(e).filter((P)=>!At(t,P));if(T.length===0&&a.length===0)return"";return["",`// ${zl}`,...a,...T.map((P)=>`declare var ${P}: any`)].join(`
543
543
  `)}if(n.length===0)return a.length>0?["",`// ${yo}`,...a].join(`
544
544
  `):"";let{imports:l,body:c}=To(e),b=c.replace(/^[ \t]*export[ \t]+(?=(?:const|let|var|function|async|class)\b)/gm,""),v=["",`// ${yo}`];if(l)v.push(l);return v.push(...a),v.push(`async function ${_o}() {`,b,` return { ${n.join(", ")} }`,"}",`type ${wo} = Awaited<ReturnType<typeof ${_o}>>`,...n.map((T)=>`declare var ${T}: ${wo}[${JSON.stringify(T)}]`)),v.join(`
545
- `)}function pi(e){let n=s(e).split(""),i=0;for(let a=0;a<n.length;a++){let l=n[a];if(l==="{"||l==="("||l==="["){i++;continue}if(l==="}"||l===")"||l==="]"){i=Math.max(0,i-1);continue}if(i>0&&l!==`
546
- `)n[a]=" "}return Me(n.join(""))}function jc(e,t){if(Ro(e)!==null)return[];let n=pi(e),i=Oe(t,new Set(n)),a=new Set(k);return n.filter((l)=>{if(a.has(l))return!1;if(At(t,l))return!1;return i.has(l)})}var yo="stx: types for the declared client payload (#1868)",zl="stx: untyped bridge names \u2014 declare a defineClientPayload to check these (#1868)",_o="__stxServerScope",wo="__StxClientPayload";var So=["$env","$user","$slot","$slots","$attrs","$props","$page","$route","$loop","loop","$errors","$csrf","$native","props","slot"];var Bl=/^\s*[A-Z_$][\w$]*\s*=[^=]/i;function Wl(e){let t=new Map,n=/!|===|!==|==|!=|&&|\|\||<|>|\btypeof\b|\binstanceof\b|\bin\b/;for(let i of e){let a=s(i),{depths:l,balanced:c}=me(a);if(!c)continue;let b=/^([ \t]*(?:export[ \t]+)?const[ \t]+)([A-Za-z_$][\w$]*)[ \t]*(?::[^=\n]+)?=[ \t]*([^\n]+)$/gm;for(let v of a.matchAll(b)){let T=v.index??0;if(l[T+v[1].length]!==0)continue;let P=v[2],M=T+v[0].length-v[3].length,H=i.slice(M,T+v[0].length).trim().replace(/;$/,"").trim(),O=v[3],L=n.test(O)&&!/\bawait\b|=>|\bfunction\b|[{}]/.test(O)&&!/[,+\-*/%&|?:=]$/.test(H)&&me(O).balanced;t.set(P,t.has(P)||!L?null:H)}}return new Map([...t].filter((i)=>i[1]!==null))}function Io(e,t,n=0,i=new Set){if(t.size===0||n>=5)return e;let a=s(e),l="",c=0;for(let b of a.matchAll(/[A-Za-z_$][\w$]*/g)){let v=b.index??0,T=b[0],P=t.get(T);if(!P||i.has(T))continue;let M=a.slice(0,v).trimEnd(),H=a.slice(v+T.length).trimStart();if(M.endsWith(".")||/^:(?!:)/.test(H)&&/[{,]$/.test(M))continue;if(v>0&&/[\w$]/.test(a[v-1]))continue;l+=`${e.slice(c,v)}(${Io(P,t,n+1,new Set([...i,T]))})`,c=v+T.length}return l+e.slice(c)}function Fl(e,t){let n=/@(if|unless|elseif|else|endif|endunless)\b\s*(\()?/g,i=[],a;while((a=n.exec(e))!==null){if(a.index>t)break;let l=a[1];if(a.index===t){if(l==="elseif"){let b=i[i.length-1];if(b?.current)b.seen.push(b.current);if(b)b.current=null}break}if(l==="endif"||l==="endunless"){i.pop();continue}let c="";if(a[2]==="("){let b=0,v=a.index+a[0].length-1,T=v+1;for(;v<e.length;v++){let P=e[v];if(P==="(")b++;else if(P===")"){if(b--,b===0)break}}c=e.slice(T,v).trim(),n.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 b=i[i.length-1];if(!b)continue;if(b.current)b.seen.push(b.current);b.current=l==="elseif"?c:null}}return i.flatMap((l)=>[...l.seen.map((c)=>`!(${c})`),...l.current?[l.current]:[]]).filter(Boolean)}function Vl(e){let t=e.code.trim();if(!t)return null;if(e.attribute?.startsWith("@")){if(Bl.test(t))return null;let i=";(($event: any): void => { ";return{text:`${i}${t} });`,prefixLength:i.length}}let n=";void ((";return{text:`${n}${t}));`,prefixLength:n.length}}var Ul=/(\bfrom\s*|\bimport\s*\(\s*|\bimport\s+)(['"])(\.{1,2}\/[^'"\n]*)\2/g;function $o(e,t){return Fs(e,t).code}function Fs(e,t){let n=new Map;if(!t)return{code:e,columns:n};let i=Po(e),a=[],l=0;for(let c of e.matchAll(Ul)){let b=c.index,[v,T,P,M]=c,H=vo.resolve(t,M).replace(/\\/g,"/"),O=`${T}${P}${H}${P}`;if(a.push(e.slice(l,b),O),l=b+v.length,v.includes(`
547
- `))continue;let L=ir(i,b),B=n.get(L.line)??[],F=B.at(-1),ee=L.column+(F?F.generatedEnd-F.sourceEnd:0);B.push({sourceStart:L.column,sourceEnd:L.column+v.length,generatedStart:ee,generatedEnd:ee+O.length}),n.set(L.line,B)}return a.push(e.slice(l)),{code:a.join(""),columns:n}}function Hl(e,t,n){let i=xo(e.importColumns?.get(t)??[],n);return xo(e.scriptColumns?.get(t)??[],i)}function fi(e){return" ".repeat(Math.max(0,(e.startColumn??1)-1))}function ql(e){let t=new Set,n=s(e);for(let i of n.matchAll(/\bimport\s+(?:type\s+)?([\w$*{}\s,]+?)\s+from\b/g)){let a=i[1],l=/\{([^}]*)\}/.exec(a);for(let T of l?.[1].split(",")??[]){let P=T.trim().replace(/^type\s+/,"").split(/\s+as\s+/).pop()?.trim();if(P&&/^[A-Z_$][\w$]*$/i.test(P))t.add(P)}let c=a.replace(/\{[^}]*\}/,""),b=/\*\s*as\s+([A-Z_$][\w$]*)/i.exec(c);if(b)t.add(b[1]);let v=/^\s*([A-Z_$][\w$]*)/i.exec(c);if(v&&v[1]!=="type")t.add(v[1])}return[...t].sort()}function Bc(e,t={}){let n=Ot(e),i=e.split(`
545
+ `)}function fi(e){let n=s(e).split(""),i=0;for(let a=0;a<n.length;a++){let l=n[a];if(l==="{"||l==="("||l==="["){i++;continue}if(l==="}"||l===")"||l==="]"){i=Math.max(0,i-1);continue}if(i>0&&l!==`
546
+ `)n[a]=" "}return Me(n.join(""))}function Bc(e,t){if(Ro(e)!==null)return[];let n=fi(e),i=Oe(t,new Set(n)),a=new Set(k);return n.filter((l)=>{if(a.has(l))return!1;if(At(t,l))return!1;return i.has(l)})}var yo="stx: types for the declared client payload (#1868)",zl="stx: untyped bridge names \u2014 declare a defineClientPayload to check these (#1868)",_o="__stxServerScope",wo="__StxClientPayload";var So=["$env","$user","$slot","$slots","$attrs","$props","$page","$route","$loop","loop","$errors","$csrf","$native","props","slot"];var Bl=/^\s*[A-Z_$][\w$]*\s*=[^=]/i;function Wl(e){let t=new Map,n=/!|===|!==|==|!=|&&|\|\||<|>|\btypeof\b|\binstanceof\b|\bin\b/;for(let i of e){let a=s(i),{depths:l,balanced:c}=me(a);if(!c)continue;let b=/^([ \t]*(?:export[ \t]+)?const[ \t]+)([A-Za-z_$][\w$]*)[ \t]*(?::[^=\n]+)?=[ \t]*([^\n]+)$/gm;for(let v of a.matchAll(b)){let T=v.index??0;if(l[T+v[1].length]!==0)continue;let P=v[2],M=T+v[0].length-v[3].length,H=i.slice(M,T+v[0].length).trim().replace(/;$/,"").trim(),O=v[3],L=n.test(O)&&!/\bawait\b|=>|\bfunction\b|[{}]/.test(O)&&!/[,+\-*/%&|?:=]$/.test(H)&&me(O).balanced;t.set(P,t.has(P)||!L?null:H)}}return new Map([...t].filter((i)=>i[1]!==null))}function Io(e,t,n=0,i=new Set){if(t.size===0||n>=5)return e;let a=s(e),l="",c=0;for(let b of a.matchAll(/[A-Za-z_$][\w$]*/g)){let v=b.index??0,T=b[0],P=t.get(T);if(!P||i.has(T))continue;let M=a.slice(0,v).trimEnd(),H=a.slice(v+T.length).trimStart();if(M.endsWith(".")||/^:(?!:)/.test(H)&&/[{,]$/.test(M))continue;if(v>0&&/[\w$]/.test(a[v-1]))continue;l+=`${e.slice(c,v)}(${Io(P,t,n+1,new Set([...i,T]))})`,c=v+T.length}return l+e.slice(c)}function Fl(e,t){let n=/@(if|unless|elseif|else|endif|endunless)\b\s*(\()?/g,i=[],a;while((a=n.exec(e))!==null){if(a.index>t)break;let l=a[1];if(a.index===t){if(l==="elseif"){let b=i[i.length-1];if(b?.current)b.seen.push(b.current);if(b)b.current=null}break}if(l==="endif"||l==="endunless"){i.pop();continue}let c="";if(a[2]==="("){let b=0,v=a.index+a[0].length-1,T=v+1;for(;v<e.length;v++){let P=e[v];if(P==="(")b++;else if(P===")"){if(b--,b===0)break}}c=e.slice(T,v).trim(),n.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 b=i[i.length-1];if(!b)continue;if(b.current)b.seen.push(b.current);b.current=l==="elseif"?c:null}}return i.flatMap((l)=>[...l.seen.map((c)=>`!(${c})`),...l.current?[l.current]:[]]).filter(Boolean)}function Vl(e){let t=e.code.trim();if(!t)return null;if(e.attribute?.startsWith("@")){if(Bl.test(t))return null;let i=";(($event: any): void => { ";return{text:`${i}${t} });`,prefixLength:i.length}}let n=";void ((";return{text:`${n}${t}));`,prefixLength:n.length}}var Ul=/(\bfrom\s*|\bimport\s*\(\s*|\bimport\s+)(['"])(\.{1,2}\/[^'"\n]*)\2/g;function $o(e,t){return zs(e,t).code}function zs(e,t){let n=new Map;if(!t)return{code:e,columns:n};let i=Po(e),a=[],l=0;for(let c of e.matchAll(Ul)){let b=c.index,[v,T,P,M]=c,H=vo.resolve(t,M).replace(/\\/g,"/"),O=`${T}${P}${H}${P}`;if(a.push(e.slice(l,b),O),l=b+v.length,v.includes(`
547
+ `))continue;let L=rr(i,b),B=n.get(L.line)??[],F=B.at(-1),ee=L.column+(F?F.generatedEnd-F.sourceEnd:0);B.push({sourceStart:L.column,sourceEnd:L.column+v.length,generatedStart:ee,generatedEnd:ee+O.length}),n.set(L.line,B)}return a.push(e.slice(l)),{code:a.join(""),columns:n}}function Hl(e,t,n){let i=xo(e.importColumns?.get(t)??[],n);return xo(e.scriptColumns?.get(t)??[],i)}function gi(e){return" ".repeat(Math.max(0,(e.startColumn??1)-1))}function ql(e){let t=new Set,n=s(e);for(let i of n.matchAll(/\bimport\s+(?:type\s+)?([\w$*{}\s,]+?)\s+from\b/g)){let a=i[1],l=/\{([^}]*)\}/.exec(a);for(let T of l?.[1].split(",")??[]){let P=T.trim().replace(/^type\s+/,"").split(/\s+as\s+/).pop()?.trim();if(P&&/^[A-Z_$][\w$]*$/i.test(P))t.add(P)}let c=a.replace(/\{[^}]*\}/,""),b=/\*\s*as\s+([A-Z_$][\w$]*)/i.exec(c);if(b)t.add(b[1]);let v=/^\s*([A-Z_$][\w$]*)/i.exec(c);if(v&&v[1]!=="type")t.add(v[1])}return[...t].sort()}function Fc(e,t={}){let n=Ot(e),i=e.split(`
548
548
  `),a=Array.from({length:i.length},()=>""),l=new Map,c=new Map,b=new Map,v=[],T=n.filter((B)=>B.kind==="server").map((B)=>B.code).join(`
549
549
  `),P=t.filePath&&t.templateExpressions!==!1?po(e,Qn(e),{filePath:t.filePath,componentsDir:t.componentsDir,projectRoot:t.projectRoot,readComponent:t.readComponent,scriptCode:(B,F)=>Ot(B).map((ee)=>$o(ee.code,vo.dirname(F))).join(`
550
- `)}):void 0,M=new Set,H=[];for(let[B,F]of n.entries()){let ee=di(fi(F)+F.code,T,String(B));for(let[se,ne]of ee.columns)c.set(F.startLine+se-1,ne);for(let se of ee.declarations)v.push({text:$o(se.text,t.originDir??""),origin:se.origin?{...se.origin,line:se.origin.line+F.startLine-1}:void 0});let G=Bs(ee.code),j=Fs(G,t.originDir??"");for(let[se,ne]of j.columns)b.set(F.startLine+se-1,ne);let te=j.code.split(`
550
+ `)}):void 0,M=new Set,H=[];for(let[B,F]of n.entries()){let ee=pi(gi(F)+F.code,T,String(B));for(let[se,ne]of ee.columns)c.set(F.startLine+se-1,ne);for(let se of ee.declarations)v.push({text:$o(se.text,t.originDir??""),origin:se.origin?{...se.origin,line:se.origin.line+F.startLine-1}:void 0});let G=Fs(ee.code),j=zs(G,t.originDir??"");for(let[se,ne]of j.columns)b.set(F.startLine+se-1,ne);let te=j.code.split(`
551
551
  `);te.forEach((se,ne)=>{let ue=F.startLine-1+ne;if(ue<a.length)a[ue]=se,M.add(ue)}),H.push(F.startLine-1+te.length-1)}for(let B of H){let F=a[B]?.trim()===""?B:B+1;if(F<a.length&&a[F].trim()===""&&(F===B||!M.has(F)))a[F]=";"}let O=(B,F)=>{for(let[ee,G]of B.split(`
552
- `).entries())if(a.push(G),F)l.set(a.length,ee===0?F:{...F,line:F.line+ee,column:1,prefixLength:0})};for(let B of v)O(B.text,B.origin);if(t.globals!==!1){O("");let B=new Set([...n.flatMap((j)=>Me(j.code)),...n.flatMap((j)=>ql(j.code))]),F=(j)=>{if(!B.has(j))O(`declare var ${j}: any`)};if(t.runtimeGlobals!==!1){if(!B.has("window"))O("declare var window: any");for(let j of k)F(j)}let ee=[...new Set([...rr,...Se,...So])].filter((j)=>t.runtimeGlobals!==!1||!k.includes(j));if(t.contextScope==="global"){O("declare global {");for(let j of ee)O(` var ${j}: any`);O("}")}else{for(let j of rr)F(j);for(let j of Se)F(j);for(let j of So)F(j)}O(`declare var ${sr}: any`);let G=new Set(n.flatMap((j)=>Me(j.code)));O(`type ${mo}<T> = T extends readonly (infer E)[] ? E : T extends Iterable<infer E2> ? E2 : any`);for(let j of Ml(e)){if(G.has(j.name))continue;let te=j.iterable&&G.has(j.iterable)?`${mo}<typeof ${j.iterable}>`:"any";O(`declare var ${j.name}: ${te}`)}}if(t.templateExpressions!==!1){if(P?.declarations)for(let F of P.declarations.split(`
553
- `))O(F);let B=ng(e).map((F)=>{let ee=P?.events.get(F.offset??-1);if(ee){F.anchor=!0;let G=F.code.trim(),j=/^([\w$]+)\s*=\s*([^=][\s\S]*)$/.exec(G),te=j?`void ((${j[2]}) satisfies __StxAssignedValue<typeof ${j[1]}>)`:/^[\w$]+(?:\.[\w$]+)*$/.test(G)?`${G} satisfies (($event: ${ee}) => unknown)`:G,se=`;(($event: ${ee}): void => { `;return{expression:F,statement:{text:`${se}${te} });`,prefixLength:se.length}}}return{expression:F,statement:Vl(F)}}).filter((F)=>F.statement!==null);if(B.push(...P?.checks||[]),B.length>0){let F=Qn(e),ee=Gn(F),G=Wl(n.map((ne)=>ne.code)),te=[...new Set(n.flatMap((ne)=>Me(ne.code)))].filter((ne)=>/^[A-Z_$][\w$]*$/i.test(ne)),se=0;if(te.length>0){O(Tl);for(let ne of te)O(`function __StxRead_${ne}() { return ${ne} }`),O(`type __StxT_${ne} = ${Co}<ReturnType<typeof __StxRead_${ne}>>`);O(`;((${te.map((ne)=>`${ne}: __StxT_${ne}`).join(", ")}) => {`),se=1}for(let{expression:ne,statement:ue}of B){let ye=" ".repeat(se),de=ne.offset===void 0?[]:ee.filter((Je)=>ne.offset>=Je.start&&ne.offset<Je.end),Ae=de.map((Je)=>`;((${Je.binding.replace(/[\r\n]/g," ")}: any) => { `).join(""),Ze=" });".repeat(de.length),Re=ne.offset===void 0?[]:Fl(F,ne.offset),Ke=Re.length>0?`${Re.map((Je)=>`if (${Io(Je,G)}) `).join("")}{ `:"",Ye=Re.length>0?" }":"";O(ye+Ae+Ke+ue.text+Ye+Ze,{line:ne.line,column:ne.column,expression:ne,prefixLength:ue.prefixLength+ye.length+Ae.length+Ke.length,guardPrefixLength:ye.length+Ae.length+Ke.length})}if(se>0)O("});")}}let L=!1;if(t.reference&&a[0]!==void 0&&a[0].trim()==="")a[0]=`/// <reference path=${JSON.stringify(t.reference.replace(/\\/g,"/"))} />`,L=!0;return O("export {}"),{text:a.join(`
554
- `),lineMap:l,sourceLineCount:i.length,componentDependencies:P?.dependencies,referenced:L,scriptColumns:c,importColumns:b}}function Po(e){let t=[0];for(let n=0;n<e.length;n++)if(e.charCodeAt(n)===10)t.push(n+1);return t}function ir(e,t){let n=0,i=e.length-1;while(n<i){let a=Math.ceil((n+i)/2);if(e[a]<=t)n=a;else i=a-1}return{line:n+1,column:t-e[n]+1}}function Fc(e,t){if(!e.expression)return!1;return e.inGuard===!0||t===2774}function gi(e,t,n){let i=e.lineMap.get(t);if(!i)return t<=e.sourceLineCount?{line:t,column:Hl(e,t,n)}:null;let a=i.expression?.anchor?0:Math.max(0,n-1-(i.prefixLength??0));return{line:i.line,column:i.column+a,expression:i.expression,inGuard:n<=(i.guardPrefixLength??0)}}var or=w(256),Zl=[{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"}],Oo=/(?:\/\/|\/\*|\{\{--)\s*stx-strict-ignore(-next-line)?([^\n*}]*)/g;function Kl(e){let t=Array.from(e,(a)=>a===`
552
+ `).entries())if(a.push(G),F)l.set(a.length,ee===0?F:{...F,line:F.line+ee,column:1,prefixLength:0})};for(let B of v)O(B.text,B.origin);if(t.globals!==!1){O("");let B=new Set([...n.flatMap((j)=>Me(j.code)),...n.flatMap((j)=>ql(j.code))]),F=(j)=>{if(!B.has(j))O(`declare var ${j}: any`)};if(t.runtimeGlobals!==!1){if(!B.has("window"))O("declare var window: any");for(let j of k)F(j)}let ee=[...new Set([...sr,...Se,...So])].filter((j)=>t.runtimeGlobals!==!1||!k.includes(j));if(t.contextScope==="global"){O("declare global {");for(let j of ee)O(` var ${j}: any`);O("}")}else{for(let j of sr)F(j);for(let j of Se)F(j);for(let j of So)F(j)}O(`declare var ${nr}: any`);let G=new Set(n.flatMap((j)=>Me(j.code)));O(`type ${mo}<T> = T extends readonly (infer E)[] ? E : T extends Iterable<infer E2> ? E2 : any`);for(let j of Ml(e)){if(G.has(j.name))continue;let te=j.iterable&&G.has(j.iterable)?`${mo}<typeof ${j.iterable}>`:"any";O(`declare var ${j.name}: ${te}`)}}if(t.templateExpressions!==!1){if(P?.declarations)for(let F of P.declarations.split(`
553
+ `))O(F);let B=rg(e).map((F)=>{let ee=P?.events.get(F.offset??-1);if(ee){F.anchor=!0;let G=F.code.trim(),j=/^([\w$]+)\s*=\s*([^=][\s\S]*)$/.exec(G),te=j?`void ((${j[2]}) satisfies __StxAssignedValue<typeof ${j[1]}>)`:/^[\w$]+(?:\.[\w$]+)*$/.test(G)?`${G} satisfies (($event: ${ee}) => unknown)`:G,se=`;(($event: ${ee}): void => { `;return{expression:F,statement:{text:`${se}${te} });`,prefixLength:se.length}}}return{expression:F,statement:Vl(F)}}).filter((F)=>F.statement!==null);if(B.push(...P?.checks||[]),B.length>0){let F=Qn(e),ee=Gn(F),G=Wl(n.map((ne)=>ne.code)),te=[...new Set(n.flatMap((ne)=>Me(ne.code)))].filter((ne)=>/^[A-Z_$][\w$]*$/i.test(ne)),se=0;if(te.length>0){O(Tl);for(let ne of te)O(`function __StxRead_${ne}() { return ${ne} }`),O(`type __StxT_${ne} = ${Co}<ReturnType<typeof __StxRead_${ne}>>`);O(`;((${te.map((ne)=>`${ne}: __StxT_${ne}`).join(", ")}) => {`),se=1}for(let{expression:ne,statement:ue}of B){let ye=" ".repeat(se),de=ne.offset===void 0?[]:ee.filter((Je)=>ne.offset>=Je.start&&ne.offset<Je.end),Ae=de.map((Je)=>`;((${Je.binding.replace(/[\r\n]/g," ")}: any) => { `).join(""),Ze=" });".repeat(de.length),Re=ne.offset===void 0?[]:Fl(F,ne.offset),Ke=Re.length>0?`${Re.map((Je)=>`if (${Io(Je,G)}) `).join("")}{ `:"",Ye=Re.length>0?" }":"";O(ye+Ae+Ke+ue.text+Ye+Ze,{line:ne.line,column:ne.column,expression:ne,prefixLength:ue.prefixLength+ye.length+Ae.length+Ke.length,guardPrefixLength:ye.length+Ae.length+Ke.length})}if(se>0)O("});")}}let L=!1;if(t.reference&&a[0]!==void 0&&a[0].trim()==="")a[0]=`/// <reference path=${JSON.stringify(t.reference.replace(/\\/g,"/"))} />`,L=!0;return O("export {}"),{text:a.join(`
554
+ `),lineMap:l,sourceLineCount:i.length,componentDependencies:P?.dependencies,referenced:L,scriptColumns:c,importColumns:b}}function Po(e){let t=[0];for(let n=0;n<e.length;n++)if(e.charCodeAt(n)===10)t.push(n+1);return t}function rr(e,t){let n=0,i=e.length-1;while(n<i){let a=Math.ceil((n+i)/2);if(e[a]<=t)n=a;else i=a-1}return{line:n+1,column:t-e[n]+1}}function zc(e,t){if(!e.expression)return!1;return e.inGuard===!0||t===2774}function mi(e,t,n){let i=e.lineMap.get(t);if(!i)return t<=e.sourceLineCount?{line:t,column:Hl(e,t,n)}:null;let a=i.expression?.anchor?0:Math.max(0,n-1-(i.prefixLength??0));return{line:i.line,column:i.column+a,expression:i.expression,inGuard:n<=(i.guardPrefixLength??0)}}var ir=w(256),Zl=[{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"}],Oo=/(?:\/\/|\/\*|\{\{--)\s*stx-strict-ignore(-next-line)?([^\n*}]*)/g;function Kl(e){let t=Array.from(e,(a)=>a===`
555
555
  `?`
556
556
  `:" "),n=0,i="";while(n<e.length){let a=e[n],l=e[n+1];if(i){if(a==="\\"){n+=2;continue}if(a===i)i="";n++;continue}if(a==='"'||a==="'"||a==="`"){i=a,n++;continue}if(a==="/"&&l==="/"){while(n<e.length&&e[n]!==`
557
557
  `)t[n]=e[n],n++;continue}if(a==="/"&&l==="*"){let c=e.indexOf("*/",n+2),b=c===-1?e.length:c+2;for(;n<b;n++)t[n]=e[n];continue}if(a==="{"&&l==="{"&&e.slice(n,n+4)==="{{--"){let c=e.indexOf("--}}",n+4),b=c===-1?e.length:c+4;for(;n<b;n++)t[n]=e[n];continue}n++}return t.join("")}function Xl(e){let t=new Map,n=Kl(e).split(`
558
558
  `),i=e.split(`
559
- `);return n.forEach((a,l)=>{Oo.lastIndex=0;for(let c of a.matchAll(Oo)){let b=c[1]==="-next-line",v=(i[l]??"").slice(0,c.index).trim(),T=b||v===""?l+2:l+1,M=(c[2]??"").split("--")[0].split(/[\s,]+/).filter(Boolean),H=M.filter((L)=>/\w/.test(L));if(M.length>0&&H.length===0)continue;let O=t.get(T);if(O&&O.size===0)continue;if(H.length===0){t.set(T,new Set);continue}if(O)H.forEach((L)=>O.add(L));else t.set(T,new Set(H))}}),t}function Jl(e,t,n){let i=e.get(t);if(!i)return!1;if(i.size===0)return!0;return[...i].some((a)=>n.includes(a))}function Ne(e,t,n,i){let a=typeof n==="boolean"?{enabled:n,failOnViolation:n}:n??{enabled:!1};if(!a.enabled)return;let l=S(e,t,i,JSON.stringify(a)),c=or.get(l);if(c!==void 0){if(c&&a.failOnViolation)throw new K(c,i??t);return}let b=a.allowPatterns??[],v=Xl(e),T=[],P=s(e.replace(/\{\{--[\s\S]*?--\}\}/g,(L)=>L.replace(/[^\n]/g," ")));for(let{pattern:L,message:B,suggestion:F}of Zl){if(b.some((G)=>/\w/.test(G)&&B.includes(G)))continue;L.lastIndex=0;let ee=P.match(L);if(ee&&ee.length>0){let G=P.split(`
559
+ `);return n.forEach((a,l)=>{Oo.lastIndex=0;for(let c of a.matchAll(Oo)){let b=c[1]==="-next-line",v=(i[l]??"").slice(0,c.index).trim(),T=b||v===""?l+2:l+1,M=(c[2]??"").split("--")[0].split(/[\s,]+/).filter(Boolean),H=M.filter((L)=>/\w/.test(L));if(M.length>0&&H.length===0)continue;let O=t.get(T);if(O&&O.size===0)continue;if(H.length===0){t.set(T,new Set);continue}if(O)H.forEach((L)=>O.add(L));else t.set(T,new Set(H))}}),t}function Jl(e,t,n){let i=e.get(t);if(!i)return!1;if(i.size===0)return!0;return[...i].some((a)=>n.includes(a))}function Ne(e,t,n,i){let a=typeof n==="boolean"?{enabled:n,failOnViolation:n}:n??{enabled:!1};if(!a.enabled)return;let l=S(e,t,i,JSON.stringify(a)),c=ir.get(l);if(c!==void 0){if(c&&a.failOnViolation)throw new K(c,i??t);return}let b=a.allowPatterns??[],v=Xl(e),T=[],P=s(e.replace(/\{\{--[\s\S]*?--\}\}/g,(L)=>L.replace(/[^\n]/g," ")));for(let{pattern:L,message:B,suggestion:F}of Zl){if(b.some((G)=>/\w/.test(G)&&B.includes(G)))continue;L.lastIndex=0;let ee=P.match(L);if(ee&&ee.length>0){let G=P.split(`
560
560
  `),j=e.split(`
561
561
  `),te=[];if(G.forEach((ye,de)=>{if(L.lastIndex=0,L.test(ye)&&!Jl(v,de+1,B))te.push(de+1)}),te.length===0&&G.some((ye)=>(L.lastIndex=0,L.test(ye))))continue;let se=te.length>0?` (script line${te.length>1?"s":""} ${te.join(", ")})`:"",ne=te.slice(0,3).map((ye)=>` ${ye} | ${(j[ye-1]??"").trim().slice(0,100)}`).join(`
562
562
  `),ue=ne?`
563
563
  ${ne}`:"";T.push(` \u2717 ${B}${se}
564
- \u2192 ${F}${ue}`)}}if(T.length===0){or.set(l,"");return}let M=(L)=>{let B=`${process.cwd()}/`;return L.startsWith(B)?L.slice(B.length):L},O=`[STX] DOM API violation in ${i&&i!==t?`${M(i)} (composed into ${M(t)})`:M(t)}:
564
+ \u2192 ${F}${ue}`)}}if(T.length===0){ir.set(l,"");return}let M=(L)=>{let B=`${process.cwd()}/`;return L.startsWith(B)?L.slice(B.length):L},O=`[STX] DOM API violation in ${i&&i!==t?`${M(i)} (composed into ${M(t)})`:M(t)}:
565
565
  ${T.join(`
566
566
  `)}
567
- Tip: prefer useRef(), navigate(), and composables for component code`;if(or.set(l,O),console.warn(O),a.failOnViolation)throw new K(O,i??t)}var Gl=[{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"}],Yl=[{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')"}],Ql=[{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 pg(e){let t=[],n=[];return eu(e,t),tu(e,t,n),nu(e,n),su(e,t),{valid:t.length===0,errors:t,warnings:n}}function eu(e,t){let n=(e.match(/\{\{/g)||[]).length,i=(e.match(/\}\}/g)||[]).length;if(n!==i)t.push({type:"expression",message:`Unclosed expression brackets: found ${n} opening '{{' and ${i} closing '}}'`,suggestion:"Ensure every {{ has a matching }}"})}function tu(e,t,n){for(let i of Gl){let a=new RegExp(`${i.open}(?:\\s|\\()`,"g"),l=new RegExp(i.close,"g"),c=(e.match(a)||[]).length,b=(e.match(l)||[]).length;if(i.altClose){let v=new RegExp(i.altClose,"g");b+=(e.match(v)||[]).length}if(c>b)t.push({type:"directive",message:`Unclosed @${i.name} directive: found ${c} opening and ${b} closing`,suggestion:`Add ${c-b} missing ${i.close} tag(s)`});else if(b>c)n.push({type:"directive",message:`Extra ${i.close} found: ${b-c} more closing than opening`,suggestion:`Check for orphaned ${i.close} tags`})}}function nu(e,t){for(let n of Yl)if(n.pattern.test(e))t.push({type:"syntax",message:n.message,suggestion:n.suggestion})}function su(e,t){for(let n of Ql)if(n.pattern.test(e))t.push({type:"expression",message:`Security warning: ${n.message}`,suggestion:"Remove dangerous code from template expressions"})}function fg(e,t){let n=e.slice(0,t).split(`
568
- `);return{line:n.length,column:n[n.length-1].length+1}}function gg(e,t,n){let i=[];switch(e){case"if":case"elseif":case"unless":if(n.length===0)i.push({type:"syntax",message:`@${e} requires a condition`,suggestion:`Use @${e}(condition)`});break;case"foreach":if(n.length===0||!n[0].includes(" as "))i.push({type:"syntax",message:'@foreach requires "items as item" syntax',suggestion:"Use @foreach(items as item) or @foreach(items as key => value)"});break;case"for":if(n.length===0)i.push({type:"syntax",message:"@for requires loop parameters",suggestion:"Use @for(let i = 0; i < 10; i++)"});break;case"switch":if(n.length===0)i.push({type:"syntax",message:"@switch requires an expression",suggestion:"Use @switch(expression)"});break;case"case":if(n.length===0)i.push({type:"syntax",message:"@case requires a value",suggestion:"Use @case(value)"});break;case"include":case"extends":case"component":if(n.length===0)i.push({type:"syntax",message:`@${e} requires a path`,suggestion:`Use @${e}('path/to/template')`});break}return i}function mg(e){return/@[a-z]+/i.test(e)||/\{\{/.test(e)}function hg(e){let t=e.matchAll(/@([a-z]+)/gi),n=new Set;for(let i of t){let a=i[1].toLowerCase();if(!a.startsWith("end"))n.add(a)}return Array.from(n)}function Do(e,t,n){let i=/^<script\b([^>]*)>/i.exec(e);if(!i||!/(?:^|\s)src\s*=/i.test(i[1]??""))return null;return E(i[0],t,n)+e.slice(i[0].length)}var cn=new R(500),lr=new Map;function Mo(e){try{let t=rs.statSync(e);return`${t.size}:${t.mtimeMs}`}catch{return""}}var ns=new R(1000),ur=new Map,fr=new R(2000),pr=new R(500),Uo=33554432,dr=Uo;function ru(e){let t=e.componentRenderCacheBytes;if(typeof t!=="number"||t<0||t===dr)return;dr=t,ss.setMaxBytes(t)}var ss=new R(2000,{maxBytes:Uo,sizeOf:(e)=>e.output.length});function iu(e){let t=new WeakSet;try{let n=(i)=>{if(i===void 0)return{__stxType:"undefined"};if(typeof i==="bigint")return{__stxType:"bigint",value:i.toString()};if(typeof i==="function"||typeof i==="symbol")throw TypeError("Non-serializable component input");if(i===null||typeof i!=="object")return i;if(t.has(i))throw TypeError("Circular component input");t.add(i);try{if(i instanceof Date)return{__stxType:"date",value:i.toISOString()};if(Array.isArray(i))return i.map(n);let a=Object.getPrototypeOf(i);if(a!==Object.prototype&&a!==null)throw TypeError("Non-plain component input");let l={};for(let c of Object.keys(i).sort())l[c]=n(i[c]);return l}finally{t.delete(i)}};return JSON.stringify(n(e))}catch{return null}}function ou(e){let t={};for(let[n,i]of Object.entries(e))if(!n.startsWith("__")||n==="__stxServeContext")t[n]=i;return t}function ar(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Ws(e){let t=process.cwd(),n=`${t}\x00${e}`,i=jo.get(n);if(i===void 0)i=Bun.hash(Ho(e,t).split(ce.sep).join("/")).toString(36).slice(0,6),jo.set(n,i);return i}var jo=new Map;function Ho(e,t){if(!ce.isAbsolute(e))return e;let n=(i)=>{try{return rs.realpathSync(i)}catch{return i}};return ce.relative(n(t),n(e))}function yg(e){return/\bjs\b/.test(e)||/\blang\s*=\s*["']?(js|javascript)["']?/i.test(e)}function Be(e){return!yg(e)}var ts=new Map;function Z(e){let t;try{t=JSON.stringify(e)}catch{return new Bun.Transpiler(e)}let n=ts.get(t);if(n)return n;if(ts.size>=16)ts.clear();let i=new Bun.Transpiler(e);return ts.set(t,i),i}var No=new WeakMap,au=256;function Fe(e){try{let t=Z({loader:"ts",target:"browser",define:C()}),n=No.get(t);if(!n)n=new Map,No.set(t,n);let i=n.get(e);if(i!==void 0)return i;let a=e.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");a=a.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");let l=[];a=a.replace(/\{!![\s\S]*?!!\}/g,(b)=>{let v=l.length;return l.push(b),`"__STX_EXPR_${v}__"`}),a=a.replace(/\{\{\{[\s\S]*?\}\}\}/g,(b)=>{let v=l.length;return l.push(b),`"__STX_EXPR_${v}__"`}),a=a.replace(/\{\{[\s\S]*?\}\}/g,(b)=>{let v=l.length;return l.push(b),`"__STX_EXPR_${v}__"`});let c=t.transformSync(a);for(let b=0;b<l.length;b++)c=c.replace(`"__STX_EXPR_${b}__"`,l[b]),c=c.replace(`'__STX_EXPR_${b}__'`,l[b]);if(n.size>=au){let b=n.keys().next();if(!b.done)n.delete(b.value)}return n.set(e,c),c}catch(t){if(process.env.STX_DEBUG_TS)console.warn("[STX] TypeScript transpilation error:",t);return e}}function cu(e){let t=[],n=new Set,i=0,a=0,l=e.length,c=(O)=>{a++;while(a<l){if(e[a]==="\\"){a+=2;continue}if(e[a]===O){a++;return}a++}},b=()=>{a++;while(a<l){if(e[a]==="\\"){a+=2;continue}if(e[a]==="`"){a++;return}if(e[a]==="$"&&e[a+1]==="{"){a+=2;let O=1;while(a<l&&O>0)if(e[a]==="{")O++,a++;else if(e[a]==="}")O--,a++;else if(e[a]==="'"||e[a]==='"')c(e[a]);else if(e[a]==="`")b();else a++;continue}a++}},v=()=>{if(e[a]==="/"&&e[a+1]==="/"){while(a<l&&e[a]!==`
567
+ Tip: prefer useRef(), navigate(), and composables for component code`;if(ir.set(l,O),console.warn(O),a.failOnViolation)throw new K(O,i??t)}var Gl=[{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"}],Yl=[{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')"}],Ql=[{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 fg(e){let t=[],n=[];return eu(e,t),tu(e,t,n),nu(e,n),su(e,t),{valid:t.length===0,errors:t,warnings:n}}function eu(e,t){let n=(e.match(/\{\{/g)||[]).length,i=(e.match(/\}\}/g)||[]).length;if(n!==i)t.push({type:"expression",message:`Unclosed expression brackets: found ${n} opening '{{' and ${i} closing '}}'`,suggestion:"Ensure every {{ has a matching }}"})}function tu(e,t,n){for(let i of Gl){let a=new RegExp(`${i.open}(?:\\s|\\()`,"g"),l=new RegExp(i.close,"g"),c=(e.match(a)||[]).length,b=(e.match(l)||[]).length;if(i.altClose){let v=new RegExp(i.altClose,"g");b+=(e.match(v)||[]).length}if(c>b)t.push({type:"directive",message:`Unclosed @${i.name} directive: found ${c} opening and ${b} closing`,suggestion:`Add ${c-b} missing ${i.close} tag(s)`});else if(b>c)n.push({type:"directive",message:`Extra ${i.close} found: ${b-c} more closing than opening`,suggestion:`Check for orphaned ${i.close} tags`})}}function nu(e,t){for(let n of Yl)if(n.pattern.test(e))t.push({type:"syntax",message:n.message,suggestion:n.suggestion})}function su(e,t){for(let n of Ql)if(n.pattern.test(e))t.push({type:"expression",message:`Security warning: ${n.message}`,suggestion:"Remove dangerous code from template expressions"})}function gg(e,t){let n=e.slice(0,t).split(`
568
+ `);return{line:n.length,column:n[n.length-1].length+1}}function mg(e,t,n){let i=[];switch(e){case"if":case"elseif":case"unless":if(n.length===0)i.push({type:"syntax",message:`@${e} requires a condition`,suggestion:`Use @${e}(condition)`});break;case"foreach":if(n.length===0||!n[0].includes(" as "))i.push({type:"syntax",message:'@foreach requires "items as item" syntax',suggestion:"Use @foreach(items as item) or @foreach(items as key => value)"});break;case"for":if(n.length===0)i.push({type:"syntax",message:"@for requires loop parameters",suggestion:"Use @for(let i = 0; i < 10; i++)"});break;case"switch":if(n.length===0)i.push({type:"syntax",message:"@switch requires an expression",suggestion:"Use @switch(expression)"});break;case"case":if(n.length===0)i.push({type:"syntax",message:"@case requires a value",suggestion:"Use @case(value)"});break;case"include":case"extends":case"component":if(n.length===0)i.push({type:"syntax",message:`@${e} requires a path`,suggestion:`Use @${e}('path/to/template')`});break}return i}function hg(e){return/@[a-z]+/i.test(e)||/\{\{/.test(e)}function yg(e){let t=e.matchAll(/@([a-z]+)/gi),n=new Set;for(let i of t){let a=i[1].toLowerCase();if(!a.startsWith("end"))n.add(a)}return Array.from(n)}function Do(e,t,n){let i=/^<script\b([^>]*)>/i.exec(e);if(!i||!/(?:^|\s)src\s*=/i.test(i[1]??""))return null;return E(i[0],t,n)+e.slice(i[0].length)}var cn=new R(500),cr=new Map;function Mo(e){try{let t=rs.statSync(e);return`${t.size}:${t.mtimeMs}`}catch{return""}}var ns=new R(1000),lr=new Map,ur=new R(2000),fr=new R(500),Uo=33554432,pr=Uo;function ru(e){let t=e.componentRenderCacheBytes;if(typeof t!=="number"||t<0||t===pr)return;pr=t,ss.setMaxBytes(t)}var ss=new R(2000,{maxBytes:Uo,sizeOf:(e)=>e.output.length});function iu(e){let t=new WeakSet;try{let n=(i)=>{if(i===void 0)return{__stxType:"undefined"};if(typeof i==="bigint")return{__stxType:"bigint",value:i.toString()};if(typeof i==="function"||typeof i==="symbol")throw TypeError("Non-serializable component input");if(i===null||typeof i!=="object")return i;if(t.has(i))throw TypeError("Circular component input");t.add(i);try{if(i instanceof Date)return{__stxType:"date",value:i.toISOString()};if(Array.isArray(i))return i.map(n);let a=Object.getPrototypeOf(i);if(a!==Object.prototype&&a!==null)throw TypeError("Non-plain component input");let l={};for(let c of Object.keys(i).sort())l[c]=n(i[c]);return l}finally{t.delete(i)}};return JSON.stringify(n(e))}catch{return null}}function ou(e){let t={};for(let[n,i]of Object.entries(e))if(!n.startsWith("__")||n==="__stxServeContext")t[n]=i;return t}function or(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function qs(e){let t=process.cwd(),n=`${t}\x00${e}`,i=jo.get(n);if(i===void 0)i=Bun.hash(Ho(e,t).split(ce.sep).join("/")).toString(36).slice(0,6),jo.set(n,i);return i}var jo=new Map;function Ho(e,t){if(!ce.isAbsolute(e))return e;let n=(i)=>{try{return rs.realpathSync(i)}catch{return i}};return ce.relative(n(t),n(e))}function bg(e){return/\bjs\b/.test(e)||/\blang\s*=\s*["']?(js|javascript)["']?/i.test(e)}function Be(e){return!bg(e)}var ts=new Map;function Z(e){let t;try{t=JSON.stringify(e)}catch{return new Bun.Transpiler(e)}let n=ts.get(t);if(n)return n;if(ts.size>=16)ts.clear();let i=new Bun.Transpiler(e);return ts.set(t,i),i}var No=new WeakMap,au=256;function Fe(e){try{let t=Z({loader:"ts",target:"browser",define:C()}),n=No.get(t);if(!n)n=new Map,No.set(t,n);let i=n.get(e);if(i!==void 0)return i;let a=e.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");a=a.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");let l=[];a=a.replace(/\{!![\s\S]*?!!\}/g,(b)=>{let v=l.length;return l.push(b),`"__STX_EXPR_${v}__"`}),a=a.replace(/\{\{\{[\s\S]*?\}\}\}/g,(b)=>{let v=l.length;return l.push(b),`"__STX_EXPR_${v}__"`}),a=a.replace(/\{\{[\s\S]*?\}\}/g,(b)=>{let v=l.length;return l.push(b),`"__STX_EXPR_${v}__"`});let c=t.transformSync(a);for(let b=0;b<l.length;b++)c=c.replace(`"__STX_EXPR_${b}__"`,l[b]),c=c.replace(`'__STX_EXPR_${b}__'`,l[b]);if(n.size>=au){let b=n.keys().next();if(!b.done)n.delete(b.value)}return n.set(e,c),c}catch(t){if(process.env.STX_DEBUG_TS)console.warn("[STX] TypeScript transpilation error:",t);return e}}function cu(e){let t=[],n=new Set,i=0,a=0,l=e.length,c=(O)=>{a++;while(a<l){if(e[a]==="\\"){a+=2;continue}if(e[a]===O){a++;return}a++}},b=()=>{a++;while(a<l){if(e[a]==="\\"){a+=2;continue}if(e[a]==="`"){a++;return}if(e[a]==="$"&&e[a+1]==="{"){a+=2;let O=1;while(a<l&&O>0)if(e[a]==="{")O++,a++;else if(e[a]==="}")O--,a++;else if(e[a]==="'"||e[a]==='"')c(e[a]);else if(e[a]==="`")b();else a++;continue}a++}},v=()=>{if(e[a]==="/"&&e[a+1]==="/"){while(a<l&&e[a]!==`
569
569
  `)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},T=new Set(["return","typeof","instanceof","in","of","new","delete","void","throw","case","do","else","yield","await"]),P=()=>{let O=a-1;while(O>=0&&/\s/.test(e[O]))O--;if(O<0)return!0;let L=e[O];if("(,=:[!&|?{};+-*%<>~^".includes(L))return!0;if(!/[\w$]/.test(L))return!1;let B=O;while(B>0&&/[\w$]/.test(e[B-1]))B--;return T.has(e.slice(B,O+1))},M=()=>{a++;let O=!1;while(a<l&&e[a]!==`
570
- `){let L=e[a];if(L==="\\"){a+=2;continue}if(L==="[")O=!0;else if(L==="]")O=!1;else if(L==="/"&&!O){a++;while(a<l&&/[a-z]/i.test(e[a]))a++;return}a++}},H=()=>{if(i!==0)return;let O=e.slice(a).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(O){let ee=O[2].split(",").map((G)=>{let j=G.trim().split(":");return j[j.length-1].trim()});for(let G of ee)if(G&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(G)&&!n.has(G))t.push(G),n.add(G);return}let L=e.slice(a).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(L){let ee=L[2];if(!n.has(ee))t.push(ee),n.add(ee);return}let B=e.slice(a).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(B){let ee=B[1];if(!n.has(ee))t.push(ee),n.add(ee);return}let F=e.slice(a).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(F){let ee=F[1];if(!n.has(ee))t.push(ee),n.add(ee)}};while(a<l){if(v())continue;if(e[a]==="'"||e[a]==='"'){c(e[a]);continue}if(e[a]==="`"){b();continue}if(e[a]==="/"&&P()){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])))H();a++}return t}function lu(e){let t=[],n=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==="{")n++;else if(c===")"||c==="]"||c==="}")n--;else if(c===","&&n===0)t.push(e.slice(i,l)),i=l+1}if(i<e.length)t.push(e.slice(i));return t}function uu(e){let t=0,n=null;for(let i=0;i<e.length;i++){let a=e[i];if(n){if(a==="\\"){i++;continue}if(a===n)n=null;continue}if(a==='"'||a==="'"||a==="`"){n=a;continue}if(a==="("||a==="["||a==="{")t++;else if(a===")"||a==="]"||a==="}")t--;else if(a==="="&&t===0){let l=e[i-1],c=e[i+1];if(l==="!"||l==="<"||l===">"||l==="=")continue;if(c==="="||c===">")continue;return i}}return-1}function fu(e,t){try{let n=/=\s*(?:withDefaults\s*\([\s\S]*?defineProps|defineProps)\b/.exec(e);if(!n)return;let i=n.index-1;while(i>=0&&/\s/.test(e[i]))i--;if(e[i]!=="}")return;let a=i,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 b=e.slice(c+1,a);for(let v of lu(b)){let T=v.trim();if(!T||T.startsWith("..."))continue;let P=uu(T);if(P===-1)continue;let M=T.slice(0,P).trim();if(!/^[A-Z_$][\w$]*$/i.test(M))continue;if(t[M]!==void 0)continue;let H=T.slice(P+1).trim();if(!H)continue;try{let O=Object.keys(t).filter(Bt),L=Function(...O,`"use strict"; return (${H});`);t[M]=L(...O.map((B)=>t[B]))}catch{}}}catch{}}var pu=new Set(["tr","td","th","thead","tbody","tfoot","caption","colgroup","col","option","optgroup","li","dt","dd","span"]);function bg(e,t){let n=Pt(e),i=e.slice(n).match(/^<([a-zA-Z][a-zA-Z0-9-]*)/);if(!i)return null;let a=i[1].toLowerCase();if(!pu.has(a))return null;let l=new RegExp(`<\\/?${a}(?=[\\s/>])(?:[^>"']|"[^"]*"|'[^']*')*>`,"iy"),c=y(e,(P,M)=>(l.lastIndex=M,l.exec(P)?.index===M?l.lastIndex:-1));if(a==="span"&&/\sdata-stx-scope\s*=/.test(c[0]?.token||""))return null;let b=0,v=!1;for(let P of c){if(b+=P.token.startsWith("</")?-1:1,b<0)return null;if(b===0){if(e.slice(P.end).trim())return null;v=!0;break}}if(!v)return null;let T=n+i[0].length;return e.slice(0,T)+t+e.slice(T)}function qo(e,t){if(!e)return!1;return[...t.additionalComponentsDirs??[],...t.fallbackComponentsDir?[t.fallbackComponentsDir]:[]].some((i)=>{let a=ce.relative(ce.resolve(i),ce.resolve(e));return!a.startsWith("..")&&!ce.isAbsolute(a)})}async function Tr(e,t,n,i,a){let l=e.endsWith(".stx")?e.slice(0,-4):e,c=(ne)=>ne.split("-").map((ue)=>ue.charAt(0).toUpperCase()+ue.slice(1)).join(""),b=n.__importedComponents;if(b){for(let ne of[l,l.toLowerCase(),c(l),U(l)])if(b.has(ne))return!0}let v=[...new Set([`${l}.stx`,`${c(l)}.stx`,`${U(l)}.stx`])],T=typeof a.root==="string"?ce.resolve(a.root):void 0,P=T??ce.dirname(i),M=[],H=(ne)=>{if(ne&&!M.includes(ne))M.push(ne)};for(let ne of Ln(i,T))H(ne);let O=n.__originalFilePath;if(O)H(ce.join(ce.dirname(O),"components"));if(qo(t,a))H(a._rootComponentsDir);H(t),H(a._rootComponentsDir),H(ce.join(ce.dirname(i),"components")),H(a.componentsDir);for(let ne of a.additionalComponentsDirs??[])H(ne);let L=a._targetComponentFallbackNames?.some((ne)=>ne.toLowerCase()===l.toLowerCase());if(!L)for(let ne of a._targetComponentDirs??[])H(ne);if(T)H(ce.resolve(T,"resources/views/components")),H(ce.resolve(T,"resources/components")),H(ce.resolve(T,"src/components")),H(ce.resolve(T,"components"));for(let ne of a._layerComponentDirs??[])H(ne);let B=a._pluginComponentDirs;if(Array.isArray(B))for(let ne of B)H(typeof ne==="string"?ne:null);if(H(a.fallbackComponentsDir),L)for(let ne of a._targetComponentDirs??[])H(ne);let F=a._nativePrimitivesFallback;if(F&&!F.except.some((ne)=>ne.toLowerCase()===l.toLowerCase()))H(F.dir);if(l.startsWith("./")||l.startsWith("../"))return r(ce.resolve(ce.dirname(i),`${l}.stx`));let ee=Lo(ce.resolve(import.meta.dir,"components")),G=M.map((ne)=>ce.isAbsolute(ne)?ne:ce.resolve(P,ne)),j=`${v.join("\x00")}\x00\x00${G.join("\x00")}`,te=fr.get(j);if(te!==void 0)return te;let se=!1;e:for(let ne of G){if(Lo(ne)===ee)continue;for(let ue of v)if(await r(ce.join(ne,ue))){se=!0;break e}}return fr.set(j,se),se}function Lo(e){let t=pr.get(e);if(t!==void 0)return t;let n=e;try{n=rs.realpathSync(e)}catch{}return pr.set(e,n),n}function wg(e){return e==="visible"||e==="idle"||e==="interaction"||e.startsWith("media:")}function Qc(e){if(!e)return!1;let t=e.replace(/<script[\s\S]*?<\/script>/gi,"").replace(/<style[\s\S]*?<\/style>/gi,"");return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(t)}function du(e,t,n){if(!e.includes("{{")&&!e.includes("{!!"))return e;let i=(a,l)=>{let c;try{c=A(a,t)}catch{return l}if(c===void 0||c===null)return"";let b=String(c);if(/<\/style/i.test(b))return console.warn(`[stx] a <style> expression in ${n??"<unknown>"} evaluated to CSS containing a closing style tag, which would end the element early, so it was dropped rather than emitted.`),"";return b};return e.replace(/\{!!([\s\S]*?)!!\}/g,(a,l)=>i(l,a)).replace(/\{\{([\s\S]*?)\}\}/g,(a,l)=>i(l,a))}var zo=new Set;function Bo(e,t,n,i){let a=`${e}\x00${t}\x00${i??""}`;if(!process.env.STX_DEBUG&&zo.has(a))return;zo.add(a);let l=t?` used in ${t}`:"",c=i?` Cause: ${i}.`:"",b=n.length>0?`
570
+ `){let L=e[a];if(L==="\\"){a+=2;continue}if(L==="[")O=!0;else if(L==="]")O=!1;else if(L==="/"&&!O){a++;while(a<l&&/[a-z]/i.test(e[a]))a++;return}a++}},H=()=>{if(i!==0)return;let O=e.slice(a).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(O){let ee=O[2].split(",").map((G)=>{let j=G.trim().split(":");return j[j.length-1].trim()});for(let G of ee)if(G&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(G)&&!n.has(G))t.push(G),n.add(G);return}let L=e.slice(a).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(L){let ee=L[2];if(!n.has(ee))t.push(ee),n.add(ee);return}let B=e.slice(a).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(B){let ee=B[1];if(!n.has(ee))t.push(ee),n.add(ee);return}let F=e.slice(a).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(F){let ee=F[1];if(!n.has(ee))t.push(ee),n.add(ee)}};while(a<l){if(v())continue;if(e[a]==="'"||e[a]==='"'){c(e[a]);continue}if(e[a]==="`"){b();continue}if(e[a]==="/"&&P()){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])))H();a++}return t}function lu(e){let t=[],n=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==="{")n++;else if(c===")"||c==="]"||c==="}")n--;else if(c===","&&n===0)t.push(e.slice(i,l)),i=l+1}if(i<e.length)t.push(e.slice(i));return t}function uu(e){let t=0,n=null;for(let i=0;i<e.length;i++){let a=e[i];if(n){if(a==="\\"){i++;continue}if(a===n)n=null;continue}if(a==='"'||a==="'"||a==="`"){n=a;continue}if(a==="("||a==="["||a==="{")t++;else if(a===")"||a==="]"||a==="}")t--;else if(a==="="&&t===0){let l=e[i-1],c=e[i+1];if(l==="!"||l==="<"||l===">"||l==="=")continue;if(c==="="||c===">")continue;return i}}return-1}function fu(e,t){try{let n=/=\s*(?:withDefaults\s*\([\s\S]*?defineProps|defineProps)\b/.exec(e);if(!n)return;let i=n.index-1;while(i>=0&&/\s/.test(e[i]))i--;if(e[i]!=="}")return;let a=i,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 b=e.slice(c+1,a);for(let v of lu(b)){let T=v.trim();if(!T||T.startsWith("..."))continue;let P=uu(T);if(P===-1)continue;let M=T.slice(0,P).trim();if(!/^[A-Z_$][\w$]*$/i.test(M))continue;if(t[M]!==void 0)continue;let H=T.slice(P+1).trim();if(!H)continue;try{let O=Object.keys(t).filter(Bt),L=Function(...O,`"use strict"; return (${H});`);t[M]=L(...O.map((B)=>t[B]))}catch{}}}catch{}}var pu=new Set(["tr","td","th","thead","tbody","tfoot","caption","colgroup","col","option","optgroup","li","dt","dd","span"]);function wg(e,t){let n=Pt(e),i=e.slice(n).match(/^<([a-zA-Z][a-zA-Z0-9-]*)/);if(!i)return null;let a=i[1].toLowerCase();if(!pu.has(a))return null;let l=new RegExp(`<\\/?${a}(?=[\\s/>])(?:[^>"']|"[^"]*"|'[^']*')*>`,"iy"),c=y(e,(P,M)=>(l.lastIndex=M,l.exec(P)?.index===M?l.lastIndex:-1));if(a==="span"&&/\sdata-stx-scope\s*=/.test(c[0]?.token||""))return null;let b=0,v=!1;for(let P of c){if(b+=P.token.startsWith("</")?-1:1,b<0)return null;if(b===0){if(e.slice(P.end).trim())return null;v=!0;break}}if(!v)return null;let T=n+i[0].length;return e.slice(0,T)+t+e.slice(T)}function qo(e,t){if(!e)return!1;return[...t.additionalComponentsDirs??[],...t.fallbackComponentsDir?[t.fallbackComponentsDir]:[]].some((i)=>{let a=ce.relative(ce.resolve(i),ce.resolve(e));return!a.startsWith("..")&&!ce.isAbsolute(a)})}async function $r(e,t,n,i,a){let l=e.endsWith(".stx")?e.slice(0,-4):e,c=(ne)=>ne.split("-").map((ue)=>ue.charAt(0).toUpperCase()+ue.slice(1)).join(""),b=n.__importedComponents;if(b){for(let ne of[l,l.toLowerCase(),c(l),U(l)])if(b.has(ne))return!0}let v=[...new Set([`${l}.stx`,`${c(l)}.stx`,`${U(l)}.stx`])],T=typeof a.root==="string"?ce.resolve(a.root):void 0,P=T??ce.dirname(i),M=[],H=(ne)=>{if(ne&&!M.includes(ne))M.push(ne)};for(let ne of Ln(i,T))H(ne);let O=n.__originalFilePath;if(O)H(ce.join(ce.dirname(O),"components"));if(qo(t,a))H(a._rootComponentsDir);H(t),H(a._rootComponentsDir),H(ce.join(ce.dirname(i),"components")),H(a.componentsDir);for(let ne of a.additionalComponentsDirs??[])H(ne);let L=a._targetComponentFallbackNames?.some((ne)=>ne.toLowerCase()===l.toLowerCase());if(!L)for(let ne of a._targetComponentDirs??[])H(ne);if(T)H(ce.resolve(T,"resources/views/components")),H(ce.resolve(T,"resources/components")),H(ce.resolve(T,"src/components")),H(ce.resolve(T,"components"));for(let ne of a._layerComponentDirs??[])H(ne);let B=a._pluginComponentDirs;if(Array.isArray(B))for(let ne of B)H(typeof ne==="string"?ne:null);if(H(a.fallbackComponentsDir),L)for(let ne of a._targetComponentDirs??[])H(ne);let F=a._nativePrimitivesFallback;if(F&&!F.except.some((ne)=>ne.toLowerCase()===l.toLowerCase()))H(F.dir);if(l.startsWith("./")||l.startsWith("../"))return r(ce.resolve(ce.dirname(i),`${l}.stx`));let ee=Lo(ce.resolve(import.meta.dir,"components")),G=M.map((ne)=>ce.isAbsolute(ne)?ne:ce.resolve(P,ne)),j=`${v.join("\x00")}\x00\x00${G.join("\x00")}`,te=ur.get(j);if(te!==void 0)return te;let se=!1;e:for(let ne of G){if(Lo(ne)===ee)continue;for(let ue of v)if(await r(ce.join(ne,ue))){se=!0;break e}}return ur.set(j,se),se}function Lo(e){let t=fr.get(e);if(t!==void 0)return t;let n=e;try{n=rs.realpathSync(e)}catch{}return fr.set(e,n),n}function vg(e){return e==="visible"||e==="idle"||e==="interaction"||e.startsWith("media:")}function el(e){if(!e)return!1;let t=e.replace(/<script[\s\S]*?<\/script>/gi,"").replace(/<style[\s\S]*?<\/style>/gi,"");return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(t)}function du(e,t,n){if(!e.includes("{{")&&!e.includes("{!!"))return e;let i=(a,l)=>{let c;try{c=A(a,t)}catch{return l}if(c===void 0||c===null)return"";let b=String(c);if(/<\/style/i.test(b))return console.warn(`[stx] a <style> expression in ${n??"<unknown>"} evaluated to CSS containing a closing style tag, which would end the element early, so it was dropped rather than emitted.`),"";return b};return e.replace(/\{!!([\s\S]*?)!!\}/g,(a,l)=>i(l,a)).replace(/\{\{([\s\S]*?)\}\}/g,(a,l)=>i(l,a))}var zo=new Set;function Bo(e,t,n,i){let a=`${e}\x00${t}\x00${i??""}`;if(!process.env.STX_DEBUG&&zo.has(a))return;zo.add(a);let l=t?` used in ${t}`:"",c=i?` Cause: ${i}.`:"",b=n.length>0?`
571
571
  searched:
572
572
  ${n.map((v)=>` - ${v}`).join(`
573
- `)}`:"";console.error(`[stx] component <${e}> could not be resolved${l}, so it rendered as nothing.${c}${b}`)}function Wo(e){return`<!-- stx: component "${e.replace(/--+/g,"-")}" could not be resolved; see the server log -->`}var gu=new Set(["for","if","show","key","ref","class","className","style"]),Fo=new Set,Zo="useMediaQuery|useDark|usePreferredDark|usePreferredLight|usePreferredReducedMotion|usePreferredContrast|useDocumentVisibility|useScrollLock",el=new RegExp(`\\b(?:${Zo})\\s*(?:<[^>]*>)?\\s*\\(`);function vi(e){let t=new Set,n=new RegExp(`\\b(?:const|let|var)\\s+([a-zA-Z_$][\\w$]*)\\s*=\\s*(?:state|derived|computed|ref|reactive|signal|useModel|useReactiveProp|useLocalStorage|useSessionStorage|keptState|useCookie|useDebouncedValue|${Zo})\\s*(?:<[^>]*>)?\\s*\\(`,"g");for(let i of e){let a;while((a=n.exec(i))!==null)t.add(a[1]);n.lastIndex=0}return[...t]}async function ze(e,t,n,i,a,l,c,b=new Set,v,T=st(a),P,M=e){let{extractVariables:H}=await o("stx/variable-extractor",()=>import("./chunk-rapk2r7b.js")),O=b??new Set;if(O.has(e))return`[Circular component reference: ${e}]`;let L=new Set(O);L.add(e);let B=typeof t.client==="string"?t.client.trim():"";if("client"in t)delete t.client;let F=B&&B!=="load"&&wg(B)?B:"";try{let ee=(oe)=>oe.split("-").map((le)=>le.charAt(0).toUpperCase()+le.slice(1)).join(""),G=M.endsWith(".stx")?M.slice(0,-4):M,j=null,te=a.__importedComponents;if(te){let oe=[G,G.toLowerCase(),ee(G),U(G)];for(let le of oe)if(te.has(le)){j=te.get(le);break}}let se=[];if(!j){let oe=[`${G}.stx`,`${ee(G)}.stx`,`${U(G)}.stx`],le=[...new Set(oe)],we=a.__originalFilePath,be=[];for(let _e of Ln(l))if(!be.includes(_e))be.push(_e);let Xe=be.length;for(let _e of c._layerComponentDirs??[])if(!be.includes(_e))be.push(_e);if(we){let _e=ce.join(ce.dirname(we),"components");be.push(_e)}let Te=c._rootComponentsDir;if(typeof Te==="string"&&qo(i,c)&&!be.includes(Te))be.push(Te);if(i&&!be.includes(i))be.push(i);if(typeof Te==="string"&&!be.includes(Te))be.push(Te);let gt=ce.join(ce.dirname(l),"components");if(!be.includes(gt))be.push(gt);if(c.componentsDir&&c.componentsDir!==i&&!be.includes(c.componentsDir))be.push(c.componentsDir);for(let _e of c.additionalComponentsDirs??[])if(_e&&!be.includes(_e))be.push(_e);let Et=c._nativeHostAttrs&&/^(?:checkbox|switch)$/i.test(G),xt=(P?.events??[]).map((_e)=>_e.replace(/^@/,"").split(".")[0].toLowerCase().replace(/-/g,"")),Rn=Object.hasOwn(t,"checked")||Boolean(P?.reactiveProps?.includes("checked")),fs=Object.hasOwn(t,"value")||Boolean(P?.reactiveProps?.includes("value")),ps=!xt.includes("valuechange")&&(Rn||xt.includes("change")&&!fs),_t=c._nativeHostAttrs&&/^textinput$/i.test(G),kt=xt.includes("update:value")&&!xt.includes("input"),Yt=c._nativeHostAttrs&&/^video$/i.test(G),ds=c._nativeHostAttrs&&/^image$/i.test(G),Tn=Ls([...Object.keys(t),...P?.reactiveProps??[]],P?.events,t),Ct=Object.hasOwn(t,"src")||Boolean(P?.reactiveProps?.includes("src")),An=Object.hasOwn(t,"source")||Boolean(P?.reactiveProps?.includes("source")),In=Yt&&(Ct||An)&&(P?.events??[]).every((_e)=>/^(?:play|pause|ended|timeupdate|loadedmetadata|loadstart|error)$/.test(_e.replace(/^@/,"").split(".")[0])),Pn=new Set(["","primary","secondary","outline","ghost","danger"]),On=typeof t.variant==="string"?t.variant.trim().toLowerCase():"",Dn=c._nativeHostAttrs&&/^button$/i.test(G)&&!Pn.has(On),Rr=c._targetComponentFallbackNames?.some((_e)=>_e.toLowerCase()===G.toLowerCase())??!1,gs=Rr&&(!Et||ps)&&(!_t||kt)&&(!Yt||In)&&(!ds||Tn)&&!Dn;for(let _e of gs?[]:c._targetComponentDirs??[])if(_e&&!be.includes(_e))be.push(_e);let Rt=typeof c.root==="string"?ce.resolve(c.root):void 0,Ar=Rt??ce.dirname(l),Tt=[];if(Rt)Tt.push(ce.resolve(Rt,"resources/views/components")),Tt.push(ce.resolve(Rt,"resources/components")),Tt.push(ce.resolve(Rt,"src/components")),Tt.push(ce.resolve(Rt,"components"));Tt.push(ce.resolve(import.meta.dir,"components"));for(let _e of Tt)if(!be.includes(_e))be.push(_e);if(Rr){let _e=(c._componentPackageDirs??[]).filter((Qe)=>typeof Qe==="string"&&Qe.length>0),mt=(gs?_e.length?_e:c._pluginComponentDirs??[]:c._targetComponentDirs??[]).filter((Qe)=>typeof Qe==="string"&&Qe.length>0);if(mt.length){let Qe=be.slice(Xe).map((Ge)=>ce.isAbsolute(Ge)?Ge:ce.resolve(Ar,Ge)).filter((Ge)=>!mt.includes(Ge)),jn=`${G}\x00${Qe.join("\x00")}`,ot=ur.get(jn);if(ot===void 0){ot=!1;for(let Ge of Qe){for(let wt of le)if(await r(ce.join(Ge,wt))){ot=!0;break}if(ot)break}ur.set(jn,ot)}if(!ot){for(let Ge of mt){let wt=be.indexOf(Ge);if(wt>=0)be.splice(wt,1)}be.splice(Xe,0,...mt)}}}let Ir=c._pluginComponentDirs;if(Array.isArray(Ir)){for(let _e of Ir)if(typeof _e==="string"&&!be.includes(_e))be.push(_e)}if(c.fallbackComponentsDir&&!be.includes(c.fallbackComponentsDir))be.push(c.fallbackComponentsDir);if(gs){for(let _e of c._targetComponentDirs??[])if(_e&&!be.includes(_e))be.push(_e)}let Mn=c._nativePrimitivesFallback;if(Mn&&!Mn.except.some((_e)=>_e.toLowerCase()===G.toLowerCase())&&!be.includes(Mn.dir))be.push(Mn.dir);let Pr=[...new Set(be.map((_e)=>{if(!_e)return _e;return ce.isAbsolute(_e)?_e:ce.resolve(Ar,_e)}))];be.length=0,be.push(...Pr);let ms=`${G}\x00${l}\x00${Pr.join("\x00")}`,hs=ns.get(ms);if(hs)if(await r(hs))j=hs;else ns.delete(ms);if(!j&&(G.startsWith("./")||G.startsWith("../")))j=ce.resolve(ce.dirname(l),`${G}.stx`),se.push(j);else if(!j)for(let _e of be){if(!_e)continue;for(let mt of le){let Qe=ce.join(_e,mt);if(se.push(Qe),await r(Qe)){j=Qe;break}}if(j)break;if(!j)try{let mt=await import("fs");if(!mt.statSync(_e,{throwIfNoEntry:!1})?.isDirectory())continue;let jn=8,ot=[{path:_e,depth:0}];while(ot.length>0&&!j){let Ge=ot.pop();if(Ge.depth>=jn)continue;let wt;try{wt=mt.readdirSync(Ge.path,{withFileTypes:!0})}catch{continue}for(let Nn of wt){if(!Nn.isDirectory())continue;if(Nn.name==="node_modules"||Nn.name.startsWith("."))continue;let Or=ce.join(Ge.path,Nn.name);for(let aa of le){let xs=ce.join(Or,aa);if(se.push(xs),await r(xs)){j=xs;break}}if(j)break;ot.push({path:Or,depth:Ge.depth+1})}}}catch{}if(j)break}if(j)ns.set(ms,j)}if(!j||!await r(j))return Bo(e,l,se),Wo(e);v.add(j);let ne;if(cn.has(j)&&lr.get(j)===Mo(j))ne=cn.get(j);else try{let oe=Mo(j);ne=await Bun.file(j).text(),cn.set(j,ne),lr.set(j,oe)}catch(oe){let le=oe instanceof Error?oe.message:String(oe);return Bo(e,l,[j],le),Wo(e)}if(P)for(let oe of new Set([...Object.keys(t),...P.reactiveProps??[]])){let le=oe.toLowerCase();if(le.startsWith("aria-")||le.startsWith("data-"))continue;let we=oe.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(new RegExp(`\\b${we}\\b`).test(ne))P.declaredProps.add(oe);if(new RegExp(`\\$props\\s*(?:\\.\\s*${we}\\b|\\[\\s*['"]${we}['"]\\s*\\])`).test(ne)||new RegExp(`\\buseReactiveProp\\s*\\(\\s*['"]${we}['"]`).test(ne))P.consumedProps?.add(oe)}if(P?.reactiveProps?.length&&/\bdefineProps\s*(?:<[^>]*>)?\s*\(/.test(ne))for(let oe of P.reactiveProps){if(gu.has(oe)||P.consumedProps?.has(oe))continue;if(new RegExp(`\\buse(?:ReactiveProp|Model)\\s*\\(\\s*['"]${oe.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(ne))continue;let le=`${j}\x00${oe}`;if(Fo.has(le))continue;Fo.add(le),console.warn(`[stx] ${ce.basename(j)} reads \`${oe}\` with defineProps(), which is not live, but ${ce.basename(l)} binds it (:${oe}): 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('${oe}').`)}let ue=new Set(["__originalFilePath","__importedComponents",Un,"__stx_client_signal_names","__stx_client_declared_names","__stx_runtime_config","__stxServeContext","__stx_scope_seq"]),ye={};for(let[oe,le]of Object.entries(a))if(!oe.startsWith("__")||ue.has(oe))ye[oe]=le;let de=T.length>0?{[Jn]:[...T]}:{},Ae=n;if(n.includes("@include")){let{processIncludes:oe}=await o("stx/includes",()=>import("./chunk-zztfp9qh.js"));Ae=await oe(n,a,l,c,v)}if(/<[A-Z][\w.-]*[\s/>]/.test(Ae)){let{processComponents:oe}=await o("stx/component-renderer",()=>import("./chunk-afyvnpr9.js")),le={...a,__processedComponents:O,...de};Ae=await oe(Ae,le,l,c,v);let we=le.__stx_preserved_client_expressions;if(Array.isArray(we)&&we.length>0)a.__stx_preserved_client_expressions=[...new Set([...Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[],...we])]}let Ze=[];if(Qc(Ae)){let{processExpressions:oe}=await o("stx/expressions",()=>import("./chunk-xjbc3bhs.js")),le=a.__stx_signals_gate===void 0?{...a,__stx_signals_gate:!0,...de}:T.length>0?{...a,...de}:a;Ae=oe(Ae,le,l);for(let we of Ae.matchAll(/\{\{([\s\S]*?)\}\}/g))Ze.push(we[1].trim())}let Re=J(Ae),Ke=[],Ye=Re.output.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(oe,le)=>{let we=Re.scripts[Number(le)]||"",be=we.match(/^<script\b([^>]*)>/i)?.[1]||"",Xe=be.match(/\btype\s*=\s*["']([^"']+)["']/i)?.[1]?.toLowerCase(),Te=!Xe||["module","text/javascript","application/javascript"].includes(Xe),gt=/\sdata-stx-(?:owner|instance)(?=[\s=/>])/i.test(` ${be}`);if(!/\bserver\b/i.test(be)&&Te&&!gt)return Ke.push(we),"";return we}),{extractSlotContent:Je}=await o("stx/slots",()=>import("./chunk-pj1xj34h.js")),rt=Je(Ye),et={};if(rt.defaultSlot?.trim())et.default=rt.defaultSlot;for(let[oe,le]of rt.namedSlots)et[oe]=le.content;let yt=a.__stx_scope_seq??={n:0,key:Ws(String(a.__filename??l))},Ft=Ho(e,process.cwd()),lt=`stx_${(Ft.endsWith(".stx")?Ft.slice(0,-4):Ft).replace(/[^a-zA-Z0-9]/g,"_")}_${++yt.n}_${yt.key}`,We={...ye,$uid:lt,$native:c._nativeHostAttrs===!0,...t,props:t,slot:Ye,$slots:et,__processedComponents:L,__sections:{},__stx_signals_gate:ke(ne)||Qc(n),__stx_preserved_client_expressions:[...Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[],...Ze]};if(/import\s/.test(ne)){We.__importedComponents=new Map(We.__importedComponents);let{processESImports:oe}=await o("stx/component-renderer",()=>import("./chunk-afyvnpr9.js"));ne=await oe(ne,We,j,c,v)}fu(ne,We);let Vt=ne,un=pe(Vt);if(un)Vt=un.content.trim();let os=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,Ut=[...ne.matchAll(os)];for(let[,oe,le]of Ut)if(!/\bserver\b|\bsrc\s*=|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/i.test(oe))Ne(le,j,c.strict);let tt=[],Ht=null,as=Ut.some((oe)=>/\bserver\b/.test(oe[1]||"")&&/\bcache\b/.test(oe[1]||"")),vt=null,ut=null,qt=null,dn=0,Zt=null;if(ru(c),as&&dr>0){let oe=iu({props:t,slot:Ae,slotContext:n.trim()?ou(ye):void 0,buildMode:c.buildMode??"",skipEventDirectives:c.skipEventDirectives===!0,native:c._nativeHostAttrs===!0,clientLoopNames:[...T].sort(),layers:c._layerGraph?.layers.map((le)=>le.configFile),uid:lt});if(oe!==null){vt=`${j}\x00${S(ne)}\x00${oe}`;let le=ss.get(vt);if(le){for(let we of le.dependencies)v.add(we);if(Ri(a,le.clientFactories),yt.n+=le.uidsConsumed,le.preservedClientExpressions.length>0){let we=new Set(Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[]);for(let be of le.preservedClientExpressions)we.add(be);a.__stx_preserved_client_expressions=[...we]}return le.output}ut=new Set(v),qt=$i(a),dn=yt.n,Zt=new Set(Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[])}}let Kt=new Set;for(let oe of Ut){let le=oe[1]||"",we=oe[2]||"",be=le.includes("server");if(Be(le)&&we.trim())we=Fe(we);if(be&&we){for(let Te of Me(we))Kt.add(Te);try{await H(we,We,j,{onFailure:(Te)=>{if(Te.kind!=="unknown")Ht=Te.kind}})}catch(Te){}}if(!be){let Te=we.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),gt=Te.includes("{{")&&Te.includes("}}"),Et=Te.includes("{!!")&&Te.includes("!!}");if(gt||Et)Te=Si(Te,We,j);let xt=le.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");tt.push(`<script${xt}>${Te}</script>`)}}let nt=J(ne).output.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),Xt=nt?nt[1]:"",cs=nt?nt[2]:"",ft="",re=Xt&&/\bscoped\b/i.test(Xt);if(nt)ft=`<style${Xt}>${du(cs,We,j)}</style>`;let ae=Vt;if(ae=ae.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),nt)ae=ae.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let oe=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,le=[];if(ae=ae.replace(oe,(we,be)=>{let Xe=be.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(Xe)le.push(`<style${Xe[1]}>${Xe[2]}</style>`);return""}),ae=ae.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),le.length>0)ft=`${ft}${le.join(`
574
- `)}`}if(n&&ae.includes("{{ text || slot }}"))ae=ae.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>n);let{applySlots:he}=await o("stx/slots",()=>import("./chunk-pj1xj34h.js")),{defaultSlot:$e,namedSlots:Pe}=rt,Ve=a.__stx_signals_gate===!0&&/\s(?:@[\w:.-]+|x-on:[\w:.-]+)\s*=/.test(Ye),it=tt.length>0&&Ys(ae)||c._nativeHostAttrs===!0&&tt.length>0||Ve&&tt.length>0||tt.some((oe)=>/\b(?:state|derived|effect|ref|useRef|reactive|computed|watch|watchEffect|useModel|useReactiveProp|onMount|onDestroy|defineProps|withDefaults|defineEmits|defineExpose|defineSlots)\s*(?:<[^<>()]*>)?\s*\(/.test(oe)),ls=(oe)=>it?ao(oe,lt):oe,us=new Map([...Pe].map(([oe,le])=>[oe,{...le,content:ls(le.content)}]));ae=await he(ae,it?oo(ls($e),lt):$e,us,We,it?lt:"");let $n=vi(tt),Jt=(Array.isArray(We.__stx_client_signal_names)?We.__stx_client_signal_names:[]).filter((oe)=>!Kt.has(oe));if($n.length>0||Jt.length>0)We.__stx_client_signal_names=[...new Set([...Jt,...$n])];else delete We.__stx_client_signal_names;let Gt=T.filter((oe)=>!Kt.has(oe)&&!(oe in t));if(Gt.length>0)We[Jn]=Gt;let En={...c,_rootComponentsDir:c._rootComponentsDir||c.componentsDir,componentsDir:ce.dirname(j),skipSignalsRuntime:!0,skipEventDirectives:c._nativeHostAttrs===!0||it||tt.length===0,defaultLayout:void 0};We.__stxProcessingDepth=(a.__stxProcessingDepth||0)+1;let{processDirectives:Cn}=await o("stx/process",()=>import("./chunk-64evx0my.js")),pt=await Cn(ae,We,j,En,v),ht=new Set(Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[]);for(let oe of pt.matchAll(/\{\{([\s\S]*?)\}\}/g))ht.add(oe[1].trim());if(ht.size>0)a.__stx_preserved_client_expressions=[...ht];let dt=lt,qe=pt;if(it){let oe="";if(Object.keys(t).length>0)try{oe=` data-stx-props="${ar(JSON.stringify(t))}"`}catch{}let le=F?` stx-hydrate="${ar(F)}"`:"",we=Object.fromEntries(Object.entries(et).map(([_t,kt])=>[_t,Boolean(kt)])),be=Object.keys(we).length>0?` data-stx-slots="${ar(JSON.stringify(we))}"`:"",Xe=` data-stx-scope="${dt}"${oe}${be}${le}`,Te=pt.slice(Pt(pt)),gt=/^<span(?=[\s/>])/i.test(Te),Et=/^<[^>]+\bdata-stx-layout-root(?:\s|=|>)/i.test(Te),xt=/^<[^>]+\bdata-stx-fill-root(?:\s|=|>)/i.test(Te),Rn=gt?"span":"div",fs=Et&&c._nativeHostAttrs?' style="display:flex;flex-direction:column;flex:1;min-height:0;min-width:0"':xt&&c._nativeHostAttrs?' style="width:100%;height:100%"':gt||Et?' style="display:contents"':"";qe=bg(pt,Xe)??`<${Rn}${Xe} data-stx-component-wrapper${fs}>${pt}</${Rn}>`;let ps=await Promise.all(tt.map(async(_t)=>{let kt=_t.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!kt)return _t;let[,Yt,ds]=kt,Tn=Do(_t,We,j);if(Tn!==null)return Tn;let Ct=await hu(ds,j,c.buildMode==="compile"),An=wn(Ct.clientCode,Le(We)),{vendorStyleTags:In}=Ct,Pn=An?`function(__scopeId) {
573
+ `)}`:"";console.error(`[stx] component <${e}> could not be resolved${l}, so it rendered as nothing.${c}${b}`)}function Wo(e){return`<!-- stx: component "${e.replace(/--+/g,"-")}" could not be resolved; see the server log -->`}var gu=new Set(["for","if","show","key","ref","class","className","style"]),Fo=new Set,Zo="useMediaQuery|useDark|usePreferredDark|usePreferredLight|usePreferredReducedMotion|usePreferredContrast|useDocumentVisibility|useScrollLock",tl=new RegExp(`\\b(?:${Zo})\\s*(?:<[^>]*>)?\\s*\\(`);function xi(e){let t=new Set,n=new RegExp(`\\b(?:const|let|var)\\s+([a-zA-Z_$][\\w$]*)\\s*=\\s*(?:state|derived|computed|ref|reactive|signal|useModel|useReactiveProp|useLocalStorage|useSessionStorage|keptState|useCookie|useDebouncedValue|${Zo})\\s*(?:<[^>]*>)?\\s*\\(`,"g");for(let i of e){let a;while((a=n.exec(i))!==null)t.add(a[1]);n.lastIndex=0}return[...t]}async function ze(e,t,n,i,a,l,c,b=new Set,v,T=st(a),P,M=e){let{extractVariables:H}=await o("stx/variable-extractor",()=>import("./chunk-stss2b88.js")),O=b??new Set;if(O.has(e))return`[Circular component reference: ${e}]`;let L=new Set(O);L.add(e);let B=typeof t.client==="string"?t.client.trim():"";if("client"in t)delete t.client;let F=B&&B!=="load"&&vg(B)?B:"";try{let ee=(oe)=>oe.split("-").map((le)=>le.charAt(0).toUpperCase()+le.slice(1)).join(""),G=M.endsWith(".stx")?M.slice(0,-4):M,j=null,te=a.__importedComponents;if(te){let oe=[G,G.toLowerCase(),ee(G),U(G)];for(let le of oe)if(te.has(le)){j=te.get(le);break}}let se=[];if(!j){let oe=[`${G}.stx`,`${ee(G)}.stx`,`${U(G)}.stx`],le=[...new Set(oe)],we=a.__originalFilePath,be=[];for(let _e of Ln(l))if(!be.includes(_e))be.push(_e);let Xe=be.length;for(let _e of c._layerComponentDirs??[])if(!be.includes(_e))be.push(_e);if(we){let _e=ce.join(ce.dirname(we),"components");be.push(_e)}let Te=c._rootComponentsDir;if(typeof Te==="string"&&qo(i,c)&&!be.includes(Te))be.push(Te);if(i&&!be.includes(i))be.push(i);if(typeof Te==="string"&&!be.includes(Te))be.push(Te);let gt=ce.join(ce.dirname(l),"components");if(!be.includes(gt))be.push(gt);if(c.componentsDir&&c.componentsDir!==i&&!be.includes(c.componentsDir))be.push(c.componentsDir);for(let _e of c.additionalComponentsDirs??[])if(_e&&!be.includes(_e))be.push(_e);let Et=c._nativeHostAttrs&&/^(?:checkbox|switch)$/i.test(G),xt=(P?.events??[]).map((_e)=>_e.replace(/^@/,"").split(".")[0].toLowerCase().replace(/-/g,"")),Rn=Object.hasOwn(t,"checked")||Boolean(P?.reactiveProps?.includes("checked")),fs=Object.hasOwn(t,"value")||Boolean(P?.reactiveProps?.includes("value")),ps=!xt.includes("valuechange")&&(Rn||xt.includes("change")&&!fs),_t=c._nativeHostAttrs&&/^textinput$/i.test(G),kt=xt.includes("update:value")&&!xt.includes("input"),Yt=c._nativeHostAttrs&&/^video$/i.test(G),ds=c._nativeHostAttrs&&/^image$/i.test(G),Tn=js([...Object.keys(t),...P?.reactiveProps??[]],P?.events,t),Ct=Object.hasOwn(t,"src")||Boolean(P?.reactiveProps?.includes("src")),An=Object.hasOwn(t,"source")||Boolean(P?.reactiveProps?.includes("source")),In=Yt&&(Ct||An)&&(P?.events??[]).every((_e)=>/^(?:play|pause|ended|timeupdate|loadedmetadata|loadstart|error)$/.test(_e.replace(/^@/,"").split(".")[0])),Pn=new Set(["","primary","secondary","outline","ghost","danger"]),On=typeof t.variant==="string"?t.variant.trim().toLowerCase():"",Dn=c._nativeHostAttrs&&/^button$/i.test(G)&&!Pn.has(On),wr=c._targetComponentFallbackNames?.some((_e)=>_e.toLowerCase()===G.toLowerCase())??!1,gs=wr&&(!Et||ps)&&(!_t||kt)&&(!Yt||In)&&(!ds||Tn)&&!Dn;for(let _e of gs?[]:c._targetComponentDirs??[])if(_e&&!be.includes(_e))be.push(_e);let Rt=typeof c.root==="string"?ce.resolve(c.root):void 0,Rr=Rt??ce.dirname(l),Tt=[];if(Rt)Tt.push(ce.resolve(Rt,"resources/views/components")),Tt.push(ce.resolve(Rt,"resources/components")),Tt.push(ce.resolve(Rt,"src/components")),Tt.push(ce.resolve(Rt,"components"));Tt.push(ce.resolve(import.meta.dir,"components"));for(let _e of Tt)if(!be.includes(_e))be.push(_e);if(wr){let _e=(c._componentPackageDirs??[]).filter((Qe)=>typeof Qe==="string"&&Qe.length>0),mt=(gs?_e.length?_e:c._pluginComponentDirs??[]:c._targetComponentDirs??[]).filter((Qe)=>typeof Qe==="string"&&Qe.length>0);if(mt.length){let Qe=be.slice(Xe).map((Ge)=>ce.isAbsolute(Ge)?Ge:ce.resolve(Rr,Ge)).filter((Ge)=>!mt.includes(Ge)),jn=`${G}\x00${Qe.join("\x00")}`,ot=lr.get(jn);if(ot===void 0){ot=!1;for(let Ge of Qe){for(let wt of le)if(await r(ce.join(Ge,wt))){ot=!0;break}if(ot)break}lr.set(jn,ot)}if(!ot){for(let Ge of mt){let wt=be.indexOf(Ge);if(wt>=0)be.splice(wt,1)}be.splice(Xe,0,...mt)}}}let Ar=c._pluginComponentDirs;if(Array.isArray(Ar)){for(let _e of Ar)if(typeof _e==="string"&&!be.includes(_e))be.push(_e)}if(c.fallbackComponentsDir&&!be.includes(c.fallbackComponentsDir))be.push(c.fallbackComponentsDir);if(gs){for(let _e of c._targetComponentDirs??[])if(_e&&!be.includes(_e))be.push(_e)}let Mn=c._nativePrimitivesFallback;if(Mn&&!Mn.except.some((_e)=>_e.toLowerCase()===G.toLowerCase())&&!be.includes(Mn.dir))be.push(Mn.dir);let Ir=[...new Set(be.map((_e)=>{if(!_e)return _e;return ce.isAbsolute(_e)?_e:ce.resolve(Rr,_e)}))];be.length=0,be.push(...Ir);let ms=`${G}\x00${l}\x00${Ir.join("\x00")}`,hs=ns.get(ms);if(hs)if(await r(hs))j=hs;else ns.delete(ms);if(!j&&(G.startsWith("./")||G.startsWith("../")))j=ce.resolve(ce.dirname(l),`${G}.stx`),se.push(j);else if(!j)for(let _e of be){if(!_e)continue;for(let mt of le){let Qe=ce.join(_e,mt);if(se.push(Qe),await r(Qe)){j=Qe;break}}if(j)break;if(!j)try{let mt=await import("fs");if(!mt.statSync(_e,{throwIfNoEntry:!1})?.isDirectory())continue;let jn=8,ot=[{path:_e,depth:0}];while(ot.length>0&&!j){let Ge=ot.pop();if(Ge.depth>=jn)continue;let wt;try{wt=mt.readdirSync(Ge.path,{withFileTypes:!0})}catch{continue}for(let Nn of wt){if(!Nn.isDirectory())continue;if(Nn.name==="node_modules"||Nn.name.startsWith("."))continue;let Pr=ce.join(Ge.path,Nn.name);for(let aa of le){let xs=ce.join(Pr,aa);if(se.push(xs),await r(xs)){j=xs;break}}if(j)break;ot.push({path:Pr,depth:Ge.depth+1})}}}catch{}if(j)break}if(j)ns.set(ms,j)}if(!j||!await r(j))return Bo(e,l,se),Wo(e);v.add(j);let ne;if(cn.has(j)&&cr.get(j)===Mo(j))ne=cn.get(j);else try{let oe=Mo(j);ne=await Bun.file(j).text(),cn.set(j,ne),cr.set(j,oe)}catch(oe){let le=oe instanceof Error?oe.message:String(oe);return Bo(e,l,[j],le),Wo(e)}if(P)for(let oe of new Set([...Object.keys(t),...P.reactiveProps??[]])){let le=oe.toLowerCase();if(le.startsWith("aria-")||le.startsWith("data-"))continue;let we=oe.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(new RegExp(`\\b${we}\\b`).test(ne))P.declaredProps.add(oe);if(new RegExp(`\\$props\\s*(?:\\.\\s*${we}\\b|\\[\\s*['"]${we}['"]\\s*\\])`).test(ne)||new RegExp(`\\buseReactiveProp\\s*\\(\\s*['"]${we}['"]`).test(ne))P.consumedProps?.add(oe)}if(P?.reactiveProps?.length&&/\bdefineProps\s*(?:<[^>]*>)?\s*\(/.test(ne))for(let oe of P.reactiveProps){if(gu.has(oe)||P.consumedProps?.has(oe))continue;if(new RegExp(`\\buse(?:ReactiveProp|Model)\\s*\\(\\s*['"]${oe.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(ne))continue;let le=`${j}\x00${oe}`;if(Fo.has(le))continue;Fo.add(le),console.warn(`[stx] ${ce.basename(j)} reads \`${oe}\` with defineProps(), which is not live, but ${ce.basename(l)} binds it (:${oe}): 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('${oe}').`)}let ue=new Set(["__originalFilePath","__importedComponents",Un,"__stx_client_signal_names","__stx_client_declared_names","__stx_runtime_config","__stxServeContext","__stx_scope_seq"]),ye={};for(let[oe,le]of Object.entries(a))if(!oe.startsWith("__")||ue.has(oe))ye[oe]=le;let de=T.length>0?{[Jn]:[...T]}:{},Ae=n;if(n.includes("@include")){let{processIncludes:oe}=await o("stx/includes",()=>import("./chunk-fx04tq90.js"));Ae=await oe(n,a,l,c,v)}if(/<[A-Z][\w.-]*[\s/>]/.test(Ae)){let{processComponents:oe}=await o("stx/component-renderer",()=>import("./chunk-tw6y23ew.js")),le={...a,__processedComponents:O,...de};Ae=await oe(Ae,le,l,c,v);let we=le.__stx_preserved_client_expressions;if(Array.isArray(we)&&we.length>0)a.__stx_preserved_client_expressions=[...new Set([...Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[],...we])]}let Ze=[];if(el(Ae)){let{processExpressions:oe}=await o("stx/expressions",()=>import("./chunk-a7z6j9ga.js")),le=a.__stx_signals_gate===void 0?{...a,__stx_signals_gate:!0,...de}:T.length>0?{...a,...de}:a;Ae=oe(Ae,le,l);for(let we of Ae.matchAll(/\{\{([\s\S]*?)\}\}/g))Ze.push(we[1].trim())}let Re=J(Ae),Ke=[],Ye=Re.output.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(oe,le)=>{let we=Re.scripts[Number(le)]||"",be=we.match(/^<script\b([^>]*)>/i)?.[1]||"",Xe=be.match(/\btype\s*=\s*["']([^"']+)["']/i)?.[1]?.toLowerCase(),Te=!Xe||["module","text/javascript","application/javascript"].includes(Xe),gt=/\sdata-stx-(?:owner|instance)(?=[\s=/>])/i.test(` ${be}`);if(!/\bserver\b/i.test(be)&&Te&&!gt)return Ke.push(we),"";return we}),{extractSlotContent:Je}=await o("stx/slots",()=>import("./chunk-263gby2p.js")),rt=Je(Ye),et={};if(rt.defaultSlot?.trim())et.default=rt.defaultSlot;for(let[oe,le]of rt.namedSlots)et[oe]=le.content;let yt=a.__stx_scope_seq??={n:0,key:qs(String(a.__filename??l))},Ft=Ho(e,process.cwd()),lt=`stx_${(Ft.endsWith(".stx")?Ft.slice(0,-4):Ft).replace(/[^a-zA-Z0-9]/g,"_")}_${++yt.n}_${yt.key}`,We={...ye,$uid:lt,$native:c._nativeHostAttrs===!0,...t,props:t,slot:Ye,$slots:et,__processedComponents:L,__sections:{},__stx_signals_gate:ke(ne)||el(n),__stx_preserved_client_expressions:[...Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[],...Ze]};if(/import\s/.test(ne)){We.__importedComponents=new Map(We.__importedComponents);let{processESImports:oe}=await o("stx/component-renderer",()=>import("./chunk-tw6y23ew.js"));ne=await oe(ne,We,j,c,v)}fu(ne,We);let Vt=ne,un=pe(Vt);if(un)Vt=un.content.trim();let os=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,Ut=[...ne.matchAll(os)];for(let[,oe,le]of Ut)if(!/\bserver\b|\bsrc\s*=|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/i.test(oe))Ne(le,j,c.strict);let tt=[],Ht=null,as=Ut.some((oe)=>/\bserver\b/.test(oe[1]||"")&&/\bcache\b/.test(oe[1]||"")),vt=null,ut=null,qt=null,dn=0,Zt=null;if(ru(c),as&&pr>0){let oe=iu({props:t,slot:Ae,slotContext:n.trim()?ou(ye):void 0,buildMode:c.buildMode??"",skipEventDirectives:c.skipEventDirectives===!0,native:c._nativeHostAttrs===!0,clientLoopNames:[...T].sort(),layers:c._layerGraph?.layers.map((le)=>le.configFile),uid:lt});if(oe!==null){vt=`${j}\x00${S(ne)}\x00${oe}`;let le=ss.get(vt);if(le){for(let we of le.dependencies)v.add(we);if(Ci(a,le.clientFactories),yt.n+=le.uidsConsumed,le.preservedClientExpressions.length>0){let we=new Set(Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[]);for(let be of le.preservedClientExpressions)we.add(be);a.__stx_preserved_client_expressions=[...we]}return le.output}ut=new Set(v),qt=ci(a),dn=yt.n,Zt=new Set(Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[])}}let Kt=new Set;for(let oe of Ut){let le=oe[1]||"",we=oe[2]||"",be=le.includes("server");if(Be(le)&&we.trim())we=Fe(we);if(be&&we){for(let Te of Me(we))Kt.add(Te);try{await H(we,We,j,{onFailure:(Te)=>{if(Te.kind!=="unknown")Ht=Te.kind}})}catch(Te){}}if(!be){let Te=we.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),gt=Te.includes("{{")&&Te.includes("}}"),Et=Te.includes("{!!")&&Te.includes("!!}");if(gt||Et)Te=ki(Te,We,j);let xt=le.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");tt.push(`<script${xt}>${Te}</script>`)}}let nt=J(ne).output.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),Xt=nt?nt[1]:"",cs=nt?nt[2]:"",ft="",re=Xt&&/\bscoped\b/i.test(Xt);if(nt)ft=`<style${Xt}>${du(cs,We,j)}</style>`;let ae=Vt;if(ae=ae.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),nt)ae=ae.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let oe=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,le=[];if(ae=ae.replace(oe,(we,be)=>{let Xe=be.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(Xe)le.push(`<style${Xe[1]}>${Xe[2]}</style>`);return""}),ae=ae.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),le.length>0)ft=`${ft}${le.join(`
574
+ `)}`}if(n&&ae.includes("{{ text || slot }}"))ae=ae.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>n);let{applySlots:he}=await o("stx/slots",()=>import("./chunk-263gby2p.js")),{defaultSlot:$e,namedSlots:Pe}=rt,Ve=a.__stx_signals_gate===!0&&/\s(?:@[\w:.-]+|x-on:[\w:.-]+)\s*=/.test(Ye),it=tt.length>0&&Js(ae)||c._nativeHostAttrs===!0&&tt.length>0||Ve&&tt.length>0||tt.some((oe)=>/\b(?:state|derived|effect|ref|useRef|reactive|computed|watch|watchEffect|useModel|useReactiveProp|onMount|onDestroy|defineProps|withDefaults|defineEmits|defineExpose|defineSlots)\s*(?:<[^<>()]*>)?\s*\(/.test(oe)),ls=(oe)=>it?ao(oe,lt):oe,us=new Map([...Pe].map(([oe,le])=>[oe,{...le,content:ls(le.content)}]));ae=await he(ae,it?oo(ls($e),lt):$e,us,We,it?lt:"");let $n=xi(tt),Jt=(Array.isArray(We.__stx_client_signal_names)?We.__stx_client_signal_names:[]).filter((oe)=>!Kt.has(oe));if($n.length>0||Jt.length>0)We.__stx_client_signal_names=[...new Set([...Jt,...$n])];else delete We.__stx_client_signal_names;let Gt=T.filter((oe)=>!Kt.has(oe)&&!(oe in t));if(Gt.length>0)We[Jn]=Gt;let En={...c,_rootComponentsDir:c._rootComponentsDir||c.componentsDir,componentsDir:ce.dirname(j),skipSignalsRuntime:!0,skipEventDirectives:c._nativeHostAttrs===!0||it||tt.length===0,defaultLayout:void 0};We.__stxProcessingDepth=(a.__stxProcessingDepth||0)+1;let{processDirectives:Cn}=await o("stx/process",()=>import("./chunk-3q19w77r.js")),pt=await Cn(ae,We,j,En,v),ht=new Set(Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[]);for(let oe of pt.matchAll(/\{\{([\s\S]*?)\}\}/g))ht.add(oe[1].trim());if(ht.size>0)a.__stx_preserved_client_expressions=[...ht];let dt=lt,qe=pt;if(it){let oe="";if(Object.keys(t).length>0)try{oe=` data-stx-props="${or(JSON.stringify(t))}"`}catch{}let le=F?` stx-hydrate="${or(F)}"`:"",we=Object.fromEntries(Object.entries(et).map(([_t,kt])=>[_t,Boolean(kt)])),be=Object.keys(we).length>0?` data-stx-slots="${or(JSON.stringify(we))}"`:"",Xe=` data-stx-scope="${dt}"${oe}${be}${le}`,Te=pt.slice(Pt(pt)),gt=/^<span(?=[\s/>])/i.test(Te),Et=/^<[^>]+\bdata-stx-layout-root(?:\s|=|>)/i.test(Te),xt=/^<[^>]+\bdata-stx-fill-root(?:\s|=|>)/i.test(Te),Rn=gt?"span":"div",fs=Et&&c._nativeHostAttrs?' style="display:flex;flex-direction:column;flex:1;min-height:0;min-width:0"':xt&&c._nativeHostAttrs?' style="width:100%;height:100%"':gt||Et?' style="display:contents"':"";qe=wg(pt,Xe)??`<${Rn}${Xe} data-stx-component-wrapper${fs}>${pt}</${Rn}>`;let ps=await Promise.all(tt.map(async(_t)=>{let kt=_t.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!kt)return _t;let[,Yt,ds]=kt,Tn=Do(_t,We,j);if(Tn!==null)return Tn;let Ct=await hu(ds,j,c.buildMode==="compile"),An=wn(Ct.clientCode,Le(We)),{vendorStyleTags:In}=Ct,Pn=An?`function(__scopeId) {
575
575
  ${An}
576
576
  return (${Ct.factoryBody})(__scopeId);
577
577
  }`:Ct.factoryBody,On=F?null:Rs(a,Pn),Dn=On?`window.__stxComponentFactories[${JSON.stringify(On)}](${JSON.stringify(dt)});`:`(${Pn})(${JSON.stringify(dt)});`;if(F)return`${In}<script type="stx/island" data-stx-island="${dt}" data-stx-scoped data-stx-owner="${dt}"${Yt}>${Dn}</script>`;return`${In}<script data-stx-scoped data-stx-run="always" data-stx-owner="${dt}"${Yt}>${Dn}</script>`}));if(qe=qe+`
@@ -580,11 +580,11 @@ return (${Ct.factoryBody})(__scopeId);
580
580
  `+ft}else{if(ft)qe+=`
581
581
  `+ft;if(tt.length>0){let oe=We.__stx_event_bindings||[],le=Le(We),we=await Promise.all(tt.map(async(be)=>{let Xe=Do(be,We,j);if(Xe!==null)return Xe;let Te=be.match(/<script\b[^>]*>([\s\S]*?)<\/script>/);if(!Te)return be;return await je(Te[1],{eventBindings:oe,templateContent:qe,filePath:j,projectRoot:process.cwd(),serverData:le,instanceId:lt})}));qe+=`
582
582
  `+we.join(`
583
- `),We.__stx_event_bindings=[]}}if(re){let oe=zs(qe,j);if(oe.hasScoped)qe=oe.html}if(vt&&ut){let oe=Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[];ss.set(vt,{output:qe,dependencies:[...v].filter((le)=>!ut.has(le)),clientFactories:qt?Ei(a,qt):[],uidsConsumed:yt.n-dn,preservedClientExpressions:Zt?oe.filter((le)=>!Zt.has(le)):[]})}if(Ht)qe=`<!--stx-render-failed:${Ht}-->${qe}`;return Ke.length>0?`${qe}
583
+ `),We.__stx_event_bindings=[]}}if(re){let oe=Hs(qe,j);if(oe.hasScoped)qe=oe.html}if(vt&&ut){let oe=Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[];ss.set(vt,{output:qe,dependencies:[...v].filter((le)=>!ut.has(le)),clientFactories:qt?$i(a,qt):[],uidsConsumed:yt.n-dn,preservedClientExpressions:Zt?oe.filter((le)=>!Zt.has(le)):[]})}if(Ht)qe=`<!--stx-render-failed:${Ht}-->${qe}`;return Ke.length>0?`${qe}
584
584
  ${Ke.join(`
585
- `)}`:qe}catch(ee){if(ee instanceof K)throw ee;return`[Error processing component: ${ee instanceof Error?ee.message:String(ee)}]`}finally{O.delete(e)}}async function r(e){return Bun.file(e).exists()}function gr(e,t){let n=ce.resolve(t),i=ce.resolve(e),a=n.endsWith(ce.sep)?n:n+ce.sep;if(i===n||i.startsWith(a))return i;return null}async function Vo(e,t,n,i){let a=t.startsWith("layouts/")?t.slice(8):t,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 n?.add(c),c}return null}async function vn(e,t,n,i){let a=await mu(e,t,n,i);if(a===null)return null;let l=gr(a,process.cwd());if(l)return l;let c=[n.root,n.layoutsDir,n.fallbackLayoutsDir,n.componentsDir,n.partialsDir,n.pagesDir,...n._layerLayoutDirs??[]].filter((b)=>typeof b==="string"&&b.length>0);for(let b of c){let v=ce.isAbsolute(b)?b:ce.resolve(process.cwd(),b);if(gr(a,v))return ce.resolve(a)}return console.warn(`[stx] rejected resolved template path that escapes project root: ${a} (template: ${e}, from: ${t})`),null}async function mu(e,t,n,i){if(n.debug)console.log(`Resolving template path: ${e} from ${t}`);let a=ce.dirname(t),l=process.cwd();if(e.startsWith("/")){let O=ce.join(l,e),L=gr(O,l);if(!L)return console.warn(`[stx] rejected template path that escapes project root: ${e} (from ${t})`),null;if(n.debug)console.log(`Checking absolute path: ${L}`);if(await r(L)&&i)i.add(L);return L}let c=async(O)=>{if(!n.layoutsDir||!n.fallbackLayoutsDir)return O;let L=ce.relative(ce.resolve(l,n.fallbackLayoutsDir),O);if(L.startsWith("..")||ce.isAbsolute(L))return O;return await Vo(ce.resolve(l,n.layoutsDir),e,i,n.debug)??O},b=ce.join(a,e);if(await r(b)){if(n.debug)console.log(`Found direct path: ${b}`);let O=await c(b);if(i)i.add(O);return O}if(!e.endsWith(".stx")&&!e.endsWith(".jsx")&&!e.endsWith(".tsx"))for(let O of[".stx",".tsx",".jsx"]){let L=`${b}${O}`;if(await r(L)){if(n.debug)console.log(`Found direct path with extension: ${L}`);let B=await c(L);if(i)i.add(B);return B}}let v=[];if(v.push(...n._layerLayoutDirs??[]),n.layoutsDir)v.push(ce.isAbsolute(n.layoutsDir)?n.layoutsDir:ce.resolve(process.cwd(),n.layoutsDir));let T=ce.resolve(a),P=process.cwd();for(let O=0;O<10;O++){let L=ce.join(T,"layouts"),B=!1;try{B=rs.statSync(L,{throwIfNoEntry:!1})?.isDirectory()??!1}catch{}if(B){v.push(L);break}let F=ce.dirname(T);if(F===T||F.length<P.length)break;T=F}for(let O of v){let L=await Vo(O,e,i,n.debug);if(L)return L}if(n.fallbackLayoutsDir){let O=ce.isAbsolute(n.fallbackLayoutsDir)?n.fallbackLayoutsDir:ce.resolve(process.cwd(),n.fallbackLayoutsDir),L=e.startsWith("layouts/")?e.slice(8):e,B=[ce.join(O,L)];if(!e.endsWith(".stx"))B.push(`${B[0]}.stx`);for(let F of B)if(await r(F)){if(n.debug)console.log(`Found in options.fallbackLayoutsDir: ${F}`);if(i)i.add(F);return F}}if(e.startsWith("layouts/")||e.includes("/layouts/")){let O=e.split("layouts/"),L=ce.join(n.partialsDir||a,"layouts",O[1]);if(await r(L)){if(n.debug)console.log(`Found in layouts path: ${L}`);if(i)i.add(L);return L}if(!L.endsWith(".stx")){let B=`${L}.stx`;if(await r(B)){if(n.debug)console.log(`Found in layouts path with extension: ${B}`);if(i)i.add(B);return B}}}if(n.partialsDir){let O=ce.join(n.partialsDir,"layouts");if(await r(O)){let L=ce.join(O,e);if(await r(L)){if(n.debug)console.log(`Found in partials layouts dir: ${L}`);if(i)i.add(L);return L}if(!e.endsWith(".stx")){let B=`${L}.stx`;if(await r(B)){if(n.debug)console.log(`Found in partials layouts dir with extension: ${B}`);if(i)i.add(B);return B}}}}let M=n.partialsDir||ce.join(process.cwd(),"views"),H=ce.join(M,e);if(await r(H)){if(n.debug)console.log(`Found in views path: ${H}`);if(i)i.add(H);return H}if(!e.endsWith(".stx")){let O=`${H}.stx`;if(await r(O)){if(n.debug)console.log(`Found in views path with extension: ${O}`);if(i)i.add(O);return O}}if(a.includes("temp")){let O=ce.join(ce.dirname(a),"layouts",e);if(await r(O)){if(n.debug)console.log(`Found in temp layouts dir: ${O}`);if(i)i.add(O);return O}if(!e.endsWith(".stx")){let L=`${O}.stx`;if(await r(L)){if(n.debug)console.log(`Found in temp layouts dir with extension: ${L}`);if(i)i.add(L);return L}}}if(n.debug)console.warn(`Template not found after trying all paths: ${e} (referenced from ${t})`);else console.warn(`Template not found: ${e} (referenced from ${t})`);return null}function tl(e,t,n){let i=0,a="",l="";try{if(typeof t==="number"&&t>=0){let c=e.split(`
585
+ `)}`:qe}catch(ee){if(ee instanceof K)throw ee;return`[Error processing component: ${ee instanceof Error?ee.message:String(ee)}]`}finally{O.delete(e)}}async function r(e){return Bun.file(e).exists()}function dr(e,t){let n=ce.resolve(t),i=ce.resolve(e),a=n.endsWith(ce.sep)?n:n+ce.sep;if(i===n||i.startsWith(a))return i;return null}async function Vo(e,t,n,i){let a=t.startsWith("layouts/")?t.slice(8):t,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 n?.add(c),c}return null}async function vn(e,t,n,i){let a=await mu(e,t,n,i);if(a===null)return null;let l=dr(a,process.cwd());if(l)return l;let c=[n.root,n.layoutsDir,n.fallbackLayoutsDir,n.componentsDir,n.partialsDir,n.pagesDir,...n._layerLayoutDirs??[]].filter((b)=>typeof b==="string"&&b.length>0);for(let b of c){let v=ce.isAbsolute(b)?b:ce.resolve(process.cwd(),b);if(dr(a,v))return ce.resolve(a)}return console.warn(`[stx] rejected resolved template path that escapes project root: ${a} (template: ${e}, from: ${t})`),null}async function mu(e,t,n,i){if(n.debug)console.log(`Resolving template path: ${e} from ${t}`);let a=ce.dirname(t),l=process.cwd();if(e.startsWith("/")){let O=ce.join(l,e),L=dr(O,l);if(!L)return console.warn(`[stx] rejected template path that escapes project root: ${e} (from ${t})`),null;if(n.debug)console.log(`Checking absolute path: ${L}`);if(await r(L)&&i)i.add(L);return L}let c=async(O)=>{if(!n.layoutsDir||!n.fallbackLayoutsDir)return O;let L=ce.relative(ce.resolve(l,n.fallbackLayoutsDir),O);if(L.startsWith("..")||ce.isAbsolute(L))return O;return await Vo(ce.resolve(l,n.layoutsDir),e,i,n.debug)??O},b=ce.join(a,e);if(await r(b)){if(n.debug)console.log(`Found direct path: ${b}`);let O=await c(b);if(i)i.add(O);return O}if(!e.endsWith(".stx")&&!e.endsWith(".jsx")&&!e.endsWith(".tsx"))for(let O of[".stx",".tsx",".jsx"]){let L=`${b}${O}`;if(await r(L)){if(n.debug)console.log(`Found direct path with extension: ${L}`);let B=await c(L);if(i)i.add(B);return B}}let v=[];if(v.push(...n._layerLayoutDirs??[]),n.layoutsDir)v.push(ce.isAbsolute(n.layoutsDir)?n.layoutsDir:ce.resolve(process.cwd(),n.layoutsDir));let T=ce.resolve(a),P=process.cwd();for(let O=0;O<10;O++){let L=ce.join(T,"layouts"),B=!1;try{B=rs.statSync(L,{throwIfNoEntry:!1})?.isDirectory()??!1}catch{}if(B){v.push(L);break}let F=ce.dirname(T);if(F===T||F.length<P.length)break;T=F}for(let O of v){let L=await Vo(O,e,i,n.debug);if(L)return L}if(n.fallbackLayoutsDir){let O=ce.isAbsolute(n.fallbackLayoutsDir)?n.fallbackLayoutsDir:ce.resolve(process.cwd(),n.fallbackLayoutsDir),L=e.startsWith("layouts/")?e.slice(8):e,B=[ce.join(O,L)];if(!e.endsWith(".stx"))B.push(`${B[0]}.stx`);for(let F of B)if(await r(F)){if(n.debug)console.log(`Found in options.fallbackLayoutsDir: ${F}`);if(i)i.add(F);return F}}if(e.startsWith("layouts/")||e.includes("/layouts/")){let O=e.split("layouts/"),L=ce.join(n.partialsDir||a,"layouts",O[1]);if(await r(L)){if(n.debug)console.log(`Found in layouts path: ${L}`);if(i)i.add(L);return L}if(!L.endsWith(".stx")){let B=`${L}.stx`;if(await r(B)){if(n.debug)console.log(`Found in layouts path with extension: ${B}`);if(i)i.add(B);return B}}}if(n.partialsDir){let O=ce.join(n.partialsDir,"layouts");if(await r(O)){let L=ce.join(O,e);if(await r(L)){if(n.debug)console.log(`Found in partials layouts dir: ${L}`);if(i)i.add(L);return L}if(!e.endsWith(".stx")){let B=`${L}.stx`;if(await r(B)){if(n.debug)console.log(`Found in partials layouts dir with extension: ${B}`);if(i)i.add(B);return B}}}}let M=n.partialsDir||ce.join(process.cwd(),"views"),H=ce.join(M,e);if(await r(H)){if(n.debug)console.log(`Found in views path: ${H}`);if(i)i.add(H);return H}if(!e.endsWith(".stx")){let O=`${H}.stx`;if(await r(O)){if(n.debug)console.log(`Found in views path with extension: ${O}`);if(i)i.add(O);return O}}if(a.includes("temp")){let O=ce.join(ce.dirname(a),"layouts",e);if(await r(O)){if(n.debug)console.log(`Found in temp layouts dir: ${O}`);if(i)i.add(O);return O}if(!e.endsWith(".stx")){let L=`${O}.stx`;if(await r(L)){if(n.debug)console.log(`Found in temp layouts dir with extension: ${L}`);if(i)i.add(L);return L}}}if(n.debug)console.warn(`Template not found after trying all paths: ${e} (referenced from ${t})`);else console.warn(`Template not found: ${e} (referenced from ${t})`);return null}function nl(e,t,n){let i=0,a="",l="";try{if(typeof t==="number"&&t>=0){let c=e.split(`
586
586
  `),b=0;for(let v=0;v<c.length;v++)if(b+=c[v].length+1,b>=t){i=v+1,a=c[v].trim();let T=Math.max(0,v-2),P=Math.min(c.length,v+3);l=c.slice(T,P).map((M,H)=>{let O=T+H+1;return`${O===i?"> ":" "}${O}: ${M}`}).join(`
587
- `);break}}else if(n){let c=e.indexOf(n);if(c>=0)return tl(e,c)}}catch{}return{lineNumber:i,lineContent:a,context:l}}var Ee={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,t,n,i,a,l){let{lineNumber:c,context:b}=tl(i,a,l),v=n.split("/").pop(),T=0;if(typeof a==="number"&&a>=0&&i){let M=i.lastIndexOf(`
587
+ `);break}}else if(n){let c=e.indexOf(n);if(c>=0)return nl(e,c)}}catch{}return{lineNumber:i,lineContent:a,context:l}}var Ee={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,t,n,i,a,l){let{lineNumber:c,context:b}=nl(i,a,l),v=n.split("/").pop(),T=0;if(typeof a==="number"&&a>=0&&i){let M=i.lastIndexOf(`
588
588
  `,Math.max(0,a-1));T=a-(M+1)+1}let P="";if(c>0)P+=`
589
589
  ${n}:${c}${T>0?`:${T}`:""}: ${e.toLowerCase()} error: ${t}
590
590
  `;if(P+=`
@@ -597,8 +597,8 @@ ${Ee.yellow}${Ee.bold}Message:${Ee.reset} ${t}
597
597
  `,b)P+=`
598
598
  ${Ee.blue}${Ee.bold}Context:${Ee.reset}
599
599
  ${Ee.dim}${b}${Ee.reset}
600
- `;return P}function ge(){cn.clear(),lr.clear(),ns.clear(),ur.clear(),fr.clear(),pr.clear(),ss.clear()}function ty(){return{size:cn.size,maxSize:500}}var cr=w(128);async function hu(e,t,n){let i=S(e,t,n),a=cr.get(i);if(a){if(js(a.deps))return a;cr.delete(i)}let l=bi(e,{filePath:t,projectRoot:process.cwd()}),c=l.code,b=wi(l.styles);c=Mt(c).code;let{hasUserImports:v,bundleClientScript:T}=await o("stx/client-script-bundler",()=>import("./chunk-fz433ybr.js")),P=[],M=!1;if(v(c)){let G=c;c=await T(G,t,{projectRoot:process.cwd(),minify:n,collectInputs:P}),M=c===G}let{stripStxRuntimeImports:H}=await o("stx/signal-processing",()=>import("./chunk-1k751fgt.js"));c=H(c);let O=I(c),L=cu(O),B=new Set(V(O,!0).split(",").map((G)=>G.trim())),F=`function(__scopeId) {
601
- ${ct("const",[...gl,...L],O)}
600
+ `;return P}function ge(){cn.clear(),cr.clear(),ns.clear(),lr.clear(),ur.clear(),fr.clear(),ss.clear()}function ny(){return{size:cn.size,maxSize:500}}var ar=w(128);async function hu(e,t,n){let i=S(e,t,n),a=ar.get(i);if(a){if(Bs(a.deps))return a;ar.delete(i)}let l=wi(e,{filePath:t,projectRoot:process.cwd()}),c=l.code,b=vi(l.styles);c=Mt(c).code;let{hasUserImports:v,bundleClientScript:T}=await o("stx/client-script-bundler",()=>import("./chunk-hs6fg0k9.js")),P=[],M=!1;if(v(c)){let G=c;c=await T(G,t,{projectRoot:process.cwd(),minify:n,collectInputs:P}),M=c===G}let{stripStxRuntimeImports:H}=await o("stx/signal-processing",()=>import("./chunk-yk90sqqv.js"));c=H(c);let O=I(c),L=cu(O),B=new Set(V(O,!0).split(",").map((G)=>G.trim())),F=`function(__scopeId) {
601
+ ${ct("const",[...ml,...L],O)}
602
602
  const __scope = window.stx._scopes = window.stx._scopes || {};
603
603
  const __scopeVars = __scope[__scopeId] = __scope[__scopeId] || {};
604
604
  __scopeVars.$refs = __scopeVars.$refs || {};
@@ -667,7 +667,7 @@ ${O}
667
667
  // Register all defined signals and functions in this scope
668
668
  const __localVars = {};
669
669
  try {
670
- ${L.map((G)=>B.has(G)?`Object.defineProperty(__localVars, '${G}', ${Os(G)});`:`if (typeof ${G} !== 'undefined') __localVars['${G}'] = ${G};`).join(`
670
+ ${L.map((G)=>B.has(G)?`Object.defineProperty(__localVars, '${G}', ${Ns(G)});`:`if (typeof ${G} !== 'undefined') __localVars['${G}'] = ${G};`).join(`
671
671
  `)}
672
672
  }
673
673
  catch (e) {}
@@ -686,24 +686,24 @@ finally {
686
686
  window.__STX_CURRENT_ELEMENT__ = __previousCurrentElement;
687
687
  window.__STX_CURRENT_PROPS__ = __previousCurrentProps;
688
688
  }
689
- }`,ee={vendorStyleTags:b,factoryBody:F,clientCode:O,deps:vr([...P,...l.styles.map((G)=>G.resolvedPath)])};if(!M&&l.unresolved.length===0)cr.set(i,ee);return ee}var bn=["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 xu=100,bu=599,hr="__stxResponseStatus",ln="__stxResponseHeaders";function is(e){return typeof e==="number"&&Number.isInteger(e)&&e>=xu&&e<=bu}function hn(e){for(let t of e.matchAll(/\bdefinePageMeta\s*\(\s*\{([\s\S]*?)\}\s*\)/g)){let n=t[1].match(/(?:^|,)\s*status\s*:\s*(\d{3})(?=\s*(?:,|$))/);if(!n)continue;let i=Number(n[1]);if(is(i))return i}return}function mr(e,t){if(!e||typeof e!=="object")return!1;let n=typeof t==="string"&&/^\d+$/.test(t.trim())?Number(t.trim()):t;if(!is(n))return!1;return e[hr]=n,!0}function yu(e,t,n){if(!e||typeof e!=="object")return;let i=String(t??"").trim();if(!i)return;e[ln]={...e[ln],[i]:String(n)}}function Nt(e){let t=e?.[hr];return is(t)?t:void 0}function Dt(e){let t=e?.[ln];if(!t||typeof t!=="object")return;let n=Object.entries(t).map(([i,a])=>[i,String(a)]);return n.length>0?Object.fromEntries(n):void 0}function zc(e,t){if(!e||!t||e===t||typeof t!=="object")return;let n=Nt(e);if(n!==void 0)t[hr]=n;let i=Dt(e);if(i)t[ln]={...t[ln],...i}}function Hs(e){return{setResponseStatus:(t)=>{mr(e,t)},notFound:(t=404)=>{let n=is(t)&&t>=400?t:404;mr(e,n)},setResponseHeader:(t,n)=>{yu(e,t,n)}}}function Hc(e,t,n={}){if(!e.includes("@status"))return e;let{filePath:i,buildMode:a}=n,l=a==="compile",c="",b=0,v=/@status\s*\(/g,T;while((T=v.exec(e))!==null){let P=_u(e,T.index+T[0].length-1);if(P<0)break;let M=e.slice(T.index+T[0].length,P).trim(),H=/^\d+$/.test(M)?Number(M):u(M,t),O=i?` in ${i}`:"";if(l)console.warn(`[stx] @status(${M})${O} is skipped when precompiling: the build has no request, so the branch it sits in is not the one a visitor will get. Call notFound() or setResponseStatus(${M}) from <script server> instead \u2014 that runs per request.`);else if(!mr(t,H))console.warn(`[stx] @status(${M})${O} is not an HTTP status (100-599) \u2014 ignoring it.`);c+=e.slice(b,T.index),b=P+1+(e.slice(P+1).match(/^[^\S\n]*\n?/)?.[0].length??0),v.lastIndex=b}return b===0?e:c+e.slice(b)}function _u(e,t){let n=1,i=null,a=!1;for(let l=t+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==="(")n++;else if(c===")"&&--n===0)return l}return-1}var Ko=new Set(bn),wu=new Set(["props","$props","defineProps"]),Su=new Set(["stx","@stacksjs/stx"]),Xo=w(128),Jo=w(64);function $u(e){let t=[],n=0,i=e.split(`
690
- `);for(let a of i){let l=n,c=null,b=!1;for(let v=0;v<a.length;v++){let T=a[v];if(b){b=!1;continue}if(T==="\\"){b=!0;continue}if(c){if(T===c)c=null;continue}if(T==="'"||T==='"'||T==="`"){c=T;continue}if(T==="/"&&v+1<a.length&&a[v+1]==="/")break;if(T==="{")n++;else if(T==="}")n--}if(l===0){let v=a.match(/(?:const|let|var)\s+(\w+)\s*=/);if(v)t.push(v[1]);else if(/^\s*(?:const|let|var)\s+\w+\s*;?\s*$/.test(a)){let T=a.match(/(?:const|let|var)\s+(\w+)/);if(T)t.push(T[1])}else{let T=a.match(/(?:const|let|var)\s+(\{[^}]+\}|\[[^\]]+\])\s*=/);if(T){let M=T[1].slice(1,-1).split(",").map((H)=>{let O=H.split(":");return(O.length>1?O[1]:O[0]).trim()}).filter((H)=>/^\w+$/.test(H));t.push(...M)}}}}return[...new Set(t)]}function rg(e){let t=e;t=t.replace(/^\s*import\s+.*?from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),t=t.replace(/^\s*import\s+['"][^'"]+['"]\s*;?\s*$/gm,""),t=t.replace(/^\s*interface\s+\w+\s*\{[\s\S]*?\n\}\s*$/gm,""),t=t.replace(/^\s*type\s+\w+\s*=[\s\S]*?(?=\n(?:const|let|var|function|export|interface|type|$))/gm,""),t=t.replace(/^(\s*(?:export\s+)?(?:const|let|var)\s+)(\w+|\{[^}]+\}|\[[^\]]+\])\s*:\s*[^=]+(\s*=)/gm,"$1$2$3");function n(i){if(!i.includes(":"))return i;let a=[],l="",c=0,b=0,v=null;for(let T=0;T<i.length;T++){let P=i[T];if(v){if(l+=P,P===v)v=null;continue}if(P==='"'||P==="'"||P==="`"){v=P,l+=P;continue}if(P==="<")c++;else if(P===">"&&c>0)c--;else if(P==="(")b++;else if(P===")")b--;if(P===","&&c===0&&b===0){a.push(l),l="";continue}l+=P}if(l)a.push(l);return a.map((T)=>{let P=T.trim(),M=P.startsWith("..."),H=M?P.slice(3):P,O=-1,L=0;for(let se=0;se<H.length;se++)if(H[se]==="<")L++;else if(H[se]===">")L--;else if(H[se]===":"&&L===0){O=se;break}if(O===-1)return T;let F=H.substring(0,O).trim().replace(/\?$/,""),ee=H.substring(O+1),G=-1,j=0;for(let se=0;se<ee.length;se++)if(ee[se]==="<")j++;else if(ee[se]===">")j--;else if(ee[se]==="="&&j===0){G=se;break}let te=M?"...":"";if(G!==-1)return`${te}${F} = ${ee.substring(G+1).trim()}`;return`${te}${F}`}).join(", ")}t=t.replace(/\b(function\s+\w*\s*)\(([^)]*)\)/g,(i,a,l)=>{if(!l.includes(":"))return i;return`${a}(${n(l)})`});{let i=/\b(function\s+\w*\s*)\(/g,a,l=[];while((a=i.exec(t))!==null){let c=a.index+a[0].length-1,b=1,v=c+1,T=0,P=null;while(v<t.length&&b>0){let O=t[v];if(P){if(O===P)P=null;v++;continue}if(O==='"'||O==="'"||O==="`"){P=O,v++;continue}if(O==="<")T++;else if(O===">"&&T>0)T--;else if(T===0){if(O==="(")b++;else if(O===")")b--}if(b>0)v++}if(b!==0)continue;let M=t.substring(c+1,v);if(!M.includes(":"))continue;let H=n(M);l.push({start:c+1,end:v,replacement:H})}for(let c=l.length-1;c>=0;c--){let{start:b,end:v,replacement:T}=l[c];t=t.substring(0,b)+T+t.substring(v)}}return t=t.replace(/\(([^)]*)\)\s*(?::\s*[^=]+)?\s*=>/g,(i,a)=>{if(!a.includes(":"))return i;if(a.includes("{")||a.includes("}"))return i;return`(${a.split(",").map((c)=>{let[b,...v]=c.split("="),T=b.split(":")[0].trim();if(v.length>0)return`${T} = ${v.join("=").trim()}`;return T}).join(", ")}) =>`}),t=t.replace(/(\))\s*:\s*([A-Z]\w*|void|string|number|boolean|any|unknown|never|null|undefined)(?:<[^>]+>)?(?:\s*\|\s*(?:[A-Z]\w*|void|string|number|boolean|any|unknown|never|null|undefined))*\s*(\{)/g,"$1$3"),t=t.replace(/(\b(?:function|class|interface|type|extends|implements)\s+\w+)\s*<[^<>()]*>/g,"$1"),t=t.replace(/(\b(?:defineProps|withDefaults|defineEmits|defineSlots|Array|Promise|Map|Set|Record|Partial|Required|Readonly|Pick|Omit|Exclude|Extract))\s*<[^<>()]*>/g,"$1"),t=t.replace(/(\w+)\s*<[A-Z][^<>()]*>\s*(?=\()/g,"$1"),t=t.replace(/\s+as\s+(?:const|[A-Za-z]\w*(?:\[\])?(?:\s*\|\s*\w+(?:\[\])?)*)/g,""),t=t.replace(/\s+satisfies\s+\w+(?:<[^>]*>)?/g,""),t=t.replace(/(\w|\)|\])\s*!(?!=)/g,"$1"),t=t.replace(/^\s*(?:export\s+)?(?:const\s+)?enum\s+\w+\s*\{[^}]*\}\s*$/gm,""),t=t.replace(/(?<=[\s=,(])<[A-Z]\w*(?:\[\])?>/g,""),t=t.replace(/\n\s*\n\s*\n/g,`
689
+ }`,ee={vendorStyleTags:b,factoryBody:F,clientCode:O,deps:xr([...P,...l.styles.map((G)=>G.resolvedPath)])};if(!M&&l.unresolved.length===0)ar.set(i,ee);return ee}var bn=["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 xu=100,bu=599,mr="__stxResponseStatus",ln="__stxResponseHeaders";function is(e){return typeof e==="number"&&Number.isInteger(e)&&e>=xu&&e<=bu}function hn(e){for(let t of e.matchAll(/\bdefinePageMeta\s*\(\s*\{([\s\S]*?)\}\s*\)/g)){let n=t[1].match(/(?:^|,)\s*status\s*:\s*(\d{3})(?=\s*(?:,|$))/);if(!n)continue;let i=Number(n[1]);if(is(i))return i}return}function gr(e,t){if(!e||typeof e!=="object")return!1;let n=typeof t==="string"&&/^\d+$/.test(t.trim())?Number(t.trim()):t;if(!is(n))return!1;return e[mr]=n,!0}function yu(e,t,n){if(!e||typeof e!=="object")return;let i=String(t??"").trim();if(!i)return;e[ln]={...e[ln],[i]:String(n)}}function Nt(e){let t=e?.[mr];return is(t)?t:void 0}function Dt(e){let t=e?.[ln];if(!t||typeof t!=="object")return;let n=Object.entries(t).map(([i,a])=>[i,String(a)]);return n.length>0?Object.fromEntries(n):void 0}function Hc(e,t){if(!e||!t||e===t||typeof t!=="object")return;let n=Nt(e);if(n!==void 0)t[mr]=n;let i=Dt(e);if(i)t[ln]={...t[ln],...i}}function Vs(e){return{setResponseStatus:(t)=>{gr(e,t)},notFound:(t=404)=>{let n=is(t)&&t>=400?t:404;gr(e,n)},setResponseHeader:(t,n)=>{yu(e,t,n)}}}function Vc(e,t,n={}){if(!e.includes("@status"))return e;let{filePath:i,buildMode:a}=n,l=a==="compile",c="",b=0,v=/@status\s*\(/g,T;while((T=v.exec(e))!==null){let P=_u(e,T.index+T[0].length-1);if(P<0)break;let M=e.slice(T.index+T[0].length,P).trim(),H=/^\d+$/.test(M)?Number(M):u(M,t),O=i?` in ${i}`:"";if(l)console.warn(`[stx] @status(${M})${O} is skipped when precompiling: the build has no request, so the branch it sits in is not the one a visitor will get. Call notFound() or setResponseStatus(${M}) from <script server> instead \u2014 that runs per request.`);else if(!gr(t,H))console.warn(`[stx] @status(${M})${O} is not an HTTP status (100-599) \u2014 ignoring it.`);c+=e.slice(b,T.index),b=P+1+(e.slice(P+1).match(/^[^\S\n]*\n?/)?.[0].length??0),v.lastIndex=b}return b===0?e:c+e.slice(b)}function _u(e,t){let n=1,i=null,a=!1;for(let l=t+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==="(")n++;else if(c===")"&&--n===0)return l}return-1}var Ko=new Set(bn),wu=new Set(["props","$props","defineProps"]),Su=new Set(["stx","@stacksjs/stx"]),Xo=w(128),Jo=w(64);function $u(e){let t=[],n=0,i=e.split(`
690
+ `);for(let a of i){let l=n,c=null,b=!1;for(let v=0;v<a.length;v++){let T=a[v];if(b){b=!1;continue}if(T==="\\"){b=!0;continue}if(c){if(T===c)c=null;continue}if(T==="'"||T==='"'||T==="`"){c=T;continue}if(T==="/"&&v+1<a.length&&a[v+1]==="/")break;if(T==="{")n++;else if(T==="}")n--}if(l===0){let v=a.match(/(?:const|let|var)\s+(\w+)\s*=/);if(v)t.push(v[1]);else if(/^\s*(?:const|let|var)\s+\w+\s*;?\s*$/.test(a)){let T=a.match(/(?:const|let|var)\s+(\w+)/);if(T)t.push(T[1])}else{let T=a.match(/(?:const|let|var)\s+(\{[^}]+\}|\[[^\]]+\])\s*=/);if(T){let M=T[1].slice(1,-1).split(",").map((H)=>{let O=H.split(":");return(O.length>1?O[1]:O[0]).trim()}).filter((H)=>/^\w+$/.test(H));t.push(...M)}}}}return[...new Set(t)]}function sg(e){let t=e;t=t.replace(/^\s*import\s+.*?from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),t=t.replace(/^\s*import\s+['"][^'"]+['"]\s*;?\s*$/gm,""),t=t.replace(/^\s*interface\s+\w+\s*\{[\s\S]*?\n\}\s*$/gm,""),t=t.replace(/^\s*type\s+\w+\s*=[\s\S]*?(?=\n(?:const|let|var|function|export|interface|type|$))/gm,""),t=t.replace(/^(\s*(?:export\s+)?(?:const|let|var)\s+)(\w+|\{[^}]+\}|\[[^\]]+\])\s*:\s*[^=]+(\s*=)/gm,"$1$2$3");function n(i){if(!i.includes(":"))return i;let a=[],l="",c=0,b=0,v=null;for(let T=0;T<i.length;T++){let P=i[T];if(v){if(l+=P,P===v)v=null;continue}if(P==='"'||P==="'"||P==="`"){v=P,l+=P;continue}if(P==="<")c++;else if(P===">"&&c>0)c--;else if(P==="(")b++;else if(P===")")b--;if(P===","&&c===0&&b===0){a.push(l),l="";continue}l+=P}if(l)a.push(l);return a.map((T)=>{let P=T.trim(),M=P.startsWith("..."),H=M?P.slice(3):P,O=-1,L=0;for(let se=0;se<H.length;se++)if(H[se]==="<")L++;else if(H[se]===">")L--;else if(H[se]===":"&&L===0){O=se;break}if(O===-1)return T;let F=H.substring(0,O).trim().replace(/\?$/,""),ee=H.substring(O+1),G=-1,j=0;for(let se=0;se<ee.length;se++)if(ee[se]==="<")j++;else if(ee[se]===">")j--;else if(ee[se]==="="&&j===0){G=se;break}let te=M?"...":"";if(G!==-1)return`${te}${F} = ${ee.substring(G+1).trim()}`;return`${te}${F}`}).join(", ")}t=t.replace(/\b(function\s+\w*\s*)\(([^)]*)\)/g,(i,a,l)=>{if(!l.includes(":"))return i;return`${a}(${n(l)})`});{let i=/\b(function\s+\w*\s*)\(/g,a,l=[];while((a=i.exec(t))!==null){let c=a.index+a[0].length-1,b=1,v=c+1,T=0,P=null;while(v<t.length&&b>0){let O=t[v];if(P){if(O===P)P=null;v++;continue}if(O==='"'||O==="'"||O==="`"){P=O,v++;continue}if(O==="<")T++;else if(O===">"&&T>0)T--;else if(T===0){if(O==="(")b++;else if(O===")")b--}if(b>0)v++}if(b!==0)continue;let M=t.substring(c+1,v);if(!M.includes(":"))continue;let H=n(M);l.push({start:c+1,end:v,replacement:H})}for(let c=l.length-1;c>=0;c--){let{start:b,end:v,replacement:T}=l[c];t=t.substring(0,b)+T+t.substring(v)}}return t=t.replace(/\(([^)]*)\)\s*(?::\s*[^=]+)?\s*=>/g,(i,a)=>{if(!a.includes(":"))return i;if(a.includes("{")||a.includes("}"))return i;return`(${a.split(",").map((c)=>{let[b,...v]=c.split("="),T=b.split(":")[0].trim();if(v.length>0)return`${T} = ${v.join("=").trim()}`;return T}).join(", ")}) =>`}),t=t.replace(/(\))\s*:\s*([A-Z]\w*|void|string|number|boolean|any|unknown|never|null|undefined)(?:<[^>]+>)?(?:\s*\|\s*(?:[A-Z]\w*|void|string|number|boolean|any|unknown|never|null|undefined))*\s*(\{)/g,"$1$3"),t=t.replace(/(\b(?:function|class|interface|type|extends|implements)\s+\w+)\s*<[^<>()]*>/g,"$1"),t=t.replace(/(\b(?:defineProps|withDefaults|defineEmits|defineSlots|Array|Promise|Map|Set|Record|Partial|Required|Readonly|Pick|Omit|Exclude|Extract))\s*<[^<>()]*>/g,"$1"),t=t.replace(/(\w+)\s*<[A-Z][^<>()]*>\s*(?=\()/g,"$1"),t=t.replace(/\s+as\s+(?:const|[A-Za-z]\w*(?:\[\])?(?:\s*\|\s*\w+(?:\[\])?)*)/g,""),t=t.replace(/\s+satisfies\s+\w+(?:<[^>]*>)?/g,""),t=t.replace(/(\w|\)|\])\s*!(?!=)/g,"$1"),t=t.replace(/^\s*(?:export\s+)?(?:const\s+)?enum\s+\w+\s*\{[^}]*\}\s*$/gm,""),t=t.replace(/(?<=[\s=,(])<[A-Z]\w*(?:\[\])?>/g,""),t=t.replace(/\n\s*\n\s*\n/g,`
691
691
 
692
- `),t}function sg(e){return e.replace(/\s*(?:imported from|from)\s+(?:(['"])([^'"\r\n]+)\1|(\S+))/g,(t,...n)=>{let[,i,a]=n,l=i??a;return/(?:[/\\]packages[/\\]stx[/\\]|@stacksjs[/\\]stx[/\\])/.test(l)?"":t})}function og(e){return/cannot find module|cannot find package|could not resolve|module not found|failed to resolve/i.test(e)}function ig(e){if(e instanceof SyntaxError)return!0;let t=e instanceof Error?e.message:String(e);return/SyntaxError|Unexpected (token|identifier|string|number|keyword|end of)|Unterminated|Expected .+ but found/i.test(t)}function ag(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 Go=new Set;async function m(e,t,n,i={}){if(!e.trim())return;let a=C(),l=S(e,JSON.stringify(a)),c=Xo.get(l);if(c===void 0){try{let re=Z({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=re.transformSync(ae)}catch{c=rg(e)}Xo.set(l,c)}let b={exports:{}},v=b.exports,T=Wt.cwd(),P={},M=[...c.matchAll(/require\s*\(\s*['"]([^'"]+)['"]\s*\)/g)||[]].map((re)=>re[1]).filter((re)=>!re.startsWith("node:")&&!["fs","path","os","child_process","crypto","http","https","url","util","stream","events","buffer","net","querystring","zlib","tls"].includes(re)),H=new Map;for(let re of M)try{if(re.startsWith(".")){P[re]=await import(at.resolve(at.dirname(n),re));continue}let ae=at.resolve(T,"node_modules",re),he=at.join(ae,"package.json"),$e=JSON.parse(g("fs").readFileSync(he,"utf8")),Pe=$e.main||"index.js";if($e.exports){let Ve=typeof $e.exports==="string"?$e.exports:$e.exports["."];if(typeof Ve==="string")Pe=Ve;else if(Ve?.bun)Pe=Ve.bun;else if(Ve?.import)Pe=Ve.import;else if(Ve?.default)Pe=Ve.default}P[re]=await import(at.resolve(ae,Pe))}catch(ae){if(re.startsWith("."))H.set(re,ae instanceof Error?ae.message:String(ae))}let O=(re)=>{if(P[re])return P[re];let ae=H.get(re);if(ae!==void 0)throw Error(`Cannot require '${re}' from ${n}: ${ae}`);return g(re)},L=t.props||{},B=(re)=>{if(!re)return L;let ae={};for(let[he,$e]of Object.entries(re)){let Pe=L[he];if(Pe!==void 0)ae[he]=Pe;else if(typeof $e==="function")ae[he]=$e();else ae[he]=$e}return ae};for(let[re,ae]of Object.entries(L))Object.defineProperty(B,re,{value:ae,enumerable:!0,configurable:!0,writable:!0});let F=(re,ae=!1)=>{if(re===void 0||re===null)return ae;if(typeof re==="string"){let he=re.trim().toLowerCase();if(he===""||he==="true"||he==="1"||he==="on"||he==="yes")return!0;if(he==="false"||he==="0"||he==="off"||he==="no")return!1;return!0}return Boolean(re)},ee=(re,ae=0)=>{if(re===void 0||re===null)return ae;if(typeof re==="string"){let $e=re.trim();if($e==="")return ae;let Pe=Number($e);return Number.isFinite(Pe)?Pe:ae}let he=Number(re);return Number.isFinite(he)?he:ae};for(let re of["name","length","caller","arguments"]){if(Object.prototype.hasOwnProperty.call(L,re))continue;try{Object.defineProperty(B,re,{value:void 0,enumerable:!1,configurable:!0,writable:!0})}catch{}}let G=(re)=>{if(!re)return L;let ae={...L};for(let[he,$e]of Object.entries(re)){let Pe=$e&&typeof $e==="object"&&!Array.isArray($e)?$e:{type:$e};if(ae[he]===void 0&&Pe.default!==void 0)ae[he]=typeof Pe.default==="function"?Pe.default():Pe.default}return ae},j=()=>t.slots||{},te=(re,ae)=>{let he={...re};for(let[$e,Pe]of Object.entries(ae))if(he[$e]===void 0)if(typeof Pe==="function")he[$e]=Pe();else he[$e]=Pe;return he},se=(re)=>{let ae=()=>re;return ae.set=(he)=>{},ae.update=(he)=>{},ae},ne=(re)=>{let ae,he=!1;return()=>{if(!he)try{ae=re(),he=!0}catch{ae=void 0}return ae}},ue=(re)=>{},ye=(re)=>re(),de=(re)=>{},Ae=(re)=>{},Ze=Hs(t);function Re(re){let ae=re||{};if(ae.title!==void 0||ae.description!==void 0)et({title:ae.title,description:ae.description})}function Ke(re){if(!re||typeof re!=="object")return;let ae=t.__stxClientPayload??{};Object.assign(ae,re),t.__stxClientPayload=ae}let Ye=()=>{let re=t.__stxServeContext,ae=t.__stxServeSearch??re?.search??"",he=re?.path??"",$e=Object.fromEntries(new URLSearchParams(ae)),Pe=t.query,Ve=Object.keys($e).length>0?$e:Pe??{},it=ae||(Object.keys(Ve).length>0?`?${new URLSearchParams(Ve).toString()}`:"");return{params:t.params??{},query:Ve,path:he,name:"",fullPath:he+it,hash:"",matched:[]}},Je=()=>({push:(re)=>{},replace:(re)=>{},back:()=>{},forward:()=>{},go:(re)=>{}}),rt=(re)=>{let ae=t.__stx_runtime_head||{};t.__stx_runtime_head=Ue(ae,Ce(re||{},{known:Zs,source:"useHead()"}))},et=(re)=>{rt(Qs(re||{}))},yt=(re)=>({value:re}),Ft=(re)=>re,yr=(re)=>({value:typeof re==="function"?re():re}),lt=(re,ae)=>{},We=(re)=>{},Vt=(re)=>{},un=(re)=>re?re():Promise.resolve(),os=(re)=>(ae,...he)=>{},Ut=(re)=>{},tt=(re,ae)=>{},Ht=(re,ae)=>ae,as=()=>({value:"light"}),vt=()=>se(!1),ut=(re)=>se(!1),qt=()=>se(!1),dn=()=>ut("(prefers-color-scheme: dark)"),Zt=()=>ut("(prefers-color-scheme: light)"),Kt=()=>ut("(prefers-reduced-motion: reduce)"),$r=()=>ut("(prefers-contrast: more)"),nt={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:{}},Xt=new Proxy(nt,{get(re,ae){if(ae in re)return re[ae];return},set(re,ae,he){return re[ae]=he,!0}}),cs={getElementById:()=>null,querySelector:()=>null,querySelectorAll:()=>[],createElement:()=>({}),createTextNode:()=>({}),body:{},head:{},documentElement:{},addEventListener:()=>{},removeEventListener:()=>{}},ft=console;try{let re=yi(c,n),ae=new Set(Object.keys(L)),he=Object.keys(t).filter((oe)=>!ae.has(oe)&&!wu.has(oe)&&Bt(oe)),$e=he.map((oe)=>t[oe]);if(!he.includes("__stxServeContext"))he.push("__stxServeContext"),$e.push(void 0);if(!ae.has("cookies")){let oe=t.cookies??t.__stxServeContext?.cookies??{},le=he.indexOf("cookies");if(le<0)he.push("cookies"),$e.push(oe);else $e[le]=oe}let Pe=new Set(["async","module","exports","require","params","window","document","console","state","derived","effect"]),Ve=[],it=[];for(let[oe,le]of Object.entries(L)){if(!Bt(oe))continue;if(Pe.has(oe))continue;if(new RegExp(`(?:^|[\\s;{])(?:const|let|var|function)\\s+${oe}\\b`).test(re))continue;Ve.push(oe),it.push(le)}let us=$u(re).map((oe)=>`module.exports.${oe} = typeof ${oe} !== 'undefined' ? ${oe} : module.exports.${oe};`).join(`
692
+ `),t}function og(e){return e.replace(/\s*(?:imported from|from)\s+(?:(['"])([^'"\r\n]+)\1|(\S+))/g,(t,...n)=>{let[,i,a]=n,l=i??a;return/(?:[/\\]packages[/\\]stx[/\\]|@stacksjs[/\\]stx[/\\])/.test(l)?"":t})}function ig(e){return/cannot find module|cannot find package|could not resolve|module not found|failed to resolve/i.test(e)}function ag(e){if(e instanceof SyntaxError)return!0;let t=e instanceof Error?e.message:String(e);return/SyntaxError|Unexpected (token|identifier|string|number|keyword|end of)|Unterminated|Expected .+ but found/i.test(t)}function cg(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 Go=new Set;async function m(e,t,n,i={}){if(!e.trim())return;let a=C(),l=S(e,JSON.stringify(a)),c=Xo.get(l);if(c===void 0){try{let re=Z({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=re.transformSync(ae)}catch{c=sg(e)}Xo.set(l,c)}let b={exports:{}},v=b.exports,T=Wt.cwd(),P={},M=[...c.matchAll(/require\s*\(\s*['"]([^'"]+)['"]\s*\)/g)||[]].map((re)=>re[1]).filter((re)=>!re.startsWith("node:")&&!["fs","path","os","child_process","crypto","http","https","url","util","stream","events","buffer","net","querystring","zlib","tls"].includes(re)),H=new Map;for(let re of M)try{if(re.startsWith(".")){P[re]=await import(at.resolve(at.dirname(n),re));continue}let ae=at.resolve(T,"node_modules",re),he=at.join(ae,"package.json"),$e=JSON.parse(g("fs").readFileSync(he,"utf8")),Pe=$e.main||"index.js";if($e.exports){let Ve=typeof $e.exports==="string"?$e.exports:$e.exports["."];if(typeof Ve==="string")Pe=Ve;else if(Ve?.bun)Pe=Ve.bun;else if(Ve?.import)Pe=Ve.import;else if(Ve?.default)Pe=Ve.default}P[re]=await import(at.resolve(ae,Pe))}catch(ae){if(re.startsWith("."))H.set(re,ae instanceof Error?ae.message:String(ae))}let O=(re)=>{if(P[re])return P[re];let ae=H.get(re);if(ae!==void 0)throw Error(`Cannot require '${re}' from ${n}: ${ae}`);return g(re)},L=t.props||{},B=(re)=>{if(!re)return L;let ae={};for(let[he,$e]of Object.entries(re)){let Pe=L[he];if(Pe!==void 0)ae[he]=Pe;else if(typeof $e==="function")ae[he]=$e();else ae[he]=$e}return ae};for(let[re,ae]of Object.entries(L))Object.defineProperty(B,re,{value:ae,enumerable:!0,configurable:!0,writable:!0});let F=(re,ae=!1)=>{if(re===void 0||re===null)return ae;if(typeof re==="string"){let he=re.trim().toLowerCase();if(he===""||he==="true"||he==="1"||he==="on"||he==="yes")return!0;if(he==="false"||he==="0"||he==="off"||he==="no")return!1;return!0}return Boolean(re)},ee=(re,ae=0)=>{if(re===void 0||re===null)return ae;if(typeof re==="string"){let $e=re.trim();if($e==="")return ae;let Pe=Number($e);return Number.isFinite(Pe)?Pe:ae}let he=Number(re);return Number.isFinite(he)?he:ae};for(let re of["name","length","caller","arguments"]){if(Object.prototype.hasOwnProperty.call(L,re))continue;try{Object.defineProperty(B,re,{value:void 0,enumerable:!1,configurable:!0,writable:!0})}catch{}}let G=(re)=>{if(!re)return L;let ae={...L};for(let[he,$e]of Object.entries(re)){let Pe=$e&&typeof $e==="object"&&!Array.isArray($e)?$e:{type:$e};if(ae[he]===void 0&&Pe.default!==void 0)ae[he]=typeof Pe.default==="function"?Pe.default():Pe.default}return ae},j=()=>t.slots||{},te=(re,ae)=>{let he={...re};for(let[$e,Pe]of Object.entries(ae))if(he[$e]===void 0)if(typeof Pe==="function")he[$e]=Pe();else he[$e]=Pe;return he},se=(re)=>{let ae=()=>re;return ae.set=(he)=>{},ae.update=(he)=>{},ae},ne=(re)=>{let ae,he=!1;return()=>{if(!he)try{ae=re(),he=!0}catch{ae=void 0}return ae}},ue=(re)=>{},ye=(re)=>re(),de=(re)=>{},Ae=(re)=>{},Ze=Vs(t);function Re(re){let ae=re||{};if(ae.title!==void 0||ae.description!==void 0)et({title:ae.title,description:ae.description})}function Ke(re){if(!re||typeof re!=="object")return;let ae=t.__stxClientPayload??{};Object.assign(ae,re),t.__stxClientPayload=ae}let Ye=()=>{let re=t.__stxServeContext,ae=t.__stxServeSearch??re?.search??"",he=re?.path??"",$e=Object.fromEntries(new URLSearchParams(ae)),Pe=t.query,Ve=Object.keys($e).length>0?$e:Pe??{},it=ae||(Object.keys(Ve).length>0?`?${new URLSearchParams(Ve).toString()}`:"");return{params:t.params??{},query:Ve,path:he,name:"",fullPath:he+it,hash:"",matched:[]}},Je=()=>({push:(re)=>{},replace:(re)=>{},back:()=>{},forward:()=>{},go:(re)=>{}}),rt=(re)=>{let ae=t.__stx_runtime_head||{};t.__stx_runtime_head=Ue(ae,Ce(re||{},{known:Qs,source:"useHead()"}))},et=(re)=>{rt(eo(re||{}))},yt=(re)=>({value:re}),Ft=(re)=>re,br=(re)=>({value:typeof re==="function"?re():re}),lt=(re,ae)=>{},We=(re)=>{},Vt=(re)=>{},un=(re)=>re?re():Promise.resolve(),os=(re)=>(ae,...he)=>{},Ut=(re)=>{},tt=(re,ae)=>{},Ht=(re,ae)=>ae,as=()=>({value:"light"}),vt=()=>se(!1),ut=(re)=>se(!1),qt=()=>se(!1),dn=()=>ut("(prefers-color-scheme: dark)"),Zt=()=>ut("(prefers-color-scheme: light)"),Kt=()=>ut("(prefers-reduced-motion: reduce)"),yr=()=>ut("(prefers-contrast: more)"),nt={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:{}},Xt=new Proxy(nt,{get(re,ae){if(ae in re)return re[ae];return},set(re,ae,he){return re[ae]=he,!0}}),cs={getElementById:()=>null,querySelector:()=>null,querySelectorAll:()=>[],createElement:()=>({}),createTextNode:()=>({}),body:{},head:{},documentElement:{},addEventListener:()=>{},removeEventListener:()=>{}},ft=console;try{let re=bi(c,n),ae=new Set(Object.keys(L)),he=Object.keys(t).filter((oe)=>!ae.has(oe)&&!wu.has(oe)&&Bt(oe)),$e=he.map((oe)=>t[oe]);if(!he.includes("__stxServeContext"))he.push("__stxServeContext"),$e.push(void 0);if(!ae.has("cookies")){let oe=t.cookies??t.__stxServeContext?.cookies??{},le=he.indexOf("cookies");if(le<0)he.push("cookies"),$e.push(oe);else $e[le]=oe}let Pe=new Set(["async","module","exports","require","params","window","document","console","state","derived","effect"]),Ve=[],it=[];for(let[oe,le]of Object.entries(L)){if(!Bt(oe))continue;if(Pe.has(oe))continue;if(new RegExp(`(?:^|[\\s;{])(?:const|let|var|function)\\s+${oe}\\b`).test(re))continue;Ve.push(oe),it.push(le)}let us=$u(re).map((oe)=>`module.exports.${oe} = typeof ${oe} !== 'undefined' ? ${oe} : module.exports.${oe};`).join(`
693
693
  `),$n=t.params??{},Jt=[],Gt=[];for(let oe=0;oe<he.length;oe++){if(he[oe]==="params")continue;Jt.push(he[oe]),Gt.push($e[oe])}let En=[...bn,...Ve,...Jt],Cn=`return (async () => {
694
694
  ${re}
695
695
  ${us}
696
696
  return module.exports
697
- })()`,pt=S(Cn,En.join("\x00")),ht=Jo.get(pt);if(!ht)ht=Function(...En,Cn),Jo.set(pt,ht);let dt=t.__stx_options?.runtimeConfig;if(dt||/\buse(?:Server)?RuntimeConfig\b/.test(c))await kn(t,n,dt);let qe=await He(t.__stx_runtime_config??_n()??D(),()=>jr(t,()=>ht(b,v,O,L,B,F,ee,G,te,Ke,Nr,Ci,Ks,se,ne,ue,ye,de,Ae,Re,Ye,Je,rt,et,Ze.setResponseStatus,Ze.setResponseHeader,Ze.notFound,yt,Ft,yr,lt,We,Vt,un,os,Ut,j,tt,Ht,as,vt,ut,qt,dn,Zt,Kt,$r,Xt,cs,ft,nt.confirm,nt.alert,nt.fetch,$n,...it,...Gt)));if(i.preserveExisting){for(let[oe,le]of Object.entries(qe))if(!(oe in t)||t[oe]===void 0)t[oe]=le}else Object.assign(t,qe);for(let[oe,le]of Object.entries(L))if(!(oe in t))t[oe]=le}catch(re){if(t.__stx_strict_hydration)throw re;let ae=sg(re instanceof Error?re.message:String(re));if(og(ae))console.warn(`[stx] server <script> in ${n??"<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:re});else if(ig(re))console.warn(`[stx] server <script> in ${n??"<unknown>"} does not parse, so every variable in that script is undefined. Cause: ${ae}`),i.onFailure?.({kind:"syntax",message:ae,error:re});else if(ag(ae))console.warn(`[stx] server <script> in ${n??"<unknown>"} names something that does not exist, so every variable in that script is undefined. Optional chaining does not help here: an undefined identifier throws before the chain is reached. Cause: ${ae}`),i.onFailure?.({kind:"missing-binding",message:ae,error:re});else{let he=`${n??"<unknown>"}\x00${ae}`;if(Wt.env.STX_DEBUG||!Go.has(he))Go.add(he),console.warn(`[stx] server <script> in ${n??"<unknown>"} threw, so every variable in that script is undefined and anything that reads one renders empty. Cause: ${ae}`);i.onFailure?.({kind:"unknown",message:ae,error:re})}try{await Tu(c,t,n)}catch(he){if(Wt.env.STX_DEBUG){let $e=he instanceof Error?he.message:String(he);console.warn(`[stx] fallback extraction also failed in ${n??"<unknown>"}: ${$e}`)}}}}function cg(e){let t=0,n=null,i=!1,a=!1;for(let l=0;l<e.length;l++){let c=e[l];if(n){if(c===n){if(n=null,i||t===0)a=!0}continue}if(c==="'"||c==='"'||c==="`"){n=c;continue}if(c==="{")t++;else if(c==="}")t--;else if(e.startsWith("from",l)&&t===0)i=!0}return n===null&&t===0&&a}var vu=/^(?:export\s+)?(?:const|let|var)\s+[A-Za-z_$][\w$]*(?:\s*,\s*[A-Za-z_$][\w$]*)*\s*;?$/;function yi(e,t){let n=t?at.dirname(t):Wt.cwd(),i=Wt.cwd(),a=e.split(`
697
+ })()`,pt=S(Cn,En.join("\x00")),ht=Jo.get(pt);if(!ht)ht=Function(...En,Cn),Jo.set(pt,ht);let dt=t.__stx_options?.runtimeConfig;if(dt||/\buse(?:Server)?RuntimeConfig\b/.test(c))await kn(t,n,dt);let qe=await He(t.__stx_runtime_config??_n()??D(),()=>Dr(t,()=>ht(b,v,O,L,B,F,ee,G,te,Ke,jr,Ei,Xs,se,ne,ue,ye,de,Ae,Re,Ye,Je,rt,et,Ze.setResponseStatus,Ze.setResponseHeader,Ze.notFound,yt,Ft,br,lt,We,Vt,un,os,Ut,j,tt,Ht,as,vt,ut,qt,dn,Zt,Kt,yr,Xt,cs,ft,nt.confirm,nt.alert,nt.fetch,$n,...it,...Gt)));if(i.preserveExisting){for(let[oe,le]of Object.entries(qe))if(!(oe in t)||t[oe]===void 0)t[oe]=le}else Object.assign(t,qe);for(let[oe,le]of Object.entries(L))if(!(oe in t))t[oe]=le}catch(re){if(t.__stx_strict_hydration)throw re;let ae=og(re instanceof Error?re.message:String(re));if(ig(ae))console.warn(`[stx] server <script> in ${n??"<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:re});else if(ag(re))console.warn(`[stx] server <script> in ${n??"<unknown>"} does not parse, so every variable in that script is undefined. Cause: ${ae}`),i.onFailure?.({kind:"syntax",message:ae,error:re});else if(cg(ae))console.warn(`[stx] server <script> in ${n??"<unknown>"} names something that does not exist, so every variable in that script is undefined. Optional chaining does not help here: an undefined identifier throws before the chain is reached. Cause: ${ae}`),i.onFailure?.({kind:"missing-binding",message:ae,error:re});else{let he=`${n??"<unknown>"}\x00${ae}`;if(Wt.env.STX_DEBUG||!Go.has(he))Go.add(he),console.warn(`[stx] server <script> in ${n??"<unknown>"} threw, so every variable in that script is undefined and anything that reads one renders empty. Cause: ${ae}`);i.onFailure?.({kind:"unknown",message:ae,error:re})}try{await Tu(c,t,n)}catch(he){if(Wt.env.STX_DEBUG){let $e=he instanceof Error?he.message:String(he);console.warn(`[stx] fallback extraction also failed in ${n??"<unknown>"}: ${$e}`)}}}}function lg(e){let t=0,n=null,i=!1,a=!1;for(let l=0;l<e.length;l++){let c=e[l];if(n){if(c===n){if(n=null,i||t===0)a=!0}continue}if(c==="'"||c==='"'||c==="`"){n=c;continue}if(c==="{")t++;else if(c==="}")t--;else if(e.startsWith("from",l)&&t===0)i=!0}return n===null&&t===0&&a}var vu=/^(?:export\s+)?(?:const|let|var)\s+[A-Za-z_$][\w$]*(?:\s*,\s*[A-Za-z_$][\w$]*)*\s*;?$/;function bi(e,t){let n=t?at.dirname(t):Wt.cwd(),i=Wt.cwd(),a=e.split(`
698
698
  `),l=[],c=0;while(c<a.length){let b=a[c].trim();if(b.startsWith("interface ")||b.startsWith("export interface ")||b.startsWith("type ")||b.startsWith("export type ")){if(b.includes("{")&&!b.includes("}")){let v=0;for(;c<a.length;c++){for(let T of a[c])if(T==="{")v++;else if(T==="}")v--;if(v<=0)break}}c++;continue}if(b.startsWith("definePageMeta(")){let v=0,T=!1,P=c;for(let O=c;O<a.length&&!T;O++){let L=null,B=!1,F=a[O];for(let ee=0;ee<F.length;ee++){let G=F[ee];if(B){B=!1;continue}if(G==="\\"){B=!0;continue}if(L){if(G===L)L=null;continue}if(G==='"'||G==="'"||G==="`"){L=G;continue}if(G==="(")v++;else if(G===")"){if(v--,v===0){c=O+1,T=!0;break}}}}if(!T)c=a.length;let M=a.slice(P,c).join(`
699
- `),H=[];for(let O of["title","description"]){let L=new RegExp(`\\b${O}\\s*:\\s*(['"\`])((?:\\\\.|(?!\\1)[^\\\\])*)\\1`).exec(M);if(L)H.push(`${O}: ${JSON.stringify(L[2])}`)}if(H.length>0)l.push(`useSeoMeta({ ${H.join(", ")} });`);continue}if(b.startsWith("import ")||b==="import"||b.startsWith("import{")||/^import['"]/.test(b)){let v=b,T=0;while(!cg(v)&&c+T+1<a.length)T++,v=`${v} ${a[c+T].trim()}`;c+=T;let P=v.match(/^import\s+(\w+)\s+from\s+['"](.+?)['"]/),M=v.match(/^import\s+\{([^}]*)\}\s+from\s+['"](.+?)['"]/),H=v.match(/^import\s*['"](.+?)['"]/),O=v,L=(B)=>{if(B.startsWith("."))return at.resolve(n,B);if(B.startsWith("~/")||B.startsWith("@/"))return at.resolve(i,B.slice(2));try{return Bun.resolveSync(B,n)}catch{return B}};if(P){let[,B,F]=P,ee=L(F);l.push(`const ${B} = (await import('${ee}')).default`),l.push(`module.exports.${B} = ${B};`)}else if(M){let[,B,F]=M,ee=L(F),G=[],j=[],te=Su.has(F);for(let se of B.split(",")){let ne=se.trim();if(!ne)continue;let ue=ne.split(/\s+as\s+/);if(ue.length===2){let[ye,de]=[ue[0].trim(),ue[1].trim()];if(te&&Ko.has(ye)){l.push(`const ${de} = ${ye};`);continue}G.push(`${ye}: ${de}`),j.push(de)}else{if(te&&Ko.has(ne))continue;G.push(ne),j.push(ne)}}if(G.length>0)l.push(`const { ${G.join(", ")} } = await import('${ee}')`);for(let se of j)l.push(`module.exports.${se} = ${se};`)}else if(H){let B=L(H[1]);l.push(`await import('${B}')`)}else l.push(O);c++;continue}if(vu.test(b))l.push(a[c]),c++;else if(b.startsWith("export const ")||b.startsWith("export let ")||b.startsWith("export var ")){let v=Qo(a,c),{type:T,name:P,value:M}=v;l.push(`${T} ${P} = ${M};`),l.push(`module.exports.${P} = ${P};`),c=v.nextIndex}else if(b.startsWith("export function ")||b.startsWith("export async function ")){let v=br(a,c);l.push(v.functionCode),l.push(`module.exports.${v.name} = ${v.name};`),c=v.nextIndex}else if(b.startsWith("const ")||b.startsWith("let ")||b.startsWith("var ")){let v=Qo(a,c),{type:T,name:P,value:M}=v;l.push(`${T} ${P} = ${M};`),l.push(`module.exports.${P} = ${P};`),c=v.nextIndex}else if(b.startsWith("function ")||b.startsWith("async function ")){let v=br(a,c);l.push(v.functionCode),l.push(`module.exports.${v.name} = ${v.name};`),c=v.nextIndex}else if(b.startsWith("export default function ")||b.startsWith("export default async function ")){let v=a[c].replace(/^(\s*)export\s+default\s+/,"$1"),T=[...a];T[c]=v;let P=br(T,c);if(l.push(P.functionCode),P.name)l.push(`module.exports.default = ${P.name};`);c=P.nextIndex}else if(b.startsWith("export default ")){let v=b.replace(/^export\s+default\s+/,"").replace(/;$/,"");l.push(`module.exports.default = ${v};`),c++}else if(b.startsWith("class ")||b.startsWith("export class ")){let v=b.match(/(?:export\s+)?class\s+(\w+)/);if(v){let T=v[1],P=a[c].replace(/^export\s+/,""),M=0,H=c;for(;H<a.length;H++){let O=a[H];for(let L of O)if(L==="{")M++;else if(L==="}")M--;if(H>c)P+=`
699
+ `),H=[];for(let O of["title","description"]){let L=new RegExp(`\\b${O}\\s*:\\s*(['"\`])((?:\\\\.|(?!\\1)[^\\\\])*)\\1`).exec(M);if(L)H.push(`${O}: ${JSON.stringify(L[2])}`)}if(H.length>0)l.push(`useSeoMeta({ ${H.join(", ")} });`);continue}if(b.startsWith("import ")||b==="import"||b.startsWith("import{")||/^import['"]/.test(b)){let v=b,T=0;while(!lg(v)&&c+T+1<a.length)T++,v=`${v} ${a[c+T].trim()}`;c+=T;let P=v.match(/^import\s+(\w+)\s+from\s+['"](.+?)['"]/),M=v.match(/^import\s+\{([^}]*)\}\s+from\s+['"](.+?)['"]/),H=v.match(/^import\s*['"](.+?)['"]/),O=v,L=(B)=>{if(B.startsWith("."))return at.resolve(n,B);if(B.startsWith("~/")||B.startsWith("@/"))return at.resolve(i,B.slice(2));try{return Bun.resolveSync(B,n)}catch{return B}};if(P){let[,B,F]=P,ee=L(F);l.push(`const ${B} = (await import('${ee}')).default`),l.push(`module.exports.${B} = ${B};`)}else if(M){let[,B,F]=M,ee=L(F),G=[],j=[],te=Su.has(F);for(let se of B.split(",")){let ne=se.trim();if(!ne)continue;let ue=ne.split(/\s+as\s+/);if(ue.length===2){let[ye,de]=[ue[0].trim(),ue[1].trim()];if(te&&Ko.has(ye)){l.push(`const ${de} = ${ye};`);continue}G.push(`${ye}: ${de}`),j.push(de)}else{if(te&&Ko.has(ne))continue;G.push(ne),j.push(ne)}}if(G.length>0)l.push(`const { ${G.join(", ")} } = await import('${ee}')`);for(let se of j)l.push(`module.exports.${se} = ${se};`)}else if(H){let B=L(H[1]);l.push(`await import('${B}')`)}else l.push(O);c++;continue}if(vu.test(b))l.push(a[c]),c++;else if(b.startsWith("export const ")||b.startsWith("export let ")||b.startsWith("export var ")){let v=Qo(a,c),{type:T,name:P,value:M}=v;l.push(`${T} ${P} = ${M};`),l.push(`module.exports.${P} = ${P};`),c=v.nextIndex}else if(b.startsWith("export function ")||b.startsWith("export async function ")){let v=hr(a,c);l.push(v.functionCode),l.push(`module.exports.${v.name} = ${v.name};`),c=v.nextIndex}else if(b.startsWith("const ")||b.startsWith("let ")||b.startsWith("var ")){let v=Qo(a,c),{type:T,name:P,value:M}=v;l.push(`${T} ${P} = ${M};`),l.push(`module.exports.${P} = ${P};`),c=v.nextIndex}else if(b.startsWith("function ")||b.startsWith("async function ")){let v=hr(a,c);l.push(v.functionCode),l.push(`module.exports.${v.name} = ${v.name};`),c=v.nextIndex}else if(b.startsWith("export default function ")||b.startsWith("export default async function ")){let v=a[c].replace(/^(\s*)export\s+default\s+/,"$1"),T=[...a];T[c]=v;let P=hr(T,c);if(l.push(P.functionCode),P.name)l.push(`module.exports.default = ${P.name};`);c=P.nextIndex}else if(b.startsWith("export default ")){let v=b.replace(/^export\s+default\s+/,"").replace(/;$/,"");l.push(`module.exports.default = ${v};`),c++}else if(b.startsWith("class ")||b.startsWith("export class ")){let v=b.match(/(?:export\s+)?class\s+(\w+)/);if(v){let T=v[1],P=a[c].replace(/^export\s+/,""),M=0,H=c;for(;H<a.length;H++){let O=a[H];for(let L of O)if(L==="{")M++;else if(L==="}")M--;if(H>c)P+=`
700
700
  `+O;if(M<=0&&H>=c)break}l.push(P),l.push(`module.exports.${T} = ${T};`),c=H+1}else l.push(b),c++}else if(b.includes("module.exports"))l.push(b),c++;else if(b.trim()&&!b.startsWith("//"))l.push(b),c++;else c++}return Eu(l.join(`
701
701
  `),n,i)}function Eu(e,t,n){let i=e.length,a="",l=0,c=null,b=!1,v=!1,T=0;while(l<i){let P=e[l],M=e[l+1];if(b){if(a+=P,P===`
702
- `)b=!1;l++;continue}if(v){if(a+=P,P==="*"&&M==="/"){a+=M,l+=2,v=!1;continue}l++;continue}if(!c&&P==="/"&&M==="/"){b=!0,a+=P,l++;continue}if(!c&&P==="/"&&M==="*"){v=!0,a+=P,l++;continue}if(c){if(a+=P,P==="\\"){a+=M,l+=2;continue}if(P===c&&c!=="`"){c=null,l++;continue}if(c==="`"){if(P==="$"&&M==="{"){T++,a+=M,l+=2;continue}if(P==="`"){c=null,l++;continue}}l++;continue}if(T>0){if(P==="{")T++;else if(P==="}")T--}if(P==='"'||P==="'"||P==="`"){c=P,a+=P,l++;continue}if(P==="a"&&e.startsWith("await",l)){let H=ku(e,l);if(H){let{quote:O,path:L,end:B}=H;if(L.startsWith(".")||L.startsWith("~/")||L.startsWith("@/")){let F=L.startsWith(".")?at.resolve(t,L):at.resolve(n,L.slice(2));a+=`await import(${O}${F}${O})`,l=B;continue}}}a+=P,l++}return a}function ku(e,t){let n=t+5;if(n>=e.length)return null;if(!/\s/.test(e[n]))return null;while(n<e.length&&/\s/.test(e[n]))n++;if(!e.startsWith("import",n))return null;n+=6;while(n<e.length&&/\s/.test(e[n]))n++;if(e[n]!=="(")return null;n++;while(n<e.length&&/\s/.test(e[n]))n++;let i=e[n];if(i!=="'"&&i!=='"')return null;n++;let a=n;while(n<e.length&&e[n]!==i)if(e[n]==="\\")n+=2;else n++;if(n>=e.length)return null;let l=e.slice(a,n);n++;while(n<e.length&&/\s/.test(e[n]))n++;if(e[n]!==")")return null;return{quote:i,path:l,end:n+1}}function sa(e,t){let n=e[t];if(n!=="{"&&n!=="[")return null;let a=x(e,n,n==="{"?"}":"]",t);if(a===-1)return null;return{pattern:e.slice(t,a+1),endPos:a+1}}function ra(e){let t=[],n=e.slice(1,-1).trim();if(!n)return t;let i=0,a=0,l="";while(i<n.length){let c=n[i];if(c==="{"||c==="["){let b=a===0?sa(n,i):null;if(b){t.push(...ra(b.pattern)),i=b.endPos,l="";continue}a++}else if(c==="}"||c==="]")a--;if(a>0){i++;continue}if(c===","){if(l.trim())t.push(l.trim());l="",i++;continue}if(c===":"){l="",i++;continue}if(c==="="){if(l.trim())t.push(l.trim());l="",i++;while(i<n.length&&n[i]!==","&&a===0){if(n[i]==="{"||n[i]==="[")a++;else if(n[i]==="}"||n[i]==="]")a--;i++}continue}if(/[\w$]/.test(c))l+=c;i++}if(l.trim())t.push(l.trim());return t}function lg(e){let t=/^(?:export\s+)?(const|let|var)\s+([A-Za-z_$][\w$]*)/.exec(e);if(!t)return null;let n=t[0].length,i=(a)=>a===" "||a==="\t";while(n<e.length&&i(e[n]))n++;if(e[n]===":"){let a=0,l=null;n++;for(;n<e.length;n++){let c=e[n];if(l){if(c==="\\"){n++;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 b=e[n+1],v=e[n-1];if(b!=="="&&b!==">"&&v!=="="&&v!=="!"&&v!=="<"&&v!==">")break}}if(e[n]!=="=")return null}while(n<e.length&&i(e[n]))n++;if(e[n]!=="=")return null;return{type:t[1],name:t[2],value:e.slice(n+1).trim()}}function Yo(e,t,n,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===t)i++;else if(c===n)i--}return i}function Qo(e,t){let n=e[t].trim(),i=lg(n),a=i?[n,i.type,i.name,i.value]:null;if(!a){let P=n.match(/^(?:export\s+)?(const|let|var)\s+/);if(P){let M=n.slice(P[0].length),H=t;if(M.startsWith("{")||M.startsWith("[")){let L=M[0],B=L==="{"?"}":"]",F=Yo(M,L,B,0),ee=M;for(let G=t+1;G<e.length&&F>0;G++)ee+=` ${e[G].trim()}`,H=G,F=Yo(e[G],L,B,F);if(F>0)ee=M,H=t;M=ee}let O=sa(M,0);if(O){let L=P[1],B=O.pattern,F=M.slice(O.endPos).trim();if(F.startsWith("=")){let ee=F.slice(1).trim(),G=ee,j=Math.max(H,t);if(ea(ee)){let ue=ta(e,j,ee);G=ue.value,j=ue.nextIndex}else j=j+1;G=G.trim().replace(/;$/,"");let te=ra(B),se=`__stx_src_${t}`,ne=te.map((ue)=>`module.exports.${ue} = ${ue};`).join(`
702
+ `)b=!1;l++;continue}if(v){if(a+=P,P==="*"&&M==="/"){a+=M,l+=2,v=!1;continue}l++;continue}if(!c&&P==="/"&&M==="/"){b=!0,a+=P,l++;continue}if(!c&&P==="/"&&M==="*"){v=!0,a+=P,l++;continue}if(c){if(a+=P,P==="\\"){a+=M,l+=2;continue}if(P===c&&c!=="`"){c=null,l++;continue}if(c==="`"){if(P==="$"&&M==="{"){T++,a+=M,l+=2;continue}if(P==="`"){c=null,l++;continue}}l++;continue}if(T>0){if(P==="{")T++;else if(P==="}")T--}if(P==='"'||P==="'"||P==="`"){c=P,a+=P,l++;continue}if(P==="a"&&e.startsWith("await",l)){let H=ku(e,l);if(H){let{quote:O,path:L,end:B}=H;if(L.startsWith(".")||L.startsWith("~/")||L.startsWith("@/")){let F=L.startsWith(".")?at.resolve(t,L):at.resolve(n,L.slice(2));a+=`await import(${O}${F}${O})`,l=B;continue}}}a+=P,l++}return a}function ku(e,t){let n=t+5;if(n>=e.length)return null;if(!/\s/.test(e[n]))return null;while(n<e.length&&/\s/.test(e[n]))n++;if(!e.startsWith("import",n))return null;n+=6;while(n<e.length&&/\s/.test(e[n]))n++;if(e[n]!=="(")return null;n++;while(n<e.length&&/\s/.test(e[n]))n++;let i=e[n];if(i!=="'"&&i!=='"')return null;n++;let a=n;while(n<e.length&&e[n]!==i)if(e[n]==="\\")n+=2;else n++;if(n>=e.length)return null;let l=e.slice(a,n);n++;while(n<e.length&&/\s/.test(e[n]))n++;if(e[n]!==")")return null;return{quote:i,path:l,end:n+1}}function sa(e,t){let n=e[t];if(n!=="{"&&n!=="[")return null;let a=x(e,n,n==="{"?"}":"]",t);if(a===-1)return null;return{pattern:e.slice(t,a+1),endPos:a+1}}function ra(e){let t=[],n=e.slice(1,-1).trim();if(!n)return t;let i=0,a=0,l="";while(i<n.length){let c=n[i];if(c==="{"||c==="["){let b=a===0?sa(n,i):null;if(b){t.push(...ra(b.pattern)),i=b.endPos,l="";continue}a++}else if(c==="}"||c==="]")a--;if(a>0){i++;continue}if(c===","){if(l.trim())t.push(l.trim());l="",i++;continue}if(c===":"){l="",i++;continue}if(c==="="){if(l.trim())t.push(l.trim());l="",i++;while(i<n.length&&n[i]!==","&&a===0){if(n[i]==="{"||n[i]==="[")a++;else if(n[i]==="}"||n[i]==="]")a--;i++}continue}if(/[\w$]/.test(c))l+=c;i++}if(l.trim())t.push(l.trim());return t}function ug(e){let t=/^(?:export\s+)?(const|let|var)\s+([A-Za-z_$][\w$]*)/.exec(e);if(!t)return null;let n=t[0].length,i=(a)=>a===" "||a==="\t";while(n<e.length&&i(e[n]))n++;if(e[n]===":"){let a=0,l=null;n++;for(;n<e.length;n++){let c=e[n];if(l){if(c==="\\"){n++;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 b=e[n+1],v=e[n-1];if(b!=="="&&b!==">"&&v!=="="&&v!=="!"&&v!=="<"&&v!==">")break}}if(e[n]!=="=")return null}while(n<e.length&&i(e[n]))n++;if(e[n]!=="=")return null;return{type:t[1],name:t[2],value:e.slice(n+1).trim()}}function Yo(e,t,n,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===t)i++;else if(c===n)i--}return i}function Qo(e,t){let n=e[t].trim(),i=ug(n),a=i?[n,i.type,i.name,i.value]:null;if(!a){let P=n.match(/^(?:export\s+)?(const|let|var)\s+/);if(P){let M=n.slice(P[0].length),H=t;if(M.startsWith("{")||M.startsWith("[")){let L=M[0],B=L==="{"?"}":"]",F=Yo(M,L,B,0),ee=M;for(let G=t+1;G<e.length&&F>0;G++)ee+=` ${e[G].trim()}`,H=G,F=Yo(e[G],L,B,F);if(F>0)ee=M,H=t;M=ee}let O=sa(M,0);if(O){let L=P[1],B=O.pattern,F=M.slice(O.endPos).trim();if(F.startsWith("=")){let ee=F.slice(1).trim(),G=ee,j=Math.max(H,t);if(ea(ee)){let ue=ta(e,j,ee);G=ue.value,j=ue.nextIndex}else j=j+1;G=G.trim().replace(/;$/,"");let te=ra(B),se=`__stx_src_${t}`,ne=te.map((ue)=>`module.exports.${ue} = ${ue};`).join(`
703
703
  `);return{type:L,name:se,value:`${G}; ${L} ${B} = ${se};
704
704
  ${ne}`,nextIndex:j}}}}throw Error(`Failed to parse variable declaration: ${n}`)}let[,l,c,b]=a,v=b,T=t;if(ea(b)){let P=ta(e,t,b);v=P.value,T=P.nextIndex}else T=t+1;while(T<e.length){let P=e[T].trim();if(P.startsWith(".")||P.startsWith("?."))v+=`
705
- ${e[T]}`,T++;else break}return v=v.trim().replace(/;$/,""),{type:l,name:c,value:v,nextIndex:T}}function br(e,t){let n=e[t].trim(),i=n.match(/^(?:export\s+)?(?:async\s+)?function\s+(\w+)/);if(!i)throw Error(`Failed to parse function declaration: ${n}`);let[,a]=i,l=n.replace(/^export\s+/,""),c=t;if(Cu(n)){let b=Ru(e,t,l);l=b.functionCode,c=b.nextIndex}else c=t+1;return{name:a,functionCode:l,nextIndex:c}}function ea(e){let t=e.trim();if(t.startsWith("{"))return x(t,"{","}",0)===-1;if(t.startsWith("["))return x(t,"[","]",0)===-1;return!ia(t)}function ia(e){let t={paren:0,bracket:0,brace:0},n=null,i=0;for(let a=0;a<e.length;a++){let l=e[a];if((a>0?e[a-1]:"")==="\\"&&n)continue;if((l==='"'||l==="'")&&!n){n=l;continue}if(l===n&&n!=="`"){n=null;continue}if(l==="`"&&!n){n="`";continue}if(l==="`"&&n==="`"&&i===0){n=null;continue}if(n==="`"&&l==="$"&&e[a+1]==="{"){i++,a++;continue}if(i>0&&l==="{"){i++;continue}if(i>0&&l==="}"){i--;continue}if(n)continue;if(l==="(")t.paren++;else if(l===")")t.paren--;else if(l==="[")t.bracket++;else if(l==="]")t.bracket--;else if(l==="{")t.brace++;else if(l==="}")t.brace--}return t.paren===0&&t.bracket===0&&t.brace===0&&n===null}function oa(e){let t=e.indexOf("(");if(t===-1)return e.indexOf("{");let n=x(e,"(",")",t);if(n===-1)return-1;return e.indexOf("{",n)}function Cu(e){let t=oa(e);if(t===-1)return!0;return x(e,"{","}",t)===-1}function ta(e,t,n){let i=n,a=t+1;while(a<e.length&&!ia(i)){let l=e[a];i+=`
705
+ ${e[T]}`,T++;else break}return v=v.trim().replace(/;$/,""),{type:l,name:c,value:v,nextIndex:T}}function hr(e,t){let n=e[t].trim(),i=n.match(/^(?:export\s+)?(?:async\s+)?function\s+(\w+)/);if(!i)throw Error(`Failed to parse function declaration: ${n}`);let[,a]=i,l=n.replace(/^export\s+/,""),c=t;if(Cu(n)){let b=Ru(e,t,l);l=b.functionCode,c=b.nextIndex}else c=t+1;return{name:a,functionCode:l,nextIndex:c}}function ea(e){let t=e.trim();if(t.startsWith("{"))return x(t,"{","}",0)===-1;if(t.startsWith("["))return x(t,"[","]",0)===-1;return!ia(t)}function ia(e){let t={paren:0,bracket:0,brace:0},n=null,i=0;for(let a=0;a<e.length;a++){let l=e[a];if((a>0?e[a-1]:"")==="\\"&&n)continue;if((l==='"'||l==="'")&&!n){n=l;continue}if(l===n&&n!=="`"){n=null;continue}if(l==="`"&&!n){n="`";continue}if(l==="`"&&n==="`"&&i===0){n=null;continue}if(n==="`"&&l==="$"&&e[a+1]==="{"){i++,a++;continue}if(i>0&&l==="{"){i++;continue}if(i>0&&l==="}"){i--;continue}if(n)continue;if(l==="(")t.paren++;else if(l===")")t.paren--;else if(l==="[")t.bracket++;else if(l==="]")t.bracket--;else if(l==="{")t.brace++;else if(l==="}")t.brace--}return t.paren===0&&t.bracket===0&&t.brace===0&&n===null}function oa(e){let t=e.indexOf("(");if(t===-1)return e.indexOf("{");let n=x(e,"(",")",t);if(n===-1)return-1;return e.indexOf("{",n)}function Cu(e){let t=oa(e);if(t===-1)return!0;return x(e,"{","}",t)===-1}function ta(e,t,n){let i=n,a=t+1;while(a<e.length&&!ia(i)){let l=e[a];i+=`
706
706
  ${l}`,a++}while(a<e.length){let l=e[a].trim();if(l.startsWith(".")||l.startsWith("?."))i+=`
707
707
  ${e[a]}`,a++;else break}return{value:i,nextIndex:a}}function Ru(e,t,n){let i=n,a=t+1;while(a<e.length){let l=oa(i);if(l!==-1){if(x(i,"{","}",l)!==-1)break}let c=e[a];i+=`
708
- ${c}`,a++}return{functionCode:i,nextIndex:a}}function na(e,t){let n=u(e,t)??u(`(${e})`,t);if(n!==void 0)return n;if(!/\bprocess\b/.test(e))return;let i={...t,process:Object.freeze({env:{...Wt.env}})},a=Object.keys(i).filter(Bt),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,t,n){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,b]=l;try{let v=b.trim().replace(/;$/,""),T=na(v,t);if(T!==void 0)t[c]=T}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,b]=l;if(!(c in t))try{let v=b.trim().replace(/;$/,""),T=na(v,t);if(T!==void 0)t[c]=T}catch{}}}function Gc(e){let t=e.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),n=t?t[1]:"",i=t?e.replace(/<script\b[^>]*>[\s\S]*?<\/script>/i,""):e;return{scriptContent:n,templateWithoutScript:i}}function Jc(e){let t=e.trim();if(!t)return!1;return/(?:const|let|var|function)\s+\w+/.test(t)}
709
- export{Ie,xe,V,Os,Ns,U,wr,Ds,Ms,ci,li,Ls,ui,Ic,At,Oe,o,pn,w,Oc,S,vr,js,Se,C,Ne,pe,Pt,fn,q,gn,De,y,Nc,fe,J,xr,Sr,kr,ie,It,Y,N,st,_r,Cr,Ot,di,Bs,ng,Me,Dc,Mc,Lc,pi,jc,Fs,fi,Bc,Fc,gi,mi,mn,zs,hn,Nt,Dt,zc,Hs,Hc,Vc,yn,Er,Vs,Us,Uc,hi,Wc,qc,Kc,Xc,bn,rg,sg,og,ig,ag,m,cg,yi,lg,Gc,Jc,bi,wi,ug,Mt,Yc,dg,Zc,ey,Le,wn,je,pg,fg,gg,mg,hg,Ws,yg,Be,Z,Fe,bg,Tr,wg,Qc,el,vi,ze,r,vn,tl,h,ge,ty,nl,rl,sl,xi,qs,vg,ny,xg,ry,xn,p,W,Q,Sn,ke,Sg,Si,kg,sy,E,ki,_g,oy,A,iy};
708
+ ${c}`,a++}return{functionCode:i,nextIndex:a}}function na(e,t){let n=u(e,t)??u(`(${e})`,t);if(n!==void 0)return n;if(!/\bprocess\b/.test(e))return;let i={...t,process:Object.freeze({env:{...Wt.env}})},a=Object.keys(i).filter(Bt),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,t,n){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,b]=l;try{let v=b.trim().replace(/;$/,""),T=na(v,t);if(T!==void 0)t[c]=T}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,b]=l;if(!(c in t))try{let v=b.trim().replace(/;$/,""),T=na(v,t);if(T!==void 0)t[c]=T}catch{}}}function Jc(e){let t=e.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),n=t?t[1]:"",i=t?e.replace(/<script\b[^>]*>[\s\S]*?<\/script>/i,""):e;return{scriptContent:n,templateWithoutScript:i}}function Yc(e){let t=e.trim();if(!t)return!1;return/(?:const|let|var|function)\s+\w+/.test(t)}
709
+ export{Ie,xe,V,Ns,Ds,U,vr,Ms,Ls,li,ui,js,di,Oc,At,Oe,o,pn,w,Nc,S,xr,Bs,Se,C,Ne,pe,Pt,fn,q,gn,De,y,Dc,fe,J,Sr,kr,_r,ie,It,Y,N,st,Cr,Er,Ot,pi,Fs,rg,Me,Mc,Lc,jc,fi,Bc,zs,gi,Fc,zc,mi,hi,mn,Hs,hn,Nt,Dt,Hc,Vs,Vc,Uc,yn,Tr,Us,Ws,Wc,yi,qc,Kc,Xc,Gc,bn,sg,og,ig,ag,cg,m,lg,bi,ug,Jc,Yc,wi,vi,dg,Mt,Zc,pg,Qc,ty,Le,wn,je,fg,gg,mg,hg,yg,qs,bg,Be,Z,Fe,wg,$r,vg,el,tl,xi,ze,r,vn,nl,h,ge,ny,rl,sl,ol,Si,Ks,xg,ry,Sg,sy,xn,p,W,Q,Sn,ke,kg,ki,_g,oy,E,_i,Cg,iy,A,ay};