@stacksjs/stx 0.2.814 → 0.2.816

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 (143) hide show
  1. package/dist/{chunk-4rny8rf5.js → chunk-0h99mrb0.js} +3 -3
  2. package/dist/chunk-0j8qrqke.js +2 -0
  3. package/dist/chunk-0yjm4j26.js +2 -0
  4. package/dist/{chunk-kvz01wzc.js → chunk-17wb2x3z.js} +2 -2
  5. package/dist/{chunk-bmkm1c8s.js → chunk-1bgv727x.js} +37 -5
  6. package/dist/{chunk-3efaf8v0.js → chunk-24354nk5.js} +2 -2
  7. package/dist/{chunk-he9zzsh4.js → chunk-2v7qvj69.js} +2 -2
  8. package/dist/{chunk-33x11khy.js → chunk-314zqrv0.js} +1 -1
  9. package/dist/{chunk-w5xq1217.js → chunk-3jd5ak8h.js} +1 -1
  10. package/dist/chunk-45gv3akm.js +2 -0
  11. package/dist/{chunk-9bt479pb.js → chunk-4vxbcf4a.js} +2 -2
  12. package/dist/{chunk-et8n16k2.js → chunk-4ypwqrj2.js} +1 -1
  13. package/dist/chunk-5b6tsg13.js +2 -0
  14. package/dist/{chunk-cfbpvm5e.js → chunk-5efv1fhk.js} +2 -2
  15. package/dist/{chunk-ethnqap6.js → chunk-5wcgqr21.js} +7 -7
  16. package/dist/{chunk-k86573fe.js → chunk-6cw072n5.js} +1 -1
  17. package/dist/{chunk-v0kn4q29.js → chunk-7bfsvkvd.js} +6 -6
  18. package/dist/{chunk-7aqdqfwf.js → chunk-7r5efkbz.js} +1 -1
  19. package/dist/{chunk-gebb12ak.js → chunk-7rk7wfm6.js} +6 -6
  20. package/dist/{chunk-ayq07qrz.js → chunk-8ca33v3s.js} +1 -1
  21. package/dist/{chunk-ewzdsksb.js → chunk-8g8h2xwz.js} +1 -1
  22. package/dist/{chunk-bejj0gra.js → chunk-8h3jv8dd.js} +1 -1
  23. package/dist/chunk-956zq9b7.js +2 -0
  24. package/dist/{chunk-t4j2rw91.js → chunk-981z8va1.js} +2 -2
  25. package/dist/{chunk-aqnfzse9.js → chunk-9avsdbz5.js} +2 -2
  26. package/dist/{chunk-ajg7tvn1.js → chunk-9d79afs9.js} +6 -6
  27. package/dist/{chunk-kf96nks9.js → chunk-9mnr9x0d.js} +2 -2
  28. package/dist/{chunk-qckgv0vz.js → chunk-9mtw71xy.js} +1 -1
  29. package/dist/{chunk-5za58geh.js → chunk-9t9qf38k.js} +20 -20
  30. package/dist/chunk-9yc4fw7e.js +2 -0
  31. package/dist/{chunk-x2hc3zth.js → chunk-a350jjd3.js} +1 -1
  32. package/dist/chunk-ar7w1kx0.js +2 -0
  33. package/dist/{chunk-hvdmhzad.js → chunk-atdn8n6b.js} +7 -7
  34. package/dist/{chunk-nsph6c12.js → chunk-azg5e5ts.js} +5 -5
  35. package/dist/chunk-b7vfs0cq.js +2 -0
  36. package/dist/{chunk-pr6nrg6x.js → chunk-b9ntt41z.js} +1 -1
  37. package/dist/{chunk-vyad54bv.js → chunk-be2stv5x.js} +1 -1
  38. package/dist/{chunk-x94q5ptn.js → chunk-bxtwbkc1.js} +1 -1
  39. package/dist/{chunk-9jdqxsna.js → chunk-c6w39fdb.js} +4 -4
  40. package/dist/chunk-c8vhjxm9.js +2 -0
  41. package/dist/{chunk-m5q50ct0.js → chunk-d3d5s0va.js} +1 -1
  42. package/dist/{chunk-49r48cjj.js → chunk-e2855m6w.js} +1 -1
  43. package/dist/{chunk-8zexecar.js → chunk-e58g2n9k.js} +1 -1
  44. package/dist/{chunk-1carv1dw.js → chunk-f54t0qar.js} +1 -1
  45. package/dist/{chunk-v6p8tf1x.js → chunk-f8zs50z0.js} +1 -1
  46. package/dist/{chunk-0dm38zt6.js → chunk-g74r0edp.js} +3 -3
  47. package/dist/chunk-geyvz4ae.js +2 -0
  48. package/dist/chunk-gqe0hnbb.js +2 -0
  49. package/dist/{chunk-1d6ef8g9.js → chunk-h5c786jf.js} +20 -20
  50. package/dist/{chunk-3z0e637x.js → chunk-jg9f5nqf.js} +5 -5
  51. package/dist/chunk-jham85mf.js +2 -0
  52. package/dist/{chunk-b682cfc9.js → chunk-jrjd02kf.js} +4 -4
  53. package/dist/{chunk-vgpnjrq4.js → chunk-k4xkbk2z.js} +1 -1
  54. package/dist/{chunk-qfqv3fjm.js → chunk-kq40yvdh.js} +1 -1
  55. package/dist/{chunk-dvbd5fxe.js → chunk-kvhsdyfg.js} +1 -1
  56. package/dist/{chunk-y7sf7aj0.js → chunk-m0x96g8e.js} +1 -1
  57. package/dist/{chunk-cbx7qght.js → chunk-mkr46mzz.js} +1 -1
  58. package/dist/{chunk-ycr9bkww.js → chunk-mmyrdbxx.js} +1 -1
  59. package/dist/{chunk-ybjfr7e8.js → chunk-n761hp6d.js} +2 -2
  60. package/dist/chunk-nctnc7tn.js +2 -0
  61. package/dist/{chunk-cxsxb3bc.js → chunk-nkb214z1.js} +8 -8
  62. package/dist/{chunk-rx5ak659.js → chunk-nqcqench.js} +102 -101
  63. package/dist/chunk-nr58sedd.js +2 -0
  64. package/dist/{chunk-bfm5cedw.js → chunk-ntn6bnjv.js} +2 -2
  65. package/dist/{chunk-p0qf405e.js → chunk-p0fp7p7x.js} +1 -1
  66. package/dist/chunk-p7tg362f.js +2 -0
  67. package/dist/{chunk-91re9xtj.js → chunk-pkjza0vv.js} +3 -3
  68. package/dist/{chunk-3pz8yag9.js → chunk-ps3t15gp.js} +1 -1
  69. package/dist/{chunk-mmh2k7ab.js → chunk-pyytr30r.js} +5 -5
  70. package/dist/chunk-qffx1nqg.js +2 -0
  71. package/dist/chunk-qn6y53v0.js +2 -0
  72. package/dist/chunk-qyxr6kq1.js +20 -0
  73. package/dist/{chunk-jj5b4h6f.js → chunk-qz8bz1f2.js} +1 -1
  74. package/dist/chunk-r4kdwpbh.js +2 -0
  75. package/dist/{chunk-r1vkk7qp.js → chunk-r5nt1bcx.js} +1 -1
  76. package/dist/{chunk-3ec6jf9b.js → chunk-r6dtrd7y.js} +3 -3
  77. package/dist/chunk-sj4vw93g.js +2 -0
  78. package/dist/chunk-spgf7r7h.js +2 -0
  79. package/dist/chunk-sxhya0hd.js +2 -0
  80. package/dist/{chunk-vbc8a8fh.js → chunk-t2sg2tp2.js} +2 -2
  81. package/dist/chunk-tnjzhbkc.js +2 -0
  82. package/dist/{chunk-vshskj73.js → chunk-tvc5n28s.js} +1 -1
  83. package/dist/chunk-veh49fc5.js +2 -0
  84. package/dist/chunk-vft84x6s.js +2 -0
  85. package/dist/{chunk-fzzfy1yh.js → chunk-vn6jxchy.js} +1 -1
  86. package/dist/chunk-wbkca2se.js +2 -0
  87. package/dist/{chunk-ta1yzmz8.js → chunk-wbzgtf5c.js} +1 -1
  88. package/dist/{chunk-46vd0375.js → chunk-wrygfmhf.js} +1 -1
  89. package/dist/{chunk-86vcmh2x.js → chunk-x6fpj9hh.js} +1 -1
  90. package/dist/{chunk-dcc0ejtd.js → chunk-y4xcym3k.js} +2 -2
  91. package/dist/{chunk-gb3tv53p.js → chunk-yts2b9d8.js} +2 -2
  92. package/dist/{chunk-40zwjmta.js → chunk-z87g05z5.js} +1 -1
  93. package/dist/{chunk-p6g80v4p.js → chunk-zcb34wfr.js} +1 -1
  94. package/dist/chunk-zjw5gm1n.js +2 -0
  95. package/dist/chunk-zkzp1ckd.js +3 -0
  96. package/dist/cli.js +12 -12
  97. package/dist/component-resolution.d.ts +33 -0
  98. package/dist/component-resolution.js +30 -0
  99. package/dist/craft-entry.js +2 -2
  100. package/dist/craft.js +2 -2
  101. package/dist/media/client/upload-fetch.d.ts +6 -0
  102. package/dist/media/client/upload-fetch.js +62 -0
  103. package/dist/native/bridge/protocol.d.ts +2 -1
  104. package/dist/native/bridge/protocol.js +27 -4
  105. package/dist/native/runtime/craft-bridge.js +29 -7
  106. package/dist/native/runtime/craft.d.ts +1 -0
  107. package/dist/pwa.js +1 -1
  108. package/dist/runtime-injection.js +2 -0
  109. package/dist/ssg.js +4 -4
  110. package/dist/stx-virtual-ts.d.ts +26 -5
  111. package/dist/stx-virtual-ts.js +67 -11
  112. package/dist/typecheck.js +6 -4
  113. package/dist/types/config-types.d.ts +1 -0
  114. package/dist/utils.js +6 -3
  115. package/package.json +5 -5
  116. package/dist/chunk-0gf0ny6y.js +0 -2
  117. package/dist/chunk-1ydz2w3t.js +0 -2
  118. package/dist/chunk-2a4dhkdw.js +0 -2
  119. package/dist/chunk-2m60sqvs.js +0 -2
  120. package/dist/chunk-526n626z.js +0 -2
  121. package/dist/chunk-54w0epxq.js +0 -2
  122. package/dist/chunk-6dcc4ezx.js +0 -2
  123. package/dist/chunk-7kj3g9bx.js +0 -2
  124. package/dist/chunk-85w7kf2j.js +0 -2
  125. package/dist/chunk-88ftnhm9.js +0 -2
  126. package/dist/chunk-9107scv6.js +0 -2
  127. package/dist/chunk-9fhgy5y5.js +0 -2
  128. package/dist/chunk-9gyy6z1d.js +0 -2
  129. package/dist/chunk-bkq60hpn.js +0 -2
  130. package/dist/chunk-e8zf4fqg.js +0 -2
  131. package/dist/chunk-h7257fsm.js +0 -2
  132. package/dist/chunk-hhahbv6g.js +0 -2
  133. package/dist/chunk-jt6k606s.js +0 -2
  134. package/dist/chunk-mmy3h4ye.js +0 -2
  135. package/dist/chunk-nq8bw7cm.js +0 -2
  136. package/dist/chunk-nz0cgrt9.js +0 -2
  137. package/dist/chunk-pjv91e8z.js +0 -20
  138. package/dist/chunk-pnbh9fgm.js +0 -2
  139. package/dist/chunk-qsepyy1p.js +0 -2
  140. package/dist/chunk-skjwswd8.js +0 -3
  141. package/dist/chunk-tdcgskyy.js +0 -2
  142. package/dist/chunk-w717cyka.js +0 -2
  143. package/dist/chunk-z27n1z4f.js +0 -2
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{ze,xn,Ws,xi,N}from"./chunk-m7hfcxt3.js";import{vn}from"./chunk-qfqv3fjm.js";import{Nr,k,ll,at,Ri,ul}from"./chunk-ybjfr7e8.js";import{P}from"./chunk-r9e0r6jx.js";import{R,qs,u,f,jt,d,q,F,w,Js,_e,Ve,Ys}from"./chunk-gebb12ak.js";import{r,ge}from"./chunk-3vpgr6nk.js";import{g}from"./chunk-0dve54ne.js";import{K}from"./chunk-c5vzr1va.js";import Qe from"path";import kt from"process";import{AsyncLocalStorage as Bo}from"async_hooks";var cr=new Bo;function mn(e){return e.__stx_server_data??={pending:new Map,values:new Map}}function ar(e,t){return cr.run(mn(e),t)}async function lr(e,t){let i=cr.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 Cr(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 j=I.trim();if(!j)return;let Q=j.indexOf(":"),z=(Q>=0?j.slice(Q+1).trim():j).split(/[\s=]/)[0];if(z&&!c.has(z))n.push(z),c.add(z)});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 j=I.trim().replace(/^\.\.\./,"");if(!j)return;let Q=j.split(/[\s=]/)[0];if(Q&&!c.has(Q))n.push(Q),c.add(Q)});return}if(t)return;let B=i.slice(a).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(B){let I=B[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 Is(e){return`{ enumerable: true, configurable: true, get() { return ${e} }, set(__stxValue_${e}) { ${e} = __stxValue_${e} } }`}function Wo(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 Os(e,t){let i=`{ ${Wo(e,t)} }`;return H(e).split(",").some((n)=>n.trim()==="__stxLiveBindings")?`Object.defineProperties(${i}, Object.getOwnPropertyDescriptors(__stxLiveBindings))`:i}import An from"fs";import Te 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 ur=new Map;function yr(e,t=!0){let i=ur.get(e);if(t&&i)return i;let n=new Map,c=[Te.join(e,"src"),Te.join(e,"dist"),e];function l(a,y){if(y>6)return;let v;try{v=An.readdirSync(a,{withFileTypes:!0})}catch{return}for(let E of v){let A=Te.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 B=M.toLowerCase();if(!n.has(B))n.set(B,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)ur.set(e,n);return n}function Ns(e,t){if(e.startsWith(".")||e.startsWith("/"))return null;let i=t;while(!0){let n=Te.join(i,"node_modules",e);try{if(An.statSync(n).isDirectory())return n}catch{}let c=Te.dirname(i);if(c===i)return null;i=c}}function Ms(e,t,i={}){return[Te.resolve(Te.dirname(t),`${e}.stx`),Te.resolve(Te.dirname(t),e),Te.resolve(i.componentsDir||"components",`${e}.stx`),Te.resolve(i.componentsDir||"components",e),e.endsWith(".stx")?e:`${e}.stx`]}function fr(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]=fr(e);for(let l of[i,i.toLowerCase(),n,c]){let a=t?.__importedComponents?.get(l);if(a!==void 0)return a}}function*ii(e,t,i={},n){let c=fr(e);if(c[0].startsWith("./")||c[0].startsWith("../")){yield Te.resolve(Te.dirname(t),`${c[0]}.stx`);return}let l=[...new Set(c.map((v)=>`${v}.stx`))],a=i.projectRoot||process.cwd(),y=[...n?.__originalFilePath?[Te.join(Te.dirname(n.__originalFilePath),"components")]:[],...i.componentsDir?[i.componentsDir]:[],Te.join(Te.dirname(t),"components"),Te.resolve(a,"src/components"),Te.resolve(a,"components"),...import.meta.dir?[Te.resolve(import.meta.dir,"components")]:[]];for(let v of new Set(y)){for(let E of l)yield Te.join(v,E);try{for(let E of An.readdirSync(v,{withFileTypes:!0}))if(E.isDirectory())for(let A of l)yield Te.join(v,E.name,A)}catch{}}}function pr(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(An.statSync(l,{throwIfNoEntry:!1})?.isFile())return l}catch{}return null}function Ds(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 Zn from"fs";import ce from"path";import ht from"path";import Kt from"fs";var zo=new Set(["touchstart","touchmove","wheel","mousewheel"]);function cs(e,t){if(t.passive)return!0;if(t.prevent||t.nonpassive)return!1;return zo.has(e.toLowerCase())}var dr=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"]),gr={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"},Fo=new Set(["ctrl","alt","shift","meta"]),$r={left:0,middle:1,right:2};function mr(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(Fo.has(n))t.systemKeys.push(n);else if(n in $r)t.mouse=n;else if(n in gr||/^[a-z]$/.test(n))t.keys.push(gr[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 Rr(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++}`,B=[],D=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,I;while((I=D.exec(v))!==null){let[,Q,X]=I,z=Q.split("."),L=z[0];if(!dr.has(L))continue;B.push({attribute:`@${Q}`,event:L,handler:X,modifiers:mr(z.slice(1)),elementId:M})}let j=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((I=j.exec(v))!==null){let[,Q,X]=I,z=Q.split("."),L=z[0];if(!dr.has(L))continue;B.push({attribute:`@${Q}`,event:L,handler:X,modifiers:mr(z.slice(1)),elementId:M})}if(B.length>0)i.push({originalTag:a,elementId:M,events:B,startIndex:E,endIndex:A})}return i}function Uo(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=$r[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 Vo(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 as(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 Ho(e){let{modifiers:t}=e,i=e.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),n=Uo(e),c=Vo(as(e.handler),t),l=[];if(t.once)l.push("once: true");if(t.capture)l.push("capture: true");if(cs(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`
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
3
  (function() {
4
4
  var $el = document.getElementById('${i}');
5
5
  if (!$el) return;
@@ -108,22 +108,22 @@ else {
108
108
  }
109
109
 
110
110
  // Event listeners
111
- ${e.map(Ho).join(`
111
+ ${e.map(Yo).join(`
112
112
  `)}
113
113
  })();
114
- </script>`}function Zo(e,t=""){let i=Rr(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 hr(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}=Zo(e,hr(t)),E=t.__stx_event_bindings||[];return t.__stx_event_bindings=[...E,...v],y}let n=Rr(e,hr(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,"\\$&"),B=new RegExp(`\\s*${M}\\s*=\\s*"[^"]*"`,"g"),D=new RegExp(`\\s*${M}\\s*=\\s*'[^']*'`,"g");E=E.replace(B,""),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 Ar(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)&&Ar(y[1],!0).has(t))return!0;for(let y of i.matchAll(/(?:const|let|var)\s*\[([^\]]*)\]/g))if(l(y.index??0)&&Ar(y[1],!1).has(t))return!0;return!1}var Tr=new R(32,{maxBytes:2097152,sizeOf:(e)=>e.code.length*4}),ut=/^[A-Za-z_$][\w$]*$/,qo=new Set(["if","for","while","switch","with"]),Ir=["(","[","{"],Or=[")","]","}"],Ko=new Set(["const","let","var","return","if","for","while","do","switch","try","throw","export"]);function Xo(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 ls(e){let t=Tr.get(e);if(t)return t;let{code:i,tokens:n}=Xo(e),c=new Map,l=[];for(let Q=0;Q<n.length;Q++){let X=n[Q].text;if(["(","[","{"].includes(X))l.push(Q);else if([")","]","}"].includes(X)){let z=l.at(-1);if(z!==void 0&&["()","[]","{}"].includes(n[z].text+X))l.pop(),c.set(z,Q),c.set(Q,z)}}function a(Q,X){let z=[],L=Q;for(let ee=Q;ee<X;ee++){if(["(","[","{"].includes(n[ee].text)&&(c.get(ee)??X)<X){ee=c.get(ee);continue}if(n[ee].text===",")z.push([L,ee]),L=ee+1}return z.push([L,X]),z}let y=[];function v(Q,X,z,L=!1){if(n[Q]?.text==="...")Q++;if(Q>=X)return;let ee=n[Q].text;if(ut.test(ee)){if(z.add(ee),z===M)y.push({name:ee,token:Q,functionScoped:L});return}if(ee!=="{"&&ee!=="[")return;let te=c.get(Q);if(te===void 0||te>=X)return;for(let[re,me]of a(Q+1,te)){let he=re;if(ee==="{")for(let le=re;le<me;le++){if(n[le].text===":"){he=le+1;break}if(n[le].text==="=")break;if(["(","[","{"].includes(n[le].text)&&c.has(le))le=c.get(le)}v(he,me,z,L)}}function E(Q,X){let z=new Set;for(let[L,ee]of a(Q,X))v(L,ee,z);return z}function A(Q){let X=Q;for(;X<n.length;X++){let z=n[X].text;if(["(","[","{"].includes(z)&&c.has(X)){X=c.get(X);continue}if([",",";",")","]","}"].includes(z))break}return n[Math.max(Q,X-1)]?.end??i.length}let M=new Set,B=[];for(let Q=0;Q<n.length;Q++)if(n[Q].text==="=>"){let X=Q-1,z=X,L;if(n[X]?.text===")"&&c.has(X))z=c.get(X),L=E(z+1,X);else if(n[X]&&ut.test(n[X].text))L=new Set([n[X].text]);else continue;let ee=Q+1,te=n[ee]?.text==="{"&&c.has(ee)?n[c.get(ee)].end:A(ee);B.push({start:n[z].start,end:te,bodyStart:n[ee]?.start??te,functionBody:!0,names:L})}else if(n[Q].text==="("&&c.has(Q)){let X=n[Q-1]?.text;if(!X||qo.has(X)||!ut.test(X)&&X!=="*"&&X!=="]")continue;let z=c.get(Q),L=z+1;if(n[L]?.text===":"){L++;while(L<n.length&&!["{","=>",";","="].includes(n[L].text))L++}if(n[L]?.text!=="{"||!c.has(L))continue;B.push({start:n[Q].start,end:n[c.get(L)].end,bodyStart:n[L].start,functionBody:X!=="catch",names:E(Q+1,z)})}function D(Q){let X=Q;for(;X<n.length;X++){let z=n[X].text;if(Ir.includes(z)&&c.has(X)){X=c.get(X);continue}if(z===";"||Or.includes(z))break;let L=n[X-1];if(X>Q&&Ko.has(z)&&L.text!==".")break;if(X>Q&&/[\n\r]/.test(i.slice(L.end,n[X].start))&&(/^[\w$]+$/.test(L.text)||Or.includes(L.text)||['"',"'","`"].includes(L.text))&&ut.test(z)&&!["in","of","instanceof"].includes(z))break}return X}let I=[];for(let Q=0;Q<n.length;Q++){if(n[Q].text!=="for")continue;let X=n[Q+1]?.text==="await"?Q+2:Q+1;if(n[X]?.text!=="("||!c.has(X))continue;let z=c.get(X),L=z+1,ee=n[L]?.text==="{"&&c.has(L)?c.get(L):D(L),te=n[ee]?.text===";"||n[ee]?.text==="}"?n[ee].end:n[Math.max(L,ee-1)]?.end??i.length;I.push({headStart:X,headEnd:z,start:n[X].start,end:te})}for(let Q=0;Q<n.length;Q++){let X=n[Q].text,z=n[Q-1]?.text;if(z==="."||n[Q+1]?.text===":")continue;if(z==="as"||z==="<")continue;if(X==="const"||X==="let"||X==="var"){let L=D(Q+1),ee=Q+1,te=!1,re=!1,me=0;for(let he=Q+1;he<=L;he++){let le=n[he]?.text;if(he<L&&Ir.includes(le)&&c.has(he)&&c.get(he)<L){he=c.get(he);continue}if(he<L&&le===":"&&!re)te=!0;else if(he<L&&le==="="&&me===0)te=!1,re=!0;else if(he<L&&te&&le==="<")me++;else if(he<L&&te&&le===">"&&me>0)me--;else if(he===L||le===","&&me===0)v(ee,he,M,X==="var"),ee=he+1,te=!1,re=!1}}else if(X==="function"||X==="class"){let L=Q+1;if(n[L]?.text==="*")L++;if(n[L]&&ut.test(n[L].text)&&n[L].text!=="extends")M.add(n[L].text),y.push({name:n[L].text,token:L})}else if(X==="import"){let L=Q+1;if(n[L]?.text==="*"&&n[L+1]?.text==="as")L+=2;let ee=n[L]?.text;if(ee&&ut.test(ee)&&ee!=="type"&&n[L+1]?.text!=="("&&n[L+1]?.text!==".")M.add(ee),y.push({name:ee,token:L,file:!0});let te=n[L]?.text==="{"?L:n[L+1]?.text===","&&n[L+2]?.text==="{"?L+2:-1;if(te!==-1&&c.has(te)){let re=c.get(te);for(let[me,he]of a(te+1,re)){let le=he-1;while(le>=me&&!ut.test(n[le].text))le--;if(le>=me&&n[le].text!=="type")y.push({name:n[le].text,token:le,file:!0})}}}}let j={code:i,scopes:B,loops:I,declarations:M,sites:y,tokens:n,pairs:c};return Tr.set(e,j),j}function qt(e){let t=ls(e);return{code:t.code,shadows:(i,n)=>t.scopes.some((c)=>n>=c.start&&n<c.end&&c.names.has(i))}}function Tn(e){return new Set(ls(e).declarations)}function Ie(e,t){let{scopes:i,loops:n,sites:c,tokens:l,pairs:a}=ls(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],j=I===-1?[0,Number.POSITIVE_INFINITY]:[l[I].start,l[a.get(I)].end];if(D.functionScoped){let X=l[D.token].start,z=i.filter((L)=>L.functionBody&&X>=L.bodyStart&&X<L.end).sort((L,ee)=>L.end-L.bodyStart-(ee.end-ee.bodyStart))[0];j=z?[z.bodyStart,z.end]:[0,Number.POSITIVE_INFINITY]}else if(!D.file){let X=n.filter((z)=>D.token>z.headStart&&D.token<z.headEnd).sort((z,L)=>z.headEnd-z.headStart-(L.headEnd-L.headStart))[0];if(X)j=[X.start,X.end]}let Q=A.get(D.name);if(Q)Q.push(j);else A.set(D.name,[j])}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]&&ut.test(l[I].text)&&l[I+1]?.text===",")I+=2;if(l[I]?.text==="{"&&a.has(I))for(let j=I+1;j<a.get(I);j++)M.add(j)}let B=new Set;for(let D=0;D<l.length;D++){let I=l[D].text;if(!t.has(I)||B.has(I)||E.has(D)||M.has(D))continue;let j=l[D-1]?.text;if(j==="#"||j==="."&&l[D-2]?.text!=="..")continue;if(l[D+1]?.text===":"&&(j==="{"||j===","))continue;let Q=l[D].start;if(A.get(I)?.some(([X,z])=>Q>=X&&Q<z))continue;if(i.some((X)=>Q>=X.start&&Q<X.end&&X.names.has(I)))continue;B.add(I)}return B}var Pe="0.2.814";var Pr=Symbol.for(`stx.lazy-module-promises.${Pe}`);function Go(){let e=globalThis;return e[Pr]??=new Map,e[Pr]}function o(e,t){let i=Go(),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 Yo=/<\/(script)/gi;function dn(e){if(!e||e.indexOf("</")===-1)return e;return e.replace(Yo,"<\\/$1")}import Dr from"fs";var Mr=[];function b(e){let t=new R(e);return Mr.push(t),t}function Rc(){for(let e of Mr)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:Dr.statSync(i).mtimeMs})}catch{}return t}function Ls(e){for(let t of e)try{if(Dr.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 Qo=/^[ \t]*import\s+['"]([^'"]+?\.css)(\?[^'"]*)?['"]\s*;?\s*$/gm;function ec(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 tc(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 nc(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 sc(e,t){let i=ec(e);if(!i||!i.subpath)return null;let n=tc(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=nc(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(Qo,(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=sc(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 rc(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="${rc(t.source)}" data-stx-layer="vendor">
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
116
  @layer vendor {
117
117
  ${t.contents}
118
118
  }
119
119
  </style>`).join(`
120
120
  `)}
121
- `}var sg=k,jr=b(256);function Nt(e){let t=x(e),i=jr.get(t);if(!i)i=ic(e),jr.set(t,i);return{code:i.code,imports:[...i.imports],models:[...i.models]}}function ic(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=Tn(t),c=xe.filter((y)=>{if(i.has(y)||n.has(y))return!1;return og(t,y,!0)}),l=zr(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(`
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
122
  `)}
123
- ${e}`,imports:c,models:l}}var oc=new Set(["Promise","Object","Array","Map","Set","Date","Error","JSON","Math","Number","String","RegExp","Symbol","WeakMap","WeakSet","Proxy","Reflect","Intl","URL","URLSearchParams","FormData","Headers","Request","Response","AbortController","EventTarget","Element","Document","Node","Window","Console","Storage","Navigator","Blob","File","FileReader","HTMLElement","SVGElement","Event","CustomEvent","DOMParser","XMLSerializer","WebSocket","Worker","SharedWorker","IntersectionObserver","MutationObserver","ResizeObserver","PerformanceObserver","Notification","Bun","Buffer","Process","Modal","Intl"]);function zr(e,t=qt(e)){let i=new Set,n=Tn(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(oc.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 cc(e){return Tn(e)}var Lr=b(128);function qc(e){let t=x(e),i=Lr.get(t);if(!i)i=ac(e),Lr.set(t,i);return{code:i.code,stxImports:[...i.stxImports],browserImports:[...i.browserImports]}}function ac(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 j=[];for(let X of D.split(",")){let z=X.trim();if(!z||z.startsWith("type "))continue;let L=z.match(/^([A-Za-z_$][\w$]*)(?:\s+as\s+([A-Za-z_$][\w$]*))?$/);if(!L)continue;let ee=L[1],te=L[2]||ee;if(c.add(ee),c.add(te),I==="stx"||I==="@stacksjs/stx")t.add(ee);else i.add(ee);if(te!==ee)j.push(`${te} = ${ee}`)}let Q=j.length>0?`var ${j.join(", ")}; /* [auto-import processed] */`:"// [auto-import processed]";n=n.replace(a[0],Q)}let y=cc(n),v=qt(n);for(let D of sg){if(c.has(D)||y.has(D))continue;if(us(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 j=I.trim().replace(/^type\s+/,"").split(/\s+as\s+/);for(let Q of j){let X=Q.trim();if(X)M.add(X)}}for(let D of xe){if(c.has(D)||y.has(D)||M.has(D))continue;if(us(A,D))i.add(D)}let B=zr(E,A);for(let D of B)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 us(qt(e),t,i)}function us(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(lc(n,y))continue;return!0}return!1}function lc(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
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
124
  ${i.join(`
125
125
  `)}
126
- ${uc(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 uc(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
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
127
  [${i.join(", ")}].forEach(function (e) {
128
128
  if (e[1] !== 'undefined') return;
129
129
  console.error(
@@ -132,12 +132,12 @@ ${uc(e,t)}`;return""}function Kh(e,t=[]){let{browserImports:i}=qc(e),n=new Set(t
132
132
  + 'or it should be imported from a relative path so the bundler includes it.'
133
133
  );
134
134
  });
135
- `}function 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 fc=/token|secret|passw|apikey|api_key|privatekey|private_key|credential|webhook|bearer|jwt|signature/i,Br=new Set;function pc(e,t){let i=fc.test(e),n=t.length>32768;if(!i&&!n)return;if(Br.has(e))return;if(Br.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;pc(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)
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
136
  ${c.join(`
137
137
  `)}
138
- `}var dc={left:0,middle:1,right:2};function gc(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=dc[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 mc(e,t){let{elementId:i,event:n,modifiers:c}=e,l=as(e.handler),a=gc(c),y=[];if(c.once)y.push("once: true");if(c.capture)y.push("capture: true");if(cs(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) {
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
139
  $el.dispatchEvent(new CustomEvent(name, { detail: detail, bubbles: true, cancelable: true }))
140
- };`;function B(D){if(/\$emit\s*\(/.test(D))return`${M}
140
+ };`;function X(D){if(/\$emit\s*\(/.test(D))return`${M}
141
141
  ${D}`;return`var scope = $el.closest('[data-stx-scope]');
142
142
  if (scope && scope.__stx_execute) {
143
143
  scope.__stx_execute('${A}', $event, $el);
@@ -151,7 +151,7 @@ else {
151
151
  var __timer
152
152
  $el.addEventListener('${n}', function($event) {
153
153
  ${a?a+"; ":""}clearTimeout(__timer)
154
- __timer = setTimeout(function() { ${B(l)} }, ${c.debounce})
154
+ __timer = setTimeout(function() { ${X(l)} }, ${c.debounce})
155
155
  }${v})
156
156
  })()`;if(c.throttle!==null)return` ;(function() {
157
157
  // eslint-disable-next-line pickier/no-unused-vars
@@ -162,7 +162,7 @@ else {
162
162
  ${a?a+"; ":""}var __now = Date.now()
163
163
  if (__now - __last >= ${c.throttle}) {
164
164
  __last = __now
165
- ${B(l)}
165
+ ${X(l)}
166
166
  }
167
167
  }${v})
168
168
  })()`;if(/\$emit\s*\(/.test(l))return` var $el = document.getElementById('${i}')
@@ -178,25 +178,25 @@ else {
178
178
  else {
179
179
  ${l}
180
180
  }
181
- }${v})`}function hc(e){if(e.length===0)return"";return`
181
+ }${v})`}function vc(e){if(e.length===0)return"";return`
182
182
  // STX: auto-generated event bindings
183
- ${e.map((i,n)=>mc(i,n)).join(`
184
- `)}`}function Wr(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 B=E[1];if(!B.startsWith("_")&&!i.has(B))t.push(B),i.add(B);a+=E[0].length;continue}let A=v.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(A){A[1].split(",").forEach((B)=>{let D=B.trim(),I=D.indexOf(":"),j=I>=0?D.slice(I+1).trim().split(/[\s=]/)[0]:D.split(/[\s=]/)[0];if(j&&!j.startsWith("_")&&!i.has(j))t.push(j),i.add(j)}),a+=A[0].length;continue}let M=v.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(M){let B=M[1];if(!B.startsWith("_")&&!i.has(B))t.push(B),i.add(B);a+=M[0].length;continue}}a++}return t}var xc=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 bc(e){let t=new Set,i=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function n(B){let D;while((D=i.exec(B))!==null){let I=D[0];if(!xc.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-526n626z.js"));if(E(i))i=await A(i,t.filePath||"",{projectRoot:t.projectRoot,minify:t.production}),c=!0;if(t.autoImports!==!1){let L=qc(i);i=L.code,n=Kc(L.stxImports,L.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=hc(t.eventBindings||[]),B=(t.attrs||"").trim(),D=/\btype\s*=\s*["']module["']/i.test(B),I=t.instanceId?` data-stx-instance="${t.instanceId}"`:"";if(D){let L=B.replace(/\btype\s*=\s*["']module["']/i,"").trim(),ee=`type="module" data-stx-scoped${I}${L?` ${L}`:""}`;return`${y}<script ${ee}>
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
186
  ${dn(`${n}${i}
187
187
  ${M}`)}
188
- </script>`}let j=Ri(e),Q=/function __stx_setup_/.test(i),X=/\bstx\.mount\s*\(|\bstx\.mountEl\s*\(/.test(e);function z(L){let ee=L.length>0?`
189
- return ${Os(i,L)};`:"",te=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}>
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
190
  window.stx.mount(function() {
191
191
  'use strict';
192
192
  try {
193
193
  ${dn(`${n}${i}
194
194
  ${M}${ee}`)}
195
195
  } catch (error) {
196
- console.error(${te}, error);
196
+ console.error(${ne}, error);
197
197
  return {};
198
198
  }
199
- })</script>`}if(!X&&!Q){if(j)return z(Wr(e));if(t.templateContent){let L=Wr(e);if(L.length>0){let ee=bc(t.templateContent);if(L.some((re)=>ee.has(re)))return z(L)}}}return`${y}<script data-stx-scoped data-stx-run="always"${I}>
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
200
  ;(function() {
201
201
  'use strict';
202
202
  try {
@@ -205,7 +205,7 @@ ${M}`)}
205
205
  } catch (error) {
206
206
  console.error(${JSON.stringify(`[stx] client block failed${t.filePath?` (${t.filePath})`:""}; this block will not hydrate`)}, error);
207
207
  }
