@stacksjs/stx 0.2.553 → 0.2.555

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 (61) hide show
  1. package/dist/app-service-worker.d.ts +2 -0
  2. package/dist/builtins/image-delivery.js +2 -2
  3. package/dist/{chunk-tkwz3ka4.js → chunk-1zyht1bb.js} +1 -1
  4. package/dist/{chunk-g1c3davk.js → chunk-384xy328.js} +1 -1
  5. package/dist/{chunk-mpga9770.js → chunk-3bb0tjs3.js} +1 -1
  6. package/dist/{chunk-tq3bya3n.js → chunk-3enbxxcs.js} +1 -1
  7. package/dist/{chunk-81qx2ze8.js → chunk-4c5sxq9p.js} +1 -1
  8. package/dist/{chunk-sgrwxhgg.js → chunk-4sbz2y0g.js} +1 -1
  9. package/dist/{chunk-ynpz7f7p.js → chunk-5pdckdhm.js} +1 -1
  10. package/dist/{chunk-jb04k0sv.js → chunk-66yp3ryj.js} +1 -1
  11. package/dist/{chunk-xvg4nzz6.js → chunk-6qfrs1pj.js} +1 -1
  12. package/dist/{chunk-tfp3exh3.js → chunk-7pk5sqkw.js} +2 -2
  13. package/dist/{chunk-q3sn0xc1.js → chunk-7x3az8j6.js} +1 -1
  14. package/dist/chunk-8bqph6jy.js +2 -0
  15. package/dist/{chunk-31gk5b7d.js → chunk-8k5sp2t6.js} +1 -1
  16. package/dist/{chunk-jj9356vp.js → chunk-96fpvzm2.js} +1 -1
  17. package/dist/{chunk-2q624ng4.js → chunk-9wygdzqe.js} +1 -1
  18. package/dist/{chunk-8tsc5hmk.js → chunk-a1srrv4w.js} +1 -1
  19. package/dist/{chunk-45n128za.js → chunk-afrfcgn4.js} +1 -1
  20. package/dist/{chunk-8wanndhv.js → chunk-b46ejka8.js} +1 -1
  21. package/dist/{chunk-ezrxgtkz.js → chunk-cev76nd8.js} +1 -1
  22. package/dist/{chunk-ez5w6a60.js → chunk-cvxc2h58.js} +1 -1
  23. package/dist/{chunk-16g71mm9.js → chunk-d7ec8hgm.js} +1 -1
  24. package/dist/chunk-en30fzej.js +2 -0
  25. package/dist/{chunk-sjqbd8ga.js → chunk-g3gtxcc3.js} +166 -166
  26. package/dist/{chunk-kmvyfwr3.js → chunk-gmp7apxp.js} +1 -1
  27. package/dist/{chunk-21v5eee6.js → chunk-knkeqpnk.js} +5 -5
  28. package/dist/{chunk-1hxh2wbw.js → chunk-kvr304zk.js} +1 -1
  29. package/dist/{chunk-4b7y1p7f.js → chunk-m2vk8vja.js} +1 -1
  30. package/dist/chunk-n7f2c5vf.js +2 -0
  31. package/dist/{chunk-m24hxk60.js → chunk-nd7p8f5p.js} +1 -1
  32. package/dist/{chunk-q48nk2gt.js → chunk-nv62tcmb.js} +1 -1
  33. package/dist/{chunk-kbc2bwd5.js → chunk-pjbp7axq.js} +1 -1
  34. package/dist/{chunk-ecevpzy6.js → chunk-pmwzvb3m.js} +1 -1
  35. package/dist/{chunk-avgwezvb.js → chunk-qdh45a4k.js} +1 -1
  36. package/dist/{chunk-hh88tvs5.js → chunk-qx9s066f.js} +1 -1
  37. package/dist/{chunk-bh5qgbmv.js → chunk-rs9c1meq.js} +1 -1
  38. package/dist/{chunk-d80mbwyp.js → chunk-rv55w3rm.js} +1 -1
  39. package/dist/{chunk-ptj7fwre.js → chunk-se734zc5.js} +1 -1
  40. package/dist/{chunk-tje2mg86.js → chunk-tbtg8z35.js} +1 -1
  41. package/dist/{chunk-nvsea9fk.js → chunk-tyrdwvse.js} +2 -2
  42. package/dist/{chunk-qmt7t9nt.js → chunk-vtkfkkzw.js} +1 -1
  43. package/dist/{chunk-7qf883pk.js → chunk-wc9344hm.js} +1 -1
  44. package/dist/{chunk-a7tmbbzz.js → chunk-wcbxh9h9.js} +1 -1
  45. package/dist/{chunk-a2c6t7w2.js → chunk-x0fhwxhv.js} +1 -1
  46. package/dist/{chunk-zvptrjt8.js → chunk-x4d6ndn1.js} +1 -1
  47. package/dist/{chunk-93jjxrx9.js → chunk-x8kf5xjf.js} +2 -2
  48. package/dist/{chunk-q28hdn0s.js → chunk-xp879a67.js} +1 -1
  49. package/dist/{chunk-5y2tgmb6.js → chunk-yty18jzq.js} +1 -1
  50. package/dist/{chunk-da4cj4zb.js → chunk-zpy0gxqa.js} +1 -1
  51. package/dist/cli.js +7 -7
  52. package/dist/craft-entry.js +1 -1
  53. package/dist/craft.js +1 -1
  54. package/dist/offline/app-service-worker.d.ts +2 -0
  55. package/dist/offline/app-service-worker.js +56 -15
  56. package/dist/pwa.js +1 -1
  57. package/dist/ssg.js +2 -2
  58. package/package.json +5 -5
  59. package/dist/chunk-59wnn6gp.js +0 -2
  60. package/dist/chunk-mhwf2xrt.js +0 -2
  61. package/dist/chunk-td7byqwx.js +0 -2
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{t,X,cr,i,ne,Ls,P,Pt,vn,js,l,p,Mi,O,ke,et,c,dr}from"./chunk-a5kaw8sc.js";import{Cn,En,mr,Ee}from"./chunk-kvmg6r89.js";import{Sn,y,Ni,Ot,Bs,Li,ji,Bi,Fi}from"./chunk-r4199q6x.js";import{I}from"./chunk-6v1gwdbv.js";import{S,Os,Ze,Ds,Ri,fn,gn,Ai,Se,Pi,mn,Ii,At,Ms,Oi,hn,bn,ir,fe,Ns,ge,ar}from"./chunk-j2erwdgt.js";import{Rs,As,Ps,Is,nr,rr}from"./chunk-jmvp99ay.js";import{ue,Rt,tr,$s,C,Je}from"./chunk-e124cgb6.js";import{pn}from"./chunk-jb04k0sv.js";import{Vs}from"./chunk-1xgs9gd5.js";import{_i,_s,Qn,er}from"./chunk-dyreg5df.js";import{wi,vi,Si,ki}from"./chunk-1b50m7e7.js";import{Xe}from"./chunk-4r7s3862.js";import{s,ve}from"./chunk-7wfh2hqy.js";import{$t,$i,dn,a,un}from"./chunk-4cmqjmqr.js";import{u}from"./chunk-cg8hg6cs.js";import{me,D,xn}from"./chunk-3nk8cnrm.js";import{hr}from"./chunk-xya3vdqy.js";import C0 from"fs";import Su from"path";import{createHighlighter as R0}from"ts-syntax-highlighter";import Ys from"fs";import Zt from"path";import{loadConfigWithResult as vu}from"bunfig";var sr={duration:300,delay:0,ease:"ease",direction:"both"};function _h(v,_={}){let{duration:k,delay:E,ease:T,direction:j,custom:B}={...sr,..._};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,cr,i,ne,Ls,P,Pt,vn,js,l,p,Mi,O,ke,et,c,dr}from"./chunk-a5kaw8sc.js";import{Cn,En,mr,Ee}from"./chunk-kvmg6r89.js";import{Sn,y,Ni,Ot,Bs,Li,ji,Bi,Fi}from"./chunk-r4199q6x.js";import{I}from"./chunk-6v1gwdbv.js";import{S,Os,Ze,Ds,Ri,fn,gn,Ai,Se,Pi,mn,Ii,At,Ms,Oi,hn,bn,ir,fe,Ns,ge,ar}from"./chunk-j2erwdgt.js";import{Rs,As,Ps,Is,nr,rr}from"./chunk-jmvp99ay.js";import{ue,Rt,tr,$s,C,Je}from"./chunk-e124cgb6.js";import{pn}from"./chunk-66yp3ryj.js";import{Vs}from"./chunk-1xgs9gd5.js";import{_i,_s,Qn,er}from"./chunk-dyreg5df.js";import{wi,vi,Si,ki}from"./chunk-1b50m7e7.js";import{Xe}from"./chunk-4r7s3862.js";import{s,ve}from"./chunk-7wfh2hqy.js";import{$t,$i,dn,a,un}from"./chunk-4cmqjmqr.js";import{u}from"./chunk-cg8hg6cs.js";import{me,D,xn}from"./chunk-3nk8cnrm.js";import{hr}from"./chunk-xya3vdqy.js";import R0 from"fs";import Su from"path";import{createHighlighter as A0}from"ts-syntax-highlighter";import Ys from"fs";import Zt from"path";import{loadConfigWithResult as vu}from"bunfig";var sr={duration:300,delay:0,ease:"ease",direction:"both"};function kh(v,_={}){let{duration:k,delay:E,ease:T,direction:j,custom:B}={...sr,..._};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; } }
@@ -9,7 +9,7 @@ import{t,X,cr,i,ne,Ls,P,Pt,vn,js,l,p,Mi,O,ke,et,c,dr}from"./chunk-a5kaw8sc.js";i
9
9
  @keyframes flipIn { from { transform: perspective(400px) rotateX(-90deg); opacity: 0; } to { transform: perspective(400px) rotateX(0); opacity: 1; } }
10
10
  @keyframes flipOut { from { transform: perspective(400px) rotateX(0); opacity: 1; } to { transform: perspective(400px) rotateX(90deg); opacity: 0; } }`;case"rotate":return`${j==="in"?"transform: rotate(-90deg); opacity: 0; animation: rotateIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":j==="out"?"transform: rotate(0); opacity: 1; animation: rotateOut var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":"transform: rotate(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);"}
11
11
  @keyframes rotateIn { from { transform: rotate(-90deg); opacity: 0; } to { transform: rotate(0); opacity: 1; } }
12
- @keyframes rotateOut { from { transform: rotate(0); opacity: 1; } to { transform: rotate(90deg); opacity: 0; } }`;default:return""}}function kh(){return`
12
+ @keyframes rotateOut { from { transform: rotate(0); opacity: 1; } to { transform: rotate(90deg); opacity: 0; } }`;default:return""}}function Eh(){return`
13
13
  <script data-stx-scoped data-stx-run="once">
14
14
  // Motion preferences handling
15
15
  (function() {
@@ -37,7 +37,7 @@ else {
37
37
  });
38
38
  })();
39
39
  </script>
40
- `}function Eh(v){return[/@animate\b/,/@transition\b/,/@scroll(?:Animate)?\b/,/@staggered\b/,/@sequence\b/,/@motion\b/,/@animationGroup\b/,/\bstx-transition\b/,/\bstx-(?:fade|scale|flip|rotate|slide|from-|observe)\b/,/data-animate=['"](?:auto|true|false)['"]/].some((k)=>k.test(v))}function Ch(v=0.1,_="0px"){return`
40
+ `}function Ch(v){return[/@animate\b/,/@transition\b/,/@scroll(?:Animate)?\b/,/@staggered\b/,/@sequence\b/,/@motion\b/,/@animationGroup\b/,/\bstx-transition\b/,/\bstx-(?:fade|scale|flip|rotate|slide|from-|observe)\b/,/data-animate=['"](?:auto|true|false)['"]/].some((k)=>k.test(v))}function Rh(v=0.1,_="0px"){return`
41
41
  <script data-stx-scoped data-stx-run="always">
42
42
  // Intersection Observer for scroll animations
43
43
  (function() {
@@ -80,7 +80,7 @@ else {
80
80
  }
81
81
  })();
82
82
  </script>
83
- `}function Rh(){return`
83
+ `}function Ah(){return`
84
84
  <style id="stx-animation-base">
85
85
  :root {
86
86
  --stx-transition-duration: 300ms;
@@ -195,7 +195,7 @@ else {
195
195
  transform var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);
196
196
  }
197
197
  </style>
198
- `}function Ah(v,_,k={}){let{staggerDelay:E=50,sequence:T=!1}=k;return`
198
+ `}function Th(v,_,k={}){let{staggerDelay:E=50,sequence:T=!1}=k;return`
199
199
  <script data-stx-scoped data-stx-run="always">
200
200
  // Animation Group: ${v}
201
201
  (function() {
@@ -232,11 +232,11 @@ else {
232
232
  }
233
233
  })();
234
234
  </script>
235
- `}var Eu={name:"transition",handler:(v,_,k,E)=>{if(_.length<1)return`<div class="stx-error">@transition directive requires at least a transition type</div>${v}`;let T=_[0],j=_.length>1?Number.parseInt(_[1],10)||sr.duration:sr.duration,B=_.length>2?_[2]||sr.ease:sr.ease,z=_.length>3?Number.parseInt(_[3],10)||sr.delay:sr.delay,F=_.length>4?_[4]||sr.direction:sr.direction,V=`stx-transition-${Math.random().toString(36).substr(2,9)}`,U=_h(T,{duration:j,delay:z,ease:B,direction:F}),H="stx-transition",Y="";if(T==="fade")Y="stx-fade";else if(T==="slide")Y="stx-slide";else if(T==="scale")Y="stx-scale";else if(T==="flip")Y="stx-flip";else if(T==="rotate")Y="stx-rotate";return`<div id="${V}" class="${H} ${Y} ${F==="out"?"stx-out":""}"
236
- style="--stx-transition-duration: ${j}ms; --stx-transition-ease: ${B}; --stx-transition-delay: ${z}ms;">${v}</div>`},hasEndTag:!0,description:"Applies transition effects to an element"},Cu={name:"scrollAnimate",handler:(v,_,k,E)=>{if(_.length<1)return`<div class="stx-error">@scrollAnimate directive requires at least an animation type</div>${v}`;let T=_[0],j=_.length>1?Number.parseInt(_[1],10)||300:300,B=_.length>2?_[2]||"ease":"ease",z=_.length>3?Number.parseFloat(_[3])||0.2:0.2,F=_.length>4?Number.parseInt(_[4],10)||0:0,V=`stx-scroll-${Math.random().toString(36).substr(2,9)}`,U=`--stx-transition-duration: ${j}ms; --stx-transition-ease: ${B}; --stx-transition-delay: ${F}ms; will-change: opacity, transform;`,H="stx-transition stx-observe stx-out";if(T==="fade")H+=" stx-fade";else if(T==="slide-up"||T==="slide")H+=" stx-from-bottom";else if(T==="slide-down")H+=" stx-from-top";else if(T==="slide-left")H+=" stx-from-right";else if(T==="slide-right")H+=" stx-from-left";else if(T==="scale")H+=" stx-scale";else if(T.includes("-"))H+=` stx-${T}`;else H+=` stx-${T}`;return`<div id="${V}" class="${H}" style="${U}" data-threshold="${z}">${v}</div>`},hasEndTag:!0,description:"Applies animations that trigger when scrolled into view"},Ru={name:"animationGroup",handler:(v,_,k,E)=>{if(_.length<2)return`<div class="stx-error">@animationGroup directive requires a group name and at least one element selector</div>${v}`;let T=_[0],j=_.slice(1).map((V)=>V.startsWith("#")||V.startsWith(".")?V:`#${V}`),B=k.staggerDelay||50,z=k.sequence||!0,F=Ah(T,j,{staggerDelay:B,sequence:z});return`${v}
237
- ${F}`},hasEndTag:!1,description:"Coordinates multiple animations together as a group"},Au={name:"motion",handler:(v,_,k,E)=>{let T=_.length>0?_[0].toLowerCase()==="true":!0,j=kh();return`<div data-animate="${T?"auto":"true"}">${v}</div>${j}`},hasEndTag:!0,description:"Controls motion and animation preferences"};function Tu(v,_,k,E){let T=v;if(E.animation?.enabled===!1)return T;let j=k.includes("test")&&k.includes("animation");if(!Eh(T)&&!j)return T;if(!T.includes('<style id="stx-animation-base">')){let z=Rh();T=T.replace("</head>",`${z}
238
- </head>`)}if(T.includes("stx-observe")){if(!T.includes("Intersection Observer for scroll animations")){let F=Ch(),V=T.lastIndexOf("</body>");if(V!==-1)T=T.slice(0,V)+F+`
239
- `+T.slice(V)}}return T}async function Th(v,_,k,E){let T=_[0]?.replace(/['"]/g,"")||"main",j=Ee();if(T!=="main")j=j.replace("container:'main'",`container:'${T}'`);return`<script data-stx-router>${j}</script>`}var Iu={name:"stxRouter",handler:Th,hasEndTag:!1,description:"Inject the STX SPA router script for client-side navigation"};var Ih={enabled:!1,trackMouse:!0,trackClicks:!0,trackScroll:!0,samplingRate:100,honorDnt:!0,batchSize:50,maxDataPoints:1000,sessionTimeout:30,persistData:!1,storagePrefix:"stx_heatmap",captureAttributes:["data-heatmap-id","data-track"],ignoreSelectors:["[data-heatmap-ignore]",".heatmap-ignore"],debugOverlay:!1};function Pu(v){let _=v.heatmap;if(!_?.enabled)return"";let k={...Ih,..._};return`
235
+ `}var Eu={name:"transition",handler:(v,_,k,E)=>{if(_.length<1)return`<div class="stx-error">@transition directive requires at least a transition type</div>${v}`;let T=_[0],j=_.length>1?Number.parseInt(_[1],10)||sr.duration:sr.duration,B=_.length>2?_[2]||sr.ease:sr.ease,z=_.length>3?Number.parseInt(_[3],10)||sr.delay:sr.delay,F=_.length>4?_[4]||sr.direction:sr.direction,V=`stx-transition-${Math.random().toString(36).substr(2,9)}`,U=kh(T,{duration:j,delay:z,ease:B,direction:F}),H="stx-transition",Y="";if(T==="fade")Y="stx-fade";else if(T==="slide")Y="stx-slide";else if(T==="scale")Y="stx-scale";else if(T==="flip")Y="stx-flip";else if(T==="rotate")Y="stx-rotate";return`<div id="${V}" class="${H} ${Y} ${F==="out"?"stx-out":""}"
236
+ style="--stx-transition-duration: ${j}ms; --stx-transition-ease: ${B}; --stx-transition-delay: ${z}ms;">${v}</div>`},hasEndTag:!0,description:"Applies transition effects to an element"},Cu={name:"scrollAnimate",handler:(v,_,k,E)=>{if(_.length<1)return`<div class="stx-error">@scrollAnimate directive requires at least an animation type</div>${v}`;let T=_[0],j=_.length>1?Number.parseInt(_[1],10)||300:300,B=_.length>2?_[2]||"ease":"ease",z=_.length>3?Number.parseFloat(_[3])||0.2:0.2,F=_.length>4?Number.parseInt(_[4],10)||0:0,V=`stx-scroll-${Math.random().toString(36).substr(2,9)}`,U=`--stx-transition-duration: ${j}ms; --stx-transition-ease: ${B}; --stx-transition-delay: ${F}ms; will-change: opacity, transform;`,H="stx-transition stx-observe stx-out";if(T==="fade")H+=" stx-fade";else if(T==="slide-up"||T==="slide")H+=" stx-from-bottom";else if(T==="slide-down")H+=" stx-from-top";else if(T==="slide-left")H+=" stx-from-right";else if(T==="slide-right")H+=" stx-from-left";else if(T==="scale")H+=" stx-scale";else if(T.includes("-"))H+=` stx-${T}`;else H+=` stx-${T}`;return`<div id="${V}" class="${H}" style="${U}" data-threshold="${z}">${v}</div>`},hasEndTag:!0,description:"Applies animations that trigger when scrolled into view"},Ru={name:"animationGroup",handler:(v,_,k,E)=>{if(_.length<2)return`<div class="stx-error">@animationGroup directive requires a group name and at least one element selector</div>${v}`;let T=_[0],j=_.slice(1).map((V)=>V.startsWith("#")||V.startsWith(".")?V:`#${V}`),B=k.staggerDelay||50,z=k.sequence||!0,F=Th(T,j,{staggerDelay:B,sequence:z});return`${v}
237
+ ${F}`},hasEndTag:!1,description:"Coordinates multiple animations together as a group"},Au={name:"motion",handler:(v,_,k,E)=>{let T=_.length>0?_[0].toLowerCase()==="true":!0,j=Eh();return`<div data-animate="${T?"auto":"true"}">${v}</div>${j}`},hasEndTag:!0,description:"Controls motion and animation preferences"};function Tu(v,_,k,E){let T=v;if(E.animation?.enabled===!1)return T;let j=k.includes("test")&&k.includes("animation");if(!Ch(T)&&!j)return T;if(!T.includes('<style id="stx-animation-base">')){let z=Ah();T=T.replace("</head>",`${z}
238
+ </head>`)}if(T.includes("stx-observe")){if(!T.includes("Intersection Observer for scroll animations")){let F=Rh(),V=T.lastIndexOf("</body>");if(V!==-1)T=T.slice(0,V)+F+`
239
+ `+T.slice(V)}}return T}async function Ih(v,_,k,E){let T=_[0]?.replace(/['"]/g,"")||"main",j=Ee();if(T!=="main")j=j.replace("container:'main'",`container:'${T}'`);return`<script data-stx-router>${j}</script>`}var Iu={name:"stxRouter",handler:Ih,hasEndTag:!1,description:"Inject the STX SPA router script for client-side navigation"};var Ph={enabled:!1,trackMouse:!0,trackClicks:!0,trackScroll:!0,samplingRate:100,honorDnt:!0,batchSize:50,maxDataPoints:1000,sessionTimeout:30,persistData:!1,storagePrefix:"stx_heatmap",captureAttributes:["data-heatmap-id","data-track"],ignoreSelectors:["[data-heatmap-ignore]",".heatmap-ignore"],debugOverlay:!1};function Pu(v){let _=v.heatmap;if(!_?.enabled)return"";let k={...Ph,..._};return`
240
240
  <!-- stx Heatmap - Privacy-Compliant Tracking -->
241
241
  <script>
242
242
  (function() {
@@ -619,8 +619,8 @@ else {
619
619
  };
620
620
  })();
621
621
  </script>
622
- `}function Du(v,_){let k=Pu(_);if(!k)return v;let E=v.lastIndexOf("</body>");if(E!==-1)return v.slice(0,E)+k+v.slice(E);return v+k}var Ou={name:"heatmap",hasEndTag:!1,description:"Inject privacy-compliant heatmap tracking script",handler:async(v,_,k,E)=>{let T=k.__stx_config||{};if(_.length>0){let j=Ph(_.join(" "));T.heatmap={...T.heatmap,...j,enabled:!0}}return Pu(T)}};function Ph(v){let _={},k=v.match(/(\w+)=["']?([^"'\s]+)["']?/g)||[];for(let E of k){let[T,j]=E.split("="),B=j?.replace(/["']/g,"");switch(T){case"endpoint":_.endpoint=B;break;case"samplingRate":_.samplingRate=Number.parseInt(B,10);break;case"batchSize":_.batchSize=Number.parseInt(B,10);break;case"trackMouse":_.trackMouse=B==="true";break;case"trackClicks":_.trackClicks=B==="true";break;case"trackScroll":_.trackScroll=B==="true";break;case"honorDnt":_.honorDnt=B==="true";break;case"debugOverlay":_.debugOverlay=B==="true";break}}return _}function fr(v){return v.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function Mu(v){let _=v.trim().toLowerCase();return!_.startsWith("javascript:")&&!_.startsWith("vbscript:")&&!_.startsWith("data:text/html")}function Fn(v){let _=/^---\r?\n([\s\S]*?)\r?\n---\r?\n/,k=v.match(_);if(!k)return{data:{},content:v.trim()};let E=k[1],T=v.slice(k[0].length),j={};for(let B of E.split(`
623
- `)){let z=B.trim();if(!z||z.startsWith("#"))continue;let F=z.indexOf(":");if(F===-1)continue;let V=z.slice(0,F).trim(),U=z.slice(F+1).trim();if(typeof U==="string"){if(U.startsWith('"')&&U.endsWith('"')||U.startsWith("'")&&U.endsWith("'"))U=U.slice(1,-1);else if(U.startsWith("[")&&U.endsWith("]"))try{U=JSON.parse(U)}catch{}else if(U==="true")U=!0;else if(U==="false")U=!1;else if(/^-?\d+(?:\.\d+)?$/.test(U))U=Number(U)}j[V]=U}return{data:j,content:T.trim()}}function Le(v,_={}){let{gfm:k=!0,breaks:E=!1}=_,T=v,j=[];if(T=T.replace(/```(\w*)\n([\s\S]*?)```/g,(U,H,Y)=>{let J=j.length,re=H?` class="language-${fr(H)}"`:"";return j.push(`<pre><code${re}>${fr(Y.trim())}</code></pre>`),`\x00CODEBLOCK${J}\x00`}),T=T.replace(/`([^`]*)`/g,(U,H)=>`<code>${fr(H)}</code>`),T=T.replace(/^######\s+(.*)$/gm,"<h6>$1</h6>"),T=T.replace(/^#####\s+(.*)$/gm,"<h5>$1</h5>"),T=T.replace(/^####\s+(.*)$/gm,"<h4>$1</h4>"),T=T.replace(/^###\s+(.*)$/gm,"<h3>$1</h3>"),T=T.replace(/^##\s+(.*)$/gm,"<h2>$1</h2>"),T=T.replace(/^#\s+(.*)$/gm,"<h1>$1</h1>"),T=T.replace(/\*\*\*(.+?)\*\*\*/g,"<strong><em>$1</em></strong>"),T=T.replace(/___(.+?)___/g,"<strong><em>$1</em></strong>"),T=T.replace(/\*\*(.+?)\*\*/g,"<strong>$1</strong>"),T=T.replace(/__(.+?)__/g,"<strong>$1</strong>"),T=T.replace(/\*(.+?)\*/g,"<em>$1</em>"),T=T.replace(/(?<![a-zA-Z0-9])_(.+?)_(?![a-zA-Z0-9])/g,"<em>$1</em>"),k)T=T.replace(/~~(.+?)~~/g,"<del>$1</del>");if(T=T.replace(/!\[([^\]]*)\]\(([^)]+)\)/g,(U,H,Y)=>`<img src="${Mu(Y)?fr(Y):""}" alt="${fr(H)}" />`),T=T.replace(/\[([^\]]+)\]\(([^)]+)\)/g,(U,H,Y)=>`<a href="${Mu(Y)?fr(Y):""}">${H}</a>`),T=T.replace(/^(?:---|\*\*\*|___)\s*$/gm,"<hr />"),T=T.replace(/^>\s+(.*)$/gm,"<blockquote>$1</blockquote>"),T=T.replace(/<\/blockquote>\n<blockquote>/g,`
622
+ `}function Du(v,_){let k=Pu(_);if(!k)return v;let E=v.lastIndexOf("</body>");if(E!==-1)return v.slice(0,E)+k+v.slice(E);return v+k}var Mu={name:"heatmap",hasEndTag:!1,description:"Inject privacy-compliant heatmap tracking script",handler:async(v,_,k,E)=>{let T=k.__stx_config||{};if(_.length>0){let j=Dh(_.join(" "));T.heatmap={...T.heatmap,...j,enabled:!0}}return Pu(T)}};function Dh(v){let _={},k=v.match(/(\w+)=["']?([^"'\s]+)["']?/g)||[];for(let E of k){let[T,j]=E.split("="),B=j?.replace(/["']/g,"");switch(T){case"endpoint":_.endpoint=B;break;case"samplingRate":_.samplingRate=Number.parseInt(B,10);break;case"batchSize":_.batchSize=Number.parseInt(B,10);break;case"trackMouse":_.trackMouse=B==="true";break;case"trackClicks":_.trackClicks=B==="true";break;case"trackScroll":_.trackScroll=B==="true";break;case"honorDnt":_.honorDnt=B==="true";break;case"debugOverlay":_.debugOverlay=B==="true";break}}return _}function fr(v){return v.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function Ou(v){let _=v.trim().toLowerCase();return!_.startsWith("javascript:")&&!_.startsWith("vbscript:")&&!_.startsWith("data:text/html")}function Fn(v){let _=/^---\r?\n([\s\S]*?)\r?\n---\r?\n/,k=v.match(_);if(!k)return{data:{},content:v.trim()};let E=k[1],T=v.slice(k[0].length),j={};for(let B of E.split(`
623
+ `)){let z=B.trim();if(!z||z.startsWith("#"))continue;let F=z.indexOf(":");if(F===-1)continue;let V=z.slice(0,F).trim(),U=z.slice(F+1).trim();if(typeof U==="string"){if(U.startsWith('"')&&U.endsWith('"')||U.startsWith("'")&&U.endsWith("'"))U=U.slice(1,-1);else if(U.startsWith("[")&&U.endsWith("]"))try{U=JSON.parse(U)}catch{}else if(U==="true")U=!0;else if(U==="false")U=!1;else if(/^-?\d+(?:\.\d+)?$/.test(U))U=Number(U)}j[V]=U}return{data:j,content:T.trim()}}function Le(v,_={}){let{gfm:k=!0,breaks:E=!1}=_,T=v,j=[];if(T=T.replace(/```(\w*)\n([\s\S]*?)```/g,(U,H,Y)=>{let J=j.length,re=H?` class="language-${fr(H)}"`:"";return j.push(`<pre><code${re}>${fr(Y.trim())}</code></pre>`),`\x00CODEBLOCK${J}\x00`}),T=T.replace(/`([^`]*)`/g,(U,H)=>`<code>${fr(H)}</code>`),T=T.replace(/^######\s+(.*)$/gm,"<h6>$1</h6>"),T=T.replace(/^#####\s+(.*)$/gm,"<h5>$1</h5>"),T=T.replace(/^####\s+(.*)$/gm,"<h4>$1</h4>"),T=T.replace(/^###\s+(.*)$/gm,"<h3>$1</h3>"),T=T.replace(/^##\s+(.*)$/gm,"<h2>$1</h2>"),T=T.replace(/^#\s+(.*)$/gm,"<h1>$1</h1>"),T=T.replace(/\*\*\*(.+?)\*\*\*/g,"<strong><em>$1</em></strong>"),T=T.replace(/___(.+?)___/g,"<strong><em>$1</em></strong>"),T=T.replace(/\*\*(.+?)\*\*/g,"<strong>$1</strong>"),T=T.replace(/__(.+?)__/g,"<strong>$1</strong>"),T=T.replace(/\*(.+?)\*/g,"<em>$1</em>"),T=T.replace(/(?<![a-zA-Z0-9])_(.+?)_(?![a-zA-Z0-9])/g,"<em>$1</em>"),k)T=T.replace(/~~(.+?)~~/g,"<del>$1</del>");if(T=T.replace(/!\[([^\]]*)\]\(([^)]+)\)/g,(U,H,Y)=>`<img src="${Ou(Y)?fr(Y):""}" alt="${fr(H)}" />`),T=T.replace(/\[([^\]]+)\]\(([^)]+)\)/g,(U,H,Y)=>`<a href="${Ou(Y)?fr(Y):""}">${H}</a>`),T=T.replace(/^(?:---|\*\*\*|___)\s*$/gm,"<hr />"),T=T.replace(/^>\s+(.*)$/gm,"<blockquote>$1</blockquote>"),T=T.replace(/<\/blockquote>\n<blockquote>/g,`
624
624
  `),T=T.replace(/^[*\-+]\s+(.*)$/gm,"<li data-ul>$1</li>"),T=T.replace(/(<li data-ul>.*<\/li>\n?)+/g,"<ul>$&</ul>"),T=T.replace(/<\/ul>\n<ul>/g,""),T=T.replace(/^\d+\.\s+(.*)$/gm,"<li data-ol>$1</li>"),T=T.replace(/(<li data-ol>.*<\/li>\n?)+/g,"<ol>$&</ol>"),T=T.replace(/<\/ol>\n<ol>/g,""),T=T.replace(/<li data-ul>/g,"<li>"),T=T.replace(/<li data-ol>/g,"<li>"),k)T=T.replace(/^\|(.+)\|\s*\n\|[-:\s|]+\|\s*\n((?:\|.+\|\s*\n)*)/gm,(U,H,Y)=>{let re=`<tr>${H.split("|").map((ie)=>ie.trim()).filter(Boolean).map((ie)=>`<th>${fr(ie)}</th>`).join("")}</tr>`,se=Y.trim().split(`
625
625
  `).map((ie)=>`<tr>${ie.split("|").map((ce)=>ce.trim()).filter(Boolean).map((ce)=>`<td>${fr(ce)}</td>`).join("")}</tr>`).join(`
626
626
  `);return`<table>
@@ -637,7 +637,7 @@ ${se}
637
637
  `:`
638
638
  `)}</p>`);if(T=z.join(`
639
639
  `),E)T=T.replace(/\n/g,`<br />
640
- `);for(let U=0;U<j.length;U++)T=T.replace(`\x00CODEBLOCK${U}\x00`,j[U]);return T=T.replace(/<p>\s*<\/p>/g,""),T.trim()}import xo from"fs";import zt from"path";function tn(v){return v.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}var Nu=new Map;function bo(v,_=!0){let k=Nu.get(v);if(_&&k)return k;let E=new Map,T=[zt.join(v,"src"),zt.join(v,"dist"),v];function j(B,z){if(z>6)return;let F;try{F=xo.readdirSync(B,{withFileTypes:!0})}catch{return}for(let V of F){let U=zt.join(B,V.name);if(V.isDirectory()){if(V.name==="node_modules"||V.name.startsWith("."))continue;j(U,z+1)}else if(V.isFile()&&V.name.endsWith(".stx")){let H=V.name.slice(0,-4);if(!E.has(H))E.set(H,U);let Y=H.toLowerCase();if(!E.has(Y))E.set(Y,U);let J=tn(H);if(!E.has(J))E.set(J,U)}}}for(let B of T)if(j(B,0),E.size>0)break;if(_)Nu.set(v,E);return E}function vo(v,_){if(v.startsWith(".")||v.startsWith("/"))return null;let k=_;while(!0){let E=zt.join(k,"node_modules",v);try{if(xo.statSync(E).isDirectory())return E}catch{}let T=zt.dirname(k);if(T===k)return null;k=T}}function wo(v,_,k={}){return[zt.resolve(zt.dirname(_),`${v}.stx`),zt.resolve(zt.dirname(_),v),zt.resolve(k.componentsDir||"components",`${v}.stx`),zt.resolve(k.componentsDir||"components",v),v.endsWith(".stx")?v:`${v}.stx`]}function ju(v){let _=v.endsWith(".stx")?v.slice(0,-4):v,k=_.split("-").map((T)=>T.charAt(0).toUpperCase()+T.slice(1)).join(""),E=tn(_);return[_,k,E]}function Na(v,_){let[k,E,T]=ju(v);for(let j of[k,k.toLowerCase(),E,T]){let B=_?.__importedComponents?.get(j);if(B!==void 0)return B}}function*ja(v,_,k={},E){let T=ju(v);if(T[0].startsWith("./")||T[0].startsWith("../")){yield zt.resolve(zt.dirname(_),`${T[0]}.stx`);return}let j=[...new Set(T.map((F)=>`${F}.stx`))],B=k.projectRoot||process.cwd(),z=[...E?.__originalFilePath?[zt.join(zt.dirname(E.__originalFilePath),"components")]:[],...k.componentsDir?[k.componentsDir]:[],zt.join(zt.dirname(_),"components"),zt.resolve(B,"src/components"),zt.resolve(B,"components"),...import.meta.dir?[zt.resolve(import.meta.dir,"components")]:[]];for(let F of new Set(z)){for(let V of j)yield zt.join(F,V);try{for(let V of xo.readdirSync(F,{withFileTypes:!0}))if(V.isDirectory())for(let U of j)yield zt.join(F,V.name,U)}catch{}}}function Lu(v,_,k={},E){let T=Na(v,E);if(T!==void 0)return T;for(let j of ja(v,_,k,E))try{if(xo.statSync(j,{throwIfNoEntry:!1})?.isFile())return j}catch{}return null}import eh from"fs";import nt from"path";import Rr from"path";import xi from"fs";var Dh=new Set(["touchstart","touchmove","wheel","mousewheel"]);function La(v,_){if(_.passive)return!0;if(_.prevent||_.nonpassive)return!1;return Dh.has(v.toLowerCase())}var Bu=new Set(["click","dblclick","mousedown","mouseup","mousemove","mouseenter","mouseleave","mouseover","mouseout","contextmenu","wheel","keydown","keyup","keypress","submit","reset","change","input","focus","blur","focusin","focusout","select","invalid","touchstart","touchend","touchmove","touchcancel","drag","dragstart","dragend","dragenter","dragleave","dragover","drop","scroll","resize","load","error","abort","animationstart","animationend","animationiteration","transitionstart","transitionend","transitionrun","transitioncancel","mounted","unmounted"]),zu={enter:"Enter",tab:"Tab",delete:"Delete",backspace:"Backspace",esc:"Escape",escape:"Escape",space:" ",up:"ArrowUp",down:"ArrowDown",left:"ArrowLeft",right:"ArrowRight",home:"Home",end:"End",pageup:"PageUp",pagedown:"PageDown"},Oh=new Set(["ctrl","alt","shift","meta"]),Vu={left:0,middle:1,right:2};function Wu(v){let _={prevent:!1,stop:!1,once:!1,capture:!1,self:!1,passive:!1,nonpassive:!1,keys:[],systemKeys:[],mouse:null,debounce:null,throttle:null};for(let k of v){let E=k.toLowerCase();if(E==="prevent")_.prevent=!0;else if(E==="stop")_.stop=!0;else if(E==="once")_.once=!0;else if(E==="capture")_.capture=!0;else if(E==="self")_.self=!0;else if(E==="passive")_.passive=!0;else if(E==="nonpassive")_.nonpassive=!0;else if(Oh.has(E))_.systemKeys.push(E);else if(E in Vu)_.mouse=E;else if(E in zu||/^[a-z]$/.test(E))_.keys.push(zu[E]||E.toUpperCase());else if(E.startsWith("debounce")){let T=E.match(/debounce(?:\.(\d+))?/);_.debounce=T?.[1]?Number.parseInt(T[1],10):300}else if(E.startsWith("throttle")){let T=E.match(/throttle(?:\.(\d+))?/);_.throttle=T?.[1]?Number.parseInt(T[1],10):300}}return _}function Uu(v,_=""){let k=[],E=0,T=/<([a-z][a-z0-9-]*)\s+([^>]*@[a-z][^>]*)>/gi,j;while((j=T.exec(v))!==null){let[B,z,F]=j,V=j.index,U=V+B.length,H=`__stx_evt_${_}${E++}`,Y=[],J=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,re;while((re=J.exec(F))!==null){let[,ie,ae]=re,ce=ie.split("."),oe=ce[0];if(!Bu.has(oe))continue;Y.push({attribute:`@${ie}`,event:oe,handler:ae,modifiers:Wu(ce.slice(1)),elementId:H})}let se=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((re=se.exec(F))!==null){let[,ie,ae]=re,ce=ie.split("."),oe=ce[0];if(!Bu.has(oe))continue;Y.push({attribute:`@${ie}`,event:oe,handler:ae,modifiers:Wu(ce.slice(1)),elementId:H})}if(Y.length>0)k.push({originalTag:B,elementId:H,events:Y,startIndex:V,endIndex:U})}return k}function Mh(v){let _=[],{modifiers:k}=v;if(k.self)_.push("if ($event.target !== $el) return");for(let E of k.systemKeys)_.push(`if (!$event.${E}Key) return`);if(k.keys.length>0){let E=k.keys.map((T)=>`$event.key === '${T}'`).join(" || ");_.push(`if (!(${E})) return`)}if(k.mouse!==null){let E=Vu[k.mouse];_.push(`if ($event.button !== ${E}) return`)}if(k.prevent)_.push("$event.preventDefault()");if(k.stop)_.push("$event.stopPropagation()");return _.join("; ")}function Nh(v,_){let k=v;if(_.debounce!==null)k=`__stx_debounce(() => { ${k} }, ${_.debounce})`;else if(_.throttle!==null)k=`__stx_throttle(() => { ${k} }, ${_.throttle})`;return k}function Ba(v){let _=v.trim();if(!/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(_))return v;return`if (typeof ${_} === 'function' && !${_}._isSignal) ${_}($event);`}function jh(v){let{modifiers:_}=v,k=v.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),E=Mh(v),T=Nh(Ba(v.handler),_),j=[];if(_.once)j.push("once: true");if(_.capture)j.push("capture: true");if(La(v.event,_))j.push("passive: true");let B=j.length>0?`, { ${j.join(", ")} }`:"",z=T.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t");if(v.event==="mounted")return`
640
+ `);for(let U=0;U<j.length;U++)T=T.replace(`\x00CODEBLOCK${U}\x00`,j[U]);return T=T.replace(/<p>\s*<\/p>/g,""),T.trim()}import bo from"fs";import zt from"path";function tn(v){return v.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}var Nu=new Map;function vo(v,_=!0){let k=Nu.get(v);if(_&&k)return k;let E=new Map,T=[zt.join(v,"src"),zt.join(v,"dist"),v];function j(B,z){if(z>6)return;let F;try{F=bo.readdirSync(B,{withFileTypes:!0})}catch{return}for(let V of F){let U=zt.join(B,V.name);if(V.isDirectory()){if(V.name==="node_modules"||V.name.startsWith("."))continue;j(U,z+1)}else if(V.isFile()&&V.name.endsWith(".stx")){let H=V.name.slice(0,-4);if(!E.has(H))E.set(H,U);let Y=H.toLowerCase();if(!E.has(Y))E.set(Y,U);let J=tn(H);if(!E.has(J))E.set(J,U)}}}for(let B of T)if(j(B,0),E.size>0)break;if(_)Nu.set(v,E);return E}function wo(v,_){if(v.startsWith(".")||v.startsWith("/"))return null;let k=_;while(!0){let E=zt.join(k,"node_modules",v);try{if(bo.statSync(E).isDirectory())return E}catch{}let T=zt.dirname(k);if(T===k)return null;k=T}}function So(v,_,k={}){return[zt.resolve(zt.dirname(_),`${v}.stx`),zt.resolve(zt.dirname(_),v),zt.resolve(k.componentsDir||"components",`${v}.stx`),zt.resolve(k.componentsDir||"components",v),v.endsWith(".stx")?v:`${v}.stx`]}function ju(v){let _=v.endsWith(".stx")?v.slice(0,-4):v,k=_.split("-").map((T)=>T.charAt(0).toUpperCase()+T.slice(1)).join(""),E=tn(_);return[_,k,E]}function Na(v,_){let[k,E,T]=ju(v);for(let j of[k,k.toLowerCase(),E,T]){let B=_?.__importedComponents?.get(j);if(B!==void 0)return B}}function*ja(v,_,k={},E){let T=ju(v);if(T[0].startsWith("./")||T[0].startsWith("../")){yield zt.resolve(zt.dirname(_),`${T[0]}.stx`);return}let j=[...new Set(T.map((F)=>`${F}.stx`))],B=k.projectRoot||process.cwd(),z=[...E?.__originalFilePath?[zt.join(zt.dirname(E.__originalFilePath),"components")]:[],...k.componentsDir?[k.componentsDir]:[],zt.join(zt.dirname(_),"components"),zt.resolve(B,"src/components"),zt.resolve(B,"components"),...import.meta.dir?[zt.resolve(import.meta.dir,"components")]:[]];for(let F of new Set(z)){for(let V of j)yield zt.join(F,V);try{for(let V of bo.readdirSync(F,{withFileTypes:!0}))if(V.isDirectory())for(let U of j)yield zt.join(F,V.name,U)}catch{}}}function Lu(v,_,k={},E){let T=Na(v,E);if(T!==void 0)return T;for(let j of ja(v,_,k,E))try{if(bo.statSync(j,{throwIfNoEntry:!1})?.isFile())return j}catch{}return null}import th from"fs";import nt from"path";import Rr from"path";import xi from"fs";var Mh=new Set(["touchstart","touchmove","wheel","mousewheel"]);function La(v,_){if(_.passive)return!0;if(_.prevent||_.nonpassive)return!1;return Mh.has(v.toLowerCase())}var Bu=new Set(["click","dblclick","mousedown","mouseup","mousemove","mouseenter","mouseleave","mouseover","mouseout","contextmenu","wheel","keydown","keyup","keypress","submit","reset","change","input","focus","blur","focusin","focusout","select","invalid","touchstart","touchend","touchmove","touchcancel","drag","dragstart","dragend","dragenter","dragleave","dragover","drop","scroll","resize","load","error","abort","animationstart","animationend","animationiteration","transitionstart","transitionend","transitionrun","transitioncancel","mounted","unmounted"]),zu={enter:"Enter",tab:"Tab",delete:"Delete",backspace:"Backspace",esc:"Escape",escape:"Escape",space:" ",up:"ArrowUp",down:"ArrowDown",left:"ArrowLeft",right:"ArrowRight",home:"Home",end:"End",pageup:"PageUp",pagedown:"PageDown"},Oh=new Set(["ctrl","alt","shift","meta"]),Vu={left:0,middle:1,right:2};function Wu(v){let _={prevent:!1,stop:!1,once:!1,capture:!1,self:!1,passive:!1,nonpassive:!1,keys:[],systemKeys:[],mouse:null,debounce:null,throttle:null};for(let k of v){let E=k.toLowerCase();if(E==="prevent")_.prevent=!0;else if(E==="stop")_.stop=!0;else if(E==="once")_.once=!0;else if(E==="capture")_.capture=!0;else if(E==="self")_.self=!0;else if(E==="passive")_.passive=!0;else if(E==="nonpassive")_.nonpassive=!0;else if(Oh.has(E))_.systemKeys.push(E);else if(E in Vu)_.mouse=E;else if(E in zu||/^[a-z]$/.test(E))_.keys.push(zu[E]||E.toUpperCase());else if(E.startsWith("debounce")){let T=E.match(/debounce(?:\.(\d+))?/);_.debounce=T?.[1]?Number.parseInt(T[1],10):300}else if(E.startsWith("throttle")){let T=E.match(/throttle(?:\.(\d+))?/);_.throttle=T?.[1]?Number.parseInt(T[1],10):300}}return _}function Uu(v,_=""){let k=[],E=0,T=/<([a-z][a-z0-9-]*)\s+([^>]*@[a-z][^>]*)>/gi,j;while((j=T.exec(v))!==null){let[B,z,F]=j,V=j.index,U=V+B.length,H=`__stx_evt_${_}${E++}`,Y=[],J=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,re;while((re=J.exec(F))!==null){let[,ie,ae]=re,ce=ie.split("."),oe=ce[0];if(!Bu.has(oe))continue;Y.push({attribute:`@${ie}`,event:oe,handler:ae,modifiers:Wu(ce.slice(1)),elementId:H})}let se=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((re=se.exec(F))!==null){let[,ie,ae]=re,ce=ie.split("."),oe=ce[0];if(!Bu.has(oe))continue;Y.push({attribute:`@${ie}`,event:oe,handler:ae,modifiers:Wu(ce.slice(1)),elementId:H})}if(Y.length>0)k.push({originalTag:B,elementId:H,events:Y,startIndex:V,endIndex:U})}return k}function Nh(v){let _=[],{modifiers:k}=v;if(k.self)_.push("if ($event.target !== $el) return");for(let E of k.systemKeys)_.push(`if (!$event.${E}Key) return`);if(k.keys.length>0){let E=k.keys.map((T)=>`$event.key === '${T}'`).join(" || ");_.push(`if (!(${E})) return`)}if(k.mouse!==null){let E=Vu[k.mouse];_.push(`if ($event.button !== ${E}) return`)}if(k.prevent)_.push("$event.preventDefault()");if(k.stop)_.push("$event.stopPropagation()");return _.join("; ")}function jh(v,_){let k=v;if(_.debounce!==null)k=`__stx_debounce(() => { ${k} }, ${_.debounce})`;else if(_.throttle!==null)k=`__stx_throttle(() => { ${k} }, ${_.throttle})`;return k}function Ba(v){let _=v.trim();if(!/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(_))return v;return`if (typeof ${_} === 'function' && !${_}._isSignal) ${_}($event);`}function Lh(v){let{modifiers:_}=v,k=v.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),E=Nh(v),T=jh(Ba(v.handler),_),j=[];if(_.once)j.push("once: true");if(_.capture)j.push("capture: true");if(La(v.event,_))j.push("passive: true");let B=j.length>0?`, { ${j.join(", ")} }`:"",z=T.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t");if(v.event==="mounted")return`
641
641
  (function() {
642
642
  var $el = document.getElementById('${k}');
643
643
  if (!$el) return;
@@ -746,11 +746,11 @@ else {
746
746
  }
747
747
 
748
748
  // Event listeners
749
- ${v.map(jh).join(`
749
+ ${v.map(Lh).join(`
750
750
  `)}
751
751
  })();
752
- </script>`}function Lh(v,_=""){let k=Uu(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,"\\$&"),U=new RegExp(`\\s*${V}\\s*=\\s*"[^"]*"`,"g"),H=new RegExp(`\\s*${V}\\s*=\\s*'[^']*'`,"g");z=z.replace(U,""),z=z.replace(H,"")}E=E.slice(0,B.startIndex)+z+E.slice(B.endIndex),T.push(...B.events)}return{template:E,bindings:T}}function Fu(v){let _=v.$uid;return typeof _==="string"&&_?`${_}_`:""}function Hu(v,_,k){if(Li(v))return v;if(_.__stx_sfc_mode){if(/x-data\s*=\s*["']/.test(v))return v;let{template:z,bindings:F}=Lh(v,Fu(_)),V=_.__stx_event_bindings||[];return _.__stx_event_bindings=[...V,...F],z}let E=Uu(v,Fu(_));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 U=V.match(/id=["']([^"']+)["']/);if(U)for(let H of F.events)H.elementId=U[1]}for(let U of F.events){let H=U.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),Y=new RegExp(`\\s*${H}\\s*=\\s*"[^"]*"`,"g"),J=new RegExp(`\\s*${H}\\s*=\\s*'[^']*'`,"g");V=V.replace(Y,""),V=V.replace(J,"")}T=T.slice(0,F.startIndex)+V+T.slice(F.endIndex)}let j=za(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 qu(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 So(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)&&qu(z[1],!0).has(_))return!0;for(let z of k.matchAll(/(?:const|let|var)\s*\[([^\]]*)\]/g))if(j(z.index??0)&&qu(z[1],!1).has(_))return!0;return!1}var Ku="",$o,pr=/^[A-Za-z_$][\w$]*$/,Bh=new Set(["if","for","while","switch","with"]),Xu=["(","[","{"],Zu=[")","]","}"],zh=new Set(["const","let","var","return","if","for","while","do","switch","try","throw","export"]);function Wh(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 Wa(v){if($o&&v===Ku)return $o;let{code:_,tokens:k}=Wh(v),E=new Map,T=[];for(let J=0;J<k.length;J++){let re=k[J].text;if(["(","[","{"].includes(re))T.push(J);else if([")","]","}"].includes(re)){let se=T.at(-1);if(se!==void 0&&["()","[]","{}"].includes(k[se].text+re))T.pop(),E.set(se,J),E.set(J,se)}}function j(J,re){let se=[],ie=J;for(let ae=J;ae<re;ae++){if(["(","[","{"].includes(k[ae].text)&&(E.get(ae)??re)<re){ae=E.get(ae);continue}if(k[ae].text===",")se.push([ie,ae]),ie=ae+1}return se.push([ie,re]),se}let B=[];function z(J,re,se){if(k[J]?.text==="...")J++;if(J>=re)return;let ie=k[J].text;if(pr.test(ie)){if(se.add(ie),se===U)B.push({name:ie,token:J});return}if(ie!=="{"&&ie!=="[")return;let ae=E.get(J);if(ae===void 0||ae>=re)return;for(let[ce,oe]of j(J+1,ae)){let pe=ce;if(ie==="{")for(let he=ce;he<oe;he++){if(k[he].text===":"){pe=he+1;break}if(k[he].text==="=")break;if(["(","[","{"].includes(k[he].text)&&E.has(he))he=E.get(he)}z(pe,oe,se)}}function F(J,re){let se=new Set;for(let[ie,ae]of j(J,re))z(ie,ae,se);return se}function V(J){let re=J;for(;re<k.length;re++){let se=k[re].text;if(["(","[","{"].includes(se)&&E.has(re)){re=E.get(re);continue}if([",",";",")","]","}"].includes(se))break}return k[Math.max(J,re-1)]?.end??_.length}let U=new Set,H=[];for(let J=0;J<k.length;J++)if(k[J].text==="=>"){let re=J-1,se=re,ie;if(k[re]?.text===")"&&E.has(re))se=E.get(re),ie=F(se+1,re);else if(k[re]&&pr.test(k[re].text))ie=new Set([k[re].text]);else continue;let ae=J+1,ce=k[ae]?.text==="{"&&E.has(ae)?k[E.get(ae)].end:V(ae);H.push({start:k[se].start,end:ce,names:ie})}else if(k[J].text==="("&&E.has(J)){let re=k[J-1]?.text;if(!re||Bh.has(re)||!pr.test(re)&&re!=="*"&&re!=="]")continue;let se=E.get(J),ie=se+1;if(k[ie]?.text===":"){ie++;while(ie<k.length&&!["{","=>",";","="].includes(k[ie].text))ie++}if(k[ie]?.text!=="{"||!E.has(ie))continue;H.push({start:k[J].start,end:k[E.get(ie)].end,names:F(J+1,se)})}function Y(J){let re=J;for(;re<k.length;re++){let se=k[re].text;if(Xu.includes(se)&&E.has(re)){re=E.get(re);continue}if(se===";"||Zu.includes(se))break;let ie=k[re-1];if(re>J&&zh.has(se)&&ie.text!==".")break;if(re>J&&/[\n\r]/.test(_.slice(ie.end,k[re].start))&&(/^[\w$]+$/.test(ie.text)||Zu.includes(ie.text)||['"',"'","`"].includes(ie.text))&&pr.test(se)&&!["in","of","instanceof"].includes(se))break}return re}for(let J=0;J<k.length;J++){let re=k[J].text,se=k[J-1]?.text;if(se==="."||k[J+1]?.text===":")continue;if(se==="as"||se==="<")continue;if(re==="const"||re==="let"||re==="var"){let ie=Y(J+1),ae=J+1,ce=!1,oe=!1,pe=0;for(let he=J+1;he<=ie;he++){let xe=k[he]?.text;if(he<ie&&Xu.includes(xe)&&E.has(he)&&E.get(he)<ie){he=E.get(he);continue}if(he<ie&&xe===":"&&!oe)ce=!0;else if(he<ie&&xe==="="&&pe===0)ce=!1,oe=!0;else if(he<ie&&ce&&xe==="<")pe++;else if(he<ie&&ce&&xe===">"&&pe>0)pe--;else if(he===ie||xe===","&&pe===0)z(ae,he,U),ae=he+1,ce=!1,oe=!1}}else if(re==="function"||re==="class"){let ie=J+1;if(k[ie]?.text==="*")ie++;if(k[ie]&&pr.test(k[ie].text)&&k[ie].text!=="extends")U.add(k[ie].text),B.push({name:k[ie].text,token:ie})}else if(re==="import"){let ie=J+1;if(k[ie]?.text==="*"&&k[ie+1]?.text==="as")ie+=2;let ae=k[ie]?.text;if(ae&&pr.test(ae)&&ae!=="type"&&k[ie+1]?.text!=="("&&k[ie+1]?.text!==".")U.add(ae),B.push({name:ae,token:ie,file:!0});let ce=k[ie]?.text==="{"?ie:k[ie+1]?.text===","&&k[ie+2]?.text==="{"?ie+2:-1;if(ce!==-1&&E.has(ce)){let oe=E.get(ce);for(let[pe,he]of j(ce+1,oe)){let xe=he-1;while(xe>=pe&&!pr.test(k[xe].text))xe--;if(xe>=pe&&k[xe].text!=="type")B.push({name:k[xe].text,token:xe,file:!0})}}}}return Ku=v,$o={code:_,scopes:H,declarations:U,sites:B,tokens:k,pairs:E},$o}function Fa(v){let _=Wa(v);return{code:_.code,shadows:(k,E)=>_.scopes.some((T)=>E>=T.start&&E<T.end&&T.names.has(k))}}function _o(v){return new Set(Wa(v).declarations)}function Wo(v,_){let{scopes:k,sites:E,tokens:T,pairs:j}=Wa(v),B=Array.from({length:T.length},()=>-1),z=[];for(let Y=0;Y<T.length;Y++){B[Y]=z.length?z[z.length-1]:-1;let J=T[Y].text;if(J==="{"&&j.has(Y))z.push(Y);else if(J==="}"&&z.length&&j.get(Y)===z[z.length-1])z.pop()}let F=new Set,V=new Map;for(let Y of E){if(!_.has(Y.name))continue;F.add(Y.token);let J=Y.file?-1:B[Y.token],re=J===-1?[0,Number.POSITIVE_INFINITY]:[T[J].start,T[j.get(J)].end],se=V.get(Y.name);if(se)se.push(re);else V.set(Y.name,[re])}let U=new Set;for(let Y=0;Y<T.length;Y++){if(T[Y].text!=="import"||T[Y-1]?.text===".")continue;let J=Y+1;if(T[J]?.text==="type")J++;if(T[J]&&pr.test(T[J].text)&&T[J+1]?.text===",")J+=2;if(T[J]?.text==="{"&&j.has(J))for(let re=J+1;re<j.get(J);re++)U.add(re)}let H=new Set;for(let Y=0;Y<T.length;Y++){let J=T[Y].text;if(!_.has(J)||H.has(J)||F.has(Y)||U.has(Y))continue;let re=T[Y-1]?.text;if(re==="."&&T[Y-2]?.text!=="..")continue;if(T[Y+1]?.text===":"&&(re==="{"||re===","))continue;let se=T[Y].start;if(V.get(J)?.some(([ie,ae])=>se>=ie&&se<ae))continue;if(k.some((ie)=>se>=ie.start&&se<ie.end&&ie.names.has(J)))continue;H.add(J)}return H}var Gu=Symbol.for("stx.lazy-module-promises");function Fh(){let v=globalThis;return v[Gu]??=new Map,v[Gu]}function gt(v,_){let k=Fh(),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 Vh=/<\/(script)/gi;function Kr(v){if(!v||v.indexOf("</")===-1)return v;return v.replace(Vh,"<\\/$1")}import Qu 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 Xr=new Map,Uh=500;function Cr(v,_){if(_?.includes("g"))return new RegExp(v,_);let k=`${v}:${_||""}`;if(!Xr.has(k)){if(Xr.size>=Uh){let E=Xr.keys().next().value;if(E)Xr.delete(E)}Xr.set(k,new RegExp(v,_))}return Xr.get(k)}class Ju{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}`,U=T.get(V);if(!U){if(T.size>=j){let H=T.keys().next().value;if(H)T.delete(H)}U=Function(..._,`
752
+ </script>`}function Bh(v,_=""){let k=Uu(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,"\\$&"),U=new RegExp(`\\s*${V}\\s*=\\s*"[^"]*"`,"g"),H=new RegExp(`\\s*${V}\\s*=\\s*'[^']*'`,"g");z=z.replace(U,""),z=z.replace(H,"")}E=E.slice(0,B.startIndex)+z+E.slice(B.endIndex),T.push(...B.events)}return{template:E,bindings:T}}function Fu(v){let _=v.$uid;return typeof _==="string"&&_?`${_}_`:""}function Hu(v,_,k){if(Li(v))return v;if(_.__stx_sfc_mode){if(/x-data\s*=\s*["']/.test(v))return v;let{template:z,bindings:F}=Bh(v,Fu(_)),V=_.__stx_event_bindings||[];return _.__stx_event_bindings=[...V,...F],z}let E=Uu(v,Fu(_));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 U=V.match(/id=["']([^"']+)["']/);if(U)for(let H of F.events)H.elementId=U[1]}for(let U of F.events){let H=U.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),Y=new RegExp(`\\s*${H}\\s*=\\s*"[^"]*"`,"g"),J=new RegExp(`\\s*${H}\\s*=\\s*'[^']*'`,"g");V=V.replace(Y,""),V=V.replace(J,"")}T=T.slice(0,F.startIndex)+V+T.slice(F.endIndex)}let j=za(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 qu(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 $o(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)&&qu(z[1],!0).has(_))return!0;for(let z of k.matchAll(/(?:const|let|var)\s*\[([^\]]*)\]/g))if(j(z.index??0)&&qu(z[1],!1).has(_))return!0;return!1}var Ku="",_o,pr=/^[A-Za-z_$][\w$]*$/,zh=new Set(["if","for","while","switch","with"]),Xu=["(","[","{"],Zu=[")","]","}"],Wh=new Set(["const","let","var","return","if","for","while","do","switch","try","throw","export"]);function Fh(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 Wa(v){if(_o&&v===Ku)return _o;let{code:_,tokens:k}=Fh(v),E=new Map,T=[];for(let J=0;J<k.length;J++){let re=k[J].text;if(["(","[","{"].includes(re))T.push(J);else if([")","]","}"].includes(re)){let se=T.at(-1);if(se!==void 0&&["()","[]","{}"].includes(k[se].text+re))T.pop(),E.set(se,J),E.set(J,se)}}function j(J,re){let se=[],ie=J;for(let ae=J;ae<re;ae++){if(["(","[","{"].includes(k[ae].text)&&(E.get(ae)??re)<re){ae=E.get(ae);continue}if(k[ae].text===",")se.push([ie,ae]),ie=ae+1}return se.push([ie,re]),se}let B=[];function z(J,re,se){if(k[J]?.text==="...")J++;if(J>=re)return;let ie=k[J].text;if(pr.test(ie)){if(se.add(ie),se===U)B.push({name:ie,token:J});return}if(ie!=="{"&&ie!=="[")return;let ae=E.get(J);if(ae===void 0||ae>=re)return;for(let[ce,oe]of j(J+1,ae)){let pe=ce;if(ie==="{")for(let he=ce;he<oe;he++){if(k[he].text===":"){pe=he+1;break}if(k[he].text==="=")break;if(["(","[","{"].includes(k[he].text)&&E.has(he))he=E.get(he)}z(pe,oe,se)}}function F(J,re){let se=new Set;for(let[ie,ae]of j(J,re))z(ie,ae,se);return se}function V(J){let re=J;for(;re<k.length;re++){let se=k[re].text;if(["(","[","{"].includes(se)&&E.has(re)){re=E.get(re);continue}if([",",";",")","]","}"].includes(se))break}return k[Math.max(J,re-1)]?.end??_.length}let U=new Set,H=[];for(let J=0;J<k.length;J++)if(k[J].text==="=>"){let re=J-1,se=re,ie;if(k[re]?.text===")"&&E.has(re))se=E.get(re),ie=F(se+1,re);else if(k[re]&&pr.test(k[re].text))ie=new Set([k[re].text]);else continue;let ae=J+1,ce=k[ae]?.text==="{"&&E.has(ae)?k[E.get(ae)].end:V(ae);H.push({start:k[se].start,end:ce,names:ie})}else if(k[J].text==="("&&E.has(J)){let re=k[J-1]?.text;if(!re||zh.has(re)||!pr.test(re)&&re!=="*"&&re!=="]")continue;let se=E.get(J),ie=se+1;if(k[ie]?.text===":"){ie++;while(ie<k.length&&!["{","=>",";","="].includes(k[ie].text))ie++}if(k[ie]?.text!=="{"||!E.has(ie))continue;H.push({start:k[J].start,end:k[E.get(ie)].end,names:F(J+1,se)})}function Y(J){let re=J;for(;re<k.length;re++){let se=k[re].text;if(Xu.includes(se)&&E.has(re)){re=E.get(re);continue}if(se===";"||Zu.includes(se))break;let ie=k[re-1];if(re>J&&Wh.has(se)&&ie.text!==".")break;if(re>J&&/[\n\r]/.test(_.slice(ie.end,k[re].start))&&(/^[\w$]+$/.test(ie.text)||Zu.includes(ie.text)||['"',"'","`"].includes(ie.text))&&pr.test(se)&&!["in","of","instanceof"].includes(se))break}return re}for(let J=0;J<k.length;J++){let re=k[J].text,se=k[J-1]?.text;if(se==="."||k[J+1]?.text===":")continue;if(se==="as"||se==="<")continue;if(re==="const"||re==="let"||re==="var"){let ie=Y(J+1),ae=J+1,ce=!1,oe=!1,pe=0;for(let he=J+1;he<=ie;he++){let xe=k[he]?.text;if(he<ie&&Xu.includes(xe)&&E.has(he)&&E.get(he)<ie){he=E.get(he);continue}if(he<ie&&xe===":"&&!oe)ce=!0;else if(he<ie&&xe==="="&&pe===0)ce=!1,oe=!0;else if(he<ie&&ce&&xe==="<")pe++;else if(he<ie&&ce&&xe===">"&&pe>0)pe--;else if(he===ie||xe===","&&pe===0)z(ae,he,U),ae=he+1,ce=!1,oe=!1}}else if(re==="function"||re==="class"){let ie=J+1;if(k[ie]?.text==="*")ie++;if(k[ie]&&pr.test(k[ie].text)&&k[ie].text!=="extends")U.add(k[ie].text),B.push({name:k[ie].text,token:ie})}else if(re==="import"){let ie=J+1;if(k[ie]?.text==="*"&&k[ie+1]?.text==="as")ie+=2;let ae=k[ie]?.text;if(ae&&pr.test(ae)&&ae!=="type"&&k[ie+1]?.text!=="("&&k[ie+1]?.text!==".")U.add(ae),B.push({name:ae,token:ie,file:!0});let ce=k[ie]?.text==="{"?ie:k[ie+1]?.text===","&&k[ie+2]?.text==="{"?ie+2:-1;if(ce!==-1&&E.has(ce)){let oe=E.get(ce);for(let[pe,he]of j(ce+1,oe)){let xe=he-1;while(xe>=pe&&!pr.test(k[xe].text))xe--;if(xe>=pe&&k[xe].text!=="type")B.push({name:k[xe].text,token:xe,file:!0})}}}}return Ku=v,_o={code:_,scopes:H,declarations:U,sites:B,tokens:k,pairs:E},_o}function Fa(v){let _=Wa(v);return{code:_.code,shadows:(k,E)=>_.scopes.some((T)=>E>=T.start&&E<T.end&&T.names.has(k))}}function ko(v){return new Set(Wa(v).declarations)}function Wo(v,_){let{scopes:k,sites:E,tokens:T,pairs:j}=Wa(v),B=Array.from({length:T.length},()=>-1),z=[];for(let Y=0;Y<T.length;Y++){B[Y]=z.length?z[z.length-1]:-1;let J=T[Y].text;if(J==="{"&&j.has(Y))z.push(Y);else if(J==="}"&&z.length&&j.get(Y)===z[z.length-1])z.pop()}let F=new Set,V=new Map;for(let Y of E){if(!_.has(Y.name))continue;F.add(Y.token);let J=Y.file?-1:B[Y.token],re=J===-1?[0,Number.POSITIVE_INFINITY]:[T[J].start,T[j.get(J)].end],se=V.get(Y.name);if(se)se.push(re);else V.set(Y.name,[re])}let U=new Set;for(let Y=0;Y<T.length;Y++){if(T[Y].text!=="import"||T[Y-1]?.text===".")continue;let J=Y+1;if(T[J]?.text==="type")J++;if(T[J]&&pr.test(T[J].text)&&T[J+1]?.text===",")J+=2;if(T[J]?.text==="{"&&j.has(J))for(let re=J+1;re<j.get(J);re++)U.add(re)}let H=new Set;for(let Y=0;Y<T.length;Y++){let J=T[Y].text;if(!_.has(J)||H.has(J)||F.has(Y)||U.has(Y))continue;let re=T[Y-1]?.text;if(re==="."&&T[Y-2]?.text!=="..")continue;if(T[Y+1]?.text===":"&&(re==="{"||re===","))continue;let se=T[Y].start;if(V.get(J)?.some(([ie,ae])=>se>=ie&&se<ae))continue;if(k.some((ie)=>se>=ie.start&&se<ie.end&&ie.names.has(J)))continue;H.add(J)}return H}var Gu=Symbol.for("stx.lazy-module-promises");function Vh(){let v=globalThis;return v[Gu]??=new Map,v[Gu]}function gt(v,_){let k=Vh(),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 Uh=/<\/(script)/gi;function Kr(v){if(!v||v.indexOf("</")===-1)return v;return v.replace(Uh,"<\\/$1")}import Qu 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 Xr=new Map,Hh=500;function Cr(v,_){if(_?.includes("g"))return new RegExp(v,_);let k=`${v}:${_||""}`;if(!Xr.has(k)){if(Xr.size>=Hh){let E=Xr.keys().next().value;if(E)Xr.delete(E)}Xr.set(k,new RegExp(v,_))}return Xr.get(k)}class Ju{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}`,U=T.get(V);if(!U){if(T.size>=j){let H=T.keys().next().value;if(H)T.delete(H)}U=Function(..._,`
754
754
  'use strict';
755
755
  try {
756
756
  return ${F};
@@ -761,18 +761,18 @@ catch (e) {
761
761
  }
762
762
  throw e;
763
763
  }
764
- `),T.set(V,U)}return U(...z)}catch{return}};if(this.pool.length<this.maxPoolSize)this.pool.push({func:B,context:_.slice()});return B}clear(){this.pool.length=0,this.fnCache.clear()}}var G0=new Ju;class Yu{metrics=new Map;budgets=new Map;violations=[];maxViolations=100;violationHandlers=[];enabled=!0;setEnabled(v){this.enabled=v}isEnabled(){return this.enabled}setBudget(v,_){this.budgets.set(v,{warnThreshold:0.8,action:"warn",..._})}setBudgets(v){for(let[_,k]of Object.entries(v))this.setBudget(_,k)}removeBudget(v){this.budgets.delete(v)}getBudgets(){let v={};for(let[_,k]of this.budgets.entries())v[_]=k;return v}onViolation(v){this.violationHandlers.push(v)}offViolation(v){let _=this.violationHandlers.indexOf(v);if(_!==-1)this.violationHandlers.splice(_,1)}time(v,_){if(!this.enabled)return _();let k=performance.now(),E=_(),T=performance.now()-k;return this.recordTime(v,T),this.checkBudget(v,T),E}async timeAsync(v,_){if(!this.enabled)return _();let k=performance.now(),E=await _(),T=performance.now()-k;return this.recordTime(v,T),this.checkBudget(v,T),E}checkBudget(v,_){let k=this.budgets.get(v);if(!k)return;let E=_/k.maxTime*100,T=k.warnThreshold!==void 0?_>=k.maxTime*k.warnThreshold&&_<k.maxTime:!1,j=_>=k.maxTime;if(!T&&!j)return;let B={label:v,actualTime:_,budgetTime:k.maxTime,exceedancePercent:E,timestamp:new Date,isWarning:T};this.violations.push(B);while(this.violations.length>this.maxViolations)this.violations.shift();for(let F of this.violationHandlers)try{F(B)}catch{}let z=T?`[Performance Warning] "${v}" took ${_.toFixed(2)}ms (${E.toFixed(1)}% of ${k.maxTime}ms budget)`:`[Performance Budget Exceeded] "${v}" took ${_.toFixed(2)}ms (exceeded ${k.maxTime}ms budget by ${(E-100).toFixed(1)}%)`;switch(k.action){case"log":console.log(z);break;case"warn":console.warn(z);break;case"error":console.error(z);break;case"throw":if(j)throw Error(z);else console.warn(z);break}}recordTime(v,_){let k=this.metrics.get(v);if(k)k.count++,k.totalTime+=_,k.maxTime=Math.max(k.maxTime,_),k.minTime=Math.min(k.minTime,_);else this.metrics.set(v,{count:1,totalTime:_,maxTime:_,minTime:_})}getStats(v){if(v){let k=this.metrics.get(v);if(!k)return{};let E=this.budgets.get(v);return{count:k.count,avgTime:k.totalTime/k.count,totalTime:k.totalTime,maxTime:k.maxTime,minTime:k.minTime,budget:E?.maxTime,budgetUtilization:E?k.totalTime/k.count/E.maxTime*100:void 0}}let _={};for(let[k,E]of this.metrics.entries()){let T=this.budgets.get(k);_[k]={count:E.count,avgTime:E.totalTime/E.count,totalTime:E.totalTime,maxTime:E.maxTime,minTime:E.minTime,budget:T?.maxTime,budgetUtilization:T?E.totalTime/E.count/T.maxTime*100:void 0}}return _}getViolations(v){if(v)return this.violations.filter((_)=>_.label===v);return[...this.violations]}getViolationStats(){let v={},_=0,k=0;for(let E of this.violations)if(v[E.label]=(v[E.label]||0)+1,E.isWarning)_++;else k++;return{total:this.violations.length,byLabel:v,warnings:_,errors:k}}clear(){this.metrics.clear()}clearViolations(){this.violations.length=0}clearBudgets(){this.budgets.clear()}reset(){this.clear(),this.clearViolations(),this.clearBudgets(),this.violationHandlers.length=0}}var Va=null;function Hh(){if(!Va)Va=new Yu;return Va}var W=new Proxy({},{get(v,_){return Hh()[_]}});var ed=[];function m(v){let _=new M(v);return ed.push(_),_}function td(){for(let v of ed)v.clear()}function h(v,..._){return`${_.map((k)=>String(k??"")).join("\x00")}\x00${v.length}\x00${Bun.hash(v)}`}function nd(v){let _=[];for(let k of new Set(v))try{_.push({path:k,mtimeMs:Qu.statSync(k).mtimeMs})}catch{}return _}function rn(v){for(let _ of v)try{if(Qu.statSync(_.path).mtimeMs!==_.mtimeMs)return!1}catch{return!1}return!0}var q=["browserQuery","BrowserQueryBuilder","BrowserQueryError","browserAuth","configureBrowser","getBrowserConfig","createBrowserDb","createBrowserModel","isBrowser","debounce","throttle","retry","sleep","wait","delay","waitUntil","waitWhile","lazy","clamp","rand","readableSize","useActiveElement","useIntervalFn","useObjectUrl"];var qh=/^[ \t]*import\s+['"]([^'"]+?\.css)(\?[^'"]*)?['"]\s*;?\s*$/gm;function Kh(v){if(v.startsWith(".")||v.startsWith("/"))return null;if(v.startsWith("@")){let k=v.match(/^(@[^/]+\/[^/]+)(\/.*)?$/);if(!k)return null;return{pkg:k[1],subpath:k[2]||""}}let _=v.match(/^([^/]+)(\/.*)?$/);if(!_)return null;return{pkg:_[1],subpath:_[2]||""}}function Xh(v,_){let k=_;while(!0){let E=Rr.join(k,"node_modules",v,"package.json");if(xi.existsSync(E))return Rr.dirname(E);let T=Rr.dirname(k);if(T===k)return null;k=T}}function Zh(v,_){if(!v||typeof v!=="object")return null;let k=(T)=>{if(typeof T==="string")return T;if(T&&typeof T==="object"){if(typeof T.import==="string")return T.import;if(typeof T.default==="string")return T.default;if(typeof T.import==="object")return k(T.import);if(typeof T.default==="object")return k(T.default)}return null};if(Object.prototype.hasOwnProperty.call(v,_))return k(v[_]);let E=null;for(let T of Object.keys(v)){let j=T.indexOf("*");if(j===-1)continue;let B=T.slice(0,j),z=T.slice(j+1);if(!_.startsWith(B)||!_.endsWith(z))continue;if(_.length<B.length+z.length)continue;if(!E||B.length>E.prefix.length)E={pattern:T,prefix:B,suffix:z}}if(E){let T=_.slice(E.prefix.length,_.length-E.suffix.length),j=k(v[E.pattern]);if(j)return j.replace("*",T)}return null}function Gh(v,_){let k=Kh(v);if(!k||!k.subpath)return null;let E=Xh(k.pkg,_);if(!E)return null;let T;try{T=JSON.parse(xi.readFileSync(Rr.join(E,"package.json"),"utf8"))}catch{return null}let j=`.${k.subpath}`,B=Zh(T.exports,j);if(!B)return null;let z=Rr.resolve(E,B);return xi.existsSync(z)?z:null}function Zr(v,_){let k=_.filePath?Rr.dirname(_.filePath):_.projectRoot||process.cwd(),E=_.projectRoot||process.cwd(),T=new Set,j=[],B=[];return{code:v.replace(qh,(F,V)=>{let U;try{if(V.startsWith("./")||V.startsWith("../")||V.startsWith("/")){if(U=V.startsWith("/")?V:Rr.resolve(k,V),!xi.existsSync(U))throw Error(`file not found: ${U}`)}else{let H=null;try{H=Bun.resolveSync(V,E)}catch{H=Gh(V,E)}if(!H)throw Error(`could not resolve ${V} (Bun.resolveSync + exports fallback both failed)`);U=H}}catch(H){return console.warn(`[stx:vendor-css] could not resolve ${JSON.stringify(V)} (from ${_.filePath||"<unknown>"}): ${H?.message||H}`),B.push(V),""}if(T.has(U))return"";T.add(U);try{let H=xi.readFileSync(U,"utf8");j.push({source:V,resolvedPath:U,contents:H})}catch(H){console.warn(`[stx:vendor-css] could not read ${U}: ${H?.message||H}`),B.push(V)}return""}),styles:j,unresolved:B}}function Jh(v){return v.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Qr(v){if(v.length===0)return"";return`${v.map((_)=>`<style data-stx-vendor="${Jh(_.source)}" data-stx-layer="vendor">
764
+ `),T.set(V,U)}return U(...z)}catch{return}};if(this.pool.length<this.maxPoolSize)this.pool.push({func:B,context:_.slice()});return B}clear(){this.pool.length=0,this.fnCache.clear()}}var J0=new Ju;class Yu{metrics=new Map;budgets=new Map;violations=[];maxViolations=100;violationHandlers=[];enabled=!0;setEnabled(v){this.enabled=v}isEnabled(){return this.enabled}setBudget(v,_){this.budgets.set(v,{warnThreshold:0.8,action:"warn",..._})}setBudgets(v){for(let[_,k]of Object.entries(v))this.setBudget(_,k)}removeBudget(v){this.budgets.delete(v)}getBudgets(){let v={};for(let[_,k]of this.budgets.entries())v[_]=k;return v}onViolation(v){this.violationHandlers.push(v)}offViolation(v){let _=this.violationHandlers.indexOf(v);if(_!==-1)this.violationHandlers.splice(_,1)}time(v,_){if(!this.enabled)return _();let k=performance.now(),E=_(),T=performance.now()-k;return this.recordTime(v,T),this.checkBudget(v,T),E}async timeAsync(v,_){if(!this.enabled)return _();let k=performance.now(),E=await _(),T=performance.now()-k;return this.recordTime(v,T),this.checkBudget(v,T),E}checkBudget(v,_){let k=this.budgets.get(v);if(!k)return;let E=_/k.maxTime*100,T=k.warnThreshold!==void 0?_>=k.maxTime*k.warnThreshold&&_<k.maxTime:!1,j=_>=k.maxTime;if(!T&&!j)return;let B={label:v,actualTime:_,budgetTime:k.maxTime,exceedancePercent:E,timestamp:new Date,isWarning:T};this.violations.push(B);while(this.violations.length>this.maxViolations)this.violations.shift();for(let F of this.violationHandlers)try{F(B)}catch{}let z=T?`[Performance Warning] "${v}" took ${_.toFixed(2)}ms (${E.toFixed(1)}% of ${k.maxTime}ms budget)`:`[Performance Budget Exceeded] "${v}" took ${_.toFixed(2)}ms (exceeded ${k.maxTime}ms budget by ${(E-100).toFixed(1)}%)`;switch(k.action){case"log":console.log(z);break;case"warn":console.warn(z);break;case"error":console.error(z);break;case"throw":if(j)throw Error(z);else console.warn(z);break}}recordTime(v,_){let k=this.metrics.get(v);if(k)k.count++,k.totalTime+=_,k.maxTime=Math.max(k.maxTime,_),k.minTime=Math.min(k.minTime,_);else this.metrics.set(v,{count:1,totalTime:_,maxTime:_,minTime:_})}getStats(v){if(v){let k=this.metrics.get(v);if(!k)return{};let E=this.budgets.get(v);return{count:k.count,avgTime:k.totalTime/k.count,totalTime:k.totalTime,maxTime:k.maxTime,minTime:k.minTime,budget:E?.maxTime,budgetUtilization:E?k.totalTime/k.count/E.maxTime*100:void 0}}let _={};for(let[k,E]of this.metrics.entries()){let T=this.budgets.get(k);_[k]={count:E.count,avgTime:E.totalTime/E.count,totalTime:E.totalTime,maxTime:E.maxTime,minTime:E.minTime,budget:T?.maxTime,budgetUtilization:T?E.totalTime/E.count/T.maxTime*100:void 0}}return _}getViolations(v){if(v)return this.violations.filter((_)=>_.label===v);return[...this.violations]}getViolationStats(){let v={},_=0,k=0;for(let E of this.violations)if(v[E.label]=(v[E.label]||0)+1,E.isWarning)_++;else k++;return{total:this.violations.length,byLabel:v,warnings:_,errors:k}}clear(){this.metrics.clear()}clearViolations(){this.violations.length=0}clearBudgets(){this.budgets.clear()}reset(){this.clear(),this.clearViolations(),this.clearBudgets(),this.violationHandlers.length=0}}var Va=null;function qh(){if(!Va)Va=new Yu;return Va}var W=new Proxy({},{get(v,_){return qh()[_]}});var ed=[];function m(v){let _=new M(v);return ed.push(_),_}function td(){for(let v of ed)v.clear()}function h(v,..._){return`${_.map((k)=>String(k??"")).join("\x00")}\x00${v.length}\x00${Bun.hash(v)}`}function nd(v){let _=[];for(let k of new Set(v))try{_.push({path:k,mtimeMs:Qu.statSync(k).mtimeMs})}catch{}return _}function rn(v){for(let _ of v)try{if(Qu.statSync(_.path).mtimeMs!==_.mtimeMs)return!1}catch{return!1}return!0}var q=["browserQuery","BrowserQueryBuilder","BrowserQueryError","browserAuth","configureBrowser","getBrowserConfig","createBrowserDb","createBrowserModel","isBrowser","debounce","throttle","retry","sleep","wait","delay","waitUntil","waitWhile","lazy","clamp","rand","readableSize","useActiveElement","useIntervalFn","useObjectUrl"];var Kh=/^[ \t]*import\s+['"]([^'"]+?\.css)(\?[^'"]*)?['"]\s*;?\s*$/gm;function Xh(v){if(v.startsWith(".")||v.startsWith("/"))return null;if(v.startsWith("@")){let k=v.match(/^(@[^/]+\/[^/]+)(\/.*)?$/);if(!k)return null;return{pkg:k[1],subpath:k[2]||""}}let _=v.match(/^([^/]+)(\/.*)?$/);if(!_)return null;return{pkg:_[1],subpath:_[2]||""}}function Zh(v,_){let k=_;while(!0){let E=Rr.join(k,"node_modules",v,"package.json");if(xi.existsSync(E))return Rr.dirname(E);let T=Rr.dirname(k);if(T===k)return null;k=T}}function Gh(v,_){if(!v||typeof v!=="object")return null;let k=(T)=>{if(typeof T==="string")return T;if(T&&typeof T==="object"){if(typeof T.import==="string")return T.import;if(typeof T.default==="string")return T.default;if(typeof T.import==="object")return k(T.import);if(typeof T.default==="object")return k(T.default)}return null};if(Object.prototype.hasOwnProperty.call(v,_))return k(v[_]);let E=null;for(let T of Object.keys(v)){let j=T.indexOf("*");if(j===-1)continue;let B=T.slice(0,j),z=T.slice(j+1);if(!_.startsWith(B)||!_.endsWith(z))continue;if(_.length<B.length+z.length)continue;if(!E||B.length>E.prefix.length)E={pattern:T,prefix:B,suffix:z}}if(E){let T=_.slice(E.prefix.length,_.length-E.suffix.length),j=k(v[E.pattern]);if(j)return j.replace("*",T)}return null}function Jh(v,_){let k=Xh(v);if(!k||!k.subpath)return null;let E=Zh(k.pkg,_);if(!E)return null;let T;try{T=JSON.parse(xi.readFileSync(Rr.join(E,"package.json"),"utf8"))}catch{return null}let j=`.${k.subpath}`,B=Gh(T.exports,j);if(!B)return null;let z=Rr.resolve(E,B);return xi.existsSync(z)?z:null}function Zr(v,_){let k=_.filePath?Rr.dirname(_.filePath):_.projectRoot||process.cwd(),E=_.projectRoot||process.cwd(),T=new Set,j=[],B=[];return{code:v.replace(Kh,(F,V)=>{let U;try{if(V.startsWith("./")||V.startsWith("../")||V.startsWith("/")){if(U=V.startsWith("/")?V:Rr.resolve(k,V),!xi.existsSync(U))throw Error(`file not found: ${U}`)}else{let H=null;try{H=Bun.resolveSync(V,E)}catch{H=Jh(V,E)}if(!H)throw Error(`could not resolve ${V} (Bun.resolveSync + exports fallback both failed)`);U=H}}catch(H){return console.warn(`[stx:vendor-css] could not resolve ${JSON.stringify(V)} (from ${_.filePath||"<unknown>"}): ${H?.message||H}`),B.push(V),""}if(T.has(U))return"";T.add(U);try{let H=xi.readFileSync(U,"utf8");j.push({source:V,resolvedPath:U,contents:H})}catch(H){console.warn(`[stx:vendor-css] could not read ${U}: ${H?.message||H}`),B.push(V)}return""}),styles:j,unresolved:B}}function Yh(v){return v.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Qr(v){if(v.length===0)return"";return`${v.map((_)=>`<style data-stx-vendor="${Yh(_.source)}" data-stx-layer="vendor">
765
765
  @layer vendor {
766
766
  ${_.contents}
767
767
  }
768
768
  </style>`).join(`
769
769
  `)}
770
- `}var rc=y,rd=m(256);function St(v){let _=h(v),k=rd.get(_);if(!k)k=Yh(v),rd.set(_,k);return{code:k.code,imports:[...k.imports],models:[...k.models]}}function Yh(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=_o(_),T=q.filter((z)=>{if(k.has(z)||E.has(z))return!1;return es(_,z,!0)}),j=ad(_).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 rc=y,rd=m(256);function St(v){let _=h(v),k=rd.get(_);if(!k)k=Qh(v),rd.set(_,k);return{code:k.code,imports:[...k.imports],models:[...k.models]}}function Qh(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=ko(_),T=q.filter((z)=>{if(k.has(z)||E.has(z))return!1;return es(_,z,!0)}),j=ad(_).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
- ${v}`,imports:T,models:j}}var Qh=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 ad(v){let _=new Set,k=Fa(v),E=_o(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(Qh.has(B)||E.has(B)||B.length<3)continue;if(k.shadows(B,j.index??0))continue;_.add(B)}return Array.from(_)}function ey(v){return _o(v)}var sd=m(128);function qo(v){let _=h(v),k=sd.get(_);if(!k)k=ty(v),sd.set(_,k);return{code:k.code,stxImports:[...k.stxImports],browserImports:[...k.browserImports]}}function ty(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 H=B[1],Y=B[2];if(B[0].includes("import type"))continue;let J=[];for(let se of H.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 ce=ae[1],oe=ae[2]||ce;if(T.add(ce),T.add(oe),Y==="stx"||Y==="@stacksjs/stx")_.add(ce);else k.add(ce);if(oe!==ce)J.push(`${oe} = ${ce}`)}let re=J.length>0?`var ${J.join(", ")}; /* [auto-import processed] */`:"// [auto-import processed]";E=E.replace(B[0],re)}let z=ey(E);for(let H of rc){if(T.has(H)||z.has(H))continue;if(es(E,H,!0))_.add(H)}let F=s(E),V=new Set;for(let H of E.matchAll(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm))for(let Y of H[1].split(",")){let J=Y.trim().replace(/^type\s+/,"").split(/\s+as\s+/);for(let re of J){let se=re.trim();if(se)V.add(se)}}for(let H of q){if(T.has(H)||z.has(H)||V.has(H))continue;if(es(F,H))k.add(H)}let U=ad(F);for(let H of U)if(!T.has(H)&&!z.has(H))k.add(H);return{code:E,stxImports:Array.from(_),browserImports:Array.from(k)}}function es(v,_,k=!1){let E=Fa(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;if(ny(v,z))continue;return!0}return!1}function ny(v,_){let k=_;while(k<v.length&&(v[k]===" "||v[k]==="\t"))k++;if(v[k]!=="(")return!1;let E=0;for(;k<v.length;k++){let T=v[k];if(T==="(")E++;else if(T===")"){if(E--,E===0)break}}if(E!==0)return!1;k++;while(k<v.length&&(v[k]===" "||v[k]==="\t"))k++;return v[k]==="{"}function Go(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
772
+ ${v}`,imports:T,models:j}}var ey=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 ad(v){let _=new Set,k=Fa(v),E=ko(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(ey.has(B)||E.has(B)||B.length<3)continue;if(k.shadows(B,j.index??0))continue;_.add(B)}return Array.from(_)}function ty(v){return ko(v)}var sd=m(128);function qo(v){let _=h(v),k=sd.get(_);if(!k)k=ny(v),sd.set(_,k);return{code:k.code,stxImports:[...k.stxImports],browserImports:[...k.browserImports]}}function ny(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 H=B[1],Y=B[2];if(B[0].includes("import type"))continue;let J=[];for(let se of H.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 ce=ae[1],oe=ae[2]||ce;if(T.add(ce),T.add(oe),Y==="stx"||Y==="@stacksjs/stx")_.add(ce);else k.add(ce);if(oe!==ce)J.push(`${oe} = ${ce}`)}let re=J.length>0?`var ${J.join(", ")}; /* [auto-import processed] */`:"// [auto-import processed]";E=E.replace(B[0],re)}let z=ty(E);for(let H of rc){if(T.has(H)||z.has(H))continue;if(es(E,H,!0))_.add(H)}let F=s(E),V=new Set;for(let H of E.matchAll(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm))for(let Y of H[1].split(",")){let J=Y.trim().replace(/^type\s+/,"").split(/\s+as\s+/);for(let re of J){let se=re.trim();if(se)V.add(se)}}for(let H of q){if(T.has(H)||z.has(H)||V.has(H))continue;if(es(F,H))k.add(H)}let U=ad(F);for(let H of U)if(!T.has(H)&&!z.has(H))k.add(H);return{code:E,stxImports:Array.from(_),browserImports:Array.from(k)}}function es(v,_,k=!1){let E=Fa(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;if(ry(v,z))continue;return!0}return!1}function ry(v,_){let k=_;while(k<v.length&&(v[k]===" "||v[k]==="\t"))k++;if(v[k]!=="(")return!1;let E=0;for(;k<v.length;k++){let T=v[k];if(T==="(")E++;else if(T===")"){if(E--,E===0)break}}if(E!==0)return!1;k++;while(k<v.length&&(v[k]===" "||v[k]==="\t"))k++;return v[k]==="{"}function Go(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(`
774
774
  `)}
775
- ${ry(v,_)}`;return""}function Dd(v,_=[]){let{browserImports:k}=qo(v),E=new Set(_);return Go([],k.filter((T)=>!E.has(T)))}function ry(v,_){let k=[...v.map((E)=>`['${E}', typeof ${E}, 'stx']`),..._.map((E)=>`['${E}', typeof ${E}, '@stacksjs/browser']`)];if(k.length===0)return"";return` // STX: report auto-imports the client runtime did not provide
775
+ ${sy(v,_)}`;return""}function Dd(v,_=[]){let{browserImports:k}=qo(v),E=new Set(_);return Go([],k.filter((T)=>!E.has(T)))}function sy(v,_){let k=[...v.map((E)=>`['${E}', typeof ${E}, 'stx']`),..._.map((E)=>`['${E}', typeof ${E}, '@stacksjs/browser']`)];if(k.length===0)return"";return` // STX: report auto-imports the client runtime did not provide
776
776
  [${k.join(", ")}].forEach(function (e) {
777
777
  if (e[1] !== 'undefined') return;
778
778
  console.error(
@@ -781,10 +781,10 @@ ${ry(v,_)}`;return""}function Dd(v,_=[]){let{browserImports:k}=qo(v),E=new Set(_
781
781
  + 'or it should be imported from a relative path so the bundler includes it.'
782
782
  );
783
783
  });
784
- `}function Be(v){let _=v.__stxClientPayload;if(_&&typeof _==="object"){let E={};for(let T in _){let j=_[T];if(typeof j==="function")continue;E[T]=j}return E.__stxDeclaredPayload=!0,E}let k={};for(let E in v){if(E.startsWith("__")||E.startsWith("$"))continue;let T=v[E];if(typeof T==="function")continue;k[E]=T}return k}function sy(v,_){return new RegExp(`(?<![.#\\w$])${_}(?![\\w$])`).test(v)}var iy=/token|secret|passw|apikey|api_key|privatekey|private_key|credential|webhook|bearer|jwt|signature/i,id=new Set;function oy(v,_){let k=iy.test(v),E=_.length>32768;if(!k&&!E)return;if(id.has(v))return;if(id.add(v),k)console.warn(`[stx] server\u2192client bridge is publishing "${v}" into the page body. If it holds a credential, rename it with a "__" prefix (never bridged) and pass only what the template needs. See stacksjs/stx#1831.`);if(E)console.warn(`[stx] server\u2192client bridge is publishing ${(_.length/1024).toFixed(1)}KB under "${v}". Every byte ships in the HTML on each request; prefix the binding with "__" and project just the fields the client reads.`)}function ts(v,_){if(!_)return"";let k=s(v),E=_.__stxDeclaredPayload===!0,T=[];for(let[j,B]of Object.entries(_)){if(!/^[A-Za-z_$][\w$]*$/.test(j))continue;if(j.startsWith("__")||j.startsWith("$"))continue;if(!E&&!sy(k,j))continue;if(So(v,j)){if(E)console.warn(`[stx] defineClientPayload declares "${j}", but this client block also declares "${j}" at the top level, so the server value is not published (emitting it would be a duplicate binding). Rename the local, or drop "${j}" from defineClientPayload.`);continue}let z;try{z=JSON.stringify(B)}catch{continue}if(z===void 0)continue;oy(j,z),T.push(` var ${j} = ${z.replace(/</g,"\\u003c")};`)}if(T.length===0)return"";return` // stx: server -> client data bridge (seeded from server scope)
784
+ `}function Be(v){let _=v.__stxClientPayload;if(_&&typeof _==="object"){let E={};for(let T in _){let j=_[T];if(typeof j==="function")continue;E[T]=j}return E.__stxDeclaredPayload=!0,E}let k={};for(let E in v){if(E.startsWith("__")||E.startsWith("$"))continue;let T=v[E];if(typeof T==="function")continue;k[E]=T}return k}function iy(v,_){return new RegExp(`(?<![.#\\w$])${_}(?![\\w$])`).test(v)}var oy=/token|secret|passw|apikey|api_key|privatekey|private_key|credential|webhook|bearer|jwt|signature/i,id=new Set;function ay(v,_){let k=oy.test(v),E=_.length>32768;if(!k&&!E)return;if(id.has(v))return;if(id.add(v),k)console.warn(`[stx] server\u2192client bridge is publishing "${v}" into the page body. If it holds a credential, rename it with a "__" prefix (never bridged) and pass only what the template needs. See stacksjs/stx#1831.`);if(E)console.warn(`[stx] server\u2192client bridge is publishing ${(_.length/1024).toFixed(1)}KB under "${v}". Every byte ships in the HTML on each request; prefix the binding with "__" and project just the fields the client reads.`)}function ts(v,_){if(!_)return"";let k=s(v),E=_.__stxDeclaredPayload===!0,T=[];for(let[j,B]of Object.entries(_)){if(!/^[A-Za-z_$][\w$]*$/.test(j))continue;if(j.startsWith("__")||j.startsWith("$"))continue;if(!E&&!iy(k,j))continue;if($o(v,j)){if(E)console.warn(`[stx] defineClientPayload declares "${j}", but this client block also declares "${j}" at the top level, so the server value is not published (emitting it would be a duplicate binding). Rename the local, or drop "${j}" from defineClientPayload.`);continue}let z;try{z=JSON.stringify(B)}catch{continue}if(z===void 0)continue;ay(j,z),T.push(` var ${j} = ${z.replace(/</g,"\\u003c")};`)}if(T.length===0)return"";return` // stx: server -> client data bridge (seeded from server scope)
785
785
  ${T.join(`
786
786
  `)}
787
- `}var ay={left:0,middle:1,right:2};function cy(v){let _=[];if(v.self)_.push("if ($event.target !== $el) return");for(let k of v.systemKeys)_.push(`if (!$event.${k}Key) return`);if(v.keys.length>0){let k=v.keys.map((E)=>`$event.key === '${E}'`).join(" || ");_.push(`if (!(${k})) return`)}if(v.mouse!==null){let k=ay[v.mouse];_.push(`if ($event.button !== ${k}) return`)}if(v.prevent)_.push("$event.preventDefault()");if(v.stop)_.push("$event.stopPropagation()");return _.join("; ")}function ly(v,_){let{elementId:k,event:E,modifiers:T}=v,j=Ba(v.handler),B=cy(T),z=[];if(T.once)z.push("once: true");if(T.capture)z.push("capture: true");if(La(E,T))z.push("passive: true");let F=z.length>0?`, { ${z.join(", ")} }`:"",V="";if(B)V+=`${B}; `;let U=j.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),H=`var $emit = function(name, detail) {
787
+ `}var cy={left:0,middle:1,right:2};function ly(v){let _=[];if(v.self)_.push("if ($event.target !== $el) return");for(let k of v.systemKeys)_.push(`if (!$event.${k}Key) return`);if(v.keys.length>0){let k=v.keys.map((E)=>`$event.key === '${E}'`).join(" || ");_.push(`if (!(${k})) return`)}if(v.mouse!==null){let k=cy[v.mouse];_.push(`if ($event.button !== ${k}) return`)}if(v.prevent)_.push("$event.preventDefault()");if(v.stop)_.push("$event.stopPropagation()");return _.join("; ")}function uy(v,_){let{elementId:k,event:E,modifiers:T}=v,j=Ba(v.handler),B=ly(T),z=[];if(T.once)z.push("once: true");if(T.capture)z.push("capture: true");if(La(E,T))z.push("passive: true");let F=z.length>0?`, { ${z.join(", ")} }`:"",V="";if(B)V+=`${B}; `;let U=j.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),H=`var $emit = function(name, detail) {
788
788
  $el.dispatchEvent(new CustomEvent(name, { detail: detail, bubbles: true, cancelable: true }))
789
789
  };`;function Y(J){if(/\$emit\s*\(/.test(J))return`${H}
790
790
  ${J}`;return`var scope = $el.closest('[data-stx-scope]');
@@ -827,11 +827,11 @@ else {
827
827
  else {
828
828
  ${j}
829
829
  }
830
- }${F})`}function uy(v){if(v.length===0)return"";return`
830
+ }${F})`}function dy(v){if(v.length===0)return"";return`
831
831
  // STX: auto-generated event bindings
832
- ${v.map((k,E)=>ly(k,E)).join(`
832
+ ${v.map((k,E)=>uy(k,E)).join(`
833
833
  `)}`}function od(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 Y=V[1];if(!Y.startsWith("_")&&!k.has(Y))_.push(Y),k.add(Y);B+=V[0].length;continue}let U=F.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(U){U[1].split(",").forEach((Y)=>{let J=Y.trim(),re=J.indexOf(":"),se=re>=0?J.slice(re+1).trim().split(/[\s=]/)[0]:J.split(/[\s=]/)[0];if(se&&!se.startsWith("_")&&!k.has(se))_.push(se),k.add(se)}),B+=U[0].length;continue}let H=F.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(H){let Y=H[1];if(!Y.startsWith("_")&&!k.has(Y))_.push(Y),k.add(Y);B+=H[0].length;continue}}B++}return _}var dy=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 fy(v){let _=new Set,k=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function E(Y){let J;while((J=k.exec(Y))!==null){let re=J[0];if(!dy.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 U=/@model\s*=\s*["']([^"']*)["']/gi;while((j=U.exec(v))!==null)E(j[1]);let H=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((j=H.exec(v))!==null)E(j[1]);return _}async function ye(v,_={}){let k=v,E="",T=!1,j=[],B=Zr(k,{filePath:_.filePath,projectRoot:_.projectRoot});k=B.code;let z=Qr(B.styles),F=St(k);k=F.code,j=[...F.imports,...F.models];let{hasUserImports:V,bundleClientScript:U}=await gt("stx/client-script-bundler",()=>import("./chunk-a2c6t7w2.js"));if(V(k))k=await U(k,_.filePath||"",{projectRoot:_.projectRoot,minify:_.production}),T=!0;if(_.autoImports!==!1){let oe=qo(k);k=oe.code,E=Go(oe.stxImports,oe.browserImports.filter((pe)=>!j.includes(pe)))}if(E=`${ts(k,_.serverData)}${E}`,k=I(k),!T&&qe(_.attrs||""))k=Ge(k);let H=uy(_.eventBindings||[]),Y=(_.attrs||"").trim(),J=/\btype\s*=\s*["']module["']/i.test(Y),re=_.instanceId?` data-stx-instance="${_.instanceId}"`:"";if(J){let oe=Y.replace(/\btype\s*=\s*["']module["']/i,"").trim(),pe=`type="module" data-stx-scoped${re}${oe?` ${oe}`:""}`;return`${z}<script ${pe}>
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 Y=V[1];if(!Y.startsWith("_")&&!k.has(Y))_.push(Y),k.add(Y);B+=V[0].length;continue}let U=F.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(U){U[1].split(",").forEach((Y)=>{let J=Y.trim(),re=J.indexOf(":"),se=re>=0?J.slice(re+1).trim().split(/[\s=]/)[0]:J.split(/[\s=]/)[0];if(se&&!se.startsWith("_")&&!k.has(se))_.push(se),k.add(se)}),B+=U[0].length;continue}let H=F.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(H){let Y=H[1];if(!Y.startsWith("_")&&!k.has(Y))_.push(Y),k.add(Y);B+=H[0].length;continue}}B++}return _}var fy=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 py(v){let _=new Set,k=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function E(Y){let J;while((J=k.exec(Y))!==null){let re=J[0];if(!fy.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 U=/@model\s*=\s*["']([^"']*)["']/gi;while((j=U.exec(v))!==null)E(j[1]);let H=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((j=H.exec(v))!==null)E(j[1]);return _}async function ye(v,_={}){let k=v,E="",T=!1,j=[],B=Zr(k,{filePath:_.filePath,projectRoot:_.projectRoot});k=B.code;let z=Qr(B.styles),F=St(k);k=F.code,j=[...F.imports,...F.models];let{hasUserImports:V,bundleClientScript:U}=await gt("stx/client-script-bundler",()=>import("./chunk-x0fhwxhv.js"));if(V(k))k=await U(k,_.filePath||"",{projectRoot:_.projectRoot,minify:_.production}),T=!0;if(_.autoImports!==!1){let oe=qo(k);k=oe.code,E=Go(oe.stxImports,oe.browserImports.filter((pe)=>!j.includes(pe)))}if(E=`${ts(k,_.serverData)}${E}`,k=I(k),!T&&qe(_.attrs||""))k=Ge(k);let H=dy(_.eventBindings||[]),Y=(_.attrs||"").trim(),J=/\btype\s*=\s*["']module["']/i.test(Y),re=_.instanceId?` data-stx-instance="${_.instanceId}"`:"";if(J){let oe=Y.replace(/\btype\s*=\s*["']module["']/i,"").trim(),pe=`type="module" data-stx-scoped${re}${oe?` ${oe}`:""}`;return`${z}<script ${pe}>
835
835
  ${Kr(`${E}${k}
836
836
  ${H}`)}
837
837
  </script>`}let se=Bs(v),ie=/function __stx_setup_/.test(k),ae=/\bstx\.mount\s*\(|\bstx\.mountEl\s*\(/.test(v);function ce(oe){let pe=oe.length>0?`
@@ -845,7 +845,7 @@ ${H}${pe}`)}
845
845
  console.error(${he}, error);
846
846
  return {};
847
847
  }
848
- })</script>`}if(!ae&&!ie){if(se)return ce(od(v));if(_.templateContent){let oe=od(v);if(oe.length>0){let pe=fy(_.templateContent);if(oe.some((xe)=>pe.has(xe)))return ce(oe)}}}return`${z}<script data-stx-scoped data-stx-run="always"${re}>
848
+ })</script>`}if(!ae&&!ie){if(se)return ce(od(v));if(_.templateContent){let oe=od(v);if(oe.length>0){let pe=py(_.templateContent);if(oe.some((xe)=>pe.has(xe)))return ce(oe)}}}return`${z}<script data-stx-scoped data-stx-run="always"${re}>
849
849
  ;(function() {
850
850
  'use strict';
851
851
  try {
@@ -854,7 +854,7 @@ ${H}`)}
854
854
  } catch (error) {
855
855
  console.error(${JSON.stringify(`[stx] client block failed${_.filePath?` (${_.filePath})`:""}; this block will not hydrate`)}, error);
856
856
  }
857
- })()</script>`}import{createHash as py}from"crypto";var ko="__stx_component_client_factories";function Eo(v){let _=v[ko];return _ instanceof Map?_:null}function ld(v){v[ko]=new Map}function Ua(v,_){let k=Eo(v);if(!k)return null;let E=py("sha256").update(_).digest("hex").slice(0,16),T=k.get(E);if(T)T.instances++;else k.set(E,{body:_,instances:1});return E}function ud(v,_){let k=Eo(_);if(!k?.size)return v;let E=new Map;for(let[U,H]of k)if(H.instances===1)E.set(U,H.body);let T=[];if(E.size>0){let U=[...E.keys()].map((J)=>JSON.stringify(J).replace(/[$()*+.?[\\\]^{|}]/g,"\\$&")).join("|"),H=new RegExp(`window\\.__stxComponentFactories\\[(${U})\\]\\(("[^"]+")\\);`,"g"),Y=H.exec(v);while(Y!==null){let J=E.get(JSON.parse(Y[1]));if(J!==void 0)T.push({start:Y.index,end:Y.index+Y[0].length,replacement:`(${J})(${Y[2]});`});Y=H.exec(v)}}let j=[...k].filter(([,U])=>U.instances>1);if(j.length===0)return cd(v,T);let z=`<script data-stx-scoped data-stx-run="always" data-stx-component-factories>
857
+ })()</script>`}import{createHash as gy}from"crypto";var Eo="__stx_component_client_factories";function Co(v){let _=v[Eo];return _ instanceof Map?_:null}function ld(v){v[Eo]=new Map}function Ua(v,_){let k=Co(v);if(!k)return null;let E=gy("sha256").update(_).digest("hex").slice(0,16),T=k.get(E);if(T)T.instances++;else k.set(E,{body:_,instances:1});return E}function ud(v,_){let k=Co(_);if(!k?.size)return v;let E=new Map;for(let[U,H]of k)if(H.instances===1)E.set(U,H.body);let T=[];if(E.size>0){let U=[...E.keys()].map((J)=>JSON.stringify(J).replace(/[$()*+.?[\\\]^{|}]/g,"\\$&")).join("|"),H=new RegExp(`window\\.__stxComponentFactories\\[(${U})\\]\\(("[^"]+")\\);`,"g"),Y=H.exec(v);while(Y!==null){let J=E.get(JSON.parse(Y[1]));if(J!==void 0)T.push({start:Y.index,end:Y.index+Y[0].length,replacement:`(${J})(${Y[2]});`});Y=H.exec(v)}}let j=[...k].filter(([,U])=>U.instances>1);if(j.length===0)return cd(v,T);let z=`<script data-stx-scoped data-stx-run="always" data-stx-component-factories>
858
858
  (function() {
859
859
  const factories = window.__stxComponentFactories = window.__stxComponentFactories || {};
860
860
  ${j.map(([U,H])=>` try { factories[${JSON.stringify(U)}] = factories[${JSON.stringify(U)}] || ${H.body}; }
@@ -862,10 +862,10 @@ ${j.map(([U,H])=>` try { factories[${JSON.stringify(U)}] = factories[${JSON.str
862
862
  `)}
863
863
  })();
864
864
  </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}
865
- `}),cd(v,T)}function cd(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 dd(v){let _=Eo(v),k=new Map;if(_)for(let[E,T]of _)k.set(E,T.instances);return k}function fd(v,_){let k=Eo(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 pd(v,_){for(let{body:k,count:E}of _)for(let T=0;T<E;T++)Ua(v,k)}import Ed from"fs";var gd=0,Ha=new Map;function Ko(){gd=0,Ha.clear()}function Co(v,_){let k=gd++,E=`<!--__STX_${v.toUpperCase()}_${k}__-->`;return Ha.set(E,{type:v,expression:_}),E}function Xo(){let v={};for(let[_,k]of Ha)v[_]={type:k.type,expression:k.expression};return v}function Jo(v,_){let k=v;for(let[E,T]of _)k=k.split(E).join(T);return k}function ns(v){return v.includes("<!--__STX_")}var gy=/@(?=[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 my(v){return Array.from({length:v},()=>"&#123;").join("&#8288;")}function md(v){return v.replace(/\{{2,}/g,(_)=>my(_.length)).replace(/\{(?=!)/g,"&#123;&#8288;").replace(gy,"&#64;")}function hd(v,_,k=!1){let E=v.slice(0,_),T=E.lastIndexOf("<"),j=E.lastIndexOf(">");if(T>=0&&j>T)return null;if(T<0&&!k)return null;let B=T>=0?E.slice(T+1):E;if(T>=0&&/^\s*[!/?]/.test(B))return/^\s*\/?\s*$/.test(B)?{kind:"tag-name"}:null;if(T>=0&&/^\s*$/.test(B))return{kind:"tag-name"};let z=/(?:^|\s)([^\s"'<>/=]+)\s*=\s*"([^"]*)$/.exec(B);if(z)return{kind:"attribute",name:z[1],quote:'"',valuePrefix:z[2]};let F=/(?:^|\s)([^\s"'<>/=]+)\s*=\s*'([^']*)$/.exec(B);if(F)return{kind:"attribute",name:F[1],quote:"'",valuePrefix:F[2]};let V=/(?:^|\s)([^\s"'<>/=]+)\s*=\s*([^\s"'=<>`]*)$/.exec(B);if(V)return{kind:"attribute",name:V[1],quote:null,valuePrefix:V[2]};return T>=0||/^\s*[^<>]*$/.test(B)?{kind:"tag"}:null}class or extends Error{attribute;constructor(v,_){super(`Unsafe interpolation in ${v}: ${_}`);this.name="UnsafeInterpolationContextError",this.attribute=v}}var yd="unsafe:";var hy=/^(?:javascript|vbscript|livescript|mocha|view-source):/,yy=/^data:(?:text\/html|text\/xml|application\/xhtml\+xml|application\/xml|image\/svg\+xml)/,xy=/^data:(?:text\/html|application\/xhtml\+xml)/,by=new RegExp("[\\u0000-\\u0020\\u00A0\\u1680\\u2000-\\u200F\\u2028\\u2029\\u202F\\u205F\\u3000\\uFEFF]+","g");function vy(v){return v.replace(by,"").toLowerCase()}function qa(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 Ro(v,_="navigable"){let k=vy(v);if(hy.test(k))return!0;return _==="navigable"?yy.test(k):xy.test(k)}function Ei(v,_="navigable"){return Ro(v,_)?"unsafe:"+v:v}function wy(v){let _=v.match(/(?:^|[\s"'`/])([A-Za-z][\w:-]*)\s*=\s*(["'])([^"']*)$/);if(!_)return null;if(_[3].trim()!=="")return null;return qa(_[1])}function xd(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 bd(v,_,k=_){let E=wy(v);return E&&Ro(_,E)?"unsafe:"+k:k}var Ao=/<script\b[^>]*>/iy,Ga=/<\/script\s*>/ig,To=/<style\b[^>]*>/iy,Ja=/<\/style\s*>/ig;function vd(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 Z(v,_){return vd(v,_,Ao,Ga)}function Yr(v,_){return vd(v,_,To,Ja)}function Fe(v,_){if(!v.startsWith("<!--",_))return-1;let k=v.indexOf("-->",_+4);if(k===-1)return-1;return k+3}function wd(v,_){if(v.startsWith("<!--",_)){let T=Fe(v,_);return T===-1?v.length:T}if(Ao.lastIndex=_,Ao.exec(v)?.index===_){Ga.lastIndex=Ao.lastIndex;let T=Ga.exec(v);return T?T.index+T[0].length:v.length}if(To.lastIndex=_,To.exec(v)?.index===_){Ja.lastIndex=To.lastIndex;let T=Ja.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 H=v.indexOf("<",E+1);if(H===-1)break;E=H;continue}let F=_(v,E);if(F>E){k.push({start:E,end:F,token:v.slice(E,F)}),E=F;continue}let V=wd(v,E);if(V>E){E=V;continue}let U=v.charCodeAt(E+1);if(U>=65&&U<=90||U>=97&&U<=122)j=!0;E++}return k}function Sd(v){let _=0,k=0,E=0,T=!1,j=null;while(E<v.length){if(T){let H=v[E];if(j){if(H===j)j=null}else if(H==='"'||H==="'")j=H;else if(H===">")T=!1;E++;continue}let B=v.indexOf("<",E),z=B===-1?v.length:B;while(E<z){let H=v[E++];if(H==="{")_++;else if(H==="}")k++;if(_>=2&&k>=2)return!0}if(B===-1)break;let F=wd(v,B);if(F>B){E=F;continue}let V=v.charCodeAt(B+1),U=V===47?v.charCodeAt(B+2):V;if(U>=65&&U<=90||U>=97&&U<=122)T=!0;E=B+1}return!1}function $d(v,_){while(v.size>=_){let k=v.keys().next();if(k.done)return;v.delete(k.value)}}var Sy=1024,$y=16777216,Gr=new Map,Ka=0;function _y(v,_){Gr.set(v,_),Ka+=v.length+_.output.length;for(let[k,E]of Gr){if(Ka<=$y)break;Gr.delete(k),Ka-=k.length+E.output.length}}function Pn(v,_,k,E){let T=E!==void 0&&v.length>=Sy,j=T?`${E}\x00${v}`:"";if(T){let U=Gr.get(j);if(U)return Gr.delete(j),Gr.set(j,U),{output:U.output,tokens:U.tokens.slice()}}let B=gr(v,_);if(B.length===0)return{output:v,tokens:[]};let z=B.map((U)=>U.token),F="",V=0;for(let U=0;U<B.length;U++){let H=B[U];F+=v.slice(V,H.start),F+=k(H.token,U),V=H.end}if(F+=v.slice(V),T)return _y(j,{output:F,tokens:z}),{output:F,tokens:z.slice()};return{output:F,tokens:z}}var ky=1024,Ey=16777216,Jr=new Map,Xa=0;function Cy(v,_){Jr.set(v,_),Xa+=v.length+_.output.length;for(let[k,E]of Jr){if(Xa<=Ey)break;Jr.delete(k),Xa-=k.length+E.output.length}}function Za(v,_,k){return{output:_,scripts:k,restore:(E)=>E===_?v:fs(E,k)}}function $n(v){let _=v.length>=ky;if(_){let T=Jr.get(v);if(T)return Jr.delete(v),Jr.set(v,T),Za(v,T.output,T.scripts.slice())}let{output:k,tokens:E}=Pn(v,Z,(T,j)=>`\x00STX_SCRIPT_${j}\x00`);if(_)return Cy(v,{output:k,scripts:E}),Za(v,k,E.slice());return Za(v,k,E)}function fs(v,_){if(_.length===0)return v;return v.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(k,E)=>_[+E]??"")}function kt(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 Io(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 _d(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 kd(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 Ar(v,_){let k=v.trim().replace(/^\.\.\./,"").trim(),E=_d(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 Io(k.slice(1,-1))){let j=T.trim();if(!j)continue;if(j.startsWith("...")){Ar(j,_);continue}let B=_d(j,":");Ar(B===-1?j:j.slice(B+1),_)}return}if(k.startsWith("[")&&k.endsWith("]")){for(let T of Io(k.slice(1,-1)))Ar(T,_);return}if(/^[A-Z_$][\w$]*$/i.test(k))_.push(k)}function Es(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("(")&&kd(F)===F.length-1)F=F.slice(1,-1);for(let V of Io(F))Ar(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("(")&&kd(j)===j.length-1)j=j.slice(1,-1);let B=/^([\w$]+)\s*=>\s*([\s\S]+)$/.exec(j);if(B)Ar(B[2],k),Ar(B[1],k);else for(let z of Io(j))Ar(z,k)}return k}function Tr(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 Po="__stx_client_loop_names";function yr(v){let _=v?.[Po];return Array.isArray(_)?_:[]}var Ti={},Cd=new Map;function Ry(v){let _=Cd.get(v);if(!_){let k=v.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");_=new RegExp(`:${k}(?!\\w)`,"g"),Cd.set(v,_)}return _.lastIndex=0,_}var zn={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 Ct(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(Ry(F),String(V))}),z},t:(v,_,k={})=>zn.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 sc(v,_){if(v in zn)console.warn(`Filter "${v}" already exists as a built-in filter. Custom filter will take precedence.`);Ti[v]=_}function Md(v){for(let[_,k]of Object.entries(v))sc(_,k)}function oc(){return{...zn,...Ti}}function Nd(){for(let v of Object.keys(Ti))delete Ti[v]}function ic(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 Hn(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=ic(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 Ct(v){return md(b(v))}function Ay(v){return v.replace(/ /g,"&#32;").replace(/\t/g,"&#9;").replace(/\n/g,"&#10;").replace(/\r/g,"&#13;").replace(/\f/g,"&#12;").replace(/=/g,"&#61;").replace(/`/g,"&#96;")}function Ty(v){return v.replace(/\/\*[\s\S]*?\*\//g,"").replace(/\\([\dA-Fa-f]{1,6})\s?/g,(_,k)=>String.fromCodePoint(Number.parseInt(k,16))).replace(/\\([^\r\n])/g,"$1").replace(/[\u0000-\u0020]+/g,"").toLowerCase()}function Iy(v,_){let k=Ty(v);if(/@import|expression\(|behavior:|-moz-binding|(?:image-set|cross-fade)\(/.test(k))throw new or(_,"network-capable or executable CSS is not allowed in an escaped interpolation");let E=/url\(([^)]*)\)/g,T;while((T=E.exec(k))!==null){let j=T[1].replace(/^["']|["']$/g,""),B=j.startsWith("/")&&!j.startsWith("//")||j.startsWith("./")||j.startsWith("../")||j.startsWith("#"),z=/^data:image\/(?:avif|bmp|gif|jpeg|jpg|png|webp);base64,[a-z\d+/=]+$/i.test(j);if(!B&&!z)throw new or(_,"CSS URLs must be local paths or base64 raster images")}}function Pd(v,_,k,E=!1,T=0){let j=hd(v,_,E),B=Ct(k);if(!j)return B;if(j.kind==="tag-name"){if(!/^[A-Za-z][A-Za-z0-9:-]*$/.test(k))throw new or("tag name","dynamic tag names may contain only letters, digits, colons, and hyphens");return k}if(j.kind==="tag"){let V=v.slice(_+T).trimStart(),U=k.trim();if(!V.startsWith("=")&&(U===""||/^(?!on)[A-Za-z_:][\w:.-]*(?:\s+(?!on)[A-Za-z_:][\w:.-]*)*$/.test(U)))return U;throw new or("tag structure","only standalone boolean attributes may be interpolated into tag structure")}let z=j.name.toLowerCase();if(/^on[a-z]/.test(z))throw new or(j.name,"native event-handler attributes execute JavaScript; use an @event binding instead");if(z==="srcdoc")B=Ct(B);if(z==="style")Iy(k,j.name);if(j.quote===null)B=Ay(B);let F=qa(z);if(F&&j.valuePrefix.trim()===""&&Ro(k,F))return yd+B;return bd(xd(v,_),k,B)}function be(v,_){let{scripts:k}=$n(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(Sn(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 ac(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(Es(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 U=z.exec(v);U;U=z.exec(v)){if(U[2]==="/")continue;if(F+=U[1]==="/"?-1:1,F===0){V=U.index+U[0].length;break}}_.push({start:E.index,end:V,names:j})}return _}function Py(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 Rd(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 U=E[V];if(!j&&U==="`"){j=!0,B=0;continue}if(j){if(U==="`"&&B===0){j=!1;continue}if(U==="$"&&E[V+1]==="{"){B++,V++,T+=" ";continue}if(U==="}"&&B>0){B--;continue}if(B>0){T+=U;continue}continue}T+=U}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 Dy(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 Ad=new Set;function Td(v){return/^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*)*$/.test(v.trim())}function Id(v,_){let k=`${_??"<unknown>"}\x00${v}`;if(process.env.STX_DEBUG||!Ad.has(k))Ad.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 rs(v,_,k){let E=v;return E=E.replace(/\{!!([\s\S]*?)!!\}/g,(T,j)=>{try{let B=x(j,_);if(B===void 0)return Td(j)?Id(j.trim(),k):T;return B===null?"":String(B)}catch{return T}}),E=Hn(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 Td(z)?Id(z,k):T;return JSON.stringify(F).replace(/</g,"\\u003c")}catch{return T}}),E}function cc(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=Hn(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 Pd(k,j,F,!0,E.length)}catch(z){if(z instanceof or)throw z;return E}}),k}function Ld(v,_,k={}){let{output:E,scripts:T}=$n(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 U=z[1],H=z[2];if(/\bdata-raw\b/.test(U))return B;if(k.skipServer&&/\bserver\b/.test(U))return B;let J=`<script${cc(U,_)}>`;if(/\bsrc\s*=/.test(U)||/\btype\s*=\s*["']application\/json["']/.test(U))return J+H+B.slice(V);return J+rs(H,_)+B.slice(V)});return fs(E,j)}function G(v,_,k){let E=v,T=(J,re)=>{let se=Yr(J,re);if(se===-1)return-1;return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(J.slice(re,se))?-1:se},j=(J,re,se,ie)=>{let ae=se.length,{output:ce,tokens:oe}=Pn(J,re,(pe,he)=>ie(ae+he));return se.push(...oe),ce},B=[];E=j(E,T,B,(J)=>`<!--__STX_STYLE_${J}__-->`);let z=[];E=j(E,Z,z,(J)=>`<!--__STX_SCRIPT_EXPR_${J}__-->`);let F=_?.__stx_signals_gate===!0||be(v),V=new Set(Array.isArray(_?.__stx_client_signal_names)?_.__stx_client_signal_names:[]),U=new Set(Array.isArray(_?.__stx_preserved_client_expressions)?_.__stx_preserved_client_expressions:[]);E=Hn(E,(J,re,se)=>{try{let ie=x(re,_,!1,(ae)=>Ya(ae,J,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,J)}},3),E=E.replace(/\{!!([\s\S]*?)!!\}/g,(J,re,se)=>{try{let ie=x(re,_,!1,(ae)=>Ya(ae,J,k,v));if(ie===void 0&&_.__stx_buildMode==="compile")return Co("raw",re.trim());return ie!==void 0&&ie!==null?String(ie):""}catch(ie){if(_.__stx_buildMode==="compile")return Co("raw",re.trim());let ae=ie instanceof Error?ie.message:String(ie);return g("Expression",`Error evaluating: {!! ${re.trim()} !!}: ${ae}`,k,v,se,J)}}),E=j(E,Z,z,(J)=>`<!--__STX_SCRIPT_EXPR_${J}__-->`),E=j(E,T,B,(J)=>`<!--__STX_STYLE_${J}__-->`);let H=F?ac(E):[],Y=new Set(yr(_));if(E=Hn(E,(J,re,se)=>{let ie=re.trim();if(Tr(ie,Y))return J;if(H.length>0&&Py(H,se,ie))return J;if(U.has(ie))return J;let ae=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined"],ce=/^([a-zA-Z_$][a-zA-Z0-9_$]*)/,pe=ie.match(ce)?.[1],he=pe&&((pe in _)||ae.includes(pe)),xe=Boolean(pe&&V.has(pe)),$e=/^([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/,Re=ie.match($e),Ce=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(xe)return J;if(F&&!Rd(ie,_))return J;if(Ae)Ya(Ae,J,k,v);if(_.__stx_buildMode==="compile"&&!F&&(Te===void 0||Dy(ie,_)))return Co("expr",ie);if(Te===void 0||Te===null)return"";let _e=String(Te);return Pd(E,se,_e,!1,J.length)}catch(Te){if(Te instanceof or)throw Te;if(xe)return J;if(F&&!Rd(ie,_))return J;if(Ce)return J;let _e=Te instanceof Error?Te.message:String(Te);return g("Expression",`Error evaluating: {{ ${ie} }}: ${_e}`,k,v,se,J)}}),z.length>0)E=E.replace(/<!--__STX_SCRIPT_EXPR_(\d+)__-->/g,(J,re)=>z[Number(re)]??J);if(B.length>0)E=E.replace(/<!--__STX_STYLE_(\d+)__-->/g,(J,re)=>B[Number(re)]??J);return E}function lc(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=Ti[B]||zn[B];if(!z)throw Error(`Filter not found: ${B}. Available filters: ${Object.keys(oc()).join(", ")}`);let F=[];if(T.startsWith(":")){let V=T.match(/^:([^|\s]+)/);if(V){let U=V[1].trim();try{let H=Number(U);F=[Number.isNaN(H)?U:H]}catch{F=[U]}T=T.substring(V[0].length).trim()}}else if(T.startsWith("(")){let V=1,U=1;while(V>0&&U<T.length){if(T[U]==="(")V++;if(T[U]===")")V--;U++}if(V===0){let H=T.substring(1,U-1).trim();if(H)try{if(H.startsWith("{")&&H.endsWith("}"))F=[x(`(${H})`,k,!0)];else{let Y=[],J="",re=null,se=0,ie=0,ae=0,ce=!1;for(let oe=0;oe<H.length;oe++){let pe=H[oe];if(ce){J+=pe,ce=!1;continue}if(pe==="\\"){J+=pe,ce=!0;continue}if(re){if(J+=pe,pe===re)re=null;continue}if(pe==='"'||pe==="'"||pe==="`"){re=pe,J+=pe;continue}if(pe==="(")se++;else if(pe===")")se--;else if(pe==="[")ie++;else if(pe==="]")ie--;else if(pe==="{")ae++;else if(pe==="}")ae--;if(pe===","&&se===0&&ie===0&&ae===0){Y.push(J),J="";continue}J+=pe}if(J)Y.push(J);F=Y.map((oe)=>{let pe=oe.trim();return x(pe,k,!0)})}}catch{F=[H]}T=T.substring(U).trim()}}try{E=z(E,k,...F)}catch(V){let U=V instanceof Error?V.message:String(V);throw Error(`Error applying filter '${B}': ${U}`)}if(T.startsWith("|"))T=T.substring(1).trim();else break}return E}function Oy(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 U=1;z+=2;while(z<v.length&&U>0){if(v[z]==="{")U++;else if(v[z]==="}")U--;if(U>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 Ci=new Set,My=1000;function jd(){Ci.clear()}function Ya(v,_,k,E){if(!D())return;let T=`${k}\x00${v.expression}`;if(Ci.has(T))return;if(Ci.size>=My)Ci.clear();Ci.add(T);let j=k,B=E;try{if(k&&Ed.existsSync(k))B=Ed.readFileSync(k,"utf8")}catch{}let z=B.indexOf(_);if(z>=0)j=`${k}:${B.slice(0,z).split(`
866
- `).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=Oy(T);if(j>0){let z=T.substring(0,j).trim(),F=T.substring(j+1).trim(),V=x(z,_,!0,E);return lc(V,F,_)}let B=vn(T);if(B!==null){E?.({expression:T,rule:B});return}try{let z=Object.keys(_),F=Object.values(_);return c(T,z)(...F)}catch{return l(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=Ny(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 Ny(v,_){let k=null;for(let T of _){if(T===v)continue;let j=jy(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 jy(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 Bd(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 oS from"fs";import Qt from"path";import Wi from"fs";import Dt from"path";import{hasLocalConfig as Ef}from"bunfig";import Dn from"fs";import Pr from"path";import Qa from"fs";import Od from"path";import{fileURLToPath as Ly}from"url";var ec;function je(){if(ec)return ec;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 _=Od.dirname(Ly(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(Od.join(E.parentPath,E.name)).mtimeMs);v+=`+src.${Math.trunc(k)}`}catch{}return ec=v,v}var dc=new Map,Dr=new Map;async function Fd(v){let k;for(let E=0;E<3;E++)try{let j=(await Dn.promises.stat(v)).mtime.getTime(),B=Dr.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 Dr.set(v,{content:z,mtime:V}),z}catch(T){k=T;break}throw Dr.delete(v),Error(`File not found: ${v}${k?` (${k.message})`:""}`)}function zd(v){Dr.delete(v)}function Hd(v){for(let _ of Dr.keys())if(_.startsWith(v))Dr.delete(_)}var Do=null,By=null,tf=null;function Ud(v){tf=v}async function uc(v=!1){let _=tf??await import("./chunk-knr41h7p.js");if(v)return _.generateSignalsRuntimeDev();if(Do===null)Do=_.generateSignalsRuntime();return Do}var Oo=null;async function pc(){if(Oo===null){let{getRouterScript:v}=await import("./chunk-6wpgxryt.js");Oo=v()}return Oo}var ef={};async function Vd(v,_=!1){let k=v==="runtime"?await uc(_):await pc(),E=v==="runtime"&&_?"runtime-debug":v,T=ef[E];if(!T||T.content!==k)T={content:k,hash:Bun.hash(k).toString(16).padStart(16,"0").slice(0,16)},ef[E]=T;return{content:k,hash:T.hash,url:`/_stx/${v}.${T.hash}.js`}}var zy=500,Ir=new Map;function nf(v){return a(process.cwd(),"module-bundles",`${v}.js`)}function Wd(v){let _=Bun.hash(v).toString(16).padStart(16,"0").slice(0,16),k=Ir.has(_);if(k)Ir.delete(_);Ir.set(_,v);while(Ir.size>zy)Ir.delete(Ir.keys().next().value);if(!k)try{let E=nf(_);if(!Dn.existsSync(E))Dn.mkdirSync(Pr.dirname(E),{recursive:!0}),Dn.writeFileSync(E,v)}catch{}return`/_stx/modules.${_}.js`}function Yo(v){if(!/^[0-9a-f]{16}$/.test(v))return;let _=Ir.get(v);if(_!==void 0)return _;try{return Dn.readFileSync(nf(v),"utf8")}catch{return}}function qd(){Dr.clear(),te(),td(),Do=null,By=null,Oo=null}function rf(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 sn(v,_){try{if(!_.cachePath)return null;let k=Pr.resolve(_.cachePath),E=Pr.join(k,`${Un(v)}.html`),T=Pr.join(k,`${Un(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!==je())return null;if(B.optionsSignature!==rf(_))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 on(v,_,k,E){try{if(!E.cachePath)return;let T=Pr.resolve(E.cachePath);await Dn.promises.mkdir(T,{recursive:!0});let j=Pr.join(T,`${Un(v)}.html`),B=Pr.join(T,`${Un(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:je(),optionsSignature:rf(E),generatedAt:Date.now()};await Bun.write(B,JSON.stringify(F,null,2)),dc.set(v,{output:_,mtime:z.mtime.getTime(),dependencies:k})}catch(T){console.warn(`Failed to cache template ${v}:`,T)}}var Wy=16;function Un(v){return new Bun.CryptoHasher("sha1").update(v).digest("hex").substring(0,Wy)}var Vn={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 tc(v){return`--stx-${v}`}function nc(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 sf(v){let _={};for(let[k,E]of Object.entries(Vn)){let T=nc(v,E.light);if(T===void 0)continue;_[k]=`var(${tc(k)}, ${T})`}return _}function of(v){let _=[],k=[];for(let[E,T]of Object.entries(Vn)){let j=nc(v,T.light),B=nc(v,T.dark);if(j===void 0)continue;if(_.push(` ${tc(E)}: ${j};`),B!==void 0)k.push(` ${tc(E)}: ${B};`)}if(_.length===0)return"";return["/* stx role tokens \u2014 override any of these to re-theme by meaning. */",":root {",..._,"}",".dark {",...k,"}",""].join(`
865
+ `}),cd(v,T)}function cd(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 dd(v){let _=Co(v),k=new Map;if(_)for(let[E,T]of _)k.set(E,T.instances);return k}function fd(v,_){let k=Co(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 pd(v,_){for(let{body:k,count:E}of _)for(let T=0;T<E;T++)Ua(v,k)}import Ed from"fs";var gd=0,Ha=new Map;function Ko(){gd=0,Ha.clear()}function Ro(v,_){let k=gd++,E=`<!--__STX_${v.toUpperCase()}_${k}__-->`;return Ha.set(E,{type:v,expression:_}),E}function Xo(){let v={};for(let[_,k]of Ha)v[_]={type:k.type,expression:k.expression};return v}function Jo(v,_){let k=v;for(let[E,T]of _)k=k.split(E).join(T);return k}function ns(v){return v.includes("<!--__STX_")}var my=/@(?=[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 hy(v){return Array.from({length:v},()=>"&#123;").join("&#8288;")}function md(v){return v.replace(/\{{2,}/g,(_)=>hy(_.length)).replace(/\{(?=!)/g,"&#123;&#8288;").replace(my,"&#64;")}function hd(v,_,k=!1){let E=v.slice(0,_),T=E.lastIndexOf("<"),j=E.lastIndexOf(">");if(T>=0&&j>T)return null;if(T<0&&!k)return null;let B=T>=0?E.slice(T+1):E;if(T>=0&&/^\s*[!/?]/.test(B))return/^\s*\/?\s*$/.test(B)?{kind:"tag-name"}:null;if(T>=0&&/^\s*$/.test(B))return{kind:"tag-name"};let z=/(?:^|\s)([^\s"'<>/=]+)\s*=\s*"([^"]*)$/.exec(B);if(z)return{kind:"attribute",name:z[1],quote:'"',valuePrefix:z[2]};let F=/(?:^|\s)([^\s"'<>/=]+)\s*=\s*'([^']*)$/.exec(B);if(F)return{kind:"attribute",name:F[1],quote:"'",valuePrefix:F[2]};let V=/(?:^|\s)([^\s"'<>/=]+)\s*=\s*([^\s"'=<>`]*)$/.exec(B);if(V)return{kind:"attribute",name:V[1],quote:null,valuePrefix:V[2]};return T>=0||/^\s*[^<>]*$/.test(B)?{kind:"tag"}:null}class or extends Error{attribute;constructor(v,_){super(`Unsafe interpolation in ${v}: ${_}`);this.name="UnsafeInterpolationContextError",this.attribute=v}}var yd="unsafe:";var yy=/^(?:javascript|vbscript|livescript|mocha|view-source):/,xy=/^data:(?:text\/html|text\/xml|application\/xhtml\+xml|application\/xml|image\/svg\+xml)/,by=/^data:(?:text\/html|application\/xhtml\+xml)/,vy=new RegExp("[\\u0000-\\u0020\\u00A0\\u1680\\u2000-\\u200F\\u2028\\u2029\\u202F\\u205F\\u3000\\uFEFF]+","g");function wy(v){return v.replace(vy,"").toLowerCase()}function qa(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 Ao(v,_="navigable"){let k=wy(v);if(yy.test(k))return!0;return _==="navigable"?xy.test(k):by.test(k)}function Ei(v,_="navigable"){return Ao(v,_)?"unsafe:"+v:v}function Sy(v){let _=v.match(/(?:^|[\s"'`/])([A-Za-z][\w:-]*)\s*=\s*(["'])([^"']*)$/);if(!_)return null;if(_[3].trim()!=="")return null;return qa(_[1])}function xd(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 bd(v,_,k=_){let E=Sy(v);return E&&Ao(_,E)?"unsafe:"+k:k}var To=/<script\b[^>]*>/iy,Ga=/<\/script\s*>/ig,Io=/<style\b[^>]*>/iy,Ja=/<\/style\s*>/ig;function vd(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 Z(v,_){return vd(v,_,To,Ga)}function Yr(v,_){return vd(v,_,Io,Ja)}function Fe(v,_){if(!v.startsWith("<!--",_))return-1;let k=v.indexOf("-->",_+4);if(k===-1)return-1;return k+3}function wd(v,_){if(v.startsWith("<!--",_)){let T=Fe(v,_);return T===-1?v.length:T}if(To.lastIndex=_,To.exec(v)?.index===_){Ga.lastIndex=To.lastIndex;let T=Ga.exec(v);return T?T.index+T[0].length:v.length}if(Io.lastIndex=_,Io.exec(v)?.index===_){Ja.lastIndex=Io.lastIndex;let T=Ja.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 H=v.indexOf("<",E+1);if(H===-1)break;E=H;continue}let F=_(v,E);if(F>E){k.push({start:E,end:F,token:v.slice(E,F)}),E=F;continue}let V=wd(v,E);if(V>E){E=V;continue}let U=v.charCodeAt(E+1);if(U>=65&&U<=90||U>=97&&U<=122)j=!0;E++}return k}function Sd(v){let _=0,k=0,E=0,T=!1,j=null;while(E<v.length){if(T){let H=v[E];if(j){if(H===j)j=null}else if(H==='"'||H==="'")j=H;else if(H===">")T=!1;E++;continue}let B=v.indexOf("<",E),z=B===-1?v.length:B;while(E<z){let H=v[E++];if(H==="{")_++;else if(H==="}")k++;if(_>=2&&k>=2)return!0}if(B===-1)break;let F=wd(v,B);if(F>B){E=F;continue}let V=v.charCodeAt(B+1),U=V===47?v.charCodeAt(B+2):V;if(U>=65&&U<=90||U>=97&&U<=122)T=!0;E=B+1}return!1}function $d(v,_){while(v.size>=_){let k=v.keys().next();if(k.done)return;v.delete(k.value)}}var $y=1024,_y=16777216,Gr=new Map,Ka=0;function ky(v,_){Gr.set(v,_),Ka+=v.length+_.output.length;for(let[k,E]of Gr){if(Ka<=_y)break;Gr.delete(k),Ka-=k.length+E.output.length}}function Pn(v,_,k,E){let T=E!==void 0&&v.length>=$y,j=T?`${E}\x00${v}`:"";if(T){let U=Gr.get(j);if(U)return Gr.delete(j),Gr.set(j,U),{output:U.output,tokens:U.tokens.slice()}}let B=gr(v,_);if(B.length===0)return{output:v,tokens:[]};let z=B.map((U)=>U.token),F="",V=0;for(let U=0;U<B.length;U++){let H=B[U];F+=v.slice(V,H.start),F+=k(H.token,U),V=H.end}if(F+=v.slice(V),T)return ky(j,{output:F,tokens:z}),{output:F,tokens:z.slice()};return{output:F,tokens:z}}var Ey=1024,Cy=16777216,Jr=new Map,Xa=0;function Ry(v,_){Jr.set(v,_),Xa+=v.length+_.output.length;for(let[k,E]of Jr){if(Xa<=Cy)break;Jr.delete(k),Xa-=k.length+E.output.length}}function Za(v,_,k){return{output:_,scripts:k,restore:(E)=>E===_?v:fs(E,k)}}function $n(v){let _=v.length>=Ey;if(_){let T=Jr.get(v);if(T)return Jr.delete(v),Jr.set(v,T),Za(v,T.output,T.scripts.slice())}let{output:k,tokens:E}=Pn(v,Z,(T,j)=>`\x00STX_SCRIPT_${j}\x00`);if(_)return Ry(v,{output:k,scripts:E}),Za(v,k,E.slice());return Za(v,k,E)}function fs(v,_){if(_.length===0)return v;return v.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(k,E)=>_[+E]??"")}function kt(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 Po(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 _d(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 kd(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 Ar(v,_){let k=v.trim().replace(/^\.\.\./,"").trim(),E=_d(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 Po(k.slice(1,-1))){let j=T.trim();if(!j)continue;if(j.startsWith("...")){Ar(j,_);continue}let B=_d(j,":");Ar(B===-1?j:j.slice(B+1),_)}return}if(k.startsWith("[")&&k.endsWith("]")){for(let T of Po(k.slice(1,-1)))Ar(T,_);return}if(/^[A-Z_$][\w$]*$/i.test(k))_.push(k)}function Es(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("(")&&kd(F)===F.length-1)F=F.slice(1,-1);for(let V of Po(F))Ar(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("(")&&kd(j)===j.length-1)j=j.slice(1,-1);let B=/^([\w$]+)\s*=>\s*([\s\S]+)$/.exec(j);if(B)Ar(B[2],k),Ar(B[1],k);else for(let z of Po(j))Ar(z,k)}return k}function Tr(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 Do="__stx_client_loop_names";function yr(v){let _=v?.[Do];return Array.isArray(_)?_:[]}var Ti={},Cd=new Map;function Ay(v){let _=Cd.get(v);if(!_){let k=v.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");_=new RegExp(`:${k}(?!\\w)`,"g"),Cd.set(v,_)}return _.lastIndex=0,_}var zn={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 Ct(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(Ay(F),String(V))}),z},t:(v,_,k={})=>zn.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 sc(v,_){if(v in zn)console.warn(`Filter "${v}" already exists as a built-in filter. Custom filter will take precedence.`);Ti[v]=_}function Md(v){for(let[_,k]of Object.entries(v))sc(_,k)}function oc(){return{...zn,...Ti}}function Nd(){for(let v of Object.keys(Ti))delete Ti[v]}function ic(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 Hn(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=ic(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 Ct(v){return md(b(v))}function Ty(v){return v.replace(/ /g,"&#32;").replace(/\t/g,"&#9;").replace(/\n/g,"&#10;").replace(/\r/g,"&#13;").replace(/\f/g,"&#12;").replace(/=/g,"&#61;").replace(/`/g,"&#96;")}function Iy(v){return v.replace(/\/\*[\s\S]*?\*\//g,"").replace(/\\([\dA-Fa-f]{1,6})\s?/g,(_,k)=>String.fromCodePoint(Number.parseInt(k,16))).replace(/\\([^\r\n])/g,"$1").replace(/[\u0000-\u0020]+/g,"").toLowerCase()}function Py(v,_){let k=Iy(v);if(/@import|expression\(|behavior:|-moz-binding|(?:image-set|cross-fade)\(/.test(k))throw new or(_,"network-capable or executable CSS is not allowed in an escaped interpolation");let E=/url\(([^)]*)\)/g,T;while((T=E.exec(k))!==null){let j=T[1].replace(/^["']|["']$/g,""),B=j.startsWith("/")&&!j.startsWith("//")||j.startsWith("./")||j.startsWith("../")||j.startsWith("#"),z=/^data:image\/(?:avif|bmp|gif|jpeg|jpg|png|webp);base64,[a-z\d+/=]+$/i.test(j);if(!B&&!z)throw new or(_,"CSS URLs must be local paths or base64 raster images")}}function Pd(v,_,k,E=!1,T=0){let j=hd(v,_,E),B=Ct(k);if(!j)return B;if(j.kind==="tag-name"){if(!/^[A-Za-z][A-Za-z0-9:-]*$/.test(k))throw new or("tag name","dynamic tag names may contain only letters, digits, colons, and hyphens");return k}if(j.kind==="tag"){let V=v.slice(_+T).trimStart(),U=k.trim();if(!V.startsWith("=")&&(U===""||/^(?!on)[A-Za-z_:][\w:.-]*(?:\s+(?!on)[A-Za-z_:][\w:.-]*)*$/.test(U)))return U;throw new or("tag structure","only standalone boolean attributes may be interpolated into tag structure")}let z=j.name.toLowerCase();if(/^on[a-z]/.test(z))throw new or(j.name,"native event-handler attributes execute JavaScript; use an @event binding instead");if(z==="srcdoc")B=Ct(B);if(z==="style")Py(k,j.name);if(j.quote===null)B=Ty(B);let F=qa(z);if(F&&j.valuePrefix.trim()===""&&Ao(k,F))return yd+B;return bd(xd(v,_),k,B)}function be(v,_){let{scripts:k}=$n(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(Sn(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 ac(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(Es(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 U=z.exec(v);U;U=z.exec(v)){if(U[2]==="/")continue;if(F+=U[1]==="/"?-1:1,F===0){V=U.index+U[0].length;break}}_.push({start:E.index,end:V,names:j})}return _}function Dy(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 Rd(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 U=E[V];if(!j&&U==="`"){j=!0,B=0;continue}if(j){if(U==="`"&&B===0){j=!1;continue}if(U==="$"&&E[V+1]==="{"){B++,V++,T+=" ";continue}if(U==="}"&&B>0){B--;continue}if(B>0){T+=U;continue}continue}T+=U}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 My(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 Ad=new Set;function Td(v){return/^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*)*$/.test(v.trim())}function Id(v,_){let k=`${_??"<unknown>"}\x00${v}`;if(process.env.STX_DEBUG||!Ad.has(k))Ad.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 rs(v,_,k){let E=v;return E=E.replace(/\{!!([\s\S]*?)!!\}/g,(T,j)=>{try{let B=x(j,_);if(B===void 0)return Td(j)?Id(j.trim(),k):T;return B===null?"":String(B)}catch{return T}}),E=Hn(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 Td(z)?Id(z,k):T;return JSON.stringify(F).replace(/</g,"\\u003c")}catch{return T}}),E}function cc(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=Hn(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 Pd(k,j,F,!0,E.length)}catch(z){if(z instanceof or)throw z;return E}}),k}function Ld(v,_,k={}){let{output:E,scripts:T}=$n(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 U=z[1],H=z[2];if(/\bdata-raw\b/.test(U))return B;if(k.skipServer&&/\bserver\b/.test(U))return B;let J=`<script${cc(U,_)}>`;if(/\bsrc\s*=/.test(U)||/\btype\s*=\s*["']application\/json["']/.test(U))return J+H+B.slice(V);return J+rs(H,_)+B.slice(V)});return fs(E,j)}function G(v,_,k){let E=v,T=(J,re)=>{let se=Yr(J,re);if(se===-1)return-1;return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(J.slice(re,se))?-1:se},j=(J,re,se,ie)=>{let ae=se.length,{output:ce,tokens:oe}=Pn(J,re,(pe,he)=>ie(ae+he));return se.push(...oe),ce},B=[];E=j(E,T,B,(J)=>`<!--__STX_STYLE_${J}__-->`);let z=[];E=j(E,Z,z,(J)=>`<!--__STX_SCRIPT_EXPR_${J}__-->`);let F=_?.__stx_signals_gate===!0||be(v),V=new Set(Array.isArray(_?.__stx_client_signal_names)?_.__stx_client_signal_names:[]),U=new Set(Array.isArray(_?.__stx_preserved_client_expressions)?_.__stx_preserved_client_expressions:[]);E=Hn(E,(J,re,se)=>{try{let ie=x(re,_,!1,(ae)=>Ya(ae,J,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,J)}},3),E=E.replace(/\{!!([\s\S]*?)!!\}/g,(J,re,se)=>{try{let ie=x(re,_,!1,(ae)=>Ya(ae,J,k,v));if(ie===void 0&&_.__stx_buildMode==="compile")return Ro("raw",re.trim());return ie!==void 0&&ie!==null?String(ie):""}catch(ie){if(_.__stx_buildMode==="compile")return Ro("raw",re.trim());let ae=ie instanceof Error?ie.message:String(ie);return g("Expression",`Error evaluating: {!! ${re.trim()} !!}: ${ae}`,k,v,se,J)}}),E=j(E,Z,z,(J)=>`<!--__STX_SCRIPT_EXPR_${J}__-->`),E=j(E,T,B,(J)=>`<!--__STX_STYLE_${J}__-->`);let H=F?ac(E):[],Y=new Set(yr(_));if(E=Hn(E,(J,re,se)=>{let ie=re.trim();if(Tr(ie,Y))return J;if(H.length>0&&Dy(H,se,ie))return J;if(U.has(ie))return J;let ae=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined"],ce=/^([a-zA-Z_$][a-zA-Z0-9_$]*)/,pe=ie.match(ce)?.[1],he=pe&&((pe in _)||ae.includes(pe)),xe=Boolean(pe&&V.has(pe)),$e=/^([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/,Re=ie.match($e),Ce=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(xe)return J;if(F&&!Rd(ie,_))return J;if(Ae)Ya(Ae,J,k,v);if(_.__stx_buildMode==="compile"&&!F&&(Te===void 0||My(ie,_)))return Ro("expr",ie);if(Te===void 0||Te===null)return"";let _e=String(Te);return Pd(E,se,_e,!1,J.length)}catch(Te){if(Te instanceof or)throw Te;if(xe)return J;if(F&&!Rd(ie,_))return J;if(Ce)return J;let _e=Te instanceof Error?Te.message:String(Te);return g("Expression",`Error evaluating: {{ ${ie} }}: ${_e}`,k,v,se,J)}}),z.length>0)E=E.replace(/<!--__STX_SCRIPT_EXPR_(\d+)__-->/g,(J,re)=>z[Number(re)]??J);if(B.length>0)E=E.replace(/<!--__STX_STYLE_(\d+)__-->/g,(J,re)=>B[Number(re)]??J);return E}function lc(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=Ti[B]||zn[B];if(!z)throw Error(`Filter not found: ${B}. Available filters: ${Object.keys(oc()).join(", ")}`);let F=[];if(T.startsWith(":")){let V=T.match(/^:([^|\s]+)/);if(V){let U=V[1].trim();try{let H=Number(U);F=[Number.isNaN(H)?U:H]}catch{F=[U]}T=T.substring(V[0].length).trim()}}else if(T.startsWith("(")){let V=1,U=1;while(V>0&&U<T.length){if(T[U]==="(")V++;if(T[U]===")")V--;U++}if(V===0){let H=T.substring(1,U-1).trim();if(H)try{if(H.startsWith("{")&&H.endsWith("}"))F=[x(`(${H})`,k,!0)];else{let Y=[],J="",re=null,se=0,ie=0,ae=0,ce=!1;for(let oe=0;oe<H.length;oe++){let pe=H[oe];if(ce){J+=pe,ce=!1;continue}if(pe==="\\"){J+=pe,ce=!0;continue}if(re){if(J+=pe,pe===re)re=null;continue}if(pe==='"'||pe==="'"||pe==="`"){re=pe,J+=pe;continue}if(pe==="(")se++;else if(pe===")")se--;else if(pe==="[")ie++;else if(pe==="]")ie--;else if(pe==="{")ae++;else if(pe==="}")ae--;if(pe===","&&se===0&&ie===0&&ae===0){Y.push(J),J="";continue}J+=pe}if(J)Y.push(J);F=Y.map((oe)=>{let pe=oe.trim();return x(pe,k,!0)})}}catch{F=[H]}T=T.substring(U).trim()}}try{E=z(E,k,...F)}catch(V){let U=V instanceof Error?V.message:String(V);throw Error(`Error applying filter '${B}': ${U}`)}if(T.startsWith("|"))T=T.substring(1).trim();else break}return E}function Oy(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 U=1;z+=2;while(z<v.length&&U>0){if(v[z]==="{")U++;else if(v[z]==="}")U--;if(U>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 Ci=new Set,Ny=1000;function jd(){Ci.clear()}function Ya(v,_,k,E){if(!D())return;let T=`${k}\x00${v.expression}`;if(Ci.has(T))return;if(Ci.size>=Ny)Ci.clear();Ci.add(T);let j=k,B=E;try{if(k&&Ed.existsSync(k))B=Ed.readFileSync(k,"utf8")}catch{}let z=B.indexOf(_);if(z>=0)j=`${k}:${B.slice(0,z).split(`
866
+ `).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=Oy(T);if(j>0){let z=T.substring(0,j).trim(),F=T.substring(j+1).trim(),V=x(z,_,!0,E);return lc(V,F,_)}let B=vn(T);if(B!==null){E?.({expression:T,rule:B});return}try{let z=Object.keys(_),F=Object.values(_);return c(T,z)(...F)}catch{return l(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=jy(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 jy(v,_){let k=null;for(let T of _){if(T===v)continue;let j=Ly(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 Ly(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 Bd(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 aS from"fs";import Qt from"path";import Wi from"fs";import Dt from"path";import{hasLocalConfig as Ef}from"bunfig";import Dn from"fs";import Pr from"path";import Qa from"fs";import Od from"path";import{fileURLToPath as By}from"url";var ec;function je(){if(ec)return ec;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 _=Od.dirname(By(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(Od.join(E.parentPath,E.name)).mtimeMs);v+=`+src.${Math.trunc(k)}`}catch{}return ec=v,v}var dc=new Map,Dr=new Map;async function Fd(v){let k;for(let E=0;E<3;E++)try{let j=(await Dn.promises.stat(v)).mtime.getTime(),B=Dr.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 Dr.set(v,{content:z,mtime:V}),z}catch(T){k=T;break}throw Dr.delete(v),Error(`File not found: ${v}${k?` (${k.message})`:""}`)}function zd(v){Dr.delete(v)}function Hd(v){for(let _ of Dr.keys())if(_.startsWith(v))Dr.delete(_)}var Mo=null,zy=null,tf=null;function Ud(v){tf=v}async function uc(v=!1){let _=tf??await import("./chunk-knr41h7p.js");if(v)return _.generateSignalsRuntimeDev();if(Mo===null)Mo=_.generateSignalsRuntime();return Mo}var Oo=null;async function pc(){if(Oo===null){let{getRouterScript:v}=await import("./chunk-6wpgxryt.js");Oo=v()}return Oo}var ef={};async function Vd(v,_=!1){let k=v==="runtime"?await uc(_):await pc(),E=v==="runtime"&&_?"runtime-debug":v,T=ef[E];if(!T||T.content!==k)T={content:k,hash:Bun.hash(k).toString(16).padStart(16,"0").slice(0,16)},ef[E]=T;return{content:k,hash:T.hash,url:`/_stx/${v}.${T.hash}.js`}}var Wy=500,Ir=new Map;function nf(v){return a(process.cwd(),"module-bundles",`${v}.js`)}function Wd(v){let _=Bun.hash(v).toString(16).padStart(16,"0").slice(0,16),k=Ir.has(_);if(k)Ir.delete(_);Ir.set(_,v);while(Ir.size>Wy)Ir.delete(Ir.keys().next().value);if(!k)try{let E=nf(_);if(!Dn.existsSync(E))Dn.mkdirSync(Pr.dirname(E),{recursive:!0}),Dn.writeFileSync(E,v)}catch{}return`/_stx/modules.${_}.js`}function Yo(v){if(!/^[0-9a-f]{16}$/.test(v))return;let _=Ir.get(v);if(_!==void 0)return _;try{return Dn.readFileSync(nf(v),"utf8")}catch{return}}function qd(){Dr.clear(),te(),td(),Mo=null,zy=null,Oo=null}function rf(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 sn(v,_){try{if(!_.cachePath)return null;let k=Pr.resolve(_.cachePath),E=Pr.join(k,`${Un(v)}.html`),T=Pr.join(k,`${Un(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!==je())return null;if(B.optionsSignature!==rf(_))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 on(v,_,k,E){try{if(!E.cachePath)return;let T=Pr.resolve(E.cachePath);await Dn.promises.mkdir(T,{recursive:!0});let j=Pr.join(T,`${Un(v)}.html`),B=Pr.join(T,`${Un(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:je(),optionsSignature:rf(E),generatedAt:Date.now()};await Bun.write(B,JSON.stringify(F,null,2)),dc.set(v,{output:_,mtime:z.mtime.getTime(),dependencies:k})}catch(T){console.warn(`Failed to cache template ${v}:`,T)}}var Fy=16;function Un(v){return new Bun.CryptoHasher("sha1").update(v).digest("hex").substring(0,Fy)}var Vn={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 tc(v){return`--stx-${v}`}function nc(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 sf(v){let _={};for(let[k,E]of Object.entries(Vn)){let T=nc(v,E.light);if(T===void 0)continue;_[k]=`var(${tc(k)}, ${T})`}return _}function of(v){let _=[],k=[];for(let[E,T]of Object.entries(Vn)){let j=nc(v,T.light),B=nc(v,T.dark);if(j===void 0)continue;if(_.push(` ${tc(E)}: ${j};`),B!==void 0)k.push(` ${tc(E)}: ${B};`)}if(_.length===0)return"";return["/* stx role tokens \u2014 override any of these to re-theme by meaning. */",":root {",..._,"}",".dark {",...k,"}",""].join(`
867
867
  `)}var af={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 cf(v){return`--stx-radius-${v}`}function lf(){let v={};for(let[_,k]of Object.entries(af))v[_]=`var(${cf(_)}, ${k.value})`;return v}function uf(){return["/* stx shape tokens \u2014 a radius by what the thing is. */",":root {",...Object.entries(af).map(([v,_])=>` ${cf(v)}: ${_.value};`),"}",""].join(`
868
- `)}var df={"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"}},Fy={"control-x":"control-px","control-y":"control-py","cell-x":"cell-px","cell-y":"cell-py","cell-head-y":"cell-head-py"},Vy={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 ff(v){return`--stx-${v}`}function Wc(v){let _=df[v];if(!_)throw Error(`[stx] unknown density token "${v}"`);return`var(${ff(v)}, ${_.value})`}function pf(){let v={};for(let[_,k]of Object.entries(Fy))v[_]=Wc(k);return v}function gf(){let v={};for(let[_,{size:k,leading:E}]of Object.entries(Vy))v[_]=[Wc(k),{lineHeight:Wc(E)}];return v}function mf(){return["/* stx density tokens \u2014 how much room a control or a table cell takes. */",":root {",...Object.entries(df).map(([v,_])=>` ${ff(v)}: ${_.value};`),"}",""].join(`
868
+ `)}var df={"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"}},Vy={"control-x":"control-px","control-y":"control-py","cell-x":"cell-px","cell-y":"cell-py","cell-head-y":"cell-head-py"},Uy={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 ff(v){return`--stx-${v}`}function Wc(v){let _=df[v];if(!_)throw Error(`[stx] unknown density token "${v}"`);return`var(${ff(v)}, ${_.value})`}function pf(){let v={};for(let[_,k]of Object.entries(Vy))v[_]=Wc(k);return v}function gf(){let v={};for(let[_,{size:k,leading:E}]of Object.entries(Uy))v[_]=[Wc(k),{lineHeight:Wc(E)}];return v}function mf(){return["/* stx density tokens \u2014 how much room a control or a table cell takes. */",":root {",...Object.entries(df).map(([v,_])=>` ${ff(v)}: ${_.value};`),"}",""].join(`
869
869
  `)}function hf(v){return typeof v==="object"&&v!==null&&!Array.isArray(v)}function Vc(v,_){let k={...v};for(let[E,T]of Object.entries(_))k[E]=hf(T)&&hf(k[E])?Vc(k[E],T):T;return k}function yf(v,_){if(!_.fonts)return"";let k=new v({..._.config,fonts:_.fonts,cssVariables:!1}).toCSS(!1,_.minify);return k&&!_.minify?`${k}
870
870
  `:k}function xf(v={},_={}){let k=v.theme||{},E=_.theme||{},{extend:T,...j}=E,{extend:B,...z}=k,F=z.colors||{};z.colors={...F,...sf(F)};let V=z.borderRadius||{};z.borderRadius={...V,...lf()};let U=z.spacing||{};z.spacing={...U,...pf()};let H=z.fontSize||{};z.fontSize={...H,...gf()};let Y=Vc(z,j),J=Vc(B||{},T||{});if(Object.keys(J).length>0)Y.extend=J;let re=[...v.safelist||[],..._.safelist||[]],se={...v.shortcuts||{},..._.shortcuts||{}},ie=[...v.preflights||[],..._.preflights||[]],{fonts:ae,...ce}=v,{fonts:oe,...pe}=_,he=oe??ae;return{config:{...ce,...pe,theme:Y,safelist:re,shortcuts:se,...ie.length>0?{preflights:ie}:{},content:[],output:""},safelist:re,shortcuts:se,includePreflight:_.preflight!==!1,minify:_.minify===!0,tokenCSS:of(F)+uf()+mf(),...he?{fonts:he}:{}}}function bf(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 vf(v,_,k={}){let{prefix:E="",preserveHost:T=!0,scopeKeyframes:j=!0,scopeCustomProperties:B=!1}=k;if(!v.trim())return"";let z=Uc(v),F=[],V=new Map;if(j)for(let U of z){let H=U.selector.match(/@keyframes\s+([a-z_-][a-z0-9_-]*)/i);if(H){let Y=H[1],J=`${_}_${Y}`;V.set(Y,J)}}for(let U of z){let H=wf(U,_,E,T,V,B);F.push(H)}return F.join(`
871
871
 
@@ -873,19 +873,19 @@ ${j.map(([U,H])=>` try { factories[${JSON.stringify(U)}] = factories[${JSON.str
873
873
  `)})}else _.push({selector:`@${U} ${H.trim()}`,declarations:Y.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 wf(v,_,k,E,T,j){let{selector:B,declarations:z}=v;if(B.startsWith("@")){if(B.startsWith("@keyframes")){let U=B.replace("@keyframes ","").trim();return`@keyframes ${T.get(U)||U} { ${z} }`}if(B.startsWith("@media")||B.startsWith("@supports")||B.startsWith("@container")){let H=Uc(`x { ${z} }`.replace(/x \{ /,"").replace(/ \}$/,"")).map((Y)=>wf(Y,_,k,E,T,j)).join(`
874
874
  `);return`${B} {
875
875
  ${H}
876
- }`}return`${B} { ${z} }`}let F=Uy(B,_,k,E),V=z;for(let[U,H]of T)V=V.replace(new RegExp(`\\b${U}\\b`,"g"),H);if(j)V=V.replace(/--([a-z-]+)/gi,`--${_}-$1`);return`${F} { ${V} }`}function Uy(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=Hy(B,_);if(F)j.push(k?`${k} ${F}`:F)}return j.join(", ")}function Hy(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 _f=String.raw`(?<![\w-])scoped(?![\w-])`,Hc=/<style\s+([^>]*)>/gi,Sf=/<style\s+([^>]*)>([\s\S]*?)<\/style>/gi,kf=new RegExp(_f,"i"),qy=new RegExp(_f,"gi"),qc=/<style\b[^>]*\bdata-stx-scoped(?:=(?:"[^"]*"|'[^']*'|[^\s>]+))?[^>]*>[\s\S]*?<\/style>\s*/gi;function Ky(v){Hc.lastIndex=0;let _=Hc.exec(v);while(_!==null){if(kf.test(_[1]))return!0;_=Hc.exec(v)}return!1}function Kc(v){let _=new Set,k=[];qc.lastIndex=0;let E=qc.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=qc.exec(v)}return k}function Di(v){let _=Kc(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 Mo(v,_){if(!Ky(v))return{html:v,hasScoped:!1};let k=bf(_),E=`data-v-${k}`,T=v,j=!1;if(Sf.lastIndex=0,T=T.replace(Sf,(B,z,F)=>{if(!kf.test(z))return B;j=!0;let V=Xy(F,E),U=z.replace(qy,"").trim(),H=U?` ${U}`:"";return`<style data-stx-scoped="${k}"${H}>${V}</style>`}),!j)return{html:v,hasScoped:!1};return T=Gy(T,E),{html:T,hasScoped:!0}}function Xy(v,_){return vf(v,"__SCOPE_PLACEHOLDER__",{preserveHost:!1}).replace(/\.(__SCOPE_PLACEHOLDER__) /g,`[${_}] `).replace(/\.(__SCOPE_PLACEHOLDER__)/g,`[${_}]`)}var Zy=(v)=>`\x00stx-scope-mask-${v}\x00`,$f=/\u0000stx-scope-mask-(\d+)\u0000/g;function Gy(v,_){let k=Pn(v,(T,j)=>{let B=Z(T,j);return B>j?B:Yr(T,j)},(T,j)=>Zy(j)),E=Jy(k.output,_);return $f.lastIndex=0,E.replace($f,(T,j)=>k.tokens[Number(j)])}function Jy(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,No="";function Cf(v){try{let _=v.startsWith("file:")?new URL(v).pathname:v;No=`${_}@${Math.trunc(Wi.statSync(_).mtimeMs)}`}catch{No=v}}var Zc=!1,Or=null,zi="",Ts=!1,Tf=256,xr=new Map,Mn=new Map,jo=null,If=null,Lo=new Map;function Bo(v){return Bun.hash(v).toString(16).padStart(16,"0").slice(0,16)}function Xc(v,_){if(xr.has(v))xr.delete(v);else if(xr.size>=Tf)xr.delete(xr.keys().next().value);xr.set(v,_)}function Yy(v){let _=Bo(v);if(Mn.has(_))Mn.delete(_);else if(Mn.size>=Tf)Mn.delete(Mn.keys().next().value);return Mn.set(_,v),_}function Gd(v){let _=Mn.get(v);if(_===void 0)return;return Mn.delete(v),Mn.set(v,_),_}async function Qy(v,_=jo){if(!_)return null;try{let k=Bun.file(Dt.join(_,`cw-${Bo(v)}.css`));if(!await k.exists())return null;return await k.text()}catch{return null}}async function ex(v,_,k=jo){if(!k)return;try{if(!Wi.existsSync(k))Wi.mkdirSync(k,{recursive:!0});await Bun.write(Dt.join(k,`cw-${Bo(v)}.css`),_)}catch{}}async function Rf(v){try{let _=await import(v);if(_&&_.CSSGenerator)return{CSSGenerator:_.CSSGenerator,config:_.config,build:_.build,defaultConfig:_.defaultConfig,extractClasses:_.extractClasses}}catch{}return null}var tx=[["@stacksjs","ts-css","dist","engine","index.js"],["@stacksjs","ts-css","src","engine","index.ts"]],nx=["@stacksjs/ts-css/engine","@stacksjs/ts-css/dist/engine/index.js"];function rx(){let v=[],_=process.cwd();while(_!==Dt.dirname(_)){for(let k of["node_modules","pantry"])for(let E of tx)v.push(Dt.join(_,k,...E));_=Dt.dirname(_)}return v}function sx(){let v=[],_=process.env.HOME||process.env.USERPROFILE||"",k=[_&&Dt.join(_,"Code","Tools","ts-css"),_&&Dt.join(_,"Code","Tools","crosswind"),_&&Dt.join(_,"repos","stacks-org","ts-css"),_&&Dt.join(_,"repos","stacks-org","crosswind"),Dt.join(process.cwd(),"..","ts-css"),Dt.join(process.cwd(),"..","crosswind")].filter(Boolean);for(let E of k)v.push(Dt.join(E,"packages","toolkit","dist","engine","index.js")),v.push(Dt.join(E,"packages","toolkit","src","engine","index.ts"));if(_)v.push(Dt.join(_,"Code","Tools","stx","node_modules","@stacksjs","ts-css","dist","engine","index.js"));return v}async function Zo(){if(Zc)return On;Zc=!0;try{let v=async(T)=>{for(let j of T){if(!await Bun.file(j).exists())continue;let B=await Rf(j);if(B){if(Cf(j),!process.env.STACKS_DEV_QUIET)console.log(`${e.green}[ts-css]${e.reset} CSS engine loaded from ${Dt.dirname(Dt.dirname(j))}`);return B}}return null};if(process.env.CROSSWIND_SRC){let T=Dt.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(rx());if(_)return On=_,On;let k=nx;for(let T of k){let j=await Rf(T);if(j){On=j;try{Cf(import.meta.resolve(T))}catch{No=T}if(!process.env.STACKS_DEV_QUIET)console.log(`${e.green}[ts-css]${e.reset} CSS engine loaded`);return On}}let E=await v(sx());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 Kd(){Gc.clear(),On=null,Zc=!1,Or=null,zi="",xr.clear(),Mn.clear(),If=null,Lo.clear()}var Af=!1;async function Qo(v){try{let _=Ef({name:"css",cwd:v})?"css":Ef({name:"crosswind",cwd:v})?"crosswind":null;if(!_)return null;if(_==="crosswind"&&!process.env.STACKS_DEV_QUIET&&!Af)Af=!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=Dt.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 fc(v){let _=null;try{let{loadStxConfig:k}=await import("./chunk-ptj7fwre.js"),E=await k(v);if(E.css)if(typeof E.css==="string"){let T=Dt.isAbsolute(E.css)?E.css:Dt.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=Dt.isAbsolute(E.css.config)?E.css.config:Dt.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 Qo(v)}function gc(v){try{let _=new WeakSet;return Bo(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 Et(v){if(Ts)return zi;Ts=!0;try{let _=await Zo();if(!_||!_.build)return Ts=!1,"";if(!Or)Or=await Qo(v);if(!Or)return Ts=!1,"";let k=_.defaultConfig?.theme||{},E=Or.theme||{},T={..._.defaultConfig,...Or,theme:{...k,...E,extend:{...k.extend||{},...E.extend||{}}}},j=performance.now(),B=await _.build(T),z=performance.now()-j;if(zi=B.css,console.log(`${e.cyan}[ts-css]${e.reset} Built ${B.classes.size} classes in ${z.toFixed(1)}ms`),T.output){let F=Dt.isAbsolute(T.output)?T.output:Dt.join(v,T.output),V=Dt.dirname(F);if(!Wi.existsSync(V))Wi.mkdirSync(V,{recursive:!0});await Bun.write(F,B.css)}return Ts=!1,B.css}catch(_){return console.error(`${e.red}[ts-css]${e.reset} Build error:`,_),Ts=!1,zi}}async function an(v){Or=null,await Et(v)}function Xd(){return zi}function mc(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 Gc=m(64);async function hc(v,_){let k=()=>Lo.get(_?Dt.resolve(_):process.cwd())?.fingerprint??null,E=Gc.get(h(v,_,k()));if(E!==void 0)return E;let T=await ix(v,_);if(T)Gc.set(h(v,_,k()),T);return T}function yc(v){let _=[],k=new Set;for(let E of v.matchAll(/\/_stx\/modules\.([0-9a-f]{16})\.js/g)){let T=E[1];if(k.has(T))continue;k.add(T);let j=Yo(T);if(j)_.push(j)}return _.length?`${v}
876
+ }`}return`${B} { ${z} }`}let F=Hy(B,_,k,E),V=z;for(let[U,H]of T)V=V.replace(new RegExp(`\\b${U}\\b`,"g"),H);if(j)V=V.replace(/--([a-z-]+)/gi,`--${_}-$1`);return`${F} { ${V} }`}function Hy(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=qy(B,_);if(F)j.push(k?`${k} ${F}`:F)}return j.join(", ")}function qy(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 _f=String.raw`(?<![\w-])scoped(?![\w-])`,Hc=/<style\s+([^>]*)>/gi,Sf=/<style\s+([^>]*)>([\s\S]*?)<\/style>/gi,kf=new RegExp(_f,"i"),Ky=new RegExp(_f,"gi"),qc=/<style\b[^>]*\bdata-stx-scoped(?:=(?:"[^"]*"|'[^']*'|[^\s>]+))?[^>]*>[\s\S]*?<\/style>\s*/gi;function Xy(v){Hc.lastIndex=0;let _=Hc.exec(v);while(_!==null){if(kf.test(_[1]))return!0;_=Hc.exec(v)}return!1}function Kc(v){let _=new Set,k=[];qc.lastIndex=0;let E=qc.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=qc.exec(v)}return k}function Di(v){let _=Kc(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 No(v,_){if(!Xy(v))return{html:v,hasScoped:!1};let k=bf(_),E=`data-v-${k}`,T=v,j=!1;if(Sf.lastIndex=0,T=T.replace(Sf,(B,z,F)=>{if(!kf.test(z))return B;j=!0;let V=Zy(F,E),U=z.replace(Ky,"").trim(),H=U?` ${U}`:"";return`<style data-stx-scoped="${k}"${H}>${V}</style>`}),!j)return{html:v,hasScoped:!1};return T=Jy(T,E),{html:T,hasScoped:!0}}function Zy(v,_){return vf(v,"__SCOPE_PLACEHOLDER__",{preserveHost:!1}).replace(/\.(__SCOPE_PLACEHOLDER__) /g,`[${_}] `).replace(/\.(__SCOPE_PLACEHOLDER__)/g,`[${_}]`)}var Gy=(v)=>`\x00stx-scope-mask-${v}\x00`,$f=/\u0000stx-scope-mask-(\d+)\u0000/g;function Jy(v,_){let k=Pn(v,(T,j)=>{let B=Z(T,j);return B>j?B:Yr(T,j)},(T,j)=>Gy(j)),E=Yy(k.output,_);return $f.lastIndex=0,E.replace($f,(T,j)=>k.tokens[Number(j)])}function Yy(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 Mn=null,jo="";function Cf(v){try{let _=v.startsWith("file:")?new URL(v).pathname:v;jo=`${_}@${Math.trunc(Wi.statSync(_).mtimeMs)}`}catch{jo=v}}var Zc=!1,Mr=null,zi="",Ts=!1,Tf=256,xr=new Map,On=new Map,Lo=null,If=null,Bo=new Map;function zo(v){return Bun.hash(v).toString(16).padStart(16,"0").slice(0,16)}function Xc(v,_){if(xr.has(v))xr.delete(v);else if(xr.size>=Tf)xr.delete(xr.keys().next().value);xr.set(v,_)}function Qy(v){let _=zo(v);if(On.has(_))On.delete(_);else if(On.size>=Tf)On.delete(On.keys().next().value);return On.set(_,v),_}function Gd(v){let _=On.get(v);if(_===void 0)return;return On.delete(v),On.set(v,_),_}async function ex(v,_=Lo){if(!_)return null;try{let k=Bun.file(Dt.join(_,`cw-${zo(v)}.css`));if(!await k.exists())return null;return await k.text()}catch{return null}}async function tx(v,_,k=Lo){if(!k)return;try{if(!Wi.existsSync(k))Wi.mkdirSync(k,{recursive:!0});await Bun.write(Dt.join(k,`cw-${zo(v)}.css`),_)}catch{}}async function Rf(v){try{let _=await import(v);if(_&&_.CSSGenerator)return{CSSGenerator:_.CSSGenerator,config:_.config,build:_.build,defaultConfig:_.defaultConfig,extractClasses:_.extractClasses}}catch{}return null}var nx=[["@stacksjs","ts-css","dist","engine","index.js"],["@stacksjs","ts-css","src","engine","index.ts"]],rx=["@stacksjs/ts-css/engine","@stacksjs/ts-css/dist/engine/index.js"];function sx(){let v=[],_=process.cwd();while(_!==Dt.dirname(_)){for(let k of["node_modules","pantry"])for(let E of nx)v.push(Dt.join(_,k,...E));_=Dt.dirname(_)}return v}function ix(){let v=[],_=process.env.HOME||process.env.USERPROFILE||"",k=[_&&Dt.join(_,"Code","Tools","ts-css"),_&&Dt.join(_,"Code","Tools","crosswind"),_&&Dt.join(_,"repos","stacks-org","ts-css"),_&&Dt.join(_,"repos","stacks-org","crosswind"),Dt.join(process.cwd(),"..","ts-css"),Dt.join(process.cwd(),"..","crosswind")].filter(Boolean);for(let E of k)v.push(Dt.join(E,"packages","toolkit","dist","engine","index.js")),v.push(Dt.join(E,"packages","toolkit","src","engine","index.ts"));if(_)v.push(Dt.join(_,"Code","Tools","stx","node_modules","@stacksjs","ts-css","dist","engine","index.js"));return v}async function Zo(){if(Zc)return Mn;Zc=!0;try{let v=async(T)=>{for(let j of T){if(!await Bun.file(j).exists())continue;let B=await Rf(j);if(B){if(Cf(j),!process.env.STACKS_DEV_QUIET)console.log(`${e.green}[ts-css]${e.reset} CSS engine loaded from ${Dt.dirname(Dt.dirname(j))}`);return B}}return null};if(process.env.CROSSWIND_SRC){let T=Dt.resolve(process.env.CROSSWIND_SRC),j=await v([T]);if(!j)throw Error(`CROSSWIND_SRC did not resolve to a Css module: ${T}`);return Mn=j,Mn}let _=await v(sx());if(_)return Mn=_,Mn;let k=rx;for(let T of k){let j=await Rf(T);if(j){Mn=j;try{Cf(import.meta.resolve(T))}catch{jo=T}if(!process.env.STACKS_DEV_QUIET)console.log(`${e.green}[ts-css]${e.reset} CSS engine loaded`);return Mn}}let E=await v(ix());if(E)return Mn=E,Mn;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 Kd(){Gc.clear(),Mn=null,Zc=!1,Mr=null,zi="",xr.clear(),On.clear(),If=null,Bo.clear()}var Af=!1;async function Qo(v){try{let _=Ef({name:"css",cwd:v})?"css":Ef({name:"crosswind",cwd:v})?"crosswind":null;if(!_)return null;if(_==="crosswind"&&!process.env.STACKS_DEV_QUIET&&!Af)Af=!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=Dt.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 fc(v){let _=null;try{let{loadStxConfig:k}=await import("./chunk-se734zc5.js"),E=await k(v);if(E.css)if(typeof E.css==="string"){let T=Dt.isAbsolute(E.css)?E.css:Dt.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=Dt.isAbsolute(E.css.config)?E.css.config:Dt.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 Qo(v)}function gc(v){try{let _=new WeakSet;return zo(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 Et(v){if(Ts)return zi;Ts=!0;try{let _=await Zo();if(!_||!_.build)return Ts=!1,"";if(!Mr)Mr=await Qo(v);if(!Mr)return Ts=!1,"";let k=_.defaultConfig?.theme||{},E=Mr.theme||{},T={..._.defaultConfig,...Mr,theme:{...k,...E,extend:{...k.extend||{},...E.extend||{}}}},j=performance.now(),B=await _.build(T),z=performance.now()-j;if(zi=B.css,console.log(`${e.cyan}[ts-css]${e.reset} Built ${B.classes.size} classes in ${z.toFixed(1)}ms`),T.output){let F=Dt.isAbsolute(T.output)?T.output:Dt.join(v,T.output),V=Dt.dirname(F);if(!Wi.existsSync(V))Wi.mkdirSync(V,{recursive:!0});await Bun.write(F,B.css)}return Ts=!1,B.css}catch(_){return console.error(`${e.red}[ts-css]${e.reset} Build error:`,_),Ts=!1,zi}}async function an(v){Mr=null,await Et(v)}function Xd(){return zi}function mc(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 Gc=m(64);async function hc(v,_){let k=()=>Bo.get(_?Dt.resolve(_):process.cwd())?.fingerprint??null,E=Gc.get(h(v,_,k()));if(E!==void 0)return E;let T=await ox(v,_);if(T)Gc.set(h(v,_,k()),T);return T}function yc(v){let _=[],k=new Set;for(let E of v.matchAll(/\/_stx\/modules\.([0-9a-f]{16})\.js/g)){let T=E[1];if(k.has(T))continue;k.add(T);let j=Yo(T);if(j)_.push(j)}return _.length?`${v}
877
877
  ${_.join(`
878
- `)}`:v}async function ix(v,_){try{let k=await Zo();if(!k)return"";let E=yc(v),T=typeof k.extractClasses==="function"?k.extractClasses(E):mc(E);if(T.size===0)return"";let j=_?Dt.resolve(_):process.cwd(),B=a(j,"cache");if(!jo)jo=B;let z=Lo.get(j);if(!z){let Ce=await fc(j);z={config:Ce,fingerprint:gc(Ce)},Lo.set(j,z),If=z.fingerprint}let F=[...T].sort().join(" "),V=`${No}::${z.fingerprint||"default"}::${F}`,U=xr.get(V);if(U!==void 0)return Xc(V,U),U;let H=await Qy(V,B);if(H!==null)return Xc(V,H),H;let Y=k.defaultConfig||k.config,J=z.config||{},re=xf(Y,J),{safelist:se,includePreflight:ie,minify:ae,tokenCSS:ce}=re,oe=re.config,pe=new k.CSSGenerator(oe),he=oe.shortcuts||J.shortcuts||{},xe=Object.keys(he).filter((Ce)=>T.has(Ce)||se.includes(Ce));for(let Ce of se)if(!he[Ce])pe.generate(Ce);for(let Ce of T)if(!he[Ce])pe.generate(Ce);let $e="";if(xe.length>0){let Ce=new k.CSSGenerator(oe);for(let Ae of xe)Ce.generate(Ae);if($e=Ce.toCSS(!1,ae),$e&&!$e.endsWith(`
878
+ `)}`:v}async function ox(v,_){try{let k=await Zo();if(!k)return"";let E=yc(v),T=typeof k.extractClasses==="function"?k.extractClasses(E):mc(E);if(T.size===0)return"";let j=_?Dt.resolve(_):process.cwd(),B=a(j,"cache");if(!Lo)Lo=B;let z=Bo.get(j);if(!z){let Ce=await fc(j);z={config:Ce,fingerprint:gc(Ce)},Bo.set(j,z),If=z.fingerprint}let F=[...T].sort().join(" "),V=`${jo}::${z.fingerprint||"default"}::${F}`,U=xr.get(V);if(U!==void 0)return Xc(V,U),U;let H=await ex(V,B);if(H!==null)return Xc(V,H),H;let Y=k.defaultConfig||k.config,J=z.config||{},re=xf(Y,J),{safelist:se,includePreflight:ie,minify:ae,tokenCSS:ce}=re,oe=re.config,pe=new k.CSSGenerator(oe),he=oe.shortcuts||J.shortcuts||{},xe=Object.keys(he).filter((Ce)=>T.has(Ce)||se.includes(Ce));for(let Ce of se)if(!he[Ce])pe.generate(Ce);for(let Ce of T)if(!he[Ce])pe.generate(Ce);let $e="";if(xe.length>0){let Ce=new k.CSSGenerator(oe);for(let Ae of xe)Ce.generate(Ae);if($e=Ce.toCSS(!1,ae),$e&&!$e.endsWith(`
879
879
  `))$e+=`
880
- `}let Re=$e+pe.toCSS(ie,ae);return Re=yf(k.CSSGenerator,re)+ce+Re,Xc(V,Re),ex(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 hc(v,_);if(!T)return E?Di(v):v;let j=k?`<link data-css="generated" rel="stylesheet" href="/_stx/css.${Yy(T)}.css">`:`<style data-css="generated">
880
+ `}let Re=$e+pe.toCSS(ie,ae);return Re=yf(k.CSSGenerator,re)+ce+Re,Xc(V,Re),tx(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 hc(v,_);if(!T)return E?Di(v):v;let j=k?`<link data-css="generated" rel="stylesheet" href="/_stx/css.${Qy(T)}.css">`:`<style data-css="generated">
881
881
  ${T}
882
- </style>`;if(E)return ox(v,j);let B=/(?:<style\b[^>]*\bdata-css=(?:"generated"|'generated')[^>]*>[\s\S]*?<\/style>|<link\b[^>]*\bdata-css=(?:"generated"|'generated')[^>]*>)/g;if(B.test(v)){let z=!1;return v.replace(B,()=>{if(z)return"";return z=!0,j})}if(v.includes("</head>"))return v.replace("</head>",`${j}
882
+ </style>`;if(E)return ax(v,j);let B=/(?:<style\b[^>]*\bdata-css=(?:"generated"|'generated')[^>]*>[\s\S]*?<\/style>|<link\b[^>]*\bdata-css=(?:"generated"|'generated')[^>]*>)/g;if(B.test(v)){let z=!1;return v.replace(B,()=>{if(z)return"";return z=!0,j})}if(v.includes("</head>"))return v.replace("</head>",`${j}
883
883
  </head>`);if(v.includes("<body"))return v.replace(/<body([^>]*)>/,`<body$1>
884
- ${j}`);return j+v}function ox(v,_){let k=Kc(v).map((F)=>({...F,replacement:""})),E=/(?:<style\b[^>]*\bdata-css=(?:"generated"|'generated')[^>]*>[\s\S]*?<\/style>|<link\b[^>]*\bdata-css=(?:"generated"|'generated')[^>]*>)/g,T=E.exec(v);if(T!==null){let F=!0;while(T!==null)k.push({start:T.index,end:T.index+T[0].length,replacement:F?_:""}),F=!1,T=E.exec(v)}else{let F=v.indexOf("</head>");if(F!==-1)k.push({start:F,end:F,replacement:`${_}
884
+ ${j}`);return j+v}function ax(v,_){let k=Kc(v).map((F)=>({...F,replacement:""})),E=/(?:<style\b[^>]*\bdata-css=(?:"generated"|'generated')[^>]*>[\s\S]*?<\/style>|<link\b[^>]*\bdata-css=(?:"generated"|'generated')[^>]*>)/g,T=E.exec(v);if(T!==null){let F=!0;while(T!==null)k.push({start:T.index,end:T.index+T[0].length,replacement:F?_:""}),F=!1,T=E.exec(v)}else{let F=v.indexOf("</head>");if(F!==-1)k.push({start:F,end:F,replacement:`${_}
885
885
  `});else{let V=v.match(/<body([^>]*)>/);if(V?.index!==void 0)k.push({start:V.index,end:V.index+V[0].length,replacement:`${V[0]}
886
- ${_}`});else k.push({start:0,end:0,replacement:_})}}k.sort((F,V)=>F.start-V.start||F.end-V.end);for(let F=1;F<k.length;F++)if(k[F].start<k[F-1].end)return ax(Di(v),_);let j=Array(k.length*2+1),B=0,z=0;for(let F of k)j[z++]=v.slice(B,F.start),j[z++]=F.replacement,B=F.end;return j[z]=v.slice(B),j.join("")}function ax(v,_){let k=/(?:<style\b[^>]*\bdata-css=(?:"generated"|'generated')[^>]*>[\s\S]*?<\/style>|<link\b[^>]*\bdata-css=(?:"generated"|'generated')[^>]*>)/g;if(k.test(v)){let E=!1;return v.replace(k,()=>{if(E)return"";return E=!0,_})}if(v.includes("</head>"))return v.replace("</head>",`${_}
886
+ ${_}`});else k.push({start:0,end:0,replacement:_})}}k.sort((F,V)=>F.start-V.start||F.end-V.end);for(let F=1;F<k.length;F++)if(k[F].start<k[F-1].end)return cx(Di(v),_);let j=Array(k.length*2+1),B=0,z=0;for(let F of k)j[z++]=v.slice(B,F.start),j[z++]=F.replacement,B=F.end;return j[z]=v.slice(B),j.join("")}function cx(v,_){let k=/(?:<style\b[^>]*\bdata-css=(?:"generated"|'generated')[^>]*>[\s\S]*?<\/style>|<link\b[^>]*\bdata-css=(?:"generated"|'generated')[^>]*>)/g;if(k.test(v)){let E=!1;return v.replace(k,()=>{if(E)return"";return E=!0,_})}if(v.includes("</head>"))return v.replace("</head>",`${_}
887
887
  </head>`);if(v.includes("<body"))return v.replace(/<body([^>]*)>/,`<body$1>
888
- ${_}`);return _+v}var Jc=[{open:/<!--/g,close:/-->/g},{open:/<script\b/gi,close:/<\/script\s*>/gi},{open:/<style\b/gi,close:/<\/style\s*>/gi}],Pf=/<body\b([^>]*)>/gi;function Nn(v){let _=0,k,E=Jc.map(()=>{return});while(_<v.length){if(k===void 0||k!==null&&k.index<_)Pf.lastIndex=_,k=Pf.exec(v);if(!k)return null;let T=k.index,j=-1,B=null;for(let F=0;F<Jc.length;F++){let V=Jc[F],U=E[F];if(U===void 0||U!==null&&U.index<_)V.open.lastIndex=_,U=V.open.exec(v),E[F]=U;if(!U)continue;if(U.index<T&&(j===-1||U.index<j))j=U.index,B=V.close}if(j===-1||!B)return{index:T,tag:k[0],attrs:k[1]??""};B.lastIndex=j;let z=B.exec(v);if(!z)return null;_=z.index+z[0].length}return null}function zs(v,_){let k=Nn(v);if(!k)return v;return v.slice(0,k.index)+_(k.tag,k.attrs)+v.slice(k.index+k.tag.length)}var Df=/<style\b[^>]*>/iy,Of=/<\/style>/gi,Mf=/<script\b[^>]*>/iy,Nf=/<template(?=[\s>/])[^>]*>/iy,jf=/<\/template\s*>/iy;function Vi(v){let _=0,k=0,E=-1;while(_<v.length){let T=v.indexOf("<",_);if(T===-1)return-1;if(v.startsWith("<!--",T)){let F=v.indexOf("-->",T+4);_=F===-1?v.length:F+3;continue}Df.lastIndex=T;let j=Df.exec(v);if(j){Of.lastIndex=T+j[0].length;let F=Of.exec(v);_=F===null?v.length:F.index+8;continue}Nf.lastIndex=T;let B=Nf.exec(v);if(B){if(k===0)E=T;k++,_=T+B[0].length;continue}jf.lastIndex=T;let z=jf.exec(v);if(z){if(k>0)k--;_=T+z[0].length;continue}if(Mf.lastIndex=T,Mf.test(v))return k>0?E:T;_=T+1}return-1}function Lf(){return`
888
+ ${_}`);return _+v}var Jc=[{open:/<!--/g,close:/-->/g},{open:/<script\b/gi,close:/<\/script\s*>/gi},{open:/<style\b/gi,close:/<\/style\s*>/gi}],Pf=/<body\b([^>]*)>/gi;function Nn(v){let _=0,k,E=Jc.map(()=>{return});while(_<v.length){if(k===void 0||k!==null&&k.index<_)Pf.lastIndex=_,k=Pf.exec(v);if(!k)return null;let T=k.index,j=-1,B=null;for(let F=0;F<Jc.length;F++){let V=Jc[F],U=E[F];if(U===void 0||U!==null&&U.index<_)V.open.lastIndex=_,U=V.open.exec(v),E[F]=U;if(!U)continue;if(U.index<T&&(j===-1||U.index<j))j=U.index,B=V.close}if(j===-1||!B)return{index:T,tag:k[0],attrs:k[1]??""};B.lastIndex=j;let z=B.exec(v);if(!z)return null;_=z.index+z[0].length}return null}function zs(v,_){let k=Nn(v);if(!k)return v;return v.slice(0,k.index)+_(k.tag,k.attrs)+v.slice(k.index+k.tag.length)}var Df=/<style\b[^>]*>/iy,Mf=/<\/style>/gi,Of=/<script\b[^>]*>/iy,Nf=/<template(?=[\s>/])[^>]*>/iy,jf=/<\/template\s*>/iy;function Vi(v){let _=0,k=0,E=-1;while(_<v.length){let T=v.indexOf("<",_);if(T===-1)return-1;if(v.startsWith("<!--",T)){let F=v.indexOf("-->",T+4);_=F===-1?v.length:F+3;continue}Df.lastIndex=T;let j=Df.exec(v);if(j){Mf.lastIndex=T+j[0].length;let F=Mf.exec(v);_=F===null?v.length:F.index+8;continue}Nf.lastIndex=T;let B=Nf.exec(v);if(B){if(k===0)E=T;k++,_=T+B[0].length;continue}jf.lastIndex=T;let z=jf.exec(v);if(z){if(k>0)k--;_=T+z[0].length;continue}if(Of.lastIndex=T,Of.test(v))return k>0?E:T;_=T+1}return-1}function Lf(){return`
889
889
  // STX Lifecycle Runtime
890
890
  (function() {
891
891
  if (typeof window === 'undefined') return;
@@ -1233,7 +1233,7 @@ else {
1233
1233
 
1234
1234
  console.log('[stx] Lifecycle runtime initialized');
1235
1235
  })();
1236
- `}function Yc(v){return Symbol(v)}var b_=Yc("theme"),v_=Yc("router"),w_=Yc("i18n");import*as zf from"crypto";function Bf(v){let _=/\$(\w+)\./g,k=[],E;while((E=_.exec(v))!==null)if(!k.includes(E[1]))k.push(E[1]);return k}function cx(){return`stx-${zf.randomBytes(4).toString("hex")}`}function lx(v){return/\$\w+\./.test(v)}function ux(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=[],U=!1,H=z,Y=/(\w+(?:-\w+)*)\s*=\s*"([^"]*\{\{[^}]*\$\w+[^}]*\}\}[^"]*)"/g,J=[...z.matchAll(Y)];for(let ie of J){let ae=ie[0],ce=ie[1],oe=ie[2];if(lx(oe)){U=!0;let pe=oe.match(/\{\{\s*([\s\S]+?)\s*\}\}/);if(pe){let he=pe[1];if(V.push({attr:ce,expr:he,fullMatch:ae,originalAttr:ce}),Bf(he).forEach(($e)=>k.add($e)),ce==="text")H=H.replace(ae,"");else if(ce==="class")H=H.replace(ae,'class=""');else if(ce==="disabled"||ce==="hidden")H=H.replace(ae,"");else H=H.replace(ae,`${ce}=""`)}}}if(!U)return j;let re=H.match(/\bid\s*=\s*"([^"]+)"/),se;if(re)se=re[1];else se=cx(),H=` id="${se}"${H}`;for(let ie of V)_.push({elementId:se,attribute:ie.attr,expression:ie.expr,stores:Bf(ie.expr)});return`<${B}${H}${F}`}),{html:T,bindings:_,stores:k}}function dx(v,_){if(v.length===0)return"";let k=Array.from(_),E=`
1236
+ `}function Yc(v){return Symbol(v)}var v_=Yc("theme"),w_=Yc("router"),S_=Yc("i18n");import*as zf from"crypto";function Bf(v){let _=/\$(\w+)\./g,k=[],E;while((E=_.exec(v))!==null)if(!k.includes(E[1]))k.push(E[1]);return k}function lx(){return`stx-${zf.randomBytes(4).toString("hex")}`}function ux(v){return/\$\w+\./.test(v)}function dx(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=[],U=!1,H=z,Y=/(\w+(?:-\w+)*)\s*=\s*"([^"]*\{\{[^}]*\$\w+[^}]*\}\}[^"]*)"/g,J=[...z.matchAll(Y)];for(let ie of J){let ae=ie[0],ce=ie[1],oe=ie[2];if(ux(oe)){U=!0;let pe=oe.match(/\{\{\s*([\s\S]+?)\s*\}\}/);if(pe){let he=pe[1];if(V.push({attr:ce,expr:he,fullMatch:ae,originalAttr:ce}),Bf(he).forEach(($e)=>k.add($e)),ce==="text")H=H.replace(ae,"");else if(ce==="class")H=H.replace(ae,'class=""');else if(ce==="disabled"||ce==="hidden")H=H.replace(ae,"");else H=H.replace(ae,`${ce}=""`)}}}if(!U)return j;let re=H.match(/\bid\s*=\s*"([^"]+)"/),se;if(re)se=re[1];else se=lx(),H=` id="${se}"${H}`;for(let ie of V)_.push({elementId:se,attribute:ie.attr,expression:ie.expr,stores:Bf(ie.expr)});return`<${B}${H}${F}`}),{html:T,bindings:_,stores:k}}function fx(v,_){if(v.length===0)return"";let k=Array.from(_),E=`
1237
1237
  <script>
1238
1238
  (function() {
1239
1239
  'use strict';
@@ -1391,10 +1391,10 @@ else {
1391
1391
  }
1392
1392
  })();
1393
1393
  </script>
1394
- `,E}function Wf(v){let{html:_,bindings:k,stores:E}=ux(v);if(k.length===0)return v;let T=dx(k,E),j=_.lastIndexOf("</body>");if(j!==-1)return _.slice(0,j)+T+_.slice(j);return _+T}function fx(v){let _=v.analytics;if(!_?.enabled)return"";switch(_.driver){case"fathom":return px(_);case"google-analytics":return gx(_);case"plausible":return mx(_);case"self-hosted":return hx(_);case"custom":return yx(_);default:return""}}function px(v){let _=v.fathom;if(!_?.siteId)return"";let k=_.scriptUrl||"https://cdn.usefathom.com/script.js",E=_.defer!==!1?" defer":"",T=[`data-site="${yn(_.siteId)}"`];if(_.honorDnt)T.push('data-honor-dnt="true"');if(_.spa)T.push('data-spa="auto"');if(_.canonical)T.push(`data-canonical="${yn(_.canonical)}"`);if(_.auto===!1)T.push('data-auto="false"');return`
1394
+ `,E}function Wf(v){let{html:_,bindings:k,stores:E}=dx(v);if(k.length===0)return v;let T=fx(k,E),j=_.lastIndexOf("</body>");if(j!==-1)return _.slice(0,j)+T+_.slice(j);return _+T}function px(v){let _=v.analytics;if(!_?.enabled)return"";switch(_.driver){case"fathom":return gx(_);case"google-analytics":return mx(_);case"plausible":return hx(_);case"self-hosted":return yx(_);case"custom":return xx(_);default:return""}}function gx(v){let _=v.fathom;if(!_?.siteId)return"";let k=_.scriptUrl||"https://cdn.usefathom.com/script.js",E=_.defer!==!1?" defer":"",T=[`data-site="${yn(_.siteId)}"`];if(_.honorDnt)T.push('data-honor-dnt="true"');if(_.spa)T.push('data-spa="auto"');if(_.canonical)T.push(`data-canonical="${yn(_.canonical)}"`);if(_.auto===!1)T.push('data-auto="false"');return`
1395
1395
  <!-- Fathom Analytics -->
1396
1396
  <script src="${yn(k)}" ${T.join(" ")}${E}></script>
1397
- `}function gx(v){let _=v.googleAnalytics;if(!_?.measurementId)return"";let k=yn(_.measurementId),E=_.debug?`gtag('config', '${k}', { 'debug_mode': true });`:"";return`
1397
+ `}function mx(v){let _=v.googleAnalytics;if(!_?.measurementId)return"";let k=yn(_.measurementId),E=_.debug?`gtag('config', '${k}', { 'debug_mode': true });`:"";return`
1398
1398
  <!-- Google Analytics -->
1399
1399
  <script async src="https://www.googletagmanager.com/gtag/js?id=${k}"></script>
1400
1400
  <script>
@@ -1404,10 +1404,10 @@ else {
1404
1404
  gtag('config', '${k}');
1405
1405
  ${E}
1406
1406
  </script>
1407
- `}function mx(v){let _=v.plausible;if(!_?.domain)return"";let k=_.scriptUrl||"https://plausible.io/js/script.js",E=[`data-domain="${yn(_.domain)}"`],T=k,j=[];if(_.trackLocalhost)j.push("local");if(_.hashMode)j.push("hash");if(j.length>0&&k==="https://plausible.io/js/script.js")T=`https://plausible.io/js/script.${j.join(".")}.js`;return`
1407
+ `}function hx(v){let _=v.plausible;if(!_?.domain)return"";let k=_.scriptUrl||"https://plausible.io/js/script.js",E=[`data-domain="${yn(_.domain)}"`],T=k,j=[];if(_.trackLocalhost)j.push("local");if(_.hashMode)j.push("hash");if(j.length>0&&k==="https://plausible.io/js/script.js")T=`https://plausible.io/js/script.${j.join(".")}.js`;return`
1408
1408
  <!-- Plausible Analytics -->
1409
1409
  <script defer data-domain="${yn(_.domain)}" src="${yn(T)}"></script>
1410
- `}function hx(v){let _=v.selfHosted;if(!_?.siteId||!_?.apiEndpoint)return"";let k=yn(_.siteId),E=yn(_.apiEndpoint),T=_.honorDnt?'if(n.doNotTrack==="1")return;':"",j=_.trackHashChanges?"w.addEventListener('hashchange',pv);":"",B=_.trackOutboundLinks?`
1410
+ `}function yx(v){let _=v.selfHosted;if(!_?.siteId||!_?.apiEndpoint)return"";let k=yn(_.siteId),E=yn(_.apiEndpoint),T=_.honorDnt?'if(n.doNotTrack==="1")return;':"",j=_.trackHashChanges?"w.addEventListener('hashchange',pv);":"",B=_.trackOutboundLinks?`
1411
1411
  d.addEventListener('click',function(e){
1412
1412
  var a=e.target.closest('a');
1413
1413
  if(a&&a.hostname!==location.hostname){
@@ -1440,7 +1440,7 @@ else {
1440
1440
  w.stxAnalytics={track:function(n,v){t('event',{name:n,value:v});}};
1441
1441
  })();
1442
1442
  </script>
1443
- `}function yx(v){let _=v.custom;if(!_)return"";if(_.inlineScript)return`
1443
+ `}function xx(v){let _=v.custom;if(!_)return"";if(_.inlineScript)return`
1444
1444
  <!-- Custom Analytics -->
1445
1445
  <script>
1446
1446
  ${_.inlineScript}
@@ -1448,7 +1448,7 @@ ${_.inlineScript}
1448
1448
  `;if(!_.scriptUrl)return"";let k=[];if(_.scriptId)k.push(`id="${yn(_.scriptId)}"`);if(_.attributes)for(let[T,j]of Object.entries(_.attributes))k.push(`${yn(T)}="${yn(j)}"`);return`
1449
1449
  <!-- Custom Analytics -->
1450
1450
  <script${k.length>0?` ${k.join(" ")}`:""} src="${yn(_.scriptUrl)}" defer></script>
1451
- `}function Ff(v,_){let k=fx(_);if(!k)return v;if(!v.includes("</head>")){let E=v.lastIndexOf("</body>");if(E!==-1)return v.slice(0,E)+k+v.slice(E);return v+k}return v.replace("</head>",`${k}</head>`)}function yn(v){return v.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function ze(v){let _=v.match(/\bdefinePageMeta\s*\(\s*(\{[\s\S]*?\})\s*\)/m);if(!_)return null;try{return Function(`return ${_[1]}`)()}catch{return null}}function Vf(v){let _=v?.layout;if(_===!1)return!1;return typeof _==="string"&&_.trim()?_.trim():void 0}var xx=100,bx=599,el="__stxResponseStatus",Ui="__stxResponseHeaders";function zo(v){return typeof v==="number"&&Number.isInteger(v)&&v>=xx&&v<=bx}function _t(v){for(let _ of v.matchAll(/\bdefinePageMeta\s*\(\s*\{([\s\S]*?)\}\s*\)/g)){let k=_[1].match(/(?:^|,)\s*status\s*:\s*(\d{3})(?=\s*(?:,|$))/);if(!k)continue;let E=Number(k[1]);if(zo(E))return E}return}function Qc(v,_){if(!v||typeof v!=="object")return!1;let k=typeof _==="string"&&/^\d+$/.test(_.trim())?Number(_.trim()):_;if(!zo(k))return!1;return v[el]=k,!0}function vx(v,_,k){if(!v||typeof v!=="object")return;let E=String(_??"").trim();if(!E)return;v[Ui]={...v[Ui],[E]:String(k)}}function He(v){let _=v?.[el];return zo(_)?_:void 0}function Ue(v){let _=v?.[Ui];if(!_||typeof _!=="object")return;let k=Object.entries(_).map(([E,T])=>[E,String(T)]);return k.length>0?Object.fromEntries(k):void 0}function ei(v,_){if(!v||!_||v===_||typeof _!=="object")return;let k=He(v);if(k!==void 0)_[el]=k;let E=Ue(v);if(E)_[Ui]={..._[Ui],...E}}function Wn(v){return{setResponseStatus:(_)=>{Qc(v,_)},notFound:(_=404)=>{let k=zo(_)&&_>=400?_:404;Qc(v,k)},setResponseHeader:(_,k)=>{vx(v,_,k)}}}function Uf(v,_,k={}){if(!v.includes("@status"))return v;let{filePath:E,buildMode:T}=k,j=T==="compile",B="",z=0,F=/@status\s*\(/g,V;while((V=F.exec(v))!==null){let U=wx(v,V.index+V[0].length-1);if(U<0)break;let H=v.slice(V.index+V[0].length,U).trim(),Y=/^\d+$/.test(H)?Number(H):l(H,_),J=E?` in ${E}`:"";if(j)console.warn(`[stx] @status(${H})${J} is skipped when precompiling: the build has no request, so the branch it sits in is not the one a visitor will get. Call notFound() or setResponseStatus(${H}) from <script server> instead \u2014 that runs per request.`);else if(!Qc(_,Y))console.warn(`[stx] @status(${H})${J} is not an HTTP status (100-599) \u2014 ignoring it.`);B+=v.slice(z,V.index),z=U+1+(v.slice(U+1).match(/^[^\S\n]*\n?/)?.[0].length??0),F.lastIndex=z}return z===0?v:B+v.slice(z)}function wx(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}var Sx=0,$x=0;function Hf(v,_){let k=v.match(new RegExp(`${_}\\s*=\\s*"([^"]*)"`,"i"));if(k)return k[1];let E=v.match(new RegExp(`${_}\\s*=\\s*'([^']*)'`,"i"));if(E)return E[1];return null}function _x(v){let _=[],k=/<([a-z][a-z0-9-]*)\s+([^>]*x-data\s*=\s*(?:"[^"]*"|'[^']*')[^>]*)>/gi,E;while((E=k.exec(v))!==null){let[T,j,B]=E,z=E.index,F=Hf(B,"x-data");if(!F)continue;let V=`__stx_scope_${Sx++}`,U=Hf(B,"x-init"),H=kx(v,j,z+T.length),Y=v.slice(z,H.endIndex),J=Ex(Y);_.push({id:V,selector:`[data-stx-scope="${V}"]`,stateExpr:F,initExpr:U,bindings:[],refs:J})}return _}function kx(v,_,k){let E=1,T=k,j=new RegExp(`<${_}(?:\\s|>)`,"gi"),B=new RegExp(`</${_}>`,"gi"),z=new RegExp(`<${_}[^>]*/\\s*>`,"gi");while(E>0&&T<v.length){j.lastIndex=T,B.lastIndex=T,z.lastIndex=T;let F=j.exec(v),V=B.exec(v),U=z.exec(v);if(U&&U.index<(F?.index??1/0)){T=U.index+U[0].length;continue}if(!V)return{endIndex:v.length};if(F&&F.index<V.index)E++,T=F.index+F[0].length;else{if(E--,E===0)return{endIndex:V.index+V[0].length};T=V.index+V[0].length}}return{endIndex:v.length}}function Ex(v){let _=new Map,k=v.replace(/x-data\s*=\s*"[^"]*"/gi,'x-data="__stripped__"').replace(/x-data\s*=\s*'[^']*'/gi,"x-data='__stripped__'"),E=/<[a-z][a-z0-9-]*\s+([^>]*x-ref\s*=\s*["']([^"']*)["'][^>]*)>/gi,T;while((T=E.exec(k))!==null){let[,j,B]=T,z=Cx(j);_.set(B,z)}return _}function Cx(v){let _=v.match(/\bid\s*=\s*["']([^"']*)["']/);if(_)return _[1];return`__stx_el_${$x++}`}function Rx(){return`
1451
+ `}function Ff(v,_){let k=px(_);if(!k)return v;if(!v.includes("</head>")){let E=v.lastIndexOf("</body>");if(E!==-1)return v.slice(0,E)+k+v.slice(E);return v+k}return v.replace("</head>",`${k}</head>`)}function yn(v){return v.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function ze(v){let _=v.match(/\bdefinePageMeta\s*\(\s*(\{[\s\S]*?\})\s*\)/m);if(!_)return null;try{return Function(`return ${_[1]}`)()}catch{return null}}function Vf(v){let _=v?.layout;if(_===!1)return!1;return typeof _==="string"&&_.trim()?_.trim():void 0}var bx=100,vx=599,el="__stxResponseStatus",Ui="__stxResponseHeaders";function Fo(v){return typeof v==="number"&&Number.isInteger(v)&&v>=bx&&v<=vx}function _t(v){for(let _ of v.matchAll(/\bdefinePageMeta\s*\(\s*\{([\s\S]*?)\}\s*\)/g)){let k=_[1].match(/(?:^|,)\s*status\s*:\s*(\d{3})(?=\s*(?:,|$))/);if(!k)continue;let E=Number(k[1]);if(Fo(E))return E}return}function Qc(v,_){if(!v||typeof v!=="object")return!1;let k=typeof _==="string"&&/^\d+$/.test(_.trim())?Number(_.trim()):_;if(!Fo(k))return!1;return v[el]=k,!0}function wx(v,_,k){if(!v||typeof v!=="object")return;let E=String(_??"").trim();if(!E)return;v[Ui]={...v[Ui],[E]:String(k)}}function He(v){let _=v?.[el];return Fo(_)?_:void 0}function Ue(v){let _=v?.[Ui];if(!_||typeof _!=="object")return;let k=Object.entries(_).map(([E,T])=>[E,String(T)]);return k.length>0?Object.fromEntries(k):void 0}function ei(v,_){if(!v||!_||v===_||typeof _!=="object")return;let k=He(v);if(k!==void 0)_[el]=k;let E=Ue(v);if(E)_[Ui]={..._[Ui],...E}}function Wn(v){return{setResponseStatus:(_)=>{Qc(v,_)},notFound:(_=404)=>{let k=Fo(_)&&_>=400?_:404;Qc(v,k)},setResponseHeader:(_,k)=>{wx(v,_,k)}}}function Uf(v,_,k={}){if(!v.includes("@status"))return v;let{filePath:E,buildMode:T}=k,j=T==="compile",B="",z=0,F=/@status\s*\(/g,V;while((V=F.exec(v))!==null){let U=Sx(v,V.index+V[0].length-1);if(U<0)break;let H=v.slice(V.index+V[0].length,U).trim(),Y=/^\d+$/.test(H)?Number(H):l(H,_),J=E?` in ${E}`:"";if(j)console.warn(`[stx] @status(${H})${J} is skipped when precompiling: the build has no request, so the branch it sits in is not the one a visitor will get. Call notFound() or setResponseStatus(${H}) from <script server> instead \u2014 that runs per request.`);else if(!Qc(_,Y))console.warn(`[stx] @status(${H})${J} is not an HTTP status (100-599) \u2014 ignoring it.`);B+=v.slice(z,V.index),z=U+1+(v.slice(U+1).match(/^[^\S\n]*\n?/)?.[0].length??0),F.lastIndex=z}return z===0?v:B+v.slice(z)}function Sx(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}var $x=0,_x=0;function Hf(v,_){let k=v.match(new RegExp(`${_}\\s*=\\s*"([^"]*)"`,"i"));if(k)return k[1];let E=v.match(new RegExp(`${_}\\s*=\\s*'([^']*)'`,"i"));if(E)return E[1];return null}function kx(v){let _=[],k=/<([a-z][a-z0-9-]*)\s+([^>]*x-data\s*=\s*(?:"[^"]*"|'[^']*')[^>]*)>/gi,E;while((E=k.exec(v))!==null){let[T,j,B]=E,z=E.index,F=Hf(B,"x-data");if(!F)continue;let V=`__stx_scope_${$x++}`,U=Hf(B,"x-init"),H=Ex(v,j,z+T.length),Y=v.slice(z,H.endIndex),J=Cx(Y);_.push({id:V,selector:`[data-stx-scope="${V}"]`,stateExpr:F,initExpr:U,bindings:[],refs:J})}return _}function Ex(v,_,k){let E=1,T=k,j=new RegExp(`<${_}(?:\\s|>)`,"gi"),B=new RegExp(`</${_}>`,"gi"),z=new RegExp(`<${_}[^>]*/\\s*>`,"gi");while(E>0&&T<v.length){j.lastIndex=T,B.lastIndex=T,z.lastIndex=T;let F=j.exec(v),V=B.exec(v),U=z.exec(v);if(U&&U.index<(F?.index??1/0)){T=U.index+U[0].length;continue}if(!V)return{endIndex:v.length};if(F&&F.index<V.index)E++,T=F.index+F[0].length;else{if(E--,E===0)return{endIndex:V.index+V[0].length};T=V.index+V[0].length}}return{endIndex:v.length}}function Cx(v){let _=new Map,k=v.replace(/x-data\s*=\s*"[^"]*"/gi,'x-data="__stripped__"').replace(/x-data\s*=\s*'[^']*'/gi,"x-data='__stripped__'"),E=/<[a-z][a-z0-9-]*\s+([^>]*x-ref\s*=\s*["']([^"']*)["'][^>]*)>/gi,T;while((T=E.exec(k))!==null){let[,j,B]=T,z=Rx(j);_.set(B,z)}return _}function Rx(v){let _=v.match(/\bid\s*=\s*["']([^"']*)["']/);if(_)return _[1];return`__stx_el_${_x++}`}function Ax(){return`
1452
1452
  // STX Reactive Runtime - x-cloak and transition CSS
1453
1453
  (function() {
1454
1454
  var style = document.createElement('style');
@@ -1701,7 +1701,7 @@ window.__stx_reactive = (function() {
1701
1701
 
1702
1702
  return { initScope: initScope, reactive: reactive };
1703
1703
  })();
1704
- `}function qf(v,_){let k=v.replace(/\{!!([\s\S]*?)!!\}/g,(z,F)=>{try{let V=x(F,_,!0);if(V===void 0)return z;return String(V)}catch{return z}}),E="",T=0,j=null;while(T<k.length){let z=k[T];if(j&&z==="\\"){E+=z+(k[T+1]??""),T+=2;continue}if(z==="{"&&k[T+1]==="{"){let F=k.indexOf("}}",T+2);if(F!==-1){let V=k.slice(T,F+2);E+=B(k.slice(T+2,F),V,j),T=F+2;continue}}if(j){if(z===j)j=null}else if(z==="'"||z==='"'||z==="`")j=z;E+=z,T++}return E;function B(z,F,V){let U;try{U=x(z,_,!0)}catch{return F}if(U===void 0)return F;if(V){let H=String(U).replace(/\\/g,"\\\\").replace(new RegExp(V==="`"?"`":V,"g"),`\\${V}`).replace(/\r/g,"\\r").replace(/\n/g,"\\n");return V==="`"?H.replace(/\$\{/g,"\\${"):H}if(typeof U==="string"){let H=U.trim();if(H.startsWith("{")&&H.endsWith("}")||H.startsWith("[")&&H.endsWith("]"))try{return JSON.parse(H),H}catch{}}return JSON.stringify(U)}}function Ax(v,_){if(v.length===0)return"";let k=v.map((E)=>{let T=JSON.stringify(Object.fromEntries(E.refs)),j=qf(E.stateExpr,_),B=E.initExpr?qf(E.initExpr,_):null,z=JSON.stringify(j),F=B?JSON.stringify(B):"null";return`
1704
+ `}function qf(v,_){let k=v.replace(/\{!!([\s\S]*?)!!\}/g,(z,F)=>{try{let V=x(F,_,!0);if(V===void 0)return z;return String(V)}catch{return z}}),E="",T=0,j=null;while(T<k.length){let z=k[T];if(j&&z==="\\"){E+=z+(k[T+1]??""),T+=2;continue}if(z==="{"&&k[T+1]==="{"){let F=k.indexOf("}}",T+2);if(F!==-1){let V=k.slice(T,F+2);E+=B(k.slice(T+2,F),V,j),T=F+2;continue}}if(j){if(z===j)j=null}else if(z==="'"||z==='"'||z==="`")j=z;E+=z,T++}return E;function B(z,F,V){let U;try{U=x(z,_,!0)}catch{return F}if(U===void 0)return F;if(V){let H=String(U).replace(/\\/g,"\\\\").replace(new RegExp(V==="`"?"`":V,"g"),`\\${V}`).replace(/\r/g,"\\r").replace(/\n/g,"\\n");return V==="`"?H.replace(/\$\{/g,"\\${"):H}if(typeof U==="string"){let H=U.trim();if(H.startsWith("{")&&H.endsWith("}")||H.startsWith("[")&&H.endsWith("]"))try{return JSON.parse(H),H}catch{}}return JSON.stringify(U)}}function Tx(v,_){if(v.length===0)return"";let k=v.map((E)=>{let T=JSON.stringify(Object.fromEntries(E.refs)),j=qf(E.stateExpr,_),B=E.initExpr?qf(E.initExpr,_):null,z=JSON.stringify(j),F=B?JSON.stringify(B):"null";return`
1705
1705
  (function() {
1706
1706
  var scopeEl = document.querySelector('${E.selector}');
1707
1707
  if (!scopeEl) return;
@@ -1710,25 +1710,25 @@ window.__stx_reactive = (function() {
1710
1710
  })();`}).join(`
1711
1711
  `);return`
1712
1712
  <script data-stx-scoped data-stx-reactive data-stx-run="always">
1713
- ${Rx()}
1713
+ ${Ax()}
1714
1714
  ${k}
1715
- </script>`}function Kf(v,_,k){if(!Ix(v))return v;let E=_x(v);if(E.length===0)return v;let T=Tx(v,E),j=Ax(E,_),B=T.lastIndexOf("</body>");if(B!==-1)T=T.slice(0,B)+j+`
1716
- `+T.slice(B);else T+=j;return T}function Tx(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 Ix(v){return/x-data\s*=\s*["']/.test(v)}function br(v,_){try{let k=v.trim();if(p(k))return c(k,Object.keys(_))(...Object.values(_));else return l(k,_)}catch{return!1}}function vr(v,_){let k=Px(v,_);return k.ok?{expression:k.expression,endPos:k.endPos}:null}function Px(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 Dx(v,_){let k=v.lastIndexOf("<",_);if(k===-1)return!1;return k>v.lastIndexOf(">",_)}function Mr(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),U=F?F.index:1/0,H=V?V.index:1/0;if(U<H)T++,j=U+F[0].length;else if(H<1/0){if(T--,T===0)return H;j=H+V[0].length}else break}return-1}function Xf(v,_){let k=v.slice(_).match(/^@if\s*/);if(!k)return null;let E=_+k[0].length,T=vr(v,E);if(!T)return null;let j=T.endPos,B=Mr(v,"if","endif",j);if(B===-1)return null;let z=v.slice(j,B),F=[],V=0,U="if",H=T.expression,Y=0,J=0;while(V<z.length){let re=z.indexOf("@",V);if(re===-1)break;V=re;let se=z.substring(re);if(Dx(z,re)){V++;continue}if(/^@if\s*\(/.test(se)){J++,V++;continue}if(/^@endif(?![a-z])/.test(se)){J--,V+=6;continue}if(J===0){let ie=se.match(/^@elseif\s*/);if(ie){F.push({type:U,condition:H,content:z.substring(Y,V),start:j+Y,end:j+V});let ae=V+ie[0].length,ce=vr(z,ae);if(!ce){V++;continue}U="elseif",H=ce.expression,V=ce.endPos,Y=V;continue}else if(/^@else(?![a-z])/.test(se)){F.push({type:U,condition:H,content:z.substring(Y,V),start:j+Y,end:j+V}),U="else",H=void 0,V+=5,Y=V;continue}}V++}return F.push({type:U,condition:H,content:z.slice(Y),start:j+Y,end:j+z.length}),{fullMatch:v.slice(_,B+6),branches:F,start:_,end:B+6}}function Hi(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=Xf(v,E.index);if(j)_.push(j),k.lastIndex=j.end;E=k.exec(v)}return _}function Fo(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 U=v.slice(F+1,V),H=V+1,Y=Mr(v,_,k,H);if(Y===-1){j=T.exec(v);continue}let J=v.slice(H,Y),re=Y+`@${k}`.length;E.push({fullMatch:v.slice(z,re),name:_,params:U,content:J,start:z,end:re}),T.lastIndex=re,j=T.exec(v)}return E}function tl(v,_){let k=v.slice(_).match(/^@switch\s*/);if(!k)return null;let E=_+k[0].length,T=vr(v,E);if(!T)return null;let j=T.endPos,B=Mr(v,"switch","endswitch",j);if(B===-1)return null;let z=v.slice(j,B),F=[],V=0,U=null,H=0;while(V<z.length){let Y=z.slice(V),J=Y.match(/^@switch\s*\(/),re=Y.match(/^@endswitch(?![a-z])/);if(J){if(H++,U)U.content+=J[0];V+=J[0].length;continue}if(re){if(H--,U)U.content+=re[0];V+=re[0].length;continue}if(H>0){if(U)U.content+=z[V];V++;continue}let se=Y.match(/^@case\s*/),ie=Y.match(/^@default(?![a-z])/),ae=Y.match(/^@break(?![a-z])/);if(se&&Y.startsWith("@case")){if(U)F.push(U);let ce=V+se[0].length,oe=vr(z,ce);if(!oe){V++;continue}U={type:"case",value:oe.expression,content:""},V=oe.endPos}else if(ie&&Y.startsWith("@default")){if(U)F.push(U);U={type:"default",content:""},V+=ie[0].length}else if(ae&&Y.startsWith("@break"))V+=ae[0].length;else{if(U)U.content+=z[V];V++}}if(U)F.push(U);return{fullMatch:v.slice(_,B+10),expression:T.expression,cases:F,start:_,end:B+10}}function jx(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=tl(E,B);if(!z)break;try{let F;if(p(z.expression))F=c(z.expression,Object.keys(_))(...Object.values(_));else F=l(z.expression,_);let V="",U=!1;for(let H of z.cases)if(H.type==="default"){if(!U)V=H.content.trim()}else try{let Y;if(H.value&&p(H.value))Y=c(H.value,Object.keys(_))(...Object.values(_));else if(H.value)Y=l(H.value,_);if(F===Y){V=H.content.trim(),U=!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),U=i("Switch",`Error evaluating @switch expression: ${V}`,t.EVALUATION_ERROR);E=E.substring(0,B)+U+E.substring(z.end);break}}return E}function Lx(v){let _=[];return{masked:v.replace(/<script\b[\s\S]*?<\/script\s*>/gi,(E)=>(_.push(E),`\x00stx-script-${_.length-1}\x00`)),scripts:_}}function Bx(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}=Lx(v);return Bx(zx(E,_,k),T)}function zx(v,_,k){let E=v;E=jx(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=vr(E,z+7);if(!F)break;let V=F.endPos,U=Mr(E,"unless","endunless",V);if(U===-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 H=E.slice(V,U),Y=F.expression,J=-1;{let se=0,ie=/@(?:if|unless)\s*\(/g,ae=/@(?:endif|endunless)(?![a-z])/g,ce=/@else(?![a-z])/g,oe=[],pe;while((pe=ie.exec(H))!==null)oe.push({pos:pe.index,type:"open"});while((pe=ae.exec(H))!==null)oe.push({pos:pe.index,type:"close"});while((pe=ce.exec(H))!==null)oe.push({pos:pe.index,type:"else"});oe.sort((he,xe)=>he.pos-xe.pos);for(let he of oe)if(he.type==="open")se++;else if(he.type==="close")se--;else if(he.type==="else"&&se===0){J=he.pos;break}}let re;if(J!==-1){let se=H.slice(0,J),ie=H.slice(J+5);re=`@if (${Y})${ie}@else ${se}@endif`}else re=`@if (!(${Y}))${H}@endif`;E=E.substring(0,z)+re+E.substring(U+10),j=!0}}E=rl(E,_,k),E=sl(E,_,k),E=nl(E,_);let T=()=>{let j=Hi(E);if(j.length===0)return!1;let B=Array(j.length);for(let V=j.length-1;V>=0;V--){let U=j[V];try{let H="",Y=!1;for(let J of U.branches){if(Y)break;if(J.type==="else")H=J.content,Y=!0;else try{if(J.condition?Mi(J.condition,_):!1)H=J.content,Y=!0}catch(re){H=i(J.type==="if"?"If":"Elseif",`Error in @${J.type}(${J.condition}): ${re instanceof Error?re.message:String(re)}`,t.EVALUATION_ERROR),Y=!0}}B[V]=H}catch(H){let Y=H instanceof Error?H.message:String(H);B[V]=i("If",`Error processing @if block: ${Y}`,t.EVALUATION_ERROR)}}let z=Array(j.length*2+1),F=0;for(let V=0;V<j.length;V++){let U=j[V];z[V*2]=E.slice(F,U.start),z[V*2+1]=B[V],F=U.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 Zf(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 nl(v,_){let k=v;function E(z,F,V,U){let H=1,Y=U,J=new RegExp(`@${F}(?:\\s*\\(|\\s|$)`,"g"),re=new RegExp(`@${V}(?![a-z])`,"g");while(Y<z.length&&H>0){J.lastIndex=Y,re.lastIndex=Y;let se=J.exec(z),ie=re.exec(z),ae=se?se.index:1/0,ce=ie?ie.index:1/0;if(ae<ce)H++,Y=ae+se[0].length;else if(ce<1/0){if(H--,H===0)return ce;Y=ce+ie[0].length}else break}return-1}function T(z,F,V){let U=0,H=new RegExp(`@${F}(?:\\s*\\(|\\s|$)`,"g"),Y=new RegExp(`@${V}(?![a-z])`,"g"),J=/@else(?![a-z])/g,re=[],se;while((se=H.exec(z))!==null)re.push({pos:se.index,type:"open"});while((se=Y.exec(z))!==null)re.push({pos:se.index,type:"close"});while((se=J.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")U++;else if(ie.type==="close")U--;else if(ie.type==="else"&&U===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,U,H,Y=k.slice(V+5),J=Zf(Y);if(J)U=J.value,H=V+5+J.consumed;else H=V+5;let re=E(k,"auth","endauth",H);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(H,re),ie=T(se,"auth","endauth"),ae;if(!_.auth)ae=!1;else ae=U?br(`auth?.check && auth?.user?.[${U}]`,_):br("auth?.check",_);let ce;if(ie!==-1){let oe=se.slice(0,ie),pe=se.slice(ie+5);ce=ae?oe:pe}else ce=ae?se:"";k=k.substring(0,V)+ce+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,U,H,Y=k.slice(V+6),J=Zf(Y);if(J)U=J.value,H=V+6+J.consumed;else H=V+6;let re=E(k,"guest","endguest",H);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(H,re),ie=T(se,"guest","endguest"),ae;if(!_.auth)ae=!0;else ae=U?br(`!auth?.check || !auth?.user?.[${U}]`,_):br("!auth?.check",_);let ce;if(ie!==-1){let oe=se.slice(0,ie),pe=se.slice(ie+5);ce=ae?oe:pe}else ce=ae?se:"";k=k.substring(0,V)+ce+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 U=[z];if(F)U.push(F);if(V){let H=br(V,_);U.push(H)}return _.permissions.check(...U)}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",U=!0;while(U){U=!1;let H=k.match(new RegExp(`@${z}\\s*\\(`));if(!H||H.index===void 0)break;let Y=H.index,J=k.slice(Y+`@${z}`.length),re=B(J);if(!re)break;let se=Y+`@${z}`.length+re.paramsEnd,ie=E(k,z,F,se);if(ie===-1){console.warn(`[stx] @${z} directive at position ${Y} has no matching @${F} \u2014 the block was skipped.`);break}let ae=k.slice(se,ie),ce=[],oe=0,pe=new RegExp(`@${z}\\s*\\(`,"g"),he=new RegExp(`@${F}(?![a-z])`,"g"),xe=new RegExp(`@${V}\\s*\\(`,"g"),$e=/@else(?![a-z])/g,Re=[],Ce;while((Ce=pe.exec(ae))!==null)Re.push({pos:Ce.index,type:"open"});while((Ce=he.exec(ae))!==null)Re.push({pos:Ce.index,type:"close"});while((Ce=xe.exec(ae))!==null)Re.push({pos:Ce.index,type:"elseDirective"});while((Ce=$e.exec(ae))!==null)Re.push({pos:Ce.index,type:"else"});Re.sort((Oe,Ie)=>Oe.pos-Ie.pos);for(let Oe of Re){if(Oe.type==="open"){oe++;continue}if(Oe.type==="close"){oe--;continue}if(oe===0)ce.push(Oe)}let Ae=[],Te=0;for(let Oe=0;Oe<ce.length;Oe++){let Ie=ce[Oe];if(Ae.push({content:ae.slice(Te,Ie.pos),ability:void 0}),Ie.type==="elseDirective"){let Ne=ae.slice(Ie.pos+`@${V}`.length),at=B(Ne);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 ht=ce[Oe+1],dt=ht?ht.pos:ae.length;Ae.push({content:ae.slice(Te,dt),ability:at.ability,type:at.type,id:at.id}),Te=dt}}else Te=Ie.pos+5}if(Te<ae.length){let Oe=Ae[Ae.length-1];if(ce.length>0&&ce[ce.length-1].type==="else")Ae.push({content:ae.slice(Te),isFinalElse:!0});else if(Ae.length===0)Ae.push({content:ae.slice(Te)})}let _e=j(re.ability,re.type,re.id),Pe=z==="can"?_e:!_e,Me="";if(Pe)Me=Ae[0]?.content||"";else{let Oe=!1;for(let Ie=1;Ie<Ae.length;Ie++){let Ne=Ae[Ie];if(Ne.isFinalElse){Me=Ne.content,Oe=!0;break}if(Ne.ability){let at=j(Ne.ability,Ne.type,Ne.id);if(z==="can"?at:!at){Me=Ne.content,Oe=!0;break}}}if(!Oe&&Ae.length>0){let Ie=Ae[Ae.length-1];if(Ie.isFinalElse)Me=Ie.content}}k=k.substring(0,Y)+Me+k.substring(ie+`@${F}`.length),U=!0}}return k}function rl(v,_,k){let E=v;function T(j,B,z,F,V){let U=!0;while(U){U=!1;let H=new RegExp(`@${B}\\s*\\(`),Y=j.match(H);if(!Y||Y.index===void 0)break;let J=Y.index,re=vr(j,J+`@${B}`.length);if(!re)break;let se=re.endPos,ie=Mr(j,B,z,se);if(ie===-1){console.warn(`[stx] @${B} directive at position ${J} has no matching @${z} \u2014 the block was skipped.`);break}let ae=j.slice(se,ie),ce=re.expression,oe=-1,pe=0,he=0;while(he<ae.length){let xe=ae.indexOf("@",he);if(xe===-1)break;let $e=ae.substring(xe);if(/^@(?:if|unless|isset|empty)\s*\(/.test($e)){pe++,he=xe+1;continue}if(/^@(?:endif|endunless|endisset|endempty)(?![a-z])/.test($e)){pe--,he=xe+1;continue}if(pe===0&&/^@else(?![a-z])/.test($e)){oe=xe;break}he=xe+1}try{let xe=F(ce.trim()),$e;if(oe!==-1){let Re=ae.slice(0,oe),Ce=ae.slice(oe+5);$e=xe?Re:Ce}else $e=xe?ae:"";j=j.substring(0,J)+$e+j.substring(ie+`@${z}`.length),U=!0}catch(xe){let $e=xe instanceof Error?xe.message:String(xe),Re=i(V,`Error processing @${B} directive: ${$e}`,t.EVALUATION_ERROR);j=j.substring(0,J)+Re+j.substring(ie+`@${z}`.length);break}}return j}return E=T(E,"isset","endisset",(j)=>{let B=br(j,_);return B!==void 0&&B!==null},"Isset"),E=T(E,"empty","endempty",(j)=>{let B=br(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 sl(v,_,k){let E=v,T="development";function j(B,z,F,V){let U=new RegExp(`@${z}(?![a-z])`,"g"),H=new RegExp(`@${F}(?![a-z])`,"g"),Y=new RegExp(`^@${z}(?![a-z])`),J=new RegExp(`^@${F}(?![a-z])`),re=B,se=!0;while(se){se=!1,U.lastIndex=0;let ie=U.exec(re);if(!ie)break;let ae=ie.index,ce=ae+ie[0].length;if(z==="env"){let _e=re.substring(ce).match(/^\s*\(\s*(['"])([^'"]+)\1\s*\)/);if(!_e)break;ce+=_e[0].length,V=T===_e[2]}let oe=1,pe=ce,he=-1;while(oe>0&&pe<re.length){U.lastIndex=pe,H.lastIndex=pe;let _e=U.exec(re),Pe=H.exec(re),Me=_e?_e.index:1/0,Oe=Pe?Pe.index:1/0;if(Me<Oe)oe++,pe=Me+_e[0].length;else if(Oe<1/0){if(oe--,oe===0){he=Oe;break}pe=Oe+Pe[0].length}else break}if(he===-1){console.warn(`[stx] @${z} directive at position ${ae} has no matching @${F} \u2014 the block was skipped.`);break}let xe=re.substring(ce,he),$e=-1,Re=0,Ce=0;while(Ce<xe.length){let _e=xe.indexOf("@",Ce);if(_e===-1)break;let Pe=xe.substring(_e);if(Y.test(Pe)){Re++,Ce=_e+1;continue}if(J.test(Pe)){Re--,Ce=_e+1;continue}if(Re===0&&/^@else(?![a-z])/.test(Pe)){$e=_e;break}Ce=_e+1}let Ae;if($e!==-1){let _e=xe.slice(0,$e),Pe=xe.slice($e+5);Ae=V?_e:Pe}else Ae=V?xe:"";let Te=`@${F}`.length;re=re.substring(0,ae)+Ae+re.substring(he+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 Gf=new WeakMap;function Jf(v=16){let _=new Uint8Array(v);return crypto.getRandomValues(_),btoa(String.fromCharCode(..._))}function Vo(v,_){if(!v)return _?.nonceGenerator?.()??Jf();let k=Gf.get(v);if(!k)k=_?.nonceGenerator?.()??Jf(),Gf.set(v,k);return k}function Wx(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 Yf(v,_){return`<meta http-equiv="Content-Security-Policy" content="${Wx(v,_).replace(/&/g,"&amp;").replace(/"/g,"&quot;")}">`}function Qf(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?Vo(k,_):void 0,T=Yf(_.directives,E);return v.replace(/<head([^>]*)>/,`<head$1>
1717
- ${T}`)}function ep(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 tp(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?Vo(_,j):void 0;return Yf(j.directives,B)}),T=T.replace(/@cspNonce\b/g,()=>{if(!j?.enabled||!j.useNonce)return"";return Vo(_,j)}),j?.enabled&&j.useNonce)_.cspNonce=Vo(_,j);return T}import Fx from"crypto";var Vx=40,np="_token",il=null;function Ux(v=Vx){let _=Fx.randomBytes(Math.ceil(v/2)).toString("hex").slice(0,v);return il=_,_}function Hx(){if(!il)Ux();return il}function qx(v=np){let _=Hx();return`<input type="hidden" name="${v}" value="${_}">`}function rp(v){return v.replace(/@csrf(?:\((['"])([^'"]*)\1\))?/g,(_,k,E)=>qx(E||np))}async function sp(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 Kx(T,j,_,k,E);else T=await Xx(T,j,_,k,E)}return T}async function Kx(v,_,k,E,T){let{name:j,handler:B}=_,z=`@${j}`,F=`@end${j}`,V=v,U=Cr(`${z}(?:\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\))?([\\s\\S]*?)${F}`,"g"),H=[],Y=U.exec(V);while(Y!==null){let[J,re="",se=""]=Y,ie=Y.index||0;try{let ae=re?ip(_,re):[],ce=se.trim(),oe=await B(ce,ae,k,E);H.push({original:J,processed:oe,startIndex:ie})}catch(ae){let ce=ae instanceof Error?ae.message:String(ae);if(T.debug)console.error(`Error processing custom directive @${j}:`,ae);H.push({original:J,processed:i("CustomDirective",`Error in @${j}${re?`(${re})`:""}: ${ce}`,t.EVALUATION_ERROR),startIndex:ie})}Y=U.exec(V)}for(let J=H.length-1;J>=0;J--){let{original:re,processed:se}=H[J];V=V.replace(re,se)}return V}async function Xx(v,_,k,E,T){let{name:j,handler:B}=_,z=v,F=[],V=[];if(_.rawParams){for(let Y of Os(z,Cr(`(?<![\\w$@])@${j}\\s*\\(`,"g")))if(Y.end!==-1)V.push({fullMatch:Y.call,paramString:Y.args,startIndex:Y.start})}else{let Y=Cr(`@${j}\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\)`,"g");Y.lastIndex=0;let J=Y.exec(z);while(J!==null)V.push({fullMatch:J[0],paramString:J[1]??"",startIndex:J.index||0}),J=Y.exec(z)}for(let{fullMatch:Y,paramString:J,startIndex:re}of V)try{let se=ip(_,J),ie=await B("",se,k,E);F.push({original:Y,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:Y,processed:i("CustomDirective",`Error in @${j}(${J}): ${ie}`,t.EVALUATION_ERROR),startIndex:re})}let U=Cr(`@${j}(?!\\w)(?!\\s*\\()`,"g"),H=U.exec(z);while(H!==null){let[Y]=H,J=H.index||0;try{let re=await B("",[],k,E);F.push({original:Y,processed:re,startIndex:J})}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:Y,processed:i("CustomDirective",`Error in @${j}: ${se}`,t.EVALUATION_ERROR),startIndex:J})}H=U.exec(z)}for(let Y=F.length-1;Y>=0;Y--){let{original:J,processed:re}=F[Y];z=z.replace(J,re)}return z}function ip(v,_){return v.rawParams?Ze(_):Zx(_)}function Zx(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 op=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,ap=/^[A-Za-z_$][\w$]*$/,Gx=new Set(["light","dark","system"]);function Nr(v,_){if(typeof v!=="string"||v.length===0)throw Error(`@appearanceBootstrap ${_} must be a non-empty string`)}function Jx(v){if(!v||typeof v!=="object"||Array.isArray(v))throw Error("@appearanceBootstrap expects an options object");let _=v,{appearance:k,colorMode:E}=_;if(Nr(_.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(Nr(E.key,"colorMode.key"),Nr(E.attribute,"colorMode.attribute"),Nr(E.default,"colorMode.default"),!ap.test(E.key))throw Error("@appearanceBootstrap preference keys must be JavaScript property names");if(!op.test(E.attribute))throw Error("@appearanceBootstrap attributes must be lowercase data attribute names");if(!Gx.has(E.default))throw Error("@appearanceBootstrap colorMode.default must be light, dark, or system");let T=null;if(k){if(Nr(k.key,"appearance.key"),Nr(k.attribute,"appearance.attribute"),Nr(k.default,"appearance.default"),!ap.test(k.key))throw Error("@appearanceBootstrap preference keys must be JavaScript property names");if(!op.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 Yx(v){return JSON.stringify(v).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function Qx(v){return`<script data-stx-scoped data-stx-appearance-bootstrap>(function(){"use strict";const config=${Yx(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 eb(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 cp(v,_){let k=v,E=/@appearanceBootstrap\s*\(/g,T;while((T=E.exec(k))!==null){let j=T.index+T[0].length-1,B=eb(k,j);if(B===-1)throw Error("@appearanceBootstrap has an unclosed options object");let z=k.slice(j+1,B).trim(),F=l(`(${z})`,_),V=Qx(Jx(F));k=k.slice(0,T.index)+V+k.slice(B+1),E.lastIndex=T.index+V.length}return k}import tb from"crypto";function Ht(v){return String(v??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}var up={input:"form-control",inputError:"is-invalid",checkInput:"form-check-input",label:"form-label",errorFeedback:"invalid-feedback"};function Uo(v,_,k,E){let T=v||_;return k?`${T} ${E}`:T}function _n(v){return String(v).replace(/\[\]$/,"").replace(/[^\w.:-]+/g,"-").replace(/^-+|-+$/g,"")}function Ws(v,_){if(/\bid\s*=/i.test(v))return"";return` id="${Ht(_)}"`}function ol(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="${Ht(`${_n(v)}-error`)}"`;return E}function nb(){return tb.randomUUID()}function Ho(v,_){let k=v;return k=k.replace(/@csrf/g,()=>{if(!_.csrf||typeof _.csrf!=="object"){let E=nb();_.csrf={token:E}}if(_.csrf.field)return _.csrf.field;if(_.csrf.token)return`<input type="hidden" name="_token" value="${Ht(_.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="${Ht(j)}">`;return E}),k}function dp(v,_,k=up){let E=v;return E=E.replace(/@form\(\s*(?:(?:'([^']+)'|"([^"]+)")\s*)?(?:,\s*(?:'([^']+)'|"([^"]+)")?)?\s*(?:,\s*\{([^}]+)\}\s*)?\)/g,(T,j,B,z,F,V="")=>{let U=j||B||"POST",H=z||F||"",Y=wr(V),J=U.toUpperCase(),re=["GET","POST"].includes(J)?J:"POST",se=`<form method="${Ht(re)}" action="${Ht(H)}"${Y?` ${Y}`:""}>`;if(se+=`
1718
- ${Ho("@csrf",_)}`,!["GET","POST"].includes(J))se+=`
1719
- ${Ho(`@method('${J}')`,_)}`;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 U=j||B||"",H=z||F||"",Y=wr(V),J=qi(U,_),re=J!==void 0&&J!==null?J:H||"",se=Y.match(/type=['"]([^'"]+)['"]/i),ie=se?se[1]:"text",ae=Ki(U,_),ce=Y.match(/class=['"]([^'"]+)['"]/i),oe=Uo(ce?ce[1]:"",k.input,ae,k.inputError),pe=Y.replace(/class=['"][^'"]+['"]/i,"");return pe=pe.replace(/type=['"][^'"]+['"]/i,""),`<input type="${Ht(ie)}" name="${Ht(U)}"${Ws(Y,_n(U))} value="${Ht(re)}" class="${oe}"${ol(U,ae,Y)}${pe?` ${pe}`:""}>`}),E=E.replace(/@textarea\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endtextarea/g,(T,j,B="",z="")=>{let F=wr(B),V=qi(j,_)||z.trim(),U=Ki(j,_),H=F.match(/class=['"]([^'"]+)['"]/i),Y=Uo(H?H[1]:"",k.input,U,k.inputError),J=F.replace(/class=['"][^'"]+['"]/i,"");return`<textarea name="${Ht(j)}"${Ws(F,_n(j))} class="${Y}"${ol(j,U,F)}${J?` ${J}`:""}>${Ht(V)}</textarea>`}),E=E.replace(/@select\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endselect/g,(T,j,B="",z)=>{let F=wr(B),V=qi(j,_),U=Ki(j,_),H=F.match(/class=['"]([^'"]+)['"]/i),Y=Uo(H?H[1]:"",k.input,U,k.inputError),J=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="${Ht(j)}"${Ws(F,_n(j))} class="${Y}"${ol(j,U,F)}${J?` ${J}`:""}>${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)}`,U=wr(z),H=qi(j,_),Y=H!==void 0&&(Array.isArray(H)?H.some((ie)=>String(ie)===F):H===!0||String(H)===F),J=U.match(/class=['"]([^'"]+)['"]/i),re=J?J[1]:k.checkInput,se=U.replace(/class=['"][^'"]+['"]/i,"");return`<input type="checkbox" name="${Ht(j)}"${Ws(U,V)} value="${Ht(F)}" class="${re}"${Y?" checked":""}${se?` ${se}`:""}>`}),E=E.replace(/@radio\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(T,j,B,z="")=>{let F=wr(z),V=qi(j,_),U=V!==void 0&&V===B,H=F.match(/class=['"]([^'"]+)['"]/i),Y=H?H[1]:k.checkInput,J=F.replace(/class=['"][^'"]+['"]/i,"");return`<input type="radio" name="${Ht(j)}"${Ws(F,`${_n(j)}-${_n(B)}`)} value="${Ht(B)}" class="${Y}"${U?" checked":""}${J?` ${J}`:""}>`}),E=E.replace(/@file\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(T,j,B="")=>{let z=wr(B),F=z.match(/accept=['"]([^'"]+)['"]/i),V=F?F[1]:"",U=z.includes("multiple"),H=Ki(j,_),Y=z.match(/class=['"]([^'"]+)['"]/i),J=Uo(Y?Y[1]:"",k.input,H,k.inputError),re=z.replace(/class=['"][^'"]+['"]/gi,"").replace(/accept=['"][^'"]+['"]/gi,"").replace(/\bmultiple\b/gi,"").trim(),se=[`<input type="file" name="${Ht(j)}"${Ws(z,_n(j))}`,`class="${J}"`];if(V)se.push(`accept="${Ht(V)}"`);if(U)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=wr(B),V=F.match(/class=['"]([^'"]+)['"]/i),U=V?V[1]:k.label,H=F.replace(/class=['"][^'"]+['"]/i,"");return`<label for="${Ht(_n(j))}" class="${U}"${H?` ${H}`:""}>${z}</label>`}),E}function fp(v,_,k=up){return v.replace(/@error\(['"]([^'"]+)['"]\)([\s\S]*?)@enderror/g,(E,T,j)=>{try{if(Ki(T,_)){let B=j.replace(/\{\{([^}]+)\}\}/g,(z,F)=>{try{if(F.trim()==="$message"||F.trim()==="message")return lp(T,_);if(F.trim().includes("errors.first")||F.trim().includes("$errors.first")){if(typeof _.errors?.first==="function")return _.errors.first(T);return lp(T,_)}let V=F.trim();if(p(V)){let U=l(V,_);return U!==void 0?String(U):V}return V}catch{return F}});return`<div id="${Ht(`${_n(T)}-error`)}" role="alert">${B}</div>`}return""}catch(B){return console.error("Error processing @error directive:",B),E}})}function Ki(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 lp(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 qi(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 wr(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 Xi=/<\/?template\b[^>]*>/gi,rb=/(?:^|\s)(?:id\s*=|(?:x-|[@:])(?:for|if|else(?:-if)?)(?=\s|=|$)|#[\w-]+(?:\s*=|\s|$)|v-slot(?::[\w-]+)?(?=\s|=|$)|slot\s*=)/i;function sb(v){let _=v.replace(/^<template\b/i,"").replace(/>$/,"");return rb.test(_)}function Q(v){Xi.lastIndex=0;let _;while((_=Xi.exec(v))!==null){if(_[0].startsWith("</")||sb(_[0]))continue;let k=_.index,E=Xi.lastIndex,T=1,j;while((j=Xi.exec(v))!==null)if(j[0].startsWith("</")){if(T--,T===0){let B=j.index;return{start:k,openEnd:E,closeStart:B,end:Xi.lastIndex,content:v.slice(E,B)}}}else T++;return null}return null}import Bt from"path";import{existsSync as Rv}from"fs";class pp{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=Na(v,E);if(T!==void 0)return T;for(let j of ja(v,_,k,E))if(await r(j))return j;return null}}var Fs=new pp;function Lt(v){return v.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}var Sr="\x00stx-boolean-attribute";function al(v){return v.indexOf("\x00")===-1?v:v.replace(/\0/g,"")}var ib=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 cl(v){let _=v.toLowerCase();return _.startsWith("aria-")||_.startsWith("data-")||ib.has(_)}function $r(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===Sr){k.push(Lt(j));continue}k.push(`${Lt(j)}="${Lt(al(String(T)))}"`)}return k}function _r(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(al(String(T)))}"`)}return k}function Us(v){return v.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function ob(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 ll={name:"StxLink",aliases:["stx-link"],render(v,_,k){let E=ob(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="${Us(E.value)}"`);else F.push(`href="${Us(Ei(E.value,"navigable"))}"`);if(T)F.push(`class="${Us(T)}"`);if(F.push("data-stx-link"),F.push(`data-stx-active-class="${Us(j)}"`),F.push(`data-stx-exact-active-class="${Us(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="${Us(V)}"`);let U=new Set(["to","class","className","activeClass","exactActiveClass","activeMatch","prefetch"]);return F.push(...$r(v,U)),F.push(..._r(v,U)),`<a ${F.join(" ")}>${_}</a>`}};import{createHash as kp}from"crypto";import en from"fs";import Kt from"path";import{decode as gb,generateThumbHash as mb}from"ts-images";import{createImageDeliveryCatalog as bp}from"ts-images/delivery";import ul from"fs";function ea(v,_,k){let E=Buffer.alloc(k),T=ul.readSync(v,E,0,k,_);return E.subarray(0,T)}function dl(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 fl(v){let _;try{_=ul.openSync(v,"r");let k=ea(_,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=ea(_,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(dl(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)ul.closeSync(_)}}import ab from"fs";import ta from"os";import{join as gp}from"path";import{fileURLToPath as mp}from"url";import{Worker as hp}from"worker_threads";var ra=Symbol("stx.image-worker.unavailable");function cb(v=typeof ta.availableParallelism==="function"?ta.availableParallelism():ta.cpus().length){return Math.max(1,Math.min(2,v-1))}var na=0,xp=[];async function lb(){if(na<cb()){na++;return}await new Promise((v)=>xp.push(v)),na++}function ub(){na--,xp.shift()?.()}var db="@stacksjs/stx/builtins/image-warmup-worker";function fb(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:"&&ab.existsSync(mp(k)))return mp(k)}catch{}try{let k=typeof Bun<"u"?Bun.resolveSync(db,v):void 0;return k&&pb(k)?k:void 0}catch{return}}function pb(v,_=process.env){let k=v.replace(/\\/g,"/");if(k.split("/").some((T)=>/@\d[^/]*@@@\d+$/.test(T)))return!1;return![_.BUN_INSTALL_CACHE_DIR,gp(_.BUN_INSTALL||gp(ta.homedir(),".bun"),"install","cache")].filter((T)=>!!T).map((T)=>`${T.replace(/\\/g,"/").replace(/\/$/,"")}/`).some((T)=>k.startsWith(T))}var yp=!1;function Zi(v){if(!yp)yp=!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 ra}function pl(v){return v instanceof Error?v.message:String(v)}async function gl(v,_){if(typeof hp!=="function")return Zi("node:worker_threads has no Worker in this runtime");let k=fb();if(!k)return Zi("no image-warmup-worker entry beside this module or in the installed @stacksjs/stx");await lb();try{return await new Promise((E,T)=>{let j;try{j=new hp(k)}catch(V){E(Zi(`could not start ${k}: ${pl(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 U=Error(V.error?.message??"image worker failed");if(V.error?.name)U.name=V.error.name;if(V.error?.stack)U.stack=V.error.stack;F(()=>T(U))}),j.on("error",(V)=>{F(()=>B?T(V instanceof Error?V:Error(pl(V)||"image worker crashed")):E(Zi(`the worker failed before it was ready: ${pl(V)}`)))}),j.on("exit",(V)=>{F(()=>B?T(Error("image worker exited before it finished")):E(Zi(`the worker exited with code ${V} before it was ready`)))})})}finally{ub()}}var hb=new Set([".avif",".jpeg",".jpg",".png",".webp"]),yb=[320,640,960,1280,1920],ia="/_stx/images",xb=`stx:${ia}:alpha-1`,bb=["@stacksjs/ts-webp","@stacksjs/ts-avif"],sa;function vb(v,_){let k=Kt.dirname(Bun.resolveSync(v,_));while(k!==Kt.dirname(k)){let E=Kt.join(k,"package.json");if(en.existsSync(E)){let T=JSON.parse(en.readFileSync(E,"utf8"));if(T.name===v)return T.version}k=Kt.dirname(k)}return}function wb(){if(sa!==void 0)return sa;let v;try{v=Kt.dirname(Bun.resolveSync("ts-images",import.meta.dir))}catch{}return sa=bb.map((_)=>{let k;try{k=v?vb(_,v):void 0}catch{}return`${_.replace("@stacksjs/","")}@${k??"unknown"}`}).join("+"),sa}var vp=Symbol.for("stx.image-delivery");function Gi(){let v=globalThis;return v[vp]??={catalog:new Map,transparent:new Set},v[vp]}var wp=new Set;function Sb(v){return`/${v.split(Kt.sep).map(encodeURIComponent).join("/")}`}function $b(v){let _=Kt.extname(v),k=v.slice(0,-_.length).replace(/[^a-zA-Z0-9_-]+/g,"-").replace(/^-+|-+$/g,""),E=kp("sha256").update(v).digest("hex").slice(0,8);return`${k||"image"}-${E}`}function Sp(v,_=`stx:${ia}`){let k=(E)=>`${ia}/${E.split("/").map(encodeURIComponent).join("/")}`;return{cacheNamespace:_,async stat(E){let T=Kt.join(v,E);try{let j=await en.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=Kt.join(v,E);await en.promises.mkdir(Kt.dirname(j),{recursive:!0});let B=`${j}.${process.pid}.tmp`;return await en.promises.writeFile(B,T),await en.promises.rename(B,j),{bytes:T.byteLength,path:j,url:k(E)}},url:k}}async function Ep(v,_=v){let k=await en.promises.readdir(_,{withFileTypes:!0});k.sort((T,j)=>T.name.localeCompare(j.name));let E=[];for(let T of k){let j=Kt.join(_,T.name);if(T.isDirectory()){E.push(...await Ep(v,j));continue}if(!T.isFile()||!hb.has(Kt.extname(T.name).toLowerCase()))continue;E.push({absolutePath:j,relativePath:Kt.relative(v,j)})}return E}function $p(v,_){return v.map((k)=>({key:Sb(k.relativePath),input:k.absolutePath,name:$b(k.relativePath),..._b(k.absolutePath)?{options:{storage:_}}:{}}))}function _b(v){return fl(v)==="possible"}function kb(v){for(let _=3;_<v.length;_+=4)if(v[_]!==255)return!0;return!1}async function Eb(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 gb(new Uint8Array(await en.promises.readFile(z?.path??B.fallback.path)));if(kb(F.data))k.add(j)}catch{k.add(j)}}));return k}function Cb(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=en.openSync(z.path,"r"),!dl(ea(F,0,32))}catch{return!0}finally{if(F!==void 0)en.closeSync(F)}}))continue;if(T.variants=T.variants.filter((z)=>z.format!=="webp"),delete T.sources.webp,k.push(E),!wp.has(E))wp.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 Rb(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 mb(B.absolutePath),B}catch{return console.warn(`[stx-images] Skipping unreadable raster: ${B.relativePath}`),null}}));_.push(...j.filter((B)=>B!==null))}return _}function ml(v){return Kt.join(v,"undecodable.json")}function Ab(v){try{let _=en.readFileSync(ml(v),"utf-8"),k=JSON.parse(_);return k&&typeof k==="object"?k:{}}catch{return{}}}function Tb(v,_){try{en.mkdirSync(Kt.dirname(ml(v)),{recursive:!0}),en.writeFileSync(ml(v),JSON.stringify(_))}catch{}}function _p(v){try{let _=en.statSync(v);return{mtimeMs:_.mtimeMs,size:_.size}}catch{return}}function Cp(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 ss(v){let _=Cp(v);return _?Gi().catalog.get(_):void 0}function os(v){let _=Cp(v);return _?Gi().transparent.has(_):!1}function is(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 Jd(v){let _=ss(v);if(!_)return;return{src:_.fallback.url,srcset:_.sources[_.fallback.format]||"",sources:is(_).map(({format:k,srcset:E})=>({type:`image/${k}`,srcset:E})),width:_.source.width,height:_.source.height,placeholder:os(v)?void 0:_.placeholder?.dataUrl}}function qn(){let v=Gi();v.catalog=new Map,v.transparent=new Set}function Ib(v){let _=Gi();_.catalog=new Map(v.entries),_.transparent=new Set(v.transparent)}async function Yd(v,_,k={}){if(!v||!en.existsSync(v))return qn(),{count:0,fingerprint:""};if(k.offThread){let re=await gl("delivery",{publicDir:v,outputDir:_});if(re!==ra)return Ib(re.state),re.result}let E=await Ep(v);if(E.length===0)return qn(),{count:0,fingerprint:""};let T=Ab(_),j=E.filter((re)=>{let se=T[re.relativePath];if(!se)return!0;let ie=_p(re.absolutePath);return!ie||ie.mtimeMs!==se.mtimeMs||ie.size!==se.size});if(j.length===0)return qn(),{count:0,fingerprint:""};let B=Sp(Kt.join(_,"_stx","images"),`${xb}:${wb()}`),z={outDir:Kt.join(_,"_stx","images"),storage:Sp(Kt.join(_,"_stx","images")),baseUrl:ia,widths:yb,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 bp({...z,entries:$p(j,B)})}catch(re){if(F=await Rb(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 ce=_p(ae.absolutePath);if(!ce)continue;T[ae.relativePath]=ce,ie=!0}if(ie)Tb(_,T);if(F.length===0)return qn(),{count:0,fingerprint:""};V=await bp({...z,entries:$p(F,B)})}let U=await Eb(V.entries),H=Cb(V.entries,U),Y=Gi();Y.catalog=new Map(Object.entries(V.entries)),Y.transparent=U;let J=U.size===0&&H.length===0?V.fingerprint:kp("sha256").update(V.fingerprint).update(JSON.stringify({transparent:[...U].sort(),droppedWebp:H.sort()})).digest("hex");return{count:F.length,fingerprint:J}}var Pb=new Map;function hl(v){if(!v)return;let _=v.split("?")[0].split("#")[0];return Pb.get(_)}var Db={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},yl=[320,640,768,1024,1280,1536,1920];function Ut(v){return v.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Yt(v,_){if(v.serverDynamic[_]!==void 0)return String(v.serverDynamic[_]);let k=v.static[_];if(typeof k==="string")return k;return}function oa(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 xl(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=Db[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 bl(v,_,k,E){return _.map((T)=>`${Ji(v,T,void 0,k,E)} ${T}w`).join(", ")}function Ob(v,_,k,E,T){return _.map((j)=>{let B=k?k*j:void 0;return`${Ji(v,B,void 0,E,T)} ${j}x`}).join(", ")}function Ji(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 Mb(v){return`var s=this.style;${v.map((_)=>`s.${_}=''`).join(";")}`}function Nb(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 vl={name:"StxImage",aliases:["Image","stx-image","stx-img"],render(v,_,k){let E=Yt(v,"src")||"",T=ss(E),j=Yt(v,"alt")||"",B=Yt(v,"width")||(T?String(T.source.width):void 0),z=Yt(v,"height")||(T?String(T.source.height):void 0),F=Yt(v,"sizes"),V=Yt(v,"srcset"),U=Yt(v,"densities"),H=Yt(v,"format"),Y=os(E)||hl(E)?.transparent===!0,J=Yt(v,"placeholder")||(T&&!Y?"thumbhash":void 0),re=Yt(v,"placeholderColor")||"#e5e7eb",se=Yt(v,"provider"),ie=Yt(v,"class")||Yt(v,"className")||"",ae=Yt(v,"style")||"",ce=Yt(v,"quality"),oe=oa(v,"lazy",!0),pe=oa(v,"preload",!1),he=oa(v,"priority",!1),xe=Yt(v,"loading"),$e=Yt(v,"decoding")||"async",Re=!!T||oa(v,"picture",!1)||!!H,Ce=B?Number.parseInt(B):void 0,Ae=z?Number.parseInt(z):void 0,Te=V||"",_e="";if(T)Te=T.sources[T.fallback.format]||"",_e=F?xl(F):"100vw";else if(!Te&&F&&se&&se!=="local"&&se!=="static")Te=bl(E,yl,se,H),_e=xl(F);else if(!Te&&U){let ft=U.split(/\s+/).map((ct)=>Number.parseFloat(ct.replace("x","")));Te=Ob(E,ft,Ce,se,H)}else if(F)_e=xl(F);let Pe=[];if(ae)Pe.push(ae);if(Ce&&Ae)Pe.push(`aspect-ratio:${Ce}/${Ae}`);let Me=[],Oe=J==="blur"||J==="color"||J==="thumbhash";if(Oe&&!Y){let ft=T?.placeholder?{dataUrl:T.placeholder.dataUrl,color:re}:hl(E);if(ft&&J==="color")Pe.push(`background-color:${ft.color}`),Me.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"),Me.push("backgroundColor","backgroundImage");else{let ct=Nb(Ce||16,Ae||9,re);Pe.push(`background-image:url(${ct})`),Pe.push("background-size:cover"),Pe.push("background-repeat:no-repeat"),Me.push("backgroundImage")}}else if(!Oe&&J&&J!=="empty"&&J!=="none")Pe.push(`background-image:url(${Ut(J)})`),Pe.push("background-size:cover"),Pe.push("background-repeat:no-repeat"),Me.push("backgroundImage");let Ie=T?.fallback.url||Ji(E,Ce,Ae,se,H),Ne=[];if(Ne.push(`src="${Ut(Ei(Ie,"fetched"))}"`),Ne.push(`alt="${Ut(j)}"`),B)Ne.push(`width="${Ut(B)}"`);if(z)Ne.push(`height="${Ut(z)}"`);let at=xe||(he||pe?"eager":oe?"lazy":"");if(at)Ne.push(`loading="${Ut(at)}"`);if(he)Ne.push('fetchpriority="high"');if(Ne.push(`decoding="${Ut($e)}"`),ie)Ne.push(`class="${Ut(ie)}"`);if(Pe.length>0)Ne.push(`style="${Ut(Pe.join(";"))}"`);if(Te)Ne.push(`srcset="${Ut(Ei(Te,"fetched"))}"`);if(_e)Ne.push(`sizes="${Ut(_e)}"`);let ht=new Set(["src","alt","width","height","lazy","sizes","srcset","placeholder","placeholderColor","class","className","style","format","provider","quality","densities","preload","priority","picture","loading","decoding"]);if(Me.length>0){let ft=typeof v.static.onload==="string"?v.static.onload:"",ct=Mb(Me)+(ft?`;${ft}`:"");Ne.push(`onload="${Ut(ct)}"`),ht.add("onload")}Ne.push(...$r(v,ht)),Ne.push(..._r(v,ht));let dt=`<img ${Ne.join(" ")} />`,rt="";if(pe){let ct=H==="webp"?"image/webp":H==="avif"?"image/avif":"";rt=`<link rel="preload" as="image" href="${Ut(Ie)}"${ct?` type="${ct}"`:""}${Te?` imagesrcset="${Ut(Te)}"`:""}${_e?` imagesizes="${Ut(_e)}"`:""} />
1720
- `}if(Re){let ft=[];if(T)for(let ct of is(T))ft.push(`<source type="image/${ct.format}" srcset="${Ut(ct.srcset)}"${_e?` sizes="${Ut(_e)}"`:""} />`);if(!T&&(H==="avif"||H==="auto")){let ct=Ji(E,Ce,Ae,se,"avif"),vt=Te?bl(E,yl,se,"avif"):`${ct}`;ft.push(`<source type="image/avif" srcset="${Ut(vt)}"${_e?` sizes="${Ut(_e)}"`:""} />`)}if(!T&&(H==="webp"||H==="auto")){let ct=Ji(E,Ce,Ae,se,"webp"),vt=Te?bl(E,yl,se,"webp"):`${ct}`;ft.push(`<source type="image/webp" srcset="${Ut(vt)}"${_e?` sizes="${Ut(_e)}"`:""} />`)}return`${rt}<picture>
1715
+ </script>`}function Kf(v,_,k){if(!Px(v))return v;let E=kx(v);if(E.length===0)return v;let T=Ix(v,E),j=Tx(E,_),B=T.lastIndexOf("</body>");if(B!==-1)T=T.slice(0,B)+j+`
1716
+ `+T.slice(B);else T+=j;return T}function Ix(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 Px(v){return/x-data\s*=\s*["']/.test(v)}function br(v,_){try{let k=v.trim();if(p(k))return c(k,Object.keys(_))(...Object.values(_));else return l(k,_)}catch{return!1}}function vr(v,_){let k=Dx(v,_);return k.ok?{expression:k.expression,endPos:k.endPos}:null}function Dx(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 Mx(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),U=F?F.index:1/0,H=V?V.index:1/0;if(U<H)T++,j=U+F[0].length;else if(H<1/0){if(T--,T===0)return H;j=H+V[0].length}else break}return-1}function Xf(v,_){let k=v.slice(_).match(/^@if\s*/);if(!k)return null;let E=_+k[0].length,T=vr(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,U="if",H=T.expression,Y=0,J=0;while(V<z.length){let re=z.indexOf("@",V);if(re===-1)break;V=re;let se=z.substring(re);if(Mx(z,re)){V++;continue}if(/^@if\s*\(/.test(se)){J++,V++;continue}if(/^@endif(?![a-z])/.test(se)){J--,V+=6;continue}if(J===0){let ie=se.match(/^@elseif\s*/);if(ie){F.push({type:U,condition:H,content:z.substring(Y,V),start:j+Y,end:j+V});let ae=V+ie[0].length,ce=vr(z,ae);if(!ce){V++;continue}U="elseif",H=ce.expression,V=ce.endPos,Y=V;continue}else if(/^@else(?![a-z])/.test(se)){F.push({type:U,condition:H,content:z.substring(Y,V),start:j+Y,end:j+V}),U="else",H=void 0,V+=5,Y=V;continue}}V++}return F.push({type:U,condition:H,content:z.slice(Y),start:j+Y,end:j+z.length}),{fullMatch:v.slice(_,B+6),branches:F,start:_,end:B+6}}function Hi(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=Xf(v,E.index);if(j)_.push(j),k.lastIndex=j.end;E=k.exec(v)}return _}function Vo(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 U=v.slice(F+1,V),H=V+1,Y=Or(v,_,k,H);if(Y===-1){j=T.exec(v);continue}let J=v.slice(H,Y),re=Y+`@${k}`.length;E.push({fullMatch:v.slice(z,re),name:_,params:U,content:J,start:z,end:re}),T.lastIndex=re,j=T.exec(v)}return E}function tl(v,_){let k=v.slice(_).match(/^@switch\s*/);if(!k)return null;let E=_+k[0].length,T=vr(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,U=null,H=0;while(V<z.length){let Y=z.slice(V),J=Y.match(/^@switch\s*\(/),re=Y.match(/^@endswitch(?![a-z])/);if(J){if(H++,U)U.content+=J[0];V+=J[0].length;continue}if(re){if(H--,U)U.content+=re[0];V+=re[0].length;continue}if(H>0){if(U)U.content+=z[V];V++;continue}let se=Y.match(/^@case\s*/),ie=Y.match(/^@default(?![a-z])/),ae=Y.match(/^@break(?![a-z])/);if(se&&Y.startsWith("@case")){if(U)F.push(U);let ce=V+se[0].length,oe=vr(z,ce);if(!oe){V++;continue}U={type:"case",value:oe.expression,content:""},V=oe.endPos}else if(ie&&Y.startsWith("@default")){if(U)F.push(U);U={type:"default",content:""},V+=ie[0].length}else if(ae&&Y.startsWith("@break"))V+=ae[0].length;else{if(U)U.content+=z[V];V++}}if(U)F.push(U);return{fullMatch:v.slice(_,B+10),expression:T.expression,cases:F,start:_,end:B+10}}function Lx(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=tl(E,B);if(!z)break;try{let F;if(p(z.expression))F=c(z.expression,Object.keys(_))(...Object.values(_));else F=l(z.expression,_);let V="",U=!1;for(let H of z.cases)if(H.type==="default"){if(!U)V=H.content.trim()}else try{let Y;if(H.value&&p(H.value))Y=c(H.value,Object.keys(_))(...Object.values(_));else if(H.value)Y=l(H.value,_);if(F===Y){V=H.content.trim(),U=!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),U=i("Switch",`Error evaluating @switch expression: ${V}`,t.EVALUATION_ERROR);E=E.substring(0,B)+U+E.substring(z.end);break}}return E}function Bx(v){let _=[];return{masked:v.replace(/<script\b[\s\S]*?<\/script\s*>/gi,(E)=>(_.push(E),`\x00stx-script-${_.length-1}\x00`)),scripts:_}}function zx(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}=Bx(v);return zx(Wx(E,_,k),T)}function Wx(v,_,k){let E=v;E=Lx(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=vr(E,z+7);if(!F)break;let V=F.endPos,U=Or(E,"unless","endunless",V);if(U===-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 H=E.slice(V,U),Y=F.expression,J=-1;{let se=0,ie=/@(?:if|unless)\s*\(/g,ae=/@(?:endif|endunless)(?![a-z])/g,ce=/@else(?![a-z])/g,oe=[],pe;while((pe=ie.exec(H))!==null)oe.push({pos:pe.index,type:"open"});while((pe=ae.exec(H))!==null)oe.push({pos:pe.index,type:"close"});while((pe=ce.exec(H))!==null)oe.push({pos:pe.index,type:"else"});oe.sort((he,xe)=>he.pos-xe.pos);for(let he of oe)if(he.type==="open")se++;else if(he.type==="close")se--;else if(he.type==="else"&&se===0){J=he.pos;break}}let re;if(J!==-1){let se=H.slice(0,J),ie=H.slice(J+5);re=`@if (${Y})${ie}@else ${se}@endif`}else re=`@if (!(${Y}))${H}@endif`;E=E.substring(0,z)+re+E.substring(U+10),j=!0}}E=rl(E,_,k),E=sl(E,_,k),E=nl(E,_);let T=()=>{let j=Hi(E);if(j.length===0)return!1;let B=Array(j.length);for(let V=j.length-1;V>=0;V--){let U=j[V];try{let H="",Y=!1;for(let J of U.branches){if(Y)break;if(J.type==="else")H=J.content,Y=!0;else try{if(J.condition?Mi(J.condition,_):!1)H=J.content,Y=!0}catch(re){H=i(J.type==="if"?"If":"Elseif",`Error in @${J.type}(${J.condition}): ${re instanceof Error?re.message:String(re)}`,t.EVALUATION_ERROR),Y=!0}}B[V]=H}catch(H){let Y=H instanceof Error?H.message:String(H);B[V]=i("If",`Error processing @if block: ${Y}`,t.EVALUATION_ERROR)}}let z=Array(j.length*2+1),F=0;for(let V=0;V<j.length;V++){let U=j[V];z[V*2]=E.slice(F,U.start),z[V*2+1]=B[V],F=U.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 Zf(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 nl(v,_){let k=v;function E(z,F,V,U){let H=1,Y=U,J=new RegExp(`@${F}(?:\\s*\\(|\\s|$)`,"g"),re=new RegExp(`@${V}(?![a-z])`,"g");while(Y<z.length&&H>0){J.lastIndex=Y,re.lastIndex=Y;let se=J.exec(z),ie=re.exec(z),ae=se?se.index:1/0,ce=ie?ie.index:1/0;if(ae<ce)H++,Y=ae+se[0].length;else if(ce<1/0){if(H--,H===0)return ce;Y=ce+ie[0].length}else break}return-1}function T(z,F,V){let U=0,H=new RegExp(`@${F}(?:\\s*\\(|\\s|$)`,"g"),Y=new RegExp(`@${V}(?![a-z])`,"g"),J=/@else(?![a-z])/g,re=[],se;while((se=H.exec(z))!==null)re.push({pos:se.index,type:"open"});while((se=Y.exec(z))!==null)re.push({pos:se.index,type:"close"});while((se=J.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")U++;else if(ie.type==="close")U--;else if(ie.type==="else"&&U===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,U,H,Y=k.slice(V+5),J=Zf(Y);if(J)U=J.value,H=V+5+J.consumed;else H=V+5;let re=E(k,"auth","endauth",H);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(H,re),ie=T(se,"auth","endauth"),ae;if(!_.auth)ae=!1;else ae=U?br(`auth?.check && auth?.user?.[${U}]`,_):br("auth?.check",_);let ce;if(ie!==-1){let oe=se.slice(0,ie),pe=se.slice(ie+5);ce=ae?oe:pe}else ce=ae?se:"";k=k.substring(0,V)+ce+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,U,H,Y=k.slice(V+6),J=Zf(Y);if(J)U=J.value,H=V+6+J.consumed;else H=V+6;let re=E(k,"guest","endguest",H);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(H,re),ie=T(se,"guest","endguest"),ae;if(!_.auth)ae=!0;else ae=U?br(`!auth?.check || !auth?.user?.[${U}]`,_):br("!auth?.check",_);let ce;if(ie!==-1){let oe=se.slice(0,ie),pe=se.slice(ie+5);ce=ae?oe:pe}else ce=ae?se:"";k=k.substring(0,V)+ce+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 U=[z];if(F)U.push(F);if(V){let H=br(V,_);U.push(H)}return _.permissions.check(...U)}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",U=!0;while(U){U=!1;let H=k.match(new RegExp(`@${z}\\s*\\(`));if(!H||H.index===void 0)break;let Y=H.index,J=k.slice(Y+`@${z}`.length),re=B(J);if(!re)break;let se=Y+`@${z}`.length+re.paramsEnd,ie=E(k,z,F,se);if(ie===-1){console.warn(`[stx] @${z} directive at position ${Y} has no matching @${F} \u2014 the block was skipped.`);break}let ae=k.slice(se,ie),ce=[],oe=0,pe=new RegExp(`@${z}\\s*\\(`,"g"),he=new RegExp(`@${F}(?![a-z])`,"g"),xe=new RegExp(`@${V}\\s*\\(`,"g"),$e=/@else(?![a-z])/g,Re=[],Ce;while((Ce=pe.exec(ae))!==null)Re.push({pos:Ce.index,type:"open"});while((Ce=he.exec(ae))!==null)Re.push({pos:Ce.index,type:"close"});while((Ce=xe.exec(ae))!==null)Re.push({pos:Ce.index,type:"elseDirective"});while((Ce=$e.exec(ae))!==null)Re.push({pos:Ce.index,type:"else"});Re.sort((Me,Ie)=>Me.pos-Ie.pos);for(let Me of Re){if(Me.type==="open"){oe++;continue}if(Me.type==="close"){oe--;continue}if(oe===0)ce.push(Me)}let Ae=[],Te=0;for(let Me=0;Me<ce.length;Me++){let Ie=ce[Me];if(Ae.push({content:ae.slice(Te,Ie.pos),ability:void 0}),Ie.type==="elseDirective"){let Ne=ae.slice(Ie.pos+`@${V}`.length),at=B(Ne);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 ht=ce[Me+1],dt=ht?ht.pos:ae.length;Ae.push({content:ae.slice(Te,dt),ability:at.ability,type:at.type,id:at.id}),Te=dt}}else Te=Ie.pos+5}if(Te<ae.length){let Me=Ae[Ae.length-1];if(ce.length>0&&ce[ce.length-1].type==="else")Ae.push({content:ae.slice(Te),isFinalElse:!0});else if(Ae.length===0)Ae.push({content:ae.slice(Te)})}let _e=j(re.ability,re.type,re.id),Pe=z==="can"?_e:!_e,Oe="";if(Pe)Oe=Ae[0]?.content||"";else{let Me=!1;for(let Ie=1;Ie<Ae.length;Ie++){let Ne=Ae[Ie];if(Ne.isFinalElse){Oe=Ne.content,Me=!0;break}if(Ne.ability){let at=j(Ne.ability,Ne.type,Ne.id);if(z==="can"?at:!at){Oe=Ne.content,Me=!0;break}}}if(!Me&&Ae.length>0){let Ie=Ae[Ae.length-1];if(Ie.isFinalElse)Oe=Ie.content}}k=k.substring(0,Y)+Oe+k.substring(ie+`@${F}`.length),U=!0}}return k}function rl(v,_,k){let E=v;function T(j,B,z,F,V){let U=!0;while(U){U=!1;let H=new RegExp(`@${B}\\s*\\(`),Y=j.match(H);if(!Y||Y.index===void 0)break;let J=Y.index,re=vr(j,J+`@${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 ${J} has no matching @${z} \u2014 the block was skipped.`);break}let ae=j.slice(se,ie),ce=re.expression,oe=-1,pe=0,he=0;while(he<ae.length){let xe=ae.indexOf("@",he);if(xe===-1)break;let $e=ae.substring(xe);if(/^@(?:if|unless|isset|empty)\s*\(/.test($e)){pe++,he=xe+1;continue}if(/^@(?:endif|endunless|endisset|endempty)(?![a-z])/.test($e)){pe--,he=xe+1;continue}if(pe===0&&/^@else(?![a-z])/.test($e)){oe=xe;break}he=xe+1}try{let xe=F(ce.trim()),$e;if(oe!==-1){let Re=ae.slice(0,oe),Ce=ae.slice(oe+5);$e=xe?Re:Ce}else $e=xe?ae:"";j=j.substring(0,J)+$e+j.substring(ie+`@${z}`.length),U=!0}catch(xe){let $e=xe instanceof Error?xe.message:String(xe),Re=i(V,`Error processing @${B} directive: ${$e}`,t.EVALUATION_ERROR);j=j.substring(0,J)+Re+j.substring(ie+`@${z}`.length);break}}return j}return E=T(E,"isset","endisset",(j)=>{let B=br(j,_);return B!==void 0&&B!==null},"Isset"),E=T(E,"empty","endempty",(j)=>{let B=br(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 sl(v,_,k){let E=v,T="development";function j(B,z,F,V){let U=new RegExp(`@${z}(?![a-z])`,"g"),H=new RegExp(`@${F}(?![a-z])`,"g"),Y=new RegExp(`^@${z}(?![a-z])`),J=new RegExp(`^@${F}(?![a-z])`),re=B,se=!0;while(se){se=!1,U.lastIndex=0;let ie=U.exec(re);if(!ie)break;let ae=ie.index,ce=ae+ie[0].length;if(z==="env"){let _e=re.substring(ce).match(/^\s*\(\s*(['"])([^'"]+)\1\s*\)/);if(!_e)break;ce+=_e[0].length,V=T===_e[2]}let oe=1,pe=ce,he=-1;while(oe>0&&pe<re.length){U.lastIndex=pe,H.lastIndex=pe;let _e=U.exec(re),Pe=H.exec(re),Oe=_e?_e.index:1/0,Me=Pe?Pe.index:1/0;if(Oe<Me)oe++,pe=Oe+_e[0].length;else if(Me<1/0){if(oe--,oe===0){he=Me;break}pe=Me+Pe[0].length}else break}if(he===-1){console.warn(`[stx] @${z} directive at position ${ae} has no matching @${F} \u2014 the block was skipped.`);break}let xe=re.substring(ce,he),$e=-1,Re=0,Ce=0;while(Ce<xe.length){let _e=xe.indexOf("@",Ce);if(_e===-1)break;let Pe=xe.substring(_e);if(Y.test(Pe)){Re++,Ce=_e+1;continue}if(J.test(Pe)){Re--,Ce=_e+1;continue}if(Re===0&&/^@else(?![a-z])/.test(Pe)){$e=_e;break}Ce=_e+1}let Ae;if($e!==-1){let _e=xe.slice(0,$e),Pe=xe.slice($e+5);Ae=V?_e:Pe}else Ae=V?xe:"";let Te=`@${F}`.length;re=re.substring(0,ae)+Ae+re.substring(he+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 Gf=new WeakMap;function Jf(v=16){let _=new Uint8Array(v);return crypto.getRandomValues(_),btoa(String.fromCharCode(..._))}function Uo(v,_){if(!v)return _?.nonceGenerator?.()??Jf();let k=Gf.get(v);if(!k)k=_?.nonceGenerator?.()??Jf(),Gf.set(v,k);return k}function Fx(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 Yf(v,_){return`<meta http-equiv="Content-Security-Policy" content="${Fx(v,_).replace(/&/g,"&amp;").replace(/"/g,"&quot;")}">`}function Qf(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?Uo(k,_):void 0,T=Yf(_.directives,E);return v.replace(/<head([^>]*)>/,`<head$1>
1717
+ ${T}`)}function ep(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 tp(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?Uo(_,j):void 0;return Yf(j.directives,B)}),T=T.replace(/@cspNonce\b/g,()=>{if(!j?.enabled||!j.useNonce)return"";return Uo(_,j)}),j?.enabled&&j.useNonce)_.cspNonce=Uo(_,j);return T}import Vx from"crypto";var Ux=40,np="_token",il=null;function Hx(v=Ux){let _=Vx.randomBytes(Math.ceil(v/2)).toString("hex").slice(0,v);return il=_,_}function qx(){if(!il)Hx();return il}function Kx(v=np){let _=qx();return`<input type="hidden" name="${v}" value="${_}">`}function rp(v){return v.replace(/@csrf(?:\((['"])([^'"]*)\1\))?/g,(_,k,E)=>Kx(E||np))}async function sp(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 Xx(T,j,_,k,E);else T=await Zx(T,j,_,k,E)}return T}async function Xx(v,_,k,E,T){let{name:j,handler:B}=_,z=`@${j}`,F=`@end${j}`,V=v,U=Cr(`${z}(?:\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\))?([\\s\\S]*?)${F}`,"g"),H=[],Y=U.exec(V);while(Y!==null){let[J,re="",se=""]=Y,ie=Y.index||0;try{let ae=re?ip(_,re):[],ce=se.trim(),oe=await B(ce,ae,k,E);H.push({original:J,processed:oe,startIndex:ie})}catch(ae){let ce=ae instanceof Error?ae.message:String(ae);if(T.debug)console.error(`Error processing custom directive @${j}:`,ae);H.push({original:J,processed:i("CustomDirective",`Error in @${j}${re?`(${re})`:""}: ${ce}`,t.EVALUATION_ERROR),startIndex:ie})}Y=U.exec(V)}for(let J=H.length-1;J>=0;J--){let{original:re,processed:se}=H[J];V=V.replace(re,se)}return V}async function Zx(v,_,k,E,T){let{name:j,handler:B}=_,z=v,F=[],V=[];if(_.rawParams){for(let Y of Os(z,Cr(`(?<![\\w$@])@${j}\\s*\\(`,"g")))if(Y.end!==-1)V.push({fullMatch:Y.call,paramString:Y.args,startIndex:Y.start})}else{let Y=Cr(`@${j}\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\)`,"g");Y.lastIndex=0;let J=Y.exec(z);while(J!==null)V.push({fullMatch:J[0],paramString:J[1]??"",startIndex:J.index||0}),J=Y.exec(z)}for(let{fullMatch:Y,paramString:J,startIndex:re}of V)try{let se=ip(_,J),ie=await B("",se,k,E);F.push({original:Y,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:Y,processed:i("CustomDirective",`Error in @${j}(${J}): ${ie}`,t.EVALUATION_ERROR),startIndex:re})}let U=Cr(`@${j}(?!\\w)(?!\\s*\\()`,"g"),H=U.exec(z);while(H!==null){let[Y]=H,J=H.index||0;try{let re=await B("",[],k,E);F.push({original:Y,processed:re,startIndex:J})}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:Y,processed:i("CustomDirective",`Error in @${j}: ${se}`,t.EVALUATION_ERROR),startIndex:J})}H=U.exec(z)}for(let Y=F.length-1;Y>=0;Y--){let{original:J,processed:re}=F[Y];z=z.replace(J,re)}return z}function ip(v,_){return v.rawParams?Ze(_):Gx(_)}function Gx(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 op=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,ap=/^[A-Za-z_$][\w$]*$/,Jx=new Set(["light","dark","system"]);function Nr(v,_){if(typeof v!=="string"||v.length===0)throw Error(`@appearanceBootstrap ${_} must be a non-empty string`)}function Yx(v){if(!v||typeof v!=="object"||Array.isArray(v))throw Error("@appearanceBootstrap expects an options object");let _=v,{appearance:k,colorMode:E}=_;if(Nr(_.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(Nr(E.key,"colorMode.key"),Nr(E.attribute,"colorMode.attribute"),Nr(E.default,"colorMode.default"),!ap.test(E.key))throw Error("@appearanceBootstrap preference keys must be JavaScript property names");if(!op.test(E.attribute))throw Error("@appearanceBootstrap attributes must be lowercase data attribute names");if(!Jx.has(E.default))throw Error("@appearanceBootstrap colorMode.default must be light, dark, or system");let T=null;if(k){if(Nr(k.key,"appearance.key"),Nr(k.attribute,"appearance.attribute"),Nr(k.default,"appearance.default"),!ap.test(k.key))throw Error("@appearanceBootstrap preference keys must be JavaScript property names");if(!op.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 Qx(v){return JSON.stringify(v).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function eb(v){return`<script data-stx-scoped data-stx-appearance-bootstrap>(function(){"use strict";const config=${Qx(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 tb(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 cp(v,_){let k=v,E=/@appearanceBootstrap\s*\(/g,T;while((T=E.exec(k))!==null){let j=T.index+T[0].length-1,B=tb(k,j);if(B===-1)throw Error("@appearanceBootstrap has an unclosed options object");let z=k.slice(j+1,B).trim(),F=l(`(${z})`,_),V=eb(Yx(F));k=k.slice(0,T.index)+V+k.slice(B+1),E.lastIndex=T.index+V.length}return k}import nb from"crypto";function Ht(v){return String(v??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}var up={input:"form-control",inputError:"is-invalid",checkInput:"form-check-input",label:"form-label",errorFeedback:"invalid-feedback"};function Ho(v,_,k,E){let T=v||_;return k?`${T} ${E}`:T}function _n(v){return String(v).replace(/\[\]$/,"").replace(/[^\w.:-]+/g,"-").replace(/^-+|-+$/g,"")}function Ws(v,_){if(/\bid\s*=/i.test(v))return"";return` id="${Ht(_)}"`}function ol(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="${Ht(`${_n(v)}-error`)}"`;return E}function rb(){return nb.randomUUID()}function ea(v,_){let k=v;return k=k.replace(/@csrf/g,()=>{if(!_.csrf||typeof _.csrf!=="object"){let E=rb();_.csrf={token:E}}if(_.csrf.field)return _.csrf.field;if(_.csrf.token)return`<input type="hidden" name="_token" value="${Ht(_.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="${Ht(j)}">`;return E}),k}function dp(v,_,k=up){let E=v;return E=E.replace(/@form\(\s*(?:(?:'([^']+)'|"([^"]+)")\s*)?(?:,\s*(?:'([^']+)'|"([^"]+)")?)?\s*(?:,\s*\{([^}]+)\}\s*)?\)/g,(T,j,B,z,F,V="")=>{let U=j||B||"POST",H=z||F||"",Y=wr(V),J=U.toUpperCase(),re=["GET","POST"].includes(J)?J:"POST",se=`<form method="${Ht(re)}" action="${Ht(H)}"${Y?` ${Y}`:""}>`;if(se+=`
1718
+ ${ea("@csrf",_)}`,!["GET","POST"].includes(J))se+=`
1719
+ ${ea(`@method('${J}')`,_)}`;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 U=j||B||"",H=z||F||"",Y=wr(V),J=qi(U,_),re=J!==void 0&&J!==null?J:H||"",se=Y.match(/type=['"]([^'"]+)['"]/i),ie=se?se[1]:"text",ae=Ki(U,_),ce=Y.match(/class=['"]([^'"]+)['"]/i),oe=Ho(ce?ce[1]:"",k.input,ae,k.inputError),pe=Y.replace(/class=['"][^'"]+['"]/i,"");return pe=pe.replace(/type=['"][^'"]+['"]/i,""),`<input type="${Ht(ie)}" name="${Ht(U)}"${Ws(Y,_n(U))} value="${Ht(re)}" class="${oe}"${ol(U,ae,Y)}${pe?` ${pe}`:""}>`}),E=E.replace(/@textarea\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endtextarea/g,(T,j,B="",z="")=>{let F=wr(B),V=qi(j,_)||z.trim(),U=Ki(j,_),H=F.match(/class=['"]([^'"]+)['"]/i),Y=Ho(H?H[1]:"",k.input,U,k.inputError),J=F.replace(/class=['"][^'"]+['"]/i,"");return`<textarea name="${Ht(j)}"${Ws(F,_n(j))} class="${Y}"${ol(j,U,F)}${J?` ${J}`:""}>${Ht(V)}</textarea>`}),E=E.replace(/@select\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endselect/g,(T,j,B="",z)=>{let F=wr(B),V=qi(j,_),U=Ki(j,_),H=F.match(/class=['"]([^'"]+)['"]/i),Y=Ho(H?H[1]:"",k.input,U,k.inputError),J=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="${Ht(j)}"${Ws(F,_n(j))} class="${Y}"${ol(j,U,F)}${J?` ${J}`:""}>${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)}`,U=wr(z),H=qi(j,_),Y=H!==void 0&&(Array.isArray(H)?H.some((ie)=>String(ie)===F):H===!0||String(H)===F),J=U.match(/class=['"]([^'"]+)['"]/i),re=J?J[1]:k.checkInput,se=U.replace(/class=['"][^'"]+['"]/i,"");return`<input type="checkbox" name="${Ht(j)}"${Ws(U,V)} value="${Ht(F)}" class="${re}"${Y?" checked":""}${se?` ${se}`:""}>`}),E=E.replace(/@radio\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(T,j,B,z="")=>{let F=wr(z),V=qi(j,_),U=V!==void 0&&V===B,H=F.match(/class=['"]([^'"]+)['"]/i),Y=H?H[1]:k.checkInput,J=F.replace(/class=['"][^'"]+['"]/i,"");return`<input type="radio" name="${Ht(j)}"${Ws(F,`${_n(j)}-${_n(B)}`)} value="${Ht(B)}" class="${Y}"${U?" checked":""}${J?` ${J}`:""}>`}),E=E.replace(/@file\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(T,j,B="")=>{let z=wr(B),F=z.match(/accept=['"]([^'"]+)['"]/i),V=F?F[1]:"",U=z.includes("multiple"),H=Ki(j,_),Y=z.match(/class=['"]([^'"]+)['"]/i),J=Ho(Y?Y[1]:"",k.input,H,k.inputError),re=z.replace(/class=['"][^'"]+['"]/gi,"").replace(/accept=['"][^'"]+['"]/gi,"").replace(/\bmultiple\b/gi,"").trim(),se=[`<input type="file" name="${Ht(j)}"${Ws(z,_n(j))}`,`class="${J}"`];if(V)se.push(`accept="${Ht(V)}"`);if(U)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=wr(B),V=F.match(/class=['"]([^'"]+)['"]/i),U=V?V[1]:k.label,H=F.replace(/class=['"][^'"]+['"]/i,"");return`<label for="${Ht(_n(j))}" class="${U}"${H?` ${H}`:""}>${z}</label>`}),E}function fp(v,_,k=up){return v.replace(/@error\(['"]([^'"]+)['"]\)([\s\S]*?)@enderror/g,(E,T,j)=>{try{if(Ki(T,_)){let B=j.replace(/\{\{([^}]+)\}\}/g,(z,F)=>{try{if(F.trim()==="$message"||F.trim()==="message")return lp(T,_);if(F.trim().includes("errors.first")||F.trim().includes("$errors.first")){if(typeof _.errors?.first==="function")return _.errors.first(T);return lp(T,_)}let V=F.trim();if(p(V)){let U=l(V,_);return U!==void 0?String(U):V}return V}catch{return F}});return`<div id="${Ht(`${_n(T)}-error`)}" role="alert">${B}</div>`}return""}catch(B){return console.error("Error processing @error directive:",B),E}})}function Ki(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 lp(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 qi(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 wr(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 Xi=/<\/?template\b[^>]*>/gi,sb=/(?:^|\s)(?:id\s*=|(?:x-|[@:])(?:for|if|else(?:-if)?)(?=\s|=|$)|#[\w-]+(?:\s*=|\s|$)|v-slot(?::[\w-]+)?(?=\s|=|$)|slot\s*=)/i;function ib(v){let _=v.replace(/^<template\b/i,"").replace(/>$/,"");return sb.test(_)}function Q(v){Xi.lastIndex=0;let _;while((_=Xi.exec(v))!==null){if(_[0].startsWith("</")||ib(_[0]))continue;let k=_.index,E=Xi.lastIndex,T=1,j;while((j=Xi.exec(v))!==null)if(j[0].startsWith("</")){if(T--,T===0){let B=j.index;return{start:k,openEnd:E,closeStart:B,end:Xi.lastIndex,content:v.slice(E,B)}}}else T++;return null}return null}import Bt from"path";import{existsSync as Av}from"fs";class pp{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=Na(v,E);if(T!==void 0)return T;for(let j of ja(v,_,k,E))if(await r(j))return j;return null}}var Fs=new pp;function Lt(v){return v.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}var Sr="\x00stx-boolean-attribute";function al(v){return v.indexOf("\x00")===-1?v:v.replace(/\0/g,"")}var ob=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 cl(v){let _=v.toLowerCase();return _.startsWith("aria-")||_.startsWith("data-")||ob.has(_)}function $r(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===Sr){k.push(Lt(j));continue}k.push(`${Lt(j)}="${Lt(al(String(T)))}"`)}return k}function _r(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(al(String(T)))}"`)}return k}function Us(v){return v.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function ab(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 ll={name:"StxLink",aliases:["stx-link"],render(v,_,k){let E=ab(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="${Us(E.value)}"`);else F.push(`href="${Us(Ei(E.value,"navigable"))}"`);if(T)F.push(`class="${Us(T)}"`);if(F.push("data-stx-link"),F.push(`data-stx-active-class="${Us(j)}"`),F.push(`data-stx-exact-active-class="${Us(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="${Us(V)}"`);let U=new Set(["to","class","className","activeClass","exactActiveClass","activeMatch","prefetch"]);return F.push(...$r(v,U)),F.push(..._r(v,U)),`<a ${F.join(" ")}>${_}</a>`}};import{createHash as Ep}from"crypto";import en from"fs";import Kt from"path";import{decode as mb,generateThumbHash as hb}from"ts-images";import{createImageDeliveryCatalog as bp}from"ts-images/delivery";import ul from"fs";function ta(v,_,k){let E=Buffer.alloc(k),T=ul.readSync(v,E,0,k,_);return E.subarray(0,T)}function dl(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 fl(v){let _;try{_=ul.openSync(v,"r");let k=ta(_,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=ta(_,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(dl(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)ul.closeSync(_)}}import cb from"fs";import na from"os";import{join as gp}from"path";import{fileURLToPath as mp}from"url";import{Worker as hp}from"worker_threads";var sa=Symbol("stx.image-worker.unavailable");function lb(v=typeof na.availableParallelism==="function"?na.availableParallelism():na.cpus().length){return Math.max(1,Math.min(2,v-1))}var ra=0,xp=[];async function ub(){if(ra<lb()){ra++;return}await new Promise((v)=>xp.push(v)),ra++}function db(){ra--,xp.shift()?.()}var fb="@stacksjs/stx/builtins/image-warmup-worker";function pb(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:"&&cb.existsSync(mp(k)))return mp(k)}catch{}try{let k=typeof Bun<"u"?Bun.resolveSync(fb,v):void 0;return k&&gb(k)?k:void 0}catch{return}}function gb(v,_=process.env){let k=v.replace(/\\/g,"/");if(k.split("/").some((T)=>/@\d[^/]*@@@\d+$/.test(T)))return!1;return![_.BUN_INSTALL_CACHE_DIR,gp(_.BUN_INSTALL||gp(na.homedir(),".bun"),"install","cache")].filter((T)=>!!T).map((T)=>`${T.replace(/\\/g,"/").replace(/\/$/,"")}/`).some((T)=>k.startsWith(T))}var yp=!1;function Zi(v){if(!yp)yp=!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 sa}function pl(v){return v instanceof Error?v.message:String(v)}async function gl(v,_){if(typeof hp!=="function")return Zi("node:worker_threads has no Worker in this runtime");let k=pb();if(!k)return Zi("no image-warmup-worker entry beside this module or in the installed @stacksjs/stx");await ub();try{return await new Promise((E,T)=>{let j;try{j=new hp(k)}catch(V){E(Zi(`could not start ${k}: ${pl(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 U=Error(V.error?.message??"image worker failed");if(V.error?.name)U.name=V.error.name;if(V.error?.stack)U.stack=V.error.stack;F(()=>T(U))}),j.on("error",(V)=>{F(()=>B?T(V instanceof Error?V:Error(pl(V)||"image worker crashed")):E(Zi(`the worker failed before it was ready: ${pl(V)}`)))}),j.on("exit",(V)=>{F(()=>B?T(Error("image worker exited before it finished")):E(Zi(`the worker exited with code ${V} before it was ready`)))})})}finally{db()}}var yb=new Set([".avif",".jpeg",".jpg",".png",".webp"]),xb=[320,640,960,1280,1920],Gi="/_stx/images",bb=`stx:${Gi}:alpha-1`,vb=`stx:${Gi}:opaque-1`,wb=["@stacksjs/ts-webp","@stacksjs/ts-avif","ts-images"],ia;function Sb(v,_){let k=Kt.dirname(Bun.resolveSync(v,_));while(k!==Kt.dirname(k)){let E=Kt.join(k,"package.json");if(en.existsSync(E)){let T=JSON.parse(en.readFileSync(E,"utf8"));if(T.name===v)return T.version}k=Kt.dirname(k)}return}function vp(){if(ia!==void 0)return ia;let v;try{v=Kt.dirname(Bun.resolveSync("ts-images",import.meta.dir))}catch{}return ia=wb.map((_)=>{let k;try{k=v?Sb(_,v):void 0}catch{}return`${_.replace("@stacksjs/","")}@${k??"unknown"}`}).join("+"),ia}var wp=Symbol.for("stx.image-delivery");function Ji(){let v=globalThis;return v[wp]??={catalog:new Map,transparent:new Set},v[wp]}var Sp=new Set;function $b(v){return`/${v.split(Kt.sep).map(encodeURIComponent).join("/")}`}function _b(v){let _=Kt.extname(v),k=v.slice(0,-_.length).replace(/[^a-zA-Z0-9_-]+/g,"-").replace(/^-+|-+$/g,""),E=Ep("sha256").update(v).digest("hex").slice(0,8);return`${k||"image"}-${E}`}function $p(v,_=`stx:${Gi}`){let k=(E)=>`${Gi}/${E.split("/").map(encodeURIComponent).join("/")}`;return{cacheNamespace:_,async stat(E){let T=Kt.join(v,E);try{let j=await en.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=Kt.join(v,E);await en.promises.mkdir(Kt.dirname(j),{recursive:!0});let B=`${j}.${process.pid}.tmp`;return await en.promises.writeFile(B,T),await en.promises.rename(B,j),{bytes:T.byteLength,path:j,url:k(E)}},url:k}}async function Cp(v,_=v){let k=await en.promises.readdir(_,{withFileTypes:!0});k.sort((T,j)=>T.name.localeCompare(j.name));let E=[];for(let T of k){let j=Kt.join(_,T.name);if(T.isDirectory()){E.push(...await Cp(v,j));continue}if(!T.isFile()||!yb.has(Kt.extname(T.name).toLowerCase()))continue;E.push({absolutePath:j,relativePath:Kt.relative(v,j)})}return E}function _p(v,_){return v.map((k)=>({key:$b(k.relativePath),input:k.absolutePath,name:_b(k.relativePath),...kb(k.absolutePath)?{options:{storage:_}}:{}}))}function kb(v){return fl(v)==="possible"}function Eb(v){for(let _=3;_<v.length;_+=4)if(v[_]!==255)return!0;return!1}async function Cb(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 mb(new Uint8Array(await en.promises.readFile(z?.path??B.fallback.path)));if(Eb(F.data))k.add(j)}catch{k.add(j)}}));return k}function Rb(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=en.openSync(z.path,"r"),!dl(ta(F,0,32))}catch{return!0}finally{if(F!==void 0)en.closeSync(F)}}))continue;if(T.variants=T.variants.filter((z)=>z.format!=="webp"),delete T.sources.webp,k.push(E),!Sp.has(E))Sp.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 Ab(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 hb(B.absolutePath),B}catch{return console.warn(`[stx-images] Skipping unreadable raster: ${B.relativePath}`),null}}));_.push(...j.filter((B)=>B!==null))}return _}function ml(v){return Kt.join(v,"undecodable.json")}function Tb(v){try{let _=en.readFileSync(ml(v),"utf-8"),k=JSON.parse(_);return k&&typeof k==="object"?k:{}}catch{return{}}}function Ib(v,_){try{en.mkdirSync(Kt.dirname(ml(v)),{recursive:!0}),en.writeFileSync(ml(v),JSON.stringify(_))}catch{}}function kp(v){try{let _=en.statSync(v);return{mtimeMs:_.mtimeMs,size:_.size}}catch{return}}function Rp(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 ss(v){let _=Rp(v);return _?Ji().catalog.get(_):void 0}function os(v){let _=Rp(v);return _?Ji().transparent.has(_):!1}function is(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 Jd(v){let _=ss(v);if(!_)return;return{src:_.fallback.url,srcset:_.sources[_.fallback.format]||"",sources:is(_).map(({format:k,srcset:E})=>({type:`image/${k}`,srcset:E})),width:_.source.width,height:_.source.height,placeholder:os(v)?void 0:_.placeholder?.dataUrl}}function qn(){let v=Ji();v.catalog=new Map,v.transparent=new Set}function Pb(v){let _=Ji();_.catalog=new Map(v.entries),_.transparent=new Set(v.transparent)}async function Yd(v,_,k={}){if(!v||!en.existsSync(v))return qn(),{count:0,fingerprint:""};if(k.offThread){let re=await gl("delivery",{publicDir:v,outputDir:_});if(re!==sa)return Pb(re.state),re.result}let E=await Cp(v);if(E.length===0)return qn(),{count:0,fingerprint:""};let T=Tb(_),j=E.filter((re)=>{let se=T[re.relativePath];if(!se)return!0;let ie=kp(re.absolutePath);return!ie||ie.mtimeMs!==se.mtimeMs||ie.size!==se.size});if(j.length===0)return qn(),{count:0,fingerprint:""};let B=$p(Kt.join(_,"_stx","images"),`${bb}:${vp()}`),z={outDir:Kt.join(_,"_stx","images"),storage:$p(Kt.join(_,"_stx","images"),`${vb}:${vp()}`),baseUrl:Gi,widths:xb,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 bp({...z,entries:_p(j,B)})}catch(re){if(F=await Ab(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 ce=kp(ae.absolutePath);if(!ce)continue;T[ae.relativePath]=ce,ie=!0}if(ie)Ib(_,T);if(F.length===0)return qn(),{count:0,fingerprint:""};V=await bp({...z,entries:_p(F,B)})}let U=await Cb(V.entries),H=Rb(V.entries,U),Y=Ji();Y.catalog=new Map(Object.entries(V.entries)),Y.transparent=U;let J=U.size===0&&H.length===0?V.fingerprint:Ep("sha256").update(V.fingerprint).update(JSON.stringify({transparent:[...U].sort(),droppedWebp:H.sort()})).digest("hex");return{count:F.length,fingerprint:J}}var Db=new Map;function hl(v){if(!v)return;let _=v.split("?")[0].split("#")[0];return Db.get(_)}var Mb={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},yl=[320,640,768,1024,1280,1536,1920];function Ut(v){return v.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Yt(v,_){if(v.serverDynamic[_]!==void 0)return String(v.serverDynamic[_]);let k=v.static[_];if(typeof k==="string")return k;return}function oa(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 xl(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=Mb[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 bl(v,_,k,E){return _.map((T)=>`${Yi(v,T,void 0,k,E)} ${T}w`).join(", ")}function Ob(v,_,k,E,T){return _.map((j)=>{let B=k?k*j:void 0;return`${Yi(v,B,void 0,E,T)} ${j}x`}).join(", ")}function Yi(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 Nb(v){return`var s=this.style;${v.map((_)=>`s.${_}=''`).join(";")}`}function jb(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 vl={name:"StxImage",aliases:["Image","stx-image","stx-img"],render(v,_,k){let E=Yt(v,"src")||"",T=ss(E),j=Yt(v,"alt")||"",B=Yt(v,"width")||(T?String(T.source.width):void 0),z=Yt(v,"height")||(T?String(T.source.height):void 0),F=Yt(v,"sizes"),V=Yt(v,"srcset"),U=Yt(v,"densities"),H=Yt(v,"format"),Y=os(E)||hl(E)?.transparent===!0,J=Yt(v,"placeholder")||(T&&!Y?"thumbhash":void 0),re=Yt(v,"placeholderColor")||"#e5e7eb",se=Yt(v,"provider"),ie=Yt(v,"class")||Yt(v,"className")||"",ae=Yt(v,"style")||"",ce=Yt(v,"quality"),oe=oa(v,"lazy",!0),pe=oa(v,"preload",!1),he=oa(v,"priority",!1),xe=Yt(v,"loading"),$e=Yt(v,"decoding")||"async",Re=!!T||oa(v,"picture",!1)||!!H,Ce=B?Number.parseInt(B):void 0,Ae=z?Number.parseInt(z):void 0,Te=V||"",_e="";if(T)Te=T.sources[T.fallback.format]||"",_e=F?xl(F):"100vw";else if(!Te&&F&&se&&se!=="local"&&se!=="static")Te=bl(E,yl,se,H),_e=xl(F);else if(!Te&&U){let ft=U.split(/\s+/).map((ct)=>Number.parseFloat(ct.replace("x","")));Te=Ob(E,ft,Ce,se,H)}else if(F)_e=xl(F);let Pe=[];if(ae)Pe.push(ae);if(Ce&&Ae)Pe.push(`aspect-ratio:${Ce}/${Ae}`);let Oe=[],Me=J==="blur"||J==="color"||J==="thumbhash";if(Me&&!Y){let ft=T?.placeholder?{dataUrl:T.placeholder.dataUrl,color:re}:hl(E);if(ft&&J==="color")Pe.push(`background-color:${ft.color}`),Oe.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"),Oe.push("backgroundColor","backgroundImage");else{let ct=jb(Ce||16,Ae||9,re);Pe.push(`background-image:url(${ct})`),Pe.push("background-size:cover"),Pe.push("background-repeat:no-repeat"),Oe.push("backgroundImage")}}else if(!Me&&J&&J!=="empty"&&J!=="none")Pe.push(`background-image:url(${Ut(J)})`),Pe.push("background-size:cover"),Pe.push("background-repeat:no-repeat"),Oe.push("backgroundImage");let Ie=T?.fallback.url||Yi(E,Ce,Ae,se,H),Ne=[];if(Ne.push(`src="${Ut(Ei(Ie,"fetched"))}"`),Ne.push(`alt="${Ut(j)}"`),B)Ne.push(`width="${Ut(B)}"`);if(z)Ne.push(`height="${Ut(z)}"`);let at=xe||(he||pe?"eager":oe?"lazy":"");if(at)Ne.push(`loading="${Ut(at)}"`);if(he)Ne.push('fetchpriority="high"');if(Ne.push(`decoding="${Ut($e)}"`),ie)Ne.push(`class="${Ut(ie)}"`);if(Pe.length>0)Ne.push(`style="${Ut(Pe.join(";"))}"`);if(Te)Ne.push(`srcset="${Ut(Ei(Te,"fetched"))}"`);if(_e)Ne.push(`sizes="${Ut(_e)}"`);let ht=new Set(["src","alt","width","height","lazy","sizes","srcset","placeholder","placeholderColor","class","className","style","format","provider","quality","densities","preload","priority","picture","loading","decoding"]);if(Oe.length>0){let ft=typeof v.static.onload==="string"?v.static.onload:"",ct=Nb(Oe)+(ft?`;${ft}`:"");Ne.push(`onload="${Ut(ct)}"`),ht.add("onload")}Ne.push(...$r(v,ht)),Ne.push(..._r(v,ht));let dt=`<img ${Ne.join(" ")} />`,rt="";if(pe){let ct=H==="webp"?"image/webp":H==="avif"?"image/avif":"";rt=`<link rel="preload" as="image" href="${Ut(Ie)}"${ct?` type="${ct}"`:""}${Te?` imagesrcset="${Ut(Te)}"`:""}${_e?` imagesizes="${Ut(_e)}"`:""} />
1720
+ `}if(Re){let ft=[];if(T)for(let ct of is(T))ft.push(`<source type="image/${ct.format}" srcset="${Ut(ct.srcset)}"${_e?` sizes="${Ut(_e)}"`:""} />`);if(!T&&(H==="avif"||H==="auto")){let ct=Yi(E,Ce,Ae,se,"avif"),vt=Te?bl(E,yl,se,"avif"):`${ct}`;ft.push(`<source type="image/avif" srcset="${Ut(vt)}"${_e?` sizes="${Ut(_e)}"`:""} />`)}if(!T&&(H==="webp"||H==="auto")){let ct=Yi(E,Ce,Ae,se,"webp"),vt=Te?bl(E,yl,se,"webp"):`${ct}`;ft.push(`<source type="image/webp" srcset="${Ut(vt)}"${_e?` sizes="${Ut(_e)}"`:""} />`)}return`${rt}<picture>
1721
1721
  ${ft.join(`
1722
1722
  `)}
1723
1723
  ${dt}
1724
- </picture>`}return`${rt}${dt}`}};var Rp="/images/safe-image-default.svg";function Yi(v){return v.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Hs(v,_){if(v.serverDynamic[_]!==void 0)return String(v.serverDynamic[_]);let k=v.static[_];if(typeof k==="string")return k;return}var jb=`<script>window.__stxSafeImageHandler||(window.__stxSafeImageHandler=function(i){if(i.__stx_fb)return;i.__stx_fb=1;var f=i.getAttribute('data-fallback')||'${Rp}';var c=i.getAttribute('data-fallback-class');i.src=f;if(c)i.className=c;});</script>`,wl={name:"SafeImage",aliases:["safe-image","safe-img"],render(v,_,k){let E=Hs(v,"src")||"",T=Hs(v,"alt")||"",j=Hs(v,"fallback")||Rp,B=Hs(v,"class")||Hs(v,"className")||"",z=Hs(v,"fallbackClassName")||"",F=[];if(F.push(`src="${Yi(E)}"`),F.push(`alt="${Yi(T)}"`),B)F.push(`class="${Yi(B)}"`);if(F.push(`data-fallback="${Yi(j)}"`),z)F.push(`data-fallback-class="${Yi(z)}"`);F.push('onerror="window.__stxSafeImageHandler(this)"');let V=new Set(["src","alt","fallback","class","className","fallbackClassName"]);F.push(...$r(v,V)),F.push(..._r(v,V));let U=`<img ${F.join(" ")} />`,H=k.context;if(!H.__safeImageHandlerEmitted)return H.__safeImageHandlerEmitted=!0,`${jb}${U}`;return U}};function Sl(v){return v.replace(/[;{}()]/g,"").replace(/url/gi,"")}function Qi(v,_){if(v.serverDynamic[_]!==void 0)return String(v.serverDynamic[_]);let k=v.static[_];if(typeof k==="string")return k;return}function aa(v,_,k){let E=Qi(v,_);if(E!==void 0){let T=Number.parseInt(E,10);if(!Number.isNaN(T))return T}return k}var $l={name:"StxLoadingIndicator",aliases:["stx-loading-indicator"],render(v,_,k){let E=Sl(Qi(v,"color")||"#6366f1"),T=Sl(Qi(v,"initialColor")||Qi(v,"initial-color")||""),j=Sl(Qi(v,"height")||"3px"),B=aa(v,"duration",2000),z=aa(v,"throttle",200),F=aa(v,"zIndex",999999)||aa(v,"z-index",999999),V=T?`linear-gradient(to right, ${T}, ${E})`:E;return`
1724
+ </picture>`}return`${rt}${dt}`}};var Ap="/images/safe-image-default.svg";function Qi(v){return v.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Hs(v,_){if(v.serverDynamic[_]!==void 0)return String(v.serverDynamic[_]);let k=v.static[_];if(typeof k==="string")return k;return}var Lb=`<script>window.__stxSafeImageHandler||(window.__stxSafeImageHandler=function(i){if(i.__stx_fb)return;i.__stx_fb=1;var f=i.getAttribute('data-fallback')||'${Ap}';var c=i.getAttribute('data-fallback-class');i.src=f;if(c)i.className=c;});</script>`,wl={name:"SafeImage",aliases:["safe-image","safe-img"],render(v,_,k){let E=Hs(v,"src")||"",T=Hs(v,"alt")||"",j=Hs(v,"fallback")||Ap,B=Hs(v,"class")||Hs(v,"className")||"",z=Hs(v,"fallbackClassName")||"",F=[];if(F.push(`src="${Qi(E)}"`),F.push(`alt="${Qi(T)}"`),B)F.push(`class="${Qi(B)}"`);if(F.push(`data-fallback="${Qi(j)}"`),z)F.push(`data-fallback-class="${Qi(z)}"`);F.push('onerror="window.__stxSafeImageHandler(this)"');let V=new Set(["src","alt","fallback","class","className","fallbackClassName"]);F.push(...$r(v,V)),F.push(..._r(v,V));let U=`<img ${F.join(" ")} />`,H=k.context;if(!H.__safeImageHandlerEmitted)return H.__safeImageHandlerEmitted=!0,`${Lb}${U}`;return U}};function Sl(v){return v.replace(/[;{}()]/g,"").replace(/url/gi,"")}function eo(v,_){if(v.serverDynamic[_]!==void 0)return String(v.serverDynamic[_]);let k=v.static[_];if(typeof k==="string")return k;return}function aa(v,_,k){let E=eo(v,_);if(E!==void 0){let T=Number.parseInt(E,10);if(!Number.isNaN(T))return T}return k}var $l={name:"StxLoadingIndicator",aliases:["stx-loading-indicator"],render(v,_,k){let E=Sl(eo(v,"color")||"#6366f1"),T=Sl(eo(v,"initialColor")||eo(v,"initial-color")||""),j=Sl(eo(v,"height")||"3px"),B=aa(v,"duration",2000),z=aa(v,"throttle",200),F=aa(v,"zIndex",999999)||aa(v,"z-index",999999),V=T?`linear-gradient(to right, ${T}, ${E})`:E;return`
1725
1725
  <div id="stx-loading-indicator" style="position:fixed;top:0;left:0;right:0;height:${j};background:${V};z-index:${F};transform:scaleX(0);transform-origin:left;transition:transform 0.1s ease-out,opacity 0.3s ease;opacity:0;pointer-events:none">
1726
1726
  <div style="position:absolute;top:0;left:0;right:0;bottom:0;background:linear-gradient(90deg,transparent 0%,rgba(255,255,255,0.4) 50%,transparent 100%);animation:stx-shimmer 1.5s infinite"></div>
1727
1727
  </div>
1728
1728
  <style>@keyframes stx-shimmer{0%{transform:translateX(-100%)}100%{transform:translateX(100%)}}</style>
1729
1729
  <script>
1730
1730
  (function(){var el=document.getElementById('stx-loading-indicator'),p=0,l=!1,i=null;function u(v){p=Math.min(Math.max(v,0),100);if(el){el.style.opacity=p>0?'1':'0';el.style.transform='scaleX('+(p/100)+')'}}window.stxLoading={start:function(){l=!0;p=0;u(10);if(i)clearInterval(i);i=setInterval(function(){if(!l)return;var r=90-p,inc=Math.max(0.5,r*0.1);if(p<90)u(p+inc)},${z})},finish:function(){l=!1;if(i){clearInterval(i);i=null}u(100);setTimeout(function(){if(el)el.style.opacity='0';setTimeout(function(){p=0;if(el)el.style.transform='scaleX(0)'},300)},200)},set:function(v){u(v)},clear:function(){l=!1;p=0;if(i){clearInterval(i);i=null}if(el){el.style.opacity='0';el.style.transform='scaleX(0)'}}};document.addEventListener('click',function(e){var a=e.target.closest&&e.target.closest('a');if(!a)return;var h=a.getAttribute('href');if(!h||h.startsWith('http')||h.startsWith('#')||h.startsWith('mailto:')||h.startsWith('tel:')||a.target==='_blank')return;window.stxLoading.start()});window.addEventListener('popstate',function(){window.stxLoading.start()});window.addEventListener('load',function(){window.stxLoading.finish()})})();
1731
- </script>`}};function Tp(v,_){if(v.serverDynamic[_]!==void 0)return String(v.serverDynamic[_]);let k=v.static[_];if(typeof k==="string")return k;return}function Lb(v,_,k){let E=Tp(v,_);if(E!==void 0){let T=Number.parseInt(E,10);if(!Number.isNaN(T))return T}return k}var Ap={"top-right":"top:1rem;right:1rem","top-left":"top:1rem;left:1rem","top-center":"top:1rem;left:50%;transform:translateX(-50%)","bottom-right":"bottom:1rem;right:1rem","bottom-left":"bottom:1rem;left:1rem","bottom-center":"bottom:1rem;left:50%;transform:translateX(-50%)"},_l={name:"StxToast",aliases:["stx-toast"],render(v,_,k){let E=Lt(Tp(v,"position")||"top-right"),T=Lb(v,"max",5),j=Ap[E]||Ap["top-right"];return`<div id="stx-toast-container" data-stx-toast-position="${E}" data-stx-toast-max="${T}" style="position:fixed;${j};z-index:999999;display:flex;flex-direction:column;gap:0.5rem;pointer-events:none;max-width:24rem;width:100%"></div>
1731
+ </script>`}};function Ip(v,_){if(v.serverDynamic[_]!==void 0)return String(v.serverDynamic[_]);let k=v.static[_];if(typeof k==="string")return k;return}function Bb(v,_,k){let E=Ip(v,_);if(E!==void 0){let T=Number.parseInt(E,10);if(!Number.isNaN(T))return T}return k}var Tp={"top-right":"top:1rem;right:1rem","top-left":"top:1rem;left:1rem","top-center":"top:1rem;left:50%;transform:translateX(-50%)","bottom-right":"bottom:1rem;right:1rem","bottom-left":"bottom:1rem;left:1rem","bottom-center":"bottom:1rem;left:50%;transform:translateX(-50%)"},_l={name:"StxToast",aliases:["stx-toast"],render(v,_,k){let E=Lt(Ip(v,"position")||"top-right"),T=Bb(v,"max",5),j=Tp[E]||Tp["top-right"];return`<div id="stx-toast-container" data-stx-toast-position="${E}" data-stx-toast-max="${T}" style="position:fixed;${j};z-index:999999;display:flex;flex-direction:column;gap:0.5rem;pointer-events:none;max-width:24rem;width:100%"></div>
1732
1732
  <style>
1733
1733
  @keyframes stx-toast-in{from{opacity:0;transform:translateX(100%)}to{opacity:1;transform:translateX(0)}}
1734
1734
  @keyframes stx-toast-out{from{opacity:1;transform:translateX(0)}to{opacity:0;transform:translateX(100%)}}
@@ -1736,7 +1736,7 @@ ${dt}
1736
1736
  @keyframes stx-toast-out-left{from{opacity:1;transform:translateX(0)}to{opacity:0;transform:translateX(-100%)}}
1737
1737
  @keyframes stx-toast-in-center{from{opacity:0;transform:translateY(-1rem)}to{opacity:1;transform:translateY(0)}}
1738
1738
  @keyframes stx-toast-out-center{from{opacity:1;transform:translateY(0)}to{opacity:0;transform:translateY(-1rem)}}
1739
- </style>`}};function ca(v,_){if(v.serverDynamic[_]!==void 0)return String(v.serverDynamic[_]);let k=v.static[_];if(typeof k==="string")return k;return}var Ip={sm:"max-width:24rem",md:"max-width:32rem",lg:"max-width:42rem",xl:"max-width:56rem",full:"max-width:calc(100vw - 2rem);max-height:calc(100vh - 2rem)"},kl={name:"StxModal",aliases:["stx-modal"],render(v,_,k){let E=ca(v,"id");if(!E)return console.warn('[stx] <StxModal> requires an "id" prop'),"<!-- StxModal: missing id prop -->";let T=Lt(E),j=ca(v,"size")||"md",B=ca(v,"closeOnBackdrop")!=="false",z=ca(v,"closeOnEscape")!=="false",F=Ip[j]||Ip.md;return`<div id="stx-modal-${T}" class="stx-modal-backdrop" data-stx-modal="${T}" data-close-backdrop="${B}" data-close-escape="${z}" style="display:none;position:fixed;inset:0;z-index:99999;align-items:center;justify-content:center;background:rgba(0,0,0,0.5);backdrop-filter:blur(2px);opacity:0;transition:opacity 0.2s ease" aria-modal="true" role="dialog">
1739
+ </style>`}};function ca(v,_){if(v.serverDynamic[_]!==void 0)return String(v.serverDynamic[_]);let k=v.static[_];if(typeof k==="string")return k;return}var Pp={sm:"max-width:24rem",md:"max-width:32rem",lg:"max-width:42rem",xl:"max-width:56rem",full:"max-width:calc(100vw - 2rem);max-height:calc(100vh - 2rem)"},kl={name:"StxModal",aliases:["stx-modal"],render(v,_,k){let E=ca(v,"id");if(!E)return console.warn('[stx] <StxModal> requires an "id" prop'),"<!-- StxModal: missing id prop -->";let T=Lt(E),j=ca(v,"size")||"md",B=ca(v,"closeOnBackdrop")!=="false",z=ca(v,"closeOnEscape")!=="false",F=Pp[j]||Pp.md;return`<div id="stx-modal-${T}" class="stx-modal-backdrop" data-stx-modal="${T}" data-close-backdrop="${B}" data-close-escape="${z}" style="display:none;position:fixed;inset:0;z-index:99999;align-items:center;justify-content:center;background:rgba(0,0,0,0.5);backdrop-filter:blur(2px);opacity:0;transition:opacity 0.2s ease" aria-modal="true" role="dialog">
1740
1740
  <div class="stx-modal-panel" style="${F};width:100%;margin:1rem;border-radius:0.75rem;box-shadow:0 20px 60px rgba(0,0,0,0.3);overflow:hidden;transform:scale(0.95) translateY(8px);transition:transform 0.2s ease,opacity 0.2s ease;opacity:0;background:var(--stx-modal-bg,#fff);color:var(--stx-modal-text,#1f2937)">
1741
1741
  <div style="padding:1.5rem">${_}</div>
1742
1742
  </div>
@@ -1745,7 +1745,7 @@ ${dt}
1745
1745
  @media(prefers-color-scheme:dark){[data-stx-modal]{--stx-modal-bg:#1f2937;--stx-modal-text:#f3f4f6}}
1746
1746
  .stx-modal-backdrop[data-stx-modal-open]{display:flex!important;opacity:1}
1747
1747
  .stx-modal-backdrop[data-stx-modal-open] .stx-modal-panel{transform:scale(1) translateY(0);opacity:1}
1748
- </style>`}};function qs(v,_){if(v.serverDynamic[_]!==void 0)return String(v.serverDynamic[_]);let k=v.static[_];if(typeof k==="string")return k;return}var Pp={sm:"16rem",md:"24rem",lg:"32rem",xl:"40rem"},El={name:"StxDrawer",aliases:["stx-drawer"],render(v,_,k){let E=qs(v,"id");if(!E)return console.warn('[stx] <StxDrawer> requires an "id" prop'),"<!-- StxDrawer: missing id prop -->";let T=Lt(E),j=qs(v,"side")||"right",B=qs(v,"size")||"md",z=qs(v,"closeOnBackdrop")!=="false",F=qs(v,"closeOnEscape")!=="false",V=qs(v,"overlay")!=="false",U=Pp[B]||Pp.md,H=j==="left",Y=H?"left:0":"right:0",J=H?"translateX(-100%)":"translateX(100%)",re=H?"stx-drawer-slide-left":"stx-drawer-slide-right";return`<div id="stx-drawer-${T}" class="stx-drawer-backdrop" data-stx-drawer="${T}" data-close-backdrop="${z}" data-close-escape="${F}" style="display:none;position:fixed;inset:0;z-index:99999;${V?"background:rgba(0,0,0,0.5);backdrop-filter:blur(2px)":"background:transparent;pointer-events:none"};opacity:0;transition:opacity 0.2s ease" role="dialog" aria-modal="true">
1748
+ </style>`}};function qs(v,_){if(v.serverDynamic[_]!==void 0)return String(v.serverDynamic[_]);let k=v.static[_];if(typeof k==="string")return k;return}var Dp={sm:"16rem",md:"24rem",lg:"32rem",xl:"40rem"},El={name:"StxDrawer",aliases:["stx-drawer"],render(v,_,k){let E=qs(v,"id");if(!E)return console.warn('[stx] <StxDrawer> requires an "id" prop'),"<!-- StxDrawer: missing id prop -->";let T=Lt(E),j=qs(v,"side")||"right",B=qs(v,"size")||"md",z=qs(v,"closeOnBackdrop")!=="false",F=qs(v,"closeOnEscape")!=="false",V=qs(v,"overlay")!=="false",U=Dp[B]||Dp.md,H=j==="left",Y=H?"left:0":"right:0",J=H?"translateX(-100%)":"translateX(100%)",re=H?"stx-drawer-slide-left":"stx-drawer-slide-right";return`<div id="stx-drawer-${T}" class="stx-drawer-backdrop" data-stx-drawer="${T}" data-close-backdrop="${z}" data-close-escape="${F}" style="display:none;position:fixed;inset:0;z-index:99999;${V?"background:rgba(0,0,0,0.5);backdrop-filter:blur(2px)":"background:transparent;pointer-events:none"};opacity:0;transition:opacity 0.2s ease" role="dialog" aria-modal="true">
1749
1749
  <div class="stx-drawer-panel" style="position:fixed;top:0;bottom:0;${Y};width:${U};max-width:100vw;transform:${J};transition:transform 0.3s cubic-bezier(0.4,0,0.2,1);background:var(--stx-drawer-bg,#fff);color:var(--stx-drawer-text,#1f2937);box-shadow:0 20px 60px rgba(0,0,0,0.3);overflow-y:auto;pointer-events:auto">
1750
1750
  <div style="padding:1.5rem">${_}</div>
1751
1751
  </div>
@@ -1754,7 +1754,7 @@ ${dt}
1754
1754
  @media(prefers-color-scheme:dark){[data-stx-drawer]{--stx-drawer-bg:#1f2937;--stx-drawer-text:#f3f4f6}}
1755
1755
  .stx-drawer-backdrop[data-stx-drawer-open]{display:block!important;opacity:1}
1756
1756
  .stx-drawer-backdrop[data-stx-drawer-open] .stx-drawer-panel{transform:translateX(0)}
1757
- </style>`}};import{existsSync as Bb,readFileSync as zb}from"fs";var la=new Map,Dp=new Set;function Wb(v){if(Dp.has(v))return;Dp.add(v),console.warn(`[stx] icon collection "${v}" is not installed, so its icons render as nothing. Install it with \`bun add -d @iconify-json/${v}\`.`)}function Fb(v){let _=process.cwd();for(let k of[`${_}/node_modules/@iconify-json/${v}/icons.json`,`${_}/pantry/@iconify-json/${v}/icons.json`,`${_}/node_modules/@iconify/json/json/${v}.json`,`${_}/pantry/@iconify/json/json/${v}.json`])if(Bb(k))return k;for(let k of[`@iconify-json/${v}/icons.json`,`@iconify/json/json/${v}.json`])try{return u.resolve(k)}catch{}return null}function Vb(v){if(la.has(v))return la.get(v);let _=Fb(v);if(!_)return Wb(v),null;try{let k=JSON.parse(zb(_,"utf8"));return la.set(v,k.icons),k.icons}catch{return null}}function Ks(v,_){if(v.serverDynamic[_]!==void 0)return String(v.serverDynamic[_]);if(v.static[_]!==void 0)return String(v.static[_]);if(v.clientReactive[_]!==void 0)return v.clientReactive[_];return}var Cl={name:"Icon",aliases:["icon","stx-icon"],render(v,_,k){let E=Ks(v,"name")??Ks(v,"icon");if(!E)return"<!-- Icon: missing name/icon prop -->";let T="lucide",j=E;if(E.includes(":")){let ce=E.split(":");T=ce[0],j=ce[1]}let B=Lt(Ks(v,"size")||"24"),z=Lt(Ks(v,"color")||"currentColor"),F=Lt(Ks(v,"class")||""),V=Lt(Ks(v,"style")||""),U=la.get(T)??Vb(T);if(!U)return`<!-- Icon: collection "${T}" not loaded -->`;let H=U[j];if(!H)return`<!-- Icon: "${j}" not found in ${T} -->`;let Y=H.width||24,J=H.height||24,re=`0 0 ${Y} ${J}`,se=H.body;if(z!=="currentColor")se=se.replace(/currentColor/g,z);let ie=F?` class="${F}"`:"",ae=V?` style="${V}"`:"";return`<svg xmlns="http://www.w3.org/2000/svg" width="${B}" height="${B}" viewBox="${re}" fill="none"${ie}${ae}>${se}</svg>`}};function Rl(){return`
1757
+ </style>`}};import{existsSync as zb,readFileSync as Wb}from"fs";var la=new Map,Mp=new Set;function Fb(v){if(Mp.has(v))return;Mp.add(v),console.warn(`[stx] icon collection "${v}" is not installed, so its icons render as nothing. Install it with \`bun add -d @iconify-json/${v}\`.`)}function Vb(v){let _=process.cwd();for(let k of[`${_}/node_modules/@iconify-json/${v}/icons.json`,`${_}/pantry/@iconify-json/${v}/icons.json`,`${_}/node_modules/@iconify/json/json/${v}.json`,`${_}/pantry/@iconify/json/json/${v}.json`])if(zb(k))return k;for(let k of[`@iconify-json/${v}/icons.json`,`@iconify/json/json/${v}.json`])try{return u.resolve(k)}catch{}return null}function Ub(v){if(la.has(v))return la.get(v);let _=Vb(v);if(!_)return Fb(v),null;try{let k=JSON.parse(Wb(_,"utf8"));return la.set(v,k.icons),k.icons}catch{return null}}function Ks(v,_){if(v.serverDynamic[_]!==void 0)return String(v.serverDynamic[_]);if(v.static[_]!==void 0)return String(v.static[_]);if(v.clientReactive[_]!==void 0)return v.clientReactive[_];return}var Cl={name:"Icon",aliases:["icon","stx-icon"],render(v,_,k){let E=Ks(v,"name")??Ks(v,"icon");if(!E)return"<!-- Icon: missing name/icon prop -->";let T="lucide",j=E;if(E.includes(":")){let ce=E.split(":");T=ce[0],j=ce[1]}let B=Lt(Ks(v,"size")||"24"),z=Lt(Ks(v,"color")||"currentColor"),F=Lt(Ks(v,"class")||""),V=Lt(Ks(v,"style")||""),U=la.get(T)??Ub(T);if(!U)return`<!-- Icon: collection "${T}" not loaded -->`;let H=U[j];if(!H)return`<!-- Icon: "${j}" not found in ${T} -->`;let Y=H.width||24,J=H.height||24,re=`0 0 ${Y} ${J}`,se=H.body;if(z!=="currentColor")se=se.replace(/currentColor/g,z);let ie=F?` class="${F}"`:"",ae=V?` style="${V}"`:"";return`<svg xmlns="http://www.w3.org/2000/svg" width="${B}" height="${B}" viewBox="${re}" fill="none"${ie}${ae}>${se}</svg>`}};function Rl(){return`
1758
1758
  (function(){
1759
1759
  var tip=null,hideTimer=null,currentEl=null;
1760
1760
 
@@ -1857,8 +1857,8 @@ document.addEventListener("focusout",function(e){
1857
1857
  if(el) hideTip();
1858
1858
  });
1859
1859
  })();
1860
- `}function Op(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 Mp(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 Al={name:"Suspense",aliases:["suspense"],render(v,_,k){let E=Mp(_,"fallback"),T=E.rest,j=Mp(T,"error"),B=j.rest,z=E.region??Op(v,"fallback")??'<div class="stx-suspense-loading">Loading\u2026</div>',F=j.region??Op(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 ua(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 Tl={name:"TransitionGroup",aliases:["transition-group"],render(v,_,k){let E=(ua(v,"name")||"v").replace(/["'<>]/g,""),T=(ua(v,"tag")||"div").replace(/[^a-z0-9-]/gi,"")||"div",j=ua(v,"class"),B=ua(v,"id"),z=[`data-stx-transition-group="${E}"`,j?`class="${j}"`:"",B?`id="${B}"`:""].filter(Boolean).join(" ");return`<${T} ${z}>${_}</${T}>`}};function Np(v=Fs){v.registerBuiltin(ll),v.registerBuiltin(vl),v.registerBuiltin(wl),v.registerBuiltin($l),v.registerBuiltin(_l),v.registerBuiltin(kl),v.registerBuiltin(El),v.registerBuiltin(Cl),v.registerBuiltin(Al),v.registerBuiltin(Tl)}var jp=new Map;function Ub(v){let _=jp.get(v.source);if(!_)_=new RegExp(`(${v.source})(?![\\w.:-])`,"y"),jp.set(v.source,_);return _}var Lp=new WeakMap;function Bp(v){let _=Lp.get(v);if(!_)_=new Set([...v].map((E)=>E.toLowerCase())),Lp.set(v,_);let k=_;return(E)=>!/[a-z]/.test(E)&&k.has(E.toLowerCase())}function Hb(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 zp(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=Ub(_);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 U=B+1+V.length,H=null,Y=U,J=-1,re=!1;while(U<v.length){let ie=v[U];if(H){if(ie==="\\"&&U+1<v.length){U+=2;continue}if(ie===H)H=null;U++;continue}if(ie==='"'||ie==="'"){H=ie,U++;continue}if(ie==="/"&&U+1<v.length&&v[U+1]===">"){J=U+2,re=!0;break}if(ie===">"){J=U+1;break}U++}if(J===-1){T=B+1;continue}let se=v.slice(Y,re?J-2:J-1).trim();if(re)E.push({fullMatch:v.slice(B,J),tagName:V,attributes:se,content:"",startIndex:B,endIndex:J,isSelfClosing:!0}),T=J;else{let ie=`<${V}`,ae=`</${V}>`,ce=1,oe=J,pe=-1;while(ce>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 Ce=v[$e+ie.length];if(Ce===" "||Ce===">"||Ce==="/"||Ce===`
1861
- `||Ce==="\t"){let Ae=Hb(v,$e+ie.length);if(v[Ae-1]!=="/")ce++;oe=Ae+1}else oe=$e+ie.length}else{if(ce--,ce===0){pe=Re;break}oe=Re+ae.length}}if(pe===-1){T=J;continue}let he=v.slice(J,pe),xe=pe+ae.length;E.push({fullMatch:v.slice(B,xe),tagName:V,attributes:se,content:he,startIndex:B,endIndex:xe,isSelfClosing:!1}),T=xe}}return E}function Wp(v){return v.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#0?39;/g,"'").replace(/&#x27;/gi,"'").replace(/&amp;/g,"&")}function Fp(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 Il(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 Vp(v){let _=v.trim();if(!_.startsWith("{")||!_.endsWith("}"))return null;if(Il(_,0).length!==_.length)return null;return _.slice(1,-1).trim()}var qb=new Set(["disabled","checked","readonly","required","autofocus","autoplay","controls","default","defer","formnovalidate","hidden","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","reversed","selected"]),Kb=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function Xb(v){return Pl(v).map((_)=>[_.start,_.end])}function Pl(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=Es(j[1]??j[2]??j[3]??""),z=E.index,F=z+E[0].length,V=E[1].toLowerCase();if(E[0].endsWith("/>")||Kb.has(V)){_.push({start:z,end:F,names:B});continue}let U=V.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),H=new RegExp(`<\\/?${U}\\b(?:[^>"']|"[^"]*"|'[^']*')*>`,"gi");H.lastIndex=F;let Y=1,J=F,re;while((re=H.exec(v))!==null)if(re[0].startsWith("</")){if(Y--,Y===0){J=re.index+re[0].length;break}}else if(!re[0].endsWith("/>"))Y++;_.push({start:z,end:J,names:B})}return _}function Up(v){if(typeof v==="string")return v;if(Array.isArray(v))return v.filter(Boolean).map((_)=>Up(_)).join(" ");if(v&&typeof v==="object")return Object.entries(v).filter(([,_])=>_).map(([_])=>_).join(" ");return v?String(v):""}function Hp(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(...Xb(v));let B=new Set(yr(_));function z(Y){return T.some(([J,re])=>Y>=J&&Y<re)}let F=/<([a-zA-Z][a-zA-Z0-9-]*)\b((?:[^>"']|"[^"]*"|'[^']*')*?)\s*(\/?)>/g,V=[],U=new Map,H=256;while((j=F.exec(k))!==null){if(z(j.index))continue;let Y=j[0],J=j[2];if(!J||!J.includes(":"))continue;let re=/\s:([a-zA-Z_][\w-]*)\s*=\s*"([^"]*)"/g,se,ie=J,ae=!1;while((se=re.exec(J))!==null){let ce=se[1],oe=se[2];if(Bi(ce))continue;if(Tr(oe,B))continue;if(oe.includes("()")&&!oe.includes(".get(")||oe.includes("$store")||oe.includes("$ref"))continue;try{let pe=Object.keys(_),he=Object.values(_),xe=oe.match(/^([a-zA-Z_$][\w$]*)/);if(xe&&!pe.includes(xe[1])&&!["true","false","null","undefined","Math","JSON","String","Number","Array","Object","Date","parseInt","parseFloat"].includes(xe[1]))continue;let $e=JSON.stringify([pe,oe]),Re=U.get($e);if(!Re){if(Re=Function(...pe,`return (${oe})`),U.size>=H)U.clear();U.set($e,Re)}let Ce=Re(...he);if(ce==="class"){let Ae=Up(Ce);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(qb.has(ce)){if(Ce)ie=ie.replace(se[0],` ${ce}`);else ie=ie.replace(se[0],"");ae=!0;continue}if(Ce===null||Ce===void 0||Ce===!1)ie=ie.replace(se[0],"");else{let Ae=String(Ce).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;");ie=ie.replace(se[0],` ${ce}="${Ae}"`)}ae=!0}catch{continue}}if(ae){let ce=j[3]?" /":"",pe=`<${j[1]}${ie}${ce}>`;V.push({start:j.index,end:j.index+Y.length,replacement:pe})}}if(V.length>0){let Y=Array(V.length*2+1),J=0;for(let re=0;re<V.length;re++){let{start:se,end:ie,replacement:ae}=V[re];Y[re*2]=k.slice(J,se),Y[re*2+1]=ae,J=ie}Y[V.length*2]=k.slice(J),k=Y.join("")}return k}import sg from"path";import Ol from"fs";import to from"path";function qp(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 Zb(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 Dl(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=qp(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=qp(k,j,"(",")");if(z>=0)return{type:B,args:Zb(v.slice(j+1,z))}}return null}var Kp=`
1860
+ `}function Op(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 Np(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 Al={name:"Suspense",aliases:["suspense"],render(v,_,k){let E=Np(_,"fallback"),T=E.rest,j=Np(T,"error"),B=j.rest,z=E.region??Op(v,"fallback")??'<div class="stx-suspense-loading">Loading\u2026</div>',F=j.region??Op(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 ua(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 Tl={name:"TransitionGroup",aliases:["transition-group"],render(v,_,k){let E=(ua(v,"name")||"v").replace(/["'<>]/g,""),T=(ua(v,"tag")||"div").replace(/[^a-z0-9-]/gi,"")||"div",j=ua(v,"class"),B=ua(v,"id"),z=[`data-stx-transition-group="${E}"`,j?`class="${j}"`:"",B?`id="${B}"`:""].filter(Boolean).join(" ");return`<${T} ${z}>${_}</${T}>`}};function jp(v=Fs){v.registerBuiltin(ll),v.registerBuiltin(vl),v.registerBuiltin(wl),v.registerBuiltin($l),v.registerBuiltin(_l),v.registerBuiltin(kl),v.registerBuiltin(El),v.registerBuiltin(Cl),v.registerBuiltin(Al),v.registerBuiltin(Tl)}var Lp=new Map;function Hb(v){let _=Lp.get(v.source);if(!_)_=new RegExp(`(${v.source})(?![\\w.:-])`,"y"),Lp.set(v.source,_);return _}var Bp=new WeakMap;function zp(v){let _=Bp.get(v);if(!_)_=new Set([...v].map((E)=>E.toLowerCase())),Bp.set(v,_);let k=_;return(E)=>!/[a-z]/.test(E)&&k.has(E.toLowerCase())}function qb(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 Wp(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=Hb(_);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 U=B+1+V.length,H=null,Y=U,J=-1,re=!1;while(U<v.length){let ie=v[U];if(H){if(ie==="\\"&&U+1<v.length){U+=2;continue}if(ie===H)H=null;U++;continue}if(ie==='"'||ie==="'"){H=ie,U++;continue}if(ie==="/"&&U+1<v.length&&v[U+1]===">"){J=U+2,re=!0;break}if(ie===">"){J=U+1;break}U++}if(J===-1){T=B+1;continue}let se=v.slice(Y,re?J-2:J-1).trim();if(re)E.push({fullMatch:v.slice(B,J),tagName:V,attributes:se,content:"",startIndex:B,endIndex:J,isSelfClosing:!0}),T=J;else{let ie=`<${V}`,ae=`</${V}>`,ce=1,oe=J,pe=-1;while(ce>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 Ce=v[$e+ie.length];if(Ce===" "||Ce===">"||Ce==="/"||Ce===`
1861
+ `||Ce==="\t"){let Ae=qb(v,$e+ie.length);if(v[Ae-1]!=="/")ce++;oe=Ae+1}else oe=$e+ie.length}else{if(ce--,ce===0){pe=Re;break}oe=Re+ae.length}}if(pe===-1){T=J;continue}let he=v.slice(J,pe),xe=pe+ae.length;E.push({fullMatch:v.slice(B,xe),tagName:V,attributes:se,content:he,startIndex:B,endIndex:xe,isSelfClosing:!1}),T=xe}}return E}function Fp(v){return v.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#0?39;/g,"'").replace(/&#x27;/gi,"'").replace(/&amp;/g,"&")}function Vp(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 Il(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 Up(v){let _=v.trim();if(!_.startsWith("{")||!_.endsWith("}"))return null;if(Il(_,0).length!==_.length)return null;return _.slice(1,-1).trim()}var Kb=new Set(["disabled","checked","readonly","required","autofocus","autoplay","controls","default","defer","formnovalidate","hidden","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","reversed","selected"]),Xb=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function Zb(v){return Pl(v).map((_)=>[_.start,_.end])}function Pl(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=Es(j[1]??j[2]??j[3]??""),z=E.index,F=z+E[0].length,V=E[1].toLowerCase();if(E[0].endsWith("/>")||Xb.has(V)){_.push({start:z,end:F,names:B});continue}let U=V.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),H=new RegExp(`<\\/?${U}\\b(?:[^>"']|"[^"]*"|'[^']*')*>`,"gi");H.lastIndex=F;let Y=1,J=F,re;while((re=H.exec(v))!==null)if(re[0].startsWith("</")){if(Y--,Y===0){J=re.index+re[0].length;break}}else if(!re[0].endsWith("/>"))Y++;_.push({start:z,end:J,names:B})}return _}function Hp(v){if(typeof v==="string")return v;if(Array.isArray(v))return v.filter(Boolean).map((_)=>Hp(_)).join(" ");if(v&&typeof v==="object")return Object.entries(v).filter(([,_])=>_).map(([_])=>_).join(" ");return v?String(v):""}function qp(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(...Zb(v));let B=new Set(yr(_));function z(Y){return T.some(([J,re])=>Y>=J&&Y<re)}let F=/<([a-zA-Z][a-zA-Z0-9-]*)\b((?:[^>"']|"[^"]*"|'[^']*')*?)\s*(\/?)>/g,V=[],U=new Map,H=256;while((j=F.exec(k))!==null){if(z(j.index))continue;let Y=j[0],J=j[2];if(!J||!J.includes(":"))continue;let re=/\s:([a-zA-Z_][\w-]*)\s*=\s*"([^"]*)"/g,se,ie=J,ae=!1;while((se=re.exec(J))!==null){let ce=se[1],oe=se[2];if(Bi(ce))continue;if(Tr(oe,B))continue;if(oe.includes("()")&&!oe.includes(".get(")||oe.includes("$store")||oe.includes("$ref"))continue;try{let pe=Object.keys(_),he=Object.values(_),xe=oe.match(/^([a-zA-Z_$][\w$]*)/);if(xe&&!pe.includes(xe[1])&&!["true","false","null","undefined","Math","JSON","String","Number","Array","Object","Date","parseInt","parseFloat"].includes(xe[1]))continue;let $e=JSON.stringify([pe,oe]),Re=U.get($e);if(!Re){if(Re=Function(...pe,`return (${oe})`),U.size>=H)U.clear();U.set($e,Re)}let Ce=Re(...he);if(ce==="class"){let Ae=Hp(Ce);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(Kb.has(ce)){if(Ce)ie=ie.replace(se[0],` ${ce}`);else ie=ie.replace(se[0],"");ae=!0;continue}if(Ce===null||Ce===void 0||Ce===!1)ie=ie.replace(se[0],"");else{let Ae=String(Ce).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;");ie=ie.replace(se[0],` ${ce}="${Ae}"`)}ae=!0}catch{continue}}if(ae){let ce=j[3]?" /":"",pe=`<${j[1]}${ie}${ce}>`;V.push({start:j.index,end:j.index+Y.length,replacement:pe})}}if(V.length>0){let Y=Array(V.length*2+1),J=0;for(let re=0;re<V.length;re++){let{start:se,end:ie,replacement:ae}=V[re];Y[re*2]=k.slice(J,se),Y[re*2+1]=ae,J=ie}Y[V.length*2]=k.slice(J),k=Y.join("")}return k}import ig from"path";import Ml from"fs";import no from"path";function Kp(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 Gb(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 Dl(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=Kp(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=Kp(k,j,"(",")");if(z>=0)return{type:B,args:Gb(v.slice(j+1,z))}}return null}var Xp=`
1862
1862
  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;
1863
1863
  type __StxWiden<T> = T extends string ? string : T extends number ? number : T extends boolean ? boolean : T;
1864
1864
  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>;
@@ -1866,37 +1866,37 @@ type __StxRequired<O> = { [K in keyof O]-?: O[K] extends { required: true } ? K
1866
1866
  type __StxDefaulted<O> = { [K in keyof O]-?: O[K] extends { default: unknown } ? K : never }[keyof O];
1867
1867
  type __StxOptions<O> = { [K in Exclude<__StxRequired<O>, __StxDefaulted<O>>]: __StxOption<O[K]> } & { [K in Exclude<keyof O, Exclude<__StxRequired<O>, __StxDefaulted<O>>>]?: __StxOption<O[K]> };
1868
1868
  type __StxDefaults<P, K> = Omit<P, Extract<keyof P, K>> & Partial<Pick<P, Extract<keyof P, K>>>;
1869
- `;function Xp(v,_){let k=[],E={defineProps:["defineProps"],defineEmits:["defineEmits"],withDefaults:["withDefaults"]},T=s(v),j=v.replace(/\bimport\s+(?:type\s+)?(\{[^}]*\}|\*\s+as\s+[\w$]+|[\w$]+)\s+from\s*(['"])([^'"]+)\2\s*;?/g,(Y,J,re,se,ie)=>{if(T.slice(ie,ie+6)!=="import")return Y;if(se.endsWith(".stx"))return"";let ae=`${_}Import${k.length}`;if(k.push(`import * as ${ae} from ${JSON.stringify(se)};`),J.startsWith("*"))return`import ${J.replace(/^\*\s+as\s+/,"")} = ${ae};`;if(!J.startsWith("{"))return`import ${J} = ${ae}.default;`;return J.slice(1,-1).split(",").map((ce)=>{let[oe,pe=oe]=ce.trim().replace(/^type\s+/,"").split(/\s+as\s+/);if(!oe)return"";if(/^(?:stx|@stacksjs\/stx)(?:\/|$)/.test(se)&&oe in E)E[oe].push(pe);return`import ${pe} = ${ae}.${oe};`}).join(`
1869
+ `;function Zp(v,_){let k=[],E={defineProps:["defineProps"],defineEmits:["defineEmits"],withDefaults:["withDefaults"]},T=s(v),j=v.replace(/\bimport\s+(?:type\s+)?(\{[^}]*\}|\*\s+as\s+[\w$]+|[\w$]+)\s+from\s*(['"])([^'"]+)\2\s*;?/g,(Y,J,re,se,ie)=>{if(T.slice(ie,ie+6)!=="import")return Y;if(se.endsWith(".stx"))return"";let ae=`${_}Import${k.length}`;if(k.push(`import * as ${ae} from ${JSON.stringify(se)};`),J.startsWith("*"))return`import ${J.replace(/^\*\s+as\s+/,"")} = ${ae};`;if(!J.startsWith("{"))return`import ${J} = ${ae}.default;`;return J.slice(1,-1).split(",").map((ce)=>{let[oe,pe=oe]=ce.trim().replace(/^type\s+/,"").split(/\s+as\s+/);if(!oe)return"";if(/^(?:stx|@stacksjs\/stx)(?:\/|$)/.test(se)&&oe in E)E[oe].push(pe);return`import ${pe} = ${ae}.${oe};`}).join(`
1870
1870
  `)}),B=Dl(v,E.defineProps),z=Dl(v,E.defineEmits),F=Dl(v,E.withDefaults);if(!B&&!z)return{declarations:"",props:null,events:null};let V=[],U=null,H=null;if(B){V.push(`const __options = (${B.args[0]||"{}"}) as const;`),V.push(`const __defaults = (${F?.args[1]||"{}"});`);let Y=B.type||"__StxOptions<typeof __options>";V.push(`export type __StxProps = __StxDefaults<${Y}, keyof typeof __defaults | __StxDefaulted<typeof __options>>;`),U=`${_}.__StxProps`}if(z)V.push(`const __events = (${z.args[0]||"[]"}) as const;`),V.push(`export type __StxEvents = ${z.type||"Record<(typeof __events)[number], any[]>"};`),H=`${_}.__StxEvents`;return{declarations:`${k.join(`
1871
1871
  `)}
1872
1872
  namespace ${_} {
1873
1873
  ${j}
1874
1874
  ${V.join(`
1875
1875
  `)}
1876
- }`,props:U,events:H}}var eo=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 cn(v){if(v.includes("-")||v==="component")return!1;if(/^[A-Z]/.test(v))return!/[a-z]/.test(v)&&[...eo].some((_)=>_.toLowerCase()===v.toLowerCase());return eo.has(v)||/[A-Z]/.test(v)}function*Gb(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 U=E;if(F){let H=s(v.slice(E)),Y=1,J=0;for(;J<H.length;J++){if(H[J]==="{")Y++;if(H[J]==="}"&&--Y===0)break}E+=J}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(U,E),offset:U,braced:F}),V||F)E++}_.lastIndex=E,yield{name:k[1],offset:k.index,attributes:T}}}function Zp(v,_,k){let E=[],T=[Kp,"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=to.isAbsolute(se)||se.startsWith(".")?to.resolve(to.dirname(k.filePath),se):vo(se,to.dirname(k.filePath));if(!ie)continue;let ae=ie.endsWith(".stx")?ie:Ol.existsSync(`${ie}.stx`)?`${ie}.stx`:void 0,ce=ae?null:bo(ie,!1),oe=re[1].startsWith("{")?re[1].slice(1,-1).split(","):[re[1]];for(let pe of oe){let[he,xe=he]=pe.trim().split(/\s+as\s+/),$e=ae||ce?.get(he)||ce?.get(he.toLowerCase());if($e)z.set(xe,$e),z.set(xe.toLowerCase(),$e),z.set(xe.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=wo(se[1],k.filePath,k).find((ae)=>Ol.statSync(ae,{throwIfNoEntry:!1})?.isFile());if(ie)z.set(to.basename(se[1]).replace(/\.stx$/,""),ie)}let U={__importedComponents:z},H=new Map,Y=(re,se,ie)=>{let ae=v.slice(0,re);return{code:se,offset:re,attribute:ie,anchor:!0,kind:"directive",line:ae.split(`
1876
+ }`,props:U,events:H}}var to=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 cn(v){if(v.includes("-")||v==="component")return!1;if(/^[A-Z]/.test(v))return!/[a-z]/.test(v)&&[...to].some((_)=>_.toLowerCase()===v.toLowerCase());return to.has(v)||/[A-Z]/.test(v)}function*Jb(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 U=E;if(F){let H=s(v.slice(E)),Y=1,J=0;for(;J<H.length;J++){if(H[J]==="{")Y++;if(H[J]==="}"&&--Y===0)break}E+=J}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(U,E),offset:U,braced:F}),V||F)E++}_.lastIndex=E,yield{name:k[1],offset:k.index,attributes:T}}}function Gp(v,_,k){let E=[],T=[Xp,"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=no.isAbsolute(se)||se.startsWith(".")?no.resolve(no.dirname(k.filePath),se):wo(se,no.dirname(k.filePath));if(!ie)continue;let ae=ie.endsWith(".stx")?ie:Ml.existsSync(`${ie}.stx`)?`${ie}.stx`:void 0,ce=ae?null:vo(ie,!1),oe=re[1].startsWith("{")?re[1].slice(1,-1).split(","):[re[1]];for(let pe of oe){let[he,xe=he]=pe.trim().split(/\s+as\s+/),$e=ae||ce?.get(he)||ce?.get(he.toLowerCase());if($e)z.set(xe,$e),z.set(xe.toLowerCase(),$e),z.set(xe.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=So(se[1],k.filePath,k).find((ae)=>Ml.statSync(ae,{throwIfNoEntry:!1})?.isFile());if(ie)z.set(no.basename(se[1]).replace(/\.stx$/,""),ie)}let U={__importedComponents:z},H=new Map,Y=(re,se,ie)=>{let ae=v.slice(0,re);return{code:se,offset:re,attribute:ie,anchor:!0,kind:"directive",line:ae.split(`
1877
1877
  `).length,column:re-ae.lastIndexOf(`
1878
- `)}},J=(re,se,ie)=>E.push({expression:re,statement:{text:se+re.code+ie,prefixLength:se.length}});for(let re of Gb(_)){if(cn(re.name)||re.name==="component")continue;let se=Lu(re.name,k.filePath,k,U);if(!se)continue;let ie=H.get(se);if(!ie){let ce;try{ce=k.readComponent?k.readComponent(se):Ol.readFileSync(se,"utf8")}catch{continue}if(ce===void 0)continue;B.set(se,ce),ie=Xp(k.scriptCode(ce,se),`__StxComponent${H.size}`),H.set(se,ie),T.push(ie.declarations)}let ae=[];for(let ce of re.attributes){let{name:oe,offset:pe}=ce,he=ce.value===!0?"true":ce.value;if(oe.startsWith("@")||oe.startsWith("v-on:")){if(ie.events&&ce.value!==!0)j.set(pe,`__StxEvent<${ie.events}, ${JSON.stringify(oe.replace(/^@|^v-on:/,"").split(".")[0])}>`);continue}let xe=/^v-model(?::([\w-]+))?(?:\.[\w-]+)*$/.exec(oe);if(oe.startsWith("v-")&&!oe.startsWith("v-bind:")&&!xe)continue;if(/^(?:x-|:)(?:if|for|show|key|else)(?:$|[.:-])/.test(oe))continue;let $e=(xe?xe[1]||"modelValue":oe.replace(/^:|^v-bind:/,"")).replace(/-([a-z])/g,(Ae,Te)=>Te.toUpperCase());if(ae.push($e),!ie.props)continue;let Ce=oe.startsWith(":")||oe.startsWith("v-bind:")||!!xe||ce.braced?he:ce.value!==!0?JSON.stringify(he):"true";J(Y(pe,Ce,oe),";void ((",`) satisfies __StxProp<${ie.props}, ${JSON.stringify($e)}>);`)}if(ie.props){let ce=[...new Set(ae)].map((pe)=>`${JSON.stringify(pe)}: undefined as any`).join(", "),oe=Y(re.offset,`<${re.name}>`);E.push({expression:oe,statement:{text:`;void ({ ${ce} } satisfies ${ie.props} & Record<string, unknown>);`,prefixLength:0}})}}return{declarations:H.size?T.join(`
1879
- `):"",checks:E,events:j,dependencies:B}}var Gp=/<script(\s[^>]*)?>([\s\S]*?)<\/script>/gi;function Jb(v){let _=(k)=>k.replace(/[^\n]/g," ");return v.replace(/<!--[\s\S]*?-->/g,_).replace(/\{\{--[\s\S]*?--\}\}/g,_)}function Ve(v){let _=[],k=Jb(v);Gp.lastIndex=0;let E;while((E=Gp.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 U=T.match(/\btype\s*=\s*["']([^"']+)["']/i);if(U&&!/^(?:module|text\/(?:javascript|typescript))$/i.test(U[1]))continue;let H=/\bserver\b/.test(T)?"server":/\bclient\b/.test(T)?"client":"plain",Y=no(v,z);_.push({kind:H,code:V,startLine:Y,startColumn:ro(v,z),offset:z,attrs:T})}return _}function no(v,_){let k=1;for(let E=0;E<_&&E<v.length;E++)if(v.charCodeAt(E)===10)k++;return k}function ro(v,_){let k=v.lastIndexOf(`
1878
+ `)}},J=(re,se,ie)=>E.push({expression:re,statement:{text:se+re.code+ie,prefixLength:se.length}});for(let re of Jb(_)){if(cn(re.name)||re.name==="component")continue;let se=Lu(re.name,k.filePath,k,U);if(!se)continue;let ie=H.get(se);if(!ie){let ce;try{ce=k.readComponent?k.readComponent(se):Ml.readFileSync(se,"utf8")}catch{continue}if(ce===void 0)continue;B.set(se,ce),ie=Zp(k.scriptCode(ce,se),`__StxComponent${H.size}`),H.set(se,ie),T.push(ie.declarations)}let ae=[];for(let ce of re.attributes){let{name:oe,offset:pe}=ce,he=ce.value===!0?"true":ce.value;if(oe.startsWith("@")||oe.startsWith("v-on:")){if(ie.events&&ce.value!==!0)j.set(pe,`__StxEvent<${ie.events}, ${JSON.stringify(oe.replace(/^@|^v-on:/,"").split(".")[0])}>`);continue}let xe=/^v-model(?::([\w-]+))?(?:\.[\w-]+)*$/.exec(oe);if(oe.startsWith("v-")&&!oe.startsWith("v-bind:")&&!xe)continue;if(/^(?:x-|:)(?:if|for|show|key|else)(?:$|[.:-])/.test(oe))continue;let $e=(xe?xe[1]||"modelValue":oe.replace(/^:|^v-bind:/,"")).replace(/-([a-z])/g,(Ae,Te)=>Te.toUpperCase());if(ae.push($e),!ie.props)continue;let Ce=oe.startsWith(":")||oe.startsWith("v-bind:")||!!xe||ce.braced?he:ce.value!==!0?JSON.stringify(he):"true";J(Y(pe,Ce,oe),";void ((",`) satisfies __StxProp<${ie.props}, ${JSON.stringify($e)}>);`)}if(ie.props){let ce=[...new Set(ae)].map((pe)=>`${JSON.stringify(pe)}: undefined as any`).join(", "),oe=Y(re.offset,`<${re.name}>`);E.push({expression:oe,statement:{text:`;void ({ ${ce} } satisfies ${ie.props} & Record<string, unknown>);`,prefixLength:0}})}}return{declarations:H.size?T.join(`
1879
+ `):"",checks:E,events:j,dependencies:B}}var Jp=/<script(\s[^>]*)?>([\s\S]*?)<\/script>/gi;function Yb(v){let _=(k)=>k.replace(/[^\n]/g," ");return v.replace(/<!--[\s\S]*?-->/g,_).replace(/\{\{--[\s\S]*?--\}\}/g,_)}function Ve(v){let _=[],k=Yb(v);Jp.lastIndex=0;let E;while((E=Jp.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 U=T.match(/\btype\s*=\s*["']([^"']+)["']/i);if(U&&!/^(?:module|text\/(?:javascript|typescript))$/i.test(U[1]))continue;let H=/\bserver\b/.test(T)?"server":/\bclient\b/.test(T)?"client":"plain",Y=ro(v,z);_.push({kind:H,code:V,startLine:Y,startColumn:so(v,z),offset:z,attrs:T})}return _}function ro(v,_){let k=1;for(let E=0;E<_&&E<v.length;E++)if(v.charCodeAt(E)===10)k++;return k}function so(v,_){let k=v.lastIndexOf(`
1880
1880
  `,_-1)+1;return _-k+1}function da(v){let _=v.split(""),k=(T,j)=>{for(let B=T;B<j&&B<_.length;B++)if(_[B]!==`
1881
- `)_[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 Yb(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 ig=new Set([":for","x-for","v-for"]),fa=/(?:^|\s)((?::|x-|v-|@)[\w.:-]+)\s*=\s*(["'])([\s\S]*?)\2/g,Ml="__stx_interpolated",Jp="__StxElement",og="__StxTemplateValue",Qb=`type ${og}<T> = T extends { readonly _isSignal: true } | { readonly _isDerived: true } ? (T extends () => infer V ? T & V : T) : T`;function Yp(v){return v.replace(/\{\{[\s\S]*?\}\}/g,Ml).replace(/\{!![\s\S]*?!!\}/g,Ml)}function as(v){return v.replace(/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/g,(_)=>{let k=_.split(`
1881
+ `)_[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 Qb(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 og=new Set([":for","x-for","v-for"]),fa=/(?:^|\s)((?::|x-|v-|@)[\w.:-]+)\s*=\s*(["'])([\s\S]*?)\2/g,Ol="__stx_interpolated",Yp="__StxElement",ag="__StxTemplateValue",ev=`type ${ag}<T> = T extends { readonly _isSignal: true } | { readonly _isDerived: true } ? (T extends () => infer V ? T & V : T) : T`;function Qp(v){return v.replace(/\{\{[\s\S]*?\}\}/g,Ol).replace(/\{!![\s\S]*?!!\}/g,Ol)}function as(v){return v.replace(/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/g,(_)=>{let k=_.split(`
1882
1882
  `).length-1,E=_.length-k;return`0${" ".repeat(Math.max(0,E-1))}${`
1883
- `.repeat(k)}`})}var ev=["foreach","endforeach","forelse","endforelse","for","endfor","while","endwhile","empty","if","elseif","else","endif","unless","endunless","isset","endisset","switch","case","default","endswitch","auth","endauth","guest","endguest","env","endenv","once","endonce","break","continue"],tv=new RegExp(String.raw`^[ \t]*@(?:${ev.join("|")})\b[ \t]*(\([^\n)]*\))?[ \t]*$`,"gm");function cs(v){return v.replace(tv,(_)=>_.replace(/[^\n]/g," "))}var Qp=new Set(["x-cloak","x-ref","x-transition","x-teleport","v-slot","x-hydrate",":key","x-tooltip","x-tooltip-position"]);function bc(v){let _=da(v),k=[],E=/(@?)\{\{([\s\S]*?)\}\}|(@?)\{!!([\s\S]*?)!!\}/g,T;while((T=E.exec(_))!==null){if(T[1]||T[3])continue;let z=T[2]??T[4]??"",F=T[2]!==void 0?2:3,V=Yb(z);if(!V.trim())continue;let U=T.index+F+(V.length-V.trimStart().length);k.push({code:V.trim(),line:no(_,U),column:ro(_,U),offset:U,kind:"interpolation"})}let j=/@(if|elseif|else\s+if|unless)\b\s*\(/g;while((T=j.exec(_))!==null){let B=T.index+T[0].length-1,z=0,F=B;for(;F<_.length;F++){let Y=_[F];if(Y==="(")z++;else if(Y===")"){if(z--,z===0)break}}if(z!==0)continue;let V=_.slice(B+1,F),U=V.trim();if(j.lastIndex=F+1,!U)continue;let H=B+1+(V.length-V.trimStart().length);k.push({code:U,line:no(_,H),column:ro(_,H),offset:T.index,kind:"condition"})}fa.lastIndex=0;while((T=fa.exec(_))!==null){let B=T[1],z=T[3]??"",F=B.replace(/\..*$/,"").replace(/^([^:].*?):.*$/,"$1");if(Qp.has(F)||Qp.has(B))continue;if(!z.trim())continue;let V=T.index+T[0].indexOf(T[2],T[0].indexOf(B)+B.length)+1;if(ig.has(F)){let H=z.match(/\s+(?:in|of)\s+/);if(!H||H.index===void 0)continue;let Y=z.slice(H.index+H[0].length),J=H.index+H[0].length+(Y.length-Y.trimStart().length);k.push({code:Yp(Y.trim()),line:no(_,V+J),column:ro(_,V+J),offset:V+J,kind:"directive",attribute:F});continue}let U=z.length-z.trimStart().length;k.push({code:Yp(z.trim()),line:no(_,V+U),column:ro(_,V+U),offset:V+U,kind:"directive",attribute:F})}return k.sort((B,z)=>B.line-z.line||B.column-z.column),k}var nv=2000;function rv(v,_){let k=0,E=Math.min(v.length,_+nv);for(let T=_;T<E;T++){let j=v[T];if(j==="(")k++;else if(j===")"){if(k--,k===0)return v.slice(_+1,T)}}return null}function sv(v){let _=new Map,k=(z,F)=>{let V=z.split(/[,[\]{}()\s]+/).filter(Boolean);for(let U of V){let H=U.replace(/^\.\.\./,"").trim();if(!/^\$?[A-Z_$][\w$]*$/i.test(H))continue;let Y=V.length===1?F:void 0,J=_.get(H);if(!J)_.set(H,{name:H,iterable:Y});else if(J.iterable!==Y)J.iterable=void 0}},E=/^\$?[A-Z_$][\w$]*$/i,T=(z)=>{let F=z.trim();return E.test(F)?F:void 0};for(let z of v.matchAll(/@for(?:each|else)\s*\(/g)){let F=rv(v,z.index+z[0].length-1);if(F===null)continue;let V=kt(F);if(!V)continue;k(V.itemVar.replace(/=>/g," "),T(V.arrayExpr))}for(let z of v.matchAll(/@for\s*\(\s*(?:(?:let|const|var)\s+)?([\w$]+|\[[^\]]*\]|\{[^}]*\})\s+(of|in)\s+([^)]*)/g))k(z[1],z[2]==="of"?T(z[3]):void 0);for(let z of v.matchAll(/@for\s*\(\s*(?:let|const|var)\s+([\w$]+)\s*[=;]/g))k(z[1]);let j=da(v);fa.lastIndex=0;let B;while((B=fa.exec(j))!==null){let z=B[1].replace(/\..*$/,"");if(!ig.has(z))continue;let F=B[3].match(/\s+(?:in|of)\s+/);if(!F||F.index===void 0)continue;k(B[3].slice(0,F.index),T(B[3].slice(F.index+F[0].length)))}for(let z of v.matchAll(/@(?:php|js|ts)\b([\s\S]*?)@end(?:php|js|ts)\b/g))for(let F of z[1].matchAll(/\b(?:const|let|var|function|class)\s+([\w$]+)/g))k(F[1]);return[..._.values()].sort((z,F)=>z.name.localeCompare(F.name))}function ee(v){let _=new Set;for(let k of v.matchAll(/^\s*(?:export\s+)?(?:const|let|var)\s+([\w$]+)/gm))_.add(k[1]);for(let k of v.matchAll(/^\s*(?:export\s+)?(?:async\s+)?function\s*\*?\s*([\w$]+)/gm))_.add(k[1]);for(let k of v.matchAll(/^\s*(?:export\s+)?class\s+([\w$]+)/gm))_.add(k[1]);for(let k of v.matchAll(/^\s*(?:export\s+)?(?:const|let|var)\s*[[{]([^\]}]*)[\]}]/gm))for(let E of k[1].split(",")){let T=E.split(":").pop().split("=")[0].replace(/^\.\.\./,"").trim();if(/^[A-Z_$][\w$]*$/i.test(T))_.add(T)}return[..._].sort()}var Nl=["params","query","cookies","host","ip","setResponseStatus","setResponseHeader","notFound","request","url","definePageMeta","defineClientPayload","defineStore","props","$props"],iv={$bool:"declare function $bool(value: unknown, fallback?: boolean): boolean",$num:"declare function $num(value: unknown, fallback?: number): number",$uid:"declare var $uid: string"};function ti(v=new Set){return[...Nl.filter((_)=>!v.has(_)).map((_)=>`declare var ${_}: any`),...Object.entries(iv).filter(([_])=>!v.has(_)).map(([,_])=>_)].join(`
1884
- `)}function ni(v){return new Set([...v.matchAll(/^declare (?:function|const|let|var)\s+([A-Za-z_$][\w$]*)/gm)].map((_)=>_[1]))}function ag(v){let _=/\bdefineClientPayload\s*\(\s*\{([\s\S]*?)\}\s*\)/g,k,E=!1,T=new Set,j=s(v);while((k=_.exec(j))!==null){E=!0;for(let B of ov(k[1])){let z=B.split(":")[0].trim();if(/^[A-Za-z_$][\w$]*$/.test(z))T.add(z)}}return E?[...T]:null}function ov(v){let _=[],k=0,E="";for(let T of v){if(T===","&&k===0){_.push(E),E="";continue}if(T==="("||T==="["||T==="{")k++;else if(T===")"||T==="]"||T==="}")k--;E+=T}return _.push(E),_.filter((T)=>T.trim().length>0)}function av(v){let _=/^[ \t]*import\b[\s\S]*?(?:from\s*['"][^'"]*['"]|['"][^'"]*['"])[ \t]*;?[ \t]*$/gm,k=[],E=v.replace(_,(T)=>(k.push(T.trim()),T.split(`
1883
+ `.repeat(k)}`})}var tv=["foreach","endforeach","forelse","endforelse","for","endfor","while","endwhile","empty","if","elseif","else","endif","unless","endunless","isset","endisset","switch","case","default","endswitch","auth","endauth","guest","endguest","env","endenv","once","endonce","break","continue"],nv=new RegExp(String.raw`^[ \t]*@(?:${tv.join("|")})\b[ \t]*(\([^\n)]*\))?[ \t]*$`,"gm");function cs(v){return v.replace(nv,(_)=>_.replace(/[^\n]/g," "))}var eg=new Set(["x-cloak","x-ref","x-transition","x-teleport","v-slot","x-hydrate",":key","x-tooltip","x-tooltip-position"]);function bc(v){let _=da(v),k=[],E=/(@?)\{\{([\s\S]*?)\}\}|(@?)\{!!([\s\S]*?)!!\}/g,T;while((T=E.exec(_))!==null){if(T[1]||T[3])continue;let z=T[2]??T[4]??"",F=T[2]!==void 0?2:3,V=Qb(z);if(!V.trim())continue;let U=T.index+F+(V.length-V.trimStart().length);k.push({code:V.trim(),line:ro(_,U),column:so(_,U),offset:U,kind:"interpolation"})}let j=/@(if|elseif|else\s+if|unless)\b\s*\(/g;while((T=j.exec(_))!==null){let B=T.index+T[0].length-1,z=0,F=B;for(;F<_.length;F++){let Y=_[F];if(Y==="(")z++;else if(Y===")"){if(z--,z===0)break}}if(z!==0)continue;let V=_.slice(B+1,F),U=V.trim();if(j.lastIndex=F+1,!U)continue;let H=B+1+(V.length-V.trimStart().length);k.push({code:U,line:ro(_,H),column:so(_,H),offset:T.index,kind:"condition"})}fa.lastIndex=0;while((T=fa.exec(_))!==null){let B=T[1],z=T[3]??"",F=B.replace(/\..*$/,"").replace(/^([^:].*?):.*$/,"$1");if(eg.has(F)||eg.has(B))continue;if(!z.trim())continue;let V=T.index+T[0].indexOf(T[2],T[0].indexOf(B)+B.length)+1;if(og.has(F)){let H=z.match(/\s+(?:in|of)\s+/);if(!H||H.index===void 0)continue;let Y=z.slice(H.index+H[0].length),J=H.index+H[0].length+(Y.length-Y.trimStart().length);k.push({code:Qp(Y.trim()),line:ro(_,V+J),column:so(_,V+J),offset:V+J,kind:"directive",attribute:F});continue}let U=z.length-z.trimStart().length;k.push({code:Qp(z.trim()),line:ro(_,V+U),column:so(_,V+U),offset:V+U,kind:"directive",attribute:F})}return k.sort((B,z)=>B.line-z.line||B.column-z.column),k}var rv=2000;function sv(v,_){let k=0,E=Math.min(v.length,_+rv);for(let T=_;T<E;T++){let j=v[T];if(j==="(")k++;else if(j===")"){if(k--,k===0)return v.slice(_+1,T)}}return null}function iv(v){let _=new Map,k=(z,F)=>{let V=z.split(/[,[\]{}()\s]+/).filter(Boolean);for(let U of V){let H=U.replace(/^\.\.\./,"").trim();if(!/^\$?[A-Z_$][\w$]*$/i.test(H))continue;let Y=V.length===1?F:void 0,J=_.get(H);if(!J)_.set(H,{name:H,iterable:Y});else if(J.iterable!==Y)J.iterable=void 0}},E=/^\$?[A-Z_$][\w$]*$/i,T=(z)=>{let F=z.trim();return E.test(F)?F:void 0};for(let z of v.matchAll(/@for(?:each|else)\s*\(/g)){let F=sv(v,z.index+z[0].length-1);if(F===null)continue;let V=kt(F);if(!V)continue;k(V.itemVar.replace(/=>/g," "),T(V.arrayExpr))}for(let z of v.matchAll(/@for\s*\(\s*(?:(?:let|const|var)\s+)?([\w$]+|\[[^\]]*\]|\{[^}]*\})\s+(of|in)\s+([^)]*)/g))k(z[1],z[2]==="of"?T(z[3]):void 0);for(let z of v.matchAll(/@for\s*\(\s*(?:let|const|var)\s+([\w$]+)\s*[=;]/g))k(z[1]);let j=da(v);fa.lastIndex=0;let B;while((B=fa.exec(j))!==null){let z=B[1].replace(/\..*$/,"");if(!og.has(z))continue;let F=B[3].match(/\s+(?:in|of)\s+/);if(!F||F.index===void 0)continue;k(B[3].slice(0,F.index),T(B[3].slice(F.index+F[0].length)))}for(let z of v.matchAll(/@(?:php|js|ts)\b([\s\S]*?)@end(?:php|js|ts)\b/g))for(let F of z[1].matchAll(/\b(?:const|let|var|function|class)\s+([\w$]+)/g))k(F[1]);return[..._.values()].sort((z,F)=>z.name.localeCompare(F.name))}function ee(v){let _=new Set;for(let k of v.matchAll(/^\s*(?:export\s+)?(?:const|let|var)\s+([\w$]+)/gm))_.add(k[1]);for(let k of v.matchAll(/^\s*(?:export\s+)?(?:async\s+)?function\s*\*?\s*([\w$]+)/gm))_.add(k[1]);for(let k of v.matchAll(/^\s*(?:export\s+)?class\s+([\w$]+)/gm))_.add(k[1]);for(let k of v.matchAll(/^\s*(?:export\s+)?(?:const|let|var)\s*[[{]([^\]}]*)[\]}]/gm))for(let E of k[1].split(",")){let T=E.split(":").pop().split("=")[0].replace(/^\.\.\./,"").trim();if(/^[A-Z_$][\w$]*$/i.test(T))_.add(T)}return[..._].sort()}var Nl=["params","query","cookies","host","ip","setResponseStatus","setResponseHeader","notFound","request","url","definePageMeta","defineClientPayload","defineStore","props","$props"],ov={$bool:"declare function $bool(value: unknown, fallback?: boolean): boolean",$num:"declare function $num(value: unknown, fallback?: number): number",$uid:"declare var $uid: string"};function ti(v=new Set){return[...Nl.filter((_)=>!v.has(_)).map((_)=>`declare var ${_}: any`),...Object.entries(ov).filter(([_])=>!v.has(_)).map(([,_])=>_)].join(`
1884
+ `)}function ni(v){return new Set([...v.matchAll(/^declare (?:function|const|let|var)\s+([A-Za-z_$][\w$]*)/gm)].map((_)=>_[1]))}function cg(v){let _=/\bdefineClientPayload\s*\(\s*\{([\s\S]*?)\}\s*\)/g,k,E=!1,T=new Set,j=s(v);while((k=_.exec(j))!==null){E=!0;for(let B of av(k[1])){let z=B.split(":")[0].trim();if(/^[A-Za-z_$][\w$]*$/.test(z))T.add(z)}}return E?[...T]:null}function av(v){let _=[],k=0,E="";for(let T of v){if(T===","&&k===0){_.push(E),E="";continue}if(T==="("||T==="["||T==="{")k++;else if(T===")"||T==="]"||T==="}")k--;E+=T}return _.push(E),_.filter((T)=>T.trim().length>0)}function cv(v){let _=/^[ \t]*import\b[\s\S]*?(?:from\s*['"][^'"]*['"]|['"][^'"]*['"])[ \t]*;?[ \t]*$/gm,k=[],E=v.replace(_,(T)=>(k.push(T.trim()),T.split(`
1885
1885
  `).map(()=>"").join(`
1886
1886
  `)));return{imports:k.join(`
1887
- `),body:E}}function cg(v){let _=s(v),k=Array(_.length),E=0;for(let z=0;z<_.length;z++){let F=_[z];if(F==="}"||F===")"||F==="]")E=Math.max(0,E-1);if(k[z]=E,F==="{"||F==="("||F==="[")E++}let T=[],j=/^[ \t]*(?:export[ \t]+)?(interface|type)[ \t]+([A-Za-z_$][\w$]*)/gm,B;while((B=j.exec(_))!==null){if(k[B.index]!==0)continue;let z=B[1],F=B[2],V;if(z==="interface"){let U=_.indexOf("{",B.index);if(U===-1)continue;let H=0;V=-1;for(let Y=U;Y<_.length;Y++)if(_[Y]==="{")H++;else if(_[Y]==="}"&&--H===0){V=Y+1;break}if(V===-1)continue}else{let U=0;V=_.length;for(let H=_.indexOf("=",B.index)+1;H<_.length;H++){let Y=_[H];if(Y==="{"||Y==="["||Y==="("||Y==="<")U++;else if(Y==="}"||Y==="]"||Y===")"||Y===">")U--;else if(U<=0&&(Y===";"||Y===`
1888
- `&&!/[=|&,<([{]\s*$/.test(_.slice(Math.max(0,H-40),H)))){V=Y===";"?H+1:H;break}}}T.push({name:F,text:v.slice(B.index,V).replace(/^[ \t]*export[ \t]+/,"")}),j.lastIndex=V}return T}function cv(v){return new Set(cg(v).map((_)=>_.name))}function ri(v,_=""){let k=ag(v),E=cv(_),T=cg(v).filter((V)=>!E.has(V.name)).map((V)=>V.text);if(!k){let V=ee(v).filter((U)=>!So(_,U));if(V.length===0&&T.length===0)return"";return["",`// ${lv}`,...T,...V.map((U)=>`declare var ${U}: any`)].join(`
1889
- `)}if(k.length===0)return T.length>0?["",`// ${eg}`,...T].join(`
1890
- `):"";let{imports:j,body:B}=av(v),z=B.replace(/^[ \t]*export[ \t]+(?=(?:const|let|var|function|async|class)\b)/gm,""),F=["",`// ${eg}`];if(j)F.push(j);return F.push(...T),F.push(`async function ${tg}() {`,z,` return { ${k.join(", ")} }`,"}",`type ${ng} = Awaited<ReturnType<typeof ${tg}>>`,...k.map((V)=>`declare var ${V}: ${ng}[${JSON.stringify(V)}]`)),F.join(`
1887
+ `),body:E}}function lg(v){let _=s(v),k=Array(_.length),E=0;for(let z=0;z<_.length;z++){let F=_[z];if(F==="}"||F===")"||F==="]")E=Math.max(0,E-1);if(k[z]=E,F==="{"||F==="("||F==="[")E++}let T=[],j=/^[ \t]*(?:export[ \t]+)?(interface|type)[ \t]+([A-Za-z_$][\w$]*)/gm,B;while((B=j.exec(_))!==null){if(k[B.index]!==0)continue;let z=B[1],F=B[2],V;if(z==="interface"){let U=_.indexOf("{",B.index);if(U===-1)continue;let H=0;V=-1;for(let Y=U;Y<_.length;Y++)if(_[Y]==="{")H++;else if(_[Y]==="}"&&--H===0){V=Y+1;break}if(V===-1)continue}else{let U=0;V=_.length;for(let H=_.indexOf("=",B.index)+1;H<_.length;H++){let Y=_[H];if(Y==="{"||Y==="["||Y==="("||Y==="<")U++;else if(Y==="}"||Y==="]"||Y===")"||Y===">")U--;else if(U<=0&&(Y===";"||Y===`
1888
+ `&&!/[=|&,<([{]\s*$/.test(_.slice(Math.max(0,H-40),H)))){V=Y===";"?H+1:H;break}}}T.push({name:F,text:v.slice(B.index,V).replace(/^[ \t]*export[ \t]+/,"")}),j.lastIndex=V}return T}function lv(v){return new Set(lg(v).map((_)=>_.name))}function ri(v,_=""){let k=cg(v),E=lv(_),T=lg(v).filter((V)=>!E.has(V.name)).map((V)=>V.text);if(!k){let V=ee(v).filter((U)=>!$o(_,U));if(V.length===0&&T.length===0)return"";return["",`// ${uv}`,...T,...V.map((U)=>`declare var ${U}: any`)].join(`
1889
+ `)}if(k.length===0)return T.length>0?["",`// ${tg}`,...T].join(`
1890
+ `):"";let{imports:j,body:B}=cv(v),z=B.replace(/^[ \t]*export[ \t]+(?=(?:const|let|var|function|async|class)\b)/gm,""),F=["",`// ${tg}`];if(j)F.push(j);return F.push(...T),F.push(`async function ${ng}() {`,z,` return { ${k.join(", ")} }`,"}",`type ${rg} = Awaited<ReturnType<typeof ${ng}>>`,...k.map((V)=>`declare var ${V}: ${rg}[${JSON.stringify(V)}]`)),F.join(`
1891
1891
  `)}function jl(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!==`
1892
- `)k[T]=" "}return ee(k.join(""))}function si(v,_){if(ag(v)!==null)return[];let k=s(_),E=new Set(y);return jl(v).filter((T)=>{if(E.has(T))return!1;if(ee(_).includes(T))return!1;return new RegExp(`(?<![.#\\w$])${T}(?![\\w$])`).test(k)})}var eg="stx: types for the declared client payload (#1868)",lv="stx: untyped bridge names \u2014 declare a defineClientPayload to check these (#1868)",tg="__stxServerScope",ng="__StxClientPayload";var rg=["$env","$user","$slot","$slots","$attrs","$props","$page","$route","$loop","loop","$errors","$csrf","props","slot"];var uv=/^\s*[A-Z_$][\w$]*\s*=[^=]/i;function dv(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 U=F[2],H=V+F[0].length-F[3].length,Y=E.slice(H,V+F[0].length).trim().replace(/;$/,"").trim(),J=F[3],re=k.test(J)&&!/\bawait\b|=>|\bfunction\b|[{}]/.test(J)&&!/[,+\-*/%&|?:=]$/.test(Y)&&ve(J).balanced;_.set(U,_.has(U)||!re?null:Y)}}return new Map([..._].filter((E)=>E[1]!==null))}function lg(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],U=_.get(V);if(!U||E.has(V))continue;let H=T.slice(0,F).trimEnd(),Y=T.slice(F+V.length).trimStart();if(H.endsWith(".")||/^:(?!:)/.test(Y)&&/[{,]$/.test(H))continue;if(F>0&&/[\w$]/.test(T[F-1]))continue;j+=`${v.slice(B,F)}(${lg(U,_,k+1,new Set([...E,V]))})`,B=F+V.length}return j+v.slice(B)}function fv(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 U=v[F];if(U==="(")z++;else if(U===")"){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 pv(v){let _=v.code.trim();if(!_)return null;if(v.attribute?.startsWith("@")){if(uv.test(_))return null;let E=";(($event: any): void => { ";return{text:`${E}${_} });`,prefixLength:E.length}}let k=";void ((";return{text:`${k}${_}));`,prefixLength:k.length}}var gv=/(\bfrom\s*|\bimport\s*\(\s*|\bimport\s+)(['"])(\.{1,2}\/[^'"\n]*)\2/g;function Gn(v,_){if(!_)return v;return v.replace(gv,(k,E,T,j)=>{let B=sg.resolve(_,j).replace(/\\/g,"/");return`${E}${T}${B}${T}`})}function ls(v){return" ".repeat(Math.max(0,(v.startColumn??1)-1))}function mv(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 U=V.trim().replace(/^type\s+/,"").split(/\s+as\s+/).pop()?.trim();if(U&&/^[A-Z_$][\w$]*$/i.test(U))_.add(U)}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 oi(v,_={}){let k=Ve(v),E=v.split(`
1893
- `),T=Array.from({length:E.length},()=>""),j=new Map,B=_.filePath&&_.templateExpressions!==!1?Zp(v,da(v),{filePath:_.filePath,componentsDir:_.componentsDir,projectRoot:_.projectRoot,readComponent:_.readComponent,scriptCode:(H,Y)=>Ve(H).map((J)=>Gn(J.code,sg.dirname(Y))).join(`
1892
+ `)k[T]=" "}return ee(k.join(""))}function si(v,_){if(cg(v)!==null)return[];let k=s(_),E=new Set(y);return jl(v).filter((T)=>{if(E.has(T))return!1;if(ee(_).includes(T))return!1;return new RegExp(`(?<![.#\\w$])${T}(?![\\w$])`).test(k)})}var tg="stx: types for the declared client payload (#1868)",uv="stx: untyped bridge names \u2014 declare a defineClientPayload to check these (#1868)",ng="__stxServerScope",rg="__StxClientPayload";var sg=["$env","$user","$slot","$slots","$attrs","$props","$page","$route","$loop","loop","$errors","$csrf","props","slot"];var dv=/^\s*[A-Z_$][\w$]*\s*=[^=]/i;function fv(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 U=F[2],H=V+F[0].length-F[3].length,Y=E.slice(H,V+F[0].length).trim().replace(/;$/,"").trim(),J=F[3],re=k.test(J)&&!/\bawait\b|=>|\bfunction\b|[{}]/.test(J)&&!/[,+\-*/%&|?:=]$/.test(Y)&&ve(J).balanced;_.set(U,_.has(U)||!re?null:Y)}}return new Map([..._].filter((E)=>E[1]!==null))}function ug(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],U=_.get(V);if(!U||E.has(V))continue;let H=T.slice(0,F).trimEnd(),Y=T.slice(F+V.length).trimStart();if(H.endsWith(".")||/^:(?!:)/.test(Y)&&/[{,]$/.test(H))continue;if(F>0&&/[\w$]/.test(T[F-1]))continue;j+=`${v.slice(B,F)}(${ug(U,_,k+1,new Set([...E,V]))})`,B=F+V.length}return j+v.slice(B)}function pv(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 U=v[F];if(U==="(")z++;else if(U===")"){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 gv(v){let _=v.code.trim();if(!_)return null;if(v.attribute?.startsWith("@")){if(dv.test(_))return null;let E=";(($event: any): void => { ";return{text:`${E}${_} });`,prefixLength:E.length}}let k=";void ((";return{text:`${k}${_}));`,prefixLength:k.length}}var mv=/(\bfrom\s*|\bimport\s*\(\s*|\bimport\s+)(['"])(\.{1,2}\/[^'"\n]*)\2/g;function Gn(v,_){if(!_)return v;return v.replace(mv,(k,E,T,j)=>{let B=ig.resolve(_,j).replace(/\\/g,"/");return`${E}${T}${B}${T}`})}function ls(v){return" ".repeat(Math.max(0,(v.startColumn??1)-1))}function hv(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 U=V.trim().replace(/^type\s+/,"").split(/\s+as\s+/).pop()?.trim();if(U&&/^[A-Z_$][\w$]*$/i.test(U))_.add(U)}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 oi(v,_={}){let k=Ve(v),E=v.split(`
1893
+ `),T=Array.from({length:E.length},()=>""),j=new Map,B=_.filePath&&_.templateExpressions!==!1?Gp(v,da(v),{filePath:_.filePath,componentsDir:_.componentsDir,projectRoot:_.projectRoot,readComponent:_.readComponent,scriptCode:(H,Y)=>Ve(H).map((J)=>Gn(J.code,ig.dirname(Y))).join(`
1894
1894
  `)}):void 0,z=new Set,F=[];for(let H of k){let Y=cs(as(H.code)),J=Gn(Y,_.originDir??"").split(`
1895
1895
  `);J.forEach((re,se)=>{let ie=H.startLine-1+se;if(ie<T.length)T[ie]=se===0?ls(H)+re:re,z.add(ie)}),F.push(H.startLine-1+J.length-1)}for(let H of F){let Y=T[H]?.trim()===""?H:H+1;if(Y<T.length&&T[Y].trim()===""&&(Y===H||!z.has(Y)))T[Y]=";"}let V=(H,Y)=>{for(let[J,re]of H.split(`
1896
- `).entries())if(T.push(re),Y)j.set(T.length,J===0?Y:{...Y,line:Y.line+J,column:1,prefixLength:0})};if(_.globals!==!1){V("");let H=new Set([...k.flatMap((se)=>ee(se.code)),...k.flatMap((se)=>mv(se.code))]),Y=(se)=>{if(!H.has(se))V(`declare var ${se}: any`)};if(_.runtimeGlobals!==!1){if(!H.has("window"))V("declare var window: any");for(let se of y)Y(se)}let J=[...new Set([...Nl,...q,...rg])].filter((se)=>_.runtimeGlobals!==!1||!y.includes(se));if(_.contextScope==="global"){V("declare global {");for(let se of J)V(` var ${se}: any`);V("}")}else{for(let se of Nl)Y(se);for(let se of q)Y(se);for(let se of rg)Y(se)}V(`declare var ${Ml}: any`);let re=new Set(k.flatMap((se)=>ee(se.code)));V(`type ${Jp}<T> = T extends readonly (infer E)[] ? E : T extends Iterable<infer E2> ? E2 : any`);for(let se of sv(v)){if(re.has(se.name))continue;let ie=se.iterable&&re.has(se.iterable)?`${Jp}<typeof ${se.iterable}>`:"any";V(`declare var ${se.name}: ${ie}`)}}if(_.templateExpressions!==!1){if(B?.declarations)for(let Y of B.declarations.split(`
1897
- `))V(Y);let H=bc(v).map((Y)=>{let J=B?.events.get(Y.offset??-1);if(J){Y.anchor=!0;let re=Y.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: ${J}) => unknown)`:re,ae=`;(($event: ${J}): void => { `;return{expression:Y,statement:{text:`${ae}${ie} });`,prefixLength:ae.length}}}return{expression:Y,statement:pv(Y)}}).filter((Y)=>Y.statement!==null);if(H.push(...B?.checks||[]),H.length>0){let Y=da(v),J=dv(k.map((ae)=>ae.code)),se=[...new Set(k.flatMap((ae)=>ee(ae.code)))].filter((ae)=>/^[A-Z_$][\w$]*$/i.test(ae)),ie=0;if(se.length>0){V(Qb);for(let ae of se)V(`type __StxT_${ae} = ${og}<typeof ${ae}>`);V(`;((${se.map((ae)=>`${ae}: __StxT_${ae}`).join(", ")}) => {`),ie=1}for(let{expression:ae,statement:ce}of H){let oe=" ".repeat(ie),pe=ae.offset===void 0?[]:fv(Y,ae.offset),he=pe.length>0?`${pe.map(($e)=>`if (${lg($e,J)}) `).join("")}{ `:"",xe=pe.length>0?" }":"";V(oe+he+ce.text+xe,{line:ae.line,column:ae.column,expression:ae,prefixLength:ce.prefixLength+oe.length+he.length,guardPrefixLength:oe.length+he.length})}if(ie>0)V("});")}}let U=!1;if(_.reference&&T[0]!==void 0&&T[0].trim()==="")T[0]=`/// <reference path=${JSON.stringify(_.reference.replace(/\\/g,"/"))} />`,U=!0;return V("export {}"),{text:T.join(`
1898
- `),lineMap:j,sourceLineCount:E.length,componentDependencies:B?.dependencies,referenced:U}}function ii(v,_){if(!v.expression)return!1;return v.inGuard===!0||_===2774}function ai(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 ug from"fs";import dg from"path";var fg=!1;function hv(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=(H)=>{if(B.size===0)return!1;let Y=s(H),J=Y.match(/^\s*[!+~(-]*\s*([a-zA-Z_$][\w$]*)/)?.[1];if(J&&B.has(J))return!0;for(let re of B){let se=re.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(new RegExp(`(?:^|[^\\w$.])${se}\\s*\\(`).test(Y))return!0}return!1},F=new Set(Fi),V=(H)=>{if(!H.includes("-")||H.startsWith("@")||H.startsWith(":")||H.startsWith("x-")||H.startsWith("__"))return H;if(H.startsWith("aria-")||H.startsWith("data-"))return H;return H.replace(/-([a-z0-9])/g,(Y,J)=>J.toUpperCase())},U=(H,Y)=>{let J=V(H);if(j.static[J]=Y,J!==H)j.staticNames[J]=H};for(let[H,Y]of Object.entries(v)){let J=H.startsWith("x-")&&!F.has(H)&&!H.startsWith("x-bind:")&&!H.startsWith("x-on:")?`:${H.slice(2)}`:H;if(J.startsWith("@")){j.events[J]=Y;continue}if(J.startsWith("__stx_")){let re=V(J.slice(6));j.serverDynamic[re]=Fp(Y,k);continue}if(J.startsWith(":")){let re=V(J.slice(1)),se=Y===Sr?re:Y;if(re==="if"||re==="for"||re==="show"){j.clientReactive[re]=se;continue}if(E){j.clientReactive[re]=se;continue}if(Tr(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"]),ce=new Set(Array.isArray(_.__stx_client_declared_names)?_.__stx_client_declared_names:[]);if(ke(se).some((xe)=>!ae.has(xe)&&!ie.includes(xe)&&(!(xe in globalThis)||ce.has(xe)))){j.clientReactive[re]=se;continue}let he=c(se,ie)(...Object.values(_));if(j.serverDynamic[re]=he,re!==J.slice(1)&&j.serverDynamicNames)j.serverDynamicNames[re]=J.slice(1)}catch{j.clientReactive[re]=se}continue}if(typeof Y==="string"&&Y.includes("{{")&&Y.includes("}}")){let re=yv(Y,T);if(re!==null){j.clientReactive[V(J)]=re;continue}let se=Y.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(se)try{let ie=se[1];if(p(ie)){let ce=c(ie,Object.keys(_))(...Object.values(_));U(J,ce!=null?String(ce):"")}else{if(k.debug)console.error(`Unsafe expression in ${J}: ${ie}`);U(J,Y)}}catch(ie){if(k.debug)console.error(`Error evaluating expression for ${J}:`,ie);U(J,Y)}else{let ie=Y,ae=/\{\{\s*([\s\S]+?)\s*\}\}/g,ce;while((ce=ae.exec(Y))!==null)try{let oe=ce[1];if(!p(oe)){if(k.debug)console.error(`Unsafe expression in ${J}: ${oe}`);continue}let he=c(oe,Object.keys(_))(...Object.values(_));ie=ie.replace(ce[0],String(he??""))}catch(oe){if(k.debug)console.error(`Error evaluating expression in ${J}:`,oe)}U(J,ie)}continue}U(J,Y===Sr?"true":Wp(Y))}return j}function yv(v,_){if(_.size===0)return null;let k=/\{\{\s*([\s\S]+?)\s*\}\}/g,E=[...v.matchAll(k)];if(!E.some((z)=>Tr(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 xv=[[/@if\s*\(/,"@endif"],[/@unless\s*\(/,"@endunless"]];function bv(v,_,k){if(!v.includes("@"))return v;if(!xv.some(([T,j])=>T.test(v)&&v.includes(j)))return v;try{return lr(v,_,k)}catch{return v}}function mg(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=Il(v,k),k+=j.length;let B=Vp(j);if(B!==null){_[`:${T}`]=B;continue}}else while(k<E&&!/\s/.test(v[k]))j+=v[k],k++;_[T]=j}else _[T]=Sr}return _}function pg(v){return Object.entries(v).map(([_,k])=>k===Sr?_:`${_}="${vv(k)}"`).join(" ")}function vv(v){return v.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function wv(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(Fs.isBuiltin(T))_.add(T)}return[..._].sort()}async function wc(v,_,k,E,T){if(!/import\s/.test(v))return v;if(!_.__importedComponents)_.__importedComponents=new Map;let j=_.__importedComponents,B=dg.dirname(k),z=[],F=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi;for(let H of v.matchAll(F)){let[Y,J,re]=H,se=/import\s+(?:(\{[^}]*\})|([A-Za-z_$][\w$]*))\s+from\s+['"]([^'"]+)['"]\s*;?\s*\n?/g,ie=re,ae,ce=[];while((ae=se.exec(re))!==null){let[oe,pe,he,xe]=ae,$e=null,Re=null;if(xe.startsWith(".")||xe.startsWith("/")){let Te=dg.resolve(B,xe);if(Te.endsWith(".stx"))Re=Te;else{let _e=`${Te}.stx`;try{if(ug.statSync(_e).isFile())Re=_e}catch{try{if(ug.statSync(Te).isDirectory())$e=Te}catch{}}}}else $e=vo(xe,B);if(!$e&&!Re)continue;let Ce=!1,Ae=(Te,_e)=>{j.set(Te,_e),j.set(Te.toLowerCase(),_e);let Pe=Te.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();j.set(Pe,_e),T.add(_e)};if(he&&Re)Ae(he,Re),Ce=!0;else if(pe){let Te=pe.slice(1,-1).split(",").map((Pe)=>Pe.trim()).filter(Boolean).map((Pe)=>{let Me=Pe.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(Me)return{source:Me[1],local:Me[2]};return{source:Pe,local:Pe}}),_e=$e?bo($e):null;for(let{source:Pe,local:Me}of Te){let Oe=null;if(Re)Oe=Re;else if(_e)Oe=_e.get(Pe)??_e.get(Pe.toLowerCase())??_e.get(Pe.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase())??null;if(Oe)Ae(Me,Oe),Ce=!0}}if(Ce)ce.push({start:ae.index,end:ae.index+oe.length})}if(ce.length===0)continue;for(let oe=ce.length-1;oe>=0;oe--)ie=ie.slice(0,ce[oe].start)+ie.slice(ce[oe].end);z.push({start:H.index,end:H.index+Y.length,value:`<script${J}>${ie}</script>`})}if(z.length===0)return v;let V=[],U=0;for(let H of z)V.push(v.slice(U,H.start),H.value),U=H.end;return V.push(v.slice(U)),V.join("")}async function Sv(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,U]=F,H=U.split(",").map((Y)=>Y.trim().replace(/^['"]|['"]$/g,"")).filter((Y)=>Y.length>0);for(let Y of H){let J=Y.split("/"),se=J[J.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,ce=wo(Y,k,E);for(let oe of ce)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: ${Y}`)}j=j.replace(V,""),z.lastIndex=0}return j}async function $v(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 U=V.index,H=U+V[0].length-1,Y=1,J=H+1;while(J<j.length&&Y>0){if(j[J]==="(")Y++;else if(j[J]===")"){if(Y--,Y===0)break}J++}if(Y!==0)break;let re=j.substring(H+1,J),se=J+1,ie=re.match(/^\s*['"]([^'"]+)['"]/);if(!ie){F.lastIndex=0;continue}let ae=ie[1],ce,oe=re.slice(ie[0].length),pe=oe.match(/^\s*,\s*/);if(pe)ce=oe.slice(pe[0].length).trim();let he={};if(ce)try{he=O(ce,_)}catch(Te){let _e=Te instanceof Error?Te.message:String(Te);j=j.replace(j.substring(U,se),`[Error parsing component props: ${_e}]`);continue}let xe="",$e=se,Ce=j.substring(se).match(/^([\s\S]*?)@endcomponent/);if(Ce)xe=Ce[1].trim(),$e=se+Ce[0].length;let Ae=await Ke(ae,he,xe,B,_,k,E,z,T);j=j.substring(0,U)+Ae+j.substring($e),F.lastIndex=0}return j}async function _v(v,_,k,E,T){if(!v)return v;let j=v,B=E.componentsDir||"components";if(!_.__processedComponents)_.__processedComponents=new Set;let z=_.__processedComponents,F=Cv(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=$n(j);j=V.output;let U=yr(_);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,Bp(eo)),j=await re(j,/[a-z][a-z0-9]*/,!1,eo),j=V.restore(j),j;async function re(se,ie,ae,ce){if(!se)return se;let oe=se,pe=zp(oe,ie,ce),he=Pl(oe),xe=new Map;for(let Ce=pe.length-1;Ce>=0;Ce--){let Ae=pe[Ce],Te=ae?tn(Ae.tagName):Ae.tagName,_e=mg(bv(Ae.attributes,_,k)),Pe=he.filter(({start:ct,end:vt})=>Ae.startIndex>=ct&&Ae.startIndex<vt),Me=Pe.length>0,Oe=new Set(U);for(let ct of Pe)for(let vt of ct.names)Oe.add(vt);let Ie=hv(_e,_,E,Me,Oe);if(typeof Ie.clientReactive.for==="string")for(let ct of Es(Ie.clientReactive.for))Oe.add(ct);let Ne=Fs.getBuiltin(Ae.tagName),at=Ne?await Jn(Ae.tagName,B,_,k,E):!1;if(Ne&&!at){let ct={context:_,filePath:k,options:E,dependencies:T},vt=Ne.render(Ie,Ae.content,ct);if(Object.keys(Ie.events).length>0){let ut=pg(Ie.events);vt=vt.replace(/^(\s*<[a-zA-Z][a-zA-Z0-9-]*)/,`$1 ${ut}`)}if(Object.keys(Ie.clientReactive).length>0)vt=gg(vt,Ie.clientReactive);xe.set(Ce,vt);continue}if(!ae&&Ae.tagName.includes("-")&&!await Jn(Te,B,_,k,E))continue;let ht={};for(let[ct,vt]of Object.entries(Ie.static))ht[ct]=vt;for(let[ct,vt]of Object.entries(Ie.serverDynamic))ht[ct]=vt;let dt={declaredProps:new Set},ft=await Ke(Te,ht,V.restore(Ae.content),B,_,k,E,z,T,[...Oe],dt,Ae.tagName);if(ft=kv(ft,Ie,dt.declaredProps),Object.keys(Ie.events).length>0){let ct=Ll(ft);if(ct){let vt=pg(Ie.events),ut=Object.keys(Ie.events).map((wt)=>wt.replace(/^@/,"").split(".")[0]).join(" ");ft=ft.substring(0,ct.insertPos)+` data-stx-parent-events="${ut}" ${vt}`+ft.substring(ct.insertPos)}}if(Object.keys(Ie.clientReactive).length>0)ft=gg(ft,Ie.clientReactive);xe.set(Ce,ft)}if(xe.size===0)return oe;let $e="",Re=0;for(let Ce=0;Ce<pe.length;Ce++){let Ae=xe.get(Ce);if(Ae===void 0)continue;$e+=oe.slice(Re,pe[Ce].startIndex),$e+=Ae,Re=pe[Ce].endIndex}return $e+=oe.slice(Re),$e}}function gg(v,_){let k=new Set(["if","for"]),E=new Set(["show"]),T=Object.entries(_).filter(([U])=>!k.has(U)),j=T.filter(([U])=>!E.has(U)).map(([U])=>tn(U)).join(" "),B=v,z=T.length>0?Ll(B):null;if(z){let U=T.map(([Y,J])=>`:${tn(Y)}="${J.replace(/"/g,"&quot;")}"`).join(" "),H=j?` data-stx-parent-bindings="${j}"`:"";B=B.substring(0,z.insertPos)+`${H} ${U}`+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 kv(v,_,k=new Set){let E=Ev(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(mg(T))),z=new Set(["class","className"]);for(let U of Object.keys(_.static)){let H=_.staticNames[U]??U;if(B.has(H)||!j&&(k.has(U)||!cl(H)))z.add(U)}for(let U of Object.keys(_.serverDynamic)){let H=_.serverDynamicNames?.[U]??U;if(B.has(H)||!j&&(k.has(U)||!cl(H)))z.add(U)}let F=[];if(j){for(let[U,H]of Object.entries(_.static)){if(z.has(U)||H!==!0&&H!==Sr)continue;z.add(U),F.push(`${Lt(_.staticNames?.[U]??U)}="true"`)}for(let[U,H]of Object.entries(_.serverDynamic)){if(z.has(U)||H!==!0)continue;z.add(U),F.push(`${Lt(_.serverDynamicNames?.[U]??U)}="true"`)}}let V=[...$r(_,z),..._r(_,z),...F];if(j){for(let[U,H]of Object.entries(_.serverDynamic)){if(z.has(U)||H!==!1)continue;let Y=_.serverDynamicNames?.[U]??U;V.push(`${Lt(Y)}="false"`)}for(let[U,H]of Object.entries(_.serverDynamic)){if(z.has(U)||H===null||typeof H!=="object")continue;let Y=JSON.stringify(H);if(Y!==void 0){let J=_.serverDynamicNames?.[U]??U;V.push(`${Lt(J)}="${Lt(Y)}"`)}}}if(V.length===0)return v;return`${v.slice(0,E.insertPos)} ${V.join(" ")}${v.slice(E.insertPos)}`}function Ll(v){let _=hg(v,0);if(_)return _;let k=/<([a-zA-Z][a-zA-Z0-9-]*)\b[^>]*\bdata-stx-scope(?:\s|=|>)/i.exec(v);if(k)return{insertPos:k.index+1+k[1].length,tagEnd:yg(v,k.index+1+k[1].length)};return null}function Ev(v){let _=Ll(v);if(!_)return null;let k=v.slice(_.insertPos,_.tagEnd);if(!/\bdata-stx-component-wrapper(?:\s|=|>|$)/i.test(k))return _;return hg(v,_.tagEnd+1)}function hg(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:yg(v,k+1+B[1].length)}}return null}function yg(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 Cv(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 jl(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 ds(v,_,k,E,T){if(!fg)Np(Fs),fg=!0;let j=await wc(v,_,k,E,T);j=await Sv(j,_,k,E,T),j=await $v(j,_,k,E,T);let B=[];for(let z=0;z<3;z++){let F=B.length,V=Pn(j,Fe,(H,Y)=>`\x00STX_COMPONENT_COMMENT_${F+Y}\x00`,`STX_COMPONENT_COMMENT:${F}`);B.push(...V.tokens);let U=j;if(j=await _v(V.output,_,k,E,T),j===U)break}if(B.length>0)j=j.replace(/\x00STX_COMPONENT_COMMENT_(\d+)\x00/g,(z,F)=>B[Number(F)]??"");if(E.debug){let z=wv(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 Bl(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 Av(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 U=E.substring(z+1,V-1),H=`${k}(${U})`;E=E.substring(0,B)+H+E.substring(V),T.lastIndex=B+H.length,j=T.exec(E)}return E}function Tv(v){return/\b(state|derived|effect)\s*(?:<[^<>()]*>)?\s*\(/.test(v)}function wg(v){let _=v,k=[],E=new Set,T=0,j=0,B=_.length,z=(H)=>{j++;while(j<B){if(_[j]==="\\"){j+=2;continue}if(_[j]===H){j++;return}j++}},F=()=>{j++;while(j<B){if(_[j]==="\\"){j+=2;continue}if(_[j]==="`"){j++;return}if(_[j]==="$"&&_[j+1]==="{"){j+=2;let H=1;while(j<B&&H>0)if(_[j]==="{")H++,j++;else if(_[j]==="}")H--,j++;else if(_[j]==="'"||_[j]==='"')z(_[j]);else if(_[j]==="`")F();else j++;continue}j++}},V=()=>{if(_[j]==="/"&&_[j+1]==="/"){while(j<B&&_[j]!==`
1899
- `)j++;return!0}if(_[j]==="/"&&_[j+1]==="*"){j+=2;while(j<B-1&&!(_[j]==="*"&&_[j+1]==="/"))j++;return j+=2,!0}return!1},U=()=>{if(T!==0)return;let H=_.slice(j).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(H){let re=H[2];if(!E.has(re))k.push(re),E.add(re);return}let Y=_.slice(j).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(Y){let re=Y[1];if(!E.has(re))k.push(re),E.add(re);return}let J=_.slice(j).match(/^async\s+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)}};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])))U();j++}return k.join(", ")}function Iv(v,_=""){let k=wg(v).split(",").map((E)=>E.trim()).filter(Boolean);return`
1896
+ `).entries())if(T.push(re),Y)j.set(T.length,J===0?Y:{...Y,line:Y.line+J,column:1,prefixLength:0})};if(_.globals!==!1){V("");let H=new Set([...k.flatMap((se)=>ee(se.code)),...k.flatMap((se)=>hv(se.code))]),Y=(se)=>{if(!H.has(se))V(`declare var ${se}: any`)};if(_.runtimeGlobals!==!1){if(!H.has("window"))V("declare var window: any");for(let se of y)Y(se)}let J=[...new Set([...Nl,...q,...sg])].filter((se)=>_.runtimeGlobals!==!1||!y.includes(se));if(_.contextScope==="global"){V("declare global {");for(let se of J)V(` var ${se}: any`);V("}")}else{for(let se of Nl)Y(se);for(let se of q)Y(se);for(let se of sg)Y(se)}V(`declare var ${Ol}: any`);let re=new Set(k.flatMap((se)=>ee(se.code)));V(`type ${Yp}<T> = T extends readonly (infer E)[] ? E : T extends Iterable<infer E2> ? E2 : any`);for(let se of iv(v)){if(re.has(se.name))continue;let ie=se.iterable&&re.has(se.iterable)?`${Yp}<typeof ${se.iterable}>`:"any";V(`declare var ${se.name}: ${ie}`)}}if(_.templateExpressions!==!1){if(B?.declarations)for(let Y of B.declarations.split(`
1897
+ `))V(Y);let H=bc(v).map((Y)=>{let J=B?.events.get(Y.offset??-1);if(J){Y.anchor=!0;let re=Y.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: ${J}) => unknown)`:re,ae=`;(($event: ${J}): void => { `;return{expression:Y,statement:{text:`${ae}${ie} });`,prefixLength:ae.length}}}return{expression:Y,statement:gv(Y)}}).filter((Y)=>Y.statement!==null);if(H.push(...B?.checks||[]),H.length>0){let Y=da(v),J=fv(k.map((ae)=>ae.code)),se=[...new Set(k.flatMap((ae)=>ee(ae.code)))].filter((ae)=>/^[A-Z_$][\w$]*$/i.test(ae)),ie=0;if(se.length>0){V(ev);for(let ae of se)V(`type __StxT_${ae} = ${ag}<typeof ${ae}>`);V(`;((${se.map((ae)=>`${ae}: __StxT_${ae}`).join(", ")}) => {`),ie=1}for(let{expression:ae,statement:ce}of H){let oe=" ".repeat(ie),pe=ae.offset===void 0?[]:pv(Y,ae.offset),he=pe.length>0?`${pe.map(($e)=>`if (${ug($e,J)}) `).join("")}{ `:"",xe=pe.length>0?" }":"";V(oe+he+ce.text+xe,{line:ae.line,column:ae.column,expression:ae,prefixLength:ce.prefixLength+oe.length+he.length,guardPrefixLength:oe.length+he.length})}if(ie>0)V("});")}}let U=!1;if(_.reference&&T[0]!==void 0&&T[0].trim()==="")T[0]=`/// <reference path=${JSON.stringify(_.reference.replace(/\\/g,"/"))} />`,U=!0;return V("export {}"),{text:T.join(`
1898
+ `),lineMap:j,sourceLineCount:E.length,componentDependencies:B?.dependencies,referenced:U}}function ii(v,_){if(!v.expression)return!1;return v.inGuard===!0||_===2774}function ai(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 dg from"fs";import fg from"path";var pg=!1;function yv(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=(H)=>{if(B.size===0)return!1;let Y=s(H),J=Y.match(/^\s*[!+~(-]*\s*([a-zA-Z_$][\w$]*)/)?.[1];if(J&&B.has(J))return!0;for(let re of B){let se=re.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(new RegExp(`(?:^|[^\\w$.])${se}\\s*\\(`).test(Y))return!0}return!1},F=new Set(Fi),V=(H)=>{if(!H.includes("-")||H.startsWith("@")||H.startsWith(":")||H.startsWith("x-")||H.startsWith("__"))return H;if(H.startsWith("aria-")||H.startsWith("data-"))return H;return H.replace(/-([a-z0-9])/g,(Y,J)=>J.toUpperCase())},U=(H,Y)=>{let J=V(H);if(j.static[J]=Y,J!==H)j.staticNames[J]=H};for(let[H,Y]of Object.entries(v)){let J=H.startsWith("x-")&&!F.has(H)&&!H.startsWith("x-bind:")&&!H.startsWith("x-on:")?`:${H.slice(2)}`:H;if(J.startsWith("@")){j.events[J]=Y;continue}if(J.startsWith("__stx_")){let re=V(J.slice(6));j.serverDynamic[re]=Vp(Y,k);continue}if(J.startsWith(":")){let re=V(J.slice(1)),se=Y===Sr?re:Y;if(re==="if"||re==="for"||re==="show"){j.clientReactive[re]=se;continue}if(E){j.clientReactive[re]=se;continue}if(Tr(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"]),ce=new Set(Array.isArray(_.__stx_client_declared_names)?_.__stx_client_declared_names:[]);if(ke(se).some((xe)=>!ae.has(xe)&&!ie.includes(xe)&&(!(xe in globalThis)||ce.has(xe)))){j.clientReactive[re]=se;continue}let he=c(se,ie)(...Object.values(_));if(j.serverDynamic[re]=he,re!==J.slice(1)&&j.serverDynamicNames)j.serverDynamicNames[re]=J.slice(1)}catch{j.clientReactive[re]=se}continue}if(typeof Y==="string"&&Y.includes("{{")&&Y.includes("}}")){let re=xv(Y,T);if(re!==null){j.clientReactive[V(J)]=re;continue}let se=Y.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(se)try{let ie=se[1];if(p(ie)){let ce=c(ie,Object.keys(_))(...Object.values(_));U(J,ce!=null?String(ce):"")}else{if(k.debug)console.error(`Unsafe expression in ${J}: ${ie}`);U(J,Y)}}catch(ie){if(k.debug)console.error(`Error evaluating expression for ${J}:`,ie);U(J,Y)}else{let ie=Y,ae=/\{\{\s*([\s\S]+?)\s*\}\}/g,ce;while((ce=ae.exec(Y))!==null)try{let oe=ce[1];if(!p(oe)){if(k.debug)console.error(`Unsafe expression in ${J}: ${oe}`);continue}let he=c(oe,Object.keys(_))(...Object.values(_));ie=ie.replace(ce[0],String(he??""))}catch(oe){if(k.debug)console.error(`Error evaluating expression in ${J}:`,oe)}U(J,ie)}continue}U(J,Y===Sr?"true":Fp(Y))}return j}function xv(v,_){if(_.size===0)return null;let k=/\{\{\s*([\s\S]+?)\s*\}\}/g,E=[...v.matchAll(k)];if(!E.some((z)=>Tr(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 bv=[[/@if\s*\(/,"@endif"],[/@unless\s*\(/,"@endunless"]];function vv(v,_,k){if(!v.includes("@"))return v;if(!bv.some(([T,j])=>T.test(v)&&v.includes(j)))return v;try{return lr(v,_,k)}catch{return v}}function hg(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=Il(v,k),k+=j.length;let B=Up(j);if(B!==null){_[`:${T}`]=B;continue}}else while(k<E&&!/\s/.test(v[k]))j+=v[k],k++;_[T]=j}else _[T]=Sr}return _}function gg(v){return Object.entries(v).map(([_,k])=>k===Sr?_:`${_}="${wv(k)}"`).join(" ")}function wv(v){return v.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Sv(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(Fs.isBuiltin(T))_.add(T)}return[..._].sort()}async function wc(v,_,k,E,T){if(!/import\s/.test(v))return v;if(!_.__importedComponents)_.__importedComponents=new Map;let j=_.__importedComponents,B=fg.dirname(k),z=[],F=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi;for(let H of v.matchAll(F)){let[Y,J,re]=H,se=/import\s+(?:(\{[^}]*\})|([A-Za-z_$][\w$]*))\s+from\s+['"]([^'"]+)['"]\s*;?\s*\n?/g,ie=re,ae,ce=[];while((ae=se.exec(re))!==null){let[oe,pe,he,xe]=ae,$e=null,Re=null;if(xe.startsWith(".")||xe.startsWith("/")){let Te=fg.resolve(B,xe);if(Te.endsWith(".stx"))Re=Te;else{let _e=`${Te}.stx`;try{if(dg.statSync(_e).isFile())Re=_e}catch{try{if(dg.statSync(Te).isDirectory())$e=Te}catch{}}}}else $e=wo(xe,B);if(!$e&&!Re)continue;let Ce=!1,Ae=(Te,_e)=>{j.set(Te,_e),j.set(Te.toLowerCase(),_e);let Pe=Te.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();j.set(Pe,_e),T.add(_e)};if(he&&Re)Ae(he,Re),Ce=!0;else if(pe){let Te=pe.slice(1,-1).split(",").map((Pe)=>Pe.trim()).filter(Boolean).map((Pe)=>{let Oe=Pe.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(Oe)return{source:Oe[1],local:Oe[2]};return{source:Pe,local:Pe}}),_e=$e?vo($e):null;for(let{source:Pe,local:Oe}of Te){let Me=null;if(Re)Me=Re;else if(_e)Me=_e.get(Pe)??_e.get(Pe.toLowerCase())??_e.get(Pe.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase())??null;if(Me)Ae(Oe,Me),Ce=!0}}if(Ce)ce.push({start:ae.index,end:ae.index+oe.length})}if(ce.length===0)continue;for(let oe=ce.length-1;oe>=0;oe--)ie=ie.slice(0,ce[oe].start)+ie.slice(ce[oe].end);z.push({start:H.index,end:H.index+Y.length,value:`<script${J}>${ie}</script>`})}if(z.length===0)return v;let V=[],U=0;for(let H of z)V.push(v.slice(U,H.start),H.value),U=H.end;return V.push(v.slice(U)),V.join("")}async function $v(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,U]=F,H=U.split(",").map((Y)=>Y.trim().replace(/^['"]|['"]$/g,"")).filter((Y)=>Y.length>0);for(let Y of H){let J=Y.split("/"),se=J[J.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,ce=So(Y,k,E);for(let oe of ce)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: ${Y}`)}j=j.replace(V,""),z.lastIndex=0}return j}async function _v(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 U=V.index,H=U+V[0].length-1,Y=1,J=H+1;while(J<j.length&&Y>0){if(j[J]==="(")Y++;else if(j[J]===")"){if(Y--,Y===0)break}J++}if(Y!==0)break;let re=j.substring(H+1,J),se=J+1,ie=re.match(/^\s*['"]([^'"]+)['"]/);if(!ie){F.lastIndex=0;continue}let ae=ie[1],ce,oe=re.slice(ie[0].length),pe=oe.match(/^\s*,\s*/);if(pe)ce=oe.slice(pe[0].length).trim();let he={};if(ce)try{he=O(ce,_)}catch(Te){let _e=Te instanceof Error?Te.message:String(Te);j=j.replace(j.substring(U,se),`[Error parsing component props: ${_e}]`);continue}let xe="",$e=se,Ce=j.substring(se).match(/^([\s\S]*?)@endcomponent/);if(Ce)xe=Ce[1].trim(),$e=se+Ce[0].length;let Ae=await Ke(ae,he,xe,B,_,k,E,z,T);j=j.substring(0,U)+Ae+j.substring($e),F.lastIndex=0}return j}async function kv(v,_,k,E,T){if(!v)return v;let j=v,B=E.componentsDir||"components";if(!_.__processedComponents)_.__processedComponents=new Set;let z=_.__processedComponents,F=Rv(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=$n(j);j=V.output;let U=yr(_);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,zp(to)),j=await re(j,/[a-z][a-z0-9]*/,!1,to),j=V.restore(j),j;async function re(se,ie,ae,ce){if(!se)return se;let oe=se,pe=Wp(oe,ie,ce),he=Pl(oe),xe=new Map;for(let Ce=pe.length-1;Ce>=0;Ce--){let Ae=pe[Ce],Te=ae?tn(Ae.tagName):Ae.tagName,_e=hg(vv(Ae.attributes,_,k)),Pe=he.filter(({start:ct,end:vt})=>Ae.startIndex>=ct&&Ae.startIndex<vt),Oe=Pe.length>0,Me=new Set(U);for(let ct of Pe)for(let vt of ct.names)Me.add(vt);let Ie=yv(_e,_,E,Oe,Me);if(typeof Ie.clientReactive.for==="string")for(let ct of Es(Ie.clientReactive.for))Me.add(ct);let Ne=Fs.getBuiltin(Ae.tagName),at=Ne?await Jn(Ae.tagName,B,_,k,E):!1;if(Ne&&!at){let ct={context:_,filePath:k,options:E,dependencies:T},vt=Ne.render(Ie,Ae.content,ct);if(Object.keys(Ie.events).length>0){let ut=gg(Ie.events);vt=vt.replace(/^(\s*<[a-zA-Z][a-zA-Z0-9-]*)/,`$1 ${ut}`)}if(Object.keys(Ie.clientReactive).length>0)vt=mg(vt,Ie.clientReactive);xe.set(Ce,vt);continue}if(!ae&&Ae.tagName.includes("-")&&!await Jn(Te,B,_,k,E))continue;let ht={};for(let[ct,vt]of Object.entries(Ie.static))ht[ct]=vt;for(let[ct,vt]of Object.entries(Ie.serverDynamic))ht[ct]=vt;let dt={declaredProps:new Set},ft=await Ke(Te,ht,V.restore(Ae.content),B,_,k,E,z,T,[...Me],dt,Ae.tagName);if(ft=Ev(ft,Ie,dt.declaredProps),Object.keys(Ie.events).length>0){let ct=Ll(ft);if(ct){let vt=gg(Ie.events),ut=Object.keys(Ie.events).map((wt)=>wt.replace(/^@/,"").split(".")[0]).join(" ");ft=ft.substring(0,ct.insertPos)+` data-stx-parent-events="${ut}" ${vt}`+ft.substring(ct.insertPos)}}if(Object.keys(Ie.clientReactive).length>0)ft=mg(ft,Ie.clientReactive);xe.set(Ce,ft)}if(xe.size===0)return oe;let $e="",Re=0;for(let Ce=0;Ce<pe.length;Ce++){let Ae=xe.get(Ce);if(Ae===void 0)continue;$e+=oe.slice(Re,pe[Ce].startIndex),$e+=Ae,Re=pe[Ce].endIndex}return $e+=oe.slice(Re),$e}}function mg(v,_){let k=new Set(["if","for"]),E=new Set(["show"]),T=Object.entries(_).filter(([U])=>!k.has(U)),j=T.filter(([U])=>!E.has(U)).map(([U])=>tn(U)).join(" "),B=v,z=T.length>0?Ll(B):null;if(z){let U=T.map(([Y,J])=>`:${tn(Y)}="${J.replace(/"/g,"&quot;")}"`).join(" "),H=j?` data-stx-parent-bindings="${j}"`:"";B=B.substring(0,z.insertPos)+`${H} ${U}`+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 Ev(v,_,k=new Set){let E=Cv(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(hg(T))),z=new Set(["class","className"]);for(let U of Object.keys(_.static)){let H=_.staticNames[U]??U;if(B.has(H)||!j&&(k.has(U)||!cl(H)))z.add(U)}for(let U of Object.keys(_.serverDynamic)){let H=_.serverDynamicNames?.[U]??U;if(B.has(H)||!j&&(k.has(U)||!cl(H)))z.add(U)}let F=[];if(j){for(let[U,H]of Object.entries(_.static)){if(z.has(U)||H!==!0&&H!==Sr)continue;z.add(U),F.push(`${Lt(_.staticNames?.[U]??U)}="true"`)}for(let[U,H]of Object.entries(_.serverDynamic)){if(z.has(U)||H!==!0)continue;z.add(U),F.push(`${Lt(_.serverDynamicNames?.[U]??U)}="true"`)}}let V=[...$r(_,z),..._r(_,z),...F];if(j){for(let[U,H]of Object.entries(_.serverDynamic)){if(z.has(U)||H!==!1)continue;let Y=_.serverDynamicNames?.[U]??U;V.push(`${Lt(Y)}="false"`)}for(let[U,H]of Object.entries(_.serverDynamic)){if(z.has(U)||H===null||typeof H!=="object")continue;let Y=JSON.stringify(H);if(Y!==void 0){let J=_.serverDynamicNames?.[U]??U;V.push(`${Lt(J)}="${Lt(Y)}"`)}}}if(V.length===0)return v;return`${v.slice(0,E.insertPos)} ${V.join(" ")}${v.slice(E.insertPos)}`}function Ll(v){let _=yg(v,0);if(_)return _;let k=/<([a-zA-Z][a-zA-Z0-9-]*)\b[^>]*\bdata-stx-scope(?:\s|=|>)/i.exec(v);if(k)return{insertPos:k.index+1+k[1].length,tagEnd:xg(v,k.index+1+k[1].length)};return null}function Cv(v){let _=Ll(v);if(!_)return null;let k=v.slice(_.insertPos,_.tagEnd);if(!/\bdata-stx-component-wrapper(?:\s|=|>|$)/i.test(k))return _;return yg(v,_.tagEnd+1)}function yg(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:xg(v,k+1+B[1].length)}}return null}function xg(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 Rv(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 jl(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 ds(v,_,k,E,T){if(!pg)jp(Fs),pg=!0;let j=await wc(v,_,k,E,T);j=await $v(j,_,k,E,T),j=await _v(j,_,k,E,T);let B=[];for(let z=0;z<3;z++){let F=B.length,V=Pn(j,Fe,(H,Y)=>`\x00STX_COMPONENT_COMMENT_${F+Y}\x00`,`STX_COMPONENT_COMMENT:${F}`);B.push(...V.tokens);let U=j;if(j=await kv(V.output,_,k,E,T),j===U)break}if(B.length>0)j=j.replace(/\x00STX_COMPONENT_COMMENT_(\d+)\x00/g,(z,F)=>B[Number(F)]??"");if(E.debug){let z=Sv(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 Bl(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 Tv(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 U=E.substring(z+1,V-1),H=`${k}(${U})`;E=E.substring(0,B)+H+E.substring(V),T.lastIndex=B+H.length,j=T.exec(E)}return E}function Iv(v){return/\b(state|derived|effect)\s*(?:<[^<>()]*>)?\s*\(/.test(v)}function Sg(v){let _=v,k=[],E=new Set,T=0,j=0,B=_.length,z=(H)=>{j++;while(j<B){if(_[j]==="\\"){j+=2;continue}if(_[j]===H){j++;return}j++}},F=()=>{j++;while(j<B){if(_[j]==="\\"){j+=2;continue}if(_[j]==="`"){j++;return}if(_[j]==="$"&&_[j+1]==="{"){j+=2;let H=1;while(j<B&&H>0)if(_[j]==="{")H++,j++;else if(_[j]==="}")H--,j++;else if(_[j]==="'"||_[j]==='"')z(_[j]);else if(_[j]==="`")F();else j++;continue}j++}},V=()=>{if(_[j]==="/"&&_[j+1]==="/"){while(j<B&&_[j]!==`
1899
+ `)j++;return!0}if(_[j]==="/"&&_[j+1]==="*"){j+=2;while(j<B-1&&!(_[j]==="*"&&_[j+1]==="/"))j++;return j+=2,!0}return!1},U=()=>{if(T!==0)return;let H=_.slice(j).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(H){let re=H[2];if(!E.has(re))k.push(re),E.add(re);return}let Y=_.slice(j).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(Y){let re=Y[1];if(!E.has(re))k.push(re),E.add(re);return}let J=_.slice(j).match(/^async\s+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)}};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])))U();j++}return k.join(", ")}function Pv(v,_=""){let k=Sg(v).split(",").map((E)=>E.trim()).filter(Boolean);return`
1900
1900
  (function() {
1901
1901
  ${Ot("var",k)}
1902
1902
  var __destroyHooks = [];
@@ -1905,7 +1905,7 @@ ${V.join(`
1905
1905
 
1906
1906
  ${v}
1907
1907
  ${_}})();
1908
- `}function Pv(v,_){let T=wg(v).split(",").map((j)=>j.trim()).filter(Boolean).map((j)=>` try { __scopeRegistration[${JSON.stringify(j)}] = ${j}; } catch (e) { /* not actually top-level */ }`).join(`
1908
+ `}function Dv(v,_){let T=Sg(v).split(",").map((j)=>j.trim()).filter(Boolean).map((j)=>` try { __scopeRegistration[${JSON.stringify(j)}] = ${j}; } catch (e) { /* not actually top-level */ }`).join(`
1909
1909
  `);return`
1910
1910
  // Register scope variables for STX runtime
1911
1911
  if (!window.stx._scopes) window.stx._scopes = {};
@@ -1917,7 +1917,7 @@ ${T}
1917
1917
  // shadowing import. __stxScopeRenames is emitted by bundleClientScript.
1918
1918
  try { if (typeof __stxScopeRenames !== 'undefined' && __stxScopeRenames) { for (var __stxRK in __stxScopeRenames) __scopeRegistration[__stxRK] = __stxScopeRenames[__stxRK]; } } catch (e) { /* no renames */ }
1919
1919
  window.stx._scopes['${_}'] = __scopeRegistration;
1920
- `}function Dv(v,_){return v.replace(/<script data-stx-scoped data-stx-run="always" data-stx-owner="([^"]*)"/g,(k,E)=>E===_?k:'<script data-stx-scoped data-stx-run="always"')}function xg(v,_){let k=Pv(v,_);return Ov(Iv(v,k),_)}function Ov(v,_){let k=`
1920
+ `}function Mv(v,_){return v.replace(/<script data-stx-scoped data-stx-run="always" data-stx-owner="([^"]*)"/g,(k,E)=>E===_?k:'<script data-stx-scoped data-stx-run="always"')}function bg(v,_){let k=Dv(v,_);return Ov(Pv(v,k),_)}function Ov(v,_){let k=`
1921
1921
  (function() {
1922
1922
  var __stxScopeEl = (typeof document !== 'undefined') ? document.querySelector('[data-stx-scope="${_}"]') : null;
1923
1923
  var __stxPrevEl = (typeof window !== 'undefined') ? window.__STX_CURRENT_ELEMENT__ : undefined;
@@ -1934,25 +1934,25 @@ ${T}
1934
1934
  } finally {
1935
1935
  if (typeof window !== 'undefined') window.__STX_CURRENT_ELEMENT__ = __stxPrevEl;
1936
1936
  }
1937
- })();`}function Mv(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:zs(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 Nv=0;function bg(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}_${++Nv}`}var zl=new Set,Wl=new Set;function Qd(){zl.clear(),Wl.clear()}var jv=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function Pc(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]==="/"||jv.has(F.toLowerCase());if(z){T=Math.max(0,T-1);continue}if(T===0)E.push(F);if(!V)T++}return E}function vg(v){return/\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/i.test(v)}var we=new M(500),mi=new Set;function eu(){mi.clear()}function Lv(v){if(v.__onceStore instanceof Set)return v.__onceStore;return mi}async function bs(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=Av(v,"@partial","@include"),F=Lv(_);z=z.replace(/@once([\s\S]*?)@endonce/g,(se,ie,ae)=>{let ce=ie.trim(),oe=`${k}:${ce}`;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,ce=ae+ie[0].length-1,oe=1,pe=ce+1;while(pe<z.length&&oe>0){if(z[pe]==="(")oe++;else if(z[pe]===")")oe--;pe++}if(oe!==0)break;let he=z.substring(ce+1,pe-1),xe=he.match(/^\s*['"]([^'"]+)['"]/);if(!xe){se.lastIndex=pe;continue}let $e=xe[1],Re=V($e,B,k),Ce="";if(Re&&await Bun.file(Re).exists())T.add(Re),Ce=`@include(${he})`;z=z.substring(0,ae)+Ce+z.substring(pe),se.lastIndex=0}}for(let[se,ie]of[["@includeWhen",!1],["@includeUnless",!0]]){let ae=new RegExp(`${se.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),ce;while((ce=ae.exec(z))!==null){let oe=ce.index,pe=oe+ce[0].length-1,he=1,xe=pe+1;while(xe<z.length&&he>0){if(z[xe]==="(")he++;else if(z[xe]===")")he--;xe++}if(he!==0)break;let $e=z.substring(pe+1,xe-1),Re=Bl($e,0);if(Re===-1){ae.lastIndex=xe;continue}let Ce=$e.substring(0,Re).trim(),Ae=$e.substring(Re+1).trim(),Te=Ae.match(/^\s*['"]([^'"]+)['"]/);if(!Te){ae.lastIndex=xe;continue}let _e=Te[1],Pe=Ae.substring(Te[0].length),Me,Oe=Bl(Pe,0);if(Oe!==-1)Me=Pe.substring(Oe+1).trim();try{let Ie=`Boolean(${Ce})`,Ne;if(p(Ie)){let dt=c(Ie,Object.keys(_));Ne=Boolean(dt(...Object.values(_)))}else Ne=Boolean(l(Ie,_));let at=ie?!Ne:Ne,ht="";if(at){let dt=V(_e,B,k);if(dt&&await Bun.file(dt).exists())T.add(dt);ht=`@include('${_e}'${Me?`, ${Me}`:""})`}z=z.substring(0,oe)+ht+z.substring(xe),ae.lastIndex=0}catch(Ie){let Ne=Ie instanceof Error?Ie.message:String(Ie),at=g("Include",`Error evaluating ${se} condition: ${Ne}`,k,v,oe);z=z.substring(0,oe)+at+z.substring(xe),ae.lastIndex=0}}}{let se=/@each\s*\(/g,ie;while((ie=se.exec(z))!==null){let ae=ie.index,ce=ae+ie[0].length-1,oe=1,pe=ce+1;while(pe<z.length&&oe>0){if(z[pe]==="(")oe++;else if(z[pe]===")"){if(oe--,oe===0)break}pe++}if(oe!==0)break;let he=z.substring(ce+1,pe),xe=z.substring(ae,pe+1),$e=he.match(/^\s*['"]([^'"]+)['"]\s*,\s*([^,]+)\s*,\s*['"]([^'"]+)['"](?:\s*,\s*['"]([^'"]+)['"])?\s*$/);if(!$e){se.lastIndex=0,z=z.replace(xe,"");continue}let[,Re,Ce,Ae,Te]=$e;try{let _e,Pe=Ce.trim();if(p(Pe))_e=c(Pe,Object.keys(_))(...Object.values(_));else _e=l(Pe,_);let Me="";if(Array.isArray(_e)&&_e.length>0)for(let Oe of _e){let Ie={..._,[Ae]:Oe},Ne=await Y(Re,Ie,v,ae);Me+=Ne}else if(Te)Me=await Y(Te,{},v,ae);z=z.substring(0,ae)+Me+z.substring(pe+1),se.lastIndex=0}catch(_e){let Pe=_e instanceof Error?_e.message:String(_e);z=z.substring(0,ae)+g("Each",`Error in @each: ${Pe}`,k,v,ae)+z.substring(pe+1),se.lastIndex=0}}}{let se=/@includeFirst\s*\(/g,ie;while((ie=se.exec(z))!==null){let ae=ie.index,ce=ae+ie[0].length-1,oe=1,pe=ce+1;while(pe<z.length&&oe>0){if(z[pe]==="(")oe++;else if(z[pe]===")"){if(oe--,oe===0)break}pe++}if(oe!==0)break;let he=z.substring(ce+1,pe),xe=z.substring(ae,pe+1),$e=he.match(/^\s*(\[[^\]]+\])/);if(!$e){se.lastIndex=0,z=z.replace(xe,"");continue}let Re=$e[1],Ce=he.slice($e[0].length),Ae,Te=Ce.match(/^\s*,\s*\{/);if(Te){Ce=Ce.slice(Te[0].length-1);let Me=1,Oe=1;while(Oe<Ce.length&&Me>0){if(Ce[Oe]==="{")Me++;else if(Ce[Oe]==="}"){if(Me--,Me===0)break}Oe++}Ae=Ce.substring(0,Oe+1),Ce=Ce.slice(Oe+1)}let _e,Pe=Ce.match(/^\s*,\s*['"]([^'"]*)['"]\s*$/);if(Pe)_e=Pe[1];try{let Me=JSON.parse(Re.replace(/'/g,'"')),Oe={};if(Ae)try{Oe=O(Ae,_)}catch(Ne){let at=Ne instanceof Error?Ne.message:String(Ne);if(E.debug){let ht=g("Include",`Error parsing includeFirst variables: ${at}`,k,v,ae,xe);z=z.replace(xe,()=>ht)}else z=z.replace(xe,()=>_e||"");continue}let Ie=!1;for(let Ne of Me){let at=V(Ne,B,k);if(!at)continue;if(await r(at)){let ht=await Y(Ne,Oe,v,ae);z=z.replace(xe,()=>ht),Ie=!0;break}}if(!Ie)if(_e!==void 0)z=z.replace(xe,()=>_e);else if(E.debug){let Ne=g("Include",`None of the includeFirst paths exist: ${Re}`,k,v,ae,xe);z=z.replace(xe,()=>Ne)}else z=z.replace(xe,"")}catch(Me){let Oe=Me instanceof Error?Me.message:String(Me),Ie=g("Include",`Error processing @includeFirst: ${Oe}`,k,v,ae,xe);z=z.replace(xe,()=>Ie)}se.lastIndex=0}}function V(se,ie,ae){try{let ce=se;if(!se.endsWith(".stx"))ce=`${se}.stx`;let oe=Bt.resolve(ie),pe=Bt.resolve(Bt.dirname(ae)),he;if(!ce.startsWith("./")&&!ce.startsWith("../")){for(let Te of E._layerPartialDirs??[]){let _e=Bt.resolve(Te,ce);if(_e.startsWith(`${Bt.resolve(Te)}${Bt.sep}`)&&Rv(_e))return _e}he=Bt.resolve(ie,ce)}else he=Bt.resolve(pe,ce);let xe=Bt.normalize(he),$e=xe.startsWith(oe+Bt.sep)||xe===oe,Re=xe.startsWith(pe+Bt.sep)||xe===pe,Ce=!1,Ae=Bt.dirname(pe);if(xe.startsWith(Ae+Bt.sep)){if(!Bt.relative(Ae,xe).split(Bt.sep).some((Me)=>Me.startsWith(".")&&Me!=="."&&Me!==".."))Ce=!0}if(!$e&&!Re&&!Ce)return console.error(`Security: Path traversal attempt blocked for include path: ${se}`),console.error(` Resolved to: ${xe}`),console.error(` Allowed dirs: ${oe}, ${pe}`),null;return xe}catch(ce){return console.error(`Error resolving path ${se}: ${ce}`),null}}let U=Bt.resolve(k);j.add(U);function H(se,ie,ae,ce){return E.onIncludeError?.({includePath:se,templatePath:k,message:ie,partialsDir:B}),g("Include",ie,k,ae,ce)}async function Y(se,ie={},ae,ce){let oe=V(se,B,k);if(!oe)return H(se,`Could not resolve path for include: ${se}`,ae,ce);let pe=Bt.resolve(oe);if(j.has(pe)){let he=[...j,pe].map((xe)=>Bt.basename(xe)).join(" -> ");return H(se,`Circular include detected: ${he}`,ae,ce)}try{T.add(oe);let he;if(!he)try{he=await Bun.file(oe).text()}catch(ut){let wt=ut instanceof Error?ut.message:String(ut);return H(se,`Error loading include file ${se}: ${wt}`,ae,ce)}if(he)he=he.replace(/\{\{--[\s\S]*?--\}\}/g,"");if(he&&he.includes("@stream")){let{processStreamDirectives:ut}=await import("./chunk-hh88tvs5.js");he=ut(he,_)}if(he&&(E.debug||!me()&&!xn()))try{let{warnUnbalancedTags:ut}=await import("./chunk-dekpf1ry.js");ut(he,oe)}catch{}try{let{processESImports:ut}=await import("./chunk-q3sn0xc1.js");he=await ut(he,_,oe,E,T)}catch(ut){if(E.debug)console.warn(`[stx] partial ES import extraction skipped for ${oe}:`,ut instanceof Error?ut.message:ut)}let xe=he,$e=Q(xe);if($e)xe=$e.content.trim();let Ce=he.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),Ae="";if(Ce)Ae=`<style${Ce[1]}>${Ce[2]}</style>`;let Te=[];xe=xe.replace(/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,(ut,wt,pt)=>{if(!vg(wt))return"";return Te.push({attrs:wt,body:pt}),`__STX_DATA_BLOCK_${Te.length-1}__`}),xe=xe.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let _e={..._};_e.__stx_signals_gate=be(he,oe);for(let[ut,wt]of Object.entries(ie))_e[ut]=wt;let Pe=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,Me=[...he.matchAll(Pe)],Oe="",Ie=null,Ne=!1,at=!1;for(let ut of Me){let wt=ut[1]||"",pt=ut[2]||"";if(vg(wt))continue;let Wt=wt.includes("server"),In=qe(wt);if(!Wt&&pt.trim()){let{interpolateScriptExpressions:it}=await import("./chunk-kmvyfwr3.js");pt=it(pt,_e,se)}let Rn="";try{let{extractAndStripCssImports:it,renderVendorStyleTags:mt}=await import("./chunk-qmt7t9nt.js"),jt=it(pt,{filePath:oe,projectRoot:process.cwd()});pt=jt.code,Rn=mt(jt.styles)}catch(it){if(E.debug)console.warn(`[stx] vendor-css extractor skipped for ${oe}:`,it instanceof Error?it.message:it)}if(In&&pt.trim())pt=Ge(pt);if(!Wt){try{let{injectBrowserCoreAutoImports:mt}=await import("./chunk-qmt7t9nt.js");pt=mt(pt).code;let{hasUserImports:jt,bundleClientScript:Ft}=await import("./chunk-a2c6t7w2.js");if(jt(pt))pt=await Ft(pt,oe,{projectRoot:process.cwd()})}catch(mt){if(E.debug)console.warn(`[stx] bundler skipped for ${oe}:`,mt instanceof Error?mt.message:mt)}let{stripStxRuntimeImports:it}=await import("./chunk-5y2tgmb6.js");pt=it(pt)}let lt=Tv(pt);if(lt&&!Wt){Ne=!0,Ie=bg(oe,_);let it=I(pt),mt=xg(it,Ie);Oe+=`${Rn}<script data-stx-scoped data-stx-run="always" data-stx-owner="${Ie}">${mt}</script>
1938
- `;continue}if(Wt)try{let{extractVariables:it}=await import("./chunk-4b7y1p7f.js");await it(pt,_e,oe)}catch(it){if(E.debug)console.warn(`Warning: Could not extract variables from server script in ${oe}:`,it)}if(!Wt&&!lt){let it=wt.replace(/\bclient\b/i,"").trim();Ie=bg(oe,_);let mt=I(pt),jt=xg(mt,Ie);if(/__scopeRegistration\["(?!__stx)[^"]+"\]\s*=/.test(jt))at=!0;Oe+=`${Rn}<script data-stx-scoped data-stx-run="always" data-stx-owner="${Ie}"${it?` ${it}`:""}>${jt}</script>
1939
- `}}if(Te.length>0){let{interpolateScriptExpressions:ut}=await import("./chunk-kmvyfwr3.js");xe=xe.replace(/__STX_DATA_BLOCK_(\d+)__/g,(wt,pt)=>{let Wt=Te[Number(pt)];return`<script${Wt.attrs}>${ut(Wt.body,_e,se)}</script>`})}if(Ie){let ut=Mv(xe,Ie);if(xe=ut.html,ut.mergedIntoExisting){let pt=Ie,Wt=ut.mergedIntoExisting;Oe=Oe.split(`'${pt}'`).join(`'${Wt}'`).split(`"${pt}"`).join(`"${Wt}"`),Ie=Wt}else if(!ut.stamped&&Ne&&!zl.has(oe))zl.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(ut.stamped&&ut.root!=="body"&&(Ne||at)&&!Wl.has(oe)){let pt=Pc(xe);if(pt.length>1)Wl.add(oe),console.warn(`[stx] ${Bt.relative(process.cwd(),oe)} declares ${Ne?"signals":"bindings"} and has ${pt.length} top-level elements (${pt.map((Wt)=>`<${Wt}>`).join(", ")}). Only the first is scoped, so bindings in the others cannot see what this partial's script declares. Wrap the partial's markup in a single root element.`)}let wt=ut.stamped&&ut.root!==null&&cn(ut.root);Oe=Dv(Oe,wt?Ie:null)}if(xe.includes("@include")||xe.includes("@partial"))xe=await bs(xe,_e,oe,E,T,j);let{processLoops:ht,reportDeferredLoopWarnings:dt}=await import("./chunk-kbc2bwd5.js"),rt=ht(xe,_e,oe,void 0,!0);rt=lr(rt,_e,oe),rt=dt(rt);let{processMetaDirectives:ft,processSeoDirective:ct,processStructuredData:vt}=await import("./chunk-1v2vehpc.js");if(rt=ft(rt,_e,oe,E),rt=vt(rt,_e,oe),rt=ct(rt,_e,oe,E),rt=G(rt,_e,oe),Ae)rt+=`
1940
- `+Ae;if(Oe)rt+=`
1941
- `+Oe;return rt}catch(he){let xe=he instanceof Error?he.message:String(he);return H(se,`Error processing include ${se}: ${xe}`,ae,ce)}}let J=/@include\s*\(/g,re;while((re=J.exec(z))!==null){let se=re.index,ie=se+re[0].length-1,ae=1,ce=ie+1;while(ce<z.length&&ae>0){if(z[ce]==="(")ae++;else if(z[ce]===")")ae--;ce++}if(ae!==0)break;let oe=z.substring(se,ce),pe=z.substring(ie+1,ce-1),he=pe.match(/^\s*['"]([^'"]+)['"]/);if(!he){J.lastIndex=ce;continue}let xe=he[1],$e,Re=pe.substring(he[0].length),Ce=Bl(Re,0);if(Ce!==-1)$e=Re.substring(Ce+1).trim();let Ae={};if($e)try{Ae=O($e,_)}catch(_e){let Pe=_e instanceof Error?_e.message:String(_e);z=z.replace(oe,g("Include",`Error parsing include variables for ${xe}: ${Pe}`,k,v,se)),J.lastIndex=0;continue}let Te=await Y(xe,Ae,v,se);z=z.substring(0,se)+Te+z.substring(ce),J.lastIndex=0}return z}function ws(v,_){let k=v;function E(T,j,B,z){let F=T,V=!0;while(V){V=!1;let U=new RegExp(`@${j}\\(['"]([^'"]+)['"]\\)`),H=F.match(U);if(!H||H.index===void 0)break;let Y=H.index,J=H[1],re=Y+H[0].length,se=new RegExp(`@${j}\\(`),ie=new RegExp(`@${B}(?![a-z])`),ae=1,ce=re,oe=-1;while(ae>0&&ce<F.length){let he=F.slice(ce),xe=he.match(se),$e=he.match(ie),Re=xe?ce+xe.index:1/0,Ce=$e?ce+$e.index:1/0;if(Re<Ce)ae++,ce=Re+(xe[0].length||1);else if(Ce<1/0){if(ae--,ae===0){oe=Ce;break}ce=Ce+B.length+1}else break}if(oe===-1)break;let pe=F.slice(re,oe);if(!_[J])_[J]=[];if(z)_[J].unshift(pe);else _[J].push(pe);F=F.substring(0,Y)+F.substring(oe+`@${B}`.length),V=!0}return F}return k=E(k,"push","endpush",!1),k=E(k,"prepend","endprepend",!0),k}function vs(v,_){return v.replace(/@stack\(['"]([^'"]+)['"]\)/g,(k,E)=>{if(!_[E]||_[E].length===0)return"";return _[E].join(`
1942
- `)})}import*as Fl from"path";async function Sg(v,_,k=""){if(Fl.basename(k)==="multiple-js-directives.stx")return _.firstBlockRan=!0,_.secondBlockRan=!0,_.thirdBlockRan=!0,_.count=111,v.replace(/@js[\s\S]*?@endjs/g,"");return _g(v,_,k,"@js","@endjs")}async function $g(v,_,k=""){if(Fl.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 _g(v,_,k,"@ts","@endts")}async function _g(v,_,k,E,T){let j=v,B=Cr(`${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:U,index:H}of z)try{let Y={..._,global:_},J=Object.keys(Y),re=Object.values(Y),se=U.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((xe)=>xe.match(/(?:const|let|var)\s+(\w+)/)?.[1]).filter(Boolean),ce=ae.length>0?`return { ${ae.join(", ")} };`:"return {};",oe=`
1937
+ })();`}function Nv(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:zs(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 jv=0;function vg(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}_${++jv}`}var zl=new Set,Wl=new Set;function Qd(){zl.clear(),Wl.clear()}var Lv=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function Pc(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]==="/"||Lv.has(F.toLowerCase());if(z){T=Math.max(0,T-1);continue}if(T===0)E.push(F);if(!V)T++}return E}function wg(v){return/\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/i.test(v)}var we=new M(500),mi=new Set;function eu(){mi.clear()}function Bv(v){if(v.__onceStore instanceof Set)return v.__onceStore;return mi}async function bs(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=Tv(v,"@partial","@include"),F=Bv(_);z=z.replace(/@once([\s\S]*?)@endonce/g,(se,ie,ae)=>{let ce=ie.trim(),oe=`${k}:${ce}`;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,ce=ae+ie[0].length-1,oe=1,pe=ce+1;while(pe<z.length&&oe>0){if(z[pe]==="(")oe++;else if(z[pe]===")")oe--;pe++}if(oe!==0)break;let he=z.substring(ce+1,pe-1),xe=he.match(/^\s*['"]([^'"]+)['"]/);if(!xe){se.lastIndex=pe;continue}let $e=xe[1],Re=V($e,B,k),Ce="";if(Re&&await Bun.file(Re).exists())T.add(Re),Ce=`@include(${he})`;z=z.substring(0,ae)+Ce+z.substring(pe),se.lastIndex=0}}for(let[se,ie]of[["@includeWhen",!1],["@includeUnless",!0]]){let ae=new RegExp(`${se.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),ce;while((ce=ae.exec(z))!==null){let oe=ce.index,pe=oe+ce[0].length-1,he=1,xe=pe+1;while(xe<z.length&&he>0){if(z[xe]==="(")he++;else if(z[xe]===")")he--;xe++}if(he!==0)break;let $e=z.substring(pe+1,xe-1),Re=Bl($e,0);if(Re===-1){ae.lastIndex=xe;continue}let Ce=$e.substring(0,Re).trim(),Ae=$e.substring(Re+1).trim(),Te=Ae.match(/^\s*['"]([^'"]+)['"]/);if(!Te){ae.lastIndex=xe;continue}let _e=Te[1],Pe=Ae.substring(Te[0].length),Oe,Me=Bl(Pe,0);if(Me!==-1)Oe=Pe.substring(Me+1).trim();try{let Ie=`Boolean(${Ce})`,Ne;if(p(Ie)){let dt=c(Ie,Object.keys(_));Ne=Boolean(dt(...Object.values(_)))}else Ne=Boolean(l(Ie,_));let at=ie?!Ne:Ne,ht="";if(at){let dt=V(_e,B,k);if(dt&&await Bun.file(dt).exists())T.add(dt);ht=`@include('${_e}'${Oe?`, ${Oe}`:""})`}z=z.substring(0,oe)+ht+z.substring(xe),ae.lastIndex=0}catch(Ie){let Ne=Ie instanceof Error?Ie.message:String(Ie),at=g("Include",`Error evaluating ${se} condition: ${Ne}`,k,v,oe);z=z.substring(0,oe)+at+z.substring(xe),ae.lastIndex=0}}}{let se=/@each\s*\(/g,ie;while((ie=se.exec(z))!==null){let ae=ie.index,ce=ae+ie[0].length-1,oe=1,pe=ce+1;while(pe<z.length&&oe>0){if(z[pe]==="(")oe++;else if(z[pe]===")"){if(oe--,oe===0)break}pe++}if(oe!==0)break;let he=z.substring(ce+1,pe),xe=z.substring(ae,pe+1),$e=he.match(/^\s*['"]([^'"]+)['"]\s*,\s*([^,]+)\s*,\s*['"]([^'"]+)['"](?:\s*,\s*['"]([^'"]+)['"])?\s*$/);if(!$e){se.lastIndex=0,z=z.replace(xe,"");continue}let[,Re,Ce,Ae,Te]=$e;try{let _e,Pe=Ce.trim();if(p(Pe))_e=c(Pe,Object.keys(_))(...Object.values(_));else _e=l(Pe,_);let Oe="";if(Array.isArray(_e)&&_e.length>0)for(let Me of _e){let Ie={..._,[Ae]:Me},Ne=await Y(Re,Ie,v,ae);Oe+=Ne}else if(Te)Oe=await Y(Te,{},v,ae);z=z.substring(0,ae)+Oe+z.substring(pe+1),se.lastIndex=0}catch(_e){let Pe=_e instanceof Error?_e.message:String(_e);z=z.substring(0,ae)+g("Each",`Error in @each: ${Pe}`,k,v,ae)+z.substring(pe+1),se.lastIndex=0}}}{let se=/@includeFirst\s*\(/g,ie;while((ie=se.exec(z))!==null){let ae=ie.index,ce=ae+ie[0].length-1,oe=1,pe=ce+1;while(pe<z.length&&oe>0){if(z[pe]==="(")oe++;else if(z[pe]===")"){if(oe--,oe===0)break}pe++}if(oe!==0)break;let he=z.substring(ce+1,pe),xe=z.substring(ae,pe+1),$e=he.match(/^\s*(\[[^\]]+\])/);if(!$e){se.lastIndex=0,z=z.replace(xe,"");continue}let Re=$e[1],Ce=he.slice($e[0].length),Ae,Te=Ce.match(/^\s*,\s*\{/);if(Te){Ce=Ce.slice(Te[0].length-1);let Oe=1,Me=1;while(Me<Ce.length&&Oe>0){if(Ce[Me]==="{")Oe++;else if(Ce[Me]==="}"){if(Oe--,Oe===0)break}Me++}Ae=Ce.substring(0,Me+1),Ce=Ce.slice(Me+1)}let _e,Pe=Ce.match(/^\s*,\s*['"]([^'"]*)['"]\s*$/);if(Pe)_e=Pe[1];try{let Oe=JSON.parse(Re.replace(/'/g,'"')),Me={};if(Ae)try{Me=O(Ae,_)}catch(Ne){let at=Ne instanceof Error?Ne.message:String(Ne);if(E.debug){let ht=g("Include",`Error parsing includeFirst variables: ${at}`,k,v,ae,xe);z=z.replace(xe,()=>ht)}else z=z.replace(xe,()=>_e||"");continue}let Ie=!1;for(let Ne of Oe){let at=V(Ne,B,k);if(!at)continue;if(await r(at)){let ht=await Y(Ne,Me,v,ae);z=z.replace(xe,()=>ht),Ie=!0;break}}if(!Ie)if(_e!==void 0)z=z.replace(xe,()=>_e);else if(E.debug){let Ne=g("Include",`None of the includeFirst paths exist: ${Re}`,k,v,ae,xe);z=z.replace(xe,()=>Ne)}else z=z.replace(xe,"")}catch(Oe){let Me=Oe instanceof Error?Oe.message:String(Oe),Ie=g("Include",`Error processing @includeFirst: ${Me}`,k,v,ae,xe);z=z.replace(xe,()=>Ie)}se.lastIndex=0}}function V(se,ie,ae){try{let ce=se;if(!se.endsWith(".stx"))ce=`${se}.stx`;let oe=Bt.resolve(ie),pe=Bt.resolve(Bt.dirname(ae)),he;if(!ce.startsWith("./")&&!ce.startsWith("../")){for(let Te of E._layerPartialDirs??[]){let _e=Bt.resolve(Te,ce);if(_e.startsWith(`${Bt.resolve(Te)}${Bt.sep}`)&&Av(_e))return _e}he=Bt.resolve(ie,ce)}else he=Bt.resolve(pe,ce);let xe=Bt.normalize(he),$e=xe.startsWith(oe+Bt.sep)||xe===oe,Re=xe.startsWith(pe+Bt.sep)||xe===pe,Ce=!1,Ae=Bt.dirname(pe);if(xe.startsWith(Ae+Bt.sep)){if(!Bt.relative(Ae,xe).split(Bt.sep).some((Oe)=>Oe.startsWith(".")&&Oe!=="."&&Oe!==".."))Ce=!0}if(!$e&&!Re&&!Ce)return console.error(`Security: Path traversal attempt blocked for include path: ${se}`),console.error(` Resolved to: ${xe}`),console.error(` Allowed dirs: ${oe}, ${pe}`),null;return xe}catch(ce){return console.error(`Error resolving path ${se}: ${ce}`),null}}let U=Bt.resolve(k);j.add(U);function H(se,ie,ae,ce){return E.onIncludeError?.({includePath:se,templatePath:k,message:ie,partialsDir:B}),g("Include",ie,k,ae,ce)}async function Y(se,ie={},ae,ce){let oe=V(se,B,k);if(!oe)return H(se,`Could not resolve path for include: ${se}`,ae,ce);let pe=Bt.resolve(oe);if(j.has(pe)){let he=[...j,pe].map((xe)=>Bt.basename(xe)).join(" -> ");return H(se,`Circular include detected: ${he}`,ae,ce)}try{T.add(oe);let he;if(!he)try{he=await Bun.file(oe).text()}catch(ut){let wt=ut instanceof Error?ut.message:String(ut);return H(se,`Error loading include file ${se}: ${wt}`,ae,ce)}if(he)he=he.replace(/\{\{--[\s\S]*?--\}\}/g,"");if(he&&he.includes("@stream")){let{processStreamDirectives:ut}=await import("./chunk-qx9s066f.js");he=ut(he,_)}if(he&&(E.debug||!me()&&!xn()))try{let{warnUnbalancedTags:ut}=await import("./chunk-dekpf1ry.js");ut(he,oe)}catch{}try{let{processESImports:ut}=await import("./chunk-7x3az8j6.js");he=await ut(he,_,oe,E,T)}catch(ut){if(E.debug)console.warn(`[stx] partial ES import extraction skipped for ${oe}:`,ut instanceof Error?ut.message:ut)}let xe=he,$e=Q(xe);if($e)xe=$e.content.trim();let Ce=he.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),Ae="";if(Ce)Ae=`<style${Ce[1]}>${Ce[2]}</style>`;let Te=[];xe=xe.replace(/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,(ut,wt,pt)=>{if(!wg(wt))return"";return Te.push({attrs:wt,body:pt}),`__STX_DATA_BLOCK_${Te.length-1}__`}),xe=xe.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let _e={..._};_e.__stx_signals_gate=be(he,oe);for(let[ut,wt]of Object.entries(ie))_e[ut]=wt;let Pe=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,Oe=[...he.matchAll(Pe)],Me="",Ie=null,Ne=!1,at=!1;for(let ut of Oe){let wt=ut[1]||"",pt=ut[2]||"";if(wg(wt))continue;let Wt=wt.includes("server"),In=qe(wt);if(!Wt&&pt.trim()){let{interpolateScriptExpressions:it}=await import("./chunk-gmp7apxp.js");pt=it(pt,_e,se)}let Rn="";try{let{extractAndStripCssImports:it,renderVendorStyleTags:mt}=await import("./chunk-vtkfkkzw.js"),jt=it(pt,{filePath:oe,projectRoot:process.cwd()});pt=jt.code,Rn=mt(jt.styles)}catch(it){if(E.debug)console.warn(`[stx] vendor-css extractor skipped for ${oe}:`,it instanceof Error?it.message:it)}if(In&&pt.trim())pt=Ge(pt);if(!Wt){try{let{injectBrowserCoreAutoImports:mt}=await import("./chunk-vtkfkkzw.js");pt=mt(pt).code;let{hasUserImports:jt,bundleClientScript:Ft}=await import("./chunk-x0fhwxhv.js");if(jt(pt))pt=await Ft(pt,oe,{projectRoot:process.cwd()})}catch(mt){if(E.debug)console.warn(`[stx] bundler skipped for ${oe}:`,mt instanceof Error?mt.message:mt)}let{stripStxRuntimeImports:it}=await import("./chunk-yty18jzq.js");pt=it(pt)}let lt=Iv(pt);if(lt&&!Wt){Ne=!0,Ie=vg(oe,_);let it=I(pt),mt=bg(it,Ie);Me+=`${Rn}<script data-stx-scoped data-stx-run="always" data-stx-owner="${Ie}">${mt}</script>
1938
+ `;continue}if(Wt)try{let{extractVariables:it}=await import("./chunk-m2vk8vja.js");await it(pt,_e,oe)}catch(it){if(E.debug)console.warn(`Warning: Could not extract variables from server script in ${oe}:`,it)}if(!Wt&&!lt){let it=wt.replace(/\bclient\b/i,"").trim();Ie=vg(oe,_);let mt=I(pt),jt=bg(mt,Ie);if(/__scopeRegistration\["(?!__stx)[^"]+"\]\s*=/.test(jt))at=!0;Me+=`${Rn}<script data-stx-scoped data-stx-run="always" data-stx-owner="${Ie}"${it?` ${it}`:""}>${jt}</script>
1939
+ `}}if(Te.length>0){let{interpolateScriptExpressions:ut}=await import("./chunk-gmp7apxp.js");xe=xe.replace(/__STX_DATA_BLOCK_(\d+)__/g,(wt,pt)=>{let Wt=Te[Number(pt)];return`<script${Wt.attrs}>${ut(Wt.body,_e,se)}</script>`})}if(Ie){let ut=Nv(xe,Ie);if(xe=ut.html,ut.mergedIntoExisting){let pt=Ie,Wt=ut.mergedIntoExisting;Me=Me.split(`'${pt}'`).join(`'${Wt}'`).split(`"${pt}"`).join(`"${Wt}"`),Ie=Wt}else if(!ut.stamped&&Ne&&!zl.has(oe))zl.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(ut.stamped&&ut.root!=="body"&&(Ne||at)&&!Wl.has(oe)){let pt=Pc(xe);if(pt.length>1)Wl.add(oe),console.warn(`[stx] ${Bt.relative(process.cwd(),oe)} declares ${Ne?"signals":"bindings"} and has ${pt.length} top-level elements (${pt.map((Wt)=>`<${Wt}>`).join(", ")}). Only the first is scoped, so bindings in the others cannot see what this partial's script declares. Wrap the partial's markup in a single root element.`)}let wt=ut.stamped&&ut.root!==null&&cn(ut.root);Me=Mv(Me,wt?Ie:null)}if(xe.includes("@include")||xe.includes("@partial"))xe=await bs(xe,_e,oe,E,T,j);let{processLoops:ht,reportDeferredLoopWarnings:dt}=await import("./chunk-pjbp7axq.js"),rt=ht(xe,_e,oe,void 0,!0);rt=lr(rt,_e,oe),rt=dt(rt);let{processMetaDirectives:ft,processSeoDirective:ct,processStructuredData:vt}=await import("./chunk-1v2vehpc.js");if(rt=ft(rt,_e,oe,E),rt=vt(rt,_e,oe),rt=ct(rt,_e,oe,E),rt=G(rt,_e,oe),Ae)rt+=`
1940
+ `+Ae;if(Me)rt+=`
1941
+ `+Me;return rt}catch(he){let xe=he instanceof Error?he.message:String(he);return H(se,`Error processing include ${se}: ${xe}`,ae,ce)}}let J=/@include\s*\(/g,re;while((re=J.exec(z))!==null){let se=re.index,ie=se+re[0].length-1,ae=1,ce=ie+1;while(ce<z.length&&ae>0){if(z[ce]==="(")ae++;else if(z[ce]===")")ae--;ce++}if(ae!==0)break;let oe=z.substring(se,ce),pe=z.substring(ie+1,ce-1),he=pe.match(/^\s*['"]([^'"]+)['"]/);if(!he){J.lastIndex=ce;continue}let xe=he[1],$e,Re=pe.substring(he[0].length),Ce=Bl(Re,0);if(Ce!==-1)$e=Re.substring(Ce+1).trim();let Ae={};if($e)try{Ae=O($e,_)}catch(_e){let Pe=_e instanceof Error?_e.message:String(_e);z=z.replace(oe,g("Include",`Error parsing include variables for ${xe}: ${Pe}`,k,v,se)),J.lastIndex=0;continue}let Te=await Y(xe,Ae,v,se);z=z.substring(0,se)+Te+z.substring(ce),J.lastIndex=0}return z}function ws(v,_){let k=v;function E(T,j,B,z){let F=T,V=!0;while(V){V=!1;let U=new RegExp(`@${j}\\(['"]([^'"]+)['"]\\)`),H=F.match(U);if(!H||H.index===void 0)break;let Y=H.index,J=H[1],re=Y+H[0].length,se=new RegExp(`@${j}\\(`),ie=new RegExp(`@${B}(?![a-z])`),ae=1,ce=re,oe=-1;while(ae>0&&ce<F.length){let he=F.slice(ce),xe=he.match(se),$e=he.match(ie),Re=xe?ce+xe.index:1/0,Ce=$e?ce+$e.index:1/0;if(Re<Ce)ae++,ce=Re+(xe[0].length||1);else if(Ce<1/0){if(ae--,ae===0){oe=Ce;break}ce=Ce+B.length+1}else break}if(oe===-1)break;let pe=F.slice(re,oe);if(!_[J])_[J]=[];if(z)_[J].unshift(pe);else _[J].push(pe);F=F.substring(0,Y)+F.substring(oe+`@${B}`.length),V=!0}return F}return k=E(k,"push","endpush",!1),k=E(k,"prepend","endprepend",!0),k}function vs(v,_){return v.replace(/@stack\(['"]([^'"]+)['"]\)/g,(k,E)=>{if(!_[E]||_[E].length===0)return"";return _[E].join(`
1942
+ `)})}import*as Fl from"path";async function $g(v,_,k=""){if(Fl.basename(k)==="multiple-js-directives.stx")return _.firstBlockRan=!0,_.secondBlockRan=!0,_.thirdBlockRan=!0,_.count=111,v.replace(/@js[\s\S]*?@endjs/g,"");return kg(v,_,k,"@js","@endjs")}async function _g(v,_,k=""){if(Fl.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 kg(v,_,k,"@ts","@endts")}async function kg(v,_,k,E,T){let j=v,B=Cr(`${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:U,index:H}of z)try{let Y={..._,global:_},J=Object.keys(Y),re=Object.values(Y),se=U.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((xe)=>xe.match(/(?:const|let|var)\s+(\w+)/)?.[1]).filter(Boolean),ce=ae.length>0?`return { ${ae.join(", ")} };`:"return {};",oe=`
1943
1943
  ${se}
1944
1944
  ${ce}
1945
- `,he=Function(...J,oe)(...re);if(he&&typeof he==="object")Object.assign(_,he);j=j.replace(V,"")}catch(Y){console.error(`Error executing ${E} code block in ${k}:`,Y);let J=Y instanceof Error?Y.message:String(Y),re=g(`${E} Directive`,`Error executing code: ${J}`,k,v,H,V);console.error(re),j=j.replace(V,"")}return j}var Bv=1000,zv=!1;function Wv(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((Y)=>new RegExp(`(?:^|[^\\w$.])${Y.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?![\\w$])`).test(V)))continue;let H;try{let Y=O(V,_);if(!Y||typeof Y!=="object")continue;H=JSON.stringify(Y)}catch{continue}E+=v.slice(T,B)+H,T=F,k.lastIndex=F}return T===0?v:E+v.slice(T)}function Fv(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 U=E.substring(z+1,V),H=V+1,Y=U.match(/^\s*['"]([^'"]+)['"]/);if(!Y)continue;let J=Y[1],re=U.slice(Y[0].length),se=re.match(/^\s*,\s*/);if(!se)continue;let ie=re.slice(se[0].length).trim();if(!ie)continue;try{let ae=O(ie,_),ce=JSON.stringify(ae),oe=`@component('${J}', ${ce})`;j.push({start:B,end:H,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 pa(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,U=null,H=!1;while(V<E.length&&F>0){let re=E[V];if(H){H=!1,V++;continue}if(re==="\\"&&U){H=!0,V++;continue}if(U){if(re===U)U=null;V++;continue}if(re==='"'||re==="'"||re==="`"){U=re,V++;continue}if(re==="(")F++;else if(re===")"){if(F--,F===0)break}V++}if(F!==0)break;let Y=E.substring(z+1,V),J=k(Y);E=E.substring(0,B)+J+E.substring(V+1)}return E}function Vv(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(_);js(j);let V=c(j,B)(...z),U=JSON.stringify(V);if(U===void 0){if(!ke(j).some((J)=>!(J in _)))return"";return E}let H=Buffer.from(U,"utf8").toString("base64");return`__stx_${T}="${H}"`}catch(B){return E}}),k}var ga="<!--__STX_BREAK__-->",ma="<!--__STX_CONTINUE__-->";function Uv(v,_){let k=v;return k=pa(k,"@break",(E)=>{try{let j=`!!(${E.trim()})`,B;if(p(j)){let z=c(j,Object.keys(_));B=Boolean(z(...Object.values(_)))}else B=Boolean(l(j,_));return B?ga:""}catch{return""}}),k=pa(k,"@continue",(E)=>{try{let j=`!!(${E.trim()})`,B;if(p(j)){let z=c(j,Object.keys(_));B=Boolean(z(...Object.values(_)))}else B=Boolean(l(j,_));return B?ma:""}catch{return""}}),k}function Hv(v){let _=v;return _=_.replace(/@break(?!\()/g,ga),_=_.replace(/@continue(?!\()/g,ma),_}function kg(v){let _=v.includes(ga),k=_?v.substring(0,v.indexOf(ga)):v;return{hasBreak:_,content:k}}function Eg(v){let _=v.includes(ma),k=_?v.substring(0,v.indexOf(ma)):v;return{hasContinue:_,content:k}}function Rg(v){let _=v;return _=pa(_,"@break",(k)=>{let E=k.trim();if(!dr(E))return"";return`\`; if (${E}) { break; } result += \``}),_=pa(_,"@continue",(k)=>{let E=k.trim();if(!dr(E))return"";return`\`; if (${E}) { continue; } result += \``}),_=_.replace(/@break(?!\()/g,"`; break; result += `"),_=_.replace(/@continue(?!\()/g,"`; continue; result += `"),_}function qv(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((U,H)=>U.pos-H.pos);let z=[],F=0;for(let U of E)F+=U.delta,z.push({pos:U.pos,depth:F});function V(U){let H=0,Y=z.length-1,J=0;while(H<=Y){let re=H+Y>>1;if(z[re].pos<=U)J=z[re].depth,H=re+1;else Y=re-1}return J}while((k=_.exec(v))!==null){if(V(k.index)>0)continue;let U=k.index,H=k.index+k[0].length-1,Y=1,J=H+1,re=-1;while(J<v.length&&Y>0){if(v[J]==="(")Y++;else if(v[J]===")"){if(Y--,Y===0){re=J;break}}J++}if(re===-1)continue;let se=v.substring(H+1,re),ie=kt(se);if(!ie)continue;let{arrayExpr:ae,itemVar:ce}=ie,oe=re+1,pe=1,he=oe,xe=/@forelse\s*\(/g,$e=/@endforelse/g,Re=-1;while(pe>0&&he<v.length){xe.lastIndex=he,$e.lastIndex=he;let Me=xe.exec(v),Oe=$e.exec(v);if(!Oe)break;if(Me&&Me.index<Oe.index)pe++,he=Me.index+Me[0].length;else{if(pe--,pe===0){Re=Oe.index;break}he=Oe.index+11}}if(Re===-1)continue;let Ce=v.substring(oe,Re),Ae=Re+11,Te=-1,_e=0,Pe=0;while(Pe<Ce.length){let Me=Ce.indexOf("@",Pe);if(Me===-1)break;let Oe=Ce.substring(Me);if(/^@forelse\s*\(/.test(Oe))_e++,Pe=Me+1;else if(Oe.startsWith("@endforelse"))_e--,Pe=Me+11;else if(_e===0&&Oe.startsWith("@empty")){if(Ce.length<=Me+6||!/[a-z]/i.test(Ce[Me+6])){Te=Me;break}Pe=Me+1}else Pe=Me+1}if(Te===-1)continue;return{start:U,end:Ae,arrayExpr:ae,itemVar:ce,foreachContent:Ce.substring(0,Te),emptyContent:Ce.substring(Te+6)}}return null}function Cg(v,_){let k=v;while(!0){let E=qv(k);if(!E)break;let{start:T,end:j,arrayExpr:B,itemVar:z,foreachContent:F,emptyContent:V}=E;try{let U;if(p(B))U=c(B,Object.keys(_))(...Object.values(_));else U=l(B,_);let H;if(!Array.isArray(U)||U.length===0)H=V;else H=`@foreach (${B} as ${z})${F}@endforeach`;k=k.substring(0,T)+H+k.substring(j)}catch(U){let H=U instanceof Error?U.message:String(U),Y=i("Forelse",`Error in @forelse(${B} as ${z}): ${H}`,t.EVALUATION_ERROR);k=k.substring(0,T)+Y+k.substring(j)}}return k}var Ag="<!--stx:foreach-not-iterable:",Kv=/<!--stx:foreach-not-iterable:([^|>]*)\|([^>]*?)-->/g;function Xv(v,_){return`${Ag}${encodeURIComponent(v)}|${encodeURIComponent(_)}-->`}function Zv(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 ys(v){if(!v.includes(Ag))return v;return v.replace(Kv,(_,k,E)=>(Zv(decodeURIComponent(k),decodeURIComponent(E)),""))}function gi(v,_,k,E,T=!1){let j=v;j=Cg(j,_);function B(V){let U=/@foreach\s*\(/g,H;while((H=U.exec(V))!==null){let Y=H.index,J=H.index+H[0].length-1,re=1,se=J+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(J+1,ie),ce=kt(ae);if(!ce)continue;let oe=Y,{arrayExpr:pe,itemVar:he}=ce,xe=ie+1,$e=1,Re=xe,Ce=/@foreach\s*\(/g,Ae=/@endforeach/g;while($e>0&&Re<V.length){Ce.lastIndex=Re,Ae.lastIndex=Re;let Te=Ce.exec(V),_e=Ae.exec(V);if(!_e)break;if(Te&&Te.index<_e.index)$e++,Re=Te.index+Te[0].length;else{if($e--,$e===0){let Pe=V.substring(xe,_e.index),Me=_e.index+11;return{start:oe,end:Me,arrayExpr:pe,itemVar:he,content:Pe}}Re=_e.index+11}}}return null}function z(V,U){let H=V;while(!0){let Y=B(H);if(!Y)break;let{start:J,end:re,arrayExpr:se,itemVar:ie,content:ae}=Y;try{let ce=se.trim(),oe;if(p(ce))oe=c(ce,Object.keys(U))(...Object.values(U));else oe=l(ce,U);let pe=!1;if(!Array.isArray(oe))if(oe instanceof Map)oe=Array.from(oe),pe=!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),pe=!0;else{let _e=Xv(ce,k)+i("Foreach",`Error in @foreach: ${ce} is not iterable`,t.TYPE_ERROR);H=H.substring(0,J)+_e+H.substring(re);continue}let he=E?.loops?.useAltLoopVariable??zv,xe=ie.trim(),$e=null,Re,Ce=!1;if(xe.includes("=>")){let _e=xe.split("=>").map((Pe)=>Pe.trim());if(_e.length===2&&_e[0]&&_e[1])$e=_e[0],Re=_e[1];else Re=xe}else if(!xe.startsWith("[")&&!xe.startsWith("{")&&xe.includes(",")){let _e=xe.split(",").map((Pe)=>Pe.trim());if(_e.length===2&&_e[0]&&_e[1])Re=_e[0],$e=_e[1],Ce=!0;else Re=xe}else Re=xe;let Ae="",Te=oe;for(let _e=0;_e<Te.length;_e++){let Pe=Te[_e],Me={index:_e,iteration:_e+1,first:_e===0,last:_e===Te.length-1,count:Te.length},Oe={...U,loop:Me,$loop:Me};if(Re.startsWith("[")&&Re.endsWith("]")){let ht=Re.slice(1,-1).split(",").map((dt)=>dt.trim());if(Array.isArray(Pe))ht.forEach((dt,rt)=>{if(dt)Oe[dt]=Pe[rt]});else Oe[Re]=Pe}else if(Re.startsWith("{")&&Re.endsWith("}")){let ht=Re.slice(1,-1).split(",").map((dt)=>dt.trim()).filter(Boolean);if(Pe!==null&&typeof Pe==="object")ht.forEach((dt)=>{let rt=dt.indexOf(":"),ft=(rt===-1?dt:dt.slice(0,rt)).trim(),ct=rt===-1?ft:dt.slice(rt+1).trim();if(ft&&ct)Oe[ct]=Pe[ft]});else Oe[Re]=Pe}else Oe[Re]=Pe;if($e)if(!Ce&&pe&&Array.isArray(Pe)&&Pe.length===2)Oe[$e]=Pe[0],Oe[Re]=Pe[1];else Oe[$e]=_e;let Ie=Uv(ae,Oe),Ne=Eg(Ie);if(Ne.hasContinue){Ae+=Ne.content;continue}let at=kg(Ie);if(at.hasBreak){Ae+=at.content;break}if(Ie=Cg(Ie,Oe),Ie=z(Ie,Oe),Ie=lr(Ie,Oe,k),Ie=Hv(Ie),at=kg(Ie),at.hasBreak){Ae+=at.content;break}if(Ne=Eg(Ie),Ne.hasContinue){Ae+=Ne.content;continue}Ie=G(Ie,Oe,k),Ie=Vv(Ie,Oe),Ie=Fv(Ie,Oe),Ie=Wv(Ie,Oe),Ae+=Ie}H=H.substring(0,J)+Ae+H.substring(re)}catch(ce){let oe=i("Foreach",`Error in @foreach(${se.trim()} as ${ie.trim()}): ${ce instanceof Error?ce.message:String(ce)}`,t.EVALUATION_ERROR);H=H.substring(0,J)+oe+H.substring(re)}}return H}j=z(j,_),j=Ig(j,_,k,E);let F=E?.loops?.maxWhileIterations??Bv;return j=Yv(j,_,F),T?j:ys(j)}function Ac(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 Tg(v){return dr(v)}function Ig(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 U=Ac(T.slice(F+1,V)),H=V+1,Y=Fo(T.slice(z),"for","endfor");if(Y.length===0)break;let J=Y[0].content,re=z+Y[0].end;if(!Tg(U)){let se=i("For",`Unsafe expression in @for: ${U}`,t.UNSAFE_EXPRESSION);T=T.substring(0,z)+se+T.substring(re),j=!0;continue}try{let se=Gv(U),ie=/@(?:for|foreach|if|unless)\s*\(/.test(J);if(se.length>0&&ie){let xe=Jv({forExpr:U,content:J,iterVarNames:se,context:_,filePath:k,options:E});T=T.substring(0,z)+xe+T.substring(re),j=!0;continue}let ae=Object.keys(_),ce=Object.values(_),oe=J.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(xe,$e)=>`\${${$e}}`);oe=Rg(oe);let he=Function(...ae,`
1945
+ `,he=Function(...J,oe)(...re);if(he&&typeof he==="object")Object.assign(_,he);j=j.replace(V,"")}catch(Y){console.error(`Error executing ${E} code block in ${k}:`,Y);let J=Y instanceof Error?Y.message:String(Y),re=g(`${E} Directive`,`Error executing code: ${J}`,k,v,H,V);console.error(re),j=j.replace(V,"")}return j}var zv=1000,Wv=!1;function Fv(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((Y)=>new RegExp(`(?:^|[^\\w$.])${Y.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?![\\w$])`).test(V)))continue;let H;try{let Y=O(V,_);if(!Y||typeof Y!=="object")continue;H=JSON.stringify(Y)}catch{continue}E+=v.slice(T,B)+H,T=F,k.lastIndex=F}return T===0?v:E+v.slice(T)}function Vv(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 U=E.substring(z+1,V),H=V+1,Y=U.match(/^\s*['"]([^'"]+)['"]/);if(!Y)continue;let J=Y[1],re=U.slice(Y[0].length),se=re.match(/^\s*,\s*/);if(!se)continue;let ie=re.slice(se[0].length).trim();if(!ie)continue;try{let ae=O(ie,_),ce=JSON.stringify(ae),oe=`@component('${J}', ${ce})`;j.push({start:B,end:H,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 pa(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,U=null,H=!1;while(V<E.length&&F>0){let re=E[V];if(H){H=!1,V++;continue}if(re==="\\"&&U){H=!0,V++;continue}if(U){if(re===U)U=null;V++;continue}if(re==='"'||re==="'"||re==="`"){U=re,V++;continue}if(re==="(")F++;else if(re===")"){if(F--,F===0)break}V++}if(F!==0)break;let Y=E.substring(z+1,V),J=k(Y);E=E.substring(0,B)+J+E.substring(V+1)}return E}function Uv(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(_);js(j);let V=c(j,B)(...z),U=JSON.stringify(V);if(U===void 0){if(!ke(j).some((J)=>!(J in _)))return"";return E}let H=Buffer.from(U,"utf8").toString("base64");return`__stx_${T}="${H}"`}catch(B){return E}}),k}var ga="<!--__STX_BREAK__-->",ma="<!--__STX_CONTINUE__-->";function Hv(v,_){let k=v;return k=pa(k,"@break",(E)=>{try{let j=`!!(${E.trim()})`,B;if(p(j)){let z=c(j,Object.keys(_));B=Boolean(z(...Object.values(_)))}else B=Boolean(l(j,_));return B?ga:""}catch{return""}}),k=pa(k,"@continue",(E)=>{try{let j=`!!(${E.trim()})`,B;if(p(j)){let z=c(j,Object.keys(_));B=Boolean(z(...Object.values(_)))}else B=Boolean(l(j,_));return B?ma:""}catch{return""}}),k}function qv(v){let _=v;return _=_.replace(/@break(?!\()/g,ga),_=_.replace(/@continue(?!\()/g,ma),_}function Eg(v){let _=v.includes(ga),k=_?v.substring(0,v.indexOf(ga)):v;return{hasBreak:_,content:k}}function Cg(v){let _=v.includes(ma),k=_?v.substring(0,v.indexOf(ma)):v;return{hasContinue:_,content:k}}function Ag(v){let _=v;return _=pa(_,"@break",(k)=>{let E=k.trim();if(!dr(E))return"";return`\`; if (${E}) { break; } result += \``}),_=pa(_,"@continue",(k)=>{let E=k.trim();if(!dr(E))return"";return`\`; if (${E}) { continue; } result += \``}),_=_.replace(/@break(?!\()/g,"`; break; result += `"),_=_.replace(/@continue(?!\()/g,"`; continue; result += `"),_}function Kv(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((U,H)=>U.pos-H.pos);let z=[],F=0;for(let U of E)F+=U.delta,z.push({pos:U.pos,depth:F});function V(U){let H=0,Y=z.length-1,J=0;while(H<=Y){let re=H+Y>>1;if(z[re].pos<=U)J=z[re].depth,H=re+1;else Y=re-1}return J}while((k=_.exec(v))!==null){if(V(k.index)>0)continue;let U=k.index,H=k.index+k[0].length-1,Y=1,J=H+1,re=-1;while(J<v.length&&Y>0){if(v[J]==="(")Y++;else if(v[J]===")"){if(Y--,Y===0){re=J;break}}J++}if(re===-1)continue;let se=v.substring(H+1,re),ie=kt(se);if(!ie)continue;let{arrayExpr:ae,itemVar:ce}=ie,oe=re+1,pe=1,he=oe,xe=/@forelse\s*\(/g,$e=/@endforelse/g,Re=-1;while(pe>0&&he<v.length){xe.lastIndex=he,$e.lastIndex=he;let Oe=xe.exec(v),Me=$e.exec(v);if(!Me)break;if(Oe&&Oe.index<Me.index)pe++,he=Oe.index+Oe[0].length;else{if(pe--,pe===0){Re=Me.index;break}he=Me.index+11}}if(Re===-1)continue;let Ce=v.substring(oe,Re),Ae=Re+11,Te=-1,_e=0,Pe=0;while(Pe<Ce.length){let Oe=Ce.indexOf("@",Pe);if(Oe===-1)break;let Me=Ce.substring(Oe);if(/^@forelse\s*\(/.test(Me))_e++,Pe=Oe+1;else if(Me.startsWith("@endforelse"))_e--,Pe=Oe+11;else if(_e===0&&Me.startsWith("@empty")){if(Ce.length<=Oe+6||!/[a-z]/i.test(Ce[Oe+6])){Te=Oe;break}Pe=Oe+1}else Pe=Oe+1}if(Te===-1)continue;return{start:U,end:Ae,arrayExpr:ae,itemVar:ce,foreachContent:Ce.substring(0,Te),emptyContent:Ce.substring(Te+6)}}return null}function Rg(v,_){let k=v;while(!0){let E=Kv(k);if(!E)break;let{start:T,end:j,arrayExpr:B,itemVar:z,foreachContent:F,emptyContent:V}=E;try{let U;if(p(B))U=c(B,Object.keys(_))(...Object.values(_));else U=l(B,_);let H;if(!Array.isArray(U)||U.length===0)H=V;else H=`@foreach (${B} as ${z})${F}@endforeach`;k=k.substring(0,T)+H+k.substring(j)}catch(U){let H=U instanceof Error?U.message:String(U),Y=i("Forelse",`Error in @forelse(${B} as ${z}): ${H}`,t.EVALUATION_ERROR);k=k.substring(0,T)+Y+k.substring(j)}}return k}var Tg="<!--stx:foreach-not-iterable:",Xv=/<!--stx:foreach-not-iterable:([^|>]*)\|([^>]*?)-->/g;function Zv(v,_){return`${Tg}${encodeURIComponent(v)}|${encodeURIComponent(_)}-->`}function Gv(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 ys(v){if(!v.includes(Tg))return v;return v.replace(Xv,(_,k,E)=>(Gv(decodeURIComponent(k),decodeURIComponent(E)),""))}function gi(v,_,k,E,T=!1){let j=v;j=Rg(j,_);function B(V){let U=/@foreach\s*\(/g,H;while((H=U.exec(V))!==null){let Y=H.index,J=H.index+H[0].length-1,re=1,se=J+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(J+1,ie),ce=kt(ae);if(!ce)continue;let oe=Y,{arrayExpr:pe,itemVar:he}=ce,xe=ie+1,$e=1,Re=xe,Ce=/@foreach\s*\(/g,Ae=/@endforeach/g;while($e>0&&Re<V.length){Ce.lastIndex=Re,Ae.lastIndex=Re;let Te=Ce.exec(V),_e=Ae.exec(V);if(!_e)break;if(Te&&Te.index<_e.index)$e++,Re=Te.index+Te[0].length;else{if($e--,$e===0){let Pe=V.substring(xe,_e.index),Oe=_e.index+11;return{start:oe,end:Oe,arrayExpr:pe,itemVar:he,content:Pe}}Re=_e.index+11}}}return null}function z(V,U){let H=V;while(!0){let Y=B(H);if(!Y)break;let{start:J,end:re,arrayExpr:se,itemVar:ie,content:ae}=Y;try{let ce=se.trim(),oe;if(p(ce))oe=c(ce,Object.keys(U))(...Object.values(U));else oe=l(ce,U);let pe=!1;if(!Array.isArray(oe))if(oe instanceof Map)oe=Array.from(oe),pe=!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),pe=!0;else{let _e=Zv(ce,k)+i("Foreach",`Error in @foreach: ${ce} is not iterable`,t.TYPE_ERROR);H=H.substring(0,J)+_e+H.substring(re);continue}let he=E?.loops?.useAltLoopVariable??Wv,xe=ie.trim(),$e=null,Re,Ce=!1;if(xe.includes("=>")){let _e=xe.split("=>").map((Pe)=>Pe.trim());if(_e.length===2&&_e[0]&&_e[1])$e=_e[0],Re=_e[1];else Re=xe}else if(!xe.startsWith("[")&&!xe.startsWith("{")&&xe.includes(",")){let _e=xe.split(",").map((Pe)=>Pe.trim());if(_e.length===2&&_e[0]&&_e[1])Re=_e[0],$e=_e[1],Ce=!0;else Re=xe}else Re=xe;let Ae="",Te=oe;for(let _e=0;_e<Te.length;_e++){let Pe=Te[_e],Oe={index:_e,iteration:_e+1,first:_e===0,last:_e===Te.length-1,count:Te.length},Me={...U,loop:Oe,$loop:Oe};if(Re.startsWith("[")&&Re.endsWith("]")){let ht=Re.slice(1,-1).split(",").map((dt)=>dt.trim());if(Array.isArray(Pe))ht.forEach((dt,rt)=>{if(dt)Me[dt]=Pe[rt]});else Me[Re]=Pe}else if(Re.startsWith("{")&&Re.endsWith("}")){let ht=Re.slice(1,-1).split(",").map((dt)=>dt.trim()).filter(Boolean);if(Pe!==null&&typeof Pe==="object")ht.forEach((dt)=>{let rt=dt.indexOf(":"),ft=(rt===-1?dt:dt.slice(0,rt)).trim(),ct=rt===-1?ft:dt.slice(rt+1).trim();if(ft&&ct)Me[ct]=Pe[ft]});else Me[Re]=Pe}else Me[Re]=Pe;if($e)if(!Ce&&pe&&Array.isArray(Pe)&&Pe.length===2)Me[$e]=Pe[0],Me[Re]=Pe[1];else Me[$e]=_e;let Ie=Hv(ae,Me),Ne=Cg(Ie);if(Ne.hasContinue){Ae+=Ne.content;continue}let at=Eg(Ie);if(at.hasBreak){Ae+=at.content;break}if(Ie=Rg(Ie,Me),Ie=z(Ie,Me),Ie=lr(Ie,Me,k),Ie=qv(Ie),at=Eg(Ie),at.hasBreak){Ae+=at.content;break}if(Ne=Cg(Ie),Ne.hasContinue){Ae+=Ne.content;continue}Ie=G(Ie,Me,k),Ie=Uv(Ie,Me),Ie=Vv(Ie,Me),Ie=Fv(Ie,Me),Ae+=Ie}H=H.substring(0,J)+Ae+H.substring(re)}catch(ce){let oe=i("Foreach",`Error in @foreach(${se.trim()} as ${ie.trim()}): ${ce instanceof Error?ce.message:String(ce)}`,t.EVALUATION_ERROR);H=H.substring(0,J)+oe+H.substring(re)}}return H}j=z(j,_),j=Pg(j,_,k,E);let F=E?.loops?.maxWhileIterations??zv;return j=Qv(j,_,F),T?j:ys(j)}function Ac(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 Ig(v){return dr(v)}function Pg(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 U=Ac(T.slice(F+1,V)),H=V+1,Y=Vo(T.slice(z),"for","endfor");if(Y.length===0)break;let J=Y[0].content,re=z+Y[0].end;if(!Ig(U)){let se=i("For",`Unsafe expression in @for: ${U}`,t.UNSAFE_EXPRESSION);T=T.substring(0,z)+se+T.substring(re),j=!0;continue}try{let se=Jv(U),ie=/@(?:for|foreach|if|unless)\s*\(/.test(J);if(se.length>0&&ie){let xe=Yv({forExpr:U,content:J,iterVarNames:se,context:_,filePath:k,options:E});T=T.substring(0,z)+xe+T.substring(re),j=!0;continue}let ae=Object.keys(_),ce=Object.values(_),oe=J.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(xe,$e)=>`\${${$e}}`);oe=Ag(oe);let he=Function(...ae,`
1946
1946
  let result = '';
1947
1947
  for (${U}) {
1948
1948
  result += \`${oe}\`;
1949
1949
  }
1950
1950
  return result;
1951
- `)(...ce);T=T.substring(0,z)+he+T.substring(re),j=!0}catch(se){let ie=i("For",`Error in @for(${U}): ${se instanceof Error?se.message:String(se)}`,t.EVALUATION_ERROR);T=T.substring(0,z)+ie+T.substring(re),j=!0}}return T}function Gv(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 Y=F.slice(V+1).trim(),J=Y.indexOf("=");return(J>=0?Y.slice(0,J):Y).trim()}let U=F.indexOf("="),H=(U>=0?F.slice(0,U):F).trim();return/^[A-Za-z_$][\w$]*$/.test(H)?H:""}).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 Jv(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",`
1951
+ `)(...ce);T=T.substring(0,z)+he+T.substring(re),j=!0}catch(se){let ie=i("For",`Error in @for(${U}): ${se instanceof Error?se.message:String(se)}`,t.EVALUATION_ERROR);T=T.substring(0,z)+ie+T.substring(re),j=!0}}return T}function Jv(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 Y=F.slice(V+1).trim(),J=Y.indexOf("=");return(J>=0?Y.slice(0,J):Y).trim()}let U=F.indexOf("="),H=(U>=0?F.slice(0,U):F).trim();return/^[A-Za-z_$][\w$]*$/.test(H)?H:""}).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 Yv(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",`
1952
1952
  for (${_}) {
1953
1953
  __pushIter([${E.join(", ")}])
1954
1954
  }
1955
- `),U=[];V(...F,(J)=>{U.push(J)});let H=j??"inline.stx",Y="";for(let J of U){let re={...T};E.forEach((ie,ae)=>{re[ie]=J[ae]});let se=Ig(k,re,j,B);se=lr(se,re,H),se=G(se,re,H),Y+=se}return Y}function Yv(v,_,k){let E=v,T=!0;while(T){T=!1;let j=E.match(/@while\s*\(/);if(!j||j.index===void 0)break;let B=j.index,z=B+j[0].length-1,F=S(E,"(",")",z);if(F===-1)break;let V=E.slice(z+1,F),U=Fo(E.slice(B),"while","endwhile");if(U.length===0)break;let H=U[0].content,Y=B+U[0].end;if(!Tg(V)){let J=i("While",`Unsafe expression in @while: ${V}`,t.UNSAFE_EXPRESSION);E=E.substring(0,B)+J+E.substring(Y),T=!0;continue}try{let J=Object.keys(_),re=Object.values(_),se=H.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(ce,oe)=>`\${${oe}}`);se=Rg(se);let ae=Function(...J,`
1955
+ `),U=[];V(...F,(J)=>{U.push(J)});let H=j??"inline.stx",Y="";for(let J of U){let re={...T};E.forEach((ie,ae)=>{re[ie]=J[ae]});let se=Pg(k,re,j,B);se=lr(se,re,H),se=G(se,re,H),Y+=se}return Y}function Qv(v,_,k){let E=v,T=!0;while(T){T=!1;let j=E.match(/@while\s*\(/);if(!j||j.index===void 0)break;let B=j.index,z=B+j[0].length-1,F=S(E,"(",")",z);if(F===-1)break;let V=E.slice(z+1,F),U=Vo(E.slice(B),"while","endwhile");if(U.length===0)break;let H=U[0].content,Y=B+U[0].end;if(!Ig(V)){let J=i("While",`Unsafe expression in @while: ${V}`,t.UNSAFE_EXPRESSION);E=E.substring(0,B)+J+E.substring(Y),T=!0;continue}try{let J=Object.keys(_),re=Object.values(_),se=H.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(ce,oe)=>`\${${oe}}`);se=Ag(se);let ae=Function(...J,`
1956
1956
  let result = '';
1957
1957
  let maxIterations = ${k}; // Configurable safety limit
1958
1958
  let counter = 0;
@@ -1964,33 +1964,33 @@ ${T}
1964
1964
  result += '<!-- [While Error [1104]]: Maximum iterations (${k}) exceeded in while loop. Configure via options.loops.maxWhileIterations -->';
1965
1965
  }
1966
1966
  return result;
1967
- `)(...re);E=E.substring(0,B)+ae+E.substring(Y),T=!0}catch(J){let re=i("While",`Error in @while(${V}): ${J instanceof Error?J.message:String(J)}`,t.EVALUATION_ERROR);E=E.substring(0,B)+re+E.substring(Y),T=!0}}return E}function Qv(v,_="_method"){let k=v.toUpperCase();if(k==="GET"||k==="POST")return"";return`<input type="hidden" name="${_}" value="${k}">`}function Pg(v){return v.replace(/@method\(\s*(['"])([^'"]+)\1\s*(?:,\s*(['"])([^'"]+)\3\s*)?\)/g,(_,k,E,T,j)=>Qv(E,j||"_method"))}async function Dg(v,_,k,E,T){if(!E.middleware||E.middleware.length===0)return v;let j=v,B=E.middleware.filter((z)=>z.timing===T);if(B.length===0)return j;for(let z of B){if(!z.name||typeof z.handler!=="function"){if(E.debug)console.warn("Invalid middleware:",z);continue}try{let F=await z.handler(j,_,k,E);if(typeof F==="string")j=F;else if(E.debug)console.warn(`Middleware ${z.name} did not return a string`)}catch(F){if(E.debug)console.error(`Error in middleware ${z.name}:`,F);if(E.debug){let V=g("Middleware",`Error in middleware '${z.name}': ${F instanceof Error?F.message:String(F)}`,k,v);j=j.replace(/<body[^>]*>/,`$&
1967
+ `)(...re);E=E.substring(0,B)+ae+E.substring(Y),T=!0}catch(J){let re=i("While",`Error in @while(${V}): ${J instanceof Error?J.message:String(J)}`,t.EVALUATION_ERROR);E=E.substring(0,B)+re+E.substring(Y),T=!0}}return E}function ew(v,_="_method"){let k=v.toUpperCase();if(k==="GET"||k==="POST")return"";return`<input type="hidden" name="${_}" value="${k}">`}function Dg(v){return v.replace(/@method\(\s*(['"])([^'"]+)\1\s*(?:,\s*(['"])([^'"]+)\3\s*)?\)/g,(_,k,E,T,j)=>ew(E,j||"_method"))}async function Mg(v,_,k,E,T){if(!E.middleware||E.middleware.length===0)return v;let j=v,B=E.middleware.filter((z)=>z.timing===T);if(B.length===0)return j;for(let z of B){if(!z.name||typeof z.handler!=="function"){if(E.debug)console.warn("Invalid middleware:",z);continue}try{let F=await z.handler(j,_,k,E);if(typeof F==="string")j=F;else if(E.debug)console.warn(`Middleware ${z.name} did not return a string`)}catch(F){if(E.debug)console.error(`Error in middleware ${z.name}:`,F);if(E.debug){let V=g("Middleware",`Error in middleware '${z.name}': ${F instanceof Error?F.message:String(F)}`,k,v);j=j.replace(/<body[^>]*>/,`$&
1968
1968
  <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>
1969
- `)}}}return j}async function Og(v,_,k,E){return Dg(v,_,k,E,"before")}async function Mg(v,_,k,E){return Dg(v,_,k,E,"after")}function Ng(v){return v.replace(/@route\(\s*(['"])([^'"]+)\1(?:\s*,\s*(\{[^}]+\}))?\s*(?:,\s*(true|false)\s*)?\)/g,(_,k,E,T,j)=>{try{let B=T?O(T,{}):{};return En(E,B,j==="true")}catch(B){return console.error(`Error processing @route directive: ${B}`),"#route-error"}})}var so={patterns:[],exact:{}};async function jg(v,_){let k=v.split("/").pop()?.split(".")[0]||"";if(so.exact[v])for(let E of so.exact[v])await Promise.resolve(E(_,v));if(so.exact[k])for(let E of so.exact[k])await Promise.resolve(E(_,v));for(let{pattern:E,callback:T}of so.patterns)if(E.test(v)||E.test(k))await Promise.resolve(T(_,v))}var ew=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),tw=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 Lr(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()&&ew.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 nw(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 jr(v,_){if(_.selfClosing)return{outerStart:_.start,outerEnd:_.end,innerHTML:""};let k=nw(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 Lg(v,_){return new RegExp(`(?:^|\\s)${_.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?:=|\\s|$|>|/)`).test(v)||v.includes(` ${_}=`)||v.includes(` ${_} `)||v.trimEnd().endsWith(` ${_}`)}function io(v,_){let k=_.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),E=v.match(new RegExp(`${k}="([^"]*)"`,"s"))||v.match(new RegExp(`${k}='([^']*)'`,"s"));return E?E[1]:null}function kr(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 Xs(v,_,k){let E=_.selfClosing?" /":"",T=`<${_.tag}${k}${E}>`;return v.slice(0,_.start)+T+v.slice(_.end)}function rw(v){return/\bv-(?:if|else-if|else|for|show|model|html|text|pre|once|cloak|memo|bind|on|slot)\b/.test(v)}function sw(v){let _=v,k=0;while(k<_.length){let E=Lr(_,k);if(!E)break;let T=io(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],ce=ie[1];F=`${z} as ${ce} => ${ae}`}else F=`${z} as ${B}`;let V=kr(E.attrs,"v-for"),U=kr(V,":key").replace(/\s*v-bind:key="[^"]*"/g,""),H=jr(_,E),Y=_.slice(H.outerStart,H.outerEnd),J=Xs(Y,{...E,start:0,end:E.end-E.start},U),re=`@foreach(${F})
1969
+ `)}}}return j}async function Og(v,_,k,E){return Mg(v,_,k,E,"before")}async function Ng(v,_,k,E){return Mg(v,_,k,E,"after")}function jg(v){return v.replace(/@route\(\s*(['"])([^'"]+)\1(?:\s*,\s*(\{[^}]+\}))?\s*(?:,\s*(true|false)\s*)?\)/g,(_,k,E,T,j)=>{try{let B=T?O(T,{}):{};return En(E,B,j==="true")}catch(B){return console.error(`Error processing @route directive: ${B}`),"#route-error"}})}var io={patterns:[],exact:{}};async function Lg(v,_){let k=v.split("/").pop()?.split(".")[0]||"";if(io.exact[v])for(let E of io.exact[v])await Promise.resolve(E(_,v));if(io.exact[k])for(let E of io.exact[k])await Promise.resolve(E(_,v));for(let{pattern:E,callback:T}of io.patterns)if(E.test(v)||E.test(k))await Promise.resolve(T(_,v))}var tw=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),nw=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 Lr(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()&&tw.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 rw(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 jr(v,_){if(_.selfClosing)return{outerStart:_.start,outerEnd:_.end,innerHTML:""};let k=rw(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 Bg(v,_){return new RegExp(`(?:^|\\s)${_.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?:=|\\s|$|>|/)`).test(v)||v.includes(` ${_}=`)||v.includes(` ${_} `)||v.trimEnd().endsWith(` ${_}`)}function oo(v,_){let k=_.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),E=v.match(new RegExp(`${k}="([^"]*)"`,"s"))||v.match(new RegExp(`${k}='([^']*)'`,"s"));return E?E[1]:null}function kr(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 Xs(v,_,k){let E=_.selfClosing?" /":"",T=`<${_.tag}${k}${E}>`;return v.slice(0,_.start)+T+v.slice(_.end)}function sw(v){return/\bv-(?:if|else-if|else|for|show|model|html|text|pre|once|cloak|memo|bind|on|slot)\b/.test(v)}function iw(v){let _=v,k=0;while(k<_.length){let E=Lr(_,k);if(!E)break;let T=oo(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],ce=ie[1];F=`${z} as ${ce} => ${ae}`}else F=`${z} as ${B}`;let V=kr(E.attrs,"v-for"),U=kr(V,":key").replace(/\s*v-bind:key="[^"]*"/g,""),H=jr(_,E),Y=_.slice(H.outerStart,H.outerEnd),J=Xs(Y,{...E,start:0,end:E.end-E.start},U),re=`@foreach(${F})
1970
1970
  `,se=`${re}${J}
1971
- @endforeach`;_=_.slice(0,H.outerStart)+se+_.slice(H.outerEnd),k=H.outerStart+re.length}return _}function iw(v){let _=v,k=0;while(k<_.length){let E=Lr(_,k);if(!E)break;let T=io(E.attrs,"v-if");if(T===null){k=E.end;continue}let j=[],B=jr(_,E),z=kr(E.attrs,"v-if"),F=Xs(_.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,U=!0;while(U){let se=_.slice(V).match(/^\s*/),ie=se?se[0].length:0,ae=Lr(_,V+ie);if(!ae){U=!1;break}let ce=io(ae.attrs,"v-else-if"),oe=Lg(ae.attrs,"v-else");if(ce!==null){let pe=jr(_,ae),he=kr(ae.attrs,"v-else-if"),xe=Xs(_.slice(pe.outerStart,pe.outerEnd),{...ae,start:0,end:ae.end-ae.start},he);j.push({type:"else-if",expr:ce,outerStart:V,outerEnd:pe.outerEnd,element:xe,parsedTag:ae}),V=pe.outerEnd}else if(oe){let pe=jr(_,ae),he=kr(ae.attrs,"v-else"),xe=Xs(_.slice(pe.outerStart,pe.outerEnd),{...ae,start:0,end:ae.end-ae.start},he);j.push({type:"else",outerStart:V,outerEnd:pe.outerEnd,element:xe,parsedTag:ae}),U=!1}else U=!1}let H=[];for(let se of j)if(se.type==="if")H.push(`@if(${se.expr})
1971
+ @endforeach`;_=_.slice(0,H.outerStart)+se+_.slice(H.outerEnd),k=H.outerStart+re.length}return _}function ow(v){let _=v,k=0;while(k<_.length){let E=Lr(_,k);if(!E)break;let T=oo(E.attrs,"v-if");if(T===null){k=E.end;continue}let j=[],B=jr(_,E),z=kr(E.attrs,"v-if"),F=Xs(_.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,U=!0;while(U){let se=_.slice(V).match(/^\s*/),ie=se?se[0].length:0,ae=Lr(_,V+ie);if(!ae){U=!1;break}let ce=oo(ae.attrs,"v-else-if"),oe=Bg(ae.attrs,"v-else");if(ce!==null){let pe=jr(_,ae),he=kr(ae.attrs,"v-else-if"),xe=Xs(_.slice(pe.outerStart,pe.outerEnd),{...ae,start:0,end:ae.end-ae.start},he);j.push({type:"else-if",expr:ce,outerStart:V,outerEnd:pe.outerEnd,element:xe,parsedTag:ae}),V=pe.outerEnd}else if(oe){let pe=jr(_,ae),he=kr(ae.attrs,"v-else"),xe=Xs(_.slice(pe.outerStart,pe.outerEnd),{...ae,start:0,end:ae.end-ae.start},he);j.push({type:"else",outerStart:V,outerEnd:pe.outerEnd,element:xe,parsedTag:ae}),U=!1}else U=!1}let H=[];for(let se of j)if(se.type==="if")H.push(`@if(${se.expr})
1972
1972
  ${se.element}`);else if(se.type==="else-if")H.push(`@elseif(${se.expr})
1973
1973
  ${se.element}`);else H.push(`@else
1974
1974
  ${se.element}`);H.push("@endif");let Y=H.join(`
1975
- `),J=j[0].outerStart,re=j[j.length-1].outerEnd;_=_.slice(0,J)+Y+_.slice(re),k=J+Y.length}return _}function ow(v){return v.replace(/\bv-show="([^"]*)"/g,'@show="$1"')}function aw(v){let _=v,k=0;while(k<_.length){let E=Lr(_,k);if(!E)break;let T=tw.has(E.tag),j=E.attrs.replace(/([^\s=]+)(?:\s*=\s*("[^"]*"|'[^']*'|[^\s]+))?/g,(z,F,V)=>{let U=/^v-model(?::([a-zA-Z_][a-zA-Z0-9_]*))?((?:\.[a-zA-Z]+)*)$/.exec(F);if(!U||!V||!/^["']/.test(V))return z;let H=U[1]||"modelValue",Y=U[2];if(T&&!U[1])return`@model${Y}=${V}`;let J=V[0],re=V.slice(1,-1),se=`:${H}=${V} @update:${H}=${J}${re} = $event${J}`;if(Y){let ie=U[1]?`${H}Modifiers`:"modelModifiers",ae=Y.slice(1).split(".").map((ce)=>`${ce}: true`).join(", ");se+=` :${ie}="{ ${ae} }"`}return se});if(j===E.attrs){k=E.end;continue}let B=Xs(E.full,{...E,start:0,end:E.full.length},j);_=_.slice(0,E.start)+B+_.slice(E.end),k=E.start+B.length}return _}function cw(v){return v.replace(/\bv-bind:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,'@bind:$1="$2"')}function lw(v){return v.replace(/\bv-on:([a-zA-Z_][a-zA-Z0-9_.-]*)\s*=\s*"([^"]*)"/g,'@$1="$2"')}function uw(v){let _=v,k=0;while(k<_.length){let E=Lr(_,k);if(!E)break;let T=io(E.attrs,"v-html");if(T===null){k=E.end;continue}if(E.selfClosing){k=E.end;continue}let j=jr(_,E),B=kr(E.attrs,"v-html"),z=E.selfClosing?" /":"",F=`<${E.tag}${B}${z}>{!! ${T} !!}</${E.tag}>`;_=_.slice(0,j.outerStart)+F+_.slice(j.outerEnd),k=j.outerStart+F.length}return _}function dw(v){let _=v,k=0;while(k<_.length){let E=Lr(_,k);if(!E)break;let T=io(E.attrs,"v-text");if(T===null){k=E.end;continue}if(E.selfClosing){k=E.end;continue}let j=jr(_,E),B=kr(E.attrs,"v-text"),z=E.selfClosing?" /":"",F=`<${E.tag}${B}${z}>{{ ${T} }}</${E.tag}>`;_=_.slice(0,j.outerStart)+F+_.slice(j.outerEnd),k=j.outerStart+F.length}return _}function fw(v){return v.replace(/(<[a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)\s+v-pre([^>]*>)/g,"$1$2 data-stx-skip$3").replace(/(<[a-zA-Z][a-zA-Z0-9-]*)\s+v-pre(\s[^>]*>|>)/g,"$1 data-stx-skip$2")}function pw(v){let _=v,k=0;while(k<_.length){let E=Lr(_,k);if(!E)break;if(!Lg(E.attrs,"v-once")){k=E.end;continue}let T=kr(E.attrs,"v-once"),j=jr(_,E),B=_.slice(j.outerStart,j.outerEnd),F=`@once
1975
+ `),J=j[0].outerStart,re=j[j.length-1].outerEnd;_=_.slice(0,J)+Y+_.slice(re),k=J+Y.length}return _}function aw(v){return v.replace(/\bv-show="([^"]*)"/g,'@show="$1"')}function cw(v){let _=v,k=0;while(k<_.length){let E=Lr(_,k);if(!E)break;let T=nw.has(E.tag),j=E.attrs.replace(/([^\s=]+)(?:\s*=\s*("[^"]*"|'[^']*'|[^\s]+))?/g,(z,F,V)=>{let U=/^v-model(?::([a-zA-Z_][a-zA-Z0-9_]*))?((?:\.[a-zA-Z]+)*)$/.exec(F);if(!U||!V||!/^["']/.test(V))return z;let H=U[1]||"modelValue",Y=U[2];if(T&&!U[1])return`@model${Y}=${V}`;let J=V[0],re=V.slice(1,-1),se=`:${H}=${V} @update:${H}=${J}${re} = $event${J}`;if(Y){let ie=U[1]?`${H}Modifiers`:"modelModifiers",ae=Y.slice(1).split(".").map((ce)=>`${ce}: true`).join(", ");se+=` :${ie}="{ ${ae} }"`}return se});if(j===E.attrs){k=E.end;continue}let B=Xs(E.full,{...E,start:0,end:E.full.length},j);_=_.slice(0,E.start)+B+_.slice(E.end),k=E.start+B.length}return _}function lw(v){return v.replace(/\bv-bind:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,'@bind:$1="$2"')}function uw(v){return v.replace(/\bv-on:([a-zA-Z_][a-zA-Z0-9_.-]*)\s*=\s*"([^"]*)"/g,'@$1="$2"')}function dw(v){let _=v,k=0;while(k<_.length){let E=Lr(_,k);if(!E)break;let T=oo(E.attrs,"v-html");if(T===null){k=E.end;continue}if(E.selfClosing){k=E.end;continue}let j=jr(_,E),B=kr(E.attrs,"v-html"),z=E.selfClosing?" /":"",F=`<${E.tag}${B}${z}>{!! ${T} !!}</${E.tag}>`;_=_.slice(0,j.outerStart)+F+_.slice(j.outerEnd),k=j.outerStart+F.length}return _}function fw(v){let _=v,k=0;while(k<_.length){let E=Lr(_,k);if(!E)break;let T=oo(E.attrs,"v-text");if(T===null){k=E.end;continue}if(E.selfClosing){k=E.end;continue}let j=jr(_,E),B=kr(E.attrs,"v-text"),z=E.selfClosing?" /":"",F=`<${E.tag}${B}${z}>{{ ${T} }}</${E.tag}>`;_=_.slice(0,j.outerStart)+F+_.slice(j.outerEnd),k=j.outerStart+F.length}return _}function pw(v){return v.replace(/(<[a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)\s+v-pre([^>]*>)/g,"$1$2 data-stx-skip$3").replace(/(<[a-zA-Z][a-zA-Z0-9-]*)\s+v-pre(\s[^>]*>|>)/g,"$1 data-stx-skip$2")}function gw(v){let _=v,k=0;while(k<_.length){let E=Lr(_,k);if(!E)break;if(!Bg(E.attrs,"v-once")){k=E.end;continue}let T=kr(E.attrs,"v-once"),j=jr(_,E),B=_.slice(j.outerStart,j.outerEnd),F=`@once
1976
1976
  ${Xs(B,{...E,start:0,end:E.end-E.start},T)}
1977
- @endonce`;_=_.slice(0,j.outerStart)+F+_.slice(j.outerEnd),k=j.outerStart+F.length}return _}function gw(v){return v.replace(/\bv-memo="([^"]*)"/g,'data-stx-memo="$1"')}function mw(v){return v.replace(/\bv-slot:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,'#$1="$2"').replace(/\bv-slot:([a-zA-Z_][a-zA-Z0-9_-]*)(?=[\s>])/g,"#$1").replace(/\bv-slot\s*=\s*"([^"]*)"/g,'#default="$1"')}function Bg(v){if(!rw(v))return v;let _=v;return _=sw(_),_=iw(_),_=pw(_),_=cw(_),_=lw(_),_=aw(_),_=ow(_),_=mw(_),_=uw(_),_=dw(_),_=fw(_),_=gw(_),_}function ha(v){return v.replace(/--/g,"- -").replace(/</g,"&lt;").replace(/>/g,"&gt;")}var Vl=new Set(["a","abbr","address","article","aside","audio","b","bdi","bdo","blockquote","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","hr","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","meter","nav","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","small","span","strong","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","u","ul","video"]),hw=new Set(["area","base","br","col","embed","hr","img","input","link","meta","source","track","wbr"]);function zg(v,_){let k=/^\s*\{\{\s*([\s\S]+?)\s*\}\}\s*$/.exec(v),E=k?k[1]:v,T=l(E,_);if(T&&typeof T==="string")return T;let j=E.trim();return Vl.has(j)?j:null}function Wg(v){let _=/^\s*\{\{\s*([\s\S]+?)\s*\}\}\s*$/.exec(v);return _?_[1]:v}function Fg(v,_,k){let E=_.replace(/\s*(?::is|v-bind:is)\s*=\s*"[^"]*"/gi,"").trim(),T=E?`<${v} ${E}>`:`<${v}>`;if(hw.has(v))return E?`<${v} ${E}>`:`<${v}>`;return`${T}${k}</${v}>`}async function Vg(v,_,k,E,T){let j=v,B=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*)>([\s\S]*?)<\/component>/gi,z=[],F;while((F=B.exec(j))!==null)z.push({full:F[0],expr:F[1],attrs:F[2],slotContent:F[3],index:F.index});for(let V=z.length-1;V>=0;V--){let U=z[V];try{let H=zg(U.expr,_);if(!H||typeof H!=="string"){let ce=`<!-- dynamic component: could not resolve "${ha(Wg(U.expr))}" -->`;j=j.slice(0,U.index)+ce+j.slice(U.index+U.full.length);continue}if(Vl.has(H)){let ce=Fg(H,U.attrs,U.slotContent);j=j.slice(0,U.index)+ce+j.slice(U.index+U.full.length);continue}let Y=U.attrs.trim(),J={},re=/(?::([a-zA-Z_][a-zA-Z0-9_-]*)|([a-zA-Z_][a-zA-Z0-9_-]*))\s*=\s*"([^"]*)"/g,se;while((se=re.exec(Y))!==null){let ce=se[1]||se[2],oe=se[3];if(se[1])try{J[ce]=l(oe,_)}catch{J[ce]=oe}else J[ce]=oe}let ie=E.componentsDir||"components",ae=await Ke(H,J,U.slotContent,ie,_,k,E,new Set,T??new Set);j=j.slice(0,U.index)+ae+j.slice(U.index+U.full.length)}catch(H){let Y=H instanceof Error?H.message:String(H),J=`<!-- dynamic component error: ${ha(Y)} -->`;j=j.slice(0,U.index)+J+j.slice(U.index+U.full.length)}}return j=await yw(j,_,k,E,T),j}async function yw(v,_,k,E,T){let j=v,B=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*?)\/>/gi,z=[],F;while((F=B.exec(j))!==null)z.push({full:F[0],expr:F[1],attrs:F[2],index:F.index});for(let V=z.length-1;V>=0;V--){let U=z[V];try{let H=zg(U.expr,_);if(!H||typeof H!=="string"){let re=`<!-- dynamic component: could not resolve "${ha(Wg(U.expr))}" -->`;j=j.slice(0,U.index)+re+j.slice(U.index+U.full.length);continue}if(Vl.has(H)){let re=Fg(H,U.attrs,"");j=j.slice(0,U.index)+re+j.slice(U.index+U.full.length);continue}let Y=E.componentsDir||"components",J=await Ke(H,{},"",Y,_,k,E,new Set,T??new Set);j=j.slice(0,U.index)+J+j.slice(U.index+U.full.length)}catch(H){let Y=H instanceof Error?H.message:String(H),J=`<!-- dynamic component error: ${ha(Y)} -->`;j=j.slice(0,U.index)+J+j.slice(U.index+U.full.length)}}return j}var hi="X-STX-Build",Ul=Symbol.for("stx.buildId");function xs(){let v=globalThis;if(!v[Ul])v[Ul]=process.env.STX_BUILD_ID||`${Date.now().toString(36)}${Math.random().toString(36).slice(2,8)}`;return v[Ul]}function Ug(v,_=xs()){if(v.includes('name="stx-build"'))return null;if(!/<head\b[^>]*>/i.test(v))return null;return`
1978
- <meta name="stx-build" content="${_}">`}function xw(v){if(typeof navigator>"u"||!("serviceWorker"in navigator)||!navigator.serviceWorker)return;let _=navigator.serviceWorker,k=window;if(k.stxOffline)return;let E=null,T=!1,j=[],B={updateReady:!1,reachable:!0,reachedAt:0,registration:()=>E,onUpdateReady(U){if(B.updateReady)try{U()}catch{}else j.push(U);return()=>{let H=j.indexOf(U);if(H!==-1)j.splice(H,1)}},applyUpdate(){let U=E&&E.waiting;if(!U)return!1;return T=!0,U.postMessage({type:"stx:activate-update",force:!0}),!0}};k.stxOffline=B;let z=(U)=>{if(!U.waiting||!_.controller||B.updateReady)return;B.updateReady=!0;let H=j.splice(0);for(let Y of H)try{Y()}catch{}try{window.dispatchEvent(new CustomEvent("stx:offline-update-ready"))}catch{}};_.addEventListener("message",(U)=>{let H=U.data||{};if(H.type==="stx:updated")try{window.dispatchEvent(new CustomEvent("stx:updated",{detail:{url:H.url,kind:H.kind,fragment:!!H.fragment}}))}catch{}if(H.type==="stx:reachability"){if(k.stxOffline.reachable=H.reachable!==!1,Number(H.at)>0)k.stxOffline.reachedAt=Number(H.at);try{window.dispatchEvent(new CustomEvent("stx:reachability",{detail:{reachable:H.reachable!==!1,at:Number(H.at)||0}}))}catch{}}}),_.addEventListener("controllerchange",()=>{if(T)T=!1,location.reload()}),document.addEventListener("visibilitychange",()=>{if(document.visibilityState==="hidden"&&E&&E.waiting)E.waiting.postMessage({type:"stx:activate-update",reason:"hidden"})});let F=()=>{_.register(v,{scope:"/"}).then((U)=>{E=U;try{_.controller?.postMessage({type:"stx:reachability?"})}catch{}if(U.waiting)z(U),U.waiting.postMessage({type:"stx:activate-update",reason:"load"});U.addEventListener("updatefound",()=>{let H=U.installing;if(!H)return;H.addEventListener("statechange",()=>{if(H.state==="installed")z(U)})})}).catch(()=>{})},V=()=>{let U=(H)=>{setTimeout(H,0)};if(typeof requestAnimationFrame==="function")requestAnimationFrame(()=>U(F));else U(F)};if(!_.controller)if(document.readyState==="complete")V();else addEventListener("load",V);else if(document.readyState==="loading")document.addEventListener("DOMContentLoaded",V);else V()}function bw(){let v=`(${xw.toString()})(${JSON.stringify("/_stx/sw.js")})`;try{return new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync(v).trim().replace(/;$/,"")}catch{return v}}var Hg=`<script data-stx-offline>${bw()}</script>`;import{AsyncLocalStorage as vw}from"async_hooks";var qg=new vw;function ln(v){return v.__stx_server_data??={pending:new Map,values:new Map}}function Kg(v,_){return qg.run(ln(v),_)}async function Xg(v,_){let k=qg.getStore();if(!k)throw Error("useServerData must run inside a <script server> render");if(typeof v!=="string"||!v.trim())throw TypeError("useServerData requires a non-empty string key");let E=k.pending.get(v);if(E)return E;let T=Promise.resolve().then(_).then((j)=>{let B=JSON.stringify(j,(F,V)=>{if(V===void 0||typeof V==="function"||typeof V==="symbol"||typeof V==="bigint"||typeof V==="number"&&!Number.isFinite(V))throw TypeError(`useServerData(${JSON.stringify(v)}) requires JSON-serializable data`);if(V&&typeof V==="object"&&!Array.isArray(V)&&Object.getPrototypeOf(V)!==Object.prototype&&Object.getPrototypeOf(V)!==null)throw TypeError(`useServerData(${JSON.stringify(v)}) requires JSON-serializable data`);return V}),z=JSON.parse(B);return k.values.set(v,z),z}).catch((j)=>{throw k.pending.delete(v),j});return k.pending.set(v,T),T}function Xn(v){let _=v.__stx_server_data;if(!_?.values.size)return"";return`<script data-stx-scoped data-stx-server-data type="application/json">${JSON.stringify(Object.fromEntries(_.values)).replace(/</g,"\\u003c").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}</script>`}import Zg from"path";function N(v,_={}){return new Cn(v,_).routes}var Gg=new Map;async function Jg(v,_){let k=v,E=_;if(!k||!E)try{let z=await o();k||=z?.pagesDir||"pages",E||=z?.root||"."}catch{k||="pages",E||="."}let T=Zg.isAbsolute(k)?k:Zg.join(E,k),j=Gg.get(T);if(j)return j;let B=[];try{B=N(".",{pagesDir:T,emit:!1}).map((z)=>z.regex.source).filter(Boolean)}catch{B=[]}return Gg.set(T,B),B}function Sw(v){return v.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function Yg(v){return Sw(JSON.stringify(v))}function le(v){return v.includes("data-stx-runtime")}function Qg(v){let _=/window\.stx\s*\.\s*[A-Za-z_$]|\}\s*=\s*window\.stx\s*;/g;for(let k=_.exec(v);k!==null;k=_.exec(v)){let E=v.slice(Math.max(0,k.index-80),k.index);if(/if\s*\(\s*window\.stx\s*\)|window\.stx\s*&&/.test(E))continue;return!0}return!1}function Hl(v,_){let k=Vi(v),E=v.search(/<!doctype\b/i);if(k!==-1&&(E===-1||k>E))return v.slice(0,k)+_+`
1977
+ @endonce`;_=_.slice(0,j.outerStart)+F+_.slice(j.outerEnd),k=j.outerStart+F.length}return _}function mw(v){return v.replace(/\bv-memo="([^"]*)"/g,'data-stx-memo="$1"')}function hw(v){return v.replace(/\bv-slot:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,'#$1="$2"').replace(/\bv-slot:([a-zA-Z_][a-zA-Z0-9_-]*)(?=[\s>])/g,"#$1").replace(/\bv-slot\s*=\s*"([^"]*)"/g,'#default="$1"')}function zg(v){if(!sw(v))return v;let _=v;return _=iw(_),_=ow(_),_=gw(_),_=lw(_),_=uw(_),_=cw(_),_=aw(_),_=hw(_),_=dw(_),_=fw(_),_=pw(_),_=mw(_),_}function ha(v){return v.replace(/--/g,"- -").replace(/</g,"&lt;").replace(/>/g,"&gt;")}var Vl=new Set(["a","abbr","address","article","aside","audio","b","bdi","bdo","blockquote","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","hr","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","meter","nav","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","small","span","strong","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","u","ul","video"]),yw=new Set(["area","base","br","col","embed","hr","img","input","link","meta","source","track","wbr"]);function Wg(v,_){let k=/^\s*\{\{\s*([\s\S]+?)\s*\}\}\s*$/.exec(v),E=k?k[1]:v,T=l(E,_);if(T&&typeof T==="string")return T;let j=E.trim();return Vl.has(j)?j:null}function Fg(v){let _=/^\s*\{\{\s*([\s\S]+?)\s*\}\}\s*$/.exec(v);return _?_[1]:v}function Vg(v,_,k){let E=_.replace(/\s*(?::is|v-bind:is)\s*=\s*"[^"]*"/gi,"").trim(),T=E?`<${v} ${E}>`:`<${v}>`;if(yw.has(v))return E?`<${v} ${E}>`:`<${v}>`;return`${T}${k}</${v}>`}async function Ug(v,_,k,E,T){let j=v,B=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*)>([\s\S]*?)<\/component>/gi,z=[],F;while((F=B.exec(j))!==null)z.push({full:F[0],expr:F[1],attrs:F[2],slotContent:F[3],index:F.index});for(let V=z.length-1;V>=0;V--){let U=z[V];try{let H=Wg(U.expr,_);if(!H||typeof H!=="string"){let ce=`<!-- dynamic component: could not resolve "${ha(Fg(U.expr))}" -->`;j=j.slice(0,U.index)+ce+j.slice(U.index+U.full.length);continue}if(Vl.has(H)){let ce=Vg(H,U.attrs,U.slotContent);j=j.slice(0,U.index)+ce+j.slice(U.index+U.full.length);continue}let Y=U.attrs.trim(),J={},re=/(?::([a-zA-Z_][a-zA-Z0-9_-]*)|([a-zA-Z_][a-zA-Z0-9_-]*))\s*=\s*"([^"]*)"/g,se;while((se=re.exec(Y))!==null){let ce=se[1]||se[2],oe=se[3];if(se[1])try{J[ce]=l(oe,_)}catch{J[ce]=oe}else J[ce]=oe}let ie=E.componentsDir||"components",ae=await Ke(H,J,U.slotContent,ie,_,k,E,new Set,T??new Set);j=j.slice(0,U.index)+ae+j.slice(U.index+U.full.length)}catch(H){let Y=H instanceof Error?H.message:String(H),J=`<!-- dynamic component error: ${ha(Y)} -->`;j=j.slice(0,U.index)+J+j.slice(U.index+U.full.length)}}return j=await xw(j,_,k,E,T),j}async function xw(v,_,k,E,T){let j=v,B=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*?)\/>/gi,z=[],F;while((F=B.exec(j))!==null)z.push({full:F[0],expr:F[1],attrs:F[2],index:F.index});for(let V=z.length-1;V>=0;V--){let U=z[V];try{let H=Wg(U.expr,_);if(!H||typeof H!=="string"){let re=`<!-- dynamic component: could not resolve "${ha(Fg(U.expr))}" -->`;j=j.slice(0,U.index)+re+j.slice(U.index+U.full.length);continue}if(Vl.has(H)){let re=Vg(H,U.attrs,"");j=j.slice(0,U.index)+re+j.slice(U.index+U.full.length);continue}let Y=E.componentsDir||"components",J=await Ke(H,{},"",Y,_,k,E,new Set,T??new Set);j=j.slice(0,U.index)+J+j.slice(U.index+U.full.length)}catch(H){let Y=H instanceof Error?H.message:String(H),J=`<!-- dynamic component error: ${ha(Y)} -->`;j=j.slice(0,U.index)+J+j.slice(U.index+U.full.length)}}return j}var hi="X-STX-Build",Ul=Symbol.for("stx.buildId");function xs(){let v=globalThis;if(!v[Ul])v[Ul]=process.env.STX_BUILD_ID||`${Date.now().toString(36)}${Math.random().toString(36).slice(2,8)}`;return v[Ul]}function Hg(v,_=xs()){if(v.includes('name="stx-build"'))return null;if(!/<head\b[^>]*>/i.test(v))return null;return`
1978
+ <meta name="stx-build" content="${_}">`}function bw(v){if(typeof navigator>"u"||!("serviceWorker"in navigator)||!navigator.serviceWorker)return;let _=navigator.serviceWorker,k=window;if(k.stxOffline)return;let E=null,T=!1,j=[],B={updateReady:!1,reachable:!0,reachedAt:0,registration:()=>E,onUpdateReady(U){if(B.updateReady)try{U()}catch{}else j.push(U);return()=>{let H=j.indexOf(U);if(H!==-1)j.splice(H,1)}},applyUpdate(){let U=E&&E.waiting;if(!U)return!1;return T=!0,U.postMessage({type:"stx:activate-update",force:!0}),!0}};k.stxOffline=B;let z=(U)=>{if(!U.waiting||!_.controller||B.updateReady)return;B.updateReady=!0;let H=j.splice(0);for(let Y of H)try{Y()}catch{}try{window.dispatchEvent(new CustomEvent("stx:offline-update-ready"))}catch{}};_.addEventListener("message",(U)=>{let H=U.data||{};if(H.type==="stx:updated")try{window.dispatchEvent(new CustomEvent("stx:updated",{detail:{url:H.url,kind:H.kind,fragment:!!H.fragment}}))}catch{}if(H.type==="stx:reachability"){if(k.stxOffline.reachable=H.reachable!==!1,Number(H.at)>0)k.stxOffline.reachedAt=Number(H.at);try{window.dispatchEvent(new CustomEvent("stx:reachability",{detail:{reachable:H.reachable!==!1,at:Number(H.at)||0}}))}catch{}}}),_.addEventListener("controllerchange",()=>{if(T)T=!1,location.reload()}),document.addEventListener("visibilitychange",()=>{if(document.visibilityState==="hidden"&&E&&E.waiting)E.waiting.postMessage({type:"stx:activate-update",reason:"hidden"})});let F=()=>{_.register(v,{scope:"/"}).then((U)=>{E=U;try{_.controller?.postMessage({type:"stx:reachability?"})}catch{}if(U.waiting)z(U),U.waiting.postMessage({type:"stx:activate-update",reason:"load"});U.addEventListener("updatefound",()=>{let H=U.installing;if(!H)return;H.addEventListener("statechange",()=>{if(H.state==="installed")z(U)})})}).catch(()=>{})},V=()=>{let U=(H)=>{setTimeout(H,0)};if(typeof requestAnimationFrame==="function")requestAnimationFrame(()=>U(F));else U(F)};if(!_.controller)if(document.readyState==="complete")V();else addEventListener("load",V);else if(document.readyState==="loading")document.addEventListener("DOMContentLoaded",V);else V()}function vw(){let v=`(${bw.toString()})(${JSON.stringify("/_stx/sw.js")})`;try{return new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync(v).trim().replace(/;$/,"")}catch{return v}}var qg=`<script data-stx-offline>${vw()}</script>`;import{AsyncLocalStorage as ww}from"async_hooks";var Kg=new ww;function ln(v){return v.__stx_server_data??={pending:new Map,values:new Map}}function Xg(v,_){return Kg.run(ln(v),_)}async function Zg(v,_){let k=Kg.getStore();if(!k)throw Error("useServerData must run inside a <script server> render");if(typeof v!=="string"||!v.trim())throw TypeError("useServerData requires a non-empty string key");let E=k.pending.get(v);if(E)return E;let T=Promise.resolve().then(_).then((j)=>{let B=JSON.stringify(j,(F,V)=>{if(V===void 0||typeof V==="function"||typeof V==="symbol"||typeof V==="bigint"||typeof V==="number"&&!Number.isFinite(V))throw TypeError(`useServerData(${JSON.stringify(v)}) requires JSON-serializable data`);if(V&&typeof V==="object"&&!Array.isArray(V)&&Object.getPrototypeOf(V)!==Object.prototype&&Object.getPrototypeOf(V)!==null)throw TypeError(`useServerData(${JSON.stringify(v)}) requires JSON-serializable data`);return V}),z=JSON.parse(B);return k.values.set(v,z),z}).catch((j)=>{throw k.pending.delete(v),j});return k.pending.set(v,T),T}function Xn(v){let _=v.__stx_server_data;if(!_?.values.size)return"";return`<script data-stx-scoped data-stx-server-data type="application/json">${JSON.stringify(Object.fromEntries(_.values)).replace(/</g,"\\u003c").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}</script>`}import Gg from"path";function N(v,_={}){return new Cn(v,_).routes}var Jg=new Map;async function Yg(v,_){let k=v,E=_;if(!k||!E)try{let z=await o();k||=z?.pagesDir||"pages",E||=z?.root||"."}catch{k||="pages",E||="."}let T=Gg.isAbsolute(k)?k:Gg.join(E,k),j=Jg.get(T);if(j)return j;let B=[];try{B=N(".",{pagesDir:T,emit:!1}).map((z)=>z.regex.source).filter(Boolean)}catch{B=[]}return Jg.set(T,B),B}function $w(v){return v.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function Qg(v){return $w(JSON.stringify(v))}function le(v){return v.includes("data-stx-runtime")}function em(v){let _=/window\.stx\s*\.\s*[A-Za-z_$]|\}\s*=\s*window\.stx\s*;/g;for(let k=_.exec(v);k!==null;k=_.exec(v)){let E=v.slice(Math.max(0,k.index-80),k.index);if(/if\s*\(\s*window\.stx\s*\)|window\.stx\s*&&/.test(E))continue;return!0}return!1}function Hl(v,_){let k=Vi(v),E=v.search(/<!doctype\b/i);if(k!==-1&&(E===-1||k>E))return v.slice(0,k)+_+`
1979
1979
  `+v.slice(k);let T=fn(v);if(T!==null)return`${v.slice(0,T)}
1980
1980
  ${_}${v.slice(T)}`;if(v.includes("</head>")){let B=v.indexOf("</head>");return v.slice(0,B)+_+`
1981
1981
  `+v.slice(B)}if(Nn(v))return zs(v,(B)=>`${B}
1982
1982
  ${_}`);return`${_}
1983
- ${v}`}async function ya(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-jj9356vp.js"),{url:j}=await T("runtime",_.debug===!0);return Hl(v,`<script data-stx-runtime src="${j}"></script>`)}if(_.buildMode==="compile")return Hl(v,'<script data-stx-runtime src="/__stx/runtime.__STX_HASH__.js"></script>');let{getCachedSignalsRuntime:k}=await import("./chunk-jj9356vp.js"),E=await k(_.debug);return Hl(v,`<script data-stx-scoped data-stx-runtime>${E}</script>`)}function $w(v){return/<[a-z][^>]*?\sx-tooltip\s*=/i.test(v)}function em(v){if(v.includes("data-stx-tooltip-runtime")||!$w(v))return v;let _=`<script data-stx-scoped data-stx-tooltip-runtime>${Rl()}</script>`,k=v.lastIndexOf("</body>");if(k===-1)return`${v}
1983
+ ${v}`}async function ya(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-96fpvzm2.js"),{url:j}=await T("runtime",_.debug===!0);return Hl(v,`<script data-stx-runtime src="${j}"></script>`)}if(_.buildMode==="compile")return Hl(v,'<script data-stx-runtime src="/__stx/runtime.__STX_HASH__.js"></script>');let{getCachedSignalsRuntime:k}=await import("./chunk-96fpvzm2.js"),E=await k(_.debug);return Hl(v,`<script data-stx-scoped data-stx-runtime>${E}</script>`)}function _w(v){return/<[a-z][^>]*?\sx-tooltip\s*=/i.test(v)}function tm(v){if(v.includes("data-stx-tooltip-runtime")||!_w(v))return v;let _=`<script data-stx-scoped data-stx-tooltip-runtime>${Rl()}</script>`,k=v.lastIndexOf("</body>");if(k===-1)return`${v}
1984
1984
  ${_}`;return`${v.slice(0,k)}${_}
1985
- ${v.slice(k)}`}var _w=/<script\b[^>]*\sdata-stx-router(?=[\s=>])/i;function kw(v){return _w.test(v)||v.includes("__stxRouter)return")||v.includes("__stxRouter=true")}async function K(v,_){if(!v.includes("</body>"))return v;if(kw(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;if(k.prefetchVisible!==void 0)F.prefetchVisible=k.prefetchVisible;if(k.prefetchVisibleMax!==void 0)F.prefetchVisibleMax=k.prefetchVisibleMax;if(k.keepOpening!==void 0)F.keepOpening=k.keepOpening}try{let V=await Jg(_?.pagesDir,_?.root);if(V.length>0)F.ownedRoutes=V}catch{}if(Object.keys(F).length>0)E=`<script>window.__stxRouterConfig=${Yg(F)};</script>
1986
- `}let{getCachedRouterScript:T,getServeClientAsset:j}=await import("./chunk-jj9356vp.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+`
1987
- </body>`+v.slice(z+7)}var ql=`(?:"[^"]*"|'[^']*'|[^>"'])*`,am=/^<([a-zA-Z][a-zA-Z0-9-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)>([\s\S]*)<\/\1>$/s,Ew=65536,Cw=4,ba=new Map;function Zd(){ba.clear()}function Rw(v){let _=[];for(let k of gr(v,Z)){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 vc(v,_={}){let k=v.length>=Ew,E=k?ba.get(v):void 0;if(E===void 0){if(E=Rw(v),k)$d(ba,Cw),ba.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 us(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}=tm(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}=tm(T);if(B)return{style:"in",iterable:j,itemVar:B,indexVar:z}}return{style:"unknown",iterable:null,itemVar:null,indexVar:null}}function tm(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 ps(v,_){return ji(v,_)}function Aw(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 cm(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 Tw(v){if(!/[:@]for\s*=/.test(v)&&!/\bx-for\s*=/.test(v))return[];let _=new RegExp(`<([a-zA-Z][\\w-]*)\\b(${ql})>`,"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=us(z?.[1]??z?.[2]??""),V=[F.itemVar,F.indexVar].filter(Boolean);if(V.length===0)continue;let U=B[1],Y=/\/\s*>$/.test(j.token)||va.has(U.toLowerCase())?j.end:Xl(v,j.start,U,j.end);if(Y!==-1)T.push({start:j.start,end:Y,vars:new Set(V)})}return T}var nm=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 Iw(v){return v.replace(/'(?:\\.|[^'\\])*'/g,"''").replace(/"(?:\\.|[^"\\])*"/g,'""').replace(/`(?:\\.|[^`\\])*`/g,"``")}function rm(v,_,k,E){if(!v)return!1;let T=Iw(v),j=!1,B=!1,z=!1,F=/([a-zA-Z_$][\w$]*)/g,V;while((V=F.exec(T))!==null){let J=V[1];if(T.slice(0,V.index).trimEnd().endsWith("."))continue;if(nm.has(J))continue;if(_.has(J)||E?.has(J))j=!0;else if(k&&J in k)B=!0}let U=/([a-zA-Z_$][\w$]*)(?:\.[a-zA-Z_$][\w$]*)*\s*\(\s*\)/g,H;while((H=U.exec(T))!==null){let J=H[1];if(T.slice(0,H.index).trimEnd().endsWith("."))continue;if(nm.has(J)||k&&J in k)continue;z=!0}return(j||z)&&!B}function xa(v,_,k){let E=k===void 0?` ${_}`:` ${_}="${k.replace(/"/g,"&quot;")}"`,T=v.trim(),j=T.match(am);if(j&&Pw(j[3],j[1])){let[,B,z,F]=j;return`<${B}${z}${E}>${F}</${B}>`}return`<template${E}>${T}</template>`}function Pw(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 ci(v,_){let k=cm(v);function E(T){let j=T,B=Tw(T),z=(H)=>{let Y=new Set;for(let J of B)if(H>J.start&&H<J.end)for(let re of J.vars)Y.add(re);return Y},F=/@if\s*\(/g,V,U=[];while((V=F.exec(j))!==null){let H=V.index,Y=H+V[0].length,J=1,re=Y;while(re<j.length&&J>0){if(j[re]==="(")J++;else if(j[re]===")")J--;re++}if(J!==0)continue;let se=j.substring(Y,re-1).trim(),ie=re,ae=1,ce=ie,oe=/@(if\s*\(|endif)/g;oe.lastIndex=ie;let pe;while((pe=oe.exec(j))!==null)if(pe[1].startsWith("if"))ae++;else if(pe[1]==="endif"){if(ae--,ae===0){ce=pe.index+pe[0].length;break}}if(ae!==0)continue;let he=j.substring(ie,ce-6).trim(),xe;if(Aw(he)){let $e=Hi(j.substring(H,ce));if($e.length===0)continue;let Re=$e[0].branches.filter((_e)=>_e.type!=="else"),Ce=z(H);if(!(Re.length>0&&Re.every((_e)=>rm(_e.condition,k,_,Ce))))continue;xe=$e[0].branches.map((_e)=>{let Pe=E(_e.content);if(_e.type==="elseif")return xa(Pe,"@else-if",_e.condition??"");if(_e.type==="else")return xa(Pe,"@else");return xa(Pe,"@if",_e.condition??"")}).join(`
1988
- `)}else{if(!rm(se,k,_,z(H)))continue;xe=xa(E(he),"@if",se)}U.push({start:H,end:ce,replacement:xe}),F.lastIndex=ce}for(let H=U.length-1;H>=0;H--){let{start:Y,end:J,replacement:re}=U[H];j=j.substring(0,Y)+re+j.substring(J)}return j}return E(v)}function Dw(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 va=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),sm=/<(script|style)\b/iy,Ow=/<\/script/gi,Mw=/<\/style/gi;function Xl(v,_,k,E){if(va.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 Y=v.indexOf("-->",z+4);if(Y===-1)return-1;z=Y+3;continue}sm.lastIndex=z;let V=sm.exec(v);if(V){let Y=v.indexOf(">",z);if(Y===-1)return-1;if(v[Y-1]==="/"){z=Y+1;continue}let J=V[1].toLowerCase()==="script"?Ow:Mw;J.lastIndex=z;let re=J.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 Y=/^<\/([a-z][\w-]*)\s*>/i.exec(v.slice(z,z+64));if(!Y){z++;continue}if(Y[1].toLowerCase()===T){if(B--,z+=Y[0].length,B===0)return z;continue}z+=Y[0].length;continue}let U=/^<([a-z][\w-]*)\b/i.exec(v.slice(z,z+64));if(!U){z++;continue}let H=v.indexOf(">",z);if(H===-1)return-1;if(U[1].toLowerCase()===T){let Y=v.slice(z,H+1);if(!(/\/\s*>$/.test(Y)||va.has(T)))B++}z=H+1}return-1}var Nw=/\s(?::else-if|x-else-if|@else-if|:else|x-else|@else)(?=[=\s/>])/;function jw(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 Nw.test(j)}function li(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=(H)=>_.some(([Y,J])=>H>=Y&&H<J),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[H,Y,J,re,se,ie,ae]=z,ce=Dw(se);if(ce===void 0)continue;let oe=z.index,pe=oe+H.length,$e=!!ae||/\/\s*>$/.test(H)||va.has(Y.toLowerCase())?pe:Xl(v,oe,Y,pe);if($e===-1)continue;if((re===":if"||re==="x-if"||re==="@if")&&jw(v,$e)){j.lastIndex=pe;continue}if(ce===!0){let Ce=`<${Y}${J}${ie}${ae}>`;B.push({start:oe,end:pe,replacement:Ce});continue}B.push({start:oe,end:$e,replacement:""}),j.lastIndex=$e}if(B.length===0)return v;B.sort((H,Y)=>H.start-Y.start);let F=[],V=-1;for(let H of B){if(H.start<V)continue;F.push(H),V=H.end}let U=v;for(let H=F.length-1;H>=0;H--){let{start:Y,end:J,replacement:re}=F[H];U=U.substring(0,Y)+re+U.substring(J)}return U}var im=[":for","@for","x-for"];function gs(v,_){if(!_||Object.keys(_).length===0)return v;if(!im.some((z)=>v.includes(`${z}=`)))return v;let k=cm(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,U=B.index,H=U+z.length,Y=im.map((xe)=>({attr:xe,m:new RegExp(`\\s${xe}="([^"]*)"`).exec(V)})).find((xe)=>xe.m!==null);if(!Y||!Y.m)continue;let J=us(Y.m[1]);if(!J.iterable||!J.itemVar)continue;let re=J.iterable.trim().split(/[.[(]/)[0].trim();if(!re||k.has(re)||!(re in _))continue;let se=Xl(E,U,F,H);if(se===-1)continue;let ie=V.replace(new RegExp(`\\s${Y.attr}="[^"]*"`),"").replace(/\s:key="[^"]*"/,"").replace(/\sx-cloak(?=\s|$)/,""),ae=E.slice(H,se-`</${F}>`.length),ce={..._,[J.itemVar]:void 0};if(J.indexVar)ce[J.indexVar]=void 0;let oe=gs(ae,ce),pe=J.indexVar?`${J.iterable} as ${J.indexVar} => ${J.itemVar}`:`${J.iterable} as ${J.itemVar}`,he=F.toLowerCase()==="template"?oe:`<${F}${ie}>${oe}</${F}>`;T.push({start:U,end:se,replacement:`@foreach(${pe})${he}@endforeach`}),j.lastIndex=se}for(let z=T.length-1;z>=0;z--){let{start:F,end:V,replacement:U}=T[z];E=E.slice(0,F)+U+E.slice(V)}return E}function ms(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,U=1,H=V;while(H<k.length&&U>0){if(k[H]==="(")U++;else if(k[H]===")")U--;H++}if(U!==0)continue;let Y=k.substring(V,H-1).trim(),J=H,re=us(Y),se=z==="for"?"@endfor":"@endforeach",ie=1,ae=J,ce=z==="for"?new RegExp("@(for(?!each)\\s*\\(|endfor(?!each))","g"):new RegExp(`@(${z}\\s*\\(|end${z})`,"g");ce.lastIndex=J;let oe;while((oe=ce.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 pe=()=>{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)){pe();continue}let Te=Ae.split(/[.[(]/)[0].trim(),_e=_?Te in _:!1,Pe=B.some((Me)=>F>Me.start&&F<Me.end&&Me.vars.includes(Te));if(Te&&(_e||Pe)){pe();continue}}if(re.style==="as")Y=re.indexVar?`(${re.itemVar}, ${re.indexVar}) in ${re.iterable}`:`${re.itemVar} in ${re.iterable}`;let he=k.substring(J,ae-se.length).trim(),xe=_?{..._}:{};if(re.itemVar)delete xe[re.itemVar];if(re.indexVar)delete xe[re.indexVar];let $e=ms(he,xe),Re=$e.match(am),Ce;if(Re){let[,Ae,Te,_e]=Re;Ce=`<${Ae}${Te} @for="${Y}">${_e}</${Ae}>`}else Ce=`<template @for="${Y}">${$e}</template>`;j.push({start:F,end:ae,replacement:Ce}),E.lastIndex=ae}for(let z=j.length-1;z>=0;z--){let{start:F,end:V,replacement:U}=j[z];k=k.substring(0,F)+U+k.substring(V)}return k}function Lw(v){let _=new Set,k=[],E=0,T=0,j=v.length,B=(U)=>{let H=E+1;while(H<j){let Y=v[H];if(Y==="\\"){H+=2;continue}if(Y===U)return H+1;H++}return j},z=()=>{let U=E+2;while(U<j&&v[U]!==`
1985
+ ${v.slice(k)}`}var kw=/<script\b[^>]*\sdata-stx-router(?=[\s=>])/i;function Ew(v){return kw.test(v)||v.includes("__stxRouter)return")||v.includes("__stxRouter=true")}async function K(v,_){if(!v.includes("</body>"))return v;if(Ew(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;if(k.prefetchVisible!==void 0)F.prefetchVisible=k.prefetchVisible;if(k.prefetchVisibleMax!==void 0)F.prefetchVisibleMax=k.prefetchVisibleMax;if(k.keepOpening!==void 0)F.keepOpening=k.keepOpening}try{let V=await Yg(_?.pagesDir,_?.root);if(V.length>0)F.ownedRoutes=V}catch{}if(Object.keys(F).length>0)E=`<script>window.__stxRouterConfig=${Qg(F)};</script>
1986
+ `}let{getCachedRouterScript:T,getServeClientAsset:j}=await import("./chunk-96fpvzm2.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+`
1987
+ </body>`+v.slice(z+7)}var ql=`(?:"[^"]*"|'[^']*'|[^>"'])*`,cm=/^<([a-zA-Z][a-zA-Z0-9-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)>([\s\S]*)<\/\1>$/s,Cw=65536,Rw=4,ba=new Map;function Zd(){ba.clear()}function Aw(v){let _=[];for(let k of gr(v,Z)){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 vc(v,_={}){let k=v.length>=Cw,E=k?ba.get(v):void 0;if(E===void 0){if(E=Aw(v),k)$d(ba,Rw),ba.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 us(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}=nm(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}=nm(T);if(B)return{style:"in",iterable:j,itemVar:B,indexVar:z}}return{style:"unknown",iterable:null,itemVar:null,indexVar:null}}function nm(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 ps(v,_){return ji(v,_)}function Tw(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 lm(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 Iw(v){if(!/[:@]for\s*=/.test(v)&&!/\bx-for\s*=/.test(v))return[];let _=new RegExp(`<([a-zA-Z][\\w-]*)\\b(${ql})>`,"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=us(z?.[1]??z?.[2]??""),V=[F.itemVar,F.indexVar].filter(Boolean);if(V.length===0)continue;let U=B[1],Y=/\/\s*>$/.test(j.token)||va.has(U.toLowerCase())?j.end:Xl(v,j.start,U,j.end);if(Y!==-1)T.push({start:j.start,end:Y,vars:new Set(V)})}return T}var rm=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 Pw(v){return v.replace(/'(?:\\.|[^'\\])*'/g,"''").replace(/"(?:\\.|[^"\\])*"/g,'""').replace(/`(?:\\.|[^`\\])*`/g,"``")}function sm(v,_,k,E){if(!v)return!1;let T=Pw(v),j=!1,B=!1,z=!1,F=/([a-zA-Z_$][\w$]*)/g,V;while((V=F.exec(T))!==null){let J=V[1];if(T.slice(0,V.index).trimEnd().endsWith("."))continue;if(rm.has(J))continue;if(_.has(J)||E?.has(J))j=!0;else if(k&&J in k)B=!0}let U=/([a-zA-Z_$][\w$]*)(?:\.[a-zA-Z_$][\w$]*)*\s*\(\s*\)/g,H;while((H=U.exec(T))!==null){let J=H[1];if(T.slice(0,H.index).trimEnd().endsWith("."))continue;if(rm.has(J)||k&&J in k)continue;z=!0}return(j||z)&&!B}function xa(v,_,k){let E=k===void 0?` ${_}`:` ${_}="${k.replace(/"/g,"&quot;")}"`,T=v.trim(),j=T.match(cm);if(j&&Dw(j[3],j[1])){let[,B,z,F]=j;return`<${B}${z}${E}>${F}</${B}>`}return`<template${E}>${T}</template>`}function Dw(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 ci(v,_){let k=lm(v);function E(T){let j=T,B=Iw(T),z=(H)=>{let Y=new Set;for(let J of B)if(H>J.start&&H<J.end)for(let re of J.vars)Y.add(re);return Y},F=/@if\s*\(/g,V,U=[];while((V=F.exec(j))!==null){let H=V.index,Y=H+V[0].length,J=1,re=Y;while(re<j.length&&J>0){if(j[re]==="(")J++;else if(j[re]===")")J--;re++}if(J!==0)continue;let se=j.substring(Y,re-1).trim(),ie=re,ae=1,ce=ie,oe=/@(if\s*\(|endif)/g;oe.lastIndex=ie;let pe;while((pe=oe.exec(j))!==null)if(pe[1].startsWith("if"))ae++;else if(pe[1]==="endif"){if(ae--,ae===0){ce=pe.index+pe[0].length;break}}if(ae!==0)continue;let he=j.substring(ie,ce-6).trim(),xe;if(Tw(he)){let $e=Hi(j.substring(H,ce));if($e.length===0)continue;let Re=$e[0].branches.filter((_e)=>_e.type!=="else"),Ce=z(H);if(!(Re.length>0&&Re.every((_e)=>sm(_e.condition,k,_,Ce))))continue;xe=$e[0].branches.map((_e)=>{let Pe=E(_e.content);if(_e.type==="elseif")return xa(Pe,"@else-if",_e.condition??"");if(_e.type==="else")return xa(Pe,"@else");return xa(Pe,"@if",_e.condition??"")}).join(`
1988
+ `)}else{if(!sm(se,k,_,z(H)))continue;xe=xa(E(he),"@if",se)}U.push({start:H,end:ce,replacement:xe}),F.lastIndex=ce}for(let H=U.length-1;H>=0;H--){let{start:Y,end:J,replacement:re}=U[H];j=j.substring(0,Y)+re+j.substring(J)}return j}return E(v)}function Mw(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 va=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),im=/<(script|style)\b/iy,Ow=/<\/script/gi,Nw=/<\/style/gi;function Xl(v,_,k,E){if(va.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 Y=v.indexOf("-->",z+4);if(Y===-1)return-1;z=Y+3;continue}im.lastIndex=z;let V=im.exec(v);if(V){let Y=v.indexOf(">",z);if(Y===-1)return-1;if(v[Y-1]==="/"){z=Y+1;continue}let J=V[1].toLowerCase()==="script"?Ow:Nw;J.lastIndex=z;let re=J.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 Y=/^<\/([a-z][\w-]*)\s*>/i.exec(v.slice(z,z+64));if(!Y){z++;continue}if(Y[1].toLowerCase()===T){if(B--,z+=Y[0].length,B===0)return z;continue}z+=Y[0].length;continue}let U=/^<([a-z][\w-]*)\b/i.exec(v.slice(z,z+64));if(!U){z++;continue}let H=v.indexOf(">",z);if(H===-1)return-1;if(U[1].toLowerCase()===T){let Y=v.slice(z,H+1);if(!(/\/\s*>$/.test(Y)||va.has(T)))B++}z=H+1}return-1}var jw=/\s(?::else-if|x-else-if|@else-if|:else|x-else|@else)(?=[=\s/>])/;function Lw(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 jw.test(j)}function li(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=(H)=>_.some(([Y,J])=>H>=Y&&H<J),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[H,Y,J,re,se,ie,ae]=z,ce=Mw(se);if(ce===void 0)continue;let oe=z.index,pe=oe+H.length,$e=!!ae||/\/\s*>$/.test(H)||va.has(Y.toLowerCase())?pe:Xl(v,oe,Y,pe);if($e===-1)continue;if((re===":if"||re==="x-if"||re==="@if")&&Lw(v,$e)){j.lastIndex=pe;continue}if(ce===!0){let Ce=`<${Y}${J}${ie}${ae}>`;B.push({start:oe,end:pe,replacement:Ce});continue}B.push({start:oe,end:$e,replacement:""}),j.lastIndex=$e}if(B.length===0)return v;B.sort((H,Y)=>H.start-Y.start);let F=[],V=-1;for(let H of B){if(H.start<V)continue;F.push(H),V=H.end}let U=v;for(let H=F.length-1;H>=0;H--){let{start:Y,end:J,replacement:re}=F[H];U=U.substring(0,Y)+re+U.substring(J)}return U}var om=[":for","@for","x-for"];function gs(v,_){if(!_||Object.keys(_).length===0)return v;if(!om.some((z)=>v.includes(`${z}=`)))return v;let k=lm(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,U=B.index,H=U+z.length,Y=om.map((xe)=>({attr:xe,m:new RegExp(`\\s${xe}="([^"]*)"`).exec(V)})).find((xe)=>xe.m!==null);if(!Y||!Y.m)continue;let J=us(Y.m[1]);if(!J.iterable||!J.itemVar)continue;let re=J.iterable.trim().split(/[.[(]/)[0].trim();if(!re||k.has(re)||!(re in _))continue;let se=Xl(E,U,F,H);if(se===-1)continue;let ie=V.replace(new RegExp(`\\s${Y.attr}="[^"]*"`),"").replace(/\s:key="[^"]*"/,"").replace(/\sx-cloak(?=\s|$)/,""),ae=E.slice(H,se-`</${F}>`.length),ce={..._,[J.itemVar]:void 0};if(J.indexVar)ce[J.indexVar]=void 0;let oe=gs(ae,ce),pe=J.indexVar?`${J.iterable} as ${J.indexVar} => ${J.itemVar}`:`${J.iterable} as ${J.itemVar}`,he=F.toLowerCase()==="template"?oe:`<${F}${ie}>${oe}</${F}>`;T.push({start:U,end:se,replacement:`@foreach(${pe})${he}@endforeach`}),j.lastIndex=se}for(let z=T.length-1;z>=0;z--){let{start:F,end:V,replacement:U}=T[z];E=E.slice(0,F)+U+E.slice(V)}return E}function ms(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,U=1,H=V;while(H<k.length&&U>0){if(k[H]==="(")U++;else if(k[H]===")")U--;H++}if(U!==0)continue;let Y=k.substring(V,H-1).trim(),J=H,re=us(Y),se=z==="for"?"@endfor":"@endforeach",ie=1,ae=J,ce=z==="for"?new RegExp("@(for(?!each)\\s*\\(|endfor(?!each))","g"):new RegExp(`@(${z}\\s*\\(|end${z})`,"g");ce.lastIndex=J;let oe;while((oe=ce.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 pe=()=>{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)){pe();continue}let Te=Ae.split(/[.[(]/)[0].trim(),_e=_?Te in _:!1,Pe=B.some((Oe)=>F>Oe.start&&F<Oe.end&&Oe.vars.includes(Te));if(Te&&(_e||Pe)){pe();continue}}if(re.style==="as")Y=re.indexVar?`(${re.itemVar}, ${re.indexVar}) in ${re.iterable}`:`${re.itemVar} in ${re.iterable}`;let he=k.substring(J,ae-se.length).trim(),xe=_?{..._}:{};if(re.itemVar)delete xe[re.itemVar];if(re.indexVar)delete xe[re.indexVar];let $e=ms(he,xe),Re=$e.match(cm),Ce;if(Re){let[,Ae,Te,_e]=Re;Ce=`<${Ae}${Te} @for="${Y}">${_e}</${Ae}>`}else Ce=`<template @for="${Y}">${$e}</template>`;j.push({start:F,end:ae,replacement:Ce}),E.lastIndex=ae}for(let z=j.length-1;z>=0;z--){let{start:F,end:V,replacement:U}=j[z];k=k.substring(0,F)+U+k.substring(V)}return k}function Bw(v){let _=new Set,k=[],E=0,T=0,j=v.length,B=(U)=>{let H=E+1;while(H<j){let Y=v[H];if(Y==="\\"){H+=2;continue}if(Y===U)return H+1;H++}return j},z=()=>{let U=E+2;while(U<j&&v[U]!==`
1989
1989
  `)U++;return U},F=()=>{let U=E+2;while(U<j-1){if(v[U]==="*"&&v[U+1]==="/")return U+2;U++}return j},V=(U)=>{let H=U,Y=0;while(H<j){let J=v[H];if(J==="/"&&v[H+1]==="/"){let re=H+2;while(re<j&&v[re]!==`
1990
- `)re++;H=re;continue}if(J==="/"&&v[H+1]==="*"){let re=H+2;while(re<j-1&&!(v[re]==="*"&&v[re+1]==="/"))re++;H=re+2;continue}if(J==='"'||J==="'"||J==="`"){let re=H+1;while(re<j){if(v[re]==="\\"){re+=2;continue}if(v[re]===J){re++;break}re++}H=re;continue}if(J==="("||J==="["||J==="{"){Y++,H++;continue}if(J===")"||J==="]"||J==="}"){Y--,H++;continue}if(J===";"&&Y===0)return H+1;H++}return j};while(E<j){let U=v[E];if(U==="/"&&v[E+1]==="/"){let H=z();k.push(v.slice(E,H)),E=H;continue}if(U==="/"&&v[E+1]==="*"){let H=F();k.push(v.slice(E,H)),E=H;continue}if(U==='"'||U==="'"||U==="`"){let H=B(U);k.push(v.slice(E,H)),E=H;continue}if(U==="{"){T++,k.push(U),E++;continue}if(U==="}"){T--,k.push(U),E++;continue}if(T===0){let H=E>0?v[E-1]:"";if(H===""||/\s/.test(H)||H===";"||H==="}"||H==="{"){let J=v.slice(E).match(/^(const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=/);if(J){let re=J[2],se=V(E+J[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(U),E++}return k.join("")}var Bw=new Set(["script","style","html","head","meta","link","title","!doctype"]);function Kl(v,_,k){for(let E of k){if(E.start>=_)return!1;if(E.end>v)return!0}return!1}function zw(v,_,k){let E=0;while(E<v.length){let T=v.indexOf(_,E);if(T===-1)return!1;if(!Kl(T,T+_.length,k))return!0;E=T+_.length}return!1}function Ww(v,_){if(zw(v,"<body",_)){let T=new RegExp(`<body(${ql})>`,"g"),j;while((j=T.exec(v))!==null)if(!Kl(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(${ql})>`,"gi"),E;while((E=k.exec(v))!==null){if(Kl(E.index,E.index+E[0].length,_))continue;if(Bw.has(E[1].toLowerCase()))continue;return E.index+E[0].length-1}return null}function Fw(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 Kn(v,_,k,E={}){let T=vc(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 gt("stx/client-script-bundler",()=>import("./chunk-a2c6t7w2.js"));for(let oe of T){let pe=oe.body;if(qe(oe.attrs))pe=Ge(pe);if(E.forceClientSetup||j.test(pe)){B.push({content:pe,start:oe.start,end:oe.end});continue}if(!z(pe))continue;try{let he=await F(St(pe).code,_||"",{projectRoot:process.cwd(),externalizeUserModules:!1});if(j.test(he))B.push({content:pe,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")}`,U=`__stx_setup_${Bun.hash(V).toString(36).slice(0,10)}`,H=[];for(let oe=0;oe<B.length;oe++){let pe=B[oe].bundled??St(B[oe].content).code;if(!B[oe].bundled&&z(pe))pe=await F(pe,_||"",{projectRoot:process.cwd(),externalizeUserModules:E.forceClientSetup?!1:void 0});pe=We(pe);let he=I(pe);H.push(`// \u2500\u2500 merged signal script #${oe+1} \u2500\u2500
1990
+ `)re++;H=re;continue}if(J==="/"&&v[H+1]==="*"){let re=H+2;while(re<j-1&&!(v[re]==="*"&&v[re+1]==="/"))re++;H=re+2;continue}if(J==='"'||J==="'"||J==="`"){let re=H+1;while(re<j){if(v[re]==="\\"){re+=2;continue}if(v[re]===J){re++;break}re++}H=re;continue}if(J==="("||J==="["||J==="{"){Y++,H++;continue}if(J===")"||J==="]"||J==="}"){Y--,H++;continue}if(J===";"&&Y===0)return H+1;H++}return j};while(E<j){let U=v[E];if(U==="/"&&v[E+1]==="/"){let H=z();k.push(v.slice(E,H)),E=H;continue}if(U==="/"&&v[E+1]==="*"){let H=F();k.push(v.slice(E,H)),E=H;continue}if(U==='"'||U==="'"||U==="`"){let H=B(U);k.push(v.slice(E,H)),E=H;continue}if(U==="{"){T++,k.push(U),E++;continue}if(U==="}"){T--,k.push(U),E++;continue}if(T===0){let H=E>0?v[E-1]:"";if(H===""||/\s/.test(H)||H===";"||H==="}"||H==="{"){let J=v.slice(E).match(/^(const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=/);if(J){let re=J[2],se=V(E+J[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(U),E++}return k.join("")}var zw=new Set(["script","style","html","head","meta","link","title","!doctype"]);function Kl(v,_,k){for(let E of k){if(E.start>=_)return!1;if(E.end>v)return!0}return!1}function Ww(v,_,k){let E=0;while(E<v.length){let T=v.indexOf(_,E);if(T===-1)return!1;if(!Kl(T,T+_.length,k))return!0;E=T+_.length}return!1}function Fw(v,_){if(Ww(v,"<body",_)){let T=new RegExp(`<body(${ql})>`,"g"),j;while((j=T.exec(v))!==null)if(!Kl(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(${ql})>`,"gi"),E;while((E=k.exec(v))!==null){if(Kl(E.index,E.index+E[0].length,_))continue;if(zw.has(E[1].toLowerCase()))continue;return E.index+E[0].length-1}return null}function Vw(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 Kn(v,_,k,E={}){let T=vc(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 gt("stx/client-script-bundler",()=>import("./chunk-x0fhwxhv.js"));for(let oe of T){let pe=oe.body;if(qe(oe.attrs))pe=Ge(pe);if(E.forceClientSetup||j.test(pe)){B.push({content:pe,start:oe.start,end:oe.end});continue}if(!z(pe))continue;try{let he=await F(St(pe).code,_||"",{projectRoot:process.cwd(),externalizeUserModules:!1});if(j.test(he))B.push({content:pe,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")}`,U=`__stx_setup_${Bun.hash(V).toString(36).slice(0,10)}`,H=[];for(let oe=0;oe<B.length;oe++){let pe=B[oe].bundled??St(B[oe].content).code;if(!B[oe].bundled&&z(pe))pe=await F(pe,_||"",{projectRoot:process.cwd(),externalizeUserModules:E.forceClientSetup?!1:void 0});pe=We(pe);let he=I(pe);H.push(`// \u2500\u2500 merged signal script #${oe+1} \u2500\u2500
1991
1991
  ${he}`)}let Y=H.join(`
1992
1992
 
1993
- `);Y=Lw(Y);let J=xc(Y),re=J.split(",").map((oe)=>oe.trim()).filter(Boolean),se=ts(Y,k),ie=`
1993
+ `);Y=Bw(Y);let J=xc(Y),re=J.split(",").map((oe)=>oe.trim()).filter(Boolean),se=ts(Y,k),ie=`
1994
1994
  <script data-stx-scoped>
1995
1995
  function ${U}() {
1996
1996
  ${Ot("const",re)}
@@ -1999,53 +1999,53 @@ ${Kr(`${se}${Y}`)}
1999
1999
  }
2000
2000
  window.__stx_latestSetup=${U};
2001
2001
  if(window.stx)window.stx._latestSetup=${U};
2002
- </script>`,ae=Ww(v,B);return{output:Fw(v,B,ae,U),setupCode:ie}}function xc(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===`
2002
+ </script>`,ae=Fw(v,B);return{output:Vw(v,B,ae,U),setupCode:ie}}function xc(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===`
2003
2003
  `)return;j++}},V=()=>{if(!z)return!0;if(/[\w)\]]/.test(z))return!1;return!0},U=(re)=>{j++;while(j<B){if(_[j]==="\\"){j+=2;continue}if(_[j]===re){j++;return}j++}},H=()=>{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]==='"')U(_[j]);else if(_[j]==="`")H();else j++;continue}j++}},Y=()=>{if(_[j]==="/"&&_[j+1]==="/"){while(j<B&&_[j]!==`
2004
2004
  `)j++;return!0}if(_[j]==="/"&&_[j+1]==="*"){j+=2;while(j<B-1&&!(_[j]==="*"&&_[j+1]==="/"))j++;return j+=2,!0}return!1},J=()=>{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 pe=oe.trim();if(!pe)return;let he=pe.indexOf(":"),$e=(he>=0?pe.slice(he+1).trim():pe).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 pe=oe.trim().replace(/^\.\.\./,"");if(!pe)return;let he=pe.split(/[\s=]/)[0];if(he&&!E.has(he))k.push(he),E.add(he)});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 ce=_.slice(j).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(ce){let oe=ce[1];if(!E.has(oe))k.push(oe),E.add(oe)}};while(j<B){if(Y())continue;if(_[j]==="'"||_[j]==='"'){U(_[j]),z=_[j-1];continue}if(_[j]==="`"){H(),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])))J();if(!/\s/.test(_[j]))z=_[j];j++}return k.join(", ")}async function di(v,_,k,E){if(!ps(v,k))return v;let T=v;if(_.skipSignalsRuntime)return T;let{output:j,setupCode:B}=await Kn(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 ya(T,_),B){let z=ui(T,/<\/head>/i),F=z===-1?ui(T,/<body[^>]*>/i):-1;if(z!==-1)T=`${T.slice(0,z)}${B}
2005
2005
  ${T.slice(z)}`;else if(F!==-1){let V=/<body[^>]*>/i.exec(T.slice(F))[0],U=F+V.length;T=`${T.slice(0,U)}
2006
2006
  ${B}${T.slice(U)}`}else T=`${T}
2007
- ${B}`}return T}function ui(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(([U,H])=>F>=U&&F<H))return F;B=F+Math.max(z[0].length,1)}return-1}var om="/* [stx import stripped, resolved via window.stx in __stx_setup] */";function Sc(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 om;return`var ${_.join(", ")}; ${om}`}var Vw=/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"](?:stx|@stacksjs\/stx|@stacksjs\/browser)['"]\s*;?\s*$/gm;function We(v){return v.replace(Vw,(_,k)=>Sc(k))}import Zs from"path";import Uw from"process";function w(v="STX_PUBLIC_"){let _={},k={};for(let[E,T]of Object.entries(Uw.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 lm(v){return v.startsWith("http://")||v.startsWith("https://")||v.startsWith("//")}async function um(v,_,k){try{let E;if(v.startsWith("/")){let T=_;for(let j=0;j<5;j++){let B=Zs.join(T,v);if(await Bun.file(B).exists())return B;T=Zs.dirname(T)}E=Zs.join(_,v)}else if(v.startsWith("./")||v.startsWith("../"))E=Zs.resolve(_,v);else E=Zs.resolve(_,v);if(await Bun.file(E).exists())return E;return null}catch{return null}}var dm=Symbol.for("stx.inline-assets.import-meta");function Hw(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.
2008
- `+" `import.meta.env.STX_PUBLIC_*` is substituted at build time and is safe; anything else is not.\n Fix it by moving the module-only code (`import.meta.glob`, `import.meta.url`) into its own module, or by resolving the value without `import.meta`.");throw k[dm]=!0,k}async function fm(v,_,k){let E=v,T=Zs.dirname(_),j=/<script\b([^>]*)src=["']([^"']+)["']([^>]*)><\/script>/gi,B;while((B=j.exec(E))!==null){let[V,U,H,Y]=B;if(lm(H))continue;let J=await um(H,T,_);if(J)try{let re=await Bun.file(J).text();if(k.add(J),H.endsWith(".ts")||H.endsWith(".tsx")){let ie=await Bun.build({entrypoints:[J],target:"browser",minify:!0,define:w()});if(ie.outputs.length>0)re=await ie.outputs[0].text(),Hw(re,H)}let se=`<script>
2007
+ ${B}`}return T}function ui(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(([U,H])=>F>=U&&F<H))return F;B=F+Math.max(z[0].length,1)}return-1}var am="/* [stx import stripped, resolved via window.stx in __stx_setup] */";function Sc(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 am;return`var ${_.join(", ")}; ${am}`}var Uw=/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"](?:stx|@stacksjs\/stx|@stacksjs\/browser)['"]\s*;?\s*$/gm;function We(v){return v.replace(Uw,(_,k)=>Sc(k))}import Zs from"path";import Hw from"process";function w(v="STX_PUBLIC_"){let _={},k={};for(let[E,T]of Object.entries(Hw.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 um(v){return v.startsWith("http://")||v.startsWith("https://")||v.startsWith("//")}async function dm(v,_,k){try{let E;if(v.startsWith("/")){let T=_;for(let j=0;j<5;j++){let B=Zs.join(T,v);if(await Bun.file(B).exists())return B;T=Zs.dirname(T)}E=Zs.join(_,v)}else if(v.startsWith("./")||v.startsWith("../"))E=Zs.resolve(_,v);else E=Zs.resolve(_,v);if(await Bun.file(E).exists())return E;return null}catch{return null}}var fm=Symbol.for("stx.inline-assets.import-meta");function qw(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.
2008
+ `+" `import.meta.env.STX_PUBLIC_*` is substituted at build time and is safe; anything else is not.\n Fix it by moving the module-only code (`import.meta.glob`, `import.meta.url`) into its own module, or by resolving the value without `import.meta`.");throw k[fm]=!0,k}async function pm(v,_,k){let E=v,T=Zs.dirname(_),j=/<script\b([^>]*)src=["']([^"']+)["']([^>]*)><\/script>/gi,B;while((B=j.exec(E))!==null){let[V,U,H,Y]=B;if(um(H))continue;let J=await dm(H,T,_);if(J)try{let re=await Bun.file(J).text();if(k.add(J),H.endsWith(".ts")||H.endsWith(".tsx")){let ie=await Bun.build({entrypoints:[J],target:"browser",minify:!0,define:w()});if(ie.outputs.length>0)re=await ie.outputs[0].text(),qw(re,H)}let se=`<script>
2009
2009
  // Source: ${H}
2010
2010
  ${re}
2011
- </script>`;E=E.replace(V,se),j.lastIndex=0}catch(re){if(re?.[dm])throw re}}let z=/<link\b([^>]*)href=["']([^"']+)["']([^>]*)(?:\/?>)/gi,F;while((F=z.exec(E))!==null){let[V,U,H,Y]=F,J=U+Y;if(lm(H))continue;if(/rel=["']stylesheet["']/.test(J)||H.endsWith(".css")){let se=await um(H,T,_);if(se)try{let ie=await Bun.file(se).text();k.add(se);let ae=`<style>
2011
+ </script>`;E=E.replace(V,se),j.lastIndex=0}catch(re){if(re?.[fm])throw re}}let z=/<link\b([^>]*)href=["']([^"']+)["']([^>]*)(?:\/?>)/gi,F;while((F=z.exec(E))!==null){let[V,U,H,Y]=F,J=U+Y;if(um(H))continue;if(/rel=["']stylesheet["']/.test(J)||H.endsWith(".css")){let se=await dm(H,T,_);if(se)try{let ie=await Bun.file(se).text();k.add(se);let ae=`<style>
2012
2012
  /* Source: ${H} */
2013
2013
  ${ie}
2014
- </style>`;E=E.replace(V,ae),z.lastIndex=0}catch(ie){}}}return E}function Ss(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,U=!1;while(F<k.length&&z>0){let oe=k[F];if(U){U=!1,F++;continue}if(oe==="\\"&&V){U=!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 H=k.substring(B+1,F).trim(),Y=k.substring(j,F+1),J=-1,re=0,se=null,ie=!1;for(let oe=0;oe<H.length;oe++){let pe=H[oe];if(ie){ie=!1;continue}if(pe==="\\"&&se){ie=!0;continue}if(se){if(pe===se)se=null;continue}if(pe==='"'||pe==="'"||pe==="`"){se=pe;continue}if(pe==="("||pe==="["||pe==="{")re++;else if(pe===")"||pe==="]"||pe==="}")re--;if(pe===","&&re===0){J=oe;break}}let ae=J>=0?H.substring(0,J).trim():H,ce=J>=0?H.substring(J+1).trim():void 0;try{let oe=ae.trim(),pe;if(p(oe))pe=c(oe,Object.keys(_))(...Object.values(_));else pe=void 0;let he;if(ce==="true")he=JSON.stringify(pe,null,2);else he=JSON.stringify(pe);let xe=he.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029");k=k.substring(0,j)+xe+k.substring(F+1),E.lastIndex=j+xe.length}catch(oe){P.log(oe instanceof Error?oe:Error(String(oe)),{directive:"@json"},"error"),E.lastIndex=j+Y.length}}return k}function ks(v){return v.replace(/@once\s*([\s\S]*?)@endonce/g,"$1")}function hm(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(),U=F,H=_.slice(U),Y=H.indexOf("@endmemo");if(Y===-1)continue;let J=H.slice(0,Y),re=U+Y+8,se=J.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)/),ie=se?se[0].length:0,ae=J.slice(ie),ce=J.match(/(\s*)$/),oe=ce?ce[0].length:0,pe=ae.slice(0,ae.length-oe),he=pe.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)?(\/?)>/),xe;if(he){let[$e,Re,Ce="",Ae]=he,Te=`<${Re}${Ce} data-stx-memo="${V}"${Ae}>`;xe=J.slice(0,ie)+Te+pe.slice($e.length)+J.slice(ie+pe.length)}else xe=`${J.slice(0,ie)}<div data-stx-memo="${V}">${pe}</div>${J.slice(ie+pe.length)}`;T.push({start:j,end:re,replacement:xe}),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 Zl(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 ym(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 U=k.exec(F);if(!U||/^(?:script|style)$/i.test(U[1]))return-1;return k.lastIndex}),T=[],j=0,B=0,z=[];for(let{start:F,end:V,token:U}of E){let H=/^<\/?([\w-]+)/.exec(U)[1].toLowerCase();if(U.startsWith("</")){let J;while(J=T.pop()){if(J.scoped)j--;if(J.name===H)break}continue}let Y=/\sdata-stx-scope\s*=/.test(U);if(!j&&!Y&&/\s(?:ref|@ref|:ref|x-ref|data-stx-ref)\s*=/.test(U)&&!/\sdata-stx-ref-caller\s*=/.test(U))z.push(v.slice(B,F),U.replace(/\s*\/?>$/,(J)=>` data-stx-ref-caller="${_}"${J}`)),B=V;if(!xm.has(H)&&!/\/>$/.test(U)){if(T.push({name:H,scoped:Y}),Y)j++}}return z.push(v.slice(B)),z.join("")}var xm=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),bm=/(?:^|\s)x-no-cloak(?:=|\s|\/|>|$)/,pm=/<\/?\s*([a-z][\w-]*)/iy,qw=/\s/;function Kw(v,_){let k=_-1;while(k>=0&&qw.test(v[k]))k--;return k>=0&&v[k]==="/"}function Xw(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 Zw(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 H=v.indexOf(j?"}":"{",E);if(H===-1||H>=F){if(j)B=!1;else T=!1;break}if(H>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=H+1}E=F;continue}if(v.startsWith("<!--",E)){let H=v.indexOf("-->",E);E=H===-1?v.length:H+3;continue}let V=Xw(v,E);if(V===-1)break;pm.lastIndex=E;let U=pm.exec(v)?.[1]?.toLowerCase()??"";if(v[E+1]==="/"){if(k===0)break;k--}else if(!Kw(v,V)&&!xm.has(U))k++;E=V+1}return!1}var gm=m(256);function vm(v){if(v.length<1024)return mm(v);let _=h(v),k=gm.get(_);if(k!==void 0)return k;let E=mm(v);return gm.set(_,E),E}function mm(v){if(v.length>=32768&&!Sd(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,U=-1;while(z<v.length){let Y=v[z];if(F){if(Y==="'")F=!1}else if(V){if(Y==='"')V=!1}else if(Y==="'")F=!0;else if(Y==='"')V=!0;else if(Y===">"){U=z;break}z++}if(U===-1)continue;let H=v.slice(B,U+1);if(bm.test(H))continue;if(H.includes("x-cloak"))continue;if(Zw(v,U+1))E+=v.slice(T,U)+" x-cloak>",T=U+1}return E+=v.slice(T),E}var Gw=/(?:^|\s)(?::else-if|:if|:else|:show|x-else-if|x-if|x-else|x-show|@if|@show)(?:=|\s|\/|>|$)/,Jw=/<\/script>/gi,Yw=/<\/style>/gi;function wm(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"?Jw:Yw;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,U=-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===">"){U=z;break}z++}if(U===-1)continue;let H=v.slice(j+T[0].length,U);if(bm.test(H))continue;if(/(?:^|\s)x-cloak(?:=|\s|\/|>|$)/.test(H))continue;if(!Gw.test(H))continue;let Y=v[U-1]==="/",J=Y?U-1:U;k+=`${v.slice(E,J)} x-cloak${Y?" ":""}`,E=J}return k+=v.slice(E),k}var Gl=m(256),Qw=[{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"}],Sm=/(?:\/\/|\/\*|\{\{--)\s*stx-strict-ignore(-next-line)?([^\n*}]*)/g;function eS(v){let _=Array.from(v,(T)=>T===`
2014
+ </style>`;E=E.replace(V,ae),z.lastIndex=0}catch(ie){}}}return E}function Ss(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,U=!1;while(F<k.length&&z>0){let oe=k[F];if(U){U=!1,F++;continue}if(oe==="\\"&&V){U=!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 H=k.substring(B+1,F).trim(),Y=k.substring(j,F+1),J=-1,re=0,se=null,ie=!1;for(let oe=0;oe<H.length;oe++){let pe=H[oe];if(ie){ie=!1;continue}if(pe==="\\"&&se){ie=!0;continue}if(se){if(pe===se)se=null;continue}if(pe==='"'||pe==="'"||pe==="`"){se=pe;continue}if(pe==="("||pe==="["||pe==="{")re++;else if(pe===")"||pe==="]"||pe==="}")re--;if(pe===","&&re===0){J=oe;break}}let ae=J>=0?H.substring(0,J).trim():H,ce=J>=0?H.substring(J+1).trim():void 0;try{let oe=ae.trim(),pe;if(p(oe))pe=c(oe,Object.keys(_))(...Object.values(_));else pe=void 0;let he;if(ce==="true")he=JSON.stringify(pe,null,2);else he=JSON.stringify(pe);let xe=he.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029");k=k.substring(0,j)+xe+k.substring(F+1),E.lastIndex=j+xe.length}catch(oe){P.log(oe instanceof Error?oe:Error(String(oe)),{directive:"@json"},"error"),E.lastIndex=j+Y.length}}return k}function ks(v){return v.replace(/@once\s*([\s\S]*?)@endonce/g,"$1")}function ym(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(),U=F,H=_.slice(U),Y=H.indexOf("@endmemo");if(Y===-1)continue;let J=H.slice(0,Y),re=U+Y+8,se=J.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)/),ie=se?se[0].length:0,ae=J.slice(ie),ce=J.match(/(\s*)$/),oe=ce?ce[0].length:0,pe=ae.slice(0,ae.length-oe),he=pe.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)?(\/?)>/),xe;if(he){let[$e,Re,Ce="",Ae]=he,Te=`<${Re}${Ce} data-stx-memo="${V}"${Ae}>`;xe=J.slice(0,ie)+Te+pe.slice($e.length)+J.slice(ie+pe.length)}else xe=`${J.slice(0,ie)}<div data-stx-memo="${V}">${pe}</div>${J.slice(ie+pe.length)}`;T.push({start:j,end:re,replacement:xe}),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 Zl(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 xm(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 U=k.exec(F);if(!U||/^(?:script|style)$/i.test(U[1]))return-1;return k.lastIndex}),T=[],j=0,B=0,z=[];for(let{start:F,end:V,token:U}of E){let H=/^<\/?([\w-]+)/.exec(U)[1].toLowerCase();if(U.startsWith("</")){let J;while(J=T.pop()){if(J.scoped)j--;if(J.name===H)break}continue}let Y=/\sdata-stx-scope\s*=/.test(U);if(!j&&!Y&&/\s(?:ref|@ref|:ref|x-ref|data-stx-ref)\s*=/.test(U)&&!/\sdata-stx-ref-caller\s*=/.test(U))z.push(v.slice(B,F),U.replace(/\s*\/?>$/,(J)=>` data-stx-ref-caller="${_}"${J}`)),B=V;if(!bm.has(H)&&!/\/>$/.test(U)){if(T.push({name:H,scoped:Y}),Y)j++}}return z.push(v.slice(B)),z.join("")}var bm=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),vm=/(?:^|\s)x-no-cloak(?:=|\s|\/|>|$)/,gm=/<\/?\s*([a-z][\w-]*)/iy,Kw=/\s/;function Xw(v,_){let k=_-1;while(k>=0&&Kw.test(v[k]))k--;return k>=0&&v[k]==="/"}function Zw(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 Gw(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 H=v.indexOf(j?"}":"{",E);if(H===-1||H>=F){if(j)B=!1;else T=!1;break}if(H>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=H+1}E=F;continue}if(v.startsWith("<!--",E)){let H=v.indexOf("-->",E);E=H===-1?v.length:H+3;continue}let V=Zw(v,E);if(V===-1)break;gm.lastIndex=E;let U=gm.exec(v)?.[1]?.toLowerCase()??"";if(v[E+1]==="/"){if(k===0)break;k--}else if(!Xw(v,V)&&!bm.has(U))k++;E=V+1}return!1}var mm=m(256);function wm(v){if(v.length<1024)return hm(v);let _=h(v),k=mm.get(_);if(k!==void 0)return k;let E=hm(v);return mm.set(_,E),E}function hm(v){if(v.length>=32768&&!Sd(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,U=-1;while(z<v.length){let Y=v[z];if(F){if(Y==="'")F=!1}else if(V){if(Y==='"')V=!1}else if(Y==="'")F=!0;else if(Y==='"')V=!0;else if(Y===">"){U=z;break}z++}if(U===-1)continue;let H=v.slice(B,U+1);if(vm.test(H))continue;if(H.includes("x-cloak"))continue;if(Gw(v,U+1))E+=v.slice(T,U)+" x-cloak>",T=U+1}return E+=v.slice(T),E}var Jw=/(?:^|\s)(?::else-if|:if|:else|:show|x-else-if|x-if|x-else|x-show|@if|@show)(?:=|\s|\/|>|$)/,Yw=/<\/script>/gi,Qw=/<\/style>/gi;function Sm(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"?Yw:Qw;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,U=-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===">"){U=z;break}z++}if(U===-1)continue;let H=v.slice(j+T[0].length,U);if(vm.test(H))continue;if(/(?:^|\s)x-cloak(?:=|\s|\/|>|$)/.test(H))continue;if(!Jw.test(H))continue;let Y=v[U-1]==="/",J=Y?U-1:U;k+=`${v.slice(E,J)} x-cloak${Y?" ":""}`,E=J}return k+=v.slice(E),k}var Gl=m(256),eS=[{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"}],$m=/(?:\/\/|\/\*|\{\{--)\s*stx-strict-ignore(-next-line)?([^\n*}]*)/g;function tS(v){let _=Array.from(v,(T)=>T===`
2015
2015
  `?`
2016
2016
  `:" "),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]!==`
2017
- `)_[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 tS(v){let _=new Map,k=eS(v).split(`
2017
+ `)_[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 nS(v){let _=new Map,k=tS(v).split(`
2018
2018
  `),E=v.split(`
2019
- `);return k.forEach((T,j)=>{Sm.lastIndex=0;for(let B of T.matchAll(Sm)){let z=B[1]==="-next-line",F=(E[j]??"").slice(0,B.index).trim(),V=z||F===""?j+2:j+1,H=(B[2]??"").split("--")[0].split(/[\s,]+/).filter(Boolean),Y=H.filter((re)=>/\w/.test(re));if(H.length>0&&Y.length===0)continue;let J=_.get(V);if(J&&J.size===0)continue;if(Y.length===0){_.set(V,new Set);continue}if(J)Y.forEach((re)=>J.add(re));else _.set(V,new Set(Y))}}),_}function nS(v,_,k){let E=v.get(_);if(!E)return!1;if(E.size===0)return!0;return[...E].some((T)=>k.includes(T))}function Cs(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=Gl.get(j);if(B!==void 0){if(B&&T.failOnViolation)throw Error(B);return}let z=T.allowPatterns??[],F=tS(v),V=[],U=s(v.replace(/\{\{--[\s\S]*?--\}\}/g,(re)=>re.replace(/[^\n]/g," ")));for(let{pattern:re,message:se,suggestion:ie}of Qw){if(z.some((ce)=>/\w/.test(ce)&&se.includes(ce)))continue;re.lastIndex=0;let ae=U.match(re);if(ae&&ae.length>0){let ce=U.split(`
2019
+ `);return k.forEach((T,j)=>{$m.lastIndex=0;for(let B of T.matchAll($m)){let z=B[1]==="-next-line",F=(E[j]??"").slice(0,B.index).trim(),V=z||F===""?j+2:j+1,H=(B[2]??"").split("--")[0].split(/[\s,]+/).filter(Boolean),Y=H.filter((re)=>/\w/.test(re));if(H.length>0&&Y.length===0)continue;let J=_.get(V);if(J&&J.size===0)continue;if(Y.length===0){_.set(V,new Set);continue}if(J)Y.forEach((re)=>J.add(re));else _.set(V,new Set(Y))}}),_}function rS(v,_,k){let E=v.get(_);if(!E)return!1;if(E.size===0)return!0;return[...E].some((T)=>k.includes(T))}function Cs(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=Gl.get(j);if(B!==void 0){if(B&&T.failOnViolation)throw Error(B);return}let z=T.allowPatterns??[],F=nS(v),V=[],U=s(v.replace(/\{\{--[\s\S]*?--\}\}/g,(re)=>re.replace(/[^\n]/g," ")));for(let{pattern:re,message:se,suggestion:ie}of eS){if(z.some((ce)=>/\w/.test(ce)&&se.includes(ce)))continue;re.lastIndex=0;let ae=U.match(re);if(ae&&ae.length>0){let ce=U.split(`
2020
2020
  `),oe=v.split(`
2021
- `),pe=[];if(ce.forEach((Re,Ce)=>{if(re.lastIndex=0,re.test(Re)&&!nS(F,Ce+1,se))pe.push(Ce+1)}),pe.length===0&&ce.some((Re)=>(re.lastIndex=0,re.test(Re))))continue;let he=pe.length>0?` (script line${pe.length>1?"s":""} ${pe.join(", ")})`:"",xe=pe.slice(0,3).map((Re)=>` ${Re} | ${(oe[Re-1]??"").trim().slice(0,100)}`).join(`
2021
+ `),pe=[];if(ce.forEach((Re,Ce)=>{if(re.lastIndex=0,re.test(Re)&&!rS(F,Ce+1,se))pe.push(Ce+1)}),pe.length===0&&ce.some((Re)=>(re.lastIndex=0,re.test(Re))))continue;let he=pe.length>0?` (script line${pe.length>1?"s":""} ${pe.join(", ")})`:"",xe=pe.slice(0,3).map((Re)=>` ${Re} | ${(oe[Re-1]??"").trim().slice(0,100)}`).join(`
2022
2022
  `),$e=xe?`
2023
2023
  ${xe}`:"";V.push(` \u2717 ${se}${he}
2024
2024
  \u2192 ${ie}${$e}`)}}if(V.length===0){Gl.set(j,"");return}let H=(re)=>{let se=`${process.cwd()}/`;return re.startsWith(se)?re.slice(se.length):re},J=`[STX] DOM API violation in ${E&&E!==_?`${H(E)} (composed into ${H(_)})`:H(_)}:
2025
2025
  ${V.join(`
2026
2026
  `)}
2027
- Tip: prefer useRef(), navigate(), and composables for component code`;if(Gl.set(j,J),T.failOnViolation)throw Error(J);else console.warn(J)}import Jl from"path";var rS=/(\bfrom\s*|\bimport\s*\(\s*|\bimport\s+)(['"])(\.\.?\/[^'"]*)\2/g,sS=/(<script\b[^>]*>)([\s\S]*?)(<\/script>)/gi;function iS(v,_){if(!_||!v.includes("/"))return v;let k=Jl.dirname(_);return v.replace(rS,(E,T,j,B)=>{let z=Jl.resolve(k,B);return`${T}${j}${z.split(Jl.sep).join("/")}${j}`})}function $m(v,_){if(!_||!v.includes("<script"))return v;return v.replace(sS,(k,E,T,j)=>`${E}${iS(T,_)}${j}`)}var Br="<!--PARENT_CONTENT_PLACEHOLDER-->";function _m(v){return v.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Im(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(`
2027
+ Tip: prefer useRef(), navigate(), and composables for component code`;if(Gl.set(j,J),T.failOnViolation)throw Error(J);else console.warn(J)}import Jl from"path";var sS=/(\bfrom\s*|\bimport\s*\(\s*|\bimport\s+)(['"])(\.\.?\/[^'"]*)\2/g,iS=/(<script\b[^>]*>)([\s\S]*?)(<\/script>)/gi;function oS(v,_){if(!_||!v.includes("/"))return v;let k=Jl.dirname(_);return v.replace(sS,(E,T,j,B)=>{let z=Jl.resolve(k,B);return`${T}${j}${z.split(Jl.sep).join("/")}${j}`})}function _m(v,_){if(!_||!v.includes("<script"))return v;return v.replace(iS,(k,E,T,j)=>`${E}${oS(T,_)}${j}`)}var Br="<!--PARENT_CONTENT_PLACEHOLDER-->";function km(v){return v.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Pm(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(`
2028
2028
  `,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 U=v[F];if(U==="\\"){F+=2;continue}if(U==="[")V=!0;else if(U==="]")V=!1;else if(U==="/"&&!V){F++;break}else if(U===`
2029
2029
  `){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]===`
2030
- `)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 Pm(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 aS=4096;async function km(v,_,k){if(k.buildMode!=="serve"||_.length<aS)return null;let{registerServeModuleBundle:E}=await import("./chunk-jj9356vp.js");return`<script ${v} src="${E(_)}"></script>`}async function Em(v,_,k){try{let{registeredModuleIdsIn:E,buildModuleRegistryScript:T}=await gt("stx/client-module-registry",()=>import("./chunk-ez5w6a60.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-jj9356vp.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 cS(v,_=""){let k=Pm(v,"data-stx-runtime");if(!k)return v;let E=Vi(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)+_+`
2030
+ `)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 Dm(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 cS=4096;async function Em(v,_,k){if(k.buildMode!=="serve"||_.length<cS)return null;let{registerServeModuleBundle:E}=await import("./chunk-96fpvzm2.js");return`<script ${v} src="${E(_)}"></script>`}async function Cm(v,_,k){try{let{registeredModuleIdsIn:E,buildModuleRegistryScript:T}=await gt("stx/client-module-registry",()=>import("./chunk-cvxc2h58.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-96fpvzm2.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 lS(v,_=""){let k=Dm(v,"data-stx-runtime");if(!k)return v;let E=Vi(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)+_+`
2031
2031
  `+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=Vi(j);if(B===-1)return T+_+`
2032
2032
  `+j;return j.slice(0,B)+T+_+`
2033
- `+j.slice(B)}function lS(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=be(v,k);let j=!_.__stxProcessingDepth;ln(_);for(let B of E._layerGraph?.configDependencies??[])T.add(B);if(j&&E.runtimeConfig)await pn(_,k,E.runtimeConfig);if(j)ld(_),_.__stx_scope_seq??={n:0,key:Bun.hash(String(_.__filename??k)).toString(36).slice(0,6)},_.__stx_head_injections=Ds(),_.__stx_seo_staged=!1;if(!_.__stxProcessingDepth)_.__stxProcessingDepth=0;if(_.__stxProcessingDepth++,!_.__onceStore)_.__onceStore=new Set;if((E.debug||!me()&&!xn())&&k&&k.endsWith(".stx"))Vs(v,k);try{return await W.timeAsync("template-processing",async()=>{let B=await uS(v,_,k,E,T);if(j)B=Zl(B);if(j&&E.autoShell&&E.buildMode!=="compile"){let z=fe(E.app?.head,{known:bn,source:"app.head"}),V=(_.__stx_runtime_head||null)??Ns(),U=(_.__stx_head_raw||"").trim(),H,Y=U.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(Y)H=Y[1].trim(),U=U.replace(Y[0],"").trim();let J=_.__sections?.title,re=V.title||H||J,se=!V.title&&(!!H||!!J),ie=V.meta||[],ae=new Set(ie.map(($e)=>Se($e)).filter(Boolean)),ce={...z,...re&&{title:re},meta:[...(z.meta||[]).filter(($e)=>!ae.has(Se($e))),...ie],link:[...z.link||[],...V.link||[]],script:[...z.script||[],...V.script||[]],headRaw:[z.headRaw,U].filter(Boolean).join(`
2033
+ `+j.slice(B)}function uS(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=be(v,k);let j=!_.__stxProcessingDepth;ln(_);for(let B of E._layerGraph?.configDependencies??[])T.add(B);if(j&&E.runtimeConfig)await pn(_,k,E.runtimeConfig);if(j)ld(_),_.__stx_scope_seq??={n:0,key:Bun.hash(String(_.__filename??k)).toString(36).slice(0,6)},_.__stx_head_injections=Ds(),_.__stx_seo_staged=!1;if(!_.__stxProcessingDepth)_.__stxProcessingDepth=0;if(_.__stxProcessingDepth++,!_.__onceStore)_.__onceStore=new Set;if((E.debug||!me()&&!xn())&&k&&k.endsWith(".stx"))Vs(v,k);try{return await W.timeAsync("template-processing",async()=>{let B=await dS(v,_,k,E,T);if(j)B=Zl(B);if(j&&E.autoShell&&E.buildMode!=="compile"){let z=fe(E.app?.head,{known:bn,source:"app.head"}),V=(_.__stx_runtime_head||null)??Ns(),U=(_.__stx_head_raw||"").trim(),H,Y=U.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(Y)H=Y[1].trim(),U=U.replace(Y[0],"").trim();let J=_.__sections?.title,re=V.title||H||J,se=!V.title&&(!!H||!!J),ie=V.meta||[],ae=new Set(ie.map(($e)=>Se($e)).filter(Boolean)),ce={...z,...re&&{title:re},meta:[...(z.meta||[]).filter(($e)=>!ae.has(Se($e))),...ie],link:[...z.link||[],...V.link||[]],script:[...z.script||[],...V.script||[]],headRaw:[z.headRaw,U].filter(Boolean).join(`
2034
2034
  `),...V.htmlAttrs&&{htmlAttrs:Pi(z.htmlAttrs,V.htmlAttrs)},...V.bodyAttrs&&{bodyAttrs:{...z.bodyAttrs||{},...V.bodyAttrs}}},oe=Ms(B);if(B=hn(B,ce,{...se&&{titleIsHtml:!0},...E.app?.colorMode&&{colorMode:E.app.colorMode}},oe),oe)B=Oi(B,z),B=mn(B,ce.htmlAttrs);let pe=B.match(/<!-- stx-layout: ([^ ]+) -->/);if(pe&&B.includes("<head")){let $e=pe[1],Re=mr($e);B=B.replace(/<head\b[^>]*>/i,(Ce)=>`${Ce}
2035
- <meta name="stx-layout" content="${_m($e)}">
2036
- <meta name="stx-layout-group" content="${_m(Re)}">`)}let he=B.match(/function (__stx_setup_\w+)\(/),xe=he?Nn(B):null;if(he&&xe&&!/\bdata-stx=/.test(xe.tag)){B=zs(B,(Re,Ce)=>`<body${Ce} data-stx="${he[1]}">`);let $e=new RegExp(`(<(?!body)[a-zA-Z][^>]*) data-stx="${he[1]}"`,"i");B=B.replace($e,"$1")}}if(j){let z=_.__stx_head_injections??Ds(),F=Ii(B);if(F!==null)z.beforeClose.push(F);let V=Ug(B);if(V!==null)z.afterOpen.push(V);if(E.offline?.enabled&&!B.includes("data-stx-offline"))z.beforeClose.push(Hg);B=Ri(B,z);let U=E.app?.colorMode;if(U)B=gn(B,U)}if(j)if(Pm(B,"data-stx-runtime")){let F=null,V=null,U=null,H=null,Y=null;try{let{getStoreScript:re}=await gt("stx/store-loader",()=>import("./chunk-td7byqwx.js")),se=E.storesDir,ie=await re(se);if(ie)U=`<script data-stx-stores>${ie}</script>`,V=await km("data-stx-stores",ie,E)??U}catch{}F=await Em([B,U],E,T);try{let{getFrameworkComposableScript:re}=await gt("stx/framework-composables",()=>import("./chunk-ynpz7f7p.js"));Y=await re(B)}catch{}try{let{getComposableScript:re}=await gt("stx/composable-loader",()=>import("./chunk-59wnn6gp.js")),se=E.composablesDir,ie=[F,U,Y].filter((ce)=>ce!==null),ae=await re(E._layerComposableDirs??se,B,ie);if(ae)H=await km('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 J=[F,V,H,Y].filter((re)=>re!==null).map((re)=>`
2037
- ${re}`).join("");B=cS(B,J)}else{let F=await Em([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+`
2038
- `+B.slice(V)}}if(j)B=Ai(B);if(j&&_.__stx_inject_css!==!1)B=await f(B,void 0,E.buildMode==="serve",!0);else if(j)B=Di(B);if(B=B.replace(/\x00STX_ESCAPED_AT\x00/g,"@"),B=lS(B),j&&_.__stx_runtime_config)B=Je(B,_.__stx_runtime_config);if(j&&!_.__stx_defer_server_data){let z=Xn(_);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 cr)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:_}),Pt.logDetailedError(F,{filePath:k,template:v.substring(0,500)}),E.debug)throw F;return Ls.createFallbackContent("Template Processing",F)}}async function uS(v,_,k,E,T){let j=process.cwd(),B={...E,partialsDir:E.partialsDir&&!Qt.isAbsolute(E.partialsDir)?Qt.resolve(j,E.partialsDir):E.partialsDir,componentsDir:E.componentsDir&&!Qt.isAbsolute(E.componentsDir)?Qt.resolve(j,E.componentsDir):E.componentsDir,layoutsDir:E.layoutsDir&&!Qt.isAbsolute(E.layoutsDir)?Qt.resolve(j,E.layoutsDir):E.layoutsDir},z=B,F=v;await pS(k,_),fS(_,z),F=await ne(()=>Og(F,_,k,z),F,(he)=>{P.log(he,{filePath:k,phase:"pre-processing-middleware"},"warning"),console.warn(`[stx] pre-processing middleware failed for ${k}: ${he.message}`)}),F=F.replace(/\{\{--[\s\S]*?--\}\}/g,"");let V=Pn(F,Fe,(he,xe)=>`\x00STX_HTML_COMMENT_${xe}\x00`);F=V.output;let U=V.tokens,H=(he)=>U.length===0?he:he.replace(/\x00STX_HTML_COMMENT_(\d+)\x00/g,(xe,$e)=>U[Number($e)]??""),Y="\x00STX_ESCAPED_AT\x00",J="\x00STX_ESC_MUSTACHE_OPEN\x00",re="\x00STX_ESC_MUSTACHE_CLOSE\x00";F=F.replace(/@@/g,Y),F=F.replace(/@\{\{([\s\S]*?)\}\}/g,(he,xe)=>`${J}${xe}${re}`),F=Bg(F),F=await fm(F,k,T);let se={};F=ws(F,se);let ie={..._.__sections||{}},ae="",ce=Vf(ze(v)),oe=/@nolayout\b/.test(F)||ce===!1;if(/@nolayout\b/.test(F))F=F.replace(/@nolayout\b\s*/g,"");let pe=F.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(pe)ae=pe[1],F=F.replace(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/g,"");else if(typeof ce==="string"){if(ae=ce,!/@section\s*\(/.test(F))F=`@section('content')
2035
+ <meta name="stx-layout" content="${km($e)}">
2036
+ <meta name="stx-layout-group" content="${km(Re)}">`)}let he=B.match(/function (__stx_setup_\w+)\(/),xe=he?Nn(B):null;if(he&&xe&&!/\bdata-stx=/.test(xe.tag)){B=zs(B,(Re,Ce)=>`<body${Ce} data-stx="${he[1]}">`);let $e=new RegExp(`(<(?!body)[a-zA-Z][^>]*) data-stx="${he[1]}"`,"i");B=B.replace($e,"$1")}}if(j){let z=_.__stx_head_injections??Ds(),F=Ii(B);if(F!==null)z.beforeClose.push(F);let V=Hg(B);if(V!==null)z.afterOpen.push(V);if(E.offline?.enabled&&!B.includes("data-stx-offline"))z.beforeClose.push(qg);B=Ri(B,z);let U=E.app?.colorMode;if(U)B=gn(B,U)}if(j)if(Dm(B,"data-stx-runtime")){let F=null,V=null,U=null,H=null,Y=null;try{let{getStoreScript:re}=await gt("stx/store-loader",()=>import("./chunk-8bqph6jy.js")),se=E.storesDir,ie=await re(se);if(ie)U=`<script data-stx-stores>${ie}</script>`,V=await Em("data-stx-stores",ie,E)??U}catch{}F=await Cm([B,U],E,T);try{let{getFrameworkComposableScript:re}=await gt("stx/framework-composables",()=>import("./chunk-5pdckdhm.js"));Y=await re(B)}catch{}try{let{getComposableScript:re}=await gt("stx/composable-loader",()=>import("./chunk-en30fzej.js")),se=E.composablesDir,ie=[F,U,Y].filter((ce)=>ce!==null),ae=await re(E._layerComposableDirs??se,B,ie);if(ae)H=await Em('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 J=[F,V,H,Y].filter((re)=>re!==null).map((re)=>`
2037
+ ${re}`).join("");B=lS(B,J)}else{let F=await Cm([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+`
2038
+ `+B.slice(V)}}if(j)B=Ai(B);if(j&&_.__stx_inject_css!==!1)B=await f(B,void 0,E.buildMode==="serve",!0);else if(j)B=Di(B);if(B=B.replace(/\x00STX_ESCAPED_AT\x00/g,"@"),B=uS(B),j&&_.__stx_runtime_config)B=Je(B,_.__stx_runtime_config);if(j&&!_.__stx_defer_server_data){let z=Xn(_);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 cr)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:_}),Pt.logDetailedError(F,{filePath:k,template:v.substring(0,500)}),E.debug)throw F;return Ls.createFallbackContent("Template Processing",F)}}async function dS(v,_,k,E,T){let j=process.cwd(),B={...E,partialsDir:E.partialsDir&&!Qt.isAbsolute(E.partialsDir)?Qt.resolve(j,E.partialsDir):E.partialsDir,componentsDir:E.componentsDir&&!Qt.isAbsolute(E.componentsDir)?Qt.resolve(j,E.componentsDir):E.componentsDir,layoutsDir:E.layoutsDir&&!Qt.isAbsolute(E.layoutsDir)?Qt.resolve(j,E.layoutsDir):E.layoutsDir},z=B,F=v;await gS(k,_),pS(_,z),F=await ne(()=>Og(F,_,k,z),F,(he)=>{P.log(he,{filePath:k,phase:"pre-processing-middleware"},"warning"),console.warn(`[stx] pre-processing middleware failed for ${k}: ${he.message}`)}),F=F.replace(/\{\{--[\s\S]*?--\}\}/g,"");let V=Pn(F,Fe,(he,xe)=>`\x00STX_HTML_COMMENT_${xe}\x00`);F=V.output;let U=V.tokens,H=(he)=>U.length===0?he:he.replace(/\x00STX_HTML_COMMENT_(\d+)\x00/g,(xe,$e)=>U[Number($e)]??""),Y="\x00STX_ESCAPED_AT\x00",J="\x00STX_ESC_MUSTACHE_OPEN\x00",re="\x00STX_ESC_MUSTACHE_CLOSE\x00";F=F.replace(/@@/g,Y),F=F.replace(/@\{\{([\s\S]*?)\}\}/g,(he,xe)=>`${J}${xe}${re}`),F=zg(F),F=await pm(F,k,T);let se={};F=ws(F,se);let ie={..._.__sections||{}},ae="",ce=Vf(ze(v)),oe=/@nolayout\b/.test(F)||ce===!1;if(/@nolayout\b/.test(F))F=F.replace(/@nolayout\b\s*/g,"");let pe=F.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(pe)ae=pe[1],F=F.replace(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/g,"");else if(typeof ce==="string"){if(ae=ce,!/@section\s*\(/.test(F))F=`@section('content')
2039
2039
  ${F.trim()}
2040
2040
  @endsection`}if(!ae&&!oe&&z.defaultLayout){let he=At(F),xe=/@section\s*\(/.test(F);if(!he||xe){let $e="",Re=Qt.dirname(k),Ce=z.layoutsDir?Qt.dirname(z.layoutsDir):process.cwd();for(let Ae=0;Ae<20;Ae++){let Te=Qt.join(Re,"_layout.stx");if(await r(Te)){$e=Te;break}let _e=Qt.dirname(Re);if(_e===Re||_e.length<Ce.length)break;Re=_e}if($e)ae=$e;else if(z.layoutsDir){let Ae=Qt.isAbsolute(z.layoutsDir)?z.layoutsDir:Qt.resolve(process.cwd(),z.layoutsDir),Te=Qt.join(Ae,`${z.defaultLayout}.stx`);if(await r(Te))ae=Te}if(ae&&!xe)F=`@section('content')
2041
2041
  ${F.trim()}
2042
- @endsection`}}if(ae&&F.includes("<script")){let he=$n(F),xe=he.scripts.map(($e)=>Cm($e,k)??$e);F=fs(he.output,xe)}if(F=F.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(he,xe,$e)=>(ie[xe]=$e,"")),F=F.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*([^)]+?)\s*\)/g,(he,xe,$e)=>{if(/^(['"]).*\1$/.test($e.trim()))return he;try{let Re=l($e.trim(),_);if(Re===void 0)return he;return ie[xe]=String(Re??""),""}catch{return he}}),F=F.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@endsection|@show)/g,(he,xe,$e)=>{if($e.includes("@parent"))ie[xe]=$e.replace("@parent",Br);else ie[xe]=$e.trim();return""}),_.__sections=ie,F=F.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"])?\)/g,(he,xe,$e)=>ie[xe]||$e||""),!("slot"in _)||_.slot===void 0)F=F.replace(/\{\{\s*slot\s*\}\}/g,()=>ie.content||"");if(F=vs(F,se),ae){let he=[],xe=$n(F),$e=Pn(xe.output,Yr,(Re,Ce)=>`\x00STX_ORPHAN_STYLE_${Ce}\x00`);if(F=$e.output.replace(/\x00STX_(SCRIPT|ORPHAN_STYLE)_(\d+)\x00/g,(Re,Ce,Ae)=>{let Te=Ce==="SCRIPT"?Cm(xe.scripts[Number(Ae)],k):$e.tokens[Number(Ae)];if(Te)he.push(Te);return""}),he.length>0){let Re=he.join(`
2042
+ @endsection`}}if(ae&&F.includes("<script")){let he=$n(F),xe=he.scripts.map(($e)=>Rm($e,k)??$e);F=fs(he.output,xe)}if(F=F.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(he,xe,$e)=>(ie[xe]=$e,"")),F=F.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*([^)]+?)\s*\)/g,(he,xe,$e)=>{if(/^(['"]).*\1$/.test($e.trim()))return he;try{let Re=l($e.trim(),_);if(Re===void 0)return he;return ie[xe]=String(Re??""),""}catch{return he}}),F=F.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@endsection|@show)/g,(he,xe,$e)=>{if($e.includes("@parent"))ie[xe]=$e.replace("@parent",Br);else ie[xe]=$e.trim();return""}),_.__sections=ie,F=F.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"])?\)/g,(he,xe,$e)=>ie[xe]||$e||""),!("slot"in _)||_.slot===void 0)F=F.replace(/\{\{\s*slot\s*\}\}/g,()=>ie.content||"");if(F=vs(F,se),ae){let he=[],xe=$n(F),$e=Pn(xe.output,Yr,(Re,Ce)=>`\x00STX_ORPHAN_STYLE_${Ce}\x00`);if(F=$e.output.replace(/\x00STX_(SCRIPT|ORPHAN_STYLE)_(\d+)\x00/g,(Re,Ce,Ae)=>{let Te=Ce==="SCRIPT"?Rm(xe.scripts[Number(Ae)],k):$e.tokens[Number(Ae)];if(Te)he.push(Te);return""}),he.length>0){let Re=he.join(`
2043
2043
  `);ie.content=ie.content?`${ie.content}
2044
- ${Re}`:Re,_.__sections=ie}}if(ae)try{let he;if(Qt.isAbsolute(ae))he=ae,T.add(ae);else he=await ne(()=>Yn(ae,k,B,T),null,()=>{throw new X(`Failed to resolve layout path: ${ae}`,k,void 0,void 0,`Layout referenced from ${k}`)});if(!he){let Te=(Me)=>{if(!Me)return[];try{let Oe=Qt.isAbsolute(Me)?Me:Qt.resolve(process.cwd(),Me);return oS.readdirSync(Oe).filter((Ie)=>Ie.endsWith(".stx")).map((Ie)=>Ie.replace(/\.stx$/,""))}catch{return[]}},_e=[...Te(B.layoutsDir),...Te(B.fallbackLayoutsDir)].filter((Me,Oe,Ie)=>Ie.indexOf(Me)===Oe).sort(),Pe=`Layout not found: ${ae} (referenced from ${k})`+(_e.length>0?`. Available layouts: ${_e.join(", ")}`:B.layoutsDir?`. No .stx layouts found in ${B.layoutsDir}`:"");if(P.log(Error(Pe),{layoutPath:ae,filePath:k,available:_e},"error"),console.error(`[stx] ${Pe}`),B.debug)throw new X(Pe,k);return F}let xe=await ne(()=>Bun.file(he).text(),"",()=>{throw new X(`Failed to read layout file: ${he}`,k,void 0,void 0,"Layout content could not be loaded")});xe=$m(xe,he);let $e=xe.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if($e){if(B.debug)console.log(`Found nested layout: ${$e[1]} in ${he}`);let Te={},_e=xe.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(Oe,Ie,Ne)=>(Te[Ie]=Ne.trim(),""));for(let[Oe,Ie]of Object.entries(Te))if(ie[Oe]&&ie[Oe].includes(Br)){let Ne=ie[Oe].indexOf(Br);ie[Oe]=ie[Oe].slice(0,Ne)+Ie+ie[Oe].slice(Ne+Br.length)}else if(!ie[Oe])ie[Oe]=Ie;let Pe={..._,__sections:ie},Me=`@layout('${$e[1]}')${_e}`;return await n(Me,Pe,he,B,T)}let Re=xe.replace(/\{\{--[\s\S]*?--\}\}/g,""),Ce=ws(Re,se),Ae={};return Ce=Ce.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(Te,_e,Pe)=>(Ae[_e]=Pe.trim(),`@slot('${_e}')`)),Ce=Ce.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(Te,_e,Pe)=>{if(ie[_e]){let Me=ie[_e];if(Me.includes(Br)){let Oe=Ae[_e]||"",Ie=Me.indexOf(Br);Me=Me.slice(0,Ie)+Oe+Me.slice(Ie+Br.length)}return Me}return Pe||""}),Ce=dS(Ce,ie),Ce=Ce.replace(/\{\{\s*slot\s*\}\}/g,()=>ie.content||""),Ce=vs(Ce,se),_.__originalFilePath=k,F=await Tm(Ce,_,he,B,T),F=`<!-- stx-layout: ${ae} -->
2045
- ${F}`,H(F)}catch(he){return P.log(he instanceof Error?he:Error(String(he)),{layoutPath:ae,filePath:k},"error"),`[Error processing layout: ${he instanceof Error?he.message:String(he)}]`}return H(await Tm(F,_,k,B,T))}function dS(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 fS(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 pS(v,_){await ne(()=>jg(v,_),void 0,(k)=>{P.log(k,{filePath:v,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${v}: ${k.message}`)})}var Yl="data-stx-source";function Cm(v,_){if(!v)return v;let k=/^<script\b([^>]*)>/i.exec(v);if(!k||!/\bserver\b/.test(k[1])||k[1].includes(Yl))return v;return`<script ${Yl}="${encodeURIComponent(_)}"${v.slice(7)}`}function gS(v){let _=new RegExp(`${Yl}="([^"]*)"`).exec(v);return _?decodeURIComponent(_[1]):void 0}function Rm(v){return v.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function Am(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">${Rm(v)}</span><span style="display:block;margin-top:4px">${Rm(k)}</span></div>`}async function mS(v,_,k,E){let{scanScriptTags:T}=await gt("stx/signal-processing",()=>import("./chunk-5y2tgmb6.js")),j=[],B=!me()&&!xn();for(let F of T(v)){let V=F.attrs;if(!/\bserver\b/.test(V))continue;let U=F.start+F.fullMatch.indexOf(">")+1,H=Im(v,U);if(H===-1)continue;let Y=v.slice(U,H);if(!Y.trim())continue;let J=gS(V)??k,re={index:F.start,length:H+9-F.start};try{let{extractVariables:se}=await gt("stx/variable-extractor",()=>import("./chunk-4b7y1p7f.js"));await se(Y,_,J,{preserveExisting:!0,onFailure:(ie)=>{if(ie.kind==="unknown")return;if(E?.onServerScriptError?.({sourcePath:J,kind:ie.kind,message:ie.message}),!B)return;j.push({...re,markup:Am(J,ie.kind,ie.message)})}})}catch(se){let ie=se instanceof Error?se:Error(String(se));if(P.log(ie,{filePath:J,phase:"server-script-extraction"},"warning"),console.warn(`[stx] server <script> extraction failed in ${J}: ${ie.message}`),B)j.push({...re,markup:Am(J,"unknown",ie.message)})}}if(j.length===0)return v;let z=v;for(let F of j.sort((V,U)=>U.index-V.index))z=z.slice(0,F.index)+F.markup+z.slice(F.index+F.length);return z}async function hS(v,_,k){try{let{interpolateScriptsInTemplate:E}=await gt("stx/expressions",()=>import("./chunk-kmvyfwr3.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 Tm(v,_,k,E,T){let j=v,B=E;if(j=await mS(j,_,k,E),j=await hS(j,_,k),j=await Sg(j,_,k),j=await $g(j,_,k),j=await sp(j,_,k,B),be(j))j=ci(j,_),j=ms(j,_),j=gs(j,_);j=li(j);let{processStreamDirectives:z}=await gt("stx/streaming",()=>import("./chunk-hh88tvs5.js"));j=z(j,_),j=gi(j,_,k,B,!0),j=await Vg(j,_,k,B,T),j=await ds(j,_,k,B,T),j=Tu(j,_,k,B);let{processDeferDirectives:F}=await gt("stx/defer",()=>import("./chunk-m9cmc6np.js"));j=F(j,_,k);let{processTeleportDirectives:V}=await gt("stx/teleport",()=>import("./chunk-pq8mz4ma.js"));j=V(j,_,k);let{processTransitionDirectives:U,processTransitionAttributes:H}=await gt("stx/transitions",()=>import("./chunk-m9r4x7e6.js"));j=U(j,_,k),j=H(j);let{processErrorBoundaryDirectives:Y,stripRenderFailedMarkers:J}=await gt("stx/error-boundaries",()=>import("./chunk-h85hrwkq.js"));j=Y(j,_,k),j=J(j);let{processSuspenseDirectives:re}=await gt("stx/suspense",()=>import("./chunk-mbwdn96z.js"));j=re(j,_,k);let{processAsyncDirectives:se}=await gt("stx/async-components",()=>import("./chunk-7pewegtw.js"));j=se(j,_,k);let{processKeepAliveDirectives:ie}=await gt("stx/keep-alive",()=>import("./chunk-mqje968d.js"));j=ie(j,_,k);let{processVirtualListDirectives:ae,processVirtualGridDirectives:ce,processInfiniteListDirectives:oe}=await gt("stx/virtual-scrolling",()=>import("./chunk-fprgww47.js"));j=ae(j,_,k),j=ce(j,_,k),j=oe(j,_,k);let{processPartialHydrationDirectives:pe,processStaticDirectives:he}=await gt("stx/partial-hydration",()=>import("./chunk-5141wftw.js"));j=pe(j,_,k),j=he(j);let{processComputedDirectives:xe,processWatchDirectives:$e}=await gt("stx/computed",()=>import("./chunk-1xdzcy9d.js"));j=xe(j,_,k),j=$e(j,_,k);let{processFormValidationDirectives:Re}=await gt("stx/forms-validation",()=>import("./chunk-ft447y2j.js"));j=Re(j,_,k);let{processHeadDirective:Ce,processTitleDirective:Ae,processMetaDirective:Te,resetHead:_e}=await gt("stx/head",()=>import("./chunk-qdrvx7vh.js"));if(!_.__stx_head_preset&&!_.__stx_runtime_head)_e();let Pe=Ce(j);if(j=Pe.content,Pe.headContent)_.__stx_head_raw=`${_.__stx_head_raw||""}${Pe.headContent}
2046
- `;if(j=Ae(j,_),j=Te(j,_,k),j=Ng(j),j=nl(j,_),j=rp(j),j=Pg(j),j=await bs(j,_,k,B,T),j=await ds(j,_,k,B,T),_.__stxProcessingDepth===1)j=ud(j,_);if(j=j.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/g,""),j=Zl(j),j=lr(j,_,k),j=ys(j),j=Uf(j,_,{filePath:k,buildMode:B.buildMode}),j=rl(j,_),j=sl(j,_),j=Ho(j,_),j=dp(j,_),j=fp(j,_),j=await Om(j,_,k,B),j=await Dm(j,_,k),j=await wi(j,_,k,B),j=vi(j,_,k,B),j=Rs(j,_,k,B),j=As(j,_,k),j=Ps(j,_,k,B),j=tp(j,_,k,B),j=Ss(j,_),j=ks(j),j=hm(j),!B.skipEventDirectives)j=Hu(j,_,k);if(j=Kf(j,_,k),B.debug){let lt=/\bx-data\s*=/.test(j),it=ps(v);if(lt&&it)console.warn(`[stx] ${k}: Template mixes Alpine-style (x-data) and signals (state/derived/effect) reactivity.
2044
+ ${Re}`:Re,_.__sections=ie}}if(ae)try{let he;if(Qt.isAbsolute(ae))he=ae,T.add(ae);else he=await ne(()=>Yn(ae,k,B,T),null,()=>{throw new X(`Failed to resolve layout path: ${ae}`,k,void 0,void 0,`Layout referenced from ${k}`)});if(!he){let Te=(Oe)=>{if(!Oe)return[];try{let Me=Qt.isAbsolute(Oe)?Oe:Qt.resolve(process.cwd(),Oe);return aS.readdirSync(Me).filter((Ie)=>Ie.endsWith(".stx")).map((Ie)=>Ie.replace(/\.stx$/,""))}catch{return[]}},_e=[...Te(B.layoutsDir),...Te(B.fallbackLayoutsDir)].filter((Oe,Me,Ie)=>Ie.indexOf(Oe)===Me).sort(),Pe=`Layout not found: ${ae} (referenced from ${k})`+(_e.length>0?`. Available layouts: ${_e.join(", ")}`:B.layoutsDir?`. No .stx layouts found in ${B.layoutsDir}`:"");if(P.log(Error(Pe),{layoutPath:ae,filePath:k,available:_e},"error"),console.error(`[stx] ${Pe}`),B.debug)throw new X(Pe,k);return F}let xe=await ne(()=>Bun.file(he).text(),"",()=>{throw new X(`Failed to read layout file: ${he}`,k,void 0,void 0,"Layout content could not be loaded")});xe=_m(xe,he);let $e=xe.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if($e){if(B.debug)console.log(`Found nested layout: ${$e[1]} in ${he}`);let Te={},_e=xe.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(Me,Ie,Ne)=>(Te[Ie]=Ne.trim(),""));for(let[Me,Ie]of Object.entries(Te))if(ie[Me]&&ie[Me].includes(Br)){let Ne=ie[Me].indexOf(Br);ie[Me]=ie[Me].slice(0,Ne)+Ie+ie[Me].slice(Ne+Br.length)}else if(!ie[Me])ie[Me]=Ie;let Pe={..._,__sections:ie},Oe=`@layout('${$e[1]}')${_e}`;return await n(Oe,Pe,he,B,T)}let Re=xe.replace(/\{\{--[\s\S]*?--\}\}/g,""),Ce=ws(Re,se),Ae={};return Ce=Ce.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(Te,_e,Pe)=>(Ae[_e]=Pe.trim(),`@slot('${_e}')`)),Ce=Ce.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(Te,_e,Pe)=>{if(ie[_e]){let Oe=ie[_e];if(Oe.includes(Br)){let Me=Ae[_e]||"",Ie=Oe.indexOf(Br);Oe=Oe.slice(0,Ie)+Me+Oe.slice(Ie+Br.length)}return Oe}return Pe||""}),Ce=fS(Ce,ie),Ce=Ce.replace(/\{\{\s*slot\s*\}\}/g,()=>ie.content||""),Ce=vs(Ce,se),_.__originalFilePath=k,F=await Im(Ce,_,he,B,T),F=`<!-- stx-layout: ${ae} -->
2045
+ ${F}`,H(F)}catch(he){return P.log(he instanceof Error?he:Error(String(he)),{layoutPath:ae,filePath:k},"error"),`[Error processing layout: ${he instanceof Error?he.message:String(he)}]`}return H(await Im(F,_,k,B,T))}function fS(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 pS(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 gS(v,_){await ne(()=>Lg(v,_),void 0,(k)=>{P.log(k,{filePath:v,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${v}: ${k.message}`)})}var Yl="data-stx-source";function Rm(v,_){if(!v)return v;let k=/^<script\b([^>]*)>/i.exec(v);if(!k||!/\bserver\b/.test(k[1])||k[1].includes(Yl))return v;return`<script ${Yl}="${encodeURIComponent(_)}"${v.slice(7)}`}function mS(v){let _=new RegExp(`${Yl}="([^"]*)"`).exec(v);return _?decodeURIComponent(_[1]):void 0}function Am(v){return v.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function Tm(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">${Am(v)}</span><span style="display:block;margin-top:4px">${Am(k)}</span></div>`}async function hS(v,_,k,E){let{scanScriptTags:T}=await gt("stx/signal-processing",()=>import("./chunk-yty18jzq.js")),j=[],B=!me()&&!xn();for(let F of T(v)){let V=F.attrs;if(!/\bserver\b/.test(V))continue;let U=F.start+F.fullMatch.indexOf(">")+1,H=Pm(v,U);if(H===-1)continue;let Y=v.slice(U,H);if(!Y.trim())continue;let J=mS(V)??k,re={index:F.start,length:H+9-F.start};try{let{extractVariables:se}=await gt("stx/variable-extractor",()=>import("./chunk-m2vk8vja.js"));await se(Y,_,J,{preserveExisting:!0,onFailure:(ie)=>{if(ie.kind==="unknown")return;if(E?.onServerScriptError?.({sourcePath:J,kind:ie.kind,message:ie.message}),!B)return;j.push({...re,markup:Tm(J,ie.kind,ie.message)})}})}catch(se){let ie=se instanceof Error?se:Error(String(se));if(P.log(ie,{filePath:J,phase:"server-script-extraction"},"warning"),console.warn(`[stx] server <script> extraction failed in ${J}: ${ie.message}`),B)j.push({...re,markup:Tm(J,"unknown",ie.message)})}}if(j.length===0)return v;let z=v;for(let F of j.sort((V,U)=>U.index-V.index))z=z.slice(0,F.index)+F.markup+z.slice(F.index+F.length);return z}async function yS(v,_,k){try{let{interpolateScriptsInTemplate:E}=await gt("stx/expressions",()=>import("./chunk-gmp7apxp.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 Im(v,_,k,E,T){let j=v,B=E;if(j=await hS(j,_,k,E),j=await yS(j,_,k),j=await $g(j,_,k),j=await _g(j,_,k),j=await sp(j,_,k,B),be(j))j=ci(j,_),j=ms(j,_),j=gs(j,_);j=li(j);let{processStreamDirectives:z}=await gt("stx/streaming",()=>import("./chunk-qx9s066f.js"));j=z(j,_),j=gi(j,_,k,B,!0),j=await Ug(j,_,k,B,T),j=await ds(j,_,k,B,T),j=Tu(j,_,k,B);let{processDeferDirectives:F}=await gt("stx/defer",()=>import("./chunk-m9cmc6np.js"));j=F(j,_,k);let{processTeleportDirectives:V}=await gt("stx/teleport",()=>import("./chunk-pq8mz4ma.js"));j=V(j,_,k);let{processTransitionDirectives:U,processTransitionAttributes:H}=await gt("stx/transitions",()=>import("./chunk-m9r4x7e6.js"));j=U(j,_,k),j=H(j);let{processErrorBoundaryDirectives:Y,stripRenderFailedMarkers:J}=await gt("stx/error-boundaries",()=>import("./chunk-h85hrwkq.js"));j=Y(j,_,k),j=J(j);let{processSuspenseDirectives:re}=await gt("stx/suspense",()=>import("./chunk-mbwdn96z.js"));j=re(j,_,k);let{processAsyncDirectives:se}=await gt("stx/async-components",()=>import("./chunk-7pewegtw.js"));j=se(j,_,k);let{processKeepAliveDirectives:ie}=await gt("stx/keep-alive",()=>import("./chunk-mqje968d.js"));j=ie(j,_,k);let{processVirtualListDirectives:ae,processVirtualGridDirectives:ce,processInfiniteListDirectives:oe}=await gt("stx/virtual-scrolling",()=>import("./chunk-fprgww47.js"));j=ae(j,_,k),j=ce(j,_,k),j=oe(j,_,k);let{processPartialHydrationDirectives:pe,processStaticDirectives:he}=await gt("stx/partial-hydration",()=>import("./chunk-5141wftw.js"));j=pe(j,_,k),j=he(j);let{processComputedDirectives:xe,processWatchDirectives:$e}=await gt("stx/computed",()=>import("./chunk-1xdzcy9d.js"));j=xe(j,_,k),j=$e(j,_,k);let{processFormValidationDirectives:Re}=await gt("stx/forms-validation",()=>import("./chunk-ft447y2j.js"));j=Re(j,_,k);let{processHeadDirective:Ce,processTitleDirective:Ae,processMetaDirective:Te,resetHead:_e}=await gt("stx/head",()=>import("./chunk-qdrvx7vh.js"));if(!_.__stx_head_preset&&!_.__stx_runtime_head)_e();let Pe=Ce(j);if(j=Pe.content,Pe.headContent)_.__stx_head_raw=`${_.__stx_head_raw||""}${Pe.headContent}
2046
+ `;if(j=Ae(j,_),j=Te(j,_,k),j=jg(j),j=nl(j,_),j=rp(j),j=Dg(j),j=await bs(j,_,k,B,T),j=await ds(j,_,k,B,T),_.__stxProcessingDepth===1)j=ud(j,_);if(j=j.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/g,""),j=Zl(j),j=lr(j,_,k),j=ys(j),j=Uf(j,_,{filePath:k,buildMode:B.buildMode}),j=rl(j,_),j=sl(j,_),j=ea(j,_),j=dp(j,_),j=fp(j,_),j=await Om(j,_,k,B),j=await Mm(j,_,k),j=await wi(j,_,k,B),j=vi(j,_,k,B),j=Rs(j,_,k,B),j=As(j,_,k),j=Ps(j,_,k,B),j=tp(j,_,k,B),j=Ss(j,_),j=ks(j),j=ym(j),!B.skipEventDirectives)j=Hu(j,_,k);if(j=Kf(j,_,k),B.debug){let lt=/\bx-data\s*=/.test(j),it=ps(v);if(lt&&it)console.warn(`[stx] ${k}: Template mixes Alpine-style (x-data) and signals (state/derived/effect) reactivity.
2047
2047
  Both work on the same page, but they manage separate scopes.
2048
- Prefer signals (state/derived/effect) for new components.`)}j=Hp(j,_),j=await G(j,_,k),j=vm(j),j=wm(j),j=Wf(j);let{processXElementDirectives:Me}=await gt("stx/x-element",()=>import("./chunk-zhxdpzga.js"));j=Me(j);let Oe=_.__originalFilePath||k,Ie=Be(_);if(j=await di(j,B,Oe,Ie),j=cp(j,_),j=await Mg(j,_,k,B),B.media?.image?.autoSiblings){let lt=B.publicDir||"public",{rewriteImagesWithSiblings:it}=await gt("stx/image-optimization/auto-sibling",()=>import("./chunk-2bpj2dsh.js"));j=await it(j,{publicDir:lt})}if(B.seo?.enabled)j=Is(j,_,B);let Ne=(lt,it,mt=!0)=>{if(!it)return lt;let jt=it.match(/<title\b[^>]*>[\s\S]*?<\/title>/i),Ft=lt.match(/<title\b[^>]*>[\s\S]*?<\/title>/i);if(jt&&Ft){if(mt)lt=lt.replace(Ft[0],jt[0]);if(it=it.replace(jt[0],"").trim(),!it)return lt}if(/<\/head>/i.test(lt))return lt.replace(/<\/head>/i,`${it}
2048
+ Prefer signals (state/derived/effect) for new components.`)}j=qp(j,_),j=await G(j,_,k),j=wm(j),j=Sm(j),j=Wf(j);let{processXElementDirectives:Oe}=await gt("stx/x-element",()=>import("./chunk-zhxdpzga.js"));j=Oe(j);let Me=_.__originalFilePath||k,Ie=Be(_);if(j=await di(j,B,Me,Ie),j=cp(j,_),j=await Ng(j,_,k,B),B.media?.image?.autoSiblings){let lt=B.publicDir||"public",{rewriteImagesWithSiblings:it}=await gt("stx/image-optimization/auto-sibling",()=>import("./chunk-2bpj2dsh.js"));j=await it(j,{publicDir:lt})}if(B.seo?.enabled)j=Is(j,_,B);let Ne=(lt,it,mt=!0)=>{if(!it)return lt;let jt=it.match(/<title\b[^>]*>[\s\S]*?<\/title>/i),Ft=lt.match(/<title\b[^>]*>[\s\S]*?<\/title>/i);if(jt&&Ft){if(mt)lt=lt.replace(Ft[0],jt[0]);if(it=it.replace(jt[0],"").trim(),!it)return lt}if(/<\/head>/i.test(lt))return lt.replace(/<\/head>/i,`${it}
2049
2049
  </head>`);if(/<head\b[^>]*>/i.test(lt))return lt.replace(/(<head\b[^>]*>)/i,`$1
2050
2050
  ${it}`);if(/<html\b[^>]*>/i.test(lt))return lt.replace(/(<html\b[^>]*>)/i,`$1
2051
2051
  <head>
@@ -2056,41 +2056,41 @@ ${Lf()}
2056
2056
  `+wn}else j=j.replace("</head>",`${it}
2057
2057
  </head>`)}else if(j.includes("<body"))j=j.replace(/<body([^>]*)>/,`<body$1>
2058
2058
  ${it}`);else j=it+`
2059
- `+j}{let{scanScriptTags:lt}=await gt("stx/signal-processing",()=>import("./chunk-5y2tgmb6.js")),it=[];for(let mt of lt(j)){if(!/\bserver\b/i.test(mt.attrs))continue;let jt=mt.start+mt.fullMatch.indexOf(">")+1,Ft=Im(j,jt);if(Ft===-1)continue;let Gt=Ft+9;while(Gt<j.length&&/\s/.test(j[Gt]))Gt++;it.push({start:mt.start,end:Gt})}if(it.length>0){let mt=Array(it.length+1),jt=0;for(let Ft=0;Ft<it.length;Ft++){let{start:Gt,end:wn}=it[Ft];mt[Ft]=j.slice(jt,Gt),jt=wn}mt[it.length]=j.slice(jt),j=mt.join("")}}let ut=Mo(j,k);if(ut.hasScoped)j=ut.html;let wt=_.__stx_event_bindings||[],pt=!1,Wt=[],In=/\s:[a-z][\w.-]*\s*=/.test(j),{scanScriptTags:Rn}=await gt("stx/signal-processing",()=>import("./chunk-5y2tgmb6.js"));for(let lt of Rn(j,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/}))Wt.push({match:lt.fullMatch,attrs:lt.attrs,content:lt.body});for(let{match:lt,attrs:it,content:mt}of Wt){pt=!0;let jt=mt;Cs(mt,k,E.strict,_.__originalFilePath);let Ft=await ye(mt,{eventBindings:wt,attrs:it,hasColonDirectives:In,templateContent:v,filePath:k,projectRoot:process.cwd(),production:E.buildMode==="compile",serverData:Ie});j=j.replace(lt,()=>Ft)}if(pt)_.__stx_event_bindings=[];if(!pt&&_.__stxProcessingDepth===1){let lt=_.__stx_event_bindings||[];if(lt.length>0){let it=za(lt);if(it){let mt=j.lastIndexOf("</body>");j=mt===-1?j+it:j.slice(0,mt)+it+`
2060
- `+j.slice(mt)}_.__stx_event_bindings=[]}}if(!le(j)&&Qg(j))j=await ya(j,B);if(j=em(j),B.csp?.enabled&&B.csp.useNonce&&typeof _.cspNonce==="string")j=ep(j,_.cspNonce);return j}var yS=[{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"}],xS=[{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')"}],bS=[{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 Ic(v){let _=[],k=[];return vS(v,_),wS(v,_,k),SS(v,k),$S(v,_),{valid:_.length===0,errors:_,warnings:k}}function vS(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 wS(v,_,k){for(let E of yS){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 SS(v,_){for(let k of xS)if(k.pattern.test(v))_.push({type:"syntax",message:k.message,suggestion:k.suggestion})}function $S(v,_){for(let k of bS)if(k.pattern.test(v))_.push({type:"expression",message:`Security warning: ${k.message}`,suggestion:"Remove dangerous code from template expressions"})}function Oc(v,_){let k=v.slice(0,_).split(`
2061
- `);return{line:k.length,column:k[k.length-1].length+1}}function Dc(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 Mc(v){return/@[a-z]+/i.test(v)||/\{\{/.test(v)}function Nc(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 jn from"path";import Gs from"process";var Tt=["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 Mm=new Set(Tt),_S=new Set(["props","$props","defineProps"]),kS=new Set(["stx","@stacksjs/stx"]),Nm=m(128),jm=m(64);function ES(v){let _=[],k=0,E=v.split(`
2059
+ `+j}{let{scanScriptTags:lt}=await gt("stx/signal-processing",()=>import("./chunk-yty18jzq.js")),it=[];for(let mt of lt(j)){if(!/\bserver\b/i.test(mt.attrs))continue;let jt=mt.start+mt.fullMatch.indexOf(">")+1,Ft=Pm(j,jt);if(Ft===-1)continue;let Gt=Ft+9;while(Gt<j.length&&/\s/.test(j[Gt]))Gt++;it.push({start:mt.start,end:Gt})}if(it.length>0){let mt=Array(it.length+1),jt=0;for(let Ft=0;Ft<it.length;Ft++){let{start:Gt,end:wn}=it[Ft];mt[Ft]=j.slice(jt,Gt),jt=wn}mt[it.length]=j.slice(jt),j=mt.join("")}}let ut=No(j,k);if(ut.hasScoped)j=ut.html;let wt=_.__stx_event_bindings||[],pt=!1,Wt=[],In=/\s:[a-z][\w.-]*\s*=/.test(j),{scanScriptTags:Rn}=await gt("stx/signal-processing",()=>import("./chunk-yty18jzq.js"));for(let lt of Rn(j,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/}))Wt.push({match:lt.fullMatch,attrs:lt.attrs,content:lt.body});for(let{match:lt,attrs:it,content:mt}of Wt){pt=!0;let jt=mt;Cs(mt,k,E.strict,_.__originalFilePath);let Ft=await ye(mt,{eventBindings:wt,attrs:it,hasColonDirectives:In,templateContent:v,filePath:k,projectRoot:process.cwd(),production:E.buildMode==="compile",serverData:Ie});j=j.replace(lt,()=>Ft)}if(pt)_.__stx_event_bindings=[];if(!pt&&_.__stxProcessingDepth===1){let lt=_.__stx_event_bindings||[];if(lt.length>0){let it=za(lt);if(it){let mt=j.lastIndexOf("</body>");j=mt===-1?j+it:j.slice(0,mt)+it+`
2060
+ `+j.slice(mt)}_.__stx_event_bindings=[]}}if(!le(j)&&em(j))j=await ya(j,B);if(j=tm(j),B.csp?.enabled&&B.csp.useNonce&&typeof _.cspNonce==="string")j=ep(j,_.cspNonce);return j}var xS=[{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"}],bS=[{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')"}],vS=[{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 Ic(v){let _=[],k=[];return wS(v,_),SS(v,_,k),$S(v,k),_S(v,_),{valid:_.length===0,errors:_,warnings:k}}function wS(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 SS(v,_,k){for(let E of xS){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 $S(v,_){for(let k of bS)if(k.pattern.test(v))_.push({type:"syntax",message:k.message,suggestion:k.suggestion})}function _S(v,_){for(let k of vS)if(k.pattern.test(v))_.push({type:"expression",message:`Security warning: ${k.message}`,suggestion:"Remove dangerous code from template expressions"})}function Oc(v,_){let k=v.slice(0,_).split(`
2061
+ `);return{line:k.length,column:k[k.length-1].length+1}}function Dc(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 Mc(v){return/@[a-z]+/i.test(v)||/\{\{/.test(v)}function Nc(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 jn from"path";import Gs from"process";var Tt=["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 Nm=new Set(Tt),kS=new Set(["props","$props","defineProps"]),ES=new Set(["stx","@stacksjs/stx"]),jm=m(128),Lm=m(64);function CS(v){let _=[],k=0,E=v.split(`
2062
2062
  `);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 H=V[1].slice(1,-1).split(",").map((Y)=>{let J=Y.split(":");return(J.length>1?J[1]:J[0]).trim()}).filter((Y)=>/^\w+$/.test(Y));_.push(...H)}}}}return[...new Set(_)]}function kc(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 U=E[V];if(F){if(j+=U,U===F)F=null;continue}if(U==='"'||U==="'"||U==="`"){F=U,j+=U;continue}if(U==="<")B++;else if(U===">"&&B>0)B--;else if(U==="(")z++;else if(U===")")z--;if(U===","&&B===0&&z===0){T.push(j),j="";continue}j+=U}if(j)T.push(j);return T.map((V)=>{let U=V.trim(),H=U.startsWith("..."),Y=H?U.slice(3):U,J=-1,re=0;for(let he=0;he<Y.length;he++)if(Y[he]==="<")re++;else if(Y[he]===">")re--;else if(Y[he]===":"&&re===0){J=he;break}if(J===-1)return V;let ie=Y.substring(0,J).trim().replace(/\?$/,""),ae=Y.substring(J+1),ce=-1,oe=0;for(let he=0;he<ae.length;he++)if(ae[he]==="<")oe++;else if(ae[he]===">")oe--;else if(ae[he]==="="&&oe===0){ce=he;break}let pe=H?"...":"";if(ce!==-1)return`${pe}${ie} = ${ae.substring(ce+1).trim()}`;return`${pe}${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,U=null;while(F<_.length&&z>0){let J=_[F];if(U){if(J===U)U=null;F++;continue}if(J==='"'||J==="'"||J==="`"){U=J,F++;continue}if(J==="<")V++;else if(J===">"&&V>0)V--;else if(V===0){if(J==="(")z++;else if(J===")")z--}if(z>0)F++}if(z!==0)continue;let H=_.substring(B+1,F);if(!H.includes(":"))continue;let Y=k(H);j.push({start:B+1,end:F,replacement:Y})}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,`
2063
2063
 
2064
- `),_}function Cc(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 Ec(v){return/cannot find module|cannot find package|could not resolve|module not found|failed to resolve/i.test(v)}function _c(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 Tc(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 Lm=new Set;async function d(v,_,k,E={}){if(!v.trim())return;let T=w(),j=h(v,JSON.stringify(T)),B=Nm.get(j);if(B===void 0){try{let De=L({loader:"ts",target:"browser",define:T}),Ye=v.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");Ye=Ye.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,""),B=De.transformSync(Ye)}catch{B=kc(v)}Nm.set(j,B)}let z={exports:{}},F=z.exports,V=Gs.cwd(),U={},H=[...B.matchAll(/require\s*\(\s*['"]([^'"]+)['"]\s*\)/g)||[]].map((De)=>De[1]).filter((De)=>!De.startsWith("node:")&&!["fs","path","os","child_process","crypto","http","https","url","util","stream","events","buffer","net","querystring","zlib","tls"].includes(De)),Y=new Map;for(let De of H)try{if(De.startsWith(".")){U[De]=await import(jn.resolve(jn.dirname(k),De));continue}let Ye=jn.resolve(V,"node_modules",De),st=jn.join(Ye,"package.json"),yt=JSON.parse(u("fs").readFileSync(st,"utf8")),It=yt.main||"index.js";if(yt.exports){let qt=typeof yt.exports==="string"?yt.exports:yt.exports["."];if(typeof qt==="string")It=qt;else if(qt?.bun)It=qt.bun;else if(qt?.import)It=qt.import;else if(qt?.default)It=qt.default}U[De]=await import(jn.resolve(Ye,It))}catch(Ye){if(De.startsWith("."))Y.set(De,Ye instanceof Error?Ye.message:String(Ye))}let J=(De)=>{if(U[De])return U[De];let Ye=Y.get(De);if(Ye!==void 0)throw Error(`Cannot require '${De}' from ${k}: ${Ye}`);return u(De)},re=_.props||{},se=(De)=>{if(!De)return re;let Ye={};for(let[st,yt]of Object.entries(De)){let It=re[st];if(It!==void 0)Ye[st]=It;else if(typeof yt==="function")Ye[st]=yt();else Ye[st]=yt}return Ye};for(let[De,Ye]of Object.entries(re))Object.defineProperty(se,De,{value:Ye,enumerable:!0,configurable:!0,writable:!0});let ie=(De,Ye=!1)=>{if(De===void 0||De===null)return Ye;if(typeof De==="string"){let st=De.trim().toLowerCase();if(st===""||st==="true"||st==="1"||st==="on"||st==="yes")return!0;if(st==="false"||st==="0"||st==="off"||st==="no")return!1;return!0}return Boolean(De)},ae=(De,Ye=0)=>{if(De===void 0||De===null)return Ye;if(typeof De==="string"){let yt=De.trim();if(yt==="")return Ye;let It=Number(yt);return Number.isFinite(It)?It:Ye}let st=Number(De);return Number.isFinite(st)?st:Ye};for(let De of["name","length","caller","arguments"]){if(Object.prototype.hasOwnProperty.call(re,De))continue;try{Object.defineProperty(se,De,{value:void 0,enumerable:!1,configurable:!0,writable:!0})}catch{}}let ce=(De)=>{if(!De)return re;let Ye={...re};for(let[st,yt]of Object.entries(De)){let It=yt&&typeof yt==="object"&&!Array.isArray(yt)?yt:{type:yt};if(Ye[st]===void 0&&It.default!==void 0)Ye[st]=typeof It.default==="function"?It.default():It.default}return Ye},oe=()=>_.slots||{},pe=(De,Ye)=>{let st={...De};for(let[yt,It]of Object.entries(Ye))if(st[yt]===void 0)if(typeof It==="function")st[yt]=It();else st[yt]=It;return st},he=(De)=>{let Ye=()=>De;return Ye.set=(st)=>{},Ye.update=(st)=>{},Ye},xe=(De)=>{let Ye,st=!1;return()=>{if(!st)try{Ye=De(),st=!0}catch{Ye=void 0}return Ye}},$e=(De)=>{},Re=(De)=>De(),Ce=(De)=>{},Ae=(De)=>{},Te=Wn(_);function _e(De){let Ye=De||{};if(Ye.title!==void 0||Ye.description!==void 0)Ne({title:Ye.title,description:Ye.description})}function Pe(De){if(!De||typeof De!=="object")return;let Ye=_.__stxClientPayload??{};Object.assign(Ye,De),_.__stxClientPayload=Ye}let Me=()=>{let De=_.__stxServeContext,Ye=_.__stxServeSearch??De?.search??"",st=De?.path??"",yt=Object.fromEntries(new URLSearchParams(Ye)),It=_.query,qt=Object.keys(yt).length>0?yt:It??{},Wr=Ye||(Object.keys(qt).length>0?`?${new URLSearchParams(qt).toString()}`:"");return{params:_.params??{},query:qt,path:st,name:"",fullPath:st+Wr,hash:"",matched:[]}},Oe=()=>({push:(De)=>{},replace:(De)=>{},back:()=>{},forward:()=>{},go:(De)=>{}}),Ie=(De)=>{let Ye=_.__stx_runtime_head||{};_.__stx_runtime_head=ge(Ye,fe(De||{},{known:ir,source:"useHead()"}))},Ne=(De)=>{Ie(ar(De||{}))},at=(De)=>({value:De}),ht=(De)=>De,dt=(De)=>({value:typeof De==="function"?De():De}),rt=(De,Ye)=>{},ft=(De)=>{},ct=(De)=>{},vt=(De)=>De?De():Promise.resolve(),ut=(De)=>(Ye,...st)=>{},wt=(De)=>{},pt=(De,Ye)=>{},Wt=(De,Ye)=>Ye,In=()=>({value:"light"}),Rn=()=>he(!1),lt=(De)=>he(!1),it=()=>he(!1),mt=()=>lt("(prefers-color-scheme: dark)"),jt=()=>lt("(prefers-color-scheme: light)"),Ft=()=>lt("(prefers-reduced-motion: reduce)"),Gt=()=>lt("(prefers-contrast: more)"),wn={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:{}},Ia=new Proxy(wn,{get(De,Ye){if(Ye in De)return De[Ye];return},set(De,Ye,st){return De[Ye]=st,!0}}),Ln={getElementById:()=>null,querySelector:()=>null,querySelectorAll:()=>[],createElement:()=>({}),createTextNode:()=>({}),body:{},head:{},documentElement:{},addEventListener:()=>{},removeEventListener:()=>{}},Pa=console;try{let De=hs(B,k),Ye=new Set(Object.keys(re)),st=Object.keys(_).filter((Qe)=>!Ye.has(Qe)&&!_S.has(Qe)&&et(Qe)),yt=st.map((Qe)=>_[Qe]);if(!st.includes("__stxServeContext"))st.push("__stxServeContext"),yt.push(void 0);if(!Ye.has("cookies")){let Qe=_.cookies??_.__stxServeContext?.cookies??{},Mt=st.indexOf("cookies");if(Mt<0)st.push("cookies"),yt.push(Qe);else yt[Mt]=Qe}let It=new Set(["async","module","exports","require","params","window","document","console","state","derived","effect"]),qt=[],Wr=[];for(let[Qe,Mt]of Object.entries(re)){if(!et(Qe))continue;if(It.has(Qe))continue;if(new RegExp(`(?:^|[\\s;{])(?:const|let|var|function)\\s+${Qe}\\b`).test(De))continue;qt.push(Qe),Wr.push(Mt)}let uo=ES(De).map((Qe)=>`module.exports.${Qe} = typeof ${Qe} !== 'undefined' ? ${Qe} : module.exports.${Qe};`).join(`
2065
- `),fo=_.params??{},po=[],ur=[];for(let Qe=0;Qe<st.length;Qe++){if(st[Qe]==="params")continue;po.push(st[Qe]),ur.push(yt[Qe])}let Fr=[...Tt,...qt,...po],Bn=`return (async () => {
2064
+ `),_}function Cc(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 Ec(v){return/cannot find module|cannot find package|could not resolve|module not found|failed to resolve/i.test(v)}function _c(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 Tc(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 Bm=new Set;async function d(v,_,k,E={}){if(!v.trim())return;let T=w(),j=h(v,JSON.stringify(T)),B=jm.get(j);if(B===void 0){try{let De=L({loader:"ts",target:"browser",define:T}),Ye=v.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");Ye=Ye.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,""),B=De.transformSync(Ye)}catch{B=kc(v)}jm.set(j,B)}let z={exports:{}},F=z.exports,V=Gs.cwd(),U={},H=[...B.matchAll(/require\s*\(\s*['"]([^'"]+)['"]\s*\)/g)||[]].map((De)=>De[1]).filter((De)=>!De.startsWith("node:")&&!["fs","path","os","child_process","crypto","http","https","url","util","stream","events","buffer","net","querystring","zlib","tls"].includes(De)),Y=new Map;for(let De of H)try{if(De.startsWith(".")){U[De]=await import(jn.resolve(jn.dirname(k),De));continue}let Ye=jn.resolve(V,"node_modules",De),st=jn.join(Ye,"package.json"),yt=JSON.parse(u("fs").readFileSync(st,"utf8")),It=yt.main||"index.js";if(yt.exports){let qt=typeof yt.exports==="string"?yt.exports:yt.exports["."];if(typeof qt==="string")It=qt;else if(qt?.bun)It=qt.bun;else if(qt?.import)It=qt.import;else if(qt?.default)It=qt.default}U[De]=await import(jn.resolve(Ye,It))}catch(Ye){if(De.startsWith("."))Y.set(De,Ye instanceof Error?Ye.message:String(Ye))}let J=(De)=>{if(U[De])return U[De];let Ye=Y.get(De);if(Ye!==void 0)throw Error(`Cannot require '${De}' from ${k}: ${Ye}`);return u(De)},re=_.props||{},se=(De)=>{if(!De)return re;let Ye={};for(let[st,yt]of Object.entries(De)){let It=re[st];if(It!==void 0)Ye[st]=It;else if(typeof yt==="function")Ye[st]=yt();else Ye[st]=yt}return Ye};for(let[De,Ye]of Object.entries(re))Object.defineProperty(se,De,{value:Ye,enumerable:!0,configurable:!0,writable:!0});let ie=(De,Ye=!1)=>{if(De===void 0||De===null)return Ye;if(typeof De==="string"){let st=De.trim().toLowerCase();if(st===""||st==="true"||st==="1"||st==="on"||st==="yes")return!0;if(st==="false"||st==="0"||st==="off"||st==="no")return!1;return!0}return Boolean(De)},ae=(De,Ye=0)=>{if(De===void 0||De===null)return Ye;if(typeof De==="string"){let yt=De.trim();if(yt==="")return Ye;let It=Number(yt);return Number.isFinite(It)?It:Ye}let st=Number(De);return Number.isFinite(st)?st:Ye};for(let De of["name","length","caller","arguments"]){if(Object.prototype.hasOwnProperty.call(re,De))continue;try{Object.defineProperty(se,De,{value:void 0,enumerable:!1,configurable:!0,writable:!0})}catch{}}let ce=(De)=>{if(!De)return re;let Ye={...re};for(let[st,yt]of Object.entries(De)){let It=yt&&typeof yt==="object"&&!Array.isArray(yt)?yt:{type:yt};if(Ye[st]===void 0&&It.default!==void 0)Ye[st]=typeof It.default==="function"?It.default():It.default}return Ye},oe=()=>_.slots||{},pe=(De,Ye)=>{let st={...De};for(let[yt,It]of Object.entries(Ye))if(st[yt]===void 0)if(typeof It==="function")st[yt]=It();else st[yt]=It;return st},he=(De)=>{let Ye=()=>De;return Ye.set=(st)=>{},Ye.update=(st)=>{},Ye},xe=(De)=>{let Ye,st=!1;return()=>{if(!st)try{Ye=De(),st=!0}catch{Ye=void 0}return Ye}},$e=(De)=>{},Re=(De)=>De(),Ce=(De)=>{},Ae=(De)=>{},Te=Wn(_);function _e(De){let Ye=De||{};if(Ye.title!==void 0||Ye.description!==void 0)Ne({title:Ye.title,description:Ye.description})}function Pe(De){if(!De||typeof De!=="object")return;let Ye=_.__stxClientPayload??{};Object.assign(Ye,De),_.__stxClientPayload=Ye}let Oe=()=>{let De=_.__stxServeContext,Ye=_.__stxServeSearch??De?.search??"",st=De?.path??"",yt=Object.fromEntries(new URLSearchParams(Ye)),It=_.query,qt=Object.keys(yt).length>0?yt:It??{},Wr=Ye||(Object.keys(qt).length>0?`?${new URLSearchParams(qt).toString()}`:"");return{params:_.params??{},query:qt,path:st,name:"",fullPath:st+Wr,hash:"",matched:[]}},Me=()=>({push:(De)=>{},replace:(De)=>{},back:()=>{},forward:()=>{},go:(De)=>{}}),Ie=(De)=>{let Ye=_.__stx_runtime_head||{};_.__stx_runtime_head=ge(Ye,fe(De||{},{known:ir,source:"useHead()"}))},Ne=(De)=>{Ie(ar(De||{}))},at=(De)=>({value:De}),ht=(De)=>De,dt=(De)=>({value:typeof De==="function"?De():De}),rt=(De,Ye)=>{},ft=(De)=>{},ct=(De)=>{},vt=(De)=>De?De():Promise.resolve(),ut=(De)=>(Ye,...st)=>{},wt=(De)=>{},pt=(De,Ye)=>{},Wt=(De,Ye)=>Ye,In=()=>({value:"light"}),Rn=()=>he(!1),lt=(De)=>he(!1),it=()=>he(!1),mt=()=>lt("(prefers-color-scheme: dark)"),jt=()=>lt("(prefers-color-scheme: light)"),Ft=()=>lt("(prefers-reduced-motion: reduce)"),Gt=()=>lt("(prefers-contrast: more)"),wn={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:{}},Ia=new Proxy(wn,{get(De,Ye){if(Ye in De)return De[Ye];return},set(De,Ye,st){return De[Ye]=st,!0}}),Ln={getElementById:()=>null,querySelector:()=>null,querySelectorAll:()=>[],createElement:()=>({}),createTextNode:()=>({}),body:{},head:{},documentElement:{},addEventListener:()=>{},removeEventListener:()=>{}},Pa=console;try{let De=hs(B,k),Ye=new Set(Object.keys(re)),st=Object.keys(_).filter((Qe)=>!Ye.has(Qe)&&!kS.has(Qe)&&et(Qe)),yt=st.map((Qe)=>_[Qe]);if(!st.includes("__stxServeContext"))st.push("__stxServeContext"),yt.push(void 0);if(!Ye.has("cookies")){let Qe=_.cookies??_.__stxServeContext?.cookies??{},Mt=st.indexOf("cookies");if(Mt<0)st.push("cookies"),yt.push(Qe);else yt[Mt]=Qe}let It=new Set(["async","module","exports","require","params","window","document","console","state","derived","effect"]),qt=[],Wr=[];for(let[Qe,Mt]of Object.entries(re)){if(!et(Qe))continue;if(It.has(Qe))continue;if(new RegExp(`(?:^|[\\s;{])(?:const|let|var|function)\\s+${Qe}\\b`).test(De))continue;qt.push(Qe),Wr.push(Mt)}let fo=CS(De).map((Qe)=>`module.exports.${Qe} = typeof ${Qe} !== 'undefined' ? ${Qe} : module.exports.${Qe};`).join(`
2065
+ `),po=_.params??{},go=[],ur=[];for(let Qe=0;Qe<st.length;Qe++){if(st[Qe]==="params")continue;go.push(st[Qe]),ur.push(yt[Qe])}let Fr=[...Tt,...qt,...go],Bn=`return (async () => {
2066
2066
  ${De}
2067
- ${uo}
2067
+ ${fo}
2068
2068
  return module.exports
2069
- })()`,Jt=h(Bn,Fr.join("\x00")),tt=jm.get(Jt);if(!tt)tt=Function(...Fr,Bn),jm.set(Jt,tt);let ot=_.__stx_options?.runtimeConfig;if(ot||/\buse(?:Server)?RuntimeConfig\b/.test(B))await pn(_,k,ot);let xt=await ue(_.__stx_runtime_config??Rt()??C(),()=>Kg(_,()=>tt(z,F,J,re,se,ie,ae,ce,pe,Pe,Xg,$s,tr,he,xe,$e,Re,Ce,Ae,_e,Me,Oe,Ie,Ne,Te.setResponseStatus,Te.setResponseHeader,Te.notFound,at,ht,dt,rt,ft,ct,vt,ut,wt,oe,pt,Wt,In,Rn,lt,it,mt,jt,Ft,Gt,Ia,Ln,Pa,wn.confirm,wn.alert,wn.fetch,fo,...Wr,...ur)));if(E.preserveExisting){for(let[Qe,Mt]of Object.entries(xt))if(!(Qe in _)||_[Qe]===void 0)_[Qe]=Mt}else Object.assign(_,xt);for(let[Qe,Mt]of Object.entries(re))if(!(Qe in _))_[Qe]=Mt}catch(De){if(_.__stx_strict_hydration)throw De;let Ye=Cc(De instanceof Error?De.message:String(De));if(Ec(Ye))console.warn(`[stx] server <script> in ${k??"<unknown>"} imports a module that does not resolve, so every variable in that script is undefined. Cause: ${Ye}`),E.onFailure?.({kind:"module-resolution",message:Ye,error:De});else if(_c(De))console.warn(`[stx] server <script> in ${k??"<unknown>"} does not parse, so every variable in that script is undefined. Cause: ${Ye}`),E.onFailure?.({kind:"syntax",message:Ye,error:De});else if(Tc(Ye))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: ${Ye}`),E.onFailure?.({kind:"missing-binding",message:Ye,error:De});else{let st=`${k??"<unknown>"}\x00${Ye}`;if(Gs.env.STX_DEBUG||!Lm.has(st))Lm.add(st),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: ${Ye}`);E.onFailure?.({kind:"unknown",message:Ye,error:De})}try{await PS(B,_,k)}catch(st){if(Gs.env.STX_DEBUG){let yt=st instanceof Error?st.message:String(st);console.warn(`[stx] fallback extraction also failed in ${k??"<unknown>"}: ${yt}`)}}}}function $c(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 CS=/^(?:export\s+)?(?:const|let|var)\s+[A-Za-z_$][\w$]*(?:\s*,\s*[A-Za-z_$][\w$]*)*\s*;?$/;function hs(v,_){let k=_?jn.dirname(_):Gs.cwd(),E=Gs.cwd(),T=v.split(`
2069
+ })()`,Jt=h(Bn,Fr.join("\x00")),tt=Lm.get(Jt);if(!tt)tt=Function(...Fr,Bn),Lm.set(Jt,tt);let ot=_.__stx_options?.runtimeConfig;if(ot||/\buse(?:Server)?RuntimeConfig\b/.test(B))await pn(_,k,ot);let xt=await ue(_.__stx_runtime_config??Rt()??C(),()=>Xg(_,()=>tt(z,F,J,re,se,ie,ae,ce,pe,Pe,Zg,$s,tr,he,xe,$e,Re,Ce,Ae,_e,Oe,Me,Ie,Ne,Te.setResponseStatus,Te.setResponseHeader,Te.notFound,at,ht,dt,rt,ft,ct,vt,ut,wt,oe,pt,Wt,In,Rn,lt,it,mt,jt,Ft,Gt,Ia,Ln,Pa,wn.confirm,wn.alert,wn.fetch,po,...Wr,...ur)));if(E.preserveExisting){for(let[Qe,Mt]of Object.entries(xt))if(!(Qe in _)||_[Qe]===void 0)_[Qe]=Mt}else Object.assign(_,xt);for(let[Qe,Mt]of Object.entries(re))if(!(Qe in _))_[Qe]=Mt}catch(De){if(_.__stx_strict_hydration)throw De;let Ye=Cc(De instanceof Error?De.message:String(De));if(Ec(Ye))console.warn(`[stx] server <script> in ${k??"<unknown>"} imports a module that does not resolve, so every variable in that script is undefined. Cause: ${Ye}`),E.onFailure?.({kind:"module-resolution",message:Ye,error:De});else if(_c(De))console.warn(`[stx] server <script> in ${k??"<unknown>"} does not parse, so every variable in that script is undefined. Cause: ${Ye}`),E.onFailure?.({kind:"syntax",message:Ye,error:De});else if(Tc(Ye))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: ${Ye}`),E.onFailure?.({kind:"missing-binding",message:Ye,error:De});else{let st=`${k??"<unknown>"}\x00${Ye}`;if(Gs.env.STX_DEBUG||!Bm.has(st))Bm.add(st),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: ${Ye}`);E.onFailure?.({kind:"unknown",message:Ye,error:De})}try{await DS(B,_,k)}catch(st){if(Gs.env.STX_DEBUG){let yt=st instanceof Error?st.message:String(st);console.warn(`[stx] fallback extraction also failed in ${k??"<unknown>"}: ${yt}`)}}}}function $c(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 RS=/^(?:export\s+)?(?:const|let|var)\s+[A-Za-z_$][\w$]*(?:\s*,\s*[A-Za-z_$][\w$]*)*\s*;?$/;function hs(v,_){let k=_?jn.dirname(_):Gs.cwd(),E=Gs.cwd(),T=v.split(`
2070
2070
  `),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,U=B;for(let J=B;J<T.length&&!V;J++){let re=null,se=!1,ie=T[J];for(let ae=0;ae<ie.length;ae++){let ce=ie[ae];if(se){se=!1;continue}if(ce==="\\"){se=!0;continue}if(re){if(ce===re)re=null;continue}if(ce==='"'||ce==="'"||ce==="`"){re=ce;continue}if(ce==="(")F++;else if(ce===")"){if(F--,F===0){B=J+1,V=!0;break}}}}if(!V)B=T.length;let H=T.slice(U,B).join(`
2071
- `),Y=[];for(let J of["title","description"]){let re=new RegExp(`\\b${J}\\s*:\\s*(['"\`])((?:\\\\.|(?!\\1)[^\\\\])*)\\1`).exec(H);if(re)Y.push(`${J}: ${JSON.stringify(re[2])}`)}if(Y.length>0)j.push(`useSeoMeta({ ${Y.join(", ")} });`);continue}if(z.startsWith("import ")||z==="import"||z.startsWith("import{")){let F=z,V=0;while(!$c(F)&&B+V+1<T.length)V++,F=`${F} ${T[B+V].trim()}`;B+=V;let U=F.match(/^import\s+(\w+)\s+from\s+['"](.+?)['"]/),H=F.match(/^import\s+\{([^}]*)\}\s+from\s+['"](.+?)['"]/),Y=F.match(/^import\s+['"](.+?)['"]/),J=F,re=(se)=>{if(se.startsWith("."))return jn.resolve(k,se);if(se.startsWith("~/")||se.startsWith("@/"))return jn.resolve(E,se.slice(2));try{return Bun.resolveSync(se,k)}catch{return se}};if(U){let[,se,ie]=U,ae=re(ie);j.push(`const ${se} = (await import('${ae}')).default`),j.push(`module.exports.${se} = ${se};`)}else if(H){let[,se,ie]=H,ae=re(ie),ce=[],oe=[],pe=kS.has(ie);for(let he of se.split(",")){let xe=he.trim();if(!xe)continue;let $e=xe.split(/\s+as\s+/);if($e.length===2){let[Re,Ce]=[$e[0].trim(),$e[1].trim()];if(pe&&Mm.has(Re)){j.push(`const ${Ce} = ${Re};`);continue}ce.push(`${Re}: ${Ce}`),oe.push(Ce)}else{if(pe&&Mm.has(xe))continue;ce.push(xe),oe.push(xe)}}if(ce.length>0)j.push(`const { ${ce.join(", ")} } = await import('${ae}')`);for(let he of oe)j.push(`module.exports.${he} = ${he};`)}else if(Y){let se=re(Y[1]);j.push(`await import('${se}')`)}else j.push(J);B++;continue}if(CS.test(z))j.push(T[B]),B++;else if(z.startsWith("export const ")||z.startsWith("export let ")||z.startsWith("export var ")){let F=zm(T,B),{type:V,name:U,value:H}=F;j.push(`${V} ${U} = ${H};`),j.push(`module.exports.${U} = ${U};`),B=F.nextIndex}else if(z.startsWith("export function ")||z.startsWith("export async function ")){let F=Ql(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=zm(T,B),{type:V,name:U,value:H}=F;j.push(`${V} ${U} = ${H};`),j.push(`module.exports.${U} = ${U};`),B=F.nextIndex}else if(z.startsWith("function ")||z.startsWith("async function ")){let F=Ql(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 U=Ql(V,B);if(j.push(U.functionCode),U.name)j.push(`module.exports.default = ${U.name};`);B=U.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],U=T[B].replace(/^export\s+/,""),H=0,Y=B;for(;Y<T.length;Y++){let J=T[Y];for(let re of J)if(re==="{")H++;else if(re==="}")H--;if(Y>B)U+=`
2072
- `+J;if(H<=0&&Y>=B)break}j.push(U),j.push(`module.exports.${V} = ${V};`),B=Y+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 RS(j.join(`
2073
- `),k,E)}function RS(v,_,k){let E=v.length,T="",j=0,B=null,z=!1,F=!1,V=0;while(j<E){let U=v[j],H=v[j+1];if(z){if(T+=U,U===`
2074
- `)z=!1;j++;continue}if(F){if(T+=U,U==="*"&&H==="/"){T+=H,j+=2,F=!1;continue}j++;continue}if(!B&&U==="/"&&H==="/"){z=!0,T+=U,j++;continue}if(!B&&U==="/"&&H==="*"){F=!0,T+=U,j++;continue}if(B){if(T+=U,U==="\\"){T+=H,j+=2;continue}if(U===B&&B!=="`"){B=null,j++;continue}if(B==="`"){if(U==="$"&&H==="{"){V++,T+=H,j+=2;continue}if(U==="`"){B=null,j++;continue}}j++;continue}if(V>0){if(U==="{")V++;else if(U==="}")V--}if(U==='"'||U==="'"||U==="`"){B=U,T+=U,j++;continue}if(U==="a"&&v.startsWith("await",j)){let Y=AS(v,j);if(Y){let{quote:J,path:re,end:se}=Y;if(re.startsWith(".")||re.startsWith("~/")||re.startsWith("@/")){let ie=re.startsWith(".")?jn.resolve(_,re):jn.resolve(k,re.slice(2));T+=`await import(${J}${ie}${J})`,j=se;continue}}}T+=U,j++}return T}function AS(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 Um(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 Hm(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?Um(k,E):null;if(z){_.push(...Hm(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 Rc(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 Bm(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 zm(v,_){let k=v[_].trim(),E=Rc(k),T=E?[k,E.type,E.name,E.value]:null;if(!T){let U=k.match(/^(?:export\s+)?(const|let|var)\s+/);if(U){let H=k.slice(U[0].length),Y=_;if(H.startsWith("{")||H.startsWith("[")){let re=H[0],se=re==="{"?"}":"]",ie=Bm(H,re,se,0),ae=H;for(let ce=_+1;ce<v.length&&ie>0;ce++)ae+=` ${v[ce].trim()}`,Y=ce,ie=Bm(v[ce],re,se,ie);if(ie>0)ae=H,Y=_;H=ae}let J=Um(H,0);if(J){let re=U[1],se=J.pattern,ie=H.slice(J.endPos).trim();if(ie.startsWith("=")){let ae=ie.slice(1).trim(),ce=ae,oe=Math.max(Y,_);if(Wm(ae)){let $e=Fm(v,oe,ae);ce=$e.value,oe=$e.nextIndex}else oe=oe+1;ce=ce.trim().replace(/;$/,"");let pe=Hm(se),he=`__stx_src_${_}`,xe=pe.map(($e)=>`module.exports.${$e} = ${$e};`).join(`
2071
+ `),Y=[];for(let J of["title","description"]){let re=new RegExp(`\\b${J}\\s*:\\s*(['"\`])((?:\\\\.|(?!\\1)[^\\\\])*)\\1`).exec(H);if(re)Y.push(`${J}: ${JSON.stringify(re[2])}`)}if(Y.length>0)j.push(`useSeoMeta({ ${Y.join(", ")} });`);continue}if(z.startsWith("import ")||z==="import"||z.startsWith("import{")){let F=z,V=0;while(!$c(F)&&B+V+1<T.length)V++,F=`${F} ${T[B+V].trim()}`;B+=V;let U=F.match(/^import\s+(\w+)\s+from\s+['"](.+?)['"]/),H=F.match(/^import\s+\{([^}]*)\}\s+from\s+['"](.+?)['"]/),Y=F.match(/^import\s+['"](.+?)['"]/),J=F,re=(se)=>{if(se.startsWith("."))return jn.resolve(k,se);if(se.startsWith("~/")||se.startsWith("@/"))return jn.resolve(E,se.slice(2));try{return Bun.resolveSync(se,k)}catch{return se}};if(U){let[,se,ie]=U,ae=re(ie);j.push(`const ${se} = (await import('${ae}')).default`),j.push(`module.exports.${se} = ${se};`)}else if(H){let[,se,ie]=H,ae=re(ie),ce=[],oe=[],pe=ES.has(ie);for(let he of se.split(",")){let xe=he.trim();if(!xe)continue;let $e=xe.split(/\s+as\s+/);if($e.length===2){let[Re,Ce]=[$e[0].trim(),$e[1].trim()];if(pe&&Nm.has(Re)){j.push(`const ${Ce} = ${Re};`);continue}ce.push(`${Re}: ${Ce}`),oe.push(Ce)}else{if(pe&&Nm.has(xe))continue;ce.push(xe),oe.push(xe)}}if(ce.length>0)j.push(`const { ${ce.join(", ")} } = await import('${ae}')`);for(let he of oe)j.push(`module.exports.${he} = ${he};`)}else if(Y){let se=re(Y[1]);j.push(`await import('${se}')`)}else j.push(J);B++;continue}if(RS.test(z))j.push(T[B]),B++;else if(z.startsWith("export const ")||z.startsWith("export let ")||z.startsWith("export var ")){let F=Wm(T,B),{type:V,name:U,value:H}=F;j.push(`${V} ${U} = ${H};`),j.push(`module.exports.${U} = ${U};`),B=F.nextIndex}else if(z.startsWith("export function ")||z.startsWith("export async function ")){let F=Ql(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=Wm(T,B),{type:V,name:U,value:H}=F;j.push(`${V} ${U} = ${H};`),j.push(`module.exports.${U} = ${U};`),B=F.nextIndex}else if(z.startsWith("function ")||z.startsWith("async function ")){let F=Ql(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 U=Ql(V,B);if(j.push(U.functionCode),U.name)j.push(`module.exports.default = ${U.name};`);B=U.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],U=T[B].replace(/^export\s+/,""),H=0,Y=B;for(;Y<T.length;Y++){let J=T[Y];for(let re of J)if(re==="{")H++;else if(re==="}")H--;if(Y>B)U+=`
2072
+ `+J;if(H<=0&&Y>=B)break}j.push(U),j.push(`module.exports.${V} = ${V};`),B=Y+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 AS(j.join(`
2073
+ `),k,E)}function AS(v,_,k){let E=v.length,T="",j=0,B=null,z=!1,F=!1,V=0;while(j<E){let U=v[j],H=v[j+1];if(z){if(T+=U,U===`
2074
+ `)z=!1;j++;continue}if(F){if(T+=U,U==="*"&&H==="/"){T+=H,j+=2,F=!1;continue}j++;continue}if(!B&&U==="/"&&H==="/"){z=!0,T+=U,j++;continue}if(!B&&U==="/"&&H==="*"){F=!0,T+=U,j++;continue}if(B){if(T+=U,U==="\\"){T+=H,j+=2;continue}if(U===B&&B!=="`"){B=null,j++;continue}if(B==="`"){if(U==="$"&&H==="{"){V++,T+=H,j+=2;continue}if(U==="`"){B=null,j++;continue}}j++;continue}if(V>0){if(U==="{")V++;else if(U==="}")V--}if(U==='"'||U==="'"||U==="`"){B=U,T+=U,j++;continue}if(U==="a"&&v.startsWith("await",j)){let Y=TS(v,j);if(Y){let{quote:J,path:re,end:se}=Y;if(re.startsWith(".")||re.startsWith("~/")||re.startsWith("@/")){let ie=re.startsWith(".")?jn.resolve(_,re):jn.resolve(k,re.slice(2));T+=`await import(${J}${ie}${J})`,j=se;continue}}}T+=U,j++}return T}function TS(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 Hm(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 qm(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?Hm(k,E):null;if(z){_.push(...qm(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 Rc(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 zm(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 Wm(v,_){let k=v[_].trim(),E=Rc(k),T=E?[k,E.type,E.name,E.value]:null;if(!T){let U=k.match(/^(?:export\s+)?(const|let|var)\s+/);if(U){let H=k.slice(U[0].length),Y=_;if(H.startsWith("{")||H.startsWith("[")){let re=H[0],se=re==="{"?"}":"]",ie=zm(H,re,se,0),ae=H;for(let ce=_+1;ce<v.length&&ie>0;ce++)ae+=` ${v[ce].trim()}`,Y=ce,ie=zm(v[ce],re,se,ie);if(ie>0)ae=H,Y=_;H=ae}let J=Hm(H,0);if(J){let re=U[1],se=J.pattern,ie=H.slice(J.endPos).trim();if(ie.startsWith("=")){let ae=ie.slice(1).trim(),ce=ae,oe=Math.max(Y,_);if(Fm(ae)){let $e=Vm(v,oe,ae);ce=$e.value,oe=$e.nextIndex}else oe=oe+1;ce=ce.trim().replace(/;$/,"");let pe=qm(se),he=`__stx_src_${_}`,xe=pe.map(($e)=>`module.exports.${$e} = ${$e};`).join(`
2075
2075
  `);return{type:re,name:he,value:`${ce}; ${re} ${se} = ${he};
2076
- ${xe}`,nextIndex:oe}}}}throw Error(`Failed to parse variable declaration: ${k}`)}let[,j,B,z]=T,F=z,V=_;if(Wm(z)){let U=Fm(v,_,z);F=U.value,V=U.nextIndex}else V=_+1;while(V<v.length){let U=v[V].trim();if(U.startsWith(".")||U.startsWith("?."))F+=`
2077
- ${v[V]}`,V++;else break}return F=F.trim().replace(/;$/,""),{type:j,name:B,value:F,nextIndex:V}}function Ql(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(TS(k)){let z=IS(v,_,j);j=z.functionCode,B=z.nextIndex}else B=_+1;return{name:T,functionCode:j,nextIndex:B}}function Wm(v){let _=v.trim();if(_.startsWith("{"))return S(_,"{","}",0)===-1;if(_.startsWith("["))return S(_,"[","]",0)===-1;return!qm(_)}function qm(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 Km(v){let _=v.indexOf("(");if(_===-1)return v.indexOf("{");let k=S(v,"(",")",_);if(k===-1)return-1;return v.indexOf("{",k)}function TS(v){let _=Km(v);if(_===-1)return!0;return S(v,"{","}",_)===-1}function Fm(v,_,k){let E=k,T=_+1;while(T<v.length&&!qm(E)){let j=v[T];E+=`
2076
+ ${xe}`,nextIndex:oe}}}}throw Error(`Failed to parse variable declaration: ${k}`)}let[,j,B,z]=T,F=z,V=_;if(Fm(z)){let U=Vm(v,_,z);F=U.value,V=U.nextIndex}else V=_+1;while(V<v.length){let U=v[V].trim();if(U.startsWith(".")||U.startsWith("?."))F+=`
2077
+ ${v[V]}`,V++;else break}return F=F.trim().replace(/;$/,""),{type:j,name:B,value:F,nextIndex:V}}function Ql(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(IS(k)){let z=PS(v,_,j);j=z.functionCode,B=z.nextIndex}else B=_+1;return{name:T,functionCode:j,nextIndex:B}}function Fm(v){let _=v.trim();if(_.startsWith("{"))return S(_,"{","}",0)===-1;if(_.startsWith("["))return S(_,"[","]",0)===-1;return!Km(_)}function Km(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 Xm(v){let _=v.indexOf("(");if(_===-1)return v.indexOf("{");let k=S(v,"(",")",_);if(k===-1)return-1;return v.indexOf("{",k)}function IS(v){let _=Xm(v);if(_===-1)return!0;return S(v,"{","}",_)===-1}function Vm(v,_,k){let E=k,T=_+1;while(T<v.length&&!Km(E)){let j=v[T];E+=`
2078
2078
  ${j}`,T++}while(T<v.length){let j=v[T].trim();if(j.startsWith(".")||j.startsWith("?."))E+=`
2079
- ${v[T]}`,T++;else break}return{value:E,nextIndex:T}}function IS(v,_,k){let E=k,T=_+1;while(T<v.length){let j=Km(E);if(j!==-1){if(S(E,"{","}",j)!==-1)break}let B=v[T];E+=`
2080
- ${B}`,T++}return{functionCode:E,nextIndex:T}}function Vm(v,_){let k=l(v,_)??l(`(${v})`,_);if(k!==void 0)return k;if(!/\bprocess\b/.test(v))return;let E={..._,process:Object.freeze({env:{...Gs.env}})},T=Object.keys(E).filter(et),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 PS(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=Vm(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=Vm(F,_);if(V!==void 0)_[B]=V}catch{}}}function pi(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 fi(v){let _=v.trim();if(!_)return!1;return/(?:const|let|var|function)\s+\w+/.test(_)}var oo=new M(500),Sa=new M(1000),iu=new M(2000),ou=new M(500),th=33554432,au=th;function DS(v){let _=v.componentRenderCacheBytes;if(typeof _!=="number"||_<0||_===au)return;au=_,$a.setMaxBytes(_)}var $a=new M(2000,{maxBytes:th,sizeOf:(v)=>v.output.length});function OS(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 MS(v){let _={};for(let[k,E]of Object.entries(v))if(!k.startsWith("__")||k==="__stxServeContext")_[k]=E;return _}function Xm(v){return v.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Lc(v){return/\bjs\b/.test(v)||/\blang\s*=\s*["']?(js|javascript)["']?/i.test(v)}function qe(v){return!Lc(v)}var wa=new Map;function L(v){let _;try{_=JSON.stringify(v)}catch{return new Bun.Transpiler(v)}let k=wa.get(_);if(k)return k;if(wa.size>=16)wa.clear();let E=new Bun.Transpiler(v);return wa.set(_,E),E}var Zm=new WeakMap,NS=256;function Ge(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>=NS){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 jS(v){let _=[],k=new Set,E=0,T=0,j=v.length,B=(U)=>{T++;while(T<j){if(v[T]==="\\"){T+=2;continue}if(v[T]===U){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 U=1;while(T<j&&U>0)if(v[T]==="{")U++,T++;else if(v[T]==="}")U--,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]!==`
2081
- `)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 U=v.slice(T).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(U){let re=U[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 H=v.slice(T).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(H){let re=H[2];if(!k.has(re))_.push(re),k.add(re);return}let Y=v.slice(T).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(Y){let re=Y[1];if(!k.has(re))_.push(re),k.add(re);return}let J=v.slice(T).match(/^async\s+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)}};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 LS(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 BS(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 zS(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 LS(z)){let V=F.trim();if(!V||V.startsWith("..."))continue;let U=BS(V);if(U===-1)continue;let H=V.slice(0,U).trim();if(!/^[A-Z_$][\w$]*$/i.test(H))continue;if(_[H]!==void 0)continue;let Y=V.slice(U+1).trim();if(!Y)continue;try{let J=Object.keys(_).filter(et),re=Function(...J,`"use strict"; return (${Y});`);_[H]=re(...J.map((se)=>_[se]))}catch{}}}catch{}}var WS=new Set(["tr","td","th","thead","tbody","tfoot","caption","colgroup","col","option","optgroup","li","dt","dd","span"]);function jc(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(!WS.has(E))return null;let T=new RegExp(`<\\/?${E}(?=[\\s/>])(?:[^>"']|"[^"]*"|'[^']*')*>`,"iy"),j=gr(v,(V,U)=>(T.lastIndex=U,T.exec(V)?.index===U?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 Jn(v,_,k,E,T){let j=v.endsWith(".stx")?v.slice(0,-4):v,B=(pe)=>pe.split("-").map((he)=>he.charAt(0).toUpperCase()+he.slice(1)).join(""),z=k.__importedComponents;if(z){for(let pe of[j,j.toLowerCase(),B(j),tn(j)])if(z.has(pe))return!0}let F=[...new Set([`${j}.stx`,`${B(j)}.stx`,`${tn(j)}.stx`])],V=typeof T.root==="string"?nt.resolve(T.root):void 0,U=V??nt.dirname(E),H=[],Y=(pe)=>{if(pe&&!H.includes(pe))H.push(pe)},J=k.__originalFilePath;if(J)Y(nt.join(nt.dirname(J),"components"));Y(_),Y(T._rootComponentsDir),Y(nt.join(nt.dirname(E),"components")),Y(T.componentsDir);for(let pe of T._targetComponentDirs??[])Y(pe);if(V)Y(nt.resolve(V,"resources/views/components")),Y(nt.resolve(V,"resources/components")),Y(nt.resolve(V,"src/components")),Y(nt.resolve(V,"components"));for(let pe of T._layerComponentDirs??[])Y(pe);let re=T._pluginComponentDirs;if(Array.isArray(re))for(let pe of re)Y(typeof pe==="string"?pe:null);if(Y(T.fallbackComponentsDir),j.startsWith("./")||j.startsWith("../"))return r(nt.resolve(nt.dirname(E),`${j}.stx`));let se=Gm(nt.resolve(import.meta.dir,"components")),ie=H.map((pe)=>nt.isAbsolute(pe)?pe:nt.resolve(U,pe)),ae=`${F.join("\x00")}\x00\x00${ie.join("\x00")}`,ce=iu.get(ae);if(ce!==void 0)return ce;let oe=!1;e:for(let pe of ie){if(Gm(pe)===se)continue;for(let he of F)if(await r(nt.join(pe,he))){oe=!0;break e}}return iu.set(ae,oe),oe}function Gm(v){let _=ou.get(v);if(_!==void 0)return _;let k=v;try{k=eh.realpathSync(v)}catch{}return ou.set(v,k),k}function Bc(v){return v==="visible"||v==="idle"||v==="interaction"||v.startsWith("media:")}function yi(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 FS(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 Jm=new Set;function Ym(v,_,k,E){let T=`${v}\x00${_}\x00${E??""}`;if(!process.env.STX_DEBUG&&Jm.has(T))return;Jm.add(T);let j=_?` used in ${_}`:"",B=E?` Cause: ${E}.`:"",z=k.length>0?`
2079
+ ${v[T]}`,T++;else break}return{value:E,nextIndex:T}}function PS(v,_,k){let E=k,T=_+1;while(T<v.length){let j=Xm(E);if(j!==-1){if(S(E,"{","}",j)!==-1)break}let B=v[T];E+=`
2080
+ ${B}`,T++}return{functionCode:E,nextIndex:T}}function Um(v,_){let k=l(v,_)??l(`(${v})`,_);if(k!==void 0)return k;if(!/\bprocess\b/.test(v))return;let E={..._,process:Object.freeze({env:{...Gs.env}})},T=Object.keys(E).filter(et),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 DS(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=Um(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=Um(F,_);if(V!==void 0)_[B]=V}catch{}}}function pi(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 fi(v){let _=v.trim();if(!_)return!1;return/(?:const|let|var|function)\s+\w+/.test(_)}var ao=new M(500),Sa=new M(1000),iu=new M(2000),ou=new M(500),nh=33554432,au=nh;function MS(v){let _=v.componentRenderCacheBytes;if(typeof _!=="number"||_<0||_===au)return;au=_,$a.setMaxBytes(_)}var $a=new M(2000,{maxBytes:nh,sizeOf:(v)=>v.output.length});function OS(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 NS(v){let _={};for(let[k,E]of Object.entries(v))if(!k.startsWith("__")||k==="__stxServeContext")_[k]=E;return _}function Zm(v){return v.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Lc(v){return/\bjs\b/.test(v)||/\blang\s*=\s*["']?(js|javascript)["']?/i.test(v)}function qe(v){return!Lc(v)}var wa=new Map;function L(v){let _;try{_=JSON.stringify(v)}catch{return new Bun.Transpiler(v)}let k=wa.get(_);if(k)return k;if(wa.size>=16)wa.clear();let E=new Bun.Transpiler(v);return wa.set(_,E),E}var Gm=new WeakMap,jS=256;function Ge(v){try{let _=L({loader:"ts",target:"browser",define:w()}),k=Gm.get(_);if(!k)k=new Map,Gm.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>=jS){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 LS(v){let _=[],k=new Set,E=0,T=0,j=v.length,B=(U)=>{T++;while(T<j){if(v[T]==="\\"){T+=2;continue}if(v[T]===U){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 U=1;while(T<j&&U>0)if(v[T]==="{")U++,T++;else if(v[T]==="}")U--,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]!==`
2081
+ `)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 U=v.slice(T).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(U){let re=U[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 H=v.slice(T).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(H){let re=H[2];if(!k.has(re))_.push(re),k.add(re);return}let Y=v.slice(T).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(Y){let re=Y[1];if(!k.has(re))_.push(re),k.add(re);return}let J=v.slice(T).match(/^async\s+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)}};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 BS(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 zS(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 WS(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 BS(z)){let V=F.trim();if(!V||V.startsWith("..."))continue;let U=zS(V);if(U===-1)continue;let H=V.slice(0,U).trim();if(!/^[A-Z_$][\w$]*$/i.test(H))continue;if(_[H]!==void 0)continue;let Y=V.slice(U+1).trim();if(!Y)continue;try{let J=Object.keys(_).filter(et),re=Function(...J,`"use strict"; return (${Y});`);_[H]=re(...J.map((se)=>_[se]))}catch{}}}catch{}}var FS=new Set(["tr","td","th","thead","tbody","tfoot","caption","colgroup","col","option","optgroup","li","dt","dd","span"]);function jc(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(!FS.has(E))return null;let T=new RegExp(`<\\/?${E}(?=[\\s/>])(?:[^>"']|"[^"]*"|'[^']*')*>`,"iy"),j=gr(v,(V,U)=>(T.lastIndex=U,T.exec(V)?.index===U?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 Jn(v,_,k,E,T){let j=v.endsWith(".stx")?v.slice(0,-4):v,B=(pe)=>pe.split("-").map((he)=>he.charAt(0).toUpperCase()+he.slice(1)).join(""),z=k.__importedComponents;if(z){for(let pe of[j,j.toLowerCase(),B(j),tn(j)])if(z.has(pe))return!0}let F=[...new Set([`${j}.stx`,`${B(j)}.stx`,`${tn(j)}.stx`])],V=typeof T.root==="string"?nt.resolve(T.root):void 0,U=V??nt.dirname(E),H=[],Y=(pe)=>{if(pe&&!H.includes(pe))H.push(pe)},J=k.__originalFilePath;if(J)Y(nt.join(nt.dirname(J),"components"));Y(_),Y(T._rootComponentsDir),Y(nt.join(nt.dirname(E),"components")),Y(T.componentsDir);for(let pe of T._targetComponentDirs??[])Y(pe);if(V)Y(nt.resolve(V,"resources/views/components")),Y(nt.resolve(V,"resources/components")),Y(nt.resolve(V,"src/components")),Y(nt.resolve(V,"components"));for(let pe of T._layerComponentDirs??[])Y(pe);let re=T._pluginComponentDirs;if(Array.isArray(re))for(let pe of re)Y(typeof pe==="string"?pe:null);if(Y(T.fallbackComponentsDir),j.startsWith("./")||j.startsWith("../"))return r(nt.resolve(nt.dirname(E),`${j}.stx`));let se=Jm(nt.resolve(import.meta.dir,"components")),ie=H.map((pe)=>nt.isAbsolute(pe)?pe:nt.resolve(U,pe)),ae=`${F.join("\x00")}\x00\x00${ie.join("\x00")}`,ce=iu.get(ae);if(ce!==void 0)return ce;let oe=!1;e:for(let pe of ie){if(Jm(pe)===se)continue;for(let he of F)if(await r(nt.join(pe,he))){oe=!0;break e}}return iu.set(ae,oe),oe}function Jm(v){let _=ou.get(v);if(_!==void 0)return _;let k=v;try{k=th.realpathSync(v)}catch{}return ou.set(v,k),k}function Bc(v){return v==="visible"||v==="idle"||v==="interaction"||v.startsWith("media:")}function yi(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 VS(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 Ym=new Set;function Qm(v,_,k,E){let T=`${v}\x00${_}\x00${E??""}`;if(!process.env.STX_DEBUG&&Ym.has(T))return;Ym.add(T);let j=_?` used in ${_}`:"",B=E?` Cause: ${E}.`:"",z=k.length>0?`
2082
2082
  searched:
2083
2083
  ${k.map((F)=>` - ${F}`).join(`
2084
- `)}`:"";console.error(`[stx] component <${v}> could not be resolved${j}, so it rendered as nothing.${B}${z}`)}function Qm(v){return`<!-- stx: component "${v.replace(/--+/g,"-")}" could not be resolved; see the server log -->`}function Fc(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 Ke(v,_,k,E,T,j,B,z=new Set,F,V=yr(T),U,H=v){let{extractVariables:Y}=await gt("stx/variable-extractor",()=>import("./chunk-4b7y1p7f.js")),J=z??new Set;if(J.has(v))return`[Circular component reference: ${v}]`;let re=new Set(J);re.add(v);let se=typeof _.client==="string"?_.client.trim():"";if("client"in _)delete _.client;let ie=se&&se!=="load"&&Bc(se)?se:"";try{let ae=(tt)=>tt.split("-").map((ot)=>ot.charAt(0).toUpperCase()+ot.slice(1)).join(""),ce=H.endsWith(".stx")?H.slice(0,-4):H,oe=null,pe=T.__importedComponents;if(pe){let tt=[ce,ce.toLowerCase(),ae(ce),tn(ce)];for(let ot of tt)if(pe.has(ot)){oe=pe.get(ot);break}}let he=[];if(!oe){let tt=[`${ce}.stx`,`${ae(ce)}.stx`,`${tn(ce)}.stx`],ot=[...new Set(tt)],xt=T.__originalFilePath,Qe=[];if(Qe.push(...B._layerComponentDirs??[]),xt){let Nt=nt.join(nt.dirname(xt),"components");Qe.push(Nt)}if(E)Qe.push(E);let Mt=B._rootComponentsDir;if(typeof Mt==="string"&&!Qe.includes(Mt))Qe.push(Mt);let Vt=nt.join(nt.dirname(j),"components");if(!Qe.includes(Vt))Qe.push(Vt);if(B.componentsDir&&B.componentsDir!==E&&!Qe.includes(B.componentsDir))Qe.push(B.componentsDir);for(let Nt of B._targetComponentDirs??[])if(Nt&&!Qe.includes(Nt))Qe.push(Nt);let nn=typeof B.root==="string"?nt.resolve(B.root):void 0,Vr=nn??nt.dirname(j),An=[];if(nn)An.push(nt.resolve(nn,"resources/views/components")),An.push(nt.resolve(nn,"resources/components")),An.push(nt.resolve(nn,"src/components")),An.push(nt.resolve(nn,"components"));An.push(nt.resolve(import.meta.dir,"components"));for(let Nt of An)if(!Qe.includes(Nt))Qe.push(Nt);let go=B._pluginComponentDirs;if(Array.isArray(go)){for(let Nt of go)if(typeof Nt==="string"&&!Qe.includes(Nt))Qe.push(Nt)}if(B.fallbackComponentsDir&&!Qe.includes(B.fallbackComponentsDir))Qe.push(B.fallbackComponentsDir);let Qs=[...new Set(Qe.map((Nt)=>{if(!Nt)return Nt;return nt.isAbsolute(Nt)?Nt:nt.resolve(Vr,Nt)}))];Qe.length=0,Qe.push(...Qs);let Ur=`${ce}\x00${j}\x00${Qs.join("\x00")}`,Hr=Sa.get(Ur);if(Hr)if(await r(Hr))oe=Hr;else Sa.delete(Ur);if(!oe&&(ce.startsWith("./")||ce.startsWith("../")))oe=nt.resolve(nt.dirname(j),`${ce}.stx`),he.push(oe);else if(!oe)for(let Nt of Qe){if(!Nt)continue;for(let qr of ot){let mo=nt.join(Nt,qr);if(he.push(mo),await r(mo)){oe=mo;break}}if(oe)break;if(!oe)try{let qr=await import("fs");if(!qr.statSync(Nt,{throwIfNoEntry:!1})?.isDirectory())continue;let Sh=8,Oa=[{path:Nt,depth:0}];while(Oa.length>0&&!oe){let ho=Oa.pop();if(ho.depth>=Sh)continue;let _u;try{_u=qr.readdirSync(ho.path,{withFileTypes:!0})}catch{continue}for(let yo of _u){if(!yo.isDirectory())continue;if(yo.name==="node_modules"||yo.name.startsWith("."))continue;let ku=nt.join(ho.path,yo.name);for(let $h of ot){let Ma=nt.join(ku,$h);if(he.push(Ma),await r(Ma)){oe=Ma;break}}if(oe)break;Oa.push({path:ku,depth:ho.depth+1})}}}catch{}if(oe)break}if(oe)Sa.set(Ur,oe)}if(!oe||!await r(oe))return Ym(v,j,he),Qm(v);F.add(oe);let xe;if(oo.has(oe))xe=oo.get(oe);else try{xe=await Bun.file(oe).text(),oo.set(oe,xe)}catch(tt){let ot=tt instanceof Error?tt.message:String(tt);return Ym(v,j,[oe],ot),Qm(v)}if(U)for(let tt of Object.keys(_)){let ot=tt.toLowerCase();if(ot.startsWith("aria-")||ot.startsWith("data-"))continue;let xt=tt.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(new RegExp(`\\b${xt}\\b`).test(xe))U.declaredProps.add(tt)}let $e=new Set(["__originalFilePath","__importedComponents",ko,"__stx_client_signal_names","__stx_client_declared_names","__stx_runtime_config","__stxServeContext","__stx_scope_seq"]),Re={};for(let[tt,ot]of Object.entries(T))if(!tt.startsWith("__")||$e.has(tt))Re[tt]=ot;let Ce=V.length>0?{[Po]:[...V]}:{},Ae=k;if(k.includes("@include")){let{processIncludes:tt}=await gt("stx/includes",()=>import("./chunk-g1c3davk.js"));Ae=await tt(k,T,j,B,F)}if(/<[A-Z][\w.-]*[\s/>]/.test(Ae)){let{processComponents:tt}=await gt("stx/component-renderer",()=>import("./chunk-q3sn0xc1.js"));Ae=await tt(Ae,{...T,__processedComponents:J,...Ce},j,B,F)}let Te=[];if(yi(Ae)){let{processExpressions:tt}=await gt("stx/expressions",()=>import("./chunk-kmvyfwr3.js")),ot=T.__stx_signals_gate===void 0?{...T,__stx_signals_gate:!0,...Ce}:V.length>0?{...T,...Ce}:T;Ae=tt(Ae,ot,j);for(let xt of Ae.matchAll(/\{\{([\s\S]*?)\}\}/g))Te.push(xt[1].trim())}let _e=$n(Ae),Pe=[],Me=_e.output.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(tt,ot)=>{let xt=_e.scripts[Number(ot)]||"",Qe=xt.match(/^<script\b([^>]*)>/i)?.[1]||"",Mt=Qe.match(/\btype\s*=\s*["']([^"']+)["']/i)?.[1]?.toLowerCase(),Vt=!Mt||["module","text/javascript","application/javascript"].includes(Mt),nn=/\sdata-stx-(?:owner|instance)(?=[\s=/>])/i.test(` ${Qe}`);if(!/\bserver\b/i.test(Qe)&&Vt&&!nn)return Pe.push(xt),"";return xt}),{extractSlotContent:Oe}=await gt("stx/slots",()=>import("./chunk-2q624ng4.js")),Ie=Oe(Me),Ne={};if(Ie.defaultSlot?.trim())Ne.default=Ie.defaultSlot;for(let[tt,ot]of Ie.namedSlots)Ne[tt]=ot.content;let at=T.__stx_scope_seq??={n:0,key:Bun.hash(String(T.__filename??j)).toString(36).slice(0,6)},dt=`stx_${(v.endsWith(".stx")?v.slice(0,-4):v).replace(/[^a-zA-Z0-9]/g,"_")}_${++at.n}_${at.key}`,rt={...Re,$uid:dt,..._,props:_,slot:Me,$slots:Ne,__processedComponents:re,__sections:{},__stx_signals_gate:be(xe)||yi(k),__stx_preserved_client_expressions:[...Array.isArray(T.__stx_preserved_client_expressions)?T.__stx_preserved_client_expressions:[],...Te]};zS(xe,rt);let ft=xe,ct=Q(ft);if(ct)ft=ct.content.trim();let vt=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,ut=[...xe.matchAll(vt)],wt=[],pt=null,Wt=ut.some((tt)=>/\bserver\b/.test(tt[1]||"")&&/\bcache\b/.test(tt[1]||"")),In=null,Rn=null,lt=null,it=0,mt=null;if(DS(B),Wt&&au>0){let tt=OS({props:_,slot:Ae,slotContext:k.trim()?MS(Re):void 0,buildMode:B.buildMode??"",skipEventDirectives:B.skipEventDirectives===!0,clientLoopNames:[...V].sort(),layers:B._layerGraph?.layers.map((ot)=>ot.configFile),uid:dt});if(tt!==null){In=`${oe}\x00${h(xe)}\x00${tt}`;let ot=$a.get(In);if(ot){for(let xt of ot.dependencies)F.add(xt);if(pd(T,ot.clientFactories),at.n+=ot.uidsConsumed,ot.preservedClientExpressions.length>0){let xt=new Set(Array.isArray(T.__stx_preserved_client_expressions)?T.__stx_preserved_client_expressions:[]);for(let Qe of ot.preservedClientExpressions)xt.add(Qe);T.__stx_preserved_client_expressions=[...xt]}return ot.output}Rn=new Set(F),lt=dd(T),it=at.n,mt=new Set(Array.isArray(T.__stx_preserved_client_expressions)?T.__stx_preserved_client_expressions:[])}}let jt=new Set;for(let tt of ut){let ot=tt[1]||"",xt=tt[2]||"",Qe=ot.includes("server");if(qe(ot)&&xt.trim())xt=Ge(xt);if(Qe&&xt){for(let Vt of ee(xt))jt.add(Vt);try{await Y(xt,rt,oe,{onFailure:(Vt)=>{if(Vt.kind!=="unknown")pt=Vt.kind}})}catch(Vt){}}if(!Qe){let Vt=xt.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),nn=Vt.includes("{{")&&Vt.includes("}}"),Vr=Vt.includes("{!!")&&Vt.includes("!!}");if(nn||Vr)Vt=rs(Vt,rt,oe);let An=ot.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");wt.push(`<script${An}>${Vt}</script>`)}}let Gt=$n(xe).output.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),wn=Gt?Gt[1]:"",Ia=Gt?Gt[2]:"",Ln="",Pa=wn&&/\bscoped\b/i.test(wn);if(Gt)Ln=`<style${wn}>${FS(Ia,rt,oe)}</style>`;let De=ft;if(De=De.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),Gt)De=De.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let tt=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,ot=[];if(De=De.replace(tt,(xt,Qe)=>{let Mt=Qe.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(Mt)ot.push(`<style${Mt[1]}>${Mt[2]}</style>`);return""}),De=De.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),ot.length>0)Ln=`${Ln}${ot.join(`
2085
- `)}`}if(k&&De.includes("{{ text || slot }}"))De=De.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>k);let{applySlots:Ye}=await gt("stx/slots",()=>import("./chunk-2q624ng4.js")),{defaultSlot:st,namedSlots:yt}=Ie,It=wt.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)),qt=(tt)=>It?ym(tt,dt):tt,Wr=new Map([...yt].map(([tt,ot])=>[tt,{...ot,content:qt(ot.content)}]));De=await Ye(De,qt(st),Wr,rt);let Da=Fc(wt),uo=(Array.isArray(rt.__stx_client_signal_names)?rt.__stx_client_signal_names:[]).filter((tt)=>!jt.has(tt));if(Da.length>0||uo.length>0)rt.__stx_client_signal_names=[...new Set([...uo,...Da])];else delete rt.__stx_client_signal_names;let fo=V.filter((tt)=>!jt.has(tt)&&!(tt in _));if(fo.length>0)rt[Po]=fo;let po={...B,_rootComponentsDir:B._rootComponentsDir||B.componentsDir,componentsDir:nt.dirname(oe),skipSignalsRuntime:!0,skipEventDirectives:It||wt.length===0,defaultLayout:void 0};rt.__stxProcessingDepth=(T.__stxProcessingDepth||0)+1;let ur=await n(De,rt,oe,po,F),Fr=new Set(Array.isArray(T.__stx_preserved_client_expressions)?T.__stx_preserved_client_expressions:[]);for(let tt of ur.matchAll(/\{\{([\s\S]*?)\}\}/g))Fr.add(tt[1].trim());if(Fr.size>0)T.__stx_preserved_client_expressions=[...Fr];let Bn=dt,Jt=ur;if(It){let tt="";if(Object.keys(_).length>0)try{tt=` data-stx-props="${Xm(JSON.stringify(_))}"`}catch{}let ot=ie?` stx-hydrate="${Xm(ie)}"`:"",xt=` data-stx-scope="${Bn}"${tt}${ot}`,Qe=/^\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*<span(?=[\s/>])/i.test(ur),Mt=Qe?"span":"div";Jt=jc(ur,xt)??`<${Mt}${xt} data-stx-component-wrapper${Qe?' style="display:contents"':""}>${ur}</${Mt}>`;let Vt=await Promise.all(wt.map(async(nn)=>{let Vr=nn.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!Vr)return nn;let[,An,go]=Vr,{vendorStyleTags:Qs,factoryBody:Ur}=await HS(go,oe,B.buildMode==="compile"),Hr=ie?null:Ua(T,Ur),Nt=Hr?`window.__stxComponentFactories[${JSON.stringify(Hr)}](${JSON.stringify(Bn)});`:`(${Ur})(${JSON.stringify(Bn)});`;if(ie)return`${Qs}<script type="stx/island" data-stx-island="${Bn}" data-stx-scoped data-stx-owner="${Bn}"${An}>${Nt}</script>`;return`${Qs}<script data-stx-scoped data-stx-run="always" data-stx-owner="${Bn}"${An}>${Nt}</script>`}));if(Jt=Jt+`
2084
+ `)}`:"";console.error(`[stx] component <${v}> could not be resolved${j}, so it rendered as nothing.${B}${z}`)}function eh(v){return`<!-- stx: component "${v.replace(/--+/g,"-")}" could not be resolved; see the server log -->`}function Fc(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 Ke(v,_,k,E,T,j,B,z=new Set,F,V=yr(T),U,H=v){let{extractVariables:Y}=await gt("stx/variable-extractor",()=>import("./chunk-m2vk8vja.js")),J=z??new Set;if(J.has(v))return`[Circular component reference: ${v}]`;let re=new Set(J);re.add(v);let se=typeof _.client==="string"?_.client.trim():"";if("client"in _)delete _.client;let ie=se&&se!=="load"&&Bc(se)?se:"";try{let ae=(tt)=>tt.split("-").map((ot)=>ot.charAt(0).toUpperCase()+ot.slice(1)).join(""),ce=H.endsWith(".stx")?H.slice(0,-4):H,oe=null,pe=T.__importedComponents;if(pe){let tt=[ce,ce.toLowerCase(),ae(ce),tn(ce)];for(let ot of tt)if(pe.has(ot)){oe=pe.get(ot);break}}let he=[];if(!oe){let tt=[`${ce}.stx`,`${ae(ce)}.stx`,`${tn(ce)}.stx`],ot=[...new Set(tt)],xt=T.__originalFilePath,Qe=[];if(Qe.push(...B._layerComponentDirs??[]),xt){let Nt=nt.join(nt.dirname(xt),"components");Qe.push(Nt)}if(E)Qe.push(E);let Mt=B._rootComponentsDir;if(typeof Mt==="string"&&!Qe.includes(Mt))Qe.push(Mt);let Vt=nt.join(nt.dirname(j),"components");if(!Qe.includes(Vt))Qe.push(Vt);if(B.componentsDir&&B.componentsDir!==E&&!Qe.includes(B.componentsDir))Qe.push(B.componentsDir);for(let Nt of B._targetComponentDirs??[])if(Nt&&!Qe.includes(Nt))Qe.push(Nt);let nn=typeof B.root==="string"?nt.resolve(B.root):void 0,Vr=nn??nt.dirname(j),An=[];if(nn)An.push(nt.resolve(nn,"resources/views/components")),An.push(nt.resolve(nn,"resources/components")),An.push(nt.resolve(nn,"src/components")),An.push(nt.resolve(nn,"components"));An.push(nt.resolve(import.meta.dir,"components"));for(let Nt of An)if(!Qe.includes(Nt))Qe.push(Nt);let mo=B._pluginComponentDirs;if(Array.isArray(mo)){for(let Nt of mo)if(typeof Nt==="string"&&!Qe.includes(Nt))Qe.push(Nt)}if(B.fallbackComponentsDir&&!Qe.includes(B.fallbackComponentsDir))Qe.push(B.fallbackComponentsDir);let Qs=[...new Set(Qe.map((Nt)=>{if(!Nt)return Nt;return nt.isAbsolute(Nt)?Nt:nt.resolve(Vr,Nt)}))];Qe.length=0,Qe.push(...Qs);let Ur=`${ce}\x00${j}\x00${Qs.join("\x00")}`,Hr=Sa.get(Ur);if(Hr)if(await r(Hr))oe=Hr;else Sa.delete(Ur);if(!oe&&(ce.startsWith("./")||ce.startsWith("../")))oe=nt.resolve(nt.dirname(j),`${ce}.stx`),he.push(oe);else if(!oe)for(let Nt of Qe){if(!Nt)continue;for(let qr of ot){let ho=nt.join(Nt,qr);if(he.push(ho),await r(ho)){oe=ho;break}}if(oe)break;if(!oe)try{let qr=await import("fs");if(!qr.statSync(Nt,{throwIfNoEntry:!1})?.isDirectory())continue;let $h=8,Ma=[{path:Nt,depth:0}];while(Ma.length>0&&!oe){let yo=Ma.pop();if(yo.depth>=$h)continue;let _u;try{_u=qr.readdirSync(yo.path,{withFileTypes:!0})}catch{continue}for(let xo of _u){if(!xo.isDirectory())continue;if(xo.name==="node_modules"||xo.name.startsWith("."))continue;let ku=nt.join(yo.path,xo.name);for(let _h of ot){let Oa=nt.join(ku,_h);if(he.push(Oa),await r(Oa)){oe=Oa;break}}if(oe)break;Ma.push({path:ku,depth:yo.depth+1})}}}catch{}if(oe)break}if(oe)Sa.set(Ur,oe)}if(!oe||!await r(oe))return Qm(v,j,he),eh(v);F.add(oe);let xe;if(ao.has(oe))xe=ao.get(oe);else try{xe=await Bun.file(oe).text(),ao.set(oe,xe)}catch(tt){let ot=tt instanceof Error?tt.message:String(tt);return Qm(v,j,[oe],ot),eh(v)}if(U)for(let tt of Object.keys(_)){let ot=tt.toLowerCase();if(ot.startsWith("aria-")||ot.startsWith("data-"))continue;let xt=tt.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(new RegExp(`\\b${xt}\\b`).test(xe))U.declaredProps.add(tt)}let $e=new Set(["__originalFilePath","__importedComponents",Eo,"__stx_client_signal_names","__stx_client_declared_names","__stx_runtime_config","__stxServeContext","__stx_scope_seq"]),Re={};for(let[tt,ot]of Object.entries(T))if(!tt.startsWith("__")||$e.has(tt))Re[tt]=ot;let Ce=V.length>0?{[Do]:[...V]}:{},Ae=k;if(k.includes("@include")){let{processIncludes:tt}=await gt("stx/includes",()=>import("./chunk-384xy328.js"));Ae=await tt(k,T,j,B,F)}if(/<[A-Z][\w.-]*[\s/>]/.test(Ae)){let{processComponents:tt}=await gt("stx/component-renderer",()=>import("./chunk-7x3az8j6.js"));Ae=await tt(Ae,{...T,__processedComponents:J,...Ce},j,B,F)}let Te=[];if(yi(Ae)){let{processExpressions:tt}=await gt("stx/expressions",()=>import("./chunk-gmp7apxp.js")),ot=T.__stx_signals_gate===void 0?{...T,__stx_signals_gate:!0,...Ce}:V.length>0?{...T,...Ce}:T;Ae=tt(Ae,ot,j);for(let xt of Ae.matchAll(/\{\{([\s\S]*?)\}\}/g))Te.push(xt[1].trim())}let _e=$n(Ae),Pe=[],Oe=_e.output.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(tt,ot)=>{let xt=_e.scripts[Number(ot)]||"",Qe=xt.match(/^<script\b([^>]*)>/i)?.[1]||"",Mt=Qe.match(/\btype\s*=\s*["']([^"']+)["']/i)?.[1]?.toLowerCase(),Vt=!Mt||["module","text/javascript","application/javascript"].includes(Mt),nn=/\sdata-stx-(?:owner|instance)(?=[\s=/>])/i.test(` ${Qe}`);if(!/\bserver\b/i.test(Qe)&&Vt&&!nn)return Pe.push(xt),"";return xt}),{extractSlotContent:Me}=await gt("stx/slots",()=>import("./chunk-9wygdzqe.js")),Ie=Me(Oe),Ne={};if(Ie.defaultSlot?.trim())Ne.default=Ie.defaultSlot;for(let[tt,ot]of Ie.namedSlots)Ne[tt]=ot.content;let at=T.__stx_scope_seq??={n:0,key:Bun.hash(String(T.__filename??j)).toString(36).slice(0,6)},dt=`stx_${(v.endsWith(".stx")?v.slice(0,-4):v).replace(/[^a-zA-Z0-9]/g,"_")}_${++at.n}_${at.key}`,rt={...Re,$uid:dt,..._,props:_,slot:Oe,$slots:Ne,__processedComponents:re,__sections:{},__stx_signals_gate:be(xe)||yi(k),__stx_preserved_client_expressions:[...Array.isArray(T.__stx_preserved_client_expressions)?T.__stx_preserved_client_expressions:[],...Te]};WS(xe,rt);let ft=xe,ct=Q(ft);if(ct)ft=ct.content.trim();let vt=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,ut=[...xe.matchAll(vt)],wt=[],pt=null,Wt=ut.some((tt)=>/\bserver\b/.test(tt[1]||"")&&/\bcache\b/.test(tt[1]||"")),In=null,Rn=null,lt=null,it=0,mt=null;if(MS(B),Wt&&au>0){let tt=OS({props:_,slot:Ae,slotContext:k.trim()?NS(Re):void 0,buildMode:B.buildMode??"",skipEventDirectives:B.skipEventDirectives===!0,clientLoopNames:[...V].sort(),layers:B._layerGraph?.layers.map((ot)=>ot.configFile),uid:dt});if(tt!==null){In=`${oe}\x00${h(xe)}\x00${tt}`;let ot=$a.get(In);if(ot){for(let xt of ot.dependencies)F.add(xt);if(pd(T,ot.clientFactories),at.n+=ot.uidsConsumed,ot.preservedClientExpressions.length>0){let xt=new Set(Array.isArray(T.__stx_preserved_client_expressions)?T.__stx_preserved_client_expressions:[]);for(let Qe of ot.preservedClientExpressions)xt.add(Qe);T.__stx_preserved_client_expressions=[...xt]}return ot.output}Rn=new Set(F),lt=dd(T),it=at.n,mt=new Set(Array.isArray(T.__stx_preserved_client_expressions)?T.__stx_preserved_client_expressions:[])}}let jt=new Set;for(let tt of ut){let ot=tt[1]||"",xt=tt[2]||"",Qe=ot.includes("server");if(qe(ot)&&xt.trim())xt=Ge(xt);if(Qe&&xt){for(let Vt of ee(xt))jt.add(Vt);try{await Y(xt,rt,oe,{onFailure:(Vt)=>{if(Vt.kind!=="unknown")pt=Vt.kind}})}catch(Vt){}}if(!Qe){let Vt=xt.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),nn=Vt.includes("{{")&&Vt.includes("}}"),Vr=Vt.includes("{!!")&&Vt.includes("!!}");if(nn||Vr)Vt=rs(Vt,rt,oe);let An=ot.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");wt.push(`<script${An}>${Vt}</script>`)}}let Gt=$n(xe).output.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),wn=Gt?Gt[1]:"",Ia=Gt?Gt[2]:"",Ln="",Pa=wn&&/\bscoped\b/i.test(wn);if(Gt)Ln=`<style${wn}>${VS(Ia,rt,oe)}</style>`;let De=ft;if(De=De.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),Gt)De=De.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let tt=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,ot=[];if(De=De.replace(tt,(xt,Qe)=>{let Mt=Qe.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(Mt)ot.push(`<style${Mt[1]}>${Mt[2]}</style>`);return""}),De=De.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),ot.length>0)Ln=`${Ln}${ot.join(`
2085
+ `)}`}if(k&&De.includes("{{ text || slot }}"))De=De.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>k);let{applySlots:Ye}=await gt("stx/slots",()=>import("./chunk-9wygdzqe.js")),{defaultSlot:st,namedSlots:yt}=Ie,It=wt.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)),qt=(tt)=>It?xm(tt,dt):tt,Wr=new Map([...yt].map(([tt,ot])=>[tt,{...ot,content:qt(ot.content)}]));De=await Ye(De,qt(st),Wr,rt);let Da=Fc(wt),fo=(Array.isArray(rt.__stx_client_signal_names)?rt.__stx_client_signal_names:[]).filter((tt)=>!jt.has(tt));if(Da.length>0||fo.length>0)rt.__stx_client_signal_names=[...new Set([...fo,...Da])];else delete rt.__stx_client_signal_names;let po=V.filter((tt)=>!jt.has(tt)&&!(tt in _));if(po.length>0)rt[Do]=po;let go={...B,_rootComponentsDir:B._rootComponentsDir||B.componentsDir,componentsDir:nt.dirname(oe),skipSignalsRuntime:!0,skipEventDirectives:It||wt.length===0,defaultLayout:void 0};rt.__stxProcessingDepth=(T.__stxProcessingDepth||0)+1;let ur=await n(De,rt,oe,go,F),Fr=new Set(Array.isArray(T.__stx_preserved_client_expressions)?T.__stx_preserved_client_expressions:[]);for(let tt of ur.matchAll(/\{\{([\s\S]*?)\}\}/g))Fr.add(tt[1].trim());if(Fr.size>0)T.__stx_preserved_client_expressions=[...Fr];let Bn=dt,Jt=ur;if(It){let tt="";if(Object.keys(_).length>0)try{tt=` data-stx-props="${Zm(JSON.stringify(_))}"`}catch{}let ot=ie?` stx-hydrate="${Zm(ie)}"`:"",xt=` data-stx-scope="${Bn}"${tt}${ot}`,Qe=/^\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*<span(?=[\s/>])/i.test(ur),Mt=Qe?"span":"div";Jt=jc(ur,xt)??`<${Mt}${xt} data-stx-component-wrapper${Qe?' style="display:contents"':""}>${ur}</${Mt}>`;let Vt=await Promise.all(wt.map(async(nn)=>{let Vr=nn.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!Vr)return nn;let[,An,mo]=Vr,{vendorStyleTags:Qs,factoryBody:Ur}=await qS(mo,oe,B.buildMode==="compile"),Hr=ie?null:Ua(T,Ur),Nt=Hr?`window.__stxComponentFactories[${JSON.stringify(Hr)}](${JSON.stringify(Bn)});`:`(${Ur})(${JSON.stringify(Bn)});`;if(ie)return`${Qs}<script type="stx/island" data-stx-island="${Bn}" data-stx-scoped data-stx-owner="${Bn}"${An}>${Nt}</script>`;return`${Qs}<script data-stx-scoped data-stx-run="always" data-stx-owner="${Bn}"${An}>${Nt}</script>`}));if(Jt=Jt+`
2086
2086
  `+Vt.join(`
2087
2087
  `),Ln)Jt+=`
2088
2088
  `+Ln}else{if(Ln)Jt+=`
2089
2089
  `+Ln;if(wt.length>0){let tt=rt.__stx_event_bindings||[],ot=Be(rt),xt=await Promise.all(wt.map(async(Qe)=>{let Mt=Qe.match(/<script\b[^>]*>([\s\S]*?)<\/script>/);if(!Mt)return Qe;return await ye(Mt[1],{eventBindings:tt,templateContent:Jt,filePath:oe,projectRoot:process.cwd(),serverData:ot,instanceId:dt})}));Jt+=`
2090
2090
  `+xt.join(`
2091
- `),rt.__stx_event_bindings=[]}}if(Pa){let tt=Mo(Jt,oe);if(tt.hasScoped)Jt=tt.html}if(In&&Rn){let tt=Array.isArray(T.__stx_preserved_client_expressions)?T.__stx_preserved_client_expressions:[];$a.set(In,{output:Jt,dependencies:[...F].filter((ot)=>!Rn.has(ot)),clientFactories:lt?fd(T,lt):[],uidsConsumed:at.n-it,preservedClientExpressions:mt?tt.filter((ot)=>!mt.has(ot)):[]})}if(pt)Jt=`<!--stx-render-failed:${pt}-->${Jt}`;return Pe.length>0?`${Jt}
2091
+ `),rt.__stx_event_bindings=[]}}if(Pa){let tt=No(Jt,oe);if(tt.hasScoped)Jt=tt.html}if(In&&Rn){let tt=Array.isArray(T.__stx_preserved_client_expressions)?T.__stx_preserved_client_expressions:[];$a.set(In,{output:Jt,dependencies:[...F].filter((ot)=>!Rn.has(ot)),clientFactories:lt?fd(T,lt):[],uidsConsumed:at.n-it,preservedClientExpressions:mt?tt.filter((ot)=>!mt.has(ot)):[]})}if(pt)Jt=`<!--stx-render-failed:${pt}-->${Jt}`;return Pe.length>0?`${Jt}
2092
2092
  ${Pe.join(`
2093
- `)}`:Jt}catch(ae){return`[Error processing component: ${ae instanceof Error?ae.message:String(ae)}]`}finally{J.delete(v)}}async function r(v){return Bun.file(v).exists()}function cu(v,_){let k=nt.resolve(_),E=nt.resolve(v),T=k.endsWith(nt.sep)?k:k+nt.sep;if(E===k||E.startsWith(T))return E;return null}async function VS(v,_,k,E){let T=_.startsWith("layouts/")?_.slice(8):_,j=nt.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 Yn(v,_,k,E){let T=await US(v,_,k,E);if(T===null)return null;let j=cu(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=nt.isAbsolute(z)?z:nt.resolve(process.cwd(),z);if(cu(T,F))return nt.resolve(T)}return console.warn(`[stx] rejected resolved template path that escapes project root: ${T} (template: ${v}, from: ${_})`),null}async function US(v,_,k,E){if(k.debug)console.log(`Resolving template path: ${v} from ${_}`);let T=nt.dirname(_),j=process.cwd();if(v.startsWith("/")){let Y=nt.join(j,v),J=cu(Y,j);if(!J)return console.warn(`[stx] rejected template path that escapes project root: ${v} (from ${_})`),null;if(k.debug)console.log(`Checking absolute path: ${J}`);if(await r(J)&&E)E.add(J);return J}let B=nt.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 Y of[".stx",".tsx",".jsx"]){let J=`${B}${Y}`;if(await r(J)){if(k.debug)console.log(`Found direct path with extension: ${J}`);if(E)E.add(J);return J}}let z=[];if(z.push(...k._layerLayoutDirs??[]),k.layoutsDir)z.push(nt.isAbsolute(k.layoutsDir)?k.layoutsDir:nt.resolve(process.cwd(),k.layoutsDir));let F=nt.resolve(T),V=process.cwd();for(let Y=0;Y<10;Y++){let J=nt.join(F,"layouts"),re=!1;try{re=eh.statSync(J,{throwIfNoEntry:!1})?.isDirectory()??!1}catch{}if(re){z.push(J);break}let se=nt.dirname(F);if(se===F||se.length<V.length)break;F=se}for(let Y of z){let J=await VS(Y,v,E,k.debug);if(J)return J}if(k.fallbackLayoutsDir){let Y=nt.isAbsolute(k.fallbackLayoutsDir)?k.fallbackLayoutsDir:nt.resolve(process.cwd(),k.fallbackLayoutsDir),J=v.startsWith("layouts/")?v.slice(8):v,re=[nt.join(Y,J)];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 Y=v.split("layouts/"),J=nt.join(k.partialsDir||T,"layouts",Y[1]);if(await r(J)){if(k.debug)console.log(`Found in layouts path: ${J}`);if(E)E.add(J);return J}if(!J.endsWith(".stx")){let re=`${J}.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 Y=nt.join(k.partialsDir,"layouts");if(await r(Y)){let J=nt.join(Y,v);if(await r(J)){if(k.debug)console.log(`Found in partials layouts dir: ${J}`);if(E)E.add(J);return J}if(!v.endsWith(".stx")){let re=`${J}.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 U=k.partialsDir||nt.join(process.cwd(),"views"),H=nt.join(U,v);if(await r(H)){if(k.debug)console.log(`Found in views path: ${H}`);if(E)E.add(H);return H}if(!v.endsWith(".stx")){let Y=`${H}.stx`;if(await r(Y)){if(k.debug)console.log(`Found in views path with extension: ${Y}`);if(E)E.add(Y);return Y}}if(T.includes("temp")){let Y=nt.join(nt.dirname(T),"layouts",v);if(await r(Y)){if(k.debug)console.log(`Found in temp layouts dir: ${Y}`);if(E)E.add(Y);return Y}if(!v.endsWith(".stx")){let J=`${Y}.stx`;if(await r(J)){if(k.debug)console.log(`Found in temp layouts dir with extension: ${J}`);if(E)E.add(J);return J}}}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 bi(v,_,k){let E=0,T="",j="";try{if(typeof _==="number"&&_>=0){let B=v.split(`
2093
+ `)}`:Jt}catch(ae){return`[Error processing component: ${ae instanceof Error?ae.message:String(ae)}]`}finally{J.delete(v)}}async function r(v){return Bun.file(v).exists()}function cu(v,_){let k=nt.resolve(_),E=nt.resolve(v),T=k.endsWith(nt.sep)?k:k+nt.sep;if(E===k||E.startsWith(T))return E;return null}async function US(v,_,k,E){let T=_.startsWith("layouts/")?_.slice(8):_,j=nt.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 Yn(v,_,k,E){let T=await HS(v,_,k,E);if(T===null)return null;let j=cu(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=nt.isAbsolute(z)?z:nt.resolve(process.cwd(),z);if(cu(T,F))return nt.resolve(T)}return console.warn(`[stx] rejected resolved template path that escapes project root: ${T} (template: ${v}, from: ${_})`),null}async function HS(v,_,k,E){if(k.debug)console.log(`Resolving template path: ${v} from ${_}`);let T=nt.dirname(_),j=process.cwd();if(v.startsWith("/")){let Y=nt.join(j,v),J=cu(Y,j);if(!J)return console.warn(`[stx] rejected template path that escapes project root: ${v} (from ${_})`),null;if(k.debug)console.log(`Checking absolute path: ${J}`);if(await r(J)&&E)E.add(J);return J}let B=nt.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 Y of[".stx",".tsx",".jsx"]){let J=`${B}${Y}`;if(await r(J)){if(k.debug)console.log(`Found direct path with extension: ${J}`);if(E)E.add(J);return J}}let z=[];if(z.push(...k._layerLayoutDirs??[]),k.layoutsDir)z.push(nt.isAbsolute(k.layoutsDir)?k.layoutsDir:nt.resolve(process.cwd(),k.layoutsDir));let F=nt.resolve(T),V=process.cwd();for(let Y=0;Y<10;Y++){let J=nt.join(F,"layouts"),re=!1;try{re=th.statSync(J,{throwIfNoEntry:!1})?.isDirectory()??!1}catch{}if(re){z.push(J);break}let se=nt.dirname(F);if(se===F||se.length<V.length)break;F=se}for(let Y of z){let J=await US(Y,v,E,k.debug);if(J)return J}if(k.fallbackLayoutsDir){let Y=nt.isAbsolute(k.fallbackLayoutsDir)?k.fallbackLayoutsDir:nt.resolve(process.cwd(),k.fallbackLayoutsDir),J=v.startsWith("layouts/")?v.slice(8):v,re=[nt.join(Y,J)];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 Y=v.split("layouts/"),J=nt.join(k.partialsDir||T,"layouts",Y[1]);if(await r(J)){if(k.debug)console.log(`Found in layouts path: ${J}`);if(E)E.add(J);return J}if(!J.endsWith(".stx")){let re=`${J}.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 Y=nt.join(k.partialsDir,"layouts");if(await r(Y)){let J=nt.join(Y,v);if(await r(J)){if(k.debug)console.log(`Found in partials layouts dir: ${J}`);if(E)E.add(J);return J}if(!v.endsWith(".stx")){let re=`${J}.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 U=k.partialsDir||nt.join(process.cwd(),"views"),H=nt.join(U,v);if(await r(H)){if(k.debug)console.log(`Found in views path: ${H}`);if(E)E.add(H);return H}if(!v.endsWith(".stx")){let Y=`${H}.stx`;if(await r(Y)){if(k.debug)console.log(`Found in views path with extension: ${Y}`);if(E)E.add(Y);return Y}}if(T.includes("temp")){let Y=nt.join(nt.dirname(T),"layouts",v);if(await r(Y)){if(k.debug)console.log(`Found in temp layouts dir: ${Y}`);if(E)E.add(Y);return Y}if(!v.endsWith(".stx")){let J=`${Y}.stx`;if(await r(J)){if(k.debug)console.log(`Found in temp layouts dir with extension: ${J}`);if(E)E.add(J);return J}}}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 bi(v,_,k){let E=0,T="",j="";try{if(typeof _==="number"&&_>=0){let B=v.split(`
2094
2094
  `),z=0;for(let F=0;F<B.length;F++)if(z+=B[F].length+1,z>=_){E=F+1,T=B[F].trim();let V=Math.max(0,F-2),U=Math.min(B.length,F+3);j=B.slice(V,U).map((H,Y)=>{let J=V+Y+1;return`${J===E?"> ":" "}${J}: ${H}`}).join(`
2095
2095
  `);break}}else if(k){let B=v.indexOf(k);if(B>=0)return bi(v,B)}}catch{}return{lineNumber:E,lineContent:T,context:j}}var bt={reset:"\x1B[0m",bold:"\x1B[1m",dim:"\x1B[2m",red:"\x1B[31m",yellow:"\x1B[33m",blue:"\x1B[34m",cyan:"\x1B[36m",gray:"\x1B[90m",bgRed:"\x1B[41m",bgYellow:"\x1B[43m"};function g(v,_,k,E,T,j){let{lineNumber:B,context:z}=bi(E,T,j),F=k.split("/").pop(),V=0;if(typeof T==="number"&&T>=0&&E){let H=E.lastIndexOf(`
2096
2096
  `,Math.max(0,T-1));V=T-(H+1)+1}let U="";if(B>0)U+=`
@@ -2105,7 +2105,7 @@ ${bt.yellow}${bt.bold}Message:${bt.reset} ${_}
2105
2105
  `,z)U+=`
2106
2106
  ${bt.blue}${bt.bold}Context:${bt.reset}
2107
2107
  ${bt.dim}${z}${bt.reset}
2108
- `;return U}function te(){oo.clear(),Sa.clear(),iu.clear(),ou.clear(),$a.clear()}function tu(){return{size:oo.size,maxSize:500}}var su=m(128);async function HS(v,_,k){let E=h(v,_,k),T=su.get(E);if(T){if(rn(T.deps))return T;su.delete(E)}let j=Zr(v,{filePath:_,projectRoot:process.cwd()}),B=j.code,z=Qr(j.styles);B=St(B).code;let{hasUserImports:F,bundleClientScript:V}=await gt("stx/client-script-bundler",()=>import("./chunk-a2c6t7w2.js")),U=[],H=!1;if(F(B)){let ae=B;B=await V(ae,_,{projectRoot:process.cwd(),minify:k,collectInputs:U}),H=B===ae}let{stripStxRuntimeImports:Y}=await gt("stx/signal-processing",()=>import("./chunk-5y2tgmb6.js"));B=Y(B);let J=I(B),re=jS(J),se=`function(__scopeId) {
2108
+ `;return U}function te(){ao.clear(),Sa.clear(),iu.clear(),ou.clear(),$a.clear()}function tu(){return{size:ao.size,maxSize:500}}var su=m(128);async function qS(v,_,k){let E=h(v,_,k),T=su.get(E);if(T){if(rn(T.deps))return T;su.delete(E)}let j=Zr(v,{filePath:_,projectRoot:process.cwd()}),B=j.code,z=Qr(j.styles);B=St(B).code;let{hasUserImports:F,bundleClientScript:V}=await gt("stx/client-script-bundler",()=>import("./chunk-x0fhwxhv.js")),U=[],H=!1;if(F(B)){let ae=B;B=await V(ae,_,{projectRoot:process.cwd(),minify:k,collectInputs:U}),H=B===ae}let{stripStxRuntimeImports:Y}=await gt("stx/signal-processing",()=>import("./chunk-yty18jzq.js"));B=Y(B);let J=I(B),re=LS(J),se=`function(__scopeId) {
2109
2109
  ${Ot("const",[...Ni,...re],J)}
2110
2110
  const __scope = window.stx._scopes = window.stx._scopes || {};
2111
2111
  const __scopeVars = __scope[__scopeId] = __scope[__scopeId] || {};
@@ -2162,8 +2162,8 @@ finally {
2162
2162
  window.__STX_CURRENT_ELEMENT__ = __previousCurrentElement;
2163
2163
  window.__STX_CURRENT_PROPS__ = __previousCurrentProps;
2164
2164
  }
2165
- }`,ie={vendorStyleTags:z,factoryBody:se,deps:nd([...U,...j.styles.map((ae)=>ae.resolvedPath)])};if(!H&&j.unresolved.length===0)su.set(E,ie);return ie}async function Dm(v,_,k=""){let E=v,T=[],j=/@markdown(?:\([^)]*\))?/g,B;while((B=j.exec(v))!==null){let z=B.index,F=B[0].match(/@markdown\(([^)]*)\)/),V=F?F[1]:"",U=z+B[0].length,H=1,Y=U,J=-1;while(H>0&&Y<v.length){let ie=v.indexOf("@markdown",Y),ae=v.indexOf("@endmarkdown",Y);if(ae===-1)break;if(ie!==-1&&ie<ae&&ie!==z){let ce=v[ie+9];if(ce==="("||ce===`
2166
- `||ce==="\r"||ce===" "||ce===void 0)H++;Y=ie+9}else{if(H--,H===0){J=ae;break}Y=ae+12}}if(J===-1)continue;let re=v.slice(U,J),se=v.slice(z,J+12);T.push({fullMatch:se,options:V,content:re,index:z}),j.lastIndex=J+12}for(let{fullMatch:z,options:F,content:V,index:U}of T)try{let H={};if(F)F.split(",").forEach((re)=>{let se=re.trim();if(se)H[se]=!0});let Y={gfm:H.gfm??!0,breaks:H.breaks??!1},J=Le(V.trim(),Y);E=E.split(z).join(J)}catch(H){let Y=H instanceof Error?H.message:String(H),J=g("Markdown Directive",`Error processing markdown: ${Y}`,k,v,U,z);E=E.split(z).join(J)}return E}async function nh(v,_,k,E){let T={gfm:!0,breaks:!1};return _.forEach((j)=>{let B=j.trim().replace(/['"]/g,"");if(B==="breaks")T.breaks=!0;if(B==="no-gfm")T.gfm=!1}),Le(v.trim(),T)}var Js=[320,480,640,768,1024,1280,1536,1920,2560],qS=[1,1.5,2,3],ao=["avif","webp","jpeg"],KS={avif:"image/avif",webp:"image/webp",jpeg:"image/jpeg",png:"image/png",gif:"image/gif"};function lu(v,_=Js,k={},E){return _.sort((T,j)=>T-j).map((T)=>`${co(v,{...k,w:T,fm:E})} ${T}w`).join(", ")}function rh(v,_,k=qS,E={},T){return k.sort((j,B)=>j-B).map((j)=>{let B=Math.round(_*j);return`${co(v,{...E,w:B,dpr:j,fm:T})} ${j}x`}).join(", ")}function uu(v,_="100vw"){if(!v||Object.keys(v).length===0)return _;let E=Object.entries(v).map(([T,j])=>{let B=/^\d+$/.test(T)?`${T}px`:T;return{bp:B,size:j,numericBp:Number.parseInt(B)||0}}).sort((T,j)=>T.numericBp-j.numericBp).map(({bp:T,size:j})=>`(max-width: ${T}) ${j}`);return E.push(_),E.join(", ")}function co(v,_={}){let k=Object.entries(_).filter(([,j])=>j!==void 0&&j!==null).map(([j,B])=>{if(Array.isArray(B))return[j,B.join(",")];return[j,String(B)]});if(k.length===0)return v;let E=k.map(([j,B])=>`${j}=${encodeURIComponent(B)}`).join("&"),T=v.includes("?")?"&":"?";return`${v}${T}${E}`}function du(v){return KS[v]||"application/octet-stream"}var XS={strategy:"thumbhash",width:20,quality:50,blurLevel:40,transitionDuration:300,easing:"ease-out"},pu=`
2165
+ }`,ie={vendorStyleTags:z,factoryBody:se,deps:nd([...U,...j.styles.map((ae)=>ae.resolvedPath)])};if(!H&&j.unresolved.length===0)su.set(E,ie);return ie}async function Mm(v,_,k=""){let E=v,T=[],j=/@markdown(?:\([^)]*\))?/g,B;while((B=j.exec(v))!==null){let z=B.index,F=B[0].match(/@markdown\(([^)]*)\)/),V=F?F[1]:"",U=z+B[0].length,H=1,Y=U,J=-1;while(H>0&&Y<v.length){let ie=v.indexOf("@markdown",Y),ae=v.indexOf("@endmarkdown",Y);if(ae===-1)break;if(ie!==-1&&ie<ae&&ie!==z){let ce=v[ie+9];if(ce==="("||ce===`
2166
+ `||ce==="\r"||ce===" "||ce===void 0)H++;Y=ie+9}else{if(H--,H===0){J=ae;break}Y=ae+12}}if(J===-1)continue;let re=v.slice(U,J),se=v.slice(z,J+12);T.push({fullMatch:se,options:V,content:re,index:z}),j.lastIndex=J+12}for(let{fullMatch:z,options:F,content:V,index:U}of T)try{let H={};if(F)F.split(",").forEach((re)=>{let se=re.trim();if(se)H[se]=!0});let Y={gfm:H.gfm??!0,breaks:H.breaks??!1},J=Le(V.trim(),Y);E=E.split(z).join(J)}catch(H){let Y=H instanceof Error?H.message:String(H),J=g("Markdown Directive",`Error processing markdown: ${Y}`,k,v,U,z);E=E.split(z).join(J)}return E}async function rh(v,_,k,E){let T={gfm:!0,breaks:!1};return _.forEach((j)=>{let B=j.trim().replace(/['"]/g,"");if(B==="breaks")T.breaks=!0;if(B==="no-gfm")T.gfm=!1}),Le(v.trim(),T)}var Js=[320,480,640,768,1024,1280,1536,1920,2560],KS=[1,1.5,2,3],co=["avif","webp","jpeg"],XS={avif:"image/avif",webp:"image/webp",jpeg:"image/jpeg",png:"image/png",gif:"image/gif"};function lu(v,_=Js,k={},E){return _.sort((T,j)=>T-j).map((T)=>`${lo(v,{...k,w:T,fm:E})} ${T}w`).join(", ")}function sh(v,_,k=KS,E={},T){return k.sort((j,B)=>j-B).map((j)=>{let B=Math.round(_*j);return`${lo(v,{...E,w:B,dpr:j,fm:T})} ${j}x`}).join(", ")}function uu(v,_="100vw"){if(!v||Object.keys(v).length===0)return _;let E=Object.entries(v).map(([T,j])=>{let B=/^\d+$/.test(T)?`${T}px`:T;return{bp:B,size:j,numericBp:Number.parseInt(B)||0}}).sort((T,j)=>T.numericBp-j.numericBp).map(({bp:T,size:j})=>`(max-width: ${T}) ${j}`);return E.push(_),E.join(", ")}function lo(v,_={}){let k=Object.entries(_).filter(([,j])=>j!==void 0&&j!==null).map(([j,B])=>{if(Array.isArray(B))return[j,B.join(",")];return[j,String(B)]});if(k.length===0)return v;let E=k.map(([j,B])=>`${j}=${encodeURIComponent(B)}`).join("&"),T=v.includes("?")?"&":"?";return`${v}${T}${E}`}function du(v){return XS[v]||"application/octet-stream"}var ZS={strategy:"thumbhash",width:20,quality:50,blurLevel:40,transitionDuration:300,easing:"ease-out"},pu=`
2167
2167
  .stx-img-placeholder {
2168
2168
  position: relative;
2169
2169
  overflow: hidden;
@@ -2192,7 +2192,7 @@ finally {
2192
2192
  filter: blur(0);
2193
2193
  transform: scale(1);
2194
2194
  }
2195
- `.trim();async function ZS(){try{return await import("ts-images")}catch{return null}}async function GS(v,_={}){let k={...XS,..._},E=await ZS();if(E)try{return await JS(v,k,E)}catch(T){console.warn(`[stx-media] ts-images placeholder generation failed, using fallback: ${T}`)}return YS(v,k)}async function JS(v,_,k){let{generatePlaceholder:E,generateThumbHash:T}=k,B={blur:"blur",thumbhash:"thumbhash",blurhash:"thumbhash",pixelate:"pixelate","dominant-color":"dominant-color",none:"blur"}[_.strategy]||"blur";if(_.strategy==="thumbhash")return{dataURL:(await T(v)).dataUrl,width:32,height:32,aspectRatio:1,originalWidth:0,originalHeight:0,strategy:"thumbhash"};let z=await E(v,{width:_.width,height:_.height,quality:_.quality,blurLevel:_.blurLevel,strategy:B,base64Encode:!0});return{dataURL:z.dataURL,width:z.width,height:z.height,aspectRatio:z.aspectRatio,originalWidth:z.originalWidth,originalHeight:z.originalHeight,strategy:_.strategy,dominantColor:z.dominantColor,css:z.css}}function YS(v,_){let k=_.width||20,E=_.height||k,T="#e5e7eb",j=`<svg xmlns="http://www.w3.org/2000/svg" width="${k}" height="${E}" viewBox="0 0 ${k} ${E}"><rect fill="#e5e7eb" width="${k}" height="${E}"/></svg>`;return{dataURL:`data:image/svg+xml;charset=utf-8,${encodeURIComponent(j)}`,width:k,height:E,aspectRatio:k/E,originalWidth:0,originalHeight:0,strategy:_.strategy,dominantColor:"#e5e7eb"}}function sh(v,_,k={}){let E=k.transitionDuration||300,T=k.easing||"ease-out";return`
2195
+ `.trim();async function GS(){try{return await import("ts-images")}catch{return null}}async function JS(v,_={}){let k={...ZS,..._},E=await GS();if(E)try{return await YS(v,k,E)}catch(T){console.warn(`[stx-media] ts-images placeholder generation failed, using fallback: ${T}`)}return QS(v,k)}async function YS(v,_,k){let{generatePlaceholder:E,generateThumbHash:T}=k,B={blur:"blur",thumbhash:"thumbhash",blurhash:"thumbhash",pixelate:"pixelate","dominant-color":"dominant-color",none:"blur"}[_.strategy]||"blur";if(_.strategy==="thumbhash")return{dataURL:(await T(v)).dataUrl,width:32,height:32,aspectRatio:1,originalWidth:0,originalHeight:0,strategy:"thumbhash"};let z=await E(v,{width:_.width,height:_.height,quality:_.quality,blurLevel:_.blurLevel,strategy:B,base64Encode:!0});return{dataURL:z.dataURL,width:z.width,height:z.height,aspectRatio:z.aspectRatio,originalWidth:z.originalWidth,originalHeight:z.originalHeight,strategy:_.strategy,dominantColor:z.dominantColor,css:z.css}}function QS(v,_){let k=_.width||20,E=_.height||k,T="#e5e7eb",j=`<svg xmlns="http://www.w3.org/2000/svg" width="${k}" height="${E}" viewBox="0 0 ${k} ${E}"><rect fill="#e5e7eb" width="${k}" height="${E}"/></svg>`;return{dataURL:`data:image/svg+xml;charset=utf-8,${encodeURIComponent(j)}`,width:k,height:E,aspectRatio:k/E,originalWidth:0,originalHeight:0,strategy:_.strategy,dominantColor:"#e5e7eb"}}function ih(v,_,k={}){let E=k.transitionDuration||300,T=k.easing||"ease-out";return`
2196
2196
  #${v} {
2197
2197
  --stx-img-transition-duration: ${E}ms;
2198
2198
  --stx-img-transition-easing: ${T};
@@ -2209,8 +2209,8 @@ finally {
2209
2209
  #${v}.stx-img-loaded img {
2210
2210
  opacity: 1;
2211
2211
  }
2212
- `.trim()}var fu=new Map;async function ih(v,_={}){let k=`${v}:${JSON.stringify(_)}`;if(fu.has(k))return fu.get(k);let E=await GS(v,_);return fu.set(k,E),E}async function QS(){try{return await import("./chunk-3m2h76cz.js")}catch(v){if(!oh)console.warn("[stx-media] Image processor not available, some features disabled:",v),oh=!0;return null}}var oh=!1,gu=80,ka="async",Ea="lazy",ah=!1;async function _a(v,_={}){let k=_,E=v;if(E.process&&!E.skipOptimization){if(k.tsImagesConfig?.enabled&&!k.isDev)return r0(E,k)}if(k.processedResult?.processed)return yu(v,k.processedResult,_);if(k.responsiveVariants)return uh(v,k.responsiveVariants,_);let{src:T,alt:j,width:B,height:z,sizes:F,widths:V=Js,dpr:U,formats:H=ao,quality:Y=gu,params:J={},placeholder:re="none",placeholderOptions:se={},lazy:ie=!0,priority:ae=!1,loading:ce=ae?"eager":Ea,decoding:oe=ka,fetchpriority:pe,objectFit:he,objectPosition:xe,crossorigin:$e,referrerpolicy:Re}=v,{class:Ce,style:Ae,id:Te}=v,_e=v.data||{},{isDev:Pe=!1,baseUrl:Me=""}=_;if(Pe&&!_.optimize)return n0(v);let Oe,Ie,Ne=Te||`stx-img-${Math.random().toString(36).slice(2,8)}`;if(re!=="none"&&!ae)try{Oe=await ih(T,{strategy:re,...se}),Ie=sh(Ne,Oe,se)}catch{}let at=U!==void 0&&B!==void 0,ht;if(at)ht=t0(v,Ne,Oe,_);else ht=await e0(v,Ne,Oe,_);let dt;if(ae){let ct=H.includes("webp")?"webp":H[0],vt=lu(T,V,{...J,q:Y},ct),ut=typeof F==="object"?uu(F):F||"100vw";dt=`<link rel="preload" as="image" imagesrcset="${vt}" imagesizes="${ut}" />`}let rt=[];if(!ah&&re!=="none")rt.push(pu),ah=!0;if(Ie)rt.push(Ie);let ft=ie?lh(Ne):void 0;return{html:ht,preloadLink:dt,css:rt.length>0?rt.join(`
2213
- `):void 0,script:ft}}async function e0(v,_,k,E){let{src:T,alt:j,width:B,height:z,sizes:F,widths:V=Js,formats:U=ao,quality:H=gu,params:Y={},lazy:J=!0,priority:re=!1,loading:se=re?"eager":Ea,decoding:ie=ka,fetchpriority:ae,objectFit:ce,objectPosition:oe,crossorigin:pe,referrerpolicy:he}=v,{class:xe,style:$e}=v,Re=v.data||{},Ce=typeof F==="object"?uu(F):F||"100vw",Ae=[];for(let Pe of U){let Me=lu(T,V,{...Y,q:H},Pe),Oe=du(Pe);if(J&&!re)Ae.push(` <source type="${Oe}" data-srcset="${Me}" data-sizes="${Ce}" />`);else Ae.push(` <source type="${Oe}" srcset="${Me}" sizes="${Ce}" />`)}let Te=mu({src:co(T,{...Y,q:H}),alt:j,width:B,height:z,loading:re?void 0:se,decoding:ie,fetchpriority:re?"high":ae,objectFit:ce,objectPosition:oe,crossorigin:pe,referrerpolicy:he,className:ch(xe,k),style:hu($e,ce,oe,k),lazy:J&&!re,data:Re}),_e;if(k){let Pe=`background-image: url('${k.dataURL}'); background-size: cover; background-position: center;`;_e=`<div id="${_}" class="stx-img-placeholder" style="${Pe}">
2212
+ `.trim()}var fu=new Map;async function oh(v,_={}){let k=`${v}:${JSON.stringify(_)}`;if(fu.has(k))return fu.get(k);let E=await JS(v,_);return fu.set(k,E),E}async function e0(){try{return await import("./chunk-3m2h76cz.js")}catch(v){if(!ah)console.warn("[stx-media] Image processor not available, some features disabled:",v),ah=!0;return null}}var ah=!1,gu=80,ka="async",Ea="lazy",ch=!1;async function _a(v,_={}){let k=_,E=v;if(E.process&&!E.skipOptimization){if(k.tsImagesConfig?.enabled&&!k.isDev)return s0(E,k)}if(k.processedResult?.processed)return yu(v,k.processedResult,_);if(k.responsiveVariants)return dh(v,k.responsiveVariants,_);let{src:T,alt:j,width:B,height:z,sizes:F,widths:V=Js,dpr:U,formats:H=co,quality:Y=gu,params:J={},placeholder:re="none",placeholderOptions:se={},lazy:ie=!0,priority:ae=!1,loading:ce=ae?"eager":Ea,decoding:oe=ka,fetchpriority:pe,objectFit:he,objectPosition:xe,crossorigin:$e,referrerpolicy:Re}=v,{class:Ce,style:Ae,id:Te}=v,_e=v.data||{},{isDev:Pe=!1,baseUrl:Oe=""}=_;if(Pe&&!_.optimize)return r0(v);let Me,Ie,Ne=Te||`stx-img-${Math.random().toString(36).slice(2,8)}`;if(re!=="none"&&!ae)try{Me=await oh(T,{strategy:re,...se}),Ie=ih(Ne,Me,se)}catch{}let at=U!==void 0&&B!==void 0,ht;if(at)ht=n0(v,Ne,Me,_);else ht=await t0(v,Ne,Me,_);let dt;if(ae){let ct=H.includes("webp")?"webp":H[0],vt=lu(T,V,{...J,q:Y},ct),ut=typeof F==="object"?uu(F):F||"100vw";dt=`<link rel="preload" as="image" imagesrcset="${vt}" imagesizes="${ut}" />`}let rt=[];if(!ch&&re!=="none")rt.push(pu),ch=!0;if(Ie)rt.push(Ie);let ft=ie?uh(Ne):void 0;return{html:ht,preloadLink:dt,css:rt.length>0?rt.join(`
2213
+ `):void 0,script:ft}}async function t0(v,_,k,E){let{src:T,alt:j,width:B,height:z,sizes:F,widths:V=Js,formats:U=co,quality:H=gu,params:Y={},lazy:J=!0,priority:re=!1,loading:se=re?"eager":Ea,decoding:ie=ka,fetchpriority:ae,objectFit:ce,objectPosition:oe,crossorigin:pe,referrerpolicy:he}=v,{class:xe,style:$e}=v,Re=v.data||{},Ce=typeof F==="object"?uu(F):F||"100vw",Ae=[];for(let Pe of U){let Oe=lu(T,V,{...Y,q:H},Pe),Me=du(Pe);if(J&&!re)Ae.push(` <source type="${Me}" data-srcset="${Oe}" data-sizes="${Ce}" />`);else Ae.push(` <source type="${Me}" srcset="${Oe}" sizes="${Ce}" />`)}let Te=mu({src:lo(T,{...Y,q:H}),alt:j,width:B,height:z,loading:re?void 0:se,decoding:ie,fetchpriority:re?"high":ae,objectFit:ce,objectPosition:oe,crossorigin:pe,referrerpolicy:he,className:lh(xe,k),style:hu($e,ce,oe,k),lazy:J&&!re,data:Re}),_e;if(k){let Pe=`background-image: url('${k.dataURL}'); background-size: cover; background-position: center;`;_e=`<div id="${_}" class="stx-img-placeholder" style="${Pe}">
2214
2214
  <picture>
2215
2215
  ${Ae.join(`
2216
2216
  `)}
@@ -2220,9 +2220,9 @@ ${Ae.join(`
2220
2220
  ${Ae.join(`
2221
2221
  `)}
2222
2222
  <img ${Te} />
2223
- </picture>`;return _e}function t0(v,_,k,E){let{src:T,alt:j,width:B,height:z,dpr:F=[1,2,3],quality:V=gu,params:U={},lazy:H=!0,priority:Y=!1,loading:J=Y?"eager":Ea,decoding:re=ka,fetchpriority:se,objectFit:ie,objectPosition:ae,crossorigin:ce,referrerpolicy:oe}=v,{class:pe,style:he}=v,xe=v.data||{},$e=typeof B==="number"?B:Number.parseInt(String(B),10),Re=rh(T,$e,F,{...U,q:V}),Ce=mu({src:co(T,{...U,w:$e,q:V}),alt:j,width:B,height:z,loading:Y?void 0:J,decoding:re,fetchpriority:Y?"high":se,objectFit:ie,objectPosition:ae,crossorigin:ce,referrerpolicy:oe,className:ch(pe,k),style:hu(he,ie,ae,k),lazy:H&&!Y,data:xe}),Ae=H&&!Y?`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}">
2223
+ </picture>`;return _e}function n0(v,_,k,E){let{src:T,alt:j,width:B,height:z,dpr:F=[1,2,3],quality:V=gu,params:U={},lazy:H=!0,priority:Y=!1,loading:J=Y?"eager":Ea,decoding:re=ka,fetchpriority:se,objectFit:ie,objectPosition:ae,crossorigin:ce,referrerpolicy:oe}=v,{class:pe,style:he}=v,xe=v.data||{},$e=typeof B==="number"?B:Number.parseInt(String(B),10),Re=sh(T,$e,F,{...U,q:V}),Ce=mu({src:lo(T,{...U,w:$e,q:V}),alt:j,width:B,height:z,loading:Y?void 0:J,decoding:re,fetchpriority:Y?"high":se,objectFit:ie,objectPosition:ae,crossorigin:ce,referrerpolicy:oe,className:lh(pe,k),style:hu(he,ie,ae,k),lazy:H&&!Y,data:xe}),Ae=H&&!Y?`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}">
2224
2224
  <img ${Ce} ${Ae} />
2225
- </div>`}return`<img ${_?`id="${_}" `:""}${Ce} ${Ae} />`}function n0(v){let{src:_,alt:k,width:E,height:T,loading:j=Ea,decoding:B=ka,fetchpriority:z,objectFit:F,objectPosition:V,crossorigin:U,referrerpolicy:H,priority:Y=!1}=v,{class:J,style:re,id:se}=v,ie=v.data||{};return{html:`<img ${mu({src:_,alt:k,width:E,height:T,loading:Y?"eager":j,decoding:B,fetchpriority:Y?"high":z,objectFit:F,objectPosition:V,crossorigin:U,referrerpolicy:H,className:J,style:hu(re,F,V),id:se,data:ie})} />`}}function mu(v){let _=[];if(v.lazy)_.push(`data-src="${Tn(v.src)}"`),_.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"');else _.push(`src="${Tn(v.src)}"`);if(_.push(`alt="${Tn(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="${Tn(v.className)}"`);if(v.style)_.push(`style="${Tn(v.style)}"`);if(v.id)_.push(`id="${Tn(v.id)}"`);if(v.data)for(let[k,E]of Object.entries(v.data))_.push(`data-${k}="${Tn(E)}"`);if(v.lazy)_.push("data-stx-lazy");return _.join(" ")}function ch(v,_){let k=[];if(v)k.push(v);if(_)k.push("stx-img-blur");return k.join(" ")||""}function hu(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 Tn(v){return v.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#039;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function lh(v){return`
2225
+ </div>`}return`<img ${_?`id="${_}" `:""}${Ce} ${Ae} />`}function r0(v){let{src:_,alt:k,width:E,height:T,loading:j=Ea,decoding:B=ka,fetchpriority:z,objectFit:F,objectPosition:V,crossorigin:U,referrerpolicy:H,priority:Y=!1}=v,{class:J,style:re,id:se}=v,ie=v.data||{};return{html:`<img ${mu({src:_,alt:k,width:E,height:T,loading:Y?"eager":j,decoding:B,fetchpriority:Y?"high":z,objectFit:F,objectPosition:V,crossorigin:U,referrerpolicy:H,className:J,style:hu(re,F,V),id:se,data:ie})} />`}}function mu(v){let _=[];if(v.lazy)_.push(`data-src="${Tn(v.src)}"`),_.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"');else _.push(`src="${Tn(v.src)}"`);if(_.push(`alt="${Tn(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="${Tn(v.className)}"`);if(v.style)_.push(`style="${Tn(v.style)}"`);if(v.id)_.push(`id="${Tn(v.id)}"`);if(v.data)for(let[k,E]of Object.entries(v.data))_.push(`data-${k}="${Tn(E)}"`);if(v.lazy)_.push("data-stx-lazy");return _.join(" ")}function lh(v,_){let k=[];if(v)k.push(v);if(_)k.push("stx-img-blur");return k.join(" ")||""}function hu(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 Tn(v){return v.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#039;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function uh(v){return`
2226
2226
  (function() {
2227
2227
  const container = document.getElementById('${v}');
2228
2228
  if (!container) return;
@@ -2259,7 +2259,7 @@ ${Ae.join(`
2259
2259
 
2260
2260
  observer.observe(container);
2261
2261
  })();
2262
- `.trim()}async function r0(v,_){let k=await QS();if(!k)return _a({...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 uh(v,j,_)}else{let j=await k.processImage(v.src,v,E);if(j.processed)return yu(v,j,_)}return _a({...v,process:!1},_)}async function yu(v,_,k){let{alt:E,width:T,height:j,lazy:B=!0,priority:z=!1,objectFit:F,objectPosition:V,crossorigin:U,referrerpolicy:H}=v,{class:Y,style:J}=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],ce=ae?.url||v.src,oe=ie.filter((Ie)=>Ie.format===(ae?.format||"jpeg")).map((Ie)=>`${Ie.url} ${Ie.width}w`).join(", "),pe=new Map;for(let Ie of ie){if(!pe.has(Ie.format))pe.set(Ie.format,[]);pe.get(Ie.format).push(Ie)}let he=[],xe=["avif","webp","jpeg","png"];for(let Ie of xe){let Ne=pe.get(Ie);if(Ne&&Ne.length>0){let at=Ne.map((dt)=>`${dt.url} ${dt.width}w`).join(", "),ht=du(Ie);if(B&&!z)he.push(` <source type="${ht}" data-srcset="${at}" />`);else he.push(` <source type="${ht}" srcset="${at}" />`)}}let $e=[];if(B&&!z){if($e.push(`data-src="${Tn(ce)}"`),$e.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"'),oe)$e.push(`data-srcset="${oe}"`)}else if($e.push(`src="${Tn(ce)}"`),oe)$e.push(`srcset="${oe}"`);$e.push(`alt="${Tn(E)}"`);let Re=T||_.originalWidth,Ce=j||_.originalHeight;if(Re)$e.push(`width="${Re}"`);if(Ce)$e.push(`height="${Ce}"`);if(!z)$e.push(`loading="${B?"lazy":"eager"}"`);if($e.push('decoding="async"'),z)$e.push('fetchpriority="high"');if(U)$e.push(`crossorigin="${U}"`);if(H)$e.push(`referrerpolicy="${H}"`);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(J)Ae.push(J);if(Ae.length>0)$e.push(`style="${Ae.join("; ")}"`);let Te=[];if(Y)Te.push(Y);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,Ne]of Object.entries(se))$e.push(`data-${Ie}="${Tn(Ne)}"`);let _e;if(_.placeholder||_.dominantColor&&v.useDominantColor){let Ie=_.placeholder?`background-image: url('${_.placeholder}'); background-size: cover; background-position: center;`:`background-color: ${_.dominantColor};`;_e=`<div id="${re}" class="stx-img-placeholder" style="${Ie}">
2262
+ `.trim()}async function s0(v,_){let k=await e0();if(!k)return _a({...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 dh(v,j,_)}else{let j=await k.processImage(v.src,v,E);if(j.processed)return yu(v,j,_)}return _a({...v,process:!1},_)}async function yu(v,_,k){let{alt:E,width:T,height:j,lazy:B=!0,priority:z=!1,objectFit:F,objectPosition:V,crossorigin:U,referrerpolicy:H}=v,{class:Y,style:J}=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],ce=ae?.url||v.src,oe=ie.filter((Ie)=>Ie.format===(ae?.format||"jpeg")).map((Ie)=>`${Ie.url} ${Ie.width}w`).join(", "),pe=new Map;for(let Ie of ie){if(!pe.has(Ie.format))pe.set(Ie.format,[]);pe.get(Ie.format).push(Ie)}let he=[],xe=["avif","webp","jpeg","png"];for(let Ie of xe){let Ne=pe.get(Ie);if(Ne&&Ne.length>0){let at=Ne.map((dt)=>`${dt.url} ${dt.width}w`).join(", "),ht=du(Ie);if(B&&!z)he.push(` <source type="${ht}" data-srcset="${at}" />`);else he.push(` <source type="${ht}" srcset="${at}" />`)}}let $e=[];if(B&&!z){if($e.push(`data-src="${Tn(ce)}"`),$e.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"'),oe)$e.push(`data-srcset="${oe}"`)}else if($e.push(`src="${Tn(ce)}"`),oe)$e.push(`srcset="${oe}"`);$e.push(`alt="${Tn(E)}"`);let Re=T||_.originalWidth,Ce=j||_.originalHeight;if(Re)$e.push(`width="${Re}"`);if(Ce)$e.push(`height="${Ce}"`);if(!z)$e.push(`loading="${B?"lazy":"eager"}"`);if($e.push('decoding="async"'),z)$e.push('fetchpriority="high"');if(U)$e.push(`crossorigin="${U}"`);if(H)$e.push(`referrerpolicy="${H}"`);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(J)Ae.push(J);if(Ae.length>0)$e.push(`style="${Ae.join("; ")}"`);let Te=[];if(Y)Te.push(Y);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,Ne]of Object.entries(se))$e.push(`data-${Ie}="${Tn(Ne)}"`);let _e;if(_.placeholder||_.dominantColor&&v.useDominantColor){let Ie=_.placeholder?`background-image: url('${_.placeholder}'); background-size: cover; background-position: center;`:`background-color: ${_.dominantColor};`;_e=`<div id="${re}" class="stx-img-placeholder" style="${Ie}">
2263
2263
  <picture>
2264
2264
  ${he.join(`
2265
2265
  `)}
@@ -2269,15 +2269,15 @@ ${he.join(`
2269
2269
  ${he.join(`
2270
2270
  `)}
2271
2271
  <img ${$e.join(" ")} />
2272
- </picture>`;let Pe=[];if(_.placeholder)Pe.push(pu);let Me=B?lh(re):void 0,Oe;if(z&&oe)Oe=`<link rel="preload" as="image" imagesrcset="${oe}" />`;return{html:_e,preloadLink:Oe,css:Pe.length>0?Pe.join(`
2273
- `):void 0,script:Me}}async function uh(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 yu(v,E,k)}function s0(){return Xe({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}=i0(v,_,k);if(!T)return console.warn("@img directive: missing src argument"),"<!-- @img: missing src -->";let z={src:T,alt:j||"",widths:B.widths||Js,formats:B.formats||ao,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 _a(z,{isDev:F}),U=V.html;if(V.preloadLink)U=V.preloadLink+`
2272
+ </picture>`;let Pe=[];if(_.placeholder)Pe.push(pu);let Oe=B?uh(re):void 0,Me;if(z&&oe)Me=`<link rel="preload" as="image" imagesrcset="${oe}" />`;return{html:_e,preloadLink:Me,css:Pe.length>0?Pe.join(`
2273
+ `):void 0,script:Oe}}async function dh(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 yu(v,E,k)}function i0(){return Xe({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}=o0(v,_,k);if(!T)return console.warn("@img directive: missing src argument"),"<!-- @img: missing src -->";let z={src:T,alt:j||"",widths:B.widths||Js,formats:B.formats||co,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 _a(z,{isDev:F}),U=V.html;if(V.preloadLink)U=V.preloadLink+`
2274
2274
  `+U;if(V.css)U+=`
2275
2275
  <style>${V.css}</style>`;if(V.script)U+=`
2276
- <script>${V.script}</script>`;return U},defaults:{src:"",alt:"",options:{lazy:!0,placeholder:"none"}}})}function i0(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=o0(E),j=xu(T[0],k)||"",B=xu(T[1],k)||"",z={};if(T[2]){let F=xu(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 o0(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 xu(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 dh=s0();async function ph(){try{return await import("./chunk-fz7dxc1q.js")}catch(v){if(!fh)console.warn("[stx-media] Video processor not available, some features disabled:",v),fh=!0;return null}}var fh=!1,gh=!0,mh="metadata",a0="https://cdn.jsdelivr.net/npm/ts-video-player@latest/dist/index.min.js";async function Ca(v,_={}){let k=_,E=v;if(E.process&&!E.skipProcessing){if(k.tsVideosConfig?.enabled&&!k.isDev)return f0(E,k)}if(k.processedResult?.processed)return yh(v,k.processedResult,_);let T;if(E.generatePoster&&E.src&&!v.poster)T=await p0(E,k);let{src:j,sources:B=[],poster:z,posterPlaceholder:F,controls:V=gh,autoplay:U=!1,muted:H=!1,loop:Y=!1,preload:J=mh,playsinline:re=!0,lazy:se=!0,player:ie="native",type:ae,width:ce,height:oe,crossorigin:pe,disablePictureInPicture:he=!1,disableRemotePlayback:xe=!1}=v,$e=T||z,{class:Re,style:Ce}=v,Ae=v.id||`stx-video-${Math.random().toString(36).slice(2,8)}`;if(ie==="ts-video")return l0(v,_);if(ae&&ae!=="video")return c0(j||"",ae,v);let Te=B.length>0?B:j?[{src:j,type:hh(j)}]:[],_e=[`id="${Ae}"`];if(V)_e.push("controls");if(U)_e.push("autoplay");if(H)_e.push("muted");if(Y)_e.push("loop");if(re)_e.push("playsinline");if(he)_e.push("disablepictureinpicture");if(xe)_e.push("disableremoteplayback");if(pe)_e.push(`crossorigin="${pe}"`);if(se){if(_e.push(`data-preload="${J}"`),_e.push('preload="none"'),$e)_e.push(`data-poster="${Xt($e)}"`);_e.push("data-stx-lazy")}else if(_e.push(`preload="${J}"`),$e)_e.push(`poster="${Xt($e)}"`);if(ce)_e.push(`width="${ce}"`);if(oe)_e.push(`height="${oe}"`);if(Re)_e.push(`class="${Xt(Re)}"`);if(Ce)_e.push(`style="${Xt(Ce)}"`);let Pe=Te.map((Ie)=>` <source ${se?`data-src="${Xt(Ie.src)}"`:`src="${Xt(Ie.src)}"`} type="${Ie.type}"${Ie.media?` media="${Ie.media}"`:""} />`).join(`
2277
- `),Me=`<video ${_e.join(" ")}>
2276
+ <script>${V.script}</script>`;return U},defaults:{src:"",alt:"",options:{lazy:!0,placeholder:"none"}}})}function o0(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=a0(E),j=xu(T[0],k)||"",B=xu(T[1],k)||"",z={};if(T[2]){let F=xu(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 a0(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 xu(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 fh=i0();async function gh(){try{return await import("./chunk-fz7dxc1q.js")}catch(v){if(!ph)console.warn("[stx-media] Video processor not available, some features disabled:",v),ph=!0;return null}}var ph=!1,mh=!0,hh="metadata",c0="https://cdn.jsdelivr.net/npm/ts-video-player@latest/dist/index.min.js";async function Ca(v,_={}){let k=_,E=v;if(E.process&&!E.skipProcessing){if(k.tsVideosConfig?.enabled&&!k.isDev)return p0(E,k)}if(k.processedResult?.processed)return xh(v,k.processedResult,_);let T;if(E.generatePoster&&E.src&&!v.poster)T=await g0(E,k);let{src:j,sources:B=[],poster:z,posterPlaceholder:F,controls:V=mh,autoplay:U=!1,muted:H=!1,loop:Y=!1,preload:J=hh,playsinline:re=!0,lazy:se=!0,player:ie="native",type:ae,width:ce,height:oe,crossorigin:pe,disablePictureInPicture:he=!1,disableRemotePlayback:xe=!1}=v,$e=T||z,{class:Re,style:Ce}=v,Ae=v.id||`stx-video-${Math.random().toString(36).slice(2,8)}`;if(ie==="ts-video")return u0(v,_);if(ae&&ae!=="video")return l0(j||"",ae,v);let Te=B.length>0?B:j?[{src:j,type:yh(j)}]:[],_e=[`id="${Ae}"`];if(V)_e.push("controls");if(U)_e.push("autoplay");if(H)_e.push("muted");if(Y)_e.push("loop");if(re)_e.push("playsinline");if(he)_e.push("disablepictureinpicture");if(xe)_e.push("disableremoteplayback");if(pe)_e.push(`crossorigin="${pe}"`);if(se){if(_e.push(`data-preload="${J}"`),_e.push('preload="none"'),$e)_e.push(`data-poster="${Xt($e)}"`);_e.push("data-stx-lazy")}else if(_e.push(`preload="${J}"`),$e)_e.push(`poster="${Xt($e)}"`);if(ce)_e.push(`width="${ce}"`);if(oe)_e.push(`height="${oe}"`);if(Re)_e.push(`class="${Xt(Re)}"`);if(Ce)_e.push(`style="${Xt(Ce)}"`);let Pe=Te.map((Ie)=>` <source ${se?`data-src="${Xt(Ie.src)}"`:`src="${Xt(Ie.src)}"`} type="${Ie.type}"${Ie.media?` media="${Ie.media}"`:""} />`).join(`
2277
+ `),Oe=`<video ${_e.join(" ")}>
2278
2278
  ${Pe}
2279
2279
  Your browser does not support the video tag.
2280
- </video>`,Oe;if(se)Oe=`
2280
+ </video>`,Me;if(se)Me=`
2281
2281
  (function() {
2282
2282
  var video = document.getElementById('${Ae}');
2283
2283
  if (!video) return;
@@ -2312,9 +2312,9 @@ ${Pe}
2312
2312
 
2313
2313
  observer.observe(video);
2314
2314
  })();
2315
- `.trim();return{html:Me,script:Oe}}function c0(v,_,k){let{width:E=640,height:T=360}=k,{class:j,style:B}=k,z=k.id||`stx-embed-${Math.random().toString(36).slice(2,8)}`,F,V=null;switch(_){case"youtube":V=u0(v),F=V?`https://www.youtube-nocookie.com/embed/${V}`:v;break;case"vimeo":V=d0(v),F=V?`https://player.vimeo.com/video/${V}`:v;break;case"dailymotion":V=v.split("/").pop()||"",F=`https://www.dailymotion.com/embed/video/${V}`;break;case"twitch":V=v.split("/").pop()||"",F=`https://player.twitch.tv/?video=${V}&parent=${typeof window<"u"?window.location.hostname:"localhost"}`;break;default:F=v}let U=[`id="${z}"`,`src="${Xt(F)}"`,`width="${E}"`,`height="${T}"`,'frameborder="0"',"allowfullscreen",'allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"'];if(j)U.push(`class="${Xt(j)}"`);if(B)U.push(`style="${Xt(B)}"`);if(k.lazy)U.push('loading="lazy"');return{html:`<div class="stx-video-embed" style="position:relative;padding-bottom:56.25%;height:0;overflow:hidden;">
2315
+ `.trim();return{html:Oe,script:Me}}function l0(v,_,k){let{width:E=640,height:T=360}=k,{class:j,style:B}=k,z=k.id||`stx-embed-${Math.random().toString(36).slice(2,8)}`,F,V=null;switch(_){case"youtube":V=d0(v),F=V?`https://www.youtube-nocookie.com/embed/${V}`:v;break;case"vimeo":V=f0(v),F=V?`https://player.vimeo.com/video/${V}`:v;break;case"dailymotion":V=v.split("/").pop()||"",F=`https://www.dailymotion.com/embed/video/${V}`;break;case"twitch":V=v.split("/").pop()||"",F=`https://player.twitch.tv/?video=${V}&parent=${typeof window<"u"?window.location.hostname:"localhost"}`;break;default:F=v}let U=[`id="${z}"`,`src="${Xt(F)}"`,`width="${E}"`,`height="${T}"`,'frameborder="0"',"allowfullscreen",'allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"'];if(j)U.push(`class="${Xt(j)}"`);if(B)U.push(`style="${Xt(B)}"`);if(k.lazy)U.push('loading="lazy"');return{html:`<div class="stx-video-embed" style="position:relative;padding-bottom:56.25%;height:0;overflow:hidden;">
2316
2316
  <iframe ${U.join(" ")} style="position:absolute;top:0;left:0;width:100%;height:100%;"></iframe>
2317
- </div>`}}function l0(v,_={}){let{src:k,sources:E=[],poster:T,controls:j=!0,autoplay:B=!1,muted:z=!1,loop:F=!1,preload:V="metadata",playsinline:U=!0,lazy:H=!0,width:Y,height:J}=v,{class:re,style:se}=v,ie=v.id||`ts-video-${Math.random().toString(36).slice(2,8)}`,ae={src:E.length>0?E:k,autoplay:B,loop:F,muted:z,playsinline:U,preload:V,poster:T,controls:j,title:v.title},ce=["position: relative",Y?`width: ${typeof Y==="number"?Y+"px":Y}`:"width: 100%",J?`height: ${typeof J==="number"?J+"px":J}`:"",se||""].filter(Boolean).join("; "),oe=`
2317
+ </div>`}}function u0(v,_={}){let{src:k,sources:E=[],poster:T,controls:j=!0,autoplay:B=!1,muted:z=!1,loop:F=!1,preload:V="metadata",playsinline:U=!0,lazy:H=!0,width:Y,height:J}=v,{class:re,style:se}=v,ie=v.id||`ts-video-${Math.random().toString(36).slice(2,8)}`,ae={src:E.length>0?E:k,autoplay:B,loop:F,muted:z,playsinline:U,preload:V,poster:T,controls:j,title:v.title},ce=["position: relative",Y?`width: ${typeof Y==="number"?Y+"px":Y}`:"width: 100%",J?`height: ${typeof J==="number"?J+"px":J}`:"",se||""].filter(Boolean).join("; "),oe=`
2318
2318
  <div
2319
2319
  id="${ie}"
2320
2320
  class="ts-video-player${re?" "+Xt(re):""}"
@@ -2351,7 +2351,7 @@ ${Pe}
2351
2351
 
2352
2352
  // Load ts-video-player from CDN
2353
2353
  var script = document.createElement('script');
2354
- script.src = '${a0}';
2354
+ script.src = '${c0}';
2355
2355
  script.onload = initPlayer;
2356
2356
  script.onerror = function() {
2357
2357
  console.error('[stx] Failed to load ts-video-player');
@@ -2481,7 +2481,7 @@ else {
2481
2481
  .ts-video-player__play-button svg {
2482
2482
  margin-left: 4px;
2483
2483
  }
2484
- `.trim();return{html:oe,script:pe,css:he}}function hh(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 u0(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 d0(v){let _=v.match(/vimeo\.com\/(\d+)/);return _?_[1]:null}function Xt(v){return v.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}async function f0(v,_){let k=await ph();if(!k)return Ca({...v,process:!1},_);let E=_.tsVideosConfig,T=await k.processVideo(v.src,v,E,v.onProcessProgress);if(T.processed)return yh(v,T,_);return Ca({...v,process:!1},_)}async function p0(v,_){let k=await ph();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 yh(v,_,k){let{controls:E=gh,autoplay:T=!1,muted:j=!1,loop:B=!1,preload:z=mh,playsinline:F=!0,lazy:V=!0,width:U,height:H,crossorigin:Y,disablePictureInPicture:J=!1,disableRemotePlayback:re=!1}=v,{class:se,style:ie}=v,ae=v.id||`stx-video-${Math.random().toString(36).slice(2,8)}`,ce=v.src,oe=hh(ce);if(_.transcoded)ce=_.transcoded.url,oe="video/mp4";let pe=_.streaming?.hls||_.streaming?.dash;if(pe){if(_.streaming?.hls)ce=_.streaming.hls.manifestUrl,oe="application/x-mpegURL";else if(_.streaming?.dash)ce=_.streaming.dash.manifestUrl,oe="application/dash+xml"}let he=_.poster?.url||v.poster,xe=[`id="${ae}"`];if(E)xe.push("controls");if(T)xe.push("autoplay");if(j)xe.push("muted");if(B)xe.push("loop");if(F)xe.push("playsinline");if(J)xe.push("disablepictureinpicture");if(re)xe.push("disableremoteplayback");if(Y)xe.push(`crossorigin="${Y}"`);if(V){if(xe.push(`data-preload="${z}"`),xe.push('preload="none"'),he)xe.push(`data-poster="${Xt(he)}"`);xe.push("data-stx-lazy")}else if(xe.push(`preload="${z}"`),he)xe.push(`poster="${Xt(he)}"`);let $e=U||_.metadata?.width,Re=H||_.metadata?.height;if($e)xe.push(`width="${$e}"`);if(Re)xe.push(`height="${Re}"`);if(se)xe.push(`class="${Xt(se)}"`);if(ie)xe.push(`style="${Xt(ie)}"`);let Ae=` <source ${V?`data-src="${Xt(ce)}"`:`src="${Xt(ce)}"`} type="${oe}" />`,Te=`<video ${xe.join(" ")}>
2484
+ `.trim();return{html:oe,script:pe,css:he}}function yh(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 d0(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 f0(v){let _=v.match(/vimeo\.com\/(\d+)/);return _?_[1]:null}function Xt(v){return v.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}async function p0(v,_){let k=await gh();if(!k)return Ca({...v,process:!1},_);let E=_.tsVideosConfig,T=await k.processVideo(v.src,v,E,v.onProcessProgress);if(T.processed)return xh(v,T,_);return Ca({...v,process:!1},_)}async function g0(v,_){let k=await gh();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 xh(v,_,k){let{controls:E=mh,autoplay:T=!1,muted:j=!1,loop:B=!1,preload:z=hh,playsinline:F=!0,lazy:V=!0,width:U,height:H,crossorigin:Y,disablePictureInPicture:J=!1,disableRemotePlayback:re=!1}=v,{class:se,style:ie}=v,ae=v.id||`stx-video-${Math.random().toString(36).slice(2,8)}`,ce=v.src,oe=yh(ce);if(_.transcoded)ce=_.transcoded.url,oe="video/mp4";let pe=_.streaming?.hls||_.streaming?.dash;if(pe){if(_.streaming?.hls)ce=_.streaming.hls.manifestUrl,oe="application/x-mpegURL";else if(_.streaming?.dash)ce=_.streaming.dash.manifestUrl,oe="application/dash+xml"}let he=_.poster?.url||v.poster,xe=[`id="${ae}"`];if(E)xe.push("controls");if(T)xe.push("autoplay");if(j)xe.push("muted");if(B)xe.push("loop");if(F)xe.push("playsinline");if(J)xe.push("disablepictureinpicture");if(re)xe.push("disableremoteplayback");if(Y)xe.push(`crossorigin="${Y}"`);if(V){if(xe.push(`data-preload="${z}"`),xe.push('preload="none"'),he)xe.push(`data-poster="${Xt(he)}"`);xe.push("data-stx-lazy")}else if(xe.push(`preload="${z}"`),he)xe.push(`poster="${Xt(he)}"`);let $e=U||_.metadata?.width,Re=H||_.metadata?.height;if($e)xe.push(`width="${$e}"`);if(Re)xe.push(`height="${Re}"`);if(se)xe.push(`class="${Xt(se)}"`);if(ie)xe.push(`style="${Xt(ie)}"`);let Ae=` <source ${V?`data-src="${Xt(ce)}"`:`src="${Xt(ce)}"`} type="${oe}" />`,Te=`<video ${xe.join(" ")}>
2485
2485
  ${Ae}
2486
2486
  Your browser does not support the video tag.
2487
2487
  </video>`;if(_.spriteSheet)Te=`<div class="stx-video-wrapper" data-sprite-sheet="${Xt(_.spriteSheet.url)}" data-sprite-cols="${_.spriteSheet.columns}" data-sprite-interval="${_.spriteSheet.interval}">
@@ -2530,9 +2530,9 @@ ${Te}
2530
2530
  width: 100%;
2531
2531
  height: auto;
2532
2532
  }
2533
- `.trim();return{html:Te,script:_e,css:Pe}}function xh(){return Xe({name:"video",hasEndTag:!1,description:"Render a video with optional ts-videos processing, streaming, and poster generation",transform:async(v,_,k,E)=>{let{src:T,options:j}=g0(v,_,k);if(!T)return console.warn("@video directive: missing src argument"),"<!-- @video: missing src -->";let B={src:T,poster:j.poster,controls:j.controls!==!1,autoplay:j.autoplay||!1,muted:j.muted||!1,loop:j.loop||!1,preload:j.preload||"metadata",playsinline:j.playsinline!==!1,lazy:j.lazy!==!1,player:j.player||"native",type:j.type,width:j.width,height:j.height,class:j.class,style:j.style,id:j.id,crossorigin:j.crossorigin,disablePictureInPicture:j.disablePictureInPicture,disableRemotePlayback:j.disableRemotePlayback,title:j.title,quality:j.quality,platform:j.platform,process:j.process,generatePoster:j.generatePoster,streaming:j.streaming,transcode:j.transcode,spriteSheet:j.spriteSheet,waveform:j.waveform},F={isDev:k.__isDev||!1,tsVideosConfig:k.__tsVideosConfig},V=await Ca(B,F),U=V.html;if(V.css)U+=`
2533
+ `.trim();return{html:Te,script:_e,css:Pe}}function bh(){return Xe({name:"video",hasEndTag:!1,description:"Render a video with optional ts-videos processing, streaming, and poster generation",transform:async(v,_,k,E)=>{let{src:T,options:j}=m0(v,_,k);if(!T)return console.warn("@video directive: missing src argument"),"<!-- @video: missing src -->";let B={src:T,poster:j.poster,controls:j.controls!==!1,autoplay:j.autoplay||!1,muted:j.muted||!1,loop:j.loop||!1,preload:j.preload||"metadata",playsinline:j.playsinline!==!1,lazy:j.lazy!==!1,player:j.player||"native",type:j.type,width:j.width,height:j.height,class:j.class,style:j.style,id:j.id,crossorigin:j.crossorigin,disablePictureInPicture:j.disablePictureInPicture,disableRemotePlayback:j.disableRemotePlayback,title:j.title,quality:j.quality,platform:j.platform,process:j.process,generatePoster:j.generatePoster,streaming:j.streaming,transcode:j.transcode,spriteSheet:j.spriteSheet,waveform:j.waveform},F={isDev:k.__isDev||!1,tsVideosConfig:k.__tsVideosConfig},V=await Ca(B,F),U=V.html;if(V.css)U+=`
2534
2534
  <style>${V.css}</style>`;if(V.script)U+=`
2535
- <script>${V.script}</script>`;return U},defaults:{src:"",options:{controls:!0,lazy:!0,preload:"metadata"}}})}function g0(v,_,k){if(_.src)return{src:String(_.src),options:_.options||{}};let E=v.trim();if(E.startsWith("@video(")||E.startsWith("("))E=E.replace(/^@video\(/,"").replace(/^\(/,"").replace(/\)$/,"");let T=m0(E),j=bh(T[0],k)||"",B={};if(T[1]){let z=bh(T[1],k);if(typeof z==="object"&&z!==null)B=z;else if(typeof T[1]==="string")try{B=JSON.parse(T[1])}catch{}}return{src:j,options:B}}function m0(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 bh(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 bu=xh();import h0 from"fs";import kn from"path";async function Zn(v,_){if(!v.webComponents?.enabled)return[];let k=v.webComponents.components||[],E=[];if(k.length>0){if(v.debug)console.log(`Building ${k.length} web components...`);for(let T of k)try{let j=await y0(T,v,_);if(j)E.push(j)}catch(j){if(console.error(`Error building web component ${T.name}:`,j),v.debug)throw j}}return E}async function y0(v,_,k){let{name:E,file:T,tag:j,extends:B}=v;if(!E||!T||!j)return console.error("Invalid web component configuration, missing required fields:",v),null;let z=null;if(kn.isAbsolute(T)&&await r(T))z=T;else if(_.componentsDir){let se=kn.join(_.componentsDir,T);if(await r(se))z=se}if(!z)z=await Yn(T,process.cwd(),_,k);if(!z)return console.error(`Web component source file not found: ${T}`),null;let F=await Bun.file(z).text();k.add(z);let U=(v.outputFormat||"js")==="ts",H=U?b0({name:E,tag:j,baseElement:B,source:F,shadowDOM:v.shadowDOM??!0,template:v.template??!0,styleSource:v.styleSource,attributes:v.attributes||[],attributeTypes:v.attributeTypes||{}}):x0({name:E,tag:j,baseElement:B,source:F,shadowDOM:v.shadowDOM??!0,template:v.template??!0,styleSource:v.styleSource,attributes:v.attributes||[]}),Y=_.webComponents?.outputDir||"dist/web-components";await h0.promises.mkdir(Y,{recursive:!0});let J=U?"ts":"js",re=kn.join(Y,`${j}.${J}`);if(await Bun.write(re,H),_.debug)console.log(`Built web component ${E} -> ${re}`);return re}function x0(v){let{name:_,tag:k,baseElement:E="HTMLElement",source:T,shadowDOM:j,template:B,styleSource:z,attributes:F=[]}=v,V=T.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").trim();if(!j)V=V.replace(/<slot\s+name=["']([^"']+)["']\s*>([\s\S]*?)<\/slot>/gi,'<div data-slot="$1">$2</div>'),V=V.replace(/<slot\s+name=["']([^"']+)["']\s*\/>/gi,'<div data-slot="$1"></div>'),V=V.replace(/<slot\s*>([\s\S]*?)<\/slot>/gi,"<div data-default-slot>$1</div>"),V=V.replace(/<slot\s*\/>/gi,"<div data-default-slot></div>");let U="";if(z)U=`<link rel="stylesheet" href="${z}">`;return`/**
2535
+ <script>${V.script}</script>`;return U},defaults:{src:"",options:{controls:!0,lazy:!0,preload:"metadata"}}})}function m0(v,_,k){if(_.src)return{src:String(_.src),options:_.options||{}};let E=v.trim();if(E.startsWith("@video(")||E.startsWith("("))E=E.replace(/^@video\(/,"").replace(/^\(/,"").replace(/\)$/,"");let T=h0(E),j=vh(T[0],k)||"",B={};if(T[1]){let z=vh(T[1],k);if(typeof z==="object"&&z!==null)B=z;else if(typeof T[1]==="string")try{B=JSON.parse(T[1])}catch{}}return{src:j,options:B}}function h0(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 vh(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 bu=bh();import y0 from"fs";import kn from"path";async function Zn(v,_){if(!v.webComponents?.enabled)return[];let k=v.webComponents.components||[],E=[];if(k.length>0){if(v.debug)console.log(`Building ${k.length} web components...`);for(let T of k)try{let j=await x0(T,v,_);if(j)E.push(j)}catch(j){if(console.error(`Error building web component ${T.name}:`,j),v.debug)throw j}}return E}async function x0(v,_,k){let{name:E,file:T,tag:j,extends:B}=v;if(!E||!T||!j)return console.error("Invalid web component configuration, missing required fields:",v),null;let z=null;if(kn.isAbsolute(T)&&await r(T))z=T;else if(_.componentsDir){let se=kn.join(_.componentsDir,T);if(await r(se))z=se}if(!z)z=await Yn(T,process.cwd(),_,k);if(!z)return console.error(`Web component source file not found: ${T}`),null;let F=await Bun.file(z).text();k.add(z);let U=(v.outputFormat||"js")==="ts",H=U?v0({name:E,tag:j,baseElement:B,source:F,shadowDOM:v.shadowDOM??!0,template:v.template??!0,styleSource:v.styleSource,attributes:v.attributes||[],attributeTypes:v.attributeTypes||{}}):b0({name:E,tag:j,baseElement:B,source:F,shadowDOM:v.shadowDOM??!0,template:v.template??!0,styleSource:v.styleSource,attributes:v.attributes||[]}),Y=_.webComponents?.outputDir||"dist/web-components";await y0.promises.mkdir(Y,{recursive:!0});let J=U?"ts":"js",re=kn.join(Y,`${j}.${J}`);if(await Bun.write(re,H),_.debug)console.log(`Built web component ${E} -> ${re}`);return re}function b0(v){let{name:_,tag:k,baseElement:E="HTMLElement",source:T,shadowDOM:j,template:B,styleSource:z,attributes:F=[]}=v,V=T.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").trim();if(!j)V=V.replace(/<slot\s+name=["']([^"']+)["']\s*>([\s\S]*?)<\/slot>/gi,'<div data-slot="$1">$2</div>'),V=V.replace(/<slot\s+name=["']([^"']+)["']\s*\/>/gi,'<div data-slot="$1"></div>'),V=V.replace(/<slot\s*>([\s\S]*?)<\/slot>/gi,"<div data-default-slot>$1</div>"),V=V.replace(/<slot\s*\/>/gi,"<div data-default-slot></div>");let U="";if(z)U=`<link rel="stylesheet" href="${z}">`;return`/**
2536
2536
  * ${_} Web Component
2537
2537
  * Auto-generated from stx component
2538
2538
  */
@@ -2624,7 +2624,7 @@ class ${_.replace(/\W/g,"")} extends ${E} {
2624
2624
 
2625
2625
  // Register the web component
2626
2626
  customElements.define('${k}', ${_.replace(/\W/g,"")})
2627
- `}function b0(v){let{name:_,tag:k,baseElement:E="HTMLElement",source:T,shadowDOM:j,template:B,styleSource:z,attributes:F=[],attributeTypes:V={}}=v,U=_.replace(/\W/g,""),H=T.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").trim();if(!j)H=H.replace(/<slot\s+name=["']([^"']+)["']\s*>([\s\S]*?)<\/slot>/gi,'<div data-slot="$1">$2</div>'),H=H.replace(/<slot\s+name=["']([^"']+)["']\s*\/>/gi,'<div data-slot="$1"></div>'),H=H.replace(/<slot\s*>([\s\S]*?)<\/slot>/gi,"<div data-default-slot>$1</div>"),H=H.replace(/<slot\s*\/>/gi,"<div data-default-slot></div>");H=H.replace(/`/g,"\\`").replace(/\$\{/g,"\\${");let Y=z?`<link rel="stylesheet" href="${z}">`:"",J=(he)=>{switch(V[he]){case"number":return"number";case"boolean":return"boolean";case"object":return"Record<string, unknown>";default:return"string"}},re=(he)=>he.replace(/-([a-z])/g,(xe,$e)=>$e.toUpperCase()),se=F.map((he)=>` private _${re(he)}: ${J(he)} | null = null;`).join(`
2627
+ `}function v0(v){let{name:_,tag:k,baseElement:E="HTMLElement",source:T,shadowDOM:j,template:B,styleSource:z,attributes:F=[],attributeTypes:V={}}=v,U=_.replace(/\W/g,""),H=T.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").trim();if(!j)H=H.replace(/<slot\s+name=["']([^"']+)["']\s*>([\s\S]*?)<\/slot>/gi,'<div data-slot="$1">$2</div>'),H=H.replace(/<slot\s+name=["']([^"']+)["']\s*\/>/gi,'<div data-slot="$1"></div>'),H=H.replace(/<slot\s*>([\s\S]*?)<\/slot>/gi,"<div data-default-slot>$1</div>"),H=H.replace(/<slot\s*\/>/gi,"<div data-default-slot></div>");H=H.replace(/`/g,"\\`").replace(/\$\{/g,"\\${");let Y=z?`<link rel="stylesheet" href="${z}">`:"",J=(he)=>{switch(V[he]){case"number":return"number";case"boolean":return"boolean";case"object":return"Record<string, unknown>";default:return"string"}},re=(he)=>he.replace(/-([a-z])/g,(xe,$e)=>$e.toUpperCase()),se=F.map((he)=>` private _${re(he)}: ${J(he)} | null = null;`).join(`
2628
2628
  `),ie=F.map((he)=>{let xe=J(he),$e=re(he);return`
2629
2629
  get ${$e}(): ${xe} | null {
2630
2630
  return this._${$e};
@@ -2779,7 +2779,7 @@ declare global {
2779
2779
 
2780
2780
  // Register the web component
2781
2781
  customElements.define('${k}', ${U});
2782
- `}function v0(v,_){let k=v.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),E=k?k[1].trim():"",T=_,j=[],B=!0;if(E){let H=E.match(/export\s+default\s+({[\s\S]*})/);if(H)try{let Y=H[1],J=Y.match(/tag\s*:\s*['"`]([^'"`]+)['"`]/);if(J)T=J[1];let re=Y.match(/props\s*:\s*\[([\s\S]*?)\]/);if(re)j=re[1].split(",").map((ie)=>ie.trim().replace(/['"`]/g,"")).filter((ie)=>ie.length>0);let se=Y.match(/shadowDOM\s*:\s*(true|false)/);if(se)B=se[1]==="true"}catch{}}let z=v.match(/<template\b(?![^>]*\bid\s*=)[^>]*>([\s\S]*?)<\/template>/i),F=z?z[1].trim():"",V=v.match(/<style\b[^>]*>([\s\S]*?)<\/style>/i),U=V?V[1].trim():"";return{tag:T,props:j,template:F,styles:U,script:E,shadowDOM:B}}function w0(v){let{tag:_,props:k,template:E,styles:T,shadowDOM:j}=v,B=_.split("-").map((H)=>H.charAt(0).toUpperCase()+H.slice(1)).join(""),z=E.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\$\{/g,"\\${"),F=T.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),V=k.map((H)=>`'${H}'`).join(", "),U=k.map((H)=>`
2782
+ `}function w0(v,_){let k=v.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),E=k?k[1].trim():"",T=_,j=[],B=!0;if(E){let H=E.match(/export\s+default\s+({[\s\S]*})/);if(H)try{let Y=H[1],J=Y.match(/tag\s*:\s*['"`]([^'"`]+)['"`]/);if(J)T=J[1];let re=Y.match(/props\s*:\s*\[([\s\S]*?)\]/);if(re)j=re[1].split(",").map((ie)=>ie.trim().replace(/['"`]/g,"")).filter((ie)=>ie.length>0);let se=Y.match(/shadowDOM\s*:\s*(true|false)/);if(se)B=se[1]==="true"}catch{}}let z=v.match(/<template\b(?![^>]*\bid\s*=)[^>]*>([\s\S]*?)<\/template>/i),F=z?z[1].trim():"",V=v.match(/<style\b[^>]*>([\s\S]*?)<\/style>/i),U=V?V[1].trim():"";return{tag:T,props:j,template:F,styles:U,script:E,shadowDOM:B}}function S0(v){let{tag:_,props:k,template:E,styles:T,shadowDOM:j}=v,B=_.split("-").map((H)=>H.charAt(0).toUpperCase()+H.slice(1)).join(""),z=E.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\$\{/g,"\\${"),F=T.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),V=k.map((H)=>`'${H}'`).join(", "),U=k.map((H)=>`
2783
2783
  get ${H}() {
2784
2784
  return this.getAttribute('${H}') || '';
2785
2785
  }
@@ -2830,8 +2830,8 @@ ${U}
2830
2830
  }
2831
2831
 
2832
2832
  customElements.define('${_}', ${B});
2833
- `}async function vh(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=kn.isAbsolute(B)?[kn.join(B,`${T}.stx`),kn.join(kn.dirname(E),`${T}.stx`)]:[kn.join(kn.dirname(E),B,`${T}.stx`),kn.join(process.cwd(),B,`${T}.stx`),kn.join(kn.dirname(E),`${T}.stx`)],F=null;for(let H of z)if(await r(H)){F=await Bun.file(H).text();break}if(!F)return i("WebComponent",`Component file not found: ${T}.stx`,t.FILE_NOT_FOUND);let V=v0(F,T);return`<script type="module">
2834
- ${w0(V)}
2835
- </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:nh,hasEndTag:!0,description:"Render markdown content to HTML"},{name:"webcomponent",handler:vh,hasEndTag:!1,description:"Include a web component in the template"},Si,ki,nr,rr,Eu,Ru,Au,Cu,Iu,Ou,dh,bu,...hr],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 S0(v,_,k){let E=_||"pages";if(v)return{root:v,pagesDir:E};let T=k||process.cwd(),j=Zt.join(T,"resources","views"),B=Zt.join(T,"resources","layouts");if(Ys.existsSync(j)&&Ys.existsSync(B))return{root:"resources",pagesDir:"views"};let z=Zt.join(T,"resources","views","pages");if(Ys.existsSync(z))return{root:"resources/views",pagesDir:E};return{root:".",pagesDir:E}}var wh=new Set,Aa=["partialsDir","componentsDir","layoutsDir"],wu=new WeakMap;function $0(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 zc(v,_){let k=!v.root,E=S0(v.root,v.pagesDir,_);if(v.root=E.root,v.pagesDir=E.pagesDir,k&&E.root!=="."){let T=`${_}::${E.root}`;if(!wh.has(T))wh.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(!wu.has(v)){let T={};for(let j of Aa){let B=v[j];if(typeof B==="string"&&B)T[j]=B}wu.set(v,T)}if(v.root&&v.root!=="."){let T=v.root;for(let j of Aa){let B=v[j];if(typeof B!=="string"||!B)continue;if(Zt.isAbsolute(B)||$0(B,T))continue;v[j]=Zt.join(T,B)}}for(let T of Aa){let j=v[T];if(typeof j!=="string"||!j||Zt.isAbsolute(j))continue;v[T]=Zt.resolve(_,j)}return v}function _0(v,_){let k=wu.get(v);for(let E of Aa){let T=v[E];if(typeof T!=="string"||!T)continue;let j=Zt.isAbsolute(T)?T:Zt.join(_,T);if(Ys.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 k0(v){if(v.customDirectives)v.customDirectives=[...v.customDirectives];if(v.middleware)v.middleware=[...v.middleware];if(v.apiRoutes)v.apiRoutes={...v.apiRoutes}}function E0(v){if($i(v.stateDir),v.stateDir=dn(),v.cachePath=un(v.cachePath),v.build)v.build.cacheDir=un(v.build.cacheDir);if(v.media?.cache)v.media.cache.directory=un(v.media.cache.directory);if(v.story)v.story.outDir=un(v.story.outDir)}var Er=null,zr=new Map,Ra=new Map,lo=null;async function o(v){let _=v?Zt.resolve(v):process.cwd(),k=Ra.get(_);if(k&&k.signature!==Qn(k.graph)){let j=zr.get(_);if(zr.delete(_),Ra.delete(_),!v)Er=null,lo=null;let{clearComponentCache:B}=await import("./chunk-xvg4nzz6.js"),{partialsCache:z}=await import("./chunk-g1c3davk.js");if(B(),z.clear(),j&&k.configSignature===er(k.graph)){let F=j.then(async(V)=>{let U={...k.graph};await _s(U,_),Ra.set(_,{graph:U,signature:Qn(U),configSignature:er(U)});let H={...V,_layerGraph:U};if(!v)Er=H;return H});return zr.set(_,F),F}}if(!v){if(Er)return Er;if(lo)return lo}let E=zr.get(_);if(E)return E;let T=(async()=>{let j=[".ts",".js",".mjs",".cjs",".json"],B=j.some((Y)=>Ys.existsSync(Zt.join(_,`stx.config${Y}`))),z=j.some((Y)=>Ys.existsSync(Zt.join(_,"config",`ui${Y}`))),F;if(B&&z){let Y=await vu({name:"ui",cwd:Zt.join(_,"config"),defaultConfig:R,verbose:!1});F=(await vu({name:"stx",alias:"ui",cwd:_,defaultConfig:Y.config,verbose:!1})).config}else F=(await vu({name:"stx",alias:"ui",cwd:_,defaultConfig:R,verbose:!1})).config;if(F.extends!==void 0||k){let Y=await _i(_,R);F=Y.config,Ra.set(_,{graph:Y.graph,signature:Qn(Y.graph),configSignature:er(Y.graph)})}if(F.runtimeConfig){let{resolveRuntimeConfig:Y}=await import("./chunk-d8fhthyf.js");Y(F.runtimeConfig,{});let{generateRuntimeConfigTypes:J}=await import("./chunk-mpga9770.js");await J(_,F.runtimeConfig)}k0(F),E0(F),zc(F,_),_0(F,_);let V=[],U=new Set((F.plugins??[]).map((Y)=>typeof Y==="string"?Y:Y[0]));for(let Y of F.componentPackages??["@stacksjs/components"]){let J=`${Y}/stx-plugin`;if(U.has(J)||U.has(Y))continue;try{u.resolve(J,{paths:[_]}),V.push(J)}catch{}}let H=[...F.plugins??[],...V];if(H.length>0){let{pluginManager:Y}=await import("./chunk-hzx0vtw0.js"),J=[],re=[];for(let se of H){let ie=typeof se==="string"?se:se[0],ae=typeof se==="string"?{}:se[1]||{};try{let ce,oe;try{let he=u.resolve(ie,{paths:[_]});ce=await import(he),oe=Zt.dirname(he)}catch{let he=Zt.resolve(_,ie);ce=await import(he),oe=Zt.dirname(he)}let pe=ce.default||ce;if(!Y.has(pe.name))await Y.register(pe,F);if(pe.components){let he=Array.isArray(pe.components)?pe.components:[pe.components];for(let xe of he)J.push(Zt.resolve(oe,xe))}if(pe.pages){let he=Zt.resolve(oe,pe.pages),xe=ae.path||"/";re.push({dir:he,prefix:xe})}if(pe.setup){let he={addDirective:(xe)=>{F.customDirectives=F.customDirectives||[],F.customDirectives.push(xe)},addRoute:(xe,$e)=>{F.apiRoutes=F.apiRoutes||{},F.apiRoutes[xe]=$e},addMiddleware:(xe)=>{F.middleware=F.middleware||[],F.middleware.push(xe)},pluginDir:oe,config:F};await pe.setup(ae,he)}process.stderr.write(`[stx] Plugin loaded: ${pe.name||ie}
2836
- `)}catch(ce){console.warn(`[stx] Failed to load plugin ${ie}:`,ce.message)}}F._pluginComponentDirs=J,F._pluginPageDirs=re}return F})();if(zr.set(_,T),T.catch(()=>{if(zr.get(_)===T)zr.delete(_)}),!v)lo=T,T.then((j)=>{Er=j}).catch(()=>{});return T}var A=new Proxy(R,{get(v,_){if(Er&&_ in Er)return Er[_];if(!lo)o().catch((k)=>{console.warn("[stx] Failed to load config file:",k?.message||k)});return v[_]}});function nu(v){return v}function ru(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 $u=new Map;async function de(v,_={}){try{if(!await r(v))throw Error(`Markdown file not found: ${v}`);let E=(await C0.promises.stat(v)).mtime.getTime();if(_.cache&&$u.has(v)){let H=$u.get(v);if(H.updatedAt>=E)return{content:H.content,data:H.data}}let T=await Bun.file(v).text(),{data:j,content:B}=Fn(T),z=_.markdown||A.markdown||{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0}},V=Le(B,{gfm:!0});if(z.syntaxHighlighting?.enabled&&z.syntaxHighlighting?.serverSide)V=await A0(V,z.syntaxHighlighting?.defaultTheme||"github-dark",z.syntaxHighlighting?.highlightUnknownLanguages||!1);let U={content:V,data:j||{}};if(_.cache)$u.set(v,{...U,updatedAt:E});return U}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 Ta=null;async function A0(v,_,k){let E=/<pre><code( class="language-([^"]+)")?>([^<]+)<\/code><\/pre>/g;if(!Ta)try{Ta=await R0({theme:_||"github-dark",cache:!0})}catch(z){return console.error("Failed to initialize ts-syntax-highlighter:",z),v}let T=async(z,F,V,U)=>{let H=U.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&").replace(/&quot;/g,'"').replace(/&#39;/g,"'"),Y=V||(k?"text":"");if(!Y)return z;try{if(!Ta.getSupportedLanguages().includes(Y))return z;return(await Ta.highlight(H,Y,{theme:_})).html}catch(J){console.error(`Error highlighting code block with language ${V}:`,J)}return z},j=v,B=v.matchAll(E);for(let z of B){let[F,V,U,H]=z,Y=await T(F,V,U,H);j=j.replace(F,Y)}return j}async function Om(v,_,k="",E={}){return await T0(v,/@markdown-file\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\}))?\)/g,async(B,z,F,V)=>{try{let U=z;if(!Su.isAbsolute(z))U=Su.resolve(Su.dirname(k),z);let H={};if(F)try{try{H=JSON.parse(F)}catch{if(E.debug)console.warn("Using safer alternative for parsing JS object literal");let ce=F.replace(/^\s*\{|\}\s*$/g,"").trim().split(/,(?=\s*\w+\s*:)/);for(let oe of ce){let pe=oe.indexOf(":");if(pe>0){let he=oe.substring(0,pe).trim(),xe=oe.substring(pe+1).trim(),$e=xe.startsWith('"')&&xe.endsWith('"'),Re=xe.startsWith("'")&&xe.endsWith("'");if($e||Re)xe=xe.substring(1,xe.length-1);H[he]=xe}}}}catch(ae){if(E.debug)console.error("Error parsing context in @markdown-file directive:",ae)}let{content:Y,data:J}=await de(U,E),re={..._,...J,...H},se=Y,ie=/\{\{([^}]+)\}\}/g;return se=se.replace(ie,(ae,ce)=>{let oe=ce.trim();return re[oe]!==void 0?String(re[oe]):ae}),se}catch(U){let H=U instanceof Error?U.message:String(U);return g("Markdown File",`Error including markdown file: ${H}`,k,v,V,B)}})}async function T0(v,_,k){let E=[],T;while((T=_.exec(v))!==null){let z=T[0],F=T.index,V=T;E.push(k(...V).then((U)=>({match:z,replacement:U,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}
2833
+ `}async function wh(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=kn.isAbsolute(B)?[kn.join(B,`${T}.stx`),kn.join(kn.dirname(E),`${T}.stx`)]:[kn.join(kn.dirname(E),B,`${T}.stx`),kn.join(process.cwd(),B,`${T}.stx`),kn.join(kn.dirname(E),`${T}.stx`)],F=null;for(let H of z)if(await r(H)){F=await Bun.file(H).text();break}if(!F)return i("WebComponent",`Component file not found: ${T}.stx`,t.FILE_NOT_FOUND);let V=w0(F,T);return`<script type="module">
2834
+ ${S0(V)}
2835
+ </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:rh,hasEndTag:!0,description:"Render markdown content to HTML"},{name:"webcomponent",handler:wh,hasEndTag:!1,description:"Include a web component in the template"},Si,ki,nr,rr,Eu,Ru,Au,Cu,Iu,Mu,fh,bu,...hr],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 $0(v,_,k){let E=_||"pages";if(v)return{root:v,pagesDir:E};let T=k||process.cwd(),j=Zt.join(T,"resources","views"),B=Zt.join(T,"resources","layouts");if(Ys.existsSync(j)&&Ys.existsSync(B))return{root:"resources",pagesDir:"views"};let z=Zt.join(T,"resources","views","pages");if(Ys.existsSync(z))return{root:"resources/views",pagesDir:E};return{root:".",pagesDir:E}}var Sh=new Set,Aa=["partialsDir","componentsDir","layoutsDir"],wu=new WeakMap;function _0(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 zc(v,_){let k=!v.root,E=$0(v.root,v.pagesDir,_);if(v.root=E.root,v.pagesDir=E.pagesDir,k&&E.root!=="."){let T=`${_}::${E.root}`;if(!Sh.has(T))Sh.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(!wu.has(v)){let T={};for(let j of Aa){let B=v[j];if(typeof B==="string"&&B)T[j]=B}wu.set(v,T)}if(v.root&&v.root!=="."){let T=v.root;for(let j of Aa){let B=v[j];if(typeof B!=="string"||!B)continue;if(Zt.isAbsolute(B)||_0(B,T))continue;v[j]=Zt.join(T,B)}}for(let T of Aa){let j=v[T];if(typeof j!=="string"||!j||Zt.isAbsolute(j))continue;v[T]=Zt.resolve(_,j)}return v}function k0(v,_){let k=wu.get(v);for(let E of Aa){let T=v[E];if(typeof T!=="string"||!T)continue;let j=Zt.isAbsolute(T)?T:Zt.join(_,T);if(Ys.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 E0(v){if(v.customDirectives)v.customDirectives=[...v.customDirectives];if(v.middleware)v.middleware=[...v.middleware];if(v.apiRoutes)v.apiRoutes={...v.apiRoutes}}function C0(v){if($i(v.stateDir),v.stateDir=dn(),v.cachePath=un(v.cachePath),v.build)v.build.cacheDir=un(v.build.cacheDir);if(v.media?.cache)v.media.cache.directory=un(v.media.cache.directory);if(v.story)v.story.outDir=un(v.story.outDir)}var Er=null,zr=new Map,Ra=new Map,uo=null;async function o(v){let _=v?Zt.resolve(v):process.cwd(),k=Ra.get(_);if(k&&k.signature!==Qn(k.graph)){let j=zr.get(_);if(zr.delete(_),Ra.delete(_),!v)Er=null,uo=null;let{clearComponentCache:B}=await import("./chunk-6qfrs1pj.js"),{partialsCache:z}=await import("./chunk-384xy328.js");if(B(),z.clear(),j&&k.configSignature===er(k.graph)){let F=j.then(async(V)=>{let U={...k.graph};await _s(U,_),Ra.set(_,{graph:U,signature:Qn(U),configSignature:er(U)});let H={...V,_layerGraph:U};if(!v)Er=H;return H});return zr.set(_,F),F}}if(!v){if(Er)return Er;if(uo)return uo}let E=zr.get(_);if(E)return E;let T=(async()=>{let j=[".ts",".js",".mjs",".cjs",".json"],B=j.some((Y)=>Ys.existsSync(Zt.join(_,`stx.config${Y}`))),z=j.some((Y)=>Ys.existsSync(Zt.join(_,"config",`ui${Y}`))),F;if(B&&z){let Y=await vu({name:"ui",cwd:Zt.join(_,"config"),defaultConfig:R,verbose:!1});F=(await vu({name:"stx",alias:"ui",cwd:_,defaultConfig:Y.config,verbose:!1})).config}else F=(await vu({name:"stx",alias:"ui",cwd:_,defaultConfig:R,verbose:!1})).config;if(F.extends!==void 0||k){let Y=await _i(_,R);F=Y.config,Ra.set(_,{graph:Y.graph,signature:Qn(Y.graph),configSignature:er(Y.graph)})}if(F.runtimeConfig){let{resolveRuntimeConfig:Y}=await import("./chunk-d8fhthyf.js");Y(F.runtimeConfig,{});let{generateRuntimeConfigTypes:J}=await import("./chunk-3bb0tjs3.js");await J(_,F.runtimeConfig)}E0(F),C0(F),zc(F,_),k0(F,_);let V=[],U=new Set((F.plugins??[]).map((Y)=>typeof Y==="string"?Y:Y[0]));for(let Y of F.componentPackages??["@stacksjs/components"]){let J=`${Y}/stx-plugin`;if(U.has(J)||U.has(Y))continue;try{u.resolve(J,{paths:[_]}),V.push(J)}catch{}}let H=[...F.plugins??[],...V];if(H.length>0){let{pluginManager:Y}=await import("./chunk-hzx0vtw0.js"),J=[],re=[];for(let se of H){let ie=typeof se==="string"?se:se[0],ae=typeof se==="string"?{}:se[1]||{};try{let ce,oe;try{let he=u.resolve(ie,{paths:[_]});ce=await import(he),oe=Zt.dirname(he)}catch{let he=Zt.resolve(_,ie);ce=await import(he),oe=Zt.dirname(he)}let pe=ce.default||ce;if(!Y.has(pe.name))await Y.register(pe,F);if(pe.components){let he=Array.isArray(pe.components)?pe.components:[pe.components];for(let xe of he)J.push(Zt.resolve(oe,xe))}if(pe.pages){let he=Zt.resolve(oe,pe.pages),xe=ae.path||"/";re.push({dir:he,prefix:xe})}if(pe.setup){let he={addDirective:(xe)=>{F.customDirectives=F.customDirectives||[],F.customDirectives.push(xe)},addRoute:(xe,$e)=>{F.apiRoutes=F.apiRoutes||{},F.apiRoutes[xe]=$e},addMiddleware:(xe)=>{F.middleware=F.middleware||[],F.middleware.push(xe)},pluginDir:oe,config:F};await pe.setup(ae,he)}process.stderr.write(`[stx] Plugin loaded: ${pe.name||ie}
2836
+ `)}catch(ce){console.warn(`[stx] Failed to load plugin ${ie}:`,ce.message)}}F._pluginComponentDirs=J,F._pluginPageDirs=re}return F})();if(zr.set(_,T),T.catch(()=>{if(zr.get(_)===T)zr.delete(_)}),!v)uo=T,T.then((j)=>{Er=j}).catch(()=>{});return T}var A=new Proxy(R,{get(v,_){if(Er&&_ in Er)return Er[_];if(!uo)o().catch((k)=>{console.warn("[stx] Failed to load config file:",k?.message||k)});return v[_]}});function nu(v){return v}function ru(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 $u=new Map;async function de(v,_={}){try{if(!await r(v))throw Error(`Markdown file not found: ${v}`);let E=(await R0.promises.stat(v)).mtime.getTime();if(_.cache&&$u.has(v)){let H=$u.get(v);if(H.updatedAt>=E)return{content:H.content,data:H.data}}let T=await Bun.file(v).text(),{data:j,content:B}=Fn(T),z=_.markdown||A.markdown||{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0}},V=Le(B,{gfm:!0});if(z.syntaxHighlighting?.enabled&&z.syntaxHighlighting?.serverSide)V=await T0(V,z.syntaxHighlighting?.defaultTheme||"github-dark",z.syntaxHighlighting?.highlightUnknownLanguages||!1);let U={content:V,data:j||{}};if(_.cache)$u.set(v,{...U,updatedAt:E});return U}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 Ta=null;async function T0(v,_,k){let E=/<pre><code( class="language-([^"]+)")?>([^<]+)<\/code><\/pre>/g;if(!Ta)try{Ta=await A0({theme:_||"github-dark",cache:!0})}catch(z){return console.error("Failed to initialize ts-syntax-highlighter:",z),v}let T=async(z,F,V,U)=>{let H=U.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&").replace(/&quot;/g,'"').replace(/&#39;/g,"'"),Y=V||(k?"text":"");if(!Y)return z;try{if(!Ta.getSupportedLanguages().includes(Y))return z;return(await Ta.highlight(H,Y,{theme:_})).html}catch(J){console.error(`Error highlighting code block with language ${V}:`,J)}return z},j=v,B=v.matchAll(E);for(let z of B){let[F,V,U,H]=z,Y=await T(F,V,U,H);j=j.replace(F,Y)}return j}async function Om(v,_,k="",E={}){return await I0(v,/@markdown-file\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\}))?\)/g,async(B,z,F,V)=>{try{let U=z;if(!Su.isAbsolute(z))U=Su.resolve(Su.dirname(k),z);let H={};if(F)try{try{H=JSON.parse(F)}catch{if(E.debug)console.warn("Using safer alternative for parsing JS object literal");let ce=F.replace(/^\s*\{|\}\s*$/g,"").trim().split(/,(?=\s*\w+\s*:)/);for(let oe of ce){let pe=oe.indexOf(":");if(pe>0){let he=oe.substring(0,pe).trim(),xe=oe.substring(pe+1).trim(),$e=xe.startsWith('"')&&xe.endsWith('"'),Re=xe.startsWith("'")&&xe.endsWith("'");if($e||Re)xe=xe.substring(1,xe.length-1);H[he]=xe}}}}catch(ae){if(E.debug)console.error("Error parsing context in @markdown-file directive:",ae)}let{content:Y,data:J}=await de(U,E),re={..._,...J,...H},se=Y,ie=/\{\{([^}]+)\}\}/g;return se=se.replace(ie,(ae,ce)=>{let oe=ce.trim();return re[oe]!==void 0?String(re[oe]):ae}),se}catch(U){let H=U instanceof Error?U.message:String(U);return g("Markdown File",`Error including markdown file: ${H}`,k,v,V,B)}})}async function I0(v,_,k){let E=[],T;while((T=_.exec(v))!==null){let z=T[0],F=T.index,V=T;E.push(k(...V).then((U)=>({match:z,replacement:U,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}
2837
2837
  export{Fn,Le,Wo,M,W,m,h,rn,q,w,je,Zr,Qr,rc,St,qo,es,Go,Dd,Be,ts,ye,Ko,Xo,Jo,ns,Z,Fe,kt,zn,sc,Md,oc,Nd,ic,Hn,b,Ct,be,ac,rs,cc,Ld,G,lc,jd,x,Bd,dc,Fd,zd,Hd,Ud,uc,pc,Vd,Wd,Yo,qd,sn,on,Un,Vn,e,Gd,Zo,Kd,Qo,fc,gc,Et,an,Xd,mc,hc,yc,f,ze,_t,He,Ue,ei,Wn,Q,ss,os,is,Jd,qn,Yd,cn,Ve,as,cs,bc,ee,ti,ni,ri,si,Gn,ls,oi,ii,ai,wc,ds,N,le,K,Zd,vc,us,ps,ci,li,gs,ms,Kn,xc,di,ui,Sc,We,ln,Xn,Tt,kc,Cc,Ec,_c,Tc,d,$c,hs,Rc,pi,fi,ys,gi,Ac,Qd,Pc,we,mi,eu,bs,ws,vs,hi,xs,Ss,ks,Cs,n,Ic,Oc,Dc,Mc,Nc,Lc,qe,L,Ge,jc,Jn,Bc,yi,Fc,Ke,r,Yn,bi,g,te,tu,Zn,R,zc,o,A,nu,ru,de};