@stacksjs/stx 0.2.816 → 0.2.818

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 (203) hide show
  1. package/dist/{chunk-pyytr30r.js → chunk-035m9ada.js} +3 -3
  2. package/dist/chunk-03mtfndv.js +2 -0
  3. package/dist/chunk-18qxd18d.js +2 -0
  4. package/dist/{chunk-d47m4qat.js → chunk-1a8qtvs1.js} +2 -2
  5. package/dist/{chunk-s9xs2ff4.js → chunk-1ae3megp.js} +5 -5
  6. package/dist/chunk-1cd0w20k.js +2 -0
  7. package/dist/{chunk-549end3k.js → chunk-1hg0zb3p.js} +2 -2
  8. package/dist/{chunk-p8wq37hd.js → chunk-1rvgv1fr.js} +5 -5
  9. package/dist/{chunk-n761hp6d.js → chunk-1tzqqr0p.js} +2 -2
  10. package/dist/{chunk-nkb214z1.js → chunk-2bnbcr22.js} +24 -24
  11. package/dist/{chunk-p0fp7p7x.js → chunk-2jn0x4sh.js} +5 -5
  12. package/dist/chunk-2kt1gqtq.js +2 -0
  13. package/dist/chunk-2vaap97d.js +2 -0
  14. package/dist/chunk-33ewq978.js +2 -0
  15. package/dist/chunk-3m342maz.js +2 -0
  16. package/dist/chunk-46sej67y.js +2 -0
  17. package/dist/{chunk-5efv1fhk.js → chunk-4fbg7gq8.js} +2 -2
  18. package/dist/{chunk-wbzgtf5c.js → chunk-4h78zypb.js} +1 -1
  19. package/dist/chunk-5zf566bv.js +2 -0
  20. package/dist/chunk-67k5q95t.js +2 -0
  21. package/dist/chunk-6e76tz09.js +2 -0
  22. package/dist/{chunk-bphwhfbd.js → chunk-6n11z33h.js} +5 -5
  23. package/dist/{chunk-7rk7wfm6.js → chunk-72jt897s.js} +13 -13
  24. package/dist/chunk-72w08sh9.js +2 -0
  25. package/dist/{chunk-5wcgqr21.js → chunk-7ac98ja7.js} +8 -8
  26. package/dist/chunk-7q79h0j4.js +2 -0
  27. package/dist/chunk-88mhhbqj.js +2 -0
  28. package/dist/{chunk-a0r4dpzs.js → chunk-8dmey36n.js} +2 -2
  29. package/dist/chunk-8gcg9maj.js +1327 -0
  30. package/dist/{chunk-x6fpj9hh.js → chunk-8hfgvs0x.js} +2 -2
  31. package/dist/{chunk-azg5e5ts.js → chunk-8wdy7kdq.js} +4 -4
  32. package/dist/{chunk-z87g05z5.js → chunk-9487tyfa.js} +2 -2
  33. package/dist/chunk-9736003n.js +2 -0
  34. package/dist/chunk-99zwpazg.js +2 -0
  35. package/dist/chunk-9e5gamvs.js +2 -0
  36. package/dist/{chunk-17wb2x3z.js → chunk-9egd7tx3.js} +2 -2
  37. package/dist/{chunk-jrjd02kf.js → chunk-9gj702tw.js} +4 -4
  38. package/dist/{chunk-2ws2qe1k.js → chunk-9gwhs0gk.js} +2 -2
  39. package/dist/{chunk-2v7qvj69.js → chunk-9tzcvsv0.js} +6 -6
  40. package/dist/{chunk-9d79afs9.js → chunk-9xd85mvm.js} +4 -4
  41. package/dist/chunk-9y1dm510.js +2 -0
  42. package/dist/{chunk-f8zs50z0.js → chunk-a1cy78h3.js} +2 -2
  43. package/dist/{chunk-9mnr9x0d.js → chunk-a67c2xrp.js} +2 -2
  44. package/dist/chunk-abzrvxct.js +2 -0
  45. package/dist/chunk-avbvedyx.js +2 -0
  46. package/dist/{chunk-3vpgr6nk.js → chunk-b9d70mgr.js} +3 -3
  47. package/dist/chunk-bbxzkcsk.js +2 -0
  48. package/dist/chunk-c179xpsq.js +2 -0
  49. package/dist/{chunk-qz8bz1f2.js → chunk-casvvt3k.js} +1 -1
  50. package/dist/{chunk-zcb34wfr.js → chunk-cf196sv5.js} +2 -2
  51. package/dist/chunk-cvq4bz8y.js +2 -0
  52. package/dist/{chunk-314zqrv0.js → chunk-d4pmddb9.js} +1 -1
  53. package/dist/chunk-dh1f8ga0.js +2 -0
  54. package/dist/{chunk-d3d5s0va.js → chunk-dpn314z2.js} +2 -2
  55. package/dist/{chunk-6cw072n5.js → chunk-dq9djbgq.js} +4 -4
  56. package/dist/{chunk-tb4wmzzd.js → chunk-e3t2bqyf.js} +5 -5
  57. package/dist/{chunk-g74r0edp.js → chunk-e9w8qav3.js} +5 -5
  58. package/dist/{chunk-jg9f5nqf.js → chunk-em2yy1te.js} +6 -6
  59. package/dist/chunk-em7kntfc.js +2 -0
  60. package/dist/chunk-enm79dwe.js +2 -0
  61. package/dist/{chunk-m0x96g8e.js → chunk-f6nk205v.js} +1 -1
  62. package/dist/{chunk-f54t0qar.js → chunk-fmawgk87.js} +1 -1
  63. package/dist/chunk-fvs15n0s.js +2 -0
  64. package/dist/{chunk-gqjb1y7c.js → chunk-g7mjv276.js} +2 -2
  65. package/dist/{chunk-r6dtrd7y.js → chunk-gcje06er.js} +30 -30
  66. package/dist/{chunk-1bgv727x.js → chunk-gtd6qs1r.js} +2 -2
  67. package/dist/chunk-gvthmy3a.js +2 -0
  68. package/dist/chunk-h8kbcz9t.js +2 -0
  69. package/dist/chunk-h8x56dq5.js +2 -0
  70. package/dist/{chunk-e58g2n9k.js → chunk-hntm02x0.js} +3 -3
  71. package/dist/chunk-hx575xy8.js +2 -0
  72. package/dist/{chunk-qyxr6kq1.js → chunk-j24psz0z.js} +7 -7
  73. package/dist/chunk-j58z3y2g.js +2 -0
  74. package/dist/chunk-j5t40n2g.js +2 -0
  75. package/dist/{chunk-atdn8n6b.js → chunk-j65nf7mt.js} +6 -6
  76. package/dist/{chunk-kvhsdyfg.js → chunk-j8r0am39.js} +1 -1
  77. package/dist/{chunk-c6w39fdb.js → chunk-k01aftw0.js} +6 -6
  78. package/dist/{chunk-0h99mrb0.js → chunk-k3t72x38.js} +2 -2
  79. package/dist/{chunk-0svj1nfa.js → chunk-k3zcadcc.js} +2 -2
  80. package/dist/chunk-kgwdxx75.js +2 -0
  81. package/dist/{chunk-r5nt1bcx.js → chunk-mbhvf0sv.js} +2 -2
  82. package/dist/{chunk-fn3q1gtr.js → chunk-mjg9cx5a.js} +3 -3
  83. package/dist/{chunk-y4xcym3k.js → chunk-mm8ak4w2.js} +2 -2
  84. package/dist/{chunk-xrd1md4j.js → chunk-mr2ke5km.js} +6 -6
  85. package/dist/chunk-n1tbc7da.js +2 -0
  86. package/dist/{chunk-9t9qf38k.js → chunk-n4s0se11.js} +8 -8
  87. package/dist/chunk-n7dm6prj.js +2 -0
  88. package/dist/chunk-nknpr8cy.js +2 -0
  89. package/dist/{chunk-jham85mf.js → chunk-nqdh7z2d.js} +1 -1
  90. package/dist/{chunk-4vxbcf4a.js → chunk-p13wg97w.js} +3 -3
  91. package/dist/chunk-pe9npaby.js +2 -0
  92. package/dist/chunk-pyz2jqph.js +2 -0
  93. package/dist/chunk-q51w24br.js +2 -0
  94. package/dist/chunk-qek9bcjt.js +2 -0
  95. package/dist/chunk-qkxx34vt.js +2 -0
  96. package/dist/{chunk-ps3t15gp.js → chunk-qr14xvwb.js} +1 -1
  97. package/dist/chunk-r2v042ym.js +2 -0
  98. package/dist/{chunk-pkjza0vv.js → chunk-r8ydxe4z.js} +3 -3
  99. package/dist/chunk-rjzp7za8.js +2 -0
  100. package/dist/{chunk-yts2b9d8.js → chunk-s6mte5vy.js} +11 -6
  101. package/dist/chunk-s9b49v74.js +3 -0
  102. package/dist/{chunk-vkn133cs.js → chunk-s9b6abkb.js} +2 -2
  103. package/dist/chunk-sata7rh2.js +2 -0
  104. package/dist/{chunk-kq40yvdh.js → chunk-sf4rntqj.js} +1 -1
  105. package/dist/{chunk-8h3jv8dd.js → chunk-sh1hbhhb.js} +2 -2
  106. package/dist/{chunk-ntn6bnjv.js → chunk-skht06a2.js} +1 -1
  107. package/dist/{chunk-24354nk5.js → chunk-swbrvrgr.js} +2 -2
  108. package/dist/{chunk-s90m43sm.js → chunk-sxad7x2s.js} +4 -4
  109. package/dist/{chunk-w6n4y2xg.js → chunk-tj6zvs8f.js} +2 -2
  110. package/dist/chunk-tmcgpf68.js +2 -0
  111. package/dist/chunk-tsb5h4e2.js +2 -0
  112. package/dist/chunk-v8h2kns0.js +2 -0
  113. package/dist/{chunk-ncyjaxyz.js → chunk-vmxzktdr.js} +1 -1
  114. package/dist/chunk-vpazz8ca.js +2 -0
  115. package/dist/{chunk-9avsdbz5.js → chunk-vtt2dec3.js} +3 -3
  116. package/dist/chunk-vyw40ym7.js +2 -0
  117. package/dist/chunk-whq40bdm.js +2 -0
  118. package/dist/chunk-x15hrtmt.js +2 -0
  119. package/dist/{chunk-7bfsvkvd.js → chunk-x34me5ar.js} +7 -7
  120. package/dist/{chunk-0ekdbagy.js → chunk-xc7nynb9.js} +2 -2
  121. package/dist/chunk-xha2gt0n.js +2 -0
  122. package/dist/{chunk-8ca33v3s.js → chunk-y3zjmv9e.js} +3 -3
  123. package/dist/chunk-ydt1pbhx.js +2 -0
  124. package/dist/chunk-ymypc1rp.js +709 -0
  125. package/dist/chunk-z8ywxqqg.js +2 -0
  126. package/dist/{chunk-tvc5n28s.js → chunk-zgq8bfaw.js} +4 -4
  127. package/dist/{chunk-e39nkbt4.js → chunk-zhvmcj78.js} +4 -4
  128. package/dist/{chunk-e2855m6w.js → chunk-zme16hcr.js} +3 -3
  129. package/dist/{chunk-sphc7xzx.js → chunk-znx5m1jv.js} +1 -1
  130. package/dist/chunk-zwp7n01x.js +2 -0
  131. package/dist/cli.js +12 -12
  132. package/dist/client/signals-expression-runtime.js +6 -2
  133. package/dist/client/signals-public-api-runtime.js +1 -0
  134. package/dist/craft-entry.js +2 -2
  135. package/dist/craft.js +2 -2
  136. package/dist/native/runtime/browser-screen.js +67 -2
  137. package/dist/native/runtime/craft.d.ts +14 -1
  138. package/dist/process.js +2 -2
  139. package/dist/pwa.js +3 -3
  140. package/dist/reactive.d.ts +12 -2
  141. package/dist/reactive.js +69 -32
  142. package/dist/ssg.js +10 -10
  143. package/dist/utils.js +12 -2
  144. package/package.json +5 -5
  145. package/dist/chunk-0j8qrqke.js +0 -2
  146. package/dist/chunk-0yjm4j26.js +0 -2
  147. package/dist/chunk-1rwfgmmk.js +0 -2
  148. package/dist/chunk-3e85etrf.js +0 -2
  149. package/dist/chunk-3jd5ak8h.js +0 -2
  150. package/dist/chunk-45gv3akm.js +0 -2
  151. package/dist/chunk-4ypwqrj2.js +0 -2
  152. package/dist/chunk-5b6tsg13.js +0 -2
  153. package/dist/chunk-5eqna31h.js +0 -2
  154. package/dist/chunk-6a97a9wk.js +0 -2
  155. package/dist/chunk-7agp0wj2.js +0 -2
  156. package/dist/chunk-7r5efkbz.js +0 -2
  157. package/dist/chunk-8g8h2xwz.js +0 -2
  158. package/dist/chunk-956zq9b7.js +0 -2
  159. package/dist/chunk-9mtw71xy.js +0 -2
  160. package/dist/chunk-9wmjmas8.js +0 -2
  161. package/dist/chunk-9yc4fw7e.js +0 -2
  162. package/dist/chunk-a350jjd3.js +0 -2
  163. package/dist/chunk-aqydav9y.js +0 -2
  164. package/dist/chunk-ar7w1kx0.js +0 -2
  165. package/dist/chunk-b7vfs0cq.js +0 -2
  166. package/dist/chunk-b9ntt41z.js +0 -2
  167. package/dist/chunk-be2stv5x.js +0 -2
  168. package/dist/chunk-bj6ax0he.js +0 -2
  169. package/dist/chunk-bxtwbkc1.js +0 -2
  170. package/dist/chunk-c8vhjxm9.js +0 -2
  171. package/dist/chunk-cxpnkgvw.js +0 -2
  172. package/dist/chunk-d3gncxq1.js +0 -2
  173. package/dist/chunk-da886asf.js +0 -2
  174. package/dist/chunk-geyvz4ae.js +0 -2
  175. package/dist/chunk-gqe0hnbb.js +0 -2
  176. package/dist/chunk-h5c786jf.js +0 -1592
  177. package/dist/chunk-h9yvb9qn.js +0 -2
  178. package/dist/chunk-k4xkbk2z.js +0 -2
  179. package/dist/chunk-mkr46mzz.js +0 -2
  180. package/dist/chunk-mmyrdbxx.js +0 -2
  181. package/dist/chunk-nctnc7tn.js +0 -2
  182. package/dist/chunk-nqcqench.js +0 -421
  183. package/dist/chunk-nr58sedd.js +0 -2
  184. package/dist/chunk-p7tg362f.js +0 -2
  185. package/dist/chunk-qffx1nqg.js +0 -2
  186. package/dist/chunk-qn6y53v0.js +0 -2
  187. package/dist/chunk-r4kdwpbh.js +0 -2
  188. package/dist/chunk-rxc1076r.js +0 -2
  189. package/dist/chunk-sj4vw93g.js +0 -2
  190. package/dist/chunk-spgf7r7h.js +0 -2
  191. package/dist/chunk-sxhya0hd.js +0 -2
  192. package/dist/chunk-syvsj91a.js +0 -2
  193. package/dist/chunk-tnjzhbkc.js +0 -2
  194. package/dist/chunk-tzb0n60s.js +0 -2
  195. package/dist/chunk-veh49fc5.js +0 -2
  196. package/dist/chunk-vft84x6s.js +0 -2
  197. package/dist/chunk-vn6jxchy.js +0 -2
  198. package/dist/chunk-wbkca2se.js +0 -2
  199. package/dist/chunk-wrygfmhf.js +0 -2
  200. package/dist/chunk-xgqyzkt2.js +0 -2
  201. package/dist/chunk-yjezsy4p.js +0 -2
  202. package/dist/chunk-zjw5gm1n.js +0 -2
  203. package/dist/chunk-zkzp1ckd.js +0 -3
