@stacksjs/stx 0.2.511 → 0.2.513

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 (126) hide show
  1. package/dist/{chunk-m6xpg33p.js → chunk-03mkxevd.js} +1 -1
  2. package/dist/{chunk-xd4zvm4x.js → chunk-1aw9qbdf.js} +3 -0
  3. package/dist/chunk-1mkyksne.js +2 -0
  4. package/dist/chunk-1wbmg22q.js +2 -0
  5. package/dist/chunk-2bdxrryj.js +2 -0
  6. package/dist/chunk-2hsp5gee.js +2 -0
  7. package/dist/{chunk-qa53jmk3.js → chunk-2yegk32c.js} +1 -1
  8. package/dist/{chunk-g495xx4v.js → chunk-365ktg70.js} +1 -1
  9. package/dist/{chunk-pj562qnx.js → chunk-38x0j2tz.js} +1 -1
  10. package/dist/chunk-3kxh9rsp.js +2 -0
  11. package/dist/chunk-3vqabd10.js +2 -0
  12. package/dist/{chunk-rvwtyrj4.js → chunk-3y8ykqpx.js} +1 -1
  13. package/dist/chunk-490f2x2r.js +2 -0
  14. package/dist/{chunk-j7bncsd9.js → chunk-4a9tt7cd.js} +1 -1
  15. package/dist/{chunk-qv57r0fa.js → chunk-4c1afy15.js} +1 -1
  16. package/dist/{chunk-8nv7xakv.js → chunk-4njn89w1.js} +5 -5
  17. package/dist/chunk-4yrk774b.js +2 -0
  18. package/dist/chunk-518kr9jb.js +2 -0
  19. package/dist/{chunk-s9fskxy7.js → chunk-5a4wj7t4.js} +5 -5
  20. package/dist/chunk-5c1qesrs.js +2 -0
  21. package/dist/chunk-5pzhcesm.js +2 -0
  22. package/dist/chunk-6bay462v.js +2 -0
  23. package/dist/{chunk-zz5b1g50.js → chunk-6k4f583z.js} +2 -2
  24. package/dist/{chunk-g7g6rc6e.js → chunk-6tmbgcv9.js} +4 -4
  25. package/dist/{chunk-1r3fmmy8.js → chunk-7smpjzzh.js} +1 -1
  26. package/dist/{chunk-mwz1mq51.js → chunk-7tzf1e7f.js} +4 -4
  27. package/dist/{chunk-5q9rmcp7.js → chunk-802qf0vz.js} +1 -1
  28. package/dist/{chunk-ej46bkaw.js → chunk-8fb1mqw1.js} +1 -1
  29. package/dist/{chunk-km9g9drp.js → chunk-9c86wgnk.js} +1 -1
  30. package/dist/{chunk-7pr8gvpc.js → chunk-a59nwgg6.js} +1 -1
  31. package/dist/chunk-a9anp4pr.js +2 -0
  32. package/dist/chunk-b0bgprzs.js +2 -0
  33. package/dist/{chunk-hka18tmt.js → chunk-bqz4wenr.js} +1 -1
  34. package/dist/chunk-bvq2hx8a.js +2 -0
  35. package/dist/{chunk-1149d93e.js → chunk-czmw5xsd.js} +2 -2
  36. package/dist/{chunk-tv2xr7s3.js → chunk-dhrzmvbj.js} +1 -1
  37. package/dist/{chunk-twqmyetp.js → chunk-dq6v78fd.js} +1 -1
  38. package/dist/chunk-epbnttw5.js +2 -0
  39. package/dist/{chunk-46wre9ep.js → chunk-fesb4h31.js} +3 -3
  40. package/dist/{chunk-npth2waq.js → chunk-fjet17jc.js} +1 -1
  41. package/dist/{chunk-5tvxv2v1.js → chunk-fp7dzqze.js} +1 -1
  42. package/dist/{chunk-68tzytfz.js → chunk-fxxrrq9n.js} +3 -3
  43. package/dist/{chunk-5tbqdz94.js → chunk-gbfap7rv.js} +2 -2
  44. package/dist/{chunk-1verz406.js → chunk-gte0wmh8.js} +5 -5
  45. package/dist/{chunk-9p3rtfbv.js → chunk-gynes6rm.js} +8 -8
  46. package/dist/{chunk-s7rbe4c6.js → chunk-h5nv63qx.js} +1 -1
  47. package/dist/{chunk-vtxzaj1h.js → chunk-hktvv0hd.js} +2 -2
  48. package/dist/{chunk-z2775k8r.js → chunk-hmyyq2hh.js} +1 -1
  49. package/dist/{chunk-5vzts63r.js → chunk-hnz2zh9q.js} +1 -1
  50. package/dist/{chunk-t77pz252.js → chunk-hqvdm4h9.js} +1 -1
  51. package/dist/chunk-j49qp4z7.js +2 -0
  52. package/dist/{chunk-vftdacyb.js → chunk-jbvg29t0.js} +1 -1
  53. package/dist/chunk-jc25dv0f.js +2 -0
  54. package/dist/{chunk-k14e9k4h.js → chunk-jf59xwba.js} +1 -1
  55. package/dist/chunk-jg62944p.js +2 -0
  56. package/dist/chunk-md8m0mpb.js +2 -0
  57. package/dist/{chunk-ph4fszwq.js → chunk-mwac03ak.js} +1 -1
  58. package/dist/chunk-ntx4axaf.js +2 -0
  59. package/dist/{chunk-91y360rc.js → chunk-p4gbvge6.js} +1 -1
  60. package/dist/chunk-pjayjj2m.js +2 -0
  61. package/dist/{chunk-5z69phk9.js → chunk-q9kq007t.js} +37 -37
  62. package/dist/chunk-qavbh6vm.js +2 -0
  63. package/dist/{chunk-a6djsvag.js → chunk-qfx532hv.js} +3 -3
  64. package/dist/chunk-qky9zfvx.js +2 -0
  65. package/dist/{chunk-x2ghjgxm.js → chunk-qm8atahn.js} +1 -1
  66. package/dist/{chunk-xmw9e9zn.js → chunk-rgh54rqz.js} +3 -3
  67. package/dist/{chunk-w9kj6t7s.js → chunk-rnnead1w.js} +1 -1
  68. package/dist/{chunk-2j1q5te2.js → chunk-shqtn2bj.js} +2 -2
  69. package/dist/chunk-skve9q8q.js +2 -0
  70. package/dist/{chunk-2dkyyewm.js → chunk-sqf60k0y.js} +2 -2
  71. package/dist/{chunk-4mmd282p.js → chunk-vdzhw78w.js} +1 -1
  72. package/dist/{chunk-g7wgpys2.js → chunk-vp827ah7.js} +4 -4
  73. package/dist/chunk-wy36z6qp.js +2 -0
  74. package/dist/{chunk-pan2t7h3.js → chunk-x1v0qyf9.js} +1 -1
  75. package/dist/chunk-x4xxfpn7.js +2 -0
  76. package/dist/{chunk-xemsypk7.js → chunk-x8mp9yvn.js} +4 -4
  77. package/dist/{chunk-tnxprz69.js → chunk-xevnx24r.js} +2 -2
  78. package/dist/chunk-xqgzwexs.js +2 -0
  79. package/dist/{chunk-e07ptggk.js → chunk-xs48j158.js} +78 -78
  80. package/dist/chunk-y3480mx8.js +2 -0
  81. package/dist/{chunk-068ank60.js → chunk-ygetbydb.js} +3 -3
  82. package/dist/{chunk-g1r4v0mc.js → chunk-yxdyh23k.js} +2 -2
  83. package/dist/{chunk-ke05jx3n.js → chunk-z6gbf119.js} +1 -1
  84. package/dist/{chunk-h6z4s5p3.js → chunk-z6nm6rf1.js} +1 -1
  85. package/dist/{chunk-7wnw3h4p.js → chunk-zgg589w4.js} +1 -1
  86. package/dist/{chunk-5zm23zrb.js → chunk-zsdhaj58.js} +40 -4
  87. package/dist/{chunk-5tkzfw4s.js → chunk-zv0vgamy.js} +3 -3
  88. package/dist/{chunk-gw9ax7xx.js → chunk-zvg1nqgw.js} +1 -1
  89. package/dist/cli.js +10 -10
  90. package/dist/craft-entry.js +2 -2
  91. package/dist/craft.js +2 -2
  92. package/dist/native/runtime/craft-bridge.js +3 -1
  93. package/dist/native/runtime/craft.d.ts +2 -0
  94. package/dist/pwa.js +2 -2
  95. package/dist/signals.js +38 -2
  96. package/dist/ssg.js +2 -2
  97. package/package.json +5 -5
  98. package/dist/chunk-11j2dj0r.js +0 -2
  99. package/dist/chunk-144xhefw.js +0 -2
  100. package/dist/chunk-18y7kk8n.js +0 -2
  101. package/dist/chunk-2a8dw04j.js +0 -2
  102. package/dist/chunk-2djfn17e.js +0 -2
  103. package/dist/chunk-2h4bf7m4.js +0 -2
  104. package/dist/chunk-33meqm5e.js +0 -2
  105. package/dist/chunk-3pczp9c0.js +0 -2
  106. package/dist/chunk-6ygvfpc5.js +0 -2
  107. package/dist/chunk-7bwkc5yf.js +0 -2
  108. package/dist/chunk-8ptefdpy.js +0 -2
  109. package/dist/chunk-8sjctqyw.js +0 -2
  110. package/dist/chunk-abxnep18.js +0 -2
  111. package/dist/chunk-aw8ehxde.js +0 -2
  112. package/dist/chunk-azv7g8rr.js +0 -2
  113. package/dist/chunk-c2vwq6gr.js +0 -2
  114. package/dist/chunk-c82gckm3.js +0 -2
  115. package/dist/chunk-dn4tww9q.js +0 -2
  116. package/dist/chunk-etbszapb.js +0 -2
  117. package/dist/chunk-j7nd8zfe.js +0 -2
  118. package/dist/chunk-jtwx2xte.js +0 -2
  119. package/dist/chunk-pzcw3trh.js +0 -2
  120. package/dist/chunk-q5jc8hmg.js +0 -2
  121. package/dist/chunk-rfqsgs51.js +0 -2
  122. package/dist/chunk-t7djn7zd.js +0 -2
  123. package/dist/chunk-vgkjmrf3.js +0 -2
  124. package/dist/chunk-w5w055g6.js +0 -2
  125. package/dist/chunk-x5gbrjm5.js +0 -2
  126. package/dist/chunk-zddtnyp7.js +0 -2
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{t,X,ir,i,te,Os,P,Rt,bn,Ms,c,p,D,Se,Ze,l,ar}from"./chunk-g495xx4v.js";import{Sn,kn,pr,Ce}from"./chunk-xd4zvm4x.js";import{wn,y,Pi,Pt,Ls,Ii,Di,Oi,Mi}from"./chunk-g1r4v0mc.js";import{I}from"./chunk-ba88n1j7.js";import{S,As,Je,Ps,Ei,un,pn,$i,xe,Ti,fn,_i,_t,Is,Ri,gn,hn,sr,pe,Ds,fe,or}from"./chunk-9p3rtfbv.js";import{$s,Ts,_s,Rs,er,tr}from"./chunk-5tbqdz94.js";import{de,Tt,Qn,Es,C,Xe}from"./chunk-zz5b1g50.js";import{dn}from"./chunk-twqmyetp.js";import{Hs}from"./chunk-e6y6s7q8.js";import{Si,ks,Yn,Zn}from"./chunk-kp4mzspk.js";import{mi,hi,bi,vi}from"./chunk-68tzytfz.js";import{Ke}from"./chunk-4drgbkga.js";import{s,ve}from"./chunk-xemsypk7.js";import{$t,Ci,cn,a,ln}from"./chunk-dne8n6h3.js";import{d}from"./chunk-yn2d8x8m.js";import{ge,O,vn}from"./chunk-vtxzaj1h.js";import{fr}from"./chunk-3ynfz6h8.js";import h0 from"fs";import gu from"path";import{createHighlighter as y0}from"ts-syntax-highlighter";import Js from"fs";import qt from"path";import{loadConfigWithResult as fu}from"bunfig";var cr={duration:300,delay:0,ease:"ease",direction:"both"};function mh(v,_={}){let{duration:k,delay:E,ease:T,direction:j,custom:B}={...cr,..._};if(v==="custom"&&B)return B;switch(v){case"fade":return`${j==="in"?"opacity: 0; animation: fadeIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":j==="out"?"opacity: 1; animation: fadeOut var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":"opacity: 1; transition: opacity var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);"}
2
+ import{t,X,ir,i,te,Os,P,Rt,bn,Ms,c,p,D,Se,Ze,l,ar}from"./chunk-365ktg70.js";import{Sn,kn,pr,Ce}from"./chunk-1aw9qbdf.js";import{vn,y,Pi,Pt,Ls,Ii,Di,Oi,Mi}from"./chunk-yxdyh23k.js";import{I}from"./chunk-ba88n1j7.js";import{S,As,Je,Ps,Ei,un,pn,$i,xe,_i,fn,Ti,Tt,Is,Ri,gn,hn,sr,pe,Ds,fe,or}from"./chunk-gynes6rm.js";import{$s,_s,Ts,Rs,er,tr}from"./chunk-gbfap7rv.js";import{de,_t,Qn,Es,C,Xe}from"./chunk-6k4f583z.js";import{dn}from"./chunk-dq6v78fd.js";import{Hs}from"./chunk-e6y6s7q8.js";import{Si,ks,Yn,Zn}from"./chunk-kp4mzspk.js";import{mi,hi,bi,wi}from"./chunk-fxxrrq9n.js";import{Ke}from"./chunk-4drgbkga.js";import{s,we}from"./chunk-x8mp9yvn.js";import{$t,Ci,cn,a,ln}from"./chunk-dne8n6h3.js";import{d}from"./chunk-yn2d8x8m.js";import{ge,O,wn}from"./chunk-hktvv0hd.js";import{fr}from"./chunk-3ynfz6h8.js";import h0 from"fs";import gu from"path";import{createHighlighter as y0}from"ts-syntax-highlighter";import Js from"fs";import qt from"path";import{loadConfigWithResult as fu}from"bunfig";var cr={duration:300,delay:0,ease:"ease",direction:"both"};function mh(v,_={}){let{duration:k,delay:E,ease:T,direction:j,custom:B}={...cr,..._};if(v==="custom"&&B)return B;switch(v){case"fade":return`${j==="in"?"opacity: 0; animation: fadeIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":j==="out"?"opacity: 1; animation: fadeOut var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":"opacity: 1; transition: opacity var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);"}
3
3
  @keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
4
4
  @keyframes fadeOut { from { opacity: 1; } to { opacity: 0; } }`;case"slide":return`${j==="in"?"transform: translateY(20px); opacity: 0; animation: slideIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":j==="out"?"transform: translateY(0); opacity: 1; animation: slideOut var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":"transform: translateY(0); opacity: 1; transition: transform var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms), opacity var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);"}
5
5
  @keyframes slideIn { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@@ -750,7 +750,7 @@ else {
750
750
  `)}
751
751
  })();
752
752
  </script>`}function Ah(v,_=""){let k=Du(v,_);if(k.length===0)return{template:v,bindings:[]};let E=v,T=[];for(let j=k.length-1;j>=0;j--){let B=k[j],z=B.originalTag;if(!z.includes(" id="))z=z.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${B.elementId}"`);else{let F=z.match(/id=["']([^"']+)["']/);if(F)for(let V of B.events)V.elementId=F[1]}for(let F of B.events){let V=F.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),H=new RegExp(`\\s*${V}\\s*=\\s*"[^"]*"`,"g"),G=new RegExp(`\\s*${V}\\s*=\\s*'[^']*'`,"g");z=z.replace(H,""),z=z.replace(G,"")}E=E.slice(0,B.startIndex)+z+E.slice(B.endIndex),T.push(...B.events)}return{template:E,bindings:T}}function Iu(v){let _=v.$uid;return typeof _==="string"&&_?`${_}_`:""}function Ou(v,_,k){if(Ii(v))return v;if(_.__stx_sfc_mode){if(/x-data\s*=\s*["']/.test(v))return v;let{template:z,bindings:F}=Ah(v,Iu(_)),V=_.__stx_event_bindings||[];return _.__stx_event_bindings=[...V,...F],z}let E=Du(v,Iu(_));if(E.length===0)return v;let T=v;for(let z=E.length-1;z>=0;z--){let F=E[z],V=F.originalTag;if(!V.includes(" id="))V=V.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${F.elementId}"`);else{let H=V.match(/id=["']([^"']+)["']/);if(H)for(let G of F.events)G.elementId=H[1]}for(let H of F.events){let G=H.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),J=new RegExp(`\\s*${G}\\s*=\\s*"[^"]*"`,"g"),ne=new RegExp(`\\s*${G}\\s*=\\s*'[^']*'`,"g");V=V.replace(J,""),V=V.replace(ne,"")}T=T.slice(0,F.startIndex)+V+T.slice(F.endIndex)}let j=Da(E.flatMap((z)=>z.events)),B=T.lastIndexOf("</body>");if(B!==-1)T=T.slice(0,B)+j+`
753
- `+T.slice(B);else T+=j;return T}function Mu(v,_){let k=new Set;for(let E of v.split(",")){let T=E.trim().replace(/^\.\.\./,"").trim();if(!T)continue;if(_){let j=T.lastIndexOf(":");if(j!==-1)T=T.slice(j+1).trim()}if(T=T.split("=")[0].trim(),/^[A-Za-z_$][\w$]*$/.test(T))k.add(T)}return k}function lo(v,_){let k=s(v),{depths:E,balanced:T}=ve(k),j=(z)=>!T||E[z]===0,B=new RegExp(`(?:^|[^\\w$.])((?:const|let|var|function|class)\\s+${_}\\b)`,"g");for(let z of k.matchAll(B)){let F=(z.index??0)+z[0].length-z[1].length;if(j(F))return!0}for(let z of k.matchAll(/(?:const|let|var)\s*\{([^}]*)\}/g))if(j(z.index??0)&&Mu(z[1],!0).has(_))return!0;for(let z of k.matchAll(/(?:const|let|var)\s*\[([^\]]*)\]/g))if(j(z.index??0)&&Mu(z[1],!1).has(_))return!0;return!1}var Nu="",uo,Hr=/^[A-Za-z_$][\w$]*$/,Th=new Set(["if","for","while","switch","with"]),ju=["(","[","{"],Lu=[")","]","}"],Ih=new Set(["const","let","var","return","if","for","while","do","switch","try","throw","export"]);function Ph(v){let _=s(v),k=[];for(let E of _.matchAll(/[A-Za-z_$][\w$]*|=>|\.\.\.|[^\s]/g)){let T=E.index??0;k.push({text:E[0],start:T,end:T+E[0].length})}return{code:_,tokens:k}}function Bu(v){if(uo&&v===Nu)return uo;let{code:_,tokens:k}=Ph(v),E=new Map,T=[];for(let J=0;J<k.length;J++){let ne=k[J].text;if(["(","[","{"].includes(ne))T.push(J);else if([")","]","}"].includes(ne)){let re=T.at(-1);if(re!==void 0&&["()","[]","{}"].includes(k[re].text+ne))T.pop(),E.set(re,J),E.set(J,re)}}function j(J,ne){let re=[],se=J;for(let ie=J;ie<ne;ie++){if(["(","[","{"].includes(k[ie].text)&&(E.get(ie)??ne)<ne){ie=E.get(ie);continue}if(k[ie].text===",")re.push([se,ie]),se=ie+1}return re.push([se,ne]),re}function B(J,ne,re){if(k[J]?.text==="...")J++;if(J>=ne)return;let se=k[J].text;if(Hr.test(se)){re.add(se);return}if(se!=="{"&&se!=="[")return;let ie=E.get(J);if(ie===void 0||ie>=ne)return;for(let[ae,ue]of j(J+1,ie)){let oe=ae;if(se==="{")for(let me=ae;me<ue;me++){if(k[me].text===":"){oe=me+1;break}if(k[me].text==="=")break;if(["(","[","{"].includes(k[me].text)&&E.has(me))me=E.get(me)}B(oe,ue,re)}}function z(J,ne){let re=new Set;for(let[se,ie]of j(J,ne))B(se,ie,re);return re}function F(J){let ne=J;for(;ne<k.length;ne++){let re=k[ne].text;if(["(","[","{"].includes(re)&&E.has(ne)){ne=E.get(ne);continue}if([",",";",")","]","}"].includes(re))break}return k[Math.max(J,ne-1)]?.end??_.length}let V=[];for(let J=0;J<k.length;J++)if(k[J].text==="=>"){let ne=J-1,re=ne,se;if(k[ne]?.text===")"&&E.has(ne))re=E.get(ne),se=z(re+1,ne);else if(k[ne]&&Hr.test(k[ne].text))se=new Set([k[ne].text]);else continue;let ie=J+1,ae=k[ie]?.text==="{"&&E.has(ie)?k[E.get(ie)].end:F(ie);V.push({start:k[re].start,end:ae,names:se})}else if(k[J].text==="("&&E.has(J)){let ne=k[J-1]?.text;if(!ne||Th.has(ne)||!Hr.test(ne)&&ne!=="*"&&ne!=="]")continue;let re=E.get(J),se=re+1;if(k[se]?.text===":"){se++;while(se<k.length&&!["{","=>",";","="].includes(k[se].text))se++}if(k[se]?.text!=="{"||!E.has(se))continue;V.push({start:k[J].start,end:k[E.get(se)].end,names:z(J+1,re)})}let H=new Set;function G(J){let ne=J;for(;ne<k.length;ne++){let re=k[ne].text;if(ju.includes(re)&&E.has(ne)){ne=E.get(ne);continue}if(re===";"||Lu.includes(re))break;let se=k[ne-1];if(ne>J&&Ih.has(re)&&se.text!==".")break;if(ne>J&&/[\n\r]/.test(_.slice(se.end,k[ne].start))&&(/^[\w$]+$/.test(se.text)||Lu.includes(se.text)||['"',"'","`"].includes(se.text))&&Hr.test(re)&&!["in","of","instanceof"].includes(re))break}return ne}for(let J=0;J<k.length;J++){let ne=k[J].text,re=k[J-1]?.text;if(re==="."||k[J+1]?.text===":")continue;if(re==="as"||re==="<")continue;if(ne==="const"||ne==="let"||ne==="var"){let se=G(J+1),ie=J+1,ae=!1,ue=!1,oe=0;for(let me=J+1;me<=se;me++){let we=k[me]?.text;if(me<se&&ju.includes(we)&&E.has(me)&&E.get(me)<se){me=E.get(me);continue}if(me<se&&we===":"&&!ue)ae=!0;else if(me<se&&we==="="&&oe===0)ae=!1,ue=!0;else if(me<se&&ae&&we==="<")oe++;else if(me<se&&ae&&we===">"&&oe>0)oe--;else if(me===se||we===","&&oe===0)B(ie,me,H),ie=me+1,ae=!1,ue=!1}}else if(ne==="function"||ne==="class"){let se=J+1;if(k[se]?.text==="*")se++;if(k[se]&&Hr.test(k[se].text)&&k[se].text!=="extends")H.add(k[se].text)}else if(ne==="import"){let se=J+1;if(k[se]?.text==="*"&&k[se+1]?.text==="as")se+=2;let ie=k[se]?.text;if(ie&&Hr.test(ie)&&ie!=="type"&&k[se+1]?.text!=="("&&k[se+1]?.text!==".")H.add(ie)}}return Nu=v,uo={code:_,scopes:V,declarations:H},uo}function Oa(v){let _=Bu(v);return{code:_.code,shadows:(k,E)=>_.scopes.some((T)=>E>=T.start&&E<T.end&&T.names.has(k))}}function fo(v){return new Set(Bu(v).declarations)}var zu=Symbol.for("stx.lazy-module-promises");function Dh(){let v=globalThis;return v[zu]??=new Map,v[zu]}function mt(v,_){let k=Dh(),E=`${import.meta.url}\x00${v}`,T=k.get(E);if(T)return T;let j=_();return k.set(E,j),j.catch(()=>{if(k.get(E)===j)k.delete(E)}),j}var Oh=/<\/(script)/gi;function qr(v){if(!v||v.indexOf("</")===-1)return v;return v.replace(Oh,"<\\/$1")}import Vu from"fs";class M{cache=new Map;maxSize;options;sizes;bytes=0;constructor(v=100,_){this.maxSize=v,this.options=_??null,this.sizes=_?new Map:null}get byteSize(){return this.bytes}setMaxBytes(v){if(!this.options)return;this.options={...this.options,maxBytes:v};while(this.bytes>v&&this.cache.size>0){let _=this.cache.keys().next().value;if(_===void 0)break;this.delete(_)}}get(v){if(!this.cache.has(v))return;let _=this.cache.get(v);return this.cache.delete(v),this.cache.set(v,_),_}set(v,_){if(this.cache.has(v))this.delete(v);let k=this.options?this.options.sizeOf(_):0;if(this.options&&k>this.options.maxBytes)return;while(this.cache.size>0&&(this.cache.size>=this.maxSize||this.options!==null&&this.bytes+k>this.options.maxBytes)){let E=this.cache.keys().next().value;if(E===void 0)break;this.delete(E)}if(this.cache.set(v,_),this.sizes)this.sizes.set(v,k),this.bytes+=k}has(v){return this.cache.has(v)}delete(v){if(this.sizes){let _=this.sizes.get(v);if(_!==void 0)this.bytes-=_,this.sizes.delete(v)}return this.cache.delete(v)}clear(){this.cache.clear(),this.sizes?.clear(),this.bytes=0}get size(){return this.cache.size}keys(){return this.cache.keys()}values(){return this.cache.values()}}var Kr=new Map,Mh=500;function Er(v,_){if(_?.includes("g"))return new RegExp(v,_);let k=`${v}:${_||""}`;if(!Kr.has(k)){if(Kr.size>=Mh){let E=Kr.keys().next().value;if(E)Kr.delete(E)}Kr.set(k,new RegExp(v,_))}return Kr.get(k)}class Wu{pool=[];maxPoolSize=10;fnCache=new Map;fnCacheMaxSize=200;getEvaluator(v){let _=Array.from(new Set(v)),k=_.sort().join(","),E=this.pool.find((z)=>z.context.join(",")===k);if(E)return E.func;let T=this.fnCache,j=this.fnCacheMaxSize,B=(...z)=>(F)=>{try{let V=`${k}:${F}`,H=T.get(V);if(!H){if(T.size>=j){let G=T.keys().next().value;if(G)T.delete(G)}H=Function(..._,`
753
+ `+T.slice(B);else T+=j;return T}function Mu(v,_){let k=new Set;for(let E of v.split(",")){let T=E.trim().replace(/^\.\.\./,"").trim();if(!T)continue;if(_){let j=T.lastIndexOf(":");if(j!==-1)T=T.slice(j+1).trim()}if(T=T.split("=")[0].trim(),/^[A-Za-z_$][\w$]*$/.test(T))k.add(T)}return k}function lo(v,_){let k=s(v),{depths:E,balanced:T}=we(k),j=(z)=>!T||E[z]===0,B=new RegExp(`(?:^|[^\\w$.])((?:const|let|var|function|class)\\s+${_}\\b)`,"g");for(let z of k.matchAll(B)){let F=(z.index??0)+z[0].length-z[1].length;if(j(F))return!0}for(let z of k.matchAll(/(?:const|let|var)\s*\{([^}]*)\}/g))if(j(z.index??0)&&Mu(z[1],!0).has(_))return!0;for(let z of k.matchAll(/(?:const|let|var)\s*\[([^\]]*)\]/g))if(j(z.index??0)&&Mu(z[1],!1).has(_))return!0;return!1}var Nu="",uo,Hr=/^[A-Za-z_$][\w$]*$/,Th=new Set(["if","for","while","switch","with"]),ju=["(","[","{"],Lu=[")","]","}"],Ih=new Set(["const","let","var","return","if","for","while","do","switch","try","throw","export"]);function Ph(v){let _=s(v),k=[];for(let E of _.matchAll(/[A-Za-z_$][\w$]*|=>|\.\.\.|[^\s]/g)){let T=E.index??0;k.push({text:E[0],start:T,end:T+E[0].length})}return{code:_,tokens:k}}function Bu(v){if(uo&&v===Nu)return uo;let{code:_,tokens:k}=Ph(v),E=new Map,T=[];for(let J=0;J<k.length;J++){let ne=k[J].text;if(["(","[","{"].includes(ne))T.push(J);else if([")","]","}"].includes(ne)){let re=T.at(-1);if(re!==void 0&&["()","[]","{}"].includes(k[re].text+ne))T.pop(),E.set(re,J),E.set(J,re)}}function j(J,ne){let re=[],se=J;for(let ie=J;ie<ne;ie++){if(["(","[","{"].includes(k[ie].text)&&(E.get(ie)??ne)<ne){ie=E.get(ie);continue}if(k[ie].text===",")re.push([se,ie]),se=ie+1}return re.push([se,ne]),re}function B(J,ne,re){if(k[J]?.text==="...")J++;if(J>=ne)return;let se=k[J].text;if(Hr.test(se)){re.add(se);return}if(se!=="{"&&se!=="[")return;let ie=E.get(J);if(ie===void 0||ie>=ne)return;for(let[ae,ue]of j(J+1,ie)){let oe=ae;if(se==="{")for(let me=ae;me<ue;me++){if(k[me].text===":"){oe=me+1;break}if(k[me].text==="=")break;if(["(","[","{"].includes(k[me].text)&&E.has(me))me=E.get(me)}B(oe,ue,re)}}function z(J,ne){let re=new Set;for(let[se,ie]of j(J,ne))B(se,ie,re);return re}function F(J){let ne=J;for(;ne<k.length;ne++){let re=k[ne].text;if(["(","[","{"].includes(re)&&E.has(ne)){ne=E.get(ne);continue}if([",",";",")","]","}"].includes(re))break}return k[Math.max(J,ne-1)]?.end??_.length}let V=[];for(let J=0;J<k.length;J++)if(k[J].text==="=>"){let ne=J-1,re=ne,se;if(k[ne]?.text===")"&&E.has(ne))re=E.get(ne),se=z(re+1,ne);else if(k[ne]&&Hr.test(k[ne].text))se=new Set([k[ne].text]);else continue;let ie=J+1,ae=k[ie]?.text==="{"&&E.has(ie)?k[E.get(ie)].end:F(ie);V.push({start:k[re].start,end:ae,names:se})}else if(k[J].text==="("&&E.has(J)){let ne=k[J-1]?.text;if(!ne||Th.has(ne)||!Hr.test(ne)&&ne!=="*"&&ne!=="]")continue;let re=E.get(J),se=re+1;if(k[se]?.text===":"){se++;while(se<k.length&&!["{","=>",";","="].includes(k[se].text))se++}if(k[se]?.text!=="{"||!E.has(se))continue;V.push({start:k[J].start,end:k[E.get(se)].end,names:z(J+1,re)})}let H=new Set;function G(J){let ne=J;for(;ne<k.length;ne++){let re=k[ne].text;if(ju.includes(re)&&E.has(ne)){ne=E.get(ne);continue}if(re===";"||Lu.includes(re))break;let se=k[ne-1];if(ne>J&&Ih.has(re)&&se.text!==".")break;if(ne>J&&/[\n\r]/.test(_.slice(se.end,k[ne].start))&&(/^[\w$]+$/.test(se.text)||Lu.includes(se.text)||['"',"'","`"].includes(se.text))&&Hr.test(re)&&!["in","of","instanceof"].includes(re))break}return ne}for(let J=0;J<k.length;J++){let ne=k[J].text,re=k[J-1]?.text;if(re==="."||k[J+1]?.text===":")continue;if(re==="as"||re==="<")continue;if(ne==="const"||ne==="let"||ne==="var"){let se=G(J+1),ie=J+1,ae=!1,ue=!1,oe=0;for(let me=J+1;me<=se;me++){let ve=k[me]?.text;if(me<se&&ju.includes(ve)&&E.has(me)&&E.get(me)<se){me=E.get(me);continue}if(me<se&&ve===":"&&!ue)ae=!0;else if(me<se&&ve==="="&&oe===0)ae=!1,ue=!0;else if(me<se&&ae&&ve==="<")oe++;else if(me<se&&ae&&ve===">"&&oe>0)oe--;else if(me===se||ve===","&&oe===0)B(ie,me,H),ie=me+1,ae=!1,ue=!1}}else if(ne==="function"||ne==="class"){let se=J+1;if(k[se]?.text==="*")se++;if(k[se]&&Hr.test(k[se].text)&&k[se].text!=="extends")H.add(k[se].text)}else if(ne==="import"){let se=J+1;if(k[se]?.text==="*"&&k[se+1]?.text==="as")se+=2;let ie=k[se]?.text;if(ie&&Hr.test(ie)&&ie!=="type"&&k[se+1]?.text!=="("&&k[se+1]?.text!==".")H.add(ie)}}return Nu=v,uo={code:_,scopes:V,declarations:H},uo}function Oa(v){let _=Bu(v);return{code:_.code,shadows:(k,E)=>_.scopes.some((T)=>E>=T.start&&E<T.end&&T.names.has(k))}}function fo(v){return new Set(Bu(v).declarations)}var zu=Symbol.for("stx.lazy-module-promises");function Dh(){let v=globalThis;return v[zu]??=new Map,v[zu]}function mt(v,_){let k=Dh(),E=`${import.meta.url}\x00${v}`,T=k.get(E);if(T)return T;let j=_();return k.set(E,j),j.catch(()=>{if(k.get(E)===j)k.delete(E)}),j}var Oh=/<\/(script)/gi;function qr(v){if(!v||v.indexOf("</")===-1)return v;return v.replace(Oh,"<\\/$1")}import Vu from"fs";class M{cache=new Map;maxSize;options;sizes;bytes=0;constructor(v=100,_){this.maxSize=v,this.options=_??null,this.sizes=_?new Map:null}get byteSize(){return this.bytes}setMaxBytes(v){if(!this.options)return;this.options={...this.options,maxBytes:v};while(this.bytes>v&&this.cache.size>0){let _=this.cache.keys().next().value;if(_===void 0)break;this.delete(_)}}get(v){if(!this.cache.has(v))return;let _=this.cache.get(v);return this.cache.delete(v),this.cache.set(v,_),_}set(v,_){if(this.cache.has(v))this.delete(v);let k=this.options?this.options.sizeOf(_):0;if(this.options&&k>this.options.maxBytes)return;while(this.cache.size>0&&(this.cache.size>=this.maxSize||this.options!==null&&this.bytes+k>this.options.maxBytes)){let E=this.cache.keys().next().value;if(E===void 0)break;this.delete(E)}if(this.cache.set(v,_),this.sizes)this.sizes.set(v,k),this.bytes+=k}has(v){return this.cache.has(v)}delete(v){if(this.sizes){let _=this.sizes.get(v);if(_!==void 0)this.bytes-=_,this.sizes.delete(v)}return this.cache.delete(v)}clear(){this.cache.clear(),this.sizes?.clear(),this.bytes=0}get size(){return this.cache.size}keys(){return this.cache.keys()}values(){return this.cache.values()}}var Kr=new Map,Mh=500;function Er(v,_){if(_?.includes("g"))return new RegExp(v,_);let k=`${v}:${_||""}`;if(!Kr.has(k)){if(Kr.size>=Mh){let E=Kr.keys().next().value;if(E)Kr.delete(E)}Kr.set(k,new RegExp(v,_))}return Kr.get(k)}class Wu{pool=[];maxPoolSize=10;fnCache=new Map;fnCacheMaxSize=200;getEvaluator(v){let _=Array.from(new Set(v)),k=_.sort().join(","),E=this.pool.find((z)=>z.context.join(",")===k);if(E)return E.func;let T=this.fnCache,j=this.fnCacheMaxSize,B=(...z)=>(F)=>{try{let V=`${k}:${F}`,H=T.get(V);if(!H){if(T.size>=j){let G=T.keys().next().value;if(G)T.delete(G)}H=Function(..._,`
754
754
  'use strict';
755
755
  try {
756
756
  return ${F};
@@ -767,7 +767,7 @@ ${_.contents}
767
767
  }
768
768
  </style>`).join(`
769
769
  `)}
770
- `}var Za=y,Ku=m(256);function wt(v){let _=h(v),k=Ku.get(_);if(!k)k=Vh(v),Ku.set(_,k);return{code:k.code,imports:[...k.imports],models:[...k.models]}}function Vh(v){let _=s(v),k=new Set;for(let z of v.matchAll(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm))for(let F of z[1].split(",")){let V=F.trim().split(/\s+as\s+/).pop()?.replace(/^type\s+/,"").trim();if(V)k.add(V)}let E=fo(_),T=W.filter((z)=>{if(k.has(z)||E.has(z))return!1;return Yr(_,z,!0)}),j=Ju(_).filter((z)=>!k.has(z)&&!E.has(z));if(T.length===0&&j.length===0)return{code:v,imports:T,models:j};return{code:`${[T.length>0?`import { ${T.join(", ")} } from '@stacksjs/browser'`:"",j.length>0?"import '@stacksjs/browser'":"",j.length>0?`const { ${j.join(", ")} } = window.StacksBrowser || {}`:""].filter(Boolean).join(`
770
+ `}var Za=y,Ku=m(256);function vt(v){let _=h(v),k=Ku.get(_);if(!k)k=Vh(v),Ku.set(_,k);return{code:k.code,imports:[...k.imports],models:[...k.models]}}function Vh(v){let _=s(v),k=new Set;for(let z of v.matchAll(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm))for(let F of z[1].split(",")){let V=F.trim().split(/\s+as\s+/).pop()?.replace(/^type\s+/,"").trim();if(V)k.add(V)}let E=fo(_),T=W.filter((z)=>{if(k.has(z)||E.has(z))return!1;return Yr(_,z,!0)}),j=Ju(_).filter((z)=>!k.has(z)&&!E.has(z));if(T.length===0&&j.length===0)return{code:v,imports:T,models:j};return{code:`${[T.length>0?`import { ${T.join(", ")} } from '@stacksjs/browser'`:"",j.length>0?"import '@stacksjs/browser'":"",j.length>0?`const { ${j.join(", ")} } = window.StacksBrowser || {}`:""].filter(Boolean).join(`
771
771
  `)}
772
772
  ${v}`,imports:T,models:j}}var Uh=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 Ju(v){let _=new Set,k=Oa(v),E=fo(v),T=/(?<![\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 j of k.code.matchAll(T)){let B=j[1];if(Uh.has(B)||E.has(B)||B.length<3)continue;if(k.shadows(B,j.index??0))continue;_.add(B)}return Array.from(_)}function Hh(v){return fo(v)}var Xu=m(128);function Ho(v){let _=h(v),k=Xu.get(_);if(!k)k=qh(v),Xu.set(_,k);return{code:k.code,stxImports:[...k.stxImports],browserImports:[...k.browserImports]}}function qh(v){let _=new Set,k=new Set,E=v;E=E.replace(/^[ \t]*import\s+type\s+\{[^}]*\}\s+from\s+['"][^'"]+['"][ \t]*;?[ \t]*$/gm,"// [type import stripped]");let T=new Set,j=/^[ \t]*import\s+(?:type\s+)?{\s*([^}]+)\s*}\s+from\s+['"](@stacksjs\/browser|@stacksjs\/stx|stx)['"][ \t]*;?[ \t]*$/gm,B;while((B=j.exec(v))!==null){let G=B[1],J=B[2];if(B[0].includes("import type"))continue;let ne=[];for(let se of G.split(",")){let ie=se.trim();if(!ie||ie.startsWith("type "))continue;let ae=ie.match(/^([A-Za-z_$][\w$]*)(?:\s+as\s+([A-Za-z_$][\w$]*))?$/);if(!ae)continue;let ue=ae[1],oe=ae[2]||ue;if(T.add(ue),T.add(oe),J==="stx"||J==="@stacksjs/stx")_.add(ue);else k.add(ue);if(oe!==ue)ne.push(`${oe} = ${ue}`)}let re=ne.length>0?`var ${ne.join(", ")}; /* [auto-import processed] */`:"// [auto-import processed]";E=E.replace(B[0],re)}let z=Hh(E);for(let G of Za){if(T.has(G)||z.has(G))continue;if(Yr(E,G,!0))_.add(G)}let F=s(E),V=new Set;for(let G of E.matchAll(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm))for(let J of G[1].split(",")){let ne=J.trim().replace(/^type\s+/,"").split(/\s+as\s+/);for(let re of ne){let se=re.trim();if(se)V.add(se)}}for(let G of W){if(T.has(G)||z.has(G)||V.has(G))continue;if(Yr(F,G))k.add(G)}let H=Ju(F);for(let G of H)if(!T.has(G)&&!z.has(G))k.add(G);return{code:E,stxImports:Array.from(_),browserImports:Array.from(k)}}function Yr(v,_,k=!1){let E=Oa(v);v=E.code;let T=new RegExp(`\\b${_.replace(/[$]/g,"\\$")}\\b`,"g");for(let j of v.matchAll(T)){let B=j.index??0;if(E.shadows(_,B))continue;let z=B+_.length,F=B-1;while(F>=0&&/\s/.test(v[F]))F--;if(v[F]==="."&&v.slice(Math.max(0,F-2),F+1)!=="...")continue;let V=z;while(V<v.length&&/\s/.test(v[V]))V++;if(v[V]===":"&&v[V+1]!==":"&&(v[F]==="{"||v[F]===","))continue;if(k&&!/^\s*(?:<[^>]*>)?\s*\(/.test(v.slice(z)))continue;return!0}return!1}function Vo(v,_){let k=[];if(v.length>0)k.push(` var { ${v.join(", ")} } = window.stx || window;`);if(_.length>0)k.push(` var { ${_.join(", ")} } = window.StacksBrowser || {};`);if(k.length>0)return` // STX: auto-imported from stx and @stacksjs/browser
773
773
  ${k.join(`
@@ -831,7 +831,7 @@ else {
831
831
  // STX: auto-generated event bindings
832
832
  ${v.map((k,E)=>Qh(k,E)).join(`
833
833
  `)}`}function Gu(v){let _=[],k=new Set,E=v.replace(/^\s*import\s+.*$/gm,""),T=0,j=E.length,B=0;while(B<j){let z=E[B];if(z==="'"||z==='"'||z==="`"){let F=z;if(B++,F==="`"){let V=0;while(B<j){if(E[B]==="\\"){B+=2;continue}if(E[B]==="`"&&V===0){B++;break}if(E[B]==="$"&&E[B+1]==="{"){V++,B+=2;continue}if(E[B]==="}"&&V>0){V--,B++;continue}B++}}else while(B<j){if(E[B]==="\\"){B+=2;continue}if(E[B]===F){B++;break}B++}continue}if(z==="/"&&E[B+1]==="/"){while(B<j&&E[B]!==`
834
- `)B++;continue}if(z==="/"&&E[B+1]==="*"){B+=2;while(B<j-1&&!(E[B]==="*"&&E[B+1]==="/"))B++;B+=2;continue}if(z==="{"){T++,B++;continue}if(z==="}"){T--,B++;continue}if(T===0){let F=E.slice(B),V=F.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(V){let J=V[1];if(!J.startsWith("_")&&!k.has(J))_.push(J),k.add(J);B+=V[0].length;continue}let H=F.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(H){H[1].split(",").forEach((J)=>{let ne=J.trim(),re=ne.indexOf(":"),se=re>=0?ne.slice(re+1).trim().split(/[\s=]/)[0]:ne.split(/[\s=]/)[0];if(se&&!se.startsWith("_")&&!k.has(se))_.push(se),k.add(se)}),B+=H[0].length;continue}let G=F.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(G){let J=G[1];if(!J.startsWith("_")&&!k.has(J))_.push(J),k.add(J);B+=G[0].length;continue}}B++}return _}var ty=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 ny(v){let _=new Set,k=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function E(J){let ne;while((ne=k.exec(J))!==null){let re=ne[0];if(!ty.has(re))_.add(re)}}let T=/\{\{([\s\S]*?)\}\}/g,j;while((j=T.exec(v))!==null)E(j[1]);let B=/:[a-z][\w.-]*\s*=\s*"([^"]*)"/gi;while((j=B.exec(v))!==null)E(j[1]);let z=/:[a-z][\w.-]*\s*=\s*'([^']*)'/gi;while((j=z.exec(v))!==null)E(j[1]);let F=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((j=F.exec(v))!==null)E(j[1]);let V=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((j=V.exec(v))!==null)E(j[1]);let H=/@model\s*=\s*["']([^"']*)["']/gi;while((j=H.exec(v))!==null)E(j[1]);let G=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((j=G.exec(v))!==null)E(j[1]);return _}async function he(v,_={}){let k=v,E="",T=!1,j=[],B=Gr(k,{filePath:_.filePath,projectRoot:_.projectRoot});k=B.code;let z=Jr(B.styles),F=wt(k);k=F.code,j=[...F.imports,...F.models];let{hasUserImports:V,bundleClientScript:H}=await mt("stx/client-script-bundler",()=>import("./chunk-x5gbrjm5.js"));if(V(k))k=await H(k,_.filePath||"",{projectRoot:_.projectRoot,minify:_.production}),T=!0;if(_.autoImports!==!1){let oe=Ho(k);k=oe.code,E=Vo(oe.stxImports,oe.browserImports.filter((me)=>!j.includes(me)))}if(E=`${Zr(k,_.serverData)}${E}`,k=I(k),!T&&Ue(_.attrs||""))k=We(k);let G=ey(_.eventBindings||[]),J=(_.attrs||"").trim(),ne=/\btype\s*=\s*["']module["']/i.test(J),re=_.instanceId?` data-stx-instance="${_.instanceId}"`:"";if(ne){let oe=J.replace(/\btype\s*=\s*["']module["']/i,"").trim(),me=`type="module" data-stx-scoped${re}${oe?` ${oe}`:""}`;return`${z}<script ${me}>
834
+ `)B++;continue}if(z==="/"&&E[B+1]==="*"){B+=2;while(B<j-1&&!(E[B]==="*"&&E[B+1]==="/"))B++;B+=2;continue}if(z==="{"){T++,B++;continue}if(z==="}"){T--,B++;continue}if(T===0){let F=E.slice(B),V=F.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(V){let J=V[1];if(!J.startsWith("_")&&!k.has(J))_.push(J),k.add(J);B+=V[0].length;continue}let H=F.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(H){H[1].split(",").forEach((J)=>{let ne=J.trim(),re=ne.indexOf(":"),se=re>=0?ne.slice(re+1).trim().split(/[\s=]/)[0]:ne.split(/[\s=]/)[0];if(se&&!se.startsWith("_")&&!k.has(se))_.push(se),k.add(se)}),B+=H[0].length;continue}let G=F.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(G){let J=G[1];if(!J.startsWith("_")&&!k.has(J))_.push(J),k.add(J);B+=G[0].length;continue}}B++}return _}var ty=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 ny(v){let _=new Set,k=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function E(J){let ne;while((ne=k.exec(J))!==null){let re=ne[0];if(!ty.has(re))_.add(re)}}let T=/\{\{([\s\S]*?)\}\}/g,j;while((j=T.exec(v))!==null)E(j[1]);let B=/:[a-z][\w.-]*\s*=\s*"([^"]*)"/gi;while((j=B.exec(v))!==null)E(j[1]);let z=/:[a-z][\w.-]*\s*=\s*'([^']*)'/gi;while((j=z.exec(v))!==null)E(j[1]);let F=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((j=F.exec(v))!==null)E(j[1]);let V=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((j=V.exec(v))!==null)E(j[1]);let H=/@model\s*=\s*["']([^"']*)["']/gi;while((j=H.exec(v))!==null)E(j[1]);let G=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((j=G.exec(v))!==null)E(j[1]);return _}async function he(v,_={}){let k=v,E="",T=!1,j=[],B=Gr(k,{filePath:_.filePath,projectRoot:_.projectRoot});k=B.code;let z=Jr(B.styles),F=vt(k);k=F.code,j=[...F.imports,...F.models];let{hasUserImports:V,bundleClientScript:H}=await mt("stx/client-script-bundler",()=>import("./chunk-jc25dv0f.js"));if(V(k))k=await H(k,_.filePath||"",{projectRoot:_.projectRoot,minify:_.production}),T=!0;if(_.autoImports!==!1){let oe=Ho(k);k=oe.code,E=Vo(oe.stxImports,oe.browserImports.filter((me)=>!j.includes(me)))}if(E=`${Zr(k,_.serverData)}${E}`,k=I(k),!T&&Ue(_.attrs||""))k=We(k);let G=ey(_.eventBindings||[]),J=(_.attrs||"").trim(),ne=/\btype\s*=\s*["']module["']/i.test(J),re=_.instanceId?` data-stx-instance="${_.instanceId}"`:"";if(ne){let oe=J.replace(/\btype\s*=\s*["']module["']/i,"").trim(),me=`type="module" data-stx-scoped${re}${oe?` ${oe}`:""}`;return`${z}<script ${me}>
835
835
  ${qr(`${E}${k}
836
836
  ${G}`)}
837
837
  </script>`}let se=Ls(v),ie=/function __stx_setup_/.test(k),ae=/\bstx\.mount\s*\(|\bstx\.mountEl\s*\(/.test(v);function ue(oe){let me=oe.length>0?`
@@ -853,20 +853,20 @@ ${j.map(([H,G])=>` try { factories[${JSON.stringify(H)}] = factories[${JSON.str
853
853
  `)}
854
854
  })();
855
855
  </script>`,F=v.search(/<script\b(?=[^>]*\bdata-stx-scoped\b)/i),V=F<0?0:F;return T.push({start:V,end:V,replacement:`${z}
856
- `}),Yu(v,T)}function Yu(v,_){if(_.length===0)return v;_.sort((j,B)=>j.start-B.start||j.end-B.end);let k=Array(_.length*2+1),E=0,T=0;for(let j of _)k[T++]=v.slice(E,j.start),k[T++]=j.replacement,E=j.end;return k[T]=v.slice(E),k.join("")}function td(v){let _=go(v),k=new Map;if(_)for(let[E,T]of _)k.set(E,T.instances);return k}function nd(v,_){let k=go(v);if(!k)return[];let E=[];for(let[T,j]of k){let B=j.instances-(_.get(T)??0);if(B>0)E.push({body:j.body,count:B})}return E}function rd(v,_){for(let{body:k,count:E}of _)for(let T=0;T<E;T++)Na(v,k)}import pd from"fs";var sd=0,ja=new Map;function Uo(){sd=0,ja.clear()}function mo(v,_){let k=sd++,E=`<!--__STX_${v.toUpperCase()}_${k}__-->`;return ja.set(E,{type:v,expression:_}),E}function Wo(){let v={};for(let[_,k]of ja)v[_]={type:k.type,expression:k.expression};return v}function qo(v,_){let k=v;for(let[E,T]of _)k=k.split(E).join(T);return k}function Qr(v){return v.includes("<!--__STX_")}var sy=/@(?=[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 iy(v){return Array.from({length:v},()=>"&#123;").join("&#8288;")}function id(v){return v.replace(/\{{2,}/g,(_)=>iy(_.length)).replace(/\{(?=!)/g,"&#123;&#8288;").replace(sy,"&#64;")}var oy=/^(?:javascript|vbscript|livescript|mocha|view-source):/,ay=/^data:(?:text\/html|text\/xml|application\/xhtml\+xml|application\/xml|image\/svg\+xml)/,cy=/^data:(?:text\/html|application\/xhtml\+xml)/,ly=new RegExp("[\\u0000-\\u0020\\u00A0\\u1680\\u2000-\\u200F\\u2028\\u2029\\u202F\\u205F\\u3000\\uFEFF]+","g");function uy(v){return v.replace(ly,"").toLowerCase()}function dy(v){let _=v.toLowerCase();if(new RegExp("^(?:href|xlink:href|action|formaction|ping|cite|manifest|data|to)$").test(_))return"navigable";if(new RegExp("^(?:src|srcset|poster|background)$").test(_))return"fetched";return null}function od(v,_="navigable"){let k=uy(v);if(oy.test(k))return!0;return _==="navigable"?ay.test(k):cy.test(k)}function yi(v,_="navigable"){return od(v,_)?"unsafe:"+v:v}function fy(v){let _=v.match(/(?:^|[\s"'`/])([A-Za-z][\w:-]*)\s*=\s*(["'])([^"']*)$/);if(!_)return null;if(_[3].trim()!=="")return null;return dy(_[1])}function La(v,_,k=256){if(_<=k)return v.slice(0,_);let E=v.slice(_-k,_),T=E.search(/[\s"'`/]/);return T===-1?"":E.slice(T)}function Ba(v,_,k=_){let E=fy(v);return E&&od(_,E)?"unsafe:"+k:k}var ho=/<script\b[^>]*>/iy,Va=/<\/script\s*>/ig,yo=/<style\b[^>]*>/iy,Ua=/<\/style\s*>/ig;function ad(v,_,k,E){k.lastIndex=_;let T=k.exec(v);if(!T||T.index!==_)return-1;E.lastIndex=k.lastIndex;let j=E.exec(v);if(!j)return-1;return j.index+j[0].length}function Y(v,_){return ad(v,_,ho,Va)}function Ss(v,_){return ad(v,_,yo,Ua)}function je(v,_){if(!v.startsWith("<!--",_))return-1;let k=v.indexOf("-->",_+4);if(k===-1)return-1;return k+3}function cd(v,_){if(v.startsWith("<!--",_)){let T=je(v,_);return T===-1?v.length:T}if(ho.lastIndex=_,ho.exec(v)?.index===_){Va.lastIndex=ho.lastIndex;let T=Va.exec(v);return T?T.index+T[0].length:v.length}if(yo.lastIndex=_,yo.exec(v)?.index===_){Ua.lastIndex=yo.lastIndex;let T=Ua.exec(v);return T?T.index+T[0].length:v.length}return-1}function gr(v,_){let k=[],E=0,T=v.length,j=!1,B=null;while(E<T){let z=v[E];if(j){if(B){if(z===B)B=null}else if(z==='"'||z==="'")B=z;else if(z===">")j=!1;E++;continue}if(z!=="<"){let G=v.indexOf("<",E+1);if(G===-1)break;E=G;continue}let F=_(v,E);if(F>E){k.push({start:E,end:F,token:v.slice(E,F)}),E=F;continue}let V=cd(v,E);if(V>E){E=V;continue}let H=v.charCodeAt(E+1);if(H>=65&&H<=90||H>=97&&H<=122)j=!0;E++}return k}function ld(v){let _=0,k=0,E=0,T=!1,j=null;while(E<v.length){if(T){let G=v[E];if(j){if(G===j)j=null}else if(G==='"'||G==="'")j=G;else if(G===">")T=!1;E++;continue}let B=v.indexOf("<",E),z=B===-1?v.length:B;while(E<z){let G=v[E++];if(G==="{")_++;else if(G==="}")k++;if(_>=2&&k>=2)return!0}if(B===-1)break;let F=cd(v,B);if(F>B){E=F;continue}let V=v.charCodeAt(B+1),H=V===47?v.charCodeAt(B+2):V;if(H>=65&&H<=90||H>=97&&H<=122)T=!0;E=B+1}return!1}function ud(v,_){while(v.size>=_){let k=v.keys().next();if(k.done)return;v.delete(k.value)}}var py=1024,gy=16777216,Xr=new Map,za=0;function my(v,_){Xr.set(v,_),za+=v.length+_.output.length;for(let[k,E]of Xr){if(za<=gy)break;Xr.delete(k),za-=k.length+E.output.length}}function Pn(v,_,k,E){let T=E!==void 0&&v.length>=py,j=T?`${E}\x00${v}`:"";if(T){let H=Xr.get(j);if(H)return Xr.delete(j),Xr.set(j,H),{output:H.output,tokens:H.tokens.slice()}}let B=gr(v,_);if(B.length===0)return{output:v,tokens:[]};let z=B.map((H)=>H.token),F="",V=0;for(let H=0;H<B.length;H++){let G=B[H];F+=v.slice(V,G.start),F+=k(G.token,H),V=G.end}if(F+=v.slice(V),T)return my(j,{output:F,tokens:z}),{output:F,tokens:z.slice()};return{output:F,tokens:z}}var hy=1024,yy=16777216,fs=new Map,Wa=0;function xy(v,_){fs.set(v,_),Wa+=v.length+_.output.length;for(let[k,E]of fs){if(Wa<=yy)break;fs.delete(k),Wa-=k.length+E.output.length}}function Fa(v,_,k){return{output:_,scripts:k,restore:(E)=>E===_?v:Cs(E,k)}}function xn(v){let _=v.length>=hy;if(_){let T=fs.get(v);if(T)return fs.delete(v),fs.set(v,T),Fa(v,T.output,T.scripts.slice())}let{output:k,tokens:E}=Pn(v,Y,(T,j)=>`\x00STX_SCRIPT_${j}\x00`);if(_)return xy(v,{output:k,scripts:E}),Fa(v,k,E.slice());return Fa(v,k,E)}function Cs(v,_){if(_.length===0)return v;return v.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(k,E)=>_[+E]??"")}function xt(v){let _=v.indexOf(" as ");if(_!==-1){let j=v.slice(0,_).trim(),B=v.slice(_+4).trim();return j&&B?{arrayExpr:j,itemVar:B}:null}let k=/^\s*(.+?)\s+in\s+([\s\S]+)$/.exec(v);if(!k)return null;let E=k[1].trim().replace(/^\(([\s\S]*)\)$/,"$1").trim(),T=k[2].trim();return E&&T?{arrayExpr:T,itemVar:E}:null}function xo(v){let _=[],k=0,E="",T=0;for(let j=0;j<v.length;j++){let B=v[j];if(E){if(B==="\\")j++;else if(B===E)E="";continue}if(B==="'"||B==='"'||B==="`")E=B;else if(B==="("||B==="["||B==="{")k++;else if(B===")"||B==="]"||B==="}")k--;else if(B===","&&k===0)_.push(v.slice(T,j)),T=j+1}return _.push(v.slice(T)),_}function dd(v,_){let k=0;for(let E=0;E<v.length;E++){let T=v[E];if(T==="("||T==="["||T==="{")k++;else if(T===")"||T==="]"||T==="}")k--;else if(T===_&&k===0)return E}return-1}function fd(v){let _=0;for(let k=0;k<v.length;k++){let E=v[k];if(E==="("||E==="["||E==="{")_++;else if((E===")"||E==="]"||E==="}")&&--_===0)return k}return-1}function Rr(v,_){let k=v.trim().replace(/^\.\.\./,"").trim(),E=dd(k,"=");if(E!==-1&&k[E+1]!==">")k=k.slice(0,E).trim();if(!k)return;if(k.startsWith("{")&&k.endsWith("}")){for(let T of xo(k.slice(1,-1))){let j=T.trim();if(!j)continue;if(j.startsWith("...")){Rr(j,_);continue}let B=dd(j,":");Rr(B===-1?j:j.slice(B+1),_)}return}if(k.startsWith("[")&&k.endsWith("]")){for(let T of xo(k.slice(1,-1)))Rr(T,_);return}if(/^[A-Z_$][\w$]*$/i.test(k))_.push(k)}function Ns(v){let _=v.trim(),k=[],E=0;for(let j=0;j<_.length;j++){let B=_[j];if(B==="("||B==="["||B==="{")E++;else if(B===")"||B==="]"||B==="}")E--;else if(E===0&&/\s/.test(B)){if(!/^\s+(?:in|of)\s/.exec(_.slice(j)))continue;let F=_.slice(0,j).trim();if(F.startsWith("(")&&fd(F)===F.length-1)F=F.slice(1,-1);for(let V of xo(F))Rr(V,k);if(k.length>0)return k;break}}let T=/^[\s\S]+?\s+as\s+([\s\S]+)$/.exec(_);if(T){let j=T[1].trim();if(j.startsWith("(")&&fd(j)===j.length-1)j=j.slice(1,-1);let B=/^([\w$]+)\s*=>\s*([\s\S]+)$/.exec(j);if(B)Rr(B[2],k),Rr(B[1],k);else for(let z of xo(j))Rr(z,k)}return k}function Ar(v,_){let k=_ instanceof Set?_:new Set(_);if(k.size===0)return!1;let B=v.replace(/'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"/g," ").replace(/`(?:[^`\\$]|\\.|\$(?!\{))*`/g," ").replace(/\??\.\s*[a-zA-Z_$][\w$]*/g," ").replace(/([{,]\s*)[a-zA-Z_$][\w$]*(\s*:(?!:))/g,"$1$2");for(let z of B.match(/[a-zA-Z_$][\w$]*/g)||[])if(k.has(z))return!0;return!1}var bo="__stx_client_loop_names";function mr(v){let _=v?.[bo];return Array.isArray(_)?_:[]}var wi={},gd=new Map;function by(v){let _=gd.get(v);if(!_){let k=v.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");_=new RegExp(`:${k}(?!\\w)`,"g"),gd.set(v,_)}return _.lastIndex=0,_}var Bn={uppercase:(v,_)=>v!==void 0&&v!==null?String(v).toUpperCase():"",lowercase:(v,_)=>v!==void 0&&v!==null?String(v).toLowerCase():"",capitalize:(v,_)=>{if(v===void 0||v===null)return"";let k=String(v);return k.charAt(0).toUpperCase()+k.slice(1)},number:(v,_,k=0)=>{if(v===void 0||v===null)return"";try{let E=Number(v);return Number.isNaN(E)?"":E.toFixed(Number.parseInt(String(k),10))}catch{return""}},fmt:(v,_,k="en-US")=>{if(v===void 0||v===null)return"";try{let E=Number(v);if(Number.isNaN(E))return String(v);return E.toLocaleString(k)}catch{return String(v)}},join:(v,_,k=",")=>{if(!Array.isArray(v))return"";return v.join(String(k))},escape:(v,_)=>{if(v===void 0||v===null)return"";return St(String(v))},translate:(v,_,k={})=>{if(!_||!_.__translations)return v;let E=_.__translations,T=_.__i18nConfig?.fallbackToKey??!0,j=String(v).split("."),B=E;for(let F of j){if(B===void 0||B===null)break;B=B[F]}if(B===void 0||B===null)return T?v:"";let z=String(B);return Object.entries(k).forEach(([F,V])=>{z=z.replace(by(F),String(V))}),z},t:(v,_,k={})=>Bn.translate(v,_,k),truncate:(v,_,k=50,E="...")=>{if(v===void 0||v===null)return"";let T=String(v);if(T.length<=k)return T;if(k<=E.length)return E.substring(0,k);return T.substring(0,k-E.length)+E},date:(v,_,k="short",E="en-US")=>{if(v===void 0||v===null)return"";try{let T=v instanceof Date?v:new Date(v);if(Number.isNaN(T.getTime()))return String(v);let j={short:{dateStyle:"short"},medium:{dateStyle:"medium"},long:{dateStyle:"long"},full:{dateStyle:"full"},time:{timeStyle:"short"},datetime:{dateStyle:"short",timeStyle:"short"},iso:{}};if(k==="iso")return T.toISOString();return new Intl.DateTimeFormat(E,j[k]||j.short).format(T)}catch{return String(v)}},currency:(v,_,k="USD",E="en-US")=>{if(v===void 0||v===null)return"";try{let T=Number(v);if(Number.isNaN(T))return String(v);return new Intl.NumberFormat(E,{style:"currency",currency:k}).format(T)}catch{return String(v)}},pluralize:(v,_,k,E)=>{let T=Number(v);if(Number.isNaN(T))return k;let j=E||`${k}s`;return T===1?k:j},first:(v,_)=>{if(v===void 0||v===null)return"";if(Array.isArray(v))return v.length===0?"":v[0];return String(v).charAt(0)},last:(v,_)=>{if(v===void 0||v===null)return"";if(Array.isArray(v))return v.length===0?"":v[v.length-1];let k=String(v);return k.charAt(k.length-1)},length:(v,_)=>{if(v===void 0||v===null)return 0;if(Array.isArray(v)||typeof v==="string")return v.length;if(v instanceof Map||v instanceof Set)return v.size;if(typeof v==="object")return Object.keys(v).length;return 0},json:(v,_,k=!1)=>{if(v===void 0)return"undefined";if(v===null)return"null";try{return k?JSON.stringify(v,null,2):JSON.stringify(v)}catch{return String(v)}},default:(v,_,k="")=>v===void 0||v===null||v===""?k:v,reverse:(v,_)=>{if(v===void 0||v===null)return"";if(Array.isArray(v))return[...v].reverse();return String(v).split("").reverse().join("")},slice:(v,_,k=0,E)=>{if(v===void 0||v===null)return"";if(Array.isArray(v)||typeof v==="string")return v.slice(k,E);return v},replace:(v,_,k,E="")=>{if(v===void 0||v===null)return"";let T=k.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return String(v).replace(new RegExp(T,"g"),()=>E)},stripTags:(v,_)=>{if(v===void 0||v===null)return"";return String(v).replace(/<[^>]*>/g,"")},urlencode:(v,_)=>{if(v===void 0||v===null)return"";return encodeURIComponent(String(v))},abs:(v,_)=>{let k=Number(v);return Number.isNaN(k)?0:Math.abs(k)},round:(v,_,k=0)=>{let E=Number(v);if(Number.isNaN(E))return 0;let T=10**k;return Math.round(E*T)/T}};function Qa(v,_){if(v in Bn)console.warn(`Filter "${v}" already exists as a built-in filter. Custom filter will take precedence.`);wi[v]=_}function Ad(v){for(let[_,k]of Object.entries(v))Qa(_,k)}function ec(){return{...Bn,...wi}}function Pd(){for(let v of Object.keys(wi))delete wi[v]}function tc(v,_,k=2){let E=0,T=null;for(let j=_+k;j<v.length;j++){let B=v[j];if(T){if(B==="\\"){j++;continue}if(B===T)T=null;continue}if(B==='"'||B==="'"||B==="`"){T=B;continue}if(B==="{"){E++;continue}if(B==="}"){if(E>0){E--;continue}let z=0;while(v[j+z]==="}")z++;if(z>=k)return j}}return-1}function Fn(v,_,k=2){let E="{".repeat(k);if(!v.includes(E))return v;let T="",j=0;for(;;){let B=v.indexOf(E,j);if(B===-1)break;let z=tc(v,B,k);if(z===-1)break;T+=v.slice(j,B)+_(v.slice(B,z+k),v.slice(B+k,z),B),j=z+k}return j===0?v:T+v.slice(j)}function b(v){return v.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function St(v){return id(b(v))}function ye(v,_){let{scripts:k}=xn(v);for(let E of k){let T=E.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i);if(!T||/\bserver\b|\bsrc\s*=/.test(T[1]))continue;let j=T[2];if(/\b(state|derived|effect|ref|reactive|computed|watch|watchEffect|useModel)\s*(?:<[^>]*>)?\s*\(/.test(j))return!0;if(wn(j,_))return!0}if(/@(if|for|show)\s*=\s*["'][^"']*\(\s*\)/.test(v))return!0;if(/@for\s*=\s*["'][^"']*\s+(?:in|of)\s+[^"']*\(\s*\)/.test(v))return!0;if(/(?:^|[\s"'])(?::|x-)(?:for|if|else-if|else|show|text|html|model|bind)\b/.test(v))return!0;return!1}function nc(v){let _=[],k=/<([a-zA-Z][\w-]*)\b[^>]*?\s(?::for|x-for|@for)\s*=\s*(["'])([\s\S]*?)\2[^>]*>/g;for(let E=k.exec(v);E;E=k.exec(v)){let T=E[1].toLowerCase(),j=new Set(Ns(E[3]));if(j.size===0)continue;let B=E.index+E[0].length;if(E[0].endsWith("/>")){_.push({start:E.index,end:B,names:j});continue}let z=new RegExp(`<(/?)${T}\\b[^>]*?(/?)>`,"gi");z.lastIndex=B;let F=1,V=v.length;for(let H=z.exec(v);H;H=z.exec(v)){if(H[2]==="/")continue;if(F+=H[1]==="/"?-1:1,F===0){V=H.index+H[0].length;break}}_.push({start:E.index,end:V,names:j})}return _}function vy(v,_,k){let E=s(k);for(let T of v){if(_<T.start||_>=T.end)continue;for(let j of T.names)if(new RegExp(`(?<![.#\\w$])${j.replace(/\$/g,"\\$")}(?![\\w$])`).test(E))return!0}return!1}function md(v,_){let k=["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"],E=v.replace(/'[^']*'/g,"").replace(/"[^"]*"/g,""),T="",j=!1,B=0;for(let V=0;V<E.length;V++){let H=E[V];if(!j&&H==="`"){j=!0,B=0;continue}if(j){if(H==="`"&&B===0){j=!1;continue}if(H==="$"&&E[V+1]==="{"){B++,V++,T+=" ";continue}if(H==="}"&&B>0){B--;continue}if(B>0){T+=H;continue}continue}T+=H}E=T;let z=/(?<![a-zA-Z0-9_$])([a-zA-Z_$][a-zA-Z0-9_$]*)/g,F;while((F=z.exec(E))!==null){let V=F[1];if(!E.substring(0,F.index).trimEnd().endsWith(".")){if(!k.includes(V)&&!(V in _))return!1}}return!0}function wy(v,_){let k=_.__stx_serverDeclared;if(!k||k.size===0)return!1;let E=s(v);for(let T of k)if(new RegExp(`(?<![.#\\w$])${T}(?![\\w$])`).test(E))return!0;return!1}var hd=new Set;function yd(v){return/^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*)*$/.test(v.trim())}function xd(v,_){let k=`${_??"<unknown>"}\x00${v}`;if(process.env.STX_DEBUG||!hd.has(k))hd.add(k),console.warn(`[stx] {{ ${v} }} in a <script> in ${_??"<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 es(v,_,k){let E=v;return E=E.replace(/\{!!([\s\S]*?)!!\}/g,(T,j)=>{try{let B=x(j,_);if(B===void 0)return yd(j)?xd(j.trim(),k):T;return B===null?"":String(B)}catch{return T}}),E=Fn(E,(T,j,B)=>{let z=j.trim();if(/^__[A-Z_]+__$/.test(z))return T;try{let F=x(j,_);if(F===void 0)return yd(z)?xd(z,k):T;return JSON.stringify(F).replace(/</g,"\\u003c")}catch{return T}}),E}function rc(v,_){if(!v.includes("{"))return v;let k=v;return k=k.replace(/\{!!([\s\S]*?)!!\}/g,(E,T)=>{try{let j=x(T,_);if(j===void 0)return E;return j===null?"":String(j)}catch{return E}}),k=Fn(k,(E,T,j)=>{let B=T.trim();if(/^__[A-Z_]+__$/.test(B))return E;try{let z=x(T,_);if(z===void 0)return E;if(z===null)return"";let F=String(z);return Ba(La(k,j),F,St(F))}catch{return E}}),k}function Id(v,_,k={}){let{output:E,scripts:T}=xn(v),j=T.map((B)=>{let z=B.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i),F=B.match(/^<script\b[^>]*>/i),V=B.search(/<\/script\s*>$/i);if(!z||!F||V===-1)return B;let H=z[1],G=z[2];if(/\bdata-raw\b/.test(H))return B;if(k.skipServer&&/\bserver\b/.test(H))return B;let ne=`<script${rc(H,_)}>`;if(/\bsrc\s*=/.test(H)||/\btype\s*=\s*["']application\/json["']/.test(H))return ne+G+B.slice(V);return ne+es(G,_)+B.slice(V)});return Cs(E,j)}function q(v,_,k){let E=v,T=(ne,re)=>{let se=Ss(ne,re);if(se===-1)return-1;return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(ne.slice(re,se))?-1:se},j=(ne,re,se,ie)=>{let ae=se.length,{output:ue,tokens:oe}=Pn(ne,re,(me,we)=>ie(ae+we));return se.push(...oe),ue},B=[];E=j(E,T,B,(ne)=>`<!--__STX_STYLE_${ne}__-->`);let z=[];E=j(E,Y,z,(ne)=>`<!--__STX_SCRIPT_EXPR_${ne}__-->`);let F=_?.__stx_signals_gate===!0||ye(v),V=new Set(Array.isArray(_?.__stx_client_signal_names)?_.__stx_client_signal_names:[]),H=new Set(Array.isArray(_?.__stx_preserved_client_expressions)?_.__stx_preserved_client_expressions:[]);E=Fn(E,(ne,re,se)=>{try{let ie=x(re,_,!1,(ae)=>Ha(ae,ne,k,v));return ie!==void 0&&ie!==null?String(ie):""}catch(ie){let ae=ie instanceof Error?ie.message:String(ie);return g("Expression",`Error evaluating: {{{ ${re.trim()}}}}: ${ae}`,k,v,se,ne)}},3),E=E.replace(/\{!!([\s\S]*?)!!\}/g,(ne,re,se)=>{try{let ie=x(re,_,!1,(ae)=>Ha(ae,ne,k,v));if(ie===void 0&&_.__stx_buildMode==="compile")return mo("raw",re.trim());return ie!==void 0&&ie!==null?String(ie):""}catch(ie){if(_.__stx_buildMode==="compile")return mo("raw",re.trim());let ae=ie instanceof Error?ie.message:String(ie);return g("Expression",`Error evaluating: {!! ${re.trim()} !!}: ${ae}`,k,v,se,ne)}}),E=j(E,Y,z,(ne)=>`<!--__STX_SCRIPT_EXPR_${ne}__-->`),E=j(E,T,B,(ne)=>`<!--__STX_STYLE_${ne}__-->`);let G=F?nc(E):[],J=new Set(mr(_));if(E=Fn(E,(ne,re,se)=>{let ie=re.trim();if(Ar(ie,J))return ne;if(G.length>0&&vy(G,se,ie))return ne;if(H.has(ie))return ne;let ae=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined"],ue=/^([a-zA-Z_$][a-zA-Z0-9_$]*)/,me=ie.match(ue)?.[1],we=me&&((me in _)||ae.includes(me)),$e=Boolean(me&&V.has(me)),_e=/^([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/,Re=ie.match(_e),Ee=Re&&!ae.includes(Re[1])&&!(Re[1]in _);if(/^__[A-Z_]+__$/.test(ie))return"";let Ae;try{let Te=x(re,_,!1,(Pe)=>{Ae=Pe});if($e)return ne;if(F&&!md(ie,_))return ne;if(Ae)Ha(Ae,ne,k,v);if(_.__stx_buildMode==="compile"&&!F&&(Te===void 0||wy(ie,_)))return mo("expr",ie);if(Te===void 0||Te===null)return"";let ke=String(Te);return Ba(La(E,se),ke,St(ke))}catch(Te){if($e)return ne;if(F&&!md(ie,_))return ne;if(Ee)return ne;let ke=Te instanceof Error?Te.message:String(Te);return g("Expression",`Error evaluating: {{ ${ie} }}: ${ke}`,k,v,se,ne)}}),z.length>0)E=E.replace(/<!--__STX_SCRIPT_EXPR_(\d+)__-->/g,(ne,re)=>z[Number(re)]??ne);if(B.length>0)E=E.replace(/<!--__STX_STYLE_(\d+)__-->/g,(ne,re)=>B[Number(re)]??ne);return E}function sc(v,_,k){if(!_.trim())return v;let E=v,T=_.trim();while(T.length>0){let j=T.match(/^(\w+)/);if(!j)break;let B=j[1];T=T.substring(B.length).trim();let z=wi[B]||Bn[B];if(!z)throw Error(`Filter not found: ${B}. Available filters: ${Object.keys(ec()).join(", ")}`);let F=[];if(T.startsWith(":")){let V=T.match(/^:([^|\s]+)/);if(V){let H=V[1].trim();try{let G=Number(H);F=[Number.isNaN(G)?H:G]}catch{F=[H]}T=T.substring(V[0].length).trim()}}else if(T.startsWith("(")){let V=1,H=1;while(V>0&&H<T.length){if(T[H]==="(")V++;if(T[H]===")")V--;H++}if(V===0){let G=T.substring(1,H-1).trim();if(G)try{if(G.startsWith("{")&&G.endsWith("}"))F=[x(`(${G})`,k,!0)];else{let J=[],ne="",re=null,se=0,ie=0,ae=0,ue=!1;for(let oe=0;oe<G.length;oe++){let me=G[oe];if(ue){ne+=me,ue=!1;continue}if(me==="\\"){ne+=me,ue=!0;continue}if(re){if(ne+=me,me===re)re=null;continue}if(me==='"'||me==="'"||me==="`"){re=me,ne+=me;continue}if(me==="(")se++;else if(me===")")se--;else if(me==="[")ie++;else if(me==="]")ie--;else if(me==="{")ae++;else if(me==="}")ae--;if(me===","&&se===0&&ie===0&&ae===0){J.push(ne),ne="";continue}ne+=me}if(ne)J.push(ne);F=J.map((oe)=>{let me=oe.trim();return x(me,k,!0)})}}catch{F=[G]}T=T.substring(H).trim()}}try{E=z(E,k,...F)}catch(V){let H=V instanceof Error?V.message:String(V);throw Error(`Error applying filter '${B}': ${H}`)}if(T.startsWith("|"))T=T.substring(1).trim();else break}return E}function Sy(v){let _=!1,k="",E=0,T=0,j=0,B=!1;for(let z=0;z<v.length;z++){let F=v[z],V=v[z+1];if(_&&B){B=!1;continue}if(_&&F==="\\"){B=!0;continue}if(B=!1,(F==='"'||F==="'"||F==="`")&&!B){if(!_)_=!0,k=F;else if(F===k)_=!1,k="";continue}if(_&&k==="`"&&F==="$"&&V==="{"){let H=1;z+=2;while(z<v.length&&H>0){if(v[z]==="{")H++;else if(v[z]==="}")H--;if(H>0)z++}continue}if(_)continue;if(F==="(")E++;else if(F===")")E--;else if(F==="[")T++;else if(F==="]")T--;else if(F==="{")j++;else if(F==="}")j--;if(F==="|"&&E===0&&T===0&&j===0){if(V==="|"){z++;continue}if(V==="="){z++;continue}return z}}return-1}var xi=new Set,$y=1000;function Dd(){xi.clear()}function Ha(v,_,k,E){if(!O())return;let T=`${k}\x00${v.expression}`;if(xi.has(T))return;if(xi.size>=$y)xi.clear();xi.add(T);let j=k,B=E;try{if(k&&pd.existsSync(k))B=pd.readFileSync(k,"utf8")}catch{}let z=B.indexOf(_);if(z>=0)j=`${k}:${B.slice(0,z).split(`
857
- `).length}`;console.warn(`${j}: stx warning: ${_} rendered as an empty string. The safe evaluator rejected \`${v.expression}\` (${v.rule}). Compute the value in <script server> and interpolate the variable instead.`)}function x(v,_,k=!1,E){try{let T=v.trim(),j=Sy(T);if(j>0){let z=T.substring(0,j).trim(),F=T.substring(j+1).trim(),V=x(z,_,!0,E);return sc(V,F,_)}let B=bn(T);if(B!==null){E?.({expression:T,rule:B});return}try{let z=Object.keys(_),F=Object.values(_);return l(T,z)(...F)}catch{return c(T,_)}}catch(T){if(T instanceof ReferenceError){let j=/(\b\w+)\s+is not defined/.exec(T.message);if(j){let B=j[1],z=_y(B,Object.keys(_));if(z&&z!==B)T.message=`${T.message} \u2014 did you mean '${z}'?`}}if(!k)console.error(`Error evaluating expression: ${v}`,T);throw T}}function _y(v,_){let k=null;for(let T of _){if(T===v)continue;let j=ky(v,T);if(k===null||j<k.dist)k={key:T,dist:j}}if(!k)return null;let E=Math.max(v.length,k.key.length);if(k.dist<=2||k.dist/E<=0.35)return k.key;return null}function ky(v,_){if(v===_)return 0;if(v.length===0)return _.length;if(_.length===0)return v.length;let[k,E]=v.length<_.length?[v,_]:[_,v],T=Array(k.length+1),j=Array(k.length+1);for(let B=0;B<=k.length;B++)T[B]=B;for(let B=1;B<=E.length;B++){j[0]=B;for(let z=1;z<=k.length;z++){let F=k[z-1]===E[B-1]?0:1;j[z]=Math.min(j[z-1]+1,T[z]+1,T[z-1]+F)}for(let z=0;z<=k.length;z++)T[z]=j[z]}return T[k.length]}function Od(v){if(!v)return"";return v.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#039;/g,"'").replace(/&#39;/g,"'").replace(/&amp;/g,"&")}import Zw from"fs";import Yt from"path";import Ni from"fs";import Ot from"path";import{hasLocalConfig as hf}from"bunfig";import Dn from"fs";import Ir from"path";import qa from"fs";import bd from"path";import{fileURLToPath as Ey}from"url";var Ka;function Ne(){if(Ka)return Ka;let v="unknown";try{v=String(JSON.parse(qa.readFileSync(new URL("../package.json",import.meta.url),"utf8")).version)}catch{}if(import.meta.url.endsWith(".ts"))try{let _=bd.dirname(Ey(import.meta.url)),k=0;for(let E of qa.readdirSync(_,{recursive:!0,withFileTypes:!0}))if(E.isFile()&&E.name.endsWith(".ts"))k=Math.max(k,qa.statSync(bd.join(E.parentPath,E.name)).mtimeMs);v+=`+src.${Math.trunc(k)}`}catch{}return Ka=v,v}var oc=new Map,Pr=new Map;async function Md(v){let k;for(let E=0;E<3;E++)try{let j=(await Dn.promises.stat(v)).mtime.getTime(),B=Pr.get(v);if(B&&B.mtime===j)return B.content;let z=await Bun.file(v).text(),V=(await Dn.promises.stat(v)).mtime.getTime();if(V!==j)continue;return Pr.set(v,{content:z,mtime:V}),z}catch(T){k=T;break}throw Pr.delete(v),Error(`File not found: ${v}${k?` (${k.message})`:""}`)}function Nd(v){Pr.delete(v)}function Ld(v){for(let _ of Pr.keys())if(_.startsWith(v))Pr.delete(_)}var vo=null,Cy=null,wd=null;function jd(v){wd=v}async function ic(v=!1){let _=wd??await import("./chunk-gw9ax7xx.js");if(v)return _.generateSignalsRuntimeDev();if(vo===null)vo=_.generateSignalsRuntime();return vo}var wo=null;async function ac(){if(wo===null){let{getRouterScript:v}=await import("./chunk-km9g9drp.js");wo=v()}return wo}var vd={};async function Bd(v,_=!1){let k=v==="runtime"?await ic(_):await ac(),E=v==="runtime"&&_?"runtime-debug":v,T=vd[E];if(!T||T.content!==k)T={content:k,hash:Bun.hash(k).toString(16).padStart(16,"0").slice(0,16)},vd[E]=T;return{content:k,hash:T.hash,url:`/_stx/${v}.${T.hash}.js`}}var Ry=500,Tr=new Map;function Sd(v){return a(process.cwd(),"module-bundles",`${v}.js`)}function Fd(v){let _=Bun.hash(v).toString(16).padStart(16,"0").slice(0,16),k=Tr.has(_);if(k)Tr.delete(_);Tr.set(_,v);while(Tr.size>Ry)Tr.delete(Tr.keys().next().value);if(!k)try{let E=Sd(_);if(!Dn.existsSync(E))Dn.mkdirSync(Ir.dirname(E),{recursive:!0}),Dn.writeFileSync(E,v)}catch{}return`/_stx/modules.${_}.js`}function Ko(v){if(!/^[0-9a-f]{16}$/.test(v))return;let _=Tr.get(v);if(_!==void 0)return _;try{return Dn.readFileSync(Sd(v),"utf8")}catch{return}}function zd(){Pr.clear(),ee(),Hu(),vo=null,Cy=null,wo=null}function $d(v){let _={debug:v.debug===!0,middleware:(v.middleware??[]).map((k)=>({name:k.name,timing:k.timing,handler:String(k.handler)})),customDirectives:(v.customDirectives??[]).map((k)=>({name:k.name,hasEndTag:k.hasEndTag===!0,rawParams:k.rawParams===!0,handler:String(k.handler)}))};return new Bun.CryptoHasher("sha1").update(JSON.stringify(_)).digest("hex")}async function nn(v,_){try{if(!_.cachePath)return null;let k=Ir.resolve(_.cachePath),E=Ir.join(k,`${zn(v)}.html`),T=Ir.join(k,`${zn(v)}.meta.json`);if(!await r(E)||!await r(T))return null;let j=await Bun.file(T).text(),B=JSON.parse(j);if(B.cacheVersion!==_.cacheVersion)return null;if(B.engine!==Ne())return null;if(B.optionsSignature!==$d(_))return null;if((await Dn.promises.stat(v)).mtime.getTime()>B.mtime)return null;for(let F of B.dependencies)if(await r(F)){if((await Dn.promises.stat(F)).mtime.getTime()>B.mtime)return null}else return null;return await Bun.file(E).text()}catch(k){return console.warn(`Cache error for ${v}:`,k),null}}async function rn(v,_,k,E){try{if(!E.cachePath)return;let T=Ir.resolve(E.cachePath);await Dn.promises.mkdir(T,{recursive:!0});let j=Ir.join(T,`${zn(v)}.html`),B=Ir.join(T,`${zn(v)}.meta.json`),z=await Dn.promises.stat(v);await Bun.write(j,_);let F={sourcePath:v,mtime:z.mtime.getTime(),dependencies:Array.from(k),cacheVersion:E.cacheVersion,engine:Ne(),optionsSignature:$d(E),generatedAt:Date.now()};await Bun.write(B,JSON.stringify(F,null,2)),oc.set(v,{output:_,mtime:z.mtime.getTime(),dependencies:k})}catch(T){console.warn(`Failed to cache template ${v}:`,T)}}var Ay=16;function zn(v){return new Bun.CryptoHasher("sha1").update(v).digest("hex").substring(0,Ay)}var Hn={fg:{light:"neutral-900",dark:"neutral-100",description:"Primary text"},"fg-strong":{light:"neutral-700",dark:"neutral-300",description:"Labels, secondary headings"},"fg-muted":{light:"neutral-600",dark:"neutral-400",description:"Supporting text"},"fg-soft":{light:"neutral-500",dark:"neutral-400",description:"De-emphasised text"},"fg-subtle":{light:"neutral-400",dark:"neutral-500",description:"Recessive, non-essential text"},surface:{light:"neutral-50",dark:"neutral-800",description:"Page and panel background"},"surface-raised":{light:"neutral-100",dark:"neutral-700",description:"Cards, popovers"},"surface-sunken":{light:"neutral-200",dark:"neutral-700",description:"Wells, track backgrounds"},panel:{light:"white",dark:"neutral-800",description:"Card, menu, dialog surface"},field:{light:"white",dark:"neutral-700",description:"Form control surface"},page:{light:"neutral-50",dark:"neutral-900",description:"Page background, behind panels"},content:{light:"white",dark:"neutral-900",description:"Content area under a chrome header - a table or list body"},"surface-hover":{light:"neutral-100",dark:"neutral-700",description:"Row or item highlight on a page or panel"},"surface-raised-hover":{light:"neutral-200",dark:"neutral-600",description:"Raised surface, hovered"},"surface-sunken-hover":{light:"neutral-300",dark:"neutral-600",description:"Sunken surface, hovered"},"field-hover":{light:"neutral-50",dark:"neutral-600",description:"Form control surface, hovered"},link:{light:"blue-500",dark:"blue-400",description:"Hyperlink"},"link-hover":{light:"blue-600",dark:"blue-300",description:"Hyperlink, hovered"},inverse:{light:"neutral-900",dark:"neutral-700",description:"Tooltip bubble, inverted surface"},"inverse-ink":{light:"white",dark:"white",description:"Text on an inverted surface"},line:{light:"neutral-200",dark:"neutral-700",description:"Default border, divider"},"line-strong":{light:"neutral-300",dark:"neutral-600",description:"Input border, focus ring track"},"line-hover":{light:"neutral-400",dark:"neutral-500",description:"Border of a hovered control"},accent:{light:"blue-600",dark:"blue-400",description:"Primary action, selected state"},info:{light:"cyan-600",dark:"cyan-400",description:"Informational emphasis"},danger:{light:"red-600",dark:"red-400",description:"Errors, destructive actions"},success:{light:"green-600",dark:"green-400",description:"Confirmation"},warning:{light:"yellow-600",dark:"yellow-400",description:"Caution"},"accent-solid":{light:"blue-500",dark:"blue-600",description:"Primary button fill"},"info-solid":{light:"cyan-500",dark:"cyan-600",description:"Informational fill"},"danger-solid":{light:"red-500",dark:"red-600",description:"Destructive button fill"},"success-solid":{light:"green-500",dark:"green-600",description:"Confirmation fill"},"warning-solid":{light:"yellow-500",dark:"yellow-600",description:"Caution fill"},"accent-solid-hover":{light:"blue-600",dark:"blue-700",description:"Primary button fill, hovered"},"info-solid-hover":{light:"cyan-600",dark:"cyan-700",description:"Informational fill, hovered"},"danger-solid-hover":{light:"red-600",dark:"red-700",description:"Destructive fill, hovered"},"success-solid-hover":{light:"green-600",dark:"green-700",description:"Confirmation fill, hovered"},"warning-solid-hover":{light:"yellow-600",dark:"yellow-700",description:"Caution fill, hovered"},"accent-ink":{light:"white",dark:"white",description:"Text on a primary fill"},"info-ink":{light:"neutral-900",dark:"neutral-900",description:"Text on an informational fill"},"danger-ink":{light:"white",dark:"white",description:"Text on a destructive fill"},"success-ink":{light:"neutral-900",dark:"neutral-900",description:"Text on a confirmation fill"},"warning-ink":{light:"neutral-900",dark:"neutral-900",description:"Text on a caution fill"},"accent-soft":{light:"blue-100",dark:"blue-900",description:"Tinted primary fill"},"accent-soft-ink":{light:"blue-800",dark:"blue-200",description:"Text on a tinted primary fill"},"info-soft":{light:"cyan-100",dark:"cyan-900",description:"Tinted informational fill"},"info-soft-ink":{light:"cyan-800",dark:"cyan-200",description:"Text on a tinted informational fill"},"danger-soft":{light:"red-100",dark:"red-900",description:"Tinted destructive fill"},"danger-soft-ink":{light:"red-800",dark:"red-200",description:"Text on a tinted destructive fill"},"success-soft":{light:"green-100",dark:"green-900",description:"Tinted confirmation fill"},"success-soft-ink":{light:"green-800",dark:"green-200",description:"Text on a tinted confirmation fill"},"warning-soft":{light:"yellow-100",dark:"yellow-900",description:"Tinted caution fill"},"warning-soft-ink":{light:"yellow-800",dark:"yellow-200",description:"Text on a tinted caution fill"},secondary:{light:"purple-600",dark:"purple-400",description:"Secondary emphasis"},"secondary-solid":{light:"purple-500",dark:"purple-600",description:"Secondary fill"},"secondary-solid-hover":{light:"purple-600",dark:"purple-700",description:"Secondary fill, hovered"},"secondary-ink":{light:"white",dark:"white",description:"Text on a secondary fill"},"secondary-soft":{light:"purple-100",dark:"purple-900",description:"Tinted secondary fill"},"secondary-soft-ink":{light:"purple-800",dark:"purple-200",description:"Text on a tinted secondary fill"},"danger-fg":{light:"red-900",dark:"red-300",description:"Text in a field with an error"},"danger-fg-subtle":{light:"red-300",dark:"red-500",description:"Recessive text in a field with an error"},"danger-line":{light:"red-300",dark:"red-600",description:"Border of a field with an error"},"danger-focus":{light:"red-500",dark:"red-400",description:"Focus ring of a field with an error"}};function Xa(v){return`--stx-${v}`}function Ga(v,_){let k=_.lastIndexOf("-");if(k===-1)return typeof v[_]==="string"?v[_]:void 0;let E=v[_.slice(0,k)];if(!E||typeof E!=="object")return;let T=E[_.slice(k+1)];return typeof T==="string"?T:void 0}function _d(v){let _={};for(let[k,E]of Object.entries(Hn)){let T=Ga(v,E.light);if(T===void 0)continue;_[k]=`var(${Xa(k)}, ${T})`}return _}function kd(v){let _=[],k=[];for(let[E,T]of Object.entries(Hn)){let j=Ga(v,T.light),B=Ga(v,T.dark);if(j===void 0)continue;if(_.push(` ${Xa(E)}: ${j};`),B!==void 0)k.push(` ${Xa(E)}: ${B};`)}if(_.length===0)return"";return["/* stx role tokens \u2014 override any of these to re-theme by meaning. */",":root {",..._,"}",".dark {",...k,"}",""].join(`
856
+ `}),Yu(v,T)}function Yu(v,_){if(_.length===0)return v;_.sort((j,B)=>j.start-B.start||j.end-B.end);let k=Array(_.length*2+1),E=0,T=0;for(let j of _)k[T++]=v.slice(E,j.start),k[T++]=j.replacement,E=j.end;return k[T]=v.slice(E),k.join("")}function td(v){let _=go(v),k=new Map;if(_)for(let[E,T]of _)k.set(E,T.instances);return k}function nd(v,_){let k=go(v);if(!k)return[];let E=[];for(let[T,j]of k){let B=j.instances-(_.get(T)??0);if(B>0)E.push({body:j.body,count:B})}return E}function rd(v,_){for(let{body:k,count:E}of _)for(let T=0;T<E;T++)Na(v,k)}import pd from"fs";var sd=0,ja=new Map;function Uo(){sd=0,ja.clear()}function mo(v,_){let k=sd++,E=`<!--__STX_${v.toUpperCase()}_${k}__-->`;return ja.set(E,{type:v,expression:_}),E}function Wo(){let v={};for(let[_,k]of ja)v[_]={type:k.type,expression:k.expression};return v}function qo(v,_){let k=v;for(let[E,T]of _)k=k.split(E).join(T);return k}function Qr(v){return v.includes("<!--__STX_")}var sy=/@(?=[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 iy(v){return Array.from({length:v},()=>"&#123;").join("&#8288;")}function id(v){return v.replace(/\{{2,}/g,(_)=>iy(_.length)).replace(/\{(?=!)/g,"&#123;&#8288;").replace(sy,"&#64;")}var oy=/^(?:javascript|vbscript|livescript|mocha|view-source):/,ay=/^data:(?:text\/html|text\/xml|application\/xhtml\+xml|application\/xml|image\/svg\+xml)/,cy=/^data:(?:text\/html|application\/xhtml\+xml)/,ly=new RegExp("[\\u0000-\\u0020\\u00A0\\u1680\\u2000-\\u200F\\u2028\\u2029\\u202F\\u205F\\u3000\\uFEFF]+","g");function uy(v){return v.replace(ly,"").toLowerCase()}function dy(v){let _=v.toLowerCase();if(new RegExp("^(?:href|xlink:href|action|formaction|ping|cite|manifest|data|to)$").test(_))return"navigable";if(new RegExp("^(?:src|srcset|poster|background)$").test(_))return"fetched";return null}function od(v,_="navigable"){let k=uy(v);if(oy.test(k))return!0;return _==="navigable"?ay.test(k):cy.test(k)}function yi(v,_="navigable"){return od(v,_)?"unsafe:"+v:v}function fy(v){let _=v.match(/(?:^|[\s"'`/])([A-Za-z][\w:-]*)\s*=\s*(["'])([^"']*)$/);if(!_)return null;if(_[3].trim()!=="")return null;return dy(_[1])}function La(v,_,k=256){if(_<=k)return v.slice(0,_);let E=v.slice(_-k,_),T=E.search(/[\s"'`/]/);return T===-1?"":E.slice(T)}function Ba(v,_,k=_){let E=fy(v);return E&&od(_,E)?"unsafe:"+k:k}var ho=/<script\b[^>]*>/iy,Va=/<\/script\s*>/ig,yo=/<style\b[^>]*>/iy,Ua=/<\/style\s*>/ig;function ad(v,_,k,E){k.lastIndex=_;let T=k.exec(v);if(!T||T.index!==_)return-1;E.lastIndex=k.lastIndex;let j=E.exec(v);if(!j)return-1;return j.index+j[0].length}function Y(v,_){return ad(v,_,ho,Va)}function Ss(v,_){return ad(v,_,yo,Ua)}function je(v,_){if(!v.startsWith("<!--",_))return-1;let k=v.indexOf("-->",_+4);if(k===-1)return-1;return k+3}function cd(v,_){if(v.startsWith("<!--",_)){let T=je(v,_);return T===-1?v.length:T}if(ho.lastIndex=_,ho.exec(v)?.index===_){Va.lastIndex=ho.lastIndex;let T=Va.exec(v);return T?T.index+T[0].length:v.length}if(yo.lastIndex=_,yo.exec(v)?.index===_){Ua.lastIndex=yo.lastIndex;let T=Ua.exec(v);return T?T.index+T[0].length:v.length}return-1}function gr(v,_){let k=[],E=0,T=v.length,j=!1,B=null;while(E<T){let z=v[E];if(j){if(B){if(z===B)B=null}else if(z==='"'||z==="'")B=z;else if(z===">")j=!1;E++;continue}if(z!=="<"){let G=v.indexOf("<",E+1);if(G===-1)break;E=G;continue}let F=_(v,E);if(F>E){k.push({start:E,end:F,token:v.slice(E,F)}),E=F;continue}let V=cd(v,E);if(V>E){E=V;continue}let H=v.charCodeAt(E+1);if(H>=65&&H<=90||H>=97&&H<=122)j=!0;E++}return k}function ld(v){let _=0,k=0,E=0,T=!1,j=null;while(E<v.length){if(T){let G=v[E];if(j){if(G===j)j=null}else if(G==='"'||G==="'")j=G;else if(G===">")T=!1;E++;continue}let B=v.indexOf("<",E),z=B===-1?v.length:B;while(E<z){let G=v[E++];if(G==="{")_++;else if(G==="}")k++;if(_>=2&&k>=2)return!0}if(B===-1)break;let F=cd(v,B);if(F>B){E=F;continue}let V=v.charCodeAt(B+1),H=V===47?v.charCodeAt(B+2):V;if(H>=65&&H<=90||H>=97&&H<=122)T=!0;E=B+1}return!1}function ud(v,_){while(v.size>=_){let k=v.keys().next();if(k.done)return;v.delete(k.value)}}var py=1024,gy=16777216,Xr=new Map,za=0;function my(v,_){Xr.set(v,_),za+=v.length+_.output.length;for(let[k,E]of Xr){if(za<=gy)break;Xr.delete(k),za-=k.length+E.output.length}}function Pn(v,_,k,E){let T=E!==void 0&&v.length>=py,j=T?`${E}\x00${v}`:"";if(T){let H=Xr.get(j);if(H)return Xr.delete(j),Xr.set(j,H),{output:H.output,tokens:H.tokens.slice()}}let B=gr(v,_);if(B.length===0)return{output:v,tokens:[]};let z=B.map((H)=>H.token),F="",V=0;for(let H=0;H<B.length;H++){let G=B[H];F+=v.slice(V,G.start),F+=k(G.token,H),V=G.end}if(F+=v.slice(V),T)return my(j,{output:F,tokens:z}),{output:F,tokens:z.slice()};return{output:F,tokens:z}}var hy=1024,yy=16777216,fs=new Map,Wa=0;function xy(v,_){fs.set(v,_),Wa+=v.length+_.output.length;for(let[k,E]of fs){if(Wa<=yy)break;fs.delete(k),Wa-=k.length+E.output.length}}function Fa(v,_,k){return{output:_,scripts:k,restore:(E)=>E===_?v:Cs(E,k)}}function xn(v){let _=v.length>=hy;if(_){let T=fs.get(v);if(T)return fs.delete(v),fs.set(v,T),Fa(v,T.output,T.scripts.slice())}let{output:k,tokens:E}=Pn(v,Y,(T,j)=>`\x00STX_SCRIPT_${j}\x00`);if(_)return xy(v,{output:k,scripts:E}),Fa(v,k,E.slice());return Fa(v,k,E)}function Cs(v,_){if(_.length===0)return v;return v.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(k,E)=>_[+E]??"")}function xt(v){let _=v.indexOf(" as ");if(_!==-1){let j=v.slice(0,_).trim(),B=v.slice(_+4).trim();return j&&B?{arrayExpr:j,itemVar:B}:null}let k=/^\s*(.+?)\s+in\s+([\s\S]+)$/.exec(v);if(!k)return null;let E=k[1].trim().replace(/^\(([\s\S]*)\)$/,"$1").trim(),T=k[2].trim();return E&&T?{arrayExpr:T,itemVar:E}:null}function xo(v){let _=[],k=0,E="",T=0;for(let j=0;j<v.length;j++){let B=v[j];if(E){if(B==="\\")j++;else if(B===E)E="";continue}if(B==="'"||B==='"'||B==="`")E=B;else if(B==="("||B==="["||B==="{")k++;else if(B===")"||B==="]"||B==="}")k--;else if(B===","&&k===0)_.push(v.slice(T,j)),T=j+1}return _.push(v.slice(T)),_}function dd(v,_){let k=0;for(let E=0;E<v.length;E++){let T=v[E];if(T==="("||T==="["||T==="{")k++;else if(T===")"||T==="]"||T==="}")k--;else if(T===_&&k===0)return E}return-1}function fd(v){let _=0;for(let k=0;k<v.length;k++){let E=v[k];if(E==="("||E==="["||E==="{")_++;else if((E===")"||E==="]"||E==="}")&&--_===0)return k}return-1}function Rr(v,_){let k=v.trim().replace(/^\.\.\./,"").trim(),E=dd(k,"=");if(E!==-1&&k[E+1]!==">")k=k.slice(0,E).trim();if(!k)return;if(k.startsWith("{")&&k.endsWith("}")){for(let T of xo(k.slice(1,-1))){let j=T.trim();if(!j)continue;if(j.startsWith("...")){Rr(j,_);continue}let B=dd(j,":");Rr(B===-1?j:j.slice(B+1),_)}return}if(k.startsWith("[")&&k.endsWith("]")){for(let T of xo(k.slice(1,-1)))Rr(T,_);return}if(/^[A-Z_$][\w$]*$/i.test(k))_.push(k)}function Ns(v){let _=v.trim(),k=[],E=0;for(let j=0;j<_.length;j++){let B=_[j];if(B==="("||B==="["||B==="{")E++;else if(B===")"||B==="]"||B==="}")E--;else if(E===0&&/\s/.test(B)){if(!/^\s+(?:in|of)\s/.exec(_.slice(j)))continue;let F=_.slice(0,j).trim();if(F.startsWith("(")&&fd(F)===F.length-1)F=F.slice(1,-1);for(let V of xo(F))Rr(V,k);if(k.length>0)return k;break}}let T=/^[\s\S]+?\s+as\s+([\s\S]+)$/.exec(_);if(T){let j=T[1].trim();if(j.startsWith("(")&&fd(j)===j.length-1)j=j.slice(1,-1);let B=/^([\w$]+)\s*=>\s*([\s\S]+)$/.exec(j);if(B)Rr(B[2],k),Rr(B[1],k);else for(let z of xo(j))Rr(z,k)}return k}function Ar(v,_){let k=_ instanceof Set?_:new Set(_);if(k.size===0)return!1;let B=v.replace(/'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"/g," ").replace(/`(?:[^`\\$]|\\.|\$(?!\{))*`/g," ").replace(/\??\.\s*[a-zA-Z_$][\w$]*/g," ").replace(/([{,]\s*)[a-zA-Z_$][\w$]*(\s*:(?!:))/g,"$1$2");for(let z of B.match(/[a-zA-Z_$][\w$]*/g)||[])if(k.has(z))return!0;return!1}var bo="__stx_client_loop_names";function mr(v){let _=v?.[bo];return Array.isArray(_)?_:[]}var vi={},gd=new Map;function by(v){let _=gd.get(v);if(!_){let k=v.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");_=new RegExp(`:${k}(?!\\w)`,"g"),gd.set(v,_)}return _.lastIndex=0,_}var Bn={uppercase:(v,_)=>v!==void 0&&v!==null?String(v).toUpperCase():"",lowercase:(v,_)=>v!==void 0&&v!==null?String(v).toLowerCase():"",capitalize:(v,_)=>{if(v===void 0||v===null)return"";let k=String(v);return k.charAt(0).toUpperCase()+k.slice(1)},number:(v,_,k=0)=>{if(v===void 0||v===null)return"";try{let E=Number(v);return Number.isNaN(E)?"":E.toFixed(Number.parseInt(String(k),10))}catch{return""}},fmt:(v,_,k="en-US")=>{if(v===void 0||v===null)return"";try{let E=Number(v);if(Number.isNaN(E))return String(v);return E.toLocaleString(k)}catch{return String(v)}},join:(v,_,k=",")=>{if(!Array.isArray(v))return"";return v.join(String(k))},escape:(v,_)=>{if(v===void 0||v===null)return"";return St(String(v))},translate:(v,_,k={})=>{if(!_||!_.__translations)return v;let E=_.__translations,T=_.__i18nConfig?.fallbackToKey??!0,j=String(v).split("."),B=E;for(let F of j){if(B===void 0||B===null)break;B=B[F]}if(B===void 0||B===null)return T?v:"";let z=String(B);return Object.entries(k).forEach(([F,V])=>{z=z.replace(by(F),String(V))}),z},t:(v,_,k={})=>Bn.translate(v,_,k),truncate:(v,_,k=50,E="...")=>{if(v===void 0||v===null)return"";let T=String(v);if(T.length<=k)return T;if(k<=E.length)return E.substring(0,k);return T.substring(0,k-E.length)+E},date:(v,_,k="short",E="en-US")=>{if(v===void 0||v===null)return"";try{let T=v instanceof Date?v:new Date(v);if(Number.isNaN(T.getTime()))return String(v);let j={short:{dateStyle:"short"},medium:{dateStyle:"medium"},long:{dateStyle:"long"},full:{dateStyle:"full"},time:{timeStyle:"short"},datetime:{dateStyle:"short",timeStyle:"short"},iso:{}};if(k==="iso")return T.toISOString();return new Intl.DateTimeFormat(E,j[k]||j.short).format(T)}catch{return String(v)}},currency:(v,_,k="USD",E="en-US")=>{if(v===void 0||v===null)return"";try{let T=Number(v);if(Number.isNaN(T))return String(v);return new Intl.NumberFormat(E,{style:"currency",currency:k}).format(T)}catch{return String(v)}},pluralize:(v,_,k,E)=>{let T=Number(v);if(Number.isNaN(T))return k;let j=E||`${k}s`;return T===1?k:j},first:(v,_)=>{if(v===void 0||v===null)return"";if(Array.isArray(v))return v.length===0?"":v[0];return String(v).charAt(0)},last:(v,_)=>{if(v===void 0||v===null)return"";if(Array.isArray(v))return v.length===0?"":v[v.length-1];let k=String(v);return k.charAt(k.length-1)},length:(v,_)=>{if(v===void 0||v===null)return 0;if(Array.isArray(v)||typeof v==="string")return v.length;if(v instanceof Map||v instanceof Set)return v.size;if(typeof v==="object")return Object.keys(v).length;return 0},json:(v,_,k=!1)=>{if(v===void 0)return"undefined";if(v===null)return"null";try{return k?JSON.stringify(v,null,2):JSON.stringify(v)}catch{return String(v)}},default:(v,_,k="")=>v===void 0||v===null||v===""?k:v,reverse:(v,_)=>{if(v===void 0||v===null)return"";if(Array.isArray(v))return[...v].reverse();return String(v).split("").reverse().join("")},slice:(v,_,k=0,E)=>{if(v===void 0||v===null)return"";if(Array.isArray(v)||typeof v==="string")return v.slice(k,E);return v},replace:(v,_,k,E="")=>{if(v===void 0||v===null)return"";let T=k.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return String(v).replace(new RegExp(T,"g"),()=>E)},stripTags:(v,_)=>{if(v===void 0||v===null)return"";return String(v).replace(/<[^>]*>/g,"")},urlencode:(v,_)=>{if(v===void 0||v===null)return"";return encodeURIComponent(String(v))},abs:(v,_)=>{let k=Number(v);return Number.isNaN(k)?0:Math.abs(k)},round:(v,_,k=0)=>{let E=Number(v);if(Number.isNaN(E))return 0;let T=10**k;return Math.round(E*T)/T}};function Qa(v,_){if(v in Bn)console.warn(`Filter "${v}" already exists as a built-in filter. Custom filter will take precedence.`);vi[v]=_}function Ad(v){for(let[_,k]of Object.entries(v))Qa(_,k)}function ec(){return{...Bn,...vi}}function Pd(){for(let v of Object.keys(vi))delete vi[v]}function tc(v,_,k=2){let E=0,T=null;for(let j=_+k;j<v.length;j++){let B=v[j];if(T){if(B==="\\"){j++;continue}if(B===T)T=null;continue}if(B==='"'||B==="'"||B==="`"){T=B;continue}if(B==="{"){E++;continue}if(B==="}"){if(E>0){E--;continue}let z=0;while(v[j+z]==="}")z++;if(z>=k)return j}}return-1}function Fn(v,_,k=2){let E="{".repeat(k);if(!v.includes(E))return v;let T="",j=0;for(;;){let B=v.indexOf(E,j);if(B===-1)break;let z=tc(v,B,k);if(z===-1)break;T+=v.slice(j,B)+_(v.slice(B,z+k),v.slice(B+k,z),B),j=z+k}return j===0?v:T+v.slice(j)}function b(v){return v.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function St(v){return id(b(v))}function ye(v,_){let{scripts:k}=xn(v);for(let E of k){let T=E.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i);if(!T||/\bserver\b|\bsrc\s*=/.test(T[1]))continue;let j=T[2];if(/\b(state|derived|effect|ref|reactive|computed|watch|watchEffect|useModel)\s*(?:<[^>]*>)?\s*\(/.test(j))return!0;if(vn(j,_))return!0}if(/@(if|for|show)\s*=\s*["'][^"']*\(\s*\)/.test(v))return!0;if(/@for\s*=\s*["'][^"']*\s+(?:in|of)\s+[^"']*\(\s*\)/.test(v))return!0;if(/(?:^|[\s"'])(?::|x-)(?:for|if|else-if|else|show|text|html|model|bind)\b/.test(v))return!0;return!1}function nc(v){let _=[],k=/<([a-zA-Z][\w-]*)\b[^>]*?\s(?::for|x-for|@for)\s*=\s*(["'])([\s\S]*?)\2[^>]*>/g;for(let E=k.exec(v);E;E=k.exec(v)){let T=E[1].toLowerCase(),j=new Set(Ns(E[3]));if(j.size===0)continue;let B=E.index+E[0].length;if(E[0].endsWith("/>")){_.push({start:E.index,end:B,names:j});continue}let z=new RegExp(`<(/?)${T}\\b[^>]*?(/?)>`,"gi");z.lastIndex=B;let F=1,V=v.length;for(let H=z.exec(v);H;H=z.exec(v)){if(H[2]==="/")continue;if(F+=H[1]==="/"?-1:1,F===0){V=H.index+H[0].length;break}}_.push({start:E.index,end:V,names:j})}return _}function vy(v,_,k){let E=s(k);for(let T of v){if(_<T.start||_>=T.end)continue;for(let j of T.names)if(new RegExp(`(?<![.#\\w$])${j.replace(/\$/g,"\\$")}(?![\\w$])`).test(E))return!0}return!1}function md(v,_){let k=["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"],E=v.replace(/'[^']*'/g,"").replace(/"[^"]*"/g,""),T="",j=!1,B=0;for(let V=0;V<E.length;V++){let H=E[V];if(!j&&H==="`"){j=!0,B=0;continue}if(j){if(H==="`"&&B===0){j=!1;continue}if(H==="$"&&E[V+1]==="{"){B++,V++,T+=" ";continue}if(H==="}"&&B>0){B--;continue}if(B>0){T+=H;continue}continue}T+=H}E=T;let z=/(?<![a-zA-Z0-9_$])([a-zA-Z_$][a-zA-Z0-9_$]*)/g,F;while((F=z.exec(E))!==null){let V=F[1];if(!E.substring(0,F.index).trimEnd().endsWith(".")){if(!k.includes(V)&&!(V in _))return!1}}return!0}function wy(v,_){let k=_.__stx_serverDeclared;if(!k||k.size===0)return!1;let E=s(v);for(let T of k)if(new RegExp(`(?<![.#\\w$])${T}(?![\\w$])`).test(E))return!0;return!1}var hd=new Set;function yd(v){return/^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*)*$/.test(v.trim())}function xd(v,_){let k=`${_??"<unknown>"}\x00${v}`;if(process.env.STX_DEBUG||!hd.has(k))hd.add(k),console.warn(`[stx] {{ ${v} }} in a <script> in ${_??"<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 es(v,_,k){let E=v;return E=E.replace(/\{!!([\s\S]*?)!!\}/g,(T,j)=>{try{let B=x(j,_);if(B===void 0)return yd(j)?xd(j.trim(),k):T;return B===null?"":String(B)}catch{return T}}),E=Fn(E,(T,j,B)=>{let z=j.trim();if(/^__[A-Z_]+__$/.test(z))return T;try{let F=x(j,_);if(F===void 0)return yd(z)?xd(z,k):T;return JSON.stringify(F).replace(/</g,"\\u003c")}catch{return T}}),E}function rc(v,_){if(!v.includes("{"))return v;let k=v;return k=k.replace(/\{!!([\s\S]*?)!!\}/g,(E,T)=>{try{let j=x(T,_);if(j===void 0)return E;return j===null?"":String(j)}catch{return E}}),k=Fn(k,(E,T,j)=>{let B=T.trim();if(/^__[A-Z_]+__$/.test(B))return E;try{let z=x(T,_);if(z===void 0)return E;if(z===null)return"";let F=String(z);return Ba(La(k,j),F,St(F))}catch{return E}}),k}function Id(v,_,k={}){let{output:E,scripts:T}=xn(v),j=T.map((B)=>{let z=B.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i),F=B.match(/^<script\b[^>]*>/i),V=B.search(/<\/script\s*>$/i);if(!z||!F||V===-1)return B;let H=z[1],G=z[2];if(/\bdata-raw\b/.test(H))return B;if(k.skipServer&&/\bserver\b/.test(H))return B;let ne=`<script${rc(H,_)}>`;if(/\bsrc\s*=/.test(H)||/\btype\s*=\s*["']application\/json["']/.test(H))return ne+G+B.slice(V);return ne+es(G,_)+B.slice(V)});return Cs(E,j)}function q(v,_,k){let E=v,T=(ne,re)=>{let se=Ss(ne,re);if(se===-1)return-1;return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(ne.slice(re,se))?-1:se},j=(ne,re,se,ie)=>{let ae=se.length,{output:ue,tokens:oe}=Pn(ne,re,(me,ve)=>ie(ae+ve));return se.push(...oe),ue},B=[];E=j(E,T,B,(ne)=>`<!--__STX_STYLE_${ne}__-->`);let z=[];E=j(E,Y,z,(ne)=>`<!--__STX_SCRIPT_EXPR_${ne}__-->`);let F=_?.__stx_signals_gate===!0||ye(v),V=new Set(Array.isArray(_?.__stx_client_signal_names)?_.__stx_client_signal_names:[]),H=new Set(Array.isArray(_?.__stx_preserved_client_expressions)?_.__stx_preserved_client_expressions:[]);E=Fn(E,(ne,re,se)=>{try{let ie=x(re,_,!1,(ae)=>Ha(ae,ne,k,v));return ie!==void 0&&ie!==null?String(ie):""}catch(ie){let ae=ie instanceof Error?ie.message:String(ie);return g("Expression",`Error evaluating: {{{ ${re.trim()}}}}: ${ae}`,k,v,se,ne)}},3),E=E.replace(/\{!!([\s\S]*?)!!\}/g,(ne,re,se)=>{try{let ie=x(re,_,!1,(ae)=>Ha(ae,ne,k,v));if(ie===void 0&&_.__stx_buildMode==="compile")return mo("raw",re.trim());return ie!==void 0&&ie!==null?String(ie):""}catch(ie){if(_.__stx_buildMode==="compile")return mo("raw",re.trim());let ae=ie instanceof Error?ie.message:String(ie);return g("Expression",`Error evaluating: {!! ${re.trim()} !!}: ${ae}`,k,v,se,ne)}}),E=j(E,Y,z,(ne)=>`<!--__STX_SCRIPT_EXPR_${ne}__-->`),E=j(E,T,B,(ne)=>`<!--__STX_STYLE_${ne}__-->`);let G=F?nc(E):[],J=new Set(mr(_));if(E=Fn(E,(ne,re,se)=>{let ie=re.trim();if(Ar(ie,J))return ne;if(G.length>0&&vy(G,se,ie))return ne;if(H.has(ie))return ne;let ae=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined"],ue=/^([a-zA-Z_$][a-zA-Z0-9_$]*)/,me=ie.match(ue)?.[1],ve=me&&((me in _)||ae.includes(me)),$e=Boolean(me&&V.has(me)),_e=/^([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/,Re=ie.match(_e),Ee=Re&&!ae.includes(Re[1])&&!(Re[1]in _);if(/^__[A-Z_]+__$/.test(ie))return"";let Ae;try{let Te=x(re,_,!1,(Pe)=>{Ae=Pe});if($e)return ne;if(F&&!md(ie,_))return ne;if(Ae)Ha(Ae,ne,k,v);if(_.__stx_buildMode==="compile"&&!F&&(Te===void 0||wy(ie,_)))return mo("expr",ie);if(Te===void 0||Te===null)return"";let ke=String(Te);return Ba(La(E,se),ke,St(ke))}catch(Te){if($e)return ne;if(F&&!md(ie,_))return ne;if(Ee)return ne;let ke=Te instanceof Error?Te.message:String(Te);return g("Expression",`Error evaluating: {{ ${ie} }}: ${ke}`,k,v,se,ne)}}),z.length>0)E=E.replace(/<!--__STX_SCRIPT_EXPR_(\d+)__-->/g,(ne,re)=>z[Number(re)]??ne);if(B.length>0)E=E.replace(/<!--__STX_STYLE_(\d+)__-->/g,(ne,re)=>B[Number(re)]??ne);return E}function sc(v,_,k){if(!_.trim())return v;let E=v,T=_.trim();while(T.length>0){let j=T.match(/^(\w+)/);if(!j)break;let B=j[1];T=T.substring(B.length).trim();let z=vi[B]||Bn[B];if(!z)throw Error(`Filter not found: ${B}. Available filters: ${Object.keys(ec()).join(", ")}`);let F=[];if(T.startsWith(":")){let V=T.match(/^:([^|\s]+)/);if(V){let H=V[1].trim();try{let G=Number(H);F=[Number.isNaN(G)?H:G]}catch{F=[H]}T=T.substring(V[0].length).trim()}}else if(T.startsWith("(")){let V=1,H=1;while(V>0&&H<T.length){if(T[H]==="(")V++;if(T[H]===")")V--;H++}if(V===0){let G=T.substring(1,H-1).trim();if(G)try{if(G.startsWith("{")&&G.endsWith("}"))F=[x(`(${G})`,k,!0)];else{let J=[],ne="",re=null,se=0,ie=0,ae=0,ue=!1;for(let oe=0;oe<G.length;oe++){let me=G[oe];if(ue){ne+=me,ue=!1;continue}if(me==="\\"){ne+=me,ue=!0;continue}if(re){if(ne+=me,me===re)re=null;continue}if(me==='"'||me==="'"||me==="`"){re=me,ne+=me;continue}if(me==="(")se++;else if(me===")")se--;else if(me==="[")ie++;else if(me==="]")ie--;else if(me==="{")ae++;else if(me==="}")ae--;if(me===","&&se===0&&ie===0&&ae===0){J.push(ne),ne="";continue}ne+=me}if(ne)J.push(ne);F=J.map((oe)=>{let me=oe.trim();return x(me,k,!0)})}}catch{F=[G]}T=T.substring(H).trim()}}try{E=z(E,k,...F)}catch(V){let H=V instanceof Error?V.message:String(V);throw Error(`Error applying filter '${B}': ${H}`)}if(T.startsWith("|"))T=T.substring(1).trim();else break}return E}function Sy(v){let _=!1,k="",E=0,T=0,j=0,B=!1;for(let z=0;z<v.length;z++){let F=v[z],V=v[z+1];if(_&&B){B=!1;continue}if(_&&F==="\\"){B=!0;continue}if(B=!1,(F==='"'||F==="'"||F==="`")&&!B){if(!_)_=!0,k=F;else if(F===k)_=!1,k="";continue}if(_&&k==="`"&&F==="$"&&V==="{"){let H=1;z+=2;while(z<v.length&&H>0){if(v[z]==="{")H++;else if(v[z]==="}")H--;if(H>0)z++}continue}if(_)continue;if(F==="(")E++;else if(F===")")E--;else if(F==="[")T++;else if(F==="]")T--;else if(F==="{")j++;else if(F==="}")j--;if(F==="|"&&E===0&&T===0&&j===0){if(V==="|"){z++;continue}if(V==="="){z++;continue}return z}}return-1}var xi=new Set,$y=1000;function Dd(){xi.clear()}function Ha(v,_,k,E){if(!O())return;let T=`${k}\x00${v.expression}`;if(xi.has(T))return;if(xi.size>=$y)xi.clear();xi.add(T);let j=k,B=E;try{if(k&&pd.existsSync(k))B=pd.readFileSync(k,"utf8")}catch{}let z=B.indexOf(_);if(z>=0)j=`${k}:${B.slice(0,z).split(`
857
+ `).length}`;console.warn(`${j}: stx warning: ${_} rendered as an empty string. The safe evaluator rejected \`${v.expression}\` (${v.rule}). Compute the value in <script server> and interpolate the variable instead.`)}function x(v,_,k=!1,E){try{let T=v.trim(),j=Sy(T);if(j>0){let z=T.substring(0,j).trim(),F=T.substring(j+1).trim(),V=x(z,_,!0,E);return sc(V,F,_)}let B=bn(T);if(B!==null){E?.({expression:T,rule:B});return}try{let z=Object.keys(_),F=Object.values(_);return l(T,z)(...F)}catch{return c(T,_)}}catch(T){if(T instanceof ReferenceError){let j=/(\b\w+)\s+is not defined/.exec(T.message);if(j){let B=j[1],z=_y(B,Object.keys(_));if(z&&z!==B)T.message=`${T.message} \u2014 did you mean '${z}'?`}}if(!k)console.error(`Error evaluating expression: ${v}`,T);throw T}}function _y(v,_){let k=null;for(let T of _){if(T===v)continue;let j=ky(v,T);if(k===null||j<k.dist)k={key:T,dist:j}}if(!k)return null;let E=Math.max(v.length,k.key.length);if(k.dist<=2||k.dist/E<=0.35)return k.key;return null}function ky(v,_){if(v===_)return 0;if(v.length===0)return _.length;if(_.length===0)return v.length;let[k,E]=v.length<_.length?[v,_]:[_,v],T=Array(k.length+1),j=Array(k.length+1);for(let B=0;B<=k.length;B++)T[B]=B;for(let B=1;B<=E.length;B++){j[0]=B;for(let z=1;z<=k.length;z++){let F=k[z-1]===E[B-1]?0:1;j[z]=Math.min(j[z-1]+1,T[z]+1,T[z-1]+F)}for(let z=0;z<=k.length;z++)T[z]=j[z]}return T[k.length]}function Od(v){if(!v)return"";return v.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#039;/g,"'").replace(/&#39;/g,"'").replace(/&amp;/g,"&")}import Zw from"fs";import Yt from"path";import Ni from"fs";import Ot from"path";import{hasLocalConfig as hf}from"bunfig";import Dn from"fs";import Ir from"path";import qa from"fs";import bd from"path";import{fileURLToPath as Ey}from"url";var Ka;function Ne(){if(Ka)return Ka;let v="unknown";try{v=String(JSON.parse(qa.readFileSync(new URL("../package.json",import.meta.url),"utf8")).version)}catch{}if(import.meta.url.endsWith(".ts"))try{let _=bd.dirname(Ey(import.meta.url)),k=0;for(let E of qa.readdirSync(_,{recursive:!0,withFileTypes:!0}))if(E.isFile()&&E.name.endsWith(".ts"))k=Math.max(k,qa.statSync(bd.join(E.parentPath,E.name)).mtimeMs);v+=`+src.${Math.trunc(k)}`}catch{}return Ka=v,v}var oc=new Map,Pr=new Map;async function Md(v){let k;for(let E=0;E<3;E++)try{let j=(await Dn.promises.stat(v)).mtime.getTime(),B=Pr.get(v);if(B&&B.mtime===j)return B.content;let z=await Bun.file(v).text(),V=(await Dn.promises.stat(v)).mtime.getTime();if(V!==j)continue;return Pr.set(v,{content:z,mtime:V}),z}catch(T){k=T;break}throw Pr.delete(v),Error(`File not found: ${v}${k?` (${k.message})`:""}`)}function Nd(v){Pr.delete(v)}function Ld(v){for(let _ of Pr.keys())if(_.startsWith(v))Pr.delete(_)}var vo=null,Cy=null,wd=null;function jd(v){wd=v}async function ic(v=!1){let _=wd??await import("./chunk-zvg1nqgw.js");if(v)return _.generateSignalsRuntimeDev();if(vo===null)vo=_.generateSignalsRuntime();return vo}var wo=null;async function ac(){if(wo===null){let{getRouterScript:v}=await import("./chunk-9c86wgnk.js");wo=v()}return wo}var vd={};async function Bd(v,_=!1){let k=v==="runtime"?await ic(_):await ac(),E=v==="runtime"&&_?"runtime-debug":v,T=vd[E];if(!T||T.content!==k)T={content:k,hash:Bun.hash(k).toString(16).padStart(16,"0").slice(0,16)},vd[E]=T;return{content:k,hash:T.hash,url:`/_stx/${v}.${T.hash}.js`}}var Ry=500,Tr=new Map;function Sd(v){return a(process.cwd(),"module-bundles",`${v}.js`)}function Fd(v){let _=Bun.hash(v).toString(16).padStart(16,"0").slice(0,16),k=Tr.has(_);if(k)Tr.delete(_);Tr.set(_,v);while(Tr.size>Ry)Tr.delete(Tr.keys().next().value);if(!k)try{let E=Sd(_);if(!Dn.existsSync(E))Dn.mkdirSync(Ir.dirname(E),{recursive:!0}),Dn.writeFileSync(E,v)}catch{}return`/_stx/modules.${_}.js`}function Ko(v){if(!/^[0-9a-f]{16}$/.test(v))return;let _=Tr.get(v);if(_!==void 0)return _;try{return Dn.readFileSync(Sd(v),"utf8")}catch{return}}function zd(){Pr.clear(),ee(),Hu(),vo=null,Cy=null,wo=null}function $d(v){let _={debug:v.debug===!0,middleware:(v.middleware??[]).map((k)=>({name:k.name,timing:k.timing,handler:String(k.handler)})),customDirectives:(v.customDirectives??[]).map((k)=>({name:k.name,hasEndTag:k.hasEndTag===!0,rawParams:k.rawParams===!0,handler:String(k.handler)}))};return new Bun.CryptoHasher("sha1").update(JSON.stringify(_)).digest("hex")}async function nn(v,_){try{if(!_.cachePath)return null;let k=Ir.resolve(_.cachePath),E=Ir.join(k,`${zn(v)}.html`),T=Ir.join(k,`${zn(v)}.meta.json`);if(!await r(E)||!await r(T))return null;let j=await Bun.file(T).text(),B=JSON.parse(j);if(B.cacheVersion!==_.cacheVersion)return null;if(B.engine!==Ne())return null;if(B.optionsSignature!==$d(_))return null;if((await Dn.promises.stat(v)).mtime.getTime()>B.mtime)return null;for(let F of B.dependencies)if(await r(F)){if((await Dn.promises.stat(F)).mtime.getTime()>B.mtime)return null}else return null;return await Bun.file(E).text()}catch(k){return console.warn(`Cache error for ${v}:`,k),null}}async function rn(v,_,k,E){try{if(!E.cachePath)return;let T=Ir.resolve(E.cachePath);await Dn.promises.mkdir(T,{recursive:!0});let j=Ir.join(T,`${zn(v)}.html`),B=Ir.join(T,`${zn(v)}.meta.json`),z=await Dn.promises.stat(v);await Bun.write(j,_);let F={sourcePath:v,mtime:z.mtime.getTime(),dependencies:Array.from(k),cacheVersion:E.cacheVersion,engine:Ne(),optionsSignature:$d(E),generatedAt:Date.now()};await Bun.write(B,JSON.stringify(F,null,2)),oc.set(v,{output:_,mtime:z.mtime.getTime(),dependencies:k})}catch(T){console.warn(`Failed to cache template ${v}:`,T)}}var Ay=16;function zn(v){return new Bun.CryptoHasher("sha1").update(v).digest("hex").substring(0,Ay)}var Hn={fg:{light:"neutral-900",dark:"neutral-100",description:"Primary text"},"fg-strong":{light:"neutral-700",dark:"neutral-300",description:"Labels, secondary headings"},"fg-muted":{light:"neutral-600",dark:"neutral-400",description:"Supporting text"},"fg-soft":{light:"neutral-500",dark:"neutral-400",description:"De-emphasised text"},"fg-subtle":{light:"neutral-400",dark:"neutral-500",description:"Recessive, non-essential text"},surface:{light:"neutral-50",dark:"neutral-800",description:"Page and panel background"},"surface-raised":{light:"neutral-100",dark:"neutral-700",description:"Cards, popovers"},"surface-sunken":{light:"neutral-200",dark:"neutral-700",description:"Wells, track backgrounds"},panel:{light:"white",dark:"neutral-800",description:"Card, menu, dialog surface"},field:{light:"white",dark:"neutral-700",description:"Form control surface"},page:{light:"neutral-50",dark:"neutral-900",description:"Page background, behind panels"},content:{light:"white",dark:"neutral-900",description:"Content area under a chrome header - a table or list body"},"surface-hover":{light:"neutral-100",dark:"neutral-700",description:"Row or item highlight on a page or panel"},"surface-raised-hover":{light:"neutral-200",dark:"neutral-600",description:"Raised surface, hovered"},"surface-sunken-hover":{light:"neutral-300",dark:"neutral-600",description:"Sunken surface, hovered"},"field-hover":{light:"neutral-50",dark:"neutral-600",description:"Form control surface, hovered"},link:{light:"blue-500",dark:"blue-400",description:"Hyperlink"},"link-hover":{light:"blue-600",dark:"blue-300",description:"Hyperlink, hovered"},inverse:{light:"neutral-900",dark:"neutral-700",description:"Tooltip bubble, inverted surface"},"inverse-ink":{light:"white",dark:"white",description:"Text on an inverted surface"},line:{light:"neutral-200",dark:"neutral-700",description:"Default border, divider"},"line-strong":{light:"neutral-300",dark:"neutral-600",description:"Input border, focus ring track"},"line-hover":{light:"neutral-400",dark:"neutral-500",description:"Border of a hovered control"},accent:{light:"blue-600",dark:"blue-400",description:"Primary action, selected state"},info:{light:"cyan-600",dark:"cyan-400",description:"Informational emphasis"},danger:{light:"red-600",dark:"red-400",description:"Errors, destructive actions"},success:{light:"green-600",dark:"green-400",description:"Confirmation"},warning:{light:"yellow-600",dark:"yellow-400",description:"Caution"},"accent-solid":{light:"blue-500",dark:"blue-600",description:"Primary button fill"},"info-solid":{light:"cyan-500",dark:"cyan-600",description:"Informational fill"},"danger-solid":{light:"red-500",dark:"red-600",description:"Destructive button fill"},"success-solid":{light:"green-500",dark:"green-600",description:"Confirmation fill"},"warning-solid":{light:"yellow-500",dark:"yellow-600",description:"Caution fill"},"accent-solid-hover":{light:"blue-600",dark:"blue-700",description:"Primary button fill, hovered"},"info-solid-hover":{light:"cyan-600",dark:"cyan-700",description:"Informational fill, hovered"},"danger-solid-hover":{light:"red-600",dark:"red-700",description:"Destructive fill, hovered"},"success-solid-hover":{light:"green-600",dark:"green-700",description:"Confirmation fill, hovered"},"warning-solid-hover":{light:"yellow-600",dark:"yellow-700",description:"Caution fill, hovered"},"accent-ink":{light:"white",dark:"white",description:"Text on a primary fill"},"info-ink":{light:"neutral-900",dark:"neutral-900",description:"Text on an informational fill"},"danger-ink":{light:"white",dark:"white",description:"Text on a destructive fill"},"success-ink":{light:"neutral-900",dark:"neutral-900",description:"Text on a confirmation fill"},"warning-ink":{light:"neutral-900",dark:"neutral-900",description:"Text on a caution fill"},"accent-soft":{light:"blue-100",dark:"blue-900",description:"Tinted primary fill"},"accent-soft-ink":{light:"blue-800",dark:"blue-200",description:"Text on a tinted primary fill"},"info-soft":{light:"cyan-100",dark:"cyan-900",description:"Tinted informational fill"},"info-soft-ink":{light:"cyan-800",dark:"cyan-200",description:"Text on a tinted informational fill"},"danger-soft":{light:"red-100",dark:"red-900",description:"Tinted destructive fill"},"danger-soft-ink":{light:"red-800",dark:"red-200",description:"Text on a tinted destructive fill"},"success-soft":{light:"green-100",dark:"green-900",description:"Tinted confirmation fill"},"success-soft-ink":{light:"green-800",dark:"green-200",description:"Text on a tinted confirmation fill"},"warning-soft":{light:"yellow-100",dark:"yellow-900",description:"Tinted caution fill"},"warning-soft-ink":{light:"yellow-800",dark:"yellow-200",description:"Text on a tinted caution fill"},secondary:{light:"purple-600",dark:"purple-400",description:"Secondary emphasis"},"secondary-solid":{light:"purple-500",dark:"purple-600",description:"Secondary fill"},"secondary-solid-hover":{light:"purple-600",dark:"purple-700",description:"Secondary fill, hovered"},"secondary-ink":{light:"white",dark:"white",description:"Text on a secondary fill"},"secondary-soft":{light:"purple-100",dark:"purple-900",description:"Tinted secondary fill"},"secondary-soft-ink":{light:"purple-800",dark:"purple-200",description:"Text on a tinted secondary fill"},"danger-fg":{light:"red-900",dark:"red-300",description:"Text in a field with an error"},"danger-fg-subtle":{light:"red-300",dark:"red-500",description:"Recessive text in a field with an error"},"danger-line":{light:"red-300",dark:"red-600",description:"Border of a field with an error"},"danger-focus":{light:"red-500",dark:"red-400",description:"Focus ring of a field with an error"}};function Xa(v){return`--stx-${v}`}function Ga(v,_){let k=_.lastIndexOf("-");if(k===-1)return typeof v[_]==="string"?v[_]:void 0;let E=v[_.slice(0,k)];if(!E||typeof E!=="object")return;let T=E[_.slice(k+1)];return typeof T==="string"?T:void 0}function _d(v){let _={};for(let[k,E]of Object.entries(Hn)){let T=Ga(v,E.light);if(T===void 0)continue;_[k]=`var(${Xa(k)}, ${T})`}return _}function kd(v){let _=[],k=[];for(let[E,T]of Object.entries(Hn)){let j=Ga(v,T.light),B=Ga(v,T.dark);if(j===void 0)continue;if(_.push(` ${Xa(E)}: ${j};`),B!==void 0)k.push(` ${Xa(E)}: ${B};`)}if(_.length===0)return"";return["/* stx role tokens \u2014 override any of these to re-theme by meaning. */",":root {",..._,"}",".dark {",...k,"}",""].join(`
858
858
  `)}var Ed={control:{value:"0.375rem",description:"Buttons, inputs, selects \u2014 rounded-md"},panel:{value:"0.5rem",description:"Cards, dialogs, menus \u2014 rounded-lg"},pill:{value:"9999px",description:"Chips and badges, which are pill-shaped by intent"}};function Cd(v){return`--stx-radius-${v}`}function Td(){let v={};for(let[_,k]of Object.entries(Ed))v[_]=`var(${Cd(_)}, ${k.value})`;return v}function Qd(){return["/* stx shape tokens \u2014 a radius by what the thing is. */",":root {",...Object.entries(Ed).map(([v,_])=>` ${Cd(v)}: ${_.value};`),"}",""].join(`
859
859
  `)}var ef={"control-px":{value:"1rem",description:"Inline padding of a md text control \u2014 px-4"},"control-py":{value:"0.5rem",description:"Block padding of a md text control \u2014 py-2"},"control-text":{value:"1rem",description:"Font size of a md text control \u2014 text-base"},"control-leading":{value:"1.5rem",description:"Line height of a md text control \u2014 text-base"},"cell-px":{value:"1.5rem",description:"Inline padding of every table cell, header or body \u2014 px-6"},"cell-py":{value:"1rem",description:"Block padding of a body cell \u2014 py-4"},"cell-text":{value:"0.875rem",description:"Font size of a body cell \u2014 text-sm"},"cell-leading":{value:"1.25rem",description:"Line height of a body cell \u2014 text-sm"},"cell-head-py":{value:"0.75rem",description:"Block padding of a header cell \u2014 py-3"},"cell-head-text":{value:"0.75rem",description:"Font size of a header cell \u2014 text-xs"},"cell-head-leading":{value:"1rem",description:"Line height of a header cell \u2014 text-xs"}},Ty={"control-x":"control-px","control-y":"control-py","cell-x":"cell-px","cell-y":"cell-py","cell-head-y":"cell-head-py"},Iy={control:{size:"control-text",leading:"control-leading"},cell:{size:"cell-text",leading:"cell-leading"},"cell-head":{size:"cell-head-text",leading:"cell-head-leading"}};function tf(v){return`--stx-${v}`}function Ja(v){let _=ef[v];if(!_)throw Error(`[stx] unknown density token "${v}"`);return`var(${tf(v)}, ${_.value})`}function nf(){let v={};for(let[_,k]of Object.entries(Ty))v[_]=Ja(k);return v}function rf(){let v={};for(let[_,{size:k,leading:E}]of Object.entries(Iy))v[_]=[Ja(k),{lineHeight:Ja(E)}];return v}function sf(){return["/* stx density tokens \u2014 how much room a control or a table cell takes. */",":root {",...Object.entries(ef).map(([v,_])=>` ${tf(v)}: ${_.value};`),"}",""].join(`
860
860
  `)}function of(v){return typeof v==="object"&&v!==null&&!Array.isArray(v)}function Ya(v,_){let k={...v};for(let[E,T]of Object.entries(_))k[E]=of(T)&&of(k[E])?Ya(k[E],T):T;return k}function af(v,_){if(!_.fonts)return"";let k=new v({..._.config,fonts:_.fonts,cssVariables:!1}).toCSS(!1,_.minify);return k&&!_.minify?`${k}
861
- `:k}function cf(v={},_={}){let k=v.theme||{},E=_.theme||{},{extend:T,...j}=E,{extend:B,...z}=k,F=z.colors||{};z.colors={...F,..._d(F)};let V=z.borderRadius||{};z.borderRadius={...V,...Td()};let H=z.spacing||{};z.spacing={...H,...nf()};let G=z.fontSize||{};z.fontSize={...G,...rf()};let J=Ya(z,j),ne=Ya(B||{},T||{});if(Object.keys(ne).length>0)J.extend=ne;let re=[...v.safelist||[],..._.safelist||[]],se={...v.shortcuts||{},..._.shortcuts||{}},ie=[...v.preflights||[],..._.preflights||[]],{fonts:ae,...ue}=v,{fonts:oe,...me}=_,we=oe??ae;return{config:{...ue,...me,theme:J,safelist:re,shortcuts:se,...ie.length>0?{preflights:ie}:{},content:[],output:""},safelist:re,shortcuts:se,includePreflight:_.preflight!==!1,minify:_.minify===!0,tokenCSS:kd(F)+Qd()+sf(),...we?{fonts:we}:{}}}function lf(v,_=""){let k=`${v}${_}`,E=0;for(let T=0;T<k.length;T++){let j=k.charCodeAt(T);E=(E<<5)-E+j,E=E&E}return`stx-${Math.abs(E).toString(36)}`}function uf(v,_,k={}){let{prefix:E="",preserveHost:T=!0,scopeKeyframes:j=!0,scopeCustomProperties:B=!1}=k;if(!v.trim())return"";let z=jc(v),F=[],V=new Map;if(j)for(let H of z){let G=H.selector.match(/@keyframes\s+([a-z_-][a-z0-9_-]*)/i);if(G){let J=G[1],ne=`${_}_${J}`;V.set(J,ne)}}for(let H of z){let G=df(H,_,E,T,V,B);F.push(G)}return F.join(`
861
+ `:k}function cf(v={},_={}){let k=v.theme||{},E=_.theme||{},{extend:T,...j}=E,{extend:B,...z}=k,F=z.colors||{};z.colors={...F,..._d(F)};let V=z.borderRadius||{};z.borderRadius={...V,...Td()};let H=z.spacing||{};z.spacing={...H,...nf()};let G=z.fontSize||{};z.fontSize={...G,...rf()};let J=Ya(z,j),ne=Ya(B||{},T||{});if(Object.keys(ne).length>0)J.extend=ne;let re=[...v.safelist||[],..._.safelist||[]],se={...v.shortcuts||{},..._.shortcuts||{}},ie=[...v.preflights||[],..._.preflights||[]],{fonts:ae,...ue}=v,{fonts:oe,...me}=_,ve=oe??ae;return{config:{...ue,...me,theme:J,safelist:re,shortcuts:se,...ie.length>0?{preflights:ie}:{},content:[],output:""},safelist:re,shortcuts:se,includePreflight:_.preflight!==!1,minify:_.minify===!0,tokenCSS:kd(F)+Qd()+sf(),...ve?{fonts:ve}:{}}}function lf(v,_=""){let k=`${v}${_}`,E=0;for(let T=0;T<k.length;T++){let j=k.charCodeAt(T);E=(E<<5)-E+j,E=E&E}return`stx-${Math.abs(E).toString(36)}`}function uf(v,_,k={}){let{prefix:E="",preserveHost:T=!0,scopeKeyframes:j=!0,scopeCustomProperties:B=!1}=k;if(!v.trim())return"";let z=jc(v),F=[],V=new Map;if(j)for(let H of z){let G=H.selector.match(/@keyframes\s+([a-z_-][a-z0-9_-]*)/i);if(G){let J=G[1],ne=`${_}_${J}`;V.set(J,ne)}}for(let H of z){let G=df(H,_,E,T,V,B);F.push(G)}return F.join(`
862
862
 
863
863
  `)}function jc(v){let _=[],k=v.replace(/\/\*[\s\S]*?\*\//g,""),E=0,T="",j=!1,B="";for(let z=0;z<k.length;z++){let F=k[z];if(F==="@"&&E===0)j=!0;if(F==="{")E++;else if(F==="}"){if(E--,E===0){if(j){B+=F;let V=B.match(/@([a-z-]+)\s*([^{]*)\{([\s\S]*)\}/i);if(V){let[,H,G,J]=V;if(H==="keyframes")_.push({selector:`@keyframes ${G.trim()}`,declarations:J.trim()});else if(H==="media"||H==="supports"||H==="container"){let ne=jc(J);_.push({selector:`@${H} ${G.trim()}`,declarations:ne.map((re)=>`${re.selector} { ${re.declarations} }`).join(`
864
864
  `)})}else _.push({selector:`@${H} ${G.trim()}`,declarations:J.trim()})}B="",j=!1}else if(T.trim()){T+=F;let V=T.match(/([^{]+)\{([^}]*)\}/);if(V)_.push({selector:V[1].trim(),declarations:V[2].trim()});T=""}continue}}if(j)B+=F;else T+=F}return _}function df(v,_,k,E,T,j){let{selector:B,declarations:z}=v;if(B.startsWith("@")){if(B.startsWith("@keyframes")){let H=B.replace("@keyframes ","").trim();return`@keyframes ${T.get(H)||H} { ${z} }`}if(B.startsWith("@media")||B.startsWith("@supports")||B.startsWith("@container")){let G=jc(`x { ${z} }`.replace(/x \{ /,"").replace(/ \}$/,"")).map((J)=>df(J,_,k,E,T,j)).join(`
865
865
  `);return`${B} {
866
866
  ${G}
867
- }`}return`${B} { ${z} }`}let F=Py(B,_,k,E),V=z;for(let[H,G]of T)V=V.replace(new RegExp(`\\b${H}\\b`,"g"),G);if(j)V=V.replace(/--([a-z-]+)/gi,`--${_}-$1`);return`${F} { ${V} }`}function Py(v,_,k,E){let T=v.split(",").map((B)=>B.trim()),j=[];for(let B of T){if(B.startsWith(":host")){if(E)j.push(B);else{let V=B.replace(/:host(\([^)]*\))?/,`.${_}$1`);j.push(V)}continue}if(B.includes("::slotted")){j.push(B);continue}if(B===":root"){j.push(`:root .${_}`);continue}let z=k?`${k} .${_}`:`.${_}`;j.push(`${z} ${B}`);let F=Dy(B,_);if(F)j.push(k?`${k} ${F}`:F)}return j.join(", ")}function Dy(v,_){let k=0,E=v.length;for(let F=0;F<v.length;F++){let V=v[F];if(V==="["||V==="(")k++;else if(V==="]"||V===")")k--;else if(k===0&&(V===" "||V===">"||V==="+"||V==="~")){E=F;break}}let T=v.slice(0,E),j=v.slice(E);if(!T)return"";let B=T.length,z=0;for(let F=0;F<T.length;F++){let V=T[F];if(V==="["||V==="(")z++;else if(V==="]"||V===")")z--;else if(k===0&&z===0&&V===":"){B=F;break}}return`${T.slice(0,B)}.${_}${T.slice(B)}${j}`}var gf=String.raw`(?<![\w-])scoped(?![\w-])`,Lc=/<style\s+([^>]*)>/gi,ff=/<style\s+([^>]*)>([\s\S]*?)<\/style>/gi,mf=new RegExp(gf,"i"),Oy=new RegExp(gf,"gi"),Bc=/<style\b[^>]*\bdata-stx-scoped(?:=(?:"[^"]*"|'[^']*'|[^\s>]+))?[^>]*>[\s\S]*?<\/style>\s*/gi;function My(v){Lc.lastIndex=0;let _=Lc.exec(v);while(_!==null){if(mf.test(_[1]))return!0;_=Lc.exec(v)}return!1}function zc(v){let _=new Set,k=[];Bc.lastIndex=0;let E=Bc.exec(v);while(E!==null){let T=E[0].trim();if(_.has(T))k.push({start:E.index,end:E.index+E[0].length});else _.add(T);E=Bc.exec(v)}return k}function ki(v){let _=zc(v);if(_.length===0)return v;let k=Array(_.length+1),E=0;for(let T=0;T<_.length;T++){let j=_[T];k[T]=v.slice(E,j.start),E=j.end}return k[_.length]=v.slice(E),k.join("")}function So(v,_){if(!My(v))return{html:v,hasScoped:!1};let k=lf(_),E=`data-v-${k}`,T=v,j=!1;if(ff.lastIndex=0,T=T.replace(ff,(B,z,F)=>{if(!mf.test(z))return B;j=!0;let V=Ny(F,E),H=z.replace(Oy,"").trim(),G=H?` ${H}`:"";return`<style data-stx-scoped="${k}"${G}>${V}</style>`}),!j)return{html:v,hasScoped:!1};return T=Ly(T,E),{html:T,hasScoped:!0}}function Ny(v,_){return uf(v,"__SCOPE_PLACEHOLDER__",{preserveHost:!1}).replace(/\.(__SCOPE_PLACEHOLDER__) /g,`[${_}] `).replace(/\.(__SCOPE_PLACEHOLDER__)/g,`[${_}]`)}var jy=(v)=>`\x00stx-scope-mask-${v}\x00`,pf=/\u0000stx-scope-mask-(\d+)\u0000/g;function Ly(v,_){let k=Pn(v,(T,j)=>{let B=Y(T,j);return B>j?B:Ss(T,j)},(T,j)=>jy(j)),E=By(k.output,_);return pf.lastIndex=0,E.replace(pf,(T,j)=>k.tokens[Number(j)])}function By(v,_){let k=new Set(["script","style","template","html","head","body","meta","link","title","base","!doctype","!DOCTYPE"]);return v.replace(/<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*)?\/?>/g,(E,T,j)=>{if(k.has(T.toLowerCase()))return E;if(E.includes(_))return E;if(T.toLowerCase()==="style"||T.toLowerCase()==="script")return E;if(j)return E.replace(`<${T}${j}`,`<${T} ${_}${j}`);if(E.endsWith("/>"))return`<${T} ${_} />`;return`<${T} ${_}>`})}var e={reset:"\x1B[0m",bright:"\x1B[1m",dim:"\x1B[2m",underscore:"\x1B[4m",blink:"\x1B[5m",reverse:"\x1B[7m",hidden:"\x1B[8m",black:"\x1B[30m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m",white:"\x1B[37m",gray:"\x1B[90m",bgBlack:"\x1B[40m",bgRed:"\x1B[41m",bgGreen:"\x1B[42m",bgYellow:"\x1B[43m",bgBlue:"\x1B[44m",bgMagenta:"\x1B[45m",bgCyan:"\x1B[46m",bgWhite:"\x1B[47m",bgGray:"\x1B[100m"};var On=null,$o="";function yf(v){try{let _=v.startsWith("file:")?new URL(v).pathname:v;$o=`${_}@${Math.trunc(Ni.statSync(_).mtimeMs)}`}catch{$o=v}}var Fc=!1,Dr=null,Ai="",js=!1,vf=256,hr=new Map,Mn=new Map,_o=null,wf=null,ko=new Map;function Eo(v){return Bun.hash(v).toString(16).padStart(16,"0").slice(0,16)}function Wc(v,_){if(hr.has(v))hr.delete(v);else if(hr.size>=vf)hr.delete(hr.keys().next().value);hr.set(v,_)}function zy(v){let _=Eo(v);if(Mn.has(_))Mn.delete(_);else if(Mn.size>=vf)Mn.delete(Mn.keys().next().value);return Mn.set(_,v),_}function Hd(v){let _=Mn.get(v);if(_===void 0)return;return Mn.delete(v),Mn.set(v,_),_}async function Wy(v,_=_o){if(!_)return null;try{let k=Bun.file(Ot.join(_,`cw-${Eo(v)}.css`));if(!await k.exists())return null;return await k.text()}catch{return null}}async function Fy(v,_,k=_o){if(!k)return;try{if(!Ni.existsSync(k))Ni.mkdirSync(k,{recursive:!0});await Bun.write(Ot.join(k,`cw-${Eo(v)}.css`),_)}catch{}}async function xf(v){try{let _=await import(v);if(_&&_.CSSGenerator)return{CSSGenerator:_.CSSGenerator,config:_.config,build:_.build,defaultConfig:_.defaultConfig,extractClasses:_.extractClasses}}catch{}return null}var Vy=[["@stacksjs","ts-css","dist","engine","index.js"],["@stacksjs","ts-css","src","engine","index.ts"]],Uy=["@stacksjs/ts-css/engine","@stacksjs/ts-css/dist/engine/index.js"];function Hy(){let v=[],_=process.cwd();while(_!==Ot.dirname(_)){for(let k of["node_modules","pantry"])for(let E of Vy)v.push(Ot.join(_,k,...E));_=Ot.dirname(_)}return v}function qy(){let v=[],_=process.env.HOME||process.env.USERPROFILE||"",k=[_&&Ot.join(_,"Code","Tools","ts-css"),_&&Ot.join(_,"Code","Tools","crosswind"),_&&Ot.join(_,"repos","stacks-org","ts-css"),_&&Ot.join(_,"repos","stacks-org","crosswind"),Ot.join(process.cwd(),"..","ts-css"),Ot.join(process.cwd(),"..","crosswind")].filter(Boolean);for(let E of k)v.push(Ot.join(E,"packages","toolkit","dist","engine","index.js")),v.push(Ot.join(E,"packages","toolkit","src","engine","index.ts"));if(_)v.push(Ot.join(_,"Code","Tools","stx","node_modules","@stacksjs","ts-css","dist","engine","index.js"));return v}async function Xo(){if(Fc)return On;Fc=!0;try{let v=async(T)=>{for(let j of T){if(!await Bun.file(j).exists())continue;let B=await xf(j);if(B){if(yf(j),!process.env.STACKS_DEV_QUIET)console.log(`${e.green}[ts-css]${e.reset} CSS engine loaded from ${Ot.dirname(Ot.dirname(j))}`);return B}}return null};if(process.env.CROSSWIND_SRC){let T=Ot.resolve(process.env.CROSSWIND_SRC),j=await v([T]);if(!j)throw Error(`CROSSWIND_SRC did not resolve to a Css module: ${T}`);return On=j,On}let _=await v(Hy());if(_)return On=_,On;let k=Uy;for(let T of k){let j=await xf(T);if(j){On=j;try{yf(import.meta.resolve(T))}catch{$o=T}if(!process.env.STACKS_DEV_QUIET)console.log(`${e.green}[ts-css]${e.reset} CSS engine loaded`);return On}}let E=await v(qy());if(E)return On=E,On;throw Error("Css CSSGenerator not found in any location")}catch{return console.warn(`${e.yellow}[ts-css] CSS engine not available, Tailwind styles will not be generated${e.reset}`),console.warn(`${e.yellow}Run 'bun add @stacksjs/ts-css' to enable CSS generation${e.reset}`),null}}function Vd(){Vc.clear(),On=null,Fc=!1,Dr=null,Ai="",hr.clear(),Mn.clear(),wf=null,ko.clear()}var bf=!1;async function Go(v){try{let _=hf({name:"css",cwd:v})?"css":hf({name:"crosswind",cwd:v})?"crosswind":null;if(!_)return null;if(_==="crosswind"&&!process.env.STACKS_DEV_QUIET&&!bf)bf=!0,console.warn(`${e.yellow}[ts-css]${e.reset} Reading the CSS config from a \`crosswind\` file. Rename it to \`css\` (e.g. config/css.ts) \u2014 the old name is deprecated.`);let{loadConfigWithResult:k}=await import("bunfig"),E=await k({name:_,cwd:v,defaultConfig:{},checkEnv:!1,verbose:!1});if(!E?.path||!E.config||Object.keys(E.config).length===0)return null;let T=Ot.relative(v,E.path);if(!process.env.STACKS_DEV_QUIET)console.log(`${e.green}[ts-css]${e.reset} Loaded config from ${T||E.path}`);return E.config}catch(_){if(_ instanceof Error&&_.name==="ConfigNotFoundError")return null;return console.warn(`${e.yellow}[ts-css]${e.reset} Failed to load css config:`,_ instanceof Error?_.message:_),null}}async function cc(v){let _=null;try{let{loadStxConfig:k}=await import("./chunk-q5jc8hmg.js"),E=await k(v);if(E.css)if(typeof E.css==="string"){let T=Ot.isAbsolute(E.css)?E.css:Ot.resolve(v,E.css);if(await Bun.file(T).exists()){let j=await import(T);_=j.default||j,console.log(`${e.green}[ts-css]${e.reset} Loaded config from stx.config.ts \u2192 ${E.css}`)}}else{if(_={...E.css,content:E.css.content||[],preflight:E.css.preflight??!0,minify:E.css.minify??!1},E.css.config){let T=Ot.isAbsolute(E.css.config)?E.css.config:Ot.resolve(v,E.css.config);if(await Bun.file(T).exists()){let j=await import(T);_={...j.default||j,..._}}}console.log(`${e.green}[ts-css]${e.reset} Using inline CSS config from stx.config.ts`)}}catch{}return _||await Go(v)}function lc(v){try{let _=new WeakSet;return Eo(JSON.stringify(v??{},(k,E)=>{if(typeof E==="function")return`[fn]${String(E)}`;if(typeof E==="object"&&E!==null){if(_.has(E))return"[circular]";_.add(E)}return E})??"")}catch{return"unhashable"}}async function kt(v){if(js)return Ai;js=!0;try{let _=await Xo();if(!_||!_.build)return js=!1,"";if(!Dr)Dr=await Go(v);if(!Dr)return js=!1,"";let k=_.defaultConfig?.theme||{},E=Dr.theme||{},T={..._.defaultConfig,...Dr,theme:{...k,...E,extend:{...k.extend||{},...E.extend||{}}}},j=performance.now(),B=await _.build(T),z=performance.now()-j;if(Ai=B.css,console.log(`${e.cyan}[ts-css]${e.reset} Built ${B.classes.size} classes in ${z.toFixed(1)}ms`),T.output){let F=Ot.isAbsolute(T.output)?T.output:Ot.join(v,T.output),V=Ot.dirname(F);if(!Ni.existsSync(V))Ni.mkdirSync(V,{recursive:!0});await Bun.write(F,B.css)}return js=!1,B.css}catch(_){return console.error(`${e.red}[ts-css]${e.reset} Build error:`,_),js=!1,Ai}}async function sn(v){Dr=null,await kt(v)}function Ud(){return Ai}function dc(v){let _=new Set,k=/class\s*=\s*["']([^"']+)["']/gi,E=k.exec(v);while(E!==null){for(let B of E[1].split(/\s+/))if(B.trim())_.add(B.trim());E=k.exec(v)}let T=/(?:x-class|:class)\s*=\s*"([^"]+)"/gi,j=T.exec(v);while(j!==null){let B=j[1].match(/'([^']+)'/g);if(B){for(let z of B)for(let F of z.slice(1,-1).split(/\s+/))if(F.trim())_.add(F.trim())}j=T.exec(v)}return _}var Vc=m(64);async function uc(v,_){let k=()=>ko.get(_?Ot.resolve(_):process.cwd())?.fingerprint??null,E=Vc.get(h(v,_,k()));if(E!==void 0)return E;let T=await Ky(v,_);if(T)Vc.set(h(v,_,k()),T);return T}function pc(v){let _=[];for(let k of v.matchAll(/\/_stx\/modules\.([0-9a-f]{16})\.js/g)){let E=Ko(k[1]);if(E)_.push(E)}return _.length?`${v}
867
+ }`}return`${B} { ${z} }`}let F=Py(B,_,k,E),V=z;for(let[H,G]of T)V=V.replace(new RegExp(`\\b${H}\\b`,"g"),G);if(j)V=V.replace(/--([a-z-]+)/gi,`--${_}-$1`);return`${F} { ${V} }`}function Py(v,_,k,E){let T=v.split(",").map((B)=>B.trim()),j=[];for(let B of T){if(B.startsWith(":host")){if(E)j.push(B);else{let V=B.replace(/:host(\([^)]*\))?/,`.${_}$1`);j.push(V)}continue}if(B.includes("::slotted")){j.push(B);continue}if(B===":root"){j.push(`:root .${_}`);continue}let z=k?`${k} .${_}`:`.${_}`;j.push(`${z} ${B}`);let F=Dy(B,_);if(F)j.push(k?`${k} ${F}`:F)}return j.join(", ")}function Dy(v,_){let k=0,E=v.length;for(let F=0;F<v.length;F++){let V=v[F];if(V==="["||V==="(")k++;else if(V==="]"||V===")")k--;else if(k===0&&(V===" "||V===">"||V==="+"||V==="~")){E=F;break}}let T=v.slice(0,E),j=v.slice(E);if(!T)return"";let B=T.length,z=0;for(let F=0;F<T.length;F++){let V=T[F];if(V==="["||V==="(")z++;else if(V==="]"||V===")")z--;else if(k===0&&z===0&&V===":"){B=F;break}}return`${T.slice(0,B)}.${_}${T.slice(B)}${j}`}var gf=String.raw`(?<![\w-])scoped(?![\w-])`,Lc=/<style\s+([^>]*)>/gi,ff=/<style\s+([^>]*)>([\s\S]*?)<\/style>/gi,mf=new RegExp(gf,"i"),Oy=new RegExp(gf,"gi"),Bc=/<style\b[^>]*\bdata-stx-scoped(?:=(?:"[^"]*"|'[^']*'|[^\s>]+))?[^>]*>[\s\S]*?<\/style>\s*/gi;function My(v){Lc.lastIndex=0;let _=Lc.exec(v);while(_!==null){if(mf.test(_[1]))return!0;_=Lc.exec(v)}return!1}function zc(v){let _=new Set,k=[];Bc.lastIndex=0;let E=Bc.exec(v);while(E!==null){let T=E[0].trim();if(_.has(T))k.push({start:E.index,end:E.index+E[0].length});else _.add(T);E=Bc.exec(v)}return k}function ki(v){let _=zc(v);if(_.length===0)return v;let k=Array(_.length+1),E=0;for(let T=0;T<_.length;T++){let j=_[T];k[T]=v.slice(E,j.start),E=j.end}return k[_.length]=v.slice(E),k.join("")}function So(v,_){if(!My(v))return{html:v,hasScoped:!1};let k=lf(_),E=`data-v-${k}`,T=v,j=!1;if(ff.lastIndex=0,T=T.replace(ff,(B,z,F)=>{if(!mf.test(z))return B;j=!0;let V=Ny(F,E),H=z.replace(Oy,"").trim(),G=H?` ${H}`:"";return`<style data-stx-scoped="${k}"${G}>${V}</style>`}),!j)return{html:v,hasScoped:!1};return T=Ly(T,E),{html:T,hasScoped:!0}}function Ny(v,_){return uf(v,"__SCOPE_PLACEHOLDER__",{preserveHost:!1}).replace(/\.(__SCOPE_PLACEHOLDER__) /g,`[${_}] `).replace(/\.(__SCOPE_PLACEHOLDER__)/g,`[${_}]`)}var jy=(v)=>`\x00stx-scope-mask-${v}\x00`,pf=/\u0000stx-scope-mask-(\d+)\u0000/g;function Ly(v,_){let k=Pn(v,(T,j)=>{let B=Y(T,j);return B>j?B:Ss(T,j)},(T,j)=>jy(j)),E=By(k.output,_);return pf.lastIndex=0,E.replace(pf,(T,j)=>k.tokens[Number(j)])}function By(v,_){let k=new Set(["script","style","template","html","head","body","meta","link","title","base","!doctype","!DOCTYPE"]);return v.replace(/<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*)?\/?>/g,(E,T,j)=>{if(k.has(T.toLowerCase()))return E;if(E.includes(_))return E;if(T.toLowerCase()==="style"||T.toLowerCase()==="script")return E;if(j)return E.replace(`<${T}${j}`,`<${T} ${_}${j}`);if(E.endsWith("/>"))return`<${T} ${_} />`;return`<${T} ${_}>`})}var e={reset:"\x1B[0m",bright:"\x1B[1m",dim:"\x1B[2m",underscore:"\x1B[4m",blink:"\x1B[5m",reverse:"\x1B[7m",hidden:"\x1B[8m",black:"\x1B[30m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m",white:"\x1B[37m",gray:"\x1B[90m",bgBlack:"\x1B[40m",bgRed:"\x1B[41m",bgGreen:"\x1B[42m",bgYellow:"\x1B[43m",bgBlue:"\x1B[44m",bgMagenta:"\x1B[45m",bgCyan:"\x1B[46m",bgWhite:"\x1B[47m",bgGray:"\x1B[100m"};var On=null,$o="";function yf(v){try{let _=v.startsWith("file:")?new URL(v).pathname:v;$o=`${_}@${Math.trunc(Ni.statSync(_).mtimeMs)}`}catch{$o=v}}var Fc=!1,Dr=null,Ai="",js=!1,vf=256,hr=new Map,Mn=new Map,_o=null,wf=null,ko=new Map;function Eo(v){return Bun.hash(v).toString(16).padStart(16,"0").slice(0,16)}function Wc(v,_){if(hr.has(v))hr.delete(v);else if(hr.size>=vf)hr.delete(hr.keys().next().value);hr.set(v,_)}function zy(v){let _=Eo(v);if(Mn.has(_))Mn.delete(_);else if(Mn.size>=vf)Mn.delete(Mn.keys().next().value);return Mn.set(_,v),_}function Hd(v){let _=Mn.get(v);if(_===void 0)return;return Mn.delete(v),Mn.set(v,_),_}async function Wy(v,_=_o){if(!_)return null;try{let k=Bun.file(Ot.join(_,`cw-${Eo(v)}.css`));if(!await k.exists())return null;return await k.text()}catch{return null}}async function Fy(v,_,k=_o){if(!k)return;try{if(!Ni.existsSync(k))Ni.mkdirSync(k,{recursive:!0});await Bun.write(Ot.join(k,`cw-${Eo(v)}.css`),_)}catch{}}async function xf(v){try{let _=await import(v);if(_&&_.CSSGenerator)return{CSSGenerator:_.CSSGenerator,config:_.config,build:_.build,defaultConfig:_.defaultConfig,extractClasses:_.extractClasses}}catch{}return null}var Vy=[["@stacksjs","ts-css","dist","engine","index.js"],["@stacksjs","ts-css","src","engine","index.ts"]],Uy=["@stacksjs/ts-css/engine","@stacksjs/ts-css/dist/engine/index.js"];function Hy(){let v=[],_=process.cwd();while(_!==Ot.dirname(_)){for(let k of["node_modules","pantry"])for(let E of Vy)v.push(Ot.join(_,k,...E));_=Ot.dirname(_)}return v}function qy(){let v=[],_=process.env.HOME||process.env.USERPROFILE||"",k=[_&&Ot.join(_,"Code","Tools","ts-css"),_&&Ot.join(_,"Code","Tools","crosswind"),_&&Ot.join(_,"repos","stacks-org","ts-css"),_&&Ot.join(_,"repos","stacks-org","crosswind"),Ot.join(process.cwd(),"..","ts-css"),Ot.join(process.cwd(),"..","crosswind")].filter(Boolean);for(let E of k)v.push(Ot.join(E,"packages","toolkit","dist","engine","index.js")),v.push(Ot.join(E,"packages","toolkit","src","engine","index.ts"));if(_)v.push(Ot.join(_,"Code","Tools","stx","node_modules","@stacksjs","ts-css","dist","engine","index.js"));return v}async function Xo(){if(Fc)return On;Fc=!0;try{let v=async(T)=>{for(let j of T){if(!await Bun.file(j).exists())continue;let B=await xf(j);if(B){if(yf(j),!process.env.STACKS_DEV_QUIET)console.log(`${e.green}[ts-css]${e.reset} CSS engine loaded from ${Ot.dirname(Ot.dirname(j))}`);return B}}return null};if(process.env.CROSSWIND_SRC){let T=Ot.resolve(process.env.CROSSWIND_SRC),j=await v([T]);if(!j)throw Error(`CROSSWIND_SRC did not resolve to a Css module: ${T}`);return On=j,On}let _=await v(Hy());if(_)return On=_,On;let k=Uy;for(let T of k){let j=await xf(T);if(j){On=j;try{yf(import.meta.resolve(T))}catch{$o=T}if(!process.env.STACKS_DEV_QUIET)console.log(`${e.green}[ts-css]${e.reset} CSS engine loaded`);return On}}let E=await v(qy());if(E)return On=E,On;throw Error("Css CSSGenerator not found in any location")}catch{return console.warn(`${e.yellow}[ts-css] CSS engine not available, Tailwind styles will not be generated${e.reset}`),console.warn(`${e.yellow}Run 'bun add @stacksjs/ts-css' to enable CSS generation${e.reset}`),null}}function Vd(){Vc.clear(),On=null,Fc=!1,Dr=null,Ai="",hr.clear(),Mn.clear(),wf=null,ko.clear()}var bf=!1;async function Go(v){try{let _=hf({name:"css",cwd:v})?"css":hf({name:"crosswind",cwd:v})?"crosswind":null;if(!_)return null;if(_==="crosswind"&&!process.env.STACKS_DEV_QUIET&&!bf)bf=!0,console.warn(`${e.yellow}[ts-css]${e.reset} Reading the CSS config from a \`crosswind\` file. Rename it to \`css\` (e.g. config/css.ts) \u2014 the old name is deprecated.`);let{loadConfigWithResult:k}=await import("bunfig"),E=await k({name:_,cwd:v,defaultConfig:{},checkEnv:!1,verbose:!1});if(!E?.path||!E.config||Object.keys(E.config).length===0)return null;let T=Ot.relative(v,E.path);if(!process.env.STACKS_DEV_QUIET)console.log(`${e.green}[ts-css]${e.reset} Loaded config from ${T||E.path}`);return E.config}catch(_){if(_ instanceof Error&&_.name==="ConfigNotFoundError")return null;return console.warn(`${e.yellow}[ts-css]${e.reset} Failed to load css config:`,_ instanceof Error?_.message:_),null}}async function cc(v){let _=null;try{let{loadStxConfig:k}=await import("./chunk-x4xxfpn7.js"),E=await k(v);if(E.css)if(typeof E.css==="string"){let T=Ot.isAbsolute(E.css)?E.css:Ot.resolve(v,E.css);if(await Bun.file(T).exists()){let j=await import(T);_=j.default||j,console.log(`${e.green}[ts-css]${e.reset} Loaded config from stx.config.ts \u2192 ${E.css}`)}}else{if(_={...E.css,content:E.css.content||[],preflight:E.css.preflight??!0,minify:E.css.minify??!1},E.css.config){let T=Ot.isAbsolute(E.css.config)?E.css.config:Ot.resolve(v,E.css.config);if(await Bun.file(T).exists()){let j=await import(T);_={...j.default||j,..._}}}console.log(`${e.green}[ts-css]${e.reset} Using inline CSS config from stx.config.ts`)}}catch{}return _||await Go(v)}function lc(v){try{let _=new WeakSet;return Eo(JSON.stringify(v??{},(k,E)=>{if(typeof E==="function")return`[fn]${String(E)}`;if(typeof E==="object"&&E!==null){if(_.has(E))return"[circular]";_.add(E)}return E})??"")}catch{return"unhashable"}}async function kt(v){if(js)return Ai;js=!0;try{let _=await Xo();if(!_||!_.build)return js=!1,"";if(!Dr)Dr=await Go(v);if(!Dr)return js=!1,"";let k=_.defaultConfig?.theme||{},E=Dr.theme||{},T={..._.defaultConfig,...Dr,theme:{...k,...E,extend:{...k.extend||{},...E.extend||{}}}},j=performance.now(),B=await _.build(T),z=performance.now()-j;if(Ai=B.css,console.log(`${e.cyan}[ts-css]${e.reset} Built ${B.classes.size} classes in ${z.toFixed(1)}ms`),T.output){let F=Ot.isAbsolute(T.output)?T.output:Ot.join(v,T.output),V=Ot.dirname(F);if(!Ni.existsSync(V))Ni.mkdirSync(V,{recursive:!0});await Bun.write(F,B.css)}return js=!1,B.css}catch(_){return console.error(`${e.red}[ts-css]${e.reset} Build error:`,_),js=!1,Ai}}async function sn(v){Dr=null,await kt(v)}function Ud(){return Ai}function dc(v){let _=new Set,k=/class\s*=\s*["']([^"']+)["']/gi,E=k.exec(v);while(E!==null){for(let B of E[1].split(/\s+/))if(B.trim())_.add(B.trim());E=k.exec(v)}let T=/(?:x-class|:class)\s*=\s*"([^"]+)"/gi,j=T.exec(v);while(j!==null){let B=j[1].match(/'([^']+)'/g);if(B){for(let z of B)for(let F of z.slice(1,-1).split(/\s+/))if(F.trim())_.add(F.trim())}j=T.exec(v)}return _}var Vc=m(64);async function uc(v,_){let k=()=>ko.get(_?Ot.resolve(_):process.cwd())?.fingerprint??null,E=Vc.get(h(v,_,k()));if(E!==void 0)return E;let T=await Ky(v,_);if(T)Vc.set(h(v,_,k()),T);return T}function pc(v){let _=[];for(let k of v.matchAll(/\/_stx\/modules\.([0-9a-f]{16})\.js/g)){let E=Ko(k[1]);if(E)_.push(E)}return _.length?`${v}
868
868
  ${_.join(`
869
- `)}`:v}async function Ky(v,_){try{let k=await Xo();if(!k)return"";let E=pc(v),T=typeof k.extractClasses==="function"?k.extractClasses(E):dc(E);if(T.size===0)return"";let j=_?Ot.resolve(_):process.cwd(),B=a(j,"cache");if(!_o)_o=B;let z=ko.get(j);if(!z){let Ee=await cc(j);z={config:Ee,fingerprint:lc(Ee)},ko.set(j,z),wf=z.fingerprint}let F=[...T].sort().join(" "),V=`${$o}::${z.fingerprint||"default"}::${F}`,H=hr.get(V);if(H!==void 0)return Wc(V,H),H;let G=await Wy(V,B);if(G!==null)return Wc(V,G),G;let J=k.defaultConfig||k.config,ne=z.config||{},re=cf(J,ne),{safelist:se,includePreflight:ie,minify:ae,tokenCSS:ue}=re,oe=re.config,me=new k.CSSGenerator(oe),we=oe.shortcuts||ne.shortcuts||{},$e=Object.keys(we).filter((Ee)=>T.has(Ee)||se.includes(Ee));for(let Ee of se)if(!we[Ee])me.generate(Ee);for(let Ee of T)if(!we[Ee])me.generate(Ee);let _e="";if($e.length>0){let Ee=new k.CSSGenerator(oe);for(let Ae of $e)Ee.generate(Ae);if(_e=Ee.toCSS(!1,ae),_e&&!_e.endsWith(`
869
+ `)}`:v}async function Ky(v,_){try{let k=await Xo();if(!k)return"";let E=pc(v),T=typeof k.extractClasses==="function"?k.extractClasses(E):dc(E);if(T.size===0)return"";let j=_?Ot.resolve(_):process.cwd(),B=a(j,"cache");if(!_o)_o=B;let z=ko.get(j);if(!z){let Ee=await cc(j);z={config:Ee,fingerprint:lc(Ee)},ko.set(j,z),wf=z.fingerprint}let F=[...T].sort().join(" "),V=`${$o}::${z.fingerprint||"default"}::${F}`,H=hr.get(V);if(H!==void 0)return Wc(V,H),H;let G=await Wy(V,B);if(G!==null)return Wc(V,G),G;let J=k.defaultConfig||k.config,ne=z.config||{},re=cf(J,ne),{safelist:se,includePreflight:ie,minify:ae,tokenCSS:ue}=re,oe=re.config,me=new k.CSSGenerator(oe),ve=oe.shortcuts||ne.shortcuts||{},$e=Object.keys(ve).filter((Ee)=>T.has(Ee)||se.includes(Ee));for(let Ee of se)if(!ve[Ee])me.generate(Ee);for(let Ee of T)if(!ve[Ee])me.generate(Ee);let _e="";if($e.length>0){let Ee=new k.CSSGenerator(oe);for(let Ae of $e)Ee.generate(Ae);if(_e=Ee.toCSS(!1,ae),_e&&!_e.endsWith(`
870
870
  `))_e+=`
871
871
  `}let Re=_e+me.toCSS(ie,ae);return Re=af(k.CSSGenerator,re)+ue+Re,Wc(V,Re),Fy(V,Re,B),Re}catch(k){return console.warn("Failed to generate Css CSS:",k),""}}async function f(v,_,k=!1,E=!1){let T=await uc(v,_);if(!T)return E?ki(v):v;let j=k?`<link data-css="generated" rel="stylesheet" href="/_stx/css.${zy(T)}.css">`:`<style data-css="generated">
872
872
  ${T}
@@ -1224,7 +1224,7 @@ else {
1224
1224
 
1225
1225
  console.log('[stx] Lifecycle runtime initialized');
1226
1226
  })();
1227
- `}function Hc(v){return Symbol(v)}var r_=Hc("theme"),s_=Hc("router"),i_=Hc("i18n");import*as Tf from"crypto";function Af(v){let _=/\$(\w+)\./g,k=[],E;while((E=_.exec(v))!==null)if(!k.includes(E[1]))k.push(E[1]);return k}function Gy(){return`stx-${Tf.randomBytes(4).toString("hex")}`}function Jy(v){return/\$\w+\./.test(v)}function Yy(v){if(!v.includes("{{")||!/\$\w+\./.test(v))return{html:v,bindings:[],stores:new Set};let _=[],k=new Set,E=/<(\w+)([^>]*?)(\s*\/?>)/g,T=v;return T=T.replace(E,(j,B,z,F)=>{if(["script","style","template"].includes(B.toLowerCase()))return j;let V=[],H=!1,G=z,J=/(\w+(?:-\w+)*)\s*=\s*"([^"]*\{\{[^}]*\$\w+[^}]*\}\}[^"]*)"/g,ne=[...z.matchAll(J)];for(let ie of ne){let ae=ie[0],ue=ie[1],oe=ie[2];if(Jy(oe)){H=!0;let me=oe.match(/\{\{\s*([\s\S]+?)\s*\}\}/);if(me){let we=me[1];if(V.push({attr:ue,expr:we,fullMatch:ae,originalAttr:ue}),Af(we).forEach((_e)=>k.add(_e)),ue==="text")G=G.replace(ae,"");else if(ue==="class")G=G.replace(ae,'class=""');else if(ue==="disabled"||ue==="hidden")G=G.replace(ae,"");else G=G.replace(ae,`${ue}=""`)}}}if(!H)return j;let re=G.match(/\bid\s*=\s*"([^"]+)"/),se;if(re)se=re[1];else se=Gy(),G=` id="${se}"${G}`;for(let ie of V)_.push({elementId:se,attribute:ie.attr,expression:ie.expr,stores:Af(ie.expr)});return`<${B}${G}${F}`}),{html:T,bindings:_,stores:k}}function Qy(v,_){if(v.length===0)return"";let k=Array.from(_),E=`
1227
+ `}function Hc(v){return Symbol(v)}var r_=Hc("theme"),s_=Hc("router"),i_=Hc("i18n");import*as Tf from"crypto";function Af(v){let _=/\$(\w+)\./g,k=[],E;while((E=_.exec(v))!==null)if(!k.includes(E[1]))k.push(E[1]);return k}function Gy(){return`stx-${Tf.randomBytes(4).toString("hex")}`}function Jy(v){return/\$\w+\./.test(v)}function Yy(v){if(!v.includes("{{")||!/\$\w+\./.test(v))return{html:v,bindings:[],stores:new Set};let _=[],k=new Set,E=/<(\w+)([^>]*?)(\s*\/?>)/g,T=v;return T=T.replace(E,(j,B,z,F)=>{if(["script","style","template"].includes(B.toLowerCase()))return j;let V=[],H=!1,G=z,J=/(\w+(?:-\w+)*)\s*=\s*"([^"]*\{\{[^}]*\$\w+[^}]*\}\}[^"]*)"/g,ne=[...z.matchAll(J)];for(let ie of ne){let ae=ie[0],ue=ie[1],oe=ie[2];if(Jy(oe)){H=!0;let me=oe.match(/\{\{\s*([\s\S]+?)\s*\}\}/);if(me){let ve=me[1];if(V.push({attr:ue,expr:ve,fullMatch:ae,originalAttr:ue}),Af(ve).forEach((_e)=>k.add(_e)),ue==="text")G=G.replace(ae,"");else if(ue==="class")G=G.replace(ae,'class=""');else if(ue==="disabled"||ue==="hidden")G=G.replace(ae,"");else G=G.replace(ae,`${ue}=""`)}}}if(!H)return j;let re=G.match(/\bid\s*=\s*"([^"]+)"/),se;if(re)se=re[1];else se=Gy(),G=` id="${se}"${G}`;for(let ie of V)_.push({elementId:se,attribute:ie.attr,expression:ie.expr,stores:Af(ie.expr)});return`<${B}${G}${F}`}),{html:T,bindings:_,stores:k}}function Qy(v,_){if(v.length===0)return"";let k=Array.from(_),E=`
1228
1228
  <script>
1229
1229
  (function() {
1230
1230
  'use strict';
@@ -1704,10 +1704,10 @@ window.__stx_reactive = (function() {
1704
1704
  ${hx()}
1705
1705
  ${k}
1706
1706
  </script>`}function jf(v,_,k){if(!bx(v))return v;let E=fx(v);if(E.length===0)return v;let T=xx(v,E),j=yx(E,_),B=T.lastIndexOf("</body>");if(B!==-1)T=T.slice(0,B)+j+`
1707
- `+T.slice(B);else T+=j;return T}function xx(v,_){let k=0,E=v.replace(/<([a-z][a-z0-9-]*)(\s+[^>]*x-data\s*=\s*(?:"[^"]*"|'[^']*')[^>]*)>/gi,(T,j,B)=>{let z=_[k++];if(!z)return T;let F=/data-stx-scope="([^"]*)"/.exec(B);if(F)return z.id=F[1],z.selector=`[data-stx-scope="${z.id}"]`,T;return`<${j} data-stx-scope="${z.id}"${B}>`});return E=E.replace(/\s*x-data\s*=\s*"([^"]*)"/g,' data-stx-xdata="$1"'),E=E.replace(/\s*x-data\s*=\s*'([^']*)'/g," data-stx-xdata='$1'"),E=E.replace(/\s*x-init\s*=\s*"([^"]*)"/g,' data-stx-xinit="$1"'),E=E.replace(/\s*x-init\s*=\s*'([^']*)'/g," data-stx-xinit='$1'"),E}function bx(v){return/x-data\s*=\s*["']/.test(v)}function yr(v,_){try{let k=v.trim();if(p(k))return l(k,Object.keys(_))(...Object.values(_));else return c(k,_)}catch{return!1}}function xr(v,_){let k=vx(v,_);return k.ok?{expression:k.expression,endPos:k.endPos}:null}function vx(v,_){let k=_;while(k<v.length&&/\s/.test(v[k]))k++;if(v[k]!=="(")return{ok:!1,reason:"missing-open-paren",pos:k};let E=S(v,"(",")",k);if(E===-1)return{ok:!1,reason:"unclosed-paren",pos:k};return{ok:!0,expression:v.slice(k+1,E),endPos:E+1}}function wx(v,_){let k=v.lastIndexOf("<",_);if(k===-1)return!1;return k>v.lastIndexOf(">",_)}function Or(v,_,k,E){let T=1,j=E,B=new RegExp(`@${_}\\s*\\(`,"g"),z=new RegExp(`@${k}(?![a-z])`,"g");while(j<v.length&&T>0){B.lastIndex=j,z.lastIndex=j;let F=B.exec(v),V=z.exec(v),H=F?F.index:1/0,G=V?V.index:1/0;if(H<G)T++,j=H+F[0].length;else if(G<1/0){if(T--,T===0)return G;j=G+V[0].length}else break}return-1}function Lf(v,_){let k=v.slice(_).match(/^@if\s*/);if(!k)return null;let E=_+k[0].length,T=xr(v,E);if(!T)return null;let j=T.endPos,B=Or(v,"if","endif",j);if(B===-1)return null;let z=v.slice(j,B),F=[],V=0,H="if",G=T.expression,J=0,ne=0;while(V<z.length){let re=z.indexOf("@",V);if(re===-1)break;V=re;let se=z.substring(re);if(wx(z,re)){V++;continue}if(/^@if\s*\(/.test(se)){ne++,V++;continue}if(/^@endif(?![a-z])/.test(se)){ne--,V+=6;continue}if(ne===0){let ie=se.match(/^@elseif\s*/);if(ie){F.push({type:H,condition:G,content:z.substring(J,V),start:j+J,end:j+V});let ae=V+ie[0].length,ue=xr(z,ae);if(!ue){V++;continue}H="elseif",G=ue.expression,V=ue.endPos,J=V;continue}else if(/^@else(?![a-z])/.test(se)){F.push({type:H,condition:G,content:z.substring(J,V),start:j+J,end:j+V}),H="else",G=void 0,V+=5,J=V;continue}}V++}return F.push({type:H,condition:G,content:z.slice(J),start:j+J,end:j+z.length}),{fullMatch:v.slice(_,B+6),branches:F,start:_,end:B+6}}function Bi(v){let _=[],k=/@if\s*\(/g,E=k.exec(v);while(E!==null){if(_.some((B)=>E.index>B.start&&E.index<B.end)){E=k.exec(v);continue}let j=Lf(v,E.index);if(j)_.push(j),k.lastIndex=j.end;E=k.exec(v)}return _}function Ro(v,_,k){let E=[],T=new RegExp(`@${_}\\s*\\(`,"g"),j=T.exec(v);while(j!==null){if(E.some((se)=>j.index>se.start&&j.index<se.end)){j=T.exec(v);continue}let z=j.index,F=z+j[0].length-1,V=S(v,"(",")",F);if(V===-1){j=T.exec(v);continue}let H=v.slice(F+1,V),G=V+1,J=Or(v,_,k,G);if(J===-1){j=T.exec(v);continue}let ne=v.slice(G,J),re=J+`@${k}`.length;E.push({fullMatch:v.slice(z,re),name:_,params:H,content:ne,start:z,end:re}),T.lastIndex=re,j=T.exec(v)}return E}function Xc(v,_){let k=v.slice(_).match(/^@switch\s*/);if(!k)return null;let E=_+k[0].length,T=xr(v,E);if(!T)return null;let j=T.endPos,B=Or(v,"switch","endswitch",j);if(B===-1)return null;let z=v.slice(j,B),F=[],V=0,H=null,G=0;while(V<z.length){let J=z.slice(V),ne=J.match(/^@switch\s*\(/),re=J.match(/^@endswitch(?![a-z])/);if(ne){if(G++,H)H.content+=ne[0];V+=ne[0].length;continue}if(re){if(G--,H)H.content+=re[0];V+=re[0].length;continue}if(G>0){if(H)H.content+=z[V];V++;continue}let se=J.match(/^@case\s*/),ie=J.match(/^@default(?![a-z])/),ae=J.match(/^@break(?![a-z])/);if(se&&J.startsWith("@case")){if(H)F.push(H);let ue=V+se[0].length,oe=xr(z,ue);if(!oe){V++;continue}H={type:"case",value:oe.expression,content:""},V=oe.endPos}else if(ie&&J.startsWith("@default")){if(H)F.push(H);H={type:"default",content:""},V+=ie[0].length}else if(ae&&J.startsWith("@break"))V+=ae[0].length;else{if(H)H.content+=z[V];V++}}if(H)F.push(H);return{fullMatch:v.slice(_,B+10),expression:T.expression,cases:F,start:_,end:B+10}}function kx(v,_,k){let E=v,T=!0;while(T){T=!1;let j=E.match(/@switch\s*\(/);if(!j||j.index===void 0)break;let B=j.index,z=Xc(E,B);if(!z)break;try{let F;if(p(z.expression))F=l(z.expression,Object.keys(_))(...Object.values(_));else F=c(z.expression,_);let V="",H=!1;for(let G of z.cases)if(G.type==="default"){if(!H)V=G.content.trim()}else try{let J;if(G.value&&p(G.value))J=l(G.value,Object.keys(_))(...Object.values(_));else if(G.value)J=c(G.value,_);if(F===J){V=G.content.trim(),H=!0;break}}catch{continue}E=E.substring(0,B)+V+E.substring(z.end),T=!0}catch(F){let V=F instanceof Error?F.message:String(F),H=i("Switch",`Error evaluating @switch expression: ${V}`,t.EVALUATION_ERROR);E=E.substring(0,B)+H+E.substring(z.end);break}}return E}function Ex(v){let _=[];return{masked:v.replace(/<script\b[\s\S]*?<\/script\s*>/gi,(E)=>(_.push(E),`\x00stx-script-${_.length-1}\x00`)),scripts:_}}function Cx(v,_){if(_.length===0)return v;return v.replace(/\u0000stx-script-(\d+)\u0000/g,(k,E)=>_[Number(E)]??k)}function lr(v,_,k){let{masked:E,scripts:T}=Ex(v);return Cx(Rx(E,_,k),T)}function Rx(v,_,k){let E=v;E=kx(E,_,k);{let j=!0;while(j){j=!1;let B=E.match(/@unless\s*\(/);if(!B||B.index===void 0)break;let z=B.index,F=xr(E,z+7);if(!F)break;let V=F.endPos,H=Or(E,"unless","endunless",V);if(H===-1){console.warn(`[stx] @unless directive at position ${z} has no matching @endunless \u2014 the block was skipped. Check for typos or missing closers.`);break}let G=E.slice(V,H),J=F.expression,ne=-1;{let se=0,ie=/@(?:if|unless)\s*\(/g,ae=/@(?:endif|endunless)(?![a-z])/g,ue=/@else(?![a-z])/g,oe=[],me;while((me=ie.exec(G))!==null)oe.push({pos:me.index,type:"open"});while((me=ae.exec(G))!==null)oe.push({pos:me.index,type:"close"});while((me=ue.exec(G))!==null)oe.push({pos:me.index,type:"else"});oe.sort((we,$e)=>we.pos-$e.pos);for(let we of oe)if(we.type==="open")se++;else if(we.type==="close")se--;else if(we.type==="else"&&se===0){ne=we.pos;break}}let re;if(ne!==-1){let se=G.slice(0,ne),ie=G.slice(ne+5);re=`@if (${J})${ie}@else ${se}@endif`}else re=`@if (!(${J}))${G}@endif`;E=E.substring(0,z)+re+E.substring(H+10),j=!0}}E=Gc(E,_,k),E=Jc(E,_,k),E=Zc(E,_);let T=()=>{let j=Bi(E);if(j.length===0)return!1;let B=Array(j.length);for(let V=j.length-1;V>=0;V--){let H=j[V];try{let G="",J=!1;for(let ne of H.branches){if(J)break;if(ne.type==="else")G=ne.content,J=!0;else try{let re;if(ne.condition&&p(ne.condition))re=l(ne.condition,Object.keys(_))(...Object.values(_));else if(ne.condition)re=c(ne.condition,_);if(re)G=ne.content,J=!0}catch(re){G=i(ne.type==="if"?"If":"Elseif",`Error in @${ne.type}(${ne.condition}): ${re instanceof Error?re.message:String(re)}`,t.EVALUATION_ERROR),J=!0}}B[V]=G}catch(G){let J=G instanceof Error?G.message:String(G);B[V]=i("If",`Error processing @if block: ${J}`,t.EVALUATION_ERROR)}}let z=Array(j.length*2+1),F=0;for(let V=0;V<j.length;V++){let H=j[V];z[V*2]=E.slice(F,H.start),z[V*2+1]=B[V],F=H.end}return z[j.length*2]=E.slice(F),E=z.join(""),!0};while(!0){let j=E;if(!T())break;if(E===j)break}return E}function Bf(v){let _=0;while(_<v.length&&/\s/.test(v[_]))_++;if(v[_]!=="(")return null;_++;while(_<v.length&&/\s/.test(v[_]))_++;let k=v[_];if(k!=="'"&&k!=='"')return null;_++;let E=[];while(_<v.length){let T=v[_];if(T==="\\"&&_+1<v.length){E.push(v[_+1]),_+=2;continue}if(T===k){_++;break}E.push(T),_++}while(_<v.length&&/\s/.test(v[_]))_++;if(v[_]!==")")return null;return _++,{value:E.join(""),consumed:_}}function Zc(v,_){let k=v;function E(z,F,V,H){let G=1,J=H,ne=new RegExp(`@${F}(?:\\s*\\(|\\s|$)`,"g"),re=new RegExp(`@${V}(?![a-z])`,"g");while(J<z.length&&G>0){ne.lastIndex=J,re.lastIndex=J;let se=ne.exec(z),ie=re.exec(z),ae=se?se.index:1/0,ue=ie?ie.index:1/0;if(ae<ue)G++,J=ae+se[0].length;else if(ue<1/0){if(G--,G===0)return ue;J=ue+ie[0].length}else break}return-1}function T(z,F,V){let H=0,G=new RegExp(`@${F}(?:\\s*\\(|\\s|$)`,"g"),J=new RegExp(`@${V}(?![a-z])`,"g"),ne=/@else(?![a-z])/g,re=[],se;while((se=G.exec(z))!==null)re.push({pos:se.index,type:"open"});while((se=J.exec(z))!==null)re.push({pos:se.index,type:"close"});while((se=ne.exec(z))!==null)re.push({pos:se.index,type:"else"});re.sort((ie,ae)=>ie.pos-ae.pos);for(let ie of re)if(ie.type==="open")H++;else if(ie.type==="close")H--;else if(ie.type==="else"&&H===0)return ie.pos;return-1}{let z=!0;while(z){z=!1;let F=k.match(/@auth(?:\s*\(|\s|(?=\n))/);if(!F||F.index===void 0)break;let V=F.index,H,G,J=k.slice(V+5),ne=Bf(J);if(ne)H=ne.value,G=V+5+ne.consumed;else G=V+5;let re=E(k,"auth","endauth",G);if(re===-1){console.warn(`[stx] @auth directive at position ${V} has no matching @endauth \u2014 the block was skipped.`);break}let se=k.slice(G,re),ie=T(se,"auth","endauth"),ae;if(!_.auth)ae=!1;else ae=H?yr(`auth?.check && auth?.user?.[${H}]`,_):yr("auth?.check",_);let ue;if(ie!==-1){let oe=se.slice(0,ie),me=se.slice(ie+5);ue=ae?oe:me}else ue=ae?se:"";k=k.substring(0,V)+ue+k.substring(re+8),z=!0}}{let z=!0;while(z){z=!1;let F=k.match(/@guest(?:\s*\(|\s|(?=\n))/);if(!F||F.index===void 0)break;let V=F.index,H,G,J=k.slice(V+6),ne=Bf(J);if(ne)H=ne.value,G=V+6+ne.consumed;else G=V+6;let re=E(k,"guest","endguest",G);if(re===-1){console.warn(`[stx] @guest directive at position ${V} has no matching @endguest \u2014 the block was skipped.`);break}let se=k.slice(G,re),ie=T(se,"guest","endguest"),ae;if(!_.auth)ae=!0;else ae=H?yr(`!auth?.check || !auth?.user?.[${H}]`,_):yr("!auth?.check",_);let ue;if(ie!==-1){let oe=se.slice(0,ie),me=se.slice(ie+5);ue=ae?oe:me}else ue=ae?se:"";k=k.substring(0,V)+ue+k.substring(re+9),z=!0}}function j(z,F,V){if(_.userCan&&typeof _.userCan[z]==="boolean")return _.userCan[z];if(_.permissions?.check&&typeof _.permissions.check==="function")try{let H=[z];if(F)H.push(F);if(V){let G=yr(V,_);H.push(G)}return _.permissions.check(...H)}catch{return!1}return!1}function B(z){let F=z.match(/^\s*\(\s*'([^']*)'(?:,\s*'([^']*)')?(?:,\s*([^)]*))?\)/);if(!F)return null;return{ability:F[1],type:F[2],id:F[3]?.trim(),paramsEnd:F[0].length}}for(let z of["can","cannot"]){let F=`end${z}`,V=z==="can"?"elsecan":"elsecannot",H=!0;while(H){H=!1;let G=k.match(new RegExp(`@${z}\\s*\\(`));if(!G||G.index===void 0)break;let J=G.index,ne=k.slice(J+`@${z}`.length),re=B(ne);if(!re)break;let se=J+`@${z}`.length+re.paramsEnd,ie=E(k,z,F,se);if(ie===-1){console.warn(`[stx] @${z} directive at position ${J} has no matching @${F} \u2014 the block was skipped.`);break}let ae=k.slice(se,ie),ue=[],oe=0,me=new RegExp(`@${z}\\s*\\(`,"g"),we=new RegExp(`@${F}(?![a-z])`,"g"),$e=new RegExp(`@${V}\\s*\\(`,"g"),_e=/@else(?![a-z])/g,Re=[],Ee;while((Ee=me.exec(ae))!==null)Re.push({pos:Ee.index,type:"open"});while((Ee=we.exec(ae))!==null)Re.push({pos:Ee.index,type:"close"});while((Ee=$e.exec(ae))!==null)Re.push({pos:Ee.index,type:"elseDirective"});while((Ee=_e.exec(ae))!==null)Re.push({pos:Ee.index,type:"else"});Re.sort((De,Ie)=>De.pos-Ie.pos);for(let De of Re){if(De.type==="open"){oe++;continue}if(De.type==="close"){oe--;continue}if(oe===0)ue.push(De)}let Ae=[],Te=0;for(let De=0;De<ue.length;De++){let Ie=ue[De];if(Ae.push({content:ae.slice(Te,Ie.pos),ability:void 0}),Ie.type==="elseDirective"){let Ye=ae.slice(Ie.pos+`@${V}`.length),at=B(Ye);if(at){Ae[Ae.length-1]={content:ae.slice(Te,Ie.pos)},Te=Ie.pos+`@${V}`.length+at.paramsEnd,Ae.push({content:"",ability:at.ability,type:at.type,id:at.id}),Ae.pop();let dt=ue[De+1],et=dt?dt.pos:ae.length;Ae.push({content:ae.slice(Te,et),ability:at.ability,type:at.type,id:at.id}),Te=et}}else Te=Ie.pos+5}if(Te<ae.length){let De=Ae[Ae.length-1];if(ue.length>0&&ue[ue.length-1].type==="else")Ae.push({content:ae.slice(Te),isFinalElse:!0});else if(Ae.length===0)Ae.push({content:ae.slice(Te)})}let ke=j(re.ability,re.type,re.id),Pe=z==="can"?ke:!ke,Ge="";if(Pe)Ge=Ae[0]?.content||"";else{let De=!1;for(let Ie=1;Ie<Ae.length;Ie++){let Ye=Ae[Ie];if(Ye.isFinalElse){Ge=Ye.content,De=!0;break}if(Ye.ability){let at=j(Ye.ability,Ye.type,Ye.id);if(z==="can"?at:!at){Ge=Ye.content,De=!0;break}}}if(!De&&Ae.length>0){let Ie=Ae[Ae.length-1];if(Ie.isFinalElse)Ge=Ie.content}}k=k.substring(0,J)+Ge+k.substring(ie+`@${F}`.length),H=!0}}return k}function Gc(v,_,k){let E=v;function T(j,B,z,F,V){let H=!0;while(H){H=!1;let G=new RegExp(`@${B}\\s*\\(`),J=j.match(G);if(!J||J.index===void 0)break;let ne=J.index,re=xr(j,ne+`@${B}`.length);if(!re)break;let se=re.endPos,ie=Or(j,B,z,se);if(ie===-1){console.warn(`[stx] @${B} directive at position ${ne} has no matching @${z} \u2014 the block was skipped.`);break}let ae=j.slice(se,ie),ue=re.expression,oe=-1,me=0,we=0;while(we<ae.length){let $e=ae.indexOf("@",we);if($e===-1)break;let _e=ae.substring($e);if(/^@(?:if|unless|isset|empty)\s*\(/.test(_e)){me++,we=$e+1;continue}if(/^@(?:endif|endunless|endisset|endempty)(?![a-z])/.test(_e)){me--,we=$e+1;continue}if(me===0&&/^@else(?![a-z])/.test(_e)){oe=$e;break}we=$e+1}try{let $e=F(ue.trim()),_e;if(oe!==-1){let Re=ae.slice(0,oe),Ee=ae.slice(oe+5);_e=$e?Re:Ee}else _e=$e?ae:"";j=j.substring(0,ne)+_e+j.substring(ie+`@${z}`.length),H=!0}catch($e){let _e=$e instanceof Error?$e.message:String($e),Re=i(V,`Error processing @${B} directive: ${_e}`,t.EVALUATION_ERROR);j=j.substring(0,ne)+Re+j.substring(ie+`@${z}`.length);break}}return j}return E=T(E,"isset","endisset",(j)=>{let B=yr(j,_);return B!==void 0&&B!==null},"Isset"),E=T(E,"empty","endempty",(j)=>{let B=yr(j,_);return B===void 0||B===null||B===""||B===0||B===!1||Array.isArray(B)&&B.length===0||typeof B==="object"&&B!==null&&Object.keys(B).length===0},"Empty"),E}function Jc(v,_,k){let E=v,T="development";function j(B,z,F,V){let H=new RegExp(`@${z}(?![a-z])`,"g"),G=new RegExp(`@${F}(?![a-z])`,"g"),J=new RegExp(`^@${z}(?![a-z])`),ne=new RegExp(`^@${F}(?![a-z])`),re=B,se=!0;while(se){se=!1,H.lastIndex=0;let ie=H.exec(re);if(!ie)break;let ae=ie.index,ue=ae+ie[0].length;if(z==="env"){let ke=re.substring(ue).match(/^\s*\(\s*(['"])([^'"]+)\1\s*\)/);if(!ke)break;ue+=ke[0].length,V=T===ke[2]}let oe=1,me=ue,we=-1;while(oe>0&&me<re.length){H.lastIndex=me,G.lastIndex=me;let ke=H.exec(re),Pe=G.exec(re),Ge=ke?ke.index:1/0,De=Pe?Pe.index:1/0;if(Ge<De)oe++,me=Ge+ke[0].length;else if(De<1/0){if(oe--,oe===0){we=De;break}me=De+Pe[0].length}else break}if(we===-1){console.warn(`[stx] @${z} directive at position ${ae} has no matching @${F} \u2014 the block was skipped.`);break}let $e=re.substring(ue,we),_e=-1,Re=0,Ee=0;while(Ee<$e.length){let ke=$e.indexOf("@",Ee);if(ke===-1)break;let Pe=$e.substring(ke);if(J.test(Pe)){Re++,Ee=ke+1;continue}if(ne.test(Pe)){Re--,Ee=ke+1;continue}if(Re===0&&/^@else(?![a-z])/.test(Pe)){_e=ke;break}Ee=ke+1}let Ae;if(_e!==-1){let ke=$e.slice(0,_e),Pe=$e.slice(_e+5);Ae=V?ke:Pe}else Ae=V?$e:"";let Te=`@${F}`.length;re=re.substring(0,ae)+Ae+re.substring(we+Te),se=!0}return re}return E=j(E,"env","endenv",!1),E=j(E,"production","endproduction",T==="production"),E=j(E,"development","enddevelopment",T==="development"),E=j(E,"staging","endstaging",T==="staging"),E=j(E,"testing","endtesting",T==="testing"),E}var zf=new WeakMap;function Wf(v=16){let _=new Uint8Array(v);return crypto.getRandomValues(_),btoa(String.fromCharCode(..._))}function Ao(v,_){if(!v)return _?.nonceGenerator?.()??Wf();let k=zf.get(v);if(!k)k=_?.nonceGenerator?.()??Wf(),zf.set(v,k);return k}function Ax(v,_){let k=[];for(let[E,T]of Object.entries(v)){if(T===void 0||T===null)continue;if(typeof T==="boolean"){if(T)k.push(E);continue}if(Array.isArray(T)){let j=[...T];if(_&&(E==="script-src"||E==="style-src"))j=j.filter((B)=>!B.startsWith("'nonce-")),j.push(`'nonce-${_}'`);if(j.length>0)k.push(`${E} ${j.join(" ")}`)}}return k.join("; ")}function Ff(v,_){return`<meta http-equiv="Content-Security-Policy" content="${Ax(v,_).replace(/&/g,"&amp;").replace(/"/g,"&quot;")}">`}function Vf(v,_,k){if(!_.enabled||!_.addMetaTag)return v;if(v.includes('http-equiv="Content-Security-Policy"'))return v;if(!v.includes("<head>")&&!v.includes("<head "))return v;let E=_.useNonce?Ao(k,_):void 0,T=Ff(_.directives,E);return v.replace(/<head([^>]*)>/,`<head$1>
1707
+ `+T.slice(B);else T+=j;return T}function xx(v,_){let k=0,E=v.replace(/<([a-z][a-z0-9-]*)(\s+[^>]*x-data\s*=\s*(?:"[^"]*"|'[^']*')[^>]*)>/gi,(T,j,B)=>{let z=_[k++];if(!z)return T;let F=/data-stx-scope="([^"]*)"/.exec(B);if(F)return z.id=F[1],z.selector=`[data-stx-scope="${z.id}"]`,T;return`<${j} data-stx-scope="${z.id}"${B}>`});return E=E.replace(/\s*x-data\s*=\s*"([^"]*)"/g,' data-stx-xdata="$1"'),E=E.replace(/\s*x-data\s*=\s*'([^']*)'/g," data-stx-xdata='$1'"),E=E.replace(/\s*x-init\s*=\s*"([^"]*)"/g,' data-stx-xinit="$1"'),E=E.replace(/\s*x-init\s*=\s*'([^']*)'/g," data-stx-xinit='$1'"),E}function bx(v){return/x-data\s*=\s*["']/.test(v)}function yr(v,_){try{let k=v.trim();if(p(k))return l(k,Object.keys(_))(...Object.values(_));else return c(k,_)}catch{return!1}}function xr(v,_){let k=vx(v,_);return k.ok?{expression:k.expression,endPos:k.endPos}:null}function vx(v,_){let k=_;while(k<v.length&&/\s/.test(v[k]))k++;if(v[k]!=="(")return{ok:!1,reason:"missing-open-paren",pos:k};let E=S(v,"(",")",k);if(E===-1)return{ok:!1,reason:"unclosed-paren",pos:k};return{ok:!0,expression:v.slice(k+1,E),endPos:E+1}}function wx(v,_){let k=v.lastIndexOf("<",_);if(k===-1)return!1;return k>v.lastIndexOf(">",_)}function Or(v,_,k,E){let T=1,j=E,B=new RegExp(`@${_}\\s*\\(`,"g"),z=new RegExp(`@${k}(?![a-z])`,"g");while(j<v.length&&T>0){B.lastIndex=j,z.lastIndex=j;let F=B.exec(v),V=z.exec(v),H=F?F.index:1/0,G=V?V.index:1/0;if(H<G)T++,j=H+F[0].length;else if(G<1/0){if(T--,T===0)return G;j=G+V[0].length}else break}return-1}function Lf(v,_){let k=v.slice(_).match(/^@if\s*/);if(!k)return null;let E=_+k[0].length,T=xr(v,E);if(!T)return null;let j=T.endPos,B=Or(v,"if","endif",j);if(B===-1)return null;let z=v.slice(j,B),F=[],V=0,H="if",G=T.expression,J=0,ne=0;while(V<z.length){let re=z.indexOf("@",V);if(re===-1)break;V=re;let se=z.substring(re);if(wx(z,re)){V++;continue}if(/^@if\s*\(/.test(se)){ne++,V++;continue}if(/^@endif(?![a-z])/.test(se)){ne--,V+=6;continue}if(ne===0){let ie=se.match(/^@elseif\s*/);if(ie){F.push({type:H,condition:G,content:z.substring(J,V),start:j+J,end:j+V});let ae=V+ie[0].length,ue=xr(z,ae);if(!ue){V++;continue}H="elseif",G=ue.expression,V=ue.endPos,J=V;continue}else if(/^@else(?![a-z])/.test(se)){F.push({type:H,condition:G,content:z.substring(J,V),start:j+J,end:j+V}),H="else",G=void 0,V+=5,J=V;continue}}V++}return F.push({type:H,condition:G,content:z.slice(J),start:j+J,end:j+z.length}),{fullMatch:v.slice(_,B+6),branches:F,start:_,end:B+6}}function Bi(v){let _=[],k=/@if\s*\(/g,E=k.exec(v);while(E!==null){if(_.some((B)=>E.index>B.start&&E.index<B.end)){E=k.exec(v);continue}let j=Lf(v,E.index);if(j)_.push(j),k.lastIndex=j.end;E=k.exec(v)}return _}function Ro(v,_,k){let E=[],T=new RegExp(`@${_}\\s*\\(`,"g"),j=T.exec(v);while(j!==null){if(E.some((se)=>j.index>se.start&&j.index<se.end)){j=T.exec(v);continue}let z=j.index,F=z+j[0].length-1,V=S(v,"(",")",F);if(V===-1){j=T.exec(v);continue}let H=v.slice(F+1,V),G=V+1,J=Or(v,_,k,G);if(J===-1){j=T.exec(v);continue}let ne=v.slice(G,J),re=J+`@${k}`.length;E.push({fullMatch:v.slice(z,re),name:_,params:H,content:ne,start:z,end:re}),T.lastIndex=re,j=T.exec(v)}return E}function Xc(v,_){let k=v.slice(_).match(/^@switch\s*/);if(!k)return null;let E=_+k[0].length,T=xr(v,E);if(!T)return null;let j=T.endPos,B=Or(v,"switch","endswitch",j);if(B===-1)return null;let z=v.slice(j,B),F=[],V=0,H=null,G=0;while(V<z.length){let J=z.slice(V),ne=J.match(/^@switch\s*\(/),re=J.match(/^@endswitch(?![a-z])/);if(ne){if(G++,H)H.content+=ne[0];V+=ne[0].length;continue}if(re){if(G--,H)H.content+=re[0];V+=re[0].length;continue}if(G>0){if(H)H.content+=z[V];V++;continue}let se=J.match(/^@case\s*/),ie=J.match(/^@default(?![a-z])/),ae=J.match(/^@break(?![a-z])/);if(se&&J.startsWith("@case")){if(H)F.push(H);let ue=V+se[0].length,oe=xr(z,ue);if(!oe){V++;continue}H={type:"case",value:oe.expression,content:""},V=oe.endPos}else if(ie&&J.startsWith("@default")){if(H)F.push(H);H={type:"default",content:""},V+=ie[0].length}else if(ae&&J.startsWith("@break"))V+=ae[0].length;else{if(H)H.content+=z[V];V++}}if(H)F.push(H);return{fullMatch:v.slice(_,B+10),expression:T.expression,cases:F,start:_,end:B+10}}function kx(v,_,k){let E=v,T=!0;while(T){T=!1;let j=E.match(/@switch\s*\(/);if(!j||j.index===void 0)break;let B=j.index,z=Xc(E,B);if(!z)break;try{let F;if(p(z.expression))F=l(z.expression,Object.keys(_))(...Object.values(_));else F=c(z.expression,_);let V="",H=!1;for(let G of z.cases)if(G.type==="default"){if(!H)V=G.content.trim()}else try{let J;if(G.value&&p(G.value))J=l(G.value,Object.keys(_))(...Object.values(_));else if(G.value)J=c(G.value,_);if(F===J){V=G.content.trim(),H=!0;break}}catch{continue}E=E.substring(0,B)+V+E.substring(z.end),T=!0}catch(F){let V=F instanceof Error?F.message:String(F),H=i("Switch",`Error evaluating @switch expression: ${V}`,t.EVALUATION_ERROR);E=E.substring(0,B)+H+E.substring(z.end);break}}return E}function Ex(v){let _=[];return{masked:v.replace(/<script\b[\s\S]*?<\/script\s*>/gi,(E)=>(_.push(E),`\x00stx-script-${_.length-1}\x00`)),scripts:_}}function Cx(v,_){if(_.length===0)return v;return v.replace(/\u0000stx-script-(\d+)\u0000/g,(k,E)=>_[Number(E)]??k)}function lr(v,_,k){let{masked:E,scripts:T}=Ex(v);return Cx(Rx(E,_,k),T)}function Rx(v,_,k){let E=v;E=kx(E,_,k);{let j=!0;while(j){j=!1;let B=E.match(/@unless\s*\(/);if(!B||B.index===void 0)break;let z=B.index,F=xr(E,z+7);if(!F)break;let V=F.endPos,H=Or(E,"unless","endunless",V);if(H===-1){console.warn(`[stx] @unless directive at position ${z} has no matching @endunless \u2014 the block was skipped. Check for typos or missing closers.`);break}let G=E.slice(V,H),J=F.expression,ne=-1;{let se=0,ie=/@(?:if|unless)\s*\(/g,ae=/@(?:endif|endunless)(?![a-z])/g,ue=/@else(?![a-z])/g,oe=[],me;while((me=ie.exec(G))!==null)oe.push({pos:me.index,type:"open"});while((me=ae.exec(G))!==null)oe.push({pos:me.index,type:"close"});while((me=ue.exec(G))!==null)oe.push({pos:me.index,type:"else"});oe.sort((ve,$e)=>ve.pos-$e.pos);for(let ve of oe)if(ve.type==="open")se++;else if(ve.type==="close")se--;else if(ve.type==="else"&&se===0){ne=ve.pos;break}}let re;if(ne!==-1){let se=G.slice(0,ne),ie=G.slice(ne+5);re=`@if (${J})${ie}@else ${se}@endif`}else re=`@if (!(${J}))${G}@endif`;E=E.substring(0,z)+re+E.substring(H+10),j=!0}}E=Gc(E,_,k),E=Jc(E,_,k),E=Zc(E,_);let T=()=>{let j=Bi(E);if(j.length===0)return!1;let B=Array(j.length);for(let V=j.length-1;V>=0;V--){let H=j[V];try{let G="",J=!1;for(let ne of H.branches){if(J)break;if(ne.type==="else")G=ne.content,J=!0;else try{let re;if(ne.condition&&p(ne.condition))re=l(ne.condition,Object.keys(_))(...Object.values(_));else if(ne.condition)re=c(ne.condition,_);if(re)G=ne.content,J=!0}catch(re){G=i(ne.type==="if"?"If":"Elseif",`Error in @${ne.type}(${ne.condition}): ${re instanceof Error?re.message:String(re)}`,t.EVALUATION_ERROR),J=!0}}B[V]=G}catch(G){let J=G instanceof Error?G.message:String(G);B[V]=i("If",`Error processing @if block: ${J}`,t.EVALUATION_ERROR)}}let z=Array(j.length*2+1),F=0;for(let V=0;V<j.length;V++){let H=j[V];z[V*2]=E.slice(F,H.start),z[V*2+1]=B[V],F=H.end}return z[j.length*2]=E.slice(F),E=z.join(""),!0};while(!0){let j=E;if(!T())break;if(E===j)break}return E}function Bf(v){let _=0;while(_<v.length&&/\s/.test(v[_]))_++;if(v[_]!=="(")return null;_++;while(_<v.length&&/\s/.test(v[_]))_++;let k=v[_];if(k!=="'"&&k!=='"')return null;_++;let E=[];while(_<v.length){let T=v[_];if(T==="\\"&&_+1<v.length){E.push(v[_+1]),_+=2;continue}if(T===k){_++;break}E.push(T),_++}while(_<v.length&&/\s/.test(v[_]))_++;if(v[_]!==")")return null;return _++,{value:E.join(""),consumed:_}}function Zc(v,_){let k=v;function E(z,F,V,H){let G=1,J=H,ne=new RegExp(`@${F}(?:\\s*\\(|\\s|$)`,"g"),re=new RegExp(`@${V}(?![a-z])`,"g");while(J<z.length&&G>0){ne.lastIndex=J,re.lastIndex=J;let se=ne.exec(z),ie=re.exec(z),ae=se?se.index:1/0,ue=ie?ie.index:1/0;if(ae<ue)G++,J=ae+se[0].length;else if(ue<1/0){if(G--,G===0)return ue;J=ue+ie[0].length}else break}return-1}function T(z,F,V){let H=0,G=new RegExp(`@${F}(?:\\s*\\(|\\s|$)`,"g"),J=new RegExp(`@${V}(?![a-z])`,"g"),ne=/@else(?![a-z])/g,re=[],se;while((se=G.exec(z))!==null)re.push({pos:se.index,type:"open"});while((se=J.exec(z))!==null)re.push({pos:se.index,type:"close"});while((se=ne.exec(z))!==null)re.push({pos:se.index,type:"else"});re.sort((ie,ae)=>ie.pos-ae.pos);for(let ie of re)if(ie.type==="open")H++;else if(ie.type==="close")H--;else if(ie.type==="else"&&H===0)return ie.pos;return-1}{let z=!0;while(z){z=!1;let F=k.match(/@auth(?:\s*\(|\s|(?=\n))/);if(!F||F.index===void 0)break;let V=F.index,H,G,J=k.slice(V+5),ne=Bf(J);if(ne)H=ne.value,G=V+5+ne.consumed;else G=V+5;let re=E(k,"auth","endauth",G);if(re===-1){console.warn(`[stx] @auth directive at position ${V} has no matching @endauth \u2014 the block was skipped.`);break}let se=k.slice(G,re),ie=T(se,"auth","endauth"),ae;if(!_.auth)ae=!1;else ae=H?yr(`auth?.check && auth?.user?.[${H}]`,_):yr("auth?.check",_);let ue;if(ie!==-1){let oe=se.slice(0,ie),me=se.slice(ie+5);ue=ae?oe:me}else ue=ae?se:"";k=k.substring(0,V)+ue+k.substring(re+8),z=!0}}{let z=!0;while(z){z=!1;let F=k.match(/@guest(?:\s*\(|\s|(?=\n))/);if(!F||F.index===void 0)break;let V=F.index,H,G,J=k.slice(V+6),ne=Bf(J);if(ne)H=ne.value,G=V+6+ne.consumed;else G=V+6;let re=E(k,"guest","endguest",G);if(re===-1){console.warn(`[stx] @guest directive at position ${V} has no matching @endguest \u2014 the block was skipped.`);break}let se=k.slice(G,re),ie=T(se,"guest","endguest"),ae;if(!_.auth)ae=!0;else ae=H?yr(`!auth?.check || !auth?.user?.[${H}]`,_):yr("!auth?.check",_);let ue;if(ie!==-1){let oe=se.slice(0,ie),me=se.slice(ie+5);ue=ae?oe:me}else ue=ae?se:"";k=k.substring(0,V)+ue+k.substring(re+9),z=!0}}function j(z,F,V){if(_.userCan&&typeof _.userCan[z]==="boolean")return _.userCan[z];if(_.permissions?.check&&typeof _.permissions.check==="function")try{let H=[z];if(F)H.push(F);if(V){let G=yr(V,_);H.push(G)}return _.permissions.check(...H)}catch{return!1}return!1}function B(z){let F=z.match(/^\s*\(\s*'([^']*)'(?:,\s*'([^']*)')?(?:,\s*([^)]*))?\)/);if(!F)return null;return{ability:F[1],type:F[2],id:F[3]?.trim(),paramsEnd:F[0].length}}for(let z of["can","cannot"]){let F=`end${z}`,V=z==="can"?"elsecan":"elsecannot",H=!0;while(H){H=!1;let G=k.match(new RegExp(`@${z}\\s*\\(`));if(!G||G.index===void 0)break;let J=G.index,ne=k.slice(J+`@${z}`.length),re=B(ne);if(!re)break;let se=J+`@${z}`.length+re.paramsEnd,ie=E(k,z,F,se);if(ie===-1){console.warn(`[stx] @${z} directive at position ${J} has no matching @${F} \u2014 the block was skipped.`);break}let ae=k.slice(se,ie),ue=[],oe=0,me=new RegExp(`@${z}\\s*\\(`,"g"),ve=new RegExp(`@${F}(?![a-z])`,"g"),$e=new RegExp(`@${V}\\s*\\(`,"g"),_e=/@else(?![a-z])/g,Re=[],Ee;while((Ee=me.exec(ae))!==null)Re.push({pos:Ee.index,type:"open"});while((Ee=ve.exec(ae))!==null)Re.push({pos:Ee.index,type:"close"});while((Ee=$e.exec(ae))!==null)Re.push({pos:Ee.index,type:"elseDirective"});while((Ee=_e.exec(ae))!==null)Re.push({pos:Ee.index,type:"else"});Re.sort((De,Ie)=>De.pos-Ie.pos);for(let De of Re){if(De.type==="open"){oe++;continue}if(De.type==="close"){oe--;continue}if(oe===0)ue.push(De)}let Ae=[],Te=0;for(let De=0;De<ue.length;De++){let Ie=ue[De];if(Ae.push({content:ae.slice(Te,Ie.pos),ability:void 0}),Ie.type==="elseDirective"){let Ye=ae.slice(Ie.pos+`@${V}`.length),at=B(Ye);if(at){Ae[Ae.length-1]={content:ae.slice(Te,Ie.pos)},Te=Ie.pos+`@${V}`.length+at.paramsEnd,Ae.push({content:"",ability:at.ability,type:at.type,id:at.id}),Ae.pop();let dt=ue[De+1],et=dt?dt.pos:ae.length;Ae.push({content:ae.slice(Te,et),ability:at.ability,type:at.type,id:at.id}),Te=et}}else Te=Ie.pos+5}if(Te<ae.length){let De=Ae[Ae.length-1];if(ue.length>0&&ue[ue.length-1].type==="else")Ae.push({content:ae.slice(Te),isFinalElse:!0});else if(Ae.length===0)Ae.push({content:ae.slice(Te)})}let ke=j(re.ability,re.type,re.id),Pe=z==="can"?ke:!ke,Ge="";if(Pe)Ge=Ae[0]?.content||"";else{let De=!1;for(let Ie=1;Ie<Ae.length;Ie++){let Ye=Ae[Ie];if(Ye.isFinalElse){Ge=Ye.content,De=!0;break}if(Ye.ability){let at=j(Ye.ability,Ye.type,Ye.id);if(z==="can"?at:!at){Ge=Ye.content,De=!0;break}}}if(!De&&Ae.length>0){let Ie=Ae[Ae.length-1];if(Ie.isFinalElse)Ge=Ie.content}}k=k.substring(0,J)+Ge+k.substring(ie+`@${F}`.length),H=!0}}return k}function Gc(v,_,k){let E=v;function T(j,B,z,F,V){let H=!0;while(H){H=!1;let G=new RegExp(`@${B}\\s*\\(`),J=j.match(G);if(!J||J.index===void 0)break;let ne=J.index,re=xr(j,ne+`@${B}`.length);if(!re)break;let se=re.endPos,ie=Or(j,B,z,se);if(ie===-1){console.warn(`[stx] @${B} directive at position ${ne} has no matching @${z} \u2014 the block was skipped.`);break}let ae=j.slice(se,ie),ue=re.expression,oe=-1,me=0,ve=0;while(ve<ae.length){let $e=ae.indexOf("@",ve);if($e===-1)break;let _e=ae.substring($e);if(/^@(?:if|unless|isset|empty)\s*\(/.test(_e)){me++,ve=$e+1;continue}if(/^@(?:endif|endunless|endisset|endempty)(?![a-z])/.test(_e)){me--,ve=$e+1;continue}if(me===0&&/^@else(?![a-z])/.test(_e)){oe=$e;break}ve=$e+1}try{let $e=F(ue.trim()),_e;if(oe!==-1){let Re=ae.slice(0,oe),Ee=ae.slice(oe+5);_e=$e?Re:Ee}else _e=$e?ae:"";j=j.substring(0,ne)+_e+j.substring(ie+`@${z}`.length),H=!0}catch($e){let _e=$e instanceof Error?$e.message:String($e),Re=i(V,`Error processing @${B} directive: ${_e}`,t.EVALUATION_ERROR);j=j.substring(0,ne)+Re+j.substring(ie+`@${z}`.length);break}}return j}return E=T(E,"isset","endisset",(j)=>{let B=yr(j,_);return B!==void 0&&B!==null},"Isset"),E=T(E,"empty","endempty",(j)=>{let B=yr(j,_);return B===void 0||B===null||B===""||B===0||B===!1||Array.isArray(B)&&B.length===0||typeof B==="object"&&B!==null&&Object.keys(B).length===0},"Empty"),E}function Jc(v,_,k){let E=v,T="development";function j(B,z,F,V){let H=new RegExp(`@${z}(?![a-z])`,"g"),G=new RegExp(`@${F}(?![a-z])`,"g"),J=new RegExp(`^@${z}(?![a-z])`),ne=new RegExp(`^@${F}(?![a-z])`),re=B,se=!0;while(se){se=!1,H.lastIndex=0;let ie=H.exec(re);if(!ie)break;let ae=ie.index,ue=ae+ie[0].length;if(z==="env"){let ke=re.substring(ue).match(/^\s*\(\s*(['"])([^'"]+)\1\s*\)/);if(!ke)break;ue+=ke[0].length,V=T===ke[2]}let oe=1,me=ue,ve=-1;while(oe>0&&me<re.length){H.lastIndex=me,G.lastIndex=me;let ke=H.exec(re),Pe=G.exec(re),Ge=ke?ke.index:1/0,De=Pe?Pe.index:1/0;if(Ge<De)oe++,me=Ge+ke[0].length;else if(De<1/0){if(oe--,oe===0){ve=De;break}me=De+Pe[0].length}else break}if(ve===-1){console.warn(`[stx] @${z} directive at position ${ae} has no matching @${F} \u2014 the block was skipped.`);break}let $e=re.substring(ue,ve),_e=-1,Re=0,Ee=0;while(Ee<$e.length){let ke=$e.indexOf("@",Ee);if(ke===-1)break;let Pe=$e.substring(ke);if(J.test(Pe)){Re++,Ee=ke+1;continue}if(ne.test(Pe)){Re--,Ee=ke+1;continue}if(Re===0&&/^@else(?![a-z])/.test(Pe)){_e=ke;break}Ee=ke+1}let Ae;if(_e!==-1){let ke=$e.slice(0,_e),Pe=$e.slice(_e+5);Ae=V?ke:Pe}else Ae=V?$e:"";let Te=`@${F}`.length;re=re.substring(0,ae)+Ae+re.substring(ve+Te),se=!0}return re}return E=j(E,"env","endenv",!1),E=j(E,"production","endproduction",T==="production"),E=j(E,"development","enddevelopment",T==="development"),E=j(E,"staging","endstaging",T==="staging"),E=j(E,"testing","endtesting",T==="testing"),E}var zf=new WeakMap;function Wf(v=16){let _=new Uint8Array(v);return crypto.getRandomValues(_),btoa(String.fromCharCode(..._))}function Ao(v,_){if(!v)return _?.nonceGenerator?.()??Wf();let k=zf.get(v);if(!k)k=_?.nonceGenerator?.()??Wf(),zf.set(v,k);return k}function Ax(v,_){let k=[];for(let[E,T]of Object.entries(v)){if(T===void 0||T===null)continue;if(typeof T==="boolean"){if(T)k.push(E);continue}if(Array.isArray(T)){let j=[...T];if(_&&(E==="script-src"||E==="style-src"))j=j.filter((B)=>!B.startsWith("'nonce-")),j.push(`'nonce-${_}'`);if(j.length>0)k.push(`${E} ${j.join(" ")}`)}}return k.join("; ")}function Ff(v,_){return`<meta http-equiv="Content-Security-Policy" content="${Ax(v,_).replace(/&/g,"&amp;").replace(/"/g,"&quot;")}">`}function Vf(v,_,k){if(!_.enabled||!_.addMetaTag)return v;if(v.includes('http-equiv="Content-Security-Policy"'))return v;if(!v.includes("<head>")&&!v.includes("<head "))return v;let E=_.useNonce?Ao(k,_):void 0,T=Ff(_.directives,E);return v.replace(/<head([^>]*)>/,`<head$1>
1708
1708
  ${T}`)}function Uf(v,_){let k=v;return k=k.replace(/<script(?![^>]*\ssrc=)([^>]*)>/gi,(E,T)=>{if(T.includes("nonce="))return E;return`<script nonce="${_}"${T}>`}),k=k.replace(/<style([^>]*)>/gi,(E,T)=>{if(T.includes("nonce="))return E;return`<style nonce="${_}"${T}>`}),k}function Hf(v,_,k,E){let T=v,j=E.csp;if(T=T.replace(/@csp\b/g,()=>{if(!j?.enabled||!j.directives)return"<!-- CSP not configured -->";let B=j.useNonce?Ao(_,j):void 0;return Ff(j.directives,B)}),T=T.replace(/@cspNonce\b/g,()=>{if(!j?.enabled||!j.useNonce)return"";return Ao(_,j)}),j?.enabled&&j.useNonce)_.cspNonce=Ao(_,j);return T}import Tx from"crypto";var Ix=40,qf="_token",Yc=null;function Px(v=Ix){let _=Tx.randomBytes(Math.ceil(v/2)).toString("hex").slice(0,v);return Yc=_,_}function Dx(){if(!Yc)Px();return Yc}function Ox(v=qf){let _=Dx();return`<input type="hidden" name="${v}" value="${_}">`}function Kf(v){return v.replace(/@csrf(?:\((['"])([^'"]*)\1\))?/g,(_,k,E)=>Ox(E||qf))}async function Xf(v,_,k,E){if(!E.customDirectives||E.customDirectives.length===0)return v;let T=v;for(let j of E.customDirectives){if(!j.name||typeof j.handler!=="function"){if(E.debug)console.warn("Invalid custom directive:",j);continue}if(j.hasEndTag)T=await Mx(T,j,_,k,E);else T=await Nx(T,j,_,k,E)}return T}async function Mx(v,_,k,E,T){let{name:j,handler:B}=_,z=`@${j}`,F=`@end${j}`,V=v,H=Er(`${z}(?:\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\))?([\\s\\S]*?)${F}`,"g"),G=[],J=H.exec(V);while(J!==null){let[ne,re="",se=""]=J,ie=J.index||0;try{let ae=re?Zf(_,re):[],ue=se.trim(),oe=await B(ue,ae,k,E);G.push({original:ne,processed:oe,startIndex:ie})}catch(ae){let ue=ae instanceof Error?ae.message:String(ae);if(T.debug)console.error(`Error processing custom directive @${j}:`,ae);G.push({original:ne,processed:i("CustomDirective",`Error in @${j}${re?`(${re})`:""}: ${ue}`,t.EVALUATION_ERROR),startIndex:ie})}J=H.exec(V)}for(let ne=G.length-1;ne>=0;ne--){let{original:re,processed:se}=G[ne];V=V.replace(re,se)}return V}async function Nx(v,_,k,E,T){let{name:j,handler:B}=_,z=v,F=[],V=[];if(_.rawParams){for(let J of As(z,Er(`(?<![\\w$@])@${j}\\s*\\(`,"g")))if(J.end!==-1)V.push({fullMatch:J.call,paramString:J.args,startIndex:J.start})}else{let J=Er(`@${j}\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\)`,"g");J.lastIndex=0;let ne=J.exec(z);while(ne!==null)V.push({fullMatch:ne[0],paramString:ne[1]??"",startIndex:ne.index||0}),ne=J.exec(z)}for(let{fullMatch:J,paramString:ne,startIndex:re}of V)try{let se=Zf(_,ne),ie=await B("",se,k,E);F.push({original:J,processed:ie,startIndex:re})}catch(se){let ie=se instanceof Error?se.message:String(se);if(T.debug)console.error(`Error processing custom directive @${j}:`,se);F.push({original:J,processed:i("CustomDirective",`Error in @${j}(${ne}): ${ie}`,t.EVALUATION_ERROR),startIndex:re})}let H=Er(`@${j}(?!\\w)(?!\\s*\\()`,"g"),G=H.exec(z);while(G!==null){let[J]=G,ne=G.index||0;try{let re=await B("",[],k,E);F.push({original:J,processed:re,startIndex:ne})}catch(re){let se=re instanceof Error?re.message:String(re);if(T.debug)console.error(`Error processing custom directive @${j}:`,re);F.push({original:J,processed:i("CustomDirective",`Error in @${j}: ${se}`,t.EVALUATION_ERROR),startIndex:ne})}G=H.exec(z)}for(let J=F.length-1;J>=0;J--){let{original:ne,processed:re}=F[J];z=z.replace(ne,re)}return z}function Zf(v,_){return v.rawParams?Je(_):jx(_)}function jx(v){if(!v.trim())return[];let _=[],k="",E=!1,T="";for(let j=0;j<v.length;j++){let B=v[j];if((B==='"'||B==="'")&&(j===0||v[j-1]!=="\\"))if(!E)E=!0,T=B;else if(B===T)E=!1;else k+=B;else if(B===","&&!E)_.push(k.trim()),k="";else k+=B}if(k.trim())_.push(k.trim());return _.map((j)=>{let B=j.trim();if(B.startsWith('"')&&B.endsWith('"')||B.startsWith("'")&&B.endsWith("'"))return B.substring(1,B.length-1);return B})}var Gf=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,Jf=/^[A-Za-z_$][\w$]*$/,Lx=new Set(["light","dark","system"]);function Mr(v,_){if(typeof v!=="string"||v.length===0)throw Error(`@appearanceBootstrap ${_} must be a non-empty string`)}function Bx(v){if(!v||typeof v!=="object"||Array.isArray(v))throw Error("@appearanceBootstrap expects an options object");let _=v,{appearance:k,colorMode:E}=_;if(Mr(_.storageKey,"storageKey"),k!==void 0&&(!k||typeof k!=="object"||Array.isArray(k)))throw Error("@appearanceBootstrap appearance must be an object when given");if(!E||typeof E!=="object"||Array.isArray(E))throw Error("@appearanceBootstrap colorMode must be an object");if(Mr(E.key,"colorMode.key"),Mr(E.attribute,"colorMode.attribute"),Mr(E.default,"colorMode.default"),!Jf.test(E.key))throw Error("@appearanceBootstrap preference keys must be JavaScript property names");if(!Gf.test(E.attribute))throw Error("@appearanceBootstrap attributes must be lowercase data attribute names");if(!Lx.has(E.default))throw Error("@appearanceBootstrap colorMode.default must be light, dark, or system");let T=null;if(k){if(Mr(k.key,"appearance.key"),Mr(k.attribute,"appearance.attribute"),Mr(k.default,"appearance.default"),!Jf.test(k.key))throw Error("@appearanceBootstrap preference keys must be JavaScript property names");if(!Gf.test(k.attribute))throw Error("@appearanceBootstrap attributes must be lowercase data attribute names");if(!Array.isArray(k.allowed)||k.allowed.length===0||k.allowed.some((j)=>typeof j!=="string"||j.length===0))throw Error("@appearanceBootstrap appearance.allowed must contain one or more strings");if(!k.allowed.includes(k.default))throw Error("@appearanceBootstrap appearance.default must be in appearance.allowed");T={key:k.key,attribute:k.attribute,allowed:[...new Set(k.allowed)],default:k.default}}return{storageKey:_.storageKey,appearance:T,colorMode:{key:E.key,attribute:E.attribute,default:E.default},respectExisting:_.respectExisting===!0}}function zx(v){return JSON.stringify(v).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function Wx(v){return`<script data-stx-scoped data-stx-appearance-bootstrap>(function(){"use strict";const config=${zx(v)};const root=document.documentElement;const MODES=["light","dark","system"];let format="json";const forced=(function(){const found={colorMode:null,appearance:null};if(!config.respectExisting)return found;try{const mode=root.getAttribute("data-"+config.colorMode.attribute);if(mode==="light"||mode==="dark")found.colorMode=mode;if(config.appearance){const name=root.getAttribute("data-"+config.appearance.attribute);if(config.appearance.allowed.includes(name))found.appearance=name}}catch{}return found}());function read(){let stored={};try{const raw=localStorage.getItem(config.storageKey);if(raw){let parsed=null;try{parsed=JSON.parse(raw)}catch{parsed=raw}if(parsed&&typeof parsed==="object"&&!Array.isArray(parsed)){stored=parsed;format="json"}else if(typeof parsed==="string"&&MODES.includes(parsed)){stored={};stored[config.colorMode.key]=parsed;format="string"}}}catch{}return stored}function write(stored){try{if(format==="string"&&!config.appearance)localStorage.setItem(config.storageKey,stored[config.colorMode.key]);else localStorage.setItem(config.storageKey,JSON.stringify(stored))}catch{}}function resolve(){const stored=read();const state={colorMode:forced.colorMode||(MODES.includes(stored[config.colorMode.key])?stored[config.colorMode.key]:config.colorMode.default)};if(config.appearance)state.appearance=forced.appearance||(config.appearance.allowed.includes(stored[config.appearance.key])?stored[config.appearance.key]:config.appearance.default);return state}function prefersDark(){try{return matchMedia("(prefers-color-scheme: dark)").matches}catch{return false}}function apply(){const state=resolve();const dark=state.colorMode==="dark"||(state.colorMode==="system"&&prefersDark());if(config.appearance)root.setAttribute("data-"+config.appearance.attribute,state.appearance);root.setAttribute("data-"+config.colorMode.attribute,state.colorMode);root.classList.toggle("dark",dark);root.dataset.theme=dark?"dark":"light";state.dark=dark;try{window.dispatchEvent(new CustomEvent("stx:appearance",{detail:state}))}catch{}return state}function store(key,allowed,value){if(allowed.includes(value)){const stored=read();stored[key]=value;write(stored)}return apply()}window.__stxAppearance={config:config,forced:forced,read:read,resolve:resolve,apply:apply,setColorMode:function(mode){return store(config.colorMode.key,MODES,mode)},setAppearance:function(name){return config.appearance?store(config.appearance.key,config.appearance.allowed,name):apply()},watchSystem:function(){try{matchMedia("(prefers-color-scheme: dark)").addEventListener("change",function(){if(resolve().colorMode==="system")apply()})}catch{}}};apply()}());</script>`}function Fx(v,_){let k=1,E=null,T=!1;for(let j=_+1;j<v.length;j++){let B=v[j];if(T){T=!1;continue}if(E){if(B==="\\")T=!0;else if(B===E)E=null;continue}if(B==='"'||B==="'"||B==="`"){E=B;continue}if(B==="(")k++;else if(B===")"&&--k===0)return j}return-1}function Yf(v,_){let k=v,E=/@appearanceBootstrap\s*\(/g,T;while((T=E.exec(k))!==null){let j=T.index+T[0].length-1,B=Fx(k,j);if(B===-1)throw Error("@appearanceBootstrap has an unclosed options object");let z=k.slice(j+1,B).trim(),F=c(`(${z})`,_),V=Wx(Bx(F));k=k.slice(0,T.index)+V+k.slice(B+1),E.lastIndex=T.index+V.length}return k}import Vx from"crypto";function Vt(v){return String(v??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}var ep={input:"form-control",inputError:"is-invalid",checkInput:"form-check-input",label:"form-label",errorFeedback:"invalid-feedback"};function To(v,_,k,E){let T=v||_;return k?`${T} ${E}`:T}function $n(v){return String(v).replace(/\[\]$/,"").replace(/[^\w.:-]+/g,"-").replace(/^-+|-+$/g,"")}function zs(v,_){if(/\bid\s*=/i.test(v))return"";return` id="${Vt(_)}"`}function Qc(v,_,k){if(!_)return"";let E="";if(!/\baria-invalid\s*=/i.test(k))E+=' aria-invalid="true"';if(!/\baria-describedby\s*=/i.test(k))E+=` aria-describedby="${Vt(`${$n(v)}-error`)}"`;return E}function Ux(){return Vx.randomUUID()}function Io(v,_){let k=v;return k=k.replace(/@csrf/g,()=>{if(!_.csrf||typeof _.csrf!=="object"){let E=Ux();_.csrf={token:E}}if(_.csrf.field)return _.csrf.field;if(_.csrf.token)return`<input type="hidden" name="_token" value="${Vt(_.csrf.token)}">`;return'<input type="hidden" name="_token" value="">'}),k=k.replace(/@method\(['"]([^'"]+)['"]\)/g,(E,T)=>{let j=T.toUpperCase();if(T&&!["GET","POST"].includes(j))return`<input type="hidden" name="_method" value="${Vt(j)}">`;return E}),k}function tp(v,_,k=ep){let E=v;return E=E.replace(/@form\(\s*(?:(?:'([^']+)'|"([^"]+)")\s*)?(?:,\s*(?:'([^']+)'|"([^"]+)")?)?\s*(?:,\s*\{([^}]+)\}\s*)?\)/g,(T,j,B,z,F,V="")=>{let H=j||B||"POST",G=z||F||"",J=br(V),ne=H.toUpperCase(),re=["GET","POST"].includes(ne)?ne:"POST",se=`<form method="${Vt(re)}" action="${Vt(G)}"${J?` ${J}`:""}>`;if(se+=`
1709
1709
  ${Io("@csrf",_)}`,!["GET","POST"].includes(ne))se+=`
1710
- ${Io(`@method('${ne}')`,_)}`;return se}),E=E.replace(/@endform/g,"</form>"),E=E.replace(/@input\(\s*(?:'([^']+)'|"([^"]+)")\s*(?:,\s*(?:(?:'([^']*)'|"([^"]*)")\s*)?)?(?:,\s*\{([^}]+)\})?\s*\)/g,(T,j,B,z,F,V="")=>{let H=j||B||"",G=z||F||"",J=br(V),ne=zi(H,_),re=ne!==void 0&&ne!==null?ne:G||"",se=J.match(/type=['"]([^'"]+)['"]/i),ie=se?se[1]:"text",ae=Wi(H,_),ue=J.match(/class=['"]([^'"]+)['"]/i),oe=To(ue?ue[1]:"",k.input,ae,k.inputError),me=J.replace(/class=['"][^'"]+['"]/i,"");return me=me.replace(/type=['"][^'"]+['"]/i,""),`<input type="${Vt(ie)}" name="${Vt(H)}"${zs(J,$n(H))} value="${Vt(re)}" class="${oe}"${Qc(H,ae,J)}${me?` ${me}`:""}>`}),E=E.replace(/@textarea\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endtextarea/g,(T,j,B="",z="")=>{let F=br(B),V=zi(j,_)||z.trim(),H=Wi(j,_),G=F.match(/class=['"]([^'"]+)['"]/i),J=To(G?G[1]:"",k.input,H,k.inputError),ne=F.replace(/class=['"][^'"]+['"]/i,"");return`<textarea name="${Vt(j)}"${zs(F,$n(j))} class="${J}"${Qc(j,H,F)}${ne?` ${ne}`:""}>${Vt(V)}</textarea>`}),E=E.replace(/@select\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endselect/g,(T,j,B="",z)=>{let F=br(B),V=zi(j,_),H=Wi(j,_),G=F.match(/class=['"]([^'"]+)['"]/i),J=To(G?G[1]:"",k.input,H,k.inputError),ne=F.replace(/class=['"][^'"]+['"]/i,""),re=z;if(V!==void 0)re=z.replace(/(<option[^>]*value=['"]([^'"]+)['"][^>]*>)/gi,(se,ie,ae)=>{if((Array.isArray(V)?V.some((oe)=>String(oe)===ae):String(V)===ae)&&!ie.includes("selected"))return ie.replace(/(<option)/,"$1 selected");return se});return`<select name="${Vt(j)}"${zs(F,$n(j))} class="${J}"${Qc(j,H,F)}${ne?` ${ne}`:""}>${re}</select>`}),E=E.replace(/@checkbox\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?(?:,\s*\{([^}]+)\})?\)/g,(T,j,B,z="")=>{let F=B===void 0?"1":B,V=B===void 0?$n(j):`${$n(j)}-${$n(F)}`,H=br(z),G=zi(j,_),J=G!==void 0&&(Array.isArray(G)?G.some((ie)=>String(ie)===F):G===!0||String(G)===F),ne=H.match(/class=['"]([^'"]+)['"]/i),re=ne?ne[1]:k.checkInput,se=H.replace(/class=['"][^'"]+['"]/i,"");return`<input type="checkbox" name="${Vt(j)}"${zs(H,V)} value="${Vt(F)}" class="${re}"${J?" checked":""}${se?` ${se}`:""}>`}),E=E.replace(/@radio\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(T,j,B,z="")=>{let F=br(z),V=zi(j,_),H=V!==void 0&&V===B,G=F.match(/class=['"]([^'"]+)['"]/i),J=G?G[1]:k.checkInput,ne=F.replace(/class=['"][^'"]+['"]/i,"");return`<input type="radio" name="${Vt(j)}"${zs(F,`${$n(j)}-${$n(B)}`)} value="${Vt(B)}" class="${J}"${H?" checked":""}${ne?` ${ne}`:""}>`}),E=E.replace(/@file\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(T,j,B="")=>{let z=br(B),F=z.match(/accept=['"]([^'"]+)['"]/i),V=F?F[1]:"",H=z.includes("multiple"),G=Wi(j,_),J=z.match(/class=['"]([^'"]+)['"]/i),ne=To(J?J[1]:"",k.input,G,k.inputError),re=z.replace(/class=['"][^'"]+['"]/gi,"").replace(/accept=['"][^'"]+['"]/gi,"").replace(/\bmultiple\b/gi,"").trim(),se=[`<input type="file" name="${Vt(j)}"${zs(z,$n(j))}`,`class="${ne}"`];if(V)se.push(`accept="${Vt(V)}"`);if(H)se.push("multiple");if(re)se.push(re);return`${se.join(" ")}>`}),E=E.replace(/@label\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endlabel/g,(T,j,B="",z)=>{let F=br(B),V=F.match(/class=['"]([^'"]+)['"]/i),H=V?V[1]:k.label,G=F.replace(/class=['"][^'"]+['"]/i,"");return`<label for="${Vt($n(j))}" class="${H}"${G?` ${G}`:""}>${z}</label>`}),E}function np(v,_,k=ep){return v.replace(/@error\(['"]([^'"]+)['"]\)([\s\S]*?)@enderror/g,(E,T,j)=>{try{if(Wi(T,_)){let B=j.replace(/\{\{([^}]+)\}\}/g,(z,F)=>{try{if(F.trim()==="$message"||F.trim()==="message")return Qf(T,_);if(F.trim().includes("errors.first")||F.trim().includes("$errors.first")){if(typeof _.errors?.first==="function")return _.errors.first(T);return Qf(T,_)}let V=F.trim();if(p(V)){let H=c(V,_);return H!==void 0?String(H):V}return V}catch{return F}});return`<div id="${Vt(`${$n(T)}-error`)}" role="alert">${B}</div>`}return""}catch(B){return console.error("Error processing @error directive:",B),E}})}function Wi(v,_){if(!_.errors)return!1;if(typeof _.errors.has==="function")return _.errors.has(v);if(typeof _.errors==="object")return Object.prototype.hasOwnProperty.call(_.errors,v);return!1}function Qf(v,_){if(!_.errors)return"";if(typeof _.errors.get==="function")return _.errors.get(v);if(typeof _.errors==="object"&&Object.prototype.hasOwnProperty.call(_.errors,v)){let k=_.errors[v];return Array.isArray(k)?k[0]:String(k)}return""}function zi(v,_){let k;if(_.old&&typeof _.old==="function")return _.old(v);if(_.old&&typeof _.old==="object")return _.old[v];if(v.endsWith("[]")){let E=v.slice(0,-2);if(k=_[E],k!==void 0)return k}return _[v]}function br(v){if(!v.trim())return"";let _=[],k=v.trim(),E=/([\w-]+)\s*:\s*(['"]?)([^,'"]*)\2(?:\s*,\s*|\s*$)/g,T;while((T=E.exec(k))!==null){let[,j,,B]=T;_.push(`${j}="${B.trim()}"`)}return _.join(" ")}var Fi=/<\/?template\b[^>]*>/gi,Hx=/(?:^|\s)(?:id\s*=|(?:x-|[@:])(?:for|if|else(?:-if)?)(?=\s|=|$)|#[\w-]+(?:\s*=|\s|$)|v-slot(?::[\w-]+)?(?=\s|=|$)|slot\s*=)/i;function qx(v){let _=v.replace(/^<template\b/i,"").replace(/>$/,"");return Hx.test(_)}function Z(v){Fi.lastIndex=0;let _;while((_=Fi.exec(v))!==null){if(_[0].startsWith("</")||qx(_[0]))continue;let k=_.index,E=Fi.lastIndex,T=1,j;while((j=Fi.exec(v))!==null)if(j[0].startsWith("</")){if(T--,T===0){let B=j.index;return{start:k,openEnd:E,closeStart:B,end:Fi.lastIndex,content:v.slice(E,B)}}}else T++;return null}return null}import Bt from"path";import{existsSync as yv}from"fs";import Po from"fs";import Wt from"path";var rp=new Map;function Do(v,_=!0){let k=rp.get(v);if(_&&k)return k;let E=new Map,T=[Wt.join(v,"src"),Wt.join(v,"dist"),v];function j(B,z){if(z>6)return;let F;try{F=Po.readdirSync(B,{withFileTypes:!0})}catch{return}for(let V of F){let H=Wt.join(B,V.name);if(V.isDirectory()){if(V.name==="node_modules"||V.name.startsWith("."))continue;j(H,z+1)}else if(V.isFile()&&V.name.endsWith(".stx")){let G=V.name.slice(0,-4);if(!E.has(G))E.set(G,H);let J=G.toLowerCase();if(!E.has(J))E.set(J,H);let ne=G.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(!E.has(ne))E.set(ne,H)}}}for(let B of T)if(j(B,0),E.size>0)break;if(_)rp.set(v,E);return E}function Oo(v,_){if(v.startsWith(".")||v.startsWith("/"))return null;let k=_;while(!0){let E=Wt.join(k,"node_modules",v);try{if(Po.statSync(E).isDirectory())return E}catch{}let T=Wt.dirname(k);if(T===k)return null;k=T}}function Mo(v,_,k={}){return[Wt.resolve(Wt.dirname(_),`${v}.stx`),Wt.resolve(Wt.dirname(_),v),Wt.resolve(k.componentsDir||"components",`${v}.stx`),Wt.resolve(k.componentsDir||"components",v),v.endsWith(".stx")?v:`${v}.stx`]}function sp(v){let _=v.endsWith(".stx")?v.slice(0,-4):v,k=_.split("-").map((T)=>T.charAt(0).toUpperCase()+T.slice(1)).join(""),E=_.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();return[_,k,E]}function el(v,_){let[k,E,T]=sp(v);for(let j of[k,k.toLowerCase(),E,T]){let B=_?.__importedComponents?.get(j);if(B!==void 0)return B}}function*tl(v,_,k={},E){let T=sp(v);if(T[0].startsWith("./")||T[0].startsWith("../")){yield Wt.resolve(Wt.dirname(_),`${T[0]}.stx`);return}let j=[...new Set(T.map((F)=>`${F}.stx`))],B=k.projectRoot||process.cwd(),z=[...E?.__originalFilePath?[Wt.join(Wt.dirname(E.__originalFilePath),"components")]:[],...k.componentsDir?[k.componentsDir]:[],Wt.join(Wt.dirname(_),"components"),Wt.resolve(B,"src/components"),Wt.resolve(B,"components"),...import.meta.dir?[Wt.resolve(import.meta.dir,"components")]:[]];for(let F of new Set(z)){for(let V of j)yield Wt.join(F,V);try{for(let V of Po.readdirSync(F,{withFileTypes:!0}))if(V.isDirectory())for(let H of j)yield Wt.join(F,V.name,H)}catch{}}}function ip(v,_,k={},E){let T=el(v,E);if(T!==void 0)return T;for(let j of tl(v,_,k,E))try{if(Po.statSync(j,{throwIfNoEntry:!1})?.isFile())return j}catch{}return null}class op{builtins=new Map;registerBuiltin(v){this.builtins.set(v.name.toLowerCase(),v);for(let _ of v.aliases)this.builtins.set(_.toLowerCase(),v)}isBuiltin(v){return this.builtins.has(v.toLowerCase())}getBuiltin(v){return this.builtins.get(v.toLowerCase())??null}async resolveFile(v,_,k,E){let T=el(v,E);if(T!==void 0)return T;for(let j of tl(v,_,k,E))if(await r(j))return j;return null}}var Ws=new op;function Lt(v){return v.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}var vr="\x00stx-boolean-attribute";function nl(v){return v.indexOf("\x00")===-1?v:v.replace(/\0/g,"")}var Kx=new Set(["accesskey","autocapitalize","autofocus","class","contenteditable","dir","draggable","enterkeyhint","exportparts","hidden","id","inert","inputmode","is","itemid","itemprop","itemref","itemscope","itemtype","lang","nonce","part","role","slot","spellcheck","style","tabindex","title","translate","accept","action","alt","autocomplete","capture","cite","cols","colspan","content","controls","datetime","default","download","enctype","for","form","formaction","formenctype","formmethod","formnovalidate","formtarget","height","href","hreflang","kind","label","loading","loop","max","maxlength","media","method","min","minlength","multiple","muted","name","open","pattern","placeholder","playsinline","poster","preload","readonly","referrerpolicy","rel","required","reversed","rows","rowspan","scope","selected","shape","size","span","src","srcdoc","srclang","srcset","start","step","target","type","usemap","value","width","wrap"]);function rl(v){let _=v.toLowerCase();return _.startsWith("aria-")||_.startsWith("data-")||Kx.has(_)}function wr(v,_){let k=[];for(let[E,T]of Object.entries(v.static)){if(_.has(E))continue;let j=v.staticNames?.[E]??E;if(typeof T==="boolean"){if(T)k.push(Lt(j));continue}if(T===vr){k.push(Lt(j));continue}k.push(`${Lt(j)}="${Lt(nl(String(T)))}"`)}return k}function Sr(v,_){let k=[];for(let[E,T]of Object.entries(v.serverDynamic??{})){if(_.has(E))continue;if(T===null||T===void 0||T===!1)continue;let j=v.serverDynamicNames?.[E]??E;if(T===!0){k.push(Lt(j));continue}if(typeof T==="object")continue;k.push(`${Lt(j)}="${Lt(nl(String(T)))}"`)}return k}function Fs(v){return v.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Xx(v){if(v.clientReactive.to)return{value:v.clientReactive.to,reactive:!0};if(v.serverDynamic.to!==void 0)return{value:String(v.serverDynamic.to),reactive:!1};if(typeof v.static.to==="string")return{value:v.static.to,reactive:!1};return{value:"#",reactive:!1}}var sl={name:"StxLink",aliases:["stx-link"],render(v,_,k){let E=Xx(v),T=(typeof v.static.class==="string"?v.static.class:"")||(typeof v.static.className==="string"?v.static.className:""),j=typeof v.static.activeClass==="string"?v.static.activeClass:"active",B=typeof v.static.exactActiveClass==="string"?v.static.exactActiveClass:"exact-active",z=v.static.prefetch===!0||v.static.prefetch==="true"||v.serverDynamic.prefetch===!0,F=[];if(E.reactive)F.push(`:href="${Fs(E.value)}"`);else F.push(`href="${Fs(yi(E.value,"navigable"))}"`);if(T)F.push(`class="${Fs(T)}"`);if(F.push("data-stx-link"),F.push(`data-stx-active-class="${Fs(j)}"`),F.push(`data-stx-exact-active-class="${Fs(B)}"`),z)F.push("data-stx-prefetch");let V=typeof v.static.activeMatch==="string"?v.static.activeMatch.trim():"";if(V)F.push(`data-stx-active-match="${Fs(V)}"`);let H=new Set(["to","class","className","activeClass","exactActiveClass","activeMatch","prefetch"]);return F.push(...wr(v,H)),F.push(...Sr(v,H)),`<a ${F.join(" ")}>${_}</a>`}};import{createHash as xp}from"crypto";import Qt from"fs";import Ut from"path";import{decode as nb,generateThumbHash as rb}from"ts-images";import{createImageDeliveryCatalog as fp}from"ts-images/delivery";import il from"fs";function No(v,_,k){let E=Buffer.alloc(k),T=il.readSync(v,E,0,k,_);return E.subarray(0,T)}function ol(v){if(v.length<25)return!1;let _=(E,T)=>String.fromCharCode(...v.subarray(E,T));if(_(0,4)!=="RIFF"||_(8,12)!=="WEBP")return!1;let k=_(12,16);if(k==="VP8X")return(v[20]&16)!==0;if(k==="VP8L")return((v[21]|v[22]<<8|v[23]<<16|v[24]<<24)>>>28&1)===1;return!1}function al(v){let _;try{_=il.openSync(v,"r");let k=No(_,0,33);if(k.length>=3&&k[0]===255&&k[1]===216&&k[2]===255)return"none";if(k.length>=26&&k[0]===137&&k.toString("latin1",1,4)==="PNG"){let E=k[25];if(E===4||E===6)return"possible";let T=8;for(let j=0;j<64;j++){let B=No(_,T,8);if(B.length<8)return"unknown";let z=B.toString("latin1",4,8);if(z==="tRNS")return"possible";if(z==="IDAT"||z==="IEND")return"none";T+=12+B.readUInt32BE(0)}return"unknown"}if(k.length>=25&&k.toString("latin1",0,4)==="RIFF"&&k.toString("latin1",8,12)==="WEBP"){if(ol(k))return"possible";let E=k.toString("latin1",12,16);return E==="VP8 "||E==="VP8X"?"none":"unknown"}return"unknown"}catch{return"unknown"}finally{if(_!==void 0)il.closeSync(_)}}import Zx from"fs";import jo from"os";import{join as ap}from"path";import{fileURLToPath as cp}from"url";import{Worker as lp}from"worker_threads";var Bo=Symbol("stx.image-worker.unavailable");function Gx(v=typeof jo.availableParallelism==="function"?jo.availableParallelism():jo.cpus().length){return Math.max(1,Math.min(2,v-1))}var Lo=0,dp=[];async function Jx(){if(Lo<Gx()){Lo++;return}await new Promise((v)=>dp.push(v)),Lo++}function Yx(){Lo--,dp.shift()?.()}var Qx="@stacksjs/stx/builtins/image-warmup-worker";function eb(v=process.cwd()){let _=import.meta.url.endsWith(".ts")?"ts":"js";try{let k=new URL(`./image-warmup-worker.${_}`,import.meta.url);if(k.protocol==="file:"&&Zx.existsSync(cp(k)))return cp(k)}catch{}try{let k=typeof Bun<"u"?Bun.resolveSync(Qx,v):void 0;return k&&tb(k)?k:void 0}catch{return}}function tb(v,_=process.env){let k=v.replace(/\\/g,"/");if(k.split("/").some((T)=>/@\d[^/]*@@@\d+$/.test(T)))return!1;return![_.BUN_INSTALL_CACHE_DIR,ap(_.BUN_INSTALL||ap(jo.homedir(),".bun"),"install","cache")].filter((T)=>!!T).map((T)=>`${T.replace(/\\/g,"/").replace(/\/$/,"")}/`).some((T)=>k.startsWith(T))}var up=!1;function Vi(v){if(!up)up=!0,console.warn(`[stx] image worker unavailable (${v}); running the image pass on the serving thread instead. Results are the same, but requests may stall while it runs.`);return Bo}function cl(v){return v instanceof Error?v.message:String(v)}async function ll(v,_){if(typeof lp!=="function")return Vi("node:worker_threads has no Worker in this runtime");let k=eb();if(!k)return Vi("no image-warmup-worker entry beside this module or in the installed @stacksjs/stx");await Jx();try{return await new Promise((E,T)=>{let j;try{j=new lp(k)}catch(V){E(Vi(`could not start ${k}: ${cl(V)}`));return}let B=!1,z=!1,F=(V)=>{if(z)return;z=!0,V(),j.terminate()};j.on("message",(V)=>{if(V.type==="ready"){B=!0,j.postMessage({task:v,args:_});return}if(V.type==="result"){F(()=>E(V.value));return}let H=Error(V.error?.message??"image worker failed");if(V.error?.name)H.name=V.error.name;if(V.error?.stack)H.stack=V.error.stack;F(()=>T(H))}),j.on("error",(V)=>{F(()=>B?T(V instanceof Error?V:Error(cl(V)||"image worker crashed")):E(Vi(`the worker failed before it was ready: ${cl(V)}`)))}),j.on("exit",(V)=>{F(()=>B?T(Error("image worker exited before it finished")):E(Vi(`the worker exited with code ${V} before it was ready`)))})})}finally{Yx()}}var sb=new Set([".avif",".jpeg",".jpg",".png",".webp"]),ib=[320,640,960,1280,1920],Fo="/_stx/images",ob=`stx:${Fo}:alpha-1`,ab=["@stacksjs/ts-webp","@stacksjs/ts-avif"],zo;function cb(v,_){let k=Ut.dirname(Bun.resolveSync(v,_));while(k!==Ut.dirname(k)){let E=Ut.join(k,"package.json");if(Qt.existsSync(E)){let T=JSON.parse(Qt.readFileSync(E,"utf8"));if(T.name===v)return T.version}k=Ut.dirname(k)}return}function lb(){if(zo!==void 0)return zo;let v;try{v=Ut.dirname(Bun.resolveSync("ts-images",import.meta.dir))}catch{}return zo=ab.map((_)=>{let k;try{k=v?cb(_,v):void 0}catch{}return`${_.replace("@stacksjs/","")}@${k??"unknown"}`}).join("+"),zo}var pp=Symbol.for("stx.image-delivery");function Ui(){let v=globalThis;return v[pp]??={catalog:new Map,transparent:new Set},v[pp]}var gp=new Set;function ub(v){return`/${v.split(Ut.sep).map(encodeURIComponent).join("/")}`}function db(v){let _=Ut.extname(v),k=v.slice(0,-_.length).replace(/[^a-zA-Z0-9_-]+/g,"-").replace(/^-+|-+$/g,""),E=xp("sha256").update(v).digest("hex").slice(0,8);return`${k||"image"}-${E}`}function mp(v,_=`stx:${Fo}`){let k=(E)=>`${Fo}/${E.split("/").map(encodeURIComponent).join("/")}`;return{cacheNamespace:_,async stat(E){let T=Ut.join(v,E);try{let j=await Qt.promises.stat(T);return j.size>0?{bytes:j.size,path:T,url:k(E)}:null}catch{return null}},async write(E,T){let j=Ut.join(v,E);await Qt.promises.mkdir(Ut.dirname(j),{recursive:!0});let B=`${j}.${process.pid}.tmp`;return await Qt.promises.writeFile(B,T),await Qt.promises.rename(B,j),{bytes:T.byteLength,path:j,url:k(E)}},url:k}}async function bp(v,_=v){let k=await Qt.promises.readdir(_,{withFileTypes:!0});k.sort((T,j)=>T.name.localeCompare(j.name));let E=[];for(let T of k){let j=Ut.join(_,T.name);if(T.isDirectory()){E.push(...await bp(v,j));continue}if(!T.isFile()||!sb.has(Ut.extname(T.name).toLowerCase()))continue;E.push({absolutePath:j,relativePath:Ut.relative(v,j)})}return E}function hp(v,_){return v.map((k)=>({key:ub(k.relativePath),input:k.absolutePath,name:db(k.relativePath),...fb(k.absolutePath)?{options:{storage:_}}:{}}))}function fb(v){return al(v)==="possible"}function pb(v){for(let _=3;_<v.length;_+=4)if(v[_]!==255)return!0;return!1}async function gb(v){let _=Object.entries(v).filter(([,T])=>T.fallback.format==="png"),k=new Set,E=8;for(let T=0;T<_.length;T+=8)await Promise.all(_.slice(T,T+8).map(async([j,B])=>{let z=B.variants.filter((F)=>F.format==="png").sort((F,V)=>F.width-V.width)[0];try{let F=await nb(new Uint8Array(await Qt.promises.readFile(z?.path??B.fallback.path)));if(pb(F.data))k.add(j)}catch{k.add(j)}}));return k}function mb(v,_){let k=[];for(let E of _){let T=v[E],j=T?.variants.filter((z)=>z.format==="webp")??[];if(!T||j.length===0)continue;if(!j.some((z)=>{let F;try{return F=Qt.openSync(z.path,"r"),!ol(No(F,0,32))}catch{return!0}finally{if(F!==void 0)Qt.closeSync(F)}}))continue;if(T.variants=T.variants.filter((z)=>z.format!=="webp"),delete T.sources.webp,k.push(E),!gp.has(E))gp.add(E),console.warn(`[stx-images] ${E} is transparent but its WebP variants have no alpha channel; serving PNG instead. Upgrade @stacksjs/ts-webp to 0.1.6 or later.`)}return k}async function hb(v){let _=[],k=8;for(let E=0;E<v.length;E+=8){let T=v.slice(E,E+8),j=await Promise.all(T.map(async(B)=>{try{return await rb(B.absolutePath),B}catch{return console.warn(`[stx-images] Skipping unreadable raster: ${B.relativePath}`),null}}));_.push(...j.filter((B)=>B!==null))}return _}function ul(v){return Ut.join(v,"undecodable.json")}function yb(v){try{let _=Qt.readFileSync(ul(v),"utf-8"),k=JSON.parse(_);return k&&typeof k==="object"?k:{}}catch{return{}}}function xb(v,_){try{Qt.mkdirSync(Ut.dirname(ul(v)),{recursive:!0}),Qt.writeFileSync(ul(v),JSON.stringify(_))}catch{}}function yp(v){try{let _=Qt.statSync(v);return{mtimeMs:_.mtimeMs,size:_.size}}catch{return}}function vp(v){if(!v||v.startsWith("data:")||v.startsWith("blob:")||/^https?:\/\//i.test(v)||v.startsWith("//"))return;let _=v.split(/[?#]/,1)[0];if(!_)return;try{return`/${_.replace(/^\/+/,"").split("/").map(decodeURIComponent).map(encodeURIComponent).join("/")}`}catch{return}}function ts(v){let _=vp(v);return _?Ui().catalog.get(_):void 0}function ns(v){let _=vp(v);return _?Ui().transparent.has(_):!1}function rs(v){let _=(E)=>v.variants.filter((T)=>T.format===E).reduce((T,j)=>T+j.bytes,0),k=_(v.fallback.format);return["avif","webp"].map((E)=>({format:E,srcset:v.sources[E]||"",bytes:_(E)})).filter((E)=>E.srcset&&E.bytes>0&&E.bytes<k).sort((E,T)=>E.bytes-T.bytes).map(({format:E,srcset:T})=>({format:E,srcset:T}))}function Wd(v){let _=ts(v);if(!_)return;return{src:_.fallback.url,srcset:_.sources[_.fallback.format]||"",sources:rs(_).map(({format:k,srcset:E})=>({type:`image/${k}`,srcset:E})),width:_.source.width,height:_.source.height,placeholder:ns(v)?void 0:_.placeholder?.dataUrl}}function Un(){let v=Ui();v.catalog=new Map,v.transparent=new Set}function bb(v){let _=Ui();_.catalog=new Map(v.entries),_.transparent=new Set(v.transparent)}async function qd(v,_,k={}){if(!v||!Qt.existsSync(v))return Un(),{count:0,fingerprint:""};if(k.offThread){let re=await ll("delivery",{publicDir:v,outputDir:_});if(re!==Bo)return bb(re.state),re.result}let E=await bp(v);if(E.length===0)return Un(),{count:0,fingerprint:""};let T=yb(_),j=E.filter((re)=>{let se=T[re.relativePath];if(!se)return!0;let ie=yp(re.absolutePath);return!ie||ie.mtimeMs!==se.mtimeMs||ie.size!==se.size});if(j.length===0)return Un(),{count:0,fingerprint:""};let B=mp(Ut.join(_,"_stx","images"),`${ob}:${lb()}`),z={outDir:Ut.join(_,"_stx","images"),storage:mp(Ut.join(_,"_stx","images")),baseUrl:Fo,widths:ib,formats:["avif","webp"],quality:{avif:70,webp:78,jpeg:82,png:100},includeOriginal:!1,placeholder:!0,batchConcurrency:4,concurrency:4},F=j,V;try{V=await fp({...z,entries:hp(j,B)})}catch(re){if(F=await hb(j),F.length===j.length)throw re;let se=new Set(F.map((ae)=>ae.relativePath)),ie=!1;for(let ae of j){if(se.has(ae.relativePath))continue;let ue=yp(ae.absolutePath);if(!ue)continue;T[ae.relativePath]=ue,ie=!0}if(ie)xb(_,T);if(F.length===0)return Un(),{count:0,fingerprint:""};V=await fp({...z,entries:hp(F,B)})}let H=await gb(V.entries),G=mb(V.entries,H),J=Ui();J.catalog=new Map(Object.entries(V.entries)),J.transparent=H;let ne=H.size===0&&G.length===0?V.fingerprint:xp("sha256").update(V.fingerprint).update(JSON.stringify({transparent:[...H].sort(),droppedWebp:G.sort()})).digest("hex");return{count:F.length,fingerprint:ne}}var vb=new Map;function dl(v){if(!v)return;let _=v.split("?")[0].split("#")[0];return vb.get(_)}var wb={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},fl=[320,640,768,1024,1280,1536,1920];function Ft(v){return v.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Zt(v,_){if(v.serverDynamic[_]!==void 0)return String(v.serverDynamic[_]);let k=v.static[_];if(typeof k==="string")return k;return}function ea(v,_,k=!1){let E=v.serverDynamic[_];if(E!==void 0)return E!==!1&&E!=="false";let T=v.static[_];if(T!==void 0)return T!=="false"&&T!==!1;return k}function pl(v){if(v.includes("(")||v.includes(","))return v;let _=v.trim().split(/\s+/),k=[];for(let E of _)if(E.includes(":")){let[T,j]=E.split(":"),B=wb[T];if(B)k.push(`(max-width: ${B}px) ${j}`);else{let z=Number.parseInt(T);if(!Number.isNaN(z))k.push(`(max-width: ${z}px) ${j}`)}}else k.push(E);return k.join(", ")}function gl(v,_,k,E){return _.map((T)=>`${Hi(v,T,void 0,k,E)} ${T}w`).join(", ")}function Sb(v,_,k,E,T){return _.map((j)=>{let B=k?k*j:void 0;return`${Hi(v,B,void 0,E,T)} ${j}x`}).join(", ")}function Hi(v,_,k,E,T){if(!E||E==="local"||E==="static")return v;if(E==="cloudinary"){let j=[];if(_)j.push(`w_${_}`);if(k)j.push(`h_${k}`);if(T)j.push(`f_${T}`);j.push("q_auto");let B=j.join(",");return v.replace("/upload/",`/upload/${B}/`)}if(E==="imgix"){let j=new URLSearchParams;if(_)j.set("w",String(_));if(k)j.set("h",String(k));if(T)j.set("fm",T);j.set("auto","format");let B=v.includes("?")?"&":"?";return`${v}${B}${j.toString()}`}if(E==="bunny"){let j=new URLSearchParams;if(_)j.set("width",String(_));if(k)j.set("height",String(k));if(T)j.set("format",T);let B=v.includes("?")?"&":"?";return`${v}${B}${j.toString()}`}return v}function $b(v){return`var s=this.style;${v.map((_)=>`s.${_}=''`).join(";")}`}function _b(v,_,k="#e5e7eb"){let E=`<svg xmlns="http://www.w3.org/2000/svg" width="${v}" height="${_}"><rect width="100%" height="100%" fill="${k}"/></svg>`;return`data:image/svg+xml;base64,${btoa(E)}`}var ml={name:"StxImage",aliases:["Image","stx-image","stx-img"],render(v,_,k){let E=Zt(v,"src")||"",T=ts(E),j=Zt(v,"alt")||"",B=Zt(v,"width")||(T?String(T.source.width):void 0),z=Zt(v,"height")||(T?String(T.source.height):void 0),F=Zt(v,"sizes"),V=Zt(v,"srcset"),H=Zt(v,"densities"),G=Zt(v,"format"),J=ns(E)||dl(E)?.transparent===!0,ne=Zt(v,"placeholder")||(T&&!J?"thumbhash":void 0),re=Zt(v,"placeholderColor")||"#e5e7eb",se=Zt(v,"provider"),ie=Zt(v,"class")||Zt(v,"className")||"",ae=Zt(v,"style")||"",ue=Zt(v,"quality"),oe=ea(v,"lazy",!0),me=ea(v,"preload",!1),we=ea(v,"priority",!1),$e=Zt(v,"loading"),_e=Zt(v,"decoding")||"async",Re=!!T||ea(v,"picture",!1)||!!G,Ee=B?Number.parseInt(B):void 0,Ae=z?Number.parseInt(z):void 0,Te=V||"",ke="";if(T)Te=T.sources[T.fallback.format]||"",ke=F?pl(F):"100vw";else if(!Te&&F&&se&&se!=="local"&&se!=="static")Te=gl(E,fl,se,G),ke=pl(F);else if(!Te&&H){let ft=H.split(/\s+/).map((ut)=>Number.parseFloat(ut.replace("x","")));Te=Sb(E,ft,Ee,se,G)}else if(F)ke=pl(F);let Pe=[];if(ae)Pe.push(ae);if(Ee&&Ae)Pe.push(`aspect-ratio:${Ee}/${Ae}`);let Ge=[],De=ne==="blur"||ne==="color"||ne==="thumbhash";if(De&&!J){let ft=T?.placeholder?{dataUrl:T.placeholder.dataUrl,color:re}:dl(E);if(ft&&ne==="color")Pe.push(`background-color:${ft.color}`),Ge.push("backgroundColor");else if(ft)Pe.push(`background-color:${ft.color}`),Pe.push(`background-image:url(${ft.dataUrl})`),Pe.push("background-size:cover"),Pe.push("background-repeat:no-repeat"),Ge.push("backgroundColor","backgroundImage");else{let ut=_b(Ee||16,Ae||9,re);Pe.push(`background-image:url(${ut})`),Pe.push("background-size:cover"),Pe.push("background-repeat:no-repeat"),Ge.push("backgroundImage")}}else if(!De&&ne&&ne!=="empty"&&ne!=="none")Pe.push(`background-image:url(${Ft(ne)})`),Pe.push("background-size:cover"),Pe.push("background-repeat:no-repeat"),Ge.push("backgroundImage");let Ie=T?.fallback.url||Hi(E,Ee,Ae,se,G),Ye=[];if(Ye.push(`src="${Ft(yi(Ie,"fetched"))}"`),Ye.push(`alt="${Ft(j)}"`),B)Ye.push(`width="${Ft(B)}"`);if(z)Ye.push(`height="${Ft(z)}"`);let at=$e||(we||me?"eager":oe?"lazy":"");if(at)Ye.push(`loading="${Ft(at)}"`);if(we)Ye.push('fetchpriority="high"');if(Ye.push(`decoding="${Ft(_e)}"`),ie)Ye.push(`class="${Ft(ie)}"`);if(Pe.length>0)Ye.push(`style="${Ft(Pe.join(";"))}"`);if(Te)Ye.push(`srcset="${Ft(yi(Te,"fetched"))}"`);if(ke)Ye.push(`sizes="${Ft(ke)}"`);let dt=new Set(["src","alt","width","height","lazy","sizes","srcset","placeholder","placeholderColor","class","className","style","format","provider","quality","densities","preload","priority","picture","loading","decoding"]);if(Ge.length>0){let ft=typeof v.static.onload==="string"?v.static.onload:"",ut=$b(Ge)+(ft?`;${ft}`:"");Ye.push(`onload="${Ft(ut)}"`),dt.add("onload")}Ye.push(...wr(v,dt)),Ye.push(...Sr(v,dt));let et=`<img ${Ye.join(" ")} />`,It="";if(me){let ut=G==="webp"?"image/webp":G==="avif"?"image/avif":"";It=`<link rel="preload" as="image" href="${Ft(Ie)}"${ut?` type="${ut}"`:""}${Te?` imagesrcset="${Ft(Te)}"`:""}${ke?` imagesizes="${Ft(ke)}"`:""} />
1710
+ ${Io(`@method('${ne}')`,_)}`;return se}),E=E.replace(/@endform/g,"</form>"),E=E.replace(/@input\(\s*(?:'([^']+)'|"([^"]+)")\s*(?:,\s*(?:(?:'([^']*)'|"([^"]*)")\s*)?)?(?:,\s*\{([^}]+)\})?\s*\)/g,(T,j,B,z,F,V="")=>{let H=j||B||"",G=z||F||"",J=br(V),ne=zi(H,_),re=ne!==void 0&&ne!==null?ne:G||"",se=J.match(/type=['"]([^'"]+)['"]/i),ie=se?se[1]:"text",ae=Wi(H,_),ue=J.match(/class=['"]([^'"]+)['"]/i),oe=To(ue?ue[1]:"",k.input,ae,k.inputError),me=J.replace(/class=['"][^'"]+['"]/i,"");return me=me.replace(/type=['"][^'"]+['"]/i,""),`<input type="${Vt(ie)}" name="${Vt(H)}"${zs(J,$n(H))} value="${Vt(re)}" class="${oe}"${Qc(H,ae,J)}${me?` ${me}`:""}>`}),E=E.replace(/@textarea\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endtextarea/g,(T,j,B="",z="")=>{let F=br(B),V=zi(j,_)||z.trim(),H=Wi(j,_),G=F.match(/class=['"]([^'"]+)['"]/i),J=To(G?G[1]:"",k.input,H,k.inputError),ne=F.replace(/class=['"][^'"]+['"]/i,"");return`<textarea name="${Vt(j)}"${zs(F,$n(j))} class="${J}"${Qc(j,H,F)}${ne?` ${ne}`:""}>${Vt(V)}</textarea>`}),E=E.replace(/@select\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endselect/g,(T,j,B="",z)=>{let F=br(B),V=zi(j,_),H=Wi(j,_),G=F.match(/class=['"]([^'"]+)['"]/i),J=To(G?G[1]:"",k.input,H,k.inputError),ne=F.replace(/class=['"][^'"]+['"]/i,""),re=z;if(V!==void 0)re=z.replace(/(<option[^>]*value=['"]([^'"]+)['"][^>]*>)/gi,(se,ie,ae)=>{if((Array.isArray(V)?V.some((oe)=>String(oe)===ae):String(V)===ae)&&!ie.includes("selected"))return ie.replace(/(<option)/,"$1 selected");return se});return`<select name="${Vt(j)}"${zs(F,$n(j))} class="${J}"${Qc(j,H,F)}${ne?` ${ne}`:""}>${re}</select>`}),E=E.replace(/@checkbox\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?(?:,\s*\{([^}]+)\})?\)/g,(T,j,B,z="")=>{let F=B===void 0?"1":B,V=B===void 0?$n(j):`${$n(j)}-${$n(F)}`,H=br(z),G=zi(j,_),J=G!==void 0&&(Array.isArray(G)?G.some((ie)=>String(ie)===F):G===!0||String(G)===F),ne=H.match(/class=['"]([^'"]+)['"]/i),re=ne?ne[1]:k.checkInput,se=H.replace(/class=['"][^'"]+['"]/i,"");return`<input type="checkbox" name="${Vt(j)}"${zs(H,V)} value="${Vt(F)}" class="${re}"${J?" checked":""}${se?` ${se}`:""}>`}),E=E.replace(/@radio\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(T,j,B,z="")=>{let F=br(z),V=zi(j,_),H=V!==void 0&&V===B,G=F.match(/class=['"]([^'"]+)['"]/i),J=G?G[1]:k.checkInput,ne=F.replace(/class=['"][^'"]+['"]/i,"");return`<input type="radio" name="${Vt(j)}"${zs(F,`${$n(j)}-${$n(B)}`)} value="${Vt(B)}" class="${J}"${H?" checked":""}${ne?` ${ne}`:""}>`}),E=E.replace(/@file\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(T,j,B="")=>{let z=br(B),F=z.match(/accept=['"]([^'"]+)['"]/i),V=F?F[1]:"",H=z.includes("multiple"),G=Wi(j,_),J=z.match(/class=['"]([^'"]+)['"]/i),ne=To(J?J[1]:"",k.input,G,k.inputError),re=z.replace(/class=['"][^'"]+['"]/gi,"").replace(/accept=['"][^'"]+['"]/gi,"").replace(/\bmultiple\b/gi,"").trim(),se=[`<input type="file" name="${Vt(j)}"${zs(z,$n(j))}`,`class="${ne}"`];if(V)se.push(`accept="${Vt(V)}"`);if(H)se.push("multiple");if(re)se.push(re);return`${se.join(" ")}>`}),E=E.replace(/@label\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endlabel/g,(T,j,B="",z)=>{let F=br(B),V=F.match(/class=['"]([^'"]+)['"]/i),H=V?V[1]:k.label,G=F.replace(/class=['"][^'"]+['"]/i,"");return`<label for="${Vt($n(j))}" class="${H}"${G?` ${G}`:""}>${z}</label>`}),E}function np(v,_,k=ep){return v.replace(/@error\(['"]([^'"]+)['"]\)([\s\S]*?)@enderror/g,(E,T,j)=>{try{if(Wi(T,_)){let B=j.replace(/\{\{([^}]+)\}\}/g,(z,F)=>{try{if(F.trim()==="$message"||F.trim()==="message")return Qf(T,_);if(F.trim().includes("errors.first")||F.trim().includes("$errors.first")){if(typeof _.errors?.first==="function")return _.errors.first(T);return Qf(T,_)}let V=F.trim();if(p(V)){let H=c(V,_);return H!==void 0?String(H):V}return V}catch{return F}});return`<div id="${Vt(`${$n(T)}-error`)}" role="alert">${B}</div>`}return""}catch(B){return console.error("Error processing @error directive:",B),E}})}function Wi(v,_){if(!_.errors)return!1;if(typeof _.errors.has==="function")return _.errors.has(v);if(typeof _.errors==="object")return Object.prototype.hasOwnProperty.call(_.errors,v);return!1}function Qf(v,_){if(!_.errors)return"";if(typeof _.errors.get==="function")return _.errors.get(v);if(typeof _.errors==="object"&&Object.prototype.hasOwnProperty.call(_.errors,v)){let k=_.errors[v];return Array.isArray(k)?k[0]:String(k)}return""}function zi(v,_){let k;if(_.old&&typeof _.old==="function")return _.old(v);if(_.old&&typeof _.old==="object")return _.old[v];if(v.endsWith("[]")){let E=v.slice(0,-2);if(k=_[E],k!==void 0)return k}return _[v]}function br(v){if(!v.trim())return"";let _=[],k=v.trim(),E=/([\w-]+)\s*:\s*(['"]?)([^,'"]*)\2(?:\s*,\s*|\s*$)/g,T;while((T=E.exec(k))!==null){let[,j,,B]=T;_.push(`${j}="${B.trim()}"`)}return _.join(" ")}var Fi=/<\/?template\b[^>]*>/gi,Hx=/(?:^|\s)(?:id\s*=|(?:x-|[@:])(?:for|if|else(?:-if)?)(?=\s|=|$)|#[\w-]+(?:\s*=|\s|$)|v-slot(?::[\w-]+)?(?=\s|=|$)|slot\s*=)/i;function qx(v){let _=v.replace(/^<template\b/i,"").replace(/>$/,"");return Hx.test(_)}function Z(v){Fi.lastIndex=0;let _;while((_=Fi.exec(v))!==null){if(_[0].startsWith("</")||qx(_[0]))continue;let k=_.index,E=Fi.lastIndex,T=1,j;while((j=Fi.exec(v))!==null)if(j[0].startsWith("</")){if(T--,T===0){let B=j.index;return{start:k,openEnd:E,closeStart:B,end:Fi.lastIndex,content:v.slice(E,B)}}}else T++;return null}return null}import Bt from"path";import{existsSync as yv}from"fs";import Po from"fs";import Wt from"path";var rp=new Map;function Do(v,_=!0){let k=rp.get(v);if(_&&k)return k;let E=new Map,T=[Wt.join(v,"src"),Wt.join(v,"dist"),v];function j(B,z){if(z>6)return;let F;try{F=Po.readdirSync(B,{withFileTypes:!0})}catch{return}for(let V of F){let H=Wt.join(B,V.name);if(V.isDirectory()){if(V.name==="node_modules"||V.name.startsWith("."))continue;j(H,z+1)}else if(V.isFile()&&V.name.endsWith(".stx")){let G=V.name.slice(0,-4);if(!E.has(G))E.set(G,H);let J=G.toLowerCase();if(!E.has(J))E.set(J,H);let ne=G.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(!E.has(ne))E.set(ne,H)}}}for(let B of T)if(j(B,0),E.size>0)break;if(_)rp.set(v,E);return E}function Oo(v,_){if(v.startsWith(".")||v.startsWith("/"))return null;let k=_;while(!0){let E=Wt.join(k,"node_modules",v);try{if(Po.statSync(E).isDirectory())return E}catch{}let T=Wt.dirname(k);if(T===k)return null;k=T}}function Mo(v,_,k={}){return[Wt.resolve(Wt.dirname(_),`${v}.stx`),Wt.resolve(Wt.dirname(_),v),Wt.resolve(k.componentsDir||"components",`${v}.stx`),Wt.resolve(k.componentsDir||"components",v),v.endsWith(".stx")?v:`${v}.stx`]}function sp(v){let _=v.endsWith(".stx")?v.slice(0,-4):v,k=_.split("-").map((T)=>T.charAt(0).toUpperCase()+T.slice(1)).join(""),E=_.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();return[_,k,E]}function el(v,_){let[k,E,T]=sp(v);for(let j of[k,k.toLowerCase(),E,T]){let B=_?.__importedComponents?.get(j);if(B!==void 0)return B}}function*tl(v,_,k={},E){let T=sp(v);if(T[0].startsWith("./")||T[0].startsWith("../")){yield Wt.resolve(Wt.dirname(_),`${T[0]}.stx`);return}let j=[...new Set(T.map((F)=>`${F}.stx`))],B=k.projectRoot||process.cwd(),z=[...E?.__originalFilePath?[Wt.join(Wt.dirname(E.__originalFilePath),"components")]:[],...k.componentsDir?[k.componentsDir]:[],Wt.join(Wt.dirname(_),"components"),Wt.resolve(B,"src/components"),Wt.resolve(B,"components"),...import.meta.dir?[Wt.resolve(import.meta.dir,"components")]:[]];for(let F of new Set(z)){for(let V of j)yield Wt.join(F,V);try{for(let V of Po.readdirSync(F,{withFileTypes:!0}))if(V.isDirectory())for(let H of j)yield Wt.join(F,V.name,H)}catch{}}}function ip(v,_,k={},E){let T=el(v,E);if(T!==void 0)return T;for(let j of tl(v,_,k,E))try{if(Po.statSync(j,{throwIfNoEntry:!1})?.isFile())return j}catch{}return null}class op{builtins=new Map;registerBuiltin(v){this.builtins.set(v.name.toLowerCase(),v);for(let _ of v.aliases)this.builtins.set(_.toLowerCase(),v)}isBuiltin(v){return this.builtins.has(v.toLowerCase())}getBuiltin(v){return this.builtins.get(v.toLowerCase())??null}async resolveFile(v,_,k,E){let T=el(v,E);if(T!==void 0)return T;for(let j of tl(v,_,k,E))if(await r(j))return j;return null}}var Ws=new op;function Lt(v){return v.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}var vr="\x00stx-boolean-attribute";function nl(v){return v.indexOf("\x00")===-1?v:v.replace(/\0/g,"")}var Kx=new Set(["accesskey","autocapitalize","autofocus","class","contenteditable","dir","draggable","enterkeyhint","exportparts","hidden","id","inert","inputmode","is","itemid","itemprop","itemref","itemscope","itemtype","lang","nonce","part","role","slot","spellcheck","style","tabindex","title","translate","accept","action","alt","autocomplete","capture","cite","cols","colspan","content","controls","datetime","default","download","enctype","for","form","formaction","formenctype","formmethod","formnovalidate","formtarget","height","href","hreflang","kind","label","loading","loop","max","maxlength","media","method","min","minlength","multiple","muted","name","open","pattern","placeholder","playsinline","poster","preload","readonly","referrerpolicy","rel","required","reversed","rows","rowspan","scope","selected","shape","size","span","src","srcdoc","srclang","srcset","start","step","target","type","usemap","value","width","wrap"]);function rl(v){let _=v.toLowerCase();return _.startsWith("aria-")||_.startsWith("data-")||Kx.has(_)}function wr(v,_){let k=[];for(let[E,T]of Object.entries(v.static)){if(_.has(E))continue;let j=v.staticNames?.[E]??E;if(typeof T==="boolean"){if(T)k.push(Lt(j));continue}if(T===vr){k.push(Lt(j));continue}k.push(`${Lt(j)}="${Lt(nl(String(T)))}"`)}return k}function Sr(v,_){let k=[];for(let[E,T]of Object.entries(v.serverDynamic??{})){if(_.has(E))continue;if(T===null||T===void 0||T===!1)continue;let j=v.serverDynamicNames?.[E]??E;if(T===!0){k.push(Lt(j));continue}if(typeof T==="object")continue;k.push(`${Lt(j)}="${Lt(nl(String(T)))}"`)}return k}function Fs(v){return v.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Xx(v){if(v.clientReactive.to)return{value:v.clientReactive.to,reactive:!0};if(v.serverDynamic.to!==void 0)return{value:String(v.serverDynamic.to),reactive:!1};if(typeof v.static.to==="string")return{value:v.static.to,reactive:!1};return{value:"#",reactive:!1}}var sl={name:"StxLink",aliases:["stx-link"],render(v,_,k){let E=Xx(v),T=(typeof v.static.class==="string"?v.static.class:"")||(typeof v.static.className==="string"?v.static.className:""),j=typeof v.static.activeClass==="string"?v.static.activeClass:"active",B=typeof v.static.exactActiveClass==="string"?v.static.exactActiveClass:"exact-active",z=v.static.prefetch===!0||v.static.prefetch==="true"||v.serverDynamic.prefetch===!0,F=[];if(E.reactive)F.push(`:href="${Fs(E.value)}"`);else F.push(`href="${Fs(yi(E.value,"navigable"))}"`);if(T)F.push(`class="${Fs(T)}"`);if(F.push("data-stx-link"),F.push(`data-stx-active-class="${Fs(j)}"`),F.push(`data-stx-exact-active-class="${Fs(B)}"`),z)F.push("data-stx-prefetch");let V=typeof v.static.activeMatch==="string"?v.static.activeMatch.trim():"";if(V)F.push(`data-stx-active-match="${Fs(V)}"`);let H=new Set(["to","class","className","activeClass","exactActiveClass","activeMatch","prefetch"]);return F.push(...wr(v,H)),F.push(...Sr(v,H)),`<a ${F.join(" ")}>${_}</a>`}};import{createHash as xp}from"crypto";import Qt from"fs";import Ut from"path";import{decode as nb,generateThumbHash as rb}from"ts-images";import{createImageDeliveryCatalog as fp}from"ts-images/delivery";import il from"fs";function No(v,_,k){let E=Buffer.alloc(k),T=il.readSync(v,E,0,k,_);return E.subarray(0,T)}function ol(v){if(v.length<25)return!1;let _=(E,T)=>String.fromCharCode(...v.subarray(E,T));if(_(0,4)!=="RIFF"||_(8,12)!=="WEBP")return!1;let k=_(12,16);if(k==="VP8X")return(v[20]&16)!==0;if(k==="VP8L")return((v[21]|v[22]<<8|v[23]<<16|v[24]<<24)>>>28&1)===1;return!1}function al(v){let _;try{_=il.openSync(v,"r");let k=No(_,0,33);if(k.length>=3&&k[0]===255&&k[1]===216&&k[2]===255)return"none";if(k.length>=26&&k[0]===137&&k.toString("latin1",1,4)==="PNG"){let E=k[25];if(E===4||E===6)return"possible";let T=8;for(let j=0;j<64;j++){let B=No(_,T,8);if(B.length<8)return"unknown";let z=B.toString("latin1",4,8);if(z==="tRNS")return"possible";if(z==="IDAT"||z==="IEND")return"none";T+=12+B.readUInt32BE(0)}return"unknown"}if(k.length>=25&&k.toString("latin1",0,4)==="RIFF"&&k.toString("latin1",8,12)==="WEBP"){if(ol(k))return"possible";let E=k.toString("latin1",12,16);return E==="VP8 "||E==="VP8X"?"none":"unknown"}return"unknown"}catch{return"unknown"}finally{if(_!==void 0)il.closeSync(_)}}import Zx from"fs";import jo from"os";import{join as ap}from"path";import{fileURLToPath as cp}from"url";import{Worker as lp}from"worker_threads";var Bo=Symbol("stx.image-worker.unavailable");function Gx(v=typeof jo.availableParallelism==="function"?jo.availableParallelism():jo.cpus().length){return Math.max(1,Math.min(2,v-1))}var Lo=0,dp=[];async function Jx(){if(Lo<Gx()){Lo++;return}await new Promise((v)=>dp.push(v)),Lo++}function Yx(){Lo--,dp.shift()?.()}var Qx="@stacksjs/stx/builtins/image-warmup-worker";function eb(v=process.cwd()){let _=import.meta.url.endsWith(".ts")?"ts":"js";try{let k=new URL(`./image-warmup-worker.${_}`,import.meta.url);if(k.protocol==="file:"&&Zx.existsSync(cp(k)))return cp(k)}catch{}try{let k=typeof Bun<"u"?Bun.resolveSync(Qx,v):void 0;return k&&tb(k)?k:void 0}catch{return}}function tb(v,_=process.env){let k=v.replace(/\\/g,"/");if(k.split("/").some((T)=>/@\d[^/]*@@@\d+$/.test(T)))return!1;return![_.BUN_INSTALL_CACHE_DIR,ap(_.BUN_INSTALL||ap(jo.homedir(),".bun"),"install","cache")].filter((T)=>!!T).map((T)=>`${T.replace(/\\/g,"/").replace(/\/$/,"")}/`).some((T)=>k.startsWith(T))}var up=!1;function Vi(v){if(!up)up=!0,console.warn(`[stx] image worker unavailable (${v}); running the image pass on the serving thread instead. Results are the same, but requests may stall while it runs.`);return Bo}function cl(v){return v instanceof Error?v.message:String(v)}async function ll(v,_){if(typeof lp!=="function")return Vi("node:worker_threads has no Worker in this runtime");let k=eb();if(!k)return Vi("no image-warmup-worker entry beside this module or in the installed @stacksjs/stx");await Jx();try{return await new Promise((E,T)=>{let j;try{j=new lp(k)}catch(V){E(Vi(`could not start ${k}: ${cl(V)}`));return}let B=!1,z=!1,F=(V)=>{if(z)return;z=!0,V(),j.terminate()};j.on("message",(V)=>{if(V.type==="ready"){B=!0,j.postMessage({task:v,args:_});return}if(V.type==="result"){F(()=>E(V.value));return}let H=Error(V.error?.message??"image worker failed");if(V.error?.name)H.name=V.error.name;if(V.error?.stack)H.stack=V.error.stack;F(()=>T(H))}),j.on("error",(V)=>{F(()=>B?T(V instanceof Error?V:Error(cl(V)||"image worker crashed")):E(Vi(`the worker failed before it was ready: ${cl(V)}`)))}),j.on("exit",(V)=>{F(()=>B?T(Error("image worker exited before it finished")):E(Vi(`the worker exited with code ${V} before it was ready`)))})})}finally{Yx()}}var sb=new Set([".avif",".jpeg",".jpg",".png",".webp"]),ib=[320,640,960,1280,1920],Fo="/_stx/images",ob=`stx:${Fo}:alpha-1`,ab=["@stacksjs/ts-webp","@stacksjs/ts-avif"],zo;function cb(v,_){let k=Ut.dirname(Bun.resolveSync(v,_));while(k!==Ut.dirname(k)){let E=Ut.join(k,"package.json");if(Qt.existsSync(E)){let T=JSON.parse(Qt.readFileSync(E,"utf8"));if(T.name===v)return T.version}k=Ut.dirname(k)}return}function lb(){if(zo!==void 0)return zo;let v;try{v=Ut.dirname(Bun.resolveSync("ts-images",import.meta.dir))}catch{}return zo=ab.map((_)=>{let k;try{k=v?cb(_,v):void 0}catch{}return`${_.replace("@stacksjs/","")}@${k??"unknown"}`}).join("+"),zo}var pp=Symbol.for("stx.image-delivery");function Ui(){let v=globalThis;return v[pp]??={catalog:new Map,transparent:new Set},v[pp]}var gp=new Set;function ub(v){return`/${v.split(Ut.sep).map(encodeURIComponent).join("/")}`}function db(v){let _=Ut.extname(v),k=v.slice(0,-_.length).replace(/[^a-zA-Z0-9_-]+/g,"-").replace(/^-+|-+$/g,""),E=xp("sha256").update(v).digest("hex").slice(0,8);return`${k||"image"}-${E}`}function mp(v,_=`stx:${Fo}`){let k=(E)=>`${Fo}/${E.split("/").map(encodeURIComponent).join("/")}`;return{cacheNamespace:_,async stat(E){let T=Ut.join(v,E);try{let j=await Qt.promises.stat(T);return j.size>0?{bytes:j.size,path:T,url:k(E)}:null}catch{return null}},async write(E,T){let j=Ut.join(v,E);await Qt.promises.mkdir(Ut.dirname(j),{recursive:!0});let B=`${j}.${process.pid}.tmp`;return await Qt.promises.writeFile(B,T),await Qt.promises.rename(B,j),{bytes:T.byteLength,path:j,url:k(E)}},url:k}}async function bp(v,_=v){let k=await Qt.promises.readdir(_,{withFileTypes:!0});k.sort((T,j)=>T.name.localeCompare(j.name));let E=[];for(let T of k){let j=Ut.join(_,T.name);if(T.isDirectory()){E.push(...await bp(v,j));continue}if(!T.isFile()||!sb.has(Ut.extname(T.name).toLowerCase()))continue;E.push({absolutePath:j,relativePath:Ut.relative(v,j)})}return E}function hp(v,_){return v.map((k)=>({key:ub(k.relativePath),input:k.absolutePath,name:db(k.relativePath),...fb(k.absolutePath)?{options:{storage:_}}:{}}))}function fb(v){return al(v)==="possible"}function pb(v){for(let _=3;_<v.length;_+=4)if(v[_]!==255)return!0;return!1}async function gb(v){let _=Object.entries(v).filter(([,T])=>T.fallback.format==="png"),k=new Set,E=8;for(let T=0;T<_.length;T+=8)await Promise.all(_.slice(T,T+8).map(async([j,B])=>{let z=B.variants.filter((F)=>F.format==="png").sort((F,V)=>F.width-V.width)[0];try{let F=await nb(new Uint8Array(await Qt.promises.readFile(z?.path??B.fallback.path)));if(pb(F.data))k.add(j)}catch{k.add(j)}}));return k}function mb(v,_){let k=[];for(let E of _){let T=v[E],j=T?.variants.filter((z)=>z.format==="webp")??[];if(!T||j.length===0)continue;if(!j.some((z)=>{let F;try{return F=Qt.openSync(z.path,"r"),!ol(No(F,0,32))}catch{return!0}finally{if(F!==void 0)Qt.closeSync(F)}}))continue;if(T.variants=T.variants.filter((z)=>z.format!=="webp"),delete T.sources.webp,k.push(E),!gp.has(E))gp.add(E),console.warn(`[stx-images] ${E} is transparent but its WebP variants have no alpha channel; serving PNG instead. Upgrade @stacksjs/ts-webp to 0.1.6 or later.`)}return k}async function hb(v){let _=[],k=8;for(let E=0;E<v.length;E+=8){let T=v.slice(E,E+8),j=await Promise.all(T.map(async(B)=>{try{return await rb(B.absolutePath),B}catch{return console.warn(`[stx-images] Skipping unreadable raster: ${B.relativePath}`),null}}));_.push(...j.filter((B)=>B!==null))}return _}function ul(v){return Ut.join(v,"undecodable.json")}function yb(v){try{let _=Qt.readFileSync(ul(v),"utf-8"),k=JSON.parse(_);return k&&typeof k==="object"?k:{}}catch{return{}}}function xb(v,_){try{Qt.mkdirSync(Ut.dirname(ul(v)),{recursive:!0}),Qt.writeFileSync(ul(v),JSON.stringify(_))}catch{}}function yp(v){try{let _=Qt.statSync(v);return{mtimeMs:_.mtimeMs,size:_.size}}catch{return}}function vp(v){if(!v||v.startsWith("data:")||v.startsWith("blob:")||/^https?:\/\//i.test(v)||v.startsWith("//"))return;let _=v.split(/[?#]/,1)[0];if(!_)return;try{return`/${_.replace(/^\/+/,"").split("/").map(decodeURIComponent).map(encodeURIComponent).join("/")}`}catch{return}}function ts(v){let _=vp(v);return _?Ui().catalog.get(_):void 0}function ns(v){let _=vp(v);return _?Ui().transparent.has(_):!1}function rs(v){let _=(E)=>v.variants.filter((T)=>T.format===E).reduce((T,j)=>T+j.bytes,0),k=_(v.fallback.format);return["avif","webp"].map((E)=>({format:E,srcset:v.sources[E]||"",bytes:_(E)})).filter((E)=>E.srcset&&E.bytes>0&&E.bytes<k).sort((E,T)=>E.bytes-T.bytes).map(({format:E,srcset:T})=>({format:E,srcset:T}))}function Wd(v){let _=ts(v);if(!_)return;return{src:_.fallback.url,srcset:_.sources[_.fallback.format]||"",sources:rs(_).map(({format:k,srcset:E})=>({type:`image/${k}`,srcset:E})),width:_.source.width,height:_.source.height,placeholder:ns(v)?void 0:_.placeholder?.dataUrl}}function Un(){let v=Ui();v.catalog=new Map,v.transparent=new Set}function bb(v){let _=Ui();_.catalog=new Map(v.entries),_.transparent=new Set(v.transparent)}async function qd(v,_,k={}){if(!v||!Qt.existsSync(v))return Un(),{count:0,fingerprint:""};if(k.offThread){let re=await ll("delivery",{publicDir:v,outputDir:_});if(re!==Bo)return bb(re.state),re.result}let E=await bp(v);if(E.length===0)return Un(),{count:0,fingerprint:""};let T=yb(_),j=E.filter((re)=>{let se=T[re.relativePath];if(!se)return!0;let ie=yp(re.absolutePath);return!ie||ie.mtimeMs!==se.mtimeMs||ie.size!==se.size});if(j.length===0)return Un(),{count:0,fingerprint:""};let B=mp(Ut.join(_,"_stx","images"),`${ob}:${lb()}`),z={outDir:Ut.join(_,"_stx","images"),storage:mp(Ut.join(_,"_stx","images")),baseUrl:Fo,widths:ib,formats:["avif","webp"],quality:{avif:70,webp:78,jpeg:82,png:100},includeOriginal:!1,placeholder:!0,batchConcurrency:4,concurrency:4},F=j,V;try{V=await fp({...z,entries:hp(j,B)})}catch(re){if(F=await hb(j),F.length===j.length)throw re;let se=new Set(F.map((ae)=>ae.relativePath)),ie=!1;for(let ae of j){if(se.has(ae.relativePath))continue;let ue=yp(ae.absolutePath);if(!ue)continue;T[ae.relativePath]=ue,ie=!0}if(ie)xb(_,T);if(F.length===0)return Un(),{count:0,fingerprint:""};V=await fp({...z,entries:hp(F,B)})}let H=await gb(V.entries),G=mb(V.entries,H),J=Ui();J.catalog=new Map(Object.entries(V.entries)),J.transparent=H;let ne=H.size===0&&G.length===0?V.fingerprint:xp("sha256").update(V.fingerprint).update(JSON.stringify({transparent:[...H].sort(),droppedWebp:G.sort()})).digest("hex");return{count:F.length,fingerprint:ne}}var vb=new Map;function dl(v){if(!v)return;let _=v.split("?")[0].split("#")[0];return vb.get(_)}var wb={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},fl=[320,640,768,1024,1280,1536,1920];function Ft(v){return v.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Zt(v,_){if(v.serverDynamic[_]!==void 0)return String(v.serverDynamic[_]);let k=v.static[_];if(typeof k==="string")return k;return}function ea(v,_,k=!1){let E=v.serverDynamic[_];if(E!==void 0)return E!==!1&&E!=="false";let T=v.static[_];if(T!==void 0)return T!=="false"&&T!==!1;return k}function pl(v){if(v.includes("(")||v.includes(","))return v;let _=v.trim().split(/\s+/),k=[];for(let E of _)if(E.includes(":")){let[T,j]=E.split(":"),B=wb[T];if(B)k.push(`(max-width: ${B}px) ${j}`);else{let z=Number.parseInt(T);if(!Number.isNaN(z))k.push(`(max-width: ${z}px) ${j}`)}}else k.push(E);return k.join(", ")}function gl(v,_,k,E){return _.map((T)=>`${Hi(v,T,void 0,k,E)} ${T}w`).join(", ")}function Sb(v,_,k,E,T){return _.map((j)=>{let B=k?k*j:void 0;return`${Hi(v,B,void 0,E,T)} ${j}x`}).join(", ")}function Hi(v,_,k,E,T){if(!E||E==="local"||E==="static")return v;if(E==="cloudinary"){let j=[];if(_)j.push(`w_${_}`);if(k)j.push(`h_${k}`);if(T)j.push(`f_${T}`);j.push("q_auto");let B=j.join(",");return v.replace("/upload/",`/upload/${B}/`)}if(E==="imgix"){let j=new URLSearchParams;if(_)j.set("w",String(_));if(k)j.set("h",String(k));if(T)j.set("fm",T);j.set("auto","format");let B=v.includes("?")?"&":"?";return`${v}${B}${j.toString()}`}if(E==="bunny"){let j=new URLSearchParams;if(_)j.set("width",String(_));if(k)j.set("height",String(k));if(T)j.set("format",T);let B=v.includes("?")?"&":"?";return`${v}${B}${j.toString()}`}return v}function $b(v){return`var s=this.style;${v.map((_)=>`s.${_}=''`).join(";")}`}function _b(v,_,k="#e5e7eb"){let E=`<svg xmlns="http://www.w3.org/2000/svg" width="${v}" height="${_}"><rect width="100%" height="100%" fill="${k}"/></svg>`;return`data:image/svg+xml;base64,${btoa(E)}`}var ml={name:"StxImage",aliases:["Image","stx-image","stx-img"],render(v,_,k){let E=Zt(v,"src")||"",T=ts(E),j=Zt(v,"alt")||"",B=Zt(v,"width")||(T?String(T.source.width):void 0),z=Zt(v,"height")||(T?String(T.source.height):void 0),F=Zt(v,"sizes"),V=Zt(v,"srcset"),H=Zt(v,"densities"),G=Zt(v,"format"),J=ns(E)||dl(E)?.transparent===!0,ne=Zt(v,"placeholder")||(T&&!J?"thumbhash":void 0),re=Zt(v,"placeholderColor")||"#e5e7eb",se=Zt(v,"provider"),ie=Zt(v,"class")||Zt(v,"className")||"",ae=Zt(v,"style")||"",ue=Zt(v,"quality"),oe=ea(v,"lazy",!0),me=ea(v,"preload",!1),ve=ea(v,"priority",!1),$e=Zt(v,"loading"),_e=Zt(v,"decoding")||"async",Re=!!T||ea(v,"picture",!1)||!!G,Ee=B?Number.parseInt(B):void 0,Ae=z?Number.parseInt(z):void 0,Te=V||"",ke="";if(T)Te=T.sources[T.fallback.format]||"",ke=F?pl(F):"100vw";else if(!Te&&F&&se&&se!=="local"&&se!=="static")Te=gl(E,fl,se,G),ke=pl(F);else if(!Te&&H){let ft=H.split(/\s+/).map((ut)=>Number.parseFloat(ut.replace("x","")));Te=Sb(E,ft,Ee,se,G)}else if(F)ke=pl(F);let Pe=[];if(ae)Pe.push(ae);if(Ee&&Ae)Pe.push(`aspect-ratio:${Ee}/${Ae}`);let Ge=[],De=ne==="blur"||ne==="color"||ne==="thumbhash";if(De&&!J){let ft=T?.placeholder?{dataUrl:T.placeholder.dataUrl,color:re}:dl(E);if(ft&&ne==="color")Pe.push(`background-color:${ft.color}`),Ge.push("backgroundColor");else if(ft)Pe.push(`background-color:${ft.color}`),Pe.push(`background-image:url(${ft.dataUrl})`),Pe.push("background-size:cover"),Pe.push("background-repeat:no-repeat"),Ge.push("backgroundColor","backgroundImage");else{let ut=_b(Ee||16,Ae||9,re);Pe.push(`background-image:url(${ut})`),Pe.push("background-size:cover"),Pe.push("background-repeat:no-repeat"),Ge.push("backgroundImage")}}else if(!De&&ne&&ne!=="empty"&&ne!=="none")Pe.push(`background-image:url(${Ft(ne)})`),Pe.push("background-size:cover"),Pe.push("background-repeat:no-repeat"),Ge.push("backgroundImage");let Ie=T?.fallback.url||Hi(E,Ee,Ae,se,G),Ye=[];if(Ye.push(`src="${Ft(yi(Ie,"fetched"))}"`),Ye.push(`alt="${Ft(j)}"`),B)Ye.push(`width="${Ft(B)}"`);if(z)Ye.push(`height="${Ft(z)}"`);let at=$e||(ve||me?"eager":oe?"lazy":"");if(at)Ye.push(`loading="${Ft(at)}"`);if(ve)Ye.push('fetchpriority="high"');if(Ye.push(`decoding="${Ft(_e)}"`),ie)Ye.push(`class="${Ft(ie)}"`);if(Pe.length>0)Ye.push(`style="${Ft(Pe.join(";"))}"`);if(Te)Ye.push(`srcset="${Ft(yi(Te,"fetched"))}"`);if(ke)Ye.push(`sizes="${Ft(ke)}"`);let dt=new Set(["src","alt","width","height","lazy","sizes","srcset","placeholder","placeholderColor","class","className","style","format","provider","quality","densities","preload","priority","picture","loading","decoding"]);if(Ge.length>0){let ft=typeof v.static.onload==="string"?v.static.onload:"",ut=$b(Ge)+(ft?`;${ft}`:"");Ye.push(`onload="${Ft(ut)}"`),dt.add("onload")}Ye.push(...wr(v,dt)),Ye.push(...Sr(v,dt));let et=`<img ${Ye.join(" ")} />`,It="";if(me){let ut=G==="webp"?"image/webp":G==="avif"?"image/avif":"";It=`<link rel="preload" as="image" href="${Ft(Ie)}"${ut?` type="${ut}"`:""}${Te?` imagesrcset="${Ft(Te)}"`:""}${ke?` imagesizes="${Ft(ke)}"`:""} />
1711
1711
  `}if(Re){let ft=[];if(T)for(let ut of rs(T))ft.push(`<source type="image/${ut.format}" srcset="${Ft(ut.srcset)}"${ke?` sizes="${Ft(ke)}"`:""} />`);if(!T&&(G==="avif"||G==="auto")){let ut=Hi(E,Ee,Ae,se,"avif"),st=Te?gl(E,fl,se,"avif"):`${ut}`;ft.push(`<source type="image/avif" srcset="${Ft(st)}"${ke?` sizes="${Ft(ke)}"`:""} />`)}if(!T&&(G==="webp"||G==="auto")){let ut=Hi(E,Ee,Ae,se,"webp"),st=Te?gl(E,fl,se,"webp"):`${ut}`;ft.push(`<source type="image/webp" srcset="${Ft(st)}"${ke?` sizes="${Ft(ke)}"`:""} />`)}return`${It}<picture>
1712
1712
  ${ft.join(`
1713
1713
  `)}
@@ -1849,7 +1849,7 @@ document.addEventListener("focusout",function(e){
1849
1849
  });
1850
1850
  })();
1851
1851
  `}function Cp(v,..._){for(let k of _){if(v.serverDynamic[k]!==void 0)return String(v.serverDynamic[k]);let E=v.static[k];if(typeof E==="string")return E}return}function Rp(v,_){let k=new RegExp(`<(template|div|span)[^>]*\\bslot=["']${_}["'][^>]*>([\\s\\S]*?)<\\/\\1>`,"i"),E=v.match(k);if(!E)return{region:null,rest:v};return{region:E[2],rest:v.replace(E[0],"")}}var _l={name:"Suspense",aliases:["suspense"],render(v,_,k){let E=Rp(_,"fallback"),T=E.rest,j=Rp(T,"error"),B=j.rest,z=E.region??Cp(v,"fallback")??'<div class="stx-suspense-loading">Loading\u2026</div>',F=j.region??Cp(v,"errorFallback","error-fallback")??'<div class="stx-suspense-error">Something went wrong.</div>';return`<div data-stx-suspense><div data-stx-suspense-fallback>${z}</div><div data-stx-suspense-error hidden>${F}</div><div data-stx-suspense-content hidden>${B}</div></div>`}};function sa(v,..._){for(let k of _){if(v.serverDynamic[k]!==void 0)return String(v.serverDynamic[k]);let E=v.static[k];if(typeof E==="string")return E}return}var kl={name:"TransitionGroup",aliases:["transition-group"],render(v,_,k){let E=(sa(v,"name")||"v").replace(/["'<>]/g,""),T=(sa(v,"tag")||"div").replace(/[^a-z0-9-]/gi,"")||"div",j=sa(v,"class"),B=sa(v,"id"),z=[`data-stx-transition-group="${E}"`,j?`class="${j}"`:"",B?`id="${B}"`:""].filter(Boolean).join(" ");return`<${T} ${z}>${_}</${T}>`}};function Ap(v=Ws){v.registerBuiltin(sl),v.registerBuiltin(ml),v.registerBuiltin(hl),v.registerBuiltin(xl),v.registerBuiltin(bl),v.registerBuiltin(vl),v.registerBuiltin(wl),v.registerBuiltin(Sl),v.registerBuiltin(_l),v.registerBuiltin(kl)}function ia(v){return v.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}var Tp=new Map;function Pb(v){let _=Tp.get(v.source);if(!_)_=new RegExp(`(${v.source})(?![\\w.:-])`,"y"),Tp.set(v.source,_);return _}var Ip=new WeakMap;function Pp(v){let _=Ip.get(v);if(!_)_=new Set([...v].map((E)=>E.toLowerCase())),Ip.set(v,_);let k=_;return(E)=>!/[a-z]/.test(E)&&k.has(E.toLowerCase())}function Db(v,_){let k="";for(let E=_;E<v.length;E++){let T=v[E];if(k){if(T==="\\")E++;else if(T===k)k=""}else if(T==='"'||T==="'")k=T;else if(T===">")return E}return v.length}function Dp(v,_,k){let E=[],T=0,j=typeof k==="function"?k:k?(B)=>k.has(B.toLowerCase()):void 0;while(T<v.length){let B=v.indexOf("<",T);if(B===-1)break;let z=Pb(_);z.lastIndex=B+1;let F=z.exec(v);if(!F){T=B+1;continue}let V=F[1];if(j&&j(V)){let ie=B+1+V.length;while(ie<v.length&&v[ie]!==">")ie++;T=ie+1;continue}let H=B+1+V.length,G=null,J=H,ne=-1,re=!1;while(H<v.length){let ie=v[H];if(G){if(ie==="\\"&&H+1<v.length){H+=2;continue}if(ie===G)G=null;H++;continue}if(ie==='"'||ie==="'"){G=ie,H++;continue}if(ie==="/"&&H+1<v.length&&v[H+1]===">"){ne=H+2,re=!0;break}if(ie===">"){ne=H+1;break}H++}if(ne===-1){T=B+1;continue}let se=v.slice(J,re?ne-2:ne-1).trim();if(re)E.push({fullMatch:v.slice(B,ne),tagName:V,attributes:se,content:"",startIndex:B,endIndex:ne,isSelfClosing:!0}),T=ne;else{let ie=`<${V}`,ae=`</${V}>`,ue=1,oe=ne,me=-1;while(ue>0&&oe<v.length){let _e=v.indexOf(ie,oe),Re=v.indexOf(ae,oe);if(Re===-1)break;if(_e!==-1&&_e<Re){let Ee=v[_e+ie.length];if(Ee===" "||Ee===">"||Ee==="/"||Ee===`
1852
- `||Ee==="\t"){let Ae=Db(v,_e+ie.length);if(v[Ae-1]!=="/")ue++;oe=Ae+1}else oe=_e+ie.length}else{if(ue--,ue===0){me=Re;break}oe=Re+ae.length}}if(me===-1){T=ne;continue}let we=v.slice(ne,me),$e=me+ae.length;E.push({fullMatch:v.slice(B,$e),tagName:V,attributes:se,content:we,startIndex:B,endIndex:$e,isSelfClosing:!1}),T=$e}}return E}function Op(v){return v.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#0?39;/g,"'").replace(/&#x27;/gi,"'").replace(/&amp;/g,"&")}function Mp(v,_){try{let k=Buffer.from(v,"base64").toString("utf8");return JSON.parse(k)}catch{}try{let k=v.replace(/&quot;/g,'"').replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&");return JSON.parse(k)}catch(k){if(_?.debug)console.error("Error decoding __stx_ prop:",k);return v}}function El(v,_){let k=0,E="",T=_;while(T<v.length){let j=v[T];if(E){if(j==="\\")T++;else if(j===E)E=""}else if(j==='"'||j==="'"||j==="`")E=j;else if(j==="{")k++;else if(j==="}"){if(k--,k===0)return v.slice(_,T+1)}T++}return v.slice(_)}function Np(v){let _=v.trim();if(!_.startsWith("{")||!_.endsWith("}"))return null;if(El(_,0).length!==_.length)return null;return _.slice(1,-1).trim()}var Ob=new Set(["disabled","checked","readonly","required","autofocus","autoplay","controls","default","defer","formnovalidate","hidden","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","reversed","selected"]),Mb=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function Nb(v){return Cl(v).map((_)=>[_.start,_.end])}function Cl(v){let _=[],k=/<([a-zA-Z][a-zA-Z0-9-]*)\b((?:[^>"']|"[^"]*"|'[^']*')*)\s*\/?>/g,E;while((E=k.exec(v))!==null){let T=E[2]||"",j=/(?:^|\s)(?::for|x-for|v-for|@for)\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'>]+))/.exec(T);if(!j)continue;let B=Ns(j[1]??j[2]??j[3]??""),z=E.index,F=z+E[0].length,V=E[1].toLowerCase();if(E[0].endsWith("/>")||Mb.has(V)){_.push({start:z,end:F,names:B});continue}let H=V.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),G=new RegExp(`<\\/?${H}\\b(?:[^>"']|"[^"]*"|'[^']*')*>`,"gi");G.lastIndex=F;let J=1,ne=F,re;while((re=G.exec(v))!==null)if(re[0].startsWith("</")){if(J--,J===0){ne=re.index+re[0].length;break}}else if(!re[0].endsWith("/>"))J++;_.push({start:z,end:ne,names:B})}return _}function jp(v){if(typeof v==="string")return v;if(Array.isArray(v))return v.filter(Boolean).map((_)=>jp(_)).join(" ");if(v&&typeof v==="object")return Object.entries(v).filter(([,_])=>_).map(([_])=>_).join(" ");return v?String(v):""}function Lp(v,_){if(!/:[\w-]+=/.test(v))return v;let k=v,E=/<(script|style)\b[^>]*>[\s\S]*?<\/\1>/gi,T=[],j;while((j=E.exec(v))!==null)T.push([j.index,j.index+j[0].length]);T.push(...Nb(v));let B=new Set(mr(_));function z(J){return T.some(([ne,re])=>J>=ne&&J<re)}let F=/<([a-zA-Z][a-zA-Z0-9-]*)\b((?:[^>"']|"[^"]*"|'[^']*')*?)\s*(\/?)>/g,V=[],H=new Map,G=256;while((j=F.exec(k))!==null){if(z(j.index))continue;let J=j[0],ne=j[2];if(!ne||!ne.includes(":"))continue;let re=/\s:([a-zA-Z_][\w-]*)\s*=\s*"([^"]*)"/g,se,ie=ne,ae=!1;while((se=re.exec(ne))!==null){let ue=se[1],oe=se[2];if(Oi(ue))continue;if(Ar(oe,B))continue;if(oe.includes("()")&&!oe.includes(".get(")||oe.includes("$store")||oe.includes("$ref"))continue;try{let me=Object.keys(_),we=Object.values(_),$e=oe.match(/^([a-zA-Z_$][\w$]*)/);if($e&&!me.includes($e[1])&&!["true","false","null","undefined","Math","JSON","String","Number","Array","Object","Date","parseInt","parseFloat"].includes($e[1]))continue;let _e=JSON.stringify([me,oe]),Re=H.get(_e);if(!Re){if(Re=Function(...me,`return (${oe})`),H.size>=G)H.clear();H.set(_e,Re)}let Ee=Re(...we);if(ue==="class"){let Ae=jp(Ee);if(Ae){let Te=ie.match(/\sclass="([^"]*)"/);if(Te)ie=ie.replace(Te[0],` class="${Te[1]} ${Ae}"`);else ie=ie.replace(se[0],` class="${Ae}"`)}else ie=ie.replace(se[0],"");ae=!0;continue}if(Ob.has(ue)){if(Ee)ie=ie.replace(se[0],` ${ue}`);else ie=ie.replace(se[0],"");ae=!0;continue}if(Ee===null||Ee===void 0||Ee===!1)ie=ie.replace(se[0],"");else{let Ae=String(Ee).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;");ie=ie.replace(se[0],` ${ue}="${Ae}"`)}ae=!0}catch{continue}}if(ae){let ue=j[3]?" /":"",me=`<${j[1]}${ie}${ue}>`;V.push({start:j.index,end:j.index+J.length,replacement:me})}}if(V.length>0){let J=Array(V.length*2+1),ne=0;for(let re=0;re<V.length;re++){let{start:se,end:ie,replacement:ae}=V[re];J[re*2]=k.slice(ne,se),J[re*2+1]=ae,ne=ie}J[V.length*2]=k.slice(ne),k=J.join("")}return k}import Jp from"path";import Al from"fs";import Zi from"path";function Bp(v,_,k,E){let T=0;for(let j=_;j<v.length;j++)if(v[j]===k)T++;else if(v[j]===E&&!(E===">"&&v[j-1]==="=")){if(--T===0)return j}return-1}function jb(v){let _=s(v),k=0,E=0,T=[];for(let j=0;j<_.length;j++)if("([{".includes(_[j]))k++;else if(")]}".includes(_[j]))k--;else if(_[j]===","&&k===0)T.push(v.slice(E,j).trim()),E=j+1;return T.push(v.slice(E).trim()),T}function Rl(v,_){let k=s(v),E=new RegExp(`\\b(?:${_.map((T)=>T.replace(/[$]/g,"\\$&")).join("|")})\\s*(?=[<(])`,"g");for(let T of k.matchAll(E)){let j=T.index+T[0].length,B="";if(k[j]==="<"){let F=Bp(k,j,"<",">");if(F<0)continue;B=v.slice(j+1,F),j=F+1;while(/\s/.test(k[j]||"")&&j<k.length)j++}if(k[j]!=="(")continue;let z=Bp(k,j,"(",")");if(z>=0)return{type:B,args:jb(v.slice(j+1,z))}}return null}var zp=`
1852
+ `||Ee==="\t"){let Ae=Db(v,_e+ie.length);if(v[Ae-1]!=="/")ue++;oe=Ae+1}else oe=_e+ie.length}else{if(ue--,ue===0){me=Re;break}oe=Re+ae.length}}if(me===-1){T=ne;continue}let ve=v.slice(ne,me),$e=me+ae.length;E.push({fullMatch:v.slice(B,$e),tagName:V,attributes:se,content:ve,startIndex:B,endIndex:$e,isSelfClosing:!1}),T=$e}}return E}function Op(v){return v.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#0?39;/g,"'").replace(/&#x27;/gi,"'").replace(/&amp;/g,"&")}function Mp(v,_){try{let k=Buffer.from(v,"base64").toString("utf8");return JSON.parse(k)}catch{}try{let k=v.replace(/&quot;/g,'"').replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&");return JSON.parse(k)}catch(k){if(_?.debug)console.error("Error decoding __stx_ prop:",k);return v}}function El(v,_){let k=0,E="",T=_;while(T<v.length){let j=v[T];if(E){if(j==="\\")T++;else if(j===E)E=""}else if(j==='"'||j==="'"||j==="`")E=j;else if(j==="{")k++;else if(j==="}"){if(k--,k===0)return v.slice(_,T+1)}T++}return v.slice(_)}function Np(v){let _=v.trim();if(!_.startsWith("{")||!_.endsWith("}"))return null;if(El(_,0).length!==_.length)return null;return _.slice(1,-1).trim()}var Ob=new Set(["disabled","checked","readonly","required","autofocus","autoplay","controls","default","defer","formnovalidate","hidden","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","reversed","selected"]),Mb=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function Nb(v){return Cl(v).map((_)=>[_.start,_.end])}function Cl(v){let _=[],k=/<([a-zA-Z][a-zA-Z0-9-]*)\b((?:[^>"']|"[^"]*"|'[^']*')*)\s*\/?>/g,E;while((E=k.exec(v))!==null){let T=E[2]||"",j=/(?:^|\s)(?::for|x-for|v-for|@for)\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'>]+))/.exec(T);if(!j)continue;let B=Ns(j[1]??j[2]??j[3]??""),z=E.index,F=z+E[0].length,V=E[1].toLowerCase();if(E[0].endsWith("/>")||Mb.has(V)){_.push({start:z,end:F,names:B});continue}let H=V.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),G=new RegExp(`<\\/?${H}\\b(?:[^>"']|"[^"]*"|'[^']*')*>`,"gi");G.lastIndex=F;let J=1,ne=F,re;while((re=G.exec(v))!==null)if(re[0].startsWith("</")){if(J--,J===0){ne=re.index+re[0].length;break}}else if(!re[0].endsWith("/>"))J++;_.push({start:z,end:ne,names:B})}return _}function jp(v){if(typeof v==="string")return v;if(Array.isArray(v))return v.filter(Boolean).map((_)=>jp(_)).join(" ");if(v&&typeof v==="object")return Object.entries(v).filter(([,_])=>_).map(([_])=>_).join(" ");return v?String(v):""}function Lp(v,_){if(!/:[\w-]+=/.test(v))return v;let k=v,E=/<(script|style)\b[^>]*>[\s\S]*?<\/\1>/gi,T=[],j;while((j=E.exec(v))!==null)T.push([j.index,j.index+j[0].length]);T.push(...Nb(v));let B=new Set(mr(_));function z(J){return T.some(([ne,re])=>J>=ne&&J<re)}let F=/<([a-zA-Z][a-zA-Z0-9-]*)\b((?:[^>"']|"[^"]*"|'[^']*')*?)\s*(\/?)>/g,V=[],H=new Map,G=256;while((j=F.exec(k))!==null){if(z(j.index))continue;let J=j[0],ne=j[2];if(!ne||!ne.includes(":"))continue;let re=/\s:([a-zA-Z_][\w-]*)\s*=\s*"([^"]*)"/g,se,ie=ne,ae=!1;while((se=re.exec(ne))!==null){let ue=se[1],oe=se[2];if(Oi(ue))continue;if(Ar(oe,B))continue;if(oe.includes("()")&&!oe.includes(".get(")||oe.includes("$store")||oe.includes("$ref"))continue;try{let me=Object.keys(_),ve=Object.values(_),$e=oe.match(/^([a-zA-Z_$][\w$]*)/);if($e&&!me.includes($e[1])&&!["true","false","null","undefined","Math","JSON","String","Number","Array","Object","Date","parseInt","parseFloat"].includes($e[1]))continue;let _e=JSON.stringify([me,oe]),Re=H.get(_e);if(!Re){if(Re=Function(...me,`return (${oe})`),H.size>=G)H.clear();H.set(_e,Re)}let Ee=Re(...ve);if(ue==="class"){let Ae=jp(Ee);if(Ae){let Te=ie.match(/\sclass="([^"]*)"/);if(Te)ie=ie.replace(Te[0],` class="${Te[1]} ${Ae}"`);else ie=ie.replace(se[0],` class="${Ae}"`)}else ie=ie.replace(se[0],"");ae=!0;continue}if(Ob.has(ue)){if(Ee)ie=ie.replace(se[0],` ${ue}`);else ie=ie.replace(se[0],"");ae=!0;continue}if(Ee===null||Ee===void 0||Ee===!1)ie=ie.replace(se[0],"");else{let Ae=String(Ee).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;");ie=ie.replace(se[0],` ${ue}="${Ae}"`)}ae=!0}catch{continue}}if(ae){let ue=j[3]?" /":"",me=`<${j[1]}${ie}${ue}>`;V.push({start:j.index,end:j.index+J.length,replacement:me})}}if(V.length>0){let J=Array(V.length*2+1),ne=0;for(let re=0;re<V.length;re++){let{start:se,end:ie,replacement:ae}=V[re];J[re*2]=k.slice(ne,se),J[re*2+1]=ae,ne=ie}J[V.length*2]=k.slice(ne),k=J.join("")}return k}import Jp from"path";import Al from"fs";import Zi from"path";function Bp(v,_,k,E){let T=0;for(let j=_;j<v.length;j++)if(v[j]===k)T++;else if(v[j]===E&&!(E===">"&&v[j-1]==="=")){if(--T===0)return j}return-1}function jb(v){let _=s(v),k=0,E=0,T=[];for(let j=0;j<_.length;j++)if("([{".includes(_[j]))k++;else if(")]}".includes(_[j]))k--;else if(_[j]===","&&k===0)T.push(v.slice(E,j).trim()),E=j+1;return T.push(v.slice(E).trim()),T}function Rl(v,_){let k=s(v),E=new RegExp(`\\b(?:${_.map((T)=>T.replace(/[$]/g,"\\$&")).join("|")})\\s*(?=[<(])`,"g");for(let T of k.matchAll(E)){let j=T.index+T[0].length,B="";if(k[j]==="<"){let F=Bp(k,j,"<",">");if(F<0)continue;B=v.slice(j+1,F),j=F+1;while(/\s/.test(k[j]||"")&&j<k.length)j++}if(k[j]!=="(")continue;let z=Bp(k,j,"(",")");if(z>=0)return{type:B,args:jb(v.slice(j+1,z))}}return null}var zp=`
1853
1853
  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;
1854
1854
  type __StxWiden<T> = T extends string ? string : T extends number ? number : T extends boolean ? boolean : T;
1855
1855
  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>;
@@ -1864,9 +1864,9 @@ namespace ${_} {
1864
1864
  ${j}
1865
1865
  ${V.join(`
1866
1866
  `)}
1867
- }`,props:H,events:G}}var Xi=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 on(v){if(v.includes("-")||v==="component")return!1;if(/^[A-Z]/.test(v))return!/[a-z]/.test(v)&&[...Xi].some((_)=>_.toLowerCase()===v.toLowerCase());return Xi.has(v)||/[A-Z]/.test(v)}function*Lb(v){let _=/<([A-Za-z][\w.-]*)(?=[\s/>])/g,k;while(k=_.exec(v)){let E=_.lastIndex,T=[];while(E<v.length){while(/\s/.test(v[E]||""))E++;if(v[E]===">"||v.slice(E,E+2)==="/>"){E+=v[E]===">"?1:2;break}let j=/^[^\s=/>]+/.exec(v.slice(E))?.[0];if(!j){E++;continue}let B=E;E+=j.length;while(/\s/.test(v[E]||""))E++;if(v[E]!=="="){T.push({name:j,value:!0,offset:B,braced:!1});continue}E++;while(/\s/.test(v[E]||""))E++;let z=v[E],F=z==="{",V=z==='"'||z==="'";if(V||F)E++;let H=E;if(F){let G=s(v.slice(E)),J=1,ne=0;for(;ne<G.length;ne++){if(G[ne]==="{")J++;if(G[ne]==="}"&&--J===0)break}E+=ne}else if(V)while(E<v.length&&v[E]!==z)E++;else while(E<v.length&&!/[\s/>]/.test(v[E]))E++;if(T.push({name:j,value:v.slice(H,E),offset:H,braced:F}),V||F)E++}_.lastIndex=E,yield{name:k[1],offset:k.index,attributes:T}}}function Fp(v,_,k){let E=[],T=[zp,"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 __StxEvent<E, K> = K extends keyof E ? E[K] extends readonly unknown[] ? Exclude<E[K]["length"], 0 | 1> extends never ? E[K][0] : E[K] : E[K] : any;'],j=new Map,B=new Map,z=new Map,F=k.scriptCode(v,k.filePath),V=s(F);for(let re of F.matchAll(/\bimport\s+(\{[^}]+\}|[\w$]+)\s+from\s*['"]([^'"]+)['"]/g)){if(V.slice(re.index,re.index+6)!=="import")continue;let se=re[2],ie=Zi.isAbsolute(se)||se.startsWith(".")?Zi.resolve(Zi.dirname(k.filePath),se):Oo(se,Zi.dirname(k.filePath));if(!ie)continue;let ae=ie.endsWith(".stx")?ie:Al.existsSync(`${ie}.stx`)?`${ie}.stx`:void 0,ue=ae?null:Do(ie,!1),oe=re[1].startsWith("{")?re[1].slice(1,-1).split(","):[re[1]];for(let me of oe){let[we,$e=we]=me.trim().split(/\s+as\s+/),_e=ae||ue?.get(we)||ue?.get(we.toLowerCase());if(_e)z.set($e,_e),z.set($e.toLowerCase(),_e),z.set($e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),_e)}}for(let re of _.matchAll(/@import\s*\(([^)]+)\)/g))for(let se of re[1].matchAll(/['"]([^'"]+)['"]/g)){let ie=Mo(se[1],k.filePath,k).find((ae)=>Al.statSync(ae,{throwIfNoEntry:!1})?.isFile());if(ie)z.set(Zi.basename(se[1]).replace(/\.stx$/,""),ie)}let H={__importedComponents:z},G=new Map,J=(re,se,ie)=>{let ae=v.slice(0,re);return{code:se,offset:re,attribute:ie,anchor:!0,kind:"directive",line:ae.split(`
1867
+ }`,props:H,events:G}}var Xi=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 on(v){if(v.includes("-")||v==="component")return!1;if(/^[A-Z]/.test(v))return!/[a-z]/.test(v)&&[...Xi].some((_)=>_.toLowerCase()===v.toLowerCase());return Xi.has(v)||/[A-Z]/.test(v)}function*Lb(v){let _=/<([A-Za-z][\w.-]*)(?=[\s/>])/g,k;while(k=_.exec(v)){let E=_.lastIndex,T=[];while(E<v.length){while(/\s/.test(v[E]||""))E++;if(v[E]===">"||v.slice(E,E+2)==="/>"){E+=v[E]===">"?1:2;break}let j=/^[^\s=/>]+/.exec(v.slice(E))?.[0];if(!j){E++;continue}let B=E;E+=j.length;while(/\s/.test(v[E]||""))E++;if(v[E]!=="="){T.push({name:j,value:!0,offset:B,braced:!1});continue}E++;while(/\s/.test(v[E]||""))E++;let z=v[E],F=z==="{",V=z==='"'||z==="'";if(V||F)E++;let H=E;if(F){let G=s(v.slice(E)),J=1,ne=0;for(;ne<G.length;ne++){if(G[ne]==="{")J++;if(G[ne]==="}"&&--J===0)break}E+=ne}else if(V)while(E<v.length&&v[E]!==z)E++;else while(E<v.length&&!/[\s/>]/.test(v[E]))E++;if(T.push({name:j,value:v.slice(H,E),offset:H,braced:F}),V||F)E++}_.lastIndex=E,yield{name:k[1],offset:k.index,attributes:T}}}function Fp(v,_,k){let E=[],T=[zp,"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 __StxEvent<E, K> = K extends keyof E ? E[K] extends readonly unknown[] ? Exclude<E[K]["length"], 0 | 1> extends never ? E[K][0] : E[K] : E[K] : any;'],j=new Map,B=new Map,z=new Map,F=k.scriptCode(v,k.filePath),V=s(F);for(let re of F.matchAll(/\bimport\s+(\{[^}]+\}|[\w$]+)\s+from\s*['"]([^'"]+)['"]/g)){if(V.slice(re.index,re.index+6)!=="import")continue;let se=re[2],ie=Zi.isAbsolute(se)||se.startsWith(".")?Zi.resolve(Zi.dirname(k.filePath),se):Oo(se,Zi.dirname(k.filePath));if(!ie)continue;let ae=ie.endsWith(".stx")?ie:Al.existsSync(`${ie}.stx`)?`${ie}.stx`:void 0,ue=ae?null:Do(ie,!1),oe=re[1].startsWith("{")?re[1].slice(1,-1).split(","):[re[1]];for(let me of oe){let[ve,$e=ve]=me.trim().split(/\s+as\s+/),_e=ae||ue?.get(ve)||ue?.get(ve.toLowerCase());if(_e)z.set($e,_e),z.set($e.toLowerCase(),_e),z.set($e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),_e)}}for(let re of _.matchAll(/@import\s*\(([^)]+)\)/g))for(let se of re[1].matchAll(/['"]([^'"]+)['"]/g)){let ie=Mo(se[1],k.filePath,k).find((ae)=>Al.statSync(ae,{throwIfNoEntry:!1})?.isFile());if(ie)z.set(Zi.basename(se[1]).replace(/\.stx$/,""),ie)}let H={__importedComponents:z},G=new Map,J=(re,se,ie)=>{let ae=v.slice(0,re);return{code:se,offset:re,attribute:ie,anchor:!0,kind:"directive",line:ae.split(`
1868
1868
  `).length,column:re-ae.lastIndexOf(`
1869
- `)}},ne=(re,se,ie)=>E.push({expression:re,statement:{text:se+re.code+ie,prefixLength:se.length}});for(let re of Lb(_)){if(on(re.name)||re.name==="component")continue;let se=ip(re.name,k.filePath,k,H);if(!se)continue;let ie=G.get(se);if(!ie){let ue;try{ue=k.readComponent?k.readComponent(se):Al.readFileSync(se,"utf8")}catch{continue}if(ue===void 0)continue;B.set(se,ue),ie=Wp(k.scriptCode(ue,se),`__StxComponent${G.size}`),G.set(se,ie),T.push(ie.declarations)}let ae=[];for(let ue of re.attributes){let{name:oe,offset:me}=ue,we=ue.value===!0?"true":ue.value;if(oe.startsWith("@")||oe.startsWith("v-on:")){if(ie.events&&ue.value!==!0)j.set(me,`__StxEvent<${ie.events}, ${JSON.stringify(oe.replace(/^@|^v-on:/,"").split(".")[0])}>`);continue}let $e=/^v-model(?::([\w-]+))?(?:\.[\w-]+)*$/.exec(oe);if(oe.startsWith("v-")&&!oe.startsWith("v-bind:")&&!$e)continue;if(/^(?:x-|:)(?:if|for|show|key|else)(?:$|[.:-])/.test(oe))continue;let _e=($e?$e[1]||"modelValue":oe.replace(/^:|^v-bind:/,"")).replace(/-([a-z])/g,(Ae,Te)=>Te.toUpperCase());if(ae.push(_e),!ie.props)continue;let Ee=oe.startsWith(":")||oe.startsWith("v-bind:")||!!$e||ue.braced?we:ue.value!==!0?JSON.stringify(we):"true";ne(J(me,Ee,oe),";void ((",`) satisfies __StxProp<${ie.props}, ${JSON.stringify(_e)}>);`)}if(ie.props){let ue=[...new Set(ae)].map((me)=>`${JSON.stringify(me)}: undefined as any`).join(", "),oe=J(re.offset,`<${re.name}>`);E.push({expression:oe,statement:{text:`;void ({ ${ue} } satisfies ${ie.props} & Record<string, unknown>);`,prefixLength:0}})}}return{declarations:G.size?T.join(`
1869
+ `)}},ne=(re,se,ie)=>E.push({expression:re,statement:{text:se+re.code+ie,prefixLength:se.length}});for(let re of Lb(_)){if(on(re.name)||re.name==="component")continue;let se=ip(re.name,k.filePath,k,H);if(!se)continue;let ie=G.get(se);if(!ie){let ue;try{ue=k.readComponent?k.readComponent(se):Al.readFileSync(se,"utf8")}catch{continue}if(ue===void 0)continue;B.set(se,ue),ie=Wp(k.scriptCode(ue,se),`__StxComponent${G.size}`),G.set(se,ie),T.push(ie.declarations)}let ae=[];for(let ue of re.attributes){let{name:oe,offset:me}=ue,ve=ue.value===!0?"true":ue.value;if(oe.startsWith("@")||oe.startsWith("v-on:")){if(ie.events&&ue.value!==!0)j.set(me,`__StxEvent<${ie.events}, ${JSON.stringify(oe.replace(/^@|^v-on:/,"").split(".")[0])}>`);continue}let $e=/^v-model(?::([\w-]+))?(?:\.[\w-]+)*$/.exec(oe);if(oe.startsWith("v-")&&!oe.startsWith("v-bind:")&&!$e)continue;if(/^(?:x-|:)(?:if|for|show|key|else)(?:$|[.:-])/.test(oe))continue;let _e=($e?$e[1]||"modelValue":oe.replace(/^:|^v-bind:/,"")).replace(/-([a-z])/g,(Ae,Te)=>Te.toUpperCase());if(ae.push(_e),!ie.props)continue;let Ee=oe.startsWith(":")||oe.startsWith("v-bind:")||!!$e||ue.braced?ve:ue.value!==!0?JSON.stringify(ve):"true";ne(J(me,Ee,oe),";void ((",`) satisfies __StxProp<${ie.props}, ${JSON.stringify(_e)}>);`)}if(ie.props){let ue=[...new Set(ae)].map((me)=>`${JSON.stringify(me)}: undefined as any`).join(", "),oe=J(re.offset,`<${re.name}>`);E.push({expression:oe,statement:{text:`;void ({ ${ue} } satisfies ${ie.props} & Record<string, unknown>);`,prefixLength:0}})}}return{declarations:G.size?T.join(`
1870
1870
  `):"",checks:E,events:j,dependencies:B}}var Vp=/<script(\s[^>]*)?>([\s\S]*?)<\/script>/gi;function Bb(v){let _=(k)=>k.replace(/[^\n]/g," ");return v.replace(/<!--[\s\S]*?-->/g,_).replace(/\{\{--[\s\S]*?--\}\}/g,_)}function He(v){let _=[],k=Bb(v);Vp.lastIndex=0;let E;while((E=Vp.exec(k))!==null){let T=(E[1]||"").trim(),j=(E[0].match(/^<script(?:\s[^>]*)?>/i)?.[0]??"<script>").length,B=(E[0].match(/<\/script\s*>$/i)?.[0]??"</script>").length,z=E.index+j,F=E.index+E[0].length-B,V=v.slice(z,F);if(/\bsrc\s*=/.test(T))continue;let H=T.match(/\btype\s*=\s*["']([^"']+)["']/i);if(H&&!/^(?:module|text\/(?:javascript|typescript))$/i.test(H[1]))continue;let G=/\bserver\b/.test(T)?"server":/\bclient\b/.test(T)?"client":"plain",J=Gi(v,z);_.push({kind:G,code:V,startLine:J,startColumn:Ji(v,z),offset:z,attrs:T})}return _}function Gi(v,_){let k=1;for(let E=0;E<_&&E<v.length;E++)if(v.charCodeAt(E)===10)k++;return k}function Ji(v,_){let k=v.lastIndexOf(`
1871
1871
  `,_-1)+1;return _-k+1}function oa(v){let _=v.split(""),k=(T,j)=>{for(let B=T;B<j&&B<_.length;B++)if(_[B]!==`
1872
1872
  `)_[B]=" "},E=[/<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 T of E){T.lastIndex=0;let j;while((j=T.exec(v))!==null)k(j.index,j.index+j[0].length)}return _.join("")}function zb(v){let _=0,k="";for(let E=0;E<v.length;E++){let T=v[E];if(k){if(T==="\\"){E++;continue}if(T===k)k="";continue}if(T==='"'||T==="'"||T==="`"){k=T;continue}if(T==="("||T==="["||T==="{"){_++;continue}if(T===")"||T==="]"||T==="}"){_--;continue}if(T==="|"&&_===0){if(v[E+1]==="|"){E++;continue}if(v[E-1]==="|")continue;return v.slice(0,E)}}return v}var Yp=new Set([":for","x-for","v-for"]),aa=/(?:^|\s)((?::|x-|v-|@)[\w.:-]+)\s*=\s*(["'])([\s\S]*?)\2/g,Tl="__stx_interpolated",Up="__StxElement",Qp="__StxTemplateValue",Wb=`type ${Qp}<T> = T extends { readonly _isSignal: true } | { readonly _isDerived: true } ? (T extends () => infer V ? T & V : T) : T`;function Hp(v){return v.replace(/\{\{[\s\S]*?\}\}/g,Tl).replace(/\{!![\s\S]*?!!\}/g,Tl)}function ss(v){return v.replace(/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/g,(_)=>{let k=_.split(`
@@ -1880,13 +1880,13 @@ ${V.join(`
1880
1880
  `)}if(k.length===0)return T.length>0?["",`// ${Kp}`,...T].join(`
1881
1881
  `):"";let{imports:j,body:B}=Zb(v),z=B.replace(/^[ \t]*export[ \t]+(?=(?:const|let|var|function|async|class)\b)/gm,""),F=["",`// ${Kp}`];if(j)F.push(j);return F.push(...T),F.push(`async function ${Xp}() {`,z,` return { ${k.join(", ")} }`,"}",`type ${Zp} = Awaited<ReturnType<typeof ${Xp}>>`,...k.map((V)=>`declare var ${V}: ${Zp}[${JSON.stringify(V)}]`)),F.join(`
1882
1882
  `)}function Pl(v){let k=s(v).split(""),E=0;for(let T=0;T<k.length;T++){let j=k[T];if(j==="{"||j==="("||j==="["){E++;continue}if(j==="}"||j===")"||j==="]"){E=Math.max(0,E-1);continue}if(E>0&&j!==`
1883
- `)k[T]=" "}return Q(k.join(""))}function ei(v,_){if(eg(v)!==null)return[];let k=s(_),E=new Set(y);return Pl(v).filter((T)=>{if(E.has(T))return!1;if(Q(_).includes(T))return!1;return new RegExp(`(?<![.#\\w$])${T}(?![\\w$])`).test(k)})}var Kp="stx: types for the declared client payload (#1868)",Jb="stx: untyped bridge names \u2014 declare a defineClientPayload to check these (#1868)",Xp="__stxServerScope",Zp="__StxClientPayload";var Gp=["$env","$user","$slot","$slots","$attrs","$props","$page","$route","$loop","loop","$errors","$csrf","props","slot"];var Yb=/^\s*[A-Z_$][\w$]*\s*=[^=]/i;function Qb(v){let _=new Map,k=/!|===|!==|==|!=|&&|\|\||<|>|\btypeof\b|\binstanceof\b|\bin\b/;for(let E of v){let T=s(E),{depths:j,balanced:B}=ve(T);if(!B)continue;let z=/^([ \t]*(?:export[ \t]+)?const[ \t]+)([A-Za-z_$][\w$]*)[ \t]*(?::[^=\n]+)?=[ \t]*([^\n]+)$/gm;for(let F of T.matchAll(z)){let V=F.index??0;if(j[V+F[1].length]!==0)continue;let H=F[2],G=V+F[0].length-F[3].length,J=E.slice(G,V+F[0].length).trim().replace(/;$/,"").trim(),ne=F[3],re=k.test(ne)&&!/\bawait\b|=>|\bfunction\b|[{}]/.test(ne)&&!/[,+\-*/%&|?:=]$/.test(J)&&ve(ne).balanced;_.set(H,_.has(H)||!re?null:J)}}return new Map([..._].filter((E)=>E[1]!==null))}function ng(v,_,k=0,E=new Set){if(_.size===0||k>=5)return v;let T=s(v),j="",B=0;for(let z of T.matchAll(/[A-Za-z_$][\w$]*/g)){let F=z.index??0,V=z[0],H=_.get(V);if(!H||E.has(V))continue;let G=T.slice(0,F).trimEnd(),J=T.slice(F+V.length).trimStart();if(G.endsWith(".")||/^:(?!:)/.test(J)&&/[{,]$/.test(G))continue;if(F>0&&/[\w$]/.test(T[F-1]))continue;j+=`${v.slice(B,F)}(${ng(H,_,k+1,new Set([...E,V]))})`,B=F+V.length}return j+v.slice(B)}function ev(v,_){let k=/@(if|unless|elseif|else|endif|endunless)\b\s*(\()?/g,E=[],T;while((T=k.exec(v))!==null){if(T.index>_)break;let j=T[1];if(T.index===_){if(j==="elseif"){let z=E[E.length-1];if(z?.current)z.seen.push(z.current);if(z)z.current=null}break}if(j==="endif"||j==="endunless"){E.pop();continue}let B="";if(T[2]==="("){let z=0,F=T.index+T[0].length-1,V=F+1;for(;F<v.length;F++){let H=v[F];if(H==="(")z++;else if(H===")"){if(z--,z===0)break}}B=v.slice(V,F).trim(),k.lastIndex=F+1}if(j==="if")E.push({seen:[],current:B});else if(j==="unless")E.push({seen:[],current:`!(${B})`});else if(j==="elseif"||j==="else"){let z=E[E.length-1];if(!z)continue;if(z.current)z.seen.push(z.current);z.current=j==="elseif"?B:null}}return E.flatMap((j)=>[...j.seen.map((B)=>`!(${B})`),...j.current?[j.current]:[]]).filter(Boolean)}function tv(v){let _=v.code.trim();if(!_)return null;if(v.attribute?.startsWith("@")){if(Yb.test(_))return null;let E=";(($event: any): void => { ";return{text:`${E}${_} });`,prefixLength:E.length}}let k=";void ((";return{text:`${k}${_}));`,prefixLength:k.length}}var nv=/(\bfrom\s*|\bimport\s*\(\s*|\bimport\s+)(['"])(\.{1,2}\/[^'"\n]*)\2/g;function Wn(v,_){if(!_)return v;return v.replace(nv,(k,E,T,j)=>{let B=Jp.resolve(_,j).replace(/\\/g,"/");return`${E}${T}${B}${T}`})}function is(v){return" ".repeat(Math.max(0,(v.startColumn??1)-1))}function rv(v){let _=new Set,k=s(v);for(let E of k.matchAll(/\bimport\s+(?:type\s+)?([\w$*{}\s,]+?)\s+from\b/g)){let T=E[1],j=/\{([^}]*)\}/.exec(T);for(let V of j?.[1].split(",")??[]){let H=V.trim().replace(/^type\s+/,"").split(/\s+as\s+/).pop()?.trim();if(H&&/^[A-Z_$][\w$]*$/i.test(H))_.add(H)}let B=T.replace(/\{[^}]*\}/,""),z=/\*\s*as\s+([A-Z_$][\w$]*)/i.exec(B);if(z)_.add(z[1]);let F=/^\s*([A-Z_$][\w$]*)/i.exec(B);if(F&&F[1]!=="type")_.add(F[1])}return[..._].sort()}function ti(v,_={}){let k=He(v),E=v.split(`
1883
+ `)k[T]=" "}return Q(k.join(""))}function ei(v,_){if(eg(v)!==null)return[];let k=s(_),E=new Set(y);return Pl(v).filter((T)=>{if(E.has(T))return!1;if(Q(_).includes(T))return!1;return new RegExp(`(?<![.#\\w$])${T}(?![\\w$])`).test(k)})}var Kp="stx: types for the declared client payload (#1868)",Jb="stx: untyped bridge names \u2014 declare a defineClientPayload to check these (#1868)",Xp="__stxServerScope",Zp="__StxClientPayload";var Gp=["$env","$user","$slot","$slots","$attrs","$props","$page","$route","$loop","loop","$errors","$csrf","props","slot"];var Yb=/^\s*[A-Z_$][\w$]*\s*=[^=]/i;function Qb(v){let _=new Map,k=/!|===|!==|==|!=|&&|\|\||<|>|\btypeof\b|\binstanceof\b|\bin\b/;for(let E of v){let T=s(E),{depths:j,balanced:B}=we(T);if(!B)continue;let z=/^([ \t]*(?:export[ \t]+)?const[ \t]+)([A-Za-z_$][\w$]*)[ \t]*(?::[^=\n]+)?=[ \t]*([^\n]+)$/gm;for(let F of T.matchAll(z)){let V=F.index??0;if(j[V+F[1].length]!==0)continue;let H=F[2],G=V+F[0].length-F[3].length,J=E.slice(G,V+F[0].length).trim().replace(/;$/,"").trim(),ne=F[3],re=k.test(ne)&&!/\bawait\b|=>|\bfunction\b|[{}]/.test(ne)&&!/[,+\-*/%&|?:=]$/.test(J)&&we(ne).balanced;_.set(H,_.has(H)||!re?null:J)}}return new Map([..._].filter((E)=>E[1]!==null))}function ng(v,_,k=0,E=new Set){if(_.size===0||k>=5)return v;let T=s(v),j="",B=0;for(let z of T.matchAll(/[A-Za-z_$][\w$]*/g)){let F=z.index??0,V=z[0],H=_.get(V);if(!H||E.has(V))continue;let G=T.slice(0,F).trimEnd(),J=T.slice(F+V.length).trimStart();if(G.endsWith(".")||/^:(?!:)/.test(J)&&/[{,]$/.test(G))continue;if(F>0&&/[\w$]/.test(T[F-1]))continue;j+=`${v.slice(B,F)}(${ng(H,_,k+1,new Set([...E,V]))})`,B=F+V.length}return j+v.slice(B)}function ev(v,_){let k=/@(if|unless|elseif|else|endif|endunless)\b\s*(\()?/g,E=[],T;while((T=k.exec(v))!==null){if(T.index>_)break;let j=T[1];if(T.index===_){if(j==="elseif"){let z=E[E.length-1];if(z?.current)z.seen.push(z.current);if(z)z.current=null}break}if(j==="endif"||j==="endunless"){E.pop();continue}let B="";if(T[2]==="("){let z=0,F=T.index+T[0].length-1,V=F+1;for(;F<v.length;F++){let H=v[F];if(H==="(")z++;else if(H===")"){if(z--,z===0)break}}B=v.slice(V,F).trim(),k.lastIndex=F+1}if(j==="if")E.push({seen:[],current:B});else if(j==="unless")E.push({seen:[],current:`!(${B})`});else if(j==="elseif"||j==="else"){let z=E[E.length-1];if(!z)continue;if(z.current)z.seen.push(z.current);z.current=j==="elseif"?B:null}}return E.flatMap((j)=>[...j.seen.map((B)=>`!(${B})`),...j.current?[j.current]:[]]).filter(Boolean)}function tv(v){let _=v.code.trim();if(!_)return null;if(v.attribute?.startsWith("@")){if(Yb.test(_))return null;let E=";(($event: any): void => { ";return{text:`${E}${_} });`,prefixLength:E.length}}let k=";void ((";return{text:`${k}${_}));`,prefixLength:k.length}}var nv=/(\bfrom\s*|\bimport\s*\(\s*|\bimport\s+)(['"])(\.{1,2}\/[^'"\n]*)\2/g;function Wn(v,_){if(!_)return v;return v.replace(nv,(k,E,T,j)=>{let B=Jp.resolve(_,j).replace(/\\/g,"/");return`${E}${T}${B}${T}`})}function is(v){return" ".repeat(Math.max(0,(v.startColumn??1)-1))}function rv(v){let _=new Set,k=s(v);for(let E of k.matchAll(/\bimport\s+(?:type\s+)?([\w$*{}\s,]+?)\s+from\b/g)){let T=E[1],j=/\{([^}]*)\}/.exec(T);for(let V of j?.[1].split(",")??[]){let H=V.trim().replace(/^type\s+/,"").split(/\s+as\s+/).pop()?.trim();if(H&&/^[A-Z_$][\w$]*$/i.test(H))_.add(H)}let B=T.replace(/\{[^}]*\}/,""),z=/\*\s*as\s+([A-Z_$][\w$]*)/i.exec(B);if(z)_.add(z[1]);let F=/^\s*([A-Z_$][\w$]*)/i.exec(B);if(F&&F[1]!=="type")_.add(F[1])}return[..._].sort()}function ti(v,_={}){let k=He(v),E=v.split(`
1884
1884
  `),T=Array.from({length:E.length},()=>""),j=new Map,B=_.filePath&&_.templateExpressions!==!1?Fp(v,oa(v),{filePath:_.filePath,componentsDir:_.componentsDir,projectRoot:_.projectRoot,readComponent:_.readComponent,scriptCode:(G,J)=>He(G).map((ne)=>Wn(ne.code,Jp.dirname(J))).join(`
1885
1885
  `)}):void 0,z=new Set,F=[];for(let G of k){let J=os(ss(G.code)),ne=Wn(J,_.originDir??"").split(`
1886
1886
  `);ne.forEach((re,se)=>{let ie=G.startLine-1+se;if(ie<T.length)T[ie]=se===0?is(G)+re:re,z.add(ie)}),F.push(G.startLine-1+ne.length-1)}for(let G of F){let J=T[G]?.trim()===""?G:G+1;if(J<T.length&&T[J].trim()===""&&(J===G||!z.has(J)))T[J]=";"}let V=(G,J)=>{for(let[ne,re]of G.split(`
1887
1887
  `).entries())if(T.push(re),J)j.set(T.length,ne===0?J:{...J,line:J.line+ne,column:1,prefixLength:0})};if(_.globals!==!1){V("");let G=new Set([...k.flatMap((se)=>Q(se.code)),...k.flatMap((se)=>rv(se.code))]),J=(se)=>{if(!G.has(se))V(`declare var ${se}: any`)};if(_.runtimeGlobals!==!1){if(!G.has("window"))V("declare var window: any");for(let se of y)J(se)}let ne=[...new Set([...Il,...W,...Gp])].filter((se)=>_.runtimeGlobals!==!1||!y.includes(se));if(_.contextScope==="global"){V("declare global {");for(let se of ne)V(` var ${se}: any`);V("}")}else{for(let se of Il)J(se);for(let se of W)J(se);for(let se of Gp)J(se)}V(`declare var ${Tl}: any`);let re=new Set(k.flatMap((se)=>Q(se.code)));V(`type ${Up}<T> = T extends readonly (infer E)[] ? E : T extends Iterable<infer E2> ? E2 : any`);for(let se of qb(v)){if(re.has(se.name))continue;let ie=se.iterable&&re.has(se.iterable)?`${Up}<typeof ${se.iterable}>`:"any";V(`declare var ${se.name}: ${ie}`)}}if(_.templateExpressions!==!1){if(B?.declarations)for(let J of B.declarations.split(`
1888
- `))V(J);let G=fc(v).map((J)=>{let ne=B?.events.get(J.offset??-1);if(ne){J.anchor=!0;let re=J.code.trim(),se=/^([\w$]+)\s*=\s*([^=][\s\S]*)$/.exec(re),ie=se?`void ((${se[2]}) satisfies __StxAssignedValue<typeof ${se[1]}>)`:/^[\w$]+(?:\.[\w$]+)*$/.test(re)?`${re} satisfies (($event: ${ne}) => unknown)`:re,ae=`;(($event: ${ne}): void => { `;return{expression:J,statement:{text:`${ae}${ie} });`,prefixLength:ae.length}}}return{expression:J,statement:tv(J)}}).filter((J)=>J.statement!==null);if(G.push(...B?.checks||[]),G.length>0){let J=oa(v),ne=Qb(k.map((ae)=>ae.code)),se=[...new Set(k.flatMap((ae)=>Q(ae.code)))].filter((ae)=>/^[A-Z_$][\w$]*$/i.test(ae)),ie=0;if(se.length>0){V(Wb);for(let ae of se)V(`type __StxT_${ae} = ${Qp}<typeof ${ae}>`);V(`;((${se.map((ae)=>`${ae}: __StxT_${ae}`).join(", ")}) => {`),ie=1}for(let{expression:ae,statement:ue}of G){let oe=" ".repeat(ie),me=ae.offset===void 0?[]:ev(J,ae.offset),we=me.length>0?`${me.map((_e)=>`if (${ng(_e,ne)}) `).join("")}{ `:"",$e=me.length>0?" }":"";V(oe+we+ue.text+$e,{line:ae.line,column:ae.column,expression:ae,prefixLength:ue.prefixLength+oe.length+we.length,guardPrefixLength:oe.length+we.length})}if(ie>0)V("});")}}let H=!1;if(_.reference&&T[0]!==void 0&&T[0].trim()==="")T[0]=`/// <reference path=${JSON.stringify(_.reference.replace(/\\/g,"/"))} />`,H=!0;return V("export {}"),{text:T.join(`
1889
- `),lineMap:j,sourceLineCount:E.length,componentDependencies:B?.dependencies,referenced:H}}function ni(v,_){if(!v.expression)return!1;return v.inGuard===!0||_===2774}function ri(v,_,k){let E=v.lineMap.get(_);if(!E)return _<=v.sourceLineCount?{line:_,column:k}:null;let T=E.expression?.anchor?0:Math.max(0,k-1-(E.prefixLength??0));return{line:E.line,column:E.column+T,expression:E.expression,inGuard:k<=(E.guardPrefixLength??0)}}import rg from"fs";import sg from"path";var ig=!1;function sv(v,_,k,E=!1,T=new Set){let j={static:{},staticNames:{},serverDynamic:{},serverDynamicNames:{},clientReactive:{},events:{}},B=new Set(Array.isArray(_.__stx_client_signal_names)?_.__stx_client_signal_names:[]),z=(G)=>{if(B.size===0)return!1;let J=s(G),ne=J.match(/^\s*[!+~(-]*\s*([a-zA-Z_$][\w$]*)/)?.[1];if(ne&&B.has(ne))return!0;for(let re of B){let se=re.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(new RegExp(`(?:^|[^\\w$.])${se}\\s*\\(`).test(J))return!0}return!1},F=new Set(Mi),V=(G)=>{if(!G.includes("-")||G.startsWith("@")||G.startsWith(":")||G.startsWith("x-")||G.startsWith("__"))return G;if(G.startsWith("aria-")||G.startsWith("data-"))return G;return G.replace(/-([a-z0-9])/g,(J,ne)=>ne.toUpperCase())},H=(G,J)=>{let ne=V(G);if(j.static[ne]=J,ne!==G)j.staticNames[ne]=G};for(let[G,J]of Object.entries(v)){let ne=G.startsWith("x-")&&!F.has(G)&&!G.startsWith("x-bind:")&&!G.startsWith("x-on:")?`:${G.slice(2)}`:G;if(ne.startsWith("@")){j.events[ne]=J;continue}if(ne.startsWith("__stx_")){let re=V(ne.slice(6));j.serverDynamic[re]=Mp(J,k);continue}if(ne.startsWith(":")){let re=V(ne.slice(1)),se=J===vr?re:J;if(re==="if"||re==="for"||re==="show"){j.clientReactive[re]=se;continue}if(E){j.clientReactive[re]=se;continue}if(Ar(se,T)){j.clientReactive[re]=se;continue}if(z(se)){j.clientReactive[re]=se;continue}try{if(!p(se)){if(k.debug)console.error(`Unsafe expression in :${re} binding: ${se}`);j.clientReactive[re]=se;continue}let ie=Object.keys(_),ae=new Set(["true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","if","else"]),ue=new Set(Array.isArray(_.__stx_client_declared_names)?_.__stx_client_declared_names:[]);if(Se(se).some(($e)=>!ae.has($e)&&!ie.includes($e)&&(!($e in globalThis)||ue.has($e)))){j.clientReactive[re]=se;continue}let we=l(se,ie)(...Object.values(_));if(j.serverDynamic[re]=we,re!==ne.slice(1)&&j.serverDynamicNames)j.serverDynamicNames[re]=ne.slice(1)}catch{j.clientReactive[re]=se}continue}if(typeof J==="string"&&J.includes("{{")&&J.includes("}}")){let re=iv(J,T);if(re!==null){j.clientReactive[V(ne)]=re;continue}let se=J.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(se)try{let ie=se[1];if(p(ie)){let ue=l(ie,Object.keys(_))(...Object.values(_));H(ne,ue!=null?String(ue):"")}else{if(k.debug)console.error(`Unsafe expression in ${ne}: ${ie}`);H(ne,J)}}catch(ie){if(k.debug)console.error(`Error evaluating expression for ${ne}:`,ie);H(ne,J)}else{let ie=J,ae=/\{\{\s*([\s\S]+?)\s*\}\}/g,ue;while((ue=ae.exec(J))!==null)try{let oe=ue[1];if(!p(oe)){if(k.debug)console.error(`Unsafe expression in ${ne}: ${oe}`);continue}let we=l(oe,Object.keys(_))(...Object.values(_));ie=ie.replace(ue[0],String(we??""))}catch(oe){if(k.debug)console.error(`Error evaluating expression in ${ne}:`,oe)}H(ne,ie)}continue}H(ne,J===vr?"true":Op(J))}return j}function iv(v,_){if(_.size===0)return null;let k=/\{\{\s*([\s\S]+?)\s*\}\}/g,E=[...v.matchAll(k)];if(!E.some((z)=>Ar(z[1],_)))return null;let T=v.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(T&&E.length===1)return T[1];let j="",B=0;for(let z of E)j+=v.slice(B,z.index).replace(/[`\\$]/g,(F)=>`\\${F}`),j+=`\${${z[1]}}`,B=z.index+z[0].length;return j+=v.slice(B).replace(/[`\\$]/g,(z)=>`\\${z}`),`\`${j}\``}var ov=[[/@if\s*\(/,"@endif"],[/@unless\s*\(/,"@endunless"]];function av(v,_,k){if(!v.includes("@"))return v;if(!ov.some(([T,j])=>T.test(v)&&v.includes(j)))return v;try{return lr(v,_,k)}catch{return v}}function cg(v){let _={},k=0,E=v.length;while(k<E){while(k<E&&/\s/.test(v[k]))k++;if(k>=E)break;let T="";while(k<E&&!/[\s=]/.test(v[k]))T+=v[k],k++;if(!T)break;while(k<E&&/\s/.test(v[k]))k++;if(k<E&&v[k]==="="){k++;while(k<E&&/\s/.test(v[k]))k++;let j="";if(k<E&&(v[k]==='"'||v[k]==="'")){let B=v[k];k++;while(k<E){let z=v[k];if(z==="\\"&&k+1<E){k++,j+=v[k],k++;continue}if(z===B){k++;break}j+=z,k++}}else if(v[k]==="{"){j=El(v,k),k+=j.length;let B=Np(j);if(B!==null){_[`:${T}`]=B;continue}}else while(k<E&&!/\s/.test(v[k]))j+=v[k],k++;_[T]=j}else _[T]=vr}return _}function og(v){return Object.entries(v).map(([_,k])=>k===vr?_:`${_}="${cv(k)}"`).join(" ")}function cv(v){return v.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function lv(v){let _=new Set,k=/<([A-Z][A-Za-z0-9]*|stx-[a-z0-9-]+)\b[^>]*>/g,E;while((E=k.exec(v))!==null){let T=E[1];if(Ws.isBuiltin(T))_.add(T)}return[..._].sort()}async function gc(v,_,k,E,T){if(!/import\s/.test(v))return v;if(!_.__importedComponents)_.__importedComponents=new Map;let j=_.__importedComponents,B=sg.dirname(k),z=[],F=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi;for(let G of v.matchAll(F)){let[J,ne,re]=G,se=/import\s+(?:(\{[^}]*\})|([A-Za-z_$][\w$]*))\s+from\s+['"]([^'"]+)['"]\s*;?\s*\n?/g,ie=re,ae,ue=[];while((ae=se.exec(re))!==null){let[oe,me,we,$e]=ae,_e=null,Re=null;if($e.startsWith(".")||$e.startsWith("/")){let Te=sg.resolve(B,$e);if(Te.endsWith(".stx"))Re=Te;else{let ke=`${Te}.stx`;try{if(rg.statSync(ke).isFile())Re=ke}catch{try{if(rg.statSync(Te).isDirectory())_e=Te}catch{}}}}else _e=Oo($e,B);if(!_e&&!Re)continue;let Ee=!1,Ae=(Te,ke)=>{j.set(Te,ke),j.set(Te.toLowerCase(),ke);let Pe=Te.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();j.set(Pe,ke),T.add(ke)};if(we&&Re)Ae(we,Re),Ee=!0;else if(me){let Te=me.slice(1,-1).split(",").map((Pe)=>Pe.trim()).filter(Boolean).map((Pe)=>{let Ge=Pe.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(Ge)return{source:Ge[1],local:Ge[2]};return{source:Pe,local:Pe}}),ke=_e?Do(_e):null;for(let{source:Pe,local:Ge}of Te){let De=null;if(Re)De=Re;else if(ke)De=ke.get(Pe)??ke.get(Pe.toLowerCase())??ke.get(Pe.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase())??null;if(De)Ae(Ge,De),Ee=!0}}if(Ee)ue.push({start:ae.index,end:ae.index+oe.length})}if(ue.length===0)continue;for(let oe=ue.length-1;oe>=0;oe--)ie=ie.slice(0,ue[oe].start)+ie.slice(ue[oe].end);z.push({start:G.index,end:G.index+J.length,value:`<script${ne}>${ie}</script>`})}if(z.length===0)return v;let V=[],H=0;for(let G of z)V.push(v.slice(H,G.start),G.value),H=G.end;return V.push(v.slice(H)),V.join("")}async function uv(v,_,k,E,T){let j=v;if(!_.__importedComponents)_.__importedComponents=new Map;let B=_.__importedComponents,z=/@import\s*\(\s*([^)]+)\s*\)/g,F;while((F=z.exec(j))!==null){let[V,H]=F,G=H.split(",").map((J)=>J.trim().replace(/^['"]|['"]$/g,"")).filter((J)=>J.length>0);for(let J of G){let ne=J.split("/"),se=ne[ne.length-1].replace(/\.stx$/,""),ie=se.includes("-")?se.split("-").map((oe)=>oe.charAt(0).toUpperCase()+oe.slice(1)).join(""):se.charAt(0).toUpperCase()+se.slice(1),ae=null,ue=Mo(J,k,E);for(let oe of ue)try{if(await Bun.file(oe).exists()){ae=oe;break}}catch{}if(ae){B.set(ie,ae),B.set(se,ae),B.set(se.toLowerCase(),ae);let oe=ie.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(B.set(oe,ae),T.add(ae),E.debug)console.log(`Imported component: ${ie} -> ${ae}`)}else if(E.debug)console.warn(`Could not resolve imported component: ${J}`)}j=j.replace(V,""),z.lastIndex=0}return j}async function dv(v,_,k,E,T){let j=v,B=E.componentsDir||"components";if(!_.__processedComponents)_.__processedComponents=new Set;let z=_.__processedComponents,F=/@component\s*\(/g,V;while((V=F.exec(j))!==null){let H=V.index,G=H+V[0].length-1,J=1,ne=G+1;while(ne<j.length&&J>0){if(j[ne]==="(")J++;else if(j[ne]===")"){if(J--,J===0)break}ne++}if(J!==0)break;let re=j.substring(G+1,ne),se=ne+1,ie=re.match(/^\s*['"]([^'"]+)['"]/);if(!ie){F.lastIndex=0;continue}let ae=ie[1],ue,oe=re.slice(ie[0].length),me=oe.match(/^\s*,\s*/);if(me)ue=oe.slice(me[0].length).trim();let we={};if(ue)try{we=D(ue,_)}catch(Te){let ke=Te instanceof Error?Te.message:String(Te);j=j.replace(j.substring(H,se),`[Error parsing component props: ${ke}]`);continue}let $e="",_e=se,Ee=j.substring(se).match(/^([\s\S]*?)@endcomponent/);if(Ee)$e=Ee[1].trim(),_e=se+Ee[0].length;let Ae=await qe(ae,we,$e,B,_,k,E,z,T);j=j.substring(0,H)+Ae+j.substring(_e),F.lastIndex=0}return j}async function fv(v,_,k,E,T){if(!v)return v;let j=v,B=E.componentsDir||"components";if(!_.__processedComponents)_.__processedComponents=new Set;let z=_.__processedComponents,F=hv(j);if(F.size>0){let se=Array.isArray(_.__stx_client_declared_names)?_.__stx_client_declared_names:[];_.__stx_client_declared_names=[...new Set([...se,...F])]}let V=xn(j);j=V.output;let H=mr(_);return j=await re(j,/[a-z][a-z0-9]*-[a-z0-9-]*/,!1),j=await re(j,/[A-Z][a-zA-Z0-9]*/,!0,Pp(Xi)),j=await re(j,/[a-z][a-z0-9]*/,!1,Xi),j=V.restore(j),j;async function re(se,ie,ae,ue){if(!se)return se;let oe=se,me=Dp(oe,ie,ue),we=Cl(oe),$e=new Map;for(let Ee=me.length-1;Ee>=0;Ee--){let Ae=me[Ee],Te=ae?ia(Ae.tagName):Ae.tagName,ke=cg(av(Ae.attributes,_,k)),Pe=we.filter(({start:ut,end:st})=>Ae.startIndex>=ut&&Ae.startIndex<st),Ge=Pe.length>0,De=new Set(H);for(let ut of Pe)for(let st of ut.names)De.add(st);let Ie=sv(ke,_,E,Ge,De);if(typeof Ie.clientReactive.for==="string")for(let ut of Ns(Ie.clientReactive.for))De.add(ut);let Ye=Ws.getBuiltin(Ae.tagName),at=Ye?await Xn(Te,B,_,k,E):!1;if(Ye&&!at){let ut={context:_,filePath:k,options:E,dependencies:T},st=Ye.render(Ie,Ae.content,ut);if(Object.keys(Ie.events).length>0){let yt=og(Ie.events);st=st.replace(/^(\s*<[a-zA-Z][a-zA-Z0-9-]*)/,`$1 ${yt}`)}if(Object.keys(Ie.clientReactive).length>0)st=ag(st,Ie.clientReactive);$e.set(Ee,st);continue}if(!ae&&Ae.tagName.includes("-")&&!await Xn(Te,B,_,k,E))continue;let dt={};for(let[ut,st]of Object.entries(Ie.static))dt[ut]=st;for(let[ut,st]of Object.entries(Ie.serverDynamic))dt[ut]=st;let et={declaredProps:new Set},ft=await qe(Te,dt,V.restore(Ae.content),B,_,k,E,z,T,[...De],et);if(ft=pv(ft,Ie,et.declaredProps),Object.keys(Ie.events).length>0){let ut=Ol(ft);if(ut){let st=og(Ie.events),yt=Object.keys(Ie.events).map((gt)=>gt.replace(/^@/,"").split(".")[0]).join(" ");ft=ft.substring(0,ut.insertPos)+` data-stx-parent-events="${yt}" ${st}`+ft.substring(ut.insertPos)}}if(Object.keys(Ie.clientReactive).length>0)ft=ag(ft,Ie.clientReactive);$e.set(Ee,ft)}if($e.size===0)return oe;let _e="",Re=0;for(let Ee=0;Ee<me.length;Ee++){let Ae=$e.get(Ee);if(Ae===void 0)continue;_e+=oe.slice(Re,me[Ee].startIndex),_e+=Ae,Re=me[Ee].endIndex}return _e+=oe.slice(Re),_e}}function ag(v,_){let k=new Set(["if","for"]),E=new Set(["show"]),T=Object.entries(_).filter(([H])=>!k.has(H)),j=T.filter(([H])=>!E.has(H)).map(([H])=>ia(H)).join(" "),B=v,z=T.length>0?Ol(B):null;if(z){let H=T.map(([J,ne])=>`:${ia(J)}="${ne.replace(/"/g,"&quot;")}"`).join(" "),G=j?` data-stx-parent-bindings="${j}"`:"";B=B.substring(0,z.insertPos)+`${G} ${H}`+B.substring(z.insertPos)}let F=_.if;if(F)B=`<template :if="${F.replace(/"/g,"&quot;")}">${B}</template>`;let V=_.for;if(V)B=`<template :for="${V.replace(/"/g,"&quot;")}">${B}</template>`;return B}function pv(v,_,k=new Set){let E=gv(v);if(!E)return v;let T=v.slice(E.insertPos,E.tagEnd),j=/\bdata-native(?:\s|=)/i.test(T),B=new Set(Object.keys(cg(T))),z=new Set(["class","className"]);for(let H of Object.keys(_.static)){let G=_.staticNames[H]??H;if(B.has(G)||!j&&(k.has(H)||!rl(G)))z.add(H)}for(let H of Object.keys(_.serverDynamic)){let G=_.serverDynamicNames?.[H]??H;if(B.has(G)||!j&&(k.has(H)||!rl(G)))z.add(H)}let F=[];if(j){for(let[H,G]of Object.entries(_.static)){if(z.has(H)||G!==!0&&G!==vr)continue;z.add(H),F.push(`${Lt(_.staticNames?.[H]??H)}="true"`)}for(let[H,G]of Object.entries(_.serverDynamic)){if(z.has(H)||G!==!0)continue;z.add(H),F.push(`${Lt(_.serverDynamicNames?.[H]??H)}="true"`)}}let V=[...wr(_,z),...Sr(_,z),...F];if(j){for(let[H,G]of Object.entries(_.serverDynamic)){if(z.has(H)||G!==!1)continue;let J=_.serverDynamicNames?.[H]??H;V.push(`${Lt(J)}="false"`)}for(let[H,G]of Object.entries(_.serverDynamic)){if(z.has(H)||G===null||typeof G!=="object")continue;let J=JSON.stringify(G);if(J!==void 0){let ne=_.serverDynamicNames?.[H]??H;V.push(`${Lt(ne)}="${Lt(J)}"`)}}}if(V.length===0)return v;return`${v.slice(0,E.insertPos)} ${V.join(" ")}${v.slice(E.insertPos)}`}function Ol(v){let _=/<([a-zA-Z][a-zA-Z0-9-]*)\b[^>]*\bdata-stx-scope(?:\s|=|>)/i.exec(v);if(_)return{insertPos:_.index+1+_[1].length,tagEnd:Dl(v,_.index+1+_[1].length)};let k=0;while(k<v.length){let E=v.slice(k),T=E.match(/^\s+/);if(T){k+=T[0].length;continue}if(E.startsWith("<!--")){let z=v.indexOf("-->",k+4);if(z===-1)return null;k=z+3;continue}let j=E.match(/^<(script|style)\b[^>]*>/i);if(j){let z=`</${j[1].toLowerCase()}>`,F=v.toLowerCase().indexOf(z,k+j[0].length);if(F===-1)return null;k=F+z.length;continue}let B=E.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(?:\s|>|\/)/);if(!B)return null;return{insertPos:k+1+B[1].length,tagEnd:Dl(v,k+1+B[1].length)}}return null}function gv(v){let _=Ol(v);if(!_)return null;let k=v.slice(_.insertPos,_.tagEnd);if(!/\bdata-stx-component-wrapper(?:\s|=|>|$)/i.test(k))return _;return mv(v,_.tagEnd+1)}function mv(v,_){let k=_;while(k<v.length){let E=v.slice(k),T=E.match(/^\s+/);if(T){k+=T[0].length;continue}if(E.startsWith("<!--")){let z=v.indexOf("-->",k+4);if(z===-1)return null;k=z+3;continue}let j=E.match(/^<(script|style)\b[^>]*>/i);if(j){let z=`</${j[1].toLowerCase()}>`,F=v.toLowerCase().indexOf(z,k+j[0].length);if(F===-1)return null;k=F+z.length;continue}let B=E.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(?:\s|>|\/)/);if(!B)return null;return{insertPos:k+1+B[1].length,tagEnd:Dl(v,k+1+B[1].length)}}return null}function Dl(v,_){let k="";for(let E=_;E<v.length;E++){let T=v[E];if(k){if(T==="\\")E++;else if(T===k)k=""}else if(T==='"'||T==="'")k=T;else if(T===">")return E}return v.length}function hv(v){let _=new Set;for(let k of v.matchAll(/<script\b([^>]*)>([\s\S]*?)<\/script>/gi)){let E=k[1];if(!/\bclient\b/.test(E)||/\bserver\b/.test(E))continue;for(let T of Pl(k[2]))_.add(T);for(let T of k[2].matchAll(/^\s*import\s+(?:type\s+)?(?:([\w$]+)\s*,?\s*)?(?:\{([^}]*)\}|\*\s+as\s+([\w$]+))?\s*from\s/gm)){if(T[1])_.add(T[1]);if(T[3])_.add(T[3]);for(let j of(T[2]??"").split(",")){let B=j.replace(/^\s*type\s+/,"").split(/\s+as\s+/).pop().trim();if(/^[A-Za-z_$][\w$]*$/.test(B))_.add(B)}}}return _}async function as(v,_,k,E,T){if(!ig)Ap(Ws),ig=!0;let j=await gc(v,_,k,E,T);j=await uv(j,_,k,E,T),j=await dv(j,_,k,E,T);let B=[];for(let z=0;z<3;z++){let F=B.length,V=Pn(j,je,(G,J)=>`\x00STX_COMPONENT_COMMENT_${F+J}\x00`,`STX_COMPONENT_COMMENT:${F}`);B.push(...V.tokens);let H=j;if(j=await fv(V.output,_,k,E,T),j===H)break}if(B.length>0)j=j.replace(/\x00STX_COMPONENT_COMMENT_(\d+)\x00/g,(z,F)=>B[Number(F)]??"");if(E.debug){let z=lv(j);if(z.length>0)console.warn(`[stx] ${k}: unresolved component tag(s) after render passes: ${z.join(", ")}. Check nested component output for malformed root tags or recursive component markup.`)}return j}function Ml(v,_){let k=0;for(let E=_;E<v.length;E++){let T=v[E];if(T==="("||T==="["||T==="{")k++;else if(T===")"||T==="]"||T==="}")k--;else if(T===","&&k===0)return E}return-1}function xv(v,_,k){let E=v,T=new RegExp(`${_.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),j=T.exec(E);while(j){let B=j.index,z=B+j[0].length-1,F=1,V=z+1;while(V<E.length&&F>0){if(E[V]==="(")F++;else if(E[V]===")")F--;V++}if(F!==0)break;let H=E.substring(z+1,V-1),G=`${k}(${H})`;E=E.substring(0,B)+G+E.substring(V),T.lastIndex=B+G.length,j=T.exec(E)}return E}function bv(v){return/\b(state|derived|effect)\s*(?:<[^<>()]*>)?\s*\(/.test(v)}function fg(v){let _=v,k=[],E=new Set,T=0,j=0,B=_.length,z=(G)=>{j++;while(j<B){if(_[j]==="\\"){j+=2;continue}if(_[j]===G){j++;return}j++}},F=()=>{j++;while(j<B){if(_[j]==="\\"){j+=2;continue}if(_[j]==="`"){j++;return}if(_[j]==="$"&&_[j+1]==="{"){j+=2;let G=1;while(j<B&&G>0)if(_[j]==="{")G++,j++;else if(_[j]==="}")G--,j++;else if(_[j]==="'"||_[j]==='"')z(_[j]);else if(_[j]==="`")F();else j++;continue}j++}},V=()=>{if(_[j]==="/"&&_[j+1]==="/"){while(j<B&&_[j]!==`
1888
+ `))V(J);let G=fc(v).map((J)=>{let ne=B?.events.get(J.offset??-1);if(ne){J.anchor=!0;let re=J.code.trim(),se=/^([\w$]+)\s*=\s*([^=][\s\S]*)$/.exec(re),ie=se?`void ((${se[2]}) satisfies __StxAssignedValue<typeof ${se[1]}>)`:/^[\w$]+(?:\.[\w$]+)*$/.test(re)?`${re} satisfies (($event: ${ne}) => unknown)`:re,ae=`;(($event: ${ne}): void => { `;return{expression:J,statement:{text:`${ae}${ie} });`,prefixLength:ae.length}}}return{expression:J,statement:tv(J)}}).filter((J)=>J.statement!==null);if(G.push(...B?.checks||[]),G.length>0){let J=oa(v),ne=Qb(k.map((ae)=>ae.code)),se=[...new Set(k.flatMap((ae)=>Q(ae.code)))].filter((ae)=>/^[A-Z_$][\w$]*$/i.test(ae)),ie=0;if(se.length>0){V(Wb);for(let ae of se)V(`type __StxT_${ae} = ${Qp}<typeof ${ae}>`);V(`;((${se.map((ae)=>`${ae}: __StxT_${ae}`).join(", ")}) => {`),ie=1}for(let{expression:ae,statement:ue}of G){let oe=" ".repeat(ie),me=ae.offset===void 0?[]:ev(J,ae.offset),ve=me.length>0?`${me.map((_e)=>`if (${ng(_e,ne)}) `).join("")}{ `:"",$e=me.length>0?" }":"";V(oe+ve+ue.text+$e,{line:ae.line,column:ae.column,expression:ae,prefixLength:ue.prefixLength+oe.length+ve.length,guardPrefixLength:oe.length+ve.length})}if(ie>0)V("});")}}let H=!1;if(_.reference&&T[0]!==void 0&&T[0].trim()==="")T[0]=`/// <reference path=${JSON.stringify(_.reference.replace(/\\/g,"/"))} />`,H=!0;return V("export {}"),{text:T.join(`
1889
+ `),lineMap:j,sourceLineCount:E.length,componentDependencies:B?.dependencies,referenced:H}}function ni(v,_){if(!v.expression)return!1;return v.inGuard===!0||_===2774}function ri(v,_,k){let E=v.lineMap.get(_);if(!E)return _<=v.sourceLineCount?{line:_,column:k}:null;let T=E.expression?.anchor?0:Math.max(0,k-1-(E.prefixLength??0));return{line:E.line,column:E.column+T,expression:E.expression,inGuard:k<=(E.guardPrefixLength??0)}}import rg from"fs";import sg from"path";var ig=!1;function sv(v,_,k,E=!1,T=new Set){let j={static:{},staticNames:{},serverDynamic:{},serverDynamicNames:{},clientReactive:{},events:{}},B=new Set(Array.isArray(_.__stx_client_signal_names)?_.__stx_client_signal_names:[]),z=(G)=>{if(B.size===0)return!1;let J=s(G),ne=J.match(/^\s*[!+~(-]*\s*([a-zA-Z_$][\w$]*)/)?.[1];if(ne&&B.has(ne))return!0;for(let re of B){let se=re.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(new RegExp(`(?:^|[^\\w$.])${se}\\s*\\(`).test(J))return!0}return!1},F=new Set(Mi),V=(G)=>{if(!G.includes("-")||G.startsWith("@")||G.startsWith(":")||G.startsWith("x-")||G.startsWith("__"))return G;if(G.startsWith("aria-")||G.startsWith("data-"))return G;return G.replace(/-([a-z0-9])/g,(J,ne)=>ne.toUpperCase())},H=(G,J)=>{let ne=V(G);if(j.static[ne]=J,ne!==G)j.staticNames[ne]=G};for(let[G,J]of Object.entries(v)){let ne=G.startsWith("x-")&&!F.has(G)&&!G.startsWith("x-bind:")&&!G.startsWith("x-on:")?`:${G.slice(2)}`:G;if(ne.startsWith("@")){j.events[ne]=J;continue}if(ne.startsWith("__stx_")){let re=V(ne.slice(6));j.serverDynamic[re]=Mp(J,k);continue}if(ne.startsWith(":")){let re=V(ne.slice(1)),se=J===vr?re:J;if(re==="if"||re==="for"||re==="show"){j.clientReactive[re]=se;continue}if(E){j.clientReactive[re]=se;continue}if(Ar(se,T)){j.clientReactive[re]=se;continue}if(z(se)){j.clientReactive[re]=se;continue}try{if(!p(se)){if(k.debug)console.error(`Unsafe expression in :${re} binding: ${se}`);j.clientReactive[re]=se;continue}let ie=Object.keys(_),ae=new Set(["true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","if","else"]),ue=new Set(Array.isArray(_.__stx_client_declared_names)?_.__stx_client_declared_names:[]);if(Se(se).some(($e)=>!ae.has($e)&&!ie.includes($e)&&(!($e in globalThis)||ue.has($e)))){j.clientReactive[re]=se;continue}let ve=l(se,ie)(...Object.values(_));if(j.serverDynamic[re]=ve,re!==ne.slice(1)&&j.serverDynamicNames)j.serverDynamicNames[re]=ne.slice(1)}catch{j.clientReactive[re]=se}continue}if(typeof J==="string"&&J.includes("{{")&&J.includes("}}")){let re=iv(J,T);if(re!==null){j.clientReactive[V(ne)]=re;continue}let se=J.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(se)try{let ie=se[1];if(p(ie)){let ue=l(ie,Object.keys(_))(...Object.values(_));H(ne,ue!=null?String(ue):"")}else{if(k.debug)console.error(`Unsafe expression in ${ne}: ${ie}`);H(ne,J)}}catch(ie){if(k.debug)console.error(`Error evaluating expression for ${ne}:`,ie);H(ne,J)}else{let ie=J,ae=/\{\{\s*([\s\S]+?)\s*\}\}/g,ue;while((ue=ae.exec(J))!==null)try{let oe=ue[1];if(!p(oe)){if(k.debug)console.error(`Unsafe expression in ${ne}: ${oe}`);continue}let ve=l(oe,Object.keys(_))(...Object.values(_));ie=ie.replace(ue[0],String(ve??""))}catch(oe){if(k.debug)console.error(`Error evaluating expression in ${ne}:`,oe)}H(ne,ie)}continue}H(ne,J===vr?"true":Op(J))}return j}function iv(v,_){if(_.size===0)return null;let k=/\{\{\s*([\s\S]+?)\s*\}\}/g,E=[...v.matchAll(k)];if(!E.some((z)=>Ar(z[1],_)))return null;let T=v.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(T&&E.length===1)return T[1];let j="",B=0;for(let z of E)j+=v.slice(B,z.index).replace(/[`\\$]/g,(F)=>`\\${F}`),j+=`\${${z[1]}}`,B=z.index+z[0].length;return j+=v.slice(B).replace(/[`\\$]/g,(z)=>`\\${z}`),`\`${j}\``}var ov=[[/@if\s*\(/,"@endif"],[/@unless\s*\(/,"@endunless"]];function av(v,_,k){if(!v.includes("@"))return v;if(!ov.some(([T,j])=>T.test(v)&&v.includes(j)))return v;try{return lr(v,_,k)}catch{return v}}function cg(v){let _={},k=0,E=v.length;while(k<E){while(k<E&&/\s/.test(v[k]))k++;if(k>=E)break;let T="";while(k<E&&!/[\s=]/.test(v[k]))T+=v[k],k++;if(!T)break;while(k<E&&/\s/.test(v[k]))k++;if(k<E&&v[k]==="="){k++;while(k<E&&/\s/.test(v[k]))k++;let j="";if(k<E&&(v[k]==='"'||v[k]==="'")){let B=v[k];k++;while(k<E){let z=v[k];if(z==="\\"&&k+1<E){k++,j+=v[k],k++;continue}if(z===B){k++;break}j+=z,k++}}else if(v[k]==="{"){j=El(v,k),k+=j.length;let B=Np(j);if(B!==null){_[`:${T}`]=B;continue}}else while(k<E&&!/\s/.test(v[k]))j+=v[k],k++;_[T]=j}else _[T]=vr}return _}function og(v){return Object.entries(v).map(([_,k])=>k===vr?_:`${_}="${cv(k)}"`).join(" ")}function cv(v){return v.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function lv(v){let _=new Set,k=/<([A-Z][A-Za-z0-9]*|stx-[a-z0-9-]+)\b[^>]*>/g,E;while((E=k.exec(v))!==null){let T=E[1];if(Ws.isBuiltin(T))_.add(T)}return[..._].sort()}async function gc(v,_,k,E,T){if(!/import\s/.test(v))return v;if(!_.__importedComponents)_.__importedComponents=new Map;let j=_.__importedComponents,B=sg.dirname(k),z=[],F=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi;for(let G of v.matchAll(F)){let[J,ne,re]=G,se=/import\s+(?:(\{[^}]*\})|([A-Za-z_$][\w$]*))\s+from\s+['"]([^'"]+)['"]\s*;?\s*\n?/g,ie=re,ae,ue=[];while((ae=se.exec(re))!==null){let[oe,me,ve,$e]=ae,_e=null,Re=null;if($e.startsWith(".")||$e.startsWith("/")){let Te=sg.resolve(B,$e);if(Te.endsWith(".stx"))Re=Te;else{let ke=`${Te}.stx`;try{if(rg.statSync(ke).isFile())Re=ke}catch{try{if(rg.statSync(Te).isDirectory())_e=Te}catch{}}}}else _e=Oo($e,B);if(!_e&&!Re)continue;let Ee=!1,Ae=(Te,ke)=>{j.set(Te,ke),j.set(Te.toLowerCase(),ke);let Pe=Te.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();j.set(Pe,ke),T.add(ke)};if(ve&&Re)Ae(ve,Re),Ee=!0;else if(me){let Te=me.slice(1,-1).split(",").map((Pe)=>Pe.trim()).filter(Boolean).map((Pe)=>{let Ge=Pe.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(Ge)return{source:Ge[1],local:Ge[2]};return{source:Pe,local:Pe}}),ke=_e?Do(_e):null;for(let{source:Pe,local:Ge}of Te){let De=null;if(Re)De=Re;else if(ke)De=ke.get(Pe)??ke.get(Pe.toLowerCase())??ke.get(Pe.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase())??null;if(De)Ae(Ge,De),Ee=!0}}if(Ee)ue.push({start:ae.index,end:ae.index+oe.length})}if(ue.length===0)continue;for(let oe=ue.length-1;oe>=0;oe--)ie=ie.slice(0,ue[oe].start)+ie.slice(ue[oe].end);z.push({start:G.index,end:G.index+J.length,value:`<script${ne}>${ie}</script>`})}if(z.length===0)return v;let V=[],H=0;for(let G of z)V.push(v.slice(H,G.start),G.value),H=G.end;return V.push(v.slice(H)),V.join("")}async function uv(v,_,k,E,T){let j=v;if(!_.__importedComponents)_.__importedComponents=new Map;let B=_.__importedComponents,z=/@import\s*\(\s*([^)]+)\s*\)/g,F;while((F=z.exec(j))!==null){let[V,H]=F,G=H.split(",").map((J)=>J.trim().replace(/^['"]|['"]$/g,"")).filter((J)=>J.length>0);for(let J of G){let ne=J.split("/"),se=ne[ne.length-1].replace(/\.stx$/,""),ie=se.includes("-")?se.split("-").map((oe)=>oe.charAt(0).toUpperCase()+oe.slice(1)).join(""):se.charAt(0).toUpperCase()+se.slice(1),ae=null,ue=Mo(J,k,E);for(let oe of ue)try{if(await Bun.file(oe).exists()){ae=oe;break}}catch{}if(ae){B.set(ie,ae),B.set(se,ae),B.set(se.toLowerCase(),ae);let oe=ie.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(B.set(oe,ae),T.add(ae),E.debug)console.log(`Imported component: ${ie} -> ${ae}`)}else if(E.debug)console.warn(`Could not resolve imported component: ${J}`)}j=j.replace(V,""),z.lastIndex=0}return j}async function dv(v,_,k,E,T){let j=v,B=E.componentsDir||"components";if(!_.__processedComponents)_.__processedComponents=new Set;let z=_.__processedComponents,F=/@component\s*\(/g,V;while((V=F.exec(j))!==null){let H=V.index,G=H+V[0].length-1,J=1,ne=G+1;while(ne<j.length&&J>0){if(j[ne]==="(")J++;else if(j[ne]===")"){if(J--,J===0)break}ne++}if(J!==0)break;let re=j.substring(G+1,ne),se=ne+1,ie=re.match(/^\s*['"]([^'"]+)['"]/);if(!ie){F.lastIndex=0;continue}let ae=ie[1],ue,oe=re.slice(ie[0].length),me=oe.match(/^\s*,\s*/);if(me)ue=oe.slice(me[0].length).trim();let ve={};if(ue)try{ve=D(ue,_)}catch(Te){let ke=Te instanceof Error?Te.message:String(Te);j=j.replace(j.substring(H,se),`[Error parsing component props: ${ke}]`);continue}let $e="",_e=se,Ee=j.substring(se).match(/^([\s\S]*?)@endcomponent/);if(Ee)$e=Ee[1].trim(),_e=se+Ee[0].length;let Ae=await qe(ae,ve,$e,B,_,k,E,z,T);j=j.substring(0,H)+Ae+j.substring(_e),F.lastIndex=0}return j}async function fv(v,_,k,E,T){if(!v)return v;let j=v,B=E.componentsDir||"components";if(!_.__processedComponents)_.__processedComponents=new Set;let z=_.__processedComponents,F=hv(j);if(F.size>0){let se=Array.isArray(_.__stx_client_declared_names)?_.__stx_client_declared_names:[];_.__stx_client_declared_names=[...new Set([...se,...F])]}let V=xn(j);j=V.output;let H=mr(_);return j=await re(j,/[a-z][a-z0-9]*-[a-z0-9-]*/,!1),j=await re(j,/[A-Z][a-zA-Z0-9]*/,!0,Pp(Xi)),j=await re(j,/[a-z][a-z0-9]*/,!1,Xi),j=V.restore(j),j;async function re(se,ie,ae,ue){if(!se)return se;let oe=se,me=Dp(oe,ie,ue),ve=Cl(oe),$e=new Map;for(let Ee=me.length-1;Ee>=0;Ee--){let Ae=me[Ee],Te=ae?ia(Ae.tagName):Ae.tagName,ke=cg(av(Ae.attributes,_,k)),Pe=ve.filter(({start:ut,end:st})=>Ae.startIndex>=ut&&Ae.startIndex<st),Ge=Pe.length>0,De=new Set(H);for(let ut of Pe)for(let st of ut.names)De.add(st);let Ie=sv(ke,_,E,Ge,De);if(typeof Ie.clientReactive.for==="string")for(let ut of Ns(Ie.clientReactive.for))De.add(ut);let Ye=Ws.getBuiltin(Ae.tagName),at=Ye?await Xn(Te,B,_,k,E):!1;if(Ye&&!at){let ut={context:_,filePath:k,options:E,dependencies:T},st=Ye.render(Ie,Ae.content,ut);if(Object.keys(Ie.events).length>0){let yt=og(Ie.events);st=st.replace(/^(\s*<[a-zA-Z][a-zA-Z0-9-]*)/,`$1 ${yt}`)}if(Object.keys(Ie.clientReactive).length>0)st=ag(st,Ie.clientReactive);$e.set(Ee,st);continue}if(!ae&&Ae.tagName.includes("-")&&!await Xn(Te,B,_,k,E))continue;let dt={};for(let[ut,st]of Object.entries(Ie.static))dt[ut]=st;for(let[ut,st]of Object.entries(Ie.serverDynamic))dt[ut]=st;let et={declaredProps:new Set},ft=await qe(Te,dt,V.restore(Ae.content),B,_,k,E,z,T,[...De],et);if(ft=pv(ft,Ie,et.declaredProps),Object.keys(Ie.events).length>0){let ut=Ol(ft);if(ut){let st=og(Ie.events),yt=Object.keys(Ie.events).map((gt)=>gt.replace(/^@/,"").split(".")[0]).join(" ");ft=ft.substring(0,ut.insertPos)+` data-stx-parent-events="${yt}" ${st}`+ft.substring(ut.insertPos)}}if(Object.keys(Ie.clientReactive).length>0)ft=ag(ft,Ie.clientReactive);$e.set(Ee,ft)}if($e.size===0)return oe;let _e="",Re=0;for(let Ee=0;Ee<me.length;Ee++){let Ae=$e.get(Ee);if(Ae===void 0)continue;_e+=oe.slice(Re,me[Ee].startIndex),_e+=Ae,Re=me[Ee].endIndex}return _e+=oe.slice(Re),_e}}function ag(v,_){let k=new Set(["if","for"]),E=new Set(["show"]),T=Object.entries(_).filter(([H])=>!k.has(H)),j=T.filter(([H])=>!E.has(H)).map(([H])=>ia(H)).join(" "),B=v,z=T.length>0?Ol(B):null;if(z){let H=T.map(([J,ne])=>`:${ia(J)}="${ne.replace(/"/g,"&quot;")}"`).join(" "),G=j?` data-stx-parent-bindings="${j}"`:"";B=B.substring(0,z.insertPos)+`${G} ${H}`+B.substring(z.insertPos)}let F=_.if;if(F)B=`<template :if="${F.replace(/"/g,"&quot;")}">${B}</template>`;let V=_.for;if(V)B=`<template :for="${V.replace(/"/g,"&quot;")}">${B}</template>`;return B}function pv(v,_,k=new Set){let E=gv(v);if(!E)return v;let T=v.slice(E.insertPos,E.tagEnd),j=/\bdata-native(?:\s|=)/i.test(T),B=new Set(Object.keys(cg(T))),z=new Set(["class","className"]);for(let H of Object.keys(_.static)){let G=_.staticNames[H]??H;if(B.has(G)||!j&&(k.has(H)||!rl(G)))z.add(H)}for(let H of Object.keys(_.serverDynamic)){let G=_.serverDynamicNames?.[H]??H;if(B.has(G)||!j&&(k.has(H)||!rl(G)))z.add(H)}let F=[];if(j){for(let[H,G]of Object.entries(_.static)){if(z.has(H)||G!==!0&&G!==vr)continue;z.add(H),F.push(`${Lt(_.staticNames?.[H]??H)}="true"`)}for(let[H,G]of Object.entries(_.serverDynamic)){if(z.has(H)||G!==!0)continue;z.add(H),F.push(`${Lt(_.serverDynamicNames?.[H]??H)}="true"`)}}let V=[...wr(_,z),...Sr(_,z),...F];if(j){for(let[H,G]of Object.entries(_.serverDynamic)){if(z.has(H)||G!==!1)continue;let J=_.serverDynamicNames?.[H]??H;V.push(`${Lt(J)}="false"`)}for(let[H,G]of Object.entries(_.serverDynamic)){if(z.has(H)||G===null||typeof G!=="object")continue;let J=JSON.stringify(G);if(J!==void 0){let ne=_.serverDynamicNames?.[H]??H;V.push(`${Lt(ne)}="${Lt(J)}"`)}}}if(V.length===0)return v;return`${v.slice(0,E.insertPos)} ${V.join(" ")}${v.slice(E.insertPos)}`}function Ol(v){let _=/<([a-zA-Z][a-zA-Z0-9-]*)\b[^>]*\bdata-stx-scope(?:\s|=|>)/i.exec(v);if(_)return{insertPos:_.index+1+_[1].length,tagEnd:Dl(v,_.index+1+_[1].length)};let k=0;while(k<v.length){let E=v.slice(k),T=E.match(/^\s+/);if(T){k+=T[0].length;continue}if(E.startsWith("<!--")){let z=v.indexOf("-->",k+4);if(z===-1)return null;k=z+3;continue}let j=E.match(/^<(script|style)\b[^>]*>/i);if(j){let z=`</${j[1].toLowerCase()}>`,F=v.toLowerCase().indexOf(z,k+j[0].length);if(F===-1)return null;k=F+z.length;continue}let B=E.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(?:\s|>|\/)/);if(!B)return null;return{insertPos:k+1+B[1].length,tagEnd:Dl(v,k+1+B[1].length)}}return null}function gv(v){let _=Ol(v);if(!_)return null;let k=v.slice(_.insertPos,_.tagEnd);if(!/\bdata-stx-component-wrapper(?:\s|=|>|$)/i.test(k))return _;return mv(v,_.tagEnd+1)}function mv(v,_){let k=_;while(k<v.length){let E=v.slice(k),T=E.match(/^\s+/);if(T){k+=T[0].length;continue}if(E.startsWith("<!--")){let z=v.indexOf("-->",k+4);if(z===-1)return null;k=z+3;continue}let j=E.match(/^<(script|style)\b[^>]*>/i);if(j){let z=`</${j[1].toLowerCase()}>`,F=v.toLowerCase().indexOf(z,k+j[0].length);if(F===-1)return null;k=F+z.length;continue}let B=E.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(?:\s|>|\/)/);if(!B)return null;return{insertPos:k+1+B[1].length,tagEnd:Dl(v,k+1+B[1].length)}}return null}function Dl(v,_){let k="";for(let E=_;E<v.length;E++){let T=v[E];if(k){if(T==="\\")E++;else if(T===k)k=""}else if(T==='"'||T==="'")k=T;else if(T===">")return E}return v.length}function hv(v){let _=new Set;for(let k of v.matchAll(/<script\b([^>]*)>([\s\S]*?)<\/script>/gi)){let E=k[1];if(!/\bclient\b/.test(E)||/\bserver\b/.test(E))continue;for(let T of Pl(k[2]))_.add(T);for(let T of k[2].matchAll(/^\s*import\s+(?:type\s+)?(?:([\w$]+)\s*,?\s*)?(?:\{([^}]*)\}|\*\s+as\s+([\w$]+))?\s*from\s/gm)){if(T[1])_.add(T[1]);if(T[3])_.add(T[3]);for(let j of(T[2]??"").split(",")){let B=j.replace(/^\s*type\s+/,"").split(/\s+as\s+/).pop().trim();if(/^[A-Za-z_$][\w$]*$/.test(B))_.add(B)}}}return _}async function as(v,_,k,E,T){if(!ig)Ap(Ws),ig=!0;let j=await gc(v,_,k,E,T);j=await uv(j,_,k,E,T),j=await dv(j,_,k,E,T);let B=[];for(let z=0;z<3;z++){let F=B.length,V=Pn(j,je,(G,J)=>`\x00STX_COMPONENT_COMMENT_${F+J}\x00`,`STX_COMPONENT_COMMENT:${F}`);B.push(...V.tokens);let H=j;if(j=await fv(V.output,_,k,E,T),j===H)break}if(B.length>0)j=j.replace(/\x00STX_COMPONENT_COMMENT_(\d+)\x00/g,(z,F)=>B[Number(F)]??"");if(E.debug){let z=lv(j);if(z.length>0)console.warn(`[stx] ${k}: unresolved component tag(s) after render passes: ${z.join(", ")}. Check nested component output for malformed root tags or recursive component markup.`)}return j}function Ml(v,_){let k=0;for(let E=_;E<v.length;E++){let T=v[E];if(T==="("||T==="["||T==="{")k++;else if(T===")"||T==="]"||T==="}")k--;else if(T===","&&k===0)return E}return-1}function xv(v,_,k){let E=v,T=new RegExp(`${_.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),j=T.exec(E);while(j){let B=j.index,z=B+j[0].length-1,F=1,V=z+1;while(V<E.length&&F>0){if(E[V]==="(")F++;else if(E[V]===")")F--;V++}if(F!==0)break;let H=E.substring(z+1,V-1),G=`${k}(${H})`;E=E.substring(0,B)+G+E.substring(V),T.lastIndex=B+G.length,j=T.exec(E)}return E}function bv(v){return/\b(state|derived|effect)\s*(?:<[^<>()]*>)?\s*\(/.test(v)}function fg(v){let _=v,k=[],E=new Set,T=0,j=0,B=_.length,z=(G)=>{j++;while(j<B){if(_[j]==="\\"){j+=2;continue}if(_[j]===G){j++;return}j++}},F=()=>{j++;while(j<B){if(_[j]==="\\"){j+=2;continue}if(_[j]==="`"){j++;return}if(_[j]==="$"&&_[j+1]==="{"){j+=2;let G=1;while(j<B&&G>0)if(_[j]==="{")G++,j++;else if(_[j]==="}")G--,j++;else if(_[j]==="'"||_[j]==='"')z(_[j]);else if(_[j]==="`")F();else j++;continue}j++}},V=()=>{if(_[j]==="/"&&_[j+1]==="/"){while(j<B&&_[j]!==`
1890
1890
  `)j++;return!0}if(_[j]==="/"&&_[j+1]==="*"){j+=2;while(j<B-1&&!(_[j]==="*"&&_[j+1]==="/"))j++;return j+=2,!0}return!1},H=()=>{if(T!==0)return;let G=_.slice(j).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(G){let re=G[2];if(!E.has(re))k.push(re),E.add(re);return}let J=_.slice(j).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(J){let re=J[1];if(!E.has(re))k.push(re),E.add(re);return}let ne=_.slice(j).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(ne){let re=ne[1];if(!E.has(re))k.push(re),E.add(re)}};while(j<B){if(V())continue;if(_[j]==="'"||_[j]==='"'){z(_[j]);continue}if(_[j]==="`"){F();continue}if(_[j]==="{"){T++,j++;continue}if(_[j]==="}"){T--,j++;continue}if(T===0&&/[a-z]/i.test(_[j])&&(j===0||/\s|[;{}()]/.test(_[j-1])))H();j++}return k.join(", ")}function vv(v,_=""){let k=fg(v).split(",").map((E)=>E.trim()).filter(Boolean);return`
1891
1891
  (function() {
1892
1892
  ${Pt("var",k)}
@@ -1925,21 +1925,21 @@ ${T}
1925
1925
  } finally {
1926
1926
  if (typeof window !== 'undefined') window.__STX_CURRENT_ELEMENT__ = __stxPrevEl;
1927
1927
  }
1928
- })();`}function _v(v,_){if(Nn(v)){let T=Nn(v).tag.match(/data-stx-scope="([^"]*)"/);if(T)return{html:v,mergedIntoExisting:T[1],stamped:!0,root:"body"};return{html:Bs(v,(j,B)=>`<body${B} data-stx-scope="${_}">`),mergedIntoExisting:null,stamped:!0,root:"body"}}let k=v.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)(<[a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*>|>)/s);if(k){let E=k[2]+k[3],T=k[2].slice(1),j=E.match(/data-stx-scope="([^"]*)"/);if(j)return{html:v,mergedIntoExisting:j[1],stamped:!0,root:T};let B=k[1],z=k[2],F=k[3];return{html:`${B}${z} data-stx-scope="${_}"${F}${v.slice(k[0].length)}`,mergedIntoExisting:null,stamped:!0,root:T}}return{html:v,mergedIntoExisting:null,stamped:!1,root:null}}var kv=0;function ug(v,_){let k=Bt.basename(v,".stx").replace(/[^a-zA-Z0-9]/g,"_"),E=_.__stx_scope_seq;return E?`stx_scope_${k}_${++E.n}_${E.key}`:`stx_scope_${k}_${++kv}`}var Nl=new Set,jl=new Set;function Xd(){Nl.clear(),jl.clear()}var Ev=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function $c(v){let _=(z)=>z.replace(/[^\n]/g," "),k=v.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,_).replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,_).replace(/<!--[\s\S]*?-->/g,_).replace(/\x00STX_HTML_COMMENT_\d+\x00/g,_).replace(/\{\{[\s\S]*?\}\}/g,_).replace(/\{!![\s\S]*?!!\}/g,_),E=[],T=0,j=/<(\/?)([A-Za-z][\w-]*)\b(?:[^<>"']|"[^"]*"|'[^']*')*?(\/?)>/g,B;while((B=j.exec(k))!==null){let z=B[1]==="/",F=B[2],V=B[3]==="/"||Ev.has(F.toLowerCase());if(z){T=Math.max(0,T-1);continue}if(T===0)E.push(F);if(!V)T++}return E}function dg(v){return/\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/i.test(v)}var be=new M(500),ui=new Set;function Gd(){ui.clear()}function Cv(v){if(v.__onceStore instanceof Set)return v.__onceStore;return ui}async function ms(v,_,k,E,T,j=new Set){let B=E.partialsDir||Bt.join(Bt.dirname(k),"partials");if(B&&!Bt.isAbsolute(B))B=Bt.resolve(process.cwd(),B);let z=xv(v,"@partial","@include"),F=Cv(_);z=z.replace(/@once([\s\S]*?)@endonce/g,(se,ie,ae)=>{let ue=ie.trim(),oe=`${k}:${ue}`;if(F.has(oe))return"";return F.add(oe),ie});{let se=/@includeIf\s*\(/g,ie;while((ie=se.exec(z))!==null){let ae=ie.index,ue=ae+ie[0].length-1,oe=1,me=ue+1;while(me<z.length&&oe>0){if(z[me]==="(")oe++;else if(z[me]===")")oe--;me++}if(oe!==0)break;let we=z.substring(ue+1,me-1),$e=we.match(/^\s*['"]([^'"]+)['"]/);if(!$e){se.lastIndex=me;continue}let _e=$e[1],Re=V(_e,B,k),Ee="";if(Re&&await Bun.file(Re).exists())T.add(Re),Ee=`@include(${we})`;z=z.substring(0,ae)+Ee+z.substring(me),se.lastIndex=0}}for(let[se,ie]of[["@includeWhen",!1],["@includeUnless",!0]]){let ae=new RegExp(`${se.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),ue;while((ue=ae.exec(z))!==null){let oe=ue.index,me=oe+ue[0].length-1,we=1,$e=me+1;while($e<z.length&&we>0){if(z[$e]==="(")we++;else if(z[$e]===")")we--;$e++}if(we!==0)break;let _e=z.substring(me+1,$e-1),Re=Ml(_e,0);if(Re===-1){ae.lastIndex=$e;continue}let Ee=_e.substring(0,Re).trim(),Ae=_e.substring(Re+1).trim(),Te=Ae.match(/^\s*['"]([^'"]+)['"]/);if(!Te){ae.lastIndex=$e;continue}let ke=Te[1],Pe=Ae.substring(Te[0].length),Ge,De=Ml(Pe,0);if(De!==-1)Ge=Pe.substring(De+1).trim();try{let Ie=`Boolean(${Ee})`,Ye;if(p(Ie)){let et=l(Ie,Object.keys(_));Ye=Boolean(et(...Object.values(_)))}else Ye=Boolean(c(Ie,_));let at=ie?!Ye:Ye,dt="";if(at){let et=V(ke,B,k);if(et&&await Bun.file(et).exists())T.add(et);dt=`@include('${ke}'${Ge?`, ${Ge}`:""})`}z=z.substring(0,oe)+dt+z.substring($e),ae.lastIndex=0}catch(Ie){let Ye=Ie instanceof Error?Ie.message:String(Ie),at=g("Include",`Error evaluating ${se} condition: ${Ye}`,k,v,oe);z=z.substring(0,oe)+at+z.substring($e),ae.lastIndex=0}}}{let se=/@each\s*\(/g,ie;while((ie=se.exec(z))!==null){let ae=ie.index,ue=ae+ie[0].length-1,oe=1,me=ue+1;while(me<z.length&&oe>0){if(z[me]==="(")oe++;else if(z[me]===")"){if(oe--,oe===0)break}me++}if(oe!==0)break;let we=z.substring(ue+1,me),$e=z.substring(ae,me+1),_e=we.match(/^\s*['"]([^'"]+)['"]\s*,\s*([^,]+)\s*,\s*['"]([^'"]+)['"](?:\s*,\s*['"]([^'"]+)['"])?\s*$/);if(!_e){se.lastIndex=0,z=z.replace($e,"");continue}let[,Re,Ee,Ae,Te]=_e;try{let ke,Pe=Ee.trim();if(p(Pe))ke=l(Pe,Object.keys(_))(...Object.values(_));else ke=c(Pe,_);let Ge="";if(Array.isArray(ke)&&ke.length>0)for(let De of ke){let Ie={..._,[Ae]:De},Ye=await J(Re,Ie,v,ae);Ge+=Ye}else if(Te)Ge=await J(Te,{},v,ae);z=z.substring(0,ae)+Ge+z.substring(me+1),se.lastIndex=0}catch(ke){let Pe=ke instanceof Error?ke.message:String(ke);z=z.substring(0,ae)+g("Each",`Error in @each: ${Pe}`,k,v,ae)+z.substring(me+1),se.lastIndex=0}}}{let se=/@includeFirst\s*\(/g,ie;while((ie=se.exec(z))!==null){let ae=ie.index,ue=ae+ie[0].length-1,oe=1,me=ue+1;while(me<z.length&&oe>0){if(z[me]==="(")oe++;else if(z[me]===")"){if(oe--,oe===0)break}me++}if(oe!==0)break;let we=z.substring(ue+1,me),$e=z.substring(ae,me+1),_e=we.match(/^\s*(\[[^\]]+\])/);if(!_e){se.lastIndex=0,z=z.replace($e,"");continue}let Re=_e[1],Ee=we.slice(_e[0].length),Ae,Te=Ee.match(/^\s*,\s*\{/);if(Te){Ee=Ee.slice(Te[0].length-1);let Ge=1,De=1;while(De<Ee.length&&Ge>0){if(Ee[De]==="{")Ge++;else if(Ee[De]==="}"){if(Ge--,Ge===0)break}De++}Ae=Ee.substring(0,De+1),Ee=Ee.slice(De+1)}let ke,Pe=Ee.match(/^\s*,\s*['"]([^'"]*)['"]\s*$/);if(Pe)ke=Pe[1];try{let Ge=JSON.parse(Re.replace(/'/g,'"')),De={};if(Ae)try{De=D(Ae,_)}catch(Ye){let at=Ye instanceof Error?Ye.message:String(Ye);if(E.debug){let dt=g("Include",`Error parsing includeFirst variables: ${at}`,k,v,ae,$e);z=z.replace($e,()=>dt)}else z=z.replace($e,()=>ke||"");continue}let Ie=!1;for(let Ye of Ge){let at=V(Ye,B,k);if(!at)continue;if(await r(at)){let dt=await J(Ye,De,v,ae);z=z.replace($e,()=>dt),Ie=!0;break}}if(!Ie)if(ke!==void 0)z=z.replace($e,()=>ke);else if(E.debug){let Ye=g("Include",`None of the includeFirst paths exist: ${Re}`,k,v,ae,$e);z=z.replace($e,()=>Ye)}else z=z.replace($e,"")}catch(Ge){let De=Ge instanceof Error?Ge.message:String(Ge),Ie=g("Include",`Error processing @includeFirst: ${De}`,k,v,ae,$e);z=z.replace($e,()=>Ie)}se.lastIndex=0}}function V(se,ie,ae){try{let ue=se;if(!se.endsWith(".stx"))ue=`${se}.stx`;let oe=Bt.resolve(ie),me=Bt.resolve(Bt.dirname(ae)),we;if(!ue.startsWith("./")&&!ue.startsWith("../")){for(let Te of E._layerPartialDirs??[]){let ke=Bt.resolve(Te,ue);if(ke.startsWith(`${Bt.resolve(Te)}${Bt.sep}`)&&yv(ke))return ke}we=Bt.resolve(ie,ue)}else we=Bt.resolve(me,ue);let $e=Bt.normalize(we),_e=$e.startsWith(oe+Bt.sep)||$e===oe,Re=$e.startsWith(me+Bt.sep)||$e===me,Ee=!1,Ae=Bt.dirname(me);if($e.startsWith(Ae+Bt.sep)){if(!Bt.relative(Ae,$e).split(Bt.sep).some((Ge)=>Ge.startsWith(".")&&Ge!=="."&&Ge!==".."))Ee=!0}if(!_e&&!Re&&!Ee)return console.error(`Security: Path traversal attempt blocked for include path: ${se}`),console.error(` Resolved to: ${$e}`),console.error(` Allowed dirs: ${oe}, ${me}`),null;return $e}catch(ue){return console.error(`Error resolving path ${se}: ${ue}`),null}}let H=Bt.resolve(k);j.add(H);function G(se,ie,ae,ue){return E.onIncludeError?.({includePath:se,templatePath:k,message:ie,partialsDir:B}),g("Include",ie,k,ae,ue)}async function J(se,ie={},ae,ue){let oe=V(se,B,k);if(!oe)return G(se,`Could not resolve path for include: ${se}`,ae,ue);let me=Bt.resolve(oe);if(j.has(me)){let we=[...j,me].map(($e)=>Bt.basename($e)).join(" -> ");return G(se,`Circular include detected: ${we}`,ae,ue)}try{T.add(oe);let we;if(!we)try{we=await Bun.file(oe).text()}catch(st){let yt=st instanceof Error?st.message:String(st);return G(se,`Error loading include file ${se}: ${yt}`,ae,ue)}if(we)we=we.replace(/\{\{--[\s\S]*?--\}\}/g,"");if(we&&we.includes("@stream")){let{processStreamDirectives:st}=await import("./chunk-5tvxv2v1.js");we=st(we,_)}if(we&&(E.debug||!ge()&&!vn()))try{let{warnUnbalancedTags:st}=await import("./chunk-vr0fb0x1.js");st(we,oe)}catch{}try{let{processESImports:st}=await import("./chunk-2djfn17e.js");we=await st(we,_,oe,E,T)}catch(st){if(E.debug)console.warn(`[stx] partial ES import extraction skipped for ${oe}:`,st instanceof Error?st.message:st)}let $e=we,_e=Z($e);if(_e)$e=_e.content.trim();let Ee=we.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),Ae="";if(Ee)Ae=`<style${Ee[1]}>${Ee[2]}</style>`;let Te=[];$e=$e.replace(/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,(st,yt,gt)=>{if(!dg(yt))return"";return Te.push({attrs:yt,body:gt}),`__STX_DATA_BLOCK_${Te.length-1}__`}),$e=$e.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let ke={..._};ke.__stx_signals_gate=ye(we,oe);for(let[st,yt]of Object.entries(ie))ke[st]=yt;let Pe=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,Ge=[...we.matchAll(Pe)],De="",Ie=null,Ye=!1;for(let st of Ge){let yt=st[1]||"",gt=st[2]||"";if(dg(yt))continue;let zt=yt.includes("server"),En=Ue(yt);if(!zt&&gt.trim()){let{interpolateScriptExpressions:nt}=await import("./chunk-x2ghjgxm.js");gt=nt(gt,ke,se)}let Cn="";try{let{extractAndStripCssImports:nt,renderVendorStyleTags:ct}=await import("./chunk-11j2dj0r.js"),bt=nt(gt,{filePath:oe,projectRoot:process.cwd()});gt=bt.code,Cn=ct(bt.styles)}catch(nt){if(E.debug)console.warn(`[stx] vendor-css extractor skipped for ${oe}:`,nt instanceof Error?nt.message:nt)}if(En&&gt.trim())gt=We(gt);if(!zt){try{let{injectBrowserCoreAutoImports:ct}=await import("./chunk-11j2dj0r.js");gt=ct(gt).code;let{hasUserImports:bt,bundleClientScript:Gt}=await import("./chunk-x5gbrjm5.js");if(bt(gt))gt=await Gt(gt,oe,{projectRoot:process.cwd()})}catch(ct){if(E.debug)console.warn(`[stx] bundler skipped for ${oe}:`,ct instanceof Error?ct.message:ct)}let{stripStxRuntimeImports:nt}=await import("./chunk-tv2xr7s3.js");gt=nt(gt)}let Tn=bv(gt);if(Tn&&!zt){Ye=!0,Ie=ug(oe,_);let nt=I(gt),ct=lg(nt,Ie);De+=`${Cn}<script data-stx-scoped data-stx-run="always" data-stx-owner="${Ie}">${ct}</script>
1929
- `;continue}if(zt)try{let{extractVariables:nt}=await import("./chunk-vgkjmrf3.js");await nt(gt,ke,oe)}catch(nt){if(E.debug)console.warn(`Warning: Could not extract variables from server script in ${oe}:`,nt)}if(!zt&&!Tn){let nt=yt.replace(/\bclient\b/i,"").trim();Ie=ug(oe,_);let ct=I(gt),bt=lg(ct,Ie);De+=`${Cn}<script data-stx-scoped data-stx-run="always" data-stx-owner="${Ie}"${nt?` ${nt}`:""}>${bt}</script>
1930
- `}}if(Te.length>0){let{interpolateScriptExpressions:st}=await import("./chunk-x2ghjgxm.js");$e=$e.replace(/__STX_DATA_BLOCK_(\d+)__/g,(yt,gt)=>{let zt=Te[Number(gt)];return`<script${zt.attrs}>${st(zt.body,ke,se)}</script>`})}if(Ie){let st=_v($e,Ie);if($e=st.html,st.mergedIntoExisting){let gt=Ie,zt=st.mergedIntoExisting;De=De.split(`'${gt}'`).join(`'${zt}'`).split(`"${gt}"`).join(`"${zt}"`),Ie=zt}else if(!st.stamped&&Ye&&!Nl.has(oe))Nl.add(oe),console.warn(`[stx] ${Bt.relative(process.cwd(),oe)} declares signals but has no element to scope them to, so nothing in it will hydrate. Wrap the partial's markup in a single root element.`);if(st.stamped&&st.root!=="body"&&Ye&&!jl.has(oe)){let gt=$c($e);if(gt.length>1)jl.add(oe),console.warn(`[stx] ${Bt.relative(process.cwd(),oe)} declares signals and has ${gt.length} top-level elements (${gt.map((zt)=>`<${zt}>`).join(", ")}). Only the first is scoped, so bindings in the others cannot see this partial's signals. Wrap the partial's markup in a single root element.`)}let yt=st.stamped&&st.root!==null&&on(st.root);De=Sv(De,yt?Ie:null)}if($e.includes("@include")||$e.includes("@partial"))$e=await ms($e,ke,oe,E,T,j);let{processLoops:at,reportDeferredLoopWarnings:dt}=await import("./chunk-azv7g8rr.js"),et=at($e,ke,oe,void 0,!0);et=lr(et,ke,oe),et=dt(et);let{processMetaDirectives:It,processSeoDirective:ft,processStructuredData:ut}=await import("./chunk-3pczp9c0.js");if(et=It(et,ke,oe,E),et=ut(et,ke,oe),et=ft(et,ke,oe,E),et=q(et,ke,oe),Ae)et+=`
1928
+ })();`}function _v(v,_){if(Nn(v)){let T=Nn(v).tag.match(/data-stx-scope="([^"]*)"/);if(T)return{html:v,mergedIntoExisting:T[1],stamped:!0,root:"body"};return{html:Bs(v,(j,B)=>`<body${B} data-stx-scope="${_}">`),mergedIntoExisting:null,stamped:!0,root:"body"}}let k=v.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)(<[a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*>|>)/s);if(k){let E=k[2]+k[3],T=k[2].slice(1),j=E.match(/data-stx-scope="([^"]*)"/);if(j)return{html:v,mergedIntoExisting:j[1],stamped:!0,root:T};let B=k[1],z=k[2],F=k[3];return{html:`${B}${z} data-stx-scope="${_}"${F}${v.slice(k[0].length)}`,mergedIntoExisting:null,stamped:!0,root:T}}return{html:v,mergedIntoExisting:null,stamped:!1,root:null}}var kv=0;function ug(v,_){let k=Bt.basename(v,".stx").replace(/[^a-zA-Z0-9]/g,"_"),E=_.__stx_scope_seq;return E?`stx_scope_${k}_${++E.n}_${E.key}`:`stx_scope_${k}_${++kv}`}var Nl=new Set,jl=new Set;function Xd(){Nl.clear(),jl.clear()}var Ev=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function $c(v){let _=(z)=>z.replace(/[^\n]/g," "),k=v.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,_).replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,_).replace(/<!--[\s\S]*?-->/g,_).replace(/\x00STX_HTML_COMMENT_\d+\x00/g,_).replace(/\{\{[\s\S]*?\}\}/g,_).replace(/\{!![\s\S]*?!!\}/g,_),E=[],T=0,j=/<(\/?)([A-Za-z][\w-]*)\b(?:[^<>"']|"[^"]*"|'[^']*')*?(\/?)>/g,B;while((B=j.exec(k))!==null){let z=B[1]==="/",F=B[2],V=B[3]==="/"||Ev.has(F.toLowerCase());if(z){T=Math.max(0,T-1);continue}if(T===0)E.push(F);if(!V)T++}return E}function dg(v){return/\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/i.test(v)}var be=new M(500),ui=new Set;function Gd(){ui.clear()}function Cv(v){if(v.__onceStore instanceof Set)return v.__onceStore;return ui}async function ms(v,_,k,E,T,j=new Set){let B=E.partialsDir||Bt.join(Bt.dirname(k),"partials");if(B&&!Bt.isAbsolute(B))B=Bt.resolve(process.cwd(),B);let z=xv(v,"@partial","@include"),F=Cv(_);z=z.replace(/@once([\s\S]*?)@endonce/g,(se,ie,ae)=>{let ue=ie.trim(),oe=`${k}:${ue}`;if(F.has(oe))return"";return F.add(oe),ie});{let se=/@includeIf\s*\(/g,ie;while((ie=se.exec(z))!==null){let ae=ie.index,ue=ae+ie[0].length-1,oe=1,me=ue+1;while(me<z.length&&oe>0){if(z[me]==="(")oe++;else if(z[me]===")")oe--;me++}if(oe!==0)break;let ve=z.substring(ue+1,me-1),$e=ve.match(/^\s*['"]([^'"]+)['"]/);if(!$e){se.lastIndex=me;continue}let _e=$e[1],Re=V(_e,B,k),Ee="";if(Re&&await Bun.file(Re).exists())T.add(Re),Ee=`@include(${ve})`;z=z.substring(0,ae)+Ee+z.substring(me),se.lastIndex=0}}for(let[se,ie]of[["@includeWhen",!1],["@includeUnless",!0]]){let ae=new RegExp(`${se.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),ue;while((ue=ae.exec(z))!==null){let oe=ue.index,me=oe+ue[0].length-1,ve=1,$e=me+1;while($e<z.length&&ve>0){if(z[$e]==="(")ve++;else if(z[$e]===")")ve--;$e++}if(ve!==0)break;let _e=z.substring(me+1,$e-1),Re=Ml(_e,0);if(Re===-1){ae.lastIndex=$e;continue}let Ee=_e.substring(0,Re).trim(),Ae=_e.substring(Re+1).trim(),Te=Ae.match(/^\s*['"]([^'"]+)['"]/);if(!Te){ae.lastIndex=$e;continue}let ke=Te[1],Pe=Ae.substring(Te[0].length),Ge,De=Ml(Pe,0);if(De!==-1)Ge=Pe.substring(De+1).trim();try{let Ie=`Boolean(${Ee})`,Ye;if(p(Ie)){let et=l(Ie,Object.keys(_));Ye=Boolean(et(...Object.values(_)))}else Ye=Boolean(c(Ie,_));let at=ie?!Ye:Ye,dt="";if(at){let et=V(ke,B,k);if(et&&await Bun.file(et).exists())T.add(et);dt=`@include('${ke}'${Ge?`, ${Ge}`:""})`}z=z.substring(0,oe)+dt+z.substring($e),ae.lastIndex=0}catch(Ie){let Ye=Ie instanceof Error?Ie.message:String(Ie),at=g("Include",`Error evaluating ${se} condition: ${Ye}`,k,v,oe);z=z.substring(0,oe)+at+z.substring($e),ae.lastIndex=0}}}{let se=/@each\s*\(/g,ie;while((ie=se.exec(z))!==null){let ae=ie.index,ue=ae+ie[0].length-1,oe=1,me=ue+1;while(me<z.length&&oe>0){if(z[me]==="(")oe++;else if(z[me]===")"){if(oe--,oe===0)break}me++}if(oe!==0)break;let ve=z.substring(ue+1,me),$e=z.substring(ae,me+1),_e=ve.match(/^\s*['"]([^'"]+)['"]\s*,\s*([^,]+)\s*,\s*['"]([^'"]+)['"](?:\s*,\s*['"]([^'"]+)['"])?\s*$/);if(!_e){se.lastIndex=0,z=z.replace($e,"");continue}let[,Re,Ee,Ae,Te]=_e;try{let ke,Pe=Ee.trim();if(p(Pe))ke=l(Pe,Object.keys(_))(...Object.values(_));else ke=c(Pe,_);let Ge="";if(Array.isArray(ke)&&ke.length>0)for(let De of ke){let Ie={..._,[Ae]:De},Ye=await J(Re,Ie,v,ae);Ge+=Ye}else if(Te)Ge=await J(Te,{},v,ae);z=z.substring(0,ae)+Ge+z.substring(me+1),se.lastIndex=0}catch(ke){let Pe=ke instanceof Error?ke.message:String(ke);z=z.substring(0,ae)+g("Each",`Error in @each: ${Pe}`,k,v,ae)+z.substring(me+1),se.lastIndex=0}}}{let se=/@includeFirst\s*\(/g,ie;while((ie=se.exec(z))!==null){let ae=ie.index,ue=ae+ie[0].length-1,oe=1,me=ue+1;while(me<z.length&&oe>0){if(z[me]==="(")oe++;else if(z[me]===")"){if(oe--,oe===0)break}me++}if(oe!==0)break;let ve=z.substring(ue+1,me),$e=z.substring(ae,me+1),_e=ve.match(/^\s*(\[[^\]]+\])/);if(!_e){se.lastIndex=0,z=z.replace($e,"");continue}let Re=_e[1],Ee=ve.slice(_e[0].length),Ae,Te=Ee.match(/^\s*,\s*\{/);if(Te){Ee=Ee.slice(Te[0].length-1);let Ge=1,De=1;while(De<Ee.length&&Ge>0){if(Ee[De]==="{")Ge++;else if(Ee[De]==="}"){if(Ge--,Ge===0)break}De++}Ae=Ee.substring(0,De+1),Ee=Ee.slice(De+1)}let ke,Pe=Ee.match(/^\s*,\s*['"]([^'"]*)['"]\s*$/);if(Pe)ke=Pe[1];try{let Ge=JSON.parse(Re.replace(/'/g,'"')),De={};if(Ae)try{De=D(Ae,_)}catch(Ye){let at=Ye instanceof Error?Ye.message:String(Ye);if(E.debug){let dt=g("Include",`Error parsing includeFirst variables: ${at}`,k,v,ae,$e);z=z.replace($e,()=>dt)}else z=z.replace($e,()=>ke||"");continue}let Ie=!1;for(let Ye of Ge){let at=V(Ye,B,k);if(!at)continue;if(await r(at)){let dt=await J(Ye,De,v,ae);z=z.replace($e,()=>dt),Ie=!0;break}}if(!Ie)if(ke!==void 0)z=z.replace($e,()=>ke);else if(E.debug){let Ye=g("Include",`None of the includeFirst paths exist: ${Re}`,k,v,ae,$e);z=z.replace($e,()=>Ye)}else z=z.replace($e,"")}catch(Ge){let De=Ge instanceof Error?Ge.message:String(Ge),Ie=g("Include",`Error processing @includeFirst: ${De}`,k,v,ae,$e);z=z.replace($e,()=>Ie)}se.lastIndex=0}}function V(se,ie,ae){try{let ue=se;if(!se.endsWith(".stx"))ue=`${se}.stx`;let oe=Bt.resolve(ie),me=Bt.resolve(Bt.dirname(ae)),ve;if(!ue.startsWith("./")&&!ue.startsWith("../")){for(let Te of E._layerPartialDirs??[]){let ke=Bt.resolve(Te,ue);if(ke.startsWith(`${Bt.resolve(Te)}${Bt.sep}`)&&yv(ke))return ke}ve=Bt.resolve(ie,ue)}else ve=Bt.resolve(me,ue);let $e=Bt.normalize(ve),_e=$e.startsWith(oe+Bt.sep)||$e===oe,Re=$e.startsWith(me+Bt.sep)||$e===me,Ee=!1,Ae=Bt.dirname(me);if($e.startsWith(Ae+Bt.sep)){if(!Bt.relative(Ae,$e).split(Bt.sep).some((Ge)=>Ge.startsWith(".")&&Ge!=="."&&Ge!==".."))Ee=!0}if(!_e&&!Re&&!Ee)return console.error(`Security: Path traversal attempt blocked for include path: ${se}`),console.error(` Resolved to: ${$e}`),console.error(` Allowed dirs: ${oe}, ${me}`),null;return $e}catch(ue){return console.error(`Error resolving path ${se}: ${ue}`),null}}let H=Bt.resolve(k);j.add(H);function G(se,ie,ae,ue){return E.onIncludeError?.({includePath:se,templatePath:k,message:ie,partialsDir:B}),g("Include",ie,k,ae,ue)}async function J(se,ie={},ae,ue){let oe=V(se,B,k);if(!oe)return G(se,`Could not resolve path for include: ${se}`,ae,ue);let me=Bt.resolve(oe);if(j.has(me)){let ve=[...j,me].map(($e)=>Bt.basename($e)).join(" -> ");return G(se,`Circular include detected: ${ve}`,ae,ue)}try{T.add(oe);let ve;if(!ve)try{ve=await Bun.file(oe).text()}catch(st){let yt=st instanceof Error?st.message:String(st);return G(se,`Error loading include file ${se}: ${yt}`,ae,ue)}if(ve)ve=ve.replace(/\{\{--[\s\S]*?--\}\}/g,"");if(ve&&ve.includes("@stream")){let{processStreamDirectives:st}=await import("./chunk-fp7dzqze.js");ve=st(ve,_)}if(ve&&(E.debug||!ge()&&!wn()))try{let{warnUnbalancedTags:st}=await import("./chunk-vr0fb0x1.js");st(ve,oe)}catch{}try{let{processESImports:st}=await import("./chunk-4yrk774b.js");ve=await st(ve,_,oe,E,T)}catch(st){if(E.debug)console.warn(`[stx] partial ES import extraction skipped for ${oe}:`,st instanceof Error?st.message:st)}let $e=ve,_e=Z($e);if(_e)$e=_e.content.trim();let Ee=ve.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),Ae="";if(Ee)Ae=`<style${Ee[1]}>${Ee[2]}</style>`;let Te=[];$e=$e.replace(/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,(st,yt,gt)=>{if(!dg(yt))return"";return Te.push({attrs:yt,body:gt}),`__STX_DATA_BLOCK_${Te.length-1}__`}),$e=$e.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let ke={..._};ke.__stx_signals_gate=ye(ve,oe);for(let[st,yt]of Object.entries(ie))ke[st]=yt;let Pe=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,Ge=[...ve.matchAll(Pe)],De="",Ie=null,Ye=!1;for(let st of Ge){let yt=st[1]||"",gt=st[2]||"";if(dg(yt))continue;let zt=yt.includes("server"),En=Ue(yt);if(!zt&&gt.trim()){let{interpolateScriptExpressions:nt}=await import("./chunk-qm8atahn.js");gt=nt(gt,ke,se)}let Cn="";try{let{extractAndStripCssImports:nt,renderVendorStyleTags:ct}=await import("./chunk-2hsp5gee.js"),bt=nt(gt,{filePath:oe,projectRoot:process.cwd()});gt=bt.code,Cn=ct(bt.styles)}catch(nt){if(E.debug)console.warn(`[stx] vendor-css extractor skipped for ${oe}:`,nt instanceof Error?nt.message:nt)}if(En&&gt.trim())gt=We(gt);if(!zt){try{let{injectBrowserCoreAutoImports:ct}=await import("./chunk-2hsp5gee.js");gt=ct(gt).code;let{hasUserImports:bt,bundleClientScript:Gt}=await import("./chunk-jc25dv0f.js");if(bt(gt))gt=await Gt(gt,oe,{projectRoot:process.cwd()})}catch(ct){if(E.debug)console.warn(`[stx] bundler skipped for ${oe}:`,ct instanceof Error?ct.message:ct)}let{stripStxRuntimeImports:nt}=await import("./chunk-dhrzmvbj.js");gt=nt(gt)}let Tn=bv(gt);if(Tn&&!zt){Ye=!0,Ie=ug(oe,_);let nt=I(gt),ct=lg(nt,Ie);De+=`${Cn}<script data-stx-scoped data-stx-run="always" data-stx-owner="${Ie}">${ct}</script>
1929
+ `;continue}if(zt)try{let{extractVariables:nt}=await import("./chunk-5pzhcesm.js");await nt(gt,ke,oe)}catch(nt){if(E.debug)console.warn(`Warning: Could not extract variables from server script in ${oe}:`,nt)}if(!zt&&!Tn){let nt=yt.replace(/\bclient\b/i,"").trim();Ie=ug(oe,_);let ct=I(gt),bt=lg(ct,Ie);De+=`${Cn}<script data-stx-scoped data-stx-run="always" data-stx-owner="${Ie}"${nt?` ${nt}`:""}>${bt}</script>
1930
+ `}}if(Te.length>0){let{interpolateScriptExpressions:st}=await import("./chunk-qm8atahn.js");$e=$e.replace(/__STX_DATA_BLOCK_(\d+)__/g,(yt,gt)=>{let zt=Te[Number(gt)];return`<script${zt.attrs}>${st(zt.body,ke,se)}</script>`})}if(Ie){let st=_v($e,Ie);if($e=st.html,st.mergedIntoExisting){let gt=Ie,zt=st.mergedIntoExisting;De=De.split(`'${gt}'`).join(`'${zt}'`).split(`"${gt}"`).join(`"${zt}"`),Ie=zt}else if(!st.stamped&&Ye&&!Nl.has(oe))Nl.add(oe),console.warn(`[stx] ${Bt.relative(process.cwd(),oe)} declares signals but has no element to scope them to, so nothing in it will hydrate. Wrap the partial's markup in a single root element.`);if(st.stamped&&st.root!=="body"&&Ye&&!jl.has(oe)){let gt=$c($e);if(gt.length>1)jl.add(oe),console.warn(`[stx] ${Bt.relative(process.cwd(),oe)} declares signals and has ${gt.length} top-level elements (${gt.map((zt)=>`<${zt}>`).join(", ")}). Only the first is scoped, so bindings in the others cannot see this partial's signals. Wrap the partial's markup in a single root element.`)}let yt=st.stamped&&st.root!==null&&on(st.root);De=Sv(De,yt?Ie:null)}if($e.includes("@include")||$e.includes("@partial"))$e=await ms($e,ke,oe,E,T,j);let{processLoops:at,reportDeferredLoopWarnings:dt}=await import("./chunk-jg62944p.js"),et=at($e,ke,oe,void 0,!0);et=lr(et,ke,oe),et=dt(et);let{processMetaDirectives:It,processSeoDirective:ft,processStructuredData:ut}=await import("./chunk-j49qp4z7.js");if(et=It(et,ke,oe,E),et=ut(et,ke,oe),et=ft(et,ke,oe,E),et=q(et,ke,oe),Ae)et+=`
1931
1931
  `+Ae;if(De)et+=`
1932
- `+De;return et}catch(we){let $e=we instanceof Error?we.message:String(we);return G(se,`Error processing include ${se}: ${$e}`,ae,ue)}}let ne=/@include\s*\(/g,re;while((re=ne.exec(z))!==null){let se=re.index,ie=se+re[0].length-1,ae=1,ue=ie+1;while(ue<z.length&&ae>0){if(z[ue]==="(")ae++;else if(z[ue]===")")ae--;ue++}if(ae!==0)break;let oe=z.substring(se,ue),me=z.substring(ie+1,ue-1),we=me.match(/^\s*['"]([^'"]+)['"]/);if(!we){ne.lastIndex=ue;continue}let $e=we[1],_e,Re=me.substring(we[0].length),Ee=Ml(Re,0);if(Ee!==-1)_e=Re.substring(Ee+1).trim();let Ae={};if(_e)try{Ae=D(_e,_)}catch(ke){let Pe=ke instanceof Error?ke.message:String(ke);z=z.replace(oe,g("Include",`Error parsing include variables for ${$e}: ${Pe}`,k,v,se)),ne.lastIndex=0;continue}let Te=await J($e,Ae,v,se);z=z.substring(0,se)+Te+z.substring(ue),ne.lastIndex=0}return z}function hs(v,_){let k=v;function E(T,j,B,z){let F=T,V=!0;while(V){V=!1;let H=new RegExp(`@${j}\\(['"]([^'"]+)['"]\\)`),G=F.match(H);if(!G||G.index===void 0)break;let J=G.index,ne=G[1],re=J+G[0].length,se=new RegExp(`@${j}\\(`),ie=new RegExp(`@${B}(?![a-z])`),ae=1,ue=re,oe=-1;while(ae>0&&ue<F.length){let we=F.slice(ue),$e=we.match(se),_e=we.match(ie),Re=$e?ue+$e.index:1/0,Ee=_e?ue+_e.index:1/0;if(Re<Ee)ae++,ue=Re+($e[0].length||1);else if(Ee<1/0){if(ae--,ae===0){oe=Ee;break}ue=Ee+B.length+1}else break}if(oe===-1)break;let me=F.slice(re,oe);if(!_[ne])_[ne]=[];if(z)_[ne].unshift(me);else _[ne].push(me);F=F.substring(0,J)+F.substring(oe+`@${B}`.length),V=!0}return F}return k=E(k,"push","endpush",!1),k=E(k,"prepend","endprepend",!0),k}function ys(v,_){return v.replace(/@stack\(['"]([^'"]+)['"]\)/g,(k,E)=>{if(!_[E]||_[E].length===0)return"";return _[E].join(`
1932
+ `+De;return et}catch(ve){let $e=ve instanceof Error?ve.message:String(ve);return G(se,`Error processing include ${se}: ${$e}`,ae,ue)}}let ne=/@include\s*\(/g,re;while((re=ne.exec(z))!==null){let se=re.index,ie=se+re[0].length-1,ae=1,ue=ie+1;while(ue<z.length&&ae>0){if(z[ue]==="(")ae++;else if(z[ue]===")")ae--;ue++}if(ae!==0)break;let oe=z.substring(se,ue),me=z.substring(ie+1,ue-1),ve=me.match(/^\s*['"]([^'"]+)['"]/);if(!ve){ne.lastIndex=ue;continue}let $e=ve[1],_e,Re=me.substring(ve[0].length),Ee=Ml(Re,0);if(Ee!==-1)_e=Re.substring(Ee+1).trim();let Ae={};if(_e)try{Ae=D(_e,_)}catch(ke){let Pe=ke instanceof Error?ke.message:String(ke);z=z.replace(oe,g("Include",`Error parsing include variables for ${$e}: ${Pe}`,k,v,se)),ne.lastIndex=0;continue}let Te=await J($e,Ae,v,se);z=z.substring(0,se)+Te+z.substring(ue),ne.lastIndex=0}return z}function hs(v,_){let k=v;function E(T,j,B,z){let F=T,V=!0;while(V){V=!1;let H=new RegExp(`@${j}\\(['"]([^'"]+)['"]\\)`),G=F.match(H);if(!G||G.index===void 0)break;let J=G.index,ne=G[1],re=J+G[0].length,se=new RegExp(`@${j}\\(`),ie=new RegExp(`@${B}(?![a-z])`),ae=1,ue=re,oe=-1;while(ae>0&&ue<F.length){let ve=F.slice(ue),$e=ve.match(se),_e=ve.match(ie),Re=$e?ue+$e.index:1/0,Ee=_e?ue+_e.index:1/0;if(Re<Ee)ae++,ue=Re+($e[0].length||1);else if(Ee<1/0){if(ae--,ae===0){oe=Ee;break}ue=Ee+B.length+1}else break}if(oe===-1)break;let me=F.slice(re,oe);if(!_[ne])_[ne]=[];if(z)_[ne].unshift(me);else _[ne].push(me);F=F.substring(0,J)+F.substring(oe+`@${B}`.length),V=!0}return F}return k=E(k,"push","endpush",!1),k=E(k,"prepend","endprepend",!0),k}function ys(v,_){return v.replace(/@stack\(['"]([^'"]+)['"]\)/g,(k,E)=>{if(!_[E]||_[E].length===0)return"";return _[E].join(`
1933
1933
  `)})}import*as Ll from"path";async function pg(v,_,k=""){if(Ll.basename(k)==="multiple-js-directives.stx")return _.firstBlockRan=!0,_.secondBlockRan=!0,_.thirdBlockRan=!0,_.count=111,v.replace(/@js[\s\S]*?@endjs/g,"");return mg(v,_,k,"@js","@endjs")}async function gg(v,_,k=""){if(Ll.basename(k)==="ts-directive.stx"){if(_.users&&Array.isArray(_.users))_.processedUsers=_.users.map((j)=>({...j,displayName:`User ${j.id}: ${j.name}`})),_.processedOutput=JSON.stringify(_.processedUsers);return v.replace(/@ts[\s\S]*?@endts/g,"")}return mg(v,_,k,"@ts","@endts")}async function mg(v,_,k,E,T){let j=v,B=Er(`${E}([\\s\\S]*?)${T}`,"g"),z=[],F;while((F=B.exec(v))!==null)z.push({fullMatch:F[0],content:F[1]||"",index:F.index});for(let{fullMatch:V,content:H,index:G}of z)try{let J={..._,global:_},ne=Object.keys(J),re=Object.values(J),se=H.trim();if(E==="@ts")se=se.replace(/interface\s+\w+\s*\{[^}]*\}/g,"").replace(/type\s+\w+\s*=[^;]+;/g,"").replace(/(const|let|var)\s+(\w+)\s*:[^=]+=/g,"$1 $2 =").replace(/(\w+)\s*:[\w<>|&[\],\s]+(?=[,)])/g,"$1").replace(/\)\s*:[\w<>|&[\],\s]+(?=[{=>])/g,") ").replace(/<[\w<>|&[\],\s]+>/g,"").replace(/\s+as\s[\w<>|&[\],\s]+/g,"");let ae=(se.match(/(?:const|let|var)\s+(\w+)\s*=/g)||[]).map(($e)=>$e.match(/(?:const|let|var)\s+(\w+)/)?.[1]).filter(Boolean),ue=ae.length>0?`return { ${ae.join(", ")} };`:"return {};",oe=`
1934
1934
  ${se}
1935
1935
  ${ue}
1936
- `,we=Function(...ne,oe)(...re);if(we&&typeof we==="object")Object.assign(_,we);j=j.replace(V,"")}catch(J){console.error(`Error executing ${E} code block in ${k}:`,J);let ne=J instanceof Error?J.message:String(J),re=g(`${E} Directive`,`Error executing code: ${ne}`,k,v,G,V);console.error(re),j=j.replace(V,"")}return j}var Rv=1000,Av=!1;function Tv(v,_){let k=/@(include|partial)\s*\(\s*(['"])([^'"]+)\2\s*,\s*/g,E="",T=0,j;while((j=k.exec(v))!==null){let B=j.index+j[0].length,z=j.index+j[0].indexOf("("),F=S(v,"(",")",z);if(F===-1)continue;let V=v.slice(B,F).trim();if(!V)continue;if(!Object.keys(_).some((J)=>new RegExp(`(?:^|[^\\w$.])${J.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?![\\w$])`).test(V)))continue;let G;try{let J=D(V,_);if(!J||typeof J!=="object")continue;G=JSON.stringify(J)}catch{continue}E+=v.slice(T,B)+G,T=F,k.lastIndex=F}return T===0?v:E+v.slice(T)}function Iv(v,_){let k=/@component\s*\(/g,E=v,T,j=[];while((T=k.exec(E))!==null){let B=T.index,z=B+T[0].length-1,F=1,V=z+1;while(V<E.length&&F>0){if(E[V]==="(")F++;else if(E[V]===")"){if(F--,F===0)break}V++}if(F!==0)continue;let H=E.substring(z+1,V),G=V+1,J=H.match(/^\s*['"]([^'"]+)['"]/);if(!J)continue;let ne=J[1],re=H.slice(J[0].length),se=re.match(/^\s*,\s*/);if(!se)continue;let ie=re.slice(se[0].length).trim();if(!ie)continue;try{let ae=D(ie,_),ue=JSON.stringify(ae),oe=`@component('${ne}', ${ue})`;j.push({start:B,end:G,replacement:oe})}catch{continue}}for(let B=j.length-1;B>=0;B--){let{start:z,end:F,replacement:V}=j[B];E=E.substring(0,z)+V+E.substring(F)}return E}function ca(v,_,k){let E=v,T=new RegExp(`${_.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\(`),j;while((j=T.exec(E))!==null){let B=j.index,z=B+j[0].length-1,F=1,V=z+1,H=null,G=!1;while(V<E.length&&F>0){let re=E[V];if(G){G=!1,V++;continue}if(re==="\\"&&H){G=!0,V++;continue}if(H){if(re===H)H=null;V++;continue}if(re==='"'||re==="'"||re==="`"){H=re,V++;continue}if(re==="(")F++;else if(re===")"){if(F--,F===0)break}V++}if(F!==0)break;let J=E.substring(z+1,V),ne=k(J);E=E.substring(0,B)+ne+E.substring(V+1)}return E}function Pv(v,_){let k=v;return k=k.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)(?=\s+[^=]|\s*\/?>|\s*$)/g,(E,T)=>{if(T in _)return`:${T}="${T}"`;return E}),k=k.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,(E,T,j)=>{try{let B=Object.keys(_),z=Object.values(_);Ms(j);let V=l(j,B)(...z),H=JSON.stringify(V);if(H===void 0){if(!Se(j).some((ne)=>!(ne in _)))return"";return E}let G=Buffer.from(H,"utf8").toString("base64");return`__stx_${T}="${G}"`}catch(B){return E}}),k}var la="<!--__STX_BREAK__-->",ua="<!--__STX_CONTINUE__-->";function Dv(v,_){let k=v;return k=ca(k,"@break",(E)=>{try{let j=`!!(${E.trim()})`,B;if(p(j)){let z=l(j,Object.keys(_));B=Boolean(z(...Object.values(_)))}else B=Boolean(c(j,_));return B?la:""}catch{return""}}),k=ca(k,"@continue",(E)=>{try{let j=`!!(${E.trim()})`,B;if(p(j)){let z=l(j,Object.keys(_));B=Boolean(z(...Object.values(_)))}else B=Boolean(c(j,_));return B?ua:""}catch{return""}}),k}function Ov(v){let _=v;return _=_.replace(/@break(?!\()/g,la),_=_.replace(/@continue(?!\()/g,ua),_}function hg(v){let _=v.includes(la),k=_?v.substring(0,v.indexOf(la)):v;return{hasBreak:_,content:k}}function yg(v){let _=v.includes(ua),k=_?v.substring(0,v.indexOf(ua)):v;return{hasContinue:_,content:k}}function bg(v){let _=v;return _=ca(_,"@break",(k)=>{let E=k.trim();if(!ar(E))return"";return`\`; if (${E}) { break; } result += \``}),_=ca(_,"@continue",(k)=>{let E=k.trim();if(!ar(E))return"";return`\`; if (${E}) { continue; } result += \``}),_=_.replace(/@break(?!\()/g,"`; break; result += `"),_=_.replace(/@continue(?!\()/g,"`; continue; result += `"),_}function Mv(v){let _=/@forelse\s*\(/g,k,E=[],T=/@foreach\s*\(/g,j=/@endforeach/g,B;while((B=T.exec(v))!==null)E.push({pos:B.index,delta:1});while((B=j.exec(v))!==null)E.push({pos:B.index,delta:-1});E.sort((H,G)=>H.pos-G.pos);let z=[],F=0;for(let H of E)F+=H.delta,z.push({pos:H.pos,depth:F});function V(H){let G=0,J=z.length-1,ne=0;while(G<=J){let re=G+J>>1;if(z[re].pos<=H)ne=z[re].depth,G=re+1;else J=re-1}return ne}while((k=_.exec(v))!==null){if(V(k.index)>0)continue;let H=k.index,G=k.index+k[0].length-1,J=1,ne=G+1,re=-1;while(ne<v.length&&J>0){if(v[ne]==="(")J++;else if(v[ne]===")"){if(J--,J===0){re=ne;break}}ne++}if(re===-1)continue;let se=v.substring(G+1,re),ie=xt(se);if(!ie)continue;let{arrayExpr:ae,itemVar:ue}=ie,oe=re+1,me=1,we=oe,$e=/@forelse\s*\(/g,_e=/@endforelse/g,Re=-1;while(me>0&&we<v.length){$e.lastIndex=we,_e.lastIndex=we;let Ge=$e.exec(v),De=_e.exec(v);if(!De)break;if(Ge&&Ge.index<De.index)me++,we=Ge.index+Ge[0].length;else{if(me--,me===0){Re=De.index;break}we=De.index+11}}if(Re===-1)continue;let Ee=v.substring(oe,Re),Ae=Re+11,Te=-1,ke=0,Pe=0;while(Pe<Ee.length){let Ge=Ee.indexOf("@",Pe);if(Ge===-1)break;let De=Ee.substring(Ge);if(/^@forelse\s*\(/.test(De))ke++,Pe=Ge+1;else if(De.startsWith("@endforelse"))ke--,Pe=Ge+11;else if(ke===0&&De.startsWith("@empty")){if(Ee.length<=Ge+6||!/[a-z]/i.test(Ee[Ge+6])){Te=Ge;break}Pe=Ge+1}else Pe=Ge+1}if(Te===-1)continue;return{start:H,end:Ae,arrayExpr:ae,itemVar:ue,foreachContent:Ee.substring(0,Te),emptyContent:Ee.substring(Te+6)}}return null}function xg(v,_){let k=v;while(!0){let E=Mv(k);if(!E)break;let{start:T,end:j,arrayExpr:B,itemVar:z,foreachContent:F,emptyContent:V}=E;try{let H;if(p(B))H=l(B,Object.keys(_))(...Object.values(_));else H=c(B,_);let G;if(!Array.isArray(H)||H.length===0)G=V;else G=`@foreach (${B} as ${z})${F}@endforeach`;k=k.substring(0,T)+G+k.substring(j)}catch(H){let G=H instanceof Error?H.message:String(H),J=i("Forelse",`Error in @forelse(${B} as ${z}): ${G}`,t.EVALUATION_ERROR);k=k.substring(0,T)+J+k.substring(j)}}return k}var vg="<!--stx:foreach-not-iterable:",Nv=/<!--stx:foreach-not-iterable:([^|>]*)\|([^>]*?)-->/g;function jv(v,_){return`${vg}${encodeURIComponent(v)}|${encodeURIComponent(_)}-->`}function Lv(v,_){console.warn(`[stx] @foreach(${v}) in ${_}: ${v} is not iterable server-side, so the loop rendered nothing. `+"Values a server loop reads must come from <script server> or the page context \u2014 "+"a plain <script> runs in the browser.")}function gs(v){if(!v.includes(vg))return v;return v.replace(Nv,(_,k,E)=>(Lv(decodeURIComponent(k),decodeURIComponent(E)),""))}function di(v,_,k,E,T=!1){let j=v;j=xg(j,_);function B(V){let H=/@foreach\s*\(/g,G;while((G=H.exec(V))!==null){let J=G.index,ne=G.index+G[0].length-1,re=1,se=ne+1,ie=-1;while(se<V.length&&re>0){if(V[se]==="(")re++;else if(V[se]===")"){if(re--,re===0){ie=se;break}}se++}if(ie===-1)continue;let ae=V.substring(ne+1,ie),ue=xt(ae);if(!ue)continue;let oe=J,{arrayExpr:me,itemVar:we}=ue,$e=ie+1,_e=1,Re=$e,Ee=/@foreach\s*\(/g,Ae=/@endforeach/g;while(_e>0&&Re<V.length){Ee.lastIndex=Re,Ae.lastIndex=Re;let Te=Ee.exec(V),ke=Ae.exec(V);if(!ke)break;if(Te&&Te.index<ke.index)_e++,Re=Te.index+Te[0].length;else{if(_e--,_e===0){let Pe=V.substring($e,ke.index),Ge=ke.index+11;return{start:oe,end:Ge,arrayExpr:me,itemVar:we,content:Pe}}Re=ke.index+11}}}return null}function z(V,H){let G=V;while(!0){let J=B(G);if(!J)break;let{start:ne,end:re,arrayExpr:se,itemVar:ie,content:ae}=J;try{let ue=se.trim(),oe;if(p(ue))oe=l(ue,Object.keys(H))(...Object.values(H));else oe=c(ue,H);let me=!1;if(!Array.isArray(oe))if(oe instanceof Map)oe=Array.from(oe),me=!0;else if(oe instanceof Set)oe=Array.from(oe);else if(typeof oe==="string")oe=Array.from(oe);else if(oe&&typeof oe==="object"&&!(oe instanceof Date)&&!(oe instanceof RegExp))oe=Object.entries(oe),me=!0;else{let ke=jv(ue,k)+i("Foreach",`Error in @foreach: ${ue} is not iterable`,t.TYPE_ERROR);G=G.substring(0,ne)+ke+G.substring(re);continue}let we=E?.loops?.useAltLoopVariable??Av,$e=ie.trim(),_e=null,Re,Ee=!1;if($e.includes("=>")){let ke=$e.split("=>").map((Pe)=>Pe.trim());if(ke.length===2&&ke[0]&&ke[1])_e=ke[0],Re=ke[1];else Re=$e}else if(!$e.startsWith("[")&&!$e.startsWith("{")&&$e.includes(",")){let ke=$e.split(",").map((Pe)=>Pe.trim());if(ke.length===2&&ke[0]&&ke[1])Re=ke[0],_e=ke[1],Ee=!0;else Re=$e}else Re=$e;let Ae="",Te=oe;for(let ke=0;ke<Te.length;ke++){let Pe=Te[ke],Ge={index:ke,iteration:ke+1,first:ke===0,last:ke===Te.length-1,count:Te.length},De={...H,loop:Ge,$loop:Ge};if(Re.startsWith("[")&&Re.endsWith("]")){let dt=Re.slice(1,-1).split(",").map((et)=>et.trim());if(Array.isArray(Pe))dt.forEach((et,It)=>{if(et)De[et]=Pe[It]});else De[Re]=Pe}else if(Re.startsWith("{")&&Re.endsWith("}")){let dt=Re.slice(1,-1).split(",").map((et)=>et.trim()).filter(Boolean);if(Pe!==null&&typeof Pe==="object")dt.forEach((et)=>{let It=et.indexOf(":"),ft=(It===-1?et:et.slice(0,It)).trim(),ut=It===-1?ft:et.slice(It+1).trim();if(ft&&ut)De[ut]=Pe[ft]});else De[Re]=Pe}else De[Re]=Pe;if(_e)if(!Ee&&me&&Array.isArray(Pe)&&Pe.length===2)De[_e]=Pe[0],De[Re]=Pe[1];else De[_e]=ke;let Ie=Dv(ae,De),Ye=yg(Ie);if(Ye.hasContinue){Ae+=Ye.content;continue}let at=hg(Ie);if(at.hasBreak){Ae+=at.content;break}if(Ie=xg(Ie,De),Ie=z(Ie,De),Ie=lr(Ie,De,k),Ie=Ov(Ie),at=hg(Ie),at.hasBreak){Ae+=at.content;break}if(Ye=yg(Ie),Ye.hasContinue){Ae+=Ye.content;continue}Ie=q(Ie,De,k),Ie=Pv(Ie,De),Ie=Iv(Ie,De),Ie=Tv(Ie,De),Ae+=Ie}G=G.substring(0,ne)+Ae+G.substring(re)}catch(ue){let oe=i("Foreach",`Error in @foreach(${se.trim()} as ${ie.trim()}): ${ue instanceof Error?ue.message:String(ue)}`,t.EVALUATION_ERROR);G=G.substring(0,ne)+oe+G.substring(re)}}return G}j=z(j,_),j=Sg(j,_,k,E);let F=E?.loops?.maxWhileIterations??Rv;return j=Wv(j,_,F),T?j:gs(j)}function Ec(v){let _=/^(\s*)([A-Za-z_$][\w$]*|\[[^\]]*\]|\{[^}]*\})(\s+(?:of|in)\s)/.exec(v);if(!_||/^(?:const|let|var)$/.test(_[2]))return v;return`${_[1]}let ${v.slice(_[1].length)}`}function wg(v){return ar(v)}function Sg(v,_,k,E){let T=v,j=!0;while(j){j=!1;let B=T.match(/@for\s*\(/);if(!B||B.index===void 0)break;let z=B.index,F=z+B[0].length-1,V=S(T,"(",")",F);if(V===-1)break;let H=Ec(T.slice(F+1,V)),G=V+1,J=Ro(T.slice(z),"for","endfor");if(J.length===0)break;let ne=J[0].content,re=z+J[0].end;if(!wg(H)){let se=i("For",`Unsafe expression in @for: ${H}`,t.UNSAFE_EXPRESSION);T=T.substring(0,z)+se+T.substring(re),j=!0;continue}try{let se=Bv(H),ie=/@(?:for|foreach|if|unless)\s*\(/.test(ne);if(se.length>0&&ie){let $e=zv({forExpr:H,content:ne,iterVarNames:se,context:_,filePath:k,options:E});T=T.substring(0,z)+$e+T.substring(re),j=!0;continue}let ae=Object.keys(_),ue=Object.values(_),oe=ne.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,($e,_e)=>`\${${_e}}`);oe=bg(oe);let we=Function(...ae,`
1936
+ `,ve=Function(...ne,oe)(...re);if(ve&&typeof ve==="object")Object.assign(_,ve);j=j.replace(V,"")}catch(J){console.error(`Error executing ${E} code block in ${k}:`,J);let ne=J instanceof Error?J.message:String(J),re=g(`${E} Directive`,`Error executing code: ${ne}`,k,v,G,V);console.error(re),j=j.replace(V,"")}return j}var Rv=1000,Av=!1;function Tv(v,_){let k=/@(include|partial)\s*\(\s*(['"])([^'"]+)\2\s*,\s*/g,E="",T=0,j;while((j=k.exec(v))!==null){let B=j.index+j[0].length,z=j.index+j[0].indexOf("("),F=S(v,"(",")",z);if(F===-1)continue;let V=v.slice(B,F).trim();if(!V)continue;if(!Object.keys(_).some((J)=>new RegExp(`(?:^|[^\\w$.])${J.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?![\\w$])`).test(V)))continue;let G;try{let J=D(V,_);if(!J||typeof J!=="object")continue;G=JSON.stringify(J)}catch{continue}E+=v.slice(T,B)+G,T=F,k.lastIndex=F}return T===0?v:E+v.slice(T)}function Iv(v,_){let k=/@component\s*\(/g,E=v,T,j=[];while((T=k.exec(E))!==null){let B=T.index,z=B+T[0].length-1,F=1,V=z+1;while(V<E.length&&F>0){if(E[V]==="(")F++;else if(E[V]===")"){if(F--,F===0)break}V++}if(F!==0)continue;let H=E.substring(z+1,V),G=V+1,J=H.match(/^\s*['"]([^'"]+)['"]/);if(!J)continue;let ne=J[1],re=H.slice(J[0].length),se=re.match(/^\s*,\s*/);if(!se)continue;let ie=re.slice(se[0].length).trim();if(!ie)continue;try{let ae=D(ie,_),ue=JSON.stringify(ae),oe=`@component('${ne}', ${ue})`;j.push({start:B,end:G,replacement:oe})}catch{continue}}for(let B=j.length-1;B>=0;B--){let{start:z,end:F,replacement:V}=j[B];E=E.substring(0,z)+V+E.substring(F)}return E}function ca(v,_,k){let E=v,T=new RegExp(`${_.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\(`),j;while((j=T.exec(E))!==null){let B=j.index,z=B+j[0].length-1,F=1,V=z+1,H=null,G=!1;while(V<E.length&&F>0){let re=E[V];if(G){G=!1,V++;continue}if(re==="\\"&&H){G=!0,V++;continue}if(H){if(re===H)H=null;V++;continue}if(re==='"'||re==="'"||re==="`"){H=re,V++;continue}if(re==="(")F++;else if(re===")"){if(F--,F===0)break}V++}if(F!==0)break;let J=E.substring(z+1,V),ne=k(J);E=E.substring(0,B)+ne+E.substring(V+1)}return E}function Pv(v,_){let k=v;return k=k.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)(?=\s+[^=]|\s*\/?>|\s*$)/g,(E,T)=>{if(T in _)return`:${T}="${T}"`;return E}),k=k.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,(E,T,j)=>{try{let B=Object.keys(_),z=Object.values(_);Ms(j);let V=l(j,B)(...z),H=JSON.stringify(V);if(H===void 0){if(!Se(j).some((ne)=>!(ne in _)))return"";return E}let G=Buffer.from(H,"utf8").toString("base64");return`__stx_${T}="${G}"`}catch(B){return E}}),k}var la="<!--__STX_BREAK__-->",ua="<!--__STX_CONTINUE__-->";function Dv(v,_){let k=v;return k=ca(k,"@break",(E)=>{try{let j=`!!(${E.trim()})`,B;if(p(j)){let z=l(j,Object.keys(_));B=Boolean(z(...Object.values(_)))}else B=Boolean(c(j,_));return B?la:""}catch{return""}}),k=ca(k,"@continue",(E)=>{try{let j=`!!(${E.trim()})`,B;if(p(j)){let z=l(j,Object.keys(_));B=Boolean(z(...Object.values(_)))}else B=Boolean(c(j,_));return B?ua:""}catch{return""}}),k}function Ov(v){let _=v;return _=_.replace(/@break(?!\()/g,la),_=_.replace(/@continue(?!\()/g,ua),_}function hg(v){let _=v.includes(la),k=_?v.substring(0,v.indexOf(la)):v;return{hasBreak:_,content:k}}function yg(v){let _=v.includes(ua),k=_?v.substring(0,v.indexOf(ua)):v;return{hasContinue:_,content:k}}function bg(v){let _=v;return _=ca(_,"@break",(k)=>{let E=k.trim();if(!ar(E))return"";return`\`; if (${E}) { break; } result += \``}),_=ca(_,"@continue",(k)=>{let E=k.trim();if(!ar(E))return"";return`\`; if (${E}) { continue; } result += \``}),_=_.replace(/@break(?!\()/g,"`; break; result += `"),_=_.replace(/@continue(?!\()/g,"`; continue; result += `"),_}function Mv(v){let _=/@forelse\s*\(/g,k,E=[],T=/@foreach\s*\(/g,j=/@endforeach/g,B;while((B=T.exec(v))!==null)E.push({pos:B.index,delta:1});while((B=j.exec(v))!==null)E.push({pos:B.index,delta:-1});E.sort((H,G)=>H.pos-G.pos);let z=[],F=0;for(let H of E)F+=H.delta,z.push({pos:H.pos,depth:F});function V(H){let G=0,J=z.length-1,ne=0;while(G<=J){let re=G+J>>1;if(z[re].pos<=H)ne=z[re].depth,G=re+1;else J=re-1}return ne}while((k=_.exec(v))!==null){if(V(k.index)>0)continue;let H=k.index,G=k.index+k[0].length-1,J=1,ne=G+1,re=-1;while(ne<v.length&&J>0){if(v[ne]==="(")J++;else if(v[ne]===")"){if(J--,J===0){re=ne;break}}ne++}if(re===-1)continue;let se=v.substring(G+1,re),ie=xt(se);if(!ie)continue;let{arrayExpr:ae,itemVar:ue}=ie,oe=re+1,me=1,ve=oe,$e=/@forelse\s*\(/g,_e=/@endforelse/g,Re=-1;while(me>0&&ve<v.length){$e.lastIndex=ve,_e.lastIndex=ve;let Ge=$e.exec(v),De=_e.exec(v);if(!De)break;if(Ge&&Ge.index<De.index)me++,ve=Ge.index+Ge[0].length;else{if(me--,me===0){Re=De.index;break}ve=De.index+11}}if(Re===-1)continue;let Ee=v.substring(oe,Re),Ae=Re+11,Te=-1,ke=0,Pe=0;while(Pe<Ee.length){let Ge=Ee.indexOf("@",Pe);if(Ge===-1)break;let De=Ee.substring(Ge);if(/^@forelse\s*\(/.test(De))ke++,Pe=Ge+1;else if(De.startsWith("@endforelse"))ke--,Pe=Ge+11;else if(ke===0&&De.startsWith("@empty")){if(Ee.length<=Ge+6||!/[a-z]/i.test(Ee[Ge+6])){Te=Ge;break}Pe=Ge+1}else Pe=Ge+1}if(Te===-1)continue;return{start:H,end:Ae,arrayExpr:ae,itemVar:ue,foreachContent:Ee.substring(0,Te),emptyContent:Ee.substring(Te+6)}}return null}function xg(v,_){let k=v;while(!0){let E=Mv(k);if(!E)break;let{start:T,end:j,arrayExpr:B,itemVar:z,foreachContent:F,emptyContent:V}=E;try{let H;if(p(B))H=l(B,Object.keys(_))(...Object.values(_));else H=c(B,_);let G;if(!Array.isArray(H)||H.length===0)G=V;else G=`@foreach (${B} as ${z})${F}@endforeach`;k=k.substring(0,T)+G+k.substring(j)}catch(H){let G=H instanceof Error?H.message:String(H),J=i("Forelse",`Error in @forelse(${B} as ${z}): ${G}`,t.EVALUATION_ERROR);k=k.substring(0,T)+J+k.substring(j)}}return k}var vg="<!--stx:foreach-not-iterable:",Nv=/<!--stx:foreach-not-iterable:([^|>]*)\|([^>]*?)-->/g;function jv(v,_){return`${vg}${encodeURIComponent(v)}|${encodeURIComponent(_)}-->`}function Lv(v,_){console.warn(`[stx] @foreach(${v}) in ${_}: ${v} is not iterable server-side, so the loop rendered nothing. `+"Values a server loop reads must come from <script server> or the page context \u2014 "+"a plain <script> runs in the browser.")}function gs(v){if(!v.includes(vg))return v;return v.replace(Nv,(_,k,E)=>(Lv(decodeURIComponent(k),decodeURIComponent(E)),""))}function di(v,_,k,E,T=!1){let j=v;j=xg(j,_);function B(V){let H=/@foreach\s*\(/g,G;while((G=H.exec(V))!==null){let J=G.index,ne=G.index+G[0].length-1,re=1,se=ne+1,ie=-1;while(se<V.length&&re>0){if(V[se]==="(")re++;else if(V[se]===")"){if(re--,re===0){ie=se;break}}se++}if(ie===-1)continue;let ae=V.substring(ne+1,ie),ue=xt(ae);if(!ue)continue;let oe=J,{arrayExpr:me,itemVar:ve}=ue,$e=ie+1,_e=1,Re=$e,Ee=/@foreach\s*\(/g,Ae=/@endforeach/g;while(_e>0&&Re<V.length){Ee.lastIndex=Re,Ae.lastIndex=Re;let Te=Ee.exec(V),ke=Ae.exec(V);if(!ke)break;if(Te&&Te.index<ke.index)_e++,Re=Te.index+Te[0].length;else{if(_e--,_e===0){let Pe=V.substring($e,ke.index),Ge=ke.index+11;return{start:oe,end:Ge,arrayExpr:me,itemVar:ve,content:Pe}}Re=ke.index+11}}}return null}function z(V,H){let G=V;while(!0){let J=B(G);if(!J)break;let{start:ne,end:re,arrayExpr:se,itemVar:ie,content:ae}=J;try{let ue=se.trim(),oe;if(p(ue))oe=l(ue,Object.keys(H))(...Object.values(H));else oe=c(ue,H);let me=!1;if(!Array.isArray(oe))if(oe instanceof Map)oe=Array.from(oe),me=!0;else if(oe instanceof Set)oe=Array.from(oe);else if(typeof oe==="string")oe=Array.from(oe);else if(oe&&typeof oe==="object"&&!(oe instanceof Date)&&!(oe instanceof RegExp))oe=Object.entries(oe),me=!0;else{let ke=jv(ue,k)+i("Foreach",`Error in @foreach: ${ue} is not iterable`,t.TYPE_ERROR);G=G.substring(0,ne)+ke+G.substring(re);continue}let ve=E?.loops?.useAltLoopVariable??Av,$e=ie.trim(),_e=null,Re,Ee=!1;if($e.includes("=>")){let ke=$e.split("=>").map((Pe)=>Pe.trim());if(ke.length===2&&ke[0]&&ke[1])_e=ke[0],Re=ke[1];else Re=$e}else if(!$e.startsWith("[")&&!$e.startsWith("{")&&$e.includes(",")){let ke=$e.split(",").map((Pe)=>Pe.trim());if(ke.length===2&&ke[0]&&ke[1])Re=ke[0],_e=ke[1],Ee=!0;else Re=$e}else Re=$e;let Ae="",Te=oe;for(let ke=0;ke<Te.length;ke++){let Pe=Te[ke],Ge={index:ke,iteration:ke+1,first:ke===0,last:ke===Te.length-1,count:Te.length},De={...H,loop:Ge,$loop:Ge};if(Re.startsWith("[")&&Re.endsWith("]")){let dt=Re.slice(1,-1).split(",").map((et)=>et.trim());if(Array.isArray(Pe))dt.forEach((et,It)=>{if(et)De[et]=Pe[It]});else De[Re]=Pe}else if(Re.startsWith("{")&&Re.endsWith("}")){let dt=Re.slice(1,-1).split(",").map((et)=>et.trim()).filter(Boolean);if(Pe!==null&&typeof Pe==="object")dt.forEach((et)=>{let It=et.indexOf(":"),ft=(It===-1?et:et.slice(0,It)).trim(),ut=It===-1?ft:et.slice(It+1).trim();if(ft&&ut)De[ut]=Pe[ft]});else De[Re]=Pe}else De[Re]=Pe;if(_e)if(!Ee&&me&&Array.isArray(Pe)&&Pe.length===2)De[_e]=Pe[0],De[Re]=Pe[1];else De[_e]=ke;let Ie=Dv(ae,De),Ye=yg(Ie);if(Ye.hasContinue){Ae+=Ye.content;continue}let at=hg(Ie);if(at.hasBreak){Ae+=at.content;break}if(Ie=xg(Ie,De),Ie=z(Ie,De),Ie=lr(Ie,De,k),Ie=Ov(Ie),at=hg(Ie),at.hasBreak){Ae+=at.content;break}if(Ye=yg(Ie),Ye.hasContinue){Ae+=Ye.content;continue}Ie=q(Ie,De,k),Ie=Pv(Ie,De),Ie=Iv(Ie,De),Ie=Tv(Ie,De),Ae+=Ie}G=G.substring(0,ne)+Ae+G.substring(re)}catch(ue){let oe=i("Foreach",`Error in @foreach(${se.trim()} as ${ie.trim()}): ${ue instanceof Error?ue.message:String(ue)}`,t.EVALUATION_ERROR);G=G.substring(0,ne)+oe+G.substring(re)}}return G}j=z(j,_),j=Sg(j,_,k,E);let F=E?.loops?.maxWhileIterations??Rv;return j=Wv(j,_,F),T?j:gs(j)}function Ec(v){let _=/^(\s*)([A-Za-z_$][\w$]*|\[[^\]]*\]|\{[^}]*\})(\s+(?:of|in)\s)/.exec(v);if(!_||/^(?:const|let|var)$/.test(_[2]))return v;return`${_[1]}let ${v.slice(_[1].length)}`}function wg(v){return ar(v)}function Sg(v,_,k,E){let T=v,j=!0;while(j){j=!1;let B=T.match(/@for\s*\(/);if(!B||B.index===void 0)break;let z=B.index,F=z+B[0].length-1,V=S(T,"(",")",F);if(V===-1)break;let H=Ec(T.slice(F+1,V)),G=V+1,J=Ro(T.slice(z),"for","endfor");if(J.length===0)break;let ne=J[0].content,re=z+J[0].end;if(!wg(H)){let se=i("For",`Unsafe expression in @for: ${H}`,t.UNSAFE_EXPRESSION);T=T.substring(0,z)+se+T.substring(re),j=!0;continue}try{let se=Bv(H),ie=/@(?:for|foreach|if|unless)\s*\(/.test(ne);if(se.length>0&&ie){let $e=zv({forExpr:H,content:ne,iterVarNames:se,context:_,filePath:k,options:E});T=T.substring(0,z)+$e+T.substring(re),j=!0;continue}let ae=Object.keys(_),ue=Object.values(_),oe=ne.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,($e,_e)=>`\${${_e}}`);oe=bg(oe);let ve=Function(...ae,`
1937
1937
  let result = '';
1938
1938
  for (${H}) {
1939
1939
  result += \`${oe}\`;
1940
1940
  }
1941
1941
  return result;
1942
- `)(...ue);T=T.substring(0,z)+we+T.substring(re),j=!0}catch(se){let ie=i("For",`Error in @for(${H}): ${se instanceof Error?se.message:String(se)}`,t.EVALUATION_ERROR);T=T.substring(0,z)+ie+T.substring(re),j=!0}}return T}function Bv(v){let _=v.trim(),k=_.match(/^(?:const|let|var)\s+(\[[^\]]+\]|\{[^}]+\})\s+(?:of|in)\s+/);if(k){let j=k[1];return j.slice(1,-1).split(",").map((z)=>{let F=z.trim();if(!F)return"";let V=F.indexOf(":");if(V>=0&&j.startsWith("{")){let J=F.slice(V+1).trim(),ne=J.indexOf("=");return(ne>=0?J.slice(0,ne):J).trim()}let H=F.indexOf("="),G=(H>=0?F.slice(0,H):F).trim();return/^[A-Za-z_$][\w$]*$/.test(G)?G:""}).filter(Boolean)}let E=_.match(/^(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s+(?:of|in)\s+/);if(E)return[E[1]];let T=_.match(/^(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s*=[^;]*;/);if(T)return[T[1]];return[]}function zv(v){let{forExpr:_,content:k,iterVarNames:E,context:T,filePath:j,options:B}=v,z=Object.keys(T),F=Object.values(T),V=Function(...z,"__pushIter",`
1942
+ `)(...ue);T=T.substring(0,z)+ve+T.substring(re),j=!0}catch(se){let ie=i("For",`Error in @for(${H}): ${se instanceof Error?se.message:String(se)}`,t.EVALUATION_ERROR);T=T.substring(0,z)+ie+T.substring(re),j=!0}}return T}function Bv(v){let _=v.trim(),k=_.match(/^(?:const|let|var)\s+(\[[^\]]+\]|\{[^}]+\})\s+(?:of|in)\s+/);if(k){let j=k[1];return j.slice(1,-1).split(",").map((z)=>{let F=z.trim();if(!F)return"";let V=F.indexOf(":");if(V>=0&&j.startsWith("{")){let J=F.slice(V+1).trim(),ne=J.indexOf("=");return(ne>=0?J.slice(0,ne):J).trim()}let H=F.indexOf("="),G=(H>=0?F.slice(0,H):F).trim();return/^[A-Za-z_$][\w$]*$/.test(G)?G:""}).filter(Boolean)}let E=_.match(/^(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s+(?:of|in)\s+/);if(E)return[E[1]];let T=_.match(/^(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s*=[^;]*;/);if(T)return[T[1]];return[]}function zv(v){let{forExpr:_,content:k,iterVarNames:E,context:T,filePath:j,options:B}=v,z=Object.keys(T),F=Object.values(T),V=Function(...z,"__pushIter",`
1943
1943
  for (${_}) {
1944
1944
  __pushIter([${E.join(", ")}])
1945
1945
  }
@@ -1959,7 +1959,7 @@ ${T}
1959
1959
  <div style="color:red;background:#ffeeee;padding:10px;border:1px solid #ff0000;margin:10px 0;font-family:monospace;white-space:pre-wrap;">${b(V)}</div>
1960
1960
  `)}}}return j}async function kg(v,_,k,E){return _g(v,_,k,E,"before")}async function Eg(v,_,k,E){return _g(v,_,k,E,"after")}function Cg(v){return v.replace(/@route\(\s*(['"])([^'"]+)\1(?:\s*,\s*(\{[^}]+\}))?\s*(?:,\s*(true|false)\s*)?\)/g,(_,k,E,T,j)=>{try{let B=T?D(T,{}):{};return kn(E,B,j==="true")}catch(B){return console.error(`Error processing @route directive: ${B}`),"#route-error"}})}var Yi={patterns:[],exact:{}};async function Rg(v,_){let k=v.split("/").pop()?.split(".")[0]||"";if(Yi.exact[v])for(let E of Yi.exact[v])await Promise.resolve(E(_,v));if(Yi.exact[k])for(let E of Yi.exact[k])await Promise.resolve(E(_,v));for(let{pattern:E,callback:T}of Yi.patterns)if(E.test(v)||E.test(k))await Promise.resolve(T(_,v))}var Vv=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),Uv=new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","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","search","section","select","slot","small","source","span","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr"]);function jr(v,_){let k=/<([a-zA-Z][a-zA-Z0-9-]*)((?:\s+(?:[^>"']|"[^"]*"|'[^']*')*)?)(\s*\/?)>/g;k.lastIndex=_;let E=k.exec(v);if(!E)return null;let T=/\/\s*>$/.test(E[0])||E[1]===E[1].toLowerCase()&&Vv.has(E[1]),j=T?E[2].replace(/\/\s*$/,""):E[2];return{full:E[0],tag:E[1],attrs:j,selfClosing:T,start:E.index,end:E.index+E[0].length}}function Hv(v,_,k){let E=1,T=k,j=new RegExp(`<${_}(?:\\s(?:[^>"']|"[^"]*"|'[^']*')*)?>`,"gi"),B=new RegExp(`</${_}\\s*>`,"gi");while(E>0&&T<v.length){j.lastIndex=T,B.lastIndex=T;let z=j.exec(v),F=B.exec(v);if(!F)return-1;if(z&&z.index<F.index)E++,T=z.index+z[0].length;else{if(E--,E===0)return F.index+F[0].length;T=F.index+F[0].length}}return-1}function Nr(v,_){if(_.selfClosing)return{outerStart:_.start,outerEnd:_.end,innerHTML:""};let k=Hv(v,_.tag,_.end);if(k===-1)return{outerStart:_.start,outerEnd:_.end,innerHTML:""};return{outerStart:_.start,outerEnd:k,innerHTML:v.slice(_.end,k-`</${_.tag}>`.length)}}function Ag(v,_){return new RegExp(`(?:^|\\s)${_.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?:=|\\s|$|>|/)`).test(v)||v.includes(` ${_}=`)||v.includes(` ${_} `)||v.trimEnd().endsWith(` ${_}`)}function Qi(v,_){let k=_.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),E=v.match(new RegExp(`${k}="([^"]*)"`,"s"))||v.match(new RegExp(`${k}='([^']*)'`,"s"));return E?E[1]:null}function $r(v,_){let k=_.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return v.replace(new RegExp(`\\s*${k}="[^"]*"`,"g"),"").replace(new RegExp(`\\s*${k}='[^']*'`,"g"),"").replace(new RegExp(`\\s*${k}(?=\\s|$|>|/)`,"g"),"")}function Ks(v,_,k){let E=_.selfClosing?" /":"",T=`<${_.tag}${k}${E}>`;return v.slice(0,_.start)+T+v.slice(_.end)}function qv(v){return/\bv-(?:if|else-if|else|for|show|model|html|text|pre|once|cloak|memo|bind|on|slot)\b/.test(v)}function Kv(v){let _=v,k=0;while(k<_.length){let E=jr(_,k);if(!E)break;let T=Qi(E.attrs,"v-for");if(T===null){k=E.end;continue}let j=T.match(/^\s*\(?([^)]+)\)?\s+(?:in|of)\s+(.+)\s*$/);if(!j){k=E.end;continue}let B=j[1].trim(),z=j[2].trim(),F;if(B.includes(",")){let ie=B.split(",").map((oe)=>oe.trim()),ae=ie[0],ue=ie[1];F=`${z} as ${ue} => ${ae}`}else F=`${z} as ${B}`;let V=$r(E.attrs,"v-for"),H=$r(V,":key").replace(/\s*v-bind:key="[^"]*"/g,""),G=Nr(_,E),J=_.slice(G.outerStart,G.outerEnd),ne=Ks(J,{...E,start:0,end:E.end-E.start},H),re=`@foreach(${F})
1961
1961
  `,se=`${re}${ne}
1962
- @endforeach`;_=_.slice(0,G.outerStart)+se+_.slice(G.outerEnd),k=G.outerStart+re.length}return _}function Xv(v){let _=v,k=0;while(k<_.length){let E=jr(_,k);if(!E)break;let T=Qi(E.attrs,"v-if");if(T===null){k=E.end;continue}let j=[],B=Nr(_,E),z=$r(E.attrs,"v-if"),F=Ks(_.slice(B.outerStart,B.outerEnd),{...E,start:0,end:E.end-E.start},z);j.push({type:"if",expr:T,outerStart:B.outerStart,outerEnd:B.outerEnd,element:F,parsedTag:E});let V=B.outerEnd,H=!0;while(H){let se=_.slice(V).match(/^\s*/),ie=se?se[0].length:0,ae=jr(_,V+ie);if(!ae){H=!1;break}let ue=Qi(ae.attrs,"v-else-if"),oe=Ag(ae.attrs,"v-else");if(ue!==null){let me=Nr(_,ae),we=$r(ae.attrs,"v-else-if"),$e=Ks(_.slice(me.outerStart,me.outerEnd),{...ae,start:0,end:ae.end-ae.start},we);j.push({type:"else-if",expr:ue,outerStart:V,outerEnd:me.outerEnd,element:$e,parsedTag:ae}),V=me.outerEnd}else if(oe){let me=Nr(_,ae),we=$r(ae.attrs,"v-else"),$e=Ks(_.slice(me.outerStart,me.outerEnd),{...ae,start:0,end:ae.end-ae.start},we);j.push({type:"else",outerStart:V,outerEnd:me.outerEnd,element:$e,parsedTag:ae}),H=!1}else H=!1}let G=[];for(let se of j)if(se.type==="if")G.push(`@if(${se.expr})
1962
+ @endforeach`;_=_.slice(0,G.outerStart)+se+_.slice(G.outerEnd),k=G.outerStart+re.length}return _}function Xv(v){let _=v,k=0;while(k<_.length){let E=jr(_,k);if(!E)break;let T=Qi(E.attrs,"v-if");if(T===null){k=E.end;continue}let j=[],B=Nr(_,E),z=$r(E.attrs,"v-if"),F=Ks(_.slice(B.outerStart,B.outerEnd),{...E,start:0,end:E.end-E.start},z);j.push({type:"if",expr:T,outerStart:B.outerStart,outerEnd:B.outerEnd,element:F,parsedTag:E});let V=B.outerEnd,H=!0;while(H){let se=_.slice(V).match(/^\s*/),ie=se?se[0].length:0,ae=jr(_,V+ie);if(!ae){H=!1;break}let ue=Qi(ae.attrs,"v-else-if"),oe=Ag(ae.attrs,"v-else");if(ue!==null){let me=Nr(_,ae),ve=$r(ae.attrs,"v-else-if"),$e=Ks(_.slice(me.outerStart,me.outerEnd),{...ae,start:0,end:ae.end-ae.start},ve);j.push({type:"else-if",expr:ue,outerStart:V,outerEnd:me.outerEnd,element:$e,parsedTag:ae}),V=me.outerEnd}else if(oe){let me=Nr(_,ae),ve=$r(ae.attrs,"v-else"),$e=Ks(_.slice(me.outerStart,me.outerEnd),{...ae,start:0,end:ae.end-ae.start},ve);j.push({type:"else",outerStart:V,outerEnd:me.outerEnd,element:$e,parsedTag:ae}),H=!1}else H=!1}let G=[];for(let se of j)if(se.type==="if")G.push(`@if(${se.expr})
1963
1963
  ${se.element}`);else if(se.type==="else-if")G.push(`@elseif(${se.expr})
1964
1964
  ${se.element}`);else G.push(`@else
1965
1965
  ${se.element}`);G.push("@endif");let J=G.join(`
@@ -1971,15 +1971,15 @@ ${Ks(B,{...E,start:0,end:E.end-E.start},T)}
1971
1971
  ${_}${v.slice(T)}`;if(v.includes("</head>")){let B=v.indexOf("</head>");return v.slice(0,B)+_+`
1972
1972
  `+v.slice(B)}if(Nn(v))return Bs(v,(B)=>`${B}
1973
1973
  ${_}`);return`${_}
1974
- ${v}`}async function fa(v,_){if(v.includes("data-stx-runtime")||v.includes("window.stx.state")||v.includes("STX Signals Runtime"))return v;if(_.buildMode==="serve"){let{getServeClientAsset:T}=await import("./chunk-1r3fmmy8.js"),{url:j}=await T("runtime",_.debug===!0);return Wl(v,`<script data-stx-runtime src="${j}"></script>`)}if(_.buildMode==="compile")return Wl(v,'<script data-stx-runtime src="/__stx/runtime.__STX_HASH__.js"></script>');let{getCachedSignalsRuntime:k}=await import("./chunk-1r3fmmy8.js"),E=await k(_.debug);return Wl(v,`<script data-stx-scoped data-stx-runtime>${E}</script>`)}function fw(v){return/<[a-z][^>]*?\sx-tooltip\s*=/i.test(v)}function Hg(v){if(v.includes("data-stx-tooltip-runtime")||!fw(v))return v;let _=`<script data-stx-scoped data-stx-tooltip-runtime>${$l()}</script>`,k=v.lastIndexOf("</body>");if(k===-1)return`${v}
1974
+ ${v}`}async function fa(v,_){if(v.includes("data-stx-runtime")||v.includes("window.stx.state")||v.includes("STX Signals Runtime"))return v;if(_.buildMode==="serve"){let{getServeClientAsset:T}=await import("./chunk-7smpjzzh.js"),{url:j}=await T("runtime",_.debug===!0);return Wl(v,`<script data-stx-runtime src="${j}"></script>`)}if(_.buildMode==="compile")return Wl(v,'<script data-stx-runtime src="/__stx/runtime.__STX_HASH__.js"></script>');let{getCachedSignalsRuntime:k}=await import("./chunk-7smpjzzh.js"),E=await k(_.debug);return Wl(v,`<script data-stx-scoped data-stx-runtime>${E}</script>`)}function fw(v){return/<[a-z][^>]*?\sx-tooltip\s*=/i.test(v)}function Hg(v){if(v.includes("data-stx-tooltip-runtime")||!fw(v))return v;let _=`<script data-stx-scoped data-stx-tooltip-runtime>${$l()}</script>`,k=v.lastIndexOf("</body>");if(k===-1)return`${v}
1975
1975
  ${_}`;return`${v.slice(0,k)}${_}
1976
1976
  ${v.slice(k)}`}var pw=/<script\b[^>]*\sdata-stx-router(?=[\s=>])/i;function gw(v){return pw.test(v)||v.includes("__stxRouter)return")||v.includes("__stxRouter=true")}async function K(v,_){if(!v.includes("</body>"))return v;if(gw(v))return v;let k=_?.router,E="";{let F={};if(k){if(k.container)F.container=k.container;if(k.interceptAllLinks!==void 0)F.interceptAllLinks=k.interceptAllLinks;if(k.progress!==void 0)F.progress=k.progress;if(k.viewTransitions!==void 0)F.viewTransitions=k.viewTransitions;if(k.viewTransitionDuration!==void 0)F.viewTransitionDuration=k.viewTransitionDuration;if(k.viewTransitionEasing!==void 0)F.viewTransitionEasing=k.viewTransitionEasing;if(k.scrollToTop!==void 0)F.scrollToTop=k.scrollToTop;if(k.scrollRestoration!==void 0)F.scrollRestoration=k.scrollRestoration;if(k.prefetch!==void 0)F.prefetch=k.prefetch;if(k.cache!==void 0)F.cache=k.cache;if(k.progressColor!==void 0)F.progressColor=k.progressColor;if(k.progressHeight!==void 0)F.progressHeight=k.progressHeight}try{let V=await Fg(_?.pagesDir,_?.root);if(V.length>0)F.ownedRoutes=V}catch{}if(Object.keys(F).length>0)E=`<script>window.__stxRouterConfig=${Vg(F)};</script>
1977
- `}let{getCachedRouterScript:T,getServeClientAsset:j}=await import("./chunk-1r3fmmy8.js"),B=_?.buildMode==="compile"?'<script data-stx-router src="/__stx/router.__STX_HASH__.js"></script>':_?.buildMode==="serve"?`<script data-stx-router src="${(await j("router")).url}"></script>`:`<script data-stx-router>${await T()}</script>`,z=v.lastIndexOf("</body>");return v.slice(0,z)+E+B+`
1978
- </body>`+v.slice(z+7)}var Fl=`(?:"[^"]*"|'[^']*'|[^>"'])*`,Yg=/^<([a-zA-Z][a-zA-Z0-9-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)>([\s\S]*)<\/\1>$/s,mw=65536,hw=4,ga=new Map;function Kd(){ga.clear()}function yw(v){let _=[];for(let k of gr(v,Y)){let E=k.token.match(/^<script\b([^>]*)>/i),T=k.token.match(/<\/script\s*>$/i);if(!E||!T)continue;let j=E[0].length,B=k.token.length-T[0].length;_.push(Object.freeze({fullMatch:k.token,attrs:E[1],body:k.token.slice(j,B),start:k.start,end:k.end}))}return _}function mc(v,_={}){let k=v.length>=mw,E=k?ga.get(v):void 0;if(E===void 0){if(E=yw(v),k)ud(ga,hw),ga.set(v,E)}let T=_.skipAttrs;if(!T)return E.slice();let j=[];for(let B of E)if(T.lastIndex=0,!T.test(B.attrs))j.push(B);return j}function cs(v){let _=v.trim(),k=_.match(/^([\s\S]+?)\s+as\s+(.+)$/);if(k){let T=k[1].trim(),j=k[2].trim(),{itemVar:B,indexVar:z}=qg(j);if(B)return{style:"as",iterable:T,itemVar:B,indexVar:z}}let E=_.match(/^(\([^)]+\)|\w+(?:\s*,\s*\w+)?)\s+(?:in|of)\s+([\s\S]+)$/);if(E){let T=E[1].trim(),j=E[2].trim(),{itemVar:B,indexVar:z}=qg(T);if(B)return{style:"in",iterable:j,itemVar:B,indexVar:z}}return{style:"unknown",iterable:null,itemVar:null,indexVar:null}}function qg(v){let _=v.trim(),k=_.match(/^(\w+)\s*=>\s*(\w+)$/);if(k)return{itemVar:k[2],indexVar:k[1]};let E=_.match(/^\(\s*(\w+)(?:\s*,\s*(\w+))?\s*\)$/);if(E)return{itemVar:E[1],indexVar:E[2]||null};let T=_.match(/^(\w+)\s*,\s*(\w+)$/);if(T)return{itemVar:T[1],indexVar:T[2]};let j=_.match(/^(\w+)$/);if(j)return{itemVar:j[1],indexVar:null};return{itemVar:null,indexVar:null}}function ls(v,_){return Di(v,_)}function xw(v){let _=/@(if\s*\(|endif|elseif\s*\(|else\b)/g,k=0,E;while((E=_.exec(v))!==null){let T=E[1];if(T.startsWith("if"))k++;else if(T==="endif")k--;else if(k===0)return!0}return!1}function Qg(v){let _=new Set,k=/<script\b(?![^>]*\bserver\b)(?![^>]*\bsrc\s*=)[^>]*>([\s\S]*?)<\/script>/gi,E=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal|useModel)\s*(?:<[^>]*>)?\s*\(/g,T;while((T=k.exec(v))!==null){let j=T[1],B;while((B=E.exec(j))!==null)_.add(B[1])}return _}function bw(v){if(!/[:@]for\s*=/.test(v)&&!/\bx-for\s*=/.test(v))return[];let _=new RegExp(`<([a-zA-Z][\\w-]*)\\b(${Fl})>`,"iy"),k=/(?:^|\s)(?::for|@for|x-for)\s*=\s*(?:"([^"]*)"|'([^']*)')/i,E=gr(v,(j,B)=>{_.lastIndex=B;let z=_.exec(j);if(!z||z.index!==B||!k.test(z[2]))return-1;return _.lastIndex}),T=[];for(let j of E){_.lastIndex=0;let B=_.exec(j.token);if(!B)continue;let z=B[2].match(k),F=cs(z?.[1]??z?.[2]??""),V=[F.itemVar,F.indexVar].filter(Boolean);if(V.length===0)continue;let H=B[1],J=/\/\s*>$/.test(j.token)||ma.has(H.toLowerCase())?j.end:Ul(v,j.start,H,j.end);if(J!==-1)T.push({start:j.start,end:J,vars:new Set(V)})}return T}var Kg=new Set(["true","false","null","undefined","NaN","Infinity","typeof","instanceof","in","of","new","void","delete","this","Math","JSON","Date","Number","String","Boolean","Array","Object","RegExp","Map","Set","Symbol","parseInt","parseFloat","isNaN","isFinite","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","window","document","console"]);function vw(v){return v.replace(/'(?:\\.|[^'\\])*'/g,"''").replace(/"(?:\\.|[^"\\])*"/g,'""').replace(/`(?:\\.|[^`\\])*`/g,"``")}function Xg(v,_,k,E){if(!v)return!1;let T=vw(v),j=!1,B=!1,z=!1,F=/([a-zA-Z_$][\w$]*)/g,V;while((V=F.exec(T))!==null){let ne=V[1];if(T.slice(0,V.index).trimEnd().endsWith("."))continue;if(Kg.has(ne))continue;if(_.has(ne)||E?.has(ne))j=!0;else if(k&&ne in k)B=!0}let H=/([a-zA-Z_$][\w$]*)(?:\.[a-zA-Z_$][\w$]*)*\s*\(\s*\)/g,G;while((G=H.exec(T))!==null){let ne=G[1];if(T.slice(0,G.index).trimEnd().endsWith("."))continue;if(Kg.has(ne)||k&&ne in k)continue;z=!0}return(j||z)&&!B}function pa(v,_,k){let E=k===void 0?` ${_}`:` ${_}="${k.replace(/"/g,"&quot;")}"`,T=v.trim(),j=T.match(Yg);if(j&&ww(j[3],j[1])){let[,B,z,F]=j;return`<${B}${z}${E}>${F}</${B}>`}return`<template${E}>${T}</template>`}function ww(v,_){let k=new RegExp(`<(/)?${_}(?=[\\s/>])`,"gi"),E=0,T;while((T=k.exec(v))!==null)if(T[1]){if(E--,E<0)return!1}else E++;return!0}function si(v,_){let k=Qg(v);function E(T){let j=T,B=bw(T),z=(G)=>{let J=new Set;for(let ne of B)if(G>ne.start&&G<ne.end)for(let re of ne.vars)J.add(re);return J},F=/@if\s*\(/g,V,H=[];while((V=F.exec(j))!==null){let G=V.index,J=G+V[0].length,ne=1,re=J;while(re<j.length&&ne>0){if(j[re]==="(")ne++;else if(j[re]===")")ne--;re++}if(ne!==0)continue;let se=j.substring(J,re-1).trim(),ie=re,ae=1,ue=ie,oe=/@(if\s*\(|endif)/g;oe.lastIndex=ie;let me;while((me=oe.exec(j))!==null)if(me[1].startsWith("if"))ae++;else if(me[1]==="endif"){if(ae--,ae===0){ue=me.index+me[0].length;break}}if(ae!==0)continue;let we=j.substring(ie,ue-6).trim(),$e;if(xw(we)){let _e=Bi(j.substring(G,ue));if(_e.length===0)continue;let Re=_e[0].branches.filter((ke)=>ke.type!=="else"),Ee=z(G);if(!(Re.length>0&&Re.every((ke)=>Xg(ke.condition,k,_,Ee))))continue;$e=_e[0].branches.map((ke)=>{let Pe=E(ke.content);if(ke.type==="elseif")return pa(Pe,"@else-if",ke.condition??"");if(ke.type==="else")return pa(Pe,"@else");return pa(Pe,"@if",ke.condition??"")}).join(`
1979
- `)}else{if(!Xg(se,k,_,z(G)))continue;$e=pa(E(we),"@if",se)}H.push({start:G,end:ue,replacement:$e}),F.lastIndex=ue}for(let G=H.length-1;G>=0;G--){let{start:J,end:ne,replacement:re}=H[G];j=j.substring(0,J)+re+j.substring(ne)}return j}return E(v)}function Sw(v){let _=v.trim();if(_==="")return;if(_==="true")return!0;if(_==="false")return!1;if(_==="null")return!1;if(_==="undefined")return!1;if(_==="NaN")return!1;if(/^-?\d+(?:\.\d+)?$/.test(_)){let T=Number(_);return T!==0&&!Number.isNaN(T)}let k=_.match(/^'((?:\\.|[^'\\])*)'$/);if(k)return k[1].length>0;let E=_.match(/^"((?:\\.|[^"\\])*)"$/);if(E)return E[1].length>0;return}var ma=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),Zg=/<(script|style)\b/iy,$w=/<\/script/gi,_w=/<\/style/gi;function Ul(v,_,k,E){if(ma.has(k.toLowerCase()))return E;let T=k.toLowerCase(),j=v.length,B=1,z=E;while(z<j){let F=v.indexOf("<",z);if(F===-1)return-1;if(z=F,v.startsWith("<!--",z)){let J=v.indexOf("-->",z+4);if(J===-1)return-1;z=J+3;continue}Zg.lastIndex=z;let V=Zg.exec(v);if(V){let J=v.indexOf(">",z);if(J===-1)return-1;if(v[J-1]==="/"){z=J+1;continue}let ne=V[1].toLowerCase()==="script"?$w:_w;ne.lastIndex=z;let re=ne.exec(v);if(re===null)return-1;let se=v.indexOf(">",re.index);if(se===-1)return-1;z=se+1;continue}if(v[z+1]==="/"){let J=/^<\/([a-z][\w-]*)\s*>/i.exec(v.slice(z,z+64));if(!J){z++;continue}if(J[1].toLowerCase()===T){if(B--,z+=J[0].length,B===0)return z;continue}z+=J[0].length;continue}let H=/^<([a-z][\w-]*)\b/i.exec(v.slice(z,z+64));if(!H){z++;continue}let G=v.indexOf(">",z);if(G===-1)return-1;if(H[1].toLowerCase()===T){let J=v.slice(z,G+1);if(!(/\/\s*>$/.test(J)||ma.has(T)))B++}z=G+1}return-1}var kw=/\s(?::else-if|x-else-if|@else-if|:else|x-else|@else)(?=[=\s/>])/;function Ew(v,_){let k=_,E=v.length;for(;;){while(k<E&&v[k]!=="<")k++;if(k>=E)return!1;if(v.startsWith("<!--",k)){let B=v.indexOf("-->",k+4);if(B===-1)return!1;k=B+3;continue}break}if(v[k+1]==="/")return!1;let T=v.indexOf(">",k);if(T===-1)return!1;let j=v.slice(k,T+1);return kw.test(j)}function oi(v){if(!v.includes(":if")&&!v.includes(":show")&&!v.includes("x-if")&&!v.includes("x-show")&&!v.includes("@if=")&&!v.includes("@show="))return v;let _=[],k=/<(script|style)\b[^>]*>[\s\S]*?<\/\1\s*>/gi,E;while((E=k.exec(v))!==null)_.push([E.index,E.index+E[0].length]);let T=(G)=>_.some(([J,ne])=>G>=J&&G<ne),j=/<([a-zA-Z][\w-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*?)\s+(:if|:show|x-if|x-show|@if|@show)\s*=\s*"([^"]*)"((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)(\/?)>/g,B=[],z;while((z=j.exec(v))!==null){if(T(z.index))continue;let[G,J,ne,re,se,ie,ae]=z,ue=Sw(se);if(ue===void 0)continue;let oe=z.index,me=oe+G.length,_e=!!ae||/\/\s*>$/.test(G)||ma.has(J.toLowerCase())?me:Ul(v,oe,J,me);if(_e===-1)continue;if((re===":if"||re==="x-if"||re==="@if")&&Ew(v,_e)){j.lastIndex=me;continue}if(ue===!0){let Ee=`<${J}${ne}${ie}${ae}>`;B.push({start:oe,end:me,replacement:Ee});continue}B.push({start:oe,end:_e,replacement:""}),j.lastIndex=_e}if(B.length===0)return v;B.sort((G,J)=>G.start-J.start);let F=[],V=-1;for(let G of B){if(G.start<V)continue;F.push(G),V=G.end}let H=v;for(let G=F.length-1;G>=0;G--){let{start:J,end:ne,replacement:re}=F[G];H=H.substring(0,J)+re+H.substring(ne)}return H}var Gg=[":for","@for","x-for"];function ds(v,_){if(!_||Object.keys(_).length===0)return v;if(!Gg.some((z)=>v.includes(`${z}=`)))return v;let k=Qg(v);if(Array.isArray(_.__stx_client_signal_names)){for(let z of _.__stx_client_signal_names)if(typeof z==="string")k.add(z)}let E=v,T=[],j=/<([a-zA-Z][\w-]*)((?:[^>"']|"[^"]*"|'[^']*')*)>/g,B;while((B=j.exec(E))!==null){let[z,F,V]=B,H=B.index,G=H+z.length,J=Gg.map(($e)=>({attr:$e,m:new RegExp(`\\s${$e}="([^"]*)"`).exec(V)})).find(($e)=>$e.m!==null);if(!J||!J.m)continue;let ne=cs(J.m[1]);if(!ne.iterable||!ne.itemVar)continue;let re=ne.iterable.trim().split(/[.[(]/)[0].trim();if(!re||k.has(re)||!(re in _))continue;let se=Ul(E,H,F,G);if(se===-1)continue;let ie=V.replace(new RegExp(`\\s${J.attr}="[^"]*"`),"").replace(/\s:key="[^"]*"/,"").replace(/\sx-cloak(?=\s|$)/,""),ae=E.slice(G,se-`</${F}>`.length),ue={..._,[ne.itemVar]:void 0};if(ne.indexVar)ue[ne.indexVar]=void 0;let oe=ds(ae,ue),me=ne.indexVar?`${ne.iterable} as ${ne.indexVar} => ${ne.itemVar}`:`${ne.iterable} as ${ne.itemVar}`,we=F.toLowerCase()==="template"?oe:`<${F}${ie}>${oe}</${F}>`;T.push({start:H,end:se,replacement:`@foreach(${me})${we}@endforeach`}),j.lastIndex=se}for(let z=T.length-1;z>=0;z--){let{start:F,end:V,replacement:H}=T[z];E=E.slice(0,F)+H+E.slice(V)}return E}function us(v,_){let k=v,E=/@(for|foreach)\s*\(/g,T,j=[],B=[];while((T=E.exec(k))!==null){let z=T[1],F=T.index,V=F+T[0].length,H=1,G=V;while(G<k.length&&H>0){if(k[G]==="(")H++;else if(k[G]===")")H--;G++}if(H!==0)continue;let J=k.substring(V,G-1).trim(),ne=G,re=cs(J),se=z==="for"?"@endfor":"@endforeach",ie=1,ae=ne,ue=z==="for"?new RegExp("@(for(?!each)\\s*\\(|endfor(?!each))","g"):new RegExp(`@(${z}\\s*\\(|end${z})`,"g");ue.lastIndex=ne;let oe;while((oe=ue.exec(k))!==null)if(oe[1].startsWith(z))ie++;else if(ie--,ie===0){ae=oe.index+oe[0].length;break}if(ie!==0)continue;let me=()=>{let Ae=[re.itemVar,re.indexVar].filter(Boolean);if(Ae.length)B.push({start:F,end:ae,vars:Ae})};if(re.iterable){let Ae=re.iterable.trim();if(Ae.startsWith("[")||Ae.startsWith("{")||Ae.startsWith("'")||Ae.startsWith('"')||Ae.startsWith("`")||/^-?\d/.test(Ae)){me();continue}let Te=Ae.split(/[.[(]/)[0].trim(),ke=_?Te in _:!1,Pe=B.some((Ge)=>F>Ge.start&&F<Ge.end&&Ge.vars.includes(Te));if(Te&&(ke||Pe)){me();continue}}if(re.style==="as")J=re.indexVar?`(${re.itemVar}, ${re.indexVar}) in ${re.iterable}`:`${re.itemVar} in ${re.iterable}`;let we=k.substring(ne,ae-se.length).trim(),$e=_?{..._}:{};if(re.itemVar)delete $e[re.itemVar];if(re.indexVar)delete $e[re.indexVar];let _e=us(we,$e),Re=_e.match(Yg),Ee;if(Re){let[,Ae,Te,ke]=Re;Ee=`<${Ae}${Te} @for="${J}">${ke}</${Ae}>`}else Ee=`<template @for="${J}">${_e}</template>`;j.push({start:F,end:ae,replacement:Ee}),E.lastIndex=ae}for(let z=j.length-1;z>=0;z--){let{start:F,end:V,replacement:H}=j[z];k=k.substring(0,F)+H+k.substring(V)}return k}function Cw(v){let _=new Set,k=[],E=0,T=0,j=v.length,B=(H)=>{let G=E+1;while(G<j){let J=v[G];if(J==="\\"){G+=2;continue}if(J===H)return G+1;G++}return j},z=()=>{let H=E+2;while(H<j&&v[H]!==`
1977
+ `}let{getCachedRouterScript:T,getServeClientAsset:j}=await import("./chunk-7smpjzzh.js"),B=_?.buildMode==="compile"?'<script data-stx-router src="/__stx/router.__STX_HASH__.js"></script>':_?.buildMode==="serve"?`<script data-stx-router src="${(await j("router")).url}"></script>`:`<script data-stx-router>${await T()}</script>`,z=v.lastIndexOf("</body>");return v.slice(0,z)+E+B+`
1978
+ </body>`+v.slice(z+7)}var Fl=`(?:"[^"]*"|'[^']*'|[^>"'])*`,Yg=/^<([a-zA-Z][a-zA-Z0-9-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)>([\s\S]*)<\/\1>$/s,mw=65536,hw=4,ga=new Map;function Kd(){ga.clear()}function yw(v){let _=[];for(let k of gr(v,Y)){let E=k.token.match(/^<script\b([^>]*)>/i),T=k.token.match(/<\/script\s*>$/i);if(!E||!T)continue;let j=E[0].length,B=k.token.length-T[0].length;_.push(Object.freeze({fullMatch:k.token,attrs:E[1],body:k.token.slice(j,B),start:k.start,end:k.end}))}return _}function mc(v,_={}){let k=v.length>=mw,E=k?ga.get(v):void 0;if(E===void 0){if(E=yw(v),k)ud(ga,hw),ga.set(v,E)}let T=_.skipAttrs;if(!T)return E.slice();let j=[];for(let B of E)if(T.lastIndex=0,!T.test(B.attrs))j.push(B);return j}function cs(v){let _=v.trim(),k=_.match(/^([\s\S]+?)\s+as\s+(.+)$/);if(k){let T=k[1].trim(),j=k[2].trim(),{itemVar:B,indexVar:z}=qg(j);if(B)return{style:"as",iterable:T,itemVar:B,indexVar:z}}let E=_.match(/^(\([^)]+\)|\w+(?:\s*,\s*\w+)?)\s+(?:in|of)\s+([\s\S]+)$/);if(E){let T=E[1].trim(),j=E[2].trim(),{itemVar:B,indexVar:z}=qg(T);if(B)return{style:"in",iterable:j,itemVar:B,indexVar:z}}return{style:"unknown",iterable:null,itemVar:null,indexVar:null}}function qg(v){let _=v.trim(),k=_.match(/^(\w+)\s*=>\s*(\w+)$/);if(k)return{itemVar:k[2],indexVar:k[1]};let E=_.match(/^\(\s*(\w+)(?:\s*,\s*(\w+))?\s*\)$/);if(E)return{itemVar:E[1],indexVar:E[2]||null};let T=_.match(/^(\w+)\s*,\s*(\w+)$/);if(T)return{itemVar:T[1],indexVar:T[2]};let j=_.match(/^(\w+)$/);if(j)return{itemVar:j[1],indexVar:null};return{itemVar:null,indexVar:null}}function ls(v,_){return Di(v,_)}function xw(v){let _=/@(if\s*\(|endif|elseif\s*\(|else\b)/g,k=0,E;while((E=_.exec(v))!==null){let T=E[1];if(T.startsWith("if"))k++;else if(T==="endif")k--;else if(k===0)return!0}return!1}function Qg(v){let _=new Set,k=/<script\b(?![^>]*\bserver\b)(?![^>]*\bsrc\s*=)[^>]*>([\s\S]*?)<\/script>/gi,E=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal|useModel)\s*(?:<[^>]*>)?\s*\(/g,T;while((T=k.exec(v))!==null){let j=T[1],B;while((B=E.exec(j))!==null)_.add(B[1])}return _}function bw(v){if(!/[:@]for\s*=/.test(v)&&!/\bx-for\s*=/.test(v))return[];let _=new RegExp(`<([a-zA-Z][\\w-]*)\\b(${Fl})>`,"iy"),k=/(?:^|\s)(?::for|@for|x-for)\s*=\s*(?:"([^"]*)"|'([^']*)')/i,E=gr(v,(j,B)=>{_.lastIndex=B;let z=_.exec(j);if(!z||z.index!==B||!k.test(z[2]))return-1;return _.lastIndex}),T=[];for(let j of E){_.lastIndex=0;let B=_.exec(j.token);if(!B)continue;let z=B[2].match(k),F=cs(z?.[1]??z?.[2]??""),V=[F.itemVar,F.indexVar].filter(Boolean);if(V.length===0)continue;let H=B[1],J=/\/\s*>$/.test(j.token)||ma.has(H.toLowerCase())?j.end:Ul(v,j.start,H,j.end);if(J!==-1)T.push({start:j.start,end:J,vars:new Set(V)})}return T}var Kg=new Set(["true","false","null","undefined","NaN","Infinity","typeof","instanceof","in","of","new","void","delete","this","Math","JSON","Date","Number","String","Boolean","Array","Object","RegExp","Map","Set","Symbol","parseInt","parseFloat","isNaN","isFinite","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","window","document","console"]);function vw(v){return v.replace(/'(?:\\.|[^'\\])*'/g,"''").replace(/"(?:\\.|[^"\\])*"/g,'""').replace(/`(?:\\.|[^`\\])*`/g,"``")}function Xg(v,_,k,E){if(!v)return!1;let T=vw(v),j=!1,B=!1,z=!1,F=/([a-zA-Z_$][\w$]*)/g,V;while((V=F.exec(T))!==null){let ne=V[1];if(T.slice(0,V.index).trimEnd().endsWith("."))continue;if(Kg.has(ne))continue;if(_.has(ne)||E?.has(ne))j=!0;else if(k&&ne in k)B=!0}let H=/([a-zA-Z_$][\w$]*)(?:\.[a-zA-Z_$][\w$]*)*\s*\(\s*\)/g,G;while((G=H.exec(T))!==null){let ne=G[1];if(T.slice(0,G.index).trimEnd().endsWith("."))continue;if(Kg.has(ne)||k&&ne in k)continue;z=!0}return(j||z)&&!B}function pa(v,_,k){let E=k===void 0?` ${_}`:` ${_}="${k.replace(/"/g,"&quot;")}"`,T=v.trim(),j=T.match(Yg);if(j&&ww(j[3],j[1])){let[,B,z,F]=j;return`<${B}${z}${E}>${F}</${B}>`}return`<template${E}>${T}</template>`}function ww(v,_){let k=new RegExp(`<(/)?${_}(?=[\\s/>])`,"gi"),E=0,T;while((T=k.exec(v))!==null)if(T[1]){if(E--,E<0)return!1}else E++;return!0}function si(v,_){let k=Qg(v);function E(T){let j=T,B=bw(T),z=(G)=>{let J=new Set;for(let ne of B)if(G>ne.start&&G<ne.end)for(let re of ne.vars)J.add(re);return J},F=/@if\s*\(/g,V,H=[];while((V=F.exec(j))!==null){let G=V.index,J=G+V[0].length,ne=1,re=J;while(re<j.length&&ne>0){if(j[re]==="(")ne++;else if(j[re]===")")ne--;re++}if(ne!==0)continue;let se=j.substring(J,re-1).trim(),ie=re,ae=1,ue=ie,oe=/@(if\s*\(|endif)/g;oe.lastIndex=ie;let me;while((me=oe.exec(j))!==null)if(me[1].startsWith("if"))ae++;else if(me[1]==="endif"){if(ae--,ae===0){ue=me.index+me[0].length;break}}if(ae!==0)continue;let ve=j.substring(ie,ue-6).trim(),$e;if(xw(ve)){let _e=Bi(j.substring(G,ue));if(_e.length===0)continue;let Re=_e[0].branches.filter((ke)=>ke.type!=="else"),Ee=z(G);if(!(Re.length>0&&Re.every((ke)=>Xg(ke.condition,k,_,Ee))))continue;$e=_e[0].branches.map((ke)=>{let Pe=E(ke.content);if(ke.type==="elseif")return pa(Pe,"@else-if",ke.condition??"");if(ke.type==="else")return pa(Pe,"@else");return pa(Pe,"@if",ke.condition??"")}).join(`
1979
+ `)}else{if(!Xg(se,k,_,z(G)))continue;$e=pa(E(ve),"@if",se)}H.push({start:G,end:ue,replacement:$e}),F.lastIndex=ue}for(let G=H.length-1;G>=0;G--){let{start:J,end:ne,replacement:re}=H[G];j=j.substring(0,J)+re+j.substring(ne)}return j}return E(v)}function Sw(v){let _=v.trim();if(_==="")return;if(_==="true")return!0;if(_==="false")return!1;if(_==="null")return!1;if(_==="undefined")return!1;if(_==="NaN")return!1;if(/^-?\d+(?:\.\d+)?$/.test(_)){let T=Number(_);return T!==0&&!Number.isNaN(T)}let k=_.match(/^'((?:\\.|[^'\\])*)'$/);if(k)return k[1].length>0;let E=_.match(/^"((?:\\.|[^"\\])*)"$/);if(E)return E[1].length>0;return}var ma=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),Zg=/<(script|style)\b/iy,$w=/<\/script/gi,_w=/<\/style/gi;function Ul(v,_,k,E){if(ma.has(k.toLowerCase()))return E;let T=k.toLowerCase(),j=v.length,B=1,z=E;while(z<j){let F=v.indexOf("<",z);if(F===-1)return-1;if(z=F,v.startsWith("<!--",z)){let J=v.indexOf("-->",z+4);if(J===-1)return-1;z=J+3;continue}Zg.lastIndex=z;let V=Zg.exec(v);if(V){let J=v.indexOf(">",z);if(J===-1)return-1;if(v[J-1]==="/"){z=J+1;continue}let ne=V[1].toLowerCase()==="script"?$w:_w;ne.lastIndex=z;let re=ne.exec(v);if(re===null)return-1;let se=v.indexOf(">",re.index);if(se===-1)return-1;z=se+1;continue}if(v[z+1]==="/"){let J=/^<\/([a-z][\w-]*)\s*>/i.exec(v.slice(z,z+64));if(!J){z++;continue}if(J[1].toLowerCase()===T){if(B--,z+=J[0].length,B===0)return z;continue}z+=J[0].length;continue}let H=/^<([a-z][\w-]*)\b/i.exec(v.slice(z,z+64));if(!H){z++;continue}let G=v.indexOf(">",z);if(G===-1)return-1;if(H[1].toLowerCase()===T){let J=v.slice(z,G+1);if(!(/\/\s*>$/.test(J)||ma.has(T)))B++}z=G+1}return-1}var kw=/\s(?::else-if|x-else-if|@else-if|:else|x-else|@else)(?=[=\s/>])/;function Ew(v,_){let k=_,E=v.length;for(;;){while(k<E&&v[k]!=="<")k++;if(k>=E)return!1;if(v.startsWith("<!--",k)){let B=v.indexOf("-->",k+4);if(B===-1)return!1;k=B+3;continue}break}if(v[k+1]==="/")return!1;let T=v.indexOf(">",k);if(T===-1)return!1;let j=v.slice(k,T+1);return kw.test(j)}function oi(v){if(!v.includes(":if")&&!v.includes(":show")&&!v.includes("x-if")&&!v.includes("x-show")&&!v.includes("@if=")&&!v.includes("@show="))return v;let _=[],k=/<(script|style)\b[^>]*>[\s\S]*?<\/\1\s*>/gi,E;while((E=k.exec(v))!==null)_.push([E.index,E.index+E[0].length]);let T=(G)=>_.some(([J,ne])=>G>=J&&G<ne),j=/<([a-zA-Z][\w-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*?)\s+(:if|:show|x-if|x-show|@if|@show)\s*=\s*"([^"]*)"((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)(\/?)>/g,B=[],z;while((z=j.exec(v))!==null){if(T(z.index))continue;let[G,J,ne,re,se,ie,ae]=z,ue=Sw(se);if(ue===void 0)continue;let oe=z.index,me=oe+G.length,_e=!!ae||/\/\s*>$/.test(G)||ma.has(J.toLowerCase())?me:Ul(v,oe,J,me);if(_e===-1)continue;if((re===":if"||re==="x-if"||re==="@if")&&Ew(v,_e)){j.lastIndex=me;continue}if(ue===!0){let Ee=`<${J}${ne}${ie}${ae}>`;B.push({start:oe,end:me,replacement:Ee});continue}B.push({start:oe,end:_e,replacement:""}),j.lastIndex=_e}if(B.length===0)return v;B.sort((G,J)=>G.start-J.start);let F=[],V=-1;for(let G of B){if(G.start<V)continue;F.push(G),V=G.end}let H=v;for(let G=F.length-1;G>=0;G--){let{start:J,end:ne,replacement:re}=F[G];H=H.substring(0,J)+re+H.substring(ne)}return H}var Gg=[":for","@for","x-for"];function ds(v,_){if(!_||Object.keys(_).length===0)return v;if(!Gg.some((z)=>v.includes(`${z}=`)))return v;let k=Qg(v);if(Array.isArray(_.__stx_client_signal_names)){for(let z of _.__stx_client_signal_names)if(typeof z==="string")k.add(z)}let E=v,T=[],j=/<([a-zA-Z][\w-]*)((?:[^>"']|"[^"]*"|'[^']*')*)>/g,B;while((B=j.exec(E))!==null){let[z,F,V]=B,H=B.index,G=H+z.length,J=Gg.map(($e)=>({attr:$e,m:new RegExp(`\\s${$e}="([^"]*)"`).exec(V)})).find(($e)=>$e.m!==null);if(!J||!J.m)continue;let ne=cs(J.m[1]);if(!ne.iterable||!ne.itemVar)continue;let re=ne.iterable.trim().split(/[.[(]/)[0].trim();if(!re||k.has(re)||!(re in _))continue;let se=Ul(E,H,F,G);if(se===-1)continue;let ie=V.replace(new RegExp(`\\s${J.attr}="[^"]*"`),"").replace(/\s:key="[^"]*"/,"").replace(/\sx-cloak(?=\s|$)/,""),ae=E.slice(G,se-`</${F}>`.length),ue={..._,[ne.itemVar]:void 0};if(ne.indexVar)ue[ne.indexVar]=void 0;let oe=ds(ae,ue),me=ne.indexVar?`${ne.iterable} as ${ne.indexVar} => ${ne.itemVar}`:`${ne.iterable} as ${ne.itemVar}`,ve=F.toLowerCase()==="template"?oe:`<${F}${ie}>${oe}</${F}>`;T.push({start:H,end:se,replacement:`@foreach(${me})${ve}@endforeach`}),j.lastIndex=se}for(let z=T.length-1;z>=0;z--){let{start:F,end:V,replacement:H}=T[z];E=E.slice(0,F)+H+E.slice(V)}return E}function us(v,_){let k=v,E=/@(for|foreach)\s*\(/g,T,j=[],B=[];while((T=E.exec(k))!==null){let z=T[1],F=T.index,V=F+T[0].length,H=1,G=V;while(G<k.length&&H>0){if(k[G]==="(")H++;else if(k[G]===")")H--;G++}if(H!==0)continue;let J=k.substring(V,G-1).trim(),ne=G,re=cs(J),se=z==="for"?"@endfor":"@endforeach",ie=1,ae=ne,ue=z==="for"?new RegExp("@(for(?!each)\\s*\\(|endfor(?!each))","g"):new RegExp(`@(${z}\\s*\\(|end${z})`,"g");ue.lastIndex=ne;let oe;while((oe=ue.exec(k))!==null)if(oe[1].startsWith(z))ie++;else if(ie--,ie===0){ae=oe.index+oe[0].length;break}if(ie!==0)continue;let me=()=>{let Ae=[re.itemVar,re.indexVar].filter(Boolean);if(Ae.length)B.push({start:F,end:ae,vars:Ae})};if(re.iterable){let Ae=re.iterable.trim();if(Ae.startsWith("[")||Ae.startsWith("{")||Ae.startsWith("'")||Ae.startsWith('"')||Ae.startsWith("`")||/^-?\d/.test(Ae)){me();continue}let Te=Ae.split(/[.[(]/)[0].trim(),ke=_?Te in _:!1,Pe=B.some((Ge)=>F>Ge.start&&F<Ge.end&&Ge.vars.includes(Te));if(Te&&(ke||Pe)){me();continue}}if(re.style==="as")J=re.indexVar?`(${re.itemVar}, ${re.indexVar}) in ${re.iterable}`:`${re.itemVar} in ${re.iterable}`;let ve=k.substring(ne,ae-se.length).trim(),$e=_?{..._}:{};if(re.itemVar)delete $e[re.itemVar];if(re.indexVar)delete $e[re.indexVar];let _e=us(ve,$e),Re=_e.match(Yg),Ee;if(Re){let[,Ae,Te,ke]=Re;Ee=`<${Ae}${Te} @for="${J}">${ke}</${Ae}>`}else Ee=`<template @for="${J}">${_e}</template>`;j.push({start:F,end:ae,replacement:Ee}),E.lastIndex=ae}for(let z=j.length-1;z>=0;z--){let{start:F,end:V,replacement:H}=j[z];k=k.substring(0,F)+H+k.substring(V)}return k}function Cw(v){let _=new Set,k=[],E=0,T=0,j=v.length,B=(H)=>{let G=E+1;while(G<j){let J=v[G];if(J==="\\"){G+=2;continue}if(J===H)return G+1;G++}return j},z=()=>{let H=E+2;while(H<j&&v[H]!==`
1980
1980
  `)H++;return H},F=()=>{let H=E+2;while(H<j-1){if(v[H]==="*"&&v[H+1]==="/")return H+2;H++}return j},V=(H)=>{let G=H,J=0;while(G<j){let ne=v[G];if(ne==="/"&&v[G+1]==="/"){let re=G+2;while(re<j&&v[re]!==`
1981
- `)re++;G=re;continue}if(ne==="/"&&v[G+1]==="*"){let re=G+2;while(re<j-1&&!(v[re]==="*"&&v[re+1]==="/"))re++;G=re+2;continue}if(ne==='"'||ne==="'"||ne==="`"){let re=G+1;while(re<j){if(v[re]==="\\"){re+=2;continue}if(v[re]===ne){re++;break}re++}G=re;continue}if(ne==="("||ne==="["||ne==="{"){J++,G++;continue}if(ne===")"||ne==="]"||ne==="}"){J--,G++;continue}if(ne===";"&&J===0)return G+1;G++}return j};while(E<j){let H=v[E];if(H==="/"&&v[E+1]==="/"){let G=z();k.push(v.slice(E,G)),E=G;continue}if(H==="/"&&v[E+1]==="*"){let G=F();k.push(v.slice(E,G)),E=G;continue}if(H==='"'||H==="'"||H==="`"){let G=B(H);k.push(v.slice(E,G)),E=G;continue}if(H==="{"){T++,k.push(H),E++;continue}if(H==="}"){T--,k.push(H),E++;continue}if(T===0){let G=E>0?v[E-1]:"";if(G===""||/\s/.test(G)||G===";"||G==="}"||G==="{"){let ne=v.slice(E).match(/^(const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=/);if(ne){let re=ne[2],se=V(E+ne[0].length);if(_.has(re)){k.push(`/* stx: deduped const ${re} */`),E=se;continue}_.add(re),k.push(v.slice(E,se)),E=se;continue}}}k.push(H),E++}return k.join("")}var Rw=new Set(["script","style","html","head","meta","link","title","!doctype"]);function Vl(v,_,k){for(let E of k){if(E.start>=_)return!1;if(E.end>v)return!0}return!1}function Aw(v,_,k){let E=0;while(E<v.length){let T=v.indexOf(_,E);if(T===-1)return!1;if(!Vl(T,T+_.length,k))return!0;E=T+_.length}return!1}function Tw(v,_){if(Aw(v,"<body",_)){let T=new RegExp(`<body(${Fl})>`,"g"),j;while((j=T.exec(v))!==null)if(!Vl(j.index,j.index+j[0].length,_))return j.index+j[0].length-1;return null}let k=new RegExp(`<([a-zA-Z][a-zA-Z0-9-]*)\\b(${Fl})>`,"gi"),E;while((E=k.exec(v))!==null){if(Vl(E.index,E.index+E[0].length,_))continue;if(Rw.has(E[1].toLowerCase()))continue;return E.index+E[0].length-1}return null}function Iw(v,_,k,E){let T=[],j=` data-stx="${E}"`,B=0,z=!1,F=(V)=>{if(k!==null&&!z&&k>=B&&k<=V)T.push(v.slice(B,k),j,v.slice(k,V)),z=!0;else T.push(v.slice(B,V))};for(let V of _){if(V.start<B)continue;F(V.start),B=V.end}return F(v.length),T.join("")}async function qn(v,_,k,E={}){let T=mc(v,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b/}),j=/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useStore|useLocalStorage|useSessionStorage|keptState|useCookie|useId|useModel|useReactiveProp|useFetch|useRef|useEventListener|useDebounce|useDebouncedValue|useThrottle|useInterval|useTimeout|useToggle|useCounter|useClickOutside|useFocus|useAsync|useColorMode|useDark|useMediaQuery|useScrollLock|usePreferredDark|usePreferredLight|usePreferredReducedMotion|usePreferredContrast|useWebSocket|useRoute|useSearchParams|onMount|onDestroy|defineProps|withDefaults|defineEmits|defineExpose|defineSlots|useOptimistic)\s*(?:<[^>]*>)?\s*\(/,B=[],{hasUserImports:z,bundleClientScript:F}=await mt("stx/client-script-bundler",()=>import("./chunk-x5gbrjm5.js"));for(let oe of T){let me=oe.body;if(Ue(oe.attrs))me=We(me);if(E.forceClientSetup||j.test(me)){B.push({content:me,start:oe.start,end:oe.end});continue}if(!z(me))continue;try{let we=await F(wt(me).code,_||"",{projectRoot:process.cwd(),externalizeUserModules:!1});if(j.test(we))B.push({content:me,start:oe.start,end:oe.end})}catch{}}if(B.length===0)return{output:v,setupCode:null};let V=`${_??""}\x00${B.map((oe)=>oe.content).join("\x00")}`,H=`__stx_setup_${Bun.hash(V).toString(36).slice(0,10)}`,G=[];for(let oe=0;oe<B.length;oe++){let me=B[oe].bundled??wt(B[oe].content).code;if(!B[oe].bundled&&z(me))me=await F(me,_||"",{projectRoot:process.cwd(),externalizeUserModules:E.forceClientSetup?!1:void 0});me=Ve(me);let we=I(me);G.push(`// \u2500\u2500 merged signal script #${oe+1} \u2500\u2500
1982
- ${we}`)}let J=G.join(`
1981
+ `)re++;G=re;continue}if(ne==="/"&&v[G+1]==="*"){let re=G+2;while(re<j-1&&!(v[re]==="*"&&v[re+1]==="/"))re++;G=re+2;continue}if(ne==='"'||ne==="'"||ne==="`"){let re=G+1;while(re<j){if(v[re]==="\\"){re+=2;continue}if(v[re]===ne){re++;break}re++}G=re;continue}if(ne==="("||ne==="["||ne==="{"){J++,G++;continue}if(ne===")"||ne==="]"||ne==="}"){J--,G++;continue}if(ne===";"&&J===0)return G+1;G++}return j};while(E<j){let H=v[E];if(H==="/"&&v[E+1]==="/"){let G=z();k.push(v.slice(E,G)),E=G;continue}if(H==="/"&&v[E+1]==="*"){let G=F();k.push(v.slice(E,G)),E=G;continue}if(H==='"'||H==="'"||H==="`"){let G=B(H);k.push(v.slice(E,G)),E=G;continue}if(H==="{"){T++,k.push(H),E++;continue}if(H==="}"){T--,k.push(H),E++;continue}if(T===0){let G=E>0?v[E-1]:"";if(G===""||/\s/.test(G)||G===";"||G==="}"||G==="{"){let ne=v.slice(E).match(/^(const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=/);if(ne){let re=ne[2],se=V(E+ne[0].length);if(_.has(re)){k.push(`/* stx: deduped const ${re} */`),E=se;continue}_.add(re),k.push(v.slice(E,se)),E=se;continue}}}k.push(H),E++}return k.join("")}var Rw=new Set(["script","style","html","head","meta","link","title","!doctype"]);function Vl(v,_,k){for(let E of k){if(E.start>=_)return!1;if(E.end>v)return!0}return!1}function Aw(v,_,k){let E=0;while(E<v.length){let T=v.indexOf(_,E);if(T===-1)return!1;if(!Vl(T,T+_.length,k))return!0;E=T+_.length}return!1}function Tw(v,_){if(Aw(v,"<body",_)){let T=new RegExp(`<body(${Fl})>`,"g"),j;while((j=T.exec(v))!==null)if(!Vl(j.index,j.index+j[0].length,_))return j.index+j[0].length-1;return null}let k=new RegExp(`<([a-zA-Z][a-zA-Z0-9-]*)\\b(${Fl})>`,"gi"),E;while((E=k.exec(v))!==null){if(Vl(E.index,E.index+E[0].length,_))continue;if(Rw.has(E[1].toLowerCase()))continue;return E.index+E[0].length-1}return null}function Iw(v,_,k,E){let T=[],j=` data-stx="${E}"`,B=0,z=!1,F=(V)=>{if(k!==null&&!z&&k>=B&&k<=V)T.push(v.slice(B,k),j,v.slice(k,V)),z=!0;else T.push(v.slice(B,V))};for(let V of _){if(V.start<B)continue;F(V.start),B=V.end}return F(v.length),T.join("")}async function qn(v,_,k,E={}){let T=mc(v,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b/}),j=/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useStore|useLocalStorage|useSessionStorage|keptState|useCookie|useId|useModel|useReactiveProp|useFetch|useRef|useEventListener|useDebounce|useDebouncedValue|useThrottle|useInterval|useTimeout|useToggle|useCounter|useClickOutside|useFocus|useAsync|useColorMode|useDark|useMediaQuery|useScrollLock|usePreferredDark|usePreferredLight|usePreferredReducedMotion|usePreferredContrast|useWebSocket|useRoute|useSearchParams|onMount|onDestroy|defineProps|withDefaults|defineEmits|defineExpose|defineSlots|useOptimistic)\s*(?:<[^>]*>)?\s*\(/,B=[],{hasUserImports:z,bundleClientScript:F}=await mt("stx/client-script-bundler",()=>import("./chunk-jc25dv0f.js"));for(let oe of T){let me=oe.body;if(Ue(oe.attrs))me=We(me);if(E.forceClientSetup||j.test(me)){B.push({content:me,start:oe.start,end:oe.end});continue}if(!z(me))continue;try{let ve=await F(vt(me).code,_||"",{projectRoot:process.cwd(),externalizeUserModules:!1});if(j.test(ve))B.push({content:me,start:oe.start,end:oe.end})}catch{}}if(B.length===0)return{output:v,setupCode:null};let V=`${_??""}\x00${B.map((oe)=>oe.content).join("\x00")}`,H=`__stx_setup_${Bun.hash(V).toString(36).slice(0,10)}`,G=[];for(let oe=0;oe<B.length;oe++){let me=B[oe].bundled??vt(B[oe].content).code;if(!B[oe].bundled&&z(me))me=await F(me,_||"",{projectRoot:process.cwd(),externalizeUserModules:E.forceClientSetup?!1:void 0});me=Ve(me);let ve=I(me);G.push(`// \u2500\u2500 merged signal script #${oe+1} \u2500\u2500
1982
+ ${ve}`)}let J=G.join(`
1983
1983
 
1984
1984
  `);J=Cw(J);let ne=hc(J),re=ne.split(",").map((oe)=>oe.trim()).filter(Boolean),se=Zr(J,k),ie=`
1985
1985
  <script data-stx-scoped>
@@ -1992,7 +1992,7 @@ window.__stx_latestSetup=${H};
1992
1992
  if(window.stx)window.stx._latestSetup=${H};
1993
1993
  </script>`,ae=Tw(v,B);return{output:Iw(v,B,ae,H),setupCode:ie}}function hc(v){let _=v,k=[],E=new Set,T=0,j=0,B=_.length,z="",F=()=>{j++;let re=!1;while(j<B){let se=_[j];if(se==="\\"){j+=2;continue}if(se==="["&&!re){re=!0,j++;continue}if(se==="]"&&re){re=!1,j++;continue}if(se==="/"&&!re){j++;while(j<B&&/[gimsuyd]/.test(_[j]))j++;return}if(se===`
1994
1994
  `)return;j++}},V=()=>{if(!z)return!0;if(/[\w)\]]/.test(z))return!1;return!0},H=(re)=>{j++;while(j<B){if(_[j]==="\\"){j+=2;continue}if(_[j]===re){j++;return}j++}},G=()=>{j++;while(j<B){if(_[j]==="\\"){j+=2;continue}if(_[j]==="`"){j++;return}if(_[j]==="$"&&_[j+1]==="{"){j+=2;let re=1;while(j<B&&re>0)if(_[j]==="{")re++,j++;else if(_[j]==="}")re--,j++;else if(_[j]==="'"||_[j]==='"')H(_[j]);else if(_[j]==="`")G();else j++;continue}j++}},J=()=>{if(_[j]==="/"&&_[j+1]==="/"){while(j<B&&_[j]!==`
1995
- `)j++;return!0}if(_[j]==="/"&&_[j+1]==="*"){j+=2;while(j<B-1&&!(_[j]==="*"&&_[j+1]==="/"))j++;return j+=2,!0}return!1},ne=()=>{if(T!==0)return;let re=_.slice(j).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*(?:[!:;,\n]|=(?!=)|$)/);if(re){let oe=re[2];if(!E.has(oe))k.push(oe),E.add(oe);return}let se=_.slice(j).match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(se){se[1].split(",").forEach((oe)=>{let me=oe.trim();if(!me)return;let we=me.indexOf(":"),_e=(we>=0?me.slice(we+1).trim():me).split(/[\s=]/)[0];if(_e&&!E.has(_e))k.push(_e),E.add(_e)});return}let ie=_.slice(j).match(/^(?:const|let|var)\s+\[([^\]]+)\]\s*=/);if(ie){ie[1].split(",").forEach((oe)=>{let me=oe.trim().replace(/^\.\.\./,"");if(!me)return;let we=me.split(/[\s=]/)[0];if(we&&!E.has(we))k.push(we),E.add(we)});return}let ae=_.slice(j).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(ae){let oe=ae[1];if(!E.has(oe))k.push(oe),E.add(oe);return}let ue=_.slice(j).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(ue){let oe=ue[1];if(!E.has(oe))k.push(oe),E.add(oe)}};while(j<B){if(J())continue;if(_[j]==="'"||_[j]==='"'){H(_[j]),z=_[j-1];continue}if(_[j]==="`"){G(),z="`";continue}if(_[j]==="/"&&_[j+1]!=="/"&&_[j+1]!=="*"&&V()){F(),z="/";continue}if(_[j]==="{"){T++,z="{",j++;continue}if(_[j]==="}"){T--,z="}",j++;continue}if(T===0&&/[a-z]/i.test(_[j])&&(j===0||/\s|[;{}()]/.test(_[j-1])))ne();if(!/\s/.test(_[j]))z=_[j];j++}return k.join(", ")}async function ii(v,_,k,E){if(!ls(v,k))return v;let T=v;if(_.skipSignalsRuntime)return T;let{output:j,setupCode:B}=await qn(T,k,E);if(T=j,!B){let z=Nn(T);if(z&&!/data-stx/.test(z.attrs)&&!/data-stx-auto/.test(z.attrs)){let F=z.tag.replace(/^<body([^>]*)>$/i,"<body$1 data-stx-auto>");T=T.slice(0,z.index)+F+T.slice(z.index+z.tag.length)}}if(T=await fa(T,_),B){let z=ai(T,/<\/head>/i),F=z===-1?ai(T,/<body[^>]*>/i):-1;if(z!==-1)T=`${T.slice(0,z)}${B}
1995
+ `)j++;return!0}if(_[j]==="/"&&_[j+1]==="*"){j+=2;while(j<B-1&&!(_[j]==="*"&&_[j+1]==="/"))j++;return j+=2,!0}return!1},ne=()=>{if(T!==0)return;let re=_.slice(j).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*(?:[!:;,\n]|=(?!=)|$)/);if(re){let oe=re[2];if(!E.has(oe))k.push(oe),E.add(oe);return}let se=_.slice(j).match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(se){se[1].split(",").forEach((oe)=>{let me=oe.trim();if(!me)return;let ve=me.indexOf(":"),_e=(ve>=0?me.slice(ve+1).trim():me).split(/[\s=]/)[0];if(_e&&!E.has(_e))k.push(_e),E.add(_e)});return}let ie=_.slice(j).match(/^(?:const|let|var)\s+\[([^\]]+)\]\s*=/);if(ie){ie[1].split(",").forEach((oe)=>{let me=oe.trim().replace(/^\.\.\./,"");if(!me)return;let ve=me.split(/[\s=]/)[0];if(ve&&!E.has(ve))k.push(ve),E.add(ve)});return}let ae=_.slice(j).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(ae){let oe=ae[1];if(!E.has(oe))k.push(oe),E.add(oe);return}let ue=_.slice(j).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(ue){let oe=ue[1];if(!E.has(oe))k.push(oe),E.add(oe)}};while(j<B){if(J())continue;if(_[j]==="'"||_[j]==='"'){H(_[j]),z=_[j-1];continue}if(_[j]==="`"){G(),z="`";continue}if(_[j]==="/"&&_[j+1]!=="/"&&_[j+1]!=="*"&&V()){F(),z="/";continue}if(_[j]==="{"){T++,z="{",j++;continue}if(_[j]==="}"){T--,z="}",j++;continue}if(T===0&&/[a-z]/i.test(_[j])&&(j===0||/\s|[;{}()]/.test(_[j-1])))ne();if(!/\s/.test(_[j]))z=_[j];j++}return k.join(", ")}async function ii(v,_,k,E){if(!ls(v,k))return v;let T=v;if(_.skipSignalsRuntime)return T;let{output:j,setupCode:B}=await qn(T,k,E);if(T=j,!B){let z=Nn(T);if(z&&!/data-stx/.test(z.attrs)&&!/data-stx-auto/.test(z.attrs)){let F=z.tag.replace(/^<body([^>]*)>$/i,"<body$1 data-stx-auto>");T=T.slice(0,z.index)+F+T.slice(z.index+z.tag.length)}}if(T=await fa(T,_),B){let z=ai(T,/<\/head>/i),F=z===-1?ai(T,/<body[^>]*>/i):-1;if(z!==-1)T=`${T.slice(0,z)}${B}
1996
1996
  ${T.slice(z)}`;else if(F!==-1){let V=/<body[^>]*>/i.exec(T.slice(F))[0],H=F+V.length;T=`${T.slice(0,H)}
1997
1997
  ${B}${T.slice(H)}`}else T=`${T}
1998
1998
  ${B}`}return T}function ai(v,_){let k=/<(script|style)\b[\s\S]*?<\/\1>/gi,E=[],T;while((T=k.exec(v))!==null)E.push([T.index,T.index+T[0].length]);let j=new RegExp(_.source,_.flags.replace(/[gy]/g,"")),B=0;while(B<v.length){let z=j.exec(v.slice(B));if(!z)return-1;let F=B+z.index;if(!E.some(([H,G])=>F>=H&&F<G))return F;B=F+Math.max(z[0].length,1)}return-1}var Jg="/* [stx import stripped, resolved via window.stx in __stx_setup] */";function yc(v){let _=[];for(let k of v.split(",")){let E=k.trim();if(!E||E.startsWith("type "))continue;let T=E.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(T&&T[1]!==T[2])_.push(`${T[2]} = ${T[1]}`)}if(_.length===0)return Jg;return`var ${_.join(", ")}; ${Jg}`}var Pw=/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"](?:stx|@stacksjs\/stx|@stacksjs\/browser)['"]\s*;?\s*$/gm;function Ve(v){return v.replace(Pw,(_,k)=>yc(k))}import Xs from"path";import Dw from"process";function w(v="STX_PUBLIC_"){let _={},k={};for(let[E,T]of Object.entries(Dw.env)){if(!E.startsWith(v)||T===void 0)continue;_[`import.meta.env.${E}`]=JSON.stringify(T),k[E]=T}return _["import.meta.env"]=JSON.stringify(k),_}function em(v){return v.startsWith("http://")||v.startsWith("https://")||v.startsWith("//")}async function tm(v,_,k){try{let E;if(v.startsWith("/")){let T=_;for(let j=0;j<5;j++){let B=Xs.join(T,v);if(await Bun.file(B).exists())return B;T=Xs.dirname(T)}E=Xs.join(_,v)}else if(v.startsWith("./")||v.startsWith("../"))E=Xs.resolve(_,v);else E=Xs.resolve(_,v);if(await Bun.file(E).exists())return E;return null}catch{return null}}var nm=Symbol.for("stx.inline-assets.import-meta");function Ow(v,_){if(!v.includes("import.meta"))return;let k=Error(`[stx] ${_} still references \`import.meta\` after bundling, and it is being inlined as a classic <script> where that is a SyntaxError \u2014 the whole script fails to parse, taking every other script on the page with it.
@@ -2002,83 +2002,83 @@ ${re}
2002
2002
  </script>`;E=E.replace(V,se),j.lastIndex=0}catch(re){if(re?.[nm])throw re}}let z=/<link\b([^>]*)href=["']([^"']+)["']([^>]*)(?:\/?>)/gi,F;while((F=z.exec(E))!==null){let[V,H,G,J]=F,ne=H+J;if(em(G))continue;if(/rel=["']stylesheet["']/.test(ne)||G.endsWith(".css")){let se=await tm(G,T,_);if(se)try{let ie=await Bun.file(se).text();k.add(se);let ae=`<style>
2003
2003
  /* Source: ${G} */
2004
2004
  ${ie}
2005
- </style>`;E=E.replace(V,ae),z.lastIndex=0}catch(ie){}}}return E}function vs(v,_){let k=v,E=/@json\s*\(/g,T;while((T=E.exec(k))!==null){let j=T.index,B=j+T[0].length-1,z=1,F=B+1,V=null,H=!1;while(F<k.length&&z>0){let oe=k[F];if(H){H=!1,F++;continue}if(oe==="\\"&&V){H=!0,F++;continue}if(V){if(oe===V)V=null;F++;continue}if(oe==='"'||oe==="'"||oe==="`"){V=oe,F++;continue}if(oe==="(")z++;else if(oe===")"){if(z--,z===0)break}F++}if(z!==0)break;let G=k.substring(B+1,F).trim(),J=k.substring(j,F+1),ne=-1,re=0,se=null,ie=!1;for(let oe=0;oe<G.length;oe++){let me=G[oe];if(ie){ie=!1;continue}if(me==="\\"&&se){ie=!0;continue}if(se){if(me===se)se=null;continue}if(me==='"'||me==="'"||me==="`"){se=me;continue}if(me==="("||me==="["||me==="{")re++;else if(me===")"||me==="]"||me==="}")re--;if(me===","&&re===0){ne=oe;break}}let ae=ne>=0?G.substring(0,ne).trim():G,ue=ne>=0?G.substring(ne+1).trim():void 0;try{let oe=ae.trim(),me;if(p(oe))me=l(oe,Object.keys(_))(...Object.values(_));else me=void 0;let we;if(ue==="true")we=JSON.stringify(me,null,2);else we=JSON.stringify(me);let $e=we.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029");k=k.substring(0,j)+$e+k.substring(F+1),E.lastIndex=j+$e.length}catch(oe){P.log(oe instanceof Error?oe:Error(String(oe)),{directive:"@json"},"error"),E.lastIndex=j+J.length}}return k}function ws(v){return v.replace(/@once\s*([\s\S]*?)@endonce/g,"$1")}function am(v){let _=v,k=/@memo\s*\(/g,E,T=[];while((E=k.exec(_))!==null){let j=E.index,B=j+E[0].length,z=1,F=B;while(F<_.length&&z>0){if(_[F]==="(")z++;else if(_[F]===")")z--;F++}if(z!==0)continue;let V=_.slice(B,F-1).trim(),H=F,G=_.slice(H),J=G.indexOf("@endmemo");if(J===-1)continue;let ne=G.slice(0,J),re=H+J+8,se=ne.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)/),ie=se?se[0].length:0,ae=ne.slice(ie),ue=ne.match(/(\s*)$/),oe=ue?ue[0].length:0,me=ae.slice(0,ae.length-oe),we=me.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)?(\/?)>/),$e;if(we){let[_e,Re,Ee="",Ae]=we,Te=`<${Re}${Ee} data-stx-memo="${V}"${Ae}>`;$e=ne.slice(0,ie)+Te+me.slice(_e.length)+ne.slice(ie+me.length)}else $e=`${ne.slice(0,ie)}<div data-stx-memo="${V}">${me}</div>${ne.slice(ie+me.length)}`;T.push({start:j,end:re,replacement:$e}),k.lastIndex=re}for(let j=T.length-1;j>=0;j--){let B=T[j];_=_.slice(0,B.start)+B.replacement+_.slice(B.end)}return _.replace(/@memo="([^"]*)"/g,'data-stx-memo="$1"')}function Hl(v){let _=v.replace(/@ref="([^"]+)"/g,'data-stx-ref="$1"');return _=_.replace(/(<[a-zA-Z][a-zA-Z0-9-]*\b[^>]*?)\sref="([^"]+)"/g,'$1 data-stx-ref="$2"'),_}function cm(v,_){if(!/\bref\s*=/.test(v))return v;let k=/<\/?([a-zA-Z][\w-]*)\b(?:"[^"]*"|'[^']*'|[^'">])*>/y,E=gr(v,(F,V)=>{k.lastIndex=V;let H=k.exec(F);if(!H||/^(?:script|style)$/i.test(H[1]))return-1;return k.lastIndex}),T=[],j=0,B=0,z=[];for(let{start:F,end:V,token:H}of E){let G=/^<\/?([\w-]+)/.exec(H)[1].toLowerCase();if(H.startsWith("</")){let ne;while(ne=T.pop()){if(ne.scoped)j--;if(ne.name===G)break}continue}let J=/\sdata-stx-scope\s*=/.test(H);if(!j&&!J&&/\s(?:ref|@ref|:ref|x-ref|data-stx-ref)\s*=/.test(H)&&!/\sdata-stx-ref-caller\s*=/.test(H))z.push(v.slice(B,F),H.replace(/\s*\/?>$/,(ne)=>` data-stx-ref-caller="${_}"${ne}`)),B=V;if(!lm.has(G)&&!/\/>$/.test(H)){if(T.push({name:G,scoped:J}),J)j++}}return z.push(v.slice(B)),z.join("")}var lm=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),um=/(?:^|\s)x-no-cloak(?:=|\s|\/|>|$)/,sm=/<\/?\s*([a-z][\w-]*)/iy,Mw=/\s/;function Nw(v,_){let k=_-1;while(k>=0&&Mw.test(v[k]))k--;return k>=0&&v[k]==="/"}function jw(v,_){let k=!1,E=!1;for(let T=_;T<v.length;T++){let j=v[T];if(k){if(j==="'")k=!1}else if(E){if(j==='"')E=!1}else if(j==="'")k=!0;else if(j==='"')E=!0;else if(j===">")return T}return-1}function Lw(v,_){if(v.indexOf("{",_)===-1||v.indexOf("}",_)===-1)return!1;let k=0,E=_,T=!1,j=!1,B=!1;while(E<v.length){let z=v.indexOf("<",E),F=z===-1?v.length:z;if(F>E){if(k===0)while(E<F){let G=v.indexOf(j?"}":"{",E);if(G===-1||G>=F){if(j)B=!1;else T=!1;break}if(G>E)if(j)B=!1;else T=!1;if(j){if(B)return!0;B=!0}else if(T)j=!0,B=!1;else T=!0;E=G+1}E=F;continue}if(v.startsWith("<!--",E)){let G=v.indexOf("-->",E);E=G===-1?v.length:G+3;continue}let V=jw(v,E);if(V===-1)break;sm.lastIndex=E;let H=sm.exec(v)?.[1]?.toLowerCase()??"";if(v[E+1]==="/"){if(k===0)break;k--}else if(!Nw(v,V)&&!lm.has(H))k++;E=V+1}return!1}var im=m(256);function dm(v){if(v.length<1024)return om(v);let _=h(v),k=im.get(_);if(k!==void 0)return k;let E=om(v);return im.set(_,E),E}function om(v){if(v.length>=32768&&!ld(v))return v;let k=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"),E="",T=0,j;while((j=k.exec(v))!==null){let B=j.index,z=B+j[0].length,F=!1,V=!1,H=-1;while(z<v.length){let J=v[z];if(F){if(J==="'")F=!1}else if(V){if(J==='"')V=!1}else if(J==="'")F=!0;else if(J==='"')V=!0;else if(J===">"){H=z;break}z++}if(H===-1)continue;let G=v.slice(B,H+1);if(um.test(G))continue;if(G.includes("x-cloak"))continue;if(Lw(v,H+1))E+=v.slice(T,H)+" x-cloak>",T=H+1}return E+=v.slice(T),E}var Bw=/(?:^|\s)(?::else-if|:if|:else|:show|x-else-if|x-if|x-else|x-show|@if|@show)(?:=|\s|\/|>|$)/,zw=/<\/script>/gi,Ww=/<\/style>/gi;function fm(v){let _=/<[a-z][\w-]*/gi,k="",E=0,T;while((T=_.exec(v))!==null){let j=T.index,B=T[0].slice(1).toLowerCase();if(B==="script"||B==="style"){let re=B==="script"?zw:Ww;re.lastIndex=j;let se=re.exec(v);if(se!==null)_.lastIndex=se.index+se[0].length;continue}let z=j+T[0].length,F=!1,V=!1,H=-1;while(z<v.length){let re=v[z];if(F){if(re==="'")F=!1}else if(V){if(re==='"')V=!1}else if(re==="'")F=!0;else if(re==='"')V=!0;else if(re===">"){H=z;break}z++}if(H===-1)continue;let G=v.slice(j+T[0].length,H);if(um.test(G))continue;if(/(?:^|\s)x-cloak(?:=|\s|\/|>|$)/.test(G))continue;if(!Bw.test(G))continue;let J=v[H-1]==="/",ne=J?H-1:H;k+=`${v.slice(E,ne)} x-cloak${J?" ":""}`,E=ne}return k+=v.slice(E),k}var ql=m(256),Fw=[{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"}],pm=/(?:\/\/|\/\*|\{\{--)\s*stx-strict-ignore(-next-line)?([^\n*}]*)/g;function Vw(v){let _=Array.from(v,(T)=>T===`
2005
+ </style>`;E=E.replace(V,ae),z.lastIndex=0}catch(ie){}}}return E}function ws(v,_){let k=v,E=/@json\s*\(/g,T;while((T=E.exec(k))!==null){let j=T.index,B=j+T[0].length-1,z=1,F=B+1,V=null,H=!1;while(F<k.length&&z>0){let oe=k[F];if(H){H=!1,F++;continue}if(oe==="\\"&&V){H=!0,F++;continue}if(V){if(oe===V)V=null;F++;continue}if(oe==='"'||oe==="'"||oe==="`"){V=oe,F++;continue}if(oe==="(")z++;else if(oe===")"){if(z--,z===0)break}F++}if(z!==0)break;let G=k.substring(B+1,F).trim(),J=k.substring(j,F+1),ne=-1,re=0,se=null,ie=!1;for(let oe=0;oe<G.length;oe++){let me=G[oe];if(ie){ie=!1;continue}if(me==="\\"&&se){ie=!0;continue}if(se){if(me===se)se=null;continue}if(me==='"'||me==="'"||me==="`"){se=me;continue}if(me==="("||me==="["||me==="{")re++;else if(me===")"||me==="]"||me==="}")re--;if(me===","&&re===0){ne=oe;break}}let ae=ne>=0?G.substring(0,ne).trim():G,ue=ne>=0?G.substring(ne+1).trim():void 0;try{let oe=ae.trim(),me;if(p(oe))me=l(oe,Object.keys(_))(...Object.values(_));else me=void 0;let ve;if(ue==="true")ve=JSON.stringify(me,null,2);else ve=JSON.stringify(me);let $e=ve.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029");k=k.substring(0,j)+$e+k.substring(F+1),E.lastIndex=j+$e.length}catch(oe){P.log(oe instanceof Error?oe:Error(String(oe)),{directive:"@json"},"error"),E.lastIndex=j+J.length}}return k}function vs(v){return v.replace(/@once\s*([\s\S]*?)@endonce/g,"$1")}function am(v){let _=v,k=/@memo\s*\(/g,E,T=[];while((E=k.exec(_))!==null){let j=E.index,B=j+E[0].length,z=1,F=B;while(F<_.length&&z>0){if(_[F]==="(")z++;else if(_[F]===")")z--;F++}if(z!==0)continue;let V=_.slice(B,F-1).trim(),H=F,G=_.slice(H),J=G.indexOf("@endmemo");if(J===-1)continue;let ne=G.slice(0,J),re=H+J+8,se=ne.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)/),ie=se?se[0].length:0,ae=ne.slice(ie),ue=ne.match(/(\s*)$/),oe=ue?ue[0].length:0,me=ae.slice(0,ae.length-oe),ve=me.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)?(\/?)>/),$e;if(ve){let[_e,Re,Ee="",Ae]=ve,Te=`<${Re}${Ee} data-stx-memo="${V}"${Ae}>`;$e=ne.slice(0,ie)+Te+me.slice(_e.length)+ne.slice(ie+me.length)}else $e=`${ne.slice(0,ie)}<div data-stx-memo="${V}">${me}</div>${ne.slice(ie+me.length)}`;T.push({start:j,end:re,replacement:$e}),k.lastIndex=re}for(let j=T.length-1;j>=0;j--){let B=T[j];_=_.slice(0,B.start)+B.replacement+_.slice(B.end)}return _.replace(/@memo="([^"]*)"/g,'data-stx-memo="$1"')}function Hl(v){let _=v.replace(/@ref="([^"]+)"/g,'data-stx-ref="$1"');return _=_.replace(/(<[a-zA-Z][a-zA-Z0-9-]*\b[^>]*?)\sref="([^"]+)"/g,'$1 data-stx-ref="$2"'),_}function cm(v,_){if(!/\bref\s*=/.test(v))return v;let k=/<\/?([a-zA-Z][\w-]*)\b(?:"[^"]*"|'[^']*'|[^'">])*>/y,E=gr(v,(F,V)=>{k.lastIndex=V;let H=k.exec(F);if(!H||/^(?:script|style)$/i.test(H[1]))return-1;return k.lastIndex}),T=[],j=0,B=0,z=[];for(let{start:F,end:V,token:H}of E){let G=/^<\/?([\w-]+)/.exec(H)[1].toLowerCase();if(H.startsWith("</")){let ne;while(ne=T.pop()){if(ne.scoped)j--;if(ne.name===G)break}continue}let J=/\sdata-stx-scope\s*=/.test(H);if(!j&&!J&&/\s(?:ref|@ref|:ref|x-ref|data-stx-ref)\s*=/.test(H)&&!/\sdata-stx-ref-caller\s*=/.test(H))z.push(v.slice(B,F),H.replace(/\s*\/?>$/,(ne)=>` data-stx-ref-caller="${_}"${ne}`)),B=V;if(!lm.has(G)&&!/\/>$/.test(H)){if(T.push({name:G,scoped:J}),J)j++}}return z.push(v.slice(B)),z.join("")}var lm=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),um=/(?:^|\s)x-no-cloak(?:=|\s|\/|>|$)/,sm=/<\/?\s*([a-z][\w-]*)/iy,Mw=/\s/;function Nw(v,_){let k=_-1;while(k>=0&&Mw.test(v[k]))k--;return k>=0&&v[k]==="/"}function jw(v,_){let k=!1,E=!1;for(let T=_;T<v.length;T++){let j=v[T];if(k){if(j==="'")k=!1}else if(E){if(j==='"')E=!1}else if(j==="'")k=!0;else if(j==='"')E=!0;else if(j===">")return T}return-1}function Lw(v,_){if(v.indexOf("{",_)===-1||v.indexOf("}",_)===-1)return!1;let k=0,E=_,T=!1,j=!1,B=!1;while(E<v.length){let z=v.indexOf("<",E),F=z===-1?v.length:z;if(F>E){if(k===0)while(E<F){let G=v.indexOf(j?"}":"{",E);if(G===-1||G>=F){if(j)B=!1;else T=!1;break}if(G>E)if(j)B=!1;else T=!1;if(j){if(B)return!0;B=!0}else if(T)j=!0,B=!1;else T=!0;E=G+1}E=F;continue}if(v.startsWith("<!--",E)){let G=v.indexOf("-->",E);E=G===-1?v.length:G+3;continue}let V=jw(v,E);if(V===-1)break;sm.lastIndex=E;let H=sm.exec(v)?.[1]?.toLowerCase()??"";if(v[E+1]==="/"){if(k===0)break;k--}else if(!Nw(v,V)&&!lm.has(H))k++;E=V+1}return!1}var im=m(256);function dm(v){if(v.length<1024)return om(v);let _=h(v),k=im.get(_);if(k!==void 0)return k;let E=om(v);return im.set(_,E),E}function om(v){if(v.length>=32768&&!ld(v))return v;let k=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"),E="",T=0,j;while((j=k.exec(v))!==null){let B=j.index,z=B+j[0].length,F=!1,V=!1,H=-1;while(z<v.length){let J=v[z];if(F){if(J==="'")F=!1}else if(V){if(J==='"')V=!1}else if(J==="'")F=!0;else if(J==='"')V=!0;else if(J===">"){H=z;break}z++}if(H===-1)continue;let G=v.slice(B,H+1);if(um.test(G))continue;if(G.includes("x-cloak"))continue;if(Lw(v,H+1))E+=v.slice(T,H)+" x-cloak>",T=H+1}return E+=v.slice(T),E}var Bw=/(?:^|\s)(?::else-if|:if|:else|:show|x-else-if|x-if|x-else|x-show|@if|@show)(?:=|\s|\/|>|$)/,zw=/<\/script>/gi,Ww=/<\/style>/gi;function fm(v){let _=/<[a-z][\w-]*/gi,k="",E=0,T;while((T=_.exec(v))!==null){let j=T.index,B=T[0].slice(1).toLowerCase();if(B==="script"||B==="style"){let re=B==="script"?zw:Ww;re.lastIndex=j;let se=re.exec(v);if(se!==null)_.lastIndex=se.index+se[0].length;continue}let z=j+T[0].length,F=!1,V=!1,H=-1;while(z<v.length){let re=v[z];if(F){if(re==="'")F=!1}else if(V){if(re==='"')V=!1}else if(re==="'")F=!0;else if(re==='"')V=!0;else if(re===">"){H=z;break}z++}if(H===-1)continue;let G=v.slice(j+T[0].length,H);if(um.test(G))continue;if(/(?:^|\s)x-cloak(?:=|\s|\/|>|$)/.test(G))continue;if(!Bw.test(G))continue;let J=v[H-1]==="/",ne=J?H-1:H;k+=`${v.slice(E,ne)} x-cloak${J?" ":""}`,E=ne}return k+=v.slice(E),k}var ql=m(256),Fw=[{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"}],pm=/(?:\/\/|\/\*|\{\{--)\s*stx-strict-ignore(-next-line)?([^\n*}]*)/g;function Vw(v){let _=Array.from(v,(T)=>T===`
2006
2006
  `?`
2007
2007
  `:" "),k=0,E="";while(k<v.length){let T=v[k],j=v[k+1];if(E){if(T==="\\"){k+=2;continue}if(T===E)E="";k++;continue}if(T==='"'||T==="'"||T==="`"){E=T,k++;continue}if(T==="/"&&j==="/"){while(k<v.length&&v[k]!==`
2008
2008
  `)_[k]=v[k],k++;continue}if(T==="/"&&j==="*"){let B=v.indexOf("*/",k+2),z=B===-1?v.length:B+2;for(;k<z;k++)_[k]=v[k];continue}if(T==="{"&&j==="{"&&v.slice(k,k+4)==="{{--"){let B=v.indexOf("--}}",k+4),z=B===-1?v.length:B+4;for(;k<z;k++)_[k]=v[k];continue}k++}return _.join("")}function Uw(v){let _=new Map,k=Vw(v).split(`
2009
2009
  `),E=v.split(`
2010
2010
  `);return k.forEach((T,j)=>{pm.lastIndex=0;for(let B of T.matchAll(pm)){let z=B[1]==="-next-line",F=(E[j]??"").slice(0,B.index).trim(),V=z||F===""?j+2:j+1,G=(B[2]??"").split("--")[0].split(/[\s,]+/).filter(Boolean),J=G.filter((re)=>/\w/.test(re));if(G.length>0&&J.length===0)continue;let ne=_.get(V);if(ne&&ne.size===0)continue;if(J.length===0){_.set(V,new Set);continue}if(ne)J.forEach((re)=>ne.add(re));else _.set(V,new Set(J))}}),_}function Hw(v,_,k){let E=v.get(_);if(!E)return!1;if(E.size===0)return!0;return[...E].some((T)=>k.includes(T))}function xs(v,_,k,E){let T=typeof k==="boolean"?{enabled:k,failOnViolation:k}:k??{enabled:!1};if(!T.enabled)return;let j=h(v,_,E,JSON.stringify(T)),B=ql.get(j);if(B!==void 0){if(B&&T.failOnViolation)throw Error(B);return}let z=T.allowPatterns??[],F=Uw(v),V=[],H=s(v.replace(/\{\{--[\s\S]*?--\}\}/g,(re)=>re.replace(/[^\n]/g," ")));for(let{pattern:re,message:se,suggestion:ie}of Fw){if(z.some((ue)=>/\w/.test(ue)&&se.includes(ue)))continue;re.lastIndex=0;let ae=H.match(re);if(ae&&ae.length>0){let ue=H.split(`
2011
2011
  `),oe=v.split(`
2012
- `),me=[];if(ue.forEach((Re,Ee)=>{if(re.lastIndex=0,re.test(Re)&&!Hw(F,Ee+1,se))me.push(Ee+1)}),me.length===0&&ue.some((Re)=>(re.lastIndex=0,re.test(Re))))continue;let we=me.length>0?` (script line${me.length>1?"s":""} ${me.join(", ")})`:"",$e=me.slice(0,3).map((Re)=>` ${Re} | ${(oe[Re-1]??"").trim().slice(0,100)}`).join(`
2012
+ `),me=[];if(ue.forEach((Re,Ee)=>{if(re.lastIndex=0,re.test(Re)&&!Hw(F,Ee+1,se))me.push(Ee+1)}),me.length===0&&ue.some((Re)=>(re.lastIndex=0,re.test(Re))))continue;let ve=me.length>0?` (script line${me.length>1?"s":""} ${me.join(", ")})`:"",$e=me.slice(0,3).map((Re)=>` ${Re} | ${(oe[Re-1]??"").trim().slice(0,100)}`).join(`
2013
2013
  `),_e=$e?`
2014
- ${$e}`:"";V.push(` \u2717 ${se}${we}
2014
+ ${$e}`:"";V.push(` \u2717 ${se}${ve}
2015
2015
  \u2192 ${ie}${_e}`)}}if(V.length===0){ql.set(j,"");return}let G=(re)=>{let se=`${process.cwd()}/`;return re.startsWith(se)?re.slice(se.length):re},ne=`[STX] DOM API violation in ${E&&E!==_?`${G(E)} (composed into ${G(_)})`:G(_)}:
2016
2016
  ${V.join(`
2017
2017
  `)}
2018
2018
  Tip: prefer useRef(), navigate(), and composables for component code`;if(ql.set(j,ne),T.failOnViolation)throw Error(ne);else console.warn(ne)}import Kl from"path";var qw=/(\bfrom\s*|\bimport\s*\(\s*|\bimport\s+)(['"])(\.\.?\/[^'"]*)\2/g,Kw=/(<script\b[^>]*>)([\s\S]*?)(<\/script>)/gi;function Xw(v,_){if(!_||!v.includes("/"))return v;let k=Kl.dirname(_);return v.replace(qw,(E,T,j,B)=>{let z=Kl.resolve(k,B);return`${T}${j}${z.split(Kl.sep).join("/")}${j}`})}function gm(v,_){if(!_||!v.includes("<script"))return v;return v.replace(Kw,(k,E,T,j)=>`${E}${Xw(T,_)}${j}`)}var Lr="<!--PARENT_CONTENT_PLACEHOLDER-->";function mm(v){return v.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Sm(v,_){let k=v.length,E=_,T=!0,j=[],B=(z)=>z+9<=k&&v[z]==="<"&&v[z+1]==="/"&&(v[z+2]==="s"||v[z+2]==="S")&&(v[z+3]==="c"||v[z+3]==="C")&&(v[z+4]==="r"||v[z+4]==="R")&&(v[z+5]==="i"||v[z+5]==="I")&&(v[z+6]==="p"||v[z+6]==="P")&&(v[z+7]==="t"||v[z+7]==="T")&&(v[z+8]===">"||/\s/.test(v[z+8]));while(E<k){let z=v[E];if(B(E))return E;if(z==="/"&&v[E+1]==="/"){if(E=v.indexOf(`
2019
2019
  `,E+2),E===-1)return-1;E+=1,T=!0;continue}if(z==="/"&&v[E+1]==="*"){let F=v.indexOf("*/",E+2);if(F===-1)return-1;E=F+2,T=!0;continue}if(z==="/"&&T){let F=E+1,V=!1;while(F<k){let H=v[F];if(H==="\\"){F+=2;continue}if(H==="[")V=!0;else if(H==="]")V=!1;else if(H==="/"&&!V){F++;break}else if(H===`
2020
2020
  `){F=-1;break}F++}if(F===-1){E++,T=!1;continue}while(F<k&&/[a-z]/.test(v[F]))F++;E=F,T=!1;continue}if(z==="'"||z==='"'){let F=z;E++;while(E<k){if(v[E]==="\\"){E+=2;continue}if(v[E]===F){E++;break}if(v[E]===`
2021
- `)break;E++}T=!1;continue}if(z==="`"){E++;while(E<k){if(v[E]==="\\"){E+=2;continue}if(v[E]==="`"){E++;break}if(v[E]==="$"&&v[E+1]==="{"){j.push(!0),E+=2,T=!0;break}E++}if(j.length===0)T=!1;continue}if(z==="}"&&j.length>0){j.pop(),E++;while(E<k){if(v[E]==="\\"){E+=2;continue}if(v[E]==="`"){E++,T=!1;break}if(v[E]==="$"&&v[E+1]==="{"){j.push(!0),E+=2,T=!0;break}E++}continue}if(/\s/.test(z));else if(/[)\].\w$]/.test(z))T=!1;else T=!0;E++}return-1}function $m(v,_){let k=_.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),E=new RegExp(`<script\\b(?=[^>]*\\b${k}(?:\\s|=|/?>))[^>]*>`,"i").exec(v);if(!E)return null;let T=E.index+E[0].length,j=v.indexOf("</script>",T);if(j===-1)return null;let B=v.indexOf(">",j);if(B===-1)return null;return{start:E.index,end:B+1}}var Gw=4096;async function hm(v,_,k){if(k.buildMode!=="serve"||_.length<Gw)return null;let{registerServeModuleBundle:E}=await import("./chunk-1r3fmmy8.js");return`<script ${v} src="${E(_)}"></script>`}async function ym(v,_,k){try{let{registeredModuleIdsIn:E,buildModuleRegistryScript:T}=await mt("stx/client-module-registry",()=>import("./chunk-4mmd282p.js")),j=[],B=await T(E(...v),{minify:_.buildMode==="compile",collectInputs:j});for(let z of j)k?.add(z);if(!B)return null;if(_.buildMode==="serve"){let{registerServeModuleBundle:z}=await import("./chunk-1r3fmmy8.js");return`<script data-stx-scoped data-stx-run="always" data-stx-modules src="${z(B)}"></script>`}return`<script data-stx-scoped data-stx-run="always" data-stx-modules>${B.replace(/<\/script/gi,"<\\/script")}</script>`}catch{return null}}function Jw(v,_=""){let k=$m(v,"data-stx-runtime");if(!k)return v;let E=ji(v);if(E===-1||E===k.start){if(!_)return v;return v.slice(0,k.end)+_+v.slice(k.end)}if(E<k.start)return v.slice(0,E)+v.slice(k.start,k.end)+_+`
2021
+ `)break;E++}T=!1;continue}if(z==="`"){E++;while(E<k){if(v[E]==="\\"){E+=2;continue}if(v[E]==="`"){E++;break}if(v[E]==="$"&&v[E+1]==="{"){j.push(!0),E+=2,T=!0;break}E++}if(j.length===0)T=!1;continue}if(z==="}"&&j.length>0){j.pop(),E++;while(E<k){if(v[E]==="\\"){E+=2;continue}if(v[E]==="`"){E++,T=!1;break}if(v[E]==="$"&&v[E+1]==="{"){j.push(!0),E+=2,T=!0;break}E++}continue}if(/\s/.test(z));else if(/[)\].\w$]/.test(z))T=!1;else T=!0;E++}return-1}function $m(v,_){let k=_.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),E=new RegExp(`<script\\b(?=[^>]*\\b${k}(?:\\s|=|/?>))[^>]*>`,"i").exec(v);if(!E)return null;let T=E.index+E[0].length,j=v.indexOf("</script>",T);if(j===-1)return null;let B=v.indexOf(">",j);if(B===-1)return null;return{start:E.index,end:B+1}}var Gw=4096;async function hm(v,_,k){if(k.buildMode!=="serve"||_.length<Gw)return null;let{registerServeModuleBundle:E}=await import("./chunk-7smpjzzh.js");return`<script ${v} src="${E(_)}"></script>`}async function ym(v,_,k){try{let{registeredModuleIdsIn:E,buildModuleRegistryScript:T}=await mt("stx/client-module-registry",()=>import("./chunk-vdzhw78w.js")),j=[],B=await T(E(...v),{minify:_.buildMode==="compile",collectInputs:j});for(let z of j)k?.add(z);if(!B)return null;if(_.buildMode==="serve"){let{registerServeModuleBundle:z}=await import("./chunk-7smpjzzh.js");return`<script data-stx-scoped data-stx-run="always" data-stx-modules src="${z(B)}"></script>`}return`<script data-stx-scoped data-stx-run="always" data-stx-modules>${B.replace(/<\/script/gi,"<\\/script")}</script>`}catch{return null}}function Jw(v,_=""){let k=$m(v,"data-stx-runtime");if(!k)return v;let E=ji(v);if(E===-1||E===k.start){if(!_)return v;return v.slice(0,k.end)+_+v.slice(k.end)}if(E<k.start)return v.slice(0,E)+v.slice(k.start,k.end)+_+`
2022
2022
  `+v.slice(E,k.start)+v.slice(k.end);let T=v.slice(k.start,k.end),j=v.slice(0,k.start)+v.slice(k.end),B=ji(j);if(B===-1)return T+_+`
2023
2023
  `+j;return j.slice(0,B)+T+_+`
2024
- `+j.slice(B)}function Yw(v){let _=/\x00STX_ESC_MUSTACHE_OPEN\x00([\s\S]*?)\x00STX_ESC_MUSTACHE_CLOSE\x00/g;return v.replace(_,(k,E,T)=>{let j=v.slice(0,T);return j.lastIndexOf("<")>j.lastIndexOf(">")?`{{${E}}}`:`{<!--stx-literal-->{${E}}}`})}async function n(v,_,k,E,T){if(E.ssr===!1&&!E.autoShell&&E.buildMode==="spa")return v;if(_.__stx_signals_gate===void 0)_.__stx_signals_gate=ye(v,k);let j=!_.__stxProcessingDepth;an(_);for(let B of E._layerGraph?.configDependencies??[])T.add(B);if(j&&E.runtimeConfig)await dn(_,k,E.runtimeConfig);if(j)Qu(_),_.__stx_scope_seq??={n:0,key:Bun.hash(String(_.__filename??k)).toString(36).slice(0,6)},_.__stx_head_injections=Ps(),_.__stx_seo_staged=!1;if(!_.__stxProcessingDepth)_.__stxProcessingDepth=0;if(_.__stxProcessingDepth++,!_.__onceStore)_.__onceStore=new Set;if((E.debug||!ge()&&!vn())&&k&&k.endsWith(".stx"))Hs(v,k);try{return await U.timeAsync("template-processing",async()=>{let B=await Qw(v,_,k,E,T);if(j)B=Hl(B);if(j&&E.autoShell&&E.buildMode!=="compile"){let z=pe(E.app?.head,{known:hn,source:"app.head"}),V=(_.__stx_runtime_head||null)??Ds(),H=(_.__stx_head_raw||"").trim(),G,J=H.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(J)G=J[1].trim(),H=H.replace(J[0],"").trim();let ne=_.__sections?.title,re=V.title||G||ne,se=!V.title&&(!!G||!!ne),ie=V.meta||[],ae=new Set(ie.map((_e)=>xe(_e)).filter(Boolean)),ue={...z,...re&&{title:re},meta:[...(z.meta||[]).filter((_e)=>!ae.has(xe(_e))),...ie],link:[...z.link||[],...V.link||[]],script:[...z.script||[],...V.script||[]],headRaw:[z.headRaw,H].filter(Boolean).join(`
2025
- `),...V.htmlAttrs&&{htmlAttrs:Ti(z.htmlAttrs,V.htmlAttrs)},...V.bodyAttrs&&{bodyAttrs:{...z.bodyAttrs||{},...V.bodyAttrs}}},oe=Is(B);if(B=gn(B,ue,{...se&&{titleIsHtml:!0},...E.app?.colorMode&&{colorMode:E.app.colorMode}},oe),oe)B=Ri(B,z),B=fn(B,ue.htmlAttrs);let me=B.match(/<!-- stx-layout: ([^ ]+) -->/);if(me&&B.includes("<head")){let _e=me[1],Re=pr(_e);B=B.replace(/<head\b[^>]*>/i,(Ee)=>`${Ee}
2024
+ `+j.slice(B)}function Yw(v){let _=/\x00STX_ESC_MUSTACHE_OPEN\x00([\s\S]*?)\x00STX_ESC_MUSTACHE_CLOSE\x00/g;return v.replace(_,(k,E,T)=>{let j=v.slice(0,T);return j.lastIndexOf("<")>j.lastIndexOf(">")?`{{${E}}}`:`{<!--stx-literal-->{${E}}}`})}async function n(v,_,k,E,T){if(E.ssr===!1&&!E.autoShell&&E.buildMode==="spa")return v;if(_.__stx_signals_gate===void 0)_.__stx_signals_gate=ye(v,k);let j=!_.__stxProcessingDepth;an(_);for(let B of E._layerGraph?.configDependencies??[])T.add(B);if(j&&E.runtimeConfig)await dn(_,k,E.runtimeConfig);if(j)Qu(_),_.__stx_scope_seq??={n:0,key:Bun.hash(String(_.__filename??k)).toString(36).slice(0,6)},_.__stx_head_injections=Ps(),_.__stx_seo_staged=!1;if(!_.__stxProcessingDepth)_.__stxProcessingDepth=0;if(_.__stxProcessingDepth++,!_.__onceStore)_.__onceStore=new Set;if((E.debug||!ge()&&!wn())&&k&&k.endsWith(".stx"))Hs(v,k);try{return await U.timeAsync("template-processing",async()=>{let B=await Qw(v,_,k,E,T);if(j)B=Hl(B);if(j&&E.autoShell&&E.buildMode!=="compile"){let z=pe(E.app?.head,{known:hn,source:"app.head"}),V=(_.__stx_runtime_head||null)??Ds(),H=(_.__stx_head_raw||"").trim(),G,J=H.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(J)G=J[1].trim(),H=H.replace(J[0],"").trim();let ne=_.__sections?.title,re=V.title||G||ne,se=!V.title&&(!!G||!!ne),ie=V.meta||[],ae=new Set(ie.map((_e)=>xe(_e)).filter(Boolean)),ue={...z,...re&&{title:re},meta:[...(z.meta||[]).filter((_e)=>!ae.has(xe(_e))),...ie],link:[...z.link||[],...V.link||[]],script:[...z.script||[],...V.script||[]],headRaw:[z.headRaw,H].filter(Boolean).join(`
2025
+ `),...V.htmlAttrs&&{htmlAttrs:_i(z.htmlAttrs,V.htmlAttrs)},...V.bodyAttrs&&{bodyAttrs:{...z.bodyAttrs||{},...V.bodyAttrs}}},oe=Is(B);if(B=gn(B,ue,{...se&&{titleIsHtml:!0},...E.app?.colorMode&&{colorMode:E.app.colorMode}},oe),oe)B=Ri(B,z),B=fn(B,ue.htmlAttrs);let me=B.match(/<!-- stx-layout: ([^ ]+) -->/);if(me&&B.includes("<head")){let _e=me[1],Re=pr(_e);B=B.replace(/<head\b[^>]*>/i,(Ee)=>`${Ee}
2026
2026
  <meta name="stx-layout" content="${mm(_e)}">
2027
- <meta name="stx-layout-group" content="${mm(Re)}">`)}let we=B.match(/function (__stx_setup_\w+)\(/),$e=we?Nn(B):null;if(we&&$e&&!/\bdata-stx=/.test($e.tag)){B=Bs(B,(Re,Ee)=>`<body${Ee} data-stx="${we[1]}">`);let _e=new RegExp(`(<(?!body)[a-zA-Z][^>]*) data-stx="${we[1]}"`,"i");B=B.replace(_e,"$1")}}if(j){let z=_.__stx_head_injections??Ps(),F=_i(B);if(F!==null)z.beforeClose.push(F);let V=Mg(B);if(V!==null)z.afterOpen.push(V);if(E.offline?.enabled&&!B.includes("data-stx-offline"))z.beforeClose.push(Ng);B=Ei(B,z);let H=E.app?.colorMode;if(H)B=pn(B,H)}if(j)if($m(B,"data-stx-runtime")){let F=null,V=null,H=null,G=null,J=null;try{let{getStoreScript:re}=await mt("stx/store-loader",()=>import("./chunk-abxnep18.js")),se=E.storesDir,ie=await re(se);if(ie)H=`<script data-stx-stores>${ie}</script>`,V=await hm("data-stx-stores",ie,E)??H}catch{}F=await ym([B,H],E,T);try{let{getFrameworkComposableScript:re}=await mt("stx/framework-composables",()=>import("./chunk-k14e9k4h.js"));J=await re(B)}catch{}try{let{getComposableScript:re}=await mt("stx/composable-loader",()=>import("./chunk-rfqsgs51.js")),se=E.composablesDir,ie=[F,H,J].filter((ue)=>ue!==null),ae=await re(E._layerComposableDirs??se,B,ie);if(ae)G=await hm('data-stx-scoped data-stx-run="always" data-stx-composables',ae,E)??`<script data-stx-scoped data-stx-run="always" data-stx-composables>${ae}</script>`}catch{}let ne=[F,V,G,J].filter((re)=>re!==null).map((re)=>`
2027
+ <meta name="stx-layout-group" content="${mm(Re)}">`)}let ve=B.match(/function (__stx_setup_\w+)\(/),$e=ve?Nn(B):null;if(ve&&$e&&!/\bdata-stx=/.test($e.tag)){B=Bs(B,(Re,Ee)=>`<body${Ee} data-stx="${ve[1]}">`);let _e=new RegExp(`(<(?!body)[a-zA-Z][^>]*) data-stx="${ve[1]}"`,"i");B=B.replace(_e,"$1")}}if(j){let z=_.__stx_head_injections??Ps(),F=Ti(B);if(F!==null)z.beforeClose.push(F);let V=Mg(B);if(V!==null)z.afterOpen.push(V);if(E.offline?.enabled&&!B.includes("data-stx-offline"))z.beforeClose.push(Ng);B=Ei(B,z);let H=E.app?.colorMode;if(H)B=pn(B,H)}if(j)if($m(B,"data-stx-runtime")){let F=null,V=null,H=null,G=null,J=null;try{let{getStoreScript:re}=await mt("stx/store-loader",()=>import("./chunk-xqgzwexs.js")),se=E.storesDir,ie=await re(se);if(ie)H=`<script data-stx-stores>${ie}</script>`,V=await hm("data-stx-stores",ie,E)??H}catch{}F=await ym([B,H],E,T);try{let{getFrameworkComposableScript:re}=await mt("stx/framework-composables",()=>import("./chunk-jf59xwba.js"));J=await re(B)}catch{}try{let{getComposableScript:re}=await mt("stx/composable-loader",()=>import("./chunk-1wbmg22q.js")),se=E.composablesDir,ie=[F,H,J].filter((ue)=>ue!==null),ae=await re(E._layerComposableDirs??se,B,ie);if(ae)G=await hm('data-stx-scoped data-stx-run="always" data-stx-composables',ae,E)??`<script data-stx-scoped data-stx-run="always" data-stx-composables>${ae}</script>`}catch{}let ne=[F,V,G,J].filter((re)=>re!==null).map((re)=>`
2028
2028
  ${re}`).join("");B=Jw(B,ne)}else{let F=await ym([B],E,T);if(F){let V=B.search(/<script\b[^>]*>(?:(?!<\/script>)[\s\S])*?__stxModules\[/i);if(V!==-1)B=B.slice(0,V)+F+`
2029
- `+B.slice(V)}}if(j)B=$i(B);if(j&&_.__stx_inject_css!==!1)B=await f(B,void 0,E.buildMode==="serve",!0);else if(j)B=ki(B);if(B=B.replace(/\x00STX_ESCAPED_AT\x00/g,"@"),B=Yw(B),j&&_.__stx_runtime_config)B=Xe(B,_.__stx_runtime_config);if(j&&!_.__stx_defer_server_data){let z=Kn(_);if(z){let F=/<head\b[^>]*>/i.exec(B),V=F?F.index+F[0].length:0;B=B.slice(0,V)+z+B.slice(V)}}return B})}catch(B){if(B instanceof ir)throw B;let z=B instanceof Error?B.message:String(B),F=new X(`Template processing failed: ${z}`,k,void 0,void 0,v.substring(0,200)+(v.length>200?"...":""));if(P.log(F,{filePath:k,context:_}),Rt.logDetailedError(F,{filePath:k,template:v.substring(0,500)}),E.debug)throw F;return Os.createFallbackContent("Template Processing",F)}}async function Qw(v,_,k,E,T){let j=process.cwd(),B={...E,partialsDir:E.partialsDir&&!Yt.isAbsolute(E.partialsDir)?Yt.resolve(j,E.partialsDir):E.partialsDir,componentsDir:E.componentsDir&&!Yt.isAbsolute(E.componentsDir)?Yt.resolve(j,E.componentsDir):E.componentsDir,layoutsDir:E.layoutsDir&&!Yt.isAbsolute(E.layoutsDir)?Yt.resolve(j,E.layoutsDir):E.layoutsDir},z=B,F=v;await nS(k,_),tS(_,z),F=await te(()=>kg(F,_,k,z),F,(we)=>{P.log(we,{filePath:k,phase:"pre-processing-middleware"},"warning"),console.warn(`[stx] pre-processing middleware failed for ${k}: ${we.message}`)}),F=F.replace(/\{\{--[\s\S]*?--\}\}/g,"");let V=Pn(F,je,(we,$e)=>`\x00STX_HTML_COMMENT_${$e}\x00`);F=V.output;let H=V.tokens,G=(we)=>H.length===0?we:we.replace(/\x00STX_HTML_COMMENT_(\d+)\x00/g,($e,_e)=>H[Number(_e)]??""),J="\x00STX_ESCAPED_AT\x00",ne="\x00STX_ESC_MUSTACHE_OPEN\x00",re="\x00STX_ESC_MUSTACHE_CLOSE\x00";F=F.replace(/@@/g,J),F=F.replace(/@\{\{([\s\S]*?)\}\}/g,(we,$e)=>`${ne}${$e}${re}`),F=Tg(F),F=await rm(F,k,T);let se={};F=hs(F,se);let ie={..._.__sections||{}},ae="",ue=Df(Be(v)),oe=/@nolayout\b/.test(F)||ue===!1;if(/@nolayout\b/.test(F))F=F.replace(/@nolayout\b\s*/g,"");let me=F.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(me)ae=me[1],F=F.replace(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/g,"");else if(typeof ue==="string"){if(ae=ue,!/@section\s*\(/.test(F))F=`@section('content')
2029
+ `+B.slice(V)}}if(j)B=$i(B);if(j&&_.__stx_inject_css!==!1)B=await f(B,void 0,E.buildMode==="serve",!0);else if(j)B=ki(B);if(B=B.replace(/\x00STX_ESCAPED_AT\x00/g,"@"),B=Yw(B),j&&_.__stx_runtime_config)B=Xe(B,_.__stx_runtime_config);if(j&&!_.__stx_defer_server_data){let z=Kn(_);if(z){let F=/<head\b[^>]*>/i.exec(B),V=F?F.index+F[0].length:0;B=B.slice(0,V)+z+B.slice(V)}}return B})}catch(B){if(B instanceof ir)throw B;let z=B instanceof Error?B.message:String(B),F=new X(`Template processing failed: ${z}`,k,void 0,void 0,v.substring(0,200)+(v.length>200?"...":""));if(P.log(F,{filePath:k,context:_}),Rt.logDetailedError(F,{filePath:k,template:v.substring(0,500)}),E.debug)throw F;return Os.createFallbackContent("Template Processing",F)}}async function Qw(v,_,k,E,T){let j=process.cwd(),B={...E,partialsDir:E.partialsDir&&!Yt.isAbsolute(E.partialsDir)?Yt.resolve(j,E.partialsDir):E.partialsDir,componentsDir:E.componentsDir&&!Yt.isAbsolute(E.componentsDir)?Yt.resolve(j,E.componentsDir):E.componentsDir,layoutsDir:E.layoutsDir&&!Yt.isAbsolute(E.layoutsDir)?Yt.resolve(j,E.layoutsDir):E.layoutsDir},z=B,F=v;await nS(k,_),tS(_,z),F=await te(()=>kg(F,_,k,z),F,(ve)=>{P.log(ve,{filePath:k,phase:"pre-processing-middleware"},"warning"),console.warn(`[stx] pre-processing middleware failed for ${k}: ${ve.message}`)}),F=F.replace(/\{\{--[\s\S]*?--\}\}/g,"");let V=Pn(F,je,(ve,$e)=>`\x00STX_HTML_COMMENT_${$e}\x00`);F=V.output;let H=V.tokens,G=(ve)=>H.length===0?ve:ve.replace(/\x00STX_HTML_COMMENT_(\d+)\x00/g,($e,_e)=>H[Number(_e)]??""),J="\x00STX_ESCAPED_AT\x00",ne="\x00STX_ESC_MUSTACHE_OPEN\x00",re="\x00STX_ESC_MUSTACHE_CLOSE\x00";F=F.replace(/@@/g,J),F=F.replace(/@\{\{([\s\S]*?)\}\}/g,(ve,$e)=>`${ne}${$e}${re}`),F=Tg(F),F=await rm(F,k,T);let se={};F=hs(F,se);let ie={..._.__sections||{}},ae="",ue=Df(Be(v)),oe=/@nolayout\b/.test(F)||ue===!1;if(/@nolayout\b/.test(F))F=F.replace(/@nolayout\b\s*/g,"");let me=F.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(me)ae=me[1],F=F.replace(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/g,"");else if(typeof ue==="string"){if(ae=ue,!/@section\s*\(/.test(F))F=`@section('content')
2030
2030
  ${F.trim()}
2031
- @endsection`}if(!ae&&!oe&&z.defaultLayout){let we=_t(F),$e=/@section\s*\(/.test(F);if(!we||$e){let _e="",Re=Yt.dirname(k),Ee=z.layoutsDir?Yt.dirname(z.layoutsDir):process.cwd();for(let Ae=0;Ae<20;Ae++){let Te=Yt.join(Re,"_layout.stx");if(await r(Te)){_e=Te;break}let ke=Yt.dirname(Re);if(ke===Re||ke.length<Ee.length)break;Re=ke}if(_e)ae=_e;else if(z.layoutsDir){let Ae=Yt.isAbsolute(z.layoutsDir)?z.layoutsDir:Yt.resolve(process.cwd(),z.layoutsDir),Te=Yt.join(Ae,`${z.defaultLayout}.stx`);if(await r(Te))ae=Te}if(ae&&!$e)F=`@section('content')
2031
+ @endsection`}if(!ae&&!oe&&z.defaultLayout){let ve=Tt(F),$e=/@section\s*\(/.test(F);if(!ve||$e){let _e="",Re=Yt.dirname(k),Ee=z.layoutsDir?Yt.dirname(z.layoutsDir):process.cwd();for(let Ae=0;Ae<20;Ae++){let Te=Yt.join(Re,"_layout.stx");if(await r(Te)){_e=Te;break}let ke=Yt.dirname(Re);if(ke===Re||ke.length<Ee.length)break;Re=ke}if(_e)ae=_e;else if(z.layoutsDir){let Ae=Yt.isAbsolute(z.layoutsDir)?z.layoutsDir:Yt.resolve(process.cwd(),z.layoutsDir),Te=Yt.join(Ae,`${z.defaultLayout}.stx`);if(await r(Te))ae=Te}if(ae&&!$e)F=`@section('content')
2032
2032
  ${F.trim()}
2033
- @endsection`}}if(ae&&F.includes("<script")){let we=xn(F),$e=we.scripts.map((_e)=>xm(_e,k)??_e);F=Cs(we.output,$e)}if(F=F.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(we,$e,_e)=>(ie[$e]=_e,"")),F=F.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*([^)]+?)\s*\)/g,(we,$e,_e)=>{if(/^(['"]).*\1$/.test(_e.trim()))return we;try{let Re=c(_e.trim(),_);if(Re===void 0)return we;return ie[$e]=String(Re??""),""}catch{return we}}),F=F.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@endsection|@show)/g,(we,$e,_e)=>{if(_e.includes("@parent"))ie[$e]=_e.replace("@parent",Lr);else ie[$e]=_e.trim();return""}),_.__sections=ie,F=F.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"])?\)/g,(we,$e,_e)=>ie[$e]||_e||""),!("slot"in _)||_.slot===void 0)F=F.replace(/\{\{\s*slot\s*\}\}/g,()=>ie.content||"");if(F=ys(F,se),ae){let we=[],$e=xn(F),_e=Pn($e.output,Ss,(Re,Ee)=>`\x00STX_ORPHAN_STYLE_${Ee}\x00`);if(F=_e.output.replace(/\x00STX_(SCRIPT|ORPHAN_STYLE)_(\d+)\x00/g,(Re,Ee,Ae)=>{let Te=Ee==="SCRIPT"?xm($e.scripts[Number(Ae)],k):_e.tokens[Number(Ae)];if(Te)we.push(Te);return""}),we.length>0){let Re=we.join(`
2033
+ @endsection`}}if(ae&&F.includes("<script")){let ve=xn(F),$e=ve.scripts.map((_e)=>xm(_e,k)??_e);F=Cs(ve.output,$e)}if(F=F.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(ve,$e,_e)=>(ie[$e]=_e,"")),F=F.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*([^)]+?)\s*\)/g,(ve,$e,_e)=>{if(/^(['"]).*\1$/.test(_e.trim()))return ve;try{let Re=c(_e.trim(),_);if(Re===void 0)return ve;return ie[$e]=String(Re??""),""}catch{return ve}}),F=F.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@endsection|@show)/g,(ve,$e,_e)=>{if(_e.includes("@parent"))ie[$e]=_e.replace("@parent",Lr);else ie[$e]=_e.trim();return""}),_.__sections=ie,F=F.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"])?\)/g,(ve,$e,_e)=>ie[$e]||_e||""),!("slot"in _)||_.slot===void 0)F=F.replace(/\{\{\s*slot\s*\}\}/g,()=>ie.content||"");if(F=ys(F,se),ae){let ve=[],$e=xn(F),_e=Pn($e.output,Ss,(Re,Ee)=>`\x00STX_ORPHAN_STYLE_${Ee}\x00`);if(F=_e.output.replace(/\x00STX_(SCRIPT|ORPHAN_STYLE)_(\d+)\x00/g,(Re,Ee,Ae)=>{let Te=Ee==="SCRIPT"?xm($e.scripts[Number(Ae)],k):_e.tokens[Number(Ae)];if(Te)ve.push(Te);return""}),ve.length>0){let Re=ve.join(`
2034
2034
  `);ie.content=ie.content?`${ie.content}
2035
- ${Re}`:Re,_.__sections=ie}}if(ae)try{let we;if(Yt.isAbsolute(ae))we=ae,T.add(ae);else we=await te(()=>Gn(ae,k,B,T),null,()=>{throw new X(`Failed to resolve layout path: ${ae}`,k,void 0,void 0,`Layout referenced from ${k}`)});if(!we){let Te=(Ge)=>{if(!Ge)return[];try{let De=Yt.isAbsolute(Ge)?Ge:Yt.resolve(process.cwd(),Ge);return Zw.readdirSync(De).filter((Ie)=>Ie.endsWith(".stx")).map((Ie)=>Ie.replace(/\.stx$/,""))}catch{return[]}},ke=[...Te(B.layoutsDir),...Te(B.fallbackLayoutsDir)].filter((Ge,De,Ie)=>Ie.indexOf(Ge)===De).sort(),Pe=`Layout not found: ${ae} (referenced from ${k})`+(ke.length>0?`. Available layouts: ${ke.join(", ")}`:B.layoutsDir?`. No .stx layouts found in ${B.layoutsDir}`:"");if(P.log(Error(Pe),{layoutPath:ae,filePath:k,available:ke},"error"),console.error(`[stx] ${Pe}`),B.debug)throw new X(Pe,k);return F}let $e=await te(()=>Bun.file(we).text(),"",()=>{throw new X(`Failed to read layout file: ${we}`,k,void 0,void 0,"Layout content could not be loaded")});$e=gm($e,we);let _e=$e.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(_e){if(B.debug)console.log(`Found nested layout: ${_e[1]} in ${we}`);let Te={},ke=$e.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(De,Ie,Ye)=>(Te[Ie]=Ye.trim(),""));for(let[De,Ie]of Object.entries(Te))if(ie[De]&&ie[De].includes(Lr)){let Ye=ie[De].indexOf(Lr);ie[De]=ie[De].slice(0,Ye)+Ie+ie[De].slice(Ye+Lr.length)}else if(!ie[De])ie[De]=Ie;let Pe={..._,__sections:ie},Ge=`@layout('${_e[1]}')${ke}`;return await n(Ge,Pe,we,B,T)}let Re=$e.replace(/\{\{--[\s\S]*?--\}\}/g,""),Ee=hs(Re,se),Ae={};return Ee=Ee.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(Te,ke,Pe)=>(Ae[ke]=Pe.trim(),`@slot('${ke}')`)),Ee=Ee.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(Te,ke,Pe)=>{if(ie[ke]){let Ge=ie[ke];if(Ge.includes(Lr)){let De=Ae[ke]||"",Ie=Ge.indexOf(Lr);Ge=Ge.slice(0,Ie)+De+Ge.slice(Ie+Lr.length)}return Ge}return Pe||""}),Ee=eS(Ee,ie),Ee=Ee.replace(/\{\{\s*slot\s*\}\}/g,()=>ie.content||""),Ee=ys(Ee,se),_.__originalFilePath=k,F=await wm(Ee,_,we,B,T),F=`<!-- stx-layout: ${ae} -->
2036
- ${F}`,G(F)}catch(we){return P.log(we instanceof Error?we:Error(String(we)),{layoutPath:ae,filePath:k},"error"),`[Error processing layout: ${we instanceof Error?we.message:String(we)}]`}return G(await wm(F,_,k,B,T))}function eS(v,_){return v.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(k,E,T)=>{let j=_[E];if(j!==void 0){if(!new RegExp(`@(?:yield|slot)\\(\\s*['"]${E.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(j))return j}return T||""})}function tS(v,_){if(v.__stx_sfc_mode=!0,v.__stx_options=_,_.buildMode)v.__stx_buildMode=_.buildMode;let k=_.envPrefix||"STX_PUBLIC_",E={};for(let[T,j]of Object.entries(process.env))if(T.startsWith(k)&&j!==void 0)E[T]=j;v.$env=E}async function nS(v,_){await te(()=>Rg(v,_),void 0,(k)=>{P.log(k,{filePath:v,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${v}: ${k.message}`)})}var Xl="data-stx-source";function xm(v,_){if(!v)return v;let k=/^<script\b([^>]*)>/i.exec(v);if(!k||!/\bserver\b/.test(k[1])||k[1].includes(Xl))return v;return`<script ${Xl}="${encodeURIComponent(_)}"${v.slice(7)}`}function rS(v){let _=new RegExp(`${Xl}="([^"]*)"`).exec(v);return _?decodeURIComponent(_[1]):void 0}function bm(v){return v.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function vm(v,_,k){return`<div data-stx-server-script-error role="alert" style="padding:12px 14px;border:1px solid #f0b4b4;border-left-width:4px;background:#fff5f5;color:#7a1f1f;font:13px/1.5 ui-monospace,SFMono-Regular,Menlo,monospace"><strong style="display:block;margin-bottom:4px">stx: a &lt;script server&gt; ${_==="module-resolution"?"imports a module that does not resolve":_==="syntax"?"does not parse":"names something that does not exist"}, so this component rendered nothing.</strong><span style="display:block;opacity:.85">${bm(v)}</span><span style="display:block;margin-top:4px">${bm(k)}</span></div>`}async function sS(v,_,k,E){let{scanScriptTags:T}=await mt("stx/signal-processing",()=>import("./chunk-tv2xr7s3.js")),j=[],B=!ge()&&!vn();for(let F of T(v)){let V=F.attrs;if(!/\bserver\b/.test(V))continue;let H=F.start+F.fullMatch.indexOf(">")+1,G=Sm(v,H);if(G===-1)continue;let J=v.slice(H,G);if(!J.trim())continue;let ne=rS(V)??k,re={index:F.start,length:G+9-F.start};try{let{extractVariables:se}=await mt("stx/variable-extractor",()=>import("./chunk-vgkjmrf3.js"));await se(J,_,ne,{preserveExisting:!0,onFailure:(ie)=>{if(ie.kind==="unknown")return;if(E?.onServerScriptError?.({sourcePath:ne,kind:ie.kind,message:ie.message}),!B)return;j.push({...re,markup:vm(ne,ie.kind,ie.message)})}})}catch(se){let ie=se instanceof Error?se:Error(String(se));if(P.log(ie,{filePath:ne,phase:"server-script-extraction"},"warning"),console.warn(`[stx] server <script> extraction failed in ${ne}: ${ie.message}`),B)j.push({...re,markup:vm(ne,"unknown",ie.message)})}}if(j.length===0)return v;let z=v;for(let F of j.sort((V,H)=>H.index-V.index))z=z.slice(0,F.index)+F.markup+z.slice(F.index+F.length);return z}async function iS(v,_,k){try{let{interpolateScriptsInTemplate:E}=await mt("stx/expressions",()=>import("./chunk-x2ghjgxm.js"));return E(v,_,{skipServer:!0})}catch(E){let T=E instanceof Error?E:Error(String(E));return P.log(T,{filePath:k,phase:"script-expression-interpolation"},"warning"),console.warn(`[stx] script expression interpolation failed in ${k}: ${T.message}`),v}}async function wm(v,_,k,E,T){let j=v,B=E;if(j=await sS(j,_,k,E),j=await iS(j,_,k),j=await pg(j,_,k),j=await gg(j,_,k),j=await Xf(j,_,k,B),ye(j))j=si(j,_),j=us(j,_),j=ds(j,_);j=oi(j);let{processStreamDirectives:z}=await mt("stx/streaming",()=>import("./chunk-5tvxv2v1.js"));j=z(j,_),j=di(j,_,k,B,!0),j=await Og(j,_,k,B,T),j=await as(j,_,k,B,T),j=Su(j,_,k,B);let{processDeferDirectives:F}=await mt("stx/defer",()=>import("./chunk-p5pna1sn.js"));j=F(j,_,k);let{processTeleportDirectives:V}=await mt("stx/teleport",()=>import("./chunk-avq5209p.js"));j=V(j,_,k);let{processTransitionDirectives:H,processTransitionAttributes:G}=await mt("stx/transitions",()=>import("./chunk-njpxfd44.js"));j=H(j,_,k),j=G(j);let{processErrorBoundaryDirectives:J,stripRenderFailedMarkers:ne}=await mt("stx/error-boundaries",()=>import("./chunk-h85hrwkq.js"));j=J(j,_,k),j=ne(j);let{processSuspenseDirectives:re}=await mt("stx/suspense",()=>import("./chunk-gty89j8s.js"));j=re(j,_,k);let{processAsyncDirectives:se}=await mt("stx/async-components",()=>import("./chunk-kxvtyh05.js"));j=se(j,_,k);let{processKeepAliveDirectives:ie}=await mt("stx/keep-alive",()=>import("./chunk-j7nd8zfe.js"));j=ie(j,_,k);let{processVirtualListDirectives:ae,processVirtualGridDirectives:ue,processInfiniteListDirectives:oe}=await mt("stx/virtual-scrolling",()=>import("./chunk-t7djn7zd.js"));j=ae(j,_,k),j=ue(j,_,k),j=oe(j,_,k);let{processPartialHydrationDirectives:me,processStaticDirectives:we}=await mt("stx/partial-hydration",()=>import("./chunk-c2vwq6gr.js"));j=me(j,_,k),j=we(j);let{processComputedDirectives:$e,processWatchDirectives:_e}=await mt("stx/computed",()=>import("./chunk-1xdzcy9d.js"));j=$e(j,_,k),j=_e(j,_,k);let{processFormValidationDirectives:Re}=await mt("stx/forms-validation",()=>import("./chunk-tf239jvd.js"));j=Re(j,_,k);let{processHeadDirective:Ee,processTitleDirective:Ae,processMetaDirective:Te,resetHead:ke}=await mt("stx/head",()=>import("./chunk-pj562qnx.js"));if(!_.__stx_head_preset&&!_.__stx_runtime_head)ke();let Pe=Ee(j);if(j=Pe.content,Pe.headContent)_.__stx_head_raw=`${_.__stx_head_raw||""}${Pe.headContent}
2037
- `;if(j=Ae(j,_),j=Te(j,_,k),j=Cg(j),j=Zc(j,_),j=Kf(j),j=$g(j),j=await ms(j,_,k,B,T),j=await as(j,_,k,B,T),_.__stxProcessingDepth===1)j=ed(j,_);if(j=j.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/g,""),j=Hl(j),j=lr(j,_,k),j=gs(j),j=Of(j,_,{filePath:k,buildMode:B.buildMode}),j=Gc(j,_),j=Jc(j,_),j=Io(j,_),j=tp(j,_),j=np(j,_),j=await km(j,_,k,B),j=await _m(j,_,k),j=await mi(j,_,k,B),j=hi(j,_,k,B),j=$s(j,_,k,B),j=Ts(j,_,k),j=_s(j,_,k,B),j=Hf(j,_,k,B),j=vs(j,_),j=ws(j),j=am(j),!B.skipEventDirectives)j=Ou(j,_,k);if(j=jf(j,_,k),B.debug){let nt=/\bx-data\s*=/.test(j),ct=ls(v);if(nt&&ct)console.warn(`[stx] ${k}: Template mixes Alpine-style (x-data) and signals (state/derived/effect) reactivity.
2035
+ ${Re}`:Re,_.__sections=ie}}if(ae)try{let ve;if(Yt.isAbsolute(ae))ve=ae,T.add(ae);else ve=await te(()=>Gn(ae,k,B,T),null,()=>{throw new X(`Failed to resolve layout path: ${ae}`,k,void 0,void 0,`Layout referenced from ${k}`)});if(!ve){let Te=(Ge)=>{if(!Ge)return[];try{let De=Yt.isAbsolute(Ge)?Ge:Yt.resolve(process.cwd(),Ge);return Zw.readdirSync(De).filter((Ie)=>Ie.endsWith(".stx")).map((Ie)=>Ie.replace(/\.stx$/,""))}catch{return[]}},ke=[...Te(B.layoutsDir),...Te(B.fallbackLayoutsDir)].filter((Ge,De,Ie)=>Ie.indexOf(Ge)===De).sort(),Pe=`Layout not found: ${ae} (referenced from ${k})`+(ke.length>0?`. Available layouts: ${ke.join(", ")}`:B.layoutsDir?`. No .stx layouts found in ${B.layoutsDir}`:"");if(P.log(Error(Pe),{layoutPath:ae,filePath:k,available:ke},"error"),console.error(`[stx] ${Pe}`),B.debug)throw new X(Pe,k);return F}let $e=await te(()=>Bun.file(ve).text(),"",()=>{throw new X(`Failed to read layout file: ${ve}`,k,void 0,void 0,"Layout content could not be loaded")});$e=gm($e,ve);let _e=$e.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(_e){if(B.debug)console.log(`Found nested layout: ${_e[1]} in ${ve}`);let Te={},ke=$e.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(De,Ie,Ye)=>(Te[Ie]=Ye.trim(),""));for(let[De,Ie]of Object.entries(Te))if(ie[De]&&ie[De].includes(Lr)){let Ye=ie[De].indexOf(Lr);ie[De]=ie[De].slice(0,Ye)+Ie+ie[De].slice(Ye+Lr.length)}else if(!ie[De])ie[De]=Ie;let Pe={..._,__sections:ie},Ge=`@layout('${_e[1]}')${ke}`;return await n(Ge,Pe,ve,B,T)}let Re=$e.replace(/\{\{--[\s\S]*?--\}\}/g,""),Ee=hs(Re,se),Ae={};return Ee=Ee.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(Te,ke,Pe)=>(Ae[ke]=Pe.trim(),`@slot('${ke}')`)),Ee=Ee.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(Te,ke,Pe)=>{if(ie[ke]){let Ge=ie[ke];if(Ge.includes(Lr)){let De=Ae[ke]||"",Ie=Ge.indexOf(Lr);Ge=Ge.slice(0,Ie)+De+Ge.slice(Ie+Lr.length)}return Ge}return Pe||""}),Ee=eS(Ee,ie),Ee=Ee.replace(/\{\{\s*slot\s*\}\}/g,()=>ie.content||""),Ee=ys(Ee,se),_.__originalFilePath=k,F=await wm(Ee,_,ve,B,T),F=`<!-- stx-layout: ${ae} -->
2036
+ ${F}`,G(F)}catch(ve){return P.log(ve instanceof Error?ve:Error(String(ve)),{layoutPath:ae,filePath:k},"error"),`[Error processing layout: ${ve instanceof Error?ve.message:String(ve)}]`}return G(await wm(F,_,k,B,T))}function eS(v,_){return v.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(k,E,T)=>{let j=_[E];if(j!==void 0){if(!new RegExp(`@(?:yield|slot)\\(\\s*['"]${E.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(j))return j}return T||""})}function tS(v,_){if(v.__stx_sfc_mode=!0,v.__stx_options=_,_.buildMode)v.__stx_buildMode=_.buildMode;let k=_.envPrefix||"STX_PUBLIC_",E={};for(let[T,j]of Object.entries(process.env))if(T.startsWith(k)&&j!==void 0)E[T]=j;v.$env=E}async function nS(v,_){await te(()=>Rg(v,_),void 0,(k)=>{P.log(k,{filePath:v,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${v}: ${k.message}`)})}var Xl="data-stx-source";function xm(v,_){if(!v)return v;let k=/^<script\b([^>]*)>/i.exec(v);if(!k||!/\bserver\b/.test(k[1])||k[1].includes(Xl))return v;return`<script ${Xl}="${encodeURIComponent(_)}"${v.slice(7)}`}function rS(v){let _=new RegExp(`${Xl}="([^"]*)"`).exec(v);return _?decodeURIComponent(_[1]):void 0}function bm(v){return v.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function vm(v,_,k){return`<div data-stx-server-script-error role="alert" style="padding:12px 14px;border:1px solid #f0b4b4;border-left-width:4px;background:#fff5f5;color:#7a1f1f;font:13px/1.5 ui-monospace,SFMono-Regular,Menlo,monospace"><strong style="display:block;margin-bottom:4px">stx: a &lt;script server&gt; ${_==="module-resolution"?"imports a module that does not resolve":_==="syntax"?"does not parse":"names something that does not exist"}, so this component rendered nothing.</strong><span style="display:block;opacity:.85">${bm(v)}</span><span style="display:block;margin-top:4px">${bm(k)}</span></div>`}async function sS(v,_,k,E){let{scanScriptTags:T}=await mt("stx/signal-processing",()=>import("./chunk-dhrzmvbj.js")),j=[],B=!ge()&&!wn();for(let F of T(v)){let V=F.attrs;if(!/\bserver\b/.test(V))continue;let H=F.start+F.fullMatch.indexOf(">")+1,G=Sm(v,H);if(G===-1)continue;let J=v.slice(H,G);if(!J.trim())continue;let ne=rS(V)??k,re={index:F.start,length:G+9-F.start};try{let{extractVariables:se}=await mt("stx/variable-extractor",()=>import("./chunk-5pzhcesm.js"));await se(J,_,ne,{preserveExisting:!0,onFailure:(ie)=>{if(ie.kind==="unknown")return;if(E?.onServerScriptError?.({sourcePath:ne,kind:ie.kind,message:ie.message}),!B)return;j.push({...re,markup:vm(ne,ie.kind,ie.message)})}})}catch(se){let ie=se instanceof Error?se:Error(String(se));if(P.log(ie,{filePath:ne,phase:"server-script-extraction"},"warning"),console.warn(`[stx] server <script> extraction failed in ${ne}: ${ie.message}`),B)j.push({...re,markup:vm(ne,"unknown",ie.message)})}}if(j.length===0)return v;let z=v;for(let F of j.sort((V,H)=>H.index-V.index))z=z.slice(0,F.index)+F.markup+z.slice(F.index+F.length);return z}async function iS(v,_,k){try{let{interpolateScriptsInTemplate:E}=await mt("stx/expressions",()=>import("./chunk-qm8atahn.js"));return E(v,_,{skipServer:!0})}catch(E){let T=E instanceof Error?E:Error(String(E));return P.log(T,{filePath:k,phase:"script-expression-interpolation"},"warning"),console.warn(`[stx] script expression interpolation failed in ${k}: ${T.message}`),v}}async function wm(v,_,k,E,T){let j=v,B=E;if(j=await sS(j,_,k,E),j=await iS(j,_,k),j=await pg(j,_,k),j=await gg(j,_,k),j=await Xf(j,_,k,B),ye(j))j=si(j,_),j=us(j,_),j=ds(j,_);j=oi(j);let{processStreamDirectives:z}=await mt("stx/streaming",()=>import("./chunk-fp7dzqze.js"));j=z(j,_),j=di(j,_,k,B,!0),j=await Og(j,_,k,B,T),j=await as(j,_,k,B,T),j=Su(j,_,k,B);let{processDeferDirectives:F}=await mt("stx/defer",()=>import("./chunk-p5pna1sn.js"));j=F(j,_,k);let{processTeleportDirectives:V}=await mt("stx/teleport",()=>import("./chunk-avq5209p.js"));j=V(j,_,k);let{processTransitionDirectives:H,processTransitionAttributes:G}=await mt("stx/transitions",()=>import("./chunk-njpxfd44.js"));j=H(j,_,k),j=G(j);let{processErrorBoundaryDirectives:J,stripRenderFailedMarkers:ne}=await mt("stx/error-boundaries",()=>import("./chunk-h85hrwkq.js"));j=J(j,_,k),j=ne(j);let{processSuspenseDirectives:re}=await mt("stx/suspense",()=>import("./chunk-gty89j8s.js"));j=re(j,_,k);let{processAsyncDirectives:se}=await mt("stx/async-components",()=>import("./chunk-kxvtyh05.js"));j=se(j,_,k);let{processKeepAliveDirectives:ie}=await mt("stx/keep-alive",()=>import("./chunk-3kxh9rsp.js"));j=ie(j,_,k);let{processVirtualListDirectives:ae,processVirtualGridDirectives:ue,processInfiniteListDirectives:oe}=await mt("stx/virtual-scrolling",()=>import("./chunk-3vqabd10.js"));j=ae(j,_,k),j=ue(j,_,k),j=oe(j,_,k);let{processPartialHydrationDirectives:me,processStaticDirectives:ve}=await mt("stx/partial-hydration",()=>import("./chunk-5c1qesrs.js"));j=me(j,_,k),j=ve(j);let{processComputedDirectives:$e,processWatchDirectives:_e}=await mt("stx/computed",()=>import("./chunk-1xdzcy9d.js"));j=$e(j,_,k),j=_e(j,_,k);let{processFormValidationDirectives:Re}=await mt("stx/forms-validation",()=>import("./chunk-tf239jvd.js"));j=Re(j,_,k);let{processHeadDirective:Ee,processTitleDirective:Ae,processMetaDirective:Te,resetHead:ke}=await mt("stx/head",()=>import("./chunk-38x0j2tz.js"));if(!_.__stx_head_preset&&!_.__stx_runtime_head)ke();let Pe=Ee(j);if(j=Pe.content,Pe.headContent)_.__stx_head_raw=`${_.__stx_head_raw||""}${Pe.headContent}
2037
+ `;if(j=Ae(j,_),j=Te(j,_,k),j=Cg(j),j=Zc(j,_),j=Kf(j),j=$g(j),j=await ms(j,_,k,B,T),j=await as(j,_,k,B,T),_.__stxProcessingDepth===1)j=ed(j,_);if(j=j.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/g,""),j=Hl(j),j=lr(j,_,k),j=gs(j),j=Of(j,_,{filePath:k,buildMode:B.buildMode}),j=Gc(j,_),j=Jc(j,_),j=Io(j,_),j=tp(j,_),j=np(j,_),j=await km(j,_,k,B),j=await _m(j,_,k),j=await mi(j,_,k,B),j=hi(j,_,k,B),j=$s(j,_,k,B),j=_s(j,_,k),j=Ts(j,_,k,B),j=Hf(j,_,k,B),j=ws(j,_),j=vs(j),j=am(j),!B.skipEventDirectives)j=Ou(j,_,k);if(j=jf(j,_,k),B.debug){let nt=/\bx-data\s*=/.test(j),ct=ls(v);if(nt&&ct)console.warn(`[stx] ${k}: Template mixes Alpine-style (x-data) and signals (state/derived/effect) reactivity.
2038
2038
  Both work on the same page, but they manage separate scopes.
2039
2039
  Prefer signals (state/derived/effect) for new components.`)}j=Lp(j,_),j=await q(j,_,k),j=dm(j),j=fm(j),j=If(j);let{processXElementDirectives:Ge}=await mt("stx/x-element",()=>import("./chunk-zhxdpzga.js"));j=Ge(j);let De=_.__originalFilePath||k,Ie=Le(_);if(j=await ii(j,B,De,Ie),j=Yf(j,_),j=await Eg(j,_,k,B),B.media?.image?.autoSiblings){let nt=B.publicDir||"public",{rewriteImagesWithSiblings:ct}=await mt("stx/image-optimization/auto-sibling",()=>import("./chunk-kkn0m1eg.js"));j=await ct(j,{publicDir:nt})}if(B.seo?.enabled)j=Rs(j,_,B);let Ye=(nt,ct,bt=!0)=>{if(!ct)return nt;let Gt=ct.match(/<title\b[^>]*>[\s\S]*?<\/title>/i),jt=nt.match(/<title\b[^>]*>[\s\S]*?<\/title>/i);if(Gt&&jt){if(bt)nt=nt.replace(jt[0],Gt[0]);if(ct=ct.replace(Gt[0],"").trim(),!ct)return nt}if(/<\/head>/i.test(nt))return nt.replace(/<\/head>/i,`${ct}
2040
2040
  </head>`);if(/<head\b[^>]*>/i.test(nt))return nt.replace(/(<head\b[^>]*>)/i,`$1
2041
2041
  ${ct}`);if(/<html\b[^>]*>/i.test(nt))return nt.replace(/(<html\b[^>]*>)/i,`$1
2042
2042
  <head>
2043
2043
  ${ct}
2044
- </head>`);return nt},{renderHead:at,getHead:dt}=await mt("stx/head",()=>import("./chunk-pj562qnx.js")),It=_.__stx_runtime_head??dt();if(It.title||It.meta?.length||It.link?.length){let nt=at(It);if(nt)j=Ye(j,nt)}if(Pe.headContent)j=Ye(j,Pe.headContent,!It.title);if(B.csp?.enabled&&B.csp.addMetaTag)j=Vf(j,B.csp,_);if(B.analytics?.enabled)j=Pf(j,B);if(B.heatmap?.enabled)j=ku(j,B);if(B.pwa?.enabled&&B.pwa.autoInject!==!1){let{injectPwaTags:nt}=await mt("stx/pwa/inject",()=>import("./chunk-2h4bf7m4.js"));j=nt(j,B)}let ft=/<script\b(?![^>]*\bserver\b)[^>]*>[\s\S]*?<\/script>/i.test(j),ut=/\bSTX\.\w+/.test(j),st=/window\.STX\s*=/.test(j);if(ft&&ut&&!st){let ct=`<script data-stx-scoped data-stx-run="once">
2044
+ </head>`);return nt},{renderHead:at,getHead:dt}=await mt("stx/head",()=>import("./chunk-38x0j2tz.js")),It=_.__stx_runtime_head??dt();if(It.title||It.meta?.length||It.link?.length){let nt=at(It);if(nt)j=Ye(j,nt)}if(Pe.headContent)j=Ye(j,Pe.headContent,!It.title);if(B.csp?.enabled&&B.csp.addMetaTag)j=Vf(j,B.csp,_);if(B.analytics?.enabled)j=Pf(j,B);if(B.heatmap?.enabled)j=ku(j,B);if(B.pwa?.enabled&&B.pwa.autoInject!==!1){let{injectPwaTags:nt}=await mt("stx/pwa/inject",()=>import("./chunk-490f2x2r.js"));j=nt(j,B)}let ft=/<script\b(?![^>]*\bserver\b)[^>]*>[\s\S]*?<\/script>/i.test(j),ut=/\bSTX\.\w+/.test(j),st=/window\.STX\s*=/.test(j);if(ft&&ut&&!st){let ct=`<script data-stx-scoped data-stx-run="once">
2045
2045
  ${Rf()}
2046
2046
  </script>`;if(j.includes("</head>")){let bt=j.indexOf("</head>"),jt=j.slice(0,bt).indexOf("<script");if(jt!==-1){let en=j.slice(0,jt),In=j.slice(jt);j=en+ct+`
2047
2047
  `+In}else j=j.replace("</head>",`${ct}
2048
2048
  </head>`)}else if(j.includes("<body"))j=j.replace(/<body([^>]*)>/,`<body$1>
2049
2049
  ${ct}`);else j=ct+`
2050
- `+j}{let{scanScriptTags:nt}=await mt("stx/signal-processing",()=>import("./chunk-tv2xr7s3.js")),ct=[];for(let bt of nt(j)){if(!/\bserver\b/i.test(bt.attrs))continue;let Gt=bt.start+bt.fullMatch.indexOf(">")+1,jt=Sm(j,Gt);if(jt===-1)continue;let en=jt+9;while(en<j.length&&/\s/.test(j[en]))en++;ct.push({start:bt.start,end:en})}if(ct.length>0){let bt=Array(ct.length+1),Gt=0;for(let jt=0;jt<ct.length;jt++){let{start:en,end:In}=ct[jt];bt[jt]=j.slice(Gt,en),Gt=In}bt[ct.length]=j.slice(Gt),j=bt.join("")}}let yt=So(j,k);if(yt.hasScoped)j=yt.html;let gt=_.__stx_event_bindings||[],zt=!1,En=[],Cn=/\s:[a-z][\w.-]*\s*=/.test(j),{scanScriptTags:Tn}=await mt("stx/signal-processing",()=>import("./chunk-tv2xr7s3.js"));for(let nt of Tn(j,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/}))En.push({match:nt.fullMatch,attrs:nt.attrs,content:nt.body});for(let{match:nt,attrs:ct,content:bt}of En){zt=!0;let Gt=bt;xs(bt,k,E.strict,_.__originalFilePath);let jt=await he(bt,{eventBindings:gt,attrs:ct,hasColonDirectives:Cn,templateContent:v,filePath:k,projectRoot:process.cwd(),production:E.buildMode==="compile",serverData:Ie});j=j.replace(nt,()=>jt)}if(zt)_.__stx_event_bindings=[];if(!zt&&_.__stxProcessingDepth===1){let nt=_.__stx_event_bindings||[];if(nt.length>0){let ct=Da(nt);if(ct){let bt=j.lastIndexOf("</body>");j=bt===-1?j+ct:j.slice(0,bt)+ct+`
2051
- `+j.slice(bt)}_.__stx_event_bindings=[]}}if(!ce(j)&&Ug(j))j=await fa(j,B);if(j=Hg(j),B.csp?.enabled&&B.csp.useNonce&&typeof _.cspNonce==="string")j=Uf(j,_.cspNonce);return j}var oS=[{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"}],aS=[{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')"}],cS=[{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 Tc(v){let _=[],k=[];return lS(v,_),uS(v,_,k),dS(v,k),fS(v,_),{valid:_.length===0,errors:_,warnings:k}}function lS(v,_){let k=(v.match(/\{\{/g)||[]).length,E=(v.match(/\}\}/g)||[]).length;if(k!==E)_.push({type:"expression",message:`Unclosed expression brackets: found ${k} opening '{{' and ${E} closing '}}'`,suggestion:"Ensure every {{ has a matching }}"})}function uS(v,_,k){for(let E of oS){let T=new RegExp(`${E.open}(?:\\s|\\()`,"g"),j=new RegExp(E.close,"g"),B=(v.match(T)||[]).length,z=(v.match(j)||[]).length;if(E.altClose){let F=new RegExp(E.altClose,"g");z+=(v.match(F)||[]).length}if(B>z)_.push({type:"directive",message:`Unclosed @${E.name} directive: found ${B} opening and ${z} closing`,suggestion:`Add ${B-z} missing ${E.close} tag(s)`});else if(z>B)k.push({type:"directive",message:`Extra ${E.close} found: ${z-B} more closing than opening`,suggestion:`Check for orphaned ${E.close} tags`})}}function dS(v,_){for(let k of aS)if(k.pattern.test(v))_.push({type:"syntax",message:k.message,suggestion:k.suggestion})}function fS(v,_){for(let k of cS)if(k.pattern.test(v))_.push({type:"expression",message:`Security warning: ${k.message}`,suggestion:"Remove dangerous code from template expressions"})}function _c(v,_){let k=v.slice(0,_).split(`
2050
+ `+j}{let{scanScriptTags:nt}=await mt("stx/signal-processing",()=>import("./chunk-dhrzmvbj.js")),ct=[];for(let bt of nt(j)){if(!/\bserver\b/i.test(bt.attrs))continue;let Gt=bt.start+bt.fullMatch.indexOf(">")+1,jt=Sm(j,Gt);if(jt===-1)continue;let en=jt+9;while(en<j.length&&/\s/.test(j[en]))en++;ct.push({start:bt.start,end:en})}if(ct.length>0){let bt=Array(ct.length+1),Gt=0;for(let jt=0;jt<ct.length;jt++){let{start:en,end:In}=ct[jt];bt[jt]=j.slice(Gt,en),Gt=In}bt[ct.length]=j.slice(Gt),j=bt.join("")}}let yt=So(j,k);if(yt.hasScoped)j=yt.html;let gt=_.__stx_event_bindings||[],zt=!1,En=[],Cn=/\s:[a-z][\w.-]*\s*=/.test(j),{scanScriptTags:Tn}=await mt("stx/signal-processing",()=>import("./chunk-dhrzmvbj.js"));for(let nt of Tn(j,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/}))En.push({match:nt.fullMatch,attrs:nt.attrs,content:nt.body});for(let{match:nt,attrs:ct,content:bt}of En){zt=!0;let Gt=bt;xs(bt,k,E.strict,_.__originalFilePath);let jt=await he(bt,{eventBindings:gt,attrs:ct,hasColonDirectives:Cn,templateContent:v,filePath:k,projectRoot:process.cwd(),production:E.buildMode==="compile",serverData:Ie});j=j.replace(nt,()=>jt)}if(zt)_.__stx_event_bindings=[];if(!zt&&_.__stxProcessingDepth===1){let nt=_.__stx_event_bindings||[];if(nt.length>0){let ct=Da(nt);if(ct){let bt=j.lastIndexOf("</body>");j=bt===-1?j+ct:j.slice(0,bt)+ct+`
2051
+ `+j.slice(bt)}_.__stx_event_bindings=[]}}if(!ce(j)&&Ug(j))j=await fa(j,B);if(j=Hg(j),B.csp?.enabled&&B.csp.useNonce&&typeof _.cspNonce==="string")j=Uf(j,_.cspNonce);return j}var oS=[{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"}],aS=[{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')"}],cS=[{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 _c(v){let _=[],k=[];return lS(v,_),uS(v,_,k),dS(v,k),fS(v,_),{valid:_.length===0,errors:_,warnings:k}}function lS(v,_){let k=(v.match(/\{\{/g)||[]).length,E=(v.match(/\}\}/g)||[]).length;if(k!==E)_.push({type:"expression",message:`Unclosed expression brackets: found ${k} opening '{{' and ${E} closing '}}'`,suggestion:"Ensure every {{ has a matching }}"})}function uS(v,_,k){for(let E of oS){let T=new RegExp(`${E.open}(?:\\s|\\()`,"g"),j=new RegExp(E.close,"g"),B=(v.match(T)||[]).length,z=(v.match(j)||[]).length;if(E.altClose){let F=new RegExp(E.altClose,"g");z+=(v.match(F)||[]).length}if(B>z)_.push({type:"directive",message:`Unclosed @${E.name} directive: found ${B} opening and ${z} closing`,suggestion:`Add ${B-z} missing ${E.close} tag(s)`});else if(z>B)k.push({type:"directive",message:`Extra ${E.close} found: ${z-B} more closing than opening`,suggestion:`Check for orphaned ${E.close} tags`})}}function dS(v,_){for(let k of aS)if(k.pattern.test(v))_.push({type:"syntax",message:k.message,suggestion:k.suggestion})}function fS(v,_){for(let k of cS)if(k.pattern.test(v))_.push({type:"expression",message:`Security warning: ${k.message}`,suggestion:"Remove dangerous code from template expressions"})}function Tc(v,_){let k=v.slice(0,_).split(`
2052
2052
  `);return{line:k.length,column:k[k.length-1].length+1}}function Rc(v,_,k){let E=[];switch(v){case"if":case"elseif":case"unless":if(k.length===0)E.push({type:"syntax",message:`@${v} requires a condition`,suggestion:`Use @${v}(condition)`});break;case"foreach":if(k.length===0||!k[0].includes(" as "))E.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(k.length===0)E.push({type:"syntax",message:"@for requires loop parameters",suggestion:"Use @for(let i = 0; i < 10; i++)"});break;case"switch":if(k.length===0)E.push({type:"syntax",message:"@switch requires an expression",suggestion:"Use @switch(expression)"});break;case"case":if(k.length===0)E.push({type:"syntax",message:"@case requires a value",suggestion:"Use @case(value)"});break;case"include":case"extends":case"component":if(k.length===0)E.push({type:"syntax",message:`@${v} requires a path`,suggestion:`Use @${v}('path/to/template')`});break}return E}function Ac(v){return/@[a-z]+/i.test(v)||/\{\{/.test(v)}function Pc(v){let _=v.matchAll(/@([a-z]+)/gi),k=new Set;for(let E of _){let T=E[1].toLowerCase();if(!T.startsWith("end"))k.add(T)}return Array.from(k)}import Ln from"path";import Zs from"process";var Et=["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 Em=new Set(Et),pS=new Set(["props","$props","defineProps"]),gS=new Set(["stx","@stacksjs/stx"]),Cm=m(128),Rm=m(64);function mS(v){let _=[],k=0,E=v.split(`
2053
- `);for(let T of E){let j=k,B=null,z=!1;for(let F=0;F<T.length;F++){let V=T[F];if(z){z=!1;continue}if(V==="\\"){z=!0;continue}if(B){if(V===B)B=null;continue}if(V==="'"||V==='"'||V==="`"){B=V;continue}if(V==="/"&&F+1<T.length&&T[F+1]==="/")break;if(V==="{")k++;else if(V==="}")k--}if(j===0){let F=T.match(/(?:const|let|var)\s+(\w+)\s*=/);if(F)_.push(F[1]);else if(/^\s*(?:const|let|var)\s+\w+\s*;?\s*$/.test(T)){let V=T.match(/(?:const|let|var)\s+(\w+)/);if(V)_.push(V[1])}else{let V=T.match(/(?:const|let|var)\s+(\{[^}]+\}|\[[^\]]+\])\s*=/);if(V){let G=V[1].slice(1,-1).split(",").map((J)=>{let ne=J.split(":");return(ne.length>1?ne[1]:ne[0]).trim()}).filter((J)=>/^\w+$/.test(J));_.push(...G)}}}}return[...new Set(_)]}function bc(v){let _=v;_=_.replace(/^\s*import\s+.*?from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),_=_.replace(/^\s*import\s+['"][^'"]+['"]\s*;?\s*$/gm,""),_=_.replace(/^\s*interface\s+\w+\s*\{[\s\S]*?\n\}\s*$/gm,""),_=_.replace(/^\s*type\s+\w+\s*=[\s\S]*?(?=\n(?:const|let|var|function|export|interface|type|$))/gm,""),_=_.replace(/^(\s*(?:export\s+)?(?:const|let|var)\s+)(\w+|\{[^}]+\}|\[[^\]]+\])\s*:\s*[^=]+(\s*=)/gm,"$1$2$3");function k(E){if(!E.includes(":"))return E;let T=[],j="",B=0,z=0,F=null;for(let V=0;V<E.length;V++){let H=E[V];if(F){if(j+=H,H===F)F=null;continue}if(H==='"'||H==="'"||H==="`"){F=H,j+=H;continue}if(H==="<")B++;else if(H===">"&&B>0)B--;else if(H==="(")z++;else if(H===")")z--;if(H===","&&B===0&&z===0){T.push(j),j="";continue}j+=H}if(j)T.push(j);return T.map((V)=>{let H=V.trim(),G=H.startsWith("..."),J=G?H.slice(3):H,ne=-1,re=0;for(let we=0;we<J.length;we++)if(J[we]==="<")re++;else if(J[we]===">")re--;else if(J[we]===":"&&re===0){ne=we;break}if(ne===-1)return V;let ie=J.substring(0,ne).trim().replace(/\?$/,""),ae=J.substring(ne+1),ue=-1,oe=0;for(let we=0;we<ae.length;we++)if(ae[we]==="<")oe++;else if(ae[we]===">")oe--;else if(ae[we]==="="&&oe===0){ue=we;break}let me=G?"...":"";if(ue!==-1)return`${me}${ie} = ${ae.substring(ue+1).trim()}`;return`${me}${ie}`}).join(", ")}_=_.replace(/\b(function\s+\w*\s*)\(([^)]*)\)/g,(E,T,j)=>{if(!j.includes(":"))return E;return`${T}(${k(j)})`});{let E=/\b(function\s+\w*\s*)\(/g,T,j=[];while((T=E.exec(_))!==null){let B=T.index+T[0].length-1,z=1,F=B+1,V=0,H=null;while(F<_.length&&z>0){let ne=_[F];if(H){if(ne===H)H=null;F++;continue}if(ne==='"'||ne==="'"||ne==="`"){H=ne,F++;continue}if(ne==="<")V++;else if(ne===">"&&V>0)V--;else if(V===0){if(ne==="(")z++;else if(ne===")")z--}if(z>0)F++}if(z!==0)continue;let G=_.substring(B+1,F);if(!G.includes(":"))continue;let J=k(G);j.push({start:B+1,end:F,replacement:J})}for(let B=j.length-1;B>=0;B--){let{start:z,end:F,replacement:V}=j[B];_=_.substring(0,z)+V+_.substring(F)}}return _=_.replace(/\(([^)]*)\)\s*(?::\s*[^=]+)?\s*=>/g,(E,T)=>{if(!T.includes(":"))return E;if(T.includes("{")||T.includes("}"))return E;return`(${T.split(",").map((B)=>{let[z,...F]=B.split("="),V=z.split(":")[0].trim();if(F.length>0)return`${V} = ${F.join("=").trim()}`;return V}).join(", ")}) =>`}),_=_.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"),_=_.replace(/(\b(?:function|class|interface|type|extends|implements)\s+\w+)\s*<[^<>()]*>/g,"$1"),_=_.replace(/(\b(?:defineProps|withDefaults|defineEmits|defineSlots|Array|Promise|Map|Set|Record|Partial|Required|Readonly|Pick|Omit|Exclude|Extract))\s*<[^<>()]*>/g,"$1"),_=_.replace(/(\w+)\s*<[A-Z][^<>()]*>\s*(?=\()/g,"$1"),_=_.replace(/\s+as\s+(?:const|[A-Za-z]\w*(?:\[\])?(?:\s*\|\s*\w+(?:\[\])?)*)/g,""),_=_.replace(/\s+satisfies\s+\w+(?:<[^>]*>)?/g,""),_=_.replace(/(\w|\)|\])\s*!(?!=)/g,"$1"),_=_.replace(/^\s*(?:export\s+)?(?:const\s+)?enum\s+\w+\s*\{[^}]*\}\s*$/gm,""),_=_.replace(/(?<=[\s=,(])<[A-Z]\w*(?:\[\])?>/g,""),_=_.replace(/\n\s*\n\s*\n/g,`
2053
+ `);for(let T of E){let j=k,B=null,z=!1;for(let F=0;F<T.length;F++){let V=T[F];if(z){z=!1;continue}if(V==="\\"){z=!0;continue}if(B){if(V===B)B=null;continue}if(V==="'"||V==='"'||V==="`"){B=V;continue}if(V==="/"&&F+1<T.length&&T[F+1]==="/")break;if(V==="{")k++;else if(V==="}")k--}if(j===0){let F=T.match(/(?:const|let|var)\s+(\w+)\s*=/);if(F)_.push(F[1]);else if(/^\s*(?:const|let|var)\s+\w+\s*;?\s*$/.test(T)){let V=T.match(/(?:const|let|var)\s+(\w+)/);if(V)_.push(V[1])}else{let V=T.match(/(?:const|let|var)\s+(\{[^}]+\}|\[[^\]]+\])\s*=/);if(V){let G=V[1].slice(1,-1).split(",").map((J)=>{let ne=J.split(":");return(ne.length>1?ne[1]:ne[0]).trim()}).filter((J)=>/^\w+$/.test(J));_.push(...G)}}}}return[...new Set(_)]}function bc(v){let _=v;_=_.replace(/^\s*import\s+.*?from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),_=_.replace(/^\s*import\s+['"][^'"]+['"]\s*;?\s*$/gm,""),_=_.replace(/^\s*interface\s+\w+\s*\{[\s\S]*?\n\}\s*$/gm,""),_=_.replace(/^\s*type\s+\w+\s*=[\s\S]*?(?=\n(?:const|let|var|function|export|interface|type|$))/gm,""),_=_.replace(/^(\s*(?:export\s+)?(?:const|let|var)\s+)(\w+|\{[^}]+\}|\[[^\]]+\])\s*:\s*[^=]+(\s*=)/gm,"$1$2$3");function k(E){if(!E.includes(":"))return E;let T=[],j="",B=0,z=0,F=null;for(let V=0;V<E.length;V++){let H=E[V];if(F){if(j+=H,H===F)F=null;continue}if(H==='"'||H==="'"||H==="`"){F=H,j+=H;continue}if(H==="<")B++;else if(H===">"&&B>0)B--;else if(H==="(")z++;else if(H===")")z--;if(H===","&&B===0&&z===0){T.push(j),j="";continue}j+=H}if(j)T.push(j);return T.map((V)=>{let H=V.trim(),G=H.startsWith("..."),J=G?H.slice(3):H,ne=-1,re=0;for(let ve=0;ve<J.length;ve++)if(J[ve]==="<")re++;else if(J[ve]===">")re--;else if(J[ve]===":"&&re===0){ne=ve;break}if(ne===-1)return V;let ie=J.substring(0,ne).trim().replace(/\?$/,""),ae=J.substring(ne+1),ue=-1,oe=0;for(let ve=0;ve<ae.length;ve++)if(ae[ve]==="<")oe++;else if(ae[ve]===">")oe--;else if(ae[ve]==="="&&oe===0){ue=ve;break}let me=G?"...":"";if(ue!==-1)return`${me}${ie} = ${ae.substring(ue+1).trim()}`;return`${me}${ie}`}).join(", ")}_=_.replace(/\b(function\s+\w*\s*)\(([^)]*)\)/g,(E,T,j)=>{if(!j.includes(":"))return E;return`${T}(${k(j)})`});{let E=/\b(function\s+\w*\s*)\(/g,T,j=[];while((T=E.exec(_))!==null){let B=T.index+T[0].length-1,z=1,F=B+1,V=0,H=null;while(F<_.length&&z>0){let ne=_[F];if(H){if(ne===H)H=null;F++;continue}if(ne==='"'||ne==="'"||ne==="`"){H=ne,F++;continue}if(ne==="<")V++;else if(ne===">"&&V>0)V--;else if(V===0){if(ne==="(")z++;else if(ne===")")z--}if(z>0)F++}if(z!==0)continue;let G=_.substring(B+1,F);if(!G.includes(":"))continue;let J=k(G);j.push({start:B+1,end:F,replacement:J})}for(let B=j.length-1;B>=0;B--){let{start:z,end:F,replacement:V}=j[B];_=_.substring(0,z)+V+_.substring(F)}}return _=_.replace(/\(([^)]*)\)\s*(?::\s*[^=]+)?\s*=>/g,(E,T)=>{if(!T.includes(":"))return E;if(T.includes("{")||T.includes("}"))return E;return`(${T.split(",").map((B)=>{let[z,...F]=B.split("="),V=z.split(":")[0].trim();if(F.length>0)return`${V} = ${F.join("=").trim()}`;return V}).join(", ")}) =>`}),_=_.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"),_=_.replace(/(\b(?:function|class|interface|type|extends|implements)\s+\w+)\s*<[^<>()]*>/g,"$1"),_=_.replace(/(\b(?:defineProps|withDefaults|defineEmits|defineSlots|Array|Promise|Map|Set|Record|Partial|Required|Readonly|Pick|Omit|Exclude|Extract))\s*<[^<>()]*>/g,"$1"),_=_.replace(/(\w+)\s*<[A-Z][^<>()]*>\s*(?=\()/g,"$1"),_=_.replace(/\s+as\s+(?:const|[A-Za-z]\w*(?:\[\])?(?:\s*\|\s*\w+(?:\[\])?)*)/g,""),_=_.replace(/\s+satisfies\s+\w+(?:<[^>]*>)?/g,""),_=_.replace(/(\w|\)|\])\s*!(?!=)/g,"$1"),_=_.replace(/^\s*(?:export\s+)?(?:const\s+)?enum\s+\w+\s*\{[^}]*\}\s*$/gm,""),_=_.replace(/(?<=[\s=,(])<[A-Z]\w*(?:\[\])?>/g,""),_=_.replace(/\n\s*\n\s*\n/g,`
2054
2054
 
2055
- `),_}function vc(v){return v.replace(/\s*(?:imported from|from)\s+(?:(['"])([^'"\r\n]+)\1|(\S+))/g,(_,...k)=>{let[,E,T]=k,j=E??T;return/(?:[/\\]packages[/\\]stx[/\\]|@stacksjs[/\\]stx[/\\])/.test(j)?"":_})}function wc(v){return/cannot find module|cannot find package|could not resolve|module not found|failed to resolve/i.test(v)}function xc(v){if(v instanceof SyntaxError)return!0;let _=v instanceof Error?v.message:String(v);return/SyntaxError|Unexpected (token|identifier|string|number|keyword|end of)|Unterminated|Expected .+ but found/i.test(_)}function Sc(v){if(!/is not defined|can't find variable/i.test(v))return!1;return!/\b(document|window|navigator|localStorage|sessionStorage|self)\b/.test(v)}var Am=new Set;async function u(v,_,k,E={}){if(!v.trim())return;let T=w(),j=h(v,JSON.stringify(T)),B=Cm.get(j);if(B===void 0){try{let Oe=L({loader:"ts",target:"browser",define:T}),Qe=v.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");Qe=Qe.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,""),B=Oe.transformSync(Qe)}catch{B=bc(v)}Cm.set(j,B)}let z={exports:{}},F=z.exports,V=Zs.cwd(),H={},G=[...B.matchAll(/require\s*\(\s*['"]([^'"]+)['"]\s*\)/g)||[]].map((Oe)=>Oe[1]).filter((Oe)=>!Oe.startsWith("node:")&&!["fs","path","os","child_process","crypto","http","https","url","util","stream","events","buffer","net","querystring","zlib","tls"].includes(Oe)),J=new Map;for(let Oe of G)try{if(Oe.startsWith(".")){H[Oe]=await import(Ln.resolve(Ln.dirname(k),Oe));continue}let Qe=Ln.resolve(V,"node_modules",Oe),ot=Ln.join(Qe,"package.json"),ht=JSON.parse(d("fs").readFileSync(ot,"utf8")),Dt=ht.main||"index.js";if(ht.exports){let Kt=typeof ht.exports==="string"?ht.exports:ht.exports["."];if(typeof Kt==="string")Dt=Kt;else if(Kt?.bun)Dt=Kt.bun;else if(Kt?.import)Dt=Kt.import;else if(Kt?.default)Dt=Kt.default}H[Oe]=await import(Ln.resolve(Qe,Dt))}catch(Qe){if(Oe.startsWith("."))J.set(Oe,Qe instanceof Error?Qe.message:String(Qe))}let ne=(Oe)=>{if(H[Oe])return H[Oe];let Qe=J.get(Oe);if(Qe!==void 0)throw Error(`Cannot require '${Oe}' from ${k}: ${Qe}`);return d(Oe)},re=_.props||{},se=(Oe)=>{if(!Oe)return re;let Qe={};for(let[ot,ht]of Object.entries(Oe)){let Dt=re[ot];if(Dt!==void 0)Qe[ot]=Dt;else if(typeof ht==="function")Qe[ot]=ht();else Qe[ot]=ht}return Qe};for(let[Oe,Qe]of Object.entries(re))Object.defineProperty(se,Oe,{value:Qe,enumerable:!0,configurable:!0,writable:!0});let ie=(Oe,Qe=!1)=>{if(Oe===void 0||Oe===null)return Qe;if(typeof Oe==="string"){let ot=Oe.trim().toLowerCase();if(ot===""||ot==="true"||ot==="1"||ot==="on"||ot==="yes")return!0;if(ot==="false"||ot==="0"||ot==="off"||ot==="no")return!1;return!0}return Boolean(Oe)},ae=(Oe,Qe=0)=>{if(Oe===void 0||Oe===null)return Qe;if(typeof Oe==="string"){let ht=Oe.trim();if(ht==="")return Qe;let Dt=Number(ht);return Number.isFinite(Dt)?Dt:Qe}let ot=Number(Oe);return Number.isFinite(ot)?ot:Qe};for(let Oe of["name","length","caller","arguments"]){if(Object.prototype.hasOwnProperty.call(re,Oe))continue;try{Object.defineProperty(se,Oe,{value:void 0,enumerable:!1,configurable:!0,writable:!0})}catch{}}let ue=(Oe)=>{if(!Oe)return re;let Qe={...re};for(let[ot,ht]of Object.entries(Oe)){let Dt=ht&&typeof ht==="object"&&!Array.isArray(ht)?ht:{type:ht};if(Qe[ot]===void 0&&Dt.default!==void 0)Qe[ot]=typeof Dt.default==="function"?Dt.default():Dt.default}return Qe},oe=()=>_.slots||{},me=(Oe,Qe)=>{let ot={...Oe};for(let[ht,Dt]of Object.entries(Qe))if(ot[ht]===void 0)if(typeof Dt==="function")ot[ht]=Dt();else ot[ht]=Dt;return ot},we=(Oe)=>{let Qe=()=>Oe;return Qe.set=(ot)=>{},Qe.update=(ot)=>{},Qe},$e=(Oe)=>{let Qe,ot=!1;return()=>{if(!ot)try{Qe=Oe(),ot=!0}catch{Qe=void 0}return Qe}},_e=(Oe)=>{},Re=(Oe)=>Oe(),Ee=(Oe)=>{},Ae=(Oe)=>{},Te=Vn(_);function ke(Oe){let Qe=Oe||{};if(Qe.title!==void 0||Qe.description!==void 0)Ye({title:Qe.title,description:Qe.description})}function Pe(Oe){if(!Oe||typeof Oe!=="object")return;let Qe=_.__stxClientPayload??{};Object.assign(Qe,Oe),_.__stxClientPayload=Qe}let Ge=()=>{let Oe=_.__stxServeContext,Qe=_.__stxServeSearch??Oe?.search??"",ot=Oe?.path??"",ht=Object.fromEntries(new URLSearchParams(Qe)),Dt=_.query,Kt=Object.keys(ht).length>0?ht:Dt??{},kr=Qe||(Object.keys(Kt).length>0?`?${new URLSearchParams(Kt).toString()}`:"");return{params:_.params??{},query:Kt,path:ot,name:"",fullPath:ot+kr,hash:"",matched:[]}},De=()=>({push:(Oe)=>{},replace:(Oe)=>{},back:()=>{},forward:()=>{},go:(Oe)=>{}}),Ie=(Oe)=>{let Qe=_.__stx_runtime_head||{};_.__stx_runtime_head=fe(Qe,pe(Oe||{},{known:sr,source:"useHead()"}))},Ye=(Oe)=>{Ie(or(Oe||{}))},at=(Oe)=>({value:Oe}),dt=(Oe)=>Oe,et=(Oe)=>({value:typeof Oe==="function"?Oe():Oe}),It=(Oe,Qe)=>{},ft=(Oe)=>{},ut=(Oe)=>{},st=(Oe)=>Oe?Oe():Promise.resolve(),yt=(Oe)=>(Qe,...ot)=>{},gt=(Oe)=>{},zt=(Oe,Qe)=>{},En=(Oe,Qe)=>Qe,Cn=()=>({value:"light"}),Tn=()=>we(!1),nt=(Oe)=>we(!1),ct=()=>we(!1),bt=()=>nt("(prefers-color-scheme: dark)"),Gt=()=>nt("(prefers-color-scheme: light)"),jt=()=>nt("(prefers-reduced-motion: reduce)"),en=()=>nt("(prefers-contrast: more)"),In={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:{}},nr=new Proxy(In,{get(Oe,Qe){if(Qe in Oe)return Oe[Qe];return},set(Oe,Qe,ot){return Oe[Qe]=ot,!0}}),Ea={getElementById:()=>null,querySelector:()=>null,querySelectorAll:()=>[],createElement:()=>({}),createTextNode:()=>({}),body:{},head:{},documentElement:{},addEventListener:()=>{},removeEventListener:()=>{}},Jt=console;try{let Oe=ps(B,k),Qe=new Set(Object.keys(re)),ot=Object.keys(_).filter((lt)=>!Qe.has(lt)&&!pS.has(lt)&&Ze(lt)),ht=ot.map((lt)=>_[lt]);if(!ot.includes("__stxServeContext"))ot.push("__stxServeContext"),ht.push(void 0);let Dt=new Set(["async","module","exports","require","params","window","document","console","state","derived","effect"]),Kt=[],kr=[];for(let[lt,Mt]of Object.entries(re)){if(!Ze(lt))continue;if(Dt.has(lt))continue;if(new RegExp(`(?:^|[\\s;{])(?:const|let|var|function)\\s+${lt}\\b`).test(Oe))continue;Kt.push(lt),kr.push(Mt)}let so=mS(Oe).map((lt)=>`module.exports.${lt} = typeof ${lt} !== 'undefined' ? ${lt} : module.exports.${lt};`).join(`
2055
+ `),_}function wc(v){return v.replace(/\s*(?:imported from|from)\s+(?:(['"])([^'"\r\n]+)\1|(\S+))/g,(_,...k)=>{let[,E,T]=k,j=E??T;return/(?:[/\\]packages[/\\]stx[/\\]|@stacksjs[/\\]stx[/\\])/.test(j)?"":_})}function vc(v){return/cannot find module|cannot find package|could not resolve|module not found|failed to resolve/i.test(v)}function xc(v){if(v instanceof SyntaxError)return!0;let _=v instanceof Error?v.message:String(v);return/SyntaxError|Unexpected (token|identifier|string|number|keyword|end of)|Unterminated|Expected .+ but found/i.test(_)}function Sc(v){if(!/is not defined|can't find variable/i.test(v))return!1;return!/\b(document|window|navigator|localStorage|sessionStorage|self)\b/.test(v)}var Am=new Set;async function u(v,_,k,E={}){if(!v.trim())return;let T=w(),j=h(v,JSON.stringify(T)),B=Cm.get(j);if(B===void 0){try{let Oe=L({loader:"ts",target:"browser",define:T}),Qe=v.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");Qe=Qe.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,""),B=Oe.transformSync(Qe)}catch{B=bc(v)}Cm.set(j,B)}let z={exports:{}},F=z.exports,V=Zs.cwd(),H={},G=[...B.matchAll(/require\s*\(\s*['"]([^'"]+)['"]\s*\)/g)||[]].map((Oe)=>Oe[1]).filter((Oe)=>!Oe.startsWith("node:")&&!["fs","path","os","child_process","crypto","http","https","url","util","stream","events","buffer","net","querystring","zlib","tls"].includes(Oe)),J=new Map;for(let Oe of G)try{if(Oe.startsWith(".")){H[Oe]=await import(Ln.resolve(Ln.dirname(k),Oe));continue}let Qe=Ln.resolve(V,"node_modules",Oe),ot=Ln.join(Qe,"package.json"),ht=JSON.parse(d("fs").readFileSync(ot,"utf8")),Dt=ht.main||"index.js";if(ht.exports){let Kt=typeof ht.exports==="string"?ht.exports:ht.exports["."];if(typeof Kt==="string")Dt=Kt;else if(Kt?.bun)Dt=Kt.bun;else if(Kt?.import)Dt=Kt.import;else if(Kt?.default)Dt=Kt.default}H[Oe]=await import(Ln.resolve(Qe,Dt))}catch(Qe){if(Oe.startsWith("."))J.set(Oe,Qe instanceof Error?Qe.message:String(Qe))}let ne=(Oe)=>{if(H[Oe])return H[Oe];let Qe=J.get(Oe);if(Qe!==void 0)throw Error(`Cannot require '${Oe}' from ${k}: ${Qe}`);return d(Oe)},re=_.props||{},se=(Oe)=>{if(!Oe)return re;let Qe={};for(let[ot,ht]of Object.entries(Oe)){let Dt=re[ot];if(Dt!==void 0)Qe[ot]=Dt;else if(typeof ht==="function")Qe[ot]=ht();else Qe[ot]=ht}return Qe};for(let[Oe,Qe]of Object.entries(re))Object.defineProperty(se,Oe,{value:Qe,enumerable:!0,configurable:!0,writable:!0});let ie=(Oe,Qe=!1)=>{if(Oe===void 0||Oe===null)return Qe;if(typeof Oe==="string"){let ot=Oe.trim().toLowerCase();if(ot===""||ot==="true"||ot==="1"||ot==="on"||ot==="yes")return!0;if(ot==="false"||ot==="0"||ot==="off"||ot==="no")return!1;return!0}return Boolean(Oe)},ae=(Oe,Qe=0)=>{if(Oe===void 0||Oe===null)return Qe;if(typeof Oe==="string"){let ht=Oe.trim();if(ht==="")return Qe;let Dt=Number(ht);return Number.isFinite(Dt)?Dt:Qe}let ot=Number(Oe);return Number.isFinite(ot)?ot:Qe};for(let Oe of["name","length","caller","arguments"]){if(Object.prototype.hasOwnProperty.call(re,Oe))continue;try{Object.defineProperty(se,Oe,{value:void 0,enumerable:!1,configurable:!0,writable:!0})}catch{}}let ue=(Oe)=>{if(!Oe)return re;let Qe={...re};for(let[ot,ht]of Object.entries(Oe)){let Dt=ht&&typeof ht==="object"&&!Array.isArray(ht)?ht:{type:ht};if(Qe[ot]===void 0&&Dt.default!==void 0)Qe[ot]=typeof Dt.default==="function"?Dt.default():Dt.default}return Qe},oe=()=>_.slots||{},me=(Oe,Qe)=>{let ot={...Oe};for(let[ht,Dt]of Object.entries(Qe))if(ot[ht]===void 0)if(typeof Dt==="function")ot[ht]=Dt();else ot[ht]=Dt;return ot},ve=(Oe)=>{let Qe=()=>Oe;return Qe.set=(ot)=>{},Qe.update=(ot)=>{},Qe},$e=(Oe)=>{let Qe,ot=!1;return()=>{if(!ot)try{Qe=Oe(),ot=!0}catch{Qe=void 0}return Qe}},_e=(Oe)=>{},Re=(Oe)=>Oe(),Ee=(Oe)=>{},Ae=(Oe)=>{},Te=Vn(_);function ke(Oe){let Qe=Oe||{};if(Qe.title!==void 0||Qe.description!==void 0)Ye({title:Qe.title,description:Qe.description})}function Pe(Oe){if(!Oe||typeof Oe!=="object")return;let Qe=_.__stxClientPayload??{};Object.assign(Qe,Oe),_.__stxClientPayload=Qe}let Ge=()=>{let Oe=_.__stxServeContext,Qe=_.__stxServeSearch??Oe?.search??"",ot=Oe?.path??"",ht=Object.fromEntries(new URLSearchParams(Qe)),Dt=_.query,Kt=Object.keys(ht).length>0?ht:Dt??{},kr=Qe||(Object.keys(Kt).length>0?`?${new URLSearchParams(Kt).toString()}`:"");return{params:_.params??{},query:Kt,path:ot,name:"",fullPath:ot+kr,hash:"",matched:[]}},De=()=>({push:(Oe)=>{},replace:(Oe)=>{},back:()=>{},forward:()=>{},go:(Oe)=>{}}),Ie=(Oe)=>{let Qe=_.__stx_runtime_head||{};_.__stx_runtime_head=fe(Qe,pe(Oe||{},{known:sr,source:"useHead()"}))},Ye=(Oe)=>{Ie(or(Oe||{}))},at=(Oe)=>({value:Oe}),dt=(Oe)=>Oe,et=(Oe)=>({value:typeof Oe==="function"?Oe():Oe}),It=(Oe,Qe)=>{},ft=(Oe)=>{},ut=(Oe)=>{},st=(Oe)=>Oe?Oe():Promise.resolve(),yt=(Oe)=>(Qe,...ot)=>{},gt=(Oe)=>{},zt=(Oe,Qe)=>{},En=(Oe,Qe)=>Qe,Cn=()=>({value:"light"}),Tn=()=>ve(!1),nt=(Oe)=>ve(!1),ct=()=>ve(!1),bt=()=>nt("(prefers-color-scheme: dark)"),Gt=()=>nt("(prefers-color-scheme: light)"),jt=()=>nt("(prefers-reduced-motion: reduce)"),en=()=>nt("(prefers-contrast: more)"),In={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:{}},nr=new Proxy(In,{get(Oe,Qe){if(Qe in Oe)return Oe[Qe];return},set(Oe,Qe,ot){return Oe[Qe]=ot,!0}}),Ea={getElementById:()=>null,querySelector:()=>null,querySelectorAll:()=>[],createElement:()=>({}),createTextNode:()=>({}),body:{},head:{},documentElement:{},addEventListener:()=>{},removeEventListener:()=>{}},Jt=console;try{let Oe=ps(B,k),Qe=new Set(Object.keys(re)),ot=Object.keys(_).filter((lt)=>!Qe.has(lt)&&!pS.has(lt)&&Ze(lt)),ht=ot.map((lt)=>_[lt]);if(!ot.includes("__stxServeContext"))ot.push("__stxServeContext"),ht.push(void 0);let Dt=new Set(["async","module","exports","require","params","window","document","console","state","derived","effect"]),Kt=[],kr=[];for(let[lt,Mt]of Object.entries(re)){if(!Ze(lt))continue;if(Dt.has(lt))continue;if(new RegExp(`(?:^|[\\s;{])(?:const|let|var|function)\\s+${lt}\\b`).test(Oe))continue;Kt.push(lt),kr.push(Mt)}let so=mS(Oe).map((lt)=>`module.exports.${lt} = typeof ${lt} !== 'undefined' ? ${lt} : module.exports.${lt};`).join(`
2056
2056
  `),Ra=_.params??{},ur=[],zr=[];for(let lt=0;lt<ot.length;lt++){if(ot[lt]==="params")continue;ur.push(ot[lt]),zr.push(ht[lt])}let rr=[...Et,...Kt,...ur],Xt=`return (async () => {
2057
2057
  ${Oe}
2058
2058
  ${so}
2059
2059
  return module.exports
2060
- })()`,tt=h(Xt,rr.join("\x00")),it=Rm.get(tt);if(!it)it=Function(...rr,Xt),Rm.set(tt,it);let vt=_.__stx_options?.runtimeConfig;if(vt||/\buse(?:Server)?RuntimeConfig\b/.test(B))await dn(_,k,vt);let pt=await de(_.__stx_runtime_config??Tt()??C(),()=>Lg(_,()=>it(z,F,ne,re,se,ie,ae,ue,me,Pe,Bg,Es,Qn,we,$e,_e,Re,Ee,Ae,ke,Ge,De,Ie,Ye,Te.setResponseStatus,Te.setResponseHeader,Te.notFound,at,dt,et,It,ft,ut,st,yt,gt,oe,zt,En,Cn,Tn,nt,ct,bt,Gt,jt,en,nr,Ea,Jt,In.confirm,In.alert,In.fetch,Ra,...kr,...zr)));if(E.preserveExisting){for(let[lt,Mt]of Object.entries(pt))if(!(lt in _)||_[lt]===void 0)_[lt]=Mt}else Object.assign(_,pt);for(let[lt,Mt]of Object.entries(re))if(!(lt in _))_[lt]=Mt}catch(Oe){if(_.__stx_strict_hydration)throw Oe;let Qe=vc(Oe instanceof Error?Oe.message:String(Oe));if(wc(Qe))console.warn(`[stx] server <script> in ${k??"<unknown>"} imports a module that does not resolve, so every variable in that script is undefined. Cause: ${Qe}`),E.onFailure?.({kind:"module-resolution",message:Qe,error:Oe});else if(xc(Oe))console.warn(`[stx] server <script> in ${k??"<unknown>"} does not parse, so every variable in that script is undefined. Cause: ${Qe}`),E.onFailure?.({kind:"syntax",message:Qe,error:Oe});else if(Sc(Qe))console.warn(`[stx] server <script> in ${k??"<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: ${Qe}`),E.onFailure?.({kind:"missing-binding",message:Qe,error:Oe});else{let ot=`${k??"<unknown>"}\x00${Qe}`;if(Zs.env.STX_DEBUG||!Am.has(ot))Am.add(ot),console.warn(`[stx] server <script> in ${k??"<unknown>"} threw, so every variable in that script is undefined and anything that reads one renders empty. Cause: ${Qe}`);E.onFailure?.({kind:"unknown",message:Qe,error:Oe})}try{await wS(B,_,k)}catch(ot){if(Zs.env.STX_DEBUG){let ht=ot instanceof Error?ot.message:String(ot);console.warn(`[stx] fallback extraction also failed in ${k??"<unknown>"}: ${ht}`)}}}}function kc(v){let _=0,k=null,E=!1,T=!1;for(let j=0;j<v.length;j++){let B=v[j];if(k){if(B===k){if(k=null,E||_===0)T=!0}continue}if(B==="'"||B==='"'||B==="`"){k=B;continue}if(B==="{")_++;else if(B==="}")_--;else if(v.startsWith("from",j)&&_===0)E=!0}return k===null&&_===0&&T}var hS=/^(?:export\s+)?(?:const|let|var)\s+[A-Za-z_$][\w$]*(?:\s*,\s*[A-Za-z_$][\w$]*)*\s*;?$/;function ps(v,_){let k=_?Ln.dirname(_):Zs.cwd(),E=Zs.cwd(),T=v.split(`
2060
+ })()`,tt=h(Xt,rr.join("\x00")),it=Rm.get(tt);if(!it)it=Function(...rr,Xt),Rm.set(tt,it);let wt=_.__stx_options?.runtimeConfig;if(wt||/\buse(?:Server)?RuntimeConfig\b/.test(B))await dn(_,k,wt);let pt=await de(_.__stx_runtime_config??_t()??C(),()=>Lg(_,()=>it(z,F,ne,re,se,ie,ae,ue,me,Pe,Bg,Es,Qn,ve,$e,_e,Re,Ee,Ae,ke,Ge,De,Ie,Ye,Te.setResponseStatus,Te.setResponseHeader,Te.notFound,at,dt,et,It,ft,ut,st,yt,gt,oe,zt,En,Cn,Tn,nt,ct,bt,Gt,jt,en,nr,Ea,Jt,In.confirm,In.alert,In.fetch,Ra,...kr,...zr)));if(E.preserveExisting){for(let[lt,Mt]of Object.entries(pt))if(!(lt in _)||_[lt]===void 0)_[lt]=Mt}else Object.assign(_,pt);for(let[lt,Mt]of Object.entries(re))if(!(lt in _))_[lt]=Mt}catch(Oe){if(_.__stx_strict_hydration)throw Oe;let Qe=wc(Oe instanceof Error?Oe.message:String(Oe));if(vc(Qe))console.warn(`[stx] server <script> in ${k??"<unknown>"} imports a module that does not resolve, so every variable in that script is undefined. Cause: ${Qe}`),E.onFailure?.({kind:"module-resolution",message:Qe,error:Oe});else if(xc(Oe))console.warn(`[stx] server <script> in ${k??"<unknown>"} does not parse, so every variable in that script is undefined. Cause: ${Qe}`),E.onFailure?.({kind:"syntax",message:Qe,error:Oe});else if(Sc(Qe))console.warn(`[stx] server <script> in ${k??"<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: ${Qe}`),E.onFailure?.({kind:"missing-binding",message:Qe,error:Oe});else{let ot=`${k??"<unknown>"}\x00${Qe}`;if(Zs.env.STX_DEBUG||!Am.has(ot))Am.add(ot),console.warn(`[stx] server <script> in ${k??"<unknown>"} threw, so every variable in that script is undefined and anything that reads one renders empty. Cause: ${Qe}`);E.onFailure?.({kind:"unknown",message:Qe,error:Oe})}try{await wS(B,_,k)}catch(ot){if(Zs.env.STX_DEBUG){let ht=ot instanceof Error?ot.message:String(ot);console.warn(`[stx] fallback extraction also failed in ${k??"<unknown>"}: ${ht}`)}}}}function kc(v){let _=0,k=null,E=!1,T=!1;for(let j=0;j<v.length;j++){let B=v[j];if(k){if(B===k){if(k=null,E||_===0)T=!0}continue}if(B==="'"||B==='"'||B==="`"){k=B;continue}if(B==="{")_++;else if(B==="}")_--;else if(v.startsWith("from",j)&&_===0)E=!0}return k===null&&_===0&&T}var hS=/^(?:export\s+)?(?:const|let|var)\s+[A-Za-z_$][\w$]*(?:\s*,\s*[A-Za-z_$][\w$]*)*\s*;?$/;function ps(v,_){let k=_?Ln.dirname(_):Zs.cwd(),E=Zs.cwd(),T=v.split(`
2061
2061
  `),j=[],B=0;while(B<T.length){let z=T[B].trim();if(z.startsWith("interface ")||z.startsWith("export interface ")||z.startsWith("type ")||z.startsWith("export type ")){if(z.includes("{")&&!z.includes("}")){let F=0;for(;B<T.length;B++){for(let V of T[B])if(V==="{")F++;else if(V==="}")F--;if(F<=0)break}}B++;continue}if(z.startsWith("definePageMeta(")){let F=0,V=!1,H=B;for(let ne=B;ne<T.length&&!V;ne++){let re=null,se=!1,ie=T[ne];for(let ae=0;ae<ie.length;ae++){let ue=ie[ae];if(se){se=!1;continue}if(ue==="\\"){se=!0;continue}if(re){if(ue===re)re=null;continue}if(ue==='"'||ue==="'"||ue==="`"){re=ue;continue}if(ue==="(")F++;else if(ue===")"){if(F--,F===0){B=ne+1,V=!0;break}}}}if(!V)B=T.length;let G=T.slice(H,B).join(`
2062
- `),J=[];for(let ne of["title","description"]){let re=new RegExp(`\\b${ne}\\s*:\\s*(['"\`])((?:\\\\.|(?!\\1)[^\\\\])*)\\1`).exec(G);if(re)J.push(`${ne}: ${JSON.stringify(re[2])}`)}if(J.length>0)j.push(`useSeoMeta({ ${J.join(", ")} });`);continue}if(z.startsWith("import ")||z==="import"||z.startsWith("import{")){let F=z,V=0;while(!kc(F)&&B+V+1<T.length)V++,F=`${F} ${T[B+V].trim()}`;B+=V;let H=F.match(/^import\s+(\w+)\s+from\s+['"](.+?)['"]/),G=F.match(/^import\s+\{([^}]*)\}\s+from\s+['"](.+?)['"]/),J=F.match(/^import\s+['"](.+?)['"]/),ne=F,re=(se)=>{if(se.startsWith("."))return Ln.resolve(k,se);if(se.startsWith("~/")||se.startsWith("@/"))return Ln.resolve(E,se.slice(2));return se};if(H){let[,se,ie]=H,ae=re(ie);j.push(`const ${se} = (await import('${ae}')).default`),j.push(`module.exports.${se} = ${se};`)}else if(G){let[,se,ie]=G,ae=re(ie),ue=[],oe=[],me=gS.has(ie);for(let we of se.split(",")){let $e=we.trim();if(!$e)continue;let _e=$e.split(/\s+as\s+/);if(_e.length===2){let[Re,Ee]=[_e[0].trim(),_e[1].trim()];if(me&&Em.has(Re)){j.push(`const ${Ee} = ${Re};`);continue}ue.push(`${Re}: ${Ee}`),oe.push(Ee)}else{if(me&&Em.has($e))continue;ue.push($e),oe.push($e)}}if(ue.length>0)j.push(`const { ${ue.join(", ")} } = await import('${ae}')`);for(let we of oe)j.push(`module.exports.${we} = ${we};`)}else if(J){let se=re(J[1]);j.push(`await import('${se}')`)}else j.push(ne);B++;continue}if(hS.test(z))j.push(T[B]),B++;else if(z.startsWith("export const ")||z.startsWith("export let ")||z.startsWith("export var ")){let F=Im(T,B),{type:V,name:H,value:G}=F;j.push(`${V} ${H} = ${G};`),j.push(`module.exports.${H} = ${H};`),B=F.nextIndex}else if(z.startsWith("export function ")||z.startsWith("export async function ")){let F=Zl(T,B);j.push(F.functionCode),j.push(`module.exports.${F.name} = ${F.name};`),B=F.nextIndex}else if(z.startsWith("const ")||z.startsWith("let ")||z.startsWith("var ")){let F=Im(T,B),{type:V,name:H,value:G}=F;j.push(`${V} ${H} = ${G};`),j.push(`module.exports.${H} = ${H};`),B=F.nextIndex}else if(z.startsWith("function ")||z.startsWith("async function ")){let F=Zl(T,B);j.push(F.functionCode),j.push(`module.exports.${F.name} = ${F.name};`),B=F.nextIndex}else if(z.startsWith("export default function ")||z.startsWith("export default async function ")){let F=T[B].replace(/^(\s*)export\s+default\s+/,"$1"),V=[...T];V[B]=F;let H=Zl(V,B);if(j.push(H.functionCode),H.name)j.push(`module.exports.default = ${H.name};`);B=H.nextIndex}else if(z.startsWith("export default ")){let F=z.replace(/^export\s+default\s+/,"").replace(/;$/,"");j.push(`module.exports.default = ${F};`),B++}else if(z.startsWith("class ")||z.startsWith("export class ")){let F=z.match(/(?:export\s+)?class\s+(\w+)/);if(F){let V=F[1],H=T[B].replace(/^export\s+/,""),G=0,J=B;for(;J<T.length;J++){let ne=T[J];for(let re of ne)if(re==="{")G++;else if(re==="}")G--;if(J>B)H+=`
2062
+ `),J=[];for(let ne of["title","description"]){let re=new RegExp(`\\b${ne}\\s*:\\s*(['"\`])((?:\\\\.|(?!\\1)[^\\\\])*)\\1`).exec(G);if(re)J.push(`${ne}: ${JSON.stringify(re[2])}`)}if(J.length>0)j.push(`useSeoMeta({ ${J.join(", ")} });`);continue}if(z.startsWith("import ")||z==="import"||z.startsWith("import{")){let F=z,V=0;while(!kc(F)&&B+V+1<T.length)V++,F=`${F} ${T[B+V].trim()}`;B+=V;let H=F.match(/^import\s+(\w+)\s+from\s+['"](.+?)['"]/),G=F.match(/^import\s+\{([^}]*)\}\s+from\s+['"](.+?)['"]/),J=F.match(/^import\s+['"](.+?)['"]/),ne=F,re=(se)=>{if(se.startsWith("."))return Ln.resolve(k,se);if(se.startsWith("~/")||se.startsWith("@/"))return Ln.resolve(E,se.slice(2));return se};if(H){let[,se,ie]=H,ae=re(ie);j.push(`const ${se} = (await import('${ae}')).default`),j.push(`module.exports.${se} = ${se};`)}else if(G){let[,se,ie]=G,ae=re(ie),ue=[],oe=[],me=gS.has(ie);for(let ve of se.split(",")){let $e=ve.trim();if(!$e)continue;let _e=$e.split(/\s+as\s+/);if(_e.length===2){let[Re,Ee]=[_e[0].trim(),_e[1].trim()];if(me&&Em.has(Re)){j.push(`const ${Ee} = ${Re};`);continue}ue.push(`${Re}: ${Ee}`),oe.push(Ee)}else{if(me&&Em.has($e))continue;ue.push($e),oe.push($e)}}if(ue.length>0)j.push(`const { ${ue.join(", ")} } = await import('${ae}')`);for(let ve of oe)j.push(`module.exports.${ve} = ${ve};`)}else if(J){let se=re(J[1]);j.push(`await import('${se}')`)}else j.push(ne);B++;continue}if(hS.test(z))j.push(T[B]),B++;else if(z.startsWith("export const ")||z.startsWith("export let ")||z.startsWith("export var ")){let F=Im(T,B),{type:V,name:H,value:G}=F;j.push(`${V} ${H} = ${G};`),j.push(`module.exports.${H} = ${H};`),B=F.nextIndex}else if(z.startsWith("export function ")||z.startsWith("export async function ")){let F=Zl(T,B);j.push(F.functionCode),j.push(`module.exports.${F.name} = ${F.name};`),B=F.nextIndex}else if(z.startsWith("const ")||z.startsWith("let ")||z.startsWith("var ")){let F=Im(T,B),{type:V,name:H,value:G}=F;j.push(`${V} ${H} = ${G};`),j.push(`module.exports.${H} = ${H};`),B=F.nextIndex}else if(z.startsWith("function ")||z.startsWith("async function ")){let F=Zl(T,B);j.push(F.functionCode),j.push(`module.exports.${F.name} = ${F.name};`),B=F.nextIndex}else if(z.startsWith("export default function ")||z.startsWith("export default async function ")){let F=T[B].replace(/^(\s*)export\s+default\s+/,"$1"),V=[...T];V[B]=F;let H=Zl(V,B);if(j.push(H.functionCode),H.name)j.push(`module.exports.default = ${H.name};`);B=H.nextIndex}else if(z.startsWith("export default ")){let F=z.replace(/^export\s+default\s+/,"").replace(/;$/,"");j.push(`module.exports.default = ${F};`),B++}else if(z.startsWith("class ")||z.startsWith("export class ")){let F=z.match(/(?:export\s+)?class\s+(\w+)/);if(F){let V=F[1],H=T[B].replace(/^export\s+/,""),G=0,J=B;for(;J<T.length;J++){let ne=T[J];for(let re of ne)if(re==="{")G++;else if(re==="}")G--;if(J>B)H+=`
2063
2063
  `+ne;if(G<=0&&J>=B)break}j.push(H),j.push(`module.exports.${V} = ${V};`),B=J+1}else j.push(z),B++}else if(z.includes("module.exports"))j.push(z),B++;else if(z.trim()&&!z.startsWith("//"))j.push(z),B++;else B++}return yS(j.join(`
2064
2064
  `),k,E)}function yS(v,_,k){let E=v.length,T="",j=0,B=null,z=!1,F=!1,V=0;while(j<E){let H=v[j],G=v[j+1];if(z){if(T+=H,H===`
2065
- `)z=!1;j++;continue}if(F){if(T+=H,H==="*"&&G==="/"){T+=G,j+=2,F=!1;continue}j++;continue}if(!B&&H==="/"&&G==="/"){z=!0,T+=H,j++;continue}if(!B&&H==="/"&&G==="*"){F=!0,T+=H,j++;continue}if(B){if(T+=H,H==="\\"){T+=G,j+=2;continue}if(H===B&&B!=="`"){B=null,j++;continue}if(B==="`"){if(H==="$"&&G==="{"){V++,T+=G,j+=2;continue}if(H==="`"){B=null,j++;continue}}j++;continue}if(V>0){if(H==="{")V++;else if(H==="}")V--}if(H==='"'||H==="'"||H==="`"){B=H,T+=H,j++;continue}if(H==="a"&&v.startsWith("await",j)){let J=xS(v,j);if(J){let{quote:ne,path:re,end:se}=J;if(re.startsWith(".")||re.startsWith("~/")||re.startsWith("@/")){let ie=re.startsWith(".")?Ln.resolve(_,re):Ln.resolve(k,re.slice(2));T+=`await import(${ne}${ie}${ne})`,j=se;continue}}}T+=H,j++}return T}function xS(v,_){let k=_+5;if(k>=v.length)return null;if(!/\s/.test(v[k]))return null;while(k<v.length&&/\s/.test(v[k]))k++;if(!v.startsWith("import",k))return null;k+=6;while(k<v.length&&/\s/.test(v[k]))k++;if(v[k]!=="(")return null;k++;while(k<v.length&&/\s/.test(v[k]))k++;let E=v[k];if(E!=="'"&&E!=='"')return null;k++;let T=k;while(k<v.length&&v[k]!==E)if(v[k]==="\\")k+=2;else k++;if(k>=v.length)return null;let j=v.slice(T,k);k++;while(k<v.length&&/\s/.test(v[k]))k++;if(v[k]!==")")return null;return{quote:E,path:j,end:k+1}}function Mm(v,_){let k=v[_];if(k!=="{"&&k!=="[")return null;let T=S(v,k,k==="{"?"}":"]",_);if(T===-1)return null;return{pattern:v.slice(_,T+1),endPos:T+1}}function Nm(v){let _=[],k=v.slice(1,-1).trim();if(!k)return _;let E=0,T=0,j="";while(E<k.length){let B=k[E];if(B==="{"||B==="["){let z=T===0?Mm(k,E):null;if(z){_.push(...Nm(z.pattern)),E=z.endPos,j="";continue}T++}else if(B==="}"||B==="]")T--;if(T>0){E++;continue}if(B===","){if(j.trim())_.push(j.trim());j="",E++;continue}if(B===":"){j="",E++;continue}if(B==="="){if(j.trim())_.push(j.trim());j="",E++;while(E<k.length&&k[E]!==","&&T===0){if(k[E]==="{"||k[E]==="[")T++;else if(k[E]==="}"||k[E]==="]")T--;E++}continue}if(/[\w$]/.test(B))j+=B;E++}if(j.trim())_.push(j.trim());return _}function Cc(v){let _=/^(?:export\s+)?(const|let|var)\s+([A-Za-z_$][\w$]*)/.exec(v);if(!_)return null;let k=_[0].length,E=(T)=>T===" "||T==="\t";while(k<v.length&&E(v[k]))k++;if(v[k]===":"){let T=0,j=null;k++;for(;k<v.length;k++){let B=v[k];if(j){if(B==="\\"){k++;continue}if(B===j)j=null;continue}if(B==="'"||B==='"'||B==="`"){j=B;continue}if(B==="("||B==="["||B==="{"||B==="<"){T++;continue}if(B===")"||B==="]"||B==="}"||B===">"){T--;continue}if(B==="="&&T<=0){let z=v[k+1],F=v[k-1];if(z!=="="&&z!==">"&&F!=="="&&F!=="!"&&F!=="<"&&F!==">")break}}if(v[k]!=="=")return null}while(k<v.length&&E(v[k]))k++;if(v[k]!=="=")return null;return{type:_[1],name:_[2],value:v.slice(k+1).trim()}}function Tm(v,_,k,E){let T=null,j=!1;for(let B of v){if(j){j=!1;continue}if(B==="\\"){j=!0;continue}if(T){if(B===T)T=null;continue}if(B==="'"||B==='"'||B==="`"){T=B;continue}if(B===_)E++;else if(B===k)E--}return E}function Im(v,_){let k=v[_].trim(),E=Cc(k),T=E?[k,E.type,E.name,E.value]:null;if(!T){let H=k.match(/^(?:export\s+)?(const|let|var)\s+/);if(H){let G=k.slice(H[0].length),J=_;if(G.startsWith("{")||G.startsWith("[")){let re=G[0],se=re==="{"?"}":"]",ie=Tm(G,re,se,0),ae=G;for(let ue=_+1;ue<v.length&&ie>0;ue++)ae+=` ${v[ue].trim()}`,J=ue,ie=Tm(v[ue],re,se,ie);if(ie>0)ae=G,J=_;G=ae}let ne=Mm(G,0);if(ne){let re=H[1],se=ne.pattern,ie=G.slice(ne.endPos).trim();if(ie.startsWith("=")){let ae=ie.slice(1).trim(),ue=ae,oe=Math.max(J,_);if(Pm(ae)){let _e=Dm(v,oe,ae);ue=_e.value,oe=_e.nextIndex}else oe=oe+1;ue=ue.trim().replace(/;$/,"");let me=Nm(se),we=`__stx_src_${_}`,$e=me.map((_e)=>`module.exports.${_e} = ${_e};`).join(`
2066
- `);return{type:re,name:we,value:`${ue}; ${re} ${se} = ${we};
2065
+ `)z=!1;j++;continue}if(F){if(T+=H,H==="*"&&G==="/"){T+=G,j+=2,F=!1;continue}j++;continue}if(!B&&H==="/"&&G==="/"){z=!0,T+=H,j++;continue}if(!B&&H==="/"&&G==="*"){F=!0,T+=H,j++;continue}if(B){if(T+=H,H==="\\"){T+=G,j+=2;continue}if(H===B&&B!=="`"){B=null,j++;continue}if(B==="`"){if(H==="$"&&G==="{"){V++,T+=G,j+=2;continue}if(H==="`"){B=null,j++;continue}}j++;continue}if(V>0){if(H==="{")V++;else if(H==="}")V--}if(H==='"'||H==="'"||H==="`"){B=H,T+=H,j++;continue}if(H==="a"&&v.startsWith("await",j)){let J=xS(v,j);if(J){let{quote:ne,path:re,end:se}=J;if(re.startsWith(".")||re.startsWith("~/")||re.startsWith("@/")){let ie=re.startsWith(".")?Ln.resolve(_,re):Ln.resolve(k,re.slice(2));T+=`await import(${ne}${ie}${ne})`,j=se;continue}}}T+=H,j++}return T}function xS(v,_){let k=_+5;if(k>=v.length)return null;if(!/\s/.test(v[k]))return null;while(k<v.length&&/\s/.test(v[k]))k++;if(!v.startsWith("import",k))return null;k+=6;while(k<v.length&&/\s/.test(v[k]))k++;if(v[k]!=="(")return null;k++;while(k<v.length&&/\s/.test(v[k]))k++;let E=v[k];if(E!=="'"&&E!=='"')return null;k++;let T=k;while(k<v.length&&v[k]!==E)if(v[k]==="\\")k+=2;else k++;if(k>=v.length)return null;let j=v.slice(T,k);k++;while(k<v.length&&/\s/.test(v[k]))k++;if(v[k]!==")")return null;return{quote:E,path:j,end:k+1}}function Mm(v,_){let k=v[_];if(k!=="{"&&k!=="[")return null;let T=S(v,k,k==="{"?"}":"]",_);if(T===-1)return null;return{pattern:v.slice(_,T+1),endPos:T+1}}function Nm(v){let _=[],k=v.slice(1,-1).trim();if(!k)return _;let E=0,T=0,j="";while(E<k.length){let B=k[E];if(B==="{"||B==="["){let z=T===0?Mm(k,E):null;if(z){_.push(...Nm(z.pattern)),E=z.endPos,j="";continue}T++}else if(B==="}"||B==="]")T--;if(T>0){E++;continue}if(B===","){if(j.trim())_.push(j.trim());j="",E++;continue}if(B===":"){j="",E++;continue}if(B==="="){if(j.trim())_.push(j.trim());j="",E++;while(E<k.length&&k[E]!==","&&T===0){if(k[E]==="{"||k[E]==="[")T++;else if(k[E]==="}"||k[E]==="]")T--;E++}continue}if(/[\w$]/.test(B))j+=B;E++}if(j.trim())_.push(j.trim());return _}function Cc(v){let _=/^(?:export\s+)?(const|let|var)\s+([A-Za-z_$][\w$]*)/.exec(v);if(!_)return null;let k=_[0].length,E=(T)=>T===" "||T==="\t";while(k<v.length&&E(v[k]))k++;if(v[k]===":"){let T=0,j=null;k++;for(;k<v.length;k++){let B=v[k];if(j){if(B==="\\"){k++;continue}if(B===j)j=null;continue}if(B==="'"||B==='"'||B==="`"){j=B;continue}if(B==="("||B==="["||B==="{"||B==="<"){T++;continue}if(B===")"||B==="]"||B==="}"||B===">"){T--;continue}if(B==="="&&T<=0){let z=v[k+1],F=v[k-1];if(z!=="="&&z!==">"&&F!=="="&&F!=="!"&&F!=="<"&&F!==">")break}}if(v[k]!=="=")return null}while(k<v.length&&E(v[k]))k++;if(v[k]!=="=")return null;return{type:_[1],name:_[2],value:v.slice(k+1).trim()}}function Tm(v,_,k,E){let T=null,j=!1;for(let B of v){if(j){j=!1;continue}if(B==="\\"){j=!0;continue}if(T){if(B===T)T=null;continue}if(B==="'"||B==='"'||B==="`"){T=B;continue}if(B===_)E++;else if(B===k)E--}return E}function Im(v,_){let k=v[_].trim(),E=Cc(k),T=E?[k,E.type,E.name,E.value]:null;if(!T){let H=k.match(/^(?:export\s+)?(const|let|var)\s+/);if(H){let G=k.slice(H[0].length),J=_;if(G.startsWith("{")||G.startsWith("[")){let re=G[0],se=re==="{"?"}":"]",ie=Tm(G,re,se,0),ae=G;for(let ue=_+1;ue<v.length&&ie>0;ue++)ae+=` ${v[ue].trim()}`,J=ue,ie=Tm(v[ue],re,se,ie);if(ie>0)ae=G,J=_;G=ae}let ne=Mm(G,0);if(ne){let re=H[1],se=ne.pattern,ie=G.slice(ne.endPos).trim();if(ie.startsWith("=")){let ae=ie.slice(1).trim(),ue=ae,oe=Math.max(J,_);if(Pm(ae)){let _e=Dm(v,oe,ae);ue=_e.value,oe=_e.nextIndex}else oe=oe+1;ue=ue.trim().replace(/;$/,"");let me=Nm(se),ve=`__stx_src_${_}`,$e=me.map((_e)=>`module.exports.${_e} = ${_e};`).join(`
2066
+ `);return{type:re,name:ve,value:`${ue}; ${re} ${se} = ${ve};
2067
2067
  ${$e}`,nextIndex:oe}}}}throw Error(`Failed to parse variable declaration: ${k}`)}let[,j,B,z]=T,F=z,V=_;if(Pm(z)){let H=Dm(v,_,z);F=H.value,V=H.nextIndex}else V=_+1;while(V<v.length){let H=v[V].trim();if(H.startsWith(".")||H.startsWith("?."))F+=`
2068
2068
  ${v[V]}`,V++;else break}return F=F.trim().replace(/;$/,""),{type:j,name:B,value:F,nextIndex:V}}function Zl(v,_){let k=v[_].trim(),E=k.match(/^(?:export\s+)?(?:async\s+)?function\s+(\w+)/);if(!E)throw Error(`Failed to parse function declaration: ${k}`);let[,T]=E,j=k.replace(/^export\s+/,""),B=_;if(bS(k)){let z=vS(v,_,j);j=z.functionCode,B=z.nextIndex}else B=_+1;return{name:T,functionCode:j,nextIndex:B}}function Pm(v){let _=v.trim();if(_.startsWith("{"))return S(_,"{","}",0)===-1;if(_.startsWith("["))return S(_,"[","]",0)===-1;return!jm(_)}function jm(v){let _={paren:0,bracket:0,brace:0},k=null,E=0;for(let T=0;T<v.length;T++){let j=v[T];if((T>0?v[T-1]:"")==="\\"&&k)continue;if((j==='"'||j==="'")&&!k){k=j;continue}if(j===k&&k!=="`"){k=null;continue}if(j==="`"&&!k){k="`";continue}if(j==="`"&&k==="`"&&E===0){k=null;continue}if(k==="`"&&j==="$"&&v[T+1]==="{"){E++,T++;continue}if(E>0&&j==="{"){E++;continue}if(E>0&&j==="}"){E--;continue}if(k)continue;if(j==="(")_.paren++;else if(j===")")_.paren--;else if(j==="[")_.bracket++;else if(j==="]")_.bracket--;else if(j==="{")_.brace++;else if(j==="}")_.brace--}return _.paren===0&&_.bracket===0&&_.brace===0&&k===null}function Lm(v){let _=v.indexOf("(");if(_===-1)return v.indexOf("{");let k=S(v,"(",")",_);if(k===-1)return-1;return v.indexOf("{",k)}function bS(v){let _=Lm(v);if(_===-1)return!0;return S(v,"{","}",_)===-1}function Dm(v,_,k){let E=k,T=_+1;while(T<v.length&&!jm(E)){let j=v[T];E+=`
2069
2069
  ${j}`,T++}while(T<v.length){let j=v[T].trim();if(j.startsWith(".")||j.startsWith("?."))E+=`
2070
2070
  ${v[T]}`,T++;else break}return{value:E,nextIndex:T}}function vS(v,_,k){let E=k,T=_+1;while(T<v.length){let j=Lm(E);if(j!==-1){if(S(E,"{","}",j)!==-1)break}let B=v[T];E+=`
2071
2071
  ${B}`,T++}return{functionCode:E,nextIndex:T}}function Om(v,_){let k=c(v,_)??c(`(${v})`,_);if(k!==void 0)return k;if(!/\bprocess\b/.test(v))return;let E={..._,process:Object.freeze({env:{...Zs.env}})},T=Object.keys(E).filter(Ze),j=T.map((B)=>E[B]);try{return Function(...T,`'use strict'; return (${v});`)(...j)}catch{try{return Function(...T,`'use strict'; return ${v};`)(...j)}catch{return}}}async function wS(v,_,k){let E=v.matchAll(/export\s+(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:export\s+|$))/g);for(let j of E){let[,,B,z]=j;try{let F=z.trim().replace(/;$/,""),V=Om(F,_);if(V!==void 0)_[B]=V}catch(F){console.warn(`Failed to parse export ${B} in fallback:`,F)}}let T=v.matchAll(/(?:^|\n)\s*(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:(?:const|let|var|function|export)\s+|$))/g);for(let j of T){let[,,B,z]=j;if(!(B in _))try{let F=z.trim().replace(/;$/,""),V=Om(F,_);if(V!==void 0)_[B]=V}catch{}}}function ci(v){let _=v.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),k=_?_[1]:"",E=_?v.replace(/<script\b[^>]*>[\s\S]*?<\/script>/i,""):v;return{scriptContent:k,templateWithoutScript:E}}function li(v){let _=v.trim();if(!_)return!1;return/(?:const|let|var|function)\s+\w+/.test(_)}var eo=new M(500),ya=new M(1000),Jl=new M(2000),Yl=new M(500),qm=33554432,Ql=qm;function SS(v){let _=v.componentRenderCacheBytes;if(typeof _!=="number"||_<0||_===Ql)return;Ql=_,xa.setMaxBytes(_)}var xa=new M(2000,{maxBytes:qm,sizeOf:(v)=>v.output.length});function $S(v){let _=new WeakSet;try{let k=(E)=>{if(E===void 0)return{__stxType:"undefined"};if(typeof E==="bigint")return{__stxType:"bigint",value:E.toString()};if(typeof E==="function"||typeof E==="symbol")throw TypeError("Non-serializable component input");if(E===null||typeof E!=="object")return E;if(_.has(E))throw TypeError("Circular component input");_.add(E);try{if(E instanceof Date)return{__stxType:"date",value:E.toISOString()};if(Array.isArray(E))return E.map(k);let T=Object.getPrototypeOf(E);if(T!==Object.prototype&&T!==null)throw TypeError("Non-plain component input");let j={};for(let B of Object.keys(E).sort())j[B]=k(E[B]);return j}finally{_.delete(E)}};return JSON.stringify(k(v))}catch{return null}}function _S(v){let _={};for(let[k,E]of Object.entries(v))if(!k.startsWith("__")||k==="__stxServeContext")_[k]=E;return _}function Bm(v){return v.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Ic(v){return/\bjs\b/.test(v)||/\blang\s*=\s*["']?(js|javascript)["']?/i.test(v)}function Ue(v){return!Ic(v)}var ha=new Map;function L(v){let _;try{_=JSON.stringify(v)}catch{return new Bun.Transpiler(v)}let k=ha.get(_);if(k)return k;if(ha.size>=16)ha.clear();let E=new Bun.Transpiler(v);return ha.set(_,E),E}var zm=new WeakMap,kS=256;function We(v){try{let _=L({loader:"ts",target:"browser",define:w()}),k=zm.get(_);if(!k)k=new Map,zm.set(_,k);let E=k.get(v);if(E!==void 0)return E;let T=v.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");T=T.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");let j=[];T=T.replace(/\{!![\s\S]*?!!\}/g,(z)=>{let F=j.length;return j.push(z),`"__STX_EXPR_${F}__"`}),T=T.replace(/\{\{\{[\s\S]*?\}\}\}/g,(z)=>{let F=j.length;return j.push(z),`"__STX_EXPR_${F}__"`}),T=T.replace(/\{\{[\s\S]*?\}\}/g,(z)=>{let F=j.length;return j.push(z),`"__STX_EXPR_${F}__"`});let B=_.transformSync(T);for(let z=0;z<j.length;z++)B=B.replace(`"__STX_EXPR_${z}__"`,j[z]),B=B.replace(`'__STX_EXPR_${z}__'`,j[z]);if(k.size>=kS){let z=k.keys().next();if(!z.done)k.delete(z.value)}return k.set(v,B),B}catch(_){if(process.env.STX_DEBUG_TS)console.warn("[STX] TypeScript transpilation error:",_);return v}}function ES(v){let _=[],k=new Set,E=0,T=0,j=v.length,B=(H)=>{T++;while(T<j){if(v[T]==="\\"){T+=2;continue}if(v[T]===H){T++;return}T++}},z=()=>{T++;while(T<j){if(v[T]==="\\"){T+=2;continue}if(v[T]==="`"){T++;return}if(v[T]==="$"&&v[T+1]==="{"){T+=2;let H=1;while(T<j&&H>0)if(v[T]==="{")H++,T++;else if(v[T]==="}")H--,T++;else if(v[T]==="'"||v[T]==='"')B(v[T]);else if(v[T]==="`")z();else T++;continue}T++}},F=()=>{if(v[T]==="/"&&v[T+1]==="/"){while(T<j&&v[T]!==`
2072
- `)T++;return!0}if(v[T]==="/"&&v[T+1]==="*"){T+=2;while(T<j-1&&!(v[T]==="*"&&v[T+1]==="/"))T++;return T+=2,!0}return!1},V=()=>{if(E!==0)return;let H=v.slice(T).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(H){let re=H[2].split(",").map((se)=>{let ie=se.trim().split(":");return ie[ie.length-1].trim()});for(let se of re)if(se&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(se)&&!k.has(se))_.push(se),k.add(se);return}let G=v.slice(T).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(G){let re=G[2];if(!k.has(re))_.push(re),k.add(re);return}let J=v.slice(T).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(J){let re=J[1];if(!k.has(re))_.push(re),k.add(re);return}let ne=v.slice(T).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(ne){let re=ne[1];if(!k.has(re))_.push(re),k.add(re)}};while(T<j){if(F())continue;if(v[T]==="'"||v[T]==='"'){B(v[T]);continue}if(v[T]==="`"){z();continue}if(v[T]==="{"){E++,T++;continue}if(v[T]==="}"){E--,T++;continue}if(E===0&&/[a-z]/i.test(v[T])&&(T===0||/\s|[;{}()]/.test(v[T-1])))V();T++}return _}function CS(v){let _=[],k=0,E=0,T=null;for(let j=0;j<v.length;j++){let B=v[j];if(T){if(B==="\\"){j++;continue}if(B===T)T=null;continue}if(B==='"'||B==="'"||B==="`"){T=B;continue}if(B==="("||B==="["||B==="{")k++;else if(B===")"||B==="]"||B==="}")k--;else if(B===","&&k===0)_.push(v.slice(E,j)),E=j+1}if(E<v.length)_.push(v.slice(E));return _}function RS(v){let _=0,k=null;for(let E=0;E<v.length;E++){let T=v[E];if(k){if(T==="\\"){E++;continue}if(T===k)k=null;continue}if(T==='"'||T==="'"||T==="`"){k=T;continue}if(T==="("||T==="["||T==="{")_++;else if(T===")"||T==="]"||T==="}")_--;else if(T==="="&&_===0){let j=v[E-1],B=v[E+1];if(j==="!"||j==="<"||j===">"||j==="=")continue;if(B==="="||B===">")continue;return E}}return-1}function AS(v,_){try{let k=/=\s*(?:withDefaults\s*\([\s\S]*?defineProps|defineProps)\b/.exec(v);if(!k)return;let E=k.index-1;while(E>=0&&/\s/.test(v[E]))E--;if(v[E]!=="}")return;let T=E,j=0,B=-1;for(;E>=0;E--){let F=v[E];if(F==="}")j++;else if(F==="{"){if(j--,j===0){B=E;break}}}if(B===-1)return;let z=v.slice(B+1,T);for(let F of CS(z)){let V=F.trim();if(!V||V.startsWith("..."))continue;let H=RS(V);if(H===-1)continue;let G=V.slice(0,H).trim();if(!/^[A-Z_$][\w$]*$/i.test(G))continue;if(_[G]!==void 0)continue;let J=V.slice(H+1).trim();if(!J)continue;try{let ne=Object.keys(_).filter(Ze),re=Function(...ne,`"use strict"; return (${J});`);_[G]=re(...ne.map((se)=>_[se]))}catch{}}}catch{}}var TS=new Set(["tr","td","th","thead","tbody","tfoot","caption","colgroup","col","option","optgroup","li","dt","dd","span"]);function Dc(v,_){let k=v.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)<([a-zA-Z][a-zA-Z0-9-]*)/s);if(!k)return null;let E=k[2].toLowerCase();if(!TS.has(E))return null;let T=new RegExp(`<\\/?${E}(?=[\\s/>])(?:[^>"']|"[^"]*"|'[^']*')*>`,"iy"),j=gr(v,(V,H)=>(T.lastIndex=H,T.exec(V)?.index===H?T.lastIndex:-1));if(E==="span"&&/\sdata-stx-scope\s*=/.test(j[0]?.token||""))return null;let B=0,z=!1;for(let V of j){if(B+=V.token.startsWith("</")?-1:1,B<0)return null;if(B===0){if(v.slice(V.end).trim())return null;z=!0;break}}if(!z)return null;let F=k[0].length;return v.slice(0,F)+_+v.slice(F)}async function Xn(v,_,k,E,T){let j=v.endsWith(".stx")?v.slice(0,-4):v,B=(we)=>we.split("-").map(($e)=>$e.charAt(0).toUpperCase()+$e.slice(1)).join(""),z=(we)=>we.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),F=k.__importedComponents;if(F){for(let we of[j,j.toLowerCase(),B(j),z(j)])if(F.has(we))return!0}let V=[...new Set([`${j}.stx`,`${B(j)}.stx`,`${z(j)}.stx`])],H=typeof T.root==="string"?rt.resolve(T.root):void 0,G=H??rt.dirname(E),J=[],ne=(we)=>{if(we&&!J.includes(we))J.push(we)},re=k.__originalFilePath;if(re)ne(rt.join(rt.dirname(re),"components"));ne(_),ne(T._rootComponentsDir),ne(rt.join(rt.dirname(E),"components")),ne(T.componentsDir);for(let we of T._targetComponentDirs??[])ne(we);if(H)ne(rt.resolve(H,"resources/views/components")),ne(rt.resolve(H,"resources/components")),ne(rt.resolve(H,"src/components")),ne(rt.resolve(H,"components"));for(let we of T._layerComponentDirs??[])ne(we);let se=T._pluginComponentDirs;if(Array.isArray(se))for(let we of se)ne(typeof we==="string"?we:null);if(ne(T.fallbackComponentsDir),j.startsWith("./")||j.startsWith("../"))return r(rt.resolve(rt.dirname(E),`${j}.stx`));let ie=Wm(rt.resolve(import.meta.dir,"components")),ae=J.map((we)=>rt.isAbsolute(we)?we:rt.resolve(G,we)),ue=`${V.join("\x00")}\x00\x00${ae.join("\x00")}`,oe=Jl.get(ue);if(oe!==void 0)return oe;let me=!1;e:for(let we of ae){if(Wm(we)===ie)continue;for(let $e of V)if(await r(rt.join(we,$e))){me=!0;break e}}return Jl.set(ue,me),me}function Wm(v){let _=Yl.get(v);if(_!==void 0)return _;let k=v;try{k=Hm.realpathSync(v)}catch{}return Yl.set(v,k),k}function Oc(v){return v==="visible"||v==="idle"||v==="interaction"||v.startsWith("media:")}function fi(v){if(!v)return!1;let _=v.replace(/<script[\s\S]*?<\/script>/gi,"").replace(/<style[\s\S]*?<\/style>/gi,"");return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(_)}function IS(v,_,k){if(!v.includes("{{")&&!v.includes("{!!"))return v;let E=(T,j)=>{let B;try{B=x(T,_)}catch{return j}if(B===void 0||B===null)return"";let z=String(B);if(/<\/style/i.test(z))return console.warn(`[stx] a <style> expression in ${k??"<unknown>"} evaluated to CSS containing a closing style tag, which would end the element early, so it was dropped rather than emitted.`),"";return z};return v.replace(/\{!!([\s\S]*?)!!\}/g,(T,j)=>E(j,T)).replace(/\{\{([\s\S]*?)\}\}/g,(T,j)=>E(j,T))}var Fm=new Set;function Vm(v,_,k,E){let T=`${v}\x00${_}\x00${E??""}`;if(!process.env.STX_DEBUG&&Fm.has(T))return;Fm.add(T);let j=_?` used in ${_}`:"",B=E?` Cause: ${E}.`:"",z=k.length>0?`
2072
+ `)T++;return!0}if(v[T]==="/"&&v[T+1]==="*"){T+=2;while(T<j-1&&!(v[T]==="*"&&v[T+1]==="/"))T++;return T+=2,!0}return!1},V=()=>{if(E!==0)return;let H=v.slice(T).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(H){let re=H[2].split(",").map((se)=>{let ie=se.trim().split(":");return ie[ie.length-1].trim()});for(let se of re)if(se&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(se)&&!k.has(se))_.push(se),k.add(se);return}let G=v.slice(T).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(G){let re=G[2];if(!k.has(re))_.push(re),k.add(re);return}let J=v.slice(T).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(J){let re=J[1];if(!k.has(re))_.push(re),k.add(re);return}let ne=v.slice(T).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(ne){let re=ne[1];if(!k.has(re))_.push(re),k.add(re)}};while(T<j){if(F())continue;if(v[T]==="'"||v[T]==='"'){B(v[T]);continue}if(v[T]==="`"){z();continue}if(v[T]==="{"){E++,T++;continue}if(v[T]==="}"){E--,T++;continue}if(E===0&&/[a-z]/i.test(v[T])&&(T===0||/\s|[;{}()]/.test(v[T-1])))V();T++}return _}function CS(v){let _=[],k=0,E=0,T=null;for(let j=0;j<v.length;j++){let B=v[j];if(T){if(B==="\\"){j++;continue}if(B===T)T=null;continue}if(B==='"'||B==="'"||B==="`"){T=B;continue}if(B==="("||B==="["||B==="{")k++;else if(B===")"||B==="]"||B==="}")k--;else if(B===","&&k===0)_.push(v.slice(E,j)),E=j+1}if(E<v.length)_.push(v.slice(E));return _}function RS(v){let _=0,k=null;for(let E=0;E<v.length;E++){let T=v[E];if(k){if(T==="\\"){E++;continue}if(T===k)k=null;continue}if(T==='"'||T==="'"||T==="`"){k=T;continue}if(T==="("||T==="["||T==="{")_++;else if(T===")"||T==="]"||T==="}")_--;else if(T==="="&&_===0){let j=v[E-1],B=v[E+1];if(j==="!"||j==="<"||j===">"||j==="=")continue;if(B==="="||B===">")continue;return E}}return-1}function AS(v,_){try{let k=/=\s*(?:withDefaults\s*\([\s\S]*?defineProps|defineProps)\b/.exec(v);if(!k)return;let E=k.index-1;while(E>=0&&/\s/.test(v[E]))E--;if(v[E]!=="}")return;let T=E,j=0,B=-1;for(;E>=0;E--){let F=v[E];if(F==="}")j++;else if(F==="{"){if(j--,j===0){B=E;break}}}if(B===-1)return;let z=v.slice(B+1,T);for(let F of CS(z)){let V=F.trim();if(!V||V.startsWith("..."))continue;let H=RS(V);if(H===-1)continue;let G=V.slice(0,H).trim();if(!/^[A-Z_$][\w$]*$/i.test(G))continue;if(_[G]!==void 0)continue;let J=V.slice(H+1).trim();if(!J)continue;try{let ne=Object.keys(_).filter(Ze),re=Function(...ne,`"use strict"; return (${J});`);_[G]=re(...ne.map((se)=>_[se]))}catch{}}}catch{}}var TS=new Set(["tr","td","th","thead","tbody","tfoot","caption","colgroup","col","option","optgroup","li","dt","dd","span"]);function Dc(v,_){let k=v.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)<([a-zA-Z][a-zA-Z0-9-]*)/s);if(!k)return null;let E=k[2].toLowerCase();if(!TS.has(E))return null;let T=new RegExp(`<\\/?${E}(?=[\\s/>])(?:[^>"']|"[^"]*"|'[^']*')*>`,"iy"),j=gr(v,(V,H)=>(T.lastIndex=H,T.exec(V)?.index===H?T.lastIndex:-1));if(E==="span"&&/\sdata-stx-scope\s*=/.test(j[0]?.token||""))return null;let B=0,z=!1;for(let V of j){if(B+=V.token.startsWith("</")?-1:1,B<0)return null;if(B===0){if(v.slice(V.end).trim())return null;z=!0;break}}if(!z)return null;let F=k[0].length;return v.slice(0,F)+_+v.slice(F)}async function Xn(v,_,k,E,T){let j=v.endsWith(".stx")?v.slice(0,-4):v,B=(ve)=>ve.split("-").map(($e)=>$e.charAt(0).toUpperCase()+$e.slice(1)).join(""),z=(ve)=>ve.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),F=k.__importedComponents;if(F){for(let ve of[j,j.toLowerCase(),B(j),z(j)])if(F.has(ve))return!0}let V=[...new Set([`${j}.stx`,`${B(j)}.stx`,`${z(j)}.stx`])],H=typeof T.root==="string"?rt.resolve(T.root):void 0,G=H??rt.dirname(E),J=[],ne=(ve)=>{if(ve&&!J.includes(ve))J.push(ve)},re=k.__originalFilePath;if(re)ne(rt.join(rt.dirname(re),"components"));ne(_),ne(T._rootComponentsDir),ne(rt.join(rt.dirname(E),"components")),ne(T.componentsDir);for(let ve of T._targetComponentDirs??[])ne(ve);if(H)ne(rt.resolve(H,"resources/views/components")),ne(rt.resolve(H,"resources/components")),ne(rt.resolve(H,"src/components")),ne(rt.resolve(H,"components"));for(let ve of T._layerComponentDirs??[])ne(ve);let se=T._pluginComponentDirs;if(Array.isArray(se))for(let ve of se)ne(typeof ve==="string"?ve:null);if(ne(T.fallbackComponentsDir),j.startsWith("./")||j.startsWith("../"))return r(rt.resolve(rt.dirname(E),`${j}.stx`));let ie=Wm(rt.resolve(import.meta.dir,"components")),ae=J.map((ve)=>rt.isAbsolute(ve)?ve:rt.resolve(G,ve)),ue=`${V.join("\x00")}\x00\x00${ae.join("\x00")}`,oe=Jl.get(ue);if(oe!==void 0)return oe;let me=!1;e:for(let ve of ae){if(Wm(ve)===ie)continue;for(let $e of V)if(await r(rt.join(ve,$e))){me=!0;break e}}return Jl.set(ue,me),me}function Wm(v){let _=Yl.get(v);if(_!==void 0)return _;let k=v;try{k=Hm.realpathSync(v)}catch{}return Yl.set(v,k),k}function Oc(v){return v==="visible"||v==="idle"||v==="interaction"||v.startsWith("media:")}function fi(v){if(!v)return!1;let _=v.replace(/<script[\s\S]*?<\/script>/gi,"").replace(/<style[\s\S]*?<\/style>/gi,"");return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(_)}function IS(v,_,k){if(!v.includes("{{")&&!v.includes("{!!"))return v;let E=(T,j)=>{let B;try{B=x(T,_)}catch{return j}if(B===void 0||B===null)return"";let z=String(B);if(/<\/style/i.test(z))return console.warn(`[stx] a <style> expression in ${k??"<unknown>"} evaluated to CSS containing a closing style tag, which would end the element early, so it was dropped rather than emitted.`),"";return z};return v.replace(/\{!!([\s\S]*?)!!\}/g,(T,j)=>E(j,T)).replace(/\{\{([\s\S]*?)\}\}/g,(T,j)=>E(j,T))}var Fm=new Set;function Vm(v,_,k,E){let T=`${v}\x00${_}\x00${E??""}`;if(!process.env.STX_DEBUG&&Fm.has(T))return;Fm.add(T);let j=_?` used in ${_}`:"",B=E?` Cause: ${E}.`:"",z=k.length>0?`
2073
2073
  searched:
2074
2074
  ${k.map((F)=>` - ${F}`).join(`
2075
- `)}`:"";console.error(`[stx] component <${v}> could not be resolved${j}, so it rendered as nothing.${B}${z}`)}function Um(v){return`<!-- stx: component "${v.replace(/--+/g,"-")}" could not be resolved; see the server log -->`}function Mc(v){let _=new Set,k=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal|useModel|useReactiveProp|useLocalStorage|useSessionStorage|keptState|useCookie|useDebouncedValue)\s*(?:<[^>]*>)?\s*\(/g;for(let E of v){let T;while((T=k.exec(E))!==null)_.add(T[1]);k.lastIndex=0}return[..._]}async function qe(v,_,k,E,T,j,B,z=new Set,F,V=mr(T),H){let{extractVariables:G}=await mt("stx/variable-extractor",()=>import("./chunk-vgkjmrf3.js")),J=z??new Set;if(J.has(v))return`[Circular component reference: ${v}]`;let ne=new Set(J);ne.add(v);let re=typeof _.client==="string"?_.client.trim():"";if("client"in _)delete _.client;let se=re&&re!=="load"&&Oc(re)?re:"";try{let ie=(tt)=>tt.split("-").map((it)=>it.charAt(0).toUpperCase()+it.slice(1)).join(""),ae=(tt)=>tt.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),ue=v.endsWith(".stx")?v.slice(0,-4):v,oe=null,me=T.__importedComponents;if(me){let tt=[ue,ue.toLowerCase(),ie(ue),ae(ue)];for(let it of tt)if(me.has(it)){oe=me.get(it);break}}let we=[];if(!oe){let tt=[`${ue}.stx`,`${ie(ue)}.stx`,`${ae(ue)}.stx`],it=[...new Set(tt)],vt=T.__originalFilePath,pt=[];if(pt.push(...B._layerComponentDirs??[]),vt){let Nt=rt.join(rt.dirname(vt),"components");pt.push(Nt)}if(E)pt.push(E);let lt=B._rootComponentsDir;if(typeof lt==="string"&&!pt.includes(lt))pt.push(lt);let Mt=rt.join(rt.dirname(j),"components");if(!pt.includes(Mt))pt.push(Mt);if(B.componentsDir&&B.componentsDir!==E&&!pt.includes(B.componentsDir))pt.push(B.componentsDir);for(let Nt of B._targetComponentDirs??[])if(Nt&&!pt.includes(Nt))pt.push(Nt);let mn=typeof B.root==="string"?rt.resolve(B.root):void 0,Wr=mn??rt.dirname(j),Rn=[];if(mn)Rn.push(rt.resolve(mn,"resources/views/components")),Rn.push(rt.resolve(mn,"resources/components")),Rn.push(rt.resolve(mn,"src/components")),Rn.push(rt.resolve(mn,"components"));Rn.push(rt.resolve(import.meta.dir,"components"));for(let Nt of Rn)if(!pt.includes(Nt))pt.push(Nt);let io=B._pluginComponentDirs;if(Array.isArray(io)){for(let Nt of io)if(typeof Nt==="string"&&!pt.includes(Nt))pt.push(Nt)}if(B.fallbackComponentsDir&&!pt.includes(B.fallbackComponentsDir))pt.push(B.fallbackComponentsDir);let Ys=[...new Set(pt.map((Nt)=>{if(!Nt)return Nt;return rt.isAbsolute(Nt)?Nt:rt.resolve(Wr,Nt)}))];pt.length=0,pt.push(...Ys);let Fr=`${ue}\x00${j}\x00${Ys.join("\x00")}`,Vr=ya.get(Fr);if(Vr)if(await r(Vr))oe=Vr;else ya.delete(Fr);if(!oe&&(ue.startsWith("./")||ue.startsWith("../")))oe=rt.resolve(rt.dirname(j),`${ue}.stx`),we.push(oe);else if(!oe)for(let Nt of pt){if(!Nt)continue;for(let Ur of it){let oo=rt.join(Nt,Ur);if(we.push(oo),await r(oo)){oe=oo;break}}if(oe)break;if(!oe)try{let Ur=await import("fs");if(!Ur.statSync(Nt,{throwIfNoEntry:!1})?.isDirectory())continue;let ph=8,Aa=[{path:Nt,depth:0}];while(Aa.length>0&&!oe){let ao=Aa.pop();if(ao.depth>=ph)continue;let hu;try{hu=Ur.readdirSync(ao.path,{withFileTypes:!0})}catch{continue}for(let co of hu){if(!co.isDirectory())continue;if(co.name==="node_modules"||co.name.startsWith("."))continue;let yu=rt.join(ao.path,co.name);for(let gh of it){let Ta=rt.join(yu,gh);if(we.push(Ta),await r(Ta)){oe=Ta;break}}if(oe)break;Aa.push({path:yu,depth:ao.depth+1})}}}catch{}if(oe)break}if(oe)ya.set(Fr,oe)}if(!oe||!await r(oe))return Vm(v,j,we),Um(v);F.add(oe);let $e;if(eo.has(oe))$e=eo.get(oe);else try{$e=await Bun.file(oe).text(),eo.set(oe,$e)}catch(tt){let it=tt instanceof Error?tt.message:String(tt);return Vm(v,j,[oe],it),Um(v)}if(H)for(let tt of Object.keys(_)){let it=tt.toLowerCase();if(it.startsWith("aria-")||it.startsWith("data-"))continue;let vt=tt.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(new RegExp(`\\b${vt}\\b`).test($e))H.declaredProps.add(tt)}let _e=new Set(["__originalFilePath","__importedComponents",po,"__stx_client_signal_names","__stx_client_declared_names","__stx_runtime_config","__stxServeContext","__stx_scope_seq"]),Re={};for(let[tt,it]of Object.entries(T))if(!tt.startsWith("__")||_e.has(tt))Re[tt]=it;let Ee=V.length>0?{[bo]:[...V]}:{},Ae=k;if(k.includes("@include")){let{processIncludes:tt}=await mt("stx/includes",()=>import("./chunk-144xhefw.js"));Ae=await tt(k,T,j,B,F)}if(/<[A-Z][\w.-]*[\s/>]/.test(Ae)){let{processComponents:tt}=await mt("stx/component-renderer",()=>import("./chunk-2djfn17e.js"));Ae=await tt(Ae,{...T,__processedComponents:J,...Ee},j,B,F)}let Te=[];if(fi(Ae)){let{processExpressions:tt}=await mt("stx/expressions",()=>import("./chunk-x2ghjgxm.js")),it=T.__stx_signals_gate===void 0?{...T,__stx_signals_gate:!0,...Ee}:V.length>0?{...T,...Ee}:T;Ae=tt(Ae,it,j);for(let vt of Ae.matchAll(/\{\{([\s\S]*?)\}\}/g))Te.push(vt[1].trim())}let ke=xn(Ae),Pe=[],Ge=ke.output.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(tt,it)=>{let vt=ke.scripts[Number(it)]||"",pt=vt.match(/^<script\b([^>]*)>/i)?.[1]||"",lt=pt.match(/\btype\s*=\s*["']([^"']+)["']/i)?.[1]?.toLowerCase(),Mt=!lt||["module","text/javascript","application/javascript"].includes(lt),mn=/\sdata-stx-(?:owner|instance)(?=[\s=/>])/i.test(` ${pt}`);if(!/\bserver\b/i.test(pt)&&Mt&&!mn)return Pe.push(vt),"";return vt}),{extractSlotContent:De}=await mt("stx/slots",()=>import("./chunk-7bwkc5yf.js")),Ie=De(Ge),Ye={};if(Ie.defaultSlot?.trim())Ye.default=Ie.defaultSlot;for(let[tt,it]of Ie.namedSlots)Ye[tt]=it.content;let at=T.__stx_scope_seq??={n:0,key:Bun.hash(String(T.__filename??j)).toString(36).slice(0,6)},dt=`stx_${ue.replace(/[^a-zA-Z0-9]/g,"_")}_${++at.n}_${at.key}`,et={...Re,$uid:dt,..._,props:_,slot:Ge,$slots:Ye,__processedComponents:ne,__sections:{},__stx_signals_gate:ye($e)||fi(k),__stx_preserved_client_expressions:[...Array.isArray(T.__stx_preserved_client_expressions)?T.__stx_preserved_client_expressions:[],...Te]};AS($e,et);let It=$e,ft=Z(It);if(ft)It=ft.content.trim();let ut=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,st=[...$e.matchAll(ut)],yt=[],gt=null,zt=st.some((tt)=>/\bserver\b/.test(tt[1]||"")&&/\bcache\b/.test(tt[1]||"")),En=null,Cn=null,Tn=null,nt=0,ct=null;if(SS(B),zt&&Ql>0){let tt=$S({props:_,slot:Ae,slotContext:k.trim()?_S(Re):void 0,buildMode:B.buildMode??"",skipEventDirectives:B.skipEventDirectives===!0,clientLoopNames:[...V].sort(),layers:B._layerGraph?.layers.map((it)=>it.configFile),uid:dt});if(tt!==null){En=`${oe}\x00${h($e)}\x00${tt}`;let it=xa.get(En);if(it){for(let vt of it.dependencies)F.add(vt);if(rd(T,it.clientFactories),at.n+=it.uidsConsumed,it.preservedClientExpressions.length>0){let vt=new Set(Array.isArray(T.__stx_preserved_client_expressions)?T.__stx_preserved_client_expressions:[]);for(let pt of it.preservedClientExpressions)vt.add(pt);T.__stx_preserved_client_expressions=[...vt]}return it.output}Cn=new Set(F),Tn=td(T),nt=at.n,ct=new Set(Array.isArray(T.__stx_preserved_client_expressions)?T.__stx_preserved_client_expressions:[])}}let bt=new Set;for(let tt of st){let it=tt[1]||"",vt=tt[2]||"",pt=it.includes("server");if(Ue(it)&&vt.trim())vt=We(vt);if(pt&&vt){for(let Mt of Q(vt))bt.add(Mt);try{await G(vt,et,oe,{onFailure:(Mt)=>{if(Mt.kind!=="unknown")gt=Mt.kind}})}catch(Mt){}}if(!pt){let Mt=vt.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),mn=Mt.includes("{{")&&Mt.includes("}}"),Wr=Mt.includes("{!!")&&Mt.includes("!!}");if(mn||Wr)Mt=es(Mt,et,oe);let Rn=it.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");yt.push(`<script${Rn}>${Mt}</script>`)}}let jt=xn($e).output.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),en=jt?jt[1]:"",In=jt?jt[2]:"",nr="",Ea=en&&/\bscoped\b/i.test(en);if(jt)nr=`<style${en}>${IS(In,et,oe)}</style>`;let Jt=It;if(Jt=Jt.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),jt)Jt=Jt.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let tt=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,it=[];if(Jt=Jt.replace(tt,(vt,pt)=>{let lt=pt.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(lt)it.push(`<style${lt[1]}>${lt[2]}</style>`);return""}),Jt=Jt.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),it.length>0)nr=`${nr}${it.join(`
2076
- `)}`}if(k&&Jt.includes("{{ text || slot }}"))Jt=Jt.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>k);let{applySlots:Oe}=await mt("stx/slots",()=>import("./chunk-7bwkc5yf.js")),{defaultSlot:Qe,namedSlots:ot}=Ie,ht=yt.some((tt)=>/\b(?:state|derived|effect|ref|useRef|reactive|computed|watch|watchEffect|useModel|useReactiveProp|onMount|onDestroy|defineProps|withDefaults|defineEmits|defineExpose|defineSlots)\s*(?:<[^<>()]*>)?\s*\(/.test(tt)),Dt=(tt)=>ht?cm(tt,dt):tt,Kt=new Map([...ot].map(([tt,it])=>[tt,{...it,content:Dt(it.content)}]));Jt=await Oe(Jt,Dt(Qe),Kt,et);let kr=Mc(yt),Ca=(Array.isArray(et.__stx_client_signal_names)?et.__stx_client_signal_names:[]).filter((tt)=>!bt.has(tt));if(kr.length>0||Ca.length>0)et.__stx_client_signal_names=[...new Set([...Ca,...kr])];else delete et.__stx_client_signal_names;let so=V.filter((tt)=>!bt.has(tt)&&!(tt in _));if(so.length>0)et[bo]=so;let Ra={...B,_rootComponentsDir:B._rootComponentsDir||B.componentsDir,componentsDir:rt.dirname(oe),skipSignalsRuntime:!0,skipEventDirectives:ht||yt.length===0,defaultLayout:void 0};et.__stxProcessingDepth=(T.__stxProcessingDepth||0)+1;let ur=await n(Jt,et,oe,Ra,F),zr=new Set(Array.isArray(T.__stx_preserved_client_expressions)?T.__stx_preserved_client_expressions:[]);for(let tt of ur.matchAll(/\{\{([\s\S]*?)\}\}/g))zr.add(tt[1].trim());if(zr.size>0)T.__stx_preserved_client_expressions=[...zr];let rr=dt,Xt=ur;if(ht){let tt="";if(Object.keys(_).length>0)try{tt=` data-stx-props="${Bm(JSON.stringify(_))}"`}catch{}let it=se?` stx-hydrate="${Bm(se)}"`:"",vt=` data-stx-scope="${rr}"${tt}${it}`,pt=/^\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*<span(?=[\s/>])/i.test(ur),lt=pt?"span":"div";Xt=Dc(ur,vt)??`<${lt}${vt} data-stx-component-wrapper${pt?' style="display:contents"':""}>${ur}</${lt}>`;let Mt=await Promise.all(yt.map(async(mn)=>{let Wr=mn.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!Wr)return mn;let[,Rn,io]=Wr,{vendorStyleTags:Ys,factoryBody:Fr}=await OS(io,oe,B.buildMode==="compile"),Vr=se?null:Na(T,Fr),Nt=Vr?`window.__stxComponentFactories[${JSON.stringify(Vr)}](${JSON.stringify(rr)});`:`(${Fr})(${JSON.stringify(rr)});`;if(se)return`${Ys}<script type="stx/island" data-stx-island="${rr}" data-stx-scoped data-stx-owner="${rr}"${Rn}>${Nt}</script>`;return`${Ys}<script data-stx-scoped data-stx-run="always" data-stx-owner="${rr}"${Rn}>${Nt}</script>`}));if(Xt=Xt+`
2075
+ `)}`:"";console.error(`[stx] component <${v}> could not be resolved${j}, so it rendered as nothing.${B}${z}`)}function Um(v){return`<!-- stx: component "${v.replace(/--+/g,"-")}" could not be resolved; see the server log -->`}function Mc(v){let _=new Set,k=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal|useModel|useReactiveProp|useLocalStorage|useSessionStorage|keptState|useCookie|useDebouncedValue)\s*(?:<[^>]*>)?\s*\(/g;for(let E of v){let T;while((T=k.exec(E))!==null)_.add(T[1]);k.lastIndex=0}return[..._]}async function qe(v,_,k,E,T,j,B,z=new Set,F,V=mr(T),H){let{extractVariables:G}=await mt("stx/variable-extractor",()=>import("./chunk-5pzhcesm.js")),J=z??new Set;if(J.has(v))return`[Circular component reference: ${v}]`;let ne=new Set(J);ne.add(v);let re=typeof _.client==="string"?_.client.trim():"";if("client"in _)delete _.client;let se=re&&re!=="load"&&Oc(re)?re:"";try{let ie=(tt)=>tt.split("-").map((it)=>it.charAt(0).toUpperCase()+it.slice(1)).join(""),ae=(tt)=>tt.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),ue=v.endsWith(".stx")?v.slice(0,-4):v,oe=null,me=T.__importedComponents;if(me){let tt=[ue,ue.toLowerCase(),ie(ue),ae(ue)];for(let it of tt)if(me.has(it)){oe=me.get(it);break}}let ve=[];if(!oe){let tt=[`${ue}.stx`,`${ie(ue)}.stx`,`${ae(ue)}.stx`],it=[...new Set(tt)],wt=T.__originalFilePath,pt=[];if(pt.push(...B._layerComponentDirs??[]),wt){let Nt=rt.join(rt.dirname(wt),"components");pt.push(Nt)}if(E)pt.push(E);let lt=B._rootComponentsDir;if(typeof lt==="string"&&!pt.includes(lt))pt.push(lt);let Mt=rt.join(rt.dirname(j),"components");if(!pt.includes(Mt))pt.push(Mt);if(B.componentsDir&&B.componentsDir!==E&&!pt.includes(B.componentsDir))pt.push(B.componentsDir);for(let Nt of B._targetComponentDirs??[])if(Nt&&!pt.includes(Nt))pt.push(Nt);let mn=typeof B.root==="string"?rt.resolve(B.root):void 0,Wr=mn??rt.dirname(j),Rn=[];if(mn)Rn.push(rt.resolve(mn,"resources/views/components")),Rn.push(rt.resolve(mn,"resources/components")),Rn.push(rt.resolve(mn,"src/components")),Rn.push(rt.resolve(mn,"components"));Rn.push(rt.resolve(import.meta.dir,"components"));for(let Nt of Rn)if(!pt.includes(Nt))pt.push(Nt);let io=B._pluginComponentDirs;if(Array.isArray(io)){for(let Nt of io)if(typeof Nt==="string"&&!pt.includes(Nt))pt.push(Nt)}if(B.fallbackComponentsDir&&!pt.includes(B.fallbackComponentsDir))pt.push(B.fallbackComponentsDir);let Ys=[...new Set(pt.map((Nt)=>{if(!Nt)return Nt;return rt.isAbsolute(Nt)?Nt:rt.resolve(Wr,Nt)}))];pt.length=0,pt.push(...Ys);let Fr=`${ue}\x00${j}\x00${Ys.join("\x00")}`,Vr=ya.get(Fr);if(Vr)if(await r(Vr))oe=Vr;else ya.delete(Fr);if(!oe&&(ue.startsWith("./")||ue.startsWith("../")))oe=rt.resolve(rt.dirname(j),`${ue}.stx`),ve.push(oe);else if(!oe)for(let Nt of pt){if(!Nt)continue;for(let Ur of it){let oo=rt.join(Nt,Ur);if(ve.push(oo),await r(oo)){oe=oo;break}}if(oe)break;if(!oe)try{let Ur=await import("fs");if(!Ur.statSync(Nt,{throwIfNoEntry:!1})?.isDirectory())continue;let ph=8,Aa=[{path:Nt,depth:0}];while(Aa.length>0&&!oe){let ao=Aa.pop();if(ao.depth>=ph)continue;let hu;try{hu=Ur.readdirSync(ao.path,{withFileTypes:!0})}catch{continue}for(let co of hu){if(!co.isDirectory())continue;if(co.name==="node_modules"||co.name.startsWith("."))continue;let yu=rt.join(ao.path,co.name);for(let gh of it){let Ta=rt.join(yu,gh);if(ve.push(Ta),await r(Ta)){oe=Ta;break}}if(oe)break;Aa.push({path:yu,depth:ao.depth+1})}}}catch{}if(oe)break}if(oe)ya.set(Fr,oe)}if(!oe||!await r(oe))return Vm(v,j,ve),Um(v);F.add(oe);let $e;if(eo.has(oe))$e=eo.get(oe);else try{$e=await Bun.file(oe).text(),eo.set(oe,$e)}catch(tt){let it=tt instanceof Error?tt.message:String(tt);return Vm(v,j,[oe],it),Um(v)}if(H)for(let tt of Object.keys(_)){let it=tt.toLowerCase();if(it.startsWith("aria-")||it.startsWith("data-"))continue;let wt=tt.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(new RegExp(`\\b${wt}\\b`).test($e))H.declaredProps.add(tt)}let _e=new Set(["__originalFilePath","__importedComponents",po,"__stx_client_signal_names","__stx_client_declared_names","__stx_runtime_config","__stxServeContext","__stx_scope_seq"]),Re={};for(let[tt,it]of Object.entries(T))if(!tt.startsWith("__")||_e.has(tt))Re[tt]=it;let Ee=V.length>0?{[bo]:[...V]}:{},Ae=k;if(k.includes("@include")){let{processIncludes:tt}=await mt("stx/includes",()=>import("./chunk-bvq2hx8a.js"));Ae=await tt(k,T,j,B,F)}if(/<[A-Z][\w.-]*[\s/>]/.test(Ae)){let{processComponents:tt}=await mt("stx/component-renderer",()=>import("./chunk-4yrk774b.js"));Ae=await tt(Ae,{...T,__processedComponents:J,...Ee},j,B,F)}let Te=[];if(fi(Ae)){let{processExpressions:tt}=await mt("stx/expressions",()=>import("./chunk-qm8atahn.js")),it=T.__stx_signals_gate===void 0?{...T,__stx_signals_gate:!0,...Ee}:V.length>0?{...T,...Ee}:T;Ae=tt(Ae,it,j);for(let wt of Ae.matchAll(/\{\{([\s\S]*?)\}\}/g))Te.push(wt[1].trim())}let ke=xn(Ae),Pe=[],Ge=ke.output.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(tt,it)=>{let wt=ke.scripts[Number(it)]||"",pt=wt.match(/^<script\b([^>]*)>/i)?.[1]||"",lt=pt.match(/\btype\s*=\s*["']([^"']+)["']/i)?.[1]?.toLowerCase(),Mt=!lt||["module","text/javascript","application/javascript"].includes(lt),mn=/\sdata-stx-(?:owner|instance)(?=[\s=/>])/i.test(` ${pt}`);if(!/\bserver\b/i.test(pt)&&Mt&&!mn)return Pe.push(wt),"";return wt}),{extractSlotContent:De}=await mt("stx/slots",()=>import("./chunk-y3480mx8.js")),Ie=De(Ge),Ye={};if(Ie.defaultSlot?.trim())Ye.default=Ie.defaultSlot;for(let[tt,it]of Ie.namedSlots)Ye[tt]=it.content;let at=T.__stx_scope_seq??={n:0,key:Bun.hash(String(T.__filename??j)).toString(36).slice(0,6)},dt=`stx_${ue.replace(/[^a-zA-Z0-9]/g,"_")}_${++at.n}_${at.key}`,et={...Re,$uid:dt,..._,props:_,slot:Ge,$slots:Ye,__processedComponents:ne,__sections:{},__stx_signals_gate:ye($e)||fi(k),__stx_preserved_client_expressions:[...Array.isArray(T.__stx_preserved_client_expressions)?T.__stx_preserved_client_expressions:[],...Te]};AS($e,et);let It=$e,ft=Z(It);if(ft)It=ft.content.trim();let ut=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,st=[...$e.matchAll(ut)],yt=[],gt=null,zt=st.some((tt)=>/\bserver\b/.test(tt[1]||"")&&/\bcache\b/.test(tt[1]||"")),En=null,Cn=null,Tn=null,nt=0,ct=null;if(SS(B),zt&&Ql>0){let tt=$S({props:_,slot:Ae,slotContext:k.trim()?_S(Re):void 0,buildMode:B.buildMode??"",skipEventDirectives:B.skipEventDirectives===!0,clientLoopNames:[...V].sort(),layers:B._layerGraph?.layers.map((it)=>it.configFile),uid:dt});if(tt!==null){En=`${oe}\x00${h($e)}\x00${tt}`;let it=xa.get(En);if(it){for(let wt of it.dependencies)F.add(wt);if(rd(T,it.clientFactories),at.n+=it.uidsConsumed,it.preservedClientExpressions.length>0){let wt=new Set(Array.isArray(T.__stx_preserved_client_expressions)?T.__stx_preserved_client_expressions:[]);for(let pt of it.preservedClientExpressions)wt.add(pt);T.__stx_preserved_client_expressions=[...wt]}return it.output}Cn=new Set(F),Tn=td(T),nt=at.n,ct=new Set(Array.isArray(T.__stx_preserved_client_expressions)?T.__stx_preserved_client_expressions:[])}}let bt=new Set;for(let tt of st){let it=tt[1]||"",wt=tt[2]||"",pt=it.includes("server");if(Ue(it)&&wt.trim())wt=We(wt);if(pt&&wt){for(let Mt of Q(wt))bt.add(Mt);try{await G(wt,et,oe,{onFailure:(Mt)=>{if(Mt.kind!=="unknown")gt=Mt.kind}})}catch(Mt){}}if(!pt){let Mt=wt.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),mn=Mt.includes("{{")&&Mt.includes("}}"),Wr=Mt.includes("{!!")&&Mt.includes("!!}");if(mn||Wr)Mt=es(Mt,et,oe);let Rn=it.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");yt.push(`<script${Rn}>${Mt}</script>`)}}let jt=xn($e).output.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),en=jt?jt[1]:"",In=jt?jt[2]:"",nr="",Ea=en&&/\bscoped\b/i.test(en);if(jt)nr=`<style${en}>${IS(In,et,oe)}</style>`;let Jt=It;if(Jt=Jt.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),jt)Jt=Jt.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let tt=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,it=[];if(Jt=Jt.replace(tt,(wt,pt)=>{let lt=pt.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(lt)it.push(`<style${lt[1]}>${lt[2]}</style>`);return""}),Jt=Jt.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),it.length>0)nr=`${nr}${it.join(`
2076
+ `)}`}if(k&&Jt.includes("{{ text || slot }}"))Jt=Jt.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>k);let{applySlots:Oe}=await mt("stx/slots",()=>import("./chunk-y3480mx8.js")),{defaultSlot:Qe,namedSlots:ot}=Ie,ht=yt.some((tt)=>/\b(?:state|derived|effect|ref|useRef|reactive|computed|watch|watchEffect|useModel|useReactiveProp|onMount|onDestroy|defineProps|withDefaults|defineEmits|defineExpose|defineSlots)\s*(?:<[^<>()]*>)?\s*\(/.test(tt)),Dt=(tt)=>ht?cm(tt,dt):tt,Kt=new Map([...ot].map(([tt,it])=>[tt,{...it,content:Dt(it.content)}]));Jt=await Oe(Jt,Dt(Qe),Kt,et);let kr=Mc(yt),Ca=(Array.isArray(et.__stx_client_signal_names)?et.__stx_client_signal_names:[]).filter((tt)=>!bt.has(tt));if(kr.length>0||Ca.length>0)et.__stx_client_signal_names=[...new Set([...Ca,...kr])];else delete et.__stx_client_signal_names;let so=V.filter((tt)=>!bt.has(tt)&&!(tt in _));if(so.length>0)et[bo]=so;let Ra={...B,_rootComponentsDir:B._rootComponentsDir||B.componentsDir,componentsDir:rt.dirname(oe),skipSignalsRuntime:!0,skipEventDirectives:ht||yt.length===0,defaultLayout:void 0};et.__stxProcessingDepth=(T.__stxProcessingDepth||0)+1;let ur=await n(Jt,et,oe,Ra,F),zr=new Set(Array.isArray(T.__stx_preserved_client_expressions)?T.__stx_preserved_client_expressions:[]);for(let tt of ur.matchAll(/\{\{([\s\S]*?)\}\}/g))zr.add(tt[1].trim());if(zr.size>0)T.__stx_preserved_client_expressions=[...zr];let rr=dt,Xt=ur;if(ht){let tt="";if(Object.keys(_).length>0)try{tt=` data-stx-props="${Bm(JSON.stringify(_))}"`}catch{}let it=se?` stx-hydrate="${Bm(se)}"`:"",wt=` data-stx-scope="${rr}"${tt}${it}`,pt=/^\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*<span(?=[\s/>])/i.test(ur),lt=pt?"span":"div";Xt=Dc(ur,wt)??`<${lt}${wt} data-stx-component-wrapper${pt?' style="display:contents"':""}>${ur}</${lt}>`;let Mt=await Promise.all(yt.map(async(mn)=>{let Wr=mn.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!Wr)return mn;let[,Rn,io]=Wr,{vendorStyleTags:Ys,factoryBody:Fr}=await OS(io,oe,B.buildMode==="compile"),Vr=se?null:Na(T,Fr),Nt=Vr?`window.__stxComponentFactories[${JSON.stringify(Vr)}](${JSON.stringify(rr)});`:`(${Fr})(${JSON.stringify(rr)});`;if(se)return`${Ys}<script type="stx/island" data-stx-island="${rr}" data-stx-scoped data-stx-owner="${rr}"${Rn}>${Nt}</script>`;return`${Ys}<script data-stx-scoped data-stx-run="always" data-stx-owner="${rr}"${Rn}>${Nt}</script>`}));if(Xt=Xt+`
2077
2077
  `+Mt.join(`
2078
2078
  `),nr)Xt+=`
2079
2079
  `+nr}else{if(nr)Xt+=`
2080
- `+nr;if(yt.length>0){let tt=et.__stx_event_bindings||[],it=Le(et),vt=await Promise.all(yt.map(async(pt)=>{let lt=pt.match(/<script\b[^>]*>([\s\S]*?)<\/script>/);if(!lt)return pt;return await he(lt[1],{eventBindings:tt,templateContent:Xt,filePath:oe,projectRoot:process.cwd(),serverData:it,instanceId:dt})}));Xt+=`
2081
- `+vt.join(`
2080
+ `+nr;if(yt.length>0){let tt=et.__stx_event_bindings||[],it=Le(et),wt=await Promise.all(yt.map(async(pt)=>{let lt=pt.match(/<script\b[^>]*>([\s\S]*?)<\/script>/);if(!lt)return pt;return await he(lt[1],{eventBindings:tt,templateContent:Xt,filePath:oe,projectRoot:process.cwd(),serverData:it,instanceId:dt})}));Xt+=`
2081
+ `+wt.join(`
2082
2082
  `),et.__stx_event_bindings=[]}}if(Ea){let tt=So(Xt,oe);if(tt.hasScoped)Xt=tt.html}if(En&&Cn){let tt=Array.isArray(T.__stx_preserved_client_expressions)?T.__stx_preserved_client_expressions:[];xa.set(En,{output:Xt,dependencies:[...F].filter((it)=>!Cn.has(it)),clientFactories:Tn?nd(T,Tn):[],uidsConsumed:at.n-nt,preservedClientExpressions:ct?tt.filter((it)=>!ct.has(it)):[]})}if(gt)Xt=`<!--stx-render-failed:${gt}-->${Xt}`;return Pe.length>0?`${Xt}
2083
2083
  ${Pe.join(`
2084
2084
  `)}`:Xt}catch(ie){return`[Error processing component: ${ie instanceof Error?ie.message:String(ie)}]`}finally{J.delete(v)}}async function r(v){return Bun.file(v).exists()}function eu(v,_){let k=rt.resolve(_),E=rt.resolve(v),T=k.endsWith(rt.sep)?k:k+rt.sep;if(E===k||E.startsWith(T))return E;return null}async function PS(v,_,k,E){let T=_.startsWith("layouts/")?_.slice(8):_,j=rt.join(v,T);for(let B of j.endsWith(".stx")?[j]:[j,`${j}.stx`])if(await r(B)){if(E)console.log(`Found layout in ${v}: ${B}`);return k?.add(B),B}return null}async function Gn(v,_,k,E){let T=await DS(v,_,k,E);if(T===null)return null;let j=eu(T,process.cwd());if(j)return j;let B=[k.root,k.layoutsDir,k.fallbackLayoutsDir,k.componentsDir,k.partialsDir,k.pagesDir,...k._layerLayoutDirs??[]].filter((z)=>typeof z==="string"&&z.length>0);for(let z of B){let F=rt.isAbsolute(z)?z:rt.resolve(process.cwd(),z);if(eu(T,F))return rt.resolve(T)}return console.warn(`[stx] rejected resolved template path that escapes project root: ${T} (template: ${v}, from: ${_})`),null}async function DS(v,_,k,E){if(k.debug)console.log(`Resolving template path: ${v} from ${_}`);let T=rt.dirname(_),j=process.cwd();if(v.startsWith("/")){let J=rt.join(j,v),ne=eu(J,j);if(!ne)return console.warn(`[stx] rejected template path that escapes project root: ${v} (from ${_})`),null;if(k.debug)console.log(`Checking absolute path: ${ne}`);if(await r(ne)&&E)E.add(ne);return ne}let B=rt.join(T,v);if(await r(B)){if(k.debug)console.log(`Found direct path: ${B}`);if(E)E.add(B);return B}if(!v.endsWith(".stx")&&!v.endsWith(".jsx")&&!v.endsWith(".tsx"))for(let J of[".stx",".tsx",".jsx"]){let ne=`${B}${J}`;if(await r(ne)){if(k.debug)console.log(`Found direct path with extension: ${ne}`);if(E)E.add(ne);return ne}}let z=[];if(z.push(...k._layerLayoutDirs??[]),k.layoutsDir)z.push(rt.isAbsolute(k.layoutsDir)?k.layoutsDir:rt.resolve(process.cwd(),k.layoutsDir));let F=rt.resolve(T),V=process.cwd();for(let J=0;J<10;J++){let ne=rt.join(F,"layouts"),re=!1;try{re=Hm.statSync(ne,{throwIfNoEntry:!1})?.isDirectory()??!1}catch{}if(re){z.push(ne);break}let se=rt.dirname(F);if(se===F||se.length<V.length)break;F=se}for(let J of z){let ne=await PS(J,v,E,k.debug);if(ne)return ne}if(k.fallbackLayoutsDir){let J=rt.isAbsolute(k.fallbackLayoutsDir)?k.fallbackLayoutsDir:rt.resolve(process.cwd(),k.fallbackLayoutsDir),ne=v.startsWith("layouts/")?v.slice(8):v,re=[rt.join(J,ne)];if(!v.endsWith(".stx"))re.push(`${re[0]}.stx`);for(let se of re)if(await r(se)){if(k.debug)console.log(`Found in options.fallbackLayoutsDir: ${se}`);if(E)E.add(se);return se}}if(v.startsWith("layouts/")||v.includes("/layouts/")){let J=v.split("layouts/"),ne=rt.join(k.partialsDir||T,"layouts",J[1]);if(await r(ne)){if(k.debug)console.log(`Found in layouts path: ${ne}`);if(E)E.add(ne);return ne}if(!ne.endsWith(".stx")){let re=`${ne}.stx`;if(await r(re)){if(k.debug)console.log(`Found in layouts path with extension: ${re}`);if(E)E.add(re);return re}}}if(k.partialsDir){let J=rt.join(k.partialsDir,"layouts");if(await r(J)){let ne=rt.join(J,v);if(await r(ne)){if(k.debug)console.log(`Found in partials layouts dir: ${ne}`);if(E)E.add(ne);return ne}if(!v.endsWith(".stx")){let re=`${ne}.stx`;if(await r(re)){if(k.debug)console.log(`Found in partials layouts dir with extension: ${re}`);if(E)E.add(re);return re}}}}let H=k.partialsDir||rt.join(process.cwd(),"views"),G=rt.join(H,v);if(await r(G)){if(k.debug)console.log(`Found in views path: ${G}`);if(E)E.add(G);return G}if(!v.endsWith(".stx")){let J=`${G}.stx`;if(await r(J)){if(k.debug)console.log(`Found in views path with extension: ${J}`);if(E)E.add(J);return J}}if(T.includes("temp")){let J=rt.join(rt.dirname(T),"layouts",v);if(await r(J)){if(k.debug)console.log(`Found in temp layouts dir: ${J}`);if(E)E.add(J);return J}if(!v.endsWith(".stx")){let ne=`${J}.stx`;if(await r(ne)){if(k.debug)console.log(`Found in temp layouts dir with extension: ${ne}`);if(E)E.add(ne);return ne}}}if(k.debug)console.warn(`Template not found after trying all paths: ${v} (referenced from ${_})`);else console.warn(`Template not found: ${v} (referenced from ${_})`);return null}function gi(v,_,k){let E=0,T="",j="";try{if(typeof _==="number"&&_>=0){let B=v.split(`
@@ -2096,7 +2096,7 @@ ${At.yellow}${At.bold}Message:${At.reset} ${_}
2096
2096
  `,z)H+=`
2097
2097
  ${At.blue}${At.bold}Context:${At.reset}
2098
2098
  ${At.dim}${z}${At.reset}
2099
- `;return H}function ee(){eo.clear(),ya.clear(),Jl.clear(),Yl.clear(),xa.clear()}function Jd(){return{size:eo.size,maxSize:500}}var Gl=m(128);async function OS(v,_,k){let E=h(v,_,k),T=Gl.get(E);if(T){if(tn(T.deps))return T;Gl.delete(E)}let j=Gr(v,{filePath:_,projectRoot:process.cwd()}),B=j.code,z=Jr(j.styles);B=wt(B).code;let{hasUserImports:F,bundleClientScript:V}=await mt("stx/client-script-bundler",()=>import("./chunk-x5gbrjm5.js")),H=[],G=!1;if(F(B)){let ae=B;B=await V(ae,_,{projectRoot:process.cwd(),minify:k,collectInputs:H}),G=B===ae}let{stripStxRuntimeImports:J}=await mt("stx/signal-processing",()=>import("./chunk-tv2xr7s3.js"));B=J(B);let ne=I(B),re=ES(ne),se=`function(__scopeId) {
2099
+ `;return H}function ee(){eo.clear(),ya.clear(),Jl.clear(),Yl.clear(),xa.clear()}function Jd(){return{size:eo.size,maxSize:500}}var Gl=m(128);async function OS(v,_,k){let E=h(v,_,k),T=Gl.get(E);if(T){if(tn(T.deps))return T;Gl.delete(E)}let j=Gr(v,{filePath:_,projectRoot:process.cwd()}),B=j.code,z=Jr(j.styles);B=vt(B).code;let{hasUserImports:F,bundleClientScript:V}=await mt("stx/client-script-bundler",()=>import("./chunk-jc25dv0f.js")),H=[],G=!1;if(F(B)){let ae=B;B=await V(ae,_,{projectRoot:process.cwd(),minify:k,collectInputs:H}),G=B===ae}let{stripStxRuntimeImports:J}=await mt("stx/signal-processing",()=>import("./chunk-dhrzmvbj.js"));B=J(B);let ne=I(B),re=ES(ne),se=`function(__scopeId) {
2100
2100
  ${Pt("const",[...Pi,...re],ne)}
2101
2101
  const __scope = window.stx._scopes = window.stx._scopes || {};
2102
2102
  const __scopeVars = __scope[__scopeId] = __scope[__scopeId] || {};
@@ -2200,8 +2200,8 @@ finally {
2200
2200
  #${v}.stx-img-loaded img {
2201
2201
  opacity: 1;
2202
2202
  }
2203
- `.trim()}var su=new Map;async function Gm(v,_={}){let k=`${v}:${JSON.stringify(_)}`;if(su.has(k))return su.get(k);let E=await BS(v,_);return su.set(k,E),E}async function FS(){try{return await import("./chunk-dn4tww9q.js")}catch(v){if(!Jm)console.warn("[stx-media] Image processor not available, some features disabled:",v),Jm=!0;return null}}var Jm=!1,ou=80,va="async",wa="lazy",Ym=!1;async function ba(v,_={}){let k=_,E=v;if(E.process&&!E.skipOptimization){if(k.tsImagesConfig?.enabled&&!k.isDev)return qS(E,k)}if(k.processedResult?.processed)return lu(v,k.processedResult,_);if(k.responsiveVariants)return th(v,k.responsiveVariants,_);let{src:T,alt:j,width:B,height:z,sizes:F,widths:V=Gs,dpr:H,formats:G=to,quality:J=ou,params:ne={},placeholder:re="none",placeholderOptions:se={},lazy:ie=!0,priority:ae=!1,loading:ue=ae?"eager":wa,decoding:oe=va,fetchpriority:me,objectFit:we,objectPosition:$e,crossorigin:_e,referrerpolicy:Re}=v,{class:Ee,style:Ae,id:Te}=v,ke=v.data||{},{isDev:Pe=!1,baseUrl:Ge=""}=_;if(Pe&&!_.optimize)return HS(v);let De,Ie,Ye=Te||`stx-img-${Math.random().toString(36).slice(2,8)}`;if(re!=="none"&&!ae)try{De=await Gm(T,{strategy:re,...se}),Ie=Zm(Ye,De,se)}catch{}let at=H!==void 0&&B!==void 0,dt;if(at)dt=US(v,Ye,De,_);else dt=await VS(v,Ye,De,_);let et;if(ae){let ut=G.includes("webp")?"webp":G[0],st=tu(T,V,{...ne,q:J},ut),yt=typeof F==="object"?nu(F):F||"100vw";et=`<link rel="preload" as="image" imagesrcset="${st}" imagesizes="${yt}" />`}let It=[];if(!Ym&&re!=="none")It.push(iu),Ym=!0;if(Ie)It.push(Ie);let ft=ie?eh(Ye):void 0;return{html:dt,preloadLink:et,css:It.length>0?It.join(`
2204
- `):void 0,script:ft}}async function VS(v,_,k,E){let{src:T,alt:j,width:B,height:z,sizes:F,widths:V=Gs,formats:H=to,quality:G=ou,params:J={},lazy:ne=!0,priority:re=!1,loading:se=re?"eager":wa,decoding:ie=va,fetchpriority:ae,objectFit:ue,objectPosition:oe,crossorigin:me,referrerpolicy:we}=v,{class:$e,style:_e}=v,Re=v.data||{},Ee=typeof F==="object"?nu(F):F||"100vw",Ae=[];for(let Pe of H){let Ge=tu(T,V,{...J,q:G},Pe),De=ru(Pe);if(ne&&!re)Ae.push(` <source type="${De}" data-srcset="${Ge}" data-sizes="${Ee}" />`);else Ae.push(` <source type="${De}" srcset="${Ge}" sizes="${Ee}" />`)}let Te=au({src:no(T,{...J,q:G}),alt:j,width:B,height:z,loading:re?void 0:se,decoding:ie,fetchpriority:re?"high":ae,objectFit:ue,objectPosition:oe,crossorigin:me,referrerpolicy:we,className:Qm($e,k),style:cu(_e,ue,oe,k),lazy:ne&&!re,data:Re}),ke;if(k){let Pe=`background-image: url('${k.dataURL}'); background-size: cover; background-position: center;`;ke=`<div id="${_}" class="stx-img-placeholder" style="${Pe}">
2203
+ `.trim()}var su=new Map;async function Gm(v,_={}){let k=`${v}:${JSON.stringify(_)}`;if(su.has(k))return su.get(k);let E=await BS(v,_);return su.set(k,E),E}async function FS(){try{return await import("./chunk-qky9zfvx.js")}catch(v){if(!Jm)console.warn("[stx-media] Image processor not available, some features disabled:",v),Jm=!0;return null}}var Jm=!1,ou=80,va="async",wa="lazy",Ym=!1;async function ba(v,_={}){let k=_,E=v;if(E.process&&!E.skipOptimization){if(k.tsImagesConfig?.enabled&&!k.isDev)return qS(E,k)}if(k.processedResult?.processed)return lu(v,k.processedResult,_);if(k.responsiveVariants)return th(v,k.responsiveVariants,_);let{src:T,alt:j,width:B,height:z,sizes:F,widths:V=Gs,dpr:H,formats:G=to,quality:J=ou,params:ne={},placeholder:re="none",placeholderOptions:se={},lazy:ie=!0,priority:ae=!1,loading:ue=ae?"eager":wa,decoding:oe=va,fetchpriority:me,objectFit:ve,objectPosition:$e,crossorigin:_e,referrerpolicy:Re}=v,{class:Ee,style:Ae,id:Te}=v,ke=v.data||{},{isDev:Pe=!1,baseUrl:Ge=""}=_;if(Pe&&!_.optimize)return HS(v);let De,Ie,Ye=Te||`stx-img-${Math.random().toString(36).slice(2,8)}`;if(re!=="none"&&!ae)try{De=await Gm(T,{strategy:re,...se}),Ie=Zm(Ye,De,se)}catch{}let at=H!==void 0&&B!==void 0,dt;if(at)dt=US(v,Ye,De,_);else dt=await VS(v,Ye,De,_);let et;if(ae){let ut=G.includes("webp")?"webp":G[0],st=tu(T,V,{...ne,q:J},ut),yt=typeof F==="object"?nu(F):F||"100vw";et=`<link rel="preload" as="image" imagesrcset="${st}" imagesizes="${yt}" />`}let It=[];if(!Ym&&re!=="none")It.push(iu),Ym=!0;if(Ie)It.push(Ie);let ft=ie?eh(Ye):void 0;return{html:dt,preloadLink:et,css:It.length>0?It.join(`
2204
+ `):void 0,script:ft}}async function VS(v,_,k,E){let{src:T,alt:j,width:B,height:z,sizes:F,widths:V=Gs,formats:H=to,quality:G=ou,params:J={},lazy:ne=!0,priority:re=!1,loading:se=re?"eager":wa,decoding:ie=va,fetchpriority:ae,objectFit:ue,objectPosition:oe,crossorigin:me,referrerpolicy:ve}=v,{class:$e,style:_e}=v,Re=v.data||{},Ee=typeof F==="object"?nu(F):F||"100vw",Ae=[];for(let Pe of H){let Ge=tu(T,V,{...J,q:G},Pe),De=ru(Pe);if(ne&&!re)Ae.push(` <source type="${De}" data-srcset="${Ge}" data-sizes="${Ee}" />`);else Ae.push(` <source type="${De}" srcset="${Ge}" sizes="${Ee}" />`)}let Te=au({src:no(T,{...J,q:G}),alt:j,width:B,height:z,loading:re?void 0:se,decoding:ie,fetchpriority:re?"high":ae,objectFit:ue,objectPosition:oe,crossorigin:me,referrerpolicy:ve,className:Qm($e,k),style:cu(_e,ue,oe,k),lazy:ne&&!re,data:Re}),ke;if(k){let Pe=`background-image: url('${k.dataURL}'); background-size: cover; background-position: center;`;ke=`<div id="${_}" class="stx-img-placeholder" style="${Pe}">
2205
2205
  <picture>
2206
2206
  ${Ae.join(`
2207
2207
  `)}
@@ -2211,7 +2211,7 @@ ${Ae.join(`
2211
2211
  ${Ae.join(`
2212
2212
  `)}
2213
2213
  <img ${Te} />
2214
- </picture>`;return ke}function US(v,_,k,E){let{src:T,alt:j,width:B,height:z,dpr:F=[1,2,3],quality:V=ou,params:H={},lazy:G=!0,priority:J=!1,loading:ne=J?"eager":wa,decoding:re=va,fetchpriority:se,objectFit:ie,objectPosition:ae,crossorigin:ue,referrerpolicy:oe}=v,{class:me,style:we}=v,$e=v.data||{},_e=typeof B==="number"?B:Number.parseInt(String(B),10),Re=Xm(T,_e,F,{...H,q:V}),Ee=au({src:no(T,{...H,w:_e,q:V}),alt:j,width:B,height:z,loading:J?void 0:ne,decoding:re,fetchpriority:J?"high":se,objectFit:ie,objectPosition:ae,crossorigin:ue,referrerpolicy:oe,className:Qm(me,k),style:cu(we,ie,ae,k),lazy:G&&!J,data:$e}),Ae=G&&!J?`data-srcset="${Re}"`:`srcset="${Re}"`;if(k){let Te=`background-image: url('${k.dataURL}'); background-size: cover; background-position: center;`;return`<div id="${_}" class="stx-img-placeholder" style="${Te}">
2214
+ </picture>`;return ke}function US(v,_,k,E){let{src:T,alt:j,width:B,height:z,dpr:F=[1,2,3],quality:V=ou,params:H={},lazy:G=!0,priority:J=!1,loading:ne=J?"eager":wa,decoding:re=va,fetchpriority:se,objectFit:ie,objectPosition:ae,crossorigin:ue,referrerpolicy:oe}=v,{class:me,style:ve}=v,$e=v.data||{},_e=typeof B==="number"?B:Number.parseInt(String(B),10),Re=Xm(T,_e,F,{...H,q:V}),Ee=au({src:no(T,{...H,w:_e,q:V}),alt:j,width:B,height:z,loading:J?void 0:ne,decoding:re,fetchpriority:J?"high":se,objectFit:ie,objectPosition:ae,crossorigin:ue,referrerpolicy:oe,className:Qm(me,k),style:cu(ve,ie,ae,k),lazy:G&&!J,data:$e}),Ae=G&&!J?`data-srcset="${Re}"`:`srcset="${Re}"`;if(k){let Te=`background-image: url('${k.dataURL}'); background-size: cover; background-position: center;`;return`<div id="${_}" class="stx-img-placeholder" style="${Te}">
2215
2215
  <img ${Ee} ${Ae} />
2216
2216
  </div>`}return`<img ${_?`id="${_}" `:""}${Ee} ${Ae} />`}function HS(v){let{src:_,alt:k,width:E,height:T,loading:j=wa,decoding:B=va,fetchpriority:z,objectFit:F,objectPosition:V,crossorigin:H,referrerpolicy:G,priority:J=!1}=v,{class:ne,style:re,id:se}=v,ie=v.data||{};return{html:`<img ${au({src:_,alt:k,width:E,height:T,loading:J?"eager":j,decoding:B,fetchpriority:J?"high":z,objectFit:F,objectPosition:V,crossorigin:H,referrerpolicy:G,className:ne,style:cu(re,F,V),id:se,data:ie})} />`}}function au(v){let _=[];if(v.lazy)_.push(`data-src="${An(v.src)}"`),_.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"');else _.push(`src="${An(v.src)}"`);if(_.push(`alt="${An(v.alt)}"`),v.width)_.push(`width="${v.width}"`);if(v.height)_.push(`height="${v.height}"`);if(v.loading)_.push(`loading="${v.loading}"`);if(v.decoding)_.push(`decoding="${v.decoding}"`);if(v.fetchpriority)_.push(`fetchpriority="${v.fetchpriority}"`);if(v.crossorigin)_.push(`crossorigin="${v.crossorigin}"`);if(v.referrerpolicy)_.push(`referrerpolicy="${v.referrerpolicy}"`);if(v.className)_.push(`class="${An(v.className)}"`);if(v.style)_.push(`style="${An(v.style)}"`);if(v.id)_.push(`id="${An(v.id)}"`);if(v.data)for(let[k,E]of Object.entries(v.data))_.push(`data-${k}="${An(E)}"`);if(v.lazy)_.push("data-stx-lazy");return _.join(" ")}function Qm(v,_){let k=[];if(v)k.push(v);if(_)k.push("stx-img-blur");return k.join(" ")||""}function cu(v,_,k,E){let T=[];if(_)T.push(`object-fit: ${_}`);if(k)T.push(`object-position: ${k}`);if(E)T.push("opacity: 0; transition: opacity 300ms ease-out");if(v)T.push(v);return T.join("; ")}function An(v){return v.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#039;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function eh(v){return`
2217
2217
  (function() {
@@ -2250,21 +2250,21 @@ ${Ae.join(`
2250
2250
 
2251
2251
  observer.observe(container);
2252
2252
  })();
2253
- `.trim()}async function qS(v,_){let k=await FS();if(!k)return ba({...v,process:!1},_);let E=_.tsImagesConfig;if(v.responsiveWidths&&v.responsiveWidths.length>0||v.widths&&v.widths.length>0||!v.width&&!v.dpr){let j=await k.generateResponsiveVariants(v.src,v,E);if(j)return th(v,j,_)}else{let j=await k.processImage(v.src,v,E);if(j.processed)return lu(v,j,_)}return ba({...v,process:!1},_)}async function lu(v,_,k){let{alt:E,width:T,height:j,lazy:B=!0,priority:z=!1,objectFit:F,objectPosition:V,crossorigin:H,referrerpolicy:G}=v,{class:J,style:ne}=v,re=v.id||`stx-img-${Math.random().toString(36).slice(2,8)}`,se=v.data||{},ie=_.variants||[],ae=ie.find((Ie)=>Ie.format==="jpeg")||ie.find((Ie)=>Ie.format==="webp")||ie[0],ue=ae?.url||v.src,oe=ie.filter((Ie)=>Ie.format===(ae?.format||"jpeg")).map((Ie)=>`${Ie.url} ${Ie.width}w`).join(", "),me=new Map;for(let Ie of ie){if(!me.has(Ie.format))me.set(Ie.format,[]);me.get(Ie.format).push(Ie)}let we=[],$e=["avif","webp","jpeg","png"];for(let Ie of $e){let Ye=me.get(Ie);if(Ye&&Ye.length>0){let at=Ye.map((et)=>`${et.url} ${et.width}w`).join(", "),dt=ru(Ie);if(B&&!z)we.push(` <source type="${dt}" data-srcset="${at}" />`);else we.push(` <source type="${dt}" srcset="${at}" />`)}}let _e=[];if(B&&!z){if(_e.push(`data-src="${An(ue)}"`),_e.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"'),oe)_e.push(`data-srcset="${oe}"`)}else if(_e.push(`src="${An(ue)}"`),oe)_e.push(`srcset="${oe}"`);_e.push(`alt="${An(E)}"`);let Re=T||_.originalWidth,Ee=j||_.originalHeight;if(Re)_e.push(`width="${Re}"`);if(Ee)_e.push(`height="${Ee}"`);if(!z)_e.push(`loading="${B?"lazy":"eager"}"`);if(_e.push('decoding="async"'),z)_e.push('fetchpriority="high"');if(H)_e.push(`crossorigin="${H}"`);if(G)_e.push(`referrerpolicy="${G}"`);let Ae=[];if(F)Ae.push(`object-fit: ${F}`);if(V)Ae.push(`object-position: ${V}`);if(_.placeholder&&B)Ae.push("opacity: 0; transition: opacity 300ms ease-out");if(ne)Ae.push(ne);if(Ae.length>0)_e.push(`style="${Ae.join("; ")}"`);let Te=[];if(J)Te.push(J);if(_.placeholder)Te.push("stx-img-blur");if(Te.length>0)_e.push(`class="${Te.join(" ")}"`);if(B&&!z)_e.push("data-stx-lazy");for(let[Ie,Ye]of Object.entries(se))_e.push(`data-${Ie}="${An(Ye)}"`);let ke;if(_.placeholder||_.dominantColor&&v.useDominantColor){let Ie=_.placeholder?`background-image: url('${_.placeholder}'); background-size: cover; background-position: center;`:`background-color: ${_.dominantColor};`;ke=`<div id="${re}" class="stx-img-placeholder" style="${Ie}">
2253
+ `.trim()}async function qS(v,_){let k=await FS();if(!k)return ba({...v,process:!1},_);let E=_.tsImagesConfig;if(v.responsiveWidths&&v.responsiveWidths.length>0||v.widths&&v.widths.length>0||!v.width&&!v.dpr){let j=await k.generateResponsiveVariants(v.src,v,E);if(j)return th(v,j,_)}else{let j=await k.processImage(v.src,v,E);if(j.processed)return lu(v,j,_)}return ba({...v,process:!1},_)}async function lu(v,_,k){let{alt:E,width:T,height:j,lazy:B=!0,priority:z=!1,objectFit:F,objectPosition:V,crossorigin:H,referrerpolicy:G}=v,{class:J,style:ne}=v,re=v.id||`stx-img-${Math.random().toString(36).slice(2,8)}`,se=v.data||{},ie=_.variants||[],ae=ie.find((Ie)=>Ie.format==="jpeg")||ie.find((Ie)=>Ie.format==="webp")||ie[0],ue=ae?.url||v.src,oe=ie.filter((Ie)=>Ie.format===(ae?.format||"jpeg")).map((Ie)=>`${Ie.url} ${Ie.width}w`).join(", "),me=new Map;for(let Ie of ie){if(!me.has(Ie.format))me.set(Ie.format,[]);me.get(Ie.format).push(Ie)}let ve=[],$e=["avif","webp","jpeg","png"];for(let Ie of $e){let Ye=me.get(Ie);if(Ye&&Ye.length>0){let at=Ye.map((et)=>`${et.url} ${et.width}w`).join(", "),dt=ru(Ie);if(B&&!z)ve.push(` <source type="${dt}" data-srcset="${at}" />`);else ve.push(` <source type="${dt}" srcset="${at}" />`)}}let _e=[];if(B&&!z){if(_e.push(`data-src="${An(ue)}"`),_e.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"'),oe)_e.push(`data-srcset="${oe}"`)}else if(_e.push(`src="${An(ue)}"`),oe)_e.push(`srcset="${oe}"`);_e.push(`alt="${An(E)}"`);let Re=T||_.originalWidth,Ee=j||_.originalHeight;if(Re)_e.push(`width="${Re}"`);if(Ee)_e.push(`height="${Ee}"`);if(!z)_e.push(`loading="${B?"lazy":"eager"}"`);if(_e.push('decoding="async"'),z)_e.push('fetchpriority="high"');if(H)_e.push(`crossorigin="${H}"`);if(G)_e.push(`referrerpolicy="${G}"`);let Ae=[];if(F)Ae.push(`object-fit: ${F}`);if(V)Ae.push(`object-position: ${V}`);if(_.placeholder&&B)Ae.push("opacity: 0; transition: opacity 300ms ease-out");if(ne)Ae.push(ne);if(Ae.length>0)_e.push(`style="${Ae.join("; ")}"`);let Te=[];if(J)Te.push(J);if(_.placeholder)Te.push("stx-img-blur");if(Te.length>0)_e.push(`class="${Te.join(" ")}"`);if(B&&!z)_e.push("data-stx-lazy");for(let[Ie,Ye]of Object.entries(se))_e.push(`data-${Ie}="${An(Ye)}"`);let ke;if(_.placeholder||_.dominantColor&&v.useDominantColor){let Ie=_.placeholder?`background-image: url('${_.placeholder}'); background-size: cover; background-position: center;`:`background-color: ${_.dominantColor};`;ke=`<div id="${re}" class="stx-img-placeholder" style="${Ie}">
2254
2254
  <picture>
2255
- ${we.join(`
2255
+ ${ve.join(`
2256
2256
  `)}
2257
2257
  <img ${_e.join(" ")} />
2258
2258
  </picture>
2259
2259
  </div>`}else ke=`<picture${re?` id="${re}"`:""}>
2260
- ${we.join(`
2260
+ ${ve.join(`
2261
2261
  `)}
2262
2262
  <img ${_e.join(" ")} />
2263
2263
  </picture>`;let Pe=[];if(_.placeholder)Pe.push(iu);let Ge=B?eh(re):void 0,De;if(z&&oe)De=`<link rel="preload" as="image" imagesrcset="${oe}" />`;return{html:ke,preloadLink:De,css:Pe.length>0?Pe.join(`
2264
2264
  `):void 0,script:Ge}}async function th(v,_,k){let E={src:_.src,processed:!0,variants:[],placeholder:_.placeholder?.dataURL,originalWidth:_.placeholder?.width,originalHeight:_.placeholder?.height};for(let[T,j]of Object.entries(_.byFormat))if(j)E.variants.push(...j);return lu(v,E,k)}function KS(){return Ke({name:"img",hasEndTag:!1,description:"Render an optimized responsive image with srcset and lazy loading",transform:async(v,_,k,E)=>{let{src:T,alt:j,options:B}=XS(v,_,k);if(!T)return console.warn("@img directive: missing src argument"),"<!-- @img: missing src -->";let z={src:T,alt:j||"",widths:B.widths||Gs,formats:B.formats||to,quality:B.quality,sizes:B.sizes,dpr:B.dpr,params:B.params,placeholder:B.placeholder,placeholderOptions:B.placeholderOptions,lazy:B.lazy!==!1,priority:B.priority||!1,loading:B.loading,decoding:B.decoding,fetchpriority:B.fetchpriority,objectFit:B.objectFit,objectPosition:B.objectPosition,class:B.class,style:B.style,id:B.id,width:B.width,height:B.height},F=k.__isDev||!1,V=await ba(z,{isDev:F}),H=V.html;if(V.preloadLink)H=V.preloadLink+`
2265
2265
  `+H;if(V.css)H+=`
2266
2266
  <style>${V.css}</style>`;if(V.script)H+=`
2267
- <script>${V.script}</script>`;return H},defaults:{src:"",alt:"",options:{lazy:!0,placeholder:"none"}}})}function XS(v,_,k){if(_.src)return{src:String(_.src),alt:String(_.alt||""),options:_.options||{}};let E=v.trim();if(E.startsWith("@img(")||E.startsWith("("))E=E.replace(/^@img\(/,"").replace(/^\(/,"").replace(/\)$/,"");let T=ZS(E),j=uu(T[0],k)||"",B=uu(T[1],k)||"",z={};if(T[2]){let F=uu(T[2],k);if(typeof F==="object"&&F!==null)z=F;else if(typeof T[2]==="string")try{z=JSON.parse(T[2])}catch{}}return{src:j,alt:B,options:z}}function ZS(v){let _=[],k="",E=!1,T="",j=0,B=0;for(let z=0;z<v.length;z++){let F=v[z],V=z>0?v[z-1]:"";if((F==='"'||F==="'"||F==="`")&&V!=="\\"){if(!E)E=!0,T=F;else if(F===T)E=!1,T="";else k+=F;continue}if(!E){if(F==="{")j++;if(F==="}")j--;if(F==="[")B++;if(F==="]")B--;if(F===","&&j===0&&B===0){_.push(k.trim()),k="";continue}}k+=F}if(k.trim())_.push(k.trim());return _}function uu(v,_){if(typeof v!=="string")return v;let k=v.trim();if(k.startsWith('"')&&k.endsWith('"')||k.startsWith("'")&&k.endsWith("'"))return k.slice(1,-1);if(!k.startsWith("/")&&!k.startsWith(".")&&!k.startsWith("http")&&!k.startsWith("{")){let E=_[k];if(E!==void 0)return E}if(k.startsWith("{")||k.startsWith("["))try{return JSON.parse(k)}catch{}return k}var nh=KS();async function sh(){try{return await import("./chunk-z2775k8r.js")}catch(v){if(!rh)console.warn("[stx-media] Video processor not available, some features disabled:",v),rh=!0;return null}}var rh=!1,ih=!0,oh="metadata",GS="https://cdn.jsdelivr.net/npm/ts-video-player@latest/dist/index.min.js";async function Sa(v,_={}){let k=_,E=v;if(E.process&&!E.skipProcessing){if(k.tsVideosConfig?.enabled&&!k.isDev)return t0(E,k)}if(k.processedResult?.processed)return ch(v,k.processedResult,_);let T;if(E.generatePoster&&E.src&&!v.poster)T=await n0(E,k);let{src:j,sources:B=[],poster:z,posterPlaceholder:F,controls:V=ih,autoplay:H=!1,muted:G=!1,loop:J=!1,preload:ne=oh,playsinline:re=!0,lazy:se=!0,player:ie="native",type:ae,width:ue,height:oe,crossorigin:me,disablePictureInPicture:we=!1,disableRemotePlayback:$e=!1}=v,_e=T||z,{class:Re,style:Ee}=v,Ae=v.id||`stx-video-${Math.random().toString(36).slice(2,8)}`;if(ie==="ts-video")return YS(v,_);if(ae&&ae!=="video")return JS(j||"",ae,v);let Te=B.length>0?B:j?[{src:j,type:ah(j)}]:[],ke=[`id="${Ae}"`];if(V)ke.push("controls");if(H)ke.push("autoplay");if(G)ke.push("muted");if(J)ke.push("loop");if(re)ke.push("playsinline");if(we)ke.push("disablepictureinpicture");if($e)ke.push("disableremoteplayback");if(me)ke.push(`crossorigin="${me}"`);if(se){if(ke.push(`data-preload="${ne}"`),ke.push('preload="none"'),_e)ke.push(`data-poster="${Ht(_e)}"`);ke.push("data-stx-lazy")}else if(ke.push(`preload="${ne}"`),_e)ke.push(`poster="${Ht(_e)}"`);if(ue)ke.push(`width="${ue}"`);if(oe)ke.push(`height="${oe}"`);if(Re)ke.push(`class="${Ht(Re)}"`);if(Ee)ke.push(`style="${Ht(Ee)}"`);let Pe=Te.map((Ie)=>` <source ${se?`data-src="${Ht(Ie.src)}"`:`src="${Ht(Ie.src)}"`} type="${Ie.type}"${Ie.media?` media="${Ie.media}"`:""} />`).join(`
2267
+ <script>${V.script}</script>`;return H},defaults:{src:"",alt:"",options:{lazy:!0,placeholder:"none"}}})}function XS(v,_,k){if(_.src)return{src:String(_.src),alt:String(_.alt||""),options:_.options||{}};let E=v.trim();if(E.startsWith("@img(")||E.startsWith("("))E=E.replace(/^@img\(/,"").replace(/^\(/,"").replace(/\)$/,"");let T=ZS(E),j=uu(T[0],k)||"",B=uu(T[1],k)||"",z={};if(T[2]){let F=uu(T[2],k);if(typeof F==="object"&&F!==null)z=F;else if(typeof T[2]==="string")try{z=JSON.parse(T[2])}catch{}}return{src:j,alt:B,options:z}}function ZS(v){let _=[],k="",E=!1,T="",j=0,B=0;for(let z=0;z<v.length;z++){let F=v[z],V=z>0?v[z-1]:"";if((F==='"'||F==="'"||F==="`")&&V!=="\\"){if(!E)E=!0,T=F;else if(F===T)E=!1,T="";else k+=F;continue}if(!E){if(F==="{")j++;if(F==="}")j--;if(F==="[")B++;if(F==="]")B--;if(F===","&&j===0&&B===0){_.push(k.trim()),k="";continue}}k+=F}if(k.trim())_.push(k.trim());return _}function uu(v,_){if(typeof v!=="string")return v;let k=v.trim();if(k.startsWith('"')&&k.endsWith('"')||k.startsWith("'")&&k.endsWith("'"))return k.slice(1,-1);if(!k.startsWith("/")&&!k.startsWith(".")&&!k.startsWith("http")&&!k.startsWith("{")){let E=_[k];if(E!==void 0)return E}if(k.startsWith("{")||k.startsWith("["))try{return JSON.parse(k)}catch{}return k}var nh=KS();async function sh(){try{return await import("./chunk-hmyyq2hh.js")}catch(v){if(!rh)console.warn("[stx-media] Video processor not available, some features disabled:",v),rh=!0;return null}}var rh=!1,ih=!0,oh="metadata",GS="https://cdn.jsdelivr.net/npm/ts-video-player@latest/dist/index.min.js";async function Sa(v,_={}){let k=_,E=v;if(E.process&&!E.skipProcessing){if(k.tsVideosConfig?.enabled&&!k.isDev)return t0(E,k)}if(k.processedResult?.processed)return ch(v,k.processedResult,_);let T;if(E.generatePoster&&E.src&&!v.poster)T=await n0(E,k);let{src:j,sources:B=[],poster:z,posterPlaceholder:F,controls:V=ih,autoplay:H=!1,muted:G=!1,loop:J=!1,preload:ne=oh,playsinline:re=!0,lazy:se=!0,player:ie="native",type:ae,width:ue,height:oe,crossorigin:me,disablePictureInPicture:ve=!1,disableRemotePlayback:$e=!1}=v,_e=T||z,{class:Re,style:Ee}=v,Ae=v.id||`stx-video-${Math.random().toString(36).slice(2,8)}`;if(ie==="ts-video")return YS(v,_);if(ae&&ae!=="video")return JS(j||"",ae,v);let Te=B.length>0?B:j?[{src:j,type:ah(j)}]:[],ke=[`id="${Ae}"`];if(V)ke.push("controls");if(H)ke.push("autoplay");if(G)ke.push("muted");if(J)ke.push("loop");if(re)ke.push("playsinline");if(ve)ke.push("disablepictureinpicture");if($e)ke.push("disableremoteplayback");if(me)ke.push(`crossorigin="${me}"`);if(se){if(ke.push(`data-preload="${ne}"`),ke.push('preload="none"'),_e)ke.push(`data-poster="${Ht(_e)}"`);ke.push("data-stx-lazy")}else if(ke.push(`preload="${ne}"`),_e)ke.push(`poster="${Ht(_e)}"`);if(ue)ke.push(`width="${ue}"`);if(oe)ke.push(`height="${oe}"`);if(Re)ke.push(`class="${Ht(Re)}"`);if(Ee)ke.push(`style="${Ht(Ee)}"`);let Pe=Te.map((Ie)=>` <source ${se?`data-src="${Ht(Ie.src)}"`:`src="${Ht(Ie.src)}"`} type="${Ie.type}"${Ie.media?` media="${Ie.media}"`:""} />`).join(`
2268
2268
  `),Ge=`<video ${ke.join(" ")}>
2269
2269
  ${Pe}
2270
2270
  Your browser does not support the video tag.
@@ -2420,7 +2420,7 @@ else {
2420
2420
  });
2421
2421
  }
2422
2422
  })();
2423
- `.trim(),we=`
2423
+ `.trim(),ve=`
2424
2424
  .ts-video-player {
2425
2425
  position: relative;
2426
2426
  background: #000;
@@ -2472,7 +2472,7 @@ else {
2472
2472
  .ts-video-player__play-button svg {
2473
2473
  margin-left: 4px;
2474
2474
  }
2475
- `.trim();return{html:oe,script:me,css:we}}function ah(v){switch(v.split(".").pop()?.toLowerCase()){case"mp4":return"video/mp4";case"webm":return"video/webm";case"ogg":case"ogv":return"video/ogg";case"mov":return"video/quicktime";case"avi":return"video/x-msvideo";case"mkv":return"video/x-matroska";case"m3u8":return"application/x-mpegURL";default:return"video/mp4"}}function QS(v){let _=[/youtube\.com\/watch\?v=([^&]+)/,/youtube\.com\/embed\/([^?]+)/,/youtu\.be\/([^?]+)/,/youtube\.com\/v\/([^?]+)/];for(let k of _){let E=v.match(k);if(E)return E[1]}return null}function e0(v){let _=v.match(/vimeo\.com\/(\d+)/);return _?_[1]:null}function Ht(v){return v.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}async function t0(v,_){let k=await sh();if(!k)return Sa({...v,process:!1},_);let E=_.tsVideosConfig,T=await k.processVideo(v.src,v,E,v.onProcessProgress);if(T.processed)return ch(v,T,_);return Sa({...v,process:!1},_)}async function n0(v,_){let k=await sh();if(!k||!v.src)return;let E=typeof v.generatePoster==="object"?v.generatePoster:{timestamp:0},T=_.tsVideosConfig||{enabled:!0,outputDir:"dist/videos",baseUrl:"/videos"};return(await k.generatePoster(v.src,E,T.outputDir,T.baseUrl||"/videos"))?.url}function ch(v,_,k){let{controls:E=ih,autoplay:T=!1,muted:j=!1,loop:B=!1,preload:z=oh,playsinline:F=!0,lazy:V=!0,width:H,height:G,crossorigin:J,disablePictureInPicture:ne=!1,disableRemotePlayback:re=!1}=v,{class:se,style:ie}=v,ae=v.id||`stx-video-${Math.random().toString(36).slice(2,8)}`,ue=v.src,oe=ah(ue);if(_.transcoded)ue=_.transcoded.url,oe="video/mp4";let me=_.streaming?.hls||_.streaming?.dash;if(me){if(_.streaming?.hls)ue=_.streaming.hls.manifestUrl,oe="application/x-mpegURL";else if(_.streaming?.dash)ue=_.streaming.dash.manifestUrl,oe="application/dash+xml"}let we=_.poster?.url||v.poster,$e=[`id="${ae}"`];if(E)$e.push("controls");if(T)$e.push("autoplay");if(j)$e.push("muted");if(B)$e.push("loop");if(F)$e.push("playsinline");if(ne)$e.push("disablepictureinpicture");if(re)$e.push("disableremoteplayback");if(J)$e.push(`crossorigin="${J}"`);if(V){if($e.push(`data-preload="${z}"`),$e.push('preload="none"'),we)$e.push(`data-poster="${Ht(we)}"`);$e.push("data-stx-lazy")}else if($e.push(`preload="${z}"`),we)$e.push(`poster="${Ht(we)}"`);let _e=H||_.metadata?.width,Re=G||_.metadata?.height;if(_e)$e.push(`width="${_e}"`);if(Re)$e.push(`height="${Re}"`);if(se)$e.push(`class="${Ht(se)}"`);if(ie)$e.push(`style="${Ht(ie)}"`);let Ae=` <source ${V?`data-src="${Ht(ue)}"`:`src="${Ht(ue)}"`} type="${oe}" />`,Te=`<video ${$e.join(" ")}>
2475
+ `.trim();return{html:oe,script:me,css:ve}}function ah(v){switch(v.split(".").pop()?.toLowerCase()){case"mp4":return"video/mp4";case"webm":return"video/webm";case"ogg":case"ogv":return"video/ogg";case"mov":return"video/quicktime";case"avi":return"video/x-msvideo";case"mkv":return"video/x-matroska";case"m3u8":return"application/x-mpegURL";default:return"video/mp4"}}function QS(v){let _=[/youtube\.com\/watch\?v=([^&]+)/,/youtube\.com\/embed\/([^?]+)/,/youtu\.be\/([^?]+)/,/youtube\.com\/v\/([^?]+)/];for(let k of _){let E=v.match(k);if(E)return E[1]}return null}function e0(v){let _=v.match(/vimeo\.com\/(\d+)/);return _?_[1]:null}function Ht(v){return v.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}async function t0(v,_){let k=await sh();if(!k)return Sa({...v,process:!1},_);let E=_.tsVideosConfig,T=await k.processVideo(v.src,v,E,v.onProcessProgress);if(T.processed)return ch(v,T,_);return Sa({...v,process:!1},_)}async function n0(v,_){let k=await sh();if(!k||!v.src)return;let E=typeof v.generatePoster==="object"?v.generatePoster:{timestamp:0},T=_.tsVideosConfig||{enabled:!0,outputDir:"dist/videos",baseUrl:"/videos"};return(await k.generatePoster(v.src,E,T.outputDir,T.baseUrl||"/videos"))?.url}function ch(v,_,k){let{controls:E=ih,autoplay:T=!1,muted:j=!1,loop:B=!1,preload:z=oh,playsinline:F=!0,lazy:V=!0,width:H,height:G,crossorigin:J,disablePictureInPicture:ne=!1,disableRemotePlayback:re=!1}=v,{class:se,style:ie}=v,ae=v.id||`stx-video-${Math.random().toString(36).slice(2,8)}`,ue=v.src,oe=ah(ue);if(_.transcoded)ue=_.transcoded.url,oe="video/mp4";let me=_.streaming?.hls||_.streaming?.dash;if(me){if(_.streaming?.hls)ue=_.streaming.hls.manifestUrl,oe="application/x-mpegURL";else if(_.streaming?.dash)ue=_.streaming.dash.manifestUrl,oe="application/dash+xml"}let ve=_.poster?.url||v.poster,$e=[`id="${ae}"`];if(E)$e.push("controls");if(T)$e.push("autoplay");if(j)$e.push("muted");if(B)$e.push("loop");if(F)$e.push("playsinline");if(ne)$e.push("disablepictureinpicture");if(re)$e.push("disableremoteplayback");if(J)$e.push(`crossorigin="${J}"`);if(V){if($e.push(`data-preload="${z}"`),$e.push('preload="none"'),ve)$e.push(`data-poster="${Ht(ve)}"`);$e.push("data-stx-lazy")}else if($e.push(`preload="${z}"`),ve)$e.push(`poster="${Ht(ve)}"`);let _e=H||_.metadata?.width,Re=G||_.metadata?.height;if(_e)$e.push(`width="${_e}"`);if(Re)$e.push(`height="${Re}"`);if(se)$e.push(`class="${Ht(se)}"`);if(ie)$e.push(`style="${Ht(ie)}"`);let Ae=` <source ${V?`data-src="${Ht(ue)}"`:`src="${Ht(ue)}"`} type="${oe}" />`,Te=`<video ${$e.join(" ")}>
2476
2476
  ${Ae}
2477
2477
  Your browser does not support the video tag.
2478
2478
  </video>`;if(_.spriteSheet)Te=`<div class="stx-video-wrapper" data-sprite-sheet="${Ht(_.spriteSheet.url)}" data-sprite-cols="${_.spriteSheet.columns}" data-sprite-interval="${_.spriteSheet.interval}">
@@ -2615,8 +2615,8 @@ class ${_.replace(/\W/g,"")} extends ${E} {
2615
2615
 
2616
2616
  // Register the web component
2617
2617
  customElements.define('${k}', ${_.replace(/\W/g,"")})
2618
- `}function c0(v){let{name:_,tag:k,baseElement:E="HTMLElement",source:T,shadowDOM:j,template:B,styleSource:z,attributes:F=[],attributeTypes:V={}}=v,H=_.replace(/\W/g,""),G=T.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").trim();if(!j)G=G.replace(/<slot\s+name=["']([^"']+)["']\s*>([\s\S]*?)<\/slot>/gi,'<div data-slot="$1">$2</div>'),G=G.replace(/<slot\s+name=["']([^"']+)["']\s*\/>/gi,'<div data-slot="$1"></div>'),G=G.replace(/<slot\s*>([\s\S]*?)<\/slot>/gi,"<div data-default-slot>$1</div>"),G=G.replace(/<slot\s*\/>/gi,"<div data-default-slot></div>");G=G.replace(/`/g,"\\`").replace(/\$\{/g,"\\${");let J=z?`<link rel="stylesheet" href="${z}">`:"",ne=(we)=>{switch(V[we]){case"number":return"number";case"boolean":return"boolean";case"object":return"Record<string, unknown>";default:return"string"}},re=(we)=>we.replace(/-([a-z])/g,($e,_e)=>_e.toUpperCase()),se=F.map((we)=>` private _${re(we)}: ${ne(we)} | null = null;`).join(`
2619
- `),ie=F.map((we)=>{let $e=ne(we),_e=re(we);return`
2618
+ `}function c0(v){let{name:_,tag:k,baseElement:E="HTMLElement",source:T,shadowDOM:j,template:B,styleSource:z,attributes:F=[],attributeTypes:V={}}=v,H=_.replace(/\W/g,""),G=T.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").trim();if(!j)G=G.replace(/<slot\s+name=["']([^"']+)["']\s*>([\s\S]*?)<\/slot>/gi,'<div data-slot="$1">$2</div>'),G=G.replace(/<slot\s+name=["']([^"']+)["']\s*\/>/gi,'<div data-slot="$1"></div>'),G=G.replace(/<slot\s*>([\s\S]*?)<\/slot>/gi,"<div data-default-slot>$1</div>"),G=G.replace(/<slot\s*\/>/gi,"<div data-default-slot></div>");G=G.replace(/`/g,"\\`").replace(/\$\{/g,"\\${");let J=z?`<link rel="stylesheet" href="${z}">`:"",ne=(ve)=>{switch(V[ve]){case"number":return"number";case"boolean":return"boolean";case"object":return"Record<string, unknown>";default:return"string"}},re=(ve)=>ve.replace(/-([a-z])/g,($e,_e)=>_e.toUpperCase()),se=F.map((ve)=>` private _${re(ve)}: ${ne(ve)} | null = null;`).join(`
2619
+ `),ie=F.map((ve)=>{let $e=ne(ve),_e=re(ve);return`
2620
2620
  get ${_e}(): ${$e} | null {
2621
2621
  return this._${_e};
2622
2622
  }
@@ -2624,22 +2624,22 @@ customElements.define('${k}', ${_.replace(/\W/g,"")})
2624
2624
  set ${_e}(value: ${$e} | null) {
2625
2625
  this._${_e} = value;
2626
2626
  if (value !== null) {
2627
- this.setAttribute('${we}', String(value));
2627
+ this.setAttribute('${ve}', String(value));
2628
2628
  }
2629
2629
  else {
2630
- this.removeAttribute('${we}');
2630
+ this.removeAttribute('${ve}');
2631
2631
  }
2632
2632
  }`}).join(`
2633
2633
  `),ae=F.length>0?`/**
2634
2634
  * Props interface for ${_}
2635
2635
  */
2636
2636
  export interface ${H}Props {
2637
- ${F.map((we)=>{let $e=ne(we);return` ${re(we)}?: ${$e};`}).join(`
2637
+ ${F.map((ve)=>{let $e=ne(ve);return` ${re(ve)}?: ${$e};`}).join(`
2638
2638
  `)}
2639
2639
  }
2640
2640
  `:"",ue=F.length>0?`
2641
2641
  static get observedAttributes(): string[] {
2642
- return [${F.map((we)=>`'${we}'`).join(", ")}];
2642
+ return [${F.map((ve)=>`'${ve}'`).join(", ")}];
2643
2643
  }
2644
2644
 
2645
2645
  attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void {
@@ -2823,6 +2823,6 @@ ${H}
2823
2823
  customElements.define('${_}', ${B});
2824
2824
  `}async function dh(v,_,k,E){if(_.length<1)return i("WebComponent","@webcomponent directive requires at least the tag name parameter",t.INVALID_DIRECTIVE_SYNTAX);let T=_[0].replace(/['"]/g,""),B=(k.__stx_options||{}).componentsDir||"components",z=_n.isAbsolute(B)?[_n.join(B,`${T}.stx`),_n.join(_n.dirname(E),`${T}.stx`)]:[_n.join(_n.dirname(E),B,`${T}.stx`),_n.join(process.cwd(),B,`${T}.stx`),_n.join(_n.dirname(E),`${T}.stx`)],F=null;for(let G of z)if(await r(G)){F=await Bun.file(G).text();break}if(!F)return i("WebComponent",`Component file not found: ${T}.stx`,t.FILE_NOT_FOUND);let V=l0(F,T);return`<script type="module">
2825
2825
  ${u0(V)}
2826
- </script>`}var R={enabled:!0,ssr:!1,partialsDir:"partials",componentsDir:"components",layoutsDir:"layouts",defaultLayout:"default",debug:!1,cache:!0,stateDir:$t,cachePath:".stx/cache",cacheVersion:"1.0.0",componentRenderCacheBytes:33554432,build:{pagesDir:"pages",outputDir:"dist",baseUrl:"/",sitemap:!0,minify:!0,cache:!0,cacheDir:".stx/ssg-cache",concurrency:10,generate404:!0,publicDir:"public",trailingSlash:!1,cleanOutput:!0},customDirectives:[{name:"markdown",handler:Km,hasEndTag:!0,description:"Render markdown content to HTML"},{name:"webcomponent",handler:dh,hasEndTag:!1,description:"Include a web component in the template"},bi,vi,er,tr,xu,vu,wu,bu,$u,Eu,nh,du,...fr],middleware:[],i18n:{defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},webComponents:{enabled:!1,outputDir:"dist/web-components",components:[]},docs:{enabled:!1,outputDir:"docs",format:"markdown",components:!0,templates:!0,directives:!0},streaming:{enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},hydration:{enabled:!1,mode:"islands",clientEntry:"src/client.ts",autoMarkers:!0,preload:"lazy"},router:{enabled:!0,container:"main",linkSelector:"a[href]",viewTransitions:!0,scrollToTop:!0,scrollRestoration:!0,prefetch:!0,cache:!0,cacheTTL:300000,skipSelectors:'[data-no-router], [target="_blank"]',viewTransitionCSS:{oldRoot:"fade-out 0.15s ease-in",newRoot:"fade-in 0.2s ease-out",oldContent:"slide-out 0.2s ease-in",newContent:"slide-in 0.25s ease-out"}},a11y:{enabled:!0,addSrOnlyStyles:!0,level:"AA",autoFix:!1,ignoreChecks:[]},seo:{enabled:!0,socialPreview:!0,defaultConfig:{title:"stx Project",description:"A website built with stx templating engine"}},animation:{enabled:!0,defaultDuration:300,defaultEase:"ease",respectMotionPreferences:!0,staggerDelay:50},markdown:{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0,additionalThemes:["light-plus","one-dark-pro","dracula","monokai","solarized-light","nord","github-dark"]}},loops:{maxWhileIterations:1000,useAltLoopVariable:!1},story:{enabled:!0,outDir:".stx/dist/story",storyMatch:["**/*.story.stx"],storyIgnored:["**/node_modules/**","**/dist/**","**/.stx/**"],port:6006},pwa:{enabled:!1,manifest:{name:"stx App",shortName:"stx",description:"A Progressive Web App built with stx",startUrl:"/",display:"standalone",orientation:"any",themeColor:"#000000",backgroundColor:"#ffffff",scope:"/"},icons:{src:"public/icon.png",sizes:[72,96,128,144,152,192,384,512],generateWebP:!0,generateAppleIcons:!0,outputDir:"pwa-icons",purpose:["any","maskable"]},routes:[{pattern:"/",strategy:"network-first"},{pattern:"/static/*",strategy:"cache-first",maxAgeSeconds:2592000},{pattern:"/api/*",strategy:"network-only"},{pattern:"*.js",strategy:"stale-while-revalidate"},{pattern:"*.css",strategy:"stale-while-revalidate"},{pattern:"*.png",strategy:"cache-first"},{pattern:"*.jpg",strategy:"cache-first"},{pattern:"*.webp",strategy:"cache-first"},{pattern:"*.svg",strategy:"cache-first"}],offline:{enabled:!0,fallbackTitle:"You are offline",fallbackMessage:"Please check your internet connection and try again.",precacheAssets:[]},serviceWorker:{fileName:"sw.js",cacheVersion:"1.0.0",skipWaiting:!0,clientsClaim:!0,navigationPreload:!1,excludeRoutes:["/api/auth/*"],cacheFileTypes:["html","css","js","png","jpg","jpeg","webp","svg","woff","woff2"],useWorkbox:!1},autoInject:!0,push:{enabled:!1,defaultOptions:{vibrate:[100,50,100],requireInteraction:!1}},backgroundSync:{enabled:!1,queueName:"stx-sync-queue",maxRetentionMinutes:1440,maxRetries:3,minInterval:1000,forms:[],endpoints:[]},shareTarget:{enabled:!1,action:"/share-target",method:"POST",enctype:"multipart/form-data",params:{title:"title",text:"text",url:"url"}},fileHandlers:{enabled:!1},protocolHandlers:[],cacheStorage:{maxSize:100,maxEntries:500,maxAge:30,purgeStrategy:"lru"},updates:{enabled:!0,promptUser:!0,autoReload:!1,message:"A new version is available. Reload to update?"},precache:{enabled:!0,includeHtml:!0,includeJs:!0,includeCss:!0,includeImages:!0,includeFonts:!0,include:[],exclude:["*.map","*.LICENSE.txt"],maxFileSizeKB:500}},media:{enabled:!0,image:{enabled:!0,defaultWidths:[320,480,640,768,1024,1280,1536,1920],defaultFormats:["avif","webp","jpeg"],defaultQuality:80,placeholderStrategy:"thumbhash",lazyByDefault:!0,enableDpr:!0,defaultDpr:[1,2,3],tsImages:{enabled:!0,outputDir:"dist/images",baseUrl:"/images",formatQuality:{jpeg:{quality:85,mozjpeg:!0,progressive:!0},png:{compressionLevel:9,palette:!1},webp:{quality:82,effort:5,smartSubsample:!0},avif:{quality:75,effort:4,lossless:!1}},breakpoints:[320,480,640,768,1024,1280,1536,1920],batchOptions:{concurrency:4,optimizationPreset:"web"}}},video:{enabled:!0,lazyByDefault:!0,defaultControls:!0,tsVideos:{enabled:!0,outputDir:"dist/videos",baseUrl:"/videos",defaultQuality:"high",streaming:{enabled:!0,format:"hls",segmentDuration:6,defaultQualities:[{label:"1080p",width:1920,height:1080,bitrate:5000000,audioBitrate:192000},{label:"720p",width:1280,height:720,bitrate:2500000,audioBitrate:128000},{label:"480p",width:854,height:480,bitrate:1e6,audioBitrate:96000}]},thumbnails:{enabled:!0,count:10,format:"webp",width:320},transcoding:{defaultCodec:"h264",defaultAudioCodec:"aac",speedPreset:"medium"}}},upload:{enabled:!0,maxSize:10485760,allowedTypes:["image/*","video/*","audio/*","application/pdf"],maxConcurrent:3},protected:{enabled:!0,expirationSeconds:3600,batchSize:10},cache:{enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500}},broadcasting:{enabled:!1,driver:"bun",host:"0.0.0.0",port:6001,scheme:"ws",verbose:!1}};function d0(v,_,k){let E=_||"pages";if(v)return{root:v,pagesDir:E};let T=k||process.cwd(),j=qt.join(T,"resources","views"),B=qt.join(T,"resources","layouts");if(Js.existsSync(j)&&Js.existsSync(B))return{root:"resources",pagesDir:"views"};let z=qt.join(T,"resources","views","pages");if(Js.existsSync(z))return{root:"resources/views",pagesDir:E};return{root:".",pagesDir:E}}var fh=new Set,_a=["partialsDir","componentsDir","layoutsDir"],pu=new WeakMap;function f0(v,_){let k=_.replace(/[\\/]+$/,"");if(!k||k===".")return!0;let E=v.replace(/\\/g,"/"),T=k.replace(/\\/g,"/");return E===T||E.startsWith(`${T}/`)}function Nc(v,_){let k=!v.root,E=d0(v.root,v.pagesDir,_);if(v.root=E.root,v.pagesDir=E.pagesDir,k&&E.root!=="."){let T=`${_}::${E.root}`;if(!fh.has(T))fh.add(T),console.warn(`[stx] No "root" in config \u2014 inferred "${E.root}" from the project layout. Template directories are resolved under it; set root explicitly to pin this.`)}if(!pu.has(v)){let T={};for(let j of _a){let B=v[j];if(typeof B==="string"&&B)T[j]=B}pu.set(v,T)}if(v.root&&v.root!=="."){let T=v.root;for(let j of _a){let B=v[j];if(typeof B!=="string"||!B)continue;if(qt.isAbsolute(B)||f0(B,T))continue;v[j]=qt.join(T,B)}}for(let T of _a){let j=v[T];if(typeof j!=="string"||!j||qt.isAbsolute(j))continue;v[T]=qt.resolve(_,j)}return v}function p0(v,_){let k=pu.get(v);for(let E of _a){let T=v[E];if(typeof T!=="string"||!T)continue;let j=qt.isAbsolute(T)?T:qt.join(_,T);if(Js.existsSync(j))continue;let B=k?.[E]??T,z=v.root,F=!!z&&z!==".";console.warn(`[stx] ${String(E)} resolves to "${j}", which does not exist. Configured as "${B}"`+(F?`, resolved under root "${z}".`:"."))}}function g0(v){if(v.customDirectives)v.customDirectives=[...v.customDirectives];if(v.middleware)v.middleware=[...v.middleware];if(v.apiRoutes)v.apiRoutes={...v.apiRoutes}}function m0(v){if(Ci(v.stateDir),v.stateDir=cn(),v.cachePath=ln(v.cachePath),v.build)v.build.cacheDir=ln(v.build.cacheDir);if(v.media?.cache)v.media.cache.directory=ln(v.media.cache.directory);if(v.story)v.story.outDir=ln(v.story.outDir)}var _r=null,Br=new Map,$a=new Map,ro=null;async function o(v){let _=v?qt.resolve(v):process.cwd(),k=$a.get(_);if(k&&k.signature!==Yn(k.graph)){let j=Br.get(_);if(Br.delete(_),$a.delete(_),!v)_r=null,ro=null;let{clearComponentCache:B}=await import("./chunk-pan2t7h3.js"),{partialsCache:z}=await import("./chunk-144xhefw.js");if(B(),z.clear(),j&&k.configSignature===Zn(k.graph)){let F=j.then(async(V)=>{let H={...k.graph};await ks(H,_),$a.set(_,{graph:H,signature:Yn(H),configSignature:Zn(H)});let G={...V,_layerGraph:H};if(!v)_r=G;return G});return Br.set(_,F),F}}if(!v){if(_r)return _r;if(ro)return ro}let E=Br.get(_);if(E)return E;let T=(async()=>{let j=[".ts",".js",".mjs",".cjs",".json"],B=j.some((J)=>Js.existsSync(qt.join(_,`stx.config${J}`))),z=j.some((J)=>Js.existsSync(qt.join(_,"config",`ui${J}`))),F;if(B&&z){let J=await fu({name:"ui",cwd:qt.join(_,"config"),defaultConfig:R,verbose:!1});F=(await fu({name:"stx",alias:"ui",cwd:_,defaultConfig:J.config,verbose:!1})).config}else F=(await fu({name:"stx",alias:"ui",cwd:_,defaultConfig:R,verbose:!1})).config;if(F.extends!==void 0||k){let J=await Si(_,R);F=J.config,$a.set(_,{graph:J.graph,signature:Yn(J.graph),configSignature:Zn(J.graph)})}if(F.runtimeConfig){let{resolveRuntimeConfig:J}=await import("./chunk-w9kj6t7s.js");J(F.runtimeConfig,{});let{generateRuntimeConfigTypes:ne}=await import("./chunk-j7bncsd9.js");await ne(_,F.runtimeConfig)}g0(F),m0(F),Nc(F,_),p0(F,_);let V=[],H=new Set((F.plugins??[]).map((J)=>typeof J==="string"?J:J[0]));for(let J of F.componentPackages??["@stacksjs/components"]){let ne=`${J}/stx-plugin`;if(H.has(ne)||H.has(J))continue;try{d.resolve(ne,{paths:[_]}),V.push(ne)}catch{}}let G=[...F.plugins??[],...V];if(G.length>0){let{pluginManager:J}=await import("./chunk-jtwx2xte.js"),ne=[],re=[];for(let se of G){let ie=typeof se==="string"?se:se[0],ae=typeof se==="string"?{}:se[1]||{};try{let ue,oe;try{let we=d.resolve(ie,{paths:[_]});ue=await import(we),oe=qt.dirname(we)}catch{let we=qt.resolve(_,ie);ue=await import(we),oe=qt.dirname(we)}let me=ue.default||ue;if(!J.has(me.name))await J.register(me,F);if(me.components){let we=Array.isArray(me.components)?me.components:[me.components];for(let $e of we)ne.push(qt.resolve(oe,$e))}if(me.pages){let we=qt.resolve(oe,me.pages),$e=ae.path||"/";re.push({dir:we,prefix:$e})}if(me.setup){let we={addDirective:($e)=>{F.customDirectives=F.customDirectives||[],F.customDirectives.push($e)},addRoute:($e,_e)=>{F.apiRoutes=F.apiRoutes||{},F.apiRoutes[$e]=_e},addMiddleware:($e)=>{F.middleware=F.middleware||[],F.middleware.push($e)},pluginDir:oe,config:F};await me.setup(ae,we)}process.stderr.write(`[stx] Plugin loaded: ${me.name||ie}
2827
- `)}catch(ue){console.warn(`[stx] Failed to load plugin ${ie}:`,ue.message)}}F._pluginComponentDirs=ne,F._pluginPageDirs=re}return F})();if(Br.set(_,T),T.catch(()=>{if(Br.get(_)===T)Br.delete(_)}),!v)ro=T,T.then((j)=>{_r=j}).catch(()=>{});return T}var A=new Proxy(R,{get(v,_){if(_r&&_ in _r)return _r[_];if(!ro)o().catch((k)=>{console.warn("[stx] Failed to load config file:",k?.message||k)});return v[_]}});function Yd(v){return v}function Zd(v){let _=[],k=[];if(v.partialsDir!==void 0&&typeof v.partialsDir!=="string")_.push({path:"partialsDir",message:"partialsDir must be a string",severity:"error"});if(v.componentsDir!==void 0&&typeof v.componentsDir!=="string")_.push({path:"componentsDir",message:"componentsDir must be a string",severity:"error"});if(v.cache!==void 0&&typeof v.cache!=="boolean")_.push({path:"cache",message:"cache must be a boolean",severity:"error"});if(v.debug!==void 0&&typeof v.debug!=="boolean")_.push({path:"debug",message:"debug must be a boolean",severity:"error"});if(v.streaming){if(v.streaming.bufferSize!==void 0){if(typeof v.streaming.bufferSize!=="number"||v.streaming.bufferSize<=0)_.push({path:"streaming.bufferSize",message:"streaming.bufferSize must be a positive number",severity:"error"})}if(v.streaming.timeout!==void 0){if(typeof v.streaming.timeout!=="number"||v.streaming.timeout<=0)_.push({path:"streaming.timeout",message:"streaming.timeout must be a positive number",severity:"error"})}if(v.streaming.strategy!==void 0){let E=["auto","manual","sections"];if(!E.includes(v.streaming.strategy))_.push({path:"streaming.strategy",message:`streaming.strategy must be one of: ${E.join(", ")}`,severity:"error"})}}if(v.i18n){if(v.i18n.format!==void 0){let E=["json","yaml","yml","js"];if(!E.includes(v.i18n.format))_.push({path:"i18n.format",message:`i18n.format must be one of: ${E.join(", ")}`,severity:"error"})}}if(v.animation){if(v.animation.defaultDuration!==void 0){if(typeof v.animation.defaultDuration!=="number"||v.animation.defaultDuration<0)_.push({path:"animation.defaultDuration",message:"animation.defaultDuration must be a non-negative number",severity:"error"})}if(v.animation.staggerDelay!==void 0){if(typeof v.animation.staggerDelay!=="number"||v.animation.staggerDelay<0)_.push({path:"animation.staggerDelay",message:"animation.staggerDelay must be a non-negative number",severity:"error"})}}if(v.a11y){if(v.a11y.level!==void 0){let E=["AA","AAA"];if(!E.includes(v.a11y.level))_.push({path:"a11y.level",message:`a11y.level must be one of: ${E.join(", ")}`,severity:"error"})}}if(v.hydration){if(v.hydration.mode!==void 0){let E=["progressive","islands"];if(!E.includes(v.hydration.mode))_.push({path:"hydration.mode",message:`hydration.mode must be one of: ${E.join(", ")}`,severity:"error"})}if(v.hydration.preload!==void 0){let E=["none","eager","lazy"];if(!E.includes(v.hydration.preload))_.push({path:"hydration.preload",message:`hydration.preload must be one of: ${E.join(", ")}`,severity:"error"})}}if(v.customDirectives)if(!Array.isArray(v.customDirectives))_.push({path:"customDirectives",message:"customDirectives must be an array",severity:"error"});else v.customDirectives.forEach((E,T)=>{if(!E.name||typeof E.name!=="string")_.push({path:`customDirectives[${T}].name`,message:"Custom directive must have a name string",severity:"error"});if(!E.handler||typeof E.handler!=="function")_.push({path:`customDirectives[${T}].handler`,message:"Custom directive must have a handler function",severity:"error"})});if(v.middleware)if(!Array.isArray(v.middleware))_.push({path:"middleware",message:"middleware must be an array",severity:"error"});else v.middleware.forEach((E,T)=>{if(!E.name||typeof E.name!=="string")_.push({path:`middleware[${T}].name`,message:"Middleware must have a name string",severity:"error"});if(!E.handler||typeof E.handler!=="function")_.push({path:`middleware[${T}].handler`,message:"Middleware must have a handler function",severity:"error"});if(!E.timing||!["before","after"].includes(E.timing))_.push({path:`middleware[${T}].timing`,message:'Middleware timing must be "before" or "after"',severity:"error"})});if(v.debug===!0&&v.cache===!0)k.push({path:"debug+cache",message:"Debug mode with caching enabled may show stale content during development",severity:"warning"});if(v.seo?.enabled===!0&&!v.seo?.defaultConfig?.title)k.push({path:"seo.defaultConfig.title",message:"SEO is enabled but no default title is set",severity:"warning"});if(v.pwa){if(v.pwa.enabled===!0&&!v.pwa.manifest?.name)_.push({path:"pwa.manifest.name",message:"PWA manifest name is required when PWA is enabled",severity:"error"});if(v.pwa.manifest?.display!==void 0){let E=["fullscreen","standalone","minimal-ui","browser"];if(!E.includes(v.pwa.manifest.display))_.push({path:"pwa.manifest.display",message:`PWA display must be one of: ${E.join(", ")}`,severity:"error"})}if(v.pwa.manifest?.orientation!==void 0){let E=["portrait","landscape","any","portrait-primary","portrait-secondary","landscape-primary","landscape-secondary"];if(!E.includes(v.pwa.manifest.orientation))_.push({path:"pwa.manifest.orientation",message:`PWA orientation must be one of: ${E.join(", ")}`,severity:"error"})}if(v.pwa.routes){let E=["cache-first","network-first","stale-while-revalidate","network-only","cache-only"];v.pwa.routes.forEach((T,j)=>{if(!T.pattern||typeof T.pattern!=="string")_.push({path:`pwa.routes[${j}].pattern`,message:"PWA route must have a pattern string",severity:"error"});if(!E.includes(T.strategy))_.push({path:`pwa.routes[${j}].strategy`,message:`PWA route strategy must be one of: ${E.join(", ")}`,severity:"error"});if(T.maxAgeSeconds!==void 0&&(typeof T.maxAgeSeconds!=="number"||T.maxAgeSeconds<0))_.push({path:`pwa.routes[${j}].maxAgeSeconds`,message:"PWA route maxAgeSeconds must be a non-negative number",severity:"error"});if(T.maxEntries!==void 0&&(typeof T.maxEntries!=="number"||T.maxEntries<1))_.push({path:`pwa.routes[${j}].maxEntries`,message:"PWA route maxEntries must be a positive number",severity:"error"})})}if(v.pwa.icons?.sizes){if(!Array.isArray(v.pwa.icons.sizes))_.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be an array of numbers",severity:"error"});else if(v.pwa.icons.sizes.filter((T)=>typeof T!=="number"||T<16||T>1024).length>0)_.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be numbers between 16 and 1024",severity:"error"})}if(v.pwa.icons?.purpose){let E=["any","maskable","monochrome"];if(v.pwa.icons.purpose.filter((j)=>!E.includes(j)).length>0)_.push({path:"pwa.icons.purpose",message:`PWA icon purpose must be one of: ${E.join(", ")}`,severity:"error"})}if(v.pwa.enabled===!0&&!v.pwa.icons?.src)k.push({path:"pwa.icons.src",message:"PWA is enabled but no icon source specified. Provide a 512x512 PNG for best results.",severity:"warning"});if(v.pwa.enabled===!0&&!v.pwa.manifest?.themeColor)k.push({path:"pwa.manifest.themeColor",message:"PWA theme color not set, defaulting to black",severity:"warning"})}return{valid:_.length===0,errors:_,warnings:k}}var mu=new Map;async function le(v,_={}){try{if(!await r(v))throw Error(`Markdown file not found: ${v}`);let E=(await h0.promises.stat(v)).mtime.getTime();if(_.cache&&mu.has(v)){let G=mu.get(v);if(G.updatedAt>=E)return{content:G.content,data:G.data}}let T=await Bun.file(v).text(),{data:j,content:B}=jn(T),z=_.markdown||A.markdown||{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0}},V=Me(B,{gfm:!0});if(z.syntaxHighlighting?.enabled&&z.syntaxHighlighting?.serverSide)V=await x0(V,z.syntaxHighlighting?.defaultTheme||"github-dark",z.syntaxHighlighting?.highlightUnknownLanguages||!1);let H={content:V,data:j||{}};if(_.cache)mu.set(v,{...H,updatedAt:E});return H}catch(k){if(_.debug)console.error(`Error reading/parsing markdown file ${v}:`,k);let E=k instanceof Error?k.message:String(k);return{content:g("Markdown File",`Error reading/parsing markdown file: ${E}`,v,"",0,""),data:{}}}}var ka=null;async function x0(v,_,k){let E=/<pre><code( class="language-([^"]+)")?>([^<]+)<\/code><\/pre>/g;if(!ka)try{ka=await y0({theme:_||"github-dark",cache:!0})}catch(z){return console.error("Failed to initialize ts-syntax-highlighter:",z),v}let T=async(z,F,V,H)=>{let G=H.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&").replace(/&quot;/g,'"').replace(/&#39;/g,"'"),J=V||(k?"text":"");if(!J)return z;try{if(!ka.getSupportedLanguages().includes(J))return z;return(await ka.highlight(G,J,{theme:_})).html}catch(ne){console.error(`Error highlighting code block with language ${V}:`,ne)}return z},j=v,B=v.matchAll(E);for(let z of B){let[F,V,H,G]=z,J=await T(F,V,H,G);j=j.replace(F,J)}return j}async function km(v,_,k="",E={}){return await b0(v,/@markdown-file\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\}))?\)/g,async(B,z,F,V)=>{try{let H=z;if(!gu.isAbsolute(z))H=gu.resolve(gu.dirname(k),z);let G={};if(F)try{try{G=JSON.parse(F)}catch{if(E.debug)console.warn("Using safer alternative for parsing JS object literal");let ue=F.replace(/^\s*\{|\}\s*$/g,"").trim().split(/,(?=\s*\w+\s*:)/);for(let oe of ue){let me=oe.indexOf(":");if(me>0){let we=oe.substring(0,me).trim(),$e=oe.substring(me+1).trim(),_e=$e.startsWith('"')&&$e.endsWith('"'),Re=$e.startsWith("'")&&$e.endsWith("'");if(_e||Re)$e=$e.substring(1,$e.length-1);G[we]=$e}}}}catch(ae){if(E.debug)console.error("Error parsing context in @markdown-file directive:",ae)}let{content:J,data:ne}=await le(H,E),re={..._,...ne,...G},se=J,ie=/\{\{([^}]+)\}\}/g;return se=se.replace(ie,(ae,ue)=>{let oe=ue.trim();return re[oe]!==void 0?String(re[oe]):ae}),se}catch(H){let G=H instanceof Error?H.message:String(H);return g("Markdown File",`Error including markdown file: ${G}`,k,v,V,B)}})}async function b0(v,_,k){let E=[],T;while((T=_.exec(v))!==null){let z=T[0],F=T.index,V=T;E.push(k(...V).then((H)=>({match:z,replacement:H,index:F})))}let j=await Promise.all(E);j.sort((z,F)=>F.index-z.index);let B=v;for(let{match:z,replacement:F}of j)B=B.replace(z,()=>F);return B}
2828
- export{jn,Me,M,U,m,h,tn,W,w,Ne,Gr,Jr,Za,wt,Ho,Yr,Vo,Rd,Le,Zr,he,Uo,Wo,qo,Qr,Y,je,xt,Bn,Qa,Ad,ec,Pd,tc,Fn,b,St,ye,nc,es,rc,Id,q,sc,Dd,x,Od,oc,Md,Nd,Ld,jd,ic,ac,Bd,Fd,Ko,zd,nn,rn,zn,Hn,e,Hd,Xo,Vd,Go,cc,lc,kt,sn,Ud,dc,uc,pc,f,Be,Ct,Fe,ze,Jo,Vn,Z,ts,ns,rs,Wd,Un,qd,on,He,ss,os,fc,Q,Yo,Zo,Qo,ei,Wn,is,ti,ni,ri,gc,as,N,ce,K,Kd,mc,cs,ls,si,oi,ds,us,qn,hc,ii,ai,yc,Ve,an,Kn,Et,bc,vc,wc,xc,Sc,u,kc,ps,Cc,ci,li,gs,di,Ec,Xd,$c,be,ui,Gd,ms,hs,ys,pi,bs,vs,ws,xs,n,Tc,_c,Rc,Ac,Pc,Ic,Ue,L,We,Dc,Xn,Oc,fi,Mc,qe,r,Gn,gi,g,ee,Jd,Jn,R,Nc,o,A,Yd,Zd,le};
2826
+ </script>`}var R={enabled:!0,ssr:!1,partialsDir:"partials",componentsDir:"components",layoutsDir:"layouts",defaultLayout:"default",debug:!1,cache:!0,stateDir:$t,cachePath:".stx/cache",cacheVersion:"1.0.0",componentRenderCacheBytes:33554432,build:{pagesDir:"pages",outputDir:"dist",baseUrl:"/",sitemap:!0,minify:!0,cache:!0,cacheDir:".stx/ssg-cache",concurrency:10,generate404:!0,publicDir:"public",trailingSlash:!1,cleanOutput:!0},customDirectives:[{name:"markdown",handler:Km,hasEndTag:!0,description:"Render markdown content to HTML"},{name:"webcomponent",handler:dh,hasEndTag:!1,description:"Include a web component in the template"},bi,wi,er,tr,xu,vu,wu,bu,$u,Eu,nh,du,...fr],middleware:[],i18n:{defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},webComponents:{enabled:!1,outputDir:"dist/web-components",components:[]},docs:{enabled:!1,outputDir:"docs",format:"markdown",components:!0,templates:!0,directives:!0},streaming:{enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},hydration:{enabled:!1,mode:"islands",clientEntry:"src/client.ts",autoMarkers:!0,preload:"lazy"},router:{enabled:!0,container:"main",linkSelector:"a[href]",viewTransitions:!0,scrollToTop:!0,scrollRestoration:!0,prefetch:!0,cache:!0,cacheTTL:300000,skipSelectors:'[data-no-router], [target="_blank"]',viewTransitionCSS:{oldRoot:"fade-out 0.15s ease-in",newRoot:"fade-in 0.2s ease-out",oldContent:"slide-out 0.2s ease-in",newContent:"slide-in 0.25s ease-out"}},a11y:{enabled:!0,addSrOnlyStyles:!0,level:"AA",autoFix:!1,ignoreChecks:[]},seo:{enabled:!0,socialPreview:!0,defaultConfig:{title:"stx Project",description:"A website built with stx templating engine"}},animation:{enabled:!0,defaultDuration:300,defaultEase:"ease",respectMotionPreferences:!0,staggerDelay:50},markdown:{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0,additionalThemes:["light-plus","one-dark-pro","dracula","monokai","solarized-light","nord","github-dark"]}},loops:{maxWhileIterations:1000,useAltLoopVariable:!1},story:{enabled:!0,outDir:".stx/dist/story",storyMatch:["**/*.story.stx"],storyIgnored:["**/node_modules/**","**/dist/**","**/.stx/**"],port:6006},pwa:{enabled:!1,manifest:{name:"stx App",shortName:"stx",description:"A Progressive Web App built with stx",startUrl:"/",display:"standalone",orientation:"any",themeColor:"#000000",backgroundColor:"#ffffff",scope:"/"},icons:{src:"public/icon.png",sizes:[72,96,128,144,152,192,384,512],generateWebP:!0,generateAppleIcons:!0,outputDir:"pwa-icons",purpose:["any","maskable"]},routes:[{pattern:"/",strategy:"network-first"},{pattern:"/static/*",strategy:"cache-first",maxAgeSeconds:2592000},{pattern:"/api/*",strategy:"network-only"},{pattern:"*.js",strategy:"stale-while-revalidate"},{pattern:"*.css",strategy:"stale-while-revalidate"},{pattern:"*.png",strategy:"cache-first"},{pattern:"*.jpg",strategy:"cache-first"},{pattern:"*.webp",strategy:"cache-first"},{pattern:"*.svg",strategy:"cache-first"}],offline:{enabled:!0,fallbackTitle:"You are offline",fallbackMessage:"Please check your internet connection and try again.",precacheAssets:[]},serviceWorker:{fileName:"sw.js",cacheVersion:"1.0.0",skipWaiting:!0,clientsClaim:!0,navigationPreload:!1,excludeRoutes:["/api/auth/*"],cacheFileTypes:["html","css","js","png","jpg","jpeg","webp","svg","woff","woff2"],useWorkbox:!1},autoInject:!0,push:{enabled:!1,defaultOptions:{vibrate:[100,50,100],requireInteraction:!1}},backgroundSync:{enabled:!1,queueName:"stx-sync-queue",maxRetentionMinutes:1440,maxRetries:3,minInterval:1000,forms:[],endpoints:[]},shareTarget:{enabled:!1,action:"/share-target",method:"POST",enctype:"multipart/form-data",params:{title:"title",text:"text",url:"url"}},fileHandlers:{enabled:!1},protocolHandlers:[],cacheStorage:{maxSize:100,maxEntries:500,maxAge:30,purgeStrategy:"lru"},updates:{enabled:!0,promptUser:!0,autoReload:!1,message:"A new version is available. Reload to update?"},precache:{enabled:!0,includeHtml:!0,includeJs:!0,includeCss:!0,includeImages:!0,includeFonts:!0,include:[],exclude:["*.map","*.LICENSE.txt"],maxFileSizeKB:500}},media:{enabled:!0,image:{enabled:!0,defaultWidths:[320,480,640,768,1024,1280,1536,1920],defaultFormats:["avif","webp","jpeg"],defaultQuality:80,placeholderStrategy:"thumbhash",lazyByDefault:!0,enableDpr:!0,defaultDpr:[1,2,3],tsImages:{enabled:!0,outputDir:"dist/images",baseUrl:"/images",formatQuality:{jpeg:{quality:85,mozjpeg:!0,progressive:!0},png:{compressionLevel:9,palette:!1},webp:{quality:82,effort:5,smartSubsample:!0},avif:{quality:75,effort:4,lossless:!1}},breakpoints:[320,480,640,768,1024,1280,1536,1920],batchOptions:{concurrency:4,optimizationPreset:"web"}}},video:{enabled:!0,lazyByDefault:!0,defaultControls:!0,tsVideos:{enabled:!0,outputDir:"dist/videos",baseUrl:"/videos",defaultQuality:"high",streaming:{enabled:!0,format:"hls",segmentDuration:6,defaultQualities:[{label:"1080p",width:1920,height:1080,bitrate:5000000,audioBitrate:192000},{label:"720p",width:1280,height:720,bitrate:2500000,audioBitrate:128000},{label:"480p",width:854,height:480,bitrate:1e6,audioBitrate:96000}]},thumbnails:{enabled:!0,count:10,format:"webp",width:320},transcoding:{defaultCodec:"h264",defaultAudioCodec:"aac",speedPreset:"medium"}}},upload:{enabled:!0,maxSize:10485760,allowedTypes:["image/*","video/*","audio/*","application/pdf"],maxConcurrent:3},protected:{enabled:!0,expirationSeconds:3600,batchSize:10},cache:{enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500}},broadcasting:{enabled:!1,driver:"bun",host:"0.0.0.0",port:6001,scheme:"ws",verbose:!1}};function d0(v,_,k){let E=_||"pages";if(v)return{root:v,pagesDir:E};let T=k||process.cwd(),j=qt.join(T,"resources","views"),B=qt.join(T,"resources","layouts");if(Js.existsSync(j)&&Js.existsSync(B))return{root:"resources",pagesDir:"views"};let z=qt.join(T,"resources","views","pages");if(Js.existsSync(z))return{root:"resources/views",pagesDir:E};return{root:".",pagesDir:E}}var fh=new Set,_a=["partialsDir","componentsDir","layoutsDir"],pu=new WeakMap;function f0(v,_){let k=_.replace(/[\\/]+$/,"");if(!k||k===".")return!0;let E=v.replace(/\\/g,"/"),T=k.replace(/\\/g,"/");return E===T||E.startsWith(`${T}/`)}function Nc(v,_){let k=!v.root,E=d0(v.root,v.pagesDir,_);if(v.root=E.root,v.pagesDir=E.pagesDir,k&&E.root!=="."){let T=`${_}::${E.root}`;if(!fh.has(T))fh.add(T),console.warn(`[stx] No "root" in config \u2014 inferred "${E.root}" from the project layout. Template directories are resolved under it; set root explicitly to pin this.`)}if(!pu.has(v)){let T={};for(let j of _a){let B=v[j];if(typeof B==="string"&&B)T[j]=B}pu.set(v,T)}if(v.root&&v.root!=="."){let T=v.root;for(let j of _a){let B=v[j];if(typeof B!=="string"||!B)continue;if(qt.isAbsolute(B)||f0(B,T))continue;v[j]=qt.join(T,B)}}for(let T of _a){let j=v[T];if(typeof j!=="string"||!j||qt.isAbsolute(j))continue;v[T]=qt.resolve(_,j)}return v}function p0(v,_){let k=pu.get(v);for(let E of _a){let T=v[E];if(typeof T!=="string"||!T)continue;let j=qt.isAbsolute(T)?T:qt.join(_,T);if(Js.existsSync(j))continue;let B=k?.[E]??T,z=v.root,F=!!z&&z!==".";console.warn(`[stx] ${String(E)} resolves to "${j}", which does not exist. Configured as "${B}"`+(F?`, resolved under root "${z}".`:"."))}}function g0(v){if(v.customDirectives)v.customDirectives=[...v.customDirectives];if(v.middleware)v.middleware=[...v.middleware];if(v.apiRoutes)v.apiRoutes={...v.apiRoutes}}function m0(v){if(Ci(v.stateDir),v.stateDir=cn(),v.cachePath=ln(v.cachePath),v.build)v.build.cacheDir=ln(v.build.cacheDir);if(v.media?.cache)v.media.cache.directory=ln(v.media.cache.directory);if(v.story)v.story.outDir=ln(v.story.outDir)}var _r=null,Br=new Map,$a=new Map,ro=null;async function o(v){let _=v?qt.resolve(v):process.cwd(),k=$a.get(_);if(k&&k.signature!==Yn(k.graph)){let j=Br.get(_);if(Br.delete(_),$a.delete(_),!v)_r=null,ro=null;let{clearComponentCache:B}=await import("./chunk-x1v0qyf9.js"),{partialsCache:z}=await import("./chunk-bvq2hx8a.js");if(B(),z.clear(),j&&k.configSignature===Zn(k.graph)){let F=j.then(async(V)=>{let H={...k.graph};await ks(H,_),$a.set(_,{graph:H,signature:Yn(H),configSignature:Zn(H)});let G={...V,_layerGraph:H};if(!v)_r=G;return G});return Br.set(_,F),F}}if(!v){if(_r)return _r;if(ro)return ro}let E=Br.get(_);if(E)return E;let T=(async()=>{let j=[".ts",".js",".mjs",".cjs",".json"],B=j.some((J)=>Js.existsSync(qt.join(_,`stx.config${J}`))),z=j.some((J)=>Js.existsSync(qt.join(_,"config",`ui${J}`))),F;if(B&&z){let J=await fu({name:"ui",cwd:qt.join(_,"config"),defaultConfig:R,verbose:!1});F=(await fu({name:"stx",alias:"ui",cwd:_,defaultConfig:J.config,verbose:!1})).config}else F=(await fu({name:"stx",alias:"ui",cwd:_,defaultConfig:R,verbose:!1})).config;if(F.extends!==void 0||k){let J=await Si(_,R);F=J.config,$a.set(_,{graph:J.graph,signature:Yn(J.graph),configSignature:Zn(J.graph)})}if(F.runtimeConfig){let{resolveRuntimeConfig:J}=await import("./chunk-rnnead1w.js");J(F.runtimeConfig,{});let{generateRuntimeConfigTypes:ne}=await import("./chunk-4a9tt7cd.js");await ne(_,F.runtimeConfig)}g0(F),m0(F),Nc(F,_),p0(F,_);let V=[],H=new Set((F.plugins??[]).map((J)=>typeof J==="string"?J:J[0]));for(let J of F.componentPackages??["@stacksjs/components"]){let ne=`${J}/stx-plugin`;if(H.has(ne)||H.has(J))continue;try{d.resolve(ne,{paths:[_]}),V.push(ne)}catch{}}let G=[...F.plugins??[],...V];if(G.length>0){let{pluginManager:J}=await import("./chunk-b0bgprzs.js"),ne=[],re=[];for(let se of G){let ie=typeof se==="string"?se:se[0],ae=typeof se==="string"?{}:se[1]||{};try{let ue,oe;try{let ve=d.resolve(ie,{paths:[_]});ue=await import(ve),oe=qt.dirname(ve)}catch{let ve=qt.resolve(_,ie);ue=await import(ve),oe=qt.dirname(ve)}let me=ue.default||ue;if(!J.has(me.name))await J.register(me,F);if(me.components){let ve=Array.isArray(me.components)?me.components:[me.components];for(let $e of ve)ne.push(qt.resolve(oe,$e))}if(me.pages){let ve=qt.resolve(oe,me.pages),$e=ae.path||"/";re.push({dir:ve,prefix:$e})}if(me.setup){let ve={addDirective:($e)=>{F.customDirectives=F.customDirectives||[],F.customDirectives.push($e)},addRoute:($e,_e)=>{F.apiRoutes=F.apiRoutes||{},F.apiRoutes[$e]=_e},addMiddleware:($e)=>{F.middleware=F.middleware||[],F.middleware.push($e)},pluginDir:oe,config:F};await me.setup(ae,ve)}process.stderr.write(`[stx] Plugin loaded: ${me.name||ie}
2827
+ `)}catch(ue){console.warn(`[stx] Failed to load plugin ${ie}:`,ue.message)}}F._pluginComponentDirs=ne,F._pluginPageDirs=re}return F})();if(Br.set(_,T),T.catch(()=>{if(Br.get(_)===T)Br.delete(_)}),!v)ro=T,T.then((j)=>{_r=j}).catch(()=>{});return T}var A=new Proxy(R,{get(v,_){if(_r&&_ in _r)return _r[_];if(!ro)o().catch((k)=>{console.warn("[stx] Failed to load config file:",k?.message||k)});return v[_]}});function Yd(v){return v}function Zd(v){let _=[],k=[];if(v.partialsDir!==void 0&&typeof v.partialsDir!=="string")_.push({path:"partialsDir",message:"partialsDir must be a string",severity:"error"});if(v.componentsDir!==void 0&&typeof v.componentsDir!=="string")_.push({path:"componentsDir",message:"componentsDir must be a string",severity:"error"});if(v.cache!==void 0&&typeof v.cache!=="boolean")_.push({path:"cache",message:"cache must be a boolean",severity:"error"});if(v.debug!==void 0&&typeof v.debug!=="boolean")_.push({path:"debug",message:"debug must be a boolean",severity:"error"});if(v.streaming){if(v.streaming.bufferSize!==void 0){if(typeof v.streaming.bufferSize!=="number"||v.streaming.bufferSize<=0)_.push({path:"streaming.bufferSize",message:"streaming.bufferSize must be a positive number",severity:"error"})}if(v.streaming.timeout!==void 0){if(typeof v.streaming.timeout!=="number"||v.streaming.timeout<=0)_.push({path:"streaming.timeout",message:"streaming.timeout must be a positive number",severity:"error"})}if(v.streaming.strategy!==void 0){let E=["auto","manual","sections"];if(!E.includes(v.streaming.strategy))_.push({path:"streaming.strategy",message:`streaming.strategy must be one of: ${E.join(", ")}`,severity:"error"})}}if(v.i18n){if(v.i18n.format!==void 0){let E=["json","yaml","yml","js"];if(!E.includes(v.i18n.format))_.push({path:"i18n.format",message:`i18n.format must be one of: ${E.join(", ")}`,severity:"error"})}}if(v.animation){if(v.animation.defaultDuration!==void 0){if(typeof v.animation.defaultDuration!=="number"||v.animation.defaultDuration<0)_.push({path:"animation.defaultDuration",message:"animation.defaultDuration must be a non-negative number",severity:"error"})}if(v.animation.staggerDelay!==void 0){if(typeof v.animation.staggerDelay!=="number"||v.animation.staggerDelay<0)_.push({path:"animation.staggerDelay",message:"animation.staggerDelay must be a non-negative number",severity:"error"})}}if(v.a11y){if(v.a11y.level!==void 0){let E=["AA","AAA"];if(!E.includes(v.a11y.level))_.push({path:"a11y.level",message:`a11y.level must be one of: ${E.join(", ")}`,severity:"error"})}}if(v.hydration){if(v.hydration.mode!==void 0){let E=["progressive","islands"];if(!E.includes(v.hydration.mode))_.push({path:"hydration.mode",message:`hydration.mode must be one of: ${E.join(", ")}`,severity:"error"})}if(v.hydration.preload!==void 0){let E=["none","eager","lazy"];if(!E.includes(v.hydration.preload))_.push({path:"hydration.preload",message:`hydration.preload must be one of: ${E.join(", ")}`,severity:"error"})}}if(v.customDirectives)if(!Array.isArray(v.customDirectives))_.push({path:"customDirectives",message:"customDirectives must be an array",severity:"error"});else v.customDirectives.forEach((E,T)=>{if(!E.name||typeof E.name!=="string")_.push({path:`customDirectives[${T}].name`,message:"Custom directive must have a name string",severity:"error"});if(!E.handler||typeof E.handler!=="function")_.push({path:`customDirectives[${T}].handler`,message:"Custom directive must have a handler function",severity:"error"})});if(v.middleware)if(!Array.isArray(v.middleware))_.push({path:"middleware",message:"middleware must be an array",severity:"error"});else v.middleware.forEach((E,T)=>{if(!E.name||typeof E.name!=="string")_.push({path:`middleware[${T}].name`,message:"Middleware must have a name string",severity:"error"});if(!E.handler||typeof E.handler!=="function")_.push({path:`middleware[${T}].handler`,message:"Middleware must have a handler function",severity:"error"});if(!E.timing||!["before","after"].includes(E.timing))_.push({path:`middleware[${T}].timing`,message:'Middleware timing must be "before" or "after"',severity:"error"})});if(v.debug===!0&&v.cache===!0)k.push({path:"debug+cache",message:"Debug mode with caching enabled may show stale content during development",severity:"warning"});if(v.seo?.enabled===!0&&!v.seo?.defaultConfig?.title)k.push({path:"seo.defaultConfig.title",message:"SEO is enabled but no default title is set",severity:"warning"});if(v.pwa){if(v.pwa.enabled===!0&&!v.pwa.manifest?.name)_.push({path:"pwa.manifest.name",message:"PWA manifest name is required when PWA is enabled",severity:"error"});if(v.pwa.manifest?.display!==void 0){let E=["fullscreen","standalone","minimal-ui","browser"];if(!E.includes(v.pwa.manifest.display))_.push({path:"pwa.manifest.display",message:`PWA display must be one of: ${E.join(", ")}`,severity:"error"})}if(v.pwa.manifest?.orientation!==void 0){let E=["portrait","landscape","any","portrait-primary","portrait-secondary","landscape-primary","landscape-secondary"];if(!E.includes(v.pwa.manifest.orientation))_.push({path:"pwa.manifest.orientation",message:`PWA orientation must be one of: ${E.join(", ")}`,severity:"error"})}if(v.pwa.routes){let E=["cache-first","network-first","stale-while-revalidate","network-only","cache-only"];v.pwa.routes.forEach((T,j)=>{if(!T.pattern||typeof T.pattern!=="string")_.push({path:`pwa.routes[${j}].pattern`,message:"PWA route must have a pattern string",severity:"error"});if(!E.includes(T.strategy))_.push({path:`pwa.routes[${j}].strategy`,message:`PWA route strategy must be one of: ${E.join(", ")}`,severity:"error"});if(T.maxAgeSeconds!==void 0&&(typeof T.maxAgeSeconds!=="number"||T.maxAgeSeconds<0))_.push({path:`pwa.routes[${j}].maxAgeSeconds`,message:"PWA route maxAgeSeconds must be a non-negative number",severity:"error"});if(T.maxEntries!==void 0&&(typeof T.maxEntries!=="number"||T.maxEntries<1))_.push({path:`pwa.routes[${j}].maxEntries`,message:"PWA route maxEntries must be a positive number",severity:"error"})})}if(v.pwa.icons?.sizes){if(!Array.isArray(v.pwa.icons.sizes))_.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be an array of numbers",severity:"error"});else if(v.pwa.icons.sizes.filter((T)=>typeof T!=="number"||T<16||T>1024).length>0)_.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be numbers between 16 and 1024",severity:"error"})}if(v.pwa.icons?.purpose){let E=["any","maskable","monochrome"];if(v.pwa.icons.purpose.filter((j)=>!E.includes(j)).length>0)_.push({path:"pwa.icons.purpose",message:`PWA icon purpose must be one of: ${E.join(", ")}`,severity:"error"})}if(v.pwa.enabled===!0&&!v.pwa.icons?.src)k.push({path:"pwa.icons.src",message:"PWA is enabled but no icon source specified. Provide a 512x512 PNG for best results.",severity:"warning"});if(v.pwa.enabled===!0&&!v.pwa.manifest?.themeColor)k.push({path:"pwa.manifest.themeColor",message:"PWA theme color not set, defaulting to black",severity:"warning"})}return{valid:_.length===0,errors:_,warnings:k}}var mu=new Map;async function le(v,_={}){try{if(!await r(v))throw Error(`Markdown file not found: ${v}`);let E=(await h0.promises.stat(v)).mtime.getTime();if(_.cache&&mu.has(v)){let G=mu.get(v);if(G.updatedAt>=E)return{content:G.content,data:G.data}}let T=await Bun.file(v).text(),{data:j,content:B}=jn(T),z=_.markdown||A.markdown||{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0}},V=Me(B,{gfm:!0});if(z.syntaxHighlighting?.enabled&&z.syntaxHighlighting?.serverSide)V=await x0(V,z.syntaxHighlighting?.defaultTheme||"github-dark",z.syntaxHighlighting?.highlightUnknownLanguages||!1);let H={content:V,data:j||{}};if(_.cache)mu.set(v,{...H,updatedAt:E});return H}catch(k){if(_.debug)console.error(`Error reading/parsing markdown file ${v}:`,k);let E=k instanceof Error?k.message:String(k);return{content:g("Markdown File",`Error reading/parsing markdown file: ${E}`,v,"",0,""),data:{}}}}var ka=null;async function x0(v,_,k){let E=/<pre><code( class="language-([^"]+)")?>([^<]+)<\/code><\/pre>/g;if(!ka)try{ka=await y0({theme:_||"github-dark",cache:!0})}catch(z){return console.error("Failed to initialize ts-syntax-highlighter:",z),v}let T=async(z,F,V,H)=>{let G=H.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&").replace(/&quot;/g,'"').replace(/&#39;/g,"'"),J=V||(k?"text":"");if(!J)return z;try{if(!ka.getSupportedLanguages().includes(J))return z;return(await ka.highlight(G,J,{theme:_})).html}catch(ne){console.error(`Error highlighting code block with language ${V}:`,ne)}return z},j=v,B=v.matchAll(E);for(let z of B){let[F,V,H,G]=z,J=await T(F,V,H,G);j=j.replace(F,J)}return j}async function km(v,_,k="",E={}){return await b0(v,/@markdown-file\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\}))?\)/g,async(B,z,F,V)=>{try{let H=z;if(!gu.isAbsolute(z))H=gu.resolve(gu.dirname(k),z);let G={};if(F)try{try{G=JSON.parse(F)}catch{if(E.debug)console.warn("Using safer alternative for parsing JS object literal");let ue=F.replace(/^\s*\{|\}\s*$/g,"").trim().split(/,(?=\s*\w+\s*:)/);for(let oe of ue){let me=oe.indexOf(":");if(me>0){let ve=oe.substring(0,me).trim(),$e=oe.substring(me+1).trim(),_e=$e.startsWith('"')&&$e.endsWith('"'),Re=$e.startsWith("'")&&$e.endsWith("'");if(_e||Re)$e=$e.substring(1,$e.length-1);G[ve]=$e}}}}catch(ae){if(E.debug)console.error("Error parsing context in @markdown-file directive:",ae)}let{content:J,data:ne}=await le(H,E),re={..._,...ne,...G},se=J,ie=/\{\{([^}]+)\}\}/g;return se=se.replace(ie,(ae,ue)=>{let oe=ue.trim();return re[oe]!==void 0?String(re[oe]):ae}),se}catch(H){let G=H instanceof Error?H.message:String(H);return g("Markdown File",`Error including markdown file: ${G}`,k,v,V,B)}})}async function b0(v,_,k){let E=[],T;while((T=_.exec(v))!==null){let z=T[0],F=T.index,V=T;E.push(k(...V).then((H)=>({match:z,replacement:H,index:F})))}let j=await Promise.all(E);j.sort((z,F)=>F.index-z.index);let B=v;for(let{match:z,replacement:F}of j)B=B.replace(z,()=>F);return B}
2828
+ export{jn,Me,M,U,m,h,tn,W,w,Ne,Gr,Jr,Za,vt,Ho,Yr,Vo,Rd,Le,Zr,he,Uo,Wo,qo,Qr,Y,je,xt,Bn,Qa,Ad,ec,Pd,tc,Fn,b,St,ye,nc,es,rc,Id,q,sc,Dd,x,Od,oc,Md,Nd,Ld,jd,ic,ac,Bd,Fd,Ko,zd,nn,rn,zn,Hn,e,Hd,Xo,Vd,Go,cc,lc,kt,sn,Ud,dc,uc,pc,f,Be,Ct,Fe,ze,Jo,Vn,Z,ts,ns,rs,Wd,Un,qd,on,He,ss,os,fc,Q,Yo,Zo,Qo,ei,Wn,is,ti,ni,ri,gc,as,N,ce,K,Kd,mc,cs,ls,si,oi,ds,us,qn,hc,ii,ai,yc,Ve,an,Kn,Et,bc,wc,vc,xc,Sc,u,kc,ps,Cc,ci,li,gs,di,Ec,Xd,$c,be,ui,Gd,ms,hs,ys,pi,bs,ws,vs,xs,n,_c,Tc,Rc,Ac,Pc,Ic,Ue,L,We,Dc,Xn,Oc,fi,Mc,qe,r,Gn,gi,g,ee,Jd,Jn,R,Nc,o,A,Yd,Zd,le};