@stacksjs/stx 0.2.582 → 0.2.583

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 (166) hide show
  1. package/dist/{chunk-ayy9mmrw.js → chunk-02qaqamv.js} +6 -6
  2. package/dist/{chunk-6w2yqtrd.js → chunk-07anexcg.js} +1 -1
  3. package/dist/{chunk-dvgvvy5b.js → chunk-09zwhsf9.js} +1 -1
  4. package/dist/{chunk-cb2pyg5t.js → chunk-0dfgefjv.js} +2 -2
  5. package/dist/chunk-0fx3ppnt.js +2 -0
  6. package/dist/chunk-0sfexf9t.js +2 -0
  7. package/dist/chunk-2927nax9.js +2 -0
  8. package/dist/{chunk-eww6sdzz.js → chunk-2943qhdt.js} +1 -1
  9. package/dist/{chunk-9jh2ake5.js → chunk-2nehykbm.js} +5 -5
  10. package/dist/chunk-2rj0ttas.js +2 -0
  11. package/dist/chunk-3ae39ttg.js +2 -0
  12. package/dist/{chunk-q2a58n2a.js → chunk-440yjsk5.js} +1 -1
  13. package/dist/{chunk-kp0hg06s.js → chunk-4pkpr5cg.js} +2 -2
  14. package/dist/{chunk-g4crr86j.js → chunk-4pmgr32a.js} +3 -3
  15. package/dist/chunk-521pe0hb.js +18 -0
  16. package/dist/chunk-58z26y07.js +2 -0
  17. package/dist/chunk-5r9k9s3m.js +2 -0
  18. package/dist/{chunk-vx75fb0d.js → chunk-6fc8vw2v.js} +2 -2
  19. package/dist/{chunk-43h8q2cm.js → chunk-6m3me7yj.js} +6 -6
  20. package/dist/chunk-76vza4ve.js +2 -0
  21. package/dist/{chunk-c1r7zq0q.js → chunk-8tq83fq7.js} +71 -71
  22. package/dist/chunk-8y8bbsh5.js +2 -0
  23. package/dist/{chunk-620szfcp.js → chunk-96mb3brj.js} +2 -2
  24. package/dist/chunk-9kzycb15.js +2 -0
  25. package/dist/{chunk-djft0m5h.js → chunk-ac6v3s3k.js} +1 -1
  26. package/dist/chunk-agfhb2qd.js +2 -0
  27. package/dist/chunk-ay6dzpt4.js +2 -0
  28. package/dist/{chunk-dtcc09x1.js → chunk-b9njk81d.js} +1 -1
  29. package/dist/chunk-bfbcmfww.js +2 -0
  30. package/dist/chunk-br01jvra.js +2 -0
  31. package/dist/{chunk-v8p5p2kp.js → chunk-c12y2bet.js} +1 -1
  32. package/dist/chunk-c2nwchk0.js +2 -0
  33. package/dist/{chunk-3qrrv6af.js → chunk-cby4mkjf.js} +1 -1
  34. package/dist/{chunk-qazn64pm.js → chunk-ck1yca7g.js} +1 -1
  35. package/dist/chunk-cxqrwvc5.js +2 -0
  36. package/dist/chunk-czea8zr1.js +2 -0
  37. package/dist/chunk-d99kfx3k.js +2 -0
  38. package/dist/{chunk-7hkc96de.js → chunk-dhq80e4r.js} +4 -4
  39. package/dist/{chunk-cdgwkzms.js → chunk-dm1qh2vq.js} +1 -1
  40. package/dist/{chunk-5pgbsc3a.js → chunk-dskrwa8f.js} +1 -1
  41. package/dist/{chunk-zk2xk0wd.js → chunk-dvc15djp.js} +2 -2
  42. package/dist/chunk-e6ycqvdm.js +2 -0
  43. package/dist/{chunk-8v19753h.js → chunk-e809x7m0.js} +1 -1
  44. package/dist/{chunk-ta3wn842.js → chunk-en7xxgtb.js} +2 -2
  45. package/dist/chunk-fvx6pd66.js +2 -0
  46. package/dist/{chunk-xpnpg967.js → chunk-g9zeybqh.js} +2 -2
  47. package/dist/{chunk-zz02hwec.js → chunk-h3z9b6bw.js} +22 -22
  48. package/dist/{chunk-yk3fbzx5.js → chunk-hp9nxva6.js} +3 -3
  49. package/dist/chunk-hrbjapvr.js +2 -0
  50. package/dist/{chunk-pmpb34md.js → chunk-hzqyfdpy.js} +5 -5
  51. package/dist/chunk-jc4mxq56.js +2 -0
  52. package/dist/chunk-jdpyxt8j.js +2 -0
  53. package/dist/{chunk-4rkvwm6v.js → chunk-je1as16r.js} +9 -9
  54. package/dist/chunk-k0zev8wc.js +2 -0
  55. package/dist/{chunk-nrfh7gaa.js → chunk-kfwmqacd.js} +1 -1
  56. package/dist/{chunk-t61vdbje.js → chunk-ktvr45qg.js} +6 -6
  57. package/dist/{chunk-y8q1n7hx.js → chunk-ky1426s1.js} +6 -6
  58. package/dist/{chunk-rr8a7d4q.js → chunk-m417sp42.js} +3 -3
  59. package/dist/{chunk-101ekf6y.js → chunk-mjj24qpb.js} +2 -2
  60. package/dist/{chunk-ev5f79mg.js → chunk-mt9x626h.js} +3 -3
  61. package/dist/{chunk-faghmmrs.js → chunk-n4e02qdz.js} +85 -85
  62. package/dist/{chunk-yy3ser06.js → chunk-nh3svtvj.js} +3 -3
  63. package/dist/{chunk-yfq2v7x5.js → chunk-nhd9m8h5.js} +6 -6
  64. package/dist/chunk-nx8rf4qd.js +2 -0
  65. package/dist/{chunk-t8wpzqs4.js → chunk-pbwk8tzz.js} +1 -1
  66. package/dist/chunk-pe5bk9ns.js +2 -0
  67. package/dist/chunk-qb2j34sp.js +2 -0
  68. package/dist/chunk-qknfceta.js +2 -0
  69. package/dist/{chunk-0vnngvy1.js → chunk-qn8gdw21.js} +4 -4
  70. package/dist/chunk-sf98zgw2.js +2 -0
  71. package/dist/chunk-sgsp4dph.js +2 -0
  72. package/dist/{chunk-jtbzmbzz.js → chunk-sv08pd66.js} +2 -2
  73. package/dist/{chunk-30rf7k4n.js → chunk-tfxmzat6.js} +24 -24
  74. package/dist/chunk-tms7amrb.js +2 -0
  75. package/dist/chunk-v0zgarvv.js +2 -0
  76. package/dist/chunk-vczw73ga.js +2 -0
  77. package/dist/{chunk-be2ba3hj.js → chunk-vkc51n9m.js} +2 -2
  78. package/dist/{chunk-1v1mew46.js → chunk-vke73gts.js} +1 -1
  79. package/dist/{chunk-c0s3k64c.js → chunk-w6wtxj54.js} +2 -2
  80. package/dist/chunk-webrqm20.js +2 -0
  81. package/dist/chunk-wngqr949.js +2 -0
  82. package/dist/{chunk-71sdgv7e.js → chunk-wyn5rfzk.js} +105 -35
  83. package/dist/{chunk-yhpyqsbr.js → chunk-x552npae.js} +2 -2
  84. package/dist/{chunk-3wy8q3aq.js → chunk-xp7fxc6p.js} +5 -5
  85. package/dist/{chunk-t4g2fptt.js → chunk-xytkfa48.js} +4 -4
  86. package/dist/chunk-xyzy84x0.js +2 -0
  87. package/dist/chunk-y1jffvkj.js +2 -0
  88. package/dist/{chunk-74j18qk0.js → chunk-y8h823cb.js} +28 -28
  89. package/dist/chunk-yas134jv.js +2 -0
  90. package/dist/{chunk-tszkg6sj.js → chunk-ycj0342k.js} +1 -1
  91. package/dist/{chunk-mxe21m6q.js → chunk-yd55vynh.js} +1 -1
  92. package/dist/{chunk-hzfhn2vr.js → chunk-ye66wc53.js} +2 -2
  93. package/dist/{chunk-k9th7hc4.js → chunk-ym1sb5bg.js} +2 -2
  94. package/dist/chunk-yn2d8x8m.js +3 -0
  95. package/dist/chunk-ze86h6vp.js +2 -0
  96. package/dist/cli.js +44 -44
  97. package/dist/client/signals-authoring-runtime.js +13 -6
  98. package/dist/client/signals-binding-utils-runtime.js +14 -1
  99. package/dist/client/signals-component-api-runtime.js +3 -1
  100. package/dist/client/signals-event-shorthand-runtime.js +1 -1
  101. package/dist/client/signals-expression-runtime.js +1 -1
  102. package/dist/client/signals-host-runtime.js +20 -0
  103. package/dist/client/signals-manifest-hydration-runtime.js +7 -0
  104. package/dist/client/signals-model-runtime.js +2 -0
  105. package/dist/client/signals-mount-runtime.js +5 -1
  106. package/dist/client/signals-process-element-runtime.js +22 -7
  107. package/dist/component-model.d.ts +1 -1
  108. package/dist/component-model.js +6 -3
  109. package/dist/composition-api.js +3 -2
  110. package/dist/craft-entry.js +2 -2
  111. package/dist/craft.js +2 -2
  112. package/dist/native/compiler/bundle.js +8 -3
  113. package/dist/native/compiler/html-to-ir.d.ts +3 -1
  114. package/dist/native/compiler/html-to-ir.js +28 -1
  115. package/dist/native/runtime/binding-tree.js +12 -0
  116. package/dist/native/runtime/craft-bridge.js +2 -1
  117. package/dist/native/runtime/jsc-globals.d.ts +10 -3
  118. package/dist/native/runtime/jsc-globals.js +23 -4
  119. package/dist/native/runtime/native-host.d.ts +4 -0
  120. package/dist/native/runtime/native-host.js +273 -21
  121. package/dist/native/runtime/shared-screen.js +1 -0
  122. package/dist/native/testing.js +1 -1
  123. package/dist/pwa.js +3 -3
  124. package/dist/ssg.js +7 -7
  125. package/package.json +5 -5
  126. package/dist/chunk-0047meje.js +0 -2
  127. package/dist/chunk-1cat8kdj.js +0 -2
  128. package/dist/chunk-1dwnp35v.js +0 -2
  129. package/dist/chunk-2dnr5qfk.js +0 -2
  130. package/dist/chunk-2v73cjbc.js +0 -2
  131. package/dist/chunk-3akgppsy.js +0 -2
  132. package/dist/chunk-4t67wmcg.js +0 -2
  133. package/dist/chunk-51zn42jy.js +0 -2
  134. package/dist/chunk-5702x95v.js +0 -2
  135. package/dist/chunk-60c2bsh9.js +0 -2
  136. package/dist/chunk-79v4d9qh.js +0 -2
  137. package/dist/chunk-7pp2vx1g.js +0 -2
  138. package/dist/chunk-8zm6tkqb.js +0 -2
  139. package/dist/chunk-a1z36dt5.js +0 -2
  140. package/dist/chunk-atsf1fe0.js +0 -2
  141. package/dist/chunk-b8qd6h1q.js +0 -2
  142. package/dist/chunk-ccxs40xy.js +0 -2
  143. package/dist/chunk-cg8hg6cs.js +0 -3
  144. package/dist/chunk-cp442y7a.js +0 -2
  145. package/dist/chunk-d4en5d3s.js +0 -2
  146. package/dist/chunk-dh80d57p.js +0 -2
  147. package/dist/chunk-dyqte1xq.js +0 -2
  148. package/dist/chunk-e4n4v022.js +0 -2
  149. package/dist/chunk-g2fw68zm.js +0 -2
  150. package/dist/chunk-hcgm37dy.js +0 -2
  151. package/dist/chunk-hd2bn5q7.js +0 -2
  152. package/dist/chunk-j1nqnmcd.js +0 -18
  153. package/dist/chunk-k7jqkt93.js +0 -2
  154. package/dist/chunk-mqy7g74k.js +0 -2
  155. package/dist/chunk-ne03tfje.js +0 -2
  156. package/dist/chunk-p2sns0bn.js +0 -2
  157. package/dist/chunk-s1sycp43.js +0 -2
  158. package/dist/chunk-sp46w7z9.js +0 -2
  159. package/dist/chunk-sy1bk1ry.js +0 -2
  160. package/dist/chunk-tpd5nwa3.js +0 -2
  161. package/dist/chunk-tpt4bgs5.js +0 -2
  162. package/dist/chunk-vq0cb1m9.js +0 -2
  163. package/dist/chunk-y1bppxgw.js +0 -2
  164. package/dist/chunk-yv5rwthv.js +0 -2
  165. package/dist/chunk-z1r4tdqy.js +0 -2
  166. package/dist/chunk-zv288w4e.js +0 -2
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{$n,y,Hi,Nt,qs,Ui,Vi,Wi,qi}from"./chunk-zk2xk0wd.js";import{O}from"./chunk-vpdx7qr3.js";import{t,Y,fr,i,re,Us,I,Dt,_n,Vs,l,p,zi,D,_e,tt,c,mr}from"./chunk-7hkc96de.js";import{An,Pn,vr,Te}from"./chunk-yhpyqsbr.js";import{S,Bs,Qe,Fs,Mi,bn,wn,Ni,Ce,Li,vn,ji,Ot,zs,Bi,xn,kn,ur,me,Hs,he,pr}from"./chunk-43h8q2cm.js";import{Ms,Ns,Ls,js,ar,cr}from"./chunk-ayy9mmrw.js";import{Ii,Is,sr,or}from"./chunk-jtbzmbzz.js";import{fe,It,ir,Ds,C,Ye}from"./chunk-be2ba3hj.js";import{yn}from"./chunk-eww6sdzz.js";import{Ys}from"./chunk-qdyp2zqf.js";import{_i,Ei,$i,Ri}from"./chunk-cdgwkzms.js";import{Je}from"./chunk-r47cs92n.js";import{s,Se}from"./chunk-3e3dpp7w.js";import{Pt,Di,mn,a,hn}from"./chunk-00p22wzr.js";import{u}from"./chunk-cg8hg6cs.js";import{E,M,En,Ws}from"./chunk-5db5sxy3.js";import{xr}from"./chunk-hzfhn2vr.js";import Hr from"path";import So from"fs";var Rh=new Set(["touchstart","touchmove","wheel","mousewheel"]);function Ba(v,_){if(_.passive)return!0;if(_.prevent||_.nonpassive)return!1;return Rh.has(v.toLowerCase())}var Mu=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"]),Ou={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"},Th=new Set(["ctrl","alt","shift","meta"]),Lu={left:0,middle:1,right:2};function Nu(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 R=k.toLowerCase();if(R==="prevent")_.prevent=!0;else if(R==="stop")_.stop=!0;else if(R==="once")_.once=!0;else if(R==="capture")_.capture=!0;else if(R==="self")_.self=!0;else if(R==="passive")_.passive=!0;else if(R==="nonpassive")_.nonpassive=!0;else if(Th.has(R))_.systemKeys.push(R);else if(R in Lu)_.mouse=R;else if(R in Ou||/^[a-z]$/.test(R))_.keys.push(Ou[R]||R.toUpperCase());else if(R.startsWith("debounce")){let T=R.match(/debounce(?:\.(\d+))?/);_.debounce=T?.[1]?Number.parseInt(T[1],10):300}else if(R.startsWith("throttle")){let T=R.match(/throttle(?:\.(\d+))?/);_.throttle=T?.[1]?Number.parseInt(T[1],10):300}}return _}function Bu(v,_=""){let k=[],R=0,T=/<([a-z][a-z0-9-]*)\s+([^>]*@[a-z][^>]*)>/gi,B;while((B=T.exec(v))!==null){let[z,W,F]=B,V=B.index,H=V+z.length,q=`__stx_evt_${_}${R++}`,Q=[],Z=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,se;while((se=Z.exec(F))!==null){let[,oe,ae]=se,le=oe.split("."),ce=le[0];if(!Mu.has(ce))continue;Q.push({attribute:`@${oe}`,event:ce,handler:ae,modifiers:Nu(le.slice(1)),elementId:q})}let ie=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((se=ie.exec(F))!==null){let[,oe,ae]=se,le=oe.split("."),ce=le[0];if(!Mu.has(ce))continue;Q.push({attribute:`@${oe}`,event:ce,handler:ae,modifiers:Nu(le.slice(1)),elementId:q})}if(Q.length>0)k.push({originalTag:z,elementId:q,events:Q,startIndex:V,endIndex:H})}return k}function Ah(v){let _=[],{modifiers:k}=v;if(k.self)_.push("if ($event.target !== $el) return");for(let R of k.systemKeys)_.push(`if (!$event.${R}Key) return`);if(k.keys.length>0){let R=k.keys.map((T)=>`$event.key === '${T}'`).join(" || ");_.push(`if (!(${R})) return`)}if(k.mouse!==null){let R=Lu[k.mouse];_.push(`if ($event.button !== ${R}) return`)}if(k.prevent)_.push("$event.preventDefault()");if(k.stop)_.push("$event.stopPropagation()");return _.join("; ")}function Ih(v,_){let k=v;if(_.debounce!==null)k=`__stx_debounce(() => { ${k} }, ${_.debounce})`;else if(_.throttle!==null)k=`__stx_throttle(() => { ${k} }, ${_.throttle})`;return k}function za(v){let _=v.trim();if(!/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(_))return v;return`if (typeof ${_} === 'function' && !${_}._isSignal) ${_}($event);`}function Ph(v){let{modifiers:_}=v,k=v.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),R=Ah(v),T=Ih(za(v.handler),_),B=[];if(_.once)B.push("once: true");if(_.capture)B.push("capture: true");if(Ba(v.event,_))B.push("passive: true");let z=B.length>0?`, { ${B.join(", ")} }`:"",W=T.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t");if(v.event==="mounted")return`
2
+ import{$n,y,Hi,Nt,qs,Ui,Vi,Wi,qi}from"./chunk-dvc15djp.js";import{O}from"./chunk-vpdx7qr3.js";import{t,Y,gr,i,re,Us,I,Dt,_n,Vs,l,p,zi,D,_e,tt,c,hr}from"./chunk-dhq80e4r.js";import{An,Pn,xr,Te}from"./chunk-x552npae.js";import{S,Bs,Qe,Fs,Mi,bn,vn,Ni,Ce,Li,wn,ji,Ot,zs,Bi,xn,kn,pr,me,Hs,he,fr}from"./chunk-6m3me7yj.js";import{Ms,Ns,Ls,js,cr,lr}from"./chunk-02qaqamv.js";import{Ii,Is,or,ir}from"./chunk-sv08pd66.js";import{fe,It,ar,Ds,C,Ye}from"./chunk-vkc51n9m.js";import{yn}from"./chunk-2943qhdt.js";import{Ys}from"./chunk-qdyp2zqf.js";import{_i,Ei,$i,Ri}from"./chunk-dm1qh2vq.js";import{Je}from"./chunk-r47cs92n.js";import{s,Se}from"./chunk-3e3dpp7w.js";import{Pt,Di,mn,a,hn}from"./chunk-00p22wzr.js";import{d}from"./chunk-yn2d8x8m.js";import{E,M,En,Ws}from"./chunk-5db5sxy3.js";import{Sr}from"./chunk-ye66wc53.js";import Hr from"path";import So from"fs";var Rh=new Set(["touchstart","touchmove","wheel","mousewheel"]);function Ba(v,_){if(_.passive)return!0;if(_.prevent||_.nonpassive)return!1;return Rh.has(v.toLowerCase())}var $u=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"]),_u={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"},Th=new Set(["ctrl","alt","shift","meta"]),Cu={left:0,middle:1,right:2};function ku(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 R=k.toLowerCase();if(R==="prevent")_.prevent=!0;else if(R==="stop")_.stop=!0;else if(R==="once")_.once=!0;else if(R==="capture")_.capture=!0;else if(R==="self")_.self=!0;else if(R==="passive")_.passive=!0;else if(R==="nonpassive")_.nonpassive=!0;else if(Th.has(R))_.systemKeys.push(R);else if(R in Cu)_.mouse=R;else if(R in _u||/^[a-z]$/.test(R))_.keys.push(_u[R]||R.toUpperCase());else if(R.startsWith("debounce")){let T=R.match(/debounce(?:\.(\d+))?/);_.debounce=T?.[1]?Number.parseInt(T[1],10):300}else if(R.startsWith("throttle")){let T=R.match(/throttle(?:\.(\d+))?/);_.throttle=T?.[1]?Number.parseInt(T[1],10):300}}return _}function Ru(v,_=""){let k=[],R=0,T=/<([a-z][a-z0-9-]*)\s+([^>]*@[a-z][^>]*)>/gi,B;while((B=T.exec(v))!==null){let[z,W,F]=B,V=B.index,H=V+z.length,q=`__stx_evt_${_}${R++}`,Q=[],Z=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,se;while((se=Z.exec(F))!==null){let[,oe,ae]=se,le=oe.split("."),ce=le[0];if(!$u.has(ce))continue;Q.push({attribute:`@${oe}`,event:ce,handler:ae,modifiers:ku(le.slice(1)),elementId:q})}let ie=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((se=ie.exec(F))!==null){let[,oe,ae]=se,le=oe.split("."),ce=le[0];if(!$u.has(ce))continue;Q.push({attribute:`@${oe}`,event:ce,handler:ae,modifiers:ku(le.slice(1)),elementId:q})}if(Q.length>0)k.push({originalTag:z,elementId:q,events:Q,startIndex:V,endIndex:H})}return k}function Ah(v){let _=[],{modifiers:k}=v;if(k.self)_.push("if ($event.target !== $el) return");for(let R of k.systemKeys)_.push(`if (!$event.${R}Key) return`);if(k.keys.length>0){let R=k.keys.map((T)=>`$event.key === '${T}'`).join(" || ");_.push(`if (!(${R})) return`)}if(k.mouse!==null){let R=Cu[k.mouse];_.push(`if ($event.button !== ${R}) return`)}if(k.prevent)_.push("$event.preventDefault()");if(k.stop)_.push("$event.stopPropagation()");return _.join("; ")}function Ih(v,_){let k=v;if(_.debounce!==null)k=`__stx_debounce(() => { ${k} }, ${_.debounce})`;else if(_.throttle!==null)k=`__stx_throttle(() => { ${k} }, ${_.throttle})`;return k}function za(v){let _=v.trim();if(!/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(_))return v;return`if (typeof ${_} === 'function' && !${_}._isSignal) ${_}($event);`}function Ph(v){let{modifiers:_}=v,k=v.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),R=Ah(v),T=Ih(za(v.handler),_),B=[];if(_.once)B.push("once: true");if(_.capture)B.push("capture: true");if(Ba(v.event,_))B.push("passive: true");let z=B.length>0?`, { ${B.join(", ")} }`:"",W=T.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t");if(v.event==="mounted")return`
3
3
  (function() {
4
4
  var $el = document.getElementById('${k}');
5
5
  if (!$el) return;
@@ -111,8 +111,8 @@ else {
111
111
  ${v.map(Ph).join(`
112
112
  `)}
113
113
  })();
114
- </script>`}function Dh(v,_=""){let k=Bu(v,_);if(k.length===0)return{template:v,bindings:[]};let R=v,T=[];for(let B=k.length-1;B>=0;B--){let z=k[B],W=z.originalTag;if(!W.includes(" id="))W=W.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${z.elementId}"`);else{let F=W.match(/id=["']([^"']+)["']/);if(F)for(let V of z.events)V.elementId=F[1]}for(let F of z.events){let V=F.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),H=new RegExp(`\\s*${V}\\s*=\\s*"[^"]*"`,"g"),q=new RegExp(`\\s*${V}\\s*=\\s*'[^']*'`,"g");W=W.replace(H,""),W=W.replace(q,"")}R=R.slice(0,z.startIndex)+W+R.slice(z.endIndex),T.push(...z.events)}return{template:R,bindings:T}}function ju(v){let _=v.$uid;return typeof _==="string"&&_?`${_}_`:""}function zu(v,_,k){if(Ui(v))return v;if(_.__stx_sfc_mode){if(/x-data\s*=\s*["']/.test(v))return v;let{template:W,bindings:F}=Dh(v,ju(_)),V=_.__stx_event_bindings||[];return _.__stx_event_bindings=[...V,...F],W}let R=Bu(v,ju(_));if(R.length===0)return v;let T=v;for(let W=R.length-1;W>=0;W--){let F=R[W],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 q of F.events)q.elementId=H[1]}for(let H of F.events){let q=H.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),Q=new RegExp(`\\s*${q}\\s*=\\s*"[^"]*"`,"g"),Z=new RegExp(`\\s*${q}\\s*=\\s*'[^']*'`,"g");V=V.replace(Q,""),V=V.replace(Z,"")}T=T.slice(0,F.startIndex)+V+T.slice(F.endIndex)}let B=Wa(R.flatMap((W)=>W.events)),z=T.lastIndexOf("</body>");if(z!==-1)T=T.slice(0,z)+B+`
115
- `+T.slice(z);else T+=B;return T}function Wu(v,_){let k=new Set;for(let R of v.split(",")){let T=R.trim().replace(/^\.\.\./,"").trim();if(!T)continue;if(_){let B=T.lastIndexOf(":");if(B!==-1)T=T.slice(B+1).trim()}if(T=T.split("=")[0].trim(),/^[A-Za-z_$][\w$]*$/.test(T))k.add(T)}return k}function Fi(v,_){let k=s(v),{depths:R,balanced:T}=Se(k),B=(W)=>!T||R[W]===0,z=new RegExp(`(?:^|[^\\w$.])((?:const|let|var|function|class)\\s+${_}\\b)`,"g");for(let W of k.matchAll(z)){let F=(W.index??0)+W[0].length-W[1].length;if(B(F))return!0}for(let W of k.matchAll(/(?:const|let|var)\s*\{([^}]*)\}/g))if(B(W.index??0)&&Wu(W[1],!0).has(_))return!0;for(let W of k.matchAll(/(?:const|let|var)\s*\[([^\]]*)\]/g))if(B(W.index??0)&&Wu(W[1],!1).has(_))return!0;return!1}var Fu="",To,hr=/^[A-Za-z_$][\w$]*$/,Mh=new Set(["if","for","while","switch","with"]),Vu=["(","[","{"],Uu=[")","]","}"],Oh=new Set(["const","let","var","return","if","for","while","do","switch","try","throw","export"]);function Nh(v){let _=s(v),k=[];for(let R of _.matchAll(/[A-Za-z_$][\w$]*|=>|\.\.\.|[^\s]/g)){let T=R.index??0;k.push({text:R[0],start:T,end:T+R[0].length})}return{code:_,tokens:k}}function Fa(v){if(To&&v===Fu)return To;let{code:_,tokens:k}=Nh(v),R=new Map,T=[];for(let se=0;se<k.length;se++){let ie=k[se].text;if(["(","[","{"].includes(ie))T.push(se);else if([")","]","}"].includes(ie)){let oe=T.at(-1);if(oe!==void 0&&["()","[]","{}"].includes(k[oe].text+ie))T.pop(),R.set(oe,se),R.set(se,oe)}}function B(se,ie){let oe=[],ae=se;for(let le=se;le<ie;le++){if(["(","[","{"].includes(k[le].text)&&(R.get(le)??ie)<ie){le=R.get(le);continue}if(k[le].text===",")oe.push([ae,le]),ae=le+1}return oe.push([ae,ie]),oe}let z=[];function W(se,ie,oe,ae=!1){if(k[se]?.text==="...")se++;if(se>=ie)return;let le=k[se].text;if(hr.test(le)){if(oe.add(le),oe===H)z.push({name:le,token:se,functionScoped:ae});return}if(le!=="{"&&le!=="[")return;let ce=R.get(se);if(ce===void 0||ce>=ie)return;for(let[ge,$e]of B(se+1,ce)){let ye=ge;if(le==="{")for(let ke=ge;ke<$e;ke++){if(k[ke].text===":"){ye=ke+1;break}if(k[ke].text==="=")break;if(["(","[","{"].includes(k[ke].text)&&R.has(ke))ke=R.get(ke)}W(ye,$e,oe,ae)}}function F(se,ie){let oe=new Set;for(let[ae,le]of B(se,ie))W(ae,le,oe);return oe}function V(se){let ie=se;for(;ie<k.length;ie++){let oe=k[ie].text;if(["(","[","{"].includes(oe)&&R.has(ie)){ie=R.get(ie);continue}if([",",";",")","]","}"].includes(oe))break}return k[Math.max(se,ie-1)]?.end??_.length}let H=new Set,q=[];for(let se=0;se<k.length;se++)if(k[se].text==="=>"){let ie=se-1,oe=ie,ae;if(k[ie]?.text===")"&&R.has(ie))oe=R.get(ie),ae=F(oe+1,ie);else if(k[ie]&&hr.test(k[ie].text))ae=new Set([k[ie].text]);else continue;let le=se+1,ce=k[le]?.text==="{"&&R.has(le)?k[R.get(le)].end:V(le);q.push({start:k[oe].start,end:ce,bodyStart:k[le]?.start??ce,functionBody:!0,names:ae})}else if(k[se].text==="("&&R.has(se)){let ie=k[se-1]?.text;if(!ie||Mh.has(ie)||!hr.test(ie)&&ie!=="*"&&ie!=="]")continue;let oe=R.get(se),ae=oe+1;if(k[ae]?.text===":"){ae++;while(ae<k.length&&!["{","=>",";","="].includes(k[ae].text))ae++}if(k[ae]?.text!=="{"||!R.has(ae))continue;q.push({start:k[se].start,end:k[R.get(ae)].end,bodyStart:k[ae].start,functionBody:ie!=="catch",names:F(se+1,oe)})}function Q(se){let ie=se;for(;ie<k.length;ie++){let oe=k[ie].text;if(Vu.includes(oe)&&R.has(ie)){ie=R.get(ie);continue}if(oe===";"||Uu.includes(oe))break;let ae=k[ie-1];if(ie>se&&Oh.has(oe)&&ae.text!==".")break;if(ie>se&&/[\n\r]/.test(_.slice(ae.end,k[ie].start))&&(/^[\w$]+$/.test(ae.text)||Uu.includes(ae.text)||['"',"'","`"].includes(ae.text))&&hr.test(oe)&&!["in","of","instanceof"].includes(oe))break}return ie}let Z=[];for(let se=0;se<k.length;se++){if(k[se].text!=="for")continue;let ie=k[se+1]?.text==="await"?se+2:se+1;if(k[ie]?.text!=="("||!R.has(ie))continue;let oe=R.get(ie),ae=oe+1,le=k[ae]?.text==="{"&&R.has(ae)?R.get(ae):Q(ae),ce=k[le]?.text===";"||k[le]?.text==="}"?k[le].end:k[Math.max(ae,le-1)]?.end??_.length;Z.push({headStart:ie,headEnd:oe,start:k[ie].start,end:ce})}for(let se=0;se<k.length;se++){let ie=k[se].text,oe=k[se-1]?.text;if(oe==="."||k[se+1]?.text===":")continue;if(oe==="as"||oe==="<")continue;if(ie==="const"||ie==="let"||ie==="var"){let ae=Q(se+1),le=se+1,ce=!1,ge=!1,$e=0;for(let ye=se+1;ye<=ae;ye++){let ke=k[ye]?.text;if(ye<ae&&Vu.includes(ke)&&R.has(ye)&&R.get(ye)<ae){ye=R.get(ye);continue}if(ye<ae&&ke===":"&&!ge)ce=!0;else if(ye<ae&&ke==="="&&$e===0)ce=!1,ge=!0;else if(ye<ae&&ce&&ke==="<")$e++;else if(ye<ae&&ce&&ke===">"&&$e>0)$e--;else if(ye===ae||ke===","&&$e===0)W(le,ye,H,ie==="var"),le=ye+1,ce=!1,ge=!1}}else if(ie==="function"||ie==="class"){let ae=se+1;if(k[ae]?.text==="*")ae++;if(k[ae]&&hr.test(k[ae].text)&&k[ae].text!=="extends")H.add(k[ae].text),z.push({name:k[ae].text,token:ae})}else if(ie==="import"){let ae=se+1;if(k[ae]?.text==="*"&&k[ae+1]?.text==="as")ae+=2;let le=k[ae]?.text;if(le&&hr.test(le)&&le!=="type"&&k[ae+1]?.text!=="("&&k[ae+1]?.text!==".")H.add(le),z.push({name:le,token:ae,file:!0});let ce=k[ae]?.text==="{"?ae:k[ae+1]?.text===","&&k[ae+2]?.text==="{"?ae+2:-1;if(ce!==-1&&R.has(ce)){let ge=R.get(ce);for(let[$e,ye]of B(ce+1,ge)){let ke=ye-1;while(ke>=$e&&!hr.test(k[ke].text))ke--;if(ke>=$e&&k[ke].text!=="type")z.push({name:k[ke].text,token:ke,file:!0})}}}}return Fu=v,To={code:_,scopes:q,loops:Z,declarations:H,sites:z,tokens:k,pairs:R},To}function Va(v){let _=Fa(v);return{code:_.code,shadows:(k,R)=>_.scopes.some((T)=>R>=T.start&&R<T.end&&T.names.has(k))}}function Ao(v){return new Set(Fa(v).declarations)}function Ct(v,_){let{scopes:k,loops:R,sites:T,tokens:B,pairs:z}=Fa(v),W=Array.from({length:B.length},()=>-1),F=[];for(let Z=0;Z<B.length;Z++){W[Z]=F.length?F[F.length-1]:-1;let se=B[Z].text;if(se==="{"&&z.has(Z))F.push(Z);else if(se==="}"&&F.length&&z.get(Z)===F[F.length-1])F.pop()}let V=new Set,H=new Map;for(let Z of T){if(!_.has(Z.name))continue;V.add(Z.token);let se=Z.file?-1:W[Z.token],ie=se===-1?[0,Number.POSITIVE_INFINITY]:[B[se].start,B[z.get(se)].end];if(Z.functionScoped){let ae=B[Z.token].start,le=k.filter((ce)=>ce.functionBody&&ae>=ce.bodyStart&&ae<ce.end).sort((ce,ge)=>ce.end-ce.bodyStart-(ge.end-ge.bodyStart))[0];ie=le?[le.bodyStart,le.end]:[0,Number.POSITIVE_INFINITY]}else if(!Z.file){let ae=R.filter((le)=>Z.token>le.headStart&&Z.token<le.headEnd).sort((le,ce)=>le.headEnd-le.headStart-(ce.headEnd-ce.headStart))[0];if(ae)ie=[ae.start,ae.end]}let oe=H.get(Z.name);if(oe)oe.push(ie);else H.set(Z.name,[ie])}let q=new Set;for(let Z=0;Z<B.length;Z++){if(B[Z].text!=="import"||B[Z-1]?.text===".")continue;let se=Z+1;if(B[se]?.text==="type")se++;if(B[se]&&hr.test(B[se].text)&&B[se+1]?.text===",")se+=2;if(B[se]?.text==="{"&&z.has(se))for(let ie=se+1;ie<z.get(se);ie++)q.add(ie)}let Q=new Set;for(let Z=0;Z<B.length;Z++){let se=B[Z].text;if(!_.has(se)||Q.has(se)||V.has(Z)||q.has(Z))continue;let ie=B[Z-1]?.text;if(ie==="#"||ie==="."&&B[Z-2]?.text!=="..")continue;if(B[Z+1]?.text===":"&&(ie==="{"||ie===","))continue;let oe=B[Z].start;if(H.get(se)?.some(([ae,le])=>oe>=ae&&oe<le))continue;if(k.some((ae)=>oe>=ae.start&&oe<ae.end&&ae.names.has(se)))continue;Q.add(se)}return Q}import Io from"fs";import Ut from"path";function sn(v){return v.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}var Hu=new Map;function Po(v,_=!0){let k=Hu.get(v);if(_&&k)return k;let R=new Map,T=[Ut.join(v,"src"),Ut.join(v,"dist"),v];function B(z,W){if(W>6)return;let F;try{F=Io.readdirSync(z,{withFileTypes:!0})}catch{return}for(let V of F){let H=Ut.join(z,V.name);if(V.isDirectory()){if(V.name==="node_modules"||V.name.startsWith("."))continue;B(H,W+1)}else if(V.isFile()&&V.name.endsWith(".stx")){let q=V.name.slice(0,-4);if(!R.has(q))R.set(q,H);let Q=q.toLowerCase();if(!R.has(Q))R.set(Q,H);let Z=sn(q);if(!R.has(Z))R.set(Z,H)}}}for(let z of T)if(B(z,0),R.size>0)break;if(_)Hu.set(v,R);return R}function Do(v,_){if(v.startsWith(".")||v.startsWith("/"))return null;let k=_;while(!0){let R=Ut.join(k,"node_modules",v);try{if(Io.statSync(R).isDirectory())return R}catch{}let T=Ut.dirname(k);if(T===k)return null;k=T}}function Mo(v,_,k={}){return[Ut.resolve(Ut.dirname(_),`${v}.stx`),Ut.resolve(Ut.dirname(_),v),Ut.resolve(k.componentsDir||"components",`${v}.stx`),Ut.resolve(k.componentsDir||"components",v),v.endsWith(".stx")?v:`${v}.stx`]}function qu(v){let _=v.endsWith(".stx")?v.slice(0,-4):v,k=_.split("-").map((T)=>T.charAt(0).toUpperCase()+T.slice(1)).join(""),R=sn(_);return[_,k,R]}function Ua(v,_){let[k,R,T]=qu(v);for(let B of[k,k.toLowerCase(),R,T]){let z=_?.__importedComponents?.get(B);if(z!==void 0)return z}}function*Ha(v,_,k={},R){let T=qu(v);if(T[0].startsWith("./")||T[0].startsWith("../")){yield Ut.resolve(Ut.dirname(_),`${T[0]}.stx`);return}let B=[...new Set(T.map((F)=>`${F}.stx`))],z=k.projectRoot||process.cwd(),W=[...R?.__originalFilePath?[Ut.join(Ut.dirname(R.__originalFilePath),"components")]:[],...k.componentsDir?[k.componentsDir]:[],Ut.join(Ut.dirname(_),"components"),Ut.resolve(z,"src/components"),Ut.resolve(z,"components"),...import.meta.dir?[Ut.resolve(import.meta.dir,"components")]:[]];for(let F of new Set(W)){for(let V of B)yield Ut.join(F,V);try{for(let V of Io.readdirSync(F,{withFileTypes:!0}))if(V.isDirectory())for(let H of B)yield Ut.join(F,V.name,H)}catch{}}}function Ku(v,_,k={},R){let T=Ua(v,R);if(T!==void 0)return T;for(let B of Ha(v,_,k,R))try{if(Io.statSync(B,{throwIfNoEntry:!1})?.isFile())return B}catch{}return null}import bh from"fs";import rt from"path";import{createHash as jh}from"crypto";var Oo="__stx_component_client_factories";function No(v){let _=v[Oo];return _ instanceof Map?_:null}function Zu(v){v[Oo]=new Map}function qa(v,_){let k=No(v);if(!k)return null;let R=jh("sha256").update(_).digest("hex").slice(0,16),T=k.get(R);if(T)T.instances++;else k.set(R,{body:_,instances:1});return R}function Gu(v,_){let k=No(_);if(!k?.size)return v;let R=new Map;for(let[H,q]of k)if(q.instances===1)R.set(H,q.body);let T=[];if(R.size>0){let H=[...R.keys()].map((Z)=>JSON.stringify(Z).replace(/[$()*+.?[\\\]^{|}]/g,"\\$&")).join("|"),q=new RegExp(`window\\.__stxComponentFactories\\[(${H})\\]\\(("[^"]+")\\);`,"g"),Q=q.exec(v);while(Q!==null){let Z=R.get(JSON.parse(Q[1]));if(Z!==void 0)T.push({start:Q.index,end:Q.index+Q[0].length,replacement:`(${Z})(${Q[2]});`});Q=q.exec(v)}}let B=[...k].filter(([,H])=>H.instances>1);if(B.length===0)return Xu(v,T);let W=`<script data-stx-scoped data-stx-run="always" data-stx-component-factories>
114
+ </script>`}function Dh(v,_=""){let k=Ru(v,_);if(k.length===0)return{template:v,bindings:[]};let R=v,T=[];for(let B=k.length-1;B>=0;B--){let z=k[B],W=z.originalTag;if(!W.includes(" id="))W=W.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${z.elementId}"`);else{let F=W.match(/id=["']([^"']+)["']/);if(F)for(let V of z.events)V.elementId=F[1]}for(let F of z.events){let V=F.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),H=new RegExp(`\\s*${V}\\s*=\\s*"[^"]*"`,"g"),q=new RegExp(`\\s*${V}\\s*=\\s*'[^']*'`,"g");W=W.replace(H,""),W=W.replace(q,"")}R=R.slice(0,z.startIndex)+W+R.slice(z.endIndex),T.push(...z.events)}return{template:R,bindings:T}}function Eu(v){let _=v.$uid;return typeof _==="string"&&_?`${_}_`:""}function Tu(v,_,k){if(Ui(v))return v;if(_.__stx_sfc_mode){if(/x-data\s*=\s*["']/.test(v))return v;let{template:W,bindings:F}=Dh(v,Eu(_)),V=_.__stx_event_bindings||[];return _.__stx_event_bindings=[...V,...F],W}let R=Ru(v,Eu(_));if(R.length===0)return v;let T=v;for(let W=R.length-1;W>=0;W--){let F=R[W],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 q of F.events)q.elementId=H[1]}for(let H of F.events){let q=H.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),Q=new RegExp(`\\s*${q}\\s*=\\s*"[^"]*"`,"g"),Z=new RegExp(`\\s*${q}\\s*=\\s*'[^']*'`,"g");V=V.replace(Q,""),V=V.replace(Z,"")}T=T.slice(0,F.startIndex)+V+T.slice(F.endIndex)}let B=Wa(R.flatMap((W)=>W.events)),z=T.lastIndexOf("</body>");if(z!==-1)T=T.slice(0,z)+B+`
115
+ `+T.slice(z);else T+=B;return T}function Au(v,_){let k=new Set;for(let R of v.split(",")){let T=R.trim().replace(/^\.\.\./,"").trim();if(!T)continue;if(_){let B=T.lastIndexOf(":");if(B!==-1)T=T.slice(B+1).trim()}if(T=T.split("=")[0].trim(),/^[A-Za-z_$][\w$]*$/.test(T))k.add(T)}return k}function Fi(v,_){let k=s(v),{depths:R,balanced:T}=Se(k),B=(W)=>!T||R[W]===0,z=new RegExp(`(?:^|[^\\w$.])((?:const|let|var|function|class)\\s+${_}\\b)`,"g");for(let W of k.matchAll(z)){let F=(W.index??0)+W[0].length-W[1].length;if(B(F))return!0}for(let W of k.matchAll(/(?:const|let|var)\s*\{([^}]*)\}/g))if(B(W.index??0)&&Au(W[1],!0).has(_))return!0;for(let W of k.matchAll(/(?:const|let|var)\s*\[([^\]]*)\]/g))if(B(W.index??0)&&Au(W[1],!1).has(_))return!0;return!1}var Iu="",To,mr=/^[A-Za-z_$][\w$]*$/,Mh=new Set(["if","for","while","switch","with"]),Pu=["(","[","{"],Du=[")","]","}"],Oh=new Set(["const","let","var","return","if","for","while","do","switch","try","throw","export"]);function Nh(v){let _=s(v),k=[];for(let R of _.matchAll(/[A-Za-z_$][\w$]*|=>|\.\.\.|[^\s]/g)){let T=R.index??0;k.push({text:R[0],start:T,end:T+R[0].length})}return{code:_,tokens:k}}function Fa(v){if(To&&v===Iu)return To;let{code:_,tokens:k}=Nh(v),R=new Map,T=[];for(let se=0;se<k.length;se++){let ie=k[se].text;if(["(","[","{"].includes(ie))T.push(se);else if([")","]","}"].includes(ie)){let oe=T.at(-1);if(oe!==void 0&&["()","[]","{}"].includes(k[oe].text+ie))T.pop(),R.set(oe,se),R.set(se,oe)}}function B(se,ie){let oe=[],ae=se;for(let le=se;le<ie;le++){if(["(","[","{"].includes(k[le].text)&&(R.get(le)??ie)<ie){le=R.get(le);continue}if(k[le].text===",")oe.push([ae,le]),ae=le+1}return oe.push([ae,ie]),oe}let z=[];function W(se,ie,oe,ae=!1){if(k[se]?.text==="...")se++;if(se>=ie)return;let le=k[se].text;if(mr.test(le)){if(oe.add(le),oe===H)z.push({name:le,token:se,functionScoped:ae});return}if(le!=="{"&&le!=="[")return;let ce=R.get(se);if(ce===void 0||ce>=ie)return;for(let[ge,$e]of B(se+1,ce)){let ye=ge;if(le==="{")for(let ke=ge;ke<$e;ke++){if(k[ke].text===":"){ye=ke+1;break}if(k[ke].text==="=")break;if(["(","[","{"].includes(k[ke].text)&&R.has(ke))ke=R.get(ke)}W(ye,$e,oe,ae)}}function F(se,ie){let oe=new Set;for(let[ae,le]of B(se,ie))W(ae,le,oe);return oe}function V(se){let ie=se;for(;ie<k.length;ie++){let oe=k[ie].text;if(["(","[","{"].includes(oe)&&R.has(ie)){ie=R.get(ie);continue}if([",",";",")","]","}"].includes(oe))break}return k[Math.max(se,ie-1)]?.end??_.length}let H=new Set,q=[];for(let se=0;se<k.length;se++)if(k[se].text==="=>"){let ie=se-1,oe=ie,ae;if(k[ie]?.text===")"&&R.has(ie))oe=R.get(ie),ae=F(oe+1,ie);else if(k[ie]&&mr.test(k[ie].text))ae=new Set([k[ie].text]);else continue;let le=se+1,ce=k[le]?.text==="{"&&R.has(le)?k[R.get(le)].end:V(le);q.push({start:k[oe].start,end:ce,bodyStart:k[le]?.start??ce,functionBody:!0,names:ae})}else if(k[se].text==="("&&R.has(se)){let ie=k[se-1]?.text;if(!ie||Mh.has(ie)||!mr.test(ie)&&ie!=="*"&&ie!=="]")continue;let oe=R.get(se),ae=oe+1;if(k[ae]?.text===":"){ae++;while(ae<k.length&&!["{","=>",";","="].includes(k[ae].text))ae++}if(k[ae]?.text!=="{"||!R.has(ae))continue;q.push({start:k[se].start,end:k[R.get(ae)].end,bodyStart:k[ae].start,functionBody:ie!=="catch",names:F(se+1,oe)})}function Q(se){let ie=se;for(;ie<k.length;ie++){let oe=k[ie].text;if(Pu.includes(oe)&&R.has(ie)){ie=R.get(ie);continue}if(oe===";"||Du.includes(oe))break;let ae=k[ie-1];if(ie>se&&Oh.has(oe)&&ae.text!==".")break;if(ie>se&&/[\n\r]/.test(_.slice(ae.end,k[ie].start))&&(/^[\w$]+$/.test(ae.text)||Du.includes(ae.text)||['"',"'","`"].includes(ae.text))&&mr.test(oe)&&!["in","of","instanceof"].includes(oe))break}return ie}let Z=[];for(let se=0;se<k.length;se++){if(k[se].text!=="for")continue;let ie=k[se+1]?.text==="await"?se+2:se+1;if(k[ie]?.text!=="("||!R.has(ie))continue;let oe=R.get(ie),ae=oe+1,le=k[ae]?.text==="{"&&R.has(ae)?R.get(ae):Q(ae),ce=k[le]?.text===";"||k[le]?.text==="}"?k[le].end:k[Math.max(ae,le-1)]?.end??_.length;Z.push({headStart:ie,headEnd:oe,start:k[ie].start,end:ce})}for(let se=0;se<k.length;se++){let ie=k[se].text,oe=k[se-1]?.text;if(oe==="."||k[se+1]?.text===":")continue;if(oe==="as"||oe==="<")continue;if(ie==="const"||ie==="let"||ie==="var"){let ae=Q(se+1),le=se+1,ce=!1,ge=!1,$e=0;for(let ye=se+1;ye<=ae;ye++){let ke=k[ye]?.text;if(ye<ae&&Pu.includes(ke)&&R.has(ye)&&R.get(ye)<ae){ye=R.get(ye);continue}if(ye<ae&&ke===":"&&!ge)ce=!0;else if(ye<ae&&ke==="="&&$e===0)ce=!1,ge=!0;else if(ye<ae&&ce&&ke==="<")$e++;else if(ye<ae&&ce&&ke===">"&&$e>0)$e--;else if(ye===ae||ke===","&&$e===0)W(le,ye,H,ie==="var"),le=ye+1,ce=!1,ge=!1}}else if(ie==="function"||ie==="class"){let ae=se+1;if(k[ae]?.text==="*")ae++;if(k[ae]&&mr.test(k[ae].text)&&k[ae].text!=="extends")H.add(k[ae].text),z.push({name:k[ae].text,token:ae})}else if(ie==="import"){let ae=se+1;if(k[ae]?.text==="*"&&k[ae+1]?.text==="as")ae+=2;let le=k[ae]?.text;if(le&&mr.test(le)&&le!=="type"&&k[ae+1]?.text!=="("&&k[ae+1]?.text!==".")H.add(le),z.push({name:le,token:ae,file:!0});let ce=k[ae]?.text==="{"?ae:k[ae+1]?.text===","&&k[ae+2]?.text==="{"?ae+2:-1;if(ce!==-1&&R.has(ce)){let ge=R.get(ce);for(let[$e,ye]of B(ce+1,ge)){let ke=ye-1;while(ke>=$e&&!mr.test(k[ke].text))ke--;if(ke>=$e&&k[ke].text!=="type")z.push({name:k[ke].text,token:ke,file:!0})}}}}return Iu=v,To={code:_,scopes:q,loops:Z,declarations:H,sites:z,tokens:k,pairs:R},To}function Va(v){let _=Fa(v);return{code:_.code,shadows:(k,R)=>_.scopes.some((T)=>R>=T.start&&R<T.end&&T.names.has(k))}}function Ao(v){return new Set(Fa(v).declarations)}function Ct(v,_){let{scopes:k,loops:R,sites:T,tokens:B,pairs:z}=Fa(v),W=Array.from({length:B.length},()=>-1),F=[];for(let Z=0;Z<B.length;Z++){W[Z]=F.length?F[F.length-1]:-1;let se=B[Z].text;if(se==="{"&&z.has(Z))F.push(Z);else if(se==="}"&&F.length&&z.get(Z)===F[F.length-1])F.pop()}let V=new Set,H=new Map;for(let Z of T){if(!_.has(Z.name))continue;V.add(Z.token);let se=Z.file?-1:W[Z.token],ie=se===-1?[0,Number.POSITIVE_INFINITY]:[B[se].start,B[z.get(se)].end];if(Z.functionScoped){let ae=B[Z.token].start,le=k.filter((ce)=>ce.functionBody&&ae>=ce.bodyStart&&ae<ce.end).sort((ce,ge)=>ce.end-ce.bodyStart-(ge.end-ge.bodyStart))[0];ie=le?[le.bodyStart,le.end]:[0,Number.POSITIVE_INFINITY]}else if(!Z.file){let ae=R.filter((le)=>Z.token>le.headStart&&Z.token<le.headEnd).sort((le,ce)=>le.headEnd-le.headStart-(ce.headEnd-ce.headStart))[0];if(ae)ie=[ae.start,ae.end]}let oe=H.get(Z.name);if(oe)oe.push(ie);else H.set(Z.name,[ie])}let q=new Set;for(let Z=0;Z<B.length;Z++){if(B[Z].text!=="import"||B[Z-1]?.text===".")continue;let se=Z+1;if(B[se]?.text==="type")se++;if(B[se]&&mr.test(B[se].text)&&B[se+1]?.text===",")se+=2;if(B[se]?.text==="{"&&z.has(se))for(let ie=se+1;ie<z.get(se);ie++)q.add(ie)}let Q=new Set;for(let Z=0;Z<B.length;Z++){let se=B[Z].text;if(!_.has(se)||Q.has(se)||V.has(Z)||q.has(Z))continue;let ie=B[Z-1]?.text;if(ie==="#"||ie==="."&&B[Z-2]?.text!=="..")continue;if(B[Z+1]?.text===":"&&(ie==="{"||ie===","))continue;let oe=B[Z].start;if(H.get(se)?.some(([ae,le])=>oe>=ae&&oe<le))continue;if(k.some((ae)=>oe>=ae.start&&oe<ae.end&&ae.names.has(se)))continue;Q.add(se)}return Q}import Io from"fs";import Ut from"path";function sn(v){return v.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}var Mu=new Map;function Po(v,_=!0){let k=Mu.get(v);if(_&&k)return k;let R=new Map,T=[Ut.join(v,"src"),Ut.join(v,"dist"),v];function B(z,W){if(W>6)return;let F;try{F=Io.readdirSync(z,{withFileTypes:!0})}catch{return}for(let V of F){let H=Ut.join(z,V.name);if(V.isDirectory()){if(V.name==="node_modules"||V.name.startsWith("."))continue;B(H,W+1)}else if(V.isFile()&&V.name.endsWith(".stx")){let q=V.name.slice(0,-4);if(!R.has(q))R.set(q,H);let Q=q.toLowerCase();if(!R.has(Q))R.set(Q,H);let Z=sn(q);if(!R.has(Z))R.set(Z,H)}}}for(let z of T)if(B(z,0),R.size>0)break;if(_)Mu.set(v,R);return R}function Do(v,_){if(v.startsWith(".")||v.startsWith("/"))return null;let k=_;while(!0){let R=Ut.join(k,"node_modules",v);try{if(Io.statSync(R).isDirectory())return R}catch{}let T=Ut.dirname(k);if(T===k)return null;k=T}}function Mo(v,_,k={}){return[Ut.resolve(Ut.dirname(_),`${v}.stx`),Ut.resolve(Ut.dirname(_),v),Ut.resolve(k.componentsDir||"components",`${v}.stx`),Ut.resolve(k.componentsDir||"components",v),v.endsWith(".stx")?v:`${v}.stx`]}function Ou(v){let _=v.endsWith(".stx")?v.slice(0,-4):v,k=_.split("-").map((T)=>T.charAt(0).toUpperCase()+T.slice(1)).join(""),R=sn(_);return[_,k,R]}function Ua(v,_){let[k,R,T]=Ou(v);for(let B of[k,k.toLowerCase(),R,T]){let z=_?.__importedComponents?.get(B);if(z!==void 0)return z}}function*Ha(v,_,k={},R){let T=Ou(v);if(T[0].startsWith("./")||T[0].startsWith("../")){yield Ut.resolve(Ut.dirname(_),`${T[0]}.stx`);return}let B=[...new Set(T.map((F)=>`${F}.stx`))],z=k.projectRoot||process.cwd(),W=[...R?.__originalFilePath?[Ut.join(Ut.dirname(R.__originalFilePath),"components")]:[],...k.componentsDir?[k.componentsDir]:[],Ut.join(Ut.dirname(_),"components"),Ut.resolve(z,"src/components"),Ut.resolve(z,"components"),...import.meta.dir?[Ut.resolve(import.meta.dir,"components")]:[]];for(let F of new Set(W)){for(let V of B)yield Ut.join(F,V);try{for(let V of Io.readdirSync(F,{withFileTypes:!0}))if(V.isDirectory())for(let H of B)yield Ut.join(F,V.name,H)}catch{}}}function Nu(v,_,k={},R){let T=Ua(v,R);if(T!==void 0)return T;for(let B of Ha(v,_,k,R))try{if(Io.statSync(B,{throwIfNoEntry:!1})?.isFile())return B}catch{}return null}import bh from"fs";import rt from"path";import{createHash as jh}from"crypto";var Oo="__stx_component_client_factories";function No(v){let _=v[Oo];return _ instanceof Map?_:null}function Lu(v){v[Oo]=new Map}function qa(v,_){let k=No(v);if(!k)return null;let R=jh("sha256").update(_).digest("hex").slice(0,16),T=k.get(R);if(T)T.instances++;else k.set(R,{body:_,instances:1});return R}function Bu(v,_){let k=No(_);if(!k?.size)return v;let R=new Map;for(let[H,q]of k)if(q.instances===1)R.set(H,q.body);let T=[];if(R.size>0){let H=[...R.keys()].map((Z)=>JSON.stringify(Z).replace(/[$()*+.?[\\\]^{|}]/g,"\\$&")).join("|"),q=new RegExp(`window\\.__stxComponentFactories\\[(${H})\\]\\(("[^"]+")\\);`,"g"),Q=q.exec(v);while(Q!==null){let Z=R.get(JSON.parse(Q[1]));if(Z!==void 0)T.push({start:Q.index,end:Q.index+Q[0].length,replacement:`(${Z})(${Q[2]});`});Q=q.exec(v)}}let B=[...k].filter(([,H])=>H.instances>1);if(B.length===0)return ju(v,T);let W=`<script data-stx-scoped data-stx-run="always" data-stx-component-factories>
116
116
  (function() {
117
117
  const factories = window.__stxComponentFactories = window.__stxComponentFactories || {};
118
118
  ${B.map(([H,q])=>` try { factories[${JSON.stringify(H)}] = factories[${JSON.stringify(H)}] || ${q.body}; }
@@ -120,8 +120,8 @@ ${B.map(([H,q])=>` try { factories[${JSON.stringify(H)}] = factories[${JSON.str
120
120
  `)}
121
121
  })();
122
122
  </script>`,F=v.search(/<script\b(?=[^>]*\bdata-stx-scoped\b)/i),V=F<0?0:F;return T.push({start:V,end:V,replacement:`${W}
123
- `}),Xu(v,T)}function Xu(v,_){if(_.length===0)return v;_.sort((B,z)=>B.start-z.start||B.end-z.end);let k=Array(_.length*2+1),R=0,T=0;for(let B of _)k[T++]=v.slice(R,B.start),k[T++]=B.replacement,R=B.end;return k[T]=v.slice(R),k.join("")}function Ju(v){let _=No(v),k=new Map;if(_)for(let[R,T]of _)k.set(R,T.instances);return k}function Yu(v,_){let k=No(v);if(!k)return[];let R=[];for(let[T,B]of k){let z=B.instances-(_.get(T)??0);if(z>0)R.push({body:B.body,count:z})}return R}function Qu(v,_){for(let{body:k,count:R}of _)for(let T=0;T<R;T++)qa(v,k)}import fd from"fs";var ed=0,Ka=new Map;function ei(){ed=0,Ka.clear()}function jo(v,_){let k=ed++,R=`<!--__STX_${v.toUpperCase()}_${k}__-->`;return Ka.set(R,{type:v,expression:_}),R}function ti(){let v={};for(let[_,k]of Ka)v[_]={type:k.type,expression:k.expression};return v}function ni(v,_){let k=v;for(let[R,T]of _)k=k.split(R).join(T);return k}function as(v){return v.includes("<!--__STX_")}var Lh=/@(?=[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 Bh(v){return Array.from({length:v},()=>"&#123;").join("&#8288;")}function td(v){return v.replace(/\{{2,}/g,(_)=>Bh(_.length)).replace(/\{(?=!)/g,"&#123;&#8288;").replace(Lh,"&#64;")}function nd(v,_,k=!1){let R=v.slice(0,_),T=R.lastIndexOf("<"),B=R.lastIndexOf(">");if(T>=0&&B>T)return null;if(T<0&&!k)return null;let z=T>=0?R.slice(T+1):R;if(T>=0&&/^\s*[!/?]/.test(z))return/^\s*\/?\s*$/.test(z)?{kind:"tag-name"}:null;if(T>=0&&/^\s*$/.test(z))return{kind:"tag-name"};let W=/(?:^|\s)([^\s"'<>/=]+)\s*=\s*"([^"]*)$/.exec(z);if(W)return{kind:"attribute",name:W[1],quote:'"',valuePrefix:W[2]};let F=/(?:^|\s)([^\s"'<>/=]+)\s*=\s*'([^']*)$/.exec(z);if(F)return{kind:"attribute",name:F[1],quote:"'",valuePrefix:F[2]};let V=/(?:^|\s)([^\s"'<>/=]+)\s*=\s*([^\s"'=<>`]*)$/.exec(z);if(V)return{kind:"attribute",name:V[1],quote:null,valuePrefix:V[2]};return T>=0||/^\s*[^<>]*$/.test(z)?{kind:"tag"}:null}class Un extends Error{attribute;constructor(v,_){super(`Unsafe interpolation in ${v}: ${_}`);this.name="UnsafeInterpolationContextError",this.attribute=v}}var rd="unsafe:";var zh=/^(?:javascript|vbscript|livescript|mocha|view-source):/,Wh=/^data:(?:text\/html|text\/xml|application\/xhtml\+xml|application\/xml|image\/svg\+xml)/,Fh=/^data:(?:text\/html|application\/xhtml\+xml)/,Vh=new RegExp("[\\u0000-\\u0020\\u00A0\\u1680\\u2000-\\u200F\\u2028\\u2029\\u202F\\u205F\\u3000\\uFEFF]+","g");function Uh(v){return v.replace(Vh,"").toLowerCase()}function Xa(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 Lo(v,_="navigable"){let k=Uh(v);if(zh.test(k))return!0;return _==="navigable"?Wh.test(k):Fh.test(k)}function Ki(v,_="navigable"){return Lo(v,_)?"unsafe:"+v:v}function Hh(v){let _=v.match(/(?:^|[\s"'`/])([A-Za-z][\w:-]*)\s*=\s*(["'])([^"']*)$/);if(!_)return null;if(_[3].trim()!=="")return null;return Xa(_[1])}function sd(v,_,k=256){if(_<=k)return v.slice(0,_);let R=v.slice(_-k,_),T=R.search(/[\s"'`/]/);return T===-1?"":R.slice(T)}function id(v,_,k=_){let R=Hh(v);return R&&Lo(_,R)?"unsafe:"+k:k}var Bo=/<script\b[^>]*>/iy,Ya=/<\/script\s*>/ig,zo=/<style\b[^>]*>/iy,Qa=/<\/style\s*>/ig;function od(v,_,k,R){k.lastIndex=_;let T=k.exec(v);if(!T||T.index!==_)return-1;R.lastIndex=k.lastIndex;let B=R.exec(v);if(!B)return-1;return B.index+B[0].length}function U(v,_){return od(v,_,Bo,Ya)}function Qr(v,_){return od(v,_,zo,Qa)}function ze(v,_){if(!v.startsWith("<!--",_))return-1;let k=v.indexOf("-->",_+4);if(k===-1)return-1;return k+3}function ad(v,_){if(v.startsWith("<!--",_)){let T=ze(v,_);return T===-1?v.length:T}if(Bo.lastIndex=_,Bo.exec(v)?.index===_){Ya.lastIndex=Bo.lastIndex;let T=Ya.exec(v);return T?T.index+T[0].length:v.length}if(zo.lastIndex=_,zo.exec(v)?.index===_){Qa.lastIndex=zo.lastIndex;let T=Qa.exec(v);return T?T.index+T[0].length:v.length}return-1}function ee(v,_){let k=[],R=0,T=v.length,B=!1,z=null;while(R<T){let W=v[R];if(B){if(z){if(W===z)z=null}else if(W==='"'||W==="'")z=W;else if(W===">")B=!1;R++;continue}if(W!=="<"){let q=v.indexOf("<",R+1);if(q===-1)break;R=q;continue}let F=_(v,R);if(F>R){k.push({start:R,end:F,token:v.slice(R,F)}),R=F;continue}let V=ad(v,R);if(V>R){R=V;continue}let H=v.charCodeAt(R+1);if(H>=65&&H<=90||H>=97&&H<=122)B=!0;R++}return k}function cd(v){let _=0,k=0,R=0,T=!1,B=null;while(R<v.length){if(T){let q=v[R];if(B){if(q===B)B=null}else if(q==='"'||q==="'")B=q;else if(q===">")T=!1;R++;continue}let z=v.indexOf("<",R),W=z===-1?v.length:z;while(R<W){let q=v[R++];if(q==="{")_++;else if(q==="}")k++;if(_>=2&&k>=2)return!0}if(z===-1)break;let F=ad(v,z);if(F>z){R=F;continue}let V=v.charCodeAt(z+1),H=V===47?v.charCodeAt(z+2):V;if(H>=65&&H<=90||H>=97&&H<=122)T=!0;R=z+1}return!1}function ld(v,_){while(v.size>=_){let k=v.keys().next();if(k.done)return;v.delete(k.value)}}var qh=1024,Kh=16777216,Jr=new Map,Za=0;function Xh(v,_){Jr.set(v,_),Za+=v.length+_.output.length;for(let[k,R]of Jr){if(Za<=Kh)break;Jr.delete(k),Za-=k.length+R.output.length}}function On(v,_,k,R){let T=R!==void 0&&v.length>=qh,B=T?`${R}\x00${v}`:"";if(T){let H=Jr.get(B);if(H)return Jr.delete(B),Jr.set(B,H),{output:H.output,tokens:H.tokens.slice()}}let z=ee(v,_);if(z.length===0)return{output:v,tokens:[]};let W=z.map((H)=>H.token),F="",V=0;for(let H=0;H<z.length;H++){let q=z[H];F+=v.slice(V,q.start),F+=k(q.token,H),V=q.end}if(F+=v.slice(V),T)return Xh(B,{output:F,tokens:W}),{output:F,tokens:W.slice()};return{output:F,tokens:W}}var Zh=1024,Gh=16777216,Yr=new Map,Ga=0;function Jh(v,_){Yr.set(v,_),Ga+=v.length+_.output.length;for(let[k,R]of Yr){if(Ga<=Gh)break;Yr.delete(k),Ga-=k.length+R.output.length}}function Ja(v,_,k){return{output:_,scripts:k,restore:(R)=>R===_?v:es(R,k)}}function Sn(v){let _=v.length>=Zh;if(_){let T=Yr.get(v);if(T)return Yr.delete(v),Yr.set(v,T),Ja(v,T.output,T.scripts.slice())}let{output:k,tokens:R}=On(v,U,(T,B)=>`\x00STX_SCRIPT_${B}\x00`);if(_)return Jh(v,{output:k,scripts:R}),Ja(v,k,R.slice());return Ja(v,k,R)}function es(v,_){if(_.length===0)return v;return v.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(k,R)=>_[+R]??"")}function Et(v){let _=v.indexOf(" as ");if(_!==-1){let B=v.slice(0,_).trim(),z=v.slice(_+4).trim();return B&&z?{arrayExpr:B,itemVar:z}:null}let k=/^\s*(.+?)\s+in\s+([\s\S]+)$/.exec(v);if(!k)return null;let R=k[1].trim().replace(/^\(([\s\S]*)\)$/,"$1").trim(),T=k[2].trim();return R&&T?{arrayExpr:T,itemVar:R}:null}function Wo(v){let _=[],k=0,R="",T=0;for(let B=0;B<v.length;B++){let z=v[B];if(R){if(z==="\\")B++;else if(z===R)R="";continue}if(z==="'"||z==='"'||z==="`")R=z;else if(z==="("||z==="["||z==="{")k++;else if(z===")"||z==="]"||z==="}")k--;else if(z===","&&k===0)_.push(v.slice(T,B)),T=B+1}return _.push(v.slice(T)),_}function ud(v,_){let k=0;for(let R=0;R<v.length;R++){let T=v[R];if(T==="("||T==="["||T==="{")k++;else if(T===")"||T==="]"||T==="}")k--;else if(T===_&&k===0)return R}return-1}function dd(v){let _=0;for(let k=0;k<v.length;k++){let R=v[k];if(R==="("||R==="["||R==="{")_++;else if((R===")"||R==="]"||R==="}")&&--_===0)return k}return-1}function Dr(v,_){let k=v.trim().replace(/^\.\.\./,"").trim(),R=ud(k,"=");if(R!==-1&&k[R+1]!==">")k=k.slice(0,R).trim();if(!k)return;if(k.startsWith("{")&&k.endsWith("}")){for(let T of Wo(k.slice(1,-1))){let B=T.trim();if(!B)continue;if(B.startsWith("...")){Dr(B,_);continue}let z=ud(B,":");Dr(z===-1?B:B.slice(z+1),_)}return}if(k.startsWith("[")&&k.endsWith("]")){for(let T of Wo(k.slice(1,-1)))Dr(T,_);return}if(/^[A-Z_$][\w$]*$/i.test(k))_.push(k)}function ts(v){let _=v.trim(),k=[],R=0;for(let B=0;B<_.length;B++){let z=_[B];if(z==="("||z==="["||z==="{")R++;else if(z===")"||z==="]"||z==="}")R--;else if(R===0&&/\s/.test(z)){if(!/^\s+(?:in|of)\s/.exec(_.slice(B)))continue;let F=_.slice(0,B).trim();if(F.startsWith("(")&&dd(F)===F.length-1)F=F.slice(1,-1);for(let V of Wo(F))Dr(V,k);if(k.length>0)return k;break}}let T=/^[\s\S]+?\s+as\s+([\s\S]+)$/.exec(_);if(T){let B=T[1].trim();if(B.startsWith("(")&&dd(B)===B.length-1)B=B.slice(1,-1);let z=/^([\w$]+)\s*=>\s*([\s\S]+)$/.exec(B);if(z)Dr(z[2],k),Dr(z[1],k);else for(let W of Wo(B))Dr(W,k)}return k}function Mr(v,_){let k=_ instanceof Set?_:new Set(_);if(k.size===0)return!1;let z=v.replace(/'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"/g," ").replace(/`(?:[^`\\$]|\\.|\$(?!\{))*`/g," ").replace(/\??\.\s*[a-zA-Z_$][\w$]*/g," ").replace(/([{,]\s*)[a-zA-Z_$][\w$]*(\s*:(?!:))/g,"$1$2");for(let W of z.match(/[a-zA-Z_$][\w$]*/g)||[])if(k.has(W))return!0;return!1}var Fo="__stx_client_loop_names";function yr(v){let _=v?.[Fo];return Array.isArray(_)?_:[]}var Zi={},pd=new Map;function Yh(v){let _=pd.get(v);if(!_){let k=v.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");_=new RegExp(`:${k}(?!\\w)`,"g"),pd.set(v,_)}return _.lastIndex=0,_}var qn={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 R=Number(v);return Number.isNaN(R)?"":R.toFixed(Number.parseInt(String(k),10))}catch{return""}},fmt:(v,_,k="en-US")=>{if(v===void 0||v===null)return"";try{let R=Number(v);if(Number.isNaN(R))return String(v);return R.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 Tt(String(v))},translate:(v,_,k={})=>{if(!_||!_.__translations)return v;let R=_.__translations,T=_.__i18nConfig?.fallbackToKey??!0,B=String(v).split("."),z=R;for(let F of B){if(z===void 0||z===null)break;z=z[F]}if(z===void 0||z===null)return T?v:"";let W=String(z);return Object.entries(k).forEach(([F,V])=>{W=W.replace(Yh(F),String(V))}),W},t:(v,_,k={})=>qn.translate(v,_,k),truncate:(v,_,k=50,R="...")=>{if(v===void 0||v===null)return"";let T=String(v);if(T.length<=k)return T;if(k<=R.length)return R.substring(0,k);return T.substring(0,k-R.length)+R},date:(v,_,k="short",R="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 B={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(R,B[k]||B.short).format(T)}catch{return String(v)}},currency:(v,_,k="USD",R="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(R,{style:"currency",currency:k}).format(T)}catch{return String(v)}},pluralize:(v,_,k,R)=>{let T=Number(v);if(Number.isNaN(T))return k;let B=R||`${k}s`;return T===1?k:B},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,R)=>{if(v===void 0||v===null)return"";if(Array.isArray(v)||typeof v==="string")return v.slice(k,R);return v},replace:(v,_,k,R="")=>{if(v===void 0||v===null)return"";let T=k.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return String(v).replace(new RegExp(T,"g"),()=>R)},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 R=Number(v);if(Number.isNaN(R))return 0;let T=10**k;return Math.round(R*T)/T}};function dc(v,_){if(v in qn)console.warn(`Filter "${v}" already exists as a built-in filter. Custom filter will take precedence.`);Zi[v]=_}function zd(v){for(let[_,k]of Object.entries(v))dc(_,k)}function uc(){return{...qn,...Zi}}function Hd(){for(let v of Object.keys(Zi))delete Zi[v]}function pc(v,_,k=2){let R=0,T=null;for(let B=_+k;B<v.length;B++){let z=v[B];if(T){if(z==="\\"){B++;continue}if(z===T)T=null;continue}if(z==='"'||z==="'"||z==="`"){T=z;continue}if(z==="{"){R++;continue}if(z==="}"){if(R>0){R--;continue}let W=0;while(v[B+W]==="}")W++;if(W>=k)return B}}return-1}function Gn(v,_,k=2){let R="{".repeat(k);if(!v.includes(R))return v;let T="",B=0;for(;;){let z=v.indexOf(R,B);if(z===-1)break;let W=pc(v,z,k);if(W===-1)break;T+=v.slice(B,z)+_(v.slice(z,W+k),v.slice(z+k,W),z),B=W+k}return B===0?v:T+v.slice(B)}function b(v){return v.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function Tt(v){return td(b(v))}function Qh(v){return v.replace(/ /g,"&#32;").replace(/\t/g,"&#9;").replace(/\n/g,"&#10;").replace(/\r/g,"&#13;").replace(/\f/g,"&#12;").replace(/=/g,"&#61;").replace(/`/g,"&#96;")}function ey(v){return v.replace(/\/\*[\s\S]*?\*\//g,"").replace(/\\([\dA-Fa-f]{1,6})\s?/g,(_,k)=>String.fromCodePoint(Number.parseInt(k,16))).replace(/\\([^\r\n])/g,"$1").replace(/[\u0000-\u0020]+/g,"").toLowerCase()}function ty(v,_){let k=ey(v);if(/@import|expression\(|behavior:|-moz-binding|(?:image-set|cross-fade)\(/.test(k))throw new Un(_,"network-capable or executable CSS is not allowed in an escaped interpolation");let R=/url\(([^)]*)\)/g,T;while((T=R.exec(k))!==null){let B=T[1].replace(/^["']|["']$/g,""),z=B.startsWith("/")&&!B.startsWith("//")||B.startsWith("./")||B.startsWith("../")||B.startsWith("#"),W=/^data:image\/(?:avif|bmp|gif|jpeg|jpg|png|webp);base64,[a-z\d+/=]+$/i.test(B);if(!z&&!W)throw new Un(_,"CSS URLs must be local paths or base64 raster images")}}function xd(v,_,k,R=!1,T=0){let B=nd(v,_,R),z=Tt(k);if(!B)return z;if(B.kind==="tag-name"){if(!/^[A-Za-z][A-Za-z0-9:-]*$/.test(k))throw new Un("tag name","dynamic tag names may contain only letters, digits, colons, and hyphens");return k}if(B.kind==="tag"){let V=v.slice(_+T).trimStart(),H=k.trim();if(!V.startsWith("=")&&(H===""||/^(?!on)[A-Za-z_:][\w:.-]*(?:\s+(?!on)[A-Za-z_:][\w:.-]*)*$/.test(H)))return H;throw new Un("tag structure","only standalone boolean attributes may be interpolated into tag structure")}let W=B.name.toLowerCase();if(/^on[a-z]/.test(W))throw new Un(B.name,"native event-handler attributes execute JavaScript; use an @event binding instead");if(W==="srcdoc")z=Tt(z);if(W==="style")ty(k,B.name);if(B.quote===null)z=Qh(z);let F=Xa(W);if(F&&B.valuePrefix.trim()===""&&Lo(k,F))return rd+z;return id(sd(v,_),k,z)}function ve(v,_){let{scripts:k}=Sn(v);for(let R of k){let T=R.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i);if(!T||/\bserver\b|\bsrc\s*=/.test(T[1]))continue;let B=T[2];if(/\b(state|derived|effect|ref|reactive|computed|watch|watchEffect|useModel)\s*(?:<[^>]*>)?\s*\(/.test(B))return!0;if($n(B,_))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 fc(v){let _=[],k=/<([a-zA-Z][\w-]*)\b[^>]*?\s(?::for|x-for|@for)\s*=\s*(["'])([\s\S]*?)\2[^>]*>/g;for(let R=k.exec(v);R;R=k.exec(v)){let T=R[1].toLowerCase(),B=new Set(ts(R[3]));if(B.size===0)continue;let z=R.index+R[0].length;if(R[0].endsWith("/>")){_.push({start:R.index,end:z,names:B});continue}let W=new RegExp(`<(/?)${T}\\b[^>]*?(/?)>`,"gi");W.lastIndex=z;let F=1,V=v.length;for(let H=W.exec(v);H;H=W.exec(v)){if(H[2]==="/")continue;if(F+=H[1]==="/"?-1:1,F===0){V=H.index+H[0].length;break}}_.push({start:R.index,end:V,names:B})}return _}function ny(v,_,k){let R=s(k);for(let T of v){if(_<T.start||_>=T.end)continue;for(let B of T.names)if(new RegExp(`(?<![.#\\w$])${B.replace(/\$/g,"\\$")}(?![\\w$])`).test(R))return!0}return!1}function gd(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"],R=v.replace(/'[^']*'/g,"").replace(/"[^"]*"/g,""),T="",B=!1,z=0;for(let V=0;V<R.length;V++){let H=R[V];if(!B&&H==="`"){B=!0,z=0;continue}if(B){if(H==="`"&&z===0){B=!1;continue}if(H==="$"&&R[V+1]==="{"){z++,V++,T+=" ";continue}if(H==="}"&&z>0){z--;continue}if(z>0){T+=H;continue}continue}T+=H}R=T;let W=/(?<![a-zA-Z0-9_$])([a-zA-Z_$][a-zA-Z0-9_$]*)/g,F;while((F=W.exec(R))!==null){let V=F[1];if(!R.substring(0,F.index).trimEnd().endsWith(".")){if(!k.includes(V)&&!(V in _))return!1}}return!0}function ry(v,_){let k=_.__stx_serverDeclared;if(!k||k.size===0)return!1;let R=s(v);for(let T of k)if(new RegExp(`(?<![.#\\w$])${T}(?![\\w$])`).test(R))return!0;return!1}var md=new Set;function hd(v){return/^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*)*$/.test(v.trim())}function yd(v,_){let k=`${_??"<unknown>"}\x00${v}`;if(process.env.STX_DEBUG||!md.has(k))md.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 cs(v,_,k){let R=v;return R=R.replace(/\{!!([\s\S]*?)!!\}/g,(T,B)=>{try{let z=x(B,_);if(z===void 0)return hd(B)?yd(B.trim(),k):T;return z===null?"":String(z)}catch{return T}}),R=Gn(R,(T,B,z)=>{let W=B.trim();if(/^__[A-Z_]+__$/.test(W))return T;try{let F=x(B,_);if(F===void 0)return hd(W)?yd(W,k):T;return JSON.stringify(F).replace(/</g,"\\u003c")}catch{return T}}),R}function gc(v,_){if(!v.includes("{"))return v;let k=v;return k=k.replace(/\{!!([\s\S]*?)!!\}/g,(R,T)=>{try{let B=x(T,_);if(B===void 0)return R;return B===null?"":String(B)}catch{return R}}),k=Gn(k,(R,T,B)=>{let z=T.trim();if(/^__[A-Z_]+__$/.test(z))return R;try{let W=x(T,_);if(W===void 0)return R;if(W===null)return"";let F=String(W);return xd(k,B,F,!0,R.length)}catch(W){if(W instanceof Un)throw W;return R}}),k}function Ud(v,_,k={}){let{output:R,scripts:T}=Sn(v),B=T.map((z)=>{let W=z.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i),F=z.match(/^<script\b[^>]*>/i),V=z.search(/<\/script\s*>$/i);if(!W||!F||V===-1)return z;let H=W[1],q=W[2];if(/\bdata-raw\b/.test(H))return z;if(k.skipServer&&/\bserver\b/.test(H))return z;let Z=`<script${gc(H,_)}>`;if(/\bsrc\s*=/.test(H)||/\btype\s*=\s*["']application\/json["']/.test(H))return Z+q+z.slice(V);return Z+cs(q,_)+z.slice(V)});return es(R,B)}function X(v,_,k){let R=v,T=(Z,se)=>{let ie=Qr(Z,se);if(ie===-1)return-1;return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(Z.slice(se,ie))?-1:ie},B=(Z,se,ie,oe)=>{let ae=ie.length,{output:le,tokens:ce}=On(Z,se,(ge,$e)=>oe(ae+$e));return ie.push(...ce),le},z=[];R=B(R,T,z,(Z)=>`<!--__STX_STYLE_${Z}__-->`);let W=[];R=B(R,U,W,(Z)=>`<!--__STX_SCRIPT_EXPR_${Z}__-->`);let F=_?.__stx_signals_gate===!0||ve(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:[]);R=Gn(R,(Z,se,ie)=>{try{let oe=x(se,_,!1,(ae)=>ec(ae,Z,k,v));return oe!==void 0&&oe!==null?String(oe):""}catch(oe){let ae=oe instanceof Error?oe.message:String(oe);return g("Expression",`Error evaluating: {{{ ${se.trim()}}}}: ${ae}`,k,v,ie,Z)}},3),R=R.replace(/\{!!([\s\S]*?)!!\}/g,(Z,se,ie)=>{try{let oe=x(se,_,!1,(ae)=>ec(ae,Z,k,v));if(oe===void 0&&_.__stx_buildMode==="compile")return jo("raw",se.trim());return oe!==void 0&&oe!==null?String(oe):""}catch(oe){if(_.__stx_buildMode==="compile")return jo("raw",se.trim());let ae=oe instanceof Error?oe.message:String(oe);return g("Expression",`Error evaluating: {!! ${se.trim()} !!}: ${ae}`,k,v,ie,Z)}}),R=B(R,U,W,(Z)=>`<!--__STX_SCRIPT_EXPR_${Z}__-->`),R=B(R,T,z,(Z)=>`<!--__STX_STYLE_${Z}__-->`);let q=F?fc(R):[],Q=new Set(yr(_));if(R=Gn(R,(Z,se,ie)=>{let oe=se.trim();if(Mr(oe,Q))return Z;if(q.length>0&&ny(q,ie,oe))return Z;if(H.has(oe))return Z;let ae=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined"],le=/^([a-zA-Z_$][a-zA-Z0-9_$]*)/,ge=oe.match(le)?.[1],$e=ge&&((ge in _)||ae.includes(ge)),ye=Boolean(ge&&V.has(ge)),ke=/^([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/,Re=oe.match(ke),Ae=Re&&!ae.includes(Re[1])&&!(Re[1]in _);if(/^__[A-Z_]+__$/.test(oe))return"";let Ie;try{let Pe=x(se,_,!1,(Me)=>{Ie=Me});if(ye)return Z;if(F&&!gd(oe,_))return Z;if(Ie)ec(Ie,Z,k,v);if(_.__stx_buildMode==="compile"&&!F&&(Pe===void 0||ry(oe,_)))return jo("expr",oe);if(Pe===void 0||Pe===null)return"";let Ee=String(Pe);return xd(R,ie,Ee,!1,Z.length)}catch(Pe){if(Pe instanceof Un)throw Pe;if(ye)return Z;if(F&&!gd(oe,_))return Z;if(Ae)return Z;let Ee=Pe instanceof Error?Pe.message:String(Pe);return g("Expression",`Error evaluating: {{ ${oe} }}: ${Ee}`,k,v,ie,Z)}}),W.length>0)R=R.replace(/<!--__STX_SCRIPT_EXPR_(\d+)__-->/g,(Z,se)=>W[Number(se)]??Z);if(z.length>0)R=R.replace(/<!--__STX_STYLE_(\d+)__-->/g,(Z,se)=>z[Number(se)]??Z);return R}function mc(v,_,k){if(!_.trim())return v;let R=v,T=_.trim();while(T.length>0){let B=T.match(/^(\w+)/);if(!B)break;let z=B[1];T=T.substring(z.length).trim();let W=Zi[z]||qn[z];if(!W)throw Error(`Filter not found: ${z}. Available filters: ${Object.keys(uc()).join(", ")}`);let F=[];if(T.startsWith(":")){let V=T.match(/^:([^|\s]+)/);if(V){let H=V[1].trim();try{let q=Number(H);F=[Number.isNaN(q)?H:q]}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 q=T.substring(1,H-1).trim();if(q)try{if(q.startsWith("{")&&q.endsWith("}"))F=[x(`(${q})`,k,!0)];else{let Q=[],Z="",se=null,ie=0,oe=0,ae=0,le=!1;for(let ce=0;ce<q.length;ce++){let ge=q[ce];if(le){Z+=ge,le=!1;continue}if(ge==="\\"){Z+=ge,le=!0;continue}if(se){if(Z+=ge,ge===se)se=null;continue}if(ge==='"'||ge==="'"||ge==="`"){se=ge,Z+=ge;continue}if(ge==="(")ie++;else if(ge===")")ie--;else if(ge==="[")oe++;else if(ge==="]")oe--;else if(ge==="{")ae++;else if(ge==="}")ae--;if(ge===","&&ie===0&&oe===0&&ae===0){Q.push(Z),Z="";continue}Z+=ge}if(Z)Q.push(Z);F=Q.map((ce)=>{let ge=ce.trim();return x(ge,k,!0)})}}catch{F=[q]}T=T.substring(H).trim()}}try{R=W(R,k,...F)}catch(V){let H=V instanceof Error?V.message:String(V);throw Error(`Error applying filter '${z}': ${H}`)}if(T.startsWith("|"))T=T.substring(1).trim();else break}return R}function sy(v){let _=!1,k="",R=0,T=0,B=0,z=!1;for(let W=0;W<v.length;W++){let F=v[W],V=v[W+1];if(_&&z){z=!1;continue}if(_&&F==="\\"){z=!0;continue}if(z=!1,(F==='"'||F==="'"||F==="`")&&!z){if(!_)_=!0,k=F;else if(F===k)_=!1,k="";continue}if(_&&k==="`"&&F==="$"&&V==="{"){let H=1;W+=2;while(W<v.length&&H>0){if(v[W]==="{")H++;else if(v[W]==="}")H--;if(H>0)W++}continue}if(_)continue;if(F==="(")R++;else if(F===")")R--;else if(F==="[")T++;else if(F==="]")T--;else if(F==="{")B++;else if(F==="}")B--;if(F==="|"&&R===0&&T===0&&B===0){if(V==="|"){W++;continue}if(V==="="){W++;continue}return W}}return-1}var Xi=new Set,iy=1000;function Vd(){Xi.clear()}function ec(v,_,k,R){if(!M())return;let T=`${k}\x00${v.expression}`;if(Xi.has(T))return;if(Xi.size>=iy)Xi.clear();Xi.add(T);let B=k,z=R;try{if(k&&fd.existsSync(k))z=fd.readFileSync(k,"utf8")}catch{}let W=z.indexOf(_);if(W>=0)B=`${k}:${z.slice(0,W).split(`
124
- `).length}`;console.warn(`${B}: 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,R){try{let T=v.trim(),B=sy(T);if(B>0){let W=T.substring(0,B).trim(),F=T.substring(B+1).trim(),V=x(W,_,!0,R);return mc(V,F,_)}let z=_n(T);if(z!==null){R?.({expression:T,rule:z});return}try{let W=Object.keys(_),F=Object.values(_);return c(T,W)(...F)}catch{return l(T,_)}}catch(T){if(T instanceof ReferenceError){let B=/(\b\w+)\s+is not defined/.exec(T.message);if(B){let z=B[1],W=oy(z,Object.keys(_));if(W&&W!==z)T.message=`${T.message} \u2014 did you mean '${W}'?`}}if(!k)console.error(`Error evaluating expression: ${v}`,T);throw T}}function oy(v,_){let k=null;for(let T of _){if(T===v)continue;let B=ay(v,T);if(k===null||B<k.dist)k={key:T,dist:B}}if(!k)return null;let R=Math.max(v.length,k.key.length);if(k.dist<=2||k.dist/R<=0.35)return k.key;return null}function ay(v,_){if(v===_)return 0;if(v.length===0)return _.length;if(_.length===0)return v.length;let[k,R]=v.length<_.length?[v,_]:[_,v],T=Array(k.length+1),B=Array(k.length+1);for(let z=0;z<=k.length;z++)T[z]=z;for(let z=1;z<=R.length;z++){B[0]=z;for(let W=1;W<=k.length;W++){let F=k[W-1]===R[z-1]?0:1;B[W]=Math.min(B[W-1]+1,T[W]+1,T[W-1]+F)}for(let W=0;W<=k.length;W++)T[W]=B[W]}return T[k.length]}function Wd(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 wd from"fs";class N{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 R=this.cache.keys().next().value;if(R===void 0)break;this.delete(R)}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 ns=new Map,cy=500;function Or(v,_){if(_?.includes("g"))return new RegExp(v,_);let k=`${v}:${_||""}`;if(!ns.has(k)){if(ns.size>=cy){let R=ns.keys().next().value;if(R)ns.delete(R)}ns.set(k,new RegExp(v,_))}return ns.get(k)}class bd{pool=[];maxPoolSize=10;fnCache=new Map;fnCacheMaxSize=200;getEvaluator(v){let _=Array.from(new Set(v)),k=_.sort().join(","),R=this.pool.find((W)=>W.context.join(",")===k);if(R)return R.func;let T=this.fnCache,B=this.fnCacheMaxSize,z=(...W)=>(F)=>{try{let V=`${k}:${F}`,H=T.get(V);if(!H){if(T.size>=B){let q=T.keys().next().value;if(q)T.delete(q)}H=Function(..._,`
123
+ `}),ju(v,T)}function ju(v,_){if(_.length===0)return v;_.sort((B,z)=>B.start-z.start||B.end-z.end);let k=Array(_.length*2+1),R=0,T=0;for(let B of _)k[T++]=v.slice(R,B.start),k[T++]=B.replacement,R=B.end;return k[T]=v.slice(R),k.join("")}function dd(v){let _=No(v),k=new Map;if(_)for(let[R,T]of _)k.set(R,T.instances);return k}function fd(v,_){let k=No(v);if(!k)return[];let R=[];for(let[T,B]of k){let z=B.instances-(_.get(T)??0);if(z>0)R.push({body:B.body,count:z})}return R}function pd(v,_){for(let{body:k,count:R}of _)for(let T=0;T<R;T++)qa(v,k)}import Ed from"fs";var gd=0,Ka=new Map;function ei(){gd=0,Ka.clear()}function jo(v,_){let k=gd++,R=`<!--__STX_${v.toUpperCase()}_${k}__-->`;return Ka.set(R,{type:v,expression:_}),R}function ti(){let v={};for(let[_,k]of Ka)v[_]={type:k.type,expression:k.expression};return v}function ni(v,_){let k=v;for(let[R,T]of _)k=k.split(R).join(T);return k}function as(v){return v.includes("<!--__STX_")}var Lh=/@(?=[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 Bh(v){return Array.from({length:v},()=>"&#123;").join("&#8288;")}function md(v){return v.replace(/\{{2,}/g,(_)=>Bh(_.length)).replace(/\{(?=!)/g,"&#123;&#8288;").replace(Lh,"&#64;")}function hd(v,_,k=!1){let R=v.slice(0,_),T=R.lastIndexOf("<"),B=R.lastIndexOf(">");if(T>=0&&B>T)return null;if(T<0&&!k)return null;let z=T>=0?R.slice(T+1):R;if(T>=0&&/^\s*[!/?]/.test(z))return/^\s*\/?\s*$/.test(z)?{kind:"tag-name"}:null;if(T>=0&&/^\s*$/.test(z))return{kind:"tag-name"};let W=/(?:^|\s)([^\s"'<>/=]+)\s*=\s*"([^"]*)$/.exec(z);if(W)return{kind:"attribute",name:W[1],quote:'"',valuePrefix:W[2]};let F=/(?:^|\s)([^\s"'<>/=]+)\s*=\s*'([^']*)$/.exec(z);if(F)return{kind:"attribute",name:F[1],quote:"'",valuePrefix:F[2]};let V=/(?:^|\s)([^\s"'<>/=]+)\s*=\s*([^\s"'=<>`]*)$/.exec(z);if(V)return{kind:"attribute",name:V[1],quote:null,valuePrefix:V[2]};return T>=0||/^\s*[^<>]*$/.test(z)?{kind:"tag"}:null}class Vn extends Error{attribute;constructor(v,_){super(`Unsafe interpolation in ${v}: ${_}`);this.name="UnsafeInterpolationContextError",this.attribute=v}}var yd="unsafe:";var zh=/^(?:javascript|vbscript|livescript|mocha|view-source):/,Wh=/^data:(?:text\/html|text\/xml|application\/xhtml\+xml|application\/xml|image\/svg\+xml)/,Fh=/^data:(?:text\/html|application\/xhtml\+xml)/,Vh=new RegExp("[\\u0000-\\u0020\\u00A0\\u1680\\u2000-\\u200F\\u2028\\u2029\\u202F\\u205F\\u3000\\uFEFF]+","g");function Uh(v){return v.replace(Vh,"").toLowerCase()}function Xa(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 Lo(v,_="navigable"){let k=Uh(v);if(zh.test(k))return!0;return _==="navigable"?Wh.test(k):Fh.test(k)}function Ki(v,_="navigable"){return Lo(v,_)?"unsafe:"+v:v}function Hh(v){let _=v.match(/(?:^|[\s"'`/])([A-Za-z][\w:-]*)\s*=\s*(["'])([^"']*)$/);if(!_)return null;if(_[3].trim()!=="")return null;return Xa(_[1])}function xd(v,_,k=256){if(_<=k)return v.slice(0,_);let R=v.slice(_-k,_),T=R.search(/[\s"'`/]/);return T===-1?"":R.slice(T)}function bd(v,_,k=_){let R=Hh(v);return R&&Lo(_,R)?"unsafe:"+k:k}var Bo=/<script\b[^>]*>/iy,Ya=/<\/script\s*>/ig,zo=/<style\b[^>]*>/iy,Qa=/<\/style\s*>/ig;function vd(v,_,k,R){k.lastIndex=_;let T=k.exec(v);if(!T||T.index!==_)return-1;R.lastIndex=k.lastIndex;let B=R.exec(v);if(!B)return-1;return B.index+B[0].length}function U(v,_){return vd(v,_,Bo,Ya)}function Qr(v,_){return vd(v,_,zo,Qa)}function ze(v,_){if(!v.startsWith("<!--",_))return-1;let k=v.indexOf("-->",_+4);if(k===-1)return-1;return k+3}function wd(v,_){if(v.startsWith("<!--",_)){let T=ze(v,_);return T===-1?v.length:T}if(Bo.lastIndex=_,Bo.exec(v)?.index===_){Ya.lastIndex=Bo.lastIndex;let T=Ya.exec(v);return T?T.index+T[0].length:v.length}if(zo.lastIndex=_,zo.exec(v)?.index===_){Qa.lastIndex=zo.lastIndex;let T=Qa.exec(v);return T?T.index+T[0].length:v.length}return-1}function ee(v,_){let k=[],R=0,T=v.length,B=!1,z=null;while(R<T){let W=v[R];if(B){if(z){if(W===z)z=null}else if(W==='"'||W==="'")z=W;else if(W===">")B=!1;R++;continue}if(W!=="<"){let q=v.indexOf("<",R+1);if(q===-1)break;R=q;continue}let F=_(v,R);if(F>R){k.push({start:R,end:F,token:v.slice(R,F)}),R=F;continue}let V=wd(v,R);if(V>R){R=V;continue}let H=v.charCodeAt(R+1);if(H>=65&&H<=90||H>=97&&H<=122)B=!0;R++}return k}function Sd(v){let _=0,k=0,R=0,T=!1,B=null;while(R<v.length){if(T){let q=v[R];if(B){if(q===B)B=null}else if(q==='"'||q==="'")B=q;else if(q===">")T=!1;R++;continue}let z=v.indexOf("<",R),W=z===-1?v.length:z;while(R<W){let q=v[R++];if(q==="{")_++;else if(q==="}")k++;if(_>=2&&k>=2)return!0}if(z===-1)break;let F=wd(v,z);if(F>z){R=F;continue}let V=v.charCodeAt(z+1),H=V===47?v.charCodeAt(z+2):V;if(H>=65&&H<=90||H>=97&&H<=122)T=!0;R=z+1}return!1}function $d(v,_){while(v.size>=_){let k=v.keys().next();if(k.done)return;v.delete(k.value)}}var qh=1024,Kh=16777216,Jr=new Map,Za=0;function Xh(v,_){Jr.set(v,_),Za+=v.length+_.output.length;for(let[k,R]of Jr){if(Za<=Kh)break;Jr.delete(k),Za-=k.length+R.output.length}}function On(v,_,k,R){let T=R!==void 0&&v.length>=qh,B=T?`${R}\x00${v}`:"";if(T){let H=Jr.get(B);if(H)return Jr.delete(B),Jr.set(B,H),{output:H.output,tokens:H.tokens.slice()}}let z=ee(v,_);if(z.length===0)return{output:v,tokens:[]};let W=z.map((H)=>H.token),F="",V=0;for(let H=0;H<z.length;H++){let q=z[H];F+=v.slice(V,q.start),F+=k(q.token,H),V=q.end}if(F+=v.slice(V),T)return Xh(B,{output:F,tokens:W}),{output:F,tokens:W.slice()};return{output:F,tokens:W}}var Zh=1024,Gh=16777216,Yr=new Map,Ga=0;function Jh(v,_){Yr.set(v,_),Ga+=v.length+_.output.length;for(let[k,R]of Yr){if(Ga<=Gh)break;Yr.delete(k),Ga-=k.length+R.output.length}}function Ja(v,_,k){return{output:_,scripts:k,restore:(R)=>R===_?v:es(R,k)}}function Sn(v){let _=v.length>=Zh;if(_){let T=Yr.get(v);if(T)return Yr.delete(v),Yr.set(v,T),Ja(v,T.output,T.scripts.slice())}let{output:k,tokens:R}=On(v,U,(T,B)=>`\x00STX_SCRIPT_${B}\x00`);if(_)return Jh(v,{output:k,scripts:R}),Ja(v,k,R.slice());return Ja(v,k,R)}function es(v,_){if(_.length===0)return v;return v.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(k,R)=>_[+R]??"")}function Et(v){let _=v.indexOf(" as ");if(_!==-1){let B=v.slice(0,_).trim(),z=v.slice(_+4).trim();return B&&z?{arrayExpr:B,itemVar:z}:null}let k=/^\s*(.+?)\s+in\s+([\s\S]+)$/.exec(v);if(!k)return null;let R=k[1].trim().replace(/^\(([\s\S]*)\)$/,"$1").trim(),T=k[2].trim();return R&&T?{arrayExpr:T,itemVar:R}:null}function Wo(v){let _=[],k=0,R="",T=0;for(let B=0;B<v.length;B++){let z=v[B];if(R){if(z==="\\")B++;else if(z===R)R="";continue}if(z==="'"||z==='"'||z==="`")R=z;else if(z==="("||z==="["||z==="{")k++;else if(z===")"||z==="]"||z==="}")k--;else if(z===","&&k===0)_.push(v.slice(T,B)),T=B+1}return _.push(v.slice(T)),_}function _d(v,_){let k=0;for(let R=0;R<v.length;R++){let T=v[R];if(T==="("||T==="["||T==="{")k++;else if(T===")"||T==="]"||T==="}")k--;else if(T===_&&k===0)return R}return-1}function kd(v){let _=0;for(let k=0;k<v.length;k++){let R=v[k];if(R==="("||R==="["||R==="{")_++;else if((R===")"||R==="]"||R==="}")&&--_===0)return k}return-1}function Dr(v,_){let k=v.trim().replace(/^\.\.\./,"").trim(),R=_d(k,"=");if(R!==-1&&k[R+1]!==">")k=k.slice(0,R).trim();if(!k)return;if(k.startsWith("{")&&k.endsWith("}")){for(let T of Wo(k.slice(1,-1))){let B=T.trim();if(!B)continue;if(B.startsWith("...")){Dr(B,_);continue}let z=_d(B,":");Dr(z===-1?B:B.slice(z+1),_)}return}if(k.startsWith("[")&&k.endsWith("]")){for(let T of Wo(k.slice(1,-1)))Dr(T,_);return}if(/^[A-Z_$][\w$]*$/i.test(k))_.push(k)}function ts(v){let _=v.trim(),k=[],R=0;for(let B=0;B<_.length;B++){let z=_[B];if(z==="("||z==="["||z==="{")R++;else if(z===")"||z==="]"||z==="}")R--;else if(R===0&&/\s/.test(z)){if(!/^\s+(?:in|of)\s/.exec(_.slice(B)))continue;let F=_.slice(0,B).trim();if(F.startsWith("(")&&kd(F)===F.length-1)F=F.slice(1,-1);for(let V of Wo(F))Dr(V,k);if(k.length>0)return k;break}}let T=/^[\s\S]+?\s+as\s+([\s\S]+)$/.exec(_);if(T){let B=T[1].trim();if(B.startsWith("(")&&kd(B)===B.length-1)B=B.slice(1,-1);let z=/^([\w$]+)\s*=>\s*([\s\S]+)$/.exec(B);if(z)Dr(z[2],k),Dr(z[1],k);else for(let W of Wo(B))Dr(W,k)}return k}function Mr(v,_){let k=_ instanceof Set?_:new Set(_);if(k.size===0)return!1;let z=v.replace(/'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"/g," ").replace(/`(?:[^`\\$]|\\.|\$(?!\{))*`/g," ").replace(/\??\.\s*[a-zA-Z_$][\w$]*/g," ").replace(/([{,]\s*)[a-zA-Z_$][\w$]*(\s*:(?!:))/g,"$1$2");for(let W of z.match(/[a-zA-Z_$][\w$]*/g)||[])if(k.has(W))return!0;return!1}var Fo="__stx_client_loop_names";function yr(v){let _=v?.[Fo];return Array.isArray(_)?_:[]}var Zi={},Cd=new Map;function Yh(v){let _=Cd.get(v);if(!_){let k=v.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");_=new RegExp(`:${k}(?!\\w)`,"g"),Cd.set(v,_)}return _.lastIndex=0,_}var Gn={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 R=Number(v);return Number.isNaN(R)?"":R.toFixed(Number.parseInt(String(k),10))}catch{return""}},fmt:(v,_,k="en-US")=>{if(v===void 0||v===null)return"";try{let R=Number(v);if(Number.isNaN(R))return String(v);return R.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 Tt(String(v))},translate:(v,_,k={})=>{if(!_||!_.__translations)return v;let R=_.__translations,T=_.__i18nConfig?.fallbackToKey??!0,B=String(v).split("."),z=R;for(let F of B){if(z===void 0||z===null)break;z=z[F]}if(z===void 0||z===null)return T?v:"";let W=String(z);return Object.entries(k).forEach(([F,V])=>{W=W.replace(Yh(F),String(V))}),W},t:(v,_,k={})=>Gn.translate(v,_,k),truncate:(v,_,k=50,R="...")=>{if(v===void 0||v===null)return"";let T=String(v);if(T.length<=k)return T;if(k<=R.length)return R.substring(0,k);return T.substring(0,k-R.length)+R},date:(v,_,k="short",R="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 B={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(R,B[k]||B.short).format(T)}catch{return String(v)}},currency:(v,_,k="USD",R="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(R,{style:"currency",currency:k}).format(T)}catch{return String(v)}},pluralize:(v,_,k,R)=>{let T=Number(v);if(Number.isNaN(T))return k;let B=R||`${k}s`;return T===1?k:B},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,R)=>{if(v===void 0||v===null)return"";if(Array.isArray(v)||typeof v==="string")return v.slice(k,R);return v},replace:(v,_,k,R="")=>{if(v===void 0||v===null)return"";let T=k.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return String(v).replace(new RegExp(T,"g"),()=>R)},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 R=Number(v);if(Number.isNaN(R))return 0;let T=10**k;return Math.round(R*T)/T}};function uc(v,_){if(v in Gn)console.warn(`Filter "${v}" already exists as a built-in filter. Custom filter will take precedence.`);Zi[v]=_}function zu(v){for(let[_,k]of Object.entries(v))uc(_,k)}function dc(){return{...Gn,...Zi}}function Hu(){for(let v of Object.keys(Zi))delete Zi[v]}function pc(v,_,k=2){let R=0,T=null;for(let B=_+k;B<v.length;B++){let z=v[B];if(T){if(z==="\\"){B++;continue}if(z===T)T=null;continue}if(z==='"'||z==="'"||z==="`"){T=z;continue}if(z==="{"){R++;continue}if(z==="}"){if(R>0){R--;continue}let W=0;while(v[B+W]==="}")W++;if(W>=k)return B}}return-1}function Kn(v,_,k=2){let R="{".repeat(k);if(!v.includes(R))return v;let T="",B=0;for(;;){let z=v.indexOf(R,B);if(z===-1)break;let W=pc(v,z,k);if(W===-1)break;T+=v.slice(B,z)+_(v.slice(z,W+k),v.slice(z+k,W),z),B=W+k}return B===0?v:T+v.slice(B)}function b(v){return v.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function Tt(v){return md(b(v))}function Qh(v){return v.replace(/ /g,"&#32;").replace(/\t/g,"&#9;").replace(/\n/g,"&#10;").replace(/\r/g,"&#13;").replace(/\f/g,"&#12;").replace(/=/g,"&#61;").replace(/`/g,"&#96;")}function ey(v){return v.replace(/\/\*[\s\S]*?\*\//g,"").replace(/\\([\dA-Fa-f]{1,6})\s?/g,(_,k)=>String.fromCodePoint(Number.parseInt(k,16))).replace(/\\([^\r\n])/g,"$1").replace(/[\u0000-\u0020]+/g,"").toLowerCase()}function ty(v,_){let k=ey(v);if(/@import|expression\(|behavior:|-moz-binding|(?:image-set|cross-fade)\(/.test(k))throw new Vn(_,"network-capable or executable CSS is not allowed in an escaped interpolation");let R=/url\(([^)]*)\)/g,T;while((T=R.exec(k))!==null){let B=T[1].replace(/^["']|["']$/g,""),z=B.startsWith("/")&&!B.startsWith("//")||B.startsWith("./")||B.startsWith("../")||B.startsWith("#"),W=/^data:image\/(?:avif|bmp|gif|jpeg|jpg|png|webp);base64,[a-z\d+/=]+$/i.test(B);if(!z&&!W)throw new Vn(_,"CSS URLs must be local paths or base64 raster images")}}function Pd(v,_,k,R=!1,T=0){let B=hd(v,_,R),z=Tt(k);if(!B)return z;if(B.kind==="tag-name"){if(!/^[A-Za-z][A-Za-z0-9:-]*$/.test(k))throw new Vn("tag name","dynamic tag names may contain only letters, digits, colons, and hyphens");return k}if(B.kind==="tag"){let V=v.slice(_+T).trimStart(),H=k.trim();if(!V.startsWith("=")&&(H===""||/^(?!on)[A-Za-z_:][\w:.-]*(?:\s+(?!on)[A-Za-z_:][\w:.-]*)*$/.test(H)))return H;throw new Vn("tag structure","only standalone boolean attributes may be interpolated into tag structure")}let W=B.name.toLowerCase();if(/^on[a-z]/.test(W))throw new Vn(B.name,"native event-handler attributes execute JavaScript; use an @event binding instead");if(W==="srcdoc")z=Tt(z);if(W==="style")ty(k,B.name);if(B.quote===null)z=Qh(z);let F=Xa(W);if(F&&B.valuePrefix.trim()===""&&Lo(k,F))return yd+z;return bd(xd(v,_),k,z)}function we(v,_){let{scripts:k}=Sn(v);for(let R of k){let T=R.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i);if(!T||/\bserver\b|\bsrc\s*=/.test(T[1]))continue;let B=T[2];if(/\b(state|derived|effect|ref|reactive|computed|watch|watchEffect|useModel)\s*(?:<[^>]*>)?\s*\(/.test(B))return!0;if($n(B,_))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 fc(v){let _=[],k=/<([a-zA-Z][\w-]*)\b[^>]*?\s(?::for|x-for|@for)\s*=\s*(["'])([\s\S]*?)\2[^>]*>/g;for(let R=k.exec(v);R;R=k.exec(v)){let T=R[1].toLowerCase(),B=new Set(ts(R[3]));if(B.size===0)continue;let z=R.index+R[0].length;if(R[0].endsWith("/>")){_.push({start:R.index,end:z,names:B});continue}let W=new RegExp(`<(/?)${T}\\b[^>]*?(/?)>`,"gi");W.lastIndex=z;let F=1,V=v.length;for(let H=W.exec(v);H;H=W.exec(v)){if(H[2]==="/")continue;if(F+=H[1]==="/"?-1:1,F===0){V=H.index+H[0].length;break}}_.push({start:R.index,end:V,names:B})}return _}function ny(v,_,k){let R=s(k);for(let T of v){if(_<T.start||_>=T.end)continue;for(let B of T.names)if(new RegExp(`(?<![.#\\w$])${B.replace(/\$/g,"\\$")}(?![\\w$])`).test(R))return!0}return!1}function Rd(v,_){let k=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","URL","URLSearchParams","Intl","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined","NaN","Infinity","isNaN","isFinite","window","document","console","new","typeof","instanceof","in","void"],R=v.replace(/'[^']*'/g,"").replace(/"[^"]*"/g,""),T="",B=!1,z=0;for(let V=0;V<R.length;V++){let H=R[V];if(!B&&H==="`"){B=!0,z=0;continue}if(B){if(H==="`"&&z===0){B=!1;continue}if(H==="$"&&R[V+1]==="{"){z++,V++,T+=" ";continue}if(H==="}"&&z>0){z--;continue}if(z>0){T+=H;continue}continue}T+=H}R=T;let W=/(?<![a-zA-Z0-9_$])([a-zA-Z_$][a-zA-Z0-9_$]*)/g,F;while((F=W.exec(R))!==null){let V=F[1];if(!R.substring(0,F.index).trimEnd().endsWith(".")){if(!k.includes(V)&&!(V in _))return!1}}return!0}function ry(v,_){let k=_.__stx_serverDeclared;if(!k||k.size===0)return!1;let R=s(v);for(let T of k)if(new RegExp(`(?<![.#\\w$])${T}(?![\\w$])`).test(R))return!0;return!1}var Td=new Set;function Ad(v){return/^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*)*$/.test(v.trim())}function Id(v,_){let k=`${_??"<unknown>"}\x00${v}`;if(process.env.STX_DEBUG||!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 cs(v,_,k){let R=v;return R=R.replace(/\{!!([\s\S]*?)!!\}/g,(T,B)=>{try{let z=x(B,_);if(z===void 0)return Ad(B)?Id(B.trim(),k):T;return z===null?"":String(z)}catch{return T}}),R=Kn(R,(T,B,z)=>{let W=B.trim();if(/^__[A-Z_]+__$/.test(W))return T;try{let F=x(B,_);if(F===void 0)return Ad(W)?Id(W,k):T;return JSON.stringify(F).replace(/</g,"\\u003c")}catch{return T}}),R}function gc(v,_){if(!v.includes("{"))return v;let k=v;return k=k.replace(/\{!!([\s\S]*?)!!\}/g,(R,T)=>{try{let B=x(T,_);if(B===void 0)return R;return B===null?"":String(B)}catch{return R}}),k=Kn(k,(R,T,B)=>{let z=T.trim();if(/^__[A-Z_]+__$/.test(z))return R;try{let W=x(T,_);if(W===void 0)return R;if(W===null)return"";let F=String(W);return Pd(k,B,F,!0,R.length)}catch(W){if(W instanceof Vn)throw W;return R}}),k}function Uu(v,_,k={}){let{output:R,scripts:T}=Sn(v),B=T.map((z)=>{let W=z.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i),F=z.match(/^<script\b[^>]*>/i),V=z.search(/<\/script\s*>$/i);if(!W||!F||V===-1)return z;let H=W[1],q=W[2];if(/\bdata-raw\b/.test(H))return z;if(k.skipServer&&/\bserver\b/.test(H))return z;let Z=`<script${gc(H,_)}>`;if(/\bsrc\s*=/.test(H)||/\btype\s*=\s*["']application\/json["']/.test(H))return Z+q+z.slice(V);return Z+cs(q,_)+z.slice(V)});return es(R,B)}function X(v,_,k){let R=v,T=(Z,se)=>{let ie=Qr(Z,se);if(ie===-1)return-1;return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(Z.slice(se,ie))?-1:ie},B=(Z,se,ie,oe)=>{let ae=ie.length,{output:le,tokens:ce}=On(Z,se,(ge,$e)=>oe(ae+$e));return ie.push(...ce),le},z=[];R=B(R,T,z,(Z)=>`<!--__STX_STYLE_${Z}__-->`);let W=[];R=B(R,U,W,(Z)=>`<!--__STX_SCRIPT_EXPR_${Z}__-->`);let F=_?.__stx_signals_gate===!0||we(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:[]);R=Kn(R,(Z,se,ie)=>{try{let oe=x(se,_,!1,(ae)=>ec(ae,Z,k,v));return oe!==void 0&&oe!==null?String(oe):""}catch(oe){let ae=oe instanceof Error?oe.message:String(oe);return g("Expression",`Error evaluating: {{{ ${se.trim()}}}}: ${ae}`,k,v,ie,Z)}},3),R=R.replace(/\{!!([\s\S]*?)!!\}/g,(Z,se,ie)=>{try{let oe=x(se,_,!1,(ae)=>ec(ae,Z,k,v));if(oe===void 0&&_.__stx_buildMode==="compile")return jo("raw",se.trim());return oe!==void 0&&oe!==null?String(oe):""}catch(oe){if(_.__stx_buildMode==="compile")return jo("raw",se.trim());let ae=oe instanceof Error?oe.message:String(oe);return g("Expression",`Error evaluating: {!! ${se.trim()} !!}: ${ae}`,k,v,ie,Z)}}),R=B(R,U,W,(Z)=>`<!--__STX_SCRIPT_EXPR_${Z}__-->`),R=B(R,T,z,(Z)=>`<!--__STX_STYLE_${Z}__-->`);let q=F?fc(R):[],Q=new Set(yr(_));if(R=Kn(R,(Z,se,ie)=>{let oe=se.trim();if(Mr(oe,Q))return Z;if(q.length>0&&ny(q,ie,oe))return Z;if(H.has(oe))return Z;let ae=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined"],le=/^([a-zA-Z_$][a-zA-Z0-9_$]*)/,ge=oe.match(le)?.[1],$e=ge&&((ge in _)||ae.includes(ge)),ye=Boolean(ge&&V.has(ge)),ke=/^([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/,Re=oe.match(ke),Ae=Re&&!ae.includes(Re[1])&&!(Re[1]in _);if(/^__[A-Z_]+__$/.test(oe))return"";let Ie;try{let Pe=x(se,_,!1,(Me)=>{Ie=Me});if(ye)return Z;if(F&&!Rd(oe,_))return Z;if(Ie)ec(Ie,Z,k,v);if(_.__stx_buildMode==="compile"&&!F&&(Pe===void 0||ry(oe,_)))return jo("expr",oe);if(Pe===void 0||Pe===null)return"";let Ee=String(Pe);return Pd(R,ie,Ee,!1,Z.length)}catch(Pe){if(Pe instanceof Vn)throw Pe;if(ye)return Z;if(F&&!Rd(oe,_))return Z;if(Ae)return Z;let Ee=Pe instanceof Error?Pe.message:String(Pe);return g("Expression",`Error evaluating: {{ ${oe} }}: ${Ee}`,k,v,ie,Z)}}),W.length>0)R=R.replace(/<!--__STX_SCRIPT_EXPR_(\d+)__-->/g,(Z,se)=>W[Number(se)]??Z);if(z.length>0)R=R.replace(/<!--__STX_STYLE_(\d+)__-->/g,(Z,se)=>z[Number(se)]??Z);return R}function mc(v,_,k){if(!_.trim())return v;let R=v,T=_.trim();while(T.length>0){let B=T.match(/^(\w+)/);if(!B)break;let z=B[1];T=T.substring(z.length).trim();let W=Zi[z]||Gn[z];if(!W)throw Error(`Filter not found: ${z}. Available filters: ${Object.keys(dc()).join(", ")}`);let F=[];if(T.startsWith(":")){let V=T.match(/^:([^|\s]+)/);if(V){let H=V[1].trim();try{let q=Number(H);F=[Number.isNaN(q)?H:q]}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 q=T.substring(1,H-1).trim();if(q)try{if(q.startsWith("{")&&q.endsWith("}"))F=[x(`(${q})`,k,!0)];else{let Q=[],Z="",se=null,ie=0,oe=0,ae=0,le=!1;for(let ce=0;ce<q.length;ce++){let ge=q[ce];if(le){Z+=ge,le=!1;continue}if(ge==="\\"){Z+=ge,le=!0;continue}if(se){if(Z+=ge,ge===se)se=null;continue}if(ge==='"'||ge==="'"||ge==="`"){se=ge,Z+=ge;continue}if(ge==="(")ie++;else if(ge===")")ie--;else if(ge==="[")oe++;else if(ge==="]")oe--;else if(ge==="{")ae++;else if(ge==="}")ae--;if(ge===","&&ie===0&&oe===0&&ae===0){Q.push(Z),Z="";continue}Z+=ge}if(Z)Q.push(Z);F=Q.map((ce)=>{let ge=ce.trim();return x(ge,k,!0)})}}catch{F=[q]}T=T.substring(H).trim()}}try{R=W(R,k,...F)}catch(V){let H=V instanceof Error?V.message:String(V);throw Error(`Error applying filter '${z}': ${H}`)}if(T.startsWith("|"))T=T.substring(1).trim();else break}return R}function sy(v){let _=!1,k="",R=0,T=0,B=0,z=!1;for(let W=0;W<v.length;W++){let F=v[W],V=v[W+1];if(_&&z){z=!1;continue}if(_&&F==="\\"){z=!0;continue}if(z=!1,(F==='"'||F==="'"||F==="`")&&!z){if(!_)_=!0,k=F;else if(F===k)_=!1,k="";continue}if(_&&k==="`"&&F==="$"&&V==="{"){let H=1;W+=2;while(W<v.length&&H>0){if(v[W]==="{")H++;else if(v[W]==="}")H--;if(H>0)W++}continue}if(_)continue;if(F==="(")R++;else if(F===")")R--;else if(F==="[")T++;else if(F==="]")T--;else if(F==="{")B++;else if(F==="}")B--;if(F==="|"&&R===0&&T===0&&B===0){if(V==="|"){W++;continue}if(V==="="){W++;continue}return W}}return-1}var Xi=new Set,iy=1000;function Vu(){Xi.clear()}function ec(v,_,k,R){if(!M())return;let T=`${k}\x00${v.expression}`;if(Xi.has(T))return;if(Xi.size>=iy)Xi.clear();Xi.add(T);let B=k,z=R;try{if(k&&Ed.existsSync(k))z=Ed.readFileSync(k,"utf8")}catch{}let W=z.indexOf(_);if(W>=0)B=`${k}:${z.slice(0,W).split(`
124
+ `).length}`;console.warn(`${B}: 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,R){try{let T=v.trim(),B=sy(T);if(B>0){let W=T.substring(0,B).trim(),F=T.substring(B+1).trim(),V=x(W,_,!0,R);return mc(V,F,_)}let z=_n(T);if(z!==null){R?.({expression:T,rule:z});return}try{let W=Object.keys(_),F=Object.values(_);return c(T,W)(...F)}catch{return l(T,_)}}catch(T){if(T instanceof ReferenceError){let B=/(\b\w+)\s+is not defined/.exec(T.message);if(B){let z=B[1],W=oy(z,Object.keys(_));if(W&&W!==z)T.message=`${T.message} \u2014 did you mean '${W}'?`}}if(!k)console.error(`Error evaluating expression: ${v}`,T);throw T}}function oy(v,_){let k=null;for(let T of _){if(T===v)continue;let B=ay(v,T);if(k===null||B<k.dist)k={key:T,dist:B}}if(!k)return null;let R=Math.max(v.length,k.key.length);if(k.dist<=2||k.dist/R<=0.35)return k.key;return null}function ay(v,_){if(v===_)return 0;if(v.length===0)return _.length;if(_.length===0)return v.length;let[k,R]=v.length<_.length?[v,_]:[_,v],T=Array(k.length+1),B=Array(k.length+1);for(let z=0;z<=k.length;z++)T[z]=z;for(let z=1;z<=R.length;z++){B[0]=z;for(let W=1;W<=k.length;W++){let F=k[W-1]===R[z-1]?0:1;B[W]=Math.min(B[W-1]+1,T[W]+1,T[W-1]+F)}for(let W=0;W<=k.length;W++)T[W]=B[W]}return T[k.length]}function Wu(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 Od from"fs";class N{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 R=this.cache.keys().next().value;if(R===void 0)break;this.delete(R)}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 ns=new Map,cy=500;function Or(v,_){if(_?.includes("g"))return new RegExp(v,_);let k=`${v}:${_||""}`;if(!ns.has(k)){if(ns.size>=cy){let R=ns.keys().next().value;if(R)ns.delete(R)}ns.set(k,new RegExp(v,_))}return ns.get(k)}class Dd{pool=[];maxPoolSize=10;fnCache=new Map;fnCacheMaxSize=200;getEvaluator(v){let _=Array.from(new Set(v)),k=_.sort().join(","),R=this.pool.find((W)=>W.context.join(",")===k);if(R)return R.func;let T=this.fnCache,B=this.fnCacheMaxSize,z=(...W)=>(F)=>{try{let V=`${k}:${F}`,H=T.get(V);if(!H){if(T.size>=B){let q=T.keys().next().value;if(q)T.delete(q)}H=Function(..._,`
125
125
  'use strict';
126
126
  try {
127
127
  return ${F};
@@ -132,18 +132,18 @@ catch (e) {
132
132
  }
133
133
  throw e;
134
134
  }
135
- `),T.set(V,H)}return H(...W)}catch{return}};if(this.pool.length<this.maxPoolSize)this.pool.push({func:z,context:_.slice()});return z}clear(){this.pool.length=0,this.fnCache.clear()}}var f$=new bd;class vd{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(),R=_(),T=performance.now()-k;return this.recordTime(v,T),this.checkBudget(v,T),R}async timeAsync(v,_){if(!this.enabled)return _();let k=performance.now(),R=await _(),T=performance.now()-k;return this.recordTime(v,T),this.checkBudget(v,T),R}checkBudget(v,_){let k=this.budgets.get(v);if(!k)return;let R=_/k.maxTime*100,T=k.warnThreshold!==void 0?_>=k.maxTime*k.warnThreshold&&_<k.maxTime:!1,B=_>=k.maxTime;if(!T&&!B)return;let z={label:v,actualTime:_,budgetTime:k.maxTime,exceedancePercent:R,timestamp:new Date,isWarning:T};this.violations.push(z);while(this.violations.length>this.maxViolations)this.violations.shift();for(let F of this.violationHandlers)try{F(z)}catch{}let W=T?`[Performance Warning] "${v}" took ${_.toFixed(2)}ms (${R.toFixed(1)}% of ${k.maxTime}ms budget)`:`[Performance Budget Exceeded] "${v}" took ${_.toFixed(2)}ms (exceeded ${k.maxTime}ms budget by ${(R-100).toFixed(1)}%)`;switch(k.action){case"log":console.log(W);break;case"warn":console.warn(W);break;case"error":console.error(W);break;case"throw":if(B)throw Error(W);else console.warn(W);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 R=this.budgets.get(v);return{count:k.count,avgTime:k.totalTime/k.count,totalTime:k.totalTime,maxTime:k.maxTime,minTime:k.minTime,budget:R?.maxTime,budgetUtilization:R?k.totalTime/k.count/R.maxTime*100:void 0}}let _={};for(let[k,R]of this.metrics.entries()){let T=this.budgets.get(k);_[k]={count:R.count,avgTime:R.totalTime/R.count,totalTime:R.totalTime,maxTime:R.maxTime,minTime:R.minTime,budget:T?.maxTime,budgetUtilization:T?R.totalTime/R.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 R of this.violations)if(v[R.label]=(v[R.label]||0)+1,R.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 tc=null;function ly(){if(!tc)tc=new vd;return tc}var G=new Proxy({},{get(v,_){return ly()[_]}});var Sd=[];function m(v){let _=new N(v);return Sd.push(_),_}function $d(){for(let v of Sd)v.clear()}function h(v,..._){return`${_.map((k)=>String(k??"")).join("\x00")}\x00${v.length}\x00${Bun.hash(v)}`}function _d(v){let _=[];for(let k of new Set(v))try{_.push({path:k,mtimeMs:wd.statSync(k).mtimeMs})}catch{}return _}function cn(v){for(let _ of v)try{if(wd.statSync(_.path).mtimeMs!==_.mtimeMs)return!1}catch{return!1}return!0}import AS from"fs";import tn from"path";import Yi from"fs";import jt from"path";import{hasLocalConfig as ff}from"bunfig";import Nn from"fs";import Nr from"path";import nc from"fs";import kd from"path";import{fileURLToPath as uy}from"url";var rc;function Fe(){if(rc)return rc;let v="unknown";try{v=String(JSON.parse(nc.readFileSync(new URL("../package.json",import.meta.url),"utf8")).version)}catch{}if(import.meta.url.endsWith(".ts"))try{let _=kd.dirname(uy(import.meta.url)),k=0;for(let R of nc.readdirSync(_,{recursive:!0,withFileTypes:!0}))if(R.isFile()&&R.name.endsWith(".ts"))k=Math.max(k,nc.statSync(kd.join(R.parentPath,R.name)).mtimeMs);v+=`+src.${Math.trunc(k)}`}catch{}return rc=v,v}var hc=new Map,jr=new Map;async function qd(v){let k;for(let R=0;R<3;R++)try{let B=(await Nn.promises.stat(v)).mtime.getTime(),z=jr.get(v);if(z&&z.mtime===B)return z.content;let W=await Bun.file(v).text(),V=(await Nn.promises.stat(v)).mtime.getTime();if(V!==B)continue;return jr.set(v,{content:W,mtime:V}),W}catch(T){k=T;break}throw jr.delete(v),Error(`File not found: ${v}${k?` (${k.message})`:""}`)}function Gd(v){jr.delete(v)}function Kd(v){for(let _ of jr.keys())if(_.startsWith(v))jr.delete(_)}var Uo=null,dy=null,Cd=null;function Xd(v){Cd=v}async function yc(v=!1){let _=Cd??await import("./chunk-3akgppsy.js");if(v)return _.generateSignalsRuntimeDev();if(Uo===null)Uo=_.generateSignalsRuntime();return Uo}var Ho=null;async function bc(){if(Ho===null){let{getRouterScript:v}=await import("./chunk-v8p5p2kp.js");Ho=v()}return Ho}var Ed={};async function Jd(v,_=!1){let k=v==="runtime"?await yc(_):await bc(),R=v==="runtime"&&_?"runtime-debug":v,T=Ed[R];if(!T||T.content!==k)T={content:k,hash:Bun.hash(k).toString(16).padStart(16,"0").slice(0,16)},Ed[R]=T;return{content:k,hash:T.hash,url:`/_stx/${v}.${T.hash}.js`}}var fy=500,py=33554432,Hn=new Map,Vo=0;function Rd(v){return a(process.cwd(),"module-bundles",`${v}.js`)}function Yd(v){let _=Bun.hash(v).toString(16).padStart(16,"0").slice(0,16),k=Hn.get(_),R=k!==void 0;if(R)Hn.delete(_),Vo-=k.length*2;Hn.set(_,v),Vo+=v.length*2;while(Hn.size>1&&(Hn.size>fy||Vo>py)){let T=Hn.keys().next().value;Vo-=Hn.get(T).length*2,Hn.delete(T)}if(!R)try{let T=Rd(_);if(!Nn.existsSync(T))Nn.mkdirSync(Nr.dirname(T),{recursive:!0}),Nn.writeFileSync(T,v)}catch{}return`/_stx/modules.${_}.js`}function ri(v){if(!/^[0-9a-f]{16}$/.test(v))return;let _=Hn.get(v);if(_!==void 0)return _;try{return Nn.readFileSync(Rd(v),"utf8")}catch{return}}function Zd(){jr.clear(),ne(),$d(),Uo=null,dy=null,Ho=null}function Td(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 dn(v,_){try{if(!_.cachePath)return null;let k=Nr.resolve(_.cachePath),R=Nr.join(k,`${Kn(v)}.html`),T=Nr.join(k,`${Kn(v)}.meta.json`);if(!await r(R)||!await r(T))return null;let B=await Bun.file(T).text(),z=JSON.parse(B);if(z.cacheVersion!==_.cacheVersion)return null;if(z.engine!==Fe())return null;if(z.optionsSignature!==Td(_))return null;if((await Nn.promises.stat(v)).mtime.getTime()>z.mtime)return null;for(let F of z.dependencies)if(await r(F)){if((await Nn.promises.stat(F)).mtime.getTime()>z.mtime)return null}else return null;return await Bun.file(R).text()}catch(k){return console.warn(`Cache error for ${v}:`,k),null}}async function un(v,_,k,R){try{if(!R.cachePath)return;let T=Nr.resolve(R.cachePath);await Nn.promises.mkdir(T,{recursive:!0});let B=Nr.join(T,`${Kn(v)}.html`),z=Nr.join(T,`${Kn(v)}.meta.json`),W=await Nn.promises.stat(v);await Bun.write(B,_);let F={sourcePath:v,mtime:W.mtime.getTime(),dependencies:Array.from(k),cacheVersion:R.cacheVersion,engine:Fe(),optionsSignature:Td(R),generatedAt:Date.now()};await Bun.write(z,JSON.stringify(F,null,2)),hc.set(v,{output:_,mtime:W.mtime.getTime(),dependencies:k})}catch(T){console.warn(`Failed to cache template ${v}:`,T)}}var gy=16;function Kn(v){return new Bun.CryptoHasher("sha1").update(v).digest("hex").substring(0,gy)}var Xn={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 sc(v){return`--stx-${v}`}function ic(v,_){let k=_.lastIndexOf("-");if(k===-1)return typeof v[_]==="string"?v[_]:void 0;let R=v[_.slice(0,k)];if(!R||typeof R!=="object")return;let T=R[_.slice(k+1)];return typeof T==="string"?T:void 0}function Ad(v){let _={};for(let[k,R]of Object.entries(Xn)){let T=ic(v,R.light);if(T===void 0)continue;_[k]=`var(${sc(k)}, ${T})`}return _}function Id(v){let _=[],k=[];for(let[R,T]of Object.entries(Xn)){let B=ic(v,T.light),z=ic(v,T.dark);if(B===void 0)continue;if(_.push(` ${sc(R)}: ${B};`),z!==void 0)k.push(` ${sc(R)}: ${z};`)}if(_.length===0)return"";return["/* stx role tokens \u2014 override any of these to re-theme by meaning. */",":root {",..._,"}",".dark {",...k,"}",""].join(`
136
- `)}var Pd={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 Dd(v){return`--stx-radius-${v}`}function Md(){let v={};for(let[_,k]of Object.entries(Pd))v[_]=`var(${Dd(_)}, ${k.value})`;return v}function Od(){return["/* stx shape tokens \u2014 a radius by what the thing is. */",":root {",...Object.entries(Pd).map(([v,_])=>` ${Dd(v)}: ${_.value};`),"}",""].join(`
137
- `)}var Nd={"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"}},my={"control-x":"control-px","control-y":"control-py","cell-x":"cell-px","cell-y":"cell-py","cell-head-y":"cell-head-py"},hy={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 jd(v){return`--stx-${v}`}function oc(v){let _=Nd[v];if(!_)throw Error(`[stx] unknown density token "${v}"`);return`var(${jd(v)}, ${_.value})`}function Ld(){let v={};for(let[_,k]of Object.entries(my))v[_]=oc(k);return v}function Bd(){let v={};for(let[_,{size:k,leading:R}]of Object.entries(hy))v[_]=[oc(k),{lineHeight:oc(R)}];return v}function ef(){return["/* stx density tokens \u2014 how much room a control or a table cell takes. */",":root {",...Object.entries(Nd).map(([v,_])=>` ${jd(v)}: ${_.value};`),"}",""].join(`
135
+ `),T.set(V,H)}return H(...W)}catch{return}};if(this.pool.length<this.maxPoolSize)this.pool.push({func:z,context:_.slice()});return z}clear(){this.pool.length=0,this.fnCache.clear()}}var f$=new Dd;class Md{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(),R=_(),T=performance.now()-k;return this.recordTime(v,T),this.checkBudget(v,T),R}async timeAsync(v,_){if(!this.enabled)return _();let k=performance.now(),R=await _(),T=performance.now()-k;return this.recordTime(v,T),this.checkBudget(v,T),R}checkBudget(v,_){let k=this.budgets.get(v);if(!k)return;let R=_/k.maxTime*100,T=k.warnThreshold!==void 0?_>=k.maxTime*k.warnThreshold&&_<k.maxTime:!1,B=_>=k.maxTime;if(!T&&!B)return;let z={label:v,actualTime:_,budgetTime:k.maxTime,exceedancePercent:R,timestamp:new Date,isWarning:T};this.violations.push(z);while(this.violations.length>this.maxViolations)this.violations.shift();for(let F of this.violationHandlers)try{F(z)}catch{}let W=T?`[Performance Warning] "${v}" took ${_.toFixed(2)}ms (${R.toFixed(1)}% of ${k.maxTime}ms budget)`:`[Performance Budget Exceeded] "${v}" took ${_.toFixed(2)}ms (exceeded ${k.maxTime}ms budget by ${(R-100).toFixed(1)}%)`;switch(k.action){case"log":console.log(W);break;case"warn":console.warn(W);break;case"error":console.error(W);break;case"throw":if(B)throw Error(W);else console.warn(W);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 R=this.budgets.get(v);return{count:k.count,avgTime:k.totalTime/k.count,totalTime:k.totalTime,maxTime:k.maxTime,minTime:k.minTime,budget:R?.maxTime,budgetUtilization:R?k.totalTime/k.count/R.maxTime*100:void 0}}let _={};for(let[k,R]of this.metrics.entries()){let T=this.budgets.get(k);_[k]={count:R.count,avgTime:R.totalTime/R.count,totalTime:R.totalTime,maxTime:R.maxTime,minTime:R.minTime,budget:T?.maxTime,budgetUtilization:T?R.totalTime/R.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 R of this.violations)if(v[R.label]=(v[R.label]||0)+1,R.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 tc=null;function ly(){if(!tc)tc=new Md;return tc}var G=new Proxy({},{get(v,_){return ly()[_]}});var Nd=[];function m(v){let _=new N(v);return Nd.push(_),_}function jd(){for(let v of Nd)v.clear()}function h(v,..._){return`${_.map((k)=>String(k??"")).join("\x00")}\x00${v.length}\x00${Bun.hash(v)}`}function Ld(v){let _=[];for(let k of new Set(v))try{_.push({path:k,mtimeMs:Od.statSync(k).mtimeMs})}catch{}return _}function cn(v){for(let _ of v)try{if(Od.statSync(_.path).mtimeMs!==_.mtimeMs)return!1}catch{return!1}return!0}import AS from"fs";import tn from"path";import Yi from"fs";import jt from"path";import{hasLocalConfig as ff}from"bunfig";import Nn from"fs";import Nr from"path";import nc from"fs";import Bd from"path";import{fileURLToPath as uy}from"url";var rc;function Fe(){if(rc)return rc;let v="unknown";try{v=String(JSON.parse(nc.readFileSync(new URL("../package.json",import.meta.url),"utf8")).version)}catch{}if(import.meta.url.endsWith(".ts"))try{let _=Bd.dirname(uy(import.meta.url)),k=0;for(let R of nc.readdirSync(_,{recursive:!0,withFileTypes:!0}))if(R.isFile()&&R.name.endsWith(".ts"))k=Math.max(k,nc.statSync(Bd.join(R.parentPath,R.name)).mtimeMs);v+=`+src.${Math.trunc(k)}`}catch{}return rc=v,v}var hc=new Map,jr=new Map;async function qu(v){let k;for(let R=0;R<3;R++)try{let B=(await Nn.promises.stat(v)).mtime.getTime(),z=jr.get(v);if(z&&z.mtime===B)return z.content;let W=await Bun.file(v).text(),V=(await Nn.promises.stat(v)).mtime.getTime();if(V!==B)continue;return jr.set(v,{content:W,mtime:V}),W}catch(T){k=T;break}throw jr.delete(v),Error(`File not found: ${v}${k?` (${k.message})`:""}`)}function Gu(v){jr.delete(v)}function Ku(v){for(let _ of jr.keys())if(_.startsWith(v))jr.delete(_)}var Uo=null,dy=null,Wd=null;function Xu(v){Wd=v}async function yc(v=!1){let _=Wd??await import("./chunk-2rj0ttas.js");if(v)return _.generateSignalsRuntimeDev();if(Uo===null)Uo=_.generateSignalsRuntime();return Uo}var Ho=null;async function bc(){if(Ho===null){let{getRouterScript:v}=await import("./chunk-c12y2bet.js");Ho=v()}return Ho}var zd={};async function Ju(v,_=!1){let k=v==="runtime"?await yc(_):await bc(),R=v==="runtime"&&_?"runtime-debug":v,T=zd[R];if(!T||T.content!==k)T={content:k,hash:Bun.hash(k).toString(16).padStart(16,"0").slice(0,16)},zd[R]=T;return{content:k,hash:T.hash,url:`/_stx/${v}.${T.hash}.js`}}var fy=500,py=33554432,Un=new Map,Vo=0;function Fd(v){return a(process.cwd(),"module-bundles",`${v}.js`)}function Yu(v){let _=Bun.hash(v).toString(16).padStart(16,"0").slice(0,16),k=Un.get(_),R=k!==void 0;if(R)Un.delete(_),Vo-=k.length*2;Un.set(_,v),Vo+=v.length*2;while(Un.size>1&&(Un.size>fy||Vo>py)){let T=Un.keys().next().value;Vo-=Un.get(T).length*2,Un.delete(T)}if(!R)try{let T=Fd(_);if(!Nn.existsSync(T))Nn.mkdirSync(Nr.dirname(T),{recursive:!0}),Nn.writeFileSync(T,v)}catch{}return`/_stx/modules.${_}.js`}function ri(v){if(!/^[0-9a-f]{16}$/.test(v))return;let _=Un.get(v);if(_!==void 0)return _;try{return Nn.readFileSync(Fd(v),"utf8")}catch{return}}function Zu(){jr.clear(),ne(),jd(),Uo=null,dy=null,Ho=null}function Vd(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 un(v,_){try{if(!_.cachePath)return null;let k=Nr.resolve(_.cachePath),R=Nr.join(k,`${Xn(v)}.html`),T=Nr.join(k,`${Xn(v)}.meta.json`);if(!await r(R)||!await r(T))return null;let B=await Bun.file(T).text(),z=JSON.parse(B);if(z.cacheVersion!==_.cacheVersion)return null;if(z.engine!==Fe())return null;if(z.optionsSignature!==Vd(_))return null;if((await Nn.promises.stat(v)).mtime.getTime()>z.mtime)return null;for(let F of z.dependencies)if(await r(F)){if((await Nn.promises.stat(F)).mtime.getTime()>z.mtime)return null}else return null;return await Bun.file(R).text()}catch(k){return console.warn(`Cache error for ${v}:`,k),null}}async function dn(v,_,k,R){try{if(!R.cachePath)return;let T=Nr.resolve(R.cachePath);await Nn.promises.mkdir(T,{recursive:!0});let B=Nr.join(T,`${Xn(v)}.html`),z=Nr.join(T,`${Xn(v)}.meta.json`),W=await Nn.promises.stat(v);await Bun.write(B,_);let F={sourcePath:v,mtime:W.mtime.getTime(),dependencies:Array.from(k),cacheVersion:R.cacheVersion,engine:Fe(),optionsSignature:Vd(R),generatedAt:Date.now()};await Bun.write(z,JSON.stringify(F,null,2)),hc.set(v,{output:_,mtime:W.mtime.getTime(),dependencies:k})}catch(T){console.warn(`Failed to cache template ${v}:`,T)}}var gy=16;function Xn(v){return new Bun.CryptoHasher("sha1").update(v).digest("hex").substring(0,gy)}var Jn={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 sc(v){return`--stx-${v}`}function ic(v,_){let k=_.lastIndexOf("-");if(k===-1)return typeof v[_]==="string"?v[_]:void 0;let R=v[_.slice(0,k)];if(!R||typeof R!=="object")return;let T=R[_.slice(k+1)];return typeof T==="string"?T:void 0}function Ud(v){let _={};for(let[k,R]of Object.entries(Jn)){let T=ic(v,R.light);if(T===void 0)continue;_[k]=`var(${sc(k)}, ${T})`}return _}function Hd(v){let _=[],k=[];for(let[R,T]of Object.entries(Jn)){let B=ic(v,T.light),z=ic(v,T.dark);if(B===void 0)continue;if(_.push(` ${sc(R)}: ${B};`),z!==void 0)k.push(` ${sc(R)}: ${z};`)}if(_.length===0)return"";return["/* stx role tokens \u2014 override any of these to re-theme by meaning. */",":root {",..._,"}",".dark {",...k,"}",""].join(`
136
+ `)}var qd={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 Kd(v){return`--stx-radius-${v}`}function Xd(){let v={};for(let[_,k]of Object.entries(qd))v[_]=`var(${Kd(_)}, ${k.value})`;return v}function Zd(){return["/* stx shape tokens \u2014 a radius by what the thing is. */",":root {",...Object.entries(qd).map(([v,_])=>` ${Kd(v)}: ${_.value};`),"}",""].join(`
137
+ `)}var Gd={"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"}},my={"control-x":"control-px","control-y":"control-py","cell-x":"cell-px","cell-y":"cell-py","cell-head-y":"cell-head-py"},hy={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 Jd(v){return`--stx-${v}`}function oc(v){let _=Gd[v];if(!_)throw Error(`[stx] unknown density token "${v}"`);return`var(${Jd(v)}, ${_.value})`}function Yd(){let v={};for(let[_,k]of Object.entries(my))v[_]=oc(k);return v}function Qd(){let v={};for(let[_,{size:k,leading:R}]of Object.entries(hy))v[_]=[oc(k),{lineHeight:oc(R)}];return v}function ef(){return["/* stx density tokens \u2014 how much room a control or a table cell takes. */",":root {",...Object.entries(Gd).map(([v,_])=>` ${Jd(v)}: ${_.value};`),"}",""].join(`
138
138
  `)}function tf(v){return typeof v==="object"&&v!==null&&!Array.isArray(v)}function ac(v,_){let k={...v};for(let[R,T]of Object.entries(_))k[R]=tf(T)&&tf(k[R])?ac(k[R],T):T;return k}function nf(v,_){if(!_.fonts)return"";let k=new v({..._.config,fonts:_.fonts,cssVariables:!1}).toCSS(!1,_.minify);return k&&!_.minify?`${k}
139
- `:k}function rf(v={},_={}){let k=v.theme||{},R=_.theme||{},{extend:T,...B}=R,{extend:z,...W}=k,F=W.colors||{};W.colors={...F,...Ad(F)};let V=W.borderRadius||{};W.borderRadius={...V,...Md()};let H=W.spacing||{};W.spacing={...H,...Ld()};let q=W.fontSize||{};W.fontSize={...q,...Bd()};let Q=ac(W,B),Z=ac(z||{},T||{});if(Object.keys(Z).length>0)Q.extend=Z;let se=[...v.safelist||[],..._.safelist||[]],ie={...v.shortcuts||{},..._.shortcuts||{}},oe=[...v.preflights||[],..._.preflights||[]],{fonts:ae,...le}=v,{fonts:ce,...ge}=_,$e=ce??ae;return{config:{...le,...ge,theme:Q,safelist:se,shortcuts:ie,...oe.length>0?{preflights:oe}:{},content:[],output:""},safelist:se,shortcuts:ie,includePreflight:_.preflight!==!1,minify:_.minify===!0,tokenCSS:Id(F)+Od()+ef(),...$e?{fonts:$e}:{}}}function sf(v,_=""){let k=`${v}${_}`,R=0;for(let T=0;T<k.length;T++){let B=k.charCodeAt(T);R=(R<<5)-R+B,R=R&R}return`stx-${Math.abs(R).toString(36)}`}function of(v,_,k={}){let{prefix:R="",preserveHost:T=!0,scopeKeyframes:B=!0,scopeCustomProperties:z=!1}=k;if(!v.trim())return"";let W=cc(v),F=[],V=new Map;if(B)for(let H of W){let q=H.selector.match(/@keyframes\s+([a-z_-][a-z0-9_-]*)/i);if(q){let Q=q[1],Z=`${_}_${Q}`;V.set(Q,Z)}}for(let H of W){let q=af(H,_,R,T,V,z);F.push(q)}return F.join(`
139
+ `:k}function rf(v={},_={}){let k=v.theme||{},R=_.theme||{},{extend:T,...B}=R,{extend:z,...W}=k,F=W.colors||{};W.colors={...F,...Ud(F)};let V=W.borderRadius||{};W.borderRadius={...V,...Xd()};let H=W.spacing||{};W.spacing={...H,...Yd()};let q=W.fontSize||{};W.fontSize={...q,...Qd()};let Q=ac(W,B),Z=ac(z||{},T||{});if(Object.keys(Z).length>0)Q.extend=Z;let se=[...v.safelist||[],..._.safelist||[]],ie={...v.shortcuts||{},..._.shortcuts||{}},oe=[...v.preflights||[],..._.preflights||[]],{fonts:ae,...le}=v,{fonts:ce,...ge}=_,$e=ce??ae;return{config:{...le,...ge,theme:Q,safelist:se,shortcuts:ie,...oe.length>0?{preflights:oe}:{},content:[],output:""},safelist:se,shortcuts:ie,includePreflight:_.preflight!==!1,minify:_.minify===!0,tokenCSS:Hd(F)+Zd()+ef(),...$e?{fonts:$e}:{}}}function sf(v,_=""){let k=`${v}${_}`,R=0;for(let T=0;T<k.length;T++){let B=k.charCodeAt(T);R=(R<<5)-R+B,R=R&R}return`stx-${Math.abs(R).toString(36)}`}function of(v,_,k={}){let{prefix:R="",preserveHost:T=!0,scopeKeyframes:B=!0,scopeCustomProperties:z=!1}=k;if(!v.trim())return"";let W=cc(v),F=[],V=new Map;if(B)for(let H of W){let q=H.selector.match(/@keyframes\s+([a-z_-][a-z0-9_-]*)/i);if(q){let Q=q[1],Z=`${_}_${Q}`;V.set(Q,Z)}}for(let H of W){let q=af(H,_,R,T,V,z);F.push(q)}return F.join(`
140
140
 
141
141
  `)}function cc(v){let _=[],k=v.replace(/\/\*[\s\S]*?\*\//g,""),R=0,T="",B=!1,z="";for(let W=0;W<k.length;W++){let F=k[W];if(F==="@"&&R===0)B=!0;if(F==="{")R++;else if(F==="}"){if(R--,R===0){if(B){z+=F;let V=z.match(/@([a-z-]+)\s*([^{]*)\{([\s\S]*)\}/i);if(V){let[,H,q,Q]=V;if(H==="keyframes")_.push({selector:`@keyframes ${q.trim()}`,declarations:Q.trim()});else if(H==="media"||H==="supports"||H==="container"){let Z=cc(Q);_.push({selector:`@${H} ${q.trim()}`,declarations:Z.map((se)=>`${se.selector} { ${se.declarations} }`).join(`
142
142
  `)})}else _.push({selector:`@${H} ${q.trim()}`,declarations:Q.trim()})}z="",B=!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(B)z+=F;else T+=F}return _}function af(v,_,k,R,T,B){let{selector:z,declarations:W}=v;if(z.startsWith("@")){if(z.startsWith("@keyframes")){let H=z.replace("@keyframes ","").trim();return`@keyframes ${T.get(H)||H} { ${W} }`}if(z.startsWith("@media")||z.startsWith("@supports")||z.startsWith("@container")){let q=cc(`x { ${W} }`.replace(/x \{ /,"").replace(/ \}$/,"")).map((Q)=>af(Q,_,k,R,T,B)).join(`
143
143
  `);return`${z} {
144
144
  ${q}
145
- }`}return`${z} { ${W} }`}let F=yy(z,_,k,R),V=W;for(let[H,q]of T)V=V.replace(new RegExp(`\\b${H}\\b`,"g"),q);if(B)V=V.replace(/--([a-z-]+)/gi,`--${_}-$1`);return`${F} { ${V} }`}function yy(v,_,k,R){let T=v.split(",").map((z)=>z.trim()),B=[];for(let z of T){if(z.startsWith(":host")){if(R)B.push(z);else{let V=z.replace(/:host(\([^)]*\))?/,`.${_}$1`);B.push(V)}continue}if(z.includes("::slotted")){B.push(z);continue}if(z===":root"){B.push(`:root .${_}`);continue}let W=k?`${k} .${_}`:`.${_}`;B.push(`${W} ${z}`);let F=xy(z,_);if(F)B.push(k?`${k} ${F}`:F)}return B.join(", ")}function xy(v,_){let k=0,R=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==="~")){R=F;break}}let T=v.slice(0,R),B=v.slice(R);if(!T)return"";let z=T.length,W=0;for(let F=0;F<T.length;F++){let V=T[F];if(V==="["||V==="(")W++;else if(V==="]"||V===")")W--;else if(k===0&&W===0&&V===":"){z=F;break}}return`${T.slice(0,z)}.${_}${T.slice(z)}${B}`}var uf=String.raw`(?<![\w-])scoped(?![\w-])`,Kc=/<style\s+([^>]*)>/gi,cf=/<style\s+([^>]*)>([\s\S]*?)<\/style>/gi,df=new RegExp(uf,"i"),by=new RegExp(uf,"gi"),Xc=/<style\b[^>]*\bdata-stx-scoped(?:=(?:"[^"]*"|'[^']*'|[^\s>]+))?[^>]*>[\s\S]*?<\/style>\s*/gi;function vy(v){Kc.lastIndex=0;let _=Kc.exec(v);while(_!==null){if(df.test(_[1]))return!0;_=Kc.exec(v)}return!1}function Zc(v){let _=new Set,k=[];Xc.lastIndex=0;let R=Xc.exec(v);while(R!==null){let T=R[0].trim();if(_.has(T))k.push({start:R.index,end:R.index+R[0].length});else _.add(T);R=Xc.exec(v)}return k}function Gi(v){let _=Zc(v);if(_.length===0)return v;let k=Array(_.length+1),R=0;for(let T=0;T<_.length;T++){let B=_[T];k[T]=v.slice(R,B.start),R=B.end}return k[_.length]=v.slice(R),k.join("")}function qo(v,_){if(!vy(v))return{html:v,hasScoped:!1};let k=sf(_),R=`data-v-${k}`,T=v,B=!1;if(cf.lastIndex=0,T=T.replace(cf,(z,W,F)=>{if(!df.test(W))return z;B=!0;let V=wy(F,R),H=W.replace(by,"").trim(),q=H?` ${H}`:"";return`<style data-stx-scoped="${k}"${q}>${V}</style>`}),!B)return{html:v,hasScoped:!1};return T=$y(T,R),{html:T,hasScoped:!0}}function wy(v,_){return of(v,"__SCOPE_PLACEHOLDER__",{preserveHost:!1}).replace(/\.(__SCOPE_PLACEHOLDER__) /g,`[${_}] `).replace(/\.(__SCOPE_PLACEHOLDER__)/g,`[${_}]`)}var Sy=(v)=>`\x00stx-scope-mask-${v}\x00`,lf=/\u0000stx-scope-mask-(\d+)\u0000/g;function $y(v,_){let k=On(v,(T,B)=>{let z=U(T,B);return z>B?z:Qr(T,B)},(T,B)=>Sy(B)),R=_y(k.output,_);return lf.lastIndex=0,R.replace(lf,(T,B)=>k.tokens[Number(B)])}function _y(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,(R,T,B)=>{if(k.has(T.toLowerCase()))return R;if(R.includes(_))return R;if(T.toLowerCase()==="style"||T.toLowerCase()==="script")return R;if(B)return R.replace(`<${T}${B}`,`<${T} ${_}${B}`);if(R.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 jn=null,Ko="";function pf(v){try{let _=v.startsWith("file:")?new URL(v).pathname:v;Ko=`${_}@${Math.trunc(Yi.statSync(_).mtimeMs)}`}catch{Ko=v}}var Jc=!1,Lr=null,Ji="",rs=!1,hf=256,br=new Map,Ln=new Map,Xo=null,yf=null,Go=new Map;function Jo(v){return Bun.hash(v).toString(16).padStart(16,"0").slice(0,16)}function Gc(v,_){if(br.has(v))br.delete(v);else if(br.size>=hf)br.delete(br.keys().next().value);br.set(v,_)}function ky(v){let _=Jo(v);if(Ln.has(_))Ln.delete(_);else if(Ln.size>=hf)Ln.delete(Ln.keys().next().value);return Ln.set(_,v),_}function Qd(v){let _=Ln.get(v);if(_===void 0)return;return Ln.delete(v),Ln.set(v,_),_}async function Ey(v,_=Xo){if(!_)return null;try{let k=Bun.file(jt.join(_,`cw-${Jo(v)}.css`));if(!await k.exists())return null;return await k.text()}catch{return null}}async function Cy(v,_,k=Xo){if(!k)return;try{if(!Yi.existsSync(k))Yi.mkdirSync(k,{recursive:!0});await Bun.write(jt.join(k,`cw-${Jo(v)}.css`),_)}catch{}}async function gf(v){try{let _=await import(v);if(_&&_.CSSGenerator)return{CSSGenerator:_.CSSGenerator,config:_.config,build:_.build,defaultConfig:_.defaultConfig,extractClasses:_.extractClasses}}catch{}return null}var Ry=[["@stacksjs","ts-css","dist","engine","index.js"],["@stacksjs","ts-css","src","engine","index.ts"]],Ty=["@stacksjs/ts-css/engine","@stacksjs/ts-css/dist/engine/index.js"];function Ay(){let v=[],_=process.cwd();while(_!==jt.dirname(_)){for(let k of["node_modules","pantry"])for(let R of Ry)v.push(jt.join(_,k,...R));_=jt.dirname(_)}return v}function Iy(){let v=[],_=process.env.HOME||process.env.USERPROFILE||"",k=[_&&jt.join(_,"Code","Tools","ts-css"),_&&jt.join(_,"Code","Tools","crosswind"),_&&jt.join(_,"repos","stacks-org","ts-css"),_&&jt.join(_,"repos","stacks-org","crosswind"),jt.join(process.cwd(),"..","ts-css"),jt.join(process.cwd(),"..","crosswind")].filter(Boolean);for(let R of k)v.push(jt.join(R,"packages","toolkit","dist","engine","index.js")),v.push(jt.join(R,"packages","toolkit","src","engine","index.ts"));if(_)v.push(jt.join(_,"Code","Tools","stx","node_modules","@stacksjs","ts-css","dist","engine","index.js"));return v}async function si(){if(Jc)return jn;Jc=!0;try{let v=async(T)=>{for(let B of T){if(!await Bun.file(B).exists())continue;let z=await gf(B);if(z){if(pf(B),!process.env.STACKS_DEV_QUIET)console.log(`${e.green}[ts-css]${e.reset} CSS engine loaded from ${jt.dirname(jt.dirname(B))}`);return z}}return null};if(process.env.CROSSWIND_SRC){let T=jt.resolve(process.env.CROSSWIND_SRC),B=await v([T]);if(!B)throw Error(`CROSSWIND_SRC did not resolve to a Css module: ${T}`);return jn=B,jn}let _=await v(Ay());if(_)return jn=_,jn;let k=Ty;for(let T of k){let B=await gf(T);if(B){jn=B;try{pf(import.meta.resolve(T))}catch{Ko=T}if(!process.env.STACKS_DEV_QUIET)console.log(`${e.green}[ts-css]${e.reset} CSS engine loaded`);return jn}}let R=await v(Iy());if(R)return jn=R,jn;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 eu(){Yc.clear(),jn=null,Jc=!1,Lr=null,Ji="",br.clear(),Ln.clear(),yf=null,Go.clear()}var mf=!1;async function oi(v){try{let _=ff({name:"css",cwd:v})?"css":ff({name:"crosswind",cwd:v})?"crosswind":null;if(!_)return null;if(_==="crosswind"&&!process.env.STACKS_DEV_QUIET&&!mf)mf=!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"),R=await k({name:_,cwd:v,defaultConfig:{},checkEnv:!1,verbose:!1});if(!R?.path||!R.config||Object.keys(R.config).length===0)return null;let T=jt.relative(v,R.path);if(!process.env.STACKS_DEV_QUIET)console.log(`${e.green}[ts-css]${e.reset} Loaded config from ${T||R.path}`);return R.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 wc(v){let _=null;try{let{loadStxConfig:k}=await import("./chunk-1dwnp35v.js"),R=await k(v);if(R.css)if(typeof R.css==="string"){let T=jt.isAbsolute(R.css)?R.css:jt.resolve(v,R.css);if(await Bun.file(T).exists()){let B=await import(T);_=B.default||B,console.log(`${e.green}[ts-css]${e.reset} Loaded config from stx.config.ts \u2192 ${R.css}`)}}else{if(_={...R.css,content:R.css.content||[],preflight:R.css.preflight??!0,minify:R.css.minify??!1},R.css.config){let T=jt.isAbsolute(R.css.config)?R.css.config:jt.resolve(v,R.css.config);if(await Bun.file(T).exists()){let B=await import(T);_={...B.default||B,..._}}}console.log(`${e.green}[ts-css]${e.reset} Using inline CSS config from stx.config.ts`)}}catch{}return _||await oi(v)}function vc(v){try{let _=new WeakSet;return Jo(JSON.stringify(v??{},(k,R)=>{if(typeof R==="function")return`[fn]${String(R)}`;if(typeof R==="object"&&R!==null){if(_.has(R))return"[circular]";_.add(R)}return R})??"")}catch{return"unhashable"}}async function $t(v){if(rs)return Ji;rs=!0;try{let _=await si();if(!_||!_.build)return rs=!1,"";if(!Lr)Lr=await oi(v);if(!Lr)return rs=!1,"";let k=_.defaultConfig?.theme||{},R=Lr.theme||{},T={..._.defaultConfig,...Lr,theme:{...k,...R,extend:{...k.extend||{},...R.extend||{}}}},B=performance.now(),z=await _.build(T),W=performance.now()-B;if(Ji=z.css,console.log(`${e.cyan}[ts-css]${e.reset} Built ${z.classes.size} classes in ${W.toFixed(1)}ms`),T.output){let F=jt.isAbsolute(T.output)?T.output:jt.join(v,T.output),V=jt.dirname(F);if(!Yi.existsSync(V))Yi.mkdirSync(V,{recursive:!0});await Bun.write(F,z.css)}return rs=!1,z.css}catch(_){return console.error(`${e.red}[ts-css]${e.reset} Build error:`,_),rs=!1,Ji}}async function pn(v){Lr=null,await $t(v)}function tu(){return Ji}function xc(v){let _=new Set,k=/class\s*=\s*["']([^"']+)["']/gi,R=k.exec(v);while(R!==null){for(let z of R[1].split(/\s+/))if(z.trim())_.add(z.trim());R=k.exec(v)}let T=/(?:x-class|:class)\s*=\s*"([^"]+)"/gi,B=T.exec(v);while(B!==null){let z=B[1].match(/'([^']+)'/g);if(z){for(let W of z)for(let F of W.slice(1,-1).split(/\s+/))if(F.trim())_.add(F.trim())}B=T.exec(v)}return _}var Yc=m(64);async function Sc(v,_){let k=()=>Go.get(_?jt.resolve(_):process.cwd())?.fingerprint??null,R=Yc.get(h(v,_,k()));if(R!==void 0)return R;let T=await Py(v,_);if(T)Yc.set(h(v,_,k()),T);return T}function*xf(v){yield v;let _=new Set;for(let k of v.matchAll(/\/_stx\/modules\.([0-9a-f]{16})\.js/g)){let R=k[1];if(_.has(R))continue;_.add(R);let T=ri(R);if(T)yield T}}function nu(v){return[...xf(v)].join(`
146
- `)}async function Py(v,_){try{let k=await si();if(!k)return"";let R=new Set;for(let Re of xf(v)){let Ae=typeof k.extractClasses==="function"?k.extractClasses(Re):xc(Re);for(let Ie of Ae)R.add(Ie)}if(R.size===0)return"";let T=_?jt.resolve(_):process.cwd(),B=a(T,"cache");if(!Xo)Xo=B;let z=Go.get(T);if(!z){let Re=await wc(T);z={config:Re,fingerprint:vc(Re)},Go.set(T,z),yf=z.fingerprint}let W=[...R].sort().join(" "),F=`${Ko}::${z.fingerprint||"default"}::${W}`,V=br.get(F);if(V!==void 0)return Gc(F,V),V;let H=await Ey(F,B);if(H!==null)return Gc(F,H),H;let q=k.defaultConfig||k.config,Q=z.config||{},Z=rf(q,Q),{safelist:se,includePreflight:ie,minify:oe,tokenCSS:ae}=Z,le=Z.config,ce=new k.CSSGenerator(le),ge=le.shortcuts||Q.shortcuts||{},$e=Object.keys(ge).filter((Re)=>R.has(Re)||se.includes(Re));for(let Re of se)if(!ge[Re])ce.generate(Re);for(let Re of R)if(!ge[Re])ce.generate(Re);let ye="";if($e.length>0){let Re=new k.CSSGenerator(le);for(let Ae of $e)Re.generate(Ae);if(ye=Re.toCSS(!1,oe),ye&&!ye.endsWith(`
145
+ }`}return`${z} { ${W} }`}let F=yy(z,_,k,R),V=W;for(let[H,q]of T)V=V.replace(new RegExp(`\\b${H}\\b`,"g"),q);if(B)V=V.replace(/--([a-z-]+)/gi,`--${_}-$1`);return`${F} { ${V} }`}function yy(v,_,k,R){let T=v.split(",").map((z)=>z.trim()),B=[];for(let z of T){if(z.startsWith(":host")){if(R)B.push(z);else{let V=z.replace(/:host(\([^)]*\))?/,`.${_}$1`);B.push(V)}continue}if(z.includes("::slotted")){B.push(z);continue}if(z===":root"){B.push(`:root .${_}`);continue}let W=k?`${k} .${_}`:`.${_}`;B.push(`${W} ${z}`);let F=xy(z,_);if(F)B.push(k?`${k} ${F}`:F)}return B.join(", ")}function xy(v,_){let k=0,R=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==="~")){R=F;break}}let T=v.slice(0,R),B=v.slice(R);if(!T)return"";let z=T.length,W=0;for(let F=0;F<T.length;F++){let V=T[F];if(V==="["||V==="(")W++;else if(V==="]"||V===")")W--;else if(k===0&&W===0&&V===":"){z=F;break}}return`${T.slice(0,z)}.${_}${T.slice(z)}${B}`}var uf=String.raw`(?<![\w-])scoped(?![\w-])`,Kc=/<style\s+([^>]*)>/gi,cf=/<style\s+([^>]*)>([\s\S]*?)<\/style>/gi,df=new RegExp(uf,"i"),by=new RegExp(uf,"gi"),Xc=/<style\b[^>]*\bdata-stx-scoped(?:=(?:"[^"]*"|'[^']*'|[^\s>]+))?[^>]*>[\s\S]*?<\/style>\s*/gi;function vy(v){Kc.lastIndex=0;let _=Kc.exec(v);while(_!==null){if(df.test(_[1]))return!0;_=Kc.exec(v)}return!1}function Zc(v){let _=new Set,k=[];Xc.lastIndex=0;let R=Xc.exec(v);while(R!==null){let T=R[0].trim();if(_.has(T))k.push({start:R.index,end:R.index+R[0].length});else _.add(T);R=Xc.exec(v)}return k}function Gi(v){let _=Zc(v);if(_.length===0)return v;let k=Array(_.length+1),R=0;for(let T=0;T<_.length;T++){let B=_[T];k[T]=v.slice(R,B.start),R=B.end}return k[_.length]=v.slice(R),k.join("")}function qo(v,_){if(!vy(v))return{html:v,hasScoped:!1};let k=sf(_),R=`data-v-${k}`,T=v,B=!1;if(cf.lastIndex=0,T=T.replace(cf,(z,W,F)=>{if(!df.test(W))return z;B=!0;let V=wy(F,R),H=W.replace(by,"").trim(),q=H?` ${H}`:"";return`<style data-stx-scoped="${k}"${q}>${V}</style>`}),!B)return{html:v,hasScoped:!1};return T=$y(T,R),{html:T,hasScoped:!0}}function wy(v,_){return of(v,"__SCOPE_PLACEHOLDER__",{preserveHost:!1}).replace(/\.(__SCOPE_PLACEHOLDER__) /g,`[${_}] `).replace(/\.(__SCOPE_PLACEHOLDER__)/g,`[${_}]`)}var Sy=(v)=>`\x00stx-scope-mask-${v}\x00`,lf=/\u0000stx-scope-mask-(\d+)\u0000/g;function $y(v,_){let k=On(v,(T,B)=>{let z=U(T,B);return z>B?z:Qr(T,B)},(T,B)=>Sy(B)),R=_y(k.output,_);return lf.lastIndex=0,R.replace(lf,(T,B)=>k.tokens[Number(B)])}function _y(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,(R,T,B)=>{if(k.has(T.toLowerCase()))return R;if(R.includes(_))return R;if(T.toLowerCase()==="style"||T.toLowerCase()==="script")return R;if(B)return R.replace(`<${T}${B}`,`<${T} ${_}${B}`);if(R.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 jn=null,Ko="";function pf(v){try{let _=v.startsWith("file:")?new URL(v).pathname:v;Ko=`${_}@${Math.trunc(Yi.statSync(_).mtimeMs)}`}catch{Ko=v}}var Jc=!1,Lr=null,Ji="",rs=!1,hf=256,br=new Map,Ln=new Map,Xo=null,yf=null,Go=new Map;function Jo(v){return Bun.hash(v).toString(16).padStart(16,"0").slice(0,16)}function Gc(v,_){if(br.has(v))br.delete(v);else if(br.size>=hf)br.delete(br.keys().next().value);br.set(v,_)}function ky(v){let _=Jo(v);if(Ln.has(_))Ln.delete(_);else if(Ln.size>=hf)Ln.delete(Ln.keys().next().value);return Ln.set(_,v),_}function Qu(v){let _=Ln.get(v);if(_===void 0)return;return Ln.delete(v),Ln.set(v,_),_}async function Ey(v,_=Xo){if(!_)return null;try{let k=Bun.file(jt.join(_,`cw-${Jo(v)}.css`));if(!await k.exists())return null;return await k.text()}catch{return null}}async function Cy(v,_,k=Xo){if(!k)return;try{if(!Yi.existsSync(k))Yi.mkdirSync(k,{recursive:!0});await Bun.write(jt.join(k,`cw-${Jo(v)}.css`),_)}catch{}}async function gf(v){try{let _=await import(v);if(_&&_.CSSGenerator)return{CSSGenerator:_.CSSGenerator,config:_.config,build:_.build,defaultConfig:_.defaultConfig,extractClasses:_.extractClasses}}catch{}return null}var Ry=[["@stacksjs","ts-css","dist","engine","index.js"],["@stacksjs","ts-css","src","engine","index.ts"]],Ty=["@stacksjs/ts-css/engine","@stacksjs/ts-css/dist/engine/index.js"];function Ay(){let v=[],_=process.cwd();while(_!==jt.dirname(_)){for(let k of["node_modules","pantry"])for(let R of Ry)v.push(jt.join(_,k,...R));_=jt.dirname(_)}return v}function Iy(){let v=[],_=process.env.HOME||process.env.USERPROFILE||"",k=[_&&jt.join(_,"Code","Tools","ts-css"),_&&jt.join(_,"Code","Tools","crosswind"),_&&jt.join(_,"repos","stacks-org","ts-css"),_&&jt.join(_,"repos","stacks-org","crosswind"),jt.join(process.cwd(),"..","ts-css"),jt.join(process.cwd(),"..","crosswind")].filter(Boolean);for(let R of k)v.push(jt.join(R,"packages","toolkit","dist","engine","index.js")),v.push(jt.join(R,"packages","toolkit","src","engine","index.ts"));if(_)v.push(jt.join(_,"Code","Tools","stx","node_modules","@stacksjs","ts-css","dist","engine","index.js"));return v}async function si(){if(Jc)return jn;Jc=!0;try{let v=async(T)=>{for(let B of T){if(!await Bun.file(B).exists())continue;let z=await gf(B);if(z){if(pf(B),!process.env.STACKS_DEV_QUIET)console.log(`${e.green}[ts-css]${e.reset} CSS engine loaded from ${jt.dirname(jt.dirname(B))}`);return z}}return null};if(process.env.CROSSWIND_SRC){let T=jt.resolve(process.env.CROSSWIND_SRC),B=await v([T]);if(!B)throw Error(`CROSSWIND_SRC did not resolve to a Css module: ${T}`);return jn=B,jn}let _=await v(Ay());if(_)return jn=_,jn;let k=Ty;for(let T of k){let B=await gf(T);if(B){jn=B;try{pf(import.meta.resolve(T))}catch{Ko=T}if(!process.env.STACKS_DEV_QUIET)console.log(`${e.green}[ts-css]${e.reset} CSS engine loaded`);return jn}}let R=await v(Iy());if(R)return jn=R,jn;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 ed(){Yc.clear(),jn=null,Jc=!1,Lr=null,Ji="",br.clear(),Ln.clear(),yf=null,Go.clear()}var mf=!1;async function oi(v){try{let _=ff({name:"css",cwd:v})?"css":ff({name:"crosswind",cwd:v})?"crosswind":null;if(!_)return null;if(_==="crosswind"&&!process.env.STACKS_DEV_QUIET&&!mf)mf=!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"),R=await k({name:_,cwd:v,defaultConfig:{},checkEnv:!1,verbose:!1});if(!R?.path||!R.config||Object.keys(R.config).length===0)return null;let T=jt.relative(v,R.path);if(!process.env.STACKS_DEV_QUIET)console.log(`${e.green}[ts-css]${e.reset} Loaded config from ${T||R.path}`);return R.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 vc(v){let _=null;try{let{loadStxConfig:k}=await import("./chunk-2927nax9.js"),R=await k(v);if(R.css)if(typeof R.css==="string"){let T=jt.isAbsolute(R.css)?R.css:jt.resolve(v,R.css);if(await Bun.file(T).exists()){let B=await import(T);_=B.default||B,console.log(`${e.green}[ts-css]${e.reset} Loaded config from stx.config.ts \u2192 ${R.css}`)}}else{if(_={...R.css,content:R.css.content||[],preflight:R.css.preflight??!0,minify:R.css.minify??!1},R.css.config){let T=jt.isAbsolute(R.css.config)?R.css.config:jt.resolve(v,R.css.config);if(await Bun.file(T).exists()){let B=await import(T);_={...B.default||B,..._}}}console.log(`${e.green}[ts-css]${e.reset} Using inline CSS config from stx.config.ts`)}}catch{}return _||await oi(v)}function wc(v){try{let _=new WeakSet;return Jo(JSON.stringify(v??{},(k,R)=>{if(typeof R==="function")return`[fn]${String(R)}`;if(typeof R==="object"&&R!==null){if(_.has(R))return"[circular]";_.add(R)}return R})??"")}catch{return"unhashable"}}async function $t(v){if(rs)return Ji;rs=!0;try{let _=await si();if(!_||!_.build)return rs=!1,"";if(!Lr)Lr=await oi(v);if(!Lr)return rs=!1,"";let k=_.defaultConfig?.theme||{},R=Lr.theme||{},T={..._.defaultConfig,...Lr,theme:{...k,...R,extend:{...k.extend||{},...R.extend||{}}}},B=performance.now(),z=await _.build(T),W=performance.now()-B;if(Ji=z.css,console.log(`${e.cyan}[ts-css]${e.reset} Built ${z.classes.size} classes in ${W.toFixed(1)}ms`),T.output){let F=jt.isAbsolute(T.output)?T.output:jt.join(v,T.output),V=jt.dirname(F);if(!Yi.existsSync(V))Yi.mkdirSync(V,{recursive:!0});await Bun.write(F,z.css)}return rs=!1,z.css}catch(_){return console.error(`${e.red}[ts-css]${e.reset} Build error:`,_),rs=!1,Ji}}async function pn(v){Lr=null,await $t(v)}function td(){return Ji}function xc(v){let _=new Set,k=/class\s*=\s*["']([^"']+)["']/gi,R=k.exec(v);while(R!==null){for(let z of R[1].split(/\s+/))if(z.trim())_.add(z.trim());R=k.exec(v)}let T=/(?:x-class|:class)\s*=\s*"([^"]+)"/gi,B=T.exec(v);while(B!==null){let z=B[1].match(/'([^']+)'/g);if(z){for(let W of z)for(let F of W.slice(1,-1).split(/\s+/))if(F.trim())_.add(F.trim())}B=T.exec(v)}return _}var Yc=m(64);async function Sc(v,_){let k=()=>Go.get(_?jt.resolve(_):process.cwd())?.fingerprint??null,R=Yc.get(h(v,_,k()));if(R!==void 0)return R;let T=await Py(v,_);if(T)Yc.set(h(v,_,k()),T);return T}function*xf(v){yield v;let _=new Set;for(let k of v.matchAll(/\/_stx\/modules\.([0-9a-f]{16})\.js/g)){let R=k[1];if(_.has(R))continue;_.add(R);let T=ri(R);if(T)yield T}}function nd(v){return[...xf(v)].join(`
146
+ `)}async function Py(v,_){try{let k=await si();if(!k)return"";let R=new Set;for(let Re of xf(v)){let Ae=typeof k.extractClasses==="function"?k.extractClasses(Re):xc(Re);for(let Ie of Ae)R.add(Ie)}if(R.size===0)return"";let T=_?jt.resolve(_):process.cwd(),B=a(T,"cache");if(!Xo)Xo=B;let z=Go.get(T);if(!z){let Re=await vc(T);z={config:Re,fingerprint:wc(Re)},Go.set(T,z),yf=z.fingerprint}let W=[...R].sort().join(" "),F=`${Ko}::${z.fingerprint||"default"}::${W}`,V=br.get(F);if(V!==void 0)return Gc(F,V),V;let H=await Ey(F,B);if(H!==null)return Gc(F,H),H;let q=k.defaultConfig||k.config,Q=z.config||{},Z=rf(q,Q),{safelist:se,includePreflight:ie,minify:oe,tokenCSS:ae}=Z,le=Z.config,ce=new k.CSSGenerator(le),ge=le.shortcuts||Q.shortcuts||{},$e=Object.keys(ge).filter((Re)=>R.has(Re)||se.includes(Re));for(let Re of se)if(!ge[Re])ce.generate(Re);for(let Re of R)if(!ge[Re])ce.generate(Re);let ye="";if($e.length>0){let Re=new k.CSSGenerator(le);for(let Ae of $e)Re.generate(Ae);if(ye=Re.toCSS(!1,oe),ye&&!ye.endsWith(`
147
147
  `))ye+=`
148
148
  `}let ke=ye+ce.toCSS(ie,oe);return ke=nf(k.CSSGenerator,Z)+ae+ke,Gc(F,ke),Cy(F,ke,B),ke}catch(k){return console.warn("Failed to generate Css CSS:",k),""}}async function f(v,_,k=!1,R=!1){let T=await Sc(v,_);if(!T)return R?Gi(v):v;let B=k?`<link data-css="generated" rel="stylesheet" href="/_stx/css.${ky(T)}.css">`:`<style data-css="generated">
149
149
  ${T}
@@ -1099,7 +1099,7 @@ else {
1099
1099
  };
1100
1100
  })();
1101
1101
  </script>
1102
- `}function If(v,_){let k=Af(_);if(!k)return v;let R=v.lastIndexOf("</body>");if(R!==-1)return v.slice(0,R)+k+v.slice(R);return v+k}var Pf={name:"heatmap",hasEndTag:!1,description:"Inject privacy-compliant heatmap tracking script",handler:async(v,_,k,R)=>{let T=k.__stx_config||{};if(_.length>0){let B=qy(_.join(" "));T.heatmap={...T.heatmap,...B,enabled:!0}}return Af(T)}};function qy(v){let _={},k=v.match(/(\w+)=["']?([^"'\s]+)["']?/g)||[];for(let R of k){let[T,B]=R.split("="),z=B?.replace(/["']/g,"");switch(T){case"endpoint":_.endpoint=z;break;case"samplingRate":_.samplingRate=Number.parseInt(z,10);break;case"batchSize":_.batchSize=Number.parseInt(z,10);break;case"trackMouse":_.trackMouse=z==="true";break;case"trackClicks":_.trackClicks=z==="true";break;case"trackScroll":_.trackScroll=z==="true";break;case"honorDnt":_.honorDnt=z==="true";break;case"debugOverlay":_.debugOverlay=z==="true";break}}return _}var lr={duration:300,delay:0,ease:"ease",direction:"both"};function Ky(v,_={}){let{duration:k,delay:R,ease:T,direction:B,custom:z}={...lr,..._};if(v==="custom"&&z)return z;switch(v){case"fade":return`${B==="in"?"opacity: 0; animation: fadeIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":B==="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);"}
1102
+ `}function If(v,_){let k=Af(_);if(!k)return v;let R=v.lastIndexOf("</body>");if(R!==-1)return v.slice(0,R)+k+v.slice(R);return v+k}var Pf={name:"heatmap",hasEndTag:!1,description:"Inject privacy-compliant heatmap tracking script",handler:async(v,_,k,R)=>{let T=k.__stx_config||{};if(_.length>0){let B=qy(_.join(" "));T.heatmap={...T.heatmap,...B,enabled:!0}}return Af(T)}};function qy(v){let _={},k=v.match(/(\w+)=["']?([^"'\s]+)["']?/g)||[];for(let R of k){let[T,B]=R.split("="),z=B?.replace(/["']/g,"");switch(T){case"endpoint":_.endpoint=z;break;case"samplingRate":_.samplingRate=Number.parseInt(z,10);break;case"batchSize":_.batchSize=Number.parseInt(z,10);break;case"trackMouse":_.trackMouse=z==="true";break;case"trackClicks":_.trackClicks=z==="true";break;case"trackScroll":_.trackScroll=z==="true";break;case"honorDnt":_.honorDnt=z==="true";break;case"debugOverlay":_.debugOverlay=z==="true";break}}return _}var Hn={duration:300,delay:0,ease:"ease",direction:"both"};function Ky(v,_={}){let{duration:k,delay:R,ease:T,direction:B,custom:z}={...Hn,..._};if(v==="custom"&&z)return z;switch(v){case"fade":return`${B==="in"?"opacity: 0; animation: fadeIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":B==="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);"}
1103
1103
  @keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
1104
1104
  @keyframes fadeOut { from { opacity: 1; } to { opacity: 0; } }`;case"slide":return`${B==="in"?"transform: translateY(20px); opacity: 0; animation: slideIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":B==="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);"}
1105
1105
  @keyframes slideIn { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@@ -1332,11 +1332,11 @@ else {
1332
1332
  }
1333
1333
  })();
1334
1334
  </script>
1335
- `}var Df={name:"transition",handler:(v,_,k,R)=>{if(_.length<1)return`<div class="stx-error">@transition directive requires at least a transition type</div>${v}`;let T=_[0],B=_.length>1?Number.parseInt(_[1],10)||lr.duration:lr.duration,z=_.length>2?_[2]||lr.ease:lr.ease,W=_.length>3?Number.parseInt(_[3],10)||lr.delay:lr.delay,F=_.length>4?_[4]||lr.direction:lr.direction,V=`stx-transition-${Math.random().toString(36).substr(2,9)}`,H=Ky(T,{duration:B,delay:W,ease:z,direction:F}),q="stx-transition",Q="";if(T==="fade")Q="stx-fade";else if(T==="slide")Q="stx-slide";else if(T==="scale")Q="stx-scale";else if(T==="flip")Q="stx-flip";else if(T==="rotate")Q="stx-rotate";return`<div id="${V}" class="${q} ${Q} ${F==="out"?"stx-out":""}"
1335
+ `}var Df={name:"transition",handler:(v,_,k,R)=>{if(_.length<1)return`<div class="stx-error">@transition directive requires at least a transition type</div>${v}`;let T=_[0],B=_.length>1?Number.parseInt(_[1],10)||Hn.duration:Hn.duration,z=_.length>2?_[2]||Hn.ease:Hn.ease,W=_.length>3?Number.parseInt(_[3],10)||Hn.delay:Hn.delay,F=_.length>4?_[4]||Hn.direction:Hn.direction,V=`stx-transition-${Math.random().toString(36).substr(2,9)}`,H=Ky(T,{duration:B,delay:W,ease:z,direction:F}),q="stx-transition",Q="";if(T==="fade")Q="stx-fade";else if(T==="slide")Q="stx-slide";else if(T==="scale")Q="stx-scale";else if(T==="flip")Q="stx-flip";else if(T==="rotate")Q="stx-rotate";return`<div id="${V}" class="${q} ${Q} ${F==="out"?"stx-out":""}"
1336
1336
  style="--stx-transition-duration: ${B}ms; --stx-transition-ease: ${z}; --stx-transition-delay: ${W}ms;">${v}</div>`},hasEndTag:!0,description:"Applies transition effects to an element"},Mf={name:"scrollAnimate",handler:(v,_,k,R)=>{if(_.length<1)return`<div class="stx-error">@scrollAnimate directive requires at least an animation type</div>${v}`;let T=_[0],B=_.length>1?Number.parseInt(_[1],10)||300:300,z=_.length>2?_[2]||"ease":"ease",W=_.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: ${B}ms; --stx-transition-ease: ${z}; --stx-transition-delay: ${F}ms; will-change: opacity, transform;`,q="stx-transition stx-observe stx-out";if(T==="fade")q+=" stx-fade";else if(T==="slide-up"||T==="slide")q+=" stx-from-bottom";else if(T==="slide-down")q+=" stx-from-top";else if(T==="slide-left")q+=" stx-from-right";else if(T==="slide-right")q+=" stx-from-left";else if(T==="scale")q+=" stx-scale";else if(T.includes("-"))q+=` stx-${T}`;else q+=` stx-${T}`;return`<div id="${V}" class="${q}" style="${H}" data-threshold="${W}">${v}</div>`},hasEndTag:!0,description:"Applies animations that trigger when scrolled into view"},Of={name:"animationGroup",handler:(v,_,k,R)=>{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],B=_.slice(1).map((V)=>V.startsWith("#")||V.startsWith(".")?V:`#${V}`),z=k.staggerDelay||50,W=k.sequence||!0,F=Yy(T,B,{staggerDelay:z,sequence:W});return`${v}
1337
1337
  ${F}`},hasEndTag:!1,description:"Coordinates multiple animations together as a group"},Nf={name:"motion",handler:(v,_,k,R)=>{let T=_.length>0?_[0].toLowerCase()==="true":!0,B=Xy();return`<div data-animate="${T?"auto":"true"}">${v}</div>${B}`},hasEndTag:!0,description:"Controls motion and animation preferences"};function jf(v,_,k,R){let T=v;if(R.animation?.enabled===!1)return T;let B=k.includes("test")&&k.includes("animation");if(!Zy(T)&&!B)return T;if(!T.includes('<style id="stx-animation-base">')){let W=Jy();T=T.replace("</head>",`${W}
1338
1338
  </head>`)}if(T.includes("stx-observe")){if(!T.includes("Intersection Observer for scroll animations")){let F=Gy(),V=T.lastIndexOf("</body>");if(V!==-1)T=T.slice(0,V)+F+`
1339
- `+T.slice(V)}}return T}function He(v){let _=v.match(/\bdefinePageMeta\s*\(\s*(\{[\s\S]*?\})\s*\)/m);if(!_)return null;try{return Function(`return ${_[1]}`)()}catch{return null}}function Lf(v){let _=v?.layout;if(_===!1)return!1;return typeof _==="string"&&_.trim()?_.trim():void 0}var Qy=100,ex=599,nl="__stxResponseStatus",eo="__stxResponseHeaders";function Yo(v){return typeof v==="number"&&Number.isInteger(v)&&v>=Qy&&v<=ex}function Rt(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 R=Number(k[1]);if(Yo(R))return R}return}function tl(v,_){if(!v||typeof v!=="object")return!1;let k=typeof _==="string"&&/^\d+$/.test(_.trim())?Number(_.trim()):_;if(!Yo(k))return!1;return v[nl]=k,!0}function tx(v,_,k){if(!v||typeof v!=="object")return;let R=String(_??"").trim();if(!R)return;v[eo]={...v[eo],[R]:String(k)}}function Ue(v){let _=v?.[nl];return Yo(_)?_:void 0}function Ve(v){let _=v?.[eo];if(!_||typeof _!=="object")return;let k=Object.entries(_).map(([R,T])=>[R,String(T)]);return k.length>0?Object.fromEntries(k):void 0}function ii(v,_){if(!v||!_||v===_||typeof _!=="object")return;let k=Ue(v);if(k!==void 0)_[nl]=k;let R=Ve(v);if(R)_[eo]={..._[eo],...R}}function Jn(v){return{setResponseStatus:(_)=>{tl(v,_)},notFound:(_=404)=>{let k=Yo(_)&&_>=400?_:404;tl(v,k)},setResponseHeader:(_,k)=>{tx(v,_,k)}}}function Bf(v,_,k={}){if(!v.includes("@status"))return v;let{filePath:R,buildMode:T}=k,B=T==="compile",z="",W=0,F=/@status\s*\(/g,V;while((V=F.exec(v))!==null){let H=nx(v,V.index+V[0].length-1);if(H<0)break;let q=v.slice(V.index+V[0].length,H).trim(),Q=/^\d+$/.test(q)?Number(q):l(q,_),Z=R?` in ${R}`:"";if(B)console.warn(`[stx] @status(${q})${Z} 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(${q}) from <script server> instead \u2014 that runs per request.`);else if(!tl(_,Q))console.warn(`[stx] @status(${q})${Z} is not an HTTP status (100-599) \u2014 ignoring it.`);z+=v.slice(W,V.index),W=H+1+(v.slice(H+1).match(/^[^\S\n]*\n?/)?.[0].length??0),F.lastIndex=W}return W===0?v:z+v.slice(W)}function nx(v,_){let k=1,R=null,T=!1;for(let B=_+1;B<v.length;B++){let z=v[B];if(T){T=!1;continue}if(R){if(z==="\\")T=!0;else if(z===R)R=null;continue}if(z==='"'||z==="'"||z==="`"){R=z;continue}if(z==="(")k++;else if(z===")"&&--k===0)return B}return-1}var rx=0,sx=0;function zf(v,_){let k=v.match(new RegExp(`${_}\\s*=\\s*"([^"]*)"`,"i"));if(k)return k[1];let R=v.match(new RegExp(`${_}\\s*=\\s*'([^']*)'`,"i"));if(R)return R[1];return null}function ix(v){let _=[],k=/<([a-z][a-z0-9-]*)\s+([^>]*x-data\s*=\s*(?:"[^"]*"|'[^']*')[^>]*)>/gi,R;while((R=k.exec(v))!==null){let[T,B,z]=R,W=R.index,F=zf(z,"x-data");if(!F)continue;let V=`__stx_scope_${rx++}`,H=zf(z,"x-init"),q=ox(v,B,W+T.length),Q=v.slice(W,q.endIndex),Z=ax(Q);_.push({id:V,selector:`[data-stx-scope="${V}"]`,stateExpr:F,initExpr:H,bindings:[],refs:Z})}return _}function ox(v,_,k){let R=1,T=k,B=new RegExp(`<${_}(?:\\s|>)`,"gi"),z=new RegExp(`</${_}>`,"gi"),W=new RegExp(`<${_}[^>]*/\\s*>`,"gi");while(R>0&&T<v.length){B.lastIndex=T,z.lastIndex=T,W.lastIndex=T;let F=B.exec(v),V=z.exec(v),H=W.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)R++,T=F.index+F[0].length;else{if(R--,R===0)return{endIndex:V.index+V[0].length};T=V.index+V[0].length}}return{endIndex:v.length}}function ax(v){let _=new Map,k=v.replace(/x-data\s*=\s*"[^"]*"/gi,'x-data="__stripped__"').replace(/x-data\s*=\s*'[^']*'/gi,"x-data='__stripped__'"),R=/<[a-z][a-z0-9-]*\s+([^>]*x-ref\s*=\s*["']([^"']*)["'][^>]*)>/gi,T;while((T=R.exec(k))!==null){let[,B,z]=T,W=cx(B);_.set(z,W)}return _}function cx(v){let _=v.match(/\bid\s*=\s*["']([^"']*)["']/);if(_)return _[1];return`__stx_el_${sx++}`}function lx(){return`
1339
+ `+T.slice(V)}}return T}function He(v){let _=v.match(/\bdefinePageMeta\s*\(\s*(\{[\s\S]*?\})\s*\)/m);if(!_)return null;try{return Function(`return ${_[1]}`)()}catch{return null}}function Lf(v){let _=v?.layout;if(_===!1)return!1;return typeof _==="string"&&_.trim()?_.trim():void 0}var Qy=100,ex=599,nl="__stxResponseStatus",eo="__stxResponseHeaders";function Yo(v){return typeof v==="number"&&Number.isInteger(v)&&v>=Qy&&v<=ex}function Rt(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 R=Number(k[1]);if(Yo(R))return R}return}function tl(v,_){if(!v||typeof v!=="object")return!1;let k=typeof _==="string"&&/^\d+$/.test(_.trim())?Number(_.trim()):_;if(!Yo(k))return!1;return v[nl]=k,!0}function tx(v,_,k){if(!v||typeof v!=="object")return;let R=String(_??"").trim();if(!R)return;v[eo]={...v[eo],[R]:String(k)}}function Ue(v){let _=v?.[nl];return Yo(_)?_:void 0}function Ve(v){let _=v?.[eo];if(!_||typeof _!=="object")return;let k=Object.entries(_).map(([R,T])=>[R,String(T)]);return k.length>0?Object.fromEntries(k):void 0}function ii(v,_){if(!v||!_||v===_||typeof _!=="object")return;let k=Ue(v);if(k!==void 0)_[nl]=k;let R=Ve(v);if(R)_[eo]={..._[eo],...R}}function Yn(v){return{setResponseStatus:(_)=>{tl(v,_)},notFound:(_=404)=>{let k=Yo(_)&&_>=400?_:404;tl(v,k)},setResponseHeader:(_,k)=>{tx(v,_,k)}}}function Bf(v,_,k={}){if(!v.includes("@status"))return v;let{filePath:R,buildMode:T}=k,B=T==="compile",z="",W=0,F=/@status\s*\(/g,V;while((V=F.exec(v))!==null){let H=nx(v,V.index+V[0].length-1);if(H<0)break;let q=v.slice(V.index+V[0].length,H).trim(),Q=/^\d+$/.test(q)?Number(q):l(q,_),Z=R?` in ${R}`:"";if(B)console.warn(`[stx] @status(${q})${Z} 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(${q}) from <script server> instead \u2014 that runs per request.`);else if(!tl(_,Q))console.warn(`[stx] @status(${q})${Z} is not an HTTP status (100-599) \u2014 ignoring it.`);z+=v.slice(W,V.index),W=H+1+(v.slice(H+1).match(/^[^\S\n]*\n?/)?.[0].length??0),F.lastIndex=W}return W===0?v:z+v.slice(W)}function nx(v,_){let k=1,R=null,T=!1;for(let B=_+1;B<v.length;B++){let z=v[B];if(T){T=!1;continue}if(R){if(z==="\\")T=!0;else if(z===R)R=null;continue}if(z==='"'||z==="'"||z==="`"){R=z;continue}if(z==="(")k++;else if(z===")"&&--k===0)return B}return-1}var rx=0,sx=0;function zf(v,_){let k=v.match(new RegExp(`${_}\\s*=\\s*"([^"]*)"`,"i"));if(k)return k[1];let R=v.match(new RegExp(`${_}\\s*=\\s*'([^']*)'`,"i"));if(R)return R[1];return null}function ix(v){let _=[],k=/<([a-z][a-z0-9-]*)\s+([^>]*x-data\s*=\s*(?:"[^"]*"|'[^']*')[^>]*)>/gi,R;while((R=k.exec(v))!==null){let[T,B,z]=R,W=R.index,F=zf(z,"x-data");if(!F)continue;let V=`__stx_scope_${rx++}`,H=zf(z,"x-init"),q=ox(v,B,W+T.length),Q=v.slice(W,q.endIndex),Z=ax(Q);_.push({id:V,selector:`[data-stx-scope="${V}"]`,stateExpr:F,initExpr:H,bindings:[],refs:Z})}return _}function ox(v,_,k){let R=1,T=k,B=new RegExp(`<${_}(?:\\s|>)`,"gi"),z=new RegExp(`</${_}>`,"gi"),W=new RegExp(`<${_}[^>]*/\\s*>`,"gi");while(R>0&&T<v.length){B.lastIndex=T,z.lastIndex=T,W.lastIndex=T;let F=B.exec(v),V=z.exec(v),H=W.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)R++,T=F.index+F[0].length;else{if(R--,R===0)return{endIndex:V.index+V[0].length};T=V.index+V[0].length}}return{endIndex:v.length}}function ax(v){let _=new Map,k=v.replace(/x-data\s*=\s*"[^"]*"/gi,'x-data="__stripped__"').replace(/x-data\s*=\s*'[^']*'/gi,"x-data='__stripped__'"),R=/<[a-z][a-z0-9-]*\s+([^>]*x-ref\s*=\s*["']([^"']*)["'][^>]*)>/gi,T;while((T=R.exec(k))!==null){let[,B,z]=T,W=cx(B);_.set(z,W)}return _}function cx(v){let _=v.match(/\bid\s*=\s*["']([^"']*)["']/);if(_)return _[1];return`__stx_el_${sx++}`}function lx(){return`
1340
1340
  // STX Reactive Runtime - x-cloak and transition CSS
1341
1341
  (function() {
1342
1342
  var style = document.createElement('style');
@@ -1601,10 +1601,10 @@ window.__stx_reactive = (function() {
1601
1601
  ${lx()}
1602
1602
  ${k}
1603
1603
  </script>`}function Ff(v,_,k){if(!fx(v))return v;let R=ix(v);if(R.length===0)return v;let T=dx(v,R),B=ux(R,_),z=T.lastIndexOf("</body>");if(z!==-1)T=T.slice(0,z)+B+`
1604
- `+T.slice(z);else T+=B;return T}function dx(v,_){let k=0,R=v.replace(/<([a-z][a-z0-9-]*)(\s+[^>]*x-data\s*=\s*(?:"[^"]*"|'[^']*')[^>]*)>/gi,(T,B,z)=>{let W=_[k++];if(!W)return T;let F=/data-stx-scope="([^"]*)"/.exec(z);if(F)return W.id=F[1],W.selector=`[data-stx-scope="${W.id}"]`,T;return`<${B} data-stx-scope="${W.id}"${z}>`});return R=R.replace(/\s*x-data\s*=\s*"([^"]*)"/g,' data-stx-xdata="$1"'),R=R.replace(/\s*x-data\s*=\s*'([^']*)'/g," data-stx-xdata='$1'"),R=R.replace(/\s*x-init\s*=\s*"([^"]*)"/g,' data-stx-xinit="$1"'),R=R.replace(/\s*x-init\s*=\s*'([^']*)'/g," data-stx-xinit='$1'"),R}function fx(v){return/x-data\s*=\s*["']/.test(v)}import Gx from"fs";import ml from"path";import{createHighlighter as Jx}from"ts-syntax-highlighter";import Os from"fs";import Jt from"path";import{loadConfigWithResult as Ux}from"bunfig";async function px(v,_,k,R){let T=_[0]?.replace(/['"]/g,"")||"main",B=Te();if(T!=="main")B=B.replace("container:'main'",`container:'${T}'`);return`<script data-stx-router>${B}</script>`}var Vf={name:"stxRouter",handler:px,hasEndTag:!1,description:"Inject the STX SPA router script for client-side navigation"};function wr(v){return v.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function Uf(v){let _=v.trim().toLowerCase();return!_.startsWith("javascript:")&&!_.startsWith("vbscript:")&&!_.startsWith("data:text/html")}function Wn(v){let _=/^---\r?\n([\s\S]*?)\r?\n---\r?\n/,k=v.match(_);if(!k)return{data:{},content:v.trim()};let R=k[1],T=v.slice(k[0].length),B={};for(let z of R.split(`
1605
- `)){let W=z.trim();if(!W||W.startsWith("#"))continue;let F=W.indexOf(":");if(F===-1)continue;let V=W.slice(0,F).trim(),H=W.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)}B[V]=H}return{data:B,content:T.trim()}}function Be(v,_={}){let{gfm:k=!0,breaks:R=!1}=_,T=v,B=[];if(T=T.replace(/```(\w*)\n([\s\S]*?)```/g,(H,q,Q)=>{let Z=B.length,se=q?` class="language-${wr(q)}"`:"";return B.push(`<pre><code${se}>${wr(Q.trim())}</code></pre>`),`\x00CODEBLOCK${Z}\x00`}),T=T.replace(/`([^`]*)`/g,(H,q)=>`<code>${wr(q)}</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,q,Q)=>`<img src="${Uf(Q)?wr(Q):""}" alt="${wr(q)}" />`),T=T.replace(/\[([^\]]+)\]\(([^)]+)\)/g,(H,q,Q)=>`<a href="${Uf(Q)?wr(Q):""}">${q}</a>`),T=T.replace(/^(?:---|\*\*\*|___)\s*$/gm,"<hr />"),T=T.replace(/^>\s+(.*)$/gm,"<blockquote>$1</blockquote>"),T=T.replace(/<\/blockquote>\n<blockquote>/g,`
1606
- `),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,q,Q)=>{let se=`<tr>${q.split("|").map((oe)=>oe.trim()).filter(Boolean).map((oe)=>`<th>${wr(oe)}</th>`).join("")}</tr>`,ie=Q.trim().split(`
1607
- `).map((oe)=>`<tr>${oe.split("|").map((le)=>le.trim()).filter(Boolean).map((le)=>`<td>${wr(le)}</td>`).join("")}</tr>`).join(`
1604
+ `+T.slice(z);else T+=B;return T}function dx(v,_){let k=0,R=v.replace(/<([a-z][a-z0-9-]*)(\s+[^>]*x-data\s*=\s*(?:"[^"]*"|'[^']*')[^>]*)>/gi,(T,B,z)=>{let W=_[k++];if(!W)return T;let F=/data-stx-scope="([^"]*)"/.exec(z);if(F)return W.id=F[1],W.selector=`[data-stx-scope="${W.id}"]`,T;return`<${B} data-stx-scope="${W.id}"${z}>`});return R=R.replace(/\s*x-data\s*=\s*"([^"]*)"/g,' data-stx-xdata="$1"'),R=R.replace(/\s*x-data\s*=\s*'([^']*)'/g," data-stx-xdata='$1'"),R=R.replace(/\s*x-init\s*=\s*"([^"]*)"/g,' data-stx-xinit="$1"'),R=R.replace(/\s*x-init\s*=\s*'([^']*)'/g," data-stx-xinit='$1'"),R}function fx(v){return/x-data\s*=\s*["']/.test(v)}import Gx from"fs";import ml from"path";import{createHighlighter as Jx}from"ts-syntax-highlighter";import Os from"fs";import Jt from"path";import{loadConfigWithResult as Ux}from"bunfig";async function px(v,_,k,R){let T=_[0]?.replace(/['"]/g,"")||"main",B=Te();if(T!=="main")B=B.replace("container:'main'",`container:'${T}'`);return`<script data-stx-router>${B}</script>`}var Vf={name:"stxRouter",handler:px,hasEndTag:!1,description:"Inject the STX SPA router script for client-side navigation"};function vr(v){return v.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function Uf(v){let _=v.trim().toLowerCase();return!_.startsWith("javascript:")&&!_.startsWith("vbscript:")&&!_.startsWith("data:text/html")}function qn(v){let _=/^---\r?\n([\s\S]*?)\r?\n---\r?\n/,k=v.match(_);if(!k)return{data:{},content:v.trim()};let R=k[1],T=v.slice(k[0].length),B={};for(let z of R.split(`
1605
+ `)){let W=z.trim();if(!W||W.startsWith("#"))continue;let F=W.indexOf(":");if(F===-1)continue;let V=W.slice(0,F).trim(),H=W.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)}B[V]=H}return{data:B,content:T.trim()}}function Be(v,_={}){let{gfm:k=!0,breaks:R=!1}=_,T=v,B=[];if(T=T.replace(/```(\w*)\n([\s\S]*?)```/g,(H,q,Q)=>{let Z=B.length,se=q?` class="language-${vr(q)}"`:"";return B.push(`<pre><code${se}>${vr(Q.trim())}</code></pre>`),`\x00CODEBLOCK${Z}\x00`}),T=T.replace(/`([^`]*)`/g,(H,q)=>`<code>${vr(q)}</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,q,Q)=>`<img src="${Uf(Q)?vr(Q):""}" alt="${vr(q)}" />`),T=T.replace(/\[([^\]]+)\]\(([^)]+)\)/g,(H,q,Q)=>`<a href="${Uf(Q)?vr(Q):""}">${q}</a>`),T=T.replace(/^(?:---|\*\*\*|___)\s*$/gm,"<hr />"),T=T.replace(/^>\s+(.*)$/gm,"<blockquote>$1</blockquote>"),T=T.replace(/<\/blockquote>\n<blockquote>/g,`
1606
+ `),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,q,Q)=>{let se=`<tr>${q.split("|").map((oe)=>oe.trim()).filter(Boolean).map((oe)=>`<th>${vr(oe)}</th>`).join("")}</tr>`,ie=Q.trim().split(`
1607
+ `).map((oe)=>`<tr>${oe.split("|").map((le)=>le.trim()).filter(Boolean).map((le)=>`<td>${vr(le)}</td>`).join("")}</tr>`).join(`
1608
1608
  `);return`<table>
1609
1609
  <thead>
1610
1610
  ${se}
@@ -1666,7 +1666,7 @@ ${ie}
1666
1666
  #${v}.stx-img-loaded img {
1667
1667
  opacity: 1;
1668
1668
  }
1669
- `.trim()}var ol=new Map;async function Zf(v,_={}){let k=`${v}:${JSON.stringify(_)}`;if(ol.has(k))return ol.get(k);let R=await xx(v,_);return ol.set(k,R),R}async function wx(){try{return await import("./chunk-7pp2vx1g.js")}catch(v){if(!Gf)console.warn("[stx-media] Image processor not available, some features disabled:",v),Gf=!0;return null}}var Gf=!1,cl=80,ta="async",na="lazy",Jf=!1;async function ea(v,_={}){let k=_,R=v;if(R.process&&!R.skipOptimization){if(k.tsImagesConfig?.enabled&&!k.isDev)return kx(R,k)}if(k.processedResult?.processed)return dl(v,k.processedResult,_);if(k.responsiveVariants)return ep(v,k.responsiveVariants,_);let{src:T,alt:B,width:z,height:W,sizes:F,widths:V=Ps,dpr:H,formats:q=to,quality:Q=cl,params:Z={},placeholder:se="none",placeholderOptions:ie={},lazy:oe=!0,priority:ae=!1,loading:le=ae?"eager":na,decoding:ce=ta,fetchpriority:ge,objectFit:$e,objectPosition:ye,crossorigin:ke,referrerpolicy:Re}=v,{class:Ae,style:Ie,id:Pe}=v,Ee=v.data||{},{isDev:Me=!1,baseUrl:je=""}=_;if(Me&&!_.optimize)return _x(v);let Ne,De,Le=Pe||`stx-img-${Math.random().toString(36).slice(2,8)}`;if(se!=="none"&&!ae)try{Ne=await Zf(T,{strategy:se,...ie}),De=Xf(Le,Ne,ie)}catch{}let ct=H!==void 0&&z!==void 0,yt;if(ct)yt=$x(v,Le,Ne,_);else yt=await Sx(v,Le,Ne,_);let pt;if(ae){let dt=q.includes("webp")?"webp":q[0],St=rl(T,V,{...Z,q:Q},dt),lt=typeof F==="object"?sl(F):F||"100vw";pt=`<link rel="preload" as="image" imagesrcset="${St}" imagesizes="${lt}" />`}let st=[];if(!Jf&&se!=="none")st.push(al),Jf=!0;if(De)st.push(De);let gt=oe?Qf(Le):void 0;return{html:yt,preloadLink:pt,css:st.length>0?st.join(`
1669
+ `.trim()}var ol=new Map;async function Zf(v,_={}){let k=`${v}:${JSON.stringify(_)}`;if(ol.has(k))return ol.get(k);let R=await xx(v,_);return ol.set(k,R),R}async function wx(){try{return await import("./chunk-c2nwchk0.js")}catch(v){if(!Gf)console.warn("[stx-media] Image processor not available, some features disabled:",v),Gf=!0;return null}}var Gf=!1,cl=80,ta="async",na="lazy",Jf=!1;async function ea(v,_={}){let k=_,R=v;if(R.process&&!R.skipOptimization){if(k.tsImagesConfig?.enabled&&!k.isDev)return kx(R,k)}if(k.processedResult?.processed)return dl(v,k.processedResult,_);if(k.responsiveVariants)return ep(v,k.responsiveVariants,_);let{src:T,alt:B,width:z,height:W,sizes:F,widths:V=Ps,dpr:H,formats:q=to,quality:Q=cl,params:Z={},placeholder:se="none",placeholderOptions:ie={},lazy:oe=!0,priority:ae=!1,loading:le=ae?"eager":na,decoding:ce=ta,fetchpriority:ge,objectFit:$e,objectPosition:ye,crossorigin:ke,referrerpolicy:Re}=v,{class:Ae,style:Ie,id:Pe}=v,Ee=v.data||{},{isDev:Me=!1,baseUrl:je=""}=_;if(Me&&!_.optimize)return _x(v);let Ne,De,Le=Pe||`stx-img-${Math.random().toString(36).slice(2,8)}`;if(se!=="none"&&!ae)try{Ne=await Zf(T,{strategy:se,...ie}),De=Xf(Le,Ne,ie)}catch{}let ct=H!==void 0&&z!==void 0,yt;if(ct)yt=$x(v,Le,Ne,_);else yt=await Sx(v,Le,Ne,_);let pt;if(ae){let dt=q.includes("webp")?"webp":q[0],St=rl(T,V,{...Z,q:Q},dt),lt=typeof F==="object"?sl(F):F||"100vw";pt=`<link rel="preload" as="image" imagesrcset="${St}" imagesizes="${lt}" />`}let st=[];if(!Jf&&se!=="none")st.push(al),Jf=!0;if(De)st.push(De);let gt=oe?Qf(Le):void 0;return{html:yt,preloadLink:pt,css:st.length>0?st.join(`
1670
1670
  `):void 0,script:gt}}async function Sx(v,_,k,R){let{src:T,alt:B,width:z,height:W,sizes:F,widths:V=Ps,formats:H=to,quality:q=cl,params:Q={},lazy:Z=!0,priority:se=!1,loading:ie=se?"eager":na,decoding:oe=ta,fetchpriority:ae,objectFit:le,objectPosition:ce,crossorigin:ge,referrerpolicy:$e}=v,{class:ye,style:ke}=v,Re=v.data||{},Ae=typeof F==="object"?sl(F):F||"100vw",Ie=[];for(let Me of H){let je=rl(T,V,{...Q,q},Me),Ne=il(Me);if(Z&&!se)Ie.push(` <source type="${Ne}" data-srcset="${je}" data-sizes="${Ae}" />`);else Ie.push(` <source type="${Ne}" srcset="${je}" sizes="${Ae}" />`)}let Pe=ll({src:no(T,{...Q,q}),alt:B,width:z,height:W,loading:se?void 0:ie,decoding:oe,fetchpriority:se?"high":ae,objectFit:le,objectPosition:ce,crossorigin:ge,referrerpolicy:$e,className:Yf(ye,k),style:ul(ke,le,ce,k),lazy:Z&&!se,data:Re}),Ee;if(k){let Me=`background-image: url('${k.dataURL}'); background-size: cover; background-position: center;`;Ee=`<div id="${_}" class="stx-img-placeholder" style="${Me}">
1671
1671
  <picture>
1672
1672
  ${Ie.join(`
@@ -1730,7 +1730,7 @@ ${$e.join(`
1730
1730
  `):void 0,script:je}}async function ep(v,_,k){let R={src:_.src,processed:!0,variants:[],placeholder:_.placeholder?.dataURL,originalWidth:_.placeholder?.width,originalHeight:_.placeholder?.height};for(let[T,B]of Object.entries(_.byFormat))if(B)R.variants.push(...B);return dl(v,R,k)}function Ex(){return Je({name:"img",hasEndTag:!1,description:"Render an optimized responsive image with srcset and lazy loading",transform:async(v,_,k,R)=>{let{src:T,alt:B,options:z}=Cx(v,_,k);if(!T)return console.warn("@img directive: missing src argument"),"<!-- @img: missing src -->";let W={src:T,alt:B||"",widths:z.widths||Ps,formats:z.formats||to,quality:z.quality,sizes:z.sizes,dpr:z.dpr,params:z.params,placeholder:z.placeholder,placeholderOptions:z.placeholderOptions,lazy:z.lazy!==!1,priority:z.priority||!1,loading:z.loading,decoding:z.decoding,fetchpriority:z.fetchpriority,objectFit:z.objectFit,objectPosition:z.objectPosition,class:z.class,style:z.style,id:z.id,width:z.width,height:z.height},F=k.__isDev||!1,V=await ea(W,{isDev:F}),H=V.html;if(V.preloadLink)H=V.preloadLink+`
1731
1731
  `+H;if(V.css)H+=`
1732
1732
  <style>${V.css}</style>`;if(V.script)H+=`
1733
- <script>${V.script}</script>`;return H},defaults:{src:"",alt:"",options:{lazy:!0,placeholder:"none"}}})}function Cx(v,_,k){if(_.src)return{src:String(_.src),alt:String(_.alt||""),options:_.options||{}};let R=v.trim();if(R.startsWith("@img(")||R.startsWith("("))R=R.replace(/^@img\(/,"").replace(/^\(/,"").replace(/\)$/,"");let T=Rx(R),B=fl(T[0],k)||"",z=fl(T[1],k)||"",W={};if(T[2]){let F=fl(T[2],k);if(typeof F==="object"&&F!==null)W=F;else if(typeof T[2]==="string")try{W=JSON.parse(T[2])}catch{}}return{src:B,alt:z,options:W}}function Rx(v){let _=[],k="",R=!1,T="",B=0,z=0;for(let W=0;W<v.length;W++){let F=v[W],V=W>0?v[W-1]:"";if((F==='"'||F==="'"||F==="`")&&V!=="\\"){if(!R)R=!0,T=F;else if(F===T)R=!1,T="";else k+=F;continue}if(!R){if(F==="{")B++;if(F==="}")B--;if(F==="[")z++;if(F==="]")z--;if(F===","&&B===0&&z===0){_.push(k.trim()),k="";continue}}k+=F}if(k.trim())_.push(k.trim());return _}function fl(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 R=_[k];if(R!==void 0)return R}if(k.startsWith("{")||k.startsWith("["))try{return JSON.parse(k)}catch{}return k}var tp=Ex();async function rp(){try{return await import("./chunk-2v73cjbc.js")}catch(v){if(!np)console.warn("[stx-media] Video processor not available, some features disabled:",v),np=!0;return null}}var np=!1,sp=!0,ip="metadata",Tx="https://cdn.jsdelivr.net/npm/ts-video-player@latest/dist/index.min.js";async function ra(v,_={}){let k=_,R=v;if(R.process&&!R.skipProcessing){if(k.tsVideosConfig?.enabled&&!k.isDev)return Mx(R,k)}if(k.processedResult?.processed)return ap(v,k.processedResult,_);let T;if(R.generatePoster&&R.src&&!v.poster)T=await Ox(R,k);let{src:B,sources:z=[],poster:W,posterPlaceholder:F,controls:V=sp,autoplay:H=!1,muted:q=!1,loop:Q=!1,preload:Z=ip,playsinline:se=!0,lazy:ie=!0,player:oe="native",type:ae,width:le,height:ce,crossorigin:ge,disablePictureInPicture:$e=!1,disableRemotePlayback:ye=!1}=v,ke=T||W,{class:Re,style:Ae}=v,Ie=v.id||`stx-video-${Math.random().toString(36).slice(2,8)}`;if(oe==="ts-video")return Ix(v,_);if(ae&&ae!=="video")return Ax(B||"",ae,v);let Pe=z.length>0?z:B?[{src:B,type:op(B)}]:[],Ee=[`id="${Ie}"`];if(V)Ee.push("controls");if(H)Ee.push("autoplay");if(q)Ee.push("muted");if(Q)Ee.push("loop");if(se)Ee.push("playsinline");if($e)Ee.push("disablepictureinpicture");if(ye)Ee.push("disableremoteplayback");if(ge)Ee.push(`crossorigin="${ge}"`);if(ie){if(Ee.push(`data-preload="${Z}"`),Ee.push('preload="none"'),ke)Ee.push(`data-poster="${Gt(ke)}"`);Ee.push("data-stx-lazy")}else if(Ee.push(`preload="${Z}"`),ke)Ee.push(`poster="${Gt(ke)}"`);if(le)Ee.push(`width="${le}"`);if(ce)Ee.push(`height="${ce}"`);if(Re)Ee.push(`class="${Gt(Re)}"`);if(Ae)Ee.push(`style="${Gt(Ae)}"`);let Me=Pe.map((De)=>` <source ${ie?`data-src="${Gt(De.src)}"`:`src="${Gt(De.src)}"`} type="${De.type}"${De.media?` media="${De.media}"`:""} />`).join(`
1733
+ <script>${V.script}</script>`;return H},defaults:{src:"",alt:"",options:{lazy:!0,placeholder:"none"}}})}function Cx(v,_,k){if(_.src)return{src:String(_.src),alt:String(_.alt||""),options:_.options||{}};let R=v.trim();if(R.startsWith("@img(")||R.startsWith("("))R=R.replace(/^@img\(/,"").replace(/^\(/,"").replace(/\)$/,"");let T=Rx(R),B=fl(T[0],k)||"",z=fl(T[1],k)||"",W={};if(T[2]){let F=fl(T[2],k);if(typeof F==="object"&&F!==null)W=F;else if(typeof T[2]==="string")try{W=JSON.parse(T[2])}catch{}}return{src:B,alt:z,options:W}}function Rx(v){let _=[],k="",R=!1,T="",B=0,z=0;for(let W=0;W<v.length;W++){let F=v[W],V=W>0?v[W-1]:"";if((F==='"'||F==="'"||F==="`")&&V!=="\\"){if(!R)R=!0,T=F;else if(F===T)R=!1,T="";else k+=F;continue}if(!R){if(F==="{")B++;if(F==="}")B--;if(F==="[")z++;if(F==="]")z--;if(F===","&&B===0&&z===0){_.push(k.trim()),k="";continue}}k+=F}if(k.trim())_.push(k.trim());return _}function fl(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 R=_[k];if(R!==void 0)return R}if(k.startsWith("{")||k.startsWith("["))try{return JSON.parse(k)}catch{}return k}var tp=Ex();async function rp(){try{return await import("./chunk-pe5bk9ns.js")}catch(v){if(!np)console.warn("[stx-media] Video processor not available, some features disabled:",v),np=!0;return null}}var np=!1,sp=!0,ip="metadata",Tx="https://cdn.jsdelivr.net/npm/ts-video-player@latest/dist/index.min.js";async function ra(v,_={}){let k=_,R=v;if(R.process&&!R.skipProcessing){if(k.tsVideosConfig?.enabled&&!k.isDev)return Mx(R,k)}if(k.processedResult?.processed)return ap(v,k.processedResult,_);let T;if(R.generatePoster&&R.src&&!v.poster)T=await Ox(R,k);let{src:B,sources:z=[],poster:W,posterPlaceholder:F,controls:V=sp,autoplay:H=!1,muted:q=!1,loop:Q=!1,preload:Z=ip,playsinline:se=!0,lazy:ie=!0,player:oe="native",type:ae,width:le,height:ce,crossorigin:ge,disablePictureInPicture:$e=!1,disableRemotePlayback:ye=!1}=v,ke=T||W,{class:Re,style:Ae}=v,Ie=v.id||`stx-video-${Math.random().toString(36).slice(2,8)}`;if(oe==="ts-video")return Ix(v,_);if(ae&&ae!=="video")return Ax(B||"",ae,v);let Pe=z.length>0?z:B?[{src:B,type:op(B)}]:[],Ee=[`id="${Ie}"`];if(V)Ee.push("controls");if(H)Ee.push("autoplay");if(q)Ee.push("muted");if(Q)Ee.push("loop");if(se)Ee.push("playsinline");if($e)Ee.push("disablepictureinpicture");if(ye)Ee.push("disableremoteplayback");if(ge)Ee.push(`crossorigin="${ge}"`);if(ie){if(Ee.push(`data-preload="${Z}"`),Ee.push('preload="none"'),ke)Ee.push(`data-poster="${Gt(ke)}"`);Ee.push("data-stx-lazy")}else if(Ee.push(`preload="${Z}"`),ke)Ee.push(`poster="${Gt(ke)}"`);if(le)Ee.push(`width="${le}"`);if(ce)Ee.push(`height="${ce}"`);if(Re)Ee.push(`class="${Gt(Re)}"`);if(Ae)Ee.push(`style="${Gt(Ae)}"`);let Me=Pe.map((De)=>` <source ${ie?`data-src="${Gt(De.src)}"`:`src="${Gt(De.src)}"`} type="${De.type}"${De.media?` media="${De.media}"`:""} />`).join(`
1734
1734
  `),je=`<video ${Ee.join(" ")}>
1735
1735
  ${Me}
1736
1736
  Your browser does not support the video tag.
@@ -1989,7 +1989,7 @@ ${Pe}
1989
1989
  }
1990
1990
  `.trim();return{html:Pe,script:Ee,css:Me}}function cp(){return Je({name:"video",hasEndTag:!1,description:"Render a video with optional ts-videos processing, streaming, and poster generation",transform:async(v,_,k,R)=>{let{src:T,options:B}=Nx(v,_,k);if(!T)return console.warn("@video directive: missing src argument"),"<!-- @video: missing src -->";let z={src:T,poster:B.poster,controls:B.controls!==!1,autoplay:B.autoplay||!1,muted:B.muted||!1,loop:B.loop||!1,preload:B.preload||"metadata",playsinline:B.playsinline!==!1,lazy:B.lazy!==!1,player:B.player||"native",type:B.type,width:B.width,height:B.height,class:B.class,style:B.style,id:B.id,crossorigin:B.crossorigin,disablePictureInPicture:B.disablePictureInPicture,disableRemotePlayback:B.disableRemotePlayback,title:B.title,quality:B.quality,platform:B.platform,process:B.process,generatePoster:B.generatePoster,streaming:B.streaming,transcode:B.transcode,spriteSheet:B.spriteSheet,waveform:B.waveform},F={isDev:k.__isDev||!1,tsVideosConfig:k.__tsVideosConfig},V=await ra(z,F),H=V.html;if(V.css)H+=`
1991
1991
  <style>${V.css}</style>`;if(V.script)H+=`
1992
- <script>${V.script}</script>`;return H},defaults:{src:"",options:{controls:!0,lazy:!0,preload:"metadata"}}})}function Nx(v,_,k){if(_.src)return{src:String(_.src),options:_.options||{}};let R=v.trim();if(R.startsWith("@video(")||R.startsWith("("))R=R.replace(/^@video\(/,"").replace(/^\(/,"").replace(/\)$/,"");let T=jx(R),B=lp(T[0],k)||"",z={};if(T[1]){let W=lp(T[1],k);if(typeof W==="object"&&W!==null)z=W;else if(typeof T[1]==="string")try{z=JSON.parse(T[1])}catch{}}return{src:B,options:z}}function jx(v){let _=[],k="",R=!1,T="",B=0,z=0;for(let W=0;W<v.length;W++){let F=v[W],V=W>0?v[W-1]:"";if((F==='"'||F==="'"||F==="`")&&V!=="\\"){if(!R)R=!0,T=F;else if(F===T)R=!1,T="";else k+=F;continue}if(!R){if(F==="{")B++;if(F==="}")B--;if(F==="[")z++;if(F==="]")z--;if(F===","&&B===0&&z===0){_.push(k.trim()),k="";continue}}k+=F}if(k.trim())_.push(k.trim());return _}function lp(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 R=_[k];if(R!==void 0)return R}if(k.startsWith("{")||k.startsWith("["))try{return JSON.parse(k)}catch{}return k}var pl=cp();import Lx from"fs";import Cn from"path";async function rr(v,_){if(!v.webComponents?.enabled)return[];let k=v.webComponents.components||[],R=[];if(k.length>0){if(v.debug)console.log(`Building ${k.length} web components...`);for(let T of k)try{let B=await Bx(T,v,_);if(B)R.push(B)}catch(B){if(console.error(`Error building web component ${T.name}:`,B),v.debug)throw B}}return R}async function Bx(v,_,k){let{name:R,file:T,tag:B,extends:z}=v;if(!R||!T||!B)return console.error("Invalid web component configuration, missing required fields:",v),null;let W=null;if(Cn.isAbsolute(T)&&await r(T))W=T;else if(_.componentsDir){let ie=Cn.join(_.componentsDir,T);if(await r(ie))W=ie}if(!W)W=await nr(T,process.cwd(),_,k);if(!W)return console.error(`Web component source file not found: ${T}`),null;let F=await Bun.file(W).text();k.add(W);let H=(v.outputFormat||"js")==="ts",q=H?Wx({name:R,tag:B,baseElement:z,source:F,shadowDOM:v.shadowDOM??!0,template:v.template??!0,styleSource:v.styleSource,attributes:v.attributes||[],attributeTypes:v.attributeTypes||{}}):zx({name:R,tag:B,baseElement:z,source:F,shadowDOM:v.shadowDOM??!0,template:v.template??!0,styleSource:v.styleSource,attributes:v.attributes||[]}),Q=_.webComponents?.outputDir||"dist/web-components";await Lx.promises.mkdir(Q,{recursive:!0});let Z=H?"ts":"js",se=Cn.join(Q,`${B}.${Z}`);if(await Bun.write(se,q),_.debug)console.log(`Built web component ${R} -> ${se}`);return se}function zx(v){let{name:_,tag:k,baseElement:R="HTMLElement",source:T,shadowDOM:B,template:z,styleSource:W,attributes:F=[]}=v,V=T.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").trim();if(!B)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(W)H=`<link rel="stylesheet" href="${W}">`;return`/**
1992
+ <script>${V.script}</script>`;return H},defaults:{src:"",options:{controls:!0,lazy:!0,preload:"metadata"}}})}function Nx(v,_,k){if(_.src)return{src:String(_.src),options:_.options||{}};let R=v.trim();if(R.startsWith("@video(")||R.startsWith("("))R=R.replace(/^@video\(/,"").replace(/^\(/,"").replace(/\)$/,"");let T=jx(R),B=lp(T[0],k)||"",z={};if(T[1]){let W=lp(T[1],k);if(typeof W==="object"&&W!==null)z=W;else if(typeof T[1]==="string")try{z=JSON.parse(T[1])}catch{}}return{src:B,options:z}}function jx(v){let _=[],k="",R=!1,T="",B=0,z=0;for(let W=0;W<v.length;W++){let F=v[W],V=W>0?v[W-1]:"";if((F==='"'||F==="'"||F==="`")&&V!=="\\"){if(!R)R=!0,T=F;else if(F===T)R=!1,T="";else k+=F;continue}if(!R){if(F==="{")B++;if(F==="}")B--;if(F==="[")z++;if(F==="]")z--;if(F===","&&B===0&&z===0){_.push(k.trim()),k="";continue}}k+=F}if(k.trim())_.push(k.trim());return _}function lp(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 R=_[k];if(R!==void 0)return R}if(k.startsWith("{")||k.startsWith("["))try{return JSON.parse(k)}catch{}return k}var pl=cp();import Lx from"fs";import Cn from"path";async function sr(v,_){if(!v.webComponents?.enabled)return[];let k=v.webComponents.components||[],R=[];if(k.length>0){if(v.debug)console.log(`Building ${k.length} web components...`);for(let T of k)try{let B=await Bx(T,v,_);if(B)R.push(B)}catch(B){if(console.error(`Error building web component ${T.name}:`,B),v.debug)throw B}}return R}async function Bx(v,_,k){let{name:R,file:T,tag:B,extends:z}=v;if(!R||!T||!B)return console.error("Invalid web component configuration, missing required fields:",v),null;let W=null;if(Cn.isAbsolute(T)&&await r(T))W=T;else if(_.componentsDir){let ie=Cn.join(_.componentsDir,T);if(await r(ie))W=ie}if(!W)W=await rr(T,process.cwd(),_,k);if(!W)return console.error(`Web component source file not found: ${T}`),null;let F=await Bun.file(W).text();k.add(W);let H=(v.outputFormat||"js")==="ts",q=H?Wx({name:R,tag:B,baseElement:z,source:F,shadowDOM:v.shadowDOM??!0,template:v.template??!0,styleSource:v.styleSource,attributes:v.attributes||[],attributeTypes:v.attributeTypes||{}}):zx({name:R,tag:B,baseElement:z,source:F,shadowDOM:v.shadowDOM??!0,template:v.template??!0,styleSource:v.styleSource,attributes:v.attributes||[]}),Q=_.webComponents?.outputDir||"dist/web-components";await Lx.promises.mkdir(Q,{recursive:!0});let Z=H?"ts":"js",se=Cn.join(Q,`${B}.${Z}`);if(await Bun.write(se,q),_.debug)console.log(`Built web component ${R} -> ${se}`);return se}function zx(v){let{name:_,tag:k,baseElement:R="HTMLElement",source:T,shadowDOM:B,template:z,styleSource:W,attributes:F=[]}=v,V=T.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").trim();if(!B)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(W)H=`<link rel="stylesheet" href="${W}">`;return`/**
1993
1993
  * ${_} Web Component
1994
1994
  * Auto-generated from stx component
1995
1995
  */
@@ -2289,12 +2289,12 @@ ${H}
2289
2289
  customElements.define('${_}', ${z});
2290
2290
  `}async function up(v,_,k,R){if(_.length<1)return i("WebComponent","@webcomponent directive requires at least the tag name parameter",t.INVALID_DIRECTIVE_SYNTAX);let T=_[0].replace(/['"]/g,""),z=(k.__stx_options||{}).componentsDir||"components",W=Cn.isAbsolute(z)?[Cn.join(z,`${T}.stx`),Cn.join(Cn.dirname(R),`${T}.stx`)]:[Cn.join(Cn.dirname(R),z,`${T}.stx`),Cn.join(process.cwd(),z,`${T}.stx`),Cn.join(Cn.dirname(R),`${T}.stx`)],F=null;for(let q of W)if(await r(q)){F=await Bun.file(q).text();break}if(!F)return i("WebComponent",`Component file not found: ${T}.stx`,t.FILE_NOT_FOUND);let V=Fx(F,T);return`<script type="module">
2291
2291
  ${Vx(V)}
2292
- </script>`}var A={enabled:!0,ssr:!1,partialsDir:"partials",componentsDir:"components",layoutsDir:"layouts",defaultLayout:"default",debug:!1,cache:!0,stateDir:Pt,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:qf,hasEndTag:!0,description:"Render markdown content to HTML"},{name:"webcomponent",handler:up,hasEndTag:!1,description:"Include a web component in the template"},$i,Ri,ar,cr,Df,Of,Nf,Mf,Vf,Pf,tp,pl,...xr],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 Hx(v,_,k){let R=_||"pages";if(v)return{root:v,pagesDir:R};let T=k||process.cwd(),B=Jt.join(T,"resources","views"),z=Jt.join(T,"resources","layouts");if(Os.existsSync(B)&&Os.existsSync(z))return{root:"resources",pagesDir:"views"};let W=Jt.join(T,"resources","views","pages");if(Os.existsSync(W))return{root:"resources/views",pagesDir:R};return{root:".",pagesDir:R}}var dp=new Set,ia=["partialsDir","componentsDir","layoutsDir"],gl=new WeakMap;function qx(v,_){let k=_.replace(/[\\/]+$/,"");if(!k||k===".")return!0;let R=v.replace(/\\/g,"/"),T=k.replace(/\\/g,"/");return R===T||R.startsWith(`${T}/`)}function qc(v,_){let k=!v.root,R=Hx(v.root,v.pagesDir,_);if(v.root=R.root,v.pagesDir=R.pagesDir,k&&R.root!=="."){let T=`${_}::${R.root}`;if(!dp.has(T))dp.add(T),console.warn(`[stx] No "root" in config \u2014 inferred "${R.root}" from the project layout. Template directories are resolved under it; set root explicitly to pin this.`)}if(!gl.has(v)){let T={};for(let B of ia){let z=v[B];if(typeof z==="string"&&z)T[B]=z}gl.set(v,T)}if(v.root&&v.root!=="."){let T=v.root;for(let B of ia){let z=v[B];if(typeof z!=="string"||!z)continue;if(Jt.isAbsolute(z)||qx(z,T))continue;v[B]=Jt.join(T,z)}}for(let T of ia){let B=v[T];if(typeof B!=="string"||!B||Jt.isAbsolute(B))continue;v[T]=Jt.resolve(_,B)}return v}function Kx(v,_){let k=gl.get(v);for(let R of ia){let T=v[R];if(typeof T!=="string"||!T)continue;let B=Jt.isAbsolute(T)?T:Jt.join(_,T);if(Os.existsSync(B))continue;let z=k?.[R]??T,W=v.root,F=!!W&&W!==".";console.warn(`[stx] ${String(R)} resolves to "${B}", which does not exist. Configured as "${z}"`+(F?`, resolved under root "${W}".`:"."))}}function Xx(v){if(v.customDirectives)v.customDirectives=[...v.customDirectives];if(v.middleware)v.middleware=[...v.middleware];if(v.apiRoutes)v.apiRoutes={...v.apiRoutes}}function Zx(v){if(Di(v.stateDir),v.stateDir=mn(),v.cachePath=hn(v.cachePath),v.build)v.build.cacheDir=hn(v.build.cacheDir);if(v.media?.cache)v.media.cache.directory=hn(v.media.cache.directory);if(v.story)v.story.outDir=hn(v.story.outDir)}var Sr=null,Br=new Map,sa=new Map,ro=null;async function As(v,_=Ux){try{return await _(v)}catch(k){if(k instanceof Error&&k.name==="ConfigNotFoundError")return{config:v.defaultConfig};throw k}}async function o(v){let _=v?Jt.resolve(v):process.cwd(),k=sa.get(_);if(k&&k.signature!==sr(k.graph)){let B=Br.get(_);if(Br.delete(_),sa.delete(_),!v)Sr=null,ro=null;let{clearComponentCache:z}=await import("./chunk-dh80d57p.js"),{partialsCache:W}=await import("./chunk-4t67wmcg.js");if(z(),W.clear(),B&&k.configSignature===or(k.graph)){let F=B.then(async(V)=>{let H={...k.graph};await Is(H,_),sa.set(_,{graph:H,signature:sr(H),configSignature:or(H)});let q={...V,_layerGraph:H};if(!v)Sr=q;return q});return Br.set(_,F),F}}if(!v){if(Sr)return Sr;if(ro)return ro}let R=Br.get(_);if(R)return R;let T=(async()=>{let B=[".ts",".js",".mjs",".cjs",".json"],z=B.some((Q)=>Os.existsSync(Jt.join(_,`stx.config${Q}`))),W=B.some((Q)=>Os.existsSync(Jt.join(_,"config",`ui${Q}`))),F;if(z&&W){let Q=await As({name:"ui",cwd:Jt.join(_,"config"),defaultConfig:A,errorPolicy:"throw",verbose:!1});F=(await As({name:"stx",alias:"ui",cwd:_,defaultConfig:Q.config,errorPolicy:"throw",verbose:!1})).config}else F=(await As({name:"stx",alias:"ui",cwd:_,defaultConfig:A,errorPolicy:"throw",verbose:!1})).config;if(F.extends!==void 0||k){let Q=await Ii(_,A);F=Q.config,sa.set(_,{graph:Q.graph,signature:sr(Q.graph),configSignature:or(Q.graph)})}if(F.runtimeConfig){let{resolveRuntimeConfig:Q}=await import("./chunk-5702x95v.js");Q(F.runtimeConfig,{});let{generateRuntimeConfigTypes:Z}=await import("./chunk-5pgbsc3a.js");await Z(_,F.runtimeConfig)}Xx(F),Zx(F),qc(F,_),Kx(F,_);let V=[],H=new Set((F.plugins??[]).map((Q)=>typeof Q==="string"?Q:Q[0]));for(let Q of F.componentPackages??["@stacksjs/components"]){let Z=`${Q}/stx-plugin`;if(H.has(Z)||H.has(Q))continue;try{u.resolve(Z,{paths:[_]}),V.push(Z)}catch{}}let q=[...F.plugins??[],...V];if(q.length>0){let{pluginManager:Q}=await import("./chunk-dpn1pmxj.js"),Z=[],se=[];for(let ie of q){let oe=typeof ie==="string"?ie:ie[0],ae=typeof ie==="string"?{}:ie[1]||{};try{let le,ce;try{let $e=u.resolve(oe,{paths:[_]});le=await import($e),ce=Jt.dirname($e)}catch{let $e=Jt.resolve(_,oe);le=await import($e),ce=Jt.dirname($e)}let ge=le.default||le;if(!Q.has(ge.name))await Q.register(ge,F);if(ge.components){let $e=Array.isArray(ge.components)?ge.components:[ge.components];for(let ye of $e)Z.push(Jt.resolve(ce,ye))}if(ge.pages){let $e=Jt.resolve(ce,ge.pages),ye=ae.path||"/";se.push({dir:$e,prefix:ye})}if(ge.setup){let $e={addDirective:(ye)=>{F.customDirectives=F.customDirectives||[],F.customDirectives.push(ye)},addRoute:(ye,ke)=>{F.apiRoutes=F.apiRoutes||{},F.apiRoutes[ye]=ke},addMiddleware:(ye)=>{F.middleware=F.middleware||[],F.middleware.push(ye)},pluginDir:ce,config:F};await ge.setup(ae,$e)}process.stderr.write(`[stx] Plugin loaded: ${ge.name||oe}
2293
- `)}catch(le){console.warn(`[stx] Failed to load plugin ${oe}:`,le.message)}}F._pluginComponentDirs=Z,F._pluginPageDirs=se}return F})();if(Br.set(_,T),T.catch(()=>{if(Br.get(_)===T)Br.delete(_)}),!v)ro=T,T.then((B)=>{Sr=B}).catch(()=>{});return T}var P=new Proxy(A,{get(v,_){if(Sr&&_ in Sr)return Sr[_];if(!ro)o().catch((k)=>{console.warn("[stx] Failed to load config file:",k?.message||k)});return v[_]}});function lu(v){return v}function du(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 R=["auto","manual","sections"];if(!R.includes(v.streaming.strategy))_.push({path:"streaming.strategy",message:`streaming.strategy must be one of: ${R.join(", ")}`,severity:"error"})}}if(v.i18n){if(v.i18n.format!==void 0){let R=["json","yaml","yml","js"];if(!R.includes(v.i18n.format))_.push({path:"i18n.format",message:`i18n.format must be one of: ${R.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 R=["AA","AAA"];if(!R.includes(v.a11y.level))_.push({path:"a11y.level",message:`a11y.level must be one of: ${R.join(", ")}`,severity:"error"})}}if(v.hydration){if(v.hydration.mode!==void 0){let R=["progressive","islands"];if(!R.includes(v.hydration.mode))_.push({path:"hydration.mode",message:`hydration.mode must be one of: ${R.join(", ")}`,severity:"error"})}if(v.hydration.preload!==void 0){let R=["none","eager","lazy"];if(!R.includes(v.hydration.preload))_.push({path:"hydration.preload",message:`hydration.preload must be one of: ${R.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((R,T)=>{if(!R.name||typeof R.name!=="string")_.push({path:`customDirectives[${T}].name`,message:"Custom directive must have a name string",severity:"error"});if(!R.handler||typeof R.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((R,T)=>{if(!R.name||typeof R.name!=="string")_.push({path:`middleware[${T}].name`,message:"Middleware must have a name string",severity:"error"});if(!R.handler||typeof R.handler!=="function")_.push({path:`middleware[${T}].handler`,message:"Middleware must have a handler function",severity:"error"});if(!R.timing||!["before","after"].includes(R.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 R=["fullscreen","standalone","minimal-ui","browser"];if(!R.includes(v.pwa.manifest.display))_.push({path:"pwa.manifest.display",message:`PWA display must be one of: ${R.join(", ")}`,severity:"error"})}if(v.pwa.manifest?.orientation!==void 0){let R=["portrait","landscape","any","portrait-primary","portrait-secondary","landscape-primary","landscape-secondary"];if(!R.includes(v.pwa.manifest.orientation))_.push({path:"pwa.manifest.orientation",message:`PWA orientation must be one of: ${R.join(", ")}`,severity:"error"})}if(v.pwa.routes){let R=["cache-first","network-first","stale-while-revalidate","network-only","cache-only"];v.pwa.routes.forEach((T,B)=>{if(!T.pattern||typeof T.pattern!=="string")_.push({path:`pwa.routes[${B}].pattern`,message:"PWA route must have a pattern string",severity:"error"});if(!R.includes(T.strategy))_.push({path:`pwa.routes[${B}].strategy`,message:`PWA route strategy must be one of: ${R.join(", ")}`,severity:"error"});if(T.maxAgeSeconds!==void 0&&(typeof T.maxAgeSeconds!=="number"||T.maxAgeSeconds<0))_.push({path:`pwa.routes[${B}].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[${B}].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 R=["any","maskable","monochrome"];if(v.pwa.icons.purpose.filter((B)=>!R.includes(B)).length>0)_.push({path:"pwa.icons.purpose",message:`PWA icon purpose must be one of: ${R.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 hl=new Map;async function pe(v,_={}){try{if(!await r(v))throw Error(`Markdown file not found: ${v}`);let R=(await Gx.promises.stat(v)).mtime.getTime();if(_.cache&&hl.has(v)){let q=hl.get(v);if(q.updatedAt>=R)return{content:q.content,data:q.data}}let T=await Bun.file(v).text(),{data:B,content:z}=Wn(T),W=_.markdown||P.markdown||{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0}},V=Be(z,{gfm:!0});if(W.syntaxHighlighting?.enabled&&W.syntaxHighlighting?.serverSide)V=await Yx(V,W.syntaxHighlighting?.defaultTheme||"github-dark",W.syntaxHighlighting?.highlightUnknownLanguages||!1);let H={content:V,data:B||{}};if(_.cache)hl.set(v,{...H,updatedAt:R});return H}catch(k){if(_.debug)console.error(`Error reading/parsing markdown file ${v}:`,k);let R=k instanceof Error?k.message:String(k);return{content:g("Markdown File",`Error reading/parsing markdown file: ${R}`,v,"",0,""),data:{}}}}var oa=null;async function Yx(v,_,k){let R=/<pre><code( class="language-([^"]+)")?>([^<]+)<\/code><\/pre>/g;if(!oa)try{oa=await Jx({theme:_||"github-dark",cache:!0})}catch(W){return console.error("Failed to initialize ts-syntax-highlighter:",W),v}let T=async(W,F,V,H)=>{let q=H.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&").replace(/&quot;/g,'"').replace(/&#39;/g,"'"),Q=V||(k?"text":"");if(!Q)return W;try{if(!oa.getSupportedLanguages().includes(Q))return W;return(await oa.highlight(q,Q,{theme:_})).html}catch(Z){console.error(`Error highlighting code block with language ${V}:`,Z)}return W},B=v,z=v.matchAll(R);for(let W of z){let[F,V,H,q]=W,Q=await T(F,V,H,q);B=B.replace(F,Q)}return B}async function fp(v,_,k="",R={}){return await Qx(v,/@markdown-file\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\}))?\)/g,async(z,W,F,V)=>{try{let H=W;if(!ml.isAbsolute(W))H=ml.resolve(ml.dirname(k),W);let q={};if(F)try{try{q=JSON.parse(F)}catch{if(R.debug)console.warn("Using safer alternative for parsing JS object literal");let le=F.replace(/^\s*\{|\}\s*$/g,"").trim().split(/,(?=\s*\w+\s*:)/);for(let ce of le){let ge=ce.indexOf(":");if(ge>0){let $e=ce.substring(0,ge).trim(),ye=ce.substring(ge+1).trim(),ke=ye.startsWith('"')&&ye.endsWith('"'),Re=ye.startsWith("'")&&ye.endsWith("'");if(ke||Re)ye=ye.substring(1,ye.length-1);q[$e]=ye}}}}catch(ae){if(R.debug)console.error("Error parsing context in @markdown-file directive:",ae)}let{content:Q,data:Z}=await pe(H,R),se={..._,...Z,...q},ie=Q,oe=/\{\{([^}]+)\}\}/g;return ie=ie.replace(oe,(ae,le)=>{let ce=le.trim();return se[ce]!==void 0?String(se[ce]):ae}),ie}catch(H){let q=H instanceof Error?H.message:String(H);return g("Markdown File",`Error including markdown file: ${q}`,k,v,V,z)}})}async function Qx(v,_,k){let R=[],T;while((T=_.exec(v))!==null){let W=T[0],F=T.index,V=T;R.push(k(...V).then((H)=>({match:W,replacement:H,index:F})))}let B=await Promise.all(R);B.sort((W,F)=>F.index-W.index);let z=v;for(let{match:W,replacement:F}of B)z=z.replace(W,()=>F);return z}function $r(v,_){try{let k=v.trim();if(p(k))return c(k,Object.keys(_))(...Object.values(_));else return l(k,_)}catch{return!1}}function _r(v,_){let k=eb(v,_);return k.ok?{expression:k.expression,endPos:k.endPos}:null}function eb(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 R=S(v,"(",")",k);if(R===-1)return{ok:!1,reason:"unclosed-paren",pos:k};return{ok:!0,expression:v.slice(k+1,R),endPos:R+1}}function tb(v,_){let k=v.lastIndexOf("<",_);if(k===-1)return!1;return k>v.lastIndexOf(">",_)}function zr(v,_,k,R){let T=1,B=R,z=new RegExp(`@${_}\\s*\\(`,"g"),W=new RegExp(`@${k}(?![a-z])`,"g");while(B<v.length&&T>0){z.lastIndex=B,W.lastIndex=B;let F=z.exec(v),V=W.exec(v),H=F?F.index:1/0,q=V?V.index:1/0;if(H<q)T++,B=H+F[0].length;else if(q<1/0){if(T--,T===0)return q;B=q+V[0].length}else break}return-1}function pp(v,_){let k=v.slice(_).match(/^@if\s*/);if(!k)return null;let R=_+k[0].length,T=_r(v,R);if(!T)return null;let B=T.endPos,z=zr(v,"if","endif",B);if(z===-1)return null;let W=v.slice(B,z),F=[],V=0,H="if",q=T.expression,Q=0,Z=0;while(V<W.length){let se=W.indexOf("@",V);if(se===-1)break;V=se;let ie=W.substring(se);if(tb(W,se)){V++;continue}if(/^@if\s*\(/.test(ie)){Z++,V++;continue}if(/^@endif(?![a-z])/.test(ie)){Z--,V+=6;continue}if(Z===0){let oe=ie.match(/^@elseif\s*/);if(oe){F.push({type:H,condition:q,content:W.substring(Q,V),start:B+Q,end:B+V});let ae=V+oe[0].length,le=_r(W,ae);if(!le){V++;continue}H="elseif",q=le.expression,V=le.endPos,Q=V;continue}else if(/^@else(?![a-z])/.test(ie)){F.push({type:H,condition:q,content:W.substring(Q,V),start:B+Q,end:B+V}),H="else",q=void 0,V+=5,Q=V;continue}}V++}return F.push({type:H,condition:q,content:W.slice(Q),start:B+Q,end:B+W.length}),{fullMatch:v.slice(_,z+6),branches:F,start:_,end:z+6}}function so(v){let _=[],k=/@if\s*\(/g,R=k.exec(v);while(R!==null){if(_.some((z)=>R.index>z.start&&R.index<z.end)){R=k.exec(v);continue}let B=pp(v,R.index);if(B)_.push(B),k.lastIndex=B.end;R=k.exec(v)}return _}function aa(v,_,k){let R=[],T=new RegExp(`@${_}\\s*\\(`,"g"),B=T.exec(v);while(B!==null){if(R.some((ie)=>B.index>ie.start&&B.index<ie.end)){B=T.exec(v);continue}let W=B.index,F=W+B[0].length-1,V=S(v,"(",")",F);if(V===-1){B=T.exec(v);continue}let H=v.slice(F+1,V),q=V+1,Q=zr(v,_,k,q);if(Q===-1){B=T.exec(v);continue}let Z=v.slice(q,Q),se=Q+`@${k}`.length;R.push({fullMatch:v.slice(W,se),name:_,params:H,content:Z,start:W,end:se}),T.lastIndex=se,B=T.exec(v)}return R}function yl(v,_){let k=v.slice(_).match(/^@switch\s*/);if(!k)return null;let R=_+k[0].length,T=_r(v,R);if(!T)return null;let B=T.endPos,z=zr(v,"switch","endswitch",B);if(z===-1)return null;let W=v.slice(B,z),F=[],V=0,H=null,q=0;while(V<W.length){let Q=W.slice(V),Z=Q.match(/^@switch\s*\(/),se=Q.match(/^@endswitch(?![a-z])/);if(Z){if(q++,H)H.content+=Z[0];V+=Z[0].length;continue}if(se){if(q--,H)H.content+=se[0];V+=se[0].length;continue}if(q>0){if(H)H.content+=W[V];V++;continue}let ie=Q.match(/^@case\s*/),oe=Q.match(/^@default(?![a-z])/),ae=Q.match(/^@break(?![a-z])/);if(ie&&Q.startsWith("@case")){if(H)F.push(H);let le=V+ie[0].length,ce=_r(W,le);if(!ce){V++;continue}H={type:"case",value:ce.expression,content:""},V=ce.endPos}else if(oe&&Q.startsWith("@default")){if(H)F.push(H);H={type:"default",content:""},V+=oe[0].length}else if(ae&&Q.startsWith("@break"))V+=ae[0].length;else{if(H)H.content+=W[V];V++}}if(H)F.push(H);return{fullMatch:v.slice(_,z+10),expression:T.expression,cases:F,start:_,end:z+10}}function ib(v,_,k){let R=v,T=!0;while(T){T=!1;let B=R.match(/@switch\s*\(/);if(!B||B.index===void 0)break;let z=B.index,W=yl(R,z);if(!W)break;try{let F;if(p(W.expression))F=c(W.expression,Object.keys(_))(...Object.values(_));else F=l(W.expression,_);let V="",H=!1;for(let q of W.cases)if(q.type==="default"){if(!H)V=q.content.trim()}else try{let Q;if(q.value&&p(q.value))Q=c(q.value,Object.keys(_))(...Object.values(_));else if(q.value)Q=l(q.value,_);if(F===Q){V=q.content.trim(),H=!0;break}}catch{continue}R=R.substring(0,z)+V+R.substring(W.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);R=R.substring(0,z)+H+R.substring(W.end);break}}return R}function ob(v){let _=[];return{masked:v.replace(/<script\b[\s\S]*?<\/script\s*>/gi,(R)=>(_.push(R),`\x00stx-script-${_.length-1}\x00`)),scripts:_}}function ab(v,_){if(_.length===0)return v;return v.replace(/\u0000stx-script-(\d+)\u0000/g,(k,R)=>_[Number(R)]??k)}function dr(v,_,k){let{masked:R,scripts:T}=ob(v);return ab(cb(R,_,k),T)}function cb(v,_,k){let R=v;R=ib(R,_,k);{let B=!0;while(B){B=!1;let z=R.match(/@unless\s*\(/);if(!z||z.index===void 0)break;let W=z.index,F=_r(R,W+7);if(!F)break;let V=F.endPos,H=zr(R,"unless","endunless",V);if(H===-1){console.warn(`[stx] @unless directive at position ${W} has no matching @endunless \u2014 the block was skipped. Check for typos or missing closers.`);break}let q=R.slice(V,H),Q=F.expression,Z=-1;{let ie=0,oe=/@(?:if|unless)\s*\(/g,ae=/@(?:endif|endunless)(?![a-z])/g,le=/@else(?![a-z])/g,ce=[],ge;while((ge=oe.exec(q))!==null)ce.push({pos:ge.index,type:"open"});while((ge=ae.exec(q))!==null)ce.push({pos:ge.index,type:"close"});while((ge=le.exec(q))!==null)ce.push({pos:ge.index,type:"else"});ce.sort(($e,ye)=>$e.pos-ye.pos);for(let $e of ce)if($e.type==="open")ie++;else if($e.type==="close")ie--;else if($e.type==="else"&&ie===0){Z=$e.pos;break}}let se;if(Z!==-1){let ie=q.slice(0,Z),oe=q.slice(Z+5);se=`@if (${Q})${oe}@else ${ie}@endif`}else se=`@if (!(${Q}))${q}@endif`;R=R.substring(0,W)+se+R.substring(H+10),B=!0}}R=bl(R,_,k),R=vl(R,_,k),R=xl(R,_);let T=()=>{let B=so(R);if(B.length===0)return!1;let z=Array(B.length);for(let V=B.length-1;V>=0;V--){let H=B[V];try{let q="",Q=!1;for(let Z of H.branches){if(Q)break;if(Z.type==="else")q=Z.content,Q=!0;else try{if(Z.condition?zi(Z.condition,_):!1)q=Z.content,Q=!0}catch(se){q=i(Z.type==="if"?"If":"Elseif",`Error in @${Z.type}(${Z.condition}): ${se instanceof Error?se.message:String(se)}`,t.EVALUATION_ERROR),Q=!0}}z[V]=q}catch(q){let Q=q instanceof Error?q.message:String(q);z[V]=i("If",`Error processing @if block: ${Q}`,t.EVALUATION_ERROR)}}let W=Array(B.length*2+1),F=0;for(let V=0;V<B.length;V++){let H=B[V];W[V*2]=R.slice(F,H.start),W[V*2+1]=z[V],F=H.end}return W[B.length*2]=R.slice(F),R=W.join(""),!0};while(!0){let B=R;if(!T())break;if(R===B)break}return R}function gp(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 R=[];while(_<v.length){let T=v[_];if(T==="\\"&&_+1<v.length){R.push(v[_+1]),_+=2;continue}if(T===k){_++;break}R.push(T),_++}while(_<v.length&&/\s/.test(v[_]))_++;if(v[_]!==")")return null;return _++,{value:R.join(""),consumed:_}}function xl(v,_){let k=v;function R(W,F,V,H){let q=1,Q=H,Z=new RegExp(`@${F}(?:\\s*\\(|\\s|$)`,"g"),se=new RegExp(`@${V}(?![a-z])`,"g");while(Q<W.length&&q>0){Z.lastIndex=Q,se.lastIndex=Q;let ie=Z.exec(W),oe=se.exec(W),ae=ie?ie.index:1/0,le=oe?oe.index:1/0;if(ae<le)q++,Q=ae+ie[0].length;else if(le<1/0){if(q--,q===0)return le;Q=le+oe[0].length}else break}return-1}function T(W,F,V){let H=0,q=new RegExp(`@${F}(?:\\s*\\(|\\s|$)`,"g"),Q=new RegExp(`@${V}(?![a-z])`,"g"),Z=/@else(?![a-z])/g,se=[],ie;while((ie=q.exec(W))!==null)se.push({pos:ie.index,type:"open"});while((ie=Q.exec(W))!==null)se.push({pos:ie.index,type:"close"});while((ie=Z.exec(W))!==null)se.push({pos:ie.index,type:"else"});se.sort((oe,ae)=>oe.pos-ae.pos);for(let oe of se)if(oe.type==="open")H++;else if(oe.type==="close")H--;else if(oe.type==="else"&&H===0)return oe.pos;return-1}{let W=!0;while(W){W=!1;let F=k.match(/@auth(?:\s*\(|\s|(?=\n))/);if(!F||F.index===void 0)break;let V=F.index,H,q,Q=k.slice(V+5),Z=gp(Q);if(Z)H=Z.value,q=V+5+Z.consumed;else q=V+5;let se=R(k,"auth","endauth",q);if(se===-1){console.warn(`[stx] @auth directive at position ${V} has no matching @endauth \u2014 the block was skipped.`);break}let ie=k.slice(q,se),oe=T(ie,"auth","endauth"),ae;if(!_.auth)ae=!1;else ae=H?$r(`auth?.check && auth?.user?.[${H}]`,_):$r("auth?.check",_);let le;if(oe!==-1){let ce=ie.slice(0,oe),ge=ie.slice(oe+5);le=ae?ce:ge}else le=ae?ie:"";k=k.substring(0,V)+le+k.substring(se+8),W=!0}}{let W=!0;while(W){W=!1;let F=k.match(/@guest(?:\s*\(|\s|(?=\n))/);if(!F||F.index===void 0)break;let V=F.index,H,q,Q=k.slice(V+6),Z=gp(Q);if(Z)H=Z.value,q=V+6+Z.consumed;else q=V+6;let se=R(k,"guest","endguest",q);if(se===-1){console.warn(`[stx] @guest directive at position ${V} has no matching @endguest \u2014 the block was skipped.`);break}let ie=k.slice(q,se),oe=T(ie,"guest","endguest"),ae;if(!_.auth)ae=!0;else ae=H?$r(`!auth?.check || !auth?.user?.[${H}]`,_):$r("!auth?.check",_);let le;if(oe!==-1){let ce=ie.slice(0,oe),ge=ie.slice(oe+5);le=ae?ce:ge}else le=ae?ie:"";k=k.substring(0,V)+le+k.substring(se+9),W=!0}}function B(W,F,V){if(_.userCan&&typeof _.userCan[W]==="boolean")return _.userCan[W];if(_.permissions?.check&&typeof _.permissions.check==="function")try{let H=[W];if(F)H.push(F);if(V){let q=$r(V,_);H.push(q)}return _.permissions.check(...H)}catch{return!1}return!1}function z(W){let F=W.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 W of["can","cannot"]){let F=`end${W}`,V=W==="can"?"elsecan":"elsecannot",H=!0;while(H){H=!1;let q=k.match(new RegExp(`@${W}\\s*\\(`));if(!q||q.index===void 0)break;let Q=q.index,Z=k.slice(Q+`@${W}`.length),se=z(Z);if(!se)break;let ie=Q+`@${W}`.length+se.paramsEnd,oe=R(k,W,F,ie);if(oe===-1){console.warn(`[stx] @${W} directive at position ${Q} has no matching @${F} \u2014 the block was skipped.`);break}let ae=k.slice(ie,oe),le=[],ce=0,ge=new RegExp(`@${W}\\s*\\(`,"g"),$e=new RegExp(`@${F}(?![a-z])`,"g"),ye=new RegExp(`@${V}\\s*\\(`,"g"),ke=/@else(?![a-z])/g,Re=[],Ae;while((Ae=ge.exec(ae))!==null)Re.push({pos:Ae.index,type:"open"});while((Ae=$e.exec(ae))!==null)Re.push({pos:Ae.index,type:"close"});while((Ae=ye.exec(ae))!==null)Re.push({pos:Ae.index,type:"elseDirective"});while((Ae=ke.exec(ae))!==null)Re.push({pos:Ae.index,type:"else"});Re.sort((Ne,De)=>Ne.pos-De.pos);for(let Ne of Re){if(Ne.type==="open"){ce++;continue}if(Ne.type==="close"){ce--;continue}if(ce===0)le.push(Ne)}let Ie=[],Pe=0;for(let Ne=0;Ne<le.length;Ne++){let De=le[Ne];if(Ie.push({content:ae.slice(Pe,De.pos),ability:void 0}),De.type==="elseDirective"){let Le=ae.slice(De.pos+`@${V}`.length),ct=z(Le);if(ct){Ie[Ie.length-1]={content:ae.slice(Pe,De.pos)},Pe=De.pos+`@${V}`.length+ct.paramsEnd,Ie.push({content:"",ability:ct.ability,type:ct.type,id:ct.id}),Ie.pop();let yt=le[Ne+1],pt=yt?yt.pos:ae.length;Ie.push({content:ae.slice(Pe,pt),ability:ct.ability,type:ct.type,id:ct.id}),Pe=pt}}else Pe=De.pos+5}if(Pe<ae.length){let Ne=Ie[Ie.length-1];if(le.length>0&&le[le.length-1].type==="else")Ie.push({content:ae.slice(Pe),isFinalElse:!0});else if(Ie.length===0)Ie.push({content:ae.slice(Pe)})}let Ee=B(se.ability,se.type,se.id),Me=W==="can"?Ee:!Ee,je="";if(Me)je=Ie[0]?.content||"";else{let Ne=!1;for(let De=1;De<Ie.length;De++){let Le=Ie[De];if(Le.isFinalElse){je=Le.content,Ne=!0;break}if(Le.ability){let ct=B(Le.ability,Le.type,Le.id);if(W==="can"?ct:!ct){je=Le.content,Ne=!0;break}}}if(!Ne&&Ie.length>0){let De=Ie[Ie.length-1];if(De.isFinalElse)je=De.content}}k=k.substring(0,Q)+je+k.substring(oe+`@${F}`.length),H=!0}}return k}function bl(v,_,k){let R=v;function T(B,z,W,F,V){let H=!0;while(H){H=!1;let q=new RegExp(`@${z}\\s*\\(`),Q=B.match(q);if(!Q||Q.index===void 0)break;let Z=Q.index,se=_r(B,Z+`@${z}`.length);if(!se)break;let ie=se.endPos,oe=zr(B,z,W,ie);if(oe===-1){console.warn(`[stx] @${z} directive at position ${Z} has no matching @${W} \u2014 the block was skipped.`);break}let ae=B.slice(ie,oe),le=se.expression,ce=-1,ge=0,$e=0;while($e<ae.length){let ye=ae.indexOf("@",$e);if(ye===-1)break;let ke=ae.substring(ye);if(/^@(?:if|unless|isset|empty)\s*\(/.test(ke)){ge++,$e=ye+1;continue}if(/^@(?:endif|endunless|endisset|endempty)(?![a-z])/.test(ke)){ge--,$e=ye+1;continue}if(ge===0&&/^@else(?![a-z])/.test(ke)){ce=ye;break}$e=ye+1}try{let ye=F(le.trim()),ke;if(ce!==-1){let Re=ae.slice(0,ce),Ae=ae.slice(ce+5);ke=ye?Re:Ae}else ke=ye?ae:"";B=B.substring(0,Z)+ke+B.substring(oe+`@${W}`.length),H=!0}catch(ye){let ke=ye instanceof Error?ye.message:String(ye),Re=i(V,`Error processing @${z} directive: ${ke}`,t.EVALUATION_ERROR);B=B.substring(0,Z)+Re+B.substring(oe+`@${W}`.length);break}}return B}return R=T(R,"isset","endisset",(B)=>{let z=$r(B,_);return z!==void 0&&z!==null},"Isset"),R=T(R,"empty","endempty",(B)=>{let z=$r(B,_);return z===void 0||z===null||z===""||z===0||z===!1||Array.isArray(z)&&z.length===0||typeof z==="object"&&z!==null&&Object.keys(z).length===0},"Empty"),R}function vl(v,_,k){let R=v,T="development";function B(z,W,F,V){let H=new RegExp(`@${W}(?![a-z])`,"g"),q=new RegExp(`@${F}(?![a-z])`,"g"),Q=new RegExp(`^@${W}(?![a-z])`),Z=new RegExp(`^@${F}(?![a-z])`),se=z,ie=!0;while(ie){ie=!1,H.lastIndex=0;let oe=H.exec(se);if(!oe)break;let ae=oe.index,le=ae+oe[0].length;if(W==="env"){let Ee=se.substring(le).match(/^\s*\(\s*(['"])([^'"]+)\1\s*\)/);if(!Ee)break;le+=Ee[0].length,V=T===Ee[2]}let ce=1,ge=le,$e=-1;while(ce>0&&ge<se.length){H.lastIndex=ge,q.lastIndex=ge;let Ee=H.exec(se),Me=q.exec(se),je=Ee?Ee.index:1/0,Ne=Me?Me.index:1/0;if(je<Ne)ce++,ge=je+Ee[0].length;else if(Ne<1/0){if(ce--,ce===0){$e=Ne;break}ge=Ne+Me[0].length}else break}if($e===-1){console.warn(`[stx] @${W} directive at position ${ae} has no matching @${F} \u2014 the block was skipped.`);break}let ye=se.substring(le,$e),ke=-1,Re=0,Ae=0;while(Ae<ye.length){let Ee=ye.indexOf("@",Ae);if(Ee===-1)break;let Me=ye.substring(Ee);if(Q.test(Me)){Re++,Ae=Ee+1;continue}if(Z.test(Me)){Re--,Ae=Ee+1;continue}if(Re===0&&/^@else(?![a-z])/.test(Me)){ke=Ee;break}Ae=Ee+1}let Ie;if(ke!==-1){let Ee=ye.slice(0,ke),Me=ye.slice(ke+5);Ie=V?Ee:Me}else Ie=V?ye:"";let Pe=`@${F}`.length;se=se.substring(0,ae)+Ie+se.substring($e+Pe),ie=!0}return se}return R=B(R,"env","endenv",!1),R=B(R,"production","endproduction",T==="production"),R=B(R,"development","enddevelopment",T==="development"),R=B(R,"staging","endstaging",T==="staging"),R=B(R,"testing","endtesting",T==="testing"),R}var mp=new WeakMap;function hp(v=16){let _=new Uint8Array(v);return crypto.getRandomValues(_),btoa(String.fromCharCode(..._))}function ca(v,_){if(!v)return _?.nonceGenerator?.()??hp();let k=mp.get(v);if(!k)k=_?.nonceGenerator?.()??hp(),mp.set(v,k);return k}function lb(v,_){let k=[];for(let[R,T]of Object.entries(v)){if(T===void 0||T===null)continue;if(typeof T==="boolean"){if(T)k.push(R);continue}if(Array.isArray(T)){let B=[...T];if(_&&(R==="script-src"||R==="style-src"))B=B.filter((z)=>!z.startsWith("'nonce-")),B.push(`'nonce-${_}'`);if(B.length>0)k.push(`${R} ${B.join(" ")}`)}}return k.join("; ")}function yp(v,_){return`<meta http-equiv="Content-Security-Policy" content="${lb(v,_).replace(/&/g,"&amp;").replace(/"/g,"&quot;")}">`}function xp(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 R=_.useNonce?ca(k,_):void 0,T=yp(_.directives,R);return v.replace(/<head([^>]*)>/,`<head$1>
2292
+ </script>`}var A={enabled:!0,ssr:!1,partialsDir:"partials",componentsDir:"components",layoutsDir:"layouts",defaultLayout:"default",debug:!1,cache:!0,stateDir:Pt,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:qf,hasEndTag:!0,description:"Render markdown content to HTML"},{name:"webcomponent",handler:up,hasEndTag:!1,description:"Include a web component in the template"},$i,Ri,cr,lr,Df,Of,Nf,Mf,Vf,Pf,tp,pl,...Sr],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 Hx(v,_,k){let R=_||"pages";if(v)return{root:v,pagesDir:R};let T=k||process.cwd(),B=Jt.join(T,"resources","views"),z=Jt.join(T,"resources","layouts");if(Os.existsSync(B)&&Os.existsSync(z))return{root:"resources",pagesDir:"views"};let W=Jt.join(T,"resources","views","pages");if(Os.existsSync(W))return{root:"resources/views",pagesDir:R};return{root:".",pagesDir:R}}var dp=new Set,ia=["partialsDir","componentsDir","layoutsDir"],gl=new WeakMap;function qx(v,_){let k=_.replace(/[\\/]+$/,"");if(!k||k===".")return!0;let R=v.replace(/\\/g,"/"),T=k.replace(/\\/g,"/");return R===T||R.startsWith(`${T}/`)}function qc(v,_){let k=!v.root,R=Hx(v.root,v.pagesDir,_);if(v.root=R.root,v.pagesDir=R.pagesDir,k&&R.root!=="."){let T=`${_}::${R.root}`;if(!dp.has(T))dp.add(T),console.warn(`[stx] No "root" in config \u2014 inferred "${R.root}" from the project layout. Template directories are resolved under it; set root explicitly to pin this.`)}if(!gl.has(v)){let T={};for(let B of ia){let z=v[B];if(typeof z==="string"&&z)T[B]=z}gl.set(v,T)}if(v.root&&v.root!=="."){let T=v.root;for(let B of ia){let z=v[B];if(typeof z!=="string"||!z)continue;if(Jt.isAbsolute(z)||qx(z,T))continue;v[B]=Jt.join(T,z)}}for(let T of ia){let B=v[T];if(typeof B!=="string"||!B||Jt.isAbsolute(B))continue;v[T]=Jt.resolve(_,B)}return v}function Kx(v,_){let k=gl.get(v);for(let R of ia){let T=v[R];if(typeof T!=="string"||!T)continue;let B=Jt.isAbsolute(T)?T:Jt.join(_,T);if(Os.existsSync(B))continue;let z=k?.[R]??T,W=v.root,F=!!W&&W!==".";console.warn(`[stx] ${String(R)} resolves to "${B}", which does not exist. Configured as "${z}"`+(F?`, resolved under root "${W}".`:"."))}}function Xx(v){if(v.customDirectives)v.customDirectives=[...v.customDirectives];if(v.middleware)v.middleware=[...v.middleware];if(v.apiRoutes)v.apiRoutes={...v.apiRoutes}}function Zx(v){if(Di(v.stateDir),v.stateDir=mn(),v.cachePath=hn(v.cachePath),v.build)v.build.cacheDir=hn(v.build.cacheDir);if(v.media?.cache)v.media.cache.directory=hn(v.media.cache.directory);if(v.story)v.story.outDir=hn(v.story.outDir)}var wr=null,Br=new Map,sa=new Map,ro=null;async function As(v,_=Ux){try{return await _(v)}catch(k){if(k instanceof Error&&k.name==="ConfigNotFoundError")return{config:v.defaultConfig};throw k}}async function o(v){let _=v?Jt.resolve(v):process.cwd(),k=sa.get(_);if(k&&k.signature!==or(k.graph)){let B=Br.get(_);if(Br.delete(_),sa.delete(_),!v)wr=null,ro=null;let{clearComponentCache:z}=await import("./chunk-ay6dzpt4.js"),{partialsCache:W}=await import("./chunk-sf98zgw2.js");if(z(),W.clear(),B&&k.configSignature===ir(k.graph)){let F=B.then(async(V)=>{let H={...k.graph};await Is(H,_),sa.set(_,{graph:H,signature:or(H),configSignature:ir(H)});let q={...V,_layerGraph:H};if(!v)wr=q;return q});return Br.set(_,F),F}}if(!v){if(wr)return wr;if(ro)return ro}let R=Br.get(_);if(R)return R;let T=(async()=>{let B=[".ts",".js",".mjs",".cjs",".json"],z=B.some((Q)=>Os.existsSync(Jt.join(_,`stx.config${Q}`))),W=B.some((Q)=>Os.existsSync(Jt.join(_,"config",`ui${Q}`))),F;if(z&&W){let Q=await As({name:"ui",cwd:Jt.join(_,"config"),defaultConfig:A,errorPolicy:"throw",verbose:!1});F=(await As({name:"stx",alias:"ui",cwd:_,defaultConfig:Q.config,errorPolicy:"throw",verbose:!1})).config}else F=(await As({name:"stx",alias:"ui",cwd:_,defaultConfig:A,errorPolicy:"throw",verbose:!1})).config;if(F.extends!==void 0||k){let Q=await Ii(_,A);F=Q.config,sa.set(_,{graph:Q.graph,signature:or(Q.graph),configSignature:ir(Q.graph)})}if(F.runtimeConfig){let{resolveRuntimeConfig:Q}=await import("./chunk-sgsp4dph.js");Q(F.runtimeConfig,{});let{generateRuntimeConfigTypes:Z}=await import("./chunk-dskrwa8f.js");await Z(_,F.runtimeConfig)}Xx(F),Zx(F),qc(F,_),Kx(F,_);let V=[],H=new Set((F.plugins??[]).map((Q)=>typeof Q==="string"?Q:Q[0]));for(let Q of F.componentPackages??["@stacksjs/components"]){let Z=`${Q}/stx-plugin`;if(H.has(Z)||H.has(Q))continue;try{d.resolve(Z,{paths:[_]}),V.push(Z)}catch{}}let q=[...F.plugins??[],...V];if(q.length>0){let{pluginManager:Q}=await import("./chunk-dpn1pmxj.js"),Z=[],se=[];for(let ie of q){let oe=typeof ie==="string"?ie:ie[0],ae=typeof ie==="string"?{}:ie[1]||{};try{let le,ce;try{let $e=d.resolve(oe,{paths:[_]});le=await import($e),ce=Jt.dirname($e)}catch{let $e=Jt.resolve(_,oe);le=await import($e),ce=Jt.dirname($e)}let ge=le.default||le;if(!Q.has(ge.name))await Q.register(ge,F);if(ge.components){let $e=Array.isArray(ge.components)?ge.components:[ge.components];for(let ye of $e)Z.push(Jt.resolve(ce,ye))}if(ge.pages){let $e=Jt.resolve(ce,ge.pages),ye=ae.path||"/";se.push({dir:$e,prefix:ye})}if(ge.setup){let $e={addDirective:(ye)=>{F.customDirectives=F.customDirectives||[],F.customDirectives.push(ye)},addRoute:(ye,ke)=>{F.apiRoutes=F.apiRoutes||{},F.apiRoutes[ye]=ke},addMiddleware:(ye)=>{F.middleware=F.middleware||[],F.middleware.push(ye)},pluginDir:ce,config:F};await ge.setup(ae,$e)}process.stderr.write(`[stx] Plugin loaded: ${ge.name||oe}
2293
+ `)}catch(le){console.warn(`[stx] Failed to load plugin ${oe}:`,le.message)}}F._pluginComponentDirs=Z,F._pluginPageDirs=se}return F})();if(Br.set(_,T),T.catch(()=>{if(Br.get(_)===T)Br.delete(_)}),!v)ro=T,T.then((B)=>{wr=B}).catch(()=>{});return T}var P=new Proxy(A,{get(v,_){if(wr&&_ in wr)return wr[_];if(!ro)o().catch((k)=>{console.warn("[stx] Failed to load config file:",k?.message||k)});return v[_]}});function ld(v){return v}function ud(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 R=["auto","manual","sections"];if(!R.includes(v.streaming.strategy))_.push({path:"streaming.strategy",message:`streaming.strategy must be one of: ${R.join(", ")}`,severity:"error"})}}if(v.i18n){if(v.i18n.format!==void 0){let R=["json","yaml","yml","js"];if(!R.includes(v.i18n.format))_.push({path:"i18n.format",message:`i18n.format must be one of: ${R.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 R=["AA","AAA"];if(!R.includes(v.a11y.level))_.push({path:"a11y.level",message:`a11y.level must be one of: ${R.join(", ")}`,severity:"error"})}}if(v.hydration){if(v.hydration.mode!==void 0){let R=["progressive","islands"];if(!R.includes(v.hydration.mode))_.push({path:"hydration.mode",message:`hydration.mode must be one of: ${R.join(", ")}`,severity:"error"})}if(v.hydration.preload!==void 0){let R=["none","eager","lazy"];if(!R.includes(v.hydration.preload))_.push({path:"hydration.preload",message:`hydration.preload must be one of: ${R.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((R,T)=>{if(!R.name||typeof R.name!=="string")_.push({path:`customDirectives[${T}].name`,message:"Custom directive must have a name string",severity:"error"});if(!R.handler||typeof R.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((R,T)=>{if(!R.name||typeof R.name!=="string")_.push({path:`middleware[${T}].name`,message:"Middleware must have a name string",severity:"error"});if(!R.handler||typeof R.handler!=="function")_.push({path:`middleware[${T}].handler`,message:"Middleware must have a handler function",severity:"error"});if(!R.timing||!["before","after"].includes(R.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 R=["fullscreen","standalone","minimal-ui","browser"];if(!R.includes(v.pwa.manifest.display))_.push({path:"pwa.manifest.display",message:`PWA display must be one of: ${R.join(", ")}`,severity:"error"})}if(v.pwa.manifest?.orientation!==void 0){let R=["portrait","landscape","any","portrait-primary","portrait-secondary","landscape-primary","landscape-secondary"];if(!R.includes(v.pwa.manifest.orientation))_.push({path:"pwa.manifest.orientation",message:`PWA orientation must be one of: ${R.join(", ")}`,severity:"error"})}if(v.pwa.routes){let R=["cache-first","network-first","stale-while-revalidate","network-only","cache-only"];v.pwa.routes.forEach((T,B)=>{if(!T.pattern||typeof T.pattern!=="string")_.push({path:`pwa.routes[${B}].pattern`,message:"PWA route must have a pattern string",severity:"error"});if(!R.includes(T.strategy))_.push({path:`pwa.routes[${B}].strategy`,message:`PWA route strategy must be one of: ${R.join(", ")}`,severity:"error"});if(T.maxAgeSeconds!==void 0&&(typeof T.maxAgeSeconds!=="number"||T.maxAgeSeconds<0))_.push({path:`pwa.routes[${B}].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[${B}].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 R=["any","maskable","monochrome"];if(v.pwa.icons.purpose.filter((B)=>!R.includes(B)).length>0)_.push({path:"pwa.icons.purpose",message:`PWA icon purpose must be one of: ${R.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 hl=new Map;async function pe(v,_={}){try{if(!await r(v))throw Error(`Markdown file not found: ${v}`);let R=(await Gx.promises.stat(v)).mtime.getTime();if(_.cache&&hl.has(v)){let q=hl.get(v);if(q.updatedAt>=R)return{content:q.content,data:q.data}}let T=await Bun.file(v).text(),{data:B,content:z}=qn(T),W=_.markdown||P.markdown||{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0}},V=Be(z,{gfm:!0});if(W.syntaxHighlighting?.enabled&&W.syntaxHighlighting?.serverSide)V=await Yx(V,W.syntaxHighlighting?.defaultTheme||"github-dark",W.syntaxHighlighting?.highlightUnknownLanguages||!1);let H={content:V,data:B||{}};if(_.cache)hl.set(v,{...H,updatedAt:R});return H}catch(k){if(_.debug)console.error(`Error reading/parsing markdown file ${v}:`,k);let R=k instanceof Error?k.message:String(k);return{content:g("Markdown File",`Error reading/parsing markdown file: ${R}`,v,"",0,""),data:{}}}}var oa=null;async function Yx(v,_,k){let R=/<pre><code( class="language-([^"]+)")?>([^<]+)<\/code><\/pre>/g;if(!oa)try{oa=await Jx({theme:_||"github-dark",cache:!0})}catch(W){return console.error("Failed to initialize ts-syntax-highlighter:",W),v}let T=async(W,F,V,H)=>{let q=H.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&").replace(/&quot;/g,'"').replace(/&#39;/g,"'"),Q=V||(k?"text":"");if(!Q)return W;try{if(!oa.getSupportedLanguages().includes(Q))return W;return(await oa.highlight(q,Q,{theme:_})).html}catch(Z){console.error(`Error highlighting code block with language ${V}:`,Z)}return W},B=v,z=v.matchAll(R);for(let W of z){let[F,V,H,q]=W,Q=await T(F,V,H,q);B=B.replace(F,Q)}return B}async function fp(v,_,k="",R={}){return await Qx(v,/@markdown-file\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\}))?\)/g,async(z,W,F,V)=>{try{let H=W;if(!ml.isAbsolute(W))H=ml.resolve(ml.dirname(k),W);let q={};if(F)try{try{q=JSON.parse(F)}catch{if(R.debug)console.warn("Using safer alternative for parsing JS object literal");let le=F.replace(/^\s*\{|\}\s*$/g,"").trim().split(/,(?=\s*\w+\s*:)/);for(let ce of le){let ge=ce.indexOf(":");if(ge>0){let $e=ce.substring(0,ge).trim(),ye=ce.substring(ge+1).trim(),ke=ye.startsWith('"')&&ye.endsWith('"'),Re=ye.startsWith("'")&&ye.endsWith("'");if(ke||Re)ye=ye.substring(1,ye.length-1);q[$e]=ye}}}}catch(ae){if(R.debug)console.error("Error parsing context in @markdown-file directive:",ae)}let{content:Q,data:Z}=await pe(H,R),se={..._,...Z,...q},ie=Q,oe=/\{\{([^}]+)\}\}/g;return ie=ie.replace(oe,(ae,le)=>{let ce=le.trim();return se[ce]!==void 0?String(se[ce]):ae}),ie}catch(H){let q=H instanceof Error?H.message:String(H);return g("Markdown File",`Error including markdown file: ${q}`,k,v,V,z)}})}async function Qx(v,_,k){let R=[],T;while((T=_.exec(v))!==null){let W=T[0],F=T.index,V=T;R.push(k(...V).then((H)=>({match:W,replacement:H,index:F})))}let B=await Promise.all(R);B.sort((W,F)=>F.index-W.index);let z=v;for(let{match:W,replacement:F}of B)z=z.replace(W,()=>F);return z}function $r(v,_){try{let k=v.trim();if(p(k))return c(k,Object.keys(_))(...Object.values(_));else return l(k,_)}catch{return!1}}function _r(v,_){let k=eb(v,_);return k.ok?{expression:k.expression,endPos:k.endPos}:null}function eb(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 R=S(v,"(",")",k);if(R===-1)return{ok:!1,reason:"unclosed-paren",pos:k};return{ok:!0,expression:v.slice(k+1,R),endPos:R+1}}function tb(v,_){let k=v.lastIndexOf("<",_);if(k===-1)return!1;return k>v.lastIndexOf(">",_)}function zr(v,_,k,R){let T=1,B=R,z=new RegExp(`@${_}\\s*\\(`,"g"),W=new RegExp(`@${k}(?![a-z])`,"g");while(B<v.length&&T>0){z.lastIndex=B,W.lastIndex=B;let F=z.exec(v),V=W.exec(v),H=F?F.index:1/0,q=V?V.index:1/0;if(H<q)T++,B=H+F[0].length;else if(q<1/0){if(T--,T===0)return q;B=q+V[0].length}else break}return-1}function pp(v,_){let k=v.slice(_).match(/^@if\s*/);if(!k)return null;let R=_+k[0].length,T=_r(v,R);if(!T)return null;let B=T.endPos,z=zr(v,"if","endif",B);if(z===-1)return null;let W=v.slice(B,z),F=[],V=0,H="if",q=T.expression,Q=0,Z=0;while(V<W.length){let se=W.indexOf("@",V);if(se===-1)break;V=se;let ie=W.substring(se);if(tb(W,se)){V++;continue}if(/^@if\s*\(/.test(ie)){Z++,V++;continue}if(/^@endif(?![a-z])/.test(ie)){Z--,V+=6;continue}if(Z===0){let oe=ie.match(/^@elseif\s*/);if(oe){F.push({type:H,condition:q,content:W.substring(Q,V),start:B+Q,end:B+V});let ae=V+oe[0].length,le=_r(W,ae);if(!le){V++;continue}H="elseif",q=le.expression,V=le.endPos,Q=V;continue}else if(/^@else(?![a-z])/.test(ie)){F.push({type:H,condition:q,content:W.substring(Q,V),start:B+Q,end:B+V}),H="else",q=void 0,V+=5,Q=V;continue}}V++}return F.push({type:H,condition:q,content:W.slice(Q),start:B+Q,end:B+W.length}),{fullMatch:v.slice(_,z+6),branches:F,start:_,end:z+6}}function so(v){let _=[],k=/@if\s*\(/g,R=k.exec(v);while(R!==null){if(_.some((z)=>R.index>z.start&&R.index<z.end)){R=k.exec(v);continue}let B=pp(v,R.index);if(B)_.push(B),k.lastIndex=B.end;R=k.exec(v)}return _}function aa(v,_,k){let R=[],T=new RegExp(`@${_}\\s*\\(`,"g"),B=T.exec(v);while(B!==null){if(R.some((ie)=>B.index>ie.start&&B.index<ie.end)){B=T.exec(v);continue}let W=B.index,F=W+B[0].length-1,V=S(v,"(",")",F);if(V===-1){B=T.exec(v);continue}let H=v.slice(F+1,V),q=V+1,Q=zr(v,_,k,q);if(Q===-1){B=T.exec(v);continue}let Z=v.slice(q,Q),se=Q+`@${k}`.length;R.push({fullMatch:v.slice(W,se),name:_,params:H,content:Z,start:W,end:se}),T.lastIndex=se,B=T.exec(v)}return R}function yl(v,_){let k=v.slice(_).match(/^@switch\s*/);if(!k)return null;let R=_+k[0].length,T=_r(v,R);if(!T)return null;let B=T.endPos,z=zr(v,"switch","endswitch",B);if(z===-1)return null;let W=v.slice(B,z),F=[],V=0,H=null,q=0;while(V<W.length){let Q=W.slice(V),Z=Q.match(/^@switch\s*\(/),se=Q.match(/^@endswitch(?![a-z])/);if(Z){if(q++,H)H.content+=Z[0];V+=Z[0].length;continue}if(se){if(q--,H)H.content+=se[0];V+=se[0].length;continue}if(q>0){if(H)H.content+=W[V];V++;continue}let ie=Q.match(/^@case\s*/),oe=Q.match(/^@default(?![a-z])/),ae=Q.match(/^@break(?![a-z])/);if(ie&&Q.startsWith("@case")){if(H)F.push(H);let le=V+ie[0].length,ce=_r(W,le);if(!ce){V++;continue}H={type:"case",value:ce.expression,content:""},V=ce.endPos}else if(oe&&Q.startsWith("@default")){if(H)F.push(H);H={type:"default",content:""},V+=oe[0].length}else if(ae&&Q.startsWith("@break"))V+=ae[0].length;else{if(H)H.content+=W[V];V++}}if(H)F.push(H);return{fullMatch:v.slice(_,z+10),expression:T.expression,cases:F,start:_,end:z+10}}function ib(v,_,k){let R=v,T=!0;while(T){T=!1;let B=R.match(/@switch\s*\(/);if(!B||B.index===void 0)break;let z=B.index,W=yl(R,z);if(!W)break;try{let F;if(p(W.expression))F=c(W.expression,Object.keys(_))(...Object.values(_));else F=l(W.expression,_);let V="",H=!1;for(let q of W.cases)if(q.type==="default"){if(!H)V=q.content.trim()}else try{let Q;if(q.value&&p(q.value))Q=c(q.value,Object.keys(_))(...Object.values(_));else if(q.value)Q=l(q.value,_);if(F===Q){V=q.content.trim(),H=!0;break}}catch{continue}R=R.substring(0,z)+V+R.substring(W.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);R=R.substring(0,z)+H+R.substring(W.end);break}}return R}function ob(v){let _=[];return{masked:v.replace(/<script\b[\s\S]*?<\/script\s*>/gi,(R)=>(_.push(R),`\x00stx-script-${_.length-1}\x00`)),scripts:_}}function ab(v,_){if(_.length===0)return v;return v.replace(/\u0000stx-script-(\d+)\u0000/g,(k,R)=>_[Number(R)]??k)}function ur(v,_,k){let{masked:R,scripts:T}=ob(v);return ab(cb(R,_,k),T)}function cb(v,_,k){let R=v;R=ib(R,_,k);{let B=!0;while(B){B=!1;let z=R.match(/@unless\s*\(/);if(!z||z.index===void 0)break;let W=z.index,F=_r(R,W+7);if(!F)break;let V=F.endPos,H=zr(R,"unless","endunless",V);if(H===-1){console.warn(`[stx] @unless directive at position ${W} has no matching @endunless \u2014 the block was skipped. Check for typos or missing closers.`);break}let q=R.slice(V,H),Q=F.expression,Z=-1;{let ie=0,oe=/@(?:if|unless)\s*\(/g,ae=/@(?:endif|endunless)(?![a-z])/g,le=/@else(?![a-z])/g,ce=[],ge;while((ge=oe.exec(q))!==null)ce.push({pos:ge.index,type:"open"});while((ge=ae.exec(q))!==null)ce.push({pos:ge.index,type:"close"});while((ge=le.exec(q))!==null)ce.push({pos:ge.index,type:"else"});ce.sort(($e,ye)=>$e.pos-ye.pos);for(let $e of ce)if($e.type==="open")ie++;else if($e.type==="close")ie--;else if($e.type==="else"&&ie===0){Z=$e.pos;break}}let se;if(Z!==-1){let ie=q.slice(0,Z),oe=q.slice(Z+5);se=`@if (${Q})${oe}@else ${ie}@endif`}else se=`@if (!(${Q}))${q}@endif`;R=R.substring(0,W)+se+R.substring(H+10),B=!0}}R=bl(R,_,k),R=vl(R,_,k),R=xl(R,_);let T=()=>{let B=so(R);if(B.length===0)return!1;let z=Array(B.length);for(let V=B.length-1;V>=0;V--){let H=B[V];try{let q="",Q=!1;for(let Z of H.branches){if(Q)break;if(Z.type==="else")q=Z.content,Q=!0;else try{if(Z.condition?zi(Z.condition,_):!1)q=Z.content,Q=!0}catch(se){q=i(Z.type==="if"?"If":"Elseif",`Error in @${Z.type}(${Z.condition}): ${se instanceof Error?se.message:String(se)}`,t.EVALUATION_ERROR),Q=!0}}z[V]=q}catch(q){let Q=q instanceof Error?q.message:String(q);z[V]=i("If",`Error processing @if block: ${Q}`,t.EVALUATION_ERROR)}}let W=Array(B.length*2+1),F=0;for(let V=0;V<B.length;V++){let H=B[V];W[V*2]=R.slice(F,H.start),W[V*2+1]=z[V],F=H.end}return W[B.length*2]=R.slice(F),R=W.join(""),!0};while(!0){let B=R;if(!T())break;if(R===B)break}return R}function gp(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 R=[];while(_<v.length){let T=v[_];if(T==="\\"&&_+1<v.length){R.push(v[_+1]),_+=2;continue}if(T===k){_++;break}R.push(T),_++}while(_<v.length&&/\s/.test(v[_]))_++;if(v[_]!==")")return null;return _++,{value:R.join(""),consumed:_}}function xl(v,_){let k=v;function R(W,F,V,H){let q=1,Q=H,Z=new RegExp(`@${F}(?:\\s*\\(|\\s|$)`,"g"),se=new RegExp(`@${V}(?![a-z])`,"g");while(Q<W.length&&q>0){Z.lastIndex=Q,se.lastIndex=Q;let ie=Z.exec(W),oe=se.exec(W),ae=ie?ie.index:1/0,le=oe?oe.index:1/0;if(ae<le)q++,Q=ae+ie[0].length;else if(le<1/0){if(q--,q===0)return le;Q=le+oe[0].length}else break}return-1}function T(W,F,V){let H=0,q=new RegExp(`@${F}(?:\\s*\\(|\\s|$)`,"g"),Q=new RegExp(`@${V}(?![a-z])`,"g"),Z=/@else(?![a-z])/g,se=[],ie;while((ie=q.exec(W))!==null)se.push({pos:ie.index,type:"open"});while((ie=Q.exec(W))!==null)se.push({pos:ie.index,type:"close"});while((ie=Z.exec(W))!==null)se.push({pos:ie.index,type:"else"});se.sort((oe,ae)=>oe.pos-ae.pos);for(let oe of se)if(oe.type==="open")H++;else if(oe.type==="close")H--;else if(oe.type==="else"&&H===0)return oe.pos;return-1}{let W=!0;while(W){W=!1;let F=k.match(/@auth(?:\s*\(|\s|(?=\n))/);if(!F||F.index===void 0)break;let V=F.index,H,q,Q=k.slice(V+5),Z=gp(Q);if(Z)H=Z.value,q=V+5+Z.consumed;else q=V+5;let se=R(k,"auth","endauth",q);if(se===-1){console.warn(`[stx] @auth directive at position ${V} has no matching @endauth \u2014 the block was skipped.`);break}let ie=k.slice(q,se),oe=T(ie,"auth","endauth"),ae;if(!_.auth)ae=!1;else ae=H?$r(`auth?.check && auth?.user?.[${H}]`,_):$r("auth?.check",_);let le;if(oe!==-1){let ce=ie.slice(0,oe),ge=ie.slice(oe+5);le=ae?ce:ge}else le=ae?ie:"";k=k.substring(0,V)+le+k.substring(se+8),W=!0}}{let W=!0;while(W){W=!1;let F=k.match(/@guest(?:\s*\(|\s|(?=\n))/);if(!F||F.index===void 0)break;let V=F.index,H,q,Q=k.slice(V+6),Z=gp(Q);if(Z)H=Z.value,q=V+6+Z.consumed;else q=V+6;let se=R(k,"guest","endguest",q);if(se===-1){console.warn(`[stx] @guest directive at position ${V} has no matching @endguest \u2014 the block was skipped.`);break}let ie=k.slice(q,se),oe=T(ie,"guest","endguest"),ae;if(!_.auth)ae=!0;else ae=H?$r(`!auth?.check || !auth?.user?.[${H}]`,_):$r("!auth?.check",_);let le;if(oe!==-1){let ce=ie.slice(0,oe),ge=ie.slice(oe+5);le=ae?ce:ge}else le=ae?ie:"";k=k.substring(0,V)+le+k.substring(se+9),W=!0}}function B(W,F,V){if(_.userCan&&typeof _.userCan[W]==="boolean")return _.userCan[W];if(_.permissions?.check&&typeof _.permissions.check==="function")try{let H=[W];if(F)H.push(F);if(V){let q=$r(V,_);H.push(q)}return _.permissions.check(...H)}catch{return!1}return!1}function z(W){let F=W.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 W of["can","cannot"]){let F=`end${W}`,V=W==="can"?"elsecan":"elsecannot",H=!0;while(H){H=!1;let q=k.match(new RegExp(`@${W}\\s*\\(`));if(!q||q.index===void 0)break;let Q=q.index,Z=k.slice(Q+`@${W}`.length),se=z(Z);if(!se)break;let ie=Q+`@${W}`.length+se.paramsEnd,oe=R(k,W,F,ie);if(oe===-1){console.warn(`[stx] @${W} directive at position ${Q} has no matching @${F} \u2014 the block was skipped.`);break}let ae=k.slice(ie,oe),le=[],ce=0,ge=new RegExp(`@${W}\\s*\\(`,"g"),$e=new RegExp(`@${F}(?![a-z])`,"g"),ye=new RegExp(`@${V}\\s*\\(`,"g"),ke=/@else(?![a-z])/g,Re=[],Ae;while((Ae=ge.exec(ae))!==null)Re.push({pos:Ae.index,type:"open"});while((Ae=$e.exec(ae))!==null)Re.push({pos:Ae.index,type:"close"});while((Ae=ye.exec(ae))!==null)Re.push({pos:Ae.index,type:"elseDirective"});while((Ae=ke.exec(ae))!==null)Re.push({pos:Ae.index,type:"else"});Re.sort((Ne,De)=>Ne.pos-De.pos);for(let Ne of Re){if(Ne.type==="open"){ce++;continue}if(Ne.type==="close"){ce--;continue}if(ce===0)le.push(Ne)}let Ie=[],Pe=0;for(let Ne=0;Ne<le.length;Ne++){let De=le[Ne];if(Ie.push({content:ae.slice(Pe,De.pos),ability:void 0}),De.type==="elseDirective"){let Le=ae.slice(De.pos+`@${V}`.length),ct=z(Le);if(ct){Ie[Ie.length-1]={content:ae.slice(Pe,De.pos)},Pe=De.pos+`@${V}`.length+ct.paramsEnd,Ie.push({content:"",ability:ct.ability,type:ct.type,id:ct.id}),Ie.pop();let yt=le[Ne+1],pt=yt?yt.pos:ae.length;Ie.push({content:ae.slice(Pe,pt),ability:ct.ability,type:ct.type,id:ct.id}),Pe=pt}}else Pe=De.pos+5}if(Pe<ae.length){let Ne=Ie[Ie.length-1];if(le.length>0&&le[le.length-1].type==="else")Ie.push({content:ae.slice(Pe),isFinalElse:!0});else if(Ie.length===0)Ie.push({content:ae.slice(Pe)})}let Ee=B(se.ability,se.type,se.id),Me=W==="can"?Ee:!Ee,je="";if(Me)je=Ie[0]?.content||"";else{let Ne=!1;for(let De=1;De<Ie.length;De++){let Le=Ie[De];if(Le.isFinalElse){je=Le.content,Ne=!0;break}if(Le.ability){let ct=B(Le.ability,Le.type,Le.id);if(W==="can"?ct:!ct){je=Le.content,Ne=!0;break}}}if(!Ne&&Ie.length>0){let De=Ie[Ie.length-1];if(De.isFinalElse)je=De.content}}k=k.substring(0,Q)+je+k.substring(oe+`@${F}`.length),H=!0}}return k}function bl(v,_,k){let R=v;function T(B,z,W,F,V){let H=!0;while(H){H=!1;let q=new RegExp(`@${z}\\s*\\(`),Q=B.match(q);if(!Q||Q.index===void 0)break;let Z=Q.index,se=_r(B,Z+`@${z}`.length);if(!se)break;let ie=se.endPos,oe=zr(B,z,W,ie);if(oe===-1){console.warn(`[stx] @${z} directive at position ${Z} has no matching @${W} \u2014 the block was skipped.`);break}let ae=B.slice(ie,oe),le=se.expression,ce=-1,ge=0,$e=0;while($e<ae.length){let ye=ae.indexOf("@",$e);if(ye===-1)break;let ke=ae.substring(ye);if(/^@(?:if|unless|isset|empty)\s*\(/.test(ke)){ge++,$e=ye+1;continue}if(/^@(?:endif|endunless|endisset|endempty)(?![a-z])/.test(ke)){ge--,$e=ye+1;continue}if(ge===0&&/^@else(?![a-z])/.test(ke)){ce=ye;break}$e=ye+1}try{let ye=F(le.trim()),ke;if(ce!==-1){let Re=ae.slice(0,ce),Ae=ae.slice(ce+5);ke=ye?Re:Ae}else ke=ye?ae:"";B=B.substring(0,Z)+ke+B.substring(oe+`@${W}`.length),H=!0}catch(ye){let ke=ye instanceof Error?ye.message:String(ye),Re=i(V,`Error processing @${z} directive: ${ke}`,t.EVALUATION_ERROR);B=B.substring(0,Z)+Re+B.substring(oe+`@${W}`.length);break}}return B}return R=T(R,"isset","endisset",(B)=>{let z=$r(B,_);return z!==void 0&&z!==null},"Isset"),R=T(R,"empty","endempty",(B)=>{let z=$r(B,_);return z===void 0||z===null||z===""||z===0||z===!1||Array.isArray(z)&&z.length===0||typeof z==="object"&&z!==null&&Object.keys(z).length===0},"Empty"),R}function vl(v,_,k){let R=v,T="development";function B(z,W,F,V){let H=new RegExp(`@${W}(?![a-z])`,"g"),q=new RegExp(`@${F}(?![a-z])`,"g"),Q=new RegExp(`^@${W}(?![a-z])`),Z=new RegExp(`^@${F}(?![a-z])`),se=z,ie=!0;while(ie){ie=!1,H.lastIndex=0;let oe=H.exec(se);if(!oe)break;let ae=oe.index,le=ae+oe[0].length;if(W==="env"){let Ee=se.substring(le).match(/^\s*\(\s*(['"])([^'"]+)\1\s*\)/);if(!Ee)break;le+=Ee[0].length,V=T===Ee[2]}let ce=1,ge=le,$e=-1;while(ce>0&&ge<se.length){H.lastIndex=ge,q.lastIndex=ge;let Ee=H.exec(se),Me=q.exec(se),je=Ee?Ee.index:1/0,Ne=Me?Me.index:1/0;if(je<Ne)ce++,ge=je+Ee[0].length;else if(Ne<1/0){if(ce--,ce===0){$e=Ne;break}ge=Ne+Me[0].length}else break}if($e===-1){console.warn(`[stx] @${W} directive at position ${ae} has no matching @${F} \u2014 the block was skipped.`);break}let ye=se.substring(le,$e),ke=-1,Re=0,Ae=0;while(Ae<ye.length){let Ee=ye.indexOf("@",Ae);if(Ee===-1)break;let Me=ye.substring(Ee);if(Q.test(Me)){Re++,Ae=Ee+1;continue}if(Z.test(Me)){Re--,Ae=Ee+1;continue}if(Re===0&&/^@else(?![a-z])/.test(Me)){ke=Ee;break}Ae=Ee+1}let Ie;if(ke!==-1){let Ee=ye.slice(0,ke),Me=ye.slice(ke+5);Ie=V?Ee:Me}else Ie=V?ye:"";let Pe=`@${F}`.length;se=se.substring(0,ae)+Ie+se.substring($e+Pe),ie=!0}return se}return R=B(R,"env","endenv",!1),R=B(R,"production","endproduction",T==="production"),R=B(R,"development","enddevelopment",T==="development"),R=B(R,"staging","endstaging",T==="staging"),R=B(R,"testing","endtesting",T==="testing"),R}var mp=new WeakMap;function hp(v=16){let _=new Uint8Array(v);return crypto.getRandomValues(_),btoa(String.fromCharCode(..._))}function ca(v,_){if(!v)return _?.nonceGenerator?.()??hp();let k=mp.get(v);if(!k)k=_?.nonceGenerator?.()??hp(),mp.set(v,k);return k}function lb(v,_){let k=[];for(let[R,T]of Object.entries(v)){if(T===void 0||T===null)continue;if(typeof T==="boolean"){if(T)k.push(R);continue}if(Array.isArray(T)){let B=[...T];if(_&&(R==="script-src"||R==="style-src"))B=B.filter((z)=>!z.startsWith("'nonce-")),B.push(`'nonce-${_}'`);if(B.length>0)k.push(`${R} ${B.join(" ")}`)}}return k.join("; ")}function yp(v,_){return`<meta http-equiv="Content-Security-Policy" content="${lb(v,_).replace(/&/g,"&amp;").replace(/"/g,"&quot;")}">`}function xp(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 R=_.useNonce?ca(k,_):void 0,T=yp(_.directives,R);return v.replace(/<head([^>]*)>/,`<head$1>
2294
2294
  ${T}`)}function bp(v,_){let k=v;return k=k.replace(/<script(?![^>]*\ssrc=)([^>]*)>/gi,(R,T)=>{if(T.includes("nonce="))return R;return`<script nonce="${_}"${T}>`}),k=k.replace(/<style([^>]*)>/gi,(R,T)=>{if(T.includes("nonce="))return R;return`<style nonce="${_}"${T}>`}),k}function vp(v,_,k,R){let T=v,B=R.csp;if(T=T.replace(/@csp\b/g,()=>{if(!B?.enabled||!B.directives)return"<!-- CSP not configured -->";let z=B.useNonce?ca(_,B):void 0;return yp(B.directives,z)}),T=T.replace(/@cspNonce\b/g,()=>{if(!B?.enabled||!B.useNonce)return"";return ca(_,B)}),B?.enabled&&B.useNonce)_.cspNonce=ca(_,B);return T}import ub from"crypto";var db=40,wp="_token",wl=null;function fb(v=db){let _=ub.randomBytes(Math.ceil(v/2)).toString("hex").slice(0,v);return wl=_,_}function pb(){if(!wl)fb();return wl}function gb(v=wp){let _=pb();return`<input type="hidden" name="${v}" value="${_}">`}function Sp(v){return v.replace(/@csrf(?:\((['"])([^'"]*)\1\))?/g,(_,k,R)=>gb(R||wp))}async function $p(v,_,k,R){if(!R.customDirectives||R.customDirectives.length===0)return v;let T=v;for(let B of R.customDirectives){if(!B.name||typeof B.handler!=="function"){if(R.debug)console.warn("Invalid custom directive:",B);continue}if(B.hasEndTag)T=await mb(T,B,_,k,R);else T=await hb(T,B,_,k,R)}return T}async function mb(v,_,k,R,T){let{name:B,handler:z}=_,W=`@${B}`,F=`@end${B}`,V=v,H=Or(`${W}(?:\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\))?([\\s\\S]*?)${F}`,"g"),q=[],Q=H.exec(V);while(Q!==null){let[Z,se="",ie=""]=Q,oe=Q.index||0;try{let ae=se?_p(_,se):[],le=ie.trim(),ce=await z(le,ae,k,R);q.push({original:Z,processed:ce,startIndex:oe})}catch(ae){let le=ae instanceof Error?ae.message:String(ae);if(T.debug)console.error(`Error processing custom directive @${B}:`,ae);q.push({original:Z,processed:i("CustomDirective",`Error in @${B}${se?`(${se})`:""}: ${le}`,t.EVALUATION_ERROR),startIndex:oe})}Q=H.exec(V)}for(let Z=q.length-1;Z>=0;Z--){let{original:se,processed:ie}=q[Z];V=V.replace(se,ie)}return V}async function hb(v,_,k,R,T){let{name:B,handler:z}=_,W=v,F=[],V=[];if(_.rawParams){for(let Q of Bs(W,Or(`(?<![\\w$@])@${B}\\s*\\(`,"g")))if(Q.end!==-1)V.push({fullMatch:Q.call,paramString:Q.args,startIndex:Q.start})}else{let Q=Or(`@${B}\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\)`,"g");Q.lastIndex=0;let Z=Q.exec(W);while(Z!==null)V.push({fullMatch:Z[0],paramString:Z[1]??"",startIndex:Z.index||0}),Z=Q.exec(W)}for(let{fullMatch:Q,paramString:Z,startIndex:se}of V)try{let ie=_p(_,Z),oe=await z("",ie,k,R);F.push({original:Q,processed:oe,startIndex:se})}catch(ie){let oe=ie instanceof Error?ie.message:String(ie);if(T.debug)console.error(`Error processing custom directive @${B}:`,ie);F.push({original:Q,processed:i("CustomDirective",`Error in @${B}(${Z}): ${oe}`,t.EVALUATION_ERROR),startIndex:se})}let H=Or(`@${B}(?!\\w)(?!\\s*\\()`,"g"),q=H.exec(W);while(q!==null){let[Q]=q,Z=q.index||0;try{let se=await z("",[],k,R);F.push({original:Q,processed:se,startIndex:Z})}catch(se){let ie=se instanceof Error?se.message:String(se);if(T.debug)console.error(`Error processing custom directive @${B}:`,se);F.push({original:Q,processed:i("CustomDirective",`Error in @${B}: ${ie}`,t.EVALUATION_ERROR),startIndex:Z})}q=H.exec(W)}for(let Q=F.length-1;Q>=0;Q--){let{original:Z,processed:se}=F[Q];W=W.replace(Z,se)}return W}function _p(v,_){return v.rawParams?Qe(_):yb(_)}function yb(v){if(!v.trim())return[];let _=[],k="",R=!1,T="";for(let B=0;B<v.length;B++){let z=v[B];if((z==='"'||z==="'")&&(B===0||v[B-1]!=="\\"))if(!R)R=!0,T=z;else if(z===T)R=!1;else k+=z;else if(z===","&&!R)_.push(k.trim()),k="";else k+=z}if(k.trim())_.push(k.trim());return _.map((B)=>{let z=B.trim();if(z.startsWith('"')&&z.endsWith('"')||z.startsWith("'")&&z.endsWith("'"))return z.substring(1,z.length-1);return z})}var kp=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,Ep=/^[A-Za-z_$][\w$]*$/,xb=new Set(["light","dark","system"]);function Wr(v,_){if(typeof v!=="string"||v.length===0)throw Error(`@appearanceBootstrap ${_} must be a non-empty string`)}function bb(v){if(!v||typeof v!=="object"||Array.isArray(v))throw Error("@appearanceBootstrap expects an options object");let _=v,{appearance:k,colorMode:R}=_;if(Wr(_.storageKey,"storageKey"),k!==void 0&&(!k||typeof k!=="object"||Array.isArray(k)))throw Error("@appearanceBootstrap appearance must be an object when given");if(!R||typeof R!=="object"||Array.isArray(R))throw Error("@appearanceBootstrap colorMode must be an object");if(Wr(R.key,"colorMode.key"),Wr(R.attribute,"colorMode.attribute"),Wr(R.default,"colorMode.default"),!Ep.test(R.key))throw Error("@appearanceBootstrap preference keys must be JavaScript property names");if(!kp.test(R.attribute))throw Error("@appearanceBootstrap attributes must be lowercase data attribute names");if(!xb.has(R.default))throw Error("@appearanceBootstrap colorMode.default must be light, dark, or system");let T=null;if(k){if(Wr(k.key,"appearance.key"),Wr(k.attribute,"appearance.attribute"),Wr(k.default,"appearance.default"),!Ep.test(k.key))throw Error("@appearanceBootstrap preference keys must be JavaScript property names");if(!kp.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((B)=>typeof B!=="string"||B.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:R.key,attribute:R.attribute,default:R.default},respectExisting:_.respectExisting===!0}}function vb(v){return JSON.stringify(v).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function wb(v){return`<script data-stx-scoped data-stx-appearance-bootstrap>(function(){"use strict";const config=${vb(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 Sb(v,_){let k=1,R=null,T=!1;for(let B=_+1;B<v.length;B++){let z=v[B];if(T){T=!1;continue}if(R){if(z==="\\")T=!0;else if(z===R)R=null;continue}if(z==='"'||z==="'"||z==="`"){R=z;continue}if(z==="(")k++;else if(z===")"&&--k===0)return B}return-1}function Cp(v,_){let k=v,R=/@appearanceBootstrap\s*\(/g,T;while((T=R.exec(k))!==null){let B=T.index+T[0].length-1,z=Sb(k,B);if(z===-1)throw Error("@appearanceBootstrap has an unclosed options object");let W=k.slice(B+1,z).trim(),F=l(`(${W})`,_),V=wb(bb(F));k=k.slice(0,T.index)+V+k.slice(z+1),R.lastIndex=T.index+V.length}return k}import $b from"crypto";function Xt(v){return String(v??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}var Tp={input:"form-control",inputError:"is-invalid",checkInput:"form-check-input",label:"form-label",errorFeedback:"invalid-feedback"};function la(v,_,k,R){let T=v||_;return k?`${T} ${R}`:T}function Rn(v){return String(v).replace(/\[\]$/,"").replace(/[^\w.:-]+/g,"-").replace(/^-+|-+$/g,"")}function Ks(v,_){if(/\bid\s*=/i.test(v))return"";return` id="${Xt(_)}"`}function Sl(v,_,k){if(!_)return"";let R="";if(!/\baria-invalid\s*=/i.test(k))R+=' aria-invalid="true"';if(!/\baria-describedby\s*=/i.test(k))R+=` aria-describedby="${Xt(`${Rn(v)}-error`)}"`;return R}function _b(){return $b.randomUUID()}function ua(v,_){let k=v;return k=k.replace(/@csrf/g,()=>{if(!_.csrf||typeof _.csrf!=="object"){let R=_b();_.csrf={token:R}}if(_.csrf.field)return _.csrf.field;if(_.csrf.token)return`<input type="hidden" name="_token" value="${Xt(_.csrf.token)}">`;return'<input type="hidden" name="_token" value="">'}),k=k.replace(/@method\(['"]([^'"]+)['"]\)/g,(R,T)=>{let B=T.toUpperCase();if(T&&!["GET","POST"].includes(B))return`<input type="hidden" name="_method" value="${Xt(B)}">`;return R}),k}function Ap(v,_,k=Tp){let R=v;return R=R.replace(/@form\(\s*(?:(?:'([^']+)'|"([^"]+)")\s*)?(?:,\s*(?:'([^']+)'|"([^"]+)")?)?\s*(?:,\s*\{([^}]+)\}\s*)?\)/g,(T,B,z,W,F,V="")=>{let H=B||z||"POST",q=W||F||"",Q=kr(V),Z=H.toUpperCase(),se=["GET","POST"].includes(Z)?Z:"POST",ie=`<form method="${Xt(se)}" action="${Xt(q)}"${Q?` ${Q}`:""}>`;if(ie+=`
2295
2295
  ${ua("@csrf",_)}`,!["GET","POST"].includes(Z))ie+=`
2296
- ${ua(`@method('${Z}')`,_)}`;return ie}),R=R.replace(/@endform/g,"</form>"),R=R.replace(/@input\(\s*(?:'([^']+)'|"([^"]+)")\s*(?:,\s*(?:(?:'([^']*)'|"([^"]*)")\s*)?)?(?:,\s*\{([^}]+)\})?\s*\)/g,(T,B,z,W,F,V="")=>{let H=B||z||"",q=W||F||"",Q=kr(V),Z=io(H,_),se=Z!==void 0&&Z!==null?Z:q||"",ie=Q.match(/type=['"]([^'"]+)['"]/i),oe=ie?ie[1]:"text",ae=oo(H,_),le=Q.match(/class=['"]([^'"]+)['"]/i),ce=la(le?le[1]:"",k.input,ae,k.inputError),ge=Q.replace(/class=['"][^'"]+['"]/i,"");return ge=ge.replace(/type=['"][^'"]+['"]/i,""),`<input type="${Xt(oe)}" name="${Xt(H)}"${Ks(Q,Rn(H))} value="${Xt(se)}" class="${ce}"${Sl(H,ae,Q)}${ge?` ${ge}`:""}>`}),R=R.replace(/@textarea\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endtextarea/g,(T,B,z="",W="")=>{let F=kr(z),V=io(B,_)||W.trim(),H=oo(B,_),q=F.match(/class=['"]([^'"]+)['"]/i),Q=la(q?q[1]:"",k.input,H,k.inputError),Z=F.replace(/class=['"][^'"]+['"]/i,"");return`<textarea name="${Xt(B)}"${Ks(F,Rn(B))} class="${Q}"${Sl(B,H,F)}${Z?` ${Z}`:""}>${Xt(V)}</textarea>`}),R=R.replace(/@select\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endselect/g,(T,B,z="",W)=>{let F=kr(z),V=io(B,_),H=oo(B,_),q=F.match(/class=['"]([^'"]+)['"]/i),Q=la(q?q[1]:"",k.input,H,k.inputError),Z=F.replace(/class=['"][^'"]+['"]/i,""),se=W;if(V!==void 0)se=W.replace(/(<option[^>]*value=['"]([^'"]+)['"][^>]*>)/gi,(ie,oe,ae)=>{if((Array.isArray(V)?V.some((ce)=>String(ce)===ae):String(V)===ae)&&!oe.includes("selected"))return oe.replace(/(<option)/,"$1 selected");return ie});return`<select name="${Xt(B)}"${Ks(F,Rn(B))} class="${Q}"${Sl(B,H,F)}${Z?` ${Z}`:""}>${se}</select>`}),R=R.replace(/@checkbox\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?(?:,\s*\{([^}]+)\})?\)/g,(T,B,z,W="")=>{let F=z===void 0?"1":z,V=z===void 0?Rn(B):`${Rn(B)}-${Rn(F)}`,H=kr(W),q=io(B,_),Q=q!==void 0&&(Array.isArray(q)?q.some((oe)=>String(oe)===F):q===!0||String(q)===F),Z=H.match(/class=['"]([^'"]+)['"]/i),se=Z?Z[1]:k.checkInput,ie=H.replace(/class=['"][^'"]+['"]/i,"");return`<input type="checkbox" name="${Xt(B)}"${Ks(H,V)} value="${Xt(F)}" class="${se}"${Q?" checked":""}${ie?` ${ie}`:""}>`}),R=R.replace(/@radio\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(T,B,z,W="")=>{let F=kr(W),V=io(B,_),H=V!==void 0&&V===z,q=F.match(/class=['"]([^'"]+)['"]/i),Q=q?q[1]:k.checkInput,Z=F.replace(/class=['"][^'"]+['"]/i,"");return`<input type="radio" name="${Xt(B)}"${Ks(F,`${Rn(B)}-${Rn(z)}`)} value="${Xt(z)}" class="${Q}"${H?" checked":""}${Z?` ${Z}`:""}>`}),R=R.replace(/@file\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(T,B,z="")=>{let W=kr(z),F=W.match(/accept=['"]([^'"]+)['"]/i),V=F?F[1]:"",H=W.includes("multiple"),q=oo(B,_),Q=W.match(/class=['"]([^'"]+)['"]/i),Z=la(Q?Q[1]:"",k.input,q,k.inputError),se=W.replace(/class=['"][^'"]+['"]/gi,"").replace(/accept=['"][^'"]+['"]/gi,"").replace(/\bmultiple\b/gi,"").trim(),ie=[`<input type="file" name="${Xt(B)}"${Ks(W,Rn(B))}`,`class="${Z}"`];if(V)ie.push(`accept="${Xt(V)}"`);if(H)ie.push("multiple");if(se)ie.push(se);return`${ie.join(" ")}>`}),R=R.replace(/@label\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endlabel/g,(T,B,z="",W)=>{let F=kr(z),V=F.match(/class=['"]([^'"]+)['"]/i),H=V?V[1]:k.label,q=F.replace(/class=['"][^'"]+['"]/i,"");return`<label for="${Xt(Rn(B))}" class="${H}"${q?` ${q}`:""}>${W}</label>`}),R}function Ip(v,_,k=Tp){return v.replace(/@error\(['"]([^'"]+)['"]\)([\s\S]*?)@enderror/g,(R,T,B)=>{try{if(oo(T,_)){let z=B.replace(/\{\{([^}]+)\}\}/g,(W,F)=>{try{if(F.trim()==="$message"||F.trim()==="message")return Rp(T,_);if(F.trim().includes("errors.first")||F.trim().includes("$errors.first")){if(typeof _.errors?.first==="function")return _.errors.first(T);return Rp(T,_)}let V=F.trim();if(p(V)){let H=l(V,_);return H!==void 0?String(H):V}return V}catch{return F}});return`<div id="${Xt(`${Rn(T)}-error`)}" role="alert">${z}</div>`}return""}catch(z){return console.error("Error processing @error directive:",z),R}})}function oo(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 Rp(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 io(v,_){let k;if(_.old&&typeof _.old==="function")return _.old(v);if(_.old&&typeof _.old==="object")return _.old[v];if(v.endsWith("[]")){let R=v.slice(0,-2);if(k=_[R],k!==void 0)return k}return _[v]}function kr(v){if(!v.trim())return"";let _=[],k=v.trim(),R=/([\w-]+)\s*:\s*(['"]?)([^,'"]*)\2(?:\s*,\s*|\s*$)/g,T;while((T=R.exec(k))!==null){let[,B,,z]=T;_.push(`${B}="${z.trim()}"`)}return _.join(" ")}var ao=/<\/?template\b[^>]*>/gi,kb=/(?:^|\s)(?:id\s*=|(?:x-|[@:])(?:for|if|else(?:-if)?)(?=\s|=|$)|#[\w-]+(?:\s*=|\s|$)|v-slot(?::[\w-]+)?(?=\s|=|$)|slot\s*=)/i;function Eb(v){let _=v.replace(/^<template\b/i,"").replace(/>$/,"");return kb.test(_)}function te(v){ao.lastIndex=0;let _;while((_=ao.exec(v))!==null){if(_[0].startsWith("</")||Eb(_[0]))continue;let k=_.index,R=ao.lastIndex,T=1,B;while((B=ao.exec(v))!==null)if(B[0].startsWith("</")){if(T--,T===0){let z=B.index;return{start:k,openEnd:R,closeStart:z,end:ao.lastIndex,content:v.slice(R,z)}}}else T++;return null}return null}import Wt from"path";import{existsSync as Gv}from"fs";class Pp{builtins=new Map;registerBuiltin(v){this.builtins.set(v.name.toLowerCase(),v);for(let _ of v.aliases)this.builtins.set(_.toLowerCase(),v)}isBuiltin(v){return this.builtins.has(v.toLowerCase())}getBuiltin(v){return this.builtins.get(v.toLowerCase())??null}async resolveFile(v,_,k,R){let T=Ua(v,R);if(T!==void 0)return T;for(let B of Ha(v,_,k,R))if(await r(B))return B;return null}}var Xs=new Pp;function zt(v){return v.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}var Er="\x00stx-boolean-attribute";function $l(v){return v.indexOf("\x00")===-1?v:v.replace(/\0/g,"")}var Cb=new Set(["accesskey","autocapitalize","autofocus","class","contenteditable","dir","draggable","enterkeyhint","exportparts","hidden","id","inert","inputmode","is","itemid","itemprop","itemref","itemscope","itemtype","lang","nonce","part","role","slot","spellcheck","style","tabindex","title","translate","accept","action","alt","autocomplete","capture","cite","cols","colspan","content","controls","datetime","default","download","enctype","for","form","formaction","formenctype","formmethod","formnovalidate","formtarget","height","href","hreflang","kind","label","loading","loop","max","maxlength","media","method","min","minlength","multiple","muted","name","open","pattern","placeholder","playsinline","poster","preload","readonly","referrerpolicy","rel","required","reversed","rows","rowspan","scope","selected","shape","size","span","src","srcdoc","srclang","srcset","start","step","target","type","usemap","value","width","wrap"]);function _l(v){let _=v.toLowerCase();return _.startsWith("aria-")||_.startsWith("data-")||Cb.has(_)}function Cr(v,_){let k=[];for(let[R,T]of Object.entries(v.static)){if(_.has(R))continue;let B=v.staticNames?.[R]??R;if(typeof T==="boolean"){if(T)k.push(zt(B));continue}if(T===Er){k.push(zt(B));continue}k.push(`${zt(B)}="${zt($l(String(T)))}"`)}return k}function Rr(v,_){let k=[];for(let[R,T]of Object.entries(v.serverDynamic??{})){if(_.has(R))continue;if(T===null||T===void 0||T===!1)continue;let B=v.serverDynamicNames?.[R]??R;if(T===!0){k.push(zt(B));continue}if(typeof T==="object")continue;k.push(`${zt(B)}="${zt($l(String(T)))}"`)}return k}function Zs(v){return v.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Rb(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 kl={name:"StxLink",aliases:["stx-link"],render(v,_,k){let R=Rb(v),T=(typeof v.static.class==="string"?v.static.class:"")||(typeof v.static.className==="string"?v.static.className:""),B=typeof v.static.activeClass==="string"?v.static.activeClass:"active",z=typeof v.static.exactActiveClass==="string"?v.static.exactActiveClass:"exact-active",W=v.static.prefetch===!0||v.static.prefetch==="true"||v.serverDynamic.prefetch===!0,F=[];if(R.reactive)F.push(`:href="${Zs(R.value)}"`);else F.push(`href="${Zs(Ki(R.value,"navigable"))}"`);if(T)F.push(`class="${Zs(T)}"`);if(F.push("data-stx-link"),F.push(`data-stx-active-class="${Zs(B)}"`),F.push(`data-stx-exact-active-class="${Zs(z)}"`),W)F.push("data-stx-prefetch");let V=typeof v.static.activeMatch==="string"?v.static.activeMatch.trim():"";if(V)F.push(`data-stx-active-match="${Zs(V)}"`);let H=new Set(["to","class","className","activeClass","exactActiveClass","activeMatch","prefetch"]);return F.push(...Cr(v,H)),F.push(...Rr(v,H)),`<a ${F.join(" ")}>${_}</a>`}};import{createHash as Hp}from"crypto";import rn from"fs";import Yt from"path";import{decode as Nb,generateThumbHash as jb}from"ts-images";import{createImageDeliveryCatalog as Lp}from"ts-images/delivery";import El from"fs";function da(v,_,k){let R=Buffer.alloc(k),T=El.readSync(v,R,0,k,_);return R.subarray(0,T)}function Cl(v){if(v.length<25)return!1;let _=(R,T)=>String.fromCharCode(...v.subarray(R,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 Rl(v){let _;try{_=El.openSync(v,"r");let k=da(_,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 R=k[25];if(R===4||R===6)return"possible";let T=8;for(let B=0;B<64;B++){let z=da(_,T,8);if(z.length<8)return"unknown";let W=z.toString("latin1",4,8);if(W==="tRNS")return"possible";if(W==="IDAT"||W==="IEND")return"none";T+=12+z.readUInt32BE(0)}return"unknown"}if(k.length>=25&&k.toString("latin1",0,4)==="RIFF"&&k.toString("latin1",8,12)==="WEBP"){if(Cl(k))return"possible";let R=k.toString("latin1",12,16);return R==="VP8 "||R==="VP8X"?"none":"unknown"}return"unknown"}catch{return"unknown"}finally{if(_!==void 0)El.closeSync(_)}}import Tb from"fs";import fa from"os";import{join as Dp}from"path";import{fileURLToPath as Mp}from"url";import{Worker as Op}from"worker_threads";var ga=Symbol("stx.image-worker.unavailable");function Ab(v=typeof fa.availableParallelism==="function"?fa.availableParallelism():fa.cpus().length){return Math.max(1,Math.min(2,v-1))}var pa=0,jp=[];async function Ib(){if(pa<Ab()){pa++;return}await new Promise((v)=>jp.push(v)),pa++}function Pb(){pa--,jp.shift()?.()}var Db="@stacksjs/stx/builtins/image-warmup-worker";function Mb(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:"&&Tb.existsSync(Mp(k)))return Mp(k)}catch{}try{let k=typeof Bun<"u"?Bun.resolveSync(Db,v):void 0;return k&&Ob(k)?k:void 0}catch{return}}function Ob(v,_=process.env){let k=v.replace(/\\/g,"/");if(k.split("/").some((T)=>/@\d[^/]*@@@\d+$/.test(T)))return!1;return![_.BUN_INSTALL_CACHE_DIR,Dp(_.BUN_INSTALL||Dp(fa.homedir(),".bun"),"install","cache")].filter((T)=>!!T).map((T)=>`${T.replace(/\\/g,"/").replace(/\/$/,"")}/`).some((T)=>k.startsWith(T))}var Np=!1;function co(v){if(!Np)Np=!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 ga}function Tl(v){return v instanceof Error?v.message:String(v)}async function Al(v,_){if(typeof Op!=="function")return co("node:worker_threads has no Worker in this runtime");let k=Mb();if(!k)return co("no image-warmup-worker entry beside this module or in the installed @stacksjs/stx");await Ib();try{return await new Promise((R,T)=>{let B;try{B=new Op(k)}catch(V){R(co(`could not start ${k}: ${Tl(V)}`));return}let z=!1,W=!1,F=(V)=>{if(W)return;W=!0,V(),B.terminate()};B.on("message",(V)=>{if(V.type==="ready"){z=!0,B.postMessage({task:v,args:_});return}if(V.type==="result"){F(()=>R(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))}),B.on("error",(V)=>{F(()=>z?T(V instanceof Error?V:Error(Tl(V)||"image worker crashed")):R(co(`the worker failed before it was ready: ${Tl(V)}`)))}),B.on("exit",(V)=>{F(()=>z?T(Error("image worker exited before it finished")):R(co(`the worker exited with code ${V} before it was ready`)))})})}finally{Pb()}}var Lb=new Set([".avif",".jpeg",".jpg",".png",".webp"]),Bb=[320,640,960,1280,1920],lo="/_stx/images",zb=`stx:${lo}:alpha-1`,Wb=`stx:${lo}:opaque-1`,Fb=["@stacksjs/ts-webp","@stacksjs/ts-avif","ts-images"],ma;function Vb(v,_){let k=Yt.dirname(Bun.resolveSync(v,_));while(k!==Yt.dirname(k)){let R=Yt.join(k,"package.json");if(rn.existsSync(R)){let T=JSON.parse(rn.readFileSync(R,"utf8"));if(T.name===v)return T.version}k=Yt.dirname(k)}return}function Bp(){if(ma!==void 0)return ma;let v;try{v=Yt.dirname(Bun.resolveSync("ts-images",import.meta.dir))}catch{}return ma=Fb.map((_)=>{let k;try{k=v?Vb(_,v):void 0}catch{}return`${_.replace("@stacksjs/","")}@${k??"unknown"}`}).join("+"),ma}var zp=Symbol.for("stx.image-delivery");function uo(){let v=globalThis;return v[zp]??={catalog:new Map,transparent:new Set},v[zp]}var Wp=new Set;function Ub(v){return`/${v.split(Yt.sep).map(encodeURIComponent).join("/")}`}function Hb(v){let _=Yt.extname(v),k=v.slice(0,-_.length).replace(/[^a-zA-Z0-9_-]+/g,"-").replace(/^-+|-+$/g,""),R=Hp("sha256").update(v).digest("hex").slice(0,8);return`${k||"image"}-${R}`}function Fp(v,_=`stx:${lo}`){let k=(R)=>`${lo}/${R.split("/").map(encodeURIComponent).join("/")}`;return{cacheNamespace:_,async stat(R){let T=Yt.join(v,R);try{let B=await rn.promises.stat(T);return B.size>0?{bytes:B.size,path:T,url:k(R)}:null}catch{return null}},async write(R,T){let B=Yt.join(v,R);await rn.promises.mkdir(Yt.dirname(B),{recursive:!0});let z=`${B}.${process.pid}.tmp`;return await rn.promises.writeFile(z,T),await rn.promises.rename(z,B),{bytes:T.byteLength,path:B,url:k(R)}},url:k}}async function qp(v,_=v){let k=await rn.promises.readdir(_,{withFileTypes:!0});k.sort((T,B)=>T.name.localeCompare(B.name));let R=[];for(let T of k){let B=Yt.join(_,T.name);if(T.isDirectory()){R.push(...await qp(v,B));continue}if(!T.isFile()||!Lb.has(Yt.extname(T.name).toLowerCase()))continue;R.push({absolutePath:B,relativePath:Yt.relative(v,B)})}return R}function Vp(v,_){return v.map((k)=>({key:Ub(k.relativePath),input:k.absolutePath,name:Hb(k.relativePath),...qb(k.absolutePath)?{options:{storage:_}}:{}}))}function qb(v){return Rl(v)==="possible"}function Kb(v){for(let _=3;_<v.length;_+=4)if(v[_]!==255)return!0;return!1}async function Xb(v){let _=Object.entries(v).filter(([,T])=>T.fallback.format==="png"),k=new Set,R=8;for(let T=0;T<_.length;T+=8)await Promise.all(_.slice(T,T+8).map(async([B,z])=>{let W=z.variants.filter((F)=>F.format==="png").sort((F,V)=>F.width-V.width)[0];try{let F=await Nb(new Uint8Array(await rn.promises.readFile(W?.path??z.fallback.path)));if(Kb(F.data))k.add(B)}catch{k.add(B)}}));return k}function Zb(v,_){let k=[];for(let R of _){let T=v[R],B=T?.variants.filter((W)=>W.format==="webp")??[];if(!T||B.length===0)continue;if(!B.some((W)=>{let F;try{return F=rn.openSync(W.path,"r"),!Cl(da(F,0,32))}catch{return!0}finally{if(F!==void 0)rn.closeSync(F)}}))continue;if(T.variants=T.variants.filter((W)=>W.format!=="webp"),delete T.sources.webp,k.push(R),!Wp.has(R))Wp.add(R),console.warn(`[stx-images] ${R} 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 R=0;R<v.length;R+=8){let T=v.slice(R,R+8),B=await Promise.all(T.map(async(z)=>{try{return await jb(z.absolutePath),z}catch{return console.warn(`[stx-images] Skipping unreadable raster: ${z.relativePath}`),null}}));_.push(...B.filter((z)=>z!==null))}return _}function Il(v){return Yt.join(v,"undecodable.json")}function Jb(v){try{let _=rn.readFileSync(Il(v),"utf-8"),k=JSON.parse(_);return k&&typeof k==="object"?k:{}}catch{return{}}}function Yb(v,_){try{rn.mkdirSync(Yt.dirname(Il(v)),{recursive:!0}),rn.writeFileSync(Il(v),JSON.stringify(_))}catch{}}function Up(v){try{let _=rn.statSync(v);return{mtimeMs:_.mtimeMs,size:_.size}}catch{return}}function Kp(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 ls(v){let _=Kp(v);return _?uo().catalog.get(_):void 0}function ds(v){let _=Kp(v);return _?uo().transparent.has(_):!1}function us(v){let _=(R)=>v.variants.filter((T)=>T.format===R).reduce((T,B)=>T+B.bytes,0),k=_(v.fallback.format);return["avif","webp"].map((R)=>({format:R,srcset:v.sources[R]||"",bytes:_(R)})).filter((R)=>R.srcset&&R.bytes>0&&R.bytes<k).sort((R,T)=>R.bytes-T.bytes).map(({format:R,srcset:T})=>({format:R,srcset:T}))}function ru(v){let _=ls(v);if(!_)return;return{src:_.fallback.url,srcset:_.sources[_.fallback.format]||"",sources:us(_).map(({format:k,srcset:R})=>({type:`image/${k}`,srcset:R})),width:_.source.width,height:_.source.height,placeholder:ds(v)?void 0:_.placeholder?.dataUrl}}function Yn(){let v=uo();v.catalog=new Map,v.transparent=new Set}function Qb(v){let _=uo();_.catalog=new Map(v.entries),_.transparent=new Set(v.transparent)}async function su(v,_,k={}){if(!v||!rn.existsSync(v))return Yn(),{count:0,fingerprint:""};if(k.offThread){let se=await Al("delivery",{publicDir:v,outputDir:_});if(se!==ga)return Qb(se.state),se.result}let R=await qp(v);if(R.length===0)return Yn(),{count:0,fingerprint:""};let T=Jb(_),B=R.filter((se)=>{let ie=T[se.relativePath];if(!ie)return!0;let oe=Up(se.absolutePath);return!oe||oe.mtimeMs!==ie.mtimeMs||oe.size!==ie.size});if(B.length===0)return Yn(),{count:0,fingerprint:""};let z=Fp(Yt.join(_,"_stx","images"),`${zb}:${Bp()}`),W={outDir:Yt.join(_,"_stx","images"),storage:Fp(Yt.join(_,"_stx","images"),`${Wb}:${Bp()}`),baseUrl:lo,widths:Bb,formats:["avif","webp"],quality:{avif:70,webp:78,jpeg:82,png:100},includeOriginal:!1,placeholder:!0,batchConcurrency:4,concurrency:4},F=B,V;try{V=await Lp({...W,entries:Vp(B,z)})}catch(se){if(F=await Gb(B),F.length===B.length)throw se;let ie=new Set(F.map((ae)=>ae.relativePath)),oe=!1;for(let ae of B){if(ie.has(ae.relativePath))continue;let le=Up(ae.absolutePath);if(!le)continue;T[ae.relativePath]=le,oe=!0}if(oe)Yb(_,T);if(F.length===0)return Yn(),{count:0,fingerprint:""};V=await Lp({...W,entries:Vp(F,z)})}let H=await Xb(V.entries),q=Zb(V.entries,H),Q=uo();Q.catalog=new Map(Object.entries(V.entries)),Q.transparent=H;let Z=H.size===0&&q.length===0?V.fingerprint:Hp("sha256").update(V.fingerprint).update(JSON.stringify({transparent:[...H].sort(),droppedWebp:q.sort()})).digest("hex");return{count:F.length,fingerprint:Z}}var ev=new Map;function Pl(v){if(!v)return;let _=v.split("?")[0].split("#")[0];return ev.get(_)}var tv={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},Dl=[320,640,768,1024,1280,1536,1920];function Kt(v){return v.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function en(v,_){if(v.serverDynamic[_]!==void 0)return String(v.serverDynamic[_]);let k=v.static[_];if(typeof k==="string")return k;return}function ha(v,_,k=!1){let R=v.serverDynamic[_];if(R!==void 0)return R!==!1&&R!=="false";let T=v.static[_];if(T!==void 0)return T!=="false"&&T!==!1;return k}function Ml(v){if(v.includes("(")||v.includes(","))return v;let _=v.trim().split(/\s+/),k=[];for(let R of _)if(R.includes(":")){let[T,B]=R.split(":"),z=tv[T];if(z)k.push(`(max-width: ${z}px) ${B}`);else{let W=Number.parseInt(T);if(!Number.isNaN(W))k.push(`(max-width: ${W}px) ${B}`)}}else k.push(R);return k.join(", ")}function Ol(v,_,k,R){return _.map((T)=>`${fo(v,T,void 0,k,R)} ${T}w`).join(", ")}function nv(v,_,k,R,T){return _.map((B)=>{let z=k?k*B:void 0;return`${fo(v,z,void 0,R,T)} ${B}x`}).join(", ")}function fo(v,_,k,R,T){if(!R||R==="local"||R==="static")return v;if(R==="cloudinary"){let B=[];if(_)B.push(`w_${_}`);if(k)B.push(`h_${k}`);if(T)B.push(`f_${T}`);B.push("q_auto");let z=B.join(",");return v.replace("/upload/",`/upload/${z}/`)}if(R==="imgix"){let B=new URLSearchParams;if(_)B.set("w",String(_));if(k)B.set("h",String(k));if(T)B.set("fm",T);B.set("auto","format");let z=v.includes("?")?"&":"?";return`${v}${z}${B.toString()}`}if(R==="bunny"){let B=new URLSearchParams;if(_)B.set("width",String(_));if(k)B.set("height",String(k));if(T)B.set("format",T);let z=v.includes("?")?"&":"?";return`${v}${z}${B.toString()}`}return v}function rv(v){return`var s=this.style;${v.map((_)=>`s.${_}=''`).join(";")}`}function sv(v,_,k="#e5e7eb"){let R=`<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(R)}`}var Nl={name:"StxImage",aliases:["Image","stx-image","stx-img"],render(v,_,k){let R=en(v,"src")||"",T=ls(R),B=en(v,"alt")||"",z=en(v,"width")||(T?String(T.source.width):void 0),W=en(v,"height")||(T?String(T.source.height):void 0),F=en(v,"sizes"),V=en(v,"srcset"),H=en(v,"densities"),q=en(v,"format"),Q=ds(R)||Pl(R)?.transparent===!0,Z=en(v,"placeholder")||(T&&!Q?"thumbhash":void 0),se=en(v,"placeholderColor")||"#e5e7eb",ie=en(v,"provider"),oe=en(v,"class")||en(v,"className")||"",ae=en(v,"style")||"",le=en(v,"quality"),ce=ha(v,"lazy",!0),ge=ha(v,"preload",!1),$e=ha(v,"priority",!1),ye=en(v,"loading"),ke=en(v,"decoding")||"async",Re=!!T||ha(v,"picture",!1)||!!q,Ae=z?Number.parseInt(z):void 0,Ie=W?Number.parseInt(W):void 0,Pe=V||"",Ee="";if(T)Pe=T.sources[T.fallback.format]||"",Ee=F?Ml(F):"100vw";else if(!Pe&&F&&ie&&ie!=="local"&&ie!=="static")Pe=Ol(R,Dl,ie,q),Ee=Ml(F);else if(!Pe&&H){let gt=H.split(/\s+/).map((dt)=>Number.parseFloat(dt.replace("x","")));Pe=nv(R,gt,Ae,ie,q)}else if(F)Ee=Ml(F);let Me=[];if(ae)Me.push(ae);if(Ae&&Ie)Me.push(`aspect-ratio:${Ae}/${Ie}`);let je=[],Ne=Z==="blur"||Z==="color"||Z==="thumbhash";if(Ne&&!Q){let gt=T?.placeholder?{dataUrl:T.placeholder.dataUrl,color:se}:Pl(R);if(gt&&Z==="color")Me.push(`background-color:${gt.color}`),je.push("backgroundColor");else if(gt)Me.push(`background-color:${gt.color}`),Me.push(`background-image:url(${gt.dataUrl})`),Me.push("background-size:cover"),Me.push("background-repeat:no-repeat"),je.push("backgroundColor","backgroundImage");else{let dt=sv(Ae||16,Ie||9,se);Me.push(`background-image:url(${dt})`),Me.push("background-size:cover"),Me.push("background-repeat:no-repeat"),je.push("backgroundImage")}}else if(!Ne&&Z&&Z!=="empty"&&Z!=="none")Me.push(`background-image:url(${Kt(Z)})`),Me.push("background-size:cover"),Me.push("background-repeat:no-repeat"),je.push("backgroundImage");let De=T?.fallback.url||fo(R,Ae,Ie,ie,q),Le=[];if(Le.push(`src="${Kt(Ki(De,"fetched"))}"`),Le.push(`alt="${Kt(B)}"`),z)Le.push(`width="${Kt(z)}"`);if(W)Le.push(`height="${Kt(W)}"`);let ct=ye||($e||ge?"eager":ce?"lazy":"");if(ct)Le.push(`loading="${Kt(ct)}"`);if($e)Le.push('fetchpriority="high"');if(Le.push(`decoding="${Kt(ke)}"`),oe)Le.push(`class="${Kt(oe)}"`);if(Me.length>0)Le.push(`style="${Kt(Me.join(";"))}"`);if(Pe)Le.push(`srcset="${Kt(Ki(Pe,"fetched"))}"`);if(Ee)Le.push(`sizes="${Kt(Ee)}"`);let yt=new Set(["src","alt","width","height","lazy","sizes","srcset","placeholder","placeholderColor","class","className","style","format","provider","quality","densities","preload","priority","picture","loading","decoding"]);if(je.length>0){let gt=typeof v.static.onload==="string"?v.static.onload:"",dt=rv(je)+(gt?`;${gt}`:"");Le.push(`onload="${Kt(dt)}"`),yt.add("onload")}Le.push(...Cr(v,yt)),Le.push(...Rr(v,yt));let pt=`<img ${Le.join(" ")} />`,st="";if(ge){let dt=q==="webp"?"image/webp":q==="avif"?"image/avif":"";st=`<link rel="preload" as="image" href="${Kt(De)}"${dt?` type="${dt}"`:""}${Pe?` imagesrcset="${Kt(Pe)}"`:""}${Ee?` imagesizes="${Kt(Ee)}"`:""} />
2297
- `}if(Re){let gt=[];if(T)for(let dt of us(T))gt.push(`<source type="image/${dt.format}" srcset="${Kt(dt.srcset)}"${Ee?` sizes="${Kt(Ee)}"`:""} />`);if(!T&&(q==="avif"||q==="auto")){let dt=fo(R,Ae,Ie,ie,"avif"),St=Pe?Ol(R,Dl,ie,"avif"):`${dt}`;gt.push(`<source type="image/avif" srcset="${Kt(St)}"${Ee?` sizes="${Kt(Ee)}"`:""} />`)}if(!T&&(q==="webp"||q==="auto")){let dt=fo(R,Ae,Ie,ie,"webp"),St=Pe?Ol(R,Dl,ie,"webp"):`${dt}`;gt.push(`<source type="image/webp" srcset="${Kt(St)}"${Ee?` sizes="${Kt(Ee)}"`:""} />`)}return`${st}<picture>
2296
+ ${ua(`@method('${Z}')`,_)}`;return ie}),R=R.replace(/@endform/g,"</form>"),R=R.replace(/@input\(\s*(?:'([^']+)'|"([^"]+)")\s*(?:,\s*(?:(?:'([^']*)'|"([^"]*)")\s*)?)?(?:,\s*\{([^}]+)\})?\s*\)/g,(T,B,z,W,F,V="")=>{let H=B||z||"",q=W||F||"",Q=kr(V),Z=io(H,_),se=Z!==void 0&&Z!==null?Z:q||"",ie=Q.match(/type=['"]([^'"]+)['"]/i),oe=ie?ie[1]:"text",ae=oo(H,_),le=Q.match(/class=['"]([^'"]+)['"]/i),ce=la(le?le[1]:"",k.input,ae,k.inputError),ge=Q.replace(/class=['"][^'"]+['"]/i,"");return ge=ge.replace(/type=['"][^'"]+['"]/i,""),`<input type="${Xt(oe)}" name="${Xt(H)}"${Ks(Q,Rn(H))} value="${Xt(se)}" class="${ce}"${Sl(H,ae,Q)}${ge?` ${ge}`:""}>`}),R=R.replace(/@textarea\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endtextarea/g,(T,B,z="",W="")=>{let F=kr(z),V=io(B,_)||W.trim(),H=oo(B,_),q=F.match(/class=['"]([^'"]+)['"]/i),Q=la(q?q[1]:"",k.input,H,k.inputError),Z=F.replace(/class=['"][^'"]+['"]/i,"");return`<textarea name="${Xt(B)}"${Ks(F,Rn(B))} class="${Q}"${Sl(B,H,F)}${Z?` ${Z}`:""}>${Xt(V)}</textarea>`}),R=R.replace(/@select\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endselect/g,(T,B,z="",W)=>{let F=kr(z),V=io(B,_),H=oo(B,_),q=F.match(/class=['"]([^'"]+)['"]/i),Q=la(q?q[1]:"",k.input,H,k.inputError),Z=F.replace(/class=['"][^'"]+['"]/i,""),se=W;if(V!==void 0)se=W.replace(/(<option[^>]*value=['"]([^'"]+)['"][^>]*>)/gi,(ie,oe,ae)=>{if((Array.isArray(V)?V.some((ce)=>String(ce)===ae):String(V)===ae)&&!oe.includes("selected"))return oe.replace(/(<option)/,"$1 selected");return ie});return`<select name="${Xt(B)}"${Ks(F,Rn(B))} class="${Q}"${Sl(B,H,F)}${Z?` ${Z}`:""}>${se}</select>`}),R=R.replace(/@checkbox\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?(?:,\s*\{([^}]+)\})?\)/g,(T,B,z,W="")=>{let F=z===void 0?"1":z,V=z===void 0?Rn(B):`${Rn(B)}-${Rn(F)}`,H=kr(W),q=io(B,_),Q=q!==void 0&&(Array.isArray(q)?q.some((oe)=>String(oe)===F):q===!0||String(q)===F),Z=H.match(/class=['"]([^'"]+)['"]/i),se=Z?Z[1]:k.checkInput,ie=H.replace(/class=['"][^'"]+['"]/i,"");return`<input type="checkbox" name="${Xt(B)}"${Ks(H,V)} value="${Xt(F)}" class="${se}"${Q?" checked":""}${ie?` ${ie}`:""}>`}),R=R.replace(/@radio\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(T,B,z,W="")=>{let F=kr(W),V=io(B,_),H=V!==void 0&&V===z,q=F.match(/class=['"]([^'"]+)['"]/i),Q=q?q[1]:k.checkInput,Z=F.replace(/class=['"][^'"]+['"]/i,"");return`<input type="radio" name="${Xt(B)}"${Ks(F,`${Rn(B)}-${Rn(z)}`)} value="${Xt(z)}" class="${Q}"${H?" checked":""}${Z?` ${Z}`:""}>`}),R=R.replace(/@file\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(T,B,z="")=>{let W=kr(z),F=W.match(/accept=['"]([^'"]+)['"]/i),V=F?F[1]:"",H=W.includes("multiple"),q=oo(B,_),Q=W.match(/class=['"]([^'"]+)['"]/i),Z=la(Q?Q[1]:"",k.input,q,k.inputError),se=W.replace(/class=['"][^'"]+['"]/gi,"").replace(/accept=['"][^'"]+['"]/gi,"").replace(/\bmultiple\b/gi,"").trim(),ie=[`<input type="file" name="${Xt(B)}"${Ks(W,Rn(B))}`,`class="${Z}"`];if(V)ie.push(`accept="${Xt(V)}"`);if(H)ie.push("multiple");if(se)ie.push(se);return`${ie.join(" ")}>`}),R=R.replace(/@label\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endlabel/g,(T,B,z="",W)=>{let F=kr(z),V=F.match(/class=['"]([^'"]+)['"]/i),H=V?V[1]:k.label,q=F.replace(/class=['"][^'"]+['"]/i,"");return`<label for="${Xt(Rn(B))}" class="${H}"${q?` ${q}`:""}>${W}</label>`}),R}function Ip(v,_,k=Tp){return v.replace(/@error\(['"]([^'"]+)['"]\)([\s\S]*?)@enderror/g,(R,T,B)=>{try{if(oo(T,_)){let z=B.replace(/\{\{([^}]+)\}\}/g,(W,F)=>{try{if(F.trim()==="$message"||F.trim()==="message")return Rp(T,_);if(F.trim().includes("errors.first")||F.trim().includes("$errors.first")){if(typeof _.errors?.first==="function")return _.errors.first(T);return Rp(T,_)}let V=F.trim();if(p(V)){let H=l(V,_);return H!==void 0?String(H):V}return V}catch{return F}});return`<div id="${Xt(`${Rn(T)}-error`)}" role="alert">${z}</div>`}return""}catch(z){return console.error("Error processing @error directive:",z),R}})}function oo(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 Rp(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 io(v,_){let k;if(_.old&&typeof _.old==="function")return _.old(v);if(_.old&&typeof _.old==="object")return _.old[v];if(v.endsWith("[]")){let R=v.slice(0,-2);if(k=_[R],k!==void 0)return k}return _[v]}function kr(v){if(!v.trim())return"";let _=[],k=v.trim(),R=/([\w-]+)\s*:\s*(['"]?)([^,'"]*)\2(?:\s*,\s*|\s*$)/g,T;while((T=R.exec(k))!==null){let[,B,,z]=T;_.push(`${B}="${z.trim()}"`)}return _.join(" ")}var ao=/<\/?template\b[^>]*>/gi,kb=/(?:^|\s)(?:id\s*=|(?:x-|[@:])(?:for|if|else(?:-if)?)(?=\s|=|$)|#[\w-]+(?:\s*=|\s|$)|v-slot(?::[\w-]+)?(?=\s|=|$)|slot\s*=)/i;function Eb(v){let _=v.replace(/^<template\b/i,"").replace(/>$/,"");return kb.test(_)}function te(v){ao.lastIndex=0;let _;while((_=ao.exec(v))!==null){if(_[0].startsWith("</")||Eb(_[0]))continue;let k=_.index,R=ao.lastIndex,T=1,B;while((B=ao.exec(v))!==null)if(B[0].startsWith("</")){if(T--,T===0){let z=B.index;return{start:k,openEnd:R,closeStart:z,end:ao.lastIndex,content:v.slice(R,z)}}}else T++;return null}return null}import Wt from"path";import{existsSync as Gv}from"fs";class Pp{builtins=new Map;registerBuiltin(v){this.builtins.set(v.name.toLowerCase(),v);for(let _ of v.aliases)this.builtins.set(_.toLowerCase(),v)}isBuiltin(v){return this.builtins.has(v.toLowerCase())}getBuiltin(v){return this.builtins.get(v.toLowerCase())??null}async resolveFile(v,_,k,R){let T=Ua(v,R);if(T!==void 0)return T;for(let B of Ha(v,_,k,R))if(await r(B))return B;return null}}var Xs=new Pp;function zt(v){return v.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}var Er="\x00stx-boolean-attribute";function $l(v){return v.indexOf("\x00")===-1?v:v.replace(/\0/g,"")}var Cb=new Set(["accesskey","autocapitalize","autofocus","class","contenteditable","dir","draggable","enterkeyhint","exportparts","hidden","id","inert","inputmode","is","itemid","itemprop","itemref","itemscope","itemtype","lang","nonce","part","role","slot","spellcheck","style","tabindex","title","translate","accept","action","alt","autocomplete","capture","cite","cols","colspan","content","controls","datetime","default","download","enctype","for","form","formaction","formenctype","formmethod","formnovalidate","formtarget","height","href","hreflang","kind","label","loading","loop","max","maxlength","media","method","min","minlength","multiple","muted","name","open","pattern","placeholder","playsinline","poster","preload","readonly","referrerpolicy","rel","required","reversed","rows","rowspan","scope","selected","shape","size","span","src","srcdoc","srclang","srcset","start","step","target","type","usemap","value","width","wrap"]);function _l(v){let _=v.toLowerCase();return _.startsWith("aria-")||_.startsWith("data-")||Cb.has(_)}function Cr(v,_){let k=[];for(let[R,T]of Object.entries(v.static)){if(_.has(R))continue;let B=v.staticNames?.[R]??R;if(typeof T==="boolean"){if(T)k.push(zt(B));continue}if(T===Er){k.push(zt(B));continue}k.push(`${zt(B)}="${zt($l(String(T)))}"`)}return k}function Rr(v,_){let k=[];for(let[R,T]of Object.entries(v.serverDynamic??{})){if(_.has(R))continue;if(T===null||T===void 0||T===!1)continue;let B=v.serverDynamicNames?.[R]??R;if(T===!0){k.push(zt(B));continue}if(typeof T==="object")continue;k.push(`${zt(B)}="${zt($l(String(T)))}"`)}return k}function Zs(v){return v.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Rb(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 kl={name:"StxLink",aliases:["stx-link"],render(v,_,k){let R=Rb(v),T=(typeof v.static.class==="string"?v.static.class:"")||(typeof v.static.className==="string"?v.static.className:""),B=typeof v.static.activeClass==="string"?v.static.activeClass:"active",z=typeof v.static.exactActiveClass==="string"?v.static.exactActiveClass:"exact-active",W=v.static.prefetch===!0||v.static.prefetch==="true"||v.serverDynamic.prefetch===!0,F=[];if(R.reactive)F.push(`:href="${Zs(R.value)}"`);else F.push(`href="${Zs(Ki(R.value,"navigable"))}"`);if(T)F.push(`class="${Zs(T)}"`);if(F.push("data-stx-link"),F.push(`data-stx-active-class="${Zs(B)}"`),F.push(`data-stx-exact-active-class="${Zs(z)}"`),W)F.push("data-stx-prefetch");let V=typeof v.static.activeMatch==="string"?v.static.activeMatch.trim():"";if(V)F.push(`data-stx-active-match="${Zs(V)}"`);let H=new Set(["to","class","className","activeClass","exactActiveClass","activeMatch","prefetch"]);return F.push(...Cr(v,H)),F.push(...Rr(v,H)),`<a ${F.join(" ")}>${_}</a>`}};import{createHash as Hp}from"crypto";import rn from"fs";import Yt from"path";import{decode as Nb,generateThumbHash as jb}from"ts-images";import{createImageDeliveryCatalog as Lp}from"ts-images/delivery";import El from"fs";function da(v,_,k){let R=Buffer.alloc(k),T=El.readSync(v,R,0,k,_);return R.subarray(0,T)}function Cl(v){if(v.length<25)return!1;let _=(R,T)=>String.fromCharCode(...v.subarray(R,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 Rl(v){let _;try{_=El.openSync(v,"r");let k=da(_,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 R=k[25];if(R===4||R===6)return"possible";let T=8;for(let B=0;B<64;B++){let z=da(_,T,8);if(z.length<8)return"unknown";let W=z.toString("latin1",4,8);if(W==="tRNS")return"possible";if(W==="IDAT"||W==="IEND")return"none";T+=12+z.readUInt32BE(0)}return"unknown"}if(k.length>=25&&k.toString("latin1",0,4)==="RIFF"&&k.toString("latin1",8,12)==="WEBP"){if(Cl(k))return"possible";let R=k.toString("latin1",12,16);return R==="VP8 "||R==="VP8X"?"none":"unknown"}return"unknown"}catch{return"unknown"}finally{if(_!==void 0)El.closeSync(_)}}import Tb from"fs";import fa from"os";import{join as Dp}from"path";import{fileURLToPath as Mp}from"url";import{Worker as Op}from"worker_threads";var ga=Symbol("stx.image-worker.unavailable");function Ab(v=typeof fa.availableParallelism==="function"?fa.availableParallelism():fa.cpus().length){return Math.max(1,Math.min(2,v-1))}var pa=0,jp=[];async function Ib(){if(pa<Ab()){pa++;return}await new Promise((v)=>jp.push(v)),pa++}function Pb(){pa--,jp.shift()?.()}var Db="@stacksjs/stx/builtins/image-warmup-worker";function Mb(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:"&&Tb.existsSync(Mp(k)))return Mp(k)}catch{}try{let k=typeof Bun<"u"?Bun.resolveSync(Db,v):void 0;return k&&Ob(k)?k:void 0}catch{return}}function Ob(v,_=process.env){let k=v.replace(/\\/g,"/");if(k.split("/").some((T)=>/@\d[^/]*@@@\d+$/.test(T)))return!1;return![_.BUN_INSTALL_CACHE_DIR,Dp(_.BUN_INSTALL||Dp(fa.homedir(),".bun"),"install","cache")].filter((T)=>!!T).map((T)=>`${T.replace(/\\/g,"/").replace(/\/$/,"")}/`).some((T)=>k.startsWith(T))}var Np=!1;function co(v){if(!Np)Np=!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 ga}function Tl(v){return v instanceof Error?v.message:String(v)}async function Al(v,_){if(typeof Op!=="function")return co("node:worker_threads has no Worker in this runtime");let k=Mb();if(!k)return co("no image-warmup-worker entry beside this module or in the installed @stacksjs/stx");await Ib();try{return await new Promise((R,T)=>{let B;try{B=new Op(k)}catch(V){R(co(`could not start ${k}: ${Tl(V)}`));return}let z=!1,W=!1,F=(V)=>{if(W)return;W=!0,V(),B.terminate()};B.on("message",(V)=>{if(V.type==="ready"){z=!0,B.postMessage({task:v,args:_});return}if(V.type==="result"){F(()=>R(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))}),B.on("error",(V)=>{F(()=>z?T(V instanceof Error?V:Error(Tl(V)||"image worker crashed")):R(co(`the worker failed before it was ready: ${Tl(V)}`)))}),B.on("exit",(V)=>{F(()=>z?T(Error("image worker exited before it finished")):R(co(`the worker exited with code ${V} before it was ready`)))})})}finally{Pb()}}var Lb=new Set([".avif",".jpeg",".jpg",".png",".webp"]),Bb=[320,640,960,1280,1920],lo="/_stx/images",zb=`stx:${lo}:alpha-1`,Wb=`stx:${lo}:opaque-1`,Fb=["@stacksjs/ts-webp","@stacksjs/ts-avif","ts-images"],ma;function Vb(v,_){let k=Yt.dirname(Bun.resolveSync(v,_));while(k!==Yt.dirname(k)){let R=Yt.join(k,"package.json");if(rn.existsSync(R)){let T=JSON.parse(rn.readFileSync(R,"utf8"));if(T.name===v)return T.version}k=Yt.dirname(k)}return}function Bp(){if(ma!==void 0)return ma;let v;try{v=Yt.dirname(Bun.resolveSync("ts-images",import.meta.dir))}catch{}return ma=Fb.map((_)=>{let k;try{k=v?Vb(_,v):void 0}catch{}return`${_.replace("@stacksjs/","")}@${k??"unknown"}`}).join("+"),ma}var zp=Symbol.for("stx.image-delivery");function uo(){let v=globalThis;return v[zp]??={catalog:new Map,transparent:new Set},v[zp]}var Wp=new Set;function Ub(v){return`/${v.split(Yt.sep).map(encodeURIComponent).join("/")}`}function Hb(v){let _=Yt.extname(v),k=v.slice(0,-_.length).replace(/[^a-zA-Z0-9_-]+/g,"-").replace(/^-+|-+$/g,""),R=Hp("sha256").update(v).digest("hex").slice(0,8);return`${k||"image"}-${R}`}function Fp(v,_=`stx:${lo}`){let k=(R)=>`${lo}/${R.split("/").map(encodeURIComponent).join("/")}`;return{cacheNamespace:_,async stat(R){let T=Yt.join(v,R);try{let B=await rn.promises.stat(T);return B.size>0?{bytes:B.size,path:T,url:k(R)}:null}catch{return null}},async write(R,T){let B=Yt.join(v,R);await rn.promises.mkdir(Yt.dirname(B),{recursive:!0});let z=`${B}.${process.pid}.tmp`;return await rn.promises.writeFile(z,T),await rn.promises.rename(z,B),{bytes:T.byteLength,path:B,url:k(R)}},url:k}}async function qp(v,_=v){let k=await rn.promises.readdir(_,{withFileTypes:!0});k.sort((T,B)=>T.name.localeCompare(B.name));let R=[];for(let T of k){let B=Yt.join(_,T.name);if(T.isDirectory()){R.push(...await qp(v,B));continue}if(!T.isFile()||!Lb.has(Yt.extname(T.name).toLowerCase()))continue;R.push({absolutePath:B,relativePath:Yt.relative(v,B)})}return R}function Vp(v,_){return v.map((k)=>({key:Ub(k.relativePath),input:k.absolutePath,name:Hb(k.relativePath),...qb(k.absolutePath)?{options:{storage:_}}:{}}))}function qb(v){return Rl(v)==="possible"}function Kb(v){for(let _=3;_<v.length;_+=4)if(v[_]!==255)return!0;return!1}async function Xb(v){let _=Object.entries(v).filter(([,T])=>T.fallback.format==="png"),k=new Set,R=8;for(let T=0;T<_.length;T+=8)await Promise.all(_.slice(T,T+8).map(async([B,z])=>{let W=z.variants.filter((F)=>F.format==="png").sort((F,V)=>F.width-V.width)[0];try{let F=await Nb(new Uint8Array(await rn.promises.readFile(W?.path??z.fallback.path)));if(Kb(F.data))k.add(B)}catch{k.add(B)}}));return k}function Zb(v,_){let k=[];for(let R of _){let T=v[R],B=T?.variants.filter((W)=>W.format==="webp")??[];if(!T||B.length===0)continue;if(!B.some((W)=>{let F;try{return F=rn.openSync(W.path,"r"),!Cl(da(F,0,32))}catch{return!0}finally{if(F!==void 0)rn.closeSync(F)}}))continue;if(T.variants=T.variants.filter((W)=>W.format!=="webp"),delete T.sources.webp,k.push(R),!Wp.has(R))Wp.add(R),console.warn(`[stx-images] ${R} 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 R=0;R<v.length;R+=8){let T=v.slice(R,R+8),B=await Promise.all(T.map(async(z)=>{try{return await jb(z.absolutePath),z}catch{return console.warn(`[stx-images] Skipping unreadable raster: ${z.relativePath}`),null}}));_.push(...B.filter((z)=>z!==null))}return _}function Il(v){return Yt.join(v,"undecodable.json")}function Jb(v){try{let _=rn.readFileSync(Il(v),"utf-8"),k=JSON.parse(_);return k&&typeof k==="object"?k:{}}catch{return{}}}function Yb(v,_){try{rn.mkdirSync(Yt.dirname(Il(v)),{recursive:!0}),rn.writeFileSync(Il(v),JSON.stringify(_))}catch{}}function Up(v){try{let _=rn.statSync(v);return{mtimeMs:_.mtimeMs,size:_.size}}catch{return}}function Kp(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 ls(v){let _=Kp(v);return _?uo().catalog.get(_):void 0}function us(v){let _=Kp(v);return _?uo().transparent.has(_):!1}function ds(v){let _=(R)=>v.variants.filter((T)=>T.format===R).reduce((T,B)=>T+B.bytes,0),k=_(v.fallback.format);return["avif","webp"].map((R)=>({format:R,srcset:v.sources[R]||"",bytes:_(R)})).filter((R)=>R.srcset&&R.bytes>0&&R.bytes<k).sort((R,T)=>R.bytes-T.bytes).map(({format:R,srcset:T})=>({format:R,srcset:T}))}function rd(v){let _=ls(v);if(!_)return;return{src:_.fallback.url,srcset:_.sources[_.fallback.format]||"",sources:ds(_).map(({format:k,srcset:R})=>({type:`image/${k}`,srcset:R})),width:_.source.width,height:_.source.height,placeholder:us(v)?void 0:_.placeholder?.dataUrl}}function Zn(){let v=uo();v.catalog=new Map,v.transparent=new Set}function Qb(v){let _=uo();_.catalog=new Map(v.entries),_.transparent=new Set(v.transparent)}async function sd(v,_,k={}){if(!v||!rn.existsSync(v))return Zn(),{count:0,fingerprint:""};if(k.offThread){let se=await Al("delivery",{publicDir:v,outputDir:_});if(se!==ga)return Qb(se.state),se.result}let R=await qp(v);if(R.length===0)return Zn(),{count:0,fingerprint:""};let T=Jb(_),B=R.filter((se)=>{let ie=T[se.relativePath];if(!ie)return!0;let oe=Up(se.absolutePath);return!oe||oe.mtimeMs!==ie.mtimeMs||oe.size!==ie.size});if(B.length===0)return Zn(),{count:0,fingerprint:""};let z=Fp(Yt.join(_,"_stx","images"),`${zb}:${Bp()}`),W={outDir:Yt.join(_,"_stx","images"),storage:Fp(Yt.join(_,"_stx","images"),`${Wb}:${Bp()}`),baseUrl:lo,widths:Bb,formats:["avif","webp"],quality:{avif:70,webp:78,jpeg:82,png:100},includeOriginal:!1,placeholder:!0,batchConcurrency:4,concurrency:4},F=B,V;try{V=await Lp({...W,entries:Vp(B,z)})}catch(se){if(F=await Gb(B),F.length===B.length)throw se;let ie=new Set(F.map((ae)=>ae.relativePath)),oe=!1;for(let ae of B){if(ie.has(ae.relativePath))continue;let le=Up(ae.absolutePath);if(!le)continue;T[ae.relativePath]=le,oe=!0}if(oe)Yb(_,T);if(F.length===0)return Zn(),{count:0,fingerprint:""};V=await Lp({...W,entries:Vp(F,z)})}let H=await Xb(V.entries),q=Zb(V.entries,H),Q=uo();Q.catalog=new Map(Object.entries(V.entries)),Q.transparent=H;let Z=H.size===0&&q.length===0?V.fingerprint:Hp("sha256").update(V.fingerprint).update(JSON.stringify({transparent:[...H].sort(),droppedWebp:q.sort()})).digest("hex");return{count:F.length,fingerprint:Z}}var ev=new Map;function Pl(v){if(!v)return;let _=v.split("?")[0].split("#")[0];return ev.get(_)}var tv={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},Dl=[320,640,768,1024,1280,1536,1920];function Kt(v){return v.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function en(v,_){if(v.serverDynamic[_]!==void 0)return String(v.serverDynamic[_]);let k=v.static[_];if(typeof k==="string")return k;return}function ha(v,_,k=!1){let R=v.serverDynamic[_];if(R!==void 0)return R!==!1&&R!=="false";let T=v.static[_];if(T!==void 0)return T!=="false"&&T!==!1;return k}function Ml(v){if(v.includes("(")||v.includes(","))return v;let _=v.trim().split(/\s+/),k=[];for(let R of _)if(R.includes(":")){let[T,B]=R.split(":"),z=tv[T];if(z)k.push(`(max-width: ${z}px) ${B}`);else{let W=Number.parseInt(T);if(!Number.isNaN(W))k.push(`(max-width: ${W}px) ${B}`)}}else k.push(R);return k.join(", ")}function Ol(v,_,k,R){return _.map((T)=>`${fo(v,T,void 0,k,R)} ${T}w`).join(", ")}function nv(v,_,k,R,T){return _.map((B)=>{let z=k?k*B:void 0;return`${fo(v,z,void 0,R,T)} ${B}x`}).join(", ")}function fo(v,_,k,R,T){if(!R||R==="local"||R==="static")return v;if(R==="cloudinary"){let B=[];if(_)B.push(`w_${_}`);if(k)B.push(`h_${k}`);if(T)B.push(`f_${T}`);B.push("q_auto");let z=B.join(",");return v.replace("/upload/",`/upload/${z}/`)}if(R==="imgix"){let B=new URLSearchParams;if(_)B.set("w",String(_));if(k)B.set("h",String(k));if(T)B.set("fm",T);B.set("auto","format");let z=v.includes("?")?"&":"?";return`${v}${z}${B.toString()}`}if(R==="bunny"){let B=new URLSearchParams;if(_)B.set("width",String(_));if(k)B.set("height",String(k));if(T)B.set("format",T);let z=v.includes("?")?"&":"?";return`${v}${z}${B.toString()}`}return v}function rv(v){return`var s=this.style;${v.map((_)=>`s.${_}=''`).join(";")}`}function sv(v,_,k="#e5e7eb"){let R=`<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(R)}`}var Nl={name:"StxImage",aliases:["Image","stx-image","stx-img"],render(v,_,k){let R=en(v,"src")||"",T=ls(R),B=en(v,"alt")||"",z=en(v,"width")||(T?String(T.source.width):void 0),W=en(v,"height")||(T?String(T.source.height):void 0),F=en(v,"sizes"),V=en(v,"srcset"),H=en(v,"densities"),q=en(v,"format"),Q=us(R)||Pl(R)?.transparent===!0,Z=en(v,"placeholder")||(T&&!Q?"thumbhash":void 0),se=en(v,"placeholderColor")||"#e5e7eb",ie=en(v,"provider"),oe=en(v,"class")||en(v,"className")||"",ae=en(v,"style")||"",le=en(v,"quality"),ce=ha(v,"lazy",!0),ge=ha(v,"preload",!1),$e=ha(v,"priority",!1),ye=en(v,"loading"),ke=en(v,"decoding")||"async",Re=!!T||ha(v,"picture",!1)||!!q,Ae=z?Number.parseInt(z):void 0,Ie=W?Number.parseInt(W):void 0,Pe=V||"",Ee="";if(T)Pe=T.sources[T.fallback.format]||"",Ee=F?Ml(F):"100vw";else if(!Pe&&F&&ie&&ie!=="local"&&ie!=="static")Pe=Ol(R,Dl,ie,q),Ee=Ml(F);else if(!Pe&&H){let gt=H.split(/\s+/).map((dt)=>Number.parseFloat(dt.replace("x","")));Pe=nv(R,gt,Ae,ie,q)}else if(F)Ee=Ml(F);let Me=[];if(ae)Me.push(ae);if(Ae&&Ie)Me.push(`aspect-ratio:${Ae}/${Ie}`);let je=[],Ne=Z==="blur"||Z==="color"||Z==="thumbhash";if(Ne&&!Q){let gt=T?.placeholder?{dataUrl:T.placeholder.dataUrl,color:se}:Pl(R);if(gt&&Z==="color")Me.push(`background-color:${gt.color}`),je.push("backgroundColor");else if(gt)Me.push(`background-color:${gt.color}`),Me.push(`background-image:url(${gt.dataUrl})`),Me.push("background-size:cover"),Me.push("background-repeat:no-repeat"),je.push("backgroundColor","backgroundImage");else{let dt=sv(Ae||16,Ie||9,se);Me.push(`background-image:url(${dt})`),Me.push("background-size:cover"),Me.push("background-repeat:no-repeat"),je.push("backgroundImage")}}else if(!Ne&&Z&&Z!=="empty"&&Z!=="none")Me.push(`background-image:url(${Kt(Z)})`),Me.push("background-size:cover"),Me.push("background-repeat:no-repeat"),je.push("backgroundImage");let De=T?.fallback.url||fo(R,Ae,Ie,ie,q),Le=[];if(Le.push(`src="${Kt(Ki(De,"fetched"))}"`),Le.push(`alt="${Kt(B)}"`),z)Le.push(`width="${Kt(z)}"`);if(W)Le.push(`height="${Kt(W)}"`);let ct=ye||($e||ge?"eager":ce?"lazy":"");if(ct)Le.push(`loading="${Kt(ct)}"`);if($e)Le.push('fetchpriority="high"');if(Le.push(`decoding="${Kt(ke)}"`),oe)Le.push(`class="${Kt(oe)}"`);if(Me.length>0)Le.push(`style="${Kt(Me.join(";"))}"`);if(Pe)Le.push(`srcset="${Kt(Ki(Pe,"fetched"))}"`);if(Ee)Le.push(`sizes="${Kt(Ee)}"`);let yt=new Set(["src","alt","width","height","lazy","sizes","srcset","placeholder","placeholderColor","class","className","style","format","provider","quality","densities","preload","priority","picture","loading","decoding"]);if(je.length>0){let gt=typeof v.static.onload==="string"?v.static.onload:"",dt=rv(je)+(gt?`;${gt}`:"");Le.push(`onload="${Kt(dt)}"`),yt.add("onload")}Le.push(...Cr(v,yt)),Le.push(...Rr(v,yt));let pt=`<img ${Le.join(" ")} />`,st="";if(ge){let dt=q==="webp"?"image/webp":q==="avif"?"image/avif":"";st=`<link rel="preload" as="image" href="${Kt(De)}"${dt?` type="${dt}"`:""}${Pe?` imagesrcset="${Kt(Pe)}"`:""}${Ee?` imagesizes="${Kt(Ee)}"`:""} />
2297
+ `}if(Re){let gt=[];if(T)for(let dt of ds(T))gt.push(`<source type="image/${dt.format}" srcset="${Kt(dt.srcset)}"${Ee?` sizes="${Kt(Ee)}"`:""} />`);if(!T&&(q==="avif"||q==="auto")){let dt=fo(R,Ae,Ie,ie,"avif"),St=Pe?Ol(R,Dl,ie,"avif"):`${dt}`;gt.push(`<source type="image/avif" srcset="${Kt(St)}"${Ee?` sizes="${Kt(Ee)}"`:""} />`)}if(!T&&(q==="webp"||q==="auto")){let dt=fo(R,Ae,Ie,ie,"webp"),St=Pe?Ol(R,Dl,ie,"webp"):`${dt}`;gt.push(`<source type="image/webp" srcset="${Kt(St)}"${Ee?` sizes="${Kt(Ee)}"`:""} />`)}return`${st}<picture>
2298
2298
  ${gt.join(`
2299
2299
  `)}
2300
2300
  ${pt}
@@ -2331,7 +2331,7 @@ ${pt}
2331
2331
  @media(prefers-color-scheme:dark){[data-stx-drawer]{--stx-drawer-bg:#1f2937;--stx-drawer-text:#f3f4f6}}
2332
2332
  .stx-drawer-backdrop[data-stx-drawer-open]{display:block!important;opacity:1}
2333
2333
  .stx-drawer-backdrop[data-stx-drawer-open] .stx-drawer-panel{transform:translateX(0)}
2334
- </style>`}};import{existsSync as av,readFileSync as cv}from"fs";var ba=new Map,Qp=new Set;function lv(v){if(Qp.has(v))return;Qp.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 uv(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(av(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 dv(v){if(ba.has(v))return ba.get(v);let _=uv(v);if(!_)return lv(v),null;try{let k=JSON.parse(cv(_,"utf8"));return ba.set(v,k.icons),k.icons}catch{return null}}function Qs(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 Vl={name:"Icon",aliases:["icon","stx-icon"],render(v,_,k){let R=Qs(v,"name")??Qs(v,"icon");if(!R)return"<!-- Icon: missing name/icon prop -->";let T="lucide",B=R;if(R.includes(":")){let le=R.split(":");T=le[0],B=le[1]}let z=zt(Qs(v,"size")||"24"),W=zt(Qs(v,"color")||"currentColor"),F=zt(Qs(v,"class")||""),V=zt(Qs(v,"style")||""),H=ba.get(T)??dv(T);if(!H)return`<!-- Icon: collection "${T}" not loaded -->`;let q=H[B];if(!q)return`<!-- Icon: "${B}" not found in ${T} -->`;let Q=q.width||24,Z=q.height||24,se=`0 0 ${Q} ${Z}`,ie=q.body;if(W!=="currentColor")ie=ie.replace(/currentColor/g,W);let oe=F?` class="${F}"`:"",ae=V?` style="${V}"`:"";return`<svg xmlns="http://www.w3.org/2000/svg" width="${z}" height="${z}" viewBox="${se}" fill="none"${oe}${ae}>${ie}</svg>`}};function Ul(){return`
2334
+ </style>`}};import{existsSync as av,readFileSync as cv}from"fs";var ba=new Map,Qp=new Set;function lv(v){if(Qp.has(v))return;Qp.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 uv(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(av(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 dv(v){if(ba.has(v))return ba.get(v);let _=uv(v);if(!_)return lv(v),null;try{let k=JSON.parse(cv(_,"utf8"));return ba.set(v,k.icons),k.icons}catch{return null}}function Qs(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 Vl={name:"Icon",aliases:["icon","stx-icon"],render(v,_,k){let R=Qs(v,"name")??Qs(v,"icon");if(!R)return"<!-- Icon: missing name/icon prop -->";let T="lucide",B=R;if(R.includes(":")){let le=R.split(":");T=le[0],B=le[1]}let z=zt(Qs(v,"size")||"24"),W=zt(Qs(v,"color")||"currentColor"),F=zt(Qs(v,"class")||""),V=zt(Qs(v,"style")||""),H=ba.get(T)??dv(T);if(!H)return`<!-- Icon: collection "${T}" not loaded -->`;let q=H[B];if(!q)return`<!-- Icon: "${B}" not found in ${T} -->`;let Q=q.width||24,Z=q.height||24,se=`0 0 ${Q} ${Z}`,ie=q.body;if(W!=="currentColor")ie=ie.replace(/currentColor/g,W);let oe=F?` class="${F}"`:"",ae=V?` style="${V}"`:"";return`<svg xmlns="http://www.w3.org/2000/svg" width="${z}" height="${z}" viewBox="${se}" fill="none"${oe}${ae}>${ie}</svg>`}};function Ul(){return`
2335
2335
  (function(){
2336
2336
  var tip=null,hideTimer=null,currentEl=null;
2337
2337
 
@@ -2452,27 +2452,27 @@ ${V.join(`
2452
2452
  `)}
2453
2453
  }`,props:H,events:q}}var mo=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 fn(v){if(v.includes("-")||v==="component")return!1;if(/^[A-Z]/.test(v))return!/[a-z]/.test(v)&&[...mo].some((_)=>_.toLowerCase()===v.toLowerCase());return mo.has(v)||/[A-Z]/.test(v)}function*xv(v){let _=/<([A-Za-z][\w.-]*)(?=[\s/>])/g,k;while(k=_.exec(v)){let R=_.lastIndex,T=[];while(R<v.length){while(/\s/.test(v[R]||""))R++;if(v[R]===">"||v.slice(R,R+2)==="/>"){R+=v[R]===">"?1:2;break}let B=/^[^\s=/>]+/.exec(v.slice(R))?.[0];if(!B){R++;continue}let z=R;R+=B.length;while(/\s/.test(v[R]||""))R++;if(v[R]!=="="){T.push({name:B,value:!0,offset:z,braced:!1});continue}R++;while(/\s/.test(v[R]||""))R++;let W=v[R],F=W==="{",V=W==='"'||W==="'";if(V||F)R++;let H=R;if(F){let q=s(v.slice(R)),Q=1,Z=0;for(;Z<q.length;Z++){if(q[Z]==="{")Q++;if(q[Z]==="}"&&--Q===0)break}R+=Z}else if(V)while(R<v.length&&v[R]!==W)R++;else while(R<v.length&&!/[\s/>]/.test(v[R]))R++;if(T.push({name:B,value:v.slice(H,R),offset:H,braced:F}),V||F)R++}_.lastIndex=R,yield{name:k[1],offset:k.index,attributes:T}}}function mg(v,_,k){let R=[],T=[pg,"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;'],B=new Map,z=new Map,W=new Map,F=k.scriptCode(v,k.filePath),V=s(F);for(let se of F.matchAll(/\bimport\s+(\{[^}]+\}|[\w$]+)\s+from\s*['"]([^'"]+)['"]/g)){if(V.slice(se.index,se.index+6)!=="import")continue;let ie=se[2],oe=ho.isAbsolute(ie)||ie.startsWith(".")?ho.resolve(ho.dirname(k.filePath),ie):Do(ie,ho.dirname(k.filePath));if(!oe)continue;let ae=oe.endsWith(".stx")?oe:Gl.existsSync(`${oe}.stx`)?`${oe}.stx`:void 0,le=ae?null:Po(oe,!1),ce=se[1].startsWith("{")?se[1].slice(1,-1).split(","):[se[1]];for(let ge of ce){let[$e,ye=$e]=ge.trim().split(/\s+as\s+/),ke=ae||le?.get($e)||le?.get($e.toLowerCase());if(ke)W.set(ye,ke),W.set(ye.toLowerCase(),ke),W.set(ye.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),ke)}}for(let se of _.matchAll(/@import\s*\(([^)]+)\)/g))for(let ie of se[1].matchAll(/['"]([^'"]+)['"]/g)){let oe=Mo(ie[1],k.filePath,k).find((ae)=>Gl.statSync(ae,{throwIfNoEntry:!1})?.isFile());if(oe)W.set(ho.basename(ie[1]).replace(/\.stx$/,""),oe)}let H={__importedComponents:W},q=new Map,Q=(se,ie,oe)=>{let ae=v.slice(0,se);return{code:ie,offset:se,attribute:oe,anchor:!0,kind:"directive",line:ae.split(`
2454
2454
  `).length,column:se-ae.lastIndexOf(`
2455
- `)}},Z=(se,ie,oe)=>R.push({expression:se,statement:{text:ie+se.code+oe,prefixLength:ie.length}});for(let se of xv(_)){if(fn(se.name)||se.name==="component")continue;let ie=Ku(se.name,k.filePath,k,H);if(!ie)continue;let oe=q.get(ie);if(!oe){let le;try{le=k.readComponent?k.readComponent(ie):Gl.readFileSync(ie,"utf8")}catch{continue}if(le===void 0)continue;z.set(ie,le),oe=gg(k.scriptCode(le,ie),`__StxComponent${q.size}`),q.set(ie,oe),T.push(oe.declarations)}let ae=[];for(let le of se.attributes){let{name:ce,offset:ge}=le,$e=le.value===!0?"true":le.value;if(ce.startsWith("@")||ce.startsWith("v-on:")){if(oe.events&&le.value!==!0)B.set(ge,`__StxEvent<${oe.events}, ${JSON.stringify(ce.replace(/^@|^v-on:/,"").split(".")[0])}>`);continue}let ye=/^v-model(?::([\w-]+))?(?:\.[\w-]+)*$/.exec(ce);if(ce.startsWith("v-")&&!ce.startsWith("v-bind:")&&!ye)continue;if(/^(?:x-|:)(?:if|for|show|key|else)(?:$|[.:-])/.test(ce))continue;let ke=(ye?ye[1]||"modelValue":ce.replace(/^:|^v-bind:/,"")).replace(/-([a-z])/g,(Ie,Pe)=>Pe.toUpperCase());if(ae.push(ke),!oe.props)continue;let Ae=ce.startsWith(":")||ce.startsWith("v-bind:")||!!ye||le.braced?$e:le.value!==!0?JSON.stringify($e):"true";Z(Q(ge,Ae,ce),";void ((",`) satisfies __StxProp<${oe.props}, ${JSON.stringify(ke)}>);`)}if(oe.props){let le=[...new Set(ae)].map((ge)=>`${JSON.stringify(ge)}: undefined as any`).join(", "),ce=Q(se.offset,`<${se.name}>`);R.push({expression:ce,statement:{text:`;void ({ ${le} } satisfies ${oe.props} & Record<string, unknown>);`,prefixLength:0}})}}return{declarations:q.size?T.join(`
2455
+ `)}},Z=(se,ie,oe)=>R.push({expression:se,statement:{text:ie+se.code+oe,prefixLength:ie.length}});for(let se of xv(_)){if(fn(se.name)||se.name==="component")continue;let ie=Nu(se.name,k.filePath,k,H);if(!ie)continue;let oe=q.get(ie);if(!oe){let le;try{le=k.readComponent?k.readComponent(ie):Gl.readFileSync(ie,"utf8")}catch{continue}if(le===void 0)continue;z.set(ie,le),oe=gg(k.scriptCode(le,ie),`__StxComponent${q.size}`),q.set(ie,oe),T.push(oe.declarations)}let ae=[];for(let le of se.attributes){let{name:ce,offset:ge}=le,$e=le.value===!0?"true":le.value;if(ce.startsWith("@")||ce.startsWith("v-on:")){if(oe.events&&le.value!==!0)B.set(ge,`__StxEvent<${oe.events}, ${JSON.stringify(ce.replace(/^@|^v-on:/,"").split(".")[0])}>`);continue}let ye=/^v-model(?::([\w-]+))?(?:\.[\w-]+)*$/.exec(ce);if(ce.startsWith("v-")&&!ce.startsWith("v-bind:")&&!ye)continue;if(/^(?:x-|:)(?:if|for|show|key|else)(?:$|[.:-])/.test(ce))continue;let ke=(ye?ye[1]||"modelValue":ce.replace(/^:|^v-bind:/,"")).replace(/-([a-z])/g,(Ie,Pe)=>Pe.toUpperCase());if(ae.push(ke),!oe.props)continue;let Ae=ce.startsWith(":")||ce.startsWith("v-bind:")||!!ye||le.braced?$e:le.value!==!0?JSON.stringify($e):"true";Z(Q(ge,Ae,ce),";void ((",`) satisfies __StxProp<${oe.props}, ${JSON.stringify(ke)}>);`)}if(oe.props){let le=[...new Set(ae)].map((ge)=>`${JSON.stringify(ge)}: undefined as any`).join(", "),ce=Q(se.offset,`<${se.name}>`);R.push({expression:ce,statement:{text:`;void ({ ${le} } satisfies ${oe.props} & Record<string, unknown>);`,prefixLength:0}})}}return{declarations:q.size?T.join(`
2456
2456
  `):"",checks:R,events:B,dependencies:z}}var hg=/<script(\s[^>]*)?>([\s\S]*?)<\/script>/gi;function bv(v){let _=(k)=>k.replace(/[^\n]/g," ");return v.replace(/<!--[\s\S]*?-->/g,_).replace(/\{\{--[\s\S]*?--\}\}/g,_)}function We(v){let _=[],k=bv(v);hg.lastIndex=0;let R;while((R=hg.exec(k))!==null){let T=(R[1]||"").trim(),B=(R[0].match(/^<script(?:\s[^>]*)?>/i)?.[0]??"<script>").length,z=(R[0].match(/<\/script\s*>$/i)?.[0]??"</script>").length,W=R.index+B,F=R.index+R[0].length-z,V=v.slice(W,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 q=/\bserver\b/.test(T)?"server":/\bclient\b/.test(T)?"client":"plain",Q=yo(v,W);_.push({kind:q,code:V,startLine:Q,startColumn:xo(v,W),offset:W,attrs:T})}return _}function yo(v,_){let k=1;for(let R=0;R<_&&R<v.length;R++)if(v.charCodeAt(R)===10)k++;return k}function xo(v,_){let k=v.lastIndexOf(`
2457
2457
  `,_-1)+1;return _-k+1}function wa(v){let _=v.split(""),k=(T,B)=>{for(let z=T;z<B&&z<_.length;z++)if(_[z]!==`
2458
2458
  `)_[z]=" "},R=[/<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 R){T.lastIndex=0;let B;while((B=T.exec(v))!==null)k(B.index,B.index+B[0].length)}return _.join("")}function vv(v){let _=0,k="";for(let R=0;R<v.length;R++){let T=v[R];if(k){if(T==="\\"){R++;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[R+1]==="|"){R++;continue}if(v[R-1]==="|")continue;return v.slice(0,R)}}return v}var kg=new Set([":for","x-for","v-for"]),Sa=/(?:^|\s)((?::|x-|v-|@)[\w.:-]+)\s*=\s*(["'])([\s\S]*?)\2/g,Jl="__stx_interpolated",yg="__StxElement",Eg="__StxTemplateValue",wv=`type ${Eg}<T> = T extends { readonly _isSignal: true } | { readonly _isDerived: true } ? (T extends () => infer V ? T & V : T) : T`;function xg(v){return v.replace(/\{\{[\s\S]*?\}\}/g,Jl).replace(/\{!![\s\S]*?!!\}/g,Jl)}function ps(v){return v.replace(/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/g,(_)=>{let k=_.split(`
2459
2459
  `).length-1,R=_.length-k;return`0${" ".repeat(Math.max(0,R-1))}${`
2460
- `.repeat(k)}`})}var Sv=["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"],$v=new RegExp(String.raw`^[ \t]*@(?:${Sv.join("|")})\b[ \t]*(\([^\n)]*\))?[ \t]*$`,"gm");function gs(v){return v.replace($v,(_)=>_.replace(/[^\n]/g," "))}var bg=new Set(["x-cloak","x-ref","x-transition","x-teleport","v-slot","x-hydrate",":key","x-tooltip","x-tooltip-position"]);function kc(v){let _=wa(v),k=[],R=/(@?)\{\{([\s\S]*?)\}\}|(@?)\{!!([\s\S]*?)!!\}/g,T;while((T=R.exec(_))!==null){if(T[1]||T[3])continue;let W=T[2]??T[4]??"",F=T[2]!==void 0?2:3,V=vv(W);if(!V.trim())continue;let H=T.index+F+(V.length-V.trimStart().length);k.push({code:V.trim(),line:yo(_,H),column:xo(_,H),offset:H,kind:"interpolation"})}let B=/@(if|elseif|else\s+if|unless)\b\s*\(/g;while((T=B.exec(_))!==null){let z=T.index+T[0].length-1,W=0,F=z;for(;F<_.length;F++){let Q=_[F];if(Q==="(")W++;else if(Q===")"){if(W--,W===0)break}}if(W!==0)continue;let V=_.slice(z+1,F),H=V.trim();if(B.lastIndex=F+1,!H)continue;let q=z+1+(V.length-V.trimStart().length);k.push({code:H,line:yo(_,q),column:xo(_,q),offset:T.index,kind:"condition"})}Sa.lastIndex=0;while((T=Sa.exec(_))!==null){let z=T[1],W=T[3]??"",F=z.replace(/\..*$/,"").replace(/^([^:].*?):.*$/,"$1");if(bg.has(F)||bg.has(z))continue;if(!W.trim())continue;let V=T.index+T[0].indexOf(T[2],T[0].indexOf(z)+z.length)+1;if(kg.has(F)){let q=W.match(/\s+(?:in|of)\s+/);if(!q||q.index===void 0)continue;let Q=W.slice(q.index+q[0].length),Z=q.index+q[0].length+(Q.length-Q.trimStart().length);k.push({code:xg(Q.trim()),line:yo(_,V+Z),column:xo(_,V+Z),offset:V+Z,kind:"directive",attribute:F});continue}let H=W.length-W.trimStart().length;k.push({code:xg(W.trim()),line:yo(_,V+H),column:xo(_,V+H),offset:V+H,kind:"directive",attribute:F})}return k.sort((z,W)=>z.line-W.line||z.column-W.column),k}var _v=2000;function kv(v,_){let k=0,R=Math.min(v.length,_+_v);for(let T=_;T<R;T++){let B=v[T];if(B==="(")k++;else if(B===")"){if(k--,k===0)return v.slice(_+1,T)}}return null}function Ev(v){let _=new Map,k=(W,F)=>{let V=W.split(/[,[\]{}()\s]+/).filter(Boolean);for(let H of V){let q=H.replace(/^\.\.\./,"").trim();if(!/^\$?[A-Z_$][\w$]*$/i.test(q))continue;let Q=V.length===1?F:void 0,Z=_.get(q);if(!Z)_.set(q,{name:q,iterable:Q});else if(Z.iterable!==Q)Z.iterable=void 0}},R=/^\$?[A-Z_$][\w$]*$/i,T=(W)=>{let F=W.trim();return R.test(F)?F:void 0};for(let W of v.matchAll(/@for(?:each|else)\s*\(/g)){let F=kv(v,W.index+W[0].length-1);if(F===null)continue;let V=Et(F);if(!V)continue;k(V.itemVar.replace(/=>/g," "),T(V.arrayExpr))}for(let W of v.matchAll(/@for\s*\(\s*(?:(?:let|const|var)\s+)?([\w$]+|\[[^\]]*\]|\{[^}]*\})\s+(of|in)\s+([^)]*)/g))k(W[1],W[2]==="of"?T(W[3]):void 0);for(let W of v.matchAll(/@for\s*\(\s*(?:let|const|var)\s+([\w$]+)\s*[=;]/g))k(W[1]);let B=wa(v);Sa.lastIndex=0;let z;while((z=Sa.exec(B))!==null){let W=z[1].replace(/\..*$/,"");if(!kg.has(W))continue;let F=z[3].match(/\s+(?:in|of)\s+/);if(!F||F.index===void 0)continue;k(z[3].slice(0,F.index),T(z[3].slice(F.index+F[0].length)))}for(let W of v.matchAll(/@(?:php|js|ts)\b([\s\S]*?)@end(?:php|js|ts)\b/g))for(let F of W[1].matchAll(/\b(?:const|let|var|function|class)\s+([\w$]+)/g))k(F[1]);return[..._.values()].sort((W,F)=>W.name.localeCompare(F.name))}function de(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 R of k[1].split(",")){let T=R.split(":").pop().split("=")[0].replace(/^\.\.\./,"").trim();if(/^[A-Z_$][\w$]*$/i.test(T))_.add(T)}return[..._].sort()}var Yl=["params","query","cookies","host","ip","setResponseStatus","setResponseHeader","notFound","request","url","definePageMeta","defineClientPayload","defineStore","props","$props"],Cv={$bool:"declare function $bool(value: unknown, fallback?: boolean): boolean",$num:"declare function $num(value: unknown, fallback?: number): number",$uid:"declare var $uid: string"};function ai(v=new Set){return[...Yl.filter((_)=>!v.has(_)).map((_)=>`declare var ${_}: any`),...Object.entries(Cv).filter(([_])=>!v.has(_)).map(([,_])=>_)].join(`
2460
+ `.repeat(k)}`})}var Sv=["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"],$v=new RegExp(String.raw`^[ \t]*@(?:${Sv.join("|")})\b[ \t]*(\([^\n)]*\))?[ \t]*$`,"gm");function gs(v){return v.replace($v,(_)=>_.replace(/[^\n]/g," "))}var bg=new Set(["x-cloak","x-ref","x-transition","x-teleport","v-slot","x-hydrate",":key","x-tooltip","x-tooltip-position"]);function kc(v){let _=wa(v),k=[],R=/(@?)\{\{([\s\S]*?)\}\}|(@?)\{!!([\s\S]*?)!!\}/g,T;while((T=R.exec(_))!==null){if(T[1]||T[3])continue;let W=T[2]??T[4]??"",F=T[2]!==void 0?2:3,V=vv(W);if(!V.trim())continue;let H=T.index+F+(V.length-V.trimStart().length);k.push({code:V.trim(),line:yo(_,H),column:xo(_,H),offset:H,kind:"interpolation"})}let B=/@(if|elseif|else\s+if|unless)\b\s*\(/g;while((T=B.exec(_))!==null){let z=T.index+T[0].length-1,W=0,F=z;for(;F<_.length;F++){let Q=_[F];if(Q==="(")W++;else if(Q===")"){if(W--,W===0)break}}if(W!==0)continue;let V=_.slice(z+1,F),H=V.trim();if(B.lastIndex=F+1,!H)continue;let q=z+1+(V.length-V.trimStart().length);k.push({code:H,line:yo(_,q),column:xo(_,q),offset:T.index,kind:"condition"})}Sa.lastIndex=0;while((T=Sa.exec(_))!==null){let z=T[1],W=T[3]??"",F=z.replace(/\..*$/,"").replace(/^([^:].*?):.*$/,"$1");if(bg.has(F)||bg.has(z))continue;if(!W.trim())continue;let V=T.index+T[0].indexOf(T[2],T[0].indexOf(z)+z.length)+1;if(kg.has(F)){let q=W.match(/\s+(?:in|of)\s+/);if(!q||q.index===void 0)continue;let Q=W.slice(q.index+q[0].length),Z=q.index+q[0].length+(Q.length-Q.trimStart().length);k.push({code:xg(Q.trim()),line:yo(_,V+Z),column:xo(_,V+Z),offset:V+Z,kind:"directive",attribute:F});continue}let H=W.length-W.trimStart().length;k.push({code:xg(W.trim()),line:yo(_,V+H),column:xo(_,V+H),offset:V+H,kind:"directive",attribute:F})}return k.sort((z,W)=>z.line-W.line||z.column-W.column),k}var _v=2000;function kv(v,_){let k=0,R=Math.min(v.length,_+_v);for(let T=_;T<R;T++){let B=v[T];if(B==="(")k++;else if(B===")"){if(k--,k===0)return v.slice(_+1,T)}}return null}function Ev(v){let _=new Map,k=(W,F)=>{let V=W.split(/[,[\]{}()\s]+/).filter(Boolean);for(let H of V){let q=H.replace(/^\.\.\./,"").trim();if(!/^\$?[A-Z_$][\w$]*$/i.test(q))continue;let Q=V.length===1?F:void 0,Z=_.get(q);if(!Z)_.set(q,{name:q,iterable:Q});else if(Z.iterable!==Q)Z.iterable=void 0}},R=/^\$?[A-Z_$][\w$]*$/i,T=(W)=>{let F=W.trim();return R.test(F)?F:void 0};for(let W of v.matchAll(/@for(?:each|else)\s*\(/g)){let F=kv(v,W.index+W[0].length-1);if(F===null)continue;let V=Et(F);if(!V)continue;k(V.itemVar.replace(/=>/g," "),T(V.arrayExpr))}for(let W of v.matchAll(/@for\s*\(\s*(?:(?:let|const|var)\s+)?([\w$]+|\[[^\]]*\]|\{[^}]*\})\s+(of|in)\s+([^)]*)/g))k(W[1],W[2]==="of"?T(W[3]):void 0);for(let W of v.matchAll(/@for\s*\(\s*(?:let|const|var)\s+([\w$]+)\s*[=;]/g))k(W[1]);let B=wa(v);Sa.lastIndex=0;let z;while((z=Sa.exec(B))!==null){let W=z[1].replace(/\..*$/,"");if(!kg.has(W))continue;let F=z[3].match(/\s+(?:in|of)\s+/);if(!F||F.index===void 0)continue;k(z[3].slice(0,F.index),T(z[3].slice(F.index+F[0].length)))}for(let W of v.matchAll(/@(?:php|js|ts)\b([\s\S]*?)@end(?:php|js|ts)\b/g))for(let F of W[1].matchAll(/\b(?:const|let|var|function|class)\s+([\w$]+)/g))k(F[1]);return[..._.values()].sort((W,F)=>W.name.localeCompare(F.name))}function ue(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 R of k[1].split(",")){let T=R.split(":").pop().split("=")[0].replace(/^\.\.\./,"").trim();if(/^[A-Z_$][\w$]*$/i.test(T))_.add(T)}return[..._].sort()}var Yl=["params","query","cookies","host","ip","setResponseStatus","setResponseHeader","notFound","request","url","definePageMeta","defineClientPayload","defineStore","props","$props"],Cv={$bool:"declare function $bool(value: unknown, fallback?: boolean): boolean",$num:"declare function $num(value: unknown, fallback?: number): number",$uid:"declare var $uid: string"};function ai(v=new Set){return[...Yl.filter((_)=>!v.has(_)).map((_)=>`declare var ${_}: any`),...Object.entries(Cv).filter(([_])=>!v.has(_)).map(([,_])=>_)].join(`
2461
2461
  `)}function ci(v){return new Set([...v.matchAll(/^declare (?:function|const|let|var)\s+([A-Za-z_$][\w$]*)/gm)].map((_)=>_[1]))}function Cg(v){let _=/\bdefineClientPayload\s*\(\s*\{([\s\S]*?)\}\s*\)/g,k,R=!1,T=new Set,B=s(v);while((k=_.exec(B))!==null){R=!0;for(let z of Rv(k[1])){let W=z.split(":")[0].trim();if(/^[A-Za-z_$][\w$]*$/.test(W))T.add(W)}}return R?[...T]:null}function Rv(v){let _=[],k=0,R="";for(let T of v){if(T===","&&k===0){_.push(R),R="";continue}if(T==="("||T==="["||T==="{")k++;else if(T===")"||T==="]"||T==="}")k--;R+=T}return _.push(R),_.filter((T)=>T.trim().length>0)}function Tv(v){let _=/^[ \t]*import\b[\s\S]*?(?:from\s*['"][^'"]*['"]|['"][^'"]*['"])[ \t]*;?[ \t]*$/gm,k=[],R=v.replace(_,(T)=>(k.push(T.trim()),T.split(`
2462
2462
  `).map(()=>"").join(`
2463
2463
  `)));return{imports:k.join(`
2464
2464
  `),body:R}}function Rg(v){let _=s(v),k=Array(_.length),R=0;for(let W=0;W<_.length;W++){let F=_[W];if(F==="}"||F===")"||F==="]")R=Math.max(0,R-1);if(k[W]=R,F==="{"||F==="("||F==="[")R++}let T=[],B=/^[ \t]*(?:export[ \t]+)?(interface|type)[ \t]+([A-Za-z_$][\w$]*)/gm,z;while((z=B.exec(_))!==null){if(k[z.index]!==0)continue;let W=z[1],F=z[2],V;if(W==="interface"){let H=_.indexOf("{",z.index);if(H===-1)continue;let q=0;V=-1;for(let Q=H;Q<_.length;Q++)if(_[Q]==="{")q++;else if(_[Q]==="}"&&--q===0){V=Q+1;break}if(V===-1)continue}else{let H=0;V=_.length;for(let q=_.indexOf("=",z.index)+1;q<_.length;q++){let Q=_[q];if(Q==="{"||Q==="["||Q==="("||Q==="<")H++;else if(Q==="}"||Q==="]"||Q===")"||Q===">")H--;else if(H<=0&&(Q===";"||Q===`
2465
- `&&!/[=|&,<([{]\s*$/.test(_.slice(Math.max(0,q-40),q)))){V=Q===";"?q+1:q;break}}}T.push({name:F,text:v.slice(z.index,V).replace(/^[ \t]*export[ \t]+/,"")}),B.lastIndex=V}return T}function Av(v){return new Set(Rg(v).map((_)=>_.name))}function li(v,_=""){let k=Cg(v),R=Av(_),T=Rg(v).filter((V)=>!R.has(V.name)).map((V)=>V.text);if(!k){let V=de(v).filter((H)=>!Fi(_,H));if(V.length===0&&T.length===0)return"";return["",`// ${Iv}`,...T,...V.map((H)=>`declare var ${H}: any`)].join(`
2465
+ `&&!/[=|&,<([{]\s*$/.test(_.slice(Math.max(0,q-40),q)))){V=Q===";"?q+1:q;break}}}T.push({name:F,text:v.slice(z.index,V).replace(/^[ \t]*export[ \t]+/,"")}),B.lastIndex=V}return T}function Av(v){return new Set(Rg(v).map((_)=>_.name))}function li(v,_=""){let k=Cg(v),R=Av(_),T=Rg(v).filter((V)=>!R.has(V.name)).map((V)=>V.text);if(!k){let V=ue(v).filter((H)=>!Fi(_,H));if(V.length===0&&T.length===0)return"";return["",`// ${Iv}`,...T,...V.map((H)=>`declare var ${H}: any`)].join(`
2466
2466
  `)}if(k.length===0)return T.length>0?["",`// ${vg}`,...T].join(`
2467
2467
  `):"";let{imports:B,body:z}=Tv(v),W=z.replace(/^[ \t]*export[ \t]+(?=(?:const|let|var|function|async|class)\b)/gm,""),F=["",`// ${vg}`];if(B)F.push(B);return F.push(...T),F.push(`async function ${wg}() {`,W,` return { ${k.join(", ")} }`,"}",`type ${Sg} = Awaited<ReturnType<typeof ${wg}>>`,...k.map((V)=>`declare var ${V}: ${Sg}[${JSON.stringify(V)}]`)),F.join(`
2468
2468
  `)}function Ql(v){let k=s(v).split(""),R=0;for(let T=0;T<k.length;T++){let B=k[T];if(B==="{"||B==="("||B==="["){R++;continue}if(B==="}"||B===")"||B==="]"){R=Math.max(0,R-1);continue}if(R>0&&B!==`
2469
- `)k[T]=" "}return de(k.join(""))}function di(v,_){if(Cg(v)!==null)return[];let k=Ql(v),R=Ct(_,new Set(k)),T=new Set(y);return k.filter((B)=>{if(T.has(B))return!1;if(Fi(_,B))return!1;return R.has(B)})}var vg="stx: types for the declared client payload (#1868)",Iv="stx: untyped bridge names \u2014 declare a defineClientPayload to check these (#1868)",wg="__stxServerScope",Sg="__StxClientPayload";var $g=["$env","$user","$slot","$slots","$attrs","$props","$page","$route","$loop","loop","$errors","$csrf","props","slot"];var Pv=/^\s*[A-Z_$][\w$]*\s*=[^=]/i;function Dv(v){let _=new Map,k=/!|===|!==|==|!=|&&|\|\||<|>|\btypeof\b|\binstanceof\b|\bin\b/;for(let R of v){let T=s(R),{depths:B,balanced:z}=Se(T);if(!z)continue;let W=/^([ \t]*(?:export[ \t]+)?const[ \t]+)([A-Za-z_$][\w$]*)[ \t]*(?::[^=\n]+)?=[ \t]*([^\n]+)$/gm;for(let F of T.matchAll(W)){let V=F.index??0;if(B[V+F[1].length]!==0)continue;let H=F[2],q=V+F[0].length-F[3].length,Q=R.slice(q,V+F[0].length).trim().replace(/;$/,"").trim(),Z=F[3],se=k.test(Z)&&!/\bawait\b|=>|\bfunction\b|[{}]/.test(Z)&&!/[,+\-*/%&|?:=]$/.test(Q)&&Se(Z).balanced;_.set(H,_.has(H)||!se?null:Q)}}return new Map([..._].filter((R)=>R[1]!==null))}function Tg(v,_,k=0,R=new Set){if(_.size===0||k>=5)return v;let T=s(v),B="",z=0;for(let W of T.matchAll(/[A-Za-z_$][\w$]*/g)){let F=W.index??0,V=W[0],H=_.get(V);if(!H||R.has(V))continue;let q=T.slice(0,F).trimEnd(),Q=T.slice(F+V.length).trimStart();if(q.endsWith(".")||/^:(?!:)/.test(Q)&&/[{,]$/.test(q))continue;if(F>0&&/[\w$]/.test(T[F-1]))continue;B+=`${v.slice(z,F)}(${Tg(H,_,k+1,new Set([...R,V]))})`,z=F+V.length}return B+v.slice(z)}function Mv(v,_){let k=/@(if|unless|elseif|else|endif|endunless)\b\s*(\()?/g,R=[],T;while((T=k.exec(v))!==null){if(T.index>_)break;let B=T[1];if(T.index===_){if(B==="elseif"){let W=R[R.length-1];if(W?.current)W.seen.push(W.current);if(W)W.current=null}break}if(B==="endif"||B==="endunless"){R.pop();continue}let z="";if(T[2]==="("){let W=0,F=T.index+T[0].length-1,V=F+1;for(;F<v.length;F++){let H=v[F];if(H==="(")W++;else if(H===")"){if(W--,W===0)break}}z=v.slice(V,F).trim(),k.lastIndex=F+1}if(B==="if")R.push({seen:[],current:z});else if(B==="unless")R.push({seen:[],current:`!(${z})`});else if(B==="elseif"||B==="else"){let W=R[R.length-1];if(!W)continue;if(W.current)W.seen.push(W.current);W.current=B==="elseif"?z:null}}return R.flatMap((B)=>[...B.seen.map((z)=>`!(${z})`),...B.current?[B.current]:[]]).filter(Boolean)}function Ov(v){let _=v.code.trim();if(!_)return null;if(v.attribute?.startsWith("@")){if(Pv.test(_))return null;let R=";(($event: any): void => { ";return{text:`${R}${_} });`,prefixLength:R.length}}let k=";void ((";return{text:`${k}${_}));`,prefixLength:k.length}}var Nv=/(\bfrom\s*|\bimport\s*\(\s*|\bimport\s+)(['"])(\.{1,2}\/[^'"\n]*)\2/g;function Zn(v,_){if(!_)return v;return v.replace(Nv,(k,R,T,B)=>{let z=_g.resolve(_,B).replace(/\\/g,"/");return`${R}${T}${z}${T}`})}function ms(v){return" ".repeat(Math.max(0,(v.startColumn??1)-1))}function jv(v){let _=new Set,k=s(v);for(let R of k.matchAll(/\bimport\s+(?:type\s+)?([\w$*{}\s,]+?)\s+from\b/g)){let T=R[1],B=/\{([^}]*)\}/.exec(T);for(let V of B?.[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 z=T.replace(/\{[^}]*\}/,""),W=/\*\s*as\s+([A-Z_$][\w$]*)/i.exec(z);if(W)_.add(W[1]);let F=/^\s*([A-Z_$][\w$]*)/i.exec(z);if(F&&F[1]!=="type")_.add(F[1])}return[..._].sort()}function ui(v,_={}){let k=We(v),R=v.split(`
2470
- `),T=Array.from({length:R.length},()=>""),B=new Map,z=_.filePath&&_.templateExpressions!==!1?mg(v,wa(v),{filePath:_.filePath,componentsDir:_.componentsDir,projectRoot:_.projectRoot,readComponent:_.readComponent,scriptCode:(q,Q)=>We(q).map((Z)=>Zn(Z.code,_g.dirname(Q))).join(`
2471
- `)}):void 0,W=new Set,F=[];for(let q of k){let Q=gs(ps(q.code)),Z=Zn(Q,_.originDir??"").split(`
2469
+ `)k[T]=" "}return ue(k.join(""))}function ui(v,_){if(Cg(v)!==null)return[];let k=Ql(v),R=Ct(_,new Set(k)),T=new Set(y);return k.filter((B)=>{if(T.has(B))return!1;if(Fi(_,B))return!1;return R.has(B)})}var vg="stx: types for the declared client payload (#1868)",Iv="stx: untyped bridge names \u2014 declare a defineClientPayload to check these (#1868)",wg="__stxServerScope",Sg="__StxClientPayload";var $g=["$env","$user","$slot","$slots","$attrs","$props","$page","$route","$loop","loop","$errors","$csrf","props","slot"];var Pv=/^\s*[A-Z_$][\w$]*\s*=[^=]/i;function Dv(v){let _=new Map,k=/!|===|!==|==|!=|&&|\|\||<|>|\btypeof\b|\binstanceof\b|\bin\b/;for(let R of v){let T=s(R),{depths:B,balanced:z}=Se(T);if(!z)continue;let W=/^([ \t]*(?:export[ \t]+)?const[ \t]+)([A-Za-z_$][\w$]*)[ \t]*(?::[^=\n]+)?=[ \t]*([^\n]+)$/gm;for(let F of T.matchAll(W)){let V=F.index??0;if(B[V+F[1].length]!==0)continue;let H=F[2],q=V+F[0].length-F[3].length,Q=R.slice(q,V+F[0].length).trim().replace(/;$/,"").trim(),Z=F[3],se=k.test(Z)&&!/\bawait\b|=>|\bfunction\b|[{}]/.test(Z)&&!/[,+\-*/%&|?:=]$/.test(Q)&&Se(Z).balanced;_.set(H,_.has(H)||!se?null:Q)}}return new Map([..._].filter((R)=>R[1]!==null))}function Tg(v,_,k=0,R=new Set){if(_.size===0||k>=5)return v;let T=s(v),B="",z=0;for(let W of T.matchAll(/[A-Za-z_$][\w$]*/g)){let F=W.index??0,V=W[0],H=_.get(V);if(!H||R.has(V))continue;let q=T.slice(0,F).trimEnd(),Q=T.slice(F+V.length).trimStart();if(q.endsWith(".")||/^:(?!:)/.test(Q)&&/[{,]$/.test(q))continue;if(F>0&&/[\w$]/.test(T[F-1]))continue;B+=`${v.slice(z,F)}(${Tg(H,_,k+1,new Set([...R,V]))})`,z=F+V.length}return B+v.slice(z)}function Mv(v,_){let k=/@(if|unless|elseif|else|endif|endunless)\b\s*(\()?/g,R=[],T;while((T=k.exec(v))!==null){if(T.index>_)break;let B=T[1];if(T.index===_){if(B==="elseif"){let W=R[R.length-1];if(W?.current)W.seen.push(W.current);if(W)W.current=null}break}if(B==="endif"||B==="endunless"){R.pop();continue}let z="";if(T[2]==="("){let W=0,F=T.index+T[0].length-1,V=F+1;for(;F<v.length;F++){let H=v[F];if(H==="(")W++;else if(H===")"){if(W--,W===0)break}}z=v.slice(V,F).trim(),k.lastIndex=F+1}if(B==="if")R.push({seen:[],current:z});else if(B==="unless")R.push({seen:[],current:`!(${z})`});else if(B==="elseif"||B==="else"){let W=R[R.length-1];if(!W)continue;if(W.current)W.seen.push(W.current);W.current=B==="elseif"?z:null}}return R.flatMap((B)=>[...B.seen.map((z)=>`!(${z})`),...B.current?[B.current]:[]]).filter(Boolean)}function Ov(v){let _=v.code.trim();if(!_)return null;if(v.attribute?.startsWith("@")){if(Pv.test(_))return null;let R=";(($event: any): void => { ";return{text:`${R}${_} });`,prefixLength:R.length}}let k=";void ((";return{text:`${k}${_}));`,prefixLength:k.length}}var Nv=/(\bfrom\s*|\bimport\s*\(\s*|\bimport\s+)(['"])(\.{1,2}\/[^'"\n]*)\2/g;function Qn(v,_){if(!_)return v;return v.replace(Nv,(k,R,T,B)=>{let z=_g.resolve(_,B).replace(/\\/g,"/");return`${R}${T}${z}${T}`})}function ms(v){return" ".repeat(Math.max(0,(v.startColumn??1)-1))}function jv(v){let _=new Set,k=s(v);for(let R of k.matchAll(/\bimport\s+(?:type\s+)?([\w$*{}\s,]+?)\s+from\b/g)){let T=R[1],B=/\{([^}]*)\}/.exec(T);for(let V of B?.[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 z=T.replace(/\{[^}]*\}/,""),W=/\*\s*as\s+([A-Z_$][\w$]*)/i.exec(z);if(W)_.add(W[1]);let F=/^\s*([A-Z_$][\w$]*)/i.exec(z);if(F&&F[1]!=="type")_.add(F[1])}return[..._].sort()}function di(v,_={}){let k=We(v),R=v.split(`
2470
+ `),T=Array.from({length:R.length},()=>""),B=new Map,z=_.filePath&&_.templateExpressions!==!1?mg(v,wa(v),{filePath:_.filePath,componentsDir:_.componentsDir,projectRoot:_.projectRoot,readComponent:_.readComponent,scriptCode:(q,Q)=>We(q).map((Z)=>Qn(Z.code,_g.dirname(Q))).join(`
2471
+ `)}):void 0,W=new Set,F=[];for(let q of k){let Q=gs(ps(q.code)),Z=Qn(Q,_.originDir??"").split(`
2472
2472
  `);Z.forEach((se,ie)=>{let oe=q.startLine-1+ie;if(oe<T.length)T[oe]=ie===0?ms(q)+se:se,W.add(oe)}),F.push(q.startLine-1+Z.length-1)}for(let q of F){let Q=T[q]?.trim()===""?q:q+1;if(Q<T.length&&T[Q].trim()===""&&(Q===q||!W.has(Q)))T[Q]=";"}let V=(q,Q)=>{for(let[Z,se]of q.split(`
2473
- `).entries())if(T.push(se),Q)B.set(T.length,Z===0?Q:{...Q,line:Q.line+Z,column:1,prefixLength:0})};if(_.globals!==!1){V("");let q=new Set([...k.flatMap((ie)=>de(ie.code)),...k.flatMap((ie)=>jv(ie.code))]),Q=(ie)=>{if(!q.has(ie))V(`declare var ${ie}: any`)};if(_.runtimeGlobals!==!1){if(!q.has("window"))V("declare var window: any");for(let ie of y)Q(ie)}let Z=[...new Set([...Yl,...K,...$g])].filter((ie)=>_.runtimeGlobals!==!1||!y.includes(ie));if(_.contextScope==="global"){V("declare global {");for(let ie of Z)V(` var ${ie}: any`);V("}")}else{for(let ie of Yl)Q(ie);for(let ie of K)Q(ie);for(let ie of $g)Q(ie)}V(`declare var ${Jl}: any`);let se=new Set(k.flatMap((ie)=>de(ie.code)));V(`type ${yg}<T> = T extends readonly (infer E)[] ? E : T extends Iterable<infer E2> ? E2 : any`);for(let ie of Ev(v)){if(se.has(ie.name))continue;let oe=ie.iterable&&se.has(ie.iterable)?`${yg}<typeof ${ie.iterable}>`:"any";V(`declare var ${ie.name}: ${oe}`)}}if(_.templateExpressions!==!1){if(z?.declarations)for(let Q of z.declarations.split(`
2474
- `))V(Q);let q=kc(v).map((Q)=>{let Z=z?.events.get(Q.offset??-1);if(Z){Q.anchor=!0;let se=Q.code.trim(),ie=/^([\w$]+)\s*=\s*([^=][\s\S]*)$/.exec(se),oe=ie?`void ((${ie[2]}) satisfies __StxAssignedValue<typeof ${ie[1]}>)`:/^[\w$]+(?:\.[\w$]+)*$/.test(se)?`${se} satisfies (($event: ${Z}) => unknown)`:se,ae=`;(($event: ${Z}): void => { `;return{expression:Q,statement:{text:`${ae}${oe} });`,prefixLength:ae.length}}}return{expression:Q,statement:Ov(Q)}}).filter((Q)=>Q.statement!==null);if(q.push(...z?.checks||[]),q.length>0){let Q=wa(v),Z=Dv(k.map((ae)=>ae.code)),ie=[...new Set(k.flatMap((ae)=>de(ae.code)))].filter((ae)=>/^[A-Z_$][\w$]*$/i.test(ae)),oe=0;if(ie.length>0){V(wv);for(let ae of ie)V(`type __StxT_${ae} = ${Eg}<typeof ${ae}>`);V(`;((${ie.map((ae)=>`${ae}: __StxT_${ae}`).join(", ")}) => {`),oe=1}for(let{expression:ae,statement:le}of q){let ce=" ".repeat(oe),ge=ae.offset===void 0?[]:Mv(Q,ae.offset),$e=ge.length>0?`${ge.map((ke)=>`if (${Tg(ke,Z)}) `).join("")}{ `:"",ye=ge.length>0?" }":"";V(ce+$e+le.text+ye,{line:ae.line,column:ae.column,expression:ae,prefixLength:le.prefixLength+ce.length+$e.length,guardPrefixLength:ce.length+$e.length})}if(oe>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(`
2475
- `),lineMap:B,sourceLineCount:R.length,componentDependencies:z?.dependencies,referenced:H}}function pi(v,_){if(!v.expression)return!1;return v.inGuard===!0||_===2774}function fi(v,_,k){let R=v.lineMap.get(_);if(!R)return _<=v.sourceLineCount?{line:_,column:k}:null;let T=R.expression?.anchor?0:Math.max(0,k-1-(R.prefixLength??0));return{line:R.line,column:R.column+T,expression:R.expression,inGuard:k<=(R.guardPrefixLength??0)}}import Ag from"fs";import Ig from"path";var Pg=!1;function Lv(v,_,k,R=!1,T=new Set){let B={static:{},staticNames:{},serverDynamic:{},serverDynamicNames:{},clientReactive:{},events:{}},z=new Set(Array.isArray(_.__stx_client_signal_names)?_.__stx_client_signal_names:[]),W=(q)=>{if(z.size===0)return!1;let Q=s(q),Z=Q.match(/^\s*[!+~(-]*\s*([a-zA-Z_$][\w$]*)/)?.[1];if(Z&&z.has(Z))return!0;for(let se of z){let ie=se.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(new RegExp(`(?:^|[^\\w$.])${ie}\\s*\\(`).test(Q))return!0}return!1},F=new Set(qi),V=(q)=>{if(!q.includes("-")||q.startsWith("@")||q.startsWith(":")||q.startsWith("x-")||q.startsWith("__"))return q;if(q.startsWith("aria-")||q.startsWith("data-"))return q;return q.replace(/-([a-z0-9])/g,(Q,Z)=>Z.toUpperCase())},H=(q,Q)=>{let Z=V(q);if(B.static[Z]=Q,Z!==q)B.staticNames[Z]=q};for(let[q,Q]of Object.entries(v)){let Z=q.startsWith("x-")&&!F.has(q)&&!q.startsWith("x-bind:")&&!q.startsWith("x-on:")?`:${q.slice(2)}`:q;if(Z.startsWith("@")){B.events[Z]=Q;continue}if(Z.startsWith("__stx_")){let se=V(Z.slice(6));B.serverDynamic[se]=cg(Q,k);continue}if(Z.startsWith(":")){let se=V(Z.slice(1)),ie=Q===Er?se:Q;if(se==="if"||se==="for"||se==="show"){B.clientReactive[se]=ie;continue}if(R){B.clientReactive[se]=ie;continue}if(Mr(ie,T)){B.clientReactive[se]=ie;continue}if(W(ie)){B.clientReactive[se]=ie;continue}try{if(!p(ie)){if(k.debug)console.error(`Unsafe expression in :${se} binding: ${ie}`);B.clientReactive[se]=ie;continue}let oe=Object.keys(_),ae=new Set(["true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","if","else"]),le=new Set(Array.isArray(_.__stx_client_declared_names)?_.__stx_client_declared_names:[]);if(_e(ie).some((ye)=>!ae.has(ye)&&!oe.includes(ye)&&(!(ye in globalThis)||le.has(ye)))){B.clientReactive[se]=ie;continue}let $e=c(ie,oe)(...Object.values(_));if(B.serverDynamic[se]=$e,se!==Z.slice(1)&&B.serverDynamicNames)B.serverDynamicNames[se]=Z.slice(1)}catch{B.clientReactive[se]=ie}continue}if(typeof Q==="string"&&Q.includes("{{")&&Q.includes("}}")){let se=Bv(Q,T);if(se!==null){B.clientReactive[V(Z)]=se;continue}let ie=Q.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(ie)try{let oe=ie[1];if(p(oe)){let le=c(oe,Object.keys(_))(...Object.values(_));H(Z,le!=null?String(le):"")}else{if(k.debug)console.error(`Unsafe expression in ${Z}: ${oe}`);H(Z,Q)}}catch(oe){if(k.debug)console.error(`Error evaluating expression for ${Z}:`,oe);H(Z,Q)}else{let oe=Q,ae=/\{\{\s*([\s\S]+?)\s*\}\}/g,le;while((le=ae.exec(Q))!==null)try{let ce=le[1];if(!p(ce)){if(k.debug)console.error(`Unsafe expression in ${Z}: ${ce}`);continue}let $e=c(ce,Object.keys(_))(...Object.values(_));oe=oe.replace(le[0],String($e??""))}catch(ce){if(k.debug)console.error(`Error evaluating expression in ${Z}:`,ce)}H(Z,oe)}continue}H(Z,Q===Er?"true":ag(Q))}return B}function Bv(v,_){if(_.size===0)return null;let k=/\{\{\s*([\s\S]+?)\s*\}\}/g,R=[...v.matchAll(k)];if(!R.some((W)=>Mr(W[1],_)))return null;let T=v.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(T&&R.length===1)return T[1];let B="",z=0;for(let W of R)B+=v.slice(z,W.index).replace(/[`\\$]/g,(F)=>`\\${F}`),B+=`\${${W[1]}}`,z=W.index+W[0].length;return B+=v.slice(z).replace(/[`\\$]/g,(W)=>`\\${W}`),`\`${B}\``}var zv=[[/@if\s*\(/,"@endif"],[/@unless\s*\(/,"@endunless"]];function Wv(v,_,k){if(!v.includes("@"))return v;if(!zv.some(([T,B])=>T.test(v)&&v.includes(B)))return v;try{return dr(v,_,k)}catch{return v}}function Og(v){let _={},k=0,R=v.length;while(k<R){while(k<R&&/\s/.test(v[k]))k++;if(k>=R)break;let T="";while(k<R&&!/[\s=]/.test(v[k]))T+=v[k],k++;if(!T)break;while(k<R&&/\s/.test(v[k]))k++;if(k<R&&v[k]==="="){k++;while(k<R&&/\s/.test(v[k]))k++;let B="";if(k<R&&(v[k]==='"'||v[k]==="'")){let z=v[k];k++;while(k<R){let W=v[k];if(W==="\\"&&k+1<R){k++,B+=v[k],k++;continue}if(W===z){k++;break}B+=W,k++}}else if(v[k]==="{"){B=Kl(v,k),k+=B.length;let z=lg(B);if(z!==null){_[`:${T}`]=z;continue}}else while(k<R&&!/\s/.test(v[k]))B+=v[k],k++;_[T]=B}else _[T]=Er}return _}function Dg(v){return Object.entries(v).map(([_,k])=>k===Er?_:`${_}="${Fv(k)}"`).join(" ")}function Fv(v){return v.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Vv(v){let _=new Set,k=/<([A-Z][A-Za-z0-9]*|stx-[a-z0-9-]+)\b[^>]*>/g,R;while((R=k.exec(v))!==null){let T=R[1];if(Xs.isBuiltin(T))_.add(T)}return[..._].sort()}async function Cc(v,_,k,R,T){if(!/import\s/.test(v))return v;if(!_.__importedComponents)_.__importedComponents=new Map;let B=_.__importedComponents,z=Ig.dirname(k),W=[],F=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi;for(let q of v.matchAll(F)){let[Q,Z,se]=q,ie=/import\s+(?:(\{[^}]*\})|([A-Za-z_$][\w$]*))\s+from\s+['"]([^'"]+)['"]\s*;?\s*\n?/g,oe=se,ae,le=[];while((ae=ie.exec(se))!==null){let[ce,ge,$e,ye]=ae,ke=null,Re=null;if(ye.startsWith(".")||ye.startsWith("/")){let Pe=Ig.resolve(z,ye);if(Pe.endsWith(".stx"))Re=Pe;else{let Ee=`${Pe}.stx`;try{if(Ag.statSync(Ee).isFile())Re=Ee}catch{try{if(Ag.statSync(Pe).isDirectory())ke=Pe}catch{}}}}else ke=Do(ye,z);if(!ke&&!Re)continue;let Ae=!1,Ie=(Pe,Ee)=>{B.set(Pe,Ee),B.set(Pe.toLowerCase(),Ee);let Me=Pe.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();B.set(Me,Ee),T.add(Ee)};if($e&&Re)Ie($e,Re),Ae=!0;else if(ge){let Pe=ge.slice(1,-1).split(",").map((Me)=>Me.trim()).filter(Boolean).map((Me)=>{let je=Me.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(je)return{source:je[1],local:je[2]};return{source:Me,local:Me}}),Ee=ke?Po(ke):null;for(let{source:Me,local:je}of Pe){let Ne=null;if(Re)Ne=Re;else if(Ee)Ne=Ee.get(Me)??Ee.get(Me.toLowerCase())??Ee.get(Me.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase())??null;if(Ne)Ie(je,Ne),Ae=!0}}if(Ae)le.push({start:ae.index,end:ae.index+ce.length})}if(le.length===0)continue;for(let ce=le.length-1;ce>=0;ce--)oe=oe.slice(0,le[ce].start)+oe.slice(le[ce].end);W.push({start:q.index,end:q.index+Q.length,value:`<script${Z}>${oe}</script>`})}if(W.length===0)return v;let V=[],H=0;for(let q of W)V.push(v.slice(H,q.start),q.value),H=q.end;return V.push(v.slice(H)),V.join("")}async function Uv(v,_,k,R,T){let B=v;if(!_.__importedComponents)_.__importedComponents=new Map;let z=_.__importedComponents,W=/@import\s*\(\s*([^)]+)\s*\)/g,F;while((F=W.exec(B))!==null){let[V,H]=F,q=H.split(",").map((Q)=>Q.trim().replace(/^['"]|['"]$/g,"")).filter((Q)=>Q.length>0);for(let Q of q){let Z=Q.split("/"),ie=Z[Z.length-1].replace(/\.stx$/,""),oe=ie.includes("-")?ie.split("-").map((ce)=>ce.charAt(0).toUpperCase()+ce.slice(1)).join(""):ie.charAt(0).toUpperCase()+ie.slice(1),ae=null,le=Mo(Q,k,R);for(let ce of le)try{if(await Bun.file(ce).exists()){ae=ce;break}}catch{}if(ae){z.set(oe,ae),z.set(ie,ae),z.set(ie.toLowerCase(),ae);let ce=oe.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(z.set(ce,ae),T.add(ae),R.debug)console.log(`Imported component: ${oe} -> ${ae}`)}else if(R.debug)console.warn(`Could not resolve imported component: ${Q}`)}B=B.replace(V,""),W.lastIndex=0}return B}async function Hv(v,_,k,R,T){let B=v,z=R.componentsDir||"components";if(!_.__processedComponents)_.__processedComponents=new Set;let W=_.__processedComponents,F=/@component\s*\(/g,V;while((V=F.exec(B))!==null){let H=V.index,q=H+V[0].length-1,Q=1,Z=q+1;while(Z<B.length&&Q>0){if(B[Z]==="(")Q++;else if(B[Z]===")"){if(Q--,Q===0)break}Z++}if(Q!==0)break;let se=B.substring(q+1,Z),ie=Z+1,oe=se.match(/^\s*['"]([^'"]+)['"]/);if(!oe){F.lastIndex=0;continue}let ae=oe[1],le,ce=se.slice(oe[0].length),ge=ce.match(/^\s*,\s*/);if(ge)le=ce.slice(ge[0].length).trim();let $e={};if(le)try{$e=D(le,_)}catch(Pe){let Ee=Pe instanceof Error?Pe.message:String(Pe);B=B.replace(B.substring(H,ie),`[Error parsing component props: ${Ee}]`);continue}let ye="",ke=ie,Ae=B.substring(ie).match(/^([\s\S]*?)@endcomponent/);if(Ae)ye=Ae[1].trim(),ke=ie+Ae[0].length;let Ie=await Xe(ae,$e,ye,z,_,k,R,W,T);B=B.substring(0,H)+Ie+B.substring(ke),F.lastIndex=0}return B}async function qv(v,_,k,R,T){if(!v)return v;let B=v,z=R.componentsDir||"components";if(!_.__processedComponents)_.__processedComponents=new Set;let W=_.__processedComponents,F=Zv(B);if(F.size>0){let ie=Array.isArray(_.__stx_client_declared_names)?_.__stx_client_declared_names:[];_.__stx_client_declared_names=[...new Set([...ie,...F])]}let V=Sn(B);B=V.output;let H=yr(_);return B=await se(B,/[a-z][a-z0-9]*-[a-z0-9-]*/,!1),B=await se(B,/[A-Z][a-zA-Z0-9]*/,!0,ig(mo)),B=await se(B,/[a-z][a-z0-9]*/,!1,mo),B=V.restore(B),B;async function se(ie,oe,ae,le){if(!ie)return ie;let ce=ie,ge=og(ce,oe,le),$e=Xl(ce),ye=new Map;for(let Ae=ge.length-1;Ae>=0;Ae--){let Ie=ge[Ae],Pe=ae?sn(Ie.tagName):Ie.tagName,Ee=Og(Wv(Ie.attributes,_,k)),Me=$e.filter(({start:dt,end:St})=>Ie.startIndex>=dt&&Ie.startIndex<St),je=Me.length>0,Ne=new Set(H);for(let dt of Me)for(let St of dt.names)Ne.add(St);let De=Lv(Ee,_,R,je,Ne);if(typeof De.clientReactive.for==="string")for(let dt of ts(De.clientReactive.for))Ne.add(dt);let Le=Xs.getBuiltin(Ie.tagName),ct=Le?await tr(Ie.tagName,z,_,k,R):!1;if(Le&&!ct){let dt={context:_,filePath:k,options:R,dependencies:T},St=Le.render(De,Ie.content,dt);if(Object.keys(De.events).length>0){let lt=Dg(De.events);St=St.replace(/^(\s*<[a-zA-Z][a-zA-Z0-9-]*)/,`$1 ${lt}`)}if(Object.keys(De.clientReactive).length>0)St=Mg(St,De.clientReactive);ye.set(Ae,St);continue}if(!ae&&Ie.tagName.includes("-")&&!await tr(Pe,z,_,k,R))continue;let yt={};for(let[dt,St]of Object.entries(De.static))yt[dt]=St;for(let[dt,St]of Object.entries(De.serverDynamic))yt[dt]=St;let pt={declaredProps:new Set},gt=await Xe(Pe,yt,V.restore(Ie.content),z,_,k,R,W,T,[...Ne],pt,Ie.tagName);if(gt=Kv(gt,De,pt.declaredProps),Object.keys(De.events).length>0){let dt=uu(gt);if(dt){let St=Dg(De.events),lt=Object.keys(De.events).map((wt)=>wt.replace(/^@/,"").split(".")[0]).join(" ");gt=gt.substring(0,dt.insertPos)+` data-stx-parent-events="${lt}" ${St}`+gt.substring(dt.insertPos)}}if(Object.keys(De.clientReactive).length>0)gt=Mg(gt,De.clientReactive);ye.set(Ae,gt)}if(ye.size===0)return ce;let ke="",Re=0;for(let Ae=0;Ae<ge.length;Ae++){let Ie=ye.get(Ae);if(Ie===void 0)continue;ke+=ce.slice(Re,ge[Ae].startIndex),ke+=Ie,Re=ge[Ae].endIndex}return ke+=ce.slice(Re),ke}}function Mg(v,_){let k=new Set(["if","for"]),R=new Set(["show"]),T=Object.entries(_).filter(([H])=>!k.has(H)),B=T.filter(([H])=>!R.has(H)).map(([H])=>sn(H)).join(" "),z=v,W=T.length>0?uu(z):null;if(W){let H=T.map(([Q,Z])=>`:${sn(Q)}="${Z.replace(/"/g,"&quot;")}"`).join(" "),q=B?` data-stx-parent-bindings="${B}"`:"";z=z.substring(0,W.insertPos)+`${q} ${H}`+z.substring(W.insertPos)}let F=_.if;if(F)z=`<template :if="${F.replace(/"/g,"&quot;")}">${z}</template>`;let V=_.for;if(V)z=`<template :for="${V.replace(/"/g,"&quot;")}">${z}</template>`;return z}function Kv(v,_,k=new Set){let R=Xv(v);if(!R)return v;let T=v.slice(R.insertPos,R.tagEnd),B=/\bdata-native(?:\s|=)/i.test(T),z=new Set(Object.keys(Og(T))),W=new Set(["class","className"]);for(let H of Object.keys(_.static)){let q=_.staticNames[H]??H;if(z.has(q)||!B&&(k.has(H)||!_l(q)))W.add(H)}for(let H of Object.keys(_.serverDynamic)){let q=_.serverDynamicNames?.[H]??H;if(z.has(q)||!B&&(k.has(H)||!_l(q)))W.add(H)}let F=[];if(B){for(let[H,q]of Object.entries(_.static)){if(W.has(H)||q!==!0&&q!==Er)continue;W.add(H),F.push(`${zt(_.staticNames?.[H]??H)}="true"`)}for(let[H,q]of Object.entries(_.serverDynamic)){if(W.has(H)||q!==!0)continue;W.add(H),F.push(`${zt(_.serverDynamicNames?.[H]??H)}="true"`)}}let V=[...Cr(_,W),...Rr(_,W),...F];if(B){for(let[H,q]of Object.entries(_.serverDynamic)){if(W.has(H)||q!==!1)continue;let Q=_.serverDynamicNames?.[H]??H;V.push(`${zt(Q)}="false"`)}for(let[H,q]of Object.entries(_.serverDynamic)){if(W.has(H)||q===null||typeof q!=="object")continue;let Q=JSON.stringify(q);if(Q!==void 0){let Z=_.serverDynamicNames?.[H]??H;V.push(`${zt(Z)}="${zt(Q)}"`)}}}if(V.length===0)return v;return`${v.slice(0,R.insertPos)} ${V.join(" ")}${v.slice(R.insertPos)}`}function uu(v){let _=Ng(v,0);if(_)return _;let k=/<([a-zA-Z][a-zA-Z0-9-]*)\b[^>]*\bdata-stx-scope(?:\s|=|>)/i.exec(v);if(k)return{insertPos:k.index+1+k[1].length,tagEnd:jg(v,k.index+1+k[1].length)};return null}function Xv(v){let _=uu(v);if(!_)return null;let k=v.slice(_.insertPos,_.tagEnd);if(!/\bdata-stx-component-wrapper(?:\s|=|>|$)/i.test(k))return _;return Ng(v,_.tagEnd+1)}function Ng(v,_){let k=_;while(k<v.length){let R=v.slice(k),T=R.match(/^\s+/);if(T){k+=T[0].length;continue}if(R.startsWith("<!--")){let W=v.indexOf("-->",k+4);if(W===-1)return null;k=W+3;continue}let B=R.match(/^<(script|style)\b[^>]*>/i);if(B){let W=`</${B[1].toLowerCase()}>`,F=v.toLowerCase().indexOf(W,k+B[0].length);if(F===-1)return null;k=F+W.length;continue}let z=R.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(?:\s|>|\/)/);if(!z)return null;return{insertPos:k+1+z[1].length,tagEnd:jg(v,k+1+z[1].length)}}return null}function jg(v,_){let k="";for(let R=_;R<v.length;R++){let T=v[R];if(k){if(T==="\\")R++;else if(T===k)k=""}else if(T==='"'||T==="'")k=T;else if(T===">")return R}return v.length}function Zv(v){let _=new Set;for(let k of v.matchAll(/<script\b([^>]*)>([\s\S]*?)<\/script>/gi)){let R=k[1];if(!/\bclient\b/.test(R)||/\bserver\b/.test(R))continue;for(let T of Ql(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 B of(T[2]??"").split(",")){let z=B.replace(/^\s*type\s+/,"").split(/\s+as\s+/).pop().trim();if(/^[A-Za-z_$][\w$]*$/.test(z))_.add(z)}}}return _}async function hs(v,_,k,R,T){if(!Pg)ng(Xs),Pg=!0;let B=await Cc(v,_,k,R,T);B=await Uv(B,_,k,R,T),B=await Hv(B,_,k,R,T);let z=[];for(let W=0;W<3;W++){let F=z.length,V=On(B,ze,(q,Q)=>`\x00STX_COMPONENT_COMMENT_${F+Q}\x00`,`STX_COMPONENT_COMMENT:${F}`);z.push(...V.tokens);let H=B;if(B=await qv(V.output,_,k,R,T),B===H)break}if(z.length>0)B=B.replace(/\x00STX_COMPONENT_COMMENT_(\d+)\x00/g,(W,F)=>z[Number(F)]??"");if(R.debug){let W=Vv(B);if(W.length>0)console.warn(`[stx] ${k}: unresolved component tag(s) after render passes: ${W.join(", ")}. Check nested component output for malformed root tags or recursive component markup.`)}return B}function fu(v,_){let k=0;for(let R=_;R<v.length;R++){let T=v[R];if(T==="("||T==="["||T==="{")k++;else if(T===")"||T==="]"||T==="}")k--;else if(T===","&&k===0)return R}return-1}function Jv(v,_,k){let R=v,T=new RegExp(`${_.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),B=T.exec(R);while(B){let z=B.index,W=z+B[0].length-1,F=1,V=W+1;while(V<R.length&&F>0){if(R[V]==="(")F++;else if(R[V]===")")F--;V++}if(F!==0)break;let H=R.substring(W+1,V-1),q=`${k}(${H})`;R=R.substring(0,z)+q+R.substring(V),T.lastIndex=z+q.length,B=T.exec(R)}return R}function Yv(v){return/\b(state|derived|effect)\s*(?:<[^<>()]*>)?\s*\(/.test(v)}function Wg(v){let _=v,k=[],R=new Set,T=0,B=0,z=_.length,W=(q)=>{B++;while(B<z){if(_[B]==="\\"){B+=2;continue}if(_[B]===q){B++;return}B++}},F=()=>{B++;while(B<z){if(_[B]==="\\"){B+=2;continue}if(_[B]==="`"){B++;return}if(_[B]==="$"&&_[B+1]==="{"){B+=2;let q=1;while(B<z&&q>0)if(_[B]==="{")q++,B++;else if(_[B]==="}")q--,B++;else if(_[B]==="'"||_[B]==='"')W(_[B]);else if(_[B]==="`")F();else B++;continue}B++}},V=()=>{if(_[B]==="/"&&_[B+1]==="/"){while(B<z&&_[B]!==`
2473
+ `).entries())if(T.push(se),Q)B.set(T.length,Z===0?Q:{...Q,line:Q.line+Z,column:1,prefixLength:0})};if(_.globals!==!1){V("");let q=new Set([...k.flatMap((ie)=>ue(ie.code)),...k.flatMap((ie)=>jv(ie.code))]),Q=(ie)=>{if(!q.has(ie))V(`declare var ${ie}: any`)};if(_.runtimeGlobals!==!1){if(!q.has("window"))V("declare var window: any");for(let ie of y)Q(ie)}let Z=[...new Set([...Yl,...K,...$g])].filter((ie)=>_.runtimeGlobals!==!1||!y.includes(ie));if(_.contextScope==="global"){V("declare global {");for(let ie of Z)V(` var ${ie}: any`);V("}")}else{for(let ie of Yl)Q(ie);for(let ie of K)Q(ie);for(let ie of $g)Q(ie)}V(`declare var ${Jl}: any`);let se=new Set(k.flatMap((ie)=>ue(ie.code)));V(`type ${yg}<T> = T extends readonly (infer E)[] ? E : T extends Iterable<infer E2> ? E2 : any`);for(let ie of Ev(v)){if(se.has(ie.name))continue;let oe=ie.iterable&&se.has(ie.iterable)?`${yg}<typeof ${ie.iterable}>`:"any";V(`declare var ${ie.name}: ${oe}`)}}if(_.templateExpressions!==!1){if(z?.declarations)for(let Q of z.declarations.split(`
2474
+ `))V(Q);let q=kc(v).map((Q)=>{let Z=z?.events.get(Q.offset??-1);if(Z){Q.anchor=!0;let se=Q.code.trim(),ie=/^([\w$]+)\s*=\s*([^=][\s\S]*)$/.exec(se),oe=ie?`void ((${ie[2]}) satisfies __StxAssignedValue<typeof ${ie[1]}>)`:/^[\w$]+(?:\.[\w$]+)*$/.test(se)?`${se} satisfies (($event: ${Z}) => unknown)`:se,ae=`;(($event: ${Z}): void => { `;return{expression:Q,statement:{text:`${ae}${oe} });`,prefixLength:ae.length}}}return{expression:Q,statement:Ov(Q)}}).filter((Q)=>Q.statement!==null);if(q.push(...z?.checks||[]),q.length>0){let Q=wa(v),Z=Dv(k.map((ae)=>ae.code)),ie=[...new Set(k.flatMap((ae)=>ue(ae.code)))].filter((ae)=>/^[A-Z_$][\w$]*$/i.test(ae)),oe=0;if(ie.length>0){V(wv);for(let ae of ie)V(`type __StxT_${ae} = ${Eg}<typeof ${ae}>`);V(`;((${ie.map((ae)=>`${ae}: __StxT_${ae}`).join(", ")}) => {`),oe=1}for(let{expression:ae,statement:le}of q){let ce=" ".repeat(oe),ge=ae.offset===void 0?[]:Mv(Q,ae.offset),$e=ge.length>0?`${ge.map((ke)=>`if (${Tg(ke,Z)}) `).join("")}{ `:"",ye=ge.length>0?" }":"";V(ce+$e+le.text+ye,{line:ae.line,column:ae.column,expression:ae,prefixLength:le.prefixLength+ce.length+$e.length,guardPrefixLength:ce.length+$e.length})}if(oe>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(`
2475
+ `),lineMap:B,sourceLineCount:R.length,componentDependencies:z?.dependencies,referenced:H}}function pi(v,_){if(!v.expression)return!1;return v.inGuard===!0||_===2774}function fi(v,_,k){let R=v.lineMap.get(_);if(!R)return _<=v.sourceLineCount?{line:_,column:k}:null;let T=R.expression?.anchor?0:Math.max(0,k-1-(R.prefixLength??0));return{line:R.line,column:R.column+T,expression:R.expression,inGuard:k<=(R.guardPrefixLength??0)}}import Ag from"fs";import Ig from"path";var Pg=!1;function Lv(v,_,k,R=!1,T=new Set){let B={static:{},staticNames:{},serverDynamic:{},serverDynamicNames:{},clientReactive:{},events:{}},z=new Set(Array.isArray(_.__stx_client_signal_names)?_.__stx_client_signal_names:[]),W=(q)=>{if(z.size===0)return!1;let Q=s(q),Z=Q.match(/^\s*[!+~(-]*\s*([a-zA-Z_$][\w$]*)/)?.[1];if(Z&&z.has(Z))return!0;for(let se of z){let ie=se.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(new RegExp(`(?:^|[^\\w$.])${ie}\\s*\\(`).test(Q))return!0}return!1},F=new Set(qi),V=(q)=>{if(!q.includes("-")||q.startsWith("@")||q.startsWith(":")||q.startsWith("x-")||q.startsWith("__"))return q;if(q.startsWith("aria-")||q.startsWith("data-"))return q;return q.replace(/-([a-z0-9])/g,(Q,Z)=>Z.toUpperCase())},H=(q,Q)=>{let Z=V(q);if(B.static[Z]=Q,Z!==q)B.staticNames[Z]=q};for(let[q,Q]of Object.entries(v)){let Z=q.startsWith("x-")&&!F.has(q)&&!q.startsWith("x-bind:")&&!q.startsWith("x-on:")?`:${q.slice(2)}`:q;if(Z.startsWith("@")){B.events[Z]=Q;continue}if(Z.startsWith("__stx_")){let se=V(Z.slice(6));B.serverDynamic[se]=cg(Q,k);continue}if(Z.startsWith(":")){let se=V(Z.slice(1)),ie=Q===Er?se:Q;if(se==="if"||se==="for"||se==="show"){B.clientReactive[se]=ie;continue}if(R){B.clientReactive[se]=ie;continue}if(Mr(ie,T)){B.clientReactive[se]=ie;continue}if(W(ie)){B.clientReactive[se]=ie;continue}try{if(!p(ie)){if(k.debug)console.error(`Unsafe expression in :${se} binding: ${ie}`);B.clientReactive[se]=ie;continue}let oe=Object.keys(_),ae=new Set(["true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","if","else"]),le=new Set(Array.isArray(_.__stx_client_declared_names)?_.__stx_client_declared_names:[]);if(_e(ie).some((ye)=>!ae.has(ye)&&!oe.includes(ye)&&(!(ye in globalThis)||le.has(ye)))){B.clientReactive[se]=ie;continue}let $e=c(ie,oe)(...Object.values(_));if(B.serverDynamic[se]=$e,se!==Z.slice(1)&&B.serverDynamicNames)B.serverDynamicNames[se]=Z.slice(1)}catch{B.clientReactive[se]=ie}continue}if(typeof Q==="string"&&Q.includes("{{")&&Q.includes("}}")){let se=Bv(Q,T);if(se!==null){B.clientReactive[V(Z)]=se;continue}let ie=Q.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(ie)try{let oe=ie[1];if(p(oe)){let le=c(oe,Object.keys(_))(...Object.values(_));H(Z,le!=null?String(le):"")}else{if(k.debug)console.error(`Unsafe expression in ${Z}: ${oe}`);H(Z,Q)}}catch(oe){if(k.debug)console.error(`Error evaluating expression for ${Z}:`,oe);H(Z,Q)}else{let oe=Q,ae=/\{\{\s*([\s\S]+?)\s*\}\}/g,le;while((le=ae.exec(Q))!==null)try{let ce=le[1];if(!p(ce)){if(k.debug)console.error(`Unsafe expression in ${Z}: ${ce}`);continue}let $e=c(ce,Object.keys(_))(...Object.values(_));oe=oe.replace(le[0],String($e??""))}catch(ce){if(k.debug)console.error(`Error evaluating expression in ${Z}:`,ce)}H(Z,oe)}continue}H(Z,Q===Er?"true":ag(Q))}return B}function Bv(v,_){if(_.size===0)return null;let k=/\{\{\s*([\s\S]+?)\s*\}\}/g,R=[...v.matchAll(k)];if(!R.some((W)=>Mr(W[1],_)))return null;let T=v.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(T&&R.length===1)return T[1];let B="",z=0;for(let W of R)B+=v.slice(z,W.index).replace(/[`\\$]/g,(F)=>`\\${F}`),B+=`\${${W[1]}}`,z=W.index+W[0].length;return B+=v.slice(z).replace(/[`\\$]/g,(W)=>`\\${W}`),`\`${B}\``}var zv=[[/@if\s*\(/,"@endif"],[/@unless\s*\(/,"@endunless"]];function Wv(v,_,k){if(!v.includes("@"))return v;if(!zv.some(([T,B])=>T.test(v)&&v.includes(B)))return v;try{return ur(v,_,k)}catch{return v}}function Og(v){let _={},k=0,R=v.length;while(k<R){while(k<R&&/\s/.test(v[k]))k++;if(k>=R)break;let T="";while(k<R&&!/[\s=]/.test(v[k]))T+=v[k],k++;if(!T)break;while(k<R&&/\s/.test(v[k]))k++;if(k<R&&v[k]==="="){k++;while(k<R&&/\s/.test(v[k]))k++;let B="";if(k<R&&(v[k]==='"'||v[k]==="'")){let z=v[k];k++;while(k<R){let W=v[k];if(W==="\\"&&k+1<R){k++,B+=v[k],k++;continue}if(W===z){k++;break}B+=W,k++}}else if(v[k]==="{"){B=Kl(v,k),k+=B.length;let z=lg(B);if(z!==null){_[`:${T}`]=z;continue}}else while(k<R&&!/\s/.test(v[k]))B+=v[k],k++;_[T]=B}else _[T]=Er}return _}function Dg(v){return Object.entries(v).map(([_,k])=>k===Er?_:`${_}="${Fv(k)}"`).join(" ")}function Fv(v){return v.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Vv(v){let _=new Set,k=/<([A-Z][A-Za-z0-9]*|stx-[a-z0-9-]+)\b[^>]*>/g,R;while((R=k.exec(v))!==null){let T=R[1];if(Xs.isBuiltin(T))_.add(T)}return[..._].sort()}async function Cc(v,_,k,R,T){if(!/import\s/.test(v))return v;if(!_.__importedComponents)_.__importedComponents=new Map;let B=_.__importedComponents,z=Ig.dirname(k),W=[],F=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi;for(let q of v.matchAll(F)){let[Q,Z,se]=q,ie=/import\s+(?:(\{[^}]*\})|([A-Za-z_$][\w$]*))\s+from\s+['"]([^'"]+)['"]\s*;?\s*\n?/g,oe=se,ae,le=[];while((ae=ie.exec(se))!==null){let[ce,ge,$e,ye]=ae,ke=null,Re=null;if(ye.startsWith(".")||ye.startsWith("/")){let Pe=Ig.resolve(z,ye);if(Pe.endsWith(".stx"))Re=Pe;else{let Ee=`${Pe}.stx`;try{if(Ag.statSync(Ee).isFile())Re=Ee}catch{try{if(Ag.statSync(Pe).isDirectory())ke=Pe}catch{}}}}else ke=Do(ye,z);if(!ke&&!Re)continue;let Ae=!1,Ie=(Pe,Ee)=>{B.set(Pe,Ee),B.set(Pe.toLowerCase(),Ee);let Me=Pe.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();B.set(Me,Ee),T.add(Ee)};if($e&&Re)Ie($e,Re),Ae=!0;else if(ge){let Pe=ge.slice(1,-1).split(",").map((Me)=>Me.trim()).filter(Boolean).map((Me)=>{let je=Me.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(je)return{source:je[1],local:je[2]};return{source:Me,local:Me}}),Ee=ke?Po(ke):null;for(let{source:Me,local:je}of Pe){let Ne=null;if(Re)Ne=Re;else if(Ee)Ne=Ee.get(Me)??Ee.get(Me.toLowerCase())??Ee.get(Me.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase())??null;if(Ne)Ie(je,Ne),Ae=!0}}if(Ae)le.push({start:ae.index,end:ae.index+ce.length})}if(le.length===0)continue;for(let ce=le.length-1;ce>=0;ce--)oe=oe.slice(0,le[ce].start)+oe.slice(le[ce].end);W.push({start:q.index,end:q.index+Q.length,value:`<script${Z}>${oe}</script>`})}if(W.length===0)return v;let V=[],H=0;for(let q of W)V.push(v.slice(H,q.start),q.value),H=q.end;return V.push(v.slice(H)),V.join("")}async function Uv(v,_,k,R,T){let B=v;if(!_.__importedComponents)_.__importedComponents=new Map;let z=_.__importedComponents,W=/@import\s*\(\s*([^)]+)\s*\)/g,F;while((F=W.exec(B))!==null){let[V,H]=F,q=H.split(",").map((Q)=>Q.trim().replace(/^['"]|['"]$/g,"")).filter((Q)=>Q.length>0);for(let Q of q){let Z=Q.split("/"),ie=Z[Z.length-1].replace(/\.stx$/,""),oe=ie.includes("-")?ie.split("-").map((ce)=>ce.charAt(0).toUpperCase()+ce.slice(1)).join(""):ie.charAt(0).toUpperCase()+ie.slice(1),ae=null,le=Mo(Q,k,R);for(let ce of le)try{if(await Bun.file(ce).exists()){ae=ce;break}}catch{}if(ae){z.set(oe,ae),z.set(ie,ae),z.set(ie.toLowerCase(),ae);let ce=oe.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(z.set(ce,ae),T.add(ae),R.debug)console.log(`Imported component: ${oe} -> ${ae}`)}else if(R.debug)console.warn(`Could not resolve imported component: ${Q}`)}B=B.replace(V,""),W.lastIndex=0}return B}async function Hv(v,_,k,R,T){let B=v,z=R.componentsDir||"components";if(!_.__processedComponents)_.__processedComponents=new Set;let W=_.__processedComponents,F=/@component\s*\(/g,V;while((V=F.exec(B))!==null){let H=V.index,q=H+V[0].length-1,Q=1,Z=q+1;while(Z<B.length&&Q>0){if(B[Z]==="(")Q++;else if(B[Z]===")"){if(Q--,Q===0)break}Z++}if(Q!==0)break;let se=B.substring(q+1,Z),ie=Z+1,oe=se.match(/^\s*['"]([^'"]+)['"]/);if(!oe){F.lastIndex=0;continue}let ae=oe[1],le,ce=se.slice(oe[0].length),ge=ce.match(/^\s*,\s*/);if(ge)le=ce.slice(ge[0].length).trim();let $e={};if(le)try{$e=D(le,_)}catch(Pe){let Ee=Pe instanceof Error?Pe.message:String(Pe);B=B.replace(B.substring(H,ie),`[Error parsing component props: ${Ee}]`);continue}let ye="",ke=ie,Ae=B.substring(ie).match(/^([\s\S]*?)@endcomponent/);if(Ae)ye=Ae[1].trim(),ke=ie+Ae[0].length;let Ie=await Xe(ae,$e,ye,z,_,k,R,W,T);B=B.substring(0,H)+Ie+B.substring(ke),F.lastIndex=0}return B}async function qv(v,_,k,R,T){if(!v)return v;let B=v,z=R.componentsDir||"components";if(!_.__processedComponents)_.__processedComponents=new Set;let W=_.__processedComponents,F=Zv(B);if(F.size>0){let ie=Array.isArray(_.__stx_client_declared_names)?_.__stx_client_declared_names:[];_.__stx_client_declared_names=[...new Set([...ie,...F])]}let V=Sn(B);B=V.output;let H=yr(_);return B=await se(B,/[a-z][a-z0-9]*-[a-z0-9-]*/,!1),B=await se(B,/[A-Z][a-zA-Z0-9]*/,!0,ig(mo)),B=await se(B,/[a-z][a-z0-9]*/,!1,mo),B=V.restore(B),B;async function se(ie,oe,ae,le){if(!ie)return ie;let ce=ie,ge=og(ce,oe,le),$e=Xl(ce),ye=new Map;for(let Ae=ge.length-1;Ae>=0;Ae--){let Ie=ge[Ae],Pe=ae?sn(Ie.tagName):Ie.tagName,Ee=Og(Wv(Ie.attributes,_,k)),Me=$e.filter(({start:dt,end:St})=>Ie.startIndex>=dt&&Ie.startIndex<St),je=Me.length>0,Ne=new Set(H);for(let dt of Me)for(let St of dt.names)Ne.add(St);let De=Lv(Ee,_,R,je,Ne);if(typeof De.clientReactive.for==="string")for(let dt of ts(De.clientReactive.for))Ne.add(dt);let Le=Xs.getBuiltin(Ie.tagName),ct=Le?await nr(Ie.tagName,z,_,k,R):!1;if(Le&&!ct){let dt={context:_,filePath:k,options:R,dependencies:T},St=Le.render(De,Ie.content,dt);if(Object.keys(De.events).length>0){let lt=Dg(De.events);St=St.replace(/^(\s*<[a-zA-Z][a-zA-Z0-9-]*)/,`$1 ${lt}`)}if(Object.keys(De.clientReactive).length>0)St=Mg(St,De.clientReactive);ye.set(Ae,St);continue}if(!ae&&Ie.tagName.includes("-")&&!await nr(Pe,z,_,k,R))continue;let yt={};for(let[dt,St]of Object.entries(De.static))yt[dt]=St;for(let[dt,St]of Object.entries(De.serverDynamic))yt[dt]=St;let pt={declaredProps:new Set},gt=await Xe(Pe,yt,V.restore(Ie.content),z,_,k,R,W,T,[...Ne],pt,Ie.tagName);if(gt=Kv(gt,De,pt.declaredProps),Object.keys(De.events).length>0){let dt=eu(gt);if(dt){let St=Dg(De.events),lt=Object.keys(De.events).map((wt)=>wt.replace(/^@/,"").split(".")[0]).join(" ");gt=gt.substring(0,dt.insertPos)+` data-stx-parent-events="${lt}" ${St}`+gt.substring(dt.insertPos)}}if(Object.keys(De.clientReactive).length>0)gt=Mg(gt,De.clientReactive);ye.set(Ae,gt)}if(ye.size===0)return ce;let ke="",Re=0;for(let Ae=0;Ae<ge.length;Ae++){let Ie=ye.get(Ae);if(Ie===void 0)continue;ke+=ce.slice(Re,ge[Ae].startIndex),ke+=Ie,Re=ge[Ae].endIndex}return ke+=ce.slice(Re),ke}}function Mg(v,_){let k=new Set(["if","for"]),R=new Set(["show"]),T=Object.entries(_).filter(([H])=>!k.has(H)),B=T.filter(([H])=>!R.has(H)).map(([H])=>sn(H)).join(" "),z=v,W=T.length>0?eu(z):null;if(W){let H=T.map(([Q,Z])=>`:${sn(Q)}="${Z.replace(/"/g,"&quot;")}"`).join(" "),q=B?` data-stx-parent-bindings="${B}"`:"";z=z.substring(0,W.insertPos)+`${q} ${H}`+z.substring(W.insertPos)}let F=_.if;if(F)z=`<template :if="${F.replace(/"/g,"&quot;")}">${z}</template>`;let V=_.for;if(V)z=`<template :for="${V.replace(/"/g,"&quot;")}">${z}</template>`;return z}function Kv(v,_,k=new Set){let R=Xv(v);if(!R)return v;let T=v.slice(R.insertPos,R.tagEnd),B=/\bdata-native(?:\s|=)/i.test(T),z=new Set(Object.keys(Og(T))),W=new Set(["class","className"]);for(let H of Object.keys(_.static)){let q=_.staticNames[H]??H;if(z.has(q)||!B&&(k.has(H)||!_l(q)))W.add(H)}for(let H of Object.keys(_.serverDynamic)){let q=_.serverDynamicNames?.[H]??H;if(z.has(q)||!B&&(k.has(H)||!_l(q)))W.add(H)}let F=[];if(B){for(let[H,q]of Object.entries(_.static)){if(W.has(H)||q!==!0&&q!==Er)continue;W.add(H),F.push(`${zt(_.staticNames?.[H]??H)}="true"`)}for(let[H,q]of Object.entries(_.serverDynamic)){if(W.has(H)||q!==!0)continue;W.add(H),F.push(`${zt(_.serverDynamicNames?.[H]??H)}="true"`)}}let V=[...Cr(_,W),...Rr(_,W),...F];if(B){for(let[H,q]of Object.entries(_.serverDynamic)){if(W.has(H)||q!==!1)continue;let Q=_.serverDynamicNames?.[H]??H;V.push(`${zt(Q)}="false"`)}for(let[H,q]of Object.entries(_.serverDynamic)){if(W.has(H)||q===null||typeof q!=="object")continue;let Q=JSON.stringify(q);if(Q!==void 0){let Z=_.serverDynamicNames?.[H]??H;V.push(`${zt(Z)}="${zt(Q)}"`)}}}if(V.length===0)return v;return`${v.slice(0,R.insertPos)} ${V.join(" ")}${v.slice(R.insertPos)}`}function eu(v){let _=Ng(v,0);if(_)return _;let k=/<([a-zA-Z][a-zA-Z0-9-]*)\b[^>]*\bdata-stx-scope(?:\s|=|>)/i.exec(v);if(k)return{insertPos:k.index+1+k[1].length,tagEnd:jg(v,k.index+1+k[1].length)};return null}function Xv(v){let _=eu(v);if(!_)return null;let k=v.slice(_.insertPos,_.tagEnd);if(!/\bdata-stx-component-wrapper(?:\s|=|>|$)/i.test(k))return _;return Ng(v,_.tagEnd+1)}function Ng(v,_){let k=_;while(k<v.length){let R=v.slice(k),T=R.match(/^\s+/);if(T){k+=T[0].length;continue}if(R.startsWith("<!--")){let W=v.indexOf("-->",k+4);if(W===-1)return null;k=W+3;continue}let B=R.match(/^<(script|style)\b[^>]*>/i);if(B){let W=`</${B[1].toLowerCase()}>`,F=v.toLowerCase().indexOf(W,k+B[0].length);if(F===-1)return null;k=F+W.length;continue}let z=R.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(?:\s|>|\/)/);if(!z)return null;return{insertPos:k+1+z[1].length,tagEnd:jg(v,k+1+z[1].length)}}return null}function jg(v,_){let k="";for(let R=_;R<v.length;R++){let T=v[R];if(k){if(T==="\\")R++;else if(T===k)k=""}else if(T==='"'||T==="'")k=T;else if(T===">")return R}return v.length}function Zv(v){let _=new Set;for(let k of v.matchAll(/<script\b([^>]*)>([\s\S]*?)<\/script>/gi)){let R=k[1];if(!/\bclient\b/.test(R)||/\bserver\b/.test(R))continue;for(let T of Ql(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 B of(T[2]??"").split(",")){let z=B.replace(/^\s*type\s+/,"").split(/\s+as\s+/).pop().trim();if(/^[A-Za-z_$][\w$]*$/.test(z))_.add(z)}}}return _}async function hs(v,_,k,R,T){if(!Pg)ng(Xs),Pg=!0;let B=await Cc(v,_,k,R,T);B=await Uv(B,_,k,R,T),B=await Hv(B,_,k,R,T);let z=[];for(let W=0;W<3;W++){let F=z.length,V=On(B,ze,(q,Q)=>`\x00STX_COMPONENT_COMMENT_${F+Q}\x00`,`STX_COMPONENT_COMMENT:${F}`);z.push(...V.tokens);let H=B;if(B=await qv(V.output,_,k,R,T),B===H)break}if(z.length>0)B=B.replace(/\x00STX_COMPONENT_COMMENT_(\d+)\x00/g,(W,F)=>z[Number(F)]??"");if(R.debug){let W=Vv(B);if(W.length>0)console.warn(`[stx] ${k}: unresolved component tag(s) after render passes: ${W.join(", ")}. Check nested component output for malformed root tags or recursive component markup.`)}return B}function tu(v,_){let k=0;for(let R=_;R<v.length;R++){let T=v[R];if(T==="("||T==="["||T==="{")k++;else if(T===")"||T==="]"||T==="}")k--;else if(T===","&&k===0)return R}return-1}function Jv(v,_,k){let R=v,T=new RegExp(`${_.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),B=T.exec(R);while(B){let z=B.index,W=z+B[0].length-1,F=1,V=W+1;while(V<R.length&&F>0){if(R[V]==="(")F++;else if(R[V]===")")F--;V++}if(F!==0)break;let H=R.substring(W+1,V-1),q=`${k}(${H})`;R=R.substring(0,z)+q+R.substring(V),T.lastIndex=z+q.length,B=T.exec(R)}return R}function Yv(v){return/\b(state|derived|effect)\s*(?:<[^<>()]*>)?\s*\(/.test(v)}function Wg(v){let _=v,k=[],R=new Set,T=0,B=0,z=_.length,W=(q)=>{B++;while(B<z){if(_[B]==="\\"){B+=2;continue}if(_[B]===q){B++;return}B++}},F=()=>{B++;while(B<z){if(_[B]==="\\"){B+=2;continue}if(_[B]==="`"){B++;return}if(_[B]==="$"&&_[B+1]==="{"){B+=2;let q=1;while(B<z&&q>0)if(_[B]==="{")q++,B++;else if(_[B]==="}")q--,B++;else if(_[B]==="'"||_[B]==='"')W(_[B]);else if(_[B]==="`")F();else B++;continue}B++}},V=()=>{if(_[B]==="/"&&_[B+1]==="/"){while(B<z&&_[B]!==`
2476
2476
  `)B++;return!0}if(_[B]==="/"&&_[B+1]==="*"){B+=2;while(B<z-1&&!(_[B]==="*"&&_[B+1]==="/"))B++;return B+=2,!0}return!1},H=()=>{if(T!==0)return;let q=_.slice(B).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(q){let se=q[2];if(!R.has(se))k.push(se),R.add(se);return}let Q=_.slice(B).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(Q){let se=Q[1];if(!R.has(se))k.push(se),R.add(se);return}let Z=_.slice(B).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(Z){let se=Z[1];if(!R.has(se))k.push(se),R.add(se)}};while(B<z){if(V())continue;if(_[B]==="'"||_[B]==='"'){W(_[B]);continue}if(_[B]==="`"){F();continue}if(_[B]==="{"){T++,B++;continue}if(_[B]==="}"){T--,B++;continue}if(T===0&&/[a-z]/i.test(_[B])&&(B===0||/\s|[;{}()]/.test(_[B-1])))H();B++}return k.join(", ")}function Qv(v,_=""){let k=Wg(v).split(",").map((R)=>R.trim()).filter(Boolean);return`
2477
2477
  (function() {
2478
2478
  ${Nt("var",k)}
@@ -2511,16 +2511,16 @@ ${T}
2511
2511
  } finally {
2512
2512
  if (typeof window !== 'undefined') window.__STX_CURRENT_ELEMENT__ = __stxPrevEl;
2513
2513
  }
2514
- })();`}function rw(v,_){if(Bn(v)){let T=Bn(v).tag.match(/data-stx-scope="([^"]*)"/);if(T)return{html:v,mergedIntoExisting:T[1],stamped:!0,root:"body"};return{html:fs(v,(B,z)=>`<body${z} 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 R=k[2]+k[3],T=k[2].slice(1),B=R.match(/data-stx-scope="([^"]*)"/);if(B)return{html:v,mergedIntoExisting:B[1],stamped:!0,root:T};let z=k[1],W=k[2],F=k[3];return{html:`${z}${W} 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 sw=0;function Bg(v,_){let k=Wt.basename(v,".stx").replace(/[^a-zA-Z0-9]/g,"_"),R=_.__stx_scope_seq;return R?`stx_scope_${k}_${++R.n}_${R.key}`:`stx_scope_${k}_${++sw}`}var pu=new Set,gu=new Set;function iu(){pu.clear(),gu.clear()}var iw=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function Nc(v){let _=(W)=>W.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,_),R=[],T=0,B=/<(\/?)([A-Za-z][\w-]*)\b(?:[^<>"']|"[^"]*"|'[^']*')*?(\/?)>/g,z;while((z=B.exec(k))!==null){let W=z[1]==="/",F=z[2],V=z[3]==="/"||iw.has(F.toLowerCase());if(W){T=Math.max(0,T-1);continue}if(T===0)R.push(F);if(!V)T++}return R}function zg(v){return/\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/i.test(v)}var xe=new N(500),xi=new Set;function au(){xi.clear()}function ow(v){if(v.__onceStore instanceof Set)return v.__onceStore;return xi}async function ks(v,_,k,R,T,B=new Set){let z=R.partialsDir||Wt.join(Wt.dirname(k),"partials");if(z&&!Wt.isAbsolute(z))z=Wt.resolve(process.cwd(),z);let W=Jv(v,"@partial","@include"),F=ow(_);W=W.replace(/@once([\s\S]*?)@endonce/g,(ie,oe,ae)=>{let le=oe.trim(),ce=`${k}:${le}`;if(F.has(ce))return"";return F.add(ce),oe});{let ie=/@includeIf\s*\(/g,oe;while((oe=ie.exec(W))!==null){let ae=oe.index,le=ae+oe[0].length-1,ce=1,ge=le+1;while(ge<W.length&&ce>0){if(W[ge]==="(")ce++;else if(W[ge]===")")ce--;ge++}if(ce!==0)break;let $e=W.substring(le+1,ge-1),ye=$e.match(/^\s*['"]([^'"]+)['"]/);if(!ye){ie.lastIndex=ge;continue}let ke=ye[1],Re=V(ke,z,k),Ae="";if(Re&&await Bun.file(Re).exists())T.add(Re),Ae=`@include(${$e})`;W=W.substring(0,ae)+Ae+W.substring(ge),ie.lastIndex=0}}for(let[ie,oe]of[["@includeWhen",!1],["@includeUnless",!0]]){let ae=new RegExp(`${ie.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),le;while((le=ae.exec(W))!==null){let ce=le.index,ge=ce+le[0].length-1,$e=1,ye=ge+1;while(ye<W.length&&$e>0){if(W[ye]==="(")$e++;else if(W[ye]===")")$e--;ye++}if($e!==0)break;let ke=W.substring(ge+1,ye-1),Re=fu(ke,0);if(Re===-1){ae.lastIndex=ye;continue}let Ae=ke.substring(0,Re).trim(),Ie=ke.substring(Re+1).trim(),Pe=Ie.match(/^\s*['"]([^'"]+)['"]/);if(!Pe){ae.lastIndex=ye;continue}let Ee=Pe[1],Me=Ie.substring(Pe[0].length),je,Ne=fu(Me,0);if(Ne!==-1)je=Me.substring(Ne+1).trim();try{let De=`Boolean(${Ae})`,Le;if(p(De)){let pt=c(De,Object.keys(_));Le=Boolean(pt(...Object.values(_)))}else Le=Boolean(l(De,_));let ct=oe?!Le:Le,yt="";if(ct){let pt=V(Ee,z,k);if(pt&&await Bun.file(pt).exists())T.add(pt);yt=`@include('${Ee}'${je?`, ${je}`:""})`}W=W.substring(0,ce)+yt+W.substring(ye),ae.lastIndex=0}catch(De){let Le=De instanceof Error?De.message:String(De),ct=g("Include",`Error evaluating ${ie} condition: ${Le}`,k,v,ce);W=W.substring(0,ce)+ct+W.substring(ye),ae.lastIndex=0}}}{let ie=/@each\s*\(/g,oe;while((oe=ie.exec(W))!==null){let ae=oe.index,le=ae+oe[0].length-1,ce=1,ge=le+1;while(ge<W.length&&ce>0){if(W[ge]==="(")ce++;else if(W[ge]===")"){if(ce--,ce===0)break}ge++}if(ce!==0)break;let $e=W.substring(le+1,ge),ye=W.substring(ae,ge+1),ke=$e.match(/^\s*['"]([^'"]+)['"]\s*,\s*([^,]+)\s*,\s*['"]([^'"]+)['"](?:\s*,\s*['"]([^'"]+)['"])?\s*$/);if(!ke){ie.lastIndex=0,W=W.replace(ye,"");continue}let[,Re,Ae,Ie,Pe]=ke;try{let Ee,Me=Ae.trim();if(p(Me))Ee=c(Me,Object.keys(_))(...Object.values(_));else Ee=l(Me,_);let je="";if(Array.isArray(Ee)&&Ee.length>0)for(let Ne of Ee){let De={..._,[Ie]:Ne},Le=await Q(Re,De,v,ae);je+=Le}else if(Pe)je=await Q(Pe,{},v,ae);W=W.substring(0,ae)+je+W.substring(ge+1),ie.lastIndex=0}catch(Ee){let Me=Ee instanceof Error?Ee.message:String(Ee);W=W.substring(0,ae)+g("Each",`Error in @each: ${Me}`,k,v,ae)+W.substring(ge+1),ie.lastIndex=0}}}{let ie=/@includeFirst\s*\(/g,oe;while((oe=ie.exec(W))!==null){let ae=oe.index,le=ae+oe[0].length-1,ce=1,ge=le+1;while(ge<W.length&&ce>0){if(W[ge]==="(")ce++;else if(W[ge]===")"){if(ce--,ce===0)break}ge++}if(ce!==0)break;let $e=W.substring(le+1,ge),ye=W.substring(ae,ge+1),ke=$e.match(/^\s*(\[[^\]]+\])/);if(!ke){ie.lastIndex=0,W=W.replace(ye,"");continue}let Re=ke[1],Ae=$e.slice(ke[0].length),Ie,Pe=Ae.match(/^\s*,\s*\{/);if(Pe){Ae=Ae.slice(Pe[0].length-1);let je=1,Ne=1;while(Ne<Ae.length&&je>0){if(Ae[Ne]==="{")je++;else if(Ae[Ne]==="}"){if(je--,je===0)break}Ne++}Ie=Ae.substring(0,Ne+1),Ae=Ae.slice(Ne+1)}let Ee,Me=Ae.match(/^\s*,\s*['"]([^'"]*)['"]\s*$/);if(Me)Ee=Me[1];try{let je=JSON.parse(Re.replace(/'/g,'"')),Ne={};if(Ie)try{Ne=D(Ie,_)}catch(Le){let ct=Le instanceof Error?Le.message:String(Le);if(R.debug){let yt=g("Include",`Error parsing includeFirst variables: ${ct}`,k,v,ae,ye);W=W.replace(ye,()=>yt)}else W=W.replace(ye,()=>Ee||"");continue}let De=!1;for(let Le of je){let ct=V(Le,z,k);if(!ct)continue;if(await r(ct)){let yt=await Q(Le,Ne,v,ae);W=W.replace(ye,()=>yt),De=!0;break}}if(!De)if(Ee!==void 0)W=W.replace(ye,()=>Ee);else if(R.debug){let Le=g("Include",`None of the includeFirst paths exist: ${Re}`,k,v,ae,ye);W=W.replace(ye,()=>Le)}else W=W.replace(ye,"")}catch(je){let Ne=je instanceof Error?je.message:String(je),De=g("Include",`Error processing @includeFirst: ${Ne}`,k,v,ae,ye);W=W.replace(ye,()=>De)}ie.lastIndex=0}}function V(ie,oe,ae){try{let le=ie;if(!ie.endsWith(".stx"))le=`${ie}.stx`;let ce=Wt.resolve(oe),ge=Wt.resolve(Wt.dirname(ae)),$e;if(!le.startsWith("./")&&!le.startsWith("../")){for(let Pe of R._layerPartialDirs??[]){let Ee=Wt.resolve(Pe,le);if(Ee.startsWith(`${Wt.resolve(Pe)}${Wt.sep}`)&&Gv(Ee))return Ee}$e=Wt.resolve(oe,le)}else $e=Wt.resolve(ge,le);let ye=Wt.normalize($e),ke=ye.startsWith(ce+Wt.sep)||ye===ce,Re=ye.startsWith(ge+Wt.sep)||ye===ge,Ae=!1,Ie=Wt.dirname(ge);if(ye.startsWith(Ie+Wt.sep)){if(!Wt.relative(Ie,ye).split(Wt.sep).some((je)=>je.startsWith(".")&&je!=="."&&je!==".."))Ae=!0}if(!ke&&!Re&&!Ae)return console.error(`Security: Path traversal attempt blocked for include path: ${ie}`),console.error(` Resolved to: ${ye}`),console.error(` Allowed dirs: ${ce}, ${ge}`),null;return ye}catch(le){return console.error(`Error resolving path ${ie}: ${le}`),null}}let H=Wt.resolve(k);B.add(H);function q(ie,oe,ae,le){return R.onIncludeError?.({includePath:ie,templatePath:k,message:oe,partialsDir:z}),g("Include",oe,k,ae,le)}async function Q(ie,oe={},ae,le){let ce=V(ie,z,k);if(!ce)return q(ie,`Could not resolve path for include: ${ie}`,ae,le);let ge=Wt.resolve(ce);if(B.has(ge)){let $e=[...B,ge].map((ye)=>Wt.basename(ye)).join(" -> ");return q(ie,`Circular include detected: ${$e}`,ae,le)}try{T.add(ce);let $e;if(!$e)try{$e=await Bun.file(ce).text()}catch(lt){let wt=lt instanceof Error?lt.message:String(lt);return q(ie,`Error loading include file ${ie}: ${wt}`,ae,le)}if($e)$e=$e.replace(/\{\{--[\s\S]*?--\}\}/g,"");if($e&&$e.includes("@stream")){let{processStreamDirectives:lt}=await import("./chunk-1cat8kdj.js");$e=lt($e,_)}if($e&&(R.debug||!E()&&!En()))try{let{warnUnbalancedTags:lt}=await import("./chunk-v9jd283e.js");lt($e,ce)}catch{}try{let{processESImports:lt}=await import("./chunk-sp46w7z9.js");$e=await lt($e,_,ce,R,T)}catch(lt){if(R.debug)console.warn(`[stx] partial ES import extraction skipped for ${ce}:`,lt instanceof Error?lt.message:lt)}let ye=$e,ke=te(ye);if(ke)ye=ke.content.trim();let Ae=$e.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),Ie="";if(Ae)Ie=`<style${Ae[1]}>${Ae[2]}</style>`;let Pe=[];ye=ye.replace(/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,(lt,wt,ft)=>{if(!zg(wt))return"";return Pe.push({attrs:wt,body:ft}),`__STX_DATA_BLOCK_${Pe.length-1}__`}),ye=ye.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let Ee={..._};Ee.__stx_signals_gate=ve($e,ce);for(let[lt,wt]of Object.entries(oe))Ee[lt]=wt;let Me=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,je=[...$e.matchAll(Me)].sort((lt,wt)=>{let ft=(lt[1]||"").includes("server"),Ft=(wt[1]||"").includes("server");return Number(Ft)-Number(ft)}),Ne="",De=null,Le=!1,ct=!1;for(let lt of je){let wt=lt[1]||"",ft=lt[2]||"";if(zg(wt))continue;let Ft=wt.includes("server"),Mn=Ge(wt);if(!Ft&&ft.trim()){let{interpolateScriptExpressions:it}=await import("./chunk-mqy7g74k.js");ft=it(ft,Ee,ie)}let Tn="";try{let{extractAndStripCssImports:it,renderVendorStyleTags:mt}=await import("./chunk-g2fw68zm.js"),kt=it(ft,{filePath:ce,projectRoot:process.cwd()});ft=kt.code,Tn=mt(kt.styles)}catch(it){if(R.debug)console.warn(`[stx] vendor-css extractor skipped for ${ce}:`,it instanceof Error?it.message:it)}if(Mn&&ft.trim())ft=Ke(ft);if(!Ft){try{let{injectBrowserCoreAutoImports:mt}=await import("./chunk-g2fw68zm.js");ft=mt(ft).code;let{hasUserImports:kt,bundleClientScript:Vt}=await import("./chunk-zv288w4e.js");if(kt(ft))ft=await Vt(ft,ce,{projectRoot:process.cwd()})}catch(mt){if(R.debug)console.warn(`[stx] bundler skipped for ${ce}:`,mt instanceof Error?mt.message:mt)}let{stripStxRuntimeImports:it}=await import("./chunk-ne03tfje.js");ft=it(ft)}let ut=Yv(ft);if(!Ft){let{extractBridgeData:it,generateServerDataBridge:mt}=await import("./chunk-g2fw68zm.js"),kt=mt(ft,it(Ee));if(kt)ft=`${kt}
2514
+ })();`}function rw(v,_){if(Bn(v)){let T=Bn(v).tag.match(/data-stx-scope="([^"]*)"/);if(T)return{html:v,mergedIntoExisting:T[1],stamped:!0,root:"body"};return{html:fs(v,(B,z)=>`<body${z} 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 R=k[2]+k[3],T=k[2].slice(1),B=R.match(/data-stx-scope="([^"]*)"/);if(B)return{html:v,mergedIntoExisting:B[1],stamped:!0,root:T};let z=k[1],W=k[2],F=k[3];return{html:`${z}${W} 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 sw=0;function Bg(v,_){let k=Wt.basename(v,".stx").replace(/[^a-zA-Z0-9]/g,"_"),R=_.__stx_scope_seq;return R?`stx_scope_${k}_${++R.n}_${R.key}`:`stx_scope_${k}_${++sw}`}var nu=new Set,ru=new Set;function id(){nu.clear(),ru.clear()}var iw=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function Nc(v){let _=(W)=>W.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,_),R=[],T=0,B=/<(\/?)([A-Za-z][\w-]*)\b(?:[^<>"']|"[^"]*"|'[^']*')*?(\/?)>/g,z;while((z=B.exec(k))!==null){let W=z[1]==="/",F=z[2],V=z[3]==="/"||iw.has(F.toLowerCase());if(W){T=Math.max(0,T-1);continue}if(T===0)R.push(F);if(!V)T++}return R}function zg(v){return/\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/i.test(v)}var xe=new N(500),xi=new Set;function ad(){xi.clear()}function ow(v){if(v.__onceStore instanceof Set)return v.__onceStore;return xi}async function ks(v,_,k,R,T,B=new Set){let z=R.partialsDir||Wt.join(Wt.dirname(k),"partials");if(z&&!Wt.isAbsolute(z))z=Wt.resolve(process.cwd(),z);let W=Jv(v,"@partial","@include"),F=ow(_);W=W.replace(/@once([\s\S]*?)@endonce/g,(ie,oe,ae)=>{let le=oe.trim(),ce=`${k}:${le}`;if(F.has(ce))return"";return F.add(ce),oe});{let ie=/@includeIf\s*\(/g,oe;while((oe=ie.exec(W))!==null){let ae=oe.index,le=ae+oe[0].length-1,ce=1,ge=le+1;while(ge<W.length&&ce>0){if(W[ge]==="(")ce++;else if(W[ge]===")")ce--;ge++}if(ce!==0)break;let $e=W.substring(le+1,ge-1),ye=$e.match(/^\s*['"]([^'"]+)['"]/);if(!ye){ie.lastIndex=ge;continue}let ke=ye[1],Re=V(ke,z,k),Ae="";if(Re&&await Bun.file(Re).exists())T.add(Re),Ae=`@include(${$e})`;W=W.substring(0,ae)+Ae+W.substring(ge),ie.lastIndex=0}}for(let[ie,oe]of[["@includeWhen",!1],["@includeUnless",!0]]){let ae=new RegExp(`${ie.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),le;while((le=ae.exec(W))!==null){let ce=le.index,ge=ce+le[0].length-1,$e=1,ye=ge+1;while(ye<W.length&&$e>0){if(W[ye]==="(")$e++;else if(W[ye]===")")$e--;ye++}if($e!==0)break;let ke=W.substring(ge+1,ye-1),Re=tu(ke,0);if(Re===-1){ae.lastIndex=ye;continue}let Ae=ke.substring(0,Re).trim(),Ie=ke.substring(Re+1).trim(),Pe=Ie.match(/^\s*['"]([^'"]+)['"]/);if(!Pe){ae.lastIndex=ye;continue}let Ee=Pe[1],Me=Ie.substring(Pe[0].length),je,Ne=tu(Me,0);if(Ne!==-1)je=Me.substring(Ne+1).trim();try{let De=`Boolean(${Ae})`,Le;if(p(De)){let pt=c(De,Object.keys(_));Le=Boolean(pt(...Object.values(_)))}else Le=Boolean(l(De,_));let ct=oe?!Le:Le,yt="";if(ct){let pt=V(Ee,z,k);if(pt&&await Bun.file(pt).exists())T.add(pt);yt=`@include('${Ee}'${je?`, ${je}`:""})`}W=W.substring(0,ce)+yt+W.substring(ye),ae.lastIndex=0}catch(De){let Le=De instanceof Error?De.message:String(De),ct=g("Include",`Error evaluating ${ie} condition: ${Le}`,k,v,ce);W=W.substring(0,ce)+ct+W.substring(ye),ae.lastIndex=0}}}{let ie=/@each\s*\(/g,oe;while((oe=ie.exec(W))!==null){let ae=oe.index,le=ae+oe[0].length-1,ce=1,ge=le+1;while(ge<W.length&&ce>0){if(W[ge]==="(")ce++;else if(W[ge]===")"){if(ce--,ce===0)break}ge++}if(ce!==0)break;let $e=W.substring(le+1,ge),ye=W.substring(ae,ge+1),ke=$e.match(/^\s*['"]([^'"]+)['"]\s*,\s*([^,]+)\s*,\s*['"]([^'"]+)['"](?:\s*,\s*['"]([^'"]+)['"])?\s*$/);if(!ke){ie.lastIndex=0,W=W.replace(ye,"");continue}let[,Re,Ae,Ie,Pe]=ke;try{let Ee,Me=Ae.trim();if(p(Me))Ee=c(Me,Object.keys(_))(...Object.values(_));else Ee=l(Me,_);let je="";if(Array.isArray(Ee)&&Ee.length>0)for(let Ne of Ee){let De={..._,[Ie]:Ne},Le=await Q(Re,De,v,ae);je+=Le}else if(Pe)je=await Q(Pe,{},v,ae);W=W.substring(0,ae)+je+W.substring(ge+1),ie.lastIndex=0}catch(Ee){let Me=Ee instanceof Error?Ee.message:String(Ee);W=W.substring(0,ae)+g("Each",`Error in @each: ${Me}`,k,v,ae)+W.substring(ge+1),ie.lastIndex=0}}}{let ie=/@includeFirst\s*\(/g,oe;while((oe=ie.exec(W))!==null){let ae=oe.index,le=ae+oe[0].length-1,ce=1,ge=le+1;while(ge<W.length&&ce>0){if(W[ge]==="(")ce++;else if(W[ge]===")"){if(ce--,ce===0)break}ge++}if(ce!==0)break;let $e=W.substring(le+1,ge),ye=W.substring(ae,ge+1),ke=$e.match(/^\s*(\[[^\]]+\])/);if(!ke){ie.lastIndex=0,W=W.replace(ye,"");continue}let Re=ke[1],Ae=$e.slice(ke[0].length),Ie,Pe=Ae.match(/^\s*,\s*\{/);if(Pe){Ae=Ae.slice(Pe[0].length-1);let je=1,Ne=1;while(Ne<Ae.length&&je>0){if(Ae[Ne]==="{")je++;else if(Ae[Ne]==="}"){if(je--,je===0)break}Ne++}Ie=Ae.substring(0,Ne+1),Ae=Ae.slice(Ne+1)}let Ee,Me=Ae.match(/^\s*,\s*['"]([^'"]*)['"]\s*$/);if(Me)Ee=Me[1];try{let je=JSON.parse(Re.replace(/'/g,'"')),Ne={};if(Ie)try{Ne=D(Ie,_)}catch(Le){let ct=Le instanceof Error?Le.message:String(Le);if(R.debug){let yt=g("Include",`Error parsing includeFirst variables: ${ct}`,k,v,ae,ye);W=W.replace(ye,()=>yt)}else W=W.replace(ye,()=>Ee||"");continue}let De=!1;for(let Le of je){let ct=V(Le,z,k);if(!ct)continue;if(await r(ct)){let yt=await Q(Le,Ne,v,ae);W=W.replace(ye,()=>yt),De=!0;break}}if(!De)if(Ee!==void 0)W=W.replace(ye,()=>Ee);else if(R.debug){let Le=g("Include",`None of the includeFirst paths exist: ${Re}`,k,v,ae,ye);W=W.replace(ye,()=>Le)}else W=W.replace(ye,"")}catch(je){let Ne=je instanceof Error?je.message:String(je),De=g("Include",`Error processing @includeFirst: ${Ne}`,k,v,ae,ye);W=W.replace(ye,()=>De)}ie.lastIndex=0}}function V(ie,oe,ae){try{let le=ie;if(!ie.endsWith(".stx"))le=`${ie}.stx`;let ce=Wt.resolve(oe),ge=Wt.resolve(Wt.dirname(ae)),$e;if(!le.startsWith("./")&&!le.startsWith("../")){for(let Pe of R._layerPartialDirs??[]){let Ee=Wt.resolve(Pe,le);if(Ee.startsWith(`${Wt.resolve(Pe)}${Wt.sep}`)&&Gv(Ee))return Ee}$e=Wt.resolve(oe,le)}else $e=Wt.resolve(ge,le);let ye=Wt.normalize($e),ke=ye.startsWith(ce+Wt.sep)||ye===ce,Re=ye.startsWith(ge+Wt.sep)||ye===ge,Ae=!1,Ie=Wt.dirname(ge);if(ye.startsWith(Ie+Wt.sep)){if(!Wt.relative(Ie,ye).split(Wt.sep).some((je)=>je.startsWith(".")&&je!=="."&&je!==".."))Ae=!0}if(!ke&&!Re&&!Ae)return console.error(`Security: Path traversal attempt blocked for include path: ${ie}`),console.error(` Resolved to: ${ye}`),console.error(` Allowed dirs: ${ce}, ${ge}`),null;return ye}catch(le){return console.error(`Error resolving path ${ie}: ${le}`),null}}let H=Wt.resolve(k);B.add(H);function q(ie,oe,ae,le){return R.onIncludeError?.({includePath:ie,templatePath:k,message:oe,partialsDir:z}),g("Include",oe,k,ae,le)}async function Q(ie,oe={},ae,le){let ce=V(ie,z,k);if(!ce)return q(ie,`Could not resolve path for include: ${ie}`,ae,le);let ge=Wt.resolve(ce);if(B.has(ge)){let $e=[...B,ge].map((ye)=>Wt.basename(ye)).join(" -> ");return q(ie,`Circular include detected: ${$e}`,ae,le)}try{T.add(ce);let $e;if(!$e)try{$e=await Bun.file(ce).text()}catch(lt){let wt=lt instanceof Error?lt.message:String(lt);return q(ie,`Error loading include file ${ie}: ${wt}`,ae,le)}if($e)$e=$e.replace(/\{\{--[\s\S]*?--\}\}/g,"");if($e&&$e.includes("@stream")){let{processStreamDirectives:lt}=await import("./chunk-webrqm20.js");$e=lt($e,_)}if($e&&(R.debug||!E()&&!En()))try{let{warnUnbalancedTags:lt}=await import("./chunk-v9jd283e.js");lt($e,ce)}catch{}try{let{processESImports:lt}=await import("./chunk-5r9k9s3m.js");$e=await lt($e,_,ce,R,T)}catch(lt){if(R.debug)console.warn(`[stx] partial ES import extraction skipped for ${ce}:`,lt instanceof Error?lt.message:lt)}let ye=$e,ke=te(ye);if(ke)ye=ke.content.trim();let Ae=$e.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),Ie="";if(Ae)Ie=`<style${Ae[1]}>${Ae[2]}</style>`;let Pe=[];ye=ye.replace(/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,(lt,wt,ft)=>{if(!zg(wt))return"";return Pe.push({attrs:wt,body:ft}),`__STX_DATA_BLOCK_${Pe.length-1}__`}),ye=ye.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let Ee={..._};Ee.__stx_signals_gate=we($e,ce);for(let[lt,wt]of Object.entries(oe))Ee[lt]=wt;let Me=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,je=[...$e.matchAll(Me)].sort((lt,wt)=>{let ft=(lt[1]||"").includes("server"),Ft=(wt[1]||"").includes("server");return Number(Ft)-Number(ft)}),Ne="",De=null,Le=!1,ct=!1;for(let lt of je){let wt=lt[1]||"",ft=lt[2]||"";if(zg(wt))continue;let Ft=wt.includes("server"),Mn=Ge(wt);if(!Ft&&ft.trim()){let{interpolateScriptExpressions:it}=await import("./chunk-wngqr949.js");ft=it(ft,Ee,ie)}let Tn="";try{let{extractAndStripCssImports:it,renderVendorStyleTags:mt}=await import("./chunk-agfhb2qd.js"),kt=it(ft,{filePath:ce,projectRoot:process.cwd()});ft=kt.code,Tn=mt(kt.styles)}catch(it){if(R.debug)console.warn(`[stx] vendor-css extractor skipped for ${ce}:`,it instanceof Error?it.message:it)}if(Mn&&ft.trim())ft=Ke(ft);if(!Ft){try{let{injectBrowserCoreAutoImports:mt}=await import("./chunk-agfhb2qd.js");ft=mt(ft).code;let{hasUserImports:kt,bundleClientScript:Vt}=await import("./chunk-cxqrwvc5.js");if(kt(ft))ft=await Vt(ft,ce,{projectRoot:process.cwd()})}catch(mt){if(R.debug)console.warn(`[stx] bundler skipped for ${ce}:`,mt instanceof Error?mt.message:mt)}let{stripStxRuntimeImports:it}=await import("./chunk-xyzy84x0.js");ft=it(ft)}let ut=Yv(ft);if(!Ft){let{extractBridgeData:it,generateServerDataBridge:mt}=await import("./chunk-agfhb2qd.js"),kt=mt(ft,it(Ee));if(kt)ft=`${kt}
2515
2515
  ${ft}`}if(ut&&!Ft){Le=!0,De=Bg(ce,_);let it=O(ft),mt=Lg(it,De);Ne+=`${Tn}<script data-stx-scoped data-stx-run="always" data-stx-owner="${De}">${mt}</script>
2516
- `;continue}if(Ft)try{let{extractVariables:it}=await import("./chunk-k7jqkt93.js");await it(ft,Ee,ce)}catch(it){if(R.debug)console.warn(`Warning: Could not extract variables from server script in ${ce}:`,it)}if(!Ft&&!ut){let it=wt.replace(/\bclient\b/i,"").trim();De=Bg(ce,_);let mt=O(ft),kt=Lg(mt,De);if(/__scopeRegistration\["(?!__stx)[^"]+"\]\s*=/.test(kt))ct=!0;Ne+=`${Tn}<script data-stx-scoped data-stx-run="always" data-stx-owner="${De}"${it?` ${it}`:""}>${kt}</script>
2517
- `}}if(Pe.length>0){let{interpolateScriptExpressions:lt}=await import("./chunk-mqy7g74k.js");ye=ye.replace(/__STX_DATA_BLOCK_(\d+)__/g,(wt,ft)=>{let Ft=Pe[Number(ft)];return`<script${Ft.attrs}>${lt(Ft.body,Ee,ie)}</script>`})}if(De){let lt=rw(ye,De);if(ye=lt.html,lt.mergedIntoExisting){let ft=De,Ft=lt.mergedIntoExisting;Ne=Ne.split(`'${ft}'`).join(`'${Ft}'`).split(`"${ft}"`).join(`"${Ft}"`),De=Ft}else if(!lt.stamped&&Le&&!pu.has(ce))pu.add(ce),console.warn(`[stx] ${Wt.relative(process.cwd(),ce)} 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(lt.stamped&&lt.root!=="body"&&(Le||ct)&&!gu.has(ce)){let ft=Nc(ye);if(ft.length>1)gu.add(ce),console.warn(`[stx] ${Wt.relative(process.cwd(),ce)} declares ${Le?"signals":"bindings"} and has ${ft.length} top-level elements (${ft.map((Ft)=>`<${Ft}>`).join(", ")}). Only the first is scoped, so bindings in the others cannot see what this partial's script declares. Wrap the partial's markup in a single root element.`)}let wt=lt.stamped&&lt.root!==null&&fn(lt.root);Ne=tw(Ne,wt?De:null)}if(ye.includes("@include")||ye.includes("@partial"))ye=await ks(ye,Ee,ce,R,T,B);let{processLoops:yt,reportDeferredLoopWarnings:pt}=await import("./chunk-z1r4tdqy.js"),st=yt(ye,Ee,ce,void 0,!0);st=dr(st,Ee,ce),st=pt(st);let{processMetaDirectives:gt,processSeoDirective:dt,processStructuredData:St}=await import("./chunk-ccxs40xy.js");if(st=gt(st,Ee,ce,R),st=St(st,Ee,ce),st=dt(st,Ee,ce,R),st=X(st,Ee,ce),Ie)st+=`
2516
+ `;continue}if(Ft)try{let{extractVariables:it}=await import("./chunk-qb2j34sp.js");await it(ft,Ee,ce)}catch(it){if(R.debug)console.warn(`Warning: Could not extract variables from server script in ${ce}:`,it)}if(!Ft&&!ut){let it=wt.replace(/\bclient\b/i,"").trim();De=Bg(ce,_);let mt=O(ft),kt=Lg(mt,De);if(/__scopeRegistration\["(?!__stx)[^"]+"\]\s*=/.test(kt))ct=!0;Ne+=`${Tn}<script data-stx-scoped data-stx-run="always" data-stx-owner="${De}"${it?` ${it}`:""}>${kt}</script>
2517
+ `}}if(Pe.length>0){let{interpolateScriptExpressions:lt}=await import("./chunk-wngqr949.js");ye=ye.replace(/__STX_DATA_BLOCK_(\d+)__/g,(wt,ft)=>{let Ft=Pe[Number(ft)];return`<script${Ft.attrs}>${lt(Ft.body,Ee,ie)}</script>`})}if(De){let lt=rw(ye,De);if(ye=lt.html,lt.mergedIntoExisting){let ft=De,Ft=lt.mergedIntoExisting;Ne=Ne.split(`'${ft}'`).join(`'${Ft}'`).split(`"${ft}"`).join(`"${Ft}"`),De=Ft}else if(!lt.stamped&&Le&&!nu.has(ce))nu.add(ce),console.warn(`[stx] ${Wt.relative(process.cwd(),ce)} 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(lt.stamped&&lt.root!=="body"&&(Le||ct)&&!ru.has(ce)){let ft=Nc(ye);if(ft.length>1)ru.add(ce),console.warn(`[stx] ${Wt.relative(process.cwd(),ce)} declares ${Le?"signals":"bindings"} and has ${ft.length} top-level elements (${ft.map((Ft)=>`<${Ft}>`).join(", ")}). Only the first is scoped, so bindings in the others cannot see what this partial's script declares. Wrap the partial's markup in a single root element.`)}let wt=lt.stamped&&lt.root!==null&&fn(lt.root);Ne=tw(Ne,wt?De:null)}if(ye.includes("@include")||ye.includes("@partial"))ye=await ks(ye,Ee,ce,R,T,B);let{processLoops:yt,reportDeferredLoopWarnings:pt}=await import("./chunk-d99kfx3k.js"),st=yt(ye,Ee,ce,void 0,!0);st=ur(st,Ee,ce),st=pt(st);let{processMetaDirectives:gt,processSeoDirective:dt,processStructuredData:St}=await import("./chunk-qknfceta.js");if(st=gt(st,Ee,ce,R),st=St(st,Ee,ce),st=dt(st,Ee,ce,R),st=X(st,Ee,ce),Ie)st+=`
2518
2518
  `+Ie;if(Ne)st+=`
2519
- `+Ne;return st}catch($e){let ye=$e instanceof Error?$e.message:String($e);return q(ie,`Error processing include ${ie}: ${ye}`,ae,le)}}let Z=/@include\s*\(/g,se;while((se=Z.exec(W))!==null){let ie=se.index,oe=ie+se[0].length-1,ae=1,le=oe+1;while(le<W.length&&ae>0){if(W[le]==="(")ae++;else if(W[le]===")")ae--;le++}if(ae!==0)break;let ce=W.substring(ie,le),ge=W.substring(oe+1,le-1),$e=ge.match(/^\s*['"]([^'"]+)['"]/);if(!$e){Z.lastIndex=le;continue}let ye=$e[1],ke,Re=ge.substring($e[0].length),Ae=fu(Re,0);if(Ae!==-1)ke=Re.substring(Ae+1).trim();let Ie={};if(ke)try{Ie=D(ke,_)}catch(Ee){let Me=Ee instanceof Error?Ee.message:String(Ee);W=W.replace(ce,g("Include",`Error parsing include variables for ${ye}: ${Me}`,k,v,ie)),Z.lastIndex=0;continue}let Pe=await Q(ye,Ie,v,ie);W=W.substring(0,ie)+Pe+W.substring(le),Z.lastIndex=0}return W}function Cs(v,_){let k=v;function R(T,B,z,W){let F=T,V=!0;while(V){V=!1;let H=new RegExp(`@${B}\\(['"]([^'"]+)['"]\\)`),q=F.match(H);if(!q||q.index===void 0)break;let Q=q.index,Z=q[1],se=Q+q[0].length,ie=new RegExp(`@${B}\\(`),oe=new RegExp(`@${z}(?![a-z])`),ae=1,le=se,ce=-1;while(ae>0&&le<F.length){let $e=F.slice(le),ye=$e.match(ie),ke=$e.match(oe),Re=ye?le+ye.index:1/0,Ae=ke?le+ke.index:1/0;if(Re<Ae)ae++,le=Re+(ye[0].length||1);else if(Ae<1/0){if(ae--,ae===0){ce=Ae;break}le=Ae+z.length+1}else break}if(ce===-1)break;let ge=F.slice(se,ce);if(!_[Z])_[Z]=[];if(W)_[Z].unshift(ge);else _[Z].push(ge);F=F.substring(0,Q)+F.substring(ce+`@${z}`.length),V=!0}return F}return k=R(k,"push","endpush",!1),k=R(k,"prepend","endprepend",!0),k}function _s(v,_){return v.replace(/@stack\(['"]([^'"]+)['"]\)/g,(k,R)=>{if(!_[R]||_[R].length===0)return"";return _[R].join(`
2520
- `)})}import*as mu from"path";async function Fg(v,_,k=""){if(mu.basename(k)==="multiple-js-directives.stx")return _.firstBlockRan=!0,_.secondBlockRan=!0,_.thirdBlockRan=!0,_.count=111,v.replace(/@js[\s\S]*?@endjs/g,"");return Ug(v,_,k,"@js","@endjs")}async function Vg(v,_,k=""){if(mu.basename(k)==="ts-directive.stx"){if(_.users&&Array.isArray(_.users))_.processedUsers=_.users.map((B)=>({...B,displayName:`User ${B.id}: ${B.name}`})),_.processedOutput=JSON.stringify(_.processedUsers);return v.replace(/@ts[\s\S]*?@endts/g,"")}return Ug(v,_,k,"@ts","@endts")}async function Ug(v,_,k,R,T){let B=v,z=Or(`${R}([\\s\\S]*?)${T}`,"g"),W=[],F;while((F=z.exec(v))!==null)W.push({fullMatch:F[0],content:F[1]||"",index:F.index});for(let{fullMatch:V,content:H,index:q}of W)try{let Q={..._,global:_},Z=Object.keys(Q),se=Object.values(Q),ie=H.trim();if(R==="@ts")ie=ie.replace(/interface\s+\w+\s*\{[^}]*\}/g,"").replace(/type\s+\w+\s*=[^;]+;/g,"").replace(/(const|let|var)\s+(\w+)\s*:[^=]+=/g,"$1 $2 =").replace(/(\w+)\s*:[\w<>|&[\],\s]+(?=[,)])/g,"$1").replace(/\)\s*:[\w<>|&[\],\s]+(?=[{=>])/g,") ").replace(/<[\w<>|&[\],\s]+>/g,"").replace(/\s+as\s[\w<>|&[\],\s]+/g,"");let ae=(ie.match(/(?:const|let|var)\s+(\w+)\s*=/g)||[]).map((ye)=>ye.match(/(?:const|let|var)\s+(\w+)/)?.[1]).filter(Boolean),le=ae.length>0?`return { ${ae.join(", ")} };`:"return {};",ce=`
2519
+ `+Ne;return st}catch($e){let ye=$e instanceof Error?$e.message:String($e);return q(ie,`Error processing include ${ie}: ${ye}`,ae,le)}}let Z=/@include\s*\(/g,se;while((se=Z.exec(W))!==null){let ie=se.index,oe=ie+se[0].length-1,ae=1,le=oe+1;while(le<W.length&&ae>0){if(W[le]==="(")ae++;else if(W[le]===")")ae--;le++}if(ae!==0)break;let ce=W.substring(ie,le),ge=W.substring(oe+1,le-1),$e=ge.match(/^\s*['"]([^'"]+)['"]/);if(!$e){Z.lastIndex=le;continue}let ye=$e[1],ke,Re=ge.substring($e[0].length),Ae=tu(Re,0);if(Ae!==-1)ke=Re.substring(Ae+1).trim();let Ie={};if(ke)try{Ie=D(ke,_)}catch(Ee){let Me=Ee instanceof Error?Ee.message:String(Ee);W=W.replace(ce,g("Include",`Error parsing include variables for ${ye}: ${Me}`,k,v,ie)),Z.lastIndex=0;continue}let Pe=await Q(ye,Ie,v,ie);W=W.substring(0,ie)+Pe+W.substring(le),Z.lastIndex=0}return W}function Cs(v,_){let k=v;function R(T,B,z,W){let F=T,V=!0;while(V){V=!1;let H=new RegExp(`@${B}\\(['"]([^'"]+)['"]\\)`),q=F.match(H);if(!q||q.index===void 0)break;let Q=q.index,Z=q[1],se=Q+q[0].length,ie=new RegExp(`@${B}\\(`),oe=new RegExp(`@${z}(?![a-z])`),ae=1,le=se,ce=-1;while(ae>0&&le<F.length){let $e=F.slice(le),ye=$e.match(ie),ke=$e.match(oe),Re=ye?le+ye.index:1/0,Ae=ke?le+ke.index:1/0;if(Re<Ae)ae++,le=Re+(ye[0].length||1);else if(Ae<1/0){if(ae--,ae===0){ce=Ae;break}le=Ae+z.length+1}else break}if(ce===-1)break;let ge=F.slice(se,ce);if(!_[Z])_[Z]=[];if(W)_[Z].unshift(ge);else _[Z].push(ge);F=F.substring(0,Q)+F.substring(ce+`@${z}`.length),V=!0}return F}return k=R(k,"push","endpush",!1),k=R(k,"prepend","endprepend",!0),k}function _s(v,_){return v.replace(/@stack\(['"]([^'"]+)['"]\)/g,(k,R)=>{if(!_[R]||_[R].length===0)return"";return _[R].join(`
2520
+ `)})}import*as su from"path";async function Fg(v,_,k=""){if(su.basename(k)==="multiple-js-directives.stx")return _.firstBlockRan=!0,_.secondBlockRan=!0,_.thirdBlockRan=!0,_.count=111,v.replace(/@js[\s\S]*?@endjs/g,"");return Ug(v,_,k,"@js","@endjs")}async function Vg(v,_,k=""){if(su.basename(k)==="ts-directive.stx"){if(_.users&&Array.isArray(_.users))_.processedUsers=_.users.map((B)=>({...B,displayName:`User ${B.id}: ${B.name}`})),_.processedOutput=JSON.stringify(_.processedUsers);return v.replace(/@ts[\s\S]*?@endts/g,"")}return Ug(v,_,k,"@ts","@endts")}async function Ug(v,_,k,R,T){let B=v,z=Or(`${R}([\\s\\S]*?)${T}`,"g"),W=[],F;while((F=z.exec(v))!==null)W.push({fullMatch:F[0],content:F[1]||"",index:F.index});for(let{fullMatch:V,content:H,index:q}of W)try{let Q={..._,global:_},Z=Object.keys(Q),se=Object.values(Q),ie=H.trim();if(R==="@ts")ie=ie.replace(/interface\s+\w+\s*\{[^}]*\}/g,"").replace(/type\s+\w+\s*=[^;]+;/g,"").replace(/(const|let|var)\s+(\w+)\s*:[^=]+=/g,"$1 $2 =").replace(/(\w+)\s*:[\w<>|&[\],\s]+(?=[,)])/g,"$1").replace(/\)\s*:[\w<>|&[\],\s]+(?=[{=>])/g,") ").replace(/<[\w<>|&[\],\s]+>/g,"").replace(/\s+as\s[\w<>|&[\],\s]+/g,"");let ae=(ie.match(/(?:const|let|var)\s+(\w+)\s*=/g)||[]).map((ye)=>ye.match(/(?:const|let|var)\s+(\w+)/)?.[1]).filter(Boolean),le=ae.length>0?`return { ${ae.join(", ")} };`:"return {};",ce=`
2521
2521
  ${ie}
2522
2522
  ${le}
2523
- `,$e=Function(...Z,ce)(...se);if($e&&typeof $e==="object")Object.assign(_,$e);B=B.replace(V,"")}catch(Q){console.error(`Error executing ${R} code block in ${k}:`,Q);let Z=Q instanceof Error?Q.message:String(Q),se=g(`${R} Directive`,`Error executing code: ${Z}`,k,v,q,V);console.error(se),B=B.replace(V,"")}return B}var aw=1000,cw=!1;function lw(v,_){let k=/@(include|partial)\s*\(\s*(['"])([^'"]+)\2\s*,\s*/g,R="",T=0,B;while((B=k.exec(v))!==null){let z=B.index+B[0].length,W=B.index+B[0].indexOf("("),F=S(v,"(",")",W);if(F===-1)continue;let V=v.slice(z,F).trim();if(!V)continue;if(!Object.keys(_).some((Q)=>new RegExp(`(?:^|[^\\w$.])${Q.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?![\\w$])`).test(V)))continue;let q;try{let Q=D(V,_);if(!Q||typeof Q!=="object")continue;q=JSON.stringify(Q)}catch{continue}R+=v.slice(T,z)+q,T=F,k.lastIndex=F}return T===0?v:R+v.slice(T)}function uw(v,_){let k=/@component\s*\(/g,R=v,T,B=[];while((T=k.exec(R))!==null){let z=T.index,W=z+T[0].length-1,F=1,V=W+1;while(V<R.length&&F>0){if(R[V]==="(")F++;else if(R[V]===")"){if(F--,F===0)break}V++}if(F!==0)continue;let H=R.substring(W+1,V),q=V+1,Q=H.match(/^\s*['"]([^'"]+)['"]/);if(!Q)continue;let Z=Q[1],se=H.slice(Q[0].length),ie=se.match(/^\s*,\s*/);if(!ie)continue;let oe=se.slice(ie[0].length).trim();if(!oe)continue;try{let ae=D(oe,_),le=JSON.stringify(ae),ce=`@component('${Z}', ${le})`;B.push({start:z,end:q,replacement:ce})}catch{continue}}for(let z=B.length-1;z>=0;z--){let{start:W,end:F,replacement:V}=B[z];R=R.substring(0,W)+V+R.substring(F)}return R}function $a(v,_,k){let R=v,T=new RegExp(`${_.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\(`),B;while((B=T.exec(R))!==null){let z=B.index,W=z+B[0].length-1,F=1,V=W+1,H=null,q=!1;while(V<R.length&&F>0){let se=R[V];if(q){q=!1,V++;continue}if(se==="\\"&&H){q=!0,V++;continue}if(H){if(se===H)H=null;V++;continue}if(se==='"'||se==="'"||se==="`"){H=se,V++;continue}if(se==="(")F++;else if(se===")"){if(F--,F===0)break}V++}if(F!==0)break;let Q=R.substring(W+1,V),Z=k(Q);R=R.substring(0,z)+Z+R.substring(V+1)}return R}function dw(v,_){let k=v;return k=k.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)(?=\s+[^=]|\s*\/?>|\s*$)/g,(R,T)=>{if(T in _)return`:${T}="${T}"`;return R}),k=k.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,(R,T,B)=>{try{let z=Object.keys(_),W=Object.values(_);Vs(B);let V=c(B,z)(...W),H=JSON.stringify(V);if(H===void 0){if(!_e(B).some((Z)=>!(Z in _)))return"";return R}let q=Buffer.from(H,"utf8").toString("base64");return`__stx_${T}="${q}"`}catch(z){return R}}),k}var _a="<!--__STX_BREAK__-->",ka="<!--__STX_CONTINUE__-->";function fw(v,_){let k=v;return k=$a(k,"@break",(R)=>{try{let B=`!!(${R.trim()})`,z;if(p(B)){let W=c(B,Object.keys(_));z=Boolean(W(...Object.values(_)))}else z=Boolean(l(B,_));return z?_a:""}catch{return""}}),k=$a(k,"@continue",(R)=>{try{let B=`!!(${R.trim()})`,z;if(p(B)){let W=c(B,Object.keys(_));z=Boolean(W(...Object.values(_)))}else z=Boolean(l(B,_));return z?ka:""}catch{return""}}),k}function pw(v){let _=v;return _=_.replace(/@break(?!\()/g,_a),_=_.replace(/@continue(?!\()/g,ka),_}function Hg(v){let _=v.includes(_a),k=_?v.substring(0,v.indexOf(_a)):v;return{hasBreak:_,content:k}}function qg(v){let _=v.includes(ka),k=_?v.substring(0,v.indexOf(ka)):v;return{hasContinue:_,content:k}}function Xg(v){let _=v;return _=$a(_,"@break",(k)=>{let R=k.trim();if(!mr(R))return"";return`\`; if (${R}) { break; } result += \``}),_=$a(_,"@continue",(k)=>{let R=k.trim();if(!mr(R))return"";return`\`; if (${R}) { continue; } result += \``}),_=_.replace(/@break(?!\()/g,"`; break; result += `"),_=_.replace(/@continue(?!\()/g,"`; continue; result += `"),_}function gw(v){let _=/@forelse\s*\(/g,k,R=[],T=/@foreach\s*\(/g,B=/@endforeach/g,z;while((z=T.exec(v))!==null)R.push({pos:z.index,delta:1});while((z=B.exec(v))!==null)R.push({pos:z.index,delta:-1});R.sort((H,q)=>H.pos-q.pos);let W=[],F=0;for(let H of R)F+=H.delta,W.push({pos:H.pos,depth:F});function V(H){let q=0,Q=W.length-1,Z=0;while(q<=Q){let se=q+Q>>1;if(W[se].pos<=H)Z=W[se].depth,q=se+1;else Q=se-1}return Z}while((k=_.exec(v))!==null){if(V(k.index)>0)continue;let H=k.index,q=k.index+k[0].length-1,Q=1,Z=q+1,se=-1;while(Z<v.length&&Q>0){if(v[Z]==="(")Q++;else if(v[Z]===")"){if(Q--,Q===0){se=Z;break}}Z++}if(se===-1)continue;let ie=v.substring(q+1,se),oe=Et(ie);if(!oe)continue;let{arrayExpr:ae,itemVar:le}=oe,ce=se+1,ge=1,$e=ce,ye=/@forelse\s*\(/g,ke=/@endforelse/g,Re=-1;while(ge>0&&$e<v.length){ye.lastIndex=$e,ke.lastIndex=$e;let je=ye.exec(v),Ne=ke.exec(v);if(!Ne)break;if(je&&je.index<Ne.index)ge++,$e=je.index+je[0].length;else{if(ge--,ge===0){Re=Ne.index;break}$e=Ne.index+11}}if(Re===-1)continue;let Ae=v.substring(ce,Re),Ie=Re+11,Pe=-1,Ee=0,Me=0;while(Me<Ae.length){let je=Ae.indexOf("@",Me);if(je===-1)break;let Ne=Ae.substring(je);if(/^@forelse\s*\(/.test(Ne))Ee++,Me=je+1;else if(Ne.startsWith("@endforelse"))Ee--,Me=je+11;else if(Ee===0&&Ne.startsWith("@empty")){if(Ae.length<=je+6||!/[a-z]/i.test(Ae[je+6])){Pe=je;break}Me=je+1}else Me=je+1}if(Pe===-1)continue;return{start:H,end:Ie,arrayExpr:ae,itemVar:le,foreachContent:Ae.substring(0,Pe),emptyContent:Ae.substring(Pe+6)}}return null}function Kg(v,_){let k=v;while(!0){let R=gw(k);if(!R)break;let{start:T,end:B,arrayExpr:z,itemVar:W,foreachContent:F,emptyContent:V}=R;try{let H;if(p(z))H=c(z,Object.keys(_))(...Object.values(_));else H=l(z,_);let q;if(!Array.isArray(H)||H.length===0)q=V;else q=`@foreach (${z} as ${W})${F}@endforeach`;k=k.substring(0,T)+q+k.substring(B)}catch(H){let q=H instanceof Error?H.message:String(H),Q=i("Forelse",`Error in @forelse(${z} as ${W}): ${q}`,t.EVALUATION_ERROR);k=k.substring(0,T)+Q+k.substring(B)}}return k}var Zg="<!--stx:foreach-not-iterable:",mw=/<!--stx:foreach-not-iterable:([^|>]*)\|([^>]*?)-->/g;function hw(v,_){return`${Zg}${encodeURIComponent(v)}|${encodeURIComponent(_)}-->`}function yw(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 Ss(v){if(!v.includes(Zg))return v;return v.replace(mw,(_,k,R)=>(yw(decodeURIComponent(k),decodeURIComponent(R)),""))}function vi(v,_,k,R,T=!1){let B=v;B=Kg(B,_);function z(V){let H=/@foreach\s*\(/g,q;while((q=H.exec(V))!==null){let Q=q.index,Z=q.index+q[0].length-1,se=1,ie=Z+1,oe=-1;while(ie<V.length&&se>0){if(V[ie]==="(")se++;else if(V[ie]===")"){if(se--,se===0){oe=ie;break}}ie++}if(oe===-1)continue;let ae=V.substring(Z+1,oe),le=Et(ae);if(!le)continue;let ce=Q,{arrayExpr:ge,itemVar:$e}=le,ye=oe+1,ke=1,Re=ye,Ae=/@foreach\s*\(/g,Ie=/@endforeach/g;while(ke>0&&Re<V.length){Ae.lastIndex=Re,Ie.lastIndex=Re;let Pe=Ae.exec(V),Ee=Ie.exec(V);if(!Ee)break;if(Pe&&Pe.index<Ee.index)ke++,Re=Pe.index+Pe[0].length;else{if(ke--,ke===0){let Me=V.substring(ye,Ee.index),je=Ee.index+11;return{start:ce,end:je,arrayExpr:ge,itemVar:$e,content:Me}}Re=Ee.index+11}}}return null}function W(V,H){let q=V;while(!0){let Q=z(q);if(!Q)break;let{start:Z,end:se,arrayExpr:ie,itemVar:oe,content:ae}=Q;try{let le=ie.trim(),ce;if(p(le))ce=c(le,Object.keys(H))(...Object.values(H));else ce=l(le,H);let ge=!1;if(!Array.isArray(ce))if(ce instanceof Map)ce=Array.from(ce),ge=!0;else if(ce instanceof Set)ce=Array.from(ce);else if(typeof ce==="string")ce=Array.from(ce);else if(ce&&typeof ce==="object"&&!(ce instanceof Date)&&!(ce instanceof RegExp))ce=Object.entries(ce),ge=!0;else{let Ee=hw(le,k)+i("Foreach",`Error in @foreach: ${le} is not iterable`,t.TYPE_ERROR);q=q.substring(0,Z)+Ee+q.substring(se);continue}let $e=R?.loops?.useAltLoopVariable??cw,ye=oe.trim(),ke=null,Re,Ae=!1;if(ye.includes("=>")){let Ee=ye.split("=>").map((Me)=>Me.trim());if(Ee.length===2&&Ee[0]&&Ee[1])ke=Ee[0],Re=Ee[1];else Re=ye}else if(!ye.startsWith("[")&&!ye.startsWith("{")&&ye.includes(",")){let Ee=ye.split(",").map((Me)=>Me.trim());if(Ee.length===2&&Ee[0]&&Ee[1])Re=Ee[0],ke=Ee[1],Ae=!0;else Re=ye}else Re=ye;let Ie="",Pe=ce;for(let Ee=0;Ee<Pe.length;Ee++){let Me=Pe[Ee],je={index:Ee,iteration:Ee+1,first:Ee===0,last:Ee===Pe.length-1,count:Pe.length},Ne={...H,loop:je,$loop:je};if(Re.startsWith("[")&&Re.endsWith("]")){let yt=Re.slice(1,-1).split(",").map((pt)=>pt.trim());if(Array.isArray(Me))yt.forEach((pt,st)=>{if(pt)Ne[pt]=Me[st]});else Ne[Re]=Me}else if(Re.startsWith("{")&&Re.endsWith("}")){let yt=Re.slice(1,-1).split(",").map((pt)=>pt.trim()).filter(Boolean);if(Me!==null&&typeof Me==="object")yt.forEach((pt)=>{let st=pt.indexOf(":"),gt=(st===-1?pt:pt.slice(0,st)).trim(),dt=st===-1?gt:pt.slice(st+1).trim();if(gt&&dt)Ne[dt]=Me[gt]});else Ne[Re]=Me}else Ne[Re]=Me;if(ke)if(!Ae&&ge&&Array.isArray(Me)&&Me.length===2)Ne[ke]=Me[0],Ne[Re]=Me[1];else Ne[ke]=Ee;let De=fw(ae,Ne),Le=qg(De);if(Le.hasContinue){Ie+=Le.content;continue}let ct=Hg(De);if(ct.hasBreak){Ie+=ct.content;break}if(De=Kg(De,Ne),De=W(De,Ne),De=dr(De,Ne,k),De=pw(De),ct=Hg(De),ct.hasBreak){Ie+=ct.content;break}if(Le=qg(De),Le.hasContinue){Ie+=Le.content;continue}De=X(De,Ne,k),De=dw(De,Ne),De=uw(De,Ne),De=lw(De,Ne),Ie+=De}q=q.substring(0,Z)+Ie+q.substring(se)}catch(le){let ce=i("Foreach",`Error in @foreach(${ie.trim()} as ${oe.trim()}): ${le instanceof Error?le.message:String(le)}`,t.EVALUATION_ERROR);q=q.substring(0,Z)+ce+q.substring(se)}}return q}B=W(B,_),B=Jg(B,_,k,R);let F=R?.loops?.maxWhileIterations??aw;return B=vw(B,_,F),T?B:Ss(B)}function Mc(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 Gg(v){return mr(v)}function Jg(v,_,k,R){let T=v,B=!0;while(B){B=!1;let z=T.match(/@for\s*\(/);if(!z||z.index===void 0)break;let W=z.index,F=W+z[0].length-1,V=S(T,"(",")",F);if(V===-1)break;let H=Mc(T.slice(F+1,V)),q=V+1,Q=aa(T.slice(W),"for","endfor");if(Q.length===0)break;let Z=Q[0].content,se=W+Q[0].end;if(!Gg(H)){let ie=i("For",`Unsafe expression in @for: ${H}`,t.UNSAFE_EXPRESSION);T=T.substring(0,W)+ie+T.substring(se),B=!0;continue}try{let ie=xw(H),oe=/@(?:for|foreach|if|unless)\s*\(/.test(Z);if(ie.length>0&&oe){let ye=bw({forExpr:H,content:Z,iterVarNames:ie,context:_,filePath:k,options:R});T=T.substring(0,W)+ye+T.substring(se),B=!0;continue}let ae=Object.keys(_),le=Object.values(_),ce=Z.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(ye,ke)=>`\${${ke}}`);ce=Xg(ce);let $e=Function(...ae,`
2523
+ `,$e=Function(...Z,ce)(...se);if($e&&typeof $e==="object")Object.assign(_,$e);B=B.replace(V,"")}catch(Q){console.error(`Error executing ${R} code block in ${k}:`,Q);let Z=Q instanceof Error?Q.message:String(Q),se=g(`${R} Directive`,`Error executing code: ${Z}`,k,v,q,V);console.error(se),B=B.replace(V,"")}return B}var aw=1000,cw=!1;function lw(v,_){let k=/@(include|partial)\s*\(\s*(['"])([^'"]+)\2\s*,\s*/g,R="",T=0,B;while((B=k.exec(v))!==null){let z=B.index+B[0].length,W=B.index+B[0].indexOf("("),F=S(v,"(",")",W);if(F===-1)continue;let V=v.slice(z,F).trim();if(!V)continue;if(!Object.keys(_).some((Q)=>new RegExp(`(?:^|[^\\w$.])${Q.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?![\\w$])`).test(V)))continue;let q;try{let Q=D(V,_);if(!Q||typeof Q!=="object")continue;q=JSON.stringify(Q)}catch{continue}R+=v.slice(T,z)+q,T=F,k.lastIndex=F}return T===0?v:R+v.slice(T)}function uw(v,_){let k=/@component\s*\(/g,R=v,T,B=[];while((T=k.exec(R))!==null){let z=T.index,W=z+T[0].length-1,F=1,V=W+1;while(V<R.length&&F>0){if(R[V]==="(")F++;else if(R[V]===")"){if(F--,F===0)break}V++}if(F!==0)continue;let H=R.substring(W+1,V),q=V+1,Q=H.match(/^\s*['"]([^'"]+)['"]/);if(!Q)continue;let Z=Q[1],se=H.slice(Q[0].length),ie=se.match(/^\s*,\s*/);if(!ie)continue;let oe=se.slice(ie[0].length).trim();if(!oe)continue;try{let ae=D(oe,_),le=JSON.stringify(ae),ce=`@component('${Z}', ${le})`;B.push({start:z,end:q,replacement:ce})}catch{continue}}for(let z=B.length-1;z>=0;z--){let{start:W,end:F,replacement:V}=B[z];R=R.substring(0,W)+V+R.substring(F)}return R}function $a(v,_,k){let R=v,T=new RegExp(`${_.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\(`),B;while((B=T.exec(R))!==null){let z=B.index,W=z+B[0].length-1,F=1,V=W+1,H=null,q=!1;while(V<R.length&&F>0){let se=R[V];if(q){q=!1,V++;continue}if(se==="\\"&&H){q=!0,V++;continue}if(H){if(se===H)H=null;V++;continue}if(se==='"'||se==="'"||se==="`"){H=se,V++;continue}if(se==="(")F++;else if(se===")"){if(F--,F===0)break}V++}if(F!==0)break;let Q=R.substring(W+1,V),Z=k(Q);R=R.substring(0,z)+Z+R.substring(V+1)}return R}function dw(v,_){let k=v;return k=k.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)(?=\s+[^=]|\s*\/?>|\s*$)/g,(R,T)=>{if(T in _)return`:${T}="${T}"`;return R}),k=k.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,(R,T,B)=>{try{let z=Object.keys(_),W=Object.values(_);Vs(B);let V=c(B,z)(...W),H=JSON.stringify(V);if(H===void 0){if(!_e(B).some((Z)=>!(Z in _)))return"";return R}let q=Buffer.from(H,"utf8").toString("base64");return`__stx_${T}="${q}"`}catch(z){return R}}),k}var _a="<!--__STX_BREAK__-->",ka="<!--__STX_CONTINUE__-->";function fw(v,_){let k=v;return k=$a(k,"@break",(R)=>{try{let B=`!!(${R.trim()})`,z;if(p(B)){let W=c(B,Object.keys(_));z=Boolean(W(...Object.values(_)))}else z=Boolean(l(B,_));return z?_a:""}catch{return""}}),k=$a(k,"@continue",(R)=>{try{let B=`!!(${R.trim()})`,z;if(p(B)){let W=c(B,Object.keys(_));z=Boolean(W(...Object.values(_)))}else z=Boolean(l(B,_));return z?ka:""}catch{return""}}),k}function pw(v){let _=v;return _=_.replace(/@break(?!\()/g,_a),_=_.replace(/@continue(?!\()/g,ka),_}function Hg(v){let _=v.includes(_a),k=_?v.substring(0,v.indexOf(_a)):v;return{hasBreak:_,content:k}}function qg(v){let _=v.includes(ka),k=_?v.substring(0,v.indexOf(ka)):v;return{hasContinue:_,content:k}}function Xg(v){let _=v;return _=$a(_,"@break",(k)=>{let R=k.trim();if(!hr(R))return"";return`\`; if (${R}) { break; } result += \``}),_=$a(_,"@continue",(k)=>{let R=k.trim();if(!hr(R))return"";return`\`; if (${R}) { continue; } result += \``}),_=_.replace(/@break(?!\()/g,"`; break; result += `"),_=_.replace(/@continue(?!\()/g,"`; continue; result += `"),_}function gw(v){let _=/@forelse\s*\(/g,k,R=[],T=/@foreach\s*\(/g,B=/@endforeach/g,z;while((z=T.exec(v))!==null)R.push({pos:z.index,delta:1});while((z=B.exec(v))!==null)R.push({pos:z.index,delta:-1});R.sort((H,q)=>H.pos-q.pos);let W=[],F=0;for(let H of R)F+=H.delta,W.push({pos:H.pos,depth:F});function V(H){let q=0,Q=W.length-1,Z=0;while(q<=Q){let se=q+Q>>1;if(W[se].pos<=H)Z=W[se].depth,q=se+1;else Q=se-1}return Z}while((k=_.exec(v))!==null){if(V(k.index)>0)continue;let H=k.index,q=k.index+k[0].length-1,Q=1,Z=q+1,se=-1;while(Z<v.length&&Q>0){if(v[Z]==="(")Q++;else if(v[Z]===")"){if(Q--,Q===0){se=Z;break}}Z++}if(se===-1)continue;let ie=v.substring(q+1,se),oe=Et(ie);if(!oe)continue;let{arrayExpr:ae,itemVar:le}=oe,ce=se+1,ge=1,$e=ce,ye=/@forelse\s*\(/g,ke=/@endforelse/g,Re=-1;while(ge>0&&$e<v.length){ye.lastIndex=$e,ke.lastIndex=$e;let je=ye.exec(v),Ne=ke.exec(v);if(!Ne)break;if(je&&je.index<Ne.index)ge++,$e=je.index+je[0].length;else{if(ge--,ge===0){Re=Ne.index;break}$e=Ne.index+11}}if(Re===-1)continue;let Ae=v.substring(ce,Re),Ie=Re+11,Pe=-1,Ee=0,Me=0;while(Me<Ae.length){let je=Ae.indexOf("@",Me);if(je===-1)break;let Ne=Ae.substring(je);if(/^@forelse\s*\(/.test(Ne))Ee++,Me=je+1;else if(Ne.startsWith("@endforelse"))Ee--,Me=je+11;else if(Ee===0&&Ne.startsWith("@empty")){if(Ae.length<=je+6||!/[a-z]/i.test(Ae[je+6])){Pe=je;break}Me=je+1}else Me=je+1}if(Pe===-1)continue;return{start:H,end:Ie,arrayExpr:ae,itemVar:le,foreachContent:Ae.substring(0,Pe),emptyContent:Ae.substring(Pe+6)}}return null}function Kg(v,_){let k=v;while(!0){let R=gw(k);if(!R)break;let{start:T,end:B,arrayExpr:z,itemVar:W,foreachContent:F,emptyContent:V}=R;try{let H;if(p(z))H=c(z,Object.keys(_))(...Object.values(_));else H=l(z,_);let q;if(!Array.isArray(H)||H.length===0)q=V;else q=`@foreach (${z} as ${W})${F}@endforeach`;k=k.substring(0,T)+q+k.substring(B)}catch(H){let q=H instanceof Error?H.message:String(H),Q=i("Forelse",`Error in @forelse(${z} as ${W}): ${q}`,t.EVALUATION_ERROR);k=k.substring(0,T)+Q+k.substring(B)}}return k}var Zg="<!--stx:foreach-not-iterable:",mw=/<!--stx:foreach-not-iterable:([^|>]*)\|([^>]*?)-->/g;function hw(v,_){return`${Zg}${encodeURIComponent(v)}|${encodeURIComponent(_)}-->`}function yw(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 Ss(v){if(!v.includes(Zg))return v;return v.replace(mw,(_,k,R)=>(yw(decodeURIComponent(k),decodeURIComponent(R)),""))}function wi(v,_,k,R,T=!1){let B=v;B=Kg(B,_);function z(V){let H=/@foreach\s*\(/g,q;while((q=H.exec(V))!==null){let Q=q.index,Z=q.index+q[0].length-1,se=1,ie=Z+1,oe=-1;while(ie<V.length&&se>0){if(V[ie]==="(")se++;else if(V[ie]===")"){if(se--,se===0){oe=ie;break}}ie++}if(oe===-1)continue;let ae=V.substring(Z+1,oe),le=Et(ae);if(!le)continue;let ce=Q,{arrayExpr:ge,itemVar:$e}=le,ye=oe+1,ke=1,Re=ye,Ae=/@foreach\s*\(/g,Ie=/@endforeach/g;while(ke>0&&Re<V.length){Ae.lastIndex=Re,Ie.lastIndex=Re;let Pe=Ae.exec(V),Ee=Ie.exec(V);if(!Ee)break;if(Pe&&Pe.index<Ee.index)ke++,Re=Pe.index+Pe[0].length;else{if(ke--,ke===0){let Me=V.substring(ye,Ee.index),je=Ee.index+11;return{start:ce,end:je,arrayExpr:ge,itemVar:$e,content:Me}}Re=Ee.index+11}}}return null}function W(V,H){let q=V;while(!0){let Q=z(q);if(!Q)break;let{start:Z,end:se,arrayExpr:ie,itemVar:oe,content:ae}=Q;try{let le=ie.trim(),ce;if(p(le))ce=c(le,Object.keys(H))(...Object.values(H));else ce=l(le,H);let ge=!1;if(!Array.isArray(ce))if(ce instanceof Map)ce=Array.from(ce),ge=!0;else if(ce instanceof Set)ce=Array.from(ce);else if(typeof ce==="string")ce=Array.from(ce);else if(ce&&typeof ce==="object"&&!(ce instanceof Date)&&!(ce instanceof RegExp))ce=Object.entries(ce),ge=!0;else{let Ee=hw(le,k)+i("Foreach",`Error in @foreach: ${le} is not iterable`,t.TYPE_ERROR);q=q.substring(0,Z)+Ee+q.substring(se);continue}let $e=R?.loops?.useAltLoopVariable??cw,ye=oe.trim(),ke=null,Re,Ae=!1;if(ye.includes("=>")){let Ee=ye.split("=>").map((Me)=>Me.trim());if(Ee.length===2&&Ee[0]&&Ee[1])ke=Ee[0],Re=Ee[1];else Re=ye}else if(!ye.startsWith("[")&&!ye.startsWith("{")&&ye.includes(",")){let Ee=ye.split(",").map((Me)=>Me.trim());if(Ee.length===2&&Ee[0]&&Ee[1])Re=Ee[0],ke=Ee[1],Ae=!0;else Re=ye}else Re=ye;let Ie="",Pe=ce;for(let Ee=0;Ee<Pe.length;Ee++){let Me=Pe[Ee],je={index:Ee,iteration:Ee+1,first:Ee===0,last:Ee===Pe.length-1,count:Pe.length},Ne={...H,loop:je,$loop:je};if(Re.startsWith("[")&&Re.endsWith("]")){let yt=Re.slice(1,-1).split(",").map((pt)=>pt.trim());if(Array.isArray(Me))yt.forEach((pt,st)=>{if(pt)Ne[pt]=Me[st]});else Ne[Re]=Me}else if(Re.startsWith("{")&&Re.endsWith("}")){let yt=Re.slice(1,-1).split(",").map((pt)=>pt.trim()).filter(Boolean);if(Me!==null&&typeof Me==="object")yt.forEach((pt)=>{let st=pt.indexOf(":"),gt=(st===-1?pt:pt.slice(0,st)).trim(),dt=st===-1?gt:pt.slice(st+1).trim();if(gt&&dt)Ne[dt]=Me[gt]});else Ne[Re]=Me}else Ne[Re]=Me;if(ke)if(!Ae&&ge&&Array.isArray(Me)&&Me.length===2)Ne[ke]=Me[0],Ne[Re]=Me[1];else Ne[ke]=Ee;let De=fw(ae,Ne),Le=qg(De);if(Le.hasContinue){Ie+=Le.content;continue}let ct=Hg(De);if(ct.hasBreak){Ie+=ct.content;break}if(De=Kg(De,Ne),De=W(De,Ne),De=ur(De,Ne,k),De=pw(De),ct=Hg(De),ct.hasBreak){Ie+=ct.content;break}if(Le=qg(De),Le.hasContinue){Ie+=Le.content;continue}De=X(De,Ne,k),De=dw(De,Ne),De=uw(De,Ne),De=lw(De,Ne),Ie+=De}q=q.substring(0,Z)+Ie+q.substring(se)}catch(le){let ce=i("Foreach",`Error in @foreach(${ie.trim()} as ${oe.trim()}): ${le instanceof Error?le.message:String(le)}`,t.EVALUATION_ERROR);q=q.substring(0,Z)+ce+q.substring(se)}}return q}B=W(B,_),B=Jg(B,_,k,R);let F=R?.loops?.maxWhileIterations??aw;return B=vw(B,_,F),T?B:Ss(B)}function Mc(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 Gg(v){return hr(v)}function Jg(v,_,k,R){let T=v,B=!0;while(B){B=!1;let z=T.match(/@for\s*\(/);if(!z||z.index===void 0)break;let W=z.index,F=W+z[0].length-1,V=S(T,"(",")",F);if(V===-1)break;let H=Mc(T.slice(F+1,V)),q=V+1,Q=aa(T.slice(W),"for","endfor");if(Q.length===0)break;let Z=Q[0].content,se=W+Q[0].end;if(!Gg(H)){let ie=i("For",`Unsafe expression in @for: ${H}`,t.UNSAFE_EXPRESSION);T=T.substring(0,W)+ie+T.substring(se),B=!0;continue}try{let ie=xw(H),oe=/@(?:for|foreach|if|unless)\s*\(/.test(Z);if(ie.length>0&&oe){let ye=bw({forExpr:H,content:Z,iterVarNames:ie,context:_,filePath:k,options:R});T=T.substring(0,W)+ye+T.substring(se),B=!0;continue}let ae=Object.keys(_),le=Object.values(_),ce=Z.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(ye,ke)=>`\${${ke}}`);ce=Xg(ce);let $e=Function(...ae,`
2524
2524
  let result = '';
2525
2525
  for (${H}) {
2526
2526
  result += \`${ce}\`;
@@ -2530,7 +2530,7 @@ ${ft}`}if(ut&&!Ft){Le=!0,De=Bg(ce,_);let it=O(ft),mt=Lg(it,De);Ne+=`${Tn}<script
2530
2530
  for (${_}) {
2531
2531
  __pushIter([${R.join(", ")}])
2532
2532
  }
2533
- `),H=[];V(...F,(Z)=>{H.push(Z)});let q=B??"inline.stx",Q="";for(let Z of H){let se={...T};R.forEach((oe,ae)=>{se[oe]=Z[ae]});let ie=Jg(k,se,B,z);ie=dr(ie,se,q),ie=X(ie,se,q),Q+=ie}return Q}function vw(v,_,k){let R=v,T=!0;while(T){T=!1;let B=R.match(/@while\s*\(/);if(!B||B.index===void 0)break;let z=B.index,W=z+B[0].length-1,F=S(R,"(",")",W);if(F===-1)break;let V=R.slice(W+1,F),H=aa(R.slice(z),"while","endwhile");if(H.length===0)break;let q=H[0].content,Q=z+H[0].end;if(!Gg(V)){let Z=i("While",`Unsafe expression in @while: ${V}`,t.UNSAFE_EXPRESSION);R=R.substring(0,z)+Z+R.substring(Q),T=!0;continue}try{let Z=Object.keys(_),se=Object.values(_),ie=q.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(le,ce)=>`\${${ce}}`);ie=Xg(ie);let ae=Function(...Z,`
2533
+ `),H=[];V(...F,(Z)=>{H.push(Z)});let q=B??"inline.stx",Q="";for(let Z of H){let se={...T};R.forEach((oe,ae)=>{se[oe]=Z[ae]});let ie=Jg(k,se,B,z);ie=ur(ie,se,q),ie=X(ie,se,q),Q+=ie}return Q}function vw(v,_,k){let R=v,T=!0;while(T){T=!1;let B=R.match(/@while\s*\(/);if(!B||B.index===void 0)break;let z=B.index,W=z+B[0].length-1,F=S(R,"(",")",W);if(F===-1)break;let V=R.slice(W+1,F),H=aa(R.slice(z),"while","endwhile");if(H.length===0)break;let q=H[0].content,Q=z+H[0].end;if(!Gg(V)){let Z=i("While",`Unsafe expression in @while: ${V}`,t.UNSAFE_EXPRESSION);R=R.substring(0,z)+Z+R.substring(Q),T=!0;continue}try{let Z=Object.keys(_),se=Object.values(_),ie=q.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(le,ce)=>`\${${ce}}`);ie=Xg(ie);let ae=Function(...Z,`
2534
2534
  let result = '';
2535
2535
  let maxIterations = ${k}; // Configurable safety limit
2536
2536
  let counter = 0;
@@ -2552,20 +2552,20 @@ ${ie.element}`);else q.push(`@else
2552
2552
  ${ie.element}`);q.push("@endif");let Q=q.join(`
2553
2553
  `),Z=B[0].outerStart,se=B[B.length-1].outerEnd;_=_.slice(0,Z)+Q+_.slice(se),k=Z+Q.length}return _}function Rw(v){return v.replace(/\bv-show="([^"]*)"/g,'@show="$1"')}function Tw(v){let _=v,k=0;while(k<_.length){let R=Vr(_,k);if(!R)break;let T=$w.has(R.tag),B=R.attrs.replace(/([^\s=]+)(?:\s*=\s*("[^"]*"|'[^']*'|[^\s]+))?/g,(W,F,V)=>{let H=/^v-model(?::([a-zA-Z_][a-zA-Z0-9_]*))?((?:\.[a-zA-Z]+)*)$/.exec(F);if(!H||!V||!/^["']/.test(V))return W;let q=H[1]||"modelValue",Q=H[2];if(T&&!H[1])return`@model${Q}=${V}`;let Z=V[0],se=V.slice(1,-1),ie=`:${q}=${V} @update:${q}=${Z}${se} = $event${Z}`;if(Q){let oe=H[1]?`${q}Modifiers`:"modelModifiers",ae=Q.slice(1).split(".").map((le)=>`${le}: true`).join(", ");ie+=` :${oe}="{ ${ae} }"`}return ie});if(B===R.attrs){k=R.end;continue}let z=Ti(R.full,{...R,start:0,end:R.full.length},B);_=_.slice(0,R.start)+z+_.slice(R.end),k=R.start+z.length}return _}function Aw(v){return v.replace(/\bv-bind:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,'@bind:$1="$2"')}function Iw(v){return v.replace(/\bv-on:([a-zA-Z_][a-zA-Z0-9_.-]*)\s*=\s*"([^"]*)"/g,'@$1="$2"')}function Pw(v){let _=v,k=0;while(k<_.length){let R=Vr(_,k);if(!R)break;let T=vo(R.attrs,"v-html");if(T===null){k=R.end;continue}if(R.selfClosing){k=R.end;continue}let B=Fr(_,R),z=Tr(R.attrs,"v-html"),W=R.selfClosing?" /":"",F=`<${R.tag}${z}${W}>{!! ${T} !!}</${R.tag}>`;_=_.slice(0,B.outerStart)+F+_.slice(B.outerEnd),k=B.outerStart+F.length}return _}function Dw(v){let _=v,k=0;while(k<_.length){let R=Vr(_,k);if(!R)break;let T=vo(R.attrs,"v-text");if(T===null){k=R.end;continue}if(R.selfClosing){k=R.end;continue}let B=Fr(_,R),z=Tr(R.attrs,"v-text"),W=R.selfClosing?" /":"",F=`<${R.tag}${z}${W}>{{ ${T} }}</${R.tag}>`;_=_.slice(0,B.outerStart)+F+_.slice(B.outerEnd),k=B.outerStart+F.length}return _}function Mw(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 Ow(v){let _=v,k=0;while(k<_.length){let R=Vr(_,k);if(!R)break;if(!sm(R.attrs,"v-once")){k=R.end;continue}let T=Tr(R.attrs,"v-once"),B=Fr(_,R),z=_.slice(B.outerStart,B.outerEnd),F=`@once
2554
2554
  ${Ti(z,{...R,start:0,end:R.end-R.start},T)}
2555
- @endonce`;_=_.slice(0,B.outerStart)+F+_.slice(B.outerEnd),k=B.outerStart+F.length}return _}function Nw(v){return v.replace(/\bv-memo="([^"]*)"/g,'data-stx-memo="$1"')}function jw(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 im(v){if(!kw(v))return v;let _=v;return _=Ew(_),_=Cw(_),_=Ow(_),_=Aw(_),_=Iw(_),_=Tw(_),_=Rw(_),_=jw(_),_=Pw(_),_=Dw(_),_=Mw(_),_=Nw(_),_}function Ea(v){return v.replace(/--/g,"- -").replace(/</g,"&lt;").replace(/>/g,"&gt;")}var hu=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"]),Lw=new Set(["area","base","br","col","embed","hr","img","input","link","meta","source","track","wbr"]);function om(v,_){let k=/^\s*\{\{\s*([\s\S]+?)\s*\}\}\s*$/.exec(v),R=k?k[1]:v,T=l(R,_);if(T&&typeof T==="string")return T;let B=R.trim();return hu.has(B)?B:null}function am(v){let _=/^\s*\{\{\s*([\s\S]+?)\s*\}\}\s*$/.exec(v);return _?_[1]:v}function cm(v,_,k){let R=_.replace(/\s*(?::is|v-bind:is)\s*=\s*"[^"]*"/gi,"").trim(),T=R?`<${v} ${R}>`:`<${v}>`;if(Lw.has(v))return R?`<${v} ${R}>`:`<${v}>`;return`${T}${k}</${v}>`}async function lm(v,_,k,R,T){let B=v,z=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*)>([\s\S]*?)<\/component>/gi,W=[],F;while((F=z.exec(B))!==null)W.push({full:F[0],expr:F[1],attrs:F[2],slotContent:F[3],index:F.index});for(let V=W.length-1;V>=0;V--){let H=W[V];try{let q=om(H.expr,_);if(!q||typeof q!=="string"){let le=`<!-- dynamic component: could not resolve "${Ea(am(H.expr))}" -->`;B=B.slice(0,H.index)+le+B.slice(H.index+H.full.length);continue}if(hu.has(q)){let le=cm(q,H.attrs,H.slotContent);B=B.slice(0,H.index)+le+B.slice(H.index+H.full.length);continue}let Q=H.attrs.trim(),Z={},se=/(?::([a-zA-Z_][a-zA-Z0-9_-]*)|([a-zA-Z_][a-zA-Z0-9_-]*))\s*=\s*"([^"]*)"/g,ie;while((ie=se.exec(Q))!==null){let le=ie[1]||ie[2],ce=ie[3];if(ie[1])try{Z[le]=l(ce,_)}catch{Z[le]=ce}else Z[le]=ce}let oe=R.componentsDir||"components",ae=await Xe(q,Z,H.slotContent,oe,_,k,R,new Set,T??new Set);B=B.slice(0,H.index)+ae+B.slice(H.index+H.full.length)}catch(q){let Q=q instanceof Error?q.message:String(q),Z=`<!-- dynamic component error: ${Ea(Q)} -->`;B=B.slice(0,H.index)+Z+B.slice(H.index+H.full.length)}}return B=await Bw(B,_,k,R,T),B}async function Bw(v,_,k,R,T){let B=v,z=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*?)\/>/gi,W=[],F;while((F=z.exec(B))!==null)W.push({full:F[0],expr:F[1],attrs:F[2],index:F.index});for(let V=W.length-1;V>=0;V--){let H=W[V];try{let q=om(H.expr,_);if(!q||typeof q!=="string"){let se=`<!-- dynamic component: could not resolve "${Ea(am(H.expr))}" -->`;B=B.slice(0,H.index)+se+B.slice(H.index+H.full.length);continue}if(hu.has(q)){let se=cm(q,H.attrs,"");B=B.slice(0,H.index)+se+B.slice(H.index+H.full.length);continue}let Q=R.componentsDir||"components",Z=await Xe(q,{},"",Q,_,k,R,new Set,T??new Set);B=B.slice(0,H.index)+Z+B.slice(H.index+H.full.length)}catch(q){let Q=q instanceof Error?q.message:String(q),Z=`<!-- dynamic component error: ${Ea(Q)} -->`;B=B.slice(0,H.index)+Z+B.slice(H.index+H.full.length)}}return B}var Si="X-STX-Build",yu=Symbol.for("stx.buildId");function Es(){let v=globalThis;if(!v[yu])v[yu]=process.env.STX_BUILD_ID||`${Date.now().toString(36)}${Math.random().toString(36).slice(2,8)}`;return v[yu]}function um(v,_=Es()){if(v.includes('name="stx-build"'))return null;if(!/<head\b[^>]*>/i.test(v))return null;return`
2556
- <meta name="stx-build" content="${_}">`}function zw(v){if(typeof navigator>"u"||!("serviceWorker"in navigator)||!navigator.serviceWorker)return;let _=navigator.serviceWorker,k=window;if(k.stxOffline)return;let R=null,T=!1,B=[],z={updateReady:!1,reachable:!0,reachedAt:0,registration:()=>R,onUpdateReady(H){if(z.updateReady)try{H()}catch{}else B.push(H);return()=>{let q=B.indexOf(H);if(q!==-1)B.splice(q,1)}},applyUpdate(){let H=R&&R.waiting;if(!H)return!1;return T=!0,H.postMessage({type:"stx:activate-update",force:!0}),!0}};k.stxOffline=z;let W=(H)=>{if(!H.waiting||!_.controller||z.updateReady)return;z.updateReady=!0;let q=B.splice(0);for(let Q of q)try{Q()}catch{}try{window.dispatchEvent(new CustomEvent("stx:offline-update-ready"))}catch{}};_.addEventListener("message",(H)=>{let q=H.data||{};if(q.type==="stx:updated")try{window.dispatchEvent(new CustomEvent("stx:updated",{detail:{url:q.url,kind:q.kind,fragment:!!q.fragment}}))}catch{}if(q.type==="stx:reachability"){if(k.stxOffline.reachable=q.reachable!==!1,Number(q.at)>0)k.stxOffline.reachedAt=Number(q.at);try{window.dispatchEvent(new CustomEvent("stx:reachability",{detail:{reachable:q.reachable!==!1,at:Number(q.at)||0}}))}catch{}}}),_.addEventListener("controllerchange",()=>{if(T)T=!1,location.reload()}),document.addEventListener("visibilitychange",()=>{if(document.visibilityState==="hidden"&&R&&R.waiting)R.waiting.postMessage({type:"stx:activate-update",reason:"hidden"})});let F=()=>{_.register(v,{scope:"/"}).then((H)=>{R=H;try{_.controller?.postMessage({type:"stx:reachability?"})}catch{}if(H.waiting)W(H),H.waiting.postMessage({type:"stx:activate-update",reason:"load"});H.addEventListener("updatefound",()=>{let q=H.installing;if(!q)return;q.addEventListener("statechange",()=>{if(q.state==="installed")W(H)})})}).catch(()=>{})},V=()=>{let H=(q)=>{setTimeout(q,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 Ww(){let v=`(${zw.toString()})(${JSON.stringify("/_stx/sw.js")})`;try{return new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync(v).trim().replace(/;$/,"")}catch{return v}}var dm=`<script data-stx-offline>${Ww()}</script>`;import{AsyncLocalStorage as Fw}from"async_hooks";var fm=new Fw;function gn(v){return v.__stx_server_data??={pending:new Map,values:new Map}}function pm(v,_){return fm.run(gn(v),_)}async function gm(v,_){let k=fm.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 R=k.pending.get(v);if(R)return R;let T=Promise.resolve().then(_).then((B)=>{let z=JSON.stringify(B,(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}),W=JSON.parse(z);return k.values.set(v,W),W}).catch((B)=>{throw k.pending.delete(v),B});return k.pending.set(v,T),T}function er(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 Vw=/<\/(script)/gi;function Ai(v){if(!v||v.indexOf("</")===-1)return v;return v.replace(Vw,"<\\/$1")}import mm from"path";function L(v,_={}){return new An(v,_).routes}var hm=new Map;async function ym(v,_){let k=v,R=_;if(!k||!R)try{let W=await o();k||=W?.pagesDir||"pages",R||=W?.root||"."}catch{k||="pages",R||="."}let T=mm.isAbsolute(k)?k:mm.join(R,k),B=hm.get(T);if(B)return B;let z=[];try{z=L(".",{pagesDir:T,emit:!1}).map((W)=>W.regex.source).filter(Boolean)}catch{z=[]}return hm.set(T,z),z}function Hw(v){return v.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function xm(v){return Hw(JSON.stringify(v))}function ue(v){return v.includes("data-stx-runtime")}function bm(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 R=v.slice(Math.max(0,k.index-80),k.index);if(/if\s*\(\s*window\.stx\s*\)|window\.stx\s*&&/.test(R))continue;return!0}return!1}function xu(v,_){let k=Qi(v),R=v.search(/<!doctype\b/i);if(k!==-1&&(R===-1||k>R))return v.slice(0,k)+_+`
2555
+ @endonce`;_=_.slice(0,B.outerStart)+F+_.slice(B.outerEnd),k=B.outerStart+F.length}return _}function Nw(v){return v.replace(/\bv-memo="([^"]*)"/g,'data-stx-memo="$1"')}function jw(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 im(v){if(!kw(v))return v;let _=v;return _=Ew(_),_=Cw(_),_=Ow(_),_=Aw(_),_=Iw(_),_=Tw(_),_=Rw(_),_=jw(_),_=Pw(_),_=Dw(_),_=Mw(_),_=Nw(_),_}function Ea(v){return v.replace(/--/g,"- -").replace(/</g,"&lt;").replace(/>/g,"&gt;")}var iu=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"]),Lw=new Set(["area","base","br","col","embed","hr","img","input","link","meta","source","track","wbr"]);function om(v,_){let k=/^\s*\{\{\s*([\s\S]+?)\s*\}\}\s*$/.exec(v),R=k?k[1]:v,T=l(R,_);if(T&&typeof T==="string")return T;let B=R.trim();return iu.has(B)?B:null}function am(v){let _=/^\s*\{\{\s*([\s\S]+?)\s*\}\}\s*$/.exec(v);return _?_[1]:v}function cm(v,_,k){let R=_.replace(/\s*(?::is|v-bind:is)\s*=\s*"[^"]*"/gi,"").trim(),T=R?`<${v} ${R}>`:`<${v}>`;if(Lw.has(v))return R?`<${v} ${R}>`:`<${v}>`;return`${T}${k}</${v}>`}async function lm(v,_,k,R,T){let B=v,z=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*)>([\s\S]*?)<\/component>/gi,W=[],F;while((F=z.exec(B))!==null)W.push({full:F[0],expr:F[1],attrs:F[2],slotContent:F[3],index:F.index});for(let V=W.length-1;V>=0;V--){let H=W[V];try{let q=om(H.expr,_);if(!q||typeof q!=="string"){let le=`<!-- dynamic component: could not resolve "${Ea(am(H.expr))}" -->`;B=B.slice(0,H.index)+le+B.slice(H.index+H.full.length);continue}if(iu.has(q)){let le=cm(q,H.attrs,H.slotContent);B=B.slice(0,H.index)+le+B.slice(H.index+H.full.length);continue}let Q=H.attrs.trim(),Z={},se=/(?::([a-zA-Z_][a-zA-Z0-9_-]*)|([a-zA-Z_][a-zA-Z0-9_-]*))\s*=\s*"([^"]*)"/g,ie;while((ie=se.exec(Q))!==null){let le=ie[1]||ie[2],ce=ie[3];if(ie[1])try{Z[le]=l(ce,_)}catch{Z[le]=ce}else Z[le]=ce}let oe=R.componentsDir||"components",ae=await Xe(q,Z,H.slotContent,oe,_,k,R,new Set,T??new Set);B=B.slice(0,H.index)+ae+B.slice(H.index+H.full.length)}catch(q){let Q=q instanceof Error?q.message:String(q),Z=`<!-- dynamic component error: ${Ea(Q)} -->`;B=B.slice(0,H.index)+Z+B.slice(H.index+H.full.length)}}return B=await Bw(B,_,k,R,T),B}async function Bw(v,_,k,R,T){let B=v,z=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*?)\/>/gi,W=[],F;while((F=z.exec(B))!==null)W.push({full:F[0],expr:F[1],attrs:F[2],index:F.index});for(let V=W.length-1;V>=0;V--){let H=W[V];try{let q=om(H.expr,_);if(!q||typeof q!=="string"){let se=`<!-- dynamic component: could not resolve "${Ea(am(H.expr))}" -->`;B=B.slice(0,H.index)+se+B.slice(H.index+H.full.length);continue}if(iu.has(q)){let se=cm(q,H.attrs,"");B=B.slice(0,H.index)+se+B.slice(H.index+H.full.length);continue}let Q=R.componentsDir||"components",Z=await Xe(q,{},"",Q,_,k,R,new Set,T??new Set);B=B.slice(0,H.index)+Z+B.slice(H.index+H.full.length)}catch(q){let Q=q instanceof Error?q.message:String(q),Z=`<!-- dynamic component error: ${Ea(Q)} -->`;B=B.slice(0,H.index)+Z+B.slice(H.index+H.full.length)}}return B}var Si="X-STX-Build",ou=Symbol.for("stx.buildId");function Es(){let v=globalThis;if(!v[ou])v[ou]=process.env.STX_BUILD_ID||`${Date.now().toString(36)}${Math.random().toString(36).slice(2,8)}`;return v[ou]}function um(v,_=Es()){if(v.includes('name="stx-build"'))return null;if(!/<head\b[^>]*>/i.test(v))return null;return`
2556
+ <meta name="stx-build" content="${_}">`}function zw(v){if(typeof navigator>"u"||!("serviceWorker"in navigator)||!navigator.serviceWorker)return;let _=navigator.serviceWorker,k=window;if(k.stxOffline)return;let R=null,T=!1,B=[],z={updateReady:!1,reachable:!0,reachedAt:0,registration:()=>R,onUpdateReady(H){if(z.updateReady)try{H()}catch{}else B.push(H);return()=>{let q=B.indexOf(H);if(q!==-1)B.splice(q,1)}},applyUpdate(){let H=R&&R.waiting;if(!H)return!1;return T=!0,H.postMessage({type:"stx:activate-update",force:!0}),!0}};k.stxOffline=z;let W=(H)=>{if(!H.waiting||!_.controller||z.updateReady)return;z.updateReady=!0;let q=B.splice(0);for(let Q of q)try{Q()}catch{}try{window.dispatchEvent(new CustomEvent("stx:offline-update-ready"))}catch{}};_.addEventListener("message",(H)=>{let q=H.data||{};if(q.type==="stx:updated")try{window.dispatchEvent(new CustomEvent("stx:updated",{detail:{url:q.url,kind:q.kind,fragment:!!q.fragment}}))}catch{}if(q.type==="stx:reachability"){if(k.stxOffline.reachable=q.reachable!==!1,Number(q.at)>0)k.stxOffline.reachedAt=Number(q.at);try{window.dispatchEvent(new CustomEvent("stx:reachability",{detail:{reachable:q.reachable!==!1,at:Number(q.at)||0}}))}catch{}}}),_.addEventListener("controllerchange",()=>{if(T)T=!1,location.reload()}),document.addEventListener("visibilitychange",()=>{if(document.visibilityState==="hidden"&&R&&R.waiting)R.waiting.postMessage({type:"stx:activate-update",reason:"hidden"})});let F=()=>{_.register(v,{scope:"/"}).then((H)=>{R=H;try{_.controller?.postMessage({type:"stx:reachability?"})}catch{}if(H.waiting)W(H),H.waiting.postMessage({type:"stx:activate-update",reason:"load"});H.addEventListener("updatefound",()=>{let q=H.installing;if(!q)return;q.addEventListener("statechange",()=>{if(q.state==="installed")W(H)})})}).catch(()=>{})},V=()=>{let H=(q)=>{setTimeout(q,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 Ww(){let v=`(${zw.toString()})(${JSON.stringify("/_stx/sw.js")})`;try{return new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync(v).trim().replace(/;$/,"")}catch{return v}}var dm=`<script data-stx-offline>${Ww()}</script>`;import{AsyncLocalStorage as Fw}from"async_hooks";var fm=new Fw;function gn(v){return v.__stx_server_data??={pending:new Map,values:new Map}}function pm(v,_){return fm.run(gn(v),_)}async function gm(v,_){let k=fm.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 R=k.pending.get(v);if(R)return R;let T=Promise.resolve().then(_).then((B)=>{let z=JSON.stringify(B,(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}),W=JSON.parse(z);return k.values.set(v,W),W}).catch((B)=>{throw k.pending.delete(v),B});return k.pending.set(v,T),T}function tr(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 Vw=/<\/(script)/gi;function Ai(v){if(!v||v.indexOf("</")===-1)return v;return v.replace(Vw,"<\\/$1")}import mm from"path";function L(v,_={}){return new An(v,_).routes}var hm=new Map;async function ym(v,_){let k=v,R=_;if(!k||!R)try{let W=await o();k||=W?.pagesDir||"pages",R||=W?.root||"."}catch{k||="pages",R||="."}let T=mm.isAbsolute(k)?k:mm.join(R,k),B=hm.get(T);if(B)return B;let z=[];try{z=L(".",{pagesDir:T,emit:!1}).map((W)=>W.regex.source).filter(Boolean)}catch{z=[]}return hm.set(T,z),z}function Hw(v){return v.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function xm(v){return Hw(JSON.stringify(v))}function de(v){return v.includes("data-stx-runtime")}function bm(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 R=v.slice(Math.max(0,k.index-80),k.index);if(/if\s*\(\s*window\.stx\s*\)|window\.stx\s*&&/.test(R))continue;return!0}return!1}function au(v,_){let k=Qi(v),R=v.search(/<!doctype\b/i);if(k!==-1&&(R===-1||k>R))return v.slice(0,k)+_+`
2557
2557
  `+v.slice(k);let T=bn(v);if(T!==null)return`${v.slice(0,T)}
2558
2558
  ${_}${v.slice(T)}`;if(v.includes("</head>")){let z=v.indexOf("</head>");return v.slice(0,z)+_+`
2559
2559
  `+v.slice(z)}if(Bn(v))return fs(v,(z)=>`${z}
2560
2560
  ${_}`);return`${_}
2561
- ${v}`}async function Ca(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-y1bppxgw.js"),{url:B}=await T("runtime",_.debug===!0);return xu(v,`<script data-stx-runtime src="${B}"></script>`)}if(_.buildMode==="compile")return xu(v,'<script data-stx-runtime src="/__stx/runtime.__STX_HASH__.js"></script>');let{getCachedSignalsRuntime:k}=await import("./chunk-y1bppxgw.js"),R=await k(_.debug);return xu(v,`<script data-stx-scoped data-stx-runtime>${R}</script>`)}function qw(v){return/<[a-z][^>]*?\sx-tooltip\s*=/i.test(v)}function vm(v){if(v.includes("data-stx-tooltip-runtime")||!qw(v))return v;let _=`<script data-stx-scoped data-stx-tooltip-runtime>${Ul()}</script>`,k=v.lastIndexOf("</body>");if(k===-1)return`${v}
2561
+ ${v}`}async function Ca(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-fvx6pd66.js"),{url:B}=await T("runtime",_.debug===!0);return au(v,`<script data-stx-runtime src="${B}"></script>`)}if(_.buildMode==="compile")return au(v,'<script data-stx-runtime src="/__stx/runtime.__STX_HASH__.js"></script>');let{getCachedSignalsRuntime:k}=await import("./chunk-fvx6pd66.js"),R=await k(_.debug);return au(v,`<script data-stx-scoped data-stx-runtime>${R}</script>`)}function qw(v){return/<[a-z][^>]*?\sx-tooltip\s*=/i.test(v)}function vm(v){if(v.includes("data-stx-tooltip-runtime")||!qw(v))return v;let _=`<script data-stx-scoped data-stx-tooltip-runtime>${Ul()}</script>`,k=v.lastIndexOf("</body>");if(k===-1)return`${v}
2562
2562
  ${_}`;return`${v.slice(0,k)}${_}
2563
2563
  ${v.slice(k)}`}var Kw=/<script\b[^>]*\sdata-stx-router(?=[\s=>])/i;function Xw(v){return Kw.test(v)||v.includes("__stxRouter)return")||v.includes("__stxRouter=true")}async function J(v,_){if(!v.includes("</body>"))return v;if(Xw(v))return v;let k=_?.router,R="";{let F={};if(k){if(k.container)F.container=k.container;if(k.interceptAllLinks!==void 0)F.interceptAllLinks=k.interceptAllLinks;if(k.progress!==void 0)F.progress=k.progress;if(k.viewTransitions!==void 0)F.viewTransitions=k.viewTransitions;if(k.viewTransitionDuration!==void 0)F.viewTransitionDuration=k.viewTransitionDuration;if(k.viewTransitionEasing!==void 0)F.viewTransitionEasing=k.viewTransitionEasing;if(k.scrollToTop!==void 0)F.scrollToTop=k.scrollToTop;if(k.scrollRestoration!==void 0)F.scrollRestoration=k.scrollRestoration;if(k.prefetch!==void 0)F.prefetch=k.prefetch;if(k.cache!==void 0)F.cache=k.cache;if(k.progressColor!==void 0)F.progressColor=k.progressColor;if(k.progressHeight!==void 0)F.progressHeight=k.progressHeight;if(k.prefetchVisible!==void 0)F.prefetchVisible=k.prefetchVisible;if(k.prefetchVisibleMax!==void 0)F.prefetchVisibleMax=k.prefetchVisibleMax;if(k.keepOpening!==void 0)F.keepOpening=k.keepOpening}try{let V=await ym(_?.pagesDir,_?.root);if(V.length>0)F.ownedRoutes=V}catch{}if(Object.keys(F).length>0)R=`<script>window.__stxRouterConfig=${xm(F)};</script>
2564
- `}let{getCachedRouterScript:T,getServeClientAsset:B}=await import("./chunk-y1bppxgw.js"),z=_?.buildMode==="compile"?'<script data-stx-router src="/__stx/router.__STX_HASH__.js"></script>':_?.buildMode==="serve"?`<script data-stx-router src="${(await B("router")).url}"></script>`:`<script data-stx-router>${await T()}</script>`,W=v.lastIndexOf("</body>");return v.slice(0,W)+R+z+`
2565
- </body>`+v.slice(W+7)}var wm=Symbol.for("stx.lazy-module-promises");function Zw(){let v=globalThis;return v[wm]??=new Map,v[wm]}function ht(v,_){let k=Zw(),R=`${import.meta.url}\x00${v}`,T=k.get(R);if(T)return T;let B=_();return k.set(R,B),B.catch(()=>{if(k.get(R)===B)k.delete(R)}),B}var bu=`(?:"[^"]*"|'[^']*'|[^>"'])*`,Rm=/^<([a-zA-Z][a-zA-Z0-9-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)>([\s\S]*)<\/\1>$/s,Gw=65536,Jw=4,Ta=new Map;function ou(){Ta.clear()}function Yw(v){let _=[];for(let k of ee(v,U)){let R=k.token.match(/^<script\b([^>]*)>/i),T=k.token.match(/<\/script\s*>$/i);if(!R||!T)continue;let B=R[0].length,z=k.token.length-T[0].length;_.push(Object.freeze({fullMatch:k.token,attrs:R[1],body:k.token.slice(B,z),start:k.start,end:k.end}))}return _}function _c(v,_={}){let k=v.length>=Gw,R=k?Ta.get(v):void 0;if(R===void 0){if(R=Yw(v),k)ld(Ta,Jw),Ta.set(v,R)}let T=_.skipAttrs;if(!T)return R.slice();let B=[];for(let z of R)if(T.lastIndex=0,!T.test(z.attrs))B.push(z);return B}function ys(v){let _=v.trim(),k=_.match(/^([\s\S]+?)\s+as\s+(.+)$/);if(k){let T=k[1].trim(),B=k[2].trim(),{itemVar:z,indexVar:W}=Sm(B);if(z)return{style:"as",iterable:T,itemVar:z,indexVar:W}}let R=_.match(/^(\([^)]+\)|\w+(?:\s*,\s*\w+)?)\s+(?:in|of)\s+([\s\S]+)$/);if(R){let T=R[1].trim(),B=R[2].trim(),{itemVar:z,indexVar:W}=Sm(T);if(z)return{style:"in",iterable:B,itemVar:z,indexVar:W}}return{style:"unknown",iterable:null,itemVar:null,indexVar:null}}function Sm(v){let _=v.trim(),k=_.match(/^(\w+)\s*=>\s*(\w+)$/);if(k)return{itemVar:k[2],indexVar:k[1]};let R=_.match(/^\(\s*(\w+)(?:\s*,\s*(\w+))?\s*\)$/);if(R)return{itemVar:R[1],indexVar:R[2]||null};let T=_.match(/^(\w+)\s*,\s*(\w+)$/);if(T)return{itemVar:T[1],indexVar:T[2]};let B=_.match(/^(\w+)$/);if(B)return{itemVar:B[1],indexVar:null};return{itemVar:null,indexVar:null}}function bs(v,_){return Vi(v,_)}function Qw(v){let _=/@(if\s*\(|endif|elseif\s*\(|else\b)/g,k=0,R;while((R=_.exec(v))!==null){let T=R[1];if(T.startsWith("if"))k++;else if(T==="endif")k--;else if(k===0)return!0}return!1}function Tm(v){let _=new Set,k=/<script\b(?![^>]*\bserver\b)(?![^>]*\bsrc\s*=)[^>]*>([\s\S]*?)<\/script>/gi,R=/\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 B=T[1],z;while((z=R.exec(B))!==null)_.add(z[1])}return _}function eS(v){if(!/[:@]for\s*=/.test(v)&&!/\bx-for\s*=/.test(v))return[];let _=new RegExp(`<([a-zA-Z][\\w-]*)\\b(${bu})>`,"iy"),k=/(?:^|\s)(?::for|@for|x-for)\s*=\s*(?:"([^"]*)"|'([^']*)')/i,R=ee(v,(B,z)=>{_.lastIndex=z;let W=_.exec(B);if(!W||W.index!==z||!k.test(W[2]))return-1;return _.lastIndex}),T=[];for(let B of R){_.lastIndex=0;let z=_.exec(B.token);if(!z)continue;let W=z[2].match(k),F=ys(W?.[1]??W?.[2]??""),V=[F.itemVar,F.indexVar].filter(Boolean);if(V.length===0)continue;let H=z[1],Q=/\/\s*>$/.test(B.token)||Aa.has(H.toLowerCase())?B.end:wu(v,B.start,H,B.end);if(Q!==-1)T.push({start:B.start,end:Q,vars:new Set(V)})}return T}var $m=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 tS(v){return v.replace(/'(?:\\.|[^'\\])*'/g,"''").replace(/"(?:\\.|[^"\\])*"/g,'""').replace(/`(?:\\.|[^`\\])*`/g,"``")}function _m(v,_,k,R){if(!v)return!1;let T=tS(v),B=!1,z=!1,W=!1,F=/([a-zA-Z_$][\w$]*)/g,V;while((V=F.exec(T))!==null){let Z=V[1];if(T.slice(0,V.index).trimEnd().endsWith("."))continue;if($m.has(Z))continue;if(_.has(Z)||R?.has(Z))B=!0;else if(k&&Z in k)z=!0}let H=/([a-zA-Z_$][\w$]*)(?:\.[a-zA-Z_$][\w$]*)*\s*\(\s*\)/g,q;while((q=H.exec(T))!==null){let Z=q[1];if(T.slice(0,q.index).trimEnd().endsWith("."))continue;if($m.has(Z)||k&&Z in k)continue;W=!0}return(B||W)&&!z}function Ra(v,_,k){let R=k===void 0?` ${_}`:` ${_}="${k.replace(/"/g,"&quot;")}"`,T=v.trim(),B=T.match(Rm);if(B&&nS(B[3],B[1])){let[,z,W,F]=B;return`<${z}${W}${R}>${F}</${z}>`}return`<template${R}>${T}</template>`}function nS(v,_){let k=new RegExp(`<(/)?${_}(?=[\\s/>])`,"gi"),R=0,T;while((T=k.exec(v))!==null)if(T[1]){if(R--,R<0)return!1}else R++;return!0}function gi(v,_){let k=Tm(v);function R(T){let B=T,z=eS(T),W=(q)=>{let Q=new Set;for(let Z of z)if(q>Z.start&&q<Z.end)for(let se of Z.vars)Q.add(se);return Q},F=/@if\s*\(/g,V,H=[];while((V=F.exec(B))!==null){let q=V.index,Q=q+V[0].length,Z=1,se=Q;while(se<B.length&&Z>0){if(B[se]==="(")Z++;else if(B[se]===")")Z--;se++}if(Z!==0)continue;let ie=B.substring(Q,se-1).trim(),oe=se,ae=1,le=oe,ce=/@(if\s*\(|endif)/g;ce.lastIndex=oe;let ge;while((ge=ce.exec(B))!==null)if(ge[1].startsWith("if"))ae++;else if(ge[1]==="endif"){if(ae--,ae===0){le=ge.index+ge[0].length;break}}if(ae!==0)continue;let $e=B.substring(oe,le-6).trim(),ye;if(Qw($e)){let ke=so(B.substring(q,le));if(ke.length===0)continue;let Re=ke[0].branches.filter((Ee)=>Ee.type!=="else"),Ae=W(q);if(!(Re.length>0&&Re.every((Ee)=>_m(Ee.condition,k,_,Ae))))continue;ye=ke[0].branches.map((Ee)=>{let Me=R(Ee.content);if(Ee.type==="elseif")return Ra(Me,"@else-if",Ee.condition??"");if(Ee.type==="else")return Ra(Me,"@else");return Ra(Me,"@if",Ee.condition??"")}).join(`
2566
- `)}else{if(!_m(ie,k,_,W(q)))continue;ye=Ra(R($e),"@if",ie)}H.push({start:q,end:le,replacement:ye}),F.lastIndex=le}for(let q=H.length-1;q>=0;q--){let{start:Q,end:Z,replacement:se}=H[q];B=B.substring(0,Q)+se+B.substring(Z)}return B}return R(v)}function rS(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 R=_.match(/^"((?:\\.|[^"\\])*)"$/);if(R)return R[1].length>0;return}var Aa=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),km=/<(script|style)\b/iy,sS=/<\/script/gi,iS=/<\/style/gi;function wu(v,_,k,R){if(Aa.has(k.toLowerCase()))return R;let T=k.toLowerCase(),B=v.length,z=1,W=R;while(W<B){let F=v.indexOf("<",W);if(F===-1)return-1;if(W=F,v.startsWith("<!--",W)){let Q=v.indexOf("-->",W+4);if(Q===-1)return-1;W=Q+3;continue}km.lastIndex=W;let V=km.exec(v);if(V){let Q=v.indexOf(">",W);if(Q===-1)return-1;if(v[Q-1]==="/"){W=Q+1;continue}let Z=V[1].toLowerCase()==="script"?sS:iS;Z.lastIndex=W;let se=Z.exec(v);if(se===null)return-1;let ie=v.indexOf(">",se.index);if(ie===-1)return-1;W=ie+1;continue}if(v[W+1]==="/"){let Q=/^<\/([a-z][\w-]*)\s*>/i.exec(v.slice(W,W+64));if(!Q){W++;continue}if(Q[1].toLowerCase()===T){if(z--,W+=Q[0].length,z===0)return W;continue}W+=Q[0].length;continue}let H=/^<([a-z][\w-]*)\b/i.exec(v.slice(W,W+64));if(!H){W++;continue}let q=v.indexOf(">",W);if(q===-1)return-1;if(H[1].toLowerCase()===T){let Q=v.slice(W,q+1);if(!(/\/\s*>$/.test(Q)||Aa.has(T)))z++}W=q+1}return-1}var oS=/\s(?::else-if|x-else-if|@else-if|:else|x-else|@else)(?=[=\s/>])/;function aS(v,_){let k=_,R=v.length;for(;;){while(k<R&&v[k]!=="<")k++;if(k>=R)return!1;if(v.startsWith("<!--",k)){let z=v.indexOf("-->",k+4);if(z===-1)return!1;k=z+3;continue}break}if(v[k+1]==="/")return!1;let T=v.indexOf(">",k);if(T===-1)return!1;let B=v.slice(k,T+1);return oS.test(B)}function mi(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,R;while((R=k.exec(v))!==null)_.push([R.index,R.index+R[0].length]);let T=(q)=>_.some(([Q,Z])=>q>=Q&&q<Z),B=/<([a-zA-Z][\w-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*?)\s+(:if|:show|x-if|x-show|@if|@show)\s*=\s*"([^"]*)"((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)(\/?)>/g,z=[],W;while((W=B.exec(v))!==null){if(T(W.index))continue;let[q,Q,Z,se,ie,oe,ae]=W,le=rS(ie);if(le===void 0)continue;let ce=W.index,ge=ce+q.length,ke=!!ae||/\/\s*>$/.test(q)||Aa.has(Q.toLowerCase())?ge:wu(v,ce,Q,ge);if(ke===-1)continue;if((se===":if"||se==="x-if"||se==="@if")&&aS(v,ke)){B.lastIndex=ge;continue}if(le===!0){let Ae=`<${Q}${Z}${oe}${ae}>`;z.push({start:ce,end:ge,replacement:Ae});continue}z.push({start:ce,end:ke,replacement:""}),B.lastIndex=ke}if(z.length===0)return v;z.sort((q,Q)=>q.start-Q.start);let F=[],V=-1;for(let q of z){if(q.start<V)continue;F.push(q),V=q.end}let H=v;for(let q=F.length-1;q>=0;q--){let{start:Q,end:Z,replacement:se}=F[q];H=H.substring(0,Q)+se+H.substring(Z)}return H}var Em=[":for","@for","x-for"];function ws(v,_){if(!_||Object.keys(_).length===0)return v;if(!Em.some((W)=>v.includes(`${W}=`)))return v;let k=Tm(v);if(Array.isArray(_.__stx_client_signal_names)){for(let W of _.__stx_client_signal_names)if(typeof W==="string")k.add(W)}let R=v,T=[],B=/<([a-zA-Z][\w-]*)((?:[^>"']|"[^"]*"|'[^']*')*)>/g,z;while((z=B.exec(R))!==null){let[W,F,V]=z,H=z.index,q=H+W.length,Q=Em.map((ye)=>({attr:ye,m:new RegExp(`\\s${ye}="([^"]*)"`).exec(V)})).find((ye)=>ye.m!==null);if(!Q||!Q.m)continue;let Z=ys(Q.m[1]);if(!Z.iterable||!Z.itemVar)continue;let se=Z.iterable.trim().split(/[.[(]/)[0].trim();if(!se||k.has(se)||!(se in _))continue;let ie=wu(R,H,F,q);if(ie===-1)continue;let oe=V.replace(new RegExp(`\\s${Q.attr}="[^"]*"`),"").replace(/\s:key="[^"]*"/,"").replace(/\sx-cloak(?=\s|$)/,""),ae=R.slice(q,ie-`</${F}>`.length),le={..._,[Z.itemVar]:void 0};if(Z.indexVar)le[Z.indexVar]=void 0;let ce=ws(ae,le),ge=Z.indexVar?`${Z.iterable} as ${Z.indexVar} => ${Z.itemVar}`:`${Z.iterable} as ${Z.itemVar}`,$e=F.toLowerCase()==="template"?ce:`<${F}${oe}>${ce}</${F}>`;T.push({start:H,end:ie,replacement:`@foreach(${ge})${$e}@endforeach`}),B.lastIndex=ie}for(let W=T.length-1;W>=0;W--){let{start:F,end:V,replacement:H}=T[W];R=R.slice(0,F)+H+R.slice(V)}return R}function vs(v,_){let k=v,R=/@(for|foreach)\s*\(/g,T,B=[],z=[];while((T=R.exec(k))!==null){let W=T[1],F=T.index,V=F+T[0].length,H=1,q=V;while(q<k.length&&H>0){if(k[q]==="(")H++;else if(k[q]===")")H--;q++}if(H!==0)continue;let Q=k.substring(V,q-1).trim(),Z=q,se=ys(Q),ie=W==="for"?"@endfor":"@endforeach",oe=1,ae=Z,le=W==="for"?new RegExp("@(for(?!each)\\s*\\(|endfor(?!each))","g"):new RegExp(`@(${W}\\s*\\(|end${W})`,"g");le.lastIndex=Z;let ce;while((ce=le.exec(k))!==null)if(ce[1].startsWith(W))oe++;else if(oe--,oe===0){ae=ce.index+ce[0].length;break}if(oe!==0)continue;let ge=()=>{let Ie=[se.itemVar,se.indexVar].filter(Boolean);if(Ie.length)z.push({start:F,end:ae,vars:Ie})};if(se.iterable){let Ie=se.iterable.trim();if(Ie.startsWith("[")||Ie.startsWith("{")||Ie.startsWith("'")||Ie.startsWith('"')||Ie.startsWith("`")||/^-?\d/.test(Ie)){ge();continue}let Pe=Ie.split(/[.[(]/)[0].trim(),Ee=_?Pe in _:!1,Me=z.some((je)=>F>je.start&&F<je.end&&je.vars.includes(Pe));if(Pe&&(Ee||Me)){ge();continue}}if(se.style==="as")Q=se.indexVar?`(${se.itemVar}, ${se.indexVar}) in ${se.iterable}`:`${se.itemVar} in ${se.iterable}`;let $e=k.substring(Z,ae-ie.length).trim(),ye=_?{..._}:{};if(se.itemVar)delete ye[se.itemVar];if(se.indexVar)delete ye[se.indexVar];let ke=vs($e,ye),Re=ke.match(Rm),Ae;if(Re){let[,Ie,Pe,Ee]=Re;Ae=`<${Ie}${Pe} @for="${Q}">${Ee}</${Ie}>`}else Ae=`<template @for="${Q}">${ke}</template>`;B.push({start:F,end:ae,replacement:Ae}),R.lastIndex=ae}for(let W=B.length-1;W>=0;W--){let{start:F,end:V,replacement:H}=B[W];k=k.substring(0,F)+H+k.substring(V)}return k}function cS(v){let _=new Set,k=[],R=0,T=0,B=v.length,z=(H)=>{let q=R+1;while(q<B){let Q=v[q];if(Q==="\\"){q+=2;continue}if(Q===H)return q+1;q++}return B},W=()=>{let H=R+2;while(H<B&&v[H]!==`
2564
+ `}let{getCachedRouterScript:T,getServeClientAsset:B}=await import("./chunk-fvx6pd66.js"),z=_?.buildMode==="compile"?'<script data-stx-router src="/__stx/router.__STX_HASH__.js"></script>':_?.buildMode==="serve"?`<script data-stx-router src="${(await B("router")).url}"></script>`:`<script data-stx-router>${await T()}</script>`,W=v.lastIndexOf("</body>");return v.slice(0,W)+R+z+`
2565
+ </body>`+v.slice(W+7)}var wm=Symbol.for("stx.lazy-module-promises");function Zw(){let v=globalThis;return v[wm]??=new Map,v[wm]}function ht(v,_){let k=Zw(),R=`${import.meta.url}\x00${v}`,T=k.get(R);if(T)return T;let B=_();return k.set(R,B),B.catch(()=>{if(k.get(R)===B)k.delete(R)}),B}var cu=`(?:"[^"]*"|'[^']*'|[^>"'])*`,Rm=/^<([a-zA-Z][a-zA-Z0-9-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)>([\s\S]*)<\/\1>$/s,Gw=65536,Jw=4,Ta=new Map;function od(){Ta.clear()}function Yw(v){let _=[];for(let k of ee(v,U)){let R=k.token.match(/^<script\b([^>]*)>/i),T=k.token.match(/<\/script\s*>$/i);if(!R||!T)continue;let B=R[0].length,z=k.token.length-T[0].length;_.push(Object.freeze({fullMatch:k.token,attrs:R[1],body:k.token.slice(B,z),start:k.start,end:k.end}))}return _}function _c(v,_={}){let k=v.length>=Gw,R=k?Ta.get(v):void 0;if(R===void 0){if(R=Yw(v),k)$d(Ta,Jw),Ta.set(v,R)}let T=_.skipAttrs;if(!T)return R.slice();let B=[];for(let z of R)if(T.lastIndex=0,!T.test(z.attrs))B.push(z);return B}function ys(v){let _=v.trim(),k=_.match(/^([\s\S]+?)\s+as\s+(.+)$/);if(k){let T=k[1].trim(),B=k[2].trim(),{itemVar:z,indexVar:W}=Sm(B);if(z)return{style:"as",iterable:T,itemVar:z,indexVar:W}}let R=_.match(/^(\([^)]+\)|\w+(?:\s*,\s*\w+)?)\s+(?:in|of)\s+([\s\S]+)$/);if(R){let T=R[1].trim(),B=R[2].trim(),{itemVar:z,indexVar:W}=Sm(T);if(z)return{style:"in",iterable:B,itemVar:z,indexVar:W}}return{style:"unknown",iterable:null,itemVar:null,indexVar:null}}function Sm(v){let _=v.trim(),k=_.match(/^(\w+)\s*=>\s*(\w+)$/);if(k)return{itemVar:k[2],indexVar:k[1]};let R=_.match(/^\(\s*(\w+)(?:\s*,\s*(\w+))?\s*\)$/);if(R)return{itemVar:R[1],indexVar:R[2]||null};let T=_.match(/^(\w+)\s*,\s*(\w+)$/);if(T)return{itemVar:T[1],indexVar:T[2]};let B=_.match(/^(\w+)$/);if(B)return{itemVar:B[1],indexVar:null};return{itemVar:null,indexVar:null}}function bs(v,_){return Vi(v,_)}function Qw(v){let _=/@(if\s*\(|endif|elseif\s*\(|else\b)/g,k=0,R;while((R=_.exec(v))!==null){let T=R[1];if(T.startsWith("if"))k++;else if(T==="endif")k--;else if(k===0)return!0}return!1}function Tm(v){let _=new Set,k=/<script\b(?![^>]*\bserver\b)(?![^>]*\bsrc\s*=)[^>]*>([\s\S]*?)<\/script>/gi,R=/\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 B=T[1],z;while((z=R.exec(B))!==null)_.add(z[1])}return _}function eS(v){if(!/[:@]for\s*=/.test(v)&&!/\bx-for\s*=/.test(v))return[];let _=new RegExp(`<([a-zA-Z][\\w-]*)\\b(${cu})>`,"iy"),k=/(?:^|\s)(?::for|@for|x-for)\s*=\s*(?:"([^"]*)"|'([^']*)')/i,R=ee(v,(B,z)=>{_.lastIndex=z;let W=_.exec(B);if(!W||W.index!==z||!k.test(W[2]))return-1;return _.lastIndex}),T=[];for(let B of R){_.lastIndex=0;let z=_.exec(B.token);if(!z)continue;let W=z[2].match(k),F=ys(W?.[1]??W?.[2]??""),V=[F.itemVar,F.indexVar].filter(Boolean);if(V.length===0)continue;let H=z[1],Q=/\/\s*>$/.test(B.token)||Aa.has(H.toLowerCase())?B.end:uu(v,B.start,H,B.end);if(Q!==-1)T.push({start:B.start,end:Q,vars:new Set(V)})}return T}var $m=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 tS(v){return v.replace(/'(?:\\.|[^'\\])*'/g,"''").replace(/"(?:\\.|[^"\\])*"/g,'""').replace(/`(?:\\.|[^`\\])*`/g,"``")}function _m(v,_,k,R){if(!v)return!1;let T=tS(v),B=!1,z=!1,W=!1,F=/([a-zA-Z_$][\w$]*)/g,V;while((V=F.exec(T))!==null){let Z=V[1];if(T.slice(0,V.index).trimEnd().endsWith("."))continue;if($m.has(Z))continue;if(_.has(Z)||R?.has(Z))B=!0;else if(k&&Z in k)z=!0}let H=/([a-zA-Z_$][\w$]*)(?:\.[a-zA-Z_$][\w$]*)*\s*\(\s*\)/g,q;while((q=H.exec(T))!==null){let Z=q[1];if(T.slice(0,q.index).trimEnd().endsWith("."))continue;if($m.has(Z)||k&&Z in k)continue;W=!0}return(B||W)&&!z}function Ra(v,_,k){let R=k===void 0?` ${_}`:` ${_}="${k.replace(/"/g,"&quot;")}"`,T=v.trim(),B=T.match(Rm);if(B&&nS(B[3],B[1])){let[,z,W,F]=B;return`<${z}${W}${R}>${F}</${z}>`}return`<template${R}>${T}</template>`}function nS(v,_){let k=new RegExp(`<(/)?${_}(?=[\\s/>])`,"gi"),R=0,T;while((T=k.exec(v))!==null)if(T[1]){if(R--,R<0)return!1}else R++;return!0}function gi(v,_){let k=Tm(v);function R(T){let B=T,z=eS(T),W=(q)=>{let Q=new Set;for(let Z of z)if(q>Z.start&&q<Z.end)for(let se of Z.vars)Q.add(se);return Q},F=/@if\s*\(/g,V,H=[];while((V=F.exec(B))!==null){let q=V.index,Q=q+V[0].length,Z=1,se=Q;while(se<B.length&&Z>0){if(B[se]==="(")Z++;else if(B[se]===")")Z--;se++}if(Z!==0)continue;let ie=B.substring(Q,se-1).trim(),oe=se,ae=1,le=oe,ce=/@(if\s*\(|endif)/g;ce.lastIndex=oe;let ge;while((ge=ce.exec(B))!==null)if(ge[1].startsWith("if"))ae++;else if(ge[1]==="endif"){if(ae--,ae===0){le=ge.index+ge[0].length;break}}if(ae!==0)continue;let $e=B.substring(oe,le-6).trim(),ye;if(Qw($e)){let ke=so(B.substring(q,le));if(ke.length===0)continue;let Re=ke[0].branches.filter((Ee)=>Ee.type!=="else"),Ae=W(q);if(!(Re.length>0&&Re.every((Ee)=>_m(Ee.condition,k,_,Ae))))continue;ye=ke[0].branches.map((Ee)=>{let Me=R(Ee.content);if(Ee.type==="elseif")return Ra(Me,"@else-if",Ee.condition??"");if(Ee.type==="else")return Ra(Me,"@else");return Ra(Me,"@if",Ee.condition??"")}).join(`
2566
+ `)}else{if(!_m(ie,k,_,W(q)))continue;ye=Ra(R($e),"@if",ie)}H.push({start:q,end:le,replacement:ye}),F.lastIndex=le}for(let q=H.length-1;q>=0;q--){let{start:Q,end:Z,replacement:se}=H[q];B=B.substring(0,Q)+se+B.substring(Z)}return B}return R(v)}function rS(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 R=_.match(/^"((?:\\.|[^"\\])*)"$/);if(R)return R[1].length>0;return}var Aa=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),km=/<(script|style)\b/iy,sS=/<\/script/gi,iS=/<\/style/gi;function uu(v,_,k,R){if(Aa.has(k.toLowerCase()))return R;let T=k.toLowerCase(),B=v.length,z=1,W=R;while(W<B){let F=v.indexOf("<",W);if(F===-1)return-1;if(W=F,v.startsWith("<!--",W)){let Q=v.indexOf("-->",W+4);if(Q===-1)return-1;W=Q+3;continue}km.lastIndex=W;let V=km.exec(v);if(V){let Q=v.indexOf(">",W);if(Q===-1)return-1;if(v[Q-1]==="/"){W=Q+1;continue}let Z=V[1].toLowerCase()==="script"?sS:iS;Z.lastIndex=W;let se=Z.exec(v);if(se===null)return-1;let ie=v.indexOf(">",se.index);if(ie===-1)return-1;W=ie+1;continue}if(v[W+1]==="/"){let Q=/^<\/([a-z][\w-]*)\s*>/i.exec(v.slice(W,W+64));if(!Q){W++;continue}if(Q[1].toLowerCase()===T){if(z--,W+=Q[0].length,z===0)return W;continue}W+=Q[0].length;continue}let H=/^<([a-z][\w-]*)\b/i.exec(v.slice(W,W+64));if(!H){W++;continue}let q=v.indexOf(">",W);if(q===-1)return-1;if(H[1].toLowerCase()===T){let Q=v.slice(W,q+1);if(!(/\/\s*>$/.test(Q)||Aa.has(T)))z++}W=q+1}return-1}var oS=/\s(?::else-if|x-else-if|@else-if|:else|x-else|@else)(?=[=\s/>])/;function aS(v,_){let k=_,R=v.length;for(;;){while(k<R&&v[k]!=="<")k++;if(k>=R)return!1;if(v.startsWith("<!--",k)){let z=v.indexOf("-->",k+4);if(z===-1)return!1;k=z+3;continue}break}if(v[k+1]==="/")return!1;let T=v.indexOf(">",k);if(T===-1)return!1;let B=v.slice(k,T+1);return oS.test(B)}function mi(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,R;while((R=k.exec(v))!==null)_.push([R.index,R.index+R[0].length]);let T=(q)=>_.some(([Q,Z])=>q>=Q&&q<Z),B=/<([a-zA-Z][\w-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*?)\s+(:if|:show|x-if|x-show|@if|@show)\s*=\s*"([^"]*)"((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)(\/?)>/g,z=[],W;while((W=B.exec(v))!==null){if(T(W.index))continue;let[q,Q,Z,se,ie,oe,ae]=W,le=rS(ie);if(le===void 0)continue;let ce=W.index,ge=ce+q.length,ke=!!ae||/\/\s*>$/.test(q)||Aa.has(Q.toLowerCase())?ge:uu(v,ce,Q,ge);if(ke===-1)continue;if((se===":if"||se==="x-if"||se==="@if")&&aS(v,ke)){B.lastIndex=ge;continue}if(le===!0){let Ae=`<${Q}${Z}${oe}${ae}>`;z.push({start:ce,end:ge,replacement:Ae});continue}z.push({start:ce,end:ke,replacement:""}),B.lastIndex=ke}if(z.length===0)return v;z.sort((q,Q)=>q.start-Q.start);let F=[],V=-1;for(let q of z){if(q.start<V)continue;F.push(q),V=q.end}let H=v;for(let q=F.length-1;q>=0;q--){let{start:Q,end:Z,replacement:se}=F[q];H=H.substring(0,Q)+se+H.substring(Z)}return H}var Em=[":for","@for","x-for"];function vs(v,_){if(!_||Object.keys(_).length===0)return v;if(!Em.some((W)=>v.includes(`${W}=`)))return v;let k=Tm(v);if(Array.isArray(_.__stx_client_signal_names)){for(let W of _.__stx_client_signal_names)if(typeof W==="string")k.add(W)}let R=v,T=[],B=/<([a-zA-Z][\w-]*)((?:[^>"']|"[^"]*"|'[^']*')*)>/g,z;while((z=B.exec(R))!==null){let[W,F,V]=z,H=z.index,q=H+W.length,Q=Em.map((ye)=>({attr:ye,m:new RegExp(`\\s${ye}="([^"]*)"`).exec(V)})).find((ye)=>ye.m!==null);if(!Q||!Q.m)continue;let Z=ys(Q.m[1]);if(!Z.iterable||!Z.itemVar)continue;let se=Z.iterable.trim().split(/[.[(]/)[0].trim();if(!se||k.has(se)||!(se in _))continue;let ie=uu(R,H,F,q);if(ie===-1)continue;let oe=V.replace(new RegExp(`\\s${Q.attr}="[^"]*"`),"").replace(/\s:key="[^"]*"/,"").replace(/\sx-cloak(?=\s|$)/,""),ae=R.slice(q,ie-`</${F}>`.length),le={..._,[Z.itemVar]:void 0};if(Z.indexVar)le[Z.indexVar]=void 0;let ce=vs(ae,le),ge=Z.indexVar?`${Z.iterable} as ${Z.indexVar} => ${Z.itemVar}`:`${Z.iterable} as ${Z.itemVar}`,$e=F.toLowerCase()==="template"?ce:`<${F}${oe}>${ce}</${F}>`;T.push({start:H,end:ie,replacement:`@foreach(${ge})${$e}@endforeach`}),B.lastIndex=ie}for(let W=T.length-1;W>=0;W--){let{start:F,end:V,replacement:H}=T[W];R=R.slice(0,F)+H+R.slice(V)}return R}function ws(v,_){let k=v,R=/@(for|foreach)\s*\(/g,T,B=[],z=[];while((T=R.exec(k))!==null){let W=T[1],F=T.index,V=F+T[0].length,H=1,q=V;while(q<k.length&&H>0){if(k[q]==="(")H++;else if(k[q]===")")H--;q++}if(H!==0)continue;let Q=k.substring(V,q-1).trim(),Z=q,se=ys(Q),ie=W==="for"?"@endfor":"@endforeach",oe=1,ae=Z,le=W==="for"?new RegExp("@(for(?!each)\\s*\\(|endfor(?!each))","g"):new RegExp(`@(${W}\\s*\\(|end${W})`,"g");le.lastIndex=Z;let ce;while((ce=le.exec(k))!==null)if(ce[1].startsWith(W))oe++;else if(oe--,oe===0){ae=ce.index+ce[0].length;break}if(oe!==0)continue;let ge=()=>{let Ie=[se.itemVar,se.indexVar].filter(Boolean);if(Ie.length)z.push({start:F,end:ae,vars:Ie})};if(se.iterable){let Ie=se.iterable.trim();if(Ie.startsWith("[")||Ie.startsWith("{")||Ie.startsWith("'")||Ie.startsWith('"')||Ie.startsWith("`")||/^-?\d/.test(Ie)){ge();continue}let Pe=Ie.split(/[.[(]/)[0].trim(),Ee=_?Pe in _:!1,Me=z.some((je)=>F>je.start&&F<je.end&&je.vars.includes(Pe));if(Pe&&(Ee||Me)){ge();continue}}if(se.style==="as")Q=se.indexVar?`(${se.itemVar}, ${se.indexVar}) in ${se.iterable}`:`${se.itemVar} in ${se.iterable}`;let $e=k.substring(Z,ae-ie.length).trim(),ye=_?{..._}:{};if(se.itemVar)delete ye[se.itemVar];if(se.indexVar)delete ye[se.indexVar];let ke=ws($e,ye),Re=ke.match(Rm),Ae;if(Re){let[,Ie,Pe,Ee]=Re;Ae=`<${Ie}${Pe} @for="${Q}">${Ee}</${Ie}>`}else Ae=`<template @for="${Q}">${ke}</template>`;B.push({start:F,end:ae,replacement:Ae}),R.lastIndex=ae}for(let W=B.length-1;W>=0;W--){let{start:F,end:V,replacement:H}=B[W];k=k.substring(0,F)+H+k.substring(V)}return k}function cS(v){let _=new Set,k=[],R=0,T=0,B=v.length,z=(H)=>{let q=R+1;while(q<B){let Q=v[q];if(Q==="\\"){q+=2;continue}if(Q===H)return q+1;q++}return B},W=()=>{let H=R+2;while(H<B&&v[H]!==`
2567
2567
  `)H++;return H},F=()=>{let H=R+2;while(H<B-1){if(v[H]==="*"&&v[H+1]==="/")return H+2;H++}return B},V=(H)=>{let q=H,Q=0;while(q<B){let Z=v[q];if(Z==="/"&&v[q+1]==="/"){let se=q+2;while(se<B&&v[se]!==`
2568
- `)se++;q=se;continue}if(Z==="/"&&v[q+1]==="*"){let se=q+2;while(se<B-1&&!(v[se]==="*"&&v[se+1]==="/"))se++;q=se+2;continue}if(Z==='"'||Z==="'"||Z==="`"){let se=q+1;while(se<B){if(v[se]==="\\"){se+=2;continue}if(v[se]===Z){se++;break}se++}q=se;continue}if(Z==="("||Z==="["||Z==="{"){Q++,q++;continue}if(Z===")"||Z==="]"||Z==="}"){Q--,q++;continue}if(Z===";"&&Q===0)return q+1;q++}return B};while(R<B){let H=v[R];if(H==="/"&&v[R+1]==="/"){let q=W();k.push(v.slice(R,q)),R=q;continue}if(H==="/"&&v[R+1]==="*"){let q=F();k.push(v.slice(R,q)),R=q;continue}if(H==='"'||H==="'"||H==="`"){let q=z(H);k.push(v.slice(R,q)),R=q;continue}if(H==="{"){T++,k.push(H),R++;continue}if(H==="}"){T--,k.push(H),R++;continue}if(T===0){let q=R>0?v[R-1]:"";if(q===""||/\s/.test(q)||q===";"||q==="}"||q==="{"){let Z=v.slice(R).match(/^(const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=/);if(Z){let se=Z[2],ie=V(R+Z[0].length);if(_.has(se)){k.push(`/* stx: deduped const ${se} */`),R=ie;continue}_.add(se),k.push(v.slice(R,ie)),R=ie;continue}}}k.push(H),R++}return k.join("")}var lS=new Set(["script","style","html","head","meta","link","title","!doctype"]);function vu(v,_,k){for(let R of k){if(R.start>=_)return!1;if(R.end>v)return!0}return!1}function uS(v,_,k){let R=0;while(R<v.length){let T=v.indexOf(_,R);if(T===-1)return!1;if(!vu(T,T+_.length,k))return!0;R=T+_.length}return!1}function dS(v,_){if(uS(v,"<body",_)){let T=new RegExp(`<body(${bu})>`,"g"),B;while((B=T.exec(v))!==null)if(!vu(B.index,B.index+B[0].length,_))return B.index+B[0].length-1;return null}let k=new RegExp(`<([a-zA-Z][a-zA-Z0-9-]*)\\b(${bu})>`,"gi"),R;while((R=k.exec(v))!==null){if(vu(R.index,R.index+R[0].length,_))continue;if(lS.has(R[1].toLowerCase()))continue;return R.index+R[0].length-1}return null}function fS(v,_,k,R){let T=[],B=` data-stx="${R}"`,z=0,W=!1,F=(V)=>{if(k!==null&&!W&&k>=z&&k<=V)T.push(v.slice(z,k),B,v.slice(k,V)),W=!0;else T.push(v.slice(z,V))};for(let V of _){if(V.start<z)continue;F(V.start),z=V.end}return F(v.length),T.join("")}async function Qn(v,_,k,R={}){let T=_c(v,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b/}),B=/\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*\(/,z=[],{hasUserImports:W,bundleClientScript:F}=await ht("stx/client-script-bundler",()=>import("./chunk-zv288w4e.js"));for(let ce of T){let ge=ce.body;if(Ge(ce.attrs))ge=Ke(ge);if(R.forceClientSetup||B.test(ge)){z.push({content:ge,start:ce.start,end:ce.end});continue}if(!W(ge))continue;try{let $e=await F(_t(ge).code,_||"",{projectRoot:process.cwd(),externalizeUserModules:!1});if(B.test($e))z.push({content:ge,start:ce.start,end:ce.end})}catch{}}if(z.length===0)return{output:v,setupCode:null};let V=`${_??""}\x00${z.map((ce)=>ce.content).join("\x00")}`,H=`__stx_setup_${Bun.hash(V).toString(36).slice(0,10)}`,q=[];for(let ce=0;ce<z.length;ce++){let ge=z[ce].bundled??_t(z[ce].content).code;if(!z[ce].bundled&&W(ge))ge=await F(ge,_||"",{projectRoot:process.cwd(),externalizeUserModules:R.forceClientSetup?!1:void 0});ge=qe(ge);let $e=O(ge);q.push(`// \u2500\u2500 merged signal script #${ce+1} \u2500\u2500
2568
+ `)se++;q=se;continue}if(Z==="/"&&v[q+1]==="*"){let se=q+2;while(se<B-1&&!(v[se]==="*"&&v[se+1]==="/"))se++;q=se+2;continue}if(Z==='"'||Z==="'"||Z==="`"){let se=q+1;while(se<B){if(v[se]==="\\"){se+=2;continue}if(v[se]===Z){se++;break}se++}q=se;continue}if(Z==="("||Z==="["||Z==="{"){Q++,q++;continue}if(Z===")"||Z==="]"||Z==="}"){Q--,q++;continue}if(Z===";"&&Q===0)return q+1;q++}return B};while(R<B){let H=v[R];if(H==="/"&&v[R+1]==="/"){let q=W();k.push(v.slice(R,q)),R=q;continue}if(H==="/"&&v[R+1]==="*"){let q=F();k.push(v.slice(R,q)),R=q;continue}if(H==='"'||H==="'"||H==="`"){let q=z(H);k.push(v.slice(R,q)),R=q;continue}if(H==="{"){T++,k.push(H),R++;continue}if(H==="}"){T--,k.push(H),R++;continue}if(T===0){let q=R>0?v[R-1]:"";if(q===""||/\s/.test(q)||q===";"||q==="}"||q==="{"){let Z=v.slice(R).match(/^(const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=/);if(Z){let se=Z[2],ie=V(R+Z[0].length);if(_.has(se)){k.push(`/* stx: deduped const ${se} */`),R=ie;continue}_.add(se),k.push(v.slice(R,ie)),R=ie;continue}}}k.push(H),R++}return k.join("")}var lS=new Set(["script","style","html","head","meta","link","title","!doctype"]);function lu(v,_,k){for(let R of k){if(R.start>=_)return!1;if(R.end>v)return!0}return!1}function uS(v,_,k){let R=0;while(R<v.length){let T=v.indexOf(_,R);if(T===-1)return!1;if(!lu(T,T+_.length,k))return!0;R=T+_.length}return!1}function dS(v,_){if(uS(v,"<body",_)){let T=new RegExp(`<body(${cu})>`,"g"),B;while((B=T.exec(v))!==null)if(!lu(B.index,B.index+B[0].length,_))return B.index+B[0].length-1;return null}let k=new RegExp(`<([a-zA-Z][a-zA-Z0-9-]*)\\b(${cu})>`,"gi"),R;while((R=k.exec(v))!==null){if(lu(R.index,R.index+R[0].length,_))continue;if(lS.has(R[1].toLowerCase()))continue;return R.index+R[0].length-1}return null}function fS(v,_,k,R){let T=[],B=` data-stx="${R}"`,z=0,W=!1,F=(V)=>{if(k!==null&&!W&&k>=z&&k<=V)T.push(v.slice(z,k),B,v.slice(k,V)),W=!0;else T.push(v.slice(z,V))};for(let V of _){if(V.start<z)continue;F(V.start),z=V.end}return F(v.length),T.join("")}async function er(v,_,k,R={}){let T=_c(v,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b/}),B=/\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*\(/,z=[],{hasUserImports:W,bundleClientScript:F}=await ht("stx/client-script-bundler",()=>import("./chunk-cxqrwvc5.js"));for(let ce of T){let ge=ce.body;if(Ge(ce.attrs))ge=Ke(ge);if(R.forceClientSetup||B.test(ge)){z.push({content:ge,start:ce.start,end:ce.end});continue}if(!W(ge))continue;try{let $e=await F(_t(ge).code,_||"",{projectRoot:process.cwd(),externalizeUserModules:!1});if(B.test($e))z.push({content:ge,start:ce.start,end:ce.end})}catch{}}if(z.length===0)return{output:v,setupCode:null};let V=`${_??""}\x00${z.map((ce)=>ce.content).join("\x00")}`,H=`__stx_setup_${Bun.hash(V).toString(36).slice(0,10)}`,q=[];for(let ce=0;ce<z.length;ce++){let ge=z[ce].bundled??_t(z[ce].content).code;if(!z[ce].bundled&&W(ge))ge=await F(ge,_||"",{projectRoot:process.cwd(),externalizeUserModules:R.forceClientSetup?!1:void 0});ge=qe(ge);let $e=O(ge);q.push(`// \u2500\u2500 merged signal script #${ce+1} \u2500\u2500
2569
2569
  ${$e}`)}let Q=q.join(`
2570
2570
 
2571
2571
  `);Q=cS(Q);let Z=Ec(Q),se=Z.split(",").map((ce)=>ce.trim()).filter(Boolean),ie=ln(Q,k),oe=`
@@ -2577,7 +2577,7 @@ ${Ai(`${ie}${Q}`)}
2577
2577
  }
2578
2578
  window.__stx_latestSetup=${H};
2579
2579
  if(window.stx)window.stx._latestSetup=${H};
2580
- </script>`,ae=dS(v,z);return{output:fS(v,z,ae,H),setupCode:oe}}function Ec(v){let _=s(v),k=[],R=new Set,T=0,B=0,z=_.length,W=()=>{if(T!==0)return;let F=_.slice(B).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*(?:[!:;,\n]|=(?!=)|$)/);if(F){let Z=F[2];if(!R.has(Z))k.push(Z),R.add(Z);return}let V=_.slice(B).match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(V){V[1].split(",").forEach((Z)=>{let se=Z.trim();if(!se)return;let ie=se.indexOf(":"),ae=(ie>=0?se.slice(ie+1).trim():se).split(/[\s=]/)[0];if(ae&&!R.has(ae))k.push(ae),R.add(ae)});return}let H=_.slice(B).match(/^(?:const|let|var)\s+\[([^\]]+)\]\s*=/);if(H){H[1].split(",").forEach((Z)=>{let se=Z.trim().replace(/^\.\.\./,"");if(!se)return;let ie=se.split(/[\s=]/)[0];if(ie&&!R.has(ie))k.push(ie),R.add(ie)});return}let q=_.slice(B).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(q){let Z=q[1];if(!R.has(Z))k.push(Z),R.add(Z);return}let Q=_.slice(B).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(Q){let Z=Q[1];if(!R.has(Z))k.push(Z),R.add(Z)}};while(B<z){if(_[B]==="{"){T++,B++;continue}if(_[B]==="}"){T--,B++;continue}if(T===0&&/[a-z]/i.test(_[B])&&(B===0||/\s|[;{}()]/.test(_[B-1])))W();B++}return k.join(", ")}async function hi(v,_,k,R){if(!bs(v,k))return v;let T=v;if(_.skipSignalsRuntime)return T;let{output:B,setupCode:z}=await Qn(T,k,R);if(T=B,!z){let W=Bn(T);if(W&&!/data-stx/.test(W.attrs)&&!/data-stx-auto/.test(W.attrs)){let F=W.tag.replace(/^<body([^>]*)>$/i,"<body$1 data-stx-auto>");T=T.slice(0,W.index)+F+T.slice(W.index+W.tag.length)}}if(T=await Ca(T,_),z){let W=yi(T,/<\/head>/i),F=W===-1?yi(T,/<body[^>]*>/i):-1;if(W!==-1)T=`${T.slice(0,W)}${z}
2580
+ </script>`,ae=dS(v,z);return{output:fS(v,z,ae,H),setupCode:oe}}function Ec(v){let _=s(v),k=[],R=new Set,T=0,B=0,z=_.length,W=()=>{if(T!==0)return;let F=_.slice(B).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*(?:[!:;,\n]|=(?!=)|$)/);if(F){let Z=F[2];if(!R.has(Z))k.push(Z),R.add(Z);return}let V=_.slice(B).match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(V){V[1].split(",").forEach((Z)=>{let se=Z.trim();if(!se)return;let ie=se.indexOf(":"),ae=(ie>=0?se.slice(ie+1).trim():se).split(/[\s=]/)[0];if(ae&&!R.has(ae))k.push(ae),R.add(ae)});return}let H=_.slice(B).match(/^(?:const|let|var)\s+\[([^\]]+)\]\s*=/);if(H){H[1].split(",").forEach((Z)=>{let se=Z.trim().replace(/^\.\.\./,"");if(!se)return;let ie=se.split(/[\s=]/)[0];if(ie&&!R.has(ie))k.push(ie),R.add(ie)});return}let q=_.slice(B).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(q){let Z=q[1];if(!R.has(Z))k.push(Z),R.add(Z);return}let Q=_.slice(B).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(Q){let Z=Q[1];if(!R.has(Z))k.push(Z),R.add(Z)}};while(B<z){if(_[B]==="{"){T++,B++;continue}if(_[B]==="}"){T--,B++;continue}if(T===0&&/[a-z]/i.test(_[B])&&(B===0||/\s|[;{}()]/.test(_[B-1])))W();B++}return k.join(", ")}async function hi(v,_,k,R){if(!bs(v,k))return v;let T=v;if(_.skipSignalsRuntime)return T;let{output:B,setupCode:z}=await er(T,k,R);if(T=B,!z){let W=Bn(T);if(W&&!/data-stx/.test(W.attrs)&&!/data-stx-auto/.test(W.attrs)){let F=W.tag.replace(/^<body([^>]*)>$/i,"<body$1 data-stx-auto>");T=T.slice(0,W.index)+F+T.slice(W.index+W.tag.length)}}if(T=await Ca(T,_),z){let W=yi(T,/<\/head>/i),F=W===-1?yi(T,/<body[^>]*>/i):-1;if(W!==-1)T=`${T.slice(0,W)}${z}
2581
2581
  ${T.slice(W)}`;else if(F!==-1){let V=/<body[^>]*>/i.exec(T.slice(F))[0],H=F+V.length;T=`${T.slice(0,H)}
2582
2582
  ${z}${T.slice(H)}`}else T=`${T}
2583
2583
  ${z}`}return T}function yi(v,_){let k=/<(script|style)\b[\s\S]*?<\/\1>/gi,R=[],T;while((T=k.exec(v))!==null)R.push([T.index,T.index+T[0].length]);let B=new RegExp(_.source,_.flags.replace(/[gy]/g,"")),z=0;while(z<v.length){let W=B.exec(v.slice(z));if(!W)return-1;let F=z+W.index;if(!R.some(([H,q])=>F>=H&&F<q))return F;z=F+Math.max(W[0].length,1)}return-1}var Cm="/* [stx import stripped, resolved via window.stx in __stx_setup] */";function Tc(v){let _=[];for(let k of v.split(",")){let R=k.trim();if(!R||R.startsWith("type "))continue;let T=R.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 Cm;return`var ${_.join(", ")}; ${Cm}`}var pS=/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"](?:stx|@stacksjs\/stx|@stacksjs\/browser)['"]\s*;?\s*$/gm;function qe(v){return v.replace(pS,(_,k)=>Tc(k))}import Pi from"path";import gS from"process";function w(v="STX_PUBLIC_"){let _={},k={};for(let[R,T]of Object.entries(gS.env)){if(!R.startsWith(v)||T===void 0)continue;_[`import.meta.env.${R}`]=JSON.stringify(T),k[R]=T}return _["import.meta.env"]=JSON.stringify(k),_}function Am(v){return v.startsWith("http://")||v.startsWith("https://")||v.startsWith("//")}async function Im(v,_,k){try{let R;if(v.startsWith("/")){let T=_;for(let B=0;B<5;B++){let z=Pi.join(T,v);if(await Bun.file(z).exists())return z;T=Pi.dirname(T)}R=Pi.join(_,v)}else if(v.startsWith("./")||v.startsWith("../"))R=Pi.resolve(_,v);else R=Pi.resolve(_,v);if(await Bun.file(R).exists())return R;return null}catch{return null}}var Pm=Symbol.for("stx.inline-assets.import-meta");function mS(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.
@@ -2587,89 +2587,89 @@ ${se}
2587
2587
  </script>`;R=R.replace(V,ie),B.lastIndex=0}catch(se){if(se?.[Pm])throw se}}let W=/<link\b([^>]*)href=["']([^"']+)["']([^>]*)(?:\/?>)/gi,F;while((F=W.exec(R))!==null){let[V,H,q,Q]=F,Z=H+Q;if(Am(q))continue;if(/rel=["']stylesheet["']/.test(Z)||q.endsWith(".css")){let ie=await Im(q,T,_);if(ie)try{let oe=await Bun.file(ie).text();k.add(ie);let ae=`<style>
2588
2588
  /* Source: ${q} */
2589
2589
  ${oe}
2590
- </style>`;R=R.replace(V,ae),W.lastIndex=0}catch(oe){}}}return R}function Ts(v,_){let k=v,R=/@json\s*\(/g,T;while((T=R.exec(k))!==null){let B=T.index,z=B+T[0].length-1,W=1,F=z+1,V=null,H=!1;while(F<k.length&&W>0){let ce=k[F];if(H){H=!1,F++;continue}if(ce==="\\"&&V){H=!0,F++;continue}if(V){if(ce===V)V=null;F++;continue}if(ce==='"'||ce==="'"||ce==="`"){V=ce,F++;continue}if(ce==="(")W++;else if(ce===")"){if(W--,W===0)break}F++}if(W!==0)break;let q=k.substring(z+1,F).trim(),Q=k.substring(B,F+1),Z=-1,se=0,ie=null,oe=!1;for(let ce=0;ce<q.length;ce++){let ge=q[ce];if(oe){oe=!1;continue}if(ge==="\\"&&ie){oe=!0;continue}if(ie){if(ge===ie)ie=null;continue}if(ge==='"'||ge==="'"||ge==="`"){ie=ge;continue}if(ge==="("||ge==="["||ge==="{")se++;else if(ge===")"||ge==="]"||ge==="}")se--;if(ge===","&&se===0){Z=ce;break}}let ae=Z>=0?q.substring(0,Z).trim():q,le=Z>=0?q.substring(Z+1).trim():void 0;try{let ce=ae.trim(),ge;if(p(ce))ge=c(ce,Object.keys(_))(...Object.values(_));else ge=void 0;let $e;if(le==="true")$e=JSON.stringify(ge,null,2);else $e=JSON.stringify(ge);let ye=$e.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029");k=k.substring(0,B)+ye+k.substring(F+1),R.lastIndex=B+ye.length}catch(ce){I.log(ce instanceof Error?ce:Error(String(ce)),{directive:"@json"},"error"),R.lastIndex=B+Q.length}}return k}function $s(v){return v.replace(/@once\s*([\s\S]*?)@endonce/g,"$1")}function jm(v){let _=v,k=/@memo\s*\(/g,R,T=[];while((R=k.exec(_))!==null){let B=R.index,z=B+R[0].length,W=1,F=z;while(F<_.length&&W>0){if(_[F]==="(")W++;else if(_[F]===")")W--;F++}if(W!==0)continue;let V=_.slice(z,F-1).trim(),H=F,q=_.slice(H),Q=q.indexOf("@endmemo");if(Q===-1)continue;let Z=q.slice(0,Q),se=H+Q+8,ie=Z.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)/),oe=ie?ie[0].length:0,ae=Z.slice(oe),le=Z.match(/(\s*)$/),ce=le?le[0].length:0,ge=ae.slice(0,ae.length-ce),$e=ge.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)?(\/?)>/),ye;if($e){let[ke,Re,Ae="",Ie]=$e,Pe=`<${Re}${Ae} data-stx-memo="${V}"${Ie}>`;ye=Z.slice(0,oe)+Pe+ge.slice(ke.length)+Z.slice(oe+ge.length)}else ye=`${Z.slice(0,oe)}<div data-stx-memo="${V}">${ge}</div>${Z.slice(oe+ge.length)}`;T.push({start:B,end:se,replacement:ye}),k.lastIndex=se}for(let B=T.length-1;B>=0;B--){let z=T[B];_=_.slice(0,z.start)+z.replacement+_.slice(z.end)}return _.replace(/@memo="([^"]*)"/g,'data-stx-memo="$1"')}function Su(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 Lm(v,_){if(!/\bref\s*=/.test(v))return v;let k=/<\/?([a-zA-Z][\w-]*)\b(?:"[^"]*"|'[^']*'|[^'">])*>/y,R=ee(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=[],B=0,z=0,W=[];for(let{start:F,end:V,token:H}of R){let q=/^<\/?([\w-]+)/.exec(H)[1].toLowerCase();if(H.startsWith("</")){let Z;while(Z=T.pop()){if(Z.scoped)B--;if(Z.name===q)break}continue}let Q=/\sdata-stx-scope\s*=/.test(H);if(!B&&!Q&&/\s(?:ref|@ref|:ref|x-ref|data-stx-ref)\s*=/.test(H)&&!/\sdata-stx-ref-caller\s*=/.test(H))W.push(v.slice(z,F),H.replace(/\s*\/?>$/,(Z)=>` data-stx-ref-caller="${_}"${Z}`)),z=V;if(!Bm.has(q)&&!/\/>$/.test(H)){if(T.push({name:q,scoped:Q}),Q)B++}}return W.push(v.slice(z)),W.join("")}var Bm=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),zm=/(?:^|\s)x-no-cloak(?:=|\s|\/|>|$)/,Mm=/<\/?\s*([a-z][\w-]*)/iy,hS=/\s/;function yS(v,_){let k=_-1;while(k>=0&&hS.test(v[k]))k--;return k>=0&&v[k]==="/"}function xS(v,_){let k=!1,R=!1;for(let T=_;T<v.length;T++){let B=v[T];if(k){if(B==="'")k=!1}else if(R){if(B==='"')R=!1}else if(B==="'")k=!0;else if(B==='"')R=!0;else if(B===">")return T}return-1}function bS(v,_){if(v.indexOf("{",_)===-1||v.indexOf("}",_)===-1)return!1;let k=0,R=_,T=!1,B=!1,z=!1;while(R<v.length){let W=v.indexOf("<",R),F=W===-1?v.length:W;if(F>R){if(k===0)while(R<F){let q=v.indexOf(B?"}":"{",R);if(q===-1||q>=F){if(B)z=!1;else T=!1;break}if(q>R)if(B)z=!1;else T=!1;if(B){if(z)return!0;z=!0}else if(T)B=!0,z=!1;else T=!0;R=q+1}R=F;continue}if(v.startsWith("<!--",R)){let q=v.indexOf("-->",R);R=q===-1?v.length:q+3;continue}let V=xS(v,R);if(V===-1)break;Mm.lastIndex=R;let H=Mm.exec(v)?.[1]?.toLowerCase()??"";if(v[R+1]==="/"){if(k===0)break;k--}else if(!yS(v,V)&&!Bm.has(H))k++;R=V+1}return!1}var Om=m(256);function Wm(v){if(v.length<1024)return Nm(v);let _=h(v),k=Om.get(_);if(k!==void 0)return k;let R=Nm(v);return Om.set(_,R),R}function Nm(v){if(v.length>=32768&&!cd(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"),R="",T=0,B;while((B=k.exec(v))!==null){let z=B.index,W=z+B[0].length,F=!1,V=!1,H=-1;while(W<v.length){let Q=v[W];if(F){if(Q==="'")F=!1}else if(V){if(Q==='"')V=!1}else if(Q==="'")F=!0;else if(Q==='"')V=!0;else if(Q===">"){H=W;break}W++}if(H===-1)continue;let q=v.slice(z,H+1);if(zm.test(q))continue;if(q.includes("x-cloak"))continue;if(bS(v,H+1))R+=v.slice(T,H)+" x-cloak>",T=H+1}return R+=v.slice(T),R}var vS=/(?:^|\s)(?::else-if|:if|:else|:show|x-else-if|x-if|x-else|x-show|@if|@show)(?:=|\s|\/|>|$)/,wS=/<\/script>/gi,SS=/<\/style>/gi;function Fm(v){let _=/<[a-z][\w-]*/gi,k="",R=0,T;while((T=_.exec(v))!==null){let B=T.index,z=T[0].slice(1).toLowerCase();if(z==="script"||z==="style"){let se=z==="script"?wS:SS;se.lastIndex=B;let ie=se.exec(v);if(ie!==null)_.lastIndex=ie.index+ie[0].length;continue}let W=B+T[0].length,F=!1,V=!1,H=-1;while(W<v.length){let se=v[W];if(F){if(se==="'")F=!1}else if(V){if(se==='"')V=!1}else if(se==="'")F=!0;else if(se==='"')V=!0;else if(se===">"){H=W;break}W++}if(H===-1)continue;let q=v.slice(B+T[0].length,H);if(zm.test(q))continue;if(/(?:^|\s)x-cloak(?:=|\s|\/|>|$)/.test(q))continue;if(!vS.test(q))continue;let Q=v[H-1]==="/",Z=Q?H-1:H;k+=`${v.slice(R,Z)} x-cloak${Q?" ":""}`,R=Z}return k+=v.slice(R),k}var $u=m(256),$S=[{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"}],Vm=/(?:\/\/|\/\*|\{\{--)\s*stx-strict-ignore(-next-line)?([^\n*}]*)/g;function _S(v){let _=Array.from(v,(T)=>T===`
2590
+ </style>`;R=R.replace(V,ae),W.lastIndex=0}catch(oe){}}}return R}function Ts(v,_){let k=v,R=/@json\s*\(/g,T;while((T=R.exec(k))!==null){let B=T.index,z=B+T[0].length-1,W=1,F=z+1,V=null,H=!1;while(F<k.length&&W>0){let ce=k[F];if(H){H=!1,F++;continue}if(ce==="\\"&&V){H=!0,F++;continue}if(V){if(ce===V)V=null;F++;continue}if(ce==='"'||ce==="'"||ce==="`"){V=ce,F++;continue}if(ce==="(")W++;else if(ce===")"){if(W--,W===0)break}F++}if(W!==0)break;let q=k.substring(z+1,F).trim(),Q=k.substring(B,F+1),Z=-1,se=0,ie=null,oe=!1;for(let ce=0;ce<q.length;ce++){let ge=q[ce];if(oe){oe=!1;continue}if(ge==="\\"&&ie){oe=!0;continue}if(ie){if(ge===ie)ie=null;continue}if(ge==='"'||ge==="'"||ge==="`"){ie=ge;continue}if(ge==="("||ge==="["||ge==="{")se++;else if(ge===")"||ge==="]"||ge==="}")se--;if(ge===","&&se===0){Z=ce;break}}let ae=Z>=0?q.substring(0,Z).trim():q,le=Z>=0?q.substring(Z+1).trim():void 0;try{let ce=ae.trim(),ge;if(p(ce))ge=c(ce,Object.keys(_))(...Object.values(_));else ge=void 0;let $e;if(le==="true")$e=JSON.stringify(ge,null,2);else $e=JSON.stringify(ge);let ye=$e.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029");k=k.substring(0,B)+ye+k.substring(F+1),R.lastIndex=B+ye.length}catch(ce){I.log(ce instanceof Error?ce:Error(String(ce)),{directive:"@json"},"error"),R.lastIndex=B+Q.length}}return k}function $s(v){return v.replace(/@once\s*([\s\S]*?)@endonce/g,"$1")}function jm(v){let _=v,k=/@memo\s*\(/g,R,T=[];while((R=k.exec(_))!==null){let B=R.index,z=B+R[0].length,W=1,F=z;while(F<_.length&&W>0){if(_[F]==="(")W++;else if(_[F]===")")W--;F++}if(W!==0)continue;let V=_.slice(z,F-1).trim(),H=F,q=_.slice(H),Q=q.indexOf("@endmemo");if(Q===-1)continue;let Z=q.slice(0,Q),se=H+Q+8,ie=Z.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)/),oe=ie?ie[0].length:0,ae=Z.slice(oe),le=Z.match(/(\s*)$/),ce=le?le[0].length:0,ge=ae.slice(0,ae.length-ce),$e=ge.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)?(\/?)>/),ye;if($e){let[ke,Re,Ae="",Ie]=$e,Pe=`<${Re}${Ae} data-stx-memo="${V}"${Ie}>`;ye=Z.slice(0,oe)+Pe+ge.slice(ke.length)+Z.slice(oe+ge.length)}else ye=`${Z.slice(0,oe)}<div data-stx-memo="${V}">${ge}</div>${Z.slice(oe+ge.length)}`;T.push({start:B,end:se,replacement:ye}),k.lastIndex=se}for(let B=T.length-1;B>=0;B--){let z=T[B];_=_.slice(0,z.start)+z.replacement+_.slice(z.end)}return _.replace(/@memo="([^"]*)"/g,'data-stx-memo="$1"')}function du(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 Lm(v,_){if(!/\bref\s*=/.test(v))return v;let k=/<\/?([a-zA-Z][\w-]*)\b(?:"[^"]*"|'[^']*'|[^'">])*>/y,R=ee(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=[],B=0,z=0,W=[];for(let{start:F,end:V,token:H}of R){let q=/^<\/?([\w-]+)/.exec(H)[1].toLowerCase();if(H.startsWith("</")){let Z;while(Z=T.pop()){if(Z.scoped)B--;if(Z.name===q)break}continue}let Q=/\sdata-stx-scope\s*=/.test(H);if(!B&&!Q&&/\s(?:ref|@ref|:ref|x-ref|data-stx-ref)\s*=/.test(H)&&!/\sdata-stx-ref-caller\s*=/.test(H))W.push(v.slice(z,F),H.replace(/\s*\/?>$/,(Z)=>` data-stx-ref-caller="${_}"${Z}`)),z=V;if(!Bm.has(q)&&!/\/>$/.test(H)){if(T.push({name:q,scoped:Q}),Q)B++}}return W.push(v.slice(z)),W.join("")}var Bm=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),zm=/(?:^|\s)x-no-cloak(?:=|\s|\/|>|$)/,Mm=/<\/?\s*([a-z][\w-]*)/iy,hS=/\s/;function yS(v,_){let k=_-1;while(k>=0&&hS.test(v[k]))k--;return k>=0&&v[k]==="/"}function xS(v,_){let k=!1,R=!1;for(let T=_;T<v.length;T++){let B=v[T];if(k){if(B==="'")k=!1}else if(R){if(B==='"')R=!1}else if(B==="'")k=!0;else if(B==='"')R=!0;else if(B===">")return T}return-1}function bS(v,_){if(v.indexOf("{",_)===-1||v.indexOf("}",_)===-1)return!1;let k=0,R=_,T=!1,B=!1,z=!1;while(R<v.length){let W=v.indexOf("<",R),F=W===-1?v.length:W;if(F>R){if(k===0)while(R<F){let q=v.indexOf(B?"}":"{",R);if(q===-1||q>=F){if(B)z=!1;else T=!1;break}if(q>R)if(B)z=!1;else T=!1;if(B){if(z)return!0;z=!0}else if(T)B=!0,z=!1;else T=!0;R=q+1}R=F;continue}if(v.startsWith("<!--",R)){let q=v.indexOf("-->",R);R=q===-1?v.length:q+3;continue}let V=xS(v,R);if(V===-1)break;Mm.lastIndex=R;let H=Mm.exec(v)?.[1]?.toLowerCase()??"";if(v[R+1]==="/"){if(k===0)break;k--}else if(!yS(v,V)&&!Bm.has(H))k++;R=V+1}return!1}var Om=m(256);function Wm(v){if(v.length<1024)return Nm(v);let _=h(v),k=Om.get(_);if(k!==void 0)return k;let R=Nm(v);return Om.set(_,R),R}function Nm(v){if(v.length>=32768&&!Sd(v))return v;let k=new RegExp(`<(${"div|span|p|h[1-6]|td|th|li|a|button|label|section|article|header|footer|main|nav|aside|dd|dt|figcaption|summary|caption|blockquote|pre|code|em|strong|small|sub|sup|time|mark|abbr|cite|q|s|u|b|i"})\\b`,"gi"),R="",T=0,B;while((B=k.exec(v))!==null){let z=B.index,W=z+B[0].length,F=!1,V=!1,H=-1;while(W<v.length){let Q=v[W];if(F){if(Q==="'")F=!1}else if(V){if(Q==='"')V=!1}else if(Q==="'")F=!0;else if(Q==='"')V=!0;else if(Q===">"){H=W;break}W++}if(H===-1)continue;let q=v.slice(z,H+1);if(zm.test(q))continue;if(q.includes("x-cloak"))continue;if(bS(v,H+1))R+=v.slice(T,H)+" x-cloak>",T=H+1}return R+=v.slice(T),R}var vS=/(?:^|\s)(?::else-if|:if|:else|:show|x-else-if|x-if|x-else|x-show|@if|@show)(?:=|\s|\/|>|$)/,wS=/<\/script>/gi,SS=/<\/style>/gi;function Fm(v){let _=/<[a-z][\w-]*/gi,k="",R=0,T;while((T=_.exec(v))!==null){let B=T.index,z=T[0].slice(1).toLowerCase();if(z==="script"||z==="style"){let se=z==="script"?wS:SS;se.lastIndex=B;let ie=se.exec(v);if(ie!==null)_.lastIndex=ie.index+ie[0].length;continue}let W=B+T[0].length,F=!1,V=!1,H=-1;while(W<v.length){let se=v[W];if(F){if(se==="'")F=!1}else if(V){if(se==='"')V=!1}else if(se==="'")F=!0;else if(se==='"')V=!0;else if(se===">"){H=W;break}W++}if(H===-1)continue;let q=v.slice(B+T[0].length,H);if(zm.test(q))continue;if(/(?:^|\s)x-cloak(?:=|\s|\/|>|$)/.test(q))continue;if(!vS.test(q))continue;let Q=v[H-1]==="/",Z=Q?H-1:H;k+=`${v.slice(R,Z)} x-cloak${Q?" ":""}`,R=Z}return k+=v.slice(R),k}var fu=m(256),$S=[{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"}],Vm=/(?:\/\/|\/\*|\{\{--)\s*stx-strict-ignore(-next-line)?([^\n*}]*)/g;function _S(v){let _=Array.from(v,(T)=>T===`
2591
2591
  `?`
2592
2592
  `:" "),k=0,R="";while(k<v.length){let T=v[k],B=v[k+1];if(R){if(T==="\\"){k+=2;continue}if(T===R)R="";k++;continue}if(T==='"'||T==="'"||T==="`"){R=T,k++;continue}if(T==="/"&&B==="/"){while(k<v.length&&v[k]!==`
2593
2593
  `)_[k]=v[k],k++;continue}if(T==="/"&&B==="*"){let z=v.indexOf("*/",k+2),W=z===-1?v.length:z+2;for(;k<W;k++)_[k]=v[k];continue}if(T==="{"&&B==="{"&&v.slice(k,k+4)==="{{--"){let z=v.indexOf("--}}",k+4),W=z===-1?v.length:z+4;for(;k<W;k++)_[k]=v[k];continue}k++}return _.join("")}function kS(v){let _=new Map,k=_S(v).split(`
2594
2594
  `),R=v.split(`
2595
- `);return k.forEach((T,B)=>{Vm.lastIndex=0;for(let z of T.matchAll(Vm)){let W=z[1]==="-next-line",F=(R[B]??"").slice(0,z.index).trim(),V=W||F===""?B+2:B+1,q=(z[2]??"").split("--")[0].split(/[\s,]+/).filter(Boolean),Q=q.filter((se)=>/\w/.test(se));if(q.length>0&&Q.length===0)continue;let Z=_.get(V);if(Z&&Z.size===0)continue;if(Q.length===0){_.set(V,new Set);continue}if(Z)Q.forEach((se)=>Z.add(se));else _.set(V,new Set(Q))}}),_}function ES(v,_,k){let R=v.get(_);if(!R)return!1;if(R.size===0)return!0;return[...R].some((T)=>k.includes(T))}function Rs(v,_,k,R){let T=typeof k==="boolean"?{enabled:k,failOnViolation:k}:k??{enabled:!1};if(!T.enabled)return;let B=h(v,_,R,JSON.stringify(T)),z=$u.get(B);if(z!==void 0){if(z&&T.failOnViolation)throw Error(z);return}let W=T.allowPatterns??[],F=kS(v),V=[],H=s(v.replace(/\{\{--[\s\S]*?--\}\}/g,(se)=>se.replace(/[^\n]/g," ")));for(let{pattern:se,message:ie,suggestion:oe}of $S){if(W.some((le)=>/\w/.test(le)&&ie.includes(le)))continue;se.lastIndex=0;let ae=H.match(se);if(ae&&ae.length>0){let le=H.split(`
2595
+ `);return k.forEach((T,B)=>{Vm.lastIndex=0;for(let z of T.matchAll(Vm)){let W=z[1]==="-next-line",F=(R[B]??"").slice(0,z.index).trim(),V=W||F===""?B+2:B+1,q=(z[2]??"").split("--")[0].split(/[\s,]+/).filter(Boolean),Q=q.filter((se)=>/\w/.test(se));if(q.length>0&&Q.length===0)continue;let Z=_.get(V);if(Z&&Z.size===0)continue;if(Q.length===0){_.set(V,new Set);continue}if(Z)Q.forEach((se)=>Z.add(se));else _.set(V,new Set(Q))}}),_}function ES(v,_,k){let R=v.get(_);if(!R)return!1;if(R.size===0)return!0;return[...R].some((T)=>k.includes(T))}function Rs(v,_,k,R){let T=typeof k==="boolean"?{enabled:k,failOnViolation:k}:k??{enabled:!1};if(!T.enabled)return;let B=h(v,_,R,JSON.stringify(T)),z=fu.get(B);if(z!==void 0){if(z&&T.failOnViolation)throw Error(z);return}let W=T.allowPatterns??[],F=kS(v),V=[],H=s(v.replace(/\{\{--[\s\S]*?--\}\}/g,(se)=>se.replace(/[^\n]/g," ")));for(let{pattern:se,message:ie,suggestion:oe}of $S){if(W.some((le)=>/\w/.test(le)&&ie.includes(le)))continue;se.lastIndex=0;let ae=H.match(se);if(ae&&ae.length>0){let le=H.split(`
2596
2596
  `),ce=v.split(`
2597
2597
  `),ge=[];if(le.forEach((Re,Ae)=>{if(se.lastIndex=0,se.test(Re)&&!ES(F,Ae+1,ie))ge.push(Ae+1)}),ge.length===0&&le.some((Re)=>(se.lastIndex=0,se.test(Re))))continue;let $e=ge.length>0?` (script line${ge.length>1?"s":""} ${ge.join(", ")})`:"",ye=ge.slice(0,3).map((Re)=>` ${Re} | ${(ce[Re-1]??"").trim().slice(0,100)}`).join(`
2598
2598
  `),ke=ye?`
2599
2599
  ${ye}`:"";V.push(` \u2717 ${ie}${$e}
2600
- \u2192 ${oe}${ke}`)}}if(V.length===0){$u.set(B,"");return}let q=(se)=>{let ie=`${process.cwd()}/`;return se.startsWith(ie)?se.slice(ie.length):se},Z=`[STX] DOM API violation in ${R&&R!==_?`${q(R)} (composed into ${q(_)})`:q(_)}:
2600
+ \u2192 ${oe}${ke}`)}}if(V.length===0){fu.set(B,"");return}let q=(se)=>{let ie=`${process.cwd()}/`;return se.startsWith(ie)?se.slice(ie.length):se},Z=`[STX] DOM API violation in ${R&&R!==_?`${q(R)} (composed into ${q(_)})`:q(_)}:
2601
2601
  ${V.join(`
2602
2602
  `)}
2603
- Tip: prefer useRef(), navigate(), and composables for component code`;if($u.set(B,Z),T.failOnViolation)throw Error(Z);else console.warn(Z)}import _u from"path";var CS=/(\bfrom\s*|\bimport\s*\(\s*|\bimport\s+)(['"])(\.\.?\/[^'"]*)\2/g,RS=/(<script\b[^>]*>)([\s\S]*?)(<\/script>)/gi;function TS(v,_){if(!_||!v.includes("/"))return v;let k=_u.dirname(_);return v.replace(CS,(R,T,B,z)=>{let W=_u.resolve(k,z);return`${T}${B}${W.split(_u.sep).join("/")}${B}`})}function Um(v,_){if(!_||!v.includes("<script"))return v;return v.replace(RS,(k,R,T,B)=>`${R}${TS(T,_)}${B}`)}var Ur="<!--PARENT_CONTENT_PLACEHOLDER-->";function Hm(v){return v.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Ym(v,_){let k=v.length,R=_,T=!0,B=[],z=(W)=>W+9<=k&&v[W]==="<"&&v[W+1]==="/"&&(v[W+2]==="s"||v[W+2]==="S")&&(v[W+3]==="c"||v[W+3]==="C")&&(v[W+4]==="r"||v[W+4]==="R")&&(v[W+5]==="i"||v[W+5]==="I")&&(v[W+6]==="p"||v[W+6]==="P")&&(v[W+7]==="t"||v[W+7]==="T")&&(v[W+8]===">"||/\s/.test(v[W+8]));while(R<k){let W=v[R];if(z(R))return R;if(W==="/"&&v[R+1]==="/"){if(R=v.indexOf(`
2603
+ Tip: prefer useRef(), navigate(), and composables for component code`;if(fu.set(B,Z),T.failOnViolation)throw Error(Z);else console.warn(Z)}import pu from"path";var CS=/(\bfrom\s*|\bimport\s*\(\s*|\bimport\s+)(['"])(\.\.?\/[^'"]*)\2/g,RS=/(<script\b[^>]*>)([\s\S]*?)(<\/script>)/gi;function TS(v,_){if(!_||!v.includes("/"))return v;let k=pu.dirname(_);return v.replace(CS,(R,T,B,z)=>{let W=pu.resolve(k,z);return`${T}${B}${W.split(pu.sep).join("/")}${B}`})}function Um(v,_){if(!_||!v.includes("<script"))return v;return v.replace(RS,(k,R,T,B)=>`${R}${TS(T,_)}${B}`)}var Ur="<!--PARENT_CONTENT_PLACEHOLDER-->";function Hm(v){return v.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Ym(v,_){let k=v.length,R=_,T=!0,B=[],z=(W)=>W+9<=k&&v[W]==="<"&&v[W+1]==="/"&&(v[W+2]==="s"||v[W+2]==="S")&&(v[W+3]==="c"||v[W+3]==="C")&&(v[W+4]==="r"||v[W+4]==="R")&&(v[W+5]==="i"||v[W+5]==="I")&&(v[W+6]==="p"||v[W+6]==="P")&&(v[W+7]==="t"||v[W+7]==="T")&&(v[W+8]===">"||/\s/.test(v[W+8]));while(R<k){let W=v[R];if(z(R))return R;if(W==="/"&&v[R+1]==="/"){if(R=v.indexOf(`
2604
2604
  `,R+2),R===-1)return-1;R+=1,T=!0;continue}if(W==="/"&&v[R+1]==="*"){let F=v.indexOf("*/",R+2);if(F===-1)return-1;R=F+2,T=!0;continue}if(W==="/"&&T){let F=R+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===`
2605
2605
  `){F=-1;break}F++}if(F===-1){R++,T=!1;continue}while(F<k&&/[a-z]/.test(v[F]))F++;R=F,T=!1;continue}if(W==="'"||W==='"'){let F=W;R++;while(R<k){if(v[R]==="\\"){R+=2;continue}if(v[R]===F){R++;break}if(v[R]===`
2606
- `)break;R++}T=!1;continue}if(W==="`"){R++;while(R<k){if(v[R]==="\\"){R+=2;continue}if(v[R]==="`"){R++;break}if(v[R]==="$"&&v[R+1]==="{"){B.push(!0),R+=2,T=!0;break}R++}if(B.length===0)T=!1;continue}if(W==="}"&&B.length>0){B.pop(),R++;while(R<k){if(v[R]==="\\"){R+=2;continue}if(v[R]==="`"){R++,T=!1;break}if(v[R]==="$"&&v[R+1]==="{"){B.push(!0),R+=2,T=!0;break}R++}continue}if(/\s/.test(W));else if(/[)\].\w$]/.test(W))T=!1;else T=!0;R++}return-1}function Qm(v,_){let k=_.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),R=new RegExp(`<script\\b(?=[^>]*\\b${k}(?:\\s|=|/?>))[^>]*>`,"i").exec(v);if(!R)return null;let T=R.index+R[0].length,B=v.indexOf("</script>",T);if(B===-1)return null;let z=v.indexOf(">",B);if(z===-1)return null;return{start:R.index,end:z+1}}var IS=4096;async function qm(v,_,k){if(k.buildMode!=="serve"||_.length<IS)return null;let{registerServeModuleBundle:R}=await import("./chunk-y1bppxgw.js");return`<script ${v} src="${R(_)}"></script>`}async function Km(v,_,k){try{let{registeredModuleIdsIn:R,buildModuleRegistryScript:T}=await ht("stx/client-module-registry",()=>import("./chunk-8v19753h.js")),B=[],z=await T(R(...v),{minify:Ws(_.buildMode),collectInputs:B});for(let W of B)k?.add(W);if(!z)return null;if(_.buildMode==="serve"){let{registerServeModuleBundle:W}=await import("./chunk-y1bppxgw.js");return`<script data-stx-scoped data-stx-run="always" data-stx-modules src="${W(z)}"></script>`}return`<script data-stx-scoped data-stx-run="always" data-stx-modules>${z.replace(/<\/script/gi,"<\\/script")}</script>`}catch{return null}}function PS(v,_=""){let k=Qm(v,"data-stx-runtime");if(!k)return v;let R=Qi(v);if(R===-1||R===k.start){if(!_)return v;return v.slice(0,k.end)+_+v.slice(k.end)}if(R<k.start)return v.slice(0,R)+v.slice(k.start,k.end)+_+`
2606
+ `)break;R++}T=!1;continue}if(W==="`"){R++;while(R<k){if(v[R]==="\\"){R+=2;continue}if(v[R]==="`"){R++;break}if(v[R]==="$"&&v[R+1]==="{"){B.push(!0),R+=2,T=!0;break}R++}if(B.length===0)T=!1;continue}if(W==="}"&&B.length>0){B.pop(),R++;while(R<k){if(v[R]==="\\"){R+=2;continue}if(v[R]==="`"){R++,T=!1;break}if(v[R]==="$"&&v[R+1]==="{"){B.push(!0),R+=2,T=!0;break}R++}continue}if(/\s/.test(W));else if(/[)\].\w$]/.test(W))T=!1;else T=!0;R++}return-1}function Qm(v,_){let k=_.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),R=new RegExp(`<script\\b(?=[^>]*\\b${k}(?:\\s|=|/?>))[^>]*>`,"i").exec(v);if(!R)return null;let T=R.index+R[0].length,B=v.indexOf("</script>",T);if(B===-1)return null;let z=v.indexOf(">",B);if(z===-1)return null;return{start:R.index,end:z+1}}var IS=4096;async function qm(v,_,k){if(k.buildMode!=="serve"||_.length<IS)return null;let{registerServeModuleBundle:R}=await import("./chunk-fvx6pd66.js");return`<script ${v} src="${R(_)}"></script>`}async function Km(v,_,k){try{let{registeredModuleIdsIn:R,buildModuleRegistryScript:T}=await ht("stx/client-module-registry",()=>import("./chunk-e809x7m0.js")),B=[],z=await T(R(...v),{minify:Ws(_.buildMode),collectInputs:B});for(let W of B)k?.add(W);if(!z)return null;if(_.buildMode==="serve"){let{registerServeModuleBundle:W}=await import("./chunk-fvx6pd66.js");return`<script data-stx-scoped data-stx-run="always" data-stx-modules src="${W(z)}"></script>`}return`<script data-stx-scoped data-stx-run="always" data-stx-modules>${z.replace(/<\/script/gi,"<\\/script")}</script>`}catch{return null}}function PS(v,_=""){let k=Qm(v,"data-stx-runtime");if(!k)return v;let R=Qi(v);if(R===-1||R===k.start){if(!_)return v;return v.slice(0,k.end)+_+v.slice(k.end)}if(R<k.start)return v.slice(0,R)+v.slice(k.start,k.end)+_+`
2607
2607
  `+v.slice(R,k.start)+v.slice(k.end);let T=v.slice(k.start,k.end),B=v.slice(0,k.start)+v.slice(k.end),z=Qi(B);if(z===-1)return T+_+`
2608
2608
  `+B;return B.slice(0,z)+T+_+`
2609
- `+B.slice(z)}function DS(v){let _=/\x00STX_ESC_MUSTACHE_OPEN\x00([\s\S]*?)\x00STX_ESC_MUSTACHE_CLOSE\x00/g;return v.replace(_,(k,R,T)=>{let B=v.slice(0,T);return B.lastIndexOf("<")>B.lastIndexOf(">")?`{{${R}}}`:`{<!--stx-literal-->{${R}}}`})}async function n(v,_,k,R,T){if(R.ssr===!1&&!R.autoShell&&R.buildMode==="spa")return v;if(_.__stx_signals_gate===void 0)_.__stx_signals_gate=ve(v,k);let B=!_.__stxProcessingDepth;gn(_);for(let z of R._layerGraph?.configDependencies??[])T.add(z);if(B&&R.runtimeConfig)await yn(_,k,R.runtimeConfig);if(B)Zu(_),_.__stx_scope_seq??={n:0,key:Bun.hash(String(_.__filename??k)).toString(36).slice(0,6)},_.__stx_head_injections=Fs(),_.__stx_seo_staged=!1;if(!_.__stxProcessingDepth)_.__stxProcessingDepth=0;if(_.__stxProcessingDepth++,!_.__onceStore)_.__onceStore=new Set;if((R.debug||!E()&&!En())&&k&&k.endsWith(".stx"))Ys(v,k);try{return await G.timeAsync("template-processing",async()=>{let z=await MS(v,_,k,R,T);if(B)z=Su(z);if(B&&R.autoShell&&R.buildMode!=="compile"){let W=me(R.app?.head,{known:kn,source:"app.head"}),V=(_.__stx_runtime_head||null)??Hs(),H=(_.__stx_head_raw||"").trim(),q,Q=H.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(Q)q=Q[1].trim(),H=H.replace(Q[0],"").trim();let Z=_.__sections?.title,se=V.title||q||Z,ie=!V.title&&(!!q||!!Z),oe=V.meta||[],ae=new Set(oe.map((ke)=>Ce(ke)).filter(Boolean)),le={...W,...se&&{title:se},meta:[...(W.meta||[]).filter((ke)=>!ae.has(Ce(ke))),...oe],link:[...W.link||[],...V.link||[]],script:[...W.script||[],...V.script||[]],headRaw:[W.headRaw,H].filter(Boolean).join(`
2610
- `),...V.htmlAttrs&&{htmlAttrs:Li(W.htmlAttrs,V.htmlAttrs)},...V.bodyAttrs&&{bodyAttrs:{...W.bodyAttrs||{},...V.bodyAttrs}}},ce=zs(z);if(z=xn(z,le,{...ie&&{titleIsHtml:!0},...R.app?.colorMode&&{colorMode:R.app.colorMode}},ce),ce)z=Bi(z,W),z=vn(z,le.htmlAttrs);let ge=z.match(/<!-- stx-layout: ([^ ]+) -->/);if(ge&&z.includes("<head")){let ke=ge[1],Re=vr(ke);z=z.replace(/<head\b[^>]*>/i,(Ae)=>`${Ae}
2609
+ `+B.slice(z)}function DS(v){let _=/\x00STX_ESC_MUSTACHE_OPEN\x00([\s\S]*?)\x00STX_ESC_MUSTACHE_CLOSE\x00/g;return v.replace(_,(k,R,T)=>{let B=v.slice(0,T);return B.lastIndexOf("<")>B.lastIndexOf(">")?`{{${R}}}`:`{<!--stx-literal-->{${R}}}`})}async function n(v,_,k,R,T){if(R.ssr===!1&&!R.autoShell&&R.buildMode==="spa")return v;if(_.__stx_signals_gate===void 0)_.__stx_signals_gate=we(v,k);let B=!_.__stxProcessingDepth;gn(_);for(let z of R._layerGraph?.configDependencies??[])T.add(z);if(B&&R.runtimeConfig)await yn(_,k,R.runtimeConfig);if(B)Lu(_),_.__stx_scope_seq??={n:0,key:Bun.hash(String(_.__filename??k)).toString(36).slice(0,6)},_.__stx_head_injections=Fs(),_.__stx_seo_staged=!1;if(!_.__stxProcessingDepth)_.__stxProcessingDepth=0;if(_.__stxProcessingDepth++,!_.__onceStore)_.__onceStore=new Set;if((R.debug||!E()&&!En())&&k&&k.endsWith(".stx"))Ys(v,k);try{return await G.timeAsync("template-processing",async()=>{let z=await MS(v,_,k,R,T);if(B)z=du(z);if(B&&R.autoShell&&R.buildMode!=="compile"){let W=me(R.app?.head,{known:kn,source:"app.head"}),V=(_.__stx_runtime_head||null)??Hs(),H=(_.__stx_head_raw||"").trim(),q,Q=H.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(Q)q=Q[1].trim(),H=H.replace(Q[0],"").trim();let Z=_.__sections?.title,se=V.title||q||Z,ie=!V.title&&(!!q||!!Z),oe=V.meta||[],ae=new Set(oe.map((ke)=>Ce(ke)).filter(Boolean)),le={...W,...se&&{title:se},meta:[...(W.meta||[]).filter((ke)=>!ae.has(Ce(ke))),...oe],link:[...W.link||[],...V.link||[]],script:[...W.script||[],...V.script||[]],headRaw:[W.headRaw,H].filter(Boolean).join(`
2610
+ `),...V.htmlAttrs&&{htmlAttrs:Li(W.htmlAttrs,V.htmlAttrs)},...V.bodyAttrs&&{bodyAttrs:{...W.bodyAttrs||{},...V.bodyAttrs}}},ce=zs(z);if(z=xn(z,le,{...ie&&{titleIsHtml:!0},...R.app?.colorMode&&{colorMode:R.app.colorMode}},ce),ce)z=Bi(z,W),z=wn(z,le.htmlAttrs);let ge=z.match(/<!-- stx-layout: ([^ ]+) -->/);if(ge&&z.includes("<head")){let ke=ge[1],Re=xr(ke);z=z.replace(/<head\b[^>]*>/i,(Ae)=>`${Ae}
2611
2611
  <meta name="stx-layout" content="${Hm(ke)}">
2612
- <meta name="stx-layout-group" content="${Hm(Re)}">`)}let $e=z.match(/function (__stx_setup_\w+)\(/),ye=$e?Bn(z):null;if($e&&ye&&!/\bdata-stx=/.test(ye.tag)){z=fs(z,(Re,Ae)=>`<body${Ae} data-stx="${$e[1]}">`);let ke=new RegExp(`(<(?!body)[a-zA-Z][^>]*) data-stx="${$e[1]}"`,"i");z=z.replace(ke,"$1")}}if(B){let W=_.__stx_head_injections??Fs(),F=ji(z);if(F!==null)W.beforeClose.push(F);let V=um(z);if(V!==null)W.afterOpen.push(V);if(R.offline?.enabled&&!z.includes("data-stx-offline"))W.beforeClose.push(dm);z=Mi(z,W);let H=R.app?.colorMode;if(H)z=wn(z,H)}if(B)if(Qm(z,"data-stx-runtime")){let F=null,V=null,H=null,q=null,Q=null;try{let{getStoreScript:se}=await ht("stx/store-loader",()=>import("./chunk-d4en5d3s.js")),ie=R.storesDir,oe=await se(ie);if(oe)H=`<script data-stx-stores>${oe}</script>`,V=await qm("data-stx-stores",oe,R)??H}catch{}F=await Km([z,H],R,T);try{let{getFrameworkComposableScript:se}=await ht("stx/framework-composables",()=>import("./chunk-3qrrv6af.js"));Q=await se(z)}catch{}try{let{getComposableScript:se}=await ht("stx/composable-loader",()=>import("./chunk-atsf1fe0.js")),ie=R.composablesDir,oe=[F,H,Q].filter((le)=>le!==null),ae=await se(R._layerComposableDirs??ie,z,oe);if(ae)q=await qm('data-stx-scoped data-stx-run="always" data-stx-composables',ae,R)??`<script data-stx-scoped data-stx-run="always" data-stx-composables>${ae}</script>`}catch{}let Z=[F,V,q,Q].filter((se)=>se!==null).map((se)=>`
2612
+ <meta name="stx-layout-group" content="${Hm(Re)}">`)}let $e=z.match(/function (__stx_setup_\w+)\(/),ye=$e?Bn(z):null;if($e&&ye&&!/\bdata-stx=/.test(ye.tag)){z=fs(z,(Re,Ae)=>`<body${Ae} data-stx="${$e[1]}">`);let ke=new RegExp(`(<(?!body)[a-zA-Z][^>]*) data-stx="${$e[1]}"`,"i");z=z.replace(ke,"$1")}}if(B){let W=_.__stx_head_injections??Fs(),F=ji(z);if(F!==null)W.beforeClose.push(F);let V=um(z);if(V!==null)W.afterOpen.push(V);if(R.offline?.enabled&&!z.includes("data-stx-offline"))W.beforeClose.push(dm);z=Mi(z,W);let H=R.app?.colorMode;if(H)z=vn(z,H)}if(B)if(Qm(z,"data-stx-runtime")){let F=null,V=null,H=null,q=null,Q=null;try{let{getStoreScript:se}=await ht("stx/store-loader",()=>import("./chunk-bfbcmfww.js")),ie=R.storesDir,oe=await se(ie);if(oe)H=`<script data-stx-stores>${oe}</script>`,V=await qm("data-stx-stores",oe,R)??H}catch{}F=await Km([z,H],R,T);try{let{getFrameworkComposableScript:se}=await ht("stx/framework-composables",()=>import("./chunk-cby4mkjf.js"));Q=await se(z)}catch{}try{let{getComposableScript:se}=await ht("stx/composable-loader",()=>import("./chunk-3ae39ttg.js")),ie=R.composablesDir,oe=[F,H,Q].filter((le)=>le!==null),ae=await se(R._layerComposableDirs??ie,z,oe);if(ae)q=await qm('data-stx-scoped data-stx-run="always" data-stx-composables',ae,R)??`<script data-stx-scoped data-stx-run="always" data-stx-composables>${ae}</script>`}catch{}let Z=[F,V,q,Q].filter((se)=>se!==null).map((se)=>`
2613
2613
  ${se}`).join("");z=PS(z,Z)}else{let F=await Km([z],R,T);if(F){let V=z.search(/<script\b[^>]*>(?:(?!<\/script>)[\s\S])*?__stxModules\[/i);if(V!==-1)z=z.slice(0,V)+F+`
2614
- `+z.slice(V)}}if(B)z=Ni(z);if(B&&_.__stx_inject_css!==!1)z=await f(z,void 0,R.buildMode==="serve",!0);else if(B)z=Gi(z);if(z=z.replace(/\x00STX_ESCAPED_AT\x00/g,"@"),z=DS(z),B&&_.__stx_runtime_config)z=Ye(z,_.__stx_runtime_config);if(B&&!_.__stx_defer_server_data){let W=er(_);if(W){let F=/<head\b[^>]*>/i.exec(z),V=F?F.index+F[0].length:0;z=z.slice(0,V)+W+z.slice(V)}}return z})}catch(z){if(z instanceof fr)throw z;let W=z instanceof Error?z.message:String(z),F=new Y(`Template processing failed: ${W}`,k,void 0,void 0,v.substring(0,200)+(v.length>200?"...":""));if(I.log(F,{filePath:k,context:_}),Dt.logDetailedError(F,{filePath:k,template:v.substring(0,500)}),R.debug)throw F;return Us.createFallbackContent("Template Processing",F)}}async function MS(v,_,k,R,T){let B=process.cwd(),z={...R,partialsDir:R.partialsDir&&!tn.isAbsolute(R.partialsDir)?tn.resolve(B,R.partialsDir):R.partialsDir,componentsDir:R.componentsDir&&!tn.isAbsolute(R.componentsDir)?tn.resolve(B,R.componentsDir):R.componentsDir,layoutsDir:R.layoutsDir&&!tn.isAbsolute(R.layoutsDir)?tn.resolve(B,R.layoutsDir):R.layoutsDir},W=z,F=v;await jS(k,_),NS(_,W),F=await re(()=>em(F,_,k,W),F,($e)=>{I.log($e,{filePath:k,phase:"pre-processing-middleware"},"warning"),console.warn(`[stx] pre-processing middleware failed for ${k}: ${$e.message}`)}),F=F.replace(/\{\{--[\s\S]*?--\}\}/g,"");let V=On(F,ze,($e,ye)=>`\x00STX_HTML_COMMENT_${ye}\x00`);F=V.output;let H=V.tokens,q=($e)=>H.length===0?$e:$e.replace(/\x00STX_HTML_COMMENT_(\d+)\x00/g,(ye,ke)=>H[Number(ke)]??""),Q="\x00STX_ESCAPED_AT\x00",Z="\x00STX_ESC_MUSTACHE_OPEN\x00",se="\x00STX_ESC_MUSTACHE_CLOSE\x00";F=F.replace(/@@/g,Q),F=F.replace(/@\{\{([\s\S]*?)\}\}/g,($e,ye)=>`${Z}${ye}${se}`),F=im(F),F=await Dm(F,k,T);let ie={};F=Cs(F,ie);let oe={..._.__sections||{}},ae="",le=Lf(He(v)),ce=/@nolayout\b/.test(F)||le===!1;if(/@nolayout\b/.test(F))F=F.replace(/@nolayout\b\s*/g,"");let ge=F.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(ge)ae=ge[1],F=F.replace(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/g,"");else if(typeof le==="string"){if(ae=le,!/@section\s*\(/.test(F))F=`@section('content')
2614
+ `+z.slice(V)}}if(B)z=Ni(z);if(B&&_.__stx_inject_css!==!1)z=await f(z,void 0,R.buildMode==="serve",!0);else if(B)z=Gi(z);if(z=z.replace(/\x00STX_ESCAPED_AT\x00/g,"@"),z=DS(z),B&&_.__stx_runtime_config)z=Ye(z,_.__stx_runtime_config);if(B&&!_.__stx_defer_server_data){let W=tr(_);if(W){let F=/<head\b[^>]*>/i.exec(z),V=F?F.index+F[0].length:0;z=z.slice(0,V)+W+z.slice(V)}}return z})}catch(z){if(z instanceof gr)throw z;let W=z instanceof Error?z.message:String(z),F=new Y(`Template processing failed: ${W}`,k,void 0,void 0,v.substring(0,200)+(v.length>200?"...":""));if(I.log(F,{filePath:k,context:_}),Dt.logDetailedError(F,{filePath:k,template:v.substring(0,500)}),R.debug)throw F;return Us.createFallbackContent("Template Processing",F)}}async function MS(v,_,k,R,T){let B=process.cwd(),z={...R,partialsDir:R.partialsDir&&!tn.isAbsolute(R.partialsDir)?tn.resolve(B,R.partialsDir):R.partialsDir,componentsDir:R.componentsDir&&!tn.isAbsolute(R.componentsDir)?tn.resolve(B,R.componentsDir):R.componentsDir,layoutsDir:R.layoutsDir&&!tn.isAbsolute(R.layoutsDir)?tn.resolve(B,R.layoutsDir):R.layoutsDir},W=z,F=v;await jS(k,_),NS(_,W),F=await re(()=>em(F,_,k,W),F,($e)=>{I.log($e,{filePath:k,phase:"pre-processing-middleware"},"warning"),console.warn(`[stx] pre-processing middleware failed for ${k}: ${$e.message}`)}),F=F.replace(/\{\{--[\s\S]*?--\}\}/g,"");let V=On(F,ze,($e,ye)=>`\x00STX_HTML_COMMENT_${ye}\x00`);F=V.output;let H=V.tokens,q=($e)=>H.length===0?$e:$e.replace(/\x00STX_HTML_COMMENT_(\d+)\x00/g,(ye,ke)=>H[Number(ke)]??""),Q="\x00STX_ESCAPED_AT\x00",Z="\x00STX_ESC_MUSTACHE_OPEN\x00",se="\x00STX_ESC_MUSTACHE_CLOSE\x00";F=F.replace(/@@/g,Q),F=F.replace(/@\{\{([\s\S]*?)\}\}/g,($e,ye)=>`${Z}${ye}${se}`),F=im(F),F=await Dm(F,k,T);let ie={};F=Cs(F,ie);let oe={..._.__sections||{}},ae="",le=Lf(He(v)),ce=/@nolayout\b/.test(F)||le===!1;if(/@nolayout\b/.test(F))F=F.replace(/@nolayout\b\s*/g,"");let ge=F.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(ge)ae=ge[1],F=F.replace(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/g,"");else if(typeof le==="string"){if(ae=le,!/@section\s*\(/.test(F))F=`@section('content')
2615
2615
  ${F.trim()}
2616
2616
  @endsection`}if(!ae&&!ce&&W.defaultLayout){let $e=Ot(F),ye=/@section\s*\(/.test(F);if(!$e||ye){let ke="",Re=tn.dirname(k),Ae=W.layoutsDir?tn.dirname(W.layoutsDir):process.cwd();for(let Ie=0;Ie<20;Ie++){let Pe=tn.join(Re,"_layout.stx");if(await r(Pe)){ke=Pe;break}let Ee=tn.dirname(Re);if(Ee===Re||Ee.length<Ae.length)break;Re=Ee}if(ke)ae=ke;else if(W.layoutsDir){let Ie=tn.isAbsolute(W.layoutsDir)?W.layoutsDir:tn.resolve(process.cwd(),W.layoutsDir),Pe=tn.join(Ie,`${W.defaultLayout}.stx`);if(await r(Pe))ae=Pe}if(ae&&!ye)F=`@section('content')
2617
2617
  ${F.trim()}
2618
2618
  @endsection`}}if(ae&&F.includes("<script")){let $e=Sn(F),ye=$e.scripts.map((ke)=>Xm(ke,k)??ke);F=es($e.output,ye)}if(F=F.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,($e,ye,ke)=>(oe[ye]=ke,"")),F=F.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*([^)]+?)\s*\)/g,($e,ye,ke)=>{if(/^(['"]).*\1$/.test(ke.trim()))return $e;try{let Re=l(ke.trim(),_);if(Re===void 0)return $e;return oe[ye]=String(Re??""),""}catch{return $e}}),F=F.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@endsection|@show)/g,($e,ye,ke)=>{if(ke.includes("@parent"))oe[ye]=ke.replace("@parent",Ur);else oe[ye]=ke.trim();return""}),_.__sections=oe,F=F.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"])?\)/g,($e,ye,ke)=>oe[ye]||ke||""),!("slot"in _)||_.slot===void 0)F=F.replace(/\{\{\s*slot\s*\}\}/g,()=>oe.content||"");if(F=_s(F,ie),ae){let $e=[],ye=Sn(F),ke=On(ye.output,Qr,(Re,Ae)=>`\x00STX_ORPHAN_STYLE_${Ae}\x00`);if(F=ke.output.replace(/\x00STX_(SCRIPT|ORPHAN_STYLE)_(\d+)\x00/g,(Re,Ae,Ie)=>{let Pe=Ae==="SCRIPT"?Xm(ye.scripts[Number(Ie)],k):ke.tokens[Number(Ie)];if(Pe)$e.push(Pe);return""}),$e.length>0){let Re=$e.join(`
2619
2619
  `);oe.content=oe.content?`${oe.content}
2620
- ${Re}`:Re,_.__sections=oe}}if(ae)try{let $e;if(tn.isAbsolute(ae))$e=ae,T.add(ae);else $e=await re(()=>nr(ae,k,z,T),null,()=>{throw new Y(`Failed to resolve layout path: ${ae}`,k,void 0,void 0,`Layout referenced from ${k}`)});if(!$e){let Pe=(je)=>{if(!je)return[];try{let Ne=tn.isAbsolute(je)?je:tn.resolve(process.cwd(),je);return AS.readdirSync(Ne).filter((De)=>De.endsWith(".stx")).map((De)=>De.replace(/\.stx$/,""))}catch{return[]}},Ee=[...Pe(z.layoutsDir),...Pe(z.fallbackLayoutsDir)].filter((je,Ne,De)=>De.indexOf(je)===Ne).sort(),Me=`Layout not found: ${ae} (referenced from ${k})`+(Ee.length>0?`. Available layouts: ${Ee.join(", ")}`:z.layoutsDir?`. No .stx layouts found in ${z.layoutsDir}`:"");if(I.log(Error(Me),{layoutPath:ae,filePath:k,available:Ee},"error"),console.error(`[stx] ${Me}`),z.debug)throw new Y(Me,k);return F}let ye=await re(()=>Bun.file($e).text(),"",()=>{throw new Y(`Failed to read layout file: ${$e}`,k,void 0,void 0,"Layout content could not be loaded")});ye=Um(ye,$e);let ke=ye.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(ke){if(z.debug)console.log(`Found nested layout: ${ke[1]} in ${$e}`);let Pe={},Ee=ye.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(Ne,De,Le)=>(Pe[De]=Le.trim(),""));for(let[Ne,De]of Object.entries(Pe))if(oe[Ne]&&oe[Ne].includes(Ur)){let Le=oe[Ne].indexOf(Ur);oe[Ne]=oe[Ne].slice(0,Le)+De+oe[Ne].slice(Le+Ur.length)}else if(!oe[Ne])oe[Ne]=De;let Me={..._,__sections:oe},je=`@layout('${ke[1]}')${Ee}`;return await n(je,Me,$e,z,T)}let Re=ye.replace(/\{\{--[\s\S]*?--\}\}/g,""),Ae=Cs(Re,ie),Ie={};return Ae=Ae.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(Pe,Ee,Me)=>(Ie[Ee]=Me.trim(),`@slot('${Ee}')`)),Ae=Ae.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(Pe,Ee,Me)=>{if(oe[Ee]){let je=oe[Ee];if(je.includes(Ur)){let Ne=Ie[Ee]||"",De=je.indexOf(Ur);je=je.slice(0,De)+Ne+je.slice(De+Ur.length)}return je}return Me||""}),Ae=OS(Ae,oe),Ae=Ae.replace(/\{\{\s*slot\s*\}\}/g,()=>oe.content||""),Ae=_s(Ae,ie),_.__originalFilePath=k,F=await Jm(Ae,_,$e,z,T),F=`<!-- stx-layout: ${ae} -->
2621
- ${F}`,q(F)}catch($e){return I.log($e instanceof Error?$e:Error(String($e)),{layoutPath:ae,filePath:k},"error"),`[Error processing layout: ${$e instanceof Error?$e.message:String($e)}]`}return q(await Jm(F,_,k,z,T))}function OS(v,_){return v.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(k,R,T)=>{let B=_[R];if(B!==void 0){if(!new RegExp(`@(?:yield|slot)\\(\\s*['"]${R.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(B))return B}return T||""})}function NS(v,_){if(v.__stx_sfc_mode=!0,v.__stx_options=_,_.buildMode)v.__stx_buildMode=_.buildMode;let k=_.envPrefix||"STX_PUBLIC_",R={};for(let[T,B]of Object.entries(process.env))if(T.startsWith(k)&&B!==void 0)R[T]=B;v.$env=R}async function jS(v,_){await re(()=>rm(v,_),void 0,(k)=>{I.log(k,{filePath:v,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${v}: ${k.message}`)})}var ku="data-stx-source";function Xm(v,_){if(!v)return v;let k=/^<script\b([^>]*)>/i.exec(v);if(!k||!/\bserver\b/.test(k[1])||k[1].includes(ku))return v;return`<script ${ku}="${encodeURIComponent(_)}"${v.slice(7)}`}function LS(v){let _=new RegExp(`${ku}="([^"]*)"`).exec(v);return _?decodeURIComponent(_[1]):void 0}function Zm(v){return v.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function Gm(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">${Zm(v)}</span><span style="display:block;margin-top:4px">${Zm(k)}</span></div>`}async function BS(v,_,k,R){let{scanScriptTags:T}=await ht("stx/signal-processing",()=>import("./chunk-ne03tfje.js")),B=[],z=!E()&&!En();for(let F of T(v)){let V=F.attrs;if(!/\bserver\b/.test(V))continue;let H=F.start+F.fullMatch.indexOf(">")+1,q=Ym(v,H);if(q===-1)continue;let Q=v.slice(H,q);if(!Q.trim())continue;let Z=LS(V)??k,se={index:F.start,length:q+9-F.start};try{let{extractVariables:ie}=await ht("stx/variable-extractor",()=>import("./chunk-k7jqkt93.js"));await ie(Q,_,Z,{preserveExisting:!0,onFailure:(oe)=>{if(oe.kind==="unknown")return;if(R?.onServerScriptError?.({sourcePath:Z,kind:oe.kind,message:oe.message}),!z)return;B.push({...se,markup:Gm(Z,oe.kind,oe.message)})}})}catch(ie){let oe=ie instanceof Error?ie:Error(String(ie));if(I.log(oe,{filePath:Z,phase:"server-script-extraction"},"warning"),console.warn(`[stx] server <script> extraction failed in ${Z}: ${oe.message}`),z)B.push({...se,markup:Gm(Z,"unknown",oe.message)})}}if(B.length===0)return v;let W=v;for(let F of B.sort((V,H)=>H.index-V.index))W=W.slice(0,F.index)+F.markup+W.slice(F.index+F.length);return W}async function zS(v,_,k){try{let{interpolateScriptsInTemplate:R}=await ht("stx/expressions",()=>import("./chunk-mqy7g74k.js"));return R(v,_,{skipServer:!0})}catch(R){let T=R instanceof Error?R:Error(String(R));return I.log(T,{filePath:k,phase:"script-expression-interpolation"},"warning"),console.warn(`[stx] script expression interpolation failed in ${k}: ${T.message}`),v}}async function Jm(v,_,k,R,T){let B=v,z=R;if(B=await BS(B,_,k,R),B=await zS(B,_,k),B=await Fg(B,_,k),B=await Vg(B,_,k),B=await $p(B,_,k,z),ve(B))B=gi(B,_),B=vs(B,_),B=ws(B,_);B=mi(B);let{processStreamDirectives:W}=await ht("stx/streaming",()=>import("./chunk-1cat8kdj.js"));B=W(B,_),B=vi(B,_,k,z,!0),B=await lm(B,_,k,z,T),B=await hs(B,_,k,z,T),B=jf(B,_,k,z);let{processDeferDirectives:F}=await ht("stx/defer",()=>import("./chunk-3x6p9me0.js"));B=F(B,_,k);let{processTeleportDirectives:V}=await ht("stx/teleport",()=>import("./chunk-efgk2xv1.js"));B=V(B,_,k);let{processTransitionDirectives:H,processTransitionAttributes:q}=await ht("stx/transitions",()=>import("./chunk-79v4d9qh.js"));B=H(B,_,k),B=q(B);let{processErrorBoundaryDirectives:Q,stripRenderFailedMarkers:Z}=await ht("stx/error-boundaries",()=>import("./chunk-h85hrwkq.js"));B=Q(B,_,k),B=Z(B);let{processSuspenseDirectives:se}=await ht("stx/suspense",()=>import("./chunk-cp442y7a.js"));B=se(B,_,k);let{processAsyncDirectives:ie}=await ht("stx/async-components",()=>import("./chunk-hd2bn5q7.js"));B=ie(B,_,k);let{processKeepAliveDirectives:oe}=await ht("stx/keep-alive",()=>import("./chunk-fj70wq7k.js"));B=oe(B,_,k);let{processVirtualListDirectives:ae,processVirtualGridDirectives:le,processInfiniteListDirectives:ce}=await ht("stx/virtual-scrolling",()=>import("./chunk-t48ws5j0.js"));B=ae(B,_,k),B=le(B,_,k),B=ce(B,_,k);let{processPartialHydrationDirectives:ge,processStaticDirectives:$e}=await ht("stx/partial-hydration",()=>import("./chunk-84f9dnq5.js"));B=ge(B,_,k),B=$e(B);let{processComputedDirectives:ye,processWatchDirectives:ke}=await ht("stx/computed",()=>import("./chunk-1xdzcy9d.js"));B=ye(B,_,k),B=ke(B,_,k);let{processFormValidationDirectives:Re}=await ht("stx/forms-validation",()=>import("./chunk-q2a58n2a.js"));B=Re(B,_,k);let{processHeadDirective:Ae,processTitleDirective:Ie,processMetaDirective:Pe,resetHead:Ee}=await ht("stx/head",()=>import("./chunk-e4n4v022.js"));if(!_.__stx_head_preset&&!_.__stx_runtime_head)Ee();let Me=Ae(B);if(B=Me.content,Me.headContent)_.__stx_head_raw=`${_.__stx_head_raw||""}${Me.headContent}
2622
- `;if(B=Ie(B,_),B=Pe(B,_,k),B=nm(B),B=xl(B,_),B=Sp(B),B=Yg(B),B=await ks(B,_,k,z,T),B=await hs(B,_,k,z,T),_.__stxProcessingDepth===1)B=Gu(B,_);if(B=B.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/g,""),B=Su(B),B=dr(B,_,k),B=Ss(B),B=Bf(B,_,{filePath:k,buildMode:z.buildMode}),B=bl(B,_),B=vl(B,_),B=ua(B,_),B=Ap(B,_),B=Ip(B,_),B=await fp(B,_,k,z),B=await Hf(B,_,k),B=await _i(B,_,k,z),B=Ei(B,_,k,z),B=Ms(B,_,k,z),B=Ns(B,_,k),B=Ls(B,_,k,z),B=vp(B,_,k,z),B=Ts(B,_),B=$s(B),B=jm(B),!z.skipEventDirectives)B=zu(B,_,k);if(B=Ff(B,_,k),z.debug){let ut=/\bx-data\s*=/.test(B),it=bs(v);if(ut&&it)console.warn(`[stx] ${k}: Template mixes Alpine-style (x-data) and signals (state/derived/effect) reactivity.
2620
+ ${Re}`:Re,_.__sections=oe}}if(ae)try{let $e;if(tn.isAbsolute(ae))$e=ae,T.add(ae);else $e=await re(()=>rr(ae,k,z,T),null,()=>{throw new Y(`Failed to resolve layout path: ${ae}`,k,void 0,void 0,`Layout referenced from ${k}`)});if(!$e){let Pe=(je)=>{if(!je)return[];try{let Ne=tn.isAbsolute(je)?je:tn.resolve(process.cwd(),je);return AS.readdirSync(Ne).filter((De)=>De.endsWith(".stx")).map((De)=>De.replace(/\.stx$/,""))}catch{return[]}},Ee=[...Pe(z.layoutsDir),...Pe(z.fallbackLayoutsDir)].filter((je,Ne,De)=>De.indexOf(je)===Ne).sort(),Me=`Layout not found: ${ae} (referenced from ${k})`+(Ee.length>0?`. Available layouts: ${Ee.join(", ")}`:z.layoutsDir?`. No .stx layouts found in ${z.layoutsDir}`:"");if(I.log(Error(Me),{layoutPath:ae,filePath:k,available:Ee},"error"),console.error(`[stx] ${Me}`),z.debug)throw new Y(Me,k);return F}let ye=await re(()=>Bun.file($e).text(),"",()=>{throw new Y(`Failed to read layout file: ${$e}`,k,void 0,void 0,"Layout content could not be loaded")});ye=Um(ye,$e);let ke=ye.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(ke){if(z.debug)console.log(`Found nested layout: ${ke[1]} in ${$e}`);let Pe={},Ee=ye.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(Ne,De,Le)=>(Pe[De]=Le.trim(),""));for(let[Ne,De]of Object.entries(Pe))if(oe[Ne]&&oe[Ne].includes(Ur)){let Le=oe[Ne].indexOf(Ur);oe[Ne]=oe[Ne].slice(0,Le)+De+oe[Ne].slice(Le+Ur.length)}else if(!oe[Ne])oe[Ne]=De;let Me={..._,__sections:oe},je=`@layout('${ke[1]}')${Ee}`;return await n(je,Me,$e,z,T)}let Re=ye.replace(/\{\{--[\s\S]*?--\}\}/g,""),Ae=Cs(Re,ie),Ie={};return Ae=Ae.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(Pe,Ee,Me)=>(Ie[Ee]=Me.trim(),`@slot('${Ee}')`)),Ae=Ae.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(Pe,Ee,Me)=>{if(oe[Ee]){let je=oe[Ee];if(je.includes(Ur)){let Ne=Ie[Ee]||"",De=je.indexOf(Ur);je=je.slice(0,De)+Ne+je.slice(De+Ur.length)}return je}return Me||""}),Ae=OS(Ae,oe),Ae=Ae.replace(/\{\{\s*slot\s*\}\}/g,()=>oe.content||""),Ae=_s(Ae,ie),_.__originalFilePath=k,F=await Jm(Ae,_,$e,z,T),F=`<!-- stx-layout: ${ae} -->
2621
+ ${F}`,q(F)}catch($e){return I.log($e instanceof Error?$e:Error(String($e)),{layoutPath:ae,filePath:k},"error"),`[Error processing layout: ${$e instanceof Error?$e.message:String($e)}]`}return q(await Jm(F,_,k,z,T))}function OS(v,_){return v.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(k,R,T)=>{let B=_[R];if(B!==void 0){if(!new RegExp(`@(?:yield|slot)\\(\\s*['"]${R.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(B))return B}return T||""})}function NS(v,_){if(v.__stx_sfc_mode=!0,v.__stx_options=_,_.buildMode)v.__stx_buildMode=_.buildMode;let k=_.envPrefix||"STX_PUBLIC_",R={};for(let[T,B]of Object.entries(process.env))if(T.startsWith(k)&&B!==void 0)R[T]=B;v.$env=R}async function jS(v,_){await re(()=>rm(v,_),void 0,(k)=>{I.log(k,{filePath:v,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${v}: ${k.message}`)})}var gu="data-stx-source";function Xm(v,_){if(!v)return v;let k=/^<script\b([^>]*)>/i.exec(v);if(!k||!/\bserver\b/.test(k[1])||k[1].includes(gu))return v;return`<script ${gu}="${encodeURIComponent(_)}"${v.slice(7)}`}function LS(v){let _=new RegExp(`${gu}="([^"]*)"`).exec(v);return _?decodeURIComponent(_[1]):void 0}function Zm(v){return v.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function Gm(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">${Zm(v)}</span><span style="display:block;margin-top:4px">${Zm(k)}</span></div>`}async function BS(v,_,k,R){let{scanScriptTags:T}=await ht("stx/signal-processing",()=>import("./chunk-xyzy84x0.js")),B=[],z=!E()&&!En();for(let F of T(v)){let V=F.attrs;if(!/\bserver\b/.test(V))continue;let H=F.start+F.fullMatch.indexOf(">")+1,q=Ym(v,H);if(q===-1)continue;let Q=v.slice(H,q);if(!Q.trim())continue;let Z=LS(V)??k,se={index:F.start,length:q+9-F.start};try{let{extractVariables:ie}=await ht("stx/variable-extractor",()=>import("./chunk-qb2j34sp.js"));await ie(Q,_,Z,{preserveExisting:!0,onFailure:(oe)=>{if(oe.kind==="unknown")return;if(R?.onServerScriptError?.({sourcePath:Z,kind:oe.kind,message:oe.message}),!z)return;B.push({...se,markup:Gm(Z,oe.kind,oe.message)})}})}catch(ie){let oe=ie instanceof Error?ie:Error(String(ie));if(I.log(oe,{filePath:Z,phase:"server-script-extraction"},"warning"),console.warn(`[stx] server <script> extraction failed in ${Z}: ${oe.message}`),z)B.push({...se,markup:Gm(Z,"unknown",oe.message)})}}if(B.length===0)return v;let W=v;for(let F of B.sort((V,H)=>H.index-V.index))W=W.slice(0,F.index)+F.markup+W.slice(F.index+F.length);return W}async function zS(v,_,k){try{let{interpolateScriptsInTemplate:R}=await ht("stx/expressions",()=>import("./chunk-wngqr949.js"));return R(v,_,{skipServer:!0})}catch(R){let T=R instanceof Error?R:Error(String(R));return I.log(T,{filePath:k,phase:"script-expression-interpolation"},"warning"),console.warn(`[stx] script expression interpolation failed in ${k}: ${T.message}`),v}}async function Jm(v,_,k,R,T){let B=v,z=R;if(B=await BS(B,_,k,R),B=await zS(B,_,k),B=await Fg(B,_,k),B=await Vg(B,_,k),B=await $p(B,_,k,z),we(B))B=gi(B,_),B=ws(B,_),B=vs(B,_);B=mi(B);let{processStreamDirectives:W}=await ht("stx/streaming",()=>import("./chunk-webrqm20.js"));B=W(B,_),B=wi(B,_,k,z,!0),B=await lm(B,_,k,z,T),B=await hs(B,_,k,z,T),B=jf(B,_,k,z);let{processDeferDirectives:F}=await ht("stx/defer",()=>import("./chunk-3x6p9me0.js"));B=F(B,_,k);let{processTeleportDirectives:V}=await ht("stx/teleport",()=>import("./chunk-efgk2xv1.js"));B=V(B,_,k);let{processTransitionDirectives:H,processTransitionAttributes:q}=await ht("stx/transitions",()=>import("./chunk-br01jvra.js"));B=H(B,_,k),B=q(B);let{processErrorBoundaryDirectives:Q,stripRenderFailedMarkers:Z}=await ht("stx/error-boundaries",()=>import("./chunk-h85hrwkq.js"));B=Q(B,_,k),B=Z(B);let{processSuspenseDirectives:se}=await ht("stx/suspense",()=>import("./chunk-jc4mxq56.js"));B=se(B,_,k);let{processAsyncDirectives:ie}=await ht("stx/async-components",()=>import("./chunk-9kzycb15.js"));B=ie(B,_,k);let{processKeepAliveDirectives:oe}=await ht("stx/keep-alive",()=>import("./chunk-fj70wq7k.js"));B=oe(B,_,k);let{processVirtualListDirectives:ae,processVirtualGridDirectives:le,processInfiniteListDirectives:ce}=await ht("stx/virtual-scrolling",()=>import("./chunk-t48ws5j0.js"));B=ae(B,_,k),B=le(B,_,k),B=ce(B,_,k);let{processPartialHydrationDirectives:ge,processStaticDirectives:$e}=await ht("stx/partial-hydration",()=>import("./chunk-84f9dnq5.js"));B=ge(B,_,k),B=$e(B);let{processComputedDirectives:ye,processWatchDirectives:ke}=await ht("stx/computed",()=>import("./chunk-1xdzcy9d.js"));B=ye(B,_,k),B=ke(B,_,k);let{processFormValidationDirectives:Re}=await ht("stx/forms-validation",()=>import("./chunk-440yjsk5.js"));B=Re(B,_,k);let{processHeadDirective:Ae,processTitleDirective:Ie,processMetaDirective:Pe,resetHead:Ee}=await ht("stx/head",()=>import("./chunk-v0zgarvv.js"));if(!_.__stx_head_preset&&!_.__stx_runtime_head)Ee();let Me=Ae(B);if(B=Me.content,Me.headContent)_.__stx_head_raw=`${_.__stx_head_raw||""}${Me.headContent}
2622
+ `;if(B=Ie(B,_),B=Pe(B,_,k),B=nm(B),B=xl(B,_),B=Sp(B),B=Yg(B),B=await ks(B,_,k,z,T),B=await hs(B,_,k,z,T),_.__stxProcessingDepth===1)B=Bu(B,_);if(B=B.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/g,""),B=du(B),B=ur(B,_,k),B=Ss(B),B=Bf(B,_,{filePath:k,buildMode:z.buildMode}),B=bl(B,_),B=vl(B,_),B=ua(B,_),B=Ap(B,_),B=Ip(B,_),B=await fp(B,_,k,z),B=await Hf(B,_,k),B=await _i(B,_,k,z),B=Ei(B,_,k,z),B=Ms(B,_,k,z),B=Ns(B,_,k),B=Ls(B,_,k,z),B=vp(B,_,k,z),B=Ts(B,_),B=$s(B),B=jm(B),!z.skipEventDirectives)B=Tu(B,_,k);if(B=Ff(B,_,k),z.debug){let ut=/\bx-data\s*=/.test(B),it=bs(v);if(ut&&it)console.warn(`[stx] ${k}: Template mixes Alpine-style (x-data) and signals (state/derived/effect) reactivity.
2623
2623
  Both work on the same page, but they manage separate scopes.
2624
2624
  Prefer signals (state/derived/effect) for new components.`)}B=dg(B,_),B=await X(B,_,k),B=Wm(B),B=Fm(B),B=Rf(B);let{processXElementDirectives:je}=await ht("stx/x-element",()=>import("./chunk-zhxdpzga.js"));B=je(B);let Ne=_.__originalFilePath||k,De=be(_);if(B=await hi(B,z,Ne,De),B=Cp(B,_),B=await tm(B,_,k,z),z.media?.image?.autoSiblings){let ut=z.publicDir||"public",{rewriteImagesWithSiblings:it}=await ht("stx/image-optimization/auto-sibling",()=>import("./chunk-thbc9gtj.js"));B=await it(B,{publicDir:ut})}if(z.seo?.enabled)B=js(B,_,z);let Le=(ut,it,mt=!0)=>{if(!it)return ut;let kt=it.match(/<title\b[^>]*>[\s\S]*?<\/title>/i),Vt=/<head\b[^>]*>[\s\S]*?(?:<\/head\s*>|<body\b|$)/i.exec(ut),Ht=Vt?/<title\b[^>]*>[\s\S]*?<\/title>/i.exec(Vt[0]):null;if(kt&&Vt&&Ht){if(mt){let nn=Vt.index+Ht.index;ut=ut.slice(0,nn)+kt[0]+ut.slice(nn+Ht[0].length)}if(it=it.replace(kt[0],"").trim(),!it)return ut}if(/<\/head>/i.test(ut))return ut.replace(/<\/head>/i,`${it}
2625
2625
  </head>`);if(/<head\b[^>]*>/i.test(ut))return ut.replace(/(<head\b[^>]*>)/i,`$1
2626
2626
  ${it}`);if(/<html\b[^>]*>/i.test(ut))return ut.replace(/(<html\b[^>]*>)/i,`$1
2627
2627
  <head>
2628
2628
  ${it}
2629
- </head>`);return ut},{renderHead:ct,getHead:yt}=await ht("stx/head",()=>import("./chunk-e4n4v022.js")),st=_.__stx_runtime_head??yt();if(st.title||st.meta?.length||st.link?.length){let ut=ct(st);if(ut)B=Le(B,ut)}if(Me.headContent)B=Le(B,Me.headContent,!st.title);if(z.csp?.enabled&&z.csp.addMetaTag)B=xp(B,z.csp,_);if(z.analytics?.enabled)B=Tf(B,z);if(z.heatmap?.enabled)B=If(B,z);if(z.pwa?.enabled&&z.pwa.autoInject!==!1){let{injectPwaTags:ut}=await ht("stx/pwa/inject",()=>import("./chunk-8zm6tkqb.js"));B=ut(B,z)}let gt=/<script\b(?![^>]*\bserver\b)[^>]*>[\s\S]*?<\/script>/i.test(B),dt=/\bSTX\.\w+/.test(B),St=/window\.STX\s*=/.test(B);if(gt&&dt&&!St){let it=`<script data-stx-scoped data-stx-run="once">
2629
+ </head>`);return ut},{renderHead:ct,getHead:yt}=await ht("stx/head",()=>import("./chunk-v0zgarvv.js")),st=_.__stx_runtime_head??yt();if(st.title||st.meta?.length||st.link?.length){let ut=ct(st);if(ut)B=Le(B,ut)}if(Me.headContent)B=Le(B,Me.headContent,!st.title);if(z.csp?.enabled&&z.csp.addMetaTag)B=xp(B,z.csp,_);if(z.analytics?.enabled)B=Tf(B,z);if(z.heatmap?.enabled)B=If(B,z);if(z.pwa?.enabled&&z.pwa.autoInject!==!1){let{injectPwaTags:ut}=await ht("stx/pwa/inject",()=>import("./chunk-0sfexf9t.js"));B=ut(B,z)}let gt=/<script\b(?![^>]*\bserver\b)[^>]*>[\s\S]*?<\/script>/i.test(B),dt=/\bSTX\.\w+/.test(B),St=/window\.STX\s*=/.test(B);if(gt&&dt&&!St){let it=`<script data-stx-scoped data-stx-run="once">
2630
2630
  ${kf()}
2631
2631
  </script>`;if(B.includes("</head>")){let mt=B.indexOf("</head>"),Vt=B.slice(0,mt).indexOf("<script");if(Vt!==-1){let Ht=B.slice(0,Vt),nn=B.slice(Vt);B=Ht+it+`
2632
2632
  `+nn}else B=B.replace("</head>",`${it}
2633
2633
  </head>`)}else if(B.includes("<body"))B=B.replace(/<body([^>]*)>/,`<body$1>
2634
2634
  ${it}`);else B=it+`
2635
- `+B}{let{scanScriptTags:ut}=await ht("stx/signal-processing",()=>import("./chunk-ne03tfje.js")),it=[];for(let mt of ut(B)){if(!/\bserver\b/i.test(mt.attrs))continue;let kt=mt.start+mt.fullMatch.indexOf(">")+1,Vt=Ym(B,kt);if(Vt===-1)continue;let Ht=Vt+9;while(Ht<B.length&&/\s/.test(B[Ht]))Ht++;it.push({start:mt.start,end:Ht})}if(it.length>0){let mt=Array(it.length+1),kt=0;for(let Vt=0;Vt<it.length;Vt++){let{start:Ht,end:nn}=it[Vt];mt[Vt]=B.slice(kt,Ht),kt=nn}mt[it.length]=B.slice(kt),B=mt.join("")}}let lt=qo(B,k);if(lt.hasScoped)B=lt.html;let wt=_.__stx_event_bindings||[],ft=!1,Ft=[],Mn=/\s:[a-z][\w.-]*\s*=/.test(B),{scanScriptTags:Tn}=await ht("stx/signal-processing",()=>import("./chunk-ne03tfje.js"));for(let ut of Tn(B,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/}))Ft.push({match:ut.fullMatch,attrs:ut.attrs,content:ut.body});for(let{match:ut,attrs:it,content:mt}of Ft){ft=!0;let kt=mt;Rs(mt,k,R.strict,_.__originalFilePath);let Vt=await we(mt,{eventBindings:wt,attrs:it,hasColonDirectives:Mn,templateContent:v,filePath:k,projectRoot:process.cwd(),production:Ws(R.buildMode),serverData:De});B=B.replace(ut,()=>Vt)}if(ft)_.__stx_event_bindings=[];if(!ft&&_.__stxProcessingDepth===1){let ut=_.__stx_event_bindings||[];if(ut.length>0){let it=Wa(ut);if(it){let mt=B.lastIndexOf("</body>");B=mt===-1?B+it:B.slice(0,mt)+it+`
2636
- `+B.slice(mt)}_.__stx_event_bindings=[]}}if(!ue(B)&&bm(B))B=await Ca(B,z);if(B=vm(B),z.csp?.enabled&&z.csp.useNonce&&typeof _.cspNonce==="string")B=bp(B,_.cspNonce);return B}var WS=[{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"}],FS=[{pattern:/@if\s*[^(]/,message:"@if directive missing parentheses",suggestion:"Use @if(condition)"},{pattern:/@foreach\s*[^(]/,message:"@foreach directive missing parentheses",suggestion:"Use @foreach(items as item)"},{pattern:/@foreach\([^)]*\)\s*[^@\n<]/,message:"@foreach may have content on same line",suggestion:"Put content on new line after @foreach()"},{pattern:/@include\s*[^(]/,message:"@include directive missing parentheses",suggestion:"Use @include('partial-name')"},{pattern:/@extends\s*[^(]/,message:"@extends directive missing parentheses",suggestion:"Use @extends('layout-name') or @layout('layout-name')"},{pattern:/@layout\s*[^(]/,message:"@layout directive missing parentheses",suggestion:"Use @layout('layout-name')"}],VS=[{pattern:/\{\{\s*constructor\s*\}\}/,message:"Attempting to access constructor property"},{pattern:/\{\{\s*__proto__\s*\}\}/,message:"Attempting to access __proto__ property"},{pattern:/\{\{\s*eval\s*\(/,message:"Attempting to use eval in expression"}];function Lc(v){let _=[],k=[];return US(v,_),HS(v,_,k),qS(v,k),KS(v,_),{valid:_.length===0,errors:_,warnings:k}}function US(v,_){let k=(v.match(/\{\{/g)||[]).length,R=(v.match(/\}\}/g)||[]).length;if(k!==R)_.push({type:"expression",message:`Unclosed expression brackets: found ${k} opening '{{' and ${R} closing '}}'`,suggestion:"Ensure every {{ has a matching }}"})}function HS(v,_,k){for(let R of WS){let T=new RegExp(`${R.open}(?:\\s|\\()`,"g"),B=new RegExp(R.close,"g"),z=(v.match(T)||[]).length,W=(v.match(B)||[]).length;if(R.altClose){let F=new RegExp(R.altClose,"g");W+=(v.match(F)||[]).length}if(z>W)_.push({type:"directive",message:`Unclosed @${R.name} directive: found ${z} opening and ${W} closing`,suggestion:`Add ${z-W} missing ${R.close} tag(s)`});else if(W>z)k.push({type:"directive",message:`Extra ${R.close} found: ${W-z} more closing than opening`,suggestion:`Check for orphaned ${R.close} tags`})}}function qS(v,_){for(let k of FS)if(k.pattern.test(v))_.push({type:"syntax",message:k.message,suggestion:k.suggestion})}function KS(v,_){for(let k of VS)if(k.pattern.test(v))_.push({type:"expression",message:`Security warning: ${k.message}`,suggestion:"Remove dangerous code from template expressions"})}function jc(v,_){let k=v.slice(0,_).split(`
2635
+ `+B}{let{scanScriptTags:ut}=await ht("stx/signal-processing",()=>import("./chunk-xyzy84x0.js")),it=[];for(let mt of ut(B)){if(!/\bserver\b/i.test(mt.attrs))continue;let kt=mt.start+mt.fullMatch.indexOf(">")+1,Vt=Ym(B,kt);if(Vt===-1)continue;let Ht=Vt+9;while(Ht<B.length&&/\s/.test(B[Ht]))Ht++;it.push({start:mt.start,end:Ht})}if(it.length>0){let mt=Array(it.length+1),kt=0;for(let Vt=0;Vt<it.length;Vt++){let{start:Ht,end:nn}=it[Vt];mt[Vt]=B.slice(kt,Ht),kt=nn}mt[it.length]=B.slice(kt),B=mt.join("")}}let lt=qo(B,k);if(lt.hasScoped)B=lt.html;let wt=_.__stx_event_bindings||[],ft=!1,Ft=[],Mn=/\s:[a-z][\w.-]*\s*=/.test(B),{scanScriptTags:Tn}=await ht("stx/signal-processing",()=>import("./chunk-xyzy84x0.js"));for(let ut of Tn(B,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/}))Ft.push({match:ut.fullMatch,attrs:ut.attrs,content:ut.body});for(let{match:ut,attrs:it,content:mt}of Ft){ft=!0;let kt=mt;Rs(mt,k,R.strict,_.__originalFilePath);let Vt=await ve(mt,{eventBindings:wt,attrs:it,hasColonDirectives:Mn,templateContent:v,filePath:k,projectRoot:process.cwd(),production:Ws(R.buildMode),serverData:De});B=B.replace(ut,()=>Vt)}if(ft)_.__stx_event_bindings=[];if(!ft&&_.__stxProcessingDepth===1){let ut=_.__stx_event_bindings||[];if(ut.length>0){let it=Wa(ut);if(it){let mt=B.lastIndexOf("</body>");B=mt===-1?B+it:B.slice(0,mt)+it+`
2636
+ `+B.slice(mt)}_.__stx_event_bindings=[]}}if(!de(B)&&bm(B))B=await Ca(B,z);if(B=vm(B),z.csp?.enabled&&z.csp.useNonce&&typeof _.cspNonce==="string")B=bp(B,_.cspNonce);return B}var WS=[{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"}],FS=[{pattern:/@if\s*[^(]/,message:"@if directive missing parentheses",suggestion:"Use @if(condition)"},{pattern:/@foreach\s*[^(]/,message:"@foreach directive missing parentheses",suggestion:"Use @foreach(items as item)"},{pattern:/@foreach\([^)]*\)\s*[^@\n<]/,message:"@foreach may have content on same line",suggestion:"Put content on new line after @foreach()"},{pattern:/@include\s*[^(]/,message:"@include directive missing parentheses",suggestion:"Use @include('partial-name')"},{pattern:/@extends\s*[^(]/,message:"@extends directive missing parentheses",suggestion:"Use @extends('layout-name') or @layout('layout-name')"},{pattern:/@layout\s*[^(]/,message:"@layout directive missing parentheses",suggestion:"Use @layout('layout-name')"}],VS=[{pattern:/\{\{\s*constructor\s*\}\}/,message:"Attempting to access constructor property"},{pattern:/\{\{\s*__proto__\s*\}\}/,message:"Attempting to access __proto__ property"},{pattern:/\{\{\s*eval\s*\(/,message:"Attempting to use eval in expression"}];function Lc(v){let _=[],k=[];return US(v,_),HS(v,_,k),qS(v,k),KS(v,_),{valid:_.length===0,errors:_,warnings:k}}function US(v,_){let k=(v.match(/\{\{/g)||[]).length,R=(v.match(/\}\}/g)||[]).length;if(k!==R)_.push({type:"expression",message:`Unclosed expression brackets: found ${k} opening '{{' and ${R} closing '}}'`,suggestion:"Ensure every {{ has a matching }}"})}function HS(v,_,k){for(let R of WS){let T=new RegExp(`${R.open}(?:\\s|\\()`,"g"),B=new RegExp(R.close,"g"),z=(v.match(T)||[]).length,W=(v.match(B)||[]).length;if(R.altClose){let F=new RegExp(R.altClose,"g");W+=(v.match(F)||[]).length}if(z>W)_.push({type:"directive",message:`Unclosed @${R.name} directive: found ${z} opening and ${W} closing`,suggestion:`Add ${z-W} missing ${R.close} tag(s)`});else if(W>z)k.push({type:"directive",message:`Extra ${R.close} found: ${W-z} more closing than opening`,suggestion:`Check for orphaned ${R.close} tags`})}}function qS(v,_){for(let k of FS)if(k.pattern.test(v))_.push({type:"syntax",message:k.message,suggestion:k.suggestion})}function KS(v,_){for(let k of VS)if(k.pattern.test(v))_.push({type:"expression",message:`Security warning: ${k.message}`,suggestion:"Remove dangerous code from template expressions"})}function jc(v,_){let k=v.slice(0,_).split(`
2637
2637
  `);return{line:k.length,column:k[k.length-1].length+1}}function Bc(v,_,k){let R=[];switch(v){case"if":case"elseif":case"unless":if(k.length===0)R.push({type:"syntax",message:`@${v} requires a condition`,suggestion:`Use @${v}(condition)`});break;case"foreach":if(k.length===0||!k[0].includes(" as "))R.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)R.push({type:"syntax",message:"@for requires loop parameters",suggestion:"Use @for(let i = 0; i < 10; i++)"});break;case"switch":if(k.length===0)R.push({type:"syntax",message:"@switch requires an expression",suggestion:"Use @switch(expression)"});break;case"case":if(k.length===0)R.push({type:"syntax",message:"@case requires a value",suggestion:"Use @case(value)"});break;case"include":case"extends":case"component":if(k.length===0)R.push({type:"syntax",message:`@${v} requires a path`,suggestion:`Use @${v}('path/to/template')`});break}return R}function Fc(v){return/@[a-z]+/i.test(v)||/\{\{/.test(v)}function zc(v){let _=v.matchAll(/@([a-z]+)/gi),k=new Set;for(let R of _){let T=R[1].toLowerCase();if(!T.startsWith("end"))k.add(T)}return Array.from(k)}import zn from"path";import Oi from"process";var At=["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 eh=new Set(At),XS=new Set(["props","$props","defineProps"]),ZS=new Set(["stx","@stacksjs/stx"]),th=m(128),nh=m(64);function GS(v){let _=[],k=0,R=v.split(`
2638
2638
  `);for(let T of R){let B=k,z=null,W=!1;for(let F=0;F<T.length;F++){let V=T[F];if(W){W=!1;continue}if(V==="\\"){W=!0;continue}if(z){if(V===z)z=null;continue}if(V==="'"||V==='"'||V==="`"){z=V;continue}if(V==="/"&&F+1<T.length&&T[F+1]==="/")break;if(V==="{")k++;else if(V==="}")k--}if(B===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 q=V[1].slice(1,-1).split(",").map((Q)=>{let Z=Q.split(":");return(Z.length>1?Z[1]:Z[0]).trim()}).filter((Q)=>/^\w+$/.test(Q));_.push(...q)}}}}return[...new Set(_)]}function $c(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(R){if(!R.includes(":"))return R;let T=[],B="",z=0,W=0,F=null;for(let V=0;V<R.length;V++){let H=R[V];if(F){if(B+=H,H===F)F=null;continue}if(H==='"'||H==="'"||H==="`"){F=H,B+=H;continue}if(H==="<")z++;else if(H===">"&&z>0)z--;else if(H==="(")W++;else if(H===")")W--;if(H===","&&z===0&&W===0){T.push(B),B="";continue}B+=H}if(B)T.push(B);return T.map((V)=>{let H=V.trim(),q=H.startsWith("..."),Q=q?H.slice(3):H,Z=-1,se=0;for(let $e=0;$e<Q.length;$e++)if(Q[$e]==="<")se++;else if(Q[$e]===">")se--;else if(Q[$e]===":"&&se===0){Z=$e;break}if(Z===-1)return V;let oe=Q.substring(0,Z).trim().replace(/\?$/,""),ae=Q.substring(Z+1),le=-1,ce=0;for(let $e=0;$e<ae.length;$e++)if(ae[$e]==="<")ce++;else if(ae[$e]===">")ce--;else if(ae[$e]==="="&&ce===0){le=$e;break}let ge=q?"...":"";if(le!==-1)return`${ge}${oe} = ${ae.substring(le+1).trim()}`;return`${ge}${oe}`}).join(", ")}_=_.replace(/\b(function\s+\w*\s*)\(([^)]*)\)/g,(R,T,B)=>{if(!B.includes(":"))return R;return`${T}(${k(B)})`});{let R=/\b(function\s+\w*\s*)\(/g,T,B=[];while((T=R.exec(_))!==null){let z=T.index+T[0].length-1,W=1,F=z+1,V=0,H=null;while(F<_.length&&W>0){let Z=_[F];if(H){if(Z===H)H=null;F++;continue}if(Z==='"'||Z==="'"||Z==="`"){H=Z,F++;continue}if(Z==="<")V++;else if(Z===">"&&V>0)V--;else if(V===0){if(Z==="(")W++;else if(Z===")")W--}if(W>0)F++}if(W!==0)continue;let q=_.substring(z+1,F);if(!q.includes(":"))continue;let Q=k(q);B.push({start:z+1,end:F,replacement:Q})}for(let z=B.length-1;z>=0;z--){let{start:W,end:F,replacement:V}=B[z];_=_.substring(0,W)+V+_.substring(F)}}return _=_.replace(/\(([^)]*)\)\s*(?::\s*[^=]+)?\s*=>/g,(R,T)=>{if(!T.includes(":"))return R;if(T.includes("{")||T.includes("}"))return R;return`(${T.split(",").map((z)=>{let[W,...F]=z.split("="),V=W.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,`
2639
2639
 
2640
- `),_}function Rc(v){return v.replace(/\s*(?:imported from|from)\s+(?:(['"])([^'"\r\n]+)\1|(\S+))/g,(_,...k)=>{let[,R,T]=k,B=R??T;return/(?:[/\\]packages[/\\]stx[/\\]|@stacksjs[/\\]stx[/\\])/.test(B)?"":_})}function Ac(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 Ic(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 rh=new Set;async function d(v,_,k,R={}){if(!v.trim())return;let T=w(),B=h(v,JSON.stringify(T)),z=th.get(B);if(z===void 0){try{let Oe=j({loader:"ts",target:"browser",define:T}),Ze=v.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");Ze=Ze.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,""),z=Oe.transformSync(Ze)}catch{z=$c(v)}th.set(B,z)}let W={exports:{}},F=W.exports,V=Oi.cwd(),H={},q=[...z.matchAll(/require\s*\(\s*['"]([^'"]+)['"]\s*\)/g)||[]].map((Oe)=>Oe[1]).filter((Oe)=>!Oe.startsWith("node:")&&!["fs","path","os","child_process","crypto","http","https","url","util","stream","events","buffer","net","querystring","zlib","tls"].includes(Oe)),Q=new Map;for(let Oe of q)try{if(Oe.startsWith(".")){H[Oe]=await import(zn.resolve(zn.dirname(k),Oe));continue}let Ze=zn.resolve(V,"node_modules",Oe),ot=zn.join(Ze,"package.json"),xt=JSON.parse(u("fs").readFileSync(ot,"utf8")),Mt=xt.main||"index.js";if(xt.exports){let Zt=typeof xt.exports==="string"?xt.exports:xt.exports["."];if(typeof Zt==="string")Mt=Zt;else if(Zt?.bun)Mt=Zt.bun;else if(Zt?.import)Mt=Zt.import;else if(Zt?.default)Mt=Zt.default}H[Oe]=await import(zn.resolve(Ze,Mt))}catch(Ze){if(Oe.startsWith("."))Q.set(Oe,Ze instanceof Error?Ze.message:String(Ze))}let Z=(Oe)=>{if(H[Oe])return H[Oe];let Ze=Q.get(Oe);if(Ze!==void 0)throw Error(`Cannot require '${Oe}' from ${k}: ${Ze}`);return u(Oe)},se=_.props||{},ie=(Oe)=>{if(!Oe)return se;let Ze={};for(let[ot,xt]of Object.entries(Oe)){let Mt=se[ot];if(Mt!==void 0)Ze[ot]=Mt;else if(typeof xt==="function")Ze[ot]=xt();else Ze[ot]=xt}return Ze};for(let[Oe,Ze]of Object.entries(se))Object.defineProperty(ie,Oe,{value:Ze,enumerable:!0,configurable:!0,writable:!0});let oe=(Oe,Ze=!1)=>{if(Oe===void 0||Oe===null)return Ze;if(typeof Oe==="string"){let ot=Oe.trim().toLowerCase();if(ot===""||ot==="true"||ot==="1"||ot==="on"||ot==="yes")return!0;if(ot==="false"||ot==="0"||ot==="off"||ot==="no")return!1;return!0}return Boolean(Oe)},ae=(Oe,Ze=0)=>{if(Oe===void 0||Oe===null)return Ze;if(typeof Oe==="string"){let xt=Oe.trim();if(xt==="")return Ze;let Mt=Number(xt);return Number.isFinite(Mt)?Mt:Ze}let ot=Number(Oe);return Number.isFinite(ot)?ot:Ze};for(let Oe of["name","length","caller","arguments"]){if(Object.prototype.hasOwnProperty.call(se,Oe))continue;try{Object.defineProperty(ie,Oe,{value:void 0,enumerable:!1,configurable:!0,writable:!0})}catch{}}let le=(Oe)=>{if(!Oe)return se;let Ze={...se};for(let[ot,xt]of Object.entries(Oe)){let Mt=xt&&typeof xt==="object"&&!Array.isArray(xt)?xt:{type:xt};if(Ze[ot]===void 0&&Mt.default!==void 0)Ze[ot]=typeof Mt.default==="function"?Mt.default():Mt.default}return Ze},ce=()=>_.slots||{},ge=(Oe,Ze)=>{let ot={...Oe};for(let[xt,Mt]of Object.entries(Ze))if(ot[xt]===void 0)if(typeof Mt==="function")ot[xt]=Mt();else ot[xt]=Mt;return ot},$e=(Oe)=>{let Ze=()=>Oe;return Ze.set=(ot)=>{},Ze.update=(ot)=>{},Ze},ye=(Oe)=>{let Ze,ot=!1;return()=>{if(!ot)try{Ze=Oe(),ot=!0}catch{Ze=void 0}return Ze}},ke=(Oe)=>{},Re=(Oe)=>Oe(),Ae=(Oe)=>{},Ie=(Oe)=>{},Pe=Jn(_);function Ee(Oe){let Ze=Oe||{};if(Ze.title!==void 0||Ze.description!==void 0)Le({title:Ze.title,description:Ze.description})}function Me(Oe){if(!Oe||typeof Oe!=="object")return;let Ze=_.__stxClientPayload??{};Object.assign(Ze,Oe),_.__stxClientPayload=Ze}let je=()=>{let Oe=_.__stxServeContext,Ze=_.__stxServeSearch??Oe?.search??"",ot=Oe?.path??"",xt=Object.fromEntries(new URLSearchParams(Ze)),Mt=_.query,Zt=Object.keys(xt).length>0?xt:Mt??{},qr=Ze||(Object.keys(Zt).length>0?`?${new URLSearchParams(Zt).toString()}`:"");return{params:_.params??{},query:Zt,path:ot,name:"",fullPath:ot+qr,hash:"",matched:[]}},Ne=()=>({push:(Oe)=>{},replace:(Oe)=>{},back:()=>{},forward:()=>{},go:(Oe)=>{}}),De=(Oe)=>{let Ze=_.__stx_runtime_head||{};_.__stx_runtime_head=he(Ze,me(Oe||{},{known:ur,source:"useHead()"}))},Le=(Oe)=>{De(pr(Oe||{}))},ct=(Oe)=>({value:Oe}),yt=(Oe)=>Oe,pt=(Oe)=>({value:typeof Oe==="function"?Oe():Oe}),st=(Oe,Ze)=>{},gt=(Oe)=>{},dt=(Oe)=>{},St=(Oe)=>Oe?Oe():Promise.resolve(),lt=(Oe)=>(Ze,...ot)=>{},wt=(Oe)=>{},ft=(Oe,Ze)=>{},Ft=(Oe,Ze)=>Ze,Mn=()=>({value:"light"}),Tn=()=>$e(!1),ut=(Oe)=>$e(!1),it=()=>$e(!1),mt=()=>ut("(prefers-color-scheme: dark)"),kt=()=>ut("(prefers-color-scheme: light)"),Vt=()=>ut("(prefers-reduced-motion: reduce)"),Ht=()=>ut("(prefers-contrast: more)"),nn={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:{}},Ma=new Proxy(nn,{get(Oe,Ze){if(Ze in Oe)return Oe[Ze];return},set(Oe,Ze,ot){return Oe[Ze]=ot,!0}}),Fn={getElementById:()=>null,querySelector:()=>null,querySelectorAll:()=>[],createElement:()=>({}),createTextNode:()=>({}),body:{},head:{},documentElement:{},addEventListener:()=>{},removeEventListener:()=>{}},Oa=console;try{let Oe=xs(z,k),Ze=new Set(Object.keys(se)),ot=Object.keys(_).filter((et)=>!Ze.has(et)&&!XS.has(et)&&tt(et)),xt=ot.map((et)=>_[et]);if(!ot.includes("__stxServeContext"))ot.push("__stxServeContext"),xt.push(void 0);if(!Ze.has("cookies")){let et=_.cookies??_.__stxServeContext?.cookies??{},Lt=ot.indexOf("cookies");if(Lt<0)ot.push("cookies"),xt.push(et);else xt[Lt]=et}let Mt=new Set(["async","module","exports","require","params","window","document","console","state","derived","effect"]),Zt=[],qr=[];for(let[et,Lt]of Object.entries(se)){if(!tt(et))continue;if(Mt.has(et))continue;if(new RegExp(`(?:^|[\\s;{])(?:const|let|var|function)\\s+${et}\\b`).test(Oe))continue;Zt.push(et),qr.push(Lt)}let $o=GS(Oe).map((et)=>`module.exports.${et} = typeof ${et} !== 'undefined' ? ${et} : module.exports.${et};`).join(`
2641
- `),_o=_.params??{},ko=[],gr=[];for(let et=0;et<ot.length;et++){if(ot[et]==="params")continue;ko.push(ot[et]),gr.push(xt[et])}let Kr=[...At,...Zt,...ko],Vn=`return (async () => {
2640
+ `),_}function Rc(v){return v.replace(/\s*(?:imported from|from)\s+(?:(['"])([^'"\r\n]+)\1|(\S+))/g,(_,...k)=>{let[,R,T]=k,B=R??T;return/(?:[/\\]packages[/\\]stx[/\\]|@stacksjs[/\\]stx[/\\])/.test(B)?"":_})}function Ac(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 Ic(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 rh=new Set;async function u(v,_,k,R={}){if(!v.trim())return;let T=w(),B=h(v,JSON.stringify(T)),z=th.get(B);if(z===void 0){try{let Oe=j({loader:"ts",target:"browser",define:T}),Ze=v.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");Ze=Ze.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,""),z=Oe.transformSync(Ze)}catch{z=$c(v)}th.set(B,z)}let W={exports:{}},F=W.exports,V=Oi.cwd(),H={},q=[...z.matchAll(/require\s*\(\s*['"]([^'"]+)['"]\s*\)/g)||[]].map((Oe)=>Oe[1]).filter((Oe)=>!Oe.startsWith("node:")&&!["fs","path","os","child_process","crypto","http","https","url","util","stream","events","buffer","net","querystring","zlib","tls"].includes(Oe)),Q=new Map;for(let Oe of q)try{if(Oe.startsWith(".")){H[Oe]=await import(zn.resolve(zn.dirname(k),Oe));continue}let Ze=zn.resolve(V,"node_modules",Oe),ot=zn.join(Ze,"package.json"),xt=JSON.parse(d("fs").readFileSync(ot,"utf8")),Mt=xt.main||"index.js";if(xt.exports){let Zt=typeof xt.exports==="string"?xt.exports:xt.exports["."];if(typeof Zt==="string")Mt=Zt;else if(Zt?.bun)Mt=Zt.bun;else if(Zt?.import)Mt=Zt.import;else if(Zt?.default)Mt=Zt.default}H[Oe]=await import(zn.resolve(Ze,Mt))}catch(Ze){if(Oe.startsWith("."))Q.set(Oe,Ze instanceof Error?Ze.message:String(Ze))}let Z=(Oe)=>{if(H[Oe])return H[Oe];let Ze=Q.get(Oe);if(Ze!==void 0)throw Error(`Cannot require '${Oe}' from ${k}: ${Ze}`);return d(Oe)},se=_.props||{},ie=(Oe)=>{if(!Oe)return se;let Ze={};for(let[ot,xt]of Object.entries(Oe)){let Mt=se[ot];if(Mt!==void 0)Ze[ot]=Mt;else if(typeof xt==="function")Ze[ot]=xt();else Ze[ot]=xt}return Ze};for(let[Oe,Ze]of Object.entries(se))Object.defineProperty(ie,Oe,{value:Ze,enumerable:!0,configurable:!0,writable:!0});let oe=(Oe,Ze=!1)=>{if(Oe===void 0||Oe===null)return Ze;if(typeof Oe==="string"){let ot=Oe.trim().toLowerCase();if(ot===""||ot==="true"||ot==="1"||ot==="on"||ot==="yes")return!0;if(ot==="false"||ot==="0"||ot==="off"||ot==="no")return!1;return!0}return Boolean(Oe)},ae=(Oe,Ze=0)=>{if(Oe===void 0||Oe===null)return Ze;if(typeof Oe==="string"){let xt=Oe.trim();if(xt==="")return Ze;let Mt=Number(xt);return Number.isFinite(Mt)?Mt:Ze}let ot=Number(Oe);return Number.isFinite(ot)?ot:Ze};for(let Oe of["name","length","caller","arguments"]){if(Object.prototype.hasOwnProperty.call(se,Oe))continue;try{Object.defineProperty(ie,Oe,{value:void 0,enumerable:!1,configurable:!0,writable:!0})}catch{}}let le=(Oe)=>{if(!Oe)return se;let Ze={...se};for(let[ot,xt]of Object.entries(Oe)){let Mt=xt&&typeof xt==="object"&&!Array.isArray(xt)?xt:{type:xt};if(Ze[ot]===void 0&&Mt.default!==void 0)Ze[ot]=typeof Mt.default==="function"?Mt.default():Mt.default}return Ze},ce=()=>_.slots||{},ge=(Oe,Ze)=>{let ot={...Oe};for(let[xt,Mt]of Object.entries(Ze))if(ot[xt]===void 0)if(typeof Mt==="function")ot[xt]=Mt();else ot[xt]=Mt;return ot},$e=(Oe)=>{let Ze=()=>Oe;return Ze.set=(ot)=>{},Ze.update=(ot)=>{},Ze},ye=(Oe)=>{let Ze,ot=!1;return()=>{if(!ot)try{Ze=Oe(),ot=!0}catch{Ze=void 0}return Ze}},ke=(Oe)=>{},Re=(Oe)=>Oe(),Ae=(Oe)=>{},Ie=(Oe)=>{},Pe=Yn(_);function Ee(Oe){let Ze=Oe||{};if(Ze.title!==void 0||Ze.description!==void 0)Le({title:Ze.title,description:Ze.description})}function Me(Oe){if(!Oe||typeof Oe!=="object")return;let Ze=_.__stxClientPayload??{};Object.assign(Ze,Oe),_.__stxClientPayload=Ze}let je=()=>{let Oe=_.__stxServeContext,Ze=_.__stxServeSearch??Oe?.search??"",ot=Oe?.path??"",xt=Object.fromEntries(new URLSearchParams(Ze)),Mt=_.query,Zt=Object.keys(xt).length>0?xt:Mt??{},qr=Ze||(Object.keys(Zt).length>0?`?${new URLSearchParams(Zt).toString()}`:"");return{params:_.params??{},query:Zt,path:ot,name:"",fullPath:ot+qr,hash:"",matched:[]}},Ne=()=>({push:(Oe)=>{},replace:(Oe)=>{},back:()=>{},forward:()=>{},go:(Oe)=>{}}),De=(Oe)=>{let Ze=_.__stx_runtime_head||{};_.__stx_runtime_head=he(Ze,me(Oe||{},{known:pr,source:"useHead()"}))},Le=(Oe)=>{De(fr(Oe||{}))},ct=(Oe)=>({value:Oe}),yt=(Oe)=>Oe,pt=(Oe)=>({value:typeof Oe==="function"?Oe():Oe}),st=(Oe,Ze)=>{},gt=(Oe)=>{},dt=(Oe)=>{},St=(Oe)=>Oe?Oe():Promise.resolve(),lt=(Oe)=>(Ze,...ot)=>{},wt=(Oe)=>{},ft=(Oe,Ze)=>{},Ft=(Oe,Ze)=>Ze,Mn=()=>({value:"light"}),Tn=()=>$e(!1),ut=(Oe)=>$e(!1),it=()=>$e(!1),mt=()=>ut("(prefers-color-scheme: dark)"),kt=()=>ut("(prefers-color-scheme: light)"),Vt=()=>ut("(prefers-reduced-motion: reduce)"),Ht=()=>ut("(prefers-contrast: more)"),nn={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:{}},Ma=new Proxy(nn,{get(Oe,Ze){if(Ze in Oe)return Oe[Ze];return},set(Oe,Ze,ot){return Oe[Ze]=ot,!0}}),Wn={getElementById:()=>null,querySelector:()=>null,querySelectorAll:()=>[],createElement:()=>({}),createTextNode:()=>({}),body:{},head:{},documentElement:{},addEventListener:()=>{},removeEventListener:()=>{}},Oa=console;try{let Oe=xs(z,k),Ze=new Set(Object.keys(se)),ot=Object.keys(_).filter((et)=>!Ze.has(et)&&!XS.has(et)&&tt(et)),xt=ot.map((et)=>_[et]);if(!ot.includes("__stxServeContext"))ot.push("__stxServeContext"),xt.push(void 0);if(!Ze.has("cookies")){let et=_.cookies??_.__stxServeContext?.cookies??{},Lt=ot.indexOf("cookies");if(Lt<0)ot.push("cookies"),xt.push(et);else xt[Lt]=et}let Mt=new Set(["async","module","exports","require","params","window","document","console","state","derived","effect"]),Zt=[],qr=[];for(let[et,Lt]of Object.entries(se)){if(!tt(et))continue;if(Mt.has(et))continue;if(new RegExp(`(?:^|[\\s;{])(?:const|let|var|function)\\s+${et}\\b`).test(Oe))continue;Zt.push(et),qr.push(Lt)}let $o=GS(Oe).map((et)=>`module.exports.${et} = typeof ${et} !== 'undefined' ? ${et} : module.exports.${et};`).join(`
2641
+ `),_o=_.params??{},ko=[],dr=[];for(let et=0;et<ot.length;et++){if(ot[et]==="params")continue;ko.push(ot[et]),dr.push(xt[et])}let Kr=[...At,...Zt,...ko],Fn=`return (async () => {
2642
2642
  ${Oe}
2643
2643
  ${$o}
2644
2644
  return module.exports
2645
- })()`,Qt=h(Vn,Kr.join("\x00")),nt=nh.get(Qt);if(!nt)nt=Function(...Kr,Vn),nh.set(Qt,nt);let at=_.__stx_options?.runtimeConfig;if(at||/\buse(?:Server)?RuntimeConfig\b/.test(z))await yn(_,k,at);let bt=await fe(_.__stx_runtime_config??It()??C(),()=>pm(_,()=>nt(W,F,Z,se,ie,oe,ae,le,ge,Me,gm,Ds,ir,$e,ye,ke,Re,Ae,Ie,Ee,je,Ne,De,Le,Pe.setResponseStatus,Pe.setResponseHeader,Pe.notFound,ct,yt,pt,st,gt,dt,St,lt,wt,ce,ft,Ft,Mn,Tn,ut,it,mt,kt,Vt,Ht,Ma,Fn,Oa,nn.confirm,nn.alert,nn.fetch,_o,...qr,...gr)));if(R.preserveExisting){for(let[et,Lt]of Object.entries(bt))if(!(et in _)||_[et]===void 0)_[et]=Lt}else Object.assign(_,bt);for(let[et,Lt]of Object.entries(se))if(!(et in _))_[et]=Lt}catch(Oe){if(_.__stx_strict_hydration)throw Oe;let Ze=Rc(Oe instanceof Error?Oe.message:String(Oe));if(Ac(Ze))console.warn(`[stx] server <script> in ${k??"<unknown>"} imports a module that does not resolve, so every variable in that script is undefined. Cause: ${Ze}`),R.onFailure?.({kind:"module-resolution",message:Ze,error:Oe});else if(Pc(Oe))console.warn(`[stx] server <script> in ${k??"<unknown>"} does not parse, so every variable in that script is undefined. Cause: ${Ze}`),R.onFailure?.({kind:"syntax",message:Ze,error:Oe});else if(Ic(Ze))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: ${Ze}`),R.onFailure?.({kind:"missing-binding",message:Ze,error:Oe});else{let ot=`${k??"<unknown>"}\x00${Ze}`;if(Oi.env.STX_DEBUG||!rh.has(ot))rh.add(ot),console.warn(`[stx] server <script> in ${k??"<unknown>"} threw, so every variable in that script is undefined and anything that reads one renders empty. Cause: ${Ze}`);R.onFailure?.({kind:"unknown",message:Ze,error:Oe})}try{await n0(z,_,k)}catch(ot){if(Oi.env.STX_DEBUG){let xt=ot instanceof Error?ot.message:String(ot);console.warn(`[stx] fallback extraction also failed in ${k??"<unknown>"}: ${xt}`)}}}}function Oc(v){let _=0,k=null,R=!1,T=!1;for(let B=0;B<v.length;B++){let z=v[B];if(k){if(z===k){if(k=null,R||_===0)T=!0}continue}if(z==="'"||z==='"'||z==="`"){k=z;continue}if(z==="{")_++;else if(z==="}")_--;else if(v.startsWith("from",B)&&_===0)R=!0}return k===null&&_===0&&T}var JS=/^(?:export\s+)?(?:const|let|var)\s+[A-Za-z_$][\w$]*(?:\s*,\s*[A-Za-z_$][\w$]*)*\s*;?$/;function xs(v,_){let k=_?zn.dirname(_):Oi.cwd(),R=Oi.cwd(),T=v.split(`
2645
+ })()`,Qt=h(Fn,Kr.join("\x00")),nt=nh.get(Qt);if(!nt)nt=Function(...Kr,Fn),nh.set(Qt,nt);let at=_.__stx_options?.runtimeConfig;if(at||/\buse(?:Server)?RuntimeConfig\b/.test(z))await yn(_,k,at);let bt=await fe(_.__stx_runtime_config??It()??C(),()=>pm(_,()=>nt(W,F,Z,se,ie,oe,ae,le,ge,Me,gm,Ds,ar,$e,ye,ke,Re,Ae,Ie,Ee,je,Ne,De,Le,Pe.setResponseStatus,Pe.setResponseHeader,Pe.notFound,ct,yt,pt,st,gt,dt,St,lt,wt,ce,ft,Ft,Mn,Tn,ut,it,mt,kt,Vt,Ht,Ma,Wn,Oa,nn.confirm,nn.alert,nn.fetch,_o,...qr,...dr)));if(R.preserveExisting){for(let[et,Lt]of Object.entries(bt))if(!(et in _)||_[et]===void 0)_[et]=Lt}else Object.assign(_,bt);for(let[et,Lt]of Object.entries(se))if(!(et in _))_[et]=Lt}catch(Oe){if(_.__stx_strict_hydration)throw Oe;let Ze=Rc(Oe instanceof Error?Oe.message:String(Oe));if(Ac(Ze))console.warn(`[stx] server <script> in ${k??"<unknown>"} imports a module that does not resolve, so every variable in that script is undefined. Cause: ${Ze}`),R.onFailure?.({kind:"module-resolution",message:Ze,error:Oe});else if(Pc(Oe))console.warn(`[stx] server <script> in ${k??"<unknown>"} does not parse, so every variable in that script is undefined. Cause: ${Ze}`),R.onFailure?.({kind:"syntax",message:Ze,error:Oe});else if(Ic(Ze))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: ${Ze}`),R.onFailure?.({kind:"missing-binding",message:Ze,error:Oe});else{let ot=`${k??"<unknown>"}\x00${Ze}`;if(Oi.env.STX_DEBUG||!rh.has(ot))rh.add(ot),console.warn(`[stx] server <script> in ${k??"<unknown>"} threw, so every variable in that script is undefined and anything that reads one renders empty. Cause: ${Ze}`);R.onFailure?.({kind:"unknown",message:Ze,error:Oe})}try{await n0(z,_,k)}catch(ot){if(Oi.env.STX_DEBUG){let xt=ot instanceof Error?ot.message:String(ot);console.warn(`[stx] fallback extraction also failed in ${k??"<unknown>"}: ${xt}`)}}}}function Oc(v){let _=0,k=null,R=!1,T=!1;for(let B=0;B<v.length;B++){let z=v[B];if(k){if(z===k){if(k=null,R||_===0)T=!0}continue}if(z==="'"||z==='"'||z==="`"){k=z;continue}if(z==="{")_++;else if(z==="}")_--;else if(v.startsWith("from",B)&&_===0)R=!0}return k===null&&_===0&&T}var JS=/^(?:export\s+)?(?:const|let|var)\s+[A-Za-z_$][\w$]*(?:\s*,\s*[A-Za-z_$][\w$]*)*\s*;?$/;function xs(v,_){let k=_?zn.dirname(_):Oi.cwd(),R=Oi.cwd(),T=v.split(`
2646
2646
  `),B=[],z=0;while(z<T.length){let W=T[z].trim();if(W.startsWith("interface ")||W.startsWith("export interface ")||W.startsWith("type ")||W.startsWith("export type ")){if(W.includes("{")&&!W.includes("}")){let F=0;for(;z<T.length;z++){for(let V of T[z])if(V==="{")F++;else if(V==="}")F--;if(F<=0)break}}z++;continue}if(W.startsWith("definePageMeta(")){let F=0,V=!1,H=z;for(let Z=z;Z<T.length&&!V;Z++){let se=null,ie=!1,oe=T[Z];for(let ae=0;ae<oe.length;ae++){let le=oe[ae];if(ie){ie=!1;continue}if(le==="\\"){ie=!0;continue}if(se){if(le===se)se=null;continue}if(le==='"'||le==="'"||le==="`"){se=le;continue}if(le==="(")F++;else if(le===")"){if(F--,F===0){z=Z+1,V=!0;break}}}}if(!V)z=T.length;let q=T.slice(H,z).join(`
2647
- `),Q=[];for(let Z of["title","description"]){let se=new RegExp(`\\b${Z}\\s*:\\s*(['"\`])((?:\\\\.|(?!\\1)[^\\\\])*)\\1`).exec(q);if(se)Q.push(`${Z}: ${JSON.stringify(se[2])}`)}if(Q.length>0)B.push(`useSeoMeta({ ${Q.join(", ")} });`);continue}if(W.startsWith("import ")||W==="import"||W.startsWith("import{")||/^import['"]/.test(W)){let F=W,V=0;while(!Oc(F)&&z+V+1<T.length)V++,F=`${F} ${T[z+V].trim()}`;z+=V;let H=F.match(/^import\s+(\w+)\s+from\s+['"](.+?)['"]/),q=F.match(/^import\s+\{([^}]*)\}\s+from\s+['"](.+?)['"]/),Q=F.match(/^import\s*['"](.+?)['"]/),Z=F,se=(ie)=>{if(ie.startsWith("."))return zn.resolve(k,ie);if(ie.startsWith("~/")||ie.startsWith("@/"))return zn.resolve(R,ie.slice(2));try{return Bun.resolveSync(ie,k)}catch{return ie}};if(H){let[,ie,oe]=H,ae=se(oe);B.push(`const ${ie} = (await import('${ae}')).default`),B.push(`module.exports.${ie} = ${ie};`)}else if(q){let[,ie,oe]=q,ae=se(oe),le=[],ce=[],ge=ZS.has(oe);for(let $e of ie.split(",")){let ye=$e.trim();if(!ye)continue;let ke=ye.split(/\s+as\s+/);if(ke.length===2){let[Re,Ae]=[ke[0].trim(),ke[1].trim()];if(ge&&eh.has(Re)){B.push(`const ${Ae} = ${Re};`);continue}le.push(`${Re}: ${Ae}`),ce.push(Ae)}else{if(ge&&eh.has(ye))continue;le.push(ye),ce.push(ye)}}if(le.length>0)B.push(`const { ${le.join(", ")} } = await import('${ae}')`);for(let $e of ce)B.push(`module.exports.${$e} = ${$e};`)}else if(Q){let ie=se(Q[1]);B.push(`await import('${ie}')`)}else B.push(Z);z++;continue}if(JS.test(W))B.push(T[z]),z++;else if(W.startsWith("export const ")||W.startsWith("export let ")||W.startsWith("export var ")){let F=ih(T,z),{type:V,name:H,value:q}=F;B.push(`${V} ${H} = ${q};`),B.push(`module.exports.${H} = ${H};`),z=F.nextIndex}else if(W.startsWith("export function ")||W.startsWith("export async function ")){let F=Eu(T,z);B.push(F.functionCode),B.push(`module.exports.${F.name} = ${F.name};`),z=F.nextIndex}else if(W.startsWith("const ")||W.startsWith("let ")||W.startsWith("var ")){let F=ih(T,z),{type:V,name:H,value:q}=F;B.push(`${V} ${H} = ${q};`),B.push(`module.exports.${H} = ${H};`),z=F.nextIndex}else if(W.startsWith("function ")||W.startsWith("async function ")){let F=Eu(T,z);B.push(F.functionCode),B.push(`module.exports.${F.name} = ${F.name};`),z=F.nextIndex}else if(W.startsWith("export default function ")||W.startsWith("export default async function ")){let F=T[z].replace(/^(\s*)export\s+default\s+/,"$1"),V=[...T];V[z]=F;let H=Eu(V,z);if(B.push(H.functionCode),H.name)B.push(`module.exports.default = ${H.name};`);z=H.nextIndex}else if(W.startsWith("export default ")){let F=W.replace(/^export\s+default\s+/,"").replace(/;$/,"");B.push(`module.exports.default = ${F};`),z++}else if(W.startsWith("class ")||W.startsWith("export class ")){let F=W.match(/(?:export\s+)?class\s+(\w+)/);if(F){let V=F[1],H=T[z].replace(/^export\s+/,""),q=0,Q=z;for(;Q<T.length;Q++){let Z=T[Q];for(let se of Z)if(se==="{")q++;else if(se==="}")q--;if(Q>z)H+=`
2647
+ `),Q=[];for(let Z of["title","description"]){let se=new RegExp(`\\b${Z}\\s*:\\s*(['"\`])((?:\\\\.|(?!\\1)[^\\\\])*)\\1`).exec(q);if(se)Q.push(`${Z}: ${JSON.stringify(se[2])}`)}if(Q.length>0)B.push(`useSeoMeta({ ${Q.join(", ")} });`);continue}if(W.startsWith("import ")||W==="import"||W.startsWith("import{")||/^import['"]/.test(W)){let F=W,V=0;while(!Oc(F)&&z+V+1<T.length)V++,F=`${F} ${T[z+V].trim()}`;z+=V;let H=F.match(/^import\s+(\w+)\s+from\s+['"](.+?)['"]/),q=F.match(/^import\s+\{([^}]*)\}\s+from\s+['"](.+?)['"]/),Q=F.match(/^import\s*['"](.+?)['"]/),Z=F,se=(ie)=>{if(ie.startsWith("."))return zn.resolve(k,ie);if(ie.startsWith("~/")||ie.startsWith("@/"))return zn.resolve(R,ie.slice(2));try{return Bun.resolveSync(ie,k)}catch{return ie}};if(H){let[,ie,oe]=H,ae=se(oe);B.push(`const ${ie} = (await import('${ae}')).default`),B.push(`module.exports.${ie} = ${ie};`)}else if(q){let[,ie,oe]=q,ae=se(oe),le=[],ce=[],ge=ZS.has(oe);for(let $e of ie.split(",")){let ye=$e.trim();if(!ye)continue;let ke=ye.split(/\s+as\s+/);if(ke.length===2){let[Re,Ae]=[ke[0].trim(),ke[1].trim()];if(ge&&eh.has(Re)){B.push(`const ${Ae} = ${Re};`);continue}le.push(`${Re}: ${Ae}`),ce.push(Ae)}else{if(ge&&eh.has(ye))continue;le.push(ye),ce.push(ye)}}if(le.length>0)B.push(`const { ${le.join(", ")} } = await import('${ae}')`);for(let $e of ce)B.push(`module.exports.${$e} = ${$e};`)}else if(Q){let ie=se(Q[1]);B.push(`await import('${ie}')`)}else B.push(Z);z++;continue}if(JS.test(W))B.push(T[z]),z++;else if(W.startsWith("export const ")||W.startsWith("export let ")||W.startsWith("export var ")){let F=ih(T,z),{type:V,name:H,value:q}=F;B.push(`${V} ${H} = ${q};`),B.push(`module.exports.${H} = ${H};`),z=F.nextIndex}else if(W.startsWith("export function ")||W.startsWith("export async function ")){let F=mu(T,z);B.push(F.functionCode),B.push(`module.exports.${F.name} = ${F.name};`),z=F.nextIndex}else if(W.startsWith("const ")||W.startsWith("let ")||W.startsWith("var ")){let F=ih(T,z),{type:V,name:H,value:q}=F;B.push(`${V} ${H} = ${q};`),B.push(`module.exports.${H} = ${H};`),z=F.nextIndex}else if(W.startsWith("function ")||W.startsWith("async function ")){let F=mu(T,z);B.push(F.functionCode),B.push(`module.exports.${F.name} = ${F.name};`),z=F.nextIndex}else if(W.startsWith("export default function ")||W.startsWith("export default async function ")){let F=T[z].replace(/^(\s*)export\s+default\s+/,"$1"),V=[...T];V[z]=F;let H=mu(V,z);if(B.push(H.functionCode),H.name)B.push(`module.exports.default = ${H.name};`);z=H.nextIndex}else if(W.startsWith("export default ")){let F=W.replace(/^export\s+default\s+/,"").replace(/;$/,"");B.push(`module.exports.default = ${F};`),z++}else if(W.startsWith("class ")||W.startsWith("export class ")){let F=W.match(/(?:export\s+)?class\s+(\w+)/);if(F){let V=F[1],H=T[z].replace(/^export\s+/,""),q=0,Q=z;for(;Q<T.length;Q++){let Z=T[Q];for(let se of Z)if(se==="{")q++;else if(se==="}")q--;if(Q>z)H+=`
2648
2648
  `+Z;if(q<=0&&Q>=z)break}B.push(H),B.push(`module.exports.${V} = ${V};`),z=Q+1}else B.push(W),z++}else if(W.includes("module.exports"))B.push(W),z++;else if(W.trim()&&!W.startsWith("//"))B.push(W),z++;else z++}return YS(B.join(`
2649
2649
  `),k,R)}function YS(v,_,k){let R=v.length,T="",B=0,z=null,W=!1,F=!1,V=0;while(B<R){let H=v[B],q=v[B+1];if(W){if(T+=H,H===`
2650
2650
  `)W=!1;B++;continue}if(F){if(T+=H,H==="*"&&q==="/"){T+=q,B+=2,F=!1;continue}B++;continue}if(!z&&H==="/"&&q==="/"){W=!0,T+=H,B++;continue}if(!z&&H==="/"&&q==="*"){F=!0,T+=H,B++;continue}if(z){if(T+=H,H==="\\"){T+=q,B+=2;continue}if(H===z&&z!=="`"){z=null,B++;continue}if(z==="`"){if(H==="$"&&q==="{"){V++,T+=q,B+=2;continue}if(H==="`"){z=null,B++;continue}}B++;continue}if(V>0){if(H==="{")V++;else if(H==="}")V--}if(H==='"'||H==="'"||H==="`"){z=H,T+=H,B++;continue}if(H==="a"&&v.startsWith("await",B)){let Q=QS(v,B);if(Q){let{quote:Z,path:se,end:ie}=Q;if(se.startsWith(".")||se.startsWith("~/")||se.startsWith("@/")){let oe=se.startsWith(".")?zn.resolve(_,se):zn.resolve(k,se.slice(2));T+=`await import(${Z}${oe}${Z})`,B=ie;continue}}}T+=H,B++}return T}function QS(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 R=v[k];if(R!=="'"&&R!=='"')return null;k++;let T=k;while(k<v.length&&v[k]!==R)if(v[k]==="\\")k+=2;else k++;if(k>=v.length)return null;let B=v.slice(T,k);k++;while(k<v.length&&/\s/.test(v[k]))k++;if(v[k]!==")")return null;return{quote:R,path:B,end:k+1}}function lh(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 uh(v){let _=[],k=v.slice(1,-1).trim();if(!k)return _;let R=0,T=0,B="";while(R<k.length){let z=k[R];if(z==="{"||z==="["){let W=T===0?lh(k,R):null;if(W){_.push(...uh(W.pattern)),R=W.endPos,B="";continue}T++}else if(z==="}"||z==="]")T--;if(T>0){R++;continue}if(z===","){if(B.trim())_.push(B.trim());B="",R++;continue}if(z===":"){B="",R++;continue}if(z==="="){if(B.trim())_.push(B.trim());B="",R++;while(R<k.length&&k[R]!==","&&T===0){if(k[R]==="{"||k[R]==="[")T++;else if(k[R]==="}"||k[R]==="]")T--;R++}continue}if(/[\w$]/.test(z))B+=z;R++}if(B.trim())_.push(B.trim());return _}function Dc(v){let _=/^(?:export\s+)?(const|let|var)\s+([A-Za-z_$][\w$]*)/.exec(v);if(!_)return null;let k=_[0].length,R=(T)=>T===" "||T==="\t";while(k<v.length&&R(v[k]))k++;if(v[k]===":"){let T=0,B=null;k++;for(;k<v.length;k++){let z=v[k];if(B){if(z==="\\"){k++;continue}if(z===B)B=null;continue}if(z==="'"||z==='"'||z==="`"){B=z;continue}if(z==="("||z==="["||z==="{"||z==="<"){T++;continue}if(z===")"||z==="]"||z==="}"||z===">"){T--;continue}if(z==="="&&T<=0){let W=v[k+1],F=v[k-1];if(W!=="="&&W!==">"&&F!=="="&&F!=="!"&&F!=="<"&&F!==">")break}}if(v[k]!=="=")return null}while(k<v.length&&R(v[k]))k++;if(v[k]!=="=")return null;return{type:_[1],name:_[2],value:v.slice(k+1).trim()}}function sh(v,_,k,R){let T=null,B=!1;for(let z of v){if(B){B=!1;continue}if(z==="\\"){B=!0;continue}if(T){if(z===T)T=null;continue}if(z==="'"||z==='"'||z==="`"){T=z;continue}if(z===_)R++;else if(z===k)R--}return R}function ih(v,_){let k=v[_].trim(),R=Dc(k),T=R?[k,R.type,R.name,R.value]:null;if(!T){let H=k.match(/^(?:export\s+)?(const|let|var)\s+/);if(H){let q=k.slice(H[0].length),Q=_;if(q.startsWith("{")||q.startsWith("[")){let se=q[0],ie=se==="{"?"}":"]",oe=sh(q,se,ie,0),ae=q;for(let le=_+1;le<v.length&&oe>0;le++)ae+=` ${v[le].trim()}`,Q=le,oe=sh(v[le],se,ie,oe);if(oe>0)ae=q,Q=_;q=ae}let Z=lh(q,0);if(Z){let se=H[1],ie=Z.pattern,oe=q.slice(Z.endPos).trim();if(oe.startsWith("=")){let ae=oe.slice(1).trim(),le=ae,ce=Math.max(Q,_);if(oh(ae)){let ke=ah(v,ce,ae);le=ke.value,ce=ke.nextIndex}else ce=ce+1;le=le.trim().replace(/;$/,"");let ge=uh(ie),$e=`__stx_src_${_}`,ye=ge.map((ke)=>`module.exports.${ke} = ${ke};`).join(`
2651
2651
  `);return{type:se,name:$e,value:`${le}; ${se} ${ie} = ${$e};
2652
2652
  ${ye}`,nextIndex:ce}}}}throw Error(`Failed to parse variable declaration: ${k}`)}let[,B,z,W]=T,F=W,V=_;if(oh(W)){let H=ah(v,_,W);F=H.value,V=H.nextIndex}else V=_+1;while(V<v.length){let H=v[V].trim();if(H.startsWith(".")||H.startsWith("?."))F+=`
2653
- ${v[V]}`,V++;else break}return F=F.trim().replace(/;$/,""),{type:B,name:z,value:F,nextIndex:V}}function Eu(v,_){let k=v[_].trim(),R=k.match(/^(?:export\s+)?(?:async\s+)?function\s+(\w+)/);if(!R)throw Error(`Failed to parse function declaration: ${k}`);let[,T]=R,B=k.replace(/^export\s+/,""),z=_;if(e0(k)){let W=t0(v,_,B);B=W.functionCode,z=W.nextIndex}else z=_+1;return{name:T,functionCode:B,nextIndex:z}}function oh(v){let _=v.trim();if(_.startsWith("{"))return S(_,"{","}",0)===-1;if(_.startsWith("["))return S(_,"[","]",0)===-1;return!dh(_)}function dh(v){let _={paren:0,bracket:0,brace:0},k=null,R=0;for(let T=0;T<v.length;T++){let B=v[T];if((T>0?v[T-1]:"")==="\\"&&k)continue;if((B==='"'||B==="'")&&!k){k=B;continue}if(B===k&&k!=="`"){k=null;continue}if(B==="`"&&!k){k="`";continue}if(B==="`"&&k==="`"&&R===0){k=null;continue}if(k==="`"&&B==="$"&&v[T+1]==="{"){R++,T++;continue}if(R>0&&B==="{"){R++;continue}if(R>0&&B==="}"){R--;continue}if(k)continue;if(B==="(")_.paren++;else if(B===")")_.paren--;else if(B==="[")_.bracket++;else if(B==="]")_.bracket--;else if(B==="{")_.brace++;else if(B==="}")_.brace--}return _.paren===0&&_.bracket===0&&_.brace===0&&k===null}function fh(v){let _=v.indexOf("(");if(_===-1)return v.indexOf("{");let k=S(v,"(",")",_);if(k===-1)return-1;return v.indexOf("{",k)}function e0(v){let _=fh(v);if(_===-1)return!0;return S(v,"{","}",_)===-1}function ah(v,_,k){let R=k,T=_+1;while(T<v.length&&!dh(R)){let B=v[T];R+=`
2653
+ ${v[V]}`,V++;else break}return F=F.trim().replace(/;$/,""),{type:B,name:z,value:F,nextIndex:V}}function mu(v,_){let k=v[_].trim(),R=k.match(/^(?:export\s+)?(?:async\s+)?function\s+(\w+)/);if(!R)throw Error(`Failed to parse function declaration: ${k}`);let[,T]=R,B=k.replace(/^export\s+/,""),z=_;if(e0(k)){let W=t0(v,_,B);B=W.functionCode,z=W.nextIndex}else z=_+1;return{name:T,functionCode:B,nextIndex:z}}function oh(v){let _=v.trim();if(_.startsWith("{"))return S(_,"{","}",0)===-1;if(_.startsWith("["))return S(_,"[","]",0)===-1;return!dh(_)}function dh(v){let _={paren:0,bracket:0,brace:0},k=null,R=0;for(let T=0;T<v.length;T++){let B=v[T];if((T>0?v[T-1]:"")==="\\"&&k)continue;if((B==='"'||B==="'")&&!k){k=B;continue}if(B===k&&k!=="`"){k=null;continue}if(B==="`"&&!k){k="`";continue}if(B==="`"&&k==="`"&&R===0){k=null;continue}if(k==="`"&&B==="$"&&v[T+1]==="{"){R++,T++;continue}if(R>0&&B==="{"){R++;continue}if(R>0&&B==="}"){R--;continue}if(k)continue;if(B==="(")_.paren++;else if(B===")")_.paren--;else if(B==="[")_.bracket++;else if(B==="]")_.bracket--;else if(B==="{")_.brace++;else if(B==="}")_.brace--}return _.paren===0&&_.bracket===0&&_.brace===0&&k===null}function fh(v){let _=v.indexOf("(");if(_===-1)return v.indexOf("{");let k=S(v,"(",")",_);if(k===-1)return-1;return v.indexOf("{",k)}function e0(v){let _=fh(v);if(_===-1)return!0;return S(v,"{","}",_)===-1}function ah(v,_,k){let R=k,T=_+1;while(T<v.length&&!dh(R)){let B=v[T];R+=`
2654
2654
  ${B}`,T++}while(T<v.length){let B=v[T].trim();if(B.startsWith(".")||B.startsWith("?."))R+=`
2655
2655
  ${v[T]}`,T++;else break}return{value:R,nextIndex:T}}function t0(v,_,k){let R=k,T=_+1;while(T<v.length){let B=fh(R);if(B!==-1){if(S(R,"{","}",B)!==-1)break}let z=v[T];R+=`
2656
- ${z}`,T++}return{functionCode:R,nextIndex:T}}function ch(v,_){let k=l(v,_)??l(`(${v})`,_);if(k!==void 0)return k;if(!/\bprocess\b/.test(v))return;let R={..._,process:Object.freeze({env:{...Oi.env}})},T=Object.keys(R).filter(tt),B=T.map((z)=>R[z]);try{return Function(...T,`'use strict'; return (${v});`)(...B)}catch{try{return Function(...T,`'use strict'; return ${v};`)(...B)}catch{return}}}async function n0(v,_,k){let R=v.matchAll(/export\s+(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:export\s+|$))/g);for(let B of R){let[,,z,W]=B;try{let F=W.trim().replace(/;$/,""),V=ch(F,_);if(V!==void 0)_[z]=V}catch(F){console.warn(`Failed to parse export ${z} 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 B of T){let[,,z,W]=B;if(!(z in _))try{let F=W.trim().replace(/;$/,""),V=ch(F,_);if(V!==void 0)_[z]=V}catch{}}}function bi(v){let _=v.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),k=_?_[1]:"",R=_?v.replace(/<script\b[^>]*>[\s\S]*?<\/script>/i,""):v;return{scriptContent:k,templateWithoutScript:R}}function wi(v){let _=v.trim();if(!_)return!1;return/(?:const|let|var|function)\s+\w+/.test(_)}var wo=new N(500),Pa=new N(1000),Ru=new N(2000),Tu=new N(500),vh=33554432,Au=vh;function r0(v){let _=v.componentRenderCacheBytes;if(typeof _!=="number"||_<0||_===Au)return;Au=_,Da.setMaxBytes(_)}var Da=new N(2000,{maxBytes:vh,sizeOf:(v)=>v.output.length});function s0(v){let _=new WeakSet;try{let k=(R)=>{if(R===void 0)return{__stxType:"undefined"};if(typeof R==="bigint")return{__stxType:"bigint",value:R.toString()};if(typeof R==="function"||typeof R==="symbol")throw TypeError("Non-serializable component input");if(R===null||typeof R!=="object")return R;if(_.has(R))throw TypeError("Circular component input");_.add(R);try{if(R instanceof Date)return{__stxType:"date",value:R.toISOString()};if(Array.isArray(R))return R.map(k);let T=Object.getPrototypeOf(R);if(T!==Object.prototype&&T!==null)throw TypeError("Non-plain component input");let B={};for(let z of Object.keys(R).sort())B[z]=k(R[z]);return B}finally{_.delete(R)}};return JSON.stringify(k(v))}catch{return null}}function i0(v){let _={};for(let[k,R]of Object.entries(v))if(!k.startsWith("__")||k==="__stxServeContext")_[k]=R;return _}function ph(v){return v.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Hc(v){return/\bjs\b/.test(v)||/\blang\s*=\s*["']?(js|javascript)["']?/i.test(v)}function Ge(v){return!Hc(v)}var Ia=new Map;function j(v){let _;try{_=JSON.stringify(v)}catch{return new Bun.Transpiler(v)}let k=Ia.get(_);if(k)return k;if(Ia.size>=16)Ia.clear();let R=new Bun.Transpiler(v);return Ia.set(_,R),R}var gh=new WeakMap,o0=256;function Ke(v){try{let _=j({loader:"ts",target:"browser",define:w()}),k=gh.get(_);if(!k)k=new Map,gh.set(_,k);let R=k.get(v);if(R!==void 0)return R;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 B=[];T=T.replace(/\{!![\s\S]*?!!\}/g,(W)=>{let F=B.length;return B.push(W),`"__STX_EXPR_${F}__"`}),T=T.replace(/\{\{\{[\s\S]*?\}\}\}/g,(W)=>{let F=B.length;return B.push(W),`"__STX_EXPR_${F}__"`}),T=T.replace(/\{\{[\s\S]*?\}\}/g,(W)=>{let F=B.length;return B.push(W),`"__STX_EXPR_${F}__"`});let z=_.transformSync(T);for(let W=0;W<B.length;W++)z=z.replace(`"__STX_EXPR_${W}__"`,B[W]),z=z.replace(`'__STX_EXPR_${W}__'`,B[W]);if(k.size>=o0){let W=k.keys().next();if(!W.done)k.delete(W.value)}return k.set(v,z),z}catch(_){if(process.env.STX_DEBUG_TS)console.warn("[STX] TypeScript transpilation error:",_);return v}}function a0(v){let _=[],k=new Set,R=0,T=0,B=v.length,z=(H)=>{T++;while(T<B){if(v[T]==="\\"){T+=2;continue}if(v[T]===H){T++;return}T++}},W=()=>{T++;while(T<B){if(v[T]==="\\"){T+=2;continue}if(v[T]==="`"){T++;return}if(v[T]==="$"&&v[T+1]==="{"){T+=2;let H=1;while(T<B&&H>0)if(v[T]==="{")H++,T++;else if(v[T]==="}")H--,T++;else if(v[T]==="'"||v[T]==='"')z(v[T]);else if(v[T]==="`")W();else T++;continue}T++}},F=()=>{if(v[T]==="/"&&v[T+1]==="/"){while(T<B&&v[T]!==`
2657
- `)T++;return!0}if(v[T]==="/"&&v[T+1]==="*"){T+=2;while(T<B-1&&!(v[T]==="*"&&v[T+1]==="/"))T++;return T+=2,!0}return!1},V=()=>{if(R!==0)return;let H=v.slice(T).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(H){let se=H[2].split(",").map((ie)=>{let oe=ie.trim().split(":");return oe[oe.length-1].trim()});for(let ie of se)if(ie&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(ie)&&!k.has(ie))_.push(ie),k.add(ie);return}let q=v.slice(T).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(q){let se=q[2];if(!k.has(se))_.push(se),k.add(se);return}let Q=v.slice(T).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(Q){let se=Q[1];if(!k.has(se))_.push(se),k.add(se);return}let Z=v.slice(T).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(Z){let se=Z[1];if(!k.has(se))_.push(se),k.add(se)}};while(T<B){if(F())continue;if(v[T]==="'"||v[T]==='"'){z(v[T]);continue}if(v[T]==="`"){W();continue}if(v[T]==="{"){R++,T++;continue}if(v[T]==="}"){R--,T++;continue}if(R===0&&/[a-z]/i.test(v[T])&&(T===0||/\s|[;{}()]/.test(v[T-1])))V();T++}return _}function c0(v){let _=[],k=0,R=0,T=null;for(let B=0;B<v.length;B++){let z=v[B];if(T){if(z==="\\"){B++;continue}if(z===T)T=null;continue}if(z==='"'||z==="'"||z==="`"){T=z;continue}if(z==="("||z==="["||z==="{")k++;else if(z===")"||z==="]"||z==="}")k--;else if(z===","&&k===0)_.push(v.slice(R,B)),R=B+1}if(R<v.length)_.push(v.slice(R));return _}function l0(v){let _=0,k=null;for(let R=0;R<v.length;R++){let T=v[R];if(k){if(T==="\\"){R++;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 B=v[R-1],z=v[R+1];if(B==="!"||B==="<"||B===">"||B==="=")continue;if(z==="="||z===">")continue;return R}}return-1}function u0(v,_){try{let k=/=\s*(?:withDefaults\s*\([\s\S]*?defineProps|defineProps)\b/.exec(v);if(!k)return;let R=k.index-1;while(R>=0&&/\s/.test(v[R]))R--;if(v[R]!=="}")return;let T=R,B=0,z=-1;for(;R>=0;R--){let F=v[R];if(F==="}")B++;else if(F==="{"){if(B--,B===0){z=R;break}}}if(z===-1)return;let W=v.slice(z+1,T);for(let F of c0(W)){let V=F.trim();if(!V||V.startsWith("..."))continue;let H=l0(V);if(H===-1)continue;let q=V.slice(0,H).trim();if(!/^[A-Z_$][\w$]*$/i.test(q))continue;if(_[q]!==void 0)continue;let Q=V.slice(H+1).trim();if(!Q)continue;try{let Z=Object.keys(_).filter(tt),se=Function(...Z,`"use strict"; return (${Q});`);_[q]=se(...Z.map((ie)=>_[ie]))}catch{}}}catch{}}var d0=new Set(["tr","td","th","thead","tbody","tfoot","caption","colgroup","col","option","optgroup","li","dt","dd","span"]);function Uc(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 R=k[2].toLowerCase();if(!d0.has(R))return null;let T=new RegExp(`<\\/?${R}(?=[\\s/>])(?:[^>"']|"[^"]*"|'[^']*')*>`,"iy"),B=ee(v,(V,H)=>(T.lastIndex=H,T.exec(V)?.index===H?T.lastIndex:-1));if(R==="span"&&/\sdata-stx-scope\s*=/.test(B[0]?.token||""))return null;let z=0,W=!1;for(let V of B){if(z+=V.token.startsWith("</")?-1:1,z<0)return null;if(z===0){if(v.slice(V.end).trim())return null;W=!0;break}}if(!W)return null;let F=k[0].length;return v.slice(0,F)+_+v.slice(F)}async function tr(v,_,k,R,T){let B=v.endsWith(".stx")?v.slice(0,-4):v,z=(ge)=>ge.split("-").map(($e)=>$e.charAt(0).toUpperCase()+$e.slice(1)).join(""),W=k.__importedComponents;if(W){for(let ge of[B,B.toLowerCase(),z(B),sn(B)])if(W.has(ge))return!0}let F=[...new Set([`${B}.stx`,`${z(B)}.stx`,`${sn(B)}.stx`])],V=typeof T.root==="string"?rt.resolve(T.root):void 0,H=V??rt.dirname(R),q=[],Q=(ge)=>{if(ge&&!q.includes(ge))q.push(ge)},Z=k.__originalFilePath;if(Z)Q(rt.join(rt.dirname(Z),"components"));Q(_),Q(T._rootComponentsDir),Q(rt.join(rt.dirname(R),"components")),Q(T.componentsDir);for(let ge of T._targetComponentDirs??[])Q(ge);if(V)Q(rt.resolve(V,"resources/views/components")),Q(rt.resolve(V,"resources/components")),Q(rt.resolve(V,"src/components")),Q(rt.resolve(V,"components"));for(let ge of T._layerComponentDirs??[])Q(ge);let se=T._pluginComponentDirs;if(Array.isArray(se))for(let ge of se)Q(typeof ge==="string"?ge:null);if(Q(T.fallbackComponentsDir),B.startsWith("./")||B.startsWith("../"))return r(rt.resolve(rt.dirname(R),`${B}.stx`));let ie=mh(rt.resolve(import.meta.dir,"components")),oe=q.map((ge)=>rt.isAbsolute(ge)?ge:rt.resolve(H,ge)),ae=`${F.join("\x00")}\x00\x00${oe.join("\x00")}`,le=Ru.get(ae);if(le!==void 0)return le;let ce=!1;e:for(let ge of oe){if(mh(ge)===ie)continue;for(let $e of F)if(await r(rt.join(ge,$e))){ce=!0;break e}}return Ru.set(ae,ce),ce}function mh(v){let _=Tu.get(v);if(_!==void 0)return _;let k=v;try{k=bh.realpathSync(v)}catch{}return Tu.set(v,k),k}function Vc(v){return v==="visible"||v==="idle"||v==="interaction"||v.startsWith("media:")}function ki(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 f0(v,_,k){if(!v.includes("{{")&&!v.includes("{!!"))return v;let R=(T,B)=>{let z;try{z=x(T,_)}catch{return B}if(z===void 0||z===null)return"";let W=String(z);if(/<\/style/i.test(W))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 W};return v.replace(/\{!!([\s\S]*?)!!\}/g,(T,B)=>R(B,T)).replace(/\{\{([\s\S]*?)\}\}/g,(T,B)=>R(B,T))}var hh=new Set;function yh(v,_,k,R){let T=`${v}\x00${_}\x00${R??""}`;if(!process.env.STX_DEBUG&&hh.has(T))return;hh.add(T);let B=_?` used in ${_}`:"",z=R?` Cause: ${R}.`:"",W=k.length>0?`
2656
+ ${z}`,T++}return{functionCode:R,nextIndex:T}}function ch(v,_){let k=l(v,_)??l(`(${v})`,_);if(k!==void 0)return k;if(!/\bprocess\b/.test(v))return;let R={..._,process:Object.freeze({env:{...Oi.env}})},T=Object.keys(R).filter(tt),B=T.map((z)=>R[z]);try{return Function(...T,`'use strict'; return (${v});`)(...B)}catch{try{return Function(...T,`'use strict'; return ${v};`)(...B)}catch{return}}}async function n0(v,_,k){let R=v.matchAll(/export\s+(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:export\s+|$))/g);for(let B of R){let[,,z,W]=B;try{let F=W.trim().replace(/;$/,""),V=ch(F,_);if(V!==void 0)_[z]=V}catch(F){console.warn(`Failed to parse export ${z} 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 B of T){let[,,z,W]=B;if(!(z in _))try{let F=W.trim().replace(/;$/,""),V=ch(F,_);if(V!==void 0)_[z]=V}catch{}}}function bi(v){let _=v.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),k=_?_[1]:"",R=_?v.replace(/<script\b[^>]*>[\s\S]*?<\/script>/i,""):v;return{scriptContent:k,templateWithoutScript:R}}function vi(v){let _=v.trim();if(!_)return!1;return/(?:const|let|var|function)\s+\w+/.test(_)}var wo=new N(500),Pa=new N(1000),yu=new N(2000),xu=new N(500),vh=33554432,bu=vh;function r0(v){let _=v.componentRenderCacheBytes;if(typeof _!=="number"||_<0||_===bu)return;bu=_,Da.setMaxBytes(_)}var Da=new N(2000,{maxBytes:vh,sizeOf:(v)=>v.output.length});function s0(v){let _=new WeakSet;try{let k=(R)=>{if(R===void 0)return{__stxType:"undefined"};if(typeof R==="bigint")return{__stxType:"bigint",value:R.toString()};if(typeof R==="function"||typeof R==="symbol")throw TypeError("Non-serializable component input");if(R===null||typeof R!=="object")return R;if(_.has(R))throw TypeError("Circular component input");_.add(R);try{if(R instanceof Date)return{__stxType:"date",value:R.toISOString()};if(Array.isArray(R))return R.map(k);let T=Object.getPrototypeOf(R);if(T!==Object.prototype&&T!==null)throw TypeError("Non-plain component input");let B={};for(let z of Object.keys(R).sort())B[z]=k(R[z]);return B}finally{_.delete(R)}};return JSON.stringify(k(v))}catch{return null}}function i0(v){let _={};for(let[k,R]of Object.entries(v))if(!k.startsWith("__")||k==="__stxServeContext")_[k]=R;return _}function ph(v){return v.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Hc(v){return/\bjs\b/.test(v)||/\blang\s*=\s*["']?(js|javascript)["']?/i.test(v)}function Ge(v){return!Hc(v)}var Ia=new Map;function j(v){let _;try{_=JSON.stringify(v)}catch{return new Bun.Transpiler(v)}let k=Ia.get(_);if(k)return k;if(Ia.size>=16)Ia.clear();let R=new Bun.Transpiler(v);return Ia.set(_,R),R}var gh=new WeakMap,o0=256;function Ke(v){try{let _=j({loader:"ts",target:"browser",define:w()}),k=gh.get(_);if(!k)k=new Map,gh.set(_,k);let R=k.get(v);if(R!==void 0)return R;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 B=[];T=T.replace(/\{!![\s\S]*?!!\}/g,(W)=>{let F=B.length;return B.push(W),`"__STX_EXPR_${F}__"`}),T=T.replace(/\{\{\{[\s\S]*?\}\}\}/g,(W)=>{let F=B.length;return B.push(W),`"__STX_EXPR_${F}__"`}),T=T.replace(/\{\{[\s\S]*?\}\}/g,(W)=>{let F=B.length;return B.push(W),`"__STX_EXPR_${F}__"`});let z=_.transformSync(T);for(let W=0;W<B.length;W++)z=z.replace(`"__STX_EXPR_${W}__"`,B[W]),z=z.replace(`'__STX_EXPR_${W}__'`,B[W]);if(k.size>=o0){let W=k.keys().next();if(!W.done)k.delete(W.value)}return k.set(v,z),z}catch(_){if(process.env.STX_DEBUG_TS)console.warn("[STX] TypeScript transpilation error:",_);return v}}function a0(v){let _=[],k=new Set,R=0,T=0,B=v.length,z=(H)=>{T++;while(T<B){if(v[T]==="\\"){T+=2;continue}if(v[T]===H){T++;return}T++}},W=()=>{T++;while(T<B){if(v[T]==="\\"){T+=2;continue}if(v[T]==="`"){T++;return}if(v[T]==="$"&&v[T+1]==="{"){T+=2;let H=1;while(T<B&&H>0)if(v[T]==="{")H++,T++;else if(v[T]==="}")H--,T++;else if(v[T]==="'"||v[T]==='"')z(v[T]);else if(v[T]==="`")W();else T++;continue}T++}},F=()=>{if(v[T]==="/"&&v[T+1]==="/"){while(T<B&&v[T]!==`
2657
+ `)T++;return!0}if(v[T]==="/"&&v[T+1]==="*"){T+=2;while(T<B-1&&!(v[T]==="*"&&v[T+1]==="/"))T++;return T+=2,!0}return!1},V=()=>{if(R!==0)return;let H=v.slice(T).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(H){let se=H[2].split(",").map((ie)=>{let oe=ie.trim().split(":");return oe[oe.length-1].trim()});for(let ie of se)if(ie&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(ie)&&!k.has(ie))_.push(ie),k.add(ie);return}let q=v.slice(T).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(q){let se=q[2];if(!k.has(se))_.push(se),k.add(se);return}let Q=v.slice(T).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(Q){let se=Q[1];if(!k.has(se))_.push(se),k.add(se);return}let Z=v.slice(T).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(Z){let se=Z[1];if(!k.has(se))_.push(se),k.add(se)}};while(T<B){if(F())continue;if(v[T]==="'"||v[T]==='"'){z(v[T]);continue}if(v[T]==="`"){W();continue}if(v[T]==="{"){R++,T++;continue}if(v[T]==="}"){R--,T++;continue}if(R===0&&/[a-z]/i.test(v[T])&&(T===0||/\s|[;{}()]/.test(v[T-1])))V();T++}return _}function c0(v){let _=[],k=0,R=0,T=null;for(let B=0;B<v.length;B++){let z=v[B];if(T){if(z==="\\"){B++;continue}if(z===T)T=null;continue}if(z==='"'||z==="'"||z==="`"){T=z;continue}if(z==="("||z==="["||z==="{")k++;else if(z===")"||z==="]"||z==="}")k--;else if(z===","&&k===0)_.push(v.slice(R,B)),R=B+1}if(R<v.length)_.push(v.slice(R));return _}function l0(v){let _=0,k=null;for(let R=0;R<v.length;R++){let T=v[R];if(k){if(T==="\\"){R++;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 B=v[R-1],z=v[R+1];if(B==="!"||B==="<"||B===">"||B==="=")continue;if(z==="="||z===">")continue;return R}}return-1}function u0(v,_){try{let k=/=\s*(?:withDefaults\s*\([\s\S]*?defineProps|defineProps)\b/.exec(v);if(!k)return;let R=k.index-1;while(R>=0&&/\s/.test(v[R]))R--;if(v[R]!=="}")return;let T=R,B=0,z=-1;for(;R>=0;R--){let F=v[R];if(F==="}")B++;else if(F==="{"){if(B--,B===0){z=R;break}}}if(z===-1)return;let W=v.slice(z+1,T);for(let F of c0(W)){let V=F.trim();if(!V||V.startsWith("..."))continue;let H=l0(V);if(H===-1)continue;let q=V.slice(0,H).trim();if(!/^[A-Z_$][\w$]*$/i.test(q))continue;if(_[q]!==void 0)continue;let Q=V.slice(H+1).trim();if(!Q)continue;try{let Z=Object.keys(_).filter(tt),se=Function(...Z,`"use strict"; return (${Q});`);_[q]=se(...Z.map((ie)=>_[ie]))}catch{}}}catch{}}var d0=new Set(["tr","td","th","thead","tbody","tfoot","caption","colgroup","col","option","optgroup","li","dt","dd","span"]);function Uc(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 R=k[2].toLowerCase();if(!d0.has(R))return null;let T=new RegExp(`<\\/?${R}(?=[\\s/>])(?:[^>"']|"[^"]*"|'[^']*')*>`,"iy"),B=ee(v,(V,H)=>(T.lastIndex=H,T.exec(V)?.index===H?T.lastIndex:-1));if(R==="span"&&/\sdata-stx-scope\s*=/.test(B[0]?.token||""))return null;let z=0,W=!1;for(let V of B){if(z+=V.token.startsWith("</")?-1:1,z<0)return null;if(z===0){if(v.slice(V.end).trim())return null;W=!0;break}}if(!W)return null;let F=k[0].length;return v.slice(0,F)+_+v.slice(F)}async function nr(v,_,k,R,T){let B=v.endsWith(".stx")?v.slice(0,-4):v,z=(ge)=>ge.split("-").map(($e)=>$e.charAt(0).toUpperCase()+$e.slice(1)).join(""),W=k.__importedComponents;if(W){for(let ge of[B,B.toLowerCase(),z(B),sn(B)])if(W.has(ge))return!0}let F=[...new Set([`${B}.stx`,`${z(B)}.stx`,`${sn(B)}.stx`])],V=typeof T.root==="string"?rt.resolve(T.root):void 0,H=V??rt.dirname(R),q=[],Q=(ge)=>{if(ge&&!q.includes(ge))q.push(ge)},Z=k.__originalFilePath;if(Z)Q(rt.join(rt.dirname(Z),"components"));Q(_),Q(T._rootComponentsDir),Q(rt.join(rt.dirname(R),"components")),Q(T.componentsDir);for(let ge of T._targetComponentDirs??[])Q(ge);if(V)Q(rt.resolve(V,"resources/views/components")),Q(rt.resolve(V,"resources/components")),Q(rt.resolve(V,"src/components")),Q(rt.resolve(V,"components"));for(let ge of T._layerComponentDirs??[])Q(ge);let se=T._pluginComponentDirs;if(Array.isArray(se))for(let ge of se)Q(typeof ge==="string"?ge:null);if(Q(T.fallbackComponentsDir),B.startsWith("./")||B.startsWith("../"))return r(rt.resolve(rt.dirname(R),`${B}.stx`));let ie=mh(rt.resolve(import.meta.dir,"components")),oe=q.map((ge)=>rt.isAbsolute(ge)?ge:rt.resolve(H,ge)),ae=`${F.join("\x00")}\x00\x00${oe.join("\x00")}`,le=yu.get(ae);if(le!==void 0)return le;let ce=!1;e:for(let ge of oe){if(mh(ge)===ie)continue;for(let $e of F)if(await r(rt.join(ge,$e))){ce=!0;break e}}return yu.set(ae,ce),ce}function mh(v){let _=xu.get(v);if(_!==void 0)return _;let k=v;try{k=bh.realpathSync(v)}catch{}return xu.set(v,k),k}function Vc(v){return v==="visible"||v==="idle"||v==="interaction"||v.startsWith("media:")}function ki(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 f0(v,_,k){if(!v.includes("{{")&&!v.includes("{!!"))return v;let R=(T,B)=>{let z;try{z=x(T,_)}catch{return B}if(z===void 0||z===null)return"";let W=String(z);if(/<\/style/i.test(W))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 W};return v.replace(/\{!!([\s\S]*?)!!\}/g,(T,B)=>R(B,T)).replace(/\{\{([\s\S]*?)\}\}/g,(T,B)=>R(B,T))}var hh=new Set;function yh(v,_,k,R){let T=`${v}\x00${_}\x00${R??""}`;if(!process.env.STX_DEBUG&&hh.has(T))return;hh.add(T);let B=_?` used in ${_}`:"",z=R?` Cause: ${R}.`:"",W=k.length>0?`
2658
2658
  searched:
2659
2659
  ${k.map((F)=>` - ${F}`).join(`
2660
- `)}`:"";console.error(`[stx] component <${v}> could not be resolved${B}, so it rendered as nothing.${z}${W}`)}function xh(v){return`<!-- stx: component "${v.replace(/--+/g,"-")}" could not be resolved; see the server log -->`}function Wc(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 R of v){let T;while((T=k.exec(R))!==null)_.add(T[1]);k.lastIndex=0}return[..._]}async function Xe(v,_,k,R,T,B,z,W=new Set,F,V=yr(T),H,q=v){let{extractVariables:Q}=await ht("stx/variable-extractor",()=>import("./chunk-k7jqkt93.js")),Z=W??new Set;if(Z.has(v))return`[Circular component reference: ${v}]`;let se=new Set(Z);se.add(v);let ie=typeof _.client==="string"?_.client.trim():"";if("client"in _)delete _.client;let oe=ie&&ie!=="load"&&Vc(ie)?ie:"";try{let ae=(nt)=>nt.split("-").map((at)=>at.charAt(0).toUpperCase()+at.slice(1)).join(""),le=q.endsWith(".stx")?q.slice(0,-4):q,ce=null,ge=T.__importedComponents;if(ge){let nt=[le,le.toLowerCase(),ae(le),sn(le)];for(let at of nt)if(ge.has(at)){ce=ge.get(at);break}}let $e=[];if(!ce){let nt=[`${le}.stx`,`${ae(le)}.stx`,`${sn(le)}.stx`],at=[...new Set(nt)],bt=T.__originalFilePath,et=[];if(et.push(...z._layerComponentDirs??[]),bt){let Bt=rt.join(rt.dirname(bt),"components");et.push(Bt)}if(R)et.push(R);let Lt=z._rootComponentsDir;if(typeof Lt==="string"&&!et.includes(Lt))et.push(Lt);let qt=rt.join(rt.dirname(B),"components");if(!et.includes(qt))et.push(qt);if(z.componentsDir&&z.componentsDir!==R&&!et.includes(z.componentsDir))et.push(z.componentsDir);for(let Bt of z._targetComponentDirs??[])if(Bt&&!et.includes(Bt))et.push(Bt);let on=typeof z.root==="string"?rt.resolve(z.root):void 0,Xr=on??rt.dirname(B),In=[];if(on)In.push(rt.resolve(on,"resources/views/components")),In.push(rt.resolve(on,"resources/components")),In.push(rt.resolve(on,"src/components")),In.push(rt.resolve(on,"components"));In.push(rt.resolve(import.meta.dir,"components"));for(let Bt of In)if(!et.includes(Bt))et.push(Bt);let Eo=z._pluginComponentDirs;if(Array.isArray(Eo)){for(let Bt of Eo)if(typeof Bt==="string"&&!et.includes(Bt))et.push(Bt)}if(z.fallbackComponentsDir&&!et.includes(z.fallbackComponentsDir))et.push(z.fallbackComponentsDir);let Ar=[...new Set(et.map((Bt)=>{if(!Bt)return Bt;return rt.isAbsolute(Bt)?Bt:rt.resolve(Xr,Bt)}))];et.length=0,et.push(...Ar);let Zr=`${le}\x00${B}\x00${Ar.join("\x00")}`,Gr=Pa.get(Zr);if(Gr)if(await r(Gr))ce=Gr;else Pa.delete(Zr);if(!ce&&(le.startsWith("./")||le.startsWith("../")))ce=rt.resolve(rt.dirname(B),`${le}.stx`),$e.push(ce);else if(!ce)for(let Bt of et){if(!Bt)continue;for(let Ir of at){let Pr=rt.join(Bt,Ir);if($e.push(Pr),await r(Pr)){ce=Pr;break}}if(ce)break;if(!ce)try{let Ir=await import("fs");if(!Ir.statSync(Bt,{throwIfNoEntry:!1})?.isDirectory())continue;let Eh=8,ja=[{path:Bt,depth:0}];while(ja.length>0&&!ce){let Co=ja.pop();if(Co.depth>=Eh)continue;let Pu;try{Pu=Ir.readdirSync(Co.path,{withFileTypes:!0})}catch{continue}for(let Ro of Pu){if(!Ro.isDirectory())continue;if(Ro.name==="node_modules"||Ro.name.startsWith("."))continue;let Du=rt.join(Co.path,Ro.name);for(let Ch of at){let La=rt.join(Du,Ch);if($e.push(La),await r(La)){ce=La;break}}if(ce)break;ja.push({path:Du,depth:Co.depth+1})}}}catch{}if(ce)break}if(ce)Pa.set(Zr,ce)}if(!ce||!await r(ce))return yh(v,B,$e),xh(v);F.add(ce);let ye;if(wo.has(ce))ye=wo.get(ce);else try{ye=await Bun.file(ce).text(),wo.set(ce,ye)}catch(nt){let at=nt instanceof Error?nt.message:String(nt);return yh(v,B,[ce],at),xh(v)}if(H)for(let nt of Object.keys(_)){let at=nt.toLowerCase();if(at.startsWith("aria-")||at.startsWith("data-"))continue;let bt=nt.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(new RegExp(`\\b${bt}\\b`).test(ye))H.declaredProps.add(nt)}let ke=new Set(["__originalFilePath","__importedComponents",Oo,"__stx_client_signal_names","__stx_client_declared_names","__stx_runtime_config","__stxServeContext","__stx_scope_seq"]),Re={};for(let[nt,at]of Object.entries(T))if(!nt.startsWith("__")||ke.has(nt))Re[nt]=at;let Ae=V.length>0?{[Fo]:[...V]}:{},Ie=k;if(k.includes("@include")){let{processIncludes:nt}=await ht("stx/includes",()=>import("./chunk-4t67wmcg.js"));Ie=await nt(k,T,B,z,F)}if(/<[A-Z][\w.-]*[\s/>]/.test(Ie)){let{processComponents:nt}=await ht("stx/component-renderer",()=>import("./chunk-sp46w7z9.js"));Ie=await nt(Ie,{...T,__processedComponents:Z,...Ae},B,z,F)}let Pe=[];if(ki(Ie)){let{processExpressions:nt}=await ht("stx/expressions",()=>import("./chunk-mqy7g74k.js")),at=T.__stx_signals_gate===void 0?{...T,__stx_signals_gate:!0,...Ae}:V.length>0?{...T,...Ae}:T;Ie=nt(Ie,at,B);for(let bt of Ie.matchAll(/\{\{([\s\S]*?)\}\}/g))Pe.push(bt[1].trim())}let Ee=Sn(Ie),Me=[],je=Ee.output.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(nt,at)=>{let bt=Ee.scripts[Number(at)]||"",et=bt.match(/^<script\b([^>]*)>/i)?.[1]||"",Lt=et.match(/\btype\s*=\s*["']([^"']+)["']/i)?.[1]?.toLowerCase(),qt=!Lt||["module","text/javascript","application/javascript"].includes(Lt),on=/\sdata-stx-(?:owner|instance)(?=[\s=/>])/i.test(` ${et}`);if(!/\bserver\b/i.test(et)&&qt&&!on)return Me.push(bt),"";return bt}),{extractSlotContent:Ne}=await ht("stx/slots",()=>import("./chunk-51zn42jy.js")),De=Ne(je),Le={};if(De.defaultSlot?.trim())Le.default=De.defaultSlot;for(let[nt,at]of De.namedSlots)Le[nt]=at.content;let ct=T.__stx_scope_seq??={n:0,key:Bun.hash(String(T.__filename??B)).toString(36).slice(0,6)},pt=`stx_${(v.endsWith(".stx")?v.slice(0,-4):v).replace(/[^a-zA-Z0-9]/g,"_")}_${++ct.n}_${ct.key}`,st={...Re,$uid:pt,..._,props:_,slot:je,$slots:Le,__processedComponents:se,__sections:{},__stx_signals_gate:ve(ye)||ki(k),__stx_preserved_client_expressions:[...Array.isArray(T.__stx_preserved_client_expressions)?T.__stx_preserved_client_expressions:[],...Pe]};u0(ye,st);let gt=ye,dt=te(gt);if(dt)gt=dt.content.trim();let St=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,lt=[...ye.matchAll(St)],wt=[],ft=null,Ft=lt.some((nt)=>/\bserver\b/.test(nt[1]||"")&&/\bcache\b/.test(nt[1]||"")),Mn=null,Tn=null,ut=null,it=0,mt=null;if(r0(z),Ft&&Au>0){let nt=s0({props:_,slot:Ie,slotContext:k.trim()?i0(Re):void 0,buildMode:z.buildMode??"",skipEventDirectives:z.skipEventDirectives===!0,clientLoopNames:[...V].sort(),layers:z._layerGraph?.layers.map((at)=>at.configFile),uid:pt});if(nt!==null){Mn=`${ce}\x00${h(ye)}\x00${nt}`;let at=Da.get(Mn);if(at){for(let bt of at.dependencies)F.add(bt);if(Qu(T,at.clientFactories),ct.n+=at.uidsConsumed,at.preservedClientExpressions.length>0){let bt=new Set(Array.isArray(T.__stx_preserved_client_expressions)?T.__stx_preserved_client_expressions:[]);for(let et of at.preservedClientExpressions)bt.add(et);T.__stx_preserved_client_expressions=[...bt]}return at.output}Tn=new Set(F),ut=Ju(T),it=ct.n,mt=new Set(Array.isArray(T.__stx_preserved_client_expressions)?T.__stx_preserved_client_expressions:[])}}let kt=new Set;for(let nt of lt){let at=nt[1]||"",bt=nt[2]||"",et=at.includes("server");if(Ge(at)&&bt.trim())bt=Ke(bt);if(et&&bt){for(let qt of de(bt))kt.add(qt);try{await Q(bt,st,ce,{onFailure:(qt)=>{if(qt.kind!=="unknown")ft=qt.kind}})}catch(qt){}}if(!et){let qt=bt.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),on=qt.includes("{{")&&qt.includes("}}"),Xr=qt.includes("{!!")&&qt.includes("!!}");if(on||Xr)qt=cs(qt,st,ce);let In=at.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");wt.push(`<script${In}>${qt}</script>`)}}let Ht=Sn(ye).output.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),nn=Ht?Ht[1]:"",Ma=Ht?Ht[2]:"",Fn="",Oa=nn&&/\bscoped\b/i.test(nn);if(Ht)Fn=`<style${nn}>${f0(Ma,st,ce)}</style>`;let Oe=gt;if(Oe=Oe.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),Ht)Oe=Oe.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let nt=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,at=[];if(Oe=Oe.replace(nt,(bt,et)=>{let Lt=et.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(Lt)at.push(`<style${Lt[1]}>${Lt[2]}</style>`);return""}),Oe=Oe.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),at.length>0)Fn=`${Fn}${at.join(`
2661
- `)}`}if(k&&Oe.includes("{{ text || slot }}"))Oe=Oe.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>k);let{applySlots:Ze}=await ht("stx/slots",()=>import("./chunk-51zn42jy.js")),{defaultSlot:ot,namedSlots:xt}=De,Mt=wt.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)),Zt=(nt)=>Mt?Lm(nt,pt):nt,qr=new Map([...xt].map(([nt,at])=>[nt,{...at,content:Zt(at.content)}]));Oe=await Ze(Oe,Zt(ot),qr,st);let Na=Wc(wt),$o=(Array.isArray(st.__stx_client_signal_names)?st.__stx_client_signal_names:[]).filter((nt)=>!kt.has(nt));if(Na.length>0||$o.length>0)st.__stx_client_signal_names=[...new Set([...$o,...Na])];else delete st.__stx_client_signal_names;let _o=V.filter((nt)=>!kt.has(nt)&&!(nt in _));if(_o.length>0)st[Fo]=_o;let ko={...z,_rootComponentsDir:z._rootComponentsDir||z.componentsDir,componentsDir:rt.dirname(ce),skipSignalsRuntime:!0,skipEventDirectives:Mt||wt.length===0,defaultLayout:void 0};st.__stxProcessingDepth=(T.__stxProcessingDepth||0)+1;let gr=await n(Oe,st,ce,ko,F),Kr=new Set(Array.isArray(T.__stx_preserved_client_expressions)?T.__stx_preserved_client_expressions:[]);for(let nt of gr.matchAll(/\{\{([\s\S]*?)\}\}/g))Kr.add(nt[1].trim());if(Kr.size>0)T.__stx_preserved_client_expressions=[...Kr];let Vn=pt,Qt=gr;if(Mt){let nt="";if(Object.keys(_).length>0)try{nt=` data-stx-props="${ph(JSON.stringify(_))}"`}catch{}let at=oe?` stx-hydrate="${ph(oe)}"`:"",bt=` data-stx-scope="${Vn}"${nt}${at}`,et=/^\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*<span(?=[\s/>])/i.test(gr),Lt=et?"span":"div";Qt=Uc(gr,bt)??`<${Lt}${bt} data-stx-component-wrapper${et?' style="display:contents"':""}>${gr}</${Lt}>`;let qt=await Promise.all(wt.map(async(on)=>{let Xr=on.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!Xr)return on;let[,In,Eo]=Xr,Ar=await m0(Eo,ce,z.buildMode==="compile"),Zr=ln(Ar.clientCode,be(st)),{vendorStyleTags:Gr}=Ar,Bt=Zr?`function(__scopeId) {
2660
+ `)}`:"";console.error(`[stx] component <${v}> could not be resolved${B}, so it rendered as nothing.${z}${W}`)}function xh(v){return`<!-- stx: component "${v.replace(/--+/g,"-")}" could not be resolved; see the server log -->`}function Wc(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 R of v){let T;while((T=k.exec(R))!==null)_.add(T[1]);k.lastIndex=0}return[..._]}async function Xe(v,_,k,R,T,B,z,W=new Set,F,V=yr(T),H,q=v){let{extractVariables:Q}=await ht("stx/variable-extractor",()=>import("./chunk-qb2j34sp.js")),Z=W??new Set;if(Z.has(v))return`[Circular component reference: ${v}]`;let se=new Set(Z);se.add(v);let ie=typeof _.client==="string"?_.client.trim():"";if("client"in _)delete _.client;let oe=ie&&ie!=="load"&&Vc(ie)?ie:"";try{let ae=(nt)=>nt.split("-").map((at)=>at.charAt(0).toUpperCase()+at.slice(1)).join(""),le=q.endsWith(".stx")?q.slice(0,-4):q,ce=null,ge=T.__importedComponents;if(ge){let nt=[le,le.toLowerCase(),ae(le),sn(le)];for(let at of nt)if(ge.has(at)){ce=ge.get(at);break}}let $e=[];if(!ce){let nt=[`${le}.stx`,`${ae(le)}.stx`,`${sn(le)}.stx`],at=[...new Set(nt)],bt=T.__originalFilePath,et=[];if(et.push(...z._layerComponentDirs??[]),bt){let Bt=rt.join(rt.dirname(bt),"components");et.push(Bt)}if(R)et.push(R);let Lt=z._rootComponentsDir;if(typeof Lt==="string"&&!et.includes(Lt))et.push(Lt);let qt=rt.join(rt.dirname(B),"components");if(!et.includes(qt))et.push(qt);if(z.componentsDir&&z.componentsDir!==R&&!et.includes(z.componentsDir))et.push(z.componentsDir);for(let Bt of z._targetComponentDirs??[])if(Bt&&!et.includes(Bt))et.push(Bt);let on=typeof z.root==="string"?rt.resolve(z.root):void 0,Xr=on??rt.dirname(B),In=[];if(on)In.push(rt.resolve(on,"resources/views/components")),In.push(rt.resolve(on,"resources/components")),In.push(rt.resolve(on,"src/components")),In.push(rt.resolve(on,"components"));In.push(rt.resolve(import.meta.dir,"components"));for(let Bt of In)if(!et.includes(Bt))et.push(Bt);let Eo=z._pluginComponentDirs;if(Array.isArray(Eo)){for(let Bt of Eo)if(typeof Bt==="string"&&!et.includes(Bt))et.push(Bt)}if(z.fallbackComponentsDir&&!et.includes(z.fallbackComponentsDir))et.push(z.fallbackComponentsDir);let Ar=[...new Set(et.map((Bt)=>{if(!Bt)return Bt;return rt.isAbsolute(Bt)?Bt:rt.resolve(Xr,Bt)}))];et.length=0,et.push(...Ar);let Zr=`${le}\x00${B}\x00${Ar.join("\x00")}`,Gr=Pa.get(Zr);if(Gr)if(await r(Gr))ce=Gr;else Pa.delete(Zr);if(!ce&&(le.startsWith("./")||le.startsWith("../")))ce=rt.resolve(rt.dirname(B),`${le}.stx`),$e.push(ce);else if(!ce)for(let Bt of et){if(!Bt)continue;for(let Ir of at){let Pr=rt.join(Bt,Ir);if($e.push(Pr),await r(Pr)){ce=Pr;break}}if(ce)break;if(!ce)try{let Ir=await import("fs");if(!Ir.statSync(Bt,{throwIfNoEntry:!1})?.isDirectory())continue;let Eh=8,ja=[{path:Bt,depth:0}];while(ja.length>0&&!ce){let Co=ja.pop();if(Co.depth>=Eh)continue;let wu;try{wu=Ir.readdirSync(Co.path,{withFileTypes:!0})}catch{continue}for(let Ro of wu){if(!Ro.isDirectory())continue;if(Ro.name==="node_modules"||Ro.name.startsWith("."))continue;let Su=rt.join(Co.path,Ro.name);for(let Ch of at){let La=rt.join(Su,Ch);if($e.push(La),await r(La)){ce=La;break}}if(ce)break;ja.push({path:Su,depth:Co.depth+1})}}}catch{}if(ce)break}if(ce)Pa.set(Zr,ce)}if(!ce||!await r(ce))return yh(v,B,$e),xh(v);F.add(ce);let ye;if(wo.has(ce))ye=wo.get(ce);else try{ye=await Bun.file(ce).text(),wo.set(ce,ye)}catch(nt){let at=nt instanceof Error?nt.message:String(nt);return yh(v,B,[ce],at),xh(v)}if(H)for(let nt of Object.keys(_)){let at=nt.toLowerCase();if(at.startsWith("aria-")||at.startsWith("data-"))continue;let bt=nt.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(new RegExp(`\\b${bt}\\b`).test(ye))H.declaredProps.add(nt)}let ke=new Set(["__originalFilePath","__importedComponents",Oo,"__stx_client_signal_names","__stx_client_declared_names","__stx_runtime_config","__stxServeContext","__stx_scope_seq"]),Re={};for(let[nt,at]of Object.entries(T))if(!nt.startsWith("__")||ke.has(nt))Re[nt]=at;let Ae=V.length>0?{[Fo]:[...V]}:{},Ie=k;if(k.includes("@include")){let{processIncludes:nt}=await ht("stx/includes",()=>import("./chunk-sf98zgw2.js"));Ie=await nt(k,T,B,z,F)}if(/<[A-Z][\w.-]*[\s/>]/.test(Ie)){let{processComponents:nt}=await ht("stx/component-renderer",()=>import("./chunk-5r9k9s3m.js"));Ie=await nt(Ie,{...T,__processedComponents:Z,...Ae},B,z,F)}let Pe=[];if(ki(Ie)){let{processExpressions:nt}=await ht("stx/expressions",()=>import("./chunk-wngqr949.js")),at=T.__stx_signals_gate===void 0?{...T,__stx_signals_gate:!0,...Ae}:V.length>0?{...T,...Ae}:T;Ie=nt(Ie,at,B);for(let bt of Ie.matchAll(/\{\{([\s\S]*?)\}\}/g))Pe.push(bt[1].trim())}let Ee=Sn(Ie),Me=[],je=Ee.output.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(nt,at)=>{let bt=Ee.scripts[Number(at)]||"",et=bt.match(/^<script\b([^>]*)>/i)?.[1]||"",Lt=et.match(/\btype\s*=\s*["']([^"']+)["']/i)?.[1]?.toLowerCase(),qt=!Lt||["module","text/javascript","application/javascript"].includes(Lt),on=/\sdata-stx-(?:owner|instance)(?=[\s=/>])/i.test(` ${et}`);if(!/\bserver\b/i.test(et)&&qt&&!on)return Me.push(bt),"";return bt}),{extractSlotContent:Ne}=await ht("stx/slots",()=>import("./chunk-76vza4ve.js")),De=Ne(je),Le={};if(De.defaultSlot?.trim())Le.default=De.defaultSlot;for(let[nt,at]of De.namedSlots)Le[nt]=at.content;let ct=T.__stx_scope_seq??={n:0,key:Bun.hash(String(T.__filename??B)).toString(36).slice(0,6)},pt=`stx_${(v.endsWith(".stx")?v.slice(0,-4):v).replace(/[^a-zA-Z0-9]/g,"_")}_${++ct.n}_${ct.key}`,st={...Re,$uid:pt,..._,props:_,slot:je,$slots:Le,__processedComponents:se,__sections:{},__stx_signals_gate:we(ye)||ki(k),__stx_preserved_client_expressions:[...Array.isArray(T.__stx_preserved_client_expressions)?T.__stx_preserved_client_expressions:[],...Pe]};u0(ye,st);let gt=ye,dt=te(gt);if(dt)gt=dt.content.trim();let St=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,lt=[...ye.matchAll(St)],wt=[],ft=null,Ft=lt.some((nt)=>/\bserver\b/.test(nt[1]||"")&&/\bcache\b/.test(nt[1]||"")),Mn=null,Tn=null,ut=null,it=0,mt=null;if(r0(z),Ft&&bu>0){let nt=s0({props:_,slot:Ie,slotContext:k.trim()?i0(Re):void 0,buildMode:z.buildMode??"",skipEventDirectives:z.skipEventDirectives===!0,clientLoopNames:[...V].sort(),layers:z._layerGraph?.layers.map((at)=>at.configFile),uid:pt});if(nt!==null){Mn=`${ce}\x00${h(ye)}\x00${nt}`;let at=Da.get(Mn);if(at){for(let bt of at.dependencies)F.add(bt);if(pd(T,at.clientFactories),ct.n+=at.uidsConsumed,at.preservedClientExpressions.length>0){let bt=new Set(Array.isArray(T.__stx_preserved_client_expressions)?T.__stx_preserved_client_expressions:[]);for(let et of at.preservedClientExpressions)bt.add(et);T.__stx_preserved_client_expressions=[...bt]}return at.output}Tn=new Set(F),ut=dd(T),it=ct.n,mt=new Set(Array.isArray(T.__stx_preserved_client_expressions)?T.__stx_preserved_client_expressions:[])}}let kt=new Set;for(let nt of lt){let at=nt[1]||"",bt=nt[2]||"",et=at.includes("server");if(Ge(at)&&bt.trim())bt=Ke(bt);if(et&&bt){for(let qt of ue(bt))kt.add(qt);try{await Q(bt,st,ce,{onFailure:(qt)=>{if(qt.kind!=="unknown")ft=qt.kind}})}catch(qt){}}if(!et){let qt=bt.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),on=qt.includes("{{")&&qt.includes("}}"),Xr=qt.includes("{!!")&&qt.includes("!!}");if(on||Xr)qt=cs(qt,st,ce);let In=at.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");wt.push(`<script${In}>${qt}</script>`)}}let Ht=Sn(ye).output.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),nn=Ht?Ht[1]:"",Ma=Ht?Ht[2]:"",Wn="",Oa=nn&&/\bscoped\b/i.test(nn);if(Ht)Wn=`<style${nn}>${f0(Ma,st,ce)}</style>`;let Oe=gt;if(Oe=Oe.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),Ht)Oe=Oe.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let nt=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,at=[];if(Oe=Oe.replace(nt,(bt,et)=>{let Lt=et.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(Lt)at.push(`<style${Lt[1]}>${Lt[2]}</style>`);return""}),Oe=Oe.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),at.length>0)Wn=`${Wn}${at.join(`
2661
+ `)}`}if(k&&Oe.includes("{{ text || slot }}"))Oe=Oe.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>k);let{applySlots:Ze}=await ht("stx/slots",()=>import("./chunk-76vza4ve.js")),{defaultSlot:ot,namedSlots:xt}=De,Mt=wt.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)),Zt=(nt)=>Mt?Lm(nt,pt):nt,qr=new Map([...xt].map(([nt,at])=>[nt,{...at,content:Zt(at.content)}]));Oe=await Ze(Oe,Zt(ot),qr,st);let Na=Wc(wt),$o=(Array.isArray(st.__stx_client_signal_names)?st.__stx_client_signal_names:[]).filter((nt)=>!kt.has(nt));if(Na.length>0||$o.length>0)st.__stx_client_signal_names=[...new Set([...$o,...Na])];else delete st.__stx_client_signal_names;let _o=V.filter((nt)=>!kt.has(nt)&&!(nt in _));if(_o.length>0)st[Fo]=_o;let ko={...z,_rootComponentsDir:z._rootComponentsDir||z.componentsDir,componentsDir:rt.dirname(ce),skipSignalsRuntime:!0,skipEventDirectives:Mt||wt.length===0,defaultLayout:void 0};st.__stxProcessingDepth=(T.__stxProcessingDepth||0)+1;let dr=await n(Oe,st,ce,ko,F),Kr=new Set(Array.isArray(T.__stx_preserved_client_expressions)?T.__stx_preserved_client_expressions:[]);for(let nt of dr.matchAll(/\{\{([\s\S]*?)\}\}/g))Kr.add(nt[1].trim());if(Kr.size>0)T.__stx_preserved_client_expressions=[...Kr];let Fn=pt,Qt=dr;if(Mt){let nt="";if(Object.keys(_).length>0)try{nt=` data-stx-props="${ph(JSON.stringify(_))}"`}catch{}let at=oe?` stx-hydrate="${ph(oe)}"`:"",bt=` data-stx-scope="${Fn}"${nt}${at}`,et=/^\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*<span(?=[\s/>])/i.test(dr),Lt=et?"span":"div";Qt=Uc(dr,bt)??`<${Lt}${bt} data-stx-component-wrapper${et?' style="display:contents"':""}>${dr}</${Lt}>`;let qt=await Promise.all(wt.map(async(on)=>{let Xr=on.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!Xr)return on;let[,In,Eo]=Xr,Ar=await m0(Eo,ce,z.buildMode==="compile"),Zr=ln(Ar.clientCode,be(st)),{vendorStyleTags:Gr}=Ar,Bt=Zr?`function(__scopeId) {
2662
2662
  ${Zr}
2663
2663
  return (${Ar.factoryBody})(__scopeId);
2664
- }`:Ar.factoryBody,Ir=oe?null:qa(T,Bt),Pr=Ir?`window.__stxComponentFactories[${JSON.stringify(Ir)}](${JSON.stringify(Vn)});`:`(${Bt})(${JSON.stringify(Vn)});`;if(oe)return`${Gr}<script type="stx/island" data-stx-island="${Vn}" data-stx-scoped data-stx-owner="${Vn}"${In}>${Pr}</script>`;return`${Gr}<script data-stx-scoped data-stx-run="always" data-stx-owner="${Vn}"${In}>${Pr}</script>`}));if(Qt=Qt+`
2664
+ }`:Ar.factoryBody,Ir=oe?null:qa(T,Bt),Pr=Ir?`window.__stxComponentFactories[${JSON.stringify(Ir)}](${JSON.stringify(Fn)});`:`(${Bt})(${JSON.stringify(Fn)});`;if(oe)return`${Gr}<script type="stx/island" data-stx-island="${Fn}" data-stx-scoped data-stx-owner="${Fn}"${In}>${Pr}</script>`;return`${Gr}<script data-stx-scoped data-stx-run="always" data-stx-owner="${Fn}"${In}>${Pr}</script>`}));if(Qt=Qt+`
2665
2665
  `+qt.join(`
2666
- `),Fn)Qt+=`
2667
- `+Fn}else{if(Fn)Qt+=`
2668
- `+Fn;if(wt.length>0){let nt=st.__stx_event_bindings||[],at=be(st),bt=await Promise.all(wt.map(async(et)=>{let Lt=et.match(/<script\b[^>]*>([\s\S]*?)<\/script>/);if(!Lt)return et;return await we(Lt[1],{eventBindings:nt,templateContent:Qt,filePath:ce,projectRoot:process.cwd(),serverData:at,instanceId:pt})}));Qt+=`
2666
+ `),Wn)Qt+=`
2667
+ `+Wn}else{if(Wn)Qt+=`
2668
+ `+Wn;if(wt.length>0){let nt=st.__stx_event_bindings||[],at=be(st),bt=await Promise.all(wt.map(async(et)=>{let Lt=et.match(/<script\b[^>]*>([\s\S]*?)<\/script>/);if(!Lt)return et;return await ve(Lt[1],{eventBindings:nt,templateContent:Qt,filePath:ce,projectRoot:process.cwd(),serverData:at,instanceId:pt})}));Qt+=`
2669
2669
  `+bt.join(`
2670
- `),st.__stx_event_bindings=[]}}if(Oa){let nt=qo(Qt,ce);if(nt.hasScoped)Qt=nt.html}if(Mn&&Tn){let nt=Array.isArray(T.__stx_preserved_client_expressions)?T.__stx_preserved_client_expressions:[];Da.set(Mn,{output:Qt,dependencies:[...F].filter((at)=>!Tn.has(at)),clientFactories:ut?Yu(T,ut):[],uidsConsumed:ct.n-it,preservedClientExpressions:mt?nt.filter((at)=>!mt.has(at)):[]})}if(ft)Qt=`<!--stx-render-failed:${ft}-->${Qt}`;return Me.length>0?`${Qt}
2670
+ `),st.__stx_event_bindings=[]}}if(Oa){let nt=qo(Qt,ce);if(nt.hasScoped)Qt=nt.html}if(Mn&&Tn){let nt=Array.isArray(T.__stx_preserved_client_expressions)?T.__stx_preserved_client_expressions:[];Da.set(Mn,{output:Qt,dependencies:[...F].filter((at)=>!Tn.has(at)),clientFactories:ut?fd(T,ut):[],uidsConsumed:ct.n-it,preservedClientExpressions:mt?nt.filter((at)=>!mt.has(at)):[]})}if(ft)Qt=`<!--stx-render-failed:${ft}-->${Qt}`;return Me.length>0?`${Qt}
2671
2671
  ${Me.join(`
2672
- `)}`:Qt}catch(ae){return`[Error processing component: ${ae instanceof Error?ae.message:String(ae)}]`}finally{Z.delete(v)}}async function r(v){return Bun.file(v).exists()}function Iu(v,_){let k=rt.resolve(_),R=rt.resolve(v),T=k.endsWith(rt.sep)?k:k+rt.sep;if(R===k||R.startsWith(T))return R;return null}async function p0(v,_,k,R){let T=_.startsWith("layouts/")?_.slice(8):_,B=rt.join(v,T);for(let z of B.endsWith(".stx")?[B]:[B,`${B}.stx`])if(await r(z)){if(R)console.log(`Found layout in ${v}: ${z}`);return k?.add(z),z}return null}async function nr(v,_,k,R){let T=await g0(v,_,k,R);if(T===null)return null;let B=Iu(T,process.cwd());if(B)return B;let z=[k.root,k.layoutsDir,k.fallbackLayoutsDir,k.componentsDir,k.partialsDir,k.pagesDir,...k._layerLayoutDirs??[]].filter((W)=>typeof W==="string"&&W.length>0);for(let W of z){let F=rt.isAbsolute(W)?W:rt.resolve(process.cwd(),W);if(Iu(T,F))return rt.resolve(T)}return console.warn(`[stx] rejected resolved template path that escapes project root: ${T} (template: ${v}, from: ${_})`),null}async function g0(v,_,k,R){if(k.debug)console.log(`Resolving template path: ${v} from ${_}`);let T=rt.dirname(_),B=process.cwd();if(v.startsWith("/")){let Q=rt.join(B,v),Z=Iu(Q,B);if(!Z)return console.warn(`[stx] rejected template path that escapes project root: ${v} (from ${_})`),null;if(k.debug)console.log(`Checking absolute path: ${Z}`);if(await r(Z)&&R)R.add(Z);return Z}let z=rt.join(T,v);if(await r(z)){if(k.debug)console.log(`Found direct path: ${z}`);if(R)R.add(z);return z}if(!v.endsWith(".stx")&&!v.endsWith(".jsx")&&!v.endsWith(".tsx"))for(let Q of[".stx",".tsx",".jsx"]){let Z=`${z}${Q}`;if(await r(Z)){if(k.debug)console.log(`Found direct path with extension: ${Z}`);if(R)R.add(Z);return Z}}let W=[];if(W.push(...k._layerLayoutDirs??[]),k.layoutsDir)W.push(rt.isAbsolute(k.layoutsDir)?k.layoutsDir:rt.resolve(process.cwd(),k.layoutsDir));let F=rt.resolve(T),V=process.cwd();for(let Q=0;Q<10;Q++){let Z=rt.join(F,"layouts"),se=!1;try{se=bh.statSync(Z,{throwIfNoEntry:!1})?.isDirectory()??!1}catch{}if(se){W.push(Z);break}let ie=rt.dirname(F);if(ie===F||ie.length<V.length)break;F=ie}for(let Q of W){let Z=await p0(Q,v,R,k.debug);if(Z)return Z}if(k.fallbackLayoutsDir){let Q=rt.isAbsolute(k.fallbackLayoutsDir)?k.fallbackLayoutsDir:rt.resolve(process.cwd(),k.fallbackLayoutsDir),Z=v.startsWith("layouts/")?v.slice(8):v,se=[rt.join(Q,Z)];if(!v.endsWith(".stx"))se.push(`${se[0]}.stx`);for(let ie of se)if(await r(ie)){if(k.debug)console.log(`Found in options.fallbackLayoutsDir: ${ie}`);if(R)R.add(ie);return ie}}if(v.startsWith("layouts/")||v.includes("/layouts/")){let Q=v.split("layouts/"),Z=rt.join(k.partialsDir||T,"layouts",Q[1]);if(await r(Z)){if(k.debug)console.log(`Found in layouts path: ${Z}`);if(R)R.add(Z);return Z}if(!Z.endsWith(".stx")){let se=`${Z}.stx`;if(await r(se)){if(k.debug)console.log(`Found in layouts path with extension: ${se}`);if(R)R.add(se);return se}}}if(k.partialsDir){let Q=rt.join(k.partialsDir,"layouts");if(await r(Q)){let Z=rt.join(Q,v);if(await r(Z)){if(k.debug)console.log(`Found in partials layouts dir: ${Z}`);if(R)R.add(Z);return Z}if(!v.endsWith(".stx")){let se=`${Z}.stx`;if(await r(se)){if(k.debug)console.log(`Found in partials layouts dir with extension: ${se}`);if(R)R.add(se);return se}}}}let H=k.partialsDir||rt.join(process.cwd(),"views"),q=rt.join(H,v);if(await r(q)){if(k.debug)console.log(`Found in views path: ${q}`);if(R)R.add(q);return q}if(!v.endsWith(".stx")){let Q=`${q}.stx`;if(await r(Q)){if(k.debug)console.log(`Found in views path with extension: ${Q}`);if(R)R.add(Q);return Q}}if(T.includes("temp")){let Q=rt.join(rt.dirname(T),"layouts",v);if(await r(Q)){if(k.debug)console.log(`Found in temp layouts dir: ${Q}`);if(R)R.add(Q);return Q}if(!v.endsWith(".stx")){let Z=`${Q}.stx`;if(await r(Z)){if(k.debug)console.log(`Found in temp layouts dir with extension: ${Z}`);if(R)R.add(Z);return Z}}}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 Ci(v,_,k){let R=0,T="",B="";try{if(typeof _==="number"&&_>=0){let z=v.split(`
2672
+ `)}`:Qt}catch(ae){return`[Error processing component: ${ae instanceof Error?ae.message:String(ae)}]`}finally{Z.delete(v)}}async function r(v){return Bun.file(v).exists()}function vu(v,_){let k=rt.resolve(_),R=rt.resolve(v),T=k.endsWith(rt.sep)?k:k+rt.sep;if(R===k||R.startsWith(T))return R;return null}async function p0(v,_,k,R){let T=_.startsWith("layouts/")?_.slice(8):_,B=rt.join(v,T);for(let z of B.endsWith(".stx")?[B]:[B,`${B}.stx`])if(await r(z)){if(R)console.log(`Found layout in ${v}: ${z}`);return k?.add(z),z}return null}async function rr(v,_,k,R){let T=await g0(v,_,k,R);if(T===null)return null;let B=vu(T,process.cwd());if(B)return B;let z=[k.root,k.layoutsDir,k.fallbackLayoutsDir,k.componentsDir,k.partialsDir,k.pagesDir,...k._layerLayoutDirs??[]].filter((W)=>typeof W==="string"&&W.length>0);for(let W of z){let F=rt.isAbsolute(W)?W:rt.resolve(process.cwd(),W);if(vu(T,F))return rt.resolve(T)}return console.warn(`[stx] rejected resolved template path that escapes project root: ${T} (template: ${v}, from: ${_})`),null}async function g0(v,_,k,R){if(k.debug)console.log(`Resolving template path: ${v} from ${_}`);let T=rt.dirname(_),B=process.cwd();if(v.startsWith("/")){let Q=rt.join(B,v),Z=vu(Q,B);if(!Z)return console.warn(`[stx] rejected template path that escapes project root: ${v} (from ${_})`),null;if(k.debug)console.log(`Checking absolute path: ${Z}`);if(await r(Z)&&R)R.add(Z);return Z}let z=rt.join(T,v);if(await r(z)){if(k.debug)console.log(`Found direct path: ${z}`);if(R)R.add(z);return z}if(!v.endsWith(".stx")&&!v.endsWith(".jsx")&&!v.endsWith(".tsx"))for(let Q of[".stx",".tsx",".jsx"]){let Z=`${z}${Q}`;if(await r(Z)){if(k.debug)console.log(`Found direct path with extension: ${Z}`);if(R)R.add(Z);return Z}}let W=[];if(W.push(...k._layerLayoutDirs??[]),k.layoutsDir)W.push(rt.isAbsolute(k.layoutsDir)?k.layoutsDir:rt.resolve(process.cwd(),k.layoutsDir));let F=rt.resolve(T),V=process.cwd();for(let Q=0;Q<10;Q++){let Z=rt.join(F,"layouts"),se=!1;try{se=bh.statSync(Z,{throwIfNoEntry:!1})?.isDirectory()??!1}catch{}if(se){W.push(Z);break}let ie=rt.dirname(F);if(ie===F||ie.length<V.length)break;F=ie}for(let Q of W){let Z=await p0(Q,v,R,k.debug);if(Z)return Z}if(k.fallbackLayoutsDir){let Q=rt.isAbsolute(k.fallbackLayoutsDir)?k.fallbackLayoutsDir:rt.resolve(process.cwd(),k.fallbackLayoutsDir),Z=v.startsWith("layouts/")?v.slice(8):v,se=[rt.join(Q,Z)];if(!v.endsWith(".stx"))se.push(`${se[0]}.stx`);for(let ie of se)if(await r(ie)){if(k.debug)console.log(`Found in options.fallbackLayoutsDir: ${ie}`);if(R)R.add(ie);return ie}}if(v.startsWith("layouts/")||v.includes("/layouts/")){let Q=v.split("layouts/"),Z=rt.join(k.partialsDir||T,"layouts",Q[1]);if(await r(Z)){if(k.debug)console.log(`Found in layouts path: ${Z}`);if(R)R.add(Z);return Z}if(!Z.endsWith(".stx")){let se=`${Z}.stx`;if(await r(se)){if(k.debug)console.log(`Found in layouts path with extension: ${se}`);if(R)R.add(se);return se}}}if(k.partialsDir){let Q=rt.join(k.partialsDir,"layouts");if(await r(Q)){let Z=rt.join(Q,v);if(await r(Z)){if(k.debug)console.log(`Found in partials layouts dir: ${Z}`);if(R)R.add(Z);return Z}if(!v.endsWith(".stx")){let se=`${Z}.stx`;if(await r(se)){if(k.debug)console.log(`Found in partials layouts dir with extension: ${se}`);if(R)R.add(se);return se}}}}let H=k.partialsDir||rt.join(process.cwd(),"views"),q=rt.join(H,v);if(await r(q)){if(k.debug)console.log(`Found in views path: ${q}`);if(R)R.add(q);return q}if(!v.endsWith(".stx")){let Q=`${q}.stx`;if(await r(Q)){if(k.debug)console.log(`Found in views path with extension: ${Q}`);if(R)R.add(Q);return Q}}if(T.includes("temp")){let Q=rt.join(rt.dirname(T),"layouts",v);if(await r(Q)){if(k.debug)console.log(`Found in temp layouts dir: ${Q}`);if(R)R.add(Q);return Q}if(!v.endsWith(".stx")){let Z=`${Q}.stx`;if(await r(Z)){if(k.debug)console.log(`Found in temp layouts dir with extension: ${Z}`);if(R)R.add(Z);return Z}}}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 Ci(v,_,k){let R=0,T="",B="";try{if(typeof _==="number"&&_>=0){let z=v.split(`
2673
2673
  `),W=0;for(let F=0;F<z.length;F++)if(W+=z[F].length+1,W>=_){R=F+1,T=z[F].trim();let V=Math.max(0,F-2),H=Math.min(z.length,F+3);B=z.slice(V,H).map((q,Q)=>{let Z=V+Q+1;return`${Z===R?"> ":" "}${Z}: ${q}`}).join(`
2674
2674
  `);break}}else if(k){let z=v.indexOf(k);if(z>=0)return Ci(v,z)}}catch{}return{lineNumber:R,lineContent:T,context:B}}var vt={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,R,T,B){let{lineNumber:z,context:W}=Ci(R,T,B),F=k.split("/").pop(),V=0;if(typeof T==="number"&&T>=0&&R){let q=R.lastIndexOf(`
2675
2675
  `,Math.max(0,T-1));V=T-(q+1)+1}let H="";if(z>0)H+=`
@@ -2684,7 +2684,7 @@ ${vt.yellow}${vt.bold}Message:${vt.reset} ${_}
2684
2684
  `,W)H+=`
2685
2685
  ${vt.blue}${vt.bold}Context:${vt.reset}
2686
2686
  ${vt.dim}${W}${vt.reset}
2687
- `;return H}function ne(){wo.clear(),Pa.clear(),Ru.clear(),Tu.clear(),Da.clear()}function cu(){return{size:wo.size,maxSize:500}}var Cu=m(128);async function m0(v,_,k){let R=h(v,_,k),T=Cu.get(R);if(T){if(cn(T.deps))return T;Cu.delete(R)}let B=ss(v,{filePath:_,projectRoot:process.cwd()}),z=B.code,W=os(B.styles);z=_t(z).code;let{hasUserImports:F,bundleClientScript:V}=await ht("stx/client-script-bundler",()=>import("./chunk-zv288w4e.js")),H=[],q=!1;if(F(z)){let ae=z;z=await V(ae,_,{projectRoot:process.cwd(),minify:k,collectInputs:H}),q=z===ae}let{stripStxRuntimeImports:Q}=await ht("stx/signal-processing",()=>import("./chunk-ne03tfje.js"));z=Q(z);let Z=O(z),se=a0(Z),ie=`function(__scopeId) {
2687
+ `;return H}function ne(){wo.clear(),Pa.clear(),yu.clear(),xu.clear(),Da.clear()}function cd(){return{size:wo.size,maxSize:500}}var hu=m(128);async function m0(v,_,k){let R=h(v,_,k),T=hu.get(R);if(T){if(cn(T.deps))return T;hu.delete(R)}let B=ss(v,{filePath:_,projectRoot:process.cwd()}),z=B.code,W=os(B.styles);z=_t(z).code;let{hasUserImports:F,bundleClientScript:V}=await ht("stx/client-script-bundler",()=>import("./chunk-cxqrwvc5.js")),H=[],q=!1;if(F(z)){let ae=z;z=await V(ae,_,{projectRoot:process.cwd(),minify:k,collectInputs:H}),q=z===ae}let{stripStxRuntimeImports:Q}=await ht("stx/signal-processing",()=>import("./chunk-xyzy84x0.js"));z=Q(z);let Z=O(z),se=a0(Z),ie=`function(__scopeId) {
2688
2688
  ${Nt("const",[...Hi,...se],Z)}
2689
2689
  const __scope = window.stx._scopes = window.stx._scopes || {};
2690
2690
  const __scopeVars = __scope[__scopeId] = __scope[__scopeId] || {};
@@ -2741,7 +2741,7 @@ finally {
2741
2741
  window.__STX_CURRENT_ELEMENT__ = __previousCurrentElement;
2742
2742
  window.__STX_CURRENT_PROPS__ = __previousCurrentProps;
2743
2743
  }
2744
- }`,oe={vendorStyleTags:W,factoryBody:ie,clientCode:Z,deps:_d([...H,...B.styles.map((ae)=>ae.resolvedPath)])};if(!q&&B.unresolved.length===0)Cu.set(R,oe);return oe}var h0=/^[ \t]*import\s+['"]([^'"]+?\.css)(\?[^'"]*)?['"]\s*;?\s*$/gm;function y0(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 x0(v,_){let k=_;while(!0){let R=Hr.join(k,"node_modules",v,"package.json");if(So.existsSync(R))return Hr.dirname(R);let T=Hr.dirname(k);if(T===k)return null;k=T}}function b0(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 R=null;for(let T of Object.keys(v)){let B=T.indexOf("*");if(B===-1)continue;let z=T.slice(0,B),W=T.slice(B+1);if(!_.startsWith(z)||!_.endsWith(W))continue;if(_.length<z.length+W.length)continue;if(!R||z.length>R.prefix.length)R={pattern:T,prefix:z,suffix:W}}if(R){let T=_.slice(R.prefix.length,_.length-R.suffix.length),B=k(v[R.pattern]);if(B)return B.replace("*",T)}return null}function v0(v,_){let k=y0(v);if(!k||!k.subpath)return null;let R=x0(k.pkg,_);if(!R)return null;let T;try{T=JSON.parse(So.readFileSync(Hr.join(R,"package.json"),"utf8"))}catch{return null}let B=`.${k.subpath}`,z=b0(T.exports,B);if(!z)return null;let W=Hr.resolve(R,z);return So.existsSync(W)?W:null}function ss(v,_){let k=_.filePath?Hr.dirname(_.filePath):_.projectRoot||process.cwd(),R=_.projectRoot||process.cwd(),T=new Set,B=[],z=[];return{code:v.replace(h0,(F,V)=>{let H;try{if(V.startsWith("./")||V.startsWith("../")||V.startsWith("/")){if(H=V.startsWith("/")?V:Hr.resolve(k,V),!So.existsSync(H))throw Error(`file not found: ${H}`)}else{let q=null;try{q=Bun.resolveSync(V,R)}catch{q=v0(V,R)}if(!q)throw Error(`could not resolve ${V} (Bun.resolveSync + exports fallback both failed)`);H=q}}catch(q){return console.warn(`[stx:vendor-css] could not resolve ${JSON.stringify(V)} (from ${_.filePath||"<unknown>"}): ${q?.message||q}`),z.push(V),""}if(T.has(H))return"";T.add(H);try{let q=So.readFileSync(H,"utf8");B.push({source:V,resolvedPath:H,contents:q})}catch(q){console.warn(`[stx:vendor-css] could not read ${H}: ${q?.message||q}`),z.push(V)}return""}),styles:B,unresolved:z}}function w0(v){return v.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function os(v){if(v.length===0)return"";return`${v.map((_)=>`<style data-stx-vendor="${w0(_.source)}" data-stx-layer="vendor">
2744
+ }`,oe={vendorStyleTags:W,factoryBody:ie,clientCode:Z,deps:Ld([...H,...B.styles.map((ae)=>ae.resolvedPath)])};if(!q&&B.unresolved.length===0)hu.set(R,oe);return oe}var h0=/^[ \t]*import\s+['"]([^'"]+?\.css)(\?[^'"]*)?['"]\s*;?\s*$/gm;function y0(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 x0(v,_){let k=_;while(!0){let R=Hr.join(k,"node_modules",v,"package.json");if(So.existsSync(R))return Hr.dirname(R);let T=Hr.dirname(k);if(T===k)return null;k=T}}function b0(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 R=null;for(let T of Object.keys(v)){let B=T.indexOf("*");if(B===-1)continue;let z=T.slice(0,B),W=T.slice(B+1);if(!_.startsWith(z)||!_.endsWith(W))continue;if(_.length<z.length+W.length)continue;if(!R||z.length>R.prefix.length)R={pattern:T,prefix:z,suffix:W}}if(R){let T=_.slice(R.prefix.length,_.length-R.suffix.length),B=k(v[R.pattern]);if(B)return B.replace("*",T)}return null}function v0(v,_){let k=y0(v);if(!k||!k.subpath)return null;let R=x0(k.pkg,_);if(!R)return null;let T;try{T=JSON.parse(So.readFileSync(Hr.join(R,"package.json"),"utf8"))}catch{return null}let B=`.${k.subpath}`,z=b0(T.exports,B);if(!z)return null;let W=Hr.resolve(R,z);return So.existsSync(W)?W:null}function ss(v,_){let k=_.filePath?Hr.dirname(_.filePath):_.projectRoot||process.cwd(),R=_.projectRoot||process.cwd(),T=new Set,B=[],z=[];return{code:v.replace(h0,(F,V)=>{let H;try{if(V.startsWith("./")||V.startsWith("../")||V.startsWith("/")){if(H=V.startsWith("/")?V:Hr.resolve(k,V),!So.existsSync(H))throw Error(`file not found: ${H}`)}else{let q=null;try{q=Bun.resolveSync(V,R)}catch{q=v0(V,R)}if(!q)throw Error(`could not resolve ${V} (Bun.resolveSync + exports fallback both failed)`);H=q}}catch(q){return console.warn(`[stx:vendor-css] could not resolve ${JSON.stringify(V)} (from ${_.filePath||"<unknown>"}): ${q?.message||q}`),z.push(V),""}if(T.has(H))return"";T.add(H);try{let q=So.readFileSync(H,"utf8");B.push({source:V,resolvedPath:H,contents:q})}catch(q){console.warn(`[stx:vendor-css] could not read ${H}: ${q?.message||q}`),z.push(V)}return""}),styles:B,unresolved:z}}function w0(v){return v.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function os(v){if(v.length===0)return"";return`${v.map((_)=>`<style data-stx-vendor="${w0(_.source)}" data-stx-layer="vendor">
2745
2745
  @layer vendor {
2746
2746
  ${_.contents}
2747
2747
  }
@@ -2752,7 +2752,7 @@ ${_.contents}
2752
2752
  ${v}`,imports:T,models:B}}var $0=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 kh(v){let _=new Set,k=Va(v),R=Ao(v),T=/(?<![\w$.])([A-Z][a-zA-Z0-9]*)\s*\.\s*(all|find|first|get|where|orderBy|orderByDesc|limit|select|pluck|create|update|delete)\s*\(/g;for(let B of k.code.matchAll(T)){let z=B[1];if($0.has(z)||R.has(z)||z.length<3)continue;if(k.shadows(z,B.index??0))continue;_.add(z)}return Array.from(_)}function _0(v){return Ao(v)}var Sh=m(128);function Zo(v){let _=h(v),k=Sh.get(_);if(!k)k=k0(v),Sh.set(_,k);return{code:k.code,stxImports:[...k.stxImports],browserImports:[...k.browserImports]}}function k0(v){let _=new Set,k=new Set,R=v;R=R.replace(/^[ \t]*import\s+type\s+\{[^}]*\}\s+from\s+['"][^'"]+['"][ \t]*;?[ \t]*$/gm,"// [type import stripped]");let T=new Set,B=/^[ \t]*import\s+(?:type\s+)?{\s*([^}]+)\s*}\s+from\s+['"](@stacksjs\/browser|@stacksjs\/stx|stx)['"][ \t]*;?[ \t]*$/gm,z;while((z=B.exec(v))!==null){let q=z[1],Q=z[2];if(z[0].includes("import type"))continue;let Z=[];for(let ie of q.split(",")){let oe=ie.trim();if(!oe||oe.startsWith("type "))continue;let ae=oe.match(/^([A-Za-z_$][\w$]*)(?:\s+as\s+([A-Za-z_$][\w$]*))?$/);if(!ae)continue;let le=ae[1],ce=ae[2]||le;if(T.add(le),T.add(ce),Q==="stx"||Q==="@stacksjs/stx")_.add(le);else k.add(le);if(ce!==le)Z.push(`${ce} = ${le}`)}let se=Z.length>0?`var ${Z.join(", ")}; /* [auto-import processed] */`:"// [auto-import processed]";R=R.replace(z[0],se)}let W=_0(R);for(let q of lc){if(T.has(q)||W.has(q))continue;if(is(R,q,!0))_.add(q)}let F=s(R),V=new Set;for(let q of R.matchAll(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm))for(let Q of q[1].split(",")){let Z=Q.trim().replace(/^type\s+/,"").split(/\s+as\s+/);for(let se of Z){let ie=se.trim();if(ie)V.add(ie)}}for(let q of K){if(T.has(q)||W.has(q)||V.has(q))continue;if(is(F,q))k.add(q)}let H=kh(F);for(let q of H)if(!T.has(q)&&!W.has(q))k.add(q);return{code:R,stxImports:Array.from(_),browserImports:Array.from(k)}}function is(v,_,k=!1){let R=Va(v);v=R.code;let T=new RegExp(`\\b${_.replace(/[$]/g,"\\$")}\\b`,"g");for(let B of v.matchAll(T)){let z=B.index??0;if(R.shadows(_,z))continue;let W=z+_.length,F=z-1;while(F>=0&&/\s/.test(v[F]))F--;if(v[F]==="."&&v.slice(Math.max(0,F-2),F+1)!=="...")continue;let V=W;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(W)))continue;if(E0(v,W))continue;return!0}return!1}function E0(v,_){let k=_;while(k<v.length&&(v[k]===" "||v[k]==="\t"))k++;if(v[k]!=="(")return!1;let R=0;for(;k<v.length;k++){let T=v[k];if(T==="(")R++;else if(T===")"){if(R--,R===0)break}}if(R!==0)return!1;k++;while(k<v.length&&(v[k]===" "||v[k]==="\t"))k++;return v[k]==="{"}function Qo(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
2753
2753
  ${k.join(`
2754
2754
  `)}
2755
- ${C0(v,_)}`;return""}function Fd(v,_=[]){let{browserImports:k}=Zo(v),R=new Set(_);return Qo([],k.filter((T)=>!R.has(T)))}function C0(v,_){let k=[...v.map((R)=>`['${R}', typeof ${R}, 'stx']`),..._.map((R)=>`['${R}', typeof ${R}, '@stacksjs/browser']`)];if(k.length===0)return"";return` // STX: report auto-imports the client runtime did not provide
2755
+ ${C0(v,_)}`;return""}function Fu(v,_=[]){let{browserImports:k}=Zo(v),R=new Set(_);return Qo([],k.filter((T)=>!R.has(T)))}function C0(v,_){let k=[...v.map((R)=>`['${R}', typeof ${R}, 'stx']`),..._.map((R)=>`['${R}', typeof ${R}, '@stacksjs/browser']`)];if(k.length===0)return"";return` // STX: report auto-imports the client runtime did not provide
2756
2756
  [${k.join(", ")}].forEach(function (e) {
2757
2757
  if (e[1] !== 'undefined') return;
2758
2758
  console.error(
@@ -2811,7 +2811,7 @@ else {
2811
2811
  // STX: auto-generated event bindings
2812
2812
  ${v.map((k,R)=>P0(k,R)).join(`
2813
2813
  `)}`}function _h(v){let _=[],k=new Set,R=v.replace(/^\s*import\s+.*$/gm,""),T=0,B=R.length,z=0;while(z<B){let W=R[z];if(W==="'"||W==='"'||W==="`"){let F=W;if(z++,F==="`"){let V=0;while(z<B){if(R[z]==="\\"){z+=2;continue}if(R[z]==="`"&&V===0){z++;break}if(R[z]==="$"&&R[z+1]==="{"){V++,z+=2;continue}if(R[z]==="}"&&V>0){V--,z++;continue}z++}}else while(z<B){if(R[z]==="\\"){z+=2;continue}if(R[z]===F){z++;break}z++}continue}if(W==="/"&&R[z+1]==="/"){while(z<B&&R[z]!==`
2814
- `)z++;continue}if(W==="/"&&R[z+1]==="*"){z+=2;while(z<B-1&&!(R[z]==="*"&&R[z+1]==="/"))z++;z+=2;continue}if(W==="{"){T++,z++;continue}if(W==="}"){T--,z++;continue}if(T===0){let F=R.slice(z),V=F.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(V){let Q=V[1];if(!Q.startsWith("_")&&!k.has(Q))_.push(Q),k.add(Q);z+=V[0].length;continue}let H=F.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(H){H[1].split(",").forEach((Q)=>{let Z=Q.trim(),se=Z.indexOf(":"),ie=se>=0?Z.slice(se+1).trim().split(/[\s=]/)[0]:Z.split(/[\s=]/)[0];if(ie&&!ie.startsWith("_")&&!k.has(ie))_.push(ie),k.add(ie)}),z+=H[0].length;continue}let q=F.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(q){let Q=q[1];if(!Q.startsWith("_")&&!k.has(Q))_.push(Q),k.add(Q);z+=q[0].length;continue}}z++}return _}var M0=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 O0(v){let _=new Set,k=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function R(Q){let Z;while((Z=k.exec(Q))!==null){let se=Z[0];if(!M0.has(se))_.add(se)}}let T=/\{\{([\s\S]*?)\}\}/g,B;while((B=T.exec(v))!==null)R(B[1]);let z=/:[a-z][\w.-]*\s*=\s*"([^"]*)"/gi;while((B=z.exec(v))!==null)R(B[1]);let W=/:[a-z][\w.-]*\s*=\s*'([^']*)'/gi;while((B=W.exec(v))!==null)R(B[1]);let F=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((B=F.exec(v))!==null)R(B[1]);let V=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((B=V.exec(v))!==null)R(B[1]);let H=/@model\s*=\s*["']([^"']*)["']/gi;while((B=H.exec(v))!==null)R(B[1]);let q=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((B=q.exec(v))!==null)R(B[1]);return _}async function we(v,_={}){let k=v,R="",T=!1,B=[],z=ss(k,{filePath:_.filePath,projectRoot:_.projectRoot});k=z.code;let W=os(z.styles),F=_t(k);k=F.code,B=[...F.imports,...F.models];let{hasUserImports:V,bundleClientScript:H}=await ht("stx/client-script-bundler",()=>import("./chunk-zv288w4e.js"));if(V(k))k=await H(k,_.filePath||"",{projectRoot:_.projectRoot,minify:_.production}),T=!0;if(_.autoImports!==!1){let ce=Zo(k);k=ce.code,R=Qo(ce.stxImports,ce.browserImports.filter((ge)=>!B.includes(ge)))}if(R=`${ln(k,_.serverData)}${R}`,k=O(k),!T&&Ge(_.attrs||""))k=Ke(k);let q=D0(_.eventBindings||[]),Q=(_.attrs||"").trim(),Z=/\btype\s*=\s*["']module["']/i.test(Q),se=_.instanceId?` data-stx-instance="${_.instanceId}"`:"";if(Z){let ce=Q.replace(/\btype\s*=\s*["']module["']/i,"").trim(),ge=`type="module" data-stx-scoped${se}${ce?` ${ce}`:""}`;return`${W}<script ${ge}>
2814
+ `)z++;continue}if(W==="/"&&R[z+1]==="*"){z+=2;while(z<B-1&&!(R[z]==="*"&&R[z+1]==="/"))z++;z+=2;continue}if(W==="{"){T++,z++;continue}if(W==="}"){T--,z++;continue}if(T===0){let F=R.slice(z),V=F.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(V){let Q=V[1];if(!Q.startsWith("_")&&!k.has(Q))_.push(Q),k.add(Q);z+=V[0].length;continue}let H=F.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(H){H[1].split(",").forEach((Q)=>{let Z=Q.trim(),se=Z.indexOf(":"),ie=se>=0?Z.slice(se+1).trim().split(/[\s=]/)[0]:Z.split(/[\s=]/)[0];if(ie&&!ie.startsWith("_")&&!k.has(ie))_.push(ie),k.add(ie)}),z+=H[0].length;continue}let q=F.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(q){let Q=q[1];if(!Q.startsWith("_")&&!k.has(Q))_.push(Q),k.add(Q);z+=q[0].length;continue}}z++}return _}var M0=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 O0(v){let _=new Set,k=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function R(Q){let Z;while((Z=k.exec(Q))!==null){let se=Z[0];if(!M0.has(se))_.add(se)}}let T=/\{\{([\s\S]*?)\}\}/g,B;while((B=T.exec(v))!==null)R(B[1]);let z=/:[a-z][\w.-]*\s*=\s*"([^"]*)"/gi;while((B=z.exec(v))!==null)R(B[1]);let W=/:[a-z][\w.-]*\s*=\s*'([^']*)'/gi;while((B=W.exec(v))!==null)R(B[1]);let F=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((B=F.exec(v))!==null)R(B[1]);let V=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((B=V.exec(v))!==null)R(B[1]);let H=/@model\s*=\s*["']([^"']*)["']/gi;while((B=H.exec(v))!==null)R(B[1]);let q=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((B=q.exec(v))!==null)R(B[1]);return _}async function ve(v,_={}){let k=v,R="",T=!1,B=[],z=ss(k,{filePath:_.filePath,projectRoot:_.projectRoot});k=z.code;let W=os(z.styles),F=_t(k);k=F.code,B=[...F.imports,...F.models];let{hasUserImports:V,bundleClientScript:H}=await ht("stx/client-script-bundler",()=>import("./chunk-cxqrwvc5.js"));if(V(k))k=await H(k,_.filePath||"",{projectRoot:_.projectRoot,minify:_.production}),T=!0;if(_.autoImports!==!1){let ce=Zo(k);k=ce.code,R=Qo(ce.stxImports,ce.browserImports.filter((ge)=>!B.includes(ge)))}if(R=`${ln(k,_.serverData)}${R}`,k=O(k),!T&&Ge(_.attrs||""))k=Ke(k);let q=D0(_.eventBindings||[]),Q=(_.attrs||"").trim(),Z=/\btype\s*=\s*["']module["']/i.test(Q),se=_.instanceId?` data-stx-instance="${_.instanceId}"`:"";if(Z){let ce=Q.replace(/\btype\s*=\s*["']module["']/i,"").trim(),ge=`type="module" data-stx-scoped${se}${ce?` ${ce}`:""}`;return`${W}<script ${ge}>
2815
2815
  ${Ai(`${R}${k}
2816
2816
  ${q}`)}
2817
2817
  </script>`}let ie=qs(v),oe=/function __stx_setup_/.test(k),ae=/\bstx\.mount\s*\(|\bstx\.mountEl\s*\(/.test(v);function le(ce){let ge=ce.length>0?`
@@ -2835,4 +2835,4 @@ ${q}`)}
2835
2835
  console.error(${JSON.stringify(`[stx] client block failed${_.filePath?` (${_.filePath})`:""}; this block will not hydrate`)}, error);
2836
2836
  }
2837
2837
  })()</script>`}
2838
- export{Wn,Be,Ct,N,G,m,h,cn,K,w,Fe,ss,os,lc,_t,Zo,is,Qo,Fd,be,ln,we,ei,ti,ni,as,U,ze,ee,Et,qn,dc,zd,uc,Hd,pc,Gn,b,Tt,ve,fc,cs,gc,Ud,X,mc,Vd,x,Wd,hc,qd,Gd,Kd,Xd,yc,bc,Jd,Yd,ri,Zd,dn,un,Kn,Xn,e,Qd,si,eu,oi,wc,vc,$t,pn,tu,xc,Sc,nu,f,He,Rt,Ue,Ve,ii,Jn,te,ls,ds,us,ru,Yn,su,fn,We,ps,gs,kc,de,ai,ci,li,di,Zn,ms,ui,pi,fi,Cc,hs,L,ue,J,ou,_c,ys,bs,gi,mi,ws,vs,Qn,Ec,hi,yi,Tc,qe,gn,er,At,$c,Rc,Ac,Pc,Ic,d,Oc,xs,Dc,bi,wi,Ss,vi,Mc,iu,Nc,xe,xi,au,ks,Cs,_s,Si,Es,Ts,$s,Rs,n,Lc,jc,Bc,Fc,zc,Hc,Ge,j,Ke,Uc,tr,Vc,ki,Wc,Xe,r,nr,Ci,g,ne,cu,rr,A,qc,As,o,P,lu,du,pe};
2838
+ export{qn,Be,Ct,N,G,m,h,cn,K,w,Fe,ss,os,lc,_t,Zo,is,Qo,Fu,be,ln,ve,ei,ti,ni,as,U,ze,ee,Et,Gn,uc,zu,dc,Hu,pc,Kn,b,Tt,we,fc,cs,gc,Uu,X,mc,Vu,x,Wu,hc,qu,Gu,Ku,Xu,yc,bc,Ju,Yu,ri,Zu,un,dn,Xn,Jn,e,Qu,si,ed,oi,vc,wc,$t,pn,td,xc,Sc,nd,f,He,Rt,Ue,Ve,ii,Yn,te,ls,us,ds,rd,Zn,sd,fn,We,ps,gs,kc,ue,ai,ci,li,ui,Qn,ms,di,pi,fi,Cc,hs,L,de,J,od,_c,ys,bs,gi,mi,vs,ws,er,Ec,hi,yi,Tc,qe,gn,tr,At,$c,Rc,Ac,Pc,Ic,u,Oc,xs,Dc,bi,vi,Ss,wi,Mc,id,Nc,xe,xi,ad,ks,Cs,_s,Si,Es,Ts,$s,Rs,n,Lc,jc,Bc,Fc,zc,Hc,Ge,j,Ke,Uc,nr,Vc,ki,Wc,Xe,r,rr,Ci,g,ne,cd,sr,A,qc,As,o,P,ld,ud,pe};