@@ -1,421 +0,0 @@
1
- // @bun
2
- import{ze,xn,Ws,xi,N}from"./chunk-m7hfcxt3.js";import{vn}from"./chunk-kq40yvdh.js";import{Or,k,ll,at,Ri,ul}from"./chunk-n761hp6d.js";import{P}from"./chunk-r9e0r6jx.js";import{R,qs,u,f,jt,d,q,F,w,Js,_e,Ve,Ys}from"./chunk-7rk7wfm6.js";import{r,ge}from"./chunk-3vpgr6nk.js";import{g}from"./chunk-0dve54ne.js";import{K}from"./chunk-c5vzr1va.js";import nt from"path";import Ct from"process";import{AsyncLocalStorage as Uo}from"async_hooks";var fr=new Uo;function mn(e){return e.__stx_server_data??={pending:new Map,values:new Map}}function pr(e,t){return fr.run(mn(e),t)}async function dr(e,t){let i=fr.getStore();if(!i)throw Error("useServerData must run inside a <script server> render");if(typeof e!=="string"||!e.trim())throw TypeError("useServerData requires a non-empty string key");let n=i.pending.get(e);if(n)return n;let c=Promise.resolve().then(t).then((l)=>{let a=JSON.stringify(l,(v,E)=>{if(E===void 0||typeof E==="function"||typeof E==="symbol"||typeof E==="bigint"||typeof E==="number"&&!Number.isFinite(E))throw TypeError(`useServerData(${JSON.stringify(e)}) requires JSON-serializable data`);if(E&&typeof E==="object"&&!Array.isArray(E)&&Object.getPrototypeOf(E)!==Object.prototype&&Object.getPrototypeOf(E)!==null)throw TypeError(`useServerData(${JSON.stringify(e)}) requires JSON-serializable data`);return E}),y=JSON.parse(a);return i.values.set(e,y),y}).catch((l)=>{throw i.pending.delete(e),l});return i.pending.set(e,c),c}function _r(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 H(e,t=!1){let i=r(e),n=[],c=new Set,l=0,a=0,y=i.length,v=()=>{if(l!==0)return;let E=i.slice(a).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*(?:[!:;,\n]|=(?!=)|$)/);if(E){if(t&&E[1]==="const")return;let I=E[2];if(!c.has(I))n.push(I),c.add(I);return}let A=i.slice(a).match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(A){if(t&&i.slice(a).startsWith("const"))return;A[1].split(",").forEach((I)=>{let B=I.trim();if(!B)return;let L=B.indexOf(":"),Q=(L>=0?B.slice(L+1).trim():B).split(/[\s=]/)[0];if(Q&&!c.has(Q))n.push(Q),c.add(Q)});return}let M=i.slice(a).match(/^(?:const|let|var)\s+\[([^\]]+)\]\s*=/);if(M){if(t&&i.slice(a).startsWith("const"))return;M[1].split(",").forEach((I)=>{let B=I.trim().replace(/^\.\.\./,"");if(!B)return;let L=B.split(/[\s=]/)[0];if(L&&!c.has(L))n.push(L),c.add(L)});return}if(t)return;let X=i.slice(a).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(X){let I=X[1];if(!c.has(I))n.push(I),c.add(I);return}let D=i.slice(a).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(D){let I=D[1];if(!c.has(I))n.push(I),c.add(I)}};while(a<y){if(i[a]==="{"){l++,a++;continue}if(i[a]==="}"){l--,a++;continue}if(l===0&&/[a-z]/i.test(i[a])&&(a===0||/\s|[;{}()]/.test(i[a-1])))v();a++}return n.join(", ")}function Ps(e){return`{ enumerable: true, configurable: true, get() { return ${e} }, set(__stxValue_${e}) { ${e} = __stxValue_${e} } }`}function Ho(e,t=H(e).split(",").map((i)=>i.trim()).filter(Boolean)){let i=new Set(H(e,!0).split(",").map((n)=>n.trim()));return t.map((n)=>i.has(n)?`get ${n}() { return ${n} }, set ${n}(__stxValue_${n}) { ${n} = __stxValue_${n} }`:n).join(", ")}function Is(e,t){let i=`{ ${Ho(e,t)} }`;return H(e).split(",").some((n)=>n.trim()==="__stxLiveBindings")?`Object.defineProperties(${i}, Object.getOwnPropertyDescriptors(__stxLiveBindings))`:i}import vt from"fs";import Ee from"path";function V(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}var gr=new Map;function yr(e,t=!0){let i=gr.get(e);if(t&&i)return i;let n=new Map,c=[Ee.join(e,"src"),Ee.join(e,"dist"),e];function l(a,y){if(y>6)return;let v;try{v=vt.readdirSync(a,{withFileTypes:!0})}catch{return}for(let E of v){let A=Ee.join(a,E.name);if(E.isDirectory()){if(E.name==="node_modules"||E.name.startsWith("."))continue;l(A,y+1)}else if(E.isFile()&&E.name.endsWith(".stx")){let M=E.name.slice(0,-4);if(!n.has(M))n.set(M,A);let X=M.toLowerCase();if(!n.has(X))n.set(X,A);let D=V(M);if(!n.has(D))n.set(D,A)}}}for(let a of c)if(l(a,0),n.size>0)break;if(t)gr.set(e,n);return n}function Os(e,t){if(e.startsWith(".")||e.startsWith("/"))return null;let i=t;while(!0){let n=Ee.join(i,"node_modules",e);try{if(vt.statSync(n).isDirectory())return n}catch{}let c=Ee.dirname(i);if(c===i)return null;i=c}}function Ns(e,t,i={}){return[Ee.resolve(Ee.dirname(t),`${e}.stx`),Ee.resolve(Ee.dirname(t),e),Ee.resolve(i.componentsDir||"components",`${e}.stx`),Ee.resolve(i.componentsDir||"components",e),e.endsWith(".stx")?e:`${e}.stx`]}function mr(e){let t=e.endsWith(".stx")?e.slice(0,-4):e,i=t.split("-").map((c)=>c.charAt(0).toUpperCase()+c.slice(1)).join(""),n=V(t);return[t,i,n]}function oi(e,t){let[i,n,c]=mr(e);for(let l of[i,i.toLowerCase(),n,c]){let a=t?.__importedComponents?.get(l);if(a!==void 0)return a}}function Zo(e,t){let i=t?Ee.resolve(t):void 0,n=Ee.dirname(Ee.resolve(e));for(;;){if(vt.existsSync(Ee.join(n,"package.json")))return i&&n===i?void 0:n;let c=Ee.dirname(n);if(c===n)return;n=c}}var qo=["src/ui","src/components","components","dist"];function cs(e,t){let i=Ee.resolve(e);if(!t&&!i.split(Ee.sep).includes("node_modules"))return[];let n=Zo(i,t);if(!n)return[];let c=[];try{let y=JSON.parse(vt.readFileSync(Ee.join(n,"package.json"),"utf8")).stx?.components;if(Array.isArray(y))c=y.filter((v)=>typeof v==="string")}catch{}let l=c.length?c:qo;return[Ee.dirname(Ee.resolve(e)),...l.map((a)=>Ee.resolve(n,a))]}function*ii(e,t,i={},n){let c=mr(e);if(c[0].startsWith("./")||c[0].startsWith("../")){yield Ee.resolve(Ee.dirname(t),`${c[0]}.stx`);return}let l=[...new Set(c.map((v)=>`${v}.stx`))],a=i.projectRoot||process.cwd(),y=[...cs(t,i.projectRoot),...n?.__originalFilePath?[Ee.join(Ee.dirname(n.__originalFilePath),"components")]:[],...i.componentsDir?[i.componentsDir]:[],Ee.join(Ee.dirname(t),"components"),Ee.resolve(a,"src/components"),Ee.resolve(a,"components"),...import.meta.dir?[Ee.resolve(import.meta.dir,"components")]:[]];for(let v of new Set(y)){for(let E of l)yield Ee.join(v,E);try{for(let E of vt.readdirSync(v,{withFileTypes:!0}))if(E.isDirectory())for(let A of l)yield Ee.join(v,E.name,A)}catch{}}}function hr(e,t,i={},n){let c=oi(e,n);if(c!==void 0)return c;for(let l of ii(e,t,i,n))try{if(vt.statSync(l,{throwIfNoEntry:!1})?.isFile())return l}catch{}return null}function Ms(e,t=[],i={}){let n=new Set([...e].map((E)=>E.replace(/[-_]/g,"").toLowerCase()));if(!n.has("src")||!n.has("alt")&&!n.has("decorative"))return!1;let c=new Map(Object.entries(i).map(([E,A])=>[E.replace(/[-_]/g,"").toLowerCase(),A])),l=c.get("alt"),a=c.get("decorative"),y=typeof l==="string"&&!!l.trim(),v=typeof a==="string"?!["false","0","off","no"].includes(a.trim().toLowerCase()):Boolean(a);if(!y&&!v)return!1;if(["source","resizemode","defaultsource","provider","format","densities","quality","preload","modifiers","preset"].some((E)=>n.has(E)))return!1;if([...t].some((E)=>!["load","error"].includes(E.replace(/^@/,"").split(".")[0].toLowerCase())))return!1;return["fit","objectfit","position","objectposition","rounded","aspectratio","zoomonhover","sources","webpsrc","webpsrcset"].some((E)=>n.has(E))}import qn from"fs";import ce from"path";import ht from"path";import Kt from"fs";var Ko=new Set(["touchstart","touchmove","wheel","mousewheel"]);function as(e,t){if(t.passive)return!0;if(t.prevent||t.nonpassive)return!1;return Ko.has(e.toLowerCase())}var $r=new Set(["click","dblclick","mousedown","mouseup","mousemove","mouseenter","mouseleave","mouseover","mouseout","contextmenu","wheel","keydown","keyup","keypress","submit","reset","change","input","focus","blur","focusin","focusout","select","invalid","touchstart","touchend","touchmove","touchcancel","drag","dragstart","dragend","dragenter","dragleave","dragover","drop","scroll","resize","load","error","abort","animationstart","animationend","animationiteration","transitionstart","transitionend","transitionrun","transitioncancel","mounted","unmounted"]),Er={enter:"Enter",tab:"Tab",delete:"Delete",backspace:"Backspace",esc:"Escape",escape:"Escape",space:" ",up:"ArrowUp",down:"ArrowDown",left:"ArrowLeft",right:"ArrowRight",home:"Home",end:"End",pageup:"PageUp",pagedown:"PageDown"},Xo=new Set(["ctrl","alt","shift","meta"]),Tr={left:0,middle:1,right:2};function Rr(e){let t={prevent:!1,stop:!1,once:!1,capture:!1,self:!1,passive:!1,nonpassive:!1,keys:[],systemKeys:[],mouse:null,debounce:null,throttle:null};for(let i of e){let n=i.toLowerCase();if(n==="prevent")t.prevent=!0;else if(n==="stop")t.stop=!0;else if(n==="once")t.once=!0;else if(n==="capture")t.capture=!0;else if(n==="self")t.self=!0;else if(n==="passive")t.passive=!0;else if(n==="nonpassive")t.nonpassive=!0;else if(Xo.has(n))t.systemKeys.push(n);else if(n in Tr)t.mouse=n;else if(n in Er||/^[a-z]$/.test(n))t.keys.push(Er[n]||n.toUpperCase());else if(n.startsWith("debounce")){let c=n.match(/debounce(?:\.(\d+))?/);t.debounce=c?.[1]?Number.parseInt(c[1],10):300}else if(n.startsWith("throttle")){let c=n.match(/throttle(?:\.(\d+))?/);t.throttle=c?.[1]?Number.parseInt(c[1],10):300}}return t}function Ir(e,t=""){let i=[],n=0,c=/<([a-z][a-z0-9-]*)\s+([^>]*@[a-z][^>]*)>/gi,l;while((l=c.exec(e))!==null){let[a,y,v]=l,E=l.index,A=E+a.length,M=`__stx_evt_${t}${n++}`,X=[],D=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,I;while((I=D.exec(v))!==null){let[,L,z]=I,Q=L.split("."),j=Q[0];if(!$r.has(j))continue;X.push({attribute:`@${L}`,event:j,handler:z,modifiers:Rr(Q.slice(1)),elementId:M})}let B=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((I=B.exec(v))!==null){let[,L,z]=I,Q=L.split("."),j=Q[0];if(!$r.has(j))continue;X.push({attribute:`@${L}`,event:j,handler:z,modifiers:Rr(Q.slice(1)),elementId:M})}if(X.length>0)i.push({originalTag:a,elementId:M,events:X,startIndex:E,endIndex:A})}return i}function Jo(e){let t=[],{modifiers:i}=e;if(i.self)t.push("if ($event.target !== $el) return");for(let n of i.systemKeys)t.push(`if (!$event.${n}Key) return`);if(i.keys.length>0){let n=i.keys.map((c)=>`$event.key === '${c}'`).join(" || ");t.push(`if (!(${n})) return`)}if(i.mouse!==null){let n=Tr[i.mouse];t.push(`if ($event.button !== ${n}) return`)}if(i.prevent)t.push("$event.preventDefault()");if(i.stop)t.push("$event.stopPropagation()");return t.join("; ")}function Go(e,t){let i=e;if(t.debounce!==null)i=`__stx_debounce(() => { ${i} }, ${t.debounce})`;else if(t.throttle!==null)i=`__stx_throttle(() => { ${i} }, ${t.throttle})`;return i}function ls(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 Yo(e){let{modifiers:t}=e,i=e.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),n=Jo(e),c=Go(ls(e.handler),t),l=[];if(t.once)l.push("once: true");if(t.capture)l.push("capture: true");if(as(e.event,t))l.push("passive: true");let a=l.length>0?`, { ${l.join(", ")} }`:"",y=c.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t");if(e.event==="mounted")return`
3
- (function() {
4
- var $el = document.getElementById('${i}');
5
- if (!$el) return;
6
- // Run mounted handler immediately (DOM is ready)
7
- var scope = $el.closest('[data-stx-scope]');
8
- if (scope && scope.__stx_execute) {
9
- scope.__stx_execute('${y}', null, $el);
10
- }
11
- else {
12
- __stx_runHandler('${y}', null, $el);
13
- }
14
- })();`;if(e.event==="unmounted")return`
15
- (function() {
16
- var $el = document.getElementById('${i}');
17
- if (!$el) return;
18
- // Set up MutationObserver to detect removal
19
- var observer = new MutationObserver(function(mutations) {
20
- for (var m of mutations) {
21
- for (var node of m.removedNodes) {
22
- if (node === $el || (node.contains && node.contains($el))) {
23
- observer.disconnect();
24
- var scope = $el.closest('[data-stx-scope]');
25
- if (scope && scope.__stx_execute) {
26
- scope.__stx_execute('${y}', null, $el);
27
- }
28
- else {
29
- __stx_runHandler('${y}', null, $el);
30
- }
31
- return;
32
- }
33
- }
34
- }
35
- });
36
- observer.observe(document.body, { childList: true, subtree: true });
37
- // Store observer for cleanup
38
- $el.__stx_unmount_observer = observer;
39
- })();`;return`
40
- (function() {
41
- var $el = document.getElementById('${i}');
42
- if (!$el) return;
43
- // eslint-disable-next-line pickier/no-unused-vars
44
- $el.addEventListener('${e.event}', function($event) {
45
- ${n?n+";":""}
46
- // Find the closest reactive scope and execute within its context
47
- var scope = $el.closest('[data-stx-scope]');
48
- if (scope && scope.__stx_execute) {
49
- scope.__stx_execute('${y}', $event, $el);
50
- }
51
- else {
52
- // Fallback for non-reactive context (entity-safe; decoded + run in memory)
53
- __stx_runHandler('${y}', $event, $el);
54
- }
55
- }${a});
56
- })();`}function ai(e){if(e.length===0)return"";return`
57
- <script data-stx-events>
58
- (function() {
59
- 'use strict';
60
-
61
- // Utility functions
62
- function __stx_debounce(fn, delay) {
63
- var timeout;
64
- return function() {
65
- var args = arguments;
66
- var ctx = this;
67
- clearTimeout(timeout);
68
- timeout = setTimeout(function() { fn.apply(ctx, args); }, delay);
69
- };
70
- }
71
-
72
- function __stx_throttle(fn, delay) {
73
- var last = 0;
74
- return function() {
75
- var now = Date.now();
76
- if (now - last >= delay) {
77
- last = now;
78
- fn.apply(this, arguments);
79
- }
80
- };
81
- }
82
-
83
- // Non-reactive fallback runner. The handler is embedded HTML-entity-encoded
84
- // so the surrounding script element can never contain raw markup, including
85
- // its own closing tag; we decode it to JS only in memory here, then run it
86
- // with $event/$el in scope.
87
- //
88
- // This comment must not spell that closing tag out. It used to, as an
89
- // example, and a browser ends the script element at the FIRST one it sees \u2014
90
- // so everything below this line, __stx_runHandler included, was emitted as
91
- // page text and no listener was ever bound. The comment about escaping was
92
- // the thing that needed escaping.
93
- function __stx_runHandler(h, $event, $el) {
94
- var code = h
95
- .replace(/&lt;/g, '<')
96
- .replace(/&gt;/g, '>')
97
- .replace(/&quot;/g, '"')
98
- .replace(/&#39;/g, "'")
99
- .replace(/&#x27;/g, "'")
100
- .replace(/&amp;/g, '&');
101
- try {
102
- // eslint-disable-next-line no-new-func
103
- (new Function('$event', '$el', code)).call($el, $event, $el);
104
- }
105
- catch (e) {
106
- if (typeof console !== 'undefined') console.error('[stx] event handler error:', e);
107
- }
108
- }
109
-
110
- // Event listeners
111
- ${e.map(Yo).join(`
112
- `)}
113
- })();
114
- </script>`}function Qo(e,t=""){let i=Ir(e,t);if(i.length===0)return{template:e,bindings:[]};let n=e,c=[];for(let l=i.length-1;l>=0;l--){let a=i[l],y=a.originalTag;if(!y.includes(" id="))y=y.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${a.elementId}"`);else{let v=y.match(/id=["']([^"']+)["']/);if(v)for(let E of a.events)E.elementId=v[1]}for(let v of a.events){let E=v.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),A=new RegExp(`\\s*${E}\\s*=\\s*"[^"]*"`,"g"),M=new RegExp(`\\s*${E}\\s*=\\s*'[^']*'`,"g");y=y.replace(A,""),y=y.replace(M,"")}n=n.slice(0,a.startIndex)+y+n.slice(a.endIndex),c.push(...a.events)}return{template:n,bindings:c}}function Ar(e){let t=e.$uid;return typeof t==="string"&&t?`${t}_`:""}function $c(e,t,i){if(ul(e))return e;if(t.__stx_sfc_mode){if(/x-data\s*=\s*["']/.test(e))return e;let{template:y,bindings:v}=Qo(e,Ar(t)),E=t.__stx_event_bindings||[];return t.__stx_event_bindings=[...E,...v],y}let n=Ir(e,Ar(t));if(n.length===0)return e;let c=e;for(let y=n.length-1;y>=0;y--){let v=n[y],E=v.originalTag;if(!E.includes(" id="))E=E.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${v.elementId}"`);else{let A=E.match(/id=["']([^"']+)["']/);if(A)for(let M of v.events)M.elementId=A[1]}for(let A of v.events){let M=A.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),X=new RegExp(`\\s*${M}\\s*=\\s*"[^"]*"`,"g"),D=new RegExp(`\\s*${M}\\s*=\\s*'[^']*'`,"g");E=E.replace(X,""),E=E.replace(D,"")}c=c.slice(0,v.startIndex)+E+c.slice(v.endIndex)}let l=ai(n.flatMap((y)=>y.events)),a=c.lastIndexOf("</body>");if(a!==-1)c=c.slice(0,a)+l+`
115
- `+c.slice(a);else c+=l;return c}function Pr(e,t){let i=new Set;for(let n of e.split(",")){let c=n.trim().replace(/^\.\.\./,"").trim();if(!c)continue;if(t){let l=c.lastIndexOf(":");if(l!==-1)c=c.slice(l+1).trim()}if(c=c.split("=")[0].trim(),/^[A-Za-z_$][\w$]*$/.test(c))i.add(c)}return i}function Rt(e,t){let i=r(e),{depths:n,balanced:c}=ge(i),l=(y)=>!c||n[y]===0,a=new RegExp(`(?:^|[^\\w$.])((?:const|let|var|function|class)\\s+${t}\\b)`,"g");for(let y of i.matchAll(a)){let v=(y.index??0)+y[0].length-y[1].length;if(l(v))return!0}for(let y of i.matchAll(/(?:const|let|var)\s*\{([^}]*)\}/g))if(l(y.index??0)&&Pr(y[1],!0).has(t))return!0;for(let y of i.matchAll(/(?:const|let|var)\s*\[([^\]]*)\]/g))if(l(y.index??0)&&Pr(y[1],!1).has(t))return!0;return!1}var Dr=new R(32,{maxBytes:2097152,sizeOf:(e)=>e.code.length*4}),dt=/^[A-Za-z_$][\w$]*$/,ec=new Set(["if","for","while","switch","with"]),Mr=["(","[","{"],jr=[")","]","}"],tc=new Set(["const","let","var","return","if","for","while","do","switch","try","throw","export"]);function nc(e){let t=r(e),i=[];for(let n of t.matchAll(/[A-Za-z_$][\w$]*|=>|\.\.\.|[^\s]/g)){let c=n.index??0;i.push({text:n[0],start:c,end:c+n[0].length})}return{code:t,tokens:i}}function us(e){let t=Dr.get(e);if(t)return t;let{code:i,tokens:n}=nc(e),c=new Map,l=[];for(let L=0;L<n.length;L++){let z=n[L].text;if(["(","[","{"].includes(z))l.push(L);else if([")","]","}"].includes(z)){let Q=l.at(-1);if(Q!==void 0&&["()","[]","{}"].includes(n[Q].text+z))l.pop(),c.set(Q,L),c.set(L,Q)}}function a(L,z){let Q=[],j=L;for(let ee=L;ee<z;ee++){if(["(","[","{"].includes(n[ee].text)&&(c.get(ee)??z)<z){ee=c.get(ee);continue}if(n[ee].text===",")Q.push([j,ee]),j=ee+1}return Q.push([j,z]),Q}let y=[];function v(L,z,Q,j=!1){if(n[L]?.text==="...")L++;if(L>=z)return;let ee=n[L].text;if(dt.test(ee)){if(Q.add(ee),Q===M)y.push({name:ee,token:L,functionScoped:j});return}if(ee!=="{"&&ee!=="[")return;let ne=c.get(L);if(ne===void 0||ne>=z)return;for(let[te,le]of a(L+1,ne)){let he=te;if(ee==="{")for(let ue=te;ue<le;ue++){if(n[ue].text===":"){he=ue+1;break}if(n[ue].text==="=")break;if(["(","[","{"].includes(n[ue].text)&&c.has(ue))ue=c.get(ue)}v(he,le,Q,j)}}function E(L,z){let Q=new Set;for(let[j,ee]of a(L,z))v(j,ee,Q);return Q}function A(L){let z=L;for(;z<n.length;z++){let Q=n[z].text;if(["(","[","{"].includes(Q)&&c.has(z)){z=c.get(z);continue}if([",",";",")","]","}"].includes(Q))break}return n[Math.max(L,z-1)]?.end??i.length}let M=new Set,X=[];for(let L=0;L<n.length;L++)if(n[L].text==="=>"){let z=L-1,Q=z,j;if(n[z]?.text===")"&&c.has(z))Q=c.get(z),j=E(Q+1,z);else if(n[z]&&dt.test(n[z].text))j=new Set([n[z].text]);else continue;let ee=L+1,ne=n[ee]?.text==="{"&&c.has(ee)?n[c.get(ee)].end:A(ee);X.push({start:n[Q].start,end:ne,bodyStart:n[ee]?.start??ne,functionBody:!0,names:j})}else if(n[L].text==="("&&c.has(L)){let z=n[L-1]?.text;if(!z||ec.has(z)||!dt.test(z)&&z!=="*"&&z!=="]")continue;let Q=c.get(L),j=Q+1;if(n[j]?.text===":"){j++;while(j<n.length&&!["{","=>",";","="].includes(n[j].text))j++}if(n[j]?.text!=="{"||!c.has(j))continue;X.push({start:n[L].start,end:n[c.get(j)].end,bodyStart:n[j].start,functionBody:z!=="catch",names:E(L+1,Q)})}function D(L){let z=L;for(;z<n.length;z++){let Q=n[z].text;if(Mr.includes(Q)&&c.has(z)){z=c.get(z);continue}if(Q===";"||jr.includes(Q))break;let j=n[z-1];if(z>L&&tc.has(Q)&&j.text!==".")break;if(z>L&&/[\n\r]/.test(i.slice(j.end,n[z].start))&&(/^[\w$]+$/.test(j.text)||jr.includes(j.text)||['"',"'","`"].includes(j.text))&&dt.test(Q)&&!["in","of","instanceof"].includes(Q))break}return z}let I=[];for(let L=0;L<n.length;L++){if(n[L].text!=="for")continue;let z=n[L+1]?.text==="await"?L+2:L+1;if(n[z]?.text!=="("||!c.has(z))continue;let Q=c.get(z),j=Q+1,ee=n[j]?.text==="{"&&c.has(j)?c.get(j):D(j),ne=n[ee]?.text===";"||n[ee]?.text==="}"?n[ee].end:n[Math.max(j,ee-1)]?.end??i.length;I.push({headStart:z,headEnd:Q,start:n[z].start,end:ne})}for(let L=0;L<n.length;L++){let z=n[L].text,Q=n[L-1]?.text;if(Q==="."||n[L+1]?.text===":")continue;if(Q==="as"||Q==="<")continue;if(z==="const"||z==="let"||z==="var"){let j=D(L+1),ee=L+1,ne=!1,te=!1,le=0;for(let he=L+1;he<=j;he++){let ue=n[he]?.text;if(he<j&&Mr.includes(ue)&&c.has(he)&&c.get(he)<j){he=c.get(he);continue}if(he<j&&ue===":"&&!te)ne=!0;else if(he<j&&ue==="="&&le===0)ne=!1,te=!0;else if(he<j&&ne&&ue==="<")le++;else if(he<j&&ne&&ue===">"&&le>0)le--;else if(he===j||ue===","&&le===0)v(ee,he,M,z==="var"),ee=he+1,ne=!1,te=!1}}else if(z==="function"||z==="class"){let j=L+1;if(n[j]?.text==="*")j++;if(n[j]&&dt.test(n[j].text)&&n[j].text!=="extends")M.add(n[j].text),y.push({name:n[j].text,token:j})}else if(z==="import"){let j=L+1;if(n[j]?.text==="*"&&n[j+1]?.text==="as")j+=2;let ee=n[j]?.text;if(ee&&dt.test(ee)&&ee!=="type"&&n[j+1]?.text!=="("&&n[j+1]?.text!==".")M.add(ee),y.push({name:ee,token:j,file:!0});let ne=n[j]?.text==="{"?j:n[j+1]?.text===","&&n[j+2]?.text==="{"?j+2:-1;if(ne!==-1&&c.has(ne)){let te=c.get(ne);for(let[le,he]of a(ne+1,te)){let ue=he-1;while(ue>=le&&!dt.test(n[ue].text))ue--;if(ue>=le&&n[ue].text!=="type")y.push({name:n[ue].text,token:ue,file:!0})}}}}let B={code:i,scopes:X,loops:I,declarations:M,sites:y,tokens:n,pairs:c};return Dr.set(e,B),B}function qt(e){let t=us(e);return{code:t.code,shadows:(i,n)=>t.scopes.some((c)=>n>=c.start&&n<c.end&&c.names.has(i))}}function In(e){return new Set(us(e).declarations)}function Ie(e,t){let{scopes:i,loops:n,sites:c,tokens:l,pairs:a}=us(e),y=Array.from({length:l.length},()=>-1),v=[];for(let D=0;D<l.length;D++){y[D]=v.length?v[v.length-1]:-1;let I=l[D].text;if(I==="{"&&a.has(D))v.push(D);else if(I==="}"&&v.length&&a.get(D)===v[v.length-1])v.pop()}let E=new Set,A=new Map;for(let D of c){if(!t.has(D.name))continue;E.add(D.token);let I=D.file?-1:y[D.token],B=I===-1?[0,Number.POSITIVE_INFINITY]:[l[I].start,l[a.get(I)].end];if(D.functionScoped){let z=l[D.token].start,Q=i.filter((j)=>j.functionBody&&z>=j.bodyStart&&z<j.end).sort((j,ee)=>j.end-j.bodyStart-(ee.end-ee.bodyStart))[0];B=Q?[Q.bodyStart,Q.end]:[0,Number.POSITIVE_INFINITY]}else if(!D.file){let z=n.filter((Q)=>D.token>Q.headStart&&D.token<Q.headEnd).sort((Q,j)=>Q.headEnd-Q.headStart-(j.headEnd-j.headStart))[0];if(z)B=[z.start,z.end]}let L=A.get(D.name);if(L)L.push(B);else A.set(D.name,[B])}let M=new Set;for(let D=0;D<l.length;D++){if(l[D].text!=="import"||l[D-1]?.text===".")continue;let I=D+1;if(l[I]?.text==="type")I++;if(l[I]&&dt.test(l[I].text)&&l[I+1]?.text===",")I+=2;if(l[I]?.text==="{"&&a.has(I))for(let B=I+1;B<a.get(I);B++)M.add(B)}let X=new Set;for(let D=0;D<l.length;D++){let I=l[D].text;if(!t.has(I)||X.has(I)||E.has(D)||M.has(D))continue;let B=l[D-1]?.text;if(B==="#"||B==="."&&l[D-2]?.text!=="..")continue;if(l[D+1]?.text===":"&&(B==="{"||B===","))continue;let L=l[D].start;if(A.get(I)?.some(([z,Q])=>L>=z&&L<Q))continue;if(i.some((z)=>L>=z.start&&L<z.end&&z.names.has(I)))continue;X.add(I)}return X}var Pe="0.2.816";var Nr=Symbol.for(`stx.lazy-module-promises.${Pe}`);function rc(){let e=globalThis;return e[Nr]??=new Map,e[Nr]}function o(e,t){let i=rc(),n=`${import.meta.url}\x00${e}`,c=i.get(n);if(c)return c;let l=t();return i.set(n,l),l.catch(()=>{if(i.get(n)===l)i.delete(n)}),l}var ic=/<\/(script)/gi;function dn(e){if(!e||e.indexOf("</")===-1)return e;return e.replace(ic,"<\\/$1")}import Lr from"fs";var Br=[];function b(e){let t=new R(e);return Br.push(t),t}function Rc(){for(let e of Br)e.clear()}function x(e,...t){return`${t.map((i)=>String(i??"")).join("\x00")}\x00${e.length}\x00${Bun.hash(e)}`}function br(e){let t=[];for(let i of new Set(e))try{t.push({path:i,mtimeMs:Lr.statSync(i).mtimeMs})}catch{}return t}function Ds(e){for(let t of e)try{if(Lr.statSync(t.path).mtimeMs!==t.mtimeMs)return!1}catch{return!1}return!0}var xe=["browserQuery","BrowserQueryBuilder","BrowserQueryError","browserAuth","configureBrowser","getBrowserConfig","createBrowserDb","createBrowserModel","isBrowser","debounce","throttle","retry","sleep","wait","delay","waitUntil","waitWhile","lazy","clamp","rand","readableSize","useActiveElement","useIntervalFn","useObjectUrl"];var oc=/^[ \t]*import\s+['"]([^'"]+?\.css)(\?[^'"]*)?['"]\s*;?\s*$/gm;function cc(e){if(e.startsWith(".")||e.startsWith("/"))return null;if(e.startsWith("@")){let i=e.match(/^(@[^/]+\/[^/]+)(\/.*)?$/);if(!i)return null;return{pkg:i[1],subpath:i[2]||""}}let t=e.match(/^([^/]+)(\/.*)?$/);if(!t)return null;return{pkg:t[1],subpath:t[2]||""}}function ac(e,t){let i=t;while(!0){let n=ht.join(i,"node_modules",e,"package.json");if(Kt.existsSync(n))return ht.dirname(n);let c=ht.dirname(i);if(c===i)return null;i=c}}function lc(e,t){if(!e||typeof e!=="object")return null;let i=(c)=>{if(typeof c==="string")return c;if(c&&typeof c==="object"){if(typeof c.import==="string")return c.import;if(typeof c.default==="string")return c.default;if(typeof c.import==="object")return i(c.import);if(typeof c.default==="object")return i(c.default)}return null};if(Object.prototype.hasOwnProperty.call(e,t))return i(e[t]);let n=null;for(let c of Object.keys(e)){let l=c.indexOf("*");if(l===-1)continue;let a=c.slice(0,l),y=c.slice(l+1);if(!t.startsWith(a)||!t.endsWith(y))continue;if(t.length<a.length+y.length)continue;if(!n||a.length>n.prefix.length)n={pattern:c,prefix:a,suffix:y}}if(n){let c=t.slice(n.prefix.length,t.length-n.suffix.length),l=i(e[n.pattern]);if(l)return l.replace("*",c)}return null}function uc(e,t){let i=cc(e);if(!i||!i.subpath)return null;let n=ac(i.pkg,t);if(!n)return null;let c;try{c=JSON.parse(Kt.readFileSync(ht.join(n,"package.json"),"utf8"))}catch{return null}let l=`.${i.subpath}`,a=lc(c.exports,l);if(!a)return null;let y=ht.resolve(n,a);return Kt.existsSync(y)?y:null}function mi(e,t){let i=t.filePath?ht.dirname(t.filePath):t.projectRoot||process.cwd(),n=t.projectRoot||process.cwd(),c=new Set,l=[],a=[];return{code:e.replace(oc,(v,E)=>{let A;try{if(E.startsWith("./")||E.startsWith("../")||E.startsWith("/")){if(A=E.startsWith("/")?E:ht.resolve(i,E),!Kt.existsSync(A))throw Error(`file not found: ${A}`)}else{let M=null;try{M=Bun.resolveSync(E,n)}catch{M=uc(E,n)}if(!M)throw Error(`could not resolve ${E} (Bun.resolveSync + exports fallback both failed)`);A=M}}catch(M){return console.warn(`[stx:vendor-css] could not resolve ${JSON.stringify(E)} (from ${t.filePath||"<unknown>"}): ${M?.message||M}`),a.push(E),""}if(c.has(A))return"";c.add(A);try{let M=Kt.readFileSync(A,"utf8");l.push({source:E,resolvedPath:A,contents:M})}catch(M){console.warn(`[stx:vendor-css] could not read ${A}: ${M?.message||M}`),a.push(E)}return""}),styles:l,unresolved:a}}function fc(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function hi(e){if(e.length===0)return"";return`${e.map((t)=>`<style data-stx-vendor="${fc(t.source)}" data-stx-layer="vendor">
116
- @layer vendor {
117
- ${t.contents}
118
- }
119
- </style>`).join(`
120
- `)}
121
- `}var sg=k,Wr=b(256);function Nt(e){let t=x(e),i=Wr.get(t);if(!i)i=pc(e),Wr.set(t,i);return{code:i.code,imports:[...i.imports],models:[...i.models]}}function pc(e){let t=r(e),i=new Set;for(let y of e.matchAll(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm))for(let v of y[1].split(",")){let E=v.trim().split(/\s+as\s+/).pop()?.replace(/^type\s+/,"").trim();if(E)i.add(E)}let n=In(t),c=xe.filter((y)=>{if(i.has(y)||n.has(y))return!1;return og(t,y,!0)}),l=Ur(t).filter((y)=>!i.has(y)&&!n.has(y));if(c.length===0&&l.length===0)return{code:e,imports:c,models:l};return{code:`${[c.length>0?`import { ${c.join(", ")} } from '@stacksjs/browser'`:"",l.length>0?"import '@stacksjs/browser'":"",l.length>0?`const { ${l.join(", ")} } = window.StacksBrowser || {}`:""].filter(Boolean).join(`
122
- `)}
123
- ${e}`,imports:c,models:l}}var dc=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 Ur(e,t=qt(e)){let i=new Set,n=In(e),c=/(?<![\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(c)){let a=l[1];if(dc.has(a)||n.has(a)||a.length<3)continue;if(t.shadows(a,l.index??0))continue;i.add(a)}return Array.from(i)}function gc(e){return In(e)}var zr=b(128);function qc(e){let t=x(e),i=zr.get(t);if(!i)i=mc(e),zr.set(t,i);return{code:i.code,stxImports:[...i.stxImports],browserImports:[...i.browserImports]}}function mc(e){let t=new Set,i=new Set,n=e;n=n.replace(/^[ \t]*import\s+type\s+\{[^}]*\}\s+from\s+['"][^'"]+['"][ \t]*;?[ \t]*$/gm,"// [type import stripped]");let c=new Set,l=/^[ \t]*import\s+(?:type\s+)?{\s*([^}]+)\s*}\s+from\s+['"](@stacksjs\/browser|@stacksjs\/stx|stx)['"][ \t]*;?[ \t]*$/gm,a;while((a=l.exec(e))!==null){let D=a[1],I=a[2];if(a[0].includes("import type"))continue;let B=[];for(let z of D.split(",")){let Q=z.trim();if(!Q||Q.startsWith("type "))continue;let j=Q.match(/^([A-Za-z_$][\w$]*)(?:\s+as\s+([A-Za-z_$][\w$]*))?$/);if(!j)continue;let ee=j[1],ne=j[2]||ee;if(c.add(ee),c.add(ne),I==="stx"||I==="@stacksjs/stx")t.add(ee);else i.add(ee);if(ne!==ee)B.push(`${ne} = ${ee}`)}let L=B.length>0?`var ${B.join(", ")}; /* [auto-import processed] */`:"// [auto-import processed]";n=n.replace(a[0],L)}let y=gc(n),v=qt(n);for(let D of sg){if(c.has(D)||y.has(D))continue;if(fs(v,D,!0))t.add(D)}let E=r(n),A=qt(E),M=new Set;for(let D of n.matchAll(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm))for(let I of D[1].split(",")){let B=I.trim().replace(/^type\s+/,"").split(/\s+as\s+/);for(let L of B){let z=L.trim();if(z)M.add(z)}}for(let D of xe){if(c.has(D)||y.has(D)||M.has(D))continue;if(fs(A,D))i.add(D)}let X=Ur(E,A);for(let D of X)if(!c.has(D)&&!y.has(D))i.add(D);return{code:n,stxImports:Array.from(t),browserImports:Array.from(i)}}function og(e,t,i=!1){return fs(qt(e),t,i)}function fs(e,t,i=!1){let n=e.code,c=new RegExp(`\\b${t.replace(/[$]/g,"\\$")}\\b`,"g");for(let l of n.matchAll(c)){let a=l.index??0;if(e.shadows(t,a))continue;let y=a+t.length,v=a-1;while(v>=0&&/\s/.test(n[v]))v--;if(n[v]==="."&&n.slice(Math.max(0,v-2),v+1)!=="...")continue;let E=y;while(E<n.length&&/\s/.test(n[E]))E++;if(n[E]===":"&&n[E+1]!==":"&&(n[v]==="{"||n[v]===","))continue;if(i&&!/^\s*(?:<[^>]*>)?\s*\(/.test(n.slice(y)))continue;if(hc(n,y))continue;return!0}return!1}function hc(e,t){let i=t;while(i<e.length&&(e[i]===" "||e[i]==="\t"))i++;if(e[i]!=="(")return!1;let n=0;for(;i<e.length;i++){let c=e[i];if(c==="(")n++;else if(c===")"){if(n--,n===0)break}}if(n!==0)return!1;i++;while(i<e.length&&(e[i]===" "||e[i]==="\t"))i++;return e[i]==="{"}function Kc(e,t){let i=[];if(e.length>0)i.push(` var { ${e.join(", ")} } = window.stx || window;`);if(t.length>0)i.push(` var { ${t.join(", ")} } = window.StacksBrowser || {};`);if(i.length>0)return` // STX: auto-imported from stx and @stacksjs/browser
124
- ${i.join(`
125
- `)}
126
- ${xc(e,t)}`;return""}function Kh(e,t=[]){let{browserImports:i}=qc(e),n=new Set(t);return Kc([],i.filter((c)=>!n.has(c)))}function xc(e,t){let i=[...e.map((n)=>`['${n}', typeof ${n}, 'stx']`),...t.map((n)=>`['${n}', typeof ${n}, '@stacksjs/browser']`)];if(i.length===0)return"";return` // STX: report auto-imports the client runtime did not provide
127
- [${i.join(", ")}].forEach(function (e) {
128
- if (e[1] !== 'undefined') return;
129
- console.error(
130
- '[stx] "' + e[0] + '" is used in this client script and auto-imported from ' + e[2] + ', '
131
- + 'but the client runtime does not provide it. Either it is not exported to the browser, '
132
- + 'or it should be imported from a relative path so the bundler includes it.'
133
- );
134
- });
135
- `}function De(e){let t=e.__stxClientPayload;if(t&&typeof t==="object"){let n={};for(let c in t){let l=t[c];if(typeof l==="function")continue;n[c]=l}return n.__stxDeclaredPayload=!0,n}let i={};for(let n in e){if(n.startsWith("__")||n.startsWith("$"))continue;let c=e[n];if(typeof c==="function")continue;i[n]=c}return i}var bc=/token|secret|passw|apikey|api_key|privatekey|private_key|credential|webhook|bearer|jwt|signature/i,Fr=new Set;function yc(e,t){let i=bc.test(e),n=t.length>32768;if(!i&&!n)return;if(Fr.has(e))return;if(Fr.add(e),i)console.warn(`[stx] server\u2192client bridge is publishing "${e}" into the page body. If it holds a credential, rename it with a "__" prefix (never bridged) and pass only what the template needs. See stacksjs/stx#1831.`);if(n)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 yn(e,t){if(!t)return"";let i=Ie(e,new Set(Object.keys(t))),n=t.__stxDeclaredPayload===!0,c=[],l=Object.entries(t).sort(([a],[y])=>a<y?-1:a>y?1:0);for(let[a,y]of l){if(!/^[A-Za-z_$][\w$]*$/.test(a))continue;if(a.startsWith("__")||a.startsWith("$"))continue;if(!n&&!i.has(a))continue;if(Rt(e,a)){if(n)console.warn(`[stx] defineClientPayload declares "${a}", but this client block also declares "${a}" at the top level, so the server value is not published (emitting it would be a duplicate binding). Rename the local, or drop "${a}" from defineClientPayload.`);continue}let v;try{v=JSON.stringify(y)}catch{continue}if(v===void 0)continue;yc(a,v),c.push(` var ${a} = ${v.replace(/</g,"\\u003c")};`)}if(c.length===0)return"";return` // stx: server -> client data bridge (seeded from server scope)
136
- ${c.join(`
137
- `)}
138
- `}var _c={left:0,middle:1,right:2};function wc(e){let t=[];if(e.self)t.push("if ($event.target !== $el) return");for(let i of e.systemKeys)t.push(`if (!$event.${i}Key) return`);if(e.keys.length>0){let i=e.keys.map((n)=>`$event.key === '${n}'`).join(" || ");t.push(`if (!(${i})) return`)}if(e.mouse!==null){let i=_c[e.mouse];t.push(`if ($event.button !== ${i}) return`)}if(e.prevent)t.push("$event.preventDefault()");if(e.stop)t.push("$event.stopPropagation()");return t.join("; ")}function Sc(e,t){let{elementId:i,event:n,modifiers:c}=e,l=ls(e.handler),a=wc(c),y=[];if(c.once)y.push("once: true");if(c.capture)y.push("capture: true");if(as(n,c))y.push("passive: true");let v=y.length>0?`, { ${y.join(", ")} }`:"",E="";if(a)E+=`${a}; `;let A=l.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),M=`var $emit = function(name, detail) {
139
- $el.dispatchEvent(new CustomEvent(name, { detail: detail, bubbles: true, cancelable: true }))
140
- };`;function X(D){if(/\$emit\s*\(/.test(D))return`${M}
141
- ${D}`;return`var scope = $el.closest('[data-stx-scope]');
142
- if (scope && scope.__stx_execute) {
143
- scope.__stx_execute('${A}', $event, $el);
144
- }
145
- else {
146
- ${D}
147
- }`}if(c.debounce!==null)return` ;(function() {
148
- // eslint-disable-next-line pickier/no-unused-vars
149
- var $el = document.getElementById('${i}')
150
- if (!$el) return
151
- var __timer
152
- $el.addEventListener('${n}', function($event) {
153
- ${a?a+"; ":""}clearTimeout(__timer)
154
- __timer = setTimeout(function() { ${X(l)} }, ${c.debounce})
155
- }${v})
156
- })()`;if(c.throttle!==null)return` ;(function() {
157
- // eslint-disable-next-line pickier/no-unused-vars
158
- var $el = document.getElementById('${i}')
159
- if (!$el) return
160
- var __last = 0
161
- $el.addEventListener('${n}', function($event) {
162
- ${a?a+"; ":""}var __now = Date.now()
163
- if (__now - __last >= ${c.throttle}) {
164
- __last = __now
165
- ${X(l)}
166
- }
167
- }${v})
168
- })()`;if(/\$emit\s*\(/.test(l))return` var $el = document.getElementById('${i}')
169
- if ($el) $el.addEventListener('${n}', function($event) {
170
- ${E}${M}
171
- ${l}
172
- }${v})`;return` var $el = document.getElementById('${i}')
173
- if ($el) $el.addEventListener('${n}', function($event) {
174
- ${E}var scope = $el.closest('[data-stx-scope]');
175
- if (scope && scope.__stx_execute) {
176
- scope.__stx_execute('${A}', $event, $el);
177
- }
178
- else {
179
- ${l}
180
- }
181
- }${v})`}function vc(e){if(e.length===0)return"";return`
182
- // STX: auto-generated event bindings
183
- ${e.map((i,n)=>Sc(i,n)).join(`
184
- `)}`}function Vr(e){let t=[],i=new Set,n=e.replace(/^\s*import\s+.*$/gm,""),c=0,l=n.length,a=0;while(a<l){let y=n[a];if(y==="'"||y==='"'||y==="`"){let v=y;if(a++,v==="`"){let E=0;while(a<l){if(n[a]==="\\"){a+=2;continue}if(n[a]==="`"&&E===0){a++;break}if(n[a]==="$"&&n[a+1]==="{"){E++,a+=2;continue}if(n[a]==="}"&&E>0){E--,a++;continue}a++}}else while(a<l){if(n[a]==="\\"){a+=2;continue}if(n[a]===v){a++;break}a++}continue}if(y==="/"&&n[a+1]==="/"){while(a<l&&n[a]!==`
185
- `)a++;continue}if(y==="/"&&n[a+1]==="*"){a+=2;while(a<l-1&&!(n[a]==="*"&&n[a+1]==="/"))a++;a+=2;continue}if(y==="{"){c++,a++;continue}if(y==="}"){c--,a++;continue}if(c===0){let v=n.slice(a),E=v.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(E){let X=E[1];if(!X.startsWith("_")&&!i.has(X))t.push(X),i.add(X);a+=E[0].length;continue}let A=v.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(A){A[1].split(",").forEach((X)=>{let D=X.trim(),I=D.indexOf(":"),B=I>=0?D.slice(I+1).trim().split(/[\s=]/)[0]:D.split(/[\s=]/)[0];if(B&&!B.startsWith("_")&&!i.has(B))t.push(B),i.add(B)}),a+=A[0].length;continue}let M=v.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(M){let X=M[1];if(!X.startsWith("_")&&!i.has(X))t.push(X),i.add(X);a+=M[0].length;continue}}a++}return t}var Ec=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 kc(e){let t=new Set,i=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function n(X){let D;while((D=i.exec(X))!==null){let I=D[0];if(!Ec.has(I))t.add(I)}}let c=/\{\{([\s\S]*?)\}\}/g,l;while((l=c.exec(e))!==null)n(l[1]);let a=/:[a-z][\w.-]*\s*=\s*"([^"]*)"/gi;while((l=a.exec(e))!==null)n(l[1]);let y=/:[a-z][\w.-]*\s*=\s*'([^']*)'/gi;while((l=y.exec(e))!==null)n(l[1]);let v=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((l=v.exec(e))!==null)n(l[1]);let E=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((l=E.exec(e))!==null)n(l[1]);let A=/@model\s*=\s*["']([^"']*)["']/gi;while((l=A.exec(e))!==null)n(l[1]);let M=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((l=M.exec(e))!==null)n(l[1]);return t}async function Le(e,t={}){let i=e,n="",c=!1,l=[],a=mi(i,{filePath:t.filePath,projectRoot:t.projectRoot});i=a.code;let y=hi(a.styles),v=Nt(i);i=v.code,l=[...v.imports,...v.models];let{hasUserImports:E,bundleClientScript:A}=await o("stx/client-script-bundler",()=>import("./chunk-p7tg362f.js"));if(E(i))i=await A(i,t.filePath||"",{projectRoot:t.projectRoot,minify:t.production}),c=!0;if(t.autoImports!==!1){let j=qc(i);i=j.code,n=Kc(j.stxImports,j.browserImports.filter((ee)=>!l.includes(ee)))}if(n=`${yn(i,t.serverData)}${n}`,i=P(i),!c&&je(t.attrs||""))i=Be(i);let M=vc(t.eventBindings||[]),X=(t.attrs||"").trim(),D=/\btype\s*=\s*["']module["']/i.test(X),I=t.instanceId?` data-stx-instance="${t.instanceId}"`:"";if(D){let j=X.replace(/\btype\s*=\s*["']module["']/i,"").trim(),ee=`type="module" data-stx-scoped${I}${j?` ${j}`:""}`;return`${y}<script ${ee}>
186
- ${dn(`${n}${i}
187
- ${M}`)}
188
- </script>`}let B=Ri(e),L=/function __stx_setup_/.test(i),z=/\bstx\.mount\s*\(|\bstx\.mountEl\s*\(/.test(e);function Q(j){let ee=j.length>0?`
189
- return ${Is(i,j)};`:"",ne=JSON.stringify(`[stx] client block failed${t.filePath?` (${t.filePath})`:""}; this block will not hydrate`);return`${y}<script data-stx-scoped data-stx-run="always"${I}>
190
- window.stx.mount(function() {
191
- 'use strict';
192
- try {
193
- ${dn(`${n}${i}
194
- ${M}${ee}`)}
195
- } catch (error) {
196
- console.error(${ne}, error);
197
- return {};
198
- }
199
- })</script>`}if(!z&&!L){if(B)return Q(Vr(e));if(t.templateContent){let j=Vr(e);if(j.length>0){let ee=kc(t.templateContent);if(j.some((te)=>ee.has(te)))return Q(j)}}}return`${y}<script data-stx-scoped data-stx-run="always"${I}>
200
- ;(function() {
201
- 'use strict';
202
- try {
203
- ${dn(`${n}${i}
204
- ${M}`)}
205
- } catch (error) {
206
- console.error(${JSON.stringify(`[stx] client block failed${t.filePath?` (${t.filePath})`:""}; this block will not hydrate`)}, error);
207
- }
208
- })()</script>`}import{createHash as ra}from"crypto";var On=/<script\b[^>]*>/iy,ms=/<\/script\s*>/ig,Pn=/<style\b[^>]*>/iy,hs=/<\/style\s*>/ig;function Hr(e,t,i,n){i.lastIndex=t;let c=i.exec(e);if(!c||c.index!==t)return-1;n.lastIndex=i.lastIndex;let l=n.exec(e);if(!l)return-1;return l.index+l[0].length}function W(e,t){return Hr(e,t,On,ms)}function pn(e,t){return Hr(e,t,Pn,hs)}function Ne(e,t){if(!e.startsWith("<!--",t))return-1;let i=e.indexOf("-->",t+4);if(i===-1)return-1;return i+3}function Zr(e,t){if(e.startsWith("<!--",t)){let c=Ne(e,t);return c===-1?e.length:c}if(On.lastIndex=t,On.exec(e)?.index===t){ms.lastIndex=On.lastIndex;let c=ms.exec(e);return c?c.index+c[0].length:e.length}if(Pn.lastIndex=t,Pn.exec(e)?.index===t){hs.lastIndex=Pn.lastIndex;let c=hs.exec(e);return c?c.index+c[0].length:e.length}return-1}function S(e,t){let i=[],n=0,c=e.length,l=!1,a=null;while(n<c){let y=e[n];if(l){if(a){if(y===a)a=null}else if(y==='"'||y==="'")a=y;else if(y===">")l=!1;n++;continue}if(y!=="<"){let M=e.indexOf("<",n+1);if(M===-1)break;n=M;continue}let v=t(e,n);if(v>n){i.push({start:n,end:v,token:e.slice(n,v)}),n=v;continue}let E=Zr(e,n);if(E>n){n=E;continue}let A=e.charCodeAt(n+1);if(A>=65&&A<=90||A>=97&&A<=122)l=!0;n++}return i}function qr(e){let t=0,i=0,n=0,c=!1,l=null;while(n<e.length){if(c){let M=e[n];if(l){if(M===l)l=null}else if(M==='"'||M==="'")l=M;else if(M===">")c=!1;n++;continue}let a=e.indexOf("<",n),y=a===-1?e.length:a;while(n<y){let M=e[n++];if(M==="{")t++;else if(M==="}")i++;if(t>=2&&i>=2)return!0}if(a===-1)break;let v=Zr(e,a);if(v>a){n=v;continue}let E=e.charCodeAt(a+1),A=E===47?e.charCodeAt(a+2):E;if(A>=65&&A<=90||A>=97&&A<=122)c=!0;n=a+1}return!1}function Ac(e,t){while(e.size>=t){let i=e.keys().next();if(i.done)return;e.delete(i.value)}}var Cc=1024,Tc=16777216,Et=new Map,ps=0;function ea(e,t){Et.set(e,t),ps+=e.length+t.output.length;for(let[i,n]of Et){if(ps<=Tc)break;Et.delete(i),ps-=i.length+n.output.length}}function pe(e,t,i,n){let c=n!==void 0&&e.length>=Cc,l=c?`${n}\x00${e}`:"";if(c){let A=Et.get(l);if(A)return Et.delete(l),Et.set(l,A),{output:A.output,tokens:A.tokens.slice()}}let a=S(e,t);if(a.length===0)return{output:e,tokens:[]};let y=a.map((A)=>A.token),v="",E=0;for(let A=0;A<a.length;A++){let M=a[A];v+=e.slice(E,M.start),v+=i(M.token,A),E=M.end}if(v+=e.slice(E),c)return ea(l,{output:v,tokens:y}),{output:v,tokens:y.slice()};return{output:v,tokens:y}}var ta=1024,na=16777216,kt=new Map,ds=0;function sa(e,t){kt.set(e,t),ds+=e.length+t.output.length;for(let[i,n]of kt){if(ds<=na)break;kt.delete(i),ds-=i.length+n.output.length}}function gs(e,t,i){return{output:t,scripts:i,restore:(n)=>n===t?e:vr(n,i)}}function G(e){let t=e.length>=ta;if(t){let c=kt.get(e);if(c)return kt.delete(e),kt.set(e,c),gs(e,c.output,c.scripts.slice())}let{output:i,tokens:n}=pe(e,W,(c,l)=>`\x00STX_SCRIPT_${l}\x00`);if(t)return sa(e,{output:i,scripts:n}),gs(e,i,n.slice());return gs(e,i,n)}function vr(e,t){if(t.length===0)return e;return e.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(i,n)=>t[+n]??"")}var Dn="__stx_component_client_factories";function Mn(e){let t=e[Dn];return t instanceof Map?t:null}function Hc(e){e[Dn]=new Map}function xs(e,t){let i=Mn(e);if(!i)return null;let n=ra("sha256").update(t).digest("hex").slice(0,16),c=i.get(n);if(c)c.instances++;else i.set(n,{body:t,instances:1});return n}function Vc(e,t){let i=Mn(t);if(!i?.size)return e;let n=new Map;for(let[A,M]of i)if(M.instances===1)n.set(A,M.body);let c=[];if(n.size>0){let A=[...n.keys()].map((D)=>JSON.stringify(D).replace(/[$()*+.?[\\\]^{|}]/g,"\\$&")).join("|"),M=new RegExp(`window\\.__stxComponentFactories\\[(${A})\\]\\(("[^"]+")\\);`,"g"),X=M.exec(e);while(X!==null){let D=n.get(JSON.parse(X[1]));if(D!==void 0)c.push({start:X.index,end:X.index+X[0].length,replacement:`(${D})(${X[2]});`});X=M.exec(e)}}let l=[...i].filter(([,A])=>A.instances>1);if(l.length===0)return Kr(e,c);let y=`<script data-stx-scoped data-stx-run="always" data-stx-component-factories>
209
- (function() {
210
- const factories = window.__stxComponentFactories = window.__stxComponentFactories || {};
211
- ${l.map(([A,M])=>` try { factories[${JSON.stringify(A)}] = factories[${JSON.stringify(A)}] || ${M.body}; }
212
- catch (e) { console.error('[stx] component factory ' + ${JSON.stringify(A)} + ' failed to register; instances of it will not hydrate.', e); }`).join(`
213
- `)}
214
- })();
215
- </script>`,v,E=/<(?:template\b|script\b(?=[^>]*\bdata-stx-scoped\b))/iy;return S(e,(A,M)=>{if(v===void 0){if(E.lastIndex=M,E.test(A))v=M}return-1}),c.push({start:v??0,end:v??0,replacement:`${y}
216
- `}),Kr(e,c)}function Kr(e,t){if(t.length===0)return e;t.sort((l,a)=>l.start-a.start||l.end-a.end);let i=Array(t.length*2+1),n=0,c=0;for(let l of t)i[c++]=e.slice(n,l.start),i[c++]=l.replacement,n=l.end;return i[c]=e.slice(n),i.join("")}function Xr(e){let t=Mn(e),i=new Map;if(t)for(let[n,c]of t)i.set(n,c.instances);return i}function Jr(e,t){let i=Mn(e);if(!i)return[];let n=[];for(let[c,l]of i){let a=l.instances-(t.get(c)??0);if(a>0)n.push({body:l.body,count:a})}return n}function Gr(e,t){for(let{body:i,count:n}of t)for(let c=0;c<n;c++)xs(e,i)}function ve(e,t,i=2){let n=0,c=null;for(let l=t+i;l<e.length;l++){let a=e[l];if(c){if(a==="\\"){l++;continue}if(a===c)c=null;continue}if(a==='"'||a==="'"||a==="`"){c=a;continue}if(a==="{"){n++;continue}if(a==="}"){if(n>0){n--;continue}let y=0;while(e[l+y]==="}")y++;if(y>=i)return l}}return-1}import _i from"fs";var Yr=0,bs=new Map;function Yc(){Yr=0,bs.clear()}function jn(e,t){let i=Yr++,n=`<!--__STX_${e.toUpperCase()}_${i}__-->`;return bs.set(n,{type:e,expression:t}),n}function Zc(){let e={};for(let[t,i]of bs)e[t]={type:i.type,expression:i.expression};return e}function Qc(e,t){let i=e;for(let[n,c]of t)i=i.split(n).join(c);return i}function bi(e){return e.includes("<!--__STX_")}var ia=/@(?=[a-zA-Z_]\w*\s*\(|end[a-zA-Z]*\b|else(?:if)?\b|empty\b|case\b|default\b|break\b|continue\b|fallback\b)/g;function oa(e){return Array.from({length:e},()=>"&#123;").join("&#8288;")}function Qr(e){return e.replace(/\{{2,}/g,(t)=>oa(t.length)).replace(/\{(?=!)/g,"&#123;&#8288;").replace(ia,"&#64;")}function xr(e,t,i=!1){let{openTag:n,tail:c}=i?ca(e,t):aa(e).at(t);return ua(c,n,i)}function ca(e,t){let i="",n=0;for(let a=0;a<t;a++){if(!e.startsWith("{{",a))continue;let y=ve(e,a);if(y<0||y+2>t)break;i+=e.slice(n,a)+"x",a=y+1,n=y+2}i+=e.slice(n,t);let c=-1,l=null;for(let a=0;a<i.length;a++){let y=i[a];if(l){if(y===l)l=null;continue}if(y==='"'||y==="'"){l=y;continue}if(y===">"){c=-1;continue}if(y==="<")c=a}return{openTag:c,tail:c>=0?i.slice(c+1):i}}var Nn=null;function aa(e){if(Nn&&Nn.source===e)return Nn.scanner;let t=la(e);return Nn={source:e,scanner:t},t}function la(e){let t=0,i=-1,n=null,c=-1,l=(y,v)=>{let E=e[y];if(v.quote){if(E===v.quote)v.quote=null;return}if(v.openTag>=0){if(E==='"'||E==="'"){v.quote=E;return}if(E===">"){v.openTag=-1;return}}if(E==="<")v.openTag=y},a=(y,v)=>{if(v.openTag>=0||!e.startsWith("<!--",y))return-1;let E=e.indexOf("-->",y+4);return E<0?e.length:E+3};return{at(y){if(y<t)t=0,i=-1,n=null,c=-1;let v={openTag:i,quote:n},E=!1;while(t<y){if(c<0&&e.startsWith("{{",t)){let B=ve(e,t);if(B<0)c=t;else if(B+2<=y){t=B+2;continue}else break}let I=a(t,v);if(I>=0){if(I>y){E=!0;break}t=I;continue}l(t,v),t++}if(i=v.openTag,n=v.quote,E)return{openTag:-1,tail:""};let A=c>=0?c:t,M={openTag:i,quote:n};for(let I=t;I<y;I++){let B=a(I,M);if(B>=0){if(B>y)return{openTag:-1,tail:""};I=B-1;continue}l(I,M)}if(M.openTag<0)return{openTag:-1,tail:""};let X="",D=M.openTag+1;for(let I=D;I<Math.min(y,A);I++){if(!e.startsWith("{{",I))continue;let B=ve(e,I);X+=e.slice(D,I)+"x",I=B+1,D=B+2}return X+=e.slice(D,y),{openTag:M.openTag,tail:X}}}}function ua(e,t,i){if(t<0&&!i)return null;if(t>=0&&/^\s*[!/?]/.test(e))return/^\s*\/?\s*$/.test(e)?{kind:"tag-name"}:null;if(t>=0&&/^\s*$/.test(e))return{kind:"tag-name"};let n=0;if(t>=0)while(n<e.length&&!/\s/.test(e[n]))n++;while(n<e.length){while(/\s/.test(e[n]??"")&&n<e.length)n++;let c=n;while(n<e.length&&!/[\s=/>]/.test(e[n]))n++;let l=e.slice(c,n);if(!l)break;while(n<e.length&&/\s/.test(e[n]))n++;if(e[n]!=="=")continue;n++;while(n<e.length&&/\s/.test(e[n]))n++;let a=e[n];if(a==='"'||a==="'"){let y=++n,v=e.indexOf(a,n);if(v===-1)return{kind:"attribute",name:l,quote:a,valuePrefix:e.slice(y)};n=v+1}else{let y=n;while(n<e.length&&!/\s/.test(e[n]))n++;if(n===e.length)return{kind:"attribute",name:l,quote:null,valuePrefix:e.slice(y)}}}return{kind:"tag"}}class oe 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 ei="unsafe:";var fa=/^(?:javascript|vbscript|livescript|mocha|view-source):/,pa=/^data:(?:text\/html|text\/xml|application\/xhtml\+xml|application\/xml|image\/svg\+xml)/,da=/^data:(?:text\/html|application\/xhtml\+xml)/,ga=new RegExp("[\\u0000-\\u0020\\u00A0\\u1680\\u2000-\\u200F\\u2028\\u2029\\u202F\\u205F\\u3000\\uFEFF]+","g");function ma(e){return e.replace(ga,"").toLowerCase()}function ys(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 Ln(e,t="navigable"){let i=ma(e);if(fa.test(i))return!0;return t==="navigable"?pa.test(i):da.test(i)}function wr(e,t="navigable"){return Ln(e,t)?"unsafe:"+e:e}function ha(e){let t=e.match(/(?:^|[\s"'`/])([A-Za-z][\w:-]*)\s*=\s*(["'])([^"']*)$/);if(!t)return null;if(t[3].trim()!=="")return null;return ys(t[1])}function ti(e,t,i=256){if(t<=i)return e.slice(0,t);let n=e.slice(t-i,t),c=n.search(/[\s"'`/]/);return c===-1?"":n.slice(c)}function ni(e,t,i=t){let n=ha(e);return n&&Ln(t,n)?"unsafe:"+i:i}function At(e){let t=e.indexOf(" as ");if(t!==-1){let l=e.slice(0,t).trim(),a=e.slice(t+4).trim();return l&&a?{arrayExpr:l,itemVar:a}:null}let i=/^\s*(.+?)\s+in\s+([\s\S]+)$/.exec(e);if(!i)return null;let n=i[1].trim().replace(/^\(([\s\S]*)\)$/,"$1").trim(),c=i[2].trim();return n&&c?{arrayExpr:c,itemVar:n}:null}function Bn(e){let t=[],i=0,n="",c=0;for(let l=0;l<e.length;l++){let a=e[l];if(n){if(a==="\\")l++;else if(a===n)n="";continue}if(a==="'"||a==='"'||a==="`")n=a;else if(a==="("||a==="["||a==="{")i++;else if(a===")"||a==="]"||a==="}")i--;else if(a===","&&i===0)t.push(e.slice(c,l)),c=l+1}return t.push(e.slice(c)),t}function si(e,t){let i=0;for(let n=0;n<e.length;n++){let c=e[n];if(c==="("||c==="["||c==="{")i++;else if(c===")"||c==="]"||c==="}")i--;else if(c===t&&i===0)return n}return-1}function ri(e){let t=0;for(let i=0;i<e.length;i++){let n=e[i];if(n==="("||n==="["||n==="{")t++;else if((n===")"||n==="]"||n==="}")&&--t===0)return i}return-1}function xt(e,t){let i=e.trim().replace(/^\.\.\./,"").trim(),n=si(i,"=");if(n!==-1&&i[n+1]!==">")i=i.slice(0,n).trim();if(!i)return;if(i.startsWith("{")&&i.endsWith("}")){for(let c of Bn(i.slice(1,-1))){let l=c.trim();if(!l)continue;if(l.startsWith("...")){xt(l,t);continue}let a=si(l,":");xt(a===-1?l:l.slice(a+1),t)}return}if(i.startsWith("[")&&i.endsWith("]")){for(let c of Bn(i.slice(1,-1)))xt(c,t);return}if(/^[A-Z_$][\w$]*$/i.test(i))t.push(i)}function J(e){let t=e.trim(),i=[],n=0;for(let l=0;l<t.length;l++){let a=t[l];if(a==="("||a==="["||a==="{")n++;else if(a===")"||a==="]"||a==="}")n--;else if(n===0&&/\s/.test(a)){if(!/^\s+(?:in|of)\s/.exec(t.slice(l)))continue;let v=t.slice(0,l).trim();if(v.startsWith("(")&&ri(v)===v.length-1)v=v.slice(1,-1);for(let E of Bn(v))xt(E,i);if(i.length>0)return i;break}}let c=/^[\s\S]+?\s+as\s+([\s\S]+)$/.exec(t);if(c){let l=c[1].trim();if(l.startsWith("(")&&ri(l)===l.length-1)l=l.slice(1,-1);let a=/^([\w$]+)\s*=>\s*([\s\S]+)$/.exec(l);if(a)xt(a[2],i),xt(a[1],i);else for(let y of Bn(l))xt(y,i)}return i}function O(e,t){let i=t instanceof Set?t:new Set(t);if(i.size===0)return!1;let a=e.replace(/'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"/g," ").replace(/`(?:[^`\\$]|\\.|\$(?!\{))*`/g," ").replace(/\??\.\s*[a-zA-Z_$][\w$]*/g," ").replace(/([{,]\s*)[a-zA-Z_$][\w$]*(\s*:(?!:))/g,"$1$2");for(let y of a.match(/[a-zA-Z_$][\w$]*/g)||[])if(i.has(y))return!0;return!1}var Wn="__stx_client_loop_names";function rt(e){let t=e?.[Wn];return Array.isArray(t)?t:[]}function zn(e){if(!e.includes("#")&&!e.includes("v-slot:")&&!e.includes("data-stx-slot-binding"))return[];let t=[],i=[],n=/<!--[\s\S]*?-->|<script\b(?:"[^"]*"|'[^']*'|[^'">])*>[\s\S]*?<\/script\s*>|<style\b(?:"[^"]*"|'[^']*'|[^'">])*>[\s\S]*?<\/style\s*>|<\/?[a-z][\w:-]*\b(?:"[^"]*"|'[^']*'|[^'">])*>/gi;for(let c of e.matchAll(n)){let l=c[0];if(/^<\/template\s*>$/i.test(l)){let a=i.pop();if(a)a.end=c.index}else if(/^<template\b/i.test(l)&&!/\/\s*>$/.test(l)){let y=[...l.slice(9).matchAll(/([^\s=/>]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+)))?/g)].find((A)=>/^(?:#[\w-]+|v-slot:[\w-]+|data-stx-slot-binding)$/i.test(A[1])),v=(y?.[2]??y?.[3])?.trim();if(v&&y?.[1]==="data-stx-slot-binding")try{v=decodeURIComponent(v)}catch{v=void 0}let E=v?{start:c.index+l.length,end:e.length,binding:v}:void 0;if(i.push(E),E)t.push(E)}}return t}var Jt={},Si=new Map;function xa(e){let t=Si.get(e);if(!t){let i=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");t=new RegExp(`:${i}(?!\\w)`,"g"),Si.set(e,t)}return t.lastIndex=0,t}var Us={uppercase:(e,t)=>e!==void 0&&e!==null?String(e).toUpperCase():"",lowercase:(e,t)=>e!==void 0&&e!==null?String(e).toLowerCase():"",capitalize:(e,t)=>{if(e===void 0||e===null)return"";let i=String(e);return i.charAt(0).toUpperCase()+i.slice(1)},number:(e,t,i=0)=>{if(e===void 0||e===null)return"";try{let n=Number(e);return Number.isNaN(n)?"":n.toFixed(Number.parseInt(String(i),10))}catch{return""}},fmt:(e,t,i="en-US")=>{if(e===void 0||e===null)return"";try{let n=Number(e);if(Number.isNaN(n))return String(e);return n.toLocaleString(i)}catch{return String(e)}},join:(e,t,i=",")=>{if(!Array.isArray(e))return"";return e.join(String(i))},escape:(e,t)=>{if(e===void 0||e===null)return"";return U(String(e))},translate:(e,t,i={})=>{if(!t||!t.__translations)return e;let n=t.__translations,c=t.__i18nConfig?.fallbackToKey??!0,l=String(e).split("."),a=n;for(let v of l){if(a===void 0||a===null)break;a=a[v]}if(a===void 0||a===null)return c?e:"";let y=String(a);return Object.entries(i).forEach(([v,E])=>{y=y.replace(xa(v),()=>String(E))}),y},t:(e,t,i={})=>Us.translate(e,t,i),truncate:(e,t,i=50,n="...")=>{if(e===void 0||e===null)return"";let c=String(e);if(c.length<=i)return c;if(i<=n.length)return n.substring(0,i);return c.substring(0,i-n.length)+n},date:(e,t,i="short",n="en-US")=>{if(e===void 0||e===null)return"";try{let c=e instanceof Date?e:new Date(e);if(Number.isNaN(c.getTime()))return String(e);let l={short:{dateStyle:"short"},medium:{dateStyle:"medium"},long:{dateStyle:"long"},full:{dateStyle:"full"},time:{timeStyle:"short"},datetime:{dateStyle:"short",timeStyle:"short"},iso:{}};if(i==="iso")return c.toISOString();return new Intl.DateTimeFormat(n,l[i]||l.short).format(c)}catch{return String(e)}},currency:(e,t,i="USD",n="en-US")=>{if(e===void 0||e===null)return"";try{let c=Number(e);if(Number.isNaN(c))return String(e);return new Intl.NumberFormat(n,{style:"currency",currency:i}).format(c)}catch{return String(e)}},pluralize:(e,t,i,n)=>{let c=Number(e);if(Number.isNaN(c))return i;let l=n||`${i}s`;return c===1?i:l},first:(e,t)=>{if(e===void 0||e===null)return"";if(Array.isArray(e))return e.length===0?"":e[0];return String(e).charAt(0)},last:(e,t)=>{if(e===void 0||e===null)return"";if(Array.isArray(e))return e.length===0?"":e[e.length-1];let i=String(e);return i.charAt(i.length-1)},length:(e,t)=>{if(e===void 0||e===null)return 0;if(Array.isArray(e)||typeof e==="string")return e.length;if(e instanceof Map||e instanceof Set)return e.size;if(typeof e==="object")return Object.keys(e).length;return 0},json:(e,t,i=!1)=>{if(e===void 0)return"undefined";if(e===null)return"null";try{return i?JSON.stringify(e,null,2):JSON.stringify(e)}catch{return String(e)}},default:(e,t,i="")=>e===void 0||e===null||e===""?i:e,reverse:(e,t)=>{if(e===void 0||e===null)return"";if(Array.isArray(e))return[...e].reverse();return String(e).split("").reverse().join("")},slice:(e,t,i=0,n)=>{if(e===void 0||e===null)return"";if(Array.isArray(e)||typeof e==="string")return e.slice(i,n);return e},replace:(e,t,i,n="")=>{if(e===void 0||e===null)return"";let c=i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return String(e).replace(new RegExp(c,"g"),()=>n)},stripTags:(e,t)=>{if(e===void 0||e===null)return"";return String(e).replace(/<[^>]*>/g,"")},urlencode:(e,t)=>{if(e===void 0||e===null)return"";return encodeURIComponent(String(e))},abs:(e,t)=>{let i=Number(e);return Number.isNaN(i)?0:Math.abs(i)},round:(e,t,i=0)=>{let n=Number(e);if(Number.isNaN(n))return 0;let c=10**i;return Math.round(n*c)/c}};function gg(e,t){if(e in Us)console.warn(`Filter "${e}" already exists as a built-in filter. Custom filter will take precedence.`);Jt[e]=t}function Gh(e){for(let[t,i]of Object.entries(e))gg(t,i)}function mg(){return{...Us,...Jt}}function Jh(){for(let e of Object.keys(Jt))delete Jt[e]}function Mt(e,t,i=2){let n="{".repeat(i);if(!e.includes(n))return e;let c="",l=0;for(;;){let a=e.indexOf(n,l);if(a===-1)break;let y=ve(e,a,i);if(y===-1)break;c+=e.slice(l,a)+t(e.slice(a,y+i),e.slice(a+i,y),a),l=y+i}return l===0?e:c+e.slice(l)}function ba(e,t,i){let n=i[0];if(n!=="'"&&n!=='"'&&n!=="`")return!1;let c=xr(e,t);if(!c||c.kind!=="attribute"||c.quote===n)return!1;if(!/^(?::|@|x-|v-)/.test(c.name))return!1;let l=0;for(let a=0;a<c.valuePrefix.length;a++)if(c.valuePrefix[a]==="\\")a++;else if(c.valuePrefix[a]===n)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 U(e){return Qr(p(e))}function ya(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 _a(e){return e.replace(/\/\*[\s\S]*?\*\//g,"").replace(/\\([\dA-Fa-f]{1,6})\s?/g,(t,i)=>String.fromCodePoint(Number.parseInt(i,16))).replace(/\\([^\r\n])/g,"$1").replace(/[\u0000-\u0020]+/g,"").toLowerCase()}function wa(e,t){let i=_a(e);if(/@import|expression\(|behavior:|-moz-binding|(?:image-set|cross-fade)\(/.test(i))throw new oe(t,"network-capable or executable CSS is not allowed in an escaped interpolation");let n=/url\(([^)]*)\)/g,c;while((c=n.exec(i))!==null){let l=c[1].replace(/^["']|["']$/g,""),a=l.startsWith("/")&&!l.startsWith("//")||l.startsWith("./")||l.startsWith("../")||l.startsWith("#"),y=/^data:image\/(?:avif|bmp|gif|jpeg|jpg|png|webp);base64,[a-z\d+/=]+$/i.test(l);if(!a&&!y)throw new oe(t,"CSS URLs must be local paths or base64 raster images")}}function Z(e,t,i,n=!1,c=0){try{return Sa(e,t,i,n,c)}catch(l){if(l instanceof oe)l.locate(e,t);throw l}}function Sa(e,t,i,n,c){let l=xr(e,t,n),a=U(i);if(!l)return a;if(l.kind==="tag-name"){if(!/^[A-Za-z][A-Za-z0-9:-]*$/.test(i))throw new oe("tag name","dynamic tag names may contain only letters, digits, colons, and hyphens");return i}if(l.kind==="tag"){let E=e.slice(t+c).trimStart(),A=i.trim();if(!E.startsWith("=")&&(A===""||/^(?!on)[A-Za-z_:][\w:.-]*(?:\s+(?!on)[A-Za-z_:][\w:.-]*)*$/.test(A)))return A;throw new oe("tag structure","only standalone boolean attributes may be interpolated into tag structure")}let y=l.name.toLowerCase();if(/^on[a-z]/.test(y))throw new oe(l.name,"native event-handler attributes execute JavaScript; use an @event binding instead");if(y==="srcdoc")a=U(a);if(y==="style")wa(i,l.name);if(l.quote===null)a=ya(a);let v=ys(y);if(v&&l.valuePrefix.trim()===""&&Ln(i,v))return ei+a;return ni(ti(e,t),i,a)}function wn(e,t){let i=` ${e}="`;return Z(i,i.length,t,!0)}function Ai(e){return e.flatMap((t)=>{let i=t.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i);return!i||/\bserver\b|\bsrc\s*=/.test(i[1])?[]:[i[2]]})}function Se(e,t){let{scripts:i}=G(e);for(let n of Ai(i)){if(/\b(state|derived|effect|ref|reactive|computed|watch|watchEffect|useModel)\s*(?:<[^>]*>)?\s*\(/.test(n)||Gc.test(n))return!0;if(Or(n,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 hg(e){let t=[],i=/<([a-zA-Z][\w-]*)\b[^>]*?\s(?::for|x-for|@for)\s*=\s*(["'])([\s\S]*?)\2[^>]*>/g;for(let n=i.exec(e);n;n=i.exec(e)){let c=n[1].toLowerCase(),l=new Set(J(n[3]));if(l.size===0)continue;let a=n.index+n[0].length;if(n[0].endsWith("/>")){t.push({start:n.index,end:a,names:l});continue}let y=new RegExp(`<(/?)${c}\\b[^>]*?(/?)>`,"gi");y.lastIndex=a;let v=1,E=e.length;for(let A=y.exec(e);A;A=y.exec(e)){if(A[2]==="/")continue;if(v+=A[1]==="/"?-1:1,v===0){E=A.index+A[0].length;break}}t.push({start:n.index,end:E,names:l})}return t}function $i(e,t,i){let n=r(i);for(let c of e){if(t<c.start||t>=c.end)continue;for(let l of c.names)if(new RegExp(`(?<![.#\\w$])${l.replace(/\$/g,"\\$")}(?![\\w$])`).test(n))return!0}return!1}function vi(e,t){let i=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","URL","URLSearchParams","Intl","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined","NaN","Infinity","isNaN","isFinite","window","document","console","new","typeof","instanceof","in","void"],n=e.replace(/'[^']*'/g,"").replace(/"[^"]*"/g,""),c="",l=!1,a=0;for(let E=0;E<n.length;E++){let A=n[E];if(!l&&A==="`"){l=!0,a=0;continue}if(l){if(A==="`"&&a===0){l=!1;continue}if(A==="$"&&n[E+1]==="{"){a++,E++,c+=" ";continue}if(A==="}"&&a>0){a--;continue}if(a>0){c+=A;continue}continue}c+=A}n=c;let y=/(?<![a-zA-Z0-9_$])([a-zA-Z_$][a-zA-Z0-9_$]*)/g,v;while((v=y.exec(n))!==null){let E=v[1];if(!n.substring(0,v.index).trimEnd().endsWith(".")){if(!i.includes(E)&&!(E in t))return!1}}return!0}function $a(e,t){let i=r(e);for(let n of i.matchAll(/(?<![.\w$])([A-Z_$][\w$]*)\s*\(/gi))if(typeof t[n[1]]==="function")return!0;return!1}function va(e,t){let i=t.__stx_serverDeclared;if(!i||i.size===0)return!1;let n=r(e);for(let c of i)if(new RegExp(`(?<![.#\\w$])${c}(?![\\w$])`).test(n))return!0;return!1}var Ei=new Set;function ki(e){return/^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*)*$/.test(e.trim())}function Ea(e,t,i){let n=i[0];if(n!=="'"&&n!=='"'&&n!=="`")return!1;let c=0;for(let l=e.lastIndexOf(`
217
- `,t-1)+1;l<t;l++)if(e[l]==="\\")l++;else if(e[l]===n)c++;return c%2===1}function Ci(e,t){let i=`${t??"<unknown>"}\x00${e}`;if(process.env.STX_DEBUG||!Ei.has(i))Ei.add(i),console.warn(`[stx] {{ ${e} }} in a <script> in ${t??"<unknown>"} has no server value, so it was emitted as undefined. A mustache left in JavaScript is a SyntaxError that takes the whole script down, so give the value a default in <script server>.`);return"undefined"}function wi(e,t,i){let n=e;return n=n.replace(/\{!!([\s\S]*?)!!\}/g,(c,l)=>{try{let a=T(l,t);if(a===void 0)return ki(l)?Ci(l.trim(),i):c;return a===null?"":String(a)}catch{return c}}),n=Mt(n,(c,l,a)=>{let y=l.trim();if(Ea(n,a,l))return c;if(/^__[A-Z_]+__$/.test(y))return c;try{let v=T(l,t);if(v===void 0)return ki(y)?Ci(y,i):c;return JSON.stringify(v).replace(/</g,"\\u003c").replace(/@/g,"\\u0040").replace(/\{{2,}/g,(E)=>"\\u007b".repeat(E.length)).replace(/\{(?=!)/g,"\\u007b")}catch{return c}}),n}function yg(e,t){if(!e.includes("{"))return e;let i=e;return i=i.replace(/\{!!([\s\S]*?)!!\}/g,(n,c)=>{try{let l=T(c,t);if(l===void 0)return n;return l===null?"":String(l)}catch{return n}}),i=Mt(i,(n,c,l)=>{let a=c.trim();if(/^__[A-Z_]+__$/.test(a))return n;try{let y=T(c,t);if(y===void 0)return n;if(y===null)return"";let v=String(y);return Z(i,l,v,!0,n.length)}catch(y){if(y instanceof oe)throw y;return n}}),i}function Yh(e,t,i={}){let{output:n,scripts:c}=G(e),l=c.map((a)=>{let y=a.match(/^<script\b((?:[^>\"']|\"[^\"]*\"|'[^']*')*)>/i),v=a.search(/<\/script\s*>$/i);if(!y||v===-1)return a;let E=y[1],A=a.slice(y[0].length,v);if(/\bdata-raw\b/.test(E))return a;if(i.skipServer&&/\bserver\b/.test(E))return a;let X=`<script${yg(E,t)}>`;if(/\bsrc\s*=/.test(E)||/\btype\s*=\s*["']application\/json["']/.test(E))return X+A+a.slice(v);return X+wi(A,t)+a.slice(v)});return vr(n,l)}function _(e,t,i){let n=e,c=(I,B)=>{let L=pn(I,B);if(L===-1)return-1;return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(I.slice(B,L))?-1:L},l=(I,B,L,z)=>{let Q=L.length,{output:j,tokens:ee}=pe(I,B,(ne,te)=>z(Q+te));return L.push(...ee),j},a=[];n=l(n,c,a,(I)=>`<!--__STX_STYLE_${I}__-->`);let y=[];n=l(n,W,y,(I)=>`<!--__STX_SCRIPT_EXPR_${I}__-->`);let v=t?.__stx_signals_gate===!0||Se(e),E=new Set([...Array.isArray(t?.__stx_client_signal_names)?t.__stx_client_signal_names:[],...yi(Ai(y))]),A=new Set(Array.isArray(t?.__stx_preserved_client_expressions)?t.__stx_preserved_client_expressions:[]);n=Mt(n,(I,B,L)=>{if(O(B,E))return I;try{let z=T(B,t,!1,(Q)=>_s(Q,I,i,e));return z!==void 0&&z!==null?String(z):""}catch(z){let Q=z instanceof Error?z.message:String(z);return h("Expression",`Error evaluating: {{{ ${B.trim()}}}}: ${Q}`,i,e,L,I)}},3),n=n.replace(/\{!!([\s\S]*?)!!\}/g,(I,B,L)=>{if(O(B,E))return I;try{let z=T(B,t,!1,(Q)=>_s(Q,I,i,e));if(z===void 0&&t.__stx_buildMode==="compile")return jn("raw",B.trim());return z!==void 0&&z!==null?String(z):""}catch(z){if(t.__stx_buildMode==="compile")return jn("raw",B.trim());let Q=z instanceof Error?z.message:String(z);return h("Expression",`Error evaluating: {!! ${B.trim()} !!}: ${Q}`,i,e,L,I)}}),n=l(n,W,y,(I)=>`<!--__STX_SCRIPT_EXPR_${I}__-->`),n=l(n,c,a,(I)=>`<!--__STX_STYLE_${I}__-->`);let M=v?hg(n):[],X=zn(n).map((I)=>({...I,names:new Set(J(`${I.binding} in __slot`))})),D=new Set(rt(t));if(n=Mt(n,(I,B,L)=>{let z=B.trim();if(ba(n,L,B))return I;if($i(X,L,z))return I;if(O(z,D))return I;if(M.length>0&&$i(M,L,z))return I;if(A.has(z))return I;let Q=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined"],j=/^([a-zA-Z_$][a-zA-Z0-9_$]*)/,ne=z.match(j)?.[1],te=ne&&((ne in t)||Q.includes(ne)),le=/^([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/,he=z.match(le),ue=he&&!Q.includes(he[1])&&!(he[1]in t);if(/^__[A-Z_]+__$/.test(z))return"";if(O(z,E))return I;if(t.__stx_native_screen===!0&&$a(z,t))return I;let Ce;try{let Ae=T(B,t,!1,(Ke)=>{Ce=Ke});if(v&&!vi(z,t))return I;if(Ce)_s(Ce,I,i,e);if(t.__stx_buildMode==="compile"&&!v&&(Ae===void 0||va(z,t)))return jn("expr",z);if(Ae===void 0||Ae===null)return"";let We=String(Ae);return Z(n,L,We,!1,I.length)}catch(Ae){if(Ae instanceof oe)throw Ae;if(v&&!vi(z,t))return I;if(ue)return I;let We=Ae instanceof Error?Ae.message:String(Ae);return h("Expression",`Error evaluating: {{ ${z} }}: ${We}`,i,e,L,I)}}),y.length>0)n=n.replace(/<!--__STX_SCRIPT_EXPR_(\d+)__-->/g,(I,B)=>y[Number(B)]??I);if(a.length>0)n=n.replace(/<!--__STX_STYLE_(\d+)__-->/g,(I,B)=>a[Number(B)]??I);return n}function bg(e,t,i){if(!t.trim())return e;let n=e,c=t.trim();while(c.length>0){let l=c.match(/^(\w+)/);if(!l)break;let a=l[1];c=c.substring(a.length).trim();let y=Jt[a]||Us[a];if(!y)throw Error(`Filter not found: ${a}. Available filters: ${Object.keys(mg()).join(", ")}`);let v=[];if(c.startsWith(":")){let E=c.match(/^:([^|\s]+)/);if(E){let A=E[1].trim();try{let M=Number(A);v=[Number.isNaN(M)?A:M]}catch{v=[A]}c=c.substring(E[0].length).trim()}}else if(c.startsWith("(")){let E=1,A=1;while(E>0&&A<c.length){if(c[A]==="(")E++;if(c[A]===")")E--;A++}if(E===0){let M=c.substring(1,A-1).trim();if(M)try{if(M.startsWith("{")&&M.endsWith("}"))v=[T(`(${M})`,i,!0)];else{let X=[],D="",I=null,B=0,L=0,z=0,Q=!1;for(let j=0;j<M.length;j++){let ee=M[j];if(Q){D+=ee,Q=!1;continue}if(ee==="\\"){D+=ee,Q=!0;continue}if(I){if(D+=ee,ee===I)I=null;continue}if(ee==='"'||ee==="'"||ee==="`"){I=ee,D+=ee;continue}if(ee==="(")B++;else if(ee===")")B--;else if(ee==="[")L++;else if(ee==="]")L--;else if(ee==="{")z++;else if(ee==="}")z--;if(ee===","&&B===0&&L===0&&z===0){X.push(D),D="";continue}D+=ee}if(D)X.push(D);v=X.map((j)=>{let ee=j.trim();return T(ee,i,!0)})}}catch{v=[M]}c=c.substring(A).trim()}}try{n=y(n,i,...v)}catch(E){let A=E instanceof Error?E.message:String(E);throw Error(`Error applying filter '${a}': ${A}`)}if(c.startsWith("|"))c=c.substring(1).trim();else break}return n}function ka(e){let t=!1,i="",n=0,c=0,l=0,a=!1;for(let y=0;y<e.length;y++){let v=e[y],E=e[y+1];if(t&&a){a=!1;continue}if(t&&v==="\\"){a=!0;continue}if(a=!1,(v==='"'||v==="'"||v==="`")&&!a){if(!t)t=!0,i=v;else if(v===i)t=!1,i="";continue}if(t&&i==="`"&&v==="$"&&E==="{"){let A=1;y+=2;while(y<e.length&&A>0){if(e[y]==="{")A++;else if(e[y]==="}")A--;if(A>0)y++}continue}if(t)continue;if(v==="(")n++;else if(v===")")n--;else if(v==="[")c++;else if(v==="]")c--;else if(v==="{")l++;else if(v==="}")l--;if(v==="|"&&n===0&&c===0&&l===0){if(E==="|"){y++;continue}if(E==="="){y++;continue}return y}}return-1}var Xt=new Set,Ca=1000;function Zh(){Xt.clear()}function _s(e,t,i,n){if(!K())return;let c=`${i}\x00${e.expression}`;if(Xt.has(c))return;if(Xt.size>=Ca)Xt.clear();Xt.add(c);let l=i,a=n;try{if(i&&_i.existsSync(i))a=_i.readFileSync(i,"utf8")}catch{}let y=a.indexOf(t);if(y>=0)l=`${i}:${a.slice(0,y).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 T(e,t,i=!1,n){try{let c=e.trim(),l=ka(c);if(l>0){let y=c.substring(0,l).trim(),v=c.substring(l+1).trim(),E=T(y,t,!0,n);return bg(E,v,t)}let a=qs(c);if(a!==null){n?.({expression:c,rule:a});return}try{let y=Object.keys(t),v=Object.values(t);return d(c,y)(...v)}catch{return u(c,t)}}catch(c){if(c instanceof ReferenceError){let l=/(\b\w+)\s+is not defined/.exec(c.message);if(l){let a=l[1],y=Ra(a,Object.keys(t));if(y&&y!==a)c.message=`${c.message} \u2014 did you mean '${y}'?`}}if(!i)console.error(`Error evaluating expression: ${e}`,c);throw c}}function Ra(e,t){let i=null;for(let c of t){if(c===e)continue;let l=Aa(e,c);if(i===null||l<i.dist)i={key:c,dist:l}}if(!i)return null;let n=Math.max(e.length,i.key.length);if(i.dist<=2||i.dist/n<=0.35)return i.key;return null}function Aa(e,t){if(e===t)return 0;if(e.length===0)return t.length;if(t.length===0)return e.length;let[i,n]=e.length<t.length?[e,t]:[t,e],c=Array(i.length+1),l=Array(i.length+1);for(let a=0;a<=i.length;a++)c[a]=a;for(let a=1;a<=n.length;a++){l[0]=a;for(let y=1;y<=i.length;y++){let v=i[y-1]===n[a-1]?0:1;l[y]=Math.min(l[y-1]+1,c[y]+1,c[y-1]+v)}for(let y=0;y<=i.length;y++)c[y]=l[y]}return c[i.length]}function Qh(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 Ta from"process";function C(e="STX_PUBLIC_"){let t={},i={};for(let[n,c]of Object.entries(Ta.env)){if(!n.startsWith(e)||c===void 0)continue;t[`import.meta.env.${n}`]=JSON.stringify(c),i[n]=c}return t["import.meta.env"]=JSON.stringify(i),t}function Ti(e,t=""){let i=`${e}${t}`,n=0;for(let c=0;c<i.length;c++){let l=i.charCodeAt(c);n=(n<<5)-n+l,n=n&n}return`stx-${Math.abs(n).toString(36)}`}function Ii(e,t,i={}){let{prefix:n="",preserveHost:c=!0,scopeKeyframes:l=!0,scopeCustomProperties:a=!1}=i;if(!e.trim())return"";let y=ws(e),v=[],E=new Map;if(l)for(let A of y){let M=A.selector.match(/@keyframes\s+([a-z_-][a-z0-9_-]*)/i);if(M){let X=M[1],D=`${t}_${X}`;E.set(X,D)}}for(let A of y){let M=Oi(A,t,n,c,E,a);v.push(M)}return v.join(`
219
-
220
- `)}function ws(e){let t=[],i=e.replace(/\/\*[\s\S]*?\*\//g,""),n=0,c="",l=!1,a="";for(let y=0;y<i.length;y++){let v=i[y];if(v==="@"&&n===0)l=!0;if(v==="{")n++;else if(v==="}"){if(n--,n===0){if(l){a+=v;let E=a.match(/@([a-z-]+)\s*([^{]*)\{([\s\S]*)\}/i);if(E){let[,A,M,X]=E;if(A==="keyframes")t.push({selector:`@keyframes ${M.trim()}`,declarations:X.trim()});else if(A==="media"||A==="supports"||A==="container"){let D=ws(X);t.push({selector:`@${A} ${M.trim()}`,declarations:D.map((I)=>`${I.selector} { ${I.declarations} }`).join(`
221
- `)})}else t.push({selector:`@${A} ${M.trim()}`,declarations:X.trim()})}a="",l=!1}else if(c.trim()){c+=v;let E=c.match(/([^{]+)\{([^}]*)\}/);if(E)t.push({selector:E[1].trim(),declarations:E[2].trim()});c=""}continue}}if(l)a+=v;else c+=v}return t}function Oi(e,t,i,n,c,l){let{selector:a,declarations:y}=e;if(a.startsWith("@")){if(a.startsWith("@keyframes")){let A=a.replace("@keyframes ","").trim();return`@keyframes ${c.get(A)||A} { ${y} }`}if(a.startsWith("@media")||a.startsWith("@supports")||a.startsWith("@container")){let M=ws(`x { ${y} }`.replace(/x \{ /,"").replace(/ \}$/,"")).map((X)=>Oi(X,t,i,n,c,l)).join(`
222
- `);return`${a} {
223
- ${M}
224
- }`}return`${a} { ${y} }`}let v=Ia(a,t,i,n),E=y;for(let[A,M]of c)E=E.replace(new RegExp(`\\b${A}\\b`,"g"),M);if(l)E=E.replace(/--([a-z-]+)/gi,`--${t}-$1`);return`${v} { ${E} }`}function Ia(e,t,i,n){let c=e.split(",").map((a)=>a.trim()),l=[];for(let a of c){if(a.startsWith(":host")){if(n)l.push(a);else{let E=a.replace(/:host(\([^)]*\))?/,`.${t}$1`);l.push(E)}continue}if(a.includes("::slotted")){l.push(a);continue}if(a===":root"){l.push(`:root .${t}`);continue}let y=i?`${i} .${t}`:`.${t}`;l.push(`${y} ${a}`);let v=Oa(a,t);if(v)l.push(i?`${i} ${v}`:v)}return l.join(", ")}function Oa(e,t){let i=0,n=e.length;for(let v=0;v<e.length;v++){let E=e[v];if(E==="["||E==="(")i++;else if(E==="]"||E===")")i--;else if(i===0&&(E===" "||E===">"||E==="+"||E==="~")){n=v;break}}let c=e.slice(0,n),l=e.slice(n);if(!c)return"";let a=c.length,y=0;for(let v=0;v<c.length;v++){let E=c[v];if(E==="["||E==="(")y++;else if(E==="]"||E===")")y--;else if(i===0&&y===0&&E===":"){a=v;break}}return`${c.slice(0,a)}.${t}${c.slice(a)}${l}`}var Mi=String.raw`(?<![\w-])scoped(?![\w-])`,Ss=/<style\s+([^>]*)>/gi,Pi=/<style\s+([^>]*)>([\s\S]*?)<\/style>/gi,ji=new RegExp(Mi,"i"),Pa=new RegExp(Mi,"gi"),$s=/<style\b[^>]*\bdata-stx-scoped(?:=(?:"[^"]*"|'[^']*'|[^\s>]+))?[^>]*>[\s\S]*?<\/style>\s*/gi;function Da(e){Ss.lastIndex=0;let t=Ss.exec(e);while(t!==null){if(ji.test(t[1]))return!0;t=Ss.exec(e)}return!1}function pi(e){let t=new Set,i=[];$s.lastIndex=0;let n=$s.exec(e);while(n!==null){let c=n[0].trim();if(t.has(c))i.push({start:n.index,end:n.index+n[0].length});else t.add(c);n=$s.exec(e)}return i}function fn(e){let t=pi(e);if(t.length===0)return e;let i=Array(t.length+1),n=0;for(let c=0;c<t.length;c++){let l=t[c];i[c]=e.slice(n,l.start),n=l.end}return i[t.length]=e.slice(n),i.join("")}function Bs(e,t){if(!Da(e))return{html:e,hasScoped:!1};let i=Ti(t),n=`data-v-${i}`,c=e,l=!1;if(Pi.lastIndex=0,c=c.replace(Pi,(a,y,v)=>{if(!ji.test(y))return a;l=!0;let E=Ma(v,n),A=y.replace(Pa,"").trim(),M=A?` ${A}`:"";return`<style data-stx-scoped="${i}"${M}>${E}</style>`}),!l)return{html:e,hasScoped:!1};return c=Na(c,n),{html:c,hasScoped:!0}}function Ma(e,t){return Ii(e,"__SCOPE_PLACEHOLDER__",{preserveHost:!1}).replace(/\.(__SCOPE_PLACEHOLDER__) /g,`[${t}] `).replace(/\.(__SCOPE_PLACEHOLDER__)/g,`[${t}]`)}var ja=(e)=>`\x00stx-scope-mask-${e}\x00`,Di=/\u0000stx-scope-mask-(\d+)\u0000/g;function Na(e,t){let i=pe(e,(c,l)=>{let a=W(c,l);return a>l?a:pn(c,l)},(c,l)=>ja(l)),n=La(i.output,t);return Di.lastIndex=0,n.replace(Di,(c,l)=>i.tokens[Number(l)])}function La(e,t){let i=new Set(["script","style","template","html","head","body","meta","link","title","base","!doctype","!DOCTYPE"]);return e.replace(/<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*)?\/?>/g,(n,c,l)=>{if(i.has(c.toLowerCase()))return n;if(n.includes(t))return n;if(c.toLowerCase()==="style"||c.toLowerCase()==="script")return n;if(l)return n.replace(`<${c}${l}`,`<${c} ${t}${l}`);if(n.endsWith("/>"))return`<${c} ${t} />`;return`<${c} ${t}>`})}var Gt=/<\/?template\b[^>]*>/gi,Ba=/(?:^|\s)(?:id\s*=|(?:x-|[@:])(?:for|if|else(?:-if)?)(?=\s|=|$)|#[\w-]+(?:\s*=|\s|$)|v-slot(?::[\w-]+)?(?=\s|=|$)|slot\s*=)/i;function Wa(e){let t=e.replace(/^<template\b/i,"").replace(/>$/,"");return Ba.test(t)}function de(e){Gt.lastIndex=0;let t;while((t=Gt.exec(e))!==null){if(t[0].startsWith("</")||Wa(t[0]))continue;let i=t.index,n=Gt.lastIndex,c=1,l;while((l=Gt.exec(e))!==null)if(l[0].startsWith("</")){if(c--,c===0){let a=l.index;return{start:i,openEnd:n,closeStart:a,end:Gt.lastIndex,content:e.slice(n,a)}}}else c++;return null}return null}function zs(e,t){let i=e,n=/@json\s*\(/g,c;while((c=n.exec(i))!==null){let l=c.index,a=l+c[0].length-1,y=1,v=a+1,E=null,A=!1;while(v<i.length&&y>0){let j=i[v];if(A){A=!1,v++;continue}if(j==="\\"&&E){A=!0,v++;continue}if(E){if(j===E)E=null;v++;continue}if(j==='"'||j==="'"||j==="`"){E=j,v++;continue}if(j==="(")y++;else if(j===")"){if(y--,y===0)break}v++}if(y!==0)break;let M=i.substring(a+1,v).trim(),X=i.substring(l,v+1),D=-1,I=0,B=null,L=!1;for(let j=0;j<M.length;j++){let ee=M[j];if(L){L=!1;continue}if(ee==="\\"&&B){L=!0;continue}if(B){if(ee===B)B=null;continue}if(ee==='"'||ee==="'"||ee==="`"){B=ee;continue}if(ee==="("||ee==="["||ee==="{")I++;else if(ee===")"||ee==="]"||ee==="}")I--;if(ee===","&&I===0){D=j;break}}let z=D>=0?M.substring(0,D).trim():M,Q=D>=0?M.substring(D+1).trim():void 0;try{let j=z.trim(),ee;if(f(j))ee=d(j,Object.keys(t))(...Object.values(t));else ee=void 0;let ne;if(Q==="true")ne=JSON.stringify(ee,null,2);else ne=JSON.stringify(ee);let te=ne.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029");i=i.substring(0,l)+te+i.substring(v+1),n.lastIndex=l+te.length}catch(j){F.log(j instanceof Error?j:Error(String(j)),{directive:"@json"},"error"),n.lastIndex=l+X.length}}return i}function Hs(e){return e.replace(/@once\s*([\s\S]*?)@endonce/g,"$1")}function Bc(e){let t=e,i=/@memo\s*\(/g,n,c=[];while((n=i.exec(t))!==null){let l=n.index,a=l+n[0].length,y=1,v=a;while(v<t.length&&y>0){if(t[v]==="(")y++;else if(t[v]===")")y--;v++}if(y!==0)continue;let E=t.slice(a,v-1).trim(),A=v,M=t.slice(A),X=M.indexOf("@endmemo");if(X===-1)continue;let D=M.slice(0,X),I=A+X+8,B=D.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)/),L=B?B[0].length:0,z=D.slice(L),Q=D.match(/(\s*)$/),j=Q?Q[0].length:0,ee=z.slice(0,z.length-j),ne=ee.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)?(\/?)>/),te;if(ne){let[le,he,ue="",Ce]=ne,Ae=`<${he}${ue} data-stx-memo="${E}"${Ce}>`;te=D.slice(0,L)+Ae+ee.slice(le.length)+D.slice(L+ee.length)}else te=`${D.slice(0,L)}<div data-stx-memo="${E}">${ee}</div>${D.slice(L+ee.length)}`;c.push({start:l,end:I,replacement:te}),i.lastIndex=I}for(let l=c.length-1;l>=0;l--){let a=c[l];t=t.slice(0,a.start)+a.replacement+t.slice(a.end)}return t.replace(/@memo="([^"]*)"/g,'data-stx-memo="$1"')}function fi(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 Wi(e,t){if(!/\bref\s*=/.test(e))return e;let i=/<\/?([a-zA-Z][\w-]*)\b(?:"[^"]*"|'[^']*'|[^'">])*>/y,n=S(e,(v,E)=>{i.lastIndex=E;let A=i.exec(v);if(!A||/^(?:script|style)$/i.test(A[1]))return-1;return i.lastIndex}),c=[],l=0,a=0,y=[];for(let{start:v,end:E,token:A}of n){let M=/^<\/?([\w-]+)/.exec(A)[1].toLowerCase();if(A.startsWith("</")){let B;while(B=c.pop()){if(B.scoped)l--;if(B.name===M)break}continue}let X=/\sdata-stx-scope\s*=/.test(A),D=/\sdata-stx-ref-caller\s*=\s*(["'])(.*?)\1/.exec(A),I=c.find((B)=>B.scoped)?.scopeId;if(D&&I&&D[2]===I)y.push(e.slice(a,v),A.replace(D[0],` data-stx-ref-caller="${t}"`)),a=E;else if(!l&&!X&&/\s(?:ref|@ref|:ref|x-ref|data-stx-ref)\s*=/.test(A)&&!/\sdata-stx-ref-caller\s*=/.test(A))y.push(e.slice(a,v),A.replace(/\s*\/?>$/,(B)=>` data-stx-ref-caller="${t}"${B}`)),a=E;if(!zi.has(M)&&!/\/>$/.test(A)){let B=/\sdata-stx-scope\s*=\s*(?:"([^"]*)"|'([^']*)')/.exec(A);if(c.push({name:M,scoped:X,scopeId:B?.[1]??B?.[2]}),X)l++}}return y.push(e.slice(a)),y.join("")}var zi=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),Fi=/(?:^|\s)x-no-cloak(?:=|\s|\/|>|$)/,Ni=/<\/?\s*([a-z][\w-]*)/iy,za=/\s/;function Fa(e,t){let i=t-1;while(i>=0&&za.test(e[i]))i--;return i>=0&&e[i]==="/"}function Va(e,t){let i=!1,n=!1;for(let c=t;c<e.length;c++){let l=e[c];if(i){if(l==="'")i=!1}else if(n){if(l==='"')n=!1}else if(l==="'")i=!0;else if(l==='"')n=!0;else if(l===">")return c}return-1}function Ua(e,t){if(e.indexOf("{",t)===-1||e.indexOf("}",t)===-1)return!1;let i=0,n=t,c=!1,l=!1,a=!1;while(n<e.length){let y=e.indexOf("<",n),v=y===-1?e.length:y;if(v>n){if(i===0)while(n<v){let M=e.indexOf(l?"}":"{",n);if(M===-1||M>=v){if(l)a=!1;else c=!1;break}if(M>n)if(l)a=!1;else c=!1;if(l){if(a)return!0;a=!0}else if(c)l=!0,a=!1;else c=!0;n=M+1}n=v;continue}if(e.startsWith("<!--",n)){let M=e.indexOf("-->",n);n=M===-1?e.length:M+3;continue}let E=Va(e,n);if(E===-1)break;Ni.lastIndex=n;let A=Ni.exec(e)?.[1]?.toLowerCase()??"";if(e[n+1]==="/"){if(i===0)break;i--}else if(!Fa(e,E)&&!zi.has(A))i++;n=E+1}return!1}var Li=b(256);function Fc(e){if(e.length<1024)return Bi(e);let t=x(e),i=Li.get(t);if(i!==void 0)return i;let n=Bi(e);return Li.set(t,n),n}function Bi(e){if(e.length>=32768&&!qr(e))return e;let i=new RegExp(`<(${"div|span|p|h[1-6]|td|th|li|a|button|label|section|article|header|footer|main|nav|aside|dd|dt|figcaption|summary|caption|blockquote|pre|code|em|strong|small|sub|sup|time|mark|abbr|cite|q|s|u|b|i"})\\b`,"gi"),n="",c=0,l;while((l=i.exec(e))!==null){let a=l.index,y=a+l[0].length,v=!1,E=!1,A=-1;while(y<e.length){let X=e[y];if(v){if(X==="'")v=!1}else if(E){if(X==='"')E=!1}else if(X==="'")v=!0;else if(X==='"')E=!0;else if(X===">"){A=y;break}y++}if(A===-1)continue;let M=e.slice(a,A+1);if(Fi.test(M))continue;if(M.includes("x-cloak"))continue;if(Ua(e,A+1))n+=e.slice(c,A)+" x-cloak>",c=A+1}return n+=e.slice(c),n}var Ha=/(?:^|\s)(?::else-if|:if|:else|:show|x-else-if|x-if|x-else|x-show|@if|@show)(?:=|\s|\/|>|$)/,Za=/<\/script>/gi,qa=/<\/style>/gi;function zc(e){let t=/<[a-z][\w-]*/gi,i="",n=0,c;while((c=t.exec(e))!==null){let l=c.index,a=c[0].slice(1).toLowerCase();if(a==="script"||a==="style"){let I=a==="script"?Za:qa;I.lastIndex=l;let B=I.exec(e);if(B!==null)t.lastIndex=B.index+B[0].length;continue}let y=l+c[0].length,v=!1,E=!1,A=-1;while(y<e.length){let I=e[y];if(v){if(I==="'")v=!1}else if(E){if(I==='"')E=!1}else if(I==="'")v=!0;else if(I==='"')E=!0;else if(I===">"){A=y;break}y++}if(A===-1)continue;let M=e.slice(l+c[0].length,A);if(Fi.test(M))continue;if(/(?:^|\s)x-cloak(?:=|\s|\/|>|$)/.test(M))continue;if(!Ha.test(M))continue;let X=e[A-1]==="/",D=X?A-1:A;i+=`${e.slice(n,D)} x-cloak${X?" ":""}`,n=D}return i+=e.slice(n),i}import so from"path";import Es from"fs";import Yt from"path";function Vi(e,t,i,n){let c=0;for(let l=t;l<e.length;l++)if(e[l]===i)c++;else if(e[l]===n&&!(n===">"&&e[l-1]==="=")){if(--c===0)return l}return-1}function Ka(e){let t=r(e),i=0,n=0,c=[];for(let l=0;l<t.length;l++)if("([{".includes(t[l]))i++;else if(")]}".includes(t[l]))i--;else if(t[l]===","&&i===0)c.push(e.slice(n,l).trim()),n=l+1;return c.push(e.slice(n).trim()),c}function vs(e,t){let i=r(e),n=new RegExp(`\\b(?:${t.map((c)=>c.replace(/[$]/g,"\\$&")).join("|")})\\s*(?=[<(])`,"g");for(let c of i.matchAll(n)){let l=c.index+c[0].length,a="";if(i[l]==="<"){let v=Vi(i,l,"<",">");if(v<0)continue;a=e.slice(l+1,v),l=v+1;while(/\s/.test(i[l]||"")&&l<i.length)l++}if(i[l]!=="(")continue;let y=Vi(i,l,"(",")");if(y>=0)return{type:a,args:Ka(e.slice(l+1,y))}}return null}var Ui=`
225
- 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;
226
- type __StxWiden<T> = T extends string ? string : T extends number ? number : T extends boolean ? boolean : T;
227
- 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>;
228
- type __StxRequired<O> = { [K in keyof O]-?: O[K] extends { required: true } ? K : never }[keyof O];
229
- type __StxDefaulted<O> = { [K in keyof O]-?: O[K] extends { default: unknown } ? K : never }[keyof O];
230
- 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]> };
231
- type __StxDefaults<P, K> = Omit<P, Extract<keyof P, K>> & Partial<Pick<P, Extract<keyof P, K>>>;
232
- `;function Hi(e,t){let i=[],n={defineProps:["defineProps"],defineEmits:["defineEmits"],withDefaults:["withDefaults"]},c=r(e),l=e.replace(/\bimport\s+(?:type\s+)?(\{[^}]*\}|\*\s+as\s+[\w$]+|[\w$]+)\s+from\s*(['"])([^'"]+)\2\s*;?/g,(X,D,I,B,L)=>{if(c.slice(L,L+6)!=="import")return X;if(B.endsWith(".stx"))return"";let z=`${t}Import${i.length}`;if(i.push(`import * as ${z} from ${JSON.stringify(B)};`),D.startsWith("*"))return`import ${D.replace(/^\*\s+as\s+/,"")} = ${z};`;if(!D.startsWith("{"))return`import ${D} = ${z}.default;`;return D.slice(1,-1).split(",").map((Q)=>{let[j,ee=j]=Q.trim().replace(/^type\s+/,"").split(/\s+as\s+/);if(!j)return"";if(/^(?:stx|@stacksjs\/stx)(?:\/|$)/.test(B)&&j in n)n[j].push(ee);return`import ${ee} = ${z}.${j};`}).join(`
233
- `)}),a=vs(e,n.defineProps),y=vs(e,n.defineEmits),v=vs(e,n.withDefaults);if(!a&&!y)return{declarations:"",props:null,events:null};let E=[],A=null,M=null;if(a){E.push(`const __options = (${a.args[0]||"{}"}) as const;`),E.push(`const __defaults = (${v?.args[1]||"{}"});`);let X=a.type||"__StxOptions<typeof __options>";E.push(`export type __StxProps = __StxDefaults<${X}, keyof typeof __defaults | __StxDefaulted<typeof __options>>;`),A=`${t}.__StxProps`}if(y)E.push(`const __events = (${y.args[0]||"[]"}) as const;`),E.push(`export type __StxEvents = ${y.type||"Record<(typeof __events)[number], any[]>"};`),M=`${t}.__StxEvents`;return{declarations:`${i.join(`
234
- `)}
235
- namespace ${t} {
236
- ${l}
237
- ${E.join(`
238
- `)}
239
- }`,props:A,events:M}}var Sr=new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","component","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","link","main","map","mark","menu","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","slot","small","source","span","strong","style","sub","summary","sup","svg","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","path","circle","rect","line","polygon","polyline","ellipse","text","tspan","textPath","g","defs","use","symbol","image","clipPath","mask","pattern","marker","linearGradient","radialGradient","stop","filter","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDropShadow","feFlood","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","foreignObject","animate","animateMotion","animateTransform","set","mpath","desc","metadata","switch","view"]);function kr(e){if(e.includes("-")||e==="component")return!1;if(/^[A-Z]/.test(e))return!/[a-z]/.test(e)&&[...Sr].some((t)=>t.toLowerCase()===e.toLowerCase());return Sr.has(e)||/[A-Z]/.test(e)}function*Xa(e){let t=/<([A-Za-z][\w.-]*)(?=[\s/>])/g,i;while(i=t.exec(e)){let n=t.lastIndex,c=[];while(n<e.length){while(/\s/.test(e[n]||""))n++;if(e[n]===">"||e.slice(n,n+2)==="/>"){n+=e[n]===">"?1:2;break}let l=/^[^\s=/>]+/.exec(e.slice(n))?.[0];if(!l){n++;continue}let a=n;n+=l.length;while(/\s/.test(e[n]||""))n++;if(e[n]!=="="){c.push({name:l,value:!0,offset:a,braced:!1});continue}n++;while(/\s/.test(e[n]||""))n++;let y=e[n],v=y==="{",E=y==='"'||y==="'";if(E||v)n++;let A=n;if(v){let M=r(e.slice(n)),X=1,D=0;for(;D<M.length;D++){if(M[D]==="{")X++;if(M[D]==="}"&&--X===0)break}n+=D}else if(E)while(n<e.length&&e[n]!==y)n++;else while(n<e.length&&!/[\s/>]/.test(e[n]))n++;if(c.push({name:l,value:e.slice(A,n),offset:A,braced:v}),E||v)n++}t.lastIndex=n,yield{name:i[1],offset:i.index,attributes:c}}}function Zi(e,t,i){let n=[],c=[Ui,"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,a=new Map,y=new Map,v=i.scriptCode(e,i.filePath),E=r(v);for(let I of v.matchAll(/\bimport\s+(\{[^}]+\}|[\w$]+)\s+from\s*['"]([^'"]+)['"]/g)){if(E.slice(I.index,I.index+6)!=="import")continue;let B=I[2],L=Yt.isAbsolute(B)||B.startsWith(".")?Yt.resolve(Yt.dirname(i.filePath),B):Os(B,Yt.dirname(i.filePath));if(!L)continue;let z=L.endsWith(".stx")?L:Es.existsSync(`${L}.stx`)?`${L}.stx`:void 0,Q=z?null:yr(L,!1),j=I[1].startsWith("{")?I[1].slice(1,-1).split(","):[I[1]];for(let ee of j){let[ne,te=ne]=ee.trim().split(/\s+as\s+/),le=z||Q?.get(ne)||Q?.get(ne.toLowerCase());if(le)y.set(te,le),y.set(te.toLowerCase(),le),y.set(te.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),le)}}for(let I of t.matchAll(/@import\s*\(([^)]+)\)/g))for(let B of I[1].matchAll(/['"]([^'"]+)['"]/g)){let L=Ns(B[1],i.filePath,i).find((z)=>Es.statSync(z,{throwIfNoEntry:!1})?.isFile());if(L)y.set(Yt.basename(B[1]).replace(/\.stx$/,""),L)}let A={__importedComponents:y},M=new Map,X=(I,B,L)=>{let z=e.slice(0,I);return{code:B,offset:I,attribute:L,anchor:!0,kind:"directive",line:z.split(`
240
- `).length,column:I-z.lastIndexOf(`
241
- `)}},D=(I,B,L)=>n.push({expression:I,statement:{text:B+I.code+L,prefixLength:B.length}});for(let I of Xa(t)){if(kr(I.name)||I.name==="component")continue;let B=hr(I.name,i.filePath,i,A);if(!B)continue;let L=M.get(B);if(!L){let Q;try{Q=i.readComponent?i.readComponent(B):Es.readFileSync(B,"utf8")}catch{continue}if(Q===void 0)continue;a.set(B,Q),L=Hi(i.scriptCode(Q,B),`__StxComponent${M.size}`),M.set(B,L),c.push(L.declarations)}let z=[];for(let Q of I.attributes){let{name:j,offset:ee}=Q,ne=Q.value===!0?"true":Q.value;if(j.startsWith("@")||j.startsWith("v-on:")){if(L.events&&Q.value!==!0)l.set(ee,`__StxEvent<${L.events}, ${JSON.stringify(j.replace(/^@|^v-on:/,"").split(".")[0])}>`);continue}let te=/^v-model(?::([\w-]+))?(?:\.[\w-]+)*$/.exec(j);if(j.startsWith("v-")&&!j.startsWith("v-bind:")&&!te)continue;if(/^(?:x-|:)(?:if|for|show|key|else)(?:$|[.:-])/.test(j))continue;let le=(te?te[1]||"modelValue":j.replace(/^:|^v-bind:/,"")).replace(/-([a-z])/g,(Ae,We)=>We.toUpperCase());if(z.push(le),!L.props)continue;let he=j.startsWith(":")||j.startsWith("v-bind:")||!!te||Q.braced,ue=he?ne:Q.value!==!0?JSON.stringify(ne):"true",Ce=!he&&Q.value!==!0&&(ne==="true"||ne==="false");D(X(ee,ue,j),";void ((",`) satisfies ${Ce?"__StxStaticProp":"__StxProp"}<${L.props}, ${JSON.stringify(le)}>);`)}if(L.props){let Q=[...new Set(z)].map((ee)=>`${JSON.stringify(ee)}: undefined as any`).join(", "),j=X(I.offset,`<${I.name}>`);n.push({expression:j,statement:{text:`;void ({ ${Q} } satisfies ${L.props} & Record<string, unknown>);`,prefixLength:0}})}}return{declarations:M.size?c.join(`
242
- `):"",checks:n,events:l,dependencies:a}}var qi=/<script(\s[^>]*)?>([\s\S]*?)<\/script>/gi;function Ja(e){let t=(i)=>i.replace(/[^\n]/g," ");return e.replace(/<!--[\s\S]*?-->/g,t).replace(/\{\{--[\s\S]*?--\}\}/g,t)}function Pt(e){let t=[],i=Ja(e);qi.lastIndex=0;let n;while((n=qi.exec(i))!==null){let c=(n[1]||"").trim(),l=(n[0].match(/^<script(?:\s[^>]*)?>/i)?.[0]??"<script>").length,a=(n[0].match(/<\/script\s*>$/i)?.[0]??"</script>").length,y=n.index+l,v=n.index+n[0].length-a,E=e.slice(y,v);if(/\bsrc\s*=/.test(c))continue;let A=c.match(/\btype\s*=\s*["']([^"']+)["']/i);if(A&&!/^(?:module|text\/(?:javascript|typescript))$/i.test(A[1]))continue;let M=/\bserver\b/.test(c)?"server":/\bclient\b/.test(c)?"client":"plain",X=Qt(e,y);t.push({kind:M,code:E,startLine:X,startColumn:en(e,y),offset:y,attrs:c})}return t}function Qt(e,t){let i=1;for(let n=0;n<t&&n<e.length;n++)if(e.charCodeAt(n)===10)i++;return i}function en(e,t){let i=e.lastIndexOf(`
243
- `,t-1)+1;return t-i+1}function Fn(e){let t=e.split(""),i=(c,l)=>{for(let a=c;a<l&&a<t.length;a++)if(t[a]!==`
244
- `)t[a]=" "},n=[/<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 c of n){c.lastIndex=0;let l;while((l=c.exec(e))!==null)i(l.index,l.index+l[0].length)}return t.join("")}function ro(e){let t=0,i="";for(let n=0;n<e.length;n++){let c=e[n];if(i){if(c==="\\"){n++;continue}if(c===i)i="";continue}if(c==='"'||c==="'"||c==="`"){i=c;continue}if(c==="("||c==="["||c==="{"){t++;continue}if(c===")"||c==="]"||c==="}"){t--;continue}if(c==="|"&&t===0){if(e[n+1]==="|"){n++;continue}if(e[n-1]==="|")continue;return e.slice(0,n)}}return e}var io=new Set([":for","x-for","v-for"]),Vn=/(?:^|\s)((?::|x-|v-|@)[\w.:-]+)\s*=\s*(["'])([\s\S]*?)\2/g,ks="__stx_interpolated",Ki="__StxElement",oo="__StxTemplateValue",Ga=`type ${oo}<T> = T extends { readonly _isSignal: true } | { readonly _isDerived: true } ? (T extends () => infer V ? T & V : T) : T`;function Xi(e){return e.replace(/\{\{[\s\S]*?\}\}/g,ks).replace(/\{!![\s\S]*?!!\}/g,ks)}function Ya(e,t,i){let n=0;for(let c=t;c<e.length;c++){let l=e[c];if(l==="{"){n++;continue}if(l!=="}"&&l!=="!")continue;if(e.startsWith(i,c)&&n===0)return c;if(l==="}"&&n>0)n--}return-1}function ci(e,t,i="0"){let n=`__stxScript${i}`;while((e+t).includes(n))n+="_";let c=new Map,l=[],a=[],y=r(e),v=fo(e),E=[],A=0;for(let L=0;L<y.length;L++){let z=y.startsWith("{{",L);if(!z&&!y.startsWith("{!!",L))continue;let Q=z?2:3,j=z?"}}":"!!}",ee=Ya(y,L+Q,j);if(ee<0)continue;let ne=L,te=e.slice(ne,ee+j.length),le=te.slice(Q,-j.length);L=ee+j.length-1;let he=a.length,ue=Rs(v,ne),Ce=Rs(v,ne+(z?2:3));a.push({code:ro(le),...Ce});let Ae=`${n}_${he}`,We=te.split(`
245
- `),Ke=We[0].length;We[0]=Ae+" ".repeat(Math.max(0,Ke-Ae.length));for(let Je=1;Je<We.length;Je++)We[Je]=We[Je].replace(/[^\r]/g," ");let Ge=c.get(ue.line)??[],Xe=Ge.at(-1),et=ue.column+(Xe?Xe.generatedEnd-Xe.sourceEnd:0);Ge.push({sourceStart:ue.column,sourceEnd:ue.column+Ke,generatedStart:et,generatedEnd:et+We[0].length}),c.set(ue.line,Ge),E.push(e.slice(A,ne),We.join(`
246
- `)),A=ne+te.length}E.push(e.slice(A));let M=E.join("");if(!a.length)return{code:M,columns:c,declarations:l};let{imports:X,body:D}=ao(t),I=[],B=0;for(let L of X.split(/\n(?=import\b)/)){if(!L.trim())continue;let z=/^import\s+(?:type\s+)?([\s\S]+?)\s+from\s*(['"][^'"]+['"])/.exec(L);if(!z){l.push({text:L});continue}let Q=`${n}Module${B++}`;l.push({text:`import * as ${Q} from ${z[2]}`});let j=z[1],ee=/\{([\s\S]*?)\}/.exec(j);for(let he of ee?.[1].split(",")??[]){let[ue,Ce=ue]=he.trim().replace(/^type\s+/,"").split(/\s+as\s+/);if(ue==="default")I.push(`const ${Ce} = ${Q}.default; type ${Ce} = import(${z[2]}).default`);else if(ue)I.push(`import ${Ce} = ${Q}.${ue}`)}let ne=j.replace(/\{[\s\S]*?\}/,""),te=/\*\s+as\s+(\w+)/.exec(ne);if(te)I.push(`import ${te[1]} = ${Q}`);let le=/^\s*([\w$]+)/.exec(ne)?.[1];if(le)I.push(`const ${le} = ${Q}.default; type ${le} = import(${z[2]}).default`)}l.push({text:`namespace ${n}Scope {
247
- ${I.join(`
248
- `)}
249
- export async function read() {
250
- ${Ls(D).replace(/^[ \t]*export[ \t]+(?=(?:const|let|var|function|async|class|interface|type)\b)/gm,"")}
251
- return {`});for(let[L,z]of a.entries())l.push({text:`value${L}: (`}),l.push({text:z.code,origin:{line:z.line,column:z.column}}),l.push({text:"),"});l.push({text:`}
252
- }
253
- }`});for(let L=0;L<a.length;L++)l.push({text:`declare var ${n}_${L}: Awaited<ReturnType<typeof ${n}Scope.read>>['value${L}']`});return{code:M,columns:c,declarations:l}}function Ji(e,t){let i=0;for(let n of e){if(t<n.generatedStart)break;if(t<n.generatedEnd)return n.sourceStart+Math.min(t-n.generatedStart,n.sourceEnd-n.sourceStart);i=n.sourceEnd-n.generatedEnd}return t+i}var Qa=["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"],el=new RegExp(String.raw`^[ \t]*@(?:${Qa.join("|")})\b[ \t]*(\([^\n)]*\))?[ \t]*$`,"gm");function Ls(e){return e.replace(el,(t)=>t.replace(/[^\n]/g," "))}var Gi=new Set(["x-cloak","x-ref","x-transition","x-teleport","v-slot","x-hydrate",":key","x-tooltip","x-tooltip-position"]);function Jf(e){let t=Fn(e),i=[],n=/(@?)\{\{([\s\S]*?)\}\}|(@?)\{!!([\s\S]*?)!!\}/g,c;while((c=n.exec(t))!==null){if(c[1]||c[3])continue;let y=c[2]??c[4]??"",v=c[2]!==void 0?2:3,E=ro(y);if(!E.trim())continue;let A=c.index+v+(E.length-E.trimStart().length);i.push({code:E.trim(),line:Qt(t,A),column:en(t,A),offset:A,kind:"interpolation"})}let l=/@(if|elseif|else\s+if|unless)\b\s*\(/g;while((c=l.exec(t))!==null){let a=c.index+c[0].length-1,y=0,v=a;for(;v<t.length;v++){let X=t[v];if(X==="(")y++;else if(X===")"){if(y--,y===0)break}}if(y!==0)continue;let E=t.slice(a+1,v),A=E.trim();if(l.lastIndex=v+1,!A)continue;let M=a+1+(E.length-E.trimStart().length);i.push({code:A,line:Qt(t,M),column:en(t,M),offset:c.index,kind:"condition"})}Vn.lastIndex=0;while((c=Vn.exec(t))!==null){let a=c[1],y=c[3]??"",v=a.replace(/\..*$/,"").replace(/^([^:].*?):.*$/,"$1");if(Gi.has(v)||Gi.has(a))continue;if(!y.trim())continue;let E=c.index+c[0].indexOf(c[2],c[0].indexOf(a)+a.length)+1;if(io.has(v)){let M=y.match(/\s+(?:in|of)\s+/);if(!M||M.index===void 0)continue;let X=y.slice(M.index+M[0].length),D=M.index+M[0].length+(X.length-X.trimStart().length);i.push({code:Xi(X.trim()),line:Qt(t,E+D),column:en(t,E+D),offset:E+D,kind:"directive",attribute:v});continue}let A=y.length-y.trimStart().length;i.push({code:Xi(y.trim()),line:Qt(t,E+A),column:en(t,E+A),offset:E+A,kind:"directive",attribute:v})}return i.sort((a,y)=>a.line-y.line||a.column-y.column),i}var tl=2000;function nl(e,t){let i=0,n=Math.min(e.length,t+tl);for(let c=t;c<n;c++){let l=e[c];if(l==="(")i++;else if(l===")"){if(i--,i===0)return e.slice(t+1,c)}}return null}function sl(e){let t=new Map,i=(y,v)=>{let E=y.split(/[,[\]{}()\s]+/).filter(Boolean);for(let A of E){let M=A.replace(/^\.\.\./,"").trim();if(!/^\$?[A-Z_$][\w$]*$/i.test(M))continue;let X=E.length===1?v:void 0,D=t.get(M);if(!D)t.set(M,{name:M,iterable:X});else if(D.iterable!==X)D.iterable=void 0}},n=/^\$?[A-Z_$][\w$]*$/i,c=(y)=>{let v=y.trim();return n.test(v)?v:void 0};for(let y of e.matchAll(/@for(?:each|else)\s*\(/g)){let v=nl(e,y.index+y[0].length-1);if(v===null)continue;let E=At(v);if(!E)continue;i(E.itemVar.replace(/=>/g," "),c(E.arrayExpr))}for(let y of e.matchAll(/@for\s*\(\s*(?:(?:let|const|var)\s+)?([\w$]+|\[[^\]]*\]|\{[^}]*\})\s+(of|in)\s+([^)]*)/g))i(y[1],y[2]==="of"?c(y[3]):void 0);for(let y of e.matchAll(/@for\s*\(\s*(?:let|const|var)\s+([\w$]+)\s*[=;]/g))i(y[1]);let l=Fn(e);Vn.lastIndex=0;let a;while((a=Vn.exec(l))!==null){let y=a[1].replace(/\..*$/,"");if(!io.has(y))continue;let v=a[3].match(/\s+(?:in|of)\s+/);if(!v||v.index===void 0)continue;i(a[3].slice(0,v.index),c(a[3].slice(v.index+v[0].length)))}for(let y of e.matchAll(/@(?:php|js|ts)\b([\s\S]*?)@end(?:php|js|ts)\b/g))for(let v of y[1].matchAll(/\b(?:const|let|var|function|class)\s+([\w$]+)/g))i(v[1]);return[...t.values()].sort((y,v)=>y.name.localeCompare(v.name))}function Me(e){let t=new Set;for(let i of e.matchAll(/^\s*(?:export\s+)?(?:const|let|var)\s+([\w$]+)/gm))t.add(i[1]);for(let i of e.matchAll(/^\s*(?:export\s+)?(?:async\s+)?function\s*\*?\s*([\w$]+)/gm))t.add(i[1]);for(let i of e.matchAll(/^\s*(?:export\s+)?class\s+([\w$]+)/gm))t.add(i[1]);for(let i of e.matchAll(/^\s*(?:export\s+)?(?:const|let|var)\s*[[{]([^\]}]*)[\]}]/gm))for(let n of i[1].split(",")){let c=n.split(":").pop().split("=")[0].replace(/^\.\.\./,"").trim();if(/^[A-Z_$][\w$]*$/i.test(c))t.add(c)}return[...t].sort()}var Cs=["params","query","cookies","host","ip","setResponseStatus","setResponseHeader","notFound","request","url","definePageMeta","defineClientPayload","defineStore","props","$props"],rl={$bool:"declare function $bool(value: unknown, fallback?: boolean): boolean",$num:"declare function $num(value: unknown, fallback?: number): number",$uid:"declare var $uid: string",$native:"declare var $native: boolean"};function Pc(e=new Set){return[...Cs.filter((t)=>!e.has(t)).map((t)=>`declare var ${t}: any`),...Object.entries(rl).filter(([t])=>!e.has(t)).map(([,t])=>t)].join(`
254
- `)}function Ic(e){return new Set([...e.matchAll(/^declare (?:function|const|let|var)\s+([A-Za-z_$][\w$]*)/gm)].map((t)=>t[1]))}function co(e){let t=/\bdefineClientPayload\s*\(\s*\{([\s\S]*?)\}\s*\)/g,i,n=!1,c=new Set,l=r(e);while((i=t.exec(l))!==null){n=!0;for(let a of il(i[1])){let y=a.split(":")[0].trim();if(/^[A-Za-z_$][\w$]*$/.test(y))c.add(y)}}return n?[...c]:null}function il(e){let t=[],i=0,n="";for(let c of e){if(c===","&&i===0){t.push(n),n="";continue}if(c==="("||c==="["||c==="{")i++;else if(c===")"||c==="]"||c==="}")i--;n+=c}return t.push(n),t.filter((c)=>c.trim().length>0)}function ao(e){let t=/^[ \t]*import\b[\s\S]*?(?:from\s*['"][^'"]*['"]|['"][^'"]*['"])[ \t]*;?[ \t]*$/gm,i=[],n=e.replace(t,(c)=>(i.push(c.trim()),c.split(`
255
- `).map(()=>"").join(`
256
- `)));return{imports:i.join(`
257
- `),body:n}}function lo(e){let t=r(e),i=Array(t.length),n=0;for(let y=0;y<t.length;y++){let v=t[y];if(v==="}"||v===")"||v==="]")n=Math.max(0,n-1);if(i[y]=n,v==="{"||v==="("||v==="[")n++}let c=[],l=/^[ \t]*(?:export[ \t]+)?(interface|type)[ \t]+([A-Za-z_$][\w$]*)/gm,a;while((a=l.exec(t))!==null){if(i[a.index]!==0)continue;let y=a[1],v=a[2],E;if(y==="interface"){let A=t.indexOf("{",a.index);if(A===-1)continue;let M=0;E=-1;for(let X=A;X<t.length;X++)if(t[X]==="{")M++;else if(t[X]==="}"&&--M===0){E=X+1;break}if(E===-1)continue}else{let A=0;E=t.length;for(let M=t.indexOf("=",a.index)+1;M<t.length;M++){let X=t[M];if(X==="{"||X==="["||X==="("||X==="<")A++;else if(X==="}"||X==="]"||X===")"||X===">")A--;else if(A<=0&&(X===";"||X===`
258
- `&&!/[=|&,<([{]\s*$/.test(t.slice(Math.max(0,M-40),M)))){E=X===";"?M+1:M;break}}}c.push({name:v,text:e.slice(a.index,E).replace(/^[ \t]*export[ \t]+/,"")}),l.lastIndex=E}return c}function ol(e){return new Set(lo(e).map((t)=>t.name))}function Oc(e,t=""){let i=co(e),n=ol(t),c=lo(e).filter((E)=>!n.has(E.name)).map((E)=>E.text);if(!i){let E=Me(e).filter((A)=>!Rt(t,A));if(E.length===0&&c.length===0)return"";return["",`// ${cl}`,...c,...E.map((A)=>`declare var ${A}: any`)].join(`
259
- `)}if(i.length===0)return c.length>0?["",`// ${Yi}`,...c].join(`
260
- `):"";let{imports:l,body:a}=ao(e),y=a.replace(/^[ \t]*export[ \t]+(?=(?:const|let|var|function|async|class)\b)/gm,""),v=["",`// ${Yi}`];if(l)v.push(l);return v.push(...c),v.push(`async function ${Qi}() {`,y,` return { ${i.join(", ")} }`,"}",`type ${eo} = Awaited<ReturnType<typeof ${Qi}>>`,...i.map((E)=>`declare var ${E}: ${eo}[${JSON.stringify(E)}]`)),v.join(`
261
- `)}function li(e){let i=r(e).split(""),n=0;for(let c=0;c<i.length;c++){let l=i[c];if(l==="{"||l==="("||l==="["){n++;continue}if(l==="}"||l===")"||l==="]"){n=Math.max(0,n-1);continue}if(n>0&&l!==`
262
- `)i[c]=" "}return Me(i.join(""))}function Nc(e,t){if(co(e)!==null)return[];let i=li(e),n=Ie(t,new Set(i)),c=new Set(k);return i.filter((l)=>{if(c.has(l))return!1;if(Rt(t,l))return!1;return n.has(l)})}var Yi="stx: types for the declared client payload (#1868)",cl="stx: untyped bridge names \u2014 declare a defineClientPayload to check these (#1868)",Qi="__stxServerScope",eo="__StxClientPayload";var to=["$env","$user","$slot","$slots","$attrs","$props","$page","$route","$loop","loop","$errors","$csrf","$native","props","slot"];var al=/^\s*[A-Z_$][\w$]*\s*=[^=]/i;function fl(e){let t=new Map,i=/!|===|!==|==|!=|&&|\|\||<|>|\btypeof\b|\binstanceof\b|\bin\b/;for(let n of e){let c=r(n),{depths:l,balanced:a}=ge(c);if(!a)continue;let y=/^([ \t]*(?:export[ \t]+)?const[ \t]+)([A-Za-z_$][\w$]*)[ \t]*(?::[^=\n]+)?=[ \t]*([^\n]+)$/gm;for(let v of c.matchAll(y)){let E=v.index??0;if(l[E+v[1].length]!==0)continue;let A=v[2],M=E+v[0].length-v[3].length,X=n.slice(M,E+v[0].length).trim().replace(/;$/,"").trim(),D=v[3],I=i.test(D)&&!/\bawait\b|=>|\bfunction\b|[{}]/.test(D)&&!/[,+\-*/%&|?:=]$/.test(X)&&ge(D).balanced;t.set(A,t.has(A)||!I?null:X)}}return new Map([...t].filter((n)=>n[1]!==null))}function uo(e,t,i=0,n=new Set){if(t.size===0||i>=5)return e;let c=r(e),l="",a=0;for(let y of c.matchAll(/[A-Za-z_$][\w$]*/g)){let v=y.index??0,E=y[0],A=t.get(E);if(!A||n.has(E))continue;let M=c.slice(0,v).trimEnd(),X=c.slice(v+E.length).trimStart();if(M.endsWith(".")||/^:(?!:)/.test(X)&&/[{,]$/.test(M))continue;if(v>0&&/[\w$]/.test(c[v-1]))continue;l+=`${e.slice(a,v)}(${uo(A,t,i+1,new Set([...n,E]))})`,a=v+E.length}return l+e.slice(a)}function pl(e,t){let i=/@(if|unless|elseif|else|endif|endunless)\b\s*(\()?/g,n=[],c;while((c=i.exec(e))!==null){if(c.index>t)break;let l=c[1];if(c.index===t){if(l==="elseif"){let y=n[n.length-1];if(y?.current)y.seen.push(y.current);if(y)y.current=null}break}if(l==="endif"||l==="endunless"){n.pop();continue}let a="";if(c[2]==="("){let y=0,v=c.index+c[0].length-1,E=v+1;for(;v<e.length;v++){let A=e[v];if(A==="(")y++;else if(A===")"){if(y--,y===0)break}}a=e.slice(E,v).trim(),i.lastIndex=v+1}if(l==="if")n.push({seen:[],current:a});else if(l==="unless")n.push({seen:[],current:`!(${a})`});else if(l==="elseif"||l==="else"){let y=n[n.length-1];if(!y)continue;if(y.current)y.seen.push(y.current);y.current=l==="elseif"?a:null}}return n.flatMap((l)=>[...l.seen.map((a)=>`!(${a})`),...l.current?[l.current]:[]]).filter(Boolean)}function dl(e){let t=e.code.trim();if(!t)return null;if(e.attribute?.startsWith("@")){if(al.test(t))return null;let n=";(($event: any): void => { ";return{text:`${n}${t} });`,prefixLength:n.length}}let i=";void ((";return{text:`${i}${t}));`,prefixLength:i.length}}var gl=/(\bfrom\s*|\bimport\s*\(\s*|\bimport\s+)(['"])(\.{1,2}\/[^'"\n]*)\2/g;function no(e,t){return js(e,t).code}function js(e,t){let i=new Map;if(!t)return{code:e,columns:i};let n=fo(e),c=[],l=0;for(let a of e.matchAll(gl)){let y=a.index,[v,E,A,M]=a,X=so.resolve(t,M).replace(/\\/g,"/"),D=`${E}${A}${X}${A}`;if(c.push(e.slice(l,y),D),l=y+v.length,v.includes(`
263
- `))continue;let I=Rs(n,y),B=i.get(I.line)??[],L=B.at(-1),z=I.column+(L?L.generatedEnd-L.sourceEnd:0);B.push({sourceStart:I.column,sourceEnd:I.column+v.length,generatedStart:z,generatedEnd:z+D.length}),i.set(I.line,B)}return c.push(e.slice(l)),{code:c.join(""),columns:i}}function ml(e,t,i){let n=Ji(e.importColumns?.get(t)??[],i);return Ji(e.scriptColumns?.get(t)??[],n)}function ui(e){return" ".repeat(Math.max(0,(e.startColumn??1)-1))}function hl(e){let t=new Set,i=r(e);for(let n of i.matchAll(/\bimport\s+(?:type\s+)?([\w$*{}\s,]+?)\s+from\b/g)){let c=n[1],l=/\{([^}]*)\}/.exec(c);for(let E of l?.[1].split(",")??[]){let A=E.trim().replace(/^type\s+/,"").split(/\s+as\s+/).pop()?.trim();if(A&&/^[A-Z_$][\w$]*$/i.test(A))t.add(A)}let a=c.replace(/\{[^}]*\}/,""),y=/\*\s*as\s+([A-Z_$][\w$]*)/i.exec(a);if(y)t.add(y[1]);let v=/^\s*([A-Z_$][\w$]*)/i.exec(a);if(v&&v[1]!=="type")t.add(v[1])}return[...t].sort()}function Mc(e,t={}){let i=Pt(e),n=e.split(`
264
- `),c=Array.from({length:n.length},()=>""),l=new Map,a=new Map,y=new Map,v=[],E=i.filter((B)=>B.kind==="server").map((B)=>B.code).join(`
265
- `),A=t.filePath&&t.templateExpressions!==!1?Zi(e,Fn(e),{filePath:t.filePath,componentsDir:t.componentsDir,projectRoot:t.projectRoot,readComponent:t.readComponent,scriptCode:(B,L)=>Pt(B).map((z)=>no(z.code,so.dirname(L))).join(`
266
- `)}):void 0,M=new Set,X=[];for(let[B,L]of i.entries()){let z=ci(ui(L)+L.code,E,String(B));for(let[ne,te]of z.columns)a.set(L.startLine+ne-1,te);for(let ne of z.declarations)v.push({text:no(ne.text,t.originDir??""),origin:ne.origin?{...ne.origin,line:ne.origin.line+L.startLine-1}:void 0});let Q=Ls(z.code),j=js(Q,t.originDir??"");for(let[ne,te]of j.columns)y.set(L.startLine+ne-1,te);let ee=j.code.split(`
267
- `);ee.forEach((ne,te)=>{let le=L.startLine-1+te;if(le<c.length)c[le]=ne,M.add(le)}),X.push(L.startLine-1+ee.length-1)}for(let B of X){let L=c[B]?.trim()===""?B:B+1;if(L<c.length&&c[L].trim()===""&&(L===B||!M.has(L)))c[L]=";"}let D=(B,L)=>{for(let[z,Q]of B.split(`
268
- `).entries())if(c.push(Q),L)l.set(c.length,z===0?L:{...L,line:L.line+z,column:1,prefixLength:0})};for(let B of v)D(B.text,B.origin);if(t.globals!==!1){D("");let B=new Set([...i.flatMap((j)=>Me(j.code)),...i.flatMap((j)=>hl(j.code))]),L=(j)=>{if(!B.has(j))D(`declare var ${j}: any`)};if(t.runtimeGlobals!==!1){if(!B.has("window"))D("declare var window: any");for(let j of k)L(j)}let z=[...new Set([...Cs,...xe,...to])].filter((j)=>t.runtimeGlobals!==!1||!k.includes(j));if(t.contextScope==="global"){D("declare global {");for(let j of z)D(` var ${j}: any`);D("}")}else{for(let j of Cs)L(j);for(let j of xe)L(j);for(let j of to)L(j)}D(`declare var ${ks}: any`);let Q=new Set(i.flatMap((j)=>Me(j.code)));D(`type ${Ki}<T> = T extends readonly (infer E)[] ? E : T extends Iterable<infer E2> ? E2 : any`);for(let j of sl(e)){if(Q.has(j.name))continue;let ee=j.iterable&&Q.has(j.iterable)?`${Ki}<typeof ${j.iterable}>`:"any";D(`declare var ${j.name}: ${ee}`)}}if(t.templateExpressions!==!1){if(A?.declarations)for(let L of A.declarations.split(`
269
- `))D(L);let B=Jf(e).map((L)=>{let z=A?.events.get(L.offset??-1);if(z){L.anchor=!0;let Q=L.code.trim(),j=/^([\w$]+)\s*=\s*([^=][\s\S]*)$/.exec(Q),ee=j?`void ((${j[2]}) satisfies __StxAssignedValue<typeof ${j[1]}>)`:/^[\w$]+(?:\.[\w$]+)*$/.test(Q)?`${Q} satisfies (($event: ${z}) => unknown)`:Q,ne=`;(($event: ${z}): void => { `;return{expression:L,statement:{text:`${ne}${ee} });`,prefixLength:ne.length}}}return{expression:L,statement:dl(L)}}).filter((L)=>L.statement!==null);if(B.push(...A?.checks||[]),B.length>0){let L=Fn(e),z=zn(L),Q=fl(i.map((te)=>te.code)),ee=[...new Set(i.flatMap((te)=>Me(te.code)))].filter((te)=>/^[A-Z_$][\w$]*$/i.test(te)),ne=0;if(ee.length>0){D(Ga);for(let te of ee)D(`function __StxRead_${te}() { return ${te} }`),D(`type __StxT_${te} = ${oo}<ReturnType<typeof __StxRead_${te}>>`);D(`;((${ee.map((te)=>`${te}: __StxT_${te}`).join(", ")}) => {`),ne=1}for(let{expression:te,statement:le}of B){let he=" ".repeat(ne),ue=te.offset===void 0?[]:z.filter((Xe)=>te.offset>=Xe.start&&te.offset<Xe.end),Ce=ue.map((Xe)=>`;((${Xe.binding.replace(/[\r\n]/g," ")}: any) => { `).join(""),Ae=" });".repeat(ue.length),We=te.offset===void 0?[]:pl(L,te.offset),Ke=We.length>0?`${We.map((Xe)=>`if (${uo(Xe,Q)}) `).join("")}{ `:"",Ge=We.length>0?" }":"";D(he+Ce+Ke+le.text+Ge+Ae,{line:te.line,column:te.column,expression:te,prefixLength:le.prefixLength+he.length+Ce.length+Ke.length,guardPrefixLength:he.length+Ce.length+Ke.length})}if(ne>0)D("});")}}let I=!1;if(t.reference&&c[0]!==void 0&&c[0].trim()==="")c[0]=`/// <reference path=${JSON.stringify(t.reference.replace(/\\/g,"/"))} />`,I=!0;return D("export {}"),{text:c.join(`
270
- `),lineMap:l,sourceLineCount:n.length,componentDependencies:A?.dependencies,referenced:I,scriptColumns:a,importColumns:y}}function fo(e){let t=[0];for(let i=0;i<e.length;i++)if(e.charCodeAt(i)===10)t.push(i+1);return t}function Rs(e,t){let i=0,n=e.length-1;while(i<n){let c=Math.ceil((i+n)/2);if(e[c]<=t)i=c;else n=c-1}return{line:i+1,column:t-e[i]+1}}function Dc(e,t){if(!e.expression)return!1;return e.inGuard===!0||t===2774}function di(e,t,i){let n=e.lineMap.get(t);if(!n)return t<=e.sourceLineCount?{line:t,column:ml(e,t,i)}:null;let c=n.expression?.anchor?0:Math.max(0,i-1-(n.prefixLength??0));return{line:n.line,column:n.column+c,expression:n.expression,inGuard:i<=(n.guardPrefixLength??0)}}var As=b(256),xl=[{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"}],po=/(?:\/\/|\/\*|\{\{--)\s*stx-strict-ignore(-next-line)?([^\n*}]*)/g;function bl(e){let t=Array.from(e,(c)=>c===`
271
- `?`
272
- `:" "),i=0,n="";while(i<e.length){let c=e[i],l=e[i+1];if(n){if(c==="\\"){i+=2;continue}if(c===n)n="";i++;continue}if(c==='"'||c==="'"||c==="`"){n=c,i++;continue}if(c==="/"&&l==="/"){while(i<e.length&&e[i]!==`
273
- `)t[i]=e[i],i++;continue}if(c==="/"&&l==="*"){let a=e.indexOf("*/",i+2),y=a===-1?e.length:a+2;for(;i<y;i++)t[i]=e[i];continue}if(c==="{"&&l==="{"&&e.slice(i,i+4)==="{{--"){let a=e.indexOf("--}}",i+4),y=a===-1?e.length:a+4;for(;i<y;i++)t[i]=e[i];continue}i++}return t.join("")}function yl(e){let t=new Map,i=bl(e).split(`
274
- `),n=e.split(`
275
- `);return i.forEach((c,l)=>{po.lastIndex=0;for(let a of c.matchAll(po)){let y=a[1]==="-next-line",v=(n[l]??"").slice(0,a.index).trim(),E=y||v===""?l+2:l+1,M=(a[2]??"").split("--")[0].split(/[\s,]+/).filter(Boolean),X=M.filter((I)=>/\w/.test(I));if(M.length>0&&X.length===0)continue;let D=t.get(E);if(D&&D.size===0)continue;if(X.length===0){t.set(E,new Set);continue}if(D)X.forEach((I)=>D.add(I));else t.set(E,new Set(X))}}),t}function _l(e,t,i){let n=e.get(t);if(!n)return!1;if(n.size===0)return!0;return[...n].some((c)=>i.includes(c))}function Oe(e,t,i,n){let c=typeof i==="boolean"?{enabled:i,failOnViolation:i}:i??{enabled:!1};if(!c.enabled)return;let l=x(e,t,n,JSON.stringify(c)),a=As.get(l);if(a!==void 0){if(a&&c.failOnViolation)throw new q(a,n??t);return}let y=c.allowPatterns??[],v=yl(e),E=[],A=r(e.replace(/\{\{--[\s\S]*?--\}\}/g,(I)=>I.replace(/[^\n]/g," ")));for(let{pattern:I,message:B,suggestion:L}of xl){if(y.some((Q)=>/\w/.test(Q)&&B.includes(Q)))continue;I.lastIndex=0;let z=A.match(I);if(z&&z.length>0){let Q=A.split(`
276
- `),j=e.split(`
277
- `),ee=[];if(Q.forEach((he,ue)=>{if(I.lastIndex=0,I.test(he)&&!_l(v,ue+1,B))ee.push(ue+1)}),ee.length===0&&Q.some((he)=>(I.lastIndex=0,I.test(he))))continue;let ne=ee.length>0?` (script line${ee.length>1?"s":""} ${ee.join(", ")})`:"",te=ee.slice(0,3).map((he)=>` ${he} | ${(j[he-1]??"").trim().slice(0,100)}`).join(`
278
- `),le=te?`
279
- ${te}`:"";E.push(` \u2717 ${B}${ne}
280
- \u2192 ${L}${le}`)}}if(E.length===0){As.set(l,"");return}let M=(I)=>{let B=`${process.cwd()}/`;return I.startsWith(B)?I.slice(B.length):I},D=`[STX] DOM API violation in ${n&&n!==t?`${M(n)} (composed into ${M(t)})`:M(t)}:
281
- ${E.join(`
282
- `)}
283
- Tip: prefer useRef(), navigate(), and composables for component code`;if(As.set(l,D),console.warn(D),c.failOnViolation)throw new q(D,n??t)}var wl=[{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"}],Sl=[{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')"}],$l=[{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 ig(e){let t=[],i=[];return vl(e,t),El(e,t,i),kl(e,i),Cl(e,t),{valid:t.length===0,errors:t,warnings:i}}function vl(e,t){let i=(e.match(/\{\{/g)||[]).length,n=(e.match(/\}\}/g)||[]).length;if(i!==n)t.push({type:"expression",message:`Unclosed expression brackets: found ${i} opening '{{' and ${n} closing '}}'`,suggestion:"Ensure every {{ has a matching }}"})}function El(e,t,i){for(let n of wl){let c=new RegExp(`${n.open}(?:\\s|\\()`,"g"),l=new RegExp(n.close,"g"),a=(e.match(c)||[]).length,y=(e.match(l)||[]).length;if(n.altClose){let v=new RegExp(n.altClose,"g");y+=(e.match(v)||[]).length}if(a>y)t.push({type:"directive",message:`Unclosed @${n.name} directive: found ${a} opening and ${y} closing`,suggestion:`Add ${a-y} missing ${n.close} tag(s)`});else if(y>a)i.push({type:"directive",message:`Extra ${n.close} found: ${y-a} more closing than opening`,suggestion:`Check for orphaned ${n.close} tags`})}}function kl(e,t){for(let i of Sl)if(i.pattern.test(e))t.push({type:"syntax",message:i.message,suggestion:i.suggestion})}function Cl(e,t){for(let i of $l)if(i.pattern.test(e))t.push({type:"expression",message:`Security warning: ${i.message}`,suggestion:"Remove dangerous code from template expressions"})}function ag(e,t){let i=e.slice(0,t).split(`
284
- `);return{line:i.length,column:i[i.length-1].length+1}}function cg(e,t,i){let n=[];switch(e){case"if":case"elseif":case"unless":if(i.length===0)n.push({type:"syntax",message:`@${e} requires a condition`,suggestion:`Use @${e}(condition)`});break;case"foreach":if(i.length===0||!i[0].includes(" as "))n.push({type:"syntax",message:'@foreach requires "items as item" syntax',suggestion:"Use @foreach(items as item) or @foreach(items as key => value)"});break;case"for":if(i.length===0)n.push({type:"syntax",message:"@for requires loop parameters",suggestion:"Use @for(let i = 0; i < 10; i++)"});break;case"switch":if(i.length===0)n.push({type:"syntax",message:"@switch requires an expression",suggestion:"Use @switch(expression)"});break;case"case":if(i.length===0)n.push({type:"syntax",message:"@case requires a value",suggestion:"Use @case(value)"});break;case"include":case"extends":case"component":if(i.length===0)n.push({type:"syntax",message:`@${e} requires a path`,suggestion:`Use @${e}('path/to/template')`});break}return n}function lg(e){return/@[a-z]+/i.test(e)||/\{\{/.test(e)}function ug(e){let t=e.matchAll(/@([a-z]+)/gi),i=new Set;for(let n of t){let c=n[1].toLowerCase();if(!c.startsWith("end"))i.add(c)}return Array.from(i)}function go(e,t,i){let n=/^<script\b([^>]*)>/i.exec(e);if(!n||!/(?:^|\s)src\s*=/i.test(n[1]??""))return null;return _(n[0],t,i)+e.slice(n[0].length)}var tn=new R(500),Ks=new Map;function mo(e){try{let t=qn.statSync(e);return`${t.size}:${t.mtimeMs}`}catch{return""}}var Hn=new R(1000),Xs=new R(2000),Gs=new R(500),vo=33554432,Qs=vo;function Rl(e){let t=e.componentRenderCacheBytes;if(typeof t!=="number"||t<0||t===Qs)return;Qs=t,Zn.setMaxBytes(t)}var Zn=new R(2000,{maxBytes:vo,sizeOf:(e)=>e.output.length});function Al(e){let t=new WeakSet;try{let i=(n)=>{if(n===void 0)return{__stxType:"undefined"};if(typeof n==="bigint")return{__stxType:"bigint",value:n.toString()};if(typeof n==="function"||typeof n==="symbol")throw TypeError("Non-serializable component input");if(n===null||typeof n!=="object")return n;if(t.has(n))throw TypeError("Circular component input");t.add(n);try{if(n instanceof Date)return{__stxType:"date",value:n.toISOString()};if(Array.isArray(n))return n.map(i);let c=Object.getPrototypeOf(n);if(c!==Object.prototype&&c!==null)throw TypeError("Non-plain component input");let l={};for(let a of Object.keys(n).sort())l[a]=i(n[a]);return l}finally{t.delete(n)}};return JSON.stringify(i(e))}catch{return null}}function Tl(e){let t={};for(let[i,n]of Object.entries(e))if(!i.startsWith("__")||i==="__stxServeContext")t[i]=n;return t}function Ts(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Vs(e){let t=process.cwd(),i=`${t}\x00${e}`,n=ho.get(i);if(n===void 0)n=Bun.hash(Eo(e,t).split(ce.sep).join("/")).toString(36).slice(0,6),ho.set(i,n);return n}var ho=new Map;function Eo(e,t){if(!ce.isAbsolute(e))return e;let i=(n)=>{try{return qn.realpathSync(n)}catch{return n}};return ce.relative(i(t),i(e))}function dg(e){return/\bjs\b/.test(e)||/\blang\s*=\s*["']?(js|javascript)["']?/i.test(e)}function je(e){return!dg(e)}var Un=new Map;function Y(e){let t;try{t=JSON.stringify(e)}catch{return new Bun.Transpiler(e)}let i=Un.get(t);if(i)return i;if(Un.size>=16)Un.clear();let n=new Bun.Transpiler(e);return Un.set(t,n),n}var xo=new WeakMap,Il=256;function Be(e){try{let t=Y({loader:"ts",target:"browser",define:C()}),i=xo.get(t);if(!i)i=new Map,xo.set(t,i);let n=i.get(e);if(n!==void 0)return n;let c=e.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");c=c.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");let l=[];c=c.replace(/\{!![\s\S]*?!!\}/g,(y)=>{let v=l.length;return l.push(y),`"__STX_EXPR_${v}__"`}),c=c.replace(/\{\{\{[\s\S]*?\}\}\}/g,(y)=>{let v=l.length;return l.push(y),`"__STX_EXPR_${v}__"`}),c=c.replace(/\{\{[\s\S]*?\}\}/g,(y)=>{let v=l.length;return l.push(y),`"__STX_EXPR_${v}__"`});let a=t.transformSync(c);for(let y=0;y<l.length;y++)a=a.replace(`"__STX_EXPR_${y}__"`,l[y]),a=a.replace(`'__STX_EXPR_${y}__'`,l[y]);if(i.size>=Il){let y=i.keys().next();if(!y.done)i.delete(y.value)}return i.set(e,a),a}catch(t){if(process.env.STX_DEBUG_TS)console.warn("[STX] TypeScript transpilation error:",t);return e}}function Ol(e){let t=[],i=new Set,n=0,c=0,l=e.length,a=(D)=>{c++;while(c<l){if(e[c]==="\\"){c+=2;continue}if(e[c]===D){c++;return}c++}},y=()=>{c++;while(c<l){if(e[c]==="\\"){c+=2;continue}if(e[c]==="`"){c++;return}if(e[c]==="$"&&e[c+1]==="{"){c+=2;let D=1;while(c<l&&D>0)if(e[c]==="{")D++,c++;else if(e[c]==="}")D--,c++;else if(e[c]==="'"||e[c]==='"')a(e[c]);else if(e[c]==="`")y();else c++;continue}c++}},v=()=>{if(e[c]==="/"&&e[c+1]==="/"){while(c<l&&e[c]!==`
285
- `)c++;return!0}if(e[c]==="/"&&e[c+1]==="*"){c+=2;while(c<l-1&&!(e[c]==="*"&&e[c+1]==="/"))c++;return c+=2,!0}return!1},E=new Set(["return","typeof","instanceof","in","of","new","delete","void","throw","case","do","else","yield","await"]),A=()=>{let D=c-1;while(D>=0&&/\s/.test(e[D]))D--;if(D<0)return!0;let I=e[D];if("(,=:[!&|?{};+-*%<>~^".includes(I))return!0;if(!/[\w$]/.test(I))return!1;let B=D;while(B>0&&/[\w$]/.test(e[B-1]))B--;return E.has(e.slice(B,D+1))},M=()=>{c++;let D=!1;while(c<l&&e[c]!==`
286
- `){let I=e[c];if(I==="\\"){c+=2;continue}if(I==="[")D=!0;else if(I==="]")D=!1;else if(I==="/"&&!D){c++;while(c<l&&/[a-z]/i.test(e[c]))c++;return}c++}},X=()=>{if(n!==0)return;let D=e.slice(c).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(D){let z=D[2].split(",").map((Q)=>{let j=Q.trim().split(":");return j[j.length-1].trim()});for(let Q of z)if(Q&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(Q)&&!i.has(Q))t.push(Q),i.add(Q);return}let I=e.slice(c).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(I){let z=I[2];if(!i.has(z))t.push(z),i.add(z);return}let B=e.slice(c).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(B){let z=B[1];if(!i.has(z))t.push(z),i.add(z);return}let L=e.slice(c).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(L){let z=L[1];if(!i.has(z))t.push(z),i.add(z)}};while(c<l){if(v())continue;if(e[c]==="'"||e[c]==='"'){a(e[c]);continue}if(e[c]==="`"){y();continue}if(e[c]==="/"&&A()){M();continue}if(e[c]==="{"){n++,c++;continue}if(e[c]==="}"){n--,c++;continue}if(n===0&&/[a-z]/i.test(e[c])&&(c===0||/\s|[;{}()]/.test(e[c-1])))X();c++}return t}function Pl(e){let t=[],i=0,n=0,c=null;for(let l=0;l<e.length;l++){let a=e[l];if(c){if(a==="\\"){l++;continue}if(a===c)c=null;continue}if(a==='"'||a==="'"||a==="`"){c=a;continue}if(a==="("||a==="["||a==="{")i++;else if(a===")"||a==="]"||a==="}")i--;else if(a===","&&i===0)t.push(e.slice(n,l)),n=l+1}if(n<e.length)t.push(e.slice(n));return t}function Dl(e){let t=0,i=null;for(let n=0;n<e.length;n++){let c=e[n];if(i){if(c==="\\"){n++;continue}if(c===i)i=null;continue}if(c==='"'||c==="'"||c==="`"){i=c;continue}if(c==="("||c==="["||c==="{")t++;else if(c===")"||c==="]"||c==="}")t--;else if(c==="="&&t===0){let l=e[n-1],a=e[n+1];if(l==="!"||l==="<"||l===">"||l==="=")continue;if(a==="="||a===">")continue;return n}}return-1}function Ml(e,t){try{let i=/=\s*(?:withDefaults\s*\([\s\S]*?defineProps|defineProps)\b/.exec(e);if(!i)return;let n=i.index-1;while(n>=0&&/\s/.test(e[n]))n--;if(e[n]!=="}")return;let c=n,l=0,a=-1;for(;n>=0;n--){let v=e[n];if(v==="}")l++;else if(v==="{"){if(l--,l===0){a=n;break}}}if(a===-1)return;let y=e.slice(a+1,c);for(let v of Pl(y)){let E=v.trim();if(!E||E.startsWith("..."))continue;let A=Dl(E);if(A===-1)continue;let M=E.slice(0,A).trim();if(!/^[A-Z_$][\w$]*$/i.test(M))continue;if(t[M]!==void 0)continue;let X=E.slice(A+1).trim();if(!X)continue;try{let D=Object.keys(t).filter(jt),I=Function(...D,`"use strict"; return (${X});`);t[M]=I(...D.map((B)=>t[B]))}catch{}}}catch{}}var jl=new Set(["tr","td","th","thead","tbody","tfoot","caption","colgroup","col","option","optgroup","li","dt","dd","span"]);function pg(e,t){let i=e.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)<([a-zA-Z][a-zA-Z0-9-]*)/s);if(!i)return null;let n=i[2].toLowerCase();if(!jl.has(n))return null;let c=new RegExp(`<\\/?${n}(?=[\\s/>])(?:[^>"']|"[^"]*"|'[^']*')*>`,"iy"),l=S(e,(E,A)=>(c.lastIndex=A,c.exec(E)?.index===A?c.lastIndex:-1));if(n==="span"&&/\sdata-stx-scope\s*=/.test(l[0]?.token||""))return null;let a=0,y=!1;for(let E of l){if(a+=E.token.startsWith("</")?-1:1,a<0)return null;if(a===0){if(e.slice(E.end).trim())return null;y=!0;break}}if(!y)return null;let v=i[0].length;return e.slice(0,v)+t+e.slice(v)}function ko(e,t){if(!e)return!1;return[...t.additionalComponentsDirs??[],...t.fallbackComponentsDir?[t.fallbackComponentsDir]:[]].some((n)=>{let c=ce.relative(ce.resolve(n),ce.resolve(e));return!c.startsWith("..")&&!ce.isAbsolute(c)})}async function Cr(e,t,i,n,c){let l=e.endsWith(".stx")?e.slice(0,-4):e,a=(te)=>te.split("-").map((le)=>le.charAt(0).toUpperCase()+le.slice(1)).join(""),y=i.__importedComponents;if(y){for(let te of[l,l.toLowerCase(),a(l),V(l)])if(y.has(te))return!0}let v=[...new Set([`${l}.stx`,`${a(l)}.stx`,`${V(l)}.stx`])],E=typeof c.root==="string"?ce.resolve(c.root):void 0,A=E??ce.dirname(n),M=[],X=(te)=>{if(te&&!M.includes(te))M.push(te)};for(let te of cs(n,E))X(te);let D=i.__originalFilePath;if(D)X(ce.join(ce.dirname(D),"components"));if(ko(t,c))X(c._rootComponentsDir);X(t),X(c._rootComponentsDir),X(ce.join(ce.dirname(n),"components")),X(c.componentsDir);for(let te of c.additionalComponentsDirs??[])X(te);let I=c._targetComponentFallbackNames?.some((te)=>te.toLowerCase()===l.toLowerCase());if(!I)for(let te of c._targetComponentDirs??[])X(te);if(E)X(ce.resolve(E,"resources/views/components")),X(ce.resolve(E,"resources/components")),X(ce.resolve(E,"src/components")),X(ce.resolve(E,"components"));for(let te of c._layerComponentDirs??[])X(te);let B=c._pluginComponentDirs;if(Array.isArray(B))for(let te of B)X(typeof te==="string"?te:null);if(X(c.fallbackComponentsDir),I)for(let te of c._targetComponentDirs??[])X(te);let L=c._nativePrimitivesFallback;if(L&&!L.except.some((te)=>te.toLowerCase()===l.toLowerCase()))X(L.dir);if(l.startsWith("./")||l.startsWith("../"))return s(ce.resolve(ce.dirname(n),`${l}.stx`));let z=bo(ce.resolve(import.meta.dir,"components")),Q=M.map((te)=>ce.isAbsolute(te)?te:ce.resolve(A,te)),j=`${v.join("\x00")}\x00\x00${Q.join("\x00")}`,ee=Xs.get(j);if(ee!==void 0)return ee;let ne=!1;e:for(let te of Q){if(bo(te)===z)continue;for(let le of v)if(await s(ce.join(te,le))){ne=!0;break e}}return Xs.set(j,ne),ne}function bo(e){let t=Gs.get(e);if(t!==void 0)return t;let i=e;try{i=qn.realpathSync(e)}catch{}return Gs.set(e,i),i}function fg(e){return e==="visible"||e==="idle"||e==="interaction"||e.startsWith("media:")}function Xc(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 Nl(e,t,i){if(!e.includes("{{")&&!e.includes("{!!"))return e;let n=(c,l)=>{let a;try{a=T(c,t)}catch{return l}if(a===void 0||a===null)return"";let y=String(a);if(/<\/style/i.test(y))return console.warn(`[stx] a <style> expression in ${i??"<unknown>"} evaluated to CSS containing a closing style tag, which would end the element early, so it was dropped rather than emitted.`),"";return y};return e.replace(/\{!!([\s\S]*?)!!\}/g,(c,l)=>n(l,c)).replace(/\{\{([\s\S]*?)\}\}/g,(c,l)=>n(l,c))}var yo=new Set;function _o(e,t,i,n){let c=`${e}\x00${t}\x00${n??""}`;if(!process.env.STX_DEBUG&&yo.has(c))return;yo.add(c);let l=t?` used in ${t}`:"",a=n?` Cause: ${n}.`:"",y=i.length>0?`
287
- searched:
288
- ${i.map((v)=>` - ${v}`).join(`
289
- `)}`:"";console.error(`[stx] component <${e}> could not be resolved${l}, so it rendered as nothing.${a}${y}`)}function wo(e){return`<!-- stx: component "${e.replace(/--+/g,"-")}" could not be resolved; see the server log -->`}var Ll=new Set(["for","if","show","key","ref","class","className","style"]),So=new Set,Co="useMediaQuery|useDark|usePreferredDark|usePreferredLight|usePreferredReducedMotion|usePreferredContrast|useDocumentVisibility|useScrollLock",Gc=new RegExp(`\\b(?:${Co})\\s*(?:<[^>]*>)?\\s*\\(`);function yi(e){let t=new Set,i=new RegExp(`\\b(?:const|let|var)\\s+([a-zA-Z_$][\\w$]*)\\s*=\\s*(?:state|derived|computed|ref|reactive|signal|useModel|useReactiveProp|useLocalStorage|useSessionStorage|keptState|useCookie|useDebouncedValue|${Co})\\s*(?:<[^>]*>)?\\s*\\(`,"g");for(let n of e){let c;while((c=i.exec(n))!==null)t.add(c[1]);i.lastIndex=0}return[...t]}async function Fe(e,t,i,n,c,l,a,y=new Set,v,E=rt(c),A,M=e){let{extractVariables:X}=await o("stx/variable-extractor",()=>import("./chunk-7r5efkbz.js")),D=y??new Set;if(D.has(e))return`[Circular component reference: ${e}]`;let I=new Set(D);I.add(e);let B=typeof t.client==="string"?t.client.trim():"";if("client"in t)delete t.client;let L=B&&B!=="load"&&fg(B)?B:"";try{let z=(re)=>re.split("-").map((ae)=>ae.charAt(0).toUpperCase()+ae.slice(1)).join(""),Q=M.endsWith(".stx")?M.slice(0,-4):M,j=null,ee=c.__importedComponents;if(ee){let re=[Q,Q.toLowerCase(),z(Q),V(Q)];for(let ae of re)if(ee.has(ae)){j=ee.get(ae);break}}let ne=[];if(!j){let re=[`${Q}.stx`,`${z(Q)}.stx`,`${V(Q)}.stx`],ae=[...new Set(re)],we=c.__originalFilePath,be=[];if(be.push(...a._layerComponentDirs??[]),we){let ye=ce.join(ce.dirname(we),"components");be.push(ye)}let He=a._rootComponentsDir;if(typeof He==="string"&&ko(n,a)&&!be.includes(He))be.push(He);if(n&&!be.includes(n))be.push(n);if(typeof He==="string"&&!be.includes(He))be.push(He);let Te=ce.join(ce.dirname(l),"components");if(!be.includes(Te))be.push(Te);if(a.componentsDir&&a.componentsDir!==n&&!be.includes(a.componentsDir))be.push(a.componentsDir);for(let ye of a.additionalComponentsDirs??[])if(ye&&!be.includes(ye))be.push(ye);let ft=a._nativeHostAttrs&&/^(?:checkbox|switch)$/i.test(Q),pt=(A?.events??[]).map((ye)=>ye.replace(/^@/,"").split(".")[0].toLowerCase().replace(/-/g,"")),yt=Object.hasOwn(t,"checked")||Boolean(A?.reactiveProps?.includes("checked")),es=Object.hasOwn(t,"value")||Boolean(A?.reactiveProps?.includes("value")),ts=!pt.includes("valuechange")&&(yt||pt.includes("change")&&!es),mt=a._nativeHostAttrs&&/^textinput$/i.test(Q),_t=pt.includes("update:value")&&!pt.includes("input"),Zt=a._nativeHostAttrs&&/^video$/i.test(Q),ns=a._nativeHostAttrs&&/^image$/i.test(Q),ln=Ms([...Object.keys(t),...A?.reactiveProps??[]],A?.events,t),wt=Object.hasOwn(t,"src")||Boolean(A?.reactiveProps?.includes("src")),un=Object.hasOwn(t,"source")||Boolean(A?.reactiveProps?.includes("source")),_n=Zt&&wt&&!un&&(A?.events??[]).every((ye)=>/^(?:play|pause|ended|timeupdate|loadedmetadata|loadstart|error)$/.test(ye.replace(/^@/,"").split(".")[0])),Sn=new Set(["","primary","secondary","outline","ghost","danger"]),$n=typeof t.variant==="string"?t.variant.trim().toLowerCase():"",En=a._nativeHostAttrs&&/^button$/i.test(Q)&&!Sn.has($n),or=a._targetComponentFallbackNames?.some((ye)=>ye.toLowerCase()===Q.toLowerCase())&&(!ft||ts)&&(!mt||_t)&&(!Zt||_n)&&(!ns||ln)&&!En;for(let ye of or?[]:a._targetComponentDirs??[])if(ye&&!be.includes(ye))be.push(ye);let St=typeof a.root==="string"?ce.resolve(a.root):void 0,zo=St??ce.dirname(l),$t=[];if(St)$t.push(ce.resolve(St,"resources/views/components")),$t.push(ce.resolve(St,"resources/components")),$t.push(ce.resolve(St,"src/components")),$t.push(ce.resolve(St,"components"));$t.push(ce.resolve(import.meta.dir,"components"));for(let ye of $t)if(!be.includes(ye))be.push(ye);let cr=a._pluginComponentDirs;if(Array.isArray(cr)){for(let ye of cr)if(typeof ye==="string"&&!be.includes(ye))be.push(ye)}if(a.fallbackComponentsDir&&!be.includes(a.fallbackComponentsDir))be.push(a.fallbackComponentsDir);if(or){for(let ye of a._targetComponentDirs??[])if(ye&&!be.includes(ye))be.push(ye)}let kn=a._nativePrimitivesFallback;if(kn&&!kn.except.some((ye)=>ye.toLowerCase()===Q.toLowerCase())&&!be.includes(kn.dir))be.push(kn.dir);let ar=[...new Set(be.map((ye)=>{if(!ye)return ye;return ce.isAbsolute(ye)?ye:ce.resolve(zo,ye)}))];be.length=0,be.push(...ar);let ss=`${Q}\x00${l}\x00${ar.join("\x00")}`,rs=Hn.get(ss);if(rs)if(await s(rs))j=rs;else Hn.delete(ss);if(!j&&(Q.startsWith("./")||Q.startsWith("../")))j=ce.resolve(ce.dirname(l),`${Q}.stx`),ne.push(j);else if(!j)for(let ye of be){if(!ye)continue;for(let Cn of ae){let Rn=ce.join(ye,Cn);if(ne.push(Rn),await s(Rn)){j=Rn;break}}if(j)break;if(!j)try{let Cn=await import("fs");if(!Cn.statSync(ye,{throwIfNoEntry:!1})?.isDirectory())continue;let Fo=8,is=[{path:ye,depth:0}];while(is.length>0&&!j){let An=is.pop();if(An.depth>=Fo)continue;let lr;try{lr=Cn.readdirSync(An.path,{withFileTypes:!0})}catch{continue}for(let Tn of lr){if(!Tn.isDirectory())continue;if(Tn.name==="node_modules"||Tn.name.startsWith("."))continue;let ur=ce.join(An.path,Tn.name);for(let Vo of ae){let os=ce.join(ur,Vo);if(ne.push(os),await s(os)){j=os;break}}if(j)break;is.push({path:ur,depth:An.depth+1})}}}catch{}if(j)break}if(j)Hn.set(ss,j)}if(!j||!await s(j))return _o(e,l,ne),wo(e);v.add(j);let te;if(tn.has(j)&&Ks.get(j)===mo(j))te=tn.get(j);else try{let re=mo(j);te=await Bun.file(j).text(),tn.set(j,te),Ks.set(j,re)}catch(re){let ae=re instanceof Error?re.message:String(re);return _o(e,l,[j],ae),wo(e)}if(A)for(let re of new Set([...Object.keys(t),...A.reactiveProps??[]])){let ae=re.toLowerCase();if(ae.startsWith("aria-")||ae.startsWith("data-"))continue;let we=re.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(new RegExp(`\\b${we}\\b`).test(te))A.declaredProps.add(re);if(new RegExp(`\\$props\\s*(?:\\.\\s*${we}\\b|\\[\\s*['"]${we}['"]\\s*\\])`).test(te)||new RegExp(`\\buseReactiveProp\\s*\\(\\s*['"]${we}['"]`).test(te))A.consumedProps?.add(re)}if(A?.reactiveProps?.length&&/\bdefineProps\s*(?:<[^>]*>)?\s*\(/.test(te))for(let re of A.reactiveProps){if(Ll.has(re)||A.consumedProps?.has(re))continue;if(new RegExp(`\\buse(?:ReactiveProp|Model)\\s*\\(\\s*['"]${re.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(te))continue;let ae=`${j}\x00${re}`;if(So.has(ae))continue;So.add(ae),console.warn(`[stx] ${ce.basename(j)} reads \`${re}\` with defineProps(), which is not live, but ${ce.basename(l)} binds it (:${re}): 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('${re}').`)}let le=new Set(["__originalFilePath","__importedComponents",Dn,"__stx_client_signal_names","__stx_client_declared_names","__stx_runtime_config","__stxServeContext","__stx_scope_seq"]),he={};for(let[re,ae]of Object.entries(c))if(!re.startsWith("__")||le.has(re))he[re]=ae;let ue=E.length>0?{[Wn]:[...E]}:{},Ce=i;if(i.includes("@include")){let{processIncludes:re}=await o("stx/includes",()=>import("./chunk-r4kdwpbh.js"));Ce=await re(i,c,l,a,v)}if(/<[A-Z][\w.-]*[\s/>]/.test(Ce)){let{processComponents:re}=await o("stx/component-renderer",()=>import("./chunk-0j8qrqke.js")),ae={...c,__processedComponents:D,...ue};Ce=await re(Ce,ae,l,a,v);let we=ae.__stx_preserved_client_expressions;if(Array.isArray(we)&&we.length>0)c.__stx_preserved_client_expressions=[...new Set([...Array.isArray(c.__stx_preserved_client_expressions)?c.__stx_preserved_client_expressions:[],...we])]}let Ae=[];if(Xc(Ce)){let{processExpressions:re}=await o("stx/expressions",()=>import("./chunk-bxtwbkc1.js")),ae=c.__stx_signals_gate===void 0?{...c,__stx_signals_gate:!0,...ue}:E.length>0?{...c,...ue}:c;Ce=re(Ce,ae,l);for(let we of Ce.matchAll(/\{\{([\s\S]*?)\}\}/g))Ae.push(we[1].trim())}let We=G(Ce),Ke=[],Ge=We.output.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(re,ae)=>{let we=We.scripts[Number(ae)]||"",be=we.match(/^<script\b([^>]*)>/i)?.[1]||"",He=be.match(/\btype\s*=\s*["']([^"']+)["']/i)?.[1]?.toLowerCase(),Te=!He||["module","text/javascript","application/javascript"].includes(He),ft=/\sdata-stx-(?:owner|instance)(?=[\s=/>])/i.test(` ${be}`);if(!/\bserver\b/i.test(be)&&Te&&!ft)return Ke.push(we),"";return we}),{extractSlotContent:Xe}=await o("stx/slots",()=>import("./chunk-956zq9b7.js")),et=Xe(Ge),Je={};if(et.defaultSlot?.trim())Je.default=et.defaultSlot;for(let[re,ae]of et.namedSlots)Je[re]=ae.content;let gt=c.__stx_scope_seq??={n:0,key:Vs(String(c.__filename??l))},Tt=Eo(e,process.cwd()),lt=`stx_${(Tt.endsWith(".stx")?Tt.slice(0,-4):Tt).replace(/[^a-zA-Z0-9]/g,"_")}_${++gt.n}_${gt.key}`,Ue={...he,$uid:lt,$native:a._nativeHostAttrs===!0,...t,props:t,slot:Ge,$slots:Je,__processedComponents:I,__sections:{},__stx_signals_gate:Se(te)||Xc(i),__stx_preserved_client_expressions:[...Array.isArray(c.__stx_preserved_client_expressions)?c.__stx_preserved_client_expressions:[],...Ae]};Ml(te,Ue);let Dt=te,sn=de(Dt);if(sn)Dt=sn.content.trim();let Xn=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,Lt=[...te.matchAll(Xn)];for(let[,re,ae]of Lt)if(!/\bserver\b|\bsrc\s*=|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/i.test(re))Oe(ae,j,a.strict);let Ye=[],Bt=null,Jn=Lt.some((re)=>/\bserver\b/.test(re[1]||"")&&/\bcache\b/.test(re[1]||"")),bt=null,st=null,Wt=null,rn=0,zt=null;if(Rl(a),Jn&&Qs>0){let re=Al({props:t,slot:Ce,slotContext:i.trim()?Tl(he):void 0,buildMode:a.buildMode??"",skipEventDirectives:a.skipEventDirectives===!0,native:a._nativeHostAttrs===!0,clientLoopNames:[...E].sort(),layers:a._layerGraph?.layers.map((ae)=>ae.configFile),uid:lt});if(re!==null){bt=`${j}\x00${x(te)}\x00${re}`;let ae=Zn.get(bt);if(ae){for(let we of ae.dependencies)v.add(we);if(Gr(c,ae.clientFactories),gt.n+=ae.uidsConsumed,ae.preservedClientExpressions.length>0){let we=new Set(Array.isArray(c.__stx_preserved_client_expressions)?c.__stx_preserved_client_expressions:[]);for(let be of ae.preservedClientExpressions)we.add(be);c.__stx_preserved_client_expressions=[...we]}return ae.output}st=new Set(v),Wt=Xr(c),rn=gt.n,zt=new Set(Array.isArray(c.__stx_preserved_client_expressions)?c.__stx_preserved_client_expressions:[])}}let Ft=new Set;for(let re of Lt){let ae=re[1]||"",we=re[2]||"",be=ae.includes("server");if(je(ae)&&we.trim())we=Be(we);if(be&&we){for(let Te of Me(we))Ft.add(Te);try{await X(we,Ue,j,{onFailure:(Te)=>{if(Te.kind!=="unknown")Bt=Te.kind}})}catch(Te){}}if(!be){let Te=we.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),ft=Te.includes("{{")&&Te.includes("}}"),pt=Te.includes("{!!")&&Te.includes("!!}");if(ft||pt)Te=wi(Te,Ue,j);let yt=ae.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");Ye.push(`<script${yt}>${Te}</script>`)}}let Qe=G(te).output.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),Vt=Qe?Qe[1]:"",Gn=Qe?Qe[2]:"",it="",se=Vt&&/\bscoped\b/i.test(Vt);if(Qe)it=`<style${Vt}>${Nl(Gn,Ue,j)}</style>`;let ie=Dt;if(ie=ie.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),Qe)ie=ie.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let re=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,ae=[];if(ie=ie.replace(re,(we,be)=>{let He=be.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(He)ae.push(`<style${He[1]}>${He[2]}</style>`);return""}),ie=ie.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),ae.length>0)it=`${it}${ae.join(`
290
- `)}`}if(i&&ie.includes("{{ text || slot }}"))ie=ie.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>i);let{applySlots:me}=await o("stx/slots",()=>import("./chunk-956zq9b7.js")),{defaultSlot:$e,namedSlots:Re}=et,Ze=c.__stx_signals_gate===!0&&/\s(?:@[\w:.-]+|x-on:[\w:.-]+)\s*=/.test(Ge),ot=a._nativeHostAttrs===!0&&Ye.length>0||Ze&&Ye.length>0||Ye.some((re)=>/\b(?:state|derived|effect|ref|useRef|reactive|computed|watch|watchEffect|useModel|useReactiveProp|onMount|onDestroy|defineProps|withDefaults|defineEmits|defineExpose|defineSlots)\s*(?:<[^<>()]*>)?\s*\(/.test(re)),Yn=(re)=>ot?Wi(re,lt):re,Qn=new Map([...Re].map(([re,ae])=>[re,{...ae,content:Yn(ae.content)}]));ie=await me(ie,Yn($e),Qn,Ue,ot?lt:"");let on=yi(Ye),Ut=(Array.isArray(Ue.__stx_client_signal_names)?Ue.__stx_client_signal_names:[]).filter((re)=>!Ft.has(re));if(on.length>0||Ut.length>0)Ue.__stx_client_signal_names=[...new Set([...Ut,...on])];else delete Ue.__stx_client_signal_names;let Ht=E.filter((re)=>!Ft.has(re)&&!(re in t));if(Ht.length>0)Ue[Wn]=Ht;let cn={...a,_rootComponentsDir:a._rootComponentsDir||a.componentsDir,componentsDir:ce.dirname(j),skipSignalsRuntime:!0,skipEventDirectives:a._nativeHostAttrs===!0||ot||Ye.length===0,defaultLayout:void 0};Ue.__stxProcessingDepth=(c.__stxProcessingDepth||0)+1;let{processDirectives:an}=await o("stx/process",()=>import("./chunk-5b6tsg13.js")),tt=await an(ie,Ue,j,cn,v),ut=new Set(Array.isArray(c.__stx_preserved_client_expressions)?c.__stx_preserved_client_expressions:[]);for(let re of tt.matchAll(/\{\{([\s\S]*?)\}\}/g))ut.add(re[1].trim());if(ut.size>0)c.__stx_preserved_client_expressions=[...ut];let ct=lt,qe=tt;if(ot){let re="";if(Object.keys(t).length>0)try{re=` data-stx-props="${Ts(JSON.stringify(t))}"`}catch{}let ae=L?` stx-hydrate="${Ts(L)}"`:"",we=Object.fromEntries(Object.entries(Je).map(([mt,_t])=>[mt,Boolean(_t)])),be=Object.keys(we).length>0?` data-stx-slots="${Ts(JSON.stringify(we))}"`:"",He=` data-stx-scope="${ct}"${re}${be}${ae}`,Te=/^\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*<span(?=[\s/>])/i.test(tt),ft=/^\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*<[^>]+\bdata-stx-layout-root(?:\s|=|>)/i.test(tt),pt=/^\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*<[^>]+\bdata-stx-fill-root(?:\s|=|>)/i.test(tt),yt=Te?"span":"div",es=ft&&a._nativeHostAttrs?' style="display:flex;flex-direction:column;flex:1;min-height:0;min-width:0"':pt&&a._nativeHostAttrs?' style="width:100%;height:100%"':Te||ft?' style="display:contents"':"";qe=pg(tt,He)??`<${yt}${He} data-stx-component-wrapper${es}>${tt}</${yt}>`;let ts=await Promise.all(Ye.map(async(mt)=>{let _t=mt.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!_t)return mt;let[,Zt,ns]=_t,ln=go(mt,Ue,j);if(ln!==null)return ln;let wt=await Wl(ns,j,a.buildMode==="compile"),un=yn(wt.clientCode,De(Ue)),{vendorStyleTags:_n}=wt,Sn=un?`function(__scopeId) {
291
- ${un}
292
- return (${wt.factoryBody})(__scopeId);
293
- }`:wt.factoryBody,$n=L?null:xs(c,Sn),En=$n?`window.__stxComponentFactories[${JSON.stringify($n)}](${JSON.stringify(ct)});`:`(${Sn})(${JSON.stringify(ct)});`;if(L)return`${_n}<script type="stx/island" data-stx-island="${ct}" data-stx-scoped data-stx-owner="${ct}"${Zt}>${En}</script>`;return`${_n}<script data-stx-scoped data-stx-run="always" data-stx-owner="${ct}"${Zt}>${En}</script>`}));if(qe=qe+`
294
- `+ts.join(`
295
- `),it)qe+=`
296
- `+it}else{if(it)qe+=`
297
- `+it;if(Ye.length>0){let re=Ue.__stx_event_bindings||[],ae=De(Ue),we=await Promise.all(Ye.map(async(be)=>{let He=go(be,Ue,j);if(He!==null)return He;let Te=be.match(/<script\b[^>]*>([\s\S]*?)<\/script>/);if(!Te)return be;return await Le(Te[1],{eventBindings:re,templateContent:qe,filePath:j,projectRoot:process.cwd(),serverData:ae,instanceId:lt})}));qe+=`
298
- `+we.join(`
299
- `),Ue.__stx_event_bindings=[]}}if(se){let re=Bs(qe,j);if(re.hasScoped)qe=re.html}if(bt&&st){let re=Array.isArray(c.__stx_preserved_client_expressions)?c.__stx_preserved_client_expressions:[];Zn.set(bt,{output:qe,dependencies:[...v].filter((ae)=>!st.has(ae)),clientFactories:Wt?Jr(c,Wt):[],uidsConsumed:gt.n-rn,preservedClientExpressions:zt?re.filter((ae)=>!zt.has(ae)):[]})}if(Bt)qe=`<!--stx-render-failed:${Bt}-->${qe}`;return Ke.length>0?`${qe}
300
- ${Ke.join(`
301
- `)}`:qe}catch(z){if(z instanceof q)throw z;return`[Error processing component: ${z instanceof Error?z.message:String(z)}]`}finally{D.delete(e)}}async function s(e){return Bun.file(e).exists()}function er(e,t){let i=ce.resolve(t),n=ce.resolve(e),c=i.endsWith(ce.sep)?i:i+ce.sep;if(n===i||n.startsWith(c))return n;return null}async function $o(e,t,i,n){let c=t.startsWith("layouts/")?t.slice(8):t,l=ce.join(e,c);for(let a of l.endsWith(".stx")?[l]:[l,`${l}.stx`])if(await s(a)){if(n)console.log(`Found layout in ${e}: ${a}`);return i?.add(a),a}return null}async function bn(e,t,i,n){let c=await Bl(e,t,i,n);if(c===null)return null;let l=er(c,process.cwd());if(l)return l;let a=[i.root,i.layoutsDir,i.fallbackLayoutsDir,i.componentsDir,i.partialsDir,i.pagesDir,...i._layerLayoutDirs??[]].filter((y)=>typeof y==="string"&&y.length>0);for(let y of a){let v=ce.isAbsolute(y)?y:ce.resolve(process.cwd(),y);if(er(c,v))return ce.resolve(c)}return console.warn(`[stx] rejected resolved template path that escapes project root: ${c} (template: ${e}, from: ${t})`),null}async function Bl(e,t,i,n){if(i.debug)console.log(`Resolving template path: ${e} from ${t}`);let c=ce.dirname(t),l=process.cwd();if(e.startsWith("/")){let D=ce.join(l,e),I=er(D,l);if(!I)return console.warn(`[stx] rejected template path that escapes project root: ${e} (from ${t})`),null;if(i.debug)console.log(`Checking absolute path: ${I}`);if(await s(I)&&n)n.add(I);return I}let a=async(D)=>{if(!i.layoutsDir||!i.fallbackLayoutsDir)return D;let I=ce.relative(ce.resolve(l,i.fallbackLayoutsDir),D);if(I.startsWith("..")||ce.isAbsolute(I))return D;return await $o(ce.resolve(l,i.layoutsDir),e,n,i.debug)??D},y=ce.join(c,e);if(await s(y)){if(i.debug)console.log(`Found direct path: ${y}`);let D=await a(y);if(n)n.add(D);return D}if(!e.endsWith(".stx")&&!e.endsWith(".jsx")&&!e.endsWith(".tsx"))for(let D of[".stx",".tsx",".jsx"]){let I=`${y}${D}`;if(await s(I)){if(i.debug)console.log(`Found direct path with extension: ${I}`);let B=await a(I);if(n)n.add(B);return B}}let v=[];if(v.push(...i._layerLayoutDirs??[]),i.layoutsDir)v.push(ce.isAbsolute(i.layoutsDir)?i.layoutsDir:ce.resolve(process.cwd(),i.layoutsDir));let E=ce.resolve(c),A=process.cwd();for(let D=0;D<10;D++){let I=ce.join(E,"layouts"),B=!1;try{B=qn.statSync(I,{throwIfNoEntry:!1})?.isDirectory()??!1}catch{}if(B){v.push(I);break}let L=ce.dirname(E);if(L===E||L.length<A.length)break;E=L}for(let D of v){let I=await $o(D,e,n,i.debug);if(I)return I}if(i.fallbackLayoutsDir){let D=ce.isAbsolute(i.fallbackLayoutsDir)?i.fallbackLayoutsDir:ce.resolve(process.cwd(),i.fallbackLayoutsDir),I=e.startsWith("layouts/")?e.slice(8):e,B=[ce.join(D,I)];if(!e.endsWith(".stx"))B.push(`${B[0]}.stx`);for(let L of B)if(await s(L)){if(i.debug)console.log(`Found in options.fallbackLayoutsDir: ${L}`);if(n)n.add(L);return L}}if(e.startsWith("layouts/")||e.includes("/layouts/")){let D=e.split("layouts/"),I=ce.join(i.partialsDir||c,"layouts",D[1]);if(await s(I)){if(i.debug)console.log(`Found in layouts path: ${I}`);if(n)n.add(I);return I}if(!I.endsWith(".stx")){let B=`${I}.stx`;if(await s(B)){if(i.debug)console.log(`Found in layouts path with extension: ${B}`);if(n)n.add(B);return B}}}if(i.partialsDir){let D=ce.join(i.partialsDir,"layouts");if(await s(D)){let I=ce.join(D,e);if(await s(I)){if(i.debug)console.log(`Found in partials layouts dir: ${I}`);if(n)n.add(I);return I}if(!e.endsWith(".stx")){let B=`${I}.stx`;if(await s(B)){if(i.debug)console.log(`Found in partials layouts dir with extension: ${B}`);if(n)n.add(B);return B}}}}let M=i.partialsDir||ce.join(process.cwd(),"views"),X=ce.join(M,e);if(await s(X)){if(i.debug)console.log(`Found in views path: ${X}`);if(n)n.add(X);return X}if(!e.endsWith(".stx")){let D=`${X}.stx`;if(await s(D)){if(i.debug)console.log(`Found in views path with extension: ${D}`);if(n)n.add(D);return D}}if(c.includes("temp")){let D=ce.join(ce.dirname(c),"layouts",e);if(await s(D)){if(i.debug)console.log(`Found in temp layouts dir: ${D}`);if(n)n.add(D);return D}if(!e.endsWith(".stx")){let I=`${D}.stx`;if(await s(I)){if(i.debug)console.log(`Found in temp layouts dir with extension: ${I}`);if(n)n.add(I);return I}}}if(i.debug)console.warn(`Template not found after trying all paths: ${e} (referenced from ${t})`);else console.warn(`Template not found: ${e} (referenced from ${t})`);return null}function Jc(e,t,i){let n=0,c="",l="";try{if(typeof t==="number"&&t>=0){let a=e.split(`
302
- `),y=0;for(let v=0;v<a.length;v++)if(y+=a[v].length+1,y>=t){n=v+1,c=a[v].trim();let E=Math.max(0,v-2),A=Math.min(a.length,v+3);l=a.slice(E,A).map((M,X)=>{let D=E+X+1;return`${D===n?"> ":" "}${D}: ${M}`}).join(`
303
- `);break}}else if(i){let a=e.indexOf(i);if(a>=0)return Jc(e,a)}}catch{}return{lineNumber:n,lineContent:c,context:l}}var ke={reset:"\x1B[0m",bold:"\x1B[1m",dim:"\x1B[2m",red:"\x1B[31m",yellow:"\x1B[33m",blue:"\x1B[34m",cyan:"\x1B[36m",gray:"\x1B[90m",bgRed:"\x1B[41m",bgYellow:"\x1B[43m"};function h(e,t,i,n,c,l){let{lineNumber:a,context:y}=Jc(n,c,l),v=i.split("/").pop(),E=0;if(typeof c==="number"&&c>=0&&n){let M=n.lastIndexOf(`
304
- `,Math.max(0,c-1));E=c-(M+1)+1}let A="";if(a>0)A+=`
305
- ${i}:${a}${E>0?`:${E}`:""}: ${e.toLowerCase()} error: ${t}
306
- `;if(A+=`
307
- ${ke.bold}${ke.red}\u256D\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256E${ke.reset}
308
- `,A+=`${ke.bold}${ke.red}\u2502${ke.reset} ${ke.bold}${ke.bgRed} ERROR ${ke.reset} ${ke.red}${e} Error${ke.reset}${" ".repeat(Math.max(0,43-e.length))}${ke.bold}${ke.red}\u2502${ke.reset}
309
- `,A+=`${ke.bold}${ke.red}\u2570\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256F${ke.reset}
310
- `,A+=`
311
- ${ke.cyan}${ke.bold}File:${ke.reset} ${ke.dim}${v}${ke.reset}`,a>0)A+=` ${ke.gray}(line ${a}${E>0?`, col ${E}`:""})${ke.reset}`;if(A+=`
312
- ${ke.yellow}${ke.bold}Message:${ke.reset} ${t}
313
- `,y)A+=`
314
- ${ke.blue}${ke.bold}Context:${ke.reset}
315
- ${ke.dim}${y}${ke.reset}
316
- `;return A}function fe(){tn.clear(),Ks.clear(),Hn.clear(),Xs.clear(),Gs.clear(),Zn.clear()}function Xh(){return{size:tn.size,maxSize:500}}var Zs=b(128);async function Wl(e,t,i){let n=x(e,t,i),c=Zs.get(n);if(c){if(Ds(c.deps))return c;Zs.delete(n)}let l=mi(e,{filePath:t,projectRoot:process.cwd()}),a=l.code,y=hi(l.styles);a=Nt(a).code;let{hasUserImports:v,bundleClientScript:E}=await o("stx/client-script-bundler",()=>import("./chunk-p7tg362f.js")),A=[],M=!1;if(v(a)){let Q=a;a=await E(Q,t,{projectRoot:process.cwd(),minify:i,collectInputs:A}),M=a===Q}let{stripStxRuntimeImports:X}=await o("stx/signal-processing",()=>import("./chunk-vft84x6s.js"));a=X(a);let D=P(a),I=Ol(D),B=new Set(H(D,!0).split(",").map((Q)=>Q.trim())),L=`function(__scopeId) {
317
- ${at("const",[...ll,...I],D)}
318
- const __scope = window.stx._scopes = window.stx._scopes || {};
319
- const __scopeVars = __scope[__scopeId] = __scope[__scopeId] || {};
320
- __scopeVars.$refs = __scopeVars.$refs || {};
321
- const __previousCurrentElement = window.__STX_CURRENT_ELEMENT__;
322
- const __previousCurrentProps = window.__STX_CURRENT_PROPS__;
323
- // A clone the runtime is setting up may not be in the document yet (rows
324
- // a loop builds inside a closed :if), where a lookup cannot see it, so the
325
- // runtime hands its root over in __STX_SETUP_ROOT__ (signals.ts).
326
- const __setupRoot = window.__STX_SETUP_ROOT__;
327
- const __componentElement = (__setupRoot && __setupRoot.getAttribute('data-stx-scope') === __scopeId && __setupRoot) || document.querySelector('[data-stx-scope="' + __scopeId + '"]');
328
- __scopeVars.$slots = Object.create(null);
329
- if (__componentElement) {
330
- try { Object.assign(__scopeVars.$slots, JSON.parse(__componentElement.getAttribute('data-stx-slots') || '{}')); }
331
- catch {}
332
- }
333
- window.__STX_CURRENT_ELEMENT__ = __componentElement;
334
- let __componentProps = __componentElement && __componentElement.__stx_props;
335
- if (!__componentProps && __componentElement) {
336
- try { __componentProps = JSON.parse(__componentElement.getAttribute('data-stx-props') || '{}'); }
337
- catch { __componentProps = {}; }
338
- }
339
- window.__STX_CURRENT_PROPS__ = __componentProps && typeof __componentProps === 'object' && !Array.isArray(__componentProps) ? __componentProps : {};
340
-
341
- // Scope-specific lifecycle callbacks. The queues drain as they run; the
342
- // hook lists keep what setup registered, because a component behind an :if
343
- // unmounts at each hide and mounts again at each show (signals.ts,
344
- // suspendSubtreeScopes).
345
- if (__scopeVars.__suspended && !__scopeVars.__mounted) {
346
- // Set up again after an :if hid it -- a <template :if> clones the
347
- // component afresh on every show, and the clone's script runs. This run's
348
- // hooks close over this run's state, so they replace the ones the hide
349
- // kept for a re-show rather than queueing beside them.
350
- __scopeVars.__mountCallbacks = [];
351
- __scopeVars.__destroyCallbacks = [];
352
- __scopeVars.__mountHooks = [];
353
- __scopeVars.__destroyHooks = [];
354
- // So do its effects: the last run's watched a clone that is gone.
355
- if (typeof __scopeVars.__disposeEffects === 'function') __scopeVars.__disposeEffects();
356
- __scopeVars.__disposeEffects = null;
357
- }
358
- __scopeVars.__mountCallbacks = __scopeVars.__mountCallbacks || [];
359
- __scopeVars.__destroyCallbacks = __scopeVars.__destroyCallbacks || [];
360
- __scopeVars.__mountHooks = __scopeVars.__mountHooks || [];
361
- __scopeVars.__destroyHooks = __scopeVars.__destroyHooks || [];
362
- let __registeringSetupHooks = true;
363
- const onMount = (fn) => { __scopeVars.__mountCallbacks.push(fn); __scopeVars.__mountHooks.push(fn); };
364
- const onDestroy = (fn) => {
365
- __scopeVars.__destroyCallbacks.push(fn);
366
- // A teardown registered inside onMount belongs to this mount alone.
367
- // Replaying it AND registering the next mount's teardown doubles cleanup.
368
- if (__registeringSetupHooks) __scopeVars.__destroyHooks.push(fn);
369
- };
370
- // The effects this setup makes (effect, watch) belong to the scope and are
371
- // disposed with it (disposeSubtreeScopes in the runtime), as its bindings
372
- // are. Untracked, one reading a store kept running for a component the
373
- // router had long swapped out.
374
- const __endEffects = window.stx._beginEffects ? window.stx._beginEffects() : null;
375
-
376
- try {
377
- ${D}
378
-
379
- // Register all defined signals and functions in this scope
380
- const __localVars = {};
381
- try {
382
- ${I.map((Q)=>B.has(Q)?`Object.defineProperty(__localVars, '${Q}', ${Ps(Q)});`:`if (typeof ${Q} !== 'undefined') __localVars['${Q}'] = ${Q};`).join(`
383
- `)}
384
- }
385
- catch (e) {}
386
- Object.defineProperties(__scopeVars, Object.getOwnPropertyDescriptors(__localVars));
387
- if (typeof __stxLiveBindings !== 'undefined') Object.defineProperties(__scopeVars, Object.getOwnPropertyDescriptors(__stxLiveBindings));
388
- }
389
- finally {
390
- __registeringSetupHooks = false;
391
- if (__endEffects) {
392
- const __previousDispose = __scopeVars.__disposeEffects;
393
- const __disposeSetup = __endEffects();
394
- __scopeVars.__disposeEffects = typeof __previousDispose === 'function'
395
- ? function() { __previousDispose(); __disposeSetup(); }
396
- : __disposeSetup;
397
- }
398
- window.__STX_CURRENT_ELEMENT__ = __previousCurrentElement;
399
- window.__STX_CURRENT_PROPS__ = __previousCurrentProps;
400
- }
401
- }`,z={vendorStyleTags:y,factoryBody:L,clientCode:D,deps:br([...A,...l.styles.map((Q)=>Q.resolvedPath)])};if(!M&&l.unresolved.length===0)Zs.set(n,z);return z}var hn=["module","exports","require","props","$props","$bool","$num","defineProps","withDefaults","defineClientPayload","useServerData","useRuntimeConfig","useServerRuntimeConfig","state","derived","effect","batch","onMount","onDestroy","definePageMeta","useRoute","useRouter","useHead","useSeoMeta","setResponseStatus","setResponseHeader","notFound","ref","reactive","computed","watch","onMounted","onUnmounted","nextTick","defineEmits","defineExpose","defineSlots","provide","inject","useColorMode","useDark","useMediaQuery","useScrollLock","usePreferredDark","usePreferredLight","usePreferredReducedMotion","usePreferredContrast","window","document","console","confirm","alert","fetch","params"];var zl=100,Fl=599,nr="__stxResponseStatus",nn="__stxResponseHeaders";function Kn(e){return typeof e==="number"&&Number.isInteger(e)&&e>=zl&&e<=Fl}function gn(e){for(let t of e.matchAll(/\bdefinePageMeta\s*\(\s*\{([\s\S]*?)\}\s*\)/g)){let i=t[1].match(/(?:^|,)\s*status\s*:\s*(\d{3})(?=\s*(?:,|$))/);if(!i)continue;let n=Number(i[1]);if(Kn(n))return n}return}function tr(e,t){if(!e||typeof e!=="object")return!1;let i=typeof t==="string"&&/^\d+$/.test(t.trim())?Number(t.trim()):t;if(!Kn(i))return!1;return e[nr]=i,!0}function Vl(e,t,i){if(!e||typeof e!=="object")return;let n=String(t??"").trim();if(!n)return;e[nn]={...e[nn],[n]:String(i)}}function It(e){let t=e?.[nr];return Kn(t)?t:void 0}function Ot(e){let t=e?.[nn];if(!t||typeof t!=="object")return;let i=Object.entries(t).map(([n,c])=>[n,String(c)]);return i.length>0?Object.fromEntries(i):void 0}function Lc(e,t){if(!e||!t||e===t||typeof t!=="object")return;let i=It(e);if(i!==void 0)t[nr]=i;let n=Ot(e);if(n)t[nn]={...t[nn],...n}}function Fs(e){return{setResponseStatus:(t)=>{tr(e,t)},notFound:(t=404)=>{let i=Kn(t)&&t>=400?t:404;tr(e,i)},setResponseHeader:(t,i)=>{Vl(e,t,i)}}}function jc(e,t,i={}){if(!e.includes("@status"))return e;let{filePath:n,buildMode:c}=i,l=c==="compile",a="",y=0,v=/@status\s*\(/g,E;while((E=v.exec(e))!==null){let A=Ul(e,E.index+E[0].length-1);if(A<0)break;let M=e.slice(E.index+E[0].length,A).trim(),X=/^\d+$/.test(M)?Number(M):u(M,t),D=n?` in ${n}`:"";if(l)console.warn(`[stx] @status(${M})${D} 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(!tr(t,X))console.warn(`[stx] @status(${M})${D} is not an HTTP status (100-599) \u2014 ignoring it.`);a+=e.slice(y,E.index),y=A+1+(e.slice(A+1).match(/^[^\S\n]*\n?/)?.[0].length??0),v.lastIndex=y}return y===0?e:a+e.slice(y)}function Ul(e,t){let i=1,n=null,c=!1;for(let l=t+1;l<e.length;l++){let a=e[l];if(c){c=!1;continue}if(n){if(a==="\\")c=!0;else if(a===n)n=null;continue}if(a==='"'||a==="'"||a==="`"){n=a;continue}if(a==="(")i++;else if(a===")"&&--i===0)return l}return-1}var Ro=new Set(hn),Hl=new Set(["props","$props","defineProps"]),Zl=new Set(["stx","@stacksjs/stx"]),Ao=b(128),To=b(64);function ql(e){let t=[],i=0,n=e.split(`
402
- `);for(let c of n){let l=i,a=null,y=!1;for(let v=0;v<c.length;v++){let E=c[v];if(y){y=!1;continue}if(E==="\\"){y=!0;continue}if(a){if(E===a)a=null;continue}if(E==="'"||E==='"'||E==="`"){a=E;continue}if(E==="/"&&v+1<c.length&&c[v+1]==="/")break;if(E==="{")i++;else if(E==="}")i--}if(l===0){let v=c.match(/(?:const|let|var)\s+(\w+)\s*=/);if(v)t.push(v[1]);else if(/^\s*(?:const|let|var)\s+\w+\s*;?\s*$/.test(c)){let E=c.match(/(?:const|let|var)\s+(\w+)/);if(E)t.push(E[1])}else{let E=c.match(/(?:const|let|var)\s+(\{[^}]+\}|\[[^\]]+\])\s*=/);if(E){let M=E[1].slice(1,-1).split(",").map((X)=>{let D=X.split(":");return(D.length>1?D[1]:D[0]).trim()}).filter((X)=>/^\w+$/.test(X));t.push(...M)}}}}return[...new Set(t)]}function Yf(e){let t=e;t=t.replace(/^\s*import\s+.*?from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),t=t.replace(/^\s*import\s+['"][^'"]+['"]\s*;?\s*$/gm,""),t=t.replace(/^\s*interface\s+\w+\s*\{[\s\S]*?\n\}\s*$/gm,""),t=t.replace(/^\s*type\s+\w+\s*=[\s\S]*?(?=\n(?:const|let|var|function|export|interface|type|$))/gm,""),t=t.replace(/^(\s*(?:export\s+)?(?:const|let|var)\s+)(\w+|\{[^}]+\}|\[[^\]]+\])\s*:\s*[^=]+(\s*=)/gm,"$1$2$3");function i(n){if(!n.includes(":"))return n;let c=[],l="",a=0,y=0,v=null;for(let E=0;E<n.length;E++){let A=n[E];if(v){if(l+=A,A===v)v=null;continue}if(A==='"'||A==="'"||A==="`"){v=A,l+=A;continue}if(A==="<")a++;else if(A===">"&&a>0)a--;else if(A==="(")y++;else if(A===")")y--;if(A===","&&a===0&&y===0){c.push(l),l="";continue}l+=A}if(l)c.push(l);return c.map((E)=>{let A=E.trim(),M=A.startsWith("..."),X=M?A.slice(3):A,D=-1,I=0;for(let ne=0;ne<X.length;ne++)if(X[ne]==="<")I++;else if(X[ne]===">")I--;else if(X[ne]===":"&&I===0){D=ne;break}if(D===-1)return E;let L=X.substring(0,D).trim().replace(/\?$/,""),z=X.substring(D+1),Q=-1,j=0;for(let ne=0;ne<z.length;ne++)if(z[ne]==="<")j++;else if(z[ne]===">")j--;else if(z[ne]==="="&&j===0){Q=ne;break}let ee=M?"...":"";if(Q!==-1)return`${ee}${L} = ${z.substring(Q+1).trim()}`;return`${ee}${L}`}).join(", ")}t=t.replace(/\b(function\s+\w*\s*)\(([^)]*)\)/g,(n,c,l)=>{if(!l.includes(":"))return n;return`${c}(${i(l)})`});{let n=/\b(function\s+\w*\s*)\(/g,c,l=[];while((c=n.exec(t))!==null){let a=c.index+c[0].length-1,y=1,v=a+1,E=0,A=null;while(v<t.length&&y>0){let D=t[v];if(A){if(D===A)A=null;v++;continue}if(D==='"'||D==="'"||D==="`"){A=D,v++;continue}if(D==="<")E++;else if(D===">"&&E>0)E--;else if(E===0){if(D==="(")y++;else if(D===")")y--}if(y>0)v++}if(y!==0)continue;let M=t.substring(a+1,v);if(!M.includes(":"))continue;let X=i(M);l.push({start:a+1,end:v,replacement:X})}for(let a=l.length-1;a>=0;a--){let{start:y,end:v,replacement:E}=l[a];t=t.substring(0,y)+E+t.substring(v)}}return t=t.replace(/\(([^)]*)\)\s*(?::\s*[^=]+)?\s*=>/g,(n,c)=>{if(!c.includes(":"))return n;if(c.includes("{")||c.includes("}"))return n;return`(${c.split(",").map((a)=>{let[y,...v]=a.split("="),E=y.split(":")[0].trim();if(v.length>0)return`${E} = ${v.join("=").trim()}`;return E}).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,`
403
-
404
- `),t}function Zf(e){return e.replace(/\s*(?:imported from|from)\s+(?:(['"])([^'"\r\n]+)\1|(\S+))/g,(t,...i)=>{let[,n,c]=i,l=n??c;return/(?:[/\\]packages[/\\]stx[/\\]|@stacksjs[/\\]stx[/\\])/.test(l)?"":t})}function Qf(e){return/cannot find module|cannot find package|could not resolve|module not found|failed to resolve/i.test(e)}function eg(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 tg(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 Io=new Set;async function m(e,t,i,n={}){if(!e.trim())return;let c=C(),l=x(e,JSON.stringify(c)),a=Ao.get(l);if(a===void 0){try{let se=Y({loader:"ts",target:"browser",define:c}),ie=e.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");ie=ie.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,""),a=se.transformSync(ie)}catch{a=Yf(e)}Ao.set(l,a)}let y={exports:{}},v=y.exports,E=Ct.cwd(),A={},M=[...a.matchAll(/require\s*\(\s*['"]([^'"]+)['"]\s*\)/g)||[]].map((se)=>se[1]).filter((se)=>!se.startsWith("node:")&&!["fs","path","os","child_process","crypto","http","https","url","util","stream","events","buffer","net","querystring","zlib","tls"].includes(se)),X=new Map;for(let se of M)try{if(se.startsWith(".")){A[se]=await import(nt.resolve(nt.dirname(i),se));continue}let ie=nt.resolve(E,"node_modules",se),me=nt.join(ie,"package.json"),$e=JSON.parse(g("fs").readFileSync(me,"utf8")),Re=$e.main||"index.js";if($e.exports){let Ze=typeof $e.exports==="string"?$e.exports:$e.exports["."];if(typeof Ze==="string")Re=Ze;else if(Ze?.bun)Re=Ze.bun;else if(Ze?.import)Re=Ze.import;else if(Ze?.default)Re=Ze.default}A[se]=await import(nt.resolve(ie,Re))}catch(ie){if(se.startsWith("."))X.set(se,ie instanceof Error?ie.message:String(ie))}let D=(se)=>{if(A[se])return A[se];let ie=X.get(se);if(ie!==void 0)throw Error(`Cannot require '${se}' from ${i}: ${ie}`);return g(se)},I=t.props||{},B=(se)=>{if(!se)return I;let ie={};for(let[me,$e]of Object.entries(se)){let Re=I[me];if(Re!==void 0)ie[me]=Re;else if(typeof $e==="function")ie[me]=$e();else ie[me]=$e}return ie};for(let[se,ie]of Object.entries(I))Object.defineProperty(B,se,{value:ie,enumerable:!0,configurable:!0,writable:!0});let L=(se,ie=!1)=>{if(se===void 0||se===null)return ie;if(typeof se==="string"){let me=se.trim().toLowerCase();if(me===""||me==="true"||me==="1"||me==="on"||me==="yes")return!0;if(me==="false"||me==="0"||me==="off"||me==="no")return!1;return!0}return Boolean(se)},z=(se,ie=0)=>{if(se===void 0||se===null)return ie;if(typeof se==="string"){let $e=se.trim();if($e==="")return ie;let Re=Number($e);return Number.isFinite(Re)?Re:ie}let me=Number(se);return Number.isFinite(me)?me:ie};for(let se of["name","length","caller","arguments"]){if(Object.prototype.hasOwnProperty.call(I,se))continue;try{Object.defineProperty(B,se,{value:void 0,enumerable:!1,configurable:!0,writable:!0})}catch{}}let Q=(se)=>{if(!se)return I;let ie={...I};for(let[me,$e]of Object.entries(se)){let Re=$e&&typeof $e==="object"&&!Array.isArray($e)?$e:{type:$e};if(ie[me]===void 0&&Re.default!==void 0)ie[me]=typeof Re.default==="function"?Re.default():Re.default}return ie},j=()=>t.slots||{},ee=(se,ie)=>{let me={...se};for(let[$e,Re]of Object.entries(ie))if(me[$e]===void 0)if(typeof Re==="function")me[$e]=Re();else me[$e]=Re;return me},ne=(se)=>{let ie=()=>se;return ie.set=(me)=>{},ie.update=(me)=>{},ie},te=(se)=>{let ie,me=!1;return()=>{if(!me)try{ie=se(),me=!0}catch{ie=void 0}return ie}},le=(se)=>{},he=(se)=>se(),ue=(se)=>{},Ce=(se)=>{},Ae=Fs(t);function We(se){let ie=se||{};if(ie.title!==void 0||ie.description!==void 0)Je({title:ie.title,description:ie.description})}function Ke(se){if(!se||typeof se!=="object")return;let ie=t.__stxClientPayload??{};Object.assign(ie,se),t.__stxClientPayload=ie}let Ge=()=>{let se=t.__stxServeContext,ie=t.__stxServeSearch??se?.search??"",me=se?.path??"",$e=Object.fromEntries(new URLSearchParams(ie)),Re=t.query,Ze=Object.keys($e).length>0?$e:Re??{},ot=ie||(Object.keys(Ze).length>0?`?${new URLSearchParams(Ze).toString()}`:"");return{params:t.params??{},query:Ze,path:me,name:"",fullPath:me+ot,hash:"",matched:[]}},Xe=()=>({push:(se)=>{},replace:(se)=>{},back:()=>{},forward:()=>{},go:(se)=>{}}),et=(se)=>{let ie=t.__stx_runtime_head||{};t.__stx_runtime_head=Ve(ie,_e(se||{},{known:Js,source:"useHead()"}))},Je=(se)=>{et(Ys(se||{}))},gt=(se)=>({value:se}),Tt=(se)=>se,rr=(se)=>({value:typeof se==="function"?se():se}),lt=(se,ie)=>{},Ue=(se)=>{},Dt=(se)=>{},sn=(se)=>se?se():Promise.resolve(),Xn=(se)=>(ie,...me)=>{},Lt=(se)=>{},Ye=(se,ie)=>{},Bt=(se,ie)=>ie,Jn=()=>({value:"light"}),bt=()=>ne(!1),st=(se)=>ne(!1),Wt=()=>ne(!1),rn=()=>st("(prefers-color-scheme: dark)"),zt=()=>st("(prefers-color-scheme: light)"),Ft=()=>st("(prefers-reduced-motion: reduce)"),ir=()=>st("(prefers-contrast: more)"),Qe={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:{}},Vt=new Proxy(Qe,{get(se,ie){if(ie in se)return se[ie];return},set(se,ie,me){return se[ie]=me,!0}}),Gn={getElementById:()=>null,querySelector:()=>null,querySelectorAll:()=>[],createElement:()=>({}),createTextNode:()=>({}),body:{},head:{},documentElement:{},addEventListener:()=>{},removeEventListener:()=>{}},it=console;try{let se=gi(a,i),ie=new Set(Object.keys(I)),me=Object.keys(t).filter((re)=>!ie.has(re)&&!Hl.has(re)&&jt(re)),$e=me.map((re)=>t[re]);if(!me.includes("__stxServeContext"))me.push("__stxServeContext"),$e.push(void 0);if(!ie.has("cookies")){let re=t.cookies??t.__stxServeContext?.cookies??{},ae=me.indexOf("cookies");if(ae<0)me.push("cookies"),$e.push(re);else $e[ae]=re}let Re=new Set(["async","module","exports","require","params","window","document","console","state","derived","effect"]),Ze=[],ot=[];for(let[re,ae]of Object.entries(I)){if(!jt(re))continue;if(Re.has(re))continue;if(new RegExp(`(?:^|[\\s;{])(?:const|let|var|function)\\s+${re}\\b`).test(se))continue;Ze.push(re),ot.push(ae)}let Qn=ql(se).map((re)=>`module.exports.${re} = typeof ${re} !== 'undefined' ? ${re} : module.exports.${re};`).join(`
405
- `),on=t.params??{},Ut=[],Ht=[];for(let re=0;re<me.length;re++){if(me[re]==="params")continue;Ut.push(me[re]),Ht.push($e[re])}let cn=[...hn,...Ze,...Ut],an=`return (async () => {
406
- ${se}
407
- ${Qn}
408
- return module.exports
409
- })()`,tt=x(an,cn.join("\x00")),ut=To.get(tt);if(!ut)ut=Function(...cn,an),To.set(tt,ut);let ct=t.__stx_options?.runtimeConfig;if(ct||/\buse(?:Server)?RuntimeConfig\b/.test(a))await vn(t,i,ct);let qe=await ze(t.__stx_runtime_config??xn()??N(),()=>pr(t,()=>ut(y,v,D,I,B,L,z,Q,ee,Ke,dr,xi,Ws,ne,te,le,he,ue,Ce,We,Ge,Xe,et,Je,Ae.setResponseStatus,Ae.setResponseHeader,Ae.notFound,gt,Tt,rr,lt,Ue,Dt,sn,Xn,Lt,j,Ye,Bt,Jn,bt,st,Wt,rn,zt,Ft,ir,Vt,Gn,it,Qe.confirm,Qe.alert,Qe.fetch,on,...ot,...Ht)));if(n.preserveExisting){for(let[re,ae]of Object.entries(qe))if(!(re in t)||t[re]===void 0)t[re]=ae}else Object.assign(t,qe);for(let[re,ae]of Object.entries(I))if(!(re in t))t[re]=ae}catch(se){if(t.__stx_strict_hydration)throw se;let ie=Zf(se instanceof Error?se.message:String(se));if(Qf(ie))console.warn(`[stx] server <script> in ${i??"<unknown>"} imports a module that does not resolve, so every variable in that script is undefined. Cause: ${ie}`),n.onFailure?.({kind:"module-resolution",message:ie,error:se});else if(eg(se))console.warn(`[stx] server <script> in ${i??"<unknown>"} does not parse, so every variable in that script is undefined. Cause: ${ie}`),n.onFailure?.({kind:"syntax",message:ie,error:se});else if(tg(ie))console.warn(`[stx] server <script> in ${i??"<unknown>"} names something that does not exist, so every variable in that script is undefined. Optional chaining does not help here: an undefined identifier throws before the chain is reached. Cause: ${ie}`),n.onFailure?.({kind:"missing-binding",message:ie,error:se});else{let me=`${i??"<unknown>"}\x00${ie}`;if(Ct.env.STX_DEBUG||!Io.has(me))Io.add(me),console.warn(`[stx] server <script> in ${i??"<unknown>"} threw, so every variable in that script is undefined and anything that reads one renders empty. Cause: ${ie}`);n.onFailure?.({kind:"unknown",message:ie,error:se})}try{await Ql(a,t,i)}catch(me){if(Ct.env.STX_DEBUG){let $e=me instanceof Error?me.message:String(me);console.warn(`[stx] fallback extraction also failed in ${i??"<unknown>"}: ${$e}`)}}}}function ng(e){let t=0,i=null,n=!1,c=!1;for(let l=0;l<e.length;l++){let a=e[l];if(i){if(a===i){if(i=null,n||t===0)c=!0}continue}if(a==="'"||a==='"'||a==="`"){i=a;continue}if(a==="{")t++;else if(a==="}")t--;else if(e.startsWith("from",l)&&t===0)n=!0}return i===null&&t===0&&c}var Kl=/^(?:export\s+)?(?:const|let|var)\s+[A-Za-z_$][\w$]*(?:\s*,\s*[A-Za-z_$][\w$]*)*\s*;?$/;function gi(e,t){let i=t?nt.dirname(t):Ct.cwd(),n=Ct.cwd(),c=e.split(`
410
- `),l=[],a=0;while(a<c.length){let y=c[a].trim();if(y.startsWith("interface ")||y.startsWith("export interface ")||y.startsWith("type ")||y.startsWith("export type ")){if(y.includes("{")&&!y.includes("}")){let v=0;for(;a<c.length;a++){for(let E of c[a])if(E==="{")v++;else if(E==="}")v--;if(v<=0)break}}a++;continue}if(y.startsWith("definePageMeta(")){let v=0,E=!1,A=a;for(let D=a;D<c.length&&!E;D++){let I=null,B=!1,L=c[D];for(let z=0;z<L.length;z++){let Q=L[z];if(B){B=!1;continue}if(Q==="\\"){B=!0;continue}if(I){if(Q===I)I=null;continue}if(Q==='"'||Q==="'"||Q==="`"){I=Q;continue}if(Q==="(")v++;else if(Q===")"){if(v--,v===0){a=D+1,E=!0;break}}}}if(!E)a=c.length;let M=c.slice(A,a).join(`
411
- `),X=[];for(let D of["title","description"]){let I=new RegExp(`\\b${D}\\s*:\\s*(['"\`])((?:\\\\.|(?!\\1)[^\\\\])*)\\1`).exec(M);if(I)X.push(`${D}: ${JSON.stringify(I[2])}`)}if(X.length>0)l.push(`useSeoMeta({ ${X.join(", ")} });`);continue}if(y.startsWith("import ")||y==="import"||y.startsWith("import{")||/^import['"]/.test(y)){let v=y,E=0;while(!ng(v)&&a+E+1<c.length)E++,v=`${v} ${c[a+E].trim()}`;a+=E;let A=v.match(/^import\s+(\w+)\s+from\s+['"](.+?)['"]/),M=v.match(/^import\s+\{([^}]*)\}\s+from\s+['"](.+?)['"]/),X=v.match(/^import\s*['"](.+?)['"]/),D=v,I=(B)=>{if(B.startsWith("."))return nt.resolve(i,B);if(B.startsWith("~/")||B.startsWith("@/"))return nt.resolve(n,B.slice(2));try{return Bun.resolveSync(B,i)}catch{return B}};if(A){let[,B,L]=A,z=I(L);l.push(`const ${B} = (await import('${z}')).default`),l.push(`module.exports.${B} = ${B};`)}else if(M){let[,B,L]=M,z=I(L),Q=[],j=[],ee=Zl.has(L);for(let ne of B.split(",")){let te=ne.trim();if(!te)continue;let le=te.split(/\s+as\s+/);if(le.length===2){let[he,ue]=[le[0].trim(),le[1].trim()];if(ee&&Ro.has(he)){l.push(`const ${ue} = ${he};`);continue}Q.push(`${he}: ${ue}`),j.push(ue)}else{if(ee&&Ro.has(te))continue;Q.push(te),j.push(te)}}if(Q.length>0)l.push(`const { ${Q.join(", ")} } = await import('${z}')`);for(let ne of j)l.push(`module.exports.${ne} = ${ne};`)}else if(X){let B=I(X[1]);l.push(`await import('${B}')`)}else l.push(D);a++;continue}if(Kl.test(y))l.push(c[a]),a++;else if(y.startsWith("export const ")||y.startsWith("export let ")||y.startsWith("export var ")){let v=Po(c,a),{type:E,name:A,value:M}=v;l.push(`${E} ${A} = ${M};`),l.push(`module.exports.${A} = ${A};`),a=v.nextIndex}else if(y.startsWith("export function ")||y.startsWith("export async function ")){let v=sr(c,a);l.push(v.functionCode),l.push(`module.exports.${v.name} = ${v.name};`),a=v.nextIndex}else if(y.startsWith("const ")||y.startsWith("let ")||y.startsWith("var ")){let v=Po(c,a),{type:E,name:A,value:M}=v;l.push(`${E} ${A} = ${M};`),l.push(`module.exports.${A} = ${A};`),a=v.nextIndex}else if(y.startsWith("function ")||y.startsWith("async function ")){let v=sr(c,a);l.push(v.functionCode),l.push(`module.exports.${v.name} = ${v.name};`),a=v.nextIndex}else if(y.startsWith("export default function ")||y.startsWith("export default async function ")){let v=c[a].replace(/^(\s*)export\s+default\s+/,"$1"),E=[...c];E[a]=v;let A=sr(E,a);if(l.push(A.functionCode),A.name)l.push(`module.exports.default = ${A.name};`);a=A.nextIndex}else if(y.startsWith("export default ")){let v=y.replace(/^export\s+default\s+/,"").replace(/;$/,"");l.push(`module.exports.default = ${v};`),a++}else if(y.startsWith("class ")||y.startsWith("export class ")){let v=y.match(/(?:export\s+)?class\s+(\w+)/);if(v){let E=v[1],A=c[a].replace(/^export\s+/,""),M=0,X=a;for(;X<c.length;X++){let D=c[X];for(let I of D)if(I==="{")M++;else if(I==="}")M--;if(X>a)A+=`
412
- `+D;if(M<=0&&X>=a)break}l.push(A),l.push(`module.exports.${E} = ${E};`),a=X+1}else l.push(y),a++}else if(y.includes("module.exports"))l.push(y),a++;else if(y.trim()&&!y.startsWith("//"))l.push(y),a++;else a++}return Xl(l.join(`
413
- `),i,n)}function Xl(e,t,i){let n=e.length,c="",l=0,a=null,y=!1,v=!1,E=0;while(l<n){let A=e[l],M=e[l+1];if(y){if(c+=A,A===`
414
- `)y=!1;l++;continue}if(v){if(c+=A,A==="*"&&M==="/"){c+=M,l+=2,v=!1;continue}l++;continue}if(!a&&A==="/"&&M==="/"){y=!0,c+=A,l++;continue}if(!a&&A==="/"&&M==="*"){v=!0,c+=A,l++;continue}if(a){if(c+=A,A==="\\"){c+=M,l+=2;continue}if(A===a&&a!=="`"){a=null,l++;continue}if(a==="`"){if(A==="$"&&M==="{"){E++,c+=M,l+=2;continue}if(A==="`"){a=null,l++;continue}}l++;continue}if(E>0){if(A==="{")E++;else if(A==="}")E--}if(A==='"'||A==="'"||A==="`"){a=A,c+=A,l++;continue}if(A==="a"&&e.startsWith("await",l)){let X=Jl(e,l);if(X){let{quote:D,path:I,end:B}=X;if(I.startsWith(".")||I.startsWith("~/")||I.startsWith("@/")){let L=I.startsWith(".")?nt.resolve(t,I):nt.resolve(i,I.slice(2));c+=`await import(${D}${L}${D})`,l=B;continue}}}c+=A,l++}return c}function Jl(e,t){let i=t+5;if(i>=e.length)return null;if(!/\s/.test(e[i]))return null;while(i<e.length&&/\s/.test(e[i]))i++;if(!e.startsWith("import",i))return null;i+=6;while(i<e.length&&/\s/.test(e[i]))i++;if(e[i]!=="(")return null;i++;while(i<e.length&&/\s/.test(e[i]))i++;let n=e[i];if(n!=="'"&&n!=='"')return null;i++;let c=i;while(i<e.length&&e[i]!==n)if(e[i]==="\\")i+=2;else i++;if(i>=e.length)return null;let l=e.slice(c,i);i++;while(i<e.length&&/\s/.test(e[i]))i++;if(e[i]!==")")return null;return{quote:n,path:l,end:i+1}}function No(e,t){let i=e[t];if(i!=="{"&&i!=="[")return null;let c=w(e,i,i==="{"?"}":"]",t);if(c===-1)return null;return{pattern:e.slice(t,c+1),endPos:c+1}}function Lo(e){let t=[],i=e.slice(1,-1).trim();if(!i)return t;let n=0,c=0,l="";while(n<i.length){let a=i[n];if(a==="{"||a==="["){let y=c===0?No(i,n):null;if(y){t.push(...Lo(y.pattern)),n=y.endPos,l="";continue}c++}else if(a==="}"||a==="]")c--;if(c>0){n++;continue}if(a===","){if(l.trim())t.push(l.trim());l="",n++;continue}if(a===":"){l="",n++;continue}if(a==="="){if(l.trim())t.push(l.trim());l="",n++;while(n<i.length&&i[n]!==","&&c===0){if(i[n]==="{"||i[n]==="[")c++;else if(i[n]==="}"||i[n]==="]")c--;n++}continue}if(/[\w$]/.test(a))l+=a;n++}if(l.trim())t.push(l.trim());return t}function rg(e){let t=/^(?:export\s+)?(const|let|var)\s+([A-Za-z_$][\w$]*)/.exec(e);if(!t)return null;let i=t[0].length,n=(c)=>c===" "||c==="\t";while(i<e.length&&n(e[i]))i++;if(e[i]===":"){let c=0,l=null;i++;for(;i<e.length;i++){let a=e[i];if(l){if(a==="\\"){i++;continue}if(a===l)l=null;continue}if(a==="'"||a==='"'||a==="`"){l=a;continue}if(a==="("||a==="["||a==="{"||a==="<"){c++;continue}if(a===")"||a==="]"||a==="}"||a===">"){c--;continue}if(a==="="&&c<=0){let y=e[i+1],v=e[i-1];if(y!=="="&&y!==">"&&v!=="="&&v!=="!"&&v!=="<"&&v!==">")break}}if(e[i]!=="=")return null}while(i<e.length&&n(e[i]))i++;if(e[i]!=="=")return null;return{type:t[1],name:t[2],value:e.slice(i+1).trim()}}function Oo(e,t,i,n){let c=null,l=!1;for(let a of e){if(l){l=!1;continue}if(a==="\\"){l=!0;continue}if(c){if(a===c)c=null;continue}if(a==="'"||a==='"'||a==="`"){c=a;continue}if(a===t)n++;else if(a===i)n--}return n}function Po(e,t){let i=e[t].trim(),n=rg(i),c=n?[i,n.type,n.name,n.value]:null;if(!c){let A=i.match(/^(?:export\s+)?(const|let|var)\s+/);if(A){let M=i.slice(A[0].length),X=t;if(M.startsWith("{")||M.startsWith("[")){let I=M[0],B=I==="{"?"}":"]",L=Oo(M,I,B,0),z=M;for(let Q=t+1;Q<e.length&&L>0;Q++)z+=` ${e[Q].trim()}`,X=Q,L=Oo(e[Q],I,B,L);if(L>0)z=M,X=t;M=z}let D=No(M,0);if(D){let I=A[1],B=D.pattern,L=M.slice(D.endPos).trim();if(L.startsWith("=")){let z=L.slice(1).trim(),Q=z,j=Math.max(X,t);if(Do(z)){let le=Mo(e,j,z);Q=le.value,j=le.nextIndex}else j=j+1;Q=Q.trim().replace(/;$/,"");let ee=Lo(B),ne=`__stx_src_${t}`,te=ee.map((le)=>`module.exports.${le} = ${le};`).join(`
415
- `);return{type:I,name:ne,value:`${Q}; ${I} ${B} = ${ne};
416
- ${te}`,nextIndex:j}}}}throw Error(`Failed to parse variable declaration: ${i}`)}let[,l,a,y]=c,v=y,E=t;if(Do(y)){let A=Mo(e,t,y);v=A.value,E=A.nextIndex}else E=t+1;while(E<e.length){let A=e[E].trim();if(A.startsWith(".")||A.startsWith("?."))v+=`
417
- ${e[E]}`,E++;else break}return v=v.trim().replace(/;$/,""),{type:l,name:a,value:v,nextIndex:E}}function sr(e,t){let i=e[t].trim(),n=i.match(/^(?:export\s+)?(?:async\s+)?function\s+(\w+)/);if(!n)throw Error(`Failed to parse function declaration: ${i}`);let[,c]=n,l=i.replace(/^export\s+/,""),a=t;if(Gl(i)){let y=Yl(e,t,l);l=y.functionCode,a=y.nextIndex}else a=t+1;return{name:c,functionCode:l,nextIndex:a}}function Do(e){let t=e.trim();if(t.startsWith("{"))return w(t,"{","}",0)===-1;if(t.startsWith("["))return w(t,"[","]",0)===-1;return!Bo(t)}function Bo(e){let t={paren:0,bracket:0,brace:0},i=null,n=0;for(let c=0;c<e.length;c++){let l=e[c];if((c>0?e[c-1]:"")==="\\"&&i)continue;if((l==='"'||l==="'")&&!i){i=l;continue}if(l===i&&i!=="`"){i=null;continue}if(l==="`"&&!i){i="`";continue}if(l==="`"&&i==="`"&&n===0){i=null;continue}if(i==="`"&&l==="$"&&e[c+1]==="{"){n++,c++;continue}if(n>0&&l==="{"){n++;continue}if(n>0&&l==="}"){n--;continue}if(i)continue;if(l==="(")t.paren++;else if(l===")")t.paren--;else if(l==="[")t.bracket++;else if(l==="]")t.bracket--;else if(l==="{")t.brace++;else if(l==="}")t.brace--}return t.paren===0&&t.bracket===0&&t.brace===0&&i===null}function Wo(e){let t=e.indexOf("(");if(t===-1)return e.indexOf("{");let i=w(e,"(",")",t);if(i===-1)return-1;return e.indexOf("{",i)}function Gl(e){let t=Wo(e);if(t===-1)return!0;return w(e,"{","}",t)===-1}function Mo(e,t,i){let n=i,c=t+1;while(c<e.length&&!Bo(n)){let l=e[c];n+=`
418
- ${l}`,c++}while(c<e.length){let l=e[c].trim();if(l.startsWith(".")||l.startsWith("?."))n+=`
419
- ${e[c]}`,c++;else break}return{value:n,nextIndex:c}}function Yl(e,t,i){let n=i,c=t+1;while(c<e.length){let l=Wo(n);if(l!==-1){if(w(n,"{","}",l)!==-1)break}let a=e[c];n+=`
420
- ${a}`,c++}return{functionCode:n,nextIndex:c}}function jo(e,t){let i=u(e,t)??u(`(${e})`,t);if(i!==void 0)return i;if(!/\bprocess\b/.test(e))return;let n={...t,process:Object.freeze({env:{...Ct.env}})},c=Object.keys(n).filter(jt),l=c.map((a)=>n[a]);try{return Function(...c,`'use strict'; return (${e});`)(...l)}catch{try{return Function(...c,`'use strict'; return ${e};`)(...l)}catch{return}}}async function Ql(e,t,i){let n=e.matchAll(/export\s+(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:export\s+|$))/g);for(let l of n){let[,,a,y]=l;try{let v=y.trim().replace(/;$/,""),E=jo(v,t);if(E!==void 0)t[a]=E}catch(v){console.warn(`Failed to parse export ${a} in fallback:`,v)}}let c=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 c){let[,,a,y]=l;if(!(a in t))try{let v=y.trim().replace(/;$/,""),E=jo(v,t);if(E!==void 0)t[a]=E}catch{}}}function Uc(e){let t=e.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),i=t?t[1]:"",n=t?e.replace(/<script\b[^>]*>[\s\S]*?<\/script>/i,""):e;return{scriptContent:i,templateWithoutScript:n}}function Wc(e){let t=e.trim();if(!t)return!1;return/(?:const|let|var|function)\s+\w+/.test(t)}
421
- export{Pe,ve,H,Ps,Is,V,yr,Os,Ns,oi,ii,Ms,ai,$c,Rt,Ie,o,dn,b,Rc,x,br,Ds,xe,C,Oe,de,wr,W,pn,Ne,S,Ac,pe,G,vr,xr,oe,At,J,O,rt,Sr,kr,Pt,ci,Ls,Jf,Me,Pc,Ic,Oc,li,Nc,js,ui,Mc,Dc,di,pi,fn,Bs,gn,It,Ot,Lc,Fs,jc,mn,_r,zs,Hs,Bc,fi,Fc,zc,Hc,Vc,hn,Yf,Zf,Qf,eg,tg,m,ng,gi,rg,Uc,Wc,mi,hi,sg,Nt,qc,og,Kc,Kh,De,yn,Le,ig,ag,cg,lg,ug,Vs,dg,je,Y,Be,pg,Cr,fg,Xc,Gc,yi,Fe,s,bn,Jc,h,fe,Xh,Yc,Zc,Qc,bi,Us,gg,Gh,mg,Jh,Mt,p,U,Z,wn,Se,hg,wi,yg,Yh,_,bg,Zh,T,Qh};