208
- })()</script>`}import{createHash as kc}from"crypto";var In=/<script\b[^>]*>/iy,gs=/<\/script\s*>/ig,On=/<style\b[^>]*>/iy,ms=/<\/style\s*>/ig;function Fr(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 Fr(e,t,In,gs)}function pn(e,t){return Fr(e,t,On,ms)}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 Ur(e,t){if(e.startsWith("<!--",t)){let c=Ne(e,t);return c===-1?e.length:c}if(In.lastIndex=t,In.exec(e)?.index===t){gs.lastIndex=In.lastIndex;let c=gs.exec(e);return c?c.index+c[0].length:e.length}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}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=Ur(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 Vr(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=Ur(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 yc=1024,_c=16777216,vt=new Map,fs=0;function wc(e,t){vt.set(e,t),fs+=e.length+t.output.length;for(let[i,n]of vt){if(fs<=_c)break;vt.delete(i),fs-=i.length+n.output.length}}function pe(e,t,i,n){let c=n!==void 0&&e.length>=yc,l=c?`${n}\x00${e}`:"";if(c){let A=vt.get(l);if(A)return vt.delete(l),vt.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 wc(l,{output:v,tokens:y}),{output:v,tokens:y.slice()};return{output:v,tokens:y}}var Sc=1024,vc=16777216,Et=new Map,ps=0;function Ec(e,t){Et.set(e,t),ps+=e.length+t.output.length;for(let[i,n]of Et){if(ps<=vc)break;Et.delete(i),ps-=i.length+n.output.length}}function ds(e,t,i){return{output:t,scripts:i,restore:(n)=>n===t?e:vr(n,i)}}function G(e){let t=e.length>=Sc;if(t){let c=Et.get(e);if(c)return Et.delete(e),Et.set(e,c),ds(e,c.output,c.scripts.slice())}let{output:i,tokens:n}=pe(e,W,(c,l)=>`\x00STX_SCRIPT_${l}\x00`);if(t)return Ec(e,{output:i,scripts:n}),ds(e,i,n.slice());return ds(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 Pn="__stx_component_client_factories";function Dn(e){let t=e[Pn];return t instanceof Map?t:null}function Hc(e){e[Pn]=new Map}function hs(e,t){let i=Dn(e);if(!i)return null;let n=kc("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=Dn(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"),B=M.exec(e);while(B!==null){let D=n.get(JSON.parse(B[1]));if(D!==void 0)c.push({start:B.index,end:B.index+B[0].length,replacement:`(${D})(${B[2]});`});B=M.exec(e)}}let l=[...i].filter(([,A])=>A.instances>1);if(l.length===0)return Hr(e,c);let y=`<script data-stx-scoped data-stx-run="always" data-stx-component-factories>
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
209
  (function() {
210
210
  const factories = window.__stxComponentFactories = window.__stxComponentFactories || {};
211
211
  ${l.map(([A,M])=>` try { factories[${JSON.stringify(A)}] = factories[${JSON.stringify(A)}] || ${M.body}; }
@@ -213,15 +213,15 @@ ${l.map(([A,M])=>` try { factories[${JSON.stringify(A)}] = factories[${JSON.str
213
213
  `)}
214
214
  })();
215
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
- `}),Hr(e,c)}function Hr(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 Zr(e){let t=Dn(e),i=new Map;if(t)for(let[n,c]of t)i.set(n,c.instances);return i}function qr(e,t){let i=Dn(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 Kr(e,t){for(let{body:i,count:n}of t)for(let c=0;c<n;c++)hs(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 ni from"fs";var Xr=0,xs=new Map;function Yc(){Xr=0,xs.clear()}function Mn(e,t){let i=Xr++,n=`<!--__STX_${e.toUpperCase()}_${i}__-->`;return xs.set(n,{type:e,expression:t}),n}function Zc(){let e={};for(let[t,i]of xs)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 Cc=/@(?=[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 Tc(e){return Array.from({length:e},()=>"&#123;").join("&#8288;")}function Jr(e){return e.replace(/\{{2,}/g,(t)=>Tc(t.length)).replace(/\{(?=!)/g,"&#123;&#8288;").replace(Cc,"&#64;")}function xr(e,t,i=!1){let{openTag:n,tail:c}=i?ea(e,t):ta(e).at(t);return sa(c,n,i)}function ea(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 jn=null;function ta(e){if(jn&&jn.source===e)return jn.scanner;let t=na(e);return jn={source:e,scanner:t},t}function na(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 j=ve(e,t);if(j<0)c=t;else if(j+2<=y){t=j+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 j=a(I,M);if(j>=0){if(j>y)return{openTag:-1,tail:""};I=j-1;continue}l(I,M)}if(M.openTag<0)return{openTag:-1,tail:""};let B="",D=M.openTag+1;for(let I=D;I<Math.min(y,A);I++){if(!e.startsWith("{{",I))continue;let j=ve(e,I);B+=e.slice(D,I)+"x",I=j+1,D=j+2}return B+=e.slice(D,y),{openTag:M.openTag,tail:B}}}}function sa(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 Gr="unsafe:";var ra=/^(?:javascript|vbscript|livescript|mocha|view-source):/,ia=/^data:(?:text\/html|text\/xml|application\/xhtml\+xml|application\/xml|image\/svg\+xml)/,oa=/^data:(?:text\/html|application\/xhtml\+xml)/,ca=new RegExp("[\\u0000-\\u0020\\u00A0\\u1680\\u2000-\\u200F\\u2028\\u2029\\u202F\\u205F\\u3000\\uFEFF]+","g");function aa(e){return e.replace(ca,"").toLowerCase()}function bs(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 Nn(e,t="navigable"){let i=aa(e);if(ra.test(i))return!0;return t==="navigable"?ia.test(i):oa.test(i)}function wr(e,t="navigable"){return Nn(e,t)?"unsafe:"+e:e}function la(e){let t=e.match(/(?:^|[\s"'`/])([A-Za-z][\w:-]*)\s*=\s*(["'])([^"']*)$/);if(!t)return null;if(t[3].trim()!=="")return null;return bs(t[1])}function Yr(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 Qr(e,t,i=t){let n=la(e);return n&&Nn(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 Ln(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 ei(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 ti(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=ei(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 Ln(i.slice(1,-1))){let l=c.trim();if(!l)continue;if(l.startsWith("...")){xt(l,t);continue}let a=ei(l,":");xt(a===-1?l:l.slice(a+1),t)}return}if(i.startsWith("[")&&i.endsWith("]")){for(let c of Ln(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("(")&&ti(v)===v.length-1)v=v.slice(1,-1);for(let E of Ln(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("(")&&ti(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 Ln(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 Bn="__stx_client_loop_names";function rt(e){let t=e?.[Bn];return Array.isArray(t)?t:[]}function Wn(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 ua(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(ua(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 fa(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 Jr(p(e))}function pa(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 da(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 ga(e,t){let i=da(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 ma(e,t,i,n,c)}catch(l){if(l instanceof oe)l.locate(e,t);throw l}}function ma(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")ga(i,l.name);if(l.quote===null)a=pa(a);let v=bs(y);if(v&&l.valuePrefix.trim()===""&&Nn(i,v))return Gr+a;return Qr(Yr(e,t),i,a)}function wn(e,t){let i=` ${e}="`;return Z(i,i.length,t,!0)}function Ei(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 Ei(i)){if(/\b(state|derived|effect|ref|reactive|computed|watch|watchEffect|useModel)\s*(?:<[^>]*>)?\s*\(/.test(n)||Gc.test(n))return!0;if(Nr(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 ri(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 _i(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 ha(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 xa(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 Si=new Set;function $i(e){return/^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*)*$/.test(e.trim())}function ba(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 vi(e,t){let i=`${t??"<unknown>"}\x00${e}`;if(process.env.STX_DEBUG||!Si.has(i))Si.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 $i(l)?vi(l.trim(),i):c;return a===null?"":String(a)}catch{return c}}),n=Mt(n,(c,l,a)=>{let y=l.trim();if(ba(n,a,l))return c;if(/^__[A-Z_]+__$/.test(y))return c;try{let v=T(l,t);if(v===void 0)return $i(y)?vi(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 B=`<script${yg(E,t)}>`;if(/\bsrc\s*=/.test(E)||/\btype\s*=\s*["']application\/json["']/.test(E))return B+A+a.slice(v);return B+wi(A,t)+a.slice(v)});return vr(n,l)}function _(e,t,i){let n=e,c=(I,j)=>{let Q=pn(I,j);if(Q===-1)return-1;return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(I.slice(j,Q))?-1:Q},l=(I,j,Q,X)=>{let z=Q.length,{output:L,tokens:ee}=pe(I,j,(te,re)=>X(z+re));return Q.push(...ee),L},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(Ei(y))]),A=new Set(Array.isArray(t?.__stx_preserved_client_expressions)?t.__stx_preserved_client_expressions:[]);n=Mt(n,(I,j,Q)=>{if(O(j,E))return I;try{let X=T(j,t,!1,(z)=>ys(z,I,i,e));return X!==void 0&&X!==null?String(X):""}catch(X){let z=X instanceof Error?X.message:String(X);return h("Expression",`Error evaluating: {{{ ${j.trim()}}}}: ${z}`,i,e,Q,I)}},3),n=n.replace(/\{!!([\s\S]*?)!!\}/g,(I,j,Q)=>{if(O(j,E))return I;try{let X=T(j,t,!1,(z)=>ys(z,I,i,e));if(X===void 0&&t.__stx_buildMode==="compile")return Mn("raw",j.trim());return X!==void 0&&X!==null?String(X):""}catch(X){if(t.__stx_buildMode==="compile")return Mn("raw",j.trim());let z=X instanceof Error?X.message:String(X);return h("Expression",`Error evaluating: {!! ${j.trim()} !!}: ${z}`,i,e,Q,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):[],B=Wn(n).map((I)=>({...I,names:new Set(J(`${I.binding} in __slot`))})),D=new Set(rt(t));if(n=Mt(n,(I,j,Q)=>{let X=j.trim();if(fa(n,Q,j))return I;if(ri(B,Q,X))return I;if(O(X,D))return I;if(M.length>0&&ri(M,Q,X))return I;if(A.has(X))return I;let z=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined"],L=/^([a-zA-Z_$][a-zA-Z0-9_$]*)/,te=X.match(L)?.[1],re=te&&((te in t)||z.includes(te)),me=/^([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/,he=X.match(me),le=he&&!z.includes(he[1])&&!(he[1]in t);if(/^__[A-Z_]+__$/.test(X))return"";if(O(X,E))return I;if(t.__stx_native_screen===!0&&ha(X,t))return I;let ke;try{let Re=T(j,t,!1,(Xe)=>{ke=Xe});if(v&&!_i(X,t))return I;if(ke)ys(ke,I,i,e);if(t.__stx_buildMode==="compile"&&!v&&(Re===void 0||xa(X,t)))return Mn("expr",X);if(Re===void 0||Re===null)return"";let He=String(Re);return Z(n,Q,He,!1,I.length)}catch(Re){if(Re instanceof oe)throw Re;if(v&&!_i(X,t))return I;if(le)return I;let He=Re instanceof Error?Re.message:String(Re);return h("Expression",`Error evaluating: {{ ${X} }}: ${He}`,i,e,Q,I)}}),y.length>0)n=n.replace(/<!--__STX_SCRIPT_EXPR_(\d+)__-->/g,(I,j)=>y[Number(j)]??I);if(a.length>0)n=n.replace(/<!--__STX_STYLE_(\d+)__-->/g,(I,j)=>a[Number(j)]??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 B=[],D="",I=null,j=0,Q=0,X=0,z=!1;for(let L=0;L<M.length;L++){let ee=M[L];if(z){D+=ee,z=!1;continue}if(ee==="\\"){D+=ee,z=!0;continue}if(I){if(D+=ee,ee===I)I=null;continue}if(ee==='"'||ee==="'"||ee==="`"){I=ee,D+=ee;continue}if(ee==="(")j++;else if(ee===")")j--;else if(ee==="[")Q++;else if(ee==="]")Q--;else if(ee==="{")X++;else if(ee==="}")X--;if(ee===","&&j===0&&Q===0&&X===0){B.push(D),D="";continue}D+=ee}if(D)B.push(D);v=B.map((L)=>{let ee=L.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 ya(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,_a=1000;function Zh(){Xt.clear()}function ys(e,t,i,n){if(!K())return;let c=`${i}\x00${e.expression}`;if(Xt.has(c))return;if(Xt.size>=_a)Xt.clear();Xt.add(c);let l=i,a=n;try{if(i&&ni.existsSync(i))a=ni.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=ya(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=wa(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 wa(e,t){let i=null;for(let c of t){if(c===e)continue;let l=Sa(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 Sa(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 $a from"process";function C(e="STX_PUBLIC_"){let t={},i={};for(let[n,c]of Object.entries($a.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 ki(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 Ci(e,t,i={}){let{prefix:n="",preserveHost:c=!0,scopeKeyframes:l=!0,scopeCustomProperties:a=!1}=i;if(!e.trim())return"";let y=_s(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 B=M[1],D=`${t}_${B}`;E.set(B,D)}}for(let A of y){let M=Ai(A,t,n,c,E,a);v.push(M)}return v.join(`
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
219
 
220
- `)}function _s(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,B]=E;if(A==="keyframes")t.push({selector:`@keyframes ${M.trim()}`,declarations:B.trim()});else if(A==="media"||A==="supports"||A==="container"){let D=_s(B);t.push({selector:`@${A} ${M.trim()}`,declarations:D.map((I)=>`${I.selector} { ${I.declarations} }`).join(`
221
- `)})}else t.push({selector:`@${A} ${M.trim()}`,declarations:B.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 Ai(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=_s(`x { ${y} }`.replace(/x \{ /,"").replace(/ \}$/,"")).map((B)=>Ai(B,t,i,n,c,l)).join(`
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
222
  `);return`${a} {
223
223
  ${M}
224
- }`}return`${a} { ${y} }`}let v=va(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 va(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=Ea(a,t);if(v)l.push(i?`${i} ${v}`:v)}return l.join(", ")}function Ea(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 Oi=String.raw`(?<![\w-])scoped(?![\w-])`,ws=/<style\s+([^>]*)>/gi,Ti=/<style\s+([^>]*)>([\s\S]*?)<\/style>/gi,Pi=new RegExp(Oi,"i"),ka=new RegExp(Oi,"gi"),Ss=/<style\b[^>]*\bdata-stx-scoped(?:=(?:"[^"]*"|'[^']*'|[^\s>]+))?[^>]*>[\s\S]*?<\/style>\s*/gi;function Ra(e){ws.lastIndex=0;let t=ws.exec(e);while(t!==null){if(Pi.test(t[1]))return!0;t=ws.exec(e)}return!1}function pi(e){let t=new Set,i=[];Ss.lastIndex=0;let n=Ss.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=Ss.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(!Ra(e))return{html:e,hasScoped:!1};let i=ki(t),n=`data-v-${i}`,c=e,l=!1;if(Ti.lastIndex=0,c=c.replace(Ti,(a,y,v)=>{if(!Pi.test(y))return a;l=!0;let E=Ca(v,n),A=y.replace(ka,"").trim(),M=A?` ${A}`:"";return`<style data-stx-scoped="${i}"${M}>${E}</style>`}),!l)return{html:e,hasScoped:!1};return c=Ta(c,n),{html:c,hasScoped:!0}}function Ca(e,t){return Ci(e,"__SCOPE_PLACEHOLDER__",{preserveHost:!1}).replace(/\.(__SCOPE_PLACEHOLDER__) /g,`[${t}] `).replace(/\.(__SCOPE_PLACEHOLDER__)/g,`[${t}]`)}var Aa=(e)=>`\x00stx-scope-mask-${e}\x00`,Ii=/\u0000stx-scope-mask-(\d+)\u0000/g;function Ta(e,t){let i=pe(e,(c,l)=>{let a=W(c,l);return a>l?a:pn(c,l)},(c,l)=>Aa(l)),n=Ia(i.output,t);return Ii.lastIndex=0,n.replace(Ii,(c,l)=>i.tokens[Number(l)])}function Ia(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,Oa=/(?:^|\s)(?:id\s*=|(?:x-|[@:])(?:for|if|else(?:-if)?)(?=\s|=|$)|#[\w-]+(?:\s*=|\s|$)|v-slot(?::[\w-]+)?(?=\s|=|$)|slot\s*=)/i;function Pa(e){let t=e.replace(/^<template\b/i,"").replace(/>$/,"");return Oa.test(t)}function de(e){Gt.lastIndex=0;let t;while((t=Gt.exec(e))!==null){if(t[0].startsWith("</")||Pa(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 L=i[v];if(A){A=!1,v++;continue}if(L==="\\"&&E){A=!0,v++;continue}if(E){if(L===E)E=null;v++;continue}if(L==='"'||L==="'"||L==="`"){E=L,v++;continue}if(L==="(")y++;else if(L===")"){if(y--,y===0)break}v++}if(y!==0)break;let M=i.substring(a+1,v).trim(),B=i.substring(l,v+1),D=-1,I=0,j=null,Q=!1;for(let L=0;L<M.length;L++){let ee=M[L];if(Q){Q=!1;continue}if(ee==="\\"&&j){Q=!0;continue}if(j){if(ee===j)j=null;continue}if(ee==='"'||ee==="'"||ee==="`"){j=ee;continue}if(ee==="("||ee==="["||ee==="{")I++;else if(ee===")"||ee==="]"||ee==="}")I--;if(ee===","&&I===0){D=L;break}}let X=D>=0?M.substring(0,D).trim():M,z=D>=0?M.substring(D+1).trim():void 0;try{let L=X.trim(),ee;if(f(L))ee=d(L,Object.keys(t))(...Object.values(t));else ee=void 0;let te;if(z==="true")te=JSON.stringify(ee,null,2);else te=JSON.stringify(ee);let re=te.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029");i=i.substring(0,l)+re+i.substring(v+1),n.lastIndex=l+re.length}catch(L){F.log(L instanceof Error?L:Error(String(L)),{directive:"@json"},"error"),n.lastIndex=l+B.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),B=M.indexOf("@endmemo");if(B===-1)continue;let D=M.slice(0,B),I=A+B+8,j=D.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)/),Q=j?j[0].length:0,X=D.slice(Q),z=D.match(/(\s*)$/),L=z?z[0].length:0,ee=X.slice(0,X.length-L),te=ee.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)?(\/?)>/),re;if(te){let[me,he,le="",ke]=te,Re=`<${he}${le} data-stx-memo="${E}"${ke}>`;re=D.slice(0,Q)+Re+ee.slice(me.length)+D.slice(Q+ee.length)}else re=`${D.slice(0,Q)}<div data-stx-memo="${E}">${ee}</div>${D.slice(Q+ee.length)}`;c.push({start:l,end:I,replacement:re}),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 Ni(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 j;while(j=c.pop()){if(j.scoped)l--;if(j.name===M)break}continue}let B=/\sdata-stx-scope\s*=/.test(A),D=/\sdata-stx-ref-caller\s*=\s*(["'])(.*?)\1/.exec(A),I=c.find((j)=>j.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&&!B&&/\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*\/?>$/,(j)=>` data-stx-ref-caller="${t}"${j}`)),a=E;if(!Li.has(M)&&!/\/>$/.test(A)){let j=/\sdata-stx-scope\s*=\s*(?:"([^"]*)"|'([^']*)')/.exec(A);if(c.push({name:M,scoped:B,scopeId:j?.[1]??j?.[2]}),B)l++}}return y.push(e.slice(a)),y.join("")}var Li=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),Bi=/(?:^|\s)x-no-cloak(?:=|\s|\/|>|$)/,Di=/<\/?\s*([a-z][\w-]*)/iy,Da=/\s/;function Ma(e,t){let i=t-1;while(i>=0&&Da.test(e[i]))i--;return i>=0&&e[i]==="/"}function ja(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 Na(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=ja(e,n);if(E===-1)break;Di.lastIndex=n;let A=Di.exec(e)?.[1]?.toLowerCase()??"";if(e[n+1]==="/"){if(i===0)break;i--}else if(!Ma(e,E)&&!Li.has(A))i++;n=E+1}return!1}var Mi=b(256);function Fc(e){if(e.length<1024)return ji(e);let t=x(e),i=Mi.get(t);if(i!==void 0)return i;let n=ji(e);return Mi.set(t,n),n}function ji(e){if(e.length>=32768&&!Vr(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 B=e[y];if(v){if(B==="'")v=!1}else if(E){if(B==='"')E=!1}else if(B==="'")v=!0;else if(B==='"')E=!0;else if(B===">"){A=y;break}y++}if(A===-1)continue;let M=e.slice(a,A+1);if(Bi.test(M))continue;if(M.includes("x-cloak"))continue;if(Na(e,A+1))n+=e.slice(c,A)+" x-cloak>",c=A+1}return n+=e.slice(c),n}var La=/(?:^|\s)(?::else-if|:if|:else|:show|x-else-if|x-if|x-else|x-show|@if|@show)(?:=|\s|\/|>|$)/,Ba=/<\/script>/gi,Wa=/<\/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"?Ba:Wa;I.lastIndex=l;let j=I.exec(e);if(j!==null)t.lastIndex=j.index+j[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(Bi.test(M))continue;if(/(?:^|\s)x-cloak(?:=|\s|\/|>|$)/.test(M))continue;if(!La.test(M))continue;let B=e[A-1]==="/",D=B?A-1:A;i+=`${e.slice(n,D)} x-cloak${B?" ":""}`,n=D}return i+=e.slice(n),i}import Qi from"path";import vs from"fs";import Yt from"path";function Wi(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 za(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 $s(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=Wi(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=Wi(i,l,"(",")");if(y>=0)return{type:a,args:za(e.slice(l+1,y))}}return null}var zi=`
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
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
226
  type __StxWiden<T> = T extends string ? string : T extends number ? number : T extends boolean ? boolean : T;
227
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>;
@@ -229,90 +229,91 @@ type __StxRequired<O> = { [K in keyof O]-?: O[K] extends { required: true } ? K
229
229
  type __StxDefaulted<O> = { [K in keyof O]-?: O[K] extends { default: unknown } ? K : never }[keyof O];
230
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
231
  type __StxDefaults<P, K> = Omit<P, Extract<keyof P, K>> & Partial<Pick<P, Extract<keyof P, K>>>;
232
- `;function Fi(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,(B,D,I,j,Q)=>{if(c.slice(Q,Q+6)!=="import")return B;if(j.endsWith(".stx"))return"";let X=`${t}Import${i.length}`;if(i.push(`import * as ${X} from ${JSON.stringify(j)};`),D.startsWith("*"))return`import ${D.replace(/^\*\s+as\s+/,"")} = ${X};`;if(!D.startsWith("{"))return`import ${D} = ${X}.default;`;return D.slice(1,-1).split(",").map((z)=>{let[L,ee=L]=z.trim().replace(/^type\s+/,"").split(/\s+as\s+/);if(!L)return"";if(/^(?:stx|@stacksjs\/stx)(?:\/|$)/.test(j)&&L in n)n[L].push(ee);return`import ${ee} = ${X}.${L};`}).join(`
233
- `)}),a=$s(e,n.defineProps),y=$s(e,n.defineEmits),v=$s(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 B=a.type||"__StxOptions<typeof __options>";E.push(`export type __StxProps = __StxDefaults<${B}, 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(`
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
234
  `)}
235
235
  namespace ${t} {
236
236
  ${l}
237
237
  ${E.join(`
238
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*Fa(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)),B=1,D=0;for(;D<M.length;D++){if(M[D]==="{")B++;if(M[D]==="}"&&--B===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 Ui(e,t,i){let n=[],c=[zi,"type __StxAssignedValue<T> = T extends { readonly _isSignal: true } | { readonly _isDerived: true } ? T extends () => infer V ? V : T : T;","type __StxProp<P, K> = K extends keyof P ? P[K] : unknown;",'type __StxStaticProp<P, K> = __StxProp<P, K> extends infer T ? boolean extends T ? T | "true" | "false" : T : never;','type __StxEvent<E, K> = K extends keyof E ? E[K] extends readonly unknown[] ? number extends E[K]["length"] ? E[K][0] : Exclude<E[K]["length"], 0 | 1> extends never ? E[K][0] : E[K] : E[K] : any;'],l=new Map,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 j=I[2],Q=Yt.isAbsolute(j)||j.startsWith(".")?Yt.resolve(Yt.dirname(i.filePath),j):Ns(j,Yt.dirname(i.filePath));if(!Q)continue;let X=Q.endsWith(".stx")?Q:vs.existsSync(`${Q}.stx`)?`${Q}.stx`:void 0,z=X?null:yr(Q,!1),L=I[1].startsWith("{")?I[1].slice(1,-1).split(","):[I[1]];for(let ee of L){let[te,re=te]=ee.trim().split(/\s+as\s+/),me=X||z?.get(te)||z?.get(te.toLowerCase());if(me)y.set(re,me),y.set(re.toLowerCase(),me),y.set(re.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),me)}}for(let I of t.matchAll(/@import\s*\(([^)]+)\)/g))for(let j of I[1].matchAll(/['"]([^'"]+)['"]/g)){let Q=Ms(j[1],i.filePath,i).find((X)=>vs.statSync(X,{throwIfNoEntry:!1})?.isFile());if(Q)y.set(Yt.basename(j[1]).replace(/\.stx$/,""),Q)}let A={__importedComponents:y},M=new Map,B=(I,j,Q)=>{let X=e.slice(0,I);return{code:j,offset:I,attribute:Q,anchor:!0,kind:"directive",line:X.split(`
240
- `).length,column:I-X.lastIndexOf(`
241
- `)}},D=(I,j,Q)=>n.push({expression:I,statement:{text:j+I.code+Q,prefixLength:j.length}});for(let I of Fa(t)){if(kr(I.name)||I.name==="component")continue;let j=pr(I.name,i.filePath,i,A);if(!j)continue;let Q=M.get(j);if(!Q){let z;try{z=i.readComponent?i.readComponent(j):vs.readFileSync(j,"utf8")}catch{continue}if(z===void 0)continue;a.set(j,z),Q=Fi(i.scriptCode(z,j),`__StxComponent${M.size}`),M.set(j,Q),c.push(Q.declarations)}let X=[];for(let z of I.attributes){let{name:L,offset:ee}=z,te=z.value===!0?"true":z.value;if(L.startsWith("@")||L.startsWith("v-on:")){if(Q.events&&z.value!==!0)l.set(ee,`__StxEvent<${Q.events}, ${JSON.stringify(L.replace(/^@|^v-on:/,"").split(".")[0])}>`);continue}let re=/^v-model(?::([\w-]+))?(?:\.[\w-]+)*$/.exec(L);if(L.startsWith("v-")&&!L.startsWith("v-bind:")&&!re)continue;if(/^(?:x-|:)(?:if|for|show|key|else)(?:$|[.:-])/.test(L))continue;let me=(re?re[1]||"modelValue":L.replace(/^:|^v-bind:/,"")).replace(/-([a-z])/g,(Re,He)=>He.toUpperCase());if(X.push(me),!Q.props)continue;let he=L.startsWith(":")||L.startsWith("v-bind:")||!!re||z.braced,le=he?te:z.value!==!0?JSON.stringify(te):"true",ke=!he&&z.value!==!0&&(te==="true"||te==="false");D(B(ee,le,L),";void ((",`) satisfies ${ke?"__StxStaticProp":"__StxProp"}<${Q.props}, ${JSON.stringify(me)}>);`)}if(Q.props){let z=[...new Set(X)].map((ee)=>`${JSON.stringify(ee)}: undefined as any`).join(", "),L=B(I.offset,`<${I.name}>`);n.push({expression:L,statement:{text:`;void ({ ${z} } satisfies ${Q.props} & Record<string, unknown>);`,prefixLength:0}})}}return{declarations:M.size?c.join(`
242
- `):"",checks:n,events:l,dependencies:a}}var Vi=/<script(\s[^>]*)?>([\s\S]*?)<\/script>/gi;function Ua(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=Ua(e);Vi.lastIndex=0;let n;while((n=Vi.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",B=Qt(e,y);t.push({kind:M,code:E,startLine:B,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 zn(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 eo(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 to=new Set([":for","x-for","v-for"]),Fn=/(?:^|\s)((?::|x-|v-|@)[\w.:-]+)\s*=\s*(["'])([\s\S]*?)\2/g,Es="__stx_interpolated",Hi="__StxElement",no="__StxTemplateValue",Va=`type ${no}<T> = T extends { readonly _isSignal: true } | { readonly _isDerived: true } ? (T extends () => infer V ? T & V : T) : T`;function Zi(e){return e.replace(/\{\{[\s\S]*?\}\}/g,Es).replace(/\{!![\s\S]*?!!\}/g,Es)}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=cl(e),E=[],A=0;for(let Q of y.matchAll(/\{\{([\s\S]*?)\}\}|\{!!([\s\S]*?)!!\}/g)){let X=Q.index,z=e.slice(X,X+Q[0].length),L=Q[1]!==void 0,ee=z.slice(L?2:3,L?-2:-3),te=a.length,re=Yi(v,X),me=Yi(v,X+(L?2:3));a.push({code:eo(ee),...me});let he=`${n}_${te}`,le=z.split(`
245
- `),ke=le[0].length;le[0]=he+" ".repeat(Math.max(0,ke-he.length));for(let Ze=1;Ze<le.length;Ze++)le[Ze]=le[Ze].replace(/[^\r]/g," ");let Re=c.get(re.line)??[],He=Re.at(-1),Xe=re.column+(He?He.generatedEnd-He.sourceEnd:0);Re.push({sourceStart:re.column,sourceEnd:re.column+ke,generatedStart:Xe,generatedEnd:Xe+le[0].length}),c.set(re.line,Re),E.push(e.slice(A,X),le.join(`
246
- `)),A=X+z.length}E.push(e.slice(A));let M=E.join("");if(!a.length)return{code:M,columns:c,declarations:l};let{imports:B,body:D}=ro(t),I=[],j=0;for(let Q of B.split(/\n(?=import\b)/)){if(!Q.trim())continue;let X=/^import\s+(?:type\s+)?([\s\S]+?)\s+from\s*(['"][^'"]+['"])/.exec(Q);if(!X){l.push({text:Q});continue}let z=`${n}Module${j++}`;l.push({text:`import * as ${z} from ${X[2]}`});let L=X[1],ee=/\{([\s\S]*?)\}/.exec(L);for(let he of ee?.[1].split(",")??[]){let[le,ke=le]=he.trim().replace(/^type\s+/,"").split(/\s+as\s+/);if(le==="default")I.push(`const ${ke} = ${z}.default; type ${ke} = import(${X[2]}).default`);else if(le)I.push(`import ${ke} = ${z}.${le}`)}let te=L.replace(/\{[\s\S]*?\}/,""),re=/\*\s+as\s+(\w+)/.exec(te);if(re)I.push(`import ${re[1]} = ${z}`);let me=/^\s*([\w$]+)/.exec(te)?.[1];if(me)I.push(`const ${me} = ${z}.default; type ${me} = import(${X[2]}).default`)}l.push({text:`namespace ${n}Scope {
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
247
  ${I.join(`
248
248
  `)}
249
249
  export async function read() {
250
- ${js(D).replace(/^[ \t]*export[ \t]+(?=(?:const|let|var|function|async|class|interface|type)\b)/gm,"")}
251
- return {`});for(let[Q,X]of a.entries())l.push({text:`value${Q}: (`}),l.push({text:X.code,origin:{line:X.line,column:X.column}}),l.push({text:"),"});l.push({text:`}
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
252
  }
253
- }`});for(let Q=0;Q<a.length;Q++)l.push({text:`declare var ${n}_${Q}: Awaited<ReturnType<typeof ${n}Scope.read>>['value${Q}']`});return{code:M,columns:c,declarations:l}}function Ha(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 Za=["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"],qa=new RegExp(String.raw`^[ \t]*@(?:${Za.join("|")})\b[ \t]*(\([^\n)]*\))?[ \t]*$`,"gm");function js(e){return e.replace(qa,(t)=>t.replace(/[^\n]/g," "))}var qi=new Set(["x-cloak","x-ref","x-transition","x-teleport","v-slot","x-hydrate",":key","x-tooltip","x-tooltip-position"]);function Jf(e){let t=zn(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=eo(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 B=t[v];if(B==="(")y++;else if(B===")"){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"})}Fn.lastIndex=0;while((c=Fn.exec(t))!==null){let a=c[1],y=c[3]??"",v=a.replace(/\..*$/,"").replace(/^([^:].*?):.*$/,"$1");if(qi.has(v)||qi.has(a))continue;if(!y.trim())continue;let E=c.index+c[0].indexOf(c[2],c[0].indexOf(a)+a.length)+1;if(to.has(v)){let M=y.match(/\s+(?:in|of)\s+/);if(!M||M.index===void 0)continue;let B=y.slice(M.index+M[0].length),D=M.index+M[0].length+(B.length-B.trimStart().length);i.push({code:Zi(B.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:Zi(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 Ka=2000;function Xa(e,t){let i=0,n=Math.min(e.length,t+Ka);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 Ja(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 B=E.length===1?v:void 0,D=t.get(M);if(!D)t.set(M,{name:M,iterable:B});else if(D.iterable!==B)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=Xa(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=zn(e);Fn.lastIndex=0;let a;while((a=Fn.exec(l))!==null){let y=a[1].replace(/\..*$/,"");if(!to.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 ks=["params","query","cookies","host","ip","setResponseStatus","setResponseHeader","notFound","request","url","definePageMeta","defineClientPayload","defineStore","props","$props"],Ga={$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[...ks.filter((t)=>!e.has(t)).map((t)=>`declare var ${t}: any`),...Object.entries(Ga).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 so(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 Ya(i[1])){let y=a.split(":")[0].trim();if(/^[A-Za-z_$][\w$]*$/.test(y))c.add(y)}}return n?[...c]:null}function Ya(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 ro(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(`
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
255
  `).map(()=>"").join(`
256
256
  `)));return{imports:i.join(`
257
- `),body:n}}function io(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 B=A;B<t.length;B++)if(t[B]==="{")M++;else if(t[B]==="}"&&--M===0){E=B+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 B=t[M];if(B==="{"||B==="["||B==="("||B==="<")A++;else if(B==="}"||B==="]"||B===")"||B===">")A--;else if(A<=0&&(B===";"||B===`
258
- `&&!/[=|&,<([{]\s*$/.test(t.slice(Math.max(0,M-40),M)))){E=B===";"?M+1:M;break}}}c.push({name:v,text:e.slice(a.index,E).replace(/^[ \t]*export[ \t]+/,"")}),l.lastIndex=E}return c}function Qa(e){return new Set(io(e).map((t)=>t.name))}function Oc(e,t=""){let i=so(e),n=Qa(t),c=io(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["",`// ${el}`,...c,...E.map((A)=>`declare var ${A}: any`)].join(`
259
- `)}if(i.length===0)return c.length>0?["",`// ${Ki}`,...c].join(`
260
- `):"";let{imports:l,body:a}=ro(e),y=a.replace(/^[ \t]*export[ \t]+(?=(?:const|let|var|function|async|class)\b)/gm,""),v=["",`// ${Ki}`];if(l)v.push(l);return v.push(...c),v.push(`async function ${Xi}() {`,y,` return { ${i.join(", ")} }`,"}",`type ${Ji} = Awaited<ReturnType<typeof ${Xi}>>`,...i.map((E)=>`declare var ${E}: ${Ji}[${JSON.stringify(E)}]`)),v.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
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(so(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 Ki="stx: types for the declared client payload (#1868)",el="stx: untyped bridge names \u2014 declare a defineClientPayload to check these (#1868)",Xi="__stxServerScope",Ji="__StxClientPayload";var Gi=["$env","$user","$slot","$slots","$attrs","$props","$page","$route","$loop","loop","$errors","$csrf","$native","props","slot"];var tl=/^\s*[A-Z_$][\w$]*\s*=[^=]/i;function nl(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,B=n.slice(M,E+v[0].length).trim().replace(/;$/,"").trim(),D=v[3],I=i.test(D)&&!/\bawait\b|=>|\bfunction\b|[{}]/.test(D)&&!/[,+\-*/%&|?:=]$/.test(B)&&ge(D).balanced;t.set(A,t.has(A)||!I?null:B)}}return new Map([...t].filter((n)=>n[1]!==null))}function oo(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(),B=c.slice(v+E.length).trimStart();if(M.endsWith(".")||/^:(?!:)/.test(B)&&/[{,]$/.test(M))continue;if(v>0&&/[\w$]/.test(c[v-1]))continue;l+=`${e.slice(a,v)}(${oo(A,t,i+1,new Set([...n,E]))})`,a=v+E.length}return l+e.slice(a)}function sl(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 rl(e){let t=e.code.trim();if(!t)return null;if(e.attribute?.startsWith("@")){if(tl.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 il=/(\bfrom\s*|\bimport\s*\(\s*|\bimport\s+)(['"])(\.{1,2}\/[^'"\n]*)\2/g;function _r(e,t){if(!t)return e;return e.replace(il,(i,n,c,l)=>{let a=Qi.resolve(t,l).replace(/\\/g,"/");return`${n}${c}${a}${c}`})}function ui(e){return" ".repeat(Math.max(0,(e.startColumn??1)-1))}function ol(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(`
263
- `),c=Array.from({length:n.length},()=>""),l=new Map,a=new Map,y=[],v=i.filter((I)=>I.kind==="server").map((I)=>I.code).join(`
264
- `),E=t.filePath&&t.templateExpressions!==!1?Ui(e,zn(e),{filePath:t.filePath,componentsDir:t.componentsDir,projectRoot:t.projectRoot,readComponent:t.readComponent,scriptCode:(I,j)=>Pt(I).map((Q)=>_r(Q.code,Qi.dirname(j))).join(`
265
- `)}):void 0,A=new Set,M=[];for(let[I,j]of i.entries()){let Q=ci(ui(j)+j.code,v,String(I));for(let[L,ee]of Q.columns)a.set(j.startLine+L-1,ee);for(let L of Q.declarations)y.push({text:_r(L.text,t.originDir??""),origin:L.origin?{...L.origin,line:L.origin.line+j.startLine-1}:void 0});let X=js(Q.code),z=_r(X,t.originDir??"").split(`
266
- `);z.forEach((L,ee)=>{let te=j.startLine-1+ee;if(te<c.length)c[te]=L,A.add(te)}),M.push(j.startLine-1+z.length-1)}for(let I of M){let j=c[I]?.trim()===""?I:I+1;if(j<c.length&&c[j].trim()===""&&(j===I||!A.has(j)))c[j]=";"}let B=(I,j)=>{for(let[Q,X]of I.split(`
267
- `).entries())if(c.push(X),j)l.set(c.length,Q===0?j:{...j,line:j.line+Q,column:1,prefixLength:0})};for(let I of y)B(I.text,I.origin);if(t.globals!==!1){B("");let I=new Set([...i.flatMap((z)=>Me(z.code)),...i.flatMap((z)=>ol(z.code))]),j=(z)=>{if(!I.has(z))B(`declare var ${z}: any`)};if(t.runtimeGlobals!==!1){if(!I.has("window"))B("declare var window: any");for(let z of k)j(z)}let Q=[...new Set([...ks,...xe,...Gi])].filter((z)=>t.runtimeGlobals!==!1||!k.includes(z));if(t.contextScope==="global"){B("declare global {");for(let z of Q)B(` var ${z}: any`);B("}")}else{for(let z of ks)j(z);for(let z of xe)j(z);for(let z of Gi)j(z)}B(`declare var ${Es}: any`);let X=new Set(i.flatMap((z)=>Me(z.code)));B(`type ${Hi}<T> = T extends readonly (infer E)[] ? E : T extends Iterable<infer E2> ? E2 : any`);for(let z of Ja(e)){if(X.has(z.name))continue;let L=z.iterable&&X.has(z.iterable)?`${Hi}<typeof ${z.iterable}>`:"any";B(`declare var ${z.name}: ${L}`)}}if(t.templateExpressions!==!1){if(E?.declarations)for(let j of E.declarations.split(`
268
- `))B(j);let I=Jf(e).map((j)=>{let Q=E?.events.get(j.offset??-1);if(Q){j.anchor=!0;let X=j.code.trim(),z=/^([\w$]+)\s*=\s*([^=][\s\S]*)$/.exec(X),L=z?`void ((${z[2]}) satisfies __StxAssignedValue<typeof ${z[1]}>)`:/^[\w$]+(?:\.[\w$]+)*$/.test(X)?`${X} satisfies (($event: ${Q}) => unknown)`:X,ee=`;(($event: ${Q}): void => { `;return{expression:j,statement:{text:`${ee}${L} });`,prefixLength:ee.length}}}return{expression:j,statement:rl(j)}}).filter((j)=>j.statement!==null);if(I.push(...E?.checks||[]),I.length>0){let j=zn(e),Q=Wn(j),X=nl(i.map((te)=>te.code)),L=[...new Set(i.flatMap((te)=>Me(te.code)))].filter((te)=>/^[A-Z_$][\w$]*$/i.test(te)),ee=0;if(L.length>0){B(Va);for(let te of L)B(`function __StxRead_${te}() { return ${te} }`),B(`type __StxT_${te} = ${no}<ReturnType<typeof __StxRead_${te}>>`);B(`;((${L.map((te)=>`${te}: __StxT_${te}`).join(", ")}) => {`),ee=1}for(let{expression:te,statement:re}of I){let me=" ".repeat(ee),he=te.offset===void 0?[]:Q.filter((Ze)=>te.offset>=Ze.start&&te.offset<Ze.end),le=he.map((Ze)=>`;((${Ze.binding.replace(/[\r\n]/g," ")}: any) => { `).join(""),ke=" });".repeat(he.length),Re=te.offset===void 0?[]:sl(j,te.offset),He=Re.length>0?`${Re.map((Ze)=>`if (${oo(Ze,X)}) `).join("")}{ `:"",Xe=Re.length>0?" }":"";B(me+le+He+re.text+Xe+ke,{line:te.line,column:te.column,expression:te,prefixLength:re.prefixLength+me.length+le.length+He.length,guardPrefixLength:me.length+le.length+He.length})}if(ee>0)B("});")}}let D=!1;if(t.reference&&c[0]!==void 0&&c[0].trim()==="")c[0]=`/// <reference path=${JSON.stringify(t.reference.replace(/\\/g,"/"))} />`,D=!0;return B("export {}"),{text:c.join(`
269
- `),lineMap:l,sourceLineCount:n.length,componentDependencies:E?.dependencies,referenced:D,scriptColumns:a}}function cl(e){let t=[0];for(let i=0;i<e.length;i++)if(e.charCodeAt(i)===10)t.push(i+1);return t}function Yi(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:Ha(e.scriptColumns?.get(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 Rs=b(256),al=[{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"}],co=/(?:\/\/|\/\*|\{\{--)\s*stx-strict-ignore(-next-line)?([^\n*}]*)/g;function fl(e){let t=Array.from(e,(c)=>c===`
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===`
270
271
  `?`
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]!==`
272
- `)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 pl(e){let t=new Map,i=fl(e).split(`
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(`
273
274
  `),n=e.split(`
274
- `);return i.forEach((c,l)=>{co.lastIndex=0;for(let a of c.matchAll(co)){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),B=M.filter((I)=>/\w/.test(I));if(M.length>0&&B.length===0)continue;let D=t.get(E);if(D&&D.size===0)continue;if(B.length===0){t.set(E,new Set);continue}if(D)B.forEach((I)=>D.add(I));else t.set(E,new Set(B))}}),t}function dl(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=Rs.get(l);if(a!==void 0){if(a&&c.failOnViolation)throw new q(a,n??t);return}let y=c.allowPatterns??[],v=pl(e),E=[],A=r(e.replace(/\{\{--[\s\S]*?--\}\}/g,(I)=>I.replace(/[^\n]/g," ")));for(let{pattern:I,message:j,suggestion:Q}of al){if(y.some((z)=>/\w/.test(z)&&j.includes(z)))continue;I.lastIndex=0;let X=A.match(I);if(X&&X.length>0){let z=A.split(`
275
- `),L=e.split(`
276
- `),ee=[];if(z.forEach((he,le)=>{if(I.lastIndex=0,I.test(he)&&!dl(v,le+1,j))ee.push(le+1)}),ee.length===0&&z.some((he)=>(I.lastIndex=0,I.test(he))))continue;let te=ee.length>0?` (script line${ee.length>1?"s":""} ${ee.join(", ")})`:"",re=ee.slice(0,3).map((he)=>` ${he} | ${(L[he-1]??"").trim().slice(0,100)}`).join(`
277
- `),me=re?`
278
- ${re}`:"";E.push(` \u2717 ${j}${te}
279
- \u2192 ${Q}${me}`)}}if(E.length===0){Rs.set(l,"");return}let M=(I)=>{let j=`${process.cwd()}/`;return I.startsWith(j)?I.slice(j.length):I},D=`[STX] DOM API violation in ${n&&n!==t?`${M(n)} (composed into ${M(t)})`:M(t)}:
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)}:
280
281
  ${E.join(`
281
282
  `)}
282
- Tip: prefer useRef(), navigate(), and composables for component code`;if(Rs.set(l,D),console.warn(D),c.failOnViolation)throw new q(D,n??t)}var gl=[{open:"@if",close:"@endif",name:"if"},{open:"@unless",close:"@endunless",name:"unless"},{open:"@foreach",close:"@endforeach",name:"foreach"},{open:"@for",close:"@endfor",name:"for"},{open:"@while",close:"@endwhile",name:"while"},{open:"@forelse",close:"@endforelse",name:"forelse"},{open:"@switch",close:"@endswitch",name:"switch"},{open:"@isset",close:"@endisset",name:"isset"},{open:"@empty",close:"@endempty",name:"empty"},{open:"@auth",close:"@endauth",name:"auth"},{open:"@guest",close:"@endguest",name:"guest"},{open:"@can",close:"@endcan",name:"can"},{open:"@cannot",close:"@endcannot",name:"cannot"},{open:"@section",close:"@endsection",name:"section",altClose:"@show"},{open:"@push",close:"@endpush",name:"push"},{open:"@prepend",close:"@endprepend",name:"prepend"},{open:"@once",close:"@endonce",name:"once"},{open:"@markdown",close:"@endmarkdown",name:"markdown"},{open:"@component",close:"@endcomponent",name:"component"}],ml=[{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')"}],hl=[{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 xl(e,t),bl(e,t,i),yl(e,i),_l(e,t),{valid:t.length===0,errors:t,warnings:i}}function xl(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 bl(e,t,i){for(let n of gl){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 yl(e,t){for(let i of ml)if(i.pattern.test(e))t.push({type:"syntax",message:i.message,suggestion:i.suggestion})}function _l(e,t){for(let i of hl)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(`
283
- `);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 ao(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),Ts=new Map;function lo(e){try{let t=Zn.statSync(e);return`${t.size}:${t.mtimeMs}`}catch{return""}}var Vn=new R(1000),Ps=new R(2000),Zs=new R(500),yo=33554432,Ks=yo;function wl(e){let t=e.componentRenderCacheBytes;if(typeof t!=="number"||t<0||t===Ks)return;Ks=t,Hn.setMaxBytes(t)}var Hn=new R(2000,{maxBytes:yo,sizeOf:(e)=>e.output.length});function Sl(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 $l(e){let t={};for(let[i,n]of Object.entries(e))if(!i.startsWith("__")||i==="__stxServeContext")t[i]=n;return t}function Cs(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=uo.get(i);if(n===void 0)n=Bun.hash(_o(e,t).split(ce.sep).join("/")).toString(36).slice(0,6),uo.set(i,n);return n}var uo=new Map;function _o(e,t){if(!ce.isAbsolute(e))return e;let i=(n)=>{try{return Zn.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 fo=new WeakMap,vl=256;function Be(e){try{let t=Y({loader:"ts",target:"browser",define:C()}),i=fo.get(t);if(!i)i=new Map,fo.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>=vl){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 El(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]!==`
284
- `)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 j=D;while(j>0&&/[\w$]/.test(e[j-1]))j--;return E.has(e.slice(j,D+1))},M=()=>{c++;let D=!1;while(c<l&&e[c]!==`
285
- `){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++}},B=()=>{if(n!==0)return;let D=e.slice(c).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(D){let X=D[2].split(",").map((z)=>{let L=z.trim().split(":");return L[L.length-1].trim()});for(let z of X)if(z&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(z)&&!i.has(z))t.push(z),i.add(z);return}let I=e.slice(c).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(I){let X=I[2];if(!i.has(X))t.push(X),i.add(X);return}let j=e.slice(c).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(j){let X=j[1];if(!i.has(X))t.push(X),i.add(X);return}let Q=e.slice(c).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(Q){let X=Q[1];if(!i.has(X))t.push(X),i.add(X)}};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])))B();c++}return t}function kl(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 Rl(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 Cl(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 kl(y)){let E=v.trim();if(!E||E.startsWith("..."))continue;let A=Rl(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 B=E.slice(A+1).trim();if(!B)continue;try{let D=Object.keys(t).filter(jt),I=Function(...D,`"use strict"; return (${B});`);t[M]=I(...D.map((j)=>t[j]))}catch{}}}catch{}}var Al=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(!Al.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 wo(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 Er(e,t,i,n,c){let l=e.endsWith(".stx")?e.slice(0,-4):e,a=(re)=>re.split("-").map((me)=>me.charAt(0).toUpperCase()+me.slice(1)).join(""),y=i.__importedComponents;if(y){for(let re of[l,l.toLowerCase(),a(l),V(l)])if(y.has(re))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=[],B=(re)=>{if(re&&!M.includes(re))M.push(re)},D=i.__originalFilePath;if(D)B(ce.join(ce.dirname(D),"components"));if(wo(t,c))B(c._rootComponentsDir);B(t),B(c._rootComponentsDir),B(ce.join(ce.dirname(n),"components")),B(c.componentsDir);for(let re of c.additionalComponentsDirs??[])B(re);let I=c._targetComponentFallbackNames?.some((re)=>re.toLowerCase()===l.toLowerCase());if(!I)for(let re of c._targetComponentDirs??[])B(re);if(E)B(ce.resolve(E,"resources/views/components")),B(ce.resolve(E,"resources/components")),B(ce.resolve(E,"src/components")),B(ce.resolve(E,"components"));for(let re of c._layerComponentDirs??[])B(re);let j=c._pluginComponentDirs;if(Array.isArray(j))for(let re of j)B(typeof re==="string"?re:null);if(B(c.fallbackComponentsDir),I)for(let re of c._targetComponentDirs??[])B(re);let Q=c._nativePrimitivesFallback;if(Q&&!Q.except.some((re)=>re.toLowerCase()===l.toLowerCase()))B(Q.dir);if(l.startsWith("./")||l.startsWith("../"))return s(ce.resolve(ce.dirname(n),`${l}.stx`));let X=po(ce.resolve(import.meta.dir,"components")),z=M.map((re)=>ce.isAbsolute(re)?re:ce.resolve(A,re)),L=`${v.join("\x00")}\x00\x00${z.join("\x00")}`,ee=Ps.get(L);if(ee!==void 0)return ee;let te=!1;e:for(let re of z){if(po(re)===X)continue;for(let me of v)if(await s(ce.join(re,me))){te=!0;break e}}return Ps.set(L,te),te}function po(e){let t=Zs.get(e);if(t!==void 0)return t;let i=e;try{i=Zn.realpathSync(e)}catch{}return Zs.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 Tl(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 go=new Set;function mo(e,t,i,n){let c=`${e}\x00${t}\x00${n??""}`;if(!process.env.STX_DEBUG&&go.has(c))return;go.add(c);let l=t?` used in ${t}`:"",a=n?` Cause: ${n}.`:"",y=i.length>0?`
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?`
286
287
  searched:
287
288
  ${i.map((v)=>` - ${v}`).join(`
288
- `)}`:"";console.error(`[stx] component <${e}> could not be resolved${l}, so it rendered as nothing.${a}${y}`)}function ho(e){return`<!-- stx: component "${e.replace(/--+/g,"-")}" could not be resolved; see the server log -->`}var Il=new Set(["for","if","show","key","ref","class","className","style"]),xo=new Set,So="useMediaQuery|useDark|usePreferredDark|usePreferredLight|usePreferredReducedMotion|usePreferredContrast|useDocumentVisibility|useScrollLock",Gc=new RegExp(`\\b(?:${So})\\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|${So})\\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:B}=await o("stx/variable-extractor",()=>import("./chunk-7aqdqfwf.js")),D=y??new Set;if(D.has(e))return`[Circular component reference: ${e}]`;let I=new Set(D);I.add(e);let j=typeof t.client==="string"?t.client.trim():"";if("client"in t)delete t.client;let Q=j&&j!=="load"&&fg(j)?j:"";try{let X=(se)=>se.split("-").map((ae)=>ae.charAt(0).toUpperCase()+ae.slice(1)).join(""),z=M.endsWith(".stx")?M.slice(0,-4):M,L=null,ee=c.__importedComponents;if(ee){let se=[z,z.toLowerCase(),X(z),V(z)];for(let ae of se)if(ee.has(ae)){L=ee.get(ae);break}}let te=[];if(!L){let se=[`${z}.stx`,`${X(z)}.stx`,`${V(z)}.stx`],ae=[...new Set(se)],we=c.__originalFilePath,be=[];if(be.push(...a._layerComponentDirs??[]),we){let ye=ce.join(ce.dirname(we),"components");be.push(ye)}let Ue=a._rootComponentsDir;if(typeof Ue==="string"&&wo(n,a)&&!be.includes(Ue))be.push(Ue);if(n&&!be.includes(n))be.push(n);if(typeof Ue==="string"&&!be.includes(Ue))be.push(Ue);let Ae=ce.join(ce.dirname(l),"components");if(!be.includes(Ae))be.push(Ae);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 ct=a._nativeHostAttrs&&/^(?:checkbox|switch)$/i.test(z),lt=(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=!lt.includes("valuechange")&&(yt||lt.includes("change")&&!es),gt=a._nativeHostAttrs&&/^textinput$/i.test(z),_t=lt.includes("update:value")&&!lt.includes("input"),Ht=a._nativeHostAttrs&&/^video$/i.test(z),ns=a._nativeHostAttrs&&/^image$/i.test(z),ln=Ds([...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=Ht&&wt&&!un&&(A?.events??[]).every((ye)=>/^(?:play|pause|ended|timeupdate|loadedmetadata|loadstart|error)$/.test(ye.replace(/^@/,"").split(".")[0])),mt=(ye)=>Object.hasOwn(t,ye)||Boolean(A?.reactiveProps?.includes(ye)),Sn=a._nativeHostAttrs&&/^button$/i.test(z)&&(mt("symbol")||mt("iconOnly")||mt("title")&&!mt("label")&&!i.trim()),Zt=a._targetComponentFallbackNames?.some((ye)=>ye.toLowerCase()===z.toLowerCase())&&(!ct||ts)&&(!gt||_t)&&(!Ht||_n)&&(!ns||ln)&&!Sn;for(let ye of Zt?[]:a._targetComponentDirs??[])if(ye&&!be.includes(ye))be.push(ye);let St=typeof a.root==="string"?ce.resolve(a.root):void 0,jo=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 sr=a._pluginComponentDirs;if(Array.isArray(sr)){for(let ye of sr)if(typeof ye==="string"&&!be.includes(ye))be.push(ye)}if(a.fallbackComponentsDir&&!be.includes(a.fallbackComponentsDir))be.push(a.fallbackComponentsDir);if(Zt){for(let ye of a._targetComponentDirs??[])if(ye&&!be.includes(ye))be.push(ye)}let $n=a._nativePrimitivesFallback;if($n&&!$n.except.some((ye)=>ye.toLowerCase()===z.toLowerCase())&&!be.includes($n.dir))be.push($n.dir);let rr=[...new Set(be.map((ye)=>{if(!ye)return ye;return ce.isAbsolute(ye)?ye:ce.resolve(jo,ye)}))];be.length=0,be.push(...rr);let ss=`${z}\x00${l}\x00${rr.join("\x00")}`,rs=Vn.get(ss);if(rs)if(await s(rs))L=rs;else Vn.delete(ss);if(!L&&(z.startsWith("./")||z.startsWith("../")))L=ce.resolve(ce.dirname(l),`${z}.stx`),te.push(L);else if(!L)for(let ye of be){if(!ye)continue;for(let En of ae){let kn=ce.join(ye,En);if(te.push(kn),await s(kn)){L=kn;break}}if(L)break;if(!L)try{let En=await import("fs");if(!En.statSync(ye,{throwIfNoEntry:!1})?.isDirectory())continue;let No=8,is=[{path:ye,depth:0}];while(is.length>0&&!L){let Rn=is.pop();if(Rn.depth>=No)continue;let ir;try{ir=En.readdirSync(Rn.path,{withFileTypes:!0})}catch{continue}for(let Cn of ir){if(!Cn.isDirectory())continue;if(Cn.name==="node_modules"||Cn.name.startsWith("."))continue;let or=ce.join(Rn.path,Cn.name);for(let Lo of ae){let os=ce.join(or,Lo);if(te.push(os),await s(os)){L=os;break}}if(L)break;is.push({path:or,depth:Rn.depth+1})}}}catch{}if(L)break}if(L)Vn.set(ss,L)}if(!L||!await s(L))return mo(e,l,te),ho(e);v.add(L);let re;if(tn.has(L)&&Ts.get(L)===lo(L))re=tn.get(L);else try{let se=lo(L);re=await Bun.file(L).text(),tn.set(L,re),Ts.set(L,se)}catch(se){let ae=se instanceof Error?se.message:String(se);return mo(e,l,[L],ae),ho(e)}if(A)for(let se of new Set([...Object.keys(t),...A.reactiveProps??[]])){let ae=se.toLowerCase();if(ae.startsWith("aria-")||ae.startsWith("data-"))continue;let we=se.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(new RegExp(`\\b${we}\\b`).test(re))A.declaredProps.add(se);if(new RegExp(`\\$props\\s*(?:\\.\\s*${we}\\b|\\[\\s*['"]${we}['"]\\s*\\])`).test(re)||new RegExp(`\\buseReactiveProp\\s*\\(\\s*['"]${we}['"]`).test(re))A.consumedProps?.add(se)}if(A?.reactiveProps?.length&&/\bdefineProps\s*(?:<[^>]*>)?\s*\(/.test(re))for(let se of A.reactiveProps){if(Il.has(se)||A.consumedProps?.has(se))continue;if(new RegExp(`\\buse(?:ReactiveProp|Model)\\s*\\(\\s*['"]${se.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(re))continue;let ae=`${L}\x00${se}`;if(xo.has(ae))continue;xo.add(ae),console.warn(`[stx] ${ce.basename(L)} reads \`${se}\` with defineProps(), which is not live, but ${ce.basename(l)} binds it (:${se}): the value can arrive empty or stale (on a native screen, and for a :for's rows, it does not arrive at all). Read it with useReactiveProp('${se}').`)}let me=new Set(["__originalFilePath","__importedComponents",Pn,"__stx_client_signal_names","__stx_client_declared_names","__stx_runtime_config","__stxServeContext","__stx_scope_seq"]),he={};for(let[se,ae]of Object.entries(c))if(!se.startsWith("__")||me.has(se))he[se]=ae;let le=E.length>0?{[Bn]:[...E]}:{},ke=i;if(i.includes("@include")){let{processIncludes:se}=await o("stx/includes",()=>import("./chunk-qsepyy1p.js"));ke=await se(i,c,l,a,v)}if(/<[A-Z][\w.-]*[\s/>]/.test(ke)){let{processComponents:se}=await o("stx/component-renderer",()=>import("./chunk-pnbh9fgm.js")),ae={...c,__processedComponents:D,...le};ke=await se(ke,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 Re=[];if(Xc(ke)){let{processExpressions:se}=await o("stx/expressions",()=>import("./chunk-x94q5ptn.js")),ae=c.__stx_signals_gate===void 0?{...c,__stx_signals_gate:!0,...le}:E.length>0?{...c,...le}:c;ke=se(ke,ae,l);for(let we of ke.matchAll(/\{\{([\s\S]*?)\}\}/g))Re.push(we[1].trim())}let He=G(ke),Xe=[],Ze=He.output.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(se,ae)=>{let we=He.scripts[Number(ae)]||"",be=we.match(/^<script\b([^>]*)>/i)?.[1]||"",Ue=be.match(/\btype\s*=\s*["']([^"']+)["']/i)?.[1]?.toLowerCase(),Ae=!Ue||["module","text/javascript","application/javascript"].includes(Ue),ct=/\sdata-stx-(?:owner|instance)(?=[\s=/>])/i.test(` ${be}`);if(!/\bserver\b/i.test(be)&&Ae&&!ct)return Xe.push(we),"";return we}),{extractSlotContent:Kn}=await o("stx/slots",()=>import("./chunk-w717cyka.js")),ft=Kn(Ze),pt={};if(ft.defaultSlot?.trim())pt.default=ft.defaultSlot;for(let[se,ae]of ft.namedSlots)pt[se]=ae.content;let dt=c.__stx_scope_seq??={n:0,key:Vs(String(c.__filename??l))},Ct=_o(e,process.cwd()),it=`stx_${(Ct.endsWith(".stx")?Ct.slice(0,-4):Ct).replace(/[^a-zA-Z0-9]/g,"_")}_${++dt.n}_${dt.key}`,We={...he,$uid:it,$native:a._nativeHostAttrs===!0,...t,props:t,slot:Ze,$slots:pt,__processedComponents:I,__sections:{},__stx_signals_gate:Se(re)||Xc(i),__stx_preserved_client_expressions:[...Array.isArray(c.__stx_preserved_client_expressions)?c.__stx_preserved_client_expressions:[],...Re]};Cl(re,We);let Tt=re,sn=de(Tt);if(sn)Tt=sn.content.trim();let Xn=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,Dt=[...re.matchAll(Xn)];for(let[,se,ae]of Dt)if(!/\bserver\b|\bsrc\s*=|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/i.test(se))Oe(ae,L,a.strict);let Je=[],Lt=null,Jn=Dt.some((se)=>/\bserver\b/.test(se[1]||"")&&/\bcache\b/.test(se[1]||"")),bt=null,et=null,Bt=null,rn=0,Wt=null;if(wl(a),Jn&&Ks>0){let se=Sl({props:t,slot:ke,slotContext:i.trim()?$l(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:it});if(se!==null){bt=`${L}\x00${x(re)}\x00${se}`;let ae=Hn.get(bt);if(ae){for(let we of ae.dependencies)v.add(we);if(Kr(c,ae.clientFactories),dt.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}et=new Set(v),Bt=Zr(c),rn=dt.n,Wt=new Set(Array.isArray(c.__stx_preserved_client_expressions)?c.__stx_preserved_client_expressions:[])}}let zt=new Set;for(let se of Dt){let ae=se[1]||"",we=se[2]||"",be=ae.includes("server");if(je(ae)&&we.trim())we=Be(we);if(be&&we){for(let Ae of Me(we))zt.add(Ae);try{await B(we,We,L,{onFailure:(Ae)=>{if(Ae.kind!=="unknown")Lt=Ae.kind}})}catch(Ae){}}if(!be){let Ae=we.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),ct=Ae.includes("{{")&&Ae.includes("}}"),lt=Ae.includes("{!!")&&Ae.includes("!!}");if(ct||lt)Ae=wi(Ae,We,L);let yt=ae.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");Je.push(`<script${yt}>${Ae}</script>`)}}let Ge=G(re).output.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),Ft=Ge?Ge[1]:"",Gn=Ge?Ge[2]:"",tt="",ne=Ft&&/\bscoped\b/i.test(Ft);if(Ge)tt=`<style${Ft}>${Tl(Gn,We,L)}</style>`;let ie=Tt;if(ie=ie.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),Ge)ie=ie.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let se=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,ae=[];if(ie=ie.replace(se,(we,be)=>{let Ue=be.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(Ue)ae.push(`<style${Ue[1]}>${Ue[2]}</style>`);return""}),ie=ie.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),ae.length>0)tt=`${tt}${ae.join(`
289
- `)}`}if(i&&ie.includes("{{ text || slot }}"))ie=ie.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>i);let{applySlots:ue}=await o("stx/slots",()=>import("./chunk-w717cyka.js")),{defaultSlot:$e,namedSlots:Ce}=ft,qe=c.__stx_signals_gate===!0&&/\s(?:@[\w:.-]+|x-on:[\w:.-]+)\s*=/.test(Ze),nt=a._nativeHostAttrs===!0&&Je.length>0||qe&&Je.length>0||Je.some((se)=>/\b(?:state|derived|effect|ref|useRef|reactive|computed|watch|watchEffect|useModel|useReactiveProp|onMount|onDestroy|defineProps|withDefaults|defineEmits|defineExpose|defineSlots)\s*(?:<[^<>()]*>)?\s*\(/.test(se)),Yn=(se)=>nt?Ni(se,it):se,Qn=new Map([...Ce].map(([se,ae])=>[se,{...ae,content:Yn(ae.content)}]));ie=await ue(ie,Yn($e),Qn,We,nt?it:"");let on=yi(Je),Ut=(Array.isArray(We.__stx_client_signal_names)?We.__stx_client_signal_names:[]).filter((se)=>!zt.has(se));if(on.length>0||Ut.length>0)We.__stx_client_signal_names=[...new Set([...Ut,...on])];else delete We.__stx_client_signal_names;let Vt=E.filter((se)=>!zt.has(se)&&!(se in t));if(Vt.length>0)We[Bn]=Vt;let cn={...a,_rootComponentsDir:a._rootComponentsDir||a.componentsDir,componentsDir:ce.dirname(L),skipSignalsRuntime:!0,skipEventDirectives:a._nativeHostAttrs===!0||nt||Je.length===0,defaultLayout:void 0};We.__stxProcessingDepth=(c.__stxProcessingDepth||0)+1;let{processDirectives:an}=await o("stx/process",()=>import("./chunk-2m60sqvs.js")),Ye=await an(ie,We,L,cn,v),ot=new Set(Array.isArray(c.__stx_preserved_client_expressions)?c.__stx_preserved_client_expressions:[]);for(let se of Ye.matchAll(/\{\{([\s\S]*?)\}\}/g))ot.add(se[1].trim());if(ot.size>0)c.__stx_preserved_client_expressions=[...ot];let st=it,Ke=Ye;if(nt){let se="";if(Object.keys(t).length>0)try{se=` data-stx-props="${Cs(JSON.stringify(t))}"`}catch{}let ae=Q?` stx-hydrate="${Cs(Q)}"`:"",we=Object.fromEntries(Object.entries(pt).map(([gt,_t])=>[gt,Boolean(_t)])),be=Object.keys(we).length>0?` data-stx-slots="${Cs(JSON.stringify(we))}"`:"",Ue=` data-stx-scope="${st}"${se}${be}${ae}`,Ae=/^\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*<span(?=[\s/>])/i.test(Ye),ct=/^\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*<[^>]+\bdata-stx-layout-root(?:\s|=|>)/i.test(Ye),lt=/^\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*<[^>]+\bdata-stx-fill-root(?:\s|=|>)/i.test(Ye),yt=Ae?"span":"div",es=ct&&a._nativeHostAttrs?' style="display:flex;flex-direction:column;flex:1;min-height:0;min-width:0"':lt&&a._nativeHostAttrs?' style="width:100%;height:100%"':Ae||ct?' style="display:contents"':"";Ke=pg(Ye,Ue)??`<${yt}${Ue} data-stx-component-wrapper${es}>${Ye}</${yt}>`;let ts=await Promise.all(Je.map(async(gt)=>{let _t=gt.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!_t)return gt;let[,Ht,ns]=_t,ln=ao(gt,We,L);if(ln!==null)return ln;let wt=await Pl(ns,L,a.buildMode==="compile"),un=yn(wt.clientCode,De(We)),{vendorStyleTags:_n}=wt,mt=un?`function(__scopeId) {
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) {
290
291
  ${un}
291
292
  return (${wt.factoryBody})(__scopeId);
292
- }`:wt.factoryBody,Sn=Q?null:hs(c,mt),Zt=Sn?`window.__stxComponentFactories[${JSON.stringify(Sn)}](${JSON.stringify(st)});`:`(${mt})(${JSON.stringify(st)});`;if(Q)return`${_n}<script type="stx/island" data-stx-island="${st}" data-stx-scoped data-stx-owner="${st}"${Ht}>${Zt}</script>`;return`${_n}<script data-stx-scoped data-stx-run="always" data-stx-owner="${st}"${Ht}>${Zt}</script>`}));if(Ke=Ke+`
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+`
293
294
  `+ts.join(`
294
- `),tt)Ke+=`
295
- `+tt}else{if(tt)Ke+=`
296
- `+tt;if(Je.length>0){let se=We.__stx_event_bindings||[],ae=De(We),we=await Promise.all(Je.map(async(be)=>{let Ue=ao(be,We,L);if(Ue!==null)return Ue;let Ae=be.match(/<script\b[^>]*>([\s\S]*?)<\/script>/);if(!Ae)return be;return await Le(Ae[1],{eventBindings:se,templateContent:Ke,filePath:L,projectRoot:process.cwd(),serverData:ae,instanceId:it})}));Ke+=`
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+=`
297
298
  `+we.join(`
298
- `),We.__stx_event_bindings=[]}}if(ne){let se=Bs(Ke,L);if(se.hasScoped)Ke=se.html}if(bt&&et){let se=Array.isArray(c.__stx_preserved_client_expressions)?c.__stx_preserved_client_expressions:[];Hn.set(bt,{output:Ke,dependencies:[...v].filter((ae)=>!et.has(ae)),clientFactories:Bt?qr(c,Bt):[],uidsConsumed:dt.n-rn,preservedClientExpressions:Wt?se.filter((ae)=>!Wt.has(ae)):[]})}if(Lt)Ke=`<!--stx-render-failed:${Lt}-->${Ke}`;return Xe.length>0?`${Ke}
299
- ${Xe.join(`
300
- `)}`:Ke}catch(X){if(X instanceof q)throw X;return`[Error processing component: ${X instanceof Error?X.message:String(X)}]`}finally{D.delete(e)}}async function s(e){return Bun.file(e).exists()}function Xs(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 bo(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 Ol(e,t,i,n);if(c===null)return null;let l=Xs(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(Xs(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 Ol(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=Xs(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 bo(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 j=await a(I);if(n)n.add(j);return j}}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"),j=!1;try{j=Zn.statSync(I,{throwIfNoEntry:!1})?.isDirectory()??!1}catch{}if(j){v.push(I);break}let Q=ce.dirname(E);if(Q===E||Q.length<A.length)break;E=Q}for(let D of v){let I=await bo(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,j=[ce.join(D,I)];if(!e.endsWith(".stx"))j.push(`${j[0]}.stx`);for(let Q of j)if(await s(Q)){if(i.debug)console.log(`Found in options.fallbackLayoutsDir: ${Q}`);if(n)n.add(Q);return Q}}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 j=`${I}.stx`;if(await s(j)){if(i.debug)console.log(`Found in layouts path with extension: ${j}`);if(n)n.add(j);return j}}}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 j=`${I}.stx`;if(await s(j)){if(i.debug)console.log(`Found in partials layouts dir with extension: ${j}`);if(n)n.add(j);return j}}}}let M=i.partialsDir||ce.join(process.cwd(),"views"),B=ce.join(M,e);if(await s(B)){if(i.debug)console.log(`Found in views path: ${B}`);if(n)n.add(B);return B}if(!e.endsWith(".stx")){let D=`${B}.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(`
301
- `),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,B)=>{let D=E+B+1;return`${D===n?"> ":" "}${D}: ${M}`}).join(`
302
- `);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 Ee={reset:"\x1B[0m",bold:"\x1B[1m",dim:"\x1B[2m",red:"\x1B[31m",yellow:"\x1B[33m",blue:"\x1B[34m",cyan:"\x1B[36m",gray:"\x1B[90m",bgRed:"\x1B[41m",bgYellow:"\x1B[43m"};function h(e,t,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(`
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(`
303
304
  `,Math.max(0,c-1));E=c-(M+1)+1}let A="";if(a>0)A+=`
304
305
  ${i}:${a}${E>0?`:${E}`:""}: ${e.toLowerCase()} error: ${t}
305
306
  `;if(A+=`
306
- ${Ee.bold}${Ee.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${Ee.reset}
307
- `,A+=`${Ee.bold}${Ee.red}\u2502${Ee.reset} ${Ee.bold}${Ee.bgRed} ERROR ${Ee.reset} ${Ee.red}${e} Error${Ee.reset}${" ".repeat(Math.max(0,43-e.length))}${Ee.bold}${Ee.red}\u2502${Ee.reset}
308
- `,A+=`${Ee.bold}${Ee.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${Ee.reset}
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}
309
310
  `,A+=`
310
- ${Ee.cyan}${Ee.bold}File:${Ee.reset} ${Ee.dim}${v}${Ee.reset}`,a>0)A+=` ${Ee.gray}(line ${a}${E>0?`, col ${E}`:""})${Ee.reset}`;if(A+=`
311
- ${Ee.yellow}${Ee.bold}Message:${Ee.reset} ${t}
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}
312
313
  `,y)A+=`
313
- ${Ee.blue}${Ee.bold}Context:${Ee.reset}
314
- ${Ee.dim}${y}${Ee.reset}
315
- `;return A}function fe(){tn.clear(),Ts.clear(),Vn.clear(),Ps.clear(),Zs.clear(),Hn.clear()}function Xh(){return{size:tn.size,maxSize:500}}var As=b(128);async function Pl(e,t,i){let n=x(e,t,i),c=As.get(n);if(c){if(Ls(c.deps))return c;As.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-526n626z.js")),A=[],M=!1;if(v(a)){let z=a;a=await E(z,t,{projectRoot:process.cwd(),minify:i,collectInputs:A}),M=a===z}let{stripStxRuntimeImports:B}=await o("stx/signal-processing",()=>import("./chunk-54w0epxq.js"));a=B(a);let D=P(a),I=El(D),j=new Set(H(D,!0).split(",").map((z)=>z.trim())),Q=`function(__scopeId) {
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) {
316
317
  ${at("const",[...ll,...I],D)}
317
318
  const __scope = window.stx._scopes = window.stx._scopes || {};
318
319
  const __scopeVars = __scope[__scopeId] = __scope[__scopeId] || {};
@@ -378,7 +379,7 @@ ${D}
378
379
  // Register all defined signals and functions in this scope
379
380
  const __localVars = {};
380
381
  try {
381
- ${I.map((z)=>j.has(z)?`Object.defineProperty(__localVars, '${z}', ${Is(z)});`:`if (typeof ${z} !== 'undefined') __localVars['${z}'] = ${z};`).join(`
382
+ ${I.map((Q)=>B.has(Q)?`Object.defineProperty(__localVars, '${Q}', ${Ps(Q)});`:`if (typeof ${Q} !== 'undefined') __localVars['${Q}'] = ${Q};`).join(`
382
383
  `)}
383
384
  }
384
385
  catch (e) {}
@@ -397,24 +398,24 @@ finally {
397
398
  window.__STX_CURRENT_ELEMENT__ = __previousCurrentElement;
398
399
  window.__STX_CURRENT_PROPS__ = __previousCurrentProps;
399
400
  }
400
- }`,X={vendorStyleTags:y,factoryBody:Q,clientCode:D,deps:br([...A,...l.styles.map((z)=>z.resolvedPath)])};if(!M&&l.unresolved.length===0)As.set(n,X);return X}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 Dl=100,Ml=599,Qs="__stxResponseStatus",nn="__stxResponseHeaders";function qn(e){return typeof e==="number"&&Number.isInteger(e)&&e>=Dl&&e<=Ml}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(qn(n))return n}return}function Gs(e,t){if(!e||typeof e!=="object")return!1;let i=typeof t==="string"&&/^\d+$/.test(t.trim())?Number(t.trim()):t;if(!qn(i))return!1;return e[Qs]=i,!0}function jl(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?.[Qs];return qn(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[Qs]=i;let n=Ot(e);if(n)t[nn]={...t[nn],...n}}function Fs(e){return{setResponseStatus:(t)=>{Gs(e,t)},notFound:(t=404)=>{let i=qn(t)&&t>=400?t:404;Gs(e,i)},setResponseHeader:(t,i)=>{jl(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=Nl(e,E.index+E[0].length-1);if(A<0)break;let M=e.slice(E.index+E[0].length,A).trim(),B=/^\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(!Gs(t,B))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 Nl(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 $o=new Set(hn),Ll=new Set(["props","$props","defineProps"]),Bl=new Set(["stx","@stacksjs/stx"]),vo=b(128),Eo=b(64);function Wl(e){let t=[],i=0,n=e.split(`
401
- `);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((B)=>{let D=B.split(":");return(D.length>1?D[1]:D[0]).trim()}).filter((B)=>/^\w+$/.test(B));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("..."),B=M?A.slice(3):A,D=-1,I=0;for(let te=0;te<B.length;te++)if(B[te]==="<")I++;else if(B[te]===">")I--;else if(B[te]===":"&&I===0){D=te;break}if(D===-1)return E;let Q=B.substring(0,D).trim().replace(/\?$/,""),X=B.substring(D+1),z=-1,L=0;for(let te=0;te<X.length;te++)if(X[te]==="<")L++;else if(X[te]===">")L--;else if(X[te]==="="&&L===0){z=te;break}let ee=M?"...":"";if(z!==-1)return`${ee}${Q} = ${X.substring(z+1).trim()}`;return`${ee}${Q}`}).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 B=i(M);l.push({start:a+1,end:v,replacement:B})}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,`
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,`
402
403
 
403
- `),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 ko=new Set;async function m(e,t,i,n={}){if(!e.trim())return;let c=C(),l=x(e,JSON.stringify(c)),a=vo.get(l);if(a===void 0){try{let ne=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=ne.transformSync(ie)}catch{a=Yf(e)}vo.set(l,a)}let y={exports:{}},v=y.exports,E=kt.cwd(),A={},M=[...a.matchAll(/require\s*\(\s*['"]([^'"]+)['"]\s*\)/g)||[]].map((ne)=>ne[1]).filter((ne)=>!ne.startsWith("node:")&&!["fs","path","os","child_process","crypto","http","https","url","util","stream","events","buffer","net","querystring","zlib","tls"].includes(ne)),B=new Map;for(let ne of M)try{if(ne.startsWith(".")){A[ne]=await import(Qe.resolve(Qe.dirname(i),ne));continue}let ie=Qe.resolve(E,"node_modules",ne),ue=Qe.join(ie,"package.json"),$e=JSON.parse(g("fs").readFileSync(ue,"utf8")),Ce=$e.main||"index.js";if($e.exports){let qe=typeof $e.exports==="string"?$e.exports:$e.exports["."];if(typeof qe==="string")Ce=qe;else if(qe?.bun)Ce=qe.bun;else if(qe?.import)Ce=qe.import;else if(qe?.default)Ce=qe.default}A[ne]=await import(Qe.resolve(ie,Ce))}catch(ie){if(ne.startsWith("."))B.set(ne,ie instanceof Error?ie.message:String(ie))}let D=(ne)=>{if(A[ne])return A[ne];let ie=B.get(ne);if(ie!==void 0)throw Error(`Cannot require '${ne}' from ${i}: ${ie}`);return g(ne)},I=t.props||{},j=(ne)=>{if(!ne)return I;let ie={};for(let[ue,$e]of Object.entries(ne)){let Ce=I[ue];if(Ce!==void 0)ie[ue]=Ce;else if(typeof $e==="function")ie[ue]=$e();else ie[ue]=$e}return ie};for(let[ne,ie]of Object.entries(I))Object.defineProperty(j,ne,{value:ie,enumerable:!0,configurable:!0,writable:!0});let Q=(ne,ie=!1)=>{if(ne===void 0||ne===null)return ie;if(typeof ne==="string"){let ue=ne.trim().toLowerCase();if(ue===""||ue==="true"||ue==="1"||ue==="on"||ue==="yes")return!0;if(ue==="false"||ue==="0"||ue==="off"||ue==="no")return!1;return!0}return Boolean(ne)},X=(ne,ie=0)=>{if(ne===void 0||ne===null)return ie;if(typeof ne==="string"){let $e=ne.trim();if($e==="")return ie;let Ce=Number($e);return Number.isFinite(Ce)?Ce:ie}let ue=Number(ne);return Number.isFinite(ue)?ue:ie};for(let ne of["name","length","caller","arguments"]){if(Object.prototype.hasOwnProperty.call(I,ne))continue;try{Object.defineProperty(j,ne,{value:void 0,enumerable:!1,configurable:!0,writable:!0})}catch{}}let z=(ne)=>{if(!ne)return I;let ie={...I};for(let[ue,$e]of Object.entries(ne)){let Ce=$e&&typeof $e==="object"&&!Array.isArray($e)?$e:{type:$e};if(ie[ue]===void 0&&Ce.default!==void 0)ie[ue]=typeof Ce.default==="function"?Ce.default():Ce.default}return ie},L=()=>t.slots||{},ee=(ne,ie)=>{let ue={...ne};for(let[$e,Ce]of Object.entries(ie))if(ue[$e]===void 0)if(typeof Ce==="function")ue[$e]=Ce();else ue[$e]=Ce;return ue},te=(ne)=>{let ie=()=>ne;return ie.set=(ue)=>{},ie.update=(ue)=>{},ie},re=(ne)=>{let ie,ue=!1;return()=>{if(!ue)try{ie=ne(),ue=!0}catch{ie=void 0}return ie}},me=(ne)=>{},he=(ne)=>ne(),le=(ne)=>{},ke=(ne)=>{},Re=Fs(t);function He(ne){let ie=ne||{};if(ie.title!==void 0||ie.description!==void 0)pt({title:ie.title,description:ie.description})}function Xe(ne){if(!ne||typeof ne!=="object")return;let ie=t.__stxClientPayload??{};Object.assign(ie,ne),t.__stxClientPayload=ie}let Ze=()=>{let ne=t.__stxServeContext,ie=t.__stxServeSearch??ne?.search??"",ue=ne?.path??"",$e=Object.fromEntries(new URLSearchParams(ie)),Ce=t.query,qe=Object.keys($e).length>0?$e:Ce??{},nt=ie||(Object.keys(qe).length>0?`?${new URLSearchParams(qe).toString()}`:"");return{params:t.params??{},query:qe,path:ue,name:"",fullPath:ue+nt,hash:"",matched:[]}},Kn=()=>({push:(ne)=>{},replace:(ne)=>{},back:()=>{},forward:()=>{},go:(ne)=>{}}),ft=(ne)=>{let ie=t.__stx_runtime_head||{};t.__stx_runtime_head=Ve(ie,_e(ne||{},{known:Js,source:"useHead()"}))},pt=(ne)=>{ft(Ys(ne||{}))},dt=(ne)=>({value:ne}),Ct=(ne)=>ne,tr=(ne)=>({value:typeof ne==="function"?ne():ne}),it=(ne,ie)=>{},We=(ne)=>{},Tt=(ne)=>{},sn=(ne)=>ne?ne():Promise.resolve(),Xn=(ne)=>(ie,...ue)=>{},Dt=(ne)=>{},Je=(ne,ie)=>{},Lt=(ne,ie)=>ie,Jn=()=>({value:"light"}),bt=()=>te(!1),et=(ne)=>te(!1),Bt=()=>te(!1),rn=()=>et("(prefers-color-scheme: dark)"),Wt=()=>et("(prefers-color-scheme: light)"),zt=()=>et("(prefers-reduced-motion: reduce)"),nr=()=>et("(prefers-contrast: more)"),Ge={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:{}},Ft=new Proxy(Ge,{get(ne,ie){if(ie in ne)return ne[ie];return},set(ne,ie,ue){return ne[ie]=ue,!0}}),Gn={getElementById:()=>null,querySelector:()=>null,querySelectorAll:()=>[],createElement:()=>({}),createTextNode:()=>({}),body:{},head:{},documentElement:{},addEventListener:()=>{},removeEventListener:()=>{}},tt=console;try{let ne=gi(a,i),ie=new Set(Object.keys(I)),ue=Object.keys(t).filter((se)=>!ie.has(se)&&!Ll.has(se)&&jt(se)),$e=ue.map((se)=>t[se]);if(!ue.includes("__stxServeContext"))ue.push("__stxServeContext"),$e.push(void 0);if(!ie.has("cookies")){let se=t.cookies??t.__stxServeContext?.cookies??{},ae=ue.indexOf("cookies");if(ae<0)ue.push("cookies"),$e.push(se);else $e[ae]=se}let Ce=new Set(["async","module","exports","require","params","window","document","console","state","derived","effect"]),qe=[],nt=[];for(let[se,ae]of Object.entries(I)){if(!jt(se))continue;if(Ce.has(se))continue;if(new RegExp(`(?:^|[\\s;{])(?:const|let|var|function)\\s+${se}\\b`).test(ne))continue;qe.push(se),nt.push(ae)}let Qn=Wl(ne).map((se)=>`module.exports.${se} = typeof ${se} !== 'undefined' ? ${se} : module.exports.${se};`).join(`
404
- `),on=t.params??{},Ut=[],Vt=[];for(let se=0;se<ue.length;se++){if(ue[se]==="params")continue;Ut.push(ue[se]),Vt.push($e[se])}let cn=[...hn,...qe,...Ut],an=`return (async () => {
405
- ${ne}
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}
406
407
  ${Qn}
407
408
  return module.exports
408
- })()`,Ye=x(an,cn.join("\x00")),ot=Eo.get(Ye);if(!ot)ot=Function(...cn,an),Eo.set(Ye,ot);let st=t.__stx_options?.runtimeConfig;if(st||/\buse(?:Server)?RuntimeConfig\b/.test(a))await vn(t,i,st);let Ke=await ze(t.__stx_runtime_config??xn()??N(),()=>ar(t,()=>ot(y,v,D,I,j,Q,X,z,ee,Xe,lr,xi,Ws,te,re,me,he,le,ke,He,Ze,Kn,ft,pt,Re.setResponseStatus,Re.setResponseHeader,Re.notFound,dt,Ct,tr,it,We,Tt,sn,Xn,Dt,L,Je,Lt,Jn,bt,et,Bt,rn,Wt,zt,nr,Ft,Gn,tt,Ge.confirm,Ge.alert,Ge.fetch,on,...nt,...Vt)));if(n.preserveExisting){for(let[se,ae]of Object.entries(Ke))if(!(se in t)||t[se]===void 0)t[se]=ae}else Object.assign(t,Ke);for(let[se,ae]of Object.entries(I))if(!(se in t))t[se]=ae}catch(ne){if(t.__stx_strict_hydration)throw ne;let ie=Zf(ne instanceof Error?ne.message:String(ne));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:ne});else if(eg(ne))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:ne});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:ne});else{let ue=`${i??"<unknown>"}\x00${ie}`;if(kt.env.STX_DEBUG||!ko.has(ue))ko.add(ue),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:ne})}try{await Zl(a,t,i)}catch(ue){if(kt.env.STX_DEBUG){let $e=ue instanceof Error?ue.message:String(ue);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 zl=/^(?:export\s+)?(?:const|let|var)\s+[A-Za-z_$][\w$]*(?:\s*,\s*[A-Za-z_$][\w$]*)*\s*;?$/;function gi(e,t){let i=t?Qe.dirname(t):kt.cwd(),n=kt.cwd(),c=e.split(`
409
- `),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,j=!1,Q=c[D];for(let X=0;X<Q.length;X++){let z=Q[X];if(j){j=!1;continue}if(z==="\\"){j=!0;continue}if(I){if(z===I)I=null;continue}if(z==='"'||z==="'"||z==="`"){I=z;continue}if(z==="(")v++;else if(z===")"){if(v--,v===0){a=D+1,E=!0;break}}}}if(!E)a=c.length;let M=c.slice(A,a).join(`
410
- `),B=[];for(let D of["title","description"]){let I=new RegExp(`\\b${D}\\s*:\\s*(['"\`])((?:\\\\.|(?!\\1)[^\\\\])*)\\1`).exec(M);if(I)B.push(`${D}: ${JSON.stringify(I[2])}`)}if(B.length>0)l.push(`useSeoMeta({ ${B.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+['"](.+?)['"]/),B=v.match(/^import\s*['"](.+?)['"]/),D=v,I=(j)=>{if(j.startsWith("."))return Qe.resolve(i,j);if(j.startsWith("~/")||j.startsWith("@/"))return Qe.resolve(n,j.slice(2));try{return Bun.resolveSync(j,i)}catch{return j}};if(A){let[,j,Q]=A,X=I(Q);l.push(`const ${j} = (await import('${X}')).default`),l.push(`module.exports.${j} = ${j};`)}else if(M){let[,j,Q]=M,X=I(Q),z=[],L=[],ee=Bl.has(Q);for(let te of j.split(",")){let re=te.trim();if(!re)continue;let me=re.split(/\s+as\s+/);if(me.length===2){let[he,le]=[me[0].trim(),me[1].trim()];if(ee&&$o.has(he)){l.push(`const ${le} = ${he};`);continue}z.push(`${he}: ${le}`),L.push(le)}else{if(ee&&$o.has(re))continue;z.push(re),L.push(re)}}if(z.length>0)l.push(`const { ${z.join(", ")} } = await import('${X}')`);for(let te of L)l.push(`module.exports.${te} = ${te};`)}else if(B){let j=I(B[1]);l.push(`await import('${j}')`)}else l.push(D);a++;continue}if(zl.test(y))l.push(c[a]),a++;else if(y.startsWith("export const ")||y.startsWith("export let ")||y.startsWith("export var ")){let v=Co(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=er(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=Co(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=er(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=er(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,B=a;for(;B<c.length;B++){let D=c[B];for(let I of D)if(I==="{")M++;else if(I==="}")M--;if(B>a)A+=`
411
- `+D;if(M<=0&&B>=a)break}l.push(A),l.push(`module.exports.${E} = ${E};`),a=B+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 Fl(l.join(`
412
- `),i,n)}function Fl(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===`
413
- `)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 B=Ul(e,l);if(B){let{quote:D,path:I,end:j}=B;if(I.startsWith(".")||I.startsWith("~/")||I.startsWith("@/")){let Q=I.startsWith(".")?Qe.resolve(t,I):Qe.resolve(i,I.slice(2));c+=`await import(${D}${Q}${D})`,l=j;continue}}}c+=A,l++}return c}function Ul(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 Oo(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 Po(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?Oo(i,n):null;if(y){t.push(...Po(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 Ro(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 Co(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),B=t;if(M.startsWith("{")||M.startsWith("[")){let I=M[0],j=I==="{"?"}":"]",Q=Ro(M,I,j,0),X=M;for(let z=t+1;z<e.length&&Q>0;z++)X+=` ${e[z].trim()}`,B=z,Q=Ro(e[z],I,j,Q);if(Q>0)X=M,B=t;M=X}let D=Oo(M,0);if(D){let I=A[1],j=D.pattern,Q=M.slice(D.endPos).trim();if(Q.startsWith("=")){let X=Q.slice(1).trim(),z=X,L=Math.max(B,t);if(Ao(X)){let me=To(e,L,X);z=me.value,L=me.nextIndex}else L=L+1;z=z.trim().replace(/;$/,"");let ee=Po(j),te=`__stx_src_${t}`,re=ee.map((me)=>`module.exports.${me} = ${me};`).join(`
414
- `);return{type:I,name:te,value:`${z}; ${I} ${j} = ${te};
415
- ${re}`,nextIndex:L}}}}throw Error(`Failed to parse variable declaration: ${i}`)}let[,l,a,y]=c,v=y,E=t;if(Ao(y)){let A=To(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+=`
416
- ${e[E]}`,E++;else break}return v=v.trim().replace(/;$/,""),{type:l,name:a,value:v,nextIndex:E}}function er(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(Vl(i)){let y=Hl(e,t,l);l=y.functionCode,a=y.nextIndex}else a=t+1;return{name:c,functionCode:l,nextIndex:a}}function Ao(e){let t=e.trim();if(t.startsWith("{"))return w(t,"{","}",0)===-1;if(t.startsWith("["))return w(t,"[","]",0)===-1;return!Do(t)}function Do(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 Mo(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 Vl(e){let t=Mo(e);if(t===-1)return!0;return w(e,"{","}",t)===-1}function To(e,t,i){let n=i,c=t+1;while(c<e.length&&!Do(n)){let l=e[c];n+=`
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+=`
417
418
  ${l}`,c++}while(c<e.length){let l=e[c].trim();if(l.startsWith(".")||l.startsWith("?."))n+=`
418
- ${e[c]}`,c++;else break}return{value:n,nextIndex:c}}function Hl(e,t,i){let n=i,c=t+1;while(c<e.length){let l=Mo(n);if(l!==-1){if(w(n,"{","}",l)!==-1)break}let a=e[c];n+=`
419
- ${a}`,c++}return{functionCode:n,nextIndex:c}}function Io(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:{...kt.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 Zl(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=Io(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=Io(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)}
420
- export{Pe,ve,H,Is,Os,V,yr,Ns,Ms,oi,ii,Ds,ai,$c,Rt,Ie,o,dn,b,Rc,x,br,Ls,xe,C,Oe,de,wr,W,pn,Ne,S,Ac,pe,G,vr,xr,oe,At,J,O,rt,Sr,kr,Pt,ci,js,Jf,Me,Pc,Ic,Oc,li,Nc,_r,ui,Mc,Dc,di,pi,fn,Bs,gn,It,Ot,Lc,Fs,jc,mn,Cr,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,Er,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};
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};