@stacksjs/stx 0.2.468 → 0.2.470

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 (117) hide show
  1. package/dist/chunk-0q8xacmn.js +2 -0
  2. package/dist/{chunk-zkg0rbmp.js → chunk-168dqya1.js} +3 -3
  3. package/dist/{chunk-9kzk7zyy.js → chunk-250psr2a.js} +1 -1
  4. package/dist/chunk-2a22ep8p.js +2 -0
  5. package/dist/{chunk-151d1av1.js → chunk-2qz5gqqe.js} +7 -7
  6. package/dist/{chunk-gxbd7pwn.js → chunk-3c6v9hp1.js} +1 -1
  7. package/dist/{chunk-hhy33p5v.js → chunk-3jjevm1j.js} +6 -6
  8. package/dist/{chunk-n8y0hp9b.js → chunk-3q9hhpvz.js} +1 -1
  9. package/dist/chunk-4waxn99v.js +2 -0
  10. package/dist/{chunk-bqx3dqv1.js → chunk-564pmmj3.js} +1 -1
  11. package/dist/{chunk-8adstrk5.js → chunk-594tt40e.js} +2 -2
  12. package/dist/{chunk-cxbp2m66.js → chunk-5rx7ptse.js} +2 -2
  13. package/dist/chunk-695de40v.js +2 -0
  14. package/dist/chunk-6a1g18h4.js +2 -0
  15. package/dist/{chunk-s23ka56m.js → chunk-6sken7b2.js} +1 -1
  16. package/dist/{chunk-gkj42zq7.js → chunk-6vstn9dk.js} +1 -1
  17. package/dist/{chunk-tdsajnjm.js → chunk-71ttf2ne.js} +1 -1
  18. package/dist/{chunk-g1562mcs.js → chunk-8v24kvjk.js} +1 -1
  19. package/dist/chunk-94d2t16y.js +2 -0
  20. package/dist/{chunk-cjb46akr.js → chunk-98gxw97n.js} +1 -1
  21. package/dist/{chunk-27kb6nrb.js → chunk-9kb3my0w.js} +2 -2
  22. package/dist/{chunk-ggde5cqk.js → chunk-9pjy59d6.js} +65 -65
  23. package/dist/{chunk-9rpw3gqx.js → chunk-9q3dbv0w.js} +1 -1
  24. package/dist/{chunk-81nqrcn0.js → chunk-a6amx427.js} +1 -1
  25. package/dist/{chunk-t7s0pdtw.js → chunk-aw4jxj6a.js} +2 -2
  26. package/dist/chunk-b5mfa6w6.js +2 -0
  27. package/dist/chunk-bprn7crb.js +2 -0
  28. package/dist/{chunk-mqdnfn4h.js → chunk-cxgr65kt.js} +1 -1
  29. package/dist/{chunk-5rvbpmzc.js → chunk-cxkyt6ht.js} +1 -1
  30. package/dist/{chunk-m8w4hve0.js → chunk-dj3b04tn.js} +1 -1
  31. package/dist/chunk-ds6eqyq2.js +2 -0
  32. package/dist/chunk-dy0gm4e4.js +2 -0
  33. package/dist/chunk-e8ewjcmj.js +2 -0
  34. package/dist/{chunk-g4dmjede.js → chunk-f64rmdvt.js} +2 -2
  35. package/dist/chunk-fkgdbdqa.js +2 -0
  36. package/dist/chunk-g9dh9yat.js +2 -0
  37. package/dist/chunk-gg4hrjrf.js +2 -0
  38. package/dist/chunk-gna3h2yv.js +2 -0
  39. package/dist/{chunk-tbef3yyk.js → chunk-gskjzw5r.js} +3 -3
  40. package/dist/chunk-gyfb3rj5.js +2 -0
  41. package/dist/chunk-gzk5ak8f.js +2 -0
  42. package/dist/{chunk-xnjcmhs5.js → chunk-hjhz90kg.js} +2 -2
  43. package/dist/{chunk-t794av8e.js → chunk-hvmtpe7w.js} +1 -1
  44. package/dist/chunk-j04s01mf.js +2 -0
  45. package/dist/{chunk-a6s6hvcd.js → chunk-j3z1bfjt.js} +1 -1
  46. package/dist/{chunk-t61vdbje.js → chunk-ktvr45qg.js} +6 -6
  47. package/dist/chunk-kyda9myt.js +2 -0
  48. package/dist/chunk-m4sd2ker.js +2 -0
  49. package/dist/chunk-mhjndjjb.js +2 -0
  50. package/dist/{chunk-8h8pf1cj.js → chunk-mn6gcvk9.js} +4 -4
  51. package/dist/{chunk-x0mc2kv0.js → chunk-mx446wgp.js} +12 -4
  52. package/dist/{chunk-cwzkq9bs.js → chunk-nma8b17c.js} +71 -16
  53. package/dist/chunk-nrjevcyh.js +2 -0
  54. package/dist/chunk-pq9978k5.js +2 -0
  55. package/dist/{chunk-28s5x7wv.js → chunk-pz537q62.js} +2 -2
  56. package/dist/{chunk-2542vq5p.js → chunk-qf7da9f6.js} +1 -1
  57. package/dist/chunk-r0gx4p2m.js +2 -0
  58. package/dist/{chunk-jjebxeee.js → chunk-r7m8dh2g.js} +5 -5
  59. package/dist/{chunk-cnxf8e5p.js → chunk-rdn3egy7.js} +1 -1
  60. package/dist/chunk-rskf20cw.js +2 -0
  61. package/dist/{chunk-dts9z53c.js → chunk-rvzx5s72.js} +1 -1
  62. package/dist/{chunk-99kt56fn.js → chunk-scvzv5y2.js} +2 -2
  63. package/dist/chunk-sz2cf4w6.js +2 -0
  64. package/dist/{chunk-07mksefx.js → chunk-tydxqfs6.js} +1 -1
  65. package/dist/chunk-vbbrtrcg.js +2 -0
  66. package/dist/chunk-vc24bahj.js +2 -0
  67. package/dist/chunk-vkgsj6k0.js +2 -0
  68. package/dist/{chunk-a0jyh65n.js → chunk-wc6k446y.js} +3 -3
  69. package/dist/{chunk-2swdrsrq.js → chunk-wzeq29c1.js} +2 -2
  70. package/dist/{chunk-8xcg2dqy.js → chunk-xc27xdm6.js} +1 -1
  71. package/dist/{chunk-ss7wapbh.js → chunk-xts31rkc.js} +199 -199
  72. package/dist/{chunk-ykqq6cw0.js → chunk-y42ge4xh.js} +20 -20
  73. package/dist/chunk-y51pb1tc.js +2 -0
  74. package/dist/{chunk-74j18qk0.js → chunk-y8h823cb.js} +28 -28
  75. package/dist/{chunk-s10r6hxp.js → chunk-yd7g02v5.js} +7 -7
  76. package/dist/chunk-yn2d8x8m.js +3 -0
  77. package/dist/{chunk-c9fj7t9b.js → chunk-yv00fy8z.js} +1 -1
  78. package/dist/cli.js +43 -43
  79. package/dist/color-mode-boot.js +1 -1
  80. package/dist/craft-entry.js +2 -2
  81. package/dist/craft.js +2 -2
  82. package/dist/dev-server/ts-css.js +18 -2
  83. package/dist/pwa.js +3 -3
  84. package/dist/signals.js +69 -14
  85. package/dist/ssg.js +2 -2
  86. package/package.json +5 -5
  87. package/dist/chunk-129ernx4.js +0 -2
  88. package/dist/chunk-2njt4vbe.js +0 -2
  89. package/dist/chunk-3w22gpa9.js +0 -2
  90. package/dist/chunk-3ztpcnga.js +0 -2
  91. package/dist/chunk-4aw47rmg.js +0 -2
  92. package/dist/chunk-549wm9qp.js +0 -2
  93. package/dist/chunk-5jak1hxp.js +0 -2
  94. package/dist/chunk-7ppykfx2.js +0 -2
  95. package/dist/chunk-82nw3942.js +0 -2
  96. package/dist/chunk-8h2adg8c.js +0 -2
  97. package/dist/chunk-9h1kq4hv.js +0 -2
  98. package/dist/chunk-awsg50kd.js +0 -2
  99. package/dist/chunk-ax1xbz1k.js +0 -2
  100. package/dist/chunk-cg8hg6cs.js +0 -3
  101. package/dist/chunk-g3xgcnh4.js +0 -2
  102. package/dist/chunk-j338fs8k.js +0 -2
  103. package/dist/chunk-kyd15xqj.js +0 -2
  104. package/dist/chunk-m5asyydz.js +0 -2
  105. package/dist/chunk-m5dgc757.js +0 -2
  106. package/dist/chunk-m6cfxjyy.js +0 -2
  107. package/dist/chunk-mmh37ywa.js +0 -2
  108. package/dist/chunk-nskfyvbv.js +0 -2
  109. package/dist/chunk-q0w6a9hv.js +0 -2
  110. package/dist/chunk-q9yhnqe5.js +0 -2
  111. package/dist/chunk-rkzvmk04.js +0 -2
  112. package/dist/chunk-rx6a75yf.js +0 -2
  113. package/dist/chunk-se4b8sjc.js +0 -2
  114. package/dist/chunk-t4rgn046.js +0 -2
  115. package/dist/chunk-tr3e1qzf.js +0 -2
  116. package/dist/chunk-vr4t7exr.js +0 -2
  117. package/dist/chunk-zb5p05v4.js +0 -2
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{t,X,sr,i,te,As,A,_t,fn,Ps,c,p,D,xe,Ye,l,or}from"./chunk-ab7vh24b.js";import{yn,bn,ur,ke}from"./chunk-x0mc2kv0.js";import{mn,y,Si,Rt,Ds,ki,Ci,$i,Ei}from"./chunk-01nx6zcw.js";import{P}from"./chunk-pf0d8y9n.js";import{S,Ts,Ge,dn,nr,pe,Rs,fe,rr}from"./chunk-tbef3yyk.js";import{Cs,$s,Es,_s,Zn,Qn}from"./chunk-s10r6hxp.js";import{ue,Et,Yn,ks,C,Ke}from"./chunk-99kt56fn.js";import{ln}from"./chunk-8xcg2dqy.js";import{js}from"./chunk-pcq6vphz.js";import{bi,xs,Gn,Jn}from"./chunk-j4afmryj.js";import{di,pi,gi,mi}from"./chunk-8adstrk5.js";import{qe}from"./chunk-tfexmdkt.js";import{s,we}from"./chunk-ak95401g.js";import{$t,vi,an,a,cn}from"./chunk-kk5cyjfs.js";import{u}from"./chunk-cg8hg6cs.js";import{ge,O,gn}from"./chunk-29pn79t5.js";import{dr}from"./chunk-27kb6nrb.js";import E0 from"fs";import nu from"path";import{createHighlighter as C0}from"ts-syntax-highlighter";import aa from"fs";import un from"path";import{loadConfigWithResult as v0}from"bunfig";var ir={duration:300,delay:0,ease:"ease",direction:"both"};function dh(v,_={}){let{duration:k,delay:E,ease:T,direction:j,custom:B}={...ir,..._};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,sr,i,te,As,A,_t,fn,Ps,c,p,D,xe,Ye,l,or}from"./chunk-ab7vh24b.js";import{yn,bn,dr,ke}from"./chunk-mx446wgp.js";import{mn,y,Si,Rt,Ds,ki,Ci,$i,Ei}from"./chunk-01nx6zcw.js";import{P}from"./chunk-pf0d8y9n.js";import{S,Ts,Ge,un,nr,pe,Rs,fe,rr}from"./chunk-gskjzw5r.js";import{Cs,$s,Es,_s,Zn,Qn}from"./chunk-yd7g02v5.js";import{de,Et,Yn,ks,C,Ke}from"./chunk-scvzv5y2.js";import{ln}from"./chunk-xc27xdm6.js";import{js}from"./chunk-pcq6vphz.js";import{bi,xs,Gn,Jn}from"./chunk-j4afmryj.js";import{ui,pi,gi,mi}from"./chunk-594tt40e.js";import{qe}from"./chunk-tfexmdkt.js";import{s,we}from"./chunk-ak95401g.js";import{$t,vi,an,a,cn}from"./chunk-kk5cyjfs.js";import{d}from"./chunk-yn2d8x8m.js";import{ge,O,gn}from"./chunk-29pn79t5.js";import{ur}from"./chunk-9kb3my0w.js";import R0 from"fs";import ru from"path";import{createHighlighter as T0}from"ts-syntax-highlighter";import ca from"fs";import dn from"path";import{loadConfigWithResult as S0}from"bunfig";var ir={duration:300,delay:0,ease:"ease",direction:"both"};function gh(v,_={}){let{duration:k,delay:E,ease:T,direction:j,custom:B}={...ir,..._};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,sr,i,te,As,A,_t,fn,Ps,c,p,D,xe,Ye,l,or}from"./chunk-ab7vh24b.js";impo
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 ph(){return`
12
+ @keyframes rotateOut { from { transform: rotate(0); opacity: 1; } to { transform: rotate(90deg); opacity: 0; } }`;default:return""}}function mh(){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 fh(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 gh(v=0.1,_="0px"){return`
40
+ `}function hh(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 yh(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 mh(){return`
83
+ `}function xh(){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 hh(v,_,k={}){let{staggerDelay:E=50,sequence:T=!1}=k;return`
198
+ `}function bh(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 ou={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)||ir.duration:ir.duration,B=_.length>2?_[2]||ir.ease:ir.ease,z=_.length>3?Number.parseInt(_[3],10)||ir.delay:ir.delay,F=_.length>4?_[4]||ir.direction:ir.direction,V=`stx-transition-${Math.random().toString(36).substr(2,9)}`,H=dh(T,{duration:j,delay:z,ease:B,direction:F}),G="stx-transition",J="";if(T==="fade")J="stx-fade";else if(T==="slide")J="stx-slide";else if(T==="scale")J="stx-scale";else if(T==="flip")J="stx-flip";else if(T==="rotate")J="stx-rotate";return`<div id="${V}" class="${G} ${J} ${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"},au={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)}`,H=`--stx-transition-duration: ${j}ms; --stx-transition-ease: ${B}; --stx-transition-delay: ${F}ms; will-change: opacity, transform;`,G="stx-transition stx-observe stx-out";if(T==="fade")G+=" stx-fade";else if(T==="slide-up"||T==="slide")G+=" stx-from-bottom";else if(T==="slide-down")G+=" stx-from-top";else if(T==="slide-left")G+=" stx-from-right";else if(T==="slide-right")G+=" stx-from-left";else if(T==="scale")G+=" stx-scale";else if(T.includes("-"))G+=` stx-${T}`;else G+=` stx-${T}`;return`<div id="${V}" class="${G}" style="${H}" data-threshold="${z}">${v}</div>`},hasEndTag:!0,description:"Applies animations that trigger when scrolled into view"},cu={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=hh(T,j,{staggerDelay:B,sequence:z});return`${v}
237
- ${F}`},hasEndTag:!1,description:"Coordinates multiple animations together as a group"},lu={name:"motion",handler:(v,_,k,E)=>{let T=_.length>0?_[0].toLowerCase()==="true":!0,j=ph();return`<div data-animate="${T?"auto":"true"}">${v}</div>${j}`},hasEndTag:!0,description:"Controls motion and animation preferences"};function uu(v,_,k,E){let T=v;if(E.animation?.enabled===!1)return T;let j=k.includes("test")&&k.includes("animation");if(!fh(T)&&!j)return T;if(!T.includes('<style id="stx-animation-base">')){let z=mh();T=T.replace("</head>",`${z}
238
- </head>`)}if(T.includes("stx-observe")){if(!T.includes("Intersection Observer for scroll animations")){let F=gh(),V=T.lastIndexOf("</body>");if(V!==-1)T=T.slice(0,V)+F+`
239
- `+T.slice(V)}}return T}async function yh(v,_,k,E){let T=_[0]?.replace(/['"]/g,"")||"main",j=ke();if(T!=="main")j=j.replace("container:'main'",`container:'${T}'`);return`<script data-stx-router>${j}</script>`}var du={name:"stxRouter",handler:yh,hasEndTag:!1,description:"Inject the STX SPA router script for client-side navigation"};var xh={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={...xh,..._};return`
235
+ `}var au={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)||ir.duration:ir.duration,B=_.length>2?_[2]||ir.ease:ir.ease,z=_.length>3?Number.parseInt(_[3],10)||ir.delay:ir.delay,F=_.length>4?_[4]||ir.direction:ir.direction,V=`stx-transition-${Math.random().toString(36).substr(2,9)}`,H=gh(T,{duration:j,delay:z,ease:B,direction:F}),G="stx-transition",J="";if(T==="fade")J="stx-fade";else if(T==="slide")J="stx-slide";else if(T==="scale")J="stx-scale";else if(T==="flip")J="stx-flip";else if(T==="rotate")J="stx-rotate";return`<div id="${V}" class="${G} ${J} ${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)}`,H=`--stx-transition-duration: ${j}ms; --stx-transition-ease: ${B}; --stx-transition-delay: ${F}ms; will-change: opacity, transform;`,G="stx-transition stx-observe stx-out";if(T==="fade")G+=" stx-fade";else if(T==="slide-up"||T==="slide")G+=" stx-from-bottom";else if(T==="slide-down")G+=" stx-from-top";else if(T==="slide-left")G+=" stx-from-right";else if(T==="slide-right")G+=" stx-from-left";else if(T==="scale")G+=" stx-scale";else if(T.includes("-"))G+=` stx-${T}`;else G+=` stx-${T}`;return`<div id="${V}" class="${G}" style="${H}" data-threshold="${z}">${v}</div>`},hasEndTag:!0,description:"Applies animations that trigger when scrolled into view"},lu={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=bh(T,j,{staggerDelay:B,sequence:z});return`${v}
237
+ ${F}`},hasEndTag:!1,description:"Coordinates multiple animations together as a group"},uu={name:"motion",handler:(v,_,k,E)=>{let T=_.length>0?_[0].toLowerCase()==="true":!0,j=mh();return`<div data-animate="${T?"auto":"true"}">${v}</div>${j}`},hasEndTag:!0,description:"Controls motion and animation preferences"};function du(v,_,k,E){let T=v;if(E.animation?.enabled===!1)return T;let j=k.includes("test")&&k.includes("animation");if(!hh(T)&&!j)return T;if(!T.includes('<style id="stx-animation-base">')){let z=xh();T=T.replace("</head>",`${z}
238
+ </head>`)}if(T.includes("stx-observe")){if(!T.includes("Intersection Observer for scroll animations")){let F=yh(),V=T.lastIndexOf("</body>");if(V!==-1)T=T.slice(0,V)+F+`
239
+ `+T.slice(V)}}return T}async function vh(v,_,k,E){let T=_[0]?.replace(/['"]/g,"")||"main",j=ke();if(T!=="main")j=j.replace("container:'main'",`container:'${T}'`);return`<script data-stx-router>${j}</script>`}var pu={name:"stxRouter",handler:vh,hasEndTag:!1,description:"Inject the STX SPA router script for client-side navigation"};var wh={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 fu(v){let _=v.heatmap;if(!_?.enabled)return"";let k={...wh,..._};return`
240
240
  <!-- stx Heatmap - Privacy-Compliant Tracking -->
241
241
  <script>
242
242
  (function() {
@@ -619,10 +619,10 @@ else {
619
619
  };
620
620
  })();
621
621
  </script>
622
- `}function fu(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 gu={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=bh(_.join(" "));T.heatmap={...T.heatmap,...j,enabled:!0}}return pu(T)}};function bh(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 pr(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 Dn(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(),H=z.slice(F+1).trim();if(typeof H==="string"){if(H.startsWith('"')&&H.endsWith('"')||H.startsWith("'")&&H.endsWith("'"))H=H.slice(1,-1);else if(H.startsWith("[")&&H.endsWith("]"))try{H=JSON.parse(H)}catch{}else if(H==="true")H=!0;else if(H==="false")H=!1;else if(/^-?\d+(?:\.\d+)?$/.test(H))H=Number(H)}j[V]=H}return{data:j,content:T.trim()}}function Oe(v,_={}){let{gfm:k=!0,breaks:E=!1}=_,T=v,j=[];if(T=T.replace(/```(\w*)\n([\s\S]*?)```/g,(H,G,J)=>{let ne=j.length,re=G?` class="language-${pr(G)}"`:"";return j.push(`<pre><code${re}>${pr(J.trim())}</code></pre>`),`\x00CODEBLOCK${ne}\x00`}),T=T.replace(/`([^`]*)`/g,(H,G)=>`<code>${pr(G)}</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,(H,G,J)=>`<img src="${mu(J)?pr(J):""}" alt="${pr(G)}" />`),T=T.replace(/\[([^\]]+)\]\(([^)]+)\)/g,(H,G,J)=>`<a href="${mu(J)?pr(J):""}">${G}</a>`),T=T.replace(/^(?:---|\*\*\*|___)\s*$/gm,"<hr />"),T=T.replace(/^>\s+(.*)$/gm,"<blockquote>$1</blockquote>"),T=T.replace(/<\/blockquote>\n<blockquote>/g,`
622
+ `}function gu(v,_){let k=fu(_);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=Sh(_.join(" "));T.heatmap={...T.heatmap,...j,enabled:!0}}return fu(T)}};function Sh(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 pr(v){return v.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function hu(v){let _=v.trim().toLowerCase();return!_.startsWith("javascript:")&&!_.startsWith("vbscript:")&&!_.startsWith("data:text/html")}function Dn(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(),H=z.slice(F+1).trim();if(typeof H==="string"){if(H.startsWith('"')&&H.endsWith('"')||H.startsWith("'")&&H.endsWith("'"))H=H.slice(1,-1);else if(H.startsWith("[")&&H.endsWith("]"))try{H=JSON.parse(H)}catch{}else if(H==="true")H=!0;else if(H==="false")H=!1;else if(/^-?\d+(?:\.\d+)?$/.test(H))H=Number(H)}j[V]=H}return{data:j,content:T.trim()}}function Oe(v,_={}){let{gfm:k=!0,breaks:E=!1}=_,T=v,j=[];if(T=T.replace(/```(\w*)\n([\s\S]*?)```/g,(H,G,J)=>{let ne=j.length,re=G?` class="language-${pr(G)}"`:"";return j.push(`<pre><code${re}>${pr(J.trim())}</code></pre>`),`\x00CODEBLOCK${ne}\x00`}),T=T.replace(/`([^`]*)`/g,(H,G)=>`<code>${pr(G)}</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,(H,G,J)=>`<img src="${hu(J)?pr(J):""}" alt="${pr(G)}" />`),T=T.replace(/\[([^\]]+)\]\(([^)]+)\)/g,(H,G,J)=>`<a href="${hu(J)?pr(J):""}">${G}</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,(H,G,J)=>{let re=`<tr>${G.split("|").map((ie)=>ie.trim()).filter(Boolean).map((ie)=>`<th>${pr(ie)}</th>`).join("")}</tr>`,se=J.trim().split(`
625
- `).map((ie)=>`<tr>${ie.split("|").map((de)=>de.trim()).filter(Boolean).map((de)=>`<td>${pr(de)}</td>`).join("")}</tr>`).join(`
625
+ `).map((ie)=>`<tr>${ie.split("|").map((ue)=>ue.trim()).filter(Boolean).map((ue)=>`<td>${pr(ue)}</td>`).join("")}</tr>`).join(`
626
626
  `);return`<table>
627
627
  <thead>
628
628
  ${re}
@@ -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 H=0;H<j.length;H++)T=T.replace(`\x00CODEBLOCK${H}\x00`,j[H]);return T=T.replace(/<p>\s*<\/p>/g,""),T.trim()}import Fm from"fs";import et from"path";import _r from"path";import Us from"fs";var vh=new Set(["touchstart","touchmove","wheel","mousewheel"]);function ma(v,_){if(_.passive)return!0;if(_.prevent||_.nonpassive)return!1;return vh.has(v.toLowerCase())}var hu=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"]),yu={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"},wh=new Set(["ctrl","alt","shift","meta"]),Wu={left:0,middle:1,right:2};function bu(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(wh.has(E))_.systemKeys.push(E);else if(E in Wu)_.mouse=E;else if(E in yu||/^[a-z]$/.test(E))_.keys.push(yu[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,H=V+B.length,G=`__stx_evt_${_}${E++}`,J=[],ne=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,re;while((re=ne.exec(F))!==null){let[,ie,oe]=re,de=ie.split("."),ae=de[0];if(!hu.has(ae))continue;J.push({attribute:`@${ie}`,event:ae,handler:oe,modifiers:bu(de.slice(1)),elementId:G})}let se=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((re=se.exec(F))!==null){let[,ie,oe]=re,de=ie.split("."),ae=de[0];if(!hu.has(ae))continue;J.push({attribute:`@${ie}`,event:ae,handler:oe,modifiers:bu(de.slice(1)),elementId:G})}if(J.length>0)k.push({originalTag:B,elementId:G,events:J,startIndex:V,endIndex:H})}return k}function Sh(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=Wu[k.mouse];_.push(`if ($event.button !== ${E}) return`)}if(k.prevent)_.push("$event.preventDefault()");if(k.stop)_.push("$event.stopPropagation()");return _.join("; ")}function $h(v,_){let k=v;if(_.debounce!==null)k=`__stx_debounce(() => { ${k} }, ${_.debounce})`;else if(_.throttle!==null)k=`__stx_throttle(() => { ${k} }, ${_.throttle})`;return k}function ha(v){let _=v.trim();if(!/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(_))return v;return`if (typeof ${_} === 'function' && !${_}._isSignal) ${_}($event);`}function _h(v){let{modifiers:_}=v,k=v.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),E=Sh(v),T=$h(ha(v.handler),_),j=[];if(_.once)j.push("once: true");if(_.capture)j.push("capture: true");if(ma(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 H=0;H<j.length;H++)T=T.replace(`\x00CODEBLOCK${H}\x00`,j[H]);return T=T.replace(/<p>\s*<\/p>/g,""),T.trim()}import Um from"fs";import et from"path";import _r from"path";import Ws from"fs";var $h=new Set(["touchstart","touchmove","wheel","mousewheel"]);function ha(v,_){if(_.passive)return!0;if(_.prevent||_.nonpassive)return!1;return $h.has(v.toLowerCase())}var yu=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"]),xu={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"},_h=new Set(["ctrl","alt","shift","meta"]),wu={left:0,middle:1,right:2};function bu(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(_h.has(E))_.systemKeys.push(E);else if(E in wu)_.mouse=E;else if(E in xu||/^[a-z]$/.test(E))_.keys.push(xu[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 Su(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,H=V+B.length,G=`__stx_evt_${_}${E++}`,J=[],ne=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,re;while((re=ne.exec(F))!==null){let[,ie,oe]=re,ue=ie.split("."),ae=ue[0];if(!yu.has(ae))continue;J.push({attribute:`@${ie}`,event:ae,handler:oe,modifiers:bu(ue.slice(1)),elementId:G})}let se=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((re=se.exec(F))!==null){let[,ie,oe]=re,ue=ie.split("."),ae=ue[0];if(!yu.has(ae))continue;J.push({attribute:`@${ie}`,event:ae,handler:oe,modifiers:bu(ue.slice(1)),elementId:G})}if(J.length>0)k.push({originalTag:B,elementId:G,events:J,startIndex:V,endIndex:H})}return k}function kh(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=wu[k.mouse];_.push(`if ($event.button !== ${E}) return`)}if(k.prevent)_.push("$event.preventDefault()");if(k.stop)_.push("$event.stopPropagation()");return _.join("; ")}function Eh(v,_){let k=v;if(_.debounce!==null)k=`__stx_debounce(() => { ${k} }, ${_.debounce})`;else if(_.throttle!==null)k=`__stx_throttle(() => { ${k} }, ${_.throttle})`;return k}function ya(v){let _=v.trim();if(!/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(_))return v;return`if (typeof ${_} === 'function' && !${_}._isSignal) ${_}($event);`}function Ch(v){let{modifiers:_}=v,k=v.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),E=kh(v),T=Eh(ya(v.handler),_),j=[];if(_.once)j.push("once: true");if(_.capture)j.push("capture: true");if(ha(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;
@@ -691,7 +691,7 @@ else {
691
691
  __stx_runHandler('${z}', $event, $el);
692
692
  }
693
693
  }${B});
694
- })();`}function ya(v){if(v.length===0)return"";return`
694
+ })();`}function xa(v){if(v.length===0)return"";return`
695
695
  <script data-stx-events>
696
696
  (function() {
697
697
  'use strict';
@@ -746,11 +746,11 @@ else {
746
746
  }
747
747
 
748
748
  // Event listeners
749
- ${v.map(_h).join(`
749
+ ${v.map(Ch).join(`
750
750
  `)}
751
751
  })();
752
- </script>`}function kh(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,"\\$&"),H=new RegExp(`\\s*${V}\\s*=\\s*"[^"]*"`,"g"),G=new RegExp(`\\s*${V}\\s*=\\s*'[^']*'`,"g");z=z.replace(H,""),z=z.replace(G,"")}E=E.slice(0,B.startIndex)+z+E.slice(B.endIndex),T.push(...B.events)}return{template:E,bindings:T}}function wu(v){let _=v.$uid;return typeof _==="string"&&_?`${_}_`:""}function qu(v,_,k){if(ki(v))return v;if(_.__stx_sfc_mode){if(/x-data\s*=\s*["']/.test(v))return v;let{template:z,bindings:F}=kh(v,wu(_)),V=_.__stx_event_bindings||[];return _.__stx_event_bindings=[...V,...F],z}let E=Uu(v,wu(_));if(E.length===0)return v;let T=v;for(let z=E.length-1;z>=0;z--){let F=E[z],V=F.originalTag;if(!V.includes(" id="))V=V.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${F.elementId}"`);else{let H=V.match(/id=["']([^"']+)["']/);if(H)for(let G of F.events)G.elementId=H[1]}for(let H of F.events){let G=H.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),J=new RegExp(`\\s*${G}\\s*=\\s*"[^"]*"`,"g"),ne=new RegExp(`\\s*${G}\\s*=\\s*'[^']*'`,"g");V=V.replace(J,""),V=V.replace(ne,"")}T=T.slice(0,F.startIndex)+V+T.slice(F.endIndex)}let j=ya(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 Ku(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 Ui(v,_){let k=s(v),{depths:E,balanced:T}=we(k),j=(z)=>!T||E[z]===0,B=new RegExp(`(?:^|[^\\w$.])((?:const|let|var|function|class)\\s+${_}\\b)`,"g");for(let z of k.matchAll(B)){let F=(z.index??0)+z[0].length-z[1].length;if(j(F))return!0}for(let z of k.matchAll(/(?:const|let|var)\s*\{([^}]*)\}/g))if(j(z.index??0)&&Ku(z[1],!0).has(_))return!0;for(let z of k.matchAll(/(?:const|let|var)\s*\[([^\]]*)\]/g))if(j(z.index??0)&&Ku(z[1],!1).has(_))return!0;return!1}var Xu="",Hi,xa=/^[A-Za-z_$][\w$]*$/,Eh=new Set(["if","for","while","switch","with"]);function Ch(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 Rh(v){if(Hi&&v===Xu)return Hi;let{code:_,tokens:k}=Ch(v),E=new Map,T=[];for(let H=0;H<k.length;H++){let G=k[H].text;if(["(","[","{"].includes(G))T.push(H);else if([")","]","}"].includes(G)){let J=T.at(-1);if(J!==void 0&&["()","[]","{}"].includes(k[J].text+G))T.pop(),E.set(J,H),E.set(H,J)}}function j(H,G){let J=[],ne=H;for(let re=H;re<G;re++){if(["(","[","{"].includes(k[re].text)&&(E.get(re)??G)<G){re=E.get(re);continue}if(k[re].text===",")J.push([ne,re]),ne=re+1}return J.push([ne,G]),J}function B(H,G,J){if(k[H]?.text==="...")H++;if(H>=G)return;let ne=k[H].text;if(xa.test(ne)){J.add(ne);return}if(ne!=="{"&&ne!=="[")return;let re=E.get(H);if(re===void 0||re>=G)return;for(let[se,ie]of j(H+1,re)){let oe=se;if(ne==="{")for(let de=se;de<ie;de++){if(k[de].text===":"){oe=de+1;break}if(k[de].text==="=")break;if(["(","[","{"].includes(k[de].text)&&E.has(de))de=E.get(de)}B(oe,ie,J)}}function z(H,G){let J=new Set;for(let[ne,re]of j(H,G))B(ne,re,J);return J}function F(H){let G=H;for(;G<k.length;G++){let J=k[G].text;if(["(","[","{"].includes(J)&&E.has(G)){G=E.get(G);continue}if([",",";",")","]","}"].includes(J))break}return k[Math.max(H,G-1)]?.end??_.length}let V=[];for(let H=0;H<k.length;H++)if(k[H].text==="=>"){let G=H-1,J=G,ne;if(k[G]?.text===")"&&E.has(G))J=E.get(G),ne=z(J+1,G);else if(k[G]&&xa.test(k[G].text))ne=new Set([k[G].text]);else continue;let re=H+1,se=k[re]?.text==="{"&&E.has(re)?k[E.get(re)].end:F(re);V.push({start:k[J].start,end:se,names:ne})}else if(k[H].text==="("&&E.has(H)){let G=k[H-1]?.text;if(!G||Eh.has(G)||!xa.test(G)&&G!=="*"&&G!=="]")continue;let J=E.get(H),ne=J+1;if(k[ne]?.text===":"){ne++;while(ne<k.length&&!["{","=>",";","="].includes(k[ne].text))ne++}if(k[ne]?.text!=="{"||!E.has(ne))continue;V.push({start:k[H].start,end:k[E.get(ne)].end,names:z(H+1,J)})}return Xu=v,Hi={code:_,scopes:V},Hi}function Zu(v){let _=Rh(v);return{code:_.code,shadows:(k,E)=>_.scopes.some((T)=>E>=T.start&&E<T.end&&T.names.has(k))}}var Gu=Symbol.for("stx.lazy-module-promises");function Th(){let v=globalThis;return v[Gu]??=new Map,v[Gu]}function ut(v,_){let k=Th(),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 Ah=/<\/(script)/gi;function zr(v){if(!v||v.indexOf("</")===-1)return v;return v.replace(Ah,"<\\/$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 Fr=new Map,Ih=500;function $r(v,_){if(_?.includes("g"))return new RegExp(v,_);let k=`${v}:${_||""}`;if(!Fr.has(k)){if(Fr.size>=Ih){let E=Fr.keys().next().value;if(E)Fr.delete(E)}Fr.set(k,new RegExp(v,_))}return Fr.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}`,H=T.get(V);if(!H){if(T.size>=j){let G=T.keys().next().value;if(G)T.delete(G)}H=Function(..._,`
752
+ </script>`}function Rh(v,_=""){let k=Su(v,_);if(k.length===0)return{template:v,bindings:[]};let E=v,T=[];for(let j=k.length-1;j>=0;j--){let B=k[j],z=B.originalTag;if(!z.includes(" id="))z=z.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${B.elementId}"`);else{let F=z.match(/id=["']([^"']+)["']/);if(F)for(let V of B.events)V.elementId=F[1]}for(let F of B.events){let V=F.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),H=new RegExp(`\\s*${V}\\s*=\\s*"[^"]*"`,"g"),G=new RegExp(`\\s*${V}\\s*=\\s*'[^']*'`,"g");z=z.replace(H,""),z=z.replace(G,"")}E=E.slice(0,B.startIndex)+z+E.slice(B.endIndex),T.push(...B.events)}return{template:E,bindings:T}}function vu(v){let _=v.$uid;return typeof _==="string"&&_?`${_}_`:""}function $u(v,_,k){if(ki(v))return v;if(_.__stx_sfc_mode){if(/x-data\s*=\s*["']/.test(v))return v;let{template:z,bindings:F}=Rh(v,vu(_)),V=_.__stx_event_bindings||[];return _.__stx_event_bindings=[...V,...F],z}let E=Su(v,vu(_));if(E.length===0)return v;let T=v;for(let z=E.length-1;z>=0;z--){let F=E[z],V=F.originalTag;if(!V.includes(" id="))V=V.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${F.elementId}"`);else{let H=V.match(/id=["']([^"']+)["']/);if(H)for(let G of F.events)G.elementId=H[1]}for(let H of F.events){let G=H.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),J=new RegExp(`\\s*${G}\\s*=\\s*"[^"]*"`,"g"),ne=new RegExp(`\\s*${G}\\s*=\\s*'[^']*'`,"g");V=V.replace(J,""),V=V.replace(ne,"")}T=T.slice(0,F.startIndex)+V+T.slice(F.endIndex)}let j=xa(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 _u(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 Ui(v,_){let k=s(v),{depths:E,balanced:T}=we(k),j=(z)=>!T||E[z]===0,B=new RegExp(`(?:^|[^\\w$.])((?:const|let|var|function|class)\\s+${_}\\b)`,"g");for(let z of k.matchAll(B)){let F=(z.index??0)+z[0].length-z[1].length;if(j(F))return!0}for(let z of k.matchAll(/(?:const|let|var)\s*\{([^}]*)\}/g))if(j(z.index??0)&&_u(z[1],!0).has(_))return!0;for(let z of k.matchAll(/(?:const|let|var)\s*\[([^\]]*)\]/g))if(j(z.index??0)&&_u(z[1],!1).has(_))return!0;return!1}var ku="",Hi,ba=/^[A-Za-z_$][\w$]*$/,Th=new Set(["if","for","while","switch","with"]);function Ah(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 Ih(v){if(Hi&&v===ku)return Hi;let{code:_,tokens:k}=Ah(v),E=new Map,T=[];for(let H=0;H<k.length;H++){let G=k[H].text;if(["(","[","{"].includes(G))T.push(H);else if([")","]","}"].includes(G)){let J=T.at(-1);if(J!==void 0&&["()","[]","{}"].includes(k[J].text+G))T.pop(),E.set(J,H),E.set(H,J)}}function j(H,G){let J=[],ne=H;for(let re=H;re<G;re++){if(["(","[","{"].includes(k[re].text)&&(E.get(re)??G)<G){re=E.get(re);continue}if(k[re].text===",")J.push([ne,re]),ne=re+1}return J.push([ne,G]),J}function B(H,G,J){if(k[H]?.text==="...")H++;if(H>=G)return;let ne=k[H].text;if(ba.test(ne)){J.add(ne);return}if(ne!=="{"&&ne!=="[")return;let re=E.get(H);if(re===void 0||re>=G)return;for(let[se,ie]of j(H+1,re)){let oe=se;if(ne==="{")for(let ue=se;ue<ie;ue++){if(k[ue].text===":"){oe=ue+1;break}if(k[ue].text==="=")break;if(["(","[","{"].includes(k[ue].text)&&E.has(ue))ue=E.get(ue)}B(oe,ie,J)}}function z(H,G){let J=new Set;for(let[ne,re]of j(H,G))B(ne,re,J);return J}function F(H){let G=H;for(;G<k.length;G++){let J=k[G].text;if(["(","[","{"].includes(J)&&E.has(G)){G=E.get(G);continue}if([",",";",")","]","}"].includes(J))break}return k[Math.max(H,G-1)]?.end??_.length}let V=[];for(let H=0;H<k.length;H++)if(k[H].text==="=>"){let G=H-1,J=G,ne;if(k[G]?.text===")"&&E.has(G))J=E.get(G),ne=z(J+1,G);else if(k[G]&&ba.test(k[G].text))ne=new Set([k[G].text]);else continue;let re=H+1,se=k[re]?.text==="{"&&E.has(re)?k[E.get(re)].end:F(re);V.push({start:k[J].start,end:se,names:ne})}else if(k[H].text==="("&&E.has(H)){let G=k[H-1]?.text;if(!G||Th.has(G)||!ba.test(G)&&G!=="*"&&G!=="]")continue;let J=E.get(H),ne=J+1;if(k[ne]?.text===":"){ne++;while(ne<k.length&&!["{","=>",";","="].includes(k[ne].text))ne++}if(k[ne]?.text!=="{"||!E.has(ne))continue;V.push({start:k[H].start,end:k[E.get(ne)].end,names:z(H+1,J)})}return ku=v,Hi={code:_,scopes:V},Hi}function Eu(v){let _=Ih(v);return{code:_.code,shadows:(k,E)=>_.scopes.some((T)=>E>=T.start&&E<T.end&&T.names.has(k))}}var Cu=Symbol.for("stx.lazy-module-promises");function Ph(){let v=globalThis;return v[Cu]??=new Map,v[Cu]}function ut(v,_){let k=Ph(),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 Dh=/<\/(script)/gi;function zr(v){if(!v||v.indexOf("</")===-1)return v;return v.replace(Dh,"<\\/$1")}import Au 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 Fr=new Map,Mh=500;function $r(v,_){if(_?.includes("g"))return new RegExp(v,_);let k=`${v}:${_||""}`;if(!Fr.has(k)){if(Fr.size>=Mh){let E=Fr.keys().next().value;if(E)Fr.delete(E)}Fr.set(k,new RegExp(v,_))}return Fr.get(k)}class Ru{pool=[];maxPoolSize=10;fnCache=new Map;fnCacheMaxSize=200;getEvaluator(v){let _=Array.from(new Set(v)),k=_.sort().join(","),E=this.pool.find((z)=>z.context.join(",")===k);if(E)return E.func;let T=this.fnCache,j=this.fnCacheMaxSize,B=(...z)=>(F)=>{try{let V=`${k}:${F}`,H=T.get(V);if(!H){if(T.size>=j){let G=T.keys().next().value;if(G)T.delete(G)}H=Function(..._,`
754
754
  'use strict';
755
755
  try {
756
756
  return ${F};
@@ -761,18 +761,18 @@ catch (e) {
761
761
  }
762
762
  throw e;
763
763
  }
764
- `),T.set(V,H)}return H(...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 q0=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 ba=null;function Ph(){if(!ba)ba=new Yu;return ba}var U=new Proxy({},{get(v,_){return Ph()[_]}});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 Qt(v){for(let _ of v)try{if(Qu.statSync(_.path).mtimeMs!==_.mtimeMs)return!1}catch{return!1}return!0}var W=["browserQuery","BrowserQueryBuilder","BrowserQueryError","browserAuth","configureBrowser","getBrowserConfig","createBrowserDb","createBrowserModel","isBrowser","debounce","throttle","retry","sleep","wait","delay","waitUntil","waitWhile","lazy","clamp","rand","readableSize","useActiveElement","useIntervalFn","useObjectUrl","useTimeoutFn"];var Dh=/^[ \t]*import\s+['"]([^'"]+?\.css)(\?[^'"]*)?['"]\s*;?\s*$/gm;function Mh(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 Oh(v,_){let k=_;while(!0){let E=_r.join(k,"node_modules",v,"package.json");if(Us.existsSync(E))return _r.dirname(E);let T=_r.dirname(k);if(T===k)return null;k=T}}function Nh(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=Mh(v);if(!k||!k.subpath)return null;let E=Oh(k.pkg,_);if(!E)return null;let T;try{T=JSON.parse(Us.readFileSync(_r.join(E,"package.json"),"utf8"))}catch{return null}let j=`.${k.subpath}`,B=Nh(T.exports,j);if(!B)return null;let z=_r.resolve(E,B);return Us.existsSync(z)?z:null}function Kr(v,_){let k=_.filePath?_r.dirname(_.filePath):_.projectRoot||process.cwd(),E=_.projectRoot||process.cwd(),T=new Set,j=[],B=[];return{code:v.replace(Dh,(F,V)=>{let H;try{if(V.startsWith("./")||V.startsWith("../")||V.startsWith("/")){if(H=V.startsWith("/")?V:_r.resolve(k,V),!Us.existsSync(H))throw Error(`file not found: ${H}`)}else{let G=null;try{G=Bun.resolveSync(V,E)}catch{G=jh(V,E)}if(!G)throw Error(`could not resolve ${V} (Bun.resolveSync + exports fallback both failed)`);H=G}}catch(G){return console.warn(`[stx:vendor-css] could not resolve ${JSON.stringify(V)} (from ${_.filePath||"<unknown>"}): ${G?.message||G}`),B.push(V),""}if(T.has(H))return"";T.add(H);try{let G=Us.readFileSync(H,"utf8");j.push({source:V,resolvedPath:H,contents:G})}catch(G){console.warn(`[stx:vendor-css] could not read ${H}: ${G?.message||G}`),B.push(V)}return""}),styles:j,unresolved:B}}function Lh(v){return v.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Xr(v){if(v.length===0)return"";return`${v.map((_)=>`<style data-stx-vendor="${Lh(_.source)}" data-stx-layer="vendor">
764
+ `),T.set(V,H)}return H(...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 X0=new Ru;class Tu{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 Oh(){if(!va)va=new Tu;return va}var U=new Proxy({},{get(v,_){return Oh()[_]}});var Iu=[];function m(v){let _=new M(v);return Iu.push(_),_}function Pu(){for(let v of Iu)v.clear()}function h(v,..._){return`${_.map((k)=>String(k??"")).join("\x00")}\x00${v.length}\x00${Bun.hash(v)}`}function Du(v){let _=[];for(let k of new Set(v))try{_.push({path:k,mtimeMs:Au.statSync(k).mtimeMs})}catch{}return _}function Qt(v){for(let _ of v)try{if(Au.statSync(_.path).mtimeMs!==_.mtimeMs)return!1}catch{return!1}return!0}var W=["browserQuery","BrowserQueryBuilder","BrowserQueryError","browserAuth","configureBrowser","getBrowserConfig","createBrowserDb","createBrowserModel","isBrowser","debounce","throttle","retry","sleep","wait","delay","waitUntil","waitWhile","lazy","clamp","rand","readableSize","useActiveElement","useIntervalFn","useObjectUrl","useTimeoutFn"];var Nh=/^[ \t]*import\s+['"]([^'"]+?\.css)(\?[^'"]*)?['"]\s*;?\s*$/gm;function jh(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 Lh(v,_){let k=_;while(!0){let E=_r.join(k,"node_modules",v,"package.json");if(Ws.existsSync(E))return _r.dirname(E);let T=_r.dirname(k);if(T===k)return null;k=T}}function Bh(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 zh(v,_){let k=jh(v);if(!k||!k.subpath)return null;let E=Lh(k.pkg,_);if(!E)return null;let T;try{T=JSON.parse(Ws.readFileSync(_r.join(E,"package.json"),"utf8"))}catch{return null}let j=`.${k.subpath}`,B=Bh(T.exports,j);if(!B)return null;let z=_r.resolve(E,B);return Ws.existsSync(z)?z:null}function Kr(v,_){let k=_.filePath?_r.dirname(_.filePath):_.projectRoot||process.cwd(),E=_.projectRoot||process.cwd(),T=new Set,j=[],B=[];return{code:v.replace(Nh,(F,V)=>{let H;try{if(V.startsWith("./")||V.startsWith("../")||V.startsWith("/")){if(H=V.startsWith("/")?V:_r.resolve(k,V),!Ws.existsSync(H))throw Error(`file not found: ${H}`)}else{let G=null;try{G=Bun.resolveSync(V,E)}catch{G=zh(V,E)}if(!G)throw Error(`could not resolve ${V} (Bun.resolveSync + exports fallback both failed)`);H=G}}catch(G){return console.warn(`[stx:vendor-css] could not resolve ${JSON.stringify(V)} (from ${_.filePath||"<unknown>"}): ${G?.message||G}`),B.push(V),""}if(T.has(H))return"";T.add(H);try{let G=Ws.readFileSync(H,"utf8");j.push({source:V,resolvedPath:H,contents:G})}catch(G){console.warn(`[stx:vendor-css] could not read ${H}: ${G?.message||G}`),B.push(V)}return""}),styles:j,unresolved:B}}function Fh(v){return v.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Xr(v){if(v.length===0)return"";return`${v.map((_)=>`<style data-stx-vendor="${Fh(_.source)}" data-stx-layer="vendor">
765
765
  @layer vendor {
766
766
  ${_.contents}
767
767
  }
768
768
  </style>`).join(`
769
769
  `)}
770
- `}var Va=y,rd=m(256);function wt(v){let _=h(v),k=rd.get(_);if(!k)k=Bh(v),rd.set(_,k);return{code:k.code,imports:[...k.imports],models:[...k.models]}}function Bh(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=new Set;for(let z of _.matchAll(/\b(?:const|let|var|function|class)\s+([A-Za-z_$][\w$]*)/g))E.add(z[1]);for(let z of _.matchAll(/\b(?:const|let|var)\s*\{([^}]*)\}/g))for(let F of z[1].split(",")){let V=F.trim().split(/[:=]/).pop()?.trim();if(V)E.add(V)}let T=W.filter((z)=>{if(k.has(z)||E.has(z))return!1;return Gr(_,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 Va=y,Mu=m(256);function wt(v){let _=h(v),k=Mu.get(_);if(!k)k=Vh(v),Mu.set(_,k);return{code:k.code,imports:[...k.imports],models:[...k.models]}}function Vh(v){let _=s(v),k=new Set;for(let z of v.matchAll(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm))for(let F of z[1].split(",")){let V=F.trim().split(/\s+as\s+/).pop()?.replace(/^type\s+/,"").trim();if(V)k.add(V)}let E=new Set;for(let z of _.matchAll(/\b(?:const|let|var|function|class)\s+([A-Za-z_$][\w$]*)/g))E.add(z[1]);for(let z of _.matchAll(/\b(?:const|let|var)\s*\{([^}]*)\}/g))for(let F of z[1].split(",")){let V=F.trim().split(/[:=]/).pop()?.trim();if(V)E.add(V)}let T=W.filter((z)=>{if(k.has(z)||E.has(z))return!1;return Gr(_,z,!0)}),j=Lu(_).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 zh=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=/\b([A-Z][a-zA-Z0-9]*)\s*\.\s*(all|find|first|get|where|orderBy|orderByDesc|limit|select|pluck|create|update|delete)\s*\(/g,E;while((E=k.exec(v))!==null)if(!zh.has(E[1]))_.add(E[1]);return Array.from(_)}function Fh(v){let _=new Set;for(let k of v.matchAll(/\b(?:const|let|var|function|class)\s+([A-Za-z_$][\w$]*)/g))_.add(k[1]);for(let k of v.matchAll(/\b(?:const|let|var)\s*\{([^}]*)\}/g))for(let E of k[1].split(",")){let T=E.trim().split(/[:=]/).pop()?.trim();if(T&&/^[A-Za-z_$][\w$]*$/.test(T))_.add(T)}return _}var sd=m(128);function jo(v){let _=h(v),k=sd.get(_);if(!k)k=Vh(v),sd.set(_,k);return{code:k.code,stxImports:[...k.stxImports],browserImports:[...k.browserImports]}}function Vh(v){let _=new Set,k=new Set,E=v;E=E.replace(/^[ \t]*import\s+type\s+\{[^}]*\}\s+from\s+['"][^'"]+['"][ \t]*;?[ \t]*$/gm,"// [type import stripped]");let T=new Set,j=/^[ \t]*import\s+(?:type\s+)?{\s*([^}]+)\s*}\s+from\s+['"](@stacksjs\/browser|@stacksjs\/stx|stx)['"][ \t]*;?[ \t]*$/gm,B;while((B=j.exec(v))!==null){let G=B[1],J=B[2];if(B[0].includes("import type"))continue;let ne=[];for(let se of G.split(",")){let ie=se.trim();if(!ie||ie.startsWith("type "))continue;let oe=ie.match(/^([A-Za-z_$][\w$]*)(?:\s+as\s+([A-Za-z_$][\w$]*))?$/);if(!oe)continue;let de=oe[1],ae=oe[2]||de;if(T.add(de),T.add(ae),J==="stx"||J==="@stacksjs/stx")_.add(de);else k.add(de);if(ae!==de)ne.push(`${ae} = ${de}`)}let re=ne.length>0?`var ${ne.join(", ")}; /* [auto-import processed] */`:"// [auto-import processed]";E=E.replace(B[0],re)}let z=Fh(E);for(let G of Va){if(T.has(G)||z.has(G))continue;if(Gr(E,G,!0))_.add(G)}let F=s(E),V=new Set;for(let G of E.matchAll(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm))for(let J of G[1].split(",")){let ne=J.trim().replace(/^type\s+/,"").split(/\s+as\s+/);for(let re of ne){let se=re.trim();if(se)V.add(se)}}for(let G of W){if(T.has(G)||z.has(G)||V.has(G))continue;if(Gr(F,G))k.add(G)}let H=ad(E);for(let G of H)if(!T.has(G)&&!z.has(G))k.add(G);return{code:E,stxImports:Array.from(_),browserImports:Array.from(k)}}function Gr(v,_,k=!1){let E=Zu(v);v=E.code;let T=new RegExp(`\\b${_.replace(/[$]/g,"\\$")}\\b`,"g");for(let j of v.matchAll(T)){let B=j.index??0;if(E.shadows(_,B))continue;let z=B+_.length,F=B-1;while(F>=0&&/\s/.test(v[F]))F--;if(v[F]==="."&&v.slice(Math.max(0,F-2),F+1)!=="...")continue;let V=z;while(V<v.length&&/\s/.test(v[V]))V++;if(v[V]===":"&&v[V+1]!==":"&&(v[F]==="{"||v[F]===","))continue;if(k&&!/^\s*(?:<[^>]*>)?\s*\(/.test(v.slice(z)))continue;return!0}return!1}function Bo(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 Wh=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 Lu(v){let _=new Set,k=/\b([A-Z][a-zA-Z0-9]*)\s*\.\s*(all|find|first|get|where|orderBy|orderByDesc|limit|select|pluck|create|update|delete)\s*\(/g,E;while((E=k.exec(v))!==null)if(!Wh.has(E[1]))_.add(E[1]);return Array.from(_)}function Uh(v){let _=new Set;for(let k of v.matchAll(/\b(?:const|let|var|function|class)\s+([A-Za-z_$][\w$]*)/g))_.add(k[1]);for(let k of v.matchAll(/\b(?:const|let|var)\s*\{([^}]*)\}/g))for(let E of k[1].split(",")){let T=E.trim().split(/[:=]/).pop()?.trim();if(T&&/^[A-Za-z_$][\w$]*$/.test(T))_.add(T)}return _}var Ou=m(128);function jo(v){let _=h(v),k=Ou.get(_);if(!k)k=Hh(v),Ou.set(_,k);return{code:k.code,stxImports:[...k.stxImports],browserImports:[...k.browserImports]}}function Hh(v){let _=new Set,k=new Set,E=v;E=E.replace(/^[ \t]*import\s+type\s+\{[^}]*\}\s+from\s+['"][^'"]+['"][ \t]*;?[ \t]*$/gm,"// [type import stripped]");let T=new Set,j=/^[ \t]*import\s+(?:type\s+)?{\s*([^}]+)\s*}\s+from\s+['"](@stacksjs\/browser|@stacksjs\/stx|stx)['"][ \t]*;?[ \t]*$/gm,B;while((B=j.exec(v))!==null){let G=B[1],J=B[2];if(B[0].includes("import type"))continue;let ne=[];for(let se of G.split(",")){let ie=se.trim();if(!ie||ie.startsWith("type "))continue;let oe=ie.match(/^([A-Za-z_$][\w$]*)(?:\s+as\s+([A-Za-z_$][\w$]*))?$/);if(!oe)continue;let ue=oe[1],ae=oe[2]||ue;if(T.add(ue),T.add(ae),J==="stx"||J==="@stacksjs/stx")_.add(ue);else k.add(ue);if(ae!==ue)ne.push(`${ae} = ${ue}`)}let re=ne.length>0?`var ${ne.join(", ")}; /* [auto-import processed] */`:"// [auto-import processed]";E=E.replace(B[0],re)}let z=Uh(E);for(let G of Va){if(T.has(G)||z.has(G))continue;if(Gr(E,G,!0))_.add(G)}let F=s(E),V=new Set;for(let G of E.matchAll(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm))for(let J of G[1].split(",")){let ne=J.trim().replace(/^type\s+/,"").split(/\s+as\s+/);for(let re of ne){let se=re.trim();if(se)V.add(se)}}for(let G of W){if(T.has(G)||z.has(G)||V.has(G))continue;if(Gr(F,G))k.add(G)}let H=Lu(E);for(let G of H)if(!T.has(G)&&!z.has(G))k.add(G);return{code:E,stxImports:Array.from(_),browserImports:Array.from(k)}}function Gr(v,_,k=!1){let E=Eu(v);v=E.code;let T=new RegExp(`\\b${_.replace(/[$]/g,"\\$")}\\b`,"g");for(let j of v.matchAll(T)){let B=j.index??0;if(E.shadows(_,B))continue;let z=B+_.length,F=B-1;while(F>=0&&/\s/.test(v[F]))F--;if(v[F]==="."&&v.slice(Math.max(0,F-2),F+1)!=="...")continue;let V=z;while(V<v.length&&/\s/.test(v[V]))V++;if(v[V]===":"&&v[V+1]!==":"&&(v[F]==="{"||v[F]===","))continue;if(k&&!/^\s*(?:<[^>]*>)?\s*\(/.test(v.slice(z)))continue;return!0}return!1}function Bo(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
- ${Wh(v,_)}`;return""}function vu(v,_=[]){let{browserImports:k}=jo(v),E=new Set(_);return Bo([],k.filter((T)=>!E.has(T)))}function Wh(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
+ ${qh(v,_)}`;return""}function vd(v,_=[]){let{browserImports:k}=jo(v),E=new Set(_);return Bo([],k.filter((T)=>!E.has(T)))}function qh(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 @@ ${Wh(v,_)}`;return""}function vu(v,_=[]){let{browserImports:k}=jo(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 Ne(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 Uh(v,_){return new RegExp(`(?<![.#\\w$])${_}(?![\\w$])`).test(v)}var Hh=/token|secret|passw|apikey|api_key|privatekey|private_key|credential|webhook|bearer|jwt|signature/i,id=new Set;function qh(v,_){let k=Hh.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 Jr(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&&!Uh(k,j))continue;if(Ui(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;qh(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 Ne(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 Kh(v,_){return new RegExp(`(?<![.#\\w$])${_}(?![\\w$])`).test(v)}var Xh=/token|secret|passw|apikey|api_key|privatekey|private_key|credential|webhook|bearer|jwt|signature/i,Nu=new Set;function Zh(v,_){let k=Xh.test(v),E=_.length>32768;if(!k&&!E)return;if(Nu.has(v))return;if(Nu.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 Jr(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&&!Kh(k,j))continue;if(Ui(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;Zh(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 Kh={left:0,middle:1,right:2};function Xh(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=Kh[v.mouse];_.push(`if ($event.button !== ${k}) return`)}if(v.prevent)_.push("$event.preventDefault()");if(v.stop)_.push("$event.stopPropagation()");return _.join("; ")}function Zh(v,_){let{elementId:k,event:E,modifiers:T}=v,j=ha(v.handler),B=Xh(T),z=[];if(T.once)z.push("once: true");if(T.capture)z.push("capture: true");if(ma(E,T))z.push("passive: true");let F=z.length>0?`, { ${z.join(", ")} }`:"",V="";if(B)V+=`${B}; `;let H=j.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),G=`var $emit = function(name, detail) {
787
+ `}var Gh={left:0,middle:1,right:2};function Jh(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=Gh[v.mouse];_.push(`if ($event.button !== ${k}) return`)}if(v.prevent)_.push("$event.preventDefault()");if(v.stop)_.push("$event.stopPropagation()");return _.join("; ")}function Yh(v,_){let{elementId:k,event:E,modifiers:T}=v,j=ya(v.handler),B=Jh(T),z=[];if(T.once)z.push("once: true");if(T.capture)z.push("capture: true");if(ha(E,T))z.push("passive: true");let F=z.length>0?`, { ${z.join(", ")} }`:"",V="";if(B)V+=`${B}; `;let H=j.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),G=`var $emit = function(name, detail) {
788
788
  $el.dispatchEvent(new CustomEvent(name, { detail: detail, bubbles: true, cancelable: true }))
789
789
  };`;function J(ne){if(/\$emit\s*\(/.test(ne))return`${G}
790
790
  ${ne}`;return`var scope = $el.closest('[data-stx-scope]');
@@ -827,25 +827,25 @@ else {
827
827
  else {
828
828
  ${j}
829
829
  }
830
- }${F})`}function Gh(v){if(v.length===0)return"";return`
830
+ }${F})`}function Qh(v){if(v.length===0)return"";return`
831
831
  // STX: auto-generated event bindings
832
- ${v.map((k,E)=>Zh(k,E)).join(`
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 J=V[1];if(!J.startsWith("_")&&!k.has(J))_.push(J),k.add(J);B+=V[0].length;continue}let H=F.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(H){H[1].split(",").forEach((J)=>{let ne=J.trim(),re=ne.indexOf(":"),se=re>=0?ne.slice(re+1).trim().split(/[\s=]/)[0]:ne.split(/[\s=]/)[0];if(se&&!se.startsWith("_")&&!k.has(se))_.push(se),k.add(se)}),B+=H[0].length;continue}let G=F.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(G){let J=G[1];if(!J.startsWith("_")&&!k.has(J))_.push(J),k.add(J);B+=G[0].length;continue}}B++}return _}var Jh=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 Yh(v){let _=new Set,k=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function E(J){let ne;while((ne=k.exec(J))!==null){let re=ne[0];if(!Jh.has(re))_.add(re)}}let T=/\{\{([\s\S]*?)\}\}/g,j;while((j=T.exec(v))!==null)E(j[1]);let B=/:[a-z][\w.-]*\s*=\s*"([^"]*)"/gi;while((j=B.exec(v))!==null)E(j[1]);let z=/:[a-z][\w.-]*\s*=\s*'([^']*)'/gi;while((j=z.exec(v))!==null)E(j[1]);let F=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((j=F.exec(v))!==null)E(j[1]);let V=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((j=V.exec(v))!==null)E(j[1]);let H=/@model\s*=\s*["']([^"']*)["']/gi;while((j=H.exec(v))!==null)E(j[1]);let G=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((j=G.exec(v))!==null)E(j[1]);return _}async function he(v,_={}){let k=v,E="",T=!1,j=[],B=Kr(k,{filePath:_.filePath,projectRoot:_.projectRoot});k=B.code;let z=Xr(B.styles),F=wt(k);k=F.code,j=[...F.imports,...F.models];let{hasUserImports:V,bundleClientScript:H}=await ut("stx/client-script-bundler",()=>import("./chunk-07mksefx.js"));if(V(k))k=await H(k,_.filePath||"",{projectRoot:_.projectRoot,minify:_.production}),T=!0;if(_.autoImports!==!1){let ae=jo(k);k=ae.code,E=Bo(ae.stxImports,ae.browserImports.filter((me)=>!j.includes(me)))}if(E=`${Jr(k,_.serverData)}${E}`,k=P(k),!T&&Ve(_.attrs||""))k=Ue(k);let G=Gh(_.eventBindings||[]),J=(_.attrs||"").trim(),ne=/\btype\s*=\s*["']module["']/i.test(J),re=_.instanceId?` data-stx-instance="${_.instanceId}"`:"";if(ne){let ae=J.replace(/\btype\s*=\s*["']module["']/i,"").trim(),me=`type="module" data-stx-scoped${re}${ae?` ${ae}`:""}`;return`${z}<script ${me}>
832
+ ${v.map((k,E)=>Yh(k,E)).join(`
833
+ `)}`}function ju(v){let _=[],k=new Set,E=v.replace(/^\s*import\s+.*$/gm,""),T=0,j=E.length,B=0;while(B<j){let z=E[B];if(z==="'"||z==='"'||z==="`"){let F=z;if(B++,F==="`"){let V=0;while(B<j){if(E[B]==="\\"){B+=2;continue}if(E[B]==="`"&&V===0){B++;break}if(E[B]==="$"&&E[B+1]==="{"){V++,B+=2;continue}if(E[B]==="}"&&V>0){V--,B++;continue}B++}}else while(B<j){if(E[B]==="\\"){B+=2;continue}if(E[B]===F){B++;break}B++}continue}if(z==="/"&&E[B+1]==="/"){while(B<j&&E[B]!==`
834
+ `)B++;continue}if(z==="/"&&E[B+1]==="*"){B+=2;while(B<j-1&&!(E[B]==="*"&&E[B+1]==="/"))B++;B+=2;continue}if(z==="{"){T++,B++;continue}if(z==="}"){T--,B++;continue}if(T===0){let F=E.slice(B),V=F.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(V){let J=V[1];if(!J.startsWith("_")&&!k.has(J))_.push(J),k.add(J);B+=V[0].length;continue}let H=F.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(H){H[1].split(",").forEach((J)=>{let ne=J.trim(),re=ne.indexOf(":"),se=re>=0?ne.slice(re+1).trim().split(/[\s=]/)[0]:ne.split(/[\s=]/)[0];if(se&&!se.startsWith("_")&&!k.has(se))_.push(se),k.add(se)}),B+=H[0].length;continue}let G=F.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(G){let J=G[1];if(!J.startsWith("_")&&!k.has(J))_.push(J),k.add(J);B+=G[0].length;continue}}B++}return _}var ey=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 ty(v){let _=new Set,k=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function E(J){let ne;while((ne=k.exec(J))!==null){let re=ne[0];if(!ey.has(re))_.add(re)}}let T=/\{\{([\s\S]*?)\}\}/g,j;while((j=T.exec(v))!==null)E(j[1]);let B=/:[a-z][\w.-]*\s*=\s*"([^"]*)"/gi;while((j=B.exec(v))!==null)E(j[1]);let z=/:[a-z][\w.-]*\s*=\s*'([^']*)'/gi;while((j=z.exec(v))!==null)E(j[1]);let F=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((j=F.exec(v))!==null)E(j[1]);let V=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((j=V.exec(v))!==null)E(j[1]);let H=/@model\s*=\s*["']([^"']*)["']/gi;while((j=H.exec(v))!==null)E(j[1]);let G=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((j=G.exec(v))!==null)E(j[1]);return _}async function he(v,_={}){let k=v,E="",T=!1,j=[],B=Kr(k,{filePath:_.filePath,projectRoot:_.projectRoot});k=B.code;let z=Xr(B.styles),F=wt(k);k=F.code,j=[...F.imports,...F.models];let{hasUserImports:V,bundleClientScript:H}=await ut("stx/client-script-bundler",()=>import("./chunk-tydxqfs6.js"));if(V(k))k=await H(k,_.filePath||"",{projectRoot:_.projectRoot,minify:_.production}),T=!0;if(_.autoImports!==!1){let ae=jo(k);k=ae.code,E=Bo(ae.stxImports,ae.browserImports.filter((me)=>!j.includes(me)))}if(E=`${Jr(k,_.serverData)}${E}`,k=P(k),!T&&Ve(_.attrs||""))k=Ue(k);let G=Qh(_.eventBindings||[]),J=(_.attrs||"").trim(),ne=/\btype\s*=\s*["']module["']/i.test(J),re=_.instanceId?` data-stx-instance="${_.instanceId}"`:"";if(ne){let ae=J.replace(/\btype\s*=\s*["']module["']/i,"").trim(),me=`type="module" data-stx-scoped${re}${ae?` ${ae}`:""}`;return`${z}<script ${me}>
835
835
  ${zr(`${E}${k}
836
836
  ${G}`)}
837
- </script>`}let se=Ds(v),ie=/function __stx_setup_/.test(k),oe=/\bstx\.mount\s*\(|\bstx\.mountEl\s*\(/.test(v);function de(ae){let me=ae.length>0?`
837
+ </script>`}let se=Ds(v),ie=/function __stx_setup_/.test(k),oe=/\bstx\.mount\s*\(|\bstx\.mountEl\s*\(/.test(v);function ue(ae){let me=ae.length>0?`
838
838
  return { ${ae.join(", ")} };`:"";return`${z}<script data-stx-scoped data-stx-run="always"${re}>
839
839
  window.stx.mount(function() {
840
840
  'use strict';
841
841
  ${zr(`${E}${k}
842
842
  ${G}${me}`)}
843
- })</script>`}if(!oe&&!ie){if(se)return de(od(v));if(_.templateContent){let ae=od(v);if(ae.length>0){let me=Yh(_.templateContent);if(ae.some((Se)=>me.has(Se)))return de(ae)}}}return`${z}<script data-stx-scoped data-stx-run="always"${re}>
843
+ })</script>`}if(!oe&&!ie){if(se)return ue(ju(v));if(_.templateContent){let ae=ju(v);if(ae.length>0){let me=ty(_.templateContent);if(ae.some((Se)=>me.has(Se)))return ue(ae)}}}return`${z}<script data-stx-scoped data-stx-run="always"${re}>
844
844
  ;(function() {
845
845
  'use strict';
846
846
  ${zr(`${E}${k}
847
847
  ${G}`)}
848
- })()</script>`}import{createHash as Qh}from"crypto";var qi="__stx_component_client_factories";function Ki(v){let _=v[qi];return _ instanceof Map?_:null}function ld(v){v[qi]=new Map}function va(v,_){let k=Ki(v);if(!k)return null;let E=Qh("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=Ki(_);if(!k?.size)return v;let E=new Map;for(let[H,G]of k)if(G.instances===1)E.set(H,G.body);let T=[];if(E.size>0){let H=[...E.keys()].map((ne)=>JSON.stringify(ne).replace(/[$()*+.?[\\\]^{|}]/g,"\\$&")).join("|"),G=new RegExp(`window\\.__stxComponentFactories\\[(${H})\\]\\(("[^"]+")\\);`,"g"),J=G.exec(v);while(J!==null){let ne=E.get(JSON.parse(J[1]));if(ne!==void 0)T.push({start:J.index,end:J.index+J[0].length,replacement:`(${ne})(${J[2]});`});J=G.exec(v)}}let j=[...k].filter(([,H])=>H.instances>1);if(j.length===0)return cd(v,T);let z=`<script data-stx-scoped data-stx-run="always" data-stx-component-factories>
848
+ })()</script>`}import{createHash as ny}from"crypto";var qi="__stx_component_client_factories";function Ki(v){let _=v[qi];return _ instanceof Map?_:null}function zu(v){v[qi]=new Map}function wa(v,_){let k=Ki(v);if(!k)return null;let E=ny("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 Fu(v,_){let k=Ki(_);if(!k?.size)return v;let E=new Map;for(let[H,G]of k)if(G.instances===1)E.set(H,G.body);let T=[];if(E.size>0){let H=[...E.keys()].map((ne)=>JSON.stringify(ne).replace(/[$()*+.?[\\\]^{|}]/g,"\\$&")).join("|"),G=new RegExp(`window\\.__stxComponentFactories\\[(${H})\\]\\(("[^"]+")\\);`,"g"),J=G.exec(v);while(J!==null){let ne=E.get(JSON.parse(J[1]));if(ne!==void 0)T.push({start:J.index,end:J.index+J[0].length,replacement:`(${ne})(${J[2]});`});J=G.exec(v)}}let j=[...k].filter(([,H])=>H.instances>1);if(j.length===0)return Bu(v,T);let z=`<script data-stx-scoped data-stx-run="always" data-stx-component-factories>
849
849
  (function() {
850
850
  const factories = window.__stxComponentFactories = window.__stxComponentFactories || {};
851
851
  ${j.map(([H,G])=>` try { factories[${JSON.stringify(H)}] = factories[${JSON.stringify(H)}] || ${G.body}; }
@@ -853,30 +853,30 @@ ${j.map(([H,G])=>` try { factories[${JSON.stringify(H)}] = factories[${JSON.str
853
853
  `)}
854
854
  })();
855
855
  </script>`,F=v.search(/<script\b(?=[^>]*\bdata-stx-scoped\b)/i),V=F<0?0:F;return T.push({start:V,end:V,replacement:`${z}
856
- `}),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 _=Ki(v),k=new Map;if(_)for(let[E,T]of _)k.set(E,T.instances);return k}function pd(v,_){let k=Ki(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 fd(v,_){for(let{body:k,count:E}of _)for(let T=0;T<E;T++)va(v,k)}import wd from"fs";var gd=0,wa=new Map;function Fo(){gd=0,wa.clear()}function Xi(v,_){let k=gd++,E=`<!--__STX_${v.toUpperCase()}_${k}__-->`;return wa.set(E,{type:v,expression:_}),E}function zo(){let v={};for(let[_,k]of wa)v[_]={type:k.type,expression:k.expression};return v}function Ho(v,_){let k=v;for(let[E,T]of _)k=k.split(E).join(T);return k}function Yr(v){return v.includes("<!--__STX_")}var ey=/@(?=[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 ty(v){return Array.from({length:v},()=>"&#123;").join("&#8288;")}function md(v){return v.replace(/\{{2,}/g,(_)=>ty(_.length)).replace(/\{(?=!)/g,"&#123;&#8288;").replace(ey,"&#64;")}var ny=/^(?:javascript|vbscript|livescript|mocha|view-source):/,ry=/^data:(?:text\/html|text\/xml|application\/xhtml\+xml|application\/xml|image\/svg\+xml)/,sy=/^data:(?:text\/html|application\/xhtml\+xml)/,iy=new RegExp("[\\u0000-\\u0020\\u00A0\\u1680\\u2000-\\u200F\\u2028\\u2029\\u202F\\u205F\\u3000\\uFEFF]+","g");function oy(v){return v.replace(iy,"").toLowerCase()}function ay(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 hd(v,_="navigable"){let k=oy(v);if(ny.test(k))return!0;return _==="navigable"?ry.test(k):sy.test(k)}function Hs(v,_="navigable"){return hd(v,_)?"unsafe:"+v:v}function cy(v){let _=v.match(/(?:^|[\s"'`/])([A-Za-z][\w:-]*)\s*=\s*(["'])([^"']*)$/);if(!_)return null;if(_[3].trim()!=="")return null;return ay(_[1])}function Sa(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 $a(v,_,k=_){let E=cy(v);return E&&hd(_,E)?"unsafe:"+k:k}var Zi=/<script\b[^>]*>/iy,Ca=/<\/script\s*>/ig,Gi=/<style\b[^>]*>/iy,Ra=/<\/style\s*>/ig;function yd(v,_,k,E){k.lastIndex=_;let T=k.exec(v);if(!T||T.index!==_)return-1;E.lastIndex=k.lastIndex;let j=E.exec(v);if(!j)return-1;return j.index+j[0].length}function Y(v,_){return yd(v,_,Zi,Ca)}function Ur(v,_){return yd(v,_,Gi,Ra)}function Le(v,_){if(!v.startsWith("<!--",_))return-1;let k=v.indexOf("-->",_+4);if(k===-1)return-1;return k+3}function xd(v,_){if(v.startsWith("<!--",_)){let T=Le(v,_);return T===-1?v.length:T}if(Zi.lastIndex=_,Zi.exec(v)?.index===_){Ca.lastIndex=Zi.lastIndex;let T=Ca.exec(v);return T?T.index+T[0].length:v.length}if(Gi.lastIndex=_,Gi.exec(v)?.index===_){Ra.lastIndex=Gi.lastIndex;let T=Ra.exec(v);return T?T.index+T[0].length:v.length}return-1}function fr(v,_){let k=[],E=0,T=v.length,j=!1,B=null;while(E<T){let z=v[E];if(j){if(B){if(z===B)B=null}else if(z==='"'||z==="'")B=z;else if(z===">")j=!1;E++;continue}if(z!=="<"){let G=v.indexOf("<",E+1);if(G===-1)break;E=G;continue}let F=_(v,E);if(F>E){k.push({start:E,end:F,token:v.slice(E,F)}),E=F;continue}let V=xd(v,E);if(V>E){E=V;continue}let H=v.charCodeAt(E+1);if(H>=65&&H<=90||H>=97&&H<=122)j=!0;E++}return k}function bd(v){let _=0,k=0,E=0,T=!1,j=null;while(E<v.length){if(T){let G=v[E];if(j){if(G===j)j=null}else if(G==='"'||G==="'")j=G;else if(G===">")T=!1;E++;continue}let B=v.indexOf("<",E),z=B===-1?v.length:B;while(E<z){let G=v[E++];if(G==="{")_++;else if(G==="}")k++;if(_>=2&&k>=2)return!0}if(B===-1)break;let F=xd(v,B);if(F>B){E=F;continue}let V=v.charCodeAt(B+1),H=V===47?v.charCodeAt(B+2):V;if(H>=65&&H<=90||H>=97&&H<=122)T=!0;E=B+1}return!1}function vd(v,_){while(v.size>=_){let k=v.keys().next();if(k.done)return;v.delete(k.value)}}var ly=1024,uy=16777216,Vr=new Map,_a=0;function dy(v,_){Vr.set(v,_),_a+=v.length+_.output.length;for(let[k,E]of Vr){if(_a<=uy)break;Vr.delete(k),_a-=k.length+E.output.length}}function En(v,_,k,E){let T=E!==void 0&&v.length>=ly,j=T?`${E}\x00${v}`:"";if(T){let H=Vr.get(j);if(H)return Vr.delete(j),Vr.set(j,H),{output:H.output,tokens:H.tokens.slice()}}let B=fr(v,_);if(B.length===0)return{output:v,tokens:[]};let z=B.map((H)=>H.token),F="",V=0;for(let H=0;H<B.length;H++){let G=B[H];F+=v.slice(V,G.start),F+=k(G.token,H),V=G.end}if(F+=v.slice(V),T)return dy(j,{output:F,tokens:z}),{output:F,tokens:z.slice()};return{output:F,tokens:z}}var py=1024,fy=16777216,Wr=new Map,ka=0;function gy(v,_){Wr.set(v,_),ka+=v.length+_.output.length;for(let[k,E]of Wr){if(ka<=fy)break;Wr.delete(k),ka-=k.length+E.output.length}}function Ea(v,_,k){return{output:_,scripts:k,restore:(E)=>E===_?v:Hr(E,k)}}function xn(v){let _=v.length>=py;if(_){let T=Wr.get(v);if(T)return Wr.delete(v),Wr.set(v,T),Ea(v,T.output,T.scripts.slice())}let{output:k,tokens:E}=En(v,Y,(T,j)=>`\x00STX_SCRIPT_${j}\x00`);if(_)return gy(v,{output:k,scripts:E}),Ea(v,k,E.slice());return Ea(v,k,E)}function Hr(v,_){if(_.length===0)return v;return v.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(k,E)=>_[+E]??"")}var Ks={},Sd=new Map;function my(v){let _=Sd.get(v);if(!_){let k=v.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");_=new RegExp(`:${k}(?!\\w)`,"g"),Sd.set(v,_)}return _.lastIndex=0,_}var On={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 vt(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(my(F),String(V))}),z},t:(v,_,k={})=>On.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 Ua(v,_){if(v in On)console.warn(`Filter "${v}" already exists as a built-in filter. Custom filter will take precedence.`);Ks[v]=_}function xu(v){for(let[_,k]of Object.entries(v))Ua(_,k)}function Wa(){return{...On,...Ks}}function Su(){for(let v of Object.keys(Ks))delete Ks[v]}function qa(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 Mn(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=qa(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 vt(v){return md(b(v))}function ye(v,_){let{scripts:k}=xn(v);for(let E of k){let T=E.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i);if(!T||/\bserver\b|\bsrc\s*=/.test(T[1]))continue;let j=T[2];if(/\b(state|derived|effect|ref|reactive|computed|watch|watchEffect|useModel)\s*(?:<[^>]*>)?\s*\(/.test(j))return!0;if(mn(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 Ka(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=/^\s*\(?\s*([A-Za-z_$][\w$]*)\s*(?:,\s*([A-Za-z_$][\w$]*)\s*)?\)?\s+(?:in|of)\s/.exec(E[3]);if(!j)continue;let B=new Set([j[1],...j[2]?[j[2]]:[]]),z=E.index+E[0].length;if(E[0].endsWith("/>")){_.push({start:E.index,end:z,names:B});continue}let F=new RegExp(`<(/?)${T}\\b[^>]*?(/?)>`,"gi");F.lastIndex=z;let V=1,H=v.length;for(let G=F.exec(v);G;G=F.exec(v)){if(G[2]==="/")continue;if(V+=G[1]==="/"?-1:1,V===0){H=G.index+G[0].length;break}}_.push({start:E.index,end:H,names:B})}return _}function hy(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 $d(v,_){let k=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","URL","URLSearchParams","Intl","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined","NaN","Infinity","isNaN","isFinite","window","document","console","new","typeof","instanceof","in","void"],E=v.replace(/'[^']*'/g,"").replace(/"[^"]*"/g,""),T="",j=!1,B=0;for(let V=0;V<E.length;V++){let H=E[V];if(!j&&H==="`"){j=!0,B=0;continue}if(j){if(H==="`"&&B===0){j=!1;continue}if(H==="$"&&E[V+1]==="{"){B++,V++,T+=" ";continue}if(H==="}"&&B>0){B--;continue}if(B>0){T+=H;continue}continue}T+=H}E=T;let z=/(?<![a-zA-Z0-9_$])([a-zA-Z_$][a-zA-Z0-9_$]*)/g,F;while((F=z.exec(E))!==null){let V=F[1];if(!E.substring(0,F.index).trimEnd().endsWith(".")){if(!k.includes(V)&&!(V in _))return!1}}return!0}function yy(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 _d=new Set;function kd(v){return/^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*)*$/.test(v.trim())}function Ed(v,_){let k=`${_??"<unknown>"}\x00${v}`;if(process.env.STX_DEBUG||!_d.has(k))_d.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 Zr(v,_,k){let E=v;return E=E.replace(/\{!!([\s\S]*?)!!\}/g,(T,j)=>{try{let B=x(j,_);if(B===void 0)return kd(j)?Ed(j.trim(),k):T;return B===null?"":String(B)}catch{return T}}),E=Mn(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 kd(z)?Ed(z,k):T;return JSON.stringify(F).replace(/</g,"\\u003c")}catch{return T}}),E}function Xa(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=Mn(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 $a(Sa(k,j),F,vt(F))}catch{return E}}),k}function ku(v,_,k={}){let{output:E,scripts:T}=xn(v),j=T.map((B)=>{let z=B.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i),F=B.match(/^<script\b[^>]*>/i),V=B.search(/<\/script\s*>$/i);if(!z||!F||V===-1)return B;let H=z[1],G=z[2];if(/\bdata-raw\b/.test(H))return B;if(k.skipServer&&/\bserver\b/.test(H))return B;let ne=`<script${Xa(H,_)}>`;if(/\bsrc\s*=/.test(H)||/\btype\s*=\s*["']application\/json["']/.test(H))return ne+G+B.slice(V);return ne+Zr(G,_)+B.slice(V)});return Hr(E,j)}function q(v,_,k){let E=v,T=(J,ne)=>{let re=Ur(J,ne);if(re===-1)return-1;return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(J.slice(ne,re))?-1:re},j=(J,ne,re,se)=>{let ie=re.length,{output:oe,tokens:de}=En(J,ne,(ae,me)=>se(ie+me));return re.push(...de),oe},B=[];E=j(E,T,B,(J)=>`<!--__STX_STYLE_${J}__-->`);let z=[];E=j(E,Y,z,(J)=>`<!--__STX_SCRIPT_EXPR_${J}__-->`);let F=_?.__stx_signals_gate===!0||ye(v),V=new Set(Array.isArray(_?.__stx_client_signal_names)?_.__stx_client_signal_names:[]),H=new Set(Array.isArray(_?.__stx_preserved_client_expressions)?_.__stx_preserved_client_expressions:[]);E=Mn(E,(J,ne,re)=>{try{let se=x(ne,_,!1,(ie)=>Ta(ie,J,k,v));return se!==void 0&&se!==null?String(se):""}catch(se){let ie=se instanceof Error?se.message:String(se);return g("Expression",`Error evaluating: {{{ ${ne.trim()}}}}: ${ie}`,k,v,re,J)}},3),E=E.replace(/\{!!([\s\S]*?)!!\}/g,(J,ne,re)=>{try{let se=x(ne,_,!1,(ie)=>Ta(ie,J,k,v));if(se===void 0&&_.__stx_buildMode==="compile")return Xi("raw",ne.trim());return se!==void 0&&se!==null?String(se):""}catch(se){if(_.__stx_buildMode==="compile")return Xi("raw",ne.trim());let ie=se instanceof Error?se.message:String(se);return g("Expression",`Error evaluating: {!! ${ne.trim()} !!}: ${ie}`,k,v,re,J)}}),E=j(E,Y,z,(J)=>`<!--__STX_SCRIPT_EXPR_${J}__-->`),E=j(E,T,B,(J)=>`<!--__STX_STYLE_${J}__-->`);let G=F?Ka(E):[];if(E=Mn(E,(J,ne,re)=>{let se=ne.trim();if(G.length>0&&hy(G,re,se))return J;if(H.has(se))return J;let ie=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined"],oe=/^([a-zA-Z_$][a-zA-Z0-9_$]*)/,ae=se.match(oe)?.[1],me=ae&&((ae in _)||ie.includes(ae)),ve=Boolean(ae&&V.has(ae)),Se=/^([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/,$e=se.match(Se),Ce=$e&&!ie.includes($e[1])&&!($e[1]in _);if(/^__[A-Z_]+__$/.test(se))return"";let Ee;try{let Te=x(ne,_,!1,(_e)=>{Ee=_e});if(ve)return J;if(F&&!$d(se,_))return J;if(Ee)Ta(Ee,J,k,v);if(_.__stx_buildMode==="compile"&&!F&&(Te===void 0||yy(se,_)))return Xi("expr",se);if(Te===void 0||Te===null)return"";let Re=String(Te);return $a(Sa(E,re),Re,vt(Re))}catch(Te){if(ve)return J;if(F&&!$d(se,_))return J;if(Ce)return J;let Re=Te instanceof Error?Te.message:String(Te);return g("Expression",`Error evaluating: {{ ${se} }}: ${Re}`,k,v,re,J)}}),z.length>0)E=E.replace(/<!--__STX_SCRIPT_EXPR_(\d+)__-->/g,(J,ne)=>z[Number(ne)]??J);if(B.length>0)E=E.replace(/<!--__STX_STYLE_(\d+)__-->/g,(J,ne)=>B[Number(ne)]??J);return E}function Ga(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=Ks[B]||On[B];if(!z)throw Error(`Filter not found: ${B}. Available filters: ${Object.keys(Wa()).join(", ")}`);let F=[];if(T.startsWith(":")){let V=T.match(/^:([^|\s]+)/);if(V){let H=V[1].trim();try{let G=Number(H);F=[Number.isNaN(G)?H:G]}catch{F=[H]}T=T.substring(V[0].length).trim()}}else if(T.startsWith("(")){let V=1,H=1;while(V>0&&H<T.length){if(T[H]==="(")V++;if(T[H]===")")V--;H++}if(V===0){let G=T.substring(1,H-1).trim();if(G)try{if(G.startsWith("{")&&G.endsWith("}"))F=[x(`(${G})`,k,!0)];else{let J=[],ne="",re=null,se=0,ie=0,oe=0,de=!1;for(let ae=0;ae<G.length;ae++){let me=G[ae];if(de){ne+=me,de=!1;continue}if(me==="\\"){ne+=me,de=!0;continue}if(re){if(ne+=me,me===re)re=null;continue}if(me==='"'||me==="'"||me==="`"){re=me,ne+=me;continue}if(me==="(")se++;else if(me===")")se--;else if(me==="[")ie++;else if(me==="]")ie--;else if(me==="{")oe++;else if(me==="}")oe--;if(me===","&&se===0&&ie===0&&oe===0){J.push(ne),ne="";continue}ne+=me}if(ne)J.push(ne);F=J.map((ae)=>{let me=ae.trim();return x(me,k,!0)})}}catch{F=[G]}T=T.substring(H).trim()}}try{E=z(E,k,...F)}catch(V){let H=V instanceof Error?V.message:String(V);throw Error(`Error applying filter '${B}': ${H}`)}if(T.startsWith("|"))T=T.substring(1).trim();else break}return E}function xy(v){let _=!1,k="",E=0,T=0,j=0,B=!1;for(let z=0;z<v.length;z++){let F=v[z],V=v[z+1];if(_&&B){B=!1;continue}if(_&&F==="\\"){B=!0;continue}if(B=!1,(F==='"'||F==="'"||F==="`")&&!B){if(!_)_=!0,k=F;else if(F===k)_=!1,k="";continue}if(_&&k==="`"&&F==="$"&&V==="{"){let H=1;z+=2;while(z<v.length&&H>0){if(v[z]==="{")H++;else if(v[z]==="}")H--;if(H>0)z++}continue}if(_)continue;if(F==="(")E++;else if(F===")")E--;else if(F==="[")T++;else if(F==="]")T--;else if(F==="{")j++;else if(F==="}")j--;if(F==="|"&&E===0&&T===0&&j===0){if(V==="|"){z++;continue}if(V==="="){z++;continue}return z}}return-1}var qs=new Set,by=1000;function Cu(){qs.clear()}function Ta(v,_,k,E){if(!O())return;let T=`${k}\x00${v.expression}`;if(qs.has(T))return;if(qs.size>=by)qs.clear();qs.add(T);let j=k,B=E;try{if(k&&wd.existsSync(k))B=wd.readFileSync(k,"utf8")}catch{}let z=B.indexOf(_);if(z>=0)j=`${k}:${B.slice(0,z).split(`
857
- `).length}`;console.warn(`${j}: stx warning: ${_} rendered as an empty string. The safe evaluator rejected \`${v.expression}\` (${v.rule}). Compute the value in <script server> and interpolate the variable instead.`)}function x(v,_,k=!1,E){try{let T=v.trim(),j=xy(T);if(j>0){let z=T.substring(0,j).trim(),F=T.substring(j+1).trim(),V=x(z,_,!0,E);return Ga(V,F,_)}let B=fn(T);if(B!==null){E?.({expression:T,rule:B});return}try{let z=Object.keys(_),F=Object.values(_);return l(T,z)(...F)}catch{return c(T,_)}}catch(T){if(T instanceof ReferenceError){let j=/(\b\w+)\s+is not defined/.exec(T.message);if(j){let B=j[1],z=vy(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 vy(v,_){let k=null;for(let T of _){if(T===v)continue;let j=wy(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 wy(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 $u(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 sS from"fs";import Jt from"path";import It from"path";import{hasLocalConfig as Qd}from"bunfig";import Cn from"fs";import Er from"path";import Aa from"fs";import Cd from"path";import{fileURLToPath as Sy}from"url";var Ia;function Me(){if(Ia)return Ia;let v="unknown";try{v=String(JSON.parse(Aa.readFileSync(new URL("../package.json",import.meta.url),"utf8")).version)}catch{}if(import.meta.url.endsWith(".ts"))try{let _=Cd.dirname(Sy(import.meta.url)),k=0;for(let E of Aa.readdirSync(_,{recursive:!0,withFileTypes:!0}))if(E.isFile()&&E.name.endsWith(".ts"))k=Math.max(k,Aa.statSync(Cd.join(E.parentPath,E.name)).mtimeMs);v+=`+src.${Math.trunc(k)}`}catch{}return Ia=v,v}var Ja=new Map,Cr=new Map;async function Eu(v){let k;for(let E=0;E<3;E++)try{let j=(await Cn.promises.stat(v)).mtime.getTime(),B=Cr.get(v);if(B&&B.mtime===j)return B.content;let z=await Bun.file(v).text(),V=(await Cn.promises.stat(v)).mtime.getTime();if(V!==j)continue;return Cr.set(v,{content:z,mtime:V}),z}catch(T){k=T;break}throw Cr.delete(v),Error(`File not found: ${v}${k?` (${k.message})`:""}`)}function _u(v){Cr.delete(v)}function Tu(v){for(let _ of Cr.keys())if(_.startsWith(v))Cr.delete(_)}var Ji=null,$y=null,Td=null;function Ru(v){Td=v}async function Ya(v=!1){let _=Td??await import("./chunk-9rpw3gqx.js");if(v)return _.generateSignalsRuntimeDev();if(Ji===null)Ji=_.generateSignalsRuntime();return Ji}var Yi=null;async function Za(){if(Yi===null){let{getRouterScript:v}=await import("./chunk-cjb46akr.js");Yi=v()}return Yi}var Rd={};async function Au(v,_=!1){let k=v==="runtime"?await Ya(_):await Za(),E=v==="runtime"&&_?"runtime-debug":v,T=Rd[E];if(!T||T.content!==k)T={content:k,hash:Bun.hash(k).toString(16).padStart(16,"0").slice(0,16)},Rd[E]=T;return{content:k,hash:T.hash,url:`/_stx/${v}.${T.hash}.js`}}var _y=500,kr=new Map;function Ad(v){return a(process.cwd(),"module-bundles",`${v}.js`)}function Pu(v){let _=Bun.hash(v).toString(16).padStart(16,"0").slice(0,16),k=kr.has(_);if(k)kr.delete(_);kr.set(_,v);while(kr.size>_y)kr.delete(kr.keys().next().value);if(!k)try{let E=Ad(_);if(!Cn.existsSync(E))Cn.mkdirSync(Er.dirname(E),{recursive:!0}),Cn.writeFileSync(E,v)}catch{}return`/_stx/modules.${_}.js`}function Vo(v){if(!/^[0-9a-f]{16}$/.test(v))return;let _=kr.get(v);if(_!==void 0)return _;try{return Cn.readFileSync(Ad(v),"utf8")}catch{return}}function Iu(){Cr.clear(),ee(),td(),Ji=null,$y=null,Yi=null}function Id(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 en(v,_){try{if(!_.cachePath)return null;let k=Er.resolve(_.cachePath),E=Er.join(k,`${Nn(v)}.html`),T=Er.join(k,`${Nn(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!==Me())return null;if(B.optionsSignature!==Id(_))return null;if((await Cn.promises.stat(v)).mtime.getTime()>B.mtime)return null;for(let F of B.dependencies)if(await r(F)){if((await Cn.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 tn(v,_,k,E){try{if(!E.cachePath)return;let T=Er.resolve(E.cachePath);await Cn.promises.mkdir(T,{recursive:!0});let j=Er.join(T,`${Nn(v)}.html`),B=Er.join(T,`${Nn(v)}.meta.json`),z=await Cn.promises.stat(v);await Bun.write(j,_);let F={sourcePath:v,mtime:z.mtime.getTime(),dependencies:Array.from(k),cacheVersion:E.cacheVersion,engine:Me(),optionsSignature:Id(E),generatedAt:Date.now()};await Bun.write(B,JSON.stringify(F,null,2)),Ja.set(v,{output:_,mtime:z.mtime.getTime(),dependencies:k})}catch(T){console.warn(`Failed to cache template ${v}:`,T)}}var ky=16;function Nn(v){return new Bun.CryptoHasher("sha1").update(v).digest("hex").substring(0,ky)}var Ln={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 Pa(v){return`--stx-${v}`}function Da(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 Pd(v){let _={};for(let[k,E]of Object.entries(Ln)){let T=Da(v,E.light);if(T===void 0)continue;_[k]=`var(${Pa(k)}, ${T})`}return _}function Dd(v){let _=[],k=[];for(let[E,T]of Object.entries(Ln)){let j=Da(v,T.light),B=Da(v,T.dark);if(j===void 0)continue;if(_.push(` ${Pa(E)}: ${j};`),B!==void 0)k.push(` ${Pa(E)}: ${B};`)}if(_.length===0)return"";return["/* stx role tokens \u2014 override any of these to re-theme by meaning. */",":root {",..._,"}",".dark {",...k,"}",""].join(`
858
- `)}var Md={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 Od(v){return`--stx-radius-${v}`}function Nd(){let v={};for(let[_,k]of Object.entries(Md))v[_]=`var(${Od(_)}, ${k.value})`;return v}function jd(){return["/* stx shape tokens \u2014 a radius by what the thing is. */",":root {",...Object.entries(Md).map(([v,_])=>` ${Od(v)}: ${_.value};`),"}",""].join(`
859
- `)}var Ld={"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"}},Ey={"control-x":"control-px","control-y":"control-py","cell-x":"cell-px","cell-y":"cell-py","cell-head-y":"cell-head-py"},Cy={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 Bd(v){return`--stx-${v}`}function Ma(v){let _=Ld[v];if(!_)throw Error(`[stx] unknown density token "${v}"`);return`var(${Bd(v)}, ${_.value})`}function zd(){let v={};for(let[_,k]of Object.entries(Ey))v[_]=Ma(k);return v}function Fd(){let v={};for(let[_,{size:k,leading:E}]of Object.entries(Cy))v[_]=[Ma(k),{lineHeight:Ma(E)}];return v}function Vd(){return["/* stx density tokens \u2014 how much room a control or a table cell takes. */",":root {",...Object.entries(Ld).map(([v,_])=>` ${Bd(v)}: ${_.value};`),"}",""].join(`
860
- `)}function Wd(v){return typeof v==="object"&&v!==null&&!Array.isArray(v)}function Oa(v,_){let k={...v};for(let[E,T]of Object.entries(_))k[E]=Wd(T)&&Wd(k[E])?Oa(k[E],T):T;return k}function Ud(v,_){if(!_.fonts)return"";let k=new v({..._.config,fonts:_.fonts,cssVariables:!1}).toCSS(!1,_.minify);return k&&!_.minify?`${k}
861
- `:k}function Hd(v={},_={}){let k=v.theme||{},E=_.theme||{},{extend:T,...j}=E,{extend:B,...z}=k,F=z.colors||{};z.colors={...F,...Pd(F)};let V=z.borderRadius||{};z.borderRadius={...V,...Nd()};let H=z.spacing||{};z.spacing={...H,...zd()};let G=z.fontSize||{};z.fontSize={...G,...Fd()};let J=Oa(z,j),ne=Oa(B||{},T||{});if(Object.keys(ne).length>0)J.extend=ne;let re=[...v.safelist||[],..._.safelist||[]],se={...v.shortcuts||{},..._.shortcuts||{}},ie=[...v.preflights||[],..._.preflights||[]],{fonts:oe,...de}=v,{fonts:ae,...me}=_,ve=ae??oe;return{config:{...de,...me,theme:J,safelist:re,shortcuts:se,...ie.length>0?{preflights:ie}:{},content:[],output:""},safelist:re,shortcuts:se,includePreflight:_.preflight!==!1,minify:_.minify===!0,tokenCSS:Dd(F)+jd()+Vd(),...ve?{fonts:ve}:{}}}function qd(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 Kd(v,_,k={}){let{prefix:E="",preserveHost:T=!0,scopeKeyframes:j=!0,scopeCustomProperties:B=!1}=k;if(!v.trim())return"";let z=Na(v),F=[],V=new Map;if(j)for(let H of z){let G=H.selector.match(/@keyframes\s+([a-z_-][a-z0-9_-]*)/i);if(G){let J=G[1],ne=`${_}_${J}`;V.set(J,ne)}}for(let H of z){let G=Xd(H,_,E,T,V,B);F.push(G)}return F.join(`
862
-
863
- `)}function Na(v){let _=[],k=v.replace(/\/\*[\s\S]*?\*\//g,""),E=0,T="",j=!1,B="";for(let z=0;z<k.length;z++){let F=k[z];if(F==="@"&&E===0)j=!0;if(F==="{")E++;else if(F==="}"){if(E--,E===0){if(j){B+=F;let V=B.match(/@([a-z-]+)\s*([^{]*)\{([\s\S]*)\}/i);if(V){let[,H,G,J]=V;if(H==="keyframes")_.push({selector:`@keyframes ${G.trim()}`,declarations:J.trim()});else if(H==="media"||H==="supports"||H==="container"){let ne=Na(J);_.push({selector:`@${H} ${G.trim()}`,declarations:ne.map((re)=>`${re.selector} { ${re.declarations} }`).join(`
864
- `)})}else _.push({selector:`@${H} ${G.trim()}`,declarations:J.trim()})}B="",j=!1}else if(T.trim()){T+=F;let V=T.match(/([^{]+)\{([^}]*)\}/);if(V)_.push({selector:V[1].trim(),declarations:V[2].trim()});T=""}continue}}if(j)B+=F;else T+=F}return _}function Xd(v,_,k,E,T,j){let{selector:B,declarations:z}=v;if(B.startsWith("@")){if(B.startsWith("@keyframes")){let H=B.replace("@keyframes ","").trim();return`@keyframes ${T.get(H)||H} { ${z} }`}if(B.startsWith("@media")||B.startsWith("@supports")||B.startsWith("@container")){let G=Na(`x { ${z} }`.replace(/x \{ /,"").replace(/ \}$/,"")).map((J)=>Xd(J,_,k,E,T,j)).join(`
856
+ `}),Bu(v,T)}function Bu(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 Vu(v){let _=Ki(v),k=new Map;if(_)for(let[E,T]of _)k.set(E,T.instances);return k}function Wu(v,_){let k=Ki(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 Uu(v,_){for(let{body:k,count:E}of _)for(let T=0;T<E;T++)wa(v,k)}import Yu from"fs";var Hu=0,Sa=new Map;function Fo(){Hu=0,Sa.clear()}function Xi(v,_){let k=Hu++,E=`<!--__STX_${v.toUpperCase()}_${k}__-->`;return Sa.set(E,{type:v,expression:_}),E}function zo(){let v={};for(let[_,k]of Sa)v[_]={type:k.type,expression:k.expression};return v}function Ho(v,_){let k=v;for(let[E,T]of _)k=k.split(E).join(T);return k}function Yr(v){return v.includes("<!--__STX_")}var ry=/@(?=[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 sy(v){return Array.from({length:v},()=>"&#123;").join("&#8288;")}function qu(v){return v.replace(/\{{2,}/g,(_)=>sy(_.length)).replace(/\{(?=!)/g,"&#123;&#8288;").replace(ry,"&#64;")}var iy=/^(?:javascript|vbscript|livescript|mocha|view-source):/,oy=/^data:(?:text\/html|text\/xml|application\/xhtml\+xml|application\/xml|image\/svg\+xml)/,ay=/^data:(?:text\/html|application\/xhtml\+xml)/,cy=new RegExp("[\\u0000-\\u0020\\u00A0\\u1680\\u2000-\\u200F\\u2028\\u2029\\u202F\\u205F\\u3000\\uFEFF]+","g");function ly(v){return v.replace(cy,"").toLowerCase()}function uy(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 Ku(v,_="navigable"){let k=ly(v);if(iy.test(k))return!0;return _==="navigable"?oy.test(k):ay.test(k)}function Us(v,_="navigable"){return Ku(v,_)?"unsafe:"+v:v}function dy(v){let _=v.match(/(?:^|[\s"'`/])([A-Za-z][\w:-]*)\s*=\s*(["'])([^"']*)$/);if(!_)return null;if(_[3].trim()!=="")return null;return uy(_[1])}function $a(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 _a(v,_,k=_){let E=dy(v);return E&&Ku(_,E)?"unsafe:"+k:k}var Zi=/<script\b[^>]*>/iy,Ra=/<\/script\s*>/ig,Gi=/<style\b[^>]*>/iy,Ta=/<\/style\s*>/ig;function Xu(v,_,k,E){k.lastIndex=_;let T=k.exec(v);if(!T||T.index!==_)return-1;E.lastIndex=k.lastIndex;let j=E.exec(v);if(!j)return-1;return j.index+j[0].length}function Y(v,_){return Xu(v,_,Zi,Ra)}function Ur(v,_){return Xu(v,_,Gi,Ta)}function Le(v,_){if(!v.startsWith("<!--",_))return-1;let k=v.indexOf("-->",_+4);if(k===-1)return-1;return k+3}function Zu(v,_){if(v.startsWith("<!--",_)){let T=Le(v,_);return T===-1?v.length:T}if(Zi.lastIndex=_,Zi.exec(v)?.index===_){Ra.lastIndex=Zi.lastIndex;let T=Ra.exec(v);return T?T.index+T[0].length:v.length}if(Gi.lastIndex=_,Gi.exec(v)?.index===_){Ta.lastIndex=Gi.lastIndex;let T=Ta.exec(v);return T?T.index+T[0].length:v.length}return-1}function fr(v,_){let k=[],E=0,T=v.length,j=!1,B=null;while(E<T){let z=v[E];if(j){if(B){if(z===B)B=null}else if(z==='"'||z==="'")B=z;else if(z===">")j=!1;E++;continue}if(z!=="<"){let G=v.indexOf("<",E+1);if(G===-1)break;E=G;continue}let F=_(v,E);if(F>E){k.push({start:E,end:F,token:v.slice(E,F)}),E=F;continue}let V=Zu(v,E);if(V>E){E=V;continue}let H=v.charCodeAt(E+1);if(H>=65&&H<=90||H>=97&&H<=122)j=!0;E++}return k}function Gu(v){let _=0,k=0,E=0,T=!1,j=null;while(E<v.length){if(T){let G=v[E];if(j){if(G===j)j=null}else if(G==='"'||G==="'")j=G;else if(G===">")T=!1;E++;continue}let B=v.indexOf("<",E),z=B===-1?v.length:B;while(E<z){let G=v[E++];if(G==="{")_++;else if(G==="}")k++;if(_>=2&&k>=2)return!0}if(B===-1)break;let F=Zu(v,B);if(F>B){E=F;continue}let V=v.charCodeAt(B+1),H=V===47?v.charCodeAt(B+2):V;if(H>=65&&H<=90||H>=97&&H<=122)T=!0;E=B+1}return!1}function Ju(v,_){while(v.size>=_){let k=v.keys().next();if(k.done)return;v.delete(k.value)}}var py=1024,fy=16777216,Vr=new Map,ka=0;function gy(v,_){Vr.set(v,_),ka+=v.length+_.output.length;for(let[k,E]of Vr){if(ka<=fy)break;Vr.delete(k),ka-=k.length+E.output.length}}function En(v,_,k,E){let T=E!==void 0&&v.length>=py,j=T?`${E}\x00${v}`:"";if(T){let H=Vr.get(j);if(H)return Vr.delete(j),Vr.set(j,H),{output:H.output,tokens:H.tokens.slice()}}let B=fr(v,_);if(B.length===0)return{output:v,tokens:[]};let z=B.map((H)=>H.token),F="",V=0;for(let H=0;H<B.length;H++){let G=B[H];F+=v.slice(V,G.start),F+=k(G.token,H),V=G.end}if(F+=v.slice(V),T)return gy(j,{output:F,tokens:z}),{output:F,tokens:z.slice()};return{output:F,tokens:z}}var my=1024,hy=16777216,Wr=new Map,Ea=0;function yy(v,_){Wr.set(v,_),Ea+=v.length+_.output.length;for(let[k,E]of Wr){if(Ea<=hy)break;Wr.delete(k),Ea-=k.length+E.output.length}}function Ca(v,_,k){return{output:_,scripts:k,restore:(E)=>E===_?v:Hr(E,k)}}function xn(v){let _=v.length>=my;if(_){let T=Wr.get(v);if(T)return Wr.delete(v),Wr.set(v,T),Ca(v,T.output,T.scripts.slice())}let{output:k,tokens:E}=En(v,Y,(T,j)=>`\x00STX_SCRIPT_${j}\x00`);if(_)return yy(v,{output:k,scripts:E}),Ca(v,k,E.slice());return Ca(v,k,E)}function Hr(v,_){if(_.length===0)return v;return v.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(k,E)=>_[+E]??"")}var qs={},Qu=new Map;function xy(v){let _=Qu.get(v);if(!_){let k=v.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");_=new RegExp(`:${k}(?!\\w)`,"g"),Qu.set(v,_)}return _.lastIndex=0,_}var On={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 vt(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(xy(F),String(V))}),z},t:(v,_,k={})=>On.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 Ua(v,_){if(v in On)console.warn(`Filter "${v}" already exists as a built-in filter. Custom filter will take precedence.`);qs[v]=_}function xd(v){for(let[_,k]of Object.entries(v))Ua(_,k)}function Wa(){return{...On,...qs}}function Sd(){for(let v of Object.keys(qs))delete qs[v]}function qa(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 Mn(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=qa(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 vt(v){return qu(b(v))}function ye(v,_){let{scripts:k}=xn(v);for(let E of k){let T=E.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i);if(!T||/\bserver\b|\bsrc\s*=/.test(T[1]))continue;let j=T[2];if(/\b(state|derived|effect|ref|reactive|computed|watch|watchEffect|useModel)\s*(?:<[^>]*>)?\s*\(/.test(j))return!0;if(mn(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 Ka(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=/^\s*\(?\s*([A-Za-z_$][\w$]*)\s*(?:,\s*([A-Za-z_$][\w$]*)\s*)?\)?\s+(?:in|of)\s/.exec(E[3]);if(!j)continue;let B=new Set([j[1],...j[2]?[j[2]]:[]]),z=E.index+E[0].length;if(E[0].endsWith("/>")){_.push({start:E.index,end:z,names:B});continue}let F=new RegExp(`<(/?)${T}\\b[^>]*?(/?)>`,"gi");F.lastIndex=z;let V=1,H=v.length;for(let G=F.exec(v);G;G=F.exec(v)){if(G[2]==="/")continue;if(V+=G[1]==="/"?-1:1,V===0){H=G.index+G[0].length;break}}_.push({start:E.index,end:H,names:B})}return _}function by(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 ed(v,_){let k=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","URL","URLSearchParams","Intl","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined","NaN","Infinity","isNaN","isFinite","window","document","console","new","typeof","instanceof","in","void"],E=v.replace(/'[^']*'/g,"").replace(/"[^"]*"/g,""),T="",j=!1,B=0;for(let V=0;V<E.length;V++){let H=E[V];if(!j&&H==="`"){j=!0,B=0;continue}if(j){if(H==="`"&&B===0){j=!1;continue}if(H==="$"&&E[V+1]==="{"){B++,V++,T+=" ";continue}if(H==="}"&&B>0){B--;continue}if(B>0){T+=H;continue}continue}T+=H}E=T;let z=/(?<![a-zA-Z0-9_$])([a-zA-Z_$][a-zA-Z0-9_$]*)/g,F;while((F=z.exec(E))!==null){let V=F[1];if(!E.substring(0,F.index).trimEnd().endsWith(".")){if(!k.includes(V)&&!(V in _))return!1}}return!0}function vy(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 td=new Set;function nd(v){return/^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*)*$/.test(v.trim())}function rd(v,_){let k=`${_??"<unknown>"}\x00${v}`;if(process.env.STX_DEBUG||!td.has(k))td.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 Zr(v,_,k){let E=v;return E=E.replace(/\{!!([\s\S]*?)!!\}/g,(T,j)=>{try{let B=x(j,_);if(B===void 0)return nd(j)?rd(j.trim(),k):T;return B===null?"":String(B)}catch{return T}}),E=Mn(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 nd(z)?rd(z,k):T;return JSON.stringify(F).replace(/</g,"\\u003c")}catch{return T}}),E}function Xa(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=Mn(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 _a($a(k,j),F,vt(F))}catch{return E}}),k}function kd(v,_,k={}){let{output:E,scripts:T}=xn(v),j=T.map((B)=>{let z=B.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i),F=B.match(/^<script\b[^>]*>/i),V=B.search(/<\/script\s*>$/i);if(!z||!F||V===-1)return B;let H=z[1],G=z[2];if(/\bdata-raw\b/.test(H))return B;if(k.skipServer&&/\bserver\b/.test(H))return B;let ne=`<script${Xa(H,_)}>`;if(/\bsrc\s*=/.test(H)||/\btype\s*=\s*["']application\/json["']/.test(H))return ne+G+B.slice(V);return ne+Zr(G,_)+B.slice(V)});return Hr(E,j)}function q(v,_,k){let E=v,T=(J,ne)=>{let re=Ur(J,ne);if(re===-1)return-1;return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(J.slice(ne,re))?-1:re},j=(J,ne,re,se)=>{let ie=re.length,{output:oe,tokens:ue}=En(J,ne,(ae,me)=>se(ie+me));return re.push(...ue),oe},B=[];E=j(E,T,B,(J)=>`<!--__STX_STYLE_${J}__-->`);let z=[];E=j(E,Y,z,(J)=>`<!--__STX_SCRIPT_EXPR_${J}__-->`);let F=_?.__stx_signals_gate===!0||ye(v),V=new Set(Array.isArray(_?.__stx_client_signal_names)?_.__stx_client_signal_names:[]),H=new Set(Array.isArray(_?.__stx_preserved_client_expressions)?_.__stx_preserved_client_expressions:[]);E=Mn(E,(J,ne,re)=>{try{let se=x(ne,_,!1,(ie)=>Aa(ie,J,k,v));return se!==void 0&&se!==null?String(se):""}catch(se){let ie=se instanceof Error?se.message:String(se);return g("Expression",`Error evaluating: {{{ ${ne.trim()}}}}: ${ie}`,k,v,re,J)}},3),E=E.replace(/\{!!([\s\S]*?)!!\}/g,(J,ne,re)=>{try{let se=x(ne,_,!1,(ie)=>Aa(ie,J,k,v));if(se===void 0&&_.__stx_buildMode==="compile")return Xi("raw",ne.trim());return se!==void 0&&se!==null?String(se):""}catch(se){if(_.__stx_buildMode==="compile")return Xi("raw",ne.trim());let ie=se instanceof Error?se.message:String(se);return g("Expression",`Error evaluating: {!! ${ne.trim()} !!}: ${ie}`,k,v,re,J)}}),E=j(E,Y,z,(J)=>`<!--__STX_SCRIPT_EXPR_${J}__-->`),E=j(E,T,B,(J)=>`<!--__STX_STYLE_${J}__-->`);let G=F?Ka(E):[];if(E=Mn(E,(J,ne,re)=>{let se=ne.trim();if(G.length>0&&by(G,re,se))return J;if(H.has(se))return J;let ie=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined"],oe=/^([a-zA-Z_$][a-zA-Z0-9_$]*)/,ae=se.match(oe)?.[1],me=ae&&((ae in _)||ie.includes(ae)),ve=Boolean(ae&&V.has(ae)),Se=/^([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/,$e=se.match(Se),Ce=$e&&!ie.includes($e[1])&&!($e[1]in _);if(/^__[A-Z_]+__$/.test(se))return"";let Ee;try{let Te=x(ne,_,!1,(_e)=>{Ee=_e});if(ve)return J;if(F&&!ed(se,_))return J;if(Ee)Aa(Ee,J,k,v);if(_.__stx_buildMode==="compile"&&!F&&(Te===void 0||vy(se,_)))return Xi("expr",se);if(Te===void 0||Te===null)return"";let Re=String(Te);return _a($a(E,re),Re,vt(Re))}catch(Te){if(ve)return J;if(F&&!ed(se,_))return J;if(Ce)return J;let Re=Te instanceof Error?Te.message:String(Te);return g("Expression",`Error evaluating: {{ ${se} }}: ${Re}`,k,v,re,J)}}),z.length>0)E=E.replace(/<!--__STX_SCRIPT_EXPR_(\d+)__-->/g,(J,ne)=>z[Number(ne)]??J);if(B.length>0)E=E.replace(/<!--__STX_STYLE_(\d+)__-->/g,(J,ne)=>B[Number(ne)]??J);return E}function Ga(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=qs[B]||On[B];if(!z)throw Error(`Filter not found: ${B}. Available filters: ${Object.keys(Wa()).join(", ")}`);let F=[];if(T.startsWith(":")){let V=T.match(/^:([^|\s]+)/);if(V){let H=V[1].trim();try{let G=Number(H);F=[Number.isNaN(G)?H:G]}catch{F=[H]}T=T.substring(V[0].length).trim()}}else if(T.startsWith("(")){let V=1,H=1;while(V>0&&H<T.length){if(T[H]==="(")V++;if(T[H]===")")V--;H++}if(V===0){let G=T.substring(1,H-1).trim();if(G)try{if(G.startsWith("{")&&G.endsWith("}"))F=[x(`(${G})`,k,!0)];else{let J=[],ne="",re=null,se=0,ie=0,oe=0,ue=!1;for(let ae=0;ae<G.length;ae++){let me=G[ae];if(ue){ne+=me,ue=!1;continue}if(me==="\\"){ne+=me,ue=!0;continue}if(re){if(ne+=me,me===re)re=null;continue}if(me==='"'||me==="'"||me==="`"){re=me,ne+=me;continue}if(me==="(")se++;else if(me===")")se--;else if(me==="[")ie++;else if(me==="]")ie--;else if(me==="{")oe++;else if(me==="}")oe--;if(me===","&&se===0&&ie===0&&oe===0){J.push(ne),ne="";continue}ne+=me}if(ne)J.push(ne);F=J.map((ae)=>{let me=ae.trim();return x(me,k,!0)})}}catch{F=[G]}T=T.substring(H).trim()}}try{E=z(E,k,...F)}catch(V){let H=V instanceof Error?V.message:String(V);throw Error(`Error applying filter '${B}': ${H}`)}if(T.startsWith("|"))T=T.substring(1).trim();else break}return E}function wy(v){let _=!1,k="",E=0,T=0,j=0,B=!1;for(let z=0;z<v.length;z++){let F=v[z],V=v[z+1];if(_&&B){B=!1;continue}if(_&&F==="\\"){B=!0;continue}if(B=!1,(F==='"'||F==="'"||F==="`")&&!B){if(!_)_=!0,k=F;else if(F===k)_=!1,k="";continue}if(_&&k==="`"&&F==="$"&&V==="{"){let H=1;z+=2;while(z<v.length&&H>0){if(v[z]==="{")H++;else if(v[z]==="}")H--;if(H>0)z++}continue}if(_)continue;if(F==="(")E++;else if(F===")")E--;else if(F==="[")T++;else if(F==="]")T--;else if(F==="{")j++;else if(F==="}")j--;if(F==="|"&&E===0&&T===0&&j===0){if(V==="|"){z++;continue}if(V==="="){z++;continue}return z}}return-1}var Hs=new Set,Sy=1000;function Cd(){Hs.clear()}function Aa(v,_,k,E){if(!O())return;let T=`${k}\x00${v.expression}`;if(Hs.has(T))return;if(Hs.size>=Sy)Hs.clear();Hs.add(T);let j=k,B=E;try{if(k&&Yu.existsSync(k))B=Yu.readFileSync(k,"utf8")}catch{}let z=B.indexOf(_);if(z>=0)j=`${k}:${B.slice(0,z).split(`
857
+ `).length}`;console.warn(`${j}: stx warning: ${_} rendered as an empty string. The safe evaluator rejected \`${v.expression}\` (${v.rule}). Compute the value in <script server> and interpolate the variable instead.`)}function x(v,_,k=!1,E){try{let T=v.trim(),j=wy(T);if(j>0){let z=T.substring(0,j).trim(),F=T.substring(j+1).trim(),V=x(z,_,!0,E);return Ga(V,F,_)}let B=fn(T);if(B!==null){E?.({expression:T,rule:B});return}try{let z=Object.keys(_),F=Object.values(_);return l(T,z)(...F)}catch{return c(T,_)}}catch(T){if(T instanceof ReferenceError){let j=/(\b\w+)\s+is not defined/.exec(T.message);if(j){let B=j[1],z=$y(B,Object.keys(_));if(z&&z!==B)T.message=`${T.message} \u2014 did you mean '${z}'?`}}if(!k)console.error(`Error evaluating expression: ${v}`,T);throw T}}function $y(v,_){let k=null;for(let T of _){if(T===v)continue;let j=_y(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 _y(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 $d(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 Jt from"path";import Zs from"fs";import It from"path";import{hasLocalConfig as ep}from"bunfig";import Cn from"fs";import Er from"path";import Ia from"fs";import sd from"path";import{fileURLToPath as ky}from"url";var Pa;function Me(){if(Pa)return Pa;let v="unknown";try{v=String(JSON.parse(Ia.readFileSync(new URL("../package.json",import.meta.url),"utf8")).version)}catch{}if(import.meta.url.endsWith(".ts"))try{let _=sd.dirname(ky(import.meta.url)),k=0;for(let E of Ia.readdirSync(_,{recursive:!0,withFileTypes:!0}))if(E.isFile()&&E.name.endsWith(".ts"))k=Math.max(k,Ia.statSync(sd.join(E.parentPath,E.name)).mtimeMs);v+=`+src.${Math.trunc(k)}`}catch{}return Pa=v,v}var Ja=new Map,Cr=new Map;async function Ed(v){let k;for(let E=0;E<3;E++)try{let j=(await Cn.promises.stat(v)).mtime.getTime(),B=Cr.get(v);if(B&&B.mtime===j)return B.content;let z=await Bun.file(v).text(),V=(await Cn.promises.stat(v)).mtime.getTime();if(V!==j)continue;return Cr.set(v,{content:z,mtime:V}),z}catch(T){k=T;break}throw Cr.delete(v),Error(`File not found: ${v}${k?` (${k.message})`:""}`)}function _d(v){Cr.delete(v)}function Td(v){for(let _ of Cr.keys())if(_.startsWith(v))Cr.delete(_)}var Ji=null,Ey=null,od=null;function Rd(v){od=v}async function Ya(v=!1){let _=od??await import("./chunk-9q3dbv0w.js");if(v)return _.generateSignalsRuntimeDev();if(Ji===null)Ji=_.generateSignalsRuntime();return Ji}var Yi=null;async function Za(){if(Yi===null){let{getRouterScript:v}=await import("./chunk-98gxw97n.js");Yi=v()}return Yi}var id={};async function Ad(v,_=!1){let k=v==="runtime"?await Ya(_):await Za(),E=v==="runtime"&&_?"runtime-debug":v,T=id[E];if(!T||T.content!==k)T={content:k,hash:Bun.hash(k).toString(16).padStart(16,"0").slice(0,16)},id[E]=T;return{content:k,hash:T.hash,url:`/_stx/${v}.${T.hash}.js`}}var Cy=500,kr=new Map;function ad(v){return a(process.cwd(),"module-bundles",`${v}.js`)}function Pd(v){let _=Bun.hash(v).toString(16).padStart(16,"0").slice(0,16),k=kr.has(_);if(k)kr.delete(_);kr.set(_,v);while(kr.size>Cy)kr.delete(kr.keys().next().value);if(!k)try{let E=ad(_);if(!Cn.existsSync(E))Cn.mkdirSync(Er.dirname(E),{recursive:!0}),Cn.writeFileSync(E,v)}catch{}return`/_stx/modules.${_}.js`}function Vo(v){if(!/^[0-9a-f]{16}$/.test(v))return;let _=kr.get(v);if(_!==void 0)return _;try{return Cn.readFileSync(ad(v),"utf8")}catch{return}}function Id(){Cr.clear(),ee(),Pu(),Ji=null,Ey=null,Yi=null}function cd(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 en(v,_){try{if(!_.cachePath)return null;let k=Er.resolve(_.cachePath),E=Er.join(k,`${Nn(v)}.html`),T=Er.join(k,`${Nn(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!==Me())return null;if(B.optionsSignature!==cd(_))return null;if((await Cn.promises.stat(v)).mtime.getTime()>B.mtime)return null;for(let F of B.dependencies)if(await r(F)){if((await Cn.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 tn(v,_,k,E){try{if(!E.cachePath)return;let T=Er.resolve(E.cachePath);await Cn.promises.mkdir(T,{recursive:!0});let j=Er.join(T,`${Nn(v)}.html`),B=Er.join(T,`${Nn(v)}.meta.json`),z=await Cn.promises.stat(v);await Bun.write(j,_);let F={sourcePath:v,mtime:z.mtime.getTime(),dependencies:Array.from(k),cacheVersion:E.cacheVersion,engine:Me(),optionsSignature:cd(E),generatedAt:Date.now()};await Bun.write(B,JSON.stringify(F,null,2)),Ja.set(v,{output:_,mtime:z.mtime.getTime(),dependencies:k})}catch(T){console.warn(`Failed to cache template ${v}:`,T)}}var Ry=16;function Nn(v){return new Bun.CryptoHasher("sha1").update(v).digest("hex").substring(0,Ry)}var Ln={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 Da(v){return`--stx-${v}`}function Ma(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 ld(v){let _={};for(let[k,E]of Object.entries(Ln)){let T=Ma(v,E.light);if(T===void 0)continue;_[k]=`var(${Da(k)}, ${T})`}return _}function ud(v){let _=[],k=[];for(let[E,T]of Object.entries(Ln)){let j=Ma(v,T.light),B=Ma(v,T.dark);if(j===void 0)continue;if(_.push(` ${Da(E)}: ${j};`),B!==void 0)k.push(` ${Da(E)}: ${B};`)}if(_.length===0)return"";return["/* stx role tokens \u2014 override any of these to re-theme by meaning. */",":root {",..._,"}",".dark {",...k,"}",""].join(`
858
+ `)}var dd={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 pd(v){return`--stx-radius-${v}`}function fd(){let v={};for(let[_,k]of Object.entries(dd))v[_]=`var(${pd(_)}, ${k.value})`;return v}function gd(){return["/* stx shape tokens \u2014 a radius by what the thing is. */",":root {",...Object.entries(dd).map(([v,_])=>` ${pd(v)}: ${_.value};`),"}",""].join(`
859
+ `)}var md={"control-px":{value:"1rem",description:"Inline padding of a md text control \u2014 px-4"},"control-py":{value:"0.5rem",description:"Block padding of a md text control \u2014 py-2"},"control-text":{value:"1rem",description:"Font size of a md text control \u2014 text-base"},"control-leading":{value:"1.5rem",description:"Line height of a md text control \u2014 text-base"},"cell-px":{value:"1.5rem",description:"Inline padding of every table cell, header or body \u2014 px-6"},"cell-py":{value:"1rem",description:"Block padding of a body cell \u2014 py-4"},"cell-text":{value:"0.875rem",description:"Font size of a body cell \u2014 text-sm"},"cell-leading":{value:"1.25rem",description:"Line height of a body cell \u2014 text-sm"},"cell-head-py":{value:"0.75rem",description:"Block padding of a header cell \u2014 py-3"},"cell-head-text":{value:"0.75rem",description:"Font size of a header cell \u2014 text-xs"},"cell-head-leading":{value:"1rem",description:"Line height of a header cell \u2014 text-xs"}},Ty={"control-x":"control-px","control-y":"control-py","cell-x":"cell-px","cell-y":"cell-py","cell-head-y":"cell-head-py"},Ay={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 hd(v){return`--stx-${v}`}function Oa(v){let _=md[v];if(!_)throw Error(`[stx] unknown density token "${v}"`);return`var(${hd(v)}, ${_.value})`}function yd(){let v={};for(let[_,k]of Object.entries(Ty))v[_]=Oa(k);return v}function bd(){let v={};for(let[_,{size:k,leading:E}]of Object.entries(Ay))v[_]=[Oa(k),{lineHeight:Oa(E)}];return v}function wd(){return["/* stx density tokens \u2014 how much room a control or a table cell takes. */",":root {",...Object.entries(md).map(([v,_])=>` ${hd(v)}: ${_.value};`),"}",""].join(`
860
+ `)}function Wd(v){return typeof v==="object"&&v!==null&&!Array.isArray(v)}function Na(v,_){let k={...v};for(let[E,T]of Object.entries(_))k[E]=Wd(T)&&Wd(k[E])?Na(k[E],T):T;return k}function Ud(v,_){if(!_.fonts)return"";let k=new v({..._.config,fonts:_.fonts,cssVariables:!1}).toCSS(!1,_.minify);return k&&!_.minify?`${k}
861
+ `:k}function qd(v={},_={}){let k=v.theme||{},E=_.theme||{},{extend:T,...j}=E,{extend:B,...z}=k,F=z.colors||{};z.colors={...F,...ld(F)};let V=z.borderRadius||{};z.borderRadius={...V,...fd()};let H=z.spacing||{};z.spacing={...H,...yd()};let G=z.fontSize||{};z.fontSize={...G,...bd()};let J=Na(z,j),ne=Na(B||{},T||{});if(Object.keys(ne).length>0)J.extend=ne;let re=[...v.safelist||[],..._.safelist||[]],se={...v.shortcuts||{},..._.shortcuts||{}},ie=[...v.preflights||[],..._.preflights||[]],{fonts:oe,...ue}=v,{fonts:ae,...me}=_,ve=ae??oe;return{config:{...ue,...me,theme:J,safelist:re,shortcuts:se,...ie.length>0?{preflights:ie}:{},content:[],output:""},safelist:re,shortcuts:se,includePreflight:_.preflight!==!1,minify:_.minify===!0,tokenCSS:ud(F)+gd()+wd(),...ve?{fonts:ve}:{}}}function Kd(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 Xd(v,_,k={}){let{prefix:E="",preserveHost:T=!0,scopeKeyframes:j=!0,scopeCustomProperties:B=!1}=k;if(!v.trim())return"";let z=ja(v),F=[],V=new Map;if(j)for(let H of z){let G=H.selector.match(/@keyframes\s+([a-z_-][a-z0-9_-]*)/i);if(G){let J=G[1],ne=`${_}_${J}`;V.set(J,ne)}}for(let H of z){let G=Zd(H,_,E,T,V,B);F.push(G)}return F.join(`
862
+
863
+ `)}function ja(v){let _=[],k=v.replace(/\/\*[\s\S]*?\*\//g,""),E=0,T="",j=!1,B="";for(let z=0;z<k.length;z++){let F=k[z];if(F==="@"&&E===0)j=!0;if(F==="{")E++;else if(F==="}"){if(E--,E===0){if(j){B+=F;let V=B.match(/@([a-z-]+)\s*([^{]*)\{([\s\S]*)\}/i);if(V){let[,H,G,J]=V;if(H==="keyframes")_.push({selector:`@keyframes ${G.trim()}`,declarations:J.trim()});else if(H==="media"||H==="supports"||H==="container"){let ne=ja(J);_.push({selector:`@${H} ${G.trim()}`,declarations:ne.map((re)=>`${re.selector} { ${re.declarations} }`).join(`
864
+ `)})}else _.push({selector:`@${H} ${G.trim()}`,declarations:J.trim()})}B="",j=!1}else if(T.trim()){T+=F;let V=T.match(/([^{]+)\{([^}]*)\}/);if(V)_.push({selector:V[1].trim(),declarations:V[2].trim()});T=""}continue}}if(j)B+=F;else T+=F}return _}function Zd(v,_,k,E,T,j){let{selector:B,declarations:z}=v;if(B.startsWith("@")){if(B.startsWith("@keyframes")){let H=B.replace("@keyframes ","").trim();return`@keyframes ${T.get(H)||H} { ${z} }`}if(B.startsWith("@media")||B.startsWith("@supports")||B.startsWith("@container")){let G=ja(`x { ${z} }`.replace(/x \{ /,"").replace(/ \}$/,"")).map((J)=>Zd(J,_,k,E,T,j)).join(`
865
865
  `);return`${B} {
866
866
  ${G}
867
- }`}return`${B} { ${z} }`}let F=Ry(B,_,k,E),V=z;for(let[H,G]of T)V=V.replace(new RegExp(`\\b${H}\\b`,"g"),G);if(j)V=V.replace(/--([a-z-]+)/gi,`--${_}-$1`);return`${F} { ${V} }`}function Ry(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=Ty(B,_);if(F)j.push(k?`${k} ${F}`:F)}return j.join(", ")}function Ty(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 Jd=String.raw`(?<![\w-])scoped(?![\w-])`,ja=/<style\s+([^>]*)>/gi,Zd=/<style\s+([^>]*)>([\s\S]*?)<\/style>/gi,Yd=new RegExp(Jd,"i"),Ay=new RegExp(Jd,"gi"),La=/<style\b[^>]*\bdata-stx-scoped(?:=(?:"[^"]*"|'[^']*'|[^\s>]+))?[^>]*>[\s\S]*?<\/style>\s*/gi;function Iy(v){ja.lastIndex=0;let _=ja.exec(v);while(_!==null){if(Yd.test(_[1]))return!0;_=ja.exec(v)}return!1}function Ba(v){let _=new Set,k=[];La.lastIndex=0;let E=La.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=La.exec(v)}return k}function Xs(v){let _=Ba(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 Qi(v,_){if(!Iy(v))return{html:v,hasScoped:!1};let k=qd(_),E=`data-v-${k}`,T=v,j=!1;if(Zd.lastIndex=0,T=T.replace(Zd,(B,z,F)=>{if(!Yd.test(z))return B;j=!0;let V=Py(F,E),H=z.replace(Ay,"").trim(),G=H?` ${H}`:"";return`<style data-stx-scoped="${k}"${G}>${V}</style>`}),!j)return{html:v,hasScoped:!1};return T=My(T,E),{html:T,hasScoped:!0}}function Py(v,_){return Kd(v,"__SCOPE_PLACEHOLDER__",{preserveHost:!1}).replace(/\.(__SCOPE_PLACEHOLDER__) /g,`[${_}] `).replace(/\.(__SCOPE_PLACEHOLDER__)/g,`[${_}]`)}var Dy=(v)=>`\x00stx-scope-mask-${v}\x00`,Gd=/\u0000stx-scope-mask-(\d+)\u0000/g;function My(v,_){let k=En(v,(T,j)=>{let B=Y(T,j);return B>j?B:Ur(T,j)},(T,j)=>Dy(j)),E=Oy(k.output,_);return Gd.lastIndex=0,E.replace(Gd,(T,j)=>k.tokens[Number(j)])}function Oy(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 Rn=null,Fa=!1,Rr=null,Zs="",qr=!1,np=256,gr=new Map,Tn=new Map,eo=null,rp=null,to=new Map;function no(v){return Bun.hash(v).toString(16).padStart(16,"0").slice(0,16)}function za(v,_){if(gr.has(v))gr.delete(v);else if(gr.size>=np)gr.delete(gr.keys().next().value);gr.set(v,_)}function Ny(v){let _=no(v);if(Tn.has(_))Tn.delete(_);else if(Tn.size>=np)Tn.delete(Tn.keys().next().value);return Tn.set(_,v),_}function Du(v){let _=Tn.get(v);if(_===void 0)return;return Tn.delete(v),Tn.set(v,_),_}async function jy(v,_=eo){if(!_)return null;try{let k=Bun.file(It.join(_,`cw-${no(v)}.css`));if(!await k.exists())return null;return await k.text()}catch{return null}}async function Ly(v,_,k=eo){if(!k)return;try{if(!fs.existsSync(k))fs.mkdirSync(k,{recursive:!0});await Bun.write(It.join(k,`cw-${no(v)}.css`),_)}catch{}}async function ep(v){try{let _=await import(v);if(_&&_.CSSGenerator)return{CSSGenerator:_.CSSGenerator,config:_.config,build:_.build,defaultConfig:_.defaultConfig,extractClasses:_.extractClasses}}catch{}return null}var By=[["@stacksjs","ts-css","dist","engine","index.js"],["@stacksjs","ts-css","src","engine","index.ts"]],zy=["@stacksjs/ts-css/engine","@stacksjs/ts-css/dist/engine/index.js"];function Fy(){let v=[],_=process.cwd();while(_!==It.dirname(_)){for(let k of["node_modules","pantry"])for(let E of By)v.push(It.join(_,k,...E));_=It.dirname(_)}return v}function Vy(){let v=[],_=process.env.HOME||process.env.USERPROFILE||"",k=[_&&It.join(_,"Code","Tools","ts-css"),_&&It.join(_,"Code","Tools","crosswind"),_&&It.join(_,"repos","stacks-org","ts-css"),_&&It.join(_,"repos","stacks-org","crosswind"),It.join(process.cwd(),"..","ts-css"),It.join(process.cwd(),"..","crosswind")].filter(Boolean);for(let E of k)v.push(It.join(E,"packages","toolkit","dist","engine","index.js")),v.push(It.join(E,"packages","toolkit","src","engine","index.ts"));if(_)v.push(It.join(_,"Code","Tools","stx","node_modules","@stacksjs","ts-css","dist","engine","index.js"));return v}async function Uo(){if(Fa)return Rn;Fa=!0;try{let v=async(T)=>{for(let j of T){if(!await Bun.file(j).exists())continue;let B=await ep(j);if(B){if(!process.env.STACKS_DEV_QUIET)console.log(`${e.green}[ts-css]${e.reset} CSS engine loaded from ${It.dirname(It.dirname(j))}`);return B}}return null};if(process.env.CROSSWIND_SRC){let T=It.resolve(process.env.CROSSWIND_SRC),j=await v([T]);if(!j)throw Error(`CROSSWIND_SRC did not resolve to a Css module: ${T}`);return Rn=j,Rn}let _=await v(Fy());if(_)return Rn=_,Rn;let k=zy;for(let T of k){let j=await ep(T);if(j){if(Rn=j,!process.env.STACKS_DEV_QUIET)console.log(`${e.green}[ts-css]${e.reset} CSS engine loaded`);return Rn}}let E=await v(Vy());if(E)return Rn=E,Rn;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 Ou(){Ha.clear(),Rn=null,Fa=!1,Rr=null,Zs="",gr.clear(),Tn.clear(),rp=null,to.clear()}var tp=!1;async function Wo(v){try{let _=Qd({name:"css",cwd:v})?"css":Qd({name:"crosswind",cwd:v})?"crosswind":null;if(!_)return null;if(_==="crosswind"&&!process.env.STACKS_DEV_QUIET&&!tp)tp=!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=It.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 Qa(v){let _=null;try{let{loadStxConfig:k}=await import("./chunk-9h1kq4hv.js"),E=await k(v);if(E.css)if(typeof E.css==="string"){let T=It.isAbsolute(E.css)?E.css:It.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=It.isAbsolute(E.css.config)?E.css.config:It.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 Wo(v)}function ec(v){try{let _=new WeakSet;return no(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 xt(v){if(qr)return Zs;qr=!0;try{let _=await Uo();if(!_||!_.build)return qr=!1,"";if(!Rr)Rr=await Wo(v);if(!Rr)return qr=!1,"";let k=_.defaultConfig?.theme||{},E=Rr.theme||{},T={..._.defaultConfig,...Rr,theme:{...k,...E,extend:{...k.extend||{},...E.extend||{}}}},j=performance.now(),B=await _.build(T),z=performance.now()-j;if(Zs=B.css,console.log(`${e.cyan}[ts-css]${e.reset} Built ${B.classes.size} classes in ${z.toFixed(1)}ms`),T.output){let F=It.isAbsolute(T.output)?T.output:It.join(v,T.output),V=It.dirname(F);if(!fs.existsSync(V))fs.mkdirSync(V,{recursive:!0});await Bun.write(F,B.css)}return qr=!1,B.css}catch(_){return console.error(`${e.red}[ts-css]${e.reset} Build error:`,_),qr=!1,Zs}}async function nn(v){Rr=null,await xt(v)}function Mu(){return Zs}function tc(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 Ha=m(64);async function nc(v,_){let k=()=>to.get(_?It.resolve(_):process.cwd())?.fingerprint??null,E=Ha.get(h(v,_,k()));if(E!==void 0)return E;let T=await Wy(v,_);if(T)Ha.set(h(v,_,k()),T);return T}function rc(v){let _=[];for(let k of v.matchAll(/\/_stx\/modules\.([0-9a-f]{16})\.js/g)){let E=Vo(k[1]);if(E)_.push(E)}return _.length?`${v}
867
+ }`}return`${B} { ${z} }`}let F=Iy(B,_,k,E),V=z;for(let[H,G]of T)V=V.replace(new RegExp(`\\b${H}\\b`,"g"),G);if(j)V=V.replace(/--([a-z-]+)/gi,`--${_}-$1`);return`${F} { ${V} }`}function Iy(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=Py(B,_);if(F)j.push(k?`${k} ${F}`:F)}return j.join(", ")}function Py(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 Yd=String.raw`(?<![\w-])scoped(?![\w-])`,La=/<style\s+([^>]*)>/gi,Gd=/<style\s+([^>]*)>([\s\S]*?)<\/style>/gi,Qd=new RegExp(Yd,"i"),Dy=new RegExp(Yd,"gi"),Ba=/<style\b[^>]*\bdata-stx-scoped(?:=(?:"[^"]*"|'[^']*'|[^\s>]+))?[^>]*>[\s\S]*?<\/style>\s*/gi;function My(v){La.lastIndex=0;let _=La.exec(v);while(_!==null){if(Qd.test(_[1]))return!0;_=La.exec(v)}return!1}function za(v){let _=new Set,k=[];Ba.lastIndex=0;let E=Ba.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=Ba.exec(v)}return k}function Ks(v){let _=za(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 Qi(v,_){if(!My(v))return{html:v,hasScoped:!1};let k=Kd(_),E=`data-v-${k}`,T=v,j=!1;if(Gd.lastIndex=0,T=T.replace(Gd,(B,z,F)=>{if(!Qd.test(z))return B;j=!0;let V=Oy(F,E),H=z.replace(Dy,"").trim(),G=H?` ${H}`:"";return`<style data-stx-scoped="${k}"${G}>${V}</style>`}),!j)return{html:v,hasScoped:!1};return T=jy(T,E),{html:T,hasScoped:!0}}function Oy(v,_){return Xd(v,"__SCOPE_PLACEHOLDER__",{preserveHost:!1}).replace(/\.(__SCOPE_PLACEHOLDER__) /g,`[${_}] `).replace(/\.(__SCOPE_PLACEHOLDER__)/g,`[${_}]`)}var Ny=(v)=>`\x00stx-scope-mask-${v}\x00`,Jd=/\u0000stx-scope-mask-(\d+)\u0000/g;function jy(v,_){let k=En(v,(T,j)=>{let B=Y(T,j);return B>j?B:Ur(T,j)},(T,j)=>Ny(j)),E=Ly(k.output,_);return Jd.lastIndex=0,E.replace(Jd,(T,j)=>k.tokens[Number(j)])}function Ly(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 Rn=null,eo="";function tp(v){try{let _=v.startsWith("file:")?new URL(v).pathname:v;eo=`${_}@${Math.trunc(Zs.statSync(_).mtimeMs)}`}catch{eo=v}}var Ha=!1,Rr=null,Xs="",qr=!1,sp=256,gr=new Map,Tn=new Map,to=null,ip=null,no=new Map;function ro(v){return Bun.hash(v).toString(16).padStart(16,"0").slice(0,16)}function Fa(v,_){if(gr.has(v))gr.delete(v);else if(gr.size>=sp)gr.delete(gr.keys().next().value);gr.set(v,_)}function By(v){let _=ro(v);if(Tn.has(_))Tn.delete(_);else if(Tn.size>=sp)Tn.delete(Tn.keys().next().value);return Tn.set(_,v),_}function Dd(v){let _=Tn.get(v);if(_===void 0)return;return Tn.delete(v),Tn.set(v,_),_}async function zy(v,_=to){if(!_)return null;try{let k=Bun.file(It.join(_,`cw-${ro(v)}.css`));if(!await k.exists())return null;return await k.text()}catch{return null}}async function Fy(v,_,k=to){if(!k)return;try{if(!Zs.existsSync(k))Zs.mkdirSync(k,{recursive:!0});await Bun.write(It.join(k,`cw-${ro(v)}.css`),_)}catch{}}async function np(v){try{let _=await import(v);if(_&&_.CSSGenerator)return{CSSGenerator:_.CSSGenerator,config:_.config,build:_.build,defaultConfig:_.defaultConfig,extractClasses:_.extractClasses}}catch{}return null}var Vy=[["@stacksjs","ts-css","dist","engine","index.js"],["@stacksjs","ts-css","src","engine","index.ts"]],Wy=["@stacksjs/ts-css/engine","@stacksjs/ts-css/dist/engine/index.js"];function Uy(){let v=[],_=process.cwd();while(_!==It.dirname(_)){for(let k of["node_modules","pantry"])for(let E of Vy)v.push(It.join(_,k,...E));_=It.dirname(_)}return v}function Hy(){let v=[],_=process.env.HOME||process.env.USERPROFILE||"",k=[_&&It.join(_,"Code","Tools","ts-css"),_&&It.join(_,"Code","Tools","crosswind"),_&&It.join(_,"repos","stacks-org","ts-css"),_&&It.join(_,"repos","stacks-org","crosswind"),It.join(process.cwd(),"..","ts-css"),It.join(process.cwd(),"..","crosswind")].filter(Boolean);for(let E of k)v.push(It.join(E,"packages","toolkit","dist","engine","index.js")),v.push(It.join(E,"packages","toolkit","src","engine","index.ts"));if(_)v.push(It.join(_,"Code","Tools","stx","node_modules","@stacksjs","ts-css","dist","engine","index.js"));return v}async function Uo(){if(Ha)return Rn;Ha=!0;try{let v=async(T)=>{for(let j of T){if(!await Bun.file(j).exists())continue;let B=await np(j);if(B){if(tp(j),!process.env.STACKS_DEV_QUIET)console.log(`${e.green}[ts-css]${e.reset} CSS engine loaded from ${It.dirname(It.dirname(j))}`);return B}}return null};if(process.env.CROSSWIND_SRC){let T=It.resolve(process.env.CROSSWIND_SRC),j=await v([T]);if(!j)throw Error(`CROSSWIND_SRC did not resolve to a Css module: ${T}`);return Rn=j,Rn}let _=await v(Uy());if(_)return Rn=_,Rn;let k=Wy;for(let T of k){let j=await np(T);if(j){Rn=j;try{tp(import.meta.resolve(T))}catch{eo=T}if(!process.env.STACKS_DEV_QUIET)console.log(`${e.green}[ts-css]${e.reset} CSS engine loaded`);return Rn}}let E=await v(Hy());if(E)return Rn=E,Rn;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 Od(){Rc.clear(),Rn=null,Ha=!1,Rr=null,Xs="",gr.clear(),Tn.clear(),ip=null,no.clear()}var rp=!1;async function Wo(v){try{let _=ep({name:"css",cwd:v})?"css":ep({name:"crosswind",cwd:v})?"crosswind":null;if(!_)return null;if(_==="crosswind"&&!process.env.STACKS_DEV_QUIET&&!rp)rp=!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=It.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 Qa(v){let _=null;try{let{loadStxConfig:k}=await import("./chunk-gzk5ak8f.js"),E=await k(v);if(E.css)if(typeof E.css==="string"){let T=It.isAbsolute(E.css)?E.css:It.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=It.isAbsolute(E.css.config)?E.css.config:It.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 Wo(v)}function ec(v){try{let _=new WeakSet;return ro(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 xt(v){if(qr)return Xs;qr=!0;try{let _=await Uo();if(!_||!_.build)return qr=!1,"";if(!Rr)Rr=await Wo(v);if(!Rr)return qr=!1,"";let k=_.defaultConfig?.theme||{},E=Rr.theme||{},T={..._.defaultConfig,...Rr,theme:{...k,...E,extend:{...k.extend||{},...E.extend||{}}}},j=performance.now(),B=await _.build(T),z=performance.now()-j;if(Xs=B.css,console.log(`${e.cyan}[ts-css]${e.reset} Built ${B.classes.size} classes in ${z.toFixed(1)}ms`),T.output){let F=It.isAbsolute(T.output)?T.output:It.join(v,T.output),V=It.dirname(F);if(!Zs.existsSync(V))Zs.mkdirSync(V,{recursive:!0});await Bun.write(F,B.css)}return qr=!1,B.css}catch(_){return console.error(`${e.red}[ts-css]${e.reset} Build error:`,_),qr=!1,Xs}}async function nn(v){Rr=null,await xt(v)}function Md(){return Xs}function tc(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 Rc=m(64);async function nc(v,_){let k=()=>no.get(_?It.resolve(_):process.cwd())?.fingerprint??null,E=Rc.get(h(v,_,k()));if(E!==void 0)return E;let T=await qy(v,_);if(T)Rc.set(h(v,_,k()),T);return T}function rc(v){let _=[];for(let k of v.matchAll(/\/_stx\/modules\.([0-9a-f]{16})\.js/g)){let E=Vo(k[1]);if(E)_.push(E)}return _.length?`${v}
868
868
  ${_.join(`
869
- `)}`:v}async function Wy(v,_){try{let k=await Uo();if(!k)return"";let E=rc(v),T=typeof k.extractClasses==="function"?k.extractClasses(E):tc(E);if(T.size===0)return"";let j=_?It.resolve(_):process.cwd(),B=a(j,"cache");if(!eo)eo=B;let z=to.get(j);if(!z){let Ee=await Qa(j);z={config:Ee,fingerprint:ec(Ee)},to.set(j,z),rp=z.fingerprint}let F=[...T].sort().join(" "),V=`${z.fingerprint||"default"}::${F}`,H=gr.get(V);if(H!==void 0)return za(V,H),H;let G=await jy(V,B);if(G!==null)return za(V,G),G;let J=k.defaultConfig||k.config,ne=z.config||{},re=Hd(J,ne),{safelist:se,includePreflight:ie,minify:oe,tokenCSS:de}=re,ae=re.config,me=new k.CSSGenerator(ae),ve=ae.shortcuts||ne.shortcuts||{},Se=Object.keys(ve).filter((Ee)=>T.has(Ee)||se.includes(Ee));for(let Ee of se)if(!ve[Ee])me.generate(Ee);for(let Ee of T)if(!ve[Ee])me.generate(Ee);let $e="";if(Se.length>0){let Ee=new k.CSSGenerator(ae);for(let Te of Se)Ee.generate(Te);if($e=Ee.toCSS(!1,oe),$e&&!$e.endsWith(`
869
+ `)}`:v}async function qy(v,_){try{let k=await Uo();if(!k)return"";let E=rc(v),T=typeof k.extractClasses==="function"?k.extractClasses(E):tc(E);if(T.size===0)return"";let j=_?It.resolve(_):process.cwd(),B=a(j,"cache");if(!to)to=B;let z=no.get(j);if(!z){let Ee=await Qa(j);z={config:Ee,fingerprint:ec(Ee)},no.set(j,z),ip=z.fingerprint}let F=[...T].sort().join(" "),V=`${eo}::${z.fingerprint||"default"}::${F}`,H=gr.get(V);if(H!==void 0)return Fa(V,H),H;let G=await zy(V,B);if(G!==null)return Fa(V,G),G;let J=k.defaultConfig||k.config,ne=z.config||{},re=qd(J,ne),{safelist:se,includePreflight:ie,minify:oe,tokenCSS:ue}=re,ae=re.config,me=new k.CSSGenerator(ae),ve=ae.shortcuts||ne.shortcuts||{},Se=Object.keys(ve).filter((Ee)=>T.has(Ee)||se.includes(Ee));for(let Ee of se)if(!ve[Ee])me.generate(Ee);for(let Ee of T)if(!ve[Ee])me.generate(Ee);let $e="";if(Se.length>0){let Ee=new k.CSSGenerator(ae);for(let Te of Se)Ee.generate(Te);if($e=Ee.toCSS(!1,oe),$e&&!$e.endsWith(`
870
870
  `))$e+=`
871
- `}let Ce=$e+me.toCSS(ie,oe);return Ce=Ud(k.CSSGenerator,re)+de+Ce,za(V,Ce),Ly(V,Ce,B),Ce}catch(k){return console.warn("Failed to generate Css CSS:",k),""}}async function f(v,_,k=!1,E=!1){let T=await nc(v,_);if(!T)return E?Xs(v):v;let j=k?`<link data-css="generated" rel="stylesheet" href="/_stx/css.${Ny(T)}.css">`:`<style data-css="generated">
871
+ `}let Ce=$e+me.toCSS(ie,oe);return Ce=Ud(k.CSSGenerator,re)+ue+Ce,Fa(V,Ce),Fy(V,Ce,B),Ce}catch(k){return console.warn("Failed to generate Css CSS:",k),""}}async function f(v,_,k=!1,E=!1){let T=await nc(v,_);if(!T)return E?Ks(v):v;let j=k?`<link data-css="generated" rel="stylesheet" href="/_stx/css.${By(T)}.css">`:`<style data-css="generated">
872
872
  ${T}
873
- </style>`;if(E)return Uy(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}
873
+ </style>`;if(E)return Ky(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}
874
874
  </head>`);if(v.includes("<body"))return v.replace(/<body([^>]*)>/,`<body$1>
875
- ${j}`);return j+v}function Uy(v,_){let k=Ba(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:`${_}
875
+ ${j}`);return j+v}function Ky(v,_){let k=za(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:`${_}
876
876
  `});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]}
877
- ${_}`});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 Hy(Xs(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 Hy(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>",`${_}
877
+ ${_}`});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 Xy(Ks(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 Xy(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>",`${_}
878
878
  </head>`);if(v.includes("<body"))return v.replace(/<body([^>]*)>/,`<body$1>
879
- ${_}`);return _+v}var Rc=[{open:/<!--/g,close:/-->/g},{open:/<script\b/gi,close:/<\/script\s*>/gi},{open:/<style\b/gi,close:/<\/style\s*>/gi}],sp=/<body\b([^>]*)>/gi;function An(v){let _=0,k,E=Rc.map(()=>{return});while(_<v.length){if(k===void 0||k!==null&&k.index<_)sp.lastIndex=_,k=sp.exec(v);if(!k)return null;let T=k.index,j=-1,B=null;for(let F=0;F<Rc.length;F++){let V=Rc[F],H=E[F];if(H===void 0||H!==null&&H.index<_)V.open.lastIndex=_,H=V.open.exec(v),E[F]=H;if(!H)continue;if(H.index<T&&(j===-1||H.index<j))j=H.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 vs(v,_){let k=An(v);if(!k)return v;return v.slice(0,k.index)+_(k.tag,k.attrs)+v.slice(k.index+k.tag.length)}var ip=/<style\b[^>]*>/iy,op=/<\/style>/gi,ap=/<script\b[^>]*>/iy,cp=/<template(?=[\s>/])[^>]*>/iy,lp=/<\/template\s*>/iy;function Gs(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}ip.lastIndex=T;let j=ip.exec(v);if(j){op.lastIndex=T+j[0].length;let F=op.exec(v);_=F===null?v.length:F.index+8;continue}cp.lastIndex=T;let B=cp.exec(v);if(B){if(k===0)E=T;k++,_=T+B[0].length;continue}lp.lastIndex=T;let z=lp.exec(v);if(z){if(k>0)k--;_=T+z[0].length;continue}if(ap.lastIndex=T,ap.test(v))return k>0?E:T;_=T+1}return-1}function up(){return`
879
+ ${_}`);return _+v}var Tc=[{open:/<!--/g,close:/-->/g},{open:/<script\b/gi,close:/<\/script\s*>/gi},{open:/<style\b/gi,close:/<\/style\s*>/gi}],op=/<body\b([^>]*)>/gi;function An(v){let _=0,k,E=Tc.map(()=>{return});while(_<v.length){if(k===void 0||k!==null&&k.index<_)op.lastIndex=_,k=op.exec(v);if(!k)return null;let T=k.index,j=-1,B=null;for(let F=0;F<Tc.length;F++){let V=Tc[F],H=E[F];if(H===void 0||H!==null&&H.index<_)V.open.lastIndex=_,H=V.open.exec(v),E[F]=H;if(!H)continue;if(H.index<T&&(j===-1||H.index<j))j=H.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 fs(v,_){let k=An(v);if(!k)return v;return v.slice(0,k.index)+_(k.tag,k.attrs)+v.slice(k.index+k.tag.length)}var ap=/<style\b[^>]*>/iy,cp=/<\/style>/gi,lp=/<script\b[^>]*>/iy,up=/<template(?=[\s>/])[^>]*>/iy,dp=/<\/template\s*>/iy;function Gs(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}ap.lastIndex=T;let j=ap.exec(v);if(j){cp.lastIndex=T+j[0].length;let F=cp.exec(v);_=F===null?v.length:F.index+8;continue}up.lastIndex=T;let B=up.exec(v);if(B){if(k===0)E=T;k++,_=T+B[0].length;continue}dp.lastIndex=T;let z=dp.exec(v);if(z){if(k>0)k--;_=T+z[0].length;continue}if(lp.lastIndex=T,lp.test(v))return k>0?E:T;_=T+1}return-1}function pp(){return`
880
880
  // STX Lifecycle Runtime
881
881
  (function() {
882
882
  if (typeof window === 'undefined') return;
@@ -1224,7 +1224,7 @@ else {
1224
1224
 
1225
1225
  console.log('[stx] Lifecycle runtime initialized');
1226
1226
  })();
1227
- `}function Tc(v){return Symbol(v)}var u_=Tc("theme"),d_=Tc("router"),p_=Tc("i18n");import*as pp from"crypto";function dp(v){let _=/\$(\w+)\./g,k=[],E;while((E=_.exec(v))!==null)if(!k.includes(E[1]))k.push(E[1]);return k}function qy(){return`stx-${pp.randomBytes(4).toString("hex")}`}function Ky(v){return/\$\w+\./.test(v)}function Xy(v){if(!v.includes("{{")||!/\$\w+\./.test(v))return{html:v,bindings:[],stores:new Set};let _=[],k=new Set,E=/<(\w+)([^>]*?)(\s*\/?>)/g,T=v;return T=T.replace(E,(j,B,z,F)=>{if(["script","style","template"].includes(B.toLowerCase()))return j;let V=[],H=!1,G=z,J=/(\w+(?:-\w+)*)\s*=\s*"([^"]*\{\{[^}]*\$\w+[^}]*\}\}[^"]*)"/g,ne=[...z.matchAll(J)];for(let ie of ne){let oe=ie[0],de=ie[1],ae=ie[2];if(Ky(ae)){H=!0;let me=ae.match(/\{\{\s*([\s\S]+?)\s*\}\}/);if(me){let ve=me[1];if(V.push({attr:de,expr:ve,fullMatch:oe,originalAttr:de}),dp(ve).forEach(($e)=>k.add($e)),de==="text")G=G.replace(oe,"");else if(de==="class")G=G.replace(oe,'class=""');else if(de==="disabled"||de==="hidden")G=G.replace(oe,"");else G=G.replace(oe,`${de}=""`)}}}if(!H)return j;let re=G.match(/\bid\s*=\s*"([^"]+)"/),se;if(re)se=re[1];else se=qy(),G=` id="${se}"${G}`;for(let ie of V)_.push({elementId:se,attribute:ie.attr,expression:ie.expr,stores:dp(ie.expr)});return`<${B}${G}${F}`}),{html:T,bindings:_,stores:k}}function Zy(v,_){if(v.length===0)return"";let k=Array.from(_),E=`
1227
+ `}function Ac(v){return Symbol(v)}var f_=Ac("theme"),g_=Ac("router"),m_=Ac("i18n");import*as gp from"crypto";function fp(v){let _=/\$(\w+)\./g,k=[],E;while((E=_.exec(v))!==null)if(!k.includes(E[1]))k.push(E[1]);return k}function Zy(){return`stx-${gp.randomBytes(4).toString("hex")}`}function Gy(v){return/\$\w+\./.test(v)}function Jy(v){if(!v.includes("{{")||!/\$\w+\./.test(v))return{html:v,bindings:[],stores:new Set};let _=[],k=new Set,E=/<(\w+)([^>]*?)(\s*\/?>)/g,T=v;return T=T.replace(E,(j,B,z,F)=>{if(["script","style","template"].includes(B.toLowerCase()))return j;let V=[],H=!1,G=z,J=/(\w+(?:-\w+)*)\s*=\s*"([^"]*\{\{[^}]*\$\w+[^}]*\}\}[^"]*)"/g,ne=[...z.matchAll(J)];for(let ie of ne){let oe=ie[0],ue=ie[1],ae=ie[2];if(Gy(ae)){H=!0;let me=ae.match(/\{\{\s*([\s\S]+?)\s*\}\}/);if(me){let ve=me[1];if(V.push({attr:ue,expr:ve,fullMatch:oe,originalAttr:ue}),fp(ve).forEach(($e)=>k.add($e)),ue==="text")G=G.replace(oe,"");else if(ue==="class")G=G.replace(oe,'class=""');else if(ue==="disabled"||ue==="hidden")G=G.replace(oe,"");else G=G.replace(oe,`${ue}=""`)}}}if(!H)return j;let re=G.match(/\bid\s*=\s*"([^"]+)"/),se;if(re)se=re[1];else se=Zy(),G=` id="${se}"${G}`;for(let ie of V)_.push({elementId:se,attribute:ie.attr,expression:ie.expr,stores:fp(ie.expr)});return`<${B}${G}${F}`}),{html:T,bindings:_,stores:k}}function Yy(v,_){if(v.length===0)return"";let k=Array.from(_),E=`
1228
1228
  <script>
1229
1229
  (function() {
1230
1230
  'use strict';
@@ -1382,10 +1382,10 @@ else {
1382
1382
  }
1383
1383
  })();
1384
1384
  </script>
1385
- `,E}function fp(v){let{html:_,bindings:k,stores:E}=Xy(v);if(k.length===0)return v;let T=Zy(k,E),j=_.lastIndexOf("</body>");if(j!==-1)return _.slice(0,j)+T+_.slice(j);return _+T}function Gy(v){let _=v.analytics;if(!_?.enabled)return"";switch(_.driver){case"fathom":return Jy(_);case"google-analytics":return Yy(_);case"plausible":return Qy(_);case"self-hosted":return ex(_);case"custom":return tx(_);default:return""}}function Jy(v){let _=v.fathom;if(!_?.siteId)return"";let k=_.scriptUrl||"https://cdn.usefathom.com/script.js",E=_.defer!==!1?" defer":"",T=[`data-site="${pn(_.siteId)}"`];if(_.honorDnt)T.push('data-honor-dnt="true"');if(_.spa)T.push('data-spa="auto"');if(_.canonical)T.push(`data-canonical="${pn(_.canonical)}"`);if(_.auto===!1)T.push('data-auto="false"');return`
1385
+ `,E}function mp(v){let{html:_,bindings:k,stores:E}=Jy(v);if(k.length===0)return v;let T=Yy(k,E),j=_.lastIndexOf("</body>");if(j!==-1)return _.slice(0,j)+T+_.slice(j);return _+T}function Qy(v){let _=v.analytics;if(!_?.enabled)return"";switch(_.driver){case"fathom":return ex(_);case"google-analytics":return tx(_);case"plausible":return nx(_);case"self-hosted":return rx(_);case"custom":return sx(_);default:return""}}function ex(v){let _=v.fathom;if(!_?.siteId)return"";let k=_.scriptUrl||"https://cdn.usefathom.com/script.js",E=_.defer!==!1?" defer":"",T=[`data-site="${pn(_.siteId)}"`];if(_.honorDnt)T.push('data-honor-dnt="true"');if(_.spa)T.push('data-spa="auto"');if(_.canonical)T.push(`data-canonical="${pn(_.canonical)}"`);if(_.auto===!1)T.push('data-auto="false"');return`
1386
1386
  <!-- Fathom Analytics -->
1387
1387
  <script src="${pn(k)}" ${T.join(" ")}${E}></script>
1388
- `}function Yy(v){let _=v.googleAnalytics;if(!_?.measurementId)return"";let k=pn(_.measurementId),E=_.debug?`gtag('config', '${k}', { 'debug_mode': true });`:"";return`
1388
+ `}function tx(v){let _=v.googleAnalytics;if(!_?.measurementId)return"";let k=pn(_.measurementId),E=_.debug?`gtag('config', '${k}', { 'debug_mode': true });`:"";return`
1389
1389
  <!-- Google Analytics -->
1390
1390
  <script async src="https://www.googletagmanager.com/gtag/js?id=${k}"></script>
1391
1391
  <script>
@@ -1395,10 +1395,10 @@ else {
1395
1395
  gtag('config', '${k}');
1396
1396
  ${E}
1397
1397
  </script>
1398
- `}function Qy(v){let _=v.plausible;if(!_?.domain)return"";let k=_.scriptUrl||"https://plausible.io/js/script.js",E=[`data-domain="${pn(_.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`
1398
+ `}function nx(v){let _=v.plausible;if(!_?.domain)return"";let k=_.scriptUrl||"https://plausible.io/js/script.js",E=[`data-domain="${pn(_.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`
1399
1399
  <!-- Plausible Analytics -->
1400
1400
  <script defer data-domain="${pn(_.domain)}" src="${pn(T)}"></script>
1401
- `}function ex(v){let _=v.selfHosted;if(!_?.siteId||!_?.apiEndpoint)return"";let k=pn(_.siteId),E=pn(_.apiEndpoint),T=_.honorDnt?'if(n.doNotTrack==="1")return;':"",j=_.trackHashChanges?"w.addEventListener('hashchange',pv);":"",B=_.trackOutboundLinks?`
1401
+ `}function rx(v){let _=v.selfHosted;if(!_?.siteId||!_?.apiEndpoint)return"";let k=pn(_.siteId),E=pn(_.apiEndpoint),T=_.honorDnt?'if(n.doNotTrack==="1")return;':"",j=_.trackHashChanges?"w.addEventListener('hashchange',pv);":"",B=_.trackOutboundLinks?`
1402
1402
  d.addEventListener('click',function(e){
1403
1403
  var a=e.target.closest('a');
1404
1404
  if(a&&a.hostname!==location.hostname){
@@ -1431,7 +1431,7 @@ else {
1431
1431
  w.stxAnalytics={track:function(n,v){t('event',{name:n,value:v});}};
1432
1432
  })();
1433
1433
  </script>
1434
- `}function tx(v){let _=v.custom;if(!_)return"";if(_.inlineScript)return`
1434
+ `}function sx(v){let _=v.custom;if(!_)return"";if(_.inlineScript)return`
1435
1435
  <!-- Custom Analytics -->
1436
1436
  <script>
1437
1437
  ${_.inlineScript}
@@ -1439,7 +1439,7 @@ ${_.inlineScript}
1439
1439
  `;if(!_.scriptUrl)return"";let k=[];if(_.scriptId)k.push(`id="${pn(_.scriptId)}"`);if(_.attributes)for(let[T,j]of Object.entries(_.attributes))k.push(`${pn(T)}="${pn(j)}"`);return`
1440
1440
  <!-- Custom Analytics -->
1441
1441
  <script${k.length>0?` ${k.join(" ")}`:""} src="${pn(_.scriptUrl)}" defer></script>
1442
- `}function gp(v,_){let k=Gy(_);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 pn(v){return v.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function je(v){let _=v.match(/\bdefinePageMeta\s*\(\s*(\{[\s\S]*?\})\s*\)/m);if(!_)return null;try{return Function(`return ${_[1]}`)()}catch{return null}}function mp(v){let _=v?.layout;if(_===!1)return!1;return typeof _==="string"&&_.trim()?_.trim():void 0}var nx=100,rx=599,Ic="__stxResponseStatus",Js="__stxResponseHeaders";function ro(v){return typeof v==="number"&&Number.isInteger(v)&&v>=nx&&v<=rx}function St(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(ro(E))return E}return}function Ac(v,_){if(!v||typeof v!=="object")return!1;let k=typeof _==="string"&&/^\d+$/.test(_.trim())?Number(_.trim()):_;if(!ro(k))return!1;return v[Ic]=k,!0}function sx(v,_,k){if(!v||typeof v!=="object")return;let E=String(_??"").trim();if(!E)return;v[Js]={...v[Js],[E]:String(k)}}function Be(v){let _=v?.[Ic];return ro(_)?_:void 0}function Fe(v){let _=v?.[Js];if(!_||typeof _!=="object")return;let k=Object.entries(_).map(([E,T])=>[E,String(T)]);return k.length>0?Object.fromEntries(k):void 0}function qo(v,_){if(!v||!_||v===_||typeof _!=="object")return;let k=Be(v);if(k!==void 0)_[Ic]=k;let E=Fe(v);if(E)_[Js]={..._[Js],...E}}function jn(v){return{setResponseStatus:(_)=>{Ac(v,_)},notFound:(_=404)=>{let k=ro(_)&&_>=400?_:404;Ac(v,k)},setResponseHeader:(_,k)=>{sx(v,_,k)}}}function hp(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 H=ix(v,V.index+V[0].length-1);if(H<0)break;let G=v.slice(V.index+V[0].length,H).trim(),J=/^\d+$/.test(G)?Number(G):c(G,_),ne=E?` in ${E}`:"";if(j)console.warn(`[stx] @status(${G})${ne} 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(${G}) from <script server> instead \u2014 that runs per request.`);else if(!Ac(_,J))console.warn(`[stx] @status(${G})${ne} is not an HTTP status (100-599) \u2014 ignoring it.`);B+=v.slice(z,V.index),z=H+1+(v.slice(H+1).match(/^[^\S\n]*\n?/)?.[0].length??0),F.lastIndex=z}return z===0?v:B+v.slice(z)}function ix(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 ox=0,ax=0;function yp(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 cx(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=yp(B,"x-data");if(!F)continue;let V=`__stx_scope_${ox++}`,H=yp(B,"x-init"),G=lx(v,j,z+T.length),J=v.slice(z,G.endIndex),ne=ux(J);_.push({id:V,selector:`[data-stx-scope="${V}"]`,stateExpr:F,initExpr:H,bindings:[],refs:ne})}return _}function lx(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),H=z.exec(v);if(H&&H.index<(F?.index??1/0)){T=H.index+H[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 ux(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=dx(j);_.set(B,z)}return _}function dx(v){let _=v.match(/\bid\s*=\s*["']([^"']*)["']/);if(_)return _[1];return`__stx_el_${ax++}`}function px(){return`
1442
+ `}function hp(v,_){let k=Qy(_);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 pn(v){return v.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function je(v){let _=v.match(/\bdefinePageMeta\s*\(\s*(\{[\s\S]*?\})\s*\)/m);if(!_)return null;try{return Function(`return ${_[1]}`)()}catch{return null}}function yp(v){let _=v?.layout;if(_===!1)return!1;return typeof _==="string"&&_.trim()?_.trim():void 0}var ix=100,ox=599,Pc="__stxResponseStatus",Js="__stxResponseHeaders";function so(v){return typeof v==="number"&&Number.isInteger(v)&&v>=ix&&v<=ox}function St(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(so(E))return E}return}function Ic(v,_){if(!v||typeof v!=="object")return!1;let k=typeof _==="string"&&/^\d+$/.test(_.trim())?Number(_.trim()):_;if(!so(k))return!1;return v[Pc]=k,!0}function ax(v,_,k){if(!v||typeof v!=="object")return;let E=String(_??"").trim();if(!E)return;v[Js]={...v[Js],[E]:String(k)}}function Be(v){let _=v?.[Pc];return so(_)?_:void 0}function Fe(v){let _=v?.[Js];if(!_||typeof _!=="object")return;let k=Object.entries(_).map(([E,T])=>[E,String(T)]);return k.length>0?Object.fromEntries(k):void 0}function qo(v,_){if(!v||!_||v===_||typeof _!=="object")return;let k=Be(v);if(k!==void 0)_[Pc]=k;let E=Fe(v);if(E)_[Js]={..._[Js],...E}}function jn(v){return{setResponseStatus:(_)=>{Ic(v,_)},notFound:(_=404)=>{let k=so(_)&&_>=400?_:404;Ic(v,k)},setResponseHeader:(_,k)=>{ax(v,_,k)}}}function xp(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 H=cx(v,V.index+V[0].length-1);if(H<0)break;let G=v.slice(V.index+V[0].length,H).trim(),J=/^\d+$/.test(G)?Number(G):c(G,_),ne=E?` in ${E}`:"";if(j)console.warn(`[stx] @status(${G})${ne} 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(${G}) from <script server> instead \u2014 that runs per request.`);else if(!Ic(_,J))console.warn(`[stx] @status(${G})${ne} is not an HTTP status (100-599) \u2014 ignoring it.`);B+=v.slice(z,V.index),z=H+1+(v.slice(H+1).match(/^[^\S\n]*\n?/)?.[0].length??0),F.lastIndex=z}return z===0?v:B+v.slice(z)}function cx(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 lx=0,ux=0;function bp(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 dx(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=bp(B,"x-data");if(!F)continue;let V=`__stx_scope_${lx++}`,H=bp(B,"x-init"),G=px(v,j,z+T.length),J=v.slice(z,G.endIndex),ne=fx(J);_.push({id:V,selector:`[data-stx-scope="${V}"]`,stateExpr:F,initExpr:H,bindings:[],refs:ne})}return _}function px(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),H=z.exec(v);if(H&&H.index<(F?.index??1/0)){T=H.index+H[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 fx(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=gx(j);_.set(B,z)}return _}function gx(v){let _=v.match(/\bid\s*=\s*["']([^"']*)["']/);if(_)return _[1];return`__stx_el_${ux++}`}function mx(){return`
1443
1443
  // STX Reactive Runtime - x-cloak and transition CSS
1444
1444
  (function() {
1445
1445
  var style = document.createElement('style');
@@ -1692,7 +1692,7 @@ window.__stx_reactive = (function() {
1692
1692
 
1693
1693
  return { initScope: initScope, reactive: reactive };
1694
1694
  })();
1695
- `}function xp(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 H;try{H=x(z,_,!0)}catch{return F}if(H===void 0)return F;if(V){let G=String(H).replace(/\\/g,"\\\\").replace(new RegExp(V==="`"?"`":V,"g"),`\\${V}`).replace(/\r/g,"\\r").replace(/\n/g,"\\n");return V==="`"?G.replace(/\$\{/g,"\\${"):G}if(typeof H==="string"){let G=H.trim();if(G.startsWith("{")&&G.endsWith("}")||G.startsWith("[")&&G.endsWith("]"))try{return JSON.parse(G),G}catch{}}return JSON.stringify(H)}}function fx(v,_){if(v.length===0)return"";let k=v.map((E)=>{let T=JSON.stringify(Object.fromEntries(E.refs)),j=xp(E.stateExpr,_),B=E.initExpr?xp(E.initExpr,_):null,z=JSON.stringify(j),F=B?JSON.stringify(B):"null";return`
1695
+ `}function vp(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 H;try{H=x(z,_,!0)}catch{return F}if(H===void 0)return F;if(V){let G=String(H).replace(/\\/g,"\\\\").replace(new RegExp(V==="`"?"`":V,"g"),`\\${V}`).replace(/\r/g,"\\r").replace(/\n/g,"\\n");return V==="`"?G.replace(/\$\{/g,"\\${"):G}if(typeof H==="string"){let G=H.trim();if(G.startsWith("{")&&G.endsWith("}")||G.startsWith("[")&&G.endsWith("]"))try{return JSON.parse(G),G}catch{}}return JSON.stringify(H)}}function hx(v,_){if(v.length===0)return"";let k=v.map((E)=>{let T=JSON.stringify(Object.fromEntries(E.refs)),j=vp(E.stateExpr,_),B=E.initExpr?vp(E.initExpr,_):null,z=JSON.stringify(j),F=B?JSON.stringify(B):"null";return`
1696
1696
  (function() {
1697
1697
  var scopeEl = document.querySelector('${E.selector}');
1698
1698
  if (!scopeEl) return;
@@ -1701,25 +1701,25 @@ window.__stx_reactive = (function() {
1701
1701
  })();`}).join(`
1702
1702
  `);return`
1703
1703
  <script data-stx-scoped data-stx-reactive data-stx-run="always">
1704
- ${px()}
1704
+ ${mx()}
1705
1705
  ${k}
1706
- </script>`}function bp(v,_,k){if(!mx(v))return v;let E=cx(v);if(E.length===0)return v;let T=gx(v,E),j=fx(E,_),B=T.lastIndexOf("</body>");if(B!==-1)T=T.slice(0,B)+j+`
1707
- `+T.slice(B);else T+=j;return T}function gx(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 mx(v){return/x-data\s*=\s*["']/.test(v)}function mr(v,_){try{let k=v.trim();if(p(k))return l(k,Object.keys(_))(...Object.values(_));else return c(k,_)}catch{return!1}}function hr(v,_){let k=hx(v,_);return k.ok?{expression:k.expression,endPos:k.endPos}:null}function hx(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 yx(v,_){let k=v.lastIndexOf("<",_);if(k===-1)return!1;return k>v.lastIndexOf(">",_)}function Tr(v,_,k,E){let T=1,j=E,B=new RegExp(`@${_}\\s*\\(`,"g"),z=new RegExp(`@${k}(?![a-z])`,"g");while(j<v.length&&T>0){B.lastIndex=j,z.lastIndex=j;let F=B.exec(v),V=z.exec(v),H=F?F.index:1/0,G=V?V.index:1/0;if(H<G)T++,j=H+F[0].length;else if(G<1/0){if(T--,T===0)return G;j=G+V[0].length}else break}return-1}function vp(v,_){let k=v.slice(_).match(/^@if\s*/);if(!k)return null;let E=_+k[0].length,T=hr(v,E);if(!T)return null;let j=T.endPos,B=Tr(v,"if","endif",j);if(B===-1)return null;let z=v.slice(j,B),F=[],V=0,H="if",G=T.expression,J=0,ne=0;while(V<z.length){let re=z.indexOf("@",V);if(re===-1)break;V=re;let se=z.substring(re);if(yx(z,re)){V++;continue}if(/^@if\s*\(/.test(se)){ne++,V++;continue}if(/^@endif(?![a-z])/.test(se)){ne--,V+=6;continue}if(ne===0){let ie=se.match(/^@elseif\s*/);if(ie){F.push({type:H,condition:G,content:z.substring(J,V),start:j+J,end:j+V});let oe=V+ie[0].length,de=hr(z,oe);if(!de){V++;continue}H="elseif",G=de.expression,V=de.endPos,J=V;continue}else if(/^@else(?![a-z])/.test(se)){F.push({type:H,condition:G,content:z.substring(J,V),start:j+J,end:j+V}),H="else",G=void 0,V+=5,J=V;continue}}V++}return F.push({type:H,condition:G,content:z.slice(J),start:j+J,end:j+z.length}),{fullMatch:v.slice(_,B+6),branches:F,start:_,end:B+6}}function Ys(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=vp(v,E.index);if(j)_.push(j),k.lastIndex=j.end;E=k.exec(v)}return _}function so(v,_,k){let E=[],T=new RegExp(`@${_}\\s*\\(`,"g"),j=T.exec(v);while(j!==null){if(E.some((se)=>j.index>se.start&&j.index<se.end)){j=T.exec(v);continue}let z=j.index,F=z+j[0].length-1,V=S(v,"(",")",F);if(V===-1){j=T.exec(v);continue}let H=v.slice(F+1,V),G=V+1,J=Tr(v,_,k,G);if(J===-1){j=T.exec(v);continue}let ne=v.slice(G,J),re=J+`@${k}`.length;E.push({fullMatch:v.slice(z,re),name:_,params:H,content:ne,start:z,end:re}),T.lastIndex=re,j=T.exec(v)}return E}function Pc(v,_){let k=v.slice(_).match(/^@switch\s*/);if(!k)return null;let E=_+k[0].length,T=hr(v,E);if(!T)return null;let j=T.endPos,B=Tr(v,"switch","endswitch",j);if(B===-1)return null;let z=v.slice(j,B),F=[],V=0,H=null,G=0;while(V<z.length){let J=z.slice(V),ne=J.match(/^@switch\s*\(/),re=J.match(/^@endswitch(?![a-z])/);if(ne){if(G++,H)H.content+=ne[0];V+=ne[0].length;continue}if(re){if(G--,H)H.content+=re[0];V+=re[0].length;continue}if(G>0){if(H)H.content+=z[V];V++;continue}let se=J.match(/^@case\s*/),ie=J.match(/^@default(?![a-z])/),oe=J.match(/^@break(?![a-z])/);if(se&&J.startsWith("@case")){if(H)F.push(H);let de=V+se[0].length,ae=hr(z,de);if(!ae){V++;continue}H={type:"case",value:ae.expression,content:""},V=ae.endPos}else if(ie&&J.startsWith("@default")){if(H)F.push(H);H={type:"default",content:""},V+=ie[0].length}else if(oe&&J.startsWith("@break"))V+=oe[0].length;else{if(H)H.content+=z[V];V++}}if(H)F.push(H);return{fullMatch:v.slice(_,B+10),expression:T.expression,cases:F,start:_,end:B+10}}function wx(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=Pc(E,B);if(!z)break;try{let F;if(p(z.expression))F=l(z.expression,Object.keys(_))(...Object.values(_));else F=c(z.expression,_);let V="",H=!1;for(let G of z.cases)if(G.type==="default"){if(!H)V=G.content.trim()}else try{let J;if(G.value&&p(G.value))J=l(G.value,Object.keys(_))(...Object.values(_));else if(G.value)J=c(G.value,_);if(F===J){V=G.content.trim(),H=!0;break}}catch{continue}E=E.substring(0,B)+V+E.substring(z.end),T=!0}catch(F){let V=F instanceof Error?F.message:String(F),H=i("Switch",`Error evaluating @switch expression: ${V}`,t.EVALUATION_ERROR);E=E.substring(0,B)+H+E.substring(z.end);break}}return E}function Sx(v){let _=[];return{masked:v.replace(/<script\b[\s\S]*?<\/script\s*>/gi,(E)=>(_.push(E),`\x00stx-script-${_.length-1}\x00`)),scripts:_}}function $x(v,_){if(_.length===0)return v;return v.replace(/\u0000stx-script-(\d+)\u0000/g,(k,E)=>_[Number(E)]??k)}function ar(v,_,k){let{masked:E,scripts:T}=Sx(v);return $x(_x(E,_,k),T)}function _x(v,_,k){let E=v;E=wx(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=hr(E,z+7);if(!F)break;let V=F.endPos,H=Tr(E,"unless","endunless",V);if(H===-1){console.warn(`[stx] @unless directive at position ${z} has no matching @endunless \u2014 the block was skipped. Check for typos or missing closers.`);break}let G=E.slice(V,H),J=F.expression,ne=-1;{let se=0,ie=/@(?:if|unless)\s*\(/g,oe=/@(?:endif|endunless)(?![a-z])/g,de=/@else(?![a-z])/g,ae=[],me;while((me=ie.exec(G))!==null)ae.push({pos:me.index,type:"open"});while((me=oe.exec(G))!==null)ae.push({pos:me.index,type:"close"});while((me=de.exec(G))!==null)ae.push({pos:me.index,type:"else"});ae.sort((ve,Se)=>ve.pos-Se.pos);for(let ve of ae)if(ve.type==="open")se++;else if(ve.type==="close")se--;else if(ve.type==="else"&&se===0){ne=ve.pos;break}}let re;if(ne!==-1){let se=G.slice(0,ne),ie=G.slice(ne+5);re=`@if (${J})${ie}@else ${se}@endif`}else re=`@if (!(${J}))${G}@endif`;E=E.substring(0,z)+re+E.substring(H+10),j=!0}}E=Mc(E,_,k),E=Oc(E,_,k),E=Dc(E,_);let T=()=>{let j=Ys(E);if(j.length===0)return!1;let B=Array(j.length);for(let V=j.length-1;V>=0;V--){let H=j[V];try{let G="",J=!1;for(let ne of H.branches){if(J)break;if(ne.type==="else")G=ne.content,J=!0;else try{let re;if(ne.condition&&p(ne.condition))re=l(ne.condition,Object.keys(_))(...Object.values(_));else if(ne.condition)re=c(ne.condition,_);if(re)G=ne.content,J=!0}catch(re){G=i(ne.type==="if"?"If":"Elseif",`Error in @${ne.type}(${ne.condition}): ${re instanceof Error?re.message:String(re)}`,t.EVALUATION_ERROR),J=!0}}B[V]=G}catch(G){let J=G instanceof Error?G.message:String(G);B[V]=i("If",`Error processing @if block: ${J}`,t.EVALUATION_ERROR)}}let z=Array(j.length*2+1),F=0;for(let V=0;V<j.length;V++){let H=j[V];z[V*2]=E.slice(F,H.start),z[V*2+1]=B[V],F=H.end}return z[j.length*2]=E.slice(F),E=z.join(""),!0};while(!0){let j=E;if(!T())break;if(E===j)break}return E}function wp(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 Dc(v,_){let k=v;function E(z,F,V,H){let G=1,J=H,ne=new RegExp(`@${F}(?:\\s*\\(|\\s|$)`,"g"),re=new RegExp(`@${V}(?![a-z])`,"g");while(J<z.length&&G>0){ne.lastIndex=J,re.lastIndex=J;let se=ne.exec(z),ie=re.exec(z),oe=se?se.index:1/0,de=ie?ie.index:1/0;if(oe<de)G++,J=oe+se[0].length;else if(de<1/0){if(G--,G===0)return de;J=de+ie[0].length}else break}return-1}function T(z,F,V){let H=0,G=new RegExp(`@${F}(?:\\s*\\(|\\s|$)`,"g"),J=new RegExp(`@${V}(?![a-z])`,"g"),ne=/@else(?![a-z])/g,re=[],se;while((se=G.exec(z))!==null)re.push({pos:se.index,type:"open"});while((se=J.exec(z))!==null)re.push({pos:se.index,type:"close"});while((se=ne.exec(z))!==null)re.push({pos:se.index,type:"else"});re.sort((ie,oe)=>ie.pos-oe.pos);for(let ie of re)if(ie.type==="open")H++;else if(ie.type==="close")H--;else if(ie.type==="else"&&H===0)return ie.pos;return-1}{let z=!0;while(z){z=!1;let F=k.match(/@auth(?:\s*\(|\s|(?=\n))/);if(!F||F.index===void 0)break;let V=F.index,H,G,J=k.slice(V+5),ne=wp(J);if(ne)H=ne.value,G=V+5+ne.consumed;else G=V+5;let re=E(k,"auth","endauth",G);if(re===-1){console.warn(`[stx] @auth directive at position ${V} has no matching @endauth \u2014 the block was skipped.`);break}let se=k.slice(G,re),ie=T(se,"auth","endauth"),oe;if(!_.auth)oe=!1;else oe=H?mr(`auth?.check && auth?.user?.[${H}]`,_):mr("auth?.check",_);let de;if(ie!==-1){let ae=se.slice(0,ie),me=se.slice(ie+5);de=oe?ae:me}else de=oe?se:"";k=k.substring(0,V)+de+k.substring(re+8),z=!0}}{let z=!0;while(z){z=!1;let F=k.match(/@guest(?:\s*\(|\s|(?=\n))/);if(!F||F.index===void 0)break;let V=F.index,H,G,J=k.slice(V+6),ne=wp(J);if(ne)H=ne.value,G=V+6+ne.consumed;else G=V+6;let re=E(k,"guest","endguest",G);if(re===-1){console.warn(`[stx] @guest directive at position ${V} has no matching @endguest \u2014 the block was skipped.`);break}let se=k.slice(G,re),ie=T(se,"guest","endguest"),oe;if(!_.auth)oe=!0;else oe=H?mr(`!auth?.check || !auth?.user?.[${H}]`,_):mr("!auth?.check",_);let de;if(ie!==-1){let ae=se.slice(0,ie),me=se.slice(ie+5);de=oe?ae:me}else de=oe?se:"";k=k.substring(0,V)+de+k.substring(re+9),z=!0}}function j(z,F,V){if(_.userCan&&typeof _.userCan[z]==="boolean")return _.userCan[z];if(_.permissions?.check&&typeof _.permissions.check==="function")try{let H=[z];if(F)H.push(F);if(V){let G=mr(V,_);H.push(G)}return _.permissions.check(...H)}catch{return!1}return!1}function B(z){let F=z.match(/^\s*\(\s*'([^']*)'(?:,\s*'([^']*)')?(?:,\s*([^)]*))?\)/);if(!F)return null;return{ability:F[1],type:F[2],id:F[3]?.trim(),paramsEnd:F[0].length}}for(let z of["can","cannot"]){let F=`end${z}`,V=z==="can"?"elsecan":"elsecannot",H=!0;while(H){H=!1;let G=k.match(new RegExp(`@${z}\\s*\\(`));if(!G||G.index===void 0)break;let J=G.index,ne=k.slice(J+`@${z}`.length),re=B(ne);if(!re)break;let se=J+`@${z}`.length+re.paramsEnd,ie=E(k,z,F,se);if(ie===-1){console.warn(`[stx] @${z} directive at position ${J} has no matching @${F} \u2014 the block was skipped.`);break}let oe=k.slice(se,ie),de=[],ae=0,me=new RegExp(`@${z}\\s*\\(`,"g"),ve=new RegExp(`@${F}(?![a-z])`,"g"),Se=new RegExp(`@${V}\\s*\\(`,"g"),$e=/@else(?![a-z])/g,Ce=[],Ee;while((Ee=me.exec(oe))!==null)Ce.push({pos:Ee.index,type:"open"});while((Ee=ve.exec(oe))!==null)Ce.push({pos:Ee.index,type:"close"});while((Ee=Se.exec(oe))!==null)Ce.push({pos:Ee.index,type:"elseDirective"});while((Ee=$e.exec(oe))!==null)Ce.push({pos:Ee.index,type:"else"});Ce.sort((Pe,Ie)=>Pe.pos-Ie.pos);for(let Pe of Ce){if(Pe.type==="open"){ae++;continue}if(Pe.type==="close"){ae--;continue}if(ae===0)de.push(Pe)}let Te=[],Re=0;for(let Pe=0;Pe<de.length;Pe++){let Ie=de[Pe];if(Te.push({content:oe.slice(Re,Ie.pos),ability:void 0}),Ie.type==="elseDirective"){let Ze=oe.slice(Ie.pos+`@${V}`.length),rt=B(Ze);if(rt){Te[Te.length-1]={content:oe.slice(Re,Ie.pos)},Re=Ie.pos+`@${V}`.length+rt.paramsEnd,Te.push({content:"",ability:rt.ability,type:rt.type,id:rt.id}),Te.pop();let at=de[Pe+1],Qe=at?at.pos:oe.length;Te.push({content:oe.slice(Re,Qe),ability:rt.ability,type:rt.type,id:rt.id}),Re=Qe}}else Re=Ie.pos+5}if(Re<oe.length){let Pe=Te[Te.length-1];if(de.length>0&&de[de.length-1].type==="else")Te.push({content:oe.slice(Re),isFinalElse:!0});else if(Te.length===0)Te.push({content:oe.slice(Re)})}let _e=j(re.ability,re.type,re.id),Ae=z==="can"?_e:!_e,Xe="";if(Ae)Xe=Te[0]?.content||"";else{let Pe=!1;for(let Ie=1;Ie<Te.length;Ie++){let Ze=Te[Ie];if(Ze.isFinalElse){Xe=Ze.content,Pe=!0;break}if(Ze.ability){let rt=j(Ze.ability,Ze.type,Ze.id);if(z==="can"?rt:!rt){Xe=Ze.content,Pe=!0;break}}}if(!Pe&&Te.length>0){let Ie=Te[Te.length-1];if(Ie.isFinalElse)Xe=Ie.content}}k=k.substring(0,J)+Xe+k.substring(ie+`@${F}`.length),H=!0}}return k}function Mc(v,_,k){let E=v;function T(j,B,z,F,V){let H=!0;while(H){H=!1;let G=new RegExp(`@${B}\\s*\\(`),J=j.match(G);if(!J||J.index===void 0)break;let ne=J.index,re=hr(j,ne+`@${B}`.length);if(!re)break;let se=re.endPos,ie=Tr(j,B,z,se);if(ie===-1){console.warn(`[stx] @${B} directive at position ${ne} has no matching @${z} \u2014 the block was skipped.`);break}let oe=j.slice(se,ie),de=re.expression,ae=-1,me=0,ve=0;while(ve<oe.length){let Se=oe.indexOf("@",ve);if(Se===-1)break;let $e=oe.substring(Se);if(/^@(?:if|unless|isset|empty)\s*\(/.test($e)){me++,ve=Se+1;continue}if(/^@(?:endif|endunless|endisset|endempty)(?![a-z])/.test($e)){me--,ve=Se+1;continue}if(me===0&&/^@else(?![a-z])/.test($e)){ae=Se;break}ve=Se+1}try{let Se=F(de.trim()),$e;if(ae!==-1){let Ce=oe.slice(0,ae),Ee=oe.slice(ae+5);$e=Se?Ce:Ee}else $e=Se?oe:"";j=j.substring(0,ne)+$e+j.substring(ie+`@${z}`.length),H=!0}catch(Se){let $e=Se instanceof Error?Se.message:String(Se),Ce=i(V,`Error processing @${B} directive: ${$e}`,t.EVALUATION_ERROR);j=j.substring(0,ne)+Ce+j.substring(ie+`@${z}`.length);break}}return j}return E=T(E,"isset","endisset",(j)=>{let B=mr(j,_);return B!==void 0&&B!==null},"Isset"),E=T(E,"empty","endempty",(j)=>{let B=mr(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 Oc(v,_,k){let E=v,T="development";function j(B,z,F,V){let H=new RegExp(`@${z}(?![a-z])`,"g"),G=new RegExp(`@${F}(?![a-z])`,"g"),J=new RegExp(`^@${z}(?![a-z])`),ne=new RegExp(`^@${F}(?![a-z])`),re=B,se=!0;while(se){se=!1,H.lastIndex=0;let ie=H.exec(re);if(!ie)break;let oe=ie.index,de=oe+ie[0].length;if(z==="env"){let _e=re.substring(de).match(/^\s*\(\s*(['"])([^'"]+)\1\s*\)/);if(!_e)break;de+=_e[0].length,V=T===_e[2]}let ae=1,me=de,ve=-1;while(ae>0&&me<re.length){H.lastIndex=me,G.lastIndex=me;let _e=H.exec(re),Ae=G.exec(re),Xe=_e?_e.index:1/0,Pe=Ae?Ae.index:1/0;if(Xe<Pe)ae++,me=Xe+_e[0].length;else if(Pe<1/0){if(ae--,ae===0){ve=Pe;break}me=Pe+Ae[0].length}else break}if(ve===-1){console.warn(`[stx] @${z} directive at position ${oe} has no matching @${F} \u2014 the block was skipped.`);break}let Se=re.substring(de,ve),$e=-1,Ce=0,Ee=0;while(Ee<Se.length){let _e=Se.indexOf("@",Ee);if(_e===-1)break;let Ae=Se.substring(_e);if(J.test(Ae)){Ce++,Ee=_e+1;continue}if(ne.test(Ae)){Ce--,Ee=_e+1;continue}if(Ce===0&&/^@else(?![a-z])/.test(Ae)){$e=_e;break}Ee=_e+1}let Te;if($e!==-1){let _e=Se.slice(0,$e),Ae=Se.slice($e+5);Te=V?_e:Ae}else Te=V?Se:"";let Re=`@${F}`.length;re=re.substring(0,oe)+Te+re.substring(ve+Re),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 Sp=new WeakMap;function $p(v=16){let _=new Uint8Array(v);return crypto.getRandomValues(_),btoa(String.fromCharCode(..._))}function io(v,_){if(!v)return _?.nonceGenerator?.()??$p();let k=Sp.get(v);if(!k)k=_?.nonceGenerator?.()??$p(),Sp.set(v,k);return k}function kx(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 _p(v,_){return`<meta http-equiv="Content-Security-Policy" content="${kx(v,_).replace(/&/g,"&amp;").replace(/"/g,"&quot;")}">`}function kp(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?io(k,_):void 0,T=_p(_.directives,E);return v.replace(/<head([^>]*)>/,`<head$1>
1708
- ${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 Cp(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?io(_,j):void 0;return _p(j.directives,B)}),T=T.replace(/@cspNonce\b/g,()=>{if(!j?.enabled||!j.useNonce)return"";return io(_,j)}),j?.enabled&&j.useNonce)_.cspNonce=io(_,j);return T}import Ex from"crypto";var Cx=40,Rp="_token",Nc=null;function Rx(v=Cx){let _=Ex.randomBytes(Math.ceil(v/2)).toString("hex").slice(0,v);return Nc=_,_}function Tx(){if(!Nc)Rx();return Nc}function Ax(v=Rp){let _=Tx();return`<input type="hidden" name="${v}" value="${_}">`}function Tp(v){return v.replace(/@csrf(?:\((['"])([^'"]*)\1\))?/g,(_,k,E)=>Ax(E||Rp))}async function Ap(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 Ix(T,j,_,k,E);else T=await Px(T,j,_,k,E)}return T}async function Ix(v,_,k,E,T){let{name:j,handler:B}=_,z=`@${j}`,F=`@end${j}`,V=v,H=$r(`${z}(?:\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\))?([\\s\\S]*?)${F}`,"g"),G=[],J=H.exec(V);while(J!==null){let[ne,re="",se=""]=J,ie=J.index||0;try{let oe=re?Ip(_,re):[],de=se.trim(),ae=await B(de,oe,k,E);G.push({original:ne,processed:ae,startIndex:ie})}catch(oe){let de=oe instanceof Error?oe.message:String(oe);if(T.debug)console.error(`Error processing custom directive @${j}:`,oe);G.push({original:ne,processed:i("CustomDirective",`Error in @${j}${re?`(${re})`:""}: ${de}`,t.EVALUATION_ERROR),startIndex:ie})}J=H.exec(V)}for(let ne=G.length-1;ne>=0;ne--){let{original:re,processed:se}=G[ne];V=V.replace(re,se)}return V}async function Px(v,_,k,E,T){let{name:j,handler:B}=_,z=v,F=[],V=[];if(_.rawParams){for(let J of Ts(z,$r(`(?<![\\w$@])@${j}\\s*\\(`,"g")))if(J.end!==-1)V.push({fullMatch:J.call,paramString:J.args,startIndex:J.start})}else{let J=$r(`@${j}\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\)`,"g");J.lastIndex=0;let ne=J.exec(z);while(ne!==null)V.push({fullMatch:ne[0],paramString:ne[1]??"",startIndex:ne.index||0}),ne=J.exec(z)}for(let{fullMatch:J,paramString:ne,startIndex:re}of V)try{let se=Ip(_,ne),ie=await B("",se,k,E);F.push({original:J,processed:ie,startIndex:re})}catch(se){let ie=se instanceof Error?se.message:String(se);if(T.debug)console.error(`Error processing custom directive @${j}:`,se);F.push({original:J,processed:i("CustomDirective",`Error in @${j}(${ne}): ${ie}`,t.EVALUATION_ERROR),startIndex:re})}let H=$r(`@${j}(?!\\w)(?!\\s*\\()`,"g"),G=H.exec(z);while(G!==null){let[J]=G,ne=G.index||0;try{let re=await B("",[],k,E);F.push({original:J,processed:re,startIndex:ne})}catch(re){let se=re instanceof Error?re.message:String(re);if(T.debug)console.error(`Error processing custom directive @${j}:`,re);F.push({original:J,processed:i("CustomDirective",`Error in @${j}: ${se}`,t.EVALUATION_ERROR),startIndex:ne})}G=H.exec(z)}for(let J=F.length-1;J>=0;J--){let{original:ne,processed:re}=F[J];z=z.replace(ne,re)}return z}function Ip(v,_){return v.rawParams?Ge(_):Dx(_)}function Dx(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 Pp=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,Dp=/^[A-Za-z_$][\w$]*$/,Mx=new Set(["light","dark","system"]);function Ar(v,_){if(typeof v!=="string"||v.length===0)throw Error(`@appearanceBootstrap ${_} must be a non-empty string`)}function Ox(v){if(!v||typeof v!=="object"||Array.isArray(v))throw Error("@appearanceBootstrap expects an options object");let _=v,{appearance:k,colorMode:E}=_;if(Ar(_.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(Ar(E.key,"colorMode.key"),Ar(E.attribute,"colorMode.attribute"),Ar(E.default,"colorMode.default"),!Dp.test(E.key))throw Error("@appearanceBootstrap preference keys must be JavaScript property names");if(!Pp.test(E.attribute))throw Error("@appearanceBootstrap attributes must be lowercase data attribute names");if(!Mx.has(E.default))throw Error("@appearanceBootstrap colorMode.default must be light, dark, or system");let T=null;if(k){if(Ar(k.key,"appearance.key"),Ar(k.attribute,"appearance.attribute"),Ar(k.default,"appearance.default"),!Dp.test(k.key))throw Error("@appearanceBootstrap preference keys must be JavaScript property names");if(!Pp.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 Nx(v){return JSON.stringify(v).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function jx(v){return`<script data-stx-scoped data-stx-appearance-bootstrap>(function(){"use strict";const config=${Nx(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 Lx(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 Mp(v,_){let k=v,E=/@appearanceBootstrap\s*\(/g,T;while((T=E.exec(k))!==null){let j=T.index+T[0].length-1,B=Lx(k,j);if(B===-1)throw Error("@appearanceBootstrap has an unclosed options object");let z=k.slice(j+1,B).trim(),F=c(`(${z})`,_),V=jx(Ox(F));k=k.slice(0,T.index)+V+k.slice(B+1),E.lastIndex=T.index+V.length}return k}import Bx from"crypto";function Wt(v){return String(v??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}var Np={input:"form-control",inputError:"is-invalid",checkInput:"form-check-input",label:"form-label",errorFeedback:"invalid-feedback"};function oo(v,_,k,E){let T=v||_;return k?`${T} ${E}`:T}function vn(v){return String(v).replace(/\[\]$/,"").replace(/[^\w.:-]+/g,"-").replace(/^-+|-+$/g,"")}function Ss(v,_){if(/\bid\s*=/i.test(v))return"";return` id="${Wt(_)}"`}function jc(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="${Wt(`${vn(v)}-error`)}"`;return E}function zx(){return Bx.randomUUID()}function ao(v,_){let k=v;return k=k.replace(/@csrf/g,()=>{if(!_.csrf||typeof _.csrf!=="object"){let E=zx();_.csrf={token:E}}if(_.csrf.field)return _.csrf.field;if(_.csrf.token)return`<input type="hidden" name="_token" value="${Wt(_.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="${Wt(j)}">`;return E}),k}function jp(v,_,k=Np){let E=v;return E=E.replace(/@form\(\s*(?:(?:'([^']+)'|"([^"]+)")\s*)?(?:,\s*(?:'([^']+)'|"([^"]+)")?)?\s*(?:,\s*\{([^}]+)\}\s*)?\)/g,(T,j,B,z,F,V="")=>{let H=j||B||"POST",G=z||F||"",J=yr(V),ne=H.toUpperCase(),re=["GET","POST"].includes(ne)?ne:"POST",se=`<form method="${Wt(re)}" action="${Wt(G)}"${J?` ${J}`:""}>`;if(se+=`
1709
- ${ao("@csrf",_)}`,!["GET","POST"].includes(ne))se+=`
1710
- ${ao(`@method('${ne}')`,_)}`;return se}),E=E.replace(/@endform/g,"</form>"),E=E.replace(/@input\(\s*(?:'([^']+)'|"([^"]+)")\s*(?:,\s*(?:(?:'([^']*)'|"([^"]*)")\s*)?)?(?:,\s*\{([^}]+)\})?\s*\)/g,(T,j,B,z,F,V="")=>{let H=j||B||"",G=z||F||"",J=yr(V),ne=Qs(H,_),re=ne!==void 0&&ne!==null?ne:G||"",se=J.match(/type=['"]([^'"]+)['"]/i),ie=se?se[1]:"text",oe=fi(H,_),de=J.match(/class=['"]([^'"]+)['"]/i),ae=oo(de?de[1]:"",k.input,oe,k.inputError),me=J.replace(/class=['"][^'"]+['"]/i,"");return me=me.replace(/type=['"][^'"]+['"]/i,""),`<input type="${Wt(ie)}" name="${Wt(H)}"${Ss(J,vn(H))} value="${Wt(re)}" class="${ae}"${jc(H,oe,J)}${me?` ${me}`:""}>`}),E=E.replace(/@textarea\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endtextarea/g,(T,j,B="",z="")=>{let F=yr(B),V=Qs(j,_)||z.trim(),H=fi(j,_),G=F.match(/class=['"]([^'"]+)['"]/i),J=oo(G?G[1]:"",k.input,H,k.inputError),ne=F.replace(/class=['"][^'"]+['"]/i,"");return`<textarea name="${Wt(j)}"${Ss(F,vn(j))} class="${J}"${jc(j,H,F)}${ne?` ${ne}`:""}>${Wt(V)}</textarea>`}),E=E.replace(/@select\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endselect/g,(T,j,B="",z)=>{let F=yr(B),V=Qs(j,_),H=fi(j,_),G=F.match(/class=['"]([^'"]+)['"]/i),J=oo(G?G[1]:"",k.input,H,k.inputError),ne=F.replace(/class=['"][^'"]+['"]/i,""),re=z;if(V!==void 0)re=z.replace(/(<option[^>]*value=['"]([^'"]+)['"][^>]*>)/gi,(se,ie,oe)=>{if((Array.isArray(V)?V.some((ae)=>String(ae)===oe):String(V)===oe)&&!ie.includes("selected"))return ie.replace(/(<option)/,"$1 selected");return se});return`<select name="${Wt(j)}"${Ss(F,vn(j))} class="${J}"${jc(j,H,F)}${ne?` ${ne}`:""}>${re}</select>`}),E=E.replace(/@checkbox\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?(?:,\s*\{([^}]+)\})?\)/g,(T,j,B,z="")=>{let F=B===void 0?"1":B,V=B===void 0?vn(j):`${vn(j)}-${vn(F)}`,H=yr(z),G=Qs(j,_),J=G!==void 0&&(Array.isArray(G)?G.some((ie)=>String(ie)===F):G===!0||String(G)===F),ne=H.match(/class=['"]([^'"]+)['"]/i),re=ne?ne[1]:k.checkInput,se=H.replace(/class=['"][^'"]+['"]/i,"");return`<input type="checkbox" name="${Wt(j)}"${Ss(H,V)} value="${Wt(F)}" class="${re}"${J?" checked":""}${se?` ${se}`:""}>`}),E=E.replace(/@radio\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(T,j,B,z="")=>{let F=yr(z),V=Qs(j,_),H=V!==void 0&&V===B,G=F.match(/class=['"]([^'"]+)['"]/i),J=G?G[1]:k.checkInput,ne=F.replace(/class=['"][^'"]+['"]/i,"");return`<input type="radio" name="${Wt(j)}"${Ss(F,`${vn(j)}-${vn(B)}`)} value="${Wt(B)}" class="${J}"${H?" checked":""}${ne?` ${ne}`:""}>`}),E=E.replace(/@file\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(T,j,B="")=>{let z=yr(B),F=z.match(/accept=['"]([^'"]+)['"]/i),V=F?F[1]:"",H=z.includes("multiple"),G=fi(j,_),J=z.match(/class=['"]([^'"]+)['"]/i),ne=oo(J?J[1]:"",k.input,G,k.inputError),re=z.replace(/class=['"][^'"]+['"]/gi,"").replace(/accept=['"][^'"]+['"]/gi,"").replace(/\bmultiple\b/gi,"").trim(),se=[`<input type="file" name="${Wt(j)}"${Ss(z,vn(j))}`,`class="${ne}"`];if(V)se.push(`accept="${Wt(V)}"`);if(H)se.push("multiple");if(re)se.push(re);return`${se.join(" ")}>`}),E=E.replace(/@label\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endlabel/g,(T,j,B="",z)=>{let F=yr(B),V=F.match(/class=['"]([^'"]+)['"]/i),H=V?V[1]:k.label,G=F.replace(/class=['"][^'"]+['"]/i,"");return`<label for="${Wt(vn(j))}" class="${H}"${G?` ${G}`:""}>${z}</label>`}),E}function Lp(v,_,k=Np){return v.replace(/@error\(['"]([^'"]+)['"]\)([\s\S]*?)@enderror/g,(E,T,j)=>{try{if(fi(T,_)){let B=j.replace(/\{\{([^}]+)\}\}/g,(z,F)=>{try{if(F.trim()==="$message"||F.trim()==="message")return Op(T,_);if(F.trim().includes("errors.first")||F.trim().includes("$errors.first")){if(typeof _.errors?.first==="function")return _.errors.first(T);return Op(T,_)}let V=F.trim();if(p(V)){let H=c(V,_);return H!==void 0?String(H):V}return V}catch{return F}});return`<div id="${Wt(`${vn(T)}-error`)}" role="alert">${B}</div>`}return""}catch(B){return console.error("Error processing @error directive:",B),E}})}function fi(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 Op(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 Qs(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 yr(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 hi=/<\/?template\b[^>]*>/gi,Fx=/(?:^|\s)(?:id\s*=|(?:x-|[@:])(?:for|if|else(?:-if)?)(?=\s|=|$)|#[\w-]+(?:\s*=|\s|$)|v-slot(?::[\w-]+)?(?=\s|=|$)|slot\s*=)/i;function Vx(v){let _=v.replace(/^<template\b/i,"").replace(/>$/,"");return Fx.test(_)}function Z(v){hi.lastIndex=0;let _;while((_=hi.exec(v))!==null){if(_[0].startsWith("</")||Vx(_[0]))continue;let k=_.index,E=hi.lastIndex,T=1,j;while((j=hi.exec(v))!==null)if(j[0].startsWith("</")){if(T--,T===0){let B=j.index;return{start:k,openEnd:E,closeStart:B,end:hi.lastIndex,content:v.slice(E,B)}}}else T++;return null}return null}import Ot from"path";import{existsSync as cv}from"fs";import co from"fs";import zt from"path";var Bp=new Map;function lo(v,_=!0){let k=Bp.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=co.readdirSync(B,{withFileTypes:!0})}catch{return}for(let V of F){let H=zt.join(B,V.name);if(V.isDirectory()){if(V.name==="node_modules"||V.name.startsWith("."))continue;j(H,z+1)}else if(V.isFile()&&V.name.endsWith(".stx")){let G=V.name.slice(0,-4);if(!E.has(G))E.set(G,H);let J=G.toLowerCase();if(!E.has(J))E.set(J,H);let ne=G.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(!E.has(ne))E.set(ne,H)}}}for(let B of T)if(j(B,0),E.size>0)break;if(_)Bp.set(v,E);return E}function uo(v,_){if(v.startsWith(".")||v.startsWith("/"))return null;let k=_;while(!0){let E=zt.join(k,"node_modules",v);try{if(co.statSync(E).isDirectory())return E}catch{}let T=zt.dirname(k);if(T===k)return null;k=T}}function po(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 zp(v){let _=v.endsWith(".stx")?v.slice(0,-4):v,k=_.split("-").map((T)=>T.charAt(0).toUpperCase()+T.slice(1)).join(""),E=_.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();return[_,k,E]}function Lc(v,_){let[k,E,T]=zp(v);for(let j of[k,k.toLowerCase(),E,T]){let B=_?.__importedComponents?.get(j);if(B!==void 0)return B}}function*Bc(v,_,k={},E){let T=zp(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 co.readdirSync(F,{withFileTypes:!0}))if(V.isDirectory())for(let H of j)yield zt.join(F,V.name,H)}catch{}}}function Fp(v,_,k={},E){let T=Lc(v,E);if(T!==void 0)return T;for(let j of Bc(v,_,k,E))try{if(co.statSync(j,{throwIfNoEntry:!1})?.isFile())return j}catch{}return null}class Vp{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=Lc(v,E);if(T!==void 0)return T;for(let j of Bc(v,_,k,E))if(await r(j))return j;return null}}var Is=new Vp;function Lt(v){return v.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}var Ir="\x00stx-boolean-attribute";function zc(v){return v.indexOf("\x00")===-1?v:v.replace(/\0/g,"")}function xr(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===Ir){k.push(Lt(j));continue}k.push(`${Lt(j)}="${Lt(zc(String(T)))}"`)}return k}function br(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(zc(String(T)))}"`)}return k}function Ms(v){return v.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Wx(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 Fc={name:"StxLink",aliases:["stx-link"],render(v,_,k){let E=Wx(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="${Ms(E.value)}"`);else F.push(`href="${Ms(Hs(E.value,"navigable"))}"`);if(T)F.push(`class="${Ms(T)}"`);if(F.push("data-stx-link"),F.push(`data-stx-active-class="${Ms(j)}"`),F.push(`data-stx-exact-active-class="${Ms(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="${Ms(V)}"`);let H=new Set(["to","class","className","activeClass","exactActiveClass","activeMatch","prefetch"]);return F.push(...xr(v,H)),F.push(...br(v,H)),`<a ${F.join(" ")}>${_}</a>`}};import{createHash as ef}from"crypto";import Yt from"fs";import Ut from"path";import{decode as Jx,generateThumbHash as Yx}from"ts-images";import{createImageDeliveryCatalog as Xp}from"ts-images/delivery";import Vc from"fs";function fo(v,_,k){let E=Buffer.alloc(k),T=Vc.readSync(v,E,0,k,_);return E.subarray(0,T)}function Wc(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 Uc(v){let _;try{_=Vc.openSync(v,"r");let k=fo(_,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=fo(_,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(Wc(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)Vc.closeSync(_)}}import Ux from"fs";import go from"os";import{join as Wp}from"path";import{fileURLToPath as Up}from"url";import{Worker as Hp}from"worker_threads";var ho=Symbol("stx.image-worker.unavailable");function Hx(v=typeof go.availableParallelism==="function"?go.availableParallelism():go.cpus().length){return Math.max(1,Math.min(2,v-1))}var mo=0,Kp=[];async function qx(){if(mo<Hx()){mo++;return}await new Promise((v)=>Kp.push(v)),mo++}function Kx(){mo--,Kp.shift()?.()}var Xx="@stacksjs/stx/builtins/image-warmup-worker";function Zx(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:"&&Ux.existsSync(Up(k)))return Up(k)}catch{}try{let k=typeof Bun<"u"?Bun.resolveSync(Xx,v):void 0;return k&&Gx(k)?k:void 0}catch{return}}function Gx(v,_=process.env){let k=v.replace(/\\/g,"/");if(k.split("/").some((T)=>/@\d[^/]*@@@\d+$/.test(T)))return!1;return![_.BUN_INSTALL_CACHE_DIR,Wp(_.BUN_INSTALL||Wp(go.homedir(),".bun"),"install","cache")].filter((T)=>!!T).map((T)=>`${T.replace(/\\/g,"/").replace(/\/$/,"")}/`).some((T)=>k.startsWith(T))}var qp=!1;function yi(v){if(!qp)qp=!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 ho}function Hc(v){return v instanceof Error?v.message:String(v)}async function qc(v,_){if(typeof Hp!=="function")return yi("node:worker_threads has no Worker in this runtime");let k=Zx();if(!k)return yi("no image-warmup-worker entry beside this module or in the installed @stacksjs/stx");await qx();try{return await new Promise((E,T)=>{let j;try{j=new Hp(k)}catch(V){E(yi(`could not start ${k}: ${Hc(V)}`));return}let B=!1,z=!1,F=(V)=>{if(z)return;z=!0,V(),j.terminate()};j.on("message",(V)=>{if(V.type==="ready"){B=!0,j.postMessage({task:v,args:_});return}if(V.type==="result"){F(()=>E(V.value));return}let H=Error(V.error?.message??"image worker failed");if(V.error?.name)H.name=V.error.name;if(V.error?.stack)H.stack=V.error.stack;F(()=>T(H))}),j.on("error",(V)=>{F(()=>B?T(V instanceof Error?V:Error(Hc(V)||"image worker crashed")):E(yi(`the worker failed before it was ready: ${Hc(V)}`)))}),j.on("exit",(V)=>{F(()=>B?T(Error("image worker exited before it finished")):E(yi(`the worker exited with code ${V} before it was ready`)))})})}finally{Kx()}}var Qx=new Set([".avif",".jpeg",".jpg",".png",".webp"]),eb=[320,640,960,1280,1920],xo="/_stx/images",tb=`stx:${xo}:alpha-1`,nb=["@stacksjs/ts-webp","@stacksjs/ts-avif"],yo;function rb(v,_){let k=Ut.dirname(Bun.resolveSync(v,_));while(k!==Ut.dirname(k)){let E=Ut.join(k,"package.json");if(Yt.existsSync(E)){let T=JSON.parse(Yt.readFileSync(E,"utf8"));if(T.name===v)return T.version}k=Ut.dirname(k)}return}function sb(){if(yo!==void 0)return yo;let v;try{v=Ut.dirname(Bun.resolveSync("ts-images",import.meta.dir))}catch{}return yo=nb.map((_)=>{let k;try{k=v?rb(_,v):void 0}catch{}return`${_.replace("@stacksjs/","")}@${k??"unknown"}`}).join("+"),yo}var Zp=Symbol.for("stx.image-delivery");function xi(){let v=globalThis;return v[Zp]??={catalog:new Map,transparent:new Set},v[Zp]}var Gp=new Set;function ib(v){return`/${v.split(Ut.sep).map(encodeURIComponent).join("/")}`}function ob(v){let _=Ut.extname(v),k=v.slice(0,-_.length).replace(/[^a-zA-Z0-9_-]+/g,"-").replace(/^-+|-+$/g,""),E=ef("sha256").update(v).digest("hex").slice(0,8);return`${k||"image"}-${E}`}function Jp(v,_=`stx:${xo}`){let k=(E)=>`${xo}/${E.split("/").map(encodeURIComponent).join("/")}`;return{cacheNamespace:_,async stat(E){let T=Ut.join(v,E);try{let j=await Yt.promises.stat(T);return j.size>0?{bytes:j.size,path:T,url:k(E)}:null}catch{return null}},async write(E,T){let j=Ut.join(v,E);await Yt.promises.mkdir(Ut.dirname(j),{recursive:!0});let B=`${j}.${process.pid}.tmp`;return await Yt.promises.writeFile(B,T),await Yt.promises.rename(B,j),{bytes:T.byteLength,path:j,url:k(E)}},url:k}}async function tf(v,_=v){let k=await Yt.promises.readdir(_,{withFileTypes:!0});k.sort((T,j)=>T.name.localeCompare(j.name));let E=[];for(let T of k){let j=Ut.join(_,T.name);if(T.isDirectory()){E.push(...await tf(v,j));continue}if(!T.isFile()||!Qx.has(Ut.extname(T.name).toLowerCase()))continue;E.push({absolutePath:j,relativePath:Ut.relative(v,j)})}return E}function Yp(v,_){return v.map((k)=>({key:ib(k.relativePath),input:k.absolutePath,name:ob(k.relativePath),...ab(k.absolutePath)?{options:{storage:_}}:{}}))}function ab(v){return Uc(v)==="possible"}function cb(v){for(let _=3;_<v.length;_+=4)if(v[_]!==255)return!0;return!1}async function lb(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 Jx(new Uint8Array(await Yt.promises.readFile(z?.path??B.fallback.path)));if(cb(F.data))k.add(j)}catch{k.add(j)}}));return k}function ub(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=Yt.openSync(z.path,"r"),!Wc(fo(F,0,32))}catch{return!0}finally{if(F!==void 0)Yt.closeSync(F)}}))continue;if(T.variants=T.variants.filter((z)=>z.format!=="webp"),delete T.sources.webp,k.push(E),!Gp.has(E))Gp.add(E),console.warn(`[stx-images] ${E} is transparent but its WebP variants have no alpha channel; serving PNG instead. Upgrade @stacksjs/ts-webp to 0.1.6 or later.`)}return k}async function db(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 Yx(B.absolutePath),B}catch{return console.warn(`[stx-images] Skipping unreadable raster: ${B.relativePath}`),null}}));_.push(...j.filter((B)=>B!==null))}return _}function Kc(v){return Ut.join(v,"undecodable.json")}function pb(v){try{let _=Yt.readFileSync(Kc(v),"utf-8"),k=JSON.parse(_);return k&&typeof k==="object"?k:{}}catch{return{}}}function fb(v,_){try{Yt.mkdirSync(Ut.dirname(Kc(v)),{recursive:!0}),Yt.writeFileSync(Kc(v),JSON.stringify(_))}catch{}}function Qp(v){try{let _=Yt.statSync(v);return{mtimeMs:_.mtimeMs,size:_.size}}catch{return}}function nf(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 Qr(v){let _=nf(v);return _?xi().catalog.get(_):void 0}function es(v){let _=nf(v);return _?xi().transparent.has(_):!1}function ts(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 Nu(v){let _=Qr(v);if(!_)return;return{src:_.fallback.url,srcset:_.sources[_.fallback.format]||"",sources:ts(_).map(({format:k,srcset:E})=>({type:`image/${k}`,srcset:E})),width:_.source.width,height:_.source.height,placeholder:es(v)?void 0:_.placeholder?.dataUrl}}function Bn(){let v=xi();v.catalog=new Map,v.transparent=new Set}function gb(v){let _=xi();_.catalog=new Map(v.entries),_.transparent=new Set(v.transparent)}async function Lu(v,_,k={}){if(!v||!Yt.existsSync(v))return Bn(),{count:0,fingerprint:""};if(k.offThread){let re=await qc("delivery",{publicDir:v,outputDir:_});if(re!==ho)return gb(re.state),re.result}let E=await tf(v);if(E.length===0)return Bn(),{count:0,fingerprint:""};let T=pb(_),j=E.filter((re)=>{let se=T[re.relativePath];if(!se)return!0;let ie=Qp(re.absolutePath);return!ie||ie.mtimeMs!==se.mtimeMs||ie.size!==se.size});if(j.length===0)return Bn(),{count:0,fingerprint:""};let B=Jp(Ut.join(_,"_stx","images"),`${tb}:${sb()}`),z={outDir:Ut.join(_,"_stx","images"),storage:Jp(Ut.join(_,"_stx","images")),baseUrl:xo,widths:eb,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 Xp({...z,entries:Yp(j,B)})}catch(re){if(F=await db(j),F.length===j.length)throw re;let se=new Set(F.map((oe)=>oe.relativePath)),ie=!1;for(let oe of j){if(se.has(oe.relativePath))continue;let de=Qp(oe.absolutePath);if(!de)continue;T[oe.relativePath]=de,ie=!0}if(ie)fb(_,T);if(F.length===0)return Bn(),{count:0,fingerprint:""};V=await Xp({...z,entries:Yp(F,B)})}let H=await lb(V.entries),G=ub(V.entries,H),J=xi();J.catalog=new Map(Object.entries(V.entries)),J.transparent=H;let ne=H.size===0&&G.length===0?V.fingerprint:ef("sha256").update(V.fingerprint).update(JSON.stringify({transparent:[...H].sort(),droppedWebp:G.sort()})).digest("hex");return{count:F.length,fingerprint:ne}}var mb=new Map;function Xc(v){if(!v)return;let _=v.split("?")[0].split("#")[0];return mb.get(_)}var hb={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},Zc=[320,640,768,1024,1280,1536,1920];function Ft(v){return v.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Xt(v,_){if(v.serverDynamic[_]!==void 0)return String(v.serverDynamic[_]);let k=v.static[_];if(typeof k==="string")return k;return}function bo(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 Gc(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=hb[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 Jc(v,_,k,E){return _.map((T)=>`${wi(v,T,void 0,k,E)} ${T}w`).join(", ")}function yb(v,_,k,E,T){return _.map((j)=>{let B=k?k*j:void 0;return`${wi(v,B,void 0,E,T)} ${j}x`}).join(", ")}function wi(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 xb(v){return`var s=this.style;${v.map((_)=>`s.${_}=''`).join(";")}`}function bb(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 Yc={name:"StxImage",aliases:["Image","stx-image","stx-img"],render(v,_,k){let E=Xt(v,"src")||"",T=Qr(E),j=Xt(v,"alt")||"",B=Xt(v,"width")||(T?String(T.source.width):void 0),z=Xt(v,"height")||(T?String(T.source.height):void 0),F=Xt(v,"sizes"),V=Xt(v,"srcset"),H=Xt(v,"densities"),G=Xt(v,"format"),J=es(E)||Xc(E)?.transparent===!0,ne=Xt(v,"placeholder")||(T&&!J?"thumbhash":void 0),re=Xt(v,"placeholderColor")||"#e5e7eb",se=Xt(v,"provider"),ie=Xt(v,"class")||Xt(v,"className")||"",oe=Xt(v,"style")||"",de=Xt(v,"quality"),ae=bo(v,"lazy",!0),me=bo(v,"preload",!1),ve=bo(v,"priority",!1),Se=Xt(v,"loading"),$e=Xt(v,"decoding")||"async",Ce=!!T||bo(v,"picture",!1)||!!G,Ee=B?Number.parseInt(B):void 0,Te=z?Number.parseInt(z):void 0,Re=V||"",_e="";if(T)Re=T.sources[T.fallback.format]||"",_e=F?Gc(F):"100vw";else if(!Re&&F&&se&&se!=="local"&&se!=="static")Re=Jc(E,Zc,se,G),_e=Gc(F);else if(!Re&&H){let pt=H.split(/\s+/).map((bt)=>Number.parseFloat(bt.replace("x","")));Re=yb(E,pt,Ee,se,G)}else if(F)_e=Gc(F);let Ae=[];if(oe)Ae.push(oe);if(Ee&&Te)Ae.push(`aspect-ratio:${Ee}/${Te}`);let Xe=[],Pe=ne==="blur"||ne==="color"||ne==="thumbhash";if(Pe&&!J){let pt=T?.placeholder?{dataUrl:T.placeholder.dataUrl,color:re}:Xc(E);if(pt&&ne==="color")Ae.push(`background-color:${pt.color}`),Xe.push("backgroundColor");else if(pt)Ae.push(`background-color:${pt.color}`),Ae.push(`background-image:url(${pt.dataUrl})`),Ae.push("background-size:cover"),Ae.push("background-repeat:no-repeat"),Xe.push("backgroundColor","backgroundImage");else{let bt=bb(Ee||16,Te||9,re);Ae.push(`background-image:url(${bt})`),Ae.push("background-size:cover"),Ae.push("background-repeat:no-repeat"),Xe.push("backgroundImage")}}else if(!Pe&&ne&&ne!=="empty"&&ne!=="none")Ae.push(`background-image:url(${Ft(ne)})`),Ae.push("background-size:cover"),Ae.push("background-repeat:no-repeat"),Xe.push("backgroundImage");let Ie=T?.fallback.url||wi(E,Ee,Te,se,G),Ze=[];if(Ze.push(`src="${Ft(Hs(Ie,"fetched"))}"`),Ze.push(`alt="${Ft(j)}"`),B)Ze.push(`width="${Ft(B)}"`);if(z)Ze.push(`height="${Ft(z)}"`);let rt=Se||(ve||me?"eager":ae?"lazy":"");if(rt)Ze.push(`loading="${Ft(rt)}"`);if(ve)Ze.push('fetchpriority="high"');if(Ze.push(`decoding="${Ft($e)}"`),ie)Ze.push(`class="${Ft(ie)}"`);if(Ae.length>0)Ze.push(`style="${Ft(Ae.join(";"))}"`);if(Re)Ze.push(`srcset="${Ft(Hs(Re,"fetched"))}"`);if(_e)Ze.push(`sizes="${Ft(_e)}"`);let at=new Set(["src","alt","width","height","lazy","sizes","srcset","placeholder","placeholderColor","class","className","style","format","provider","quality","densities","preload","priority","picture","loading","decoding"]);if(Xe.length>0){let pt=typeof v.static.onload==="string"?v.static.onload:"",bt=xb(Xe)+(pt?`;${pt}`:"");Ze.push(`onload="${Ft(bt)}"`),at.add("onload")}Ze.push(...xr(v,at)),Ze.push(...br(v,at));let Qe=`<img ${Ze.join(" ")} />`,ht="";if(me){let bt=G==="webp"?"image/webp":G==="avif"?"image/avif":"";ht=`<link rel="preload" as="image" href="${Ft(Ie)}"${bt?` type="${bt}"`:""}${Re?` imagesrcset="${Ft(Re)}"`:""}${_e?` imagesizes="${Ft(_e)}"`:""} />
1711
- `}if(Ce){let pt=[];if(T)for(let bt of ts(T))pt.push(`<source type="image/${bt.format}" srcset="${Ft(bt.srcset)}"${_e?` sizes="${Ft(_e)}"`:""} />`);if(!T&&(G==="avif"||G==="auto")){let bt=wi(E,Ee,Te,se,"avif"),ct=Re?Jc(E,Zc,se,"avif"):`${bt}`;pt.push(`<source type="image/avif" srcset="${Ft(ct)}"${_e?` sizes="${Ft(_e)}"`:""} />`)}if(!T&&(G==="webp"||G==="auto")){let bt=wi(E,Ee,Te,se,"webp"),ct=Re?Jc(E,Zc,se,"webp"):`${bt}`;pt.push(`<source type="image/webp" srcset="${Ft(ct)}"${_e?` sizes="${Ft(_e)}"`:""} />`)}return`${ht}<picture>
1706
+ </script>`}function wp(v,_,k){if(!xx(v))return v;let E=dx(v);if(E.length===0)return v;let T=yx(v,E),j=hx(E,_),B=T.lastIndexOf("</body>");if(B!==-1)T=T.slice(0,B)+j+`
1707
+ `+T.slice(B);else T+=j;return T}function yx(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 xx(v){return/x-data\s*=\s*["']/.test(v)}function mr(v,_){try{let k=v.trim();if(p(k))return l(k,Object.keys(_))(...Object.values(_));else return c(k,_)}catch{return!1}}function hr(v,_){let k=bx(v,_);return k.ok?{expression:k.expression,endPos:k.endPos}:null}function bx(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 vx(v,_){let k=v.lastIndexOf("<",_);if(k===-1)return!1;return k>v.lastIndexOf(">",_)}function Tr(v,_,k,E){let T=1,j=E,B=new RegExp(`@${_}\\s*\\(`,"g"),z=new RegExp(`@${k}(?![a-z])`,"g");while(j<v.length&&T>0){B.lastIndex=j,z.lastIndex=j;let F=B.exec(v),V=z.exec(v),H=F?F.index:1/0,G=V?V.index:1/0;if(H<G)T++,j=H+F[0].length;else if(G<1/0){if(T--,T===0)return G;j=G+V[0].length}else break}return-1}function Sp(v,_){let k=v.slice(_).match(/^@if\s*/);if(!k)return null;let E=_+k[0].length,T=hr(v,E);if(!T)return null;let j=T.endPos,B=Tr(v,"if","endif",j);if(B===-1)return null;let z=v.slice(j,B),F=[],V=0,H="if",G=T.expression,J=0,ne=0;while(V<z.length){let re=z.indexOf("@",V);if(re===-1)break;V=re;let se=z.substring(re);if(vx(z,re)){V++;continue}if(/^@if\s*\(/.test(se)){ne++,V++;continue}if(/^@endif(?![a-z])/.test(se)){ne--,V+=6;continue}if(ne===0){let ie=se.match(/^@elseif\s*/);if(ie){F.push({type:H,condition:G,content:z.substring(J,V),start:j+J,end:j+V});let oe=V+ie[0].length,ue=hr(z,oe);if(!ue){V++;continue}H="elseif",G=ue.expression,V=ue.endPos,J=V;continue}else if(/^@else(?![a-z])/.test(se)){F.push({type:H,condition:G,content:z.substring(J,V),start:j+J,end:j+V}),H="else",G=void 0,V+=5,J=V;continue}}V++}return F.push({type:H,condition:G,content:z.slice(J),start:j+J,end:j+z.length}),{fullMatch:v.slice(_,B+6),branches:F,start:_,end:B+6}}function Ys(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=Sp(v,E.index);if(j)_.push(j),k.lastIndex=j.end;E=k.exec(v)}return _}function io(v,_,k){let E=[],T=new RegExp(`@${_}\\s*\\(`,"g"),j=T.exec(v);while(j!==null){if(E.some((se)=>j.index>se.start&&j.index<se.end)){j=T.exec(v);continue}let z=j.index,F=z+j[0].length-1,V=S(v,"(",")",F);if(V===-1){j=T.exec(v);continue}let H=v.slice(F+1,V),G=V+1,J=Tr(v,_,k,G);if(J===-1){j=T.exec(v);continue}let ne=v.slice(G,J),re=J+`@${k}`.length;E.push({fullMatch:v.slice(z,re),name:_,params:H,content:ne,start:z,end:re}),T.lastIndex=re,j=T.exec(v)}return E}function Dc(v,_){let k=v.slice(_).match(/^@switch\s*/);if(!k)return null;let E=_+k[0].length,T=hr(v,E);if(!T)return null;let j=T.endPos,B=Tr(v,"switch","endswitch",j);if(B===-1)return null;let z=v.slice(j,B),F=[],V=0,H=null,G=0;while(V<z.length){let J=z.slice(V),ne=J.match(/^@switch\s*\(/),re=J.match(/^@endswitch(?![a-z])/);if(ne){if(G++,H)H.content+=ne[0];V+=ne[0].length;continue}if(re){if(G--,H)H.content+=re[0];V+=re[0].length;continue}if(G>0){if(H)H.content+=z[V];V++;continue}let se=J.match(/^@case\s*/),ie=J.match(/^@default(?![a-z])/),oe=J.match(/^@break(?![a-z])/);if(se&&J.startsWith("@case")){if(H)F.push(H);let ue=V+se[0].length,ae=hr(z,ue);if(!ae){V++;continue}H={type:"case",value:ae.expression,content:""},V=ae.endPos}else if(ie&&J.startsWith("@default")){if(H)F.push(H);H={type:"default",content:""},V+=ie[0].length}else if(oe&&J.startsWith("@break"))V+=oe[0].length;else{if(H)H.content+=z[V];V++}}if(H)F.push(H);return{fullMatch:v.slice(_,B+10),expression:T.expression,cases:F,start:_,end:B+10}}function _x(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=Dc(E,B);if(!z)break;try{let F;if(p(z.expression))F=l(z.expression,Object.keys(_))(...Object.values(_));else F=c(z.expression,_);let V="",H=!1;for(let G of z.cases)if(G.type==="default"){if(!H)V=G.content.trim()}else try{let J;if(G.value&&p(G.value))J=l(G.value,Object.keys(_))(...Object.values(_));else if(G.value)J=c(G.value,_);if(F===J){V=G.content.trim(),H=!0;break}}catch{continue}E=E.substring(0,B)+V+E.substring(z.end),T=!0}catch(F){let V=F instanceof Error?F.message:String(F),H=i("Switch",`Error evaluating @switch expression: ${V}`,t.EVALUATION_ERROR);E=E.substring(0,B)+H+E.substring(z.end);break}}return E}function kx(v){let _=[];return{masked:v.replace(/<script\b[\s\S]*?<\/script\s*>/gi,(E)=>(_.push(E),`\x00stx-script-${_.length-1}\x00`)),scripts:_}}function Ex(v,_){if(_.length===0)return v;return v.replace(/\u0000stx-script-(\d+)\u0000/g,(k,E)=>_[Number(E)]??k)}function ar(v,_,k){let{masked:E,scripts:T}=kx(v);return Ex(Cx(E,_,k),T)}function Cx(v,_,k){let E=v;E=_x(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=hr(E,z+7);if(!F)break;let V=F.endPos,H=Tr(E,"unless","endunless",V);if(H===-1){console.warn(`[stx] @unless directive at position ${z} has no matching @endunless \u2014 the block was skipped. Check for typos or missing closers.`);break}let G=E.slice(V,H),J=F.expression,ne=-1;{let se=0,ie=/@(?:if|unless)\s*\(/g,oe=/@(?:endif|endunless)(?![a-z])/g,ue=/@else(?![a-z])/g,ae=[],me;while((me=ie.exec(G))!==null)ae.push({pos:me.index,type:"open"});while((me=oe.exec(G))!==null)ae.push({pos:me.index,type:"close"});while((me=ue.exec(G))!==null)ae.push({pos:me.index,type:"else"});ae.sort((ve,Se)=>ve.pos-Se.pos);for(let ve of ae)if(ve.type==="open")se++;else if(ve.type==="close")se--;else if(ve.type==="else"&&se===0){ne=ve.pos;break}}let re;if(ne!==-1){let se=G.slice(0,ne),ie=G.slice(ne+5);re=`@if (${J})${ie}@else ${se}@endif`}else re=`@if (!(${J}))${G}@endif`;E=E.substring(0,z)+re+E.substring(H+10),j=!0}}E=Oc(E,_,k),E=Nc(E,_,k),E=Mc(E,_);let T=()=>{let j=Ys(E);if(j.length===0)return!1;let B=Array(j.length);for(let V=j.length-1;V>=0;V--){let H=j[V];try{let G="",J=!1;for(let ne of H.branches){if(J)break;if(ne.type==="else")G=ne.content,J=!0;else try{let re;if(ne.condition&&p(ne.condition))re=l(ne.condition,Object.keys(_))(...Object.values(_));else if(ne.condition)re=c(ne.condition,_);if(re)G=ne.content,J=!0}catch(re){G=i(ne.type==="if"?"If":"Elseif",`Error in @${ne.type}(${ne.condition}): ${re instanceof Error?re.message:String(re)}`,t.EVALUATION_ERROR),J=!0}}B[V]=G}catch(G){let J=G instanceof Error?G.message:String(G);B[V]=i("If",`Error processing @if block: ${J}`,t.EVALUATION_ERROR)}}let z=Array(j.length*2+1),F=0;for(let V=0;V<j.length;V++){let H=j[V];z[V*2]=E.slice(F,H.start),z[V*2+1]=B[V],F=H.end}return z[j.length*2]=E.slice(F),E=z.join(""),!0};while(!0){let j=E;if(!T())break;if(E===j)break}return E}function $p(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 Mc(v,_){let k=v;function E(z,F,V,H){let G=1,J=H,ne=new RegExp(`@${F}(?:\\s*\\(|\\s|$)`,"g"),re=new RegExp(`@${V}(?![a-z])`,"g");while(J<z.length&&G>0){ne.lastIndex=J,re.lastIndex=J;let se=ne.exec(z),ie=re.exec(z),oe=se?se.index:1/0,ue=ie?ie.index:1/0;if(oe<ue)G++,J=oe+se[0].length;else if(ue<1/0){if(G--,G===0)return ue;J=ue+ie[0].length}else break}return-1}function T(z,F,V){let H=0,G=new RegExp(`@${F}(?:\\s*\\(|\\s|$)`,"g"),J=new RegExp(`@${V}(?![a-z])`,"g"),ne=/@else(?![a-z])/g,re=[],se;while((se=G.exec(z))!==null)re.push({pos:se.index,type:"open"});while((se=J.exec(z))!==null)re.push({pos:se.index,type:"close"});while((se=ne.exec(z))!==null)re.push({pos:se.index,type:"else"});re.sort((ie,oe)=>ie.pos-oe.pos);for(let ie of re)if(ie.type==="open")H++;else if(ie.type==="close")H--;else if(ie.type==="else"&&H===0)return ie.pos;return-1}{let z=!0;while(z){z=!1;let F=k.match(/@auth(?:\s*\(|\s|(?=\n))/);if(!F||F.index===void 0)break;let V=F.index,H,G,J=k.slice(V+5),ne=$p(J);if(ne)H=ne.value,G=V+5+ne.consumed;else G=V+5;let re=E(k,"auth","endauth",G);if(re===-1){console.warn(`[stx] @auth directive at position ${V} has no matching @endauth \u2014 the block was skipped.`);break}let se=k.slice(G,re),ie=T(se,"auth","endauth"),oe;if(!_.auth)oe=!1;else oe=H?mr(`auth?.check && auth?.user?.[${H}]`,_):mr("auth?.check",_);let ue;if(ie!==-1){let ae=se.slice(0,ie),me=se.slice(ie+5);ue=oe?ae:me}else ue=oe?se:"";k=k.substring(0,V)+ue+k.substring(re+8),z=!0}}{let z=!0;while(z){z=!1;let F=k.match(/@guest(?:\s*\(|\s|(?=\n))/);if(!F||F.index===void 0)break;let V=F.index,H,G,J=k.slice(V+6),ne=$p(J);if(ne)H=ne.value,G=V+6+ne.consumed;else G=V+6;let re=E(k,"guest","endguest",G);if(re===-1){console.warn(`[stx] @guest directive at position ${V} has no matching @endguest \u2014 the block was skipped.`);break}let se=k.slice(G,re),ie=T(se,"guest","endguest"),oe;if(!_.auth)oe=!0;else oe=H?mr(`!auth?.check || !auth?.user?.[${H}]`,_):mr("!auth?.check",_);let ue;if(ie!==-1){let ae=se.slice(0,ie),me=se.slice(ie+5);ue=oe?ae:me}else ue=oe?se:"";k=k.substring(0,V)+ue+k.substring(re+9),z=!0}}function j(z,F,V){if(_.userCan&&typeof _.userCan[z]==="boolean")return _.userCan[z];if(_.permissions?.check&&typeof _.permissions.check==="function")try{let H=[z];if(F)H.push(F);if(V){let G=mr(V,_);H.push(G)}return _.permissions.check(...H)}catch{return!1}return!1}function B(z){let F=z.match(/^\s*\(\s*'([^']*)'(?:,\s*'([^']*)')?(?:,\s*([^)]*))?\)/);if(!F)return null;return{ability:F[1],type:F[2],id:F[3]?.trim(),paramsEnd:F[0].length}}for(let z of["can","cannot"]){let F=`end${z}`,V=z==="can"?"elsecan":"elsecannot",H=!0;while(H){H=!1;let G=k.match(new RegExp(`@${z}\\s*\\(`));if(!G||G.index===void 0)break;let J=G.index,ne=k.slice(J+`@${z}`.length),re=B(ne);if(!re)break;let se=J+`@${z}`.length+re.paramsEnd,ie=E(k,z,F,se);if(ie===-1){console.warn(`[stx] @${z} directive at position ${J} has no matching @${F} \u2014 the block was skipped.`);break}let oe=k.slice(se,ie),ue=[],ae=0,me=new RegExp(`@${z}\\s*\\(`,"g"),ve=new RegExp(`@${F}(?![a-z])`,"g"),Se=new RegExp(`@${V}\\s*\\(`,"g"),$e=/@else(?![a-z])/g,Ce=[],Ee;while((Ee=me.exec(oe))!==null)Ce.push({pos:Ee.index,type:"open"});while((Ee=ve.exec(oe))!==null)Ce.push({pos:Ee.index,type:"close"});while((Ee=Se.exec(oe))!==null)Ce.push({pos:Ee.index,type:"elseDirective"});while((Ee=$e.exec(oe))!==null)Ce.push({pos:Ee.index,type:"else"});Ce.sort((Pe,Ie)=>Pe.pos-Ie.pos);for(let Pe of Ce){if(Pe.type==="open"){ae++;continue}if(Pe.type==="close"){ae--;continue}if(ae===0)ue.push(Pe)}let Te=[],Re=0;for(let Pe=0;Pe<ue.length;Pe++){let Ie=ue[Pe];if(Te.push({content:oe.slice(Re,Ie.pos),ability:void 0}),Ie.type==="elseDirective"){let Ze=oe.slice(Ie.pos+`@${V}`.length),rt=B(Ze);if(rt){Te[Te.length-1]={content:oe.slice(Re,Ie.pos)},Re=Ie.pos+`@${V}`.length+rt.paramsEnd,Te.push({content:"",ability:rt.ability,type:rt.type,id:rt.id}),Te.pop();let at=ue[Pe+1],Qe=at?at.pos:oe.length;Te.push({content:oe.slice(Re,Qe),ability:rt.ability,type:rt.type,id:rt.id}),Re=Qe}}else Re=Ie.pos+5}if(Re<oe.length){let Pe=Te[Te.length-1];if(ue.length>0&&ue[ue.length-1].type==="else")Te.push({content:oe.slice(Re),isFinalElse:!0});else if(Te.length===0)Te.push({content:oe.slice(Re)})}let _e=j(re.ability,re.type,re.id),Ae=z==="can"?_e:!_e,Xe="";if(Ae)Xe=Te[0]?.content||"";else{let Pe=!1;for(let Ie=1;Ie<Te.length;Ie++){let Ze=Te[Ie];if(Ze.isFinalElse){Xe=Ze.content,Pe=!0;break}if(Ze.ability){let rt=j(Ze.ability,Ze.type,Ze.id);if(z==="can"?rt:!rt){Xe=Ze.content,Pe=!0;break}}}if(!Pe&&Te.length>0){let Ie=Te[Te.length-1];if(Ie.isFinalElse)Xe=Ie.content}}k=k.substring(0,J)+Xe+k.substring(ie+`@${F}`.length),H=!0}}return k}function Oc(v,_,k){let E=v;function T(j,B,z,F,V){let H=!0;while(H){H=!1;let G=new RegExp(`@${B}\\s*\\(`),J=j.match(G);if(!J||J.index===void 0)break;let ne=J.index,re=hr(j,ne+`@${B}`.length);if(!re)break;let se=re.endPos,ie=Tr(j,B,z,se);if(ie===-1){console.warn(`[stx] @${B} directive at position ${ne} has no matching @${z} \u2014 the block was skipped.`);break}let oe=j.slice(se,ie),ue=re.expression,ae=-1,me=0,ve=0;while(ve<oe.length){let Se=oe.indexOf("@",ve);if(Se===-1)break;let $e=oe.substring(Se);if(/^@(?:if|unless|isset|empty)\s*\(/.test($e)){me++,ve=Se+1;continue}if(/^@(?:endif|endunless|endisset|endempty)(?![a-z])/.test($e)){me--,ve=Se+1;continue}if(me===0&&/^@else(?![a-z])/.test($e)){ae=Se;break}ve=Se+1}try{let Se=F(ue.trim()),$e;if(ae!==-1){let Ce=oe.slice(0,ae),Ee=oe.slice(ae+5);$e=Se?Ce:Ee}else $e=Se?oe:"";j=j.substring(0,ne)+$e+j.substring(ie+`@${z}`.length),H=!0}catch(Se){let $e=Se instanceof Error?Se.message:String(Se),Ce=i(V,`Error processing @${B} directive: ${$e}`,t.EVALUATION_ERROR);j=j.substring(0,ne)+Ce+j.substring(ie+`@${z}`.length);break}}return j}return E=T(E,"isset","endisset",(j)=>{let B=mr(j,_);return B!==void 0&&B!==null},"Isset"),E=T(E,"empty","endempty",(j)=>{let B=mr(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 Nc(v,_,k){let E=v,T="development";function j(B,z,F,V){let H=new RegExp(`@${z}(?![a-z])`,"g"),G=new RegExp(`@${F}(?![a-z])`,"g"),J=new RegExp(`^@${z}(?![a-z])`),ne=new RegExp(`^@${F}(?![a-z])`),re=B,se=!0;while(se){se=!1,H.lastIndex=0;let ie=H.exec(re);if(!ie)break;let oe=ie.index,ue=oe+ie[0].length;if(z==="env"){let _e=re.substring(ue).match(/^\s*\(\s*(['"])([^'"]+)\1\s*\)/);if(!_e)break;ue+=_e[0].length,V=T===_e[2]}let ae=1,me=ue,ve=-1;while(ae>0&&me<re.length){H.lastIndex=me,G.lastIndex=me;let _e=H.exec(re),Ae=G.exec(re),Xe=_e?_e.index:1/0,Pe=Ae?Ae.index:1/0;if(Xe<Pe)ae++,me=Xe+_e[0].length;else if(Pe<1/0){if(ae--,ae===0){ve=Pe;break}me=Pe+Ae[0].length}else break}if(ve===-1){console.warn(`[stx] @${z} directive at position ${oe} has no matching @${F} \u2014 the block was skipped.`);break}let Se=re.substring(ue,ve),$e=-1,Ce=0,Ee=0;while(Ee<Se.length){let _e=Se.indexOf("@",Ee);if(_e===-1)break;let Ae=Se.substring(_e);if(J.test(Ae)){Ce++,Ee=_e+1;continue}if(ne.test(Ae)){Ce--,Ee=_e+1;continue}if(Ce===0&&/^@else(?![a-z])/.test(Ae)){$e=_e;break}Ee=_e+1}let Te;if($e!==-1){let _e=Se.slice(0,$e),Ae=Se.slice($e+5);Te=V?_e:Ae}else Te=V?Se:"";let Re=`@${F}`.length;re=re.substring(0,oe)+Te+re.substring(ve+Re),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 _p=new WeakMap;function kp(v=16){let _=new Uint8Array(v);return crypto.getRandomValues(_),btoa(String.fromCharCode(..._))}function oo(v,_){if(!v)return _?.nonceGenerator?.()??kp();let k=_p.get(v);if(!k)k=_?.nonceGenerator?.()??kp(),_p.set(v,k);return k}function Rx(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 Ep(v,_){return`<meta http-equiv="Content-Security-Policy" content="${Rx(v,_).replace(/&/g,"&amp;").replace(/"/g,"&quot;")}">`}function Cp(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?oo(k,_):void 0,T=Ep(_.directives,E);return v.replace(/<head([^>]*)>/,`<head$1>
1708
+ ${T}`)}function Rp(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?oo(_,j):void 0;return Ep(j.directives,B)}),T=T.replace(/@cspNonce\b/g,()=>{if(!j?.enabled||!j.useNonce)return"";return oo(_,j)}),j?.enabled&&j.useNonce)_.cspNonce=oo(_,j);return T}import Tx from"crypto";var Ax=40,Ap="_token",jc=null;function Ix(v=Ax){let _=Tx.randomBytes(Math.ceil(v/2)).toString("hex").slice(0,v);return jc=_,_}function Px(){if(!jc)Ix();return jc}function Dx(v=Ap){let _=Px();return`<input type="hidden" name="${v}" value="${_}">`}function Ip(v){return v.replace(/@csrf(?:\((['"])([^'"]*)\1\))?/g,(_,k,E)=>Dx(E||Ap))}async function Pp(v,_,k,E){if(!E.customDirectives||E.customDirectives.length===0)return v;let T=v;for(let j of E.customDirectives){if(!j.name||typeof j.handler!=="function"){if(E.debug)console.warn("Invalid custom directive:",j);continue}if(j.hasEndTag)T=await Mx(T,j,_,k,E);else T=await Ox(T,j,_,k,E)}return T}async function Mx(v,_,k,E,T){let{name:j,handler:B}=_,z=`@${j}`,F=`@end${j}`,V=v,H=$r(`${z}(?:\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\))?([\\s\\S]*?)${F}`,"g"),G=[],J=H.exec(V);while(J!==null){let[ne,re="",se=""]=J,ie=J.index||0;try{let oe=re?Dp(_,re):[],ue=se.trim(),ae=await B(ue,oe,k,E);G.push({original:ne,processed:ae,startIndex:ie})}catch(oe){let ue=oe instanceof Error?oe.message:String(oe);if(T.debug)console.error(`Error processing custom directive @${j}:`,oe);G.push({original:ne,processed:i("CustomDirective",`Error in @${j}${re?`(${re})`:""}: ${ue}`,t.EVALUATION_ERROR),startIndex:ie})}J=H.exec(V)}for(let ne=G.length-1;ne>=0;ne--){let{original:re,processed:se}=G[ne];V=V.replace(re,se)}return V}async function Ox(v,_,k,E,T){let{name:j,handler:B}=_,z=v,F=[],V=[];if(_.rawParams){for(let J of Ts(z,$r(`(?<![\\w$@])@${j}\\s*\\(`,"g")))if(J.end!==-1)V.push({fullMatch:J.call,paramString:J.args,startIndex:J.start})}else{let J=$r(`@${j}\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\)`,"g");J.lastIndex=0;let ne=J.exec(z);while(ne!==null)V.push({fullMatch:ne[0],paramString:ne[1]??"",startIndex:ne.index||0}),ne=J.exec(z)}for(let{fullMatch:J,paramString:ne,startIndex:re}of V)try{let se=Dp(_,ne),ie=await B("",se,k,E);F.push({original:J,processed:ie,startIndex:re})}catch(se){let ie=se instanceof Error?se.message:String(se);if(T.debug)console.error(`Error processing custom directive @${j}:`,se);F.push({original:J,processed:i("CustomDirective",`Error in @${j}(${ne}): ${ie}`,t.EVALUATION_ERROR),startIndex:re})}let H=$r(`@${j}(?!\\w)(?!\\s*\\()`,"g"),G=H.exec(z);while(G!==null){let[J]=G,ne=G.index||0;try{let re=await B("",[],k,E);F.push({original:J,processed:re,startIndex:ne})}catch(re){let se=re instanceof Error?re.message:String(re);if(T.debug)console.error(`Error processing custom directive @${j}:`,re);F.push({original:J,processed:i("CustomDirective",`Error in @${j}: ${se}`,t.EVALUATION_ERROR),startIndex:ne})}G=H.exec(z)}for(let J=F.length-1;J>=0;J--){let{original:ne,processed:re}=F[J];z=z.replace(ne,re)}return z}function Dp(v,_){return v.rawParams?Ge(_):Nx(_)}function Nx(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 Mp=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,Op=/^[A-Za-z_$][\w$]*$/,jx=new Set(["light","dark","system"]);function Ar(v,_){if(typeof v!=="string"||v.length===0)throw Error(`@appearanceBootstrap ${_} must be a non-empty string`)}function Lx(v){if(!v||typeof v!=="object"||Array.isArray(v))throw Error("@appearanceBootstrap expects an options object");let _=v,{appearance:k,colorMode:E}=_;if(Ar(_.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(Ar(E.key,"colorMode.key"),Ar(E.attribute,"colorMode.attribute"),Ar(E.default,"colorMode.default"),!Op.test(E.key))throw Error("@appearanceBootstrap preference keys must be JavaScript property names");if(!Mp.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(Ar(k.key,"appearance.key"),Ar(k.attribute,"appearance.attribute"),Ar(k.default,"appearance.default"),!Op.test(k.key))throw Error("@appearanceBootstrap preference keys must be JavaScript property names");if(!Mp.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 Bx(v){return JSON.stringify(v).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function zx(v){return`<script data-stx-scoped data-stx-appearance-bootstrap>(function(){"use strict";const config=${Bx(v)};const root=document.documentElement;const MODES=["light","dark","system"];let format="json";const forced=(function(){const found={colorMode:null,appearance:null};if(!config.respectExisting)return found;try{const mode=root.getAttribute("data-"+config.colorMode.attribute);if(mode==="light"||mode==="dark")found.colorMode=mode;if(config.appearance){const name=root.getAttribute("data-"+config.appearance.attribute);if(config.appearance.allowed.includes(name))found.appearance=name}}catch{}return found}());function read(){let stored={};try{const raw=localStorage.getItem(config.storageKey);if(raw){let parsed=null;try{parsed=JSON.parse(raw)}catch{parsed=raw}if(parsed&&typeof parsed==="object"&&!Array.isArray(parsed)){stored=parsed;format="json"}else if(typeof parsed==="string"&&MODES.includes(parsed)){stored={};stored[config.colorMode.key]=parsed;format="string"}}}catch{}return stored}function write(stored){try{if(format==="string"&&!config.appearance)localStorage.setItem(config.storageKey,stored[config.colorMode.key]);else localStorage.setItem(config.storageKey,JSON.stringify(stored))}catch{}}function resolve(){const stored=read();const state={colorMode:forced.colorMode||(MODES.includes(stored[config.colorMode.key])?stored[config.colorMode.key]:config.colorMode.default)};if(config.appearance)state.appearance=forced.appearance||(config.appearance.allowed.includes(stored[config.appearance.key])?stored[config.appearance.key]:config.appearance.default);return state}function prefersDark(){try{return matchMedia("(prefers-color-scheme: dark)").matches}catch{return false}}function apply(){const state=resolve();const dark=state.colorMode==="dark"||(state.colorMode==="system"&&prefersDark());if(config.appearance)root.setAttribute("data-"+config.appearance.attribute,state.appearance);root.setAttribute("data-"+config.colorMode.attribute,state.colorMode);root.classList.toggle("dark",dark);root.dataset.theme=dark?"dark":"light";state.dark=dark;try{window.dispatchEvent(new CustomEvent("stx:appearance",{detail:state}))}catch{}return state}function store(key,allowed,value){if(allowed.includes(value)){const stored=read();stored[key]=value;write(stored)}return apply()}window.__stxAppearance={config:config,forced:forced,read:read,resolve:resolve,apply:apply,setColorMode:function(mode){return store(config.colorMode.key,MODES,mode)},setAppearance:function(name){return config.appearance?store(config.appearance.key,config.appearance.allowed,name):apply()},watchSystem:function(){try{matchMedia("(prefers-color-scheme: dark)").addEventListener("change",function(){if(resolve().colorMode==="system")apply()})}catch{}}};apply()}());</script>`}function Fx(v,_){let k=1,E=null,T=!1;for(let j=_+1;j<v.length;j++){let B=v[j];if(T){T=!1;continue}if(E){if(B==="\\")T=!0;else if(B===E)E=null;continue}if(B==='"'||B==="'"||B==="`"){E=B;continue}if(B==="(")k++;else if(B===")"&&--k===0)return j}return-1}function Np(v,_){let k=v,E=/@appearanceBootstrap\s*\(/g,T;while((T=E.exec(k))!==null){let j=T.index+T[0].length-1,B=Fx(k,j);if(B===-1)throw Error("@appearanceBootstrap has an unclosed options object");let z=k.slice(j+1,B).trim(),F=c(`(${z})`,_),V=zx(Lx(F));k=k.slice(0,T.index)+V+k.slice(B+1),E.lastIndex=T.index+V.length}return k}import Vx from"crypto";function Wt(v){return String(v??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}var Lp={input:"form-control",inputError:"is-invalid",checkInput:"form-check-input",label:"form-label",errorFeedback:"invalid-feedback"};function ao(v,_,k,E){let T=v||_;return k?`${T} ${E}`:T}function vn(v){return String(v).replace(/\[\]$/,"").replace(/[^\w.:-]+/g,"-").replace(/^-+|-+$/g,"")}function vs(v,_){if(/\bid\s*=/i.test(v))return"";return` id="${Wt(_)}"`}function Lc(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="${Wt(`${vn(v)}-error`)}"`;return E}function Wx(){return Vx.randomUUID()}function co(v,_){let k=v;return k=k.replace(/@csrf/g,()=>{if(!_.csrf||typeof _.csrf!=="object"){let E=Wx();_.csrf={token:E}}if(_.csrf.field)return _.csrf.field;if(_.csrf.token)return`<input type="hidden" name="_token" value="${Wt(_.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="${Wt(j)}">`;return E}),k}function Bp(v,_,k=Lp){let E=v;return E=E.replace(/@form\(\s*(?:(?:'([^']+)'|"([^"]+)")\s*)?(?:,\s*(?:'([^']+)'|"([^"]+)")?)?\s*(?:,\s*\{([^}]+)\}\s*)?\)/g,(T,j,B,z,F,V="")=>{let H=j||B||"POST",G=z||F||"",J=yr(V),ne=H.toUpperCase(),re=["GET","POST"].includes(ne)?ne:"POST",se=`<form method="${Wt(re)}" action="${Wt(G)}"${J?` ${J}`:""}>`;if(se+=`
1709
+ ${co("@csrf",_)}`,!["GET","POST"].includes(ne))se+=`
1710
+ ${co(`@method('${ne}')`,_)}`;return se}),E=E.replace(/@endform/g,"</form>"),E=E.replace(/@input\(\s*(?:'([^']+)'|"([^"]+)")\s*(?:,\s*(?:(?:'([^']*)'|"([^"]*)")\s*)?)?(?:,\s*\{([^}]+)\})?\s*\)/g,(T,j,B,z,F,V="")=>{let H=j||B||"",G=z||F||"",J=yr(V),ne=Qs(H,_),re=ne!==void 0&&ne!==null?ne:G||"",se=J.match(/type=['"]([^'"]+)['"]/i),ie=se?se[1]:"text",oe=fi(H,_),ue=J.match(/class=['"]([^'"]+)['"]/i),ae=ao(ue?ue[1]:"",k.input,oe,k.inputError),me=J.replace(/class=['"][^'"]+['"]/i,"");return me=me.replace(/type=['"][^'"]+['"]/i,""),`<input type="${Wt(ie)}" name="${Wt(H)}"${vs(J,vn(H))} value="${Wt(re)}" class="${ae}"${Lc(H,oe,J)}${me?` ${me}`:""}>`}),E=E.replace(/@textarea\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endtextarea/g,(T,j,B="",z="")=>{let F=yr(B),V=Qs(j,_)||z.trim(),H=fi(j,_),G=F.match(/class=['"]([^'"]+)['"]/i),J=ao(G?G[1]:"",k.input,H,k.inputError),ne=F.replace(/class=['"][^'"]+['"]/i,"");return`<textarea name="${Wt(j)}"${vs(F,vn(j))} class="${J}"${Lc(j,H,F)}${ne?` ${ne}`:""}>${Wt(V)}</textarea>`}),E=E.replace(/@select\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endselect/g,(T,j,B="",z)=>{let F=yr(B),V=Qs(j,_),H=fi(j,_),G=F.match(/class=['"]([^'"]+)['"]/i),J=ao(G?G[1]:"",k.input,H,k.inputError),ne=F.replace(/class=['"][^'"]+['"]/i,""),re=z;if(V!==void 0)re=z.replace(/(<option[^>]*value=['"]([^'"]+)['"][^>]*>)/gi,(se,ie,oe)=>{if((Array.isArray(V)?V.some((ae)=>String(ae)===oe):String(V)===oe)&&!ie.includes("selected"))return ie.replace(/(<option)/,"$1 selected");return se});return`<select name="${Wt(j)}"${vs(F,vn(j))} class="${J}"${Lc(j,H,F)}${ne?` ${ne}`:""}>${re}</select>`}),E=E.replace(/@checkbox\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?(?:,\s*\{([^}]+)\})?\)/g,(T,j,B,z="")=>{let F=B===void 0?"1":B,V=B===void 0?vn(j):`${vn(j)}-${vn(F)}`,H=yr(z),G=Qs(j,_),J=G!==void 0&&(Array.isArray(G)?G.some((ie)=>String(ie)===F):G===!0||String(G)===F),ne=H.match(/class=['"]([^'"]+)['"]/i),re=ne?ne[1]:k.checkInput,se=H.replace(/class=['"][^'"]+['"]/i,"");return`<input type="checkbox" name="${Wt(j)}"${vs(H,V)} value="${Wt(F)}" class="${re}"${J?" checked":""}${se?` ${se}`:""}>`}),E=E.replace(/@radio\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(T,j,B,z="")=>{let F=yr(z),V=Qs(j,_),H=V!==void 0&&V===B,G=F.match(/class=['"]([^'"]+)['"]/i),J=G?G[1]:k.checkInput,ne=F.replace(/class=['"][^'"]+['"]/i,"");return`<input type="radio" name="${Wt(j)}"${vs(F,`${vn(j)}-${vn(B)}`)} value="${Wt(B)}" class="${J}"${H?" checked":""}${ne?` ${ne}`:""}>`}),E=E.replace(/@file\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(T,j,B="")=>{let z=yr(B),F=z.match(/accept=['"]([^'"]+)['"]/i),V=F?F[1]:"",H=z.includes("multiple"),G=fi(j,_),J=z.match(/class=['"]([^'"]+)['"]/i),ne=ao(J?J[1]:"",k.input,G,k.inputError),re=z.replace(/class=['"][^'"]+['"]/gi,"").replace(/accept=['"][^'"]+['"]/gi,"").replace(/\bmultiple\b/gi,"").trim(),se=[`<input type="file" name="${Wt(j)}"${vs(z,vn(j))}`,`class="${ne}"`];if(V)se.push(`accept="${Wt(V)}"`);if(H)se.push("multiple");if(re)se.push(re);return`${se.join(" ")}>`}),E=E.replace(/@label\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endlabel/g,(T,j,B="",z)=>{let F=yr(B),V=F.match(/class=['"]([^'"]+)['"]/i),H=V?V[1]:k.label,G=F.replace(/class=['"][^'"]+['"]/i,"");return`<label for="${Wt(vn(j))}" class="${H}"${G?` ${G}`:""}>${z}</label>`}),E}function zp(v,_,k=Lp){return v.replace(/@error\(['"]([^'"]+)['"]\)([\s\S]*?)@enderror/g,(E,T,j)=>{try{if(fi(T,_)){let B=j.replace(/\{\{([^}]+)\}\}/g,(z,F)=>{try{if(F.trim()==="$message"||F.trim()==="message")return jp(T,_);if(F.trim().includes("errors.first")||F.trim().includes("$errors.first")){if(typeof _.errors?.first==="function")return _.errors.first(T);return jp(T,_)}let V=F.trim();if(p(V)){let H=c(V,_);return H!==void 0?String(H):V}return V}catch{return F}});return`<div id="${Wt(`${vn(T)}-error`)}" role="alert">${B}</div>`}return""}catch(B){return console.error("Error processing @error directive:",B),E}})}function fi(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 jp(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 Qs(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 yr(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 hi=/<\/?template\b[^>]*>/gi,Ux=/(?:^|\s)(?:id\s*=|(?:x-|[@:])(?:for|if|else(?:-if)?)(?=\s|=|$)|#[\w-]+(?:\s*=|\s|$)|v-slot(?::[\w-]+)?(?=\s|=|$)|slot\s*=)/i;function Hx(v){let _=v.replace(/^<template\b/i,"").replace(/>$/,"");return Ux.test(_)}function Z(v){hi.lastIndex=0;let _;while((_=hi.exec(v))!==null){if(_[0].startsWith("</")||Hx(_[0]))continue;let k=_.index,E=hi.lastIndex,T=1,j;while((j=hi.exec(v))!==null)if(j[0].startsWith("</")){if(T--,T===0){let B=j.index;return{start:k,openEnd:E,closeStart:B,end:hi.lastIndex,content:v.slice(E,B)}}}else T++;return null}return null}import Ot from"path";import{existsSync as dv}from"fs";import lo from"fs";import zt from"path";var Fp=new Map;function uo(v,_=!0){let k=Fp.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=lo.readdirSync(B,{withFileTypes:!0})}catch{return}for(let V of F){let H=zt.join(B,V.name);if(V.isDirectory()){if(V.name==="node_modules"||V.name.startsWith("."))continue;j(H,z+1)}else if(V.isFile()&&V.name.endsWith(".stx")){let G=V.name.slice(0,-4);if(!E.has(G))E.set(G,H);let J=G.toLowerCase();if(!E.has(J))E.set(J,H);let ne=G.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(!E.has(ne))E.set(ne,H)}}}for(let B of T)if(j(B,0),E.size>0)break;if(_)Fp.set(v,E);return E}function po(v,_){if(v.startsWith(".")||v.startsWith("/"))return null;let k=_;while(!0){let E=zt.join(k,"node_modules",v);try{if(lo.statSync(E).isDirectory())return E}catch{}let T=zt.dirname(k);if(T===k)return null;k=T}}function fo(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 Vp(v){let _=v.endsWith(".stx")?v.slice(0,-4):v,k=_.split("-").map((T)=>T.charAt(0).toUpperCase()+T.slice(1)).join(""),E=_.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();return[_,k,E]}function Bc(v,_){let[k,E,T]=Vp(v);for(let j of[k,k.toLowerCase(),E,T]){let B=_?.__importedComponents?.get(j);if(B!==void 0)return B}}function*zc(v,_,k={},E){let T=Vp(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 lo.readdirSync(F,{withFileTypes:!0}))if(V.isDirectory())for(let H of j)yield zt.join(F,V.name,H)}catch{}}}function Wp(v,_,k={},E){let T=Bc(v,E);if(T!==void 0)return T;for(let j of zc(v,_,k,E))try{if(lo.statSync(j,{throwIfNoEntry:!1})?.isFile())return j}catch{}return null}class Up{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=Bc(v,E);if(T!==void 0)return T;for(let j of zc(v,_,k,E))if(await r(j))return j;return null}}var Ss=new Up;function Lt(v){return v.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}var Ir="\x00stx-boolean-attribute";function Fc(v){return v.indexOf("\x00")===-1?v:v.replace(/\0/g,"")}function xr(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===Ir){k.push(Lt(j));continue}k.push(`${Lt(j)}="${Lt(Fc(String(T)))}"`)}return k}function br(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(Fc(String(T)))}"`)}return k}function Is(v){return v.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function qx(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 Vc={name:"StxLink",aliases:["stx-link"],render(v,_,k){let E=qx(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="${Is(E.value)}"`);else F.push(`href="${Is(Us(E.value,"navigable"))}"`);if(T)F.push(`class="${Is(T)}"`);if(F.push("data-stx-link"),F.push(`data-stx-active-class="${Is(j)}"`),F.push(`data-stx-exact-active-class="${Is(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="${Is(V)}"`);let H=new Set(["to","class","className","activeClass","exactActiveClass","activeMatch","prefetch"]);return F.push(...xr(v,H)),F.push(...br(v,H)),`<a ${F.join(" ")}>${_}</a>`}};import{createHash as nf}from"crypto";import Yt from"fs";import Ut from"path";import{decode as eb,generateThumbHash as tb}from"ts-images";import{createImageDeliveryCatalog as Gp}from"ts-images/delivery";import Wc from"fs";function go(v,_,k){let E=Buffer.alloc(k),T=Wc.readSync(v,E,0,k,_);return E.subarray(0,T)}function Uc(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 Hc(v){let _;try{_=Wc.openSync(v,"r");let k=go(_,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=go(_,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(Uc(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)Wc.closeSync(_)}}import Kx from"fs";import mo from"os";import{join as Hp}from"path";import{fileURLToPath as qp}from"url";import{Worker as Kp}from"worker_threads";var yo=Symbol("stx.image-worker.unavailable");function Xx(v=typeof mo.availableParallelism==="function"?mo.availableParallelism():mo.cpus().length){return Math.max(1,Math.min(2,v-1))}var ho=0,Zp=[];async function Zx(){if(ho<Xx()){ho++;return}await new Promise((v)=>Zp.push(v)),ho++}function Gx(){ho--,Zp.shift()?.()}var Jx="@stacksjs/stx/builtins/image-warmup-worker";function Yx(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:"&&Kx.existsSync(qp(k)))return qp(k)}catch{}try{let k=typeof Bun<"u"?Bun.resolveSync(Jx,v):void 0;return k&&Qx(k)?k:void 0}catch{return}}function Qx(v,_=process.env){let k=v.replace(/\\/g,"/");if(k.split("/").some((T)=>/@\d[^/]*@@@\d+$/.test(T)))return!1;return![_.BUN_INSTALL_CACHE_DIR,Hp(_.BUN_INSTALL||Hp(mo.homedir(),".bun"),"install","cache")].filter((T)=>!!T).map((T)=>`${T.replace(/\\/g,"/").replace(/\/$/,"")}/`).some((T)=>k.startsWith(T))}var Xp=!1;function yi(v){if(!Xp)Xp=!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 yo}function qc(v){return v instanceof Error?v.message:String(v)}async function Kc(v,_){if(typeof Kp!=="function")return yi("node:worker_threads has no Worker in this runtime");let k=Yx();if(!k)return yi("no image-warmup-worker entry beside this module or in the installed @stacksjs/stx");await Zx();try{return await new Promise((E,T)=>{let j;try{j=new Kp(k)}catch(V){E(yi(`could not start ${k}: ${qc(V)}`));return}let B=!1,z=!1,F=(V)=>{if(z)return;z=!0,V(),j.terminate()};j.on("message",(V)=>{if(V.type==="ready"){B=!0,j.postMessage({task:v,args:_});return}if(V.type==="result"){F(()=>E(V.value));return}let H=Error(V.error?.message??"image worker failed");if(V.error?.name)H.name=V.error.name;if(V.error?.stack)H.stack=V.error.stack;F(()=>T(H))}),j.on("error",(V)=>{F(()=>B?T(V instanceof Error?V:Error(qc(V)||"image worker crashed")):E(yi(`the worker failed before it was ready: ${qc(V)}`)))}),j.on("exit",(V)=>{F(()=>B?T(Error("image worker exited before it finished")):E(yi(`the worker exited with code ${V} before it was ready`)))})})}finally{Gx()}}var nb=new Set([".avif",".jpeg",".jpg",".png",".webp"]),rb=[320,640,960,1280,1920],bo="/_stx/images",sb=`stx:${bo}:alpha-1`,ib=["@stacksjs/ts-webp","@stacksjs/ts-avif"],xo;function ob(v,_){let k=Ut.dirname(Bun.resolveSync(v,_));while(k!==Ut.dirname(k)){let E=Ut.join(k,"package.json");if(Yt.existsSync(E)){let T=JSON.parse(Yt.readFileSync(E,"utf8"));if(T.name===v)return T.version}k=Ut.dirname(k)}return}function ab(){if(xo!==void 0)return xo;let v;try{v=Ut.dirname(Bun.resolveSync("ts-images",import.meta.dir))}catch{}return xo=ib.map((_)=>{let k;try{k=v?ob(_,v):void 0}catch{}return`${_.replace("@stacksjs/","")}@${k??"unknown"}`}).join("+"),xo}var Jp=Symbol.for("stx.image-delivery");function xi(){let v=globalThis;return v[Jp]??={catalog:new Map,transparent:new Set},v[Jp]}var Yp=new Set;function cb(v){return`/${v.split(Ut.sep).map(encodeURIComponent).join("/")}`}function lb(v){let _=Ut.extname(v),k=v.slice(0,-_.length).replace(/[^a-zA-Z0-9_-]+/g,"-").replace(/^-+|-+$/g,""),E=nf("sha256").update(v).digest("hex").slice(0,8);return`${k||"image"}-${E}`}function Qp(v,_=`stx:${bo}`){let k=(E)=>`${bo}/${E.split("/").map(encodeURIComponent).join("/")}`;return{cacheNamespace:_,async stat(E){let T=Ut.join(v,E);try{let j=await Yt.promises.stat(T);return j.size>0?{bytes:j.size,path:T,url:k(E)}:null}catch{return null}},async write(E,T){let j=Ut.join(v,E);await Yt.promises.mkdir(Ut.dirname(j),{recursive:!0});let B=`${j}.${process.pid}.tmp`;return await Yt.promises.writeFile(B,T),await Yt.promises.rename(B,j),{bytes:T.byteLength,path:j,url:k(E)}},url:k}}async function rf(v,_=v){let k=await Yt.promises.readdir(_,{withFileTypes:!0});k.sort((T,j)=>T.name.localeCompare(j.name));let E=[];for(let T of k){let j=Ut.join(_,T.name);if(T.isDirectory()){E.push(...await rf(v,j));continue}if(!T.isFile()||!nb.has(Ut.extname(T.name).toLowerCase()))continue;E.push({absolutePath:j,relativePath:Ut.relative(v,j)})}return E}function ef(v,_){return v.map((k)=>({key:cb(k.relativePath),input:k.absolutePath,name:lb(k.relativePath),...ub(k.absolutePath)?{options:{storage:_}}:{}}))}function ub(v){return Hc(v)==="possible"}function db(v){for(let _=3;_<v.length;_+=4)if(v[_]!==255)return!0;return!1}async function pb(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 eb(new Uint8Array(await Yt.promises.readFile(z?.path??B.fallback.path)));if(db(F.data))k.add(j)}catch{k.add(j)}}));return k}function fb(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=Yt.openSync(z.path,"r"),!Uc(go(F,0,32))}catch{return!0}finally{if(F!==void 0)Yt.closeSync(F)}}))continue;if(T.variants=T.variants.filter((z)=>z.format!=="webp"),delete T.sources.webp,k.push(E),!Yp.has(E))Yp.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 gb(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 tb(B.absolutePath),B}catch{return console.warn(`[stx-images] Skipping unreadable raster: ${B.relativePath}`),null}}));_.push(...j.filter((B)=>B!==null))}return _}function Xc(v){return Ut.join(v,"undecodable.json")}function mb(v){try{let _=Yt.readFileSync(Xc(v),"utf-8"),k=JSON.parse(_);return k&&typeof k==="object"?k:{}}catch{return{}}}function hb(v,_){try{Yt.mkdirSync(Ut.dirname(Xc(v)),{recursive:!0}),Yt.writeFileSync(Xc(v),JSON.stringify(_))}catch{}}function tf(v){try{let _=Yt.statSync(v);return{mtimeMs:_.mtimeMs,size:_.size}}catch{return}}function sf(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 Qr(v){let _=sf(v);return _?xi().catalog.get(_):void 0}function es(v){let _=sf(v);return _?xi().transparent.has(_):!1}function ts(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 Nd(v){let _=Qr(v);if(!_)return;return{src:_.fallback.url,srcset:_.sources[_.fallback.format]||"",sources:ts(_).map(({format:k,srcset:E})=>({type:`image/${k}`,srcset:E})),width:_.source.width,height:_.source.height,placeholder:es(v)?void 0:_.placeholder?.dataUrl}}function Bn(){let v=xi();v.catalog=new Map,v.transparent=new Set}function yb(v){let _=xi();_.catalog=new Map(v.entries),_.transparent=new Set(v.transparent)}async function Ld(v,_,k={}){if(!v||!Yt.existsSync(v))return Bn(),{count:0,fingerprint:""};if(k.offThread){let re=await Kc("delivery",{publicDir:v,outputDir:_});if(re!==yo)return yb(re.state),re.result}let E=await rf(v);if(E.length===0)return Bn(),{count:0,fingerprint:""};let T=mb(_),j=E.filter((re)=>{let se=T[re.relativePath];if(!se)return!0;let ie=tf(re.absolutePath);return!ie||ie.mtimeMs!==se.mtimeMs||ie.size!==se.size});if(j.length===0)return Bn(),{count:0,fingerprint:""};let B=Qp(Ut.join(_,"_stx","images"),`${sb}:${ab()}`),z={outDir:Ut.join(_,"_stx","images"),storage:Qp(Ut.join(_,"_stx","images")),baseUrl:bo,widths:rb,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 Gp({...z,entries:ef(j,B)})}catch(re){if(F=await gb(j),F.length===j.length)throw re;let se=new Set(F.map((oe)=>oe.relativePath)),ie=!1;for(let oe of j){if(se.has(oe.relativePath))continue;let ue=tf(oe.absolutePath);if(!ue)continue;T[oe.relativePath]=ue,ie=!0}if(ie)hb(_,T);if(F.length===0)return Bn(),{count:0,fingerprint:""};V=await Gp({...z,entries:ef(F,B)})}let H=await pb(V.entries),G=fb(V.entries,H),J=xi();J.catalog=new Map(Object.entries(V.entries)),J.transparent=H;let ne=H.size===0&&G.length===0?V.fingerprint:nf("sha256").update(V.fingerprint).update(JSON.stringify({transparent:[...H].sort(),droppedWebp:G.sort()})).digest("hex");return{count:F.length,fingerprint:ne}}var xb=new Map;function Zc(v){if(!v)return;let _=v.split("?")[0].split("#")[0];return xb.get(_)}var bb={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},Gc=[320,640,768,1024,1280,1536,1920];function Ft(v){return v.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Xt(v,_){if(v.serverDynamic[_]!==void 0)return String(v.serverDynamic[_]);let k=v.static[_];if(typeof k==="string")return k;return}function vo(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 Jc(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=bb[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 Yc(v,_,k,E){return _.map((T)=>`${wi(v,T,void 0,k,E)} ${T}w`).join(", ")}function vb(v,_,k,E,T){return _.map((j)=>{let B=k?k*j:void 0;return`${wi(v,B,void 0,E,T)} ${j}x`}).join(", ")}function wi(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 wb(v){return`var s=this.style;${v.map((_)=>`s.${_}=''`).join(";")}`}function Sb(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 Qc={name:"StxImage",aliases:["Image","stx-image","stx-img"],render(v,_,k){let E=Xt(v,"src")||"",T=Qr(E),j=Xt(v,"alt")||"",B=Xt(v,"width")||(T?String(T.source.width):void 0),z=Xt(v,"height")||(T?String(T.source.height):void 0),F=Xt(v,"sizes"),V=Xt(v,"srcset"),H=Xt(v,"densities"),G=Xt(v,"format"),J=es(E)||Zc(E)?.transparent===!0,ne=Xt(v,"placeholder")||(T&&!J?"thumbhash":void 0),re=Xt(v,"placeholderColor")||"#e5e7eb",se=Xt(v,"provider"),ie=Xt(v,"class")||Xt(v,"className")||"",oe=Xt(v,"style")||"",ue=Xt(v,"quality"),ae=vo(v,"lazy",!0),me=vo(v,"preload",!1),ve=vo(v,"priority",!1),Se=Xt(v,"loading"),$e=Xt(v,"decoding")||"async",Ce=!!T||vo(v,"picture",!1)||!!G,Ee=B?Number.parseInt(B):void 0,Te=z?Number.parseInt(z):void 0,Re=V||"",_e="";if(T)Re=T.sources[T.fallback.format]||"",_e=F?Jc(F):"100vw";else if(!Re&&F&&se&&se!=="local"&&se!=="static")Re=Yc(E,Gc,se,G),_e=Jc(F);else if(!Re&&H){let pt=H.split(/\s+/).map((bt)=>Number.parseFloat(bt.replace("x","")));Re=vb(E,pt,Ee,se,G)}else if(F)_e=Jc(F);let Ae=[];if(oe)Ae.push(oe);if(Ee&&Te)Ae.push(`aspect-ratio:${Ee}/${Te}`);let Xe=[],Pe=ne==="blur"||ne==="color"||ne==="thumbhash";if(Pe&&!J){let pt=T?.placeholder?{dataUrl:T.placeholder.dataUrl,color:re}:Zc(E);if(pt&&ne==="color")Ae.push(`background-color:${pt.color}`),Xe.push("backgroundColor");else if(pt)Ae.push(`background-color:${pt.color}`),Ae.push(`background-image:url(${pt.dataUrl})`),Ae.push("background-size:cover"),Ae.push("background-repeat:no-repeat"),Xe.push("backgroundColor","backgroundImage");else{let bt=Sb(Ee||16,Te||9,re);Ae.push(`background-image:url(${bt})`),Ae.push("background-size:cover"),Ae.push("background-repeat:no-repeat"),Xe.push("backgroundImage")}}else if(!Pe&&ne&&ne!=="empty"&&ne!=="none")Ae.push(`background-image:url(${Ft(ne)})`),Ae.push("background-size:cover"),Ae.push("background-repeat:no-repeat"),Xe.push("backgroundImage");let Ie=T?.fallback.url||wi(E,Ee,Te,se,G),Ze=[];if(Ze.push(`src="${Ft(Us(Ie,"fetched"))}"`),Ze.push(`alt="${Ft(j)}"`),B)Ze.push(`width="${Ft(B)}"`);if(z)Ze.push(`height="${Ft(z)}"`);let rt=Se||(ve||me?"eager":ae?"lazy":"");if(rt)Ze.push(`loading="${Ft(rt)}"`);if(ve)Ze.push('fetchpriority="high"');if(Ze.push(`decoding="${Ft($e)}"`),ie)Ze.push(`class="${Ft(ie)}"`);if(Ae.length>0)Ze.push(`style="${Ft(Ae.join(";"))}"`);if(Re)Ze.push(`srcset="${Ft(Us(Re,"fetched"))}"`);if(_e)Ze.push(`sizes="${Ft(_e)}"`);let at=new Set(["src","alt","width","height","lazy","sizes","srcset","placeholder","placeholderColor","class","className","style","format","provider","quality","densities","preload","priority","picture","loading","decoding"]);if(Xe.length>0){let pt=typeof v.static.onload==="string"?v.static.onload:"",bt=wb(Xe)+(pt?`;${pt}`:"");Ze.push(`onload="${Ft(bt)}"`),at.add("onload")}Ze.push(...xr(v,at)),Ze.push(...br(v,at));let Qe=`<img ${Ze.join(" ")} />`,ht="";if(me){let bt=G==="webp"?"image/webp":G==="avif"?"image/avif":"";ht=`<link rel="preload" as="image" href="${Ft(Ie)}"${bt?` type="${bt}"`:""}${Re?` imagesrcset="${Ft(Re)}"`:""}${_e?` imagesizes="${Ft(_e)}"`:""} />
1711
+ `}if(Ce){let pt=[];if(T)for(let bt of ts(T))pt.push(`<source type="image/${bt.format}" srcset="${Ft(bt.srcset)}"${_e?` sizes="${Ft(_e)}"`:""} />`);if(!T&&(G==="avif"||G==="auto")){let bt=wi(E,Ee,Te,se,"avif"),ct=Re?Yc(E,Gc,se,"avif"):`${bt}`;pt.push(`<source type="image/avif" srcset="${Ft(ct)}"${_e?` sizes="${Ft(_e)}"`:""} />`)}if(!T&&(G==="webp"||G==="auto")){let bt=wi(E,Ee,Te,se,"webp"),ct=Re?Yc(E,Gc,se,"webp"):`${bt}`;pt.push(`<source type="image/webp" srcset="${Ft(ct)}"${_e?` sizes="${Ft(_e)}"`:""} />`)}return`${ht}<picture>
1712
1712
  ${pt.join(`
1713
1713
  `)}
1714
1714
  ${Qe}
1715
- </picture>`}return`${ht}${Qe}`}};var rf="/images/safe-image-default.svg";function _i(v){return v.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Os(v,_){if(v.serverDynamic[_]!==void 0)return String(v.serverDynamic[_]);let k=v.static[_];if(typeof k==="string")return k;return}var vb=`<script>window.__stxSafeImageHandler||(window.__stxSafeImageHandler=function(i){if(i.__stx_fb)return;i.__stx_fb=1;var f=i.getAttribute('data-fallback')||'${rf}';var c=i.getAttribute('data-fallback-class');i.src=f;if(c)i.className=c;});</script>`,Qc={name:"SafeImage",aliases:["safe-image","safe-img"],render(v,_,k){let E=Os(v,"src")||"",T=Os(v,"alt")||"",j=Os(v,"fallback")||rf,B=Os(v,"class")||Os(v,"className")||"",z=Os(v,"fallbackClassName")||"",F=[];if(F.push(`src="${_i(E)}"`),F.push(`alt="${_i(T)}"`),B)F.push(`class="${_i(B)}"`);if(F.push(`data-fallback="${_i(j)}"`),z)F.push(`data-fallback-class="${_i(z)}"`);F.push('onerror="window.__stxSafeImageHandler(this)"');let V=new Set(["src","alt","fallback","class","className","fallbackClassName"]);F.push(...xr(v,V)),F.push(...br(v,V));let H=`<img ${F.join(" ")} />`,G=k.context;if(!G.__safeImageHandlerEmitted)return G.__safeImageHandlerEmitted=!0,`${vb}${H}`;return H}};function el(v){return v.replace(/[;{}()]/g,"").replace(/url/gi,"")}function Ri(v,_){if(v.serverDynamic[_]!==void 0)return String(v.serverDynamic[_]);let k=v.static[_];if(typeof k==="string")return k;return}function vo(v,_,k){let E=Ri(v,_);if(E!==void 0){let T=Number.parseInt(E,10);if(!Number.isNaN(T))return T}return k}var tl={name:"StxLoadingIndicator",aliases:["stx-loading-indicator"],render(v,_,k){let E=el(Ri(v,"color")||"#6366f1"),T=el(Ri(v,"initialColor")||Ri(v,"initial-color")||""),j=el(Ri(v,"height")||"3px"),B=vo(v,"duration",2000),z=vo(v,"throttle",200),F=vo(v,"zIndex",999999)||vo(v,"z-index",999999),V=T?`linear-gradient(to right, ${T}, ${E})`:E;return`
1715
+ </picture>`}return`${ht}${Qe}`}};var of="/images/safe-image-default.svg";function _i(v){return v.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Ms(v,_){if(v.serverDynamic[_]!==void 0)return String(v.serverDynamic[_]);let k=v.static[_];if(typeof k==="string")return k;return}var $b=`<script>window.__stxSafeImageHandler||(window.__stxSafeImageHandler=function(i){if(i.__stx_fb)return;i.__stx_fb=1;var f=i.getAttribute('data-fallback')||'${of}';var c=i.getAttribute('data-fallback-class');i.src=f;if(c)i.className=c;});</script>`,el={name:"SafeImage",aliases:["safe-image","safe-img"],render(v,_,k){let E=Ms(v,"src")||"",T=Ms(v,"alt")||"",j=Ms(v,"fallback")||of,B=Ms(v,"class")||Ms(v,"className")||"",z=Ms(v,"fallbackClassName")||"",F=[];if(F.push(`src="${_i(E)}"`),F.push(`alt="${_i(T)}"`),B)F.push(`class="${_i(B)}"`);if(F.push(`data-fallback="${_i(j)}"`),z)F.push(`data-fallback-class="${_i(z)}"`);F.push('onerror="window.__stxSafeImageHandler(this)"');let V=new Set(["src","alt","fallback","class","className","fallbackClassName"]);F.push(...xr(v,V)),F.push(...br(v,V));let H=`<img ${F.join(" ")} />`,G=k.context;if(!G.__safeImageHandlerEmitted)return G.__safeImageHandlerEmitted=!0,`${$b}${H}`;return H}};function tl(v){return v.replace(/[;{}()]/g,"").replace(/url/gi,"")}function Ri(v,_){if(v.serverDynamic[_]!==void 0)return String(v.serverDynamic[_]);let k=v.static[_];if(typeof k==="string")return k;return}function wo(v,_,k){let E=Ri(v,_);if(E!==void 0){let T=Number.parseInt(E,10);if(!Number.isNaN(T))return T}return k}var nl={name:"StxLoadingIndicator",aliases:["stx-loading-indicator"],render(v,_,k){let E=tl(Ri(v,"color")||"#6366f1"),T=tl(Ri(v,"initialColor")||Ri(v,"initial-color")||""),j=tl(Ri(v,"height")||"3px"),B=wo(v,"duration",2000),z=wo(v,"throttle",200),F=wo(v,"zIndex",999999)||wo(v,"z-index",999999),V=T?`linear-gradient(to right, ${T}, ${E})`:E;return`
1716
1716
  <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">
1717
1717
  <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>
1718
1718
  </div>
1719
1719
  <style>@keyframes stx-shimmer{0%{transform:translateX(-100%)}100%{transform:translateX(100%)}}</style>
1720
1720
  <script>
1721
1721
  (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()})})();
1722
- </script>`}};function of(v,_){if(v.serverDynamic[_]!==void 0)return String(v.serverDynamic[_]);let k=v.static[_];if(typeof k==="string")return k;return}function wb(v,_,k){let E=of(v,_);if(E!==void 0){let T=Number.parseInt(E,10);if(!Number.isNaN(T))return T}return k}var sf={"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%)"},nl={name:"StxToast",aliases:["stx-toast"],render(v,_,k){let E=Lt(of(v,"position")||"top-right"),T=wb(v,"max",5),j=sf[E]||sf["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>
1722
+ </script>`}};function cf(v,_){if(v.serverDynamic[_]!==void 0)return String(v.serverDynamic[_]);let k=v.static[_];if(typeof k==="string")return k;return}function _b(v,_,k){let E=cf(v,_);if(E!==void 0){let T=Number.parseInt(E,10);if(!Number.isNaN(T))return T}return k}var af={"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%)"},rl={name:"StxToast",aliases:["stx-toast"],render(v,_,k){let E=Lt(cf(v,"position")||"top-right"),T=_b(v,"max",5),j=af[E]||af["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>
1723
1723
  <style>
1724
1724
  @keyframes stx-toast-in{from{opacity:0;transform:translateX(100%)}to{opacity:1;transform:translateX(0)}}
1725
1725
  @keyframes stx-toast-out{from{opacity:1;transform:translateX(0)}to{opacity:0;transform:translateX(100%)}}
@@ -1727,7 +1727,7 @@ ${Qe}
1727
1727
  @keyframes stx-toast-out-left{from{opacity:1;transform:translateX(0)}to{opacity:0;transform:translateX(-100%)}}
1728
1728
  @keyframes stx-toast-in-center{from{opacity:0;transform:translateY(-1rem)}to{opacity:1;transform:translateY(0)}}
1729
1729
  @keyframes stx-toast-out-center{from{opacity:1;transform:translateY(0)}to{opacity:0;transform:translateY(-1rem)}}
1730
- </style>`}};function wo(v,_){if(v.serverDynamic[_]!==void 0)return String(v.serverDynamic[_]);let k=v.static[_];if(typeof k==="string")return k;return}var af={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)"},rl={name:"StxModal",aliases:["stx-modal"],render(v,_,k){let E=wo(v,"id");if(!E)return console.warn('[stx] <StxModal> requires an "id" prop'),"<!-- StxModal: missing id prop -->";let T=Lt(E),j=wo(v,"size")||"md",B=wo(v,"closeOnBackdrop")!=="false",z=wo(v,"closeOnEscape")!=="false",F=af[j]||af.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">
1730
+ </style>`}};function So(v,_){if(v.serverDynamic[_]!==void 0)return String(v.serverDynamic[_]);let k=v.static[_];if(typeof k==="string")return k;return}var lf={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)"},sl={name:"StxModal",aliases:["stx-modal"],render(v,_,k){let E=So(v,"id");if(!E)return console.warn('[stx] <StxModal> requires an "id" prop'),"<!-- StxModal: missing id prop -->";let T=Lt(E),j=So(v,"size")||"md",B=So(v,"closeOnBackdrop")!=="false",z=So(v,"closeOnEscape")!=="false",F=lf[j]||lf.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">
1731
1731
  <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)">
1732
1732
  <div style="padding:1.5rem">${_}</div>
1733
1733
  </div>
@@ -1736,7 +1736,7 @@ ${Qe}
1736
1736
  @media(prefers-color-scheme:dark){[data-stx-modal]{--stx-modal-bg:#1f2937;--stx-modal-text:#f3f4f6}}
1737
1737
  .stx-modal-backdrop[data-stx-modal-open]{display:flex!important;opacity:1}
1738
1738
  .stx-modal-backdrop[data-stx-modal-open] .stx-modal-panel{transform:scale(1) translateY(0);opacity:1}
1739
- </style>`}};function Ns(v,_){if(v.serverDynamic[_]!==void 0)return String(v.serverDynamic[_]);let k=v.static[_];if(typeof k==="string")return k;return}var cf={sm:"16rem",md:"24rem",lg:"32rem",xl:"40rem"},sl={name:"StxDrawer",aliases:["stx-drawer"],render(v,_,k){let E=Ns(v,"id");if(!E)return console.warn('[stx] <StxDrawer> requires an "id" prop'),"<!-- StxDrawer: missing id prop -->";let T=Lt(E),j=Ns(v,"side")||"right",B=Ns(v,"size")||"md",z=Ns(v,"closeOnBackdrop")!=="false",F=Ns(v,"closeOnEscape")!=="false",V=Ns(v,"overlay")!=="false",H=cf[B]||cf.md,G=j==="left",J=G?"left:0":"right:0",ne=G?"translateX(-100%)":"translateX(100%)",re=G?"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">
1739
+ </style>`}};function Os(v,_){if(v.serverDynamic[_]!==void 0)return String(v.serverDynamic[_]);let k=v.static[_];if(typeof k==="string")return k;return}var uf={sm:"16rem",md:"24rem",lg:"32rem",xl:"40rem"},il={name:"StxDrawer",aliases:["stx-drawer"],render(v,_,k){let E=Os(v,"id");if(!E)return console.warn('[stx] <StxDrawer> requires an "id" prop'),"<!-- StxDrawer: missing id prop -->";let T=Lt(E),j=Os(v,"side")||"right",B=Os(v,"size")||"md",z=Os(v,"closeOnBackdrop")!=="false",F=Os(v,"closeOnEscape")!=="false",V=Os(v,"overlay")!=="false",H=uf[B]||uf.md,G=j==="left",J=G?"left:0":"right:0",ne=G?"translateX(-100%)":"translateX(100%)",re=G?"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">
1740
1740
  <div class="stx-drawer-panel" style="position:fixed;top:0;bottom:0;${J};width:${H};max-width:100vw;transform:${ne};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">
1741
1741
  <div style="padding:1.5rem">${_}</div>
1742
1742
  </div>
@@ -1745,7 +1745,7 @@ ${Qe}
1745
1745
  @media(prefers-color-scheme:dark){[data-stx-drawer]{--stx-drawer-bg:#1f2937;--stx-drawer-text:#f3f4f6}}
1746
1746
  .stx-drawer-backdrop[data-stx-drawer-open]{display:block!important;opacity:1}
1747
1747
  .stx-drawer-backdrop[data-stx-drawer-open] .stx-drawer-panel{transform:translateX(0)}
1748
- </style>`}};import{existsSync as Sb,readFileSync as $b}from"fs";var So=new Map,lf=new Set;function _b(v){if(lf.has(v))return;lf.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 kb(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(Sb(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 Eb(v){if(So.has(v))return So.get(v);let _=kb(v);if(!_)return _b(v),null;try{let k=JSON.parse($b(_,"utf8"));return So.set(v,k.icons),k.icons}catch{return null}}function Ls(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 il={name:"Icon",aliases:["icon","stx-icon"],render(v,_,k){let E=Ls(v,"name")??Ls(v,"icon");if(!E)return"<!-- Icon: missing name/icon prop -->";let T="lucide",j=E;if(E.includes(":")){let de=E.split(":");T=de[0],j=de[1]}let B=Lt(Ls(v,"size")||"24"),z=Lt(Ls(v,"color")||"currentColor"),F=Lt(Ls(v,"class")||""),V=Lt(Ls(v,"style")||""),H=So.get(T)??Eb(T);if(!H)return`<!-- Icon: collection "${T}" not loaded -->`;let G=H[j];if(!G)return`<!-- Icon: "${j}" not found in ${T} -->`;let J=G.width||24,ne=G.height||24,re=`0 0 ${J} ${ne}`,se=G.body;if(z!=="currentColor")se=se.replace(/currentColor/g,z);let ie=F?` class="${F}"`:"",oe=V?` style="${V}"`:"";return`<svg xmlns="http://www.w3.org/2000/svg" width="${B}" height="${B}" viewBox="${re}" fill="none"${ie}${oe}>${se}</svg>`}};function ol(){return`
1748
+ </style>`}};import{existsSync as kb,readFileSync as Eb}from"fs";var $o=new Map,df=new Set;function Cb(v){if(df.has(v))return;df.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 Rb(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(kb(k))return k;for(let k of[`@iconify-json/${v}/icons.json`,`@iconify/json/json/${v}.json`])try{return d.resolve(k)}catch{}return null}function Tb(v){if($o.has(v))return $o.get(v);let _=Rb(v);if(!_)return Cb(v),null;try{let k=JSON.parse(Eb(_,"utf8"));return $o.set(v,k.icons),k.icons}catch{return null}}function Ns(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 ol={name:"Icon",aliases:["icon","stx-icon"],render(v,_,k){let E=Ns(v,"name")??Ns(v,"icon");if(!E)return"<!-- Icon: missing name/icon prop -->";let T="lucide",j=E;if(E.includes(":")){let ue=E.split(":");T=ue[0],j=ue[1]}let B=Lt(Ns(v,"size")||"24"),z=Lt(Ns(v,"color")||"currentColor"),F=Lt(Ns(v,"class")||""),V=Lt(Ns(v,"style")||""),H=$o.get(T)??Tb(T);if(!H)return`<!-- Icon: collection "${T}" not loaded -->`;let G=H[j];if(!G)return`<!-- Icon: "${j}" not found in ${T} -->`;let J=G.width||24,ne=G.height||24,re=`0 0 ${J} ${ne}`,se=G.body;if(z!=="currentColor")se=se.replace(/currentColor/g,z);let ie=F?` class="${F}"`:"",oe=V?` style="${V}"`:"";return`<svg xmlns="http://www.w3.org/2000/svg" width="${B}" height="${B}" viewBox="${re}" fill="none"${ie}${oe}>${se}</svg>`}};function al(){return`
1749
1749
  (function(){
1750
1750
  var tip=null,hideTimer=null,currentEl=null;
1751
1751
 
@@ -1848,8 +1848,8 @@ document.addEventListener("focusout",function(e){
1848
1848
  if(el) hideTip();
1849
1849
  });
1850
1850
  })();
1851
- `}function uf(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 df(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=df(_,"fallback"),T=E.rest,j=df(T,"error"),B=j.rest,z=E.region??uf(v,"fallback")??'<div class="stx-suspense-loading">Loading\u2026</div>',F=j.region??uf(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 $o(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 cl={name:"TransitionGroup",aliases:["transition-group"],render(v,_,k){let E=($o(v,"name")||"v").replace(/["'<>]/g,""),T=($o(v,"tag")||"div").replace(/[^a-z0-9-]/gi,"")||"div",j=$o(v,"class"),B=$o(v,"id"),z=[`data-stx-transition-group="${E}"`,j?`class="${j}"`:"",B?`id="${B}"`:""].filter(Boolean).join(" ");return`<${T} ${z}>${_}</${T}>`}};function pf(v=Is){v.registerBuiltin(Fc),v.registerBuiltin(Yc),v.registerBuiltin(Qc),v.registerBuiltin(tl),v.registerBuiltin(nl),v.registerBuiltin(rl),v.registerBuiltin(sl),v.registerBuiltin(il),v.registerBuiltin(al),v.registerBuiltin(cl)}function _o(v){return v.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}var ff=new Map;function Cb(v){let _=ff.get(v.source);if(!_)_=new RegExp(`(${v.source})(?![\\w.:-])`,"y"),ff.set(v.source,_);return _}var gf=new WeakMap;function mf(v){let _=gf.get(v);if(!_)_=new Set([...v].map((E)=>E.toLowerCase())),gf.set(v,_);let k=_;return(E)=>!/[a-z]/.test(E)&&k.has(E.toLowerCase())}function Rb(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 hf(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=Cb(_);z.lastIndex=B+1;let F=z.exec(v);if(!F){T=B+1;continue}let V=F[1];if(j&&j(V)){let ie=B+1+V.length;while(ie<v.length&&v[ie]!==">")ie++;T=ie+1;continue}let H=B+1+V.length,G=null,J=H,ne=-1,re=!1;while(H<v.length){let ie=v[H];if(G){if(ie==="\\"&&H+1<v.length){H+=2;continue}if(ie===G)G=null;H++;continue}if(ie==='"'||ie==="'"){G=ie,H++;continue}if(ie==="/"&&H+1<v.length&&v[H+1]===">"){ne=H+2,re=!0;break}if(ie===">"){ne=H+1;break}H++}if(ne===-1){T=B+1;continue}let se=v.slice(J,re?ne-2:ne-1).trim();if(re)E.push({fullMatch:v.slice(B,ne),tagName:V,attributes:se,content:"",startIndex:B,endIndex:ne,isSelfClosing:!0}),T=ne;else{let ie=`<${V}`,oe=`</${V}>`,de=1,ae=ne,me=-1;while(de>0&&ae<v.length){let $e=v.indexOf(ie,ae),Ce=v.indexOf(oe,ae);if(Ce===-1)break;if($e!==-1&&$e<Ce){let Ee=v[$e+ie.length];if(Ee===" "||Ee===">"||Ee==="/"||Ee===`
1852
- `||Ee==="\t"){let Te=Rb(v,$e+ie.length);if(v[Te-1]!=="/")de++;ae=Te+1}else ae=$e+ie.length}else{if(de--,de===0){me=Ce;break}ae=Ce+oe.length}}if(me===-1){T=ne;continue}let ve=v.slice(ne,me),Se=me+oe.length;E.push({fullMatch:v.slice(B,Se),tagName:V,attributes:se,content:ve,startIndex:B,endIndex:Se,isSelfClosing:!1}),T=Se}}return E}function yf(v){return v.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#0?39;/g,"'").replace(/&#x27;/gi,"'").replace(/&amp;/g,"&")}function xf(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 ll(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 bf(v){let _=v.trim();if(!_.startsWith("{")||!_.endsWith("}"))return null;if(ll(_,0).length!==_.length)return null;return _.slice(1,-1).trim()}var Tb=new Set(["disabled","checked","readonly","required","autofocus","autoplay","controls","default","defer","formnovalidate","hidden","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","reversed","selected"]),Ab=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function ul(v){let _=[],k=/<([a-zA-Z][a-zA-Z0-9-]*)\b((?:[^>"']|"[^"]*"|'[^']*')*)\s*\/?>/g,E;while((E=k.exec(v))!==null){let T=E[2]||"";if(!/(?:^|\s)(?::for|x-for|v-for|@for)\s*=/.test(T))continue;let j=E.index,B=j+E[0].length,z=E[1].toLowerCase();if(E[0].endsWith("/>")||Ab.has(z)){_.push([j,B]);continue}let F=z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),V=new RegExp(`<\\/?${F}\\b(?:[^>"']|"[^"]*"|'[^']*')*>`,"gi");V.lastIndex=B;let H=1,G=B,J;while((J=V.exec(v))!==null)if(J[0].startsWith("</")){if(H--,H===0){G=J.index+J[0].length;break}}else if(!J[0].endsWith("/>"))H++;_.push([j,G])}return _}function vf(v){if(typeof v==="string")return v;if(Array.isArray(v))return v.filter(Boolean).map((_)=>vf(_)).join(" ");if(v&&typeof v==="object")return Object.entries(v).filter(([,_])=>_).map(([_])=>_).join(" ");return v?String(v):""}function wf(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(...ul(v));function B(G){return T.some(([J,ne])=>G>=J&&G<ne)}let z=/<([a-zA-Z][a-zA-Z0-9-]*)\b((?:[^>"']|"[^"]*"|'[^']*')*?)\s*(\/?)>/g,F=[],V=new Map,H=256;while((j=z.exec(k))!==null){if(B(j.index))continue;let G=j[0],J=j[2];if(!J||!J.includes(":"))continue;let ne=/\s:([a-zA-Z_][\w-]*)\s*=\s*"([^"]*)"/g,re,se=J,ie=!1;while((re=ne.exec(J))!==null){let oe=re[1],de=re[2];if($i(oe))continue;if(de.includes("()")&&!de.includes(".get(")||de.includes("$store")||de.includes("$ref"))continue;try{let ae=Object.keys(_),me=Object.values(_),ve=de.match(/^([a-zA-Z_$][\w$]*)/);if(ve&&!ae.includes(ve[1])&&!["true","false","null","undefined","Math","JSON","String","Number","Array","Object","Date","parseInt","parseFloat"].includes(ve[1]))continue;let Se=JSON.stringify([ae,de]),$e=V.get(Se);if(!$e){if($e=Function(...ae,`return (${de})`),V.size>=H)V.clear();V.set(Se,$e)}let Ce=$e(...me);if(oe==="class"){let Ee=vf(Ce);if(Ee){let Te=se.match(/\sclass="([^"]*)"/);if(Te)se=se.replace(Te[0],` class="${Te[1]} ${Ee}"`);else se=se.replace(re[0],` class="${Ee}"`)}else se=se.replace(re[0],"");ie=!0;continue}if(Tb.has(oe)){if(Ce)se=se.replace(re[0],` ${oe}`);else se=se.replace(re[0],"");ie=!0;continue}if(Ce===null||Ce===void 0||Ce===!1)se=se.replace(re[0],"");else{let Ee=String(Ce).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;");se=se.replace(re[0],` ${oe}="${Ee}"`)}ie=!0}catch{continue}}if(ie){let oe=j[3]?" /":"",ae=`<${j[1]}${se}${oe}>`;F.push({start:j.index,end:j.index+G.length,replacement:ae})}}if(F.length>0){let G=Array(F.length*2+1),J=0;for(let ne=0;ne<F.length;ne++){let{start:re,end:se,replacement:ie}=F[ne];G[ne*2]=k.slice(J,re),G[ne*2+1]=ie,J=se}G[F.length*2]=k.slice(J),k=G.join("")}return k}import Mf from"path";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}import pl from"fs";import Ai from"path";function Sf(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 Ib(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=Sf(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=Sf(k,j,"(",")");if(z>=0)return{type:B,args:Ib(v.slice(j+1,z))}}return null}var $f=`
1851
+ `}function pf(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 ff(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 cl={name:"Suspense",aliases:["suspense"],render(v,_,k){let E=ff(_,"fallback"),T=E.rest,j=ff(T,"error"),B=j.rest,z=E.region??pf(v,"fallback")??'<div class="stx-suspense-loading">Loading\u2026</div>',F=j.region??pf(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 _o(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 ll={name:"TransitionGroup",aliases:["transition-group"],render(v,_,k){let E=(_o(v,"name")||"v").replace(/["'<>]/g,""),T=(_o(v,"tag")||"div").replace(/[^a-z0-9-]/gi,"")||"div",j=_o(v,"class"),B=_o(v,"id"),z=[`data-stx-transition-group="${E}"`,j?`class="${j}"`:"",B?`id="${B}"`:""].filter(Boolean).join(" ");return`<${T} ${z}>${_}</${T}>`}};function gf(v=Ss){v.registerBuiltin(Vc),v.registerBuiltin(Qc),v.registerBuiltin(el),v.registerBuiltin(nl),v.registerBuiltin(rl),v.registerBuiltin(sl),v.registerBuiltin(il),v.registerBuiltin(ol),v.registerBuiltin(cl),v.registerBuiltin(ll)}function ko(v){return v.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}var mf=new Map;function Ab(v){let _=mf.get(v.source);if(!_)_=new RegExp(`(${v.source})(?![\\w.:-])`,"y"),mf.set(v.source,_);return _}var hf=new WeakMap;function yf(v){let _=hf.get(v);if(!_)_=new Set([...v].map((E)=>E.toLowerCase())),hf.set(v,_);let k=_;return(E)=>!/[a-z]/.test(E)&&k.has(E.toLowerCase())}function Ib(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 xf(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=Ab(_);z.lastIndex=B+1;let F=z.exec(v);if(!F){T=B+1;continue}let V=F[1];if(j&&j(V)){let ie=B+1+V.length;while(ie<v.length&&v[ie]!==">")ie++;T=ie+1;continue}let H=B+1+V.length,G=null,J=H,ne=-1,re=!1;while(H<v.length){let ie=v[H];if(G){if(ie==="\\"&&H+1<v.length){H+=2;continue}if(ie===G)G=null;H++;continue}if(ie==='"'||ie==="'"){G=ie,H++;continue}if(ie==="/"&&H+1<v.length&&v[H+1]===">"){ne=H+2,re=!0;break}if(ie===">"){ne=H+1;break}H++}if(ne===-1){T=B+1;continue}let se=v.slice(J,re?ne-2:ne-1).trim();if(re)E.push({fullMatch:v.slice(B,ne),tagName:V,attributes:se,content:"",startIndex:B,endIndex:ne,isSelfClosing:!0}),T=ne;else{let ie=`<${V}`,oe=`</${V}>`,ue=1,ae=ne,me=-1;while(ue>0&&ae<v.length){let $e=v.indexOf(ie,ae),Ce=v.indexOf(oe,ae);if(Ce===-1)break;if($e!==-1&&$e<Ce){let Ee=v[$e+ie.length];if(Ee===" "||Ee===">"||Ee==="/"||Ee===`
1852
+ `||Ee==="\t"){let Te=Ib(v,$e+ie.length);if(v[Te-1]!=="/")ue++;ae=Te+1}else ae=$e+ie.length}else{if(ue--,ue===0){me=Ce;break}ae=Ce+oe.length}}if(me===-1){T=ne;continue}let ve=v.slice(ne,me),Se=me+oe.length;E.push({fullMatch:v.slice(B,Se),tagName:V,attributes:se,content:ve,startIndex:B,endIndex:Se,isSelfClosing:!1}),T=Se}}return E}function bf(v){return v.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#0?39;/g,"'").replace(/&#x27;/gi,"'").replace(/&amp;/g,"&")}function vf(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 ul(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 wf(v){let _=v.trim();if(!_.startsWith("{")||!_.endsWith("}"))return null;if(ul(_,0).length!==_.length)return null;return _.slice(1,-1).trim()}var Pb=new Set(["disabled","checked","readonly","required","autofocus","autoplay","controls","default","defer","formnovalidate","hidden","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","reversed","selected"]),Db=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function dl(v){let _=[],k=/<([a-zA-Z][a-zA-Z0-9-]*)\b((?:[^>"']|"[^"]*"|'[^']*')*)\s*\/?>/g,E;while((E=k.exec(v))!==null){let T=E[2]||"";if(!/(?:^|\s)(?::for|x-for|v-for|@for)\s*=/.test(T))continue;let j=E.index,B=j+E[0].length,z=E[1].toLowerCase();if(E[0].endsWith("/>")||Db.has(z)){_.push([j,B]);continue}let F=z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),V=new RegExp(`<\\/?${F}\\b(?:[^>"']|"[^"]*"|'[^']*')*>`,"gi");V.lastIndex=B;let H=1,G=B,J;while((J=V.exec(v))!==null)if(J[0].startsWith("</")){if(H--,H===0){G=J.index+J[0].length;break}}else if(!J[0].endsWith("/>"))H++;_.push([j,G])}return _}function Sf(v){if(typeof v==="string")return v;if(Array.isArray(v))return v.filter(Boolean).map((_)=>Sf(_)).join(" ");if(v&&typeof v==="object")return Object.entries(v).filter(([,_])=>_).map(([_])=>_).join(" ");return v?String(v):""}function $f(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(...dl(v));function B(G){return T.some(([J,ne])=>G>=J&&G<ne)}let z=/<([a-zA-Z][a-zA-Z0-9-]*)\b((?:[^>"']|"[^"]*"|'[^']*')*?)\s*(\/?)>/g,F=[],V=new Map,H=256;while((j=z.exec(k))!==null){if(B(j.index))continue;let G=j[0],J=j[2];if(!J||!J.includes(":"))continue;let ne=/\s:([a-zA-Z_][\w-]*)\s*=\s*"([^"]*)"/g,re,se=J,ie=!1;while((re=ne.exec(J))!==null){let oe=re[1],ue=re[2];if($i(oe))continue;if(ue.includes("()")&&!ue.includes(".get(")||ue.includes("$store")||ue.includes("$ref"))continue;try{let ae=Object.keys(_),me=Object.values(_),ve=ue.match(/^([a-zA-Z_$][\w$]*)/);if(ve&&!ae.includes(ve[1])&&!["true","false","null","undefined","Math","JSON","String","Number","Array","Object","Date","parseInt","parseFloat"].includes(ve[1]))continue;let Se=JSON.stringify([ae,ue]),$e=V.get(Se);if(!$e){if($e=Function(...ae,`return (${ue})`),V.size>=H)V.clear();V.set(Se,$e)}let Ce=$e(...me);if(oe==="class"){let Ee=Sf(Ce);if(Ee){let Te=se.match(/\sclass="([^"]*)"/);if(Te)se=se.replace(Te[0],` class="${Te[1]} ${Ee}"`);else se=se.replace(re[0],` class="${Ee}"`)}else se=se.replace(re[0],"");ie=!0;continue}if(Pb.has(oe)){if(Ce)se=se.replace(re[0],` ${oe}`);else se=se.replace(re[0],"");ie=!0;continue}if(Ce===null||Ce===void 0||Ce===!1)se=se.replace(re[0],"");else{let Ee=String(Ce).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;");se=se.replace(re[0],` ${oe}="${Ee}"`)}ie=!0}catch{continue}}if(ie){let oe=j[3]?" /":"",ae=`<${j[1]}${se}${oe}>`;F.push({start:j.index,end:j.index+G.length,replacement:ae})}}if(F.length>0){let G=Array(F.length*2+1),J=0;for(let ne=0;ne<F.length;ne++){let{start:re,end:se,replacement:ie}=F[ne];G[ne*2]=k.slice(J,re),G[ne*2+1]=ie,J=se}G[F.length*2]=k.slice(J),k=G.join("")}return k}import Nf from"path";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}import fl from"fs";import Ai from"path";function _f(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 Mb(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 pl(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=_f(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=_f(k,j,"(",")");if(z>=0)return{type:B,args:Mb(v.slice(j+1,z))}}return null}var kf=`
1853
1853
  type __StxCtor<T> = T extends StringConstructor ? string : T extends NumberConstructor ? number : T extends BooleanConstructor ? boolean : T extends ArrayConstructor ? unknown[] : T extends ObjectConstructor ? object : T extends readonly unknown[] ? __StxCtor<T[number]> : T extends abstract new (...args: any[]) => infer V ? V : unknown;
1854
1854
  type __StxWiden<T> = T extends string ? string : T extends number ? number : T extends boolean ? boolean : T;
1855
1855
  type __StxOption<T> = T extends { type: infer C } ? __StxCtor<C> : T extends { default: infer D } ? D extends (...args: any[]) => infer V ? V : __StxWiden<D> : __StxCtor<T>;
@@ -1857,37 +1857,37 @@ type __StxRequired<O> = { [K in keyof O]-?: O[K] extends { required: true } ? K
1857
1857
  type __StxDefaulted<O> = { [K in keyof O]-?: O[K] extends { default: unknown } ? K : never }[keyof O];
1858
1858
  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]> };
1859
1859
  type __StxDefaults<P, K> = Omit<P, Extract<keyof P, K>> & Partial<Pick<P, Extract<keyof P, K>>>;
1860
- `;function _f(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,(J,ne,re,se,ie)=>{if(T.slice(ie,ie+6)!=="import")return J;if(se.endsWith(".stx"))return"";let oe=`${_}Import${k.length}`;if(k.push(`import * as ${oe} from ${JSON.stringify(se)};`),ne.startsWith("*"))return`import ${ne.replace(/^\*\s+as\s+/,"")} = ${oe};`;if(!ne.startsWith("{"))return`import ${ne} = ${oe}.default;`;return ne.slice(1,-1).split(",").map((de)=>{let[ae,me=ae]=de.trim().replace(/^type\s+/,"").split(/\s+as\s+/);if(!ae)return"";if(/^(?:stx|@stacksjs\/stx)(?:\/|$)/.test(se)&&ae in E)E[ae].push(me);return`import ${me} = ${oe}.${ae};`}).join(`
1861
- `)}),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=[],H=null,G=null;if(B){V.push(`const __options = (${B.args[0]||"{}"}) as const;`),V.push(`const __defaults = (${F?.args[1]||"{}"});`);let J=B.type||"__StxOptions<typeof __options>";V.push(`export type __StxProps = __StxDefaults<${J}, keyof typeof __defaults | __StxDefaulted<typeof __options>>;`),H=`${_}.__StxProps`}if(z)V.push(`const __events = (${z.args[0]||"[]"}) as const;`),V.push(`export type __StxEvents = ${z.type||"Record<(typeof __events)[number], any[]>"};`),G=`${_}.__StxEvents`;return{declarations:`${k.join(`
1860
+ `;function Ef(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,(J,ne,re,se,ie)=>{if(T.slice(ie,ie+6)!=="import")return J;if(se.endsWith(".stx"))return"";let oe=`${_}Import${k.length}`;if(k.push(`import * as ${oe} from ${JSON.stringify(se)};`),ne.startsWith("*"))return`import ${ne.replace(/^\*\s+as\s+/,"")} = ${oe};`;if(!ne.startsWith("{"))return`import ${ne} = ${oe}.default;`;return ne.slice(1,-1).split(",").map((ue)=>{let[ae,me=ae]=ue.trim().replace(/^type\s+/,"").split(/\s+as\s+/);if(!ae)return"";if(/^(?:stx|@stacksjs\/stx)(?:\/|$)/.test(se)&&ae in E)E[ae].push(me);return`import ${me} = ${oe}.${ae};`}).join(`
1861
+ `)}),B=pl(v,E.defineProps),z=pl(v,E.defineEmits),F=pl(v,E.withDefaults);if(!B&&!z)return{declarations:"",props:null,events:null};let V=[],H=null,G=null;if(B){V.push(`const __options = (${B.args[0]||"{}"}) as const;`),V.push(`const __defaults = (${F?.args[1]||"{}"});`);let J=B.type||"__StxOptions<typeof __options>";V.push(`export type __StxProps = __StxDefaults<${J}, keyof typeof __defaults | __StxDefaulted<typeof __options>>;`),H=`${_}.__StxProps`}if(z)V.push(`const __events = (${z.args[0]||"[]"}) as const;`),V.push(`export type __StxEvents = ${z.type||"Record<(typeof __events)[number], any[]>"};`),G=`${_}.__StxEvents`;return{declarations:`${k.join(`
1862
1862
  `)}
1863
1863
  namespace ${_} {
1864
1864
  ${j}
1865
1865
  ${V.join(`
1866
1866
  `)}
1867
- }`,props:H,events:G}}var Ti=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 rn(v){if(v.includes("-")||v==="component")return!1;if(/^[A-Z]/.test(v))return!/[a-z]/.test(v)&&[...Ti].some((_)=>_.toLowerCase()===v.toLowerCase());return Ti.has(v)||/[A-Z]/.test(v)}function*Pb(v){let _=/<([A-Za-z][\w.-]*)(?=[\s/>])/g,k;while(k=_.exec(v)){let E=_.lastIndex,T=[];while(E<v.length){while(/\s/.test(v[E]||""))E++;if(v[E]===">"||v.slice(E,E+2)==="/>"){E+=v[E]===">"?1:2;break}let j=/^[^\s=/>]+/.exec(v.slice(E))?.[0];if(!j){E++;continue}let B=E;E+=j.length;while(/\s/.test(v[E]||""))E++;if(v[E]!=="="){T.push({name:j,value:!0,offset:B,braced:!1});continue}E++;while(/\s/.test(v[E]||""))E++;let z=v[E],F=z==="{",V=z==='"'||z==="'";if(V||F)E++;let H=E;if(F){let G=s(v.slice(E)),J=1,ne=0;for(;ne<G.length;ne++){if(G[ne]==="{")J++;if(G[ne]==="}"&&--J===0)break}E+=ne}else if(V)while(E<v.length&&v[E]!==z)E++;else while(E<v.length&&!/[\s/>]/.test(v[E]))E++;if(T.push({name:j,value:v.slice(H,E),offset:H,braced:F}),V||F)E++}_.lastIndex=E,yield{name:k[1],offset:k.index,attributes:T}}}function kf(v,_,k){let E=[],T=[$f,"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=Ai.isAbsolute(se)||se.startsWith(".")?Ai.resolve(Ai.dirname(k.filePath),se):uo(se,Ai.dirname(k.filePath));if(!ie)continue;let oe=ie.endsWith(".stx")?ie:pl.existsSync(`${ie}.stx`)?`${ie}.stx`:void 0,de=oe?null:lo(ie,!1),ae=re[1].startsWith("{")?re[1].slice(1,-1).split(","):[re[1]];for(let me of ae){let[ve,Se=ve]=me.trim().split(/\s+as\s+/),$e=oe||de?.get(ve)||de?.get(ve.toLowerCase());if($e)z.set(Se,$e),z.set(Se.toLowerCase(),$e),z.set(Se.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=po(se[1],k.filePath,k).find((oe)=>pl.statSync(oe,{throwIfNoEntry:!1})?.isFile());if(ie)z.set(Ai.basename(se[1]).replace(/\.stx$/,""),ie)}let H={__importedComponents:z},G=new Map,J=(re,se,ie)=>{let oe=v.slice(0,re);return{code:se,offset:re,attribute:ie,anchor:!0,kind:"directive",line:oe.split(`
1867
+ }`,props:H,events:G}}var Ti=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 rn(v){if(v.includes("-")||v==="component")return!1;if(/^[A-Z]/.test(v))return!/[a-z]/.test(v)&&[...Ti].some((_)=>_.toLowerCase()===v.toLowerCase());return Ti.has(v)||/[A-Z]/.test(v)}function*Ob(v){let _=/<([A-Za-z][\w.-]*)(?=[\s/>])/g,k;while(k=_.exec(v)){let E=_.lastIndex,T=[];while(E<v.length){while(/\s/.test(v[E]||""))E++;if(v[E]===">"||v.slice(E,E+2)==="/>"){E+=v[E]===">"?1:2;break}let j=/^[^\s=/>]+/.exec(v.slice(E))?.[0];if(!j){E++;continue}let B=E;E+=j.length;while(/\s/.test(v[E]||""))E++;if(v[E]!=="="){T.push({name:j,value:!0,offset:B,braced:!1});continue}E++;while(/\s/.test(v[E]||""))E++;let z=v[E],F=z==="{",V=z==='"'||z==="'";if(V||F)E++;let H=E;if(F){let G=s(v.slice(E)),J=1,ne=0;for(;ne<G.length;ne++){if(G[ne]==="{")J++;if(G[ne]==="}"&&--J===0)break}E+=ne}else if(V)while(E<v.length&&v[E]!==z)E++;else while(E<v.length&&!/[\s/>]/.test(v[E]))E++;if(T.push({name:j,value:v.slice(H,E),offset:H,braced:F}),V||F)E++}_.lastIndex=E,yield{name:k[1],offset:k.index,attributes:T}}}function Cf(v,_,k){let E=[],T=[kf,"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=Ai.isAbsolute(se)||se.startsWith(".")?Ai.resolve(Ai.dirname(k.filePath),se):po(se,Ai.dirname(k.filePath));if(!ie)continue;let oe=ie.endsWith(".stx")?ie:fl.existsSync(`${ie}.stx`)?`${ie}.stx`:void 0,ue=oe?null:uo(ie,!1),ae=re[1].startsWith("{")?re[1].slice(1,-1).split(","):[re[1]];for(let me of ae){let[ve,Se=ve]=me.trim().split(/\s+as\s+/),$e=oe||ue?.get(ve)||ue?.get(ve.toLowerCase());if($e)z.set(Se,$e),z.set(Se.toLowerCase(),$e),z.set(Se.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=fo(se[1],k.filePath,k).find((oe)=>fl.statSync(oe,{throwIfNoEntry:!1})?.isFile());if(ie)z.set(Ai.basename(se[1]).replace(/\.stx$/,""),ie)}let H={__importedComponents:z},G=new Map,J=(re,se,ie)=>{let oe=v.slice(0,re);return{code:se,offset:re,attribute:ie,anchor:!0,kind:"directive",line:oe.split(`
1868
1868
  `).length,column:re-oe.lastIndexOf(`
1869
- `)}},ne=(re,se,ie)=>E.push({expression:re,statement:{text:se+re.code+ie,prefixLength:se.length}});for(let re of Pb(_)){if(rn(re.name)||re.name==="component")continue;let se=Fp(re.name,k.filePath,k,H);if(!se)continue;let ie=G.get(se);if(!ie){let de;try{de=k.readComponent?k.readComponent(se):pl.readFileSync(se,"utf8")}catch{continue}if(de===void 0)continue;B.set(se,de),ie=_f(k.scriptCode(de,se),`__StxComponent${G.size}`),G.set(se,ie),T.push(ie.declarations)}let oe=[];for(let de of re.attributes){let{name:ae,offset:me}=de,ve=de.value===!0?"true":de.value;if(ae.startsWith("@")||ae.startsWith("v-on:")){if(ie.events&&de.value!==!0)j.set(me,`__StxEvent<${ie.events}, ${JSON.stringify(ae.replace(/^@|^v-on:/,"").split(".")[0])}>`);continue}let Se=/^v-model(?::([\w-]+))?(?:\.[\w-]+)*$/.exec(ae);if(ae.startsWith("v-")&&!ae.startsWith("v-bind:")&&!Se)continue;if(/^(?:x-|:)(?:if|for|show|key|else)(?:$|[.:-])/.test(ae))continue;let $e=(Se?Se[1]||"modelValue":ae.replace(/^:|^v-bind:/,"")).replace(/-([a-z])/g,(Te,Re)=>Re.toUpperCase());if(oe.push($e),!ie.props)continue;let Ee=ae.startsWith(":")||ae.startsWith("v-bind:")||!!Se||de.braced?ve:de.value!==!0?JSON.stringify(ve):"true";ne(J(me,Ee,ae),";void ((",`) satisfies __StxProp<${ie.props}, ${JSON.stringify($e)}>);`)}if(ie.props){let de=[...new Set(oe)].map((me)=>`${JSON.stringify(me)}: undefined as any`).join(", "),ae=J(re.offset,`<${re.name}>`);E.push({expression:ae,statement:{text:`;void ({ ${de} } satisfies ${ie.props} & Record<string, unknown>);`,prefixLength:0}})}}return{declarations:G.size?T.join(`
1870
- `):"",checks:E,events:j,dependencies:B}}var Ef=/<script(\s[^>]*)?>([\s\S]*?)<\/script>/gi;function Db(v){let _=(k)=>k.replace(/[^\n]/g," ");return v.replace(/<!--[\s\S]*?-->/g,_).replace(/\{\{--[\s\S]*?--\}\}/g,_)}function ze(v){let _=[],k=Db(v);Ef.lastIndex=0;let E;while((E=Ef.exec(k))!==null){let T=(E[1]||"").trim(),j=(E[0].match(/^<script(?:\s[^>]*)?>/i)?.[0]??"<script>").length,B=(E[0].match(/<\/script\s*>$/i)?.[0]??"</script>").length,z=E.index+j,F=E.index+E[0].length-B,V=v.slice(z,F);if(/\bsrc\s*=/.test(T))continue;let H=T.match(/\btype\s*=\s*["']([^"']+)["']/i);if(H&&!/^(?:module|text\/(?:javascript|typescript))$/i.test(H[1]))continue;let G=/\bserver\b/.test(T)?"server":/\bclient\b/.test(T)?"client":"plain",J=Ii(v,z);_.push({kind:G,code:V,startLine:J,startColumn:Pi(v,z),offset:z,attrs:T})}return _}function Ii(v,_){let k=1;for(let E=0;E<_&&E<v.length;E++)if(v.charCodeAt(E)===10)k++;return k}function Pi(v,_){let k=v.lastIndexOf(`
1871
- `,_-1)+1;return _-k+1}function ko(v){let _=v.split(""),k=(T,j)=>{for(let B=T;B<j&&B<_.length;B++)if(_[B]!==`
1872
- `)_[B]=" "},E=[/<script(?:\s[^>]*)?>[\s\S]*?<\/script>/gi,/<style(?:\s[^>]*)?>[\s\S]*?<\/style>/gi,/<!--[\s\S]*?-->/g,/\{\{--[\s\S]*?--\}\}/g,/@verbatim\b[\s\S]*?@endverbatim\b/g];for(let T of E){T.lastIndex=0;let j;while((j=T.exec(v))!==null)k(j.index,j.index+j[0].length)}return _.join("")}function Mb(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 Of=new Set([":for","x-for","v-for"]),Eo=/(?:^|\s)((?::|x-|v-|@)[\w.:-]+)\s*=\s*(["'])([\s\S]*?)\2/g,fl="__stx_interpolated",Cf="__StxElement",Nf="__StxTemplateValue",Ob=`type ${Nf}<T> = T extends { readonly _isSignal: true } | { readonly _isDerived: true } ? (T extends () => infer V ? T & V : T) : T`;function Rf(v){return v.replace(/\{\{[\s\S]*?\}\}/g,fl).replace(/\{!![\s\S]*?!!\}/g,fl)}function ns(v){return v.replace(/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/g,(_)=>{let k=_.split(`
1869
+ `)}},ne=(re,se,ie)=>E.push({expression:re,statement:{text:se+re.code+ie,prefixLength:se.length}});for(let re of Ob(_)){if(rn(re.name)||re.name==="component")continue;let se=Wp(re.name,k.filePath,k,H);if(!se)continue;let ie=G.get(se);if(!ie){let ue;try{ue=k.readComponent?k.readComponent(se):fl.readFileSync(se,"utf8")}catch{continue}if(ue===void 0)continue;B.set(se,ue),ie=Ef(k.scriptCode(ue,se),`__StxComponent${G.size}`),G.set(se,ie),T.push(ie.declarations)}let oe=[];for(let ue of re.attributes){let{name:ae,offset:me}=ue,ve=ue.value===!0?"true":ue.value;if(ae.startsWith("@")||ae.startsWith("v-on:")){if(ie.events&&ue.value!==!0)j.set(me,`__StxEvent<${ie.events}, ${JSON.stringify(ae.replace(/^@|^v-on:/,"").split(".")[0])}>`);continue}let Se=/^v-model(?::([\w-]+))?(?:\.[\w-]+)*$/.exec(ae);if(ae.startsWith("v-")&&!ae.startsWith("v-bind:")&&!Se)continue;if(/^(?:x-|:)(?:if|for|show|key|else)(?:$|[.:-])/.test(ae))continue;let $e=(Se?Se[1]||"modelValue":ae.replace(/^:|^v-bind:/,"")).replace(/-([a-z])/g,(Te,Re)=>Re.toUpperCase());if(oe.push($e),!ie.props)continue;let Ee=ae.startsWith(":")||ae.startsWith("v-bind:")||!!Se||ue.braced?ve:ue.value!==!0?JSON.stringify(ve):"true";ne(J(me,Ee,ae),";void ((",`) satisfies __StxProp<${ie.props}, ${JSON.stringify($e)}>);`)}if(ie.props){let ue=[...new Set(oe)].map((me)=>`${JSON.stringify(me)}: undefined as any`).join(", "),ae=J(re.offset,`<${re.name}>`);E.push({expression:ae,statement:{text:`;void ({ ${ue} } satisfies ${ie.props} & Record<string, unknown>);`,prefixLength:0}})}}return{declarations:G.size?T.join(`
1870
+ `):"",checks:E,events:j,dependencies:B}}var Rf=/<script(\s[^>]*)?>([\s\S]*?)<\/script>/gi;function Nb(v){let _=(k)=>k.replace(/[^\n]/g," ");return v.replace(/<!--[\s\S]*?-->/g,_).replace(/\{\{--[\s\S]*?--\}\}/g,_)}function ze(v){let _=[],k=Nb(v);Rf.lastIndex=0;let E;while((E=Rf.exec(k))!==null){let T=(E[1]||"").trim(),j=(E[0].match(/^<script(?:\s[^>]*)?>/i)?.[0]??"<script>").length,B=(E[0].match(/<\/script\s*>$/i)?.[0]??"</script>").length,z=E.index+j,F=E.index+E[0].length-B,V=v.slice(z,F);if(/\bsrc\s*=/.test(T))continue;let H=T.match(/\btype\s*=\s*["']([^"']+)["']/i);if(H&&!/^(?:module|text\/(?:javascript|typescript))$/i.test(H[1]))continue;let G=/\bserver\b/.test(T)?"server":/\bclient\b/.test(T)?"client":"plain",J=Ii(v,z);_.push({kind:G,code:V,startLine:J,startColumn:Pi(v,z),offset:z,attrs:T})}return _}function Ii(v,_){let k=1;for(let E=0;E<_&&E<v.length;E++)if(v.charCodeAt(E)===10)k++;return k}function Pi(v,_){let k=v.lastIndexOf(`
1871
+ `,_-1)+1;return _-k+1}function Eo(v){let _=v.split(""),k=(T,j)=>{for(let B=T;B<j&&B<_.length;B++)if(_[B]!==`
1872
+ `)_[B]=" "},E=[/<script(?:\s[^>]*)?>[\s\S]*?<\/script>/gi,/<style(?:\s[^>]*)?>[\s\S]*?<\/style>/gi,/<!--[\s\S]*?-->/g,/\{\{--[\s\S]*?--\}\}/g,/@verbatim\b[\s\S]*?@endverbatim\b/g];for(let T of E){T.lastIndex=0;let j;while((j=T.exec(v))!==null)k(j.index,j.index+j[0].length)}return _.join("")}function jb(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 jf=new Set([":for","x-for","v-for"]),Co=/(?:^|\s)((?::|x-|v-|@)[\w.:-]+)\s*=\s*(["'])([\s\S]*?)\2/g,gl="__stx_interpolated",Tf="__StxElement",Lf="__StxTemplateValue",Lb=`type ${Lf}<T> = T extends { readonly _isSignal: true } | { readonly _isDerived: true } ? (T extends () => infer V ? T & V : T) : T`;function Af(v){return v.replace(/\{\{[\s\S]*?\}\}/g,gl).replace(/\{!![\s\S]*?!!\}/g,gl)}function ns(v){return v.replace(/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/g,(_)=>{let k=_.split(`
1873
1873
  `).length-1,E=_.length-k;return`0${" ".repeat(Math.max(0,E-1))}${`
1874
- `.repeat(k)}`})}var Nb=["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"],jb=new RegExp(String.raw`^[ \t]*@(?:${Nb.join("|")})\b[ \t]*(\([^\n)]*\))?[ \t]*$`,"gm");function rs(v){return v.replace(jb,(_)=>_.replace(/[^\n]/g," "))}var Tf=new Set(["x-cloak","x-ref","x-transition","x-teleport","v-slot","x-hydrate",":key","x-tooltip","x-tooltip-position"]);function sc(v){let _=ko(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=Mb(z);if(!V.trim())continue;let H=T.index+F+(V.length-V.trimStart().length);k.push({code:V.trim(),line:Ii(_,H),column:Pi(_,H),offset:H,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 J=_[F];if(J==="(")z++;else if(J===")"){if(z--,z===0)break}}if(z!==0)continue;let V=_.slice(B+1,F),H=V.trim();if(j.lastIndex=F+1,!H)continue;let G=B+1+(V.length-V.trimStart().length);k.push({code:H,line:Ii(_,G),column:Pi(_,G),offset:T.index,kind:"condition"})}Eo.lastIndex=0;while((T=Eo.exec(_))!==null){let B=T[1],z=T[3]??"",F=B.replace(/\..*$/,"").replace(/^([^:].*?):.*$/,"$1");if(Tf.has(F)||Tf.has(B))continue;if(!z.trim())continue;let V=T.index+T[0].indexOf(T[2],T[0].indexOf(B)+B.length)+1;if(Of.has(F)){let G=z.match(/\s+(?:in|of)\s+/);if(!G||G.index===void 0)continue;let J=z.slice(G.index+G[0].length),ne=G.index+G[0].length+(J.length-J.trimStart().length);k.push({code:Rf(J.trim()),line:Ii(_,V+ne),column:Pi(_,V+ne),offset:V+ne,kind:"directive",attribute:F});continue}let H=z.length-z.trimStart().length;k.push({code:Rf(z.trim()),line:Ii(_,V+H),column:Pi(_,V+H),offset:V+H,kind:"directive",attribute:F})}return k.sort((B,z)=>B.line-z.line||B.column-z.column),k}var Lb=2000;function Bb(v,_){let k=0,E=Math.min(v.length,_+Lb);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 zb(v){let _=new Map,k=(z,F)=>{let V=z.split(/[,[\]{}()\s]+/).filter(Boolean);for(let H of V){let G=H.replace(/^\.\.\./,"").trim();if(!/^\$?[A-Z_$][\w$]*$/i.test(G))continue;let J=V.length===1?F:void 0,ne=_.get(G);if(!ne)_.set(G,{name:G,iterable:J});else if(ne.iterable!==J)ne.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=Bb(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=ko(v);Eo.lastIndex=0;let B;while((B=Eo.exec(j))!==null){let z=B[1].replace(/\..*$/,"");if(!Of.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 Q(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 gl=["params","query","cookies","host","ip","setResponseStatus","setResponseHeader","notFound","request","url","definePageMeta","defineClientPayload","defineStore","props","$props"],Fb={$bool:"declare function $bool(value: unknown, fallback?: boolean): boolean",$num:"declare function $num(value: unknown, fallback?: number): number",$uid:"declare var $uid: string"};function Ko(v=new Set){return[...gl.filter((_)=>!v.has(_)).map((_)=>`declare var ${_}: any`),...Object.entries(Fb).filter(([_])=>!v.has(_)).map(([,_])=>_)].join(`
1875
- `)}function Xo(v){return new Set([...v.matchAll(/^declare (?:function|const|let|var)\s+([A-Za-z_$][\w$]*)/gm)].map((_)=>_[1]))}function jf(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 Vb(k[1])){let z=B.split(":")[0].trim();if(/^[A-Za-z_$][\w$]*$/.test(z))T.add(z)}}return E?[...T]:null}function Vb(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 Wb(v){let _=/^[ \t]*import\b[\s\S]*?(?:from\s*['"][^'"]*['"]|['"][^'"]*['"])[ \t]*;?[ \t]*$/gm,k=[],E=v.replace(_,(T)=>(k.push(T.trim()),T.split(`
1874
+ `.repeat(k)}`})}var Bb=["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"],zb=new RegExp(String.raw`^[ \t]*@(?:${Bb.join("|")})\b[ \t]*(\([^\n)]*\))?[ \t]*$`,"gm");function rs(v){return v.replace(zb,(_)=>_.replace(/[^\n]/g," "))}var If=new Set(["x-cloak","x-ref","x-transition","x-teleport","v-slot","x-hydrate",":key","x-tooltip","x-tooltip-position"]);function sc(v){let _=Eo(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=jb(z);if(!V.trim())continue;let H=T.index+F+(V.length-V.trimStart().length);k.push({code:V.trim(),line:Ii(_,H),column:Pi(_,H),offset:H,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 J=_[F];if(J==="(")z++;else if(J===")"){if(z--,z===0)break}}if(z!==0)continue;let V=_.slice(B+1,F),H=V.trim();if(j.lastIndex=F+1,!H)continue;let G=B+1+(V.length-V.trimStart().length);k.push({code:H,line:Ii(_,G),column:Pi(_,G),offset:T.index,kind:"condition"})}Co.lastIndex=0;while((T=Co.exec(_))!==null){let B=T[1],z=T[3]??"",F=B.replace(/\..*$/,"").replace(/^([^:].*?):.*$/,"$1");if(If.has(F)||If.has(B))continue;if(!z.trim())continue;let V=T.index+T[0].indexOf(T[2],T[0].indexOf(B)+B.length)+1;if(jf.has(F)){let G=z.match(/\s+(?:in|of)\s+/);if(!G||G.index===void 0)continue;let J=z.slice(G.index+G[0].length),ne=G.index+G[0].length+(J.length-J.trimStart().length);k.push({code:Af(J.trim()),line:Ii(_,V+ne),column:Pi(_,V+ne),offset:V+ne,kind:"directive",attribute:F});continue}let H=z.length-z.trimStart().length;k.push({code:Af(z.trim()),line:Ii(_,V+H),column:Pi(_,V+H),offset:V+H,kind:"directive",attribute:F})}return k.sort((B,z)=>B.line-z.line||B.column-z.column),k}var Fb=2000;function Vb(v,_){let k=0,E=Math.min(v.length,_+Fb);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 Wb(v){let _=new Map,k=(z,F)=>{let V=z.split(/[,[\]{}()\s]+/).filter(Boolean);for(let H of V){let G=H.replace(/^\.\.\./,"").trim();if(!/^\$?[A-Z_$][\w$]*$/i.test(G))continue;let J=V.length===1?F:void 0,ne=_.get(G);if(!ne)_.set(G,{name:G,iterable:J});else if(ne.iterable!==J)ne.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=Vb(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=Eo(v);Co.lastIndex=0;let B;while((B=Co.exec(j))!==null){let z=B[1].replace(/\..*$/,"");if(!jf.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 Q(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 ml=["params","query","cookies","host","ip","setResponseStatus","setResponseHeader","notFound","request","url","definePageMeta","defineClientPayload","defineStore","props","$props"],Ub={$bool:"declare function $bool(value: unknown, fallback?: boolean): boolean",$num:"declare function $num(value: unknown, fallback?: number): number",$uid:"declare var $uid: string"};function Ko(v=new Set){return[...ml.filter((_)=>!v.has(_)).map((_)=>`declare var ${_}: any`),...Object.entries(Ub).filter(([_])=>!v.has(_)).map(([,_])=>_)].join(`
1875
+ `)}function Xo(v){return new Set([...v.matchAll(/^declare (?:function|const|let|var)\s+([A-Za-z_$][\w$]*)/gm)].map((_)=>_[1]))}function Bf(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 Hb(k[1])){let z=B.split(":")[0].trim();if(/^[A-Za-z_$][\w$]*$/.test(z))T.add(z)}}return E?[...T]:null}function Hb(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 qb(v){let _=/^[ \t]*import\b[\s\S]*?(?:from\s*['"][^'"]*['"]|['"][^'"]*['"])[ \t]*;?[ \t]*$/gm,k=[],E=v.replace(_,(T)=>(k.push(T.trim()),T.split(`
1876
1876
  `).map(()=>"").join(`
1877
1877
  `)));return{imports:k.join(`
1878
- `),body:E}}function Lf(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 H=_.indexOf("{",B.index);if(H===-1)continue;let G=0;V=-1;for(let J=H;J<_.length;J++)if(_[J]==="{")G++;else if(_[J]==="}"&&--G===0){V=J+1;break}if(V===-1)continue}else{let H=0;V=_.length;for(let G=_.indexOf("=",B.index)+1;G<_.length;G++){let J=_[G];if(J==="{"||J==="["||J==="("||J==="<")H++;else if(J==="}"||J==="]"||J===")"||J===">")H--;else if(H<=0&&(J===";"||J===`
1879
- `&&!/[=|&,<([{]\s*$/.test(_.slice(Math.max(0,G-40),G)))){V=J===";"?G+1:G;break}}}T.push({name:F,text:v.slice(B.index,V).replace(/^[ \t]*export[ \t]+/,"")}),j.lastIndex=V}return T}function Ub(v){return new Set(Lf(v).map((_)=>_.name))}function Go(v,_=""){let k=jf(v),E=Ub(_),T=Lf(v).filter((V)=>!E.has(V.name)).map((V)=>V.text);if(!k){let V=Q(v).filter((H)=>!Ui(_,H));if(V.length===0&&T.length===0)return"";return["",`// ${Hb}`,...T,...V.map((H)=>`declare var ${H}: any`)].join(`
1880
- `)}if(k.length===0)return T.length>0?["",`// ${Af}`,...T].join(`
1881
- `):"";let{imports:j,body:B}=Wb(v),z=B.replace(/^[ \t]*export[ \t]+(?=(?:const|let|var|function|async|class)\b)/gm,""),F=["",`// ${Af}`];if(j)F.push(j);return F.push(...T),F.push(`async function ${If}() {`,z,` return { ${k.join(", ")} }`,"}",`type ${Pf} = Awaited<ReturnType<typeof ${If}>>`,...k.map((V)=>`declare var ${V}: ${Pf}[${JSON.stringify(V)}]`)),F.join(`
1882
- `)}function ml(v){let k=s(v).split(""),E=0;for(let T=0;T<k.length;T++){let j=k[T];if(j==="{"||j==="("||j==="["){E++;continue}if(j==="}"||j===")"||j==="]"){E=Math.max(0,E-1);continue}if(E>0&&j!==`
1883
- `)k[T]=" "}return Q(k.join(""))}function Jo(v,_){if(jf(v)!==null)return[];let k=s(_),E=new Set(y);return ml(v).filter((T)=>{if(E.has(T))return!1;if(Q(_).includes(T))return!1;return new RegExp(`(?<![.#\\w$])${T}(?![\\w$])`).test(k)})}var Af="stx: types for the declared client payload (#1868)",Hb="stx: untyped bridge names \u2014 declare a defineClientPayload to check these (#1868)",If="__stxServerScope",Pf="__StxClientPayload";var Df=["$env","$user","$slot","$slots","$attrs","$props","$page","$route","$loop","loop","$errors","$csrf","props","slot"];var qb=/^\s*[A-Z_$][\w$]*\s*=[^=]/i;function Kb(v){let _=new Map,k=/!|===|!==|==|!=|&&|\|\||<|>|\btypeof\b|\binstanceof\b|\bin\b/;for(let E of v){let T=s(E),{depths:j,balanced:B}=we(T);if(!B)continue;let z=/^([ \t]*(?:export[ \t]+)?const[ \t]+)([A-Za-z_$][\w$]*)[ \t]*(?::[^=\n]+)?=[ \t]*([^\n]+)$/gm;for(let F of T.matchAll(z)){let V=F.index??0;if(j[V+F[1].length]!==0)continue;let H=F[2],G=V+F[0].length-F[3].length,J=E.slice(G,V+F[0].length).trim().replace(/;$/,"").trim(),ne=F[3],re=k.test(ne)&&!/\bawait\b|=>|\bfunction\b|[{}]/.test(ne)&&!/[,+\-*/%&|?:=]$/.test(J)&&we(ne).balanced;_.set(H,_.has(H)||!re?null:J)}}return new Map([..._].filter((E)=>E[1]!==null))}function Bf(v,_,k=0,E=new Set){if(_.size===0||k>=5)return v;let T=s(v),j="",B=0;for(let z of T.matchAll(/[A-Za-z_$][\w$]*/g)){let F=z.index??0,V=z[0],H=_.get(V);if(!H||E.has(V))continue;let G=T.slice(0,F).trimEnd(),J=T.slice(F+V.length).trimStart();if(G.endsWith(".")||/^:(?!:)/.test(J)&&/[{,]$/.test(G))continue;if(F>0&&/[\w$]/.test(T[F-1]))continue;j+=`${v.slice(B,F)}(${Bf(H,_,k+1,new Set([...E,V]))})`,B=F+V.length}return j+v.slice(B)}function Xb(v,_){let k=/@(if|unless|elseif|else|endif|endunless)\b\s*(\()?/g,E=[],T;while((T=k.exec(v))!==null){if(T.index>_)break;let j=T[1];if(T.index===_){if(j==="elseif"){let z=E[E.length-1];if(z?.current)z.seen.push(z.current);if(z)z.current=null}break}if(j==="endif"||j==="endunless"){E.pop();continue}let B="";if(T[2]==="("){let z=0,F=T.index+T[0].length-1,V=F+1;for(;F<v.length;F++){let H=v[F];if(H==="(")z++;else if(H===")"){if(z--,z===0)break}}B=v.slice(V,F).trim(),k.lastIndex=F+1}if(j==="if")E.push({seen:[],current:B});else if(j==="unless")E.push({seen:[],current:`!(${B})`});else if(j==="elseif"||j==="else"){let z=E[E.length-1];if(!z)continue;if(z.current)z.seen.push(z.current);z.current=j==="elseif"?B:null}}return E.flatMap((j)=>[...j.seen.map((B)=>`!(${B})`),...j.current?[j.current]:[]]).filter(Boolean)}function Zb(v){let _=v.code.trim();if(!_)return null;if(v.attribute?.startsWith("@")){if(qb.test(_))return null;let E=";(($event: any): void => { ";return{text:`${E}${_} });`,prefixLength:E.length}}let k=";void ((";return{text:`${k}${_}));`,prefixLength:k.length}}var Gb=/(\bfrom\s*|\bimport\s*\(\s*|\bimport\s+)(['"])(\.{1,2}\/[^'"\n]*)\2/g;function Fn(v,_){if(!_)return v;return v.replace(Gb,(k,E,T,j)=>{let B=Mf.resolve(_,j).replace(/\\/g,"/");return`${E}${T}${B}${T}`})}function ss(v){return" ".repeat(Math.max(0,(v.startColumn??1)-1))}function Jb(v){let _=new Set,k=s(v);for(let E of k.matchAll(/\bimport\s+(?:type\s+)?([\w$*{}\s,]+?)\s+from\b/g)){let T=E[1],j=/\{([^}]*)\}/.exec(T);for(let V of j?.[1].split(",")??[]){let H=V.trim().replace(/^type\s+/,"").split(/\s+as\s+/).pop()?.trim();if(H&&/^[A-Z_$][\w$]*$/i.test(H))_.add(H)}let B=T.replace(/\{[^}]*\}/,""),z=/\*\s*as\s+([A-Z_$][\w$]*)/i.exec(B);if(z)_.add(z[1]);let F=/^\s*([A-Z_$][\w$]*)/i.exec(B);if(F&&F[1]!=="type")_.add(F[1])}return[..._].sort()}function Yo(v,_={}){let k=ze(v),E=v.split(`
1884
- `),T=Array.from({length:E.length},()=>""),j=new Map,B=_.filePath&&_.templateExpressions!==!1?kf(v,ko(v),{filePath:_.filePath,componentsDir:_.componentsDir,projectRoot:_.projectRoot,readComponent:_.readComponent,scriptCode:(G,J)=>ze(G).map((ne)=>Fn(ne.code,Mf.dirname(J))).join(`
1878
+ `),body:E}}function zf(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 H=_.indexOf("{",B.index);if(H===-1)continue;let G=0;V=-1;for(let J=H;J<_.length;J++)if(_[J]==="{")G++;else if(_[J]==="}"&&--G===0){V=J+1;break}if(V===-1)continue}else{let H=0;V=_.length;for(let G=_.indexOf("=",B.index)+1;G<_.length;G++){let J=_[G];if(J==="{"||J==="["||J==="("||J==="<")H++;else if(J==="}"||J==="]"||J===")"||J===">")H--;else if(H<=0&&(J===";"||J===`
1879
+ `&&!/[=|&,<([{]\s*$/.test(_.slice(Math.max(0,G-40),G)))){V=J===";"?G+1:G;break}}}T.push({name:F,text:v.slice(B.index,V).replace(/^[ \t]*export[ \t]+/,"")}),j.lastIndex=V}return T}function Kb(v){return new Set(zf(v).map((_)=>_.name))}function Go(v,_=""){let k=Bf(v),E=Kb(_),T=zf(v).filter((V)=>!E.has(V.name)).map((V)=>V.text);if(!k){let V=Q(v).filter((H)=>!Ui(_,H));if(V.length===0&&T.length===0)return"";return["",`// ${Xb}`,...T,...V.map((H)=>`declare var ${H}: any`)].join(`
1880
+ `)}if(k.length===0)return T.length>0?["",`// ${Pf}`,...T].join(`
1881
+ `):"";let{imports:j,body:B}=qb(v),z=B.replace(/^[ \t]*export[ \t]+(?=(?:const|let|var|function|async|class)\b)/gm,""),F=["",`// ${Pf}`];if(j)F.push(j);return F.push(...T),F.push(`async function ${Df}() {`,z,` return { ${k.join(", ")} }`,"}",`type ${Mf} = Awaited<ReturnType<typeof ${Df}>>`,...k.map((V)=>`declare var ${V}: ${Mf}[${JSON.stringify(V)}]`)),F.join(`
1882
+ `)}function hl(v){let k=s(v).split(""),E=0;for(let T=0;T<k.length;T++){let j=k[T];if(j==="{"||j==="("||j==="["){E++;continue}if(j==="}"||j===")"||j==="]"){E=Math.max(0,E-1);continue}if(E>0&&j!==`
1883
+ `)k[T]=" "}return Q(k.join(""))}function Jo(v,_){if(Bf(v)!==null)return[];let k=s(_),E=new Set(y);return hl(v).filter((T)=>{if(E.has(T))return!1;if(Q(_).includes(T))return!1;return new RegExp(`(?<![.#\\w$])${T}(?![\\w$])`).test(k)})}var Pf="stx: types for the declared client payload (#1868)",Xb="stx: untyped bridge names \u2014 declare a defineClientPayload to check these (#1868)",Df="__stxServerScope",Mf="__StxClientPayload";var Of=["$env","$user","$slot","$slots","$attrs","$props","$page","$route","$loop","loop","$errors","$csrf","props","slot"];var Zb=/^\s*[A-Z_$][\w$]*\s*=[^=]/i;function Gb(v){let _=new Map,k=/!|===|!==|==|!=|&&|\|\||<|>|\btypeof\b|\binstanceof\b|\bin\b/;for(let E of v){let T=s(E),{depths:j,balanced:B}=we(T);if(!B)continue;let z=/^([ \t]*(?:export[ \t]+)?const[ \t]+)([A-Za-z_$][\w$]*)[ \t]*(?::[^=\n]+)?=[ \t]*([^\n]+)$/gm;for(let F of T.matchAll(z)){let V=F.index??0;if(j[V+F[1].length]!==0)continue;let H=F[2],G=V+F[0].length-F[3].length,J=E.slice(G,V+F[0].length).trim().replace(/;$/,"").trim(),ne=F[3],re=k.test(ne)&&!/\bawait\b|=>|\bfunction\b|[{}]/.test(ne)&&!/[,+\-*/%&|?:=]$/.test(J)&&we(ne).balanced;_.set(H,_.has(H)||!re?null:J)}}return new Map([..._].filter((E)=>E[1]!==null))}function Ff(v,_,k=0,E=new Set){if(_.size===0||k>=5)return v;let T=s(v),j="",B=0;for(let z of T.matchAll(/[A-Za-z_$][\w$]*/g)){let F=z.index??0,V=z[0],H=_.get(V);if(!H||E.has(V))continue;let G=T.slice(0,F).trimEnd(),J=T.slice(F+V.length).trimStart();if(G.endsWith(".")||/^:(?!:)/.test(J)&&/[{,]$/.test(G))continue;if(F>0&&/[\w$]/.test(T[F-1]))continue;j+=`${v.slice(B,F)}(${Ff(H,_,k+1,new Set([...E,V]))})`,B=F+V.length}return j+v.slice(B)}function Jb(v,_){let k=/@(if|unless|elseif|else|endif|endunless)\b\s*(\()?/g,E=[],T;while((T=k.exec(v))!==null){if(T.index>_)break;let j=T[1];if(T.index===_){if(j==="elseif"){let z=E[E.length-1];if(z?.current)z.seen.push(z.current);if(z)z.current=null}break}if(j==="endif"||j==="endunless"){E.pop();continue}let B="";if(T[2]==="("){let z=0,F=T.index+T[0].length-1,V=F+1;for(;F<v.length;F++){let H=v[F];if(H==="(")z++;else if(H===")"){if(z--,z===0)break}}B=v.slice(V,F).trim(),k.lastIndex=F+1}if(j==="if")E.push({seen:[],current:B});else if(j==="unless")E.push({seen:[],current:`!(${B})`});else if(j==="elseif"||j==="else"){let z=E[E.length-1];if(!z)continue;if(z.current)z.seen.push(z.current);z.current=j==="elseif"?B:null}}return E.flatMap((j)=>[...j.seen.map((B)=>`!(${B})`),...j.current?[j.current]:[]]).filter(Boolean)}function Yb(v){let _=v.code.trim();if(!_)return null;if(v.attribute?.startsWith("@")){if(Zb.test(_))return null;let E=";(($event: any): void => { ";return{text:`${E}${_} });`,prefixLength:E.length}}let k=";void ((";return{text:`${k}${_}));`,prefixLength:k.length}}var Qb=/(\bfrom\s*|\bimport\s*\(\s*|\bimport\s+)(['"])(\.{1,2}\/[^'"\n]*)\2/g;function Fn(v,_){if(!_)return v;return v.replace(Qb,(k,E,T,j)=>{let B=Nf.resolve(_,j).replace(/\\/g,"/");return`${E}${T}${B}${T}`})}function ss(v){return" ".repeat(Math.max(0,(v.startColumn??1)-1))}function ev(v){let _=new Set,k=s(v);for(let E of k.matchAll(/\bimport\s+(?:type\s+)?([\w$*{}\s,]+?)\s+from\b/g)){let T=E[1],j=/\{([^}]*)\}/.exec(T);for(let V of j?.[1].split(",")??[]){let H=V.trim().replace(/^type\s+/,"").split(/\s+as\s+/).pop()?.trim();if(H&&/^[A-Z_$][\w$]*$/i.test(H))_.add(H)}let B=T.replace(/\{[^}]*\}/,""),z=/\*\s*as\s+([A-Z_$][\w$]*)/i.exec(B);if(z)_.add(z[1]);let F=/^\s*([A-Z_$][\w$]*)/i.exec(B);if(F&&F[1]!=="type")_.add(F[1])}return[..._].sort()}function Yo(v,_={}){let k=ze(v),E=v.split(`
1884
+ `),T=Array.from({length:E.length},()=>""),j=new Map,B=_.filePath&&_.templateExpressions!==!1?Cf(v,Eo(v),{filePath:_.filePath,componentsDir:_.componentsDir,projectRoot:_.projectRoot,readComponent:_.readComponent,scriptCode:(G,J)=>ze(G).map((ne)=>Fn(ne.code,Nf.dirname(J))).join(`
1885
1885
  `)}):void 0,z=new Set,F=[];for(let G of k){let J=rs(ns(G.code)),ne=Fn(J,_.originDir??"").split(`
1886
1886
  `);ne.forEach((re,se)=>{let ie=G.startLine-1+se;if(ie<T.length)T[ie]=se===0?ss(G)+re:re,z.add(ie)}),F.push(G.startLine-1+ne.length-1)}for(let G of F){let J=T[G]?.trim()===""?G:G+1;if(J<T.length&&T[J].trim()===""&&(J===G||!z.has(J)))T[J]=";"}let V=(G,J)=>{for(let[ne,re]of G.split(`
1887
- `).entries())if(T.push(re),J)j.set(T.length,ne===0?J:{...J,line:J.line+ne,column:1,prefixLength:0})};if(_.globals!==!1){V("");let G=new Set([...k.flatMap((se)=>Q(se.code)),...k.flatMap((se)=>Jb(se.code))]),J=(se)=>{if(!G.has(se))V(`declare var ${se}: any`)};if(_.runtimeGlobals!==!1){if(!G.has("window"))V("declare var window: any");for(let se of y)J(se)}let ne=[...new Set([...gl,...W,...Df])].filter((se)=>_.runtimeGlobals!==!1||!y.includes(se));if(_.contextScope==="global"){V("declare global {");for(let se of ne)V(` var ${se}: any`);V("}")}else{for(let se of gl)J(se);for(let se of W)J(se);for(let se of Df)J(se)}V(`declare var ${fl}: any`);let re=new Set(k.flatMap((se)=>Q(se.code)));V(`type ${Cf}<T> = T extends readonly (infer E)[] ? E : T extends Iterable<infer E2> ? E2 : any`);for(let se of zb(v)){if(re.has(se.name))continue;let ie=se.iterable&&re.has(se.iterable)?`${Cf}<typeof ${se.iterable}>`:"any";V(`declare var ${se.name}: ${ie}`)}}if(_.templateExpressions!==!1){if(B?.declarations)for(let J of B.declarations.split(`
1888
- `))V(J);let G=sc(v).map((J)=>{let ne=B?.events.get(J.offset??-1);if(ne){J.anchor=!0;let re=J.code.trim(),se=/^([\w$]+)\s*=\s*([^=][\s\S]*)$/.exec(re),ie=se?`void ((${se[2]}) satisfies __StxAssignedValue<typeof ${se[1]}>)`:/^[\w$]+(?:\.[\w$]+)*$/.test(re)?`${re} satisfies (($event: ${ne}) => unknown)`:re,oe=`;(($event: ${ne}): void => { `;return{expression:J,statement:{text:`${oe}${ie} });`,prefixLength:oe.length}}}return{expression:J,statement:Zb(J)}}).filter((J)=>J.statement!==null);if(G.push(...B?.checks||[]),G.length>0){let J=ko(v),ne=Kb(k.map((oe)=>oe.code)),se=[...new Set(k.flatMap((oe)=>Q(oe.code)))].filter((oe)=>/^[A-Z_$][\w$]*$/i.test(oe)),ie=0;if(se.length>0){V(Ob);for(let oe of se)V(`type __StxT_${oe} = ${Nf}<typeof ${oe}>`);V(`;((${se.map((oe)=>`${oe}: __StxT_${oe}`).join(", ")}) => {`),ie=1}for(let{expression:oe,statement:de}of G){let ae=" ".repeat(ie),me=oe.offset===void 0?[]:Xb(J,oe.offset),ve=me.length>0?`${me.map(($e)=>`if (${Bf($e,ne)}) `).join("")}{ `:"",Se=me.length>0?" }":"";V(ae+ve+de.text+Se,{line:oe.line,column:oe.column,expression:oe,prefixLength:de.prefixLength+ae.length+ve.length,guardPrefixLength:ae.length+ve.length})}if(ie>0)V("});")}}let H=!1;if(_.reference&&T[0]!==void 0&&T[0].trim()==="")T[0]=`/// <reference path=${JSON.stringify(_.reference.replace(/\\/g,"/"))} />`,H=!0;return V("export {}"),{text:T.join(`
1889
- `),lineMap:j,sourceLineCount:E.length,componentDependencies:B?.dependencies,referenced:H}}function Zo(v,_){if(!v.expression)return!1;return v.inGuard===!0||_===2774}function Qo(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 zf from"fs";import Ff from"path";var Vf=!1;function Yb(v,_,k,E=!1){let T={static:{},staticNames:{},serverDynamic:{},serverDynamicNames:{},clientReactive:{},events:{}},j=new Set(Array.isArray(_.__stx_client_signal_names)?_.__stx_client_signal_names:[]),B=(H)=>{if(j.size===0)return!1;let G=s(H),J=G.match(/^\s*[!+~(-]*\s*([a-zA-Z_$][\w$]*)/)?.[1];if(J&&j.has(J))return!0;for(let ne of j){let re=ne.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(new RegExp(`(?:^|[^\\w$.])${re}\\s*\\(`).test(G))return!0}return!1},z=new Set(Ei),F=(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,(G,J)=>J.toUpperCase())},V=(H,G)=>{let J=F(H);if(T.static[J]=G,J!==H)T.staticNames[J]=H};for(let[H,G]of Object.entries(v)){let J=H.startsWith("x-")&&!z.has(H)&&!H.startsWith("x-bind:")&&!H.startsWith("x-on:")?`:${H.slice(2)}`:H;if(J.startsWith("@")){T.events[J]=G;continue}if(J.startsWith("__stx_")){let ne=F(J.slice(6));T.serverDynamic[ne]=xf(G,k);continue}if(J.startsWith(":")){let ne=F(J.slice(1)),re=G===Ir?ne:G;if(ne==="if"||ne==="for"||ne==="show"){T.clientReactive[ne]=re;continue}if(E){T.clientReactive[ne]=re;continue}if(B(re)){T.clientReactive[ne]=re;continue}try{if(!p(re)){if(k.debug)console.error(`Unsafe expression in :${ne} binding: ${re}`);T.clientReactive[ne]=re;continue}let se=Object.keys(_),ie=new Set(["true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","if","else"]),oe=new Set(Array.isArray(_.__stx_client_declared_names)?_.__stx_client_declared_names:[]);if(xe(re).some((ve)=>!ie.has(ve)&&!se.includes(ve)&&(!(ve in globalThis)||oe.has(ve)))){T.clientReactive[ne]=re;continue}let me=l(re,se)(...Object.values(_));if(T.serverDynamic[ne]=me,ne!==J.slice(1)&&T.serverDynamicNames)T.serverDynamicNames[ne]=J.slice(1)}catch{T.clientReactive[ne]=re}continue}if(typeof G==="string"&&G.includes("{{")&&G.includes("}}")){let ne=G.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(ne)try{let re=ne[1];if(p(re)){let ie=l(re,Object.keys(_))(...Object.values(_));V(J,ie!=null?String(ie):"")}else{if(k.debug)console.error(`Unsafe expression in ${J}: ${re}`);V(J,G)}}catch(re){if(k.debug)console.error(`Error evaluating expression for ${J}:`,re);V(J,G)}else{let re=G,se=/\{\{\s*([\s\S]+?)\s*\}\}/g,ie;while((ie=se.exec(G))!==null)try{let oe=ie[1];if(!p(oe)){if(k.debug)console.error(`Unsafe expression in ${J}: ${oe}`);continue}let ae=l(oe,Object.keys(_))(...Object.values(_));re=re.replace(ie[0],String(ae??""))}catch(oe){if(k.debug)console.error(`Error evaluating expression in ${J}:`,oe)}V(J,re)}continue}V(J,G===Ir?"true":yf(G))}return T}var Qb=[[/@if\s*\(/,"@endif"],[/@unless\s*\(/,"@endunless"]];function ev(v,_,k){if(!v.includes("@"))return v;if(!Qb.some(([T,j])=>T.test(v)&&v.includes(j)))return v;try{return ar(v,_,k)}catch{return v}}function qf(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=ll(v,k),k+=j.length;let B=bf(j);if(B!==null){_[`:${T}`]=B;continue}}else while(k<E&&!/\s/.test(v[k]))j+=v[k],k++;_[T]=j}else _[T]=Ir}return _}function Wf(v){return Object.entries(v).map(([_,k])=>k===Ir?_:`${_}="${tv(k)}"`).join(" ")}function tv(v){return v.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function nv(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(Is.isBuiltin(T))_.add(T)}return[..._].sort()}async function oc(v,_,k,E,T){if(!/import\s/.test(v))return v;if(!_.__importedComponents)_.__importedComponents=new Map;let j=_.__importedComponents,B=Ff.dirname(k),z=[],F=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi;for(let G of v.matchAll(F)){let[J,ne,re]=G,se=/import\s+(?:(\{[^}]*\})|([A-Za-z_$][\w$]*))\s+from\s+['"]([^'"]+)['"]\s*;?\s*\n?/g,ie=re,oe,de=[];while((oe=se.exec(re))!==null){let[ae,me,ve,Se]=oe,$e=null,Ce=null;if(Se.startsWith(".")||Se.startsWith("/")){let Re=Ff.resolve(B,Se);if(Re.endsWith(".stx"))Ce=Re;else{let _e=`${Re}.stx`;try{if(zf.statSync(_e).isFile())Ce=_e}catch{try{if(zf.statSync(Re).isDirectory())$e=Re}catch{}}}}else $e=uo(Se,B);if(!$e&&!Ce)continue;let Ee=!1,Te=(Re,_e)=>{j.set(Re,_e),j.set(Re.toLowerCase(),_e);let Ae=Re.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();j.set(Ae,_e),T.add(_e)};if(ve&&Ce)Te(ve,Ce),Ee=!0;else if(me){let Re=me.slice(1,-1).split(",").map((Ae)=>Ae.trim()).filter(Boolean).map((Ae)=>{let Xe=Ae.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(Xe)return{source:Xe[1],local:Xe[2]};return{source:Ae,local:Ae}}),_e=$e?lo($e):null;for(let{source:Ae,local:Xe}of Re){let Pe=null;if(Ce)Pe=Ce;else if(_e)Pe=_e.get(Ae)??_e.get(Ae.toLowerCase())??_e.get(Ae.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase())??null;if(Pe)Te(Xe,Pe),Ee=!0}}if(Ee)de.push({start:oe.index,end:oe.index+ae.length})}if(de.length===0)continue;for(let ae=de.length-1;ae>=0;ae--)ie=ie.slice(0,de[ae].start)+ie.slice(de[ae].end);z.push({start:G.index,end:G.index+J.length,value:`<script${ne}>${ie}</script>`})}if(z.length===0)return v;let V=[],H=0;for(let G of z)V.push(v.slice(H,G.start),G.value),H=G.end;return V.push(v.slice(H)),V.join("")}async function rv(v,_,k,E,T){let j=v;if(!_.__importedComponents)_.__importedComponents=new Map;let B=_.__importedComponents,z=/@import\s*\(\s*([^)]+)\s*\)/g,F;while((F=z.exec(j))!==null){let[V,H]=F,G=H.split(",").map((J)=>J.trim().replace(/^['"]|['"]$/g,"")).filter((J)=>J.length>0);for(let J of G){let ne=J.split("/"),se=ne[ne.length-1].replace(/\.stx$/,""),ie=se.includes("-")?se.split("-").map((ae)=>ae.charAt(0).toUpperCase()+ae.slice(1)).join(""):se.charAt(0).toUpperCase()+se.slice(1),oe=null,de=po(J,k,E);for(let ae of de)try{if(await Bun.file(ae).exists()){oe=ae;break}}catch{}if(oe){B.set(ie,oe),B.set(se,oe),B.set(se.toLowerCase(),oe);let ae=ie.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(B.set(ae,oe),T.add(oe),E.debug)console.log(`Imported component: ${ie} -> ${oe}`)}else if(E.debug)console.warn(`Could not resolve imported component: ${J}`)}j=j.replace(V,""),z.lastIndex=0}return j}async function sv(v,_,k,E,T){let j=v,B=E.componentsDir||"components";if(!_.__processedComponents)_.__processedComponents=new Set;let z=_.__processedComponents,F=/@component\s*\(/g,V;while((V=F.exec(j))!==null){let H=V.index,G=H+V[0].length-1,J=1,ne=G+1;while(ne<j.length&&J>0){if(j[ne]==="(")J++;else if(j[ne]===")"){if(J--,J===0)break}ne++}if(J!==0)break;let re=j.substring(G+1,ne),se=ne+1,ie=re.match(/^\s*['"]([^'"]+)['"]/);if(!ie){F.lastIndex=0;continue}let oe=ie[1],de,ae=re.slice(ie[0].length),me=ae.match(/^\s*,\s*/);if(me)de=ae.slice(me[0].length).trim();let ve={};if(de)try{ve=D(de,_)}catch(Re){let _e=Re instanceof Error?Re.message:String(Re);j=j.replace(j.substring(H,se),`[Error parsing component props: ${_e}]`);continue}let Se="",$e=se,Ee=j.substring(se).match(/^([\s\S]*?)@endcomponent/);if(Ee)Se=Ee[1].trim(),$e=se+Ee[0].length;let Te=await We(oe,ve,Se,B,_,k,E,z,T);j=j.substring(0,H)+Te+j.substring($e),F.lastIndex=0}return j}async function iv(v,_,k,E,T){if(!v)return v;let j=v,B=E.componentsDir||"components";if(!_.__processedComponents)_.__processedComponents=new Set;let z=_.__processedComponents,F=av(j);if(F.size>0){let se=Array.isArray(_.__stx_client_declared_names)?_.__stx_client_declared_names:[];_.__stx_client_declared_names=[...new Set([...se,...F])]}let V=xn(j);j=V.output;let H=ul(j);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,mf(Ti)),j=await re(j,/[a-z][a-z0-9]*/,!1,Ti),j=V.restore(j),j;async function re(se,ie,oe,de){if(!se)return se;let ae=se,me=hf(ae,ie,de),ve=new Map;for(let Ce=me.length-1;Ce>=0;Ce--){let Ee=me[Ce],Te=oe?_o(Ee.tagName):Ee.tagName,Re=qf(ev(Ee.attributes,_,k)),_e=H.some(([at,Qe])=>Ee.startIndex>=at&&Ee.startIndex<Qe),Ae=Yb(Re,_,E,_e),Xe=Is.getBuiltin(Ee.tagName),Pe=Xe?await qn(Te,B,_,k,E):!1;if(Xe&&!Pe){let at={context:_,filePath:k,options:E,dependencies:T},Qe=Xe.render(Ae,Ee.content,at);if(Object.keys(Ae.events).length>0){let ht=Wf(Ae.events);Qe=Qe.replace(/^(\s*<[a-zA-Z][a-zA-Z0-9-]*)/,`$1 ${ht}`)}if(Object.keys(Ae.clientReactive).length>0)Qe=Uf(Qe,Ae.clientReactive);ve.set(Ce,Qe);continue}if(!oe&&Ee.tagName.includes("-")&&!await qn(Te,B,_,k,E))continue;let Ie={};for(let[at,Qe]of Object.entries(Ae.static))Ie[at]=Qe;for(let[at,Qe]of Object.entries(Ae.serverDynamic))Ie[at]=Qe;let rt=await We(Te,Ie,V.restore(Ee.content),B,_,k,E,z,T);if(rt=ov(rt,Ae),Object.keys(Ae.events).length>0){let at=hl(rt);if(at){let Qe=Wf(Ae.events),ht=Object.keys(Ae.events).map((pt)=>pt.replace(/^@/,"").split(".")[0]).join(" ");rt=rt.substring(0,at.insertPos)+` data-stx-parent-events="${ht}" ${Qe}`+rt.substring(at.insertPos)}}if(Object.keys(Ae.clientReactive).length>0)rt=Uf(rt,Ae.clientReactive);ve.set(Ce,rt)}if(ve.size===0)return ae;let Se="",$e=0;for(let Ce=0;Ce<me.length;Ce++){let Ee=ve.get(Ce);if(Ee===void 0)continue;Se+=ae.slice($e,me[Ce].startIndex),Se+=Ee,$e=me[Ce].endIndex}return Se+=ae.slice($e),Se}}function Uf(v,_){let k=new Set(["if","for"]),E=new Set(["show"]),T=Object.entries(_).filter(([H])=>!k.has(H)),j=T.filter(([H])=>!E.has(H)).map(([H])=>_o(H)).join(" "),B=v,z=T.length>0?hl(B):null;if(z){let H=T.map(([J,ne])=>`:${_o(J)}="${ne.replace(/"/g,"&quot;")}"`).join(" "),G=j?` data-stx-parent-bindings="${j}"`:"";B=B.substring(0,z.insertPos)+`${G} ${H}`+B.substring(z.insertPos)}let F=_.if;if(F)B=`<template :if="${F.replace(/"/g,"&quot;")}">${B}</template>`;let V=_.for;if(V)B=`<template :for="${V.replace(/"/g,"&quot;")}">${B}</template>`;return B}function ov(v,_){let k=hl(v);if(!k)return v;let E=v.slice(k.insertPos,k.tagEnd);if(!/\bdata-native(?:\s|=)/i.test(E))return v;let T=new Set(Object.keys(qf(E))),j=new Set(["class","className"]);for(let z of Object.keys(_.static))if(T.has(_.staticNames[z]??z))j.add(z);for(let z of Object.keys(_.serverDynamic))if(T.has(_.serverDynamicNames?.[z]??z))j.add(z);let B=[...xr(_,j),...br(_,j)];for(let[z,F]of Object.entries(_.serverDynamic)){if(j.has(z)||F!==!1)continue;let V=_.serverDynamicNames?.[z]??z;B.push(`${Lt(V)}="false"`)}for(let[z,F]of Object.entries(_.serverDynamic)){if(j.has(z)||F===null||typeof F!=="object")continue;let V=JSON.stringify(F);if(V!==void 0){let H=_.serverDynamicNames?.[z]??z;B.push(`${Lt(H)}="${Lt(V)}"`)}}if(B.length===0)return v;return`${v.slice(0,k.insertPos)} ${B.join(" ")}${v.slice(k.insertPos)}`}function hl(v){let _=/<([a-zA-Z][a-zA-Z0-9-]*)\b[^>]*\bdata-stx-scope(?:\s|=|>)/i.exec(v);if(_)return{insertPos:_.index+1+_[1].length,tagEnd:Hf(v,_.index+1+_[1].length)};let k=0;while(k<v.length){let E=v.slice(k),T=E.match(/^\s+/);if(T){k+=T[0].length;continue}if(E.startsWith("<!--")){let z=v.indexOf("-->",k+4);if(z===-1)return null;k=z+3;continue}let j=E.match(/^<(script|style)\b[^>]*>/i);if(j){let z=`</${j[1].toLowerCase()}>`,F=v.toLowerCase().indexOf(z,k+j[0].length);if(F===-1)return null;k=F+z.length;continue}let B=E.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(?:\s|>|\/)/);if(!B)return null;return{insertPos:k+1+B[1].length,tagEnd:Hf(v,k+1+B[1].length)}}return null}function Hf(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 av(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 ml(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 os(v,_,k,E,T){if(!Vf)pf(Is),Vf=!0;let j=await oc(v,_,k,E,T);j=await rv(j,_,k,E,T),j=await sv(j,_,k,E,T);let B=[];for(let z=0;z<3;z++){let F=B.length,V=En(j,Le,(G,J)=>`\x00STX_COMPONENT_COMMENT_${F+J}\x00`,`STX_COMPONENT_COMMENT:${F}`);B.push(...V.tokens);let H=j;if(j=await iv(V.output,_,k,E,T),j===H)break}if(B.length>0)j=j.replace(/\x00STX_COMPONENT_COMMENT_(\d+)\x00/g,(z,F)=>B[Number(F)]??"");if(E.debug){let z=nv(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 yl(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 lv(v,_,k){let E=v,T=new RegExp(`${_.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),j=T.exec(E);while(j){let B=j.index,z=B+j[0].length-1,F=1,V=z+1;while(V<E.length&&F>0){if(E[V]==="(")F++;else if(E[V]===")")F--;V++}if(F!==0)break;let H=E.substring(z+1,V-1),G=`${k}(${H})`;E=E.substring(0,B)+G+E.substring(V),T.lastIndex=B+G.length,j=T.exec(E)}return E}function uv(v){return/\b(state|derived|effect)\s*(?:<[^<>()]*>)?\s*\(/.test(v)}function Gf(v){let _=v,k=[],E=new Set,T=0,j=0,B=_.length,z=(G)=>{j++;while(j<B){if(_[j]==="\\"){j+=2;continue}if(_[j]===G){j++;return}j++}},F=()=>{j++;while(j<B){if(_[j]==="\\"){j+=2;continue}if(_[j]==="`"){j++;return}if(_[j]==="$"&&_[j+1]==="{"){j+=2;let G=1;while(j<B&&G>0)if(_[j]==="{")G++,j++;else if(_[j]==="}")G--,j++;else if(_[j]==="'"||_[j]==='"')z(_[j]);else if(_[j]==="`")F();else j++;continue}j++}},V=()=>{if(_[j]==="/"&&_[j+1]==="/"){while(j<B&&_[j]!==`
1890
- `)j++;return!0}if(_[j]==="/"&&_[j+1]==="*"){j+=2;while(j<B-1&&!(_[j]==="*"&&_[j+1]==="/"))j++;return j+=2,!0}return!1},H=()=>{if(T!==0)return;let G=_.slice(j).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(G){let re=G[2];if(!E.has(re))k.push(re),E.add(re);return}let J=_.slice(j).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(J){let re=J[1];if(!E.has(re))k.push(re),E.add(re);return}let ne=_.slice(j).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(ne){let re=ne[1];if(!E.has(re))k.push(re),E.add(re)}};while(j<B){if(V())continue;if(_[j]==="'"||_[j]==='"'){z(_[j]);continue}if(_[j]==="`"){F();continue}if(_[j]==="{"){T++,j++;continue}if(_[j]==="}"){T--,j++;continue}if(T===0&&/[a-z]/i.test(_[j])&&(j===0||/\s|[;{}()]/.test(_[j-1])))H();j++}return k.join(", ")}function dv(v,_=""){let k=Gf(v).split(",").map((E)=>E.trim()).filter(Boolean);return`
1887
+ `).entries())if(T.push(re),J)j.set(T.length,ne===0?J:{...J,line:J.line+ne,column:1,prefixLength:0})};if(_.globals!==!1){V("");let G=new Set([...k.flatMap((se)=>Q(se.code)),...k.flatMap((se)=>ev(se.code))]),J=(se)=>{if(!G.has(se))V(`declare var ${se}: any`)};if(_.runtimeGlobals!==!1){if(!G.has("window"))V("declare var window: any");for(let se of y)J(se)}let ne=[...new Set([...ml,...W,...Of])].filter((se)=>_.runtimeGlobals!==!1||!y.includes(se));if(_.contextScope==="global"){V("declare global {");for(let se of ne)V(` var ${se}: any`);V("}")}else{for(let se of ml)J(se);for(let se of W)J(se);for(let se of Of)J(se)}V(`declare var ${gl}: any`);let re=new Set(k.flatMap((se)=>Q(se.code)));V(`type ${Tf}<T> = T extends readonly (infer E)[] ? E : T extends Iterable<infer E2> ? E2 : any`);for(let se of Wb(v)){if(re.has(se.name))continue;let ie=se.iterable&&re.has(se.iterable)?`${Tf}<typeof ${se.iterable}>`:"any";V(`declare var ${se.name}: ${ie}`)}}if(_.templateExpressions!==!1){if(B?.declarations)for(let J of B.declarations.split(`
1888
+ `))V(J);let G=sc(v).map((J)=>{let ne=B?.events.get(J.offset??-1);if(ne){J.anchor=!0;let re=J.code.trim(),se=/^([\w$]+)\s*=\s*([^=][\s\S]*)$/.exec(re),ie=se?`void ((${se[2]}) satisfies __StxAssignedValue<typeof ${se[1]}>)`:/^[\w$]+(?:\.[\w$]+)*$/.test(re)?`${re} satisfies (($event: ${ne}) => unknown)`:re,oe=`;(($event: ${ne}): void => { `;return{expression:J,statement:{text:`${oe}${ie} });`,prefixLength:oe.length}}}return{expression:J,statement:Yb(J)}}).filter((J)=>J.statement!==null);if(G.push(...B?.checks||[]),G.length>0){let J=Eo(v),ne=Gb(k.map((oe)=>oe.code)),se=[...new Set(k.flatMap((oe)=>Q(oe.code)))].filter((oe)=>/^[A-Z_$][\w$]*$/i.test(oe)),ie=0;if(se.length>0){V(Lb);for(let oe of se)V(`type __StxT_${oe} = ${Lf}<typeof ${oe}>`);V(`;((${se.map((oe)=>`${oe}: __StxT_${oe}`).join(", ")}) => {`),ie=1}for(let{expression:oe,statement:ue}of G){let ae=" ".repeat(ie),me=oe.offset===void 0?[]:Jb(J,oe.offset),ve=me.length>0?`${me.map(($e)=>`if (${Ff($e,ne)}) `).join("")}{ `:"",Se=me.length>0?" }":"";V(ae+ve+ue.text+Se,{line:oe.line,column:oe.column,expression:oe,prefixLength:ue.prefixLength+ae.length+ve.length,guardPrefixLength:ae.length+ve.length})}if(ie>0)V("});")}}let H=!1;if(_.reference&&T[0]!==void 0&&T[0].trim()==="")T[0]=`/// <reference path=${JSON.stringify(_.reference.replace(/\\/g,"/"))} />`,H=!0;return V("export {}"),{text:T.join(`
1889
+ `),lineMap:j,sourceLineCount:E.length,componentDependencies:B?.dependencies,referenced:H}}function Zo(v,_){if(!v.expression)return!1;return v.inGuard===!0||_===2774}function Qo(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 Vf from"fs";import Wf from"path";var Uf=!1;function tv(v,_,k,E=!1){let T={static:{},staticNames:{},serverDynamic:{},serverDynamicNames:{},clientReactive:{},events:{}},j=new Set(Array.isArray(_.__stx_client_signal_names)?_.__stx_client_signal_names:[]),B=(H)=>{if(j.size===0)return!1;let G=s(H),J=G.match(/^\s*[!+~(-]*\s*([a-zA-Z_$][\w$]*)/)?.[1];if(J&&j.has(J))return!0;for(let ne of j){let re=ne.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(new RegExp(`(?:^|[^\\w$.])${re}\\s*\\(`).test(G))return!0}return!1},z=new Set(Ei),F=(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,(G,J)=>J.toUpperCase())},V=(H,G)=>{let J=F(H);if(T.static[J]=G,J!==H)T.staticNames[J]=H};for(let[H,G]of Object.entries(v)){let J=H.startsWith("x-")&&!z.has(H)&&!H.startsWith("x-bind:")&&!H.startsWith("x-on:")?`:${H.slice(2)}`:H;if(J.startsWith("@")){T.events[J]=G;continue}if(J.startsWith("__stx_")){let ne=F(J.slice(6));T.serverDynamic[ne]=vf(G,k);continue}if(J.startsWith(":")){let ne=F(J.slice(1)),re=G===Ir?ne:G;if(ne==="if"||ne==="for"||ne==="show"){T.clientReactive[ne]=re;continue}if(E){T.clientReactive[ne]=re;continue}if(B(re)){T.clientReactive[ne]=re;continue}try{if(!p(re)){if(k.debug)console.error(`Unsafe expression in :${ne} binding: ${re}`);T.clientReactive[ne]=re;continue}let se=Object.keys(_),ie=new Set(["true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","if","else"]),oe=new Set(Array.isArray(_.__stx_client_declared_names)?_.__stx_client_declared_names:[]);if(xe(re).some((ve)=>!ie.has(ve)&&!se.includes(ve)&&(!(ve in globalThis)||oe.has(ve)))){T.clientReactive[ne]=re;continue}let me=l(re,se)(...Object.values(_));if(T.serverDynamic[ne]=me,ne!==J.slice(1)&&T.serverDynamicNames)T.serverDynamicNames[ne]=J.slice(1)}catch{T.clientReactive[ne]=re}continue}if(typeof G==="string"&&G.includes("{{")&&G.includes("}}")){let ne=G.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(ne)try{let re=ne[1];if(p(re)){let ie=l(re,Object.keys(_))(...Object.values(_));V(J,ie!=null?String(ie):"")}else{if(k.debug)console.error(`Unsafe expression in ${J}: ${re}`);V(J,G)}}catch(re){if(k.debug)console.error(`Error evaluating expression for ${J}:`,re);V(J,G)}else{let re=G,se=/\{\{\s*([\s\S]+?)\s*\}\}/g,ie;while((ie=se.exec(G))!==null)try{let oe=ie[1];if(!p(oe)){if(k.debug)console.error(`Unsafe expression in ${J}: ${oe}`);continue}let ae=l(oe,Object.keys(_))(...Object.values(_));re=re.replace(ie[0],String(ae??""))}catch(oe){if(k.debug)console.error(`Error evaluating expression in ${J}:`,oe)}V(J,re)}continue}V(J,G===Ir?"true":bf(G))}return T}var nv=[[/@if\s*\(/,"@endif"],[/@unless\s*\(/,"@endunless"]];function rv(v,_,k){if(!v.includes("@"))return v;if(!nv.some(([T,j])=>T.test(v)&&v.includes(j)))return v;try{return ar(v,_,k)}catch{return v}}function Xf(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=ul(v,k),k+=j.length;let B=wf(j);if(B!==null){_[`:${T}`]=B;continue}}else while(k<E&&!/\s/.test(v[k]))j+=v[k],k++;_[T]=j}else _[T]=Ir}return _}function Hf(v){return Object.entries(v).map(([_,k])=>k===Ir?_:`${_}="${sv(k)}"`).join(" ")}function sv(v){return v.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function iv(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(Ss.isBuiltin(T))_.add(T)}return[..._].sort()}async function oc(v,_,k,E,T){if(!/import\s/.test(v))return v;if(!_.__importedComponents)_.__importedComponents=new Map;let j=_.__importedComponents,B=Wf.dirname(k),z=[],F=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi;for(let G of v.matchAll(F)){let[J,ne,re]=G,se=/import\s+(?:(\{[^}]*\})|([A-Za-z_$][\w$]*))\s+from\s+['"]([^'"]+)['"]\s*;?\s*\n?/g,ie=re,oe,ue=[];while((oe=se.exec(re))!==null){let[ae,me,ve,Se]=oe,$e=null,Ce=null;if(Se.startsWith(".")||Se.startsWith("/")){let Re=Wf.resolve(B,Se);if(Re.endsWith(".stx"))Ce=Re;else{let _e=`${Re}.stx`;try{if(Vf.statSync(_e).isFile())Ce=_e}catch{try{if(Vf.statSync(Re).isDirectory())$e=Re}catch{}}}}else $e=po(Se,B);if(!$e&&!Ce)continue;let Ee=!1,Te=(Re,_e)=>{j.set(Re,_e),j.set(Re.toLowerCase(),_e);let Ae=Re.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();j.set(Ae,_e),T.add(_e)};if(ve&&Ce)Te(ve,Ce),Ee=!0;else if(me){let Re=me.slice(1,-1).split(",").map((Ae)=>Ae.trim()).filter(Boolean).map((Ae)=>{let Xe=Ae.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(Xe)return{source:Xe[1],local:Xe[2]};return{source:Ae,local:Ae}}),_e=$e?uo($e):null;for(let{source:Ae,local:Xe}of Re){let Pe=null;if(Ce)Pe=Ce;else if(_e)Pe=_e.get(Ae)??_e.get(Ae.toLowerCase())??_e.get(Ae.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase())??null;if(Pe)Te(Xe,Pe),Ee=!0}}if(Ee)ue.push({start:oe.index,end:oe.index+ae.length})}if(ue.length===0)continue;for(let ae=ue.length-1;ae>=0;ae--)ie=ie.slice(0,ue[ae].start)+ie.slice(ue[ae].end);z.push({start:G.index,end:G.index+J.length,value:`<script${ne}>${ie}</script>`})}if(z.length===0)return v;let V=[],H=0;for(let G of z)V.push(v.slice(H,G.start),G.value),H=G.end;return V.push(v.slice(H)),V.join("")}async function ov(v,_,k,E,T){let j=v;if(!_.__importedComponents)_.__importedComponents=new Map;let B=_.__importedComponents,z=/@import\s*\(\s*([^)]+)\s*\)/g,F;while((F=z.exec(j))!==null){let[V,H]=F,G=H.split(",").map((J)=>J.trim().replace(/^['"]|['"]$/g,"")).filter((J)=>J.length>0);for(let J of G){let ne=J.split("/"),se=ne[ne.length-1].replace(/\.stx$/,""),ie=se.includes("-")?se.split("-").map((ae)=>ae.charAt(0).toUpperCase()+ae.slice(1)).join(""):se.charAt(0).toUpperCase()+se.slice(1),oe=null,ue=fo(J,k,E);for(let ae of ue)try{if(await Bun.file(ae).exists()){oe=ae;break}}catch{}if(oe){B.set(ie,oe),B.set(se,oe),B.set(se.toLowerCase(),oe);let ae=ie.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(B.set(ae,oe),T.add(oe),E.debug)console.log(`Imported component: ${ie} -> ${oe}`)}else if(E.debug)console.warn(`Could not resolve imported component: ${J}`)}j=j.replace(V,""),z.lastIndex=0}return j}async function av(v,_,k,E,T){let j=v,B=E.componentsDir||"components";if(!_.__processedComponents)_.__processedComponents=new Set;let z=_.__processedComponents,F=/@component\s*\(/g,V;while((V=F.exec(j))!==null){let H=V.index,G=H+V[0].length-1,J=1,ne=G+1;while(ne<j.length&&J>0){if(j[ne]==="(")J++;else if(j[ne]===")"){if(J--,J===0)break}ne++}if(J!==0)break;let re=j.substring(G+1,ne),se=ne+1,ie=re.match(/^\s*['"]([^'"]+)['"]/);if(!ie){F.lastIndex=0;continue}let oe=ie[1],ue,ae=re.slice(ie[0].length),me=ae.match(/^\s*,\s*/);if(me)ue=ae.slice(me[0].length).trim();let ve={};if(ue)try{ve=D(ue,_)}catch(Re){let _e=Re instanceof Error?Re.message:String(Re);j=j.replace(j.substring(H,se),`[Error parsing component props: ${_e}]`);continue}let Se="",$e=se,Ee=j.substring(se).match(/^([\s\S]*?)@endcomponent/);if(Ee)Se=Ee[1].trim(),$e=se+Ee[0].length;let Te=await We(oe,ve,Se,B,_,k,E,z,T);j=j.substring(0,H)+Te+j.substring($e),F.lastIndex=0}return j}async function cv(v,_,k,E,T){if(!v)return v;let j=v,B=E.componentsDir||"components";if(!_.__processedComponents)_.__processedComponents=new Set;let z=_.__processedComponents,F=uv(j);if(F.size>0){let se=Array.isArray(_.__stx_client_declared_names)?_.__stx_client_declared_names:[];_.__stx_client_declared_names=[...new Set([...se,...F])]}let V=xn(j);j=V.output;let H=dl(j);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,yf(Ti)),j=await re(j,/[a-z][a-z0-9]*/,!1,Ti),j=V.restore(j),j;async function re(se,ie,oe,ue){if(!se)return se;let ae=se,me=xf(ae,ie,ue),ve=new Map;for(let Ce=me.length-1;Ce>=0;Ce--){let Ee=me[Ce],Te=oe?ko(Ee.tagName):Ee.tagName,Re=Xf(rv(Ee.attributes,_,k)),_e=H.some(([at,Qe])=>Ee.startIndex>=at&&Ee.startIndex<Qe),Ae=tv(Re,_,E,_e),Xe=Ss.getBuiltin(Ee.tagName),Pe=Xe?await qn(Te,B,_,k,E):!1;if(Xe&&!Pe){let at={context:_,filePath:k,options:E,dependencies:T},Qe=Xe.render(Ae,Ee.content,at);if(Object.keys(Ae.events).length>0){let ht=Hf(Ae.events);Qe=Qe.replace(/^(\s*<[a-zA-Z][a-zA-Z0-9-]*)/,`$1 ${ht}`)}if(Object.keys(Ae.clientReactive).length>0)Qe=qf(Qe,Ae.clientReactive);ve.set(Ce,Qe);continue}if(!oe&&Ee.tagName.includes("-")&&!await qn(Te,B,_,k,E))continue;let Ie={};for(let[at,Qe]of Object.entries(Ae.static))Ie[at]=Qe;for(let[at,Qe]of Object.entries(Ae.serverDynamic))Ie[at]=Qe;let rt=await We(Te,Ie,V.restore(Ee.content),B,_,k,E,z,T);if(rt=lv(rt,Ae),Object.keys(Ae.events).length>0){let at=yl(rt);if(at){let Qe=Hf(Ae.events),ht=Object.keys(Ae.events).map((pt)=>pt.replace(/^@/,"").split(".")[0]).join(" ");rt=rt.substring(0,at.insertPos)+` data-stx-parent-events="${ht}" ${Qe}`+rt.substring(at.insertPos)}}if(Object.keys(Ae.clientReactive).length>0)rt=qf(rt,Ae.clientReactive);ve.set(Ce,rt)}if(ve.size===0)return ae;let Se="",$e=0;for(let Ce=0;Ce<me.length;Ce++){let Ee=ve.get(Ce);if(Ee===void 0)continue;Se+=ae.slice($e,me[Ce].startIndex),Se+=Ee,$e=me[Ce].endIndex}return Se+=ae.slice($e),Se}}function qf(v,_){let k=new Set(["if","for"]),E=new Set(["show"]),T=Object.entries(_).filter(([H])=>!k.has(H)),j=T.filter(([H])=>!E.has(H)).map(([H])=>ko(H)).join(" "),B=v,z=T.length>0?yl(B):null;if(z){let H=T.map(([J,ne])=>`:${ko(J)}="${ne.replace(/"/g,"&quot;")}"`).join(" "),G=j?` data-stx-parent-bindings="${j}"`:"";B=B.substring(0,z.insertPos)+`${G} ${H}`+B.substring(z.insertPos)}let F=_.if;if(F)B=`<template :if="${F.replace(/"/g,"&quot;")}">${B}</template>`;let V=_.for;if(V)B=`<template :for="${V.replace(/"/g,"&quot;")}">${B}</template>`;return B}function lv(v,_){let k=yl(v);if(!k)return v;let E=v.slice(k.insertPos,k.tagEnd);if(!/\bdata-native(?:\s|=)/i.test(E))return v;let T=new Set(Object.keys(Xf(E))),j=new Set(["class","className"]);for(let z of Object.keys(_.static))if(T.has(_.staticNames[z]??z))j.add(z);for(let z of Object.keys(_.serverDynamic))if(T.has(_.serverDynamicNames?.[z]??z))j.add(z);let B=[...xr(_,j),...br(_,j)];for(let[z,F]of Object.entries(_.serverDynamic)){if(j.has(z)||F!==!1)continue;let V=_.serverDynamicNames?.[z]??z;B.push(`${Lt(V)}="false"`)}for(let[z,F]of Object.entries(_.serverDynamic)){if(j.has(z)||F===null||typeof F!=="object")continue;let V=JSON.stringify(F);if(V!==void 0){let H=_.serverDynamicNames?.[z]??z;B.push(`${Lt(H)}="${Lt(V)}"`)}}if(B.length===0)return v;return`${v.slice(0,k.insertPos)} ${B.join(" ")}${v.slice(k.insertPos)}`}function yl(v){let _=/<([a-zA-Z][a-zA-Z0-9-]*)\b[^>]*\bdata-stx-scope(?:\s|=|>)/i.exec(v);if(_)return{insertPos:_.index+1+_[1].length,tagEnd:Kf(v,_.index+1+_[1].length)};let k=0;while(k<v.length){let E=v.slice(k),T=E.match(/^\s+/);if(T){k+=T[0].length;continue}if(E.startsWith("<!--")){let z=v.indexOf("-->",k+4);if(z===-1)return null;k=z+3;continue}let j=E.match(/^<(script|style)\b[^>]*>/i);if(j){let z=`</${j[1].toLowerCase()}>`,F=v.toLowerCase().indexOf(z,k+j[0].length);if(F===-1)return null;k=F+z.length;continue}let B=E.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(?:\s|>|\/)/);if(!B)return null;return{insertPos:k+1+B[1].length,tagEnd:Kf(v,k+1+B[1].length)}}return null}function Kf(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 uv(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 hl(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 os(v,_,k,E,T){if(!Uf)gf(Ss),Uf=!0;let j=await oc(v,_,k,E,T);j=await ov(j,_,k,E,T),j=await av(j,_,k,E,T);let B=[];for(let z=0;z<3;z++){let F=B.length,V=En(j,Le,(G,J)=>`\x00STX_COMPONENT_COMMENT_${F+J}\x00`,`STX_COMPONENT_COMMENT:${F}`);B.push(...V.tokens);let H=j;if(j=await cv(V.output,_,k,E,T),j===H)break}if(B.length>0)j=j.replace(/\x00STX_COMPONENT_COMMENT_(\d+)\x00/g,(z,F)=>B[Number(F)]??"");if(E.debug){let z=iv(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 xl(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 pv(v,_,k){let E=v,T=new RegExp(`${_.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),j=T.exec(E);while(j){let B=j.index,z=B+j[0].length-1,F=1,V=z+1;while(V<E.length&&F>0){if(E[V]==="(")F++;else if(E[V]===")")F--;V++}if(F!==0)break;let H=E.substring(z+1,V-1),G=`${k}(${H})`;E=E.substring(0,B)+G+E.substring(V),T.lastIndex=B+G.length,j=T.exec(E)}return E}function fv(v){return/\b(state|derived|effect)\s*(?:<[^<>()]*>)?\s*\(/.test(v)}function Yf(v){let _=v,k=[],E=new Set,T=0,j=0,B=_.length,z=(G)=>{j++;while(j<B){if(_[j]==="\\"){j+=2;continue}if(_[j]===G){j++;return}j++}},F=()=>{j++;while(j<B){if(_[j]==="\\"){j+=2;continue}if(_[j]==="`"){j++;return}if(_[j]==="$"&&_[j+1]==="{"){j+=2;let G=1;while(j<B&&G>0)if(_[j]==="{")G++,j++;else if(_[j]==="}")G--,j++;else if(_[j]==="'"||_[j]==='"')z(_[j]);else if(_[j]==="`")F();else j++;continue}j++}},V=()=>{if(_[j]==="/"&&_[j+1]==="/"){while(j<B&&_[j]!==`
1890
+ `)j++;return!0}if(_[j]==="/"&&_[j+1]==="*"){j+=2;while(j<B-1&&!(_[j]==="*"&&_[j+1]==="/"))j++;return j+=2,!0}return!1},H=()=>{if(T!==0)return;let G=_.slice(j).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(G){let re=G[2];if(!E.has(re))k.push(re),E.add(re);return}let J=_.slice(j).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(J){let re=J[1];if(!E.has(re))k.push(re),E.add(re);return}let ne=_.slice(j).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(ne){let re=ne[1];if(!E.has(re))k.push(re),E.add(re)}};while(j<B){if(V())continue;if(_[j]==="'"||_[j]==='"'){z(_[j]);continue}if(_[j]==="`"){F();continue}if(_[j]==="{"){T++,j++;continue}if(_[j]==="}"){T--,j++;continue}if(T===0&&/[a-z]/i.test(_[j])&&(j===0||/\s|[;{}()]/.test(_[j-1])))H();j++}return k.join(", ")}function gv(v,_=""){let k=Yf(v).split(",").map((E)=>E.trim()).filter(Boolean);return`
1891
1891
  (function() {
1892
1892
  ${Rt("var",k)}
1893
1893
  var __destroyHooks = [];
@@ -1896,7 +1896,7 @@ ${V.join(`
1896
1896
 
1897
1897
  ${v}
1898
1898
  ${_}})();
1899
- `}function pv(v,_){let T=Gf(v).split(",").map((j)=>j.trim()).filter(Boolean).map((j)=>` try { __scopeRegistration[${JSON.stringify(j)}] = ${j}; } catch (e) { /* not actually top-level */ }`).join(`
1899
+ `}function mv(v,_){let T=Yf(v).split(",").map((j)=>j.trim()).filter(Boolean).map((j)=>` try { __scopeRegistration[${JSON.stringify(j)}] = ${j}; } catch (e) { /* not actually top-level */ }`).join(`
1900
1900
  `);return`
1901
1901
  // Register scope variables for STX runtime
1902
1902
  if (!window.stx._scopes) window.stx._scopes = {};
@@ -1908,7 +1908,7 @@ ${T}
1908
1908
  // shadowing import. __stxScopeRenames is emitted by bundleClientScript.
1909
1909
  try { if (typeof __stxScopeRenames !== 'undefined' && __stxScopeRenames) { for (var __stxRK in __stxScopeRenames) __scopeRegistration[__stxRK] = __stxScopeRenames[__stxRK]; } } catch (e) { /* no renames */ }
1910
1910
  window.stx._scopes['${_}'] = __scopeRegistration;
1911
- `}function fv(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 Kf(v,_){let k=pv(v,_);return gv(dv(v,k),_)}function gv(v,_){let k=`
1911
+ `}function hv(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 Zf(v,_){let k=mv(v,_);return yv(gv(v,k),_)}function yv(v,_){let k=`
1912
1912
  (function() {
1913
1913
  var __stxScopeEl = (typeof document !== 'undefined') ? document.querySelector('[data-stx-scope="${_}"]') : null;
1914
1914
  var __stxPrevEl = (typeof window !== 'undefined') ? window.__STX_CURRENT_ELEMENT__ : undefined;
@@ -1925,25 +1925,25 @@ ${T}
1925
1925
  } finally {
1926
1926
  if (typeof window !== 'undefined') window.__STX_CURRENT_ELEMENT__ = __stxPrevEl;
1927
1927
  }
1928
- })();`}function mv(v,_){if(An(v)){let T=An(v).tag.match(/data-stx-scope="([^"]*)"/);if(T)return{html:v,mergedIntoExisting:T[1],stamped:!0,root:"body"};return{html:vs(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 hv=0;function Xf(v,_){let k=Ot.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}_${++hv}`}var xl=new Set,bl=new Set;function Bu(){xl.clear(),bl.clear()}var yv=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function yc(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]==="/"||yv.has(F.toLowerCase());if(z){T=Math.max(0,T-1);continue}if(T===0)E.push(F);if(!V)T++}return E}function Zf(v){return/\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/i.test(v)}var be=new M(500),ai=new Set;function Fu(){ai.clear()}function xv(v){if(v.__onceStore instanceof Set)return v.__onceStore;return ai}async function ps(v,_,k,E,T,j=new Set){let B=E.partialsDir||Ot.join(Ot.dirname(k),"partials");if(B&&!Ot.isAbsolute(B))B=Ot.resolve(process.cwd(),B);let z=lv(v,"@partial","@include"),F=xv(_);z=z.replace(/@once([\s\S]*?)@endonce/g,(se,ie,oe)=>{let de=ie.trim(),ae=`${k}:${de}`;if(F.has(ae))return"";return F.add(ae),ie});{let se=/@includeIf\s*\(/g,ie;while((ie=se.exec(z))!==null){let oe=ie.index,de=oe+ie[0].length-1,ae=1,me=de+1;while(me<z.length&&ae>0){if(z[me]==="(")ae++;else if(z[me]===")")ae--;me++}if(ae!==0)break;let ve=z.substring(de+1,me-1),Se=ve.match(/^\s*['"]([^'"]+)['"]/);if(!Se){se.lastIndex=me;continue}let $e=Se[1],Ce=V($e,B,k),Ee="";if(Ce&&await Bun.file(Ce).exists())T.add(Ce),Ee=`@include(${ve})`;z=z.substring(0,oe)+Ee+z.substring(me),se.lastIndex=0}}for(let[se,ie]of[["@includeWhen",!1],["@includeUnless",!0]]){let oe=new RegExp(`${se.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),de;while((de=oe.exec(z))!==null){let ae=de.index,me=ae+de[0].length-1,ve=1,Se=me+1;while(Se<z.length&&ve>0){if(z[Se]==="(")ve++;else if(z[Se]===")")ve--;Se++}if(ve!==0)break;let $e=z.substring(me+1,Se-1),Ce=yl($e,0);if(Ce===-1){oe.lastIndex=Se;continue}let Ee=$e.substring(0,Ce).trim(),Te=$e.substring(Ce+1).trim(),Re=Te.match(/^\s*['"]([^'"]+)['"]/);if(!Re){oe.lastIndex=Se;continue}let _e=Re[1],Ae=Te.substring(Re[0].length),Xe,Pe=yl(Ae,0);if(Pe!==-1)Xe=Ae.substring(Pe+1).trim();try{let Ie=`Boolean(${Ee})`,Ze;if(p(Ie)){let Qe=l(Ie,Object.keys(_));Ze=Boolean(Qe(...Object.values(_)))}else Ze=Boolean(c(Ie,_));let rt=ie?!Ze:Ze,at="";if(rt){let Qe=V(_e,B,k);if(Qe&&await Bun.file(Qe).exists())T.add(Qe);at=`@include('${_e}'${Xe?`, ${Xe}`:""})`}z=z.substring(0,ae)+at+z.substring(Se),oe.lastIndex=0}catch(Ie){let Ze=Ie instanceof Error?Ie.message:String(Ie),rt=g("Include",`Error evaluating ${se} condition: ${Ze}`,k,v,ae);z=z.substring(0,ae)+rt+z.substring(Se),oe.lastIndex=0}}}{let se=/@each\s*\(/g,ie;while((ie=se.exec(z))!==null){let oe=ie.index,de=oe+ie[0].length-1,ae=1,me=de+1;while(me<z.length&&ae>0){if(z[me]==="(")ae++;else if(z[me]===")"){if(ae--,ae===0)break}me++}if(ae!==0)break;let ve=z.substring(de+1,me),Se=z.substring(oe,me+1),$e=ve.match(/^\s*['"]([^'"]+)['"]\s*,\s*([^,]+)\s*,\s*['"]([^'"]+)['"](?:\s*,\s*['"]([^'"]+)['"])?\s*$/);if(!$e){se.lastIndex=0,z=z.replace(Se,"");continue}let[,Ce,Ee,Te,Re]=$e;try{let _e,Ae=Ee.trim();if(p(Ae))_e=l(Ae,Object.keys(_))(...Object.values(_));else _e=c(Ae,_);let Xe="";if(Array.isArray(_e)&&_e.length>0)for(let Pe of _e){let Ie={..._,[Te]:Pe},Ze=await J(Ce,Ie,v,oe);Xe+=Ze}else if(Re)Xe=await J(Re,{},v,oe);z=z.substring(0,oe)+Xe+z.substring(me+1),se.lastIndex=0}catch(_e){let Ae=_e instanceof Error?_e.message:String(_e);z=z.substring(0,oe)+g("Each",`Error in @each: ${Ae}`,k,v,oe)+z.substring(me+1),se.lastIndex=0}}}{let se=/@includeFirst\s*\(/g,ie;while((ie=se.exec(z))!==null){let oe=ie.index,de=oe+ie[0].length-1,ae=1,me=de+1;while(me<z.length&&ae>0){if(z[me]==="(")ae++;else if(z[me]===")"){if(ae--,ae===0)break}me++}if(ae!==0)break;let ve=z.substring(de+1,me),Se=z.substring(oe,me+1),$e=ve.match(/^\s*(\[[^\]]+\])/);if(!$e){se.lastIndex=0,z=z.replace(Se,"");continue}let Ce=$e[1],Ee=ve.slice($e[0].length),Te,Re=Ee.match(/^\s*,\s*\{/);if(Re){Ee=Ee.slice(Re[0].length-1);let Xe=1,Pe=1;while(Pe<Ee.length&&Xe>0){if(Ee[Pe]==="{")Xe++;else if(Ee[Pe]==="}"){if(Xe--,Xe===0)break}Pe++}Te=Ee.substring(0,Pe+1),Ee=Ee.slice(Pe+1)}let _e,Ae=Ee.match(/^\s*,\s*['"]([^'"]*)['"]\s*$/);if(Ae)_e=Ae[1];try{let Xe=JSON.parse(Ce.replace(/'/g,'"')),Pe={};if(Te)try{Pe=D(Te,_)}catch(Ze){let rt=Ze instanceof Error?Ze.message:String(Ze);if(E.debug){let at=g("Include",`Error parsing includeFirst variables: ${rt}`,k,v,oe,Se);z=z.replace(Se,()=>at)}else z=z.replace(Se,()=>_e||"");continue}let Ie=!1;for(let Ze of Xe){let rt=V(Ze,B,k);if(!rt)continue;if(await r(rt)){let at=await J(Ze,Pe,v,oe);z=z.replace(Se,()=>at),Ie=!0;break}}if(!Ie)if(_e!==void 0)z=z.replace(Se,()=>_e);else if(E.debug){let Ze=g("Include",`None of the includeFirst paths exist: ${Ce}`,k,v,oe,Se);z=z.replace(Se,()=>Ze)}else z=z.replace(Se,"")}catch(Xe){let Pe=Xe instanceof Error?Xe.message:String(Xe),Ie=g("Include",`Error processing @includeFirst: ${Pe}`,k,v,oe,Se);z=z.replace(Se,()=>Ie)}se.lastIndex=0}}function V(se,ie,oe){try{let de=se;if(!se.endsWith(".stx"))de=`${se}.stx`;let ae=Ot.resolve(ie),me=Ot.resolve(Ot.dirname(oe)),ve;if(!de.startsWith("./")&&!de.startsWith("../")){for(let Re of E._layerPartialDirs??[]){let _e=Ot.resolve(Re,de);if(_e.startsWith(`${Ot.resolve(Re)}${Ot.sep}`)&&cv(_e))return _e}ve=Ot.resolve(ie,de)}else ve=Ot.resolve(me,de);let Se=Ot.normalize(ve),$e=Se.startsWith(ae+Ot.sep)||Se===ae,Ce=Se.startsWith(me+Ot.sep)||Se===me,Ee=!1,Te=Ot.dirname(me);if(Se.startsWith(Te+Ot.sep)){if(!Ot.relative(Te,Se).split(Ot.sep).some((Xe)=>Xe.startsWith(".")&&Xe!=="."&&Xe!==".."))Ee=!0}if(!$e&&!Ce&&!Ee)return console.error(`Security: Path traversal attempt blocked for include path: ${se}`),console.error(` Resolved to: ${Se}`),console.error(` Allowed dirs: ${ae}, ${me}`),null;return Se}catch(de){return console.error(`Error resolving path ${se}: ${de}`),null}}let H=Ot.resolve(k);j.add(H);function G(se,ie,oe,de){return E.onIncludeError?.({includePath:se,templatePath:k,message:ie,partialsDir:B}),g("Include",ie,k,oe,de)}async function J(se,ie={},oe,de){let ae=V(se,B,k);if(!ae)return G(se,`Could not resolve path for include: ${se}`,oe,de);let me=Ot.resolve(ae);if(j.has(me)){let ve=[...j,me].map((Se)=>Ot.basename(Se)).join(" -> ");return G(se,`Circular include detected: ${ve}`,oe,de)}try{T.add(ae);let ve;if(!ve)try{ve=await Bun.file(ae).text()}catch(ct){let Pt=ct instanceof Error?ct.message:String(ct);return G(se,`Error loading include file ${se}: ${Pt}`,oe,de)}if(ve)ve=ve.replace(/\{\{--[\s\S]*?--\}\}/g,"");if(ve&&ve.includes("@stream")){let{processStreamDirectives:ct}=await import("./chunk-q0w6a9hv.js");ve=ct(ve,_)}if(ve&&(E.debug||!ge()&&!gn()))try{let{warnUnbalancedTags:ct}=await import("./chunk-fqhewm3t.js");ct(ve,ae)}catch{}try{let{processESImports:ct}=await import("./chunk-3w22gpa9.js");ve=await ct(ve,_,ae,E,T)}catch(ct){if(E.debug)console.warn(`[stx] partial ES import extraction skipped for ${ae}:`,ct instanceof Error?ct.message:ct)}let Se=ve,$e=Z(Se);if($e)Se=$e.content.trim();let Ee=ve.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),Te="";if(Ee)Te=`<style${Ee[1]}>${Ee[2]}</style>`;let Re=[];Se=Se.replace(/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,(ct,Pt,ft)=>{if(!Zf(Pt))return"";return Re.push({attrs:Pt,body:ft}),`__STX_DATA_BLOCK_${Re.length-1}__`}),Se=Se.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let _e={..._};_e.__stx_signals_gate=ye(ve,ae);for(let[ct,Pt]of Object.entries(ie))_e[ct]=Pt;let Ae=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,Xe=[...ve.matchAll(Ae)],Pe="",Ie=null,Ze=!1;for(let ct of Xe){let Pt=ct[1]||"",ft=ct[2]||"";if(Zf(Pt))continue;let Nt=Pt.includes("server"),Pn=Ve(Pt);if(!Nt&&ft.trim()){let{interpolateScriptExpressions:tt}=await import("./chunk-82nw3942.js");ft=tt(ft,_e,se)}let Sn="";try{let{extractAndStripCssImports:tt,renderVendorStyleTags:it}=await import("./chunk-a6s6hvcd.js"),gt=tt(ft,{filePath:ae,projectRoot:process.cwd()});ft=gt.code,Sn=it(gt.styles)}catch(tt){if(E.debug)console.warn(`[stx] vendor-css extractor skipped for ${ae}:`,tt instanceof Error?tt.message:tt)}if(Pn&&ft.trim())ft=Ue(ft);if(!Nt){try{let{injectBrowserCoreAutoImports:it}=await import("./chunk-a6s6hvcd.js");ft=it(ft).code;let{hasUserImports:gt,bundleClientScript:qt}=await import("./chunk-07mksefx.js");if(gt(ft))ft=await qt(ft,ae,{projectRoot:process.cwd()})}catch(it){if(E.debug)console.warn(`[stx] bundler skipped for ${ae}:`,it instanceof Error?it.message:it)}let{stripStxRuntimeImports:tt}=await import("./chunk-q9yhnqe5.js");ft=tt(ft)}let er=uv(ft);if(er&&!Nt){Ze=!0,Ie=Xf(ae,_);let tt=P(ft),it=Kf(tt,Ie);Pe+=`${Sn}<script data-stx-scoped data-stx-run="always" data-stx-owner="${Ie}">${it}</script>
1929
- `;continue}if(Nt)try{let{extractVariables:tt}=await import("./chunk-7ppykfx2.js");await tt(ft,_e,ae)}catch(tt){if(E.debug)console.warn(`Warning: Could not extract variables from server script in ${ae}:`,tt)}if(!Nt&&!er){let tt=Pt.replace(/\bclient\b/i,"").trim();Ie=Xf(ae,_);let it=P(ft),gt=Kf(it,Ie);Pe+=`${Sn}<script data-stx-scoped data-stx-run="always" data-stx-owner="${Ie}"${tt?` ${tt}`:""}>${gt}</script>
1930
- `}}if(Re.length>0){let{interpolateScriptExpressions:ct}=await import("./chunk-82nw3942.js");Se=Se.replace(/__STX_DATA_BLOCK_(\d+)__/g,(Pt,ft)=>{let Nt=Re[Number(ft)];return`<script${Nt.attrs}>${ct(Nt.body,_e,se)}</script>`})}if(Ie){let ct=mv(Se,Ie);if(Se=ct.html,ct.mergedIntoExisting){let ft=Ie,Nt=ct.mergedIntoExisting;Pe=Pe.split(`'${ft}'`).join(`'${Nt}'`).split(`"${ft}"`).join(`"${Nt}"`),Ie=Nt}else if(!ct.stamped&&Ze&&!xl.has(ae))xl.add(ae),console.warn(`[stx] ${Ot.relative(process.cwd(),ae)} 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(ct.stamped&&ct.root!=="body"&&Ze&&!bl.has(ae)){let ft=yc(Se);if(ft.length>1)bl.add(ae),console.warn(`[stx] ${Ot.relative(process.cwd(),ae)} declares signals and has ${ft.length} top-level elements (${ft.map((Nt)=>`<${Nt}>`).join(", ")}). Only the first is scoped, so bindings in the others cannot see this partial's signals. Wrap the partial's markup in a single root element.`)}let Pt=ct.stamped&&ct.root!==null&&rn(ct.root);Pe=fv(Pe,Pt?Ie:null)}if(Se.includes("@include")||Se.includes("@partial"))Se=await ps(Se,_e,ae,E,T,j);let{processLoops:rt,reportDeferredLoopWarnings:at}=await import("./chunk-vr4t7exr.js"),Qe=rt(Se,_e,ae,void 0,!0);Qe=ar(Qe,_e,ae),Qe=at(Qe);let{processMetaDirectives:ht,processSeoDirective:pt,processStructuredData:bt}=await import("./chunk-2njt4vbe.js");if(Qe=ht(Qe,_e,ae,E),Qe=bt(Qe,_e,ae),Qe=pt(Qe,_e,ae,E),Qe=q(Qe,_e,ae),Te)Qe+=`
1928
+ })();`}function xv(v,_){if(An(v)){let T=An(v).tag.match(/data-stx-scope="([^"]*)"/);if(T)return{html:v,mergedIntoExisting:T[1],stamped:!0,root:"body"};return{html:fs(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 bv=0;function Gf(v,_){let k=Ot.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}_${++bv}`}var bl=new Set,vl=new Set;function Bd(){bl.clear(),vl.clear()}var vv=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function yc(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]==="/"||vv.has(F.toLowerCase());if(z){T=Math.max(0,T-1);continue}if(T===0)E.push(F);if(!V)T++}return E}function Jf(v){return/\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/i.test(v)}var be=new M(500),ai=new Set;function Fd(){ai.clear()}function wv(v){if(v.__onceStore instanceof Set)return v.__onceStore;return ai}async function ps(v,_,k,E,T,j=new Set){let B=E.partialsDir||Ot.join(Ot.dirname(k),"partials");if(B&&!Ot.isAbsolute(B))B=Ot.resolve(process.cwd(),B);let z=pv(v,"@partial","@include"),F=wv(_);z=z.replace(/@once([\s\S]*?)@endonce/g,(se,ie,oe)=>{let ue=ie.trim(),ae=`${k}:${ue}`;if(F.has(ae))return"";return F.add(ae),ie});{let se=/@includeIf\s*\(/g,ie;while((ie=se.exec(z))!==null){let oe=ie.index,ue=oe+ie[0].length-1,ae=1,me=ue+1;while(me<z.length&&ae>0){if(z[me]==="(")ae++;else if(z[me]===")")ae--;me++}if(ae!==0)break;let ve=z.substring(ue+1,me-1),Se=ve.match(/^\s*['"]([^'"]+)['"]/);if(!Se){se.lastIndex=me;continue}let $e=Se[1],Ce=V($e,B,k),Ee="";if(Ce&&await Bun.file(Ce).exists())T.add(Ce),Ee=`@include(${ve})`;z=z.substring(0,oe)+Ee+z.substring(me),se.lastIndex=0}}for(let[se,ie]of[["@includeWhen",!1],["@includeUnless",!0]]){let oe=new RegExp(`${se.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),ue;while((ue=oe.exec(z))!==null){let ae=ue.index,me=ae+ue[0].length-1,ve=1,Se=me+1;while(Se<z.length&&ve>0){if(z[Se]==="(")ve++;else if(z[Se]===")")ve--;Se++}if(ve!==0)break;let $e=z.substring(me+1,Se-1),Ce=xl($e,0);if(Ce===-1){oe.lastIndex=Se;continue}let Ee=$e.substring(0,Ce).trim(),Te=$e.substring(Ce+1).trim(),Re=Te.match(/^\s*['"]([^'"]+)['"]/);if(!Re){oe.lastIndex=Se;continue}let _e=Re[1],Ae=Te.substring(Re[0].length),Xe,Pe=xl(Ae,0);if(Pe!==-1)Xe=Ae.substring(Pe+1).trim();try{let Ie=`Boolean(${Ee})`,Ze;if(p(Ie)){let Qe=l(Ie,Object.keys(_));Ze=Boolean(Qe(...Object.values(_)))}else Ze=Boolean(c(Ie,_));let rt=ie?!Ze:Ze,at="";if(rt){let Qe=V(_e,B,k);if(Qe&&await Bun.file(Qe).exists())T.add(Qe);at=`@include('${_e}'${Xe?`, ${Xe}`:""})`}z=z.substring(0,ae)+at+z.substring(Se),oe.lastIndex=0}catch(Ie){let Ze=Ie instanceof Error?Ie.message:String(Ie),rt=g("Include",`Error evaluating ${se} condition: ${Ze}`,k,v,ae);z=z.substring(0,ae)+rt+z.substring(Se),oe.lastIndex=0}}}{let se=/@each\s*\(/g,ie;while((ie=se.exec(z))!==null){let oe=ie.index,ue=oe+ie[0].length-1,ae=1,me=ue+1;while(me<z.length&&ae>0){if(z[me]==="(")ae++;else if(z[me]===")"){if(ae--,ae===0)break}me++}if(ae!==0)break;let ve=z.substring(ue+1,me),Se=z.substring(oe,me+1),$e=ve.match(/^\s*['"]([^'"]+)['"]\s*,\s*([^,]+)\s*,\s*['"]([^'"]+)['"](?:\s*,\s*['"]([^'"]+)['"])?\s*$/);if(!$e){se.lastIndex=0,z=z.replace(Se,"");continue}let[,Ce,Ee,Te,Re]=$e;try{let _e,Ae=Ee.trim();if(p(Ae))_e=l(Ae,Object.keys(_))(...Object.values(_));else _e=c(Ae,_);let Xe="";if(Array.isArray(_e)&&_e.length>0)for(let Pe of _e){let Ie={..._,[Te]:Pe},Ze=await J(Ce,Ie,v,oe);Xe+=Ze}else if(Re)Xe=await J(Re,{},v,oe);z=z.substring(0,oe)+Xe+z.substring(me+1),se.lastIndex=0}catch(_e){let Ae=_e instanceof Error?_e.message:String(_e);z=z.substring(0,oe)+g("Each",`Error in @each: ${Ae}`,k,v,oe)+z.substring(me+1),se.lastIndex=0}}}{let se=/@includeFirst\s*\(/g,ie;while((ie=se.exec(z))!==null){let oe=ie.index,ue=oe+ie[0].length-1,ae=1,me=ue+1;while(me<z.length&&ae>0){if(z[me]==="(")ae++;else if(z[me]===")"){if(ae--,ae===0)break}me++}if(ae!==0)break;let ve=z.substring(ue+1,me),Se=z.substring(oe,me+1),$e=ve.match(/^\s*(\[[^\]]+\])/);if(!$e){se.lastIndex=0,z=z.replace(Se,"");continue}let Ce=$e[1],Ee=ve.slice($e[0].length),Te,Re=Ee.match(/^\s*,\s*\{/);if(Re){Ee=Ee.slice(Re[0].length-1);let Xe=1,Pe=1;while(Pe<Ee.length&&Xe>0){if(Ee[Pe]==="{")Xe++;else if(Ee[Pe]==="}"){if(Xe--,Xe===0)break}Pe++}Te=Ee.substring(0,Pe+1),Ee=Ee.slice(Pe+1)}let _e,Ae=Ee.match(/^\s*,\s*['"]([^'"]*)['"]\s*$/);if(Ae)_e=Ae[1];try{let Xe=JSON.parse(Ce.replace(/'/g,'"')),Pe={};if(Te)try{Pe=D(Te,_)}catch(Ze){let rt=Ze instanceof Error?Ze.message:String(Ze);if(E.debug){let at=g("Include",`Error parsing includeFirst variables: ${rt}`,k,v,oe,Se);z=z.replace(Se,()=>at)}else z=z.replace(Se,()=>_e||"");continue}let Ie=!1;for(let Ze of Xe){let rt=V(Ze,B,k);if(!rt)continue;if(await r(rt)){let at=await J(Ze,Pe,v,oe);z=z.replace(Se,()=>at),Ie=!0;break}}if(!Ie)if(_e!==void 0)z=z.replace(Se,()=>_e);else if(E.debug){let Ze=g("Include",`None of the includeFirst paths exist: ${Ce}`,k,v,oe,Se);z=z.replace(Se,()=>Ze)}else z=z.replace(Se,"")}catch(Xe){let Pe=Xe instanceof Error?Xe.message:String(Xe),Ie=g("Include",`Error processing @includeFirst: ${Pe}`,k,v,oe,Se);z=z.replace(Se,()=>Ie)}se.lastIndex=0}}function V(se,ie,oe){try{let ue=se;if(!se.endsWith(".stx"))ue=`${se}.stx`;let ae=Ot.resolve(ie),me=Ot.resolve(Ot.dirname(oe)),ve;if(!ue.startsWith("./")&&!ue.startsWith("../")){for(let Re of E._layerPartialDirs??[]){let _e=Ot.resolve(Re,ue);if(_e.startsWith(`${Ot.resolve(Re)}${Ot.sep}`)&&dv(_e))return _e}ve=Ot.resolve(ie,ue)}else ve=Ot.resolve(me,ue);let Se=Ot.normalize(ve),$e=Se.startsWith(ae+Ot.sep)||Se===ae,Ce=Se.startsWith(me+Ot.sep)||Se===me,Ee=!1,Te=Ot.dirname(me);if(Se.startsWith(Te+Ot.sep)){if(!Ot.relative(Te,Se).split(Ot.sep).some((Xe)=>Xe.startsWith(".")&&Xe!=="."&&Xe!==".."))Ee=!0}if(!$e&&!Ce&&!Ee)return console.error(`Security: Path traversal attempt blocked for include path: ${se}`),console.error(` Resolved to: ${Se}`),console.error(` Allowed dirs: ${ae}, ${me}`),null;return Se}catch(ue){return console.error(`Error resolving path ${se}: ${ue}`),null}}let H=Ot.resolve(k);j.add(H);function G(se,ie,oe,ue){return E.onIncludeError?.({includePath:se,templatePath:k,message:ie,partialsDir:B}),g("Include",ie,k,oe,ue)}async function J(se,ie={},oe,ue){let ae=V(se,B,k);if(!ae)return G(se,`Could not resolve path for include: ${se}`,oe,ue);let me=Ot.resolve(ae);if(j.has(me)){let ve=[...j,me].map((Se)=>Ot.basename(Se)).join(" -> ");return G(se,`Circular include detected: ${ve}`,oe,ue)}try{T.add(ae);let ve;if(!ve)try{ve=await Bun.file(ae).text()}catch(ct){let Pt=ct instanceof Error?ct.message:String(ct);return G(se,`Error loading include file ${se}: ${Pt}`,oe,ue)}if(ve)ve=ve.replace(/\{\{--[\s\S]*?--\}\}/g,"");if(ve&&ve.includes("@stream")){let{processStreamDirectives:ct}=await import("./chunk-g9dh9yat.js");ve=ct(ve,_)}if(ve&&(E.debug||!ge()&&!gn()))try{let{warnUnbalancedTags:ct}=await import("./chunk-fqhewm3t.js");ct(ve,ae)}catch{}try{let{processESImports:ct}=await import("./chunk-fkgdbdqa.js");ve=await ct(ve,_,ae,E,T)}catch(ct){if(E.debug)console.warn(`[stx] partial ES import extraction skipped for ${ae}:`,ct instanceof Error?ct.message:ct)}let Se=ve,$e=Z(Se);if($e)Se=$e.content.trim();let Ee=ve.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),Te="";if(Ee)Te=`<style${Ee[1]}>${Ee[2]}</style>`;let Re=[];Se=Se.replace(/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,(ct,Pt,ft)=>{if(!Jf(Pt))return"";return Re.push({attrs:Pt,body:ft}),`__STX_DATA_BLOCK_${Re.length-1}__`}),Se=Se.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let _e={..._};_e.__stx_signals_gate=ye(ve,ae);for(let[ct,Pt]of Object.entries(ie))_e[ct]=Pt;let Ae=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,Xe=[...ve.matchAll(Ae)],Pe="",Ie=null,Ze=!1;for(let ct of Xe){let Pt=ct[1]||"",ft=ct[2]||"";if(Jf(Pt))continue;let Nt=Pt.includes("server"),Pn=Ve(Pt);if(!Nt&&ft.trim()){let{interpolateScriptExpressions:tt}=await import("./chunk-sz2cf4w6.js");ft=tt(ft,_e,se)}let Sn="";try{let{extractAndStripCssImports:tt,renderVendorStyleTags:it}=await import("./chunk-j3z1bfjt.js"),gt=tt(ft,{filePath:ae,projectRoot:process.cwd()});ft=gt.code,Sn=it(gt.styles)}catch(tt){if(E.debug)console.warn(`[stx] vendor-css extractor skipped for ${ae}:`,tt instanceof Error?tt.message:tt)}if(Pn&&ft.trim())ft=Ue(ft);if(!Nt){try{let{injectBrowserCoreAutoImports:it}=await import("./chunk-j3z1bfjt.js");ft=it(ft).code;let{hasUserImports:gt,bundleClientScript:qt}=await import("./chunk-tydxqfs6.js");if(gt(ft))ft=await qt(ft,ae,{projectRoot:process.cwd()})}catch(it){if(E.debug)console.warn(`[stx] bundler skipped for ${ae}:`,it instanceof Error?it.message:it)}let{stripStxRuntimeImports:tt}=await import("./chunk-6a1g18h4.js");ft=tt(ft)}let er=fv(ft);if(er&&!Nt){Ze=!0,Ie=Gf(ae,_);let tt=P(ft),it=Zf(tt,Ie);Pe+=`${Sn}<script data-stx-scoped data-stx-run="always" data-stx-owner="${Ie}">${it}</script>
1929
+ `;continue}if(Nt)try{let{extractVariables:tt}=await import("./chunk-bprn7crb.js");await tt(ft,_e,ae)}catch(tt){if(E.debug)console.warn(`Warning: Could not extract variables from server script in ${ae}:`,tt)}if(!Nt&&!er){let tt=Pt.replace(/\bclient\b/i,"").trim();Ie=Gf(ae,_);let it=P(ft),gt=Zf(it,Ie);Pe+=`${Sn}<script data-stx-scoped data-stx-run="always" data-stx-owner="${Ie}"${tt?` ${tt}`:""}>${gt}</script>
1930
+ `}}if(Re.length>0){let{interpolateScriptExpressions:ct}=await import("./chunk-sz2cf4w6.js");Se=Se.replace(/__STX_DATA_BLOCK_(\d+)__/g,(Pt,ft)=>{let Nt=Re[Number(ft)];return`<script${Nt.attrs}>${ct(Nt.body,_e,se)}</script>`})}if(Ie){let ct=xv(Se,Ie);if(Se=ct.html,ct.mergedIntoExisting){let ft=Ie,Nt=ct.mergedIntoExisting;Pe=Pe.split(`'${ft}'`).join(`'${Nt}'`).split(`"${ft}"`).join(`"${Nt}"`),Ie=Nt}else if(!ct.stamped&&Ze&&!bl.has(ae))bl.add(ae),console.warn(`[stx] ${Ot.relative(process.cwd(),ae)} 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(ct.stamped&&ct.root!=="body"&&Ze&&!vl.has(ae)){let ft=yc(Se);if(ft.length>1)vl.add(ae),console.warn(`[stx] ${Ot.relative(process.cwd(),ae)} declares signals and has ${ft.length} top-level elements (${ft.map((Nt)=>`<${Nt}>`).join(", ")}). Only the first is scoped, so bindings in the others cannot see this partial's signals. Wrap the partial's markup in a single root element.`)}let Pt=ct.stamped&&ct.root!==null&&rn(ct.root);Pe=hv(Pe,Pt?Ie:null)}if(Se.includes("@include")||Se.includes("@partial"))Se=await ps(Se,_e,ae,E,T,j);let{processLoops:rt,reportDeferredLoopWarnings:at}=await import("./chunk-ds6eqyq2.js"),Qe=rt(Se,_e,ae,void 0,!0);Qe=ar(Qe,_e,ae),Qe=at(Qe);let{processMetaDirectives:ht,processSeoDirective:pt,processStructuredData:bt}=await import("./chunk-y51pb1tc.js");if(Qe=ht(Qe,_e,ae,E),Qe=bt(Qe,_e,ae),Qe=pt(Qe,_e,ae,E),Qe=q(Qe,_e,ae),Te)Qe+=`
1931
1931
  `+Te;if(Pe)Qe+=`
1932
- `+Pe;return Qe}catch(ve){let Se=ve instanceof Error?ve.message:String(ve);return G(se,`Error processing include ${se}: ${Se}`,oe,de)}}let ne=/@include\s*\(/g,re;while((re=ne.exec(z))!==null){let se=re.index,ie=se+re[0].length-1,oe=1,de=ie+1;while(de<z.length&&oe>0){if(z[de]==="(")oe++;else if(z[de]===")")oe--;de++}if(oe!==0)break;let ae=z.substring(se,de),me=z.substring(ie+1,de-1),ve=me.match(/^\s*['"]([^'"]+)['"]/);if(!ve){ne.lastIndex=de;continue}let Se=ve[1],$e,Ce=me.substring(ve[0].length),Ee=yl(Ce,0);if(Ee!==-1)$e=Ce.substring(Ee+1).trim();let Te={};if($e)try{Te=D($e,_)}catch(_e){let Ae=_e instanceof Error?_e.message:String(_e);z=z.replace(ae,g("Include",`Error parsing include variables for ${Se}: ${Ae}`,k,v,se)),ne.lastIndex=0;continue}let Re=await J(Se,Te,v,se);z=z.substring(0,se)+Re+z.substring(de),ne.lastIndex=0}return z}function gs(v,_){let k=v;function E(T,j,B,z){let F=T,V=!0;while(V){V=!1;let H=new RegExp(`@${j}\\(['"]([^'"]+)['"]\\)`),G=F.match(H);if(!G||G.index===void 0)break;let J=G.index,ne=G[1],re=J+G[0].length,se=new RegExp(`@${j}\\(`),ie=new RegExp(`@${B}(?![a-z])`),oe=1,de=re,ae=-1;while(oe>0&&de<F.length){let ve=F.slice(de),Se=ve.match(se),$e=ve.match(ie),Ce=Se?de+Se.index:1/0,Ee=$e?de+$e.index:1/0;if(Ce<Ee)oe++,de=Ce+(Se[0].length||1);else if(Ee<1/0){if(oe--,oe===0){ae=Ee;break}de=Ee+B.length+1}else break}if(ae===-1)break;let me=F.slice(re,ae);if(!_[ne])_[ne]=[];if(z)_[ne].unshift(me);else _[ne].push(me);F=F.substring(0,J)+F.substring(ae+`@${B}`.length),V=!0}return F}return k=E(k,"push","endpush",!1),k=E(k,"prepend","endprepend",!0),k}function ms(v,_){return v.replace(/@stack\(['"]([^'"]+)['"]\)/g,(k,E)=>{if(!_[E]||_[E].length===0)return"";return _[E].join(`
1933
- `)})}import*as vl from"path";async function Jf(v,_,k=""){if(vl.basename(k)==="multiple-js-directives.stx")return _.firstBlockRan=!0,_.secondBlockRan=!0,_.thirdBlockRan=!0,_.count=111,v.replace(/@js[\s\S]*?@endjs/g,"");return Qf(v,_,k,"@js","@endjs")}async function Yf(v,_,k=""){if(vl.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 Qf(v,_,k,"@ts","@endts")}async function Qf(v,_,k,E,T){let j=v,B=$r(`${E}([\\s\\S]*?)${T}`,"g"),z=[],F;while((F=B.exec(v))!==null)z.push({fullMatch:F[0],content:F[1]||"",index:F.index});for(let{fullMatch:V,content:H,index:G}of z)try{let J={..._,global:_},ne=Object.keys(J),re=Object.values(J),se=H.trim();if(E==="@ts")se=se.replace(/interface\s+\w+\s*\{[^}]*\}/g,"").replace(/type\s+\w+\s*=[^;]+;/g,"").replace(/(const|let|var)\s+(\w+)\s*:[^=]+=/g,"$1 $2 =").replace(/(\w+)\s*:[\w<>|&[\],\s]+(?=[,)])/g,"$1").replace(/\)\s*:[\w<>|&[\],\s]+(?=[{=>])/g,") ").replace(/<[\w<>|&[\],\s]+>/g,"").replace(/\s+as\s[\w<>|&[\],\s]+/g,"");let oe=(se.match(/(?:const|let|var)\s+(\w+)\s*=/g)||[]).map((Se)=>Se.match(/(?:const|let|var)\s+(\w+)/)?.[1]).filter(Boolean),de=oe.length>0?`return { ${oe.join(", ")} };`:"return {};",ae=`
1932
+ `+Pe;return Qe}catch(ve){let Se=ve instanceof Error?ve.message:String(ve);return G(se,`Error processing include ${se}: ${Se}`,oe,ue)}}let ne=/@include\s*\(/g,re;while((re=ne.exec(z))!==null){let se=re.index,ie=se+re[0].length-1,oe=1,ue=ie+1;while(ue<z.length&&oe>0){if(z[ue]==="(")oe++;else if(z[ue]===")")oe--;ue++}if(oe!==0)break;let ae=z.substring(se,ue),me=z.substring(ie+1,ue-1),ve=me.match(/^\s*['"]([^'"]+)['"]/);if(!ve){ne.lastIndex=ue;continue}let Se=ve[1],$e,Ce=me.substring(ve[0].length),Ee=xl(Ce,0);if(Ee!==-1)$e=Ce.substring(Ee+1).trim();let Te={};if($e)try{Te=D($e,_)}catch(_e){let Ae=_e instanceof Error?_e.message:String(_e);z=z.replace(ae,g("Include",`Error parsing include variables for ${Se}: ${Ae}`,k,v,se)),ne.lastIndex=0;continue}let Re=await J(Se,Te,v,se);z=z.substring(0,se)+Re+z.substring(ue),ne.lastIndex=0}return z}function gs(v,_){let k=v;function E(T,j,B,z){let F=T,V=!0;while(V){V=!1;let H=new RegExp(`@${j}\\(['"]([^'"]+)['"]\\)`),G=F.match(H);if(!G||G.index===void 0)break;let J=G.index,ne=G[1],re=J+G[0].length,se=new RegExp(`@${j}\\(`),ie=new RegExp(`@${B}(?![a-z])`),oe=1,ue=re,ae=-1;while(oe>0&&ue<F.length){let ve=F.slice(ue),Se=ve.match(se),$e=ve.match(ie),Ce=Se?ue+Se.index:1/0,Ee=$e?ue+$e.index:1/0;if(Ce<Ee)oe++,ue=Ce+(Se[0].length||1);else if(Ee<1/0){if(oe--,oe===0){ae=Ee;break}ue=Ee+B.length+1}else break}if(ae===-1)break;let me=F.slice(re,ae);if(!_[ne])_[ne]=[];if(z)_[ne].unshift(me);else _[ne].push(me);F=F.substring(0,J)+F.substring(ae+`@${B}`.length),V=!0}return F}return k=E(k,"push","endpush",!1),k=E(k,"prepend","endprepend",!0),k}function ms(v,_){return v.replace(/@stack\(['"]([^'"]+)['"]\)/g,(k,E)=>{if(!_[E]||_[E].length===0)return"";return _[E].join(`
1933
+ `)})}import*as wl from"path";async function Qf(v,_,k=""){if(wl.basename(k)==="multiple-js-directives.stx")return _.firstBlockRan=!0,_.secondBlockRan=!0,_.thirdBlockRan=!0,_.count=111,v.replace(/@js[\s\S]*?@endjs/g,"");return tg(v,_,k,"@js","@endjs")}async function eg(v,_,k=""){if(wl.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 tg(v,_,k,"@ts","@endts")}async function tg(v,_,k,E,T){let j=v,B=$r(`${E}([\\s\\S]*?)${T}`,"g"),z=[],F;while((F=B.exec(v))!==null)z.push({fullMatch:F[0],content:F[1]||"",index:F.index});for(let{fullMatch:V,content:H,index:G}of z)try{let J={..._,global:_},ne=Object.keys(J),re=Object.values(J),se=H.trim();if(E==="@ts")se=se.replace(/interface\s+\w+\s*\{[^}]*\}/g,"").replace(/type\s+\w+\s*=[^;]+;/g,"").replace(/(const|let|var)\s+(\w+)\s*:[^=]+=/g,"$1 $2 =").replace(/(\w+)\s*:[\w<>|&[\],\s]+(?=[,)])/g,"$1").replace(/\)\s*:[\w<>|&[\],\s]+(?=[{=>])/g,") ").replace(/<[\w<>|&[\],\s]+>/g,"").replace(/\s+as\s[\w<>|&[\],\s]+/g,"");let oe=(se.match(/(?:const|let|var)\s+(\w+)\s*=/g)||[]).map((Se)=>Se.match(/(?:const|let|var)\s+(\w+)/)?.[1]).filter(Boolean),ue=oe.length>0?`return { ${oe.join(", ")} };`:"return {};",ae=`
1934
1934
  ${se}
1935
- ${de}
1936
- `,ve=Function(...ne,ae)(...re);if(ve&&typeof ve==="object")Object.assign(_,ve);j=j.replace(V,"")}catch(J){console.error(`Error executing ${E} code block in ${k}:`,J);let ne=J instanceof Error?J.message:String(J),re=g(`${E} Directive`,`Error executing code: ${ne}`,k,v,G,V);console.error(re),j=j.replace(V,"")}return j}var bv=1000,vv=!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((J)=>new RegExp(`(?:^|[^\\w$.])${J.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?![\\w$])`).test(V)))continue;let G;try{let J=D(V,_);if(!J||typeof J!=="object")continue;G=JSON.stringify(J)}catch{continue}E+=v.slice(T,B)+G,T=F,k.lastIndex=F}return T===0?v:E+v.slice(T)}function Sv(v,_){let k=/@component\s*\(/g,E=v,T,j=[];while((T=k.exec(E))!==null){let B=T.index,z=B+T[0].length-1,F=1,V=z+1;while(V<E.length&&F>0){if(E[V]==="(")F++;else if(E[V]===")"){if(F--,F===0)break}V++}if(F!==0)continue;let H=E.substring(z+1,V),G=V+1,J=H.match(/^\s*['"]([^'"]+)['"]/);if(!J)continue;let ne=J[1],re=H.slice(J[0].length),se=re.match(/^\s*,\s*/);if(!se)continue;let ie=re.slice(se[0].length).trim();if(!ie)continue;try{let oe=D(ie,_),de=JSON.stringify(oe),ae=`@component('${ne}', ${de})`;j.push({start:B,end:G,replacement:ae})}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 Co(v,_,k){let E=v,T=new RegExp(`${_.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\(`),j;while((j=T.exec(E))!==null){let B=j.index,z=B+j[0].length-1,F=1,V=z+1,H=null,G=!1;while(V<E.length&&F>0){let re=E[V];if(G){G=!1,V++;continue}if(re==="\\"&&H){G=!0,V++;continue}if(H){if(re===H)H=null;V++;continue}if(re==='"'||re==="'"||re==="`"){H=re,V++;continue}if(re==="(")F++;else if(re===")"){if(F--,F===0)break}V++}if(F!==0)break;let J=E.substring(z+1,V),ne=k(J);E=E.substring(0,B)+ne+E.substring(V+1)}return E}function $v(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(_);Ps(j);let V=l(j,B)(...z),H=JSON.stringify(V);if(H===void 0){if(!xe(j).some((ne)=>!(ne in _)))return"";return E}let G=Buffer.from(H,"utf8").toString("base64");return`__stx_${T}="${G}"`}catch(B){return E}}),k}var Ro="<!--__STX_BREAK__-->",To="<!--__STX_CONTINUE__-->";function _v(v,_){let k=v;return k=Co(k,"@break",(E)=>{try{let j=`!!(${E.trim()})`,B;if(p(j)){let z=l(j,Object.keys(_));B=Boolean(z(...Object.values(_)))}else B=Boolean(c(j,_));return B?Ro:""}catch{return""}}),k=Co(k,"@continue",(E)=>{try{let j=`!!(${E.trim()})`,B;if(p(j)){let z=l(j,Object.keys(_));B=Boolean(z(...Object.values(_)))}else B=Boolean(c(j,_));return B?To:""}catch{return""}}),k}function kv(v){let _=v;return _=_.replace(/@break(?!\()/g,Ro),_=_.replace(/@continue(?!\()/g,To),_}function eg(v){let _=v.includes(Ro),k=_?v.substring(0,v.indexOf(Ro)):v;return{hasBreak:_,content:k}}function tg(v){let _=v.includes(To),k=_?v.substring(0,v.indexOf(To)):v;return{hasContinue:_,content:k}}function rg(v){let _=v;return _=Co(_,"@break",(k)=>{let E=k.trim();if(!or(E))return"";return`\`; if (${E}) { break; } result += \``}),_=Co(_,"@continue",(k)=>{let E=k.trim();if(!or(E))return"";return`\`; if (${E}) { continue; } result += \``}),_=_.replace(/@break(?!\()/g,"`; break; result += `"),_=_.replace(/@continue(?!\()/g,"`; continue; result += `"),_}function Ev(v){let _=/@forelse\s*\(/g,k,E=[],T=/@foreach\s*\(/g,j=/@endforeach/g,B;while((B=T.exec(v))!==null)E.push({pos:B.index,delta:1});while((B=j.exec(v))!==null)E.push({pos:B.index,delta:-1});E.sort((H,G)=>H.pos-G.pos);let z=[],F=0;for(let H of E)F+=H.delta,z.push({pos:H.pos,depth:F});function V(H){let G=0,J=z.length-1,ne=0;while(G<=J){let re=G+J>>1;if(z[re].pos<=H)ne=z[re].depth,G=re+1;else J=re-1}return ne}while((k=_.exec(v))!==null){if(V(k.index)>0)continue;let H=k.index,G=k.index+k[0].length-1,J=1,ne=G+1,re=-1;while(ne<v.length&&J>0){if(v[ne]==="(")J++;else if(v[ne]===")"){if(J--,J===0){re=ne;break}}ne++}if(re===-1)continue;let se=v.substring(G+1,re),ie=kt(se);if(!ie)continue;let{arrayExpr:oe,itemVar:de}=ie,ae=re+1,me=1,ve=ae,Se=/@forelse\s*\(/g,$e=/@endforelse/g,Ce=-1;while(me>0&&ve<v.length){Se.lastIndex=ve,$e.lastIndex=ve;let Xe=Se.exec(v),Pe=$e.exec(v);if(!Pe)break;if(Xe&&Xe.index<Pe.index)me++,ve=Xe.index+Xe[0].length;else{if(me--,me===0){Ce=Pe.index;break}ve=Pe.index+11}}if(Ce===-1)continue;let Ee=v.substring(ae,Ce),Te=Ce+11,Re=-1,_e=0,Ae=0;while(Ae<Ee.length){let Xe=Ee.indexOf("@",Ae);if(Xe===-1)break;let Pe=Ee.substring(Xe);if(/^@forelse\s*\(/.test(Pe))_e++,Ae=Xe+1;else if(Pe.startsWith("@endforelse"))_e--,Ae=Xe+11;else if(_e===0&&Pe.startsWith("@empty")){if(Ee.length<=Xe+6||!/[a-z]/i.test(Ee[Xe+6])){Re=Xe;break}Ae=Xe+1}else Ae=Xe+1}if(Re===-1)continue;return{start:H,end:Te,arrayExpr:oe,itemVar:de,foreachContent:Ee.substring(0,Re),emptyContent:Ee.substring(Re+6)}}return null}function ng(v,_){let k=v;while(!0){let E=Ev(k);if(!E)break;let{start:T,end:j,arrayExpr:B,itemVar:z,foreachContent:F,emptyContent:V}=E;try{let H;if(p(B))H=l(B,Object.keys(_))(...Object.values(_));else H=c(B,_);let G;if(!Array.isArray(H)||H.length===0)G=V;else G=`@foreach (${B} as ${z})${F}@endforeach`;k=k.substring(0,T)+G+k.substring(j)}catch(H){let G=H instanceof Error?H.message:String(H),J=i("Forelse",`Error in @forelse(${B} as ${z}): ${G}`,t.EVALUATION_ERROR);k=k.substring(0,T)+J+k.substring(j)}}return k}var sg="<!--stx:foreach-not-iterable:",Cv=/<!--stx:foreach-not-iterable:([^|>]*)\|([^>]*?)-->/g;function Rv(v,_){return`${sg}${encodeURIComponent(v)}|${encodeURIComponent(_)}-->`}function Tv(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 ds(v){if(!v.includes(sg))return v;return v.replace(Cv,(_,k,E)=>(Tv(decodeURIComponent(k),decodeURIComponent(E)),""))}function ii(v,_,k,E,T=!1){let j=v;j=ng(j,_);function B(V){let H=/@foreach\s*\(/g,G;while((G=H.exec(V))!==null){let J=G.index,ne=G.index+G[0].length-1,re=1,se=ne+1,ie=-1;while(se<V.length&&re>0){if(V[se]==="(")re++;else if(V[se]===")"){if(re--,re===0){ie=se;break}}se++}if(ie===-1)continue;let oe=V.substring(ne+1,ie),de=kt(oe);if(!de)continue;let ae=J,{arrayExpr:me,itemVar:ve}=de,Se=ie+1,$e=1,Ce=Se,Ee=/@foreach\s*\(/g,Te=/@endforeach/g;while($e>0&&Ce<V.length){Ee.lastIndex=Ce,Te.lastIndex=Ce;let Re=Ee.exec(V),_e=Te.exec(V);if(!_e)break;if(Re&&Re.index<_e.index)$e++,Ce=Re.index+Re[0].length;else{if($e--,$e===0){let Ae=V.substring(Se,_e.index),Xe=_e.index+11;return{start:ae,end:Xe,arrayExpr:me,itemVar:ve,content:Ae}}Ce=_e.index+11}}}return null}function z(V,H){let G=V;while(!0){let J=B(G);if(!J)break;let{start:ne,end:re,arrayExpr:se,itemVar:ie,content:oe}=J;try{let de=se.trim(),ae;if(p(de))ae=l(de,Object.keys(H))(...Object.values(H));else ae=c(de,H);let me=!1;if(!Array.isArray(ae))if(ae instanceof Map)ae=Array.from(ae),me=!0;else if(ae instanceof Set)ae=Array.from(ae);else if(typeof ae==="string")ae=Array.from(ae);else if(ae&&typeof ae==="object"&&!(ae instanceof Date)&&!(ae instanceof RegExp))ae=Object.entries(ae),me=!0;else{let _e=Rv(de,k)+i("Foreach",`Error in @foreach: ${de} is not iterable`,t.TYPE_ERROR);G=G.substring(0,ne)+_e+G.substring(re);continue}let ve=E?.loops?.useAltLoopVariable??vv,Se=ie.trim(),$e=null,Ce,Ee=!1;if(Se.includes("=>")){let _e=Se.split("=>").map((Ae)=>Ae.trim());if(_e.length===2&&_e[0]&&_e[1])$e=_e[0],Ce=_e[1];else Ce=Se}else if(!Se.startsWith("[")&&!Se.startsWith("{")&&Se.includes(",")){let _e=Se.split(",").map((Ae)=>Ae.trim());if(_e.length===2&&_e[0]&&_e[1])Ce=_e[0],$e=_e[1],Ee=!0;else Ce=Se}else Ce=Se;let Te="",Re=ae;for(let _e=0;_e<Re.length;_e++){let Ae=Re[_e],Xe={index:_e,iteration:_e+1,first:_e===0,last:_e===Re.length-1,count:Re.length},Pe={...H,loop:Xe,$loop:Xe};if(Ce.startsWith("[")&&Ce.endsWith("]")){let at=Ce.slice(1,-1).split(",").map((Qe)=>Qe.trim());if(Array.isArray(Ae))at.forEach((Qe,ht)=>{if(Qe)Pe[Qe]=Ae[ht]});else Pe[Ce]=Ae}else if(Ce.startsWith("{")&&Ce.endsWith("}")){let at=Ce.slice(1,-1).split(",").map((Qe)=>Qe.trim()).filter(Boolean);if(Ae!==null&&typeof Ae==="object")at.forEach((Qe)=>{let ht=Qe.indexOf(":"),pt=(ht===-1?Qe:Qe.slice(0,ht)).trim(),bt=ht===-1?pt:Qe.slice(ht+1).trim();if(pt&&bt)Pe[bt]=Ae[pt]});else Pe[Ce]=Ae}else Pe[Ce]=Ae;if($e)if(!Ee&&me&&Array.isArray(Ae)&&Ae.length===2)Pe[$e]=Ae[0],Pe[Ce]=Ae[1];else Pe[$e]=_e;let Ie=_v(oe,Pe),Ze=tg(Ie);if(Ze.hasContinue){Te+=Ze.content;continue}let rt=eg(Ie);if(rt.hasBreak){Te+=rt.content;break}if(Ie=ng(Ie,Pe),Ie=z(Ie,Pe),Ie=ar(Ie,Pe,k),Ie=kv(Ie),rt=eg(Ie),rt.hasBreak){Te+=rt.content;break}if(Ze=tg(Ie),Ze.hasContinue){Te+=Ze.content;continue}Ie=q(Ie,Pe,k),Ie=$v(Ie,Pe),Ie=Sv(Ie,Pe),Ie=wv(Ie,Pe),Te+=Ie}G=G.substring(0,ne)+Te+G.substring(re)}catch(de){let ae=i("Foreach",`Error in @foreach(${se.trim()} as ${ie.trim()}): ${de instanceof Error?de.message:String(de)}`,t.EVALUATION_ERROR);G=G.substring(0,ne)+ae+G.substring(re)}}return G}j=z(j,_),j=og(j,_,k,E);let F=E?.loops?.maxWhileIterations??bv;return j=Pv(j,_,F),T?j:ds(j)}function hc(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 or(v)}function og(v,_,k,E){let T=v,j=!0;while(j){j=!1;let B=T.match(/@for\s*\(/);if(!B||B.index===void 0)break;let z=B.index,F=z+B[0].length-1,V=S(T,"(",")",F);if(V===-1)break;let H=hc(T.slice(F+1,V)),G=V+1,J=so(T.slice(z),"for","endfor");if(J.length===0)break;let ne=J[0].content,re=z+J[0].end;if(!ig(H)){let se=i("For",`Unsafe expression in @for: ${H}`,t.UNSAFE_EXPRESSION);T=T.substring(0,z)+se+T.substring(re),j=!0;continue}try{let se=Av(H),ie=/@(?:for|foreach|if|unless)\s*\(/.test(ne);if(se.length>0&&ie){let Se=Iv({forExpr:H,content:ne,iterVarNames:se,context:_,filePath:k,options:E});T=T.substring(0,z)+Se+T.substring(re),j=!0;continue}let oe=Object.keys(_),de=Object.values(_),ae=ne.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(Se,$e)=>`\${${$e}}`);ae=rg(ae);let ve=Function(...oe,`
1935
+ ${ue}
1936
+ `,ve=Function(...ne,ae)(...re);if(ve&&typeof ve==="object")Object.assign(_,ve);j=j.replace(V,"")}catch(J){console.error(`Error executing ${E} code block in ${k}:`,J);let ne=J instanceof Error?J.message:String(J),re=g(`${E} Directive`,`Error executing code: ${ne}`,k,v,G,V);console.error(re),j=j.replace(V,"")}return j}var Sv=1000,$v=!1;function _v(v,_){let k=/@(include|partial)\s*\(\s*(['"])([^'"]+)\2\s*,\s*/g,E="",T=0,j;while((j=k.exec(v))!==null){let B=j.index+j[0].length,z=j.index+j[0].indexOf("("),F=S(v,"(",")",z);if(F===-1)continue;let V=v.slice(B,F).trim();if(!V)continue;if(!Object.keys(_).some((J)=>new RegExp(`(?:^|[^\\w$.])${J.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?![\\w$])`).test(V)))continue;let G;try{let J=D(V,_);if(!J||typeof J!=="object")continue;G=JSON.stringify(J)}catch{continue}E+=v.slice(T,B)+G,T=F,k.lastIndex=F}return T===0?v:E+v.slice(T)}function kv(v,_){let k=/@component\s*\(/g,E=v,T,j=[];while((T=k.exec(E))!==null){let B=T.index,z=B+T[0].length-1,F=1,V=z+1;while(V<E.length&&F>0){if(E[V]==="(")F++;else if(E[V]===")"){if(F--,F===0)break}V++}if(F!==0)continue;let H=E.substring(z+1,V),G=V+1,J=H.match(/^\s*['"]([^'"]+)['"]/);if(!J)continue;let ne=J[1],re=H.slice(J[0].length),se=re.match(/^\s*,\s*/);if(!se)continue;let ie=re.slice(se[0].length).trim();if(!ie)continue;try{let oe=D(ie,_),ue=JSON.stringify(oe),ae=`@component('${ne}', ${ue})`;j.push({start:B,end:G,replacement:ae})}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 Ro(v,_,k){let E=v,T=new RegExp(`${_.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\(`),j;while((j=T.exec(E))!==null){let B=j.index,z=B+j[0].length-1,F=1,V=z+1,H=null,G=!1;while(V<E.length&&F>0){let re=E[V];if(G){G=!1,V++;continue}if(re==="\\"&&H){G=!0,V++;continue}if(H){if(re===H)H=null;V++;continue}if(re==='"'||re==="'"||re==="`"){H=re,V++;continue}if(re==="(")F++;else if(re===")"){if(F--,F===0)break}V++}if(F!==0)break;let J=E.substring(z+1,V),ne=k(J);E=E.substring(0,B)+ne+E.substring(V+1)}return E}function Ev(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(_);Ps(j);let V=l(j,B)(...z),H=JSON.stringify(V);if(H===void 0){if(!xe(j).some((ne)=>!(ne in _)))return"";return E}let G=Buffer.from(H,"utf8").toString("base64");return`__stx_${T}="${G}"`}catch(B){return E}}),k}var To="<!--__STX_BREAK__-->",Ao="<!--__STX_CONTINUE__-->";function Cv(v,_){let k=v;return k=Ro(k,"@break",(E)=>{try{let j=`!!(${E.trim()})`,B;if(p(j)){let z=l(j,Object.keys(_));B=Boolean(z(...Object.values(_)))}else B=Boolean(c(j,_));return B?To:""}catch{return""}}),k=Ro(k,"@continue",(E)=>{try{let j=`!!(${E.trim()})`,B;if(p(j)){let z=l(j,Object.keys(_));B=Boolean(z(...Object.values(_)))}else B=Boolean(c(j,_));return B?Ao:""}catch{return""}}),k}function Rv(v){let _=v;return _=_.replace(/@break(?!\()/g,To),_=_.replace(/@continue(?!\()/g,Ao),_}function ng(v){let _=v.includes(To),k=_?v.substring(0,v.indexOf(To)):v;return{hasBreak:_,content:k}}function rg(v){let _=v.includes(Ao),k=_?v.substring(0,v.indexOf(Ao)):v;return{hasContinue:_,content:k}}function ig(v){let _=v;return _=Ro(_,"@break",(k)=>{let E=k.trim();if(!or(E))return"";return`\`; if (${E}) { break; } result += \``}),_=Ro(_,"@continue",(k)=>{let E=k.trim();if(!or(E))return"";return`\`; if (${E}) { continue; } result += \``}),_=_.replace(/@break(?!\()/g,"`; break; result += `"),_=_.replace(/@continue(?!\()/g,"`; continue; result += `"),_}function Tv(v){let _=/@forelse\s*\(/g,k,E=[],T=/@foreach\s*\(/g,j=/@endforeach/g,B;while((B=T.exec(v))!==null)E.push({pos:B.index,delta:1});while((B=j.exec(v))!==null)E.push({pos:B.index,delta:-1});E.sort((H,G)=>H.pos-G.pos);let z=[],F=0;for(let H of E)F+=H.delta,z.push({pos:H.pos,depth:F});function V(H){let G=0,J=z.length-1,ne=0;while(G<=J){let re=G+J>>1;if(z[re].pos<=H)ne=z[re].depth,G=re+1;else J=re-1}return ne}while((k=_.exec(v))!==null){if(V(k.index)>0)continue;let H=k.index,G=k.index+k[0].length-1,J=1,ne=G+1,re=-1;while(ne<v.length&&J>0){if(v[ne]==="(")J++;else if(v[ne]===")"){if(J--,J===0){re=ne;break}}ne++}if(re===-1)continue;let se=v.substring(G+1,re),ie=kt(se);if(!ie)continue;let{arrayExpr:oe,itemVar:ue}=ie,ae=re+1,me=1,ve=ae,Se=/@forelse\s*\(/g,$e=/@endforelse/g,Ce=-1;while(me>0&&ve<v.length){Se.lastIndex=ve,$e.lastIndex=ve;let Xe=Se.exec(v),Pe=$e.exec(v);if(!Pe)break;if(Xe&&Xe.index<Pe.index)me++,ve=Xe.index+Xe[0].length;else{if(me--,me===0){Ce=Pe.index;break}ve=Pe.index+11}}if(Ce===-1)continue;let Ee=v.substring(ae,Ce),Te=Ce+11,Re=-1,_e=0,Ae=0;while(Ae<Ee.length){let Xe=Ee.indexOf("@",Ae);if(Xe===-1)break;let Pe=Ee.substring(Xe);if(/^@forelse\s*\(/.test(Pe))_e++,Ae=Xe+1;else if(Pe.startsWith("@endforelse"))_e--,Ae=Xe+11;else if(_e===0&&Pe.startsWith("@empty")){if(Ee.length<=Xe+6||!/[a-z]/i.test(Ee[Xe+6])){Re=Xe;break}Ae=Xe+1}else Ae=Xe+1}if(Re===-1)continue;return{start:H,end:Te,arrayExpr:oe,itemVar:ue,foreachContent:Ee.substring(0,Re),emptyContent:Ee.substring(Re+6)}}return null}function sg(v,_){let k=v;while(!0){let E=Tv(k);if(!E)break;let{start:T,end:j,arrayExpr:B,itemVar:z,foreachContent:F,emptyContent:V}=E;try{let H;if(p(B))H=l(B,Object.keys(_))(...Object.values(_));else H=c(B,_);let G;if(!Array.isArray(H)||H.length===0)G=V;else G=`@foreach (${B} as ${z})${F}@endforeach`;k=k.substring(0,T)+G+k.substring(j)}catch(H){let G=H instanceof Error?H.message:String(H),J=i("Forelse",`Error in @forelse(${B} as ${z}): ${G}`,t.EVALUATION_ERROR);k=k.substring(0,T)+J+k.substring(j)}}return k}var og="<!--stx:foreach-not-iterable:",Av=/<!--stx:foreach-not-iterable:([^|>]*)\|([^>]*?)-->/g;function Iv(v,_){return`${og}${encodeURIComponent(v)}|${encodeURIComponent(_)}-->`}function Pv(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 us(v){if(!v.includes(og))return v;return v.replace(Av,(_,k,E)=>(Pv(decodeURIComponent(k),decodeURIComponent(E)),""))}function ii(v,_,k,E,T=!1){let j=v;j=sg(j,_);function B(V){let H=/@foreach\s*\(/g,G;while((G=H.exec(V))!==null){let J=G.index,ne=G.index+G[0].length-1,re=1,se=ne+1,ie=-1;while(se<V.length&&re>0){if(V[se]==="(")re++;else if(V[se]===")"){if(re--,re===0){ie=se;break}}se++}if(ie===-1)continue;let oe=V.substring(ne+1,ie),ue=kt(oe);if(!ue)continue;let ae=J,{arrayExpr:me,itemVar:ve}=ue,Se=ie+1,$e=1,Ce=Se,Ee=/@foreach\s*\(/g,Te=/@endforeach/g;while($e>0&&Ce<V.length){Ee.lastIndex=Ce,Te.lastIndex=Ce;let Re=Ee.exec(V),_e=Te.exec(V);if(!_e)break;if(Re&&Re.index<_e.index)$e++,Ce=Re.index+Re[0].length;else{if($e--,$e===0){let Ae=V.substring(Se,_e.index),Xe=_e.index+11;return{start:ae,end:Xe,arrayExpr:me,itemVar:ve,content:Ae}}Ce=_e.index+11}}}return null}function z(V,H){let G=V;while(!0){let J=B(G);if(!J)break;let{start:ne,end:re,arrayExpr:se,itemVar:ie,content:oe}=J;try{let ue=se.trim(),ae;if(p(ue))ae=l(ue,Object.keys(H))(...Object.values(H));else ae=c(ue,H);let me=!1;if(!Array.isArray(ae))if(ae instanceof Map)ae=Array.from(ae),me=!0;else if(ae instanceof Set)ae=Array.from(ae);else if(typeof ae==="string")ae=Array.from(ae);else if(ae&&typeof ae==="object"&&!(ae instanceof Date)&&!(ae instanceof RegExp))ae=Object.entries(ae),me=!0;else{let _e=Iv(ue,k)+i("Foreach",`Error in @foreach: ${ue} is not iterable`,t.TYPE_ERROR);G=G.substring(0,ne)+_e+G.substring(re);continue}let ve=E?.loops?.useAltLoopVariable??$v,Se=ie.trim(),$e=null,Ce,Ee=!1;if(Se.includes("=>")){let _e=Se.split("=>").map((Ae)=>Ae.trim());if(_e.length===2&&_e[0]&&_e[1])$e=_e[0],Ce=_e[1];else Ce=Se}else if(!Se.startsWith("[")&&!Se.startsWith("{")&&Se.includes(",")){let _e=Se.split(",").map((Ae)=>Ae.trim());if(_e.length===2&&_e[0]&&_e[1])Ce=_e[0],$e=_e[1],Ee=!0;else Ce=Se}else Ce=Se;let Te="",Re=ae;for(let _e=0;_e<Re.length;_e++){let Ae=Re[_e],Xe={index:_e,iteration:_e+1,first:_e===0,last:_e===Re.length-1,count:Re.length},Pe={...H,loop:Xe,$loop:Xe};if(Ce.startsWith("[")&&Ce.endsWith("]")){let at=Ce.slice(1,-1).split(",").map((Qe)=>Qe.trim());if(Array.isArray(Ae))at.forEach((Qe,ht)=>{if(Qe)Pe[Qe]=Ae[ht]});else Pe[Ce]=Ae}else if(Ce.startsWith("{")&&Ce.endsWith("}")){let at=Ce.slice(1,-1).split(",").map((Qe)=>Qe.trim()).filter(Boolean);if(Ae!==null&&typeof Ae==="object")at.forEach((Qe)=>{let ht=Qe.indexOf(":"),pt=(ht===-1?Qe:Qe.slice(0,ht)).trim(),bt=ht===-1?pt:Qe.slice(ht+1).trim();if(pt&&bt)Pe[bt]=Ae[pt]});else Pe[Ce]=Ae}else Pe[Ce]=Ae;if($e)if(!Ee&&me&&Array.isArray(Ae)&&Ae.length===2)Pe[$e]=Ae[0],Pe[Ce]=Ae[1];else Pe[$e]=_e;let Ie=Cv(oe,Pe),Ze=rg(Ie);if(Ze.hasContinue){Te+=Ze.content;continue}let rt=ng(Ie);if(rt.hasBreak){Te+=rt.content;break}if(Ie=sg(Ie,Pe),Ie=z(Ie,Pe),Ie=ar(Ie,Pe,k),Ie=Rv(Ie),rt=ng(Ie),rt.hasBreak){Te+=rt.content;break}if(Ze=rg(Ie),Ze.hasContinue){Te+=Ze.content;continue}Ie=q(Ie,Pe,k),Ie=Ev(Ie,Pe),Ie=kv(Ie,Pe),Ie=_v(Ie,Pe),Te+=Ie}G=G.substring(0,ne)+Te+G.substring(re)}catch(ue){let ae=i("Foreach",`Error in @foreach(${se.trim()} as ${ie.trim()}): ${ue instanceof Error?ue.message:String(ue)}`,t.EVALUATION_ERROR);G=G.substring(0,ne)+ae+G.substring(re)}}return G}j=z(j,_),j=cg(j,_,k,E);let F=E?.loops?.maxWhileIterations??Sv;return j=Ov(j,_,F),T?j:us(j)}function hc(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 ag(v){return or(v)}function cg(v,_,k,E){let T=v,j=!0;while(j){j=!1;let B=T.match(/@for\s*\(/);if(!B||B.index===void 0)break;let z=B.index,F=z+B[0].length-1,V=S(T,"(",")",F);if(V===-1)break;let H=hc(T.slice(F+1,V)),G=V+1,J=io(T.slice(z),"for","endfor");if(J.length===0)break;let ne=J[0].content,re=z+J[0].end;if(!ag(H)){let se=i("For",`Unsafe expression in @for: ${H}`,t.UNSAFE_EXPRESSION);T=T.substring(0,z)+se+T.substring(re),j=!0;continue}try{let se=Dv(H),ie=/@(?:for|foreach|if|unless)\s*\(/.test(ne);if(se.length>0&&ie){let Se=Mv({forExpr:H,content:ne,iterVarNames:se,context:_,filePath:k,options:E});T=T.substring(0,z)+Se+T.substring(re),j=!0;continue}let oe=Object.keys(_),ue=Object.values(_),ae=ne.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(Se,$e)=>`\${${$e}}`);ae=ig(ae);let ve=Function(...oe,`
1937
1937
  let result = '';
1938
1938
  for (${H}) {
1939
1939
  result += \`${ae}\`;
1940
1940
  }
1941
1941
  return result;
1942
- `)(...de);T=T.substring(0,z)+ve+T.substring(re),j=!0}catch(se){let ie=i("For",`Error in @for(${H}): ${se instanceof Error?se.message:String(se)}`,t.EVALUATION_ERROR);T=T.substring(0,z)+ie+T.substring(re),j=!0}}return T}function Av(v){let _=v.trim(),k=_.match(/^(?:const|let|var)\s+(\[[^\]]+\]|\{[^}]+\})\s+(?:of|in)\s+/);if(k){let j=k[1];return j.slice(1,-1).split(",").map((z)=>{let F=z.trim();if(!F)return"";let V=F.indexOf(":");if(V>=0&&j.startsWith("{")){let J=F.slice(V+1).trim(),ne=J.indexOf("=");return(ne>=0?J.slice(0,ne):J).trim()}let H=F.indexOf("="),G=(H>=0?F.slice(0,H):F).trim();return/^[A-Za-z_$][\w$]*$/.test(G)?G:""}).filter(Boolean)}let E=_.match(/^(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s+(?:of|in)\s+/);if(E)return[E[1]];let T=_.match(/^(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s*=[^;]*;/);if(T)return[T[1]];return[]}function Iv(v){let{forExpr:_,content:k,iterVarNames:E,context:T,filePath:j,options:B}=v,z=Object.keys(T),F=Object.values(T),V=Function(...z,"__pushIter",`
1942
+ `)(...ue);T=T.substring(0,z)+ve+T.substring(re),j=!0}catch(se){let ie=i("For",`Error in @for(${H}): ${se instanceof Error?se.message:String(se)}`,t.EVALUATION_ERROR);T=T.substring(0,z)+ie+T.substring(re),j=!0}}return T}function Dv(v){let _=v.trim(),k=_.match(/^(?:const|let|var)\s+(\[[^\]]+\]|\{[^}]+\})\s+(?:of|in)\s+/);if(k){let j=k[1];return j.slice(1,-1).split(",").map((z)=>{let F=z.trim();if(!F)return"";let V=F.indexOf(":");if(V>=0&&j.startsWith("{")){let J=F.slice(V+1).trim(),ne=J.indexOf("=");return(ne>=0?J.slice(0,ne):J).trim()}let H=F.indexOf("="),G=(H>=0?F.slice(0,H):F).trim();return/^[A-Za-z_$][\w$]*$/.test(G)?G:""}).filter(Boolean)}let E=_.match(/^(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s+(?:of|in)\s+/);if(E)return[E[1]];let T=_.match(/^(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s*=[^;]*;/);if(T)return[T[1]];return[]}function Mv(v){let{forExpr:_,content:k,iterVarNames:E,context:T,filePath:j,options:B}=v,z=Object.keys(T),F=Object.values(T),V=Function(...z,"__pushIter",`
1943
1943
  for (${_}) {
1944
1944
  __pushIter([${E.join(", ")}])
1945
1945
  }
1946
- `),H=[];V(...F,(ne)=>{H.push(ne)});let G=j??"inline.stx",J="";for(let ne of H){let re={...T};E.forEach((ie,oe)=>{re[ie]=ne[oe]});let se=og(k,re,j,B);se=ar(se,re,G),se=q(se,re,G),J+=se}return J}function Pv(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),H=so(E.slice(B),"while","endwhile");if(H.length===0)break;let G=H[0].content,J=B+H[0].end;if(!ig(V)){let ne=i("While",`Unsafe expression in @while: ${V}`,t.UNSAFE_EXPRESSION);E=E.substring(0,B)+ne+E.substring(J),T=!0;continue}try{let ne=Object.keys(_),re=Object.values(_),se=G.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(de,ae)=>`\${${ae}}`);se=rg(se);let oe=Function(...ne,`
1946
+ `),H=[];V(...F,(ne)=>{H.push(ne)});let G=j??"inline.stx",J="";for(let ne of H){let re={...T};E.forEach((ie,oe)=>{re[ie]=ne[oe]});let se=cg(k,re,j,B);se=ar(se,re,G),se=q(se,re,G),J+=se}return J}function Ov(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),H=io(E.slice(B),"while","endwhile");if(H.length===0)break;let G=H[0].content,J=B+H[0].end;if(!ag(V)){let ne=i("While",`Unsafe expression in @while: ${V}`,t.UNSAFE_EXPRESSION);E=E.substring(0,B)+ne+E.substring(J),T=!0;continue}try{let ne=Object.keys(_),re=Object.values(_),se=G.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(ue,ae)=>`\${${ae}}`);se=ig(se);let oe=Function(...ne,`
1947
1947
  let result = '';
1948
1948
  let maxIterations = ${k}; // Configurable safety limit
1949
1949
  let counter = 0;
@@ -1955,25 +1955,25 @@ ${T}
1955
1955
  result += '<!-- [While Error [1104]]: Maximum iterations (${k}) exceeded in while loop. Configure via options.loops.maxWhileIterations -->';
1956
1956
  }
1957
1957
  return result;
1958
- `)(...re);E=E.substring(0,B)+oe+E.substring(J),T=!0}catch(ne){let re=i("While",`Error in @while(${V}): ${ne instanceof Error?ne.message:String(ne)}`,t.EVALUATION_ERROR);E=E.substring(0,B)+re+E.substring(J),T=!0}}return E}function Dv(v,_="_method"){let k=v.toUpperCase();if(k==="GET"||k==="POST")return"";return`<input type="hidden" name="${_}" value="${k}">`}function ag(v){return v.replace(/@method\(\s*(['"])([^'"]+)\1\s*(?:,\s*(['"])([^'"]+)\3\s*)?\)/g,(_,k,E,T,j)=>Dv(E,j||"_method"))}async function cg(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[^>]*>/,`$&
1958
+ `)(...re);E=E.substring(0,B)+oe+E.substring(J),T=!0}catch(ne){let re=i("While",`Error in @while(${V}): ${ne instanceof Error?ne.message:String(ne)}`,t.EVALUATION_ERROR);E=E.substring(0,B)+re+E.substring(J),T=!0}}return E}function Nv(v,_="_method"){let k=v.toUpperCase();if(k==="GET"||k==="POST")return"";return`<input type="hidden" name="${_}" value="${k}">`}function lg(v){return v.replace(/@method\(\s*(['"])([^'"]+)\1\s*(?:,\s*(['"])([^'"]+)\3\s*)?\)/g,(_,k,E,T,j)=>Nv(E,j||"_method"))}async function ug(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[^>]*>/,`$&
1959
1959
  <div style="color:red;background:#ffeeee;padding:10px;border:1px solid #ff0000;margin:10px 0;font-family:monospace;white-space:pre-wrap;">${b(V)}</div>
1960
- `)}}}return j}async function lg(v,_,k,E){return cg(v,_,k,E,"before")}async function ug(v,_,k,E){return cg(v,_,k,E,"after")}function dg(v){return v.replace(/@route\(\s*(['"])([^'"]+)\1(?:\s*,\s*(\{[^}]+\}))?\s*(?:,\s*(true|false)\s*)?\)/g,(_,k,E,T,j)=>{try{let B=T?D(T,{}):{};return bn(E,B,j==="true")}catch(B){return console.error(`Error processing @route directive: ${B}`),"#route-error"}})}var Di={patterns:[],exact:{}};async function pg(v,_){let k=v.split("/").pop()?.split(".")[0]||"";if(Di.exact[v])for(let E of Di.exact[v])await Promise.resolve(E(_,v));if(Di.exact[k])for(let E of Di.exact[k])await Promise.resolve(E(_,v));for(let{pattern:E,callback:T}of Di.patterns)if(E.test(v)||E.test(k))await Promise.resolve(T(_,v))}var Mv=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),Ov=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 Dr(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()&&Mv.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 Nv(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 Pr(v,_){if(_.selfClosing)return{outerStart:_.start,outerEnd:_.end,innerHTML:""};let k=Nv(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 fg(v,_){return new RegExp(`(?:^|\\s)${_.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?:=|\\s|$|>|/)`).test(v)||v.includes(` ${_}=`)||v.includes(` ${_} `)||v.trimEnd().endsWith(` ${_}`)}function Mi(v,_){let k=_.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),E=v.match(new RegExp(`${k}="([^"]*)"`,"s"))||v.match(new RegExp(`${k}='([^']*)'`,"s"));return E?E[1]:null}function vr(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 Bs(v,_,k){let E=_.selfClosing?" /":"",T=`<${_.tag}${k}${E}>`;return v.slice(0,_.start)+T+v.slice(_.end)}function jv(v){return/\bv-(?:if|else-if|else|for|show|model|html|text|pre|once|cloak|memo|bind|on|slot)\b/.test(v)}function Lv(v){let _=v,k=0;while(k<_.length){let E=Dr(_,k);if(!E)break;let T=Mi(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((ae)=>ae.trim()),oe=ie[0],de=ie[1];F=`${z} as ${de} => ${oe}`}else F=`${z} as ${B}`;let V=vr(E.attrs,"v-for"),H=vr(V,":key").replace(/\s*v-bind:key="[^"]*"/g,""),G=Pr(_,E),J=_.slice(G.outerStart,G.outerEnd),ne=Bs(J,{...E,start:0,end:E.end-E.start},H),re=`@foreach(${F})
1960
+ `)}}}return j}async function dg(v,_,k,E){return ug(v,_,k,E,"before")}async function pg(v,_,k,E){return ug(v,_,k,E,"after")}function fg(v){return v.replace(/@route\(\s*(['"])([^'"]+)\1(?:\s*,\s*(\{[^}]+\}))?\s*(?:,\s*(true|false)\s*)?\)/g,(_,k,E,T,j)=>{try{let B=T?D(T,{}):{};return bn(E,B,j==="true")}catch(B){return console.error(`Error processing @route directive: ${B}`),"#route-error"}})}var Di={patterns:[],exact:{}};async function gg(v,_){let k=v.split("/").pop()?.split(".")[0]||"";if(Di.exact[v])for(let E of Di.exact[v])await Promise.resolve(E(_,v));if(Di.exact[k])for(let E of Di.exact[k])await Promise.resolve(E(_,v));for(let{pattern:E,callback:T}of Di.patterns)if(E.test(v)||E.test(k))await Promise.resolve(T(_,v))}var jv=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),Lv=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 Dr(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()&&jv.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 Bv(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 Pr(v,_){if(_.selfClosing)return{outerStart:_.start,outerEnd:_.end,innerHTML:""};let k=Bv(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 mg(v,_){return new RegExp(`(?:^|\\s)${_.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?:=|\\s|$|>|/)`).test(v)||v.includes(` ${_}=`)||v.includes(` ${_} `)||v.trimEnd().endsWith(` ${_}`)}function Mi(v,_){let k=_.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),E=v.match(new RegExp(`${k}="([^"]*)"`,"s"))||v.match(new RegExp(`${k}='([^']*)'`,"s"));return E?E[1]:null}function vr(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 Ls(v,_,k){let E=_.selfClosing?" /":"",T=`<${_.tag}${k}${E}>`;return v.slice(0,_.start)+T+v.slice(_.end)}function zv(v){return/\bv-(?:if|else-if|else|for|show|model|html|text|pre|once|cloak|memo|bind|on|slot)\b/.test(v)}function Fv(v){let _=v,k=0;while(k<_.length){let E=Dr(_,k);if(!E)break;let T=Mi(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((ae)=>ae.trim()),oe=ie[0],ue=ie[1];F=`${z} as ${ue} => ${oe}`}else F=`${z} as ${B}`;let V=vr(E.attrs,"v-for"),H=vr(V,":key").replace(/\s*v-bind:key="[^"]*"/g,""),G=Pr(_,E),J=_.slice(G.outerStart,G.outerEnd),ne=Ls(J,{...E,start:0,end:E.end-E.start},H),re=`@foreach(${F})
1961
1961
  `,se=`${re}${ne}
1962
- @endforeach`;_=_.slice(0,G.outerStart)+se+_.slice(G.outerEnd),k=G.outerStart+re.length}return _}function Bv(v){let _=v,k=0;while(k<_.length){let E=Dr(_,k);if(!E)break;let T=Mi(E.attrs,"v-if");if(T===null){k=E.end;continue}let j=[],B=Pr(_,E),z=vr(E.attrs,"v-if"),F=Bs(_.slice(B.outerStart,B.outerEnd),{...E,start:0,end:E.end-E.start},z);j.push({type:"if",expr:T,outerStart:B.outerStart,outerEnd:B.outerEnd,element:F,parsedTag:E});let V=B.outerEnd,H=!0;while(H){let se=_.slice(V).match(/^\s*/),ie=se?se[0].length:0,oe=Dr(_,V+ie);if(!oe){H=!1;break}let de=Mi(oe.attrs,"v-else-if"),ae=fg(oe.attrs,"v-else");if(de!==null){let me=Pr(_,oe),ve=vr(oe.attrs,"v-else-if"),Se=Bs(_.slice(me.outerStart,me.outerEnd),{...oe,start:0,end:oe.end-oe.start},ve);j.push({type:"else-if",expr:de,outerStart:V,outerEnd:me.outerEnd,element:Se,parsedTag:oe}),V=me.outerEnd}else if(ae){let me=Pr(_,oe),ve=vr(oe.attrs,"v-else"),Se=Bs(_.slice(me.outerStart,me.outerEnd),{...oe,start:0,end:oe.end-oe.start},ve);j.push({type:"else",outerStart:V,outerEnd:me.outerEnd,element:Se,parsedTag:oe}),H=!1}else H=!1}let G=[];for(let se of j)if(se.type==="if")G.push(`@if(${se.expr})
1962
+ @endforeach`;_=_.slice(0,G.outerStart)+se+_.slice(G.outerEnd),k=G.outerStart+re.length}return _}function Vv(v){let _=v,k=0;while(k<_.length){let E=Dr(_,k);if(!E)break;let T=Mi(E.attrs,"v-if");if(T===null){k=E.end;continue}let j=[],B=Pr(_,E),z=vr(E.attrs,"v-if"),F=Ls(_.slice(B.outerStart,B.outerEnd),{...E,start:0,end:E.end-E.start},z);j.push({type:"if",expr:T,outerStart:B.outerStart,outerEnd:B.outerEnd,element:F,parsedTag:E});let V=B.outerEnd,H=!0;while(H){let se=_.slice(V).match(/^\s*/),ie=se?se[0].length:0,oe=Dr(_,V+ie);if(!oe){H=!1;break}let ue=Mi(oe.attrs,"v-else-if"),ae=mg(oe.attrs,"v-else");if(ue!==null){let me=Pr(_,oe),ve=vr(oe.attrs,"v-else-if"),Se=Ls(_.slice(me.outerStart,me.outerEnd),{...oe,start:0,end:oe.end-oe.start},ve);j.push({type:"else-if",expr:ue,outerStart:V,outerEnd:me.outerEnd,element:Se,parsedTag:oe}),V=me.outerEnd}else if(ae){let me=Pr(_,oe),ve=vr(oe.attrs,"v-else"),Se=Ls(_.slice(me.outerStart,me.outerEnd),{...oe,start:0,end:oe.end-oe.start},ve);j.push({type:"else",outerStart:V,outerEnd:me.outerEnd,element:Se,parsedTag:oe}),H=!1}else H=!1}let G=[];for(let se of j)if(se.type==="if")G.push(`@if(${se.expr})
1963
1963
  ${se.element}`);else if(se.type==="else-if")G.push(`@elseif(${se.expr})
1964
1964
  ${se.element}`);else G.push(`@else
1965
1965
  ${se.element}`);G.push("@endif");let J=G.join(`
1966
- `),ne=j[0].outerStart,re=j[j.length-1].outerEnd;_=_.slice(0,ne)+J+_.slice(re),k=ne+J.length}return _}function zv(v){return v.replace(/\bv-show="([^"]*)"/g,'@show="$1"')}function Fv(v){let _=v,k=0;while(k<_.length){let E=Dr(_,k);if(!E)break;let T=Ov.has(E.tag),j=E.attrs.replace(/([^\s=]+)(?:\s*=\s*("[^"]*"|'[^']*'|[^\s]+))?/g,(z,F,V)=>{let H=/^v-model(?::([a-zA-Z_][a-zA-Z0-9_]*))?((?:\.[a-zA-Z]+)*)$/.exec(F);if(!H||!V||!/^["']/.test(V))return z;let G=H[1]||"modelValue",J=H[2];if(T&&!H[1])return`@model${J}=${V}`;let ne=V[0],re=V.slice(1,-1),se=`:${G}=${V} @update:${G}=${ne}${re} = $event${ne}`;if(J){let ie=H[1]?`${G}Modifiers`:"modelModifiers",oe=J.slice(1).split(".").map((de)=>`${de}: true`).join(", ");se+=` :${ie}="{ ${oe} }"`}return se});if(j===E.attrs){k=E.end;continue}let B=Bs(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 Vv(v){return v.replace(/\bv-bind:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,'@bind:$1="$2"')}function Wv(v){return v.replace(/\bv-on:([a-zA-Z_][a-zA-Z0-9_.-]*)\s*=\s*"([^"]*)"/g,'@$1="$2"')}function Uv(v){let _=v,k=0;while(k<_.length){let E=Dr(_,k);if(!E)break;let T=Mi(E.attrs,"v-html");if(T===null){k=E.end;continue}if(E.selfClosing){k=E.end;continue}let j=Pr(_,E),B=vr(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 Hv(v){let _=v,k=0;while(k<_.length){let E=Dr(_,k);if(!E)break;let T=Mi(E.attrs,"v-text");if(T===null){k=E.end;continue}if(E.selfClosing){k=E.end;continue}let j=Pr(_,E),B=vr(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 qv(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 Kv(v){let _=v,k=0;while(k<_.length){let E=Dr(_,k);if(!E)break;if(!fg(E.attrs,"v-once")){k=E.end;continue}let T=vr(E.attrs,"v-once"),j=Pr(_,E),B=_.slice(j.outerStart,j.outerEnd),F=`@once
1967
- ${Bs(B,{...E,start:0,end:E.end-E.start},T)}
1968
- @endonce`;_=_.slice(0,j.outerStart)+F+_.slice(j.outerEnd),k=j.outerStart+F.length}return _}function Xv(v){return v.replace(/\bv-memo="([^"]*)"/g,'data-stx-memo="$1"')}function Zv(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 gg(v){if(!jv(v))return v;let _=v;return _=Lv(_),_=Bv(_),_=Kv(_),_=Vv(_),_=Wv(_),_=Fv(_),_=zv(_),_=Zv(_),_=Uv(_),_=Hv(_),_=qv(_),_=Xv(_),_}function Ao(v){return v.replace(/--/g,"- -").replace(/</g,"&lt;").replace(/>/g,"&gt;")}var wl=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"]),Gv=new Set(["area","base","br","col","embed","hr","img","input","link","meta","source","track","wbr"]);function mg(v,_){let k=/^\s*\{\{\s*([\s\S]+?)\s*\}\}\s*$/.exec(v),E=k?k[1]:v,T=c(E,_);if(T&&typeof T==="string")return T;let j=E.trim();return wl.has(j)?j:null}function hg(v){let _=/^\s*\{\{\s*([\s\S]+?)\s*\}\}\s*$/.exec(v);return _?_[1]:v}function yg(v,_,k){let E=_.replace(/\s*(?::is|v-bind:is)\s*=\s*"[^"]*"/gi,"").trim(),T=E?`<${v} ${E}>`:`<${v}>`;if(Gv.has(v))return E?`<${v} ${E}>`:`<${v}>`;return`${T}${k}</${v}>`}async function xg(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 H=z[V];try{let G=mg(H.expr,_);if(!G||typeof G!=="string"){let de=`<!-- dynamic component: could not resolve "${Ao(hg(H.expr))}" -->`;j=j.slice(0,H.index)+de+j.slice(H.index+H.full.length);continue}if(wl.has(G)){let de=yg(G,H.attrs,H.slotContent);j=j.slice(0,H.index)+de+j.slice(H.index+H.full.length);continue}let J=H.attrs.trim(),ne={},re=/(?::([a-zA-Z_][a-zA-Z0-9_-]*)|([a-zA-Z_][a-zA-Z0-9_-]*))\s*=\s*"([^"]*)"/g,se;while((se=re.exec(J))!==null){let de=se[1]||se[2],ae=se[3];if(se[1])try{ne[de]=c(ae,_)}catch{ne[de]=ae}else ne[de]=ae}let ie=E.componentsDir||"components",oe=await We(G,ne,H.slotContent,ie,_,k,E,new Set,T??new Set);j=j.slice(0,H.index)+oe+j.slice(H.index+H.full.length)}catch(G){let J=G instanceof Error?G.message:String(G),ne=`<!-- dynamic component error: ${Ao(J)} -->`;j=j.slice(0,H.index)+ne+j.slice(H.index+H.full.length)}}return j=await Jv(j,_,k,E,T),j}async function Jv(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 H=z[V];try{let G=mg(H.expr,_);if(!G||typeof G!=="string"){let re=`<!-- dynamic component: could not resolve "${Ao(hg(H.expr))}" -->`;j=j.slice(0,H.index)+re+j.slice(H.index+H.full.length);continue}if(wl.has(G)){let re=yg(G,H.attrs,"");j=j.slice(0,H.index)+re+j.slice(H.index+H.full.length);continue}let J=E.componentsDir||"components",ne=await We(G,{},"",J,_,k,E,new Set,T??new Set);j=j.slice(0,H.index)+ne+j.slice(H.index+H.full.length)}catch(G){let J=G instanceof Error?G.message:String(G),ne=`<!-- dynamic component error: ${Ao(J)} -->`;j=j.slice(0,H.index)+ne+j.slice(H.index+H.full.length)}}return j}function Sl(){return{afterOpen:[],beforeClose:[]}}function Yv(v){return v.afterOpen.length>0||v.beforeClose.length>0}function vg(v,_){if(!Yv(_))return v;let k=_.afterOpen.join(""),E=_.beforeClose.join(""),T=v.lastIndexOf("</head>"),j=k?Oi(v):null,B=E&&T!==-1?T:null;if(j===null&&B===null)return v;if(j!==null&&B!==null)return`${v.slice(0,j)}${k}${v.slice(j,B)}${E}${v.slice(B)}`;if(j!==null)return`${v.slice(0,j)}${k}${v.slice(j)}`;return`${v.slice(0,B)}${E}${v.slice(B)}`}var bg=/\s*<meta\b[^>]*\bcharset\b[^>]*>/iy;function Oi(v){let _=/<head\b[^>]*>/i.exec(v);if(!_)return null;let k=_.index+_[0].length;bg.lastIndex=k;let E=bg.exec(v);return E?k+E[0].length:k}var _l="data-stx-color-mode-boot",Qv="__STX_COLOR_MODE__",ew=new Set(["light","dark","auto","system"]),tw=new Set(["auto","system"]),nw=/^[a-z][\w:-]*$/i,rw=/^[\w-]+$/;function sw(v){let _=v.storageKey??"stx-color-mode",k=v.initialMode??"auto",E=v.darkClass===void 0?"dark":v.darkClass,T=v.attribute??null,j=v.autoValue??null,B=v.respectExisting===!0;if(typeof _!=="string"||_.length===0)throw Error("colorMode.storageKey must be a non-empty string");if(!ew.has(k))throw Error(`colorMode.initialMode must be one of light, dark, auto, system \u2014 got ${JSON.stringify(k)}`);if(E!==null&&(typeof E!=="string"||!rw.test(E)))throw Error(`colorMode.darkClass must be a single CSS class name, or null to opt out \u2014 got ${JSON.stringify(E)}`);if(T!==null&&(typeof T!=="string"||!nw.test(T)))throw Error(`colorMode.attribute must be a valid HTML attribute name \u2014 got ${JSON.stringify(T)}`);if(j!==null&&!tw.has(j))throw Error(`colorMode.autoValue must be 'auto' or 'system' \u2014 got ${JSON.stringify(j)}`);if(E===null&&T===null)throw Error("colorMode needs at least one of darkClass or attribute \u2014 with both null nothing would mark the mode on <html>");if(B&&T===null)throw Error("colorMode.respectExisting needs an attribute to read \u2014 the dark class alone cannot say whether a mode was chosen");return{storageKey:_,initialMode:k==="system"?"auto":k,darkClass:E,attribute:T,autoValue:j,respectExisting:B}}function iw(v){return JSON.stringify(v).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function kl(v={}){let _=sw(v),E=`(function(){"use strict";var c=${iw(_)};var p=c.initialMode;var a=c.autoValue;try{var v=localStorage.getItem(c.storageKey);if(v==="light"||v==="dark"){p=v}else if(v==="auto"||v==="system"){p="auto";if(!a)a=v}}catch(e){}var r=document.documentElement;var f=null;if(c.respectExisting&&c.attribute){var x=r.getAttribute(c.attribute);if(x==="light"||x==="dark")f=x}var m=f;if(!m){m=p;if(p==="auto"){try{m=matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}catch(e){m="light"}}}if(c.attribute)r.setAttribute(c.attribute,m);if(c.darkClass){if(m==="dark")r.classList.add(c.darkClass);else r.classList.remove(c.darkClass)}try{window.${Qv}={storageKey:c.storageKey,initialMode:c.initialMode,darkClass:c.darkClass,attribute:c.attribute,autoValue:a||"auto",respectExisting:c.respectExisting,forced:f,preference:p,mode:m}}catch(e){}}());`;return`<script ${_l}>${E}</script>`}function Vn(v,_={}){if(v.includes(_l))return v;let k=$l(v);if(k===null)return v;let E=kl(_);return`${v.slice(0,k)}
1969
- ${E}${v.slice(k)}`}var $l=Oi,ow=new RegExp(`<script\\b[^>]*\\b${_l}\\b[^>]*>[\\s\\S]*?<\\/script>`,"i"),wg=/<meta\b[^>]*\bcharset\b[^>]*>/gi,Sg=/<\/head>/gi;function aw(v){let _=/<head\b[^>]*>/i.exec(v);if(!_)return v;let k=_.index+_[0].length;Sg.lastIndex=k;let E=Sg.exec(v),T=E?E.index:v.length;wg.lastIndex=k;let j=wg.exec(v);if(!j||j.index>=T)return v;if(v.slice(k,j.index).trim()==="")return v;let B=j.index+j[0].length;return`${v.slice(0,k)}
1970
- ${j[0]}${v.slice(k,j.index)}${v.slice(B,T)}${v.slice(T)}`}function $g(v){return cw(aw(v))}function cw(v){let _=ow.exec(v);if(!_)return v;let k=$l(v);if(k===null)return v;if(_.index<=k||v.slice(k,_.index).trim()==="")return v;let E=v.slice(0,_.index)+v.slice(_.index+_[0].length),T=$l(E);if(T===null)return v;return`${E.slice(0,T)}
1971
- ${_[0]}${E.slice(T)}`}var ci="X-STX-Build",El=Symbol.for("stx.buildId");function hs(){let v=globalThis;if(!v[El])v[El]=process.env.STX_BUILD_ID||`${Date.now().toString(36)}${Math.random().toString(36).slice(2,8)}`;return v[El]}function _g(v,_=hs()){if(v.includes('name="stx-build"'))return null;if(!/<head\b[^>]*>/i.test(v))return null;return`
1972
- <meta name="stx-build" content="${_}">`}function lw(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,registration:()=>E,onUpdateReady(H){if(B.updateReady)try{H()}catch{}else j.push(H);return()=>{let G=j.indexOf(H);if(G!==-1)j.splice(G,1)}},applyUpdate(){let H=E&&E.waiting;if(!H)return!1;return T=!0,H.postMessage({type:"stx:activate-update",force:!0}),!0}};k.stxOffline=B;let z=(H)=>{if(!H.waiting||!_.controller||B.updateReady)return;B.updateReady=!0;let G=j.splice(0);for(let J of G)try{J()}catch{}try{window.dispatchEvent(new CustomEvent("stx:offline-update-ready"))}catch{}};_.addEventListener("message",(H)=>{let G=H.data||{};if(G.type==="stx:updated")try{window.dispatchEvent(new CustomEvent("stx:updated",{detail:{url:G.url,kind:G.kind,fragment:!!G.fragment}}))}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((H)=>{if(E=H,H.waiting)z(H),H.waiting.postMessage({type:"stx:activate-update",reason:"load"});H.addEventListener("updatefound",()=>{let G=H.installing;if(!G)return;G.addEventListener("statechange",()=>{if(G.state==="installed")z(H)})})}).catch(()=>{})},V=()=>{let H=(G)=>{setTimeout(G,0)};if(typeof requestAnimationFrame==="function")requestAnimationFrame(()=>H(F));else H(F)};if(!_.controller)if(document.readyState==="complete")V();else addEventListener("load",V);else if(document.readyState==="loading")document.addEventListener("DOMContentLoaded",V);else V()}function uw(){let v=`(${lw.toString()})(${JSON.stringify("/_stx/sw.js")})`;try{return new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync(v).trim().replace(/;$/,"")}catch{return v}}var kg=`<script data-stx-offline>${uw()}</script>`;import{AsyncLocalStorage as dw}from"async_hooks";var Eg=new dw;function sn(v){return v.__stx_server_data??={pending:new Map,values:new Map}}function Cg(v,_){return Eg.run(sn(v),_)}async function Rg(v,_){let k=Eg.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 Hn(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>`}var Ig="<style data-stx-cloak>[x-cloak]{display:none !important}</style>",Io="data-stx-html-attrs",Po="data-stx-html-class",Pg=/^[A-Za-z_:][\w:.-]*$/;function cr(v){return String(v).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function pw(v){return String(v).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function wr(v){if(v.name)return`name="${v.name}"`;if(v.property)return`property="${v.property}"`;if(v.charset!=null)return"charset=";if(v["http-equiv"])return`http-equiv="${v["http-equiv"]}"`;return""}function fw(v){let _=/^\s*<meta\b([^>]*)>/i.exec(v);if(!_)return null;let k={};for(let E of _[1].matchAll(/([\w:-]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'>]+)))?/g))k[E[1].toLowerCase()]=E[2]??E[3]??E[4]??"";return k}function zs(v,_){return Object.entries(v).filter(([k])=>!_?.(k)).map(([k,E])=>`${k}="${cr(String(E))}"`).join(" ")}function gw(v={},_="en"){let k=[],E=[],T="",j=_;for(let[z,F]of Object.entries(v||{})){if(F==null)continue;let V=z.trim();if(!Pg.test(V))continue;let H=V.toLowerCase();if(H==="lang"){j=String(F);continue}if(H==="class"){T=String(F).trim();continue}k.push(` ${V}="${cr(String(F))}"`),E.push(V)}let B=` lang="${cr(j)}"`;if(T)B+=` class="${cr(T)}"`;if(B+=k.join(""),T)B+=` ${Po}="${cr(T)}"`;if(E.length)B+=` ${Io}="${cr(E.join(" "))}"`;return B}function Dg(v={},_={}){let k={...v,..._};if(v.class&&_.class){let E=v.class.split(/\s+/).filter(Boolean);for(let T of _.class.split(/\s+/).filter(Boolean))if(!E.includes(T))E.push(T);k.class=E.join(" ")}return k}function Un(v,_={}){if(!_||Object.keys(_).length===0)return v;let k=v.match(/<html\b([^>]*)>/i);if(!k)return v;let E={},T=[],j=/([A-Za-z_:][\w:.-]*)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'>]+)))?/g,B;while((B=j.exec(k[1]))!==null){let H=B[1];if(!(H in E))T.push(H);E[H]=B[2]??B[3]??B[4]??""}let z=[],F=[];for(let[H,G]of Object.entries(_)){if(G==null)continue;let J=H.trim();if(!Pg.test(J))continue;let ne=J.toLowerCase();if(ne==="class"){let re=(E.class||"").split(/\s+/).filter(Boolean);for(let se of String(G).split(/\s+/).filter(Boolean))if(!re.includes(se))re.push(se),z.push(se);if(!("class"in E))T.push("class");E.class=re.join(" ");continue}if(!(J in E))T.push(J);if(E[J]=String(G),ne!=="lang")F.push(J)}if(z.length){if(!(Po in E))T.push(Po);E[Po]=z.join(" ")}if(F.length){if(!(Io in E))T.push(Io);E[Io]=F.join(" ")}let V=T.map((H)=>` ${H}="${cr(E[H])}"`).join("");return v.replace(k[0],()=>`<html${V}>`)}function Mg(v){if(v.includes("data-stx-cloak"))return null;if(v.lastIndexOf("</head>")===-1)return null;return`${Ig}
1973
- `}function mw(v){let _=[],k=0;while(k<v.length){let j=v.slice(k),B=j.match(/^\s+/);if(B){k+=B[0].length;continue}if(j.startsWith("<!--")){let G=v.indexOf("-->",k);if(G===-1)break;k=G+3;continue}let z=j.match(/^<script\b[^>]*>/i);if(z){let G=v.toLowerCase().indexOf("</script>",k+z[0].length);if(G===-1)break;k=G+9;continue}let F=j.match(/^<link\b[^>]*>/i);if(F){_.push(F[0]),k+=F[0].length;continue}let V=j.match(/^<meta\b[^>]*>/i);if(V){_.push(V[0]),k+=V[0].length;continue}let H=j.match(/^<style\b[^>]*>[\s\S]*?<\/style>/i);if(H){_.push(H[0]),k+=H[0].length;continue}break}if(_.length===0)return{body:v,hoisted:_};let E="",T=0;while(T<v.length&&T<k){let j=v.slice(T),B=j.match(/^<link\b[^>]*>/i);if(B&&_.includes(B[0])){T+=B[0].length;continue}let z=j.match(/^<meta\b[^>]*>/i);if(z&&_.includes(z[0])){T+=z[0].length;continue}let F=j.match(/^<style\b[^>]*>[\s\S]*?<\/style>/i);if(F&&_.includes(F[0])){T+=F[0].length;continue}E+=v[T],T++}return E+=v.slice(k),{body:E,hoisted:_}}function hw(v,_={},k={}){let{title:E="stx App",lang:T="en",meta:j=[],link:B=[],script:z=[],headRaw:F="",htmlAttrs:V={},bodyClass:H="",bodyAttrs:G={}}=_,J=k.title||E,ne=[{charset:"UTF-8"},{name:"viewport",content:"width=device-width, initial-scale=1.0"}],re=new Set(j.map(wr).filter(Boolean)),{body:se,hoisted:ie}=mw(v),oe=new Set(ie.flatMap((Re)=>{let _e=fw(Re);return _e?[wr(_e)].filter(Boolean):[]})),ae=[...ne.filter((Re)=>!re.has(wr(Re))),...j].filter((Re)=>!oe.has(wr(Re))).map((Re)=>` <meta ${zs(Re)}>`).join(`
1974
- `),me=B.map((Re)=>` <link ${zs(Re)}>`).join(`
1975
- `),ve=z.map((Re)=>{if(Re.src)return` <script ${zs(Re,(_e)=>_e==="content")}></script>`;if(Re.content)return` <script>${Re.content}</script>`;return""}).filter(Boolean).join(`
1976
- `),Se=gw(V,T),$e=Object.entries(G).map(([Re,_e])=>` ${Re}="${cr(String(_e))}"`).join(""),Ce=H?` class="${cr(H)}"`:"",Ee=[ae,k.colorMode?` ${kl(k.colorMode)}`:"",` <title>${k.titleIsHtml?J:pw(J)}</title>`,` ${Ig}`,me,ve,F?` ${F}`:"",...(k.styles||[]).map((Re)=>` ${Re}`),...ie.map((Re)=>` ${Re}`),...(k.headScripts||[]).map((Re)=>` ${Re}`),k.headStack||""].filter(Boolean),Te=[se,...(k.bodyScripts||[]).map((Re)=>Re),k.bodyStack||""].filter(Boolean);return`<!DOCTYPE html>
1966
+ `),ne=j[0].outerStart,re=j[j.length-1].outerEnd;_=_.slice(0,ne)+J+_.slice(re),k=ne+J.length}return _}function Wv(v){return v.replace(/\bv-show="([^"]*)"/g,'@show="$1"')}function Uv(v){let _=v,k=0;while(k<_.length){let E=Dr(_,k);if(!E)break;let T=Lv.has(E.tag),j=E.attrs.replace(/([^\s=]+)(?:\s*=\s*("[^"]*"|'[^']*'|[^\s]+))?/g,(z,F,V)=>{let H=/^v-model(?::([a-zA-Z_][a-zA-Z0-9_]*))?((?:\.[a-zA-Z]+)*)$/.exec(F);if(!H||!V||!/^["']/.test(V))return z;let G=H[1]||"modelValue",J=H[2];if(T&&!H[1])return`@model${J}=${V}`;let ne=V[0],re=V.slice(1,-1),se=`:${G}=${V} @update:${G}=${ne}${re} = $event${ne}`;if(J){let ie=H[1]?`${G}Modifiers`:"modelModifiers",oe=J.slice(1).split(".").map((ue)=>`${ue}: true`).join(", ");se+=` :${ie}="{ ${oe} }"`}return se});if(j===E.attrs){k=E.end;continue}let B=Ls(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 Hv(v){return v.replace(/\bv-bind:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,'@bind:$1="$2"')}function qv(v){return v.replace(/\bv-on:([a-zA-Z_][a-zA-Z0-9_.-]*)\s*=\s*"([^"]*)"/g,'@$1="$2"')}function Kv(v){let _=v,k=0;while(k<_.length){let E=Dr(_,k);if(!E)break;let T=Mi(E.attrs,"v-html");if(T===null){k=E.end;continue}if(E.selfClosing){k=E.end;continue}let j=Pr(_,E),B=vr(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 Xv(v){let _=v,k=0;while(k<_.length){let E=Dr(_,k);if(!E)break;let T=Mi(E.attrs,"v-text");if(T===null){k=E.end;continue}if(E.selfClosing){k=E.end;continue}let j=Pr(_,E),B=vr(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 Zv(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 Gv(v){let _=v,k=0;while(k<_.length){let E=Dr(_,k);if(!E)break;if(!mg(E.attrs,"v-once")){k=E.end;continue}let T=vr(E.attrs,"v-once"),j=Pr(_,E),B=_.slice(j.outerStart,j.outerEnd),F=`@once
1967
+ ${Ls(B,{...E,start:0,end:E.end-E.start},T)}
1968
+ @endonce`;_=_.slice(0,j.outerStart)+F+_.slice(j.outerEnd),k=j.outerStart+F.length}return _}function Jv(v){return v.replace(/\bv-memo="([^"]*)"/g,'data-stx-memo="$1"')}function Yv(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 hg(v){if(!zv(v))return v;let _=v;return _=Fv(_),_=Vv(_),_=Gv(_),_=Hv(_),_=qv(_),_=Uv(_),_=Wv(_),_=Yv(_),_=Kv(_),_=Xv(_),_=Zv(_),_=Jv(_),_}function Io(v){return v.replace(/--/g,"- -").replace(/</g,"&lt;").replace(/>/g,"&gt;")}var Sl=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"]),Qv=new Set(["area","base","br","col","embed","hr","img","input","link","meta","source","track","wbr"]);function yg(v,_){let k=/^\s*\{\{\s*([\s\S]+?)\s*\}\}\s*$/.exec(v),E=k?k[1]:v,T=c(E,_);if(T&&typeof T==="string")return T;let j=E.trim();return Sl.has(j)?j:null}function xg(v){let _=/^\s*\{\{\s*([\s\S]+?)\s*\}\}\s*$/.exec(v);return _?_[1]:v}function bg(v,_,k){let E=_.replace(/\s*(?::is|v-bind:is)\s*=\s*"[^"]*"/gi,"").trim(),T=E?`<${v} ${E}>`:`<${v}>`;if(Qv.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 H=z[V];try{let G=yg(H.expr,_);if(!G||typeof G!=="string"){let ue=`<!-- dynamic component: could not resolve "${Io(xg(H.expr))}" -->`;j=j.slice(0,H.index)+ue+j.slice(H.index+H.full.length);continue}if(Sl.has(G)){let ue=bg(G,H.attrs,H.slotContent);j=j.slice(0,H.index)+ue+j.slice(H.index+H.full.length);continue}let J=H.attrs.trim(),ne={},re=/(?::([a-zA-Z_][a-zA-Z0-9_-]*)|([a-zA-Z_][a-zA-Z0-9_-]*))\s*=\s*"([^"]*)"/g,se;while((se=re.exec(J))!==null){let ue=se[1]||se[2],ae=se[3];if(se[1])try{ne[ue]=c(ae,_)}catch{ne[ue]=ae}else ne[ue]=ae}let ie=E.componentsDir||"components",oe=await We(G,ne,H.slotContent,ie,_,k,E,new Set,T??new Set);j=j.slice(0,H.index)+oe+j.slice(H.index+H.full.length)}catch(G){let J=G instanceof Error?G.message:String(G),ne=`<!-- dynamic component error: ${Io(J)} -->`;j=j.slice(0,H.index)+ne+j.slice(H.index+H.full.length)}}return j=await ew(j,_,k,E,T),j}async function ew(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 H=z[V];try{let G=yg(H.expr,_);if(!G||typeof G!=="string"){let re=`<!-- dynamic component: could not resolve "${Io(xg(H.expr))}" -->`;j=j.slice(0,H.index)+re+j.slice(H.index+H.full.length);continue}if(Sl.has(G)){let re=bg(G,H.attrs,"");j=j.slice(0,H.index)+re+j.slice(H.index+H.full.length);continue}let J=E.componentsDir||"components",ne=await We(G,{},"",J,_,k,E,new Set,T??new Set);j=j.slice(0,H.index)+ne+j.slice(H.index+H.full.length)}catch(G){let J=G instanceof Error?G.message:String(G),ne=`<!-- dynamic component error: ${Io(J)} -->`;j=j.slice(0,H.index)+ne+j.slice(H.index+H.full.length)}}return j}function $l(){return{afterOpen:[],beforeClose:[]}}function tw(v){return v.afterOpen.length>0||v.beforeClose.length>0}function Sg(v,_){if(!tw(_))return v;let k=_.afterOpen.join(""),E=_.beforeClose.join(""),T=v.lastIndexOf("</head>"),j=k?Oi(v):null,B=E&&T!==-1?T:null;if(j===null&&B===null)return v;if(j!==null&&B!==null)return`${v.slice(0,j)}${k}${v.slice(j,B)}${E}${v.slice(B)}`;if(j!==null)return`${v.slice(0,j)}${k}${v.slice(j)}`;return`${v.slice(0,B)}${E}${v.slice(B)}`}var wg=/\s*<meta\b[^>]*\bcharset\b[^>]*>/iy;function Oi(v){let _=/<head\b[^>]*>/i.exec(v);if(!_)return null;let k=_.index+_[0].length;wg.lastIndex=k;let E=wg.exec(v);return E?k+E[0].length:k}var kl="data-stx-color-mode-boot",$g="__STX_COLOR_MODE__",nw=new Set(["light","dark","auto","system"]),rw=new Set(["auto","system"]),sw=/^[a-z][\w:-]*$/i,iw=/^[\w-]+$/;function ow(v){let _=v.storageKey??"stx-color-mode",k=v.initialMode??"auto",E=v.darkClass===void 0?"dark":v.darkClass,T=v.attribute??null,j=v.autoValue??null,B=v.respectExisting===!0;if(typeof _!=="string"||_.length===0)throw Error("colorMode.storageKey must be a non-empty string");if(!nw.has(k))throw Error(`colorMode.initialMode must be one of light, dark, auto, system \u2014 got ${JSON.stringify(k)}`);if(E!==null&&(typeof E!=="string"||!iw.test(E)))throw Error(`colorMode.darkClass must be a single CSS class name, or null to opt out \u2014 got ${JSON.stringify(E)}`);if(T!==null&&(typeof T!=="string"||!sw.test(T)))throw Error(`colorMode.attribute must be a valid HTML attribute name \u2014 got ${JSON.stringify(T)}`);if(j!==null&&!rw.has(j))throw Error(`colorMode.autoValue must be 'auto' or 'system' \u2014 got ${JSON.stringify(j)}`);if(E===null&&T===null)throw Error("colorMode needs at least one of darkClass or attribute \u2014 with both null nothing would mark the mode on <html>");if(B&&T===null)throw Error("colorMode.respectExisting needs an attribute to read \u2014 the dark class alone cannot say whether a mode was chosen");return{storageKey:_,initialMode:k==="system"?"auto":k,darkClass:E,attribute:T,autoValue:j,respectExisting:B}}function aw(v){return JSON.stringify(v).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function El(v={}){let _=ow(v),k=aw(_),E=`(function(){"use strict";var o=window.${$g};if(o&&typeof o.sync==="function"){o.sync();return}var c=${k};var r=document.documentElement;function read(){var p=c.initialMode,a=c.autoValue;try{var v=localStorage.getItem(c.storageKey);if(v==="light"||v==="dark"){p=v}else if(v==="auto"||v==="system"){p="auto";if(!a)a=v}}catch(e){}return{p:p,a:a}}function sys(){try{return matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}catch(e){return"light"}}function stamp(m){if(c.attribute)r.setAttribute(c.attribute,m);if(c.darkClass){if(m==="dark")r.classList.add(c.darkClass);else r.classList.remove(c.darkClass)}}var s=read();var f=null;if(c.respectExisting&&c.attribute){var x=r.getAttribute(c.attribute);if(x==="light"||x==="dark")f=x}var m=f||(s.p==="auto"?sys():s.p);var p=s.p;stamp(m);var g=null;function sync(){var t=read(),n=f||(t.p==="auto"?sys():t.p);var moved=n!==m,chose=t.p!==p;if(moved){r.style.setProperty("transition","none","important");stamp(n);void r.offsetHeight;r.style.removeProperty("transition")}else stamp(n);m=n;p=t.p;if(g){g.mode=n;g.preference=t.p;if(t.a)g.autoValue=t.a}if(moved||chose){try{window.dispatchEvent(new CustomEvent("stx:color-mode",{detail:{mode:n,preference:t.p}}))}catch(e){}}}try{g=window.${$g}={storageKey:c.storageKey,initialMode:c.initialMode,darkClass:c.darkClass,attribute:c.attribute,autoValue:s.a||"auto",respectExisting:c.respectExisting,forced:f,preference:p,mode:m,watching:true,sync:sync}}catch(e){}try{var q=matchMedia("(prefers-color-scheme: dark)");if(q.addEventListener)q.addEventListener("change",sync);else if(q.addListener)q.addListener(sync)}catch(e){}try{addEventListener("pageshow",sync);addEventListener("storage",function(e){if(e.key===null||e.key===c.storageKey)sync()});document.addEventListener("visibilitychange",function(){if(document.visibilityState==="visible")sync()})}catch(e){}}());`;return`<script ${kl}>${E}</script>`}function Vn(v,_={}){if(v.includes(kl))return v;let k=_l(v);if(k===null)return v;let E=El(_);return`${v.slice(0,k)}
1969
+ ${E}${v.slice(k)}`}var _l=Oi,cw=new RegExp(`<script\\b[^>]*\\b${kl}\\b[^>]*>[\\s\\S]*?<\\/script>`,"i"),_g=/<meta\b[^>]*\bcharset\b[^>]*>/gi,kg=/<\/head>/gi;function lw(v){let _=/<head\b[^>]*>/i.exec(v);if(!_)return v;let k=_.index+_[0].length;kg.lastIndex=k;let E=kg.exec(v),T=E?E.index:v.length;_g.lastIndex=k;let j=_g.exec(v);if(!j||j.index>=T)return v;if(v.slice(k,j.index).trim()==="")return v;let B=j.index+j[0].length;return`${v.slice(0,k)}
1970
+ ${j[0]}${v.slice(k,j.index)}${v.slice(B,T)}${v.slice(T)}`}function Eg(v){return uw(lw(v))}function uw(v){let _=cw.exec(v);if(!_)return v;let k=_l(v);if(k===null)return v;if(_.index<=k||v.slice(k,_.index).trim()==="")return v;let E=v.slice(0,_.index)+v.slice(_.index+_[0].length),T=_l(E);if(T===null)return v;return`${E.slice(0,T)}
1971
+ ${_[0]}${E.slice(T)}`}var ci="X-STX-Build",Cl=Symbol.for("stx.buildId");function hs(){let v=globalThis;if(!v[Cl])v[Cl]=process.env.STX_BUILD_ID||`${Date.now().toString(36)}${Math.random().toString(36).slice(2,8)}`;return v[Cl]}function Cg(v,_=hs()){if(v.includes('name="stx-build"'))return null;if(!/<head\b[^>]*>/i.test(v))return null;return`
1972
+ <meta name="stx-build" content="${_}">`}function dw(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,registration:()=>E,onUpdateReady(H){if(B.updateReady)try{H()}catch{}else j.push(H);return()=>{let G=j.indexOf(H);if(G!==-1)j.splice(G,1)}},applyUpdate(){let H=E&&E.waiting;if(!H)return!1;return T=!0,H.postMessage({type:"stx:activate-update",force:!0}),!0}};k.stxOffline=B;let z=(H)=>{if(!H.waiting||!_.controller||B.updateReady)return;B.updateReady=!0;let G=j.splice(0);for(let J of G)try{J()}catch{}try{window.dispatchEvent(new CustomEvent("stx:offline-update-ready"))}catch{}};_.addEventListener("message",(H)=>{let G=H.data||{};if(G.type==="stx:updated")try{window.dispatchEvent(new CustomEvent("stx:updated",{detail:{url:G.url,kind:G.kind,fragment:!!G.fragment}}))}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((H)=>{if(E=H,H.waiting)z(H),H.waiting.postMessage({type:"stx:activate-update",reason:"load"});H.addEventListener("updatefound",()=>{let G=H.installing;if(!G)return;G.addEventListener("statechange",()=>{if(G.state==="installed")z(H)})})}).catch(()=>{})},V=()=>{let H=(G)=>{setTimeout(G,0)};if(typeof requestAnimationFrame==="function")requestAnimationFrame(()=>H(F));else H(F)};if(!_.controller)if(document.readyState==="complete")V();else addEventListener("load",V);else if(document.readyState==="loading")document.addEventListener("DOMContentLoaded",V);else V()}function pw(){let v=`(${dw.toString()})(${JSON.stringify("/_stx/sw.js")})`;try{return new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync(v).trim().replace(/;$/,"")}catch{return v}}var Rg=`<script data-stx-offline>${pw()}</script>`;import{AsyncLocalStorage as fw}from"async_hooks";var Tg=new fw;function sn(v){return v.__stx_server_data??={pending:new Map,values:new Map}}function Ag(v,_){return Tg.run(sn(v),_)}async function Ig(v,_){let k=Tg.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 Hn(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>`}var Mg="<style data-stx-cloak>[x-cloak]{display:none !important}</style>",Po="data-stx-html-attrs",Do="data-stx-html-class",Og=/^[A-Za-z_:][\w:.-]*$/;function cr(v){return String(v).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function gw(v){return String(v).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function wr(v){if(v.name)return`name="${v.name}"`;if(v.property)return`property="${v.property}"`;if(v.charset!=null)return"charset=";if(v["http-equiv"])return`http-equiv="${v["http-equiv"]}"`;return""}function mw(v){let _=/^\s*<meta\b([^>]*)>/i.exec(v);if(!_)return null;let k={};for(let E of _[1].matchAll(/([\w:-]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'>]+)))?/g))k[E[1].toLowerCase()]=E[2]??E[3]??E[4]??"";return k}function Bs(v,_){return Object.entries(v).filter(([k])=>!_?.(k)).map(([k,E])=>`${k}="${cr(String(E))}"`).join(" ")}function hw(v={},_="en"){let k=[],E=[],T="",j=_;for(let[z,F]of Object.entries(v||{})){if(F==null)continue;let V=z.trim();if(!Og.test(V))continue;let H=V.toLowerCase();if(H==="lang"){j=String(F);continue}if(H==="class"){T=String(F).trim();continue}k.push(` ${V}="${cr(String(F))}"`),E.push(V)}let B=` lang="${cr(j)}"`;if(T)B+=` class="${cr(T)}"`;if(B+=k.join(""),T)B+=` ${Do}="${cr(T)}"`;if(E.length)B+=` ${Po}="${cr(E.join(" "))}"`;return B}function Ng(v={},_={}){let k={...v,..._};if(v.class&&_.class){let E=v.class.split(/\s+/).filter(Boolean);for(let T of _.class.split(/\s+/).filter(Boolean))if(!E.includes(T))E.push(T);k.class=E.join(" ")}return k}function Un(v,_={}){if(!_||Object.keys(_).length===0)return v;let k=v.match(/<html\b([^>]*)>/i);if(!k)return v;let E={},T=[],j=/([A-Za-z_:][\w:.-]*)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'>]+)))?/g,B;while((B=j.exec(k[1]))!==null){let H=B[1];if(!(H in E))T.push(H);E[H]=B[2]??B[3]??B[4]??""}let z=[],F=[];for(let[H,G]of Object.entries(_)){if(G==null)continue;let J=H.trim();if(!Og.test(J))continue;let ne=J.toLowerCase();if(ne==="class"){let re=(E.class||"").split(/\s+/).filter(Boolean);for(let se of String(G).split(/\s+/).filter(Boolean))if(!re.includes(se))re.push(se),z.push(se);if(!("class"in E))T.push("class");E.class=re.join(" ");continue}if(!(J in E))T.push(J);if(E[J]=String(G),ne!=="lang")F.push(J)}if(z.length){if(!(Do in E))T.push(Do);E[Do]=z.join(" ")}if(F.length){if(!(Po in E))T.push(Po);E[Po]=F.join(" ")}let V=T.map((H)=>` ${H}="${cr(E[H])}"`).join("");return v.replace(k[0],()=>`<html${V}>`)}function jg(v){if(v.includes("data-stx-cloak"))return null;if(v.lastIndexOf("</head>")===-1)return null;return`${Mg}
1973
+ `}function yw(v){let _=[],k=0;while(k<v.length){let j=v.slice(k),B=j.match(/^\s+/);if(B){k+=B[0].length;continue}if(j.startsWith("<!--")){let G=v.indexOf("-->",k);if(G===-1)break;k=G+3;continue}let z=j.match(/^<script\b[^>]*>/i);if(z){let G=v.toLowerCase().indexOf("</script>",k+z[0].length);if(G===-1)break;k=G+9;continue}let F=j.match(/^<link\b[^>]*>/i);if(F){_.push(F[0]),k+=F[0].length;continue}let V=j.match(/^<meta\b[^>]*>/i);if(V){_.push(V[0]),k+=V[0].length;continue}let H=j.match(/^<style\b[^>]*>[\s\S]*?<\/style>/i);if(H){_.push(H[0]),k+=H[0].length;continue}break}if(_.length===0)return{body:v,hoisted:_};let E="",T=0;while(T<v.length&&T<k){let j=v.slice(T),B=j.match(/^<link\b[^>]*>/i);if(B&&_.includes(B[0])){T+=B[0].length;continue}let z=j.match(/^<meta\b[^>]*>/i);if(z&&_.includes(z[0])){T+=z[0].length;continue}let F=j.match(/^<style\b[^>]*>[\s\S]*?<\/style>/i);if(F&&_.includes(F[0])){T+=F[0].length;continue}E+=v[T],T++}return E+=v.slice(k),{body:E,hoisted:_}}function xw(v,_={},k={}){let{title:E="stx App",lang:T="en",meta:j=[],link:B=[],script:z=[],headRaw:F="",htmlAttrs:V={},bodyClass:H="",bodyAttrs:G={}}=_,J=k.title||E,ne=[{charset:"UTF-8"},{name:"viewport",content:"width=device-width, initial-scale=1.0"}],re=new Set(j.map(wr).filter(Boolean)),{body:se,hoisted:ie}=yw(v),oe=new Set(ie.flatMap((Re)=>{let _e=mw(Re);return _e?[wr(_e)].filter(Boolean):[]})),ae=[...ne.filter((Re)=>!re.has(wr(Re))),...j].filter((Re)=>!oe.has(wr(Re))).map((Re)=>` <meta ${Bs(Re)}>`).join(`
1974
+ `),me=B.map((Re)=>` <link ${Bs(Re)}>`).join(`
1975
+ `),ve=z.map((Re)=>{if(Re.src)return` <script ${Bs(Re,(_e)=>_e==="content")}></script>`;if(Re.content)return` <script>${Re.content}</script>`;return""}).filter(Boolean).join(`
1976
+ `),Se=hw(V,T),$e=Object.entries(G).map(([Re,_e])=>` ${Re}="${cr(String(_e))}"`).join(""),Ce=H?` class="${cr(H)}"`:"",Ee=[ae,k.colorMode?` ${El(k.colorMode)}`:"",` <title>${k.titleIsHtml?J:gw(J)}</title>`,` ${Mg}`,me,ve,F?` ${F}`:"",...(k.styles||[]).map((Re)=>` ${Re}`),...ie.map((Re)=>` ${Re}`),...(k.headScripts||[]).map((Re)=>` ${Re}`),k.headStack||""].filter(Boolean),Te=[se,...(k.bodyScripts||[]).map((Re)=>Re),k.bodyStack||""].filter(Boolean);return`<!DOCTYPE html>
1977
1977
  <html${Se}>
1978
1978
  <head>
1979
1979
  ${Ee.join(`
@@ -1983,24 +1983,24 @@ ${Ee.join(`
1983
1983
  ${Te.join(`
1984
1984
  `)}
1985
1985
  </body>
1986
- </html>`}var Cl=/\s+/y,Rl=/<(script|style)\b[^>]*>/iy,yw=/<\/script>/gi,xw=/<\/style>/gi,Tg=/<!DOCTYPE\b/iy,Ag=/<html[\s>]/iy;function on(v){let _=0;while(_<v.length){if(Cl.lastIndex=_,Cl.exec(v)){_=Cl.lastIndex;continue}if(v.startsWith("<!--",_)){let T=v.indexOf("-->",_);if(T===-1)return!1;_=T+3;continue}Rl.lastIndex=_;let E=Rl.exec(v);if(E){let T=E[1].toLowerCase()==="script"?yw:xw;T.lastIndex=Rl.lastIndex;let j=T.exec(v);if(j===null)return!1;_=j.index+j[0].length;continue}if(Tg.lastIndex=_,Tg.test(v))return!0;return Ag.lastIndex=_,Ag.test(v)}return!1}function Tl(v){return on(v)}function Og(v,_={}){let k=v.lastIndexOf("</head>");if(k===-1)return v;let{meta:E=[],link:T=[],script:j=[],headRaw:B=""}=_,z=v.slice(0,k),F=[];for(let V of E){let H=wr(V);if(H&&z.includes(H))continue;F.push(` <meta ${zs(V)}>`)}for(let V of T){if(V.href&&z.includes(`href="${V.href}"`))continue;F.push(` <link ${zs(V)}>`)}for(let V of j)if(V.src){if(z.includes(`src="${V.src}"`))continue;F.push(` <script ${zs(V,(H)=>H==="content")}></script>`)}else if(V.content){if(z.includes(V.content))continue;F.push(` <script>${V.content}</script>`)}if(B&&!z.includes(B))F.push(` ${B}`);if(F.length===0)return v;return`${v.slice(0,k)}${F.join(`
1986
+ </html>`}var Rl=/\s+/y,Tl=/<(script|style)\b[^>]*>/iy,bw=/<\/script>/gi,vw=/<\/style>/gi,Pg=/<!DOCTYPE\b/iy,Dg=/<html[\s>]/iy;function on(v){let _=0;while(_<v.length){if(Rl.lastIndex=_,Rl.exec(v)){_=Rl.lastIndex;continue}if(v.startsWith("<!--",_)){let T=v.indexOf("-->",_);if(T===-1)return!1;_=T+3;continue}Tl.lastIndex=_;let E=Tl.exec(v);if(E){let T=E[1].toLowerCase()==="script"?bw:vw;T.lastIndex=Tl.lastIndex;let j=T.exec(v);if(j===null)return!1;_=j.index+j[0].length;continue}if(Pg.lastIndex=_,Pg.test(v))return!0;return Dg.lastIndex=_,Dg.test(v)}return!1}function Al(v){return on(v)}function Lg(v,_={}){let k=v.lastIndexOf("</head>");if(k===-1)return v;let{meta:E=[],link:T=[],script:j=[],headRaw:B=""}=_,z=v.slice(0,k),F=[];for(let V of E){let H=wr(V);if(H&&z.includes(H))continue;F.push(` <meta ${Bs(V)}>`)}for(let V of T){if(V.href&&z.includes(`href="${V.href}"`))continue;F.push(` <link ${Bs(V)}>`)}for(let V of j)if(V.src){if(z.includes(`src="${V.src}"`))continue;F.push(` <script ${Bs(V,(H)=>H==="content")}></script>`)}else if(V.content){if(z.includes(V.content))continue;F.push(` <script>${V.content}</script>`)}if(B&&!z.includes(B))F.push(` ${B}`);if(F.length===0)return v;return`${v.slice(0,k)}${F.join(`
1987
1987
  `)}
1988
- ${v.slice(k)}`}function Wn(v,_={},k={},E){if(E??Tl(v))return v;return hw(v,_,k)}import Ng from"path";function N(v,_={}){return new yn(v,_).routes}var jg=new Map;async function Lg(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=Ng.isAbsolute(k)?k:Ng.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 vw(v){return v.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function Bg(v){return vw(JSON.stringify(v))}function ce(v){return v.includes("data-stx-runtime")}function zg(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 Al(v,_){let k=Gs(v),E=v.search(/<!doctype\b/i);if(k!==-1&&(E===-1||k>E))return v.slice(0,k)+_+`
1988
+ ${v.slice(k)}`}function Wn(v,_={},k={},E){if(E??Al(v))return v;return xw(v,_,k)}import Bg from"path";function N(v,_={}){return new yn(v,_).routes}var zg=new Map;async function Fg(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=Bg.isAbsolute(k)?k:Bg.join(E,k),j=zg.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 zg.set(T,B),B}function Sw(v){return v.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function Vg(v){return Sw(JSON.stringify(v))}function ce(v){return v.includes("data-stx-runtime")}function Wg(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 Il(v,_){let k=Gs(v),E=v.search(/<!doctype\b/i);if(k!==-1&&(E===-1||k>E))return v.slice(0,k)+_+`
1989
1989
  `+v.slice(k);let T=Oi(v);if(T!==null)return`${v.slice(0,T)}
1990
1990
  ${_}${v.slice(T)}`;if(v.includes("</head>")){let B=v.indexOf("</head>");return v.slice(0,B)+_+`
1991
- `+v.slice(B)}if(An(v))return vs(v,(B)=>`${B}
1991
+ `+v.slice(B)}if(An(v))return fs(v,(B)=>`${B}
1992
1992
  ${_}`);return`${_}
1993
- ${v}`}async function Do(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-se4b8sjc.js"),{url:j}=await T("runtime",_.debug===!0);return Al(v,`<script data-stx-runtime src="${j}"></script>`)}if(_.buildMode==="compile")return Al(v,'<script data-stx-runtime src="/__stx/runtime.__STX_HASH__.js"></script>');let{getCachedSignalsRuntime:k}=await import("./chunk-se4b8sjc.js"),E=await k(_.debug);return Al(v,`<script data-stx-scoped data-stx-runtime>${E}</script>`)}function ww(v){return/<[a-z][^>]*?\sx-tooltip\s*=/i.test(v)}function Fg(v){if(v.includes("data-stx-tooltip-runtime")||!ww(v))return v;let _=`<script data-stx-scoped data-stx-tooltip-runtime>${ol()}</script>`,k=v.lastIndexOf("</body>");if(k===-1)return`${v}
1993
+ ${v}`}async function Mo(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-695de40v.js"),{url:j}=await T("runtime",_.debug===!0);return Il(v,`<script data-stx-runtime src="${j}"></script>`)}if(_.buildMode==="compile")return Il(v,'<script data-stx-runtime src="/__stx/runtime.__STX_HASH__.js"></script>');let{getCachedSignalsRuntime:k}=await import("./chunk-695de40v.js"),E=await k(_.debug);return Il(v,`<script data-stx-scoped data-stx-runtime>${E}</script>`)}function $w(v){return/<[a-z][^>]*?\sx-tooltip\s*=/i.test(v)}function Ug(v){if(v.includes("data-stx-tooltip-runtime")||!$w(v))return v;let _=`<script data-stx-scoped data-stx-tooltip-runtime>${al()}</script>`,k=v.lastIndexOf("</body>");if(k===-1)return`${v}
1994
1994
  ${_}`;return`${v.slice(0,k)}${_}
1995
- ${v.slice(k)}`}var Sw=/<script\b[^>]*\sdata-stx-router(?=[\s=>])/i;function $w(v){return Sw.test(v)||v.includes("__stxRouter)return")||v.includes("__stxRouter=true")}async function K(v,_){if(!v.includes("</body>"))return v;if($w(v))return v;let k=_?.router,E="";{let F={};if(k){if(k.container)F.container=k.container;if(k.interceptAllLinks!==void 0)F.interceptAllLinks=k.interceptAllLinks;if(k.progress!==void 0)F.progress=k.progress;if(k.viewTransitions!==void 0)F.viewTransitions=k.viewTransitions;if(k.viewTransitionDuration!==void 0)F.viewTransitionDuration=k.viewTransitionDuration;if(k.viewTransitionEasing!==void 0)F.viewTransitionEasing=k.viewTransitionEasing;if(k.scrollToTop!==void 0)F.scrollToTop=k.scrollToTop;if(k.scrollRestoration!==void 0)F.scrollRestoration=k.scrollRestoration;if(k.prefetch!==void 0)F.prefetch=k.prefetch;if(k.cache!==void 0)F.cache=k.cache;if(k.progressColor!==void 0)F.progressColor=k.progressColor;if(k.progressHeight!==void 0)F.progressHeight=k.progressHeight}try{let V=await Lg(_?.pagesDir,_?.root);if(V.length>0)F.ownedRoutes=V}catch{}if(Object.keys(F).length>0)E=`<script>window.__stxRouterConfig=${Bg(F)};</script>
1996
- `}let{getCachedRouterScript:T,getServeClientAsset:j}=await import("./chunk-se4b8sjc.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+`
1997
- </body>`+v.slice(z+7)}var Il=`(?:"[^"]*"|'[^']*'|[^>"'])*`,Xg=/^<([a-zA-Z][a-zA-Z0-9-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)>([\s\S]*)<\/\1>$/s,_w=65536,kw=4,Oo=new Map;function ju(){Oo.clear()}function Ew(v){let _=[];for(let k of fr(v,Y)){let E=k.token.match(/^<script\b([^>]*)>/i),T=k.token.match(/<\/script\s*>$/i);if(!E||!T)continue;let j=E[0].length,B=k.token.length-T[0].length;_.push(Object.freeze({fullMatch:k.token,attrs:E[1],body:k.token.slice(j,B),start:k.start,end:k.end}))}return _}function ic(v,_={}){let k=v.length>=_w,E=k?Oo.get(v):void 0;if(E===void 0){if(E=Ew(v),k)vd(Oo,kw),Oo.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 is(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}=Vg(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}=Vg(T);if(B)return{style:"in",iterable:j,itemVar:B,indexVar:z}}return{style:"unknown",iterable:null,itemVar:null,indexVar:null}}function Vg(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 as(v,_){return Ci(v,_)}function Cw(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 Zg(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 Rw(v){if(!/[:@]for\s*=/.test(v)&&!/\bx-for\s*=/.test(v))return[];let _=new RegExp(`<([a-zA-Z][\\w-]*)\\b(${Il})>`,"iy"),k=/(?:^|\s)(?::for|@for|x-for)\s*=\s*(?:"([^"]*)"|'([^']*)')/i,E=fr(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=is(z?.[1]??z?.[2]??""),V=[F.itemVar,F.indexVar].filter(Boolean);if(V.length===0)continue;let H=B[1],J=/\/\s*>$/.test(j.token)||No.has(H.toLowerCase())?j.end:Dl(v,j.start,H,j.end);if(J!==-1)T.push({start:j.start,end:J,vars:new Set(V)})}return T}var Wg=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 Tw(v){return v.replace(/'(?:\\.|[^'\\])*'/g,"''").replace(/"(?:\\.|[^"\\])*"/g,'""').replace(/`(?:\\.|[^`\\])*`/g,"``")}function Ug(v,_,k,E){if(!v)return!1;let T=Tw(v),j=!1,B=!1,z=!1,F=/([a-zA-Z_$][\w$]*)/g,V;while((V=F.exec(T))!==null){let ne=V[1];if(T.slice(0,V.index).trimEnd().endsWith("."))continue;if(Wg.has(ne))continue;if(_.has(ne)||E?.has(ne))j=!0;else if(k&&ne in k)B=!0}let H=/([a-zA-Z_$][\w$]*)(?:\.[a-zA-Z_$][\w$]*)*\s*\(\s*\)/g,G;while((G=H.exec(T))!==null){let ne=G[1];if(T.slice(0,G.index).trimEnd().endsWith("."))continue;if(Wg.has(ne)||k&&ne in k)continue;z=!0}return(j||z)&&!B}function Mo(v,_,k){let E=k===void 0?` ${_}`:` ${_}="${k.replace(/"/g,"&quot;")}"`,T=v.trim(),j=T.match(Xg);if(j&&Aw(j[3],j[1])){let[,B,z,F]=j;return`<${B}${z}${E}>${F}</${B}>`}return`<template${E}>${T}</template>`}function Aw(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 ei(v,_){let k=Zg(v);function E(T){let j=T,B=Rw(T),z=(G)=>{let J=new Set;for(let ne of B)if(G>ne.start&&G<ne.end)for(let re of ne.vars)J.add(re);return J},F=/@if\s*\(/g,V,H=[];while((V=F.exec(j))!==null){let G=V.index,J=G+V[0].length,ne=1,re=J;while(re<j.length&&ne>0){if(j[re]==="(")ne++;else if(j[re]===")")ne--;re++}if(ne!==0)continue;let se=j.substring(J,re-1).trim(),ie=re,oe=1,de=ie,ae=/@(if\s*\(|endif)/g;ae.lastIndex=ie;let me;while((me=ae.exec(j))!==null)if(me[1].startsWith("if"))oe++;else if(me[1]==="endif"){if(oe--,oe===0){de=me.index+me[0].length;break}}if(oe!==0)continue;let ve=j.substring(ie,de-6).trim(),Se;if(Cw(ve)){let $e=Ys(j.substring(G,de));if($e.length===0)continue;let Ce=$e[0].branches.filter((_e)=>_e.type!=="else"),Ee=z(G);if(!(Ce.length>0&&Ce.every((_e)=>Ug(_e.condition,k,_,Ee))))continue;Se=$e[0].branches.map((_e)=>{let Ae=E(_e.content);if(_e.type==="elseif")return Mo(Ae,"@else-if",_e.condition??"");if(_e.type==="else")return Mo(Ae,"@else");return Mo(Ae,"@if",_e.condition??"")}).join(`
1998
- `)}else{if(!Ug(se,k,_,z(G)))continue;Se=Mo(E(ve),"@if",se)}H.push({start:G,end:de,replacement:Se}),F.lastIndex=de}for(let G=H.length-1;G>=0;G--){let{start:J,end:ne,replacement:re}=H[G];j=j.substring(0,J)+re+j.substring(ne)}return j}return E(v)}function Iw(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 No=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),Hg=/<(script|style)\b/iy,Pw=/<\/script/gi,Dw=/<\/style/gi;function Dl(v,_,k,E){if(No.has(k.toLowerCase()))return E;let T=k.toLowerCase(),j=v.length,B=1,z=E;while(z<j){let F=v.indexOf("<",z);if(F===-1)return-1;if(z=F,v.startsWith("<!--",z)){let J=v.indexOf("-->",z+4);if(J===-1)return-1;z=J+3;continue}Hg.lastIndex=z;let V=Hg.exec(v);if(V){let J=v.indexOf(">",z);if(J===-1)return-1;if(v[J-1]==="/"){z=J+1;continue}let ne=V[1].toLowerCase()==="script"?Pw:Dw;ne.lastIndex=z;let re=ne.exec(v);if(re===null)return-1;let se=v.indexOf(">",re.index);if(se===-1)return-1;z=se+1;continue}if(v[z+1]==="/"){let J=/^<\/([a-z][\w-]*)\s*>/i.exec(v.slice(z,z+64));if(!J){z++;continue}if(J[1].toLowerCase()===T){if(B--,z+=J[0].length,B===0)return z;continue}z+=J[0].length;continue}let H=/^<([a-z][\w-]*)\b/i.exec(v.slice(z,z+64));if(!H){z++;continue}let G=v.indexOf(">",z);if(G===-1)return-1;if(H[1].toLowerCase()===T){let J=v.slice(z,G+1);if(!(/\/\s*>$/.test(J)||No.has(T)))B++}z=G+1}return-1}var Mw=/\s(?::else-if|x-else-if|@else-if|:else|x-else|@else)(?=[=\s/>])/;function Ow(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 Mw.test(j)}function ti(v){if(!v.includes(":if")&&!v.includes(":show")&&!v.includes("x-if")&&!v.includes("x-show")&&!v.includes("@if=")&&!v.includes("@show="))return v;let _=[],k=/<(script|style)\b[^>]*>[\s\S]*?<\/\1\s*>/gi,E;while((E=k.exec(v))!==null)_.push([E.index,E.index+E[0].length]);let T=(G)=>_.some(([J,ne])=>G>=J&&G<ne),j=/<([a-zA-Z][\w-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*?)\s+(:if|:show|x-if|x-show|@if|@show)\s*=\s*"([^"]*)"((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)(\/?)>/g,B=[],z;while((z=j.exec(v))!==null){if(T(z.index))continue;let[G,J,ne,re,se,ie,oe]=z,de=Iw(se);if(de===void 0)continue;let ae=z.index,me=ae+G.length,$e=!!oe||/\/\s*>$/.test(G)||No.has(J.toLowerCase())?me:Dl(v,ae,J,me);if($e===-1)continue;if((re===":if"||re==="x-if"||re==="@if")&&Ow(v,$e)){j.lastIndex=me;continue}if(de===!0){let Ee=`<${J}${ne}${ie}${oe}>`;B.push({start:ae,end:me,replacement:Ee});continue}B.push({start:ae,end:$e,replacement:""}),j.lastIndex=$e}if(B.length===0)return v;B.sort((G,J)=>G.start-J.start);let F=[],V=-1;for(let G of B){if(G.start<V)continue;F.push(G),V=G.end}let H=v;for(let G=F.length-1;G>=0;G--){let{start:J,end:ne,replacement:re}=F[G];H=H.substring(0,J)+re+H.substring(ne)}return H}var qg=[":for","@for","x-for"];function cs(v,_){if(!_||Object.keys(_).length===0)return v;if(!qg.some((z)=>v.includes(`${z}=`)))return v;let k=Zg(v);if(Array.isArray(_.__stx_client_signal_names)){for(let z of _.__stx_client_signal_names)if(typeof z==="string")k.add(z)}let E=v,T=[],j=/<([a-zA-Z][\w-]*)((?:[^>"']|"[^"]*"|'[^']*')*)>/g,B;while((B=j.exec(E))!==null){let[z,F,V]=B,H=B.index,G=H+z.length,J=qg.map((Se)=>({attr:Se,m:new RegExp(`\\s${Se}="([^"]*)"`).exec(V)})).find((Se)=>Se.m!==null);if(!J||!J.m)continue;let ne=is(J.m[1]);if(!ne.iterable||!ne.itemVar)continue;let re=ne.iterable.trim().split(/[.[(]/)[0].trim();if(!re||k.has(re)||!(re in _))continue;let se=Dl(E,H,F,G);if(se===-1)continue;let ie=V.replace(new RegExp(`\\s${J.attr}="[^"]*"`),"").replace(/\s:key="[^"]*"/,"").replace(/\sx-cloak(?=\s|$)/,""),oe=E.slice(G,se-`</${F}>`.length),de={..._,[ne.itemVar]:void 0};if(ne.indexVar)de[ne.indexVar]=void 0;let ae=cs(oe,de),me=ne.indexVar?`${ne.iterable} as ${ne.indexVar} => ${ne.itemVar}`:`${ne.iterable} as ${ne.itemVar}`,ve=F.toLowerCase()==="template"?ae:`<${F}${ie}>${ae}</${F}>`;T.push({start:H,end:se,replacement:`@foreach(${me})${ve}@endforeach`}),j.lastIndex=se}for(let z=T.length-1;z>=0;z--){let{start:F,end:V,replacement:H}=T[z];E=E.slice(0,F)+H+E.slice(V)}return E}function ls(v,_){let k=v,E=/@(for|foreach)\s*\(/g,T,j=[],B=[];while((T=E.exec(k))!==null){let z=T[1],F=T.index,V=F+T[0].length,H=1,G=V;while(G<k.length&&H>0){if(k[G]==="(")H++;else if(k[G]===")")H--;G++}if(H!==0)continue;let J=k.substring(V,G-1).trim(),ne=G,re=is(J),se=z==="for"?"@endfor":"@endforeach",ie=1,oe=ne,de=z==="for"?new RegExp("@(for(?!each)\\s*\\(|endfor(?!each))","g"):new RegExp(`@(${z}\\s*\\(|end${z})`,"g");de.lastIndex=ne;let ae;while((ae=de.exec(k))!==null)if(ae[1].startsWith(z))ie++;else if(ie--,ie===0){oe=ae.index+ae[0].length;break}if(ie!==0)continue;let me=()=>{let Te=[re.itemVar,re.indexVar].filter(Boolean);if(Te.length)B.push({start:F,end:oe,vars:Te})};if(re.iterable){let Te=re.iterable.trim();if(Te.startsWith("[")||Te.startsWith("{")||Te.startsWith("'")||Te.startsWith('"')||Te.startsWith("`")||/^-?\d/.test(Te)){me();continue}let Re=Te.split(/[.[(]/)[0].trim(),_e=_?Re in _:!1,Ae=B.some((Xe)=>F>Xe.start&&F<Xe.end&&Xe.vars.includes(Re));if(Re&&(_e||Ae)){me();continue}}if(re.style==="as")J=re.indexVar?`(${re.itemVar}, ${re.indexVar}) in ${re.iterable}`:`${re.itemVar} in ${re.iterable}`;let ve=k.substring(ne,oe-se.length).trim(),Se=_?{..._}:{};if(re.itemVar)delete Se[re.itemVar];if(re.indexVar)delete Se[re.indexVar];let $e=ls(ve,Se),Ce=$e.match(Xg),Ee;if(Ce){let[,Te,Re,_e]=Ce;Ee=`<${Te}${Re} @for="${J}">${_e}</${Te}>`}else Ee=`<template @for="${J}">${$e}</template>`;j.push({start:F,end:oe,replacement:Ee}),E.lastIndex=oe}for(let z=j.length-1;z>=0;z--){let{start:F,end:V,replacement:H}=j[z];k=k.substring(0,F)+H+k.substring(V)}return k}function Nw(v){let _=new Set,k=[],E=0,T=0,j=v.length,B=(H)=>{let G=E+1;while(G<j){let J=v[G];if(J==="\\"){G+=2;continue}if(J===H)return G+1;G++}return j},z=()=>{let H=E+2;while(H<j&&v[H]!==`
1995
+ ${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}try{let V=await Fg(_?.pagesDir,_?.root);if(V.length>0)F.ownedRoutes=V}catch{}if(Object.keys(F).length>0)E=`<script>window.__stxRouterConfig=${Vg(F)};</script>
1996
+ `}let{getCachedRouterScript:T,getServeClientAsset:j}=await import("./chunk-695de40v.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+`
1997
+ </body>`+v.slice(z+7)}var Pl=`(?:"[^"]*"|'[^']*'|[^>"'])*`,Jg=/^<([a-zA-Z][a-zA-Z0-9-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)>([\s\S]*)<\/\1>$/s,Ew=65536,Cw=4,No=new Map;function jd(){No.clear()}function Rw(v){let _=[];for(let k of fr(v,Y)){let E=k.token.match(/^<script\b([^>]*)>/i),T=k.token.match(/<\/script\s*>$/i);if(!E||!T)continue;let j=E[0].length,B=k.token.length-T[0].length;_.push(Object.freeze({fullMatch:k.token,attrs:E[1],body:k.token.slice(j,B),start:k.start,end:k.end}))}return _}function ic(v,_={}){let k=v.length>=Ew,E=k?No.get(v):void 0;if(E===void 0){if(E=Rw(v),k)Ju(No,Cw),No.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 is(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}=Hg(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}=Hg(T);if(B)return{style:"in",iterable:j,itemVar:B,indexVar:z}}return{style:"unknown",iterable:null,itemVar:null,indexVar:null}}function Hg(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 as(v,_){return Ci(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 Yg(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 Aw(v){if(!/[:@]for\s*=/.test(v)&&!/\bx-for\s*=/.test(v))return[];let _=new RegExp(`<([a-zA-Z][\\w-]*)\\b(${Pl})>`,"iy"),k=/(?:^|\s)(?::for|@for|x-for)\s*=\s*(?:"([^"]*)"|'([^']*)')/i,E=fr(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=is(z?.[1]??z?.[2]??""),V=[F.itemVar,F.indexVar].filter(Boolean);if(V.length===0)continue;let H=B[1],J=/\/\s*>$/.test(j.token)||Lo.has(H.toLowerCase())?j.end:Ml(v,j.start,H,j.end);if(J!==-1)T.push({start:j.start,end:J,vars:new Set(V)})}return T}var qg=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 Kg(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 ne=V[1];if(T.slice(0,V.index).trimEnd().endsWith("."))continue;if(qg.has(ne))continue;if(_.has(ne)||E?.has(ne))j=!0;else if(k&&ne in k)B=!0}let H=/([a-zA-Z_$][\w$]*)(?:\.[a-zA-Z_$][\w$]*)*\s*\(\s*\)/g,G;while((G=H.exec(T))!==null){let ne=G[1];if(T.slice(0,G.index).trimEnd().endsWith("."))continue;if(qg.has(ne)||k&&ne in k)continue;z=!0}return(j||z)&&!B}function Oo(v,_,k){let E=k===void 0?` ${_}`:` ${_}="${k.replace(/"/g,"&quot;")}"`,T=v.trim(),j=T.match(Jg);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 ei(v,_){let k=Yg(v);function E(T){let j=T,B=Aw(T),z=(G)=>{let J=new Set;for(let ne of B)if(G>ne.start&&G<ne.end)for(let re of ne.vars)J.add(re);return J},F=/@if\s*\(/g,V,H=[];while((V=F.exec(j))!==null){let G=V.index,J=G+V[0].length,ne=1,re=J;while(re<j.length&&ne>0){if(j[re]==="(")ne++;else if(j[re]===")")ne--;re++}if(ne!==0)continue;let se=j.substring(J,re-1).trim(),ie=re,oe=1,ue=ie,ae=/@(if\s*\(|endif)/g;ae.lastIndex=ie;let me;while((me=ae.exec(j))!==null)if(me[1].startsWith("if"))oe++;else if(me[1]==="endif"){if(oe--,oe===0){ue=me.index+me[0].length;break}}if(oe!==0)continue;let ve=j.substring(ie,ue-6).trim(),Se;if(Tw(ve)){let $e=Ys(j.substring(G,ue));if($e.length===0)continue;let Ce=$e[0].branches.filter((_e)=>_e.type!=="else"),Ee=z(G);if(!(Ce.length>0&&Ce.every((_e)=>Kg(_e.condition,k,_,Ee))))continue;Se=$e[0].branches.map((_e)=>{let Ae=E(_e.content);if(_e.type==="elseif")return Oo(Ae,"@else-if",_e.condition??"");if(_e.type==="else")return Oo(Ae,"@else");return Oo(Ae,"@if",_e.condition??"")}).join(`
1998
+ `)}else{if(!Kg(se,k,_,z(G)))continue;Se=Oo(E(ve),"@if",se)}H.push({start:G,end:ue,replacement:Se}),F.lastIndex=ue}for(let G=H.length-1;G>=0;G--){let{start:J,end:ne,replacement:re}=H[G];j=j.substring(0,J)+re+j.substring(ne)}return j}return E(v)}function 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 Lo=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),Xg=/<(script|style)\b/iy,Mw=/<\/script/gi,Ow=/<\/style/gi;function Ml(v,_,k,E){if(Lo.has(k.toLowerCase()))return E;let T=k.toLowerCase(),j=v.length,B=1,z=E;while(z<j){let F=v.indexOf("<",z);if(F===-1)return-1;if(z=F,v.startsWith("<!--",z)){let J=v.indexOf("-->",z+4);if(J===-1)return-1;z=J+3;continue}Xg.lastIndex=z;let V=Xg.exec(v);if(V){let J=v.indexOf(">",z);if(J===-1)return-1;if(v[J-1]==="/"){z=J+1;continue}let ne=V[1].toLowerCase()==="script"?Mw:Ow;ne.lastIndex=z;let re=ne.exec(v);if(re===null)return-1;let se=v.indexOf(">",re.index);if(se===-1)return-1;z=se+1;continue}if(v[z+1]==="/"){let J=/^<\/([a-z][\w-]*)\s*>/i.exec(v.slice(z,z+64));if(!J){z++;continue}if(J[1].toLowerCase()===T){if(B--,z+=J[0].length,B===0)return z;continue}z+=J[0].length;continue}let H=/^<([a-z][\w-]*)\b/i.exec(v.slice(z,z+64));if(!H){z++;continue}let G=v.indexOf(">",z);if(G===-1)return-1;if(H[1].toLowerCase()===T){let J=v.slice(z,G+1);if(!(/\/\s*>$/.test(J)||Lo.has(T)))B++}z=G+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 ti(v){if(!v.includes(":if")&&!v.includes(":show")&&!v.includes("x-if")&&!v.includes("x-show")&&!v.includes("@if=")&&!v.includes("@show="))return v;let _=[],k=/<(script|style)\b[^>]*>[\s\S]*?<\/\1\s*>/gi,E;while((E=k.exec(v))!==null)_.push([E.index,E.index+E[0].length]);let T=(G)=>_.some(([J,ne])=>G>=J&&G<ne),j=/<([a-zA-Z][\w-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*?)\s+(:if|:show|x-if|x-show|@if|@show)\s*=\s*"([^"]*)"((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)(\/?)>/g,B=[],z;while((z=j.exec(v))!==null){if(T(z.index))continue;let[G,J,ne,re,se,ie,oe]=z,ue=Dw(se);if(ue===void 0)continue;let ae=z.index,me=ae+G.length,$e=!!oe||/\/\s*>$/.test(G)||Lo.has(J.toLowerCase())?me:Ml(v,ae,J,me);if($e===-1)continue;if((re===":if"||re==="x-if"||re==="@if")&&jw(v,$e)){j.lastIndex=me;continue}if(ue===!0){let Ee=`<${J}${ne}${ie}${oe}>`;B.push({start:ae,end:me,replacement:Ee});continue}B.push({start:ae,end:$e,replacement:""}),j.lastIndex=$e}if(B.length===0)return v;B.sort((G,J)=>G.start-J.start);let F=[],V=-1;for(let G of B){if(G.start<V)continue;F.push(G),V=G.end}let H=v;for(let G=F.length-1;G>=0;G--){let{start:J,end:ne,replacement:re}=F[G];H=H.substring(0,J)+re+H.substring(ne)}return H}var Zg=[":for","@for","x-for"];function cs(v,_){if(!_||Object.keys(_).length===0)return v;if(!Zg.some((z)=>v.includes(`${z}=`)))return v;let k=Yg(v);if(Array.isArray(_.__stx_client_signal_names)){for(let z of _.__stx_client_signal_names)if(typeof z==="string")k.add(z)}let E=v,T=[],j=/<([a-zA-Z][\w-]*)((?:[^>"']|"[^"]*"|'[^']*')*)>/g,B;while((B=j.exec(E))!==null){let[z,F,V]=B,H=B.index,G=H+z.length,J=Zg.map((Se)=>({attr:Se,m:new RegExp(`\\s${Se}="([^"]*)"`).exec(V)})).find((Se)=>Se.m!==null);if(!J||!J.m)continue;let ne=is(J.m[1]);if(!ne.iterable||!ne.itemVar)continue;let re=ne.iterable.trim().split(/[.[(]/)[0].trim();if(!re||k.has(re)||!(re in _))continue;let se=Ml(E,H,F,G);if(se===-1)continue;let ie=V.replace(new RegExp(`\\s${J.attr}="[^"]*"`),"").replace(/\s:key="[^"]*"/,"").replace(/\sx-cloak(?=\s|$)/,""),oe=E.slice(G,se-`</${F}>`.length),ue={..._,[ne.itemVar]:void 0};if(ne.indexVar)ue[ne.indexVar]=void 0;let ae=cs(oe,ue),me=ne.indexVar?`${ne.iterable} as ${ne.indexVar} => ${ne.itemVar}`:`${ne.iterable} as ${ne.itemVar}`,ve=F.toLowerCase()==="template"?ae:`<${F}${ie}>${ae}</${F}>`;T.push({start:H,end:se,replacement:`@foreach(${me})${ve}@endforeach`}),j.lastIndex=se}for(let z=T.length-1;z>=0;z--){let{start:F,end:V,replacement:H}=T[z];E=E.slice(0,F)+H+E.slice(V)}return E}function ls(v,_){let k=v,E=/@(for|foreach)\s*\(/g,T,j=[],B=[];while((T=E.exec(k))!==null){let z=T[1],F=T.index,V=F+T[0].length,H=1,G=V;while(G<k.length&&H>0){if(k[G]==="(")H++;else if(k[G]===")")H--;G++}if(H!==0)continue;let J=k.substring(V,G-1).trim(),ne=G,re=is(J),se=z==="for"?"@endfor":"@endforeach",ie=1,oe=ne,ue=z==="for"?new RegExp("@(for(?!each)\\s*\\(|endfor(?!each))","g"):new RegExp(`@(${z}\\s*\\(|end${z})`,"g");ue.lastIndex=ne;let ae;while((ae=ue.exec(k))!==null)if(ae[1].startsWith(z))ie++;else if(ie--,ie===0){oe=ae.index+ae[0].length;break}if(ie!==0)continue;let me=()=>{let Te=[re.itemVar,re.indexVar].filter(Boolean);if(Te.length)B.push({start:F,end:oe,vars:Te})};if(re.iterable){let Te=re.iterable.trim();if(Te.startsWith("[")||Te.startsWith("{")||Te.startsWith("'")||Te.startsWith('"')||Te.startsWith("`")||/^-?\d/.test(Te)){me();continue}let Re=Te.split(/[.[(]/)[0].trim(),_e=_?Re in _:!1,Ae=B.some((Xe)=>F>Xe.start&&F<Xe.end&&Xe.vars.includes(Re));if(Re&&(_e||Ae)){me();continue}}if(re.style==="as")J=re.indexVar?`(${re.itemVar}, ${re.indexVar}) in ${re.iterable}`:`${re.itemVar} in ${re.iterable}`;let ve=k.substring(ne,oe-se.length).trim(),Se=_?{..._}:{};if(re.itemVar)delete Se[re.itemVar];if(re.indexVar)delete Se[re.indexVar];let $e=ls(ve,Se),Ce=$e.match(Jg),Ee;if(Ce){let[,Te,Re,_e]=Ce;Ee=`<${Te}${Re} @for="${J}">${_e}</${Te}>`}else Ee=`<template @for="${J}">${$e}</template>`;j.push({start:F,end:oe,replacement:Ee}),E.lastIndex=oe}for(let z=j.length-1;z>=0;z--){let{start:F,end:V,replacement:H}=j[z];k=k.substring(0,F)+H+k.substring(V)}return k}function Lw(v){let _=new Set,k=[],E=0,T=0,j=v.length,B=(H)=>{let G=E+1;while(G<j){let J=v[G];if(J==="\\"){G+=2;continue}if(J===H)return G+1;G++}return j},z=()=>{let H=E+2;while(H<j&&v[H]!==`
1999
1999
  `)H++;return H},F=()=>{let H=E+2;while(H<j-1){if(v[H]==="*"&&v[H+1]==="/")return H+2;H++}return j},V=(H)=>{let G=H,J=0;while(G<j){let ne=v[G];if(ne==="/"&&v[G+1]==="/"){let re=G+2;while(re<j&&v[re]!==`
2000
- `)re++;G=re;continue}if(ne==="/"&&v[G+1]==="*"){let re=G+2;while(re<j-1&&!(v[re]==="*"&&v[re+1]==="/"))re++;G=re+2;continue}if(ne==='"'||ne==="'"||ne==="`"){let re=G+1;while(re<j){if(v[re]==="\\"){re+=2;continue}if(v[re]===ne){re++;break}re++}G=re;continue}if(ne==="("||ne==="["||ne==="{"){J++,G++;continue}if(ne===")"||ne==="]"||ne==="}"){J--,G++;continue}if(ne===";"&&J===0)return G+1;G++}return j};while(E<j){let H=v[E];if(H==="/"&&v[E+1]==="/"){let G=z();k.push(v.slice(E,G)),E=G;continue}if(H==="/"&&v[E+1]==="*"){let G=F();k.push(v.slice(E,G)),E=G;continue}if(H==='"'||H==="'"||H==="`"){let G=B(H);k.push(v.slice(E,G)),E=G;continue}if(H==="{"){T++,k.push(H),E++;continue}if(H==="}"){T--,k.push(H),E++;continue}if(T===0){let G=E>0?v[E-1]:"";if(G===""||/\s/.test(G)||G===";"||G==="}"||G==="{"){let ne=v.slice(E).match(/^(const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=/);if(ne){let re=ne[2],se=V(E+ne[0].length);if(_.has(re)){k.push(`/* stx: deduped const ${re} */`),E=se;continue}_.add(re),k.push(v.slice(E,se)),E=se;continue}}}k.push(H),E++}return k.join("")}var jw=new Set(["script","style","html","head","meta","link","title","!doctype"]);function Pl(v,_,k){for(let E of k){if(E.start>=_)return!1;if(E.end>v)return!0}return!1}function Lw(v,_,k){let E=0;while(E<v.length){let T=v.indexOf(_,E);if(T===-1)return!1;if(!Pl(T,T+_.length,k))return!0;E=T+_.length}return!1}function Bw(v,_){if(Lw(v,"<body",_)){let T=new RegExp(`<body(${Il})>`,"g"),j;while((j=T.exec(v))!==null)if(!Pl(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(${Il})>`,"gi"),E;while((E=k.exec(v))!==null){if(Pl(E.index,E.index+E[0].length,_))continue;if(jw.has(E[1].toLowerCase()))continue;return E.index+E[0].length-1}return null}function zw(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 zn(v,_,k,E={}){let T=ic(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 ut("stx/client-script-bundler",()=>import("./chunk-07mksefx.js"));for(let ae of T){let me=ae.body;if(Ve(ae.attrs))me=Ue(me);if(E.forceClientSetup||j.test(me)){B.push({content:me,start:ae.start,end:ae.end});continue}if(!z(me))continue;try{let ve=await F(wt(me).code,_||"",{projectRoot:process.cwd(),externalizeUserModules:!1});if(j.test(ve))B.push({content:me,start:ae.start,end:ae.end})}catch{}}if(B.length===0)return{output:v,setupCode:null};let V=`${_??""}\x00${B.map((ae)=>ae.content).join("\x00")}`,H=`__stx_setup_${Bun.hash(V).toString(36).slice(0,10)}`,G=[];for(let ae=0;ae<B.length;ae++){let me=B[ae].bundled??wt(B[ae].content).code;if(!B[ae].bundled&&z(me))me=await F(me,_||"",{projectRoot:process.cwd(),externalizeUserModules:E.forceClientSetup?!1:void 0});me=He(me);let ve=P(me);G.push(`// \u2500\u2500 merged signal script #${ae+1} \u2500\u2500
2000
+ `)re++;G=re;continue}if(ne==="/"&&v[G+1]==="*"){let re=G+2;while(re<j-1&&!(v[re]==="*"&&v[re+1]==="/"))re++;G=re+2;continue}if(ne==='"'||ne==="'"||ne==="`"){let re=G+1;while(re<j){if(v[re]==="\\"){re+=2;continue}if(v[re]===ne){re++;break}re++}G=re;continue}if(ne==="("||ne==="["||ne==="{"){J++,G++;continue}if(ne===")"||ne==="]"||ne==="}"){J--,G++;continue}if(ne===";"&&J===0)return G+1;G++}return j};while(E<j){let H=v[E];if(H==="/"&&v[E+1]==="/"){let G=z();k.push(v.slice(E,G)),E=G;continue}if(H==="/"&&v[E+1]==="*"){let G=F();k.push(v.slice(E,G)),E=G;continue}if(H==='"'||H==="'"||H==="`"){let G=B(H);k.push(v.slice(E,G)),E=G;continue}if(H==="{"){T++,k.push(H),E++;continue}if(H==="}"){T--,k.push(H),E++;continue}if(T===0){let G=E>0?v[E-1]:"";if(G===""||/\s/.test(G)||G===";"||G==="}"||G==="{"){let ne=v.slice(E).match(/^(const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=/);if(ne){let re=ne[2],se=V(E+ne[0].length);if(_.has(re)){k.push(`/* stx: deduped const ${re} */`),E=se;continue}_.add(re),k.push(v.slice(E,se)),E=se;continue}}}k.push(H),E++}return k.join("")}var Bw=new Set(["script","style","html","head","meta","link","title","!doctype"]);function Dl(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(!Dl(T,T+_.length,k))return!0;E=T+_.length}return!1}function Fw(v,_){if(zw(v,"<body",_)){let T=new RegExp(`<body(${Pl})>`,"g"),j;while((j=T.exec(v))!==null)if(!Dl(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(${Pl})>`,"gi"),E;while((E=k.exec(v))!==null){if(Dl(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 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 zn(v,_,k,E={}){let T=ic(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 ut("stx/client-script-bundler",()=>import("./chunk-tydxqfs6.js"));for(let ae of T){let me=ae.body;if(Ve(ae.attrs))me=Ue(me);if(E.forceClientSetup||j.test(me)){B.push({content:me,start:ae.start,end:ae.end});continue}if(!z(me))continue;try{let ve=await F(wt(me).code,_||"",{projectRoot:process.cwd(),externalizeUserModules:!1});if(j.test(ve))B.push({content:me,start:ae.start,end:ae.end})}catch{}}if(B.length===0)return{output:v,setupCode:null};let V=`${_??""}\x00${B.map((ae)=>ae.content).join("\x00")}`,H=`__stx_setup_${Bun.hash(V).toString(36).slice(0,10)}`,G=[];for(let ae=0;ae<B.length;ae++){let me=B[ae].bundled??wt(B[ae].content).code;if(!B[ae].bundled&&z(me))me=await F(me,_||"",{projectRoot:process.cwd(),externalizeUserModules:E.forceClientSetup?!1:void 0});me=He(me);let ve=P(me);G.push(`// \u2500\u2500 merged signal script #${ae+1} \u2500\u2500
2001
2001
  ${ve}`)}let J=G.join(`
2002
2002
 
2003
- `);J=Nw(J);let ne=ac(J),re=ne.split(",").map((ae)=>ae.trim()).filter(Boolean),se=Jr(J,k),ie=`
2003
+ `);J=Lw(J);let ne=ac(J),re=ne.split(",").map((ae)=>ae.trim()).filter(Boolean),se=Jr(J,k),ie=`
2004
2004
  <script data-stx-scoped>
2005
2005
  function ${H}() {
2006
2006
  ${Rt("const",re)}
@@ -2009,100 +2009,100 @@ ${zr(`${se}${J}`)}
2009
2009
  }
2010
2010
  window.__stx_latestSetup=${H};
2011
2011
  if(window.stx)window.stx._latestSetup=${H};
2012
- </script>`,oe=Bw(v,B);return{output:zw(v,B,oe,H),setupCode:ie}}function ac(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===`
2012
+ </script>`,oe=Fw(v,B);return{output:Vw(v,B,oe,H),setupCode:ie}}function ac(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===`
2013
2013
  `)return;j++}},V=()=>{if(!z)return!0;if(/[\w)\]]/.test(z))return!1;return!0},H=(re)=>{j++;while(j<B){if(_[j]==="\\"){j+=2;continue}if(_[j]===re){j++;return}j++}},G=()=>{j++;while(j<B){if(_[j]==="\\"){j+=2;continue}if(_[j]==="`"){j++;return}if(_[j]==="$"&&_[j+1]==="{"){j+=2;let re=1;while(j<B&&re>0)if(_[j]==="{")re++,j++;else if(_[j]==="}")re--,j++;else if(_[j]==="'"||_[j]==='"')H(_[j]);else if(_[j]==="`")G();else j++;continue}j++}},J=()=>{if(_[j]==="/"&&_[j+1]==="/"){while(j<B&&_[j]!==`
2014
- `)j++;return!0}if(_[j]==="/"&&_[j+1]==="*"){j+=2;while(j<B-1&&!(_[j]==="*"&&_[j+1]==="/"))j++;return j+=2,!0}return!1},ne=()=>{if(T!==0)return;let re=_.slice(j).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*(?:[!:;,\n]|=(?!=)|$)/);if(re){let ae=re[2];if(!E.has(ae))k.push(ae),E.add(ae);return}let se=_.slice(j).match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(se){se[1].split(",").forEach((ae)=>{let me=ae.trim();if(!me)return;let ve=me.indexOf(":"),$e=(ve>=0?me.slice(ve+1).trim():me).split(/[\s=]/)[0];if($e&&!E.has($e))k.push($e),E.add($e)});return}let ie=_.slice(j).match(/^(?:const|let|var)\s+\[([^\]]+)\]\s*=/);if(ie){ie[1].split(",").forEach((ae)=>{let me=ae.trim().replace(/^\.\.\./,"");if(!me)return;let ve=me.split(/[\s=]/)[0];if(ve&&!E.has(ve))k.push(ve),E.add(ve)});return}let oe=_.slice(j).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(oe){let ae=oe[1];if(!E.has(ae))k.push(ae),E.add(ae);return}let de=_.slice(j).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(de){let ae=de[1];if(!E.has(ae))k.push(ae),E.add(ae)}};while(j<B){if(J())continue;if(_[j]==="'"||_[j]==='"'){H(_[j]),z=_[j-1];continue}if(_[j]==="`"){G(),z="`";continue}if(_[j]==="/"&&_[j+1]!=="/"&&_[j+1]!=="*"&&V()){F(),z="/";continue}if(_[j]==="{"){T++,z="{",j++;continue}if(_[j]==="}"){T--,z="}",j++;continue}if(T===0&&/[a-z]/i.test(_[j])&&(j===0||/\s|[;{}()]/.test(_[j-1])))ne();if(!/\s/.test(_[j]))z=_[j];j++}return k.join(", ")}async function ni(v,_,k,E){if(!as(v,k))return v;let T=v;if(_.skipSignalsRuntime)return T;let{output:j,setupCode:B}=await zn(T,k,E);if(T=j,!B){let z=An(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 Do(T,_),B){let z=ri(T,/<\/head>/i),F=z===-1?ri(T,/<body[^>]*>/i):-1;if(z!==-1)T=`${T.slice(0,z)}${B}
2014
+ `)j++;return!0}if(_[j]==="/"&&_[j+1]==="*"){j+=2;while(j<B-1&&!(_[j]==="*"&&_[j+1]==="/"))j++;return j+=2,!0}return!1},ne=()=>{if(T!==0)return;let re=_.slice(j).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*(?:[!:;,\n]|=(?!=)|$)/);if(re){let ae=re[2];if(!E.has(ae))k.push(ae),E.add(ae);return}let se=_.slice(j).match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(se){se[1].split(",").forEach((ae)=>{let me=ae.trim();if(!me)return;let ve=me.indexOf(":"),$e=(ve>=0?me.slice(ve+1).trim():me).split(/[\s=]/)[0];if($e&&!E.has($e))k.push($e),E.add($e)});return}let ie=_.slice(j).match(/^(?:const|let|var)\s+\[([^\]]+)\]\s*=/);if(ie){ie[1].split(",").forEach((ae)=>{let me=ae.trim().replace(/^\.\.\./,"");if(!me)return;let ve=me.split(/[\s=]/)[0];if(ve&&!E.has(ve))k.push(ve),E.add(ve)});return}let oe=_.slice(j).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(oe){let ae=oe[1];if(!E.has(ae))k.push(ae),E.add(ae);return}let ue=_.slice(j).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(ue){let ae=ue[1];if(!E.has(ae))k.push(ae),E.add(ae)}};while(j<B){if(J())continue;if(_[j]==="'"||_[j]==='"'){H(_[j]),z=_[j-1];continue}if(_[j]==="`"){G(),z="`";continue}if(_[j]==="/"&&_[j+1]!=="/"&&_[j+1]!=="*"&&V()){F(),z="/";continue}if(_[j]==="{"){T++,z="{",j++;continue}if(_[j]==="}"){T--,z="}",j++;continue}if(T===0&&/[a-z]/i.test(_[j])&&(j===0||/\s|[;{}()]/.test(_[j-1])))ne();if(!/\s/.test(_[j]))z=_[j];j++}return k.join(", ")}async function ni(v,_,k,E){if(!as(v,k))return v;let T=v;if(_.skipSignalsRuntime)return T;let{output:j,setupCode:B}=await zn(T,k,E);if(T=j,!B){let z=An(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 Mo(T,_),B){let z=ri(T,/<\/head>/i),F=z===-1?ri(T,/<body[^>]*>/i):-1;if(z!==-1)T=`${T.slice(0,z)}${B}
2015
2015
  ${T.slice(z)}`;else if(F!==-1){let V=/<body[^>]*>/i.exec(T.slice(F))[0],H=F+V.length;T=`${T.slice(0,H)}
2016
2016
  ${B}${T.slice(H)}`}else T=`${T}
2017
- ${B}`}return T}function ri(v,_){let k=/<(script|style)\b[\s\S]*?<\/\1>/gi,E=[],T;while((T=k.exec(v))!==null)E.push([T.index,T.index+T[0].length]);let j=new RegExp(_.source,_.flags.replace(/[gy]/g,"")),B=0;while(B<v.length){let z=j.exec(v.slice(B));if(!z)return-1;let F=B+z.index;if(!E.some(([H,G])=>F>=H&&F<G))return F;B=F+Math.max(z[0].length,1)}return-1}var Kg="/* [stx import stripped, resolved via window.stx in __stx_setup] */";function cc(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 Kg;return`var ${_.join(", ")}; ${Kg}`}var Fw=/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"](?:stx|@stacksjs\/stx|@stacksjs\/browser)['"]\s*;?\s*$/gm;function He(v){return v.replace(Fw,(_,k)=>cc(k))}import Fs from"path";import Vw from"process";function w(v="STX_PUBLIC_"){let _={},k={};for(let[E,T]of Object.entries(Vw.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 Gg(v){return v.startsWith("http://")||v.startsWith("https://")||v.startsWith("//")}async function Jg(v,_,k){try{let E;if(v.startsWith("/")){let T=_;for(let j=0;j<5;j++){let B=Fs.join(T,v);if(await Bun.file(B).exists())return B;T=Fs.dirname(T)}E=Fs.join(_,v)}else if(v.startsWith("./")||v.startsWith("../"))E=Fs.resolve(_,v);else E=Fs.resolve(_,v);if(await Bun.file(E).exists())return E;return null}catch{return null}}var Yg=Symbol.for("stx.inline-assets.import-meta");function Ww(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.
2018
- `+" `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[Yg]=!0,k}async function Qg(v,_,k){let E=v,T=Fs.dirname(_),j=/<script\b([^>]*)src=["']([^"']+)["']([^>]*)><\/script>/gi,B;while((B=j.exec(E))!==null){let[V,H,G,J]=B;if(Gg(G))continue;let ne=await Jg(G,T,_);if(ne)try{let re=await Bun.file(ne).text();if(k.add(ne),G.endsWith(".ts")||G.endsWith(".tsx")){let ie=await Bun.build({entrypoints:[ne],target:"browser",minify:!0,define:w()});if(ie.outputs.length>0)re=await ie.outputs[0].text(),Ww(re,G)}let se=`<script>
2017
+ ${B}`}return T}function ri(v,_){let k=/<(script|style)\b[\s\S]*?<\/\1>/gi,E=[],T;while((T=k.exec(v))!==null)E.push([T.index,T.index+T[0].length]);let j=new RegExp(_.source,_.flags.replace(/[gy]/g,"")),B=0;while(B<v.length){let z=j.exec(v.slice(B));if(!z)return-1;let F=B+z.index;if(!E.some(([H,G])=>F>=H&&F<G))return F;B=F+Math.max(z[0].length,1)}return-1}var Gg="/* [stx import stripped, resolved via window.stx in __stx_setup] */";function cc(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 Gg;return`var ${_.join(", ")}; ${Gg}`}var Ww=/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"](?:stx|@stacksjs\/stx|@stacksjs\/browser)['"]\s*;?\s*$/gm;function He(v){return v.replace(Ww,(_,k)=>cc(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 Qg(v){return v.startsWith("http://")||v.startsWith("https://")||v.startsWith("//")}async function em(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 tm=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.
2018
+ `+" `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[tm]=!0,k}async function nm(v,_,k){let E=v,T=zs.dirname(_),j=/<script\b([^>]*)src=["']([^"']+)["']([^>]*)><\/script>/gi,B;while((B=j.exec(E))!==null){let[V,H,G,J]=B;if(Qg(G))continue;let ne=await em(G,T,_);if(ne)try{let re=await Bun.file(ne).text();if(k.add(ne),G.endsWith(".ts")||G.endsWith(".tsx")){let ie=await Bun.build({entrypoints:[ne],target:"browser",minify:!0,define:w()});if(ie.outputs.length>0)re=await ie.outputs[0].text(),Hw(re,G)}let se=`<script>
2019
2019
  // Source: ${G}
2020
2020
  ${re}
2021
- </script>`;E=E.replace(V,se),j.lastIndex=0}catch(re){if(re?.[Yg])throw re}}let z=/<link\b([^>]*)href=["']([^"']+)["']([^>]*)(?:\/?>)/gi,F;while((F=z.exec(E))!==null){let[V,H,G,J]=F,ne=H+J;if(Gg(G))continue;if(/rel=["']stylesheet["']/.test(ne)||G.endsWith(".css")){let se=await Jg(G,T,_);if(se)try{let ie=await Bun.file(se).text();k.add(se);let oe=`<style>
2021
+ </script>`;E=E.replace(V,se),j.lastIndex=0}catch(re){if(re?.[tm])throw re}}let z=/<link\b([^>]*)href=["']([^"']+)["']([^>]*)(?:\/?>)/gi,F;while((F=z.exec(E))!==null){let[V,H,G,J]=F,ne=H+J;if(Qg(G))continue;if(/rel=["']stylesheet["']/.test(ne)||G.endsWith(".css")){let se=await em(G,T,_);if(se)try{let ie=await Bun.file(se).text();k.add(se);let oe=`<style>
2022
2022
  /* Source: ${G} */
2023
2023
  ${ie}
2024
- </style>`;E=E.replace(V,oe),z.lastIndex=0}catch(ie){}}}return E}function ys(v,_){let k=v,E=/@json\s*\(/g,T;while((T=E.exec(k))!==null){let j=T.index,B=j+T[0].length-1,z=1,F=B+1,V=null,H=!1;while(F<k.length&&z>0){let ae=k[F];if(H){H=!1,F++;continue}if(ae==="\\"&&V){H=!0,F++;continue}if(V){if(ae===V)V=null;F++;continue}if(ae==='"'||ae==="'"||ae==="`"){V=ae,F++;continue}if(ae==="(")z++;else if(ae===")"){if(z--,z===0)break}F++}if(z!==0)break;let G=k.substring(B+1,F).trim(),J=k.substring(j,F+1),ne=-1,re=0,se=null,ie=!1;for(let ae=0;ae<G.length;ae++){let me=G[ae];if(ie){ie=!1;continue}if(me==="\\"&&se){ie=!0;continue}if(se){if(me===se)se=null;continue}if(me==='"'||me==="'"||me==="`"){se=me;continue}if(me==="("||me==="["||me==="{")re++;else if(me===")"||me==="]"||me==="}")re--;if(me===","&&re===0){ne=ae;break}}let oe=ne>=0?G.substring(0,ne).trim():G,de=ne>=0?G.substring(ne+1).trim():void 0;try{let ae=oe.trim(),me;if(p(ae))me=l(ae,Object.keys(_))(...Object.values(_));else me=void 0;let ve;if(de==="true")ve=JSON.stringify(me,null,2);else ve=JSON.stringify(me);let Se=ve.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029");k=k.substring(0,j)+Se+k.substring(F+1),E.lastIndex=j+Se.length}catch(ae){A.log(ae instanceof Error?ae:Error(String(ae)),{directive:"@json"},"error"),E.lastIndex=j+J.length}}return k}function bs(v){return v.replace(/@once\s*([\s\S]*?)@endonce/g,"$1")}function rm(v){let _=v,k=/@memo\s*\(/g,E,T=[];while((E=k.exec(_))!==null){let j=E.index,B=j+E[0].length,z=1,F=B;while(F<_.length&&z>0){if(_[F]==="(")z++;else if(_[F]===")")z--;F++}if(z!==0)continue;let V=_.slice(B,F-1).trim(),H=F,G=_.slice(H),J=G.indexOf("@endmemo");if(J===-1)continue;let ne=G.slice(0,J),re=H+J+8,se=ne.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)/),ie=se?se[0].length:0,oe=ne.slice(ie),de=ne.match(/(\s*)$/),ae=de?de[0].length:0,me=oe.slice(0,oe.length-ae),ve=me.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)?(\/?)>/),Se;if(ve){let[$e,Ce,Ee="",Te]=ve,Re=`<${Ce}${Ee} data-stx-memo="${V}"${Te}>`;Se=ne.slice(0,ie)+Re+me.slice($e.length)+ne.slice(ie+me.length)}else Se=`${ne.slice(0,ie)}<div data-stx-memo="${V}">${me}</div>${ne.slice(ie+me.length)}`;T.push({start:j,end:re,replacement:Se}),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 Ml(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 sm(v,_){if(!/\bref\s*=/.test(v))return v;let k=/<\/?([a-zA-Z][\w-]*)\b(?:"[^"]*"|'[^']*'|[^'">])*>/y,E=fr(v,(F,V)=>{k.lastIndex=V;let H=k.exec(F);if(!H||/^(?:script|style)$/i.test(H[1]))return-1;return k.lastIndex}),T=[],j=0,B=0,z=[];for(let{start:F,end:V,token:H}of E){let G=/^<\/?([\w-]+)/.exec(H)[1].toLowerCase();if(H.startsWith("</")){let ne;while(ne=T.pop()){if(ne.scoped)j--;if(ne.name===G)break}continue}let J=/\sdata-stx-scope\s*=/.test(H);if(!j&&!J&&/\s(?:ref|@ref|:ref|x-ref|data-stx-ref)\s*=/.test(H)&&!/\sdata-stx-ref-caller\s*=/.test(H))z.push(v.slice(B,F),H.replace(/\s*\/?>$/,(ne)=>` data-stx-ref-caller="${_}"${ne}`)),B=V;if(!im.has(G)&&!/\/>$/.test(H)){if(T.push({name:G,scoped:J}),J)j++}}return z.push(v.slice(B)),z.join("")}var im=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),om=/(?:^|\s)x-no-cloak(?:=|\s|\/|>|$)/,em=/<\/?\s*([a-z][\w-]*)/iy,Uw=/\s/;function Hw(v,_){let k=_-1;while(k>=0&&Uw.test(v[k]))k--;return k>=0&&v[k]==="/"}function qw(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 Kw(v,_){if(v.indexOf("{",_)===-1||v.indexOf("}",_)===-1)return!1;let k=0,E=_,T=!1,j=!1,B=!1;while(E<v.length){let z=v.indexOf("<",E),F=z===-1?v.length:z;if(F>E){if(k===0)while(E<F){let G=v.indexOf(j?"}":"{",E);if(G===-1||G>=F){if(j)B=!1;else T=!1;break}if(G>E)if(j)B=!1;else T=!1;if(j){if(B)return!0;B=!0}else if(T)j=!0,B=!1;else T=!0;E=G+1}E=F;continue}if(v.startsWith("<!--",E)){let G=v.indexOf("-->",E);E=G===-1?v.length:G+3;continue}let V=qw(v,E);if(V===-1)break;em.lastIndex=E;let H=em.exec(v)?.[1]?.toLowerCase()??"";if(v[E+1]==="/"){if(k===0)break;k--}else if(!Hw(v,V)&&!im.has(H))k++;E=V+1}return!1}var tm=m(256);function am(v){if(v.length<1024)return nm(v);let _=h(v),k=tm.get(_);if(k!==void 0)return k;let E=nm(v);return tm.set(_,E),E}function nm(v){if(v.length>=32768&&!bd(v))return v;let k=new RegExp(`<(${"div|span|p|h[1-6]|td|th|li|a|button|label|section|article|header|footer|main|nav|aside|dd|dt|figcaption|summary|caption|blockquote|pre|code|em|strong|small|sub|sup|time|mark|abbr|cite|q|s|u|b|i"})\\b`,"gi"),E="",T=0,j;while((j=k.exec(v))!==null){let B=j.index,z=B+j[0].length,F=!1,V=!1,H=-1;while(z<v.length){let J=v[z];if(F){if(J==="'")F=!1}else if(V){if(J==='"')V=!1}else if(J==="'")F=!0;else if(J==='"')V=!0;else if(J===">"){H=z;break}z++}if(H===-1)continue;let G=v.slice(B,H+1);if(om.test(G))continue;if(G.includes("x-cloak"))continue;if(Kw(v,H+1))E+=v.slice(T,H)+" x-cloak>",T=H+1}return E+=v.slice(T),E}var Xw=/(?:^|\s)(?::else-if|:if|:else|:show|x-else-if|x-if|x-else|x-show|@if|@show)(?:=|\s|\/|>|$)/,Zw=/<\/script>/gi,Gw=/<\/style>/gi;function cm(v){let _=/<[a-z][\w-]*/gi,k="",E=0,T;while((T=_.exec(v))!==null){let j=T.index,B=T[0].slice(1).toLowerCase();if(B==="script"||B==="style"){let re=B==="script"?Zw:Gw;re.lastIndex=j;let se=re.exec(v);if(se!==null)_.lastIndex=se.index+se[0].length;continue}let z=j+T[0].length,F=!1,V=!1,H=-1;while(z<v.length){let re=v[z];if(F){if(re==="'")F=!1}else if(V){if(re==='"')V=!1}else if(re==="'")F=!0;else if(re==='"')V=!0;else if(re===">"){H=z;break}z++}if(H===-1)continue;let G=v.slice(j+T[0].length,H);if(om.test(G))continue;if(/(?:^|\s)x-cloak(?:=|\s|\/|>|$)/.test(G))continue;if(!Xw.test(G))continue;let J=v[H-1]==="/",ne=J?H-1:H;k+=`${v.slice(E,ne)} x-cloak${J?" ":""}`,E=ne}return k+=v.slice(E),k}var Ol=m(256),Jw=[{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"}],lm=/(?:\/\/|\/\*|\{\{--)\s*stx-strict-ignore(-next-line)?([^\n*}]*)/g;function Yw(v){let _=Array.from(v,(T)=>T===`
2024
+ </style>`;E=E.replace(V,oe),z.lastIndex=0}catch(ie){}}}return E}function ys(v,_){let k=v,E=/@json\s*\(/g,T;while((T=E.exec(k))!==null){let j=T.index,B=j+T[0].length-1,z=1,F=B+1,V=null,H=!1;while(F<k.length&&z>0){let ae=k[F];if(H){H=!1,F++;continue}if(ae==="\\"&&V){H=!0,F++;continue}if(V){if(ae===V)V=null;F++;continue}if(ae==='"'||ae==="'"||ae==="`"){V=ae,F++;continue}if(ae==="(")z++;else if(ae===")"){if(z--,z===0)break}F++}if(z!==0)break;let G=k.substring(B+1,F).trim(),J=k.substring(j,F+1),ne=-1,re=0,se=null,ie=!1;for(let ae=0;ae<G.length;ae++){let me=G[ae];if(ie){ie=!1;continue}if(me==="\\"&&se){ie=!0;continue}if(se){if(me===se)se=null;continue}if(me==='"'||me==="'"||me==="`"){se=me;continue}if(me==="("||me==="["||me==="{")re++;else if(me===")"||me==="]"||me==="}")re--;if(me===","&&re===0){ne=ae;break}}let oe=ne>=0?G.substring(0,ne).trim():G,ue=ne>=0?G.substring(ne+1).trim():void 0;try{let ae=oe.trim(),me;if(p(ae))me=l(ae,Object.keys(_))(...Object.values(_));else me=void 0;let ve;if(ue==="true")ve=JSON.stringify(me,null,2);else ve=JSON.stringify(me);let Se=ve.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029");k=k.substring(0,j)+Se+k.substring(F+1),E.lastIndex=j+Se.length}catch(ae){A.log(ae instanceof Error?ae:Error(String(ae)),{directive:"@json"},"error"),E.lastIndex=j+J.length}}return k}function bs(v){return v.replace(/@once\s*([\s\S]*?)@endonce/g,"$1")}function om(v){let _=v,k=/@memo\s*\(/g,E,T=[];while((E=k.exec(_))!==null){let j=E.index,B=j+E[0].length,z=1,F=B;while(F<_.length&&z>0){if(_[F]==="(")z++;else if(_[F]===")")z--;F++}if(z!==0)continue;let V=_.slice(B,F-1).trim(),H=F,G=_.slice(H),J=G.indexOf("@endmemo");if(J===-1)continue;let ne=G.slice(0,J),re=H+J+8,se=ne.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)/),ie=se?se[0].length:0,oe=ne.slice(ie),ue=ne.match(/(\s*)$/),ae=ue?ue[0].length:0,me=oe.slice(0,oe.length-ae),ve=me.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)?(\/?)>/),Se;if(ve){let[$e,Ce,Ee="",Te]=ve,Re=`<${Ce}${Ee} data-stx-memo="${V}"${Te}>`;Se=ne.slice(0,ie)+Re+me.slice($e.length)+ne.slice(ie+me.length)}else Se=`${ne.slice(0,ie)}<div data-stx-memo="${V}">${me}</div>${ne.slice(ie+me.length)}`;T.push({start:j,end:re,replacement:Se}),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 Ol(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 am(v,_){if(!/\bref\s*=/.test(v))return v;let k=/<\/?([a-zA-Z][\w-]*)\b(?:"[^"]*"|'[^']*'|[^'">])*>/y,E=fr(v,(F,V)=>{k.lastIndex=V;let H=k.exec(F);if(!H||/^(?:script|style)$/i.test(H[1]))return-1;return k.lastIndex}),T=[],j=0,B=0,z=[];for(let{start:F,end:V,token:H}of E){let G=/^<\/?([\w-]+)/.exec(H)[1].toLowerCase();if(H.startsWith("</")){let ne;while(ne=T.pop()){if(ne.scoped)j--;if(ne.name===G)break}continue}let J=/\sdata-stx-scope\s*=/.test(H);if(!j&&!J&&/\s(?:ref|@ref|:ref|x-ref|data-stx-ref)\s*=/.test(H)&&!/\sdata-stx-ref-caller\s*=/.test(H))z.push(v.slice(B,F),H.replace(/\s*\/?>$/,(ne)=>` data-stx-ref-caller="${_}"${ne}`)),B=V;if(!cm.has(G)&&!/\/>$/.test(H)){if(T.push({name:G,scoped:J}),J)j++}}return z.push(v.slice(B)),z.join("")}var cm=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),lm=/(?:^|\s)x-no-cloak(?:=|\s|\/|>|$)/,rm=/<\/?\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 G=v.indexOf(j?"}":"{",E);if(G===-1||G>=F){if(j)B=!1;else T=!1;break}if(G>E)if(j)B=!1;else T=!1;if(j){if(B)return!0;B=!0}else if(T)j=!0,B=!1;else T=!0;E=G+1}E=F;continue}if(v.startsWith("<!--",E)){let G=v.indexOf("-->",E);E=G===-1?v.length:G+3;continue}let V=Xw(v,E);if(V===-1)break;rm.lastIndex=E;let H=rm.exec(v)?.[1]?.toLowerCase()??"";if(v[E+1]==="/"){if(k===0)break;k--}else if(!Kw(v,V)&&!cm.has(H))k++;E=V+1}return!1}var sm=m(256);function um(v){if(v.length<1024)return im(v);let _=h(v),k=sm.get(_);if(k!==void 0)return k;let E=im(v);return sm.set(_,E),E}function im(v){if(v.length>=32768&&!Gu(v))return v;let k=new RegExp(`<(${"div|span|p|h[1-6]|td|th|li|a|button|label|section|article|header|footer|main|nav|aside|dd|dt|figcaption|summary|caption|blockquote|pre|code|em|strong|small|sub|sup|time|mark|abbr|cite|q|s|u|b|i"})\\b`,"gi"),E="",T=0,j;while((j=k.exec(v))!==null){let B=j.index,z=B+j[0].length,F=!1,V=!1,H=-1;while(z<v.length){let J=v[z];if(F){if(J==="'")F=!1}else if(V){if(J==='"')V=!1}else if(J==="'")F=!0;else if(J==='"')V=!0;else if(J===">"){H=z;break}z++}if(H===-1)continue;let G=v.slice(B,H+1);if(lm.test(G))continue;if(G.includes("x-cloak"))continue;if(Zw(v,H+1))E+=v.slice(T,H)+" x-cloak>",T=H+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 dm(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,H=-1;while(z<v.length){let re=v[z];if(F){if(re==="'")F=!1}else if(V){if(re==='"')V=!1}else if(re==="'")F=!0;else if(re==='"')V=!0;else if(re===">"){H=z;break}z++}if(H===-1)continue;let G=v.slice(j+T[0].length,H);if(lm.test(G))continue;if(/(?:^|\s)x-cloak(?:=|\s|\/|>|$)/.test(G))continue;if(!Gw.test(G))continue;let J=v[H-1]==="/",ne=J?H-1:H;k+=`${v.slice(E,ne)} x-cloak${J?" ":""}`,E=ne}return k+=v.slice(E),k}var Nl=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"}],pm=/(?:\/\/|\/\*|\{\{--)\s*stx-strict-ignore(-next-line)?([^\n*}]*)/g;function eS(v){let _=Array.from(v,(T)=>T===`
2025
2025
  `?`
2026
2026
  `:" "),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]!==`
2027
- `)_[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 Qw(v){let _=new Map,k=Yw(v).split(`
2027
+ `)_[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(`
2028
2028
  `),E=v.split(`
2029
- `);return k.forEach((T,j)=>{lm.lastIndex=0;for(let B of T.matchAll(lm)){let z=B[1]==="-next-line",F=(E[j]??"").slice(0,B.index).trim(),V=z||F===""?j+2:j+1,G=(B[2]??"").split("--")[0].split(/[\s,]+/).filter(Boolean),J=G.filter((re)=>/\w/.test(re));if(G.length>0&&J.length===0)continue;let ne=_.get(V);if(ne&&ne.size===0)continue;if(J.length===0){_.set(V,new Set);continue}if(ne)J.forEach((re)=>ne.add(re));else _.set(V,new Set(J))}}),_}function eS(v,_,k){let E=v.get(_);if(!E)return!1;if(E.size===0)return!0;return[...E].some((T)=>k.includes(T))}function ws(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=Ol.get(j);if(B!==void 0){if(B&&T.failOnViolation)throw Error(B);return}let z=T.allowPatterns??[],F=Qw(v),V=[],H=s(v.replace(/\{\{--[\s\S]*?--\}\}/g,(re)=>re.replace(/[^\n]/g," ")));for(let{pattern:re,message:se,suggestion:ie}of Jw){if(z.some((de)=>/\w/.test(de)&&se.includes(de)))continue;re.lastIndex=0;let oe=H.match(re);if(oe&&oe.length>0){let de=H.split(`
2029
+ `);return k.forEach((T,j)=>{pm.lastIndex=0;for(let B of T.matchAll(pm)){let z=B[1]==="-next-line",F=(E[j]??"").slice(0,B.index).trim(),V=z||F===""?j+2:j+1,G=(B[2]??"").split("--")[0].split(/[\s,]+/).filter(Boolean),J=G.filter((re)=>/\w/.test(re));if(G.length>0&&J.length===0)continue;let ne=_.get(V);if(ne&&ne.size===0)continue;if(J.length===0){_.set(V,new Set);continue}if(ne)J.forEach((re)=>ne.add(re));else _.set(V,new Set(J))}}),_}function 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 ws(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=Nl.get(j);if(B!==void 0){if(B&&T.failOnViolation)throw Error(B);return}let z=T.allowPatterns??[],F=tS(v),V=[],H=s(v.replace(/\{\{--[\s\S]*?--\}\}/g,(re)=>re.replace(/[^\n]/g," ")));for(let{pattern:re,message:se,suggestion:ie}of Qw){if(z.some((ue)=>/\w/.test(ue)&&se.includes(ue)))continue;re.lastIndex=0;let oe=H.match(re);if(oe&&oe.length>0){let ue=H.split(`
2030
2030
  `),ae=v.split(`
2031
- `),me=[];if(de.forEach((Ce,Ee)=>{if(re.lastIndex=0,re.test(Ce)&&!eS(F,Ee+1,se))me.push(Ee+1)}),me.length===0&&de.some((Ce)=>(re.lastIndex=0,re.test(Ce))))continue;let ve=me.length>0?` (script line${me.length>1?"s":""} ${me.join(", ")})`:"",Se=me.slice(0,3).map((Ce)=>` ${Ce} | ${(ae[Ce-1]??"").trim().slice(0,100)}`).join(`
2031
+ `),me=[];if(ue.forEach((Ce,Ee)=>{if(re.lastIndex=0,re.test(Ce)&&!nS(F,Ee+1,se))me.push(Ee+1)}),me.length===0&&ue.some((Ce)=>(re.lastIndex=0,re.test(Ce))))continue;let ve=me.length>0?` (script line${me.length>1?"s":""} ${me.join(", ")})`:"",Se=me.slice(0,3).map((Ce)=>` ${Ce} | ${(ae[Ce-1]??"").trim().slice(0,100)}`).join(`
2032
2032
  `),$e=Se?`
2033
2033
  ${Se}`:"";V.push(` \u2717 ${se}${ve}
2034
- \u2192 ${ie}${$e}`)}}if(V.length===0){Ol.set(j,"");return}let G=(re)=>{let se=`${process.cwd()}/`;return re.startsWith(se)?re.slice(se.length):re},ne=`[STX] DOM API violation in ${E&&E!==_?`${G(E)} (composed into ${G(_)})`:G(_)}:
2034
+ \u2192 ${ie}${$e}`)}}if(V.length===0){Nl.set(j,"");return}let G=(re)=>{let se=`${process.cwd()}/`;return re.startsWith(se)?re.slice(se.length):re},ne=`[STX] DOM API violation in ${E&&E!==_?`${G(E)} (composed into ${G(_)})`:G(_)}:
2035
2035
  ${V.join(`
2036
2036
  `)}
2037
- Tip: prefer useRef(), navigate(), and composables for component code`;if(Ol.set(j,ne),T.failOnViolation)throw Error(ne);else console.warn(ne)}import Nl from"path";var tS=/(\bfrom\s*|\bimport\s*\(\s*|\bimport\s+)(['"])(\.\.?\/[^'"]*)\2/g,nS=/(<script\b[^>]*>)([\s\S]*?)(<\/script>)/gi;function rS(v,_){if(!_||!v.includes("/"))return v;let k=Nl.dirname(_);return v.replace(tS,(E,T,j,B)=>{let z=Nl.resolve(k,B);return`${T}${j}${z.split(Nl.sep).join("/")}${j}`})}function um(v,_){if(!_||!v.includes("<script"))return v;return v.replace(nS,(k,E,T,j)=>`${E}${rS(T,_)}${j}`)}var Mr="<!--PARENT_CONTENT_PLACEHOLDER-->";function dm(v){return v.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function xm(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(`
2037
+ Tip: prefer useRef(), navigate(), and composables for component code`;if(Nl.set(j,ne),T.failOnViolation)throw Error(ne);else console.warn(ne)}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 fm(v,_){if(!_||!v.includes("<script"))return v;return v.replace(sS,(k,E,T,j)=>`${E}${iS(T,_)}${j}`)}var Mr="<!--PARENT_CONTENT_PLACEHOLDER-->";function gm(v){return v.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function wm(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(`
2038
2038
  `,E+2),E===-1)return-1;E+=1,T=!0;continue}if(z==="/"&&v[E+1]==="*"){let F=v.indexOf("*/",E+2);if(F===-1)return-1;E=F+2,T=!0;continue}if(z==="/"&&T){let F=E+1,V=!1;while(F<k){let H=v[F];if(H==="\\"){F+=2;continue}if(H==="[")V=!0;else if(H==="]")V=!1;else if(H==="/"&&!V){F++;break}else if(H===`
2039
2039
  `){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]===`
2040
- `)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 bm(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 iS=4096;async function pm(v,_,k){if(k.buildMode!=="serve"||_.length<iS)return null;let{registerServeModuleBundle:E}=await import("./chunk-se4b8sjc.js");return`<script ${v} src="${E(_)}"></script>`}async function fm(v,_,k){try{let{registeredModuleIdsIn:E,buildModuleRegistryScript:T}=await ut("stx/client-module-registry",()=>import("./chunk-81nqrcn0.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-se4b8sjc.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 oS(v,_=""){let k=bm(v,"data-stx-runtime");if(!k)return v;let E=Gs(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)+_+`
2040
+ `)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 Sm(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 mm(v,_,k){if(k.buildMode!=="serve"||_.length<aS)return null;let{registerServeModuleBundle:E}=await import("./chunk-695de40v.js");return`<script ${v} src="${E(_)}"></script>`}async function hm(v,_,k){try{let{registeredModuleIdsIn:E,buildModuleRegistryScript:T}=await ut("stx/client-module-registry",()=>import("./chunk-a6amx427.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-695de40v.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=Sm(v,"data-stx-runtime");if(!k)return v;let E=Gs(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)+_+`
2041
2041
  `+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=Gs(j);if(B===-1)return T+_+`
2042
2042
  `+j;return j.slice(0,B)+T+_+`
2043
- `+j.slice(B)}function aS(v){let _=/\x00STX_ESC_MUSTACHE_OPEN\x00([\s\S]*?)\x00STX_ESC_MUSTACHE_CLOSE\x00/g;return v.replace(_,(k,E,T)=>{let j=v.slice(0,T);return j.lastIndexOf("<")>j.lastIndexOf(">")?`{{${E}}}`:`{<!--stx-literal-->{${E}}}`})}async function n(v,_,k,E,T){if(E.ssr===!1&&!E.autoShell&&E.buildMode==="spa")return v;if(_.__stx_signals_gate===void 0)_.__stx_signals_gate=ye(v,k);let j=!_.__stxProcessingDepth;sn(_);for(let B of E._layerGraph?.configDependencies??[])T.add(B);if(j&&E.runtimeConfig)await ln(_,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=Sl(),_.__stx_seo_staged=!1;if(!_.__stxProcessingDepth)_.__stxProcessingDepth=0;if(_.__stxProcessingDepth++,!_.__onceStore)_.__onceStore=new Set;if((E.debug||!ge()&&!gn())&&k&&k.endsWith(".stx"))js(v,k);try{return await U.timeAsync("template-processing",async()=>{let B=await cS(v,_,k,E,T);if(j)B=Ml(B);if(j&&E.autoShell&&E.buildMode!=="compile"){let z=pe(E.app?.head,{known:dn,source:"app.head"}),V=(_.__stx_runtime_head||null)??Rs(),H=(_.__stx_head_raw||"").trim(),G,J=H.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(J)G=J[1].trim(),H=H.replace(J[0],"").trim();let ne=_.__sections?.title,re=V.title||G||ne,se=!V.title&&(!!G||!!ne),ie=V.meta||[],oe=new Set(ie.map(($e)=>wr($e)).filter(Boolean)),de={...z,...re&&{title:re},meta:[...(z.meta||[]).filter(($e)=>!oe.has(wr($e))),...ie],link:[...z.link||[],...V.link||[]],script:[...z.script||[],...V.script||[]],headRaw:[z.headRaw,H].filter(Boolean).join(`
2044
- `),...V.htmlAttrs&&{htmlAttrs:Dg(z.htmlAttrs,V.htmlAttrs)},...V.bodyAttrs&&{bodyAttrs:{...z.bodyAttrs||{},...V.bodyAttrs}}},ae=Tl(B);if(B=Wn(B,de,{...se&&{titleIsHtml:!0},...E.app?.colorMode&&{colorMode:E.app.colorMode}},ae),ae)B=Og(B,z),B=Un(B,de.htmlAttrs);let me=B.match(/<!-- stx-layout: ([^ ]+) -->/);if(me&&B.includes("<head")){let $e=me[1],Ce=ur($e);B=B.replace(/<head\b[^>]*>/i,(Ee)=>`${Ee}
2045
- <meta name="stx-layout" content="${dm($e)}">
2046
- <meta name="stx-layout-group" content="${dm(Ce)}">`)}let ve=B.match(/function (__stx_setup_\w+)\(/),Se=ve?An(B):null;if(ve&&Se&&!/\bdata-stx=/.test(Se.tag)){B=vs(B,(Ce,Ee)=>`<body${Ee} data-stx="${ve[1]}">`);let $e=new RegExp(`(<(?!body)[a-zA-Z][^>]*) data-stx="${ve[1]}"`,"i");B=B.replace($e,"$1")}}if(j){let z=_.__stx_head_injections??Sl(),F=Mg(B);if(F!==null)z.beforeClose.push(F);let V=_g(B);if(V!==null)z.afterOpen.push(V);if(E.offline?.enabled&&!B.includes("data-stx-offline"))z.beforeClose.push(kg);B=vg(B,z);let H=E.app?.colorMode;if(H)B=Vn(B,H)}if(j)if(bm(B,"data-stx-runtime")){let F=null,V=null,H=null,G=null,J=null;try{let{getStoreScript:re}=await ut("stx/store-loader",()=>import("./chunk-m5asyydz.js")),se=E.storesDir,ie=await re(se);if(ie)H=`<script data-stx-stores>${ie}</script>`,V=await pm("data-stx-stores",ie,E)??H}catch{}F=await fm([B,H],E,T);try{let{getFrameworkComposableScript:re}=await ut("stx/framework-composables",()=>import("./chunk-c9fj7t9b.js"));J=await re(B)}catch{}try{let{getComposableScript:re}=await ut("stx/composable-loader",()=>import("./chunk-5jak1hxp.js")),se=E.composablesDir,ie=[F,H,J].filter((de)=>de!==null),oe=await re(E._layerComposableDirs??se,B,ie);if(oe)G=await pm('data-stx-scoped data-stx-run="always" data-stx-composables',oe,E)??`<script data-stx-scoped data-stx-run="always" data-stx-composables>${oe}</script>`}catch{}let ne=[F,V,G,J].filter((re)=>re!==null).map((re)=>`
2047
- ${re}`).join("");B=oS(B,ne)}else{let F=await fm([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+`
2048
- `+B.slice(V)}}if(j)B=$g(B);if(j&&_.__stx_inject_css!==!1)B=await f(B,void 0,E.buildMode==="serve",!0);else if(j)B=Xs(B);if(B=B.replace(/\x00STX_ESCAPED_AT\x00/g,"@"),B=aS(B),j&&_.__stx_runtime_config)B=Ke(B,_.__stx_runtime_config);if(j&&!_.__stx_defer_server_data){let z=Hn(_);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 sr)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(A.log(F,{filePath:k,context:_}),_t.logDetailedError(F,{filePath:k,template:v.substring(0,500)}),E.debug)throw F;return As.createFallbackContent("Template Processing",F)}}async function cS(v,_,k,E,T){let j=process.cwd(),B={...E,partialsDir:E.partialsDir&&!Jt.isAbsolute(E.partialsDir)?Jt.resolve(j,E.partialsDir):E.partialsDir,componentsDir:E.componentsDir&&!Jt.isAbsolute(E.componentsDir)?Jt.resolve(j,E.componentsDir):E.componentsDir,layoutsDir:E.layoutsDir&&!Jt.isAbsolute(E.layoutsDir)?Jt.resolve(j,E.layoutsDir):E.layoutsDir},z=B,F=v;await dS(k,_),uS(_,z),F=await te(()=>lg(F,_,k,z),F,(ve)=>{A.log(ve,{filePath:k,phase:"pre-processing-middleware"},"warning"),console.warn(`[stx] pre-processing middleware failed for ${k}: ${ve.message}`)}),F=F.replace(/\{\{--[\s\S]*?--\}\}/g,"");let V=En(F,Le,(ve,Se)=>`\x00STX_HTML_COMMENT_${Se}\x00`);F=V.output;let H=V.tokens,G=(ve)=>H.length===0?ve:ve.replace(/\x00STX_HTML_COMMENT_(\d+)\x00/g,(Se,$e)=>H[Number($e)]??""),J="\x00STX_ESCAPED_AT\x00",ne="\x00STX_ESC_MUSTACHE_OPEN\x00",re="\x00STX_ESC_MUSTACHE_CLOSE\x00";F=F.replace(/@@/g,J),F=F.replace(/@\{\{([\s\S]*?)\}\}/g,(ve,Se)=>`${ne}${Se}${re}`),F=gg(F),F=await Qg(F,k,T);let se={};F=gs(F,se);let ie={..._.__sections||{}},oe="",de=mp(je(v)),ae=/@nolayout\b/.test(F)||de===!1;if(/@nolayout\b/.test(F))F=F.replace(/@nolayout\b\s*/g,"");let me=F.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(me)oe=me[1],F=F.replace(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/g,"");else if(typeof de==="string"){if(oe=de,!/@section\s*\(/.test(F))F=`@section('content')
2043
+ `+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=ye(v,k);let j=!_.__stxProcessingDepth;sn(_);for(let B of E._layerGraph?.configDependencies??[])T.add(B);if(j&&E.runtimeConfig)await ln(_,k,E.runtimeConfig);if(j)zu(_),_.__stx_scope_seq??={n:0,key:Bun.hash(String(_.__filename??k)).toString(36).slice(0,6)},_.__stx_head_injections=$l(),_.__stx_seo_staged=!1;if(!_.__stxProcessingDepth)_.__stxProcessingDepth=0;if(_.__stxProcessingDepth++,!_.__onceStore)_.__onceStore=new Set;if((E.debug||!ge()&&!gn())&&k&&k.endsWith(".stx"))js(v,k);try{return await U.timeAsync("template-processing",async()=>{let B=await uS(v,_,k,E,T);if(j)B=Ol(B);if(j&&E.autoShell&&E.buildMode!=="compile"){let z=pe(E.app?.head,{known:un,source:"app.head"}),V=(_.__stx_runtime_head||null)??Rs(),H=(_.__stx_head_raw||"").trim(),G,J=H.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(J)G=J[1].trim(),H=H.replace(J[0],"").trim();let ne=_.__sections?.title,re=V.title||G||ne,se=!V.title&&(!!G||!!ne),ie=V.meta||[],oe=new Set(ie.map(($e)=>wr($e)).filter(Boolean)),ue={...z,...re&&{title:re},meta:[...(z.meta||[]).filter(($e)=>!oe.has(wr($e))),...ie],link:[...z.link||[],...V.link||[]],script:[...z.script||[],...V.script||[]],headRaw:[z.headRaw,H].filter(Boolean).join(`
2044
+ `),...V.htmlAttrs&&{htmlAttrs:Ng(z.htmlAttrs,V.htmlAttrs)},...V.bodyAttrs&&{bodyAttrs:{...z.bodyAttrs||{},...V.bodyAttrs}}},ae=Al(B);if(B=Wn(B,ue,{...se&&{titleIsHtml:!0},...E.app?.colorMode&&{colorMode:E.app.colorMode}},ae),ae)B=Lg(B,z),B=Un(B,ue.htmlAttrs);let me=B.match(/<!-- stx-layout: ([^ ]+) -->/);if(me&&B.includes("<head")){let $e=me[1],Ce=dr($e);B=B.replace(/<head\b[^>]*>/i,(Ee)=>`${Ee}
2045
+ <meta name="stx-layout" content="${gm($e)}">
2046
+ <meta name="stx-layout-group" content="${gm(Ce)}">`)}let ve=B.match(/function (__stx_setup_\w+)\(/),Se=ve?An(B):null;if(ve&&Se&&!/\bdata-stx=/.test(Se.tag)){B=fs(B,(Ce,Ee)=>`<body${Ee} data-stx="${ve[1]}">`);let $e=new RegExp(`(<(?!body)[a-zA-Z][^>]*) data-stx="${ve[1]}"`,"i");B=B.replace($e,"$1")}}if(j){let z=_.__stx_head_injections??$l(),F=jg(B);if(F!==null)z.beforeClose.push(F);let V=Cg(B);if(V!==null)z.afterOpen.push(V);if(E.offline?.enabled&&!B.includes("data-stx-offline"))z.beforeClose.push(Rg);B=Sg(B,z);let H=E.app?.colorMode;if(H)B=Vn(B,H)}if(j)if(Sm(B,"data-stx-runtime")){let F=null,V=null,H=null,G=null,J=null;try{let{getStoreScript:re}=await ut("stx/store-loader",()=>import("./chunk-kyda9myt.js")),se=E.storesDir,ie=await re(se);if(ie)H=`<script data-stx-stores>${ie}</script>`,V=await mm("data-stx-stores",ie,E)??H}catch{}F=await hm([B,H],E,T);try{let{getFrameworkComposableScript:re}=await ut("stx/framework-composables",()=>import("./chunk-yv00fy8z.js"));J=await re(B)}catch{}try{let{getComposableScript:re}=await ut("stx/composable-loader",()=>import("./chunk-b5mfa6w6.js")),se=E.composablesDir,ie=[F,H,J].filter((ue)=>ue!==null),oe=await re(E._layerComposableDirs??se,B,ie);if(oe)G=await mm('data-stx-scoped data-stx-run="always" data-stx-composables',oe,E)??`<script data-stx-scoped data-stx-run="always" data-stx-composables>${oe}</script>`}catch{}let ne=[F,V,G,J].filter((re)=>re!==null).map((re)=>`
2047
+ ${re}`).join("");B=cS(B,ne)}else{let F=await hm([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+`
2048
+ `+B.slice(V)}}if(j)B=Eg(B);if(j&&_.__stx_inject_css!==!1)B=await f(B,void 0,E.buildMode==="serve",!0);else if(j)B=Ks(B);if(B=B.replace(/\x00STX_ESCAPED_AT\x00/g,"@"),B=lS(B),j&&_.__stx_runtime_config)B=Ke(B,_.__stx_runtime_config);if(j&&!_.__stx_defer_server_data){let z=Hn(_);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 sr)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(A.log(F,{filePath:k,context:_}),_t.logDetailedError(F,{filePath:k,template:v.substring(0,500)}),E.debug)throw F;return As.createFallbackContent("Template Processing",F)}}async function uS(v,_,k,E,T){let j=process.cwd(),B={...E,partialsDir:E.partialsDir&&!Jt.isAbsolute(E.partialsDir)?Jt.resolve(j,E.partialsDir):E.partialsDir,componentsDir:E.componentsDir&&!Jt.isAbsolute(E.componentsDir)?Jt.resolve(j,E.componentsDir):E.componentsDir,layoutsDir:E.layoutsDir&&!Jt.isAbsolute(E.layoutsDir)?Jt.resolve(j,E.layoutsDir):E.layoutsDir},z=B,F=v;await fS(k,_),pS(_,z),F=await te(()=>dg(F,_,k,z),F,(ve)=>{A.log(ve,{filePath:k,phase:"pre-processing-middleware"},"warning"),console.warn(`[stx] pre-processing middleware failed for ${k}: ${ve.message}`)}),F=F.replace(/\{\{--[\s\S]*?--\}\}/g,"");let V=En(F,Le,(ve,Se)=>`\x00STX_HTML_COMMENT_${Se}\x00`);F=V.output;let H=V.tokens,G=(ve)=>H.length===0?ve:ve.replace(/\x00STX_HTML_COMMENT_(\d+)\x00/g,(Se,$e)=>H[Number($e)]??""),J="\x00STX_ESCAPED_AT\x00",ne="\x00STX_ESC_MUSTACHE_OPEN\x00",re="\x00STX_ESC_MUSTACHE_CLOSE\x00";F=F.replace(/@@/g,J),F=F.replace(/@\{\{([\s\S]*?)\}\}/g,(ve,Se)=>`${ne}${Se}${re}`),F=hg(F),F=await nm(F,k,T);let se={};F=gs(F,se);let ie={..._.__sections||{}},oe="",ue=yp(je(v)),ae=/@nolayout\b/.test(F)||ue===!1;if(/@nolayout\b/.test(F))F=F.replace(/@nolayout\b\s*/g,"");let me=F.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(me)oe=me[1],F=F.replace(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/g,"");else if(typeof ue==="string"){if(oe=ue,!/@section\s*\(/.test(F))F=`@section('content')
2049
2049
  ${F.trim()}
2050
2050
  @endsection`}if(!oe&&!ae&&z.defaultLayout){let ve=on(F),Se=/@section\s*\(/.test(F);if(!ve||Se){let $e="",Ce=Jt.dirname(k),Ee=z.layoutsDir?Jt.dirname(z.layoutsDir):process.cwd();for(let Te=0;Te<20;Te++){let Re=Jt.join(Ce,"_layout.stx");if(await r(Re)){$e=Re;break}let _e=Jt.dirname(Ce);if(_e===Ce||_e.length<Ee.length)break;Ce=_e}if($e)oe=$e;else if(z.layoutsDir){let Te=Jt.isAbsolute(z.layoutsDir)?z.layoutsDir:Jt.resolve(process.cwd(),z.layoutsDir),Re=Jt.join(Te,`${z.defaultLayout}.stx`);if(await r(Re))oe=Re}if(oe&&!Se)F=`@section('content')
2051
2051
  ${F.trim()}
2052
- @endsection`}}if(oe&&F.includes("<script")){let ve=xn(F),Se=ve.scripts.map(($e)=>gm($e,k)??$e);F=Hr(ve.output,Se)}if(F=F.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(ve,Se,$e)=>(ie[Se]=$e,"")),F=F.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*([^)]+?)\s*\)/g,(ve,Se,$e)=>{if(/^(['"]).*\1$/.test($e.trim()))return ve;try{let Ce=c($e.trim(),_);if(Ce===void 0)return ve;return ie[Se]=String(Ce??""),""}catch{return ve}}),F=F.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@endsection|@show)/g,(ve,Se,$e)=>{if($e.includes("@parent"))ie[Se]=$e.replace("@parent",Mr);else ie[Se]=$e.trim();return""}),_.__sections=ie,F=F.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"])?\)/g,(ve,Se,$e)=>ie[Se]||$e||""),!("slot"in _)||_.slot===void 0)F=F.replace(/\{\{\s*slot\s*\}\}/g,()=>ie.content||"");if(F=ms(F,se),oe){let ve=[],Se=xn(F),$e=En(Se.output,Ur,(Ce,Ee)=>`\x00STX_ORPHAN_STYLE_${Ee}\x00`);if(F=$e.output.replace(/\x00STX_(SCRIPT|ORPHAN_STYLE)_(\d+)\x00/g,(Ce,Ee,Te)=>{let Re=Ee==="SCRIPT"?gm(Se.scripts[Number(Te)],k):$e.tokens[Number(Te)];if(Re)ve.push(Re);return""}),ve.length>0){let Ce=ve.join(`
2052
+ @endsection`}}if(oe&&F.includes("<script")){let ve=xn(F),Se=ve.scripts.map(($e)=>ym($e,k)??$e);F=Hr(ve.output,Se)}if(F=F.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(ve,Se,$e)=>(ie[Se]=$e,"")),F=F.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*([^)]+?)\s*\)/g,(ve,Se,$e)=>{if(/^(['"]).*\1$/.test($e.trim()))return ve;try{let Ce=c($e.trim(),_);if(Ce===void 0)return ve;return ie[Se]=String(Ce??""),""}catch{return ve}}),F=F.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@endsection|@show)/g,(ve,Se,$e)=>{if($e.includes("@parent"))ie[Se]=$e.replace("@parent",Mr);else ie[Se]=$e.trim();return""}),_.__sections=ie,F=F.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"])?\)/g,(ve,Se,$e)=>ie[Se]||$e||""),!("slot"in _)||_.slot===void 0)F=F.replace(/\{\{\s*slot\s*\}\}/g,()=>ie.content||"");if(F=ms(F,se),oe){let ve=[],Se=xn(F),$e=En(Se.output,Ur,(Ce,Ee)=>`\x00STX_ORPHAN_STYLE_${Ee}\x00`);if(F=$e.output.replace(/\x00STX_(SCRIPT|ORPHAN_STYLE)_(\d+)\x00/g,(Ce,Ee,Te)=>{let Re=Ee==="SCRIPT"?ym(Se.scripts[Number(Te)],k):$e.tokens[Number(Te)];if(Re)ve.push(Re);return""}),ve.length>0){let Ce=ve.join(`
2053
2053
  `);ie.content=ie.content?`${ie.content}
2054
- ${Ce}`:Ce,_.__sections=ie}}if(oe)try{let ve;if(Jt.isAbsolute(oe))ve=oe,T.add(oe);else ve=await te(()=>Kn(oe,k,B,T),null,()=>{throw new X(`Failed to resolve layout path: ${oe}`,k,void 0,void 0,`Layout referenced from ${k}`)});if(!ve){let Re=(Xe)=>{if(!Xe)return[];try{let Pe=Jt.isAbsolute(Xe)?Xe:Jt.resolve(process.cwd(),Xe);return sS.readdirSync(Pe).filter((Ie)=>Ie.endsWith(".stx")).map((Ie)=>Ie.replace(/\.stx$/,""))}catch{return[]}},_e=[...Re(B.layoutsDir),...Re(B.fallbackLayoutsDir)].filter((Xe,Pe,Ie)=>Ie.indexOf(Xe)===Pe).sort(),Ae=`Layout not found: ${oe} (referenced from ${k})`+(_e.length>0?`. Available layouts: ${_e.join(", ")}`:B.layoutsDir?`. No .stx layouts found in ${B.layoutsDir}`:"");if(A.log(Error(Ae),{layoutPath:oe,filePath:k,available:_e},"error"),console.error(`[stx] ${Ae}`),B.debug)throw new X(Ae,k);return F}let Se=await te(()=>Bun.file(ve).text(),"",()=>{throw new X(`Failed to read layout file: ${ve}`,k,void 0,void 0,"Layout content could not be loaded")});Se=um(Se,ve);let $e=Se.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if($e){if(B.debug)console.log(`Found nested layout: ${$e[1]} in ${ve}`);let Re={},_e=Se.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(Pe,Ie,Ze)=>(Re[Ie]=Ze.trim(),""));for(let[Pe,Ie]of Object.entries(Re))if(ie[Pe]&&ie[Pe].includes(Mr)){let Ze=ie[Pe].indexOf(Mr);ie[Pe]=ie[Pe].slice(0,Ze)+Ie+ie[Pe].slice(Ze+Mr.length)}else if(!ie[Pe])ie[Pe]=Ie;let Ae={..._,__sections:ie},Xe=`@layout('${$e[1]}')${_e}`;return await n(Xe,Ae,ve,B,T)}let Ce=Se.replace(/\{\{--[\s\S]*?--\}\}/g,""),Ee=gs(Ce,se),Te={};return Ee=Ee.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(Re,_e,Ae)=>(Te[_e]=Ae.trim(),`@slot('${_e}')`)),Ee=Ee.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(Re,_e,Ae)=>{if(ie[_e]){let Xe=ie[_e];if(Xe.includes(Mr)){let Pe=Te[_e]||"",Ie=Xe.indexOf(Mr);Xe=Xe.slice(0,Ie)+Pe+Xe.slice(Ie+Mr.length)}return Xe}return Ae||""}),Ee=lS(Ee,ie),Ee=Ee.replace(/\{\{\s*slot\s*\}\}/g,()=>ie.content||""),Ee=ms(Ee,se),_.__originalFilePath=k,F=await ym(Ee,_,ve,B,T),F=`<!-- stx-layout: ${oe} -->
2055
- ${F}`,G(F)}catch(ve){return A.log(ve instanceof Error?ve:Error(String(ve)),{layoutPath:oe,filePath:k},"error"),`[Error processing layout: ${ve instanceof Error?ve.message:String(ve)}]`}return G(await ym(F,_,k,B,T))}function lS(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 uS(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 dS(v,_){await te(()=>pg(v,_),void 0,(k)=>{A.log(k,{filePath:v,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${v}: ${k.message}`)})}var jl="data-stx-source";function gm(v,_){if(!v)return v;let k=/^<script\b([^>]*)>/i.exec(v);if(!k||!/\bserver\b/.test(k[1])||k[1].includes(jl))return v;return`<script ${jl}="${encodeURIComponent(_)}"${v.slice(7)}`}function pS(v){let _=new RegExp(`${jl}="([^"]*)"`).exec(v);return _?decodeURIComponent(_[1]):void 0}function mm(v){return v.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function hm(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">${mm(v)}</span><span style="display:block;margin-top:4px">${mm(k)}</span></div>`}async function fS(v,_,k,E){let{scanScriptTags:T}=await ut("stx/signal-processing",()=>import("./chunk-q9yhnqe5.js")),j=[],B=!ge()&&!gn();for(let F of T(v)){let V=F.attrs;if(!/\bserver\b/.test(V))continue;let H=F.start+F.fullMatch.indexOf(">")+1,G=xm(v,H);if(G===-1)continue;let J=v.slice(H,G);if(!J.trim())continue;let ne=pS(V)??k,re={index:F.start,length:G+9-F.start};try{let{extractVariables:se}=await ut("stx/variable-extractor",()=>import("./chunk-7ppykfx2.js"));await se(J,_,ne,{preserveExisting:!0,onFailure:(ie)=>{if(ie.kind==="unknown")return;if(E?.onServerScriptError?.({sourcePath:ne,kind:ie.kind,message:ie.message}),!B)return;j.push({...re,markup:hm(ne,ie.kind,ie.message)})}})}catch(se){let ie=se instanceof Error?se:Error(String(se));if(A.log(ie,{filePath:ne,phase:"server-script-extraction"},"warning"),console.warn(`[stx] server <script> extraction failed in ${ne}: ${ie.message}`),B)j.push({...re,markup:hm(ne,"unknown",ie.message)})}}if(j.length===0)return v;let z=v;for(let F of j.sort((V,H)=>H.index-V.index))z=z.slice(0,F.index)+F.markup+z.slice(F.index+F.length);return z}async function gS(v,_,k){try{let{interpolateScriptsInTemplate:E}=await ut("stx/expressions",()=>import("./chunk-82nw3942.js"));return E(v,_,{skipServer:!0})}catch(E){let T=E instanceof Error?E:Error(String(E));return A.log(T,{filePath:k,phase:"script-expression-interpolation"},"warning"),console.warn(`[stx] script expression interpolation failed in ${k}: ${T.message}`),v}}async function ym(v,_,k,E,T){let j=v,B=E;if(j=await fS(j,_,k,E),j=await gS(j,_,k),j=await Jf(j,_,k),j=await Yf(j,_,k),j=await Ap(j,_,k,B),ye(j))j=ei(j,_),j=ls(j,_),j=cs(j,_);j=ti(j);let{processStreamDirectives:z}=await ut("stx/streaming",()=>import("./chunk-q0w6a9hv.js"));j=z(j,_),j=ii(j,_,k,B,!0),j=await xg(j,_,k,B,T),j=await os(j,_,k,B,T),j=uu(j,_,k,B);let{processDeferDirectives:F}=await ut("stx/defer",()=>import("./chunk-yed9c66h.js"));j=F(j,_,k);let{processTeleportDirectives:V}=await ut("stx/teleport",()=>import("./chunk-w0vrmvh7.js"));j=V(j,_,k);let{processTransitionDirectives:H,processTransitionAttributes:G}=await ut("stx/transitions",()=>import("./chunk-5y4qxmaw.js"));j=H(j,_,k),j=G(j);let{processErrorBoundaryDirectives:J,stripRenderFailedMarkers:ne}=await ut("stx/error-boundaries",()=>import("./chunk-h85hrwkq.js"));j=J(j,_,k),j=ne(j);let{processSuspenseDirectives:re}=await ut("stx/suspense",()=>import("./chunk-st1s30tn.js"));j=re(j,_,k);let{processAsyncDirectives:se}=await ut("stx/async-components",()=>import("./chunk-3gbjppvg.js"));j=se(j,_,k);let{processKeepAliveDirectives:ie}=await ut("stx/keep-alive",()=>import("./chunk-v7ahbhbd.js"));j=ie(j,_,k);let{processVirtualListDirectives:oe,processVirtualGridDirectives:de,processInfiniteListDirectives:ae}=await ut("stx/virtual-scrolling",()=>import("./chunk-j338fs8k.js"));j=oe(j,_,k),j=de(j,_,k),j=ae(j,_,k);let{processPartialHydrationDirectives:me,processStaticDirectives:ve}=await ut("stx/partial-hydration",()=>import("./chunk-8mxjd1ge.js"));j=me(j,_,k),j=ve(j);let{processComputedDirectives:Se,processWatchDirectives:$e}=await ut("stx/computed",()=>import("./chunk-1xdzcy9d.js"));j=Se(j,_,k),j=$e(j,_,k);let{processFormValidationDirectives:Ce}=await ut("stx/forms-validation",()=>import("./chunk-fe5xht52.js"));j=Ce(j,_,k);let{processHeadDirective:Ee,processTitleDirective:Te,processMetaDirective:Re,resetHead:_e}=await ut("stx/head",()=>import("./chunk-4aw47rmg.js"));if(!_.__stx_head_preset&&!_.__stx_runtime_head)_e();let Ae=Ee(j);if(j=Ae.content,Ae.headContent)_.__stx_head_raw=`${_.__stx_head_raw||""}${Ae.headContent}
2056
- `;if(j=Te(j,_),j=Re(j,_,k),j=dg(j),j=Dc(j,_),j=Tp(j),j=ag(j),j=await ps(j,_,k,B,T),j=await os(j,_,k,B,T),_.__stxProcessingDepth===1)j=ud(j,_);if(j=j.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/g,""),j=Ml(j),j=ar(j,_,k),j=ds(j),j=hp(j,_,{filePath:k,buildMode:B.buildMode}),j=Mc(j,_),j=Oc(j,_),j=ao(j,_),j=jp(j,_),j=Lp(j,_),j=await wm(j,_,k,B),j=await vm(j,_,k),j=await di(j,_,k,B),j=pi(j,_,k,B),j=Cs(j,_,k,B),j=$s(j,_,k),j=Es(j,_,k,B),j=Cp(j,_,k,B),j=ys(j,_),j=bs(j),j=rm(j),!B.skipEventDirectives)j=qu(j,_,k);if(j=bp(j,_,k),B.debug){let tt=/\bx-data\s*=/.test(j),it=as(v);if(tt&&it)console.warn(`[stx] ${k}: Template mixes Alpine-style (x-data) and signals (state/derived/effect) reactivity.
2054
+ ${Ce}`:Ce,_.__sections=ie}}if(oe)try{let ve;if(Jt.isAbsolute(oe))ve=oe,T.add(oe);else ve=await te(()=>Kn(oe,k,B,T),null,()=>{throw new X(`Failed to resolve layout path: ${oe}`,k,void 0,void 0,`Layout referenced from ${k}`)});if(!ve){let Re=(Xe)=>{if(!Xe)return[];try{let Pe=Jt.isAbsolute(Xe)?Xe:Jt.resolve(process.cwd(),Xe);return oS.readdirSync(Pe).filter((Ie)=>Ie.endsWith(".stx")).map((Ie)=>Ie.replace(/\.stx$/,""))}catch{return[]}},_e=[...Re(B.layoutsDir),...Re(B.fallbackLayoutsDir)].filter((Xe,Pe,Ie)=>Ie.indexOf(Xe)===Pe).sort(),Ae=`Layout not found: ${oe} (referenced from ${k})`+(_e.length>0?`. Available layouts: ${_e.join(", ")}`:B.layoutsDir?`. No .stx layouts found in ${B.layoutsDir}`:"");if(A.log(Error(Ae),{layoutPath:oe,filePath:k,available:_e},"error"),console.error(`[stx] ${Ae}`),B.debug)throw new X(Ae,k);return F}let Se=await te(()=>Bun.file(ve).text(),"",()=>{throw new X(`Failed to read layout file: ${ve}`,k,void 0,void 0,"Layout content could not be loaded")});Se=fm(Se,ve);let $e=Se.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if($e){if(B.debug)console.log(`Found nested layout: ${$e[1]} in ${ve}`);let Re={},_e=Se.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(Pe,Ie,Ze)=>(Re[Ie]=Ze.trim(),""));for(let[Pe,Ie]of Object.entries(Re))if(ie[Pe]&&ie[Pe].includes(Mr)){let Ze=ie[Pe].indexOf(Mr);ie[Pe]=ie[Pe].slice(0,Ze)+Ie+ie[Pe].slice(Ze+Mr.length)}else if(!ie[Pe])ie[Pe]=Ie;let Ae={..._,__sections:ie},Xe=`@layout('${$e[1]}')${_e}`;return await n(Xe,Ae,ve,B,T)}let Ce=Se.replace(/\{\{--[\s\S]*?--\}\}/g,""),Ee=gs(Ce,se),Te={};return Ee=Ee.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(Re,_e,Ae)=>(Te[_e]=Ae.trim(),`@slot('${_e}')`)),Ee=Ee.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(Re,_e,Ae)=>{if(ie[_e]){let Xe=ie[_e];if(Xe.includes(Mr)){let Pe=Te[_e]||"",Ie=Xe.indexOf(Mr);Xe=Xe.slice(0,Ie)+Pe+Xe.slice(Ie+Mr.length)}return Xe}return Ae||""}),Ee=dS(Ee,ie),Ee=Ee.replace(/\{\{\s*slot\s*\}\}/g,()=>ie.content||""),Ee=ms(Ee,se),_.__originalFilePath=k,F=await vm(Ee,_,ve,B,T),F=`<!-- stx-layout: ${oe} -->
2055
+ ${F}`,G(F)}catch(ve){return A.log(ve instanceof Error?ve:Error(String(ve)),{layoutPath:oe,filePath:k},"error"),`[Error processing layout: ${ve instanceof Error?ve.message:String(ve)}]`}return G(await vm(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 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 fS(v,_){await te(()=>gg(v,_),void 0,(k)=>{A.log(k,{filePath:v,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${v}: ${k.message}`)})}var Ll="data-stx-source";function ym(v,_){if(!v)return v;let k=/^<script\b([^>]*)>/i.exec(v);if(!k||!/\bserver\b/.test(k[1])||k[1].includes(Ll))return v;return`<script ${Ll}="${encodeURIComponent(_)}"${v.slice(7)}`}function gS(v){let _=new RegExp(`${Ll}="([^"]*)"`).exec(v);return _?decodeURIComponent(_[1]):void 0}function xm(v){return v.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function bm(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">${xm(v)}</span><span style="display:block;margin-top:4px">${xm(k)}</span></div>`}async function mS(v,_,k,E){let{scanScriptTags:T}=await ut("stx/signal-processing",()=>import("./chunk-6a1g18h4.js")),j=[],B=!ge()&&!gn();for(let F of T(v)){let V=F.attrs;if(!/\bserver\b/.test(V))continue;let H=F.start+F.fullMatch.indexOf(">")+1,G=wm(v,H);if(G===-1)continue;let J=v.slice(H,G);if(!J.trim())continue;let ne=gS(V)??k,re={index:F.start,length:G+9-F.start};try{let{extractVariables:se}=await ut("stx/variable-extractor",()=>import("./chunk-bprn7crb.js"));await se(J,_,ne,{preserveExisting:!0,onFailure:(ie)=>{if(ie.kind==="unknown")return;if(E?.onServerScriptError?.({sourcePath:ne,kind:ie.kind,message:ie.message}),!B)return;j.push({...re,markup:bm(ne,ie.kind,ie.message)})}})}catch(se){let ie=se instanceof Error?se:Error(String(se));if(A.log(ie,{filePath:ne,phase:"server-script-extraction"},"warning"),console.warn(`[stx] server <script> extraction failed in ${ne}: ${ie.message}`),B)j.push({...re,markup:bm(ne,"unknown",ie.message)})}}if(j.length===0)return v;let z=v;for(let F of j.sort((V,H)=>H.index-V.index))z=z.slice(0,F.index)+F.markup+z.slice(F.index+F.length);return z}async function hS(v,_,k){try{let{interpolateScriptsInTemplate:E}=await ut("stx/expressions",()=>import("./chunk-sz2cf4w6.js"));return E(v,_,{skipServer:!0})}catch(E){let T=E instanceof Error?E:Error(String(E));return A.log(T,{filePath:k,phase:"script-expression-interpolation"},"warning"),console.warn(`[stx] script expression interpolation failed in ${k}: ${T.message}`),v}}async function vm(v,_,k,E,T){let j=v,B=E;if(j=await mS(j,_,k,E),j=await hS(j,_,k),j=await Qf(j,_,k),j=await eg(j,_,k),j=await Pp(j,_,k,B),ye(j))j=ei(j,_),j=ls(j,_),j=cs(j,_);j=ti(j);let{processStreamDirectives:z}=await ut("stx/streaming",()=>import("./chunk-g9dh9yat.js"));j=z(j,_),j=ii(j,_,k,B,!0),j=await vg(j,_,k,B,T),j=await os(j,_,k,B,T),j=du(j,_,k,B);let{processDeferDirectives:F}=await ut("stx/defer",()=>import("./chunk-yed9c66h.js"));j=F(j,_,k);let{processTeleportDirectives:V}=await ut("stx/teleport",()=>import("./chunk-w0vrmvh7.js"));j=V(j,_,k);let{processTransitionDirectives:H,processTransitionAttributes:G}=await ut("stx/transitions",()=>import("./chunk-5y4qxmaw.js"));j=H(j,_,k),j=G(j);let{processErrorBoundaryDirectives:J,stripRenderFailedMarkers:ne}=await ut("stx/error-boundaries",()=>import("./chunk-h85hrwkq.js"));j=J(j,_,k),j=ne(j);let{processSuspenseDirectives:re}=await ut("stx/suspense",()=>import("./chunk-st1s30tn.js"));j=re(j,_,k);let{processAsyncDirectives:se}=await ut("stx/async-components",()=>import("./chunk-3gbjppvg.js"));j=se(j,_,k);let{processKeepAliveDirectives:ie}=await ut("stx/keep-alive",()=>import("./chunk-v7ahbhbd.js"));j=ie(j,_,k);let{processVirtualListDirectives:oe,processVirtualGridDirectives:ue,processInfiniteListDirectives:ae}=await ut("stx/virtual-scrolling",()=>import("./chunk-gna3h2yv.js"));j=oe(j,_,k),j=ue(j,_,k),j=ae(j,_,k);let{processPartialHydrationDirectives:me,processStaticDirectives:ve}=await ut("stx/partial-hydration",()=>import("./chunk-8mxjd1ge.js"));j=me(j,_,k),j=ve(j);let{processComputedDirectives:Se,processWatchDirectives:$e}=await ut("stx/computed",()=>import("./chunk-1xdzcy9d.js"));j=Se(j,_,k),j=$e(j,_,k);let{processFormValidationDirectives:Ce}=await ut("stx/forms-validation",()=>import("./chunk-fe5xht52.js"));j=Ce(j,_,k);let{processHeadDirective:Ee,processTitleDirective:Te,processMetaDirective:Re,resetHead:_e}=await ut("stx/head",()=>import("./chunk-gyfb3rj5.js"));if(!_.__stx_head_preset&&!_.__stx_runtime_head)_e();let Ae=Ee(j);if(j=Ae.content,Ae.headContent)_.__stx_head_raw=`${_.__stx_head_raw||""}${Ae.headContent}
2056
+ `;if(j=Te(j,_),j=Re(j,_,k),j=fg(j),j=Mc(j,_),j=Ip(j),j=lg(j),j=await ps(j,_,k,B,T),j=await os(j,_,k,B,T),_.__stxProcessingDepth===1)j=Fu(j,_);if(j=j.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/g,""),j=Ol(j),j=ar(j,_,k),j=us(j),j=xp(j,_,{filePath:k,buildMode:B.buildMode}),j=Oc(j,_),j=Nc(j,_),j=co(j,_),j=Bp(j,_),j=zp(j,_),j=await _m(j,_,k,B),j=await $m(j,_,k),j=await ui(j,_,k,B),j=pi(j,_,k,B),j=Cs(j,_,k,B),j=$s(j,_,k),j=Es(j,_,k,B),j=Tp(j,_,k,B),j=ys(j,_),j=bs(j),j=om(j),!B.skipEventDirectives)j=$u(j,_,k);if(j=wp(j,_,k),B.debug){let tt=/\bx-data\s*=/.test(j),it=as(v);if(tt&&it)console.warn(`[stx] ${k}: Template mixes Alpine-style (x-data) and signals (state/derived/effect) reactivity.
2057
2057
  Both work on the same page, but they manage separate scopes.
2058
- Prefer signals (state/derived/effect) for new components.`)}j=wf(j,_),j=await q(j,_,k),j=am(j),j=cm(j),j=fp(j);let{processXElementDirectives:Xe}=await ut("stx/x-element",()=>import("./chunk-zhxdpzga.js"));j=Xe(j);let Pe=_.__originalFilePath||k,Ie=Ne(_);if(j=await ni(j,B,Pe,Ie),j=Mp(j,_),j=await ug(j,_,k,B),B.media?.image?.autoSiblings){let tt=B.publicDir||"public",{rewriteImagesWithSiblings:it}=await ut("stx/image-optimization/auto-sibling",()=>import("./chunk-50vq8k55.js"));j=await it(j,{publicDir:tt})}if(B.seo?.enabled)j=_s(j,_,B);let Ze=(tt,it,gt=!0)=>{if(!it)return tt;let qt=it.match(/<title\b[^>]*>[\s\S]*?<\/title>/i),Dt=tt.match(/<title\b[^>]*>[\s\S]*?<\/title>/i);if(qt&&Dt){if(gt)tt=tt.replace(Dt[0],qt[0]);if(it=it.replace(qt[0],"").trim(),!it)return tt}if(/<\/head>/i.test(tt))return tt.replace(/<\/head>/i,`${it}
2058
+ Prefer signals (state/derived/effect) for new components.`)}j=$f(j,_),j=await q(j,_,k),j=um(j),j=dm(j),j=mp(j);let{processXElementDirectives:Xe}=await ut("stx/x-element",()=>import("./chunk-zhxdpzga.js"));j=Xe(j);let Pe=_.__originalFilePath||k,Ie=Ne(_);if(j=await ni(j,B,Pe,Ie),j=Np(j,_),j=await pg(j,_,k,B),B.media?.image?.autoSiblings){let tt=B.publicDir||"public",{rewriteImagesWithSiblings:it}=await ut("stx/image-optimization/auto-sibling",()=>import("./chunk-50vq8k55.js"));j=await it(j,{publicDir:tt})}if(B.seo?.enabled)j=_s(j,_,B);let Ze=(tt,it,gt=!0)=>{if(!it)return tt;let qt=it.match(/<title\b[^>]*>[\s\S]*?<\/title>/i),Dt=tt.match(/<title\b[^>]*>[\s\S]*?<\/title>/i);if(qt&&Dt){if(gt)tt=tt.replace(Dt[0],qt[0]);if(it=it.replace(qt[0],"").trim(),!it)return tt}if(/<\/head>/i.test(tt))return tt.replace(/<\/head>/i,`${it}
2059
2059
  </head>`);if(/<head\b[^>]*>/i.test(tt))return tt.replace(/(<head\b[^>]*>)/i,`$1
2060
2060
  ${it}`);if(/<html\b[^>]*>/i.test(tt))return tt.replace(/(<html\b[^>]*>)/i,`$1
2061
2061
  <head>
2062
2062
  ${it}
2063
- </head>`);return tt},{renderHead:rt,getHead:at}=await ut("stx/head",()=>import("./chunk-4aw47rmg.js")),ht=_.__stx_runtime_head??at();if(ht.title||ht.meta?.length||ht.link?.length){let tt=rt(ht);if(tt)j=Ze(j,tt)}if(Ae.headContent)j=Ze(j,Ae.headContent,!ht.title);if(B.csp?.enabled&&B.csp.addMetaTag)j=kp(j,B.csp,_);if(B.analytics?.enabled)j=gp(j,B);if(B.heatmap?.enabled)j=fu(j,B);if(B.pwa?.enabled&&B.pwa.autoInject!==!1){let{injectPwaTags:tt}=await ut("stx/pwa/inject",()=>import("./chunk-7mh0fnrq.js"));j=tt(j,B)}let pt=/<script\b(?![^>]*\bserver\b)[^>]*>[\s\S]*?<\/script>/i.test(j),bt=/\bSTX\.\w+/.test(j),ct=/window\.STX\s*=/.test(j);if(pt&&bt&&!ct){let it=`<script data-stx-scoped data-stx-run="once">
2064
- ${up()}
2063
+ </head>`);return tt},{renderHead:rt,getHead:at}=await ut("stx/head",()=>import("./chunk-gyfb3rj5.js")),ht=_.__stx_runtime_head??at();if(ht.title||ht.meta?.length||ht.link?.length){let tt=rt(ht);if(tt)j=Ze(j,tt)}if(Ae.headContent)j=Ze(j,Ae.headContent,!ht.title);if(B.csp?.enabled&&B.csp.addMetaTag)j=Cp(j,B.csp,_);if(B.analytics?.enabled)j=hp(j,B);if(B.heatmap?.enabled)j=gu(j,B);if(B.pwa?.enabled&&B.pwa.autoInject!==!1){let{injectPwaTags:tt}=await ut("stx/pwa/inject",()=>import("./chunk-7mh0fnrq.js"));j=tt(j,B)}let pt=/<script\b(?![^>]*\bserver\b)[^>]*>[\s\S]*?<\/script>/i.test(j),bt=/\bSTX\.\w+/.test(j),ct=/window\.STX\s*=/.test(j);if(pt&&bt&&!ct){let it=`<script data-stx-scoped data-stx-run="once">
2064
+ ${pp()}
2065
2065
  </script>`;if(j.includes("</head>")){let gt=j.indexOf("</head>"),Dt=j.slice(0,gt).indexOf("<script");if(Dt!==-1){let hn=j.slice(0,Dt),jt=j.slice(Dt);j=hn+it+`
2066
2066
  `+jt}else j=j.replace("</head>",`${it}
2067
2067
  </head>`)}else if(j.includes("<body"))j=j.replace(/<body([^>]*)>/,`<body$1>
2068
2068
  ${it}`);else j=it+`
2069
- `+j}{let{scanScriptTags:tt}=await ut("stx/signal-processing",()=>import("./chunk-q9yhnqe5.js")),it=[];for(let gt of tt(j)){if(!/\bserver\b/i.test(gt.attrs))continue;let qt=gt.start+gt.fullMatch.indexOf(">")+1,Dt=xm(j,qt);if(Dt===-1)continue;let hn=Dt+9;while(hn<j.length&&/\s/.test(j[hn]))hn++;it.push({start:gt.start,end:hn})}if(it.length>0){let gt=Array(it.length+1),qt=0;for(let Dt=0;Dt<it.length;Dt++){let{start:hn,end:jt}=it[Dt];gt[Dt]=j.slice(qt,hn),qt=jt}gt[it.length]=j.slice(qt),j=gt.join("")}}let Pt=Qi(j,k);if(Pt.hasScoped)j=Pt.html;let ft=_.__stx_event_bindings||[],Nt=!1,Pn=[],Sn=/\s:[a-z][\w.-]*\s*=/.test(j),{scanScriptTags:er}=await ut("stx/signal-processing",()=>import("./chunk-q9yhnqe5.js"));for(let tt of er(j,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/}))Pn.push({match:tt.fullMatch,attrs:tt.attrs,content:tt.body});for(let{match:tt,attrs:it,content:gt}of Pn){Nt=!0;let qt=gt;ws(gt,k,E.strict,_.__originalFilePath);let Dt=await he(gt,{eventBindings:ft,attrs:it,hasColonDirectives:Sn,templateContent:v,filePath:k,projectRoot:process.cwd(),production:E.buildMode==="compile",serverData:Ie});j=j.replace(tt,()=>Dt)}if(Nt)_.__stx_event_bindings=[];if(!Nt&&_.__stxProcessingDepth===1){let tt=_.__stx_event_bindings||[];if(tt.length>0){let it=ya(tt);if(it){let gt=j.lastIndexOf("</body>");j=gt===-1?j+it:j.slice(0,gt)+it+`
2070
- `+j.slice(gt)}_.__stx_event_bindings=[]}}if(!ce(j)&&zg(j))j=await Do(j,B);if(j=Fg(j),B.csp?.enabled&&B.csp.useNonce&&typeof _.cspNonce==="string")j=Ep(j,_.cspNonce);return j}var mS=[{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"}],hS=[{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')"}],yS=[{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 bc(v){let _=[],k=[];return xS(v,_),bS(v,_,k),vS(v,k),wS(v,_),{valid:_.length===0,errors:_,warnings:k}}function xS(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 bS(v,_,k){for(let E of mS){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 vS(v,_){for(let k of hS)if(k.pattern.test(v))_.push({type:"syntax",message:k.message,suggestion:k.suggestion})}function wS(v,_){for(let k of yS)if(k.pattern.test(v))_.push({type:"expression",message:`Security warning: ${k.message}`,suggestion:"Remove dangerous code from template expressions"})}function wc(v,_){let k=v.slice(0,_).split(`
2071
- `);return{line:k.length,column:k[k.length-1].length+1}}function vc(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 xc(v){return/@[a-z]+/i.test(v)||/\{\{/.test(v)}function Sc(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 In from"path";import Vs from"process";var Ct=["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 Sm=new Set(Ct),SS=new Set(["props","$props","defineProps"]),$S=new Set(["stx","@stacksjs/stx"]),$m=m(128),_m=m(64);function _S(v){let _=[],k=0,E=v.split(`
2072
- `);for(let T of E){let j=k,B=null,z=!1;for(let F=0;F<T.length;F++){let V=T[F];if(z){z=!1;continue}if(V==="\\"){z=!0;continue}if(B){if(V===B)B=null;continue}if(V==="'"||V==='"'||V==="`"){B=V;continue}if(V==="/"&&F+1<T.length&&T[F+1]==="/")break;if(V==="{")k++;else if(V==="}")k--}if(j===0){let F=T.match(/(?:const|let|var)\s+(\w+)\s*=/);if(F)_.push(F[1]);else if(/^\s*(?:const|let|var)\s+\w+\s*;?\s*$/.test(T)){let V=T.match(/(?:const|let|var)\s+(\w+)/);if(V)_.push(V[1])}else{let V=T.match(/(?:const|let|var)\s+(\{[^}]+\}|\[[^\]]+\])\s*=/);if(V){let G=V[1].slice(1,-1).split(",").map((J)=>{let ne=J.split(":");return(ne.length>1?ne[1]:ne[0]).trim()}).filter((J)=>/^\w+$/.test(J));_.push(...G)}}}}return[...new Set(_)]}function lc(v){let _=v;_=_.replace(/^\s*import\s+.*?from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),_=_.replace(/^\s*import\s+['"][^'"]+['"]\s*;?\s*$/gm,""),_=_.replace(/^\s*interface\s+\w+\s*\{[\s\S]*?\n\}\s*$/gm,""),_=_.replace(/^\s*type\s+\w+\s*=[\s\S]*?(?=\n(?:const|let|var|function|export|interface|type|$))/gm,""),_=_.replace(/^(\s*(?:export\s+)?(?:const|let|var)\s+)(\w+|\{[^}]+\}|\[[^\]]+\])\s*:\s*[^=]+(\s*=)/gm,"$1$2$3");function k(E){if(!E.includes(":"))return E;let T=[],j="",B=0,z=0,F=null;for(let V=0;V<E.length;V++){let H=E[V];if(F){if(j+=H,H===F)F=null;continue}if(H==='"'||H==="'"||H==="`"){F=H,j+=H;continue}if(H==="<")B++;else if(H===">"&&B>0)B--;else if(H==="(")z++;else if(H===")")z--;if(H===","&&B===0&&z===0){T.push(j),j="";continue}j+=H}if(j)T.push(j);return T.map((V)=>{let H=V.trim(),G=H.startsWith("..."),J=G?H.slice(3):H,ne=-1,re=0;for(let ve=0;ve<J.length;ve++)if(J[ve]==="<")re++;else if(J[ve]===">")re--;else if(J[ve]===":"&&re===0){ne=ve;break}if(ne===-1)return V;let ie=J.substring(0,ne).trim().replace(/\?$/,""),oe=J.substring(ne+1),de=-1,ae=0;for(let ve=0;ve<oe.length;ve++)if(oe[ve]==="<")ae++;else if(oe[ve]===">")ae--;else if(oe[ve]==="="&&ae===0){de=ve;break}let me=G?"...":"";if(de!==-1)return`${me}${ie} = ${oe.substring(de+1).trim()}`;return`${me}${ie}`}).join(", ")}_=_.replace(/\b(function\s+\w*\s*)\(([^)]*)\)/g,(E,T,j)=>{if(!j.includes(":"))return E;return`${T}(${k(j)})`});{let E=/\b(function\s+\w*\s*)\(/g,T,j=[];while((T=E.exec(_))!==null){let B=T.index+T[0].length-1,z=1,F=B+1,V=0,H=null;while(F<_.length&&z>0){let ne=_[F];if(H){if(ne===H)H=null;F++;continue}if(ne==='"'||ne==="'"||ne==="`"){H=ne,F++;continue}if(ne==="<")V++;else if(ne===">"&&V>0)V--;else if(V===0){if(ne==="(")z++;else if(ne===")")z--}if(z>0)F++}if(z!==0)continue;let G=_.substring(B+1,F);if(!G.includes(":"))continue;let J=k(G);j.push({start:B+1,end:F,replacement:J})}for(let B=j.length-1;B>=0;B--){let{start:z,end:F,replacement:V}=j[B];_=_.substring(0,z)+V+_.substring(F)}}return _=_.replace(/\(([^)]*)\)\s*(?::\s*[^=]+)?\s*=>/g,(E,T)=>{if(!T.includes(":"))return E;if(T.includes("{")||T.includes("}"))return E;return`(${T.split(",").map((B)=>{let[z,...F]=B.split("="),V=z.split(":")[0].trim();if(F.length>0)return`${V} = ${F.join("=").trim()}`;return V}).join(", ")}) =>`}),_=_.replace(/(\))\s*:\s*([A-Z]\w*|void|string|number|boolean|any|unknown|never|null|undefined)(?:<[^>]+>)?(?:\s*\|\s*(?:[A-Z]\w*|void|string|number|boolean|any|unknown|never|null|undefined))*\s*(\{)/g,"$1$3"),_=_.replace(/(\b(?:function|class|interface|type|extends|implements)\s+\w+)\s*<[^<>()]*>/g,"$1"),_=_.replace(/(\b(?:defineProps|withDefaults|defineEmits|defineSlots|Array|Promise|Map|Set|Record|Partial|Required|Readonly|Pick|Omit|Exclude|Extract))\s*<[^<>()]*>/g,"$1"),_=_.replace(/(\w+)\s*<[A-Z][^<>()]*>\s*(?=\()/g,"$1"),_=_.replace(/\s+as\s+(?:const|[A-Za-z]\w*(?:\[\])?(?:\s*\|\s*\w+(?:\[\])?)*)/g,""),_=_.replace(/\s+satisfies\s+\w+(?:<[^>]*>)?/g,""),_=_.replace(/(\w|\)|\])\s*!(?!=)/g,"$1"),_=_.replace(/^\s*(?:export\s+)?(?:const\s+)?enum\s+\w+\s*\{[^}]*\}\s*$/gm,""),_=_.replace(/(?<=[\s=,(])<[A-Z]\w*(?:\[\])?>/g,""),_=_.replace(/\n\s*\n\s*\n/g,`
2069
+ `+j}{let{scanScriptTags:tt}=await ut("stx/signal-processing",()=>import("./chunk-6a1g18h4.js")),it=[];for(let gt of tt(j)){if(!/\bserver\b/i.test(gt.attrs))continue;let qt=gt.start+gt.fullMatch.indexOf(">")+1,Dt=wm(j,qt);if(Dt===-1)continue;let hn=Dt+9;while(hn<j.length&&/\s/.test(j[hn]))hn++;it.push({start:gt.start,end:hn})}if(it.length>0){let gt=Array(it.length+1),qt=0;for(let Dt=0;Dt<it.length;Dt++){let{start:hn,end:jt}=it[Dt];gt[Dt]=j.slice(qt,hn),qt=jt}gt[it.length]=j.slice(qt),j=gt.join("")}}let Pt=Qi(j,k);if(Pt.hasScoped)j=Pt.html;let ft=_.__stx_event_bindings||[],Nt=!1,Pn=[],Sn=/\s:[a-z][\w.-]*\s*=/.test(j),{scanScriptTags:er}=await ut("stx/signal-processing",()=>import("./chunk-6a1g18h4.js"));for(let tt of er(j,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/}))Pn.push({match:tt.fullMatch,attrs:tt.attrs,content:tt.body});for(let{match:tt,attrs:it,content:gt}of Pn){Nt=!0;let qt=gt;ws(gt,k,E.strict,_.__originalFilePath);let Dt=await he(gt,{eventBindings:ft,attrs:it,hasColonDirectives:Sn,templateContent:v,filePath:k,projectRoot:process.cwd(),production:E.buildMode==="compile",serverData:Ie});j=j.replace(tt,()=>Dt)}if(Nt)_.__stx_event_bindings=[];if(!Nt&&_.__stxProcessingDepth===1){let tt=_.__stx_event_bindings||[];if(tt.length>0){let it=xa(tt);if(it){let gt=j.lastIndexOf("</body>");j=gt===-1?j+it:j.slice(0,gt)+it+`
2070
+ `+j.slice(gt)}_.__stx_event_bindings=[]}}if(!ce(j)&&Wg(j))j=await Mo(j,B);if(j=Ug(j),B.csp?.enabled&&B.csp.useNonce&&typeof _.cspNonce==="string")j=Rp(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 bc(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 wc(v,_){let k=v.slice(0,_).split(`
2071
+ `);return{line:k.length,column:k[k.length-1].length+1}}function vc(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 xc(v){return/@[a-z]+/i.test(v)||/\{\{/.test(v)}function Sc(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 In from"path";import Fs from"process";var Ct=["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 km=new Set(Ct),_S=new Set(["props","$props","defineProps"]),kS=new Set(["stx","@stacksjs/stx"]),Em=m(128),Cm=m(64);function ES(v){let _=[],k=0,E=v.split(`
2072
+ `);for(let T of E){let j=k,B=null,z=!1;for(let F=0;F<T.length;F++){let V=T[F];if(z){z=!1;continue}if(V==="\\"){z=!0;continue}if(B){if(V===B)B=null;continue}if(V==="'"||V==='"'||V==="`"){B=V;continue}if(V==="/"&&F+1<T.length&&T[F+1]==="/")break;if(V==="{")k++;else if(V==="}")k--}if(j===0){let F=T.match(/(?:const|let|var)\s+(\w+)\s*=/);if(F)_.push(F[1]);else if(/^\s*(?:const|let|var)\s+\w+\s*;?\s*$/.test(T)){let V=T.match(/(?:const|let|var)\s+(\w+)/);if(V)_.push(V[1])}else{let V=T.match(/(?:const|let|var)\s+(\{[^}]+\}|\[[^\]]+\])\s*=/);if(V){let G=V[1].slice(1,-1).split(",").map((J)=>{let ne=J.split(":");return(ne.length>1?ne[1]:ne[0]).trim()}).filter((J)=>/^\w+$/.test(J));_.push(...G)}}}}return[...new Set(_)]}function lc(v){let _=v;_=_.replace(/^\s*import\s+.*?from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),_=_.replace(/^\s*import\s+['"][^'"]+['"]\s*;?\s*$/gm,""),_=_.replace(/^\s*interface\s+\w+\s*\{[\s\S]*?\n\}\s*$/gm,""),_=_.replace(/^\s*type\s+\w+\s*=[\s\S]*?(?=\n(?:const|let|var|function|export|interface|type|$))/gm,""),_=_.replace(/^(\s*(?:export\s+)?(?:const|let|var)\s+)(\w+|\{[^}]+\}|\[[^\]]+\])\s*:\s*[^=]+(\s*=)/gm,"$1$2$3");function k(E){if(!E.includes(":"))return E;let T=[],j="",B=0,z=0,F=null;for(let V=0;V<E.length;V++){let H=E[V];if(F){if(j+=H,H===F)F=null;continue}if(H==='"'||H==="'"||H==="`"){F=H,j+=H;continue}if(H==="<")B++;else if(H===">"&&B>0)B--;else if(H==="(")z++;else if(H===")")z--;if(H===","&&B===0&&z===0){T.push(j),j="";continue}j+=H}if(j)T.push(j);return T.map((V)=>{let H=V.trim(),G=H.startsWith("..."),J=G?H.slice(3):H,ne=-1,re=0;for(let ve=0;ve<J.length;ve++)if(J[ve]==="<")re++;else if(J[ve]===">")re--;else if(J[ve]===":"&&re===0){ne=ve;break}if(ne===-1)return V;let ie=J.substring(0,ne).trim().replace(/\?$/,""),oe=J.substring(ne+1),ue=-1,ae=0;for(let ve=0;ve<oe.length;ve++)if(oe[ve]==="<")ae++;else if(oe[ve]===">")ae--;else if(oe[ve]==="="&&ae===0){ue=ve;break}let me=G?"...":"";if(ue!==-1)return`${me}${ie} = ${oe.substring(ue+1).trim()}`;return`${me}${ie}`}).join(", ")}_=_.replace(/\b(function\s+\w*\s*)\(([^)]*)\)/g,(E,T,j)=>{if(!j.includes(":"))return E;return`${T}(${k(j)})`});{let E=/\b(function\s+\w*\s*)\(/g,T,j=[];while((T=E.exec(_))!==null){let B=T.index+T[0].length-1,z=1,F=B+1,V=0,H=null;while(F<_.length&&z>0){let ne=_[F];if(H){if(ne===H)H=null;F++;continue}if(ne==='"'||ne==="'"||ne==="`"){H=ne,F++;continue}if(ne==="<")V++;else if(ne===">"&&V>0)V--;else if(V===0){if(ne==="(")z++;else if(ne===")")z--}if(z>0)F++}if(z!==0)continue;let G=_.substring(B+1,F);if(!G.includes(":"))continue;let J=k(G);j.push({start:B+1,end:F,replacement:J})}for(let B=j.length-1;B>=0;B--){let{start:z,end:F,replacement:V}=j[B];_=_.substring(0,z)+V+_.substring(F)}}return _=_.replace(/\(([^)]*)\)\s*(?::\s*[^=]+)?\s*=>/g,(E,T)=>{if(!T.includes(":"))return E;if(T.includes("{")||T.includes("}"))return E;return`(${T.split(",").map((B)=>{let[z,...F]=B.split("="),V=z.split(":")[0].trim();if(F.length>0)return`${V} = ${F.join("=").trim()}`;return V}).join(", ")}) =>`}),_=_.replace(/(\))\s*:\s*([A-Z]\w*|void|string|number|boolean|any|unknown|never|null|undefined)(?:<[^>]+>)?(?:\s*\|\s*(?:[A-Z]\w*|void|string|number|boolean|any|unknown|never|null|undefined))*\s*(\{)/g,"$1$3"),_=_.replace(/(\b(?:function|class|interface|type|extends|implements)\s+\w+)\s*<[^<>()]*>/g,"$1"),_=_.replace(/(\b(?:defineProps|withDefaults|defineEmits|defineSlots|Array|Promise|Map|Set|Record|Partial|Required|Readonly|Pick|Omit|Exclude|Extract))\s*<[^<>()]*>/g,"$1"),_=_.replace(/(\w+)\s*<[A-Z][^<>()]*>\s*(?=\()/g,"$1"),_=_.replace(/\s+as\s+(?:const|[A-Za-z]\w*(?:\[\])?(?:\s*\|\s*\w+(?:\[\])?)*)/g,""),_=_.replace(/\s+satisfies\s+\w+(?:<[^>]*>)?/g,""),_=_.replace(/(\w|\)|\])\s*!(?!=)/g,"$1"),_=_.replace(/^\s*(?:export\s+)?(?:const\s+)?enum\s+\w+\s*\{[^}]*\}\s*$/gm,""),_=_.replace(/(?<=[\s=,(])<[A-Z]\w*(?:\[\])?>/g,""),_=_.replace(/\n\s*\n\s*\n/g,`
2073
2073
 
2074
- `),_}function uc(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 dc(v){return/cannot find module|cannot find package|could not resolve|module not found|failed to resolve/i.test(v)}function pc(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 fc(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 km=new Set;async function d(v,_,k,E={}){if(!v.trim())return;let T=w(),j=h(v,JSON.stringify(T)),B=$m.get(j);if(B===void 0){try{let De=L({loader:"ts",target:"browser",define:T}),Je=v.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");Je=Je.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,""),B=De.transformSync(Je)}catch{B=lc(v)}$m.set(j,B)}let z={exports:{}},F=z.exports,V=Vs.cwd(),H={},G=[...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)),J=new Map;for(let De of G)try{if(De.startsWith(".")){H[De]=await import(In.resolve(In.dirname(k),De));continue}let Je=In.resolve(V,"node_modules",De),st=In.join(Je,"package.json"),mt=JSON.parse(u("fs").readFileSync(st,"utf8")),At=mt.main||"index.js";if(mt.exports){let Kt=typeof mt.exports==="string"?mt.exports:mt.exports["."];if(typeof Kt==="string")At=Kt;else if(Kt?.bun)At=Kt.bun;else if(Kt?.import)At=Kt.import;else if(Kt?.default)At=Kt.default}H[De]=await import(In.resolve(Je,At))}catch(Je){if(De.startsWith("."))J.set(De,Je instanceof Error?Je.message:String(Je))}let ne=(De)=>{if(H[De])return H[De];let Je=J.get(De);if(Je!==void 0)throw Error(`Cannot require '${De}' from ${k}: ${Je}`);return u(De)},re=_.props||{},se=(De)=>{if(!De)return re;let Je={};for(let[st,mt]of Object.entries(De)){let At=re[st];if(At!==void 0)Je[st]=At;else if(typeof mt==="function")Je[st]=mt();else Je[st]=mt}return Je};for(let[De,Je]of Object.entries(re))Object.defineProperty(se,De,{value:Je,enumerable:!0,configurable:!0,writable:!0});let ie=(De,Je=!1)=>{if(De===void 0||De===null)return Je;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)},oe=(De,Je=0)=>{if(De===void 0||De===null)return Je;if(typeof De==="string"){let mt=De.trim();if(mt==="")return Je;let At=Number(mt);return Number.isFinite(At)?At:Je}let st=Number(De);return Number.isFinite(st)?st:Je};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 de=(De)=>{if(!De)return re;let Je={...re};for(let[st,mt]of Object.entries(De)){let At=mt&&typeof mt==="object"&&!Array.isArray(mt)?mt:{type:mt};if(Je[st]===void 0&&At.default!==void 0)Je[st]=typeof At.default==="function"?At.default():At.default}return Je},ae=()=>_.slots||{},me=(De,Je)=>{let st={...De};for(let[mt,At]of Object.entries(Je))if(st[mt]===void 0)if(typeof At==="function")st[mt]=At();else st[mt]=At;return st},ve=(De)=>{let Je=()=>De;return Je.set=(st)=>{},Je.update=(st)=>{},Je},Se=(De)=>{let Je,st=!1;return()=>{if(!st)try{Je=De(),st=!0}catch{Je=void 0}return Je}},$e=(De)=>{},Ce=(De)=>De(),Ee=(De)=>{},Te=(De)=>{},Re=jn(_);function _e(De){let Je=De||{};if(Je.title!==void 0||Je.description!==void 0)Ze({title:Je.title,description:Je.description})}function Ae(De){if(!De||typeof De!=="object")return;let Je=_.__stxClientPayload??{};Object.assign(Je,De),_.__stxClientPayload=Je}let Xe=()=>{let De=_.__stxServeContext,Je=_.__stxServeSearch??De?.search??"",st=De?.path??"",mt=Object.fromEntries(new URLSearchParams(Je)),At=_.query,Kt=Object.keys(mt).length>0?mt:At??{},_n=Je||(Object.keys(Kt).length>0?`?${new URLSearchParams(Kt).toString()}`:"");return{params:_.params??{},query:Kt,path:st,name:"",fullPath:st+_n,hash:"",matched:[]}},Pe=()=>({push:(De)=>{},replace:(De)=>{},back:()=>{},forward:()=>{},go:(De)=>{}}),Ie=(De)=>{let Je=_.__stx_runtime_head||{};_.__stx_runtime_head=fe(Je,pe(De||{},{known:nr,source:"useHead()"}))},Ze=(De)=>{Ie(rr(De||{}))},rt=(De)=>({value:De}),at=(De)=>De,Qe=(De)=>({value:typeof De==="function"?De():De}),ht=(De,Je)=>{},pt=(De)=>{},bt=(De)=>{},ct=(De)=>De?De():Promise.resolve(),Pt=(De)=>(Je,...st)=>{},ft=(De)=>{},Nt=(De,Je)=>{},Pn=(De,Je)=>Je,Sn=()=>({value:"light"}),er=()=>ve(!1),tt=(De)=>ve(!1),it=()=>ve(!1),gt=()=>tt("(prefers-color-scheme: dark)"),qt=()=>tt("(prefers-color-scheme: light)"),Dt=()=>tt("(prefers-reduced-motion: reduce)"),hn=()=>tt("(prefers-contrast: more)"),jt={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:{}},ua=new Proxy(jt,{get(De,Je){if(Je in De)return De[Je];return},set(De,Je,st){return De[Je]=st,!0}}),da={getElementById:()=>null,querySelector:()=>null,querySelectorAll:()=>[],createElement:()=>({}),createTextNode:()=>({}),body:{},head:{},documentElement:{},addEventListener:()=>{},removeEventListener:()=>{}},pa=console;try{let De=us(B,k),Je=new Set(Object.keys(re)),st=Object.keys(_).filter((lt)=>!Je.has(lt)&&!SS.has(lt)&&Ye(lt)),mt=st.map((lt)=>_[lt]);if(!st.includes("__stxServeContext"))st.push("__stxServeContext"),mt.push(void 0);let At=new Set(["async","module","exports","require","params","window","document","console","state","derived","effect"]),Kt=[],_n=[];for(let[lt,kn]of Object.entries(re)){if(!Ye(lt))continue;if(At.has(lt))continue;if(new RegExp(`(?:^|[\\s;{])(?:const|let|var|function)\\s+${lt}\\b`).test(De))continue;Kt.push(lt),_n.push(kn)}let lr=_S(De).map((lt)=>`module.exports.${lt} = typeof ${lt} !== 'undefined' ? ${lt} : module.exports.${lt};`).join(`
2074
+ `),_}function dc(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 uc(v){return/cannot find module|cannot find package|could not resolve|module not found|failed to resolve/i.test(v)}function pc(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 fc(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 Rm=new Set;async function u(v,_,k,E={}){if(!v.trim())return;let T=w(),j=h(v,JSON.stringify(T)),B=Em.get(j);if(B===void 0){try{let De=L({loader:"ts",target:"browser",define:T}),Je=v.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");Je=Je.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,""),B=De.transformSync(Je)}catch{B=lc(v)}Em.set(j,B)}let z={exports:{}},F=z.exports,V=Fs.cwd(),H={},G=[...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)),J=new Map;for(let De of G)try{if(De.startsWith(".")){H[De]=await import(In.resolve(In.dirname(k),De));continue}let Je=In.resolve(V,"node_modules",De),st=In.join(Je,"package.json"),mt=JSON.parse(d("fs").readFileSync(st,"utf8")),At=mt.main||"index.js";if(mt.exports){let Kt=typeof mt.exports==="string"?mt.exports:mt.exports["."];if(typeof Kt==="string")At=Kt;else if(Kt?.bun)At=Kt.bun;else if(Kt?.import)At=Kt.import;else if(Kt?.default)At=Kt.default}H[De]=await import(In.resolve(Je,At))}catch(Je){if(De.startsWith("."))J.set(De,Je instanceof Error?Je.message:String(Je))}let ne=(De)=>{if(H[De])return H[De];let Je=J.get(De);if(Je!==void 0)throw Error(`Cannot require '${De}' from ${k}: ${Je}`);return d(De)},re=_.props||{},se=(De)=>{if(!De)return re;let Je={};for(let[st,mt]of Object.entries(De)){let At=re[st];if(At!==void 0)Je[st]=At;else if(typeof mt==="function")Je[st]=mt();else Je[st]=mt}return Je};for(let[De,Je]of Object.entries(re))Object.defineProperty(se,De,{value:Je,enumerable:!0,configurable:!0,writable:!0});let ie=(De,Je=!1)=>{if(De===void 0||De===null)return Je;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)},oe=(De,Je=0)=>{if(De===void 0||De===null)return Je;if(typeof De==="string"){let mt=De.trim();if(mt==="")return Je;let At=Number(mt);return Number.isFinite(At)?At:Je}let st=Number(De);return Number.isFinite(st)?st:Je};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 ue=(De)=>{if(!De)return re;let Je={...re};for(let[st,mt]of Object.entries(De)){let At=mt&&typeof mt==="object"&&!Array.isArray(mt)?mt:{type:mt};if(Je[st]===void 0&&At.default!==void 0)Je[st]=typeof At.default==="function"?At.default():At.default}return Je},ae=()=>_.slots||{},me=(De,Je)=>{let st={...De};for(let[mt,At]of Object.entries(Je))if(st[mt]===void 0)if(typeof At==="function")st[mt]=At();else st[mt]=At;return st},ve=(De)=>{let Je=()=>De;return Je.set=(st)=>{},Je.update=(st)=>{},Je},Se=(De)=>{let Je,st=!1;return()=>{if(!st)try{Je=De(),st=!0}catch{Je=void 0}return Je}},$e=(De)=>{},Ce=(De)=>De(),Ee=(De)=>{},Te=(De)=>{},Re=jn(_);function _e(De){let Je=De||{};if(Je.title!==void 0||Je.description!==void 0)Ze({title:Je.title,description:Je.description})}function Ae(De){if(!De||typeof De!=="object")return;let Je=_.__stxClientPayload??{};Object.assign(Je,De),_.__stxClientPayload=Je}let Xe=()=>{let De=_.__stxServeContext,Je=_.__stxServeSearch??De?.search??"",st=De?.path??"",mt=Object.fromEntries(new URLSearchParams(Je)),At=_.query,Kt=Object.keys(mt).length>0?mt:At??{},_n=Je||(Object.keys(Kt).length>0?`?${new URLSearchParams(Kt).toString()}`:"");return{params:_.params??{},query:Kt,path:st,name:"",fullPath:st+_n,hash:"",matched:[]}},Pe=()=>({push:(De)=>{},replace:(De)=>{},back:()=>{},forward:()=>{},go:(De)=>{}}),Ie=(De)=>{let Je=_.__stx_runtime_head||{};_.__stx_runtime_head=fe(Je,pe(De||{},{known:nr,source:"useHead()"}))},Ze=(De)=>{Ie(rr(De||{}))},rt=(De)=>({value:De}),at=(De)=>De,Qe=(De)=>({value:typeof De==="function"?De():De}),ht=(De,Je)=>{},pt=(De)=>{},bt=(De)=>{},ct=(De)=>De?De():Promise.resolve(),Pt=(De)=>(Je,...st)=>{},ft=(De)=>{},Nt=(De,Je)=>{},Pn=(De,Je)=>Je,Sn=()=>({value:"light"}),er=()=>ve(!1),tt=(De)=>ve(!1),it=()=>ve(!1),gt=()=>tt("(prefers-color-scheme: dark)"),qt=()=>tt("(prefers-color-scheme: light)"),Dt=()=>tt("(prefers-reduced-motion: reduce)"),hn=()=>tt("(prefers-contrast: more)"),jt={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:{}},da=new Proxy(jt,{get(De,Je){if(Je in De)return De[Je];return},set(De,Je,st){return De[Je]=st,!0}}),pa={getElementById:()=>null,querySelector:()=>null,querySelectorAll:()=>[],createElement:()=>({}),createTextNode:()=>({}),body:{},head:{},documentElement:{},addEventListener:()=>{},removeEventListener:()=>{}},fa=console;try{let De=ds(B,k),Je=new Set(Object.keys(re)),st=Object.keys(_).filter((lt)=>!Je.has(lt)&&!_S.has(lt)&&Ye(lt)),mt=st.map((lt)=>_[lt]);if(!st.includes("__stxServeContext"))st.push("__stxServeContext"),mt.push(void 0);let At=new Set(["async","module","exports","require","params","window","document","console","state","derived","effect"]),Kt=[],_n=[];for(let[lt,kn]of Object.entries(re)){if(!Ye(lt))continue;if(At.has(lt))continue;if(new RegExp(`(?:^|[\\s;{])(?:const|let|var|function)\\s+${lt}\\b`).test(De))continue;Kt.push(lt),_n.push(kn)}let lr=ES(De).map((lt)=>`module.exports.${lt} = typeof ${lt} !== 'undefined' ? ${lt} : module.exports.${lt};`).join(`
2075
2075
  `),Zt=_.params??{},nt=[],ot=[];for(let lt=0;lt<st.length;lt++){if(st[lt]==="params")continue;nt.push(st[lt]),ot.push(mt[lt])}let Tt=[...Ct,...Kt,...nt],dt=`return (async () => {
2076
2076
  ${De}
2077
2077
  ${lr}
2078
2078
  return module.exports
2079
- })()`,Vt=h(dt,Tt.join("\x00")),Mt=_m.get(Vt);if(!Mt)Mt=Function(...Tt,dt),_m.set(Vt,Mt);let Gt=_.__stx_options?.runtimeConfig;if(Gt||/\buse(?:Server)?RuntimeConfig\b/.test(B))await ln(_,k,Gt);let tr=await ue(_.__stx_runtime_config??Et()??C(),()=>Cg(_,()=>Mt(z,F,ne,re,se,ie,oe,de,me,Ae,Rg,ks,Yn,ve,Se,$e,Ce,Ee,Te,_e,Xe,Pe,Ie,Ze,Re.setResponseStatus,Re.setResponseHeader,Re.notFound,rt,at,Qe,ht,pt,bt,ct,Pt,ft,ae,Nt,Pn,Sn,er,tt,it,gt,qt,Dt,hn,ua,da,pa,jt.confirm,jt.alert,jt.fetch,Zt,..._n,...ot)));if(E.preserveExisting){for(let[lt,kn]of Object.entries(tr))if(!(lt in _)||_[lt]===void 0)_[lt]=kn}else Object.assign(_,tr);for(let[lt,kn]of Object.entries(re))if(!(lt in _))_[lt]=kn}catch(De){if(_.__stx_strict_hydration)throw De;let Je=uc(De instanceof Error?De.message:String(De));if(dc(Je))console.warn(`[stx] server <script> in ${k??"<unknown>"} imports a module that does not resolve, so every variable in that script is undefined. Cause: ${Je}`),E.onFailure?.({kind:"module-resolution",message:Je,error:De});else if(pc(De))console.warn(`[stx] server <script> in ${k??"<unknown>"} does not parse, so every variable in that script is undefined. Cause: ${Je}`),E.onFailure?.({kind:"syntax",message:Je,error:De});else if(fc(Je))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: ${Je}`),E.onFailure?.({kind:"missing-binding",message:Je,error:De});else{let st=`${k??"<unknown>"}\x00${Je}`;if(Vs.env.STX_DEBUG||!km.has(st))km.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: ${Je}`);E.onFailure?.({kind:"unknown",message:Je,error:De})}try{await AS(B,_,k)}catch(st){if(Vs.env.STX_DEBUG){let mt=st instanceof Error?st.message:String(st);console.warn(`[stx] fallback extraction also failed in ${k??"<unknown>"}: ${mt}`)}}}}function gc(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 kS=/^(?:export\s+)?(?:const|let|var)\s+[A-Za-z_$][\w$]*(?:\s*,\s*[A-Za-z_$][\w$]*)*\s*;?$/;function us(v,_){let k=_?In.dirname(_):Vs.cwd(),E=Vs.cwd(),T=v.split(`
2080
- `),j=[],B=0;while(B<T.length){let z=T[B].trim();if(z.startsWith("interface ")||z.startsWith("export interface ")||z.startsWith("type ")||z.startsWith("export type ")){if(z.includes("{")&&!z.includes("}")){let F=0;for(;B<T.length;B++){for(let V of T[B])if(V==="{")F++;else if(V==="}")F--;if(F<=0)break}}B++;continue}if(z.startsWith("definePageMeta(")){let F=0,V=!1,H=B;for(let ne=B;ne<T.length&&!V;ne++){let re=null,se=!1,ie=T[ne];for(let oe=0;oe<ie.length;oe++){let de=ie[oe];if(se){se=!1;continue}if(de==="\\"){se=!0;continue}if(re){if(de===re)re=null;continue}if(de==='"'||de==="'"||de==="`"){re=de;continue}if(de==="(")F++;else if(de===")"){if(F--,F===0){B=ne+1,V=!0;break}}}}if(!V)B=T.length;let G=T.slice(H,B).join(`
2081
- `),J=[];for(let ne of["title","description"]){let re=new RegExp(`\\b${ne}\\s*:\\s*(['"\`])((?:\\\\.|(?!\\1)[^\\\\])*)\\1`).exec(G);if(re)J.push(`${ne}: ${JSON.stringify(re[2])}`)}if(J.length>0)j.push(`useSeoMeta({ ${J.join(", ")} });`);continue}if(z.startsWith("import ")||z==="import"||z.startsWith("import{")){let F=z,V=0;while(!gc(F)&&B+V+1<T.length)V++,F=`${F} ${T[B+V].trim()}`;B+=V;let H=F.match(/^import\s+(\w+)\s+from\s+['"](.+?)['"]/),G=F.match(/^import\s+\{([^}]*)\}\s+from\s+['"](.+?)['"]/),J=F.match(/^import\s+['"](.+?)['"]/),ne=F,re=(se)=>{if(se.startsWith("."))return In.resolve(k,se);if(se.startsWith("~/")||se.startsWith("@/"))return In.resolve(E,se.slice(2));return se};if(H){let[,se,ie]=H,oe=re(ie);j.push(`const ${se} = (await import('${oe}')).default`),j.push(`module.exports.${se} = ${se};`)}else if(G){let[,se,ie]=G,oe=re(ie),de=[],ae=[],me=$S.has(ie);for(let ve of se.split(",")){let Se=ve.trim();if(!Se)continue;let $e=Se.split(/\s+as\s+/);if($e.length===2){let[Ce,Ee]=[$e[0].trim(),$e[1].trim()];if(me&&Sm.has(Ce)){j.push(`const ${Ee} = ${Ce};`);continue}de.push(`${Ce}: ${Ee}`),ae.push(Ee)}else{if(me&&Sm.has(Se))continue;de.push(Se),ae.push(Se)}}if(de.length>0)j.push(`const { ${de.join(", ")} } = await import('${oe}')`);for(let ve of ae)j.push(`module.exports.${ve} = ${ve};`)}else if(J){let se=re(J[1]);j.push(`await import('${se}')`)}else j.push(ne);B++;continue}if(kS.test(z))j.push(T[B]),B++;else if(z.startsWith("export const ")||z.startsWith("export let ")||z.startsWith("export var ")){let F=Cm(T,B),{type:V,name:H,value:G}=F;j.push(`${V} ${H} = ${G};`),j.push(`module.exports.${H} = ${H};`),B=F.nextIndex}else if(z.startsWith("export function ")||z.startsWith("export async function ")){let F=Ll(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=Cm(T,B),{type:V,name:H,value:G}=F;j.push(`${V} ${H} = ${G};`),j.push(`module.exports.${H} = ${H};`),B=F.nextIndex}else if(z.startsWith("function ")||z.startsWith("async function ")){let F=Ll(T,B);j.push(F.functionCode),j.push(`module.exports.${F.name} = ${F.name};`),B=F.nextIndex}else if(z.startsWith("export default function ")||z.startsWith("export default async function ")){let F=T[B].replace(/^(\s*)export\s+default\s+/,"$1"),V=[...T];V[B]=F;let H=Ll(V,B);if(j.push(H.functionCode),H.name)j.push(`module.exports.default = ${H.name};`);B=H.nextIndex}else if(z.startsWith("export default ")){let F=z.replace(/^export\s+default\s+/,"").replace(/;$/,"");j.push(`module.exports.default = ${F};`),B++}else if(z.startsWith("class ")||z.startsWith("export class ")){let F=z.match(/(?:export\s+)?class\s+(\w+)/);if(F){let V=F[1],H=T[B].replace(/^export\s+/,""),G=0,J=B;for(;J<T.length;J++){let ne=T[J];for(let re of ne)if(re==="{")G++;else if(re==="}")G--;if(J>B)H+=`
2082
- `+ne;if(G<=0&&J>=B)break}j.push(H),j.push(`module.exports.${V} = ${V};`),B=J+1}else j.push(z),B++}else if(z.includes("module.exports"))j.push(z),B++;else if(z.trim()&&!z.startsWith("//"))j.push(z),B++;else B++}return ES(j.join(`
2083
- `),k,E)}function ES(v,_,k){let E=v.length,T="",j=0,B=null,z=!1,F=!1,V=0;while(j<E){let H=v[j],G=v[j+1];if(z){if(T+=H,H===`
2084
- `)z=!1;j++;continue}if(F){if(T+=H,H==="*"&&G==="/"){T+=G,j+=2,F=!1;continue}j++;continue}if(!B&&H==="/"&&G==="/"){z=!0,T+=H,j++;continue}if(!B&&H==="/"&&G==="*"){F=!0,T+=H,j++;continue}if(B){if(T+=H,H==="\\"){T+=G,j+=2;continue}if(H===B&&B!=="`"){B=null,j++;continue}if(B==="`"){if(H==="$"&&G==="{"){V++,T+=G,j+=2;continue}if(H==="`"){B=null,j++;continue}}j++;continue}if(V>0){if(H==="{")V++;else if(H==="}")V--}if(H==='"'||H==="'"||H==="`"){B=H,T+=H,j++;continue}if(H==="a"&&v.startsWith("await",j)){let J=CS(v,j);if(J){let{quote:ne,path:re,end:se}=J;if(re.startsWith(".")||re.startsWith("~/")||re.startsWith("@/")){let ie=re.startsWith(".")?In.resolve(_,re):In.resolve(k,re.slice(2));T+=`await import(${ne}${ie}${ne})`,j=se;continue}}}T+=H,j++}return T}function CS(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 Im(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 Pm(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?Im(k,E):null;if(z){_.push(...Pm(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 mc(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 Em(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 Cm(v,_){let k=v[_].trim(),E=mc(k),T=E?[k,E.type,E.name,E.value]:null;if(!T){let H=k.match(/^(?:export\s+)?(const|let|var)\s+/);if(H){let G=k.slice(H[0].length),J=_;if(G.startsWith("{")||G.startsWith("[")){let re=G[0],se=re==="{"?"}":"]",ie=Em(G,re,se,0),oe=G;for(let de=_+1;de<v.length&&ie>0;de++)oe+=` ${v[de].trim()}`,J=de,ie=Em(v[de],re,se,ie);if(ie>0)oe=G,J=_;G=oe}let ne=Im(G,0);if(ne){let re=H[1],se=ne.pattern,ie=G.slice(ne.endPos).trim();if(ie.startsWith("=")){let oe=ie.slice(1).trim(),de=oe,ae=Math.max(J,_);if(Rm(oe)){let $e=Tm(v,ae,oe);de=$e.value,ae=$e.nextIndex}else ae=ae+1;de=de.trim().replace(/;$/,"");let me=Pm(se),ve=`__stx_src_${_}`,Se=me.map(($e)=>`module.exports.${$e} = ${$e};`).join(`
2085
- `);return{type:re,name:ve,value:`${de}; ${re} ${se} = ${ve};
2086
- ${Se}`,nextIndex:ae}}}}throw Error(`Failed to parse variable declaration: ${k}`)}let[,j,B,z]=T,F=z,V=_;if(Rm(z)){let H=Tm(v,_,z);F=H.value,V=H.nextIndex}else V=_+1;while(V<v.length){let H=v[V].trim();if(H.startsWith(".")||H.startsWith("?."))F+=`
2087
- ${v[V]}`,V++;else break}return F=F.trim().replace(/;$/,""),{type:j,name:B,value:F,nextIndex:V}}function Ll(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(RS(k)){let z=TS(v,_,j);j=z.functionCode,B=z.nextIndex}else B=_+1;return{name:T,functionCode:j,nextIndex:B}}function Rm(v){let _=v.trim();if(_.startsWith("{"))return S(_,"{","}",0)===-1;if(_.startsWith("["))return S(_,"[","]",0)===-1;return!Dm(_)}function Dm(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 Mm(v){let _=v.indexOf("(");if(_===-1)return v.indexOf("{");let k=S(v,"(",")",_);if(k===-1)return-1;return v.indexOf("{",k)}function RS(v){let _=Mm(v);if(_===-1)return!0;return S(v,"{","}",_)===-1}function Tm(v,_,k){let E=k,T=_+1;while(T<v.length&&!Dm(E)){let j=v[T];E+=`
2079
+ })()`,Vt=h(dt,Tt.join("\x00")),Mt=Cm.get(Vt);if(!Mt)Mt=Function(...Tt,dt),Cm.set(Vt,Mt);let Gt=_.__stx_options?.runtimeConfig;if(Gt||/\buse(?:Server)?RuntimeConfig\b/.test(B))await ln(_,k,Gt);let tr=await de(_.__stx_runtime_config??Et()??C(),()=>Ag(_,()=>Mt(z,F,ne,re,se,ie,oe,ue,me,Ae,Ig,ks,Yn,ve,Se,$e,Ce,Ee,Te,_e,Xe,Pe,Ie,Ze,Re.setResponseStatus,Re.setResponseHeader,Re.notFound,rt,at,Qe,ht,pt,bt,ct,Pt,ft,ae,Nt,Pn,Sn,er,tt,it,gt,qt,Dt,hn,da,pa,fa,jt.confirm,jt.alert,jt.fetch,Zt,..._n,...ot)));if(E.preserveExisting){for(let[lt,kn]of Object.entries(tr))if(!(lt in _)||_[lt]===void 0)_[lt]=kn}else Object.assign(_,tr);for(let[lt,kn]of Object.entries(re))if(!(lt in _))_[lt]=kn}catch(De){if(_.__stx_strict_hydration)throw De;let Je=dc(De instanceof Error?De.message:String(De));if(uc(Je))console.warn(`[stx] server <script> in ${k??"<unknown>"} imports a module that does not resolve, so every variable in that script is undefined. Cause: ${Je}`),E.onFailure?.({kind:"module-resolution",message:Je,error:De});else if(pc(De))console.warn(`[stx] server <script> in ${k??"<unknown>"} does not parse, so every variable in that script is undefined. Cause: ${Je}`),E.onFailure?.({kind:"syntax",message:Je,error:De});else if(fc(Je))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: ${Je}`),E.onFailure?.({kind:"missing-binding",message:Je,error:De});else{let st=`${k??"<unknown>"}\x00${Je}`;if(Fs.env.STX_DEBUG||!Rm.has(st))Rm.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: ${Je}`);E.onFailure?.({kind:"unknown",message:Je,error:De})}try{await PS(B,_,k)}catch(st){if(Fs.env.STX_DEBUG){let mt=st instanceof Error?st.message:String(st);console.warn(`[stx] fallback extraction also failed in ${k??"<unknown>"}: ${mt}`)}}}}function gc(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 ds(v,_){let k=_?In.dirname(_):Fs.cwd(),E=Fs.cwd(),T=v.split(`
2080
+ `),j=[],B=0;while(B<T.length){let z=T[B].trim();if(z.startsWith("interface ")||z.startsWith("export interface ")||z.startsWith("type ")||z.startsWith("export type ")){if(z.includes("{")&&!z.includes("}")){let F=0;for(;B<T.length;B++){for(let V of T[B])if(V==="{")F++;else if(V==="}")F--;if(F<=0)break}}B++;continue}if(z.startsWith("definePageMeta(")){let F=0,V=!1,H=B;for(let ne=B;ne<T.length&&!V;ne++){let re=null,se=!1,ie=T[ne];for(let oe=0;oe<ie.length;oe++){let ue=ie[oe];if(se){se=!1;continue}if(ue==="\\"){se=!0;continue}if(re){if(ue===re)re=null;continue}if(ue==='"'||ue==="'"||ue==="`"){re=ue;continue}if(ue==="(")F++;else if(ue===")"){if(F--,F===0){B=ne+1,V=!0;break}}}}if(!V)B=T.length;let G=T.slice(H,B).join(`
2081
+ `),J=[];for(let ne of["title","description"]){let re=new RegExp(`\\b${ne}\\s*:\\s*(['"\`])((?:\\\\.|(?!\\1)[^\\\\])*)\\1`).exec(G);if(re)J.push(`${ne}: ${JSON.stringify(re[2])}`)}if(J.length>0)j.push(`useSeoMeta({ ${J.join(", ")} });`);continue}if(z.startsWith("import ")||z==="import"||z.startsWith("import{")){let F=z,V=0;while(!gc(F)&&B+V+1<T.length)V++,F=`${F} ${T[B+V].trim()}`;B+=V;let H=F.match(/^import\s+(\w+)\s+from\s+['"](.+?)['"]/),G=F.match(/^import\s+\{([^}]*)\}\s+from\s+['"](.+?)['"]/),J=F.match(/^import\s+['"](.+?)['"]/),ne=F,re=(se)=>{if(se.startsWith("."))return In.resolve(k,se);if(se.startsWith("~/")||se.startsWith("@/"))return In.resolve(E,se.slice(2));return se};if(H){let[,se,ie]=H,oe=re(ie);j.push(`const ${se} = (await import('${oe}')).default`),j.push(`module.exports.${se} = ${se};`)}else if(G){let[,se,ie]=G,oe=re(ie),ue=[],ae=[],me=kS.has(ie);for(let ve of se.split(",")){let Se=ve.trim();if(!Se)continue;let $e=Se.split(/\s+as\s+/);if($e.length===2){let[Ce,Ee]=[$e[0].trim(),$e[1].trim()];if(me&&km.has(Ce)){j.push(`const ${Ee} = ${Ce};`);continue}ue.push(`${Ce}: ${Ee}`),ae.push(Ee)}else{if(me&&km.has(Se))continue;ue.push(Se),ae.push(Se)}}if(ue.length>0)j.push(`const { ${ue.join(", ")} } = await import('${oe}')`);for(let ve of ae)j.push(`module.exports.${ve} = ${ve};`)}else if(J){let se=re(J[1]);j.push(`await import('${se}')`)}else j.push(ne);B++;continue}if(CS.test(z))j.push(T[B]),B++;else if(z.startsWith("export const ")||z.startsWith("export let ")||z.startsWith("export var ")){let F=Am(T,B),{type:V,name:H,value:G}=F;j.push(`${V} ${H} = ${G};`),j.push(`module.exports.${H} = ${H};`),B=F.nextIndex}else if(z.startsWith("export function ")||z.startsWith("export async function ")){let F=Bl(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=Am(T,B),{type:V,name:H,value:G}=F;j.push(`${V} ${H} = ${G};`),j.push(`module.exports.${H} = ${H};`),B=F.nextIndex}else if(z.startsWith("function ")||z.startsWith("async function ")){let F=Bl(T,B);j.push(F.functionCode),j.push(`module.exports.${F.name} = ${F.name};`),B=F.nextIndex}else if(z.startsWith("export default function ")||z.startsWith("export default async function ")){let F=T[B].replace(/^(\s*)export\s+default\s+/,"$1"),V=[...T];V[B]=F;let H=Bl(V,B);if(j.push(H.functionCode),H.name)j.push(`module.exports.default = ${H.name};`);B=H.nextIndex}else if(z.startsWith("export default ")){let F=z.replace(/^export\s+default\s+/,"").replace(/;$/,"");j.push(`module.exports.default = ${F};`),B++}else if(z.startsWith("class ")||z.startsWith("export class ")){let F=z.match(/(?:export\s+)?class\s+(\w+)/);if(F){let V=F[1],H=T[B].replace(/^export\s+/,""),G=0,J=B;for(;J<T.length;J++){let ne=T[J];for(let re of ne)if(re==="{")G++;else if(re==="}")G--;if(J>B)H+=`
2082
+ `+ne;if(G<=0&&J>=B)break}j.push(H),j.push(`module.exports.${V} = ${V};`),B=J+1}else j.push(z),B++}else if(z.includes("module.exports"))j.push(z),B++;else if(z.trim()&&!z.startsWith("//"))j.push(z),B++;else B++}return RS(j.join(`
2083
+ `),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 H=v[j],G=v[j+1];if(z){if(T+=H,H===`
2084
+ `)z=!1;j++;continue}if(F){if(T+=H,H==="*"&&G==="/"){T+=G,j+=2,F=!1;continue}j++;continue}if(!B&&H==="/"&&G==="/"){z=!0,T+=H,j++;continue}if(!B&&H==="/"&&G==="*"){F=!0,T+=H,j++;continue}if(B){if(T+=H,H==="\\"){T+=G,j+=2;continue}if(H===B&&B!=="`"){B=null,j++;continue}if(B==="`"){if(H==="$"&&G==="{"){V++,T+=G,j+=2;continue}if(H==="`"){B=null,j++;continue}}j++;continue}if(V>0){if(H==="{")V++;else if(H==="}")V--}if(H==='"'||H==="'"||H==="`"){B=H,T+=H,j++;continue}if(H==="a"&&v.startsWith("await",j)){let J=TS(v,j);if(J){let{quote:ne,path:re,end:se}=J;if(re.startsWith(".")||re.startsWith("~/")||re.startsWith("@/")){let ie=re.startsWith(".")?In.resolve(_,re):In.resolve(k,re.slice(2));T+=`await import(${ne}${ie}${ne})`,j=se;continue}}}T+=H,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 Mm(v,_){let k=v[_];if(k!=="{"&&k!=="[")return null;let T=S(v,k,k==="{"?"}":"]",_);if(T===-1)return null;return{pattern:v.slice(_,T+1),endPos:T+1}}function Om(v){let _=[],k=v.slice(1,-1).trim();if(!k)return _;let E=0,T=0,j="";while(E<k.length){let B=k[E];if(B==="{"||B==="["){let z=T===0?Mm(k,E):null;if(z){_.push(...Om(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 mc(v){let _=/^(?:export\s+)?(const|let|var)\s+([A-Za-z_$][\w$]*)/.exec(v);if(!_)return null;let k=_[0].length,E=(T)=>T===" "||T==="\t";while(k<v.length&&E(v[k]))k++;if(v[k]===":"){let T=0,j=null;k++;for(;k<v.length;k++){let B=v[k];if(j){if(B==="\\"){k++;continue}if(B===j)j=null;continue}if(B==="'"||B==='"'||B==="`"){j=B;continue}if(B==="("||B==="["||B==="{"||B==="<"){T++;continue}if(B===")"||B==="]"||B==="}"||B===">"){T--;continue}if(B==="="&&T<=0){let z=v[k+1],F=v[k-1];if(z!=="="&&z!==">"&&F!=="="&&F!=="!"&&F!=="<"&&F!==">")break}}if(v[k]!=="=")return null}while(k<v.length&&E(v[k]))k++;if(v[k]!=="=")return null;return{type:_[1],name:_[2],value:v.slice(k+1).trim()}}function Tm(v,_,k,E){let T=null,j=!1;for(let B of v){if(j){j=!1;continue}if(B==="\\"){j=!0;continue}if(T){if(B===T)T=null;continue}if(B==="'"||B==='"'||B==="`"){T=B;continue}if(B===_)E++;else if(B===k)E--}return E}function Am(v,_){let k=v[_].trim(),E=mc(k),T=E?[k,E.type,E.name,E.value]:null;if(!T){let H=k.match(/^(?:export\s+)?(const|let|var)\s+/);if(H){let G=k.slice(H[0].length),J=_;if(G.startsWith("{")||G.startsWith("[")){let re=G[0],se=re==="{"?"}":"]",ie=Tm(G,re,se,0),oe=G;for(let ue=_+1;ue<v.length&&ie>0;ue++)oe+=` ${v[ue].trim()}`,J=ue,ie=Tm(v[ue],re,se,ie);if(ie>0)oe=G,J=_;G=oe}let ne=Mm(G,0);if(ne){let re=H[1],se=ne.pattern,ie=G.slice(ne.endPos).trim();if(ie.startsWith("=")){let oe=ie.slice(1).trim(),ue=oe,ae=Math.max(J,_);if(Im(oe)){let $e=Pm(v,ae,oe);ue=$e.value,ae=$e.nextIndex}else ae=ae+1;ue=ue.trim().replace(/;$/,"");let me=Om(se),ve=`__stx_src_${_}`,Se=me.map(($e)=>`module.exports.${$e} = ${$e};`).join(`
2085
+ `);return{type:re,name:ve,value:`${ue}; ${re} ${se} = ${ve};
2086
+ ${Se}`,nextIndex:ae}}}}throw Error(`Failed to parse variable declaration: ${k}`)}let[,j,B,z]=T,F=z,V=_;if(Im(z)){let H=Pm(v,_,z);F=H.value,V=H.nextIndex}else V=_+1;while(V<v.length){let H=v[V].trim();if(H.startsWith(".")||H.startsWith("?."))F+=`
2087
+ ${v[V]}`,V++;else break}return F=F.trim().replace(/;$/,""),{type:j,name:B,value:F,nextIndex:V}}function Bl(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(AS(k)){let z=IS(v,_,j);j=z.functionCode,B=z.nextIndex}else B=_+1;return{name:T,functionCode:j,nextIndex:B}}function Im(v){let _=v.trim();if(_.startsWith("{"))return S(_,"{","}",0)===-1;if(_.startsWith("["))return S(_,"[","]",0)===-1;return!Nm(_)}function Nm(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 jm(v){let _=v.indexOf("(");if(_===-1)return v.indexOf("{");let k=S(v,"(",")",_);if(k===-1)return-1;return v.indexOf("{",k)}function AS(v){let _=jm(v);if(_===-1)return!0;return S(v,"{","}",_)===-1}function Pm(v,_,k){let E=k,T=_+1;while(T<v.length&&!Nm(E)){let j=v[T];E+=`
2088
2088
  ${j}`,T++}while(T<v.length){let j=v[T].trim();if(j.startsWith(".")||j.startsWith("?."))E+=`
2089
- ${v[T]}`,T++;else break}return{value:E,nextIndex:T}}function TS(v,_,k){let E=k,T=_+1;while(T<v.length){let j=Mm(E);if(j!==-1){if(S(E,"{","}",j)!==-1)break}let B=v[T];E+=`
2090
- ${B}`,T++}return{functionCode:E,nextIndex:T}}function Am(v,_){let k=c(v,_)??c(`(${v})`,_);if(k!==void 0)return k;if(!/\bprocess\b/.test(v))return;let E={..._,process:Object.freeze({env:{...Vs.env}})},T=Object.keys(E).filter(Ye),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 AS(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=Am(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=Am(F,_);if(V!==void 0)_[B]=V}catch{}}}function si(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 oi(v){let _=v.trim();if(!_)return!1;return/(?:const|let|var|function)\s+\w+/.test(_)}var Ni=new M(500),ea=new M(1000),zl=new M(2000),Fl=new M(500),Vm=33554432,Vl=Vm;function IS(v){let _=v.componentRenderCacheBytes;if(typeof _!=="number"||_<0||_===Vl)return;Vl=_,ta.setMaxBytes(_)}var ta=new M(2000,{maxBytes:Vm,sizeOf:(v)=>v.output.length});function PS(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 DS(v){let _={};for(let[k,E]of Object.entries(v))if(!k.startsWith("__")||k==="__stxServeContext")_[k]=E;return _}function Om(v){return v.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function kc(v){return/\bjs\b/.test(v)||/\blang\s*=\s*["']?(js|javascript)["']?/i.test(v)}function Ve(v){return!kc(v)}var Lo=new Map;function L(v){let _;try{_=JSON.stringify(v)}catch{return new Bun.Transpiler(v)}let k=Lo.get(_);if(k)return k;if(Lo.size>=16)Lo.clear();let E=new Bun.Transpiler(v);return Lo.set(_,E),E}var Nm=new WeakMap,MS=256;function Ue(v){try{let _=L({loader:"ts",target:"browser",define:w()}),k=Nm.get(_);if(!k)k=new Map,Nm.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>=MS){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 OS(v){let _=[],k=new Set,E=0,T=0,j=v.length,B=(H)=>{T++;while(T<j){if(v[T]==="\\"){T+=2;continue}if(v[T]===H){T++;return}T++}},z=()=>{T++;while(T<j){if(v[T]==="\\"){T+=2;continue}if(v[T]==="`"){T++;return}if(v[T]==="$"&&v[T+1]==="{"){T+=2;let H=1;while(T<j&&H>0)if(v[T]==="{")H++,T++;else if(v[T]==="}")H--,T++;else if(v[T]==="'"||v[T]==='"')B(v[T]);else if(v[T]==="`")z();else T++;continue}T++}},F=()=>{if(v[T]==="/"&&v[T+1]==="/"){while(T<j&&v[T]!==`
2091
- `)T++;return!0}if(v[T]==="/"&&v[T+1]==="*"){T+=2;while(T<j-1&&!(v[T]==="*"&&v[T+1]==="/"))T++;return T+=2,!0}return!1},V=()=>{if(E!==0)return;let H=v.slice(T).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(H){let re=H[2].split(",").map((se)=>{let ie=se.trim().split(":");return ie[ie.length-1].trim()});for(let se of re)if(se&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(se)&&!k.has(se))_.push(se),k.add(se);return}let G=v.slice(T).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(G){let re=G[2];if(!k.has(re))_.push(re),k.add(re);return}let J=v.slice(T).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(J){let re=J[1];if(!k.has(re))_.push(re),k.add(re);return}let ne=v.slice(T).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(ne){let re=ne[1];if(!k.has(re))_.push(re),k.add(re)}};while(T<j){if(F())continue;if(v[T]==="'"||v[T]==='"'){B(v[T]);continue}if(v[T]==="`"){z();continue}if(v[T]==="{"){E++,T++;continue}if(v[T]==="}"){E--,T++;continue}if(E===0&&/[a-z]/i.test(v[T])&&(T===0||/\s|[;{}()]/.test(v[T-1])))V();T++}return _}function NS(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 jS(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 LS(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 NS(z)){let V=F.trim();if(!V||V.startsWith("..."))continue;let H=jS(V);if(H===-1)continue;let G=V.slice(0,H).trim();if(!/^[A-Z_$][\w$]*$/i.test(G))continue;if(_[G]!==void 0)continue;let J=V.slice(H+1).trim();if(!J)continue;try{let ne=Object.keys(_).filter(Ye),re=Function(...ne,`"use strict"; return (${J});`);_[G]=re(...ne.map((se)=>_[se]))}catch{}}}catch{}}var BS=new Set(["tr","td","th","thead","tbody","tfoot","caption","colgroup","col","option","optgroup","li","dt","dd","span"]);function Cc(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(!BS.has(E))return null;let T=new RegExp(`<\\/?${E}(?=[\\s/>])(?:[^>"']|"[^"]*"|'[^']*')*>`,"iy"),j=fr(v,(V,H)=>(T.lastIndex=H,T.exec(V)?.index===H?T.lastIndex:-1));if(E==="span"&&/\sdata-stx-scope\s*=/.test(j[0]?.token||""))return null;let B=0,z=!1;for(let V of j){if(B+=V.token.startsWith("</")?-1:1,B<0)return null;if(B===0){if(v.slice(V.end).trim())return null;z=!0;break}}if(!z)return null;let F=k[0].length;return v.slice(0,F)+_+v.slice(F)}async function qn(v,_,k,E,T){let j=v.endsWith(".stx")?v.slice(0,-4):v,B=(ve)=>ve.split("-").map((Se)=>Se.charAt(0).toUpperCase()+Se.slice(1)).join(""),z=(ve)=>ve.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),F=k.__importedComponents;if(F){for(let ve of[j,j.toLowerCase(),B(j),z(j)])if(F.has(ve))return!0}let V=[...new Set([`${j}.stx`,`${B(j)}.stx`,`${z(j)}.stx`])],H=typeof T.root==="string"?et.resolve(T.root):void 0,G=H??et.dirname(E),J=[],ne=(ve)=>{if(ve&&!J.includes(ve))J.push(ve)},re=k.__originalFilePath;if(re)ne(et.join(et.dirname(re),"components"));if(ne(_),ne(T._rootComponentsDir),ne(et.join(et.dirname(E),"components")),ne(T.componentsDir),H)ne(et.resolve(H,"resources/views/components")),ne(et.resolve(H,"resources/components")),ne(et.resolve(H,"src/components")),ne(et.resolve(H,"components"));for(let ve of T._layerComponentDirs??[])ne(ve);let se=T._pluginComponentDirs;if(Array.isArray(se))for(let ve of se)ne(typeof ve==="string"?ve:null);if(ne(T.fallbackComponentsDir),j.startsWith("./")||j.startsWith("../"))return r(et.resolve(et.dirname(E),`${j}.stx`));let ie=jm(et.resolve(import.meta.dir,"components")),oe=J.map((ve)=>et.isAbsolute(ve)?ve:et.resolve(G,ve)),de=`${V.join("\x00")}\x00\x00${oe.join("\x00")}`,ae=zl.get(de);if(ae!==void 0)return ae;let me=!1;e:for(let ve of oe){if(jm(ve)===ie)continue;for(let Se of V)if(await r(et.join(ve,Se))){me=!0;break e}}return zl.set(de,me),me}function jm(v){let _=Fl.get(v);if(_!==void 0)return _;let k=v;try{k=Fm.realpathSync(v)}catch{}return Fl.set(v,k),k}function $c(v){return v==="visible"||v==="idle"||v==="interaction"||v.startsWith("media:")}function li(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 zS(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 Lm=new Set;function Bm(v,_,k,E){let T=`${v}\x00${_}\x00${E??""}`;if(!process.env.STX_DEBUG&&Lm.has(T))return;Lm.add(T);let j=_?` used in ${_}`:"",B=E?` Cause: ${E}.`:"",z=k.length>0?`
2089
+ ${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=jm(E);if(j!==-1){if(S(E,"{","}",j)!==-1)break}let B=v[T];E+=`
2090
+ ${B}`,T++}return{functionCode:E,nextIndex:T}}function Dm(v,_){let k=c(v,_)??c(`(${v})`,_);if(k!==void 0)return k;if(!/\bprocess\b/.test(v))return;let E={..._,process:Object.freeze({env:{...Fs.env}})},T=Object.keys(E).filter(Ye),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=Dm(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=Dm(F,_);if(V!==void 0)_[B]=V}catch{}}}function si(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 oi(v){let _=v.trim();if(!_)return!1;return/(?:const|let|var|function)\s+\w+/.test(_)}var Ni=new M(500),ta=new M(1000),Fl=new M(2000),Vl=new M(500),Hm=33554432,Wl=Hm;function DS(v){let _=v.componentRenderCacheBytes;if(typeof _!=="number"||_<0||_===Wl)return;Wl=_,na.setMaxBytes(_)}var na=new M(2000,{maxBytes:Hm,sizeOf:(v)=>v.output.length});function MS(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 OS(v){let _={};for(let[k,E]of Object.entries(v))if(!k.startsWith("__")||k==="__stxServeContext")_[k]=E;return _}function Lm(v){return v.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function kc(v){return/\bjs\b/.test(v)||/\blang\s*=\s*["']?(js|javascript)["']?/i.test(v)}function Ve(v){return!kc(v)}var ea=new Map;function L(v){let _;try{_=JSON.stringify(v)}catch{return new Bun.Transpiler(v)}let k=ea.get(_);if(k)return k;if(ea.size>=16)ea.clear();let E=new Bun.Transpiler(v);return ea.set(_,E),E}var Bm=new WeakMap,NS=256;function Ue(v){try{let _=L({loader:"ts",target:"browser",define:w()}),k=Bm.get(_);if(!k)k=new Map,Bm.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=(H)=>{T++;while(T<j){if(v[T]==="\\"){T+=2;continue}if(v[T]===H){T++;return}T++}},z=()=>{T++;while(T<j){if(v[T]==="\\"){T+=2;continue}if(v[T]==="`"){T++;return}if(v[T]==="$"&&v[T+1]==="{"){T+=2;let H=1;while(T<j&&H>0)if(v[T]==="{")H++,T++;else if(v[T]==="}")H--,T++;else if(v[T]==="'"||v[T]==='"')B(v[T]);else if(v[T]==="`")z();else T++;continue}T++}},F=()=>{if(v[T]==="/"&&v[T+1]==="/"){while(T<j&&v[T]!==`
2091
+ `)T++;return!0}if(v[T]==="/"&&v[T+1]==="*"){T+=2;while(T<j-1&&!(v[T]==="*"&&v[T+1]==="/"))T++;return T+=2,!0}return!1},V=()=>{if(E!==0)return;let H=v.slice(T).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(H){let re=H[2].split(",").map((se)=>{let ie=se.trim().split(":");return ie[ie.length-1].trim()});for(let se of re)if(se&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(se)&&!k.has(se))_.push(se),k.add(se);return}let G=v.slice(T).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(G){let re=G[2];if(!k.has(re))_.push(re),k.add(re);return}let J=v.slice(T).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(J){let re=J[1];if(!k.has(re))_.push(re),k.add(re);return}let ne=v.slice(T).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(ne){let re=ne[1];if(!k.has(re))_.push(re),k.add(re)}};while(T<j){if(F())continue;if(v[T]==="'"||v[T]==='"'){B(v[T]);continue}if(v[T]==="`"){z();continue}if(v[T]==="{"){E++,T++;continue}if(v[T]==="}"){E--,T++;continue}if(E===0&&/[a-z]/i.test(v[T])&&(T===0||/\s|[;{}()]/.test(v[T-1])))V();T++}return _}function 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 H=BS(V);if(H===-1)continue;let G=V.slice(0,H).trim();if(!/^[A-Z_$][\w$]*$/i.test(G))continue;if(_[G]!==void 0)continue;let J=V.slice(H+1).trim();if(!J)continue;try{let ne=Object.keys(_).filter(Ye),re=Function(...ne,`"use strict"; return (${J});`);_[G]=re(...ne.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 Cc(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=fr(v,(V,H)=>(T.lastIndex=H,T.exec(V)?.index===H?T.lastIndex:-1));if(E==="span"&&/\sdata-stx-scope\s*=/.test(j[0]?.token||""))return null;let B=0,z=!1;for(let V of j){if(B+=V.token.startsWith("</")?-1:1,B<0)return null;if(B===0){if(v.slice(V.end).trim())return null;z=!0;break}}if(!z)return null;let F=k[0].length;return v.slice(0,F)+_+v.slice(F)}async function qn(v,_,k,E,T){let j=v.endsWith(".stx")?v.slice(0,-4):v,B=(ve)=>ve.split("-").map((Se)=>Se.charAt(0).toUpperCase()+Se.slice(1)).join(""),z=(ve)=>ve.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),F=k.__importedComponents;if(F){for(let ve of[j,j.toLowerCase(),B(j),z(j)])if(F.has(ve))return!0}let V=[...new Set([`${j}.stx`,`${B(j)}.stx`,`${z(j)}.stx`])],H=typeof T.root==="string"?et.resolve(T.root):void 0,G=H??et.dirname(E),J=[],ne=(ve)=>{if(ve&&!J.includes(ve))J.push(ve)},re=k.__originalFilePath;if(re)ne(et.join(et.dirname(re),"components"));if(ne(_),ne(T._rootComponentsDir),ne(et.join(et.dirname(E),"components")),ne(T.componentsDir),H)ne(et.resolve(H,"resources/views/components")),ne(et.resolve(H,"resources/components")),ne(et.resolve(H,"src/components")),ne(et.resolve(H,"components"));for(let ve of T._layerComponentDirs??[])ne(ve);let se=T._pluginComponentDirs;if(Array.isArray(se))for(let ve of se)ne(typeof ve==="string"?ve:null);if(ne(T.fallbackComponentsDir),j.startsWith("./")||j.startsWith("../"))return r(et.resolve(et.dirname(E),`${j}.stx`));let ie=zm(et.resolve(import.meta.dir,"components")),oe=J.map((ve)=>et.isAbsolute(ve)?ve:et.resolve(G,ve)),ue=`${V.join("\x00")}\x00\x00${oe.join("\x00")}`,ae=Fl.get(ue);if(ae!==void 0)return ae;let me=!1;e:for(let ve of oe){if(zm(ve)===ie)continue;for(let Se of V)if(await r(et.join(ve,Se))){me=!0;break e}}return Fl.set(ue,me),me}function zm(v){let _=Vl.get(v);if(_!==void 0)return _;let k=v;try{k=Um.realpathSync(v)}catch{}return Vl.set(v,k),k}function $c(v){return v==="visible"||v==="idle"||v==="interaction"||v.startsWith("media:")}function li(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 Fm=new Set;function Vm(v,_,k,E){let T=`${v}\x00${_}\x00${E??""}`;if(!process.env.STX_DEBUG&&Fm.has(T))return;Fm.add(T);let j=_?` used in ${_}`:"",B=E?` Cause: ${E}.`:"",z=k.length>0?`
2092
2092
  searched:
2093
2093
  ${k.map((F)=>` - ${F}`).join(`
2094
- `)}`:"";console.error(`[stx] component <${v}> could not be resolved${j}, so it rendered as nothing.${B}${z}`)}function zm(v){return`<!-- stx: component "${v.replace(/--+/g,"-")}" could not be resolved; see the server log -->`}function Ec(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 We(v,_,k,E,T,j,B,z=new Set,F){let{extractVariables:V}=await ut("stx/variable-extractor",()=>import("./chunk-7ppykfx2.js")),H=z??new Set;if(H.has(v))return`[Circular component reference: ${v}]`;let G=new Set(H);G.add(v);let J=typeof _.client==="string"?_.client.trim():"";if("client"in _)delete _.client;let ne=J&&J!=="load"&&$c(J)?J:"";try{let re=(nt)=>nt.split("-").map((ot)=>ot.charAt(0).toUpperCase()+ot.slice(1)).join(""),se=(nt)=>nt.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),ie=v.endsWith(".stx")?v.slice(0,-4):v,oe=null,de=T.__importedComponents;if(de){let nt=[ie,ie.toLowerCase(),re(ie),se(ie)];for(let ot of nt)if(de.has(ot)){oe=de.get(ot);break}}let ae=[];if(!oe){let nt=[`${ie}.stx`,`${re(ie)}.stx`,`${se(ie)}.stx`],ot=[...new Set(nt)],Tt=T.__originalFilePath,dt=[];if(dt.push(...B._layerComponentDirs??[]),Tt){let Bt=et.join(et.dirname(Tt),"components");dt.push(Bt)}if(E)dt.push(E);let Vt=B._rootComponentsDir;if(typeof Vt==="string"&&!dt.includes(Vt))dt.push(Vt);let Mt=et.join(et.dirname(j),"components");if(!dt.includes(Mt))dt.push(Mt);if(B.componentsDir&&B.componentsDir!==E&&!dt.includes(B.componentsDir))dt.push(B.componentsDir);let Gt=typeof B.root==="string"?et.resolve(B.root):void 0,tr=Gt??et.dirname(j),lt=[];if(Gt)lt.push(et.resolve(Gt,"resources/views/components")),lt.push(et.resolve(Gt,"resources/components")),lt.push(et.resolve(Gt,"src/components")),lt.push(et.resolve(Gt,"components"));lt.push(et.resolve(import.meta.dir,"components"));for(let Bt of lt)if(!dt.includes(Bt))dt.push(Bt);let kn=B._pluginComponentDirs;if(Array.isArray(kn)){for(let Bt of kn)if(typeof Bt==="string"&&!dt.includes(Bt))dt.push(Bt)}if(B.fallbackComponentsDir&&!dt.includes(B.fallbackComponentsDir))dt.push(B.fallbackComponentsDir);let Nr=[...new Set(dt.map((Bt)=>{if(!Bt)return Bt;return et.isAbsolute(Bt)?Bt:et.resolve(tr,Bt)}))];dt.length=0,dt.push(...Nr);let jr=`${ie}\x00${j}\x00${Nr.join("\x00")}`,Lr=ea.get(jr);if(Lr)if(await r(Lr))oe=Lr;else ea.delete(jr);if(!oe&&(ie.startsWith("./")||ie.startsWith("../")))oe=et.resolve(et.dirname(j),`${ie}.stx`),ae.push(oe);else if(!oe)for(let Bt of dt){if(!Bt)continue;for(let Br of ot){let Fi=et.join(Bt,Br);if(ae.push(Fi),await r(Fi)){oe=Fi;break}}if(oe)break;if(!oe)try{let Br=await import("fs");if(!Br.statSync(Bt,{throwIfNoEntry:!1})?.isDirectory())continue;let lh=8,fa=[{path:Bt,depth:0}];while(fa.length>0&&!oe){let Vi=fa.pop();if(Vi.depth>=lh)continue;let su;try{su=Br.readdirSync(Vi.path,{withFileTypes:!0})}catch{continue}for(let Wi of su){if(!Wi.isDirectory())continue;if(Wi.name==="node_modules"||Wi.name.startsWith("."))continue;let iu=et.join(Vi.path,Wi.name);for(let uh of ot){let ga=et.join(iu,uh);if(ae.push(ga),await r(ga)){oe=ga;break}}if(oe)break;fa.push({path:iu,depth:Vi.depth+1})}}}catch{}if(oe)break}if(oe)ea.set(jr,oe)}if(!oe||!await r(oe))return Bm(v,j,ae),zm(v);F.add(oe);let me;if(Ni.has(oe))me=Ni.get(oe);else try{me=await Bun.file(oe).text(),Ni.set(oe,me)}catch(nt){let ot=nt instanceof Error?nt.message:String(nt);return Bm(v,j,[oe],ot),zm(v)}let ve=new Set(["__originalFilePath","__importedComponents",qi,"__stx_client_signal_names","__stx_client_declared_names","__stx_runtime_config","__stxServeContext","__stx_scope_seq"]),Se={};for(let[nt,ot]of Object.entries(T))if(!nt.startsWith("__")||ve.has(nt))Se[nt]=ot;let $e=k;if(k.includes("@include")){let{processIncludes:nt}=await ut("stx/includes",()=>import("./chunk-kyd15xqj.js"));$e=await nt(k,T,j,B,F)}if(/<[A-Z][\w.-]*[\s/>]/.test($e)){let{processComponents:nt}=await ut("stx/component-renderer",()=>import("./chunk-3w22gpa9.js"));$e=await nt($e,{...T,__processedComponents:H},j,B,F)}let Ce=[];if(li($e)){let{processExpressions:nt}=await ut("stx/expressions",()=>import("./chunk-82nw3942.js")),ot=T.__stx_signals_gate===void 0?{...T,__stx_signals_gate:!0}:T;$e=nt($e,ot,j);for(let Tt of $e.matchAll(/\{\{([\s\S]*?)\}\}/g))Ce.push(Tt[1].trim())}let Ee=xn($e),Te=[],Re=Ee.output.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(nt,ot)=>{let Tt=Ee.scripts[Number(ot)]||"",dt=Tt.match(/^<script\b([^>]*)>/i)?.[1]||"",Vt=dt.match(/\btype\s*=\s*["']([^"']+)["']/i)?.[1]?.toLowerCase(),Mt=!Vt||["module","text/javascript","application/javascript"].includes(Vt),Gt=/\sdata-stx-(?:owner|instance)(?=[\s=/>])/i.test(` ${dt}`);if(!/\bserver\b/i.test(dt)&&Mt&&!Gt)return Te.push(Tt),"";return Tt}),{extractSlotContent:_e}=await ut("stx/slots",()=>import("./chunk-g3xgcnh4.js")),Ae=_e(Re),Xe={};if(Ae.defaultSlot?.trim())Xe.default=Ae.defaultSlot;for(let[nt,ot]of Ae.namedSlots)Xe[nt]=ot.content;let Pe=T.__stx_scope_seq??={n:0,key:Bun.hash(String(T.__filename??j)).toString(36).slice(0,6)},Ie=`stx_${ie.replace(/[^a-zA-Z0-9]/g,"_")}_${++Pe.n}_${Pe.key}`,Ze={...Se,$uid:Ie,..._,props:_,slot:Re,$slots:Xe,__processedComponents:G,__sections:{},__stx_signals_gate:ye(me)||li(k),__stx_preserved_client_expressions:[...Array.isArray(T.__stx_preserved_client_expressions)?T.__stx_preserved_client_expressions:[],...Ce]};LS(me,Ze);let rt=me,at=Z(rt);if(at)rt=at.content.trim();let Qe=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,ht=[...me.matchAll(Qe)],pt=[],bt=null,ct=ht.some((nt)=>/\bserver\b/.test(nt[1]||"")&&/\bcache\b/.test(nt[1]||"")),Pt=null,ft=null,Nt=null,Pn=0,Sn=null;if(IS(B),ct&&Vl>0){let nt=PS({props:_,slot:$e,slotContext:k.trim()?DS(Se):void 0,buildMode:B.buildMode??"",skipEventDirectives:B.skipEventDirectives===!0,layers:B._layerGraph?.layers.map((ot)=>ot.configFile),uid:Ie});if(nt!==null){Pt=`${oe}\x00${h(me)}\x00${nt}`;let ot=ta.get(Pt);if(ot){for(let Tt of ot.dependencies)F.add(Tt);if(fd(T,ot.clientFactories),Pe.n+=ot.uidsConsumed,ot.preservedClientExpressions.length>0){let Tt=new Set(Array.isArray(T.__stx_preserved_client_expressions)?T.__stx_preserved_client_expressions:[]);for(let dt of ot.preservedClientExpressions)Tt.add(dt);T.__stx_preserved_client_expressions=[...Tt]}return ot.output}ft=new Set(F),Nt=dd(T),Pn=Pe.n,Sn=new Set(Array.isArray(T.__stx_preserved_client_expressions)?T.__stx_preserved_client_expressions:[])}}let er=new Set;for(let nt of ht){let ot=nt[1]||"",Tt=nt[2]||"",dt=ot.includes("server");if(Ve(ot)&&Tt.trim())Tt=Ue(Tt);if(dt&&Tt){for(let Mt of Q(Tt))er.add(Mt);try{await V(Tt,Ze,oe,{onFailure:(Mt)=>{if(Mt.kind!=="unknown")bt=Mt.kind}})}catch(Mt){}}if(!dt){let Mt=Tt.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),Gt=Mt.includes("{{")&&Mt.includes("}}"),tr=Mt.includes("{!!")&&Mt.includes("!!}");if(Gt||tr)Mt=Zr(Mt,Ze,oe);let lt=ot.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");pt.push(`<script${lt}>${Mt}</script>`)}}let it=xn(me).output.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),gt=it?it[1]:"",qt=it?it[2]:"",Dt="",hn=gt&&/\bscoped\b/i.test(gt);if(it)Dt=`<style${gt}>${zS(qt,Ze,oe)}</style>`;let jt=rt;if(jt=jt.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),it)jt=jt.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let nt=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,ot=[];if(jt=jt.replace(nt,(Tt,dt)=>{let Vt=dt.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(Vt)ot.push(`<style${Vt[1]}>${Vt[2]}</style>`);return""}),jt=jt.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),ot.length>0)Dt=`${Dt}${ot.join(`
2095
- `)}`}if(k&&jt.includes("{{ text || slot }}"))jt=jt.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>k);let{applySlots:ua}=await ut("stx/slots",()=>import("./chunk-g3xgcnh4.js")),{defaultSlot:da,namedSlots:pa}=Ae,De=pt.some((nt)=>/\b(?:state|derived|effect|ref|useRef|reactive|computed|watch|watchEffect|useModel|useReactiveProp|onMount|onDestroy|defineProps|withDefaults|defineEmits|defineExpose|defineSlots)\s*(?:<[^<>()]*>)?\s*\(/.test(nt)),Je=(nt)=>De?sm(nt,Ie):nt,st=new Map([...pa].map(([nt,ot])=>[nt,{...ot,content:Je(ot.content)}]));jt=await ua(jt,Je(da),st,Ze);let mt=Ec(pt),At=(Array.isArray(Ze.__stx_client_signal_names)?Ze.__stx_client_signal_names:[]).filter((nt)=>!er.has(nt));if(mt.length>0||At.length>0)Ze.__stx_client_signal_names=[...new Set([...At,...mt])];else delete Ze.__stx_client_signal_names;let Kt={...B,_rootComponentsDir:B._rootComponentsDir||B.componentsDir,componentsDir:et.dirname(oe),skipSignalsRuntime:!0,skipEventDirectives:De||pt.length===0,defaultLayout:void 0};Ze.__stxProcessingDepth=(T.__stxProcessingDepth||0)+1;let _n=await n(jt,Ze,oe,Kt,F),zi=new Set(Array.isArray(T.__stx_preserved_client_expressions)?T.__stx_preserved_client_expressions:[]);for(let nt of _n.matchAll(/\{\{([\s\S]*?)\}\}/g))zi.add(nt[1].trim());if(zi.size>0)T.__stx_preserved_client_expressions=[...zi];let lr=Ie,Zt=_n;if(De){let nt="";if(Object.keys(_).length>0)try{nt=` data-stx-props="${Om(JSON.stringify(_))}"`}catch{}let ot=ne?` stx-hydrate="${Om(ne)}"`:"",Tt=` data-stx-scope="${lr}"${nt}${ot}`,dt=/^\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*<span(?=[\s/>])/i.test(_n),Vt=dt?"span":"div";Zt=Cc(_n,Tt)??`<${Vt}${Tt}${dt?' style="display:contents"':""}>${_n}</${Vt}>`;let Mt=await Promise.all(pt.map(async(Gt)=>{let tr=Gt.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!tr)return Gt;let[,lt,kn]=tr,{vendorStyleTags:Nr,factoryBody:jr}=await WS(kn,oe,B.buildMode==="compile"),Lr=ne?null:va(T,jr),Bt=Lr?`window.__stxComponentFactories[${JSON.stringify(Lr)}](${JSON.stringify(lr)});`:`(${jr})(${JSON.stringify(lr)});`;if(ne)return`${Nr}<script type="stx/island" data-stx-island="${lr}" data-stx-scoped data-stx-owner="${lr}"${lt}>${Bt}</script>`;return`${Nr}<script data-stx-scoped data-stx-run="always" data-stx-owner="${lr}"${lt}>${Bt}</script>`}));if(Zt=Zt+`
2094
+ `)}`:"";console.error(`[stx] component <${v}> could not be resolved${j}, so it rendered as nothing.${B}${z}`)}function Wm(v){return`<!-- stx: component "${v.replace(/--+/g,"-")}" could not be resolved; see the server log -->`}function Ec(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 We(v,_,k,E,T,j,B,z=new Set,F){let{extractVariables:V}=await ut("stx/variable-extractor",()=>import("./chunk-bprn7crb.js")),H=z??new Set;if(H.has(v))return`[Circular component reference: ${v}]`;let G=new Set(H);G.add(v);let J=typeof _.client==="string"?_.client.trim():"";if("client"in _)delete _.client;let ne=J&&J!=="load"&&$c(J)?J:"";try{let re=(nt)=>nt.split("-").map((ot)=>ot.charAt(0).toUpperCase()+ot.slice(1)).join(""),se=(nt)=>nt.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),ie=v.endsWith(".stx")?v.slice(0,-4):v,oe=null,ue=T.__importedComponents;if(ue){let nt=[ie,ie.toLowerCase(),re(ie),se(ie)];for(let ot of nt)if(ue.has(ot)){oe=ue.get(ot);break}}let ae=[];if(!oe){let nt=[`${ie}.stx`,`${re(ie)}.stx`,`${se(ie)}.stx`],ot=[...new Set(nt)],Tt=T.__originalFilePath,dt=[];if(dt.push(...B._layerComponentDirs??[]),Tt){let Bt=et.join(et.dirname(Tt),"components");dt.push(Bt)}if(E)dt.push(E);let Vt=B._rootComponentsDir;if(typeof Vt==="string"&&!dt.includes(Vt))dt.push(Vt);let Mt=et.join(et.dirname(j),"components");if(!dt.includes(Mt))dt.push(Mt);if(B.componentsDir&&B.componentsDir!==E&&!dt.includes(B.componentsDir))dt.push(B.componentsDir);let Gt=typeof B.root==="string"?et.resolve(B.root):void 0,tr=Gt??et.dirname(j),lt=[];if(Gt)lt.push(et.resolve(Gt,"resources/views/components")),lt.push(et.resolve(Gt,"resources/components")),lt.push(et.resolve(Gt,"src/components")),lt.push(et.resolve(Gt,"components"));lt.push(et.resolve(import.meta.dir,"components"));for(let Bt of lt)if(!dt.includes(Bt))dt.push(Bt);let kn=B._pluginComponentDirs;if(Array.isArray(kn)){for(let Bt of kn)if(typeof Bt==="string"&&!dt.includes(Bt))dt.push(Bt)}if(B.fallbackComponentsDir&&!dt.includes(B.fallbackComponentsDir))dt.push(B.fallbackComponentsDir);let Nr=[...new Set(dt.map((Bt)=>{if(!Bt)return Bt;return et.isAbsolute(Bt)?Bt:et.resolve(tr,Bt)}))];dt.length=0,dt.push(...Nr);let jr=`${ie}\x00${j}\x00${Nr.join("\x00")}`,Lr=ta.get(jr);if(Lr)if(await r(Lr))oe=Lr;else ta.delete(jr);if(!oe&&(ie.startsWith("./")||ie.startsWith("../")))oe=et.resolve(et.dirname(j),`${ie}.stx`),ae.push(oe);else if(!oe)for(let Bt of dt){if(!Bt)continue;for(let Br of ot){let Fi=et.join(Bt,Br);if(ae.push(Fi),await r(Fi)){oe=Fi;break}}if(oe)break;if(!oe)try{let Br=await import("fs");if(!Br.statSync(Bt,{throwIfNoEntry:!1})?.isDirectory())continue;let ph=8,ga=[{path:Bt,depth:0}];while(ga.length>0&&!oe){let Vi=ga.pop();if(Vi.depth>=ph)continue;let iu;try{iu=Br.readdirSync(Vi.path,{withFileTypes:!0})}catch{continue}for(let Wi of iu){if(!Wi.isDirectory())continue;if(Wi.name==="node_modules"||Wi.name.startsWith("."))continue;let ou=et.join(Vi.path,Wi.name);for(let fh of ot){let ma=et.join(ou,fh);if(ae.push(ma),await r(ma)){oe=ma;break}}if(oe)break;ga.push({path:ou,depth:Vi.depth+1})}}}catch{}if(oe)break}if(oe)ta.set(jr,oe)}if(!oe||!await r(oe))return Vm(v,j,ae),Wm(v);F.add(oe);let me;if(Ni.has(oe))me=Ni.get(oe);else try{me=await Bun.file(oe).text(),Ni.set(oe,me)}catch(nt){let ot=nt instanceof Error?nt.message:String(nt);return Vm(v,j,[oe],ot),Wm(v)}let ve=new Set(["__originalFilePath","__importedComponents",qi,"__stx_client_signal_names","__stx_client_declared_names","__stx_runtime_config","__stxServeContext","__stx_scope_seq"]),Se={};for(let[nt,ot]of Object.entries(T))if(!nt.startsWith("__")||ve.has(nt))Se[nt]=ot;let $e=k;if(k.includes("@include")){let{processIncludes:nt}=await ut("stx/includes",()=>import("./chunk-pq9978k5.js"));$e=await nt(k,T,j,B,F)}if(/<[A-Z][\w.-]*[\s/>]/.test($e)){let{processComponents:nt}=await ut("stx/component-renderer",()=>import("./chunk-fkgdbdqa.js"));$e=await nt($e,{...T,__processedComponents:H},j,B,F)}let Ce=[];if(li($e)){let{processExpressions:nt}=await ut("stx/expressions",()=>import("./chunk-sz2cf4w6.js")),ot=T.__stx_signals_gate===void 0?{...T,__stx_signals_gate:!0}:T;$e=nt($e,ot,j);for(let Tt of $e.matchAll(/\{\{([\s\S]*?)\}\}/g))Ce.push(Tt[1].trim())}let Ee=xn($e),Te=[],Re=Ee.output.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(nt,ot)=>{let Tt=Ee.scripts[Number(ot)]||"",dt=Tt.match(/^<script\b([^>]*)>/i)?.[1]||"",Vt=dt.match(/\btype\s*=\s*["']([^"']+)["']/i)?.[1]?.toLowerCase(),Mt=!Vt||["module","text/javascript","application/javascript"].includes(Vt),Gt=/\sdata-stx-(?:owner|instance)(?=[\s=/>])/i.test(` ${dt}`);if(!/\bserver\b/i.test(dt)&&Mt&&!Gt)return Te.push(Tt),"";return Tt}),{extractSlotContent:_e}=await ut("stx/slots",()=>import("./chunk-4waxn99v.js")),Ae=_e(Re),Xe={};if(Ae.defaultSlot?.trim())Xe.default=Ae.defaultSlot;for(let[nt,ot]of Ae.namedSlots)Xe[nt]=ot.content;let Pe=T.__stx_scope_seq??={n:0,key:Bun.hash(String(T.__filename??j)).toString(36).slice(0,6)},Ie=`stx_${ie.replace(/[^a-zA-Z0-9]/g,"_")}_${++Pe.n}_${Pe.key}`,Ze={...Se,$uid:Ie,..._,props:_,slot:Re,$slots:Xe,__processedComponents:G,__sections:{},__stx_signals_gate:ye(me)||li(k),__stx_preserved_client_expressions:[...Array.isArray(T.__stx_preserved_client_expressions)?T.__stx_preserved_client_expressions:[],...Ce]};zS(me,Ze);let rt=me,at=Z(rt);if(at)rt=at.content.trim();let Qe=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,ht=[...me.matchAll(Qe)],pt=[],bt=null,ct=ht.some((nt)=>/\bserver\b/.test(nt[1]||"")&&/\bcache\b/.test(nt[1]||"")),Pt=null,ft=null,Nt=null,Pn=0,Sn=null;if(DS(B),ct&&Wl>0){let nt=MS({props:_,slot:$e,slotContext:k.trim()?OS(Se):void 0,buildMode:B.buildMode??"",skipEventDirectives:B.skipEventDirectives===!0,layers:B._layerGraph?.layers.map((ot)=>ot.configFile),uid:Ie});if(nt!==null){Pt=`${oe}\x00${h(me)}\x00${nt}`;let ot=na.get(Pt);if(ot){for(let Tt of ot.dependencies)F.add(Tt);if(Uu(T,ot.clientFactories),Pe.n+=ot.uidsConsumed,ot.preservedClientExpressions.length>0){let Tt=new Set(Array.isArray(T.__stx_preserved_client_expressions)?T.__stx_preserved_client_expressions:[]);for(let dt of ot.preservedClientExpressions)Tt.add(dt);T.__stx_preserved_client_expressions=[...Tt]}return ot.output}ft=new Set(F),Nt=Vu(T),Pn=Pe.n,Sn=new Set(Array.isArray(T.__stx_preserved_client_expressions)?T.__stx_preserved_client_expressions:[])}}let er=new Set;for(let nt of ht){let ot=nt[1]||"",Tt=nt[2]||"",dt=ot.includes("server");if(Ve(ot)&&Tt.trim())Tt=Ue(Tt);if(dt&&Tt){for(let Mt of Q(Tt))er.add(Mt);try{await V(Tt,Ze,oe,{onFailure:(Mt)=>{if(Mt.kind!=="unknown")bt=Mt.kind}})}catch(Mt){}}if(!dt){let Mt=Tt.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),Gt=Mt.includes("{{")&&Mt.includes("}}"),tr=Mt.includes("{!!")&&Mt.includes("!!}");if(Gt||tr)Mt=Zr(Mt,Ze,oe);let lt=ot.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");pt.push(`<script${lt}>${Mt}</script>`)}}let it=xn(me).output.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),gt=it?it[1]:"",qt=it?it[2]:"",Dt="",hn=gt&&/\bscoped\b/i.test(gt);if(it)Dt=`<style${gt}>${VS(qt,Ze,oe)}</style>`;let jt=rt;if(jt=jt.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),it)jt=jt.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let nt=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,ot=[];if(jt=jt.replace(nt,(Tt,dt)=>{let Vt=dt.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(Vt)ot.push(`<style${Vt[1]}>${Vt[2]}</style>`);return""}),jt=jt.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),ot.length>0)Dt=`${Dt}${ot.join(`
2095
+ `)}`}if(k&&jt.includes("{{ text || slot }}"))jt=jt.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>k);let{applySlots:da}=await ut("stx/slots",()=>import("./chunk-4waxn99v.js")),{defaultSlot:pa,namedSlots:fa}=Ae,De=pt.some((nt)=>/\b(?:state|derived|effect|ref|useRef|reactive|computed|watch|watchEffect|useModel|useReactiveProp|onMount|onDestroy|defineProps|withDefaults|defineEmits|defineExpose|defineSlots)\s*(?:<[^<>()]*>)?\s*\(/.test(nt)),Je=(nt)=>De?am(nt,Ie):nt,st=new Map([...fa].map(([nt,ot])=>[nt,{...ot,content:Je(ot.content)}]));jt=await da(jt,Je(pa),st,Ze);let mt=Ec(pt),At=(Array.isArray(Ze.__stx_client_signal_names)?Ze.__stx_client_signal_names:[]).filter((nt)=>!er.has(nt));if(mt.length>0||At.length>0)Ze.__stx_client_signal_names=[...new Set([...At,...mt])];else delete Ze.__stx_client_signal_names;let Kt={...B,_rootComponentsDir:B._rootComponentsDir||B.componentsDir,componentsDir:et.dirname(oe),skipSignalsRuntime:!0,skipEventDirectives:De||pt.length===0,defaultLayout:void 0};Ze.__stxProcessingDepth=(T.__stxProcessingDepth||0)+1;let _n=await n(jt,Ze,oe,Kt,F),zi=new Set(Array.isArray(T.__stx_preserved_client_expressions)?T.__stx_preserved_client_expressions:[]);for(let nt of _n.matchAll(/\{\{([\s\S]*?)\}\}/g))zi.add(nt[1].trim());if(zi.size>0)T.__stx_preserved_client_expressions=[...zi];let lr=Ie,Zt=_n;if(De){let nt="";if(Object.keys(_).length>0)try{nt=` data-stx-props="${Lm(JSON.stringify(_))}"`}catch{}let ot=ne?` stx-hydrate="${Lm(ne)}"`:"",Tt=` data-stx-scope="${lr}"${nt}${ot}`,dt=/^\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*<span(?=[\s/>])/i.test(_n),Vt=dt?"span":"div";Zt=Cc(_n,Tt)??`<${Vt}${Tt}${dt?' style="display:contents"':""}>${_n}</${Vt}>`;let Mt=await Promise.all(pt.map(async(Gt)=>{let tr=Gt.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!tr)return Gt;let[,lt,kn]=tr,{vendorStyleTags:Nr,factoryBody:jr}=await HS(kn,oe,B.buildMode==="compile"),Lr=ne?null:wa(T,jr),Bt=Lr?`window.__stxComponentFactories[${JSON.stringify(Lr)}](${JSON.stringify(lr)});`:`(${jr})(${JSON.stringify(lr)});`;if(ne)return`${Nr}<script type="stx/island" data-stx-island="${lr}" data-stx-scoped data-stx-owner="${lr}"${lt}>${Bt}</script>`;return`${Nr}<script data-stx-scoped data-stx-run="always" data-stx-owner="${lr}"${lt}>${Bt}</script>`}));if(Zt=Zt+`
2096
2096
  `+Mt.join(`
2097
2097
  `),Dt)Zt+=`
2098
2098
  `+Dt}else{if(Dt)Zt+=`
2099
2099
  `+Dt;if(pt.length>0){let nt=Ze.__stx_event_bindings||[],ot=Ne(Ze),Tt=await Promise.all(pt.map(async(dt)=>{let Vt=dt.match(/<script\b[^>]*>([\s\S]*?)<\/script>/);if(!Vt)return dt;return await he(Vt[1],{eventBindings:nt,templateContent:Zt,filePath:oe,projectRoot:process.cwd(),serverData:ot,instanceId:Ie})}));Zt+=`
2100
2100
  `+Tt.join(`
2101
- `),Ze.__stx_event_bindings=[]}}if(hn){let nt=Qi(Zt,oe);if(nt.hasScoped)Zt=nt.html}if(Pt&&ft){let nt=Array.isArray(T.__stx_preserved_client_expressions)?T.__stx_preserved_client_expressions:[];ta.set(Pt,{output:Zt,dependencies:[...F].filter((ot)=>!ft.has(ot)),clientFactories:Nt?pd(T,Nt):[],uidsConsumed:Pe.n-Pn,preservedClientExpressions:Sn?nt.filter((ot)=>!Sn.has(ot)):[]})}if(bt)Zt=`<!--stx-render-failed:${bt}-->${Zt}`;return Te.length>0?`${Zt}
2101
+ `),Ze.__stx_event_bindings=[]}}if(hn){let nt=Qi(Zt,oe);if(nt.hasScoped)Zt=nt.html}if(Pt&&ft){let nt=Array.isArray(T.__stx_preserved_client_expressions)?T.__stx_preserved_client_expressions:[];na.set(Pt,{output:Zt,dependencies:[...F].filter((ot)=>!ft.has(ot)),clientFactories:Nt?Wu(T,Nt):[],uidsConsumed:Pe.n-Pn,preservedClientExpressions:Sn?nt.filter((ot)=>!Sn.has(ot)):[]})}if(bt)Zt=`<!--stx-render-failed:${bt}-->${Zt}`;return Te.length>0?`${Zt}
2102
2102
  ${Te.join(`
2103
- `)}`:Zt}catch(re){return`[Error processing component: ${re instanceof Error?re.message:String(re)}]`}finally{H.delete(v)}}async function r(v){return Bun.file(v).exists()}function Wl(v,_){let k=et.resolve(_),E=et.resolve(v),T=k.endsWith(et.sep)?k:k+et.sep;if(E===k||E.startsWith(T))return E;return null}async function FS(v,_,k,E){let T=_.startsWith("layouts/")?_.slice(8):_,j=et.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 Kn(v,_,k,E){let T=await VS(v,_,k,E);if(T===null)return null;let j=Wl(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=et.isAbsolute(z)?z:et.resolve(process.cwd(),z);if(Wl(T,F))return et.resolve(T)}return console.warn(`[stx] rejected resolved template path that escapes project root: ${T} (template: ${v}, from: ${_})`),null}async function VS(v,_,k,E){if(k.debug)console.log(`Resolving template path: ${v} from ${_}`);let T=et.dirname(_),j=process.cwd();if(v.startsWith("/")){let J=et.join(j,v),ne=Wl(J,j);if(!ne)return console.warn(`[stx] rejected template path that escapes project root: ${v} (from ${_})`),null;if(k.debug)console.log(`Checking absolute path: ${ne}`);if(await r(ne)&&E)E.add(ne);return ne}let B=et.join(T,v);if(await r(B)){if(k.debug)console.log(`Found direct path: ${B}`);if(E)E.add(B);return B}if(!v.endsWith(".stx")&&!v.endsWith(".jsx")&&!v.endsWith(".tsx"))for(let J of[".stx",".tsx",".jsx"]){let ne=`${B}${J}`;if(await r(ne)){if(k.debug)console.log(`Found direct path with extension: ${ne}`);if(E)E.add(ne);return ne}}let z=[];if(z.push(...k._layerLayoutDirs??[]),k.layoutsDir)z.push(et.isAbsolute(k.layoutsDir)?k.layoutsDir:et.resolve(process.cwd(),k.layoutsDir));let F=et.resolve(T),V=process.cwd();for(let J=0;J<10;J++){let ne=et.join(F,"layouts"),re=!1;try{re=Fm.statSync(ne,{throwIfNoEntry:!1})?.isDirectory()??!1}catch{}if(re){z.push(ne);break}let se=et.dirname(F);if(se===F||se.length<V.length)break;F=se}for(let J of z){let ne=await FS(J,v,E,k.debug);if(ne)return ne}if(k.fallbackLayoutsDir){let J=et.isAbsolute(k.fallbackLayoutsDir)?k.fallbackLayoutsDir:et.resolve(process.cwd(),k.fallbackLayoutsDir),ne=v.startsWith("layouts/")?v.slice(8):v,re=[et.join(J,ne)];if(!v.endsWith(".stx"))re.push(`${re[0]}.stx`);for(let se of re)if(await r(se)){if(k.debug)console.log(`Found in options.fallbackLayoutsDir: ${se}`);if(E)E.add(se);return se}}if(v.startsWith("layouts/")||v.includes("/layouts/")){let J=v.split("layouts/"),ne=et.join(k.partialsDir||T,"layouts",J[1]);if(await r(ne)){if(k.debug)console.log(`Found in layouts path: ${ne}`);if(E)E.add(ne);return ne}if(!ne.endsWith(".stx")){let re=`${ne}.stx`;if(await r(re)){if(k.debug)console.log(`Found in layouts path with extension: ${re}`);if(E)E.add(re);return re}}}if(k.partialsDir){let J=et.join(k.partialsDir,"layouts");if(await r(J)){let ne=et.join(J,v);if(await r(ne)){if(k.debug)console.log(`Found in partials layouts dir: ${ne}`);if(E)E.add(ne);return ne}if(!v.endsWith(".stx")){let re=`${ne}.stx`;if(await r(re)){if(k.debug)console.log(`Found in partials layouts dir with extension: ${re}`);if(E)E.add(re);return re}}}}let H=k.partialsDir||et.join(process.cwd(),"views"),G=et.join(H,v);if(await r(G)){if(k.debug)console.log(`Found in views path: ${G}`);if(E)E.add(G);return G}if(!v.endsWith(".stx")){let J=`${G}.stx`;if(await r(J)){if(k.debug)console.log(`Found in views path with extension: ${J}`);if(E)E.add(J);return J}}if(T.includes("temp")){let J=et.join(et.dirname(T),"layouts",v);if(await r(J)){if(k.debug)console.log(`Found in temp layouts dir: ${J}`);if(E)E.add(J);return J}if(!v.endsWith(".stx")){let ne=`${J}.stx`;if(await r(ne)){if(k.debug)console.log(`Found in temp layouts dir with extension: ${ne}`);if(E)E.add(ne);return ne}}}if(k.debug)console.warn(`Template not found after trying all paths: ${v} (referenced from ${_})`);else console.warn(`Template not found: ${v} (referenced from ${_})`);return null}function ui(v,_,k){let E=0,T="",j="";try{if(typeof _==="number"&&_>=0){let B=v.split(`
2103
+ `)}`:Zt}catch(re){return`[Error processing component: ${re instanceof Error?re.message:String(re)}]`}finally{H.delete(v)}}async function r(v){return Bun.file(v).exists()}function Ul(v,_){let k=et.resolve(_),E=et.resolve(v),T=k.endsWith(et.sep)?k:k+et.sep;if(E===k||E.startsWith(T))return E;return null}async function WS(v,_,k,E){let T=_.startsWith("layouts/")?_.slice(8):_,j=et.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 Kn(v,_,k,E){let T=await US(v,_,k,E);if(T===null)return null;let j=Ul(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=et.isAbsolute(z)?z:et.resolve(process.cwd(),z);if(Ul(T,F))return et.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=et.dirname(_),j=process.cwd();if(v.startsWith("/")){let J=et.join(j,v),ne=Ul(J,j);if(!ne)return console.warn(`[stx] rejected template path that escapes project root: ${v} (from ${_})`),null;if(k.debug)console.log(`Checking absolute path: ${ne}`);if(await r(ne)&&E)E.add(ne);return ne}let B=et.join(T,v);if(await r(B)){if(k.debug)console.log(`Found direct path: ${B}`);if(E)E.add(B);return B}if(!v.endsWith(".stx")&&!v.endsWith(".jsx")&&!v.endsWith(".tsx"))for(let J of[".stx",".tsx",".jsx"]){let ne=`${B}${J}`;if(await r(ne)){if(k.debug)console.log(`Found direct path with extension: ${ne}`);if(E)E.add(ne);return ne}}let z=[];if(z.push(...k._layerLayoutDirs??[]),k.layoutsDir)z.push(et.isAbsolute(k.layoutsDir)?k.layoutsDir:et.resolve(process.cwd(),k.layoutsDir));let F=et.resolve(T),V=process.cwd();for(let J=0;J<10;J++){let ne=et.join(F,"layouts"),re=!1;try{re=Um.statSync(ne,{throwIfNoEntry:!1})?.isDirectory()??!1}catch{}if(re){z.push(ne);break}let se=et.dirname(F);if(se===F||se.length<V.length)break;F=se}for(let J of z){let ne=await WS(J,v,E,k.debug);if(ne)return ne}if(k.fallbackLayoutsDir){let J=et.isAbsolute(k.fallbackLayoutsDir)?k.fallbackLayoutsDir:et.resolve(process.cwd(),k.fallbackLayoutsDir),ne=v.startsWith("layouts/")?v.slice(8):v,re=[et.join(J,ne)];if(!v.endsWith(".stx"))re.push(`${re[0]}.stx`);for(let se of re)if(await r(se)){if(k.debug)console.log(`Found in options.fallbackLayoutsDir: ${se}`);if(E)E.add(se);return se}}if(v.startsWith("layouts/")||v.includes("/layouts/")){let J=v.split("layouts/"),ne=et.join(k.partialsDir||T,"layouts",J[1]);if(await r(ne)){if(k.debug)console.log(`Found in layouts path: ${ne}`);if(E)E.add(ne);return ne}if(!ne.endsWith(".stx")){let re=`${ne}.stx`;if(await r(re)){if(k.debug)console.log(`Found in layouts path with extension: ${re}`);if(E)E.add(re);return re}}}if(k.partialsDir){let J=et.join(k.partialsDir,"layouts");if(await r(J)){let ne=et.join(J,v);if(await r(ne)){if(k.debug)console.log(`Found in partials layouts dir: ${ne}`);if(E)E.add(ne);return ne}if(!v.endsWith(".stx")){let re=`${ne}.stx`;if(await r(re)){if(k.debug)console.log(`Found in partials layouts dir with extension: ${re}`);if(E)E.add(re);return re}}}}let H=k.partialsDir||et.join(process.cwd(),"views"),G=et.join(H,v);if(await r(G)){if(k.debug)console.log(`Found in views path: ${G}`);if(E)E.add(G);return G}if(!v.endsWith(".stx")){let J=`${G}.stx`;if(await r(J)){if(k.debug)console.log(`Found in views path with extension: ${J}`);if(E)E.add(J);return J}}if(T.includes("temp")){let J=et.join(et.dirname(T),"layouts",v);if(await r(J)){if(k.debug)console.log(`Found in temp layouts dir: ${J}`);if(E)E.add(J);return J}if(!v.endsWith(".stx")){let ne=`${J}.stx`;if(await r(ne)){if(k.debug)console.log(`Found in temp layouts dir with extension: ${ne}`);if(E)E.add(ne);return ne}}}if(k.debug)console.warn(`Template not found after trying all paths: ${v} (referenced from ${_})`);else console.warn(`Template not found: ${v} (referenced from ${_})`);return null}function di(v,_,k){let E=0,T="",j="";try{if(typeof _==="number"&&_>=0){let B=v.split(`
2104
2104
  `),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),H=Math.min(B.length,F+3);j=B.slice(V,H).map((G,J)=>{let ne=V+J+1;return`${ne===E?"> ":" "}${ne}: ${G}`}).join(`
2105
- `);break}}else if(k){let B=v.indexOf(k);if(B>=0)return ui(v,B)}}catch{}return{lineNumber:E,lineContent:T,context:j}}var yt={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}=ui(E,T,j),F=k.split("/").pop(),V=0;if(typeof T==="number"&&T>=0&&E){let G=E.lastIndexOf(`
2105
+ `);break}}else if(k){let B=v.indexOf(k);if(B>=0)return di(v,B)}}catch{}return{lineNumber:E,lineContent:T,context:j}}var yt={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}=di(E,T,j),F=k.split("/").pop(),V=0;if(typeof T==="number"&&T>=0&&E){let G=E.lastIndexOf(`
2106
2106
  `,Math.max(0,T-1));V=T-(G+1)+1}let H="";if(B>0)H+=`
2107
2107
  ${k}:${B}${V>0?`:${V}`:""}: ${v.toLowerCase()} error: ${_}
2108
2108
  `;if(H+=`
@@ -2115,7 +2115,7 @@ ${yt.yellow}${yt.bold}Message:${yt.reset} ${_}
2115
2115
  `,z)H+=`
2116
2116
  ${yt.blue}${yt.bold}Context:${yt.reset}
2117
2117
  ${yt.dim}${z}${yt.reset}
2118
- `;return H}function ee(){Ni.clear(),ea.clear(),zl.clear(),Fl.clear(),ta.clear()}function zu(){return{size:Ni.size,maxSize:500}}var Bl=m(128);async function WS(v,_,k){let E=h(v,_,k),T=Bl.get(E);if(T){if(Qt(T.deps))return T;Bl.delete(E)}let j=Kr(v,{filePath:_,projectRoot:process.cwd()}),B=j.code,z=Xr(j.styles);B=wt(B).code;let{hasUserImports:F,bundleClientScript:V}=await ut("stx/client-script-bundler",()=>import("./chunk-07mksefx.js")),H=[],G=!1;if(F(B)){let oe=B;B=await V(oe,_,{projectRoot:process.cwd(),minify:k,collectInputs:H}),G=B===oe}let{stripStxRuntimeImports:J}=await ut("stx/signal-processing",()=>import("./chunk-q9yhnqe5.js"));B=J(B);let ne=P(B),re=OS(ne),se=`function(__scopeId) {
2118
+ `;return H}function ee(){Ni.clear(),ta.clear(),Fl.clear(),Vl.clear(),na.clear()}function zd(){return{size:Ni.size,maxSize:500}}var zl=m(128);async function HS(v,_,k){let E=h(v,_,k),T=zl.get(E);if(T){if(Qt(T.deps))return T;zl.delete(E)}let j=Kr(v,{filePath:_,projectRoot:process.cwd()}),B=j.code,z=Xr(j.styles);B=wt(B).code;let{hasUserImports:F,bundleClientScript:V}=await ut("stx/client-script-bundler",()=>import("./chunk-tydxqfs6.js")),H=[],G=!1;if(F(B)){let oe=B;B=await V(oe,_,{projectRoot:process.cwd(),minify:k,collectInputs:H}),G=B===oe}let{stripStxRuntimeImports:J}=await ut("stx/signal-processing",()=>import("./chunk-6a1g18h4.js"));B=J(B);let ne=P(B),re=jS(ne),se=`function(__scopeId) {
2119
2119
  ${Rt("const",[...Si,...re],ne)}
2120
2120
  const __scope = window.stx._scopes = window.stx._scopes || {};
2121
2121
  const __scopeVars = __scope[__scopeId] = __scope[__scopeId] || {};
@@ -2172,8 +2172,8 @@ finally {
2172
2172
  window.__STX_CURRENT_ELEMENT__ = __previousCurrentElement;
2173
2173
  window.__STX_CURRENT_PROPS__ = __previousCurrentProps;
2174
2174
  }
2175
- }`,ie={vendorStyleTags:z,factoryBody:se,deps:nd([...H,...j.styles.map((oe)=>oe.resolvedPath)])};if(!G&&j.unresolved.length===0)Bl.set(E,ie);return ie}async function vm(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]:"",H=z+B[0].length,G=1,J=H,ne=-1;while(G>0&&J<v.length){let ie=v.indexOf("@markdown",J),oe=v.indexOf("@endmarkdown",J);if(oe===-1)break;if(ie!==-1&&ie<oe&&ie!==z){let de=v[ie+9];if(de==="("||de===`
2176
- `||de==="\r"||de===" "||de===void 0)G++;J=ie+9}else{if(G--,G===0){ne=oe;break}J=oe+12}}if(ne===-1)continue;let re=v.slice(H,ne),se=v.slice(z,ne+12);T.push({fullMatch:se,options:V,content:re,index:z}),j.lastIndex=ne+12}for(let{fullMatch:z,options:F,content:V,index:H}of T)try{let G={};if(F)F.split(",").forEach((re)=>{let se=re.trim();if(se)G[se]=!0});let J={gfm:G.gfm??!0,breaks:G.breaks??!1},ne=Oe(V.trim(),J);E=E.split(z).join(ne)}catch(G){let J=G instanceof Error?G.message:String(G),ne=g("Markdown Directive",`Error processing markdown: ${J}`,k,v,H,z);E=E.split(z).join(ne)}return E}async function Wm(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}),Oe(v.trim(),T)}var Ws=[320,480,640,768,1024,1280,1536,1920,2560],US=[1,1.5,2,3],ji=["avif","webp","jpeg"],HS={avif:"image/avif",webp:"image/webp",jpeg:"image/jpeg",png:"image/png",gif:"image/gif"};function Ul(v,_=Ws,k={},E){return _.sort((T,j)=>T-j).map((T)=>`${Li(v,{...k,w:T,fm:E})} ${T}w`).join(", ")}function Um(v,_,k=US,E={},T){return k.sort((j,B)=>j-B).map((j)=>{let B=Math.round(_*j);return`${Li(v,{...E,w:B,dpr:j,fm:T})} ${j}x`}).join(", ")}function Hl(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 Li(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 ql(v){return HS[v]||"application/octet-stream"}var qS={strategy:"thumbhash",width:20,quality:50,blurLevel:40,transitionDuration:300,easing:"ease-out"},Xl=`
2175
+ }`,ie={vendorStyleTags:z,factoryBody:se,deps:Du([...H,...j.styles.map((oe)=>oe.resolvedPath)])};if(!G&&j.unresolved.length===0)zl.set(E,ie);return ie}async function $m(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]:"",H=z+B[0].length,G=1,J=H,ne=-1;while(G>0&&J<v.length){let ie=v.indexOf("@markdown",J),oe=v.indexOf("@endmarkdown",J);if(oe===-1)break;if(ie!==-1&&ie<oe&&ie!==z){let ue=v[ie+9];if(ue==="("||ue===`
2176
+ `||ue==="\r"||ue===" "||ue===void 0)G++;J=ie+9}else{if(G--,G===0){ne=oe;break}J=oe+12}}if(ne===-1)continue;let re=v.slice(H,ne),se=v.slice(z,ne+12);T.push({fullMatch:se,options:V,content:re,index:z}),j.lastIndex=ne+12}for(let{fullMatch:z,options:F,content:V,index:H}of T)try{let G={};if(F)F.split(",").forEach((re)=>{let se=re.trim();if(se)G[se]=!0});let J={gfm:G.gfm??!0,breaks:G.breaks??!1},ne=Oe(V.trim(),J);E=E.split(z).join(ne)}catch(G){let J=G instanceof Error?G.message:String(G),ne=g("Markdown Directive",`Error processing markdown: ${J}`,k,v,H,z);E=E.split(z).join(ne)}return E}async function qm(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}),Oe(v.trim(),T)}var Vs=[320,480,640,768,1024,1280,1536,1920,2560],qS=[1,1.5,2,3],ji=["avif","webp","jpeg"],KS={avif:"image/avif",webp:"image/webp",jpeg:"image/jpeg",png:"image/png",gif:"image/gif"};function Hl(v,_=Vs,k={},E){return _.sort((T,j)=>T-j).map((T)=>`${Li(v,{...k,w:T,fm:E})} ${T}w`).join(", ")}function Km(v,_,k=qS,E={},T){return k.sort((j,B)=>j-B).map((j)=>{let B=Math.round(_*j);return`${Li(v,{...E,w:B,dpr:j,fm:T})} ${j}x`}).join(", ")}function ql(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 Li(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 Kl(v){return KS[v]||"application/octet-stream"}var XS={strategy:"thumbhash",width:20,quality:50,blurLevel:40,transitionDuration:300,easing:"ease-out"},Zl=`
2177
2177
  .stx-img-placeholder {
2178
2178
  position: relative;
2179
2179
  overflow: hidden;
@@ -2202,7 +2202,7 @@ finally {
2202
2202
  filter: blur(0);
2203
2203
  transform: scale(1);
2204
2204
  }
2205
- `.trim();async function KS(){try{return await import("ts-images")}catch{return null}}async function XS(v,_={}){let k={...qS,..._},E=await KS();if(E)try{return await ZS(v,k,E)}catch(T){console.warn(`[stx-media] ts-images placeholder generation failed, using fallback: ${T}`)}return GS(v,k)}async function ZS(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 GS(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 Hm(v,_,k={}){let E=k.transitionDuration||300,T=k.easing||"ease-out";return`
2205
+ `.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 Xm(v,_,k={}){let E=k.transitionDuration||300,T=k.easing||"ease-out";return`
2206
2206
  #${v} {
2207
2207
  --stx-img-transition-duration: ${E}ms;
2208
2208
  --stx-img-transition-easing: ${T};
@@ -2219,8 +2219,8 @@ finally {
2219
2219
  #${v}.stx-img-loaded img {
2220
2220
  opacity: 1;
2221
2221
  }
2222
- `.trim()}var Kl=new Map;async function qm(v,_={}){let k=`${v}:${JSON.stringify(_)}`;if(Kl.has(k))return Kl.get(k);let E=await XS(v,_);return Kl.set(k,E),E}async function JS(){try{return await import("./chunk-5sb7gw66.js")}catch(v){if(!Km)console.warn("[stx-media] Image processor not available, some features disabled:",v),Km=!0;return null}}var Km=!1,Zl=80,ra="async",sa="lazy",Xm=!1;async function na(v,_={}){let k=_,E=v;if(E.process&&!E.skipOptimization){if(k.tsImagesConfig?.enabled&&!k.isDev)return t0(E,k)}if(k.processedResult?.processed)return Yl(v,k.processedResult,_);if(k.responsiveVariants)return Jm(v,k.responsiveVariants,_);let{src:T,alt:j,width:B,height:z,sizes:F,widths:V=Ws,dpr:H,formats:G=ji,quality:J=Zl,params:ne={},placeholder:re="none",placeholderOptions:se={},lazy:ie=!0,priority:oe=!1,loading:de=oe?"eager":sa,decoding:ae=ra,fetchpriority:me,objectFit:ve,objectPosition:Se,crossorigin:$e,referrerpolicy:Ce}=v,{class:Ee,style:Te,id:Re}=v,_e=v.data||{},{isDev:Ae=!1,baseUrl:Xe=""}=_;if(Ae&&!_.optimize)return e0(v);let Pe,Ie,Ze=Re||`stx-img-${Math.random().toString(36).slice(2,8)}`;if(re!=="none"&&!oe)try{Pe=await qm(T,{strategy:re,...se}),Ie=Hm(Ze,Pe,se)}catch{}let rt=H!==void 0&&B!==void 0,at;if(rt)at=QS(v,Ze,Pe,_);else at=await YS(v,Ze,Pe,_);let Qe;if(oe){let bt=G.includes("webp")?"webp":G[0],ct=Ul(T,V,{...ne,q:J},bt),Pt=typeof F==="object"?Hl(F):F||"100vw";Qe=`<link rel="preload" as="image" imagesrcset="${ct}" imagesizes="${Pt}" />`}let ht=[];if(!Xm&&re!=="none")ht.push(Xl),Xm=!0;if(Ie)ht.push(Ie);let pt=ie?Gm(Ze):void 0;return{html:at,preloadLink:Qe,css:ht.length>0?ht.join(`
2223
- `):void 0,script:pt}}async function YS(v,_,k,E){let{src:T,alt:j,width:B,height:z,sizes:F,widths:V=Ws,formats:H=ji,quality:G=Zl,params:J={},lazy:ne=!0,priority:re=!1,loading:se=re?"eager":sa,decoding:ie=ra,fetchpriority:oe,objectFit:de,objectPosition:ae,crossorigin:me,referrerpolicy:ve}=v,{class:Se,style:$e}=v,Ce=v.data||{},Ee=typeof F==="object"?Hl(F):F||"100vw",Te=[];for(let Ae of H){let Xe=Ul(T,V,{...J,q:G},Ae),Pe=ql(Ae);if(ne&&!re)Te.push(` <source type="${Pe}" data-srcset="${Xe}" data-sizes="${Ee}" />`);else Te.push(` <source type="${Pe}" srcset="${Xe}" sizes="${Ee}" />`)}let Re=Gl({src:Li(T,{...J,q:G}),alt:j,width:B,height:z,loading:re?void 0:se,decoding:ie,fetchpriority:re?"high":oe,objectFit:de,objectPosition:ae,crossorigin:me,referrerpolicy:ve,className:Zm(Se,k),style:Jl($e,de,ae,k),lazy:ne&&!re,data:Ce}),_e;if(k){let Ae=`background-image: url('${k.dataURL}'); background-size: cover; background-position: center;`;_e=`<div id="${_}" class="stx-img-placeholder" style="${Ae}">
2222
+ `.trim()}var Xl=new Map;async function Zm(v,_={}){let k=`${v}:${JSON.stringify(_)}`;if(Xl.has(k))return Xl.get(k);let E=await GS(v,_);return Xl.set(k,E),E}async function QS(){try{return await import("./chunk-5sb7gw66.js")}catch(v){if(!Gm)console.warn("[stx-media] Image processor not available, some features disabled:",v),Gm=!0;return null}}var Gm=!1,Gl=80,sa="async",ia="lazy",Jm=!1;async function ra(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 Ql(v,k.processedResult,_);if(k.responsiveVariants)return eh(v,k.responsiveVariants,_);let{src:T,alt:j,width:B,height:z,sizes:F,widths:V=Vs,dpr:H,formats:G=ji,quality:J=Gl,params:ne={},placeholder:re="none",placeholderOptions:se={},lazy:ie=!0,priority:oe=!1,loading:ue=oe?"eager":ia,decoding:ae=sa,fetchpriority:me,objectFit:ve,objectPosition:Se,crossorigin:$e,referrerpolicy:Ce}=v,{class:Ee,style:Te,id:Re}=v,_e=v.data||{},{isDev:Ae=!1,baseUrl:Xe=""}=_;if(Ae&&!_.optimize)return n0(v);let Pe,Ie,Ze=Re||`stx-img-${Math.random().toString(36).slice(2,8)}`;if(re!=="none"&&!oe)try{Pe=await Zm(T,{strategy:re,...se}),Ie=Xm(Ze,Pe,se)}catch{}let rt=H!==void 0&&B!==void 0,at;if(rt)at=t0(v,Ze,Pe,_);else at=await e0(v,Ze,Pe,_);let Qe;if(oe){let bt=G.includes("webp")?"webp":G[0],ct=Hl(T,V,{...ne,q:J},bt),Pt=typeof F==="object"?ql(F):F||"100vw";Qe=`<link rel="preload" as="image" imagesrcset="${ct}" imagesizes="${Pt}" />`}let ht=[];if(!Jm&&re!=="none")ht.push(Zl),Jm=!0;if(Ie)ht.push(Ie);let pt=ie?Qm(Ze):void 0;return{html:at,preloadLink:Qe,css:ht.length>0?ht.join(`
2223
+ `):void 0,script:pt}}async function e0(v,_,k,E){let{src:T,alt:j,width:B,height:z,sizes:F,widths:V=Vs,formats:H=ji,quality:G=Gl,params:J={},lazy:ne=!0,priority:re=!1,loading:se=re?"eager":ia,decoding:ie=sa,fetchpriority:oe,objectFit:ue,objectPosition:ae,crossorigin:me,referrerpolicy:ve}=v,{class:Se,style:$e}=v,Ce=v.data||{},Ee=typeof F==="object"?ql(F):F||"100vw",Te=[];for(let Ae of H){let Xe=Hl(T,V,{...J,q:G},Ae),Pe=Kl(Ae);if(ne&&!re)Te.push(` <source type="${Pe}" data-srcset="${Xe}" data-sizes="${Ee}" />`);else Te.push(` <source type="${Pe}" srcset="${Xe}" sizes="${Ee}" />`)}let Re=Jl({src:Li(T,{...J,q:G}),alt:j,width:B,height:z,loading:re?void 0:se,decoding:ie,fetchpriority:re?"high":oe,objectFit:ue,objectPosition:ae,crossorigin:me,referrerpolicy:ve,className:Ym(Se,k),style:Yl($e,ue,ae,k),lazy:ne&&!re,data:Ce}),_e;if(k){let Ae=`background-image: url('${k.dataURL}'); background-size: cover; background-position: center;`;_e=`<div id="${_}" class="stx-img-placeholder" style="${Ae}">
2224
2224
  <picture>
2225
2225
  ${Te.join(`
2226
2226
  `)}
@@ -2230,9 +2230,9 @@ ${Te.join(`
2230
2230
  ${Te.join(`
2231
2231
  `)}
2232
2232
  <img ${Re} />
2233
- </picture>`;return _e}function QS(v,_,k,E){let{src:T,alt:j,width:B,height:z,dpr:F=[1,2,3],quality:V=Zl,params:H={},lazy:G=!0,priority:J=!1,loading:ne=J?"eager":sa,decoding:re=ra,fetchpriority:se,objectFit:ie,objectPosition:oe,crossorigin:de,referrerpolicy:ae}=v,{class:me,style:ve}=v,Se=v.data||{},$e=typeof B==="number"?B:Number.parseInt(String(B),10),Ce=Um(T,$e,F,{...H,q:V}),Ee=Gl({src:Li(T,{...H,w:$e,q:V}),alt:j,width:B,height:z,loading:J?void 0:ne,decoding:re,fetchpriority:J?"high":se,objectFit:ie,objectPosition:oe,crossorigin:de,referrerpolicy:ae,className:Zm(me,k),style:Jl(ve,ie,oe,k),lazy:G&&!J,data:Se}),Te=G&&!J?`data-srcset="${Ce}"`:`srcset="${Ce}"`;if(k){let Re=`background-image: url('${k.dataURL}'); background-size: cover; background-position: center;`;return`<div id="${_}" class="stx-img-placeholder" style="${Re}">
2233
+ </picture>`;return _e}function t0(v,_,k,E){let{src:T,alt:j,width:B,height:z,dpr:F=[1,2,3],quality:V=Gl,params:H={},lazy:G=!0,priority:J=!1,loading:ne=J?"eager":ia,decoding:re=sa,fetchpriority:se,objectFit:ie,objectPosition:oe,crossorigin:ue,referrerpolicy:ae}=v,{class:me,style:ve}=v,Se=v.data||{},$e=typeof B==="number"?B:Number.parseInt(String(B),10),Ce=Km(T,$e,F,{...H,q:V}),Ee=Jl({src:Li(T,{...H,w:$e,q:V}),alt:j,width:B,height:z,loading:J?void 0:ne,decoding:re,fetchpriority:J?"high":se,objectFit:ie,objectPosition:oe,crossorigin:ue,referrerpolicy:ae,className:Ym(me,k),style:Yl(ve,ie,oe,k),lazy:G&&!J,data:Se}),Te=G&&!J?`data-srcset="${Ce}"`:`srcset="${Ce}"`;if(k){let Re=`background-image: url('${k.dataURL}'); background-size: cover; background-position: center;`;return`<div id="${_}" class="stx-img-placeholder" style="${Re}">
2234
2234
  <img ${Ee} ${Te} />
2235
- </div>`}return`<img ${_?`id="${_}" `:""}${Ee} ${Te} />`}function e0(v){let{src:_,alt:k,width:E,height:T,loading:j=sa,decoding:B=ra,fetchpriority:z,objectFit:F,objectPosition:V,crossorigin:H,referrerpolicy:G,priority:J=!1}=v,{class:ne,style:re,id:se}=v,ie=v.data||{};return{html:`<img ${Gl({src:_,alt:k,width:E,height:T,loading:J?"eager":j,decoding:B,fetchpriority:J?"high":z,objectFit:F,objectPosition:V,crossorigin:H,referrerpolicy:G,className:ne,style:Jl(re,F,V),id:se,data:ie})} />`}}function Gl(v){let _=[];if(v.lazy)_.push(`data-src="${$n(v.src)}"`),_.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"');else _.push(`src="${$n(v.src)}"`);if(_.push(`alt="${$n(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="${$n(v.className)}"`);if(v.style)_.push(`style="${$n(v.style)}"`);if(v.id)_.push(`id="${$n(v.id)}"`);if(v.data)for(let[k,E]of Object.entries(v.data))_.push(`data-${k}="${$n(E)}"`);if(v.lazy)_.push("data-stx-lazy");return _.join(" ")}function Zm(v,_){let k=[];if(v)k.push(v);if(_)k.push("stx-img-blur");return k.join(" ")||""}function Jl(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 $n(v){return v.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#039;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Gm(v){return`
2235
+ </div>`}return`<img ${_?`id="${_}" `:""}${Ee} ${Te} />`}function n0(v){let{src:_,alt:k,width:E,height:T,loading:j=ia,decoding:B=sa,fetchpriority:z,objectFit:F,objectPosition:V,crossorigin:H,referrerpolicy:G,priority:J=!1}=v,{class:ne,style:re,id:se}=v,ie=v.data||{};return{html:`<img ${Jl({src:_,alt:k,width:E,height:T,loading:J?"eager":j,decoding:B,fetchpriority:J?"high":z,objectFit:F,objectPosition:V,crossorigin:H,referrerpolicy:G,className:ne,style:Yl(re,F,V),id:se,data:ie})} />`}}function Jl(v){let _=[];if(v.lazy)_.push(`data-src="${$n(v.src)}"`),_.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"');else _.push(`src="${$n(v.src)}"`);if(_.push(`alt="${$n(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="${$n(v.className)}"`);if(v.style)_.push(`style="${$n(v.style)}"`);if(v.id)_.push(`id="${$n(v.id)}"`);if(v.data)for(let[k,E]of Object.entries(v.data))_.push(`data-${k}="${$n(E)}"`);if(v.lazy)_.push("data-stx-lazy");return _.join(" ")}function Ym(v,_){let k=[];if(v)k.push(v);if(_)k.push("stx-img-blur");return k.join(" ")||""}function Yl(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 $n(v){return v.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#039;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Qm(v){return`
2236
2236
  (function() {
2237
2237
  const container = document.getElementById('${v}');
2238
2238
  if (!container) return;
@@ -2269,7 +2269,7 @@ ${Te.join(`
2269
2269
 
2270
2270
  observer.observe(container);
2271
2271
  })();
2272
- `.trim()}async function t0(v,_){let k=await JS();if(!k)return na({...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 Jm(v,j,_)}else{let j=await k.processImage(v.src,v,E);if(j.processed)return Yl(v,j,_)}return na({...v,process:!1},_)}async function Yl(v,_,k){let{alt:E,width:T,height:j,lazy:B=!0,priority:z=!1,objectFit:F,objectPosition:V,crossorigin:H,referrerpolicy:G}=v,{class:J,style:ne}=v,re=v.id||`stx-img-${Math.random().toString(36).slice(2,8)}`,se=v.data||{},ie=_.variants||[],oe=ie.find((Ie)=>Ie.format==="jpeg")||ie.find((Ie)=>Ie.format==="webp")||ie[0],de=oe?.url||v.src,ae=ie.filter((Ie)=>Ie.format===(oe?.format||"jpeg")).map((Ie)=>`${Ie.url} ${Ie.width}w`).join(", "),me=new Map;for(let Ie of ie){if(!me.has(Ie.format))me.set(Ie.format,[]);me.get(Ie.format).push(Ie)}let ve=[],Se=["avif","webp","jpeg","png"];for(let Ie of Se){let Ze=me.get(Ie);if(Ze&&Ze.length>0){let rt=Ze.map((Qe)=>`${Qe.url} ${Qe.width}w`).join(", "),at=ql(Ie);if(B&&!z)ve.push(` <source type="${at}" data-srcset="${rt}" />`);else ve.push(` <source type="${at}" srcset="${rt}" />`)}}let $e=[];if(B&&!z){if($e.push(`data-src="${$n(de)}"`),$e.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"'),ae)$e.push(`data-srcset="${ae}"`)}else if($e.push(`src="${$n(de)}"`),ae)$e.push(`srcset="${ae}"`);$e.push(`alt="${$n(E)}"`);let Ce=T||_.originalWidth,Ee=j||_.originalHeight;if(Ce)$e.push(`width="${Ce}"`);if(Ee)$e.push(`height="${Ee}"`);if(!z)$e.push(`loading="${B?"lazy":"eager"}"`);if($e.push('decoding="async"'),z)$e.push('fetchpriority="high"');if(H)$e.push(`crossorigin="${H}"`);if(G)$e.push(`referrerpolicy="${G}"`);let Te=[];if(F)Te.push(`object-fit: ${F}`);if(V)Te.push(`object-position: ${V}`);if(_.placeholder&&B)Te.push("opacity: 0; transition: opacity 300ms ease-out");if(ne)Te.push(ne);if(Te.length>0)$e.push(`style="${Te.join("; ")}"`);let Re=[];if(J)Re.push(J);if(_.placeholder)Re.push("stx-img-blur");if(Re.length>0)$e.push(`class="${Re.join(" ")}"`);if(B&&!z)$e.push("data-stx-lazy");for(let[Ie,Ze]of Object.entries(se))$e.push(`data-${Ie}="${$n(Ze)}"`);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}">
2272
+ `.trim()}async function r0(v,_){let k=await QS();if(!k)return ra({...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 eh(v,j,_)}else{let j=await k.processImage(v.src,v,E);if(j.processed)return Ql(v,j,_)}return ra({...v,process:!1},_)}async function Ql(v,_,k){let{alt:E,width:T,height:j,lazy:B=!0,priority:z=!1,objectFit:F,objectPosition:V,crossorigin:H,referrerpolicy:G}=v,{class:J,style:ne}=v,re=v.id||`stx-img-${Math.random().toString(36).slice(2,8)}`,se=v.data||{},ie=_.variants||[],oe=ie.find((Ie)=>Ie.format==="jpeg")||ie.find((Ie)=>Ie.format==="webp")||ie[0],ue=oe?.url||v.src,ae=ie.filter((Ie)=>Ie.format===(oe?.format||"jpeg")).map((Ie)=>`${Ie.url} ${Ie.width}w`).join(", "),me=new Map;for(let Ie of ie){if(!me.has(Ie.format))me.set(Ie.format,[]);me.get(Ie.format).push(Ie)}let ve=[],Se=["avif","webp","jpeg","png"];for(let Ie of Se){let Ze=me.get(Ie);if(Ze&&Ze.length>0){let rt=Ze.map((Qe)=>`${Qe.url} ${Qe.width}w`).join(", "),at=Kl(Ie);if(B&&!z)ve.push(` <source type="${at}" data-srcset="${rt}" />`);else ve.push(` <source type="${at}" srcset="${rt}" />`)}}let $e=[];if(B&&!z){if($e.push(`data-src="${$n(ue)}"`),$e.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"'),ae)$e.push(`data-srcset="${ae}"`)}else if($e.push(`src="${$n(ue)}"`),ae)$e.push(`srcset="${ae}"`);$e.push(`alt="${$n(E)}"`);let Ce=T||_.originalWidth,Ee=j||_.originalHeight;if(Ce)$e.push(`width="${Ce}"`);if(Ee)$e.push(`height="${Ee}"`);if(!z)$e.push(`loading="${B?"lazy":"eager"}"`);if($e.push('decoding="async"'),z)$e.push('fetchpriority="high"');if(H)$e.push(`crossorigin="${H}"`);if(G)$e.push(`referrerpolicy="${G}"`);let Te=[];if(F)Te.push(`object-fit: ${F}`);if(V)Te.push(`object-position: ${V}`);if(_.placeholder&&B)Te.push("opacity: 0; transition: opacity 300ms ease-out");if(ne)Te.push(ne);if(Te.length>0)$e.push(`style="${Te.join("; ")}"`);let Re=[];if(J)Re.push(J);if(_.placeholder)Re.push("stx-img-blur");if(Re.length>0)$e.push(`class="${Re.join(" ")}"`);if(B&&!z)$e.push("data-stx-lazy");for(let[Ie,Ze]of Object.entries(se))$e.push(`data-${Ie}="${$n(Ze)}"`);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}">
2273
2273
  <picture>
2274
2274
  ${ve.join(`
2275
2275
  `)}
@@ -2279,11 +2279,11 @@ ${ve.join(`
2279
2279
  ${ve.join(`
2280
2280
  `)}
2281
2281
  <img ${$e.join(" ")} />
2282
- </picture>`;let Ae=[];if(_.placeholder)Ae.push(Xl);let Xe=B?Gm(re):void 0,Pe;if(z&&ae)Pe=`<link rel="preload" as="image" imagesrcset="${ae}" />`;return{html:_e,preloadLink:Pe,css:Ae.length>0?Ae.join(`
2283
- `):void 0,script:Xe}}async function Jm(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 Yl(v,E,k)}function n0(){return qe({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}=r0(v,_,k);if(!T)return console.warn("@img directive: missing src argument"),"<!-- @img: missing src -->";let z={src:T,alt:j||"",widths:B.widths||Ws,formats:B.formats||ji,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 na(z,{isDev:F}),H=V.html;if(V.preloadLink)H=V.preloadLink+`
2282
+ </picture>`;let Ae=[];if(_.placeholder)Ae.push(Zl);let Xe=B?Qm(re):void 0,Pe;if(z&&ae)Pe=`<link rel="preload" as="image" imagesrcset="${ae}" />`;return{html:_e,preloadLink:Pe,css:Ae.length>0?Ae.join(`
2283
+ `):void 0,script:Xe}}async function eh(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 Ql(v,E,k)}function s0(){return qe({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||Vs,formats:B.formats||ji,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 ra(z,{isDev:F}),H=V.html;if(V.preloadLink)H=V.preloadLink+`
2284
2284
  `+H;if(V.css)H+=`
2285
2285
  <style>${V.css}</style>`;if(V.script)H+=`
2286
- <script>${V.script}</script>`;return H},defaults:{src:"",alt:"",options:{lazy:!0,placeholder:"none"}}})}function r0(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=s0(E),j=Ql(T[0],k)||"",B=Ql(T[1],k)||"",z={};if(T[2]){let F=Ql(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 s0(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 Ql(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 Ym=n0();async function eh(){try{return await import("./chunk-k84qkm21.js")}catch(v){if(!Qm)console.warn("[stx-media] Video processor not available, some features disabled:",v),Qm=!0;return null}}var Qm=!1,th=!0,nh="metadata",i0="https://cdn.jsdelivr.net/npm/ts-video-player@latest/dist/index.min.js";async function ia(v,_={}){let k=_,E=v;if(E.process&&!E.skipProcessing){if(k.tsVideosConfig?.enabled&&!k.isDev)return u0(E,k)}if(k.processedResult?.processed)return sh(v,k.processedResult,_);let T;if(E.generatePoster&&E.src&&!v.poster)T=await d0(E,k);let{src:j,sources:B=[],poster:z,posterPlaceholder:F,controls:V=th,autoplay:H=!1,muted:G=!1,loop:J=!1,preload:ne=nh,playsinline:re=!0,lazy:se=!0,player:ie="native",type:oe,width:de,height:ae,crossorigin:me,disablePictureInPicture:ve=!1,disableRemotePlayback:Se=!1}=v,$e=T||z,{class:Ce,style:Ee}=v,Te=v.id||`stx-video-${Math.random().toString(36).slice(2,8)}`;if(ie==="ts-video")return a0(v,_);if(oe&&oe!=="video")return o0(j||"",oe,v);let Re=B.length>0?B:j?[{src:j,type:rh(j)}]:[],_e=[`id="${Te}"`];if(V)_e.push("controls");if(H)_e.push("autoplay");if(G)_e.push("muted");if(J)_e.push("loop");if(re)_e.push("playsinline");if(ve)_e.push("disablepictureinpicture");if(Se)_e.push("disableremoteplayback");if(me)_e.push(`crossorigin="${me}"`);if(se){if(_e.push(`data-preload="${ne}"`),_e.push('preload="none"'),$e)_e.push(`data-poster="${Ht($e)}"`);_e.push("data-stx-lazy")}else if(_e.push(`preload="${ne}"`),$e)_e.push(`poster="${Ht($e)}"`);if(de)_e.push(`width="${de}"`);if(ae)_e.push(`height="${ae}"`);if(Ce)_e.push(`class="${Ht(Ce)}"`);if(Ee)_e.push(`style="${Ht(Ee)}"`);let Ae=Re.map((Ie)=>` <source ${se?`data-src="${Ht(Ie.src)}"`:`src="${Ht(Ie.src)}"`} type="${Ie.type}"${Ie.media?` media="${Ie.media}"`:""} />`).join(`
2286
+ <script>${V.script}</script>`;return H},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=eu(T[0],k)||"",B=eu(T[1],k)||"",z={};if(T[2]){let F=eu(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 eu(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 th=s0();async function rh(){try{return await import("./chunk-k84qkm21.js")}catch(v){if(!nh)console.warn("[stx-media] Video processor not available, some features disabled:",v),nh=!0;return null}}var nh=!1,sh=!0,ih="metadata",a0="https://cdn.jsdelivr.net/npm/ts-video-player@latest/dist/index.min.js";async function oa(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 ah(v,k.processedResult,_);let T;if(E.generatePoster&&E.src&&!v.poster)T=await f0(E,k);let{src:j,sources:B=[],poster:z,posterPlaceholder:F,controls:V=sh,autoplay:H=!1,muted:G=!1,loop:J=!1,preload:ne=ih,playsinline:re=!0,lazy:se=!0,player:ie="native",type:oe,width:ue,height:ae,crossorigin:me,disablePictureInPicture:ve=!1,disableRemotePlayback:Se=!1}=v,$e=T||z,{class:Ce,style:Ee}=v,Te=v.id||`stx-video-${Math.random().toString(36).slice(2,8)}`;if(ie==="ts-video")return l0(v,_);if(oe&&oe!=="video")return c0(j||"",oe,v);let Re=B.length>0?B:j?[{src:j,type:oh(j)}]:[],_e=[`id="${Te}"`];if(V)_e.push("controls");if(H)_e.push("autoplay");if(G)_e.push("muted");if(J)_e.push("loop");if(re)_e.push("playsinline");if(ve)_e.push("disablepictureinpicture");if(Se)_e.push("disableremoteplayback");if(me)_e.push(`crossorigin="${me}"`);if(se){if(_e.push(`data-preload="${ne}"`),_e.push('preload="none"'),$e)_e.push(`data-poster="${Ht($e)}"`);_e.push("data-stx-lazy")}else if(_e.push(`preload="${ne}"`),$e)_e.push(`poster="${Ht($e)}"`);if(ue)_e.push(`width="${ue}"`);if(ae)_e.push(`height="${ae}"`);if(Ce)_e.push(`class="${Ht(Ce)}"`);if(Ee)_e.push(`style="${Ht(Ee)}"`);let Ae=Re.map((Ie)=>` <source ${se?`data-src="${Ht(Ie.src)}"`:`src="${Ht(Ie.src)}"`} type="${Ie.type}"${Ie.media?` media="${Ie.media}"`:""} />`).join(`
2287
2287
  `),Xe=`<video ${_e.join(" ")}>
2288
2288
  ${Ae}
2289
2289
  Your browser does not support the video tag.
@@ -2322,13 +2322,13 @@ ${Ae}
2322
2322
 
2323
2323
  observer.observe(video);
2324
2324
  })();
2325
- `.trim();return{html:Xe,script:Pe}}function o0(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=c0(v),F=V?`https://www.youtube-nocookie.com/embed/${V}`:v;break;case"vimeo":V=l0(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 H=[`id="${z}"`,`src="${Ht(F)}"`,`width="${E}"`,`height="${T}"`,'frameborder="0"',"allowfullscreen",'allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"'];if(j)H.push(`class="${Ht(j)}"`);if(B)H.push(`style="${Ht(B)}"`);if(k.lazy)H.push('loading="lazy"');return{html:`<div class="stx-video-embed" style="position:relative;padding-bottom:56.25%;height:0;overflow:hidden;">
2325
+ `.trim();return{html:Xe,script:Pe}}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 H=[`id="${z}"`,`src="${Ht(F)}"`,`width="${E}"`,`height="${T}"`,'frameborder="0"',"allowfullscreen",'allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"'];if(j)H.push(`class="${Ht(j)}"`);if(B)H.push(`style="${Ht(B)}"`);if(k.lazy)H.push('loading="lazy"');return{html:`<div class="stx-video-embed" style="position:relative;padding-bottom:56.25%;height:0;overflow:hidden;">
2326
2326
  <iframe ${H.join(" ")} style="position:absolute;top:0;left:0;width:100%;height:100%;"></iframe>
2327
- </div>`}}function a0(v,_={}){let{src:k,sources:E=[],poster:T,controls:j=!0,autoplay:B=!1,muted:z=!1,loop:F=!1,preload:V="metadata",playsinline:H=!0,lazy:G=!0,width:J,height:ne}=v,{class:re,style:se}=v,ie=v.id||`ts-video-${Math.random().toString(36).slice(2,8)}`,oe={src:E.length>0?E:k,autoplay:B,loop:F,muted:z,playsinline:H,preload:V,poster:T,controls:j,title:v.title},de=["position: relative",J?`width: ${typeof J==="number"?J+"px":J}`:"width: 100%",ne?`height: ${typeof ne==="number"?ne+"px":ne}`:"",se||""].filter(Boolean).join("; "),ae=`
2327
+ </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:H=!0,lazy:G=!0,width:J,height:ne}=v,{class:re,style:se}=v,ie=v.id||`ts-video-${Math.random().toString(36).slice(2,8)}`,oe={src:E.length>0?E:k,autoplay:B,loop:F,muted:z,playsinline:H,preload:V,poster:T,controls:j,title:v.title},ue=["position: relative",J?`width: ${typeof J==="number"?J+"px":J}`:"width: 100%",ne?`height: ${typeof ne==="number"?ne+"px":ne}`:"",se||""].filter(Boolean).join("; "),ae=`
2328
2328
  <div
2329
2329
  id="${ie}"
2330
2330
  class="ts-video-player${re?" "+Ht(re):""}"
2331
- style="${de}"
2331
+ style="${ue}"
2332
2332
  data-ts-video-player
2333
2333
  data-config='${JSON.stringify(oe)}'
2334
2334
  ${G?"data-lazy":""}
@@ -2361,7 +2361,7 @@ ${Ae}
2361
2361
 
2362
2362
  // Load ts-video-player from CDN
2363
2363
  var script = document.createElement('script');
2364
- script.src = '${i0}';
2364
+ script.src = '${a0}';
2365
2365
  script.onload = initPlayer;
2366
2366
  script.onerror = function() {
2367
2367
  console.error('[stx] Failed to load ts-video-player');
@@ -2491,7 +2491,7 @@ else {
2491
2491
  .ts-video-player__play-button svg {
2492
2492
  margin-left: 4px;
2493
2493
  }
2494
- `.trim();return{html:ae,script:me,css:ve}}function rh(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 c0(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 l0(v){let _=v.match(/vimeo\.com\/(\d+)/);return _?_[1]:null}function Ht(v){return v.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}async function u0(v,_){let k=await eh();if(!k)return ia({...v,process:!1},_);let E=_.tsVideosConfig,T=await k.processVideo(v.src,v,E,v.onProcessProgress);if(T.processed)return sh(v,T,_);return ia({...v,process:!1},_)}async function d0(v,_){let k=await eh();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 sh(v,_,k){let{controls:E=th,autoplay:T=!1,muted:j=!1,loop:B=!1,preload:z=nh,playsinline:F=!0,lazy:V=!0,width:H,height:G,crossorigin:J,disablePictureInPicture:ne=!1,disableRemotePlayback:re=!1}=v,{class:se,style:ie}=v,oe=v.id||`stx-video-${Math.random().toString(36).slice(2,8)}`,de=v.src,ae=rh(de);if(_.transcoded)de=_.transcoded.url,ae="video/mp4";let me=_.streaming?.hls||_.streaming?.dash;if(me){if(_.streaming?.hls)de=_.streaming.hls.manifestUrl,ae="application/x-mpegURL";else if(_.streaming?.dash)de=_.streaming.dash.manifestUrl,ae="application/dash+xml"}let ve=_.poster?.url||v.poster,Se=[`id="${oe}"`];if(E)Se.push("controls");if(T)Se.push("autoplay");if(j)Se.push("muted");if(B)Se.push("loop");if(F)Se.push("playsinline");if(ne)Se.push("disablepictureinpicture");if(re)Se.push("disableremoteplayback");if(J)Se.push(`crossorigin="${J}"`);if(V){if(Se.push(`data-preload="${z}"`),Se.push('preload="none"'),ve)Se.push(`data-poster="${Ht(ve)}"`);Se.push("data-stx-lazy")}else if(Se.push(`preload="${z}"`),ve)Se.push(`poster="${Ht(ve)}"`);let $e=H||_.metadata?.width,Ce=G||_.metadata?.height;if($e)Se.push(`width="${$e}"`);if(Ce)Se.push(`height="${Ce}"`);if(se)Se.push(`class="${Ht(se)}"`);if(ie)Se.push(`style="${Ht(ie)}"`);let Te=` <source ${V?`data-src="${Ht(de)}"`:`src="${Ht(de)}"`} type="${ae}" />`,Re=`<video ${Se.join(" ")}>
2494
+ `.trim();return{html:ae,script:me,css:ve}}function oh(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 Ht(v){return v.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}async function p0(v,_){let k=await rh();if(!k)return oa({...v,process:!1},_);let E=_.tsVideosConfig,T=await k.processVideo(v.src,v,E,v.onProcessProgress);if(T.processed)return ah(v,T,_);return oa({...v,process:!1},_)}async function f0(v,_){let k=await rh();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 ah(v,_,k){let{controls:E=sh,autoplay:T=!1,muted:j=!1,loop:B=!1,preload:z=ih,playsinline:F=!0,lazy:V=!0,width:H,height:G,crossorigin:J,disablePictureInPicture:ne=!1,disableRemotePlayback:re=!1}=v,{class:se,style:ie}=v,oe=v.id||`stx-video-${Math.random().toString(36).slice(2,8)}`,ue=v.src,ae=oh(ue);if(_.transcoded)ue=_.transcoded.url,ae="video/mp4";let me=_.streaming?.hls||_.streaming?.dash;if(me){if(_.streaming?.hls)ue=_.streaming.hls.manifestUrl,ae="application/x-mpegURL";else if(_.streaming?.dash)ue=_.streaming.dash.manifestUrl,ae="application/dash+xml"}let ve=_.poster?.url||v.poster,Se=[`id="${oe}"`];if(E)Se.push("controls");if(T)Se.push("autoplay");if(j)Se.push("muted");if(B)Se.push("loop");if(F)Se.push("playsinline");if(ne)Se.push("disablepictureinpicture");if(re)Se.push("disableremoteplayback");if(J)Se.push(`crossorigin="${J}"`);if(V){if(Se.push(`data-preload="${z}"`),Se.push('preload="none"'),ve)Se.push(`data-poster="${Ht(ve)}"`);Se.push("data-stx-lazy")}else if(Se.push(`preload="${z}"`),ve)Se.push(`poster="${Ht(ve)}"`);let $e=H||_.metadata?.width,Ce=G||_.metadata?.height;if($e)Se.push(`width="${$e}"`);if(Ce)Se.push(`height="${Ce}"`);if(se)Se.push(`class="${Ht(se)}"`);if(ie)Se.push(`style="${Ht(ie)}"`);let Te=` <source ${V?`data-src="${Ht(ue)}"`:`src="${Ht(ue)}"`} type="${ae}" />`,Re=`<video ${Se.join(" ")}>
2495
2495
  ${Te}
2496
2496
  Your browser does not support the video tag.
2497
2497
  </video>`;if(_.spriteSheet)Re=`<div class="stx-video-wrapper" data-sprite-sheet="${Ht(_.spriteSheet.url)}" data-sprite-cols="${_.spriteSheet.columns}" data-sprite-interval="${_.spriteSheet.interval}">
@@ -2540,9 +2540,9 @@ ${Re}
2540
2540
  width: 100%;
2541
2541
  height: auto;
2542
2542
  }
2543
- `.trim();return{html:Re,script:_e,css:Ae}}function ih(){return qe({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}=p0(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 ia(B,F),H=V.html;if(V.css)H+=`
2543
+ `.trim();return{html:Re,script:_e,css:Ae}}function ch(){return qe({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 oa(B,F),H=V.html;if(V.css)H+=`
2544
2544
  <style>${V.css}</style>`;if(V.script)H+=`
2545
- <script>${V.script}</script>`;return H},defaults:{src:"",options:{controls:!0,lazy:!0,preload:"metadata"}}})}function p0(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=f0(E),j=oh(T[0],k)||"",B={};if(T[1]){let z=oh(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 f0(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 oh(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 eu=ih();import g0 from"fs";import wn from"path";async function Xn(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 m0(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 m0(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(wn.isAbsolute(T)&&await r(T))z=T;else if(_.componentsDir){let se=wn.join(_.componentsDir,T);if(await r(se))z=se}if(!z)z=await Kn(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 H=(v.outputFormat||"js")==="ts",G=H?y0({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||{}}):h0({name:E,tag:j,baseElement:B,source:F,shadowDOM:v.shadowDOM??!0,template:v.template??!0,styleSource:v.styleSource,attributes:v.attributes||[]}),J=_.webComponents?.outputDir||"dist/web-components";await g0.promises.mkdir(J,{recursive:!0});let ne=H?"ts":"js",re=wn.join(J,`${j}.${ne}`);if(await Bun.write(re,G),_.debug)console.log(`Built web component ${E} -> ${re}`);return re}function h0(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 H="";if(z)H=`<link rel="stylesheet" href="${z}">`;return`/**
2545
+ <script>${V.script}</script>`;return H},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=lh(T[0],k)||"",B={};if(T[1]){let z=lh(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 lh(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 tu=ch();import h0 from"fs";import wn from"path";async function Xn(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(wn.isAbsolute(T)&&await r(T))z=T;else if(_.componentsDir){let se=wn.join(_.componentsDir,T);if(await r(se))z=se}if(!z)z=await Kn(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 H=(v.outputFormat||"js")==="ts",G=H?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||[]}),J=_.webComponents?.outputDir||"dist/web-components";await h0.promises.mkdir(J,{recursive:!0});let ne=H?"ts":"js",re=wn.join(J,`${j}.${ne}`);if(await Bun.write(re,G),_.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 H="";if(z)H=`<link rel="stylesheet" href="${z}">`;return`/**
2546
2546
  * ${_} Web Component
2547
2547
  * Auto-generated from stx component
2548
2548
  */
@@ -2634,7 +2634,7 @@ class ${_.replace(/\W/g,"")} extends ${E} {
2634
2634
 
2635
2635
  // Register the web component
2636
2636
  customElements.define('${k}', ${_.replace(/\W/g,"")})
2637
- `}function y0(v){let{name:_,tag:k,baseElement:E="HTMLElement",source:T,shadowDOM:j,template:B,styleSource:z,attributes:F=[],attributeTypes:V={}}=v,H=_.replace(/\W/g,""),G=T.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").trim();if(!j)G=G.replace(/<slot\s+name=["']([^"']+)["']\s*>([\s\S]*?)<\/slot>/gi,'<div data-slot="$1">$2</div>'),G=G.replace(/<slot\s+name=["']([^"']+)["']\s*\/>/gi,'<div data-slot="$1"></div>'),G=G.replace(/<slot\s*>([\s\S]*?)<\/slot>/gi,"<div data-default-slot>$1</div>"),G=G.replace(/<slot\s*\/>/gi,"<div data-default-slot></div>");G=G.replace(/`/g,"\\`").replace(/\$\{/g,"\\${");let J=z?`<link rel="stylesheet" href="${z}">`:"",ne=(ve)=>{switch(V[ve]){case"number":return"number";case"boolean":return"boolean";case"object":return"Record<string, unknown>";default:return"string"}},re=(ve)=>ve.replace(/-([a-z])/g,(Se,$e)=>$e.toUpperCase()),se=F.map((ve)=>` private _${re(ve)}: ${ne(ve)} | null = null;`).join(`
2637
+ `}function b0(v){let{name:_,tag:k,baseElement:E="HTMLElement",source:T,shadowDOM:j,template:B,styleSource:z,attributes:F=[],attributeTypes:V={}}=v,H=_.replace(/\W/g,""),G=T.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").trim();if(!j)G=G.replace(/<slot\s+name=["']([^"']+)["']\s*>([\s\S]*?)<\/slot>/gi,'<div data-slot="$1">$2</div>'),G=G.replace(/<slot\s+name=["']([^"']+)["']\s*\/>/gi,'<div data-slot="$1"></div>'),G=G.replace(/<slot\s*>([\s\S]*?)<\/slot>/gi,"<div data-default-slot>$1</div>"),G=G.replace(/<slot\s*\/>/gi,"<div data-default-slot></div>");G=G.replace(/`/g,"\\`").replace(/\$\{/g,"\\${");let J=z?`<link rel="stylesheet" href="${z}">`:"",ne=(ve)=>{switch(V[ve]){case"number":return"number";case"boolean":return"boolean";case"object":return"Record<string, unknown>";default:return"string"}},re=(ve)=>ve.replace(/-([a-z])/g,(Se,$e)=>$e.toUpperCase()),se=F.map((ve)=>` private _${re(ve)}: ${ne(ve)} | null = null;`).join(`
2638
2638
  `),ie=F.map((ve)=>{let Se=ne(ve),$e=re(ve);return`
2639
2639
  get ${$e}(): ${Se} | null {
2640
2640
  return this._${$e};
@@ -2656,7 +2656,7 @@ export interface ${H}Props {
2656
2656
  ${F.map((ve)=>{let Se=ne(ve);return` ${re(ve)}?: ${Se};`}).join(`
2657
2657
  `)}
2658
2658
  }
2659
- `:"",de=F.length>0?`
2659
+ `:"",ue=F.length>0?`
2660
2660
  static get observedAttributes(): string[] {
2661
2661
  return [${F.map((ve)=>`'${ve}'`).join(", ")}];
2662
2662
  }
@@ -2761,7 +2761,7 @@ ${j?`
2761
2761
  }
2762
2762
  }
2763
2763
  }`}
2764
- ${de}
2764
+ ${ue}
2765
2765
  ${ie}
2766
2766
 
2767
2767
  connectedCallback(): void {
@@ -2789,7 +2789,7 @@ declare global {
2789
2789
 
2790
2790
  // Register the web component
2791
2791
  customElements.define('${k}', ${H});
2792
- `}function x0(v,_){let k=v.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),E=k?k[1].trim():"",T=_,j=[],B=!0;if(E){let G=E.match(/export\s+default\s+({[\s\S]*})/);if(G)try{let J=G[1],ne=J.match(/tag\s*:\s*['"`]([^'"`]+)['"`]/);if(ne)T=ne[1];let re=J.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=J.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),H=V?V[1].trim():"";return{tag:T,props:j,template:F,styles:H,script:E,shadowDOM:B}}function b0(v){let{tag:_,props:k,template:E,styles:T,shadowDOM:j}=v,B=_.split("-").map((G)=>G.charAt(0).toUpperCase()+G.slice(1)).join(""),z=E.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\$\{/g,"\\${"),F=T.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),V=k.map((G)=>`'${G}'`).join(", "),H=k.map((G)=>`
2792
+ `}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 G=E.match(/export\s+default\s+({[\s\S]*})/);if(G)try{let J=G[1],ne=J.match(/tag\s*:\s*['"`]([^'"`]+)['"`]/);if(ne)T=ne[1];let re=J.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=J.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),H=V?V[1].trim():"";return{tag:T,props:j,template:F,styles:H,script:E,shadowDOM:B}}function w0(v){let{tag:_,props:k,template:E,styles:T,shadowDOM:j}=v,B=_.split("-").map((G)=>G.charAt(0).toUpperCase()+G.slice(1)).join(""),z=E.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\$\{/g,"\\${"),F=T.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),V=k.map((G)=>`'${G}'`).join(", "),H=k.map((G)=>`
2793
2793
  get ${G}() {
2794
2794
  return this.getAttribute('${G}') || '';
2795
2795
  }
@@ -2840,8 +2840,8 @@ ${H}
2840
2840
  }
2841
2841
 
2842
2842
  customElements.define('${_}', ${B});
2843
- `}async function ah(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=wn.isAbsolute(B)?[wn.join(B,`${T}.stx`),wn.join(wn.dirname(E),`${T}.stx`)]:[wn.join(wn.dirname(E),B,`${T}.stx`),wn.join(process.cwd(),B,`${T}.stx`),wn.join(wn.dirname(E),`${T}.stx`)],F=null;for(let G of z)if(await r(G)){F=await Bun.file(G).text();break}if(!F)return i("WebComponent",`Component file not found: ${T}.stx`,t.FILE_NOT_FOUND);let V=x0(F,T);return`<script type="module">
2844
- ${b0(V)}
2845
- </script>`}var I={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:Wm,hasEndTag:!0,description:"Render markdown content to HTML"},{name:"webcomponent",handler:ah,hasEndTag:!1,description:"Include a web component in the template"},gi,mi,Zn,Qn,ou,cu,lu,au,du,gu,Ym,eu,...dr],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 w0(v,_,k){let E=_||"pages";if(v)return{root:v,pagesDir:E};let T=k||process.cwd(),j=un.join(T,"resources","views"),B=un.join(T,"resources","layouts");if(aa.existsSync(j)&&aa.existsSync(B))return{root:"resources",pagesDir:"views"};let z=un.join(T,"resources","views","pages");if(aa.existsSync(z))return{root:"resources/views",pagesDir:E};return{root:".",pagesDir:E}}var ch=new Set,ca=["partialsDir","componentsDir","layoutsDir"],tu=new WeakMap;function S0(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 _c(v,_){let k=!v.root,E=w0(v.root,v.pagesDir,_);if(v.root=E.root,v.pagesDir=E.pagesDir,k&&E.root!=="."){let T=`${_}::${E.root}`;if(!ch.has(T))ch.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(!tu.has(v)){let T={};for(let j of ca){let B=v[j];if(typeof B==="string"&&B)T[j]=B}tu.set(v,T)}if(v.root&&v.root!=="."){let T=v.root;for(let j of ca){let B=v[j];if(typeof B!=="string"||!B)continue;if(un.isAbsolute(B)||S0(B,T))continue;v[j]=un.join(T,B)}}for(let T of ca){let j=v[T];if(typeof j!=="string"||!j||un.isAbsolute(j))continue;v[T]=un.resolve(_,j)}return v}function $0(v,_){let k=tu.get(v);for(let E of ca){let T=v[E];if(typeof T!=="string"||!T)continue;let j=un.isAbsolute(T)?T:un.join(_,T);if(aa.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 _0(v){if(v.customDirectives)v.customDirectives=[...v.customDirectives];if(v.middleware)v.middleware=[...v.middleware];if(v.apiRoutes)v.apiRoutes={...v.apiRoutes}}function k0(v){if(vi(v.stateDir),v.stateDir=an(),v.cachePath=cn(v.cachePath),v.build)v.build.cacheDir=cn(v.build.cacheDir);if(v.media?.cache)v.media.cache.directory=cn(v.media.cache.directory);if(v.story)v.story.outDir=cn(v.story.outDir)}var Sr=null,Or=new Map,oa=new Map,Bi=null;async function o(v){let _=v?un.resolve(v):process.cwd(),k=oa.get(_);if(k&&k.signature!==Gn(k.graph)){let j=Or.get(_);if(Or.delete(_),oa.delete(_),!v)Sr=null,Bi=null;let{clearComponentCache:B}=await import("./chunk-nskfyvbv.js"),{partialsCache:z}=await import("./chunk-kyd15xqj.js");if(B(),z.clear(),j&&k.configSignature===Jn(k.graph)){let F=j.then(async(V)=>{let H={...k.graph};await xs(H,_),oa.set(_,{graph:H,signature:Gn(H),configSignature:Jn(H)});let G={...V,_layerGraph:H};if(!v)Sr=G;return G});return Or.set(_,F),F}}if(!v){if(Sr)return Sr;if(Bi)return Bi}let E=Or.get(_);if(E)return E;let T=(async()=>{let B=(await v0({name:"stx",alias:"ui",cwd:_,defaultConfig:I,verbose:!1})).config;if(B.extends!==void 0||k){let H=await bi(_,I);B=H.config,oa.set(_,{graph:H.graph,signature:Gn(H.graph),configSignature:Jn(H.graph)})}if(B.runtimeConfig){let{resolveRuntimeConfig:H}=await import("./chunk-zb5p05v4.js");H(B.runtimeConfig,{});let{generateRuntimeConfigTypes:G}=await import("./chunk-g1562mcs.js");await G(_,B.runtimeConfig)}_0(B),k0(B),_c(B,_),$0(B,_);let z=[],F=new Set((B.plugins??[]).map((H)=>typeof H==="string"?H:H[0]));for(let H of B.componentPackages??["@stacksjs/components"]){let G=`${H}/stx-plugin`;if(F.has(G)||F.has(H))continue;try{u.resolve(G,{paths:[_]}),z.push(G)}catch{}}let V=[...B.plugins??[],...z];if(V.length>0){let{pluginManager:H}=await import("./chunk-mmh37ywa.js"),G=[],J=[];for(let ne of V){let re=typeof ne==="string"?ne:ne[0],se=typeof ne==="string"?{}:ne[1]||{};try{let ie,oe;try{let ae=u.resolve(re,{paths:[_]});ie=await import(ae),oe=un.dirname(ae)}catch{let ae=un.resolve(_,re);ie=await import(ae),oe=un.dirname(ae)}let de=ie.default||ie;if(!H.has(de.name))await H.register(de,B);if(de.components){let ae=Array.isArray(de.components)?de.components:[de.components];for(let me of ae)G.push(un.resolve(oe,me))}if(de.pages){let ae=un.resolve(oe,de.pages),me=se.path||"/";J.push({dir:ae,prefix:me})}if(de.setup){let ae={addDirective:(me)=>{B.customDirectives=B.customDirectives||[],B.customDirectives.push(me)},addRoute:(me,ve)=>{B.apiRoutes=B.apiRoutes||{},B.apiRoutes[me]=ve},addMiddleware:(me)=>{B.middleware=B.middleware||[],B.middleware.push(me)},pluginDir:oe,config:B};await de.setup(se,ae)}process.stderr.write(`[stx] Plugin loaded: ${de.name||re}
2846
- `)}catch(ie){console.warn(`[stx] Failed to load plugin ${re}:`,ie.message)}}B._pluginComponentDirs=G,B._pluginPageDirs=J}return B})();if(Or.set(_,T),T.catch(()=>{if(Or.get(_)===T)Or.delete(_)}),!v)Bi=T,T.then((j)=>{Sr=j}).catch(()=>{});return T}var R=new Proxy(I,{get(v,_){if(Sr&&_ in Sr)return Sr[_];if(!Bi)o().catch((k)=>{console.warn("[stx] Failed to load config file:",k?.message||k)});return v[_]}});function Hu(v){return v}function Vu(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 ru=new Map;async function le(v,_={}){try{if(!await r(v))throw Error(`Markdown file not found: ${v}`);let E=(await E0.promises.stat(v)).mtime.getTime();if(_.cache&&ru.has(v)){let G=ru.get(v);if(G.updatedAt>=E)return{content:G.content,data:G.data}}let T=await Bun.file(v).text(),{data:j,content:B}=Dn(T),z=_.markdown||R.markdown||{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0}},V=Oe(B,{gfm:!0});if(z.syntaxHighlighting?.enabled&&z.syntaxHighlighting?.serverSide)V=await R0(V,z.syntaxHighlighting?.defaultTheme||"github-dark",z.syntaxHighlighting?.highlightUnknownLanguages||!1);let H={content:V,data:j||{}};if(_.cache)ru.set(v,{...H,updatedAt:E});return H}catch(k){if(_.debug)console.error(`Error reading/parsing markdown file ${v}:`,k);let E=k instanceof Error?k.message:String(k);return{content:g("Markdown File",`Error reading/parsing markdown file: ${E}`,v,"",0,""),data:{}}}}var la=null;async function R0(v,_,k){let E=/<pre><code( class="language-([^"]+)")?>([^<]+)<\/code><\/pre>/g;if(!la)try{la=await C0({theme:_||"github-dark",cache:!0})}catch(z){return console.error("Failed to initialize ts-syntax-highlighter:",z),v}let T=async(z,F,V,H)=>{let G=H.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&").replace(/&quot;/g,'"').replace(/&#39;/g,"'"),J=V||(k?"text":"");if(!J)return z;try{if(!la.getSupportedLanguages().includes(J))return z;return(await la.highlight(G,J,{theme:_})).html}catch(ne){console.error(`Error highlighting code block with language ${V}:`,ne)}return z},j=v,B=v.matchAll(E);for(let z of B){let[F,V,H,G]=z,J=await T(F,V,H,G);j=j.replace(F,J)}return j}async function wm(v,_,k="",E={}){return await T0(v,/@markdown-file\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\}))?\)/g,async(B,z,F,V)=>{try{let H=z;if(!nu.isAbsolute(z))H=nu.resolve(nu.dirname(k),z);let G={};if(F)try{try{G=JSON.parse(F)}catch{if(E.debug)console.warn("Using safer alternative for parsing JS object literal");let de=F.replace(/^\s*\{|\}\s*$/g,"").trim().split(/,(?=\s*\w+\s*:)/);for(let ae of de){let me=ae.indexOf(":");if(me>0){let ve=ae.substring(0,me).trim(),Se=ae.substring(me+1).trim(),$e=Se.startsWith('"')&&Se.endsWith('"'),Ce=Se.startsWith("'")&&Se.endsWith("'");if($e||Ce)Se=Se.substring(1,Se.length-1);G[ve]=Se}}}}catch(oe){if(E.debug)console.error("Error parsing context in @markdown-file directive:",oe)}let{content:J,data:ne}=await le(H,E),re={..._,...ne,...G},se=J,ie=/\{\{([^}]+)\}\}/g;return se=se.replace(ie,(oe,de)=>{let ae=de.trim();return re[ae]!==void 0?String(re[ae]):oe}),se}catch(H){let G=H instanceof Error?H.message:String(H);return g("Markdown File",`Error including markdown file: ${G}`,k,v,V,B)}})}async function 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((H)=>({match:z,replacement:H,index:F})))}let j=await Promise.all(E);j.sort((z,F)=>F.index-z.index);let B=v;for(let{match:z,replacement:F}of j)B=B.replace(z,()=>F);return B}
2847
- export{Dn,Oe,M,U,m,h,Qt,W,w,Me,Kr,Xr,Va,wt,jo,Gr,Bo,vu,Ne,Jr,he,Fo,zo,Ho,Yr,Y,Le,On,Ua,xu,Wa,Su,qa,Mn,b,vt,ye,Ka,Zr,Xa,ku,q,Ga,Cu,x,$u,Ja,Eu,_u,Tu,Ru,Ya,Za,Au,Pu,Vo,Iu,en,tn,Nn,Ln,e,Du,Uo,Ou,Wo,Qa,ec,xt,nn,Mu,tc,nc,rc,f,je,St,Be,Fe,qo,jn,Z,Qr,es,ts,Nu,Bn,Lu,kt,rn,ze,ns,rs,sc,Q,Ko,Xo,Go,Jo,Fn,ss,Yo,Zo,Qo,oc,os,N,ce,K,ju,ic,is,as,ei,ti,cs,ls,zn,ac,ni,ri,cc,He,sn,Hn,Ct,lc,uc,dc,pc,fc,d,gc,us,mc,si,oi,ds,ii,hc,Bu,yc,be,ai,Fu,ps,gs,ms,Vn,ci,hs,Un,on,Wn,ys,bs,ws,n,bc,wc,vc,xc,Sc,kc,Ve,L,Ue,Cc,qn,$c,li,Ec,We,r,Kn,ui,g,ee,zu,Xn,I,_c,o,R,Hu,Vu,le};
2843
+ `}async function uh(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=wn.isAbsolute(B)?[wn.join(B,`${T}.stx`),wn.join(wn.dirname(E),`${T}.stx`)]:[wn.join(wn.dirname(E),B,`${T}.stx`),wn.join(process.cwd(),B,`${T}.stx`),wn.join(wn.dirname(E),`${T}.stx`)],F=null;for(let G of z)if(await r(G)){F=await Bun.file(G).text();break}if(!F)return i("WebComponent",`Component file not found: ${T}.stx`,t.FILE_NOT_FOUND);let V=v0(F,T);return`<script type="module">
2844
+ ${w0(V)}
2845
+ </script>`}var I={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:qm,hasEndTag:!0,description:"Render markdown content to HTML"},{name:"webcomponent",handler:uh,hasEndTag:!1,description:"Include a web component in the template"},gi,mi,Zn,Qn,au,lu,uu,cu,pu,mu,th,tu,...ur],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=dn.join(T,"resources","views"),B=dn.join(T,"resources","layouts");if(ca.existsSync(j)&&ca.existsSync(B))return{root:"resources",pagesDir:"views"};let z=dn.join(T,"resources","views","pages");if(ca.existsSync(z))return{root:"resources/views",pagesDir:E};return{root:".",pagesDir:E}}var dh=new Set,la=["partialsDir","componentsDir","layoutsDir"],nu=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 _c(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(!dh.has(T))dh.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(!nu.has(v)){let T={};for(let j of la){let B=v[j];if(typeof B==="string"&&B)T[j]=B}nu.set(v,T)}if(v.root&&v.root!=="."){let T=v.root;for(let j of la){let B=v[j];if(typeof B!=="string"||!B)continue;if(dn.isAbsolute(B)||_0(B,T))continue;v[j]=dn.join(T,B)}}for(let T of la){let j=v[T];if(typeof j!=="string"||!j||dn.isAbsolute(j))continue;v[T]=dn.resolve(_,j)}return v}function k0(v,_){let k=nu.get(v);for(let E of la){let T=v[E];if(typeof T!=="string"||!T)continue;let j=dn.isAbsolute(T)?T:dn.join(_,T);if(ca.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(vi(v.stateDir),v.stateDir=an(),v.cachePath=cn(v.cachePath),v.build)v.build.cacheDir=cn(v.build.cacheDir);if(v.media?.cache)v.media.cache.directory=cn(v.media.cache.directory);if(v.story)v.story.outDir=cn(v.story.outDir)}var Sr=null,Or=new Map,aa=new Map,Bi=null;async function o(v){let _=v?dn.resolve(v):process.cwd(),k=aa.get(_);if(k&&k.signature!==Gn(k.graph)){let j=Or.get(_);if(Or.delete(_),aa.delete(_),!v)Sr=null,Bi=null;let{clearComponentCache:B}=await import("./chunk-vc24bahj.js"),{partialsCache:z}=await import("./chunk-pq9978k5.js");if(B(),z.clear(),j&&k.configSignature===Jn(k.graph)){let F=j.then(async(V)=>{let H={...k.graph};await xs(H,_),aa.set(_,{graph:H,signature:Gn(H),configSignature:Jn(H)});let G={...V,_layerGraph:H};if(!v)Sr=G;return G});return Or.set(_,F),F}}if(!v){if(Sr)return Sr;if(Bi)return Bi}let E=Or.get(_);if(E)return E;let T=(async()=>{let B=(await S0({name:"stx",alias:"ui",cwd:_,defaultConfig:I,verbose:!1})).config;if(B.extends!==void 0||k){let H=await bi(_,I);B=H.config,aa.set(_,{graph:H.graph,signature:Gn(H.graph),configSignature:Jn(H.graph)})}if(B.runtimeConfig){let{resolveRuntimeConfig:H}=await import("./chunk-94d2t16y.js");H(B.runtimeConfig,{});let{generateRuntimeConfigTypes:G}=await import("./chunk-8v24kvjk.js");await G(_,B.runtimeConfig)}E0(B),C0(B),_c(B,_),k0(B,_);let z=[],F=new Set((B.plugins??[]).map((H)=>typeof H==="string"?H:H[0]));for(let H of B.componentPackages??["@stacksjs/components"]){let G=`${H}/stx-plugin`;if(F.has(G)||F.has(H))continue;try{d.resolve(G,{paths:[_]}),z.push(G)}catch{}}let V=[...B.plugins??[],...z];if(V.length>0){let{pluginManager:H}=await import("./chunk-nrjevcyh.js"),G=[],J=[];for(let ne of V){let re=typeof ne==="string"?ne:ne[0],se=typeof ne==="string"?{}:ne[1]||{};try{let ie,oe;try{let ae=d.resolve(re,{paths:[_]});ie=await import(ae),oe=dn.dirname(ae)}catch{let ae=dn.resolve(_,re);ie=await import(ae),oe=dn.dirname(ae)}let ue=ie.default||ie;if(!H.has(ue.name))await H.register(ue,B);if(ue.components){let ae=Array.isArray(ue.components)?ue.components:[ue.components];for(let me of ae)G.push(dn.resolve(oe,me))}if(ue.pages){let ae=dn.resolve(oe,ue.pages),me=se.path||"/";J.push({dir:ae,prefix:me})}if(ue.setup){let ae={addDirective:(me)=>{B.customDirectives=B.customDirectives||[],B.customDirectives.push(me)},addRoute:(me,ve)=>{B.apiRoutes=B.apiRoutes||{},B.apiRoutes[me]=ve},addMiddleware:(me)=>{B.middleware=B.middleware||[],B.middleware.push(me)},pluginDir:oe,config:B};await ue.setup(se,ae)}process.stderr.write(`[stx] Plugin loaded: ${ue.name||re}
2846
+ `)}catch(ie){console.warn(`[stx] Failed to load plugin ${re}:`,ie.message)}}B._pluginComponentDirs=G,B._pluginPageDirs=J}return B})();if(Or.set(_,T),T.catch(()=>{if(Or.get(_)===T)Or.delete(_)}),!v)Bi=T,T.then((j)=>{Sr=j}).catch(()=>{});return T}var R=new Proxy(I,{get(v,_){if(Sr&&_ in Sr)return Sr[_];if(!Bi)o().catch((k)=>{console.warn("[stx] Failed to load config file:",k?.message||k)});return v[_]}});function Hd(v){return v}function Vd(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 su=new Map;async function le(v,_={}){try{if(!await r(v))throw Error(`Markdown file not found: ${v}`);let E=(await R0.promises.stat(v)).mtime.getTime();if(_.cache&&su.has(v)){let G=su.get(v);if(G.updatedAt>=E)return{content:G.content,data:G.data}}let T=await Bun.file(v).text(),{data:j,content:B}=Dn(T),z=_.markdown||R.markdown||{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0}},V=Oe(B,{gfm:!0});if(z.syntaxHighlighting?.enabled&&z.syntaxHighlighting?.serverSide)V=await A0(V,z.syntaxHighlighting?.defaultTheme||"github-dark",z.syntaxHighlighting?.highlightUnknownLanguages||!1);let H={content:V,data:j||{}};if(_.cache)su.set(v,{...H,updatedAt:E});return H}catch(k){if(_.debug)console.error(`Error reading/parsing markdown file ${v}:`,k);let E=k instanceof Error?k.message:String(k);return{content:g("Markdown File",`Error reading/parsing markdown file: ${E}`,v,"",0,""),data:{}}}}var ua=null;async function A0(v,_,k){let E=/<pre><code( class="language-([^"]+)")?>([^<]+)<\/code><\/pre>/g;if(!ua)try{ua=await T0({theme:_||"github-dark",cache:!0})}catch(z){return console.error("Failed to initialize ts-syntax-highlighter:",z),v}let T=async(z,F,V,H)=>{let G=H.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&").replace(/&quot;/g,'"').replace(/&#39;/g,"'"),J=V||(k?"text":"");if(!J)return z;try{if(!ua.getSupportedLanguages().includes(J))return z;return(await ua.highlight(G,J,{theme:_})).html}catch(ne){console.error(`Error highlighting code block with language ${V}:`,ne)}return z},j=v,B=v.matchAll(E);for(let z of B){let[F,V,H,G]=z,J=await T(F,V,H,G);j=j.replace(F,J)}return j}async function _m(v,_,k="",E={}){return await I0(v,/@markdown-file\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\}))?\)/g,async(B,z,F,V)=>{try{let H=z;if(!ru.isAbsolute(z))H=ru.resolve(ru.dirname(k),z);let G={};if(F)try{try{G=JSON.parse(F)}catch{if(E.debug)console.warn("Using safer alternative for parsing JS object literal");let ue=F.replace(/^\s*\{|\}\s*$/g,"").trim().split(/,(?=\s*\w+\s*:)/);for(let ae of ue){let me=ae.indexOf(":");if(me>0){let ve=ae.substring(0,me).trim(),Se=ae.substring(me+1).trim(),$e=Se.startsWith('"')&&Se.endsWith('"'),Ce=Se.startsWith("'")&&Se.endsWith("'");if($e||Ce)Se=Se.substring(1,Se.length-1);G[ve]=Se}}}}catch(oe){if(E.debug)console.error("Error parsing context in @markdown-file directive:",oe)}let{content:J,data:ne}=await le(H,E),re={..._,...ne,...G},se=J,ie=/\{\{([^}]+)\}\}/g;return se=se.replace(ie,(oe,ue)=>{let ae=ue.trim();return re[ae]!==void 0?String(re[ae]):oe}),se}catch(H){let G=H instanceof Error?H.message:String(H);return g("Markdown File",`Error including markdown file: ${G}`,k,v,V,B)}})}async function 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((H)=>({match:z,replacement:H,index:F})))}let j=await Promise.all(E);j.sort((z,F)=>F.index-z.index);let B=v;for(let{match:z,replacement:F}of j)B=B.replace(z,()=>F);return B}
2847
+ export{Dn,Oe,M,U,m,h,Qt,W,w,Me,Kr,Xr,Va,wt,jo,Gr,Bo,vd,Ne,Jr,he,Fo,zo,Ho,Yr,Y,Le,On,Ua,xd,Wa,Sd,qa,Mn,b,vt,ye,Ka,Zr,Xa,kd,q,Ga,Cd,x,$d,Ja,Ed,_d,Td,Rd,Ya,Za,Ad,Pd,Vo,Id,en,tn,Nn,Ln,e,Dd,Uo,Od,Wo,Qa,ec,xt,nn,Md,tc,nc,rc,f,je,St,Be,Fe,qo,jn,Z,Qr,es,ts,Nd,Bn,Ld,kt,rn,ze,ns,rs,sc,Q,Ko,Xo,Go,Jo,Fn,ss,Yo,Zo,Qo,oc,os,N,ce,K,jd,ic,is,as,ei,ti,cs,ls,zn,ac,ni,ri,cc,He,sn,Hn,Ct,lc,dc,uc,pc,fc,u,gc,ds,mc,si,oi,us,ii,hc,Bd,yc,be,ai,Fd,ps,gs,ms,Vn,ci,hs,Un,on,Wn,ys,bs,ws,n,bc,wc,vc,xc,Sc,kc,Ve,L,Ue,Cc,qn,$c,li,Ec,We,r,Kn,di,g,ee,zd,Xn,I,_c,o,R,Hd,Vd,le};